From: support Date: Tue, 6 Sep 2022 21:24:34 +0000 (+0000) Subject: Built motion from commit 94e49db2.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%201101license.mail?a=commitdiff_plain;h=5cb3926aded9bbd433243f437523376c4dd3e04f;p=motion2.git Built motion from commit 94e49db2.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b612810..711da9e 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-09-06T12:11:29.129Z", + "time": "2022-09-06T21:16:56.509Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a9c8163..a16d879 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-06T12:11:29.129Z", + "time": "2022-09-06T21:16:56.509Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/package.json b/package.json index 6d6dbe7..3ccea66 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,9 @@ "prettier:write": "prettier --write './**/*'", "format-all": "npm run js-beautify && npm run prettier:write", "test": "mocha server/test --timeout 5000", - "aux-containers": "docker-compose up -d database cache" + "aux-containers": "docker-compose up -d database cache", + "db-dump": "docker-compose exec -u root database /xmotion_mysql_bk.sh dump", + "db-restore": "docker-compose exec -u root database /xmotion_mysql_bk.sh restore" }, "dependencies": { "@types/express-serve-static-core": "4.17.28", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 720658a..e54eed9 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 _0xa123=['exports','getDataValue','STRING','contactManager','integration','jscripty','urlForward','bot','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]'];(function(_0x370a82,_0x1d2de6){var _0x4c4100=function(_0x4c58e1){while(--_0x4c58e1){_0x370a82['push'](_0x370a82['shift']());}};_0x4c4100(++_0x1d2de6);}(_0xa123,0x1c2));var _0x3a12=function(_0x15a05d,_0x5c3a8f){_0x15a05d=_0x15a05d-0x0;var _0x33fe3f=_0xa123[_0x15a05d];return _0x33fe3f;};'use strict';var Sequelize=require('sequelize');module[_0x3a12('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x165f48){return this[_0x3a12('0x1')]('action');}},'action':{'type':Sequelize[_0x3a12('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3a12('0x3'),_0x3a12('0x4'),'motionbar',_0x3a12('0x5'),_0x3a12('0x6'),'browser',_0x3a12('0x7'),_0x3a12('0x8')]],'msg':_0x3a12('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3a12('0x2')](0x1000),'comment':_0x3a12('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x3a12('0x2')](0x1000),'comments':_0x3a12('0xb')},'data5':{'type':Sequelize[_0x3a12('0x2')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x3a12('0x2')],'comments':_0x3a12('0xc')},'data7':{'type':Sequelize[_0x3a12('0xd')],'comments':_0x3a12('0xe')}}; \ No newline at end of file +var _0x83ff=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty','browser','bot','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)]'];(function(_0x5d6dc2,_0x1338ad){var _0xa5fccb=function(_0x320a9c){while(--_0x320a9c){_0x5d6dc2['push'](_0x5d6dc2['shift']());}};_0xa5fccb(++_0x1338ad);}(_0x83ff,0x17f));var _0xf83f=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x83ff[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');module[_0xf83f('0x0')]={'name':{'type':Sequelize[_0xf83f('0x1')],'get':function(_0x3d2138){return this[_0xf83f('0x2')](_0xf83f('0x3'));}},'action':{'type':Sequelize[_0xf83f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xf83f('0x5'),_0xf83f('0x6'),_0xf83f('0x7'),'urlForward',_0xf83f('0x8'),_0xf83f('0x9'),_0xf83f('0xa')]],'msg':_0xf83f('0xb')}},'comment':_0xf83f('0xb')},'data1':{'type':Sequelize[_0xf83f('0x4')](0x1000),'comment':_0xf83f('0xc')},'data2':{'type':Sequelize[_0xf83f('0x4')](0x1000),'comment':_0xf83f('0xd')},'data3':{'type':Sequelize[_0xf83f('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xf83f('0xe')},'data5':{'type':Sequelize[_0xf83f('0x4')](0x1000),'comments':_0xf83f('0xf')},'data6':{'type':Sequelize[_0xf83f('0x4')],'comments':_0xf83f('0x10')},'data7':{'type':Sequelize['TEXT'],'comments':_0xf83f('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e6c0628..9b6a8ff 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 _0x2398=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','find','params','catch','Action','request-promise','moment','bluebird','mustache','util'];(function(_0x459a2d,_0x48d0db){var _0x44a5ba=function(_0x3864ba){while(--_0x3864ba){_0x459a2d['push'](_0x459a2d['shift']());}};_0x44a5ba(++_0x48d0db);}(_0x2398,0x136));var _0x8239=function(_0xe7f722,_0x3aa747){_0xe7f722=_0xe7f722-0x0;var _0x41b750=_0x2398[_0xe7f722];return _0x41b750;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8239('0x0'));var moment=require(_0x8239('0x1'));var BPromise=require(_0x8239('0x2'));var Mustache=require(_0x8239('0x3'));var util=require(_0x8239('0x4'));var path=require(_0x8239('0x5'));var sox=require(_0x8239('0x6'));var csv=require(_0x8239('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8239('0x8'));var _=require(_0x8239('0x9'));var squel=require(_0x8239('0xa'));var crypto=require(_0x8239('0xb'));var jsforce=require(_0x8239('0xc'));var deskjs=require(_0x8239('0xd'));var toCsv=require(_0x8239('0x7'));var querystring=require(_0x8239('0xe'));var Papa=require('papaparse');var Redis=require(_0x8239('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8239('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8239('0x11'))(_0x8239('0x12'));var utils=require(_0x8239('0x13'));var config=require(_0x8239('0x14'));var licenseUtil=require(_0x8239('0x15'));var db=require(_0x8239('0x16'))['db'];function respondWithStatusCode(_0x2b58bc,_0x2ca0c2){_0x2ca0c2=_0x2ca0c2||0xcc;return function(_0x1958b1){if(_0x1958b1){return _0x2b58bc[_0x8239('0x17')](_0x2ca0c2);}return _0x2b58bc[_0x8239('0x18')](_0x2ca0c2)['end']();};}function respondWithResult(_0x92b464,_0x40237f){_0x40237f=_0x40237f||0xc8;return function(_0x3a4cf9){if(_0x3a4cf9){return _0x92b464[_0x8239('0x18')](_0x40237f)['json'](_0x3a4cf9);}};}function respondWithFilteredResult(_0x2f110b,_0x5cd316){return function(_0x7c5f76){if(_0x7c5f76){var _0x461cde=typeof _0x5cd316['offset']===_0x8239('0x19')&&typeof _0x5cd316[_0x8239('0x1a')]===_0x8239('0x19');var _0x3f7a97=_0x7c5f76[_0x8239('0x1b')];var _0xc75a95=_0x461cde?0x0:_0x5cd316[_0x8239('0x1c')];var _0x22a2a7=_0x461cde?_0x7c5f76[_0x8239('0x1b')]:_0x5cd316['offset']+_0x5cd316['limit'];var _0x34bc88;if(_0x22a2a7>=_0x3f7a97){_0x22a2a7=_0x3f7a97;_0x34bc88=0xc8;}else{_0x34bc88=0xce;}_0x2f110b[_0x8239('0x18')](_0x34bc88);return _0x2f110b[_0x8239('0x1d')](_0x8239('0x1e'),_0xc75a95+'-'+_0x22a2a7+'/'+_0x3f7a97)[_0x8239('0x1f')](_0x7c5f76);}return null;};}function patchUpdates(_0x584e1e){return function(_0x594ceb){try{jsonpatch['apply'](_0x594ceb,_0x584e1e,!![]);}catch(_0x22a5dd){return BPromise[_0x8239('0x20')](_0x22a5dd);}return _0x594ceb[_0x8239('0x21')]();};}function saveUpdates(_0x57ec27,_0x228a17){return function(_0x1b2cbd){if(_0x1b2cbd){return _0x1b2cbd[_0x8239('0x22')](_0x57ec27)[_0x8239('0x23')](function(_0x31ffb6){return _0x31ffb6;});}return null;};}function removeEntity(_0x55288c,_0x4d0ade){return function(_0x5210ff){if(_0x5210ff){return _0x5210ff[_0x8239('0x24')]()['then'](function(){_0x55288c['status'](0xcc)[_0x8239('0x25')]();});}};}function handleEntityNotFound(_0x590628,_0x3c1179){return function(_0x4c2aa7){if(!_0x4c2aa7){_0x590628['sendStatus'](0x194);}return _0x4c2aa7;};}function handleError(_0x6a0f7,_0x1da5f8){_0x1da5f8=_0x1da5f8||0x1f4;return function(_0x4ecaf4){logger[_0x8239('0x26')](_0x4ecaf4['stack']);if(_0x4ecaf4[_0x8239('0x27')]){delete _0x4ecaf4[_0x8239('0x27')];}_0x6a0f7[_0x8239('0x18')](_0x1da5f8)[_0x8239('0x28')](_0x4ecaf4);};}exports[_0x8239('0x22')]=function(_0x3aef8c,_0x2776bb){if(_0x3aef8c['body']['id']){delete _0x3aef8c['body']['id'];}return db['Action'][_0x8239('0x29')]({'where':{'id':_0x3aef8c[_0x8239('0x2a')]['id']}})[_0x8239('0x23')](handleEntityNotFound(_0x2776bb,null))[_0x8239('0x23')](saveUpdates(_0x3aef8c['body'],null))['then'](respondWithResult(_0x2776bb,null))[_0x8239('0x2b')](handleError(_0x2776bb,null));};exports[_0x8239('0x24')]=function(_0x202bce,_0x4d3ab0){return db[_0x8239('0x2c')][_0x8239('0x29')]({'where':{'id':_0x202bce[_0x8239('0x2a')]['id']}})[_0x8239('0x23')](handleEntityNotFound(_0x4d3ab0,null))['then'](removeEntity(_0x4d3ab0,null))['catch'](handleError(_0x4d3ab0,null));}; \ No newline at end of file +var _0xd1f3=['Action','find','params','catch','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','body'];(function(_0x56166f,_0x4703b6){var _0x3f1854=function(_0x319c82){while(--_0x319c82){_0x56166f['push'](_0x56166f['shift']());}};_0x3f1854(++_0x4703b6);}(_0xd1f3,0x16c));var _0x3d1f=function(_0x5d5abb,_0x4c4e39){_0x5d5abb=_0x5d5abb-0x0;var _0x442e5c=_0xd1f3[_0x5d5abb];return _0x442e5c;};'use strict';var emlformat=require(_0x3d1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d1f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d1f('0x2'));var moment=require(_0x3d1f('0x3'));var BPromise=require(_0x3d1f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d1f('0x5'));var sox=require(_0x3d1f('0x6'));var csv=require(_0x3d1f('0x7'));var ejs=require(_0x3d1f('0x8'));var fs=require('fs');var fs_extra=require(_0x3d1f('0x9'));var _=require(_0x3d1f('0xa'));var squel=require(_0x3d1f('0xb'));var crypto=require(_0x3d1f('0xc'));var jsforce=require(_0x3d1f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d1f('0x7'));var querystring=require('querystring');var Papa=require(_0x3d1f('0xe'));var Redis=require(_0x3d1f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3d1f('0x10'));var as=require(_0x3d1f('0x11'));var hardwareService=require(_0x3d1f('0x12'));var logger=require('../../config/logger')(_0x3d1f('0x13'));var utils=require(_0x3d1f('0x14'));var config=require(_0x3d1f('0x15'));var licenseUtil=require(_0x3d1f('0x16'));var db=require(_0x3d1f('0x17'))['db'];function respondWithStatusCode(_0x3aa3e7,_0x358210){_0x358210=_0x358210||0xcc;return function(_0x529eac){if(_0x529eac){return _0x3aa3e7['sendStatus'](_0x358210);}return _0x3aa3e7[_0x3d1f('0x18')](_0x358210)[_0x3d1f('0x19')]();};}function respondWithResult(_0x4a3814,_0x1bbd39){_0x1bbd39=_0x1bbd39||0xc8;return function(_0x29d38a){if(_0x29d38a){return _0x4a3814[_0x3d1f('0x18')](_0x1bbd39)[_0x3d1f('0x1a')](_0x29d38a);}};}function respondWithFilteredResult(_0x228b6f,_0xfebf98){return function(_0x142ff6){if(_0x142ff6){var _0x361f2a=typeof _0xfebf98['offset']===_0x3d1f('0x1b')&&typeof _0xfebf98[_0x3d1f('0x1c')]===_0x3d1f('0x1b');var _0x2d083c=_0x142ff6[_0x3d1f('0x1d')];var _0x52db49=_0x361f2a?0x0:_0xfebf98[_0x3d1f('0x1e')];var _0x53c304=_0x361f2a?_0x142ff6[_0x3d1f('0x1d')]:_0xfebf98[_0x3d1f('0x1e')]+_0xfebf98[_0x3d1f('0x1c')];var _0x3b0c8e;if(_0x53c304>=_0x2d083c){_0x53c304=_0x2d083c;_0x3b0c8e=0xc8;}else{_0x3b0c8e=0xce;}_0x228b6f[_0x3d1f('0x18')](_0x3b0c8e);return _0x228b6f['set'](_0x3d1f('0x1f'),_0x52db49+'-'+_0x53c304+'/'+_0x2d083c)[_0x3d1f('0x1a')](_0x142ff6);}return null;};}function patchUpdates(_0x59043e){return function(_0x556cf5){try{jsonpatch['apply'](_0x556cf5,_0x59043e,!![]);}catch(_0x350efd){return BPromise[_0x3d1f('0x20')](_0x350efd);}return _0x556cf5[_0x3d1f('0x21')]();};}function saveUpdates(_0x46708c,_0x496ad9){return function(_0x4b60e6){if(_0x4b60e6){return _0x4b60e6[_0x3d1f('0x22')](_0x46708c)[_0x3d1f('0x23')](function(_0x45fa78){return _0x45fa78;});}return null;};}function removeEntity(_0x2267b3,_0xbe10bd){return function(_0x4ef02e){if(_0x4ef02e){return _0x4ef02e[_0x3d1f('0x24')]()[_0x3d1f('0x23')](function(){_0x2267b3[_0x3d1f('0x18')](0xcc)[_0x3d1f('0x19')]();});}};}function handleEntityNotFound(_0x3d117c,_0x180519){return function(_0x447953){if(!_0x447953){_0x3d117c[_0x3d1f('0x25')](0x194);}return _0x447953;};}function handleError(_0x741c96,_0x25a336){_0x25a336=_0x25a336||0x1f4;return function(_0x3c5b28){logger['error'](_0x3c5b28[_0x3d1f('0x26')]);if(_0x3c5b28[_0x3d1f('0x27')]){delete _0x3c5b28[_0x3d1f('0x27')];}_0x741c96['status'](_0x25a336)['send'](_0x3c5b28);};}exports[_0x3d1f('0x22')]=function(_0x50e993,_0xc64882){if(_0x50e993[_0x3d1f('0x28')]['id']){delete _0x50e993['body']['id'];}return db[_0x3d1f('0x29')][_0x3d1f('0x2a')]({'where':{'id':_0x50e993[_0x3d1f('0x2b')]['id']}})[_0x3d1f('0x23')](handleEntityNotFound(_0xc64882,null))['then'](saveUpdates(_0x50e993[_0x3d1f('0x28')],null))[_0x3d1f('0x23')](respondWithResult(_0xc64882,null))[_0x3d1f('0x2c')](handleError(_0xc64882,null));};exports[_0x3d1f('0x24')]=function(_0x2013da,_0x9bacbd){return db['Action']['find']({'where':{'id':_0x2013da[_0x3d1f('0x2b')]['id']}})[_0x3d1f('0x23')](handleEntityNotFound(_0x9bacbd,null))[_0x3d1f('0x23')](removeEntity(_0x9bacbd,null))[_0x3d1f('0x2c')](handleError(_0x9bacbd,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 51d4d15..c610a38 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 _0xa862=['request-promise','rimraf','./action.attributes','exports','define','Action','lodash','util','api','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa862,0x95));var _0x2a86=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xa862[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0x2a86('0x0'));var util=require(_0x2a86('0x1'));var logger=require('../../config/logger')(_0x2a86('0x2'));var moment=require(_0x2a86('0x3'));var BPromise=require(_0x2a86('0x4'));var rp=require(_0x2a86('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a86('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a86('0x7'));module[_0x2a86('0x8')]=function(_0x3cf4bc,_0x182942){return _0x3cf4bc[_0x2a86('0x9')](_0x2a86('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x621a=['api','moment','request-promise','path','rimraf','../../config/environment','exports','Action','tools_actions','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x621a,0x195));var _0xa621=function(_0x2af47e,_0x1d2a86){_0x2af47e=_0x2af47e-0x0;var _0x5bca26=_0x621a[_0x2af47e];return _0x5bca26;};'use strict';var _=require('lodash');var util=require(_0xa621('0x0'));var logger=require(_0xa621('0x1'))(_0xa621('0x2'));var moment=require(_0xa621('0x3'));var BPromise=require('bluebird');var rp=require(_0xa621('0x4'));var fs=require('fs');var path=require(_0xa621('0x5'));var rimraf=require(_0xa621('0x6'));var config=require(_0xa621('0x7'));var attributes=require('./action.attributes');module[_0xa621('0x8')]=function(_0x99b1c5,_0x4b3a3b){return _0x99b1c5['define'](_0xa621('0x9'),attributes,{'tableName':_0xa621('0xa'),'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 910822c..578471d 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5968a5,_0x1b4179){var _0x10dabc=function(_0x54c04a){while(--_0x54c04a){_0x5968a5['push'](_0x5968a5['shift']());}};_0x10dabc(++_0x1b4179);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x5fc3[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x7a54=['info','Action,\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(_0x383284,_0x4f42fb){_0x383284=_0x383284-0x0;var _0x63402a=_0x7a54[_0x383284];return _0x63402a;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index ca3e950..6dbec76 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 _0x1453=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1453,0xd0));var _0x3145=function(_0x404715,_0x5b4d86){_0x404715=_0x404715-0x0;var _0x198d48=_0x1453[_0x404715];return _0x198d48;};'use strict';var multer=require(_0x3145('0x0'));var util=require('util');var path=require(_0x3145('0x1'));var timeout=require(_0x3145('0x2'));var express=require('express');var router=express[_0x3145('0x3')]();var fs_extra=require(_0x3145('0x4'));var auth=require(_0x3145('0x5'));var interaction=require(_0x3145('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x3145('0x7')](_0x3145('0x8'),auth[_0x3145('0x9')](),controller['update']);router[_0x3145('0xa')](_0x3145('0x8'),auth[_0x3145('0x9')](),controller[_0x3145('0xb')]);module[_0x3145('0xc')]=router; \ No newline at end of file +var _0x8b83=['path','connect-timeout','express','fs-extra','../../config/environment','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x41d7fb,_0x4ee9a6){var _0x4c42bc=function(_0x24479a){while(--_0x24479a){_0x41d7fb['push'](_0x41d7fb['shift']());}};_0x4c42bc(++_0x4ee9a6);}(_0x8b83,0xfa));var _0x38b8=function(_0x37b069,_0x1b79a7){_0x37b069=_0x37b069-0x0;var _0x236863=_0x8b83[_0x37b069];return _0x236863;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x38b8('0x0'));var timeout=require(_0x38b8('0x1'));var express=require(_0x38b8('0x2'));var router=express['Router']();var fs_extra=require(_0x38b8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x38b8('0x4'));var controller=require('./action.controller');router['put'](_0x38b8('0x5'),auth[_0x38b8('0x6')](),controller['update']);router[_0x38b8('0x7')](_0x38b8('0x5'),auth[_0x38b8('0x6')](),controller[_0x38b8('0x8')]);module[_0x38b8('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 912e308..e5931f3 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 _0x7217=['sequelize','STRING','TEXT'];(function(_0x58a6e8,_0x4f6603){var _0x35ef3e=function(_0x28e9be){while(--_0x28e9be){_0x58a6e8['push'](_0x58a6e8['shift']());}};_0x35ef3e(++_0x4f6603);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xafc4=['sequelize','STRING','TEXT'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xafc4,0x69));var _0x4afc=function(_0x350ca1,_0x2f8068){_0x350ca1=_0x350ca1-0x0;var _0x10a6b4=_0xafc4[_0x350ca1];return _0x10a6b4;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 04c70ce..3d9f4e8 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 _0x5244=['options','includeAll','include','rows','catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','params','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%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)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','AVG(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','run','ROUND(%s)','IS\x20EMPTY','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x58256e,_0x48f062){var _0xc9e57b=function(_0x32fb7b){while(--_0x32fb7b){_0x58256e['push'](_0x58256e['shift']());}};_0xc9e57b(++_0x48f062);}(_0x5244,0x1a2));var _0x4524=function(_0x2de602,_0x2157a8){_0x2de602=_0x2de602-0x0;var _0x48514a=_0x5244[_0x2de602];return _0x48514a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4524('0x0'));var zipdir=require(_0x4524('0x1'));var jsonpatch=require(_0x4524('0x2'));var rp=require('request-promise');var moment=require(_0x4524('0x3'));var BPromise=require(_0x4524('0x4'));var Mustache=require(_0x4524('0x5'));var util=require(_0x4524('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4524('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4524('0x8'));var _=require(_0x4524('0x9'));var squel=require(_0x4524('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4524('0x7'));var querystring=require(_0x4524('0xb'));var Papa=require(_0x4524('0xc'));var Redis=require(_0x4524('0xd'));var authService=require(_0x4524('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4524('0xf'));var hardwareService=require(_0x4524('0x10'));var logger=require(_0x4524('0x11'))(_0x4524('0x12'));var utils=require(_0x4524('0x13'));var config=require(_0x4524('0x14'));var licenseUtil=require(_0x4524('0x15'));var db=require(_0x4524('0x16'))['db'];var dbH=require('../../mysqldb')[_0x4524('0x17')];function respondWithStatusCode(_0x5220c6,_0x20ed19){_0x20ed19=_0x20ed19||0xcc;return function(_0x15a6dc){if(_0x15a6dc){return _0x5220c6[_0x4524('0x18')](_0x20ed19);}return _0x5220c6[_0x4524('0x19')](_0x20ed19)[_0x4524('0x1a')]();};}function respondWithResult(_0x1d75a7,_0x207c8f){_0x207c8f=_0x207c8f||0xc8;return function(_0x1e0336){if(_0x1e0336){return _0x1d75a7[_0x4524('0x19')](_0x207c8f)[_0x4524('0x1b')](_0x1e0336);}};}function respondWithFilteredResult(_0x327686,_0x26418b){return function(_0x484921){if(_0x484921){var _0x19debe=typeof _0x26418b['offset']===_0x4524('0x1c')&&typeof _0x26418b['limit']===_0x4524('0x1c');var _0xd135dc=_0x484921[_0x4524('0x1d')];var _0x4b7fed=_0x19debe?0x0:_0x26418b['offset'];var _0x748feb=_0x19debe?_0x484921[_0x4524('0x1d')]:_0x26418b[_0x4524('0x1e')]+_0x26418b[_0x4524('0x1f')];var _0xeac76b;if(_0x748feb>=_0xd135dc){_0x748feb=_0xd135dc;_0xeac76b=0xc8;}else{_0xeac76b=0xce;}_0x327686[_0x4524('0x19')](_0xeac76b);return _0x327686['set'](_0x4524('0x20'),_0x4b7fed+'-'+_0x748feb+'/'+_0xd135dc)[_0x4524('0x1b')](_0x484921);}return null;};}function patchUpdates(_0x3450e5){return function(_0xf439e9){try{jsonpatch[_0x4524('0x21')](_0xf439e9,_0x3450e5,!![]);}catch(_0x5bc77d){return BPromise[_0x4524('0x22')](_0x5bc77d);}return _0xf439e9[_0x4524('0x23')]();};}function saveUpdates(_0x3e82b8,_0x2bdcff){return function(_0x1223a2){if(_0x1223a2){return _0x1223a2[_0x4524('0x24')](_0x3e82b8)[_0x4524('0x25')](function(_0x203590){return _0x203590;});}return null;};}function removeEntity(_0x335aac,_0xa75186){return function(_0x54599f){if(_0x54599f){return _0x54599f[_0x4524('0x26')]()['then'](function(){var _0x480571=_0x54599f[_0x4524('0x27')]({'plain':!![]});var _0x524e9b=_0x4524('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x524e9b,'resourceId':_0x480571['id']}})[_0x4524('0x25')](function(){return _0x54599f;});})[_0x4524('0x25')](function(){_0x335aac[_0x4524('0x19')](0xcc)[_0x4524('0x1a')]();});}};}function handleEntityNotFound(_0x2f398f,_0x4429ba){return function(_0x327a0f){if(!_0x327a0f){_0x2f398f[_0x4524('0x18')](0x194);}return _0x327a0f;};}function handleError(_0x288679,_0xb7c194){_0xb7c194=_0xb7c194||0x1f4;return function(_0x395073){logger[_0x4524('0x29')](_0x395073[_0x4524('0x2a')]);if(_0x395073[_0x4524('0x2b')]){delete _0x395073[_0x4524('0x2b')];}_0x288679[_0x4524('0x19')](_0xb7c194)[_0x4524('0x2c')](_0x395073);};}exports['index']=function(_0x57485c,_0x2d77bd){var _0x3fa467={},_0x32439b={},_0x971b4d={'count':0x0,'rows':[]};var _0x463211=_[_0x4524('0x2d')](db[_0x4524('0x2e')]['rawAttributes'],function(_0x4717e3){return{'name':_0x4717e3[_0x4524('0x2f')],'type':_0x4717e3[_0x4524('0x30')][_0x4524('0x31')]};});_0x32439b[_0x4524('0x32')]=_[_0x4524('0x2d')](_0x463211,_0x4524('0x2b'));_0x32439b[_0x4524('0x33')]=_[_0x4524('0x34')](_0x57485c[_0x4524('0x33')]);_0x32439b['filters']=_[_0x4524('0x35')](_0x32439b[_0x4524('0x32')],_0x32439b[_0x4524('0x33')]);_0x3fa467[_0x4524('0x36')]=_['intersection'](_0x32439b[_0x4524('0x32')],qs['fields'](_0x57485c[_0x4524('0x33')][_0x4524('0x37')]));_0x3fa467[_0x4524('0x36')]=_0x3fa467['attributes']['length']?_0x3fa467['attributes']:_0x32439b[_0x4524('0x32')];if(!_0x57485c['query'][_0x4524('0x38')](_0x4524('0x39'))){_0x3fa467[_0x4524('0x1f')]=qs[_0x4524('0x1f')](_0x57485c[_0x4524('0x33')]['limit']);_0x3fa467[_0x4524('0x1e')]=qs['offset'](_0x57485c[_0x4524('0x33')][_0x4524('0x1e')]);}_0x3fa467['order']=qs[_0x4524('0x3a')](_0x57485c[_0x4524('0x33')]['sort']);_0x3fa467[_0x4524('0x3b')]=qs[_0x4524('0x3c')](_[_0x4524('0x3d')](_0x57485c[_0x4524('0x33')],_0x32439b['filters']),_0x463211);if(_0x57485c[_0x4524('0x33')][_0x4524('0x3e')]){_0x3fa467['where']=_[_0x4524('0x3f')](_0x3fa467['where'],{'$or':_['map'](_0x463211,function(_0x29048d){if(_0x29048d[_0x4524('0x30')]!==_0x4524('0x40')){var _0x19ac29={};_0x19ac29[_0x29048d[_0x4524('0x2b')]]={'$like':'%'+_0x57485c['query'][_0x4524('0x3e')]+'%'};return _0x19ac29;}})});}_0x3fa467=_[_0x4524('0x3f')]({},_0x3fa467,_0x57485c[_0x4524('0x41')]);var _0x325da4={'where':_0x3fa467[_0x4524('0x3b')]};return db[_0x4524('0x2e')][_0x4524('0x1d')](_0x325da4)['then'](function(_0x3ca81d){_0x971b4d[_0x4524('0x1d')]=_0x3ca81d;if(_0x57485c[_0x4524('0x33')][_0x4524('0x42')]){_0x3fa467[_0x4524('0x43')]=[{'all':!![]}];}return db[_0x4524('0x2e')]['findAll'](_0x3fa467);})[_0x4524('0x25')](function(_0x210589){_0x971b4d[_0x4524('0x44')]=_0x210589;return _0x971b4d;})['then'](respondWithFilteredResult(_0x2d77bd,_0x3fa467))[_0x4524('0x45')](handleError(_0x2d77bd,null));};exports[_0x4524('0x46')]=function(_0x16de00,_0x47c150){var _0x528594={'raw':![],'where':{'id':_0x16de00['params']['id']}},_0x1b4581={};_0x1b4581['model']=_[_0x4524('0x34')](db[_0x4524('0x2e')]['rawAttributes']);_0x1b4581[_0x4524('0x33')]=_[_0x4524('0x34')](_0x16de00[_0x4524('0x33')]);_0x1b4581[_0x4524('0x3c')]=_[_0x4524('0x35')](_0x1b4581[_0x4524('0x32')],_0x1b4581[_0x4524('0x33')]);_0x528594[_0x4524('0x36')]=_[_0x4524('0x35')](_0x1b4581[_0x4524('0x32')],qs['fields'](_0x16de00[_0x4524('0x33')][_0x4524('0x37')]));_0x528594[_0x4524('0x36')]=_0x528594['attributes'][_0x4524('0x47')]?_0x528594[_0x4524('0x36')]:_0x1b4581[_0x4524('0x32')];if(_0x16de00['query']['includeAll']){_0x528594[_0x4524('0x43')]=[{'all':!![]}];}_0x528594=_[_0x4524('0x3f')]({},_0x528594,_0x16de00['options']);return db[_0x4524('0x2e')][_0x4524('0x48')](_0x528594)[_0x4524('0x25')](handleEntityNotFound(_0x47c150,null))[_0x4524('0x25')](respondWithResult(_0x47c150,null))[_0x4524('0x45')](handleError(_0x47c150,null));};exports[_0x4524('0x49')]=function(_0x85150b,_0x1774fa){return db[_0x4524('0x2e')][_0x4524('0x49')](_0x85150b['body'],{})[_0x4524('0x25')](function(_0x3eb4de){var _0x53e008=_0x85150b[_0x4524('0x4a')][_0x4524('0x27')]({'plain':!![]});if(!_0x53e008)throw new Error(_0x4524('0x4b'));if(_0x53e008[_0x4524('0x4c')]===_0x4524('0x4a')){var _0x389623=_0x3eb4de[_0x4524('0x27')]({'plain':!![]});var _0xe65fc2='Reports';return db['UserProfileSection']['find']({'where':{'name':_0xe65fc2,'userProfileId':_0x53e008['userProfileId']},'raw':!![]})[_0x4524('0x25')](function(_0x4868d5){if(_0x4868d5&&_0x4868d5[_0x4524('0x4d')]===0x0){return db['UserProfileResource'][_0x4524('0x49')]({'name':_0x389623[_0x4524('0x2b')],'resourceId':_0x389623['id'],'type':_0x4524('0x28'),'sectionId':_0x4868d5['id']},{})[_0x4524('0x25')](function(){return _0x3eb4de;});}else{return _0x3eb4de;}})[_0x4524('0x45')](function(_0x3bdc1d){logger[_0x4524('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bdc1d);throw _0x3bdc1d;});}return _0x3eb4de;})[_0x4524('0x25')](respondWithResult(_0x1774fa,0xc9))['catch'](handleError(_0x1774fa,null));};exports[_0x4524('0x24')]=function(_0x32e1ba,_0x4d31c1){if(_0x32e1ba['body']['id']){delete _0x32e1ba[_0x4524('0x4e')]['id'];}return db[_0x4524('0x2e')]['find']({'where':{'id':_0x32e1ba['params']['id']}})['then'](handleEntityNotFound(_0x4d31c1,null))[_0x4524('0x25')](saveUpdates(_0x32e1ba['body'],null))['then'](respondWithResult(_0x4d31c1,null))[_0x4524('0x45')](handleError(_0x4d31c1,null));};exports['destroy']=function(_0x16568a,_0x37caf9){return db[_0x4524('0x2e')][_0x4524('0x48')]({'where':{'id':_0x16568a[_0x4524('0x4f')]['id']}})[_0x4524('0x25')](handleEntityNotFound(_0x37caf9,null))[_0x4524('0x25')](removeEntity(_0x37caf9,null))[_0x4524('0x45')](handleError(_0x37caf9,null));};exports['preview']=function(_0x44a82e,_0xc5349e){var _0x4772c1=0xa;var _0x3f4eb9=[_0x4524('0x50'),_0x4524('0x51'),_0x4524('0x52'),_0x4524('0x53')];var _0x28dd72={'SUM':_0x4524('0x54'),'COUNT':_0x4524('0x55'),'COUNT DISTINCT':_0x4524('0x56'),'MAX':'MAX(%s)','MIN':_0x4524('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4524('0x58'),'GROUP_CONCAT ASC':_0x4524('0x59'),'GROUP_CONCAT DESC':_0x4524('0x5a')};var _0x498894={'SEC_TO_TIME':_0x4524('0x5b'),'DATE':_0x4524('0x5c'),'HOUR':_0x4524('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4524('0x5e')};var _0x3f8cc2=function(_0xb52929){return!_[_0x4524('0x5f')]([_0x4524('0x60'),_0x4524('0x61'),'IS\x20EMPTY',_0x4524('0x62')],_0xb52929);};var _0x4eace9=function(_0x50712d){if(!_0x50712d||!_0x50712d[_0x4524('0x63')][_0x4524('0x47')]){return'';}for(var _0x3e5d75='(',_0x50c3ce=0x0;_0x50c3ce<_0x50712d['rules'][_0x4524('0x47')];_0x50c3ce+=0x1){_0x50c3ce>0x0&&(_0x3e5d75+='\x20'+_0x50712d[_0x4524('0x64')]+'\x20');_0x3e5d75+=_0x50712d['rules'][_0x50c3ce][_0x4524('0x65')]?_0x4eace9(_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x65')]):_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x66')]+'\x20'+_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x67')]+(_0x3f8cc2(_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x67')])?'\x20'+_0x50712d[_0x4524('0x63')][_0x50c3ce]['value']:'');}return _0x3e5d75+')';};var _0x40170c={'where':{'id':_0x44a82e[_0x4524('0x4f')]['id']}},_0x5bf843,_0x5030e8,_0x3d86ac,_0x449355,_0x1072e6;_0x40170c=_[_0x4524('0x3f')]({},_0x40170c,_0x44a82e[_0x4524('0x41')]);return db[_0x4524('0x2e')][_0x4524('0x48')](_0x40170c)['then'](function(_0x5050bc){if(_0x5050bc){_0x5bf843=_0x5050bc;return _0x5050bc[_0x4524('0x68')]();}return null;})[_0x4524('0x25')](function(_0x59053d){if(_0x59053d){if(!_0x59053d[_0x4524('0x47')]){throw new db[(_0x4524('0x69'))][(_0x4524('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5030e8=_0x59053d;return db[_0x4524('0x6b')][_0x4524('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x23cb23){if(_0x23cb23){_0x3d86ac=_['keyBy'](_0x23cb23,'id');var _0x341156;var _0x302eba=squel['select']();_0x302eba['from'](_0x5bf843[_0x4524('0x6d')]);for(var _0x2c0638=0x0;_0x2c0638<_0x5030e8[_0x4524('0x47')];_0x2c0638+=0x1){_0x341156=_0x5030e8[_0x2c0638][_0x4524('0x6e')]?_0x3d86ac[_0x5030e8[_0x2c0638][_0x4524('0x6e')]][_0x4524('0x6f')]:_0x5030e8[_0x2c0638]['field'];_0x341156=_0x5030e8[_0x2c0638][_0x4524('0x70')]?_[_0x4524('0x71')](_0x28dd72[_0x5030e8[_0x2c0638][_0x4524('0x70')]],'%s',_0x341156):_0x341156;_0x341156=_0x5030e8[_0x2c0638][_0x4524('0x72')]?_[_0x4524('0x71')](_0x498894[_0x5030e8[_0x2c0638]['format']],'%s',_0x341156):_0x341156;if(_0x5030e8[_0x2c0638][_0x4524('0x73')]){_0x302eba[_0x4524('0x65')](_0x341156);}_0x5030e8[_0x2c0638][_0x4524('0x74')]&&_0x302eba[_0x4524('0x75')](_0x341156,_0x5030e8[_0x2c0638][_0x4524('0x74')]===_0x4524('0x76')?![]:!![]);_0x302eba[_0x4524('0x66')](_0x341156,_0x5030e8[_0x2c0638][_0x4524('0x77')]||_0x341156);}if(_0x5bf843[_0x4524('0x78')]){_0x5bf843[_0x4524('0x78')]=JSON[_0x4524('0x79')](_0x5bf843[_0x4524('0x78')]);for(var _0x5611a8=0x0;_0x5611a8<_0x5bf843[_0x4524('0x78')][_0x4524('0x47')];_0x5611a8+=0x1){if(_0x5bf843['joins'][_0x5611a8][_0x4524('0x30')]&&_['includes'](_0x3f4eb9,_0x5bf843[_0x4524('0x78')][_0x5611a8][_0x4524('0x30')])&&_0x5bf843['joins'][_0x5611a8]['parentKey']&&_0x5bf843['joins'][_0x5611a8][_0x4524('0x7a')]&&_0x5bf843[_0x4524('0x78')][_0x5611a8][_0x4524('0x7b')]){_0x302eba[_0x5bf843['joins'][_0x5611a8][_0x4524('0x30')]](_0x5bf843[_0x4524('0x78')][_0x5611a8][_0x4524('0x7a')],null,util[_0x4524('0x72')](_0x4524('0x7c'),_0x5bf843[_0x4524('0x6d')],_0x5bf843['joins'][_0x5611a8][_0x4524('0x7d')],_0x5bf843[_0x4524('0x78')][_0x5611a8]['foreignTable'],_0x5bf843['joins'][_0x5611a8][_0x4524('0x7b')]));}}}if(_0x5bf843['conditions']){_0x5bf843['conditions']=JSON[_0x4524('0x79')](_0x5bf843[_0x4524('0x7e')]);_0x302eba['where'](_0x4eace9(_0x5bf843[_0x4524('0x7e')]['group']));}_0x1072e6=_0x302eba[_0x4524('0x7f')]();_0x302eba[_0x4524('0x1f')](_0x4772c1);_0x302eba[_0x4524('0x1e')](0x0);logger[_0x4524('0x80')](_0x4524('0x81'),_0x302eba[_0x4524('0x82')]());return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x302eba[_0x4524('0x82')](),{'type':dbH[_0x4524('0x83')][_0x4524('0x84')][_0x4524('0x85')]});}})[_0x4524('0x25')](respondWithResult(_0xc5349e,null))[_0x4524('0x45')](handleError(_0xc5349e,null));};function runReport(_0x46f9d1,_0x1af37e,_0x5300e2){var _0x1e3dc1=_0x1af37e[_0x4524('0x2b')];var _0x2783c0=0xa;var _0x20ebf3=[_0x4524('0x50'),_0x4524('0x51'),_0x4524('0x52'),_0x4524('0x53')];var _0x3591f7={'SUM':_0x4524('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4524('0x56'),'MAX':_0x4524('0x86'),'MIN':_0x4524('0x57'),'AVG':_0x4524('0x87'),'GROUP_CONCAT':_0x4524('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4524('0x5a')};var _0x2defad={'SEC_TO_TIME':_0x4524('0x5b'),'DATE':_0x4524('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4524('0x5e')};var _0x40516c=function(_0x488fbb){return!_[_0x4524('0x5f')]([_0x4524('0x60'),_0x4524('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x488fbb);};var _0x3c3411=function(_0x41e308){if(!_0x41e308||!_0x41e308[_0x4524('0x63')][_0x4524('0x47')]){return'';}for(var _0x614245='(',_0x18b820=0x0;_0x18b820<_0x41e308[_0x4524('0x63')]['length'];_0x18b820+=0x1){_0x18b820>0x0&&(_0x614245+='\x20'+_0x41e308[_0x4524('0x64')]+'\x20');_0x614245+=_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x65')]?_0x3c3411(_0x41e308[_0x4524('0x63')][_0x18b820]['group']):_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x66')]+'\x20'+_0x41e308[_0x4524('0x63')][_0x18b820]['condition']+(_0x40516c(_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x67')])?'\x20'+_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x88')]:'');}return _0x614245+')';};var _0xa8338a={'where':{'id':_0x46f9d1['id']}},_0x377f50,_0x30bacd,_0x4225a1,_0x291d7a,_0x30f854;_0xa8338a=_['merge']({},_0xa8338a,_0x5300e2);return db[_0x4524('0x2e')][_0x4524('0x48')](_0xa8338a)[_0x4524('0x25')](function(_0x3f9618){if(_0x3f9618){_0x377f50=_0x3f9618;return _0x3f9618[_0x4524('0x68')]();}return null;})['then'](function(_0x3b55bf){if(_0x3b55bf){if(!_0x3b55bf[_0x4524('0x47')]){throw new db[(_0x4524('0x69'))][(_0x4524('0x6a'))](_0x4524('0x89'),0x193);}_0x30bacd=_0x3b55bf;return db[_0x4524('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x21c5f8){if(_0x21c5f8){_0x4225a1=_[_0x4524('0x8a')](_0x21c5f8,'id');var _0x8b324e;var _0xae14fe=squel[_0x4524('0x8b')]();_0xae14fe[_0x4524('0x8c')](_0x377f50[_0x4524('0x6d')]);for(var _0x1e6080=0x0;_0x1e6080<_0x30bacd[_0x4524('0x47')];_0x1e6080+=0x1){_0x8b324e=_0x30bacd[_0x1e6080]['MetricId']?_0x4225a1[_0x30bacd[_0x1e6080][_0x4524('0x6e')]][_0x4524('0x6f')]:_0x30bacd[_0x1e6080][_0x4524('0x66')];_0x8b324e=_0x30bacd[_0x1e6080]['function']?_[_0x4524('0x71')](_0x3591f7[_0x30bacd[_0x1e6080][_0x4524('0x70')]],'%s',_0x8b324e):_0x8b324e;_0x8b324e=_0x30bacd[_0x1e6080][_0x4524('0x72')]?_[_0x4524('0x71')](_0x2defad[_0x30bacd[_0x1e6080][_0x4524('0x72')]],'%s',_0x8b324e):_0x8b324e;if(_0x30bacd[_0x1e6080][_0x4524('0x73')]){_0xae14fe[_0x4524('0x65')](_0x8b324e);}_0x30bacd[_0x1e6080][_0x4524('0x74')]&&_0xae14fe[_0x4524('0x75')](_0x8b324e,_0x30bacd[_0x1e6080][_0x4524('0x74')]==='DESC'?![]:!![]);_0xae14fe[_0x4524('0x66')](_0x8b324e,_0x30bacd[_0x1e6080]['alias']||_0x8b324e);}if(_0x377f50[_0x4524('0x78')]){_0x377f50['joins']=JSON[_0x4524('0x79')](_0x377f50[_0x4524('0x78')]);for(var _0x4c5f3c=0x0;_0x4c5f3c<_0x377f50['joins']['length'];_0x4c5f3c+=0x1){if(_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x30')]&&_[_0x4524('0x5f')](_0x20ebf3,_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x30')])&&_0x377f50['joins'][_0x4c5f3c][_0x4524('0x7d')]&&_0x377f50[_0x4524('0x78')][_0x4c5f3c]['foreignTable']&&_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x7b')]){_0xae14fe[_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x30')]](_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x7a')],null,util[_0x4524('0x72')](_0x4524('0x7c'),_0x377f50['table'],_0x377f50['joins'][_0x4c5f3c][_0x4524('0x7d')],_0x377f50[_0x4524('0x78')][_0x4c5f3c]['foreignTable'],_0x377f50['joins'][_0x4c5f3c][_0x4524('0x7b')]));}}}if(_0x377f50[_0x4524('0x7e')]){_0x377f50[_0x4524('0x7e')]=JSON[_0x4524('0x79')](_0x377f50[_0x4524('0x7e')]);_0xae14fe['where'](_0x3c3411(_0x377f50[_0x4524('0x7e')][_0x4524('0x65')]));}_0x30f854=_0xae14fe[_0x4524('0x7f')]();_0xae14fe[_0x4524('0x1f')](_0x2783c0);_0xae14fe[_0x4524('0x1e')](0x0);return;}})[_0x4524('0x25')](function(){if(_0x1af37e[_0x4524('0x8d')]==='web'){return null;}var _0x3f3501=_[_0x4524('0x3f')](_0x1af37e,{'name':_0x1af37e[_0x4524('0x8e')]||_0x1af37e['name']||_0x377f50['name'],'basename':_0x1e3dc1,'savename':util[_0x4524('0x72')](_0x4524('0x8f'),_0x1af37e[_0x4524('0x2b')]||_0x377f50[_0x4524('0x2b')],require(_0x4524('0x90'))[_0x4524('0x91')](0x4),_0x1af37e['output']||_0x4524('0x92')),'reportId':_0x377f50['id'],'reportType':_0x4524('0x93')});return db[_0x4524('0x94')]['create'](_0x3f3501,{'raw':!![]});})['then'](function(_0x4b9ea8){if(_0x377f50[_0x4524('0x6d')]==='cdr'){_0x30f854[_0x4524('0x3b')](_0x377f50['table']+_0x4524('0x95'),_0x1af37e[_0x4524('0x96')],_0x1af37e[_0x4524('0x97')]);}else{_0x30f854['where'](_0x377f50[_0x4524('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1af37e[_0x4524('0x96')],_0x1af37e[_0x4524('0x97')]);}if(_0x4b9ea8){logger['info'](_0x4524('0x98'),_0x30f854[_0x4524('0x82')]());require('child_process')[_0x4524('0x99')](path[_0x4524('0x50')](__dirname,_0x4524('0x9a'),_0x4b9ea8[_0x4524('0x8d')]),[_0x4b9ea8['id'],_0x30f854[_0x4524('0x82')](),path[_0x4524('0x50')](__dirname,'../../files/reports',_0x4b9ea8[_0x4524('0x9b')]),_0x1e3dc1]);return _0x4b9ea8;}else{var _0x29eb37=squel[_0x4524('0x8b')]();_0x29eb37[_0x4524('0x8c')]('('+_0x30f854[_0x4524('0x82')]()+')',_0x4524('0x9c'));_0x29eb37[_0x4524('0x66')](_0x4524('0x9d'),'count');_0x30f854[_0x4524('0x1f')](_0x1af37e[_0x4524('0x1f')]||_0x2783c0);_0x30f854['offset'](_0x1af37e[_0x4524('0x1e')]||0x0);return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x29eb37[_0x4524('0x82')](),{'type':dbH['sequelize'][_0x4524('0x84')][_0x4524('0x85')]})[_0x4524('0x25')](function(_0x3c6b03){if(!_0x3c6b03[_0x4524('0x47')]){_0x291d7a=0x0;}else{_0x291d7a=_0x3c6b03[0x0][_0x4524('0x1d')]||0x0;}return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x30f854[_0x4524('0x82')](),{'type':dbH[_0x4524('0x83')][_0x4524('0x84')][_0x4524('0x85')]});})['then'](function(_0x5020c2){return{'rows':_0x5020c2||[],'count':_0x291d7a};});}});}exports[_0x4524('0x9e')]=function(_0x147a67,_0x26dd7b){return runReport(_0x147a67[_0x4524('0x4f')],_0x147a67[_0x4524('0x33')],_0x147a67['options'])[_0x4524('0x25')](respondWithResult(_0x26dd7b,null))['catch'](handleError(_0x26dd7b,null));};exports['runReport']=runReport;exports[_0x4524('0x33')]=function(_0x1b7bbd,_0x297eea){var _0x5c86c6=0xa;var _0x187dcb=[_0x4524('0x50'),_0x4524('0x51'),_0x4524('0x52'),'cross_join'];var _0x568371={'SUM':_0x4524('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4524('0x86'),'MIN':_0x4524('0x57'),'AVG':_0x4524('0x87'),'GROUP_CONCAT':_0x4524('0x58'),'GROUP_CONCAT ASC':_0x4524('0x59'),'GROUP_CONCAT DESC':_0x4524('0x5a')};var _0x1ba339={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x4524('0x5d'),'ROUND':_0x4524('0x9f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x40bfe7=function(_0x59fd3a){return!_[_0x4524('0x5f')]([_0x4524('0x60'),_0x4524('0x61'),_0x4524('0xa0'),_0x4524('0x62')],_0x59fd3a);};var _0x1ee2f9=function(_0x32d27c){if(!_0x32d27c||!_0x32d27c['rules'][_0x4524('0x47')]){return'';}for(var _0x10aa28='(',_0x1c159a=0x0;_0x1c159a<_0x32d27c['rules'][_0x4524('0x47')];_0x1c159a+=0x1){_0x1c159a>0x0&&(_0x10aa28+='\x20'+_0x32d27c[_0x4524('0x64')]+'\x20');_0x10aa28+=_0x32d27c['rules'][_0x1c159a]['group']?_0x1ee2f9(_0x32d27c[_0x4524('0x63')][_0x1c159a][_0x4524('0x65')]):_0x32d27c['rules'][_0x1c159a][_0x4524('0x66')]+'\x20'+_0x32d27c['rules'][_0x1c159a][_0x4524('0x67')]+(_0x40bfe7(_0x32d27c['rules'][_0x1c159a]['condition'])?'\x20'+_0x32d27c[_0x4524('0x63')][_0x1c159a]['value']:'');}return _0x10aa28+')';};var _0xf8ba19={'where':{'id':_0x1b7bbd['params']['id']}},_0x202da4,_0x4cf84a,_0x15fc71,_0x153106,_0xdf5684;_0xf8ba19=_[_0x4524('0x3f')]({},_0xf8ba19,_0x1b7bbd[_0x4524('0x41')]);return db[_0x4524('0x2e')]['find'](_0xf8ba19)[_0x4524('0x25')](function(_0x564aa6){if(_0x564aa6){_0x202da4=_0x564aa6;return _0x564aa6[_0x4524('0x68')]();}return null;})[_0x4524('0x25')](function(_0x52cdc8){if(_0x52cdc8){if(!_0x52cdc8[_0x4524('0x47')]){throw new db['Sequelize'][(_0x4524('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cf84a=_0x52cdc8;return db['AnalyticMetric'][_0x4524('0x6c')]({'raw':!![]});}return null;})['then'](function(_0xec54b1){if(_0xec54b1){_0x15fc71=_[_0x4524('0x8a')](_0xec54b1,'id');var _0x4af704;var _0x4d76f2=squel[_0x4524('0x8b')]();_0x4d76f2[_0x4524('0x8c')](_0x202da4[_0x4524('0x6d')]);for(var _0x4f6215=0x0;_0x4f6215<_0x4cf84a[_0x4524('0x47')];_0x4f6215+=0x1){_0x4af704=_0x4cf84a[_0x4f6215][_0x4524('0x6e')]?_0x15fc71[_0x4cf84a[_0x4f6215][_0x4524('0x6e')]][_0x4524('0x6f')]:_0x4cf84a[_0x4f6215]['field'];_0x4af704=_0x4cf84a[_0x4f6215][_0x4524('0x70')]?_['replace'](_0x568371[_0x4cf84a[_0x4f6215][_0x4524('0x70')]],'%s',_0x4af704):_0x4af704;_0x4af704=_0x4cf84a[_0x4f6215]['format']?_[_0x4524('0x71')](_0x1ba339[_0x4cf84a[_0x4f6215]['format']],'%s',_0x4af704):_0x4af704;if(_0x4cf84a[_0x4f6215][_0x4524('0x73')]){_0x4d76f2[_0x4524('0x65')](_0x4af704);}_0x4cf84a[_0x4f6215][_0x4524('0x74')]&&_0x4d76f2['order'](_0x4af704,_0x4cf84a[_0x4f6215][_0x4524('0x74')]===_0x4524('0x76')?![]:!![]);_0x4d76f2[_0x4524('0x66')](_0x4af704,_0x4cf84a[_0x4f6215][_0x4524('0x77')]||_0x4af704);}if(_0x202da4[_0x4524('0x78')]){_0x202da4[_0x4524('0x78')]=JSON['parse'](_0x202da4['joins']);for(var _0x5f38b1=0x0;_0x5f38b1<_0x202da4['joins']['length'];_0x5f38b1+=0x1){if(_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x30')]&&_[_0x4524('0x5f')](_0x187dcb,_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x30')])&&_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7d')]&&_0x202da4[_0x4524('0x78')][_0x5f38b1]['foreignTable']&&_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7b')]){_0x4d76f2[_0x202da4['joins'][_0x5f38b1][_0x4524('0x30')]](_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7a')],null,util[_0x4524('0x72')](_0x4524('0x7c'),_0x202da4[_0x4524('0x6d')],_0x202da4[_0x4524('0x78')][_0x5f38b1]['parentKey'],_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7a')],_0x202da4['joins'][_0x5f38b1][_0x4524('0x7b')]));}}}if(_0x202da4['conditions']){_0x202da4['conditions']=JSON[_0x4524('0x79')](_0x202da4['conditions']);_0x4d76f2[_0x4524('0x3b')](_0x1ee2f9(_0x202da4['conditions'][_0x4524('0x65')]));}_0xdf5684=_0x4d76f2[_0x4524('0x7f')]();_0x4d76f2[_0x4524('0x1f')](_0x5c86c6);_0x4d76f2[_0x4524('0x1e')](0x0);logger[_0x4524('0x80')]('Limited\x20Query:',_0x4d76f2[_0x4524('0x82')]());return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x4d76f2[_0x4524('0x82')](),{'type':dbH[_0x4524('0x83')][_0x4524('0x84')][_0x4524('0x85')]});}})[_0x4524('0x25')](function(){return{'sql':_0xdf5684[_0x4524('0x82')]()};})[_0x4524('0x25')](respondWithResult(_0x297eea,null))[_0x4524('0x45')](handleError(_0x297eea,null));}; \ No newline at end of file +var _0x4d77=['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','dbH','json','offset','undefined','limit','count','status','set','apply','reject','save','update','get','CustomReports','UserProfileResource','destroy','end','error','name','send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','AnalyticCustomReport','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','format','groupBy','orderBy','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','Sequelize','function','DESC','output','fullPath','generate','csv','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x4ffaed,_0x79b4a6){var _0x50acda=function(_0x2f00c5){while(--_0x2f00c5){_0x4ffaed['push'](_0x4ffaed['shift']());}};_0x50acda(++_0x79b4a6);}(_0x4d77,0x96));var _0x74d7=function(_0x40b898,_0x2fd575){_0x40b898=_0x40b898-0x0;var _0x2ff0bb=_0x4d77[_0x40b898];return _0x2ff0bb;};'use strict';var emlformat=require(_0x74d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x74d7('0x2'));var BPromise=require(_0x74d7('0x3'));var Mustache=require(_0x74d7('0x4'));var util=require(_0x74d7('0x5'));var path=require('path');var sox=require(_0x74d7('0x6'));var csv=require(_0x74d7('0x7'));var ejs=require(_0x74d7('0x8'));var fs=require('fs');var fs_extra=require(_0x74d7('0x9'));var _=require(_0x74d7('0xa'));var squel=require(_0x74d7('0xb'));var crypto=require('crypto');var jsforce=require(_0x74d7('0xc'));var deskjs=require(_0x74d7('0xd'));var toCsv=require(_0x74d7('0x7'));var querystring=require(_0x74d7('0xe'));var Papa=require(_0x74d7('0xf'));var Redis=require(_0x74d7('0x10'));var authService=require(_0x74d7('0x11'));var qs=require(_0x74d7('0x12'));var as=require(_0x74d7('0x13'));var hardwareService=require(_0x74d7('0x14'));var logger=require(_0x74d7('0x15'))(_0x74d7('0x16'));var utils=require('../../config/utils');var config=require(_0x74d7('0x17'));var licenseUtil=require(_0x74d7('0x18'));var db=require(_0x74d7('0x19'))['db'];var dbH=require(_0x74d7('0x19'))[_0x74d7('0x1a')];function respondWithStatusCode(_0x1b1007,_0x2e0e33){_0x2e0e33=_0x2e0e33||0xcc;return function(_0xa9aa16){if(_0xa9aa16){return _0x1b1007['sendStatus'](_0x2e0e33);}return _0x1b1007['status'](_0x2e0e33)['end']();};}function respondWithResult(_0x4428a7,_0xf7d815){_0xf7d815=_0xf7d815||0xc8;return function(_0x2fada4){if(_0x2fada4){return _0x4428a7['status'](_0xf7d815)[_0x74d7('0x1b')](_0x2fada4);}};}function respondWithFilteredResult(_0x5f3ee8,_0x2638f1){return function(_0x2fc91d){if(_0x2fc91d){var _0x457ac0=typeof _0x2638f1[_0x74d7('0x1c')]===_0x74d7('0x1d')&&typeof _0x2638f1[_0x74d7('0x1e')]==='undefined';var _0x429973=_0x2fc91d[_0x74d7('0x1f')];var _0x234779=_0x457ac0?0x0:_0x2638f1[_0x74d7('0x1c')];var _0x4dc745=_0x457ac0?_0x2fc91d[_0x74d7('0x1f')]:_0x2638f1[_0x74d7('0x1c')]+_0x2638f1[_0x74d7('0x1e')];var _0xaf2233;if(_0x4dc745>=_0x429973){_0x4dc745=_0x429973;_0xaf2233=0xc8;}else{_0xaf2233=0xce;}_0x5f3ee8[_0x74d7('0x20')](_0xaf2233);return _0x5f3ee8[_0x74d7('0x21')]('Content-Range',_0x234779+'-'+_0x4dc745+'/'+_0x429973)[_0x74d7('0x1b')](_0x2fc91d);}return null;};}function patchUpdates(_0x495cfa){return function(_0x55cf53){try{jsonpatch[_0x74d7('0x22')](_0x55cf53,_0x495cfa,!![]);}catch(_0x3d651b){return BPromise[_0x74d7('0x23')](_0x3d651b);}return _0x55cf53[_0x74d7('0x24')]();};}function saveUpdates(_0x1d10f7,_0x441e3a){return function(_0x1f6954){if(_0x1f6954){return _0x1f6954[_0x74d7('0x25')](_0x1d10f7)['then'](function(_0x7fb1d2){return _0x7fb1d2;});}return null;};}function removeEntity(_0x28ea8a,_0x482db6){return function(_0x4a3abf){if(_0x4a3abf){return _0x4a3abf['destroy']()['then'](function(){var _0x59f5ff=_0x4a3abf[_0x74d7('0x26')]({'plain':!![]});var _0x11fb07=_0x74d7('0x27');return db[_0x74d7('0x28')][_0x74d7('0x29')]({'where':{'type':_0x11fb07,'resourceId':_0x59f5ff['id']}})['then'](function(){return _0x4a3abf;});})['then'](function(){_0x28ea8a[_0x74d7('0x20')](0xcc)[_0x74d7('0x2a')]();});}};}function handleEntityNotFound(_0x511fc4,_0x4e7dfa){return function(_0x3ecd8f){if(!_0x3ecd8f){_0x511fc4['sendStatus'](0x194);}return _0x3ecd8f;};}function handleError(_0x5543d3,_0x533e74){_0x533e74=_0x533e74||0x1f4;return function(_0x43a08b){logger[_0x74d7('0x2b')](_0x43a08b['stack']);if(_0x43a08b[_0x74d7('0x2c')]){delete _0x43a08b['name'];}_0x5543d3['status'](_0x533e74)[_0x74d7('0x2d')](_0x43a08b);};}exports[_0x74d7('0x2e')]=function(_0x25143d,_0x4e7dfb){var _0x43332f={},_0x15ad8e={},_0x1856ad={'count':0x0,'rows':[]};var _0x24d2a0=_['map'](db['AnalyticCustomReport'][_0x74d7('0x2f')],function(_0x4dd6b1){return{'name':_0x4dd6b1['fieldName'],'type':_0x4dd6b1[_0x74d7('0x30')][_0x74d7('0x31')]};});_0x15ad8e['model']=_[_0x74d7('0x32')](_0x24d2a0,_0x74d7('0x2c'));_0x15ad8e[_0x74d7('0x33')]=_[_0x74d7('0x34')](_0x25143d[_0x74d7('0x33')]);_0x15ad8e['filters']=_[_0x74d7('0x35')](_0x15ad8e[_0x74d7('0x36')],_0x15ad8e['query']);_0x43332f[_0x74d7('0x37')]=_['intersection'](_0x15ad8e[_0x74d7('0x36')],qs[_0x74d7('0x38')](_0x25143d[_0x74d7('0x33')]['fields']));_0x43332f['attributes']=_0x43332f[_0x74d7('0x37')][_0x74d7('0x39')]?_0x43332f[_0x74d7('0x37')]:_0x15ad8e[_0x74d7('0x36')];if(!_0x25143d[_0x74d7('0x33')]['hasOwnProperty']('nolimit')){_0x43332f['limit']=qs['limit'](_0x25143d[_0x74d7('0x33')][_0x74d7('0x1e')]);_0x43332f[_0x74d7('0x1c')]=qs['offset'](_0x25143d[_0x74d7('0x33')][_0x74d7('0x1c')]);}_0x43332f[_0x74d7('0x3a')]=qs[_0x74d7('0x3b')](_0x25143d[_0x74d7('0x33')]['sort']);_0x43332f[_0x74d7('0x3c')]=qs[_0x74d7('0x3d')](_['pick'](_0x25143d['query'],_0x15ad8e['filters']),_0x24d2a0);if(_0x25143d[_0x74d7('0x33')][_0x74d7('0x3e')]){_0x43332f[_0x74d7('0x3c')]=_[_0x74d7('0x3f')](_0x43332f['where'],{'$or':_[_0x74d7('0x32')](_0x24d2a0,function(_0x50afc1){if(_0x50afc1['type']!==_0x74d7('0x40')){var _0x25252f={};_0x25252f[_0x50afc1['name']]={'$like':'%'+_0x25143d[_0x74d7('0x33')][_0x74d7('0x3e')]+'%'};return _0x25252f;}})});}_0x43332f=_[_0x74d7('0x3f')]({},_0x43332f,_0x25143d[_0x74d7('0x41')]);var _0x55dfd7={'where':_0x43332f[_0x74d7('0x3c')]};return db['AnalyticCustomReport'][_0x74d7('0x1f')](_0x55dfd7)[_0x74d7('0x42')](function(_0x55d3ff){_0x1856ad['count']=_0x55d3ff;if(_0x25143d[_0x74d7('0x33')][_0x74d7('0x43')]){_0x43332f[_0x74d7('0x44')]=[{'all':!![]}];}return db[_0x74d7('0x45')][_0x74d7('0x46')](_0x43332f);})['then'](function(_0x5c43e9){_0x1856ad[_0x74d7('0x47')]=_0x5c43e9;return _0x1856ad;})[_0x74d7('0x42')](respondWithFilteredResult(_0x4e7dfb,_0x43332f))[_0x74d7('0x48')](handleError(_0x4e7dfb,null));};exports[_0x74d7('0x49')]=function(_0x246f21,_0x37fde2){var _0x54e6b0={'raw':![],'where':{'id':_0x246f21[_0x74d7('0x4a')]['id']}},_0x59fad5={};_0x59fad5[_0x74d7('0x36')]=_['keys'](db[_0x74d7('0x45')]['rawAttributes']);_0x59fad5[_0x74d7('0x33')]=_[_0x74d7('0x34')](_0x246f21[_0x74d7('0x33')]);_0x59fad5['filters']=_[_0x74d7('0x35')](_0x59fad5[_0x74d7('0x36')],_0x59fad5['query']);_0x54e6b0[_0x74d7('0x37')]=_[_0x74d7('0x35')](_0x59fad5[_0x74d7('0x36')],qs[_0x74d7('0x38')](_0x246f21[_0x74d7('0x33')][_0x74d7('0x38')]));_0x54e6b0[_0x74d7('0x37')]=_0x54e6b0[_0x74d7('0x37')][_0x74d7('0x39')]?_0x54e6b0[_0x74d7('0x37')]:_0x59fad5[_0x74d7('0x36')];if(_0x246f21['query']['includeAll']){_0x54e6b0[_0x74d7('0x44')]=[{'all':!![]}];}_0x54e6b0=_['merge']({},_0x54e6b0,_0x246f21['options']);return db[_0x74d7('0x45')]['find'](_0x54e6b0)[_0x74d7('0x42')](handleEntityNotFound(_0x37fde2,null))[_0x74d7('0x42')](respondWithResult(_0x37fde2,null))[_0x74d7('0x48')](handleError(_0x37fde2,null));};exports['create']=function(_0x95f203,_0x4b2837){return db[_0x74d7('0x45')][_0x74d7('0x4b')](_0x95f203[_0x74d7('0x4c')],{})['then'](function(_0x4e4da8){var _0x2949ac=_0x95f203[_0x74d7('0x4d')][_0x74d7('0x26')]({'plain':!![]});if(!_0x2949ac)throw new Error(_0x74d7('0x4e'));if(_0x2949ac[_0x74d7('0x4f')]==='user'){var _0x206021=_0x4e4da8['get']({'plain':!![]});var _0x15c8c1='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x15c8c1,'userProfileId':_0x2949ac[_0x74d7('0x50')]},'raw':!![]})[_0x74d7('0x42')](function(_0x319e98){if(_0x319e98&&_0x319e98[_0x74d7('0x51')]===0x0){return db['UserProfileResource'][_0x74d7('0x4b')]({'name':_0x206021[_0x74d7('0x2c')],'resourceId':_0x206021['id'],'type':_0x74d7('0x27'),'sectionId':_0x319e98['id']},{})['then'](function(){return _0x4e4da8;});}else{return _0x4e4da8;}})[_0x74d7('0x48')](function(_0x2af81b){logger[_0x74d7('0x2b')](_0x74d7('0x52'),_0x2af81b);throw _0x2af81b;});}return _0x4e4da8;})[_0x74d7('0x42')](respondWithResult(_0x4b2837,0xc9))[_0x74d7('0x48')](handleError(_0x4b2837,null));};exports['update']=function(_0x4091ff,_0x3bf22e){if(_0x4091ff[_0x74d7('0x4c')]['id']){delete _0x4091ff[_0x74d7('0x4c')]['id'];}return db[_0x74d7('0x45')]['find']({'where':{'id':_0x4091ff[_0x74d7('0x4a')]['id']}})[_0x74d7('0x42')](handleEntityNotFound(_0x3bf22e,null))['then'](saveUpdates(_0x4091ff[_0x74d7('0x4c')],null))[_0x74d7('0x42')](respondWithResult(_0x3bf22e,null))[_0x74d7('0x48')](handleError(_0x3bf22e,null));};exports[_0x74d7('0x29')]=function(_0xa6e1d5,_0x2a1efc){return db[_0x74d7('0x45')][_0x74d7('0x53')]({'where':{'id':_0xa6e1d5[_0x74d7('0x4a')]['id']}})[_0x74d7('0x42')](handleEntityNotFound(_0x2a1efc,null))[_0x74d7('0x42')](removeEntity(_0x2a1efc,null))[_0x74d7('0x48')](handleError(_0x2a1efc,null));};exports[_0x74d7('0x54')]=function(_0x4d88b0,_0x5b0b23){var _0x2e37e8=0xa;var _0x5d23ee=['join','left_join',_0x74d7('0x55'),_0x74d7('0x56')];var _0x31a4d9={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x74d7('0x57'),'MAX':_0x74d7('0x58'),'MIN':'MIN(%s)','AVG':_0x74d7('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x51cd50={'SEC_TO_TIME':_0x74d7('0x5a'),'DATE':_0x74d7('0x5b'),'HOUR':_0x74d7('0x5c'),'ROUND':_0x74d7('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x38af8f=function(_0x4fbc1c){return!_[_0x74d7('0x5e')]([_0x74d7('0x5f'),_0x74d7('0x60'),_0x74d7('0x61'),_0x74d7('0x62')],_0x4fbc1c);};var _0x42ba93=function(_0x2200da){if(!_0x2200da||!_0x2200da[_0x74d7('0x63')][_0x74d7('0x39')]){return'';}for(var _0x52f2d1='(',_0x3eaaab=0x0;_0x3eaaab<_0x2200da['rules']['length'];_0x3eaaab+=0x1){_0x3eaaab>0x0&&(_0x52f2d1+='\x20'+_0x2200da[_0x74d7('0x64')]+'\x20');_0x52f2d1+=_0x2200da[_0x74d7('0x63')][_0x3eaaab][_0x74d7('0x65')]?_0x42ba93(_0x2200da[_0x74d7('0x63')][_0x3eaaab][_0x74d7('0x65')]):_0x2200da[_0x74d7('0x63')][_0x3eaaab][_0x74d7('0x66')]+'\x20'+_0x2200da['rules'][_0x3eaaab][_0x74d7('0x67')]+(_0x38af8f(_0x2200da[_0x74d7('0x63')][_0x3eaaab][_0x74d7('0x67')])?'\x20'+_0x2200da[_0x74d7('0x63')][_0x3eaaab][_0x74d7('0x68')]:'');}return _0x52f2d1+')';};var _0x575baa={'where':{'id':_0x4d88b0['params']['id']}},_0x2802df,_0xd6bcb8,_0x283357,_0x295030,_0x5e178a;_0x575baa=_[_0x74d7('0x3f')]({},_0x575baa,_0x4d88b0['options']);return db['AnalyticCustomReport'][_0x74d7('0x53')](_0x575baa)[_0x74d7('0x42')](function(_0x3b8608){if(_0x3b8608){_0x2802df=_0x3b8608;return _0x3b8608['getFields']();}return null;})['then'](function(_0x56b295){if(_0x56b295){if(!_0x56b295[_0x74d7('0x39')]){throw new db['Sequelize'][(_0x74d7('0x69'))](_0x74d7('0x6a'),0x193);}_0xd6bcb8=_0x56b295;return db[_0x74d7('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x16ecac){if(_0x16ecac){_0x283357=_[_0x74d7('0x6c')](_0x16ecac,'id');var _0x1bbb4e;var _0x365999=squel[_0x74d7('0x6d')]();_0x365999[_0x74d7('0x6e')](_0x2802df[_0x74d7('0x6f')]);for(var _0xfd47a5=0x0;_0xfd47a5<_0xd6bcb8[_0x74d7('0x39')];_0xfd47a5+=0x1){_0x1bbb4e=_0xd6bcb8[_0xfd47a5][_0x74d7('0x70')]?_0x283357[_0xd6bcb8[_0xfd47a5]['MetricId']][_0x74d7('0x71')]:_0xd6bcb8[_0xfd47a5][_0x74d7('0x66')];_0x1bbb4e=_0xd6bcb8[_0xfd47a5]['function']?_[_0x74d7('0x72')](_0x31a4d9[_0xd6bcb8[_0xfd47a5]['function']],'%s',_0x1bbb4e):_0x1bbb4e;_0x1bbb4e=_0xd6bcb8[_0xfd47a5]['format']?_[_0x74d7('0x72')](_0x51cd50[_0xd6bcb8[_0xfd47a5][_0x74d7('0x73')]],'%s',_0x1bbb4e):_0x1bbb4e;if(_0xd6bcb8[_0xfd47a5][_0x74d7('0x74')]){_0x365999[_0x74d7('0x65')](_0x1bbb4e);}_0xd6bcb8[_0xfd47a5][_0x74d7('0x75')]&&_0x365999[_0x74d7('0x3a')](_0x1bbb4e,_0xd6bcb8[_0xfd47a5][_0x74d7('0x75')]==='DESC'?![]:!![]);_0x365999[_0x74d7('0x66')](_0x1bbb4e,_0xd6bcb8[_0xfd47a5][_0x74d7('0x76')]||_0x1bbb4e);}if(_0x2802df['joins']){_0x2802df['joins']=JSON[_0x74d7('0x77')](_0x2802df[_0x74d7('0x78')]);for(var _0x525ee9=0x0;_0x525ee9<_0x2802df['joins'][_0x74d7('0x39')];_0x525ee9+=0x1){if(_0x2802df['joins'][_0x525ee9][_0x74d7('0x30')]&&_['includes'](_0x5d23ee,_0x2802df[_0x74d7('0x78')][_0x525ee9][_0x74d7('0x30')])&&_0x2802df[_0x74d7('0x78')][_0x525ee9][_0x74d7('0x79')]&&_0x2802df[_0x74d7('0x78')][_0x525ee9]['foreignTable']&&_0x2802df[_0x74d7('0x78')][_0x525ee9][_0x74d7('0x7a')]){_0x365999[_0x2802df[_0x74d7('0x78')][_0x525ee9][_0x74d7('0x30')]](_0x2802df[_0x74d7('0x78')][_0x525ee9]['foreignTable'],null,util[_0x74d7('0x73')](_0x74d7('0x7b'),_0x2802df[_0x74d7('0x6f')],_0x2802df[_0x74d7('0x78')][_0x525ee9][_0x74d7('0x79')],_0x2802df[_0x74d7('0x78')][_0x525ee9][_0x74d7('0x7c')],_0x2802df[_0x74d7('0x78')][_0x525ee9][_0x74d7('0x7a')]));}}}if(_0x2802df['conditions']){_0x2802df[_0x74d7('0x7d')]=JSON[_0x74d7('0x77')](_0x2802df[_0x74d7('0x7d')]);_0x365999[_0x74d7('0x3c')](_0x42ba93(_0x2802df[_0x74d7('0x7d')][_0x74d7('0x65')]));}_0x5e178a=_0x365999[_0x74d7('0x7e')]();_0x365999[_0x74d7('0x1e')](_0x2e37e8);_0x365999['offset'](0x0);logger[_0x74d7('0x7f')](_0x74d7('0x80'),_0x365999[_0x74d7('0x81')]());return dbH[_0x74d7('0x82')][_0x74d7('0x33')](_0x365999[_0x74d7('0x81')](),{'type':dbH[_0x74d7('0x82')][_0x74d7('0x83')][_0x74d7('0x84')]});}})[_0x74d7('0x42')](respondWithResult(_0x5b0b23,null))[_0x74d7('0x48')](handleError(_0x5b0b23,null));};function runReport(_0x193f59,_0x10abb7,_0x20d19e){var _0xcaca07=_0x10abb7[_0x74d7('0x2c')];var _0x3415d8=0xa;var _0x1da7be=[_0x74d7('0x85'),_0x74d7('0x86'),'right_join',_0x74d7('0x56')];var _0x1417b6={'SUM':_0x74d7('0x87'),'COUNT':_0x74d7('0x88'),'COUNT DISTINCT':_0x74d7('0x57'),'MAX':_0x74d7('0x58'),'MIN':_0x74d7('0x89'),'AVG':_0x74d7('0x59'),'GROUP_CONCAT':_0x74d7('0x8a'),'GROUP_CONCAT ASC':_0x74d7('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ce0fc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x74d7('0x5b'),'HOUR':_0x74d7('0x5c'),'ROUND':_0x74d7('0x5d'),'UNIX_TIMESTAMP':_0x74d7('0x8c')};var _0x4907cc=function(_0x5fdc50){return!_['includes'](['IS\x20NULL',_0x74d7('0x60'),_0x74d7('0x61'),_0x74d7('0x62')],_0x5fdc50);};var _0x2d79b6=function(_0x3e42d5){if(!_0x3e42d5||!_0x3e42d5[_0x74d7('0x63')][_0x74d7('0x39')]){return'';}for(var _0x1fb00a='(',_0x539424=0x0;_0x539424<_0x3e42d5['rules'][_0x74d7('0x39')];_0x539424+=0x1){_0x539424>0x0&&(_0x1fb00a+='\x20'+_0x3e42d5[_0x74d7('0x64')]+'\x20');_0x1fb00a+=_0x3e42d5[_0x74d7('0x63')][_0x539424][_0x74d7('0x65')]?_0x2d79b6(_0x3e42d5[_0x74d7('0x63')][_0x539424][_0x74d7('0x65')]):_0x3e42d5['rules'][_0x539424]['field']+'\x20'+_0x3e42d5[_0x74d7('0x63')][_0x539424][_0x74d7('0x67')]+(_0x4907cc(_0x3e42d5[_0x74d7('0x63')][_0x539424][_0x74d7('0x67')])?'\x20'+_0x3e42d5[_0x74d7('0x63')][_0x539424][_0x74d7('0x68')]:'');}return _0x1fb00a+')';};var _0x5bc6fc={'where':{'id':_0x193f59['id']}},_0x1d8e08,_0x653f2b,_0x393501,_0x452c77,_0x376ebd;_0x5bc6fc=_[_0x74d7('0x3f')]({},_0x5bc6fc,_0x20d19e);return db[_0x74d7('0x45')][_0x74d7('0x53')](_0x5bc6fc)[_0x74d7('0x42')](function(_0x588f3d){if(_0x588f3d){_0x1d8e08=_0x588f3d;return _0x588f3d['getFields']();}return null;})[_0x74d7('0x42')](function(_0x430bbf){if(_0x430bbf){if(!_0x430bbf[_0x74d7('0x39')]){throw new db[(_0x74d7('0x8d'))][(_0x74d7('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x653f2b=_0x430bbf;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x59a741){if(_0x59a741){_0x393501=_[_0x74d7('0x6c')](_0x59a741,'id');var _0x24c91d;var _0x583897=squel['select']();_0x583897[_0x74d7('0x6e')](_0x1d8e08['table']);for(var _0x2765e3=0x0;_0x2765e3<_0x653f2b['length'];_0x2765e3+=0x1){_0x24c91d=_0x653f2b[_0x2765e3]['MetricId']?_0x393501[_0x653f2b[_0x2765e3][_0x74d7('0x70')]][_0x74d7('0x71')]:_0x653f2b[_0x2765e3][_0x74d7('0x66')];_0x24c91d=_0x653f2b[_0x2765e3][_0x74d7('0x8e')]?_[_0x74d7('0x72')](_0x1417b6[_0x653f2b[_0x2765e3][_0x74d7('0x8e')]],'%s',_0x24c91d):_0x24c91d;_0x24c91d=_0x653f2b[_0x2765e3]['format']?_[_0x74d7('0x72')](_0x4ce0fc[_0x653f2b[_0x2765e3][_0x74d7('0x73')]],'%s',_0x24c91d):_0x24c91d;if(_0x653f2b[_0x2765e3][_0x74d7('0x74')]){_0x583897[_0x74d7('0x65')](_0x24c91d);}_0x653f2b[_0x2765e3][_0x74d7('0x75')]&&_0x583897[_0x74d7('0x3a')](_0x24c91d,_0x653f2b[_0x2765e3][_0x74d7('0x75')]===_0x74d7('0x8f')?![]:!![]);_0x583897[_0x74d7('0x66')](_0x24c91d,_0x653f2b[_0x2765e3][_0x74d7('0x76')]||_0x24c91d);}if(_0x1d8e08[_0x74d7('0x78')]){_0x1d8e08[_0x74d7('0x78')]=JSON[_0x74d7('0x77')](_0x1d8e08[_0x74d7('0x78')]);for(var _0x28e442=0x0;_0x28e442<_0x1d8e08[_0x74d7('0x78')]['length'];_0x28e442+=0x1){if(_0x1d8e08[_0x74d7('0x78')][_0x28e442][_0x74d7('0x30')]&&_[_0x74d7('0x5e')](_0x1da7be,_0x1d8e08[_0x74d7('0x78')][_0x28e442]['type'])&&_0x1d8e08[_0x74d7('0x78')][_0x28e442][_0x74d7('0x79')]&&_0x1d8e08['joins'][_0x28e442][_0x74d7('0x7c')]&&_0x1d8e08['joins'][_0x28e442][_0x74d7('0x7a')]){_0x583897[_0x1d8e08[_0x74d7('0x78')][_0x28e442][_0x74d7('0x30')]](_0x1d8e08[_0x74d7('0x78')][_0x28e442]['foreignTable'],null,util[_0x74d7('0x73')]('%s.%s\x20=\x20%s.%s',_0x1d8e08[_0x74d7('0x6f')],_0x1d8e08[_0x74d7('0x78')][_0x28e442][_0x74d7('0x79')],_0x1d8e08[_0x74d7('0x78')][_0x28e442]['foreignTable'],_0x1d8e08[_0x74d7('0x78')][_0x28e442][_0x74d7('0x7a')]));}}}if(_0x1d8e08[_0x74d7('0x7d')]){_0x1d8e08[_0x74d7('0x7d')]=JSON[_0x74d7('0x77')](_0x1d8e08[_0x74d7('0x7d')]);_0x583897[_0x74d7('0x3c')](_0x2d79b6(_0x1d8e08[_0x74d7('0x7d')][_0x74d7('0x65')]));}_0x376ebd=_0x583897[_0x74d7('0x7e')]();_0x583897[_0x74d7('0x1e')](_0x3415d8);_0x583897[_0x74d7('0x1c')](0x0);return;}})[_0x74d7('0x42')](function(){if(_0x10abb7[_0x74d7('0x90')]==='web'){return null;}var _0xa23585=_[_0x74d7('0x3f')](_0x10abb7,{'name':_0x10abb7[_0x74d7('0x91')]||_0x10abb7[_0x74d7('0x2c')]||_0x1d8e08[_0x74d7('0x2c')],'basename':_0xcaca07,'savename':util[_0x74d7('0x73')]('%s-%s.%s',_0x10abb7['name']||_0x1d8e08[_0x74d7('0x2c')],require('randomstring')[_0x74d7('0x92')](0x4),_0x10abb7[_0x74d7('0x90')]||_0x74d7('0x93')),'reportId':_0x1d8e08['id'],'reportType':_0x74d7('0x94')});return db['AnalyticExtractedReport'][_0x74d7('0x4b')](_0xa23585,{'raw':!![]});})[_0x74d7('0x42')](function(_0x5aa890){if(_0x1d8e08[_0x74d7('0x6f')]===_0x74d7('0x95')){_0x376ebd[_0x74d7('0x3c')](_0x1d8e08['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10abb7[_0x74d7('0x96')],_0x10abb7[_0x74d7('0x97')]);}else{_0x376ebd['where'](_0x1d8e08['table']+_0x74d7('0x98'),_0x10abb7[_0x74d7('0x96')],_0x10abb7[_0x74d7('0x97')]);}if(_0x5aa890){logger[_0x74d7('0x99')](_0x74d7('0x9a'),_0x376ebd['toString']());require(_0x74d7('0x9b'))[_0x74d7('0x9c')](path['join'](__dirname,_0x74d7('0x9d'),_0x5aa890['output']),[_0x5aa890['id'],_0x376ebd[_0x74d7('0x81')](),path[_0x74d7('0x85')](__dirname,'../../files/reports',_0x5aa890[_0x74d7('0x9e')]),_0xcaca07]);return _0x5aa890;}else{var _0x35faa0=squel[_0x74d7('0x6d')]();_0x35faa0['from']('('+_0x376ebd[_0x74d7('0x81')]()+')',_0x74d7('0x9f'));_0x35faa0['field']('COUNT(*)',_0x74d7('0x1f'));_0x376ebd[_0x74d7('0x1e')](_0x10abb7[_0x74d7('0x1e')]||_0x3415d8);_0x376ebd[_0x74d7('0x1c')](_0x10abb7[_0x74d7('0x1c')]||0x0);return dbH[_0x74d7('0x82')][_0x74d7('0x33')](_0x35faa0[_0x74d7('0x81')](),{'type':dbH[_0x74d7('0x82')][_0x74d7('0x83')]['SELECT']})[_0x74d7('0x42')](function(_0x54cd36){if(!_0x54cd36[_0x74d7('0x39')]){_0x452c77=0x0;}else{_0x452c77=_0x54cd36[0x0][_0x74d7('0x1f')]||0x0;}return dbH[_0x74d7('0x82')]['query'](_0x376ebd[_0x74d7('0x81')](),{'type':dbH[_0x74d7('0x82')][_0x74d7('0x83')]['SELECT']});})[_0x74d7('0x42')](function(_0x3b20d6){return{'rows':_0x3b20d6||[],'count':_0x452c77};});}});}exports[_0x74d7('0xa0')]=function(_0x5b1c06,_0x50db7d){return runReport(_0x5b1c06[_0x74d7('0x4a')],_0x5b1c06[_0x74d7('0x33')],_0x5b1c06[_0x74d7('0x41')])[_0x74d7('0x42')](respondWithResult(_0x50db7d,null))[_0x74d7('0x48')](handleError(_0x50db7d,null));};exports[_0x74d7('0xa1')]=runReport;exports[_0x74d7('0x33')]=function(_0x4c336d,_0x204f6c){var _0x3d0a60=0xa;var _0xfff1be=[_0x74d7('0x85'),'left_join',_0x74d7('0x55'),'cross_join'];var _0x4e9c7b={'SUM':_0x74d7('0x87'),'COUNT':_0x74d7('0x88'),'COUNT DISTINCT':_0x74d7('0x57'),'MAX':_0x74d7('0x58'),'MIN':_0x74d7('0x89'),'AVG':_0x74d7('0x59'),'GROUP_CONCAT':_0x74d7('0x8a'),'GROUP_CONCAT ASC':_0x74d7('0x8b'),'GROUP_CONCAT DESC':_0x74d7('0xa2')};var _0x373590={'SEC_TO_TIME':_0x74d7('0x5a'),'DATE':_0x74d7('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x74d7('0x5d'),'UNIX_TIMESTAMP':_0x74d7('0x8c')};var _0x3de1bb=function(_0x18cb04){return!_[_0x74d7('0x5e')]([_0x74d7('0x5f'),_0x74d7('0x60'),_0x74d7('0x61'),'IS\x20NOT\x20EMPTY'],_0x18cb04);};var _0x2e6251=function(_0x10e39a){if(!_0x10e39a||!_0x10e39a[_0x74d7('0x63')][_0x74d7('0x39')]){return'';}for(var _0x26767b='(',_0x12bb2d=0x0;_0x12bb2d<_0x10e39a[_0x74d7('0x63')]['length'];_0x12bb2d+=0x1){_0x12bb2d>0x0&&(_0x26767b+='\x20'+_0x10e39a[_0x74d7('0x64')]+'\x20');_0x26767b+=_0x10e39a[_0x74d7('0x63')][_0x12bb2d][_0x74d7('0x65')]?_0x2e6251(_0x10e39a[_0x74d7('0x63')][_0x12bb2d][_0x74d7('0x65')]):_0x10e39a[_0x74d7('0x63')][_0x12bb2d][_0x74d7('0x66')]+'\x20'+_0x10e39a['rules'][_0x12bb2d][_0x74d7('0x67')]+(_0x3de1bb(_0x10e39a[_0x74d7('0x63')][_0x12bb2d]['condition'])?'\x20'+_0x10e39a[_0x74d7('0x63')][_0x12bb2d][_0x74d7('0x68')]:'');}return _0x26767b+')';};var _0x5b489b={'where':{'id':_0x4c336d[_0x74d7('0x4a')]['id']}},_0x129795,_0x134f5d,_0x54ec52,_0x224430,_0x5907af;_0x5b489b=_['merge']({},_0x5b489b,_0x4c336d[_0x74d7('0x41')]);return db[_0x74d7('0x45')][_0x74d7('0x53')](_0x5b489b)[_0x74d7('0x42')](function(_0x11ae50){if(_0x11ae50){_0x129795=_0x11ae50;return _0x11ae50['getFields']();}return null;})[_0x74d7('0x42')](function(_0x407bee){if(_0x407bee){if(!_0x407bee[_0x74d7('0x39')]){throw new db[(_0x74d7('0x8d'))][(_0x74d7('0x69'))](_0x74d7('0x6a'),0x193);}_0x134f5d=_0x407bee;return db['AnalyticMetric'][_0x74d7('0x46')]({'raw':!![]});}return null;})['then'](function(_0x5c0c0a){if(_0x5c0c0a){_0x54ec52=_[_0x74d7('0x6c')](_0x5c0c0a,'id');var _0x43a5b6;var _0x3fd55f=squel[_0x74d7('0x6d')]();_0x3fd55f[_0x74d7('0x6e')](_0x129795['table']);for(var _0x12583b=0x0;_0x12583b<_0x134f5d[_0x74d7('0x39')];_0x12583b+=0x1){_0x43a5b6=_0x134f5d[_0x12583b]['MetricId']?_0x54ec52[_0x134f5d[_0x12583b]['MetricId']]['metric']:_0x134f5d[_0x12583b][_0x74d7('0x66')];_0x43a5b6=_0x134f5d[_0x12583b][_0x74d7('0x8e')]?_[_0x74d7('0x72')](_0x4e9c7b[_0x134f5d[_0x12583b][_0x74d7('0x8e')]],'%s',_0x43a5b6):_0x43a5b6;_0x43a5b6=_0x134f5d[_0x12583b][_0x74d7('0x73')]?_[_0x74d7('0x72')](_0x373590[_0x134f5d[_0x12583b][_0x74d7('0x73')]],'%s',_0x43a5b6):_0x43a5b6;if(_0x134f5d[_0x12583b]['groupBy']){_0x3fd55f[_0x74d7('0x65')](_0x43a5b6);}_0x134f5d[_0x12583b][_0x74d7('0x75')]&&_0x3fd55f[_0x74d7('0x3a')](_0x43a5b6,_0x134f5d[_0x12583b][_0x74d7('0x75')]===_0x74d7('0x8f')?![]:!![]);_0x3fd55f['field'](_0x43a5b6,_0x134f5d[_0x12583b][_0x74d7('0x76')]||_0x43a5b6);}if(_0x129795[_0x74d7('0x78')]){_0x129795[_0x74d7('0x78')]=JSON[_0x74d7('0x77')](_0x129795[_0x74d7('0x78')]);for(var _0x2143e8=0x0;_0x2143e8<_0x129795[_0x74d7('0x78')]['length'];_0x2143e8+=0x1){if(_0x129795[_0x74d7('0x78')][_0x2143e8][_0x74d7('0x30')]&&_[_0x74d7('0x5e')](_0xfff1be,_0x129795[_0x74d7('0x78')][_0x2143e8][_0x74d7('0x30')])&&_0x129795[_0x74d7('0x78')][_0x2143e8][_0x74d7('0x79')]&&_0x129795['joins'][_0x2143e8][_0x74d7('0x7c')]&&_0x129795[_0x74d7('0x78')][_0x2143e8][_0x74d7('0x7a')]){_0x3fd55f[_0x129795[_0x74d7('0x78')][_0x2143e8]['type']](_0x129795['joins'][_0x2143e8][_0x74d7('0x7c')],null,util[_0x74d7('0x73')]('%s.%s\x20=\x20%s.%s',_0x129795[_0x74d7('0x6f')],_0x129795['joins'][_0x2143e8][_0x74d7('0x79')],_0x129795[_0x74d7('0x78')][_0x2143e8][_0x74d7('0x7c')],_0x129795['joins'][_0x2143e8][_0x74d7('0x7a')]));}}}if(_0x129795[_0x74d7('0x7d')]){_0x129795[_0x74d7('0x7d')]=JSON[_0x74d7('0x77')](_0x129795[_0x74d7('0x7d')]);_0x3fd55f[_0x74d7('0x3c')](_0x2e6251(_0x129795[_0x74d7('0x7d')][_0x74d7('0x65')]));}_0x5907af=_0x3fd55f[_0x74d7('0x7e')]();_0x3fd55f[_0x74d7('0x1e')](_0x3d0a60);_0x3fd55f[_0x74d7('0x1c')](0x0);logger['debug'](_0x74d7('0x80'),_0x3fd55f[_0x74d7('0x81')]());return dbH[_0x74d7('0x82')]['query'](_0x3fd55f[_0x74d7('0x81')](),{'type':dbH[_0x74d7('0x82')][_0x74d7('0x83')][_0x74d7('0x84')]});}})['then'](function(){return{'sql':_0x5907af[_0x74d7('0x81')]()};})['then'](respondWithResult(_0x204f6c,null))['catch'](handleError(_0x204f6c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bb807d7..9d87bb9 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 _0x762c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','util'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x762c,0x167));var _0xc762=function(_0x50963f,_0x97943a){_0x50963f=_0x50963f-0x0;var _0x5667d5=_0x762c[_0x50963f];return _0x5667d5;};'use strict';var _=require('lodash');var util=require(_0xc762('0x0'));var logger=require('../../config/logger')(_0xc762('0x1'));var moment=require(_0xc762('0x2'));var BPromise=require(_0xc762('0x3'));var rp=require(_0xc762('0x4'));var fs=require('fs');var path=require(_0xc762('0x5'));var rimraf=require(_0xc762('0x6'));var config=require(_0xc762('0x7'));var attributes=require(_0xc762('0x8'));module[_0xc762('0x9')]=function(_0x5ca906,_0xa2c089){return _0x5ca906[_0xc762('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xc762('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4c3=['./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x4b8ae6,_0xa14390){var _0x1e650c=function(_0x58149c){while(--_0x58149c){_0x4b8ae6['push'](_0x4b8ae6['shift']());}};_0x1e650c(++_0xa14390);}(_0xd4c3,0x130));var _0x3d4c=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xd4c3[_0x166d93];return _0xba708;};'use strict';var _=require(_0x3d4c('0x0'));var util=require('util');var logger=require(_0x3d4c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3d4c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d4c('0x3'));var rimraf=require(_0x3d4c('0x4'));var config=require(_0x3d4c('0x5'));var attributes=require(_0x3d4c('0x6'));module[_0x3d4c('0x7')]=function(_0x371b57,_0x1d6a7f){return _0x371b57[_0x3d4c('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x3d4c('0x9'),'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 119083b..46cf1cc 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 _0xebe5=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x3105a9,_0x5f36f1){var _0x5d6e3=function(_0x10d873){while(--_0x10d873){_0x3105a9['push'](_0x3105a9['shift']());}};_0x5d6e3(++_0x5f36f1);}(_0xebe5,0x179));var _0x5ebe=function(_0x35836c,_0x17aedb){_0x35836c=_0x35836c-0x0;var _0x5277b3=_0xebe5[_0x35836c];return _0x5277b3;};'use strict';var _=require(_0x5ebe('0x0'));var util=require(_0x5ebe('0x1'));var moment=require(_0x5ebe('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ebe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ebe('0x4'));var logger=require('../../config/logger')(_0x5ebe('0x5'));var config=require(_0x5ebe('0x6'));var jayson=require(_0x5ebe('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1704,_0x1abb80,_0x31742a){return new BPromise(function(_0x1c649c,_0x23d94b){return client[_0x5ebe('0x8')](_0x4a1704,_0x31742a)[_0x5ebe('0x9')](function(_0x2da3e4){logger[_0x5ebe('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1abb80,_0x5ebe('0xb'));logger['debug'](_0x5ebe('0xc'),_0x1abb80,'request\x20sent',JSON[_0x5ebe('0xd')](_0x2da3e4));if(_0x2da3e4[_0x5ebe('0xe')]){if(_0x2da3e4['error'][_0x5ebe('0xf')]===0x1f4){logger[_0x5ebe('0xe')](_0x5ebe('0x10'),_0x1abb80,_0x2da3e4[_0x5ebe('0xe')][_0x5ebe('0x11')]);return _0x23d94b(_0x2da3e4[_0x5ebe('0xe')]['message']);}logger[_0x5ebe('0xe')](_0x5ebe('0x10'),_0x1abb80,_0x2da3e4[_0x5ebe('0xe')][_0x5ebe('0x11')]);return _0x1c649c(_0x2da3e4[_0x5ebe('0xe')][_0x5ebe('0x11')]);}else{logger[_0x5ebe('0xa')](_0x5ebe('0x10'),_0x1abb80,_0x5ebe('0xb'));_0x1c649c(_0x2da3e4[_0x5ebe('0x12')][_0x5ebe('0x11')]);}})['catch'](function(_0x34d9a6){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1abb80,_0x34d9a6);_0x23d94b(_0x34d9a6);});});} \ No newline at end of file +var _0xb2dc=['message','info','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2fd278,_0x2e0dc7){var _0x4bb0ea=function(_0x35eafe){while(--_0x35eafe){_0x2fd278['push'](_0x2fd278['shift']());}};_0x4bb0ea(++_0x2e0dc7);}(_0xb2dc,0x1df));var _0xcb2d=function(_0x52c6b7,_0x1b31aa){_0x52c6b7=_0x52c6b7-0x0;var _0x3c3ac9=_0xb2dc[_0x52c6b7];return _0x3c3ac9;};'use strict';var _=require('lodash');var util=require(_0xcb2d('0x0'));var moment=require(_0xcb2d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb2d('0x2'))['db'];var utils=require(_0xcb2d('0x3'));var logger=require(_0xcb2d('0x4'))(_0xcb2d('0x5'));var config=require(_0xcb2d('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x359943,_0x59ad4a,_0x3cfadc){return new BPromise(function(_0x2b06fd,_0x2a5299){return client['request'](_0x359943,_0x3cfadc)[_0xcb2d('0x7')](function(_0x2eae9f){logger['info'](_0xcb2d('0x8'),_0x59ad4a,_0xcb2d('0x9'));logger[_0xcb2d('0xa')](_0xcb2d('0xb'),_0x59ad4a,_0xcb2d('0x9'),JSON[_0xcb2d('0xc')](_0x2eae9f));if(_0x2eae9f['error']){if(_0x2eae9f[_0xcb2d('0xd')][_0xcb2d('0xe')]===0x1f4){logger[_0xcb2d('0xd')](_0xcb2d('0x8'),_0x59ad4a,_0x2eae9f[_0xcb2d('0xd')]['message']);return _0x2a5299(_0x2eae9f[_0xcb2d('0xd')]['message']);}logger[_0xcb2d('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x59ad4a,_0x2eae9f[_0xcb2d('0xd')][_0xcb2d('0xf')]);return _0x2b06fd(_0x2eae9f['error'][_0xcb2d('0xf')]);}else{logger[_0xcb2d('0x10')](_0xcb2d('0x8'),_0x59ad4a,_0xcb2d('0x9'));_0x2b06fd(_0x2eae9f[_0xcb2d('0x11')][_0xcb2d('0xf')]);}})[_0xcb2d('0x12')](function(_0x2b3f19){logger[_0xcb2d('0xd')](_0xcb2d('0x8'),_0x59ad4a,_0x2b3f19);_0x2a5299(_0x2b3f19);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 44b7c14..542889b 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 _0xb002=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','preview','/:id/run','run','/:id/query','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3dd34b,_0x4fd418){var _0x44cd78=function(_0x588742){while(--_0x588742){_0x3dd34b['push'](_0x3dd34b['shift']());}};_0x44cd78(++_0x4fd418);}(_0xb002,0x72));var _0x2b00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb002[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2b00('0x0'));var util=require('util');var path=require(_0x2b00('0x1'));var timeout=require(_0x2b00('0x2'));var express=require(_0x2b00('0x3'));var router=express[_0x2b00('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2b00('0x5'));var config=require(_0x2b00('0x6'));var controller=require(_0x2b00('0x7'));router['get']('/',auth[_0x2b00('0x8')](),controller['index']);router[_0x2b00('0x9')](_0x2b00('0xa'),auth[_0x2b00('0x8')](),controller['show']);router[_0x2b00('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x2b00('0xb')]);router[_0x2b00('0x9')](_0x2b00('0xc'),auth[_0x2b00('0x8')](),controller[_0x2b00('0xd')]);router[_0x2b00('0x9')](_0x2b00('0xe'),auth[_0x2b00('0x8')](),controller['query']);router['post']('/',auth[_0x2b00('0x8')](),controller[_0x2b00('0xf')]);router['put'](_0x2b00('0xa'),auth[_0x2b00('0x8')](),controller[_0x2b00('0x10')]);router[_0x2b00('0x11')](_0x2b00('0xa'),auth[_0x2b00('0x8')](),controller[_0x2b00('0x12')]);module[_0x2b00('0x13')]=router; \ No newline at end of file +var _0x7c6d=['query','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','run','/:id/query'];(function(_0x2712e6,_0x363c18){var _0x13bbe1=function(_0x24b66b){while(--_0x24b66b){_0x2712e6['push'](_0x2712e6['shift']());}};_0x13bbe1(++_0x363c18);}(_0x7c6d,0xed));var _0xd7c6=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7c6d[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xd7c6('0x0'));var util=require(_0xd7c6('0x1'));var path=require(_0xd7c6('0x2'));var timeout=require(_0xd7c6('0x3'));var express=require(_0xd7c6('0x4'));var router=express[_0xd7c6('0x5')]();var fs_extra=require(_0xd7c6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd7c6('0x7'));var config=require(_0xd7c6('0x8'));var controller=require('./analyticCustomReport.controller');router[_0xd7c6('0x9')]('/',auth[_0xd7c6('0xa')](),controller['index']);router[_0xd7c6('0x9')](_0xd7c6('0xb'),auth[_0xd7c6('0xa')](),controller[_0xd7c6('0xc')]);router[_0xd7c6('0x9')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0xd7c6('0x9')]('/:id/run',auth[_0xd7c6('0xa')](),controller[_0xd7c6('0xd')]);router[_0xd7c6('0x9')](_0xd7c6('0xe'),auth[_0xd7c6('0xa')](),controller[_0xd7c6('0xf')]);router[_0xd7c6('0x10')]('/',auth[_0xd7c6('0xa')](),controller['create']);router[_0xd7c6('0x11')](_0xd7c6('0xb'),auth[_0xd7c6('0xa')](),controller[_0xd7c6('0x12')]);router[_0xd7c6('0x13')](_0xd7c6('0xb'),auth[_0xd7c6('0xa')](),controller['destroy']);module[_0xd7c6('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f0cf71d..10f78e8 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x405aeb,_0x5ee732){var _0x50e76a=function(_0x2cded1){while(--_0x2cded1){_0x405aeb['push'](_0x405aeb['shift']());}};_0x50e76a(++_0x5ee732);}(_0x5fab,0x177));var _0xb5fa=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x5fab[_0x2085f3];return _0x384e3c;};'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 +var _0x687b=['STRING','TEXT','sequelize','exports'];(function(_0x21b84d,_0x4da029){var _0x3bd8ef=function(_0x106246){while(--_0x106246){_0x21b84d['push'](_0x21b84d['shift']());}};_0x3bd8ef(++_0x4da029);}(_0x687b,0x14a));var _0xb687=function(_0x43cdc5,_0x2f19ba){_0x43cdc5=_0x43cdc5-0x0;var _0x2da6c5=_0x687b[_0x43cdc5];return _0x2da6c5;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb687('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb687('0x3')]},'joins':{'type':Sequelize[_0xb687('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dfbbf56..0f8e4ba 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 _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0xcd9ec8,_0x27699f){var _0x5aa31b=function(_0x32f922){while(--_0x32f922){_0xcd9ec8['push'](_0xcd9ec8['shift']());}};_0x5aa31b(++_0x27699f);}(_0x7a54,0x106));var _0x47a5=function(_0x25c99c,_0x5146b3){_0x25c99c=_0x25c99c-0x0;var _0x26e4fa=_0x7a54[_0x25c99c];return _0x26e4fa;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file +var _0x524e=['AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','SELECT','run','runReport','SUM(%s)','GROUP_CONCAT(%s)','debug','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','AnalyticDefaultReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','create','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','params','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','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\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','sequelize','toString','join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','from','clone','output','web','fullPath','generate','csv','default'];(function(_0x4ca359,_0x25a241){var _0x49ee9e=function(_0x2696ab){while(--_0x2696ab){_0x4ca359['push'](_0x4ca359['shift']());}};_0x49ee9e(++_0x25a241);}(_0x524e,0x15e));var _0xe524=function(_0x3f4e15,_0x53fae7){_0x3f4e15=_0x3f4e15-0x0;var _0x540eb6=_0x524e[_0x3f4e15];return _0x540eb6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xfdc2a5,_0x1541d8){_0x1541d8=_0x1541d8||0xcc;return function(_0x11adbc){if(_0x11adbc){return _0xfdc2a5[_0xe524('0x1c')](_0x1541d8);}return _0xfdc2a5[_0xe524('0x1d')](_0x1541d8)['end']();};}function respondWithResult(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xc8;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x1d')](_0x51e9fe)['json'](_0x19f013);}};}function respondWithFilteredResult(_0x569660,_0x488fce){return function(_0x109795){if(_0x109795){var _0x538754=typeof _0x488fce[_0xe524('0x1e')]==='undefined'&&typeof _0x488fce['limit']==='undefined';var _0x3a4027=_0x109795['count'];var _0x11b2a1=_0x538754?0x0:_0x488fce[_0xe524('0x1e')];var _0x278de9=_0x538754?_0x109795[_0xe524('0x1f')]:_0x488fce['offset']+_0x488fce[_0xe524('0x20')];var _0x3ccb3f;if(_0x278de9>=_0x3a4027){_0x278de9=_0x3a4027;_0x3ccb3f=0xc8;}else{_0x3ccb3f=0xce;}_0x569660['status'](_0x3ccb3f);return _0x569660[_0xe524('0x21')](_0xe524('0x22'),_0x11b2a1+'-'+_0x278de9+'/'+_0x3a4027)[_0xe524('0x23')](_0x109795);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x24')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x25')](_0xbf059b);}return _0x1c4194[_0xe524('0x26')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x27')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x28')]()['then'](function(){var _0x17e245=_0x599d5d[_0xe524('0x29')]({'plain':!![]});var _0xd62772=_0xe524('0x2a');return db[_0xe524('0x2b')][_0xe524('0x28')]({'where':{'type':_0xd62772,'resourceId':_0x17e245['id']}})[_0xe524('0x27')](function(){return _0x599d5d;});})['then'](function(){_0x1ad106['status'](0xcc)[_0xe524('0x2c')]();});}};}function handleEntityNotFound(_0x45abad,_0x476572){return function(_0x109a96){if(!_0x109a96){_0x45abad[_0xe524('0x1c')](0x194);}return _0x109a96;};}function handleError(_0x5405e4,_0x52f140){_0x52f140=_0x52f140||0x1f4;return function(_0x4b1ff){logger[_0xe524('0x2d')](_0x4b1ff[_0xe524('0x2e')]);if(_0x4b1ff[_0xe524('0x2f')]){delete _0x4b1ff[_0xe524('0x2f')];}_0x5405e4['status'](_0x52f140)[_0xe524('0x30')](_0x4b1ff);};}exports[_0xe524('0x31')]=function(_0x4a4e15,_0x5b7ded){var _0x20688e={},_0x376324={},_0x5b2fc3={'count':0x0,'rows':[]};var _0x31d4a7=_['map'](db[_0xe524('0x32')]['rawAttributes'],function(_0x315e56){return{'name':_0x315e56[_0xe524('0x33')],'type':_0x315e56[_0xe524('0x34')]['key']};});_0x376324[_0xe524('0x35')]=_['map'](_0x31d4a7,_0xe524('0x2f'));_0x376324[_0xe524('0x36')]=_[_0xe524('0x37')](_0x4a4e15['query']);_0x376324[_0xe524('0x38')]=_[_0xe524('0x39')](_0x376324['model'],_0x376324[_0xe524('0x36')]);_0x20688e[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x376324[_0xe524('0x35')],qs['fields'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3b')]));_0x20688e[_0xe524('0x3a')]=_0x20688e[_0xe524('0x3a')][_0xe524('0x3c')]?_0x20688e[_0xe524('0x3a')]:_0x376324[_0xe524('0x35')];if(!_0x4a4e15[_0xe524('0x36')]['hasOwnProperty'](_0xe524('0x3d'))){_0x20688e['limit']=qs[_0xe524('0x20')](_0x4a4e15[_0xe524('0x36')]['limit']);_0x20688e[_0xe524('0x1e')]=qs['offset'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x1e')]);}_0x20688e[_0xe524('0x3e')]=qs[_0xe524('0x3f')](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3f')]);_0x20688e[_0xe524('0x40')]=qs[_0xe524('0x38')](_['pick'](_0x4a4e15[_0xe524('0x36')],_0x376324[_0xe524('0x38')]),_0x31d4a7);if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x41')]){_0x20688e[_0xe524('0x40')]=_[_0xe524('0x42')](_0x20688e[_0xe524('0x40')],{'$or':_[_0xe524('0x43')](_0x31d4a7,function(_0x5d3ea1){if(_0x5d3ea1[_0xe524('0x34')]!==_0xe524('0x44')){var _0x2e4a13={};_0x2e4a13[_0x5d3ea1['name']]={'$like':'%'+_0x4a4e15[_0xe524('0x36')]['filter']+'%'};return _0x2e4a13;}})});}_0x20688e=_[_0xe524('0x42')]({},_0x20688e,_0x4a4e15[_0xe524('0x45')]);var _0x43c314={'where':_0x20688e[_0xe524('0x40')]};return db[_0xe524('0x32')][_0xe524('0x1f')](_0x43c314)[_0xe524('0x27')](function(_0x52cd0e){_0x5b2fc3[_0xe524('0x1f')]=_0x52cd0e;if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x46')]){_0x20688e[_0xe524('0x47')]=[{'all':!![]}];}return db[_0xe524('0x32')][_0xe524('0x48')](_0x20688e);})['then'](function(_0xb694b9){_0x5b2fc3[_0xe524('0x49')]=_0xb694b9;return _0x5b2fc3;})[_0xe524('0x27')](respondWithFilteredResult(_0x5b7ded,_0x20688e))['catch'](handleError(_0x5b7ded,null));};exports[_0xe524('0x4a')]=function(_0x5209dc,_0x4e5d99){var _0x2b9b3b={'raw':!![],'where':{'id':_0x5209dc['params']['id']}},_0x33906d={};_0x33906d[_0xe524('0x35')]=_[_0xe524('0x37')](db[_0xe524('0x32')][_0xe524('0x4b')]);_0x33906d['query']=_['keys'](_0x5209dc[_0xe524('0x36')]);_0x33906d[_0xe524('0x38')]=_['intersection'](_0x33906d[_0xe524('0x35')],_0x33906d['query']);_0x2b9b3b[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x33906d[_0xe524('0x35')],qs[_0xe524('0x3b')](_0x5209dc[_0xe524('0x36')][_0xe524('0x3b')]));_0x2b9b3b[_0xe524('0x3a')]=_0x2b9b3b[_0xe524('0x3a')][_0xe524('0x3c')]?_0x2b9b3b[_0xe524('0x3a')]:_0x33906d[_0xe524('0x35')];if(_0x5209dc[_0xe524('0x36')][_0xe524('0x46')]){_0x2b9b3b[_0xe524('0x47')]=[{'all':!![]}];}_0x2b9b3b=_[_0xe524('0x42')]({},_0x2b9b3b,_0x5209dc['options']);return db[_0xe524('0x32')]['find'](_0x2b9b3b)['then'](handleEntityNotFound(_0x4e5d99,null))[_0xe524('0x27')](respondWithResult(_0x4e5d99,null))['catch'](handleError(_0x4e5d99,null));};exports[_0xe524('0x4c')]=function(_0x15d7ee,_0x561107){return db[_0xe524('0x32')]['create'](_0x15d7ee['body'],{})[_0xe524('0x27')](function(_0x1e5687){var _0x203e71=_0x15d7ee['user']['get']({'plain':!![]});if(!_0x203e71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x203e71['role']==='user'){var _0x5477ca=_0x1e5687[_0xe524('0x29')]({'plain':!![]});var _0x2ce5c0='Reports';return db[_0xe524('0x4d')][_0xe524('0x4e')]({'where':{'name':_0x2ce5c0,'userProfileId':_0x203e71[_0xe524('0x4f')]},'raw':!![]})[_0xe524('0x27')](function(_0x2fa143){if(_0x2fa143&&_0x2fa143['autoAssociation']===0x0){return db[_0xe524('0x2b')][_0xe524('0x4c')]({'name':_0x5477ca[_0xe524('0x2f')],'resourceId':_0x5477ca['id'],'type':'DefaultReports','sectionId':_0x2fa143['id']},{})[_0xe524('0x27')](function(){return _0x1e5687;});}else{return _0x1e5687;}})['catch'](function(_0x12e5d0){logger[_0xe524('0x2d')](_0xe524('0x50'),_0x12e5d0);throw _0x12e5d0;});}return _0x1e5687;})[_0xe524('0x27')](respondWithResult(_0x561107,0xc9))[_0xe524('0x51')](handleError(_0x561107,null));};exports[_0xe524('0x52')]=function(_0x1cec31,_0x374450){if(_0x1cec31[_0xe524('0x53')]['id']){delete _0x1cec31[_0xe524('0x53')]['id'];}return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x1cec31['params']['id']}})['then'](handleEntityNotFound(_0x374450,null))['then'](saveUpdates(_0x1cec31[_0xe524('0x53')],null))[_0xe524('0x27')](respondWithResult(_0x374450,null))[_0xe524('0x51')](handleError(_0x374450,null));};exports[_0xe524('0x28')]=function(_0x45fb0d,_0xef3d2f){return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x45fb0d[_0xe524('0x54')]['id']}})[_0xe524('0x27')](handleEntityNotFound(_0xef3d2f,null))[_0xe524('0x27')](removeEntity(_0xef3d2f,null))['catch'](handleError(_0xef3d2f,null));};exports[_0xe524('0x55')]=function(_0x1f0567,_0x4a5f4a){var _0x53da86=0xa;var _0x54adbd=['join',_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x8a2c00={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':_0xe524('0x5a'),'MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x582fbb={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x4f58ff=function(_0x5d0507){return!_[_0xe524('0x63')]([_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x67')],_0x5d0507);};var _0x474ed4=function(_0x5135f0){if(!_0x5135f0||!_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0xc3ccfd='(',_0x5d3b9c=0x0;_0x5d3b9c<_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')];_0x5d3b9c+=0x1){_0x5d3b9c>0x0&&(_0xc3ccfd+='\x20'+_0x5135f0[_0xe524('0x69')]+'\x20');_0xc3ccfd+=_0x5135f0['rules'][_0x5d3b9c]['group']?_0x474ed4(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6a')]):_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6b')]+'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c]['condition']+(_0x4f58ff(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6c')])?'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6d')]:'');}return _0xc3ccfd+')';};var _0x3ce098={'where':{'id':_0x1f0567[_0xe524('0x54')]['id']}},_0x22d06a,_0x35e6b2,_0x1e4b32,_0x27c55c,_0x7e5992;_0x3ce098=_['merge']({},_0x3ce098,_0x1f0567[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x3ce098)[_0xe524('0x27')](function(_0xeec885){if(_0xeec885){_0x22d06a=_0xeec885;return _0xeec885['getFields']();}return null;})[_0xe524('0x27')](function(_0x2341cf){if(_0x2341cf){if(!_0x2341cf[_0xe524('0x3c')]){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x35e6b2=_0x2341cf;return db[_0xe524('0x71')]['findAll']({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x245501){if(_0x245501){_0x1e4b32=_[_0xe524('0x72')](_0x245501,'id');var _0xce15f5;var _0x5ec07c=squel[_0xe524('0x73')]();_0x5ec07c['from'](_0x22d06a[_0xe524('0x74')]);for(var _0x2a88e2=0x0;_0x2a88e2<_0x35e6b2[_0xe524('0x3c')];_0x2a88e2+=0x1){_0xce15f5=_0x35e6b2[_0x2a88e2]['MetricId']?_0x1e4b32[_0x35e6b2[_0x2a88e2][_0xe524('0x75')]][_0xe524('0x76')]:_0x35e6b2[_0x2a88e2][_0xe524('0x6b')];_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x77')]?_[_0xe524('0x78')](_0x8a2c00[_0x35e6b2[_0x2a88e2]['function']],'%s',_0xce15f5):_0xce15f5;_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x79')]?_[_0xe524('0x78')](_0x582fbb[_0x35e6b2[_0x2a88e2][_0xe524('0x79')]],'%s',_0xce15f5):_0xce15f5;if(_0x35e6b2[_0x2a88e2][_0xe524('0x7a')]){_0x5ec07c[_0xe524('0x6a')](_0xce15f5);}_0x35e6b2[_0x2a88e2]['orderBy']&&_0x5ec07c[_0xe524('0x3e')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7b')]===_0xe524('0x7c')?![]:!![]);_0x5ec07c[_0xe524('0x6b')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7d')]||_0xce15f5);}if(_0x22d06a[_0xe524('0x7e')]){_0x22d06a['joins']=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x7e')]);for(var _0x1beaa2=0x0;_0x1beaa2<_0x22d06a['joins'][_0xe524('0x3c')];_0x1beaa2+=0x1){if(_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['type']&&_[_0xe524('0x63')](_0x54adbd,_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')])&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')]&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['foreignTable']&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]){_0x5ec07c[_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')]](_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x22d06a[_0xe524('0x74')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]));}}}if(_0x22d06a['conditions']){_0x22d06a[_0xe524('0x84')]=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x84')]);_0x5ec07c['where'](_0x474ed4(_0x22d06a[_0xe524('0x84')][_0xe524('0x6a')]));}_0x7e5992=_0x5ec07c['clone']();_0x5ec07c['limit'](_0x53da86);_0x5ec07c[_0xe524('0x1e')](0x0);logger['debug'](_0xe524('0x85'),_0x5ec07c['toString']());return dbH[_0xe524('0x86')][_0xe524('0x36')](_0x5ec07c[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')]['QueryTypes']['SELECT']});}})[_0xe524('0x27')](respondWithResult(_0x4a5f4a,null))[_0xe524('0x51')](handleError(_0x4a5f4a,null));};function runReport(_0x50eb96,_0x45c287,_0x449842){var _0x1f3ed1=_0x45c287['name'];var _0x19b063=0xa;var _0x140a4e=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x54385f={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':_0xe524('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1681c5={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x50f5e3=function(_0x11298c){return!_[_0xe524('0x63')]([_0xe524('0x64'),'IS\x20NOT\x20NULL',_0xe524('0x66'),_0xe524('0x67')],_0x11298c);};var _0x5603d0=function(_0x2712ac){if(!_0x2712ac||!_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0x32c9f6='(',_0x58d29e=0x0;_0x58d29e<_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')];_0x58d29e+=0x1){_0x58d29e>0x0&&(_0x32c9f6+='\x20'+_0x2712ac[_0xe524('0x69')]+'\x20');_0x32c9f6+=_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]?_0x5603d0(_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]):_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6b')]+'\x20'+_0x2712ac['rules'][_0x58d29e][_0xe524('0x6c')]+(_0x50f5e3(_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6c')])?'\x20'+_0x2712ac['rules'][_0x58d29e]['value']:'');}return _0x32c9f6+')';};var _0x334164={'where':{'id':_0x50eb96['id']}},_0x512572,_0x903e24,_0x4964c3,_0x2dc3f5,_0x246c62;_0x334164=_['merge']({},_0x334164,_0x449842);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x334164)['then'](function(_0x482b72){if(_0x482b72){_0x512572=_0x482b72;return _0x482b72[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x1b3e03){if(_0x1b3e03){if(!_0x1b3e03['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x903e24=_0x1b3e03;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x57501c){if(_0x57501c){_0x4964c3=_[_0xe524('0x72')](_0x57501c,'id');var _0x3a2834;var _0x4c7f45=squel['select']();_0x4c7f45[_0xe524('0x8c')](_0x512572[_0xe524('0x74')]);for(var _0x41f842=0x0;_0x41f842<_0x903e24[_0xe524('0x3c')];_0x41f842+=0x1){_0x3a2834=_0x903e24[_0x41f842]['MetricId']?_0x4964c3[_0x903e24[_0x41f842][_0xe524('0x75')]][_0xe524('0x76')]:_0x903e24[_0x41f842]['field'];_0x3a2834=_0x903e24[_0x41f842]['function']?_[_0xe524('0x78')](_0x54385f[_0x903e24[_0x41f842][_0xe524('0x77')]],'%s',_0x3a2834):_0x3a2834;_0x3a2834=_0x903e24[_0x41f842][_0xe524('0x79')]?_[_0xe524('0x78')](_0x1681c5[_0x903e24[_0x41f842][_0xe524('0x79')]],'%s',_0x3a2834):_0x3a2834;if(_0x903e24[_0x41f842][_0xe524('0x7a')]){_0x4c7f45['group'](_0x3a2834);}_0x903e24[_0x41f842]['orderBy']&&_0x4c7f45[_0xe524('0x3e')](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x4c7f45['field'](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7d')]||_0x3a2834);}if(_0x512572[_0xe524('0x7e')]){_0x512572[_0xe524('0x7e')]=JSON[_0xe524('0x7f')](_0x512572[_0xe524('0x7e')]);for(var _0xa820a1=0x0;_0xa820a1<_0x512572['joins']['length'];_0xa820a1+=0x1){if(_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x140a4e,_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')])&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x80')]&&_0x512572[_0xe524('0x7e')][_0xa820a1]['foreignTable']&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]){_0x4c7f45[_0x512572[_0xe524('0x7e')][_0xa820a1]['type']](_0x512572['joins'][_0xa820a1][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x512572[_0xe524('0x74')],_0x512572['joins'][_0xa820a1][_0xe524('0x80')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x82')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]));}}}if(_0x512572['conditions']){_0x512572[_0xe524('0x84')]=JSON['parse'](_0x512572[_0xe524('0x84')]);_0x4c7f45[_0xe524('0x40')](_0x5603d0(_0x512572['conditions'][_0xe524('0x6a')]));}_0x246c62=_0x4c7f45[_0xe524('0x8d')]();_0x4c7f45['limit'](_0x19b063);_0x4c7f45[_0xe524('0x1e')](0x0);return;}})['then'](function(){if(_0x45c287[_0xe524('0x8e')]===_0xe524('0x8f')){return null;}var _0x1be681=_[_0xe524('0x42')](_0x45c287,{'name':_0x45c287[_0xe524('0x90')]||_0x45c287[_0xe524('0x2f')]||_0x512572[_0xe524('0x2f')],'basename':_0x1f3ed1,'savename':util[_0xe524('0x79')]('%s-%s.%s',_0x45c287[_0xe524('0x2f')]||_0x512572['name'],require('randomstring')[_0xe524('0x91')](0x4),_0x45c287['output']||_0xe524('0x92')),'reportId':_0x512572['id'],'reportType':_0xe524('0x93')});return db[_0xe524('0x94')][_0xe524('0x4c')](_0x1be681,{'raw':!![]});})[_0xe524('0x27')](function(_0x26c802){if(_0x512572['table']==='cdr'){_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x95'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}else{_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x98'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}if(_0x26c802){logger['info'](_0xe524('0x99'),_0x246c62[_0xe524('0x87')]());require(_0xe524('0x9a'))[_0xe524('0x9b')](path[_0xe524('0x88')](__dirname,_0xe524('0x9c'),_0x26c802['output']),[_0x26c802['id'],_0x246c62[_0xe524('0x87')](),path[_0xe524('0x88')](__dirname,_0xe524('0x9d'),_0x26c802[_0xe524('0x9e')]),_0x1f3ed1]);return _0x26c802;}else{var _0x84bbd7=squel[_0xe524('0x73')]();_0x84bbd7[_0xe524('0x8c')]('('+_0x246c62[_0xe524('0x87')]()+')','countTable');_0x84bbd7['field']('COUNT(*)',_0xe524('0x1f'));_0x246c62[_0xe524('0x20')](_0x45c287['limit']||_0x19b063);_0x246c62[_0xe524('0x1e')](_0x45c287[_0xe524('0x1e')]||0x0);return dbH['sequelize'][_0xe524('0x36')](_0x84bbd7[_0xe524('0x87')](),{'type':dbH['sequelize'][_0xe524('0x9f')][_0xe524('0xa0')]})[_0xe524('0x27')](function(_0x542182){if(!_0x542182[_0xe524('0x3c')]){_0x2dc3f5=0x0;}else{_0x2dc3f5=_0x542182[0x0][_0xe524('0x1f')]||0x0;}return dbH[_0xe524('0x86')]['query'](_0x246c62[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});})['then'](function(_0x5e6a3d){return{'rows':_0x5e6a3d||[],'count':_0x2dc3f5};});}});}exports[_0xe524('0xa1')]=function(_0x33d066,_0x3ea495){return runReport(_0x33d066[_0xe524('0x54')],_0x33d066[_0xe524('0x36')],_0x33d066[_0xe524('0x45')])[_0xe524('0x27')](respondWithResult(_0x3ea495,null))[_0xe524('0x51')](handleError(_0x3ea495,null));};exports[_0xe524('0xa2')]=runReport;exports[_0xe524('0x36')]=function(_0x4505de,_0x292f14){var _0x2d24c1=0xa;var _0x483307=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x280022={'SUM':_0xe524('0xa3'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':'MIN(%s)','AVG':_0xe524('0x89'),'GROUP_CONCAT':_0xe524('0xa4'),'GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x46d6da={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x39998a=function(_0x107de8){return!_['includes']([_0xe524('0x64'),_0xe524('0x65'),'IS\x20EMPTY',_0xe524('0x67')],_0x107de8);};var _0x458e14=function(_0x4e0886){if(!_0x4e0886||!_0x4e0886['rules'][_0xe524('0x3c')]){return'';}for(var _0x3639cf='(',_0x575c14=0x0;_0x575c14<_0x4e0886['rules'][_0xe524('0x3c')];_0x575c14+=0x1){_0x575c14>0x0&&(_0x3639cf+='\x20'+_0x4e0886['operator']+'\x20');_0x3639cf+=_0x4e0886['rules'][_0x575c14]['group']?_0x458e14(_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6a')]):_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6b')]+'\x20'+_0x4e0886['rules'][_0x575c14]['condition']+(_0x39998a(_0x4e0886['rules'][_0x575c14][_0xe524('0x6c')])?'\x20'+_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6d')]:'');}return _0x3639cf+')';};var _0x289720={'where':{'id':_0x4505de[_0xe524('0x54')]['id']}},_0x3fb45c,_0x3362fe,_0x119684,_0x19e4fd,_0x4b4349;_0x289720=_[_0xe524('0x42')]({},_0x289720,_0x4505de[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x289720)[_0xe524('0x27')](function(_0x404a49){if(_0x404a49){_0x3fb45c=_0x404a49;return _0x404a49[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x8e8087){if(_0x8e8087){if(!_0x8e8087['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x3362fe=_0x8e8087;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x113a54){if(_0x113a54){_0x119684=_[_0xe524('0x72')](_0x113a54,'id');var _0x4ebca4;var _0x40043c=squel[_0xe524('0x73')]();_0x40043c[_0xe524('0x8c')](_0x3fb45c[_0xe524('0x74')]);for(var _0x19a773=0x0;_0x19a773<_0x3362fe[_0xe524('0x3c')];_0x19a773+=0x1){_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x75')]?_0x119684[_0x3362fe[_0x19a773][_0xe524('0x75')]][_0xe524('0x76')]:_0x3362fe[_0x19a773][_0xe524('0x6b')];_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x77')]?_[_0xe524('0x78')](_0x280022[_0x3362fe[_0x19a773]['function']],'%s',_0x4ebca4):_0x4ebca4;_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x79')]?_[_0xe524('0x78')](_0x46d6da[_0x3362fe[_0x19a773][_0xe524('0x79')]],'%s',_0x4ebca4):_0x4ebca4;if(_0x3362fe[_0x19a773]['groupBy']){_0x40043c['group'](_0x4ebca4);}_0x3362fe[_0x19a773][_0xe524('0x7b')]&&_0x40043c[_0xe524('0x3e')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x40043c[_0xe524('0x6b')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7d')]||_0x4ebca4);}if(_0x3fb45c[_0xe524('0x7e')]){_0x3fb45c['joins']=JSON['parse'](_0x3fb45c[_0xe524('0x7e')]);for(var _0x2a85e5=0x0;_0x2a85e5<_0x3fb45c[_0xe524('0x7e')]['length'];_0x2a85e5+=0x1){if(_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x483307,_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')])&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')]&&_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')]&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]){_0x40043c[_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]](_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')],null,util[_0xe524('0x79')]('%s.%s\x20=\x20%s.%s',_0x3fb45c[_0xe524('0x74')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x82')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]));}}}if(_0x3fb45c[_0xe524('0x84')]){_0x3fb45c[_0xe524('0x84')]=JSON['parse'](_0x3fb45c['conditions']);_0x40043c[_0xe524('0x40')](_0x458e14(_0x3fb45c[_0xe524('0x84')][_0xe524('0x6a')]));}_0x4b4349=_0x40043c[_0xe524('0x8d')]();_0x40043c[_0xe524('0x20')](_0x2d24c1);_0x40043c[_0xe524('0x1e')](0x0);logger[_0xe524('0xa5')]('Limited\x20Query:',_0x40043c['toString']());return dbH[_0xe524('0x86')]['query'](_0x40043c['toString'](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});}})[_0xe524('0x27')](function(){return{'sql':_0x4b4349[_0xe524('0x87')]()};})[_0xe524('0x27')](respondWithResult(_0x292f14,null))['catch'](handleError(_0x292f14,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e207f32..9920864 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 _0xec7c=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','analytics_default_reports','lodash'];(function(_0x2bdaf6,_0x5a48fe){var _0x33c743=function(_0x26e380){while(--_0x26e380){_0x2bdaf6['push'](_0x2bdaf6['shift']());}};_0x33c743(++_0x5a48fe);}(_0xec7c,0x1c1));var _0xcec7=function(_0x32d225,_0x459300){_0x32d225=_0x32d225-0x0;var _0x22293b=_0xec7c[_0x32d225];return _0x22293b;};'use strict';var _=require(_0xcec7('0x0'));var util=require('util');var logger=require(_0xcec7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcec7('0x2'));var rp=require(_0xcec7('0x3'));var fs=require('fs');var path=require(_0xcec7('0x4'));var rimraf=require(_0xcec7('0x5'));var config=require(_0xcec7('0x6'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x2114cc,_0x382308){return _0x2114cc[_0xcec7('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0xcec7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc171=['AnalyticDefaultReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x3b2605,_0xd7bdfc){var _0x2c503c=function(_0x1edc04){while(--_0x1edc04){_0x3b2605['push'](_0x3b2605['shift']());}};_0x2c503c(++_0xd7bdfc);}(_0xc171,0x6f));var _0x1c17=function(_0x12efa0,_0x579590){_0x12efa0=_0x12efa0-0x0;var _0x158c02=_0xc171[_0x12efa0];return _0x158c02;};'use strict';var _=require(_0x1c17('0x0'));var util=require('util');var logger=require(_0x1c17('0x1'))(_0x1c17('0x2'));var moment=require(_0x1c17('0x3'));var BPromise=require(_0x1c17('0x4'));var rp=require(_0x1c17('0x5'));var fs=require('fs');var path=require(_0x1c17('0x6'));var rimraf=require('rimraf');var config=require(_0x1c17('0x7'));var attributes=require(_0x1c17('0x8'));module[_0x1c17('0x9')]=function(_0x417fef,_0x2640ef){return _0x417fef['define'](_0x1c17('0xa'),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 3318169..c0b0811 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 _0xe93f=['debug','error','message','AnalyticDefaultReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xe93f,0xb0));var _0xfe93=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe93f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe93('0x0'));var util=require(_0xfe93('0x1'));var moment=require(_0xfe93('0x2'));var BPromise=require(_0xfe93('0x3'));var rs=require(_0xfe93('0x4'));var fs=require('fs');var Redis=require(_0xfe93('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe93('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfe93('0x7'));var jayson=require(_0xfe93('0x8'));var client=jayson['client'][_0xfe93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bf420,_0x22bf50,_0x19dea2){return new BPromise(function(_0x259174,_0x16b8c9){return client[_0xfe93('0xa')](_0x4bf420,_0x19dea2)[_0xfe93('0xb')](function(_0x14f334){logger[_0xfe93('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0xfe93('0xd'));logger[_0xfe93('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x22bf50,'request\x20sent',JSON['stringify'](_0x14f334));if(_0x14f334[_0xfe93('0xf')]){if(_0x14f334[_0xfe93('0xf')]['code']===0x1f4){logger[_0xfe93('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0x14f334[_0xfe93('0xf')][_0xfe93('0x10')]);return _0x16b8c9(_0x14f334[_0xfe93('0xf')][_0xfe93('0x10')]);}logger[_0xfe93('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0x14f334[_0xfe93('0xf')][_0xfe93('0x10')]);return _0x259174(_0x14f334['error'][_0xfe93('0x10')]);}else{logger[_0xfe93('0xc')](_0xfe93('0x11'),_0x22bf50,'request\x20sent');_0x259174(_0x14f334[_0xfe93('0x12')][_0xfe93('0x10')]);}})['catch'](function(_0x1f4249){logger[_0xfe93('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0x1f4249);_0x16b8c9(_0x1f4249);});});} \ No newline at end of file +var _0x4c44=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x268ae4,_0x4280bf){var _0x432e21=function(_0x51ce74){while(--_0x51ce74){_0x268ae4['push'](_0x268ae4['shift']());}};_0x432e21(++_0x4280bf);}(_0x4c44,0x1ea));var _0x44c4=function(_0x13f1c8,_0x49a872){_0x13f1c8=_0x13f1c8-0x0;var _0x1e716a=_0x4c44[_0x13f1c8];return _0x1e716a;};'use strict';var _=require(_0x44c4('0x0'));var util=require(_0x44c4('0x1'));var moment=require(_0x44c4('0x2'));var BPromise=require(_0x44c4('0x3'));var rs=require(_0x44c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44c4('0x5'))['db'];var utils=require(_0x44c4('0x6'));var logger=require(_0x44c4('0x7'))(_0x44c4('0x8'));var config=require(_0x44c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x44c4('0xa')][_0x44c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x241fb8,_0x9312d,_0x4519b9){return new BPromise(function(_0x313341,_0x1ce151){return client[_0x44c4('0xc')](_0x241fb8,_0x4519b9)[_0x44c4('0xd')](function(_0x180d45){logger[_0x44c4('0xe')](_0x44c4('0xf'),_0x9312d,_0x44c4('0x10'));logger[_0x44c4('0x11')](_0x44c4('0x12'),_0x9312d,'request\x20sent',JSON[_0x44c4('0x13')](_0x180d45));if(_0x180d45['error']){if(_0x180d45[_0x44c4('0x14')][_0x44c4('0x15')]===0x1f4){logger[_0x44c4('0x14')](_0x44c4('0xf'),_0x9312d,_0x180d45[_0x44c4('0x14')]['message']);return _0x1ce151(_0x180d45[_0x44c4('0x14')][_0x44c4('0x16')]);}logger[_0x44c4('0x14')](_0x44c4('0xf'),_0x9312d,_0x180d45[_0x44c4('0x14')]['message']);return _0x313341(_0x180d45[_0x44c4('0x14')]['message']);}else{logger[_0x44c4('0xe')](_0x44c4('0xf'),_0x9312d,_0x44c4('0x10'));_0x313341(_0x180d45[_0x44c4('0x17')][_0x44c4('0x16')]);}})['catch'](function(_0x1e456d){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x9312d,_0x1e456d);_0x1ce151(_0x1e456d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f28bfd3..9b65ceb 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 _0xe84a=['/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/query','query','post','create','put'];(function(_0x4e6fb2,_0x3cf23e){var _0x2f1636=function(_0x53c7eb){while(--_0x53c7eb){_0x4e6fb2['push'](_0x4e6fb2['shift']());}};_0x2f1636(++_0x3cf23e);}(_0xe84a,0x113));var _0xae84=function(_0x271575,_0x181a21){_0x271575=_0x271575-0x0;var _0x1cd7d2=_0xe84a[_0x271575];return _0x1cd7d2;};'use strict';var multer=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var path=require(_0xae84('0x2'));var timeout=require(_0xae84('0x3'));var express=require(_0xae84('0x4'));var router=express[_0xae84('0x5')]();var fs_extra=require(_0xae84('0x6'));var auth=require(_0xae84('0x7'));var interaction=require(_0xae84('0x8'));var config=require(_0xae84('0x9'));var controller=require('./analyticDefaultReport.controller');router[_0xae84('0xa')]('/',auth['isAuthenticated'](),controller[_0xae84('0xb')]);router[_0xae84('0xa')]('/:id',auth[_0xae84('0xc')](),controller[_0xae84('0xd')]);router[_0xae84('0xa')]('/:id/preview',auth[_0xae84('0xc')](),controller['preview']);router[_0xae84('0xa')]('/:id/run',auth[_0xae84('0xc')](),controller['run']);router[_0xae84('0xa')](_0xae84('0xe'),auth[_0xae84('0xc')](),controller[_0xae84('0xf')]);router[_0xae84('0x10')]('/',auth[_0xae84('0xc')](),controller[_0xae84('0x11')]);router[_0xae84('0x12')](_0xae84('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xae84('0x13'),auth[_0xae84('0xc')](),controller[_0xae84('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4d23=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','/:id'];(function(_0x11b82f,_0x582d1b){var _0x480cf2=function(_0x30df53){while(--_0x30df53){_0x11b82f['push'](_0x11b82f['shift']());}};_0x480cf2(++_0x582d1b);}(_0x4d23,0x91));var _0x34d2=function(_0x1974eb,_0x3860d1){_0x1974eb=_0x1974eb-0x0;var _0x164088=_0x4d23[_0x1974eb];return _0x164088;};'use strict';var multer=require('multer');var util=require(_0x34d2('0x0'));var path=require(_0x34d2('0x1'));var timeout=require(_0x34d2('0x2'));var express=require(_0x34d2('0x3'));var router=express[_0x34d2('0x4')]();var fs_extra=require(_0x34d2('0x5'));var auth=require(_0x34d2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x34d2('0x7'));var controller=require(_0x34d2('0x8'));router['get']('/',auth[_0x34d2('0x9')](),controller[_0x34d2('0xa')]);router[_0x34d2('0xb')]('/:id',auth[_0x34d2('0x9')](),controller[_0x34d2('0xc')]);router[_0x34d2('0xb')](_0x34d2('0xd'),auth[_0x34d2('0x9')](),controller[_0x34d2('0xe')]);router[_0x34d2('0xb')](_0x34d2('0xf'),auth['isAuthenticated'](),controller[_0x34d2('0x10')]);router['get']('/:id/query',auth[_0x34d2('0x9')](),controller[_0x34d2('0x11')]);router[_0x34d2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34d2('0x13')]('/:id',auth[_0x34d2('0x9')](),controller[_0x34d2('0x14')]);router[_0x34d2('0x15')](_0x34d2('0x16'),auth[_0x34d2('0x9')](),controller['destroy']);module[_0x34d2('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 2fd36f6..4efd50b 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 _0x38c9=['UNSIGNED','sequelize','csv','pdf','xlsx','STRING','DATE','ENUM','manual','scheduled'];(function(_0x444625,_0x517882){var _0x1730f2=function(_0x271845){while(--_0x271845){_0x444625['push'](_0x444625['shift']());}};_0x1730f2(++_0x517882);}(_0x38c9,0x10f));var _0x938c=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x38c9[_0x21af3a];return _0x268a49;};'use strict';var Sequelize=require(_0x938c('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x938c('0x1'),_0x938c('0x2'),_0x938c('0x3')),'allowNull':![],'defaultValue':_0x938c('0x1')},'savename':{'type':Sequelize[_0x938c('0x4')],'allowNull':![]},'startDate':{'type':Sequelize[_0x938c('0x5')]},'endDate':{'type':Sequelize[_0x938c('0x5')]},'status':{'type':Sequelize[_0x938c('0x4')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x938c('0x6')](_0x938c('0x7'),_0x938c('0x8')),'allowNull':![],'defaultValue':_0x938c('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x938c('0x9')]},'reportType':{'type':Sequelize[_0x938c('0x4')]}}; \ No newline at end of file +var _0x5e23=['xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf'];(function(_0x531b74,_0x3a473b){var _0x513d17=function(_0x2ea644){while(--_0x2ea644){_0x531b74['push'](_0x531b74['shift']());}};_0x513d17(++_0x3a473b);}(_0x5e23,0xca));var _0x35e2=function(_0x4d77c3,_0x194d2d){_0x4d77c3=_0x4d77c3-0x0;var _0x5b548b=_0x5e23[_0x4d77c3];return _0x5b548b;};'use strict';var Sequelize=require(_0x35e2('0x0'));var moment=require(_0x35e2('0x1'));module['exports']={'name':{'type':Sequelize[_0x35e2('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x35e2('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x35e2('0x3')](_0x35e2('0x4'),_0x35e2('0x5'),_0x35e2('0x6')),'allowNull':![],'defaultValue':_0x35e2('0x4')},'savename':{'type':Sequelize[_0x35e2('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x35e2('0x7')]},'endDate':{'type':Sequelize[_0x35e2('0x7')]},'status':{'type':Sequelize[_0x35e2('0x2')],'defaultValue':_0x35e2('0x8')},'type':{'type':Sequelize['ENUM'](_0x35e2('0x9'),_0x35e2('0xa')),'allowNull':![],'defaultValue':_0x35e2('0x9')},'reportId':{'type':Sequelize[_0x35e2('0xb')](0xb)[_0x35e2('0xc')]},'reportType':{'type':Sequelize[_0x35e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9ac279f..65c5730 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 _0xa593=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','AnalyticExtractedReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','filter','merge','options','includeAll','findAll','catch','show','keys','fields','include','find','body','user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x48de6b,_0x336431){var _0x501fcc=function(_0x4aa33b){while(--_0x4aa33b){_0x48de6b['push'](_0x48de6b['shift']());}};_0x501fcc(++_0x336431);}(_0xa593,0x175));var _0x3a59=function(_0x4d8f76,_0x2663fb){_0x4d8f76=_0x4d8f76-0x0;var _0x4a2345=_0xa593[_0x4d8f76];return _0x4a2345;};'use strict';var emlformat=require(_0x3a59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a59('0x1'));var rp=require(_0x3a59('0x2'));var moment=require('moment');var BPromise=require(_0x3a59('0x3'));var Mustache=require(_0x3a59('0x4'));var util=require(_0x3a59('0x5'));var path=require(_0x3a59('0x6'));var sox=require('sox');var csv=require(_0x3a59('0x7'));var ejs=require(_0x3a59('0x8'));var fs=require('fs');var fs_extra=require(_0x3a59('0x9'));var _=require(_0x3a59('0xa'));var squel=require(_0x3a59('0xb'));var crypto=require(_0x3a59('0xc'));var jsforce=require(_0x3a59('0xd'));var deskjs=require(_0x3a59('0xe'));var toCsv=require(_0x3a59('0x7'));var querystring=require(_0x3a59('0xf'));var Papa=require('papaparse');var Redis=require(_0x3a59('0x10'));var authService=require(_0x3a59('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a59('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a59('0x13'))(_0x3a59('0x14'));var utils=require(_0x3a59('0x15'));var config=require(_0x3a59('0x16'));var licenseUtil=require(_0x3a59('0x17'));var db=require(_0x3a59('0x18'))['db'];function respondWithStatusCode(_0x3f3006,_0x3e4ae7){_0x3e4ae7=_0x3e4ae7||0xcc;return function(_0x58d751){if(_0x58d751){return _0x3f3006[_0x3a59('0x19')](_0x3e4ae7);}return _0x3f3006[_0x3a59('0x1a')](_0x3e4ae7)[_0x3a59('0x1b')]();};}function respondWithResult(_0x514b5f,_0x5b21cf){_0x5b21cf=_0x5b21cf||0xc8;return function(_0x11cd01){if(_0x11cd01){return _0x514b5f[_0x3a59('0x1a')](_0x5b21cf)[_0x3a59('0x1c')](_0x11cd01);}};}function respondWithFilteredResult(_0xe5aadf,_0x301aa7){return function(_0x5205f6){if(_0x5205f6){var _0x23d94d=typeof _0x301aa7[_0x3a59('0x1d')]==='undefined'&&typeof _0x301aa7[_0x3a59('0x1e')]===_0x3a59('0x1f');var _0x5ea7af=_0x5205f6[_0x3a59('0x20')];var _0x1ad69b=_0x23d94d?0x0:_0x301aa7[_0x3a59('0x1d')];var _0x3eee23=_0x23d94d?_0x5205f6['count']:_0x301aa7['offset']+_0x301aa7[_0x3a59('0x1e')];var _0x3c27c6;if(_0x3eee23>=_0x5ea7af){_0x3eee23=_0x5ea7af;_0x3c27c6=0xc8;}else{_0x3c27c6=0xce;}_0xe5aadf[_0x3a59('0x1a')](_0x3c27c6);return _0xe5aadf[_0x3a59('0x21')](_0x3a59('0x22'),_0x1ad69b+'-'+_0x3eee23+'/'+_0x5ea7af)[_0x3a59('0x1c')](_0x5205f6);}return null;};}function patchUpdates(_0x19b7df){return function(_0x54c5fe){try{jsonpatch['apply'](_0x54c5fe,_0x19b7df,!![]);}catch(_0x48de4f){return BPromise[_0x3a59('0x23')](_0x48de4f);}return _0x54c5fe[_0x3a59('0x24')]();};}function saveUpdates(_0x56ded0,_0xd83e47){return function(_0x815e2){if(_0x815e2){return _0x815e2[_0x3a59('0x25')](_0x56ded0)[_0x3a59('0x26')](function(_0x41a1dc){return _0x41a1dc;});}return null;};}function removeEntity(_0x285930,_0x3d3168){return function(_0x5cd755){if(_0x5cd755){return _0x5cd755[_0x3a59('0x27')]()['then'](function(){var _0x4a14b2=_0x5cd755[_0x3a59('0x28')]({'plain':!![]});var _0x4723bb=_0x3a59('0x29');return db[_0x3a59('0x2a')][_0x3a59('0x27')]({'where':{'type':_0x4723bb,'resourceId':_0x4a14b2['id']}})[_0x3a59('0x26')](function(){return _0x5cd755;});})[_0x3a59('0x26')](function(){_0x285930[_0x3a59('0x1a')](0xcc)[_0x3a59('0x1b')]();});}};}function handleEntityNotFound(_0x3733bc,_0x5a8beb){return function(_0x45d584){if(!_0x45d584){_0x3733bc[_0x3a59('0x19')](0x194);}return _0x45d584;};}function handleError(_0x2fa478,_0x5c5132){_0x5c5132=_0x5c5132||0x1f4;return function(_0x3a8716){logger[_0x3a59('0x2b')](_0x3a8716['stack']);if(_0x3a8716[_0x3a59('0x2c')]){delete _0x3a8716[_0x3a59('0x2c')];}_0x2fa478[_0x3a59('0x1a')](_0x5c5132)['send'](_0x3a8716);};}exports['index']=function(_0x313047,_0x14d301){var _0x45af77={},_0x493550={},_0x6a6130={'count':0x0,'rows':[]};var _0x1d61d0=_['map'](db[_0x3a59('0x2d')][_0x3a59('0x2e')],function(_0x118e3d){return{'name':_0x118e3d[_0x3a59('0x2f')],'type':_0x118e3d['type'][_0x3a59('0x30')]};});_0x493550[_0x3a59('0x31')]=_[_0x3a59('0x32')](_0x1d61d0,_0x3a59('0x2c'));_0x493550[_0x3a59('0x33')]=_['keys'](_0x313047[_0x3a59('0x33')]);_0x493550['filters']=_[_0x3a59('0x34')](_0x493550[_0x3a59('0x31')],_0x493550[_0x3a59('0x33')]);_0x45af77[_0x3a59('0x35')]=_[_0x3a59('0x34')](_0x493550['model'],qs['fields'](_0x313047[_0x3a59('0x33')]['fields']));_0x45af77[_0x3a59('0x35')]=_0x45af77[_0x3a59('0x35')][_0x3a59('0x36')]?_0x45af77[_0x3a59('0x35')]:_0x493550[_0x3a59('0x31')];if(!_0x313047[_0x3a59('0x33')][_0x3a59('0x37')](_0x3a59('0x38'))){_0x45af77[_0x3a59('0x1e')]=qs['limit'](_0x313047[_0x3a59('0x33')][_0x3a59('0x1e')]);_0x45af77[_0x3a59('0x1d')]=qs['offset'](_0x313047[_0x3a59('0x33')]['offset']);}_0x45af77[_0x3a59('0x39')]=qs[_0x3a59('0x3a')](_0x313047['query']['sort']);_0x45af77[_0x3a59('0x3b')]=qs[_0x3a59('0x3c')](_[_0x3a59('0x3d')](_0x313047[_0x3a59('0x33')],_0x493550[_0x3a59('0x3c')]),_0x1d61d0);if(_0x313047[_0x3a59('0x33')]['filter']){_0x45af77[_0x3a59('0x3b')]=_['merge'](_0x45af77['where'],{'$or':_[_0x3a59('0x32')](_0x1d61d0,function(_0x4a2bf2){if(_0x4a2bf2[_0x3a59('0x3e')]!=='VIRTUAL'){var _0x412172={};_0x412172[_0x4a2bf2['name']]={'$like':'%'+_0x313047[_0x3a59('0x33')][_0x3a59('0x3f')]+'%'};return _0x412172;}})});}_0x45af77=_[_0x3a59('0x40')]({},_0x45af77,_0x313047[_0x3a59('0x41')]);var _0x164756={'where':_0x45af77[_0x3a59('0x3b')]};return db['AnalyticExtractedReport'][_0x3a59('0x20')](_0x164756)[_0x3a59('0x26')](function(_0x12acf7){_0x6a6130[_0x3a59('0x20')]=_0x12acf7;if(_0x313047[_0x3a59('0x33')][_0x3a59('0x42')]){_0x45af77['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x3a59('0x43')](_0x45af77);})[_0x3a59('0x26')](function(_0x4b9494){_0x6a6130['rows']=_0x4b9494;return _0x6a6130;})[_0x3a59('0x26')](respondWithFilteredResult(_0x14d301,_0x45af77))[_0x3a59('0x44')](handleError(_0x14d301,null));};exports[_0x3a59('0x45')]=function(_0x335243,_0x47a32f){var _0x477beb={'raw':!![],'where':{'id':_0x335243['params']['id']}},_0x135c3b={};_0x135c3b[_0x3a59('0x31')]=_[_0x3a59('0x46')](db['AnalyticExtractedReport']['rawAttributes']);_0x135c3b[_0x3a59('0x33')]=_[_0x3a59('0x46')](_0x335243[_0x3a59('0x33')]);_0x135c3b[_0x3a59('0x3c')]=_[_0x3a59('0x34')](_0x135c3b[_0x3a59('0x31')],_0x135c3b['query']);_0x477beb['attributes']=_[_0x3a59('0x34')](_0x135c3b[_0x3a59('0x31')],qs['fields'](_0x335243[_0x3a59('0x33')][_0x3a59('0x47')]));_0x477beb[_0x3a59('0x35')]=_0x477beb[_0x3a59('0x35')][_0x3a59('0x36')]?_0x477beb[_0x3a59('0x35')]:_0x135c3b[_0x3a59('0x31')];if(_0x335243['query']['includeAll']){_0x477beb[_0x3a59('0x48')]=[{'all':!![]}];}_0x477beb=_['merge']({},_0x477beb,_0x335243['options']);return db[_0x3a59('0x2d')][_0x3a59('0x49')](_0x477beb)[_0x3a59('0x26')](handleEntityNotFound(_0x47a32f,null))[_0x3a59('0x26')](respondWithResult(_0x47a32f,null))[_0x3a59('0x44')](handleError(_0x47a32f,null));};exports['create']=function(_0x51f62f,_0x535006){return db['AnalyticExtractedReport']['create'](_0x51f62f[_0x3a59('0x4a')],{})['then'](function(_0x230706){var _0x1e70ae=_0x51f62f[_0x3a59('0x4b')][_0x3a59('0x28')]({'plain':!![]});if(!_0x1e70ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e70ae[_0x3a59('0x4c')]===_0x3a59('0x4b')){var _0x215471=_0x230706[_0x3a59('0x28')]({'plain':!![]});var _0x443930=_0x3a59('0x29');return db[_0x3a59('0x4d')][_0x3a59('0x49')]({'where':{'name':_0x443930,'userProfileId':_0x1e70ae['userProfileId']},'raw':!![]})['then'](function(_0x2a0385){if(_0x2a0385&&_0x2a0385['autoAssociation']===0x0){return db['UserProfileResource'][_0x3a59('0x4e')]({'name':_0x215471['name'],'resourceId':_0x215471['id'],'type':_0x2a0385[_0x3a59('0x2c')],'sectionId':_0x2a0385['id']},{})[_0x3a59('0x26')](function(){return _0x230706;});}else{return _0x230706;}})[_0x3a59('0x44')](function(_0x5ab818){logger[_0x3a59('0x2b')](_0x3a59('0x4f'),_0x5ab818);throw _0x5ab818;});}return _0x230706;})[_0x3a59('0x26')](respondWithResult(_0x535006,0xc9))[_0x3a59('0x44')](handleError(_0x535006,null));};exports[_0x3a59('0x25')]=function(_0x347417,_0x59a03c){if(_0x347417[_0x3a59('0x4a')]['id']){delete _0x347417['body']['id'];}return db[_0x3a59('0x2d')][_0x3a59('0x49')]({'where':{'id':_0x347417[_0x3a59('0x50')]['id']}})['then'](handleEntityNotFound(_0x59a03c,null))[_0x3a59('0x26')](saveUpdates(_0x347417[_0x3a59('0x4a')],null))[_0x3a59('0x26')](respondWithResult(_0x59a03c,null))['catch'](handleError(_0x59a03c,null));};exports['destroy']=function(_0x1e924a,_0x3df7ee){return db[_0x3a59('0x2d')][_0x3a59('0x49')]({'where':{'id':_0x1e924a[_0x3a59('0x50')]['id']}})[_0x3a59('0x26')](handleEntityNotFound(_0x3df7ee,null))[_0x3a59('0x26')](removeEntity(_0x3df7ee,null))[_0x3a59('0x44')](handleError(_0x3df7ee,null));};exports[_0x3a59('0x51')]=function(_0x4bcb85,_0x2c1185,_0x4b9220){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4bcb85[_0x3a59('0x50')]['id']},'attributes':[_0x3a59('0x2c'),_0x3a59('0x52'),_0x3a59('0x53'),_0x3a59('0x54')],'raw':!![]})[_0x3a59('0x26')](handleEntityNotFound(_0x2c1185,null))[_0x3a59('0x26')](function(_0x491403){if(_0x491403){if(!fs[_0x3a59('0x55')](path[_0x3a59('0x56')](config[_0x3a59('0x57')],_0x3a59('0x58'),_0x491403[_0x3a59('0x53')]))){throw new db[(_0x3a59('0x59'))][(_0x3a59('0x5a'))](_0x3a59('0x5b'));}if(_0x4bcb85['query'][_0x3a59('0x5c')]){return _0x2c1185['sendStatus'](0xc8);}return _0x2c1185[_0x3a59('0x51')](path['join'](config[_0x3a59('0x57')],'server/files/reports',_0x491403[_0x3a59('0x53')]),util['format'](_0x3a59('0x5d'),_0x491403['basename']||_0x491403[_0x3a59('0x2c')],_0x491403[_0x3a59('0x54')][_0x3a59('0x5e')]()));}})['catch'](handleError(_0x2c1185,null));}; \ No newline at end of file +var _0xd5b7=['filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','AnalyticExtractedReport','include','catch','show','params','keys','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','query'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd5b7,0x88));var _0x7d5b=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xd5b7[_0x561f25];return _0x150e4c;};'use strict';var emlformat=require(_0x7d5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d5b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d5b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7d5b('0x3'));var util=require(_0x7d5b('0x4'));var path=require(_0x7d5b('0x5'));var sox=require(_0x7d5b('0x6'));var csv=require(_0x7d5b('0x7'));var ejs=require(_0x7d5b('0x8'));var fs=require('fs');var fs_extra=require(_0x7d5b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7d5b('0xa'));var jsforce=require(_0x7d5b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7d5b('0xc'));var Redis=require(_0x7d5b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7d5b('0xe'));var as=require(_0x7d5b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d5b('0x10'))('api');var utils=require(_0x7d5b('0x11'));var config=require(_0x7d5b('0x12'));var licenseUtil=require(_0x7d5b('0x13'));var db=require(_0x7d5b('0x14'))['db'];function respondWithStatusCode(_0x2ca3c4,_0x2b7dc5){_0x2b7dc5=_0x2b7dc5||0xcc;return function(_0x32994b){if(_0x32994b){return _0x2ca3c4[_0x7d5b('0x15')](_0x2b7dc5);}return _0x2ca3c4[_0x7d5b('0x16')](_0x2b7dc5)[_0x7d5b('0x17')]();};}function respondWithResult(_0x473916,_0x282eb7){_0x282eb7=_0x282eb7||0xc8;return function(_0x4dc6bc){if(_0x4dc6bc){return _0x473916[_0x7d5b('0x16')](_0x282eb7)[_0x7d5b('0x18')](_0x4dc6bc);}};}function respondWithFilteredResult(_0x249c07,_0x5bb3d2){return function(_0xf81ed7){if(_0xf81ed7){var _0x3f5026=typeof _0x5bb3d2[_0x7d5b('0x19')]==='undefined'&&typeof _0x5bb3d2[_0x7d5b('0x1a')]===_0x7d5b('0x1b');var _0x147776=_0xf81ed7[_0x7d5b('0x1c')];var _0x2dc5dd=_0x3f5026?0x0:_0x5bb3d2[_0x7d5b('0x19')];var _0x23c4c2=_0x3f5026?_0xf81ed7[_0x7d5b('0x1c')]:_0x5bb3d2['offset']+_0x5bb3d2['limit'];var _0x33935a;if(_0x23c4c2>=_0x147776){_0x23c4c2=_0x147776;_0x33935a=0xc8;}else{_0x33935a=0xce;}_0x249c07[_0x7d5b('0x16')](_0x33935a);return _0x249c07[_0x7d5b('0x1d')](_0x7d5b('0x1e'),_0x2dc5dd+'-'+_0x23c4c2+'/'+_0x147776)['json'](_0xf81ed7);}return null;};}function patchUpdates(_0x2ece4e){return function(_0x1c17af){try{jsonpatch[_0x7d5b('0x1f')](_0x1c17af,_0x2ece4e,!![]);}catch(_0x48a301){return BPromise[_0x7d5b('0x20')](_0x48a301);}return _0x1c17af['save']();};}function saveUpdates(_0xff143b,_0x311bae){return function(_0x21f035){if(_0x21f035){return _0x21f035[_0x7d5b('0x21')](_0xff143b)[_0x7d5b('0x22')](function(_0x483931){return _0x483931;});}return null;};}function removeEntity(_0x568281,_0x25113a){return function(_0x1e43e){if(_0x1e43e){return _0x1e43e[_0x7d5b('0x23')]()[_0x7d5b('0x22')](function(){var _0x2085ef=_0x1e43e[_0x7d5b('0x24')]({'plain':!![]});var _0x499438=_0x7d5b('0x25');return db[_0x7d5b('0x26')]['destroy']({'where':{'type':_0x499438,'resourceId':_0x2085ef['id']}})[_0x7d5b('0x22')](function(){return _0x1e43e;});})[_0x7d5b('0x22')](function(){_0x568281[_0x7d5b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x344190,_0x173380){return function(_0x579c7c){if(!_0x579c7c){_0x344190[_0x7d5b('0x15')](0x194);}return _0x579c7c;};}function handleError(_0x5a5f45,_0x4b2f94){_0x4b2f94=_0x4b2f94||0x1f4;return function(_0x56b42e){logger['error'](_0x56b42e[_0x7d5b('0x27')]);if(_0x56b42e[_0x7d5b('0x28')]){delete _0x56b42e[_0x7d5b('0x28')];}_0x5a5f45[_0x7d5b('0x16')](_0x4b2f94)[_0x7d5b('0x29')](_0x56b42e);};}exports[_0x7d5b('0x2a')]=function(_0x55f19a,_0x4a75f3){var _0x56b149={},_0x5e4d6a={},_0x1eee33={'count':0x0,'rows':[]};var _0x1f6ec2=_['map'](db['AnalyticExtractedReport'][_0x7d5b('0x2b')],function(_0x3e12a0){return{'name':_0x3e12a0[_0x7d5b('0x2c')],'type':_0x3e12a0[_0x7d5b('0x2d')][_0x7d5b('0x2e')]};});_0x5e4d6a['model']=_['map'](_0x1f6ec2,_0x7d5b('0x28'));_0x5e4d6a[_0x7d5b('0x2f')]=_['keys'](_0x55f19a[_0x7d5b('0x2f')]);_0x5e4d6a[_0x7d5b('0x30')]=_[_0x7d5b('0x31')](_0x5e4d6a[_0x7d5b('0x32')],_0x5e4d6a['query']);_0x56b149[_0x7d5b('0x33')]=_['intersection'](_0x5e4d6a['model'],qs[_0x7d5b('0x34')](_0x55f19a[_0x7d5b('0x2f')][_0x7d5b('0x34')]));_0x56b149[_0x7d5b('0x33')]=_0x56b149[_0x7d5b('0x33')][_0x7d5b('0x35')]?_0x56b149[_0x7d5b('0x33')]:_0x5e4d6a[_0x7d5b('0x32')];if(!_0x55f19a['query'][_0x7d5b('0x36')]('nolimit')){_0x56b149[_0x7d5b('0x1a')]=qs[_0x7d5b('0x1a')](_0x55f19a[_0x7d5b('0x2f')][_0x7d5b('0x1a')]);_0x56b149[_0x7d5b('0x19')]=qs['offset'](_0x55f19a[_0x7d5b('0x2f')][_0x7d5b('0x19')]);}_0x56b149['order']=qs[_0x7d5b('0x37')](_0x55f19a[_0x7d5b('0x2f')][_0x7d5b('0x37')]);_0x56b149[_0x7d5b('0x38')]=qs[_0x7d5b('0x30')](_[_0x7d5b('0x39')](_0x55f19a['query'],_0x5e4d6a[_0x7d5b('0x30')]),_0x1f6ec2);if(_0x55f19a['query'][_0x7d5b('0x3a')]){_0x56b149[_0x7d5b('0x38')]=_[_0x7d5b('0x3b')](_0x56b149['where'],{'$or':_[_0x7d5b('0x3c')](_0x1f6ec2,function(_0x1a0017){if(_0x1a0017[_0x7d5b('0x2d')]!==_0x7d5b('0x3d')){var _0x5930f3={};_0x5930f3[_0x1a0017[_0x7d5b('0x28')]]={'$like':'%'+_0x55f19a[_0x7d5b('0x2f')]['filter']+'%'};return _0x5930f3;}})});}_0x56b149=_['merge']({},_0x56b149,_0x55f19a[_0x7d5b('0x3e')]);var _0x2e2797={'where':_0x56b149[_0x7d5b('0x38')]};return db[_0x7d5b('0x3f')][_0x7d5b('0x1c')](_0x2e2797)[_0x7d5b('0x22')](function(_0x452466){_0x1eee33[_0x7d5b('0x1c')]=_0x452466;if(_0x55f19a['query']['includeAll']){_0x56b149[_0x7d5b('0x40')]=[{'all':!![]}];}return db[_0x7d5b('0x3f')]['findAll'](_0x56b149);})['then'](function(_0x426c10){_0x1eee33['rows']=_0x426c10;return _0x1eee33;})[_0x7d5b('0x22')](respondWithFilteredResult(_0x4a75f3,_0x56b149))[_0x7d5b('0x41')](handleError(_0x4a75f3,null));};exports[_0x7d5b('0x42')]=function(_0x4172ec,_0x3b9508){var _0x330d7c={'raw':!![],'where':{'id':_0x4172ec[_0x7d5b('0x43')]['id']}},_0x56cf70={};_0x56cf70[_0x7d5b('0x32')]=_[_0x7d5b('0x44')](db[_0x7d5b('0x3f')]['rawAttributes']);_0x56cf70[_0x7d5b('0x2f')]=_[_0x7d5b('0x44')](_0x4172ec[_0x7d5b('0x2f')]);_0x56cf70[_0x7d5b('0x30')]=_['intersection'](_0x56cf70[_0x7d5b('0x32')],_0x56cf70[_0x7d5b('0x2f')]);_0x330d7c['attributes']=_[_0x7d5b('0x31')](_0x56cf70[_0x7d5b('0x32')],qs[_0x7d5b('0x34')](_0x4172ec[_0x7d5b('0x2f')][_0x7d5b('0x34')]));_0x330d7c[_0x7d5b('0x33')]=_0x330d7c[_0x7d5b('0x33')]['length']?_0x330d7c['attributes']:_0x56cf70[_0x7d5b('0x32')];if(_0x4172ec[_0x7d5b('0x2f')][_0x7d5b('0x45')]){_0x330d7c[_0x7d5b('0x40')]=[{'all':!![]}];}_0x330d7c=_[_0x7d5b('0x3b')]({},_0x330d7c,_0x4172ec['options']);return db[_0x7d5b('0x3f')][_0x7d5b('0x46')](_0x330d7c)['then'](handleEntityNotFound(_0x3b9508,null))[_0x7d5b('0x22')](respondWithResult(_0x3b9508,null))[_0x7d5b('0x41')](handleError(_0x3b9508,null));};exports['create']=function(_0x45ea48,_0x332b27){return db[_0x7d5b('0x3f')]['create'](_0x45ea48[_0x7d5b('0x47')],{})[_0x7d5b('0x22')](function(_0x3adfc0){var _0xdd0b4=_0x45ea48[_0x7d5b('0x48')][_0x7d5b('0x24')]({'plain':!![]});if(!_0xdd0b4)throw new Error(_0x7d5b('0x49'));if(_0xdd0b4['role']===_0x7d5b('0x48')){var _0x3f2e1d=_0x3adfc0[_0x7d5b('0x24')]({'plain':!![]});var _0x1c2a66=_0x7d5b('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x1c2a66,'userProfileId':_0xdd0b4[_0x7d5b('0x4a')]},'raw':!![]})[_0x7d5b('0x22')](function(_0x4d0201){if(_0x4d0201&&_0x4d0201[_0x7d5b('0x4b')]===0x0){return db[_0x7d5b('0x26')][_0x7d5b('0x4c')]({'name':_0x3f2e1d[_0x7d5b('0x28')],'resourceId':_0x3f2e1d['id'],'type':_0x4d0201[_0x7d5b('0x28')],'sectionId':_0x4d0201['id']},{})[_0x7d5b('0x22')](function(){return _0x3adfc0;});}else{return _0x3adfc0;}})[_0x7d5b('0x41')](function(_0x5ee159){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ee159);throw _0x5ee159;});}return _0x3adfc0;})[_0x7d5b('0x22')](respondWithResult(_0x332b27,0xc9))[_0x7d5b('0x41')](handleError(_0x332b27,null));};exports[_0x7d5b('0x21')]=function(_0x3a0136,_0xfa4dfa){if(_0x3a0136[_0x7d5b('0x47')]['id']){delete _0x3a0136['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3a0136[_0x7d5b('0x43')]['id']}})[_0x7d5b('0x22')](handleEntityNotFound(_0xfa4dfa,null))['then'](saveUpdates(_0x3a0136[_0x7d5b('0x47')],null))[_0x7d5b('0x22')](respondWithResult(_0xfa4dfa,null))['catch'](handleError(_0xfa4dfa,null));};exports[_0x7d5b('0x23')]=function(_0x355e35,_0x167549){return db[_0x7d5b('0x3f')]['find']({'where':{'id':_0x355e35[_0x7d5b('0x43')]['id']}})['then'](handleEntityNotFound(_0x167549,null))[_0x7d5b('0x22')](removeEntity(_0x167549,null))['catch'](handleError(_0x167549,null));};exports['download']=function(_0x2ea9df,_0x479820,_0xa0886f){return db['AnalyticExtractedReport'][_0x7d5b('0x46')]({'where':{'id':_0x2ea9df[_0x7d5b('0x43')]['id']},'attributes':[_0x7d5b('0x28'),_0x7d5b('0x4d'),_0x7d5b('0x4e'),_0x7d5b('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x479820,null))[_0x7d5b('0x22')](function(_0x62d209){if(_0x62d209){if(!fs[_0x7d5b('0x50')](path[_0x7d5b('0x51')](config[_0x7d5b('0x52')],_0x7d5b('0x53'),_0x62d209['savename']))){throw new db[(_0x7d5b('0x54'))][(_0x7d5b('0x55'))](_0x7d5b('0x56'));}if(_0x2ea9df[_0x7d5b('0x2f')][_0x7d5b('0x57')]){return _0x479820[_0x7d5b('0x15')](0xc8);}return _0x479820[_0x7d5b('0x58')](path[_0x7d5b('0x51')](config['root'],_0x7d5b('0x53'),_0x62d209[_0x7d5b('0x4e')]),util[_0x7d5b('0x59')](_0x7d5b('0x5a'),_0x62d209[_0x7d5b('0x4d')]||_0x62d209[_0x7d5b('0x28')],_0x62d209[_0x7d5b('0x4f')][_0x7d5b('0x5b')]()));}})['catch'](handleError(_0x479820,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1222d71..e984bfb 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 _0x2a15=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','api','moment','bluebird','path'];(function(_0x4eeb93,_0x197bcf){var _0x58a715=function(_0x54491c){while(--_0x54491c){_0x4eeb93['push'](_0x4eeb93['shift']());}};_0x58a715(++_0x197bcf);}(_0x2a15,0x132));var _0x52a1=function(_0x210b5e,_0x13cec9){_0x210b5e=_0x210b5e-0x0;var _0x1bc407=_0x2a15[_0x210b5e];return _0x1bc407;};'use strict';var _=require(_0x52a1('0x0'));var util=require(_0x52a1('0x1'));var logger=require('../../config/logger')(_0x52a1('0x2'));var moment=require(_0x52a1('0x3'));var BPromise=require(_0x52a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52a1('0x5'));var rimraf=require(_0x52a1('0x6'));var config=require(_0x52a1('0x7'));var attributes=require(_0x52a1('0x8'));module[_0x52a1('0x9')]=function(_0x178275,_0x53ca5e){return _0x178275[_0x52a1('0xa')](_0x52a1('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8474=['path','../../config/environment','./analyticExtractedReport.attributes','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x229d39,_0x52ffbd){var _0x282743=function(_0x1252cb){while(--_0x1252cb){_0x229d39['push'](_0x229d39['shift']());}};_0x282743(++_0x52ffbd);}(_0x8474,0x14e));var _0x4847=function(_0x234266,_0x24b1bf){_0x234266=_0x234266-0x0;var _0x3ea978=_0x8474[_0x234266];return _0x3ea978;};'use strict';var _=require(_0x4847('0x0'));var util=require(_0x4847('0x1'));var logger=require(_0x4847('0x2'))(_0x4847('0x3'));var moment=require(_0x4847('0x4'));var BPromise=require('bluebird');var rp=require(_0x4847('0x5'));var fs=require('fs');var path=require(_0x4847('0x6'));var rimraf=require('rimraf');var config=require(_0x4847('0x7'));var attributes=require(_0x4847('0x8'));module['exports']=function(_0xbb22dd,_0x191998){return _0xbb22dd[_0x4847('0x9')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','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 4dbba91..1ee4e26 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 _0xf7e5=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','catch','util'];(function(_0x2aeb2f,_0x2fbc20){var _0x34ada2=function(_0x1905c2){while(--_0x1905c2){_0x2aeb2f['push'](_0x2aeb2f['shift']());}};_0x34ada2(++_0x2fbc20);}(_0xf7e5,0x7d));var _0x5f7e=function(_0x406c91,_0x5efff1){_0x406c91=_0x406c91-0x0;var _0x4ee6fa=_0xf7e5[_0x406c91];return _0x4ee6fa;};'use strict';var _=require('lodash');var util=require(_0x5f7e('0x0'));var moment=require(_0x5f7e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f7e('0x2'));var db=require(_0x5f7e('0x3'))['db'];var utils=require(_0x5f7e('0x4'));var logger=require(_0x5f7e('0x5'))(_0x5f7e('0x6'));var config=require(_0x5f7e('0x7'));var jayson=require(_0x5f7e('0x8'));var client=jayson[_0x5f7e('0x9')][_0x5f7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d2751,_0x509fd5,_0x186646){return new BPromise(function(_0xf2902e,_0x4a1ea2){return client['request'](_0x5d2751,_0x186646)[_0x5f7e('0xb')](function(_0xbabec1){logger[_0x5f7e('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x509fd5,_0x5f7e('0xd'));logger[_0x5f7e('0xe')](_0x5f7e('0xf'),_0x509fd5,_0x5f7e('0xd'),JSON[_0x5f7e('0x10')](_0xbabec1));if(_0xbabec1[_0x5f7e('0x11')]){if(_0xbabec1[_0x5f7e('0x11')]['code']===0x1f4){logger[_0x5f7e('0x11')](_0x5f7e('0x12'),_0x509fd5,_0xbabec1[_0x5f7e('0x11')][_0x5f7e('0x13')]);return _0x4a1ea2(_0xbabec1[_0x5f7e('0x11')]['message']);}logger[_0x5f7e('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x509fd5,_0xbabec1['error']['message']);return _0xf2902e(_0xbabec1[_0x5f7e('0x11')][_0x5f7e('0x13')]);}else{logger[_0x5f7e('0xc')](_0x5f7e('0x12'),_0x509fd5,'request\x20sent');_0xf2902e(_0xbabec1['result'][_0x5f7e('0x13')]);}})[_0x5f7e('0x14')](function(_0x2da1cb){logger[_0x5f7e('0x11')](_0x5f7e('0x12'),_0x509fd5,_0x2da1cb);_0x4a1ea2(_0x2da1cb);});});} \ No newline at end of file +var _0xfea4=['code','message','result','catch','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xfea4,0x1a8));var _0x4fea=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xfea4[_0x49d19d];return _0x4ebef1;};'use strict';var _=require('lodash');var util=require(_0x4fea('0x0'));var moment=require('moment');var BPromise=require(_0x4fea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4fea('0x2'));var logger=require(_0x4fea('0x3'))(_0x4fea('0x4'));var config=require(_0x4fea('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4fea('0x6')][_0x4fea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe07c13,_0x26d574,_0x549e7a){return new BPromise(function(_0x15235e,_0x5a79a1){return client[_0x4fea('0x8')](_0xe07c13,_0x549e7a)[_0x4fea('0x9')](function(_0x527ccc){logger[_0x4fea('0xa')](_0x4fea('0xb'),_0x26d574,_0x4fea('0xc'));logger[_0x4fea('0xd')](_0x4fea('0xe'),_0x26d574,'request\x20sent',JSON[_0x4fea('0xf')](_0x527ccc));if(_0x527ccc['error']){if(_0x527ccc[_0x4fea('0x10')][_0x4fea('0x11')]===0x1f4){logger[_0x4fea('0x10')](_0x4fea('0xb'),_0x26d574,_0x527ccc[_0x4fea('0x10')][_0x4fea('0x12')]);return _0x5a79a1(_0x527ccc[_0x4fea('0x10')][_0x4fea('0x12')]);}logger[_0x4fea('0x10')](_0x4fea('0xb'),_0x26d574,_0x527ccc['error'][_0x4fea('0x12')]);return _0x15235e(_0x527ccc[_0x4fea('0x10')][_0x4fea('0x12')]);}else{logger[_0x4fea('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x26d574,_0x4fea('0xc'));_0x15235e(_0x527ccc[_0x4fea('0x13')][_0x4fea('0x12')]);}})[_0x4fea('0x14')](function(_0x551e61){logger[_0x4fea('0x10')](_0x4fea('0xb'),_0x26d574,_0x551e61);_0x5a79a1(_0x551e61);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d834924..c3aba27 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 _0xc706=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','put','destroy','exports','multer'];(function(_0x34d38c,_0x4f1295){var _0x4be108=function(_0x263e0f){while(--_0x263e0f){_0x34d38c['push'](_0x34d38c['shift']());}};_0x4be108(++_0x4f1295);}(_0xc706,0xe9));var _0x6c70=function(_0x575c17,_0x58cf05){_0x575c17=_0x575c17-0x0;var _0x4be569=_0xc706[_0x575c17];return _0x4be569;};'use strict';var multer=require(_0x6c70('0x0'));var util=require(_0x6c70('0x1'));var path=require(_0x6c70('0x2'));var timeout=require(_0x6c70('0x3'));var express=require('express');var router=express[_0x6c70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c70('0x5'));var interaction=require(_0x6c70('0x6'));var config=require('../../config/environment');var controller=require(_0x6c70('0x7'));router[_0x6c70('0x8')]('/',auth[_0x6c70('0x9')](),controller['index']);router[_0x6c70('0x8')](_0x6c70('0xa'),auth[_0x6c70('0x9')](),controller['show']);router['get'](_0x6c70('0xb'),auth[_0x6c70('0x9')](),controller[_0x6c70('0xc')]);router[_0x6c70('0xd')]('/',auth[_0x6c70('0x9')](),controller[_0x6c70('0xe')]);router[_0x6c70('0xf')](_0x6c70('0xa'),auth[_0x6c70('0x9')](),controller['update']);router['delete'](_0x6c70('0xa'),auth['isAuthenticated'](),controller[_0x6c70('0x10')]);module[_0x6c70('0x11')]=router; \ No newline at end of file +var _0x5287=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','create','put','update','delete','destroy'];(function(_0x4d0426,_0x17707f){var _0x136b4f=function(_0x397046){while(--_0x397046){_0x4d0426['push'](_0x4d0426['shift']());}};_0x136b4f(++_0x17707f);}(_0x5287,0x11d));var _0x7528=function(_0x245c02,_0x110ce4){_0x245c02=_0x245c02-0x0;var _0x19259a=_0x5287[_0x245c02];return _0x19259a;};'use strict';var multer=require(_0x7528('0x0'));var util=require('util');var path=require(_0x7528('0x1'));var timeout=require(_0x7528('0x2'));var express=require('express');var router=express[_0x7528('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7528('0x4'));var interaction=require(_0x7528('0x5'));var config=require(_0x7528('0x6'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x7528('0x7')](),controller[_0x7528('0x8')]);router[_0x7528('0x9')](_0x7528('0xa'),auth[_0x7528('0x7')](),controller[_0x7528('0xb')]);router['get'](_0x7528('0xc'),auth[_0x7528('0x7')](),controller[_0x7528('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7528('0xe')]);router[_0x7528('0xf')](_0x7528('0xa'),auth[_0x7528('0x7')](),controller[_0x7528('0x10')]);router[_0x7528('0x11')](_0x7528('0xa'),auth[_0x7528('0x7')](),controller[_0x7528('0x12')]);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 be421cf..c9a7245 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 _0x0a8a=['exports','TEXT','STRING','BOOLEAN'];(function(_0x36ca1f,_0x469b9e){var _0x2df6e1=function(_0x33db68){while(--_0x33db68){_0x36ca1f['push'](_0x36ca1f['shift']());}};_0x2df6e1(++_0x469b9e);}(_0x0a8a,0x1b8));var _0xa0a8=function(_0x568db3,_0x24395d){_0x568db3=_0x568db3-0x0;var _0x58c38b=_0x0a8a[_0x568db3];return _0x58c38b;};'use strict';var Sequelize=require('sequelize');module[_0xa0a8('0x0')]={'field':{'type':Sequelize[_0xa0a8('0x1')]},'alias':{'type':Sequelize[_0xa0a8('0x2')]},'function':{'type':Sequelize[_0xa0a8('0x2')]},'format':{'type':Sequelize[_0xa0a8('0x2')]},'groupBy':{'type':Sequelize[_0xa0a8('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa0a8('0x2')]},'custom':{'type':Sequelize[_0xa0a8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbd06=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1308da,_0x105319){var _0x5a5ba5=function(_0x2d8e3a){while(--_0x2d8e3a){_0x1308da['push'](_0x1308da['shift']());}};_0x5a5ba5(++_0x105319);}(_0xbd06,0x1bc));var _0x6bd0=function(_0x1c2f73,_0x2ce397){_0x1c2f73=_0x1c2f73-0x0;var _0x3c3e4b=_0xbd06[_0x1c2f73];return _0x3c3e4b;};'use strict';var Sequelize=require('sequelize');module[_0x6bd0('0x0')]={'field':{'type':Sequelize[_0x6bd0('0x1')]},'alias':{'type':Sequelize[_0x6bd0('0x2')]},'function':{'type':Sequelize[_0x6bd0('0x2')]},'format':{'type':Sequelize[_0x6bd0('0x2')]},'groupBy':{'type':Sequelize[_0x6bd0('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6bd0('0x2')]},'custom':{'type':Sequelize[_0x6bd0('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 44e50b0..1b5a008 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 _0x2f21=['moment','bluebird','util','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','api','../../config/license/util','../../mysqldb','end','json','undefined','limit','offset','count','status','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','catch','show','params','length','find','create','body','bulkCreate','bulkDestroy','destroy','ids','AnalyticCustomReport','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x2f21,0xf2));var _0x12f2=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x2f21[_0x487b0c];return _0x1adbdc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12f2('0x0'));var zipdir=require(_0x12f2('0x1'));var jsonpatch=require(_0x12f2('0x2'));var rp=require(_0x12f2('0x3'));var moment=require(_0x12f2('0x4'));var BPromise=require(_0x12f2('0x5'));var Mustache=require('mustache');var util=require(_0x12f2('0x6'));var path=require(_0x12f2('0x7'));var sox=require(_0x12f2('0x8'));var csv=require(_0x12f2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x12f2('0xa'));var _=require(_0x12f2('0xb'));var squel=require(_0x12f2('0xc'));var crypto=require(_0x12f2('0xd'));var jsforce=require(_0x12f2('0xe'));var deskjs=require(_0x12f2('0xf'));var toCsv=require(_0x12f2('0x9'));var querystring=require(_0x12f2('0x10'));var Papa=require(_0x12f2('0x11'));var Redis=require(_0x12f2('0x12'));var authService=require(_0x12f2('0x13'));var qs=require(_0x12f2('0x14'));var as=require(_0x12f2('0x15'));var hardwareService=require(_0x12f2('0x16'));var logger=require('../../config/logger')(_0x12f2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x12f2('0x18'));var db=require(_0x12f2('0x19'))['db'];function respondWithStatusCode(_0x33a358,_0x40695a){_0x40695a=_0x40695a||0xcc;return function(_0x51d2fb){if(_0x51d2fb){return _0x33a358['sendStatus'](_0x40695a);}return _0x33a358['status'](_0x40695a)[_0x12f2('0x1a')]();};}function respondWithResult(_0x1e11cd,_0x8d9942){_0x8d9942=_0x8d9942||0xc8;return function(_0x55d0b8){if(_0x55d0b8){return _0x1e11cd['status'](_0x8d9942)[_0x12f2('0x1b')](_0x55d0b8);}};}function respondWithFilteredResult(_0x161f5b,_0x4834bc){return function(_0x5745f8){if(_0x5745f8){var _0x2dffb5=typeof _0x4834bc['offset']===_0x12f2('0x1c')&&typeof _0x4834bc[_0x12f2('0x1d')]===_0x12f2('0x1c');var _0x492732=_0x5745f8['count'];var _0x5d4e5e=_0x2dffb5?0x0:_0x4834bc[_0x12f2('0x1e')];var _0x36b698=_0x2dffb5?_0x5745f8[_0x12f2('0x1f')]:_0x4834bc[_0x12f2('0x1e')]+_0x4834bc['limit'];var _0x1d0609;if(_0x36b698>=_0x492732){_0x36b698=_0x492732;_0x1d0609=0xc8;}else{_0x1d0609=0xce;}_0x161f5b[_0x12f2('0x20')](_0x1d0609);return _0x161f5b['set']('Content-Range',_0x5d4e5e+'-'+_0x36b698+'/'+_0x492732)[_0x12f2('0x1b')](_0x5745f8);}return null;};}function patchUpdates(_0x42e315){return function(_0x3dc048){try{jsonpatch[_0x12f2('0x21')](_0x3dc048,_0x42e315,!![]);}catch(_0x68672f){return BPromise[_0x12f2('0x22')](_0x68672f);}return _0x3dc048[_0x12f2('0x23')]();};}function saveUpdates(_0x18f2a9,_0x4a6d5d){return function(_0x3a2113){if(_0x3a2113){return _0x3a2113[_0x12f2('0x24')](_0x18f2a9)[_0x12f2('0x25')](function(_0x391f75){return _0x391f75;});}return null;};}function removeEntity(_0x521bff,_0x364def){return function(_0x4adf0c){if(_0x4adf0c){return _0x4adf0c['destroy']()['then'](function(){_0x521bff[_0x12f2('0x20')](0xcc)[_0x12f2('0x1a')]();});}};}function handleEntityNotFound(_0x2a4c61,_0x2223ce){return function(_0x302454){if(!_0x302454){_0x2a4c61[_0x12f2('0x26')](0x194);}return _0x302454;};}function handleError(_0x5a4c8d,_0x1f3cbb){_0x1f3cbb=_0x1f3cbb||0x1f4;return function(_0x53d788){logger[_0x12f2('0x27')](_0x53d788[_0x12f2('0x28')]);if(_0x53d788[_0x12f2('0x29')]){delete _0x53d788[_0x12f2('0x29')];}_0x5a4c8d[_0x12f2('0x20')](_0x1f3cbb)[_0x12f2('0x2a')](_0x53d788);};}exports[_0x12f2('0x2b')]=function(_0x40246e,_0x38b815){var _0x595724={},_0x5c05fb={},_0x5ec16d={'count':0x0,'rows':[]};var _0x53032b=_[_0x12f2('0x2c')](db[_0x12f2('0x2d')][_0x12f2('0x2e')],function(_0x23cdf0){return{'name':_0x23cdf0[_0x12f2('0x2f')],'type':_0x23cdf0[_0x12f2('0x30')][_0x12f2('0x31')]};});_0x5c05fb[_0x12f2('0x32')]=_[_0x12f2('0x2c')](_0x53032b,_0x12f2('0x29'));_0x5c05fb[_0x12f2('0x33')]=_[_0x12f2('0x34')](_0x40246e[_0x12f2('0x33')]);_0x5c05fb[_0x12f2('0x35')]=_[_0x12f2('0x36')](_0x5c05fb[_0x12f2('0x32')],_0x5c05fb[_0x12f2('0x33')]);_0x595724[_0x12f2('0x37')]=_[_0x12f2('0x36')](_0x5c05fb[_0x12f2('0x32')],qs[_0x12f2('0x38')](_0x40246e['query']['fields']));_0x595724[_0x12f2('0x37')]=_0x595724[_0x12f2('0x37')]['length']?_0x595724[_0x12f2('0x37')]:_0x5c05fb['model'];if(!_0x40246e['query'][_0x12f2('0x39')](_0x12f2('0x3a'))){_0x595724[_0x12f2('0x1d')]=qs['limit'](_0x40246e[_0x12f2('0x33')][_0x12f2('0x1d')]);_0x595724[_0x12f2('0x1e')]=qs[_0x12f2('0x1e')](_0x40246e['query'][_0x12f2('0x1e')]);}_0x595724[_0x12f2('0x3b')]=qs[_0x12f2('0x3c')](_0x40246e[_0x12f2('0x33')][_0x12f2('0x3c')]);_0x595724[_0x12f2('0x3d')]=qs[_0x12f2('0x35')](_['pick'](_0x40246e[_0x12f2('0x33')],_0x5c05fb[_0x12f2('0x35')]),_0x53032b);if(_0x40246e[_0x12f2('0x33')]['filter']){_0x595724[_0x12f2('0x3d')]=_[_0x12f2('0x3e')](_0x595724[_0x12f2('0x3d')],{'$or':_[_0x12f2('0x2c')](_0x53032b,function(_0x5dbca1){if(_0x5dbca1[_0x12f2('0x30')]!=='VIRTUAL'){var _0x569eb8={};_0x569eb8[_0x5dbca1[_0x12f2('0x29')]]={'$like':'%'+_0x40246e[_0x12f2('0x33')][_0x12f2('0x3f')]+'%'};return _0x569eb8;}})});}_0x595724=_[_0x12f2('0x3e')]({},_0x595724,_0x40246e[_0x12f2('0x40')]);var _0x5ec01a={'where':_0x595724[_0x12f2('0x3d')]};return db[_0x12f2('0x2d')][_0x12f2('0x1f')](_0x5ec01a)['then'](function(_0x41015b){_0x5ec16d[_0x12f2('0x1f')]=_0x41015b;if(_0x40246e[_0x12f2('0x33')][_0x12f2('0x41')]){_0x595724[_0x12f2('0x42')]=[{'all':!![]}];}return db[_0x12f2('0x2d')][_0x12f2('0x43')](_0x595724);})[_0x12f2('0x25')](function(_0x399fb8){_0x5ec16d['rows']=_0x399fb8;return _0x5ec16d;})[_0x12f2('0x25')](respondWithFilteredResult(_0x38b815,_0x595724))[_0x12f2('0x44')](handleError(_0x38b815,null));};exports[_0x12f2('0x45')]=function(_0x27bb02,_0x3ce16a){var _0x5feab9={'raw':![],'where':{'id':_0x27bb02[_0x12f2('0x46')]['id']}},_0x2c712f={};_0x2c712f[_0x12f2('0x32')]=_[_0x12f2('0x34')](db[_0x12f2('0x2d')][_0x12f2('0x2e')]);_0x2c712f['query']=_[_0x12f2('0x34')](_0x27bb02[_0x12f2('0x33')]);_0x2c712f[_0x12f2('0x35')]=_[_0x12f2('0x36')](_0x2c712f[_0x12f2('0x32')],_0x2c712f[_0x12f2('0x33')]);_0x5feab9[_0x12f2('0x37')]=_[_0x12f2('0x36')](_0x2c712f[_0x12f2('0x32')],qs[_0x12f2('0x38')](_0x27bb02[_0x12f2('0x33')][_0x12f2('0x38')]));_0x5feab9[_0x12f2('0x37')]=_0x5feab9[_0x12f2('0x37')][_0x12f2('0x47')]?_0x5feab9[_0x12f2('0x37')]:_0x2c712f[_0x12f2('0x32')];if(_0x27bb02['query']['includeAll']){_0x5feab9[_0x12f2('0x42')]=[{'all':!![]}];}_0x5feab9=_[_0x12f2('0x3e')]({},_0x5feab9,_0x27bb02[_0x12f2('0x40')]);return db[_0x12f2('0x2d')][_0x12f2('0x48')](_0x5feab9)[_0x12f2('0x25')](handleEntityNotFound(_0x3ce16a,null))['then'](respondWithResult(_0x3ce16a,null))[_0x12f2('0x44')](handleError(_0x3ce16a,null));};exports['create']=function(_0xc9fc66,_0x3b14ff){return db['AnalyticFieldReport'][_0x12f2('0x49')](_0xc9fc66[_0x12f2('0x4a')],{})[_0x12f2('0x25')](respondWithResult(_0x3b14ff,0xc9))[_0x12f2('0x44')](handleError(_0x3b14ff,null));};exports['bulkCreate']=function(_0xef9551,_0x11f681){return db[_0x12f2('0x2d')][_0x12f2('0x4b')](_0xef9551[_0x12f2('0x4a')],{'raw':![],'individualHooks':!![]})[_0x12f2('0x25')](respondWithResult(_0x11f681,0xc9))['catch'](handleError(_0x11f681,null));};exports[_0x12f2('0x24')]=function(_0x562e5b,_0x5f28f7){if(_0x562e5b[_0x12f2('0x4a')]['id']){delete _0x562e5b[_0x12f2('0x4a')]['id'];}return db[_0x12f2('0x2d')][_0x12f2('0x48')]({'where':{'id':_0x562e5b[_0x12f2('0x46')]['id']}})[_0x12f2('0x25')](handleEntityNotFound(_0x5f28f7,null))['then'](saveUpdates(_0x562e5b[_0x12f2('0x4a')],null))[_0x12f2('0x25')](respondWithResult(_0x5f28f7,null))[_0x12f2('0x44')](handleError(_0x5f28f7,null));};exports['destroy']=function(_0x2e5efc,_0x513579){return db[_0x12f2('0x2d')]['find']({'where':{'id':_0x2e5efc['params']['id']}})[_0x12f2('0x25')](handleEntityNotFound(_0x513579,null))[_0x12f2('0x25')](removeEntity(_0x513579,null))[_0x12f2('0x44')](handleError(_0x513579,null));};exports[_0x12f2('0x4c')]=function(_0x5b2560,_0x1fe651){return db[_0x12f2('0x2d')][_0x12f2('0x4d')]({'where':{'id':_0x5b2560['query'][_0x12f2('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x12f2('0x25')](respondWithResult(_0x1fe651,0xcc))[_0x12f2('0x44')](handleError(_0x1fe651,null));};exports['addFields']=function(_0x51ffac,_0x4a4c80,_0x3f7255){return db[_0x12f2('0x4f')]['findOne']({'where':{'id':_0x51ffac['params']['id']}})[_0x12f2('0x25')](handleEntityNotFound(_0x4a4c80,null))[_0x12f2('0x25')](function(_0x4a6045){if(_0x4a6045){return db['sequelize'][_0x12f2('0x50')](function(_0x26e610){return db[_0x12f2('0x2d')][_0x12f2('0x4d')]({'where':{'CustomReportId':_0x51ffac['params']['id']},'transaction':_0x26e610})[_0x12f2('0x25')](function(_0x54f31d){var _0x1baea1=_[_0x12f2('0x2c')](_0x51ffac[_0x12f2('0x4a')],function(_0xaf1c77){delete _0xaf1c77['id'];_0xaf1c77[_0x12f2('0x51')]=_0x51ffac[_0x12f2('0x46')]['id'];return _0xaf1c77;});return db['AnalyticFieldReport'][_0x12f2('0x4b')](_0x1baea1,{'transaction':_0x26e610});});})[_0x12f2('0x25')](function(){return db['AnalyticFieldReport'][_0x12f2('0x43')]({'where':{'CustomReportId':_0x51ffac[_0x12f2('0x46')]['id']}});});}})[_0x12f2('0x25')](respondWithResult(_0x4a4c80,null))[_0x12f2('0x44')](handleError(_0x4a4c80,null));}; \ No newline at end of file +var _0xff24=['find','catch','create','bulkCreate','body','update','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','key','query','keys','model','intersection','fields','attributes','length','nolimit','sort','filters','where','merge','type','filter','options','includeAll','include','findAll','rows'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xff24,0x146));var _0x4ff2=function(_0x384387,_0x15f813){_0x384387=_0x384387-0x0;var _0x3a6caf=_0xff24[_0x384387];return _0x3a6caf;};'use strict';var emlformat=require(_0x4ff2('0x0'));var rimraf=require(_0x4ff2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ff2('0x2'));var rp=require(_0x4ff2('0x3'));var moment=require(_0x4ff2('0x4'));var BPromise=require(_0x4ff2('0x5'));var Mustache=require(_0x4ff2('0x6'));var util=require(_0x4ff2('0x7'));var path=require(_0x4ff2('0x8'));var sox=require(_0x4ff2('0x9'));var csv=require('to-csv');var ejs=require(_0x4ff2('0xa'));var fs=require('fs');var fs_extra=require(_0x4ff2('0xb'));var _=require(_0x4ff2('0xc'));var squel=require(_0x4ff2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ff2('0xe'));var toCsv=require(_0x4ff2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4ff2('0x10'));var authService=require(_0x4ff2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4ff2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4ff2('0x13'));var config=require(_0x4ff2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ff2('0x15'))['db'];function respondWithStatusCode(_0x5cc2d6,_0x22e91b){_0x22e91b=_0x22e91b||0xcc;return function(_0x435c54){if(_0x435c54){return _0x5cc2d6['sendStatus'](_0x22e91b);}return _0x5cc2d6[_0x4ff2('0x16')](_0x22e91b)[_0x4ff2('0x17')]();};}function respondWithResult(_0x4de836,_0x4561b3){_0x4561b3=_0x4561b3||0xc8;return function(_0x3e8c1a){if(_0x3e8c1a){return _0x4de836[_0x4ff2('0x16')](_0x4561b3)[_0x4ff2('0x18')](_0x3e8c1a);}};}function respondWithFilteredResult(_0x179487,_0xedd364){return function(_0xe5941c){if(_0xe5941c){var _0x8b4ff7=typeof _0xedd364[_0x4ff2('0x19')]==='undefined'&&typeof _0xedd364[_0x4ff2('0x1a')]===_0x4ff2('0x1b');var _0x13a445=_0xe5941c[_0x4ff2('0x1c')];var _0x483088=_0x8b4ff7?0x0:_0xedd364[_0x4ff2('0x19')];var _0x6b7547=_0x8b4ff7?_0xe5941c[_0x4ff2('0x1c')]:_0xedd364[_0x4ff2('0x19')]+_0xedd364[_0x4ff2('0x1a')];var _0x53ba94;if(_0x6b7547>=_0x13a445){_0x6b7547=_0x13a445;_0x53ba94=0xc8;}else{_0x53ba94=0xce;}_0x179487['status'](_0x53ba94);return _0x179487[_0x4ff2('0x1d')](_0x4ff2('0x1e'),_0x483088+'-'+_0x6b7547+'/'+_0x13a445)[_0x4ff2('0x18')](_0xe5941c);}return null;};}function patchUpdates(_0x456d4e){return function(_0x433ac2){try{jsonpatch[_0x4ff2('0x1f')](_0x433ac2,_0x456d4e,!![]);}catch(_0x3fb57a){return BPromise[_0x4ff2('0x20')](_0x3fb57a);}return _0x433ac2[_0x4ff2('0x21')]();};}function saveUpdates(_0x167621,_0x9400){return function(_0x49f6ea){if(_0x49f6ea){return _0x49f6ea['update'](_0x167621)[_0x4ff2('0x22')](function(_0x15c39f){return _0x15c39f;});}return null;};}function removeEntity(_0x36c297,_0x32c80a){return function(_0x13cfa1){if(_0x13cfa1){return _0x13cfa1[_0x4ff2('0x23')]()[_0x4ff2('0x22')](function(){_0x36c297[_0x4ff2('0x16')](0xcc)[_0x4ff2('0x17')]();});}};}function handleEntityNotFound(_0x15422d,_0x5e63bd){return function(_0xdf8b27){if(!_0xdf8b27){_0x15422d[_0x4ff2('0x24')](0x194);}return _0xdf8b27;};}function handleError(_0x2727c0,_0x1b43bd){_0x1b43bd=_0x1b43bd||0x1f4;return function(_0x1b6756){logger[_0x4ff2('0x25')](_0x1b6756[_0x4ff2('0x26')]);if(_0x1b6756[_0x4ff2('0x27')]){delete _0x1b6756['name'];}_0x2727c0[_0x4ff2('0x16')](_0x1b43bd)[_0x4ff2('0x28')](_0x1b6756);};}exports['index']=function(_0x264aa5,_0x2b4873){var _0x468018={},_0x48900c={},_0x4ce95f={'count':0x0,'rows':[]};var _0x56dfe4=_[_0x4ff2('0x29')](db[_0x4ff2('0x2a')][_0x4ff2('0x2b')],function(_0x4185d8){return{'name':_0x4185d8['fieldName'],'type':_0x4185d8['type'][_0x4ff2('0x2c')]};});_0x48900c['model']=_[_0x4ff2('0x29')](_0x56dfe4,_0x4ff2('0x27'));_0x48900c[_0x4ff2('0x2d')]=_[_0x4ff2('0x2e')](_0x264aa5[_0x4ff2('0x2d')]);_0x48900c['filters']=_['intersection'](_0x48900c[_0x4ff2('0x2f')],_0x48900c[_0x4ff2('0x2d')]);_0x468018['attributes']=_[_0x4ff2('0x30')](_0x48900c[_0x4ff2('0x2f')],qs[_0x4ff2('0x31')](_0x264aa5[_0x4ff2('0x2d')][_0x4ff2('0x31')]));_0x468018[_0x4ff2('0x32')]=_0x468018[_0x4ff2('0x32')][_0x4ff2('0x33')]?_0x468018[_0x4ff2('0x32')]:_0x48900c[_0x4ff2('0x2f')];if(!_0x264aa5[_0x4ff2('0x2d')]['hasOwnProperty'](_0x4ff2('0x34'))){_0x468018[_0x4ff2('0x1a')]=qs[_0x4ff2('0x1a')](_0x264aa5['query'][_0x4ff2('0x1a')]);_0x468018['offset']=qs[_0x4ff2('0x19')](_0x264aa5[_0x4ff2('0x2d')][_0x4ff2('0x19')]);}_0x468018['order']=qs['sort'](_0x264aa5[_0x4ff2('0x2d')][_0x4ff2('0x35')]);_0x468018['where']=qs[_0x4ff2('0x36')](_['pick'](_0x264aa5[_0x4ff2('0x2d')],_0x48900c['filters']),_0x56dfe4);if(_0x264aa5[_0x4ff2('0x2d')]['filter']){_0x468018[_0x4ff2('0x37')]=_[_0x4ff2('0x38')](_0x468018['where'],{'$or':_[_0x4ff2('0x29')](_0x56dfe4,function(_0x412477){if(_0x412477[_0x4ff2('0x39')]!=='VIRTUAL'){var _0x51b43b={};_0x51b43b[_0x412477['name']]={'$like':'%'+_0x264aa5[_0x4ff2('0x2d')][_0x4ff2('0x3a')]+'%'};return _0x51b43b;}})});}_0x468018=_[_0x4ff2('0x38')]({},_0x468018,_0x264aa5[_0x4ff2('0x3b')]);var _0x5673ec={'where':_0x468018[_0x4ff2('0x37')]};return db[_0x4ff2('0x2a')][_0x4ff2('0x1c')](_0x5673ec)[_0x4ff2('0x22')](function(_0x2a3b45){_0x4ce95f[_0x4ff2('0x1c')]=_0x2a3b45;if(_0x264aa5[_0x4ff2('0x2d')][_0x4ff2('0x3c')]){_0x468018[_0x4ff2('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4ff2('0x3e')](_0x468018);})[_0x4ff2('0x22')](function(_0x15d91a){_0x4ce95f[_0x4ff2('0x3f')]=_0x15d91a;return _0x4ce95f;})[_0x4ff2('0x22')](respondWithFilteredResult(_0x2b4873,_0x468018))['catch'](handleError(_0x2b4873,null));};exports['show']=function(_0x48916d,_0x137014){var _0x352d8c={'raw':![],'where':{'id':_0x48916d['params']['id']}},_0xe1c278={};_0xe1c278[_0x4ff2('0x2f')]=_[_0x4ff2('0x2e')](db[_0x4ff2('0x2a')]['rawAttributes']);_0xe1c278[_0x4ff2('0x2d')]=_[_0x4ff2('0x2e')](_0x48916d[_0x4ff2('0x2d')]);_0xe1c278['filters']=_['intersection'](_0xe1c278['model'],_0xe1c278[_0x4ff2('0x2d')]);_0x352d8c[_0x4ff2('0x32')]=_[_0x4ff2('0x30')](_0xe1c278[_0x4ff2('0x2f')],qs[_0x4ff2('0x31')](_0x48916d[_0x4ff2('0x2d')]['fields']));_0x352d8c[_0x4ff2('0x32')]=_0x352d8c[_0x4ff2('0x32')]['length']?_0x352d8c[_0x4ff2('0x32')]:_0xe1c278[_0x4ff2('0x2f')];if(_0x48916d[_0x4ff2('0x2d')][_0x4ff2('0x3c')]){_0x352d8c[_0x4ff2('0x3d')]=[{'all':!![]}];}_0x352d8c=_[_0x4ff2('0x38')]({},_0x352d8c,_0x48916d[_0x4ff2('0x3b')]);return db[_0x4ff2('0x2a')][_0x4ff2('0x40')](_0x352d8c)[_0x4ff2('0x22')](handleEntityNotFound(_0x137014,null))[_0x4ff2('0x22')](respondWithResult(_0x137014,null))[_0x4ff2('0x41')](handleError(_0x137014,null));};exports[_0x4ff2('0x42')]=function(_0x1b4f7f,_0x10a447){return db['AnalyticFieldReport'][_0x4ff2('0x42')](_0x1b4f7f['body'],{})[_0x4ff2('0x22')](respondWithResult(_0x10a447,0xc9))['catch'](handleError(_0x10a447,null));};exports[_0x4ff2('0x43')]=function(_0x54c517,_0x205176){return db[_0x4ff2('0x2a')][_0x4ff2('0x43')](_0x54c517[_0x4ff2('0x44')],{'raw':![],'individualHooks':!![]})[_0x4ff2('0x22')](respondWithResult(_0x205176,0xc9))[_0x4ff2('0x41')](handleError(_0x205176,null));};exports[_0x4ff2('0x45')]=function(_0x588ec1,_0x44aeb6){if(_0x588ec1[_0x4ff2('0x44')]['id']){delete _0x588ec1['body']['id'];}return db[_0x4ff2('0x2a')][_0x4ff2('0x40')]({'where':{'id':_0x588ec1[_0x4ff2('0x46')]['id']}})[_0x4ff2('0x22')](handleEntityNotFound(_0x44aeb6,null))[_0x4ff2('0x22')](saveUpdates(_0x588ec1[_0x4ff2('0x44')],null))[_0x4ff2('0x22')](respondWithResult(_0x44aeb6,null))[_0x4ff2('0x41')](handleError(_0x44aeb6,null));};exports[_0x4ff2('0x23')]=function(_0x587752,_0x3c5ab8){return db['AnalyticFieldReport']['find']({'where':{'id':_0x587752['params']['id']}})[_0x4ff2('0x22')](handleEntityNotFound(_0x3c5ab8,null))[_0x4ff2('0x22')](removeEntity(_0x3c5ab8,null))['catch'](handleError(_0x3c5ab8,null));};exports[_0x4ff2('0x47')]=function(_0x50c2cf,_0x4e9bbe){return db[_0x4ff2('0x2a')][_0x4ff2('0x23')]({'where':{'id':_0x50c2cf[_0x4ff2('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x4ff2('0x22')](respondWithResult(_0x4e9bbe,0xcc))['catch'](handleError(_0x4e9bbe,null));};exports[_0x4ff2('0x48')]=function(_0x3c50c1,_0x46ea47,_0x3566e9){return db[_0x4ff2('0x49')][_0x4ff2('0x4a')]({'where':{'id':_0x3c50c1[_0x4ff2('0x46')]['id']}})[_0x4ff2('0x22')](handleEntityNotFound(_0x46ea47,null))[_0x4ff2('0x22')](function(_0x1508a1){if(_0x1508a1){return db[_0x4ff2('0x4b')][_0x4ff2('0x4c')](function(_0x6d43dd){return db[_0x4ff2('0x2a')][_0x4ff2('0x23')]({'where':{'CustomReportId':_0x3c50c1['params']['id']},'transaction':_0x6d43dd})[_0x4ff2('0x22')](function(_0x41d3b5){var _0x5cfd42=_['map'](_0x3c50c1[_0x4ff2('0x44')],function(_0x1d7ad2){delete _0x1d7ad2['id'];_0x1d7ad2[_0x4ff2('0x4d')]=_0x3c50c1[_0x4ff2('0x46')]['id'];return _0x1d7ad2;});return db[_0x4ff2('0x2a')]['bulkCreate'](_0x5cfd42,{'transaction':_0x6d43dd});});})['then'](function(){return db[_0x4ff2('0x2a')][_0x4ff2('0x3e')]({'where':{'CustomReportId':_0x3c50c1[_0x4ff2('0x46')]['id']}});});}})[_0x4ff2('0x22')](respondWithResult(_0x46ea47,null))[_0x4ff2('0x41')](handleError(_0x46ea47,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2adbed9..b3fa8e1 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 _0x41da=['rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1e16fe,_0x2ab89d){var _0xb7ac60=function(_0x3704e4){while(--_0x3704e4){_0x1e16fe['push'](_0x1e16fe['shift']());}};_0xb7ac60(++_0x2ab89d);}(_0x41da,0xf5));var _0xa41d=function(_0x4b0a13,_0x9f30e0){_0x4b0a13=_0x4b0a13-0x0;var _0x4d11bf=_0x41da[_0x4b0a13];return _0x4d11bf;};'use strict';var _=require(_0xa41d('0x0'));var util=require(_0xa41d('0x1'));var logger=require(_0xa41d('0x2'))(_0xa41d('0x3'));var moment=require(_0xa41d('0x4'));var BPromise=require(_0xa41d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa41d('0x6'));var rimraf=require(_0xa41d('0x7'));var config=require(_0xa41d('0x8'));var attributes=require(_0xa41d('0x9'));module['exports']=function(_0x3758aa,_0x1b12e8){return _0x3758aa[_0xa41d('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0xa41d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07b9=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x268352,_0x418960){var _0x156772=function(_0x1638f2){while(--_0x1638f2){_0x268352['push'](_0x268352['shift']());}};_0x156772(++_0x418960);}(_0x07b9,0x9c));var _0x907b=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x07b9[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var logger=require(_0x907b('0x2'))('api');var moment=require(_0x907b('0x3'));var BPromise=require(_0x907b('0x4'));var rp=require(_0x907b('0x5'));var fs=require('fs');var path=require(_0x907b('0x6'));var rimraf=require('rimraf');var config=require(_0x907b('0x7'));var attributes=require(_0x907b('0x8'));module[_0x907b('0x9')]=function(_0x44bc34,_0x311645){return _0x44bc34[_0x907b('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x907b('0xb'),'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 72389b2..ec2cd3c 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 _0xae93=['rpc','../../config/environment','jayson/promise','client','http','then','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xae93,0x188));var _0x3ae9=function(_0x9a3421,_0x479230){_0x9a3421=_0x9a3421-0x0;var _0x575917=_0xae93[_0x9a3421];return _0x575917;};'use strict';var _=require(_0x3ae9('0x0'));var util=require(_0x3ae9('0x1'));var moment=require(_0x3ae9('0x2'));var BPromise=require(_0x3ae9('0x3'));var rs=require(_0x3ae9('0x4'));var fs=require('fs');var Redis=require(_0x3ae9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ae9('0x6'))(_0x3ae9('0x7'));var config=require(_0x3ae9('0x8'));var jayson=require(_0x3ae9('0x9'));var client=jayson[_0x3ae9('0xa')][_0x3ae9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a2da,_0x43c27d,_0x1c1fcc){return new BPromise(function(_0x46b1d3,_0x51ab80){return client['request'](_0x13a2da,_0x1c1fcc)[_0x3ae9('0xc')](function(_0x46af80){logger['info'](_0x3ae9('0xd'),_0x43c27d,'request\x20sent');logger['debug'](_0x3ae9('0xe'),_0x43c27d,_0x3ae9('0xf'),JSON['stringify'](_0x46af80));if(_0x46af80[_0x3ae9('0x10')]){if(_0x46af80[_0x3ae9('0x10')][_0x3ae9('0x11')]===0x1f4){logger[_0x3ae9('0x10')](_0x3ae9('0xd'),_0x43c27d,_0x46af80['error'][_0x3ae9('0x12')]);return _0x51ab80(_0x46af80[_0x3ae9('0x10')][_0x3ae9('0x12')]);}logger[_0x3ae9('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43c27d,_0x46af80[_0x3ae9('0x10')]['message']);return _0x46b1d3(_0x46af80['error'][_0x3ae9('0x12')]);}else{logger[_0x3ae9('0x13')](_0x3ae9('0xd'),_0x43c27d,'request\x20sent');_0x46b1d3(_0x46af80[_0x3ae9('0x14')][_0x3ae9('0x12')]);}})['catch'](function(_0x2193d9){logger[_0x3ae9('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43c27d,_0x2193d9);_0x51ab80(_0x2193d9);});});} \ No newline at end of file +var _0xf523=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x470958,_0x6c8986){var _0x2c91ea=function(_0x3f60c6){while(--_0x3f60c6){_0x470958['push'](_0x470958['shift']());}};_0x2c91ea(++_0x6c8986);}(_0xf523,0x1c5));var _0x3f52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf523[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f52('0x0'));var util=require(_0x3f52('0x1'));var moment=require(_0x3f52('0x2'));var BPromise=require(_0x3f52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f52('0x4'));var db=require(_0x3f52('0x5'))['db'];var utils=require(_0x3f52('0x6'));var logger=require(_0x3f52('0x7'))(_0x3f52('0x8'));var config=require(_0x3f52('0x9'));var jayson=require(_0x3f52('0xa'));var client=jayson['client'][_0x3f52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2093a9,_0x184957,_0x15ef60){return new BPromise(function(_0x1e0c0b,_0x1029fd){return client[_0x3f52('0xc')](_0x2093a9,_0x15ef60)[_0x3f52('0xd')](function(_0x2ae7b7){logger[_0x3f52('0xe')](_0x3f52('0xf'),_0x184957,_0x3f52('0x10'));logger[_0x3f52('0x11')](_0x3f52('0x12'),_0x184957,_0x3f52('0x10'),JSON['stringify'](_0x2ae7b7));if(_0x2ae7b7[_0x3f52('0x13')]){if(_0x2ae7b7[_0x3f52('0x13')][_0x3f52('0x14')]===0x1f4){logger[_0x3f52('0x13')](_0x3f52('0xf'),_0x184957,_0x2ae7b7[_0x3f52('0x13')][_0x3f52('0x15')]);return _0x1029fd(_0x2ae7b7[_0x3f52('0x13')][_0x3f52('0x15')]);}logger[_0x3f52('0x13')](_0x3f52('0xf'),_0x184957,_0x2ae7b7[_0x3f52('0x13')][_0x3f52('0x15')]);return _0x1e0c0b(_0x2ae7b7[_0x3f52('0x13')][_0x3f52('0x15')]);}else{logger[_0x3f52('0xe')](_0x3f52('0xf'),_0x184957,'request\x20sent');_0x1e0c0b(_0x2ae7b7['result']['message']);}})[_0x3f52('0x16')](function(_0x5b0f91){logger[_0x3f52('0x13')](_0x3f52('0xf'),_0x184957,_0x5b0f91);_0x1029fd(_0x5b0f91);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3557032..5fd7a85 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(_0x458188,_0x11abf0){var _0x19d5ce=function(_0x4ec67c){while(--_0x4ec67c){_0x458188['push'](_0x458188['shift']());}};_0x19d5ce(++_0x11abf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x49dd54,_0x1e8e5f){var _0x2779bd=function(_0x569711){while(--_0x569711){_0x49dd54['push'](_0x49dd54['shift']());}};_0x2779bd(++_0x1e8e5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 a49ffad..770595c 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 _0x9a86=['name','STRING','TEXT','sequelize','exports'];(function(_0x4e24d3,_0x37a5bd){var _0x2c1698=function(_0x2a1e00){while(--_0x2a1e00){_0x4e24d3['push'](_0x4e24d3['shift']());}};_0x2c1698(++_0x37a5bd);}(_0x9a86,0x1ed));var _0x69a8=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x9a86[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x69a8('0x2')},'table':{'type':Sequelize[_0x69a8('0x3')]},'metric':{'type':Sequelize[_0x69a8('0x4')]},'description':{'type':Sequelize[_0x69a8('0x3')]}}; \ No newline at end of file +var _0x2ca5=['exports','STRING','name','TEXT'];(function(_0x563d3b,_0x40812b){var _0xcc6fa4=function(_0x262fd8){while(--_0x262fd8){_0x563d3b['push'](_0x563d3b['shift']());}};_0xcc6fa4(++_0x40812b);}(_0x2ca5,0x108));var _0x52ca=function(_0xf67f45,_0x36e087){_0xf67f45=_0xf67f45-0x0;var _0xd9ab5=_0x2ca5[_0xf67f45];return _0xd9ab5;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'name':{'type':Sequelize[_0x52ca('0x1')],'allowNull':![],'unique':_0x52ca('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x52ca('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 23d273b..11c5f30 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 _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x3bea06,_0x38f09a){var _0x20f6f7=function(_0x37ca19){while(--_0x37ca19){_0x3bea06['push'](_0x3bea06['shift']());}};_0x20f6f7(++_0x38f09a);}(_0x24ca,0x1bc));var _0xa24c=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x24ca[_0x58dc25];return _0x21b0a7;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file +var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','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','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x58daed,_0x3b0d27){var _0x30c931=function(_0x499f49){while(--_0x499f49){_0x58daed['push'](_0x58daed['shift']());}};_0x30c931(++_0x3b0d27);}(_0x9a19,0x114));var _0x99a1=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0x9a19[_0x10dc64];return _0x9cf98d;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5849ff2..ee4be78 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 _0xc73a=['exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','request-promise','path','rimraf','./analyticMetric.attributes'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xc73a,0x72));var _0xac73=function(_0x415b79,_0x3c813f){_0x415b79=_0x415b79-0x0;var _0x2ef640=_0xc73a[_0x415b79];return _0x2ef640;};'use strict';var _=require('lodash');var util=require(_0xac73('0x0'));var logger=require(_0xac73('0x1'))(_0xac73('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac73('0x3'));var fs=require('fs');var path=require(_0xac73('0x4'));var rimraf=require(_0xac73('0x5'));var config=require('../../config/environment');var attributes=require(_0xac73('0x6'));module[_0xac73('0x7')]=function(_0x23fa68,_0x57992a){return _0x23fa68[_0xac73('0x8')](_0xac73('0x9'),attributes,{'tableName':_0xac73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe700=['../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1bb678,_0x3258b6){var _0x2cc118=function(_0x15c2d1){while(--_0x15c2d1){_0x1bb678['push'](_0x1bb678['shift']());}};_0x2cc118(++_0x3258b6);}(_0xe700,0x75));var _0x0e70=function(_0x136e91,_0xc80d21){_0x136e91=_0x136e91-0x0;var _0x25901d=_0xe700[_0x136e91];return _0x25901d;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))(_0x0e70('0x3'));var moment=require(_0x0e70('0x4'));var BPromise=require(_0x0e70('0x5'));var rp=require(_0x0e70('0x6'));var fs=require('fs');var path=require(_0x0e70('0x7'));var rimraf=require(_0x0e70('0x8'));var config=require(_0x0e70('0x9'));var attributes=require('./analyticMetric.attributes');module[_0x0e70('0xa')]=function(_0x5e1b28,_0x44a1ee){return _0x5e1b28[_0x0e70('0xb')](_0x0e70('0xc'),attributes,{'tableName':_0x0e70('0xd'),'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 0f194f7..c1ccdf8 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 _0xd466=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3afcf1,_0x5e12ec){var _0x193c29=function(_0x1bfc2c){while(--_0x1bfc2c){_0x3afcf1['push'](_0x3afcf1['shift']());}};_0x193c29(++_0x5e12ec);}(_0xd466,0xe7));var _0x6d46=function(_0x2637e5,_0x46b19d){_0x2637e5=_0x2637e5-0x0;var _0xc30f8e=_0xd466[_0x2637e5];return _0xc30f8e;};'use strict';var _=require(_0x6d46('0x0'));var util=require(_0x6d46('0x1'));var moment=require(_0x6d46('0x2'));var BPromise=require(_0x6d46('0x3'));var rs=require(_0x6d46('0x4'));var fs=require('fs');var Redis=require(_0x6d46('0x5'));var db=require(_0x6d46('0x6'))['db'];var utils=require(_0x6d46('0x7'));var logger=require(_0x6d46('0x8'))('rpc');var config=require(_0x6d46('0x9'));var jayson=require(_0x6d46('0xa'));var client=jayson[_0x6d46('0xb')][_0x6d46('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dd3a2,_0x21b78d,_0x25bbe7){return new BPromise(function(_0x4a67cf,_0x6609b8){return client[_0x6d46('0xd')](_0x2dd3a2,_0x25bbe7)[_0x6d46('0xe')](function(_0x4ac3f8){logger[_0x6d46('0xf')](_0x6d46('0x10'),_0x21b78d,_0x6d46('0x11'));logger[_0x6d46('0x12')](_0x6d46('0x13'),_0x21b78d,_0x6d46('0x11'),JSON[_0x6d46('0x14')](_0x4ac3f8));if(_0x4ac3f8[_0x6d46('0x15')]){if(_0x4ac3f8[_0x6d46('0x15')]['code']===0x1f4){logger[_0x6d46('0x15')](_0x6d46('0x10'),_0x21b78d,_0x4ac3f8[_0x6d46('0x15')][_0x6d46('0x16')]);return _0x6609b8(_0x4ac3f8[_0x6d46('0x15')][_0x6d46('0x16')]);}logger[_0x6d46('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x21b78d,_0x4ac3f8['error'][_0x6d46('0x16')]);return _0x4a67cf(_0x4ac3f8[_0x6d46('0x15')][_0x6d46('0x16')]);}else{logger[_0x6d46('0xf')](_0x6d46('0x10'),_0x21b78d,'request\x20sent');_0x4a67cf(_0x4ac3f8[_0x6d46('0x17')]['message']);}})['catch'](function(_0x865b7e){logger[_0x6d46('0x15')](_0x6d46('0x10'),_0x21b78d,_0x865b7e);_0x6609b8(_0x865b7e);});});} \ No newline at end of file +var _0x0948=['ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x2c09f5,_0x1cfc67){var _0x145b28=function(_0x2696bc){while(--_0x2696bc){_0x2c09f5['push'](_0x2c09f5['shift']());}};_0x145b28(++_0x1cfc67);}(_0x0948,0x96));var _0x8094=function(_0x3a9815,_0x47eb16){_0x3a9815=_0x3a9815-0x0;var _0x188653=_0x0948[_0x3a9815];return _0x188653;};'use strict';var _=require(_0x8094('0x0'));var util=require(_0x8094('0x1'));var moment=require(_0x8094('0x2'));var BPromise=require('bluebird');var rs=require(_0x8094('0x3'));var fs=require('fs');var Redis=require(_0x8094('0x4'));var db=require(_0x8094('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8094('0x6'))(_0x8094('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8094('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x599b8d,_0x461bf6,_0x4666df){return new BPromise(function(_0x24846b,_0x1cb509){return client[_0x8094('0x9')](_0x599b8d,_0x4666df)[_0x8094('0xa')](function(_0x16bb27){logger[_0x8094('0xb')](_0x8094('0xc'),_0x461bf6,_0x8094('0xd'));logger[_0x8094('0xe')](_0x8094('0xf'),_0x461bf6,_0x8094('0xd'),JSON[_0x8094('0x10')](_0x16bb27));if(_0x16bb27[_0x8094('0x11')]){if(_0x16bb27[_0x8094('0x11')][_0x8094('0x12')]===0x1f4){logger[_0x8094('0x11')](_0x8094('0xc'),_0x461bf6,_0x16bb27['error'][_0x8094('0x13')]);return _0x1cb509(_0x16bb27[_0x8094('0x11')]['message']);}logger[_0x8094('0x11')](_0x8094('0xc'),_0x461bf6,_0x16bb27[_0x8094('0x11')][_0x8094('0x13')]);return _0x24846b(_0x16bb27[_0x8094('0x11')][_0x8094('0x13')]);}else{logger[_0x8094('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x461bf6,_0x8094('0xd'));_0x24846b(_0x16bb27[_0x8094('0x14')][_0x8094('0x13')]);}})[_0x8094('0x15')](function(_0x567770){logger[_0x8094('0x11')](_0x8094('0xc'),_0x461bf6,_0x567770);_0x1cb509(_0x567770);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4b22d2d..fe13f3c 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 _0x63b6=['get','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated'];(function(_0x1c3080,_0x59c2b1){var _0x517c07=function(_0x1e851c){while(--_0x1e851c){_0x1c3080['push'](_0x1c3080['shift']());}};_0x517c07(++_0x59c2b1);}(_0x63b6,0x127));var _0x663b=function(_0x23f7c0,_0x1dab5f){_0x23f7c0=_0x23f7c0-0x0;var _0x2dc413=_0x63b6[_0x23f7c0];return _0x2dc413;};'use strict';var multer=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var path=require(_0x663b('0x2'));var timeout=require('connect-timeout');var express=require(_0x663b('0x3'));var router=express['Router']();var fs_extra=require(_0x663b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x663b('0x5'));var config=require(_0x663b('0x6'));var controller=require(_0x663b('0x7'));router['get']('/',auth[_0x663b('0x8')](),controller['index']);router[_0x663b('0x9')]('/:id',auth[_0x663b('0x8')](),controller[_0x663b('0xa')]);router[_0x663b('0xb')]('/',auth[_0x663b('0x8')](),controller[_0x663b('0xc')]);router[_0x663b('0xd')]('/:id',auth[_0x663b('0x8')](),controller[_0x663b('0xe')]);router[_0x663b('0xf')](_0x663b('0x10'),auth[_0x663b('0x8')](),controller[_0x663b('0x11')]);module[_0x663b('0x12')]=router; \ No newline at end of file +var _0x8e0f=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated','post','update','delete','destroy','exports','multer','util','path'];(function(_0x305d67,_0xe2f3ce){var _0x4500c9=function(_0x457abf){while(--_0x457abf){_0x305d67['push'](_0x305d67['shift']());}};_0x4500c9(++_0xe2f3ce);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x41011f,_0x4cc6a6){_0x41011f=_0x41011f-0x0;var _0x11cfd5=_0x8e0f[_0x41011f];return _0x11cfd5;};'use strict';var multer=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var path=require(_0xf8e0('0x2'));var timeout=require(_0xf8e0('0x3'));var express=require(_0xf8e0('0x4'));var router=express[_0xf8e0('0x5')]();var fs_extra=require(_0xf8e0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf8e0('0x7'));var config=require('../../config/environment');var controller=require(_0xf8e0('0x8'));router[_0xf8e0('0x9')]('/',auth['isAuthenticated'](),controller[_0xf8e0('0xa')]);router[_0xf8e0('0x9')](_0xf8e0('0xb'),auth[_0xf8e0('0xc')](),controller['show']);router[_0xf8e0('0xd')]('/',auth[_0xf8e0('0xc')](),controller['create']);router['put'](_0xf8e0('0xb'),auth[_0xf8e0('0xc')](),controller[_0xf8e0('0xe')]);router[_0xf8e0('0xf')](_0xf8e0('0xb'),auth[_0xf8e0('0xc')](),controller[_0xf8e0('0x10')]);module[_0xf8e0('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6ad6c5d..1c3d50d 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 _0x515d=['exports','TEXT'];(function(_0x4ec56d,_0x1c3f81){var _0x560fdb=function(_0x12fbc8){while(--_0x12fbc8){_0x4ec56d['push'](_0x4ec56d['shift']());}};_0x560fdb(++_0x1c3f81);}(_0x515d,0x104));var _0xd515=function(_0x4ddc5d,_0x33e649){_0x4ddc5d=_0x4ddc5d-0x0;var _0x231056=_0x515d[_0x4ddc5d];return _0x231056;};'use strict';var Sequelize=require('sequelize');module[_0xd515('0x0')]={'tree':{'type':Sequelize[_0xd515('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0b09=['exports','sequelize'];(function(_0x52c102,_0x5496e8){var _0x13f73e=function(_0x3e91ee){while(--_0x3e91ee){_0x52c102['push'](_0x52c102['shift']());}};_0x13f73e(++_0x5496e8);}(_0x0b09,0xb5));var _0x90b0=function(_0x209724,_0x214db5){_0x209724=_0x209724-0x0;var _0x33eb56=_0x0b09[_0x209724];return _0x33eb56;};'use strict';var Sequelize=require(_0x90b0('0x0'));module[_0x90b0('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 4baaac0..d2cefd7 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 _0xe830=['body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','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','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','find','create'];(function(_0x45510d,_0x235f12){var _0x263399=function(_0x31c6a4){while(--_0x31c6a4){_0x45510d['push'](_0x45510d['shift']());}};_0x263399(++_0x235f12);}(_0xe830,0xe5));var _0x0e83=function(_0x45533a,_0xf6d29a){_0x45533a=_0x45533a-0x0;var _0x35e675=_0xe830[_0x45533a];return _0x35e675;};'use strict';var emlformat=require(_0x0e83('0x0'));var rimraf=require(_0x0e83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e83('0x2'));var rp=require(_0x0e83('0x3'));var moment=require(_0x0e83('0x4'));var BPromise=require(_0x0e83('0x5'));var Mustache=require(_0x0e83('0x6'));var util=require(_0x0e83('0x7'));var path=require(_0x0e83('0x8'));var sox=require(_0x0e83('0x9'));var csv=require(_0x0e83('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e83('0xb'));var squel=require('squel');var crypto=require(_0x0e83('0xc'));var jsforce=require(_0x0e83('0xd'));var deskjs=require(_0x0e83('0xe'));var toCsv=require(_0x0e83('0xa'));var querystring=require(_0x0e83('0xf'));var Papa=require(_0x0e83('0x10'));var Redis=require(_0x0e83('0x11'));var authService=require(_0x0e83('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0e83('0x13'));var hardwareService=require(_0x0e83('0x14'));var logger=require(_0x0e83('0x15'))(_0x0e83('0x16'));var utils=require(_0x0e83('0x17'));var config=require(_0x0e83('0x18'));var licenseUtil=require(_0x0e83('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6b7e,_0x1d461d){_0x1d461d=_0x1d461d||0xcc;return function(_0x141c45){if(_0x141c45){return _0x4c6b7e['sendStatus'](_0x1d461d);}return _0x4c6b7e[_0x0e83('0x1a')](_0x1d461d)[_0x0e83('0x1b')]();};}function respondWithResult(_0xb25b34,_0x26f5d4){_0x26f5d4=_0x26f5d4||0xc8;return function(_0x2f652f){if(_0x2f652f){return _0xb25b34[_0x0e83('0x1a')](_0x26f5d4)[_0x0e83('0x1c')](_0x2f652f);}};}function respondWithFilteredResult(_0x3fb4e7,_0x20eb82){return function(_0x5d52ea){if(_0x5d52ea){var _0x463a1d=typeof _0x20eb82[_0x0e83('0x1d')]===_0x0e83('0x1e')&&typeof _0x20eb82['limit']===_0x0e83('0x1e');var _0x7032c7=_0x5d52ea[_0x0e83('0x1f')];var _0xa0b29c=_0x463a1d?0x0:_0x20eb82[_0x0e83('0x1d')];var _0x153ddc=_0x463a1d?_0x5d52ea[_0x0e83('0x1f')]:_0x20eb82['offset']+_0x20eb82[_0x0e83('0x20')];var _0x4ac5c2;if(_0x153ddc>=_0x7032c7){_0x153ddc=_0x7032c7;_0x4ac5c2=0xc8;}else{_0x4ac5c2=0xce;}_0x3fb4e7[_0x0e83('0x1a')](_0x4ac5c2);return _0x3fb4e7[_0x0e83('0x21')](_0x0e83('0x22'),_0xa0b29c+'-'+_0x153ddc+'/'+_0x7032c7)['json'](_0x5d52ea);}return null;};}function patchUpdates(_0x4ebc7b){return function(_0x1f8c0b){try{jsonpatch['apply'](_0x1f8c0b,_0x4ebc7b,!![]);}catch(_0x15c10){return BPromise[_0x0e83('0x23')](_0x15c10);}return _0x1f8c0b['save']();};}function saveUpdates(_0x53979d,_0x57ae16){return function(_0x32fd9a){if(_0x32fd9a){return _0x32fd9a[_0x0e83('0x24')](_0x53979d)['then'](function(_0x51bc3c){return _0x51bc3c;});}return null;};}function removeEntity(_0x511e05,_0x261998){return function(_0x3e6fe9){if(_0x3e6fe9){return _0x3e6fe9[_0x0e83('0x25')]()['then'](function(){_0x511e05[_0x0e83('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52e3f9,_0x2ac8c3){return function(_0x4d687e){if(!_0x4d687e){_0x52e3f9[_0x0e83('0x26')](0x194);}return _0x4d687e;};}function handleError(_0x3a0d97,_0x509b77){_0x509b77=_0x509b77||0x1f4;return function(_0x33f99b){logger[_0x0e83('0x27')](_0x33f99b[_0x0e83('0x28')]);if(_0x33f99b[_0x0e83('0x29')]){delete _0x33f99b[_0x0e83('0x29')];}_0x3a0d97[_0x0e83('0x1a')](_0x509b77)[_0x0e83('0x2a')](_0x33f99b);};}exports[_0x0e83('0x2b')]=function(_0x105017,_0x129b55){var _0x21f4ea={},_0x432484={},_0x15c8cc={'count':0x0,'rows':[]};var _0x31c6b5=_[_0x0e83('0x2c')](db[_0x0e83('0x2d')][_0x0e83('0x2e')],function(_0x64a2bd){return{'name':_0x64a2bd[_0x0e83('0x2f')],'type':_0x64a2bd[_0x0e83('0x30')][_0x0e83('0x31')]};});_0x432484['model']=_[_0x0e83('0x2c')](_0x31c6b5,_0x0e83('0x29'));_0x432484[_0x0e83('0x32')]=_[_0x0e83('0x33')](_0x105017['query']);_0x432484['filters']=_[_0x0e83('0x34')](_0x432484[_0x0e83('0x35')],_0x432484[_0x0e83('0x32')]);_0x21f4ea['attributes']=_[_0x0e83('0x34')](_0x432484[_0x0e83('0x35')],qs[_0x0e83('0x36')](_0x105017[_0x0e83('0x32')][_0x0e83('0x36')]));_0x21f4ea[_0x0e83('0x37')]=_0x21f4ea[_0x0e83('0x37')][_0x0e83('0x38')]?_0x21f4ea[_0x0e83('0x37')]:_0x432484[_0x0e83('0x35')];if(!_0x105017[_0x0e83('0x32')]['hasOwnProperty']('nolimit')){_0x21f4ea[_0x0e83('0x20')]=qs[_0x0e83('0x20')](_0x105017[_0x0e83('0x32')][_0x0e83('0x20')]);_0x21f4ea[_0x0e83('0x1d')]=qs[_0x0e83('0x1d')](_0x105017[_0x0e83('0x32')]['offset']);}_0x21f4ea[_0x0e83('0x39')]=qs[_0x0e83('0x3a')](_0x105017[_0x0e83('0x32')][_0x0e83('0x3a')]);_0x21f4ea[_0x0e83('0x3b')]=qs['filters'](_[_0x0e83('0x3c')](_0x105017[_0x0e83('0x32')],_0x432484[_0x0e83('0x3d')]),_0x31c6b5);if(_0x105017[_0x0e83('0x32')][_0x0e83('0x3e')]){_0x21f4ea['where']=_[_0x0e83('0x3f')](_0x21f4ea[_0x0e83('0x3b')],{'$or':_[_0x0e83('0x2c')](_0x31c6b5,function(_0x4e4044){if(_0x4e4044[_0x0e83('0x30')]!==_0x0e83('0x40')){var _0x35e7f5={};_0x35e7f5[_0x4e4044[_0x0e83('0x29')]]={'$like':'%'+_0x105017[_0x0e83('0x32')][_0x0e83('0x3e')]+'%'};return _0x35e7f5;}})});}_0x21f4ea=_['merge']({},_0x21f4ea,_0x105017[_0x0e83('0x41')]);var _0x2b2b99={'where':_0x21f4ea[_0x0e83('0x3b')]};return db['AnalyticTreeReport']['count'](_0x2b2b99)[_0x0e83('0x42')](function(_0xfed616){_0x15c8cc[_0x0e83('0x1f')]=_0xfed616;if(_0x105017[_0x0e83('0x32')][_0x0e83('0x43')]){_0x21f4ea[_0x0e83('0x44')]=[{'all':!![]}];}return db[_0x0e83('0x2d')]['findAll'](_0x21f4ea);})[_0x0e83('0x42')](function(_0x38ecd0){_0x15c8cc[_0x0e83('0x45')]=_0x38ecd0;return _0x15c8cc;})[_0x0e83('0x42')](respondWithFilteredResult(_0x129b55,_0x21f4ea))[_0x0e83('0x46')](handleError(_0x129b55,null));};exports[_0x0e83('0x47')]=function(_0x5552e4,_0x4eb48b){var _0x23dd62={'raw':!![],'where':{'id':_0x5552e4[_0x0e83('0x48')]['id']}},_0x422198={};_0x422198[_0x0e83('0x35')]=_[_0x0e83('0x33')](db[_0x0e83('0x2d')][_0x0e83('0x2e')]);_0x422198[_0x0e83('0x32')]=_[_0x0e83('0x33')](_0x5552e4[_0x0e83('0x32')]);_0x422198[_0x0e83('0x3d')]=_[_0x0e83('0x34')](_0x422198[_0x0e83('0x35')],_0x422198[_0x0e83('0x32')]);_0x23dd62[_0x0e83('0x37')]=_['intersection'](_0x422198['model'],qs[_0x0e83('0x36')](_0x5552e4[_0x0e83('0x32')][_0x0e83('0x36')]));_0x23dd62[_0x0e83('0x37')]=_0x23dd62[_0x0e83('0x37')]['length']?_0x23dd62[_0x0e83('0x37')]:_0x422198[_0x0e83('0x35')];if(_0x5552e4[_0x0e83('0x32')][_0x0e83('0x43')]){_0x23dd62[_0x0e83('0x44')]=[{'all':!![]}];}_0x23dd62=_[_0x0e83('0x3f')]({},_0x23dd62,_0x5552e4[_0x0e83('0x41')]);return db[_0x0e83('0x2d')][_0x0e83('0x49')](_0x23dd62)['then'](handleEntityNotFound(_0x4eb48b,null))[_0x0e83('0x42')](respondWithResult(_0x4eb48b,null))[_0x0e83('0x46')](handleError(_0x4eb48b,null));};exports[_0x0e83('0x4a')]=function(_0x5b41b5,_0x3c6fe3){return db[_0x0e83('0x2d')]['create'](_0x5b41b5[_0x0e83('0x4b')],{})[_0x0e83('0x42')](respondWithResult(_0x3c6fe3,0xc9))[_0x0e83('0x46')](handleError(_0x3c6fe3,null));};exports[_0x0e83('0x24')]=function(_0x498feb,_0x28adeb){if(_0x498feb['body']['id']){delete _0x498feb['body']['id'];}return db[_0x0e83('0x2d')][_0x0e83('0x49')]({'where':{'id':_0x498feb[_0x0e83('0x48')]['id']}})[_0x0e83('0x42')](handleEntityNotFound(_0x28adeb,null))[_0x0e83('0x42')](saveUpdates(_0x498feb[_0x0e83('0x4b')],null))[_0x0e83('0x42')](respondWithResult(_0x28adeb,null))[_0x0e83('0x46')](handleError(_0x28adeb,null));};exports[_0x0e83('0x25')]=function(_0x25e25a,_0x17b9e0){return db[_0x0e83('0x2d')][_0x0e83('0x49')]({'where':{'id':_0x25e25a['params']['id']}})['then'](handleEntityNotFound(_0x17b9e0,null))[_0x0e83('0x42')](removeEntity(_0x17b9e0,null))[_0x0e83('0x46')](handleError(_0x17b9e0,null));}; \ No newline at end of file +var _0x04b4=['stack','name','send','index','map','AnalyticTreeReport','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error'];(function(_0x359761,_0x54285f){var _0x41b94=function(_0x13f021){while(--_0x13f021){_0x359761['push'](_0x359761['shift']());}};_0x41b94(++_0x54285f);}(_0x04b4,0x147));var _0x404b=function(_0x338d05,_0x1dd4d5){_0x338d05=_0x338d05-0x0;var _0x2ae650=_0x04b4[_0x338d05];return _0x2ae650;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x404b('0x0'));var zipdir=require(_0x404b('0x1'));var jsonpatch=require(_0x404b('0x2'));var rp=require('request-promise');var moment=require(_0x404b('0x3'));var BPromise=require(_0x404b('0x4'));var Mustache=require(_0x404b('0x5'));var util=require(_0x404b('0x6'));var path=require(_0x404b('0x7'));var sox=require('sox');var csv=require(_0x404b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x404b('0x9'));var squel=require('squel');var crypto=require(_0x404b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x404b('0xb'));var toCsv=require(_0x404b('0x8'));var querystring=require('querystring');var Papa=require(_0x404b('0xc'));var Redis=require(_0x404b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x404b('0xe'));var as=require(_0x404b('0xf'));var hardwareService=require(_0x404b('0x10'));var logger=require(_0x404b('0x11'))('api');var utils=require(_0x404b('0x12'));var config=require(_0x404b('0x13'));var licenseUtil=require(_0x404b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27438d,_0x5dc728){_0x5dc728=_0x5dc728||0xcc;return function(_0x35acb2){if(_0x35acb2){return _0x27438d[_0x404b('0x15')](_0x5dc728);}return _0x27438d['status'](_0x5dc728)['end']();};}function respondWithResult(_0xed6975,_0x4be3be){_0x4be3be=_0x4be3be||0xc8;return function(_0x22cf0c){if(_0x22cf0c){return _0xed6975['status'](_0x4be3be)[_0x404b('0x16')](_0x22cf0c);}};}function respondWithFilteredResult(_0x1494ba,_0x5eaf14){return function(_0x112e11){if(_0x112e11){var _0x5a276c=typeof _0x5eaf14[_0x404b('0x17')]===_0x404b('0x18')&&typeof _0x5eaf14['limit']===_0x404b('0x18');var _0x4b73b9=_0x112e11[_0x404b('0x19')];var _0x5c68e0=_0x5a276c?0x0:_0x5eaf14[_0x404b('0x17')];var _0xdbfd78=_0x5a276c?_0x112e11['count']:_0x5eaf14['offset']+_0x5eaf14[_0x404b('0x1a')];var _0x4376e0;if(_0xdbfd78>=_0x4b73b9){_0xdbfd78=_0x4b73b9;_0x4376e0=0xc8;}else{_0x4376e0=0xce;}_0x1494ba[_0x404b('0x1b')](_0x4376e0);return _0x1494ba[_0x404b('0x1c')](_0x404b('0x1d'),_0x5c68e0+'-'+_0xdbfd78+'/'+_0x4b73b9)['json'](_0x112e11);}return null;};}function patchUpdates(_0x55c92a){return function(_0x4c1e92){try{jsonpatch[_0x404b('0x1e')](_0x4c1e92,_0x55c92a,!![]);}catch(_0x5025db){return BPromise[_0x404b('0x1f')](_0x5025db);}return _0x4c1e92[_0x404b('0x20')]();};}function saveUpdates(_0x336df6,_0x514724){return function(_0x3e5585){if(_0x3e5585){return _0x3e5585[_0x404b('0x21')](_0x336df6)[_0x404b('0x22')](function(_0x10f1e4){return _0x10f1e4;});}return null;};}function removeEntity(_0x1529a4,_0x1614ef){return function(_0x4446c1){if(_0x4446c1){return _0x4446c1[_0x404b('0x23')]()[_0x404b('0x22')](function(){_0x1529a4['status'](0xcc)[_0x404b('0x24')]();});}};}function handleEntityNotFound(_0x139292,_0x180988){return function(_0x12301e){if(!_0x12301e){_0x139292[_0x404b('0x15')](0x194);}return _0x12301e;};}function handleError(_0x51cc9c,_0x8a172a){_0x8a172a=_0x8a172a||0x1f4;return function(_0x35bcdb){logger[_0x404b('0x25')](_0x35bcdb[_0x404b('0x26')]);if(_0x35bcdb['name']){delete _0x35bcdb[_0x404b('0x27')];}_0x51cc9c[_0x404b('0x1b')](_0x8a172a)[_0x404b('0x28')](_0x35bcdb);};}exports[_0x404b('0x29')]=function(_0x278c2,_0x5bc1fd){var _0x248630={},_0x2eca9c={},_0xb53dc6={'count':0x0,'rows':[]};var _0x3bdaf1=_[_0x404b('0x2a')](db[_0x404b('0x2b')][_0x404b('0x2c')],function(_0x14b676){return{'name':_0x14b676['fieldName'],'type':_0x14b676['type']['key']};});_0x2eca9c['model']=_[_0x404b('0x2a')](_0x3bdaf1,_0x404b('0x27'));_0x2eca9c[_0x404b('0x2d')]=_[_0x404b('0x2e')](_0x278c2[_0x404b('0x2d')]);_0x2eca9c[_0x404b('0x2f')]=_[_0x404b('0x30')](_0x2eca9c[_0x404b('0x31')],_0x2eca9c[_0x404b('0x2d')]);_0x248630[_0x404b('0x32')]=_[_0x404b('0x30')](_0x2eca9c[_0x404b('0x31')],qs[_0x404b('0x33')](_0x278c2['query'][_0x404b('0x33')]));_0x248630[_0x404b('0x32')]=_0x248630['attributes'][_0x404b('0x34')]?_0x248630['attributes']:_0x2eca9c[_0x404b('0x31')];if(!_0x278c2[_0x404b('0x2d')]['hasOwnProperty'](_0x404b('0x35'))){_0x248630[_0x404b('0x1a')]=qs[_0x404b('0x1a')](_0x278c2['query']['limit']);_0x248630[_0x404b('0x17')]=qs[_0x404b('0x17')](_0x278c2[_0x404b('0x2d')][_0x404b('0x17')]);}_0x248630[_0x404b('0x36')]=qs[_0x404b('0x37')](_0x278c2[_0x404b('0x2d')][_0x404b('0x37')]);_0x248630[_0x404b('0x38')]=qs[_0x404b('0x2f')](_[_0x404b('0x39')](_0x278c2[_0x404b('0x2d')],_0x2eca9c[_0x404b('0x2f')]),_0x3bdaf1);if(_0x278c2[_0x404b('0x2d')][_0x404b('0x3a')]){_0x248630[_0x404b('0x38')]=_[_0x404b('0x3b')](_0x248630['where'],{'$or':_['map'](_0x3bdaf1,function(_0x50c02d){if(_0x50c02d[_0x404b('0x3c')]!==_0x404b('0x3d')){var _0xc38d={};_0xc38d[_0x50c02d[_0x404b('0x27')]]={'$like':'%'+_0x278c2[_0x404b('0x2d')][_0x404b('0x3a')]+'%'};return _0xc38d;}})});}_0x248630=_['merge']({},_0x248630,_0x278c2[_0x404b('0x3e')]);var _0x51d0e8={'where':_0x248630[_0x404b('0x38')]};return db[_0x404b('0x2b')][_0x404b('0x19')](_0x51d0e8)[_0x404b('0x22')](function(_0x5c6070){_0xb53dc6[_0x404b('0x19')]=_0x5c6070;if(_0x278c2[_0x404b('0x2d')][_0x404b('0x3f')]){_0x248630[_0x404b('0x40')]=[{'all':!![]}];}return db[_0x404b('0x2b')][_0x404b('0x41')](_0x248630);})['then'](function(_0x392e9a){_0xb53dc6[_0x404b('0x42')]=_0x392e9a;return _0xb53dc6;})[_0x404b('0x22')](respondWithFilteredResult(_0x5bc1fd,_0x248630))[_0x404b('0x43')](handleError(_0x5bc1fd,null));};exports[_0x404b('0x44')]=function(_0x157cfc,_0x22a8cb){var _0x55f4d7={'raw':!![],'where':{'id':_0x157cfc[_0x404b('0x45')]['id']}},_0x52e4d6={};_0x52e4d6[_0x404b('0x31')]=_[_0x404b('0x2e')](db[_0x404b('0x2b')]['rawAttributes']);_0x52e4d6[_0x404b('0x2d')]=_[_0x404b('0x2e')](_0x157cfc[_0x404b('0x2d')]);_0x52e4d6[_0x404b('0x2f')]=_[_0x404b('0x30')](_0x52e4d6[_0x404b('0x31')],_0x52e4d6[_0x404b('0x2d')]);_0x55f4d7[_0x404b('0x32')]=_['intersection'](_0x52e4d6[_0x404b('0x31')],qs[_0x404b('0x33')](_0x157cfc[_0x404b('0x2d')][_0x404b('0x33')]));_0x55f4d7['attributes']=_0x55f4d7[_0x404b('0x32')][_0x404b('0x34')]?_0x55f4d7['attributes']:_0x52e4d6[_0x404b('0x31')];if(_0x157cfc[_0x404b('0x2d')]['includeAll']){_0x55f4d7[_0x404b('0x40')]=[{'all':!![]}];}_0x55f4d7=_[_0x404b('0x3b')]({},_0x55f4d7,_0x157cfc[_0x404b('0x3e')]);return db[_0x404b('0x2b')][_0x404b('0x46')](_0x55f4d7)[_0x404b('0x22')](handleEntityNotFound(_0x22a8cb,null))['then'](respondWithResult(_0x22a8cb,null))['catch'](handleError(_0x22a8cb,null));};exports[_0x404b('0x47')]=function(_0x12c7da,_0x5e8caa){return db[_0x404b('0x2b')][_0x404b('0x47')](_0x12c7da[_0x404b('0x48')],{})[_0x404b('0x22')](respondWithResult(_0x5e8caa,0xc9))[_0x404b('0x43')](handleError(_0x5e8caa,null));};exports[_0x404b('0x21')]=function(_0x2325d7,_0x4807c5){if(_0x2325d7['body']['id']){delete _0x2325d7[_0x404b('0x48')]['id'];}return db[_0x404b('0x2b')][_0x404b('0x46')]({'where':{'id':_0x2325d7[_0x404b('0x45')]['id']}})[_0x404b('0x22')](handleEntityNotFound(_0x4807c5,null))[_0x404b('0x22')](saveUpdates(_0x2325d7[_0x404b('0x48')],null))['then'](respondWithResult(_0x4807c5,null))[_0x404b('0x43')](handleError(_0x4807c5,null));};exports[_0x404b('0x23')]=function(_0x3c1c54,_0x33c0c8){return db[_0x404b('0x2b')][_0x404b('0x46')]({'where':{'id':_0x3c1c54[_0x404b('0x45')]['id']}})[_0x404b('0x22')](handleEntityNotFound(_0x33c0c8,null))['then'](removeEntity(_0x33c0c8,null))['catch'](handleError(_0x33c0c8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index db313ff..6c2130c 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 _0x71e6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees','util','api'];(function(_0xccecef,_0x52e019){var _0xfba4d3=function(_0xb6b9aa){while(--_0xb6b9aa){_0xccecef['push'](_0xccecef['shift']());}};_0xfba4d3(++_0x52e019);}(_0x71e6,0x1ab));var _0x671e=function(_0x39be73,_0x31a022){_0x39be73=_0x39be73-0x0;var _0x14b572=_0x71e6[_0x39be73];return _0x14b572;};'use strict';var _=require('lodash');var util=require(_0x671e('0x0'));var logger=require('../../config/logger')(_0x671e('0x1'));var moment=require(_0x671e('0x2'));var BPromise=require(_0x671e('0x3'));var rp=require(_0x671e('0x4'));var fs=require('fs');var path=require(_0x671e('0x5'));var rimraf=require(_0x671e('0x6'));var config=require(_0x671e('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x671e('0x8')]=function(_0x5ce6aa,_0x5d80ca){return _0x5ce6aa[_0x671e('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x671e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb70d=['./analyticTreeReport.attributes','define','lodash','util','api','moment','bluebird','request-promise'];(function(_0x72cec1,_0x487eb0){var _0x552ed4=function(_0x2f71da){while(--_0x2f71da){_0x72cec1['push'](_0x72cec1['shift']());}};_0x552ed4(++_0x487eb0);}(_0xb70d,0x102));var _0xdb70=function(_0x594543,_0x36aba0){_0x594543=_0x594543-0x0;var _0x32d072=_0xb70d[_0x594543];return _0x32d072;};'use strict';var _=require(_0xdb70('0x0'));var util=require(_0xdb70('0x1'));var logger=require('../../config/logger')(_0xdb70('0x2'));var moment=require(_0xdb70('0x3'));var BPromise=require(_0xdb70('0x4'));var rp=require(_0xdb70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdb70('0x6'));module['exports']=function(_0x51b8fe,_0x166d24){return _0x51b8fe[_0xdb70('0x7')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','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 aa3f137..0c74328 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x450f34,_0x19858b){var _0xa68752=function(_0x4fd64d){while(--_0x4fd64d){_0x450f34['push'](_0x450f34['shift']());}};_0xa68752(++_0x19858b);}(_0xdb28,0x106));var _0x8db2=function(_0x3acb10,_0x37fa4a){_0x3acb10=_0x3acb10-0x0;var _0x3d9d32=_0xdb28[_0x3acb10];return _0x3d9d32;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0xbab402,_0x588332){_0xbab402=_0xbab402-0x0;var _0x5f06eb=_0x7a54[_0xbab402];return _0x5f06eb;};'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 828fd85..22b4e2d 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 _0x8c82=['create','put','/:id','update','delete','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','isAuthenticated','show','post'];(function(_0x18cc1c,_0x10f42d){var _0x205f02=function(_0x3e3be4){while(--_0x3e3be4){_0x18cc1c['push'](_0x18cc1c['shift']());}};_0x205f02(++_0x10f42d);}(_0x8c82,0x126));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x28c8('0x0'));var util=require(_0x28c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x28c8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x28c8('0x3'));var interaction=require(_0x28c8('0x4'));var config=require(_0x28c8('0x5'));var controller=require(_0x28c8('0x6'));router[_0x28c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x28c8('0x8')]);router[_0x28c8('0x7')]('/:id',auth[_0x28c8('0x9')](),controller[_0x28c8('0xa')]);router[_0x28c8('0xb')]('/',auth[_0x28c8('0x9')](),controller[_0x28c8('0xc')]);router[_0x28c8('0xd')](_0x28c8('0xe'),auth[_0x28c8('0x9')](),controller[_0x28c8('0xf')]);router[_0x28c8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x28c8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf545=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a2c6a,_0x356d21){var _0xa3ba72=function(_0xc0fb50){while(--_0xc0fb50){_0x3a2c6a['push'](_0x3a2c6a['shift']());}};_0xa3ba72(++_0x356d21);}(_0xf545,0xfc));var _0x5f54=function(_0x53e55c,_0x40898b){_0x53e55c=_0x53e55c-0x0;var _0x451802=_0xf545[_0x53e55c];return _0x451802;};'use strict';var multer=require(_0x5f54('0x0'));var util=require(_0x5f54('0x1'));var path=require('path');var timeout=require(_0x5f54('0x2'));var express=require('express');var router=express[_0x5f54('0x3')]();var fs_extra=require(_0x5f54('0x4'));var auth=require(_0x5f54('0x5'));var interaction=require(_0x5f54('0x6'));var config=require(_0x5f54('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x5f54('0x8')]('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0xa')]);router['get'](_0x5f54('0xb'),auth[_0x5f54('0x9')](),controller[_0x5f54('0xc')]);router[_0x5f54('0xd')]('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0xe')]);router[_0x5f54('0xf')](_0x5f54('0xb'),auth[_0x5f54('0x9')](),controller[_0x5f54('0x10')]);router[_0x5f54('0x11')](_0x5f54('0xb'),auth[_0x5f54('0x9')](),controller[_0x5f54('0x12')]);module[_0x5f54('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ae4e812..9d70698 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 _0xd382=['sequelize','exports','STRING'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xd382,0x1b6));var _0x2d38=function(_0x37d7e9,_0x5034be){_0x37d7e9=_0x37d7e9-0x0;var _0x53b51c=_0xd382[_0x37d7e9];return _0x53b51c;};'use strict';var Sequelize=require(_0x2d38('0x0'));module[_0x2d38('0x1')]={'name':{'type':Sequelize[_0x2d38('0x2')]},'basename':{'type':Sequelize[_0x2d38('0x2')]},'type':{'type':Sequelize[_0x2d38('0x2')]}}; \ No newline at end of file +var _0xbeff=['exports','STRING'];(function(_0x4557a6,_0x1c1a61){var _0x2b55ae=function(_0x16e707){while(--_0x16e707){_0x4557a6['push'](_0x4557a6['shift']());}};_0x2b55ae(++_0x1c1a61);}(_0xbeff,0x8e));var _0xfbef=function(_0x532cd9,_0x118c1e){_0x532cd9=_0x532cd9-0x0;var _0x567aae=_0xbeff[_0x532cd9];return _0x567aae;};'use strict';var Sequelize=require('sequelize');module[_0xfbef('0x0')]={'name':{'type':Sequelize[_0xfbef('0x1')]},'basename':{'type':Sequelize[_0xfbef('0x1')]},'type':{'type':Sequelize[_0xfbef('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9c54aa6..32ead3d 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 _0xa92c=['mimetype','download','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','ejs','fs-extra','lodash','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/environment','../../config/license/util','../../mysqldb','status','json','offset','count','set','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','index','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','Attachment','include','findAll','then','catch','show','rawAttributes','keys','find','clone','params','omit','body','createdAt','updatedAt','create','includeAll','file','originalname','basename','filename'];(function(_0x276683,_0x3bc50){var _0x4edd55=function(_0x7082b4){while(--_0x7082b4){_0x276683['push'](_0x276683['shift']());}};_0x4edd55(++_0x3bc50);}(_0xa92c,0x1b2));var _0xca92=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xa92c[_0x2261ce];return _0x524640;};'use strict';var emlformat=require(_0xca92('0x0'));var rimraf=require(_0xca92('0x1'));var zipdir=require(_0xca92('0x2'));var jsonpatch=require(_0xca92('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xca92('0x4'));var Mustache=require(_0xca92('0x5'));var util=require('util');var path=require(_0xca92('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca92('0x7'));var fs=require('fs');var fs_extra=require(_0xca92('0x8'));var _=require(_0xca92('0x9'));var squel=require('squel');var crypto=require(_0xca92('0xa'));var jsforce=require(_0xca92('0xb'));var deskjs=require(_0xca92('0xc'));var toCsv=require(_0xca92('0xd'));var querystring=require(_0xca92('0xe'));var Papa=require(_0xca92('0xf'));var Redis=require(_0xca92('0x10'));var authService=require(_0xca92('0x11'));var qs=require(_0xca92('0x12'));var as=require(_0xca92('0x13'));var hardwareService=require(_0xca92('0x14'));var logger=require(_0xca92('0x15'))(_0xca92('0x16'));var utils=require('../../config/utils');var config=require(_0xca92('0x17'));var licenseUtil=require(_0xca92('0x18'));var db=require(_0xca92('0x19'))['db'];function respondWithStatusCode(_0x346f60,_0x547127){_0x547127=_0x547127||0xcc;return function(_0x873b8c){if(_0x873b8c){return _0x346f60['sendStatus'](_0x547127);}return _0x346f60['status'](_0x547127)['end']();};}function respondWithResult(_0x53b8e4,_0x424e45){_0x424e45=_0x424e45||0xc8;return function(_0x2aa01e){if(_0x2aa01e){return _0x53b8e4[_0xca92('0x1a')](_0x424e45)[_0xca92('0x1b')](_0x2aa01e);}};}function respondWithFilteredResult(_0x41f253,_0x1c3bac){return function(_0xf95084){if(_0xf95084){var _0x1a28f4=typeof _0x1c3bac[_0xca92('0x1c')]==='undefined'&&typeof _0x1c3bac['limit']==='undefined';var _0x100948=_0xf95084[_0xca92('0x1d')];var _0x434525=_0x1a28f4?0x0:_0x1c3bac['offset'];var _0x143c4c=_0x1a28f4?_0xf95084[_0xca92('0x1d')]:_0x1c3bac[_0xca92('0x1c')]+_0x1c3bac['limit'];var _0x103193;if(_0x143c4c>=_0x100948){_0x143c4c=_0x100948;_0x103193=0xc8;}else{_0x103193=0xce;}_0x41f253[_0xca92('0x1a')](_0x103193);return _0x41f253[_0xca92('0x1e')]('Content-Range',_0x434525+'-'+_0x143c4c+'/'+_0x100948)[_0xca92('0x1b')](_0xf95084);}return null;};}function patchUpdates(_0x4ceddc){return function(_0x216eb0){try{jsonpatch[_0xca92('0x1f')](_0x216eb0,_0x4ceddc,!![]);}catch(_0x5437cc){return BPromise[_0xca92('0x20')](_0x5437cc);}return _0x216eb0[_0xca92('0x21')]();};}function saveUpdates(_0x1d96e0,_0xf271f5){return function(_0x1f3380){if(_0x1f3380){return _0x1f3380[_0xca92('0x22')](_0x1d96e0)['then'](function(_0xc7d2e){return _0xc7d2e;});}return null;};}function removeEntity(_0x209046,_0x1e68ff){return function(_0x1bc0b0){if(_0x1bc0b0){return _0x1bc0b0[_0xca92('0x23')]()['then'](function(){_0x209046[_0xca92('0x1a')](0xcc)[_0xca92('0x24')]();});}};}function handleEntityNotFound(_0xf774f6,_0xaf0cc9){return function(_0x50affd){if(!_0x50affd){_0xf774f6[_0xca92('0x25')](0x194);}return _0x50affd;};}function handleError(_0x6eade6,_0x2162ff){_0x2162ff=_0x2162ff||0x1f4;return function(_0xa81e14){logger[_0xca92('0x26')](_0xa81e14[_0xca92('0x27')]);if(_0xa81e14[_0xca92('0x28')]){delete _0xa81e14['name'];}_0x6eade6[_0xca92('0x1a')](_0x2162ff)['send'](_0xa81e14);};}exports[_0xca92('0x29')]=function(_0x468288,_0x496e48){var _0x3877c6={},_0x2cad7a={},_0x1b31c1={'count':0x0,'rows':[]};var _0x12fdb5=_['map'](db['Attachment']['rawAttributes'],function(_0x369f92){return{'name':_0x369f92[_0xca92('0x2a')],'type':_0x369f92[_0xca92('0x2b')]['key']};});_0x2cad7a[_0xca92('0x2c')]=_[_0xca92('0x2d')](_0x12fdb5,_0xca92('0x28'));_0x2cad7a[_0xca92('0x2e')]=_['keys'](_0x468288['query']);_0x2cad7a[_0xca92('0x2f')]=_[_0xca92('0x30')](_0x2cad7a[_0xca92('0x2c')],_0x2cad7a['query']);_0x3877c6['attributes']=_[_0xca92('0x30')](_0x2cad7a[_0xca92('0x2c')],qs[_0xca92('0x31')](_0x468288[_0xca92('0x2e')][_0xca92('0x31')]));_0x3877c6['attributes']=_0x3877c6[_0xca92('0x32')][_0xca92('0x33')]?_0x3877c6[_0xca92('0x32')]:_0x2cad7a[_0xca92('0x2c')];if(!_0x468288[_0xca92('0x2e')]['hasOwnProperty'](_0xca92('0x34'))){_0x3877c6['limit']=qs['limit'](_0x468288[_0xca92('0x2e')][_0xca92('0x35')]);_0x3877c6[_0xca92('0x1c')]=qs[_0xca92('0x1c')](_0x468288[_0xca92('0x2e')][_0xca92('0x1c')]);}_0x3877c6[_0xca92('0x36')]=qs[_0xca92('0x37')](_0x468288[_0xca92('0x2e')][_0xca92('0x37')]);_0x3877c6[_0xca92('0x38')]=qs[_0xca92('0x2f')](_['pick'](_0x468288['query'],_0x2cad7a[_0xca92('0x2f')]),_0x12fdb5);if(_0x468288[_0xca92('0x2e')][_0xca92('0x39')]){_0x3877c6[_0xca92('0x38')]=_[_0xca92('0x3a')](_0x3877c6[_0xca92('0x38')],{'$or':_['map'](_0x12fdb5,function(_0x38f6fd){if(_0x38f6fd[_0xca92('0x2b')]!==_0xca92('0x3b')){var _0x27322b={};_0x27322b[_0x38f6fd[_0xca92('0x28')]]={'$like':'%'+_0x468288['query']['filter']+'%'};return _0x27322b;}})});}_0x3877c6=_['merge']({},_0x3877c6,_0x468288[_0xca92('0x3c')]);var _0x8b0cd4={'where':_0x3877c6['where']};return db[_0xca92('0x3d')]['count'](_0x8b0cd4)['then'](function(_0x1468a0){_0x1b31c1['count']=_0x1468a0;if(_0x468288[_0xca92('0x2e')]['includeAll']){_0x3877c6[_0xca92('0x3e')]=[{'all':!![]}];}return db[_0xca92('0x3d')][_0xca92('0x3f')](_0x3877c6);})['then'](function(_0xe186e7){_0x1b31c1['rows']=_0xe186e7;return _0x1b31c1;})[_0xca92('0x40')](respondWithFilteredResult(_0x496e48,_0x3877c6))[_0xca92('0x41')](handleError(_0x496e48,null));};exports[_0xca92('0x42')]=function(_0x5db5e5,_0x350f20){var _0x197f22={'raw':!![],'where':{'id':_0x5db5e5['params']['id']}},_0x2fc807={};_0x2fc807[_0xca92('0x2c')]=_['keys'](db['Attachment'][_0xca92('0x43')]);_0x2fc807['query']=_[_0xca92('0x44')](_0x5db5e5[_0xca92('0x2e')]);_0x2fc807[_0xca92('0x2f')]=_[_0xca92('0x30')](_0x2fc807[_0xca92('0x2c')],_0x2fc807[_0xca92('0x2e')]);_0x197f22[_0xca92('0x32')]=_[_0xca92('0x30')](_0x2fc807['model'],qs[_0xca92('0x31')](_0x5db5e5[_0xca92('0x2e')][_0xca92('0x31')]));_0x197f22[_0xca92('0x32')]=_0x197f22[_0xca92('0x32')][_0xca92('0x33')]?_0x197f22[_0xca92('0x32')]:_0x2fc807[_0xca92('0x2c')];if(_0x5db5e5[_0xca92('0x2e')]['includeAll']){_0x197f22[_0xca92('0x3e')]=[{'all':!![]}];}_0x197f22=_['merge']({},_0x197f22,_0x5db5e5[_0xca92('0x3c')]);return db[_0xca92('0x3d')][_0xca92('0x45')](_0x197f22)[_0xca92('0x40')](handleEntityNotFound(_0x350f20,null))[_0xca92('0x40')](respondWithResult(_0x350f20,null))[_0xca92('0x41')](handleError(_0x350f20,null));};exports[_0xca92('0x46')]=function(_0x4c20ab,_0x317e1e){var _0x45faf3={'where':{'id':_0x4c20ab[_0xca92('0x47')]['id']}},_0x42852f={};_0x42852f['model']=_['keys'](db[_0xca92('0x3d')]['rawAttributes']);_0x45faf3['attributes']=_[_0xca92('0x30')](_0x42852f['model'],qs[_0xca92('0x31')](_0x4c20ab[_0xca92('0x2e')][_0xca92('0x31')]));_0x45faf3[_0xca92('0x32')]=_0x45faf3[_0xca92('0x32')][_0xca92('0x33')]?_0x45faf3[_0xca92('0x32')]:_0x42852f[_0xca92('0x2c')];if(_0x4c20ab['query']['includeAll']){_0x45faf3[_0xca92('0x3e')]=[{'all':!![]}];}_0x45faf3=_['merge']({},_0x45faf3,_0x4c20ab[_0xca92('0x3c')]);return db[_0xca92('0x3d')][_0xca92('0x45')](_0x45faf3)[_0xca92('0x40')](handleEntityNotFound(_0x317e1e,null))[_0xca92('0x40')](function(_0x2c1cb0){if(_0x2c1cb0){var _0x36ab1b=_0x2c1cb0['get']({'plain':!![]});_0x36ab1b=qs['omit'](_0x36ab1b,['id','createdAt','updatedAt']);_0x4c20ab['body']=_[_0xca92('0x48')](_0x4c20ab[_0xca92('0x49')],['id',_0xca92('0x4a'),_0xca92('0x4b')]);return db['Attachment'][_0xca92('0x4c')](_[_0xca92('0x3a')](_0x36ab1b,_0x4c20ab[_0xca92('0x49')]),{'include':_0x4c20ab['query'][_0xca92('0x4d')]?[{'all':!![]}]:undefined});}})[_0xca92('0x40')](respondWithResult(_0x317e1e,0xc9))[_0xca92('0x41')](handleError(_0x317e1e,null));};exports[_0xca92('0x22')]=function(_0x204866,_0x55cea9){if(_0x204866[_0xca92('0x49')]['id']){delete _0x204866[_0xca92('0x49')]['id'];}return db['Attachment']['find']({'where':{'id':_0x204866['params']['id']}})['then'](handleEntityNotFound(_0x55cea9,null))[_0xca92('0x40')](saveUpdates(_0x204866[_0xca92('0x49')],null))['then'](respondWithResult(_0x55cea9,null))[_0xca92('0x41')](handleError(_0x55cea9,null));};exports['destroy']=function(_0x206dfe,_0x52f846){return db[_0xca92('0x3d')][_0xca92('0x45')]({'where':{'id':_0x206dfe[_0xca92('0x47')]['id']}})[_0xca92('0x40')](handleEntityNotFound(_0x52f846,null))[_0xca92('0x40')](removeEntity(_0x52f846,null))[_0xca92('0x41')](handleError(_0x52f846,null));};exports['create']=function(_0x48dd38,_0x153ba7,_0x52b695){_0x48dd38[_0xca92('0x49')][_0xca92('0x28')]=_0x48dd38[_0xca92('0x4e')][_0xca92('0x4f')];_0x48dd38['body'][_0xca92('0x50')]=_0x48dd38[_0xca92('0x4e')][_0xca92('0x51')];_0x48dd38[_0xca92('0x49')][_0xca92('0x2b')]=_0x48dd38[_0xca92('0x4e')][_0xca92('0x52')];return db[_0xca92('0x3d')][_0xca92('0x4c')](_0x48dd38[_0xca92('0x49')])[_0xca92('0x40')](respondWithResult(_0x153ba7,0xc9))[_0xca92('0x41')](handleError(_0x153ba7,null));};exports[_0xca92('0x53')]=function(_0x482161,_0x2f447d,_0x7da97f){return db['Attachment']['findOne']({'where':{'id':_0x482161['params']['id']},'raw':!![]})[_0xca92('0x40')](handleEntityNotFound(_0x2f447d,null))['then'](function(_0xcf009e){if(_0xcf009e){var _0x4daaee=_0xcf009e['ChatOfflineMessageId']!==null;var _0x351d6f=path[_0xca92('0x54')](config['root'],_0xca92('0x55'));if(_0x4daaee){_0x351d6f=path[_0xca92('0x54')](_0x351d6f,'offline-chat/');}var _0x460016=path[_0xca92('0x54')](_0x351d6f,_0xcf009e[_0xca92('0x50')]);return _0x2f447d[_0xca92('0x53')](_0x460016);}})[_0xca92('0x41')](handleError(_0x2f447d,null));}; \ No newline at end of file +var _0x738d=['findAll','rows','show','catch','include','omit','updatedAt','body','create','find','params','file','originalname','filename','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','basename','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','send','index','Attachment','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','includeAll'];(function(_0x3b54d5,_0x91edca){var _0x4ff32e=function(_0x1662b7){while(--_0x1662b7){_0x3b54d5['push'](_0x3b54d5['shift']());}};_0x4ff32e(++_0x91edca);}(_0x738d,0x1cc));var _0xd738=function(_0x4fb085,_0x92d052){_0x4fb085=_0x4fb085-0x0;var _0x3fdbfe=_0x738d[_0x4fb085];return _0x3fdbfe;};'use strict';var emlformat=require(_0xd738('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd738('0x1'));var jsonpatch=require(_0xd738('0x2'));var rp=require(_0xd738('0x3'));var moment=require('moment');var BPromise=require(_0xd738('0x4'));var Mustache=require('mustache');var util=require(_0xd738('0x5'));var path=require(_0xd738('0x6'));var sox=require(_0xd738('0x7'));var csv=require(_0xd738('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd738('0x9'));var _=require(_0xd738('0xa'));var squel=require(_0xd738('0xb'));var crypto=require(_0xd738('0xc'));var jsforce=require(_0xd738('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd738('0x8'));var querystring=require(_0xd738('0xe'));var Papa=require(_0xd738('0xf'));var Redis=require(_0xd738('0x10'));var authService=require(_0xd738('0x11'));var qs=require(_0xd738('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd738('0x13'));var logger=require(_0xd738('0x14'))(_0xd738('0x15'));var utils=require(_0xd738('0x16'));var config=require(_0xd738('0x17'));var licenseUtil=require(_0xd738('0x18'));var db=require(_0xd738('0x19'))['db'];function respondWithStatusCode(_0x1fce0e,_0x1c976f){_0x1c976f=_0x1c976f||0xcc;return function(_0x2fb2ea){if(_0x2fb2ea){return _0x1fce0e['sendStatus'](_0x1c976f);}return _0x1fce0e['status'](_0x1c976f)[_0xd738('0x1a')]();};}function respondWithResult(_0x26edec,_0x3d7db0){_0x3d7db0=_0x3d7db0||0xc8;return function(_0xf0d87){if(_0xf0d87){return _0x26edec[_0xd738('0x1b')](_0x3d7db0)[_0xd738('0x1c')](_0xf0d87);}};}function respondWithFilteredResult(_0x316294,_0x234ead){return function(_0x5ba9fe){if(_0x5ba9fe){var _0x307b70=typeof _0x234ead[_0xd738('0x1d')]===_0xd738('0x1e')&&typeof _0x234ead[_0xd738('0x1f')]===_0xd738('0x1e');var _0x72c89a=_0x5ba9fe[_0xd738('0x20')];var _0x23e4f6=_0x307b70?0x0:_0x234ead['offset'];var _0x36fecc=_0x307b70?_0x5ba9fe[_0xd738('0x20')]:_0x234ead[_0xd738('0x1d')]+_0x234ead[_0xd738('0x1f')];var _0x344841;if(_0x36fecc>=_0x72c89a){_0x36fecc=_0x72c89a;_0x344841=0xc8;}else{_0x344841=0xce;}_0x316294[_0xd738('0x1b')](_0x344841);return _0x316294[_0xd738('0x21')](_0xd738('0x22'),_0x23e4f6+'-'+_0x36fecc+'/'+_0x72c89a)[_0xd738('0x1c')](_0x5ba9fe);}return null;};}function patchUpdates(_0xb14b4f){return function(_0x4ea10e){try{jsonpatch[_0xd738('0x23')](_0x4ea10e,_0xb14b4f,!![]);}catch(_0x458864){return BPromise[_0xd738('0x24')](_0x458864);}return _0x4ea10e[_0xd738('0x25')]();};}function saveUpdates(_0x37650a,_0x5a73f9){return function(_0x51110f){if(_0x51110f){return _0x51110f[_0xd738('0x26')](_0x37650a)['then'](function(_0xcc2fa4){return _0xcc2fa4;});}return null;};}function removeEntity(_0x5c3193,_0x494aae){return function(_0x24589e){if(_0x24589e){return _0x24589e[_0xd738('0x27')]()[_0xd738('0x28')](function(){_0x5c3193[_0xd738('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7146,_0x1e1fe1){return function(_0x389dbc){if(!_0x389dbc){_0x2c7146[_0xd738('0x29')](0x194);}return _0x389dbc;};}function handleError(_0x2fe61f,_0x572ead){_0x572ead=_0x572ead||0x1f4;return function(_0x29c5ce){logger['error'](_0x29c5ce[_0xd738('0x2a')]);if(_0x29c5ce['name']){delete _0x29c5ce['name'];}_0x2fe61f[_0xd738('0x1b')](_0x572ead)[_0xd738('0x2b')](_0x29c5ce);};}exports[_0xd738('0x2c')]=function(_0x5c7840,_0x53dbed){var _0x5b8321={},_0x57159a={},_0xcbdb54={'count':0x0,'rows':[]};var _0x43d2da=_['map'](db[_0xd738('0x2d')][_0xd738('0x2e')],function(_0xd83685){return{'name':_0xd83685[_0xd738('0x2f')],'type':_0xd83685[_0xd738('0x30')]['key']};});_0x57159a[_0xd738('0x31')]=_['map'](_0x43d2da,_0xd738('0x32'));_0x57159a[_0xd738('0x33')]=_[_0xd738('0x34')](_0x5c7840['query']);_0x57159a[_0xd738('0x35')]=_[_0xd738('0x36')](_0x57159a['model'],_0x57159a[_0xd738('0x33')]);_0x5b8321[_0xd738('0x37')]=_['intersection'](_0x57159a[_0xd738('0x31')],qs[_0xd738('0x38')](_0x5c7840[_0xd738('0x33')]['fields']));_0x5b8321[_0xd738('0x37')]=_0x5b8321['attributes'][_0xd738('0x39')]?_0x5b8321[_0xd738('0x37')]:_0x57159a[_0xd738('0x31')];if(!_0x5c7840[_0xd738('0x33')][_0xd738('0x3a')](_0xd738('0x3b'))){_0x5b8321['limit']=qs['limit'](_0x5c7840[_0xd738('0x33')][_0xd738('0x1f')]);_0x5b8321['offset']=qs[_0xd738('0x1d')](_0x5c7840[_0xd738('0x33')]['offset']);}_0x5b8321['order']=qs['sort'](_0x5c7840[_0xd738('0x33')][_0xd738('0x3c')]);_0x5b8321[_0xd738('0x3d')]=qs[_0xd738('0x35')](_[_0xd738('0x3e')](_0x5c7840[_0xd738('0x33')],_0x57159a[_0xd738('0x35')]),_0x43d2da);if(_0x5c7840[_0xd738('0x33')][_0xd738('0x3f')]){_0x5b8321[_0xd738('0x3d')]=_[_0xd738('0x40')](_0x5b8321[_0xd738('0x3d')],{'$or':_[_0xd738('0x41')](_0x43d2da,function(_0x291ed5){if(_0x291ed5[_0xd738('0x30')]!=='VIRTUAL'){var _0x48e5c1={};_0x48e5c1[_0x291ed5[_0xd738('0x32')]]={'$like':'%'+_0x5c7840[_0xd738('0x33')][_0xd738('0x3f')]+'%'};return _0x48e5c1;}})});}_0x5b8321=_['merge']({},_0x5b8321,_0x5c7840[_0xd738('0x42')]);var _0x241343={'where':_0x5b8321[_0xd738('0x3d')]};return db[_0xd738('0x2d')][_0xd738('0x20')](_0x241343)[_0xd738('0x28')](function(_0x3bfb3b){_0xcbdb54[_0xd738('0x20')]=_0x3bfb3b;if(_0x5c7840[_0xd738('0x33')][_0xd738('0x43')]){_0x5b8321['include']=[{'all':!![]}];}return db['Attachment'][_0xd738('0x44')](_0x5b8321);})['then'](function(_0x464a44){_0xcbdb54[_0xd738('0x45')]=_0x464a44;return _0xcbdb54;})['then'](respondWithFilteredResult(_0x53dbed,_0x5b8321))['catch'](handleError(_0x53dbed,null));};exports[_0xd738('0x46')]=function(_0x70a38,_0x14831c){var _0x44bfac={'raw':!![],'where':{'id':_0x70a38['params']['id']}},_0x45b7db={};_0x45b7db[_0xd738('0x31')]=_[_0xd738('0x34')](db[_0xd738('0x2d')][_0xd738('0x2e')]);_0x45b7db[_0xd738('0x33')]=_[_0xd738('0x34')](_0x70a38[_0xd738('0x33')]);_0x45b7db[_0xd738('0x35')]=_[_0xd738('0x36')](_0x45b7db[_0xd738('0x31')],_0x45b7db['query']);_0x44bfac['attributes']=_['intersection'](_0x45b7db[_0xd738('0x31')],qs[_0xd738('0x38')](_0x70a38[_0xd738('0x33')][_0xd738('0x38')]));_0x44bfac[_0xd738('0x37')]=_0x44bfac[_0xd738('0x37')]['length']?_0x44bfac[_0xd738('0x37')]:_0x45b7db['model'];if(_0x70a38[_0xd738('0x33')][_0xd738('0x43')]){_0x44bfac['include']=[{'all':!![]}];}_0x44bfac=_[_0xd738('0x40')]({},_0x44bfac,_0x70a38[_0xd738('0x42')]);return db[_0xd738('0x2d')]['find'](_0x44bfac)[_0xd738('0x28')](handleEntityNotFound(_0x14831c,null))['then'](respondWithResult(_0x14831c,null))[_0xd738('0x47')](handleError(_0x14831c,null));};exports['clone']=function(_0x24697e,_0x3e7e45){var _0x4d7ce0={'where':{'id':_0x24697e['params']['id']}},_0x5d3c55={};_0x5d3c55[_0xd738('0x31')]=_[_0xd738('0x34')](db[_0xd738('0x2d')][_0xd738('0x2e')]);_0x4d7ce0[_0xd738('0x37')]=_['intersection'](_0x5d3c55[_0xd738('0x31')],qs[_0xd738('0x38')](_0x24697e[_0xd738('0x33')][_0xd738('0x38')]));_0x4d7ce0[_0xd738('0x37')]=_0x4d7ce0['attributes'][_0xd738('0x39')]?_0x4d7ce0['attributes']:_0x5d3c55['model'];if(_0x24697e[_0xd738('0x33')][_0xd738('0x43')]){_0x4d7ce0[_0xd738('0x48')]=[{'all':!![]}];}_0x4d7ce0=_[_0xd738('0x40')]({},_0x4d7ce0,_0x24697e[_0xd738('0x42')]);return db[_0xd738('0x2d')]['find'](_0x4d7ce0)[_0xd738('0x28')](handleEntityNotFound(_0x3e7e45,null))[_0xd738('0x28')](function(_0x22aae1){if(_0x22aae1){var _0x44dc2f=_0x22aae1['get']({'plain':!![]});_0x44dc2f=qs[_0xd738('0x49')](_0x44dc2f,['id','createdAt',_0xd738('0x4a')]);_0x24697e['body']=_[_0xd738('0x49')](_0x24697e[_0xd738('0x4b')],['id','createdAt',_0xd738('0x4a')]);return db[_0xd738('0x2d')][_0xd738('0x4c')](_[_0xd738('0x40')](_0x44dc2f,_0x24697e[_0xd738('0x4b')]),{'include':_0x24697e[_0xd738('0x33')][_0xd738('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3e7e45,0xc9))[_0xd738('0x47')](handleError(_0x3e7e45,null));};exports['update']=function(_0x4d8519,_0xd90ed0){if(_0x4d8519[_0xd738('0x4b')]['id']){delete _0x4d8519[_0xd738('0x4b')]['id'];}return db[_0xd738('0x2d')][_0xd738('0x4d')]({'where':{'id':_0x4d8519[_0xd738('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd90ed0,null))[_0xd738('0x28')](saveUpdates(_0x4d8519[_0xd738('0x4b')],null))[_0xd738('0x28')](respondWithResult(_0xd90ed0,null))[_0xd738('0x47')](handleError(_0xd90ed0,null));};exports[_0xd738('0x27')]=function(_0x1e4849,_0x2119fb){return db['Attachment'][_0xd738('0x4d')]({'where':{'id':_0x1e4849[_0xd738('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2119fb,null))[_0xd738('0x28')](removeEntity(_0x2119fb,null))[_0xd738('0x47')](handleError(_0x2119fb,null));};exports[_0xd738('0x4c')]=function(_0x27cfcc,_0x438fc8,_0x292419){_0x27cfcc['body'][_0xd738('0x32')]=_0x27cfcc[_0xd738('0x4f')][_0xd738('0x50')];_0x27cfcc[_0xd738('0x4b')]['basename']=_0x27cfcc[_0xd738('0x4f')][_0xd738('0x51')];_0x27cfcc['body']['type']=_0x27cfcc[_0xd738('0x4f')]['mimetype'];return db[_0xd738('0x2d')]['create'](_0x27cfcc[_0xd738('0x4b')])['then'](respondWithResult(_0x438fc8,0xc9))[_0xd738('0x47')](handleError(_0x438fc8,null));};exports[_0xd738('0x52')]=function(_0x4a5d6d,_0x4abe1a,_0x49a73e){return db[_0xd738('0x2d')][_0xd738('0x53')]({'where':{'id':_0x4a5d6d[_0xd738('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4abe1a,null))[_0xd738('0x28')](function(_0x49d88b){if(_0x49d88b){var _0x3518b1=_0x49d88b[_0xd738('0x54')]!==null;var _0x12842e=path[_0xd738('0x55')](config['root'],_0xd738('0x56'));if(_0x3518b1){_0x12842e=path[_0xd738('0x55')](_0x12842e,'offline-chat/');}var _0x2a8b2b=path[_0xd738('0x55')](_0x12842e,_0x49d88b[_0xd738('0x57')]);return _0x4abe1a['download'](_0x2a8b2b);}})[_0xd738('0x47')](handleError(_0x4abe1a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1080fea..e00c88c 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 _0x6d36=['./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3e9c53,_0x401eb2){var _0x2ffa2f=function(_0xae5b99){while(--_0xae5b99){_0x3e9c53['push'](_0x3e9c53['shift']());}};_0x2ffa2f(++_0x401eb2);}(_0x6d36,0xf7));var _0x66d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x66d3('0x0'));var util=require(_0x66d3('0x1'));var logger=require(_0x66d3('0x2'))(_0x66d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x66d3('0x4'));var fs=require('fs');var path=require(_0x66d3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x66d3('0x6'));module[_0x66d3('0x7')]=function(_0x1736a7,_0x53f7e6){return _0x1736a7[_0x66d3('0x8')](_0x66d3('0x9'),attributes,{'tableName':_0x66d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd88f=['./attachment.attributes','define','Attachment','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43e6e0,_0x149111){var _0x3e3c5d=function(_0x4f3adc){while(--_0x4f3adc){_0x43e6e0['push'](_0x43e6e0['shift']());}};_0x3e3c5d(++_0x149111);}(_0xd88f,0x1dc));var _0xfd88=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd88f[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0xfd88('0x0'));var logger=require(_0xfd88('0x1'))('api');var moment=require(_0xfd88('0x2'));var BPromise=require(_0xfd88('0x3'));var rp=require(_0xfd88('0x4'));var fs=require('fs');var path=require(_0xfd88('0x5'));var rimraf=require(_0xfd88('0x6'));var config=require(_0xfd88('0x7'));var attributes=require(_0xfd88('0x8'));module['exports']=function(_0x2e87b8,_0x17a316){return _0x2e87b8[_0xfd88('0x9')](_0xfd88('0xa'),attributes,{'tableName':'attachments','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 8091026..82f63d4 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 _0xdace=['message','info','CreateAttachment','Attachment','create','options','raw','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s'];(function(_0x156a96,_0xb28bc){var _0x297671=function(_0x302a41){while(--_0x302a41){_0x156a96['push'](_0x156a96['shift']());}};_0x297671(++_0xb28bc);}(_0xdace,0xc5));var _0xedac=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xdace[_0x7d62cb];return _0x3a6266;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('Attachment,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});}exports[_0xedac('0x15')]=function(_0x4fb540){var _0x4b2563=this;return new Promise(function(_0x2d02d7,_0x2adefa){return db[_0xedac('0x16')][_0xedac('0x17')](_0x4fb540['body'],{'raw':_0x4fb540['options']?_0x4fb540[_0xedac('0x18')][_0xedac('0x19')]===undefined?!![]:![]:!![]})[_0xedac('0xc')](function(_0xcc1605){logger[_0xedac('0x14')](_0xedac('0x15'),_0x4fb540);logger[_0xedac('0xe')](_0xedac('0x15'),_0x4fb540,JSON['stringify'](_0xcc1605));_0x2d02d7(_0xcc1605);})[_0xedac('0x1a')](function(_0x510005){logger[_0xedac('0x10')](_0xedac('0x15'),_0x510005['message'],_0x4fb540);_0x2adefa(_0x4b2563[_0xedac('0x10')](0x1f4,_0x510005[_0xedac('0x13')]));});});}; \ No newline at end of file +var _0x7af2=['message','Attachment,\x20%s,\x20%s','result','catch','CreateAttachment','Attachment','create','body','options','raw','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error'];(function(_0x126da9,_0x7fcaa8){var _0x170d32=function(_0x3b657e){while(--_0x3b657e){_0x126da9['push'](_0x126da9['shift']());}};_0x170d32(++_0x7fcaa8);}(_0x7af2,0x119));var _0x27af=function(_0x28adaa,_0x4dcc47){_0x28adaa=_0x28adaa-0x0;var _0x2e633a=_0x7af2[_0x28adaa];return _0x2e633a;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('Attachment,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('Attachment,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('Attachment,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});}exports[_0x27af('0x14')]=function(_0x31d702){var _0x5997ae=this;return new Promise(function(_0x4e6e2f,_0x20a6d7){return db[_0x27af('0x15')][_0x27af('0x16')](_0x31d702[_0x27af('0x17')],{'raw':_0x31d702[_0x27af('0x18')]?_0x31d702['options'][_0x27af('0x19')]===undefined?!![]:![]:!![]})[_0x27af('0xc')](function(_0xcb4b90){logger['info'](_0x27af('0x14'),_0x31d702);logger[_0x27af('0x1a')](_0x27af('0x14'),_0x31d702,JSON['stringify'](_0xcb4b90));_0x4e6e2f(_0xcb4b90);})[_0x27af('0x13')](function(_0x2460f4){logger[_0x27af('0xf')](_0x27af('0x14'),_0x2460f4[_0x27af('0x10')],_0x31d702);_0x20a6d7(_0x5997ae[_0x27af('0xf')](0x1f4,_0x2460f4[_0x27af('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index cf47319..6d092ad 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +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(_0x2c9f90,_0x4f5e99){var _0x2e3d05=function(_0x22ac69){while(--_0x22ac69){_0x2c9f90['push'](_0x2c9f90['shift']());}};_0x2e3d05(++_0x4f5e99);}(_0xb10b,0x12a));var _0xbb10=function(_0x31ed74,_0x96d0de){_0x31ed74=_0x31ed74-0x0;var _0x260f84=_0xb10b[_0x31ed74];return _0x260f84;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index a009d7b..a5e867d 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 _0x46e3=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','disabled','blockedAt','online','admin','user','blocked','add','minutes','clearBlockUser','getLicense','catch','status','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','name','User','passport','passport-local','moment','activedirectory2','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x244086,_0x2d3b2d){var _0x57b8ae=function(_0x5f1409){while(--_0x5f1409){_0x244086['push'](_0x244086['shift']());}};_0x57b8ae(++_0x2d3b2d);}(_0x46e3,0x128));var _0x346e=function(_0x399fa9,_0x50bbd1){_0x399fa9=_0x399fa9-0x0;var _0x1a396e=_0x46e3[_0x399fa9];return _0x1a396e;};'use strict';var passport=require(_0x346e('0x0'));var LocalStrategy=require(_0x346e('0x1'))['Strategy'];var moment=require(_0x346e('0x2'));var ActiveDirectory=require(_0x346e('0x3'));var BPromise=require('bluebird');var util=require(_0x346e('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x346e('0x5'));var utils=require(_0x346e('0x6'));var config=require(_0x346e('0x7'));var logger=require(_0x346e('0x8'))('api');function isActiveDirectoryConfigured(_0x4c1a6c){var _0x4f32a0=![];if(typeof _0x4c1a6c[_0x346e('0x9')]!==_0x346e('0xa')){_0x4f32a0=_0x4c1a6c[_0x346e('0x9')][_0x346e('0xb')]&&_0x4c1a6c[_0x346e('0x9')][_0x346e('0xc')]&&_0x4c1a6c[_0x346e('0x9')][_0x346e('0xd')];}return _0x4f32a0;}function adAuthenticate(_0x3e5ec9,_0x3f5f2f,_0xb1fd3c){return new BPromise(function(_0xdb7380,_0x29f863){try{var _0x347c1c=new ActiveDirectory(_0x3e5ec9);_0x347c1c[_0x346e('0xe')](_0x3f5f2f,_0xb1fd3c,function(_0x56740a,_0x5968c6){if(_0x56740a){logger[_0x346e('0xf')](_0x346e('0x10'),_0x3f5f2f,util[_0x346e('0x11')](_0x56740a,{'showHidden':![],'depth':null}));_0x29f863(_0x346e('0x12'));}else if(!_0x5968c6){logger[_0x346e('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3f5f2f);_0x29f863('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xdb7380(_0x5968c6);}});}catch(_0x3e3336){_0x29f863(_0x3e3336);}});}function ActiveDirectoryAuthenticate(_0x4f1566,_0x57abc6,_0x2cb8ba,_0xac2d44){var _0xf73052,_0x28258f;if(!isActiveDirectoryConfigured(config)){logger[_0x346e('0xf')](_0x346e('0x13'),_0x57abc6);return _0xac2d44(null,![],{'message':_0x346e('0x12')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x346e('0x14'),_0x346e('0x15')],'raw':!![]})[_0x346e('0x16')](function(_0x53cb12){_0xf73052=_0x53cb12;if(!_0xf73052['adSsoEnabled']){logger[_0x346e('0xf')](_0x346e('0x17'),_0x57abc6);throw new Error(_0x346e('0x12'));}return _0x4f1566[_0x346e('0x18')]({'attributes':['id','name',_0x346e('0x19'),_0x346e('0x1a'),'role',_0x346e('0x1b'),'blocked',_0x346e('0x1c'),_0x346e('0x1d')],'where':{'name':_0x57abc6,'role':{'$or':[_0x346e('0x1e'),_0x346e('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0x346e('0x16')](function(_0x3c5444){if(!_0x3c5444||_0x3c5444&&_0x3c5444['name']!==_0x57abc6){throw new Error(_0x346e('0x12'));}_0x28258f=_0x3c5444;var _0x3ed3aa=_0x28258f['name']+'@'+config[_0x346e('0x9')][_0x346e('0xd')];return adAuthenticate(config['activedirectory'],_0x3ed3aa,_0x2cb8ba);})[_0x346e('0x16')](function(_0x4483d4){if(_0x28258f[_0x346e('0x1b')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0xf73052[_0x346e('0x15')]>0x0){if(_0x28258f[_0x346e('0x20')]){if(moment(_0x28258f[_0x346e('0x1c')])[_0x346e('0x21')](_0xf73052['blockDuration'],_0x346e('0x22'))>moment()){throw new Error(_0x346e('0x12'));}return utils[_0x346e('0x23')](_0x28258f,0x0,![],null)['then'](function(){return utils[_0x346e('0x24')](_0x28258f);})[_0x346e('0x16')](function(){return _0xac2d44(null,_0x28258f);});}else{return utils[_0x346e('0x24')](_0x28258f)['then'](function(){return _0xac2d44(null,_0x28258f);});}}else{return utils[_0x346e('0x24')](_0x28258f)[_0x346e('0x16')](function(){return _0xac2d44(null,_0x28258f);});}})[_0x346e('0x25')](function(_0x486ae1){return _0xac2d44(null,![],_0x486ae1);});}function handleError(_0x5ee942,_0xcfe8a2,_0x127d0c){return _0x5ee942[_0x346e('0x26')](_0xcfe8a2||0x1f4)['send']({'message':_0x127d0c?_0x127d0c['message']||_0x127d0c:''});}exports[_0x346e('0x27')]=function(_0xa174ca,_0x5edbfe,_0x26adb8){passport[_0x346e('0xe')](_0x346e('0x28'),function(_0x215bf4,_0x575907,_0x3df5eb){var _0x3dfda8=_0x215bf4||_0x3df5eb;if(_0x3dfda8){return handleError(_0x5edbfe,0x191,_0x3dfda8);}if(!_0x575907){return handleError(_0x5edbfe,0x194,{'message':_0x346e('0x29')});}else{var _0x369c96={'payload':{'id':_0x575907['id'],'role':_0x575907['role']},'options':{'expiresIn':0x15180}};return authService[_0x346e('0x2a')](_0x369c96)[_0x346e('0x16')](function(_0x14c1a){_0x5edbfe['json']({'id':_0x575907['id'],'token':_0x14c1a,'statusCall':'','isAlreadyLogged':_0x575907[_0x346e('0x1d')]});});}})(_0xa174ca,_0x5edbfe,_0x26adb8);};passport['use'](_0x346e('0x28'),new LocalStrategy({'usernameField':_0x346e('0x2b'),'passwordField':_0x346e('0x19')},function(_0x34fef5,_0x1325a9,_0x58dbdd){return ActiveDirectoryAuthenticate(db[_0x346e('0x2c')],_0x34fef5,_0x1325a9,_0x58dbdd);})); \ No newline at end of file +var _0xb664=['blockDuration','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','use','User','passport-local','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','adSsoEnabled','findOne','name','salt','disabled','blocked','online','agent','then','domain','blockedAt','add'];(function(_0x536128,_0x205e2b){var _0x19eb75=function(_0x5d5aa0){while(--_0x5d5aa0){_0x536128['push'](_0x536128['shift']());}};_0x19eb75(++_0x205e2b);}(_0xb664,0x151));var _0x4b66=function(_0x36abea,_0x2d09dd){_0x36abea=_0x36abea-0x0;var _0xbd36e4=_0xb664[_0x36abea];return _0xbd36e4;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x4b66('0x0'))['Strategy'];var moment=require(_0x4b66('0x1'));var ActiveDirectory=require(_0x4b66('0x2'));var BPromise=require('bluebird');var util=require(_0x4b66('0x3'));var db=require(_0x4b66('0x4'))['db'];var authService=require(_0x4b66('0x5'));var utils=require(_0x4b66('0x6'));var config=require(_0x4b66('0x7'));var logger=require(_0x4b66('0x8'))('api');function isActiveDirectoryConfigured(_0x18368f){var _0x482a51=![];if(typeof _0x18368f[_0x4b66('0x9')]!==_0x4b66('0xa')){_0x482a51=_0x18368f['activedirectory']['baseDN']&&_0x18368f[_0x4b66('0x9')][_0x4b66('0xb')]&&_0x18368f[_0x4b66('0x9')]['domain'];}return _0x482a51;}function adAuthenticate(_0x6a4bc2,_0x32dba4,_0x6421a9){return new BPromise(function(_0x36bfe5,_0x37b83d){try{var _0x2cf98f=new ActiveDirectory(_0x6a4bc2);_0x2cf98f[_0x4b66('0xc')](_0x32dba4,_0x6421a9,function(_0x38c6bc,_0x93cc6f){if(_0x38c6bc){logger[_0x4b66('0xd')](_0x4b66('0xe'),_0x32dba4,util[_0x4b66('0xf')](_0x38c6bc,{'showHidden':![],'depth':null}));_0x37b83d(_0x4b66('0x10'));}else if(!_0x93cc6f){logger[_0x4b66('0xd')](_0x4b66('0x11'),_0x32dba4);_0x37b83d(_0x4b66('0x10'));}else{_0x36bfe5(_0x93cc6f);}});}catch(_0x90217){_0x37b83d(_0x90217);}});}function ActiveDirectoryAuthenticate(_0x528e54,_0x4a5900,_0xa66ad,_0x5e00c8){var _0x4b5eff,_0x3efcb4;if(!isActiveDirectoryConfigured(config)){logger[_0x4b66('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x4a5900);return _0x5e00c8(null,![],{'message':_0x4b66('0x10')});}return db[_0x4b66('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0x4b66('0x13'),'blockDuration'],'raw':!![]})['then'](function(_0x4e9bb2){_0x4b5eff=_0x4e9bb2;if(!_0x4b5eff[_0x4b66('0x13')]){logger[_0x4b66('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x4a5900);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x528e54[_0x4b66('0x14')]({'attributes':['id',_0x4b66('0x15'),'password',_0x4b66('0x16'),'role',_0x4b66('0x17'),_0x4b66('0x18'),'blockedAt',_0x4b66('0x19')],'where':{'name':_0x4a5900,'role':{'$or':['admin','user',_0x4b66('0x1a')]},'adSsoEnabled':!![]}});})[_0x4b66('0x1b')](function(_0x247b34){if(!_0x247b34||_0x247b34&&_0x247b34[_0x4b66('0x15')]!==_0x4a5900){throw new Error(_0x4b66('0x10'));}_0x3efcb4=_0x247b34;var _0x369118=_0x3efcb4['name']+'@'+config[_0x4b66('0x9')][_0x4b66('0x1c')];return adAuthenticate(config[_0x4b66('0x9')],_0x369118,_0xa66ad);})[_0x4b66('0x1b')](function(_0x30b032){if(_0x3efcb4[_0x4b66('0x17')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4b5eff['blockDuration']>0x0){if(_0x3efcb4['blocked']){if(moment(_0x3efcb4[_0x4b66('0x1d')])[_0x4b66('0x1e')](_0x4b5eff[_0x4b66('0x1f')],_0x4b66('0x20'))>moment()){throw new Error(_0x4b66('0x10'));}return utils[_0x4b66('0x21')](_0x3efcb4,0x0,![],null)[_0x4b66('0x1b')](function(){return utils[_0x4b66('0x22')](_0x3efcb4);})[_0x4b66('0x1b')](function(){return _0x5e00c8(null,_0x3efcb4);});}else{return utils['getLicense'](_0x3efcb4)[_0x4b66('0x1b')](function(){return _0x5e00c8(null,_0x3efcb4);});}}else{return utils[_0x4b66('0x22')](_0x3efcb4)[_0x4b66('0x1b')](function(){return _0x5e00c8(null,_0x3efcb4);});}})[_0x4b66('0x23')](function(_0x4d7d2e){return _0x5e00c8(null,![],_0x4d7d2e);});}function handleError(_0x3d6c6a,_0x1aaf91,_0x599a39){return _0x3d6c6a[_0x4b66('0x24')](_0x1aaf91||0x1f4)[_0x4b66('0x25')]({'message':_0x599a39?_0x599a39[_0x4b66('0x26')]||_0x599a39:''});}exports[_0x4b66('0x27')]=function(_0x46ec79,_0x29498f,_0x20f850){passport[_0x4b66('0xc')](_0x4b66('0x28'),function(_0x185dc6,_0x8da84e,_0x41f9f9){var _0x37ff5e=_0x185dc6||_0x41f9f9;if(_0x37ff5e){return handleError(_0x29498f,0x191,_0x37ff5e);}if(!_0x8da84e){return handleError(_0x29498f,0x194,{'message':_0x4b66('0x29')});}else{var _0x1bd349={'payload':{'id':_0x8da84e['id'],'role':_0x8da84e[_0x4b66('0x2a')]},'options':{'expiresIn':0x15180}};return authService[_0x4b66('0x2b')](_0x1bd349)[_0x4b66('0x1b')](function(_0x3e9f93){_0x29498f['json']({'id':_0x8da84e['id'],'token':_0x3e9f93,'statusCall':'','isAlreadyLogged':_0x8da84e[_0x4b66('0x19')]});});}})(_0x46ec79,_0x29498f,_0x20f850);};passport[_0x4b66('0x2c')](_0x4b66('0x28'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x32e431,_0x30ffd0,_0xbd4a5c){return ActiveDirectoryAuthenticate(db[_0x4b66('0x2d')],_0x32e431,_0x30ffd0,_0xbd4a5c);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 1fa158d..7ba87c3 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 _0x0f39=['exports','express','./authActiveDirectory.controller','post','login'];(function(_0x333a53,_0xe8f712){var _0x3c2bd3=function(_0x106e4f){while(--_0x106e4f){_0x333a53['push'](_0x333a53['shift']());}};_0x3c2bd3(++_0xe8f712);}(_0x0f39,0xdd));var _0x90f3=function(_0x400f47,_0x112481){_0x400f47=_0x400f47-0x0;var _0x3edac7=_0x0f39[_0x400f47];return _0x3edac7;};'use strict';var express=require(_0x90f3('0x0'));var router=express['Router']();var controller=require(_0x90f3('0x1'));router[_0x90f3('0x2')]('/',controller[_0x90f3('0x3')]);module[_0x90f3('0x4')]=router; \ No newline at end of file +var _0xd6a6=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0x4c8d5a,_0xa62d3){var _0x38b78f=function(_0x3ce08c){while(--_0x3ce08c){_0x4c8d5a['push'](_0x4c8d5a['shift']());}};_0x38b78f(++_0xa62d3);}(_0xd6a6,0x1e5));var _0x6d6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6a6[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x6d6a('0x0'));var router=express[_0x6d6a('0x1')]();var controller=require(_0x6d6a('0x2'));router[_0x6d6a('0x3')]('/',controller[_0x6d6a('0x4')]);module[_0x6d6a('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 19ad1f5..0e1e8a4 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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0xcc4d00,_0x206c59){var _0x3bec1f=function(_0xf4dd00){while(--_0xf4dd00){_0xcc4d00['push'](_0xcc4d00['shift']());}};_0x3bec1f(++_0x206c59);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ 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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7a54,0x106));var _0x47a5=function(_0x50b090,_0x492486){_0x50b090=_0x50b090-0x0;var _0x2c286a=_0x7a54[_0x50b090];return _0x2c286a;};'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 3289086..5fef2ef 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 _0x7fc4=['/callback','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../../components/auth/service','login','get'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x7fc4,0x1cf));var _0x47fc=function(_0xc0e946,_0x5ea564){_0xc0e946=_0xc0e946-0x0;var _0x39efa9=_0x7fc4[_0xc0e946];return _0x39efa9;};'use strict';var express=require('express');var passport=require(_0x47fc('0x0'));var router=express['Router']();var controller=require(_0x47fc('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x47fc('0x2'));router['get']('/',controller[_0x47fc('0x3')]);router[_0x47fc('0x4')](_0x47fc('0x5'),controller['callback'],authService[_0x47fc('0x6')],userController[_0x47fc('0x3')],authService[_0x47fc('0x7')]);module[_0x47fc('0x8')]=router; \ No newline at end of file +var _0x61cd=['login','/callback','callback','setTokenCookie','exports','express','passport','Router','./authGoogle.controller'];(function(_0x155b2f,_0x927966){var _0x14f331=function(_0xf8b17a){while(--_0xf8b17a){_0x155b2f['push'](_0x155b2f['shift']());}};_0x14f331(++_0x927966);}(_0x61cd,0xa7));var _0xd61c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61cd[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xd61c('0x0'));var passport=require(_0xd61c('0x1'));var router=express[_0xd61c('0x2')]();var controller=require(_0xd61c('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0xd61c('0x4')]);router['get'](_0xd61c('0x5'),controller[_0xd61c('0x6')],authService['isMiddleware'],userController['login'],authService[_0xd61c('0x7')]);module[_0xd61c('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6fb1c1f..721b0b1 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 _0x6ebc=['SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','authenticate','local-login','signToken','json','online','forgot','body','trim','toLowerCase','Setting','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','findOne','blockDuration','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','Smtp','request','SendMail','error'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6ebc,0x78));var _0xc6eb=function(_0x588901,_0x17249f){_0x588901=_0x588901-0x0;var _0x39c89c=_0x6ebc[_0x588901];return _0x39c89c;};'use strict';var util=require(_0xc6eb('0x0'));var passport=require(_0xc6eb('0x1'));var LocalStrategy=require(_0xc6eb('0x2'))[_0xc6eb('0x3')];var jayson=require('jayson/promise');var _=require(_0xc6eb('0x4'));var rs=require(_0xc6eb('0x5'));var moment=require(_0xc6eb('0x6'));var db=require(_0xc6eb('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc6eb('0x8'));var client=jayson[_0xc6eb('0x9')][_0xc6eb('0xa')]({'port':0x232b});function localAuthenticate(_0x4452b6,_0xe56db1,_0x99e6f3,_0x2c9025){var _0x3de069,_0x18eb36;return db['Setting'][_0xc6eb('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc6eb('0xc')],'raw':!![]})['then'](function(_0x56b9d6){_0x3de069=_0x56b9d6;return _0x4452b6[_0xc6eb('0xb')]({'attributes':['id','name','password','salt','role',_0xc6eb('0xd'),_0xc6eb('0xe'),_0xc6eb('0xf'),_0xc6eb('0x10')],'where':{'name':_0xe56db1,'role':{'$or':[_0xc6eb('0x11'),_0xc6eb('0x12'),_0xc6eb('0x13')]}}});})[_0xc6eb('0x14')](function(_0x4a546a){if(!_0x4a546a||_0x4a546a&&_0x4a546a[_0xc6eb('0x15')]!==_0xe56db1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x18eb36=_0x4a546a;return _0x18eb36;}})[_0xc6eb('0x14')](function(){_0x18eb36['authenticate'](_0x99e6f3,function(_0x2e13e9,_0x451648){var _0x409824=_0x18eb36[_0xc6eb('0x10')]+0x1;if(_0x2e13e9){return _0x2c9025(_0x2e13e9);}else if(!_0x451648){if(_0x18eb36['disabled']){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}else if(_0x3de069[_0xc6eb('0x17')]>0x0){if(_0x18eb36[_0xc6eb('0xe')]){if(_0x3de069[_0xc6eb('0xc')]>0x0){if(moment(_0x18eb36[_0xc6eb('0xf')])[_0xc6eb('0x18')](_0x3de069[_0xc6eb('0xc')],_0xc6eb('0x19'))>moment()){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc6eb('0x1a')](_0x18eb36,_0x409824,![],null)[_0xc6eb('0x14')](function(){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});});}}else{return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}}else{if(_0x409824>=_0x3de069[_0xc6eb('0x17')]){return utils['clearBlockUser'](_0x18eb36,0x0,!![],moment())[_0xc6eb('0x14')](function(){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});});}else{return utils[_0xc6eb('0x1a')](_0x18eb36,_0x409824,![],null)['then'](function(){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});});}}}else{return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}}else{if(_0x18eb36['disabled']){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3de069['allowedLoginAttempts']>0x0){if(_0x18eb36[_0xc6eb('0xe')]){if(_0x3de069['blockDuration']>0x0){if(moment(_0x18eb36[_0xc6eb('0xf')])['add'](_0x3de069[_0xc6eb('0xc')],_0xc6eb('0x19'))>moment()){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc6eb('0x1a')](_0x18eb36,0x0,![],null)['then'](function(){return utils['getLicense'](_0x18eb36);})[_0xc6eb('0x14')](function(){return _0x2c9025(null,_0x18eb36);});}}else{return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}}else{return utils[_0xc6eb('0x1a')](_0x18eb36,0x0,![],null)[_0xc6eb('0x14')](function(){return utils[_0xc6eb('0x1b')](_0x18eb36);})['then'](function(){return _0x2c9025(null,_0x18eb36);})[_0xc6eb('0x1c')](function(_0x4d1709){return _0x2c9025(null,![],_0x4d1709);});}}else{if(_0x18eb36[_0xc6eb('0xe')]){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc6eb('0x1b')](_0x18eb36)[_0xc6eb('0x14')](function(){return _0x2c9025(null,_0x18eb36);});}}}});})[_0xc6eb('0x1c')](function(_0x3f0eee){return _0x2c9025(null,![],_0x3f0eee);});}function sendServiceMail(_0x47376d){return db[_0xc6eb('0x1d')][_0xc6eb('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xc6eb('0x15'),_0xc6eb('0x1f')],'include':[{'model':db[_0xc6eb('0x20')],'as':'Smtp','include':[{'model':db[_0xc6eb('0x21')],'as':_0xc6eb('0x21')}]}]})[_0xc6eb('0x14')](function(_0x48fbd2){if(!_0x48fbd2){throw new Error(_0xc6eb('0x22'));}var _0x299146=_0x48fbd2[_0xc6eb('0x23')]();var _0x38f74c={'account':_0x299146,'message':_[_0xc6eb('0x24')]({'from':util[_0xc6eb('0x25')]('\x22%s\x22\x20<%s>',_0x48fbd2[_0xc6eb('0x15')],_0x48fbd2['email']||_0x48fbd2[_0xc6eb('0x26')][_0xc6eb('0x12')])},_0x47376d)};return client[_0xc6eb('0x27')](_0xc6eb('0x28'),_0x38f74c);})[_0xc6eb('0x14')](function(_0x50730){if(_0x50730[_0xc6eb('0x29')]){throw new Error(util[_0xc6eb('0x25')](_0xc6eb('0x2a'),_0x50730['error'][_0xc6eb('0x2b')]||JSON[_0xc6eb('0x2c')](_0x50730[_0xc6eb('0x29')])));}return!![];});}function handleError(_0x44878f,_0x1662c1,_0x3c64e2){return _0x44878f[_0xc6eb('0x2d')](_0x1662c1||0x1f4)[_0xc6eb('0x2e')]({'message':_0x3c64e2?_0x3c64e2[_0xc6eb('0x2b')]||_0x3c64e2:''});}exports['login']=function(_0x5e14f1,_0x593806,_0x439c43){passport[_0xc6eb('0x2f')](_0xc6eb('0x30'),function(_0x5ab4f7,_0xbf1112,_0x5e3361){var _0x3eb669=_0x5ab4f7||_0x5e3361;if(_0x3eb669){return handleError(_0x593806,0x191,_0x3eb669);}if(!_0xbf1112){return handleError(_0x593806,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x26e70e={'payload':{'id':_0xbf1112['id'],'role':_0xbf1112['role']},'options':{'expiresIn':0x15180}};return authService[_0xc6eb('0x31')](_0x26e70e)['then'](function(_0x34df7c){_0x593806[_0xc6eb('0x32')]({'id':_0xbf1112['id'],'token':_0x34df7c,'statusCall':'','isAlreadyLogged':_0xbf1112[_0xc6eb('0x33')]});});}})(_0x5e14f1,_0x593806,_0x439c43);};exports[_0xc6eb('0x34')]=function(_0x597783,_0x3fdc5f){if(!_0x597783[_0xc6eb('0x35')]['email']){return handleError(_0x3fdc5f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x46c618=rs['generate']();_0x597783[_0xc6eb('0x35')][_0xc6eb('0x1f')]=_0x597783[_0xc6eb('0x35')][_0xc6eb('0x1f')][_0xc6eb('0x36')]()[_0xc6eb('0x37')]();var _0x273c31;return db[_0xc6eb('0x38')][_0xc6eb('0xb')]({'where':{'id':0x1},'attributes':[_0xc6eb('0x17'),'blockDuration'],'raw':!![]})[_0xc6eb('0x14')](function(_0x40d5d9){_0x273c31=_0x40d5d9;return db['User'][_0xc6eb('0x1e')]({'where':{'email':_0x597783[_0xc6eb('0x35')]['email']}});})[_0xc6eb('0x14')](function(_0x2796cd){if(!_0x2796cd){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2796cd['disabled']){throw new Error(_0xc6eb('0x39'));}if(_0x2796cd[_0xc6eb('0xe')]){if(moment(_0x2796cd['blockedAt'])[_0xc6eb('0x18')](_0x273c31[_0xc6eb('0xc')],_0xc6eb('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2796cd['blocked']=![];_0x2796cd['blockedAt']=null;}}_0x2796cd[_0xc6eb('0x3a')]=_0x46c618;_0x2796cd[_0xc6eb('0x3b')]=Date[_0xc6eb('0x3c')]()+0x36ee80;return _0x2796cd[_0xc6eb('0x3d')]();})['then'](function(){return sendServiceMail({'to':_0x597783[_0xc6eb('0x35')][_0xc6eb('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xc6eb('0x3e')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xc6eb('0x3f')+_0x597783[_0xc6eb('0x40')][_0xc6eb('0x41')]+_0xc6eb('0x42')+_0x46c618+'\x0a\x0a'+_0xc6eb('0x43')});})[_0xc6eb('0x14')](function(){_0x3fdc5f[_0xc6eb('0x2d')](0xc8)[_0xc6eb('0x2e')]({'message':_0xc6eb('0x44')});})[_0xc6eb('0x1c')](function(_0x30507b){return handleError(_0x3fdc5f,0x1f4,_0x30507b);});};exports[_0xc6eb('0x45')]=function(_0x100e09,_0x462c6c){return db[_0xc6eb('0x46')][_0xc6eb('0x1e')]({'where':{'resetPasswordToken':_0x100e09[_0xc6eb('0x47')]['token'],'resetPasswordExpires':{'$gt':Date[_0xc6eb('0x3c')]()}}})['then'](function(_0x54a8aa){if(!_0x54a8aa){throw new Error(_0xc6eb('0x48'));}return db['Setting'][_0xc6eb('0xb')]({'attributes':['id',_0xc6eb('0x49'),'enforcePasswordHistory',_0xc6eb('0x4a')]})['then'](function(_0x37abd6){if(_0x37abd6[_0xc6eb('0x49')])authService['validatePasswordPattern'](_0x100e09[_0xc6eb('0x35')][_0xc6eb('0x4b')]);if(!_0x37abd6[_0xc6eb('0x4c')]||!_0x54a8aa[_0xc6eb('0x4d')])return _0x54a8aa;authService[_0xc6eb('0x4e')](_0x100e09[_0xc6eb('0x35')][_0xc6eb('0x4b')],_0x54a8aa[_0xc6eb('0x4d')],_0x37abd6[_0xc6eb('0x4a')]);return _0x54a8aa;})[_0xc6eb('0x14')](function(){_0x54a8aa['password']=_0x100e09[_0xc6eb('0x35')][_0xc6eb('0x4b')];_0x54a8aa[_0xc6eb('0x3a')]=null;_0x54a8aa[_0xc6eb('0x3b')]=null;return _0x54a8aa[_0xc6eb('0x3d')]();});})['then'](function(){_0x462c6c['status'](0xc8)['send']({'message':_0xc6eb('0x4f')});})[_0xc6eb('0x1c')](function(_0x59a723){return handleError(_0x462c6c,0x1f4,_0x59a723);});};passport[_0xc6eb('0x50')](_0xc6eb('0x30'),new LocalStrategy({'usernameField':_0xc6eb('0x15'),'passwordField':'password'},function(_0x166990,_0x381af7,_0x513aad){return localAuthenticate(db[_0xc6eb('0x46')],_0x166990,_0x381af7,_0x513aad);})); \ No newline at end of file +var _0x4d9b=['generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','password','previousPasswords','validatePasswordHistory','passwordHistoryLimit','save','Password\x20reset!','use','local-login','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','\x22%s\x22\x20<%s>','user','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x241c5d,_0x4f087e){var _0x41cd50=function(_0x34b868){while(--_0x34b868){_0x241c5d['push'](_0x241c5d['shift']());}};_0x41cd50(++_0x4f087e);}(_0x4d9b,0x1bd));var _0xb4d9=function(_0x1551ea,_0x21272d){_0x1551ea=_0x1551ea-0x0;var _0xe06058=_0x4d9b[_0x1551ea];return _0xe06058;};'use strict';var util=require(_0xb4d9('0x0'));var passport=require(_0xb4d9('0x1'));var LocalStrategy=require(_0xb4d9('0x2'))[_0xb4d9('0x3')];var jayson=require(_0xb4d9('0x4'));var _=require(_0xb4d9('0x5'));var rs=require(_0xb4d9('0x6'));var moment=require('moment');var db=require(_0xb4d9('0x7'))['db'];var authService=require(_0xb4d9('0x8'));var utils=require(_0xb4d9('0x9'));var client=jayson['client'][_0xb4d9('0xa')]({'port':0x232b});function localAuthenticate(_0x3df5f3,_0x3fc6cf,_0x2c4741,_0x568bef){var _0x362f46,_0x3f6786;return db[_0xb4d9('0xb')][_0xb4d9('0xc')]({'where':{'id':0x1},'attributes':[_0xb4d9('0xd'),_0xb4d9('0xe')],'raw':!![]})[_0xb4d9('0xf')](function(_0x3ab6ef){_0x362f46=_0x3ab6ef;return _0x3df5f3[_0xb4d9('0xc')]({'attributes':['id',_0xb4d9('0x10'),'password','salt',_0xb4d9('0x11'),_0xb4d9('0x12'),_0xb4d9('0x13'),_0xb4d9('0x14'),_0xb4d9('0x15')],'where':{'name':_0x3fc6cf,'role':{'$or':[_0xb4d9('0x16'),'user',_0xb4d9('0x17')]}}});})[_0xb4d9('0xf')](function(_0x3dd054){if(!_0x3dd054||_0x3dd054&&_0x3dd054[_0xb4d9('0x10')]!==_0x3fc6cf){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3f6786=_0x3dd054;return _0x3f6786;}})[_0xb4d9('0xf')](function(){_0x3f6786[_0xb4d9('0x18')](_0x2c4741,function(_0x5c48f0,_0xcfcd31){var _0x132b04=_0x3f6786[_0xb4d9('0x15')]+0x1;if(_0x5c48f0){return _0x568bef(_0x5c48f0);}else if(!_0xcfcd31){if(_0x3f6786[_0xb4d9('0x12')]){return _0x568bef(null,![],{'message':_0xb4d9('0x19')});}else if(_0x362f46[_0xb4d9('0xd')]>0x0){if(_0x3f6786[_0xb4d9('0x13')]){if(_0x362f46[_0xb4d9('0xe')]>0x0){if(moment(_0x3f6786['blockedAt'])[_0xb4d9('0x1a')](_0x362f46[_0xb4d9('0xe')],_0xb4d9('0x1b'))>moment()){return _0x568bef(null,![],{'message':_0xb4d9('0x19')});}else{return utils['clearBlockUser'](_0x3f6786,_0x132b04,![],null)['then'](function(){return _0x568bef(null,![],{'message':_0xb4d9('0x19')});});}}else{return _0x568bef(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x132b04>=_0x362f46[_0xb4d9('0xd')]){return utils[_0xb4d9('0x1c')](_0x3f6786,0x0,!![],moment())[_0xb4d9('0xf')](function(){return _0x568bef(null,![],{'message':_0xb4d9('0x19')});});}else{return utils[_0xb4d9('0x1c')](_0x3f6786,_0x132b04,![],null)[_0xb4d9('0xf')](function(){return _0x568bef(null,![],{'message':_0xb4d9('0x19')});});}}}else{return _0x568bef(null,![],{'message':_0xb4d9('0x19')});}}else{if(_0x3f6786[_0xb4d9('0x12')]){return _0x568bef(null,![],{'message':_0xb4d9('0x19')});}else if(_0x362f46[_0xb4d9('0xd')]>0x0){if(_0x3f6786['blocked']){if(_0x362f46[_0xb4d9('0xe')]>0x0){if(moment(_0x3f6786[_0xb4d9('0x14')])[_0xb4d9('0x1a')](_0x362f46[_0xb4d9('0xe')],_0xb4d9('0x1b'))>moment()){return _0x568bef(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb4d9('0x1c')](_0x3f6786,0x0,![],null)[_0xb4d9('0xf')](function(){return utils[_0xb4d9('0x1d')](_0x3f6786);})['then'](function(){return _0x568bef(null,_0x3f6786);});}}else{return _0x568bef(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xb4d9('0x1c')](_0x3f6786,0x0,![],null)['then'](function(){return utils[_0xb4d9('0x1d')](_0x3f6786);})[_0xb4d9('0xf')](function(){return _0x568bef(null,_0x3f6786);})['catch'](function(_0x5296d9){return _0x568bef(null,![],_0x5296d9);});}}else{if(_0x3f6786[_0xb4d9('0x13')]){return _0x568bef(null,![],{'message':_0xb4d9('0x19')});}else{return utils[_0xb4d9('0x1d')](_0x3f6786)['then'](function(){return _0x568bef(null,_0x3f6786);});}}}});})[_0xb4d9('0x1e')](function(_0x41a5a3){return _0x568bef(null,![],_0x41a5a3);});}function sendServiceMail(_0x2d7e8e){return db[_0xb4d9('0x1f')][_0xb4d9('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xb4d9('0x21')],'include':[{'model':db[_0xb4d9('0x22')],'as':'Smtp','include':[{'model':db[_0xb4d9('0x23')],'as':'CloudProvider'}]}]})['then'](function(_0x2a7ae0){if(!_0x2a7ae0){throw new Error(_0xb4d9('0x24'));}var _0x183d2b=_0x2a7ae0['getSmtpOptions']();var _0x2a9f68={'account':_0x183d2b,'message':_['merge']({'from':util['format'](_0xb4d9('0x25'),_0x2a7ae0[_0xb4d9('0x10')],_0x2a7ae0['email']||_0x2a7ae0['Smtp'][_0xb4d9('0x26')])},_0x2d7e8e)};return client[_0xb4d9('0x27')]('SendMail',_0x2a9f68);})[_0xb4d9('0xf')](function(_0x329656){if(_0x329656[_0xb4d9('0x28')]){throw new Error(util[_0xb4d9('0x29')](_0xb4d9('0x2a'),_0x329656[_0xb4d9('0x28')][_0xb4d9('0x2b')]||JSON[_0xb4d9('0x2c')](_0x329656['error'])));}return!![];});}function handleError(_0x4bcd8d,_0x314a8f,_0x437188){return _0x4bcd8d[_0xb4d9('0x2d')](_0x314a8f||0x1f4)[_0xb4d9('0x2e')]({'message':_0x437188?_0x437188[_0xb4d9('0x2b')]||_0x437188:''});}exports[_0xb4d9('0x2f')]=function(_0x262604,_0x5249a9,_0x55318e){passport['authenticate']('local-login',function(_0x2cecd5,_0x25a507,_0x3eed6c){var _0x172ccc=_0x2cecd5||_0x3eed6c;if(_0x172ccc){return handleError(_0x5249a9,0x191,_0x172ccc);}if(!_0x25a507){return handleError(_0x5249a9,0x194,{'message':_0xb4d9('0x30')});}else{var _0x1e85dc={'payload':{'id':_0x25a507['id'],'role':_0x25a507[_0xb4d9('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1e85dc)[_0xb4d9('0xf')](function(_0x1ed400){_0x5249a9[_0xb4d9('0x31')]({'id':_0x25a507['id'],'token':_0x1ed400,'statusCall':'','isAlreadyLogged':_0x25a507['online']});});}})(_0x262604,_0x5249a9,_0x55318e);};exports[_0xb4d9('0x32')]=function(_0x3df8ed,_0x4c36b9){if(!_0x3df8ed[_0xb4d9('0x33')][_0xb4d9('0x21')]){return handleError(_0x4c36b9,0x1f4,{'message':_0xb4d9('0x34')});}var _0x5c5217=rs[_0xb4d9('0x35')]();_0x3df8ed[_0xb4d9('0x33')][_0xb4d9('0x21')]=_0x3df8ed[_0xb4d9('0x33')][_0xb4d9('0x21')][_0xb4d9('0x36')]()[_0xb4d9('0x37')]();var _0x53a04d;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb4d9('0xe')],'raw':!![]})[_0xb4d9('0xf')](function(_0x4efbde){_0x53a04d=_0x4efbde;return db['User'][_0xb4d9('0x20')]({'where':{'email':_0x3df8ed[_0xb4d9('0x33')][_0xb4d9('0x21')]}});})[_0xb4d9('0xf')](function(_0x547d3e){if(!_0x547d3e){throw new Error(_0xb4d9('0x38'));}if(_0x547d3e[_0xb4d9('0x12')]){throw new Error(_0xb4d9('0x39'));}if(_0x547d3e[_0xb4d9('0x13')]){if(moment(_0x547d3e[_0xb4d9('0x14')])[_0xb4d9('0x1a')](_0x53a04d['blockDuration'],_0xb4d9('0x1b'))>moment()){throw new Error(_0xb4d9('0x3a'));}else{_0x547d3e[_0xb4d9('0x13')]=![];_0x547d3e[_0xb4d9('0x14')]=null;}}_0x547d3e[_0xb4d9('0x3b')]=_0x5c5217;_0x547d3e[_0xb4d9('0x3c')]=Date['now']()+0x36ee80;return _0x547d3e['save']();})['then'](function(){return sendServiceMail({'to':_0x3df8ed['body'][_0xb4d9('0x21')],'subject':_0xb4d9('0x3d'),'text':_0xb4d9('0x3e')+_0xb4d9('0x3f')+_0xb4d9('0x40')+_0x3df8ed['headers'][_0xb4d9('0x41')]+'/reset/'+_0x5c5217+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xb4d9('0xf')](function(){_0x4c36b9['status'](0xc8)[_0xb4d9('0x2e')]({'message':_0xb4d9('0x42')});})[_0xb4d9('0x1e')](function(_0x2305da){return handleError(_0x4c36b9,0x1f4,_0x2305da);});};exports[_0xb4d9('0x43')]=function(_0x267c5f,_0xf84f77){return db[_0xb4d9('0x44')]['find']({'where':{'resetPasswordToken':_0x267c5f[_0xb4d9('0x45')][_0xb4d9('0x46')],'resetPasswordExpires':{'$gt':Date[_0xb4d9('0x47')]()}}})[_0xb4d9('0xf')](function(_0x169501){if(!_0x169501){throw new Error(_0xb4d9('0x48'));}return db['Setting'][_0xb4d9('0xc')]({'attributes':['id',_0xb4d9('0x49'),_0xb4d9('0x4a'),'passwordHistoryLimit']})[_0xb4d9('0xf')](function(_0x4d7106){if(_0x4d7106['securePassword'])authService['validatePasswordPattern'](_0x267c5f[_0xb4d9('0x33')][_0xb4d9('0x4b')]);if(!_0x4d7106[_0xb4d9('0x4a')]||!_0x169501[_0xb4d9('0x4c')])return _0x169501;authService[_0xb4d9('0x4d')](_0x267c5f[_0xb4d9('0x33')][_0xb4d9('0x4b')],_0x169501[_0xb4d9('0x4c')],_0x4d7106[_0xb4d9('0x4e')]);return _0x169501;})['then'](function(){_0x169501[_0xb4d9('0x4b')]=_0x267c5f[_0xb4d9('0x33')][_0xb4d9('0x4b')];_0x169501[_0xb4d9('0x3b')]=null;_0x169501[_0xb4d9('0x3c')]=null;return _0x169501[_0xb4d9('0x4f')]();});})[_0xb4d9('0xf')](function(){_0xf84f77['status'](0xc8)['send']({'message':_0xb4d9('0x50')});})['catch'](function(_0x1e0a15){return handleError(_0xf84f77,0x1f4,_0x1e0a15);});};passport[_0xb4d9('0x51')](_0xb4d9('0x52'),new LocalStrategy({'usernameField':_0xb4d9('0x10'),'passwordField':_0xb4d9('0x4b')},function(_0x5104fe,_0x5f37c3,_0x48a626){return localAuthenticate(db[_0xb4d9('0x44')],_0x5104fe,_0x5f37c3,_0x48a626);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3718735..ab5787a 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 _0xbddd=['exports','express','Router','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x348310,_0x462221){var _0x5122b6=function(_0xd4b958){while(--_0xd4b958){_0x348310['push'](_0x348310['shift']());}};_0x5122b6(++_0x462221);}(_0xbddd,0x159));var _0xdbdd=function(_0x2f48a6,_0x4d6b5e){_0x2f48a6=_0x2f48a6-0x0;var _0x5788d3=_0xbddd[_0x2f48a6];return _0x5788d3;};'use strict';var express=require(_0xdbdd('0x0'));var router=express[_0xdbdd('0x1')]();var controller=require(_0xdbdd('0x2'));router[_0xdbdd('0x3')]('/',controller[_0xdbdd('0x4')]);router[_0xdbdd('0x3')](_0xdbdd('0x5'),controller['forgot']);router[_0xdbdd('0x3')](_0xdbdd('0x6'),controller['reset']);module[_0xdbdd('0x7')]=router; \ No newline at end of file +var _0xfe5b=['./authLocal.controller','post','/forgot','/reset/:token','reset','exports','express'];(function(_0x22f79e,_0xa43ebb){var _0x42b347=function(_0xe07322){while(--_0xe07322){_0x22f79e['push'](_0x22f79e['shift']());}};_0x42b347(++_0xa43ebb);}(_0xfe5b,0x125));var _0xbfe5=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xfe5b[_0x3635ce];return _0x97ecd0;};'use strict';var express=require(_0xbfe5('0x0'));var router=express['Router']();var controller=require(_0xbfe5('0x1'));router['post']('/',controller['login']);router[_0xbfe5('0x2')](_0xbfe5('0x3'),controller['forgot']);router['post'](_0xbfe5('0x4'),controller[_0xbfe5('0x5')]);module[_0xbfe5('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4c3e1e2..8db5775 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 _0x517b=['INTEGER','sequelize','exports','BOOLEAN'];(function(_0x565610,_0x1a4085){var _0x89951f=function(_0x4bdf54){while(--_0x4bdf54){_0x565610['push'](_0x565610['shift']());}};_0x89951f(++_0x1a4085);}(_0x517b,0x129));var _0xb517=function(_0xc0ffd5,_0x5d656a){_0xc0ffd5=_0xc0ffd5-0x0;var _0x46fe2c=_0x517b[_0xc0ffd5];return _0x46fe2c;};'use strict';var Sequelize=require(_0xb517('0x0'));module[_0xb517('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xb517('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb517('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6520=['STRING','INTEGER','sequelize','exports'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x6520,0xfe));var _0x0652=function(_0x5474c6,_0x129851){_0x5474c6=_0x5474c6-0x0;var _0x3155ab=_0x6520[_0x5474c6];return _0x3155ab;};'use strict';var Sequelize=require(_0x0652('0x0'));module[_0x0652('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0652('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0652('0x3')],'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 f80a4de..a669880 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 _0x79fb=['count','set','Content-Range','save','update','destroy','then','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','length','includeAll','find','create','body','params','addConditions','ids','getConditions','findOne','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3be931,_0x3afd25){var _0x3b8a91=function(_0x163c3f){while(--_0x163c3f){_0x3be931['push'](_0x3be931['shift']());}};_0x3b8a91(++_0x3afd25);}(_0x79fb,0xd9));var _0xb79f=function(_0x308056,_0x8d9c69){_0x308056=_0x308056-0x0;var _0xbe9fc6=_0x79fb[_0x308056];return _0xbe9fc6;};'use strict';var emlformat=require(_0xb79f('0x0'));var rimraf=require(_0xb79f('0x1'));var zipdir=require(_0xb79f('0x2'));var jsonpatch=require(_0xb79f('0x3'));var rp=require(_0xb79f('0x4'));var moment=require('moment');var BPromise=require(_0xb79f('0x5'));var Mustache=require(_0xb79f('0x6'));var util=require(_0xb79f('0x7'));var path=require(_0xb79f('0x8'));var sox=require(_0xb79f('0x9'));var csv=require(_0xb79f('0xa'));var ejs=require(_0xb79f('0xb'));var fs=require('fs');var fs_extra=require(_0xb79f('0xc'));var _=require('lodash');var squel=require(_0xb79f('0xd'));var crypto=require(_0xb79f('0xe'));var jsforce=require(_0xb79f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb79f('0xa'));var querystring=require(_0xb79f('0x10'));var Papa=require(_0xb79f('0x11'));var Redis=require('ioredis');var authService=require(_0xb79f('0x12'));var qs=require(_0xb79f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb79f('0x14'));var logger=require(_0xb79f('0x15'))(_0xb79f('0x16'));var utils=require(_0xb79f('0x17'));var config=require(_0xb79f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb79f('0x19'))['db'];function respondWithStatusCode(_0x219a31,_0xdb4ab3){_0xdb4ab3=_0xdb4ab3||0xcc;return function(_0x323787){if(_0x323787){return _0x219a31[_0xb79f('0x1a')](_0xdb4ab3);}return _0x219a31[_0xb79f('0x1b')](_0xdb4ab3)[_0xb79f('0x1c')]();};}function respondWithResult(_0x47d6a4,_0x197d87){_0x197d87=_0x197d87||0xc8;return function(_0x2ac5c8){if(_0x2ac5c8){return _0x47d6a4[_0xb79f('0x1b')](_0x197d87)[_0xb79f('0x1d')](_0x2ac5c8);}};}function respondWithFilteredResult(_0xb53fdd,_0xab22f9){return function(_0xe3bfb3){if(_0xe3bfb3){var _0x495dae=typeof _0xab22f9[_0xb79f('0x1e')]===_0xb79f('0x1f')&&typeof _0xab22f9['limit']===_0xb79f('0x1f');var _0xa52411=_0xe3bfb3['count'];var _0x26cdf8=_0x495dae?0x0:_0xab22f9[_0xb79f('0x1e')];var _0x59226c=_0x495dae?_0xe3bfb3[_0xb79f('0x20')]:_0xab22f9[_0xb79f('0x1e')]+_0xab22f9['limit'];var _0x49374b;if(_0x59226c>=_0xa52411){_0x59226c=_0xa52411;_0x49374b=0xc8;}else{_0x49374b=0xce;}_0xb53fdd['status'](_0x49374b);return _0xb53fdd[_0xb79f('0x21')](_0xb79f('0x22'),_0x26cdf8+'-'+_0x59226c+'/'+_0xa52411)['json'](_0xe3bfb3);}return null;};}function patchUpdates(_0x8621d3){return function(_0x3da063){try{jsonpatch['apply'](_0x3da063,_0x8621d3,!![]);}catch(_0x106bae){return BPromise['reject'](_0x106bae);}return _0x3da063[_0xb79f('0x23')]();};}function saveUpdates(_0x55e97c,_0x246ab6){return function(_0x3d1478){if(_0x3d1478){return _0x3d1478[_0xb79f('0x24')](_0x55e97c)['then'](function(_0x3db1a0){return _0x3db1a0;});}return null;};}function removeEntity(_0x25aa15,_0x2ab119){return function(_0x5eae72){if(_0x5eae72){return _0x5eae72[_0xb79f('0x25')]()[_0xb79f('0x26')](function(){_0x25aa15[_0xb79f('0x1b')](0xcc)[_0xb79f('0x1c')]();});}};}function handleEntityNotFound(_0x470593,_0x293803){return function(_0x5aa319){if(!_0x5aa319){_0x470593[_0xb79f('0x1a')](0x194);}return _0x5aa319;};}function handleError(_0x39d4cc,_0x6bdfe2){_0x6bdfe2=_0x6bdfe2||0x1f4;return function(_0x674f11){logger[_0xb79f('0x27')](_0x674f11[_0xb79f('0x28')]);if(_0x674f11[_0xb79f('0x29')]){delete _0x674f11[_0xb79f('0x29')];}_0x39d4cc['status'](_0x6bdfe2)['send'](_0x674f11);};}exports[_0xb79f('0x2a')]=function(_0x14922d,_0x54bc40){var _0x5badfc={},_0x1d160c={},_0x25b7a1={'count':0x0,'rows':[]};var _0x1c3141=_[_0xb79f('0x2b')](db[_0xb79f('0x2c')][_0xb79f('0x2d')],function(_0x2bb98b){return{'name':_0x2bb98b[_0xb79f('0x2e')],'type':_0x2bb98b[_0xb79f('0x2f')][_0xb79f('0x30')]};});_0x1d160c[_0xb79f('0x31')]=_[_0xb79f('0x2b')](_0x1c3141,_0xb79f('0x29'));_0x1d160c[_0xb79f('0x32')]=_[_0xb79f('0x33')](_0x14922d[_0xb79f('0x32')]);_0x1d160c[_0xb79f('0x34')]=_[_0xb79f('0x35')](_0x1d160c[_0xb79f('0x31')],_0x1d160c[_0xb79f('0x32')]);_0x5badfc[_0xb79f('0x36')]=_[_0xb79f('0x35')](_0x1d160c[_0xb79f('0x31')],qs[_0xb79f('0x37')](_0x14922d['query']['fields']));_0x5badfc[_0xb79f('0x36')]=_0x5badfc[_0xb79f('0x36')]['length']?_0x5badfc[_0xb79f('0x36')]:_0x1d160c[_0xb79f('0x31')];if(!_0x14922d[_0xb79f('0x32')][_0xb79f('0x38')](_0xb79f('0x39'))){_0x5badfc[_0xb79f('0x3a')]=qs['limit'](_0x14922d['query'][_0xb79f('0x3a')]);_0x5badfc[_0xb79f('0x1e')]=qs[_0xb79f('0x1e')](_0x14922d['query'][_0xb79f('0x1e')]);}_0x5badfc[_0xb79f('0x3b')]=qs[_0xb79f('0x3c')](_0x14922d['query']['sort']);_0x5badfc[_0xb79f('0x3d')]=qs['filters'](_[_0xb79f('0x3e')](_0x14922d[_0xb79f('0x32')],_0x1d160c['filters']),_0x1c3141);if(_0x14922d['query'][_0xb79f('0x3f')]){_0x5badfc[_0xb79f('0x3d')]=_[_0xb79f('0x40')](_0x5badfc[_0xb79f('0x3d')],{'$or':_[_0xb79f('0x2b')](_0x1c3141,function(_0x5bdc77){if(_0x5bdc77[_0xb79f('0x2f')]!==_0xb79f('0x41')){var _0x422f80={};_0x422f80[_0x5bdc77[_0xb79f('0x29')]]={'$like':'%'+_0x14922d[_0xb79f('0x32')]['filter']+'%'};return _0x422f80;}})});}_0x5badfc=_['merge']({},_0x5badfc,_0x14922d[_0xb79f('0x42')]);var _0x1407f1={'where':_0x5badfc['where']};return db['Automation'][_0xb79f('0x20')](_0x1407f1)[_0xb79f('0x26')](function(_0x21f57f){_0x25b7a1[_0xb79f('0x20')]=_0x21f57f;if(_0x14922d['query']['includeAll']){_0x5badfc[_0xb79f('0x43')]=[{'all':!![]}];}return db['Automation'][_0xb79f('0x44')](_0x5badfc);})[_0xb79f('0x26')](function(_0x330a41){_0x25b7a1['rows']=_0x330a41;return _0x25b7a1;})[_0xb79f('0x26')](respondWithFilteredResult(_0x54bc40,_0x5badfc))[_0xb79f('0x45')](handleError(_0x54bc40,null));};exports[_0xb79f('0x46')]=function(_0xb6a45c,_0x2aacae){var _0x313b67={'raw':![],'where':{'id':_0xb6a45c['params']['id']}},_0x5859bf={};_0x5859bf['model']=_[_0xb79f('0x33')](db['Automation'][_0xb79f('0x2d')]);_0x5859bf['query']=_[_0xb79f('0x33')](_0xb6a45c[_0xb79f('0x32')]);_0x5859bf[_0xb79f('0x34')]=_[_0xb79f('0x35')](_0x5859bf[_0xb79f('0x31')],_0x5859bf[_0xb79f('0x32')]);_0x313b67[_0xb79f('0x36')]=_[_0xb79f('0x35')](_0x5859bf[_0xb79f('0x31')],qs[_0xb79f('0x37')](_0xb6a45c[_0xb79f('0x32')][_0xb79f('0x37')]));_0x313b67['attributes']=_0x313b67[_0xb79f('0x36')][_0xb79f('0x47')]?_0x313b67[_0xb79f('0x36')]:_0x5859bf[_0xb79f('0x31')];if(_0xb6a45c[_0xb79f('0x32')][_0xb79f('0x48')]){_0x313b67[_0xb79f('0x43')]=[{'all':!![]}];}_0x313b67=_[_0xb79f('0x40')]({},_0x313b67,_0xb6a45c[_0xb79f('0x42')]);return db[_0xb79f('0x2c')][_0xb79f('0x49')](_0x313b67)[_0xb79f('0x26')](handleEntityNotFound(_0x2aacae,null))[_0xb79f('0x26')](respondWithResult(_0x2aacae,null))[_0xb79f('0x45')](handleError(_0x2aacae,null));};exports[_0xb79f('0x4a')]=function(_0x2927f5,_0x24d6f4){return db[_0xb79f('0x2c')][_0xb79f('0x4a')](_0x2927f5[_0xb79f('0x4b')],{})[_0xb79f('0x26')](respondWithResult(_0x24d6f4,0xc9))[_0xb79f('0x45')](handleError(_0x24d6f4,null));};exports['update']=function(_0xf1a588,_0x49218b){if(_0xf1a588['body']['id']){delete _0xf1a588[_0xb79f('0x4b')]['id'];}return db['Automation']['find']({'where':{'id':_0xf1a588[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x49218b,null))[_0xb79f('0x26')](saveUpdates(_0xf1a588[_0xb79f('0x4b')],null))[_0xb79f('0x26')](respondWithResult(_0x49218b,null))[_0xb79f('0x45')](handleError(_0x49218b,null));};exports[_0xb79f('0x25')]=function(_0x970a66,_0x272f9c){return db[_0xb79f('0x2c')][_0xb79f('0x49')]({'where':{'id':_0x970a66[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x272f9c,null))[_0xb79f('0x26')](removeEntity(_0x272f9c,null))[_0xb79f('0x45')](handleError(_0x272f9c,null));};exports[_0xb79f('0x4d')]=function(_0x2e83b8,_0x3cb2b4,_0x228e85){return db['Condition'][_0xb79f('0x49')]({'where':{'id':_0x2e83b8[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x3cb2b4,null))[_0xb79f('0x26')](function(_0x5195c4){if(_0x5195c4){return _0x5195c4['addConditions'](_0x2e83b8[_0xb79f('0x4b')][_0xb79f('0x4e')],_['omit'](_0x2e83b8[_0xb79f('0x4b')],['ids','id'])||{});}})[_0xb79f('0x26')](respondWithResult(_0x3cb2b4,null))[_0xb79f('0x45')](handleError(_0x3cb2b4,null));};exports[_0xb79f('0x4f')]=function(_0x5d1940,_0x1d2e59,_0x5ea90a){var _0x4cca90={};var _0x4d059f={};var _0x582565;var _0x307312;return db['Automation'][_0xb79f('0x50')]({'where':{'id':_0x5d1940[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x1d2e59,null))[_0xb79f('0x26')](function(_0x3a31ab){if(_0x3a31ab){_0x582565=_0x3a31ab;_0x4d059f[_0xb79f('0x31')]=_['keys'](db['Condition'][_0xb79f('0x2d')]);_0x4d059f[_0xb79f('0x32')]=_[_0xb79f('0x33')](_0x5d1940[_0xb79f('0x32')]);_0x4d059f['filters']=_[_0xb79f('0x35')](_0x4d059f[_0xb79f('0x31')],_0x4d059f[_0xb79f('0x32')]);_0x4cca90[_0xb79f('0x36')]=_['intersection'](_0x4d059f[_0xb79f('0x31')],qs['fields'](_0x5d1940[_0xb79f('0x32')]['fields']));_0x4cca90[_0xb79f('0x36')]=_0x4cca90[_0xb79f('0x36')][_0xb79f('0x47')]?_0x4cca90[_0xb79f('0x36')]:_0x4d059f['model'];_0x4cca90['order']=qs['sort'](_0x5d1940[_0xb79f('0x32')]['sort']);_0x4cca90['where']=qs[_0xb79f('0x34')](_[_0xb79f('0x3e')](_0x5d1940['query'],_0x4d059f[_0xb79f('0x34')]));if(_0x5d1940[_0xb79f('0x32')][_0xb79f('0x3f')]){_0x4cca90[_0xb79f('0x3d')]=_['merge'](_0x4cca90[_0xb79f('0x3d')],{'$or':_['map'](_0x4cca90[_0xb79f('0x36')],function(_0x4a8479){var _0x4f9eca={};_0x4f9eca[_0x4a8479]={'$like':'%'+_0x5d1940[_0xb79f('0x32')]['filter']+'%'};return _0x4f9eca;})});}_0x4cca90=_[_0xb79f('0x40')]({},_0x4cca90,_0x5d1940[_0xb79f('0x42')]);return _0x582565[_0xb79f('0x4f')](_0x4cca90);}})['then'](function(_0x1e7ade){if(_0x1e7ade){_0x307312=_0x1e7ade['length'];if(!_0x5d1940[_0xb79f('0x32')][_0xb79f('0x38')]('nolimit')){_0x4cca90[_0xb79f('0x3a')]=qs[_0xb79f('0x3a')](_0x5d1940[_0xb79f('0x32')][_0xb79f('0x3a')]);_0x4cca90['offset']=qs[_0xb79f('0x1e')](_0x5d1940['query'][_0xb79f('0x1e')]);}return _0x582565[_0xb79f('0x4f')](_0x4cca90);}})[_0xb79f('0x26')](function(_0x1e716a){if(_0x1e716a){return _0x1e716a?{'count':_0x307312,'rows':_0x1e716a}:null;}})['then'](respondWithResult(_0x1d2e59,null))[_0xb79f('0x45')](handleError(_0x1d2e59,null));};exports[_0xb79f('0x51')]=function(_0x272f80,_0x5ec7a1,_0x13fe21){return db['Action'][_0xb79f('0x49')]({'where':{'id':_0x272f80['params']['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x5ec7a1,null))[_0xb79f('0x26')](function(_0x2e14ab){if(_0x2e14ab){return _0x2e14ab['addActions'](_0x272f80[_0xb79f('0x4b')][_0xb79f('0x4e')],_['omit'](_0x272f80[_0xb79f('0x4b')],[_0xb79f('0x4e'),'id'])||{});}})[_0xb79f('0x26')](respondWithResult(_0x5ec7a1,null))['catch'](handleError(_0x5ec7a1,null));};exports[_0xb79f('0x52')]=function(_0x58c21e,_0x4b8a4e,_0x177d31){var _0x2f5f5e={};var _0x250ee6={};var _0x2aa082;var _0x7d6482;return db['Automation'][_0xb79f('0x50')]({'where':{'id':_0x58c21e[_0xb79f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b8a4e,null))[_0xb79f('0x26')](function(_0x464697){if(_0x464697){_0x2aa082=_0x464697;_0x250ee6['model']=_[_0xb79f('0x33')](db['Action'][_0xb79f('0x2d')]);_0x250ee6[_0xb79f('0x32')]=_['keys'](_0x58c21e['query']);_0x250ee6['filters']=_['intersection'](_0x250ee6[_0xb79f('0x31')],_0x250ee6[_0xb79f('0x32')]);_0x2f5f5e[_0xb79f('0x36')]=_[_0xb79f('0x35')](_0x250ee6[_0xb79f('0x31')],qs[_0xb79f('0x37')](_0x58c21e[_0xb79f('0x32')]['fields']));_0x2f5f5e[_0xb79f('0x36')]=_0x2f5f5e[_0xb79f('0x36')][_0xb79f('0x47')]?_0x2f5f5e[_0xb79f('0x36')]:_0x250ee6['model'];_0x2f5f5e[_0xb79f('0x3b')]=qs[_0xb79f('0x3c')](_0x58c21e[_0xb79f('0x32')][_0xb79f('0x3c')]);_0x2f5f5e['where']=qs[_0xb79f('0x34')](_[_0xb79f('0x3e')](_0x58c21e[_0xb79f('0x32')],_0x250ee6['filters']));if(_0x58c21e[_0xb79f('0x32')][_0xb79f('0x3f')]){_0x2f5f5e['where']=_[_0xb79f('0x40')](_0x2f5f5e[_0xb79f('0x3d')],{'$or':_[_0xb79f('0x2b')](_0x2f5f5e['attributes'],function(_0x43cd0b){var _0x5cf60b={};_0x5cf60b[_0x43cd0b]={'$like':'%'+_0x58c21e[_0xb79f('0x32')][_0xb79f('0x3f')]+'%'};return _0x5cf60b;})});}_0x2f5f5e=_[_0xb79f('0x40')]({},_0x2f5f5e,_0x58c21e[_0xb79f('0x42')]);return _0x2aa082[_0xb79f('0x52')](_0x2f5f5e);}})[_0xb79f('0x26')](function(_0xe55d0d){if(_0xe55d0d){_0x7d6482=_0xe55d0d['length'];if(!_0x58c21e[_0xb79f('0x32')]['hasOwnProperty'](_0xb79f('0x39'))){_0x2f5f5e[_0xb79f('0x3a')]=qs[_0xb79f('0x3a')](_0x58c21e['query'][_0xb79f('0x3a')]);_0x2f5f5e[_0xb79f('0x1e')]=qs[_0xb79f('0x1e')](_0x58c21e[_0xb79f('0x32')][_0xb79f('0x1e')]);}return _0x2aa082[_0xb79f('0x52')](_0x2f5f5e);}})['then'](function(_0x50b45b){if(_0x50b45b){return _0x50b45b?{'count':_0x7d6482,'rows':_0x50b45b}:null;}})[_0xb79f('0x26')](respondWithResult(_0x4b8a4e,null))[_0xb79f('0x45')](handleError(_0x4b8a4e,null));}; \ No newline at end of file +var _0x0f66=['../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','Automation','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','params','keys','length','options','find','catch','create','body','Condition','addConditions','ids','omit','getConditions','findOne','addActions','Action','getActions','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','papaparse','ioredis'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x0f66,0x140));var _0x60f6=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x0f66[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0x60f6('0x0'));var rimraf=require(_0x60f6('0x1'));var zipdir=require(_0x60f6('0x2'));var jsonpatch=require(_0x60f6('0x3'));var rp=require(_0x60f6('0x4'));var moment=require('moment');var BPromise=require(_0x60f6('0x5'));var Mustache=require(_0x60f6('0x6'));var util=require(_0x60f6('0x7'));var path=require(_0x60f6('0x8'));var sox=require(_0x60f6('0x9'));var csv=require(_0x60f6('0xa'));var ejs=require(_0x60f6('0xb'));var fs=require('fs');var fs_extra=require(_0x60f6('0xc'));var _=require(_0x60f6('0xd'));var squel=require(_0x60f6('0xe'));var crypto=require(_0x60f6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x60f6('0x10'));var toCsv=require(_0x60f6('0xa'));var querystring=require(_0x60f6('0x11'));var Papa=require(_0x60f6('0x12'));var Redis=require(_0x60f6('0x13'));var authService=require(_0x60f6('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60f6('0x15'));var logger=require(_0x60f6('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x60f6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x60f6('0x18'))['db'];function respondWithStatusCode(_0x4b17d0,_0x187d48){_0x187d48=_0x187d48||0xcc;return function(_0x1bb146){if(_0x1bb146){return _0x4b17d0[_0x60f6('0x19')](_0x187d48);}return _0x4b17d0[_0x60f6('0x1a')](_0x187d48)[_0x60f6('0x1b')]();};}function respondWithResult(_0x494e2b,_0x1cdbc7){_0x1cdbc7=_0x1cdbc7||0xc8;return function(_0x557617){if(_0x557617){return _0x494e2b[_0x60f6('0x1a')](_0x1cdbc7)['json'](_0x557617);}};}function respondWithFilteredResult(_0x571dc4,_0xcc7379){return function(_0x5cf9df){if(_0x5cf9df){var _0x2a5d00=typeof _0xcc7379['offset']===_0x60f6('0x1c')&&typeof _0xcc7379['limit']==='undefined';var _0x62c20b=_0x5cf9df['count'];var _0xdcc07e=_0x2a5d00?0x0:_0xcc7379[_0x60f6('0x1d')];var _0x46a551=_0x2a5d00?_0x5cf9df['count']:_0xcc7379[_0x60f6('0x1d')]+_0xcc7379[_0x60f6('0x1e')];var _0x3353a1;if(_0x46a551>=_0x62c20b){_0x46a551=_0x62c20b;_0x3353a1=0xc8;}else{_0x3353a1=0xce;}_0x571dc4[_0x60f6('0x1a')](_0x3353a1);return _0x571dc4[_0x60f6('0x1f')](_0x60f6('0x20'),_0xdcc07e+'-'+_0x46a551+'/'+_0x62c20b)[_0x60f6('0x21')](_0x5cf9df);}return null;};}function patchUpdates(_0x2ce6f3){return function(_0x3d63c9){try{jsonpatch[_0x60f6('0x22')](_0x3d63c9,_0x2ce6f3,!![]);}catch(_0x1e350e){return BPromise[_0x60f6('0x23')](_0x1e350e);}return _0x3d63c9['save']();};}function saveUpdates(_0x2c78c5,_0x5c1967){return function(_0x3b9805){if(_0x3b9805){return _0x3b9805[_0x60f6('0x24')](_0x2c78c5)['then'](function(_0x296695){return _0x296695;});}return null;};}function removeEntity(_0xef9bc8,_0x121905){return function(_0x23fb07){if(_0x23fb07){return _0x23fb07[_0x60f6('0x25')]()[_0x60f6('0x26')](function(){_0xef9bc8[_0x60f6('0x1a')](0xcc)[_0x60f6('0x1b')]();});}};}function handleEntityNotFound(_0x218588,_0x432e2c){return function(_0x552b7d){if(!_0x552b7d){_0x218588[_0x60f6('0x19')](0x194);}return _0x552b7d;};}function handleError(_0x1e68a1,_0x435352){_0x435352=_0x435352||0x1f4;return function(_0x415477){logger[_0x60f6('0x27')](_0x415477[_0x60f6('0x28')]);if(_0x415477['name']){delete _0x415477[_0x60f6('0x29')];}_0x1e68a1[_0x60f6('0x1a')](_0x435352)[_0x60f6('0x2a')](_0x415477);};}exports[_0x60f6('0x2b')]=function(_0x858fe1,_0x5aa321){var _0x47f2ba={},_0x19462b={},_0x1a8b72={'count':0x0,'rows':[]};var _0xbc87ba=_[_0x60f6('0x2c')](db[_0x60f6('0x2d')][_0x60f6('0x2e')],function(_0x56a9ec){return{'name':_0x56a9ec['fieldName'],'type':_0x56a9ec[_0x60f6('0x2f')][_0x60f6('0x30')]};});_0x19462b[_0x60f6('0x31')]=_[_0x60f6('0x2c')](_0xbc87ba,'name');_0x19462b[_0x60f6('0x32')]=_['keys'](_0x858fe1[_0x60f6('0x32')]);_0x19462b[_0x60f6('0x33')]=_[_0x60f6('0x34')](_0x19462b[_0x60f6('0x31')],_0x19462b[_0x60f6('0x32')]);_0x47f2ba[_0x60f6('0x35')]=_['intersection'](_0x19462b[_0x60f6('0x31')],qs[_0x60f6('0x36')](_0x858fe1['query'][_0x60f6('0x36')]));_0x47f2ba[_0x60f6('0x35')]=_0x47f2ba[_0x60f6('0x35')]['length']?_0x47f2ba[_0x60f6('0x35')]:_0x19462b['model'];if(!_0x858fe1[_0x60f6('0x32')][_0x60f6('0x37')](_0x60f6('0x38'))){_0x47f2ba[_0x60f6('0x1e')]=qs[_0x60f6('0x1e')](_0x858fe1[_0x60f6('0x32')][_0x60f6('0x1e')]);_0x47f2ba[_0x60f6('0x1d')]=qs[_0x60f6('0x1d')](_0x858fe1[_0x60f6('0x32')][_0x60f6('0x1d')]);}_0x47f2ba[_0x60f6('0x39')]=qs[_0x60f6('0x3a')](_0x858fe1[_0x60f6('0x32')][_0x60f6('0x3a')]);_0x47f2ba[_0x60f6('0x3b')]=qs[_0x60f6('0x33')](_[_0x60f6('0x3c')](_0x858fe1['query'],_0x19462b[_0x60f6('0x33')]),_0xbc87ba);if(_0x858fe1[_0x60f6('0x32')][_0x60f6('0x3d')]){_0x47f2ba['where']=_[_0x60f6('0x3e')](_0x47f2ba[_0x60f6('0x3b')],{'$or':_['map'](_0xbc87ba,function(_0x3058a3){if(_0x3058a3[_0x60f6('0x2f')]!==_0x60f6('0x3f')){var _0x17d9b3={};_0x17d9b3[_0x3058a3[_0x60f6('0x29')]]={'$like':'%'+_0x858fe1['query'][_0x60f6('0x3d')]+'%'};return _0x17d9b3;}})});}_0x47f2ba=_['merge']({},_0x47f2ba,_0x858fe1['options']);var _0x1de63a={'where':_0x47f2ba[_0x60f6('0x3b')]};return db['Automation']['count'](_0x1de63a)['then'](function(_0x577ca0){_0x1a8b72[_0x60f6('0x40')]=_0x577ca0;if(_0x858fe1[_0x60f6('0x32')][_0x60f6('0x41')]){_0x47f2ba['include']=[{'all':!![]}];}return db[_0x60f6('0x2d')][_0x60f6('0x42')](_0x47f2ba);})[_0x60f6('0x26')](function(_0x446fc1){_0x1a8b72[_0x60f6('0x43')]=_0x446fc1;return _0x1a8b72;})[_0x60f6('0x26')](respondWithFilteredResult(_0x5aa321,_0x47f2ba))['catch'](handleError(_0x5aa321,null));};exports['show']=function(_0x3f2147,_0x4c8e86){var _0x243473={'raw':![],'where':{'id':_0x3f2147[_0x60f6('0x44')]['id']}},_0x180065={};_0x180065[_0x60f6('0x31')]=_[_0x60f6('0x45')](db[_0x60f6('0x2d')][_0x60f6('0x2e')]);_0x180065[_0x60f6('0x32')]=_[_0x60f6('0x45')](_0x3f2147['query']);_0x180065[_0x60f6('0x33')]=_[_0x60f6('0x34')](_0x180065[_0x60f6('0x31')],_0x180065[_0x60f6('0x32')]);_0x243473[_0x60f6('0x35')]=_[_0x60f6('0x34')](_0x180065[_0x60f6('0x31')],qs[_0x60f6('0x36')](_0x3f2147['query'][_0x60f6('0x36')]));_0x243473[_0x60f6('0x35')]=_0x243473[_0x60f6('0x35')][_0x60f6('0x46')]?_0x243473[_0x60f6('0x35')]:_0x180065[_0x60f6('0x31')];if(_0x3f2147[_0x60f6('0x32')][_0x60f6('0x41')]){_0x243473['include']=[{'all':!![]}];}_0x243473=_[_0x60f6('0x3e')]({},_0x243473,_0x3f2147[_0x60f6('0x47')]);return db[_0x60f6('0x2d')][_0x60f6('0x48')](_0x243473)[_0x60f6('0x26')](handleEntityNotFound(_0x4c8e86,null))['then'](respondWithResult(_0x4c8e86,null))[_0x60f6('0x49')](handleError(_0x4c8e86,null));};exports[_0x60f6('0x4a')]=function(_0x422492,_0x7aff66){return db[_0x60f6('0x2d')][_0x60f6('0x4a')](_0x422492[_0x60f6('0x4b')],{})['then'](respondWithResult(_0x7aff66,0xc9))[_0x60f6('0x49')](handleError(_0x7aff66,null));};exports[_0x60f6('0x24')]=function(_0x820524,_0x87991e){if(_0x820524[_0x60f6('0x4b')]['id']){delete _0x820524[_0x60f6('0x4b')]['id'];}return db[_0x60f6('0x2d')][_0x60f6('0x48')]({'where':{'id':_0x820524[_0x60f6('0x44')]['id']}})[_0x60f6('0x26')](handleEntityNotFound(_0x87991e,null))['then'](saveUpdates(_0x820524[_0x60f6('0x4b')],null))[_0x60f6('0x26')](respondWithResult(_0x87991e,null))['catch'](handleError(_0x87991e,null));};exports[_0x60f6('0x25')]=function(_0x56052d,_0x29b548){return db[_0x60f6('0x2d')][_0x60f6('0x48')]({'where':{'id':_0x56052d[_0x60f6('0x44')]['id']}})[_0x60f6('0x26')](handleEntityNotFound(_0x29b548,null))[_0x60f6('0x26')](removeEntity(_0x29b548,null))[_0x60f6('0x49')](handleError(_0x29b548,null));};exports['addConditions']=function(_0x57431d,_0x32477f,_0x2bb830){return db[_0x60f6('0x4c')][_0x60f6('0x48')]({'where':{'id':_0x57431d[_0x60f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x32477f,null))[_0x60f6('0x26')](function(_0x36ea10){if(_0x36ea10){return _0x36ea10[_0x60f6('0x4d')](_0x57431d['body'][_0x60f6('0x4e')],_[_0x60f6('0x4f')](_0x57431d[_0x60f6('0x4b')],[_0x60f6('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x32477f,null))[_0x60f6('0x49')](handleError(_0x32477f,null));};exports[_0x60f6('0x50')]=function(_0x4330ae,_0xc54c4a,_0x1b7f89){var _0x40a7ec={};var _0x312069={};var _0x6b72a8;var _0x38322b;return db[_0x60f6('0x2d')][_0x60f6('0x51')]({'where':{'id':_0x4330ae[_0x60f6('0x44')]['id']}})[_0x60f6('0x26')](handleEntityNotFound(_0xc54c4a,null))[_0x60f6('0x26')](function(_0x361c10){if(_0x361c10){_0x6b72a8=_0x361c10;_0x312069['model']=_[_0x60f6('0x45')](db[_0x60f6('0x4c')][_0x60f6('0x2e')]);_0x312069[_0x60f6('0x32')]=_['keys'](_0x4330ae[_0x60f6('0x32')]);_0x312069[_0x60f6('0x33')]=_['intersection'](_0x312069[_0x60f6('0x31')],_0x312069['query']);_0x40a7ec[_0x60f6('0x35')]=_[_0x60f6('0x34')](_0x312069[_0x60f6('0x31')],qs[_0x60f6('0x36')](_0x4330ae[_0x60f6('0x32')][_0x60f6('0x36')]));_0x40a7ec[_0x60f6('0x35')]=_0x40a7ec[_0x60f6('0x35')][_0x60f6('0x46')]?_0x40a7ec['attributes']:_0x312069[_0x60f6('0x31')];_0x40a7ec[_0x60f6('0x39')]=qs['sort'](_0x4330ae[_0x60f6('0x32')]['sort']);_0x40a7ec[_0x60f6('0x3b')]=qs[_0x60f6('0x33')](_['pick'](_0x4330ae[_0x60f6('0x32')],_0x312069[_0x60f6('0x33')]));if(_0x4330ae['query'][_0x60f6('0x3d')]){_0x40a7ec[_0x60f6('0x3b')]=_[_0x60f6('0x3e')](_0x40a7ec[_0x60f6('0x3b')],{'$or':_[_0x60f6('0x2c')](_0x40a7ec[_0x60f6('0x35')],function(_0x5632d9){var _0x1ef6cd={};_0x1ef6cd[_0x5632d9]={'$like':'%'+_0x4330ae[_0x60f6('0x32')]['filter']+'%'};return _0x1ef6cd;})});}_0x40a7ec=_[_0x60f6('0x3e')]({},_0x40a7ec,_0x4330ae[_0x60f6('0x47')]);return _0x6b72a8[_0x60f6('0x50')](_0x40a7ec);}})[_0x60f6('0x26')](function(_0x4476bd){if(_0x4476bd){_0x38322b=_0x4476bd[_0x60f6('0x46')];if(!_0x4330ae[_0x60f6('0x32')][_0x60f6('0x37')](_0x60f6('0x38'))){_0x40a7ec[_0x60f6('0x1e')]=qs[_0x60f6('0x1e')](_0x4330ae[_0x60f6('0x32')][_0x60f6('0x1e')]);_0x40a7ec[_0x60f6('0x1d')]=qs[_0x60f6('0x1d')](_0x4330ae[_0x60f6('0x32')][_0x60f6('0x1d')]);}return _0x6b72a8['getConditions'](_0x40a7ec);}})[_0x60f6('0x26')](function(_0x26ad03){if(_0x26ad03){return _0x26ad03?{'count':_0x38322b,'rows':_0x26ad03}:null;}})['then'](respondWithResult(_0xc54c4a,null))[_0x60f6('0x49')](handleError(_0xc54c4a,null));};exports[_0x60f6('0x52')]=function(_0x5e43b8,_0x1bd283,_0x4b588f){return db[_0x60f6('0x53')][_0x60f6('0x48')]({'where':{'id':_0x5e43b8[_0x60f6('0x44')]['id']}})[_0x60f6('0x26')](handleEntityNotFound(_0x1bd283,null))[_0x60f6('0x26')](function(_0xf1adc6){if(_0xf1adc6){return _0xf1adc6[_0x60f6('0x52')](_0x5e43b8[_0x60f6('0x4b')][_0x60f6('0x4e')],_['omit'](_0x5e43b8[_0x60f6('0x4b')],[_0x60f6('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x1bd283,null))[_0x60f6('0x49')](handleError(_0x1bd283,null));};exports[_0x60f6('0x54')]=function(_0x53f098,_0xb20df0,_0x1209a5){var _0x2125ff={};var _0x4fa20a={};var _0x4de535;var _0x170d47;return db[_0x60f6('0x2d')][_0x60f6('0x51')]({'where':{'id':_0x53f098[_0x60f6('0x44')]['id']}})[_0x60f6('0x26')](handleEntityNotFound(_0xb20df0,null))[_0x60f6('0x26')](function(_0x2b6824){if(_0x2b6824){_0x4de535=_0x2b6824;_0x4fa20a[_0x60f6('0x31')]=_[_0x60f6('0x45')](db[_0x60f6('0x53')][_0x60f6('0x2e')]);_0x4fa20a[_0x60f6('0x32')]=_[_0x60f6('0x45')](_0x53f098[_0x60f6('0x32')]);_0x4fa20a['filters']=_[_0x60f6('0x34')](_0x4fa20a[_0x60f6('0x31')],_0x4fa20a[_0x60f6('0x32')]);_0x2125ff[_0x60f6('0x35')]=_[_0x60f6('0x34')](_0x4fa20a[_0x60f6('0x31')],qs[_0x60f6('0x36')](_0x53f098['query'][_0x60f6('0x36')]));_0x2125ff['attributes']=_0x2125ff[_0x60f6('0x35')][_0x60f6('0x46')]?_0x2125ff[_0x60f6('0x35')]:_0x4fa20a[_0x60f6('0x31')];_0x2125ff[_0x60f6('0x39')]=qs[_0x60f6('0x3a')](_0x53f098[_0x60f6('0x32')][_0x60f6('0x3a')]);_0x2125ff[_0x60f6('0x3b')]=qs[_0x60f6('0x33')](_[_0x60f6('0x3c')](_0x53f098[_0x60f6('0x32')],_0x4fa20a[_0x60f6('0x33')]));if(_0x53f098[_0x60f6('0x32')][_0x60f6('0x3d')]){_0x2125ff[_0x60f6('0x3b')]=_[_0x60f6('0x3e')](_0x2125ff[_0x60f6('0x3b')],{'$or':_[_0x60f6('0x2c')](_0x2125ff[_0x60f6('0x35')],function(_0x1fd7b4){var _0x371fc8={};_0x371fc8[_0x1fd7b4]={'$like':'%'+_0x53f098[_0x60f6('0x32')][_0x60f6('0x3d')]+'%'};return _0x371fc8;})});}_0x2125ff=_['merge']({},_0x2125ff,_0x53f098['options']);return _0x4de535[_0x60f6('0x54')](_0x2125ff);}})['then'](function(_0x42810b){if(_0x42810b){_0x170d47=_0x42810b[_0x60f6('0x46')];if(!_0x53f098[_0x60f6('0x32')][_0x60f6('0x37')](_0x60f6('0x38'))){_0x2125ff[_0x60f6('0x1e')]=qs['limit'](_0x53f098['query'][_0x60f6('0x1e')]);_0x2125ff['offset']=qs[_0x60f6('0x1d')](_0x53f098[_0x60f6('0x32')][_0x60f6('0x1d')]);}return _0x4de535[_0x60f6('0x54')](_0x2125ff);}})[_0x60f6('0x26')](function(_0x4b1178){if(_0x4b1178){return _0x4b1178?{'count':_0x170d47,'rows':_0x4b1178}:null;}})[_0x60f6('0x26')](respondWithResult(_0xb20df0,null))['catch'](handleError(_0xb20df0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f9a958f..f2d3da3 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 _0x455e=['tools_automations','../../config/logger','api','request-promise','path','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x455e,0x169));var _0xe455=function(_0x208d6d,_0x47f7b6){_0x208d6d=_0x208d6d-0x0;var _0x432519=_0x455e[_0x208d6d];return _0x432519;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe455('0x0'))(_0xe455('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe455('0x2'));var fs=require('fs');var path=require(_0xe455('0x3'));var rimraf=require(_0xe455('0x4'));var config=require('../../config/environment');var attributes=require(_0xe455('0x5'));module[_0xe455('0x6')]=function(_0x3f2f08,_0x4ab547){return _0x3f2f08[_0xe455('0x7')](_0xe455('0x8'),attributes,{'tableName':_0xe455('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06db=['api','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash'];(function(_0x38284c,_0x2d7b2d){var _0x3618bf=function(_0x103307){while(--_0x103307){_0x38284c['push'](_0x38284c['shift']());}};_0x3618bf(++_0x2d7b2d);}(_0x06db,0x1c2));var _0xb06d=function(_0x5ed9ca,_0x565f80){_0x5ed9ca=_0x5ed9ca-0x0;var _0x79aa0a=_0x06db[_0x5ed9ca];return _0x79aa0a;};'use strict';var _=require(_0xb06d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb06d('0x1'));var moment=require('moment');var BPromise=require(_0xb06d('0x2'));var rp=require(_0xb06d('0x3'));var fs=require('fs');var path=require(_0xb06d('0x4'));var rimraf=require(_0xb06d('0x5'));var config=require(_0xb06d('0x6'));var attributes=require(_0xb06d('0x7'));module['exports']=function(_0x3841a0,_0x1a3321){return _0x3841a0[_0xb06d('0x8')](_0xb06d('0x9'),attributes,{'tableName':_0xb06d('0xa'),'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 dcddc05..fe37eb5 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 _0x505d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','Automation,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e8082,_0x481707){var _0x58794=function(_0x25fb94){while(--_0x25fb94){_0x3e8082['push'](_0x3e8082['shift']());}};_0x58794(++_0x481707);}(_0x505d,0x93));var _0xd505=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x505d[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('Automation,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('Automation,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});} \ No newline at end of file +var _0x1681=['../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','message','Automation,\x20%s,\x20%s','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1168('0x0'));var BPromise=require(_0x1168('0x1'));var rs=require(_0x1168('0x2'));var fs=require('fs');var Redis=require(_0x1168('0x3'));var db=require(_0x1168('0x4'))['db'];var utils=require(_0x1168('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1168('0x6'));var jayson=require(_0x1168('0x7'));var client=jayson['client'][_0x1168('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d0634,_0x5e6752,_0x27309b){return new BPromise(function(_0x53baca,_0x262f80){return client[_0x1168('0x9')](_0x1d0634,_0x27309b)['then'](function(_0x38096f){logger[_0x1168('0xa')]('Automation,\x20%s,\x20%s',_0x5e6752,_0x1168('0xb'));logger[_0x1168('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x5e6752,'request\x20sent',JSON[_0x1168('0xd')](_0x38096f));if(_0x38096f[_0x1168('0xe')]){if(_0x38096f[_0x1168('0xe')][_0x1168('0xf')]===0x1f4){logger[_0x1168('0xe')]('Automation,\x20%s,\x20%s',_0x5e6752,_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);return _0x262f80(_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);}logger[_0x1168('0xe')]('Automation,\x20%s,\x20%s',_0x5e6752,_0x38096f[_0x1168('0xe')]['message']);return _0x53baca(_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);}else{logger['info'](_0x1168('0x11'),_0x5e6752,_0x1168('0xb'));_0x53baca(_0x38096f['result'][_0x1168('0x10')]);}})['catch'](function(_0x45e07e){logger[_0x1168('0xe')]('Automation,\x20%s,\x20%s',_0x5e6752,_0x45e07e);_0x262f80(_0x45e07e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 78f1c96..9b571fe 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 _0x7bbd=['delete','destroy','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','create','post','put'];(function(_0x4ded50,_0x4a6af3){var _0xa92135=function(_0xe09b41){while(--_0xe09b41){_0x4ded50['push'](_0x4ded50['shift']());}};_0xa92135(++_0x4a6af3);}(_0x7bbd,0x11f));var _0xd7bb=function(_0x550ac7,_0x1b692e){_0x550ac7=_0x550ac7-0x0;var _0x18910b=_0x7bbd[_0x550ac7];return _0x18910b;};'use strict';var multer=require(_0xd7bb('0x0'));var util=require(_0xd7bb('0x1'));var path=require(_0xd7bb('0x2'));var timeout=require(_0xd7bb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7bb('0x4'));var config=require(_0xd7bb('0x5'));var controller=require('./automation.controller');router[_0xd7bb('0x6')]('/',auth[_0xd7bb('0x7')](),controller[_0xd7bb('0x8')]);router[_0xd7bb('0x6')](_0xd7bb('0x9'),auth[_0xd7bb('0x7')](),controller[_0xd7bb('0xa')]);router[_0xd7bb('0x6')](_0xd7bb('0xb'),auth[_0xd7bb('0x7')](),controller['getConditions']);router[_0xd7bb('0x6')](_0xd7bb('0xc'),auth[_0xd7bb('0x7')](),controller[_0xd7bb('0xd')]);router['post']('/',auth[_0xd7bb('0x7')](),controller[_0xd7bb('0xe')]);router['post']('/:id/conditions',auth[_0xd7bb('0x7')](),controller['addConditions']);router[_0xd7bb('0xf')]('/:id/actions',auth[_0xd7bb('0x7')](),controller['addActions']);router[_0xd7bb('0x10')](_0xd7bb('0x9'),auth[_0xd7bb('0x7')](),controller['update']);router[_0xd7bb('0x11')]('/:id',auth[_0xd7bb('0x7')](),controller[_0xd7bb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x82a7=['./automation.controller','get','isAuthenticated','index','/:id','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x82a7,0x1c4));var _0x782a=function(_0x451cdf,_0x5b3bc5){_0x451cdf=_0x451cdf-0x0;var _0x80051=_0x82a7[_0x451cdf];return _0x80051;};'use strict';var multer=require('multer');var util=require(_0x782a('0x0'));var path=require(_0x782a('0x1'));var timeout=require(_0x782a('0x2'));var express=require(_0x782a('0x3'));var router=express[_0x782a('0x4')]();var fs_extra=require(_0x782a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x782a('0x6'));var config=require(_0x782a('0x7'));var controller=require(_0x782a('0x8'));router[_0x782a('0x9')]('/',auth[_0x782a('0xa')](),controller[_0x782a('0xb')]);router[_0x782a('0x9')](_0x782a('0xc'),auth[_0x782a('0xa')](),controller['show']);router[_0x782a('0x9')]('/:id/conditions',auth[_0x782a('0xa')](),controller['getConditions']);router['get'](_0x782a('0xd'),auth['isAuthenticated'](),controller[_0x782a('0xe')]);router[_0x782a('0xf')]('/',auth['isAuthenticated'](),controller[_0x782a('0x10')]);router['post'](_0x782a('0x11'),auth[_0x782a('0xa')](),controller[_0x782a('0x12')]);router[_0x782a('0xf')](_0x782a('0xd'),auth[_0x782a('0xa')](),controller[_0x782a('0x13')]);router[_0x782a('0x14')](_0x782a('0xc'),auth[_0x782a('0xa')](),controller[_0x782a('0x15')]);router[_0x782a('0x16')](_0x782a('0xc'),auth[_0x782a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 2fdc62f..a01728e 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 _0x8d87=['exports','STRING','name','ENUM','ivr','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,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#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','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\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\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x2e6369,_0x385ab2){var _0x5b70ee=function(_0x4089dd){while(--_0x4089dd){_0x2e6369['push'](_0x2e6369['shift']());}};_0x5b70ee(++_0x385ab2);}(_0x8d87,0x1ac));var _0x78d8=function(_0x332d5c,_0x4a2336){_0x332d5c=_0x332d5c-0x0;var _0x47448d=_0x8d87[_0x332d5c];return _0x47448d;};'use strict';var Sequelize=require(_0x78d8('0x0'));module[_0x78d8('0x1')]={'name':{'type':Sequelize[_0x78d8('0x2')],'unique':_0x78d8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x78d8('0x4')](_0x78d8('0x5')),'allowNull':![],'defaultValue':_0x78d8('0x5')},'description':{'type':Sequelize[_0x78d8('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x78d8('0x6')},'limitCalls':{'type':Sequelize[_0x78d8('0x7')](0x4)[_0x78d8('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x78d8('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x78d8('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x78d8('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x78d8('0x10')},'dialTimezone':{'type':Sequelize[_0x78d8('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x78d8('0x2')],'defaultValue':_0x78d8('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x78d8('0x4')](_0x78d8('0x12'),_0x78d8('0x13'),_0x78d8('0x14')),'defaultValue':_0x78d8('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x78d8('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x78d8('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x78d8('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x78d8('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x78d8('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x78d8('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x78d8('0x7')](0x9)[_0x78d8('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x78d8('0x7')](0x9)[_0x78d8('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x78d8('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x78d8('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x78d8('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x78d8('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x78d8('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x78d8('0x4')](_0x78d8('0x1d'),_0x78d8('0x1e')),'defaultValue':_0x78d8('0x1d')},'dialPrefix':{'type':Sequelize[_0x78d8('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x78d8('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x26')}}; \ No newline at end of file +var _0x968a=['Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','never','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\x20Maximum\x20Word\x20Length','DESC','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\x20(min:1,\x20max:999)','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)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x968a,0x1da));var _0xa968=function(_0x5da545,_0x408e18){_0x5da545=_0x5da545-0x0;var _0x46aaa6=_0x968a[_0x5da545];return _0x46aaa6;};'use strict';var Sequelize=require('sequelize');module[_0xa968('0x0')]={'name':{'type':Sequelize[_0xa968('0x1')],'unique':_0xa968('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa968('0x3')),'allowNull':![],'defaultValue':_0xa968('0x3')},'description':{'type':Sequelize[_0xa968('0x1')]},'active':{'type':Sequelize[_0xa968('0x4')],'defaultValue':0x0,'comment':_0xa968('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xa968('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa968('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa968('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa968('0x8')](0x3)[_0xa968('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa968('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa968('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa968('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa968('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa968('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa968('0x8')](0x5)[_0xa968('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa968('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa968('0x8')](0x3)[_0xa968('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa968('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa968('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa968('0x8')](0x3)[_0xa968('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa968('0xd')},'dialTimezone':{'type':Sequelize[_0xa968('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa968('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xa968('0xe')]('always',_0xa968('0xf'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xa968('0x4')],'defaultValue':0x0,'comment':_0xa968('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xa968('0x8')](0x9)[_0xa968('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa968('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xa968('0x8')](0x9)[_0xa968('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa968('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa968('0x8')](0x9)[_0xa968('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa968('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa968('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa968('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xa968('0x8')](0x9)[_0xa968('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa968('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa968('0x8')](0x9)[_0xa968('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa968('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa968('0x8')](0x5)[_0xa968('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa968('0x8')](0x9)[_0xa968('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa968('0x17')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xa968('0x18'),_0xa968('0x19')),'defaultValue':_0xa968('0x18')},'dialPrefix':{'type':Sequelize[_0xa968('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa968('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa968('0x1a')},'dialCutDigit':{'type':Sequelize[_0xa968('0x8')](0x3)[_0xa968('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa968('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa968('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa968('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa968('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa968('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xa968('0x8')](0x3)[_0xa968('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa968('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xa968('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa968('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa968('0x8')](0x3)[_0xa968('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa968('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa968('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa968('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa968('0x8')](0x5)[_0xa968('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa968('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa968('0x8')](0x3)[_0xa968('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa968('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa968('0x8')](0x5)[_0xa968('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa968('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 39f0e85..757a958 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 _0xc584=['cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','sequelize','push','removeLists','getBlackLists','CmList','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','all','removeBlackLists','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','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','count','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','getHoppers','findOne','CmHopper','sort','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','pick','CmHopperBlack','getLists','addLists','format','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','field','phone','NOW()','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId\x20=\x20?'];(function(_0x4e061e,_0x2c72e9){var _0xda83dc=function(_0x1fc8de){while(--_0x1fc8de){_0x4e061e['push'](_0x4e061e['shift']());}};_0xda83dc(++_0x2c72e9);}(_0xc584,0xa8));var _0x4c58=function(_0x1e7ead,_0x7f6227){_0x1e7ead=_0x1e7ead-0x0;var _0x3912b2=_0xc584[_0x1e7ead];return _0x3912b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c58('0x0'));var zipdir=require(_0x4c58('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4c58('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4c58('0x3'));var util=require(_0x4c58('0x4'));var path=require(_0x4c58('0x5'));var sox=require('sox');var csv=require(_0x4c58('0x6'));var ejs=require(_0x4c58('0x7'));var fs=require('fs');var fs_extra=require(_0x4c58('0x8'));var _=require(_0x4c58('0x9'));var squel=require(_0x4c58('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c58('0x6'));var querystring=require(_0x4c58('0xb'));var Papa=require(_0x4c58('0xc'));var Redis=require(_0x4c58('0xd'));var authService=require(_0x4c58('0xe'));var qs=require(_0x4c58('0xf'));var as=require(_0x4c58('0x10'));var hardwareService=require(_0x4c58('0x11'));var logger=require(_0x4c58('0x12'))(_0x4c58('0x13'));var utils=require(_0x4c58('0x14'));var config=require(_0x4c58('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28f052,_0x4c17de){_0x4c17de=_0x4c17de||0xcc;return function(_0x821dba){if(_0x821dba){return _0x28f052[_0x4c58('0x16')](_0x4c17de);}return _0x28f052[_0x4c58('0x17')](_0x4c17de)[_0x4c58('0x18')]();};}function respondWithResult(_0x308372,_0x442bf9){_0x442bf9=_0x442bf9||0xc8;return function(_0x5a9e76){if(_0x5a9e76){return _0x308372[_0x4c58('0x17')](_0x442bf9)['json'](_0x5a9e76);}};}function respondWithFilteredResult(_0x4fa114,_0x5990c3){return function(_0x1831e4){if(_0x1831e4){var _0x14af92=typeof _0x5990c3[_0x4c58('0x19')]===_0x4c58('0x1a')&&typeof _0x5990c3['limit']===_0x4c58('0x1a');var _0x26db37=_0x1831e4[_0x4c58('0x1b')];var _0x1dc590=_0x14af92?0x0:_0x5990c3[_0x4c58('0x19')];var _0x4b72cc=_0x14af92?_0x1831e4[_0x4c58('0x1b')]:_0x5990c3[_0x4c58('0x19')]+_0x5990c3['limit'];var _0x26631e;if(_0x4b72cc>=_0x26db37){_0x4b72cc=_0x26db37;_0x26631e=0xc8;}else{_0x26631e=0xce;}_0x4fa114[_0x4c58('0x17')](_0x26631e);return _0x4fa114[_0x4c58('0x1c')](_0x4c58('0x1d'),_0x1dc590+'-'+_0x4b72cc+'/'+_0x26db37)[_0x4c58('0x1e')](_0x1831e4);}return null;};}function patchUpdates(_0x46876f){return function(_0x5793d2){try{jsonpatch[_0x4c58('0x1f')](_0x5793d2,_0x46876f,!![]);}catch(_0x408e30){return BPromise[_0x4c58('0x20')](_0x408e30);}return _0x5793d2[_0x4c58('0x21')]();};}function saveUpdates(_0xdd2d81,_0x4f189f){return function(_0x101d23){if(_0x101d23){return _0x101d23['update'](_0xdd2d81)[_0x4c58('0x22')](function(_0x368034){return _0x368034;});}return null;};}function removeEntity(_0x53ab2d,_0x3062fb){return function(_0x386c98){if(_0x386c98){return _0x386c98[_0x4c58('0x23')]()['then'](function(){var _0x159bf8=_0x386c98[_0x4c58('0x24')]({'plain':!![]});var _0x3f7de6=_0x4c58('0x25');return db[_0x4c58('0x26')]['destroy']({'where':{'type':_0x3f7de6,'resourceId':_0x159bf8['id']}})[_0x4c58('0x22')](function(){return _0x386c98;});})[_0x4c58('0x22')](function(){_0x53ab2d[_0x4c58('0x17')](0xcc)[_0x4c58('0x18')]();});}};}function handleEntityNotFound(_0x317409,_0x15efd1){return function(_0x38b2de){if(!_0x38b2de){_0x317409[_0x4c58('0x16')](0x194);}return _0x38b2de;};}function handleError(_0x5b5b4e,_0x33a731){_0x33a731=_0x33a731||0x1f4;return function(_0x10b72c){logger[_0x4c58('0x27')](_0x10b72c[_0x4c58('0x28')]);if(_0x10b72c[_0x4c58('0x29')]){delete _0x10b72c[_0x4c58('0x29')];}_0x5b5b4e[_0x4c58('0x17')](_0x33a731)[_0x4c58('0x2a')](_0x10b72c);};}exports[_0x4c58('0x2b')]=function(_0x437975,_0x13cf99){var _0x3c08a7={},_0x3ec02a={},_0x440ee4={'count':0x0,'rows':[]};var _0x1531f1=_[_0x4c58('0x2c')](db[_0x4c58('0x2d')][_0x4c58('0x2e')],function(_0x55fbf8){return{'name':_0x55fbf8['fieldName'],'type':_0x55fbf8['type'][_0x4c58('0x2f')]};});_0x3ec02a['model']=_[_0x4c58('0x2c')](_0x1531f1,'name');_0x3ec02a[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x437975[_0x4c58('0x30')]);_0x3ec02a['filters']=_[_0x4c58('0x32')](_0x3ec02a[_0x4c58('0x33')],_0x3ec02a[_0x4c58('0x30')]);_0x3c08a7[_0x4c58('0x34')]=_[_0x4c58('0x32')](_0x3ec02a[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x437975[_0x4c58('0x30')]['fields']));_0x3c08a7['attributes']=_0x3c08a7['attributes'][_0x4c58('0x36')]?_0x3c08a7[_0x4c58('0x34')]:_0x3ec02a[_0x4c58('0x33')];if(!_0x437975['query'][_0x4c58('0x37')](_0x4c58('0x38'))){_0x3c08a7[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x437975['query'][_0x4c58('0x39')]);_0x3c08a7[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x437975[_0x4c58('0x30')][_0x4c58('0x19')]);}_0x3c08a7[_0x4c58('0x3a')]=qs['sort'](_0x437975[_0x4c58('0x30')]['sort']);_0x3c08a7['where']=qs[_0x4c58('0x3b')](_['pick'](_0x437975[_0x4c58('0x30')],_0x3ec02a[_0x4c58('0x3b')]),_0x1531f1);if(_0x437975[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x3c08a7[_0x4c58('0x3d')]=_['merge'](_0x3c08a7[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x1531f1,function(_0x511cfd){if(_0x511cfd['type']!==_0x4c58('0x3e')){var _0xb59516={};_0xb59516[_0x511cfd[_0x4c58('0x29')]]={'$like':'%'+_0x437975['query']['filter']+'%'};return _0xb59516;}})});}_0x3c08a7=_['merge']({},_0x3c08a7,_0x437975[_0x4c58('0x3f')]);var _0x5797ae={'where':_0x3c08a7[_0x4c58('0x3d')]};return db['Campaign'][_0x4c58('0x1b')](_0x5797ae)[_0x4c58('0x22')](function(_0x3b74b4){_0x440ee4[_0x4c58('0x1b')]=_0x3b74b4;if(_0x437975[_0x4c58('0x30')][_0x4c58('0x40')]){_0x3c08a7[_0x4c58('0x41')]=[{'all':!![]}];}return db[_0x4c58('0x2d')][_0x4c58('0x42')](_0x3c08a7);})[_0x4c58('0x22')](function(_0x1f8d23){_0x440ee4[_0x4c58('0x43')]=_0x1f8d23;return _0x440ee4;})[_0x4c58('0x22')](respondWithFilteredResult(_0x13cf99,_0x3c08a7))[_0x4c58('0x44')](handleError(_0x13cf99,null));};exports[_0x4c58('0x45')]=function(_0x41c8ab,_0x5c1653){var _0x5d19a0={'raw':![],'where':{'id':_0x41c8ab[_0x4c58('0x46')]['id']}},_0x54ff5d={};_0x54ff5d['model']=_['keys'](db['Campaign'][_0x4c58('0x2e')]);_0x54ff5d[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x41c8ab[_0x4c58('0x30')]);_0x54ff5d[_0x4c58('0x3b')]=_['intersection'](_0x54ff5d[_0x4c58('0x33')],_0x54ff5d['query']);_0x5d19a0['attributes']=_[_0x4c58('0x32')](_0x54ff5d['model'],qs[_0x4c58('0x35')](_0x41c8ab[_0x4c58('0x30')][_0x4c58('0x35')]));_0x5d19a0['attributes']=_0x5d19a0['attributes']['length']?_0x5d19a0[_0x4c58('0x34')]:_0x54ff5d['model'];if(_0x41c8ab['query'][_0x4c58('0x40')]){_0x5d19a0['include']=[{'all':!![]}];}_0x5d19a0=_[_0x4c58('0x47')]({},_0x5d19a0,_0x41c8ab['options']);return db[_0x4c58('0x2d')]['find'](_0x5d19a0)[_0x4c58('0x22')](handleEntityNotFound(_0x5c1653,null))['then'](respondWithResult(_0x5c1653,null))[_0x4c58('0x44')](handleError(_0x5c1653,null));};exports[_0x4c58('0x48')]=function(_0x47f744,_0x32ad34){return db[_0x4c58('0x2d')]['create'](_0x47f744[_0x4c58('0x49')],{})[_0x4c58('0x22')](function(_0x2ed13b){var _0x465ca3=_0x47f744[_0x4c58('0x4a')][_0x4c58('0x24')]({'plain':!![]});if(!_0x465ca3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x465ca3[_0x4c58('0x4b')]===_0x4c58('0x4a')){var _0x31483f=_0x2ed13b[_0x4c58('0x24')]({'plain':!![]});var _0x374094='IvrCampaigns';return db[_0x4c58('0x4c')][_0x4c58('0x4d')]({'where':{'name':_0x374094,'userProfileId':_0x465ca3[_0x4c58('0x4e')]},'raw':!![]})['then'](function(_0x57c30d){if(_0x57c30d&&_0x57c30d[_0x4c58('0x4f')]===0x0){return db[_0x4c58('0x26')][_0x4c58('0x48')]({'name':_0x31483f['name'],'resourceId':_0x31483f['id'],'type':_0x57c30d[_0x4c58('0x29')],'sectionId':_0x57c30d['id']},{})[_0x4c58('0x22')](function(){return _0x2ed13b;});}else{return _0x2ed13b;}})['catch'](function(_0x5e89f6){logger['error'](_0x4c58('0x50'),_0x5e89f6);throw _0x5e89f6;});}return _0x2ed13b;})[_0x4c58('0x22')](respondWithResult(_0x32ad34,0xc9))[_0x4c58('0x44')](handleError(_0x32ad34,null));};exports[_0x4c58('0x51')]=function(_0x1a8bb4,_0x1fe254){var _0x3db6d6={'where':{'id':_0x1a8bb4['params']['id']}},_0x3c9319={};_0x3c9319[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x2d')][_0x4c58('0x2e')]);_0x3db6d6['attributes']=_['intersection'](_0x3c9319[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x1a8bb4['query'][_0x4c58('0x35')]));_0x3db6d6[_0x4c58('0x34')]=_0x3db6d6['attributes'][_0x4c58('0x36')]?_0x3db6d6['attributes']:_0x3c9319[_0x4c58('0x33')];if(_0x1a8bb4[_0x4c58('0x30')][_0x4c58('0x40')]){_0x3db6d6[_0x4c58('0x41')]=[{'all':!![]}];}_0x3db6d6=_[_0x4c58('0x47')]({},_0x3db6d6,_0x1a8bb4[_0x4c58('0x3f')]);return db[_0x4c58('0x2d')][_0x4c58('0x4d')](_0x3db6d6)['then'](handleEntityNotFound(_0x1fe254,null))['then'](function(_0x56ac40){if(_0x56ac40){var _0x545568=_0x56ac40[_0x4c58('0x24')]({'plain':!![]});_0x545568=qs[_0x4c58('0x52')](_0x545568,['id','createdAt',_0x4c58('0x53')]);_0x1a8bb4['body']=_[_0x4c58('0x52')](_0x1a8bb4[_0x4c58('0x49')],['id',_0x4c58('0x54'),_0x4c58('0x53')]);return db['Campaign'][_0x4c58('0x48')](_[_0x4c58('0x47')](_0x545568,_0x1a8bb4[_0x4c58('0x49')]),{'include':_0x1a8bb4[_0x4c58('0x30')][_0x4c58('0x40')]?[{'all':!![]}]:undefined})[_0x4c58('0x22')](function(_0x2b1b70){var _0x312bfd=_0x1a8bb4[_0x4c58('0x4a')]['get']({'plain':!![]});if(!_0x312bfd)throw new Error(_0x4c58('0x55'));if(_0x312bfd[_0x4c58('0x4b')]===_0x4c58('0x4a')){var _0x537054=_0x2b1b70[_0x4c58('0x24')]({'plain':!![]});var _0x3bce6e=_0x4c58('0x25');return db[_0x4c58('0x4c')][_0x4c58('0x4d')]({'where':{'name':_0x3bce6e,'userProfileId':_0x312bfd[_0x4c58('0x4e')]},'raw':!![]})[_0x4c58('0x22')](function(_0xe509e2){if(_0xe509e2&&_0xe509e2[_0x4c58('0x4f')]===0x0){return db[_0x4c58('0x26')][_0x4c58('0x48')]({'name':_0x537054[_0x4c58('0x29')],'resourceId':_0x537054['id'],'type':_0xe509e2[_0x4c58('0x29')],'sectionId':_0xe509e2['id']},{})['then'](function(){return _0x2b1b70;});}else{return _0x2b1b70;}})[_0x4c58('0x44')](function(_0x2cd761){logger[_0x4c58('0x27')](_0x4c58('0x50'),_0x2cd761);throw _0x2cd761;});}return _0x2b1b70;});}})[_0x4c58('0x22')](respondWithResult(_0x1fe254,0xc9))[_0x4c58('0x44')](handleError(_0x1fe254,null));};exports[_0x4c58('0x56')]=function(_0x5c8e31,_0xfb4b0f){if(_0x5c8e31[_0x4c58('0x49')]['id']){delete _0x5c8e31[_0x4c58('0x49')]['id'];}return db['Campaign'][_0x4c58('0x4d')]({'where':{'id':_0x5c8e31[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0xfb4b0f,null))[_0x4c58('0x22')](saveUpdates(_0x5c8e31[_0x4c58('0x49')],null))[_0x4c58('0x22')](respondWithResult(_0xfb4b0f,null))['catch'](handleError(_0xfb4b0f,null));};exports['destroy']=function(_0x4aa070,_0x5c3d80){return db[_0x4c58('0x2d')]['find']({'where':{'id':_0x4aa070[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x5c3d80,null))[_0x4c58('0x22')](removeEntity(_0x5c3d80,null))[_0x4c58('0x44')](handleError(_0x5c3d80,null));};exports[_0x4c58('0x57')]=function(_0x20ce29,_0x2cf937,_0x21f92e){var _0x151b3a={'raw':!![],'where':{}};var _0x1ba8ba={};var _0x7fa9eb={'count':0x0,'rows':[]};return db[_0x4c58('0x2d')][_0x4c58('0x58')]({'where':{'id':_0x20ce29[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x2cf937,null))['then'](function(_0x9b38fd){if(_0x9b38fd){_0x1ba8ba[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x59')][_0x4c58('0x2e')]);_0x1ba8ba[_0x4c58('0x30')]=_['keys'](_0x20ce29['query']);_0x1ba8ba[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x1ba8ba[_0x4c58('0x33')],_0x1ba8ba[_0x4c58('0x30')]);_0x151b3a['attributes']=_['intersection'](_0x1ba8ba[_0x4c58('0x33')],qs['fields'](_0x20ce29[_0x4c58('0x30')][_0x4c58('0x35')]));_0x151b3a['attributes']=_0x151b3a[_0x4c58('0x34')][_0x4c58('0x36')]?_0x151b3a['attributes']:_0x1ba8ba['model'];if(!_0x20ce29[_0x4c58('0x30')]['hasOwnProperty'](_0x4c58('0x38'))){_0x151b3a['limit']=qs[_0x4c58('0x39')](_0x20ce29['query'][_0x4c58('0x39')]);_0x151b3a[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x20ce29[_0x4c58('0x30')][_0x4c58('0x19')]);}_0x151b3a[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x20ce29[_0x4c58('0x30')][_0x4c58('0x5a')]);_0x151b3a[_0x4c58('0x3d')]=qs['filters'](_['pick'](_0x20ce29[_0x4c58('0x30')],_0x1ba8ba[_0x4c58('0x3b')]));_0x151b3a[_0x4c58('0x3d')][_0x4c58('0x5b')]=_0x9b38fd['id'];if(_0x20ce29['query'][_0x4c58('0x3c')]){_0x151b3a['where']=_[_0x4c58('0x47')](_0x151b3a[_0x4c58('0x3d')],{'$or':_['map'](_0x151b3a[_0x4c58('0x34')],function(_0x1e02aa){var _0x3ce1ed={};_0x3ce1ed[_0x1e02aa]={'$like':'%'+_0x20ce29['query'][_0x4c58('0x3c')]+'%'};return _0x3ce1ed;})});}_0x151b3a=_[_0x4c58('0x47')]({},_0x151b3a,_0x20ce29[_0x4c58('0x3f')]);return db['CmHopper'][_0x4c58('0x1b')]({'where':_0x151b3a[_0x4c58('0x3d')]})[_0x4c58('0x22')](function(_0x121177){_0x7fa9eb[_0x4c58('0x1b')]=_0x121177;if(_0x20ce29[_0x4c58('0x30')][_0x4c58('0x40')]){_0x151b3a[_0x4c58('0x41')]=[{'all':!![]}];}return db[_0x4c58('0x59')]['findAll'](_0x151b3a);})[_0x4c58('0x22')](function(_0x36ed27){_0x7fa9eb[_0x4c58('0x43')]=_0x36ed27;return _0x7fa9eb;});}})[_0x4c58('0x22')](respondWithFilteredResult(_0x2cf937,_0x151b3a))['catch'](handleError(_0x2cf937,null));};exports[_0x4c58('0x5c')]=function(_0x2a56aa,_0x20b43d,_0x88f08e){var _0x2c4f16={'raw':!![],'where':{}};var _0x59ab28={};var _0xf7ea8e={'count':0x0,'rows':[]};return db[_0x4c58('0x2d')]['findOne']({'where':{'id':_0x2a56aa[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x20b43d,null))[_0x4c58('0x22')](function(_0x1fda5d){if(_0x1fda5d){_0x59ab28[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x5d')][_0x4c58('0x2e')]);_0x59ab28[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x2a56aa[_0x4c58('0x30')]);_0x59ab28[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x59ab28[_0x4c58('0x33')],_0x59ab28['query']);_0x2c4f16[_0x4c58('0x34')]=_['intersection'](_0x59ab28[_0x4c58('0x33')],qs['fields'](_0x2a56aa['query'][_0x4c58('0x35')]));_0x2c4f16[_0x4c58('0x34')]=_0x2c4f16[_0x4c58('0x34')]['length']?_0x2c4f16[_0x4c58('0x34')]:_0x59ab28[_0x4c58('0x33')];if(!_0x2a56aa[_0x4c58('0x30')]['hasOwnProperty'](_0x4c58('0x38'))){_0x2c4f16['limit']=qs['limit'](_0x2a56aa['query'][_0x4c58('0x39')]);_0x2c4f16[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x2a56aa[_0x4c58('0x30')]['offset']);}_0x2c4f16['order']=qs[_0x4c58('0x5a')](_0x2a56aa[_0x4c58('0x30')][_0x4c58('0x5a')]);_0x2c4f16['where']=qs[_0x4c58('0x3b')](_['pick'](_0x2a56aa['query'],_0x59ab28['filters']));_0x2c4f16[_0x4c58('0x3d')]['CampaignId']=_0x1fda5d['id'];if(_0x2a56aa[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x2c4f16[_0x4c58('0x3d')]=_['merge'](_0x2c4f16[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x2c4f16[_0x4c58('0x34')],function(_0x3d0101){var _0x207e08={};_0x207e08[_0x3d0101]={'$like':'%'+_0x2a56aa['query'][_0x4c58('0x3c')]+'%'};return _0x207e08;})});}_0x2c4f16=_[_0x4c58('0x47')]({},_0x2c4f16,_0x2a56aa[_0x4c58('0x3f')]);return db[_0x4c58('0x5d')][_0x4c58('0x1b')]({'where':_0x2c4f16['where']})['then'](function(_0x5ce4e9){_0xf7ea8e[_0x4c58('0x1b')]=_0x5ce4e9;if(_0x2a56aa[_0x4c58('0x30')][_0x4c58('0x40')]){_0x2c4f16[_0x4c58('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4c58('0x42')](_0x2c4f16);})[_0x4c58('0x22')](function(_0x582d90){_0xf7ea8e[_0x4c58('0x43')]=_0x582d90;return _0xf7ea8e;});}})['then'](respondWithFilteredResult(_0x20b43d,_0x2c4f16))[_0x4c58('0x44')](handleError(_0x20b43d,null));};exports[_0x4c58('0x5e')]=function(_0x1cfd1a,_0x4c9a4b,_0x310ad7){var _0x3b4662={'raw':!![],'where':{}};var _0x45cf5e={};var _0x242a49={'count':0x0,'rows':[]};return db[_0x4c58('0x2d')][_0x4c58('0x58')]({'where':{'id':_0x1cfd1a[_0x4c58('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c9a4b,null))[_0x4c58('0x22')](function(_0x11b98d){if(_0x11b98d){_0x45cf5e[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x5f')]['rawAttributes']);_0x45cf5e[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x1cfd1a['query']);_0x45cf5e[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x45cf5e[_0x4c58('0x33')],_0x45cf5e['query']);_0x3b4662['attributes']=_[_0x4c58('0x32')](_0x45cf5e['model'],qs[_0x4c58('0x35')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x35')]));_0x3b4662[_0x4c58('0x34')]=_0x3b4662['attributes'][_0x4c58('0x36')]?_0x3b4662['attributes']:_0x45cf5e[_0x4c58('0x33')];if(!_0x1cfd1a['query'][_0x4c58('0x37')](_0x4c58('0x38'))){_0x3b4662['limit']=qs[_0x4c58('0x39')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x39')]);_0x3b4662[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x19')]);}_0x3b4662[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x5a')]);_0x3b4662['where']=qs[_0x4c58('0x3b')](_[_0x4c58('0x60')](_0x1cfd1a[_0x4c58('0x30')],_0x45cf5e['filters']));_0x3b4662[_0x4c58('0x3d')][_0x4c58('0x5b')]=_0x11b98d['id'];if(_0x1cfd1a['query'][_0x4c58('0x3c')]){_0x3b4662[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x3b4662[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x3b4662[_0x4c58('0x34')],function(_0xbf4110){var _0x25c25a={};_0x25c25a[_0xbf4110]={'$like':'%'+_0x1cfd1a['query'][_0x4c58('0x3c')]+'%'};return _0x25c25a;})});}_0x3b4662=_[_0x4c58('0x47')]({},_0x3b4662,_0x1cfd1a['options']);return db['CmHopperFinal'][_0x4c58('0x1b')]({'where':_0x3b4662[_0x4c58('0x3d')]})[_0x4c58('0x22')](function(_0x6029d4){_0x242a49[_0x4c58('0x1b')]=_0x6029d4;if(_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x40')]){_0x3b4662[_0x4c58('0x41')]=[{'all':!![]}];}return db[_0x4c58('0x5f')][_0x4c58('0x42')](_0x3b4662);})['then'](function(_0x447a2b){_0x242a49[_0x4c58('0x43')]=_0x447a2b;return _0x242a49;});}})[_0x4c58('0x22')](respondWithFilteredResult(_0x4c9a4b,_0x3b4662))[_0x4c58('0x44')](handleError(_0x4c9a4b,null));};exports['getHopperBlacks']=function(_0x3acdc1,_0x1ac09b,_0x419cc4){var _0x5dffa1={'raw':!![],'where':{}};var _0x5afdca={};var _0x5a7eac={'count':0x0,'rows':[]};return db['Campaign'][_0x4c58('0x58')]({'where':{'id':_0x3acdc1[_0x4c58('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ac09b,null))['then'](function(_0x37e5cf){if(_0x37e5cf){_0x5afdca['model']=_[_0x4c58('0x31')](db['CmHopperBlack'][_0x4c58('0x2e')]);_0x5afdca[_0x4c58('0x30')]=_['keys'](_0x3acdc1[_0x4c58('0x30')]);_0x5afdca['filters']=_['intersection'](_0x5afdca[_0x4c58('0x33')],_0x5afdca[_0x4c58('0x30')]);_0x5dffa1[_0x4c58('0x34')]=_[_0x4c58('0x32')](_0x5afdca[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x3acdc1[_0x4c58('0x30')][_0x4c58('0x35')]));_0x5dffa1[_0x4c58('0x34')]=_0x5dffa1[_0x4c58('0x34')]['length']?_0x5dffa1[_0x4c58('0x34')]:_0x5afdca['model'];if(!_0x3acdc1[_0x4c58('0x30')]['hasOwnProperty'](_0x4c58('0x38'))){_0x5dffa1[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x3acdc1[_0x4c58('0x30')][_0x4c58('0x39')]);_0x5dffa1[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x3acdc1['query'][_0x4c58('0x19')]);}_0x5dffa1[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x3acdc1[_0x4c58('0x30')]['sort']);_0x5dffa1['where']=qs[_0x4c58('0x3b')](_[_0x4c58('0x60')](_0x3acdc1[_0x4c58('0x30')],_0x5afdca[_0x4c58('0x3b')]));_0x5dffa1['where'][_0x4c58('0x5b')]=_0x37e5cf['id'];if(_0x3acdc1[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x5dffa1[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x5dffa1['where'],{'$or':_[_0x4c58('0x2c')](_0x5dffa1['attributes'],function(_0x3f9eb6){var _0x562a39={};_0x562a39[_0x3f9eb6]={'$like':'%'+_0x3acdc1['query'][_0x4c58('0x3c')]+'%'};return _0x562a39;})});}_0x5dffa1=_[_0x4c58('0x47')]({},_0x5dffa1,_0x3acdc1[_0x4c58('0x3f')]);return db['CmHopperBlack'][_0x4c58('0x1b')]({'where':_0x5dffa1[_0x4c58('0x3d')]})[_0x4c58('0x22')](function(_0x2d9003){_0x5a7eac[_0x4c58('0x1b')]=_0x2d9003;if(_0x3acdc1['query'][_0x4c58('0x40')]){_0x5dffa1['include']=[{'all':!![]}];}return db[_0x4c58('0x61')][_0x4c58('0x42')](_0x5dffa1);})[_0x4c58('0x22')](function(_0x113c47){_0x5a7eac[_0x4c58('0x43')]=_0x113c47;return _0x5a7eac;});}})[_0x4c58('0x22')](respondWithFilteredResult(_0x1ac09b,_0x5dffa1))['catch'](handleError(_0x1ac09b,null));};exports[_0x4c58('0x62')]=function(_0x1956aa,_0x3630a7,_0x2a4ec3){var _0x1d8a34={};var _0x1cb289={};var _0x389612;var _0x24679d;return db[_0x4c58('0x2d')][_0x4c58('0x58')]({'where':{'id':_0x1956aa['params']['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x3630a7,null))['then'](function(_0x4a7207){if(_0x4a7207){_0x389612=_0x4a7207;_0x1cb289[_0x4c58('0x33')]=_[_0x4c58('0x31')](db['CmList'][_0x4c58('0x2e')]);_0x1cb289[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x1956aa['query']);_0x1cb289[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x1cb289[_0x4c58('0x33')],_0x1cb289[_0x4c58('0x30')]);_0x1d8a34[_0x4c58('0x34')]=_['intersection'](_0x1cb289['model'],qs[_0x4c58('0x35')](_0x1956aa[_0x4c58('0x30')]['fields']));_0x1d8a34[_0x4c58('0x34')]=_0x1d8a34[_0x4c58('0x34')]['length']?_0x1d8a34['attributes']:_0x1cb289['model'];_0x1d8a34[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x1956aa['query'][_0x4c58('0x5a')]);_0x1d8a34[_0x4c58('0x3d')]=qs[_0x4c58('0x3b')](_[_0x4c58('0x60')](_0x1956aa[_0x4c58('0x30')],_0x1cb289[_0x4c58('0x3b')]));if(_0x1956aa['query'][_0x4c58('0x3c')]){_0x1d8a34[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x1d8a34[_0x4c58('0x3d')],{'$or':_['map'](_0x1d8a34[_0x4c58('0x34')],function(_0x3e0335){var _0x27d6c8={};_0x27d6c8[_0x3e0335]={'$like':'%'+_0x1956aa[_0x4c58('0x30')][_0x4c58('0x3c')]+'%'};return _0x27d6c8;})});}_0x1d8a34=_[_0x4c58('0x47')]({},_0x1d8a34,_0x1956aa[_0x4c58('0x3f')]);return _0x389612[_0x4c58('0x62')](_0x1d8a34);}})['then'](function(_0x6c2f85){if(_0x6c2f85){_0x24679d=_0x6c2f85[_0x4c58('0x36')];if(!_0x1956aa[_0x4c58('0x30')][_0x4c58('0x37')](_0x4c58('0x38'))){_0x1d8a34[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x1956aa[_0x4c58('0x30')][_0x4c58('0x39')]);_0x1d8a34[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x1956aa[_0x4c58('0x30')][_0x4c58('0x19')]);}return _0x389612[_0x4c58('0x62')](_0x1d8a34);}})[_0x4c58('0x22')](function(_0x1f4ff9){if(_0x1f4ff9){return _0x1f4ff9?{'count':_0x24679d,'rows':_0x1f4ff9}:null;}})[_0x4c58('0x22')](respondWithResult(_0x3630a7,null))['catch'](handleError(_0x3630a7,null));};exports[_0x4c58('0x63')]=function(_0x19f318,_0x45a0f3,_0x352681){var _0x410acd,_0x2bb505;var _0x35edc2=[];var _0x1a5ad2=moment()[_0x4c58('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x4c58('0x2d')][_0x4c58('0x4d')]({'where':{'id':_0x19f318['params']['id']}})['then'](handleEntityNotFound(_0x45a0f3,null))[_0x4c58('0x22')](function(_0x2f2b6a){if(_0x2f2b6a){_0x2bb505=_0x2f2b6a;return _0x2f2b6a[_0x4c58('0x63')](_0x19f318['body'][_0x4c58('0x65')],_[_0x4c58('0x52')](_0x19f318[_0x4c58('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0x23c4a0){var _0x576884;var _0x185288;_0x410acd=_0x23c4a0||[];var _0xf292b6=[];if(_0x23c4a0){for(var _0x461115=0x0;_0x461115<_0x23c4a0['length'];_0x461115+=0x1){var _0x10ae6e=_0x23c4a0[_0x461115][_0x4c58('0x24')]({'plain':!![]});_0x2bb505[_0x4c58('0x66')]=_0x19f318[_0x4c58('0x49')]['dialCheckDuplicateType']?_0x19f318[_0x4c58('0x49')]['dialCheckDuplicateType']:_0x2bb505[_0x4c58('0x66')];switch(_0x2bb505[_0x4c58('0x66')]){case'always':_0x576884=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x69'))[_0x4c58('0x6a')](['phone',_0x4c58('0x6b'),_0x4c58('0x6c'),'ListId',_0x4c58('0x5b'),_0x4c58('0x54'),_0x4c58('0x53')],squel['select']()[_0x4c58('0x6d')](_0x4c58('0x6e'),_0x4c58('0x6e'))[_0x4c58('0x6d')](_0x4c58('0x6f'),'scheduledAt')[_0x4c58('0x6d')]('id','ContactId')['field'](_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')](),_0x4c58('0x72'))['field'](_0x19f318[_0x4c58('0x46')]['id'][_0x4c58('0x71')](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27','updatedAt')['from'](_0x4c58('0x73'))[_0x4c58('0x3d')](_0x4c58('0x74'))[_0x4c58('0x3d')]('ListId\x20=\x20?',_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())[_0x4c58('0x3d')](_0x4c58('0x75'))['where'](_0x4c58('0x76'),squel[_0x4c58('0x77')]()['field'](_0x4c58('0x78'))[_0x4c58('0x79')](_0x4c58('0x7a'))[_0x4c58('0x3d')](_0x4c58('0x7b'),_0x19f318[_0x4c58('0x46')]['id']['toString']()))[_0x4c58('0x3d')](_0x4c58('0x76'),squel['select']()[_0x4c58('0x6d')]('COALESCE(phone,\x27\x27)')[_0x4c58('0x79')](_0x4c58('0x69'))[_0x4c58('0x3d')]('CampaignId\x20=\x20?',_0x19f318[_0x4c58('0x46')]['id'][_0x4c58('0x71')]())))[_0x4c58('0x71')]();break;case'onlyIfOpen':_0x576884=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x69'))[_0x4c58('0x6a')]([_0x4c58('0x6e'),_0x4c58('0x6b'),_0x4c58('0x6c'),_0x4c58('0x72'),_0x4c58('0x5b'),'createdAt','updatedAt'],squel[_0x4c58('0x77')]()['field']('phone',_0x4c58('0x6e'))['field']('NOW()',_0x4c58('0x6b'))[_0x4c58('0x6d')]('id',_0x4c58('0x6c'))['field'](_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')](),_0x4c58('0x72'))[_0x4c58('0x6d')](_0x19f318[_0x4c58('0x46')]['id']['toString'](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x53'))['from'](_0x4c58('0x73'))[_0x4c58('0x3d')](_0x4c58('0x74'))[_0x4c58('0x3d')]('ListId\x20=\x20?',_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())[_0x4c58('0x3d')](_0x4c58('0x75'))[_0x4c58('0x3d')](_0x4c58('0x76'),squel[_0x4c58('0x77')]()[_0x4c58('0x6d')](_0x4c58('0x7c'))[_0x4c58('0x79')]('cm_hopper')[_0x4c58('0x3d')](_0x4c58('0x7b'),_0x19f318['params']['id'][_0x4c58('0x71')]())))['toString']();break;default:_0x576884=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x69'))[_0x4c58('0x6a')]([_0x4c58('0x6e'),'scheduledAt',_0x4c58('0x6c'),'ListId',_0x4c58('0x5b'),_0x4c58('0x54'),_0x4c58('0x53')],squel[_0x4c58('0x77')]()[_0x4c58('0x6d')](_0x4c58('0x6e'),_0x4c58('0x6e'))['field'](_0x4c58('0x6f'),'scheduledAt')['field']('id','ContactId')[_0x4c58('0x6d')](_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')](),_0x4c58('0x72'))[_0x4c58('0x6d')](_0x19f318[_0x4c58('0x46')]['id']['toString'](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x53'))['from'](_0x4c58('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0x4c58('0x3d')](_0x4c58('0x7d'),_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x4c58('0x71')]();}_0x185288=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x7e'))['fromQuery'](['cmHopperId',_0x4c58('0x6b'),'phone',_0x4c58('0x7f'),_0x4c58('0x54'),_0x4c58('0x53')],squel[_0x4c58('0x77')]()[_0x4c58('0x6d')](_0x4c58('0x80'),'id')[_0x4c58('0x6d')](_0x4c58('0x6f'),_0x4c58('0x6b'))[_0x4c58('0x6d')](_0x4c58('0x81'),_0x4c58('0x6e'))[_0x4c58('0x6d')](_0x4c58('0x82'),_0x4c58('0x7f'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27','updatedAt')[_0x4c58('0x79')](_0x4c58('0x83'),'ci')[_0x4c58('0x84')]('cm_hopper','h',_0x4c58('0x85'))['where'](_0x4c58('0x86'),_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())[_0x4c58('0x3d')]('h.CampaignId=?',_0x19f318[_0x4c58('0x46')]['id'][_0x4c58('0x71')]())[_0x4c58('0x3d')](_0x4c58('0x87'),_0x1a5ad2))[_0x4c58('0x71')]();_0xf292b6['push'](db[_0x4c58('0x88')]['query'](_0x576884));_0x35edc2[_0x4c58('0x89')](db[_0x4c58('0x88')][_0x4c58('0x30')](_0x185288));}return BPromise['all'](_0xf292b6);}})['then'](function(){return BPromise['all'](_0x35edc2);})[_0x4c58('0x22')](function(){return _0x410acd;})[_0x4c58('0x22')](respondWithResult(_0x45a0f3,null))[_0x4c58('0x44')](handleError(_0x45a0f3,null));};exports[_0x4c58('0x8a')]=function(_0x516919,_0x37b828,_0x4bbf38){return db[_0x4c58('0x2d')][_0x4c58('0x4d')]({'where':{'id':_0x516919[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x37b828,null))[_0x4c58('0x22')](function(_0x9c503){if(_0x9c503){return _0x9c503[_0x4c58('0x8a')](_0x516919['query'][_0x4c58('0x65')]);}})[_0x4c58('0x22')](function(_0x36ace3){if(_0x36ace3){return db[_0x4c58('0x59')][_0x4c58('0x23')]({'where':{'ListId':_0x516919[_0x4c58('0x30')][_0x4c58('0x65')],'CampaignId':_0x516919[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](function(){return _0x36ace3;});}})[_0x4c58('0x22')](respondWithStatusCode(_0x37b828,null))['catch'](handleError(_0x37b828,null));};exports[_0x4c58('0x8b')]=function(_0x26db06,_0x892b6d,_0x519b9d){var _0x195e5a={};var _0x31a34f={};var _0x4aa856;var _0x2c314b;return db['Campaign'][_0x4c58('0x58')]({'where':{'id':_0x26db06[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x892b6d,null))[_0x4c58('0x22')](function(_0x15bf17){if(_0x15bf17){_0x4aa856=_0x15bf17;_0x31a34f[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x8c')][_0x4c58('0x2e')]);_0x31a34f[_0x4c58('0x30')]=_['keys'](_0x26db06[_0x4c58('0x30')]);_0x31a34f[_0x4c58('0x3b')]=_['intersection'](_0x31a34f[_0x4c58('0x33')],_0x31a34f['query']);_0x195e5a[_0x4c58('0x34')]=_[_0x4c58('0x32')](_0x31a34f[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x26db06[_0x4c58('0x30')][_0x4c58('0x35')]));_0x195e5a[_0x4c58('0x34')]=_0x195e5a['attributes']['length']?_0x195e5a['attributes']:_0x31a34f[_0x4c58('0x33')];_0x195e5a[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x26db06[_0x4c58('0x30')]['sort']);_0x195e5a[_0x4c58('0x3d')]=qs['filters'](_[_0x4c58('0x60')](_0x26db06[_0x4c58('0x30')],_0x31a34f[_0x4c58('0x3b')]));if(_0x26db06[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x195e5a[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x195e5a[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x195e5a[_0x4c58('0x34')],function(_0x4e444a){var _0x42f667={};_0x42f667[_0x4e444a]={'$like':'%'+_0x26db06[_0x4c58('0x30')][_0x4c58('0x3c')]+'%'};return _0x42f667;})});}_0x195e5a=_[_0x4c58('0x47')]({},_0x195e5a,_0x26db06[_0x4c58('0x3f')]);return _0x4aa856['getBlackLists'](_0x195e5a);}})[_0x4c58('0x22')](function(_0x3f9128){if(_0x3f9128){_0x2c314b=_0x3f9128['length'];if(!_0x26db06[_0x4c58('0x30')][_0x4c58('0x37')](_0x4c58('0x38'))){_0x195e5a[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x26db06['query'][_0x4c58('0x39')]);_0x195e5a[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x26db06[_0x4c58('0x30')][_0x4c58('0x19')]);}return _0x4aa856[_0x4c58('0x8b')](_0x195e5a);}})[_0x4c58('0x22')](function(_0xce9713){if(_0xce9713){return _0xce9713?{'count':_0x2c314b,'rows':_0xce9713}:null;}})['then'](respondWithResult(_0x892b6d,null))['catch'](handleError(_0x892b6d,null));};exports[_0x4c58('0x8d')]=function(_0x1560a9,_0x38507c,_0x506d7d){var _0x326a4,_0x2e0fd4;var _0x34efd0=[];var _0x57f8cb=moment()[_0x4c58('0x64')](_0x4c58('0x8e'));return db[_0x4c58('0x2d')][_0x4c58('0x4d')]({'where':{'id':_0x1560a9[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x38507c,null))[_0x4c58('0x22')](function(_0x343284){if(_0x343284){_0x2e0fd4=_0x343284;return _0x343284[_0x4c58('0x8d')](_0x1560a9['body'][_0x4c58('0x65')],_['omit'](_0x1560a9[_0x4c58('0x49')],['ids','id'])||{});}return null;})[_0x4c58('0x8f')](function(_0x411be4){var _0x361231;var _0x5e897c;_0x326a4=_0x411be4||[];var _0x3d850a=[];if(_0x411be4){for(var _0x1fb5cf=0x0;_0x1fb5cf<_0x411be4[_0x4c58('0x36')];_0x1fb5cf+=0x1){var _0x53cae5=_0x411be4[_0x1fb5cf]['get']({'plain':!![]});_0x361231=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x90'))['fromQuery']([_0x4c58('0x6e'),_0x4c58('0x6c'),_0x4c58('0x72'),_0x4c58('0x5b'),_0x4c58('0x54'),_0x4c58('0x53')],squel['select']()[_0x4c58('0x6d')]('phone',_0x4c58('0x6e'))[_0x4c58('0x6d')]('id','ContactId')[_0x4c58('0x6d')](_0x53cae5[_0x4c58('0x70')][_0x4c58('0x71')](),'ListId')[_0x4c58('0x6d')](_0x1560a9[_0x4c58('0x46')]['id'][_0x4c58('0x71')](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('NOW()',_0x4c58('0x54'))[_0x4c58('0x6d')]('NOW()',_0x4c58('0x53'))[_0x4c58('0x79')](_0x4c58('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0x4c58('0x3d')]('ListId\x20=\x20?',_0x53cae5['CmListId']['toString']())[_0x4c58('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3d850a[_0x4c58('0x89')](db[_0x4c58('0x88')]['query'](_0x361231));}return BPromise[_0x4c58('0x91')](_0x3d850a);}})[_0x4c58('0x22')](function(){return _0x326a4;})[_0x4c58('0x22')](respondWithResult(_0x38507c,null))[_0x4c58('0x44')](handleError(_0x38507c,null));};exports[_0x4c58('0x92')]=function(_0x1b1d7a,_0x39839d,_0x562bc3){return db[_0x4c58('0x2d')]['find']({'where':{'id':_0x1b1d7a['params']['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x39839d,null))['then'](function(_0x164579){if(_0x164579){return _0x164579[_0x4c58('0x92')](_0x1b1d7a['query']['ids']);}})['then'](function(_0x253cec){if(_0x253cec){return db[_0x4c58('0x61')][_0x4c58('0x23')]({'where':{'ListId':_0x1b1d7a[_0x4c58('0x30')][_0x4c58('0x65')],'CampaignId':_0x1b1d7a[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](function(){return _0x253cec;});}})[_0x4c58('0x22')](respondWithStatusCode(_0x39839d,null))[_0x4c58('0x44')](handleError(_0x39839d,null));}; \ No newline at end of file +var _0x9114=['Content-Range','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','pick','getHopperHistories','findOne','order','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','NOW()','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x9114,0x72));var _0x4911=function(_0xffe53d,_0xd81109){_0xffe53d=_0xffe53d-0x0;var _0x218724=_0x9114[_0xffe53d];return _0x218724;};'use strict';var emlformat=require(_0x4911('0x0'));var rimraf=require(_0x4911('0x1'));var zipdir=require(_0x4911('0x2'));var jsonpatch=require(_0x4911('0x3'));var rp=require('request-promise');var moment=require(_0x4911('0x4'));var BPromise=require(_0x4911('0x5'));var Mustache=require(_0x4911('0x6'));var util=require(_0x4911('0x7'));var path=require(_0x4911('0x8'));var sox=require(_0x4911('0x9'));var csv=require(_0x4911('0xa'));var ejs=require(_0x4911('0xb'));var fs=require('fs');var fs_extra=require(_0x4911('0xc'));var _=require('lodash');var squel=require(_0x4911('0xd'));var crypto=require(_0x4911('0xe'));var jsforce=require(_0x4911('0xf'));var deskjs=require(_0x4911('0x10'));var toCsv=require(_0x4911('0xa'));var querystring=require(_0x4911('0x11'));var Papa=require(_0x4911('0x12'));var Redis=require(_0x4911('0x13'));var authService=require(_0x4911('0x14'));var qs=require(_0x4911('0x15'));var as=require(_0x4911('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4911('0x17'))(_0x4911('0x18'));var utils=require(_0x4911('0x19'));var config=require(_0x4911('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4911('0x1b'))['db'];function respondWithStatusCode(_0x5abf3d,_0x4ca386){_0x4ca386=_0x4ca386||0xcc;return function(_0x4d620b){if(_0x4d620b){return _0x5abf3d[_0x4911('0x1c')](_0x4ca386);}return _0x5abf3d['status'](_0x4ca386)[_0x4911('0x1d')]();};}function respondWithResult(_0x3098f6,_0x2de3ac){_0x2de3ac=_0x2de3ac||0xc8;return function(_0x38de3e){if(_0x38de3e){return _0x3098f6[_0x4911('0x1e')](_0x2de3ac)[_0x4911('0x1f')](_0x38de3e);}};}function respondWithFilteredResult(_0x5f1624,_0x152da4){return function(_0x3f4c8a){if(_0x3f4c8a){var _0x5220ac=typeof _0x152da4[_0x4911('0x20')]==='undefined'&&typeof _0x152da4['limit']===_0x4911('0x21');var _0x41e0c2=_0x3f4c8a[_0x4911('0x22')];var _0x3f179c=_0x5220ac?0x0:_0x152da4[_0x4911('0x20')];var _0x51bda4=_0x5220ac?_0x3f4c8a[_0x4911('0x22')]:_0x152da4[_0x4911('0x20')]+_0x152da4['limit'];var _0x9c5b48;if(_0x51bda4>=_0x41e0c2){_0x51bda4=_0x41e0c2;_0x9c5b48=0xc8;}else{_0x9c5b48=0xce;}_0x5f1624[_0x4911('0x1e')](_0x9c5b48);return _0x5f1624[_0x4911('0x23')](_0x4911('0x24'),_0x3f179c+'-'+_0x51bda4+'/'+_0x41e0c2)['json'](_0x3f4c8a);}return null;};}function patchUpdates(_0xdd837c){return function(_0x1a9c9c){try{jsonpatch['apply'](_0x1a9c9c,_0xdd837c,!![]);}catch(_0xe72e89){return BPromise['reject'](_0xe72e89);}return _0x1a9c9c[_0x4911('0x25')]();};}function saveUpdates(_0x452c94,_0x596a6f){return function(_0xcfe614){if(_0xcfe614){return _0xcfe614[_0x4911('0x26')](_0x452c94)[_0x4911('0x27')](function(_0x2dc786){return _0x2dc786;});}return null;};}function removeEntity(_0x42e9fc,_0x1e0a79){return function(_0x40ca91){if(_0x40ca91){return _0x40ca91[_0x4911('0x28')]()[_0x4911('0x27')](function(){var _0x2b4dfb=_0x40ca91['get']({'plain':!![]});var _0x3aca60=_0x4911('0x29');return db[_0x4911('0x2a')][_0x4911('0x28')]({'where':{'type':_0x3aca60,'resourceId':_0x2b4dfb['id']}})[_0x4911('0x27')](function(){return _0x40ca91;});})['then'](function(){_0x42e9fc[_0x4911('0x1e')](0xcc)[_0x4911('0x1d')]();});}};}function handleEntityNotFound(_0xe89f5c,_0x4a8545){return function(_0x35a521){if(!_0x35a521){_0xe89f5c[_0x4911('0x1c')](0x194);}return _0x35a521;};}function handleError(_0x407923,_0x47a3f9){_0x47a3f9=_0x47a3f9||0x1f4;return function(_0x1b9ae9){logger[_0x4911('0x2b')](_0x1b9ae9[_0x4911('0x2c')]);if(_0x1b9ae9[_0x4911('0x2d')]){delete _0x1b9ae9[_0x4911('0x2d')];}_0x407923[_0x4911('0x1e')](_0x47a3f9)['send'](_0x1b9ae9);};}exports[_0x4911('0x2e')]=function(_0x30ef42,_0x465006){var _0x476522={},_0x2c3464={},_0x98ea32={'count':0x0,'rows':[]};var _0x5ae9fe=_[_0x4911('0x2f')](db[_0x4911('0x30')][_0x4911('0x31')],function(_0x64f77){return{'name':_0x64f77[_0x4911('0x32')],'type':_0x64f77[_0x4911('0x33')][_0x4911('0x34')]};});_0x2c3464[_0x4911('0x35')]=_['map'](_0x5ae9fe,_0x4911('0x2d'));_0x2c3464[_0x4911('0x36')]=_[_0x4911('0x37')](_0x30ef42[_0x4911('0x36')]);_0x2c3464[_0x4911('0x38')]=_['intersection'](_0x2c3464[_0x4911('0x35')],_0x2c3464[_0x4911('0x36')]);_0x476522[_0x4911('0x39')]=_[_0x4911('0x3a')](_0x2c3464[_0x4911('0x35')],qs[_0x4911('0x3b')](_0x30ef42[_0x4911('0x36')][_0x4911('0x3b')]));_0x476522[_0x4911('0x39')]=_0x476522[_0x4911('0x39')][_0x4911('0x3c')]?_0x476522['attributes']:_0x2c3464[_0x4911('0x35')];if(!_0x30ef42[_0x4911('0x36')][_0x4911('0x3d')](_0x4911('0x3e'))){_0x476522[_0x4911('0x3f')]=qs['limit'](_0x30ef42[_0x4911('0x36')][_0x4911('0x3f')]);_0x476522[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x30ef42[_0x4911('0x36')][_0x4911('0x20')]);}_0x476522['order']=qs[_0x4911('0x40')](_0x30ef42[_0x4911('0x36')][_0x4911('0x40')]);_0x476522['where']=qs[_0x4911('0x38')](_['pick'](_0x30ef42[_0x4911('0x36')],_0x2c3464[_0x4911('0x38')]),_0x5ae9fe);if(_0x30ef42[_0x4911('0x36')][_0x4911('0x41')]){_0x476522['where']=_[_0x4911('0x42')](_0x476522[_0x4911('0x43')],{'$or':_[_0x4911('0x2f')](_0x5ae9fe,function(_0x30baad){if(_0x30baad[_0x4911('0x33')]!==_0x4911('0x44')){var _0xd3a05e={};_0xd3a05e[_0x30baad[_0x4911('0x2d')]]={'$like':'%'+_0x30ef42[_0x4911('0x36')][_0x4911('0x41')]+'%'};return _0xd3a05e;}})});}_0x476522=_[_0x4911('0x42')]({},_0x476522,_0x30ef42[_0x4911('0x45')]);var _0x66daa0={'where':_0x476522[_0x4911('0x43')]};return db[_0x4911('0x30')][_0x4911('0x22')](_0x66daa0)[_0x4911('0x27')](function(_0x589427){_0x98ea32[_0x4911('0x22')]=_0x589427;if(_0x30ef42[_0x4911('0x36')][_0x4911('0x46')]){_0x476522[_0x4911('0x47')]=[{'all':!![]}];}return db[_0x4911('0x30')][_0x4911('0x48')](_0x476522);})[_0x4911('0x27')](function(_0x32f6da){_0x98ea32[_0x4911('0x49')]=_0x32f6da;return _0x98ea32;})[_0x4911('0x27')](respondWithFilteredResult(_0x465006,_0x476522))[_0x4911('0x4a')](handleError(_0x465006,null));};exports['show']=function(_0x280a07,_0x586aa4){var _0x55d9f2={'raw':![],'where':{'id':_0x280a07[_0x4911('0x4b')]['id']}},_0x656f0d={};_0x656f0d[_0x4911('0x35')]=_[_0x4911('0x37')](db[_0x4911('0x30')][_0x4911('0x31')]);_0x656f0d['query']=_[_0x4911('0x37')](_0x280a07[_0x4911('0x36')]);_0x656f0d[_0x4911('0x38')]=_['intersection'](_0x656f0d[_0x4911('0x35')],_0x656f0d[_0x4911('0x36')]);_0x55d9f2[_0x4911('0x39')]=_[_0x4911('0x3a')](_0x656f0d[_0x4911('0x35')],qs[_0x4911('0x3b')](_0x280a07[_0x4911('0x36')][_0x4911('0x3b')]));_0x55d9f2[_0x4911('0x39')]=_0x55d9f2[_0x4911('0x39')][_0x4911('0x3c')]?_0x55d9f2[_0x4911('0x39')]:_0x656f0d[_0x4911('0x35')];if(_0x280a07[_0x4911('0x36')]['includeAll']){_0x55d9f2[_0x4911('0x47')]=[{'all':!![]}];}_0x55d9f2=_[_0x4911('0x42')]({},_0x55d9f2,_0x280a07[_0x4911('0x45')]);return db[_0x4911('0x30')]['find'](_0x55d9f2)[_0x4911('0x27')](handleEntityNotFound(_0x586aa4,null))[_0x4911('0x27')](respondWithResult(_0x586aa4,null))[_0x4911('0x4a')](handleError(_0x586aa4,null));};exports[_0x4911('0x4c')]=function(_0x34992b,_0x37ad31){return db[_0x4911('0x30')][_0x4911('0x4c')](_0x34992b[_0x4911('0x4d')],{})['then'](function(_0x357bb0){var _0x3f0310=_0x34992b[_0x4911('0x4e')][_0x4911('0x4f')]({'plain':!![]});if(!_0x3f0310)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f0310[_0x4911('0x50')]==='user'){var _0x2a167d=_0x357bb0[_0x4911('0x4f')]({'plain':!![]});var _0x3d9f5b=_0x4911('0x29');return db[_0x4911('0x51')][_0x4911('0x52')]({'where':{'name':_0x3d9f5b,'userProfileId':_0x3f0310[_0x4911('0x53')]},'raw':!![]})['then'](function(_0x43c405){if(_0x43c405&&_0x43c405[_0x4911('0x54')]===0x0){return db[_0x4911('0x2a')][_0x4911('0x4c')]({'name':_0x2a167d[_0x4911('0x2d')],'resourceId':_0x2a167d['id'],'type':_0x43c405['name'],'sectionId':_0x43c405['id']},{})[_0x4911('0x27')](function(){return _0x357bb0;});}else{return _0x357bb0;}})[_0x4911('0x4a')](function(_0x981dff){logger[_0x4911('0x2b')](_0x4911('0x55'),_0x981dff);throw _0x981dff;});}return _0x357bb0;})['then'](respondWithResult(_0x37ad31,0xc9))[_0x4911('0x4a')](handleError(_0x37ad31,null));};exports[_0x4911('0x56')]=function(_0x488115,_0x1e376e){var _0x294224={'where':{'id':_0x488115['params']['id']}},_0x47d2a0={};_0x47d2a0[_0x4911('0x35')]=_[_0x4911('0x37')](db[_0x4911('0x30')][_0x4911('0x31')]);_0x294224['attributes']=_[_0x4911('0x3a')](_0x47d2a0[_0x4911('0x35')],qs['fields'](_0x488115[_0x4911('0x36')][_0x4911('0x3b')]));_0x294224[_0x4911('0x39')]=_0x294224[_0x4911('0x39')][_0x4911('0x3c')]?_0x294224[_0x4911('0x39')]:_0x47d2a0[_0x4911('0x35')];if(_0x488115[_0x4911('0x36')][_0x4911('0x46')]){_0x294224['include']=[{'all':!![]}];}_0x294224=_[_0x4911('0x42')]({},_0x294224,_0x488115['options']);return db[_0x4911('0x30')][_0x4911('0x52')](_0x294224)[_0x4911('0x27')](handleEntityNotFound(_0x1e376e,null))[_0x4911('0x27')](function(_0x270afd){if(_0x270afd){var _0x36c42d=_0x270afd[_0x4911('0x4f')]({'plain':!![]});_0x36c42d=qs['omit'](_0x36c42d,['id',_0x4911('0x57'),_0x4911('0x58')]);_0x488115['body']=_[_0x4911('0x59')](_0x488115[_0x4911('0x4d')],['id',_0x4911('0x57'),'updatedAt']);return db['Campaign'][_0x4911('0x4c')](_['merge'](_0x36c42d,_0x488115['body']),{'include':_0x488115[_0x4911('0x36')][_0x4911('0x46')]?[{'all':!![]}]:undefined})[_0x4911('0x27')](function(_0x4f5136){var _0x3e7815=_0x488115[_0x4911('0x4e')]['get']({'plain':!![]});if(!_0x3e7815)throw new Error(_0x4911('0x5a'));if(_0x3e7815[_0x4911('0x50')]===_0x4911('0x4e')){var _0x4e3785=_0x4f5136[_0x4911('0x4f')]({'plain':!![]});var _0x3aa45f=_0x4911('0x29');return db[_0x4911('0x51')][_0x4911('0x52')]({'where':{'name':_0x3aa45f,'userProfileId':_0x3e7815[_0x4911('0x53')]},'raw':!![]})[_0x4911('0x27')](function(_0x449479){if(_0x449479&&_0x449479[_0x4911('0x54')]===0x0){return db[_0x4911('0x2a')][_0x4911('0x4c')]({'name':_0x4e3785[_0x4911('0x2d')],'resourceId':_0x4e3785['id'],'type':_0x449479[_0x4911('0x2d')],'sectionId':_0x449479['id']},{})[_0x4911('0x27')](function(){return _0x4f5136;});}else{return _0x4f5136;}})[_0x4911('0x4a')](function(_0x57346d){logger[_0x4911('0x2b')](_0x4911('0x55'),_0x57346d);throw _0x57346d;});}return _0x4f5136;});}})['then'](respondWithResult(_0x1e376e,0xc9))[_0x4911('0x4a')](handleError(_0x1e376e,null));};exports[_0x4911('0x26')]=function(_0x4b7c1b,_0x131ccb){if(_0x4b7c1b[_0x4911('0x4d')]['id']){delete _0x4b7c1b[_0x4911('0x4d')]['id'];}return db[_0x4911('0x30')][_0x4911('0x52')]({'where':{'id':_0x4b7c1b[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x131ccb,null))[_0x4911('0x27')](saveUpdates(_0x4b7c1b[_0x4911('0x4d')],null))['then'](respondWithResult(_0x131ccb,null))[_0x4911('0x4a')](handleError(_0x131ccb,null));};exports['destroy']=function(_0x54b01e,_0x2c10a6){return db[_0x4911('0x30')][_0x4911('0x52')]({'where':{'id':_0x54b01e[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x2c10a6,null))['then'](removeEntity(_0x2c10a6,null))['catch'](handleError(_0x2c10a6,null));};exports[_0x4911('0x5b')]=function(_0x402548,_0x25e4d1,_0x1022bf){var _0x4a07cd={'raw':!![],'where':{}};var _0x433fd9={};var _0x56df40={'count':0x0,'rows':[]};return db[_0x4911('0x30')]['findOne']({'where':{'id':_0x402548[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x25e4d1,null))[_0x4911('0x27')](function(_0x49ffad){if(_0x49ffad){_0x433fd9[_0x4911('0x35')]=_[_0x4911('0x37')](db[_0x4911('0x5c')][_0x4911('0x31')]);_0x433fd9[_0x4911('0x36')]=_['keys'](_0x402548[_0x4911('0x36')]);_0x433fd9[_0x4911('0x38')]=_[_0x4911('0x3a')](_0x433fd9['model'],_0x433fd9[_0x4911('0x36')]);_0x4a07cd[_0x4911('0x39')]=_['intersection'](_0x433fd9[_0x4911('0x35')],qs[_0x4911('0x3b')](_0x402548[_0x4911('0x36')]['fields']));_0x4a07cd[_0x4911('0x39')]=_0x4a07cd[_0x4911('0x39')][_0x4911('0x3c')]?_0x4a07cd['attributes']:_0x433fd9[_0x4911('0x35')];if(!_0x402548[_0x4911('0x36')][_0x4911('0x3d')](_0x4911('0x3e'))){_0x4a07cd[_0x4911('0x3f')]=qs['limit'](_0x402548[_0x4911('0x36')]['limit']);_0x4a07cd['offset']=qs[_0x4911('0x20')](_0x402548['query']['offset']);}_0x4a07cd['order']=qs[_0x4911('0x40')](_0x402548[_0x4911('0x36')]['sort']);_0x4a07cd['where']=qs[_0x4911('0x38')](_[_0x4911('0x5d')](_0x402548[_0x4911('0x36')],_0x433fd9[_0x4911('0x38')]));_0x4a07cd['where']['CampaignId']=_0x49ffad['id'];if(_0x402548[_0x4911('0x36')]['filter']){_0x4a07cd['where']=_[_0x4911('0x42')](_0x4a07cd[_0x4911('0x43')],{'$or':_[_0x4911('0x2f')](_0x4a07cd['attributes'],function(_0x26eb39){var _0x57471b={};_0x57471b[_0x26eb39]={'$like':'%'+_0x402548[_0x4911('0x36')][_0x4911('0x41')]+'%'};return _0x57471b;})});}_0x4a07cd=_['merge']({},_0x4a07cd,_0x402548[_0x4911('0x45')]);return db['CmHopper'][_0x4911('0x22')]({'where':_0x4a07cd[_0x4911('0x43')]})[_0x4911('0x27')](function(_0x223004){_0x56df40[_0x4911('0x22')]=_0x223004;if(_0x402548['query'][_0x4911('0x46')]){_0x4a07cd[_0x4911('0x47')]=[{'all':!![]}];}return db[_0x4911('0x5c')][_0x4911('0x48')](_0x4a07cd);})[_0x4911('0x27')](function(_0x1266da){_0x56df40[_0x4911('0x49')]=_0x1266da;return _0x56df40;});}})['then'](respondWithFilteredResult(_0x25e4d1,_0x4a07cd))[_0x4911('0x4a')](handleError(_0x25e4d1,null));};exports[_0x4911('0x5e')]=function(_0x48eb7e,_0x56b695,_0x1d7c8b){var _0x354b09={'raw':!![],'where':{}};var _0x269e80={};var _0x27e43b={'count':0x0,'rows':[]};return db[_0x4911('0x30')][_0x4911('0x5f')]({'where':{'id':_0x48eb7e[_0x4911('0x4b')]['id']}})['then'](handleEntityNotFound(_0x56b695,null))[_0x4911('0x27')](function(_0x467c50){if(_0x467c50){_0x269e80[_0x4911('0x35')]=_[_0x4911('0x37')](db['CmHopperHistory'][_0x4911('0x31')]);_0x269e80['query']=_['keys'](_0x48eb7e[_0x4911('0x36')]);_0x269e80[_0x4911('0x38')]=_['intersection'](_0x269e80[_0x4911('0x35')],_0x269e80['query']);_0x354b09[_0x4911('0x39')]=_[_0x4911('0x3a')](_0x269e80[_0x4911('0x35')],qs['fields'](_0x48eb7e[_0x4911('0x36')][_0x4911('0x3b')]));_0x354b09[_0x4911('0x39')]=_0x354b09['attributes']['length']?_0x354b09['attributes']:_0x269e80[_0x4911('0x35')];if(!_0x48eb7e[_0x4911('0x36')]['hasOwnProperty'](_0x4911('0x3e'))){_0x354b09[_0x4911('0x3f')]=qs['limit'](_0x48eb7e[_0x4911('0x36')]['limit']);_0x354b09[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x48eb7e[_0x4911('0x36')][_0x4911('0x20')]);}_0x354b09[_0x4911('0x60')]=qs[_0x4911('0x40')](_0x48eb7e[_0x4911('0x36')][_0x4911('0x40')]);_0x354b09['where']=qs[_0x4911('0x38')](_['pick'](_0x48eb7e[_0x4911('0x36')],_0x269e80['filters']));_0x354b09[_0x4911('0x43')][_0x4911('0x61')]=_0x467c50['id'];if(_0x48eb7e['query'][_0x4911('0x41')]){_0x354b09[_0x4911('0x43')]=_[_0x4911('0x42')](_0x354b09['where'],{'$or':_[_0x4911('0x2f')](_0x354b09[_0x4911('0x39')],function(_0x194402){var _0x1c21d7={};_0x1c21d7[_0x194402]={'$like':'%'+_0x48eb7e[_0x4911('0x36')][_0x4911('0x41')]+'%'};return _0x1c21d7;})});}_0x354b09=_[_0x4911('0x42')]({},_0x354b09,_0x48eb7e[_0x4911('0x45')]);return db[_0x4911('0x62')][_0x4911('0x22')]({'where':_0x354b09[_0x4911('0x43')]})[_0x4911('0x27')](function(_0x26227d){_0x27e43b['count']=_0x26227d;if(_0x48eb7e[_0x4911('0x36')][_0x4911('0x46')]){_0x354b09['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x4911('0x48')](_0x354b09);})['then'](function(_0x3d5815){_0x27e43b[_0x4911('0x49')]=_0x3d5815;return _0x27e43b;});}})[_0x4911('0x27')](respondWithFilteredResult(_0x56b695,_0x354b09))['catch'](handleError(_0x56b695,null));};exports['getHopperFinals']=function(_0x4e66f4,_0x22834c,_0x262ca0){var _0x11008e={'raw':!![],'where':{}};var _0x501139={};var _0x5f2699={'count':0x0,'rows':[]};return db[_0x4911('0x30')][_0x4911('0x5f')]({'where':{'id':_0x4e66f4[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x22834c,null))[_0x4911('0x27')](function(_0x401beb){if(_0x401beb){_0x501139['model']=_[_0x4911('0x37')](db[_0x4911('0x63')]['rawAttributes']);_0x501139[_0x4911('0x36')]=_[_0x4911('0x37')](_0x4e66f4[_0x4911('0x36')]);_0x501139[_0x4911('0x38')]=_[_0x4911('0x3a')](_0x501139['model'],_0x501139['query']);_0x11008e[_0x4911('0x39')]=_[_0x4911('0x3a')](_0x501139['model'],qs[_0x4911('0x3b')](_0x4e66f4[_0x4911('0x36')][_0x4911('0x3b')]));_0x11008e[_0x4911('0x39')]=_0x11008e[_0x4911('0x39')][_0x4911('0x3c')]?_0x11008e[_0x4911('0x39')]:_0x501139[_0x4911('0x35')];if(!_0x4e66f4[_0x4911('0x36')][_0x4911('0x3d')]('nolimit')){_0x11008e[_0x4911('0x3f')]=qs[_0x4911('0x3f')](_0x4e66f4['query']['limit']);_0x11008e[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x4e66f4['query'][_0x4911('0x20')]);}_0x11008e[_0x4911('0x60')]=qs[_0x4911('0x40')](_0x4e66f4[_0x4911('0x36')][_0x4911('0x40')]);_0x11008e[_0x4911('0x43')]=qs[_0x4911('0x38')](_[_0x4911('0x5d')](_0x4e66f4['query'],_0x501139['filters']));_0x11008e[_0x4911('0x43')][_0x4911('0x61')]=_0x401beb['id'];if(_0x4e66f4['query'][_0x4911('0x41')]){_0x11008e[_0x4911('0x43')]=_[_0x4911('0x42')](_0x11008e[_0x4911('0x43')],{'$or':_[_0x4911('0x2f')](_0x11008e[_0x4911('0x39')],function(_0x47d1ce){var _0x2cb16a={};_0x2cb16a[_0x47d1ce]={'$like':'%'+_0x4e66f4[_0x4911('0x36')][_0x4911('0x41')]+'%'};return _0x2cb16a;})});}_0x11008e=_[_0x4911('0x42')]({},_0x11008e,_0x4e66f4[_0x4911('0x45')]);return db[_0x4911('0x63')][_0x4911('0x22')]({'where':_0x11008e[_0x4911('0x43')]})[_0x4911('0x27')](function(_0x28d997){_0x5f2699[_0x4911('0x22')]=_0x28d997;if(_0x4e66f4[_0x4911('0x36')][_0x4911('0x46')]){_0x11008e['include']=[{'all':!![]}];}return db[_0x4911('0x63')]['findAll'](_0x11008e);})[_0x4911('0x27')](function(_0xc06721){_0x5f2699[_0x4911('0x49')]=_0xc06721;return _0x5f2699;});}})[_0x4911('0x27')](respondWithFilteredResult(_0x22834c,_0x11008e))[_0x4911('0x4a')](handleError(_0x22834c,null));};exports[_0x4911('0x64')]=function(_0x4a03ea,_0x4c1df0,_0x182d94){var _0x5483b5={'raw':!![],'where':{}};var _0x3c96c4={};var _0x572c93={'count':0x0,'rows':[]};return db['Campaign'][_0x4911('0x5f')]({'where':{'id':_0x4a03ea[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x4c1df0,null))['then'](function(_0x36cb40){if(_0x36cb40){_0x3c96c4[_0x4911('0x35')]=_['keys'](db[_0x4911('0x65')][_0x4911('0x31')]);_0x3c96c4[_0x4911('0x36')]=_['keys'](_0x4a03ea['query']);_0x3c96c4[_0x4911('0x38')]=_[_0x4911('0x3a')](_0x3c96c4[_0x4911('0x35')],_0x3c96c4[_0x4911('0x36')]);_0x5483b5[_0x4911('0x39')]=_['intersection'](_0x3c96c4[_0x4911('0x35')],qs[_0x4911('0x3b')](_0x4a03ea[_0x4911('0x36')][_0x4911('0x3b')]));_0x5483b5[_0x4911('0x39')]=_0x5483b5[_0x4911('0x39')]['length']?_0x5483b5[_0x4911('0x39')]:_0x3c96c4['model'];if(!_0x4a03ea[_0x4911('0x36')][_0x4911('0x3d')]('nolimit')){_0x5483b5['limit']=qs[_0x4911('0x3f')](_0x4a03ea['query'][_0x4911('0x3f')]);_0x5483b5[_0x4911('0x20')]=qs['offset'](_0x4a03ea[_0x4911('0x36')][_0x4911('0x20')]);}_0x5483b5['order']=qs[_0x4911('0x40')](_0x4a03ea[_0x4911('0x36')][_0x4911('0x40')]);_0x5483b5[_0x4911('0x43')]=qs['filters'](_['pick'](_0x4a03ea[_0x4911('0x36')],_0x3c96c4[_0x4911('0x38')]));_0x5483b5[_0x4911('0x43')]['CampaignId']=_0x36cb40['id'];if(_0x4a03ea['query'][_0x4911('0x41')]){_0x5483b5['where']=_[_0x4911('0x42')](_0x5483b5[_0x4911('0x43')],{'$or':_['map'](_0x5483b5['attributes'],function(_0xaddc19){var _0x573d3c={};_0x573d3c[_0xaddc19]={'$like':'%'+_0x4a03ea[_0x4911('0x36')][_0x4911('0x41')]+'%'};return _0x573d3c;})});}_0x5483b5=_[_0x4911('0x42')]({},_0x5483b5,_0x4a03ea[_0x4911('0x45')]);return db[_0x4911('0x65')]['count']({'where':_0x5483b5['where']})[_0x4911('0x27')](function(_0x40988d){_0x572c93[_0x4911('0x22')]=_0x40988d;if(_0x4a03ea[_0x4911('0x36')][_0x4911('0x46')]){_0x5483b5[_0x4911('0x47')]=[{'all':!![]}];}return db[_0x4911('0x65')]['findAll'](_0x5483b5);})[_0x4911('0x27')](function(_0x42ae0b){_0x572c93[_0x4911('0x49')]=_0x42ae0b;return _0x572c93;});}})[_0x4911('0x27')](respondWithFilteredResult(_0x4c1df0,_0x5483b5))['catch'](handleError(_0x4c1df0,null));};exports[_0x4911('0x66')]=function(_0x1ba9a6,_0x1566a4,_0x462e80){var _0x347a57={};var _0x83f7fe={};var _0x5173f3;var _0x185f7a;return db[_0x4911('0x30')][_0x4911('0x5f')]({'where':{'id':_0x1ba9a6[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x1566a4,null))[_0x4911('0x27')](function(_0x2f1bb1){if(_0x2f1bb1){_0x5173f3=_0x2f1bb1;_0x83f7fe[_0x4911('0x35')]=_[_0x4911('0x37')](db['CmList']['rawAttributes']);_0x83f7fe[_0x4911('0x36')]=_[_0x4911('0x37')](_0x1ba9a6['query']);_0x83f7fe[_0x4911('0x38')]=_[_0x4911('0x3a')](_0x83f7fe[_0x4911('0x35')],_0x83f7fe[_0x4911('0x36')]);_0x347a57[_0x4911('0x39')]=_[_0x4911('0x3a')](_0x83f7fe['model'],qs[_0x4911('0x3b')](_0x1ba9a6[_0x4911('0x36')]['fields']));_0x347a57[_0x4911('0x39')]=_0x347a57[_0x4911('0x39')][_0x4911('0x3c')]?_0x347a57[_0x4911('0x39')]:_0x83f7fe['model'];_0x347a57['order']=qs[_0x4911('0x40')](_0x1ba9a6[_0x4911('0x36')][_0x4911('0x40')]);_0x347a57[_0x4911('0x43')]=qs[_0x4911('0x38')](_[_0x4911('0x5d')](_0x1ba9a6[_0x4911('0x36')],_0x83f7fe[_0x4911('0x38')]));if(_0x1ba9a6['query']['filter']){_0x347a57[_0x4911('0x43')]=_[_0x4911('0x42')](_0x347a57['where'],{'$or':_[_0x4911('0x2f')](_0x347a57[_0x4911('0x39')],function(_0xabca83){var _0x48c7b8={};_0x48c7b8[_0xabca83]={'$like':'%'+_0x1ba9a6[_0x4911('0x36')]['filter']+'%'};return _0x48c7b8;})});}_0x347a57=_[_0x4911('0x42')]({},_0x347a57,_0x1ba9a6[_0x4911('0x45')]);return _0x5173f3[_0x4911('0x66')](_0x347a57);}})['then'](function(_0x3ddc27){if(_0x3ddc27){_0x185f7a=_0x3ddc27['length'];if(!_0x1ba9a6[_0x4911('0x36')][_0x4911('0x3d')](_0x4911('0x3e'))){_0x347a57[_0x4911('0x3f')]=qs[_0x4911('0x3f')](_0x1ba9a6['query']['limit']);_0x347a57['offset']=qs[_0x4911('0x20')](_0x1ba9a6[_0x4911('0x36')]['offset']);}return _0x5173f3['getLists'](_0x347a57);}})[_0x4911('0x27')](function(_0x24c758){if(_0x24c758){return _0x24c758?{'count':_0x185f7a,'rows':_0x24c758}:null;}})[_0x4911('0x27')](respondWithResult(_0x1566a4,null))[_0x4911('0x4a')](handleError(_0x1566a4,null));};exports[_0x4911('0x67')]=function(_0x4fb61f,_0x513852,_0x984ff3){var _0x5af7cc,_0x233603;var _0x1dcf84=[];var _0x4eaaec=moment()[_0x4911('0x68')](_0x4911('0x69'));return db[_0x4911('0x30')][_0x4911('0x52')]({'where':{'id':_0x4fb61f[_0x4911('0x4b')]['id']}})['then'](handleEntityNotFound(_0x513852,null))[_0x4911('0x27')](function(_0x5dec01){if(_0x5dec01){_0x233603=_0x5dec01;return _0x5dec01[_0x4911('0x67')](_0x4fb61f[_0x4911('0x4d')][_0x4911('0x6a')],_[_0x4911('0x59')](_0x4fb61f[_0x4911('0x4d')],['ids','id'])||{});}return null;})[_0x4911('0x6b')](function(_0x2ba82a){var _0x31b2c5;var _0x20815a;_0x5af7cc=_0x2ba82a||[];var _0x263473=[];if(_0x2ba82a){for(var _0xef6dbe=0x0;_0xef6dbe<_0x2ba82a[_0x4911('0x3c')];_0xef6dbe+=0x1){var _0xd7c653=_0x2ba82a[_0xef6dbe][_0x4911('0x4f')]({'plain':!![]});_0x233603[_0x4911('0x6c')]=_0x4fb61f[_0x4911('0x4d')][_0x4911('0x6c')]?_0x4fb61f[_0x4911('0x4d')][_0x4911('0x6c')]:_0x233603[_0x4911('0x6c')];switch(_0x233603[_0x4911('0x6c')]){case _0x4911('0x6d'):_0x31b2c5=squel[_0x4911('0x6e')]()[_0x4911('0x6f')](_0x4911('0x70'))['fromQuery']([_0x4911('0x71'),_0x4911('0x72'),_0x4911('0x73'),_0x4911('0x74'),_0x4911('0x61'),_0x4911('0x57'),_0x4911('0x58')],squel[_0x4911('0x75')]()['field'](_0x4911('0x71'),_0x4911('0x71'))['field']('NOW()',_0x4911('0x72'))[_0x4911('0x76')]('id',_0x4911('0x73'))['field'](_0xd7c653['CmListId']['toString'](),'ListId')[_0x4911('0x76')](_0x4fb61f[_0x4911('0x4b')]['id'][_0x4911('0x77')](),_0x4911('0x61'))[_0x4911('0x76')]('\x27'+_0x4eaaec+'\x27',_0x4911('0x57'))['field']('\x27'+_0x4eaaec+'\x27','updatedAt')[_0x4911('0x78')](_0x4911('0x79'))['where']('deletedAt\x20IS\x20NULL')[_0x4911('0x43')]('ListId\x20=\x20?',_0xd7c653['CmListId'][_0x4911('0x77')]())[_0x4911('0x43')](_0x4911('0x7a'))[_0x4911('0x43')](_0x4911('0x7b'),squel['select']()['field'](_0x4911('0x7c'))[_0x4911('0x78')](_0x4911('0x7d'))['where'](_0x4911('0x7e'),_0x4fb61f[_0x4911('0x4b')]['id']['toString']()))[_0x4911('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4911('0x75')]()[_0x4911('0x76')]('COALESCE(phone,\x27\x27)')[_0x4911('0x78')](_0x4911('0x70'))[_0x4911('0x43')](_0x4911('0x7e'),_0x4fb61f['params']['id']['toString']())))[_0x4911('0x77')]();break;case _0x4911('0x7f'):_0x31b2c5=squel[_0x4911('0x6e')]()['into'](_0x4911('0x70'))[_0x4911('0x80')]([_0x4911('0x71'),_0x4911('0x72'),_0x4911('0x73'),_0x4911('0x74'),'CampaignId',_0x4911('0x57'),'updatedAt'],squel[_0x4911('0x75')]()[_0x4911('0x76')](_0x4911('0x71'),'phone')[_0x4911('0x76')](_0x4911('0x81'),_0x4911('0x72'))['field']('id',_0x4911('0x73'))['field'](_0xd7c653[_0x4911('0x82')][_0x4911('0x77')](),'ListId')[_0x4911('0x76')](_0x4fb61f[_0x4911('0x4b')]['id']['toString'](),_0x4911('0x61'))[_0x4911('0x76')]('\x27'+_0x4eaaec+'\x27',_0x4911('0x57'))[_0x4911('0x76')]('\x27'+_0x4eaaec+'\x27',_0x4911('0x58'))[_0x4911('0x78')](_0x4911('0x79'))[_0x4911('0x43')](_0x4911('0x83'))['where'](_0x4911('0x84'),_0xd7c653['CmListId'][_0x4911('0x77')]())[_0x4911('0x43')](_0x4911('0x7a'))[_0x4911('0x43')](_0x4911('0x7b'),squel[_0x4911('0x75')]()[_0x4911('0x76')](_0x4911('0x85'))[_0x4911('0x78')]('cm_hopper')[_0x4911('0x43')](_0x4911('0x7e'),_0x4fb61f[_0x4911('0x4b')]['id'][_0x4911('0x77')]())))['toString']();break;default:_0x31b2c5=squel[_0x4911('0x6e')]()['into'](_0x4911('0x70'))[_0x4911('0x80')]([_0x4911('0x71'),_0x4911('0x72'),_0x4911('0x73'),_0x4911('0x74'),_0x4911('0x61'),_0x4911('0x57'),'updatedAt'],squel[_0x4911('0x75')]()['field'](_0x4911('0x71'),_0x4911('0x71'))[_0x4911('0x76')](_0x4911('0x81'),'scheduledAt')[_0x4911('0x76')]('id','ContactId')[_0x4911('0x76')](_0xd7c653[_0x4911('0x82')][_0x4911('0x77')](),_0x4911('0x74'))[_0x4911('0x76')](_0x4fb61f[_0x4911('0x4b')]['id'][_0x4911('0x77')](),'CampaignId')[_0x4911('0x76')]('\x27'+_0x4eaaec+'\x27','createdAt')[_0x4911('0x76')]('\x27'+_0x4eaaec+'\x27',_0x4911('0x58'))[_0x4911('0x78')](_0x4911('0x79'))['where'](_0x4911('0x83'))[_0x4911('0x43')](_0x4911('0x84'),_0xd7c653[_0x4911('0x82')][_0x4911('0x77')]())[_0x4911('0x43')](_0x4911('0x7a')))[_0x4911('0x77')]();}_0x20815a=squel[_0x4911('0x6e')]()[_0x4911('0x6f')]('cm_hopper_additional_phones')[_0x4911('0x80')]([_0x4911('0x86'),_0x4911('0x72'),_0x4911('0x71'),_0x4911('0x87'),_0x4911('0x57'),_0x4911('0x58')],squel[_0x4911('0x75')]()[_0x4911('0x76')](_0x4911('0x88'),'id')['field'](_0x4911('0x81'),_0x4911('0x72'))['field'](_0x4911('0x89'),_0x4911('0x71'))[_0x4911('0x76')](_0x4911('0x8a'),_0x4911('0x87'))[_0x4911('0x76')]('\x27'+_0x4eaaec+'\x27',_0x4911('0x57'))[_0x4911('0x76')]('\x27'+_0x4eaaec+'\x27',_0x4911('0x58'))[_0x4911('0x78')]('cm_contact_has_items','ci')[_0x4911('0x8b')](_0x4911('0x70'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x4911('0x8c'),_0xd7c653['CmListId'][_0x4911('0x77')]())[_0x4911('0x43')]('h.CampaignId=?',_0x4fb61f[_0x4911('0x4b')]['id'][_0x4911('0x77')]())[_0x4911('0x43')](_0x4911('0x8d'),_0x4eaaec))[_0x4911('0x77')]();_0x263473[_0x4911('0x8e')](db[_0x4911('0x8f')][_0x4911('0x36')](_0x31b2c5));_0x1dcf84[_0x4911('0x8e')](db[_0x4911('0x8f')][_0x4911('0x36')](_0x20815a));}return BPromise[_0x4911('0x90')](_0x263473);}})['then'](function(){return BPromise[_0x4911('0x90')](_0x1dcf84);})['then'](function(){return _0x5af7cc;})['then'](respondWithResult(_0x513852,null))[_0x4911('0x4a')](handleError(_0x513852,null));};exports[_0x4911('0x91')]=function(_0x522f52,_0x4bcd4e,_0x30f57c){return db['Campaign'][_0x4911('0x52')]({'where':{'id':_0x522f52[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x4bcd4e,null))[_0x4911('0x27')](function(_0x5785cd){if(_0x5785cd){return _0x5785cd['removeLists'](_0x522f52['query']['ids']);}})[_0x4911('0x27')](function(_0x5720ad){if(_0x5720ad){return db[_0x4911('0x5c')]['destroy']({'where':{'ListId':_0x522f52[_0x4911('0x36')][_0x4911('0x6a')],'CampaignId':_0x522f52['params']['id']}})[_0x4911('0x27')](function(){return _0x5720ad;});}})[_0x4911('0x27')](respondWithStatusCode(_0x4bcd4e,null))[_0x4911('0x4a')](handleError(_0x4bcd4e,null));};exports[_0x4911('0x92')]=function(_0x53ff7c,_0x64144d,_0x513212){var _0xd439fd={};var _0x2640a2={};var _0x30a32c;var _0x35db89;return db[_0x4911('0x30')][_0x4911('0x5f')]({'where':{'id':_0x53ff7c['params']['id']}})['then'](handleEntityNotFound(_0x64144d,null))['then'](function(_0x50db27){if(_0x50db27){_0x30a32c=_0x50db27;_0x2640a2['model']=_[_0x4911('0x37')](db[_0x4911('0x93')]['rawAttributes']);_0x2640a2[_0x4911('0x36')]=_['keys'](_0x53ff7c[_0x4911('0x36')]);_0x2640a2['filters']=_[_0x4911('0x3a')](_0x2640a2[_0x4911('0x35')],_0x2640a2[_0x4911('0x36')]);_0xd439fd[_0x4911('0x39')]=_[_0x4911('0x3a')](_0x2640a2[_0x4911('0x35')],qs['fields'](_0x53ff7c[_0x4911('0x36')]['fields']));_0xd439fd[_0x4911('0x39')]=_0xd439fd[_0x4911('0x39')][_0x4911('0x3c')]?_0xd439fd[_0x4911('0x39')]:_0x2640a2[_0x4911('0x35')];_0xd439fd['order']=qs['sort'](_0x53ff7c[_0x4911('0x36')][_0x4911('0x40')]);_0xd439fd[_0x4911('0x43')]=qs['filters'](_['pick'](_0x53ff7c['query'],_0x2640a2['filters']));if(_0x53ff7c[_0x4911('0x36')]['filter']){_0xd439fd['where']=_['merge'](_0xd439fd[_0x4911('0x43')],{'$or':_[_0x4911('0x2f')](_0xd439fd['attributes'],function(_0x5bd9a3){var _0x4e94aa={};_0x4e94aa[_0x5bd9a3]={'$like':'%'+_0x53ff7c[_0x4911('0x36')][_0x4911('0x41')]+'%'};return _0x4e94aa;})});}_0xd439fd=_[_0x4911('0x42')]({},_0xd439fd,_0x53ff7c[_0x4911('0x45')]);return _0x30a32c[_0x4911('0x92')](_0xd439fd);}})[_0x4911('0x27')](function(_0x39719e){if(_0x39719e){_0x35db89=_0x39719e[_0x4911('0x3c')];if(!_0x53ff7c[_0x4911('0x36')]['hasOwnProperty'](_0x4911('0x3e'))){_0xd439fd[_0x4911('0x3f')]=qs[_0x4911('0x3f')](_0x53ff7c[_0x4911('0x36')][_0x4911('0x3f')]);_0xd439fd[_0x4911('0x20')]=qs['offset'](_0x53ff7c[_0x4911('0x36')]['offset']);}return _0x30a32c[_0x4911('0x92')](_0xd439fd);}})[_0x4911('0x27')](function(_0x1345b3){if(_0x1345b3){return _0x1345b3?{'count':_0x35db89,'rows':_0x1345b3}:null;}})[_0x4911('0x27')](respondWithResult(_0x64144d,null))[_0x4911('0x4a')](handleError(_0x64144d,null));};exports[_0x4911('0x94')]=function(_0x5d708d,_0x5a9056,_0xa9bf70){var _0x5d7aa1,_0x540bd2;var _0x3657c7=[];var _0x5f14eb=moment()[_0x4911('0x68')](_0x4911('0x69'));return db[_0x4911('0x30')][_0x4911('0x52')]({'where':{'id':_0x5d708d['params']['id']}})['then'](handleEntityNotFound(_0x5a9056,null))[_0x4911('0x27')](function(_0x411dfc){if(_0x411dfc){_0x540bd2=_0x411dfc;return _0x411dfc['addBlackLists'](_0x5d708d['body']['ids'],_[_0x4911('0x59')](_0x5d708d[_0x4911('0x4d')],[_0x4911('0x6a'),'id'])||{});}return null;})['spread'](function(_0x2d5fbb){var _0xa3f7bd;var _0x5a7978;_0x5d7aa1=_0x2d5fbb||[];var _0x5eda85=[];if(_0x2d5fbb){for(var _0x467a6d=0x0;_0x467a6d<_0x2d5fbb[_0x4911('0x3c')];_0x467a6d+=0x1){var _0x43739f=_0x2d5fbb[_0x467a6d][_0x4911('0x4f')]({'plain':!![]});_0xa3f7bd=squel[_0x4911('0x6e')]()['into']('cm_hopper_black')[_0x4911('0x80')]([_0x4911('0x71'),_0x4911('0x73'),_0x4911('0x74'),_0x4911('0x61'),_0x4911('0x57'),_0x4911('0x58')],squel[_0x4911('0x75')]()[_0x4911('0x76')](_0x4911('0x71'),'phone')['field']('id','ContactId')[_0x4911('0x76')](_0x43739f['CmListId'][_0x4911('0x77')](),'ListId')[_0x4911('0x76')](_0x5d708d[_0x4911('0x4b')]['id'][_0x4911('0x77')](),_0x4911('0x61'))[_0x4911('0x76')]('NOW()','createdAt')[_0x4911('0x76')](_0x4911('0x81'),_0x4911('0x58'))[_0x4911('0x78')](_0x4911('0x79'))[_0x4911('0x43')](_0x4911('0x83'))['where'](_0x4911('0x84'),_0x43739f['CmListId']['toString']())['where'](_0x4911('0x7a')))['toString']();_0x5eda85[_0x4911('0x8e')](db[_0x4911('0x8f')][_0x4911('0x36')](_0xa3f7bd));}return BPromise[_0x4911('0x90')](_0x5eda85);}})[_0x4911('0x27')](function(){return _0x5d7aa1;})[_0x4911('0x27')](respondWithResult(_0x5a9056,null))[_0x4911('0x4a')](handleError(_0x5a9056,null));};exports[_0x4911('0x95')]=function(_0x559d03,_0x472602,_0x266b64){return db['Campaign'][_0x4911('0x52')]({'where':{'id':_0x559d03[_0x4911('0x4b')]['id']}})['then'](handleEntityNotFound(_0x472602,null))[_0x4911('0x27')](function(_0x4abf04){if(_0x4abf04){return _0x4abf04[_0x4911('0x95')](_0x559d03['query'][_0x4911('0x6a')]);}})['then'](function(_0x414bd8){if(_0x414bd8){return db['CmHopperBlack'][_0x4911('0x28')]({'where':{'ListId':_0x559d03['query'][_0x4911('0x6a')],'CampaignId':_0x559d03[_0x4911('0x4b')]['id']}})[_0x4911('0x27')](function(){return _0x414bd8;});}})[_0x4911('0x27')](respondWithStatusCode(_0x472602,null))[_0x4911('0x4a')](handleError(_0x472602,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 97b03d4..11c9765 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_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 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':'campaigns','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(_0x2abf68,_0x4ec499){var _0x2adec3=function(_0x2cd4f8){while(--_0x2cd4f8){_0x2abf68['push'](_0x2abf68['shift']());}};_0x2adec3(++_0x4ec499);}(_0x7a54,0x106));var _0x47a5=function(_0x1da24d,_0x98902e){_0x1da24d=_0x1da24d-0x0;var _0x17c9eb=_0x7a54[_0x1da24d];return _0x17c9eb;};'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 dd7d669..9713ca0 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 _0x3140=['include','map','model','then','GetCampaign','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','Campaign','findAll','options','where','attributes','limit'];(function(_0x91fbca,_0x249f60){var _0x582ad8=function(_0x248c20){while(--_0x248c20){_0x91fbca['push'](_0x91fbca['shift']());}};_0x582ad8(++_0x249f60);}(_0x3140,0xaf));var _0x0314=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x3140[_0x3861f7];return _0x50879f;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0314('0x4'))['db'];var utils=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var config=require(_0x0314('0x8'));var jayson=require(_0x0314('0x9'));var client=jayson[_0x0314('0xa')][_0x0314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ee94,_0x44762d,_0x176944){return new BPromise(function(_0x495b27,_0x26031f){return client[_0x0314('0xc')](_0x11ee94,_0x176944)['then'](function(_0x5e9bca){logger[_0x0314('0xd')]('Campaign,\x20%s,\x20%s',_0x44762d,_0x0314('0xe'));logger[_0x0314('0xf')](_0x0314('0x10'),_0x44762d,_0x0314('0xe'),JSON[_0x0314('0x11')](_0x5e9bca));if(_0x5e9bca[_0x0314('0x12')]){if(_0x5e9bca['error'][_0x0314('0x13')]===0x1f4){logger[_0x0314('0x12')](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x26031f(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}logger['error'](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x495b27(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}else{logger[_0x0314('0xd')](_0x0314('0x14'),_0x44762d,_0x0314('0xe'));_0x495b27(_0x5e9bca['result'][_0x0314('0x15')]);}})[_0x0314('0x16')](function(_0x1f23c6){logger['error'](_0x0314('0x14'),_0x44762d,_0x1f23c6);_0x26031f(_0x1f23c6);});});}exports['GetCampaign']=function(_0x575b68){var _0x39db0b=this;return new Promise(function(_0x329679,_0x583d39){return db[_0x0314('0x17')][_0x0314('0x18')]({'raw':_0x575b68['options']?_0x575b68[_0x0314('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1a')]||null:null,'attributes':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1b')]||null:null,'limit':_0x575b68['options']?_0x575b68['options'][_0x0314('0x1c')]||null:null,'include':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1d')]?_[_0x0314('0x1e')](_0x575b68[_0x0314('0x19')]['include'],function(_0x3c743e){return{'model':db[_0x3c743e[_0x0314('0x1f')]],'as':_0x3c743e['as'],'attributes':_0x3c743e['attributes'],'include':_0x3c743e[_0x0314('0x1d')]?_[_0x0314('0x1e')](_0x3c743e[_0x0314('0x1d')],function(_0x26c6a4){return{'model':db[_0x26c6a4[_0x0314('0x1f')]],'as':_0x26c6a4['as'],'attributes':_0x26c6a4[_0x0314('0x1b')],'include':_0x26c6a4['include']?_[_0x0314('0x1e')](_0x26c6a4[_0x0314('0x1d')],function(_0x2d636b){return{'model':db[_0x2d636b['model']],'as':_0x2d636b['as'],'attributes':_0x2d636b[_0x0314('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0314('0x20')](function(_0x47c102){logger['info'](_0x0314('0x21'),_0x575b68);logger[_0x0314('0xf')]('GetCampaign',_0x575b68,JSON[_0x0314('0x11')](_0x47c102));_0x329679(_0x47c102);})[_0x0314('0x16')](function(_0x5291c2){logger['error'](_0x0314('0x21'),_0x5291c2[_0x0314('0x15')],_0x575b68);_0x583d39(_0x39db0b['error'](0x1f4,_0x5291c2[_0x0314('0x15')]));});});}; \ No newline at end of file +var _0x1094=['rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58fc54,_0x1441c6){var _0x304fe5=function(_0x1838c0){while(--_0x1838c0){_0x58fc54['push'](_0x58fc54['shift']());}};_0x304fe5(++_0x1441c6);}(_0x1094,0x143));var _0x4109=function(_0xacd405,_0x2217bb){_0xacd405=_0xacd405-0x0;var _0x57611c=_0x1094[_0xacd405];return _0x57611c;};'use strict';var _=require(_0x4109('0x0'));var util=require(_0x4109('0x1'));var moment=require('moment');var BPromise=require(_0x4109('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4109('0x3'));var db=require(_0x4109('0x4'))['db'];var utils=require(_0x4109('0x5'));var logger=require(_0x4109('0x6'))(_0x4109('0x7'));var config=require('../../config/environment');var jayson=require(_0x4109('0x8'));var client=jayson[_0x4109('0x9')][_0x4109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c3e9,_0xd2df16,_0x2c34f){return new BPromise(function(_0x5512e8,_0x5b4ecf){return client[_0x4109('0xb')](_0x36c3e9,_0x2c34f)[_0x4109('0xc')](function(_0x2fa1d8){logger[_0x4109('0xd')]('Campaign,\x20%s,\x20%s',_0xd2df16,'request\x20sent');logger[_0x4109('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0xd2df16,_0x4109('0xf'),JSON[_0x4109('0x10')](_0x2fa1d8));if(_0x2fa1d8[_0x4109('0x11')]){if(_0x2fa1d8['error'][_0x4109('0x12')]===0x1f4){logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')][_0x4109('0x14')]);return _0x5b4ecf(_0x2fa1d8['error'][_0x4109('0x14')]);}logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')]['message']);return _0x5512e8(_0x2fa1d8['error'][_0x4109('0x14')]);}else{logger[_0x4109('0xd')](_0x4109('0x13'),_0xd2df16,_0x4109('0xf'));_0x5512e8(_0x2fa1d8[_0x4109('0x15')][_0x4109('0x14')]);}})[_0x4109('0x16')](function(_0x3c6542){logger['error']('Campaign,\x20%s,\x20%s',_0xd2df16,_0x3c6542);_0x5b4ecf(_0x3c6542);});});}exports[_0x4109('0x17')]=function(_0x328f1c){var _0x6945ae=this;return new Promise(function(_0x2e3fd6,_0x415e48){return db[_0x4109('0x18')][_0x4109('0x19')]({'raw':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')]['where']||null:null,'attributes':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')]['attributes']||null:null,'limit':_0x328f1c['options']?_0x328f1c[_0x4109('0x1a')]['limit']||null:null,'include':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')][_0x4109('0x1b')]?_[_0x4109('0x1c')](_0x328f1c['options'][_0x4109('0x1b')],function(_0x438f4f){return{'model':db[_0x438f4f[_0x4109('0x1d')]],'as':_0x438f4f['as'],'attributes':_0x438f4f['attributes'],'include':_0x438f4f[_0x4109('0x1b')]?_[_0x4109('0x1c')](_0x438f4f[_0x4109('0x1b')],function(_0x57768e){return{'model':db[_0x57768e['model']],'as':_0x57768e['as'],'attributes':_0x57768e['attributes'],'include':_0x57768e[_0x4109('0x1b')]?_[_0x4109('0x1c')](_0x57768e[_0x4109('0x1b')],function(_0x1ef8fb){return{'model':db[_0x1ef8fb[_0x4109('0x1d')]],'as':_0x1ef8fb['as'],'attributes':_0x1ef8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x4109('0xc')](function(_0x357ce6){logger['info'](_0x4109('0x17'),_0x328f1c);logger['debug'](_0x4109('0x17'),_0x328f1c,JSON[_0x4109('0x10')](_0x357ce6));_0x2e3fd6(_0x357ce6);})[_0x4109('0x16')](function(_0x3165c5){logger[_0x4109('0x11')]('GetCampaign',_0x3165c5[_0x4109('0x14')],_0x328f1c);_0x415e48(_0x6945ae['error'](0x1f4,_0x3165c5[_0x4109('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b097848..d4c73d8 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 _0x3786=['put','update','delete','/:id','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','show','/:id/hoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0x13b947,_0x65c4df){var _0x803766=function(_0x5e363f){while(--_0x5e363f){_0x13b947['push'](_0x13b947['shift']());}};_0x803766(++_0x65c4df);}(_0x3786,0x13b));var _0x6378=function(_0x231422,_0x26fcd3){_0x231422=_0x231422-0x0;var _0x520643=_0x3786[_0x231422];return _0x520643;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6378('0x0'));var timeout=require(_0x6378('0x1'));var express=require(_0x6378('0x2'));var router=express[_0x6378('0x3')]();var fs_extra=require(_0x6378('0x4'));var auth=require(_0x6378('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6378('0x6'));var controller=require(_0x6378('0x7'));router['get']('/',auth[_0x6378('0x8')](),controller[_0x6378('0x9')]);router[_0x6378('0xa')]('/:id',auth[_0x6378('0x8')](),controller[_0x6378('0xb')]);router[_0x6378('0xa')](_0x6378('0xc'),auth[_0x6378('0x8')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x6378('0x8')](),controller['getHopperHistories']);router[_0x6378('0xa')](_0x6378('0xd'),auth[_0x6378('0x8')](),controller[_0x6378('0xe')]);router[_0x6378('0xa')](_0x6378('0xf'),auth[_0x6378('0x8')](),controller['getHopperBlacks']);router[_0x6378('0xa')](_0x6378('0x10'),auth[_0x6378('0x8')](),controller[_0x6378('0x11')]);router['get'](_0x6378('0x12'),auth[_0x6378('0x8')](),controller[_0x6378('0x13')]);router[_0x6378('0x14')]('/',auth[_0x6378('0x8')](),controller[_0x6378('0x15')]);router[_0x6378('0x14')](_0x6378('0x16'),auth['isAuthenticated'](),controller[_0x6378('0x17')]);router[_0x6378('0x14')](_0x6378('0x10'),auth[_0x6378('0x8')](),controller[_0x6378('0x18')]);router[_0x6378('0x14')]('/:id/blacklists',auth[_0x6378('0x8')](),controller[_0x6378('0x19')]);router[_0x6378('0x1a')]('/:id',auth[_0x6378('0x8')](),controller[_0x6378('0x1b')]);router[_0x6378('0x1c')](_0x6378('0x1d'),auth[_0x6378('0x8')](),controller['destroy']);router[_0x6378('0x1c')]('/:id/lists',auth[_0x6378('0x8')](),controller['removeLists']);router[_0x6378('0x1c')](_0x6378('0x12'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x6378('0x1e')]=router; \ No newline at end of file +var _0x4d46=['post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','/:id/lists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','create'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x4d46,0x197));var _0x64d4=function(_0x56f2a4,_0xe6ba2f){_0x56f2a4=_0x56f2a4-0x0;var _0x1fe93c=_0x4d46[_0x56f2a4];return _0x1fe93c;};'use strict';var multer=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var path=require(_0x64d4('0x2'));var timeout=require(_0x64d4('0x3'));var express=require(_0x64d4('0x4'));var router=express[_0x64d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x64d4('0x6'));var interaction=require(_0x64d4('0x7'));var config=require(_0x64d4('0x8'));var controller=require(_0x64d4('0x9'));router[_0x64d4('0xa')]('/',auth[_0x64d4('0xb')](),controller['index']);router[_0x64d4('0xa')](_0x64d4('0xc'),auth['isAuthenticated'](),controller[_0x64d4('0xd')]);router[_0x64d4('0xa')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x64d4('0xb')](),controller[_0x64d4('0xe')]);router[_0x64d4('0xa')](_0x64d4('0xf'),auth[_0x64d4('0xb')](),controller[_0x64d4('0x10')]);router[_0x64d4('0xa')](_0x64d4('0x11'),auth[_0x64d4('0xb')](),controller['getHopperBlacks']);router[_0x64d4('0xa')]('/:id/lists',auth[_0x64d4('0xb')](),controller[_0x64d4('0x12')]);router[_0x64d4('0xa')](_0x64d4('0x13'),auth[_0x64d4('0xb')](),controller[_0x64d4('0x14')]);router['post']('/',auth[_0x64d4('0xb')](),controller[_0x64d4('0x15')]);router[_0x64d4('0x16')](_0x64d4('0x17'),auth[_0x64d4('0xb')](),controller[_0x64d4('0x18')]);router[_0x64d4('0x16')]('/:id/lists',auth[_0x64d4('0xb')](),controller[_0x64d4('0x19')]);router['post'](_0x64d4('0x13'),auth[_0x64d4('0xb')](),controller[_0x64d4('0x1a')]);router[_0x64d4('0x1b')](_0x64d4('0xc'),auth[_0x64d4('0xb')](),controller[_0x64d4('0x1c')]);router[_0x64d4('0x1d')]('/:id',auth[_0x64d4('0xb')](),controller[_0x64d4('0x1e')]);router[_0x64d4('0x1d')](_0x64d4('0x1f'),auth['isAuthenticated'](),controller['removeLists']);router[_0x64d4('0x1d')](_0x64d4('0x13'),auth[_0x64d4('0xb')](),controller['removeBlackLists']);module[_0x64d4('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d3f1afe..3351224 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 _0xd5d6=['STRING','VIRTUAL','getDataValue','sequelize'];(function(_0x1a4de0,_0xd775ac){var _0x179477=function(_0x147d13){while(--_0x147d13){_0x1a4de0['push'](_0x1a4de0['shift']());}};_0x179477(++_0xd775ac);}(_0xd5d6,0x77));var _0x6d5d=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xd5d6[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require(_0x6d5d('0x0'));module['exports']={'key':{'type':Sequelize[_0x6d5d('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6d5d('0x2')],'get':function(){return this[_0x6d5d('0x3')]('key');}}}; \ No newline at end of file +var _0x9b21=['getDataValue','key','STRING','TEXT'];(function(_0x397524,_0x1340ff){var _0x42b4dc=function(_0x5bd77c){while(--_0x5bd77c){_0x397524['push'](_0x397524['shift']());}};_0x42b4dc(++_0x1340ff);}(_0x9b21,0x116));var _0x19b2=function(_0x267c76,_0x292eeb){_0x267c76=_0x267c76-0x0;var _0x571dad=_0x9b21[_0x267c76];return _0x571dad;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x19b2('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x19b2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x19b2('0x0')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x19b2('0x2')](_0x19b2('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5a97670..ddaa053 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 _0xe3b6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','filter','options','CannedAnswer','includeAll','findAll','catch','keys','include','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xe3b6,0x175));var _0x6e3b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe3b6[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x6e3b('0x0'));var rimraf=require(_0x6e3b('0x1'));var zipdir=require(_0x6e3b('0x2'));var jsonpatch=require(_0x6e3b('0x3'));var rp=require(_0x6e3b('0x4'));var moment=require(_0x6e3b('0x5'));var BPromise=require(_0x6e3b('0x6'));var Mustache=require(_0x6e3b('0x7'));var util=require(_0x6e3b('0x8'));var path=require(_0x6e3b('0x9'));var sox=require(_0x6e3b('0xa'));var csv=require('to-csv');var ejs=require(_0x6e3b('0xb'));var fs=require('fs');var fs_extra=require(_0x6e3b('0xc'));var _=require('lodash');var squel=require(_0x6e3b('0xd'));var crypto=require(_0x6e3b('0xe'));var jsforce=require(_0x6e3b('0xf'));var deskjs=require(_0x6e3b('0x10'));var toCsv=require(_0x6e3b('0x11'));var querystring=require(_0x6e3b('0x12'));var Papa=require(_0x6e3b('0x13'));var Redis=require(_0x6e3b('0x14'));var authService=require(_0x6e3b('0x15'));var qs=require(_0x6e3b('0x16'));var as=require(_0x6e3b('0x17'));var hardwareService=require(_0x6e3b('0x18'));var logger=require(_0x6e3b('0x19'))(_0x6e3b('0x1a'));var utils=require(_0x6e3b('0x1b'));var config=require(_0x6e3b('0x1c'));var licenseUtil=require(_0x6e3b('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9882,_0xb464c4){_0xb464c4=_0xb464c4||0xcc;return function(_0x5b2657){if(_0x5b2657){return _0x3c9882['sendStatus'](_0xb464c4);}return _0x3c9882[_0x6e3b('0x1e')](_0xb464c4)[_0x6e3b('0x1f')]();};}function respondWithResult(_0x1884d7,_0x51f07c){_0x51f07c=_0x51f07c||0xc8;return function(_0x48900b){if(_0x48900b){return _0x1884d7[_0x6e3b('0x1e')](_0x51f07c)[_0x6e3b('0x20')](_0x48900b);}};}function respondWithFilteredResult(_0x81d6dc,_0x43063a){return function(_0x1b598f){if(_0x1b598f){var _0x3de81a=typeof _0x43063a[_0x6e3b('0x21')]===_0x6e3b('0x22')&&typeof _0x43063a[_0x6e3b('0x23')]===_0x6e3b('0x22');var _0x1ebd9d=_0x1b598f[_0x6e3b('0x24')];var _0x322fbb=_0x3de81a?0x0:_0x43063a[_0x6e3b('0x21')];var _0x298353=_0x3de81a?_0x1b598f[_0x6e3b('0x24')]:_0x43063a['offset']+_0x43063a[_0x6e3b('0x23')];var _0x2cdd80;if(_0x298353>=_0x1ebd9d){_0x298353=_0x1ebd9d;_0x2cdd80=0xc8;}else{_0x2cdd80=0xce;}_0x81d6dc[_0x6e3b('0x1e')](_0x2cdd80);return _0x81d6dc[_0x6e3b('0x25')](_0x6e3b('0x26'),_0x322fbb+'-'+_0x298353+'/'+_0x1ebd9d)[_0x6e3b('0x20')](_0x1b598f);}return null;};}function patchUpdates(_0x57c033){return function(_0x817739){try{jsonpatch[_0x6e3b('0x27')](_0x817739,_0x57c033,!![]);}catch(_0x45e48d){return BPromise[_0x6e3b('0x28')](_0x45e48d);}return _0x817739[_0x6e3b('0x29')]();};}function saveUpdates(_0x3b4d20,_0x3a9319){return function(_0x43389e){if(_0x43389e){return _0x43389e[_0x6e3b('0x2a')](_0x3b4d20)[_0x6e3b('0x2b')](function(_0x4f4a8c){return _0x4f4a8c;});}return null;};}function removeEntity(_0x15d341,_0x38e5e2){return function(_0x5c1386){if(_0x5c1386){return _0x5c1386[_0x6e3b('0x2c')]()[_0x6e3b('0x2b')](function(){var _0xe8dc86=_0x5c1386[_0x6e3b('0x2d')]({'plain':!![]});var _0x5ec906=_0x6e3b('0x2e');return db['UserProfileResource'][_0x6e3b('0x2c')]({'where':{'type':_0x5ec906,'resourceId':_0xe8dc86['id']}})['then'](function(){return _0x5c1386;});})[_0x6e3b('0x2b')](function(){_0x15d341['status'](0xcc)[_0x6e3b('0x1f')]();});}};}function handleEntityNotFound(_0x3df6a1,_0x27a63d){return function(_0x3ba9f6){if(!_0x3ba9f6){_0x3df6a1[_0x6e3b('0x2f')](0x194);}return _0x3ba9f6;};}function handleError(_0x3d375c,_0x3b790d){_0x3b790d=_0x3b790d||0x1f4;return function(_0x5549b6){logger['error'](_0x5549b6[_0x6e3b('0x30')]);if(_0x5549b6['name']){delete _0x5549b6[_0x6e3b('0x31')];}_0x3d375c['status'](_0x3b790d)[_0x6e3b('0x32')](_0x5549b6);};}exports[_0x6e3b('0x33')]=function(_0x10f630,_0x41868d){var _0x15e907={},_0x5b68a1={},_0x5e78f0={'count':0x0,'rows':[]};var _0x2495a3=_['map'](db['CannedAnswer'][_0x6e3b('0x34')],function(_0x5b82c2){return{'name':_0x5b82c2[_0x6e3b('0x35')],'type':_0x5b82c2['type'][_0x6e3b('0x36')]};});_0x5b68a1[_0x6e3b('0x37')]=_['map'](_0x2495a3,'name');_0x5b68a1[_0x6e3b('0x38')]=_['keys'](_0x10f630[_0x6e3b('0x38')]);_0x5b68a1[_0x6e3b('0x39')]=_[_0x6e3b('0x3a')](_0x5b68a1['model'],_0x5b68a1[_0x6e3b('0x38')]);_0x15e907['attributes']=_[_0x6e3b('0x3a')](_0x5b68a1[_0x6e3b('0x37')],qs['fields'](_0x10f630['query'][_0x6e3b('0x3b')]));_0x15e907['attributes']=_0x15e907[_0x6e3b('0x3c')][_0x6e3b('0x3d')]?_0x15e907[_0x6e3b('0x3c')]:_0x5b68a1[_0x6e3b('0x37')];if(!_0x10f630[_0x6e3b('0x38')]['hasOwnProperty'](_0x6e3b('0x3e'))){_0x15e907['limit']=qs[_0x6e3b('0x23')](_0x10f630[_0x6e3b('0x38')]['limit']);_0x15e907[_0x6e3b('0x21')]=qs['offset'](_0x10f630[_0x6e3b('0x38')][_0x6e3b('0x21')]);}_0x15e907[_0x6e3b('0x3f')]=qs[_0x6e3b('0x40')](_0x10f630['query'][_0x6e3b('0x40')]);_0x15e907['where']=qs[_0x6e3b('0x39')](_[_0x6e3b('0x41')](_0x10f630[_0x6e3b('0x38')],_0x5b68a1[_0x6e3b('0x39')]),_0x2495a3);if(_0x10f630[_0x6e3b('0x38')]['filter']){_0x15e907[_0x6e3b('0x42')]=_[_0x6e3b('0x43')](_0x15e907[_0x6e3b('0x42')],{'$or':[{'key':{'$like':'%'+_0x10f630[_0x6e3b('0x38')][_0x6e3b('0x44')]+'%'}},{'value':{'$like':'%'+_0x10f630['query']['filter']+'%'}}]});}_0x15e907=_[_0x6e3b('0x43')]({},_0x15e907,_0x10f630[_0x6e3b('0x45')]);var _0x4692fb={'where':_0x15e907[_0x6e3b('0x42')]};return db[_0x6e3b('0x46')][_0x6e3b('0x24')](_0x4692fb)[_0x6e3b('0x2b')](function(_0xe60155){_0x5e78f0[_0x6e3b('0x24')]=_0xe60155;if(_0x10f630[_0x6e3b('0x38')][_0x6e3b('0x47')]){_0x15e907['include']=[{'all':!![]}];}return db[_0x6e3b('0x46')][_0x6e3b('0x48')](_0x15e907);})[_0x6e3b('0x2b')](function(_0x430ab5){_0x5e78f0['rows']=_0x430ab5;return _0x5e78f0;})[_0x6e3b('0x2b')](respondWithFilteredResult(_0x41868d,_0x15e907))[_0x6e3b('0x49')](handleError(_0x41868d,null));};exports['show']=function(_0x268b9d,_0xa934e5){var _0x464c17={'raw':!![],'where':{'id':_0x268b9d['params']['id']}},_0x402723={};_0x402723[_0x6e3b('0x37')]=_[_0x6e3b('0x4a')](db[_0x6e3b('0x46')][_0x6e3b('0x34')]);_0x402723[_0x6e3b('0x38')]=_[_0x6e3b('0x4a')](_0x268b9d[_0x6e3b('0x38')]);_0x402723[_0x6e3b('0x39')]=_['intersection'](_0x402723[_0x6e3b('0x37')],_0x402723[_0x6e3b('0x38')]);_0x464c17[_0x6e3b('0x3c')]=_[_0x6e3b('0x3a')](_0x402723[_0x6e3b('0x37')],qs[_0x6e3b('0x3b')](_0x268b9d[_0x6e3b('0x38')][_0x6e3b('0x3b')]));_0x464c17[_0x6e3b('0x3c')]=_0x464c17[_0x6e3b('0x3c')]['length']?_0x464c17[_0x6e3b('0x3c')]:_0x402723['model'];if(_0x268b9d[_0x6e3b('0x38')][_0x6e3b('0x47')]){_0x464c17[_0x6e3b('0x4b')]=[{'all':!![]}];}_0x464c17=_[_0x6e3b('0x43')]({},_0x464c17,_0x268b9d[_0x6e3b('0x45')]);return db['CannedAnswer'][_0x6e3b('0x4c')](_0x464c17)[_0x6e3b('0x2b')](handleEntityNotFound(_0xa934e5,null))[_0x6e3b('0x2b')](respondWithResult(_0xa934e5,null))[_0x6e3b('0x49')](handleError(_0xa934e5,null));};exports[_0x6e3b('0x2a')]=function(_0x247a87,_0xa93483){if(_0x247a87[_0x6e3b('0x4d')]['id']){delete _0x247a87[_0x6e3b('0x4d')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x247a87[_0x6e3b('0x4e')]['id']}})[_0x6e3b('0x2b')](handleEntityNotFound(_0xa93483,null))[_0x6e3b('0x2b')](saveUpdates(_0x247a87[_0x6e3b('0x4d')],null))[_0x6e3b('0x2b')](respondWithResult(_0xa93483,null))[_0x6e3b('0x49')](handleError(_0xa93483,null));};exports[_0x6e3b('0x2c')]=function(_0x20f950,_0x40a51e){return db[_0x6e3b('0x46')][_0x6e3b('0x4c')]({'where':{'id':_0x20f950['params']['id']}})['then'](handleEntityNotFound(_0x40a51e,null))[_0x6e3b('0x2b')](removeEntity(_0x40a51e,null))[_0x6e3b('0x49')](handleError(_0x40a51e,null));};exports[_0x6e3b('0x4f')]=function(_0x355a1a,_0x158953){var _0x11f38f={'key':_0x355a1a['body'][_0x6e3b('0x36')]};if(_0x355a1a[_0x6e3b('0x4d')]['MailAccountId']){_0x11f38f[_0x6e3b('0x50')]=_0x355a1a[_0x6e3b('0x4d')][_0x6e3b('0x50')];}else if(_0x355a1a['body'][_0x6e3b('0x51')]){_0x11f38f[_0x6e3b('0x51')]=_0x355a1a[_0x6e3b('0x4d')][_0x6e3b('0x51')];}else if(_0x355a1a['body'][_0x6e3b('0x52')]){_0x11f38f['OpenchannelAccountId']=_0x355a1a['body'][_0x6e3b('0x52')];}else if(_0x355a1a[_0x6e3b('0x4d')][_0x6e3b('0x53')]){_0x11f38f[_0x6e3b('0x53')]=_0x355a1a['body'][_0x6e3b('0x53')];}return db[_0x6e3b('0x46')][_0x6e3b('0x4c')]({'where':_0x11f38f})['then'](function(_0x5dd18a){if(_0x5dd18a){throw new db[(_0x6e3b('0x54'))][(_0x6e3b('0x55'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x6e3b('0x46')][_0x6e3b('0x4f')](_0x355a1a[_0x6e3b('0x4d')]);})[_0x6e3b('0x2b')](function(_0x574a62){var _0x543e99=_0x355a1a[_0x6e3b('0x56')]['get']({'plain':!![]});if(!_0x543e99)throw new Error(_0x6e3b('0x57'));if(_0x543e99[_0x6e3b('0x58')]===_0x6e3b('0x56')){var _0x48e251=_0x574a62[_0x6e3b('0x2d')]({'plain':!![]});return db[_0x6e3b('0x59')]['find']({'where':{'name':_0x6e3b('0x2e'),'userProfileId':_0x543e99[_0x6e3b('0x5a')]},'raw':!![]})['then'](function(_0x5da73d){if(_0x5da73d&&_0x5da73d[_0x6e3b('0x5b')]===0x0){return db[_0x6e3b('0x5c')]['create']({'name':_0x48e251['name'],'resourceId':_0x48e251['id'],'type':_0x5da73d[_0x6e3b('0x31')],'sectionId':_0x5da73d['id']},{})[_0x6e3b('0x2b')](function(){return _0x574a62;});}else{return _0x574a62;}})['catch'](function(_0x16b804){logger['error'](_0x6e3b('0x5d'),_0x16b804);throw _0x16b804;});}return _0x574a62;})['then'](respondWithResult(_0x158953,0xc9))[_0x6e3b('0x49')](handleError(_0x158953,null));}; \ No newline at end of file +var _0x1fc0=['find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','apply','reject','then','UserProfileResource','destroy','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','includeAll','options'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0x1fc0,0x69));var _0x01fc=function(_0x277027,_0x77b687){_0x277027=_0x277027-0x0;var _0x166f4f=_0x1fc0[_0x277027];return _0x166f4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01fc('0x0'));var zipdir=require(_0x01fc('0x1'));var jsonpatch=require(_0x01fc('0x2'));var rp=require('request-promise');var moment=require(_0x01fc('0x3'));var BPromise=require(_0x01fc('0x4'));var Mustache=require(_0x01fc('0x5'));var util=require(_0x01fc('0x6'));var path=require(_0x01fc('0x7'));var sox=require(_0x01fc('0x8'));var csv=require(_0x01fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x01fc('0xa'));var crypto=require(_0x01fc('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x01fc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x01fc('0xc'));var authService=require(_0x01fc('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x01fc('0xe'));var hardwareService=require(_0x01fc('0xf'));var logger=require(_0x01fc('0x10'))(_0x01fc('0x11'));var utils=require(_0x01fc('0x12'));var config=require(_0x01fc('0x13'));var licenseUtil=require(_0x01fc('0x14'));var db=require(_0x01fc('0x15'))['db'];function respondWithStatusCode(_0x273e8d,_0x5ebc4b){_0x5ebc4b=_0x5ebc4b||0xcc;return function(_0x34e665){if(_0x34e665){return _0x273e8d[_0x01fc('0x16')](_0x5ebc4b);}return _0x273e8d['status'](_0x5ebc4b)[_0x01fc('0x17')]();};}function respondWithResult(_0x76287,_0xcfe392){_0xcfe392=_0xcfe392||0xc8;return function(_0x2f777d){if(_0x2f777d){return _0x76287[_0x01fc('0x18')](_0xcfe392)[_0x01fc('0x19')](_0x2f777d);}};}function respondWithFilteredResult(_0x2afea7,_0x2b96ce){return function(_0x4de370){if(_0x4de370){var _0x58a716=typeof _0x2b96ce[_0x01fc('0x1a')]===_0x01fc('0x1b')&&typeof _0x2b96ce['limit']===_0x01fc('0x1b');var _0xe84d5e=_0x4de370[_0x01fc('0x1c')];var _0xb0e2ce=_0x58a716?0x0:_0x2b96ce[_0x01fc('0x1a')];var _0x256c04=_0x58a716?_0x4de370[_0x01fc('0x1c')]:_0x2b96ce[_0x01fc('0x1a')]+_0x2b96ce['limit'];var _0x36df62;if(_0x256c04>=_0xe84d5e){_0x256c04=_0xe84d5e;_0x36df62=0xc8;}else{_0x36df62=0xce;}_0x2afea7[_0x01fc('0x18')](_0x36df62);return _0x2afea7['set']('Content-Range',_0xb0e2ce+'-'+_0x256c04+'/'+_0xe84d5e)[_0x01fc('0x19')](_0x4de370);}return null;};}function patchUpdates(_0x546058){return function(_0x44d3dc){try{jsonpatch[_0x01fc('0x1d')](_0x44d3dc,_0x546058,!![]);}catch(_0x3ddee9){return BPromise[_0x01fc('0x1e')](_0x3ddee9);}return _0x44d3dc['save']();};}function saveUpdates(_0x269a86,_0x1df424){return function(_0x153fd3){if(_0x153fd3){return _0x153fd3['update'](_0x269a86)[_0x01fc('0x1f')](function(_0xf4726c){return _0xf4726c;});}return null;};}function removeEntity(_0x1790a6,_0x1906ca){return function(_0x2bb84f){if(_0x2bb84f){return _0x2bb84f['destroy']()['then'](function(){var _0xd11537=_0x2bb84f['get']({'plain':!![]});var _0x6f5f83='CannedAnswers';return db[_0x01fc('0x20')][_0x01fc('0x21')]({'where':{'type':_0x6f5f83,'resourceId':_0xd11537['id']}})[_0x01fc('0x1f')](function(){return _0x2bb84f;});})[_0x01fc('0x1f')](function(){_0x1790a6[_0x01fc('0x18')](0xcc)[_0x01fc('0x17')]();});}};}function handleEntityNotFound(_0x30486d,_0xb7d9e3){return function(_0x139e3c){if(!_0x139e3c){_0x30486d[_0x01fc('0x16')](0x194);}return _0x139e3c;};}function handleError(_0x276a94,_0x521537){_0x521537=_0x521537||0x1f4;return function(_0x3fceb3){logger[_0x01fc('0x22')](_0x3fceb3['stack']);if(_0x3fceb3['name']){delete _0x3fceb3[_0x01fc('0x23')];}_0x276a94[_0x01fc('0x18')](_0x521537)[_0x01fc('0x24')](_0x3fceb3);};}exports[_0x01fc('0x25')]=function(_0x1e50c3,_0x2a3172){var _0x4a6b40={},_0x5bde3f={},_0x2f3245={'count':0x0,'rows':[]};var _0x1fa370=_[_0x01fc('0x26')](db[_0x01fc('0x27')][_0x01fc('0x28')],function(_0x3a701b){return{'name':_0x3a701b[_0x01fc('0x29')],'type':_0x3a701b[_0x01fc('0x2a')]['key']};});_0x5bde3f[_0x01fc('0x2b')]=_['map'](_0x1fa370,_0x01fc('0x23'));_0x5bde3f[_0x01fc('0x2c')]=_[_0x01fc('0x2d')](_0x1e50c3[_0x01fc('0x2c')]);_0x5bde3f[_0x01fc('0x2e')]=_['intersection'](_0x5bde3f[_0x01fc('0x2b')],_0x5bde3f[_0x01fc('0x2c')]);_0x4a6b40[_0x01fc('0x2f')]=_[_0x01fc('0x30')](_0x5bde3f[_0x01fc('0x2b')],qs[_0x01fc('0x31')](_0x1e50c3[_0x01fc('0x2c')][_0x01fc('0x31')]));_0x4a6b40['attributes']=_0x4a6b40[_0x01fc('0x2f')][_0x01fc('0x32')]?_0x4a6b40[_0x01fc('0x2f')]:_0x5bde3f[_0x01fc('0x2b')];if(!_0x1e50c3['query'][_0x01fc('0x33')](_0x01fc('0x34'))){_0x4a6b40[_0x01fc('0x35')]=qs[_0x01fc('0x35')](_0x1e50c3[_0x01fc('0x2c')]['limit']);_0x4a6b40['offset']=qs[_0x01fc('0x1a')](_0x1e50c3[_0x01fc('0x2c')]['offset']);}_0x4a6b40[_0x01fc('0x36')]=qs[_0x01fc('0x37')](_0x1e50c3['query']['sort']);_0x4a6b40[_0x01fc('0x38')]=qs[_0x01fc('0x2e')](_[_0x01fc('0x39')](_0x1e50c3[_0x01fc('0x2c')],_0x5bde3f[_0x01fc('0x2e')]),_0x1fa370);if(_0x1e50c3[_0x01fc('0x2c')][_0x01fc('0x3a')]){_0x4a6b40[_0x01fc('0x38')]=_[_0x01fc('0x3b')](_0x4a6b40[_0x01fc('0x38')],{'$or':[{'key':{'$like':'%'+_0x1e50c3[_0x01fc('0x2c')][_0x01fc('0x3a')]+'%'}},{'value':{'$like':'%'+_0x1e50c3[_0x01fc('0x2c')][_0x01fc('0x3a')]+'%'}}]});}_0x4a6b40=_[_0x01fc('0x3b')]({},_0x4a6b40,_0x1e50c3['options']);var _0x43eed6={'where':_0x4a6b40['where']};return db[_0x01fc('0x27')]['count'](_0x43eed6)[_0x01fc('0x1f')](function(_0x4258a5){_0x2f3245['count']=_0x4258a5;if(_0x1e50c3[_0x01fc('0x2c')]['includeAll']){_0x4a6b40[_0x01fc('0x3c')]=[{'all':!![]}];}return db[_0x01fc('0x27')]['findAll'](_0x4a6b40);})[_0x01fc('0x1f')](function(_0x4a5e34){_0x2f3245[_0x01fc('0x3d')]=_0x4a5e34;return _0x2f3245;})[_0x01fc('0x1f')](respondWithFilteredResult(_0x2a3172,_0x4a6b40))[_0x01fc('0x3e')](handleError(_0x2a3172,null));};exports[_0x01fc('0x3f')]=function(_0x1ea7c8,_0x91fb36){var _0xbbbee={'raw':!![],'where':{'id':_0x1ea7c8[_0x01fc('0x40')]['id']}},_0xf387f={};_0xf387f[_0x01fc('0x2b')]=_[_0x01fc('0x2d')](db['CannedAnswer']['rawAttributes']);_0xf387f[_0x01fc('0x2c')]=_[_0x01fc('0x2d')](_0x1ea7c8['query']);_0xf387f[_0x01fc('0x2e')]=_[_0x01fc('0x30')](_0xf387f[_0x01fc('0x2b')],_0xf387f[_0x01fc('0x2c')]);_0xbbbee[_0x01fc('0x2f')]=_[_0x01fc('0x30')](_0xf387f[_0x01fc('0x2b')],qs[_0x01fc('0x31')](_0x1ea7c8[_0x01fc('0x2c')][_0x01fc('0x31')]));_0xbbbee[_0x01fc('0x2f')]=_0xbbbee['attributes'][_0x01fc('0x32')]?_0xbbbee[_0x01fc('0x2f')]:_0xf387f[_0x01fc('0x2b')];if(_0x1ea7c8['query'][_0x01fc('0x41')]){_0xbbbee[_0x01fc('0x3c')]=[{'all':!![]}];}_0xbbbee=_[_0x01fc('0x3b')]({},_0xbbbee,_0x1ea7c8[_0x01fc('0x42')]);return db[_0x01fc('0x27')][_0x01fc('0x43')](_0xbbbee)[_0x01fc('0x1f')](handleEntityNotFound(_0x91fb36,null))['then'](respondWithResult(_0x91fb36,null))[_0x01fc('0x3e')](handleError(_0x91fb36,null));};exports['update']=function(_0x154d12,_0xaac317){if(_0x154d12[_0x01fc('0x44')]['id']){delete _0x154d12[_0x01fc('0x44')]['id'];}return db[_0x01fc('0x27')][_0x01fc('0x43')]({'where':{'id':_0x154d12[_0x01fc('0x40')]['id']}})[_0x01fc('0x1f')](handleEntityNotFound(_0xaac317,null))[_0x01fc('0x1f')](saveUpdates(_0x154d12['body'],null))['then'](respondWithResult(_0xaac317,null))['catch'](handleError(_0xaac317,null));};exports[_0x01fc('0x21')]=function(_0x100180,_0xf56e2){return db[_0x01fc('0x27')][_0x01fc('0x43')]({'where':{'id':_0x100180['params']['id']}})[_0x01fc('0x1f')](handleEntityNotFound(_0xf56e2,null))['then'](removeEntity(_0xf56e2,null))[_0x01fc('0x3e')](handleError(_0xf56e2,null));};exports[_0x01fc('0x45')]=function(_0x57655f,_0x9c9c5f){var _0x2a85a3={'key':_0x57655f['body']['key']};if(_0x57655f['body'][_0x01fc('0x46')]){_0x2a85a3['MailAccountId']=_0x57655f[_0x01fc('0x44')][_0x01fc('0x46')];}else if(_0x57655f[_0x01fc('0x44')][_0x01fc('0x47')]){_0x2a85a3[_0x01fc('0x47')]=_0x57655f[_0x01fc('0x44')]['SmsAccountId'];}else if(_0x57655f[_0x01fc('0x44')][_0x01fc('0x48')]){_0x2a85a3[_0x01fc('0x48')]=_0x57655f['body'][_0x01fc('0x48')];}else if(_0x57655f['body'][_0x01fc('0x49')]){_0x2a85a3[_0x01fc('0x49')]=_0x57655f[_0x01fc('0x44')][_0x01fc('0x49')];}return db[_0x01fc('0x27')][_0x01fc('0x43')]({'where':_0x2a85a3})[_0x01fc('0x1f')](function(_0x4e1c28){if(_0x4e1c28){throw new db[(_0x01fc('0x4a'))][(_0x01fc('0x4b'))](_0x01fc('0x4c'));}return db[_0x01fc('0x27')]['create'](_0x57655f['body']);})[_0x01fc('0x1f')](function(_0x1f37cc){var _0xe978ed=_0x57655f[_0x01fc('0x4d')]['get']({'plain':!![]});if(!_0xe978ed)throw new Error(_0x01fc('0x4e'));if(_0xe978ed[_0x01fc('0x4f')]===_0x01fc('0x4d')){var _0x15c8d8=_0x1f37cc[_0x01fc('0x50')]({'plain':!![]});return db[_0x01fc('0x51')][_0x01fc('0x43')]({'where':{'name':_0x01fc('0x52'),'userProfileId':_0xe978ed[_0x01fc('0x53')]},'raw':!![]})['then'](function(_0x300f29){if(_0x300f29&&_0x300f29[_0x01fc('0x54')]===0x0){return db[_0x01fc('0x20')]['create']({'name':_0x15c8d8[_0x01fc('0x23')],'resourceId':_0x15c8d8['id'],'type':_0x300f29[_0x01fc('0x23')],'sectionId':_0x300f29['id']},{})['then'](function(){return _0x1f37cc;});}else{return _0x1f37cc;}})[_0x01fc('0x3e')](function(_0x5cccfd){logger[_0x01fc('0x22')](_0x01fc('0x55'),_0x5cccfd);throw _0x5cccfd;});}return _0x1f37cc;})[_0x01fc('0x1f')](respondWithResult(_0x9c9c5f,0xc9))[_0x01fc('0x3e')](handleError(_0x9c9c5f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2be989a..165ddd6 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 _0xad06=['api','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad06,0xa7));var _0x6ad0=function(_0xc9584,_0x2b670b){_0xc9584=_0xc9584-0x0;var _0x2bb31f=_0xad06[_0xc9584];return _0x2bb31f;};'use strict';var _=require(_0x6ad0('0x0'));var util=require(_0x6ad0('0x1'));var logger=require('../../config/logger')(_0x6ad0('0x2'));var moment=require('moment');var BPromise=require(_0x6ad0('0x3'));var rp=require(_0x6ad0('0x4'));var fs=require('fs');var path=require(_0x6ad0('0x5'));var rimraf=require('rimraf');var config=require(_0x6ad0('0x6'));var attributes=require(_0x6ad0('0x7'));module['exports']=function(_0x143e28,_0xc28ac0){return _0x143e28[_0x6ad0('0x8')](_0x6ad0('0x9'),attributes,{'tableName':_0x6ad0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ad0('0xb'),'collate':_0x6ad0('0xc')});}; \ No newline at end of file +var _0xbea3=['bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x4de86b,_0x5eb642){var _0x306c57=function(_0x20ab50){while(--_0x20ab50){_0x4de86b['push'](_0x4de86b['shift']());}};_0x306c57(++_0x5eb642);}(_0xbea3,0x137));var _0x3bea=function(_0x3f3586,_0x26fd25){_0x3f3586=_0x3f3586-0x0;var _0x2a1447=_0xbea3[_0x3f3586];return _0x2a1447;};'use strict';var _=require('lodash');var util=require(_0x3bea('0x0'));var logger=require(_0x3bea('0x1'))(_0x3bea('0x2'));var moment=require(_0x3bea('0x3'));var BPromise=require(_0x3bea('0x4'));var rp=require(_0x3bea('0x5'));var fs=require('fs');var path=require(_0x3bea('0x6'));var rimraf=require(_0x3bea('0x7'));var config=require(_0x3bea('0x8'));var attributes=require(_0x3bea('0x9'));module['exports']=function(_0x312af0,_0x492e89){return _0x312af0[_0x3bea('0xa')](_0x3bea('0xb'),attributes,{'tableName':_0x3bea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3bea('0xd'),'collate':_0x3bea('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2fc5a86..4e3ba2b 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(_0x2c4d8e,_0x6ba19a){var _0x1b4bef=function(_0x2ad428){while(--_0x2ad428){_0x2c4d8e['push'](_0x2c4d8e['shift']());}};_0x1b4bef(++_0x6ba19a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x3dfab0,_0x5bbd94){var _0x400725=function(_0x123a9c){while(--_0x123a9c){_0x3dfab0['push'](_0x3dfab0['shift']());}};_0x400725(++_0x5bbd94);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 da7da72..2ea00fa 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 _0xd469=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x556730,_0x39cbbc){var _0x381001=function(_0x1a2572){while(--_0x1a2572){_0x556730['push'](_0x556730['shift']());}};_0x381001(++_0x39cbbc);}(_0xd469,0xfd));var _0x9d46=function(_0x1ebc40,_0x46811a){_0x1ebc40=_0x1ebc40-0x0;var _0x4565f1=_0xd469[_0x1ebc40];return _0x4565f1;};'use strict';var multer=require(_0x9d46('0x0'));var util=require(_0x9d46('0x1'));var path=require('path');var timeout=require(_0x9d46('0x2'));var express=require(_0x9d46('0x3'));var router=express[_0x9d46('0x4')]();var fs_extra=require(_0x9d46('0x5'));var auth=require(_0x9d46('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d46('0x7'));var controller=require('./cannedAnswer.controller');router[_0x9d46('0x8')]('/',auth[_0x9d46('0x9')](),controller[_0x9d46('0xa')]);router['get']('/:id',auth[_0x9d46('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9d46('0xb')]);router[_0x9d46('0xc')](_0x9d46('0xd'),auth[_0x9d46('0x9')](),controller['update']);router[_0x9d46('0xe')](_0x9d46('0xd'),auth[_0x9d46('0x9')](),controller[_0x9d46('0xf')]);module[_0x9d46('0x10')]=router; \ No newline at end of file +var _0x1e26=['get','/:id','isAuthenticated','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x3735ae,_0x207862){var _0x14de1d=function(_0x512a85){while(--_0x512a85){_0x3735ae['push'](_0x3735ae['shift']());}};_0x14de1d(++_0x207862);}(_0x1e26,0x18f));var _0x61e2=function(_0x5b1dd3,_0x10c1bd){_0x5b1dd3=_0x5b1dd3-0x0;var _0x1609e7=_0x1e26[_0x5b1dd3];return _0x1609e7;};'use strict';var multer=require(_0x61e2('0x0'));var util=require(_0x61e2('0x1'));var path=require(_0x61e2('0x2'));var timeout=require(_0x61e2('0x3'));var express=require(_0x61e2('0x4'));var router=express[_0x61e2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x61e2('0x6'));var config=require(_0x61e2('0x7'));var controller=require(_0x61e2('0x8'));router[_0x61e2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x61e2('0xa'),auth[_0x61e2('0xb')](),controller[_0x61e2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x61e2('0xd')]);router['put'](_0x61e2('0xa'),auth[_0x61e2('0xb')](),controller[_0x61e2('0xe')]);router[_0x61e2('0xf')](_0x61e2('0xa'),auth[_0x61e2('0xb')](),controller['destroy']);module[_0x61e2('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 3209c15..61e0e05 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 _0x87ae=['STRING','INTEGER','DATE'];(function(_0x48bb79,_0x2cbd8a){var _0x50d40c=function(_0x5a6a52){while(--_0x5a6a52){_0x48bb79['push'](_0x48bb79['shift']());}};_0x50d40c(++_0x2cbd8a);}(_0x87ae,0xf5));var _0xe87a=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x87ae[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xe87a('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xe87a('0x1')]},'dst':{'type':Sequelize[_0xe87a('0x1')]},'dcontext':{'type':Sequelize[_0xe87a('0x1')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xe87a('0x1')]},'lastapp':{'type':Sequelize[_0xe87a('0x1')]},'lastdata':{'type':Sequelize[_0xe87a('0x1')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe87a('0x1')]},'amaflags':{'type':Sequelize[_0xe87a('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe87a('0x1')]},'uniqueid':{'type':Sequelize[_0xe87a('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe87a('0x1')]},'peeraccount':{'type':Sequelize[_0xe87a('0x1')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xe87a('0x1')]}}; \ No newline at end of file +var _0x6c6f=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x5ce90b,_0x2dc12a){_0x5ce90b=_0x5ce90b-0x0;var _0xc28eab=_0x6c6f[_0x5ce90b];return _0xc28eab;};'use strict';var Sequelize=require(_0xf6c6('0x0'));module[_0xf6c6('0x1')]={'calldate':{'type':Sequelize[_0xf6c6('0x2')],'allowNull':![],'defaultValue':_0xf6c6('0x3')},'clid':{'type':Sequelize[_0xf6c6('0x4')]},'src':{'type':Sequelize[_0xf6c6('0x4')]},'dst':{'type':Sequelize[_0xf6c6('0x4')]},'dcontext':{'type':Sequelize[_0xf6c6('0x4')]},'channel':{'type':Sequelize[_0xf6c6('0x4')]},'dstchannel':{'type':Sequelize[_0xf6c6('0x4')]},'lastapp':{'type':Sequelize[_0xf6c6('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xf6c6('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf6c6('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf6c6('0x4')]},'uniqueid':{'type':Sequelize[_0xf6c6('0x4')]},'linkedid':{'type':Sequelize[_0xf6c6('0x4')]},'sequence':{'type':Sequelize[_0xf6c6('0x4')]},'peeraccount':{'type':Sequelize[_0xf6c6('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xf6c6('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index da91694..3bd4b7f 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 _0xdd0c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x239013,_0x4b6af3){var _0x1f80af=function(_0x4b9517){while(--_0x4b9517){_0x239013['push'](_0x239013['shift']());}};_0x1f80af(++_0x4b6af3);}(_0xdd0c,0x165));var _0xcdd0=function(_0x569888,_0x1b93c6){_0x569888=_0x569888-0x0;var _0x1d2e0a=_0xdd0c[_0x569888];return _0x1d2e0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd0('0x0'));var zipdir=require(_0xcdd0('0x1'));var jsonpatch=require(_0xcdd0('0x2'));var rp=require('request-promise');var moment=require(_0xcdd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdd0('0x4'));var util=require(_0xcdd0('0x5'));var path=require(_0xcdd0('0x6'));var sox=require(_0xcdd0('0x7'));var csv=require(_0xcdd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd0('0x9'));var _=require(_0xcdd0('0xa'));var squel=require(_0xcdd0('0xb'));var crypto=require(_0xcdd0('0xc'));var jsforce=require(_0xcdd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd0('0xe'));var authService=require(_0xcdd0('0xf'));var qs=require(_0xcdd0('0x10'));var as=require(_0xcdd0('0x11'));var hardwareService=require(_0xcdd0('0x12'));var logger=require(_0xcdd0('0x13'))(_0xcdd0('0x14'));var utils=require(_0xcdd0('0x15'));var config=require(_0xcdd0('0x16'));var licenseUtil=require(_0xcdd0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1ff6,_0x356501){_0x356501=_0x356501||0xcc;return function(_0x14c775){if(_0x14c775){return _0x4a1ff6['sendStatus'](_0x356501);}return _0x4a1ff6[_0xcdd0('0x18')](_0x356501)[_0xcdd0('0x19')]();};}function respondWithResult(_0x4f4aa4,_0x1fc89a){_0x1fc89a=_0x1fc89a||0xc8;return function(_0x1d5bff){if(_0x1d5bff){return _0x4f4aa4[_0xcdd0('0x18')](_0x1fc89a)[_0xcdd0('0x1a')](_0x1d5bff);}};}function respondWithFilteredResult(_0xc1c3d5,_0x52aef5){return function(_0x5b5c06){if(_0x5b5c06){var _0x189f54=typeof _0x52aef5[_0xcdd0('0x1b')]===_0xcdd0('0x1c')&&typeof _0x52aef5[_0xcdd0('0x1d')]===_0xcdd0('0x1c');var _0x3b07a1=_0x5b5c06[_0xcdd0('0x1e')];var _0x2c199f=_0x189f54?0x0:_0x52aef5[_0xcdd0('0x1b')];var _0x14d55b=_0x189f54?_0x5b5c06['count']:_0x52aef5[_0xcdd0('0x1b')]+_0x52aef5[_0xcdd0('0x1d')];var _0x5060fa;if(_0x14d55b>=_0x3b07a1){_0x14d55b=_0x3b07a1;_0x5060fa=0xc8;}else{_0x5060fa=0xce;}_0xc1c3d5['status'](_0x5060fa);return _0xc1c3d5[_0xcdd0('0x1f')](_0xcdd0('0x20'),_0x2c199f+'-'+_0x14d55b+'/'+_0x3b07a1)['json'](_0x5b5c06);}return null;};}function patchUpdates(_0x12128e){return function(_0x4f7325){try{jsonpatch['apply'](_0x4f7325,_0x12128e,!![]);}catch(_0x4d038f){return BPromise[_0xcdd0('0x21')](_0x4d038f);}return _0x4f7325[_0xcdd0('0x22')]();};}function saveUpdates(_0x4afcfa,_0x2ab7e4){return function(_0x31a3e6){if(_0x31a3e6){return _0x31a3e6[_0xcdd0('0x23')](_0x4afcfa)['then'](function(_0x9d4727){return _0x9d4727;});}return null;};}function removeEntity(_0x7be0ac,_0x509e9c){return function(_0x3c81b1){if(_0x3c81b1){return _0x3c81b1[_0xcdd0('0x24')]()['then'](function(){_0x7be0ac[_0xcdd0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3797c2,_0x64b52){return function(_0x476018){if(!_0x476018){_0x3797c2['sendStatus'](0x194);}return _0x476018;};}function handleError(_0x22fd47,_0x10cba2){_0x10cba2=_0x10cba2||0x1f4;return function(_0x5e5cc){logger[_0xcdd0('0x25')](_0x5e5cc[_0xcdd0('0x26')]);if(_0x5e5cc[_0xcdd0('0x27')]){delete _0x5e5cc[_0xcdd0('0x27')];}_0x22fd47[_0xcdd0('0x18')](_0x10cba2)[_0xcdd0('0x28')](_0x5e5cc);};}exports[_0xcdd0('0x29')]=function(_0x4074e0,_0x49cfe0){var _0x28084c={},_0xd6d64f={},_0x1bbe37={'count':0x0,'rows':[]};var _0x5b8635=_[_0xcdd0('0x2a')](db[_0xcdd0('0x2b')][_0xcdd0('0x2c')],function(_0x477d1a){return{'name':_0x477d1a[_0xcdd0('0x2d')],'type':_0x477d1a['type'][_0xcdd0('0x2e')]};});_0xd6d64f[_0xcdd0('0x2f')]=_[_0xcdd0('0x2a')](_0x5b8635,'name');_0xd6d64f['query']=_[_0xcdd0('0x30')](_0x4074e0[_0xcdd0('0x31')]);_0xd6d64f[_0xcdd0('0x32')]=_['intersection'](_0xd6d64f[_0xcdd0('0x2f')],_0xd6d64f[_0xcdd0('0x31')]);_0x28084c['attributes']=_[_0xcdd0('0x33')](_0xd6d64f[_0xcdd0('0x2f')],qs[_0xcdd0('0x34')](_0x4074e0[_0xcdd0('0x31')]['fields']));_0x28084c[_0xcdd0('0x35')]=_0x28084c[_0xcdd0('0x35')]['length']?_0x28084c[_0xcdd0('0x35')]:_0xd6d64f[_0xcdd0('0x2f')];if(!_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x36')]('nolimit')){_0x28084c[_0xcdd0('0x1d')]=qs[_0xcdd0('0x1d')](_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x1d')]);_0x28084c[_0xcdd0('0x1b')]=qs['offset'](_0x4074e0[_0xcdd0('0x31')]['offset']);}_0x28084c['order']=qs['sort'](_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x37')]);_0x28084c[_0xcdd0('0x38')]=qs[_0xcdd0('0x32')](_[_0xcdd0('0x39')](_0x4074e0[_0xcdd0('0x31')],_0xd6d64f[_0xcdd0('0x32')]),_0x5b8635);if(_0x4074e0['query'][_0xcdd0('0x3a')]){_0x28084c[_0xcdd0('0x38')]=_[_0xcdd0('0x3b')](_0x28084c[_0xcdd0('0x38')],{'$or':_['map'](_0x5b8635,function(_0x4934a5){if(_0x4934a5[_0xcdd0('0x3c')]!==_0xcdd0('0x3d')){var _0x47a5f5={};_0x47a5f5[_0x4934a5[_0xcdd0('0x27')]]={'$like':'%'+_0x4074e0[_0xcdd0('0x31')]['filter']+'%'};return _0x47a5f5;}})});}_0x28084c=_[_0xcdd0('0x3b')]({},_0x28084c,_0x4074e0['options']);var _0x41ce22={'where':_0x28084c['where']};return db[_0xcdd0('0x2b')][_0xcdd0('0x1e')](_0x41ce22)[_0xcdd0('0x3e')](function(_0x271f47){_0x1bbe37['count']=_0x271f47;if(_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x3f')]){_0x28084c['include']=[{'all':!![]}];}return db[_0xcdd0('0x2b')][_0xcdd0('0x40')](_0x28084c);})[_0xcdd0('0x3e')](function(_0x27ce74){_0x1bbe37[_0xcdd0('0x41')]=_0x27ce74;return _0x1bbe37;})[_0xcdd0('0x3e')](respondWithFilteredResult(_0x49cfe0,_0x28084c))[_0xcdd0('0x42')](handleError(_0x49cfe0,null));};exports[_0xcdd0('0x43')]=function(_0x375e89,_0xce8a50){var _0x5f0c94={'raw':!![],'where':{'id':_0x375e89['params']['id']}},_0x2718b3={};_0x2718b3['model']=_[_0xcdd0('0x30')](db['Cdr'][_0xcdd0('0x2c')]);_0x2718b3[_0xcdd0('0x31')]=_[_0xcdd0('0x30')](_0x375e89[_0xcdd0('0x31')]);_0x2718b3[_0xcdd0('0x32')]=_['intersection'](_0x2718b3[_0xcdd0('0x2f')],_0x2718b3['query']);_0x5f0c94['attributes']=_[_0xcdd0('0x33')](_0x2718b3[_0xcdd0('0x2f')],qs['fields'](_0x375e89['query']['fields']));_0x5f0c94[_0xcdd0('0x35')]=_0x5f0c94[_0xcdd0('0x35')][_0xcdd0('0x44')]?_0x5f0c94['attributes']:_0x2718b3[_0xcdd0('0x2f')];if(_0x375e89[_0xcdd0('0x31')][_0xcdd0('0x3f')]){_0x5f0c94[_0xcdd0('0x45')]=[{'all':!![]}];}_0x5f0c94=_[_0xcdd0('0x3b')]({},_0x5f0c94,_0x375e89['options']);return db[_0xcdd0('0x2b')]['find'](_0x5f0c94)[_0xcdd0('0x3e')](handleEntityNotFound(_0xce8a50,null))[_0xcdd0('0x3e')](respondWithResult(_0xce8a50,null))[_0xcdd0('0x42')](handleError(_0xce8a50,null));};exports[_0xcdd0('0x46')]=function(_0x265cfb,_0x2fc567){return db[_0xcdd0('0x2b')][_0xcdd0('0x46')](_0x265cfb[_0xcdd0('0x47')],{})[_0xcdd0('0x3e')](respondWithResult(_0x2fc567,0xc9))[_0xcdd0('0x42')](handleError(_0x2fc567,null));};exports[_0xcdd0('0x23')]=function(_0x3afae8,_0x6c2cb8){if(_0x3afae8[_0xcdd0('0x47')]['id']){delete _0x3afae8['body']['id'];}return db[_0xcdd0('0x2b')][_0xcdd0('0x48')]({'where':{'id':_0x3afae8[_0xcdd0('0x49')]['id']}})[_0xcdd0('0x3e')](handleEntityNotFound(_0x6c2cb8,null))[_0xcdd0('0x3e')](saveUpdates(_0x3afae8[_0xcdd0('0x47')],null))[_0xcdd0('0x3e')](respondWithResult(_0x6c2cb8,null))[_0xcdd0('0x42')](handleError(_0x6c2cb8,null));};exports[_0xcdd0('0x24')]=function(_0x214cdd,_0x36156c){return db[_0xcdd0('0x2b')][_0xcdd0('0x48')]({'where':{'id':_0x214cdd[_0xcdd0('0x49')]['id']}})['then'](handleEntityNotFound(_0x36156c,null))[_0xcdd0('0x3e')](removeEntity(_0x36156c,null))[_0xcdd0('0x42')](handleError(_0x36156c,null));};exports[_0xcdd0('0x4a')]=function(_0xc7370e,_0x46c578){return db[_0xcdd0('0x2b')][_0xcdd0('0x4a')]()['then'](respondWithResult(_0x46c578,null))[_0xcdd0('0x42')](handleError(_0x46c578,null));}; \ No newline at end of file +var _0x33c5=['bluebird','mustache','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','Cdr','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','create','body','catch','find','describe','rimraf','zip-dir','request-promise','moment'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x33c5,0xe6));var _0x533c=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x33c5[_0x175e89];return _0x2ed996;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c'));_0x38d886[_0x533c('0x34')]=_[_0x533c('0x35')](_0x425f60[_0x533c('0x34')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x34')]);_0x212d1b[_0x533c('0x38')]=_[_0x533c('0x37')](_0x38d886[_0x533c('0x33')],qs['fields'](_0x425f60[_0x533c('0x34')][_0x533c('0x39')]));_0x212d1b[_0x533c('0x38')]=_0x212d1b[_0x533c('0x38')]['length']?_0x212d1b[_0x533c('0x38')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x34')][_0x533c('0x3a')](_0x533c('0x3b'))){_0x212d1b['limit']=qs['limit'](_0x425f60['query']['limit']);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b['order']=qs[_0x533c('0x3c')](_0x425f60[_0x533c('0x34')][_0x533c('0x3c')]);_0x212d1b['where']=qs[_0x533c('0x36')](_[_0x533c('0x3d')](_0x425f60[_0x533c('0x34')],_0x38d886['filters']),_0x2fc7fa);if(_0x425f60[_0x533c('0x34')][_0x533c('0x3e')]){_0x212d1b[_0x533c('0x3f')]=_['merge'](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x2cd02f){if(_0x2cd02f[_0x533c('0x31')]!==_0x533c('0x40')){var _0x4154f9={};_0x4154f9[_0x2cd02f[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x34')][_0x533c('0x3e')]+'%'};return _0x4154f9;}})});}_0x212d1b=_[_0x533c('0x41')]({},_0x212d1b,_0x425f60[_0x533c('0x42')]);var _0x55af6e={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x55af6e)[_0x533c('0x29')](function(_0x29b4c6){_0x3c559b[_0x533c('0x23')]=_0x29b4c6;if(_0x425f60['query'][_0x533c('0x43')]){_0x212d1b[_0x533c('0x44')]=[{'all':!![]}];}return db[_0x533c('0x30')]['findAll'](_0x212d1b);})[_0x533c('0x29')](function(_0x4170e4){_0x3c559b[_0x533c('0x45')]=_0x4170e4;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x4f5e26,_0x22447d){var _0x39034e={'raw':!![],'where':{'id':_0x4f5e26[_0x533c('0x47')]['id']}},_0x55a372={};_0x55a372[_0x533c('0x33')]=_[_0x533c('0x35')](db['Cdr']['rawAttributes']);_0x55a372['query']=_['keys'](_0x4f5e26[_0x533c('0x34')]);_0x55a372['filters']=_[_0x533c('0x37')](_0x55a372['model'],_0x55a372[_0x533c('0x34')]);_0x39034e['attributes']=_[_0x533c('0x37')](_0x55a372[_0x533c('0x33')],qs['fields'](_0x4f5e26[_0x533c('0x34')][_0x533c('0x39')]));_0x39034e[_0x533c('0x38')]=_0x39034e[_0x533c('0x38')][_0x533c('0x48')]?_0x39034e['attributes']:_0x55a372[_0x533c('0x33')];if(_0x4f5e26[_0x533c('0x34')][_0x533c('0x43')]){_0x39034e[_0x533c('0x44')]=[{'all':!![]}];}_0x39034e=_['merge']({},_0x39034e,_0x4f5e26[_0x533c('0x42')]);return db[_0x533c('0x30')]['find'](_0x39034e)['then'](handleEntityNotFound(_0x22447d,null))[_0x533c('0x29')](respondWithResult(_0x22447d,null))['catch'](handleError(_0x22447d,null));};exports[_0x533c('0x49')]=function(_0x2a9186,_0x19878d){return db[_0x533c('0x30')][_0x533c('0x49')](_0x2a9186[_0x533c('0x4a')],{})[_0x533c('0x29')](respondWithResult(_0x19878d,0xc9))[_0x533c('0x4b')](handleError(_0x19878d,null));};exports['update']=function(_0x19ccc0,_0x6b16e1){if(_0x19ccc0[_0x533c('0x4a')]['id']){delete _0x19ccc0['body']['id'];}return db[_0x533c('0x30')][_0x533c('0x4c')]({'where':{'id':_0x19ccc0['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x6b16e1,null))['then'](saveUpdates(_0x19ccc0[_0x533c('0x4a')],null))[_0x533c('0x29')](respondWithResult(_0x6b16e1,null))[_0x533c('0x4b')](handleError(_0x6b16e1,null));};exports[_0x533c('0x2a')]=function(_0x32d110,_0x3c46f3){return db[_0x533c('0x30')]['find']({'where':{'id':_0x32d110[_0x533c('0x47')]['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x3c46f3,null))[_0x533c('0x29')](removeEntity(_0x3c46f3,null))[_0x533c('0x4b')](handleError(_0x3c46f3,null));};exports[_0x533c('0x4d')]=function(_0x1558ef,_0x3eb174){return db['Cdr']['describe']()['then'](respondWithResult(_0x3eb174,null))['catch'](handleError(_0x3eb174,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index fe61065..787696d 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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x22b7a6,_0x3ce62c){var _0x1b750e=function(_0x576272){while(--_0x576272){_0x22b7a6['push'](_0x22b7a6['shift']());}};_0x1b750e(++_0x3ce62c);}(_0x7a54,0x106));var _0x47a5=function(_0x505e7e,_0x558dd6){_0x505e7e=_0x505e7e-0x0;var _0x15dcb5=_0x7a54[_0x505e7e];return _0x15dcb5;};'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 +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x31afd2,_0x1d8eb3){var _0x38459e=function(_0x430ea7){while(--_0x430ea7){_0x31afd2['push'](_0x31afd2['shift']());}};_0x38459e(++_0x1d8eb3);}(_0x7a54,0x106));var _0x47a5=function(_0x69614d,_0x2a8e34){_0x69614d=_0x69614d-0x0;var _0x4a22cc=_0x7a54[_0x69614d];return _0x4a22cc;};'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 3c7db57..29a2e25 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 _0x4b2e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b2e,0x18e));var _0xe4b2=function(_0x2b0aec,_0x86e4ad){_0x2b0aec=_0x2b0aec-0x0;var _0x2aef33=_0x4b2e[_0x2b0aec];return _0x2aef33;};'use strict';var _=require('lodash');var util=require(_0xe4b2('0x0'));var moment=require('moment');var BPromise=require(_0xe4b2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4b2('0x2'));var db=require(_0xe4b2('0x3'))['db'];var utils=require(_0xe4b2('0x4'));var logger=require(_0xe4b2('0x5'))(_0xe4b2('0x6'));var config=require('../../config/environment');var jayson=require(_0xe4b2('0x7'));var client=jayson[_0xe4b2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55a9ea,_0x5a928d,_0x1b4752){return new BPromise(function(_0x2de17f,_0x3dbbf3){return client[_0xe4b2('0x9')](_0x55a9ea,_0x1b4752)[_0xe4b2('0xa')](function(_0x32c69c){logger['info'](_0xe4b2('0xb'),_0x5a928d,_0xe4b2('0xc'));logger[_0xe4b2('0xd')](_0xe4b2('0xe'),_0x5a928d,_0xe4b2('0xc'),JSON['stringify'](_0x32c69c));if(_0x32c69c[_0xe4b2('0xf')]){if(_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x10')]===0x1f4){logger[_0xe4b2('0xf')]('Cdr,\x20%s,\x20%s',_0x5a928d,_0x32c69c['error']['message']);return _0x3dbbf3(_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x11')]);}logger[_0xe4b2('0xf')](_0xe4b2('0xb'),_0x5a928d,_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x11')]);return _0x2de17f(_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x11')]);}else{logger[_0xe4b2('0x12')](_0xe4b2('0xb'),_0x5a928d,'request\x20sent');_0x2de17f(_0x32c69c['result'][_0xe4b2('0x11')]);}})[_0xe4b2('0x13')](function(_0x29c0f8){logger[_0xe4b2('0xf')](_0xe4b2('0xb'),_0x5a928d,_0x29c0f8);_0x3dbbf3(_0x29c0f8);});});} \ No newline at end of file +var _0x7f9c=['request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ced05,_0x5065c7){var _0x2a0e97=function(_0x553759){while(--_0x553759){_0x1ced05['push'](_0x1ced05['shift']());}};_0x2a0e97(++_0x5065c7);}(_0x7f9c,0x64));var _0xc7f9=function(_0x5acbeb,_0x436c9a){_0x5acbeb=_0x5acbeb-0x0;var _0x2be17c=_0x7f9c[_0x5acbeb];return _0x2be17c;};'use strict';var _=require('lodash');var util=require(_0xc7f9('0x0'));var moment=require(_0xc7f9('0x1'));var BPromise=require(_0xc7f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc7f9('0x4'))(_0xc7f9('0x5'));var config=require(_0xc7f9('0x6'));var jayson=require(_0xc7f9('0x7'));var client=jayson[_0xc7f9('0x8')][_0xc7f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22875a,_0x2ddbc0,_0x3bda0f){return new BPromise(function(_0xb33ce5,_0x1c1a99){return client[_0xc7f9('0xa')](_0x22875a,_0x3bda0f)[_0xc7f9('0xb')](function(_0x304728){logger['info'](_0xc7f9('0xc'),_0x2ddbc0,_0xc7f9('0xd'));logger[_0xc7f9('0xe')](_0xc7f9('0xf'),_0x2ddbc0,_0xc7f9('0xd'),JSON[_0xc7f9('0x10')](_0x304728));if(_0x304728[_0xc7f9('0x11')]){if(_0x304728[_0xc7f9('0x11')][_0xc7f9('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x2ddbc0,_0x304728['error']['message']);return _0x1c1a99(_0x304728[_0xc7f9('0x11')][_0xc7f9('0x13')]);}logger[_0xc7f9('0x11')](_0xc7f9('0xc'),_0x2ddbc0,_0x304728[_0xc7f9('0x11')][_0xc7f9('0x13')]);return _0xb33ce5(_0x304728[_0xc7f9('0x11')]['message']);}else{logger[_0xc7f9('0x14')]('Cdr,\x20%s,\x20%s',_0x2ddbc0,_0xc7f9('0xd'));_0xb33ce5(_0x304728[_0xc7f9('0x15')][_0xc7f9('0x13')]);}})['catch'](function(_0x2e36c8){logger[_0xc7f9('0x11')](_0xc7f9('0xc'),_0x2ddbc0,_0x2e36c8);_0x1c1a99(_0x2e36c8);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 1ee97e8..aca2a19 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('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(_0x3799b2,_0x3728da){var _0x1d7571=function(_0x4993b3){while(--_0x4993b3){_0x3799b2['push'](_0x3799b2['shift']());}};_0x1d7571(++_0x3728da);}(_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'));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 86116fb..a1d54b8 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 _0x3017=['*,*,*,*','INTEGER','STRING','TEXT'];(function(_0x5162ed,_0x386cb7){var _0x4c579b=function(_0x189260){while(--_0x189260){_0x5162ed['push'](_0x5162ed['shift']());}};_0x4c579b(++_0x386cb7);}(_0x3017,0x18d));var _0x7301=function(_0x42d902,_0x2ee119){_0x42d902=_0x42d902-0x0;var _0x39db2a=_0x3017[_0x42d902];return _0x39db2a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7301('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7301('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7301('0x2')]()},'description':{'type':Sequelize[_0x7301('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7301('0x3')}}; \ No newline at end of file +var _0xd1ec=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0x3c9ea1,_0x2f930e){var _0x17afda=function(_0x5969e4){while(--_0x5969e4){_0x3c9ea1['push'](_0x3c9ea1['shift']());}};_0x17afda(++_0x2f930e);}(_0xd1ec,0x192));var _0xcd1e=function(_0x332047,_0x5d4b0a){_0x332047=_0x332047-0x0;var _0x40c591=_0xd1ec[_0x332047];return _0x40c591;};'use strict';var Sequelize=require(_0xcd1e('0x0'));module['exports']={'priority':{'type':Sequelize[_0xcd1e('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcd1e('0x2')]()},'description':{'type':Sequelize[_0xcd1e('0x3')]},'interval':{'type':Sequelize[_0xcd1e('0x3')],'defaultValue':_0xcd1e('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e9c1cdb..5dfe09c 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 _0x76bc=['send','params','model','keys','ChatApplication','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','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','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','name'];(function(_0xdd8feb,_0x48cc45){var _0x87ea75=function(_0x2256f5){while(--_0x2256f5){_0xdd8feb['push'](_0xdd8feb['shift']());}};_0x87ea75(++_0x48cc45);}(_0x76bc,0x17f));var _0xc76b=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x76bc[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require(_0xc76b('0x0'));var rimraf=require(_0xc76b('0x1'));var zipdir=require(_0xc76b('0x2'));var jsonpatch=require(_0xc76b('0x3'));var rp=require(_0xc76b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc76b('0x5'));var util=require(_0xc76b('0x6'));var path=require(_0xc76b('0x7'));var sox=require(_0xc76b('0x8'));var csv=require(_0xc76b('0x9'));var ejs=require(_0xc76b('0xa'));var fs=require('fs');var fs_extra=require(_0xc76b('0xb'));var _=require(_0xc76b('0xc'));var squel=require(_0xc76b('0xd'));var crypto=require(_0xc76b('0xe'));var jsforce=require(_0xc76b('0xf'));var deskjs=require(_0xc76b('0x10'));var toCsv=require(_0xc76b('0x9'));var querystring=require(_0xc76b('0x11'));var Papa=require(_0xc76b('0x12'));var Redis=require(_0xc76b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc76b('0x14'));var as=require(_0xc76b('0x15'));var hardwareService=require(_0xc76b('0x16'));var logger=require(_0xc76b('0x17'))(_0xc76b('0x18'));var utils=require(_0xc76b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc76b('0x1a'));var db=require(_0xc76b('0x1b'))['db'];function respondWithStatusCode(_0x30835f,_0xc84b2c){_0xc84b2c=_0xc84b2c||0xcc;return function(_0x4474cd){if(_0x4474cd){return _0x30835f[_0xc76b('0x1c')](_0xc84b2c);}return _0x30835f[_0xc76b('0x1d')](_0xc84b2c)['end']();};}function respondWithResult(_0x538ca8,_0x38a0f1){_0x38a0f1=_0x38a0f1||0xc8;return function(_0x25e4a1){if(_0x25e4a1){return _0x538ca8[_0xc76b('0x1d')](_0x38a0f1)[_0xc76b('0x1e')](_0x25e4a1);}};}function respondWithFilteredResult(_0x25752f,_0x5d1130){return function(_0x21d99a){if(_0x21d99a){var _0x2db167=typeof _0x5d1130[_0xc76b('0x1f')]==='undefined'&&typeof _0x5d1130['limit']===_0xc76b('0x20');var _0x2d3e9d=_0x21d99a[_0xc76b('0x21')];var _0x3e716e=_0x2db167?0x0:_0x5d1130[_0xc76b('0x1f')];var _0x55a61d=_0x2db167?_0x21d99a['count']:_0x5d1130['offset']+_0x5d1130[_0xc76b('0x22')];var _0x164d38;if(_0x55a61d>=_0x2d3e9d){_0x55a61d=_0x2d3e9d;_0x164d38=0xc8;}else{_0x164d38=0xce;}_0x25752f[_0xc76b('0x1d')](_0x164d38);return _0x25752f[_0xc76b('0x23')](_0xc76b('0x24'),_0x3e716e+'-'+_0x55a61d+'/'+_0x2d3e9d)[_0xc76b('0x1e')](_0x21d99a);}return null;};}function patchUpdates(_0x336be9){return function(_0x20aed4){try{jsonpatch[_0xc76b('0x25')](_0x20aed4,_0x336be9,!![]);}catch(_0x393b0b){return BPromise['reject'](_0x393b0b);}return _0x20aed4[_0xc76b('0x26')]();};}function saveUpdates(_0x4bf5a9,_0x51fafe){return function(_0x3bbede){if(_0x3bbede){return _0x3bbede[_0xc76b('0x27')](_0x4bf5a9)[_0xc76b('0x28')](function(_0xac9a7f){return _0xac9a7f;});}return null;};}function removeEntity(_0x18332d,_0xa6a862){return function(_0x24ee9a){if(_0x24ee9a){return _0x24ee9a[_0xc76b('0x29')]()['then'](function(){_0x18332d[_0xc76b('0x1d')](0xcc)[_0xc76b('0x2a')]();});}};}function handleEntityNotFound(_0x5f0a7b,_0xf43320){return function(_0x2ac9de){if(!_0x2ac9de){_0x5f0a7b[_0xc76b('0x1c')](0x194);}return _0x2ac9de;};}function handleError(_0x25ea69,_0x369fc1){_0x369fc1=_0x369fc1||0x1f4;return function(_0x451ee1){logger['error'](_0x451ee1['stack']);if(_0x451ee1[_0xc76b('0x2b')]){delete _0x451ee1[_0xc76b('0x2b')];}_0x25ea69[_0xc76b('0x1d')](_0x369fc1)[_0xc76b('0x2c')](_0x451ee1);};}exports['show']=function(_0xd92178,_0x26c19b){var _0x35d1bc={'raw':!![],'where':{'id':_0xd92178[_0xc76b('0x2d')]['id']}},_0x4a0918={};_0x4a0918[_0xc76b('0x2e')]=_[_0xc76b('0x2f')](db[_0xc76b('0x30')]['rawAttributes']);_0x4a0918[_0xc76b('0x31')]=_[_0xc76b('0x2f')](_0xd92178[_0xc76b('0x31')]);_0x4a0918[_0xc76b('0x32')]=_[_0xc76b('0x33')](_0x4a0918['model'],_0x4a0918[_0xc76b('0x31')]);_0x35d1bc['attributes']=_[_0xc76b('0x33')](_0x4a0918[_0xc76b('0x2e')],qs[_0xc76b('0x34')](_0xd92178[_0xc76b('0x31')][_0xc76b('0x34')]));_0x35d1bc[_0xc76b('0x35')]=_0x35d1bc['attributes']['length']?_0x35d1bc[_0xc76b('0x35')]:_0x4a0918[_0xc76b('0x2e')];if(_0xd92178[_0xc76b('0x31')][_0xc76b('0x36')]){_0x35d1bc[_0xc76b('0x37')]=[{'all':!![]}];}_0x35d1bc=_[_0xc76b('0x38')]({},_0x35d1bc,_0xd92178[_0xc76b('0x39')]);return db[_0xc76b('0x30')][_0xc76b('0x3a')](_0x35d1bc)[_0xc76b('0x28')](handleEntityNotFound(_0x26c19b,null))[_0xc76b('0x28')](respondWithResult(_0x26c19b,null))[_0xc76b('0x3b')](handleError(_0x26c19b,null));};exports[_0xc76b('0x27')]=function(_0x21bc23,_0xb3c2c6){if(_0x21bc23['body']['id']){delete _0x21bc23[_0xc76b('0x3c')]['id'];}return db[_0xc76b('0x30')][_0xc76b('0x3a')]({'where':{'id':_0x21bc23[_0xc76b('0x2d')]['id']}})[_0xc76b('0x28')](handleEntityNotFound(_0xb3c2c6,null))[_0xc76b('0x28')](saveUpdates(_0x21bc23[_0xc76b('0x3c')],null))[_0xc76b('0x28')](respondWithResult(_0xb3c2c6,null))[_0xc76b('0x3b')](handleError(_0xb3c2c6,null));};exports[_0xc76b('0x29')]=function(_0x41d26d,_0x3fc3d7){return db[_0xc76b('0x30')][_0xc76b('0x3a')]({'where':{'id':_0x41d26d['params']['id']}})[_0xc76b('0x28')](handleEntityNotFound(_0x3fc3d7,null))['then'](removeEntity(_0x3fc3d7,null))[_0xc76b('0x3b')](handleError(_0x3fc3d7,null));}; \ No newline at end of file +var _0x34b7=['undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','update','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x18fb42,_0x1f1122){var _0x2665e9=function(_0x538b38){while(--_0x538b38){_0x18fb42['push'](_0x18fb42['shift']());}};_0x2665e9(++_0x1f1122);}(_0x34b7,0x196));var _0x734b=function(_0x2efb96,_0x40a4ce){_0x2efb96=_0x2efb96-0x0;var _0x50d38d=_0x34b7[_0x2efb96];return _0x50d38d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x26')]();});}};}function handleEntityNotFound(_0x3abbe6,_0x44ffa9){return function(_0x148abe){if(!_0x148abe){_0x3abbe6[_0x734b('0x18')](0x194);}return _0x148abe;};}function handleError(_0x566d55,_0x49732b){_0x49732b=_0x49732b||0x1f4;return function(_0x13cc5a){logger[_0x734b('0x27')](_0x13cc5a['stack']);if(_0x13cc5a[_0x734b('0x28')]){delete _0x13cc5a[_0x734b('0x28')];}_0x566d55[_0x734b('0x19')](_0x49732b)[_0x734b('0x29')](_0x13cc5a);};}exports[_0x734b('0x2a')]=function(_0x1b8295,_0x3ba39c){var _0x5c6c5d={'raw':!![],'where':{'id':_0x1b8295[_0x734b('0x2b')]['id']}},_0x1f3652={};_0x1f3652[_0x734b('0x2c')]=_[_0x734b('0x2d')](db[_0x734b('0x2e')][_0x734b('0x2f')]);_0x1f3652[_0x734b('0x30')]=_[_0x734b('0x2d')](_0x1b8295[_0x734b('0x30')]);_0x1f3652[_0x734b('0x31')]=_['intersection'](_0x1f3652[_0x734b('0x2c')],_0x1f3652[_0x734b('0x30')]);_0x5c6c5d['attributes']=_[_0x734b('0x32')](_0x1f3652[_0x734b('0x2c')],qs[_0x734b('0x33')](_0x1b8295[_0x734b('0x30')][_0x734b('0x33')]));_0x5c6c5d[_0x734b('0x34')]=_0x5c6c5d[_0x734b('0x34')][_0x734b('0x35')]?_0x5c6c5d[_0x734b('0x34')]:_0x1f3652[_0x734b('0x2c')];if(_0x1b8295[_0x734b('0x30')][_0x734b('0x36')]){_0x5c6c5d[_0x734b('0x37')]=[{'all':!![]}];}_0x5c6c5d=_[_0x734b('0x38')]({},_0x5c6c5d,_0x1b8295[_0x734b('0x39')]);return db['ChatApplication'][_0x734b('0x3a')](_0x5c6c5d)['then'](handleEntityNotFound(_0x3ba39c,null))[_0x734b('0x24')](respondWithResult(_0x3ba39c,null))[_0x734b('0x3b')](handleError(_0x3ba39c,null));};exports[_0x734b('0x3c')]=function(_0x24b030,_0x19f94d){if(_0x24b030[_0x734b('0x3d')]['id']){delete _0x24b030['body']['id'];}return db['ChatApplication'][_0x734b('0x3a')]({'where':{'id':_0x24b030['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x19f94d,null))['then'](saveUpdates(_0x24b030[_0x734b('0x3d')],null))['then'](respondWithResult(_0x19f94d,null))[_0x734b('0x3b')](handleError(_0x19f94d,null));};exports['destroy']=function(_0x37d891,_0x336859){return db[_0x734b('0x2e')][_0x734b('0x3a')]({'where':{'id':_0x37d891[_0x734b('0x2b')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x336859,null))[_0x734b('0x24')](removeEntity(_0x336859,null))['catch'](handleError(_0x336859,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2636dd8..b639337 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 _0x5da8=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatApplication.attributes','define'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x5da8,0x1cb));var _0x85da=function(_0x56a0ec,_0x4bf91b){_0x56a0ec=_0x56a0ec-0x0;var _0x42966f=_0x5da8[_0x56a0ec];return _0x42966f;};'use strict';var _=require(_0x85da('0x0'));var util=require('util');var logger=require(_0x85da('0x1'))(_0x85da('0x2'));var moment=require(_0x85da('0x3'));var BPromise=require(_0x85da('0x4'));var rp=require(_0x85da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85da('0x6'));var attributes=require(_0x85da('0x7'));module['exports']=function(_0x492f7d,_0x21d7a0){return _0x492f7d[_0x85da('0x8')](_0x85da('0x9'),attributes,{'tableName':_0x85da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x85da('0xb'),'collate':_0x85da('0xc')});}; \ No newline at end of file +var _0x9762=['exports','define','ChatApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatApplication.attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9762,0x19c));var _0x2976=function(_0x553982,_0x17721f){_0x553982=_0x553982-0x0;var _0x2f0882=_0x9762[_0x553982];return _0x2f0882;};'use strict';var _=require('lodash');var util=require(_0x2976('0x0'));var logger=require(_0x2976('0x1'))(_0x2976('0x2'));var moment=require(_0x2976('0x3'));var BPromise=require(_0x2976('0x4'));var rp=require(_0x2976('0x5'));var fs=require('fs');var path=require(_0x2976('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2976('0x7'));module[_0x2976('0x8')]=function(_0x2eb73b,_0x5a9842){return _0x2eb73b[_0x2976('0x9')](_0x2976('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2976('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 47dee06..ca7550d 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 _0x274d=['rpc','../../config/environment','jayson/promise','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../config/logger'];(function(_0x2b4d01,_0x4c6044){var _0x4195d7=function(_0x59935){while(--_0x59935){_0x2b4d01['push'](_0x2b4d01['shift']());}};_0x4195d7(++_0x4c6044);}(_0x274d,0x1b4));var _0xd274=function(_0x1b3884,_0x9aab32){_0x1b3884=_0x1b3884-0x0;var _0x5908ca=_0x274d[_0x1b3884];return _0x5908ca;};'use strict';var _=require(_0xd274('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd274('0x1'));var fs=require('fs');var Redis=require(_0xd274('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd274('0x3'))(_0xd274('0x4'));var config=require(_0xd274('0x5'));var jayson=require(_0xd274('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5dd022,_0x22c2c2,_0x2de697){return new BPromise(function(_0x4732e9,_0x222ac9){return client[_0xd274('0x7')](_0x5dd022,_0x2de697)[_0xd274('0x8')](function(_0x58248e){logger['info'](_0xd274('0x9'),_0x22c2c2,'request\x20sent');logger[_0xd274('0xa')](_0xd274('0xb'),_0x22c2c2,_0xd274('0xc'),JSON[_0xd274('0xd')](_0x58248e));if(_0x58248e[_0xd274('0xe')]){if(_0x58248e['error'][_0xd274('0xf')]===0x1f4){logger[_0xd274('0xe')](_0xd274('0x9'),_0x22c2c2,_0x58248e['error'][_0xd274('0x10')]);return _0x222ac9(_0x58248e[_0xd274('0xe')][_0xd274('0x10')]);}logger[_0xd274('0xe')](_0xd274('0x9'),_0x22c2c2,_0x58248e[_0xd274('0xe')]['message']);return _0x4732e9(_0x58248e[_0xd274('0xe')]['message']);}else{logger[_0xd274('0x11')](_0xd274('0x9'),_0x22c2c2,'request\x20sent');_0x4732e9(_0x58248e[_0xd274('0x12')][_0xd274('0x10')]);}})[_0xd274('0x13')](function(_0x913a48){logger[_0xd274('0xe')](_0xd274('0x9'),_0x22c2c2,_0x913a48);_0x222ac9(_0x913a48);});});} \ No newline at end of file +var _0x422c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring'];(function(_0x3bec10,_0x1e9117){var _0x1da94b=function(_0x51538d){while(--_0x51538d){_0x3bec10['push'](_0x3bec10['shift']());}};_0x1da94b(++_0x1e9117);}(_0x422c,0x14d));var _0xc422=function(_0x3ff2f3,_0x2cf1a5){_0x3ff2f3=_0x3ff2f3-0x0;var _0x415420=_0x422c[_0x3ff2f3];return _0x415420;};'use strict';var _=require('lodash');var util=require(_0xc422('0x0'));var moment=require(_0xc422('0x1'));var BPromise=require('bluebird');var rs=require(_0xc422('0x2'));var fs=require('fs');var Redis=require(_0xc422('0x3'));var db=require(_0xc422('0x4'))['db'];var utils=require(_0xc422('0x5'));var logger=require(_0xc422('0x6'))(_0xc422('0x7'));var config=require(_0xc422('0x8'));var jayson=require(_0xc422('0x9'));var client=jayson[_0xc422('0xa')][_0xc422('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dcc5f,_0x37043f,_0x3fe20d){return new BPromise(function(_0x190d2e,_0x2df07e){return client[_0xc422('0xc')](_0x3dcc5f,_0x3fe20d)[_0xc422('0xd')](function(_0x4ba08e){logger['info'](_0xc422('0xe'),_0x37043f,_0xc422('0xf'));logger[_0xc422('0x10')](_0xc422('0x11'),_0x37043f,_0xc422('0xf'),JSON[_0xc422('0x12')](_0x4ba08e));if(_0x4ba08e[_0xc422('0x13')]){if(_0x4ba08e[_0xc422('0x13')][_0xc422('0x14')]===0x1f4){logger[_0xc422('0x13')](_0xc422('0xe'),_0x37043f,_0x4ba08e[_0xc422('0x13')]['message']);return _0x2df07e(_0x4ba08e[_0xc422('0x13')][_0xc422('0x15')]);}logger[_0xc422('0x13')](_0xc422('0xe'),_0x37043f,_0x4ba08e[_0xc422('0x13')]['message']);return _0x190d2e(_0x4ba08e['error'][_0xc422('0x15')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x37043f,_0xc422('0xf'));_0x190d2e(_0x4ba08e[_0xc422('0x16')][_0xc422('0x15')]);}})[_0xc422('0x17')](function(_0x50e8d3){logger['error'](_0xc422('0xe'),_0x37043f,_0x50e8d3);_0x2df07e(_0x50e8d3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 51611d8..ec83708 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 _0x3766=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3766,0x19b));var _0x6376=function(_0x17c283,_0x587fcc){_0x17c283=_0x17c283-0x0;var _0x4e0800=_0x3766[_0x17c283];return _0x4e0800;};'use strict';var multer=require(_0x6376('0x0'));var util=require(_0x6376('0x1'));var path=require('path');var timeout=require(_0x6376('0x2'));var express=require(_0x6376('0x3'));var router=express[_0x6376('0x4')]();var fs_extra=require(_0x6376('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6376('0x6'));var controller=require(_0x6376('0x7'));router[_0x6376('0x8')]('/:id',auth[_0x6376('0x9')](),controller[_0x6376('0xa')]);router[_0x6376('0xb')]('/:id',auth[_0x6376('0x9')](),controller[_0x6376('0xc')]);router[_0x6376('0xd')](_0x6376('0xe'),auth[_0x6376('0x9')](),controller[_0x6376('0xf')]);module[_0x6376('0x10')]=router; \ No newline at end of file +var _0x2ef4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','delete','exports','multer','util'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0x2ef4,0xfa));var _0x42ef=function(_0x38d034,_0x22f267){_0x38d034=_0x38d034-0x0;var _0x1a3768=_0x2ef4[_0x38d034];return _0x1a3768;};'use strict';var multer=require(_0x42ef('0x0'));var util=require(_0x42ef('0x1'));var path=require('path');var timeout=require(_0x42ef('0x2'));var express=require(_0x42ef('0x3'));var router=express[_0x42ef('0x4')]();var fs_extra=require(_0x42ef('0x5'));var auth=require(_0x42ef('0x6'));var interaction=require(_0x42ef('0x7'));var config=require(_0x42ef('0x8'));var controller=require(_0x42ef('0x9'));router[_0x42ef('0xa')]('/:id',auth[_0x42ef('0xb')](),controller[_0x42ef('0xc')]);router[_0x42ef('0xd')](_0x42ef('0xe'),auth['isAuthenticated'](),controller[_0x42ef('0xf')]);router[_0x42ef('0x10')]('/:id',auth[_0x42ef('0xb')](),controller['destroy']);module[_0x42ef('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 09bef79..84e0fdb 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 _0xed5e=['sequelize','STRING','BOOLEAN'];(function(_0x57e389,_0x4c6889){var _0xdd53a1=function(_0x11bd50){while(--_0x11bd50){_0x57e389['push'](_0x57e389['shift']());}};_0xdd53a1(++_0x4c6889);}(_0xed5e,0xff));var _0xeed5=function(_0x50b919,_0x7cdb7f){_0x50b919=_0x50b919-0x0;var _0x12fec9=_0xed5e[_0x50b919];return _0x12fec9;};'use strict';var Sequelize=require(_0xeed5('0x0'));module['exports']={'name':{'type':Sequelize[_0xeed5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xeed5('0x1')]},'write':{'type':Sequelize[_0xeed5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x49f5=['sequelize','STRING','BOOLEAN'];(function(_0x4e63f7,_0x59f625){var _0x5599fe=function(_0x4a3952){while(--_0x4a3952){_0x4e63f7['push'](_0x4e63f7['shift']());}};_0x5599fe(++_0x59f625);}(_0x49f5,0xf0));var _0x549f=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x49f5[_0x2d9c6a];return _0xf3c918;};'use strict';var Sequelize=require(_0x549f('0x0'));module['exports']={'name':{'type':Sequelize[_0x549f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x549f('0x1')]},'write':{'type':Sequelize[_0x549f('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 f0a8692..ac887b7 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 _0x007e=['ChatGroupId','findOne','$gte','split','format','getMessages','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','error','name','send','index','map','ChatGroup','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','keys','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','order','nolimit','removeMembers','addMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x007e,0x166));var _0xe007=function(_0x5e4487,_0x8b8232){_0x5e4487=_0x5e4487-0x0;var _0x10409b=_0x007e[_0x5e4487];return _0x10409b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe007('0x0'));var zipdir=require(_0xe007('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe007('0x2'));var moment=require(_0xe007('0x3'));var BPromise=require(_0xe007('0x4'));var Mustache=require(_0xe007('0x5'));var util=require('util');var path=require(_0xe007('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(_0xe007('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe007('0x8'));var querystring=require(_0xe007('0x9'));var Papa=require(_0xe007('0xa'));var Redis=require(_0xe007('0xb'));var authService=require(_0xe007('0xc'));var qs=require(_0xe007('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe007('0xe'));var logger=require('../../config/logger')(_0xe007('0xf'));var utils=require('../../config/utils');var config=require(_0xe007('0x10'));var licenseUtil=require(_0xe007('0x11'));var db=require(_0xe007('0x12'))['db'];config['redis']=_[_0xe007('0x13')](config[_0xe007('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xe007('0x15'))(new Redis(config[_0xe007('0x14')]));require(_0xe007('0x16'))[_0xe007('0x17')](socket);function respondWithStatusCode(_0x33c40c,_0xfed403){_0xfed403=_0xfed403||0xcc;return function(_0xc74d13){if(_0xc74d13){return _0x33c40c[_0xe007('0x18')](_0xfed403);}return _0x33c40c[_0xe007('0x19')](_0xfed403)[_0xe007('0x1a')]();};}function respondWithResult(_0x48737c,_0x3882e6){_0x3882e6=_0x3882e6||0xc8;return function(_0x4e4425){if(_0x4e4425){return _0x48737c[_0xe007('0x19')](_0x3882e6)[_0xe007('0x1b')](_0x4e4425);}};}function respondWithFilteredResult(_0x44f2ab,_0x534e54){return function(_0x592a8c){if(_0x592a8c){var _0x49c36a=typeof _0x534e54[_0xe007('0x1c')]==='undefined'&&typeof _0x534e54[_0xe007('0x1d')]===_0xe007('0x1e');var _0xd64719=_0x592a8c[_0xe007('0x1f')];var _0x5076cf=_0x49c36a?0x0:_0x534e54[_0xe007('0x1c')];var _0x1f0185=_0x49c36a?_0x592a8c[_0xe007('0x1f')]:_0x534e54[_0xe007('0x1c')]+_0x534e54[_0xe007('0x1d')];var _0x3d4dd;if(_0x1f0185>=_0xd64719){_0x1f0185=_0xd64719;_0x3d4dd=0xc8;}else{_0x3d4dd=0xce;}_0x44f2ab[_0xe007('0x19')](_0x3d4dd);return _0x44f2ab[_0xe007('0x20')]('Content-Range',_0x5076cf+'-'+_0x1f0185+'/'+_0xd64719)[_0xe007('0x1b')](_0x592a8c);}return null;};}function patchUpdates(_0x5e6eee){return function(_0x5f05a0){try{jsonpatch[_0xe007('0x21')](_0x5f05a0,_0x5e6eee,!![]);}catch(_0x5eaf1b){return BPromise['reject'](_0x5eaf1b);}return _0x5f05a0[_0xe007('0x22')]();};}function saveUpdates(_0x52e693,_0x1d352f){return function(_0x1d74a6){if(_0x1d74a6){return _0x1d74a6[_0xe007('0x23')](_0x52e693)[_0xe007('0x24')](function(_0x53d7e3){return _0x53d7e3;});}return null;};}function removeEntity(_0x445123,_0x5c2735){return function(_0xeee007){if(_0xeee007){return _0xeee007['destroy']()[_0xe007('0x24')](function(){_0x445123[_0xe007('0x19')](0xcc)[_0xe007('0x1a')]();});}};}function handleEntityNotFound(_0x5d9884,_0x121024){return function(_0x44b3a9){if(!_0x44b3a9){_0x5d9884[_0xe007('0x18')](0x194);}return _0x44b3a9;};}function handleError(_0x866d1f,_0x14d27a){_0x14d27a=_0x14d27a||0x1f4;return function(_0x33beba){logger[_0xe007('0x25')](_0x33beba['stack']);if(_0x33beba['name']){delete _0x33beba[_0xe007('0x26')];}_0x866d1f['status'](_0x14d27a)[_0xe007('0x27')](_0x33beba);};}exports[_0xe007('0x28')]=function(_0x2e9ec8,_0x3e6de7){var _0x40432c={},_0x503bf9={},_0x52f9d6={'count':0x0,'rows':[]};var _0x55984a=_[_0xe007('0x29')](db[_0xe007('0x2a')]['rawAttributes'],function(_0x3a67ca){return{'name':_0x3a67ca['fieldName'],'type':_0x3a67ca[_0xe007('0x2b')][_0xe007('0x2c')]};});_0x503bf9[_0xe007('0x2d')]=_['map'](_0x55984a,_0xe007('0x26'));_0x503bf9[_0xe007('0x2e')]=_['keys'](_0x2e9ec8[_0xe007('0x2e')]);_0x503bf9[_0xe007('0x2f')]=_[_0xe007('0x30')](_0x503bf9[_0xe007('0x2d')],_0x503bf9[_0xe007('0x2e')]);_0x40432c[_0xe007('0x31')]=_[_0xe007('0x30')](_0x503bf9[_0xe007('0x2d')],qs[_0xe007('0x32')](_0x2e9ec8['query'][_0xe007('0x32')]));_0x40432c[_0xe007('0x31')]=_0x40432c[_0xe007('0x31')][_0xe007('0x33')]?_0x40432c[_0xe007('0x31')]:_0x503bf9[_0xe007('0x2d')];if(!_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x34')]('nolimit')){_0x40432c[_0xe007('0x1d')]=qs[_0xe007('0x1d')](_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x1d')]);_0x40432c[_0xe007('0x1c')]=qs[_0xe007('0x1c')](_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x1c')]);}_0x40432c['order']=qs[_0xe007('0x35')](_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x35')]);_0x40432c['where']=qs['filters'](_[_0xe007('0x36')](_0x2e9ec8[_0xe007('0x2e')],_0x503bf9[_0xe007('0x2f')]),_0x55984a);if(_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x37')]){_0x40432c['where']=_[_0xe007('0x38')](_0x40432c[_0xe007('0x39')],{'$or':_['map'](_0x55984a,function(_0x185c1b){if(_0x185c1b[_0xe007('0x2b')]!==_0xe007('0x3a')){var _0x590b1a={};_0x590b1a[_0x185c1b[_0xe007('0x26')]]={'$like':'%'+_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x37')]+'%'};return _0x590b1a;}})});}_0x40432c=_[_0xe007('0x38')]({},_0x40432c,_0x2e9ec8[_0xe007('0x3b')]);var _0x43ef64={'where':_0x40432c[_0xe007('0x39')]};return db[_0xe007('0x2a')][_0xe007('0x1f')](_0x43ef64)[_0xe007('0x24')](function(_0x57db58){_0x52f9d6[_0xe007('0x1f')]=_0x57db58;if(_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x3c')]){_0x40432c[_0xe007('0x3d')]=[{'all':!![]}];}return db[_0xe007('0x2a')]['findAll'](_0x40432c);})['then'](function(_0x2c4ff2){_0x52f9d6['rows']=_0x2c4ff2;return _0x52f9d6;})['then'](respondWithFilteredResult(_0x3e6de7,_0x40432c))[_0xe007('0x3e')](handleError(_0x3e6de7,null));};exports['show']=function(_0xff7d34,_0x116831){var _0x348d53={'raw':!![],'where':{'id':_0xff7d34[_0xe007('0x3f')]['id']}},_0x804cc6={};_0x804cc6[_0xe007('0x2d')]=_['keys'](db['ChatGroup'][_0xe007('0x40')]);_0x804cc6[_0xe007('0x2e')]=_[_0xe007('0x41')](_0xff7d34[_0xe007('0x2e')]);_0x804cc6['filters']=_['intersection'](_0x804cc6[_0xe007('0x2d')],_0x804cc6['query']);_0x348d53[_0xe007('0x31')]=_[_0xe007('0x30')](_0x804cc6[_0xe007('0x2d')],qs['fields'](_0xff7d34[_0xe007('0x2e')][_0xe007('0x32')]));_0x348d53['attributes']=_0x348d53['attributes'][_0xe007('0x33')]?_0x348d53[_0xe007('0x31')]:_0x804cc6[_0xe007('0x2d')];if(_0xff7d34['query'][_0xe007('0x3c')]){_0x348d53[_0xe007('0x3d')]=[{'all':!![]}];}_0x348d53=_['merge']({},_0x348d53,_0xff7d34[_0xe007('0x3b')]);return db[_0xe007('0x2a')]['find'](_0x348d53)[_0xe007('0x24')](handleEntityNotFound(_0x116831,null))['then'](respondWithResult(_0x116831,null))['catch'](handleError(_0x116831,null));};exports['create']=function(_0x38f2eb,_0x3ef087){return db[_0xe007('0x2a')][_0xe007('0x42')](_0x38f2eb[_0xe007('0x43')],{})['then'](respondWithResult(_0x3ef087,0xc9))[_0xe007('0x3e')](handleError(_0x3ef087,null));};exports[_0xe007('0x23')]=function(_0x496a85,_0x3d2834){if(_0x496a85[_0xe007('0x43')]['id']){delete _0x496a85[_0xe007('0x43')]['id'];}return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x496a85[_0xe007('0x3f')]['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x3d2834,null))[_0xe007('0x24')](saveUpdates(_0x496a85['body'],null))[_0xe007('0x24')](respondWithResult(_0x3d2834,null))[_0xe007('0x3e')](handleError(_0x3d2834,null));};exports['destroy']=function(_0x124625,_0x63cf9a){return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x124625['params']['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x63cf9a,null))['then'](removeEntity(_0x63cf9a,null))[_0xe007('0x3e')](handleError(_0x63cf9a,null));};exports['describe']=function(_0x3579d5,_0x319018){return db['ChatGroup'][_0xe007('0x45')]()[_0xe007('0x24')](respondWithResult(_0x319018,null))['catch'](handleError(_0x319018,null));};exports[_0xe007('0x46')]=function(_0x33582e,_0x161bf6,_0x4f6544){return db[_0xe007('0x47')][_0xe007('0x1f')]({'where':{'ChatGroupId':_0x33582e[_0xe007('0x3f')]['id'],'ToId':_0x33582e['user']['id'],'read':![]}})[_0xe007('0x24')](function(_0x40468b){return{'id':_[_0xe007('0x48')](_0x33582e['params']['id']),'count':_0x40468b};})['then'](respondWithResult(_0x161bf6,null))[_0xe007('0x3e')](handleError(_0x161bf6,null));};exports[_0xe007('0x49')]=function(_0x438d98,_0x24d709,_0x199e6d){return db[_0xe007('0x2a')]['find']({'where':{'id':_0x438d98[_0xe007('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24d709,null))[_0xe007('0x24')](function(_0x1daa1a){if(_0x1daa1a){return _0x1daa1a[_0xe007('0x49')](_0x438d98[_0xe007('0x43')][_0xe007('0x4a')],_[_0xe007('0x4b')](_0x438d98['body'],[_0xe007('0x4a'),'id'])||{});}})[_0xe007('0x24')](respondWithResult(_0x24d709,null))[_0xe007('0x3e')](handleError(_0x24d709,null));};exports[_0xe007('0x4c')]=function(_0x2a6ab1,_0x50669b,_0x2121d6){var _0x566bdc={};var _0x2343cd={};var _0xe25215;var _0x19561f;return db['ChatGroup']['findOne']({'where':{'id':_0x2a6ab1[_0xe007('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50669b,null))['then'](function(_0x3c15c9){if(_0x3c15c9){_0xe25215=_0x3c15c9;_0x2343cd[_0xe007('0x2d')]=_[_0xe007('0x41')](db[_0xe007('0x4d')][_0xe007('0x40')]);_0x2343cd['query']=_[_0xe007('0x41')](_0x2a6ab1[_0xe007('0x2e')]);_0x2343cd[_0xe007('0x2f')]=_[_0xe007('0x30')](_0x2343cd['model'],_0x2343cd[_0xe007('0x2e')]);_0x566bdc[_0xe007('0x31')]=_[_0xe007('0x30')](_0x2343cd[_0xe007('0x2d')],qs[_0xe007('0x32')](_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x32')]));_0x566bdc[_0xe007('0x31')]=_0x566bdc[_0xe007('0x31')]['length']?_0x566bdc[_0xe007('0x31')]:_0x2343cd['model'];_0x566bdc[_0xe007('0x4e')]=qs[_0xe007('0x35')](_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x35')]);_0x566bdc[_0xe007('0x39')]=qs[_0xe007('0x2f')](_[_0xe007('0x36')](_0x2a6ab1[_0xe007('0x2e')],_0x2343cd['filters']));if(_0x2a6ab1['query'][_0xe007('0x37')]){_0x566bdc[_0xe007('0x39')]=_[_0xe007('0x38')](_0x566bdc['where'],{'$or':_[_0xe007('0x29')](_0x566bdc[_0xe007('0x31')],function(_0x20f934){var _0x3a60f0={};_0x3a60f0[_0x20f934]={'$like':'%'+_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x37')]+'%'};return _0x3a60f0;})});}_0x566bdc=_[_0xe007('0x38')]({},_0x566bdc,_0x2a6ab1[_0xe007('0x3b')]);return _0xe25215[_0xe007('0x4c')](_0x566bdc);}})[_0xe007('0x24')](function(_0x5d6b48){if(_0x5d6b48){_0x19561f=_0x5d6b48[_0xe007('0x33')];if(!_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x34')](_0xe007('0x4f'))){_0x566bdc[_0xe007('0x1d')]=qs['limit'](_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x1d')]);_0x566bdc[_0xe007('0x1c')]=qs['offset'](_0x2a6ab1['query']['offset']);}return _0xe25215['getMembers'](_0x566bdc);}})['then'](function(_0x114717){if(_0x114717){return _0x114717?{'count':_0x19561f,'rows':_0x114717}:null;}})[_0xe007('0x24')](respondWithResult(_0x50669b,null))['catch'](handleError(_0x50669b,null));};exports['removeMembers']=function(_0x5d1cce,_0x4acc8e,_0x368a85){return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x5d1cce['params']['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x4acc8e,null))['then'](function(_0x494633){if(_0x494633){return _0x494633[_0xe007('0x50')](_0x5d1cce[_0xe007('0x2e')][_0xe007('0x4a')]);}})[_0xe007('0x24')](respondWithStatusCode(_0x4acc8e,null))[_0xe007('0x3e')](handleError(_0x4acc8e,null));};exports[_0xe007('0x51')]=function(_0x711581,_0x218e9e,_0x24fca6){if(_0x711581['body']['id']){delete _0x711581['body']['id'];}return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x711581[_0xe007('0x3f')]['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x218e9e,null))[_0xe007('0x24')](function(_0x56bad3){if(_0x56bad3){_0x711581[_0xe007('0x43')][_0xe007('0x52')]=_0x56bad3['id'];return db[_0xe007('0x47')][_0xe007('0x42')](_0x711581['body']);}})[_0xe007('0x24')](respondWithResult(_0x218e9e,null))[_0xe007('0x3e')](handleError(_0x218e9e,null));};exports['getMessages']=function(_0x61caad,_0x49785a,_0x4a0e9c){var _0x309644={};var _0x5c562c={};var _0x3f1cb8;var _0x1977a5;return db[_0xe007('0x2a')][_0xe007('0x53')]({'where':{'id':_0x61caad['params']['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x49785a,null))['then'](function(_0x287b31){if(_0x287b31){_0x3f1cb8=_0x287b31;_0x5c562c['model']=_['keys'](db[_0xe007('0x47')][_0xe007('0x40')]);_0x5c562c[_0xe007('0x2e')]=_[_0xe007('0x41')](_0x61caad[_0xe007('0x2e')]);_0x5c562c[_0xe007('0x2f')]=_[_0xe007('0x30')](_0x5c562c[_0xe007('0x2d')],_0x5c562c[_0xe007('0x2e')]);_0x309644['attributes']=_[_0xe007('0x30')](_0x5c562c['model'],qs['fields'](_0x61caad[_0xe007('0x2e')][_0xe007('0x32')]));_0x309644['attributes']=_0x309644['attributes'][_0xe007('0x33')]?_0x309644['attributes']:_0x5c562c[_0xe007('0x2d')];_0x309644[_0xe007('0x4e')]=qs['sort'](_0x61caad['query'][_0xe007('0x35')]);_0x309644['where']=qs[_0xe007('0x2f')](_[_0xe007('0x36')](_0x61caad[_0xe007('0x2e')],_0x5c562c['filters']));if(_0x61caad[_0xe007('0x2e')]['filter']){_0x309644[_0xe007('0x39')]=_[_0xe007('0x38')](_0x309644[_0xe007('0x39')],{'$or':_['map'](_0x309644[_0xe007('0x31')],function(_0x2f4ccf){var _0x454f08={};_0x454f08[_0x2f4ccf]={'$like':'%'+_0x61caad[_0xe007('0x2e')][_0xe007('0x37')]+'%'};return _0x454f08;})});}if(_0x61caad['query']['$gte']){var _0x473f2c=_0x61caad[_0xe007('0x2e')][_0xe007('0x54')][_0xe007('0x55')](',');var _0x47af52={};_0x47af52[_0x473f2c[0x0]]={'$gte':moment(_0x473f2c[0x1])[_0xe007('0x56')]('YYYY-MM-DD\x20HH:mm:ss')};_0x309644[_0xe007('0x39')]=_[_0xe007('0x38')](_0x309644[_0xe007('0x39')],_0x47af52);}_0x309644=_[_0xe007('0x38')]({},_0x309644,_0x61caad['options']);return _0x3f1cb8[_0xe007('0x57')](_0x309644);}})[_0xe007('0x24')](function(_0x48cad6){if(_0x48cad6){_0x1977a5=_0x48cad6[_0xe007('0x33')];if(!_0x61caad['query']['hasOwnProperty']('nolimit')){_0x309644['limit']=qs[_0xe007('0x1d')](_0x61caad[_0xe007('0x2e')][_0xe007('0x1d')]);_0x309644[_0xe007('0x1c')]=qs[_0xe007('0x1c')](_0x61caad['query']['offset']);}return _0x3f1cb8[_0xe007('0x57')](_0x309644);}})[_0xe007('0x24')](function(_0x12ee1d){if(_0x12ee1d){return _0x12ee1d?{'count':_0x1977a5,'rows':_0x12ee1d}:null;}})[_0xe007('0x24')](respondWithResult(_0x49785a,null))[_0xe007('0x3e')](handleError(_0x49785a,null));}; \ No newline at end of file +var _0x5235=['hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','order','removeMembers','addMessage','ChatGroupId','findOne','pick','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','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','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','ChatGroup','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5235,0x83));var _0x5523=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x5235[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5523('0x0'));var zipdir=require(_0x5523('0x1'));var jsonpatch=require(_0x5523('0x2'));var rp=require(_0x5523('0x3'));var moment=require('moment');var BPromise=require(_0x5523('0x4'));var Mustache=require(_0x5523('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5523('0x6'));var ejs=require(_0x5523('0x7'));var fs=require('fs');var fs_extra=require(_0x5523('0x8'));var _=require(_0x5523('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5523('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5523('0xb'));var Papa=require(_0x5523('0xc'));var Redis=require(_0x5523('0xd'));var authService=require(_0x5523('0xe'));var qs=require(_0x5523('0xf'));var as=require(_0x5523('0x10'));var hardwareService=require(_0x5523('0x11'));var logger=require(_0x5523('0x12'))('api');var utils=require(_0x5523('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5523('0x14'));var db=require(_0x5523('0x15'))['db'];config['redis']=_[_0x5523('0x16')](config[_0x5523('0x17')],{'host':_0x5523('0x18'),'port':0x18eb});var socket=require(_0x5523('0x19'))(new Redis(config['redis']));require(_0x5523('0x1a'))['register'](socket);function respondWithStatusCode(_0x557c0d,_0x3542f3){_0x3542f3=_0x3542f3||0xcc;return function(_0x319d30){if(_0x319d30){return _0x557c0d[_0x5523('0x1b')](_0x3542f3);}return _0x557c0d[_0x5523('0x1c')](_0x3542f3)['end']();};}function respondWithResult(_0x23a978,_0x17a368){_0x17a368=_0x17a368||0xc8;return function(_0x4b7fec){if(_0x4b7fec){return _0x23a978[_0x5523('0x1c')](_0x17a368)['json'](_0x4b7fec);}};}function respondWithFilteredResult(_0x39a8e2,_0x5b45fd){return function(_0x4e777a){if(_0x4e777a){var _0x4a1ad6=typeof _0x5b45fd[_0x5523('0x1d')]===_0x5523('0x1e')&&typeof _0x5b45fd[_0x5523('0x1f')]===_0x5523('0x1e');var _0x1f28c0=_0x4e777a[_0x5523('0x20')];var _0x15f773=_0x4a1ad6?0x0:_0x5b45fd[_0x5523('0x1d')];var _0x32a126=_0x4a1ad6?_0x4e777a[_0x5523('0x20')]:_0x5b45fd[_0x5523('0x1d')]+_0x5b45fd[_0x5523('0x1f')];var _0x7e20f3;if(_0x32a126>=_0x1f28c0){_0x32a126=_0x1f28c0;_0x7e20f3=0xc8;}else{_0x7e20f3=0xce;}_0x39a8e2['status'](_0x7e20f3);return _0x39a8e2[_0x5523('0x21')](_0x5523('0x22'),_0x15f773+'-'+_0x32a126+'/'+_0x1f28c0)[_0x5523('0x23')](_0x4e777a);}return null;};}function patchUpdates(_0x2f542f){return function(_0x51cb64){try{jsonpatch[_0x5523('0x24')](_0x51cb64,_0x2f542f,!![]);}catch(_0x7ed48d){return BPromise[_0x5523('0x25')](_0x7ed48d);}return _0x51cb64['save']();};}function saveUpdates(_0x3f4e12,_0x879de1){return function(_0x57eebb){if(_0x57eebb){return _0x57eebb[_0x5523('0x26')](_0x3f4e12)[_0x5523('0x27')](function(_0x2e437e){return _0x2e437e;});}return null;};}function removeEntity(_0x4e6ae2,_0x166818){return function(_0x1872ba){if(_0x1872ba){return _0x1872ba[_0x5523('0x28')]()[_0x5523('0x27')](function(){_0x4e6ae2[_0x5523('0x1c')](0xcc)[_0x5523('0x29')]();});}};}function handleEntityNotFound(_0x3a2872,_0x3cf4b3){return function(_0x3a6883){if(!_0x3a6883){_0x3a2872[_0x5523('0x1b')](0x194);}return _0x3a6883;};}function handleError(_0x90ca40,_0x528c15){_0x528c15=_0x528c15||0x1f4;return function(_0x75b63){logger[_0x5523('0x2a')](_0x75b63[_0x5523('0x2b')]);if(_0x75b63[_0x5523('0x2c')]){delete _0x75b63[_0x5523('0x2c')];}_0x90ca40[_0x5523('0x1c')](_0x528c15)[_0x5523('0x2d')](_0x75b63);};}exports[_0x5523('0x2e')]=function(_0x49f4ce,_0x6fbe04){var _0x129c21={},_0x3ff3be={},_0x3e8fd8={'count':0x0,'rows':[]};var _0x38bd9d=_['map'](db[_0x5523('0x2f')][_0x5523('0x30')],function(_0x4b6c4f){return{'name':_0x4b6c4f['fieldName'],'type':_0x4b6c4f[_0x5523('0x31')][_0x5523('0x32')]};});_0x3ff3be[_0x5523('0x33')]=_[_0x5523('0x34')](_0x38bd9d,_0x5523('0x2c'));_0x3ff3be[_0x5523('0x35')]=_[_0x5523('0x36')](_0x49f4ce[_0x5523('0x35')]);_0x3ff3be['filters']=_[_0x5523('0x37')](_0x3ff3be[_0x5523('0x33')],_0x3ff3be[_0x5523('0x35')]);_0x129c21[_0x5523('0x38')]=_[_0x5523('0x37')](_0x3ff3be['model'],qs[_0x5523('0x39')](_0x49f4ce[_0x5523('0x35')][_0x5523('0x39')]));_0x129c21[_0x5523('0x38')]=_0x129c21[_0x5523('0x38')][_0x5523('0x3a')]?_0x129c21[_0x5523('0x38')]:_0x3ff3be[_0x5523('0x33')];if(!_0x49f4ce['query'][_0x5523('0x3b')](_0x5523('0x3c'))){_0x129c21[_0x5523('0x1f')]=qs[_0x5523('0x1f')](_0x49f4ce[_0x5523('0x35')][_0x5523('0x1f')]);_0x129c21[_0x5523('0x1d')]=qs[_0x5523('0x1d')](_0x49f4ce[_0x5523('0x35')][_0x5523('0x1d')]);}_0x129c21['order']=qs[_0x5523('0x3d')](_0x49f4ce[_0x5523('0x35')]['sort']);_0x129c21[_0x5523('0x3e')]=qs[_0x5523('0x3f')](_['pick'](_0x49f4ce[_0x5523('0x35')],_0x3ff3be['filters']),_0x38bd9d);if(_0x49f4ce[_0x5523('0x35')][_0x5523('0x40')]){_0x129c21[_0x5523('0x3e')]=_[_0x5523('0x41')](_0x129c21[_0x5523('0x3e')],{'$or':_[_0x5523('0x34')](_0x38bd9d,function(_0x2be7f8){if(_0x2be7f8[_0x5523('0x31')]!==_0x5523('0x42')){var _0x39da0f={};_0x39da0f[_0x2be7f8[_0x5523('0x2c')]]={'$like':'%'+_0x49f4ce[_0x5523('0x35')][_0x5523('0x40')]+'%'};return _0x39da0f;}})});}_0x129c21=_[_0x5523('0x41')]({},_0x129c21,_0x49f4ce[_0x5523('0x43')]);var _0x5b619d={'where':_0x129c21[_0x5523('0x3e')]};return db[_0x5523('0x2f')][_0x5523('0x20')](_0x5b619d)[_0x5523('0x27')](function(_0x49dbd9){_0x3e8fd8[_0x5523('0x20')]=_0x49dbd9;if(_0x49f4ce['query'][_0x5523('0x44')]){_0x129c21[_0x5523('0x45')]=[{'all':!![]}];}return db[_0x5523('0x2f')][_0x5523('0x46')](_0x129c21);})[_0x5523('0x27')](function(_0x9b37f8){_0x3e8fd8[_0x5523('0x47')]=_0x9b37f8;return _0x3e8fd8;})[_0x5523('0x27')](respondWithFilteredResult(_0x6fbe04,_0x129c21))[_0x5523('0x48')](handleError(_0x6fbe04,null));};exports[_0x5523('0x49')]=function(_0x1ff8d6,_0x5295a4){var _0x31952b={'raw':!![],'where':{'id':_0x1ff8d6[_0x5523('0x4a')]['id']}},_0x74a888={};_0x74a888['model']=_[_0x5523('0x36')](db['ChatGroup'][_0x5523('0x30')]);_0x74a888['query']=_[_0x5523('0x36')](_0x1ff8d6['query']);_0x74a888[_0x5523('0x3f')]=_[_0x5523('0x37')](_0x74a888[_0x5523('0x33')],_0x74a888[_0x5523('0x35')]);_0x31952b[_0x5523('0x38')]=_[_0x5523('0x37')](_0x74a888[_0x5523('0x33')],qs[_0x5523('0x39')](_0x1ff8d6[_0x5523('0x35')][_0x5523('0x39')]));_0x31952b[_0x5523('0x38')]=_0x31952b[_0x5523('0x38')][_0x5523('0x3a')]?_0x31952b[_0x5523('0x38')]:_0x74a888[_0x5523('0x33')];if(_0x1ff8d6[_0x5523('0x35')][_0x5523('0x44')]){_0x31952b[_0x5523('0x45')]=[{'all':!![]}];}_0x31952b=_[_0x5523('0x41')]({},_0x31952b,_0x1ff8d6[_0x5523('0x43')]);return db[_0x5523('0x2f')][_0x5523('0x4b')](_0x31952b)['then'](handleEntityNotFound(_0x5295a4,null))['then'](respondWithResult(_0x5295a4,null))[_0x5523('0x48')](handleError(_0x5295a4,null));};exports[_0x5523('0x4c')]=function(_0x39620a,_0x5dd12b){return db['ChatGroup'][_0x5523('0x4c')](_0x39620a[_0x5523('0x4d')],{})[_0x5523('0x27')](respondWithResult(_0x5dd12b,0xc9))[_0x5523('0x48')](handleError(_0x5dd12b,null));};exports[_0x5523('0x26')]=function(_0x3f37d0,_0x1179ef){if(_0x3f37d0['body']['id']){delete _0x3f37d0[_0x5523('0x4d')]['id'];}return db['ChatGroup'][_0x5523('0x4b')]({'where':{'id':_0x3f37d0[_0x5523('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1179ef,null))[_0x5523('0x27')](saveUpdates(_0x3f37d0[_0x5523('0x4d')],null))[_0x5523('0x27')](respondWithResult(_0x1179ef,null))[_0x5523('0x48')](handleError(_0x1179ef,null));};exports[_0x5523('0x28')]=function(_0x15a203,_0x3492eb){return db[_0x5523('0x2f')]['find']({'where':{'id':_0x15a203['params']['id']}})[_0x5523('0x27')](handleEntityNotFound(_0x3492eb,null))['then'](removeEntity(_0x3492eb,null))[_0x5523('0x48')](handleError(_0x3492eb,null));};exports[_0x5523('0x4e')]=function(_0x2a6b84,_0x55d642){return db[_0x5523('0x2f')][_0x5523('0x4e')]()['then'](respondWithResult(_0x55d642,null))['catch'](handleError(_0x55d642,null));};exports['getUnread']=function(_0x2be251,_0x11b475,_0xe0df22){return db[_0x5523('0x4f')][_0x5523('0x20')]({'where':{'ChatGroupId':_0x2be251[_0x5523('0x4a')]['id'],'ToId':_0x2be251[_0x5523('0x50')]['id'],'read':![]}})[_0x5523('0x27')](function(_0x1693e0){return{'id':_[_0x5523('0x51')](_0x2be251[_0x5523('0x4a')]['id']),'count':_0x1693e0};})[_0x5523('0x27')](respondWithResult(_0x11b475,null))['catch'](handleError(_0x11b475,null));};exports[_0x5523('0x52')]=function(_0xea2289,_0x1167e8,_0x5435b7){return db['ChatGroup'][_0x5523('0x4b')]({'where':{'id':_0xea2289[_0x5523('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1167e8,null))['then'](function(_0xe787c7){if(_0xe787c7){return _0xe787c7[_0x5523('0x52')](_0xea2289['body']['ids'],_[_0x5523('0x53')](_0xea2289[_0x5523('0x4d')],[_0x5523('0x54'),'id'])||{});}})[_0x5523('0x27')](respondWithResult(_0x1167e8,null))[_0x5523('0x48')](handleError(_0x1167e8,null));};exports[_0x5523('0x55')]=function(_0x169224,_0x20ce97,_0x10a73a){var _0x65c71a={};var _0x1ceb82={};var _0x58e2ac;var _0x2f9a9d;return db['ChatGroup']['findOne']({'where':{'id':_0x169224['params']['id']}})[_0x5523('0x27')](handleEntityNotFound(_0x20ce97,null))[_0x5523('0x27')](function(_0x4a98f1){if(_0x4a98f1){_0x58e2ac=_0x4a98f1;_0x1ceb82[_0x5523('0x33')]=_[_0x5523('0x36')](db['User']['rawAttributes']);_0x1ceb82[_0x5523('0x35')]=_['keys'](_0x169224[_0x5523('0x35')]);_0x1ceb82['filters']=_['intersection'](_0x1ceb82[_0x5523('0x33')],_0x1ceb82[_0x5523('0x35')]);_0x65c71a['attributes']=_[_0x5523('0x37')](_0x1ceb82['model'],qs[_0x5523('0x39')](_0x169224[_0x5523('0x35')][_0x5523('0x39')]));_0x65c71a[_0x5523('0x38')]=_0x65c71a['attributes'][_0x5523('0x3a')]?_0x65c71a[_0x5523('0x38')]:_0x1ceb82[_0x5523('0x33')];_0x65c71a[_0x5523('0x56')]=qs[_0x5523('0x3d')](_0x169224[_0x5523('0x35')][_0x5523('0x3d')]);_0x65c71a[_0x5523('0x3e')]=qs[_0x5523('0x3f')](_['pick'](_0x169224['query'],_0x1ceb82[_0x5523('0x3f')]));if(_0x169224[_0x5523('0x35')][_0x5523('0x40')]){_0x65c71a[_0x5523('0x3e')]=_['merge'](_0x65c71a[_0x5523('0x3e')],{'$or':_[_0x5523('0x34')](_0x65c71a[_0x5523('0x38')],function(_0x206335){var _0x11f0da={};_0x11f0da[_0x206335]={'$like':'%'+_0x169224[_0x5523('0x35')][_0x5523('0x40')]+'%'};return _0x11f0da;})});}_0x65c71a=_['merge']({},_0x65c71a,_0x169224[_0x5523('0x43')]);return _0x58e2ac[_0x5523('0x55')](_0x65c71a);}})[_0x5523('0x27')](function(_0x4989ac){if(_0x4989ac){_0x2f9a9d=_0x4989ac['length'];if(!_0x169224[_0x5523('0x35')][_0x5523('0x3b')](_0x5523('0x3c'))){_0x65c71a[_0x5523('0x1f')]=qs[_0x5523('0x1f')](_0x169224[_0x5523('0x35')][_0x5523('0x1f')]);_0x65c71a[_0x5523('0x1d')]=qs['offset'](_0x169224[_0x5523('0x35')][_0x5523('0x1d')]);}return _0x58e2ac[_0x5523('0x55')](_0x65c71a);}})[_0x5523('0x27')](function(_0x446718){if(_0x446718){return _0x446718?{'count':_0x2f9a9d,'rows':_0x446718}:null;}})[_0x5523('0x27')](respondWithResult(_0x20ce97,null))['catch'](handleError(_0x20ce97,null));};exports[_0x5523('0x57')]=function(_0xe16b1f,_0x3f4dcb,_0x48d946){return db[_0x5523('0x2f')][_0x5523('0x4b')]({'where':{'id':_0xe16b1f['params']['id']}})[_0x5523('0x27')](handleEntityNotFound(_0x3f4dcb,null))[_0x5523('0x27')](function(_0x2ae5b7){if(_0x2ae5b7){return _0x2ae5b7[_0x5523('0x57')](_0xe16b1f['query']['ids']);}})[_0x5523('0x27')](respondWithStatusCode(_0x3f4dcb,null))['catch'](handleError(_0x3f4dcb,null));};exports[_0x5523('0x58')]=function(_0x4aba6a,_0x57e53c,_0x282c36){if(_0x4aba6a[_0x5523('0x4d')]['id']){delete _0x4aba6a[_0x5523('0x4d')]['id'];}return db[_0x5523('0x2f')][_0x5523('0x4b')]({'where':{'id':_0x4aba6a[_0x5523('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57e53c,null))[_0x5523('0x27')](function(_0x15cb48){if(_0x15cb48){_0x4aba6a[_0x5523('0x4d')][_0x5523('0x59')]=_0x15cb48['id'];return db[_0x5523('0x4f')][_0x5523('0x4c')](_0x4aba6a['body']);}})[_0x5523('0x27')](respondWithResult(_0x57e53c,null))[_0x5523('0x48')](handleError(_0x57e53c,null));};exports['getMessages']=function(_0x383d6f,_0x44d32d,_0x2a2b24){var _0x1307a2={};var _0x5940b={};var _0x2d3245;var _0xe2d3f8;return db['ChatGroup'][_0x5523('0x5a')]({'where':{'id':_0x383d6f[_0x5523('0x4a')]['id']}})[_0x5523('0x27')](handleEntityNotFound(_0x44d32d,null))[_0x5523('0x27')](function(_0x3f3b77){if(_0x3f3b77){_0x2d3245=_0x3f3b77;_0x5940b[_0x5523('0x33')]=_['keys'](db[_0x5523('0x4f')]['rawAttributes']);_0x5940b[_0x5523('0x35')]=_['keys'](_0x383d6f[_0x5523('0x35')]);_0x5940b[_0x5523('0x3f')]=_['intersection'](_0x5940b[_0x5523('0x33')],_0x5940b[_0x5523('0x35')]);_0x1307a2['attributes']=_['intersection'](_0x5940b[_0x5523('0x33')],qs[_0x5523('0x39')](_0x383d6f['query'][_0x5523('0x39')]));_0x1307a2[_0x5523('0x38')]=_0x1307a2['attributes'][_0x5523('0x3a')]?_0x1307a2[_0x5523('0x38')]:_0x5940b[_0x5523('0x33')];_0x1307a2[_0x5523('0x56')]=qs[_0x5523('0x3d')](_0x383d6f['query'][_0x5523('0x3d')]);_0x1307a2[_0x5523('0x3e')]=qs[_0x5523('0x3f')](_[_0x5523('0x5b')](_0x383d6f[_0x5523('0x35')],_0x5940b[_0x5523('0x3f')]));if(_0x383d6f[_0x5523('0x35')][_0x5523('0x40')]){_0x1307a2[_0x5523('0x3e')]=_['merge'](_0x1307a2[_0x5523('0x3e')],{'$or':_['map'](_0x1307a2[_0x5523('0x38')],function(_0x13bad0){var _0x15c966={};_0x15c966[_0x13bad0]={'$like':'%'+_0x383d6f[_0x5523('0x35')]['filter']+'%'};return _0x15c966;})});}if(_0x383d6f[_0x5523('0x35')]['$gte']){var _0x120b42=_0x383d6f[_0x5523('0x35')]['$gte'][_0x5523('0x5c')](',');var _0x3ef62a={};_0x3ef62a[_0x120b42[0x0]]={'$gte':moment(_0x120b42[0x1])[_0x5523('0x5d')](_0x5523('0x5e'))};_0x1307a2[_0x5523('0x3e')]=_[_0x5523('0x41')](_0x1307a2[_0x5523('0x3e')],_0x3ef62a);}_0x1307a2=_[_0x5523('0x41')]({},_0x1307a2,_0x383d6f['options']);return _0x2d3245['getMessages'](_0x1307a2);}})[_0x5523('0x27')](function(_0x2fcbe7){if(_0x2fcbe7){_0xe2d3f8=_0x2fcbe7[_0x5523('0x3a')];if(!_0x383d6f['query']['hasOwnProperty'](_0x5523('0x3c'))){_0x1307a2['limit']=qs[_0x5523('0x1f')](_0x383d6f[_0x5523('0x35')][_0x5523('0x1f')]);_0x1307a2[_0x5523('0x1d')]=qs[_0x5523('0x1d')](_0x383d6f[_0x5523('0x35')][_0x5523('0x1d')]);}return _0x2d3245['getMessages'](_0x1307a2);}})[_0x5523('0x27')](function(_0x5378dd){if(_0x5378dd){return _0x5378dd?{'count':_0xe2d3f8,'rows':_0x5378dd}:null;}})[_0x5523('0x27')](respondWithResult(_0x44d32d,null))['catch'](handleError(_0x44d32d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b3558e0..ddb095e 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 _0x7c71=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x41f6b7,_0x2defae){var _0x215031=function(_0xdcc8b9){while(--_0xdcc8b9){_0x41f6b7['push'](_0x41f6b7['shift']());}};_0x215031(++_0x2defae);}(_0x7c71,0x177));var _0x17c7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7c71[_0x40220a];return _0x3903cc;};'use strict';var EventEmitter=require(_0x17c7('0x0'));var ChatGroup=require(_0x17c7('0x1'))['db'][_0x17c7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x17c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x17c7('0x4'),'afterDestroy':_0x17c7('0x5')};function emitEvent(_0x3f9105){return function(_0x5a4923,_0x4fed29,_0xa4e319){ChatGroupEvents[_0x17c7('0x6')](_0x3f9105+':'+_0x5a4923['id'],_0x5a4923);ChatGroupEvents[_0x17c7('0x6')](_0x3f9105,_0x5a4923);_0xa4e319(null);};}for(var e in events){if(events[_0x17c7('0x7')](e)){var event=events[e];ChatGroup[_0x17c7('0x8')](e,emitEvent(event));}}module[_0x17c7('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x6fad=['ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x597de3,_0x59913a){var _0x4e96c3=function(_0x366dfb){while(--_0x366dfb){_0x597de3['push'](_0x597de3['shift']());}};_0x4e96c3(++_0x59913a);}(_0x6fad,0x17a));var _0xd6fa=function(_0x27b1da,_0xc8abcf){_0x27b1da=_0x27b1da-0x0;var _0x27f050=_0x6fad[_0x27b1da];return _0x27f050;};'use strict';var EventEmitter=require(_0xd6fa('0x0'));var ChatGroup=require(_0xd6fa('0x1'))['db'][_0xd6fa('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd6fa('0x3')](0x0);var events={'afterCreate':_0xd6fa('0x4'),'afterUpdate':'update','afterDestroy':_0xd6fa('0x5')};function emitEvent(_0x4af892){return function(_0x3cd6a2,_0x542461,_0x40ac02){ChatGroupEvents['emit'](_0x4af892+':'+_0x3cd6a2['id'],_0x3cd6a2);ChatGroupEvents[_0xd6fa('0x6')](_0x4af892,_0x3cd6a2);_0x40ac02(null);};}for(var e in events){if(events[_0xd6fa('0x7')](e)){var event=events[e];ChatGroup[_0xd6fa('0x8')](e,emitEvent(event));}}module[_0xd6fa('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 99a52c8..c3618cf 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 _0x046c=['chat_groups','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup'];(function(_0x36ed67,_0x109b5d){var _0x6efdf7=function(_0x3c9cb6){while(--_0x3c9cb6){_0x36ed67['push'](_0x36ed67['shift']());}};_0x6efdf7(++_0x109b5d);}(_0x046c,0x16c));var _0xc046=function(_0x129726,_0x10fc4a){_0x129726=_0x129726-0x0;var _0x4257bd=_0x046c[_0x129726];return _0x4257bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc046('0x0'))(_0xc046('0x1'));var moment=require(_0xc046('0x2'));var BPromise=require(_0xc046('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc046('0x4'));var rimraf=require(_0xc046('0x5'));var config=require(_0xc046('0x6'));var attributes=require(_0xc046('0x7'));module['exports']=function(_0x37011a,_0x5e0a2a){return _0x37011a[_0xc046('0x8')](_0xc046('0x9'),attributes,{'tableName':_0xc046('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80bc=['path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2e1730,_0xac4c9a){var _0xbd78dc=function(_0x35cf16){while(--_0x35cf16){_0x2e1730['push'](_0x2e1730['shift']());}};_0xbd78dc(++_0xac4c9a);}(_0x80bc,0x1a7));var _0xc80b=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x80bc[_0x40822a];return _0x357420;};'use strict';var _=require(_0xc80b('0x0'));var util=require(_0xc80b('0x1'));var logger=require(_0xc80b('0x2'))(_0xc80b('0x3'));var moment=require(_0xc80b('0x4'));var BPromise=require(_0xc80b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc80b('0x6'));var rimraf=require(_0xc80b('0x7'));var config=require(_0xc80b('0x8'));var attributes=require(_0xc80b('0x9'));module['exports']=function(_0x4ebdd6,_0x3a770d){return _0x4ebdd6[_0xc80b('0xa')](_0xc80b('0xb'),attributes,{'tableName':_0xc80b('0xc'),'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 175a372..cbc618d 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 _0x8832=['../../config/environment','jayson/promise','client','redis','localhost','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2d5c0c,_0x2b3c68){var _0x586ea4=function(_0xd580fc){while(--_0xd580fc){_0x2d5c0c['push'](_0x2d5c0c['shift']());}};_0x586ea4(++_0x2b3c68);}(_0x8832,0x1f4));var _0x2883=function(_0x593b90,_0x391cd8){_0x593b90=_0x593b90-0x0;var _0xb3290b=_0x8832[_0x593b90];return _0xb3290b;};'use strict';var _=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2883('0x2'));var fs=require('fs');var Redis=require(_0x2883('0x3'));var db=require(_0x2883('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2883('0x5'))('rpc');var config=require(_0x2883('0x6'));var jayson=require(_0x2883('0x7'));var client=jayson[_0x2883('0x8')]['http']({'port':0x232a});config[_0x2883('0x9')]=_['defaults'](config[_0x2883('0x9')],{'host':_0x2883('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2883('0xb'))[_0x2883('0xc')](socket);function respondWithRpcPromise(_0x467978,_0x10f8c8,_0x21fd17){return new BPromise(function(_0x4a729c,_0x4b803f){return client[_0x2883('0xd')](_0x467978,_0x21fd17)['then'](function(_0x5f3fc1){logger['info'](_0x2883('0xe'),_0x10f8c8,'request\x20sent');logger[_0x2883('0xf')](_0x2883('0x10'),_0x10f8c8,_0x2883('0x11'),JSON[_0x2883('0x12')](_0x5f3fc1));if(_0x5f3fc1[_0x2883('0x13')]){if(_0x5f3fc1[_0x2883('0x13')]['code']===0x1f4){logger['error'](_0x2883('0xe'),_0x10f8c8,_0x5f3fc1[_0x2883('0x13')]['message']);return _0x4b803f(_0x5f3fc1[_0x2883('0x13')][_0x2883('0x14')]);}logger[_0x2883('0x13')](_0x2883('0xe'),_0x10f8c8,_0x5f3fc1[_0x2883('0x13')][_0x2883('0x14')]);return _0x4a729c(_0x5f3fc1[_0x2883('0x13')][_0x2883('0x14')]);}else{logger['info'](_0x2883('0xe'),_0x10f8c8,_0x2883('0x11'));_0x4a729c(_0x5f3fc1[_0x2883('0x15')][_0x2883('0x14')]);}})[_0x2883('0x16')](function(_0x2632eb){logger[_0x2883('0x13')](_0x2883('0xe'),_0x10f8c8,_0x2632eb);_0x4b803f(_0x2632eb);});});} \ No newline at end of file +var _0x6e0e=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46005d,_0x3810cd){var _0x3bff1d=function(_0x16d7a9){while(--_0x16d7a9){_0x46005d['push'](_0x46005d['shift']());}};_0x3bff1d(++_0x3810cd);}(_0x6e0e,0x90));var _0xe6e0=function(_0x83879,_0x42f30e){_0x83879=_0x83879-0x0;var _0x1b7d91=_0x6e0e[_0x83879];return _0x1b7d91;};'use strict';var _=require(_0xe6e0('0x0'));var util=require(_0xe6e0('0x1'));var moment=require(_0xe6e0('0x2'));var BPromise=require(_0xe6e0('0x3'));var rs=require(_0xe6e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6e0('0x5'))['db'];var utils=require(_0xe6e0('0x6'));var logger=require(_0xe6e0('0x7'))(_0xe6e0('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6e0('0x9'));var client=jayson[_0xe6e0('0xa')][_0xe6e0('0xb')]({'port':0x232a});config[_0xe6e0('0xc')]=_[_0xe6e0('0xd')](config[_0xe6e0('0xc')],{'host':_0xe6e0('0xe'),'port':0x18eb});var socket=require(_0xe6e0('0xf'))(new Redis(config[_0xe6e0('0xc')]));require(_0xe6e0('0x10'))[_0xe6e0('0x11')](socket);function respondWithRpcPromise(_0x13b058,_0x399680,_0xb365dc){return new BPromise(function(_0x42487d,_0x13853a){return client['request'](_0x13b058,_0xb365dc)[_0xe6e0('0x12')](function(_0x3ff654){logger[_0xe6e0('0x13')](_0xe6e0('0x14'),_0x399680,_0xe6e0('0x15'));logger['debug'](_0xe6e0('0x16'),_0x399680,_0xe6e0('0x15'),JSON[_0xe6e0('0x17')](_0x3ff654));if(_0x3ff654['error']){if(_0x3ff654[_0xe6e0('0x18')][_0xe6e0('0x19')]===0x1f4){logger['error'](_0xe6e0('0x14'),_0x399680,_0x3ff654[_0xe6e0('0x18')][_0xe6e0('0x1a')]);return _0x13853a(_0x3ff654[_0xe6e0('0x18')][_0xe6e0('0x1a')]);}logger['error'](_0xe6e0('0x14'),_0x399680,_0x3ff654[_0xe6e0('0x18')][_0xe6e0('0x1a')]);return _0x42487d(_0x3ff654[_0xe6e0('0x18')][_0xe6e0('0x1a')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x399680,_0xe6e0('0x15'));_0x42487d(_0x3ff654['result'][_0xe6e0('0x1a')]);}})[_0xe6e0('0x1b')](function(_0x3fde0e){logger[_0xe6e0('0x18')](_0xe6e0('0x14'),_0x399680,_0x3fde0e);_0x13853a(_0x3fde0e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0e4c699..4e91d49 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 _0x27ff=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x1a01b1,_0xcc2032){var _0xbea4b2=function(_0x3768d1){while(--_0x3768d1){_0x1a01b1['push'](_0x1a01b1['shift']());}};_0xbea4b2(++_0xcc2032);}(_0x27ff,0xf5));var _0xf27f=function(_0x23082a,_0x445d35){_0x23082a=_0x23082a-0x0;var _0x4be541=_0x27ff[_0x23082a];return _0x4be541;};'use strict';var ChatGroupEvents=require(_0xf27f('0x0'));var events=[_0xf27f('0x1'),'remove',_0xf27f('0x2')];function createListener(_0xee4c9d,_0x5c0cb9){return function(_0x138a5d){_0x5c0cb9[_0xf27f('0x3')](_0xee4c9d,_0x138a5d);};}function removeListener(_0x422fbb,_0x14cb3c){return function(){ChatGroupEvents[_0xf27f('0x4')](_0x422fbb,_0x14cb3c);};}exports[_0xf27f('0x5')]=function(_0xba170a){for(var _0x38b398=0x0,_0x5de2e1=events[_0xf27f('0x6')];_0x38b398<_0x5de2e1;_0x38b398++){var _0x279a5a=events[_0x38b398];var _0x2959d5=createListener(_0xf27f('0x7')+_0x279a5a,_0xba170a);ChatGroupEvents['on'](_0x279a5a,_0x2959d5);}}; \ No newline at end of file +var _0x58a2=['save','remove','emit','./chatGroup.events'];(function(_0xf843a0,_0x49845d){var _0x553afd=function(_0x1aa19f){while(--_0x1aa19f){_0xf843a0['push'](_0xf843a0['shift']());}};_0x553afd(++_0x49845d);}(_0x58a2,0x163));var _0x258a=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x58a2[_0x29d915];return _0x160f86;};'use strict';var ChatGroupEvents=require(_0x258a('0x0'));var events=[_0x258a('0x1'),_0x258a('0x2'),'update'];function createListener(_0x2b9f45,_0x23c4ae){return function(_0x3236b0){_0x23c4ae[_0x258a('0x3')](_0x2b9f45,_0x3236b0);};}function removeListener(_0x1444b4,_0x59d146){return function(){ChatGroupEvents['removeListener'](_0x1444b4,_0x59d146);};}exports['register']=function(_0x3fb6e){for(var _0x2b7c11=0x0,_0x981c14=events['length'];_0x2b7c11<_0x981c14;_0x2b7c11++){var _0x10e0be=events[_0x2b7c11];var _0x1b143d=createListener('chatGroup:'+_0x10e0be,_0x3fb6e);ChatGroupEvents['on'](_0x10e0be,_0x1b143d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f1b3d45..1808e9d 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 _0x42f4=['/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','post','addMembers','addMessage','put','update','delete','removeMembers','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe'];(function(_0x57acaa,_0x34cf60){var _0x34edad=function(_0x1f046f){while(--_0x1f046f){_0x57acaa['push'](_0x57acaa['shift']());}};_0x34edad(++_0x34cf60);}(_0x42f4,0xd6));var _0x442f=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x42f4[_0x5ad220];return _0xdec77d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x442f('0x0'));var timeout=require(_0x442f('0x1'));var express=require(_0x442f('0x2'));var router=express['Router']();var fs_extra=require(_0x442f('0x3'));var auth=require(_0x442f('0x4'));var interaction=require(_0x442f('0x5'));var config=require(_0x442f('0x6'));var controller=require(_0x442f('0x7'));router[_0x442f('0x8')]('/',auth[_0x442f('0x9')](),controller['index']);router[_0x442f('0x8')]('/describe',auth[_0x442f('0x9')](),controller[_0x442f('0xa')]);router[_0x442f('0x8')](_0x442f('0xb'),auth[_0x442f('0x9')](),controller[_0x442f('0xc')]);router[_0x442f('0x8')](_0x442f('0xd'),auth[_0x442f('0x9')](),controller[_0x442f('0xe')]);router[_0x442f('0x8')]('/:id/members',auth[_0x442f('0x9')](),controller[_0x442f('0xf')]);router[_0x442f('0x8')](_0x442f('0x10'),auth[_0x442f('0x9')](),controller['getMessages']);router[_0x442f('0x11')]('/',auth[_0x442f('0x9')](),controller['create']);router[_0x442f('0x11')]('/:id/members',auth[_0x442f('0x9')](),controller[_0x442f('0x12')]);router[_0x442f('0x11')](_0x442f('0x10'),auth[_0x442f('0x9')](),controller[_0x442f('0x13')]);router[_0x442f('0x14')]('/:id',auth[_0x442f('0x9')](),controller[_0x442f('0x15')]);router['delete'](_0x442f('0xb'),auth[_0x442f('0x9')](),controller['destroy']);router[_0x442f('0x16')]('/:id/members',auth[_0x442f('0x9')](),controller[_0x442f('0x17')]);module[_0x442f('0x18')]=router; \ No newline at end of file +var _0xec7f=['index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated'];(function(_0x469ce9,_0x4a9239){var _0x180ebe=function(_0x39aa6f){while(--_0x39aa6f){_0x469ce9['push'](_0x469ce9['shift']());}};_0x180ebe(++_0x4a9239);}(_0xec7f,0xd4));var _0xfec7=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xec7f[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xfec7('0x0'));var util=require('util');var path=require(_0xfec7('0x1'));var timeout=require(_0xfec7('0x2'));var express=require(_0xfec7('0x3'));var router=express[_0xfec7('0x4')]();var fs_extra=require(_0xfec7('0x5'));var auth=require(_0xfec7('0x6'));var interaction=require(_0xfec7('0x7'));var config=require(_0xfec7('0x8'));var controller=require(_0xfec7('0x9'));router[_0xfec7('0xa')]('/',auth[_0xfec7('0xb')](),controller[_0xfec7('0xc')]);router['get'](_0xfec7('0xd'),auth[_0xfec7('0xb')](),controller[_0xfec7('0xe')]);router[_0xfec7('0xa')](_0xfec7('0xf'),auth[_0xfec7('0xb')](),controller[_0xfec7('0x10')]);router[_0xfec7('0xa')]('/:id/unread',auth[_0xfec7('0xb')](),controller['getUnread']);router['get'](_0xfec7('0x11'),auth['isAuthenticated'](),controller[_0xfec7('0x12')]);router[_0xfec7('0xa')](_0xfec7('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0xfec7('0x14')]('/',auth[_0xfec7('0xb')](),controller[_0xfec7('0x15')]);router[_0xfec7('0x14')](_0xfec7('0x11'),auth[_0xfec7('0xb')](),controller[_0xfec7('0x16')]);router[_0xfec7('0x14')](_0xfec7('0x13'),auth[_0xfec7('0xb')](),controller[_0xfec7('0x17')]);router[_0xfec7('0x18')](_0xfec7('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xfec7('0x19')](_0xfec7('0xf'),auth[_0xfec7('0xb')](),controller[_0xfec7('0x1a')]);router[_0xfec7('0x19')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0xfec7('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 6d7c5ac..22a9423 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 _0xa571=['exports','BOOLEAN','INTEGER','star','thumb','TEXT','DATE','STRING','long','ENUM','sequelize'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0xa571,0x107));var _0x1a57=function(_0x34ea07,_0x3c13b0){_0x34ea07=_0x34ea07-0x0;var _0x2af74b=_0xa571[_0x34ea07];return _0x2af74b;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'closed':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1a57('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x1a57('0x4'),_0x1a57('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x1a57('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1a57('0x7')]},'disposition':{'type':Sequelize[_0x1a57('0x8')]},'secondDisposition':{'type':Sequelize[_0x1a57('0x8')]},'thirdDisposition':{'type':Sequelize[_0x1a57('0x8')]},'note':{'type':Sequelize[_0x1a57('0x8')]},'browserName':{'type':Sequelize[_0x1a57('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x1a57('0x8')]},'osVersion':{'type':Sequelize[_0x1a57('0x8')]},'deviceModel':{'type':Sequelize[_0x1a57('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x1a57('0x8')]},'referer':{'type':Sequelize[_0x1a57('0x6')]},'customerIp':{'type':Sequelize[_0x1a57('0x8')]},'formData':{'type':Sequelize[_0x1a57('0x6')](_0x1a57('0x9'))},'read1stAt':{'type':Sequelize[_0x1a57('0x7')]},'lastMsgAt':{'type':Sequelize[_0x1a57('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1a57('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x1a57('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x1a57('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d05=['out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','long','DATE'];(function(_0xaa92e9,_0xdde7f9){var _0x1c904e=function(_0x2f61d9){while(--_0x2f61d9){_0xaa92e9['push'](_0xaa92e9['shift']());}};_0x1c904e(++_0xdde7f9);}(_0x8d05,0xe8));var _0x58d0=function(_0x3bcf2f,_0x2b3938){_0x3bcf2f=_0x3bcf2f-0x0;var _0x4030a2=_0x8d05[_0x3bcf2f];return _0x4030a2;};'use strict';var Sequelize=require(_0x58d0('0x0'));module[_0x58d0('0x1')]={'closed':{'type':Sequelize[_0x58d0('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x58d0('0x3')]},'ratingType':{'type':Sequelize[_0x58d0('0x4')]('star','thumb'),'defaultValue':_0x58d0('0x5')},'ratingMessage':{'type':Sequelize[_0x58d0('0x6')]},'pathTranscript':{'type':Sequelize[_0x58d0('0x6')]},'mailTranscript':{'type':Sequelize[_0x58d0('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x58d0('0x7')]},'secondDisposition':{'type':Sequelize[_0x58d0('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x58d0('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x58d0('0x7')]},'osName':{'type':Sequelize[_0x58d0('0x7')]},'osVersion':{'type':Sequelize[_0x58d0('0x7')]},'deviceModel':{'type':Sequelize[_0x58d0('0x7')]},'deviceVendor':{'type':Sequelize[_0x58d0('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x58d0('0x6')]},'customerIp':{'type':Sequelize[_0x58d0('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x58d0('0x8'))},'read1stAt':{'type':Sequelize[_0x58d0('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x58d0('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x58d0('0x7')]},'customerPort':{'type':Sequelize[_0x58d0('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x58d0('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x58d0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index cf2f663..278ef47 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 _0xcf0e=['Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','UserId','%s%d','System','customer','Visitor','agentIdentifier','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Smtp','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','pick','ChatInteractionId','options','includeAgent','push','alias','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','lastName','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','localhost','redis','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','result','ChatInteraction,\x20%s,\x20%s','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','contact','agent','interaction','account','index','map','rawAttributes','fieldName','key','getOptions','findAll','chat','query','user','catch','show','params','ChatInteraction','keys','filters','model','attributes','intersection','fields','length','includeAll','include','find','create','body','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','out','ChatMessage','updateAttributes','customUpdate','CmContact'];(function(_0x58fb9d,_0xc4e55f){var _0x1f2c7f=function(_0x114d88){while(--_0x114d88){_0x58fb9d['push'](_0x58fb9d['shift']());}};_0x1f2c7f(++_0xc4e55f);}(_0xcf0e,0x6d));var _0xecf0=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xcf0e[_0xf51c06];return _0x1d5420;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xecf0('0x0'));var rp=require('request-promise');var moment=require(_0xecf0('0x1'));var BPromise=require(_0xecf0('0x2'));var Mustache=require(_0xecf0('0x3'));var util=require(_0xecf0('0x4'));var path=require(_0xecf0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xecf0('0x6'));var Redis=require(_0xecf0('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xecf0('0x8'));var pdf=require(_0xecf0('0x9'));var logger=require('../../config/logger')(_0xecf0('0xa'));var config=require(_0xecf0('0xb'));var db=require(_0xecf0('0xc'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xecf0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecf0('0xe')]));require('./chatInteraction.socket')[_0xecf0('0xf')](socket);var jayson=require(_0xecf0('0x10'));var client=jayson[_0xecf0('0x11')][_0xecf0('0x12')]({'port':0x232b});var client9004=jayson[_0xecf0('0x11')][_0xecf0('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x3d3bbd,_0x37cc31,_0x66c47d,_0x295baf){return new BPromise(function(_0x1bd70d,_0x398793){var _0x276a6c=_0x295baf||client;return _0x276a6c[_0xecf0('0x13')](_0x3d3bbd,_0x66c47d)[_0xecf0('0x14')](function(_0x39e325){logger[_0xecf0('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x37cc31,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x37cc31,_0xecf0('0x16'),JSON[_0xecf0('0x17')](_0x39e325));if(_0x39e325[_0xecf0('0x18')]){if(_0x39e325[_0xecf0('0x18')][_0xecf0('0x19')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x37cc31,_0x39e325[_0xecf0('0x18')][_0xecf0('0x1a')]);return _0x398793(_0x39e325[_0xecf0('0x18')]['message']);}logger[_0xecf0('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x37cc31,_0x39e325[_0xecf0('0x18')][_0xecf0('0x1a')]);return _0x1bd70d(_0x39e325[_0xecf0('0x18')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x37cc31,_0xecf0('0x16'));_0x1bd70d(_0x39e325[_0xecf0('0x1b')]['message']);}})['catch'](function(_0x2e23a8){logger[_0xecf0('0x18')](_0xecf0('0x1c'),_0x37cc31,_0x2e23a8);_0x398793(_0x2e23a8);});});}function respondWithStatusCode(_0x10087b,_0xdbd195){_0xdbd195=_0xdbd195||0xcc;return function(_0x3d21e2){if(_0x3d21e2){return _0x10087b[_0xecf0('0x1d')](_0xdbd195);}return _0x10087b[_0xecf0('0x1e')](_0xdbd195)[_0xecf0('0x1f')]();};}function respondWithResult(_0x4badc7,_0x354f13){_0x354f13=_0x354f13||0xc8;return function(_0x58e9a1){if(_0x58e9a1){return _0x4badc7[_0xecf0('0x1e')](_0x354f13)[_0xecf0('0x20')](_0x58e9a1);}};}function respondWithFilteredResult(_0x42ecb2,_0x15d57c){return function(_0x580727){if(_0x580727){var _0x388619=typeof _0x15d57c[_0xecf0('0x21')]===_0xecf0('0x22')&&typeof _0x15d57c[_0xecf0('0x23')]===_0xecf0('0x22');var _0x15b966=_0x580727[_0xecf0('0x24')];var _0x4aef05=_0x388619?0x0:_0x15d57c[_0xecf0('0x21')];var _0x1fa553=_0x388619?_0x580727[_0xecf0('0x24')]:_0x15d57c[_0xecf0('0x21')]+_0x15d57c['limit'];var _0x448c30;if(_0x1fa553>=_0x15b966){_0x1fa553=_0x15b966;_0x448c30=0xc8;}else{_0x448c30=0xce;}_0x42ecb2[_0xecf0('0x1e')](_0x448c30);return _0x42ecb2[_0xecf0('0x25')](_0xecf0('0x26'),_0x4aef05+'-'+_0x1fa553+'/'+_0x15b966)[_0xecf0('0x20')](_0x580727);}return null;};}function saveUpdates(_0x3b31ee){return function(_0x515512){if(_0x515512){return _0x515512[_0xecf0('0x27')](_0x3b31ee)[_0xecf0('0x14')](function(_0xd3f5b6){return _0xd3f5b6;});}return null;};}function removeEntity(_0x3b643d){return function(_0x124ac4){if(_0x124ac4){return _0x124ac4[_0xecf0('0x28')]()[_0xecf0('0x14')](function(){_0x3b643d['status'](0xcc)[_0xecf0('0x1f')]();});}};}function handleEntityNotFound(_0x53586c){return function(_0x3181d6){if(!_0x3181d6){_0x53586c[_0xecf0('0x1d')](0x194);}return _0x3181d6;};}function handleError(_0x900106,_0x458788){_0x458788=_0x458788||0x1f4;return function(_0x5cdb9b){logger[_0xecf0('0x18')](_0x5cdb9b[_0xecf0('0x29')]);if(_0x5cdb9b[_0xecf0('0x2a')]){delete _0x5cdb9b[_0xecf0('0x2a')];}_0x900106[_0xecf0('0x1e')](_0x458788)['send'](_0x5cdb9b);};}function getMustacheRender(_0x1c4301,_0x5aebed){return Mustache[_0xecf0('0x2b')](_0x1c4301,_[_0xecf0('0x2c')](_0x5aebed['body'],{'contact':_0x5aebed[_0xecf0('0x2d')],'message':_0x5aebed['message'],'agent':_0x5aebed[_0xecf0('0x2e')],'interaction':_0x5aebed[_0xecf0('0x2f')],'account':_0x5aebed[_0xecf0('0x30')]}))||'';}exports[_0xecf0('0x31')]=function(_0xdc91ad,_0x4f4cdb){var _0x475413={};var _0x8a50d2=_[_0xecf0('0x32')](db['ChatInteraction'][_0xecf0('0x33')],function(_0x534048){return{'name':_0x534048[_0xecf0('0x34')],'type':_0x534048['type'][_0xecf0('0x35')]};});_0x475413=qs[_0xecf0('0x36')](_0x8a50d2,_0xdc91ad);return interaction[_0xecf0('0x37')](_0xecf0('0x38'),_0xdc91ad[_0xecf0('0x39')],_0xdc91ad[_0xecf0('0x3a')],_0x475413,_0x8a50d2)['then'](respondWithFilteredResult(_0x4f4cdb,_0x475413))[_0xecf0('0x3b')](handleError(_0x4f4cdb,null));};exports[_0xecf0('0x3c')]=function(_0x4f3e5f,_0x5e15c9){var _0x2652b3={'raw':![],'where':{'id':_0x4f3e5f[_0xecf0('0x3d')]['id']}},_0x252eec={};_0x252eec['model']=_['keys'](db[_0xecf0('0x3e')][_0xecf0('0x33')]);_0x252eec['query']=_[_0xecf0('0x3f')](_0x4f3e5f[_0xecf0('0x39')]);_0x252eec[_0xecf0('0x40')]=_['intersection'](_0x252eec[_0xecf0('0x41')],_0x252eec[_0xecf0('0x39')]);_0x2652b3[_0xecf0('0x42')]=_[_0xecf0('0x43')](_0x252eec[_0xecf0('0x41')],qs['fields'](_0x4f3e5f[_0xecf0('0x39')][_0xecf0('0x44')]));_0x2652b3['attributes']=_0x2652b3[_0xecf0('0x42')][_0xecf0('0x45')]?_0x2652b3['attributes']:_0x252eec['model'];if(_0x4f3e5f[_0xecf0('0x39')][_0xecf0('0x46')]){_0x2652b3[_0xecf0('0x47')]=[{'all':!![]}];}_0x2652b3=_['merge']({},_0x2652b3,_0x4f3e5f['options']);return db[_0xecf0('0x3e')][_0xecf0('0x48')](_0x2652b3)[_0xecf0('0x14')](handleEntityNotFound(_0x5e15c9,null))[_0xecf0('0x14')](respondWithResult(_0x5e15c9,null))[_0xecf0('0x3b')](handleError(_0x5e15c9,null));};exports[_0xecf0('0x49')]=function(_0x1b5bd8,_0x2eee3f){return db[_0xecf0('0x3e')][_0xecf0('0x49')](_0x1b5bd8[_0xecf0('0x4a')],{})[_0xecf0('0x14')](respondWithResult(_0x2eee3f,0xc9))[_0xecf0('0x3b')](handleError(_0x2eee3f,null));};exports['update']=function(_0x49aedf,_0xa518f3){if(_0x49aedf[_0xecf0('0x4a')]['id']){delete _0x49aedf[_0xecf0('0x4a')]['id'];}return db[_0xecf0('0x3e')][_0xecf0('0x48')]({'where':{'id':_0x49aedf[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0xa518f3,null))[_0xecf0('0x14')](saveUpdates(_0x49aedf[_0xecf0('0x4a')],null))[_0xecf0('0x14')](respondWithResult(_0xa518f3,null))[_0xecf0('0x3b')](handleError(_0xa518f3,null));};exports[_0xecf0('0x28')]=function(_0x1f661b,_0x53b978){return db[_0xecf0('0x3e')][_0xecf0('0x48')]({'where':{'id':_0x1f661b[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x53b978,null))[_0xecf0('0x14')](removeEntity(_0x53b978,null))[_0xecf0('0x3b')](handleError(_0x53b978,null));};exports[_0xecf0('0x4b')]=function(_0x20346a,_0x338241){return db['ChatInteraction']['describe']()[_0xecf0('0x14')](respondWithResult(_0x338241,null))['catch'](handleError(_0x338241,null));};exports['createVidaooSession']=function(_0x2e098a,_0x3116e6){var _0xd614c4=_0x2e098a[_0xecf0('0x3d')]['id'];var _0x5d4f3d;var _0x354607;var _0x327399;return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0xd614c4}})[_0xecf0('0x14')](function(_0x5a1663){_0x5d4f3d=_0x5a1663;return db[_0xecf0('0x4d')][_0xecf0('0x4c')]({'where':{'id':_0x5a1663[_0xecf0('0x4e')]},'attributes':['id',_0xecf0('0x4f'),_0xecf0('0x50'),_0xecf0('0x51'),_0xecf0('0x52'),_0xecf0('0x53')],'raw':!![]});})[_0xecf0('0x14')](function(_0x502db8){if(_0x502db8&&_0x502db8['vidaooApiKey']&&_0x502db8['vidaooEscalation']){_0x354607=_0x502db8;var _0x5ceb34={'interaction':{'id':_0xd614c4},'agent':{'id':_0x2e098a[_0xecf0('0x3a')]['id'],'name':_0x2e098a['user']['name'],'fullname':_0x2e098a[_0xecf0('0x3a')][_0xecf0('0x54')],'email':_0x2e098a['user'][_0xecf0('0x55')]},'contact':_0x2e098a[_0xecf0('0x4a')][_0xecf0('0x2d')],'account':_0x2e098a[_0xecf0('0x4a')][_0xecf0('0x30')]};var _0xe817e0={'rejectUnauthorized':![],'method':_0xecf0('0x56'),'url':_0xecf0('0x57'),'headers':{'X-APIKEY':_0x502db8[_0xecf0('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2e098a[_0xecf0('0x3a')][_0xecf0('0x55')]],'buttons':null,'topic':_0x354607[_0xecf0('0x51')],'note':_[_0xecf0('0x58')](_0x354607[_0xecf0('0x52')])?null:getMustacheRender(_0x354607[_0xecf0('0x52')],_0x5ceb34),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x354607[_0xecf0('0x53')])){var _0x375377=getMustacheRender(_0x354607[_0xecf0('0x53')],_0x5ceb34);var _0x463a4c=JSON[_0xecf0('0x59')](_0x375377);_0xe817e0[_0xecf0('0x4a')][_0xecf0('0x5a')]=_0x463a4c;}}catch(_0x3cb581){throw new db[(_0xecf0('0x5b'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xe817e0);}else{throw new db[(_0xecf0('0x5b'))][(_0xecf0('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xecf0('0x14')](function(_0x423bd5){_0x327399=_0x423bd5;if(_0x327399['id']){var _0x216bea={'body':_0x327399['join_url'],'ChatWebsiteId':_0x354607['id'],'ChatInteractionId':_0x5d4f3d['id'],'direction':_0xecf0('0x5d'),'UserId':_0x2e098a['user']['id']};return db[_0xecf0('0x5e')][_0xecf0('0x49')](_0x216bea,{});}else{throw new db[(_0xecf0('0x5b'))][(_0xecf0('0x5c'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xecf0('0x14')](function(){return _0x5d4f3d[_0xecf0('0x5f')]({'vidaooSessionId':_0x327399['id']});})[_0xecf0('0x14')](respondWithResult(_0x3116e6,null))[_0xecf0('0x3b')](handleError(_0x3116e6,null));};exports[_0xecf0('0x60')]=function(_0x3d1e2a,_0x1cdb3e){if(_0x3d1e2a[_0xecf0('0x4a')]['id']){delete _0x3d1e2a['body']['id'];}return db[_0xecf0('0x3e')][_0xecf0('0x48')]({'where':{'id':_0x3d1e2a[_0xecf0('0x3d')]['id']},'include':[{'model':db[_0xecf0('0x61')],'as':_0xecf0('0x62')}]})[_0xecf0('0x14')](handleEntityNotFound(_0x1cdb3e,null))[_0xecf0('0x14')](saveUpdates(_0x3d1e2a[_0xecf0('0x4a')],null))[_0xecf0('0x14')](respondWithResult(_0x1cdb3e,null))[_0xecf0('0x3b')](handleError(_0x1cdb3e,null));};exports[_0xecf0('0x63')]=function(_0x15a937,_0x22ca53){if(_0x15a937[_0xecf0('0x4a')]['id']){delete _0x15a937[_0xecf0('0x4a')]['id'];}return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x15a937[_0xecf0('0x3d')]['id']}})['then'](function(_0x2364d0){if(!_0x2364d0){logger[_0xecf0('0x18')](_0xecf0('0x64'),_0xecf0('0x63'),0x194,_0xecf0('0x65'));_0x22ca53['sendStatus'](0x194);}else{if(_0x2364d0['UserId']){throw new db[(_0xecf0('0x5b'))]['ValidationError'](_0xecf0('0x66'));}}return _0x2364d0;})[_0xecf0('0x14')](function(_0x4c3986){if(_0x4c3986){return _0x4c3986[_0xecf0('0x27')]({'closed':_0x15a937['body']['closed'],'disposition':_0x15a937[_0xecf0('0x4a')][_0xecf0('0x67')]})[_0xecf0('0x14')](function(_0x133bc3){return _0x133bc3;});}})[_0xecf0('0x14')](function(){return respondWithRpcPromise(_0xecf0('0x68'),_0xecf0('0x63'),_0x15a937[_0xecf0('0x4a')],client9004);})['then'](respondWithResult(_0x22ca53,null))[_0xecf0('0x3b')](handleError(_0x22ca53,null));};exports['attachmentUpload']=function(_0x1aef55,_0x37b0c2){_0x1aef55[_0xecf0('0x4a')]['name']=_0x1aef55[_0xecf0('0x69')]['originalname'];_0x1aef55['body'][_0xecf0('0x6a')]=_0x1aef55[_0xecf0('0x69')][_0xecf0('0x6b')];_0x1aef55[_0xecf0('0x4a')]['type']=_0x1aef55[_0xecf0('0x69')][_0xecf0('0x6c')];return db[_0xecf0('0x6d')][_0xecf0('0x49')](_0x1aef55['body'])[_0xecf0('0x14')](respondWithResult(_0x37b0c2,0xc9))['catch'](handleError(_0x37b0c2,null));};exports[_0xecf0('0x6e')]=function(_0x280b11,_0x2f3f3f){return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0x280b11[_0xecf0('0x3d')]['id']},'raw':!![]})[_0xecf0('0x14')](handleEntityNotFound(_0x2f3f3f,null))[_0xecf0('0x14')](function(_0x30c3a0){if(_0x30c3a0){if(_0x30c3a0[_0xecf0('0x6f')]){return _0x2f3f3f[_0xecf0('0x1e')](0x193)[_0xecf0('0x20')]({'status':0x193,'message':_0xecf0('0x70')});}return db[_0xecf0('0x6d')][_0xecf0('0x4c')]({'where':{'id':_0x280b11[_0xecf0('0x39')][_0xecf0('0x71')]},'raw':!![]})[_0xecf0('0x14')](handleEntityNotFound(_0x2f3f3f,null));}})[_0xecf0('0x14')](function(_0x42aeb5){if(_0x42aeb5){var _0x44b854=_0x42aeb5['ChatOfflineMessageId']!==null;var _0x281fe3=path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0x74'));if(_0x44b854){_0x281fe3=path['join'](_0x281fe3,_0xecf0('0x75'));}var _0x226254=path[_0xecf0('0x72')](_0x281fe3,_0x42aeb5[_0xecf0('0x6a')]);return _0x2f3f3f[_0xecf0('0x76')](_0x226254);}})['catch'](handleError(_0x2f3f3f,null));};exports[_0xecf0('0x77')]=function(_0x49ea93,_0x42d4db){var _0xbe9546=null;var _0x861c37=null;var _0x3163d8=null;if(_0x49ea93['body']['id']){delete _0x49ea93['body']['id'];}if(_0x49ea93['body'][_0xecf0('0x78')]){_0x3163d8=path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0x79'),util[_0xecf0('0x7a')](_0xecf0('0x7b'),Date[_0xecf0('0x7c')]()));_0x49ea93[_0xecf0('0x4a')][_0xecf0('0x7d')]=_0x3163d8;}return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x49ea93['params']['id']},'include':[{'model':db[_0xecf0('0x5e')],'as':_0xecf0('0x7e'),'include':[{'model':db[_0xecf0('0x7f')],'as':_0xecf0('0x7f')}]}]})['then'](handleEntityNotFound(_0x42d4db,null))[_0xecf0('0x14')](saveUpdates(_0x49ea93[_0xecf0('0x4a')],null))['then'](function(_0x5357db){if(_0x5357db){_0xbe9546=_0x5357db;return db[_0xecf0('0x4d')][_0xecf0('0x48')]({'where':{'id':_0xbe9546[_0xecf0('0x4e')]}});}})['then'](function(_0x7220c9){if(_0x7220c9){_0x861c37=_0x7220c9;return db[_0xecf0('0x61')]['find']({'where':{'id':_0xbe9546[_0xecf0('0x80')]}});}})[_0xecf0('0x14')](function(_0x1ef488){if(_0x1ef488){if(_0x3163d8){var _0x4d377b=null;for(var _0xc92c99=0x1;_0xc92c99<_0xbe9546['Messages']['length'];++_0xc92c99){_0x4d377b=_0xbe9546[_0xecf0('0x7e')][_0xc92c99];var _0x23ab22=_0x4d377b[_0xecf0('0x81')]?util[_0xecf0('0x7a')](_0xecf0('0x82'),_0x861c37['agentAlias'],_0x4d377b[_0xecf0('0x81')]):_0xecf0('0x83');var _0x29d335=_0x49ea93[_0xecf0('0x4a')][_0xecf0('0x84')]||util[_0xecf0('0x7a')](_0xecf0('0x82'),_0xecf0('0x85'),_0x4d377b[_0xecf0('0x80')]);switch(_0x861c37[_0xecf0('0x86')]){case'website_alias':_0x23ab22=_0x4d377b[_0xecf0('0x81')]?util[_0xecf0('0x7a')](_0xecf0('0x82'),_0x861c37[_0xecf0('0x87')],_0x4d377b[_0xecf0('0x81')]):_0xecf0('0x83');break;case _0xecf0('0x88'):_0x23ab22=_0x4d377b[_0xecf0('0x81')]?_0x4d377b[_0xecf0('0x7f')]['alias']||_0x4d377b[_0xecf0('0x7f')][_0xecf0('0x54')]:_0xecf0('0x83');break;case _0xecf0('0x89'):_0x23ab22=_0x4d377b['UserId']?_0x4d377b[_0xecf0('0x7f')][_0xecf0('0x54')]:_0xecf0('0x83');break;default:_0x23ab22=_0x4d377b[_0xecf0('0x81')]?util[_0xecf0('0x7a')](_0xecf0('0x82'),_0x861c37[_0xecf0('0x87')],_0x4d377b['UserId']):_0xecf0('0x83');}var _0x7d6301=util['format'](_0xecf0('0x8a'),moment(_0x4d377b[_0xecf0('0x8b')])['format'](_0xecf0('0x8c')),_0x4d377b[_0xecf0('0x8d')]==='in'?_0x29d335:_0x23ab22,_0x4d377b[_0xecf0('0x4a')]);if(!_0x4d377b[_0xecf0('0x8e')]){fs[_0xecf0('0x8f')](_0x3163d8,_0x7d6301);}}return db[_0xecf0('0x90')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xecf0('0x91')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xecf0('0x92'),'raw':!![]}]}]});}}})[_0xecf0('0x14')](function(_0x150f9e){if(!_0x150f9e||!_0x150f9e['Smtp']||!_0x49ea93[_0xecf0('0x4a')])return _0xbe9546;var _0x21f900=_0x150f9e[_0xecf0('0x93')]();return respondWithRpcPromise(_0xecf0('0x94'),'sendMail',{'account':_0x21f900,'message':{'from':util[_0xecf0('0x7a')](_0xecf0('0x95'),_0x150f9e[_0xecf0('0x2a')],_0x150f9e[_0xecf0('0x55')]||_0x150f9e[_0xecf0('0x96')][_0xecf0('0x3a')]),'to':_0x49ea93[_0xecf0('0x4a')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xecf0('0x7a')](_0xecf0('0x97'),_0x49ea93[_0xecf0('0x4a')][_0xecf0('0x78')]),'attachments':[{'path':_0x3163d8}]}})['then'](function(){return _0xbe9546;})[_0xecf0('0x3b')](function(_0x260bb4){logger[_0xecf0('0x18')](_0x260bb4);});})[_0xecf0('0x14')](respondWithStatusCode(_0x42d4db,0xc8))['catch'](handleError(_0x42d4db,null));};exports['addMessage']=function(_0x4a5a1b,_0x37a361){return db[_0xecf0('0x5e')][_0xecf0('0x48')]({'where':{'id':_0x4a5a1b[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x37a361,null))[_0xecf0('0x14')](function(_0x4aa412){if(_0x4aa412){return _0x4aa412['addMessage'](_0x4a5a1b['body'][_0xecf0('0x98')],_[_0xecf0('0x99')](_0x4a5a1b[_0xecf0('0x4a')],[_0xecf0('0x98'),'id'])||{});}})[_0xecf0('0x14')](respondWithResult(_0x37a361,null))[_0xecf0('0x3b')](handleError(_0x37a361,null));};exports[_0xecf0('0x9a')]=function(_0x442f41,_0x4e3538){var _0x756e4e={'raw':![],'where':{}};var _0x55f842={};var _0x169a0b={'count':0x0,'rows':[]};return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0x442f41[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x4e3538,null))['then'](function(_0x44bd0d){if(_0x44bd0d){_0x55f842['model']=_[_0xecf0('0x3f')](db[_0xecf0('0x5e')][_0xecf0('0x33')]);_0x55f842[_0xecf0('0x39')]=_[_0xecf0('0x3f')](_0x442f41[_0xecf0('0x39')]);_0x55f842['filters']=_[_0xecf0('0x43')](_0x55f842[_0xecf0('0x41')],_0x55f842['query']);_0x756e4e[_0xecf0('0x42')]=_[_0xecf0('0x43')](_0x55f842[_0xecf0('0x41')],qs[_0xecf0('0x44')](_0x442f41[_0xecf0('0x39')][_0xecf0('0x44')]));_0x756e4e[_0xecf0('0x42')]=_0x756e4e[_0xecf0('0x42')][_0xecf0('0x45')]?_0x756e4e[_0xecf0('0x42')]:_0x55f842[_0xecf0('0x41')];if(!_0x442f41[_0xecf0('0x39')][_0xecf0('0x9b')](_0xecf0('0x9c'))){_0x756e4e[_0xecf0('0x23')]=qs[_0xecf0('0x23')](_0x442f41['query'][_0xecf0('0x23')]);_0x756e4e[_0xecf0('0x21')]=qs[_0xecf0('0x21')](_0x442f41[_0xecf0('0x39')][_0xecf0('0x21')]);}_0x756e4e[_0xecf0('0x9d')]=qs['sort'](_0x442f41[_0xecf0('0x39')][_0xecf0('0x9e')]);_0x756e4e[_0xecf0('0x9f')]=qs['filters'](_['pick'](_0x442f41[_0xecf0('0x39')],_0x55f842[_0xecf0('0x40')]));_0x756e4e[_0xecf0('0x9f')]['ChatInteractionId']=_0x44bd0d['id'];if(_0x442f41[_0xecf0('0x39')]['filter']){_0x756e4e[_0xecf0('0x9f')]=_[_0xecf0('0x2c')](_0x756e4e[_0xecf0('0x9f')],{'$or':_[_0xecf0('0x32')](_0x756e4e[_0xecf0('0x42')],function(_0x24b03a){var _0x3ecf64={};_0x3ecf64[_0x24b03a]={'$like':'%'+_0x442f41[_0xecf0('0x39')][_0xecf0('0xa0')]+'%'};return _0x3ecf64;})});}if(_0x442f41[_0xecf0('0x39')]['$gte']){var _0x519b53=_0x442f41[_0xecf0('0x39')][_0xecf0('0xa1')]['split'](',');var _0x2ff2da={};_0x2ff2da[_0x519b53[0x0]]={'$gte':moment(_0x519b53[0x1])[_0xecf0('0x7a')](_0xecf0('0xa2'))};_0x756e4e[_0xecf0('0x9f')]=_[_0xecf0('0x2c')](_0x756e4e[_0xecf0('0x9f')],_0x2ff2da);}_0x756e4e=_[_0xecf0('0x2c')]({},_0x756e4e,_0x442f41['options']);return db[_0xecf0('0x5e')][_0xecf0('0x24')]({'where':_0x756e4e[_0xecf0('0x9f')]})[_0xecf0('0x14')](function(_0x29c225){_0x169a0b[_0xecf0('0x24')]=_0x29c225;if(_0x442f41[_0xecf0('0x39')][_0xecf0('0x46')]){_0x756e4e['include']=[{'all':!![]}];}return db[_0xecf0('0x5e')]['findAll'](_0x756e4e);})['then'](function(_0x3d4802){_0x169a0b[_0xecf0('0xa3')]=_0x3d4802;return _0x169a0b;});}})['then'](respondWithFilteredResult(_0x4e3538,_0x756e4e))[_0xecf0('0x3b')](handleError(_0x4e3538,null));};exports['getMyMessages']=function(_0x1aa6d1,_0x49b767){var _0x5b9122={'where':{}},_0x3a4ffb={},_0x4acb4a={'count':0x0,'rows':[]};return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0x1aa6d1[_0xecf0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x49b767,null))[_0xecf0('0x14')](function(_0x26645){if(_0x26645){_0x3a4ffb['model']=_['keys'](db[_0xecf0('0x5e')][_0xecf0('0x33')]);_0x3a4ffb[_0xecf0('0x39')]=_[_0xecf0('0x3f')](_0x1aa6d1[_0xecf0('0x39')]);_0x3a4ffb['filters']=_['intersection'](_0x3a4ffb[_0xecf0('0x41')],_0x3a4ffb[_0xecf0('0x39')]);_0x5b9122[_0xecf0('0x42')]=_[_0xecf0('0x43')](_0x3a4ffb[_0xecf0('0x41')],qs[_0xecf0('0x44')](_0x1aa6d1[_0xecf0('0x39')]['fields']));_0x5b9122['attributes']=_0x5b9122[_0xecf0('0x42')][_0xecf0('0x45')]?_0x5b9122[_0xecf0('0x42')]:_0x3a4ffb[_0xecf0('0x41')];if(!_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x9b')]('nolimit')){_0x5b9122[_0xecf0('0x23')]=qs[_0xecf0('0x23')](_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x23')]);_0x5b9122['offset']=qs[_0xecf0('0x21')](_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x21')]);}_0x5b9122[_0xecf0('0x9d')]=qs[_0xecf0('0x9e')](_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x9e')]);_0x5b9122[_0xecf0('0x9f')]=qs[_0xecf0('0x40')](_[_0xecf0('0xa4')](_0x1aa6d1[_0xecf0('0x39')],_0x3a4ffb[_0xecf0('0x40')]));_0x5b9122[_0xecf0('0x9f')][_0xecf0('0xa5')]=_0x26645['id'];if(_0x1aa6d1['query'][_0xecf0('0xa0')]){_0x5b9122[_0xecf0('0x9f')]=_['merge'](_0x5b9122[_0xecf0('0x9f')],{'$or':_[_0xecf0('0x32')](_0x5b9122[_0xecf0('0x42')],function(_0x2ce08f){var _0x22ab73={};_0x22ab73[_0x2ce08f]={'$like':'%'+_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0xa0')]+'%'};return _0x22ab73;})});}_0x5b9122[_0xecf0('0x9f')][_0xecf0('0x8e')]=![];if(_0x1aa6d1[_0xecf0('0x39')]['id']){_0x5b9122[_0xecf0('0x9f')]['id']={'$gt':_0x1aa6d1[_0xecf0('0x39')]['id']};}_0x5b9122=_[_0xecf0('0x2c')]({},_0x5b9122,_0x1aa6d1[_0xecf0('0xa6')]);return db[_0xecf0('0x5e')]['count']({'where':_0x5b9122[_0xecf0('0x9f')]})[_0xecf0('0x14')](function(_0x19f779){_0x4acb4a[_0xecf0('0x24')]=_0x19f779;_0x5b9122['include']=[];if(_0x1aa6d1['query'][_0xecf0('0xa7')]){_0x5b9122[_0xecf0('0x47')][_0xecf0('0xa8')]({'model':db[_0xecf0('0x7f')],'as':'User','attributes':['id',_0xecf0('0x54'),_0xecf0('0xa9')]});}if(_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x46')]){_0x5b9122[_0xecf0('0x47')]=[{'all':!![]}];}return db[_0xecf0('0x5e')][_0xecf0('0x37')](_0x5b9122);})[_0xecf0('0x14')](function(_0xd1ef98){_0x4acb4a[_0xecf0('0xa3')]=_0xd1ef98;return _0x4acb4a;});}})['then'](respondWithFilteredResult(_0x49b767,_0x5b9122))[_0xecf0('0x3b')](handleError(_0x49b767,null));};exports[_0xecf0('0xaa')]=function(_0x49530d,_0x3a7710){return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x49530d[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x3a7710,null))['then'](function(_0x408996){if(_0x408996){return _0x408996['setTags'](_0x49530d['body'][_0xecf0('0x98')],_['omit'](_0x49530d[_0xecf0('0x4a')],['ids','id'])||{})[_0xecf0('0xab')](function(){return db[_0xecf0('0xac')][_0xecf0('0x37')]({'attributes':['id',_0xecf0('0x2a'),_0xecf0('0xad')],'where':{'id':_0x49530d[_0xecf0('0x4a')][_0xecf0('0x98')]}});})[_0xecf0('0x14')](function(_0x556379){socket[_0xecf0('0xae')](_0xecf0('0xaf'),{'id':Number(_0x49530d[_0xecf0('0x3d')]['id']),'tags':_0x556379||[]});return{'id':Number(_0x49530d[_0xecf0('0x3d')]['id']),'tags':_0x556379||[]};});}})['then'](respondWithResult(_0x3a7710,null))[_0xecf0('0x3b')](handleError(_0x3a7710,null));};exports[_0xecf0('0xb0')]=function(_0x444574,_0x1775ad){return db[_0xecf0('0x3e')]['find']({'where':{'id':_0x444574[_0xecf0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1775ad,null))['then'](function(_0x2c90ef){if(_0x2c90ef){return _0x2c90ef[_0xecf0('0xb0')](_0x444574[_0xecf0('0x39')][_0xecf0('0x98')]);}})['then'](respondWithStatusCode(_0x1775ad,null))[_0xecf0('0x3b')](handleError(_0x1775ad,null));};exports[_0xecf0('0x76')]=function(_0x2e75a0,_0x39e8a4){var _0x4cb263=moment()['unix']()[_0xecf0('0xb1')]();var _0x39abc2=path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0xb2'),_0xecf0('0xb3'),_0xecf0('0xb4'));var _0xca76a1=path[_0xecf0('0x72')](config['root'],'server',_0xecf0('0xb3'),'attachments');var _0x453f72=path[_0xecf0('0x72')](_0x39abc2,_0x4cb263);var _0x3a7f13=util['format']('transcript-%d-%s.zip',_0x2e75a0[_0xecf0('0x3d')]['id'],_0x4cb263);var _0x4fe85f=path['join'](_0x39abc2,_0x3a7f13);var _0x32db42=[];_0x32db42['push']({'model':db[_0xecf0('0x7f')],'as':_0xecf0('0x7f'),'attributes':['id',_0xecf0('0x54')],'raw':!![]});_0x32db42['push']({'model':db[_0xecf0('0x61')],'as':_0xecf0('0x62'),'attributes':['id','firstName',_0xecf0('0xb5')],'raw':!![]});if(_0x2e75a0[_0xecf0('0x39')]['attachments']){_0x32db42[_0xecf0('0xa8')]({'model':db[_0xecf0('0x6d')],'as':_0xecf0('0x6d'),'raw':!![]});}var _0x3d795c=[{'model':db['ChatMessage'],'as':_0xecf0('0x7e'),'attributes':['id',_0xecf0('0x4a'),_0xecf0('0x8b'),'direction',_0xecf0('0x8e'),_0xecf0('0xb6')],'include':_0x32db42}];_0x3d795c['push']({'model':db['ChatWebsite'],'as':_0xecf0('0xb7'),'attributes':['id',_0xecf0('0x2a')]});_0x3d795c[_0xecf0('0xa8')]({'model':db['User'],'as':_0xecf0('0xb8'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x2e75a0[_0xecf0('0x3d')]['id']},'include':_0x3d795c})['then'](handleEntityNotFound(_0x39e8a4,null))[_0xecf0('0x14')](function(_0x11e3b0){if(_0x11e3b0){var _0x24a61c=_0x11e3b0['get']({'plain':!![]});fs[_0xecf0('0xb9')](_0x453f72);var _0xfb34c8={'channel':_0xecf0('0xba'),'account':_0x24a61c[_0xecf0('0xb7')]['name'],'agent':_0x24a61c[_0xecf0('0xb8')]?_0x24a61c[_0xecf0('0xb8')][_0xecf0('0x54')]:_0xecf0('0xbb'),'createdAt':moment(_0x24a61c[_0xecf0('0x8b')])[_0xecf0('0x7a')](_0xecf0('0xa2'))[_0xecf0('0xb1')](),'closedAt':_0x24a61c['closed']?moment(_0x24a61c[_0xecf0('0xbc')])['format'](_0xecf0('0xa2'))[_0xecf0('0xb1')]():'','disposition':_0x24a61c[_0xecf0('0x67')],'chatInfo':{'browser':_0x24a61c[_0xecf0('0xbd')],'os':_0x24a61c[_0xecf0('0xbe')],'referer':_0x24a61c[_0xecf0('0xbf')],'customerIp':_0x24a61c['customerIp'],'customerPort':_0x24a61c[_0xecf0('0xc0')]?_0x24a61c['customerPort']:_0xecf0('0xbb')},'messages':_(_0x24a61c[_0xecf0('0x7e')])[_0xecf0('0xc1')]()[_0xecf0('0xa0')]({'secret':![]})[_0xecf0('0x32')](function(_0xb24602){if(_0xb24602['Attachment']){var _0x31f6fb=path[_0xecf0('0x72')](_0xca76a1,_0xb24602[_0xecf0('0x6d')]['basename']);if(fs['existsSync'](_0x31f6fb)){fs[_0xecf0('0xc2')](_0x31f6fb)[_0xecf0('0xc3')](fs[_0xecf0('0xc4')](path[_0xecf0('0x72')](_0x453f72,_0xb24602['Attachment'][_0xecf0('0x6a')])));}}return{'date':moment(_0xb24602[_0xecf0('0x8b')])[_0xecf0('0x7a')](_0xecf0('0xa2'))[_0xecf0('0xb1')](),'sender':_0xb24602[_0xecf0('0x8d')]===_0xecf0('0x5d')?_0xb24602[_0xecf0('0x7f')]?_0xb24602[_0xecf0('0x7f')][_0xecf0('0x54')]:_0xecf0('0x83'):_0xb24602['Contact'][_0xecf0('0xc5')]+(_0xb24602[_0xecf0('0x62')][_0xecf0('0xb5')]?'\x20'+_0xb24602['Contact']['lastName']:''),'body':_0xb24602[_0xecf0('0x6d')]?_0xb24602[_0xecf0('0x6d')][_0xecf0('0x6a')]:_0xb24602[_0xecf0('0x4a')],'direction':_0xb24602[_0xecf0('0x8d')]===_0xecf0('0x5d')?'A':'C','secret':_0xb24602[_0xecf0('0x8e')],'read':_0xb24602[_0xecf0('0xb6')],'attachment':_0xb24602[_0xecf0('0x6d')]};})[_0xecf0('0xc6')]()};return ejs[_0xecf0('0xc7')](path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0xb2'),_0xecf0('0xc8'),_0xecf0('0xc9')),{'interaction':_0xfb34c8})[_0xecf0('0x14')](function(_0x5edffe){var _0x6d1a50=path[_0xecf0('0x72')](_0x453f72,_0xecf0('0xca')+_0x24a61c['id']+'-'+_0x4cb263+_0xecf0('0xcb'));var _0x3007f9={'path':_0x6d1a50,'channel':'Chat','interactionId':_0x24a61c['id']};return pdf[_0xecf0('0xcc')](_0x5edffe,_0x3007f9);})[_0xecf0('0x14')](function(){return new Promise(function(_0x1033ce,_0x43fda2){zipdir(_0x453f72,{'saveTo':_0x4fe85f},function(_0x4ab3d8,_0x49eb9c){if(_0x4ab3d8)return _0x43fda2(_0x4ab3d8);return _0x1033ce(_0x49eb9c);});})[_0xecf0('0x14')](function(){return new BPromise(function(_0x1484c4,_0x350581){rimraf(_0x453f72,function(_0x4707ad){if(_0x4707ad)_0x350581(_0x4707ad);return _0x1484c4();});});})[_0xecf0('0x14')](function(){return _0x39e8a4['download'](_0x4fe85f,_0x3a7f13,function(_0x14e6da){if(_0x14e6da){logger[_0xecf0('0x18')](_0xecf0('0xcd'),_0x14e6da);}else{fs[_0xecf0('0xce')](_0x4fe85f);}});});});}else{return _0x39e8a4[_0xecf0('0x1d')](0xc8);}})[_0xecf0('0x3b')](handleError(_0x39e8a4,null));}; \ No newline at end of file +var _0x85ba=['stack','name','send','render','merge','contact','agent','interaction','account','index','map','rawAttributes','key','getOptions','findAll','query','show','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','ChatInteraction','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','user','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','file','basename','filename','type','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','root','transcript-%s.txt','now','Messages','User','CmContact','UserId','format','%s%d','agentAlias','System','customer','Visitor','ContactId','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailServerOut','Smtp','CloudProvider','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','ids','hasOwnProperty','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','secret','includeAgent','push','addTags','setTags','omit','spread','Tag','color','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','read','Account','mkdirSync','Owner','N.A.','toString','closedAt','browserName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','undefined','offset','count','limit','update','destroy','end','sendStatus'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x85ba,0x164));var _0xa85b=function(_0x404ad0,_0x14c1fd){_0x404ad0=_0x404ad0-0x0;var _0x4b2717=_0x85ba[_0x404ad0];return _0x4b2717;};'use strict';var rimraf=require(_0xa85b('0x0'));var zipdir=require(_0xa85b('0x1'));var rp=require(_0xa85b('0x2'));var moment=require(_0xa85b('0x3'));var BPromise=require(_0xa85b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa85b('0x5'));var Redis=require(_0xa85b('0x6'));var interaction=require(_0xa85b('0x7'));var qs=require(_0xa85b('0x8'));var pdf=require(_0xa85b('0x9'));var logger=require('../../config/logger')(_0xa85b('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa85b('0xb')](config[_0xa85b('0xc')],{'host':_0xa85b('0xd'),'port':0x18eb});var socket=require(_0xa85b('0xe'))(new Redis(config[_0xa85b('0xc')]));require(_0xa85b('0xf'))[_0xa85b('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa85b('0x11')][_0xa85b('0x12')]({'port':0x232b});var client9004=jayson[_0xa85b('0x11')][_0xa85b('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x3882c6,_0x18c723,_0x38fa60,_0x12abb1){return new BPromise(function(_0x5aeb86,_0x1b5e75){var _0x436cea=_0x12abb1||client;return _0x436cea[_0xa85b('0x13')](_0x3882c6,_0x38fa60)[_0xa85b('0x14')](function(_0x2229ef){logger[_0xa85b('0x15')](_0xa85b('0x16'),_0x18c723,_0xa85b('0x17'));logger[_0xa85b('0x18')](_0xa85b('0x19'),_0x18c723,'request\x20sent',JSON['stringify'](_0x2229ef));if(_0x2229ef[_0xa85b('0x1a')]){if(_0x2229ef['error'][_0xa85b('0x1b')]===0x1f4){logger[_0xa85b('0x1a')](_0xa85b('0x16'),_0x18c723,_0x2229ef['error'][_0xa85b('0x1c')]);return _0x1b5e75(_0x2229ef[_0xa85b('0x1a')][_0xa85b('0x1c')]);}logger[_0xa85b('0x1a')](_0xa85b('0x16'),_0x18c723,_0x2229ef[_0xa85b('0x1a')][_0xa85b('0x1c')]);return _0x5aeb86(_0x2229ef[_0xa85b('0x1a')]['message']);}else{logger[_0xa85b('0x15')](_0xa85b('0x16'),_0x18c723,'request\x20sent');_0x5aeb86(_0x2229ef['result'][_0xa85b('0x1c')]);}})[_0xa85b('0x1d')](function(_0x21e58f){logger[_0xa85b('0x1a')](_0xa85b('0x16'),_0x18c723,_0x21e58f);_0x1b5e75(_0x21e58f);});});}function respondWithStatusCode(_0x22181a,_0x2d7132){_0x2d7132=_0x2d7132||0xcc;return function(_0x16cf12){if(_0x16cf12){return _0x22181a['sendStatus'](_0x2d7132);}return _0x22181a['status'](_0x2d7132)['end']();};}function respondWithResult(_0xbe3316,_0xa3ce52){_0xa3ce52=_0xa3ce52||0xc8;return function(_0x56d8a6){if(_0x56d8a6){return _0xbe3316[_0xa85b('0x1e')](_0xa3ce52)[_0xa85b('0x1f')](_0x56d8a6);}};}function respondWithFilteredResult(_0x563875,_0x4285ea){return function(_0xc90b8f){if(_0xc90b8f){var _0x107afb=typeof _0x4285ea['offset']===_0xa85b('0x20')&&typeof _0x4285ea['limit']===_0xa85b('0x20');var _0x2a42af=_0xc90b8f['count'];var _0x5c4ff4=_0x107afb?0x0:_0x4285ea[_0xa85b('0x21')];var _0x5a4acb=_0x107afb?_0xc90b8f[_0xa85b('0x22')]:_0x4285ea[_0xa85b('0x21')]+_0x4285ea[_0xa85b('0x23')];var _0x2d230d;if(_0x5a4acb>=_0x2a42af){_0x5a4acb=_0x2a42af;_0x2d230d=0xc8;}else{_0x2d230d=0xce;}_0x563875[_0xa85b('0x1e')](_0x2d230d);return _0x563875['set']('Content-Range',_0x5c4ff4+'-'+_0x5a4acb+'/'+_0x2a42af)['json'](_0xc90b8f);}return null;};}function saveUpdates(_0x3d76a9){return function(_0x4e7574){if(_0x4e7574){return _0x4e7574[_0xa85b('0x24')](_0x3d76a9)[_0xa85b('0x14')](function(_0x2bc654){return _0x2bc654;});}return null;};}function removeEntity(_0x2d1705){return function(_0x19eac0){if(_0x19eac0){return _0x19eac0[_0xa85b('0x25')]()[_0xa85b('0x14')](function(){_0x2d1705[_0xa85b('0x1e')](0xcc)[_0xa85b('0x26')]();});}};}function handleEntityNotFound(_0x1e865e){return function(_0x4d89c7){if(!_0x4d89c7){_0x1e865e[_0xa85b('0x27')](0x194);}return _0x4d89c7;};}function handleError(_0x247447,_0x2be229){_0x2be229=_0x2be229||0x1f4;return function(_0x45ee94){logger[_0xa85b('0x1a')](_0x45ee94[_0xa85b('0x28')]);if(_0x45ee94[_0xa85b('0x29')]){delete _0x45ee94[_0xa85b('0x29')];}_0x247447['status'](_0x2be229)[_0xa85b('0x2a')](_0x45ee94);};}function getMustacheRender(_0x4260fb,_0x18f0c1){return Mustache[_0xa85b('0x2b')](_0x4260fb,_[_0xa85b('0x2c')](_0x18f0c1['body'],{'contact':_0x18f0c1[_0xa85b('0x2d')],'message':_0x18f0c1[_0xa85b('0x1c')],'agent':_0x18f0c1[_0xa85b('0x2e')],'interaction':_0x18f0c1[_0xa85b('0x2f')],'account':_0x18f0c1[_0xa85b('0x30')]}))||'';}exports[_0xa85b('0x31')]=function(_0x44f489,_0x4440e9){var _0x519a72={};var _0x4a9e15=_[_0xa85b('0x32')](db['ChatInteraction'][_0xa85b('0x33')],function(_0x402858){return{'name':_0x402858['fieldName'],'type':_0x402858['type'][_0xa85b('0x34')]};});_0x519a72=qs[_0xa85b('0x35')](_0x4a9e15,_0x44f489);return interaction[_0xa85b('0x36')]('chat',_0x44f489[_0xa85b('0x37')],_0x44f489['user'],_0x519a72,_0x4a9e15)[_0xa85b('0x14')](respondWithFilteredResult(_0x4440e9,_0x519a72))['catch'](handleError(_0x4440e9,null));};exports[_0xa85b('0x38')]=function(_0x3c02e9,_0x578415){var _0x2fc0c7={'raw':![],'where':{'id':_0x3c02e9[_0xa85b('0x39')]['id']}},_0x240884={};_0x240884['model']=_[_0xa85b('0x3a')](db['ChatInteraction'][_0xa85b('0x33')]);_0x240884[_0xa85b('0x37')]=_[_0xa85b('0x3a')](_0x3c02e9[_0xa85b('0x37')]);_0x240884[_0xa85b('0x3b')]=_[_0xa85b('0x3c')](_0x240884[_0xa85b('0x3d')],_0x240884[_0xa85b('0x37')]);_0x2fc0c7['attributes']=_['intersection'](_0x240884[_0xa85b('0x3d')],qs[_0xa85b('0x3e')](_0x3c02e9[_0xa85b('0x37')]['fields']));_0x2fc0c7[_0xa85b('0x3f')]=_0x2fc0c7[_0xa85b('0x3f')][_0xa85b('0x40')]?_0x2fc0c7['attributes']:_0x240884[_0xa85b('0x3d')];if(_0x3c02e9[_0xa85b('0x37')][_0xa85b('0x41')]){_0x2fc0c7[_0xa85b('0x42')]=[{'all':!![]}];}_0x2fc0c7=_['merge']({},_0x2fc0c7,_0x3c02e9['options']);return db[_0xa85b('0x43')][_0xa85b('0x44')](_0x2fc0c7)[_0xa85b('0x14')](handleEntityNotFound(_0x578415,null))['then'](respondWithResult(_0x578415,null))[_0xa85b('0x1d')](handleError(_0x578415,null));};exports[_0xa85b('0x45')]=function(_0x30c249,_0x5e7672){return db[_0xa85b('0x43')][_0xa85b('0x45')](_0x30c249[_0xa85b('0x46')],{})[_0xa85b('0x14')](respondWithResult(_0x5e7672,0xc9))[_0xa85b('0x1d')](handleError(_0x5e7672,null));};exports['update']=function(_0x3e51e4,_0x5b0f72){if(_0x3e51e4[_0xa85b('0x46')]['id']){delete _0x3e51e4[_0xa85b('0x46')]['id'];}return db[_0xa85b('0x43')]['find']({'where':{'id':_0x3e51e4['params']['id']}})[_0xa85b('0x14')](handleEntityNotFound(_0x5b0f72,null))['then'](saveUpdates(_0x3e51e4[_0xa85b('0x46')],null))[_0xa85b('0x14')](respondWithResult(_0x5b0f72,null))[_0xa85b('0x1d')](handleError(_0x5b0f72,null));};exports[_0xa85b('0x25')]=function(_0x224227,_0x56d406){return db[_0xa85b('0x43')]['find']({'where':{'id':_0x224227['params']['id']}})[_0xa85b('0x14')](handleEntityNotFound(_0x56d406,null))[_0xa85b('0x14')](removeEntity(_0x56d406,null))[_0xa85b('0x1d')](handleError(_0x56d406,null));};exports[_0xa85b('0x47')]=function(_0x3c2f12,_0x52884c){return db['ChatInteraction']['describe']()[_0xa85b('0x14')](respondWithResult(_0x52884c,null))[_0xa85b('0x1d')](handleError(_0x52884c,null));};exports[_0xa85b('0x48')]=function(_0x21cb96,_0xb12743){var _0x3a62c1=_0x21cb96[_0xa85b('0x39')]['id'];var _0x1965d9;var _0x5dfc01;var _0x28c073;return db[_0xa85b('0x43')][_0xa85b('0x49')]({'where':{'id':_0x3a62c1}})[_0xa85b('0x14')](function(_0x527d3f){_0x1965d9=_0x527d3f;return db[_0xa85b('0x4a')][_0xa85b('0x49')]({'where':{'id':_0x527d3f[_0xa85b('0x4b')]},'attributes':['id',_0xa85b('0x4c'),_0xa85b('0x4d'),_0xa85b('0x4e'),'vidaooNote',_0xa85b('0x4f')],'raw':!![]});})[_0xa85b('0x14')](function(_0x31d211){if(_0x31d211&&_0x31d211[_0xa85b('0x4c')]&&_0x31d211['vidaooEscalation']){_0x5dfc01=_0x31d211;var _0x390c6c={'interaction':{'id':_0x3a62c1},'agent':{'id':_0x21cb96[_0xa85b('0x50')]['id'],'name':_0x21cb96[_0xa85b('0x50')][_0xa85b('0x29')],'fullname':_0x21cb96[_0xa85b('0x50')][_0xa85b('0x51')],'email':_0x21cb96[_0xa85b('0x50')][_0xa85b('0x52')]},'contact':_0x21cb96[_0xa85b('0x46')][_0xa85b('0x2d')],'account':_0x21cb96[_0xa85b('0x46')][_0xa85b('0x30')]};var _0x4f39bb={'rejectUnauthorized':![],'method':'POST','url':_0xa85b('0x53'),'headers':{'X-APIKEY':_0x31d211[_0xa85b('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x21cb96[_0xa85b('0x50')][_0xa85b('0x52')]],'buttons':null,'topic':_0x5dfc01[_0xa85b('0x4e')],'note':_[_0xa85b('0x54')](_0x5dfc01[_0xa85b('0x55')])?null:getMustacheRender(_0x5dfc01[_0xa85b('0x55')],_0x390c6c),'metadata':null},'redirect':_0xa85b('0x56'),'json':!![]};try{if(!_[_0xa85b('0x54')](_0x5dfc01[_0xa85b('0x4f')])){var _0x43ca8d=getMustacheRender(_0x5dfc01['vidaooMetadata'],_0x390c6c);var _0x560b76=JSON[_0xa85b('0x57')](_0x43ca8d);_0x4f39bb[_0xa85b('0x46')][_0xa85b('0x58')]=_0x560b76;}}catch(_0x129802){throw new db['Sequelize'][(_0xa85b('0x59'))](_0xa85b('0x5a'));}return rp(_0x4f39bb);}else{throw new db['Sequelize'][(_0xa85b('0x59'))](_0xa85b('0x5b'));}})[_0xa85b('0x14')](function(_0x6eb798){_0x28c073=_0x6eb798;if(_0x28c073['id']){var _0x29fb5a={'body':_0x28c073[_0xa85b('0x5c')],'ChatWebsiteId':_0x5dfc01['id'],'ChatInteractionId':_0x1965d9['id'],'direction':_0xa85b('0x5d'),'UserId':_0x21cb96[_0xa85b('0x50')]['id']};return db[_0xa85b('0x5e')][_0xa85b('0x45')](_0x29fb5a,{});}else{throw new db[(_0xa85b('0x5f'))]['ValidationError'](_0xa85b('0x60'));}})[_0xa85b('0x14')](function(){return _0x1965d9['updateAttributes']({'vidaooSessionId':_0x28c073['id']});})[_0xa85b('0x14')](respondWithResult(_0xb12743,null))[_0xa85b('0x1d')](handleError(_0xb12743,null));};exports['customUpdate']=function(_0x1cca27,_0x41c782){if(_0x1cca27[_0xa85b('0x46')]['id']){delete _0x1cca27['body']['id'];}return db['ChatInteraction'][_0xa85b('0x44')]({'where':{'id':_0x1cca27['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xa85b('0x14')](handleEntityNotFound(_0x41c782,null))['then'](saveUpdates(_0x1cca27[_0xa85b('0x46')],null))[_0xa85b('0x14')](respondWithResult(_0x41c782,null))[_0xa85b('0x1d')](handleError(_0x41c782,null));};exports[_0xa85b('0x61')]=function(_0x17c049,_0x5902a2){if(_0x17c049[_0xa85b('0x46')]['id']){delete _0x17c049[_0xa85b('0x46')]['id'];}return db[_0xa85b('0x43')][_0xa85b('0x44')]({'where':{'id':_0x17c049['params']['id']}})[_0xa85b('0x14')](function(_0x206afd){if(!_0x206afd){logger[_0xa85b('0x1a')](_0xa85b('0x62'),_0xa85b('0x61'),0x194,'entity\x20not\x20found');_0x5902a2['sendStatus'](0x194);}else{if(_0x206afd['UserId']){throw new db[(_0xa85b('0x5f'))][(_0xa85b('0x59'))](_0xa85b('0x63'));}}return _0x206afd;})[_0xa85b('0x14')](function(_0xfc3849){if(_0xfc3849){return _0xfc3849[_0xa85b('0x24')]({'closed':_0x17c049[_0xa85b('0x46')][_0xa85b('0x64')],'disposition':_0x17c049[_0xa85b('0x46')][_0xa85b('0x65')]})[_0xa85b('0x14')](function(_0x53e6a4){return _0x53e6a4;});}})[_0xa85b('0x14')](function(){return respondWithRpcPromise('AbandonInteraction',_0xa85b('0x61'),_0x17c049[_0xa85b('0x46')],client9004);})['then'](respondWithResult(_0x5902a2,null))[_0xa85b('0x1d')](handleError(_0x5902a2,null));};exports['attachmentUpload']=function(_0x244aa9,_0x4d3dac){_0x244aa9[_0xa85b('0x46')][_0xa85b('0x29')]=_0x244aa9[_0xa85b('0x66')]['originalname'];_0x244aa9[_0xa85b('0x46')][_0xa85b('0x67')]=_0x244aa9[_0xa85b('0x66')][_0xa85b('0x68')];_0x244aa9['body'][_0xa85b('0x69')]=_0x244aa9[_0xa85b('0x66')][_0xa85b('0x6a')];return db[_0xa85b('0x6b')]['create'](_0x244aa9['body'])[_0xa85b('0x14')](respondWithResult(_0x4d3dac,0xc9))[_0xa85b('0x1d')](handleError(_0x4d3dac,null));};exports[_0xa85b('0x6c')]=function(_0x5923d3,_0x51eb10){return db[_0xa85b('0x43')]['findOne']({'where':{'id':_0x5923d3[_0xa85b('0x39')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x51eb10,null))[_0xa85b('0x14')](function(_0x57af63){if(_0x57af63){if(_0x57af63[_0xa85b('0x64')]){return _0x51eb10[_0xa85b('0x1e')](0x193)[_0xa85b('0x1f')]({'status':0x193,'message':_0xa85b('0x6d')});}return db[_0xa85b('0x6b')][_0xa85b('0x49')]({'where':{'id':_0x5923d3[_0xa85b('0x37')]['attachId']},'raw':!![]})[_0xa85b('0x14')](handleEntityNotFound(_0x51eb10,null));}})['then'](function(_0x265da4){if(_0x265da4){var _0x9f7648=_0x265da4[_0xa85b('0x6e')]!==null;var _0x2ea47a=path[_0xa85b('0x6f')](config['root'],_0xa85b('0x70'));if(_0x9f7648){_0x2ea47a=path[_0xa85b('0x6f')](_0x2ea47a,'offline-chat/');}var _0x1fd799=path[_0xa85b('0x6f')](_0x2ea47a,_0x265da4[_0xa85b('0x67')]);return _0x51eb10[_0xa85b('0x71')](_0x1fd799);}})[_0xa85b('0x1d')](handleError(_0x51eb10,null));};exports['close']=function(_0x1c0c98,_0x4b4149){var _0x44c483=null;var _0x1750bf=null;var _0xe51bfd=null;if(_0x1c0c98[_0xa85b('0x46')]['id']){delete _0x1c0c98['body']['id'];}if(_0x1c0c98['body'][_0xa85b('0x72')]){_0xe51bfd=path[_0xa85b('0x6f')](config[_0xa85b('0x73')],'server/files/chat/upload/',util['format'](_0xa85b('0x74'),Date[_0xa85b('0x75')]()));_0x1c0c98[_0xa85b('0x46')]['pathTranscript']=_0xe51bfd;}return db['ChatInteraction'][_0xa85b('0x44')]({'where':{'id':_0x1c0c98[_0xa85b('0x39')]['id']},'include':[{'model':db[_0xa85b('0x5e')],'as':_0xa85b('0x76'),'include':[{'model':db[_0xa85b('0x77')],'as':'User'}]}]})[_0xa85b('0x14')](handleEntityNotFound(_0x4b4149,null))[_0xa85b('0x14')](saveUpdates(_0x1c0c98['body'],null))[_0xa85b('0x14')](function(_0x14abd3){if(_0x14abd3){_0x44c483=_0x14abd3;return db[_0xa85b('0x4a')][_0xa85b('0x44')]({'where':{'id':_0x44c483['ChatWebsiteId']}});}})[_0xa85b('0x14')](function(_0x50f0f6){if(_0x50f0f6){_0x1750bf=_0x50f0f6;return db[_0xa85b('0x78')][_0xa85b('0x44')]({'where':{'id':_0x44c483['ContactId']}});}})['then'](function(_0x2f257c){if(_0x2f257c){if(_0xe51bfd){var _0x22e1b7=null;for(var _0x293259=0x1;_0x293259<_0x44c483['Messages'][_0xa85b('0x40')];++_0x293259){_0x22e1b7=_0x44c483['Messages'][_0x293259];var _0x3cf617=_0x22e1b7[_0xa85b('0x79')]?util[_0xa85b('0x7a')](_0xa85b('0x7b'),_0x1750bf[_0xa85b('0x7c')],_0x22e1b7[_0xa85b('0x79')]):_0xa85b('0x7d');var _0x11b1d7=_0x1c0c98[_0xa85b('0x46')][_0xa85b('0x7e')]||util[_0xa85b('0x7a')]('%s%d',_0xa85b('0x7f'),_0x22e1b7[_0xa85b('0x80')]);switch(_0x1750bf[_0xa85b('0x81')]){case _0xa85b('0x82'):_0x3cf617=_0x22e1b7[_0xa85b('0x79')]?util[_0xa85b('0x7a')](_0xa85b('0x7b'),_0x1750bf[_0xa85b('0x7c')],_0x22e1b7[_0xa85b('0x79')]):_0xa85b('0x7d');break;case _0xa85b('0x83'):_0x3cf617=_0x22e1b7['UserId']?_0x22e1b7['User'][_0xa85b('0x84')]||_0x22e1b7['User'][_0xa85b('0x51')]:_0xa85b('0x7d');break;case'agent_fullname':_0x3cf617=_0x22e1b7[_0xa85b('0x79')]?_0x22e1b7['User'][_0xa85b('0x51')]:'System';break;default:_0x3cf617=_0x22e1b7[_0xa85b('0x79')]?util[_0xa85b('0x7a')](_0xa85b('0x7b'),_0x1750bf['agentAlias'],_0x22e1b7[_0xa85b('0x79')]):'System';}var _0x177013=util[_0xa85b('0x7a')](_0xa85b('0x85'),moment(_0x22e1b7[_0xa85b('0x86')])[_0xa85b('0x7a')](_0xa85b('0x87')),_0x22e1b7[_0xa85b('0x88')]==='in'?_0x11b1d7:_0x3cf617,_0x22e1b7[_0xa85b('0x46')]);if(!_0x22e1b7['secret']){fs['appendFileSync'](_0xe51bfd,_0x177013);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa85b('0x89')],'as':_0xa85b('0x8a'),'raw':!![],'include':[{'model':db[_0xa85b('0x8b')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xa85b('0x14')](function(_0x59b2fd){if(!_0x59b2fd||!_0x59b2fd[_0xa85b('0x8a')]||!_0x1c0c98[_0xa85b('0x46')])return _0x44c483;var _0xe290d3=_0x59b2fd['getSmtpOptions']();return respondWithRpcPromise(_0xa85b('0x8c'),'sendMail',{'account':_0xe290d3,'message':{'from':util[_0xa85b('0x7a')](_0xa85b('0x8d'),_0x59b2fd[_0xa85b('0x29')],_0x59b2fd[_0xa85b('0x52')]||_0x59b2fd[_0xa85b('0x8a')]['user']),'to':_0x1c0c98[_0xa85b('0x46')][_0xa85b('0x72')],'subject':_0xa85b('0x8e'),'text':util[_0xa85b('0x7a')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x1c0c98[_0xa85b('0x46')][_0xa85b('0x72')]),'attachments':[{'path':_0xe51bfd}]}})['then'](function(){return _0x44c483;})[_0xa85b('0x1d')](function(_0xf789e9){logger[_0xa85b('0x1a')](_0xf789e9);});})['then'](respondWithStatusCode(_0x4b4149,0xc8))['catch'](handleError(_0x4b4149,null));};exports['addMessage']=function(_0x515df5,_0x14f2bc){return db[_0xa85b('0x5e')][_0xa85b('0x44')]({'where':{'id':_0x515df5[_0xa85b('0x39')]['id']}})[_0xa85b('0x14')](handleEntityNotFound(_0x14f2bc,null))[_0xa85b('0x14')](function(_0x178022){if(_0x178022){return _0x178022['addMessage'](_0x515df5['body']['ids'],_['omit'](_0x515df5[_0xa85b('0x46')],[_0xa85b('0x8f'),'id'])||{});}})[_0xa85b('0x14')](respondWithResult(_0x14f2bc,null))[_0xa85b('0x1d')](handleError(_0x14f2bc,null));};exports['getMessages']=function(_0x477657,_0x38c324){var _0xb14363={'raw':![],'where':{}};var _0x2afefa={};var _0x366284={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa85b('0x49')]({'where':{'id':_0x477657['params']['id']}})['then'](handleEntityNotFound(_0x38c324,null))[_0xa85b('0x14')](function(_0x426f75){if(_0x426f75){_0x2afefa[_0xa85b('0x3d')]=_[_0xa85b('0x3a')](db['ChatMessage'][_0xa85b('0x33')]);_0x2afefa[_0xa85b('0x37')]=_[_0xa85b('0x3a')](_0x477657['query']);_0x2afefa['filters']=_[_0xa85b('0x3c')](_0x2afefa[_0xa85b('0x3d')],_0x2afefa[_0xa85b('0x37')]);_0xb14363[_0xa85b('0x3f')]=_[_0xa85b('0x3c')](_0x2afefa[_0xa85b('0x3d')],qs['fields'](_0x477657[_0xa85b('0x37')]['fields']));_0xb14363['attributes']=_0xb14363[_0xa85b('0x3f')][_0xa85b('0x40')]?_0xb14363[_0xa85b('0x3f')]:_0x2afefa[_0xa85b('0x3d')];if(!_0x477657['query'][_0xa85b('0x90')]('nolimit')){_0xb14363[_0xa85b('0x23')]=qs['limit'](_0x477657[_0xa85b('0x37')][_0xa85b('0x23')]);_0xb14363[_0xa85b('0x21')]=qs[_0xa85b('0x21')](_0x477657[_0xa85b('0x37')][_0xa85b('0x21')]);}_0xb14363[_0xa85b('0x91')]=qs[_0xa85b('0x92')](_0x477657[_0xa85b('0x37')][_0xa85b('0x92')]);_0xb14363['where']=qs[_0xa85b('0x3b')](_[_0xa85b('0x93')](_0x477657['query'],_0x2afefa[_0xa85b('0x3b')]));_0xb14363[_0xa85b('0x94')][_0xa85b('0x95')]=_0x426f75['id'];if(_0x477657[_0xa85b('0x37')][_0xa85b('0x96')]){_0xb14363[_0xa85b('0x94')]=_['merge'](_0xb14363[_0xa85b('0x94')],{'$or':_['map'](_0xb14363[_0xa85b('0x3f')],function(_0x94df8e){var _0x1502e5={};_0x1502e5[_0x94df8e]={'$like':'%'+_0x477657[_0xa85b('0x37')][_0xa85b('0x96')]+'%'};return _0x1502e5;})});}if(_0x477657['query'][_0xa85b('0x97')]){var _0x4daf75=_0x477657[_0xa85b('0x37')][_0xa85b('0x97')][_0xa85b('0x98')](',');var _0x4ddee1={};_0x4ddee1[_0x4daf75[0x0]]={'$gte':moment(_0x4daf75[0x1])[_0xa85b('0x7a')](_0xa85b('0x99'))};_0xb14363['where']=_[_0xa85b('0x2c')](_0xb14363[_0xa85b('0x94')],_0x4ddee1);}_0xb14363=_[_0xa85b('0x2c')]({},_0xb14363,_0x477657[_0xa85b('0x9a')]);return db[_0xa85b('0x5e')][_0xa85b('0x22')]({'where':_0xb14363[_0xa85b('0x94')]})['then'](function(_0x12efd7){_0x366284[_0xa85b('0x22')]=_0x12efd7;if(_0x477657['query'][_0xa85b('0x41')]){_0xb14363['include']=[{'all':!![]}];}return db[_0xa85b('0x5e')][_0xa85b('0x36')](_0xb14363);})[_0xa85b('0x14')](function(_0x1c68a4){_0x366284[_0xa85b('0x9b')]=_0x1c68a4;return _0x366284;});}})['then'](respondWithFilteredResult(_0x38c324,_0xb14363))[_0xa85b('0x1d')](handleError(_0x38c324,null));};exports[_0xa85b('0x9c')]=function(_0x3b726c,_0x238574){var _0x486c7b={'where':{}},_0x4096ce={},_0x56798d={'count':0x0,'rows':[]};return db[_0xa85b('0x43')][_0xa85b('0x49')]({'where':{'id':_0x3b726c[_0xa85b('0x39')]['id']}})[_0xa85b('0x14')](handleEntityNotFound(_0x238574,null))[_0xa85b('0x14')](function(_0x17ebed){if(_0x17ebed){_0x4096ce['model']=_[_0xa85b('0x3a')](db[_0xa85b('0x5e')][_0xa85b('0x33')]);_0x4096ce[_0xa85b('0x37')]=_[_0xa85b('0x3a')](_0x3b726c[_0xa85b('0x37')]);_0x4096ce[_0xa85b('0x3b')]=_['intersection'](_0x4096ce['model'],_0x4096ce[_0xa85b('0x37')]);_0x486c7b[_0xa85b('0x3f')]=_[_0xa85b('0x3c')](_0x4096ce[_0xa85b('0x3d')],qs[_0xa85b('0x3e')](_0x3b726c[_0xa85b('0x37')][_0xa85b('0x3e')]));_0x486c7b[_0xa85b('0x3f')]=_0x486c7b['attributes'][_0xa85b('0x40')]?_0x486c7b[_0xa85b('0x3f')]:_0x4096ce[_0xa85b('0x3d')];if(!_0x3b726c['query'][_0xa85b('0x90')]('nolimit')){_0x486c7b[_0xa85b('0x23')]=qs[_0xa85b('0x23')](_0x3b726c[_0xa85b('0x37')]['limit']);_0x486c7b[_0xa85b('0x21')]=qs['offset'](_0x3b726c['query'][_0xa85b('0x21')]);}_0x486c7b[_0xa85b('0x91')]=qs[_0xa85b('0x92')](_0x3b726c[_0xa85b('0x37')]['sort']);_0x486c7b[_0xa85b('0x94')]=qs[_0xa85b('0x3b')](_['pick'](_0x3b726c[_0xa85b('0x37')],_0x4096ce[_0xa85b('0x3b')]));_0x486c7b[_0xa85b('0x94')]['ChatInteractionId']=_0x17ebed['id'];if(_0x3b726c['query']['filter']){_0x486c7b[_0xa85b('0x94')]=_[_0xa85b('0x2c')](_0x486c7b[_0xa85b('0x94')],{'$or':_[_0xa85b('0x32')](_0x486c7b[_0xa85b('0x3f')],function(_0x1e7022){var _0x2749c4={};_0x2749c4[_0x1e7022]={'$like':'%'+_0x3b726c[_0xa85b('0x37')][_0xa85b('0x96')]+'%'};return _0x2749c4;})});}_0x486c7b[_0xa85b('0x94')][_0xa85b('0x9d')]=![];if(_0x3b726c[_0xa85b('0x37')]['id']){_0x486c7b[_0xa85b('0x94')]['id']={'$gt':_0x3b726c[_0xa85b('0x37')]['id']};}_0x486c7b=_['merge']({},_0x486c7b,_0x3b726c[_0xa85b('0x9a')]);return db['ChatMessage'][_0xa85b('0x22')]({'where':_0x486c7b[_0xa85b('0x94')]})[_0xa85b('0x14')](function(_0xb052b1){_0x56798d[_0xa85b('0x22')]=_0xb052b1;_0x486c7b[_0xa85b('0x42')]=[];if(_0x3b726c[_0xa85b('0x37')][_0xa85b('0x9e')]){_0x486c7b[_0xa85b('0x42')][_0xa85b('0x9f')]({'model':db[_0xa85b('0x77')],'as':'User','attributes':['id',_0xa85b('0x51'),_0xa85b('0x84')]});}if(_0x3b726c[_0xa85b('0x37')][_0xa85b('0x41')]){_0x486c7b['include']=[{'all':!![]}];}return db[_0xa85b('0x5e')][_0xa85b('0x36')](_0x486c7b);})['then'](function(_0x31ae74){_0x56798d['rows']=_0x31ae74;return _0x56798d;});}})['then'](respondWithFilteredResult(_0x238574,_0x486c7b))[_0xa85b('0x1d')](handleError(_0x238574,null));};exports[_0xa85b('0xa0')]=function(_0x38228b,_0x40a94d){return db[_0xa85b('0x43')]['find']({'where':{'id':_0x38228b['params']['id']}})['then'](handleEntityNotFound(_0x40a94d,null))[_0xa85b('0x14')](function(_0x3384f6){if(_0x3384f6){return _0x3384f6[_0xa85b('0xa1')](_0x38228b[_0xa85b('0x46')][_0xa85b('0x8f')],_[_0xa85b('0xa2')](_0x38228b[_0xa85b('0x46')],['ids','id'])||{})[_0xa85b('0xa3')](function(){return db[_0xa85b('0xa4')][_0xa85b('0x36')]({'attributes':['id',_0xa85b('0x29'),_0xa85b('0xa5')],'where':{'id':_0x38228b['body']['ids']}});})['then'](function(_0x278b00){socket['emit']('chatInteractionTags:save',{'id':Number(_0x38228b[_0xa85b('0x39')]['id']),'tags':_0x278b00||[]});return{'id':Number(_0x38228b[_0xa85b('0x39')]['id']),'tags':_0x278b00||[]};});}})['then'](respondWithResult(_0x40a94d,null))[_0xa85b('0x1d')](handleError(_0x40a94d,null));};exports[_0xa85b('0xa6')]=function(_0x2e1524,_0x54491a){return db[_0xa85b('0x43')][_0xa85b('0x44')]({'where':{'id':_0x2e1524['params']['id']}})['then'](handleEntityNotFound(_0x54491a,null))['then'](function(_0x58cdac){if(_0x58cdac){return _0x58cdac[_0xa85b('0xa6')](_0x2e1524[_0xa85b('0x37')][_0xa85b('0x8f')]);}})['then'](respondWithStatusCode(_0x54491a,null))[_0xa85b('0x1d')](handleError(_0x54491a,null));};exports[_0xa85b('0x71')]=function(_0x6c71f9,_0x38ddc6){var _0x360475=moment()[_0xa85b('0xa7')]()['toString']();var _0x3674c5=path[_0xa85b('0x6f')](config[_0xa85b('0x73')],_0xa85b('0xa8'),_0xa85b('0xa9'),_0xa85b('0xaa'));var _0x148c04=path[_0xa85b('0x6f')](config[_0xa85b('0x73')],'server',_0xa85b('0xa9'),_0xa85b('0xab'));var _0x4bc0c0=path[_0xa85b('0x6f')](_0x3674c5,_0x360475);var _0x59fd1c=util[_0xa85b('0x7a')](_0xa85b('0xac'),_0x6c71f9[_0xa85b('0x39')]['id'],_0x360475);var _0x44665e=path[_0xa85b('0x6f')](_0x3674c5,_0x59fd1c);var _0x27a787=[];_0x27a787['push']({'model':db[_0xa85b('0x77')],'as':'User','attributes':['id',_0xa85b('0x51')],'raw':!![]});_0x27a787['push']({'model':db[_0xa85b('0x78')],'as':_0xa85b('0xad'),'attributes':['id',_0xa85b('0xae'),_0xa85b('0xaf')],'raw':!![]});if(_0x6c71f9[_0xa85b('0x37')][_0xa85b('0xab')]){_0x27a787['push']({'model':db[_0xa85b('0x6b')],'as':_0xa85b('0x6b'),'raw':!![]});}var _0x562172=[{'model':db[_0xa85b('0x5e')],'as':_0xa85b('0x76'),'attributes':['id',_0xa85b('0x46'),_0xa85b('0x86'),_0xa85b('0x88'),_0xa85b('0x9d'),_0xa85b('0xb0')],'include':_0x27a787}];_0x562172[_0xa85b('0x9f')]({'model':db[_0xa85b('0x4a')],'as':_0xa85b('0xb1'),'attributes':['id',_0xa85b('0x29')]});_0x562172['push']({'model':db[_0xa85b('0x77')],'as':'Owner','attributes':['id',_0xa85b('0x51')]});return db[_0xa85b('0x43')][_0xa85b('0x44')]({'where':{'id':_0x6c71f9[_0xa85b('0x39')]['id']},'include':_0x562172})['then'](handleEntityNotFound(_0x38ddc6,null))['then'](function(_0x438216){if(_0x438216){var _0x1b9177=_0x438216['get']({'plain':!![]});fs[_0xa85b('0xb2')](_0x4bc0c0);var _0x514c3a={'channel':'Chat','account':_0x1b9177['Account']['name'],'agent':_0x1b9177[_0xa85b('0xb3')]?_0x1b9177[_0xa85b('0xb3')][_0xa85b('0x51')]:_0xa85b('0xb4'),'createdAt':moment(_0x1b9177[_0xa85b('0x86')])[_0xa85b('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa85b('0xb5')](),'closedAt':_0x1b9177[_0xa85b('0x64')]?moment(_0x1b9177[_0xa85b('0xb6')])[_0xa85b('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa85b('0xb5')]():'','disposition':_0x1b9177['disposition'],'chatInfo':{'browser':_0x1b9177[_0xa85b('0xb7')],'os':_0x1b9177['osName'],'referer':_0x1b9177['referer'],'customerIp':_0x1b9177[_0xa85b('0xb8')],'customerPort':_0x1b9177[_0xa85b('0xb9')]?_0x1b9177[_0xa85b('0xb9')]:'N.A.'},'messages':_(_0x1b9177[_0xa85b('0x76')])[_0xa85b('0xba')]()[_0xa85b('0x96')]({'secret':![]})[_0xa85b('0x32')](function(_0x14e55a){if(_0x14e55a[_0xa85b('0x6b')]){var _0x29fe33=path['join'](_0x148c04,_0x14e55a[_0xa85b('0x6b')][_0xa85b('0x67')]);if(fs[_0xa85b('0xbb')](_0x29fe33)){fs[_0xa85b('0xbc')](_0x29fe33)['pipe'](fs[_0xa85b('0xbd')](path[_0xa85b('0x6f')](_0x4bc0c0,_0x14e55a['Attachment']['basename'])));}}return{'date':moment(_0x14e55a[_0xa85b('0x86')])['format'](_0xa85b('0x99'))[_0xa85b('0xb5')](),'sender':_0x14e55a[_0xa85b('0x88')]===_0xa85b('0x5d')?_0x14e55a[_0xa85b('0x77')]?_0x14e55a['User'][_0xa85b('0x51')]:_0xa85b('0x7d'):_0x14e55a[_0xa85b('0xad')][_0xa85b('0xae')]+(_0x14e55a['Contact']['lastName']?'\x20'+_0x14e55a[_0xa85b('0xad')][_0xa85b('0xaf')]:''),'body':_0x14e55a['Attachment']?_0x14e55a[_0xa85b('0x6b')][_0xa85b('0x67')]:_0x14e55a[_0xa85b('0x46')],'direction':_0x14e55a[_0xa85b('0x88')]===_0xa85b('0x5d')?'A':'C','secret':_0x14e55a[_0xa85b('0x9d')],'read':_0x14e55a[_0xa85b('0xb0')],'attachment':_0x14e55a[_0xa85b('0x6b')]};})[_0xa85b('0xbe')]()};return ejs[_0xa85b('0xbf')](path[_0xa85b('0x6f')](config['root'],_0xa85b('0xa8'),_0xa85b('0xc0'),_0xa85b('0xc1')),{'interaction':_0x514c3a})['then'](function(_0x3fcd09){var _0x26628d=path[_0xa85b('0x6f')](_0x4bc0c0,_0xa85b('0xc2')+_0x1b9177['id']+'-'+_0x360475+_0xa85b('0xc3'));var _0x23ffcd={'path':_0x26628d,'channel':'Chat','interactionId':_0x1b9177['id']};return pdf['createPdfFromHTML'](_0x3fcd09,_0x23ffcd);})[_0xa85b('0x14')](function(){return new Promise(function(_0x36ff28,_0x3f0a74){zipdir(_0x4bc0c0,{'saveTo':_0x44665e},function(_0x25001d,_0x2cb3f7){if(_0x25001d)return _0x3f0a74(_0x25001d);return _0x36ff28(_0x2cb3f7);});})[_0xa85b('0x14')](function(){return new BPromise(function(_0x4a1b9f,_0x1203f3){rimraf(_0x4bc0c0,function(_0x37fa95){if(_0x37fa95)_0x1203f3(_0x37fa95);return _0x4a1b9f();});});})[_0xa85b('0x14')](function(){return _0x38ddc6['download'](_0x44665e,_0x59fd1c,function(_0x549852){if(_0x549852){logger[_0xa85b('0x1a')](_0xa85b('0xc4'),_0x549852);}else{fs[_0xa85b('0xc5')](_0x44665e);}});});});}else{return _0x38ddc6['sendStatus'](0xc8);}})[_0xa85b('0x1d')](handleError(_0x38ddc6,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f37ba97..cd25482 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 _0xea71=['events','../../mysqldb','setMaxListeners','save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x2a8020,_0x30b23d){var _0x239636=function(_0x29aa39){while(--_0x29aa39){_0x2a8020['push'](_0x2a8020['shift']());}};_0x239636(++_0x30b23d);}(_0xea71,0x143));var _0x1ea7=function(_0x2d060e,_0xbfe514){_0x2d060e=_0x2d060e-0x0;var _0x36a103=_0xea71[_0x2d060e];return _0x36a103;};'use strict';var EventEmitter=require(_0x1ea7('0x0'));var ChatInteraction=require(_0x1ea7('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x1ea7('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1ea7('0x2')](0x0);var events={'afterCreate':_0x1ea7('0x3'),'afterUpdate':_0x1ea7('0x4'),'afterDestroy':_0x1ea7('0x5')};function emitEvent(_0x43ba7f){return function(_0xbcd225,_0x179c11,_0x1862ba){_0xbcd225['getUsers']({'attributes':['id'],'raw':!![]})[_0x1ea7('0x6')](function(_0x312a7b){_0xbcd225[_0x1ea7('0x7')]('Users',_0x312a7b[_0x1ea7('0x8')](function(_0x5a486e){return{'id':_0x5a486e['id']};}));return ChatMessage[_0x1ea7('0x9')]({'where':{'ChatInteractionId':_0xbcd225['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x521c38){_0xbcd225[_0x1ea7('0x7')](_0x1ea7('0xa'),_0x521c38[_0x1ea7('0xb')]);ChatInteractionEvents[_0x1ea7('0xc')](_0x43ba7f+':'+_0xbcd225['id'],_0xbcd225);ChatInteractionEvents['emit'](_0x43ba7f,_0xbcd225);_0x1862ba(null);})[_0x1ea7('0xd')](_0x1862ba(null));};}for(var e in events){if(events[_0x1ea7('0xe')](e)){var event=events[e];ChatInteraction[_0x1ea7('0xf')](e,emitEvent(event));}}module[_0x1ea7('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x3169=['../../mysqldb','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','ChatInteraction'];(function(_0x2e7698,_0x2d1bb8){var _0x438792=function(_0x1ebc69){while(--_0x1ebc69){_0x2e7698['push'](_0x2e7698['shift']());}};_0x438792(++_0x2d1bb8);}(_0x3169,0xe0));var _0x9316=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x3169[_0x35fabd];return _0x61a8ee;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x9316('0x0')];var ChatMessage=require(_0x9316('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9316('0x2'),'afterDestroy':_0x9316('0x3')};function emitEvent(_0x2adbc5){return function(_0x3c9063,_0x20e3c4,_0x202440){_0x3c9063[_0x9316('0x4')]({'attributes':['id'],'raw':!![]})[_0x9316('0x5')](function(_0x5182de){_0x3c9063[_0x9316('0x6')](_0x9316('0x7'),_0x5182de[_0x9316('0x8')](function(_0xd374bb){return{'id':_0xd374bb['id']};}));return ChatMessage[_0x9316('0x9')]({'where':{'ChatInteractionId':_0x3c9063['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9316('0x5')](function(_0x35ca0f){_0x3c9063['setDataValue'](_0x9316('0xa'),_0x35ca0f[_0x9316('0xb')]);ChatInteractionEvents[_0x9316('0xc')](_0x2adbc5+':'+_0x3c9063['id'],_0x3c9063);ChatInteractionEvents[_0x9316('0xc')](_0x2adbc5,_0x3c9063);_0x202440(null);})[_0x9316('0xd')](_0x202440(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x9316('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 78f4185..d608031 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 _0xcc49=['request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x2d9c11,_0x2a4c8a){var _0x3b3e89=function(_0x415955){while(--_0x415955){_0x2d9c11['push'](_0x2d9c11['shift']());}};_0x3b3e89(++_0x2a4c8a);}(_0xcc49,0x1c8));var _0x9cc4=function(_0x336c8b,_0x56b55b){_0x336c8b=_0x336c8b-0x0;var _0x4dd2f6=_0xcc49[_0x336c8b];return _0x4dd2f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9cc4('0x0'))(_0x9cc4('0x1'));var moment=require(_0x9cc4('0x2'));var BPromise=require('bluebird');var rp=require(_0x9cc4('0x3'));var fs=require('fs');var path=require(_0x9cc4('0x4'));var rimraf=require(_0x9cc4('0x5'));var config=require(_0x9cc4('0x6'));var attributes=require(_0x9cc4('0x7'));module[_0x9cc4('0x8')]=function(_0x54c3e8,_0x4e5446){return _0x54c3e8['define'](_0x9cc4('0x9'),attributes,{'tableName':_0x9cc4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4205c4,_0xe41488,_0x595ac1){if(_0x4205c4[_0x9cc4('0xb')](_0x9cc4('0xc'))){_0x4205c4[_0x9cc4('0xd')]=moment()[_0x9cc4('0xe')](_0x9cc4('0xf'));}_0x595ac1(null,_0x4205c4);}},'charset':'utf8mb4','collate':_0x9cc4('0x10')});}; \ No newline at end of file +var _0xfc03=['chat_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x4de042,_0x2ffbde){var _0x25d892=function(_0x798332){while(--_0x798332){_0x4de042['push'](_0x4de042['shift']());}};_0x25d892(++_0x2ffbde);}(_0xfc03,0x1da));var _0x3fc0=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xfc03[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var logger=require(_0x3fc0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3fc0('0x2'));var rp=require(_0x3fc0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3fc0('0x4'));var attributes=require(_0x3fc0('0x5'));module[_0x3fc0('0x6')]=function(_0x4160ae,_0xda8ecb){return _0x4160ae['define']('ChatInteraction',attributes,{'tableName':_0x3fc0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ecf55,_0x5a255f,_0x365044){if(_0x3ecf55['changed']('closed')){_0x3ecf55[_0x3fc0('0x8')]=moment()[_0x3fc0('0x9')](_0x3fc0('0xa'));}_0x365044(null,_0x3ecf55);}},'charset':_0x3fc0('0xb'),'collate':_0x3fc0('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 995aee8..997ead5 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 _0xd7f1=['message','result','UpdateChatInteraction','options','raw','where','attributes','limit','info','debug','catch','AddTagsToChatInteraction','addTags','body','ids','omit','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7f1,0xcf));var _0x1d7f=function(_0x1e1858,_0x2bc0ec){_0x1e1858=_0x1e1858-0x0;var _0x4d8d7a=_0xd7f1[_0x1e1858];return _0x4d8d7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d7f('0x0'));var BPromise=require(_0x1d7f('0x1'));var rs=require(_0x1d7f('0x2'));var fs=require('fs');var Redis=require(_0x1d7f('0x3'));var db=require(_0x1d7f('0x4'))['db'];var utils=require(_0x1d7f('0x5'));var logger=require(_0x1d7f('0x6'))(_0x1d7f('0x7'));var config=require(_0x1d7f('0x8'));var jayson=require(_0x1d7f('0x9'));var client=jayson[_0x1d7f('0xa')]['http']({'port':0x232a});config[_0x1d7f('0xb')]=_['defaults'](config['redis'],{'host':_0x1d7f('0xc'),'port':0x18eb});var socket=require(_0x1d7f('0xd'))(new Redis(config[_0x1d7f('0xb')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x42167e,_0xae04ad,_0x30b968){return new BPromise(function(_0x16dcf0,_0x500446){return client[_0x1d7f('0xe')](_0x42167e,_0x30b968)[_0x1d7f('0xf')](function(_0x342dc2){logger['info'](_0x1d7f('0x10'),_0xae04ad,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xae04ad,_0x1d7f('0x11'),JSON[_0x1d7f('0x12')](_0x342dc2));if(_0x342dc2[_0x1d7f('0x13')]){if(_0x342dc2[_0x1d7f('0x13')][_0x1d7f('0x14')]===0x1f4){logger[_0x1d7f('0x13')](_0x1d7f('0x10'),_0xae04ad,_0x342dc2['error']['message']);return _0x500446(_0x342dc2[_0x1d7f('0x13')]['message']);}logger['error'](_0x1d7f('0x10'),_0xae04ad,_0x342dc2['error'][_0x1d7f('0x15')]);return _0x16dcf0(_0x342dc2[_0x1d7f('0x13')][_0x1d7f('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0xae04ad,_0x1d7f('0x11'));_0x16dcf0(_0x342dc2[_0x1d7f('0x16')]['message']);}})['catch'](function(_0x35f1de){logger[_0x1d7f('0x13')](_0x1d7f('0x10'),_0xae04ad,_0x35f1de);_0x500446(_0x35f1de);});});}exports[_0x1d7f('0x17')]=function(_0x3770d6){var _0x3bd63a=this;return new Promise(function(_0x37e65b,_0xf5e0d8){return db['ChatInteraction']['update'](_0x3770d6['body'],{'raw':_0x3770d6[_0x1d7f('0x18')]?_0x3770d6[_0x1d7f('0x18')][_0x1d7f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3770d6[_0x1d7f('0x18')]?_0x3770d6['options'][_0x1d7f('0x1a')]||null:null,'attributes':_0x3770d6['options']?_0x3770d6['options'][_0x1d7f('0x1b')]||null:null,'limit':_0x3770d6['options']?_0x3770d6[_0x1d7f('0x18')][_0x1d7f('0x1c')]||null:null})[_0x1d7f('0xf')](function(_0x54ea9e){logger[_0x1d7f('0x1d')](_0x1d7f('0x17'),_0x3770d6);logger[_0x1d7f('0x1e')](_0x1d7f('0x17'),_0x3770d6,JSON[_0x1d7f('0x12')](_0x54ea9e));_0x37e65b(_0x54ea9e);})[_0x1d7f('0x1f')](function(_0x3a0037){logger['error'](_0x1d7f('0x17'),_0x3a0037[_0x1d7f('0x15')],_0x3770d6);_0xf5e0d8(_0x3bd63a[_0x1d7f('0x13')](0x1f4,_0x3a0037[_0x1d7f('0x15')]));});});};exports[_0x1d7f('0x20')]=function(_0x242ef6){return new Promise(function(_0x43115b,_0x42f4ab){return db['ChatInteraction']['find']({'where':_0x242ef6[_0x1d7f('0x18')]?_0x242ef6[_0x1d7f('0x18')][_0x1d7f('0x1a')]||null:null})[_0x1d7f('0xf')](function(_0x3ddbc3){if(_0x3ddbc3){return _0x3ddbc3[_0x1d7f('0x21')](_0x242ef6[_0x1d7f('0x22')][_0x1d7f('0x23')],_[_0x1d7f('0x24')](_0x242ef6['body'],['ids','id'])||{});}})['spread'](function(_0x1f8628){logger['info'](_0x1d7f('0x25'),_0x242ef6);logger['debug'](_0x1d7f('0x25'),_0x242ef6,JSON[_0x1d7f('0x12')](_0x1f8628));_0x43115b(_0x1f8628);})[_0x1d7f('0x1f')](function(_0x247c46){logger[_0x1d7f('0x13')]('AddTags',_0x247c46['message'],_0x242ef6);_0x42f4ab(_this[_0x1d7f('0x13')](0x1f4,_0x247c46[_0x1d7f('0x15')]));});});}; \ No newline at end of file +var _0x192a=['redis','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','catch','ChatInteraction','find','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter'];(function(_0x2fb9b5,_0x1e1bdc){var _0x3f8993=function(_0x37fe74){while(--_0x37fe74){_0x2fb9b5['push'](_0x2fb9b5['shift']());}};_0x3f8993(++_0x1e1bdc);}(_0x192a,0x16b));var _0xa192=function(_0x5ba67a,_0x444e05){_0x5ba67a=_0x5ba67a-0x0;var _0xc76b82=_0x192a[_0x5ba67a];return _0xc76b82;};'use strict';var _=require('lodash');var util=require(_0xa192('0x0'));var moment=require(_0xa192('0x1'));var BPromise=require(_0xa192('0x2'));var rs=require(_0xa192('0x3'));var fs=require('fs');var Redis=require(_0xa192('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa192('0x5'));var logger=require(_0xa192('0x6'))(_0xa192('0x7'));var config=require(_0xa192('0x8'));var jayson=require(_0xa192('0x9'));var client=jayson[_0xa192('0xa')][_0xa192('0xb')]({'port':0x232a});config['redis']=_[_0xa192('0xc')](config['redis'],{'host':_0xa192('0xd'),'port':0x18eb});var socket=require(_0xa192('0xe'))(new Redis(config[_0xa192('0xf')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x11ca0e,_0x16e687,_0x316f12){return new BPromise(function(_0x28870d,_0x4b3e65){return client[_0xa192('0x10')](_0x11ca0e,_0x316f12)[_0xa192('0x11')](function(_0x185a57){logger[_0xa192('0x12')](_0xa192('0x13'),_0x16e687,'request\x20sent');logger[_0xa192('0x14')](_0xa192('0x15'),_0x16e687,_0xa192('0x16'),JSON[_0xa192('0x17')](_0x185a57));if(_0x185a57['error']){if(_0x185a57[_0xa192('0x18')][_0xa192('0x19')]===0x1f4){logger[_0xa192('0x18')](_0xa192('0x13'),_0x16e687,_0x185a57[_0xa192('0x18')][_0xa192('0x1a')]);return _0x4b3e65(_0x185a57[_0xa192('0x18')][_0xa192('0x1a')]);}logger[_0xa192('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x16e687,_0x185a57[_0xa192('0x18')][_0xa192('0x1a')]);return _0x28870d(_0x185a57[_0xa192('0x18')][_0xa192('0x1a')]);}else{logger['info'](_0xa192('0x13'),_0x16e687,_0xa192('0x16'));_0x28870d(_0x185a57['result'][_0xa192('0x1a')]);}})['catch'](function(_0x5bccb9){logger[_0xa192('0x18')](_0xa192('0x13'),_0x16e687,_0x5bccb9);_0x4b3e65(_0x5bccb9);});});}exports[_0xa192('0x1b')]=function(_0x568df7){var _0x4f66bf=this;return new Promise(function(_0x5877bc,_0x245cff){return db['ChatInteraction'][_0xa192('0x1c')](_0x568df7[_0xa192('0x1d')],{'raw':_0x568df7[_0xa192('0x1e')]?_0x568df7[_0xa192('0x1e')][_0xa192('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568df7[_0xa192('0x1e')]?_0x568df7[_0xa192('0x1e')][_0xa192('0x20')]||null:null,'attributes':_0x568df7[_0xa192('0x1e')]?_0x568df7['options'][_0xa192('0x21')]||null:null,'limit':_0x568df7[_0xa192('0x1e')]?_0x568df7[_0xa192('0x1e')][_0xa192('0x22')]||null:null})['then'](function(_0x356e12){logger[_0xa192('0x12')](_0xa192('0x1b'),_0x568df7);logger[_0xa192('0x14')](_0xa192('0x1b'),_0x568df7,JSON[_0xa192('0x17')](_0x356e12));_0x5877bc(_0x356e12);})[_0xa192('0x23')](function(_0x46d78a){logger['error'](_0xa192('0x1b'),_0x46d78a[_0xa192('0x1a')],_0x568df7);_0x245cff(_0x4f66bf[_0xa192('0x18')](0x1f4,_0x46d78a[_0xa192('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x14ba44){return new Promise(function(_0x2e6f46,_0x230eb9){return db[_0xa192('0x24')][_0xa192('0x25')]({'where':_0x14ba44[_0xa192('0x1e')]?_0x14ba44[_0xa192('0x1e')][_0xa192('0x20')]||null:null})['then'](function(_0x518939){if(_0x518939){return _0x518939['addTags'](_0x14ba44[_0xa192('0x1d')][_0xa192('0x26')],_[_0xa192('0x27')](_0x14ba44[_0xa192('0x1d')],[_0xa192('0x26'),'id'])||{});}})[_0xa192('0x28')](function(_0x41d67e){logger['info'](_0xa192('0x29'),_0x14ba44);logger[_0xa192('0x14')](_0xa192('0x29'),_0x14ba44,JSON[_0xa192('0x17')](_0x41d67e));_0x2e6f46(_0x41d67e);})['catch'](function(_0x39b6ab){logger[_0xa192('0x18')]('AddTags',_0x39b6ab['message'],_0x14ba44);_0x230eb9(_this['error'](0x1f4,_0x39b6ab[_0xa192('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4be9081..55b9dd0 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 _0x0a7f=['chatInteraction:','remove','update','emit','removeListener','register'];(function(_0x5c1a4c,_0x3778b2){var _0x5c66b7=function(_0x9756e6){while(--_0x9756e6){_0x5c1a4c['push'](_0x5c1a4c['shift']());}};_0x5c66b7(++_0x3778b2);}(_0x0a7f,0xdf));var _0xf0a7=function(_0x2c63ac,_0x1df97a){_0x2c63ac=_0x2c63ac-0x0;var _0xdf3040=_0x0a7f[_0x2c63ac];return _0xdf3040;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xf0a7('0x0'),_0xf0a7('0x1')];function createListener(_0x4fffb2,_0x100fdd){return function(_0x4cda0c){_0x100fdd[_0xf0a7('0x2')](_0x4fffb2,_0x4cda0c);};}function removeListener(_0xf15212,_0xeaac94){return function(){ChatInteractionEvents[_0xf0a7('0x3')](_0xf15212,_0xeaac94);};}exports[_0xf0a7('0x4')]=function(_0x42e27a){for(var _0x305ea6=0x0,_0x19ffa7=events['length'];_0x305ea6<_0x19ffa7;_0x305ea6++){var _0x22dc7c=events[_0x305ea6];var _0x20e7fa=createListener(_0xf0a7('0x5')+_0x22dc7c,_0x42e27a);ChatInteractionEvents['on'](_0x22dc7c,_0x20e7fa);}}; \ No newline at end of file +var _0xbede=['register','length','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x56f8d7,_0x334464){var _0x1b6aee=function(_0x1b36c0){while(--_0x1b36c0){_0x56f8d7['push'](_0x56f8d7['shift']());}};_0x1b6aee(++_0x334464);}(_0xbede,0xe2));var _0xebed=function(_0x3eb717,_0x5252d3){_0x3eb717=_0x3eb717-0x0;var _0x2cff84=_0xbede[_0x3eb717];return _0x2cff84;};'use strict';var ChatInteractionEvents=require(_0xebed('0x0'));var events=[_0xebed('0x1'),_0xebed('0x2'),_0xebed('0x3')];function createListener(_0x50f199,_0x3e62fc){return function(_0x342534){_0x3e62fc[_0xebed('0x4')](_0x50f199,_0x342534);};}function removeListener(_0xd6c0ff,_0x2ba01f){return function(){ChatInteractionEvents[_0xebed('0x5')](_0xd6c0ff,_0x2ba01f);};}exports[_0xebed('0x6')]=function(_0x31e450){for(var _0x43c86b=0x0,_0x50e029=events[_0xebed('0x7')];_0x43c86b<_0x50e029;_0x43c86b++){var _0x5a16a0=events[_0x43c86b];var _0x17a745=createListener('chatInteraction:'+_0x5a16a0,_0x31e450);ChatInteractionEvents['on'](_0x5a16a0,_0x17a745);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 160bc25..e35cc33 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 _0x998f=['../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chat','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x998f,0x136));var _0xf998=function(_0x45de99,_0x2b5ffd){_0x45de99=_0x45de99-0x0;var _0x2c846d=_0x998f[_0x45de99];return _0x2c846d;};'use strict';var multer=require(_0xf998('0x0'));var util=require(_0xf998('0x1'));var path=require(_0xf998('0x2'));var timeout=require(_0xf998('0x3'));var express=require(_0xf998('0x4'));var router=express[_0xf998('0x5')]();var fs_extra=require(_0xf998('0x6'));var auth=require(_0xf998('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf998('0x8'));var controller=require(_0xf998('0x9'));router['get']('/',auth[_0xf998('0xa')](),controller[_0xf998('0xb')]);router[_0xf998('0xc')](_0xf998('0xd'),auth['isAuthenticated'](),controller[_0xf998('0xe')]);router[_0xf998('0xc')](_0xf998('0xf'),auth[_0xf998('0x10')](),controller[_0xf998('0x11')]);router[_0xf998('0xc')]('/:id/attachment_download',auth[_0xf998('0x10')](),controller[_0xf998('0x12')]);router[_0xf998('0xc')](_0xf998('0x13'),auth[_0xf998('0xa')](),controller[_0xf998('0x14')]);router['get'](_0xf998('0x15'),auth[_0xf998('0x10')](),controller['getMyMessages']);router['get']('/:id/download',auth[_0xf998('0xa')](),controller[_0xf998('0x16')]);router['post']('/',auth[_0xf998('0xa')](),controller[_0xf998('0x17')]);router[_0xf998('0x18')](_0xf998('0x19'),auth[_0xf998('0xa')](),controller[_0xf998('0x1a')]);var upload=multer({'storage':multer[_0xf998('0x1b')]({'destination':function(_0x34d18a,_0x3f2bc2,_0x1e7343){_0x1e7343(null,path[_0xf998('0x1c')](config[_0xf998('0x1d')],_0xf998('0x1e')));},'filename':function(_0x42733f,_0x177e25,_0xad57ac){_0xad57ac(null,util['format'](_0xf998('0x1f'),Date[_0xf998('0x20')](),_0x177e25[_0xf998('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf998('0x18')](_0xf998('0x22'),upload[_0xf998('0x23')]('file'),controller[_0xf998('0x24')]);router[_0xf998('0x18')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0xf998('0x25'),auth[_0xf998('0xa')](),interaction[_0xf998('0x26')]('chat',_0xf998('0x27')),controller[_0xf998('0x28')]);router[_0xf998('0x29')](_0xf998('0xf'),auth[_0xf998('0xa')](),interaction[_0xf998('0x26')]('chat','chatinteraction:update'),controller['update']);router['put'](_0xf998('0x2a'),controller[_0xf998('0x2b')]);router[_0xf998('0x29')](_0xf998('0x2c'),auth[_0xf998('0x10')](),controller[_0xf998('0x2d')]);router['put'](_0xf998('0x2e'),controller[_0xf998('0x2f')]);router[_0xf998('0x30')]('/:id',auth[_0xf998('0xa')](),interaction[_0xf998('0x26')](_0xf998('0x31'),_0xf998('0x32')),controller[_0xf998('0x33')]);router[_0xf998('0x30')](_0xf998('0x25'),auth[_0xf998('0xa')](),controller[_0xf998('0x34')]);module['exports']=router; \ No newline at end of file +var _0xdb1f=['%s-%s','now','originalname','replace','single','file','attachmentUpload','addMessage','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','close','delete','destroy','/:id/tags','removeTags','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','isAuthenticated','getMessages','/:id/my_messages','/:id/download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb1f,0x79));var _0xfdb1=function(_0x1ba66b,_0x4b6c1e){_0x1ba66b=_0x1ba66b-0x0;var _0xa07e97=_0xdb1f[_0x1ba66b];return _0xa07e97;};'use strict';var multer=require(_0xfdb1('0x0'));var util=require(_0xfdb1('0x1'));var path=require('path');var timeout=require(_0xfdb1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfdb1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfdb1('0x4'));var config=require(_0xfdb1('0x5'));var controller=require(_0xfdb1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xfdb1('0x7')]);router[_0xfdb1('0x8')](_0xfdb1('0x9'),auth['isAuthenticated'](),controller[_0xfdb1('0xa')]);router[_0xfdb1('0x8')](_0xfdb1('0xb'),auth[_0xfdb1('0xc')](),controller[_0xfdb1('0xd')]);router[_0xfdb1('0x8')]('/:id/attachment_download',auth[_0xfdb1('0xc')](),controller[_0xfdb1('0xe')]);router[_0xfdb1('0x8')](_0xfdb1('0xf'),auth[_0xfdb1('0x10')](),controller[_0xfdb1('0x11')]);router[_0xfdb1('0x8')](_0xfdb1('0x12'),auth[_0xfdb1('0xc')](),controller['getMyMessages']);router[_0xfdb1('0x8')](_0xfdb1('0x13'),auth[_0xfdb1('0x10')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xfdb1('0x14')]);router[_0xfdb1('0x15')](_0xfdb1('0x16'),auth[_0xfdb1('0x10')](),controller[_0xfdb1('0x17')]);var upload=multer({'storage':multer[_0xfdb1('0x18')]({'destination':function(_0x58a3dc,_0x24d2f9,_0x154f6a){_0x154f6a(null,path[_0xfdb1('0x19')](config['root'],'server/files/attachments/'));},'filename':function(_0xcb4374,_0x3f39d7,_0x303283){_0x303283(null,util['format'](_0xfdb1('0x1a'),Date[_0xfdb1('0x1b')](),_0x3f39d7[_0xfdb1('0x1c')][_0xfdb1('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfdb1('0x15')]('/:id/attachment_upload',upload[_0xfdb1('0x1e')](_0xfdb1('0x1f')),controller[_0xfdb1('0x20')]);router['post'](_0xfdb1('0xf'),auth[_0xfdb1('0xc')](),controller[_0xfdb1('0x21')]);router[_0xfdb1('0x15')]('/:id/tags',auth[_0xfdb1('0x10')](),interaction[_0xfdb1('0x22')]('chat',_0xfdb1('0x23')),controller[_0xfdb1('0x24')]);router[_0xfdb1('0x25')](_0xfdb1('0xb'),auth[_0xfdb1('0x10')](),interaction[_0xfdb1('0x22')](_0xfdb1('0x26'),_0xfdb1('0x27')),controller[_0xfdb1('0x28')]);router[_0xfdb1('0x25')]('/:id/custom_update',controller[_0xfdb1('0x29')]);router[_0xfdb1('0x25')](_0xfdb1('0x2a'),auth[_0xfdb1('0xc')](),controller[_0xfdb1('0x2b')]);router[_0xfdb1('0x25')]('/:id/close',controller[_0xfdb1('0x2c')]);router[_0xfdb1('0x2d')](_0xfdb1('0xb'),auth[_0xfdb1('0x10')](),interaction[_0xfdb1('0x22')](_0xfdb1('0x26'),'chatinteraction:destroy'),controller[_0xfdb1('0x2e')]);router['delete'](_0xfdb1('0x2f'),auth[_0xfdb1('0x10')](),controller[_0xfdb1('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 0f3a2fc..5fdb0d1 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 _0xdd7f=['sequelize','medium','BOOLEAN'];(function(_0x1ef0dd,_0x4435ea){var _0x18710c=function(_0x419133){while(--_0x419133){_0x1ef0dd['push'](_0x1ef0dd['shift']());}};_0x18710c(++_0x4435ea);}(_0xdd7f,0x1d7));var _0xfdd7=function(_0x3d125d,_0xc2ce6a){_0x3d125d=_0x3d125d-0x0;var _0x3c7a20=_0xdd7f[_0x3d125d];return _0x3c7a20;};'use strict';var Sequelize=require(_0xfdd7('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xfdd7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfdd7('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x835a=['sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x835a,0x1b8));var _0xa835=function(_0x49c9a7,_0x1d4918){_0x49c9a7=_0x49c9a7-0x0;var _0x11e20a=_0x835a[_0x49c9a7];return _0x11e20a;};'use strict';var Sequelize=require(_0xa835('0x0'));module[_0xa835('0x1')]={'body':{'type':Sequelize[_0xa835('0x2')](_0xa835('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa835('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 7afde40..71d977f 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 _0x4daa=['showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','then','sendStatus','error','name','send','map','ChatInternalMessage','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','filter','merge','type','includeAll','include','findAll','catch','show','params','keys','fields','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','userpic','internal','online'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x4daa,0x1b6));var _0xa4da=function(_0x295e7f,_0x1a4d59){_0x295e7f=_0x295e7f-0x0;var _0xdb8b56=_0x4daa[_0x295e7f];return _0xdb8b56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4da('0x0'));var zipdir=require(_0xa4da('0x1'));var jsonpatch=require(_0xa4da('0x2'));var rp=require(_0xa4da('0x3'));var moment=require(_0xa4da('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4da('0x5'));var path=require(_0xa4da('0x6'));var sox=require(_0xa4da('0x7'));var csv=require(_0xa4da('0x8'));var ejs=require(_0xa4da('0x9'));var fs=require('fs');var fs_extra=require(_0xa4da('0xa'));var _=require(_0xa4da('0xb'));var squel=require(_0xa4da('0xc'));var crypto=require('crypto');var jsforce=require(_0xa4da('0xd'));var deskjs=require(_0xa4da('0xe'));var toCsv=require(_0xa4da('0x8'));var querystring=require(_0xa4da('0xf'));var Papa=require(_0xa4da('0x10'));var Redis=require(_0xa4da('0x11'));var authService=require(_0xa4da('0x12'));var qs=require(_0xa4da('0x13'));var as=require(_0xa4da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4da('0x15'))(_0xa4da('0x16'));var utils=require(_0xa4da('0x17'));var config=require(_0xa4da('0x18'));var licenseUtil=require(_0xa4da('0x19'));var db=require(_0xa4da('0x1a'))['db'];config['redis']=_[_0xa4da('0x1b')](config[_0xa4da('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4da('0x1d'))(new Redis(config[_0xa4da('0x1c')]));require(_0xa4da('0x1e'))[_0xa4da('0x1f')](socket);function respondWithStatusCode(_0x21ccd1,_0x3929dd){_0x3929dd=_0x3929dd||0xcc;return function(_0x4094a0){if(_0x4094a0){return _0x21ccd1['sendStatus'](_0x3929dd);}return _0x21ccd1[_0xa4da('0x20')](_0x3929dd)['end']();};}function respondWithResult(_0x212c6c,_0x14c8b9){_0x14c8b9=_0x14c8b9||0xc8;return function(_0x44ffeb){if(_0x44ffeb){return _0x212c6c[_0xa4da('0x20')](_0x14c8b9)[_0xa4da('0x21')](_0x44ffeb);}};}function respondWithFilteredResult(_0x4541d8,_0x24f322){return function(_0x5c9d8f){if(_0x5c9d8f){var _0x19ef99=typeof _0x24f322['offset']===_0xa4da('0x22')&&typeof _0x24f322['limit']===_0xa4da('0x22');var _0x230543=_0x5c9d8f[_0xa4da('0x23')];var _0x5f3e5b=_0x19ef99?0x0:_0x24f322[_0xa4da('0x24')];var _0x5be1f5=_0x19ef99?_0x5c9d8f[_0xa4da('0x23')]:_0x24f322[_0xa4da('0x24')]+_0x24f322[_0xa4da('0x25')];var _0x29b83c;if(_0x5be1f5>=_0x230543){_0x5be1f5=_0x230543;_0x29b83c=0xc8;}else{_0x29b83c=0xce;}_0x4541d8[_0xa4da('0x20')](_0x29b83c);return _0x4541d8['set'](_0xa4da('0x26'),_0x5f3e5b+'-'+_0x5be1f5+'/'+_0x230543)[_0xa4da('0x21')](_0x5c9d8f);}return null;};}function patchUpdates(_0x583616){return function(_0x34a6ea){try{jsonpatch[_0xa4da('0x27')](_0x34a6ea,_0x583616,!![]);}catch(_0x3a544d){return BPromise[_0xa4da('0x28')](_0x3a544d);}return _0x34a6ea[_0xa4da('0x29')]();};}function saveUpdates(_0x48bfd2,_0x297af2){return function(_0x2a46c1){if(_0x2a46c1){return _0x2a46c1['update'](_0x48bfd2)['then'](function(_0x1d9757){return _0x1d9757;});}return null;};}function removeEntity(_0x378069,_0x442b1f){return function(_0x5133ad){if(_0x5133ad){return _0x5133ad[_0xa4da('0x2a')]()[_0xa4da('0x2b')](function(){_0x378069['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x103083,_0x52ab8b){return function(_0x28e4bd){if(!_0x28e4bd){_0x103083[_0xa4da('0x2c')](0x194);}return _0x28e4bd;};}function handleError(_0x4f095f,_0x2636fd){_0x2636fd=_0x2636fd||0x1f4;return function(_0x2477cb){logger[_0xa4da('0x2d')](_0x2477cb['stack']);if(_0x2477cb['name']){delete _0x2477cb[_0xa4da('0x2e')];}_0x4f095f[_0xa4da('0x20')](_0x2636fd)[_0xa4da('0x2f')](_0x2477cb);};}exports['index']=function(_0x3e60de,_0x558024){var _0x2cb1a2={},_0x15c1c6={},_0x191c84={'count':0x0,'rows':[]};var _0x2f2153=_[_0xa4da('0x30')](db[_0xa4da('0x31')]['rawAttributes'],function(_0x3daf65){return{'name':_0x3daf65['fieldName'],'type':_0x3daf65['type'][_0xa4da('0x32')]};});_0x15c1c6[_0xa4da('0x33')]=_[_0xa4da('0x30')](_0x2f2153,'name');_0x15c1c6[_0xa4da('0x34')]=_['keys'](_0x3e60de[_0xa4da('0x34')]);_0x15c1c6[_0xa4da('0x35')]=_[_0xa4da('0x36')](_0x15c1c6[_0xa4da('0x33')],_0x15c1c6[_0xa4da('0x34')]);_0x2cb1a2[_0xa4da('0x37')]=_['intersection'](_0x15c1c6['model'],qs['fields'](_0x3e60de['query']['fields']));_0x2cb1a2[_0xa4da('0x37')]=_0x2cb1a2[_0xa4da('0x37')][_0xa4da('0x38')]?_0x2cb1a2[_0xa4da('0x37')]:_0x15c1c6[_0xa4da('0x33')];if(!_0x3e60de[_0xa4da('0x34')]['hasOwnProperty'](_0xa4da('0x39'))){_0x2cb1a2[_0xa4da('0x25')]=qs[_0xa4da('0x25')](_0x3e60de[_0xa4da('0x34')]['limit']);_0x2cb1a2[_0xa4da('0x24')]=qs[_0xa4da('0x24')](_0x3e60de[_0xa4da('0x34')][_0xa4da('0x24')]);}_0x2cb1a2['order']=qs[_0xa4da('0x3a')](_0x3e60de[_0xa4da('0x34')][_0xa4da('0x3a')]);_0x2cb1a2[_0xa4da('0x3b')]=qs['filters'](_['pick'](_0x3e60de[_0xa4da('0x34')],_0x15c1c6[_0xa4da('0x35')]),_0x2f2153);if(_0x3e60de[_0xa4da('0x34')][_0xa4da('0x3c')]){_0x2cb1a2['where']=_[_0xa4da('0x3d')](_0x2cb1a2[_0xa4da('0x3b')],{'$or':_[_0xa4da('0x30')](_0x2f2153,function(_0x27a614){if(_0x27a614[_0xa4da('0x3e')]!=='VIRTUAL'){var _0xadc6f0={};_0xadc6f0[_0x27a614[_0xa4da('0x2e')]]={'$like':'%'+_0x3e60de[_0xa4da('0x34')]['filter']+'%'};return _0xadc6f0;}})});}_0x2cb1a2=_[_0xa4da('0x3d')]({},_0x2cb1a2,_0x3e60de['options']);var _0x306f05={'where':_0x2cb1a2[_0xa4da('0x3b')]};return db[_0xa4da('0x31')][_0xa4da('0x23')](_0x306f05)[_0xa4da('0x2b')](function(_0x24f8ca){_0x191c84[_0xa4da('0x23')]=_0x24f8ca;if(_0x3e60de[_0xa4da('0x34')][_0xa4da('0x3f')]){_0x2cb1a2[_0xa4da('0x40')]=[{'all':!![]}];}return db[_0xa4da('0x31')][_0xa4da('0x41')](_0x2cb1a2);})[_0xa4da('0x2b')](function(_0x3a8cc2){_0x191c84['rows']=_0x3a8cc2;return _0x191c84;})['then'](respondWithFilteredResult(_0x558024,_0x2cb1a2))[_0xa4da('0x42')](handleError(_0x558024,null));};exports[_0xa4da('0x43')]=function(_0xc2a3f8,_0xeb8a76){var _0x2f6655={'raw':!![],'where':{'id':_0xc2a3f8[_0xa4da('0x44')]['id']}},_0x22309d={};_0x22309d['model']=_[_0xa4da('0x45')](db[_0xa4da('0x31')]['rawAttributes']);_0x22309d[_0xa4da('0x34')]=_[_0xa4da('0x45')](_0xc2a3f8[_0xa4da('0x34')]);_0x22309d['filters']=_[_0xa4da('0x36')](_0x22309d['model'],_0x22309d[_0xa4da('0x34')]);_0x2f6655[_0xa4da('0x37')]=_[_0xa4da('0x36')](_0x22309d[_0xa4da('0x33')],qs[_0xa4da('0x46')](_0xc2a3f8[_0xa4da('0x34')]['fields']));_0x2f6655['attributes']=_0x2f6655[_0xa4da('0x37')]['length']?_0x2f6655[_0xa4da('0x37')]:_0x22309d[_0xa4da('0x33')];if(_0xc2a3f8[_0xa4da('0x34')][_0xa4da('0x3f')]){_0x2f6655[_0xa4da('0x40')]=[{'all':!![]}];}_0x2f6655=_[_0xa4da('0x3d')]({},_0x2f6655,_0xc2a3f8['options']);return db[_0xa4da('0x31')][_0xa4da('0x47')](_0x2f6655)[_0xa4da('0x2b')](handleEntityNotFound(_0xeb8a76,null))[_0xa4da('0x2b')](respondWithResult(_0xeb8a76,null))[_0xa4da('0x42')](handleError(_0xeb8a76,null));};exports[_0xa4da('0x48')]=function(_0x1d3004,_0x2c0948){return db[_0xa4da('0x31')][_0xa4da('0x48')](_0x1d3004[_0xa4da('0x49')],{})[_0xa4da('0x2b')](respondWithResult(_0x2c0948,0xc9))[_0xa4da('0x42')](handleError(_0x2c0948,null));};exports[_0xa4da('0x4a')]=function(_0x53abdf,_0x442ff2){if(_0x53abdf[_0xa4da('0x49')]['id']){delete _0x53abdf[_0xa4da('0x49')]['id'];}return db[_0xa4da('0x31')][_0xa4da('0x47')]({'where':{'id':_0x53abdf[_0xa4da('0x44')]['id']}})[_0xa4da('0x2b')](handleEntityNotFound(_0x442ff2,null))[_0xa4da('0x2b')](saveUpdates(_0x53abdf[_0xa4da('0x49')],null))[_0xa4da('0x2b')](respondWithResult(_0x442ff2,null))[_0xa4da('0x42')](handleError(_0x442ff2,null));};exports[_0xa4da('0x2a')]=function(_0x57f808,_0x40872b){return db[_0xa4da('0x31')][_0xa4da('0x47')]({'where':{'id':_0x57f808[_0xa4da('0x44')]['id']}})[_0xa4da('0x2b')](handleEntityNotFound(_0x40872b,null))[_0xa4da('0x2b')](removeEntity(_0x40872b,null))[_0xa4da('0x42')](handleError(_0x40872b,null));};exports[_0xa4da('0x4b')]=function(_0x205b3a,_0x5d9d35){return db[_0xa4da('0x31')][_0xa4da('0x4b')]()[_0xa4da('0x2b')](respondWithResult(_0x5d9d35,null))['catch'](handleError(_0x5d9d35,null));};function wrapUser(_0x1a3fb1){return function(_0x34a118){var _0x31468c=_0x1a3fb1[_0xa4da('0x4c')]({'plain':!![]});_0x31468c[_0xa4da('0x4d')]=[];if(_0x34a118){_0x31468c[_0xa4da('0x4e')]=_0x34a118[_0xa4da('0x4f')];_0x31468c['lastMessage']=_0x34a118;}else{_0x31468c[_0xa4da('0x4e')]=moment(0x0)[_0xa4da('0x50')](_0xa4da('0x51'));_0x31468c[_0xa4da('0x52')]={};}return _0x31468c;};}exports[_0xa4da('0x53')]=function(_0x544a3d,_0x184899,_0x2257d0){var _0x4ea71b=[];return db['User'][_0xa4da('0x41')]({'where':{'role':[_0xa4da('0x54'),_0xa4da('0x55'),_0xa4da('0x56')]},'attributes':['id',_0xa4da('0x57'),'name',_0xa4da('0x58'),_0xa4da('0x59'),_0xa4da('0x5a'),_0xa4da('0x5b'),'lastLoginAt','allowmessenger',_0xa4da('0x5c')],'order':qs['sort']('-online'),'include':[{'model':db[_0xa4da('0x5d')],'as':_0xa4da('0x5e'),'attributes':['id',_0xa4da('0x2e'),'type'],'through':{'attributes':[]}}]})[_0xa4da('0x2b')](function(_0x269be1){if(_0x269be1){var _0x46fdfc=_0x544a3d[_0xa4da('0x56')][_0xa4da('0x4c')]({'plain':!![]});if(!_0x46fdfc)throw new Error(_0xa4da('0x5f'));if(_0x46fdfc[_0xa4da('0x58')]===_0xa4da('0x56')){return db['UserProfileSection']['find']({'where':{'name':_0xa4da('0x60'),'userProfileId':_0x46fdfc['userProfileId']},'raw':!![]})[_0xa4da('0x2b')](function(_0x2286e2){if(_0x2286e2){if(_0x2286e2[_0xa4da('0x61')]===0x0){return db[_0xa4da('0x62')][_0xa4da('0x41')]({'where':{'sectionId':_0x2286e2['id']},'raw':!![]})[_0xa4da('0x2b')](function(_0x355988){var _0x359bc9=[];if(_[_0xa4da('0x63')](_0x355988)){_0x359bc9=_[_0xa4da('0x3c')](_0x269be1,function(_0x45e849){if(_0x45e849[_0xa4da('0x58')]!==_0xa4da('0x54')){return _0x45e849;}});return _0x359bc9;}else{for(var _0x4c9bda=0x0;_0x4c9bda<_0x269be1[_0xa4da('0x38')];_0x4c9bda++){var _0x44d413=_0x269be1[_0x4c9bda];if(_0x44d413[_0xa4da('0x58')]===_0xa4da('0x54')){var _0x11fe02=_[_0xa4da('0x47')](_0x355988,function(_0x42bf8d){return _0x42bf8d[_0xa4da('0x64')]===_0x44d413['id'];});if(_0x11fe02)_0x359bc9[_0xa4da('0x65')](_0x44d413);}else{_0x359bc9['push'](_0x44d413);}}return _0x359bc9;}});}else{return _0x269be1;}}else{var _0x438207=_['filter'](_0x269be1,function(_0x48d086){if(_0x48d086['role']!==_0xa4da('0x54')){return _0x48d086;}});return _0x438207;}});}else{return _0x269be1;}}})[_0xa4da('0x2b')](function(_0x109c81){var _0x5e1f41=[];if(_0x109c81){_0x4ea71b=_0x109c81;for(var _0x22df10=0x0;_0x22df10<_0x109c81['length'];_0x22df10+=0x1){_0x4ea71b[_0x22df10]['messages']=[];_0x5e1f41[_0xa4da('0x65')](db[_0xa4da('0x31')]['find']({'where':{'FromId':[_0x544a3d[_0xa4da('0x56')]['id'],_0x109c81[_0x22df10]['id']],'ToId':[_0x544a3d[_0xa4da('0x56')]['id'],_0x109c81[_0x22df10]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xa4da('0x66'),_0xa4da('0x67'),_0xa4da('0x68'),_0xa4da('0x49')],'order':qs['sort'](_0xa4da('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x109c81[_0x22df10])));}return BPromise['all'](_0x5e1f41);}return[];})['then'](function(_0x1add3e){return{'rows':_0x1add3e,'count':_0x1add3e[_0xa4da('0x38')]};})['then'](respondWithResult(_0x184899,null))[_0xa4da('0x42')](handleError(_0x184899,null));}; \ No newline at end of file +var _0x7f03=['getUsers','User','findAll','admin','user','fullname','userpic','internal','allowmessenger','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','resourceId','push','agent','FromId','ToId','read','-createdAt','all','zip-dir','request-promise','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','include','rows','show','params','includeAll','find','catch','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x7f03,0x86));var _0x37f0=function(_0x9eb6f2,_0x568341){_0x9eb6f2=_0x9eb6f2-0x0;var _0x3a2333=_0x7f03[_0x9eb6f2];return _0x3a2333;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x37f0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37f0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x37f0('0x2'));var csv=require(_0x37f0('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37f0('0x4'));var _=require(_0x37f0('0x5'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x37f0('0x6'));var deskjs=require(_0x37f0('0x7'));var toCsv=require(_0x37f0('0x3'));var querystring=require('querystring');var Papa=require(_0x37f0('0x8'));var Redis=require('ioredis');var authService=require(_0x37f0('0x9'));var qs=require(_0x37f0('0xa'));var as=require(_0x37f0('0xb'));var hardwareService=require(_0x37f0('0xc'));var logger=require(_0x37f0('0xd'))('api');var utils=require(_0x37f0('0xe'));var config=require(_0x37f0('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x37f0('0x10'))['db'];config[_0x37f0('0x11')]=_[_0x37f0('0x12')](config[_0x37f0('0x11')],{'host':_0x37f0('0x13'),'port':0x18eb});var socket=require(_0x37f0('0x14'))(new Redis(config['redis']));require(_0x37f0('0x15'))['register'](socket);function respondWithStatusCode(_0x192f16,_0x47ee71){_0x47ee71=_0x47ee71||0xcc;return function(_0xd8cc8b){if(_0xd8cc8b){return _0x192f16[_0x37f0('0x16')](_0x47ee71);}return _0x192f16[_0x37f0('0x17')](_0x47ee71)['end']();};}function respondWithResult(_0x32b4e5,_0xaeee12){_0xaeee12=_0xaeee12||0xc8;return function(_0x59039a){if(_0x59039a){return _0x32b4e5['status'](_0xaeee12)[_0x37f0('0x18')](_0x59039a);}};}function respondWithFilteredResult(_0x2c9425,_0xb47e70){return function(_0x5528de){if(_0x5528de){var _0x58e7f3=typeof _0xb47e70[_0x37f0('0x19')]===_0x37f0('0x1a')&&typeof _0xb47e70[_0x37f0('0x1b')]===_0x37f0('0x1a');var _0x44b465=_0x5528de['count'];var _0x20527c=_0x58e7f3?0x0:_0xb47e70[_0x37f0('0x19')];var _0x56150c=_0x58e7f3?_0x5528de['count']:_0xb47e70[_0x37f0('0x19')]+_0xb47e70[_0x37f0('0x1b')];var _0x5656a6;if(_0x56150c>=_0x44b465){_0x56150c=_0x44b465;_0x5656a6=0xc8;}else{_0x5656a6=0xce;}_0x2c9425[_0x37f0('0x17')](_0x5656a6);return _0x2c9425[_0x37f0('0x1c')]('Content-Range',_0x20527c+'-'+_0x56150c+'/'+_0x44b465)['json'](_0x5528de);}return null;};}function patchUpdates(_0x3a50e0){return function(_0x4cf4f4){try{jsonpatch[_0x37f0('0x1d')](_0x4cf4f4,_0x3a50e0,!![]);}catch(_0x1911ef){return BPromise[_0x37f0('0x1e')](_0x1911ef);}return _0x4cf4f4[_0x37f0('0x1f')]();};}function saveUpdates(_0xd2f2e8,_0x542183){return function(_0x28a582){if(_0x28a582){return _0x28a582[_0x37f0('0x20')](_0xd2f2e8)[_0x37f0('0x21')](function(_0x23f789){return _0x23f789;});}return null;};}function removeEntity(_0x4c7c45,_0x6e8973){return function(_0x46225d){if(_0x46225d){return _0x46225d[_0x37f0('0x22')]()['then'](function(){_0x4c7c45['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5407f5,_0x826126){return function(_0x383879){if(!_0x383879){_0x5407f5[_0x37f0('0x16')](0x194);}return _0x383879;};}function handleError(_0x1c40d8,_0x2737a9){_0x2737a9=_0x2737a9||0x1f4;return function(_0x2abad2){logger[_0x37f0('0x23')](_0x2abad2['stack']);if(_0x2abad2['name']){delete _0x2abad2[_0x37f0('0x24')];}_0x1c40d8[_0x37f0('0x17')](_0x2737a9)[_0x37f0('0x25')](_0x2abad2);};}exports['index']=function(_0x283697,_0x2bcfd0){var _0x4028c0={},_0x291fc2={},_0x489bc2={'count':0x0,'rows':[]};var _0x5199d9=_[_0x37f0('0x26')](db[_0x37f0('0x27')][_0x37f0('0x28')],function(_0x510a78){return{'name':_0x510a78[_0x37f0('0x29')],'type':_0x510a78[_0x37f0('0x2a')][_0x37f0('0x2b')]};});_0x291fc2['model']=_[_0x37f0('0x26')](_0x5199d9,_0x37f0('0x24'));_0x291fc2[_0x37f0('0x2c')]=_[_0x37f0('0x2d')](_0x283697[_0x37f0('0x2c')]);_0x291fc2['filters']=_[_0x37f0('0x2e')](_0x291fc2[_0x37f0('0x2f')],_0x291fc2[_0x37f0('0x2c')]);_0x4028c0[_0x37f0('0x30')]=_[_0x37f0('0x2e')](_0x291fc2[_0x37f0('0x2f')],qs[_0x37f0('0x31')](_0x283697[_0x37f0('0x2c')][_0x37f0('0x31')]));_0x4028c0[_0x37f0('0x30')]=_0x4028c0[_0x37f0('0x30')]['length']?_0x4028c0[_0x37f0('0x30')]:_0x291fc2[_0x37f0('0x2f')];if(!_0x283697[_0x37f0('0x2c')][_0x37f0('0x32')](_0x37f0('0x33'))){_0x4028c0['limit']=qs[_0x37f0('0x1b')](_0x283697[_0x37f0('0x2c')][_0x37f0('0x1b')]);_0x4028c0[_0x37f0('0x19')]=qs[_0x37f0('0x19')](_0x283697[_0x37f0('0x2c')][_0x37f0('0x19')]);}_0x4028c0[_0x37f0('0x34')]=qs[_0x37f0('0x35')](_0x283697[_0x37f0('0x2c')][_0x37f0('0x35')]);_0x4028c0[_0x37f0('0x36')]=qs[_0x37f0('0x37')](_[_0x37f0('0x38')](_0x283697[_0x37f0('0x2c')],_0x291fc2[_0x37f0('0x37')]),_0x5199d9);if(_0x283697[_0x37f0('0x2c')][_0x37f0('0x39')]){_0x4028c0[_0x37f0('0x36')]=_[_0x37f0('0x3a')](_0x4028c0['where'],{'$or':_[_0x37f0('0x26')](_0x5199d9,function(_0x5ed794){if(_0x5ed794['type']!=='VIRTUAL'){var _0x490323={};_0x490323[_0x5ed794['name']]={'$like':'%'+_0x283697['query'][_0x37f0('0x39')]+'%'};return _0x490323;}})});}_0x4028c0=_[_0x37f0('0x3a')]({},_0x4028c0,_0x283697[_0x37f0('0x3b')]);var _0x565572={'where':_0x4028c0[_0x37f0('0x36')]};return db['ChatInternalMessage'][_0x37f0('0x3c')](_0x565572)[_0x37f0('0x21')](function(_0x44207c){_0x489bc2['count']=_0x44207c;if(_0x283697[_0x37f0('0x2c')]['includeAll']){_0x4028c0[_0x37f0('0x3d')]=[{'all':!![]}];}return db[_0x37f0('0x27')]['findAll'](_0x4028c0);})[_0x37f0('0x21')](function(_0x1ef39e){_0x489bc2[_0x37f0('0x3e')]=_0x1ef39e;return _0x489bc2;})['then'](respondWithFilteredResult(_0x2bcfd0,_0x4028c0))['catch'](handleError(_0x2bcfd0,null));};exports[_0x37f0('0x3f')]=function(_0xfd98d3,_0xeb6c84){var _0x24c199={'raw':!![],'where':{'id':_0xfd98d3[_0x37f0('0x40')]['id']}},_0x4c1dc8={};_0x4c1dc8['model']=_[_0x37f0('0x2d')](db[_0x37f0('0x27')][_0x37f0('0x28')]);_0x4c1dc8[_0x37f0('0x2c')]=_[_0x37f0('0x2d')](_0xfd98d3[_0x37f0('0x2c')]);_0x4c1dc8[_0x37f0('0x37')]=_[_0x37f0('0x2e')](_0x4c1dc8[_0x37f0('0x2f')],_0x4c1dc8[_0x37f0('0x2c')]);_0x24c199[_0x37f0('0x30')]=_['intersection'](_0x4c1dc8[_0x37f0('0x2f')],qs[_0x37f0('0x31')](_0xfd98d3[_0x37f0('0x2c')]['fields']));_0x24c199[_0x37f0('0x30')]=_0x24c199[_0x37f0('0x30')]['length']?_0x24c199['attributes']:_0x4c1dc8[_0x37f0('0x2f')];if(_0xfd98d3[_0x37f0('0x2c')][_0x37f0('0x41')]){_0x24c199[_0x37f0('0x3d')]=[{'all':!![]}];}_0x24c199=_['merge']({},_0x24c199,_0xfd98d3[_0x37f0('0x3b')]);return db['ChatInternalMessage'][_0x37f0('0x42')](_0x24c199)[_0x37f0('0x21')](handleEntityNotFound(_0xeb6c84,null))[_0x37f0('0x21')](respondWithResult(_0xeb6c84,null))[_0x37f0('0x43')](handleError(_0xeb6c84,null));};exports[_0x37f0('0x44')]=function(_0x43d8b1,_0x16e390){return db['ChatInternalMessage']['create'](_0x43d8b1[_0x37f0('0x45')],{})['then'](respondWithResult(_0x16e390,0xc9))['catch'](handleError(_0x16e390,null));};exports[_0x37f0('0x20')]=function(_0x3e3ef3,_0x8cdaae){if(_0x3e3ef3['body']['id']){delete _0x3e3ef3[_0x37f0('0x45')]['id'];}return db[_0x37f0('0x27')]['find']({'where':{'id':_0x3e3ef3['params']['id']}})[_0x37f0('0x21')](handleEntityNotFound(_0x8cdaae,null))['then'](saveUpdates(_0x3e3ef3[_0x37f0('0x45')],null))[_0x37f0('0x21')](respondWithResult(_0x8cdaae,null))['catch'](handleError(_0x8cdaae,null));};exports[_0x37f0('0x22')]=function(_0x12f138,_0x14de73){return db[_0x37f0('0x27')][_0x37f0('0x42')]({'where':{'id':_0x12f138[_0x37f0('0x40')]['id']}})['then'](handleEntityNotFound(_0x14de73,null))['then'](removeEntity(_0x14de73,null))[_0x37f0('0x43')](handleError(_0x14de73,null));};exports[_0x37f0('0x46')]=function(_0x1c3c66,_0x5f11ca){return db[_0x37f0('0x27')]['describe']()[_0x37f0('0x21')](respondWithResult(_0x5f11ca,null))[_0x37f0('0x43')](handleError(_0x5f11ca,null));};function wrapUser(_0x7a9466){return function(_0x32a1d8){var _0x1642dd=_0x7a9466[_0x37f0('0x47')]({'plain':!![]});_0x1642dd[_0x37f0('0x48')]=[];if(_0x32a1d8){_0x1642dd[_0x37f0('0x49')]=_0x32a1d8[_0x37f0('0x4a')];_0x1642dd[_0x37f0('0x4b')]=_0x32a1d8;}else{_0x1642dd[_0x37f0('0x49')]=moment(0x0)[_0x37f0('0x4c')](_0x37f0('0x4d'));_0x1642dd[_0x37f0('0x4b')]={};}return _0x1642dd;};}exports[_0x37f0('0x4e')]=function(_0x47fbc5,_0x127fd8,_0x2a14c3){var _0x10de80=[];return db[_0x37f0('0x4f')][_0x37f0('0x50')]({'where':{'role':['agent',_0x37f0('0x51'),_0x37f0('0x52')]},'attributes':['id',_0x37f0('0x53'),_0x37f0('0x24'),'role',_0x37f0('0x54'),_0x37f0('0x55'),'online','lastLoginAt',_0x37f0('0x56'),'showWebBar'],'order':qs[_0x37f0('0x35')](_0x37f0('0x57')),'include':[{'model':db[_0x37f0('0x58')],'as':_0x37f0('0x59'),'attributes':['id',_0x37f0('0x24'),_0x37f0('0x2a')],'through':{'attributes':[]}}]})['then'](function(_0xb68cd5){if(_0xb68cd5){var _0x462cc5=_0x47fbc5[_0x37f0('0x52')][_0x37f0('0x47')]({'plain':!![]});if(!_0x462cc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x462cc5[_0x37f0('0x5a')]===_0x37f0('0x52')){return db[_0x37f0('0x5b')][_0x37f0('0x42')]({'where':{'name':_0x37f0('0x5c'),'userProfileId':_0x462cc5[_0x37f0('0x5d')]},'raw':!![]})[_0x37f0('0x21')](function(_0xf3a0b7){if(_0xf3a0b7){if(_0xf3a0b7[_0x37f0('0x5e')]===0x0){return db[_0x37f0('0x5f')][_0x37f0('0x50')]({'where':{'sectionId':_0xf3a0b7['id']},'raw':!![]})['then'](function(_0x54e3eb){var _0x4fc8da=[];if(_[_0x37f0('0x60')](_0x54e3eb)){_0x4fc8da=_['filter'](_0xb68cd5,function(_0x37949f){if(_0x37949f[_0x37f0('0x5a')]!=='agent'){return _0x37949f;}});return _0x4fc8da;}else{for(var _0x3b3752=0x0;_0x3b3752<_0xb68cd5[_0x37f0('0x61')];_0x3b3752++){var _0x2e2014=_0xb68cd5[_0x3b3752];if(_0x2e2014[_0x37f0('0x5a')]==='agent'){var _0x174421=_[_0x37f0('0x42')](_0x54e3eb,function(_0x3aebcc){return _0x3aebcc[_0x37f0('0x62')]===_0x2e2014['id'];});if(_0x174421)_0x4fc8da[_0x37f0('0x63')](_0x2e2014);}else{_0x4fc8da[_0x37f0('0x63')](_0x2e2014);}}return _0x4fc8da;}});}else{return _0xb68cd5;}}else{var _0x29ad16=_['filter'](_0xb68cd5,function(_0x3a7359){if(_0x3a7359[_0x37f0('0x5a')]!==_0x37f0('0x64')){return _0x3a7359;}});return _0x29ad16;}});}else{return _0xb68cd5;}}})[_0x37f0('0x21')](function(_0x51ace8){var _0x17b7ba=[];if(_0x51ace8){_0x10de80=_0x51ace8;for(var _0x5bb192=0x0;_0x5bb192<_0x51ace8[_0x37f0('0x61')];_0x5bb192+=0x1){_0x10de80[_0x5bb192]['messages']=[];_0x17b7ba[_0x37f0('0x63')](db[_0x37f0('0x27')][_0x37f0('0x42')]({'where':{'FromId':[_0x47fbc5['user']['id'],_0x51ace8[_0x5bb192]['id']],'ToId':[_0x47fbc5[_0x37f0('0x52')]['id'],_0x51ace8[_0x5bb192]['id']],'ChatGroupId':null},'attributes':['id',_0x37f0('0x4a'),_0x37f0('0x65'),_0x37f0('0x66'),_0x37f0('0x67'),'body'],'order':qs['sort'](_0x37f0('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x51ace8[_0x5bb192])));}return BPromise[_0x37f0('0x69')](_0x17b7ba);}return[];})[_0x37f0('0x21')](function(_0x13cb0e){return{'rows':_0x13cb0e,'count':_0x13cb0e[_0x37f0('0x61')]};})['then'](respondWithResult(_0x127fd8,null))[_0x37f0('0x43')](handleError(_0x127fd8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 471bff6..a15b462 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 _0xe5f0=['exports','events','../../mysqldb','ChatInternalMessage','save','update','emit','hasOwnProperty'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xe5f0,0x69));var _0x0e5f=function(_0x1ecc8a,_0x2753e7){_0x1ecc8a=_0x1ecc8a-0x0;var _0x5bb893=_0xe5f0[_0x1ecc8a];return _0x5bb893;};'use strict';var EventEmitter=require(_0x0e5f('0x0'));var ChatInternalMessage=require(_0x0e5f('0x1'))['db'][_0x0e5f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e5f('0x3'),'afterUpdate':_0x0e5f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x141176){return function(_0x41a4e8,_0x3ab87b,_0xbf2587){ChatInternalMessageEvents[_0x0e5f('0x5')](_0x141176+':'+_0x41a4e8['id'],_0x41a4e8);ChatInternalMessageEvents[_0x0e5f('0x5')](_0x141176,_0x41a4e8);_0xbf2587(null);};}for(var e in events){if(events[_0x0e5f('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x0e5f('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3391=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x3391,0x13f));var _0x1339=function(_0x82bd68,_0x54da1b){_0x82bd68=_0x82bd68-0x0;var _0x304b30=_0x3391[_0x82bd68];return _0x304b30;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x1339('0x0'))['db'][_0x1339('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1339('0x2')](0x0);var events={'afterCreate':_0x1339('0x3'),'afterUpdate':_0x1339('0x4'),'afterDestroy':_0x1339('0x5')};function emitEvent(_0x3ef186){return function(_0x525964,_0x1f0b94,_0x3b7b0a){ChatInternalMessageEvents['emit'](_0x3ef186+':'+_0x525964['id'],_0x525964);ChatInternalMessageEvents[_0x1339('0x6')](_0x3ef186,_0x525964);_0x3b7b0a(null);};}for(var e in events){if(events[_0x1339('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c790b15..f5e080f 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 _0x58d3=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./chatInternalMessage.attributes','exports'];(function(_0x56e3f2,_0x4c3db1){var _0x1a0106=function(_0x1e3960){while(--_0x1e3960){_0x56e3f2['push'](_0x56e3f2['shift']());}};_0x1a0106(++_0x4c3db1);}(_0x58d3,0x92));var _0x358d=function(_0x1fa4ae,_0xb27861){_0x1fa4ae=_0x1fa4ae-0x0;var _0x40e58a=_0x58d3[_0x1fa4ae];return _0x40e58a;};'use strict';var _=require(_0x358d('0x0'));var util=require(_0x358d('0x1'));var logger=require('../../config/logger')(_0x358d('0x2'));var moment=require(_0x358d('0x3'));var BPromise=require(_0x358d('0x4'));var rp=require(_0x358d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x358d('0x6'));module[_0x358d('0x7')]=function(_0x5aaa6b,_0x17bf79){return _0x5aaa6b['define']('ChatInternalMessage',attributes,{'tableName':_0x358d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x358d('0x9'),'collate':_0x358d('0xa')});}; \ No newline at end of file +var _0xef44=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0xef44,0x197));var _0x4ef4=function(_0x599a30,_0x58e137){_0x599a30=_0x599a30-0x0;var _0x252d04=_0xef44[_0x599a30];return _0x252d04;};'use strict';var _=require('lodash');var util=require(_0x4ef4('0x0'));var logger=require(_0x4ef4('0x1'))(_0x4ef4('0x2'));var moment=require(_0x4ef4('0x3'));var BPromise=require(_0x4ef4('0x4'));var rp=require(_0x4ef4('0x5'));var fs=require('fs');var path=require(_0x4ef4('0x6'));var rimraf=require(_0x4ef4('0x7'));var config=require(_0x4ef4('0x8'));var attributes=require(_0x4ef4('0x9'));module[_0x4ef4('0xa')]=function(_0xe6248f,_0x5df28c){return _0xe6248f[_0x4ef4('0xb')](_0x4ef4('0xc'),attributes,{'tableName':_0x4ef4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ef4('0xe'),'collate':_0x4ef4('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b4ea088..bc0cbb7 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 _0xc30d=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x397984,_0x5cbddf){var _0x54daaa=function(_0x44fd81){while(--_0x44fd81){_0x397984['push'](_0x397984['shift']());}};_0x54daaa(++_0x5cbddf);}(_0xc30d,0x6e));var _0xdc30=function(_0x2ecd91,_0x1f21e8){_0x2ecd91=_0x2ecd91-0x0;var _0x3bf737=_0xc30d[_0x2ecd91];return _0x3bf737;};'use strict';var _=require(_0xdc30('0x0'));var util=require('util');var moment=require(_0xdc30('0x1'));var BPromise=require(_0xdc30('0x2'));var rs=require(_0xdc30('0x3'));var fs=require('fs');var Redis=require(_0xdc30('0x4'));var db=require(_0xdc30('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc30('0x6'))('rpc');var config=require(_0xdc30('0x7'));var jayson=require(_0xdc30('0x8'));var client=jayson[_0xdc30('0x9')][_0xdc30('0xa')]({'port':0x232a});config[_0xdc30('0xb')]=_[_0xdc30('0xc')](config['redis'],{'host':_0xdc30('0xd'),'port':0x18eb});var socket=require(_0xdc30('0xe'))(new Redis(config[_0xdc30('0xb')]));require(_0xdc30('0xf'))[_0xdc30('0x10')](socket);function respondWithRpcPromise(_0x65f596,_0x38b6fc,_0x165fb2){return new BPromise(function(_0x2c4fe1,_0x593143){return client['request'](_0x65f596,_0x165fb2)['then'](function(_0x110f58){logger[_0xdc30('0x11')](_0xdc30('0x12'),_0x38b6fc,_0xdc30('0x13'));logger[_0xdc30('0x14')](_0xdc30('0x15'),_0x38b6fc,_0xdc30('0x13'),JSON['stringify'](_0x110f58));if(_0x110f58[_0xdc30('0x16')]){if(_0x110f58[_0xdc30('0x16')][_0xdc30('0x17')]===0x1f4){logger[_0xdc30('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x38b6fc,_0x110f58[_0xdc30('0x16')][_0xdc30('0x18')]);return _0x593143(_0x110f58[_0xdc30('0x16')]['message']);}logger[_0xdc30('0x16')](_0xdc30('0x12'),_0x38b6fc,_0x110f58[_0xdc30('0x16')][_0xdc30('0x18')]);return _0x2c4fe1(_0x110f58[_0xdc30('0x16')][_0xdc30('0x18')]);}else{logger[_0xdc30('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x38b6fc,_0xdc30('0x13'));_0x2c4fe1(_0x110f58[_0xdc30('0x19')]['message']);}})['catch'](function(_0x3d984e){logger[_0xdc30('0x16')](_0xdc30('0x12'),_0x38b6fc,_0x3d984e);_0x593143(_0x3d984e);});});} \ No newline at end of file +var _0x7fac=['localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2e6ccb,_0x31fe2c){var _0x3d5b50=function(_0x5b7df6){while(--_0x5b7df6){_0x2e6ccb['push'](_0x2e6ccb['shift']());}};_0x3d5b50(++_0x31fe2c);}(_0x7fac,0x137));var _0xc7fa=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x7fac[_0x1895b7];return _0x1aecdc;};'use strict';var _=require(_0xc7fa('0x0'));var util=require('util');var moment=require(_0xc7fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xc7fa('0x2'));var fs=require('fs');var Redis=require(_0xc7fa('0x3'));var db=require(_0xc7fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7fa('0x5'))(_0xc7fa('0x6'));var config=require(_0xc7fa('0x7'));var jayson=require(_0xc7fa('0x8'));var client=jayson[_0xc7fa('0x9')][_0xc7fa('0xa')]({'port':0x232a});config[_0xc7fa('0xb')]=_[_0xc7fa('0xc')](config[_0xc7fa('0xb')],{'host':_0xc7fa('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7fa('0xb')]));require(_0xc7fa('0xe'))[_0xc7fa('0xf')](socket);function respondWithRpcPromise(_0x30aa72,_0x58b60a,_0x40ad16){return new BPromise(function(_0x8c070c,_0x882892){return client[_0xc7fa('0x10')](_0x30aa72,_0x40ad16)[_0xc7fa('0x11')](function(_0x1e78a2){logger[_0xc7fa('0x12')](_0xc7fa('0x13'),_0x58b60a,_0xc7fa('0x14'));logger['debug'](_0xc7fa('0x15'),_0x58b60a,_0xc7fa('0x14'),JSON[_0xc7fa('0x16')](_0x1e78a2));if(_0x1e78a2[_0xc7fa('0x17')]){if(_0x1e78a2[_0xc7fa('0x17')][_0xc7fa('0x18')]===0x1f4){logger['error'](_0xc7fa('0x13'),_0x58b60a,_0x1e78a2[_0xc7fa('0x17')][_0xc7fa('0x19')]);return _0x882892(_0x1e78a2[_0xc7fa('0x17')][_0xc7fa('0x19')]);}logger[_0xc7fa('0x17')](_0xc7fa('0x13'),_0x58b60a,_0x1e78a2['error'][_0xc7fa('0x19')]);return _0x8c070c(_0x1e78a2['error'][_0xc7fa('0x19')]);}else{logger[_0xc7fa('0x12')](_0xc7fa('0x13'),_0x58b60a,_0xc7fa('0x14'));_0x8c070c(_0x1e78a2['result'][_0xc7fa('0x19')]);}})[_0xc7fa('0x1a')](function(_0x922fa2){logger['error'](_0xc7fa('0x13'),_0x58b60a,_0x922fa2);_0x882892(_0x922fa2);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e4185b0..73d874d 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 _0x8b61=['remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x8b61,0xed));var _0x18b6=function(_0x5f4ef9,_0x2a82c1){_0x5f4ef9=_0x5f4ef9-0x0;var _0x4728cc=_0x8b61[_0x5f4ef9];return _0x4728cc;};'use strict';var ChatInternalMessageEvents=require(_0x18b6('0x0'));var events=['save',_0x18b6('0x1'),'update'];function createListener(_0x36e0cb,_0x51fd91){return function(_0x2997cc){_0x51fd91[_0x18b6('0x2')](_0x36e0cb,_0x2997cc);};}function removeListener(_0x46e210,_0x58a971){return function(){ChatInternalMessageEvents[_0x18b6('0x3')](_0x46e210,_0x58a971);};}exports[_0x18b6('0x4')]=function(_0x26112b){for(var _0x13a20=0x0,_0x18588b=events[_0x18b6('0x5')];_0x13a20<_0x18588b;_0x13a20++){var _0x135abb=events[_0x13a20];var _0x241be7=createListener(_0x18b6('0x6')+_0x135abb,_0x26112b);ChatInternalMessageEvents['on'](_0x135abb,_0x241be7);}}; \ No newline at end of file +var _0x3654=['update','emit','removeListener','register','length','./chatInternalMessage.events','save'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3654,0x1ef));var _0x4365=function(_0x5189b5,_0x129c83){_0x5189b5=_0x5189b5-0x0;var _0x29203f=_0x3654[_0x5189b5];return _0x29203f;};'use strict';var ChatInternalMessageEvents=require(_0x4365('0x0'));var events=[_0x4365('0x1'),'remove',_0x4365('0x2')];function createListener(_0x4cfbc3,_0x1b7f94){return function(_0xb4b797){_0x1b7f94[_0x4365('0x3')](_0x4cfbc3,_0xb4b797);};}function removeListener(_0x50e7a2,_0x3e7581){return function(){ChatInternalMessageEvents[_0x4365('0x4')](_0x50e7a2,_0x3e7581);};}exports[_0x4365('0x5')]=function(_0x25f53e){for(var _0x5339fc=0x0,_0x33458c=events[_0x4365('0x6')];_0x5339fc<_0x33458c;_0x5339fc++){var _0x3ee0d4=events[_0x5339fc];var _0x4e9993=createListener('chatInternalMessage:'+_0x3ee0d4,_0x25f53e);ChatInternalMessageEvents['on'](_0x3ee0d4,_0x4e9993);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 9d5d685..85d86ff 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 _0xf4ab=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','describe','/users','getUsers','isAuthenticated','post','put','/:id'];(function(_0x102adc,_0xe36885){var _0x4198cd=function(_0x4f7021){while(--_0x4f7021){_0x102adc['push'](_0x102adc['shift']());}};_0x4198cd(++_0xe36885);}(_0xf4ab,0x1b7));var _0xbf4a=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xf4ab[_0x245afe];return _0x4eefde;};'use strict';var multer=require(_0xbf4a('0x0'));var util=require(_0xbf4a('0x1'));var path=require(_0xbf4a('0x2'));var timeout=require(_0xbf4a('0x3'));var express=require(_0xbf4a('0x4'));var router=express[_0xbf4a('0x5')]();var fs_extra=require(_0xbf4a('0x6'));var auth=require(_0xbf4a('0x7'));var interaction=require(_0xbf4a('0x8'));var config=require(_0xbf4a('0x9'));var controller=require(_0xbf4a('0xa'));router[_0xbf4a('0xb')]('/',auth['isAuthenticated'](),controller[_0xbf4a('0xc')]);router[_0xbf4a('0xb')](_0xbf4a('0xd'),auth['isAuthenticated'](),controller[_0xbf4a('0xe')]);router[_0xbf4a('0xb')](_0xbf4a('0xf'),auth['isAuthenticated'](),controller[_0xbf4a('0x10')]);router[_0xbf4a('0xb')]('/:id',auth[_0xbf4a('0x11')](),controller['show']);router[_0xbf4a('0x12')]('/',auth[_0xbf4a('0x11')](),controller['create']);router[_0xbf4a('0x13')]('/:id',controller['update']);router['delete'](_0xbf4a('0x14'),auth[_0xbf4a('0x11')](),controller[_0xbf4a('0x15')]);module[_0xbf4a('0x16')]=router; \ No newline at end of file +var _0xa263=['/describe','getUsers','/:id','create','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x57e176,_0x147601){var _0x28497a=function(_0x38255c){while(--_0x38255c){_0x57e176['push'](_0x57e176['shift']());}};_0x28497a(++_0x147601);}(_0xa263,0x103));var _0x3a26=function(_0x23f4fe,_0x32c2fb){_0x23f4fe=_0x23f4fe-0x0;var _0x272114=_0xa263[_0x23f4fe];return _0x272114;};'use strict';var multer=require(_0x3a26('0x0'));var util=require('util');var path=require(_0x3a26('0x1'));var timeout=require(_0x3a26('0x2'));var express=require(_0x3a26('0x3'));var router=express['Router']();var fs_extra=require(_0x3a26('0x4'));var auth=require(_0x3a26('0x5'));var interaction=require(_0x3a26('0x6'));var config=require(_0x3a26('0x7'));var controller=require(_0x3a26('0x8'));router[_0x3a26('0x9')]('/',auth[_0x3a26('0xa')](),controller['index']);router[_0x3a26('0x9')](_0x3a26('0xb'),auth[_0x3a26('0xa')](),controller['describe']);router[_0x3a26('0x9')]('/users',auth[_0x3a26('0xa')](),controller[_0x3a26('0xc')]);router[_0x3a26('0x9')](_0x3a26('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3a26('0xe')]);router[_0x3a26('0xf')]('/:id',controller['update']);router[_0x3a26('0x10')](_0x3a26('0xd'),auth[_0x3a26('0xa')](),controller[_0x3a26('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 13a4b93..286d8b8 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 _0x585e=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5cf272,_0x5ef6b4){var _0x479246=function(_0x1fb87c){while(--_0x1fb87c){_0x5cf272['push'](_0x5cf272['shift']());}};_0x479246(++_0x5ef6b4);}(_0x585e,0x1c2));var _0xe585=function(_0x1b4c7b,_0x141bbf){_0x1b4c7b=_0x1b4c7b-0x0;var _0x45f19b=_0x585e[_0x1b4c7b];return _0x45f19b;};'use strict';var Sequelize=require(_0xe585('0x0'));module[_0xe585('0x1')]={'body':{'type':Sequelize[_0xe585('0x2')](_0xe585('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe585('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe585('0x5')),'defaultValue':_0xe585('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xe585('0x6')]},'providerResponse':{'type':Sequelize[_0xe585('0x2')]}}; \ No newline at end of file +var _0xe820=['sequelize','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x503d93,_0x4bfc88){var _0x5c1387=function(_0x2cc00a){while(--_0x2cc00a){_0x503d93['push'](_0x503d93['shift']());}};_0x5c1387(++_0x4bfc88);}(_0xe820,0xd2));var _0x0e82=function(_0x41d83a,_0x13f95f){_0x41d83a=_0x41d83a-0x0;var _0x316ea5=_0xe820[_0x41d83a];return _0x316ea5;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'body':{'type':Sequelize[_0x0e82('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e82('0x3')]('in',_0x0e82('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0e82('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0e82('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 0ba0c0d..f65f189 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 _0xd0c4=['status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','show','include','find','body','params','describe','chat-interactions','accept','chat','read','readAt','format','UserId','user','agent','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','parse','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','SIP/%s','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus'];(function(_0x255d9f,_0x558dbf){var _0x435eb4=function(_0x3ca94d){while(--_0x3ca94d){_0x255d9f['push'](_0x255d9f['shift']());}};_0x435eb4(++_0x558dbf);}(_0xd0c4,0xd9));var _0x4d0c=function(_0x149bc3,_0x4b09d8){_0x149bc3=_0x149bc3-0x0;var _0x5d33eb=_0xd0c4[_0x149bc3];return _0x5d33eb;};'use strict';var emlformat=require(_0x4d0c('0x0'));var rimraf=require(_0x4d0c('0x1'));var zipdir=require(_0x4d0c('0x2'));var jsonpatch=require(_0x4d0c('0x3'));var rp=require(_0x4d0c('0x4'));var moment=require(_0x4d0c('0x5'));var BPromise=require(_0x4d0c('0x6'));var Mustache=require('mustache');var util=require(_0x4d0c('0x7'));var path=require(_0x4d0c('0x8'));var sox=require(_0x4d0c('0x9'));var csv=require(_0x4d0c('0xa'));var ejs=require(_0x4d0c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d0c('0xc'));var crypto=require(_0x4d0c('0xd'));var jsforce=require(_0x4d0c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d0c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4d0c('0xf'));var as=require(_0x4d0c('0x10'));var hardwareService=require(_0x4d0c('0x11'));var logger=require(_0x4d0c('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4d0c('0x13'));var licenseUtil=require(_0x4d0c('0x14'));var db=require(_0x4d0c('0x15'))['db'];config[_0x4d0c('0x16')]=_[_0x4d0c('0x17')](config[_0x4d0c('0x16')],{'host':_0x4d0c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4d0c('0x19'))[_0x4d0c('0x1a')](socket);var jayson=require(_0x4d0c('0x1b'));var client=jayson[_0x4d0c('0x1c')][_0x4d0c('0x1d')]({'port':0x232c});var client9002=jayson[_0x4d0c('0x1c')][_0x4d0c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x368d82,_0x2c656c,_0x9c952,_0x4b8eb3){return new BPromise(function(_0x1a3506,_0x27df0b){var _0x3faf01=_0x4b8eb3||client;return _0x3faf01[_0x4d0c('0x1e')](_0x368d82,_0x9c952)[_0x4d0c('0x1f')](function(_0x5aba47){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2c656c,_0x4d0c('0x20'));logger[_0x4d0c('0x21')](_0x4d0c('0x22'),_0x2c656c,_0x4d0c('0x20'),JSON[_0x4d0c('0x23')](_0x5aba47));if(_0x5aba47[_0x4d0c('0x24')]){if(_0x5aba47['error']['code']===0x1f4){logger[_0x4d0c('0x24')](_0x4d0c('0x25'),_0x2c656c,_0x5aba47[_0x4d0c('0x24')][_0x4d0c('0x26')]);return _0x27df0b(_0x5aba47['error'][_0x4d0c('0x26')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x2c656c,_0x5aba47['error'][_0x4d0c('0x26')]);return _0x1a3506(_0x5aba47[_0x4d0c('0x24')][_0x4d0c('0x26')]);}else{logger[_0x4d0c('0x27')](_0x4d0c('0x25'),_0x2c656c,_0x4d0c('0x20'));_0x1a3506(_0x5aba47[_0x4d0c('0x28')][_0x4d0c('0x26')]);}})[_0x4d0c('0x29')](function(_0x1f7f35){logger['error'](_0x4d0c('0x25'),_0x2c656c,_0x1f7f35);_0x27df0b(_0x1f7f35);});});}function respondWithStatusCode(_0x1e76c9,_0x478d66){_0x478d66=_0x478d66||0xcc;return function(_0x38f86b){if(_0x38f86b){return _0x1e76c9[_0x4d0c('0x2a')](_0x478d66);}return _0x1e76c9[_0x4d0c('0x2b')](_0x478d66)[_0x4d0c('0x2c')]();};}function respondWithResult(_0x35b1ea,_0x7407f2){_0x7407f2=_0x7407f2||0xc8;return function(_0x53dd14){if(_0x53dd14){return _0x35b1ea[_0x4d0c('0x2b')](_0x7407f2)[_0x4d0c('0x2d')](_0x53dd14);}};}function respondWithFilteredResult(_0x43e0fa,_0x324186){return function(_0x13288c){if(_0x13288c){var _0xe660c=typeof _0x324186['offset']===_0x4d0c('0x2e')&&typeof _0x324186[_0x4d0c('0x2f')]==='undefined';var _0x468128=_0x13288c[_0x4d0c('0x30')];var _0x33fb28=_0xe660c?0x0:_0x324186[_0x4d0c('0x31')];var _0x2a9cd2=_0xe660c?_0x13288c[_0x4d0c('0x30')]:_0x324186[_0x4d0c('0x31')]+_0x324186['limit'];var _0x4c6619;if(_0x2a9cd2>=_0x468128){_0x2a9cd2=_0x468128;_0x4c6619=0xc8;}else{_0x4c6619=0xce;}_0x43e0fa[_0x4d0c('0x2b')](_0x4c6619);return _0x43e0fa[_0x4d0c('0x32')]('Content-Range',_0x33fb28+'-'+_0x2a9cd2+'/'+_0x468128)[_0x4d0c('0x2d')](_0x13288c);}return null;};}function patchUpdates(_0x57b569){return function(_0xaae1e6){try{jsonpatch['apply'](_0xaae1e6,_0x57b569,!![]);}catch(_0x57a8b4){return BPromise[_0x4d0c('0x33')](_0x57a8b4);}return _0xaae1e6[_0x4d0c('0x34')]();};}function saveUpdates(_0x4f6e01,_0x20f68f){return function(_0x575ea2){if(_0x575ea2){return _0x575ea2[_0x4d0c('0x35')](_0x4f6e01)['then'](function(_0x170f19){return _0x170f19;});}return null;};}function removeEntity(_0x56a080,_0x4f1515){return function(_0x3d5f29){if(_0x3d5f29){return _0x3d5f29[_0x4d0c('0x36')]()['then'](function(){_0x56a080[_0x4d0c('0x2b')](0xcc)[_0x4d0c('0x2c')]();});}};}function handleEntityNotFound(_0x14e423,_0x1cf725){return function(_0x33653e){if(!_0x33653e){_0x14e423[_0x4d0c('0x2a')](0x194);}return _0x33653e;};}function handleError(_0x37894d,_0x2d7253){_0x2d7253=_0x2d7253||0x1f4;return function(_0x4e75d8){logger[_0x4d0c('0x24')](_0x4e75d8[_0x4d0c('0x37')]);if(_0x4e75d8[_0x4d0c('0x38')]){delete _0x4e75d8['name'];}_0x37894d[_0x4d0c('0x2b')](_0x2d7253)[_0x4d0c('0x39')](_0x4e75d8);};}exports['index']=function(_0x453393,_0x592ce1){var _0x54508f={},_0x981e52={},_0x38572d={'count':0x0,'rows':[]};var _0x32c712=_[_0x4d0c('0x3a')](db[_0x4d0c('0x3b')][_0x4d0c('0x3c')],function(_0x4ad18f){return{'name':_0x4ad18f[_0x4d0c('0x3d')],'type':_0x4ad18f[_0x4d0c('0x3e')][_0x4d0c('0x3f')]};});_0x981e52['model']=_[_0x4d0c('0x3a')](_0x32c712,_0x4d0c('0x38'));_0x981e52[_0x4d0c('0x40')]=_[_0x4d0c('0x41')](_0x453393[_0x4d0c('0x40')]);_0x981e52['filters']=_[_0x4d0c('0x42')](_0x981e52[_0x4d0c('0x43')],_0x981e52['query']);_0x54508f['attributes']=_[_0x4d0c('0x42')](_0x981e52[_0x4d0c('0x43')],qs[_0x4d0c('0x44')](_0x453393[_0x4d0c('0x40')]['fields']));_0x54508f['attributes']=_0x54508f[_0x4d0c('0x45')][_0x4d0c('0x46')]?_0x54508f['attributes']:_0x981e52[_0x4d0c('0x43')];if(!_0x453393[_0x4d0c('0x40')]['hasOwnProperty'](_0x4d0c('0x47'))){_0x54508f[_0x4d0c('0x2f')]=qs[_0x4d0c('0x2f')](_0x453393['query'][_0x4d0c('0x2f')]);_0x54508f[_0x4d0c('0x31')]=qs[_0x4d0c('0x31')](_0x453393['query'][_0x4d0c('0x31')]);}_0x54508f[_0x4d0c('0x48')]=qs[_0x4d0c('0x49')](_0x453393['query'][_0x4d0c('0x49')]);_0x54508f[_0x4d0c('0x4a')]=qs['filters'](_['pick'](_0x453393[_0x4d0c('0x40')],_0x981e52[_0x4d0c('0x4b')]),_0x32c712);if(_0x453393['query'][_0x4d0c('0x4c')]){_0x54508f['where']=_['merge'](_0x54508f[_0x4d0c('0x4a')],{'$or':_[_0x4d0c('0x3a')](_0x32c712,function(_0x55ae7f){if(_0x55ae7f[_0x4d0c('0x3e')]!=='VIRTUAL'){var _0x4dce59={};_0x4dce59[_0x55ae7f[_0x4d0c('0x38')]]={'$like':'%'+_0x453393[_0x4d0c('0x40')][_0x4d0c('0x4c')]+'%'};return _0x4dce59;}})});}_0x54508f=_[_0x4d0c('0x4d')]({},_0x54508f,_0x453393[_0x4d0c('0x4e')]);var _0x5c6d68={'where':_0x54508f['where']};return db[_0x4d0c('0x3b')][_0x4d0c('0x30')](_0x5c6d68)[_0x4d0c('0x1f')](function(_0x5e2810){_0x38572d[_0x4d0c('0x30')]=_0x5e2810;if(_0x453393[_0x4d0c('0x40')][_0x4d0c('0x4f')]){_0x54508f['include']=[{'all':!![]}];}return db[_0x4d0c('0x3b')][_0x4d0c('0x50')](_0x54508f);})[_0x4d0c('0x1f')](function(_0x98c438){_0x38572d[_0x4d0c('0x51')]=_0x98c438;return _0x38572d;})['then'](respondWithFilteredResult(_0x592ce1,_0x54508f))[_0x4d0c('0x29')](handleError(_0x592ce1,null));};exports[_0x4d0c('0x52')]=function(_0x3d4dd6,_0x27fe22){var _0x3728c1={'raw':!![],'where':{'id':_0x3d4dd6['params']['id']}},_0x33e455={};_0x33e455[_0x4d0c('0x43')]=_[_0x4d0c('0x41')](db[_0x4d0c('0x3b')][_0x4d0c('0x3c')]);_0x33e455[_0x4d0c('0x40')]=_[_0x4d0c('0x41')](_0x3d4dd6['query']);_0x33e455[_0x4d0c('0x4b')]=_[_0x4d0c('0x42')](_0x33e455[_0x4d0c('0x43')],_0x33e455[_0x4d0c('0x40')]);_0x3728c1[_0x4d0c('0x45')]=_[_0x4d0c('0x42')](_0x33e455[_0x4d0c('0x43')],qs[_0x4d0c('0x44')](_0x3d4dd6[_0x4d0c('0x40')][_0x4d0c('0x44')]));_0x3728c1[_0x4d0c('0x45')]=_0x3728c1[_0x4d0c('0x45')][_0x4d0c('0x46')]?_0x3728c1['attributes']:_0x33e455[_0x4d0c('0x43')];if(_0x3d4dd6[_0x4d0c('0x40')][_0x4d0c('0x4f')]){_0x3728c1[_0x4d0c('0x53')]=[{'all':!![]}];}_0x3728c1=_[_0x4d0c('0x4d')]({},_0x3728c1,_0x3d4dd6['options']);return db['ChatMessage'][_0x4d0c('0x54')](_0x3728c1)[_0x4d0c('0x1f')](handleEntityNotFound(_0x27fe22,null))['then'](respondWithResult(_0x27fe22,null))[_0x4d0c('0x29')](handleError(_0x27fe22,null));};exports['create']=function(_0x466c09,_0x2794bc){return db[_0x4d0c('0x3b')]['create'](_0x466c09[_0x4d0c('0x55')],{})[_0x4d0c('0x1f')](respondWithResult(_0x2794bc,0xc9))[_0x4d0c('0x29')](handleError(_0x2794bc,null));};exports[_0x4d0c('0x35')]=function(_0x4885e3,_0xce0ac8){if(_0x4885e3['body']['id']){delete _0x4885e3['body']['id'];}return db['ChatMessage'][_0x4d0c('0x54')]({'where':{'id':_0x4885e3[_0x4d0c('0x56')]['id']}})[_0x4d0c('0x1f')](handleEntityNotFound(_0xce0ac8,null))[_0x4d0c('0x1f')](saveUpdates(_0x4885e3['body'],null))[_0x4d0c('0x1f')](respondWithResult(_0xce0ac8,null))[_0x4d0c('0x29')](handleError(_0xce0ac8,null));};exports[_0x4d0c('0x36')]=function(_0x5aace7,_0x416dad){return db[_0x4d0c('0x3b')][_0x4d0c('0x54')]({'where':{'id':_0x5aace7[_0x4d0c('0x56')]['id']}})[_0x4d0c('0x1f')](handleEntityNotFound(_0x416dad,null))[_0x4d0c('0x1f')](removeEntity(_0x416dad,null))[_0x4d0c('0x29')](handleError(_0x416dad,null));};exports[_0x4d0c('0x57')]=function(_0x1f9d17,_0x1f71da){return db['ChatMessage'][_0x4d0c('0x57')]()[_0x4d0c('0x1f')](respondWithResult(_0x1f71da,null))[_0x4d0c('0x29')](handleError(_0x1f71da,null));};var interaction_log=require(_0x4d0c('0x12'))(_0x4d0c('0x58'));exports[_0x4d0c('0x59')]=function(_0x329394,_0x11b88b,_0x3b67ab){var _0x304364={'agent':{},'channel':_0x4d0c('0x5a')};if(_0x329394[_0x4d0c('0x55')]['id']){delete _0x329394[_0x4d0c('0x55')]['id'];}_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5b')]=!![];_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5c')]=moment()[_0x4d0c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')]=_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')]||_0x329394[_0x4d0c('0x5f')]['id'];_0x304364[_0x4d0c('0x60')]['id']=_0x329394[_0x4d0c('0x55')]['UserId'];return db[_0x4d0c('0x3b')][_0x4d0c('0x54')]({'where':{'id':_0x329394[_0x4d0c('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11b88b,null))[_0x4d0c('0x1f')](saveUpdates(_0x329394[_0x4d0c('0x55')],null))[_0x4d0c('0x1f')](function(_0x3257a4){if(_0x3257a4){_0x304364[_0x4d0c('0x26')]=_0x3257a4['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x3257a4[_0x4d0c('0x61')]}});}return null;})[_0x4d0c('0x1f')](handleEntityNotFound(_0x11b88b,null))[_0x4d0c('0x1f')](function(_0x46d958){if(_0x46d958){return _0x46d958[_0x4d0c('0x35')]({'UserId':_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')],'read1stAt':_['isNil'](_0x46d958['read1stAt'])?moment()[_0x4d0c('0x5d')](_0x4d0c('0x62')):undefined});}return null;})['then'](function(_0x494312){if(_0x494312){_0x304364['interaction']=_0x494312[_0x4d0c('0x63')]({'plain':!![]});interaction_log[_0x4d0c('0x27')](_0x4d0c('0x64'),_0x329394[_0x4d0c('0x5f')]['id'],_0x329394[_0x4d0c('0x5f')][_0x4d0c('0x38')],_0x329394[_0x4d0c('0x5f')][_0x4d0c('0x65')],_0x304364[_0x4d0c('0x66')]['id'],_0x329394[_0x4d0c('0x55')]?JSON[_0x4d0c('0x23')](_0x329394[_0x4d0c('0x55')]):_0x4d0c('0x67'));return respondWithRpcPromise(_0x4d0c('0x68'),_0x4d0c('0x69'),_0x304364);}return null;})[_0x4d0c('0x1f')](function(_0x422972){var _0x578764=_0x4d0c('0x6a')+_0x422972['message'][_0x4d0c('0x6b')];return db[_0x4d0c('0x6c')][_0x4d0c('0x40')](_0x578764,{'type':db['Sequelize'][_0x4d0c('0x6d')][_0x4d0c('0x6e')],'raw':!![]})['then'](function(_0x587dfb){return _0x587dfb;});})[_0x4d0c('0x1f')](function(_0x5d919d){if(_0x5d919d){_0x304364[_0x4d0c('0x26')][_0x4d0c('0x6f')]=_0x5d919d[0x0];if(!_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')])return;return db[_0x4d0c('0x70')]['find']({'where':{'id':_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')],'role':_0x4d0c('0x60')},'attributes':['id','name',_0x4d0c('0x71'),_0x4d0c('0x72'),_0x4d0c('0x73')],'raw':!![]});}return null;})[_0x4d0c('0x1f')](function(_0x434e3e){if(!_0x434e3e)return null;_0x304364[_0x4d0c('0x26')]['agent']=_0x434e3e;return _0x304364;})[_0x4d0c('0x1f')](function(_0x3dd49b){if(_0x3dd49b){if(_0x329394[_0x4d0c('0x55')][_0x4d0c('0x74')]){_0x304364[_0x4d0c('0x26')][_0x4d0c('0x75')]=util[_0x4d0c('0x5d')]('SIP/%s',_0x329394[_0x4d0c('0x5f')][_0x4d0c('0x38')]);_0x304364[_0x4d0c('0x26')][_0x4d0c('0x76')]=_0x304364[_0x4d0c('0x76')];_0x304364[_0x4d0c('0x26')][_0x4d0c('0x77')]=_0x304364[_0x4d0c('0x76')];_0x304364[_0x4d0c('0x26')]['event']=_0x4d0c('0x59');return respondWithRpcPromise(_0x4d0c('0x78'),_0x4d0c('0x78'),{'event':_0x4d0c('0x79'),'message':_[_0x4d0c('0x4d')](_0x304364[_0x4d0c('0x26')],JSON[_0x4d0c('0x7a')](_0x304364[_0x4d0c('0x66')]['formData']))},client9002)[_0x4d0c('0x1f')](function(){return _0x304364;});}return _0x304364;}return null;})[_0x4d0c('0x1f')](respondWithResult(_0x11b88b,null))[_0x4d0c('0x29')](handleError(_0x11b88b,null));};var interaction_log=require(_0x4d0c('0x12'))(_0x4d0c('0x58'));exports[_0x4d0c('0x33')]=function(_0x51f73d,_0x17b29a,_0x3f53b2){var _0x2521d4={'agent':{},'channel':_0x4d0c('0x5a')};if(_0x51f73d['body']['id']){delete _0x51f73d[_0x4d0c('0x55')]['id'];}_0x51f73d[_0x4d0c('0x55')][_0x4d0c('0x5e')]=_0x51f73d[_0x4d0c('0x55')][_0x4d0c('0x5e')]||_0x51f73d['user']['id'];_0x2521d4[_0x4d0c('0x60')]['id']=_0x51f73d['body'][_0x4d0c('0x5e')];return db[_0x4d0c('0x3b')][_0x4d0c('0x54')]({'where':{'id':_0x51f73d[_0x4d0c('0x56')]['id'],'UserId':null}})[_0x4d0c('0x1f')](handleEntityNotFound(_0x17b29a,null))['then'](function(_0x3a0539){if(_0x3a0539){_0x2521d4[_0x4d0c('0x26')]=_0x3a0539[_0x4d0c('0x63')]({'plain':!![]});return db[_0x4d0c('0x7b')]['find']({'where':{'id':_0x3a0539['ChatInteractionId']}});}return null;})[_0x4d0c('0x1f')](handleEntityNotFound(_0x17b29a,null))['then'](function(_0x7d29db){if(_0x7d29db){_0x2521d4[_0x4d0c('0x66')]=_0x7d29db[_0x4d0c('0x63')]({'plain':!![]});interaction_log['info'](_0x4d0c('0x7c'),_0x51f73d[_0x4d0c('0x5f')]['id'],_0x51f73d[_0x4d0c('0x5f')][_0x4d0c('0x38')],_0x51f73d['user'][_0x4d0c('0x65')],_0x2521d4[_0x4d0c('0x66')]['id'],_0x51f73d['body']?JSON[_0x4d0c('0x23')](_0x51f73d[_0x4d0c('0x55')]):_0x4d0c('0x67'));return respondWithRpcPromise(_0x4d0c('0x7d'),'rejectMessage',_0x2521d4);}return null;})['then'](function(_0x27c468){var _0x207f45='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27c468[_0x4d0c('0x26')][_0x4d0c('0x6b')];return db[_0x4d0c('0x6c')][_0x4d0c('0x40')](_0x207f45,{'type':db[_0x4d0c('0x7e')][_0x4d0c('0x6d')][_0x4d0c('0x6e')],'raw':!![]})['then'](function(_0x17360c){return _0x17360c;});})[_0x4d0c('0x1f')](function(_0xe60750){if(_0xe60750){_0x2521d4[_0x4d0c('0x26')][_0x4d0c('0x6f')]=_0xe60750[0x0];if(!_0x51f73d['body'][_0x4d0c('0x5e')])return;return db[_0x4d0c('0x70')][_0x4d0c('0x54')]({'where':{'id':_0x51f73d[_0x4d0c('0x55')][_0x4d0c('0x5e')],'role':'agent'},'attributes':['id',_0x4d0c('0x38'),'fullname',_0x4d0c('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x235260){if(!_0x235260)return null;_0x2521d4[_0x4d0c('0x26')][_0x4d0c('0x60')]=_0x235260;return _0x2521d4;})[_0x4d0c('0x1f')](function(_0x508d96){if(_0x508d96){_0x508d96[_0x4d0c('0x26')]['interface']=util[_0x4d0c('0x5d')](_0x4d0c('0x7f'),_0x51f73d[_0x4d0c('0x5f')][_0x4d0c('0x38')]);_0x508d96[_0x4d0c('0x26')]['channel']=_0x2521d4[_0x4d0c('0x76')];_0x508d96['message']['motionChannel']=_0x2521d4['channel'];_0x508d96[_0x4d0c('0x26')][_0x4d0c('0x80')]=_0x4d0c('0x33');respondWithRpcPromise(_0x4d0c('0x78'),_0x4d0c('0x78'),{'event':_0x4d0c('0x81'),'message':_[_0x4d0c('0x4d')](_0x2521d4['message'],JSON[_0x4d0c('0x7a')](_0x2521d4[_0x4d0c('0x66')]['formData']))},client9002);return _0x2521d4;}return null;})[_0x4d0c('0x1f')](respondWithResult(_0x17b29a,null))[_0x4d0c('0x29')](handleError(_0x17b29a,null));}; \ No newline at end of file +var _0xea34=['localhost','socket.io-emitter','./chatMessage.socket','register','http','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','ChatMessage,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','include','findAll','rows','show','params','create','body','update','find','describe','../../config/logger','accept','chat','read','readAt','UserId','user','agent','get','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteractionId','RejectMessage','rejectMessage','QueryTypes','fullname','SIP/%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x4f8b9b,_0x4bdf66){var _0x81d2f3=function(_0x5a08cd){while(--_0x5a08cd){_0x4f8b9b['push'](_0x4f8b9b['shift']());}};_0x81d2f3(++_0x4bdf66);}(_0xea34,0xf4));var _0x4ea3=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xea34[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0x4ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ea3('0x1'));var jsonpatch=require(_0x4ea3('0x2'));var rp=require(_0x4ea3('0x3'));var moment=require(_0x4ea3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ea3('0x5'));var path=require(_0x4ea3('0x6'));var sox=require(_0x4ea3('0x7'));var csv=require(_0x4ea3('0x8'));var ejs=require(_0x4ea3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ea3('0xa'));var _=require(_0x4ea3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ea3('0xc'));var deskjs=require(_0x4ea3('0xd'));var toCsv=require(_0x4ea3('0x8'));var querystring=require(_0x4ea3('0xe'));var Papa=require('papaparse');var Redis=require(_0x4ea3('0xf'));var authService=require(_0x4ea3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ea3('0x11'));var utils=require('../../config/utils');var config=require(_0x4ea3('0x12'));var licenseUtil=require(_0x4ea3('0x13'));var db=require(_0x4ea3('0x14'))['db'];config[_0x4ea3('0x15')]=_['defaults'](config[_0x4ea3('0x15')],{'host':_0x4ea3('0x16'),'port':0x18eb});var socket=require(_0x4ea3('0x17'))(new Redis(config[_0x4ea3('0x15')]));require(_0x4ea3('0x18'))[_0x4ea3('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x4ea3('0x1a')]({'port':0x232c});var client9002=jayson[_0x4ea3('0x1b')][_0x4ea3('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x517baf,_0x5baf67,_0x236c4d,_0x4b432c){return new BPromise(function(_0x4cfbbb,_0xc16ca){var _0x104654=_0x4b432c||client;return _0x104654[_0x4ea3('0x1c')](_0x517baf,_0x236c4d)[_0x4ea3('0x1d')](function(_0x208a83){logger[_0x4ea3('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x5baf67,_0x4ea3('0x1f'));logger[_0x4ea3('0x20')](_0x4ea3('0x21'),_0x5baf67,'request\x20sent',JSON[_0x4ea3('0x22')](_0x208a83));if(_0x208a83['error']){if(_0x208a83['error'][_0x4ea3('0x23')]===0x1f4){logger['error'](_0x4ea3('0x24'),_0x5baf67,_0x208a83[_0x4ea3('0x25')]['message']);return _0xc16ca(_0x208a83[_0x4ea3('0x25')][_0x4ea3('0x26')]);}logger['error'](_0x4ea3('0x24'),_0x5baf67,_0x208a83[_0x4ea3('0x25')]['message']);return _0x4cfbbb(_0x208a83[_0x4ea3('0x25')]['message']);}else{logger[_0x4ea3('0x1e')](_0x4ea3('0x24'),_0x5baf67,_0x4ea3('0x1f'));_0x4cfbbb(_0x208a83[_0x4ea3('0x27')]['message']);}})[_0x4ea3('0x28')](function(_0x29778f){logger['error'](_0x4ea3('0x24'),_0x5baf67,_0x29778f);_0xc16ca(_0x29778f);});});}function respondWithStatusCode(_0x50ffb1,_0x4c1ecb){_0x4c1ecb=_0x4c1ecb||0xcc;return function(_0x2a7566){if(_0x2a7566){return _0x50ffb1[_0x4ea3('0x29')](_0x4c1ecb);}return _0x50ffb1[_0x4ea3('0x2a')](_0x4c1ecb)['end']();};}function respondWithResult(_0x53402d,_0x41aaa2){_0x41aaa2=_0x41aaa2||0xc8;return function(_0x268419){if(_0x268419){return _0x53402d[_0x4ea3('0x2a')](_0x41aaa2)[_0x4ea3('0x2b')](_0x268419);}};}function respondWithFilteredResult(_0x490024,_0xf184ac){return function(_0x30f379){if(_0x30f379){var _0x3bd434=typeof _0xf184ac[_0x4ea3('0x2c')]===_0x4ea3('0x2d')&&typeof _0xf184ac['limit']===_0x4ea3('0x2d');var _0x2c2947=_0x30f379[_0x4ea3('0x2e')];var _0x516083=_0x3bd434?0x0:_0xf184ac[_0x4ea3('0x2c')];var _0x3d8ff9=_0x3bd434?_0x30f379['count']:_0xf184ac[_0x4ea3('0x2c')]+_0xf184ac[_0x4ea3('0x2f')];var _0x316c38;if(_0x3d8ff9>=_0x2c2947){_0x3d8ff9=_0x2c2947;_0x316c38=0xc8;}else{_0x316c38=0xce;}_0x490024[_0x4ea3('0x2a')](_0x316c38);return _0x490024['set']('Content-Range',_0x516083+'-'+_0x3d8ff9+'/'+_0x2c2947)[_0x4ea3('0x2b')](_0x30f379);}return null;};}function patchUpdates(_0x152268){return function(_0x3393b5){try{jsonpatch[_0x4ea3('0x30')](_0x3393b5,_0x152268,!![]);}catch(_0x58daff){return BPromise[_0x4ea3('0x31')](_0x58daff);}return _0x3393b5[_0x4ea3('0x32')]();};}function saveUpdates(_0xebb0ad,_0x53116c){return function(_0x122cbb){if(_0x122cbb){return _0x122cbb['update'](_0xebb0ad)[_0x4ea3('0x1d')](function(_0x37449a){return _0x37449a;});}return null;};}function removeEntity(_0x51311f,_0x2622e7){return function(_0x29a7ac){if(_0x29a7ac){return _0x29a7ac[_0x4ea3('0x33')]()[_0x4ea3('0x1d')](function(){_0x51311f['status'](0xcc)[_0x4ea3('0x34')]();});}};}function handleEntityNotFound(_0x800a9d,_0x112a6f){return function(_0x4c4456){if(!_0x4c4456){_0x800a9d[_0x4ea3('0x29')](0x194);}return _0x4c4456;};}function handleError(_0x390358,_0x58ba54){_0x58ba54=_0x58ba54||0x1f4;return function(_0x12d649){logger[_0x4ea3('0x25')](_0x12d649[_0x4ea3('0x35')]);if(_0x12d649[_0x4ea3('0x36')]){delete _0x12d649[_0x4ea3('0x36')];}_0x390358[_0x4ea3('0x2a')](_0x58ba54)[_0x4ea3('0x37')](_0x12d649);};}exports[_0x4ea3('0x38')]=function(_0x203e29,_0x56931a){var _0x41110b={},_0x17d686={},_0x5a3457={'count':0x0,'rows':[]};var _0x3a599f=_[_0x4ea3('0x39')](db['ChatMessage'][_0x4ea3('0x3a')],function(_0x3c7e37){return{'name':_0x3c7e37[_0x4ea3('0x3b')],'type':_0x3c7e37[_0x4ea3('0x3c')][_0x4ea3('0x3d')]};});_0x17d686['model']=_[_0x4ea3('0x39')](_0x3a599f,_0x4ea3('0x36'));_0x17d686[_0x4ea3('0x3e')]=_[_0x4ea3('0x3f')](_0x203e29[_0x4ea3('0x3e')]);_0x17d686[_0x4ea3('0x40')]=_[_0x4ea3('0x41')](_0x17d686[_0x4ea3('0x42')],_0x17d686[_0x4ea3('0x3e')]);_0x41110b[_0x4ea3('0x43')]=_[_0x4ea3('0x41')](_0x17d686[_0x4ea3('0x42')],qs[_0x4ea3('0x44')](_0x203e29[_0x4ea3('0x3e')][_0x4ea3('0x44')]));_0x41110b[_0x4ea3('0x43')]=_0x41110b[_0x4ea3('0x43')][_0x4ea3('0x45')]?_0x41110b['attributes']:_0x17d686[_0x4ea3('0x42')];if(!_0x203e29[_0x4ea3('0x3e')][_0x4ea3('0x46')](_0x4ea3('0x47'))){_0x41110b[_0x4ea3('0x2f')]=qs[_0x4ea3('0x2f')](_0x203e29[_0x4ea3('0x3e')]['limit']);_0x41110b[_0x4ea3('0x2c')]=qs[_0x4ea3('0x2c')](_0x203e29[_0x4ea3('0x3e')][_0x4ea3('0x2c')]);}_0x41110b[_0x4ea3('0x48')]=qs['sort'](_0x203e29['query'][_0x4ea3('0x49')]);_0x41110b[_0x4ea3('0x4a')]=qs['filters'](_[_0x4ea3('0x4b')](_0x203e29[_0x4ea3('0x3e')],_0x17d686['filters']),_0x3a599f);if(_0x203e29['query'][_0x4ea3('0x4c')]){_0x41110b[_0x4ea3('0x4a')]=_[_0x4ea3('0x4d')](_0x41110b[_0x4ea3('0x4a')],{'$or':_[_0x4ea3('0x39')](_0x3a599f,function(_0x1bf788){if(_0x1bf788[_0x4ea3('0x3c')]!==_0x4ea3('0x4e')){var _0x19538f={};_0x19538f[_0x1bf788[_0x4ea3('0x36')]]={'$like':'%'+_0x203e29[_0x4ea3('0x3e')][_0x4ea3('0x4c')]+'%'};return _0x19538f;}})});}_0x41110b=_[_0x4ea3('0x4d')]({},_0x41110b,_0x203e29[_0x4ea3('0x4f')]);var _0x2b962f={'where':_0x41110b['where']};return db[_0x4ea3('0x50')][_0x4ea3('0x2e')](_0x2b962f)[_0x4ea3('0x1d')](function(_0x1f9712){_0x5a3457[_0x4ea3('0x2e')]=_0x1f9712;if(_0x203e29[_0x4ea3('0x3e')]['includeAll']){_0x41110b[_0x4ea3('0x51')]=[{'all':!![]}];}return db[_0x4ea3('0x50')][_0x4ea3('0x52')](_0x41110b);})[_0x4ea3('0x1d')](function(_0x2ea4ac){_0x5a3457[_0x4ea3('0x53')]=_0x2ea4ac;return _0x5a3457;})[_0x4ea3('0x1d')](respondWithFilteredResult(_0x56931a,_0x41110b))[_0x4ea3('0x28')](handleError(_0x56931a,null));};exports[_0x4ea3('0x54')]=function(_0x4e83c8,_0x41f951){var _0x3bae2d={'raw':!![],'where':{'id':_0x4e83c8[_0x4ea3('0x55')]['id']}},_0x20fc5f={};_0x20fc5f[_0x4ea3('0x42')]=_[_0x4ea3('0x3f')](db['ChatMessage'][_0x4ea3('0x3a')]);_0x20fc5f[_0x4ea3('0x3e')]=_['keys'](_0x4e83c8[_0x4ea3('0x3e')]);_0x20fc5f[_0x4ea3('0x40')]=_[_0x4ea3('0x41')](_0x20fc5f[_0x4ea3('0x42')],_0x20fc5f[_0x4ea3('0x3e')]);_0x3bae2d[_0x4ea3('0x43')]=_[_0x4ea3('0x41')](_0x20fc5f[_0x4ea3('0x42')],qs['fields'](_0x4e83c8[_0x4ea3('0x3e')][_0x4ea3('0x44')]));_0x3bae2d[_0x4ea3('0x43')]=_0x3bae2d[_0x4ea3('0x43')][_0x4ea3('0x45')]?_0x3bae2d[_0x4ea3('0x43')]:_0x20fc5f[_0x4ea3('0x42')];if(_0x4e83c8[_0x4ea3('0x3e')]['includeAll']){_0x3bae2d['include']=[{'all':!![]}];}_0x3bae2d=_['merge']({},_0x3bae2d,_0x4e83c8[_0x4ea3('0x4f')]);return db[_0x4ea3('0x50')]['find'](_0x3bae2d)[_0x4ea3('0x1d')](handleEntityNotFound(_0x41f951,null))[_0x4ea3('0x1d')](respondWithResult(_0x41f951,null))['catch'](handleError(_0x41f951,null));};exports[_0x4ea3('0x56')]=function(_0x3ebf29,_0x4143a4){return db[_0x4ea3('0x50')]['create'](_0x3ebf29[_0x4ea3('0x57')],{})[_0x4ea3('0x1d')](respondWithResult(_0x4143a4,0xc9))[_0x4ea3('0x28')](handleError(_0x4143a4,null));};exports[_0x4ea3('0x58')]=function(_0x5e0fb5,_0x45c416){if(_0x5e0fb5[_0x4ea3('0x57')]['id']){delete _0x5e0fb5['body']['id'];}return db['ChatMessage'][_0x4ea3('0x59')]({'where':{'id':_0x5e0fb5[_0x4ea3('0x55')]['id']}})[_0x4ea3('0x1d')](handleEntityNotFound(_0x45c416,null))[_0x4ea3('0x1d')](saveUpdates(_0x5e0fb5[_0x4ea3('0x57')],null))[_0x4ea3('0x1d')](respondWithResult(_0x45c416,null))['catch'](handleError(_0x45c416,null));};exports['destroy']=function(_0x4f5259,_0x4db2a9){return db['ChatMessage'][_0x4ea3('0x59')]({'where':{'id':_0x4f5259['params']['id']}})[_0x4ea3('0x1d')](handleEntityNotFound(_0x4db2a9,null))[_0x4ea3('0x1d')](removeEntity(_0x4db2a9,null))[_0x4ea3('0x28')](handleError(_0x4db2a9,null));};exports['describe']=function(_0x3fca8a,_0x284b3d){return db[_0x4ea3('0x50')][_0x4ea3('0x5a')]()[_0x4ea3('0x1d')](respondWithResult(_0x284b3d,null))[_0x4ea3('0x28')](handleError(_0x284b3d,null));};var interaction_log=require(_0x4ea3('0x5b'))('chat-interactions');exports[_0x4ea3('0x5c')]=function(_0x2da620,_0x5d0ec3,_0x4b0ff2){var _0x255f1f={'agent':{},'channel':_0x4ea3('0x5d')};if(_0x2da620[_0x4ea3('0x57')]['id']){delete _0x2da620['body']['id'];}_0x2da620[_0x4ea3('0x57')][_0x4ea3('0x5e')]=!![];_0x2da620[_0x4ea3('0x57')][_0x4ea3('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2da620[_0x4ea3('0x57')][_0x4ea3('0x60')]=_0x2da620[_0x4ea3('0x57')][_0x4ea3('0x60')]||_0x2da620[_0x4ea3('0x61')]['id'];_0x255f1f[_0x4ea3('0x62')]['id']=_0x2da620[_0x4ea3('0x57')][_0x4ea3('0x60')];return db[_0x4ea3('0x50')][_0x4ea3('0x59')]({'where':{'id':_0x2da620[_0x4ea3('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d0ec3,null))[_0x4ea3('0x1d')](saveUpdates(_0x2da620[_0x4ea3('0x57')],null))[_0x4ea3('0x1d')](function(_0x2335e6){if(_0x2335e6){_0x255f1f[_0x4ea3('0x26')]=_0x2335e6[_0x4ea3('0x63')]({'plain':!![]});return db['ChatInteraction'][_0x4ea3('0x59')]({'where':{'id':_0x2335e6['ChatInteractionId']}});}return null;})[_0x4ea3('0x1d')](handleEntityNotFound(_0x5d0ec3,null))['then'](function(_0x4f0291){if(_0x4f0291){return _0x4f0291[_0x4ea3('0x58')]({'UserId':_0x2da620['body'][_0x4ea3('0x60')],'read1stAt':_[_0x4ea3('0x64')](_0x4f0291['read1stAt'])?moment()[_0x4ea3('0x65')](_0x4ea3('0x66')):undefined});}return null;})[_0x4ea3('0x1d')](function(_0x312f6c){if(_0x312f6c){_0x255f1f[_0x4ea3('0x67')]=_0x312f6c[_0x4ea3('0x63')]({'plain':!![]});interaction_log[_0x4ea3('0x1e')](_0x4ea3('0x68'),_0x2da620[_0x4ea3('0x61')]['id'],_0x2da620['user']['name'],_0x2da620[_0x4ea3('0x61')]['role'],_0x255f1f[_0x4ea3('0x67')]['id'],_0x2da620['body']?JSON[_0x4ea3('0x22')](_0x2da620['body']):_0x4ea3('0x69'));return respondWithRpcPromise(_0x4ea3('0x6a'),_0x4ea3('0x6b'),_0x255f1f);}return null;})[_0x4ea3('0x1d')](function(_0x29c7bc){var _0x5ee9fe=_0x4ea3('0x6c')+_0x29c7bc[_0x4ea3('0x26')][_0x4ea3('0x6d')];return db[_0x4ea3('0x6e')][_0x4ea3('0x3e')](_0x5ee9fe,{'type':db[_0x4ea3('0x6f')]['QueryTypes'][_0x4ea3('0x70')],'raw':!![]})[_0x4ea3('0x1d')](function(_0x5a56e4){return _0x5a56e4;});})[_0x4ea3('0x1d')](function(_0x572de9){if(_0x572de9){_0x255f1f[_0x4ea3('0x26')][_0x4ea3('0x71')]=_0x572de9[0x0];if(!_0x2da620['body'][_0x4ea3('0x60')])return;return db[_0x4ea3('0x72')][_0x4ea3('0x59')]({'where':{'id':_0x2da620[_0x4ea3('0x57')][_0x4ea3('0x60')],'role':_0x4ea3('0x62')},'attributes':['id','name','fullname',_0x4ea3('0x73'),_0x4ea3('0x74')],'raw':!![]});}return null;})[_0x4ea3('0x1d')](function(_0x43140d){if(!_0x43140d)return null;_0x255f1f['message']['agent']=_0x43140d;return _0x255f1f;})[_0x4ea3('0x1d')](function(_0x462657){if(_0x462657){if(_0x2da620['body'][_0x4ea3('0x75')]){_0x255f1f[_0x4ea3('0x26')][_0x4ea3('0x76')]=util[_0x4ea3('0x65')]('SIP/%s',_0x2da620[_0x4ea3('0x61')]['name']);_0x255f1f[_0x4ea3('0x26')][_0x4ea3('0x77')]=_0x255f1f[_0x4ea3('0x77')];_0x255f1f[_0x4ea3('0x26')][_0x4ea3('0x78')]=_0x255f1f['channel'];_0x255f1f[_0x4ea3('0x26')][_0x4ea3('0x79')]=_0x4ea3('0x5c');return respondWithRpcPromise(_0x4ea3('0x7a'),_0x4ea3('0x7a'),{'event':_0x4ea3('0x7b'),'message':_[_0x4ea3('0x4d')](_0x255f1f['message'],JSON[_0x4ea3('0x7c')](_0x255f1f[_0x4ea3('0x67')][_0x4ea3('0x7d')]))},client9002)[_0x4ea3('0x1d')](function(){return _0x255f1f;});}return _0x255f1f;}return null;})[_0x4ea3('0x1d')](respondWithResult(_0x5d0ec3,null))['catch'](handleError(_0x5d0ec3,null));};var interaction_log=require(_0x4ea3('0x5b'))(_0x4ea3('0x7e'));exports[_0x4ea3('0x31')]=function(_0x3a957e,_0x550f84,_0x5f1d20){var _0x25fa78={'agent':{},'channel':'chat'};if(_0x3a957e['body']['id']){delete _0x3a957e['body']['id'];}_0x3a957e[_0x4ea3('0x57')][_0x4ea3('0x60')]=_0x3a957e[_0x4ea3('0x57')][_0x4ea3('0x60')]||_0x3a957e[_0x4ea3('0x61')]['id'];_0x25fa78['agent']['id']=_0x3a957e[_0x4ea3('0x57')]['UserId'];return db[_0x4ea3('0x50')]['find']({'where':{'id':_0x3a957e[_0x4ea3('0x55')]['id'],'UserId':null}})[_0x4ea3('0x1d')](handleEntityNotFound(_0x550f84,null))[_0x4ea3('0x1d')](function(_0x37d169){if(_0x37d169){_0x25fa78[_0x4ea3('0x26')]=_0x37d169[_0x4ea3('0x63')]({'plain':!![]});return db['ChatInteraction'][_0x4ea3('0x59')]({'where':{'id':_0x37d169[_0x4ea3('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x550f84,null))[_0x4ea3('0x1d')](function(_0x3ad2d0){if(_0x3ad2d0){_0x25fa78[_0x4ea3('0x67')]=_0x3ad2d0[_0x4ea3('0x63')]({'plain':!![]});interaction_log[_0x4ea3('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a957e['user']['id'],_0x3a957e[_0x4ea3('0x61')][_0x4ea3('0x36')],_0x3a957e[_0x4ea3('0x61')]['role'],_0x25fa78[_0x4ea3('0x67')]['id'],_0x3a957e[_0x4ea3('0x57')]?JSON[_0x4ea3('0x22')](_0x3a957e[_0x4ea3('0x57')]):_0x4ea3('0x69'));return respondWithRpcPromise(_0x4ea3('0x80'),_0x4ea3('0x81'),_0x25fa78);}return null;})[_0x4ea3('0x1d')](function(_0x1f6abb){var _0x41067f=_0x4ea3('0x6c')+_0x1f6abb[_0x4ea3('0x26')][_0x4ea3('0x6d')];return db['sequelize']['query'](_0x41067f,{'type':db[_0x4ea3('0x6f')][_0x4ea3('0x82')][_0x4ea3('0x70')],'raw':!![]})[_0x4ea3('0x1d')](function(_0x438b4d){return _0x438b4d;});})['then'](function(_0x1e164c){if(_0x1e164c){_0x25fa78[_0x4ea3('0x26')][_0x4ea3('0x71')]=_0x1e164c[0x0];if(!_0x3a957e[_0x4ea3('0x57')]['UserId'])return;return db[_0x4ea3('0x72')][_0x4ea3('0x59')]({'where':{'id':_0x3a957e[_0x4ea3('0x57')][_0x4ea3('0x60')],'role':_0x4ea3('0x62')},'attributes':['id',_0x4ea3('0x36'),_0x4ea3('0x83'),_0x4ea3('0x73'),'internal'],'raw':!![]});}return null;})[_0x4ea3('0x1d')](function(_0x5bbe7b){if(!_0x5bbe7b)return null;_0x25fa78[_0x4ea3('0x26')]['agent']=_0x5bbe7b;return _0x25fa78;})[_0x4ea3('0x1d')](function(_0x23a803){if(_0x23a803){_0x23a803[_0x4ea3('0x26')][_0x4ea3('0x76')]=util[_0x4ea3('0x65')](_0x4ea3('0x84'),_0x3a957e['user'][_0x4ea3('0x36')]);_0x23a803[_0x4ea3('0x26')][_0x4ea3('0x77')]=_0x25fa78[_0x4ea3('0x77')];_0x23a803['message'][_0x4ea3('0x78')]=_0x25fa78[_0x4ea3('0x77')];_0x23a803[_0x4ea3('0x26')][_0x4ea3('0x79')]=_0x4ea3('0x31');respondWithRpcPromise(_0x4ea3('0x7a'),_0x4ea3('0x7a'),{'event':'rejectmessage','message':_[_0x4ea3('0x4d')](_0x25fa78[_0x4ea3('0x26')],JSON[_0x4ea3('0x7c')](_0x25fa78[_0x4ea3('0x67')][_0x4ea3('0x7d')]))},client9002);return _0x25fa78;}return null;})['then'](respondWithResult(_0x550f84,null))[_0x4ea3('0x28')](handleError(_0x550f84,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0523f06..7b44aa1 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 _0xc501=['save','remove','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc501,0x64));var _0x1c50=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0xc501[_0x2c5255];return _0x30d0ea;};'use strict';var EventEmitter=require(_0x1c50('0x0'));var ChatMessage=require(_0x1c50('0x1'))['db'][_0x1c50('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1c50('0x3')](0x0);var events={'afterCreate':_0x1c50('0x4'),'afterUpdate':'update','afterDestroy':_0x1c50('0x5')};function emitEvent(_0x27af38){return function(_0x3d1a13,_0x48791f,_0x271ec2){ChatMessageEvents['emit'](_0x27af38+':'+_0x3d1a13['id'],_0x3d1a13);ChatMessageEvents['emit'](_0x27af38,_0x3d1a13);_0x271ec2(null);};}for(var e in events){if(events[_0x1c50('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x1c50('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x595d=['hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x18f58c,_0x2de294){var _0x2911ab=function(_0x36865a){while(--_0x36865a){_0x18f58c['push'](_0x18f58c['shift']());}};_0x2911ab(++_0x2de294);}(_0x595d,0xfc));var _0xd595=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x595d[_0x158f01];return _0x5ef74e;};'use strict';var EventEmitter=require(_0xd595('0x0'));var ChatMessage=require(_0xd595('0x1'))['db'][_0xd595('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd595('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd595('0x4'),'afterDestroy':_0xd595('0x5')};function emitEvent(_0xe61e19){return function(_0x318e3d,_0x5318c5,_0x47008c){ChatMessageEvents[_0xd595('0x6')](_0xe61e19+':'+_0x318e3d['id'],_0x318e3d);ChatMessageEvents[_0xd595('0x6')](_0xe61e19,_0x318e3d);_0x47008c(null);};}for(var e in events){if(events[_0xd595('0x7')](e)){var event=events[e];ChatMessage[_0xd595('0x8')](e,emitEvent(event));}}module[_0xd595('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c11ac62..b0fe5b9 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 _0x1d9d=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x333a60,_0x201ccf){var _0x21e8c2=function(_0x2fbac3){while(--_0x2fbac3){_0x333a60['push'](_0x333a60['shift']());}};_0x21e8c2(++_0x201ccf);}(_0x1d9d,0x6d));var _0xd1d9=function(_0x3fd38f,_0x5c31e2){_0x3fd38f=_0x3fd38f-0x0;var _0x15afd0=_0x1d9d[_0x3fd38f];return _0x15afd0;};'use strict';var _=require(_0xd1d9('0x0'));var util=require(_0xd1d9('0x1'));var logger=require(_0xd1d9('0x2'))('api');var moment=require(_0xd1d9('0x3'));var BPromise=require(_0xd1d9('0x4'));var rp=require(_0xd1d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1d9('0x6'));var config=require(_0xd1d9('0x7'));var attributes=require(_0xd1d9('0x8'));module[_0xd1d9('0x9')]=function(_0x5cc987,_0x286cd0){return _0x5cc987[_0xd1d9('0xa')](_0xd1d9('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xd1d9('0xc'),'fields':[_0xd1d9('0xd')],'type':_0xd1d9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e1b9e,_0x536d32,_0x105a4f){var _0x5132ef=_0x5cc987['models'];var _0x39f3c7=_0x1e1b9e[_0xd1d9('0xf')]({'plain':!![]});if(_0x39f3c7[_0xd1d9('0x10')]['toLowerCase']()==='in'||_0x39f3c7[_0xd1d9('0x10')][_0xd1d9('0x11')]()===_0xd1d9('0x12')&&!_0x39f3c7['secret']&&!_['isNil'](_0x39f3c7['UserId'])){_0x5132ef[_0xd1d9('0x13')][_0xd1d9('0x14')]({'where':{'id':_0x39f3c7[_0xd1d9('0x15')]}})[_0xd1d9('0x16')](function(_0x45c88c){if(_0x45c88c){_0x45c88c['update']({'lastMsgAt':_0x39f3c7[_0xd1d9('0x17')],'lastMsgDirection':_0x39f3c7['direction'][_0xd1d9('0x11')]()});}})[_0xd1d9('0x18')](function(_0x42df45){console[_0xd1d9('0x19')](_0x42df45);});}_0x105a4f();}},'charset':_0xd1d9('0x1a'),'collate':_0xd1d9('0x1b')});}; \ No newline at end of file +var _0x21b2=['toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction'];(function(_0x3414b6,_0x301e64){var _0x3d36b9=function(_0x28ab46){while(--_0x28ab46){_0x3414b6['push'](_0x3414b6['shift']());}};_0x3d36b9(++_0x301e64);}(_0x21b2,0x79));var _0x221b=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x21b2[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x221b('0x0'));var util=require(_0x221b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x221b('0x2'));var BPromise=require(_0x221b('0x3'));var rp=require(_0x221b('0x4'));var fs=require('fs');var path=require(_0x221b('0x5'));var rimraf=require(_0x221b('0x6'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module['exports']=function(_0x1c75e9,_0x55d8e7){return _0x1c75e9['define'](_0x221b('0x7'),attributes,{'tableName':_0x221b('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x221b('0x9')],'type':_0x221b('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56624b,_0x536cf2,_0x1d9e1b){var _0x267294=_0x1c75e9[_0x221b('0xb')];var _0x438104=_0x56624b[_0x221b('0xc')]({'plain':!![]});if(_0x438104[_0x221b('0xd')][_0x221b('0xe')]()==='in'||_0x438104['direction'][_0x221b('0xe')]()===_0x221b('0xf')&&!_0x438104['secret']&&!_[_0x221b('0x10')](_0x438104[_0x221b('0x11')])){_0x267294[_0x221b('0x12')][_0x221b('0x13')]({'where':{'id':_0x438104[_0x221b('0x14')]}})['then'](function(_0x34b6eb){if(_0x34b6eb){_0x34b6eb[_0x221b('0x15')]({'lastMsgAt':_0x438104[_0x221b('0x16')],'lastMsgDirection':_0x438104[_0x221b('0xd')][_0x221b('0xe')]()});}})[_0x221b('0x17')](function(_0x32678b){console[_0x221b('0x18')](_0x32678b);});}_0x1d9e1b();}},'charset':_0x221b('0x19'),'collate':_0x221b('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e27c4cf..1ed1325 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 _0x5439=['moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash'];(function(_0x403580,_0x353dd3){var _0x18f0cf=function(_0x3f5ee4){while(--_0x3f5ee4){_0x403580['push'](_0x403580['shift']());}};_0x18f0cf(++_0x353dd3);}(_0x5439,0x1ef));var _0x9543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5439[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9543('0x0'));var util=require('util');var moment=require(_0x9543('0x1'));var BPromise=require(_0x9543('0x2'));var rs=require(_0x9543('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9543('0x4'));var logger=require(_0x9543('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9543('0x6'));var client=jayson[_0x9543('0x7')][_0x9543('0x8')]({'port':0x232a});config[_0x9543('0x9')]=_[_0x9543('0xa')](config[_0x9543('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9543('0xb'))(new Redis(config[_0x9543('0x9')]));require(_0x9543('0xc'))['register'](socket);function respondWithRpcPromise(_0x2d62a1,_0x3ea8e6,_0x8c8b9f){return new BPromise(function(_0x496dec,_0x3cc885){return client[_0x9543('0xd')](_0x2d62a1,_0x8c8b9f)[_0x9543('0xe')](function(_0xfe3681){logger['info'](_0x9543('0xf'),_0x3ea8e6,_0x9543('0x10'));logger[_0x9543('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3ea8e6,_0x9543('0x10'),JSON[_0x9543('0x12')](_0xfe3681));if(_0xfe3681[_0x9543('0x13')]){if(_0xfe3681['error'][_0x9543('0x14')]===0x1f4){logger[_0x9543('0x13')](_0x9543('0xf'),_0x3ea8e6,_0xfe3681['error'][_0x9543('0x15')]);return _0x3cc885(_0xfe3681['error'][_0x9543('0x15')]);}logger[_0x9543('0x13')](_0x9543('0xf'),_0x3ea8e6,_0xfe3681[_0x9543('0x13')][_0x9543('0x15')]);return _0x496dec(_0xfe3681['error'][_0x9543('0x15')]);}else{logger[_0x9543('0x16')](_0x9543('0xf'),_0x3ea8e6,'request\x20sent');_0x496dec(_0xfe3681[_0x9543('0x17')][_0x9543('0x15')]);}})[_0x9543('0x18')](function(_0x2beae4){logger[_0x9543('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3ea8e6,_0x2beae4);_0x3cc885(_0x2beae4);});});}exports['CreateChatMessage']=function(_0x5d5df8){var _0x345ed9=this;return new Promise(function(_0x49a6c0,_0x589b41){return db[_0x9543('0x19')][_0x9543('0x1a')](_0x5d5df8[_0x9543('0x1b')],{'raw':_0x5d5df8['options']?_0x5d5df8[_0x9543('0x1c')][_0x9543('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x32a25c){logger[_0x9543('0x16')]('CreateChatMessage',_0x5d5df8);logger['debug']('CreateChatMessage',_0x5d5df8,JSON['stringify'](_0x32a25c));_0x49a6c0(_0x32a25c);})[_0x9543('0x18')](function(_0x3e8a47){logger[_0x9543('0x13')](_0x9543('0x1e'),_0x3e8a47[_0x9543('0x15')],_0x5d5df8);_0x589b41(_0x345ed9[_0x9543('0x13')](0x1f4,_0x3e8a47[_0x9543('0x15')]));});});}; \ No newline at end of file +var _0x651e=['defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x651e,0xf4));var _0xe651=function(_0x3ff23a,_0x2f2c43){_0x3ff23a=_0x3ff23a-0x0;var _0x2f4121=_0x651e[_0x3ff23a];return _0x2f4121;};'use strict';var _=require(_0xe651('0x0'));var util=require(_0xe651('0x1'));var moment=require(_0xe651('0x2'));var BPromise=require(_0xe651('0x3'));var rs=require(_0xe651('0x4'));var fs=require('fs');var Redis=require(_0xe651('0x5'));var db=require(_0xe651('0x6'))['db'];var utils=require(_0xe651('0x7'));var logger=require(_0xe651('0x8'))(_0xe651('0x9'));var config=require(_0xe651('0xa'));var jayson=require(_0xe651('0xb'));var client=jayson[_0xe651('0xc')][_0xe651('0xd')]({'port':0x232a});config[_0xe651('0xe')]=_[_0xe651('0xf')](config[_0xe651('0xe')],{'host':_0xe651('0x10'),'port':0x18eb});var socket=require(_0xe651('0x11'))(new Redis(config[_0xe651('0xe')]));require(_0xe651('0x12'))[_0xe651('0x13')](socket);function respondWithRpcPromise(_0x482da5,_0x350dd8,_0x498142){return new BPromise(function(_0xbbabe8,_0x15dac3){return client[_0xe651('0x14')](_0x482da5,_0x498142)[_0xe651('0x15')](function(_0x4f83bb){logger[_0xe651('0x16')]('ChatMessage,\x20%s,\x20%s',_0x350dd8,_0xe651('0x17'));logger['debug'](_0xe651('0x18'),_0x350dd8,_0xe651('0x17'),JSON[_0xe651('0x19')](_0x4f83bb));if(_0x4f83bb[_0xe651('0x1a')]){if(_0x4f83bb[_0xe651('0x1a')][_0xe651('0x1b')]===0x1f4){logger[_0xe651('0x1a')](_0xe651('0x1c'),_0x350dd8,_0x4f83bb[_0xe651('0x1a')]['message']);return _0x15dac3(_0x4f83bb[_0xe651('0x1a')]['message']);}logger[_0xe651('0x1a')](_0xe651('0x1c'),_0x350dd8,_0x4f83bb['error'][_0xe651('0x1d')]);return _0xbbabe8(_0x4f83bb[_0xe651('0x1a')]['message']);}else{logger[_0xe651('0x16')](_0xe651('0x1c'),_0x350dd8,_0xe651('0x17'));_0xbbabe8(_0x4f83bb[_0xe651('0x1e')][_0xe651('0x1d')]);}})['catch'](function(_0x12c9ac){logger['error'](_0xe651('0x1c'),_0x350dd8,_0x12c9ac);_0x15dac3(_0x12c9ac);});});}exports[_0xe651('0x1f')]=function(_0x2d2acc){var _0x75f9f=this;return new Promise(function(_0x5b368b,_0x39827d){return db[_0xe651('0x20')]['create'](_0x2d2acc['body'],{'raw':_0x2d2acc[_0xe651('0x21')]?_0x2d2acc[_0xe651('0x21')][_0xe651('0x22')]===undefined?!![]:![]:!![]})[_0xe651('0x15')](function(_0x4d553b){logger[_0xe651('0x16')]('CreateChatMessage',_0x2d2acc);logger[_0xe651('0x23')](_0xe651('0x1f'),_0x2d2acc,JSON['stringify'](_0x4d553b));_0x5b368b(_0x4d553b);})[_0xe651('0x24')](function(_0x3e6f1a){logger[_0xe651('0x1a')](_0xe651('0x1f'),_0x3e6f1a[_0xe651('0x1d')],_0x2d2acc);_0x39827d(_0x75f9f[_0xe651('0x1a')](0x1f4,_0x3e6f1a[_0xe651('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index db4886d..17a4d54 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 _0xee14=['length','chatMessage:','remove','update','emit','removeListener'];(function(_0x132b71,_0x25f23e){var _0x224664=function(_0x1f9e23){while(--_0x1f9e23){_0x132b71['push'](_0x132b71['shift']());}};_0x224664(++_0x25f23e);}(_0xee14,0x13a));var _0x4ee1=function(_0x1e3c5e,_0x5252b1){_0x1e3c5e=_0x1e3c5e-0x0;var _0x4d9e35=_0xee14[_0x1e3c5e];return _0x4d9e35;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4ee1('0x0'),_0x4ee1('0x1')];function createListener(_0x34e49d,_0x1fa407){return function(_0x18e3c4){_0x1fa407[_0x4ee1('0x2')](_0x34e49d,_0x18e3c4);};}function removeListener(_0x34a0ae,_0x1e5fb6){return function(){ChatMessageEvents[_0x4ee1('0x3')](_0x34a0ae,_0x1e5fb6);};}exports['register']=function(_0xba6d36){for(var _0x573700=0x0,_0x327c18=events[_0x4ee1('0x4')];_0x573700<_0x327c18;_0x573700++){var _0x187656=events[_0x573700];var _0x293d5f=createListener(_0x4ee1('0x5')+_0x187656,_0xba6d36);ChatMessageEvents['on'](_0x187656,_0x293d5f);}}; \ No newline at end of file +var _0xc23a=['save','remove','update','removeListener','register','length'];(function(_0x4d13a1,_0xc62b83){var _0x4e2e1b=function(_0x33a936){while(--_0x33a936){_0x4d13a1['push'](_0x4d13a1['shift']());}};_0x4e2e1b(++_0xc62b83);}(_0xc23a,0xd2));var _0xac23=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0xc23a[_0x6dfbaa];return _0xfbe02;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xac23('0x0'),_0xac23('0x1'),_0xac23('0x2')];function createListener(_0x58d1a2,_0x99f7dc){return function(_0x4e806e){_0x99f7dc['emit'](_0x58d1a2,_0x4e806e);};}function removeListener(_0x35c541,_0x4f104c){return function(){ChatMessageEvents[_0xac23('0x3')](_0x35c541,_0x4f104c);};}exports[_0xac23('0x4')]=function(_0xc71a6d){for(var _0x4c1482=0x0,_0x47b021=events[_0xac23('0x5')];_0x4c1482<_0x47b021;_0x4c1482++){var _0x3b6647=events[_0x4c1482];var _0x20342c=createListener('chatMessage:'+_0x3b6647,_0xc71a6d);ChatMessageEvents['on'](_0x3b6647,_0x20342c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 50c3e00..b30ed34 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 _0x10f9=['isAuthenticated','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x240167,_0x38a99c){var _0x292a01=function(_0x19710b){while(--_0x19710b){_0x240167['push'](_0x240167['shift']());}};_0x292a01(++_0x38a99c);}(_0x10f9,0x148));var _0x910f=function(_0x4adbdb,_0x3ff3c7){_0x4adbdb=_0x4adbdb-0x0;var _0x59966b=_0x10f9[_0x4adbdb];return _0x59966b;};'use strict';var multer=require(_0x910f('0x0'));var util=require('util');var path=require(_0x910f('0x1'));var timeout=require(_0x910f('0x2'));var express=require(_0x910f('0x3'));var router=express[_0x910f('0x4')]();var fs_extra=require(_0x910f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x910f('0x6'));var config=require(_0x910f('0x7'));var controller=require(_0x910f('0x8'));router[_0x910f('0x9')]('/',auth[_0x910f('0xa')](),controller['index']);router[_0x910f('0x9')]('/describe',auth[_0x910f('0xa')](),controller[_0x910f('0xb')]);router['get'](_0x910f('0xc'),auth[_0x910f('0xa')](),controller[_0x910f('0xd')]);router[_0x910f('0xe')]('/',auth[_0x910f('0xa')](),interaction[_0x910f('0xf')]('chat',_0x910f('0x10')),controller[_0x910f('0x11')]);router[_0x910f('0x12')]('/:id',controller[_0x910f('0x13')]);router[_0x910f('0x12')](_0x910f('0x14'),auth[_0x910f('0xa')](),controller['accept']);router['put'](_0x910f('0x15'),auth['isAuthenticated'](),controller[_0x910f('0x16')]);router[_0x910f('0x17')](_0x910f('0xc'),auth[_0x910f('0xa')](),controller[_0x910f('0x18')]);module[_0x910f('0x19')]=router; \ No newline at end of file +var _0x61a6=['/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61a6,0x170));var _0x661a=function(_0x2c2781,_0x5f1153){_0x2c2781=_0x2c2781-0x0;var _0x3fe469=_0x61a6[_0x2c2781];return _0x3fe469;};'use strict';var multer=require(_0x661a('0x0'));var util=require(_0x661a('0x1'));var path=require('path');var timeout=require(_0x661a('0x2'));var express=require(_0x661a('0x3'));var router=express[_0x661a('0x4')]();var fs_extra=require(_0x661a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x661a('0x6'));var config=require(_0x661a('0x7'));var controller=require('./chatMessage.controller');router[_0x661a('0x8')]('/',auth[_0x661a('0x9')](),controller[_0x661a('0xa')]);router[_0x661a('0x8')](_0x661a('0xb'),auth['isAuthenticated'](),controller[_0x661a('0xc')]);router[_0x661a('0x8')](_0x661a('0xd'),auth[_0x661a('0x9')](),controller['show']);router['post']('/',auth[_0x661a('0x9')](),interaction[_0x661a('0xe')](_0x661a('0xf'),_0x661a('0x10')),controller[_0x661a('0x11')]);router[_0x661a('0x12')](_0x661a('0xd'),controller[_0x661a('0x13')]);router[_0x661a('0x12')](_0x661a('0x14'),auth[_0x661a('0x9')](),controller[_0x661a('0x15')]);router[_0x661a('0x12')](_0x661a('0x16'),auth[_0x661a('0x9')](),controller[_0x661a('0x17')]);router[_0x661a('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x661a('0x19')]);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 cb4c6d2..e36dbee 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 _0x757a=['exports','TEXT'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x757a,0xde));var _0xa757=function(_0x31df51,_0x2d54b4){_0x31df51=_0x31df51-0x0;var _0x1d3e0e=_0x757a[_0x31df51];return _0x1d3e0e;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0b0e,0x187));var _0xe0b0=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x0b0e[_0x544099];return _0x20ab09;};'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 571faac..cd7c725 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(_0x2cca5d,_0x117d96){var _0x507c48=function(_0x255c38){while(--_0x255c38){_0x2cca5d['push'](_0x2cca5d['shift']());}};_0x507c48(++_0x117d96);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _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(_0x1eba61,_0x4782ec){var _0x409420=function(_0x5682b8){while(--_0x5682b8){_0x1eba61['push'](_0x1eba61['shift']());}};_0x409420(++_0x4782ec);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 5553fbe..40d1f85 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 _0x33de=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x3f5155,_0x13cc8f){var _0x5a8d5a=function(_0x3a47d1){while(--_0x3a47d1){_0x3f5155['push'](_0x3f5155['shift']());}};_0x5a8d5a(++_0x13cc8f);}(_0x33de,0x14b));var _0xe33d=function(_0x59820d,_0xc8e6ba){_0x59820d=_0x59820d-0x0;var _0x3c72b1=_0x33de[_0x59820d];return _0x3c72b1;};'use strict';var EventEmitter=require(_0xe33d('0x0'));var ChatOfflineMessage=require(_0xe33d('0x1'))['db'][_0xe33d('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe33d('0x3')](0x0);var events={'afterCreate':_0xe33d('0x4'),'afterUpdate':_0xe33d('0x5'),'afterDestroy':_0xe33d('0x6')};function emitEvent(_0x3bd5ec){return function(_0x84395f,_0x451e5a,_0xb4d96){ChatOfflineMessageEvents['emit'](_0x3bd5ec+':'+_0x84395f['id'],_0x84395f);ChatOfflineMessageEvents[_0xe33d('0x7')](_0x3bd5ec,_0x84395f);_0xb4d96(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xe33d('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa43b=['hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xae0c01,_0x449c99){var _0x913e86=function(_0x421e87){while(--_0x421e87){_0xae0c01['push'](_0xae0c01['shift']());}};_0x913e86(++_0x449c99);}(_0xa43b,0x12e));var _0xba43=function(_0xcc8729,_0x57b762){_0xcc8729=_0xcc8729-0x0;var _0xbbcdba=_0xa43b[_0xcc8729];return _0xbbcdba;};'use strict';var EventEmitter=require(_0xba43('0x0'));var ChatOfflineMessage=require(_0xba43('0x1'))['db'][_0xba43('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xba43('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xba43('0x4'),'afterDestroy':_0xba43('0x5')};function emitEvent(_0x9389a2){return function(_0xa51767,_0x11a38a,_0x56564a){ChatOfflineMessageEvents[_0xba43('0x6')](_0x9389a2+':'+_0xa51767['id'],_0xa51767);ChatOfflineMessageEvents[_0xba43('0x6')](_0x9389a2,_0xa51767);_0x56564a(null);};}for(var e in events){if(events[_0xba43('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xba43('0x8')](e,emitEvent(event));}}module[_0xba43('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 615f64b..439bdd1 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 _0x5c70=['ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes','exports','define'];(function(_0x3439bc,_0xc03879){var _0x484801=function(_0x39d69f){while(--_0x39d69f){_0x3439bc['push'](_0x3439bc['shift']());}};_0x484801(++_0xc03879);}(_0x5c70,0x11f));var _0x05c7=function(_0x3ac76f,_0x46494c){_0x3ac76f=_0x3ac76f-0x0;var _0x178ae0=_0x5c70[_0x3ac76f];return _0x178ae0;};'use strict';var attributes=require(_0x05c7('0x0'));module[_0x05c7('0x1')]=function(_0x463380){return _0x463380[_0x05c7('0x2')](_0x05c7('0x3'),attributes,{'tableName':_0x05c7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd1d9=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x31d6ed,_0x40d038){var _0x3d7b47=function(_0x2f3d10){while(--_0x2f3d10){_0x31d6ed['push'](_0x31d6ed['shift']());}};_0x3d7b47(++_0x40d038);}(_0xd1d9,0x95));var _0x9d1d=function(_0x34d559,_0xc30b58){_0x34d559=_0x34d559-0x0;var _0x2112a5=_0xd1d9[_0x34d559];return _0x2112a5;};'use strict';var attributes=require(_0x9d1d('0x0'));module[_0x9d1d('0x1')]=function(_0x3ae780){return _0x3ae780['define'](_0x9d1d('0x2'),attributes,{'tableName':_0x9d1d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d1d('0x4'),'collate':_0x9d1d('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7f014c1..e67f092 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 _0x6408=['jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1b6f54,_0x17109a){var _0x5ae1c9=function(_0x384a94){while(--_0x384a94){_0x1b6f54['push'](_0x1b6f54['shift']());}};_0x5ae1c9(++_0x17109a);}(_0x6408,0x194));var _0x8640=function(_0x46608c,_0x4bb7a2){_0x46608c=_0x46608c-0x0;var _0x168a0c=_0x6408[_0x46608c];return _0x168a0c;};'use strict';var _=require(_0x8640('0x0'));var util=require(_0x8640('0x1'));var moment=require(_0x8640('0x2'));var BPromise=require(_0x8640('0x3'));var rs=require(_0x8640('0x4'));var fs=require('fs');var Redis=require(_0x8640('0x5'));var db=require(_0x8640('0x6'))['db'];var utils=require(_0x8640('0x7'));var logger=require(_0x8640('0x8'))(_0x8640('0x9'));var config=require('../../config/environment');var jayson=require(_0x8640('0xa'));var client=jayson[_0x8640('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9083,_0x44d634,_0x52c497){return new BPromise(function(_0x40b941,_0x5113d8){return client['request'](_0x1b9083,_0x52c497)[_0x8640('0xc')](function(_0x590034){logger[_0x8640('0xd')](_0x8640('0xe'),_0x44d634,'request\x20sent');logger[_0x8640('0xf')](_0x8640('0x10'),_0x44d634,_0x8640('0x11'),JSON[_0x8640('0x12')](_0x590034));if(_0x590034[_0x8640('0x13')]){if(_0x590034[_0x8640('0x13')]['code']===0x1f4){logger['error'](_0x8640('0xe'),_0x44d634,_0x590034[_0x8640('0x13')][_0x8640('0x14')]);return _0x5113d8(_0x590034[_0x8640('0x13')]['message']);}logger[_0x8640('0x13')](_0x8640('0xe'),_0x44d634,_0x590034[_0x8640('0x13')][_0x8640('0x14')]);return _0x40b941(_0x590034[_0x8640('0x13')][_0x8640('0x14')]);}else{logger['info'](_0x8640('0xe'),_0x44d634,_0x8640('0x11'));_0x40b941(_0x590034[_0x8640('0x15')][_0x8640('0x14')]);}})[_0x8640('0x16')](function(_0x15ac1b){logger['error'](_0x8640('0xe'),_0x44d634,_0x15ac1b);_0x5113d8(_0x15ac1b);});});} \ No newline at end of file +var _0x7d3b=['error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x7d3b,0x1d9));var _0xb7d3=function(_0x1c7edd,_0x12d0aa){_0x1c7edd=_0x1c7edd-0x0;var _0x488159=_0x7d3b[_0x1c7edd];return _0x488159;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb7d3('0x0'));var rs=require(_0xb7d3('0x1'));var fs=require('fs');var Redis=require(_0xb7d3('0x2'));var db=require(_0xb7d3('0x3'))['db'];var utils=require(_0xb7d3('0x4'));var logger=require(_0xb7d3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb7d3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xb0bbac,_0x3d2784,_0x8a2a73){return new BPromise(function(_0x256ff8,_0x505e0b){return client[_0xb7d3('0x7')](_0xb0bbac,_0x8a2a73)[_0xb7d3('0x8')](function(_0x3bb91c){logger[_0xb7d3('0x9')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3d2784,'request\x20sent');logger['debug'](_0xb7d3('0xa'),_0x3d2784,_0xb7d3('0xb'),JSON[_0xb7d3('0xc')](_0x3bb91c));if(_0x3bb91c[_0xb7d3('0xd')]){if(_0x3bb91c[_0xb7d3('0xd')][_0xb7d3('0xe')]===0x1f4){logger[_0xb7d3('0xd')](_0xb7d3('0xf'),_0x3d2784,_0x3bb91c['error'][_0xb7d3('0x10')]);return _0x505e0b(_0x3bb91c[_0xb7d3('0xd')][_0xb7d3('0x10')]);}logger['error'](_0xb7d3('0xf'),_0x3d2784,_0x3bb91c[_0xb7d3('0xd')][_0xb7d3('0x10')]);return _0x256ff8(_0x3bb91c[_0xb7d3('0xd')][_0xb7d3('0x10')]);}else{logger['info'](_0xb7d3('0xf'),_0x3d2784,_0xb7d3('0xb'));_0x256ff8(_0x3bb91c[_0xb7d3('0x11')][_0xb7d3('0x10')]);}})['catch'](function(_0x3c9249){logger[_0xb7d3('0xd')](_0xb7d3('0xf'),_0x3d2784,_0x3c9249);_0x505e0b(_0x3c9249);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3ddb88c..27eb4d0 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 _0x656b=['fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','create','update','destroy','multer','connect-timeout','Router'];(function(_0x1aa883,_0x50f53b){var _0x5e9fb5=function(_0x5558f1){while(--_0x5558f1){_0x1aa883['push'](_0x1aa883['shift']());}};_0x5e9fb5(++_0x50f53b);}(_0x656b,0x1dd));var _0xb656=function(_0x14e1da,_0x2d21d2){_0x14e1da=_0x14e1da-0x0;var _0x411d1d=_0x656b[_0x14e1da];return _0x411d1d;};'use strict';var multer=require(_0xb656('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb656('0x1'));var express=require('express');var router=express[_0xb656('0x2')]();var fs_extra=require(_0xb656('0x3'));var auth=require(_0xb656('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb656('0x5'));var controller=require(_0xb656('0x6'));router[_0xb656('0x7')]('/',auth[_0xb656('0x8')](),controller['index']);router['get'](_0xb656('0x9'),auth[_0xb656('0x8')](),controller[_0xb656('0xa')]);router[_0xb656('0x7')](_0xb656('0xb'),auth[_0xb656('0x8')](),controller['show']);router['post']('/',auth[_0xb656('0x8')](),controller[_0xb656('0xc')]);router['put'](_0xb656('0xb'),auth['isAuthenticated'](),controller[_0xb656('0xd')]);router['delete'](_0xb656('0xb'),auth[_0xb656('0x8')](),controller[_0xb656('0xe')]);module['exports']=router; \ No newline at end of file +var _0xaf19=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x5844cf,_0x2093ed){var _0x390b71=function(_0x3c7e98){while(--_0x3c7e98){_0x5844cf['push'](_0x5844cf['shift']());}};_0x390b71(++_0x2093ed);}(_0xaf19,0x6f));var _0x9af1=function(_0x614499,_0x3143ee){_0x614499=_0x614499-0x0;var _0x1a6aa6=_0xaf19[_0x614499];return _0x1a6aa6;};'use strict';var multer=require(_0x9af1('0x0'));var util=require(_0x9af1('0x1'));var path=require(_0x9af1('0x2'));var timeout=require(_0x9af1('0x3'));var express=require(_0x9af1('0x4'));var router=express[_0x9af1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9af1('0x6'));var config=require('../../config/environment');var controller=require(_0x9af1('0x7'));router[_0x9af1('0x8')]('/',auth[_0x9af1('0x9')](),controller['index']);router[_0x9af1('0x8')](_0x9af1('0xa'),auth[_0x9af1('0x9')](),controller[_0x9af1('0xb')]);router[_0x9af1('0x8')](_0x9af1('0xc'),auth[_0x9af1('0x9')](),controller[_0x9af1('0xd')]);router[_0x9af1('0xe')]('/',auth[_0x9af1('0x9')](),controller[_0x9af1('0xf')]);router[_0x9af1('0x10')](_0x9af1('0xc'),auth[_0x9af1('0x9')](),controller[_0x9af1('0x11')]);router[_0x9af1('0x12')](_0x9af1('0xc'),auth['isAuthenticated'](),controller[_0x9af1('0x13')]);module[_0x9af1('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ab674bf..32f5e25 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 _0xa7a6=['STRING','timeout','mouseOver','INTEGER','exports'];(function(_0x246464,_0x1f0b14){var _0x26eb18=function(_0x7721b3){while(--_0x7721b3){_0x246464['push'](_0x246464['shift']());}};_0x26eb18(++_0x1f0b14);}(_0xa7a6,0x19e));var _0x6a7a=function(_0x28e196,_0x55ea66){_0x28e196=_0x28e196-0x0;var _0xebe98e=_0xa7a6[_0x28e196];return _0xebe98e;};'use strict';var Sequelize=require('sequelize');module[_0x6a7a('0x0')]={'name':{'type':Sequelize[_0x6a7a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x6a7a('0x2')),'defaultValue':_0x6a7a('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6a7a('0x4')]}}; \ No newline at end of file +var _0x2aaf=['STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x543c29,_0x5d2414){var _0x1c292e=function(_0x228a18){while(--_0x228a18){_0x543c29['push'](_0x543c29['shift']());}};_0x1c292e(++_0x5d2414);}(_0x2aaf,0x158));var _0xf2aa=function(_0x37e046,_0x961867){_0x37e046=_0x37e046-0x0;var _0x50fd79=_0x2aaf[_0x37e046];return _0x50fd79;};'use strict';var Sequelize=require(_0xf2aa('0x0'));module['exports']={'name':{'type':Sequelize[_0xf2aa('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf2aa('0x2')](_0xf2aa('0x3'),_0xf2aa('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xf2aa('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3496fb2..b2161dc 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 _0x1134=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv'];(function(_0x5edcd8,_0xd8a6ca){var _0x2263cc=function(_0x17df45){while(--_0x17df45){_0x5edcd8['push'](_0x5edcd8['shift']());}};_0x2263cc(++_0xd8a6ca);}(_0x1134,0x19c));var _0x4113=function(_0x364cdd,_0x15c213){_0x364cdd=_0x364cdd-0x0;var _0x6fb254=_0x1134[_0x364cdd];return _0x6fb254;};'use strict';var emlformat=require(_0x4113('0x0'));var rimraf=require(_0x4113('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4113('0x2'));var rp=require(_0x4113('0x3'));var moment=require('moment');var BPromise=require(_0x4113('0x4'));var Mustache=require(_0x4113('0x5'));var util=require('util');var path=require(_0x4113('0x6'));var sox=require('sox');var csv=require(_0x4113('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4113('0x8'));var _=require('lodash');var squel=require(_0x4113('0x9'));var crypto=require(_0x4113('0xa'));var jsforce=require(_0x4113('0xb'));var deskjs=require(_0x4113('0xc'));var toCsv=require(_0x4113('0x7'));var querystring=require(_0x4113('0xd'));var Papa=require(_0x4113('0xe'));var Redis=require(_0x4113('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4113('0x10'));var as=require(_0x4113('0x11'));var hardwareService=require(_0x4113('0x12'));var logger=require(_0x4113('0x13'))(_0x4113('0x14'));var utils=require(_0x4113('0x15'));var config=require(_0x4113('0x16'));var licenseUtil=require(_0x4113('0x17'));var db=require(_0x4113('0x18'))['db'];function respondWithStatusCode(_0x457d3f,_0x53720f){_0x53720f=_0x53720f||0xcc;return function(_0x48b14c){if(_0x48b14c){return _0x457d3f['sendStatus'](_0x53720f);}return _0x457d3f[_0x4113('0x19')](_0x53720f)[_0x4113('0x1a')]();};}function respondWithResult(_0x4ba7ce,_0x567e69){_0x567e69=_0x567e69||0xc8;return function(_0x40f01e){if(_0x40f01e){return _0x4ba7ce['status'](_0x567e69)[_0x4113('0x1b')](_0x40f01e);}};}function respondWithFilteredResult(_0x5ab2a7,_0x59f69b){return function(_0xcdfdd){if(_0xcdfdd){var _0xe88992=typeof _0x59f69b[_0x4113('0x1c')]===_0x4113('0x1d')&&typeof _0x59f69b[_0x4113('0x1e')]===_0x4113('0x1d');var _0x405849=_0xcdfdd[_0x4113('0x1f')];var _0x1051d4=_0xe88992?0x0:_0x59f69b[_0x4113('0x1c')];var _0x59b821=_0xe88992?_0xcdfdd[_0x4113('0x1f')]:_0x59f69b[_0x4113('0x1c')]+_0x59f69b[_0x4113('0x1e')];var _0x1d40ba;if(_0x59b821>=_0x405849){_0x59b821=_0x405849;_0x1d40ba=0xc8;}else{_0x1d40ba=0xce;}_0x5ab2a7[_0x4113('0x19')](_0x1d40ba);return _0x5ab2a7[_0x4113('0x20')](_0x4113('0x21'),_0x1051d4+'-'+_0x59b821+'/'+_0x405849)[_0x4113('0x1b')](_0xcdfdd);}return null;};}function patchUpdates(_0x37bf1e){return function(_0x57540a){try{jsonpatch[_0x4113('0x22')](_0x57540a,_0x37bf1e,!![]);}catch(_0x2776a6){return BPromise['reject'](_0x2776a6);}return _0x57540a['save']();};}function saveUpdates(_0x11deb0,_0x49c72f){return function(_0x149d1a){if(_0x149d1a){return _0x149d1a[_0x4113('0x23')](_0x11deb0)[_0x4113('0x24')](function(_0x5a85be){return _0x5a85be;});}return null;};}function removeEntity(_0x12f1fe,_0x16b16c){return function(_0x349b33){if(_0x349b33){return _0x349b33[_0x4113('0x25')]()[_0x4113('0x24')](function(){_0x12f1fe[_0x4113('0x19')](0xcc)[_0x4113('0x1a')]();});}};}function handleEntityNotFound(_0x1c498a,_0x122102){return function(_0xc73743){if(!_0xc73743){_0x1c498a[_0x4113('0x26')](0x194);}return _0xc73743;};}function handleError(_0x2a014b,_0x56c343){_0x56c343=_0x56c343||0x1f4;return function(_0x44b317){logger[_0x4113('0x27')](_0x44b317['stack']);if(_0x44b317[_0x4113('0x28')]){delete _0x44b317[_0x4113('0x28')];}_0x2a014b[_0x4113('0x19')](_0x56c343)[_0x4113('0x29')](_0x44b317);};}exports[_0x4113('0x2a')]=function(_0x180fed,_0x234543){var _0x134a04={'raw':!![],'where':{'id':_0x180fed[_0x4113('0x2b')]['id']}},_0x3f063f={};_0x3f063f[_0x4113('0x2c')]=_[_0x4113('0x2d')](db[_0x4113('0x2e')][_0x4113('0x2f')]);_0x3f063f['query']=_[_0x4113('0x2d')](_0x180fed[_0x4113('0x30')]);_0x3f063f['filters']=_[_0x4113('0x31')](_0x3f063f[_0x4113('0x2c')],_0x3f063f[_0x4113('0x30')]);_0x134a04[_0x4113('0x32')]=_['intersection'](_0x3f063f[_0x4113('0x2c')],qs[_0x4113('0x33')](_0x180fed[_0x4113('0x30')][_0x4113('0x33')]));_0x134a04[_0x4113('0x32')]=_0x134a04[_0x4113('0x32')][_0x4113('0x34')]?_0x134a04[_0x4113('0x32')]:_0x3f063f[_0x4113('0x2c')];if(_0x180fed['query'][_0x4113('0x35')]){_0x134a04['include']=[{'all':!![]}];}_0x134a04=_[_0x4113('0x36')]({},_0x134a04,_0x180fed[_0x4113('0x37')]);return db[_0x4113('0x2e')][_0x4113('0x38')](_0x134a04)[_0x4113('0x24')](handleEntityNotFound(_0x234543,null))[_0x4113('0x24')](respondWithResult(_0x234543,null))['catch'](handleError(_0x234543,null));};exports[_0x4113('0x39')]=function(_0x56ad93,_0x397fcd){return db[_0x4113('0x2e')][_0x4113('0x39')](_0x56ad93['body'],{})[_0x4113('0x24')](respondWithResult(_0x397fcd,0xc9))['catch'](handleError(_0x397fcd,null));};exports[_0x4113('0x23')]=function(_0x580434,_0x13d161){if(_0x580434[_0x4113('0x3a')]['id']){delete _0x580434['body']['id'];}return db['ChatProactiveAction'][_0x4113('0x38')]({'where':{'id':_0x580434[_0x4113('0x2b')]['id']}})[_0x4113('0x24')](handleEntityNotFound(_0x13d161,null))['then'](saveUpdates(_0x580434['body'],null))[_0x4113('0x24')](respondWithResult(_0x13d161,null))[_0x4113('0x3b')](handleError(_0x13d161,null));};exports[_0x4113('0x25')]=function(_0xed3af2,_0xa50de0){return db['ChatProactiveAction'][_0x4113('0x38')]({'where':{'id':_0xed3af2[_0x4113('0x2b')]['id']}})[_0x4113('0x24')](handleEntityNotFound(_0xa50de0,null))['then'](removeEntity(_0xa50de0,null))[_0x4113('0x3b')](handleError(_0xa50de0,null));}; \ No newline at end of file +var _0x4ce6=['../../mysqldb','end','status','json','offset','count','limit','apply','reject','save','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','fields','attributes','includeAll','include','merge','find','catch','body','update','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','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'];(function(_0x4cd0ba,_0xf219f7){var _0x29fc75=function(_0x5666f6){while(--_0x5666f6){_0x4cd0ba['push'](_0x4cd0ba['shift']());}};_0x29fc75(++_0xf219f7);}(_0x4ce6,0x108));var _0x64ce=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x4ce6[_0x5e36d1];return _0x950b9e;};'use strict';var emlformat=require(_0x64ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64ce('0x1'));var jsonpatch=require(_0x64ce('0x2'));var rp=require(_0x64ce('0x3'));var moment=require(_0x64ce('0x4'));var BPromise=require(_0x64ce('0x5'));var Mustache=require(_0x64ce('0x6'));var util=require('util');var path=require(_0x64ce('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x64ce('0x8'));var fs=require('fs');var fs_extra=require(_0x64ce('0x9'));var _=require('lodash');var squel=require(_0x64ce('0xa'));var crypto=require(_0x64ce('0xb'));var jsforce=require(_0x64ce('0xc'));var deskjs=require(_0x64ce('0xd'));var toCsv=require(_0x64ce('0xe'));var querystring=require(_0x64ce('0xf'));var Papa=require(_0x64ce('0x10'));var Redis=require(_0x64ce('0x11'));var authService=require(_0x64ce('0x12'));var qs=require(_0x64ce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64ce('0x14'));var logger=require(_0x64ce('0x15'))(_0x64ce('0x16'));var utils=require(_0x64ce('0x17'));var config=require(_0x64ce('0x18'));var licenseUtil=require(_0x64ce('0x19'));var db=require(_0x64ce('0x1a'))['db'];function respondWithStatusCode(_0x321f24,_0x4dbb9e){_0x4dbb9e=_0x4dbb9e||0xcc;return function(_0x17be05){if(_0x17be05){return _0x321f24['sendStatus'](_0x4dbb9e);}return _0x321f24['status'](_0x4dbb9e)[_0x64ce('0x1b')]();};}function respondWithResult(_0x498d55,_0xedcfa5){_0xedcfa5=_0xedcfa5||0xc8;return function(_0x22e852){if(_0x22e852){return _0x498d55[_0x64ce('0x1c')](_0xedcfa5)[_0x64ce('0x1d')](_0x22e852);}};}function respondWithFilteredResult(_0x3579a3,_0x235a82){return function(_0x476a31){if(_0x476a31){var _0x42df9a=typeof _0x235a82[_0x64ce('0x1e')]==='undefined'&&typeof _0x235a82['limit']==='undefined';var _0x3eca89=_0x476a31[_0x64ce('0x1f')];var _0x1f6fd4=_0x42df9a?0x0:_0x235a82[_0x64ce('0x1e')];var _0x38d441=_0x42df9a?_0x476a31[_0x64ce('0x1f')]:_0x235a82[_0x64ce('0x1e')]+_0x235a82[_0x64ce('0x20')];var _0xafcce4;if(_0x38d441>=_0x3eca89){_0x38d441=_0x3eca89;_0xafcce4=0xc8;}else{_0xafcce4=0xce;}_0x3579a3[_0x64ce('0x1c')](_0xafcce4);return _0x3579a3['set']('Content-Range',_0x1f6fd4+'-'+_0x38d441+'/'+_0x3eca89)[_0x64ce('0x1d')](_0x476a31);}return null;};}function patchUpdates(_0x17a36b){return function(_0x4f8dc2){try{jsonpatch[_0x64ce('0x21')](_0x4f8dc2,_0x17a36b,!![]);}catch(_0x3a8d29){return BPromise[_0x64ce('0x22')](_0x3a8d29);}return _0x4f8dc2[_0x64ce('0x23')]();};}function saveUpdates(_0x2b5f89,_0x1aa495){return function(_0x34a7f7){if(_0x34a7f7){return _0x34a7f7['update'](_0x2b5f89)[_0x64ce('0x24')](function(_0x36c332){return _0x36c332;});}return null;};}function removeEntity(_0x4f9107,_0x1aec1f){return function(_0x9729cf){if(_0x9729cf){return _0x9729cf['destroy']()[_0x64ce('0x24')](function(){_0x4f9107[_0x64ce('0x1c')](0xcc)[_0x64ce('0x1b')]();});}};}function handleEntityNotFound(_0x33feb3,_0x2826f6){return function(_0x2e941c){if(!_0x2e941c){_0x33feb3['sendStatus'](0x194);}return _0x2e941c;};}function handleError(_0x618946,_0x3b77c7){_0x3b77c7=_0x3b77c7||0x1f4;return function(_0x5415de){logger[_0x64ce('0x25')](_0x5415de[_0x64ce('0x26')]);if(_0x5415de['name']){delete _0x5415de[_0x64ce('0x27')];}_0x618946[_0x64ce('0x1c')](_0x3b77c7)[_0x64ce('0x28')](_0x5415de);};}exports['show']=function(_0x24181c,_0x1fd112){var _0x23d5a0={'raw':!![],'where':{'id':_0x24181c[_0x64ce('0x29')]['id']}},_0x3e7a52={};_0x3e7a52[_0x64ce('0x2a')]=_[_0x64ce('0x2b')](db[_0x64ce('0x2c')][_0x64ce('0x2d')]);_0x3e7a52[_0x64ce('0x2e')]=_[_0x64ce('0x2b')](_0x24181c[_0x64ce('0x2e')]);_0x3e7a52['filters']=_[_0x64ce('0x2f')](_0x3e7a52['model'],_0x3e7a52[_0x64ce('0x2e')]);_0x23d5a0['attributes']=_[_0x64ce('0x2f')](_0x3e7a52['model'],qs[_0x64ce('0x30')](_0x24181c['query']['fields']));_0x23d5a0['attributes']=_0x23d5a0[_0x64ce('0x31')]['length']?_0x23d5a0['attributes']:_0x3e7a52[_0x64ce('0x2a')];if(_0x24181c[_0x64ce('0x2e')][_0x64ce('0x32')]){_0x23d5a0[_0x64ce('0x33')]=[{'all':!![]}];}_0x23d5a0=_[_0x64ce('0x34')]({},_0x23d5a0,_0x24181c['options']);return db[_0x64ce('0x2c')][_0x64ce('0x35')](_0x23d5a0)[_0x64ce('0x24')](handleEntityNotFound(_0x1fd112,null))[_0x64ce('0x24')](respondWithResult(_0x1fd112,null))[_0x64ce('0x36')](handleError(_0x1fd112,null));};exports['create']=function(_0x3b9d90,_0x1bf7ec){return db[_0x64ce('0x2c')]['create'](_0x3b9d90[_0x64ce('0x37')],{})[_0x64ce('0x24')](respondWithResult(_0x1bf7ec,0xc9))[_0x64ce('0x36')](handleError(_0x1bf7ec,null));};exports[_0x64ce('0x38')]=function(_0x12ecea,_0x1bb5fb){if(_0x12ecea[_0x64ce('0x37')]['id']){delete _0x12ecea[_0x64ce('0x37')]['id'];}return db['ChatProactiveAction'][_0x64ce('0x35')]({'where':{'id':_0x12ecea['params']['id']}})['then'](handleEntityNotFound(_0x1bb5fb,null))[_0x64ce('0x24')](saveUpdates(_0x12ecea['body'],null))[_0x64ce('0x24')](respondWithResult(_0x1bb5fb,null))[_0x64ce('0x36')](handleError(_0x1bb5fb,null));};exports[_0x64ce('0x39')]=function(_0x50773a,_0x3460ae){return db[_0x64ce('0x2c')]['find']({'where':{'id':_0x50773a[_0x64ce('0x29')]['id']}})['then'](handleEntityNotFound(_0x3460ae,null))[_0x64ce('0x24')](removeEntity(_0x3460ae,null))[_0x64ce('0x36')](handleError(_0x3460ae,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 799846e..12ffe6c 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 _0x8d5a=['bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment'];(function(_0x10cc9f,_0x5d40a5){var _0x392aaa=function(_0x2f0e7b){while(--_0x2f0e7b){_0x10cc9f['push'](_0x10cc9f['shift']());}};_0x392aaa(++_0x5d40a5);}(_0x8d5a,0x67));var _0xa8d5=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x8d5a[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xa8d5('0x0'));var util=require(_0xa8d5('0x1'));var logger=require(_0xa8d5('0x2'))(_0xa8d5('0x3'));var moment=require(_0xa8d5('0x4'));var BPromise=require(_0xa8d5('0x5'));var rp=require(_0xa8d5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8d5('0x7'));var config=require(_0xa8d5('0x8'));var attributes=require(_0xa8d5('0x9'));module[_0xa8d5('0xa')]=function(_0x1ffe07,_0x45bb52){return _0x1ffe07['define'](_0xa8d5('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c93=['chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction'];(function(_0xb0cf,_0x3b98c6){var _0x5258ba=function(_0x1f975c){while(--_0x1f975c){_0xb0cf['push'](_0xb0cf['shift']());}};_0x5258ba(++_0x3b98c6);}(_0x5c93,0x194));var _0x35c9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5c93[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x35c9('0x0'));var logger=require(_0x35c9('0x1'))(_0x35c9('0x2'));var moment=require(_0x35c9('0x3'));var BPromise=require(_0x35c9('0x4'));var rp=require(_0x35c9('0x5'));var fs=require('fs');var path=require(_0x35c9('0x6'));var rimraf=require(_0x35c9('0x7'));var config=require(_0x35c9('0x8'));var attributes=require(_0x35c9('0x9'));module[_0x35c9('0xa')]=function(_0x149df5,_0x1c013d){return _0x149df5['define'](_0x35c9('0xb'),attributes,{'tableName':_0x35c9('0xc'),'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 060f43c..e4abc03 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 _0xc7f3=['then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xc7f3,0x1c1));var _0x3c7f=function(_0x22205c,_0x473493){_0x22205c=_0x22205c-0x0;var _0x3f5efe=_0xc7f3[_0x22205c];return _0x3f5efe;};'use strict';var _=require(_0x3c7f('0x0'));var util=require(_0x3c7f('0x1'));var moment=require(_0x3c7f('0x2'));var BPromise=require(_0x3c7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c7f('0x4'))['db'];var utils=require(_0x3c7f('0x5'));var logger=require(_0x3c7f('0x6'))(_0x3c7f('0x7'));var config=require(_0x3c7f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c7f('0x9')][_0x3c7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa8a8e5,_0xd237fc,_0x46cffb){return new BPromise(function(_0x3fdd3f,_0x11dd9f){return client['request'](_0xa8a8e5,_0x46cffb)[_0x3c7f('0xb')](function(_0x3c7e0c){logger['info'](_0x3c7f('0xc'),_0xd237fc,_0x3c7f('0xd'));logger[_0x3c7f('0xe')](_0x3c7f('0xf'),_0xd237fc,_0x3c7f('0xd'),JSON[_0x3c7f('0x10')](_0x3c7e0c));if(_0x3c7e0c[_0x3c7f('0x11')]){if(_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x12')]===0x1f4){logger[_0x3c7f('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0xd237fc,_0x3c7e0c[_0x3c7f('0x11')]['message']);return _0x11dd9f(_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x13')]);}logger[_0x3c7f('0x11')](_0x3c7f('0xc'),_0xd237fc,_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x13')]);return _0x3fdd3f(_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x13')]);}else{logger[_0x3c7f('0x14')](_0x3c7f('0xc'),_0xd237fc,_0x3c7f('0xd'));_0x3fdd3f(_0x3c7e0c[_0x3c7f('0x15')]['message']);}})[_0x3c7f('0x16')](function(_0x84265){logger[_0x3c7f('0x11')](_0x3c7f('0xc'),_0xd237fc,_0x84265);_0x11dd9f(_0x84265);});});} \ No newline at end of file +var _0x49d7=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird'];(function(_0x53816b,_0x2f9ba3){var _0x7f2259=function(_0x351304){while(--_0x351304){_0x53816b['push'](_0x53816b['shift']());}};_0x7f2259(++_0x2f9ba3);}(_0x49d7,0x1f4));var _0x749d=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x49d7[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0x749d('0x0'));var util=require(_0x749d('0x1'));var moment=require(_0x749d('0x2'));var BPromise=require(_0x749d('0x3'));var rs=require(_0x749d('0x4'));var fs=require('fs');var Redis=require(_0x749d('0x5'));var db=require(_0x749d('0x6'))['db'];var utils=require(_0x749d('0x7'));var logger=require('../../config/logger')(_0x749d('0x8'));var config=require(_0x749d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x749d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3311fc,_0x3f189c,_0x284eae){return new BPromise(function(_0x4eaa25,_0x459569){return client[_0x749d('0xb')](_0x3311fc,_0x284eae)[_0x749d('0xc')](function(_0x4e1c6c){logger[_0x749d('0xd')](_0x749d('0xe'),_0x3f189c,_0x749d('0xf'));logger[_0x749d('0x10')](_0x749d('0x11'),_0x3f189c,_0x749d('0xf'),JSON['stringify'](_0x4e1c6c));if(_0x4e1c6c[_0x749d('0x12')]){if(_0x4e1c6c[_0x749d('0x12')]['code']===0x1f4){logger[_0x749d('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x3f189c,_0x4e1c6c['error'][_0x749d('0x13')]);return _0x459569(_0x4e1c6c['error']['message']);}logger[_0x749d('0x12')](_0x749d('0xe'),_0x3f189c,_0x4e1c6c['error'][_0x749d('0x13')]);return _0x4eaa25(_0x4e1c6c[_0x749d('0x12')][_0x749d('0x13')]);}else{logger['info'](_0x749d('0xe'),_0x3f189c,_0x749d('0xf'));_0x4eaa25(_0x4e1c6c['result'][_0x749d('0x13')]);}})[_0x749d('0x14')](function(_0xf0079a){logger['error'](_0x749d('0xe'),_0x3f189c,_0xf0079a);_0x459569(_0xf0079a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 03adb85..f5f7a10 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 _0x7217=['Router','fs-extra','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x43023c,_0x53062e){var _0x8c0d9a=function(_0x144ead){while(--_0x144ead){_0x43023c['push'](_0x43023c['shift']());}};_0x8c0d9a(++_0x53062e);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0xa')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xf')]);router[_0x7721('0x10')](_0x7721('0x9'),auth['isAuthenticated'](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x2f343b,_0xb53102){var _0x11860d=function(_0x28e5f3){while(--_0x28e5f3){_0x2f343b['push'](_0x2f343b['shift']());}};_0x11860d(++_0xb53102);}(_0xd8fb,0x99));var _0xbd8f=function(_0x31329e,_0x231b4c){_0x31329e=_0x31329e-0x0;var _0x511c8c=_0xd8fb[_0x31329e];return _0x511c8c;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ece26e2..e401254 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 _0x5c97=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x47cb0f,_0x5c7147){var _0x4dd971=function(_0x2fd41c){while(--_0x2fd41c){_0x47cb0f['push'](_0x47cb0f['shift']());}};_0x4dd971(++_0x5c7147);}(_0x5c97,0x1b3));var _0x75c9=function(_0x49c341,_0x5b9570){_0x49c341=_0x49c341-0x0;var _0x1c106d=_0x5c97[_0x49c341];return _0x1c106d;};'use strict';var Sequelize=require(_0x75c9('0x0'));module[_0x75c9('0x1')]={'name':{'type':Sequelize[_0x75c9('0x2')],'unique':_0x75c9('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x75c9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x75c9('0x5')](_0x75c9('0x6'),'beepall',_0x75c9('0x7'))}}; \ No newline at end of file +var _0x1d0d=['STRING','name','INTEGER','rrmemory','roundrobin','sequelize','exports'];(function(_0x58815d,_0x186506){var _0x2f2b8f=function(_0xceeb87){while(--_0xceeb87){_0x58815d['push'](_0x58815d['shift']());}};_0x2f2b8f(++_0x186506);}(_0x1d0d,0xb4));var _0xd1d0=function(_0x104cc4,_0xf0a4d6){_0x104cc4=_0x104cc4-0x0;var _0x2d4e38=_0x1d0d[_0x104cc4];return _0x2d4e38;};'use strict';var Sequelize=require(_0xd1d0('0x0'));module[_0xd1d0('0x1')]={'name':{'type':Sequelize[_0xd1d0('0x2')],'unique':_0xd1d0('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd1d0('0x2')]},'timeout':{'type':Sequelize[_0xd1d0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd1d0('0x5'),'beepall',_0xd1d0('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e1fd78e..19cc646 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 _0xb0ad=['localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','findAll','rows','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','params','describe','getMembers','findOne','UserChatQueue','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','push','sequelize','every','TeamId','all','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','order','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x1ff192,_0x350338){var _0x11f5ad=function(_0x492244){while(--_0x492244){_0x1ff192['push'](_0x1ff192['shift']());}};_0x11f5ad(++_0x350338);}(_0xb0ad,0x113));var _0xdb0a=function(_0x46fc52,_0x1dcbe4){_0x46fc52=_0x46fc52-0x0;var _0x3a4be0=_0xb0ad[_0x46fc52];return _0x3a4be0;};'use strict';var emlformat=require(_0xdb0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb0a('0x1'));var jsonpatch=require(_0xdb0a('0x2'));var rp=require(_0xdb0a('0x3'));var moment=require('moment');var BPromise=require(_0xdb0a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb0a('0x5'));var sox=require(_0xdb0a('0x6'));var csv=require(_0xdb0a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb0a('0x8'));var squel=require(_0xdb0a('0x9'));var crypto=require(_0xdb0a('0xa'));var jsforce=require(_0xdb0a('0xb'));var deskjs=require(_0xdb0a('0xc'));var toCsv=require(_0xdb0a('0x7'));var querystring=require(_0xdb0a('0xd'));var Papa=require(_0xdb0a('0xe'));var Redis=require(_0xdb0a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb0a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb0a('0x11'))(_0xdb0a('0x12'));var utils=require(_0xdb0a('0x13'));var config=require(_0xdb0a('0x14'));var licenseUtil=require(_0xdb0a('0x15'));var db=require(_0xdb0a('0x16'))['db'];config['redis']=_[_0xdb0a('0x17')](config[_0xdb0a('0x18')],{'host':_0xdb0a('0x19'),'port':0x18eb});var socket=require(_0xdb0a('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xdb0a('0x1b')](socket);var jayson=require(_0xdb0a('0x1c'));var client=jayson[_0xdb0a('0x1d')][_0xdb0a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xd6f476,_0x3a12c3,_0x5711c7,_0x43415d){return new BPromise(function(_0x45223d,_0x595fc0){var _0x401fc2=_0x43415d||client;return _0x401fc2['request'](_0xd6f476,_0x5711c7)[_0xdb0a('0x1f')](function(_0xdd4568){logger[_0xdb0a('0x20')](_0xdb0a('0x21'),_0x3a12c3,_0xdb0a('0x22'));logger[_0xdb0a('0x23')](_0xdb0a('0x24'),_0x3a12c3,_0xdb0a('0x22'),JSON[_0xdb0a('0x25')](_0xdd4568));if(_0xdd4568[_0xdb0a('0x26')]){if(_0xdd4568[_0xdb0a('0x26')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3a12c3,_0xdd4568[_0xdb0a('0x26')][_0xdb0a('0x27')]);return _0x595fc0(_0xdd4568[_0xdb0a('0x26')][_0xdb0a('0x27')]);}logger[_0xdb0a('0x26')](_0xdb0a('0x21'),_0x3a12c3,_0xdd4568[_0xdb0a('0x26')][_0xdb0a('0x27')]);return _0x45223d(_0xdd4568[_0xdb0a('0x26')]['message']);}else{logger[_0xdb0a('0x20')]('ChatQueue,\x20%s,\x20%s',_0x3a12c3,_0xdb0a('0x22'));_0x45223d(_0xdd4568[_0xdb0a('0x28')][_0xdb0a('0x27')]);}})[_0xdb0a('0x29')](function(_0x406246){logger[_0xdb0a('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3a12c3,_0x406246);_0x595fc0(_0x406246);});});}function respondWithStatusCode(_0x5ab7a6,_0x1153a2){_0x1153a2=_0x1153a2||0xcc;return function(_0xf1a2c8){if(_0xf1a2c8){return _0x5ab7a6[_0xdb0a('0x2a')](_0x1153a2);}return _0x5ab7a6[_0xdb0a('0x2b')](_0x1153a2)['end']();};}function respondWithResult(_0x3f5b2d,_0x448d59){_0x448d59=_0x448d59||0xc8;return function(_0x3bce13){if(_0x3bce13){return _0x3f5b2d[_0xdb0a('0x2b')](_0x448d59)[_0xdb0a('0x2c')](_0x3bce13);}};}function respondWithFilteredResult(_0xb98459,_0x26a327){return function(_0x26fce9){if(_0x26fce9){var _0x3b586c=typeof _0x26a327[_0xdb0a('0x2d')]===_0xdb0a('0x2e')&&typeof _0x26a327[_0xdb0a('0x2f')]===_0xdb0a('0x2e');var _0x1052a2=_0x26fce9[_0xdb0a('0x30')];var _0x3e49d4=_0x3b586c?0x0:_0x26a327['offset'];var _0x532870=_0x3b586c?_0x26fce9['count']:_0x26a327[_0xdb0a('0x2d')]+_0x26a327[_0xdb0a('0x2f')];var _0x244fdf;if(_0x532870>=_0x1052a2){_0x532870=_0x1052a2;_0x244fdf=0xc8;}else{_0x244fdf=0xce;}_0xb98459['status'](_0x244fdf);return _0xb98459[_0xdb0a('0x31')](_0xdb0a('0x32'),_0x3e49d4+'-'+_0x532870+'/'+_0x1052a2)['json'](_0x26fce9);}return null;};}function patchUpdates(_0x5e8b13){return function(_0x306254){try{jsonpatch[_0xdb0a('0x33')](_0x306254,_0x5e8b13,!![]);}catch(_0x47ad0c){return BPromise[_0xdb0a('0x34')](_0x47ad0c);}return _0x306254[_0xdb0a('0x35')]();};}function saveUpdates(_0xf0d148,_0x2e4709){return function(_0x4bbb79){if(_0x4bbb79){return _0x4bbb79['update'](_0xf0d148)[_0xdb0a('0x1f')](function(_0xe487b2){return _0xe487b2;});}return null;};}function removeEntity(_0x95e6bd,_0x45b95e){return function(_0x54bd93){if(_0x54bd93){return _0x54bd93[_0xdb0a('0x36')]()[_0xdb0a('0x1f')](function(){var _0x3dae8c=_0x54bd93[_0xdb0a('0x37')]({'plain':!![]});var _0x34f520=_0xdb0a('0x38');return db[_0xdb0a('0x39')][_0xdb0a('0x36')]({'where':{'type':_0x34f520,'resourceId':_0x3dae8c['id']}})[_0xdb0a('0x1f')](function(){return _0x54bd93;});})['then'](function(){_0x95e6bd[_0xdb0a('0x2b')](0xcc)[_0xdb0a('0x3a')]();});}};}function handleEntityNotFound(_0x49d4ae,_0x34c5de){return function(_0x3cd66c){if(!_0x3cd66c){_0x49d4ae[_0xdb0a('0x2a')](0x194);}return _0x3cd66c;};}function handleError(_0x11dde0,_0xb24ac){_0xb24ac=_0xb24ac||0x1f4;return function(_0x50652d){logger[_0xdb0a('0x26')](_0x50652d[_0xdb0a('0x3b')]);if(_0x50652d[_0xdb0a('0x3c')]){delete _0x50652d[_0xdb0a('0x3c')];}_0x11dde0[_0xdb0a('0x2b')](_0xb24ac)[_0xdb0a('0x3d')](_0x50652d);};}exports[_0xdb0a('0x3e')]=function(_0x3df1ac,_0x3b8149){var _0x175004={},_0x41fea4={},_0xa281d4={'count':0x0,'rows':[]};var _0x1e8f0d=_[_0xdb0a('0x3f')](db[_0xdb0a('0x40')][_0xdb0a('0x41')],function(_0x2eb56f){return{'name':_0x2eb56f[_0xdb0a('0x42')],'type':_0x2eb56f[_0xdb0a('0x43')][_0xdb0a('0x44')]};});_0x41fea4[_0xdb0a('0x45')]=_[_0xdb0a('0x3f')](_0x1e8f0d,'name');_0x41fea4[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x3df1ac[_0xdb0a('0x46')]);_0x41fea4['filters']=_[_0xdb0a('0x48')](_0x41fea4[_0xdb0a('0x45')],_0x41fea4['query']);_0x175004[_0xdb0a('0x49')]=_[_0xdb0a('0x48')](_0x41fea4[_0xdb0a('0x45')],qs[_0xdb0a('0x4a')](_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x175004['attributes']=_0x175004[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x175004[_0xdb0a('0x49')]:_0x41fea4[_0xdb0a('0x45')];if(!_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x4c')](_0xdb0a('0x4d'))){_0x175004[_0xdb0a('0x2f')]=qs['limit'](_0x3df1ac['query']['limit']);_0x175004[_0xdb0a('0x2d')]=qs[_0xdb0a('0x2d')](_0x3df1ac['query'][_0xdb0a('0x2d')]);}_0x175004['order']=qs[_0xdb0a('0x4e')](_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x4e')]);_0x175004[_0xdb0a('0x4f')]=qs[_0xdb0a('0x50')](_[_0xdb0a('0x51')](_0x3df1ac[_0xdb0a('0x46')],_0x41fea4[_0xdb0a('0x50')]),_0x1e8f0d);if(_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x52')]){_0x175004[_0xdb0a('0x4f')]=_[_0xdb0a('0x53')](_0x175004[_0xdb0a('0x4f')],{'$or':_['map'](_0x1e8f0d,function(_0x4de2b9){if(_0x4de2b9[_0xdb0a('0x43')]!=='VIRTUAL'){var _0x3837a4={};_0x3837a4[_0x4de2b9[_0xdb0a('0x3c')]]={'$like':'%'+_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x52')]+'%'};return _0x3837a4;}})});}_0x175004=_[_0xdb0a('0x53')]({},_0x175004,_0x3df1ac['options']);var _0x2bb342={'where':_0x175004[_0xdb0a('0x4f')]};return db['ChatQueue'][_0xdb0a('0x30')](_0x2bb342)['then'](function(_0xf226b1){_0xa281d4[_0xdb0a('0x30')]=_0xf226b1;if(_0x3df1ac[_0xdb0a('0x46')]['includeAll']){_0x175004['include']=[{'all':!![]}];}return db['ChatQueue'][_0xdb0a('0x54')](_0x175004);})['then'](function(_0x141383){_0xa281d4[_0xdb0a('0x55')]=_0x141383;return _0xa281d4;})[_0xdb0a('0x1f')](respondWithFilteredResult(_0x3b8149,_0x175004))[_0xdb0a('0x29')](handleError(_0x3b8149,null));};exports['show']=function(_0x12bb6d,_0x4dd154){var _0x3d0e33={'raw':!![],'where':{'id':_0x12bb6d['params']['id']}},_0x115e60={};_0x115e60[_0xdb0a('0x45')]=_[_0xdb0a('0x47')](db[_0xdb0a('0x40')][_0xdb0a('0x41')]);_0x115e60[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x12bb6d[_0xdb0a('0x46')]);_0x115e60['filters']=_['intersection'](_0x115e60['model'],_0x115e60[_0xdb0a('0x46')]);_0x3d0e33[_0xdb0a('0x49')]=_[_0xdb0a('0x48')](_0x115e60[_0xdb0a('0x45')],qs[_0xdb0a('0x4a')](_0x12bb6d[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x3d0e33[_0xdb0a('0x49')]=_0x3d0e33[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x3d0e33[_0xdb0a('0x49')]:_0x115e60['model'];if(_0x12bb6d['query'][_0xdb0a('0x56')]){_0x3d0e33[_0xdb0a('0x57')]=[{'all':!![]}];}_0x3d0e33=_[_0xdb0a('0x53')]({},_0x3d0e33,_0x12bb6d[_0xdb0a('0x58')]);return db['ChatQueue'][_0xdb0a('0x59')](_0x3d0e33)[_0xdb0a('0x1f')](handleEntityNotFound(_0x4dd154,null))[_0xdb0a('0x1f')](respondWithResult(_0x4dd154,null))[_0xdb0a('0x29')](handleError(_0x4dd154,null));};exports[_0xdb0a('0x5a')]=function(_0x1df126,_0x40b4b7){return db[_0xdb0a('0x40')][_0xdb0a('0x5a')](_0x1df126['body'],{})[_0xdb0a('0x1f')](function(_0x14f41b){var _0x1b3e83=_0x1df126[_0xdb0a('0x5b')][_0xdb0a('0x37')]({'plain':!![]});if(!_0x1b3e83)throw new Error(_0xdb0a('0x5c'));if(_0x1b3e83[_0xdb0a('0x5d')]===_0xdb0a('0x5b')){var _0x271416=_0x14f41b[_0xdb0a('0x37')]({'plain':!![]});var _0x56556a=_0xdb0a('0x38');return db[_0xdb0a('0x5e')][_0xdb0a('0x59')]({'where':{'name':_0x56556a,'userProfileId':_0x1b3e83[_0xdb0a('0x5f')]},'raw':!![]})['then'](function(_0x2561aa){if(_0x2561aa&&_0x2561aa[_0xdb0a('0x60')]===0x0){return db[_0xdb0a('0x39')][_0xdb0a('0x5a')]({'name':_0x271416[_0xdb0a('0x3c')],'resourceId':_0x271416['id'],'type':_0x2561aa['name'],'sectionId':_0x2561aa['id']},{})['then'](function(){return _0x14f41b;});}else{return _0x14f41b;}})[_0xdb0a('0x29')](function(_0x1401ed){logger[_0xdb0a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1401ed);throw _0x1401ed;});}return _0x14f41b;})[_0xdb0a('0x1f')](respondWithResult(_0x40b4b7,0xc9))[_0xdb0a('0x29')](handleError(_0x40b4b7,null));};exports[_0xdb0a('0x61')]=function(_0x57d26f,_0x1345a2){if(_0x57d26f[_0xdb0a('0x62')]['id']){delete _0x57d26f[_0xdb0a('0x62')]['id'];}return db['ChatQueue'][_0xdb0a('0x59')]({'where':{'id':_0x57d26f[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x1345a2,null))[_0xdb0a('0x1f')](saveUpdates(_0x57d26f[_0xdb0a('0x62')],null))['then'](respondWithResult(_0x1345a2,null))[_0xdb0a('0x29')](handleError(_0x1345a2,null));};exports[_0xdb0a('0x36')]=function(_0x239f57,_0x139826){return db[_0xdb0a('0x40')][_0xdb0a('0x59')]({'where':{'id':_0x239f57[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x139826,null))[_0xdb0a('0x1f')](removeEntity(_0x139826,null))[_0xdb0a('0x29')](handleError(_0x139826,null));};exports[_0xdb0a('0x64')]=function(_0xd58b2e,_0x591f6a){return db['ChatQueue'][_0xdb0a('0x64')]()['then'](respondWithResult(_0x591f6a,null))[_0xdb0a('0x29')](handleError(_0x591f6a,null));};exports[_0xdb0a('0x65')]=function(_0xcca25,_0x491098,_0x3a7514){var _0x58c006={'raw':!![],'where':{}},_0x41281c={},_0x219934;return db[_0xdb0a('0x40')][_0xdb0a('0x66')]({'where':{'id':_0xcca25[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x491098,null))[_0xdb0a('0x1f')](function(_0x3dbc21){if(_0x3dbc21){_0x219934=_0x3dbc21[_0xdb0a('0x37')]({'plain':!![]});_0x41281c[_0xdb0a('0x45')]=_['keys'](db['UserChatQueue'][_0xdb0a('0x41')]);_0x41281c['query']=_[_0xdb0a('0x47')](_0xcca25[_0xdb0a('0x46')]);_0x41281c['filters']=_['intersection'](_0x41281c[_0xdb0a('0x45')],_0x41281c[_0xdb0a('0x46')]);_0x58c006[_0xdb0a('0x49')]=_[_0xdb0a('0x48')](_0x41281c[_0xdb0a('0x45')],qs['fields'](_0xcca25[_0xdb0a('0x46')]['fields']));_0x58c006[_0xdb0a('0x49')]=_0x58c006[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x58c006[_0xdb0a('0x49')]:_0x41281c[_0xdb0a('0x45')];if(!_0xcca25[_0xdb0a('0x46')]['hasOwnProperty'](_0xdb0a('0x4d'))){_0x58c006[_0xdb0a('0x2f')]=qs['limit'](_0xcca25[_0xdb0a('0x46')][_0xdb0a('0x2f')]);_0x58c006[_0xdb0a('0x2d')]=qs['offset'](_0xcca25[_0xdb0a('0x46')]['offset']);}_0x58c006['order']=qs[_0xdb0a('0x4e')](_0xcca25['query'][_0xdb0a('0x4e')]);_0x58c006['where']=qs[_0xdb0a('0x50')](_[_0xdb0a('0x51')](_0xcca25[_0xdb0a('0x46')],_0x41281c['filters']));_0x58c006[_0xdb0a('0x4f')]['ChatQueueId']=_0x3dbc21['id'];if(_0xcca25[_0xdb0a('0x46')][_0xdb0a('0x52')]){_0x58c006[_0xdb0a('0x4f')]=_[_0xdb0a('0x53')](_0x58c006[_0xdb0a('0x4f')],{'$or':_[_0xdb0a('0x3f')](_0x58c006[_0xdb0a('0x49')],function(_0x15f5ab){var _0x44ad38={};_0x44ad38[_0x15f5ab]={'$like':'%'+_0xcca25['query'][_0xdb0a('0x52')]+'%'};return _0x44ad38;})});}_0x58c006=_['merge']({},_0x58c006,_0xcca25[_0xdb0a('0x58')]);return db[_0xdb0a('0x67')][_0xdb0a('0x54')](_0x58c006);}})[_0xdb0a('0x1f')](function(_0x2d64a6){if(_0x2d64a6){return db['User'][_0xdb0a('0x68')]({'where':{'id':_[_0xdb0a('0x3f')](_0x2d64a6,'UserId'),'role':_0xdb0a('0x69')},'attributes':['id',_0xdb0a('0x3c'),_0xdb0a('0x6a'),_0xdb0a('0x6b'),'createdAt']});}})['then'](function(_0x62e4c0){if(_0x62e4c0){return{'count':_0x62e4c0['count'],'rows':_[_0xdb0a('0x3f')](_0x62e4c0['rows'],function(_0x4e16bd){return{'membername':_0x4e16bd[_0xdb0a('0x3c')],'UserId':_0x4e16bd['id'],'queue_name':_0x219934['name'],'ChatQueueId':_0x219934['id'],'interface':util[_0xdb0a('0x6c')](_0xdb0a('0x6d'),'SIP',_0x4e16bd[_0xdb0a('0x3c')]),'penalty':0x0,'paused':_0x4e16bd['chatPause'],'createdAt':_0x4e16bd['createdAt'],'updatedAt':_0x4e16bd[_0xdb0a('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x491098,_0x58c006))['catch'](handleError(_0x491098,null));};exports[_0xdb0a('0x6e')]=function(_0x1d849d,_0x2de924,_0x4c0ae8){var _0x45e7bc={};var _0x28db73={};var _0xff1820;var _0x14df8e;return db[_0xdb0a('0x40')][_0xdb0a('0x66')]({'where':{'id':_0x1d849d[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x2de924,null))[_0xdb0a('0x1f')](function(_0x3d1ebe){if(_0x3d1ebe){_0xff1820=_0x3d1ebe;_0x28db73[_0xdb0a('0x45')]=_['keys'](db['Team']['rawAttributes']);_0x28db73[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x1d849d[_0xdb0a('0x46')]);_0x28db73[_0xdb0a('0x50')]=_[_0xdb0a('0x48')](_0x28db73[_0xdb0a('0x45')],_0x28db73[_0xdb0a('0x46')]);_0x45e7bc['attributes']=_[_0xdb0a('0x48')](_0x28db73['model'],qs['fields'](_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x45e7bc[_0xdb0a('0x49')]=_0x45e7bc[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x45e7bc[_0xdb0a('0x49')]:_0x28db73[_0xdb0a('0x45')];_0x45e7bc['order']=qs[_0xdb0a('0x4e')](_0x1d849d['query'][_0xdb0a('0x4e')]);_0x45e7bc['where']=qs['filters'](_['pick'](_0x1d849d['query'],_0x28db73['filters']));if(_0x1d849d[_0xdb0a('0x46')]['filter']){_0x45e7bc[_0xdb0a('0x4f')]=_['merge'](_0x45e7bc[_0xdb0a('0x4f')],{'$or':_[_0xdb0a('0x3f')](_0x45e7bc[_0xdb0a('0x49')],function(_0x581d6d){var _0x14f2ed={};_0x14f2ed[_0x581d6d]={'$like':'%'+_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x52')]+'%'};return _0x14f2ed;})});}_0x45e7bc=_['merge']({},_0x45e7bc,_0x1d849d['options']);return _0xff1820[_0xdb0a('0x6e')](_0x45e7bc);}})[_0xdb0a('0x1f')](function(_0xaf4a0f){if(_0xaf4a0f){_0x14df8e=_0xaf4a0f[_0xdb0a('0x4b')];if(!_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x4c')](_0xdb0a('0x4d'))){_0x45e7bc[_0xdb0a('0x2f')]=qs[_0xdb0a('0x2f')](_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x2f')]);_0x45e7bc[_0xdb0a('0x2d')]=qs[_0xdb0a('0x2d')](_0x1d849d['query'][_0xdb0a('0x2d')]);}return _0xff1820[_0xdb0a('0x6e')](_0x45e7bc);}})[_0xdb0a('0x1f')](function(_0x20c058){if(_0x20c058){return _0x20c058?{'count':_0x14df8e,'rows':_0x20c058}:null;}})[_0xdb0a('0x1f')](respondWithResult(_0x2de924,null))['catch'](handleError(_0x2de924,null));};exports[_0xdb0a('0x6f')]=function(_0x203754,_0x394cb7,_0x5b1a09){var _0x4af425=_0x203754[_0xdb0a('0x62')][_0xdb0a('0x70')];return db[_0xdb0a('0x71')][_0xdb0a('0x54')]({'where':{'id':_0x4af425},'attributes':['id'],'include':[{'model':db[_0xdb0a('0x72')],'as':_0xdb0a('0x73'),'attributes':['id',_0xdb0a('0x3c'),_0xdb0a('0x74'),_0xdb0a('0x75'),'interface'],'raw':!![]}]})[_0xdb0a('0x1f')](function(_0x1565a2){if(_0x1565a2){var _0x292667=_[_0xdb0a('0x76')](_0x1565a2,function(_0xc826d4){var _0x51a7c3=_0xc826d4[_0xdb0a('0x37')]({'plain':!![]});return _0x51a7c3['Agents'];});return db[_0xdb0a('0x40')][_0xdb0a('0x59')]({'where':{'id':_0x203754[_0xdb0a('0x63')]['id']}})['then'](function(_0x174f75){return db['sequelize'][_0xdb0a('0x77')](function(_0x14836b){return _0x174f75[_0xdb0a('0x6f')](_0x4af425,{'transaction':_0x14836b})['then'](function(){return BPromise[_0xdb0a('0x78')](_0x292667,function(_0x346bf5){return db[_0xdb0a('0x67')][_0xdb0a('0x79')]({'where':{'UserId':_0x346bf5['id'],'ChatQueueId':_0x203754['params']['id']},'transaction':_0x14836b});});})[_0xdb0a('0x1f')](function(){_0x292667[_0xdb0a('0x7a')](function(_0x22e82b){socket[_0xdb0a('0x7b')](_0xdb0a('0x7c'),{'UserId':_0x22e82b['id'],'ChatQueueId':_0x174f75['id']});});});});});}})[_0xdb0a('0x1f')](respondWithStatusCode(_0x394cb7,null))[_0xdb0a('0x29')](handleError(_0x394cb7,null));};exports[_0xdb0a('0x7d')]=function(_0x58ca99,_0x538344,_0x178989){return db['Team'][_0xdb0a('0x54')]({'where':{'id':_0x58ca99['query'][_0xdb0a('0x70')]},'attributes':['id'],'include':[{'model':db[_0xdb0a('0x72')],'as':_0xdb0a('0x73'),'attributes':['id'],'raw':!![]}]})[_0xdb0a('0x1f')](handleEntityNotFound(_0x538344,null))['then'](function(_0x16329f){var _0x287bbb=_[_0xdb0a('0x3f')](_0x16329f,'id');var _0x4f366c=[];var _0x33bf24=[];var _0x2304c2=squel[_0xdb0a('0x7e')]();_0x2304c2[_0xdb0a('0x7f')](_0xdb0a('0x80'))[_0xdb0a('0x81')](_0xdb0a('0x82'),'tq')['join'](_0xdb0a('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdb0a('0x4f')](_0xdb0a('0x84'),_0x58ca99['params']['id']);for(var _0x19605a=0x0;_0x19605a<_0x16329f[_0xdb0a('0x4b')];_0x19605a+=0x1){let _0x4f2ba4=_0x16329f[_0x19605a];for(var _0x544e1c=0x0;_0x544e1c<_0x4f2ba4['Agents'][_0xdb0a('0x4b')];_0x544e1c+=0x1){let _0x1cf9f8=_0x4f2ba4[_0xdb0a('0x73')][_0x544e1c];var _0x46a5b2=_0x2304c2[_0xdb0a('0x85')]();_0x46a5b2[_0xdb0a('0x4f')]('ut.UserId\x20=\x20?',_0x1cf9f8['id']);_0x33bf24[_0xdb0a('0x86')](db[_0xdb0a('0x87')][_0xdb0a('0x46')](_0x46a5b2['toString'](),{'type':db[_0xdb0a('0x87')]['QueryTypes']['SELECT']})[_0xdb0a('0x1f')](function(_0x659206){if(_0x659206[_0xdb0a('0x4b')]===0x1){return _0x1cf9f8['id'];}else{var _0x4eac3f=_[_0xdb0a('0x88')](_[_0xdb0a('0x3f')](_0x659206,_0xdb0a('0x89')),function(_0x2e3d43){return _['includes'](_0x287bbb,_0x2e3d43);});if(_0x4eac3f){return _0x1cf9f8['id'];}}}));}}return BPromise[_0xdb0a('0x8a')](_0x33bf24)['then'](function(_0x443255){_0x4f366c=_(_0x4f366c)['union'](_0x443255)[_0xdb0a('0x8b')]()[_0xdb0a('0x8c')]();return db[_0xdb0a('0x40')]['find']({'where':{'id':_0x58ca99[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](function(_0x40d715){return db['sequelize']['transaction'](function(_0x5b3e23){return _0x40d715[_0xdb0a('0x7d')](_0x58ca99[_0xdb0a('0x46')][_0xdb0a('0x70')],{'transaction':_0x5b3e23})[_0xdb0a('0x1f')](function(){if(!_[_0xdb0a('0x8d')](_0x4f366c)){return _0x40d715['removeAgents'](_0x4f366c,{'transaction':_0x5b3e23});}})[_0xdb0a('0x1f')](function(){_0x4f366c[_0xdb0a('0x7a')](function(_0x8c7b2a){socket[_0xdb0a('0x7b')](_0xdb0a('0x8e'),{'UserId':_0x8c7b2a,'ChatQueueId':_0x40d715['id']});});});});});});})['then'](respondWithStatusCode(_0x538344,null))[_0xdb0a('0x29')](handleError(_0x538344,null));};exports['addAgents']=function(_0xc1fc21,_0x7074ba,_0x542648){return db[_0xdb0a('0x40')]['find']({'where':{'id':_0xc1fc21['params']['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x7074ba,null))[_0xdb0a('0x1f')](function(_0x40a0bd){if(_0x40a0bd){return _0x40a0bd[_0xdb0a('0x8f')](_0xc1fc21[_0xdb0a('0x62')]['ids'],_[_0xdb0a('0x90')](_0xc1fc21[_0xdb0a('0x62')],[_0xdb0a('0x70'),'id'])||{})[_0xdb0a('0x91')](function(_0x176328){for(var _0x5078c8=0x0;_0x5078c8<_0xc1fc21[_0xdb0a('0x62')]['ids'][_0xdb0a('0x4b')];_0x5078c8+=0x1){socket[_0xdb0a('0x7b')]('userChatQueue:save',{'UserId':Number(_0xc1fc21[_0xdb0a('0x62')][_0xdb0a('0x70')][_0x5078c8]),'ChatQueueId':Number(_0xc1fc21[_0xdb0a('0x63')]['id'])});}return _0x176328;});}})[_0xdb0a('0x1f')](respondWithResult(_0x7074ba,null))['catch'](handleError(_0x7074ba,null));};exports[_0xdb0a('0x92')]=function(_0x57f7d3,_0x3425f4,_0x2c0971){return db['ChatQueue'][_0xdb0a('0x59')]({'where':{'id':_0x57f7d3['params']['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x3425f4,null))[_0xdb0a('0x1f')](function(_0x3e8ba0){if(_0x3e8ba0){return _0x3e8ba0[_0xdb0a('0x92')](_0x57f7d3[_0xdb0a('0x46')][_0xdb0a('0x70')])[_0xdb0a('0x1f')](function(){if(_[_0xdb0a('0x93')](_0x57f7d3[_0xdb0a('0x46')][_0xdb0a('0x70')])){for(var _0x3f1288=0x0;_0x3f1288<_0x57f7d3[_0xdb0a('0x46')]['ids'][_0xdb0a('0x4b')];_0x3f1288+=0x1){socket[_0xdb0a('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x57f7d3['query'][_0xdb0a('0x70')][_0x3f1288]),'ChatQueueId':Number(_0x57f7d3['params']['id'])});}}else{socket[_0xdb0a('0x7b')](_0xdb0a('0x8e'),{'UserId':Number(_0x57f7d3['query'][_0xdb0a('0x70')]),'ChatQueueId':Number(_0x57f7d3['params']['id'])});}});}})[_0xdb0a('0x1f')](respondWithStatusCode(_0x3425f4,null))['catch'](handleError(_0x3425f4,null));};exports[_0xdb0a('0x94')]=function(_0x2a9468,_0x208b57,_0x43acc1){var _0x15df04={};var _0x1712d7={};var _0x1b9894;var _0x1fc661;return db['ChatQueue'][_0xdb0a('0x66')]({'where':{'id':_0x2a9468[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x208b57,null))['then'](function(_0x178fa4){if(_0x178fa4){_0x1b9894=_0x178fa4;_0x1712d7[_0xdb0a('0x45')]=_[_0xdb0a('0x47')](db[_0xdb0a('0x72')][_0xdb0a('0x41')]);_0x1712d7[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x2a9468[_0xdb0a('0x46')]);_0x1712d7[_0xdb0a('0x50')]=_[_0xdb0a('0x48')](_0x1712d7['model'],_0x1712d7[_0xdb0a('0x46')]);_0x15df04['attributes']=_[_0xdb0a('0x48')](_0x1712d7[_0xdb0a('0x45')],qs[_0xdb0a('0x4a')](_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x15df04[_0xdb0a('0x49')]=_0x15df04[_0xdb0a('0x49')]['length']?_0x15df04[_0xdb0a('0x49')]:_0x1712d7[_0xdb0a('0x45')];_0x15df04[_0xdb0a('0x95')]=qs[_0xdb0a('0x4e')](_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x4e')]);_0x15df04[_0xdb0a('0x4f')]=qs['filters'](_[_0xdb0a('0x51')](_0x2a9468[_0xdb0a('0x46')],_0x1712d7[_0xdb0a('0x50')]));if(_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x52')]){_0x15df04[_0xdb0a('0x4f')]=_[_0xdb0a('0x53')](_0x15df04['where'],{'$or':_['map'](_0x15df04[_0xdb0a('0x49')],function(_0x16fe7e){var _0x5694d8={};_0x5694d8[_0x16fe7e]={'$like':'%'+_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x52')]+'%'};return _0x5694d8;})});}_0x15df04=_[_0xdb0a('0x53')]({},_0x15df04,_0x2a9468[_0xdb0a('0x58')]);return _0x1b9894['getAgents'](_0x15df04);}})['then'](function(_0x4a8428){if(_0x4a8428){_0x1fc661=_0x4a8428[_0xdb0a('0x4b')];if(!_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x4c')]('nolimit')){_0x15df04['limit']=qs['limit'](_0x2a9468['query']['limit']);_0x15df04[_0xdb0a('0x2d')]=qs[_0xdb0a('0x2d')](_0x2a9468[_0xdb0a('0x46')]['offset']);}return _0x1b9894[_0xdb0a('0x94')](_0x15df04);}})[_0xdb0a('0x1f')](function(_0x538be1){if(_0x538be1){return _0x538be1?{'count':_0x1fc661,'rows':_0x538be1}:null;}})[_0xdb0a('0x1f')](respondWithResult(_0x208b57,null))['catch'](handleError(_0x208b57,null));}; \ No newline at end of file +var _0xff3e=['fast-json-patch','request-promise','path','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/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','destroy','get','ChatQueues','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','ChatQueue','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','UserChatQueue','hasOwnProperty','order','User','findAndCountAll','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','removeTeams','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf'];(function(_0x395924,_0x58adf9){var _0x2edc62=function(_0x26ff7){while(--_0x26ff7){_0x395924['push'](_0x395924['shift']());}};_0x2edc62(++_0x58adf9);}(_0xff3e,0x128));var _0xeff3=function(_0x12d7b0,_0xa3e199){_0x12d7b0=_0x12d7b0-0x0;var _0x56ad07=_0xff3e[_0x12d7b0];return _0x56ad07;};'use strict';var emlformat=require(_0xeff3('0x0'));var rimraf=require(_0xeff3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeff3('0x2'));var rp=require(_0xeff3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xeff3('0x4'));var sox=require('sox');var csv=require(_0xeff3('0x5'));var ejs=require(_0xeff3('0x6'));var fs=require('fs');var fs_extra=require(_0xeff3('0x7'));var _=require('lodash');var squel=require(_0xeff3('0x8'));var crypto=require('crypto');var jsforce=require(_0xeff3('0x9'));var deskjs=require(_0xeff3('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeff3('0xb'));var Papa=require(_0xeff3('0xc'));var Redis=require('ioredis');var authService=require(_0xeff3('0xd'));var qs=require(_0xeff3('0xe'));var as=require(_0xeff3('0xf'));var hardwareService=require(_0xeff3('0x10'));var logger=require(_0xeff3('0x11'))(_0xeff3('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeff3('0x13'));var db=require(_0xeff3('0x14'))['db'];config[_0xeff3('0x15')]=_[_0xeff3('0x16')](config['redis'],{'host':_0xeff3('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeff3('0x15')]));require(_0xeff3('0x18'))['register'](socket);var jayson=require(_0xeff3('0x19'));var client=jayson[_0xeff3('0x1a')][_0xeff3('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf3bcfc,_0xb7b3cf,_0x15ba2e,_0x33f6e9){return new BPromise(function(_0x5af528,_0x357aa2){var _0x482519=_0x33f6e9||client;return _0x482519[_0xeff3('0x1c')](_0xf3bcfc,_0x15ba2e)[_0xeff3('0x1d')](function(_0x31b682){logger[_0xeff3('0x1e')](_0xeff3('0x1f'),_0xb7b3cf,_0xeff3('0x20'));logger[_0xeff3('0x21')](_0xeff3('0x22'),_0xb7b3cf,_0xeff3('0x20'),JSON[_0xeff3('0x23')](_0x31b682));if(_0x31b682[_0xeff3('0x24')]){if(_0x31b682['error'][_0xeff3('0x25')]===0x1f4){logger[_0xeff3('0x24')](_0xeff3('0x1f'),_0xb7b3cf,_0x31b682[_0xeff3('0x24')][_0xeff3('0x26')]);return _0x357aa2(_0x31b682[_0xeff3('0x24')]['message']);}logger[_0xeff3('0x24')](_0xeff3('0x1f'),_0xb7b3cf,_0x31b682['error']['message']);return _0x5af528(_0x31b682['error'][_0xeff3('0x26')]);}else{logger[_0xeff3('0x1e')](_0xeff3('0x1f'),_0xb7b3cf,_0xeff3('0x20'));_0x5af528(_0x31b682[_0xeff3('0x27')]['message']);}})[_0xeff3('0x28')](function(_0x28a82f){logger[_0xeff3('0x24')](_0xeff3('0x1f'),_0xb7b3cf,_0x28a82f);_0x357aa2(_0x28a82f);});});}function respondWithStatusCode(_0x5541ae,_0x50601f){_0x50601f=_0x50601f||0xcc;return function(_0x1b305e){if(_0x1b305e){return _0x5541ae['sendStatus'](_0x50601f);}return _0x5541ae[_0xeff3('0x29')](_0x50601f)[_0xeff3('0x2a')]();};}function respondWithResult(_0x1a77c5,_0x49d94b){_0x49d94b=_0x49d94b||0xc8;return function(_0x15ba2a){if(_0x15ba2a){return _0x1a77c5[_0xeff3('0x29')](_0x49d94b)['json'](_0x15ba2a);}};}function respondWithFilteredResult(_0x2e7c79,_0x470a67){return function(_0x5de6e4){if(_0x5de6e4){var _0x1d41af=typeof _0x470a67[_0xeff3('0x2b')]===_0xeff3('0x2c')&&typeof _0x470a67['limit']===_0xeff3('0x2c');var _0xd0defa=_0x5de6e4[_0xeff3('0x2d')];var _0x50a2ad=_0x1d41af?0x0:_0x470a67[_0xeff3('0x2b')];var _0x1aac72=_0x1d41af?_0x5de6e4['count']:_0x470a67['offset']+_0x470a67[_0xeff3('0x2e')];var _0x176b10;if(_0x1aac72>=_0xd0defa){_0x1aac72=_0xd0defa;_0x176b10=0xc8;}else{_0x176b10=0xce;}_0x2e7c79[_0xeff3('0x29')](_0x176b10);return _0x2e7c79['set'](_0xeff3('0x2f'),_0x50a2ad+'-'+_0x1aac72+'/'+_0xd0defa)[_0xeff3('0x30')](_0x5de6e4);}return null;};}function patchUpdates(_0x100a81){return function(_0x43ad38){try{jsonpatch[_0xeff3('0x31')](_0x43ad38,_0x100a81,!![]);}catch(_0x52648a){return BPromise[_0xeff3('0x32')](_0x52648a);}return _0x43ad38[_0xeff3('0x33')]();};}function saveUpdates(_0x2da460,_0x77aae3){return function(_0x3b7e12){if(_0x3b7e12){return _0x3b7e12['update'](_0x2da460)[_0xeff3('0x1d')](function(_0x40500c){return _0x40500c;});}return null;};}function removeEntity(_0x4336ec,_0x5735ec){return function(_0x1f1640){if(_0x1f1640){return _0x1f1640[_0xeff3('0x34')]()[_0xeff3('0x1d')](function(){var _0x5a348b=_0x1f1640[_0xeff3('0x35')]({'plain':!![]});var _0x3887df=_0xeff3('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x3887df,'resourceId':_0x5a348b['id']}})[_0xeff3('0x1d')](function(){return _0x1f1640;});})[_0xeff3('0x1d')](function(){_0x4336ec[_0xeff3('0x29')](0xcc)[_0xeff3('0x2a')]();});}};}function handleEntityNotFound(_0x259b20,_0x4c431a){return function(_0x499593){if(!_0x499593){_0x259b20[_0xeff3('0x37')](0x194);}return _0x499593;};}function handleError(_0x18f24a,_0x4201cf){_0x4201cf=_0x4201cf||0x1f4;return function(_0x447fbc){logger[_0xeff3('0x24')](_0x447fbc[_0xeff3('0x38')]);if(_0x447fbc[_0xeff3('0x39')]){delete _0x447fbc[_0xeff3('0x39')];}_0x18f24a[_0xeff3('0x29')](_0x4201cf)['send'](_0x447fbc);};}exports[_0xeff3('0x3a')]=function(_0x54fa73,_0x5e25cd){var _0xfcdf09={},_0x156319={},_0x4bb6d3={'count':0x0,'rows':[]};var _0x154345=_[_0xeff3('0x3b')](db['ChatQueue'][_0xeff3('0x3c')],function(_0x4f3e94){return{'name':_0x4f3e94[_0xeff3('0x3d')],'type':_0x4f3e94[_0xeff3('0x3e')][_0xeff3('0x3f')]};});_0x156319[_0xeff3('0x40')]=_[_0xeff3('0x3b')](_0x154345,_0xeff3('0x39'));_0x156319[_0xeff3('0x41')]=_[_0xeff3('0x42')](_0x54fa73[_0xeff3('0x41')]);_0x156319[_0xeff3('0x43')]=_['intersection'](_0x156319['model'],_0x156319[_0xeff3('0x41')]);_0xfcdf09[_0xeff3('0x44')]=_['intersection'](_0x156319[_0xeff3('0x40')],qs[_0xeff3('0x45')](_0x54fa73['query'][_0xeff3('0x45')]));_0xfcdf09[_0xeff3('0x44')]=_0xfcdf09[_0xeff3('0x44')][_0xeff3('0x46')]?_0xfcdf09['attributes']:_0x156319[_0xeff3('0x40')];if(!_0x54fa73[_0xeff3('0x41')]['hasOwnProperty'](_0xeff3('0x47'))){_0xfcdf09[_0xeff3('0x2e')]=qs['limit'](_0x54fa73[_0xeff3('0x41')]['limit']);_0xfcdf09[_0xeff3('0x2b')]=qs[_0xeff3('0x2b')](_0x54fa73[_0xeff3('0x41')][_0xeff3('0x2b')]);}_0xfcdf09['order']=qs[_0xeff3('0x48')](_0x54fa73['query'][_0xeff3('0x48')]);_0xfcdf09[_0xeff3('0x49')]=qs[_0xeff3('0x43')](_[_0xeff3('0x4a')](_0x54fa73['query'],_0x156319[_0xeff3('0x43')]),_0x154345);if(_0x54fa73[_0xeff3('0x41')][_0xeff3('0x4b')]){_0xfcdf09[_0xeff3('0x49')]=_['merge'](_0xfcdf09[_0xeff3('0x49')],{'$or':_['map'](_0x154345,function(_0x333e13){if(_0x333e13[_0xeff3('0x3e')]!=='VIRTUAL'){var _0x4d1b48={};_0x4d1b48[_0x333e13[_0xeff3('0x39')]]={'$like':'%'+_0x54fa73[_0xeff3('0x41')][_0xeff3('0x4b')]+'%'};return _0x4d1b48;}})});}_0xfcdf09=_[_0xeff3('0x4c')]({},_0xfcdf09,_0x54fa73[_0xeff3('0x4d')]);var _0x7dd80b={'where':_0xfcdf09[_0xeff3('0x49')]};return db['ChatQueue'][_0xeff3('0x2d')](_0x7dd80b)[_0xeff3('0x1d')](function(_0x430c6f){_0x4bb6d3[_0xeff3('0x2d')]=_0x430c6f;if(_0x54fa73[_0xeff3('0x41')][_0xeff3('0x4e')]){_0xfcdf09[_0xeff3('0x4f')]=[{'all':!![]}];}return db['ChatQueue'][_0xeff3('0x50')](_0xfcdf09);})[_0xeff3('0x1d')](function(_0x51d582){_0x4bb6d3[_0xeff3('0x51')]=_0x51d582;return _0x4bb6d3;})[_0xeff3('0x1d')](respondWithFilteredResult(_0x5e25cd,_0xfcdf09))[_0xeff3('0x28')](handleError(_0x5e25cd,null));};exports[_0xeff3('0x52')]=function(_0x40f3dc,_0x3f73a9){var _0x3b34c6={'raw':!![],'where':{'id':_0x40f3dc[_0xeff3('0x53')]['id']}},_0x3179cc={};_0x3179cc[_0xeff3('0x40')]=_[_0xeff3('0x42')](db[_0xeff3('0x54')][_0xeff3('0x3c')]);_0x3179cc[_0xeff3('0x41')]=_[_0xeff3('0x42')](_0x40f3dc[_0xeff3('0x41')]);_0x3179cc[_0xeff3('0x43')]=_[_0xeff3('0x55')](_0x3179cc[_0xeff3('0x40')],_0x3179cc['query']);_0x3b34c6['attributes']=_['intersection'](_0x3179cc[_0xeff3('0x40')],qs['fields'](_0x40f3dc[_0xeff3('0x41')][_0xeff3('0x45')]));_0x3b34c6[_0xeff3('0x44')]=_0x3b34c6[_0xeff3('0x44')][_0xeff3('0x46')]?_0x3b34c6[_0xeff3('0x44')]:_0x3179cc[_0xeff3('0x40')];if(_0x40f3dc[_0xeff3('0x41')][_0xeff3('0x4e')]){_0x3b34c6['include']=[{'all':!![]}];}_0x3b34c6=_[_0xeff3('0x4c')]({},_0x3b34c6,_0x40f3dc['options']);return db[_0xeff3('0x54')][_0xeff3('0x56')](_0x3b34c6)['then'](handleEntityNotFound(_0x3f73a9,null))[_0xeff3('0x1d')](respondWithResult(_0x3f73a9,null))['catch'](handleError(_0x3f73a9,null));};exports[_0xeff3('0x57')]=function(_0xa926a7,_0x115b91){return db['ChatQueue']['create'](_0xa926a7['body'],{})['then'](function(_0x14e6a6){var _0x3a1d11=_0xa926a7[_0xeff3('0x58')]['get']({'plain':!![]});if(!_0x3a1d11)throw new Error(_0xeff3('0x59'));if(_0x3a1d11[_0xeff3('0x5a')]==='user'){var _0x1c0450=_0x14e6a6['get']({'plain':!![]});var _0xcfae3c='ChatQueues';return db[_0xeff3('0x5b')][_0xeff3('0x56')]({'where':{'name':_0xcfae3c,'userProfileId':_0x3a1d11[_0xeff3('0x5c')]},'raw':!![]})[_0xeff3('0x1d')](function(_0x3c828f){if(_0x3c828f&&_0x3c828f['autoAssociation']===0x0){return db[_0xeff3('0x5d')][_0xeff3('0x57')]({'name':_0x1c0450['name'],'resourceId':_0x1c0450['id'],'type':_0x3c828f[_0xeff3('0x39')],'sectionId':_0x3c828f['id']},{})[_0xeff3('0x1d')](function(){return _0x14e6a6;});}else{return _0x14e6a6;}})[_0xeff3('0x28')](function(_0x1585a4){logger['error'](_0xeff3('0x5e'),_0x1585a4);throw _0x1585a4;});}return _0x14e6a6;})[_0xeff3('0x1d')](respondWithResult(_0x115b91,0xc9))[_0xeff3('0x28')](handleError(_0x115b91,null));};exports[_0xeff3('0x5f')]=function(_0x92ff59,_0x4cdf02){if(_0x92ff59['body']['id']){delete _0x92ff59[_0xeff3('0x60')]['id'];}return db[_0xeff3('0x54')][_0xeff3('0x56')]({'where':{'id':_0x92ff59[_0xeff3('0x53')]['id']}})['then'](handleEntityNotFound(_0x4cdf02,null))[_0xeff3('0x1d')](saveUpdates(_0x92ff59[_0xeff3('0x60')],null))['then'](respondWithResult(_0x4cdf02,null))['catch'](handleError(_0x4cdf02,null));};exports[_0xeff3('0x34')]=function(_0x490207,_0x2057d5){return db[_0xeff3('0x54')]['find']({'where':{'id':_0x490207['params']['id']}})['then'](handleEntityNotFound(_0x2057d5,null))['then'](removeEntity(_0x2057d5,null))[_0xeff3('0x28')](handleError(_0x2057d5,null));};exports['describe']=function(_0x1d494f,_0x2e1e38){return db[_0xeff3('0x54')][_0xeff3('0x61')]()[_0xeff3('0x1d')](respondWithResult(_0x2e1e38,null))[_0xeff3('0x28')](handleError(_0x2e1e38,null));};exports['getMembers']=function(_0x58652e,_0x33a25d,_0xc9f8c6){var _0x15e509={'raw':!![],'where':{}},_0x1e5041={},_0x5ae338;return db['ChatQueue'][_0xeff3('0x62')]({'where':{'id':_0x58652e[_0xeff3('0x53')]['id']}})[_0xeff3('0x1d')](handleEntityNotFound(_0x33a25d,null))[_0xeff3('0x1d')](function(_0x1f1b5a){if(_0x1f1b5a){_0x5ae338=_0x1f1b5a[_0xeff3('0x35')]({'plain':!![]});_0x1e5041[_0xeff3('0x40')]=_[_0xeff3('0x42')](db[_0xeff3('0x63')][_0xeff3('0x3c')]);_0x1e5041[_0xeff3('0x41')]=_[_0xeff3('0x42')](_0x58652e[_0xeff3('0x41')]);_0x1e5041[_0xeff3('0x43')]=_[_0xeff3('0x55')](_0x1e5041[_0xeff3('0x40')],_0x1e5041[_0xeff3('0x41')]);_0x15e509[_0xeff3('0x44')]=_[_0xeff3('0x55')](_0x1e5041[_0xeff3('0x40')],qs[_0xeff3('0x45')](_0x58652e[_0xeff3('0x41')][_0xeff3('0x45')]));_0x15e509['attributes']=_0x15e509[_0xeff3('0x44')]['length']?_0x15e509['attributes']:_0x1e5041[_0xeff3('0x40')];if(!_0x58652e[_0xeff3('0x41')][_0xeff3('0x64')](_0xeff3('0x47'))){_0x15e509[_0xeff3('0x2e')]=qs[_0xeff3('0x2e')](_0x58652e[_0xeff3('0x41')][_0xeff3('0x2e')]);_0x15e509[_0xeff3('0x2b')]=qs['offset'](_0x58652e[_0xeff3('0x41')][_0xeff3('0x2b')]);}_0x15e509[_0xeff3('0x65')]=qs[_0xeff3('0x48')](_0x58652e[_0xeff3('0x41')]['sort']);_0x15e509[_0xeff3('0x49')]=qs[_0xeff3('0x43')](_['pick'](_0x58652e[_0xeff3('0x41')],_0x1e5041['filters']));_0x15e509[_0xeff3('0x49')]['ChatQueueId']=_0x1f1b5a['id'];if(_0x58652e[_0xeff3('0x41')][_0xeff3('0x4b')]){_0x15e509[_0xeff3('0x49')]=_['merge'](_0x15e509['where'],{'$or':_[_0xeff3('0x3b')](_0x15e509[_0xeff3('0x44')],function(_0x4f27d8){var _0x176599={};_0x176599[_0x4f27d8]={'$like':'%'+_0x58652e[_0xeff3('0x41')][_0xeff3('0x4b')]+'%'};return _0x176599;})});}_0x15e509=_[_0xeff3('0x4c')]({},_0x15e509,_0x58652e[_0xeff3('0x4d')]);return db[_0xeff3('0x63')][_0xeff3('0x50')](_0x15e509);}})[_0xeff3('0x1d')](function(_0x208b0a){if(_0x208b0a){return db[_0xeff3('0x66')][_0xeff3('0x67')]({'where':{'id':_['map'](_0x208b0a,'UserId'),'role':'agent'},'attributes':['id',_0xeff3('0x39'),_0xeff3('0x68'),_0xeff3('0x69'),_0xeff3('0x6a')]});}})[_0xeff3('0x1d')](function(_0x3b5bed){if(_0x3b5bed){return{'count':_0x3b5bed[_0xeff3('0x2d')],'rows':_[_0xeff3('0x3b')](_0x3b5bed[_0xeff3('0x51')],function(_0x5d5b9b){return{'membername':_0x5d5b9b[_0xeff3('0x39')],'UserId':_0x5d5b9b['id'],'queue_name':_0x5ae338['name'],'ChatQueueId':_0x5ae338['id'],'interface':util[_0xeff3('0x6b')](_0xeff3('0x6c'),_0xeff3('0x6d'),_0x5d5b9b[_0xeff3('0x39')]),'penalty':0x0,'paused':_0x5d5b9b[_0xeff3('0x68')],'createdAt':_0x5d5b9b[_0xeff3('0x6a')],'updatedAt':_0x5d5b9b[_0xeff3('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x33a25d,_0x15e509))['catch'](handleError(_0x33a25d,null));};exports['getTeams']=function(_0x24eb32,_0x101615,_0x4b2221){var _0x44d35b={};var _0x46bb3e={};var _0x5e313b;var _0x38333e;return db[_0xeff3('0x54')][_0xeff3('0x62')]({'where':{'id':_0x24eb32[_0xeff3('0x53')]['id']}})[_0xeff3('0x1d')](handleEntityNotFound(_0x101615,null))[_0xeff3('0x1d')](function(_0x274093){if(_0x274093){_0x5e313b=_0x274093;_0x46bb3e['model']=_[_0xeff3('0x42')](db[_0xeff3('0x6e')][_0xeff3('0x3c')]);_0x46bb3e[_0xeff3('0x41')]=_[_0xeff3('0x42')](_0x24eb32[_0xeff3('0x41')]);_0x46bb3e['filters']=_['intersection'](_0x46bb3e['model'],_0x46bb3e['query']);_0x44d35b[_0xeff3('0x44')]=_[_0xeff3('0x55')](_0x46bb3e[_0xeff3('0x40')],qs[_0xeff3('0x45')](_0x24eb32[_0xeff3('0x41')][_0xeff3('0x45')]));_0x44d35b[_0xeff3('0x44')]=_0x44d35b['attributes']['length']?_0x44d35b['attributes']:_0x46bb3e[_0xeff3('0x40')];_0x44d35b[_0xeff3('0x65')]=qs[_0xeff3('0x48')](_0x24eb32['query'][_0xeff3('0x48')]);_0x44d35b[_0xeff3('0x49')]=qs[_0xeff3('0x43')](_[_0xeff3('0x4a')](_0x24eb32[_0xeff3('0x41')],_0x46bb3e['filters']));if(_0x24eb32[_0xeff3('0x41')][_0xeff3('0x4b')]){_0x44d35b[_0xeff3('0x49')]=_[_0xeff3('0x4c')](_0x44d35b[_0xeff3('0x49')],{'$or':_[_0xeff3('0x3b')](_0x44d35b[_0xeff3('0x44')],function(_0x49034f){var _0x549556={};_0x549556[_0x49034f]={'$like':'%'+_0x24eb32['query'][_0xeff3('0x4b')]+'%'};return _0x549556;})});}_0x44d35b=_[_0xeff3('0x4c')]({},_0x44d35b,_0x24eb32[_0xeff3('0x4d')]);return _0x5e313b[_0xeff3('0x6f')](_0x44d35b);}})[_0xeff3('0x1d')](function(_0xe84f5){if(_0xe84f5){_0x38333e=_0xe84f5[_0xeff3('0x46')];if(!_0x24eb32[_0xeff3('0x41')][_0xeff3('0x64')]('nolimit')){_0x44d35b['limit']=qs[_0xeff3('0x2e')](_0x24eb32[_0xeff3('0x41')][_0xeff3('0x2e')]);_0x44d35b[_0xeff3('0x2b')]=qs[_0xeff3('0x2b')](_0x24eb32[_0xeff3('0x41')][_0xeff3('0x2b')]);}return _0x5e313b[_0xeff3('0x6f')](_0x44d35b);}})['then'](function(_0x34389f){if(_0x34389f){return _0x34389f?{'count':_0x38333e,'rows':_0x34389f}:null;}})[_0xeff3('0x1d')](respondWithResult(_0x101615,null))[_0xeff3('0x28')](handleError(_0x101615,null));};exports[_0xeff3('0x70')]=function(_0x22aea3,_0x584d50,_0x2a36c4){var _0x23092b=_0x22aea3[_0xeff3('0x60')][_0xeff3('0x71')];return db[_0xeff3('0x6e')][_0xeff3('0x50')]({'where':{'id':_0x23092b},'attributes':['id'],'include':[{'model':db[_0xeff3('0x66')],'as':_0xeff3('0x72'),'attributes':['id',_0xeff3('0x39'),_0xeff3('0x73'),_0xeff3('0x74'),'interface'],'raw':!![]}]})[_0xeff3('0x1d')](function(_0x3b7273){if(_0x3b7273){var _0x5de780=_[_0xeff3('0x75')](_0x3b7273,function(_0x3c4e5e){var _0x162c45=_0x3c4e5e[_0xeff3('0x35')]({'plain':!![]});return _0x162c45[_0xeff3('0x72')];});return db[_0xeff3('0x54')]['find']({'where':{'id':_0x22aea3[_0xeff3('0x53')]['id']}})[_0xeff3('0x1d')](function(_0x270459){return db[_0xeff3('0x76')][_0xeff3('0x77')](function(_0x11b8d6){return _0x270459[_0xeff3('0x70')](_0x23092b,{'transaction':_0x11b8d6})[_0xeff3('0x1d')](function(){return BPromise[_0xeff3('0x78')](_0x5de780,function(_0x4c7e59){return db['UserChatQueue'][_0xeff3('0x79')]({'where':{'UserId':_0x4c7e59['id'],'ChatQueueId':_0x22aea3['params']['id']},'transaction':_0x11b8d6});});})[_0xeff3('0x1d')](function(){_0x5de780[_0xeff3('0x7a')](function(_0x3f1f8c){socket[_0xeff3('0x7b')](_0xeff3('0x7c'),{'UserId':_0x3f1f8c['id'],'ChatQueueId':_0x270459['id']});});});});});}})['then'](respondWithStatusCode(_0x584d50,null))[_0xeff3('0x28')](handleError(_0x584d50,null));};exports['removeTeams']=function(_0x6b19a,_0xc70d19,_0x32043c){return db[_0xeff3('0x6e')][_0xeff3('0x50')]({'where':{'id':_0x6b19a[_0xeff3('0x41')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeff3('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeff3('0x1d')](handleEntityNotFound(_0xc70d19,null))[_0xeff3('0x1d')](function(_0x1a4d78){var _0x5975ca=_[_0xeff3('0x3b')](_0x1a4d78,'id');var _0x122dbd=[];var _0x166bd7=[];var _0x3017ff=squel[_0xeff3('0x7d')]();_0x3017ff[_0xeff3('0x7e')](_0xeff3('0x7f'))[_0xeff3('0x80')](_0xeff3('0x81'),'tq')['join'](_0xeff3('0x82'),'ut',_0xeff3('0x83'))[_0xeff3('0x49')](_0xeff3('0x84'),_0x6b19a[_0xeff3('0x53')]['id']);for(var _0x37fe28=0x0;_0x37fe28<_0x1a4d78[_0xeff3('0x46')];_0x37fe28+=0x1){let _0x1b4831=_0x1a4d78[_0x37fe28];for(var _0x2e52f2=0x0;_0x2e52f2<_0x1b4831[_0xeff3('0x72')][_0xeff3('0x46')];_0x2e52f2+=0x1){let _0x778f26=_0x1b4831[_0xeff3('0x72')][_0x2e52f2];var _0x3d4dcb=_0x3017ff[_0xeff3('0x85')]();_0x3d4dcb['where'](_0xeff3('0x86'),_0x778f26['id']);_0x166bd7[_0xeff3('0x87')](db['sequelize']['query'](_0x3d4dcb[_0xeff3('0x88')](),{'type':db[_0xeff3('0x76')][_0xeff3('0x89')][_0xeff3('0x8a')]})[_0xeff3('0x1d')](function(_0x56fb70){if(_0x56fb70[_0xeff3('0x46')]===0x1){return _0x778f26['id'];}else{var _0x4ae298=_['every'](_[_0xeff3('0x3b')](_0x56fb70,_0xeff3('0x8b')),function(_0x5366df){return _[_0xeff3('0x8c')](_0x5975ca,_0x5366df);});if(_0x4ae298){return _0x778f26['id'];}}}));}}return BPromise[_0xeff3('0x8d')](_0x166bd7)['then'](function(_0x5d4c1c){_0x122dbd=_(_0x122dbd)['union'](_0x5d4c1c)['compact']()['value']();return db[_0xeff3('0x54')][_0xeff3('0x56')]({'where':{'id':_0x6b19a[_0xeff3('0x53')]['id']}})[_0xeff3('0x1d')](function(_0x3c966b){return db[_0xeff3('0x76')]['transaction'](function(_0x1e4eb7){return _0x3c966b[_0xeff3('0x8e')](_0x6b19a['query'][_0xeff3('0x71')],{'transaction':_0x1e4eb7})[_0xeff3('0x1d')](function(){if(!_['isEmpty'](_0x122dbd)){return _0x3c966b[_0xeff3('0x8f')](_0x122dbd,{'transaction':_0x1e4eb7});}})[_0xeff3('0x1d')](function(){_0x122dbd[_0xeff3('0x7a')](function(_0x90d922){socket[_0xeff3('0x7b')](_0xeff3('0x90'),{'UserId':_0x90d922,'ChatQueueId':_0x3c966b['id']});});});});});});})[_0xeff3('0x1d')](respondWithStatusCode(_0xc70d19,null))[_0xeff3('0x28')](handleError(_0xc70d19,null));};exports[_0xeff3('0x91')]=function(_0xb673d2,_0x5ee67d,_0x173d7a){return db[_0xeff3('0x54')][_0xeff3('0x56')]({'where':{'id':_0xb673d2['params']['id']}})[_0xeff3('0x1d')](handleEntityNotFound(_0x5ee67d,null))[_0xeff3('0x1d')](function(_0x4a6768){if(_0x4a6768){return _0x4a6768['addAgents'](_0xb673d2[_0xeff3('0x60')][_0xeff3('0x71')],_[_0xeff3('0x92')](_0xb673d2[_0xeff3('0x60')],['ids','id'])||{})['spread'](function(_0xd809e4){for(var _0x432f74=0x0;_0x432f74<_0xb673d2[_0xeff3('0x60')][_0xeff3('0x71')]['length'];_0x432f74+=0x1){socket[_0xeff3('0x7b')](_0xeff3('0x7c'),{'UserId':Number(_0xb673d2[_0xeff3('0x60')][_0xeff3('0x71')][_0x432f74]),'ChatQueueId':Number(_0xb673d2[_0xeff3('0x53')]['id'])});}return _0xd809e4;});}})[_0xeff3('0x1d')](respondWithResult(_0x5ee67d,null))['catch'](handleError(_0x5ee67d,null));};exports[_0xeff3('0x8f')]=function(_0x32ff39,_0x45381d,_0x3ee277){return db['ChatQueue'][_0xeff3('0x56')]({'where':{'id':_0x32ff39['params']['id']}})['then'](handleEntityNotFound(_0x45381d,null))[_0xeff3('0x1d')](function(_0x533653){if(_0x533653){return _0x533653[_0xeff3('0x8f')](_0x32ff39[_0xeff3('0x41')][_0xeff3('0x71')])['then'](function(){if(_[_0xeff3('0x93')](_0x32ff39['query'][_0xeff3('0x71')])){for(var _0x11801e=0x0;_0x11801e<_0x32ff39[_0xeff3('0x41')]['ids'][_0xeff3('0x46')];_0x11801e+=0x1){socket['emit'](_0xeff3('0x90'),{'UserId':Number(_0x32ff39[_0xeff3('0x41')][_0xeff3('0x71')][_0x11801e]),'ChatQueueId':Number(_0x32ff39['params']['id'])});}}else{socket[_0xeff3('0x7b')](_0xeff3('0x90'),{'UserId':Number(_0x32ff39[_0xeff3('0x41')]['ids']),'ChatQueueId':Number(_0x32ff39[_0xeff3('0x53')]['id'])});}});}})[_0xeff3('0x1d')](respondWithStatusCode(_0x45381d,null))[_0xeff3('0x28')](handleError(_0x45381d,null));};exports[_0xeff3('0x94')]=function(_0x2dbe10,_0x12da2c,_0x34a94b){var _0x55e5aa={};var _0x8447e4={};var _0x480717;var _0x2b6d9f;return db[_0xeff3('0x54')]['findOne']({'where':{'id':_0x2dbe10['params']['id']}})[_0xeff3('0x1d')](handleEntityNotFound(_0x12da2c,null))[_0xeff3('0x1d')](function(_0xd82d75){if(_0xd82d75){_0x480717=_0xd82d75;_0x8447e4[_0xeff3('0x40')]=_[_0xeff3('0x42')](db[_0xeff3('0x66')]['rawAttributes']);_0x8447e4[_0xeff3('0x41')]=_[_0xeff3('0x42')](_0x2dbe10[_0xeff3('0x41')]);_0x8447e4[_0xeff3('0x43')]=_[_0xeff3('0x55')](_0x8447e4['model'],_0x8447e4[_0xeff3('0x41')]);_0x55e5aa[_0xeff3('0x44')]=_['intersection'](_0x8447e4[_0xeff3('0x40')],qs['fields'](_0x2dbe10[_0xeff3('0x41')][_0xeff3('0x45')]));_0x55e5aa[_0xeff3('0x44')]=_0x55e5aa[_0xeff3('0x44')][_0xeff3('0x46')]?_0x55e5aa[_0xeff3('0x44')]:_0x8447e4[_0xeff3('0x40')];_0x55e5aa[_0xeff3('0x65')]=qs['sort'](_0x2dbe10['query']['sort']);_0x55e5aa['where']=qs['filters'](_['pick'](_0x2dbe10[_0xeff3('0x41')],_0x8447e4['filters']));if(_0x2dbe10[_0xeff3('0x41')][_0xeff3('0x4b')]){_0x55e5aa[_0xeff3('0x49')]=_['merge'](_0x55e5aa[_0xeff3('0x49')],{'$or':_[_0xeff3('0x3b')](_0x55e5aa[_0xeff3('0x44')],function(_0x764a9){var _0x1165f8={};_0x1165f8[_0x764a9]={'$like':'%'+_0x2dbe10['query']['filter']+'%'};return _0x1165f8;})});}_0x55e5aa=_[_0xeff3('0x4c')]({},_0x55e5aa,_0x2dbe10[_0xeff3('0x4d')]);return _0x480717[_0xeff3('0x94')](_0x55e5aa);}})[_0xeff3('0x1d')](function(_0x2de0c4){if(_0x2de0c4){_0x2b6d9f=_0x2de0c4[_0xeff3('0x46')];if(!_0x2dbe10[_0xeff3('0x41')][_0xeff3('0x64')](_0xeff3('0x47'))){_0x55e5aa['limit']=qs[_0xeff3('0x2e')](_0x2dbe10[_0xeff3('0x41')][_0xeff3('0x2e')]);_0x55e5aa[_0xeff3('0x2b')]=qs['offset'](_0x2dbe10[_0xeff3('0x41')][_0xeff3('0x2b')]);}return _0x480717[_0xeff3('0x94')](_0x55e5aa);}})[_0xeff3('0x1d')](function(_0x221cd3){if(_0x221cd3){return _0x221cd3?{'count':_0x2b6d9f,'rows':_0x221cd3}:null;}})[_0xeff3('0x1d')](respondWithResult(_0x12da2c,null))[_0xeff3('0x28')](handleError(_0x12da2c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 55fa0df..275d9df 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 _0x3e9e=['events','ChatQueue','hasOwnProperty','hook','exports'];(function(_0x3b59d5,_0x1e23f2){var _0x30cc91=function(_0x54815d){while(--_0x54815d){_0x3b59d5['push'](_0x3b59d5['shift']());}};_0x30cc91(++_0x1e23f2);}(_0x3e9e,0x91));var _0xe3e9=function(_0xe10194,_0x7ff838){_0xe10194=_0xe10194-0x0;var _0x2369cf=_0x3e9e[_0xe10194];return _0x2369cf;};'use strict';var EventEmitter=require(_0xe3e9('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe3e9('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x229cee){return function(_0x1846d6,_0x334206,_0x455c8f){ChatQueueEvents['emit'](_0x229cee+':'+_0x1846d6['id'],_0x1846d6);ChatQueueEvents['emit'](_0x229cee,_0x1846d6);_0x455c8f(null);};}for(var e in events){if(events[_0xe3e9('0x2')](e)){var event=events[e];ChatQueue[_0xe3e9('0x3')](e,emitEvent(event));}}module[_0xe3e9('0x4')]=ChatQueueEvents; \ No newline at end of file +var _0x4e20=['hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x1448f6,_0x1371e3){var _0x4f33b1=function(_0x54c714){while(--_0x54c714){_0x1448f6['push'](_0x1448f6['shift']());}};_0x4f33b1(++_0x1371e3);}(_0x4e20,0x173));var _0x04e2=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x4e20[_0x381379];return _0x3e1063;};'use strict';var EventEmitter=require(_0x04e2('0x0'));var ChatQueue=require(_0x04e2('0x1'))['db'][_0x04e2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x04e2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x04e2('0x4'),'afterDestroy':_0x04e2('0x5')};function emitEvent(_0x493a9d){return function(_0x768f59,_0xc4d606,_0x1f757b){ChatQueueEvents['emit'](_0x493a9d+':'+_0x768f59['id'],_0x768f59);ChatQueueEvents['emit'](_0x493a9d,_0x768f59);_0x1f757b(null);};}for(var e in events){if(events[_0x04e2('0x6')](e)){var event=events[e];ChatQueue[_0x04e2('0x7')](e,emitEvent(event));}}module[_0x04e2('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 57830a0..d87a437 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 _0x7287=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4a247e,_0x2099a7){var _0x30a6ca=function(_0x7397cc){while(--_0x7397cc){_0x4a247e['push'](_0x4a247e['shift']());}};_0x30a6ca(++_0x2099a7);}(_0x7287,0x96));var _0x7728=function(_0xebfd56,_0x5967f1){_0xebfd56=_0xebfd56-0x0;var _0x4cb58e=_0x7287[_0xebfd56];return _0x4cb58e;};'use strict';var _=require(_0x7728('0x0'));var util=require(_0x7728('0x1'));var logger=require(_0x7728('0x2'))(_0x7728('0x3'));var moment=require('moment');var BPromise=require(_0x7728('0x4'));var rp=require(_0x7728('0x5'));var fs=require('fs');var path=require(_0x7728('0x6'));var rimraf=require(_0x7728('0x7'));var config=require(_0x7728('0x8'));var attributes=require(_0x7728('0x9'));module[_0x7728('0xa')]=function(_0x5f1233,_0x29e53b){return _0x5f1233[_0x7728('0xb')](_0x7728('0xc'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x201d=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x3d6cc0,_0x31cb2c){var _0x32e7ff=function(_0xf5a8d3){while(--_0xf5a8d3){_0x3d6cc0['push'](_0x3d6cc0['shift']());}};_0x32e7ff(++_0x31cb2c);}(_0x201d,0xd0));var _0xd201=function(_0x3147f3,_0x255510){_0x3147f3=_0x3147f3-0x0;var _0x130fd0=_0x201d[_0x3147f3];return _0x130fd0;};'use strict';var _=require(_0xd201('0x0'));var util=require(_0xd201('0x1'));var logger=require(_0xd201('0x2'))(_0xd201('0x3'));var moment=require('moment');var BPromise=require(_0xd201('0x4'));var rp=require(_0xd201('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd201('0x6'));var config=require(_0xd201('0x7'));var attributes=require(_0xd201('0x8'));module[_0xd201('0x9')]=function(_0x37320f,_0x1f7962){return _0x37320f[_0xd201('0xa')](_0xd201('0xb'),attributes,{'tableName':_0xd201('0xc'),'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 b768b0e..1f59d21 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 _0xd027=['limit','include','map','model','ShowChatQueue','find','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes'];(function(_0x3adb53,_0x344e17){var _0x36be40=function(_0x2dc6f5){while(--_0x2dc6f5){_0x3adb53['push'](_0x3adb53['shift']());}};_0x36be40(++_0x344e17);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7d02('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7d02('0x1'));var fs=require('fs');var Redis=require(_0x7d02('0x2'));var db=require(_0x7d02('0x3'))['db'];var utils=require(_0x7d02('0x4'));var logger=require(_0x7d02('0x5'))(_0x7d02('0x6'));var config=require(_0x7d02('0x7'));var jayson=require(_0x7d02('0x8'));var client=jayson['client'][_0x7d02('0x9')]({'port':0x232a});config[_0x7d02('0xa')]=_[_0x7d02('0xb')](config[_0x7d02('0xa')],{'host':_0x7d02('0xc'),'port':0x18eb});var socket=require(_0x7d02('0xd'))(new Redis(config[_0x7d02('0xa')]));require(_0x7d02('0xe'))[_0x7d02('0xf')](socket);function respondWithRpcPromise(_0x37217c,_0x21abe5,_0x3bfc73){return new BPromise(function(_0x259517,_0x55b35a){return client[_0x7d02('0x10')](_0x37217c,_0x3bfc73)[_0x7d02('0x11')](function(_0x5eefcd){logger[_0x7d02('0x12')](_0x7d02('0x13'),_0x21abe5,_0x7d02('0x14'));logger[_0x7d02('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x21abe5,_0x7d02('0x14'),JSON['stringify'](_0x5eefcd));if(_0x5eefcd[_0x7d02('0x16')]){if(_0x5eefcd[_0x7d02('0x16')]['code']===0x1f4){logger[_0x7d02('0x16')](_0x7d02('0x13'),_0x21abe5,_0x5eefcd['error'][_0x7d02('0x17')]);return _0x55b35a(_0x5eefcd[_0x7d02('0x16')][_0x7d02('0x17')]);}logger['error'](_0x7d02('0x13'),_0x21abe5,_0x5eefcd[_0x7d02('0x16')][_0x7d02('0x17')]);return _0x259517(_0x5eefcd[_0x7d02('0x16')][_0x7d02('0x17')]);}else{logger[_0x7d02('0x12')](_0x7d02('0x13'),_0x21abe5,_0x7d02('0x14'));_0x259517(_0x5eefcd[_0x7d02('0x18')][_0x7d02('0x17')]);}})[_0x7d02('0x19')](function(_0x1168c0){logger[_0x7d02('0x16')](_0x7d02('0x13'),_0x21abe5,_0x1168c0);_0x55b35a(_0x1168c0);});});}exports[_0x7d02('0x1a')]=function(_0x82a804){var _0x579565=this;return new Promise(function(_0x41c538,_0x152291){return db[_0x7d02('0x1b')][_0x7d02('0x1c')]({'raw':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x1e')]===undefined?!![]:![]:!![],'where':_0x82a804['options']?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x1f')]||null:null,'attributes':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x20')]||null:null,'limit':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x21')]||null:null,'include':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x22')]?_['map'](_0x82a804[_0x7d02('0x1d')][_0x7d02('0x22')],function(_0xe81f55){return{'model':db[_0xe81f55['model']],'as':_0xe81f55['as'],'attributes':_0xe81f55['attributes'],'include':_0xe81f55[_0x7d02('0x22')]?_[_0x7d02('0x23')](_0xe81f55[_0x7d02('0x22')],function(_0x478506){return{'model':db[_0x478506[_0x7d02('0x24')]],'as':_0x478506['as'],'attributes':_0x478506[_0x7d02('0x20')],'include':_0x478506[_0x7d02('0x22')]?_[_0x7d02('0x23')](_0x478506['include'],function(_0x5b94c8){return{'model':db[_0x5b94c8['model']],'as':_0x5b94c8['as'],'attributes':_0x5b94c8[_0x7d02('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d02('0x11')](function(_0x2d6132){logger[_0x7d02('0x12')]('GetChatQueue',_0x82a804);logger[_0x7d02('0x15')]('GetChatQueue',_0x82a804,JSON['stringify'](_0x2d6132));_0x41c538(_0x2d6132);})[_0x7d02('0x19')](function(_0x7a05c6){logger[_0x7d02('0x16')](_0x7d02('0x1a'),_0x7a05c6['message'],_0x82a804);_0x152291(_0x579565[_0x7d02('0x16')](0x1f4,_0x7a05c6[_0x7d02('0x17')]));});});};exports[_0x7d02('0x25')]=function(_0x4bac3e){var _0x868f7e=this;return new Promise(function(_0x3aaa05,_0x22cf7e){return db[_0x7d02('0x1b')][_0x7d02('0x26')]({'raw':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e[_0x7d02('0x1d')][_0x7d02('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e[_0x7d02('0x1d')][_0x7d02('0x1f')]||null:null,'attributes':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e['options'][_0x7d02('0x20')]||null:null,'include':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e[_0x7d02('0x1d')][_0x7d02('0x22')]?_['map'](_0x4bac3e['options'][_0x7d02('0x22')],function(_0x4dfe91){return{'model':db[_0x4dfe91['model']],'as':_0x4dfe91['as'],'attributes':_0x4dfe91[_0x7d02('0x20')],'include':_0x4dfe91['include']?_['map'](_0x4dfe91[_0x7d02('0x22')],function(_0x4841cc){return{'model':db[_0x4841cc[_0x7d02('0x24')]],'as':_0x4841cc['as'],'attributes':_0x4841cc['attributes'],'include':_0x4841cc[_0x7d02('0x22')]?_['map'](_0x4841cc[_0x7d02('0x22')],function(_0x1b1037){return{'model':db[_0x1b1037[_0x7d02('0x24')]],'as':_0x1b1037['as'],'attributes':_0x1b1037['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x388842){logger[_0x7d02('0x12')](_0x7d02('0x25'),_0x4bac3e);logger[_0x7d02('0x15')](_0x7d02('0x25'),_0x4bac3e,JSON[_0x7d02('0x27')](_0x388842));_0x3aaa05(_0x388842);})[_0x7d02('0x19')](function(_0x46c843){logger[_0x7d02('0x16')](_0x7d02('0x25'),_0x46c843[_0x7d02('0x17')],_0x4bac3e);_0x22cf7e(_0x868f7e['error'](0x1f4,_0x46c843['message']));});});}; \ No newline at end of file +var _0x57fa=['include','model','map','debug','stringify','ShowChatQueue','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes'];(function(_0x2fcd0c,_0xe4db7d){var _0x18230c=function(_0x1f036e){while(--_0x1f036e){_0x2fcd0c['push'](_0x2fcd0c['shift']());}};_0x18230c(++_0xe4db7d);}(_0x57fa,0x127));var _0xa57f=function(_0x407c27,_0x2ae777){_0x407c27=_0x407c27-0x0;var _0x5e40df=_0x57fa[_0x407c27];return _0x5e40df;};'use strict';var _=require(_0xa57f('0x0'));var util=require(_0xa57f('0x1'));var moment=require('moment');var BPromise=require(_0xa57f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa57f('0x3'));var db=require(_0xa57f('0x4'))['db'];var utils=require(_0xa57f('0x5'));var logger=require(_0xa57f('0x6'))(_0xa57f('0x7'));var config=require(_0xa57f('0x8'));var jayson=require(_0xa57f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xa57f('0xa')]=_['defaults'](config[_0xa57f('0xa')],{'host':_0xa57f('0xb'),'port':0x18eb});var socket=require(_0xa57f('0xc'))(new Redis(config[_0xa57f('0xa')]));require(_0xa57f('0xd'))['register'](socket);function respondWithRpcPromise(_0x120138,_0x3dfc9e,_0x422a38){return new BPromise(function(_0x686d87,_0x592b84){return client['request'](_0x120138,_0x422a38)[_0xa57f('0xe')](function(_0x226ab7){logger[_0xa57f('0xf')](_0xa57f('0x10'),_0x3dfc9e,'request\x20sent');logger['debug'](_0xa57f('0x11'),_0x3dfc9e,_0xa57f('0x12'),JSON['stringify'](_0x226ab7));if(_0x226ab7[_0xa57f('0x13')]){if(_0x226ab7['error']['code']===0x1f4){logger[_0xa57f('0x13')]('ChatQueue,\x20%s,\x20%s',_0x3dfc9e,_0x226ab7[_0xa57f('0x13')]['message']);return _0x592b84(_0x226ab7[_0xa57f('0x13')][_0xa57f('0x14')]);}logger[_0xa57f('0x13')](_0xa57f('0x10'),_0x3dfc9e,_0x226ab7['error']['message']);return _0x686d87(_0x226ab7[_0xa57f('0x13')][_0xa57f('0x14')]);}else{logger[_0xa57f('0xf')]('ChatQueue,\x20%s,\x20%s',_0x3dfc9e,_0xa57f('0x12'));_0x686d87(_0x226ab7[_0xa57f('0x15')][_0xa57f('0x14')]);}})['catch'](function(_0x1ffa06){logger[_0xa57f('0x13')](_0xa57f('0x10'),_0x3dfc9e,_0x1ffa06);_0x592b84(_0x1ffa06);});});}exports[_0xa57f('0x16')]=function(_0x1b0587){var _0x46038a=this;return new Promise(function(_0x4fd4f4,_0x37c294){return db[_0xa57f('0x17')][_0xa57f('0x18')]({'raw':_0x1b0587[_0xa57f('0x19')]?_0x1b0587[_0xa57f('0x19')][_0xa57f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b0587[_0xa57f('0x19')]?_0x1b0587[_0xa57f('0x19')][_0xa57f('0x1b')]||null:null,'attributes':_0x1b0587[_0xa57f('0x19')]?_0x1b0587['options'][_0xa57f('0x1c')]||null:null,'limit':_0x1b0587['options']?_0x1b0587[_0xa57f('0x19')]['limit']||null:null,'include':_0x1b0587[_0xa57f('0x19')]?_0x1b0587[_0xa57f('0x19')][_0xa57f('0x1d')]?_['map'](_0x1b0587['options'][_0xa57f('0x1d')],function(_0x4470e8){return{'model':db[_0x4470e8[_0xa57f('0x1e')]],'as':_0x4470e8['as'],'attributes':_0x4470e8['attributes'],'include':_0x4470e8[_0xa57f('0x1d')]?_[_0xa57f('0x1f')](_0x4470e8[_0xa57f('0x1d')],function(_0x14e241){return{'model':db[_0x14e241[_0xa57f('0x1e')]],'as':_0x14e241['as'],'attributes':_0x14e241[_0xa57f('0x1c')],'include':_0x14e241[_0xa57f('0x1d')]?_[_0xa57f('0x1f')](_0x14e241[_0xa57f('0x1d')],function(_0x13b5c1){return{'model':db[_0x13b5c1[_0xa57f('0x1e')]],'as':_0x13b5c1['as'],'attributes':_0x13b5c1[_0xa57f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa57f('0xe')](function(_0x1ef2e1){logger['info'](_0xa57f('0x16'),_0x1b0587);logger[_0xa57f('0x20')](_0xa57f('0x16'),_0x1b0587,JSON[_0xa57f('0x21')](_0x1ef2e1));_0x4fd4f4(_0x1ef2e1);})['catch'](function(_0x3c1c9a){logger[_0xa57f('0x13')](_0xa57f('0x16'),_0x3c1c9a[_0xa57f('0x14')],_0x1b0587);_0x37c294(_0x46038a[_0xa57f('0x13')](0x1f4,_0x3c1c9a[_0xa57f('0x14')]));});});};exports['ShowChatQueue']=function(_0x408dc3){var _0x38290b=this;return new Promise(function(_0x3f44af,_0x1fab3e){return db['ChatQueue']['find']({'raw':_0x408dc3[_0xa57f('0x19')]?_0x408dc3['options'][_0xa57f('0x1a')]===undefined?!![]:![]:!![],'where':_0x408dc3[_0xa57f('0x19')]?_0x408dc3['options'][_0xa57f('0x1b')]||null:null,'attributes':_0x408dc3[_0xa57f('0x19')]?_0x408dc3[_0xa57f('0x19')][_0xa57f('0x1c')]||null:null,'include':_0x408dc3['options']?_0x408dc3[_0xa57f('0x19')]['include']?_['map'](_0x408dc3[_0xa57f('0x19')][_0xa57f('0x1d')],function(_0x215438){return{'model':db[_0x215438[_0xa57f('0x1e')]],'as':_0x215438['as'],'attributes':_0x215438[_0xa57f('0x1c')],'include':_0x215438['include']?_[_0xa57f('0x1f')](_0x215438['include'],function(_0x4caed8){return{'model':db[_0x4caed8[_0xa57f('0x1e')]],'as':_0x4caed8['as'],'attributes':_0x4caed8[_0xa57f('0x1c')],'include':_0x4caed8[_0xa57f('0x1d')]?_[_0xa57f('0x1f')](_0x4caed8[_0xa57f('0x1d')],function(_0x166c50){return{'model':db[_0x166c50[_0xa57f('0x1e')]],'as':_0x166c50['as'],'attributes':_0x166c50[_0xa57f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa57f('0xe')](function(_0x52c87f){logger[_0xa57f('0xf')](_0xa57f('0x22'),_0x408dc3);logger[_0xa57f('0x20')]('ShowChatQueue',_0x408dc3,JSON[_0xa57f('0x21')](_0x52c87f));_0x3f44af(_0x52c87f);})[_0xa57f('0x23')](function(_0x514bfc){logger[_0xa57f('0x13')](_0xa57f('0x22'),_0x514bfc['message'],_0x408dc3);_0x1fab3e(_0x38290b[_0xa57f('0x13')](0x1f4,_0x514bfc[_0xa57f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d36cac8..88ad5b9 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 _0x425d=['./chatQueue.events','remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x425d,0x1e0));var _0xd425=function(_0x1e1818,_0x5bb131){_0x1e1818=_0x1e1818-0x0;var _0x5c7561=_0x425d[_0x1e1818];return _0x5c7561;};'use strict';var ChatQueueEvents=require(_0xd425('0x0'));var events=['save',_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x314a2b,_0x97e370){return function(_0x183caa){_0x97e370[_0xd425('0x3')](_0x314a2b,_0x183caa);};}function removeListener(_0x47043f,_0x596be7){return function(){ChatQueueEvents[_0xd425('0x4')](_0x47043f,_0x596be7);};}exports[_0xd425('0x5')]=function(_0xc4e080){for(var _0x36866e=0x0,_0x1d97d9=events[_0xd425('0x6')];_0x36866e<_0x1d97d9;_0x36866e++){var _0x50b061=events[_0x36866e];var _0xb6ba8e=createListener(_0xd425('0x7')+_0x50b061,_0xc4e080);ChatQueueEvents['on'](_0x50b061,_0xb6ba8e);}}; \ No newline at end of file +var _0xda55=['chatQueue:','./chatQueue.events','save','emit','removeListener','length'];(function(_0x12986b,_0x5b7f7b){var _0x37aa08=function(_0x2da2b3){while(--_0x2da2b3){_0x12986b['push'](_0x12986b['shift']());}};_0x37aa08(++_0x5b7f7b);}(_0xda55,0x6d));var _0x5da5=function(_0x5e7bd1,_0x3634dd){_0x5e7bd1=_0x5e7bd1-0x0;var _0x33d089=_0xda55[_0x5e7bd1];return _0x33d089;};'use strict';var ChatQueueEvents=require(_0x5da5('0x0'));var events=[_0x5da5('0x1'),'remove','update'];function createListener(_0x13ecbc,_0x240a49){return function(_0x26a443){_0x240a49[_0x5da5('0x2')](_0x13ecbc,_0x26a443);};}function removeListener(_0x1c3afd,_0x5da254){return function(){ChatQueueEvents[_0x5da5('0x3')](_0x1c3afd,_0x5da254);};}exports['register']=function(_0x356a37){for(var _0x58e7b3=0x0,_0x2fd877=events[_0x5da5('0x4')];_0x58e7b3<_0x2fd877;_0x58e7b3++){var _0x71b187=events[_0x58e7b3];var _0x46290d=createListener(_0x5da5('0x5')+_0x71b187,_0x356a37);ChatQueueEvents['on'](_0x71b187,_0x46290d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 672e856..00f1288 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x23f615,_0xc4a2e8){var _0x3e7474=function(_0xe3ede1){while(--_0xe3ede1){_0x23f615['push'](_0x23f615['shift']());}};_0x3e7474(++_0xc4a2e8);}(_0x7217,0x19e));var _0x7721=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x7217[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x2e776e,_0x158737){var _0x33c626=function(_0x44682b){while(--_0x44682b){_0x2e776e['push'](_0x2e776e['shift']());}};_0x33c626(++_0x158737);}(_0x814b,0x1a2));var _0xb814=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x814b[_0x30c2ae];return _0x1ee1cc;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);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 785260c..7baf069 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 _0xe3ab=['exports','STRING','DATE','moment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xe3ab,0x8b));var _0xbe3a=function(_0x2c52cd,_0x17bf79){_0x2c52cd=_0x2c52cd-0x0;var _0x432dd5=_0xe3ab[_0x2c52cd];return _0x432dd5;};'use strict';var moment=require(_0xbe3a('0x0'));var Sequelize=require('sequelize');module[_0xbe3a('0x1')]={'uniqueid':{'type':Sequelize[_0xbe3a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbe3a('0x2')]},'joinAt':{'type':Sequelize[_0xbe3a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbe3a('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbe3a('0x2')]}}; \ No newline at end of file +var _0x197d=['sequelize','exports','STRING','DATE'];(function(_0x581e8f,_0x5a7b55){var _0x16d53d=function(_0x502fb9){while(--_0x502fb9){_0x581e8f['push'](_0x581e8f['shift']());}};_0x16d53d(++_0x5a7b55);}(_0x197d,0x1e8));var _0xd197=function(_0x1bc5a0,_0x20066b){_0x1bc5a0=_0x1bc5a0-0x0;var _0x528001=_0x197d[_0x1bc5a0];return _0x528001;};'use strict';var moment=require('moment');var Sequelize=require(_0xd197('0x0'));module[_0xd197('0x1')]={'uniqueid':{'type':Sequelize[_0xd197('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd197('0x2')]},'joinAt':{'type':Sequelize[_0xd197('0x3')]},'leaveAt':{'type':Sequelize[_0xd197('0x3')]},'acceptAt':{'type':Sequelize[_0xd197('0x3')]},'exitAt':{'type':Sequelize[_0xd197('0x3')]},'reason':{'type':Sequelize[_0xd197('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index a69fdd7..3658109 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 _0x9120=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x9120,0x1b3));var _0x0912=function(_0x5ef8d8,_0x3d70a2){_0x5ef8d8=_0x5ef8d8-0x0;var _0x21cd90=_0x9120[_0x5ef8d8];return _0x21cd90;};'use strict';var emlformat=require(_0x0912('0x0'));var rimraf=require(_0x0912('0x1'));var zipdir=require(_0x0912('0x2'));var jsonpatch=require(_0x0912('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0912('0x4'));var Mustache=require(_0x0912('0x5'));var util=require(_0x0912('0x6'));var path=require(_0x0912('0x7'));var sox=require(_0x0912('0x8'));var csv=require(_0x0912('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0912('0xa'));var _=require(_0x0912('0xb'));var squel=require(_0x0912('0xc'));var crypto=require('crypto');var jsforce=require(_0x0912('0xd'));var deskjs=require(_0x0912('0xe'));var toCsv=require(_0x0912('0x9'));var querystring=require(_0x0912('0xf'));var Papa=require(_0x0912('0x10'));var Redis=require('ioredis');var authService=require(_0x0912('0x11'));var qs=require(_0x0912('0x12'));var as=require(_0x0912('0x13'));var hardwareService=require(_0x0912('0x14'));var logger=require('../../config/logger')(_0x0912('0x15'));var utils=require('../../config/utils');var config=require(_0x0912('0x16'));var licenseUtil=require(_0x0912('0x17'));var db=require(_0x0912('0x18'))['db'];function respondWithStatusCode(_0xc7af62,_0x22752b){_0x22752b=_0x22752b||0xcc;return function(_0x10faac){if(_0x10faac){return _0xc7af62[_0x0912('0x19')](_0x22752b);}return _0xc7af62[_0x0912('0x1a')](_0x22752b)[_0x0912('0x1b')]();};}function respondWithResult(_0x102468,_0x17f22d){_0x17f22d=_0x17f22d||0xc8;return function(_0x350d6b){if(_0x350d6b){return _0x102468[_0x0912('0x1a')](_0x17f22d)[_0x0912('0x1c')](_0x350d6b);}};}function respondWithFilteredResult(_0x247612,_0x5eb1c9){return function(_0x4d00fd){if(_0x4d00fd){var _0x1ed3e8=typeof _0x5eb1c9['offset']===_0x0912('0x1d')&&typeof _0x5eb1c9['limit']===_0x0912('0x1d');var _0x49b581=_0x4d00fd[_0x0912('0x1e')];var _0x5eace1=_0x1ed3e8?0x0:_0x5eb1c9[_0x0912('0x1f')];var _0x5357db=_0x1ed3e8?_0x4d00fd[_0x0912('0x1e')]:_0x5eb1c9['offset']+_0x5eb1c9['limit'];var _0x3377af;if(_0x5357db>=_0x49b581){_0x5357db=_0x49b581;_0x3377af=0xc8;}else{_0x3377af=0xce;}_0x247612['status'](_0x3377af);return _0x247612[_0x0912('0x20')](_0x0912('0x21'),_0x5eace1+'-'+_0x5357db+'/'+_0x49b581)['json'](_0x4d00fd);}return null;};}function patchUpdates(_0x106008){return function(_0xb1af32){try{jsonpatch[_0x0912('0x22')](_0xb1af32,_0x106008,!![]);}catch(_0x5927d2){return BPromise['reject'](_0x5927d2);}return _0xb1af32[_0x0912('0x23')]();};}function saveUpdates(_0x626428,_0x1f04a1){return function(_0x30b7cc){if(_0x30b7cc){return _0x30b7cc[_0x0912('0x24')](_0x626428)[_0x0912('0x25')](function(_0x6c4902){return _0x6c4902;});}return null;};}function removeEntity(_0x2a3e70,_0xca7f8b){return function(_0x572d12){if(_0x572d12){return _0x572d12[_0x0912('0x26')]()[_0x0912('0x25')](function(){_0x2a3e70[_0x0912('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a938e,_0x21d65b){return function(_0x53d673){if(!_0x53d673){_0x4a938e['sendStatus'](0x194);}return _0x53d673;};}function handleError(_0x39462e,_0x39e96b){_0x39e96b=_0x39e96b||0x1f4;return function(_0x4d45d2){logger[_0x0912('0x27')](_0x4d45d2[_0x0912('0x28')]);if(_0x4d45d2[_0x0912('0x29')]){delete _0x4d45d2[_0x0912('0x29')];}_0x39462e[_0x0912('0x1a')](_0x39e96b)['send'](_0x4d45d2);};}exports[_0x0912('0x2a')]=function(_0x1d6c87,_0x4ac024){var _0x2b1653={},_0x3428a9={},_0x2ce714={'count':0x0,'rows':[]};var _0x5b3956=_[_0x0912('0x2b')](db[_0x0912('0x2c')][_0x0912('0x2d')],function(_0x176529){return{'name':_0x176529['fieldName'],'type':_0x176529[_0x0912('0x2e')][_0x0912('0x2f')]};});_0x3428a9[_0x0912('0x30')]=_[_0x0912('0x2b')](_0x5b3956,_0x0912('0x29'));_0x3428a9[_0x0912('0x31')]=_['keys'](_0x1d6c87['query']);_0x3428a9[_0x0912('0x32')]=_[_0x0912('0x33')](_0x3428a9['model'],_0x3428a9['query']);_0x2b1653[_0x0912('0x34')]=_[_0x0912('0x33')](_0x3428a9[_0x0912('0x30')],qs[_0x0912('0x35')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x35')]));_0x2b1653[_0x0912('0x34')]=_0x2b1653[_0x0912('0x34')]['length']?_0x2b1653['attributes']:_0x3428a9[_0x0912('0x30')];if(!_0x1d6c87[_0x0912('0x31')]['hasOwnProperty'](_0x0912('0x36'))){_0x2b1653[_0x0912('0x37')]=qs[_0x0912('0x37')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x37')]);_0x2b1653[_0x0912('0x1f')]=qs[_0x0912('0x1f')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x1f')]);}_0x2b1653['order']=qs[_0x0912('0x38')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x38')]);_0x2b1653[_0x0912('0x39')]=qs[_0x0912('0x32')](_[_0x0912('0x3a')](_0x1d6c87[_0x0912('0x31')],_0x3428a9['filters']),_0x5b3956);if(_0x1d6c87[_0x0912('0x31')]['filter']){_0x2b1653['where']=_['merge'](_0x2b1653[_0x0912('0x39')],{'$or':_[_0x0912('0x2b')](_0x5b3956,function(_0x5db5f9){if(_0x5db5f9[_0x0912('0x2e')]!==_0x0912('0x3b')){var _0xfdf81c={};_0xfdf81c[_0x5db5f9['name']]={'$like':'%'+_0x1d6c87[_0x0912('0x31')][_0x0912('0x3c')]+'%'};return _0xfdf81c;}})});}_0x2b1653=_['merge']({},_0x2b1653,_0x1d6c87[_0x0912('0x3d')]);var _0x40de57={'where':_0x2b1653[_0x0912('0x39')]};return db[_0x0912('0x2c')][_0x0912('0x1e')](_0x40de57)[_0x0912('0x25')](function(_0x4eb359){_0x2ce714[_0x0912('0x1e')]=_0x4eb359;if(_0x1d6c87[_0x0912('0x31')][_0x0912('0x3e')]){_0x2b1653[_0x0912('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0912('0x40')](_0x2b1653);})[_0x0912('0x25')](function(_0x10040b){_0x2ce714['rows']=_0x10040b;return _0x2ce714;})[_0x0912('0x25')](respondWithFilteredResult(_0x4ac024,_0x2b1653))[_0x0912('0x41')](handleError(_0x4ac024,null));};exports[_0x0912('0x42')]=function(_0x19839e,_0x1c5158){var _0x320f98={'raw':!![],'where':{'id':_0x19839e[_0x0912('0x43')]['id']}},_0x15e23b={};_0x15e23b['model']=_[_0x0912('0x44')](db['ChatQueueReport'][_0x0912('0x2d')]);_0x15e23b[_0x0912('0x31')]=_[_0x0912('0x44')](_0x19839e[_0x0912('0x31')]);_0x15e23b[_0x0912('0x32')]=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],_0x15e23b[_0x0912('0x31')]);_0x320f98['attributes']=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],qs[_0x0912('0x35')](_0x19839e['query'][_0x0912('0x35')]));_0x320f98[_0x0912('0x34')]=_0x320f98[_0x0912('0x34')][_0x0912('0x45')]?_0x320f98[_0x0912('0x34')]:_0x15e23b[_0x0912('0x30')];if(_0x19839e[_0x0912('0x31')][_0x0912('0x3e')]){_0x320f98[_0x0912('0x3f')]=[{'all':!![]}];}_0x320f98=_[_0x0912('0x46')]({},_0x320f98,_0x19839e[_0x0912('0x3d')]);return db[_0x0912('0x2c')][_0x0912('0x47')](_0x320f98)[_0x0912('0x25')](handleEntityNotFound(_0x1c5158,null))[_0x0912('0x25')](respondWithResult(_0x1c5158,null))[_0x0912('0x41')](handleError(_0x1c5158,null));};exports[_0x0912('0x48')]=function(_0x255ee5,_0x3b0548){return db[_0x0912('0x2c')][_0x0912('0x48')](_0x255ee5[_0x0912('0x49')],{})[_0x0912('0x25')](respondWithResult(_0x3b0548,0xc9))['catch'](handleError(_0x3b0548,null));};exports[_0x0912('0x24')]=function(_0x3b94cc,_0x591c83){if(_0x3b94cc[_0x0912('0x49')]['id']){delete _0x3b94cc[_0x0912('0x49')]['id'];}return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x3b94cc[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x591c83,null))['then'](saveUpdates(_0x3b94cc[_0x0912('0x49')],null))[_0x0912('0x25')](respondWithResult(_0x591c83,null))[_0x0912('0x41')](handleError(_0x591c83,null));};exports['destroy']=function(_0x11364e,_0x3ce4bf){return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x11364e[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x3ce4bf,null))[_0x0912('0x25')](removeEntity(_0x3ce4bf,null))[_0x0912('0x41')](handleError(_0x3ce4bf,null));};exports['describe']=function(_0x91bb1a,_0x360313){return db[_0x0912('0x2c')][_0x0912('0x4a')]()[_0x0912('0x25')](respondWithResult(_0x360313,null))['catch'](handleError(_0x360313,null));}; \ No newline at end of file +var _0x5419=['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/environment','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ChatQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x5b7431,_0x559de8){var _0x49b36b=function(_0x546c3d){while(--_0x546c3d){_0x5b7431['push'](_0x5b7431['shift']());}};_0x49b36b(++_0x559de8);}(_0x5419,0x175));var _0x9541=function(_0xcb0eb2,_0x3906bf){_0xcb0eb2=_0xcb0eb2-0x0;var _0xbab9b8=_0x5419[_0xcb0eb2];return _0xbab9b8;};'use strict';var emlformat=require(_0x9541('0x0'));var rimraf=require(_0x9541('0x1'));var zipdir=require(_0x9541('0x2'));var jsonpatch=require(_0x9541('0x3'));var rp=require(_0x9541('0x4'));var moment=require(_0x9541('0x5'));var BPromise=require(_0x9541('0x6'));var Mustache=require(_0x9541('0x7'));var util=require(_0x9541('0x8'));var path=require(_0x9541('0x9'));var sox=require('sox');var csv=require(_0x9541('0xa'));var ejs=require(_0x9541('0xb'));var fs=require('fs');var fs_extra=require(_0x9541('0xc'));var _=require(_0x9541('0xd'));var squel=require(_0x9541('0xe'));var crypto=require(_0x9541('0xf'));var jsforce=require(_0x9541('0x10'));var deskjs=require(_0x9541('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9541('0x12'));var Papa=require('papaparse');var Redis=require(_0x9541('0x13'));var authService=require(_0x9541('0x14'));var qs=require(_0x9541('0x15'));var as=require(_0x9541('0x16'));var hardwareService=require(_0x9541('0x17'));var logger=require(_0x9541('0x18'))(_0x9541('0x19'));var utils=require('../../config/utils');var config=require(_0x9541('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x75669e,_0x4f97a9){_0x4f97a9=_0x4f97a9||0xcc;return function(_0x40cc60){if(_0x40cc60){return _0x75669e['sendStatus'](_0x4f97a9);}return _0x75669e[_0x9541('0x1b')](_0x4f97a9)[_0x9541('0x1c')]();};}function respondWithResult(_0x1ffa34,_0x38ab15){_0x38ab15=_0x38ab15||0xc8;return function(_0x28316e){if(_0x28316e){return _0x1ffa34[_0x9541('0x1b')](_0x38ab15)['json'](_0x28316e);}};}function respondWithFilteredResult(_0x37a48e,_0x548cdc){return function(_0x64b64a){if(_0x64b64a){var _0x569b6d=typeof _0x548cdc[_0x9541('0x1d')]==='undefined'&&typeof _0x548cdc[_0x9541('0x1e')]===_0x9541('0x1f');var _0xcc7699=_0x64b64a[_0x9541('0x20')];var _0xf5a87e=_0x569b6d?0x0:_0x548cdc[_0x9541('0x1d')];var _0x50e39f=_0x569b6d?_0x64b64a['count']:_0x548cdc[_0x9541('0x1d')]+_0x548cdc[_0x9541('0x1e')];var _0x594ba4;if(_0x50e39f>=_0xcc7699){_0x50e39f=_0xcc7699;_0x594ba4=0xc8;}else{_0x594ba4=0xce;}_0x37a48e['status'](_0x594ba4);return _0x37a48e[_0x9541('0x21')](_0x9541('0x22'),_0xf5a87e+'-'+_0x50e39f+'/'+_0xcc7699)[_0x9541('0x23')](_0x64b64a);}return null;};}function patchUpdates(_0xc6683a){return function(_0xfbcffc){try{jsonpatch[_0x9541('0x24')](_0xfbcffc,_0xc6683a,!![]);}catch(_0xf225bb){return BPromise[_0x9541('0x25')](_0xf225bb);}return _0xfbcffc[_0x9541('0x26')]();};}function saveUpdates(_0x1f2d91,_0x43bb4c){return function(_0x54a827){if(_0x54a827){return _0x54a827[_0x9541('0x27')](_0x1f2d91)[_0x9541('0x28')](function(_0x41abc5){return _0x41abc5;});}return null;};}function removeEntity(_0x244ecc,_0x101374){return function(_0x2f6b0a){if(_0x2f6b0a){return _0x2f6b0a[_0x9541('0x29')]()[_0x9541('0x28')](function(){_0x244ecc[_0x9541('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35ec2c,_0x48987e){return function(_0xbaf6cb){if(!_0xbaf6cb){_0x35ec2c[_0x9541('0x2a')](0x194);}return _0xbaf6cb;};}function handleError(_0x123ed5,_0xc8dcf2){_0xc8dcf2=_0xc8dcf2||0x1f4;return function(_0x4b6faf){logger[_0x9541('0x2b')](_0x4b6faf[_0x9541('0x2c')]);if(_0x4b6faf[_0x9541('0x2d')]){delete _0x4b6faf[_0x9541('0x2d')];}_0x123ed5['status'](_0xc8dcf2)[_0x9541('0x2e')](_0x4b6faf);};}exports['index']=function(_0x40a1bc,_0x19c710){var _0x5869f4={},_0xf82d59={},_0x2b2883={'count':0x0,'rows':[]};var _0x4f4d23=_[_0x9541('0x2f')](db[_0x9541('0x30')]['rawAttributes'],function(_0x259243){return{'name':_0x259243['fieldName'],'type':_0x259243[_0x9541('0x31')][_0x9541('0x32')]};});_0xf82d59[_0x9541('0x33')]=_[_0x9541('0x2f')](_0x4f4d23,_0x9541('0x2d'));_0xf82d59[_0x9541('0x34')]=_[_0x9541('0x35')](_0x40a1bc['query']);_0xf82d59[_0x9541('0x36')]=_[_0x9541('0x37')](_0xf82d59[_0x9541('0x33')],_0xf82d59[_0x9541('0x34')]);_0x5869f4[_0x9541('0x38')]=_[_0x9541('0x37')](_0xf82d59[_0x9541('0x33')],qs[_0x9541('0x39')](_0x40a1bc[_0x9541('0x34')][_0x9541('0x39')]));_0x5869f4[_0x9541('0x38')]=_0x5869f4[_0x9541('0x38')][_0x9541('0x3a')]?_0x5869f4[_0x9541('0x38')]:_0xf82d59[_0x9541('0x33')];if(!_0x40a1bc[_0x9541('0x34')][_0x9541('0x3b')](_0x9541('0x3c'))){_0x5869f4[_0x9541('0x1e')]=qs[_0x9541('0x1e')](_0x40a1bc['query'][_0x9541('0x1e')]);_0x5869f4['offset']=qs['offset'](_0x40a1bc['query']['offset']);}_0x5869f4[_0x9541('0x3d')]=qs[_0x9541('0x3e')](_0x40a1bc[_0x9541('0x34')]['sort']);_0x5869f4[_0x9541('0x3f')]=qs[_0x9541('0x36')](_['pick'](_0x40a1bc[_0x9541('0x34')],_0xf82d59[_0x9541('0x36')]),_0x4f4d23);if(_0x40a1bc[_0x9541('0x34')][_0x9541('0x40')]){_0x5869f4[_0x9541('0x3f')]=_[_0x9541('0x41')](_0x5869f4[_0x9541('0x3f')],{'$or':_[_0x9541('0x2f')](_0x4f4d23,function(_0x39b6d9){if(_0x39b6d9[_0x9541('0x31')]!=='VIRTUAL'){var _0x4d48c0={};_0x4d48c0[_0x39b6d9[_0x9541('0x2d')]]={'$like':'%'+_0x40a1bc[_0x9541('0x34')][_0x9541('0x40')]+'%'};return _0x4d48c0;}})});}_0x5869f4=_[_0x9541('0x41')]({},_0x5869f4,_0x40a1bc[_0x9541('0x42')]);var _0x42f654={'where':_0x5869f4[_0x9541('0x3f')]};return db[_0x9541('0x30')][_0x9541('0x20')](_0x42f654)['then'](function(_0x264f17){_0x2b2883['count']=_0x264f17;if(_0x40a1bc[_0x9541('0x34')][_0x9541('0x43')]){_0x5869f4[_0x9541('0x44')]=[{'all':!![]}];}return db[_0x9541('0x30')]['findAll'](_0x5869f4);})[_0x9541('0x28')](function(_0x2b4b85){_0x2b2883[_0x9541('0x45')]=_0x2b4b85;return _0x2b2883;})[_0x9541('0x28')](respondWithFilteredResult(_0x19c710,_0x5869f4))[_0x9541('0x46')](handleError(_0x19c710,null));};exports[_0x9541('0x47')]=function(_0x3aee70,_0x410a11){var _0x1be782={'raw':!![],'where':{'id':_0x3aee70['params']['id']}},_0x51584e={};_0x51584e[_0x9541('0x33')]=_[_0x9541('0x35')](db[_0x9541('0x30')]['rawAttributes']);_0x51584e[_0x9541('0x34')]=_['keys'](_0x3aee70[_0x9541('0x34')]);_0x51584e['filters']=_[_0x9541('0x37')](_0x51584e[_0x9541('0x33')],_0x51584e[_0x9541('0x34')]);_0x1be782[_0x9541('0x38')]=_['intersection'](_0x51584e[_0x9541('0x33')],qs[_0x9541('0x39')](_0x3aee70[_0x9541('0x34')]['fields']));_0x1be782[_0x9541('0x38')]=_0x1be782[_0x9541('0x38')][_0x9541('0x3a')]?_0x1be782[_0x9541('0x38')]:_0x51584e['model'];if(_0x3aee70['query']['includeAll']){_0x1be782['include']=[{'all':!![]}];}_0x1be782=_[_0x9541('0x41')]({},_0x1be782,_0x3aee70[_0x9541('0x42')]);return db[_0x9541('0x30')][_0x9541('0x48')](_0x1be782)[_0x9541('0x28')](handleEntityNotFound(_0x410a11,null))['then'](respondWithResult(_0x410a11,null))[_0x9541('0x46')](handleError(_0x410a11,null));};exports[_0x9541('0x49')]=function(_0x458b3c,_0x4ca001){return db['ChatQueueReport'][_0x9541('0x49')](_0x458b3c[_0x9541('0x4a')],{})[_0x9541('0x28')](respondWithResult(_0x4ca001,0xc9))['catch'](handleError(_0x4ca001,null));};exports['update']=function(_0x47082f,_0x22606e){if(_0x47082f[_0x9541('0x4a')]['id']){delete _0x47082f[_0x9541('0x4a')]['id'];}return db[_0x9541('0x30')][_0x9541('0x48')]({'where':{'id':_0x47082f[_0x9541('0x4b')]['id']}})['then'](handleEntityNotFound(_0x22606e,null))[_0x9541('0x28')](saveUpdates(_0x47082f[_0x9541('0x4a')],null))['then'](respondWithResult(_0x22606e,null))['catch'](handleError(_0x22606e,null));};exports[_0x9541('0x29')]=function(_0x170c93,_0x460051){return db[_0x9541('0x30')][_0x9541('0x48')]({'where':{'id':_0x170c93[_0x9541('0x4b')]['id']}})[_0x9541('0x28')](handleEntityNotFound(_0x460051,null))['then'](removeEntity(_0x460051,null))['catch'](handleError(_0x460051,null));};exports[_0x9541('0x4c')]=function(_0x4f09c5,_0x3cefc1){return db[_0x9541('0x30')][_0x9541('0x4c')]()['then'](respondWithResult(_0x3cefc1,null))[_0x9541('0x46')](handleError(_0x3cefc1,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ee18a5b..268af0c 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf51299,_0x388983){var _0x2db212=function(_0x285929){while(--_0x285929){_0xf51299['push'](_0xf51299['shift']());}};_0x2db212(++_0x388983);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x14c00f,_0x11b192){var _0x19fbda=function(_0xf9caa4){while(--_0xf9caa4){_0x14c00f['push'](_0x14c00f['shift']());}};_0x19fbda(++_0x11b192);}(_0xe706,0xa3));var _0x6e70=function(_0x237f45,_0x45987a){_0x237f45=_0x237f45-0x0;var _0x268b78=_0xe706[_0x237f45];return _0x268b78;};'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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d76bb67..388b845 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 _0xc0dc=['request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x285f9b,_0xfcae6c){var _0x32dd58=function(_0x392920){while(--_0x392920){_0x285f9b['push'](_0x285f9b['shift']());}};_0x32dd58(++_0xfcae6c);}(_0xc0dc,0xf6));var _0xcc0d=function(_0x4e291b,_0x1f1dcc){_0x4e291b=_0x4e291b-0x0;var _0x2d0bd3=_0xc0dc[_0x4e291b];return _0x2d0bd3;};'use strict';var _=require(_0xcc0d('0x0'));var util=require(_0xcc0d('0x1'));var moment=require(_0xcc0d('0x2'));var BPromise=require(_0xcc0d('0x3'));var rs=require(_0xcc0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc0d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc0d('0x6'))(_0xcc0d('0x7'));var config=require(_0xcc0d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387e4f,_0x43de3e,_0x4f387e){return new BPromise(function(_0x49fda8,_0xb83ca3){return client[_0xcc0d('0xa')](_0x387e4f,_0x4f387e)[_0xcc0d('0xb')](function(_0x6e4dca){logger[_0xcc0d('0xc')](_0xcc0d('0xd'),_0x43de3e,'request\x20sent');logger[_0xcc0d('0xe')](_0xcc0d('0xf'),_0x43de3e,_0xcc0d('0x10'),JSON[_0xcc0d('0x11')](_0x6e4dca));if(_0x6e4dca['error']){if(_0x6e4dca['error']['code']===0x1f4){logger['error'](_0xcc0d('0xd'),_0x43de3e,_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);return _0xb83ca3(_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);}logger[_0xcc0d('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x43de3e,_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);return _0x49fda8(_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);}else{logger[_0xcc0d('0xc')](_0xcc0d('0xd'),_0x43de3e,'request\x20sent');_0x49fda8(_0x6e4dca[_0xcc0d('0x14')]['message']);}})['catch'](function(_0x4d7182){logger['error'](_0xcc0d('0xd'),_0x43de3e,_0x4d7182);_0xb83ca3(_0x4d7182);});});}exports[_0xcc0d('0x15')]=function(_0x57d7f1){var _0x4c2b0e=this;return new Promise(function(_0x23f28d,_0x22745e){return db[_0xcc0d('0x16')][_0xcc0d('0x17')](_0x57d7f1[_0xcc0d('0x18')],{'raw':_0x57d7f1['options']?_0x57d7f1[_0xcc0d('0x19')][_0xcc0d('0x1a')]===undefined?!![]:![]:!![]})[_0xcc0d('0xb')](function(_0x40dbbc){logger['info'](_0xcc0d('0x15'),_0x57d7f1);logger[_0xcc0d('0xe')](_0xcc0d('0x15'),_0x57d7f1,JSON[_0xcc0d('0x11')](_0x40dbbc));_0x23f28d(_0x40dbbc);})['catch'](function(_0x59285d){logger[_0xcc0d('0x12')](_0xcc0d('0x15'),_0x59285d['message'],_0x57d7f1);_0x22745e(_0x4c2b0e['error'](0x1f4,_0x59285d[_0xcc0d('0x13')]));});});};exports[_0xcc0d('0x1b')]=function(_0x8fd67c){var _0xca46ee=this;return new Promise(function(_0x306c05,_0x5487f7){return db[_0xcc0d('0x16')]['update'](_0x8fd67c[_0xcc0d('0x18')],{'raw':_0x8fd67c['options']?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8fd67c[_0xcc0d('0x19')]?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1c')]||null:null,'attributes':_0x8fd67c[_0xcc0d('0x19')]?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1d')]||null:null,'limit':_0x8fd67c[_0xcc0d('0x19')]?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1e')]||null:null})[_0xcc0d('0xb')](function(_0x226f57){logger[_0xcc0d('0xc')]('UpdateChatQueueReport',_0x8fd67c);logger['debug'](_0xcc0d('0x1b'),_0x8fd67c,JSON[_0xcc0d('0x11')](_0x226f57));_0x306c05(_0x226f57);})[_0xcc0d('0x1f')](function(_0x448941){logger[_0xcc0d('0x12')]('UpdateChatQueueReport',_0x448941['message'],_0x8fd67c);_0x5487f7(_0xca46ee[_0xcc0d('0x12')](0x1f4,_0x448941[_0xcc0d('0x13')]));});});}; \ No newline at end of file +var _0x7c7b=['../../mysqldb','../../config/utils','../../config/environment','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','raw','where','attributes','limit','catch','lodash','util','moment','ioredis'];(function(_0x593d30,_0x32a721){var _0x5eb4b7=function(_0x201246){while(--_0x201246){_0x593d30['push'](_0x593d30['shift']());}};_0x5eb4b7(++_0x32a721);}(_0x7c7b,0x11e));var _0xb7c7=function(_0x251f85,_0x2be404){_0x251f85=_0x251f85-0x0;var _0x307b74=_0x7c7b[_0x251f85];return _0x307b74;};'use strict';var _=require(_0xb7c7('0x0'));var util=require(_0xb7c7('0x1'));var moment=require(_0xb7c7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7c7('0x3'));var db=require(_0xb7c7('0x4'))['db'];var utils=require(_0xb7c7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb7c7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb7c7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3aeb33,_0x57cc08,_0x5b8bd2){return new BPromise(function(_0x5e1636,_0x2430b6){return client['request'](_0x3aeb33,_0x5b8bd2)[_0xb7c7('0x8')](function(_0x3ee90a){logger[_0xb7c7('0x9')](_0xb7c7('0xa'),_0x57cc08,_0xb7c7('0xb'));logger[_0xb7c7('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x57cc08,'request\x20sent',JSON[_0xb7c7('0xd')](_0x3ee90a));if(_0x3ee90a[_0xb7c7('0xe')]){if(_0x3ee90a[_0xb7c7('0xe')][_0xb7c7('0xf')]===0x1f4){logger[_0xb7c7('0xe')](_0xb7c7('0xa'),_0x57cc08,_0x3ee90a[_0xb7c7('0xe')][_0xb7c7('0x10')]);return _0x2430b6(_0x3ee90a[_0xb7c7('0xe')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x57cc08,_0x3ee90a[_0xb7c7('0xe')][_0xb7c7('0x10')]);return _0x5e1636(_0x3ee90a[_0xb7c7('0xe')][_0xb7c7('0x10')]);}else{logger[_0xb7c7('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x57cc08,_0xb7c7('0xb'));_0x5e1636(_0x3ee90a[_0xb7c7('0x11')][_0xb7c7('0x10')]);}})['catch'](function(_0x3d3f69){logger[_0xb7c7('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x57cc08,_0x3d3f69);_0x2430b6(_0x3d3f69);});});}exports[_0xb7c7('0x12')]=function(_0x5922f7){var _0x4cde0f=this;return new Promise(function(_0x5e5fc6,_0xbb8c9d){return db[_0xb7c7('0x13')][_0xb7c7('0x14')](_0x5922f7[_0xb7c7('0x15')],{'raw':_0x5922f7[_0xb7c7('0x16')]?_0x5922f7[_0xb7c7('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xb7c7('0x8')](function(_0x3c9293){logger[_0xb7c7('0x9')](_0xb7c7('0x12'),_0x5922f7);logger['debug'](_0xb7c7('0x12'),_0x5922f7,JSON[_0xb7c7('0xd')](_0x3c9293));_0x5e5fc6(_0x3c9293);})['catch'](function(_0x562ef7){logger['error']('CreateChatQueueReport',_0x562ef7[_0xb7c7('0x10')],_0x5922f7);_0xbb8c9d(_0x4cde0f[_0xb7c7('0xe')](0x1f4,_0x562ef7[_0xb7c7('0x10')]));});});};exports[_0xb7c7('0x17')]=function(_0x19d16c){var _0x4382d8=this;return new Promise(function(_0x17c1e4,_0x177e26){return db['ChatQueueReport']['update'](_0x19d16c['body'],{'raw':_0x19d16c['options']?_0x19d16c[_0xb7c7('0x16')][_0xb7c7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d16c[_0xb7c7('0x16')]?_0x19d16c[_0xb7c7('0x16')][_0xb7c7('0x19')]||null:null,'attributes':_0x19d16c[_0xb7c7('0x16')]?_0x19d16c[_0xb7c7('0x16')][_0xb7c7('0x1a')]||null:null,'limit':_0x19d16c['options']?_0x19d16c[_0xb7c7('0x16')][_0xb7c7('0x1b')]||null:null})['then'](function(_0x1f6ea1){logger[_0xb7c7('0x9')](_0xb7c7('0x17'),_0x19d16c);logger[_0xb7c7('0xc')](_0xb7c7('0x17'),_0x19d16c,JSON[_0xb7c7('0xd')](_0x1f6ea1));_0x17c1e4(_0x1f6ea1);})[_0xb7c7('0x1c')](function(_0x434cdf){logger[_0xb7c7('0xe')]('UpdateChatQueueReport',_0x434cdf['message'],_0x19d16c);_0x177e26(_0x4382d8[_0xb7c7('0xe')](0x1f4,_0x434cdf[_0xb7c7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8e15c2d..e7d9150 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 _0xe554=['/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','get','show','post','create','put'];(function(_0x197043,_0x3ebf47){var _0x233e33=function(_0x17bd0f){while(--_0x17bd0f){_0x197043['push'](_0x197043['shift']());}};_0x233e33(++_0x3ebf47);}(_0xe554,0x112));var _0x4e55=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe554[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x4e55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e55('0x1'));var express=require(_0x4e55('0x2'));var router=express[_0x4e55('0x3')]();var fs_extra=require(_0x4e55('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4e55('0x5'));var config=require(_0x4e55('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x4e55('0x7')](),controller['index']);router['get'](_0x4e55('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x4e55('0x9')]('/:id',auth[_0x4e55('0x7')](),controller[_0x4e55('0xa')]);router[_0x4e55('0xb')]('/',auth[_0x4e55('0x7')](),controller[_0x4e55('0xc')]);router[_0x4e55('0xd')](_0x4e55('0xe'),auth['isAuthenticated'](),controller[_0x4e55('0xf')]);router[_0x4e55('0x10')](_0x4e55('0xe'),auth[_0x4e55('0x7')](),controller['destroy']);module[_0x4e55('0x11')]=router; \ No newline at end of file +var _0x44c6=['isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe'];(function(_0x4edac5,_0x41d853){var _0x572b3b=function(_0x1cc65f){while(--_0x1cc65f){_0x4edac5['push'](_0x4edac5['shift']());}};_0x572b3b(++_0x41d853);}(_0x44c6,0xf9));var _0x644c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x644c('0x0'));var path=require(_0x644c('0x1'));var timeout=require(_0x644c('0x2'));var express=require(_0x644c('0x3'));var router=express[_0x644c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x644c('0x5'));var config=require(_0x644c('0x6'));var controller=require(_0x644c('0x7'));router[_0x644c('0x8')]('/',auth['isAuthenticated'](),controller[_0x644c('0x9')]);router['get'](_0x644c('0xa'),auth[_0x644c('0xb')](),controller['describe']);router[_0x644c('0x8')](_0x644c('0xc'),auth[_0x644c('0xb')](),controller[_0x644c('0xd')]);router['post']('/',auth[_0x644c('0xb')](),controller[_0x644c('0xe')]);router[_0x644c('0xf')](_0x644c('0xc'),auth[_0x644c('0xb')](),controller[_0x644c('0x10')]);router[_0x644c('0x11')]('/:id',auth[_0x644c('0xb')](),controller[_0x644c('0x12')]);module[_0x644c('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 071274a..7e7e1b3 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x437344,_0x482d45){_0x437344=_0x437344-0x0;var _0x450a49=_0xb43b[_0x437344];return _0x450a49;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x22fb10,_0x145420){var _0x41ec51=function(_0x1832e2){while(--_0x1832e2){_0x22fb10['push'](_0x22fb10['shift']());}};_0x41ec51(++_0x145420);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b5df7,_0x21c8a9){_0x4b5df7=_0x4b5df7-0x0;var _0x2af9d0=_0xedd9[_0x4b5df7];return _0x2af9d0;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2e6b013..1bdd1a4 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 _0xfacc=['fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','ChatTransferReport','includeAll','include','rows','catch','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model'];(function(_0x49710a,_0x56a5f1){var _0x686417=function(_0x5d51ef){while(--_0x5d51ef){_0x49710a['push'](_0x49710a['shift']());}};_0x686417(++_0x56a5f1);}(_0xfacc,0xfc));var _0xcfac=function(_0x540311,_0x53ca8b){_0x540311=_0x540311-0x0;var _0x56beef=_0xfacc[_0x540311];return _0x56beef;};'use strict';var emlformat=require(_0xcfac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfac('0x1'));var jsonpatch=require(_0xcfac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcfac('0x3'));var Mustache=require('mustache');var util=require(_0xcfac('0x4'));var path=require(_0xcfac('0x5'));var sox=require(_0xcfac('0x6'));var csv=require(_0xcfac('0x7'));var ejs=require(_0xcfac('0x8'));var fs=require('fs');var fs_extra=require(_0xcfac('0x9'));var _=require(_0xcfac('0xa'));var squel=require(_0xcfac('0xb'));var crypto=require(_0xcfac('0xc'));var jsforce=require(_0xcfac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcfac('0xe'));var Papa=require(_0xcfac('0xf'));var Redis=require(_0xcfac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcfac('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfac('0x12'));var logger=require(_0xcfac('0x13'))(_0xcfac('0x14'));var utils=require(_0xcfac('0x15'));var config=require(_0xcfac('0x16'));var licenseUtil=require(_0xcfac('0x17'));var db=require(_0xcfac('0x18'))['db'];function respondWithStatusCode(_0x4dd907,_0x21681a){_0x21681a=_0x21681a||0xcc;return function(_0x12e854){if(_0x12e854){return _0x4dd907['sendStatus'](_0x21681a);}return _0x4dd907[_0xcfac('0x19')](_0x21681a)[_0xcfac('0x1a')]();};}function respondWithResult(_0xffea01,_0x57069c){_0x57069c=_0x57069c||0xc8;return function(_0x297623){if(_0x297623){return _0xffea01[_0xcfac('0x19')](_0x57069c)[_0xcfac('0x1b')](_0x297623);}};}function respondWithFilteredResult(_0x117df8,_0x562e3c){return function(_0x356bfd){if(_0x356bfd){var _0xc2fcc4=typeof _0x562e3c[_0xcfac('0x1c')]===_0xcfac('0x1d')&&typeof _0x562e3c['limit']===_0xcfac('0x1d');var _0x3baaad=_0x356bfd[_0xcfac('0x1e')];var _0x286063=_0xc2fcc4?0x0:_0x562e3c[_0xcfac('0x1c')];var _0x36e510=_0xc2fcc4?_0x356bfd[_0xcfac('0x1e')]:_0x562e3c[_0xcfac('0x1c')]+_0x562e3c['limit'];var _0x458b54;if(_0x36e510>=_0x3baaad){_0x36e510=_0x3baaad;_0x458b54=0xc8;}else{_0x458b54=0xce;}_0x117df8['status'](_0x458b54);return _0x117df8[_0xcfac('0x1f')](_0xcfac('0x20'),_0x286063+'-'+_0x36e510+'/'+_0x3baaad)['json'](_0x356bfd);}return null;};}function patchUpdates(_0x42678c){return function(_0x2f18fd){try{jsonpatch[_0xcfac('0x21')](_0x2f18fd,_0x42678c,!![]);}catch(_0x397c07){return BPromise['reject'](_0x397c07);}return _0x2f18fd[_0xcfac('0x22')]();};}function saveUpdates(_0x1e8ae7,_0xab1813){return function(_0x4cabe8){if(_0x4cabe8){return _0x4cabe8[_0xcfac('0x23')](_0x1e8ae7)['then'](function(_0x47ed6f){return _0x47ed6f;});}return null;};}function removeEntity(_0x19b518,_0x1937de){return function(_0x2d8b50){if(_0x2d8b50){return _0x2d8b50[_0xcfac('0x24')]()[_0xcfac('0x25')](function(){_0x19b518[_0xcfac('0x19')](0xcc)[_0xcfac('0x1a')]();});}};}function handleEntityNotFound(_0x4a6f0a,_0x2a6a17){return function(_0x2dfd9f){if(!_0x2dfd9f){_0x4a6f0a[_0xcfac('0x26')](0x194);}return _0x2dfd9f;};}function handleError(_0x2909eb,_0x5f0964){_0x5f0964=_0x5f0964||0x1f4;return function(_0xabc551){logger[_0xcfac('0x27')](_0xabc551[_0xcfac('0x28')]);if(_0xabc551[_0xcfac('0x29')]){delete _0xabc551[_0xcfac('0x29')];}_0x2909eb[_0xcfac('0x19')](_0x5f0964)[_0xcfac('0x2a')](_0xabc551);};}exports[_0xcfac('0x2b')]=function(_0x4e78d2,_0x5a3b9c){var _0x3528e5={},_0x45e91a={},_0x4ee3e7={'count':0x0,'rows':[]};var _0x465912=_[_0xcfac('0x2c')](db['ChatTransferReport'][_0xcfac('0x2d')],function(_0x4ca36f){return{'name':_0x4ca36f[_0xcfac('0x2e')],'type':_0x4ca36f['type']['key']};});_0x45e91a['model']=_[_0xcfac('0x2c')](_0x465912,_0xcfac('0x29'));_0x45e91a[_0xcfac('0x2f')]=_[_0xcfac('0x30')](_0x4e78d2[_0xcfac('0x2f')]);_0x45e91a[_0xcfac('0x31')]=_[_0xcfac('0x32')](_0x45e91a[_0xcfac('0x33')],_0x45e91a[_0xcfac('0x2f')]);_0x3528e5['attributes']=_[_0xcfac('0x32')](_0x45e91a['model'],qs[_0xcfac('0x34')](_0x4e78d2[_0xcfac('0x2f')]['fields']));_0x3528e5['attributes']=_0x3528e5['attributes']['length']?_0x3528e5[_0xcfac('0x35')]:_0x45e91a[_0xcfac('0x33')];if(!_0x4e78d2[_0xcfac('0x2f')][_0xcfac('0x36')](_0xcfac('0x37'))){_0x3528e5[_0xcfac('0x38')]=qs['limit'](_0x4e78d2[_0xcfac('0x2f')][_0xcfac('0x38')]);_0x3528e5[_0xcfac('0x1c')]=qs['offset'](_0x4e78d2['query']['offset']);}_0x3528e5[_0xcfac('0x39')]=qs[_0xcfac('0x3a')](_0x4e78d2[_0xcfac('0x2f')]['sort']);_0x3528e5['where']=qs[_0xcfac('0x31')](_[_0xcfac('0x3b')](_0x4e78d2[_0xcfac('0x2f')],_0x45e91a[_0xcfac('0x31')]),_0x465912);if(_0x4e78d2[_0xcfac('0x2f')][_0xcfac('0x3c')]){_0x3528e5[_0xcfac('0x3d')]=_[_0xcfac('0x3e')](_0x3528e5['where'],{'$or':_['map'](_0x465912,function(_0x40a87c){if(_0x40a87c[_0xcfac('0x3f')]!==_0xcfac('0x40')){var _0x58f23f={};_0x58f23f[_0x40a87c[_0xcfac('0x29')]]={'$like':'%'+_0x4e78d2['query'][_0xcfac('0x3c')]+'%'};return _0x58f23f;}})});}_0x3528e5=_[_0xcfac('0x3e')]({},_0x3528e5,_0x4e78d2[_0xcfac('0x41')]);var _0x173537={'where':_0x3528e5[_0xcfac('0x3d')]};return db[_0xcfac('0x42')][_0xcfac('0x1e')](_0x173537)['then'](function(_0x204cc4){_0x4ee3e7[_0xcfac('0x1e')]=_0x204cc4;if(_0x4e78d2['query'][_0xcfac('0x43')]){_0x3528e5[_0xcfac('0x44')]=[{'all':!![]}];}return db[_0xcfac('0x42')]['findAll'](_0x3528e5);})[_0xcfac('0x25')](function(_0x1b71e1){_0x4ee3e7[_0xcfac('0x45')]=_0x1b71e1;return _0x4ee3e7;})['then'](respondWithFilteredResult(_0x5a3b9c,_0x3528e5))[_0xcfac('0x46')](handleError(_0x5a3b9c,null));};exports['show']=function(_0x194571,_0x5ebedf){var _0x1db5d8={'raw':!![],'where':{'id':_0x194571[_0xcfac('0x47')]['id']}},_0x1d5f5f={};_0x1d5f5f['model']=_['keys'](db[_0xcfac('0x42')][_0xcfac('0x2d')]);_0x1d5f5f['query']=_[_0xcfac('0x30')](_0x194571[_0xcfac('0x2f')]);_0x1d5f5f['filters']=_['intersection'](_0x1d5f5f['model'],_0x1d5f5f['query']);_0x1db5d8[_0xcfac('0x35')]=_[_0xcfac('0x32')](_0x1d5f5f[_0xcfac('0x33')],qs['fields'](_0x194571[_0xcfac('0x2f')][_0xcfac('0x34')]));_0x1db5d8['attributes']=_0x1db5d8[_0xcfac('0x35')]['length']?_0x1db5d8[_0xcfac('0x35')]:_0x1d5f5f[_0xcfac('0x33')];if(_0x194571[_0xcfac('0x2f')][_0xcfac('0x43')]){_0x1db5d8[_0xcfac('0x44')]=[{'all':!![]}];}_0x1db5d8=_['merge']({},_0x1db5d8,_0x194571[_0xcfac('0x41')]);return db[_0xcfac('0x42')]['find'](_0x1db5d8)[_0xcfac('0x25')](handleEntityNotFound(_0x5ebedf,null))[_0xcfac('0x25')](respondWithResult(_0x5ebedf,null))[_0xcfac('0x46')](handleError(_0x5ebedf,null));};exports['create']=function(_0x2abc29,_0x316629){return db[_0xcfac('0x42')][_0xcfac('0x48')](_0x2abc29[_0xcfac('0x49')],{})[_0xcfac('0x25')](respondWithResult(_0x316629,0xc9))[_0xcfac('0x46')](handleError(_0x316629,null));};exports[_0xcfac('0x23')]=function(_0x2f3539,_0x3de1a4){if(_0x2f3539[_0xcfac('0x49')]['id']){delete _0x2f3539[_0xcfac('0x49')]['id'];}return db[_0xcfac('0x42')][_0xcfac('0x4a')]({'where':{'id':_0x2f3539[_0xcfac('0x47')]['id']}})[_0xcfac('0x25')](handleEntityNotFound(_0x3de1a4,null))[_0xcfac('0x25')](saveUpdates(_0x2f3539['body'],null))['then'](respondWithResult(_0x3de1a4,null))[_0xcfac('0x46')](handleError(_0x3de1a4,null));};exports[_0xcfac('0x24')]=function(_0x18b3d4,_0x9c935c){return db[_0xcfac('0x42')][_0xcfac('0x4a')]({'where':{'id':_0x18b3d4[_0xcfac('0x47')]['id']}})[_0xcfac('0x25')](handleEntityNotFound(_0x9c935c,null))[_0xcfac('0x25')](removeEntity(_0x9c935c,null))[_0xcfac('0x46')](handleError(_0x9c935c,null));};exports[_0xcfac('0x4b')]=function(_0x4c9734,_0x3124c3){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x3124c3,null))[_0xcfac('0x46')](handleError(_0x3124c3,null));}; \ No newline at end of file +var _0x7c01=['Content-Range','apply','reject','save','update','then','sendStatus','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','length','include','options','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x5aca71,_0x583dfa){var _0x375f79=function(_0x3b2d5e){while(--_0x3b2d5e){_0x5aca71['push'](_0x5aca71['shift']());}};_0x375f79(++_0x583dfa);}(_0x7c01,0x19d));var _0x17c0=function(_0x2ac88a,_0x25481f){_0x2ac88a=_0x2ac88a-0x0;var _0x3644b3=_0x7c01[_0x2ac88a];return _0x3644b3;};'use strict';var emlformat=require(_0x17c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17c0('0x1'));var jsonpatch=require(_0x17c0('0x2'));var rp=require(_0x17c0('0x3'));var moment=require(_0x17c0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x17c0('0x5'));var path=require(_0x17c0('0x6'));var sox=require('sox');var csv=require(_0x17c0('0x7'));var ejs=require(_0x17c0('0x8'));var fs=require('fs');var fs_extra=require(_0x17c0('0x9'));var _=require('lodash');var squel=require(_0x17c0('0xa'));var crypto=require(_0x17c0('0xb'));var jsforce=require(_0x17c0('0xc'));var deskjs=require(_0x17c0('0xd'));var toCsv=require(_0x17c0('0x7'));var querystring=require('querystring');var Papa=require(_0x17c0('0xe'));var Redis=require('ioredis');var authService=require(_0x17c0('0xf'));var qs=require(_0x17c0('0x10'));var as=require(_0x17c0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17c0('0x12'))('api');var utils=require(_0x17c0('0x13'));var config=require(_0x17c0('0x14'));var licenseUtil=require(_0x17c0('0x15'));var db=require(_0x17c0('0x16'))['db'];function respondWithStatusCode(_0x301eac,_0x457307){_0x457307=_0x457307||0xcc;return function(_0x183463){if(_0x183463){return _0x301eac['sendStatus'](_0x457307);}return _0x301eac[_0x17c0('0x17')](_0x457307)[_0x17c0('0x18')]();};}function respondWithResult(_0xddeeae,_0x1d18ca){_0x1d18ca=_0x1d18ca||0xc8;return function(_0x8486d8){if(_0x8486d8){return _0xddeeae[_0x17c0('0x17')](_0x1d18ca)[_0x17c0('0x19')](_0x8486d8);}};}function respondWithFilteredResult(_0x1c2215,_0x3af5b7){return function(_0xb3e9de){if(_0xb3e9de){var _0x216713=typeof _0x3af5b7[_0x17c0('0x1a')]===_0x17c0('0x1b')&&typeof _0x3af5b7[_0x17c0('0x1c')]===_0x17c0('0x1b');var _0x4cc2d7=_0xb3e9de[_0x17c0('0x1d')];var _0x329c67=_0x216713?0x0:_0x3af5b7[_0x17c0('0x1a')];var _0x250dca=_0x216713?_0xb3e9de[_0x17c0('0x1d')]:_0x3af5b7['offset']+_0x3af5b7[_0x17c0('0x1c')];var _0x211ae9;if(_0x250dca>=_0x4cc2d7){_0x250dca=_0x4cc2d7;_0x211ae9=0xc8;}else{_0x211ae9=0xce;}_0x1c2215[_0x17c0('0x17')](_0x211ae9);return _0x1c2215[_0x17c0('0x1e')](_0x17c0('0x1f'),_0x329c67+'-'+_0x250dca+'/'+_0x4cc2d7)[_0x17c0('0x19')](_0xb3e9de);}return null;};}function patchUpdates(_0x3629a3){return function(_0x419435){try{jsonpatch[_0x17c0('0x20')](_0x419435,_0x3629a3,!![]);}catch(_0x385397){return BPromise[_0x17c0('0x21')](_0x385397);}return _0x419435[_0x17c0('0x22')]();};}function saveUpdates(_0x2f0b0c,_0x4b4bea){return function(_0x2baeee){if(_0x2baeee){return _0x2baeee[_0x17c0('0x23')](_0x2f0b0c)[_0x17c0('0x24')](function(_0x30af19){return _0x30af19;});}return null;};}function removeEntity(_0x466c04,_0x11e3b5){return function(_0xc31c4e){if(_0xc31c4e){return _0xc31c4e['destroy']()[_0x17c0('0x24')](function(){_0x466c04[_0x17c0('0x17')](0xcc)[_0x17c0('0x18')]();});}};}function handleEntityNotFound(_0x27582a,_0x2816da){return function(_0x47a211){if(!_0x47a211){_0x27582a[_0x17c0('0x25')](0x194);}return _0x47a211;};}function handleError(_0x31108a,_0x2db886){_0x2db886=_0x2db886||0x1f4;return function(_0x2613fe){logger['error'](_0x2613fe['stack']);if(_0x2613fe[_0x17c0('0x26')]){delete _0x2613fe[_0x17c0('0x26')];}_0x31108a[_0x17c0('0x17')](_0x2db886)[_0x17c0('0x27')](_0x2613fe);};}exports['index']=function(_0x616720,_0x8b8b3f){var _0x416779={},_0x3758f6={},_0x17346e={'count':0x0,'rows':[]};var _0x55d181=_[_0x17c0('0x28')](db[_0x17c0('0x29')][_0x17c0('0x2a')],function(_0x4e542a){return{'name':_0x4e542a[_0x17c0('0x2b')],'type':_0x4e542a[_0x17c0('0x2c')][_0x17c0('0x2d')]};});_0x3758f6[_0x17c0('0x2e')]=_[_0x17c0('0x28')](_0x55d181,_0x17c0('0x26'));_0x3758f6['query']=_[_0x17c0('0x2f')](_0x616720['query']);_0x3758f6[_0x17c0('0x30')]=_[_0x17c0('0x31')](_0x3758f6[_0x17c0('0x2e')],_0x3758f6[_0x17c0('0x32')]);_0x416779[_0x17c0('0x33')]=_['intersection'](_0x3758f6[_0x17c0('0x2e')],qs[_0x17c0('0x34')](_0x616720[_0x17c0('0x32')][_0x17c0('0x34')]));_0x416779[_0x17c0('0x33')]=_0x416779['attributes']['length']?_0x416779['attributes']:_0x3758f6['model'];if(!_0x616720[_0x17c0('0x32')][_0x17c0('0x35')](_0x17c0('0x36'))){_0x416779[_0x17c0('0x1c')]=qs[_0x17c0('0x1c')](_0x616720[_0x17c0('0x32')][_0x17c0('0x1c')]);_0x416779[_0x17c0('0x1a')]=qs[_0x17c0('0x1a')](_0x616720[_0x17c0('0x32')][_0x17c0('0x1a')]);}_0x416779[_0x17c0('0x37')]=qs[_0x17c0('0x38')](_0x616720[_0x17c0('0x32')][_0x17c0('0x38')]);_0x416779[_0x17c0('0x39')]=qs[_0x17c0('0x30')](_[_0x17c0('0x3a')](_0x616720[_0x17c0('0x32')],_0x3758f6['filters']),_0x55d181);if(_0x616720[_0x17c0('0x32')]['filter']){_0x416779[_0x17c0('0x39')]=_[_0x17c0('0x3b')](_0x416779[_0x17c0('0x39')],{'$or':_[_0x17c0('0x28')](_0x55d181,function(_0x30ecdb){if(_0x30ecdb[_0x17c0('0x2c')]!==_0x17c0('0x3c')){var _0x3a902e={};_0x3a902e[_0x30ecdb['name']]={'$like':'%'+_0x616720['query'][_0x17c0('0x3d')]+'%'};return _0x3a902e;}})});}_0x416779=_['merge']({},_0x416779,_0x616720['options']);var _0x10e5a9={'where':_0x416779[_0x17c0('0x39')]};return db[_0x17c0('0x29')]['count'](_0x10e5a9)[_0x17c0('0x24')](function(_0x590c57){_0x17346e[_0x17c0('0x1d')]=_0x590c57;if(_0x616720[_0x17c0('0x32')][_0x17c0('0x3e')]){_0x416779['include']=[{'all':!![]}];}return db[_0x17c0('0x29')]['findAll'](_0x416779);})[_0x17c0('0x24')](function(_0x34b533){_0x17346e[_0x17c0('0x3f')]=_0x34b533;return _0x17346e;})[_0x17c0('0x24')](respondWithFilteredResult(_0x8b8b3f,_0x416779))[_0x17c0('0x40')](handleError(_0x8b8b3f,null));};exports['show']=function(_0x3b8e36,_0xc3dfbc){var _0xe02713={'raw':!![],'where':{'id':_0x3b8e36['params']['id']}},_0x4ead0f={};_0x4ead0f[_0x17c0('0x2e')]=_[_0x17c0('0x2f')](db['ChatTransferReport'][_0x17c0('0x2a')]);_0x4ead0f[_0x17c0('0x32')]=_[_0x17c0('0x2f')](_0x3b8e36[_0x17c0('0x32')]);_0x4ead0f[_0x17c0('0x30')]=_[_0x17c0('0x31')](_0x4ead0f['model'],_0x4ead0f[_0x17c0('0x32')]);_0xe02713[_0x17c0('0x33')]=_[_0x17c0('0x31')](_0x4ead0f[_0x17c0('0x2e')],qs[_0x17c0('0x34')](_0x3b8e36[_0x17c0('0x32')][_0x17c0('0x34')]));_0xe02713[_0x17c0('0x33')]=_0xe02713[_0x17c0('0x33')][_0x17c0('0x41')]?_0xe02713[_0x17c0('0x33')]:_0x4ead0f[_0x17c0('0x2e')];if(_0x3b8e36[_0x17c0('0x32')][_0x17c0('0x3e')]){_0xe02713[_0x17c0('0x42')]=[{'all':!![]}];}_0xe02713=_[_0x17c0('0x3b')]({},_0xe02713,_0x3b8e36[_0x17c0('0x43')]);return db[_0x17c0('0x29')][_0x17c0('0x44')](_0xe02713)[_0x17c0('0x24')](handleEntityNotFound(_0xc3dfbc,null))[_0x17c0('0x24')](respondWithResult(_0xc3dfbc,null))[_0x17c0('0x40')](handleError(_0xc3dfbc,null));};exports['create']=function(_0x44a3c2,_0x21865b){return db['ChatTransferReport'][_0x17c0('0x45')](_0x44a3c2[_0x17c0('0x46')],{})[_0x17c0('0x24')](respondWithResult(_0x21865b,0xc9))['catch'](handleError(_0x21865b,null));};exports[_0x17c0('0x23')]=function(_0x1ef4d2,_0x4f961d){if(_0x1ef4d2['body']['id']){delete _0x1ef4d2[_0x17c0('0x46')]['id'];}return db[_0x17c0('0x29')][_0x17c0('0x44')]({'where':{'id':_0x1ef4d2[_0x17c0('0x47')]['id']}})[_0x17c0('0x24')](handleEntityNotFound(_0x4f961d,null))[_0x17c0('0x24')](saveUpdates(_0x1ef4d2['body'],null))['then'](respondWithResult(_0x4f961d,null))[_0x17c0('0x40')](handleError(_0x4f961d,null));};exports[_0x17c0('0x48')]=function(_0x57b943,_0x1fb78c){return db['ChatTransferReport']['find']({'where':{'id':_0x57b943[_0x17c0('0x47')]['id']}})[_0x17c0('0x24')](handleEntityNotFound(_0x1fb78c,null))[_0x17c0('0x24')](removeEntity(_0x1fb78c,null))['catch'](handleError(_0x1fb78c,null));};exports[_0x17c0('0x49')]=function(_0x3551c8,_0x34f951){return db[_0x17c0('0x29')]['describe']()[_0x17c0('0x24')](respondWithResult(_0x34f951,null))[_0x17c0('0x40')](handleError(_0x34f951,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4ee58c0..831dd0b 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 _0x14fb=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','uniqueid','util','moment','bluebird'];(function(_0x5f2cd,_0x2640ce){var _0x356ba8=function(_0x2a5ee1){while(--_0x2a5ee1){_0x5f2cd['push'](_0x5f2cd['shift']());}};_0x356ba8(++_0x2640ce);}(_0x14fb,0xbb));var _0xb14f=function(_0x45f24d,_0x1055a2){_0x45f24d=_0x45f24d-0x0;var _0x374cd6=_0x14fb[_0x45f24d];return _0x374cd6;};'use strict';var _=require('lodash');var util=require(_0xb14f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb14f('0x1'));var BPromise=require(_0xb14f('0x2'));var rp=require(_0xb14f('0x3'));var fs=require('fs');var path=require(_0xb14f('0x4'));var rimraf=require(_0xb14f('0x5'));var config=require(_0xb14f('0x6'));var attributes=require(_0xb14f('0x7'));module[_0xb14f('0x8')]=function(_0x332fe6,_0x43345b){return _0x332fe6['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xb14f('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5aaa=['api','moment','bluebird','request-promise','rimraf','define','ChatTransferReport','uniqueid','lodash','../../config/logger'];(function(_0xae6d0d,_0x5514a3){var _0x351851=function(_0x34b429){while(--_0x34b429){_0xae6d0d['push'](_0xae6d0d['shift']());}};_0x351851(++_0x5514a3);}(_0x5aaa,0xd0));var _0xa5aa=function(_0x5b0c0a,_0x3d73fc){_0x5b0c0a=_0x5b0c0a-0x0;var _0x944786=_0x5aaa[_0x5b0c0a];return _0x944786;};'use strict';var _=require(_0xa5aa('0x0'));var util=require('util');var logger=require(_0xa5aa('0x1'))(_0xa5aa('0x2'));var moment=require(_0xa5aa('0x3'));var BPromise=require(_0xa5aa('0x4'));var rp=require(_0xa5aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5aa('0x6'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x3d3503,_0x16ba05){return _0x3d3503[_0xa5aa('0x7')](_0xa5aa('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xa5aa('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9a2e027..3f301a9 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 _0x7b04=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s'];(function(_0x43a8b9,_0x4ff1e0){var _0x39894b=function(_0x48b507){while(--_0x48b507){_0x43a8b9['push'](_0x43a8b9['shift']());}};_0x39894b(++_0x4ff1e0);}(_0x7b04,0x157));var _0x47b0=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7b04[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require(_0x47b0('0x0'));var moment=require(_0x47b0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b0('0x2'));var db=require(_0x47b0('0x3'))['db'];var utils=require(_0x47b0('0x4'));var logger=require(_0x47b0('0x5'))(_0x47b0('0x6'));var config=require(_0x47b0('0x7'));var jayson=require(_0x47b0('0x8'));var client=jayson[_0x47b0('0x9')][_0x47b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x366e67,_0x3227cf,_0x35e8c7){return new BPromise(function(_0x4fc356,_0x4fa919){return client[_0x47b0('0xb')](_0x366e67,_0x35e8c7)[_0x47b0('0xc')](function(_0x74ac52){logger['info'](_0x47b0('0xd'),_0x3227cf,_0x47b0('0xe'));logger[_0x47b0('0xf')](_0x47b0('0x10'),_0x3227cf,_0x47b0('0xe'),JSON[_0x47b0('0x11')](_0x74ac52));if(_0x74ac52['error']){if(_0x74ac52[_0x47b0('0x12')]['code']===0x1f4){logger['error'](_0x47b0('0xd'),_0x3227cf,_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);return _0x4fa919(_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3227cf,_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);return _0x4fc356(_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);}else{logger['info'](_0x47b0('0xd'),_0x3227cf,'request\x20sent');_0x4fc356(_0x74ac52['result'][_0x47b0('0x13')]);}})[_0x47b0('0x14')](function(_0x1f09e9){logger[_0x47b0('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x3227cf,_0x1f09e9);_0x4fa919(_0x1f09e9);});});} \ No newline at end of file +var _0x2a7c=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4c78e5,_0x5c4849){var _0x43d4be=function(_0x1e2225){while(--_0x1e2225){_0x4c78e5['push'](_0x4c78e5['shift']());}};_0x43d4be(++_0x5c4849);}(_0x2a7c,0x11e));var _0xc2a7=function(_0xad3af7,_0x3cf642){_0xad3af7=_0xad3af7-0x0;var _0xb42df6=_0x2a7c[_0xad3af7];return _0xb42df6;};'use strict';var _=require(_0xc2a7('0x0'));var util=require(_0xc2a7('0x1'));var moment=require('moment');var BPromise=require(_0xc2a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2a7('0x4'));var logger=require(_0xc2a7('0x5'))(_0xc2a7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2a7('0x7')][_0xc2a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a0c12,_0x2d40b7,_0x5d9a7e){return new BPromise(function(_0x5804d1,_0x37a988){return client[_0xc2a7('0x9')](_0x1a0c12,_0x5d9a7e)[_0xc2a7('0xa')](function(_0x21bca0){logger[_0xc2a7('0xb')](_0xc2a7('0xc'),_0x2d40b7,_0xc2a7('0xd'));logger['debug'](_0xc2a7('0xe'),_0x2d40b7,_0xc2a7('0xd'),JSON[_0xc2a7('0xf')](_0x21bca0));if(_0x21bca0[_0xc2a7('0x10')]){if(_0x21bca0[_0xc2a7('0x10')][_0xc2a7('0x11')]===0x1f4){logger[_0xc2a7('0x10')](_0xc2a7('0xc'),_0x2d40b7,_0x21bca0[_0xc2a7('0x10')][_0xc2a7('0x12')]);return _0x37a988(_0x21bca0[_0xc2a7('0x10')]['message']);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2d40b7,_0x21bca0[_0xc2a7('0x10')][_0xc2a7('0x12')]);return _0x5804d1(_0x21bca0['error'][_0xc2a7('0x12')]);}else{logger[_0xc2a7('0xb')](_0xc2a7('0xc'),_0x2d40b7,_0xc2a7('0xd'));_0x5804d1(_0x21bca0['result']['message']);}})[_0xc2a7('0x13')](function(_0x3d938d){logger[_0xc2a7('0x10')](_0xc2a7('0xc'),_0x2d40b7,_0x3d938d);_0x37a988(_0x3d938d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1fd236b..e39c8da 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 _0x016c=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x4ca426,_0x265a46){var _0x23edec=function(_0xe03a6a){while(--_0xe03a6a){_0x4ca426['push'](_0x4ca426['shift']());}};_0x23edec(++_0x265a46);}(_0x016c,0x1c3));var _0xc016=function(_0x6d948e,_0x240e7c){_0x6d948e=_0x6d948e-0x0;var _0x1affc4=_0x016c[_0x6d948e];return _0x1affc4;};'use strict';var multer=require(_0xc016('0x0'));var util=require(_0xc016('0x1'));var path=require(_0xc016('0x2'));var timeout=require('connect-timeout');var express=require(_0xc016('0x3'));var router=express['Router']();var fs_extra=require(_0xc016('0x4'));var auth=require(_0xc016('0x5'));var interaction=require(_0xc016('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xc016('0x7')]('/',auth[_0xc016('0x8')](),controller[_0xc016('0x9')]);router[_0xc016('0x7')](_0xc016('0xa'),auth['isAuthenticated'](),controller[_0xc016('0xb')]);router[_0xc016('0x7')](_0xc016('0xc'),auth['isAuthenticated'](),controller[_0xc016('0xd')]);router[_0xc016('0xe')]('/',auth[_0xc016('0x8')](),controller[_0xc016('0xf')]);router['put'](_0xc016('0xc'),auth[_0xc016('0x8')](),controller[_0xc016('0x10')]);router['delete']('/:id',auth[_0xc016('0x8')](),controller['destroy']);module[_0xc016('0x11')]=router; \ No newline at end of file +var _0x8cf9=['describe','/:id','create','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x8cf9,0x83));var _0x98cf=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8cf9[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x98cf('0x0'));var util=require(_0x98cf('0x1'));var path=require(_0x98cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x98cf('0x3'));var router=express[_0x98cf('0x4')]();var fs_extra=require(_0x98cf('0x5'));var auth=require(_0x98cf('0x6'));var interaction=require(_0x98cf('0x7'));var config=require('../../config/environment');var controller=require(_0x98cf('0x8'));router[_0x98cf('0x9')]('/',auth[_0x98cf('0xa')](),controller[_0x98cf('0xb')]);router[_0x98cf('0x9')](_0x98cf('0xc'),auth[_0x98cf('0xa')](),controller[_0x98cf('0xd')]);router[_0x98cf('0x9')](_0x98cf('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x98cf('0xa')](),controller[_0x98cf('0xf')]);router[_0x98cf('0x10')](_0x98cf('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x98cf('0xe'),auth[_0x98cf('0xa')](),controller['destroy']);module[_0x98cf('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 76b26b3..71615d6 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 _0xa75b=['ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','TEXT','stringify','input','text','name','onlineForm','parse','getDataValue','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','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.','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xa75b,0x170));var _0xba75=function(_0x2bbde9,_0x3a3e09){_0x2bbde9=_0x2bbde9-0x0;var _0x19418e=_0xa75b[_0x2bbde9];return _0x19418e;};'use strict';var Sequelize=require(_0xba75('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'unique':_0xba75('0x2')},'description':{'type':Sequelize[_0xba75('0x1')]},'mapKey':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x3')},'mapKeyOffline':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x3')},'key':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x4')},'customerAlias':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba75('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xba75('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xba75('0x1')]},'animation':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xba75('0x8')](_0xba75('0x9'),_0xba75('0xa')),'defaultValue':_0xba75('0x9')},'header_online':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xb')},'start_chat_button':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xc')},'offline_chat_button':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xba75('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x11')},'placeholderMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x12')},'closingMessageButton':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x13')},'skipMessageButton':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x15')},'ratingType':{'type':Sequelize[_0xba75('0x8')]('star','thumb'),'defaultValue':_0xba75('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xba75('0x17')],'defaultValue':function(){return JSON[_0xba75('0x18')]({'items':[{'type':_0xba75('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xba75('0x1a'),'required':!![]},'props':{'title':_0xba75('0x1b'),'helpText':''}},{'type':_0xba75('0x19'),'props':{'title':_0xba75('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xba75('0x3'),'type':_0xba75('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xba75('0x1c'))?JSON[_0xba75('0x1d')](this[_0xba75('0x1e')](_0xba75('0x1c'))):{};},'set':function(_0x1caa6){return this[_0xba75('0x1f')](_0xba75('0x1c'),JSON[_0xba75('0x18')](_0x1caa6));}},'offlineForm':{'type':Sequelize[_0xba75('0x17')],'defaultValue':function(){return JSON[_0xba75('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xba75('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0xba75('0x20')},'props':{'title':'Comments','helpText':_0xba75('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xba75('0x1e')](_0xba75('0x22'))?JSON['parse'](this[_0xba75('0x1e')](_0xba75('0x22'))):{};},'set':function(_0x8a2e4d){return this[_0xba75('0x1f')]('offlineForm',JSON['stringify'](_0x8a2e4d));}},'token':{'type':Sequelize[_0xba75('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xba75('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xba75('0x1')]},'waitingTitle':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x26')},'skipUnmanaged':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x13')},'enableCustomerAttachment':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xba75('0x17')]},'showAgentAvatar':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xba75('0x1')]},'notificationTemplate':{'type':Sequelize[_0xba75('0x17')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xba75('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x27')},'messagesAlignment':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x28')},'defaultTitle':{'type':Sequelize[_0xba75('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xba75('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':_0xba75('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba75('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba75('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x2a')},'systemAvatar':{'type':Sequelize[_0xba75('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xba75('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![],'comment':_0xba75('0x2c'),'set':function(_0x45d8cd){if(!_0x45d8cd)this[_0xba75('0x1f')](_0xba75('0x2d'),null);this[_0xba75('0x1f')]('mandatoryDisposition',_0x45d8cd);}},'vidaooEscalation':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xba75('0x1')],'defaultValue':function(){return _0xba75('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0xba75('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xba75('0x17')]}}; \ No newline at end of file +var _0xec56=['#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','name','text','input','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','Agent'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xec56,0x1bd));var _0x6ec5=function(_0x46433a,_0x147edd){_0x46433a=_0x46433a-0x0;var _0x3fe2eb=_0xec56[_0x46433a];return _0x3fe2eb;};'use strict';var Sequelize=require(_0x6ec5('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'unique':_0x6ec5('0x2')},'description':{'type':Sequelize[_0x6ec5('0x1')]},'mapKey':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x3')},'mapKeyOffline':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x3')},'key':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x4')},'customerAlias':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6ec5('0x1')]},'animation':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6ec5('0x9')](_0x6ec5('0xa'),_0x6ec5('0xb')),'defaultValue':_0x6ec5('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6ec5('0xc')},'start_chat_button':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xd')},'offline_chat_button':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xe')},'header_offline':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xf')},'download_transcript':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6ec5('0x10')]},'closingQuestion':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x12')},'noteTitle':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x13')},'placeholderMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x14')},'closingMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x15')},'closingMessageButton':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xe')},'skipMessageButton':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x16')},'conditionAgreement':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x6ec5('0x9')](_0x6ec5('0x17'),_0x6ec5('0x18')),'defaultValue':_0x6ec5('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6ec5('0x10')],'defaultValue':function(){return JSON[_0x6ec5('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6ec5('0x1a'),'type':_0x6ec5('0x1b'),'required':!![]},'props':{'title':_0x6ec5('0x1a'),'helpText':''}},{'type':_0x6ec5('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6ec5('0x3'),'type':_0x6ec5('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6ec5('0x1d'))?JSON[_0x6ec5('0x1e')](this[_0x6ec5('0x1f')]('onlineForm')):{};},'set':function(_0x1b779a){return this[_0x6ec5('0x20')](_0x6ec5('0x1d'),JSON[_0x6ec5('0x19')](_0x1b779a));}},'offlineForm':{'type':Sequelize[_0x6ec5('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6ec5('0x1c'),'props':{'title':_0x6ec5('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6ec5('0x3')},'variable':null},{'type':_0x6ec5('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x6ec5('0x22'),'helpText':_0x6ec5('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x6ec5('0x1f')](_0x6ec5('0x24'))?JSON[_0x6ec5('0x1e')](this['getDataValue'](_0x6ec5('0x24'))):{};},'set':function(_0x179f57){return this[_0x6ec5('0x20')](_0x6ec5('0x24'),JSON[_0x6ec5('0x19')](_0x179f57));}},'token':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':function(){return rs[_0x6ec5('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6ec5('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6ec5('0x1')]},'waitingTitle':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6ec5('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x28')},'skipUnmanaged':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x16')},'sendUnmanaged':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6ec5('0x10')],'defaultValue':function(){return _0x6ec5('0x29');}},'notificationSound':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ec5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x2b')},'verticalAlignment':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x6ec5('0x1')]},'customerAvatar':{'type':Sequelize[_0x6ec5('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ec5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x2d')},'systemAvatar':{'type':Sequelize[_0x6ec5('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ec5('0x7')],'comment':_0x6ec5('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![],'comment':_0x6ec5('0x2f'),'set':function(_0x53dcd8){if(!_0x53dcd8)this[_0x6ec5('0x20')]('mandatoryDispositionPauseId',null);this[_0x6ec5('0x20')]('mandatoryDisposition',_0x53dcd8);}},'vidaooEscalation':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6ec5('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ec5('0x30')},'vidaooNote':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':function(){return _0x6ec5('0x31');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6ec5('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 99572ca..dc43248 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 _0x426e=['Attachment','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','mimetype','mapValues','subjectOffline','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','utf8','URL','3.1.0','remote','connection','remoteAddress','alignment','verticalAlignment','labelText','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','destroy','bulkCreate','stack','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','offlineForm','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','ChatWebsites','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','rows','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','ChatWebsiteId','Disposition','findOne','options','findAll','removeDispositions','addAnswer','CannedAnswer','hasOwnProperty','include','removeAnswers','ids','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','server/files/images/avatars/system_avatar.png','notify','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','account','list','applications','priority','Applications','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','contact','messageId','created','autoclose','unmanaged','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','files','attachments','offline-chat','basename','sequelize','transaction'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0x426e,0x182));var _0xe426=function(_0x404303,_0xcf6dee){_0x404303=_0x404303-0x0;var _0x2bb9e5=_0x426e[_0x404303];return _0x2bb9e5;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xe426('0x0'));var util=require('util');var path=require(_0xe426('0x1'));var ejs=require(_0xe426('0x2'));var fs=require('fs');var fs_extra=require(_0xe426('0x3'));var _=require(_0xe426('0x4'));var querystring=require(_0xe426('0x5'));var Redis=require(_0xe426('0x6'));var qs=require(_0xe426('0x7'));var logger=require(_0xe426('0x8'))(_0xe426('0x9'));var config=require(_0xe426('0xa'));var url=require(_0xe426('0xb'));var db=require(_0xe426('0xc'))['db'];config[_0xe426('0xd')]=_['defaults'](config[_0xe426('0xd')],{'host':_0xe426('0xe'),'port':0x18eb});var socket=require(_0xe426('0xf'))(new Redis(config[_0xe426('0xd')]));require(_0xe426('0x10'))[_0xe426('0x11')](socket);var htmlToText=require(_0xe426('0x12'));var jayson=require(_0xe426('0x13'));var client=jayson[_0xe426('0x14')][_0xe426('0x15')]({'port':0x232c});var client9002=jayson[_0xe426('0x14')][_0xe426('0x15')]({'port':0x232a});var client9003=jayson[_0xe426('0x14')][_0xe426('0x15')]({'port':0x232b});var client9001=jayson[_0xe426('0x14')]['http']({'port':0x2329});function respondWithRpcPromise(_0x5b29a4,_0x13d983,_0x43a4d8,_0x411ea1){return new BPromise(function(_0x4ec2cb,_0x1f23a1){var _0x7a3333=_0x411ea1||client;return _0x7a3333[_0xe426('0x16')](_0x5b29a4,_0x43a4d8)[_0xe426('0x17')](function(_0x1b0567){logger['info'](_0xe426('0x18'),_0x13d983,'request\x20sent');logger[_0xe426('0x19')](_0xe426('0x1a'),_0x13d983,_0xe426('0x1b'),JSON['stringify'](_0x1b0567));if(_0x1b0567[_0xe426('0x1c')]){if(_0x1b0567['error']['code']===0x1f4){logger[_0xe426('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x13d983,_0x1b0567[_0xe426('0x1c')][_0xe426('0x1d')]);return _0x1f23a1(_0x1b0567[_0xe426('0x1c')]['message']);}logger[_0xe426('0x1c')](_0xe426('0x18'),_0x13d983,_0x1b0567['error'][_0xe426('0x1d')]);return _0x4ec2cb(_0x1b0567['error']['message']);}else{logger[_0xe426('0x1e')](_0xe426('0x18'),_0x13d983,'request\x20sent');_0x4ec2cb(_0x1b0567[_0xe426('0x1f')][_0xe426('0x1d')]);}})[_0xe426('0x20')](function(_0x36f2c4){logger[_0xe426('0x1c')](_0xe426('0x18'),_0x13d983,_0x36f2c4);_0x1f23a1(_0x36f2c4);});});}function respondWithStatusCode(_0x37baa0,_0x577504){_0x577504=_0x577504||0xcc;return function(_0xbea2c8){if(_0xbea2c8){return _0x37baa0[_0xe426('0x21')](_0x577504);}return _0x37baa0[_0xe426('0x22')](_0x577504)[_0xe426('0x23')]();};}function respondWithResult(_0x62954e,_0x2e381f){_0x2e381f=_0x2e381f||0xc8;return function(_0x42d06c){if(_0x42d06c){return _0x62954e[_0xe426('0x22')](_0x2e381f)[_0xe426('0x24')](_0x42d06c);}};}function respondWithFilteredResult(_0x20a9cc,_0x1e64a7){return function(_0x101d8c){if(_0x101d8c){var _0x53c4f3=typeof _0x1e64a7[_0xe426('0x25')]===_0xe426('0x26')&&typeof _0x1e64a7['limit']===_0xe426('0x26');var _0xfbbbf3=_0x101d8c[_0xe426('0x27')];var _0x554411=_0x53c4f3?0x0:_0x1e64a7[_0xe426('0x25')];var _0x5ad5ba=_0x53c4f3?_0x101d8c[_0xe426('0x27')]:_0x1e64a7[_0xe426('0x25')]+_0x1e64a7['limit'];var _0xbf028e;if(_0x5ad5ba>=_0xfbbbf3){_0x5ad5ba=_0xfbbbf3;_0xbf028e=0xc8;}else{_0xbf028e=0xce;}_0x20a9cc[_0xe426('0x22')](_0xbf028e);return _0x20a9cc['set'](_0xe426('0x28'),_0x554411+'-'+_0x5ad5ba+'/'+_0xfbbbf3)[_0xe426('0x24')](_0x101d8c);}return null;};}function saveUpdates(_0x1cb9be){return function(_0x5e6cd0){if(_0x5e6cd0){return _0x5e6cd0['update'](_0x1cb9be)[_0xe426('0x17')](function(_0xfcbb07){return _0xfcbb07;});}return null;};}function removeEntity(_0x396bd4){return function(_0x55edb2){if(_0x55edb2){return _0x55edb2['destroy']()['then'](function(){var _0x1c03e5=_0x55edb2['get']({'plain':!![]});var _0x478703=_0xe426('0x29');return db[_0xe426('0x2a')]['destroy']({'where':{'type':_0x478703,'resourceId':_0x1c03e5['id']}})[_0xe426('0x17')](function(){return _0x55edb2;});})[_0xe426('0x17')](function(){_0x396bd4[_0xe426('0x22')](0xcc)[_0xe426('0x23')]();});}};}function handleEntityNotFound(_0x2e504b){return function(_0x21a4cb){if(!_0x21a4cb){_0x2e504b[_0xe426('0x21')](0x194);}return _0x21a4cb;};}function handleError(_0x5106c5,_0xa2cdc1){_0xa2cdc1=_0xa2cdc1||0x1f4;return function(_0x1c177b){logger['error'](_0x1c177b['stack']);if(_0x1c177b[_0xe426('0x2b')]){delete _0x1c177b[_0xe426('0x2b')];}_0x5106c5['status'](_0xa2cdc1)[_0xe426('0x2c')](_0x1c177b);};}exports['index']=function(_0x2d13e5,_0x36a224){var _0x365f72={'include':[{'model':db[_0xe426('0x2d')],'as':_0xe426('0x2e')}]},_0x3cdc10={},_0x5e58ff={'count':0x0,'rows':[]};var _0xa91b0b=_[_0xe426('0x2f')](db[_0xe426('0x30')][_0xe426('0x31')],function(_0x4a261a){return{'name':_0x4a261a['fieldName'],'type':_0x4a261a[_0xe426('0x32')][_0xe426('0x33')]};});_0x3cdc10[_0xe426('0x34')]=_['map'](_0xa91b0b,_0xe426('0x2b'));_0x3cdc10[_0xe426('0x35')]=_[_0xe426('0x36')](_0x2d13e5[_0xe426('0x35')]);_0x3cdc10[_0xe426('0x37')]=_[_0xe426('0x38')](_0x3cdc10[_0xe426('0x34')],_0x3cdc10[_0xe426('0x35')]);_0x365f72[_0xe426('0x39')]=_[_0xe426('0x38')](_0x3cdc10[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x2d13e5[_0xe426('0x35')][_0xe426('0x3a')]));_0x365f72[_0xe426('0x39')]=_0x365f72[_0xe426('0x39')]['length']?_0x365f72[_0xe426('0x39')]:_0x3cdc10[_0xe426('0x34')];if(!_0x2d13e5[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x365f72['limit']=qs[_0xe426('0x3c')](_0x2d13e5[_0xe426('0x35')][_0xe426('0x3c')]);_0x365f72[_0xe426('0x25')]=qs['offset'](_0x2d13e5[_0xe426('0x35')][_0xe426('0x25')]);}_0x365f72[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x2d13e5['query'][_0xe426('0x3e')]);_0x365f72['where']=qs[_0xe426('0x37')](_[_0xe426('0x3f')](_0x2d13e5['query'],_0x3cdc10[_0xe426('0x37')]),_0xa91b0b);if(_0x2d13e5[_0xe426('0x35')]['filter']){_0x365f72[_0xe426('0x40')]=_[_0xe426('0x41')](_0x365f72[_0xe426('0x40')],{'$or':_['map'](_0xa91b0b,function(_0x345b8e){if(_0x345b8e[_0xe426('0x32')]!==_0xe426('0x42')){var _0x55936f={};_0x55936f[_0x345b8e[_0xe426('0x2b')]]={'$like':'%'+_0x2d13e5[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x55936f;}})});}_0x365f72=_['merge']({},_0x365f72,_0x2d13e5['options']);var _0x5dbaae={'where':_0x365f72[_0xe426('0x40')]};return db[_0xe426('0x30')][_0xe426('0x27')](_0x5dbaae)[_0xe426('0x17')](function(_0x2d4e4c){_0x5e58ff['count']=_0x2d4e4c;if(_0x2d13e5[_0xe426('0x35')][_0xe426('0x44')]){_0x365f72['include']=[{'all':!![]}];}return db[_0xe426('0x30')]['findAll'](_0x365f72);})[_0xe426('0x17')](function(_0x5ad755){_0x5e58ff[_0xe426('0x45')]=_0x5ad755;return _0x5e58ff;})[_0xe426('0x17')](respondWithFilteredResult(_0x36a224,_0x365f72))['catch'](handleError(_0x36a224,null));};exports[_0xe426('0x46')]=function(_0x310500,_0x5d7545){var _0x522872={'raw':![],'where':{'id':_0x310500[_0xe426('0x47')]['id']},'include':[{'model':db[_0xe426('0x2d')],'as':_0xe426('0x2e')}]},_0x53b71a={};_0x53b71a[_0xe426('0x34')]=_[_0xe426('0x36')](db[_0xe426('0x30')][_0xe426('0x31')]);_0x53b71a[_0xe426('0x35')]=_[_0xe426('0x36')](_0x310500[_0xe426('0x35')]);_0x53b71a['filters']=_[_0xe426('0x38')](_0x53b71a[_0xe426('0x34')],_0x53b71a['query']);_0x522872[_0xe426('0x39')]=_[_0xe426('0x38')](_0x53b71a[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x310500['query']['fields']));_0x522872[_0xe426('0x39')]=_0x522872[_0xe426('0x39')][_0xe426('0x48')]?_0x522872[_0xe426('0x39')]:_0x53b71a['model'];if(_0x310500[_0xe426('0x35')][_0xe426('0x44')]){_0x522872['include']=[{'all':!![]}];}_0x522872=_[_0xe426('0x41')]({},_0x522872,_0x310500['options']);return db[_0xe426('0x30')][_0xe426('0x49')](_0x522872)[_0xe426('0x17')](handleEntityNotFound(_0x5d7545,null))['then'](respondWithResult(_0x5d7545,null))['catch'](handleError(_0x5d7545,null));};exports[_0xe426('0x4a')]=function(_0x4ff4a2,_0x528c0d){return db['ChatWebsite']['create'](_0x4ff4a2[_0xe426('0x4b')],{})[_0xe426('0x17')](function(_0x3fccc5){var _0x2aeac2=_0x4ff4a2['user'][_0xe426('0x4c')]({'plain':!![]});if(!_0x2aeac2)throw new Error(_0xe426('0x4d'));if(_0x2aeac2[_0xe426('0x4e')]===_0xe426('0x4f')){var _0x3bf7bb=_0x3fccc5[_0xe426('0x4c')]({'plain':!![]});var _0x110372=_0xe426('0x29');return db[_0xe426('0x50')][_0xe426('0x49')]({'where':{'name':_0x110372,'userProfileId':_0x2aeac2['userProfileId']},'raw':!![]})[_0xe426('0x17')](function(_0x1eea18){if(_0x1eea18&&_0x1eea18[_0xe426('0x51')]===0x0){return db[_0xe426('0x2a')]['create']({'name':_0x3bf7bb[_0xe426('0x2b')],'resourceId':_0x3bf7bb['id'],'type':_0x1eea18[_0xe426('0x2b')],'sectionId':_0x1eea18['id']},{})[_0xe426('0x17')](function(){return _0x3fccc5;});}else{return _0x3fccc5;}})[_0xe426('0x20')](function(_0x3ef90c){logger[_0xe426('0x1c')](_0xe426('0x52'),_0x3ef90c);throw _0x3ef90c;});}return _0x3fccc5;})['then'](respondWithResult(_0x528c0d,0xc9))[_0xe426('0x20')](handleError(_0x528c0d,null));};exports[_0xe426('0x53')]=function(_0x9f5082,_0x2d0205){if(_0x9f5082['body']['id']){delete _0x9f5082[_0xe426('0x4b')]['id'];}return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x9f5082[_0xe426('0x47')]['id']},'include':[{'model':db['Pause'],'as':_0xe426('0x2e')}]})['then'](handleEntityNotFound(_0x2d0205,null))[_0xe426('0x17')](saveUpdates(_0x9f5082['body'],null))[_0xe426('0x17')](respondWithResult(_0x2d0205,null))['catch'](handleError(_0x2d0205,null));};exports['destroy']=function(_0x3c6681,_0x55ddbe){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x3c6681[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x55ddbe,null))[_0xe426('0x17')](removeEntity(_0x55ddbe,null))[_0xe426('0x20')](handleError(_0x55ddbe,null));};exports[_0xe426('0x54')]=function(_0x4450af,_0x317787){return db[_0xe426('0x30')][_0xe426('0x54')]()['then'](respondWithResult(_0x317787,null))['catch'](handleError(_0x317787,null));};exports['addDisposition']=function(_0x12b481,_0x307ff3){if(_0x12b481['body']['id']){delete _0x12b481[_0xe426('0x4b')]['id'];}return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x12b481[_0xe426('0x47')]['id']}})['then'](handleEntityNotFound(_0x307ff3,null))[_0xe426('0x17')](function(_0x59b68f){if(_0x59b68f){_0x12b481['body'][_0xe426('0x55')]=_0x59b68f['id'];return db[_0xe426('0x56')][_0xe426('0x4a')](_0x12b481[_0xe426('0x4b')]);}})[_0xe426('0x17')](respondWithResult(_0x307ff3,null))[_0xe426('0x20')](handleError(_0x307ff3,null));};exports['getDispositions']=function(_0x472031,_0x2fd67a){var _0x5d28a5={'raw':![],'where':{}};var _0x508fe2={};var _0x29d091={'count':0x0,'rows':[]};return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x472031[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2fd67a,null))[_0xe426('0x17')](function(_0x152125){if(_0x152125){_0x508fe2[_0xe426('0x34')]=_['keys'](db['Disposition']['rawAttributes']);_0x508fe2[_0xe426('0x35')]=_[_0xe426('0x36')](_0x472031[_0xe426('0x35')]);_0x508fe2[_0xe426('0x37')]=_[_0xe426('0x38')](_0x508fe2[_0xe426('0x34')],_0x508fe2[_0xe426('0x35')]);_0x5d28a5[_0xe426('0x39')]=_[_0xe426('0x38')](_0x508fe2[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x472031[_0xe426('0x35')][_0xe426('0x3a')]));_0x5d28a5['attributes']=_0x5d28a5[_0xe426('0x39')][_0xe426('0x48')]?_0x5d28a5[_0xe426('0x39')]:_0x508fe2[_0xe426('0x34')];if(!_0x472031[_0xe426('0x35')]['hasOwnProperty']('nolimit')){_0x5d28a5[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x472031[_0xe426('0x35')]['limit']);_0x5d28a5[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x472031['query'][_0xe426('0x25')]);}_0x5d28a5[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x472031[_0xe426('0x35')][_0xe426('0x3e')]);_0x5d28a5[_0xe426('0x40')]=qs['filters'](_[_0xe426('0x3f')](_0x472031[_0xe426('0x35')],_0x508fe2[_0xe426('0x37')]));_0x5d28a5[_0xe426('0x40')][_0xe426('0x55')]=_0x152125['id'];if(_0x472031[_0xe426('0x35')][_0xe426('0x43')]){_0x5d28a5['where']=_['merge'](_0x5d28a5[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x5d28a5['attributes'],function(_0x59d120){var _0x2384e5={};_0x2384e5[_0x59d120]={'$like':'%'+_0x472031[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x2384e5;})});}_0x5d28a5=_[_0xe426('0x41')]({},_0x5d28a5,_0x472031[_0xe426('0x58')]);return db[_0xe426('0x56')][_0xe426('0x27')]({'where':_0x5d28a5[_0xe426('0x40')]})[_0xe426('0x17')](function(_0x136e54){_0x29d091[_0xe426('0x27')]=_0x136e54;if(_0x472031['query']['includeAll']){_0x5d28a5['include']=[{'all':!![]}];}return db[_0xe426('0x56')][_0xe426('0x59')](_0x5d28a5);})['then'](function(_0x16ba01){_0x29d091['rows']=_0x16ba01;return _0x29d091;});}})[_0xe426('0x17')](respondWithFilteredResult(_0x2fd67a,_0x5d28a5))[_0xe426('0x20')](handleError(_0x2fd67a,null));};exports[_0xe426('0x5a')]=function(_0x30d198,_0x918582){return db['ChatWebsite'][_0xe426('0x49')]({'where':{'id':_0x30d198[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x918582,null))[_0xe426('0x17')](function(_0x129898){if(_0x129898){return _0x129898['removeDispositions'](_0x30d198['query']['ids']);}})['then'](respondWithStatusCode(_0x918582,null))[_0xe426('0x20')](handleError(_0x918582,null));};exports[_0xe426('0x5b')]=function(_0x34f09a,_0x2830c2){if(_0x34f09a['body']['id']){delete _0x34f09a[_0xe426('0x4b')]['id'];}return db[_0xe426('0x30')]['find']({'where':{'id':_0x34f09a[_0xe426('0x47')]['id']}})['then'](handleEntityNotFound(_0x2830c2,null))[_0xe426('0x17')](function(_0x1ad8b5){if(_0x1ad8b5){_0x34f09a[_0xe426('0x4b')][_0xe426('0x55')]=_0x1ad8b5['id'];return db[_0xe426('0x5c')][_0xe426('0x4a')](_0x34f09a[_0xe426('0x4b')]);}})[_0xe426('0x17')](respondWithResult(_0x2830c2,null))[_0xe426('0x20')](handleError(_0x2830c2,null));};exports['getAnswers']=function(_0x4992df,_0x184ea6){var _0x3d4ef7={'raw':![],'where':{}};var _0x51f3b1={};var _0x250f78={'count':0x0,'rows':[]};return db[_0xe426('0x30')]['findOne']({'where':{'id':_0x4992df[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x184ea6,null))['then'](function(_0x9eaac2){if(_0x9eaac2){_0x51f3b1[_0xe426('0x34')]=_[_0xe426('0x36')](db[_0xe426('0x5c')][_0xe426('0x31')]);_0x51f3b1[_0xe426('0x35')]=_['keys'](_0x4992df[_0xe426('0x35')]);_0x51f3b1[_0xe426('0x37')]=_[_0xe426('0x38')](_0x51f3b1[_0xe426('0x34')],_0x51f3b1[_0xe426('0x35')]);_0x3d4ef7[_0xe426('0x39')]=_[_0xe426('0x38')](_0x51f3b1[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x4992df[_0xe426('0x35')][_0xe426('0x3a')]));_0x3d4ef7[_0xe426('0x39')]=_0x3d4ef7['attributes'][_0xe426('0x48')]?_0x3d4ef7[_0xe426('0x39')]:_0x51f3b1[_0xe426('0x34')];if(!_0x4992df[_0xe426('0x35')][_0xe426('0x5d')](_0xe426('0x3b'))){_0x3d4ef7[_0xe426('0x3c')]=qs['limit'](_0x4992df['query'][_0xe426('0x3c')]);_0x3d4ef7[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x4992df['query'][_0xe426('0x25')]);}_0x3d4ef7[_0xe426('0x3d')]=qs['sort'](_0x4992df['query'][_0xe426('0x3e')]);_0x3d4ef7['where']=qs[_0xe426('0x37')](_[_0xe426('0x3f')](_0x4992df['query'],_0x51f3b1[_0xe426('0x37')]));_0x3d4ef7['where'][_0xe426('0x55')]=_0x9eaac2['id'];if(_0x4992df[_0xe426('0x35')][_0xe426('0x43')]){_0x3d4ef7[_0xe426('0x40')]=_[_0xe426('0x41')](_0x3d4ef7[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x3d4ef7['attributes'],function(_0x2309bd){var _0x467759={};_0x467759[_0x2309bd]={'$like':'%'+_0x4992df['query'][_0xe426('0x43')]+'%'};return _0x467759;})});}_0x3d4ef7=_[_0xe426('0x41')]({},_0x3d4ef7,_0x4992df['options']);return db['CannedAnswer'][_0xe426('0x27')]({'where':_0x3d4ef7[_0xe426('0x40')]})['then'](function(_0x2c2651){_0x250f78[_0xe426('0x27')]=_0x2c2651;if(_0x4992df['query'][_0xe426('0x44')]){_0x3d4ef7[_0xe426('0x5e')]=[{'all':!![]}];}return db[_0xe426('0x5c')][_0xe426('0x59')](_0x3d4ef7);})[_0xe426('0x17')](function(_0xb35ff3){_0x250f78[_0xe426('0x45')]=_0xb35ff3;return _0x250f78;});}})['then'](respondWithFilteredResult(_0x184ea6,_0x3d4ef7))[_0xe426('0x20')](handleError(_0x184ea6,null));};exports[_0xe426('0x5f')]=function(_0x215aa4,_0x2d5c89){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x215aa4['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2d5c89,null))[_0xe426('0x17')](function(_0x4726d5){if(_0x4726d5){return _0x4726d5[_0xe426('0x5f')](_0x215aa4['query'][_0xe426('0x60')]);}})['then'](respondWithStatusCode(_0x2d5c89,null))[_0xe426('0x20')](handleError(_0x2d5c89,null));};exports['addLogo']=function(_0x357641,_0x2380b8){_0x357641[_0xe426('0x4b')][_0xe426('0x61')]=_0x357641[_0xe426('0x62')][_0xe426('0x63')];return db['ChatWebsite']['find']({'where':{'id':_0x357641[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2380b8,null))['then'](saveUpdates(_0x357641[_0xe426('0x4b')],null))['then'](respondWithResult(_0x2380b8,null))[_0xe426('0x20')](handleError(_0x2380b8,null));};exports['addAvatar']=function(_0xb3de01,_0x1275da){_0xb3de01[_0xe426('0x4b')][_0xe426('0x64')]=_0xb3de01['file']['filename'];return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0xb3de01[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1275da,null))[_0xe426('0x17')](saveUpdates(_0xb3de01[_0xe426('0x4b')],null))[_0xe426('0x17')](respondWithResult(_0x1275da,null))[_0xe426('0x20')](handleError(_0x1275da,null));};exports[_0xe426('0x65')]=function(_0x135566,_0x3a89ba){_0x135566[_0xe426('0x4b')][_0xe426('0x66')]=_0x135566[_0xe426('0x62')]['filename'];return db['ChatWebsite'][_0xe426('0x49')]({'where':{'id':_0x135566[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x3a89ba,null))[_0xe426('0x17')](saveUpdates(_0x135566['body'],null))['then'](respondWithResult(_0x3a89ba,null))[_0xe426('0x20')](handleError(_0x3a89ba,null));};exports[_0xe426('0x67')]=function(_0x5d1af1,_0x2a1232){_0x5d1af1[_0xe426('0x4b')][_0xe426('0x68')]=_0x5d1af1[_0xe426('0x62')][_0xe426('0x63')];return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x5d1af1[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2a1232,null))[_0xe426('0x17')](saveUpdates(_0x5d1af1['body'],null))['then'](respondWithResult(_0x2a1232,null))[_0xe426('0x20')](handleError(_0x2a1232,null));};exports[_0xe426('0x69')]=function(_0x26fc94,_0x4a926a){var _0xe87470=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x6c'));var _0x128c1e={'where':{'id':_0x26fc94[_0xe426('0x47')]['id']},'attributes':['id',_0xe426('0x61')],'raw':!![]};var _0x316cfa=![];return require('../../config/license/util')[_0xe426('0x6d')]()[_0xe426('0x17')](function(_0x369a0a){if(_0x369a0a){_0x316cfa=_0x369a0a[_0xe426('0x6e')];}})[_0xe426('0x17')](function(){return db['ChatWebsite'][_0xe426('0x49')](_0x128c1e);})[_0xe426('0x17')](handleEntityNotFound(_0x4a926a,null))[_0xe426('0x17')](function(_0x5aa974){if(_0x5aa974){if(!_[_0xe426('0x6f')](_0x5aa974[_0xe426('0x61')])){if(fs[_0xe426('0x70')](path[_0xe426('0x6a')](config['root'],_0xe426('0x71'),_0x5aa974[_0xe426('0x61')]))&&_0x316cfa){_0xe87470=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x71'),_0x5aa974[_0xe426('0x61')]);}}return _0x4a926a[_0xe426('0x72')](_0xe87470);}})[_0xe426('0x20')](handleError(_0x4a926a,null));};exports['getAvatar']=function(_0x3a2792,_0x1c96f7){var _0x18a3de=path['join'](config[_0xe426('0x6b')],_0xe426('0x73'));var _0x476fba={'where':{'id':_0x3a2792[_0xe426('0x47')]['id']},'attributes':['id',_0xe426('0x64')],'raw':!![]};return db[_0xe426('0x30')][_0xe426('0x49')](_0x476fba)[_0xe426('0x17')](handleEntityNotFound(_0x1c96f7,null))[_0xe426('0x17')](function(_0x42ccd4){if(_0x42ccd4){if(!_['isNil'](_0x42ccd4[_0xe426('0x64')])){if(fs['existsSync'](path[_0xe426('0x6a')](config['root'],_0xe426('0x74'),_0x42ccd4[_0xe426('0x64')]))){_0x18a3de=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x74'),_0x42ccd4['agentAvatar']);}}return _0x1c96f7[_0xe426('0x72')](_0x18a3de);}})['catch'](handleError(_0x1c96f7,null));};exports[_0xe426('0x75')]=function(_0x2b56da,_0x401297){var _0x26c954=path['join'](config['root'],_0xe426('0x76'));var _0x584dac={'where':{'id':_0x2b56da[_0xe426('0x47')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xe426('0x30')][_0xe426('0x49')](_0x584dac)['then'](handleEntityNotFound(_0x401297,null))[_0xe426('0x17')](function(_0x5d1756){if(_0x5d1756){if(!_[_0xe426('0x6f')](_0x5d1756[_0xe426('0x66')])){if(fs[_0xe426('0x70')](path[_0xe426('0x6a')](config['root'],'server/files/images/avatars/',_0x5d1756['customerAvatar']))&&_0x5d1756['showCustomerAvatar']){_0x26c954=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x74'),_0x5d1756[_0xe426('0x66')]);}}return _0x401297['download'](_0x26c954);}})[_0xe426('0x20')](handleError(_0x401297,null));};exports['getSystemAvatar']=function(_0x55afad,_0x27ed74){var _0x3b8560=path['join'](config[_0xe426('0x6b')],_0xe426('0x77'));var _0x239eca={'where':{'id':_0x55afad[_0xe426('0x47')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xe426('0x49')](_0x239eca)[_0xe426('0x17')](handleEntityNotFound(_0x27ed74,null))['then'](function(_0x421f7c){if(_0x421f7c){if(!_[_0xe426('0x6f')](_0x421f7c[_0xe426('0x68')])){if(fs[_0xe426('0x70')](path['join'](config[_0xe426('0x6b')],_0xe426('0x74'),_0x421f7c['systemAvatar']))){_0x3b8560=path['join'](config['root'],'server/files/images/avatars/',_0x421f7c[_0xe426('0x68')]);}}return _0x27ed74[_0xe426('0x72')](_0x3b8560);}})['catch'](handleError(_0x27ed74,null));};exports[_0xe426('0x78')]=function(_0x922e28,_0x30d0c7){var _0x324bc9=require('user-agent-parser');var _0x4ea2fd=new _0x324bc9();var _0x181e45=_0x4ea2fd['setUA'](_0x922e28[_0xe426('0x79')][_0xe426('0x7a')])[_0xe426('0x7b')]();var _0x751919={'body':_0x922e28['body'],'channel':_0xe426('0x7c')};var _0x25b1a5=[];var _0x3e64da=[];var _0x5de36a={};var _0x5618ec=![];return db[_0xe426('0x7d')][_0xe426('0x54')]()['then'](function(_0x2798a2){if(!_0x2798a2){throw new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x80'));}_0x25b1a5=_[_0xe426('0x81')](_[_0xe426('0x36')](_0x2798a2),[_0xe426('0x82'),'updatedAt']);_0x3e64da=_[_0xe426('0x81')](_[_0xe426('0x36')](_0x2798a2),[_0xe426('0x82'),_0xe426('0x83'),_0xe426('0x84'),_0xe426('0x85')]);if(_0x922e28[_0xe426('0x4b')]['id']){delete _0x922e28[_0xe426('0x4b')]['id'];}if(_[_0xe426('0x6f')](_0x922e28['body'][_0xe426('0x86')])){throw new db[(_0xe426('0x7e'))]['ValidationError'](_0xe426('0x87'));}if(_[_0xe426('0x6f')](_0x922e28[_0xe426('0x4b')][_0xe426('0x4b')])||_0x922e28[_0xe426('0x4b')][_0xe426('0x4b')]===''){throw new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x88'));}if(_[_0xe426('0x6f')](_0x922e28[_0xe426('0x4b')][_0xe426('0x89')])){throw new db[(_0xe426('0x7e'))]['ValidationError'](_0xe426('0x8a')+_0x3e64da);}if(!_[_0xe426('0x8b')](_0x3e64da,_0x922e28[_0xe426('0x4b')][_0xe426('0x89')])){throw new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x8c')+_0x3e64da);}_0x5de36a[_0x922e28[_0xe426('0x4b')][_0xe426('0x89')]]=_0x922e28[_0xe426('0x4b')]['from'];})[_0xe426('0x17')](function(){return db['ChatWebsite'][_0xe426('0x49')]({'where':{'id':_0x922e28[_0xe426('0x47')]['id']},'include':[{'model':db[_0xe426('0x8d')],'as':_0xe426('0x8e'),'include':[{'model':db[_0xe426('0x7d')],'as':_0xe426('0x8f'),'where':_0x5de36a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xe426('0x90')],'as':'Applications'}]});})[_0xe426('0x17')](handleEntityNotFound(_0x30d0c7,null))['then'](function(_0x32eaae){if(_0x32eaae&&_0x32eaae['List']){_0x751919[_0xe426('0x91')]=_0x32eaae;_0x751919['applications']=_0x32eaae['Applications'];_0x751919[_0xe426('0x92')]=_0x32eaae[_0xe426('0x8e')];_0x751919[_0xe426('0x93')]=_['orderBy'](_0x751919[_0xe426('0x93')],[_0xe426('0x94')],['asc']);if(_0x751919[_0xe426('0x91')]['Applications']){delete _0x751919[_0xe426('0x91')][_0xe426('0x95')];}if(_0x751919[_0xe426('0x91')][_0xe426('0x8e')]&&_0x751919[_0xe426('0x91')][_0xe426('0x8e')]['Contacts']['length']){return _0x751919[_0xe426('0x91')][_0xe426('0x8e')][_0xe426('0x8f')][0x0];}var _0x43cfad=_[_0xe426('0x96')](_0x922e28[_0xe426('0x4b')],{'firstName':_0x922e28[_0xe426('0x4b')][_0xe426('0x86')],'ListId':_0x32eaae[_0xe426('0x85')]});_0x43cfad[_0x922e28[_0xe426('0x4b')]['mapKey']]=_0x922e28[_0xe426('0x4b')][_0xe426('0x86')];return db['CmContact'][_0xe426('0x4a')](_0x43cfad,{'fields':_0x25b1a5,'raw':!![]});}})['then'](handleEntityNotFound(_0x30d0c7,null))[_0xe426('0x17')](function(_0x59e2b3){_0x751919['contact']=_0x59e2b3;var _0x4047f9=_0x922e28[_0xe426('0x4b')][_0xe426('0x97')];if(_0x922e28[_0xe426('0x79')][_0xe426('0x98')]){_0x4047f9=_0x922e28[_0xe426('0x79')][_0xe426('0x98')];}else if(_0x922e28['headers'][_0xe426('0x99')]){_0x4047f9=_[_0xe426('0x9a')](_0x922e28[_0xe426('0x79')][_0xe426('0x99')][_0xe426('0x9b')](','));}if(_0x59e2b3){var _0x1688df={'ContactId':_0x59e2b3['id'],'ChatWebsiteId':_0x922e28[_0xe426('0x47')]['id'],'from':(_0x59e2b3[_0xe426('0x9c')]||'')+'\x20'+(_0x59e2b3[_0xe426('0x9d')]||''),'customerIp':_0x4047f9,'customerPort':_0x922e28[_0xe426('0x79')][_0xe426('0x9e')]?_0x922e28['headers']['x-real-port']:null,'referer':_0x922e28[_0xe426('0x4b')][_0xe426('0x9f')],'browserName':_0x181e45[_0xe426('0xa0')][_0xe426('0x2b')]&&_0x181e45['browser'][_0xe426('0xa1')]?util['format'](_0xe426('0xa2'),_0x181e45[_0xe426('0xa0')][_0xe426('0x2b')],_0x181e45[_0xe426('0xa0')][_0xe426('0xa1')]):_0xe426('0xa3'),'browserVersion':_0x181e45[_0xe426('0xa0')][_0xe426('0xa1')]||_0xe426('0xa3'),'osName':util[_0xe426('0xa4')](_0xe426('0xa2'),_0x181e45['os'][_0xe426('0x2b')],_0x181e45['os'][_0xe426('0xa1')]),'osVersion':_0x181e45['os'][_0xe426('0xa1')],'deviceModel':_0x181e45[_0xe426('0xa5')][_0xe426('0x34')]&&_0x181e45[_0xe426('0xa5')][_0xe426('0xa6')]?util[_0xe426('0xa4')](_0xe426('0xa7'),_0x181e45[_0xe426('0xa5')][_0xe426('0x34')],_0x181e45[_0xe426('0xa5')][_0xe426('0xa6')],_0x181e45['device'][_0xe426('0x32')]):null,'deviceVendor':_0x181e45[_0xe426('0xa5')][_0xe426('0xa6')],'deviceType':_0x181e45[_0xe426('0xa5')]['type'],'formData':JSON[_0xe426('0xa8')](_0x922e28[_0xe426('0x4b')])};var _0x5669e1={'ChatWebsiteId':_0x922e28[_0xe426('0x47')]['id'],'closed':![]};if(_0x922e28['body'][_0xe426('0xa9')]){_0x5669e1[_0xe426('0xa9')]=_0x922e28['body']['threadId'];return db[_0xe426('0xaa')][_0xe426('0x49')]({'where':_0x5669e1})[_0xe426('0x17')](function(_0x3856d4){if(_0x3856d4){return[_0x3856d4,![]];}_0x1688df[_0xe426('0xa9')]=_0x922e28[_0xe426('0x4b')][_0xe426('0xa9')];_0x1688df[_0xe426('0xab')]=_0x922e28[_0xe426('0x4b')][_0xe426('0xab')];return db[_0xe426('0xaa')][_0xe426('0x4a')](_0x1688df)[_0xe426('0x17')](function(_0x370235){return[_0x370235,!![]];});});}_0x5669e1['ContactId']=_0x59e2b3['id'];if(_0x922e28[_0xe426('0x4b')]['interaction']&&_0x922e28[_0xe426('0x4b')][_0xe426('0xac')]['id']){_0x5669e1['id']=_0x922e28[_0xe426('0x4b')][_0xe426('0xac')]['id'];return db[_0xe426('0xaa')][_0xe426('0x49')]({'where':_0x5669e1})[_0xe426('0x17')](function(_0x44668d){if(_0x44668d){return[_0x44668d,![]];}return db[_0xe426('0xaa')][_0xe426('0x4a')](_0x1688df)[_0xe426('0x17')](function(_0x3bfa0){return[_0x3bfa0,!![]];});});}return db[_0xe426('0xaa')][_0xe426('0x4a')](_0x1688df)['then'](function(_0x4f3011){return[_0x4f3011,!![]];});}})[_0xe426('0xad')](function(_0x1b8726,_0x2f2192){if(_0x1b8726){_0x5618ec=_0x2f2192;if(!_0x2f2192){var _0xf8d0cd={'from':(_0x751919[_0xe426('0xae')][_0xe426('0x9c')]||'')+'\x20'+(_0x751919['contact']['lastName']||'')};if(_0x922e28['body'][_0xe426('0xa9')]&&_0x922e28[_0xe426('0x4b')][_0xe426('0xaf')]&&_0x922e28['body'][_0xe426('0xa9')]!=_0x922e28['body'][_0xe426('0xaf')]){_0xf8d0cd[_0xe426('0xa9')]=_0x922e28[_0xe426('0x4b')]['messageId'];}return _0x1b8726['update'](_0xf8d0cd);}else{return _0x1b8726;}}})[_0xe426('0x17')](function(_0x2d7ac6){_0x751919['interaction']=_0x2d7ac6[_0xe426('0x4c')]({'plain':!![]});_0x751919[_0xe426('0xac')][_0xe426('0xb0')]=_0x5618ec;if(_0x751919[_0xe426('0xac')][_0xe426('0xb0')]){if(_0x751919[_0xe426('0x91')][_0xe426('0xb1')]){_0x751919[_0xe426('0x93')]['push']({'id':0x0,'priority':_0x751919['applications'][_0xe426('0x48')]+0x1,'app':'close','appdata':_0xe426('0xb2'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x922e28[_0xe426('0x4b')][_0xe426('0x4b')],'ChatWebsiteId':_0x922e28[_0xe426('0x47')]['id'],'ChatInteractionId':_0x2d7ac6['id'],'direction':'in','ContactId':_0x751919['contact']['id'],'AttachmentId':_0x922e28[_0xe426('0x4b')][_0xe426('0xb3')]});})[_0xe426('0x17')](function(_0x4ebe54){_0x751919['message']=_0x4ebe54;if(_0x751919[_0xe426('0xac')][_0xe426('0xb4')]){return db[_0xe426('0xb5')][_0xe426('0x49')]({'attributes':['id',_0xe426('0x2b')],'where':{'id':_0x751919['interaction'][_0xe426('0xb4')]}})[_0xe426('0x17')](function(_0x4d0cc4){if(_0x4d0cc4){_0x751919[_0xe426('0x93')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe426('0xb6'),'appdata':_0x4d0cc4[_0xe426('0x2b')]+','+(_0x751919[_0xe426('0x91')][_0xe426('0xb7')]||0xa),'interval':'*,*,*,*'});_0x751919[_0xe426('0xb8')]=!![];}return respondWithRpcPromise(_0xe426('0xb9'),_0xe426('0xba'),_0x751919);});}return respondWithRpcPromise('Start',_0xe426('0xba'),_0x751919);})[_0xe426('0x17')](function(_0x232c32){respondWithRpcPromise('EventManager',_0xe426('0xbb'),{'event':_0xe426('0x78'),'message':_0x232c32},client9002);return _0x232c32;})[_0xe426('0x17')](respondWithResult(_0x30d0c7,null))[_0xe426('0x20')](handleError(_0x30d0c7,null));};exports[_0xe426('0xbc')]=function(_0x48af6c,_0x2bb0c1){var _0x1f769e,_0xc28a0c,_0x24cf7f;var _0x2d00a6=[];var _0x7e1f28={};var _0xc8340=_0x48af6c['files']||[];var _0x43b14a=[];var _0x3602df;return db[_0xe426('0x7d')][_0xe426('0x54')]()['then'](function(_0x1a9c3d){if(!_0x1a9c3d){throw new db['Sequelize'][(_0xe426('0x7f'))](_0xe426('0x80'));}_0x2d00a6=_[_0xe426('0x81')](_[_0xe426('0x36')](_0x1a9c3d),[_0xe426('0x82'),_0xe426('0x83'),_0xe426('0x84'),_0xe426('0x85')]);if(_0x48af6c[_0xe426('0x4b')]['id']){delete _0x48af6c['body']['id'];}if(_[_0xe426('0x6f')](_0x48af6c['body']['from'])){throw _0x2bb0c1['status'](0x1f4)[_0xe426('0x2c')](new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x87')));}if(_['isNil'](_0x48af6c['body'][_0xe426('0x4b')])||_0x48af6c[_0xe426('0x4b')][_0xe426('0x4b')]===''){throw _0x2bb0c1[_0xe426('0x22')](0x1f4)[_0xe426('0x2c')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe426('0x6f')](_0x48af6c[_0xe426('0x4b')][_0xe426('0xbd')])){throw _0x2bb0c1[_0xe426('0x22')](0x1f4)[_0xe426('0x2c')](new db['Sequelize']['ValidationError'](_0xe426('0xbe')+_0x2d00a6));}if(!_[_0xe426('0x8b')](_0x2d00a6,_0x48af6c[_0xe426('0x4b')]['mapKeyOffline'])){throw _0x2bb0c1['status'](0x1f4)['send'](new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0xbf')+_0x2d00a6));}_0x7e1f28[_0x48af6c[_0xe426('0x4b')][_0xe426('0xbd')]]=_0x48af6c[_0xe426('0x4b')][_0xe426('0x86')];})[_0xe426('0x17')](function(){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x48af6c[_0xe426('0x47')]['id']},'include':[{'model':db[_0xe426('0x8d')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xe426('0x17')](handleEntityNotFound(_0x2bb0c1,null))[_0xe426('0x17')](function(_0x17864b){if(_0x17864b&&_0x17864b[_0xe426('0x8e')]){_0xc28a0c=_0x17864b;var _0x1fe58a=_['defaults'](_0x48af6c[_0xe426('0x4b')],{'firstName':_0x48af6c['body'][_0xe426('0x86')],'phone':_0x48af6c[_0xe426('0x4b')]['from'],'ListId':_0x17864b[_0xe426('0x85')]});_0x1fe58a[_0x48af6c[_0xe426('0x4b')][_0xe426('0xbd')]]=_0x48af6c[_0xe426('0x4b')][_0xe426('0x86')];return db[_0xe426('0x7d')][_0xe426('0xc0')]({'where':_0x7e1f28,'defaults':_0x1fe58a});}})[_0xe426('0xad')](function(_0x2664fb){if(_0x2664fb){_0x24cf7f=_0x2664fb;var _0x413672=fs[_0xe426('0xc1')](path[_0xe426('0x6a')](config['root'],_0xe426('0xc2')),'utf8');var _0x44216d=ejs[_0xe426('0xc3')](_0x413672,{'body':_[_0xe426('0xc4')](_0x48af6c[_0xe426('0x4b')][_0xe426('0x4b')]),'bodyTitle':_0xc28a0c[_0xe426('0xc5')]});return db[_0xe426('0xc6')][_0xe426('0x4a')]({'body':_0x44216d,'plainBody':htmlToText[_0xe426('0xc7')](_0x44216d),'ContactId':_0x2664fb['id'],'ChatWebsiteId':_0xc28a0c['id']});}})[_0xe426('0x17')](function(_0x229824){_0x3602df=_0x229824;if(_0xc8340[_0xe426('0x48')]){var _0x2db419=_0xc8340[_0xe426('0x2f')](function(_0x1baac3){return{'name':_0x1baac3['originalname'],'basename':_0x1baac3[_0xe426('0x63')],'type':_0x1baac3['mimetype'],'ChatOfflineMessageId':_0x229824['id']};});_0x43b14a=_0x2db419[_0xe426('0x2f')](_0x2dbcb2=>{var _0x4b6ed6={'filename':_0x2dbcb2[_0xe426('0x2b')],'path':path[_0xe426('0x6a')](config[_0xe426('0x6b')],'server',_0xe426('0xc8'),_0xe426('0xc9'),_0xe426('0xca'),_0x2dbcb2[_0xe426('0xcb')])};return _0x4b6ed6;});if(!_0xc28a0c['openNewInteraction']){return db[_0xe426('0xcc')][_0xe426('0xcd')](function(_0xb8484a){return db[_0xe426('0xce')]['bulkCreate'](_0x2db419,{'transaction':_0xb8484a});});}}})[_0xe426('0x17')](function(){if(_0x3602df){_0x1f769e=_0x3602df;return db[_0xe426('0xcf')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe426('0xd0')],'as':_0xe426('0xd1'),'raw':!![],'include':[{'model':db[_0xe426('0xd2')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xe426('0x17')](function(_0x3e35f9){if(_0x3e35f9&&_0x3e35f9[_0xe426('0xd1')]&&_0xc28a0c[_0xe426('0xd3')]&&_0xc28a0c[_0xe426('0xd4')]){var _0x2de72a=_0x3e35f9[_0xe426('0xd5')]();return respondWithRpcPromise('SendMail',_0xe426('0xd6'),{'account':_0x2de72a,'message':{'from':util[_0xe426('0xa4')](_0xe426('0xd7'),_0x3e35f9['name'],_0x3e35f9[_0xe426('0xd8')]||_0x3e35f9[_0xe426('0xd1')][_0xe426('0x4f')]),'to':_0xc28a0c[_0xe426('0xd4')],'subject':_0xc28a0c['offlineMessageSubject'],'html':_0x1f769e[_0xe426('0x4b')],'attachments':_0x43b14a}},client9003)[_0xe426('0x17')](function(){return _0x1f769e;})[_0xe426('0x20')](function(_0x2dda46){logger[_0xe426('0x1c')](_0x2dda46);});}})[_0xe426('0x17')](function(){if(_0xc28a0c&&_0xc28a0c[_0xe426('0xd9')]&&_0xc28a0c['MailAccountId']){var _0xeddf87=[];if(_0xc8340['length']){_0xeddf87=_0xc8340[_0xe426('0x2f')](function(_0x2ca6b1){return{'name':_0x2ca6b1['originalname'],'basename':_0x2ca6b1[_0xe426('0x63')],'type':_0x2ca6b1[_0xe426('0xda')],'ChatOfflineMessageId':_0x3602df['id']};});}var _0x290f15;if(!_[_0xe426('0x6f')](_0xc28a0c['subjectOffline'])){var _0x36c49e=_['map'](_0x48af6c[_0xe426('0x4b')],function(_0x2b268d){return _0x2b268d;});var _0x1f3d74=_['toPairsIn'](_0x36c49e)[0x0];var _0x1a245e=_[_0xe426('0xdb')](_0x1f3d74,function(_0x27a73f){return _0x27a73f;});_0x290f15=_0x1a245e[0x1][_0xc28a0c[_0xe426('0xdc')]];}var _0x4256ef={'from':_0x24cf7f[_0xe426('0xd8')],'firstName':_0x24cf7f[_0xe426('0x9c')],'lastName':_0x24cf7f[_0xe426('0x9d')],'mapKey':'email','message':{'from':_0x24cf7f[_0xe426('0xd8')],'to':_0xc28a0c[_0xe426('0xcf')][_0xe426('0xd8')],'cc':'','subject':_['isNil'](_0x290f15)?_0xc28a0c['offlineMessageSubject']:_0x290f15,'messageId':'','sentAt':new Date(),'attach':_0xeddf87[_0xe426('0x48')],'attachments':_0xeddf87,'originChannel':_0xe426('0xdd'),'ChatWebsiteId':_0xc28a0c['id'],'ChatOfflineMessageId':_0x1f769e['id'],'originTo':_0xc28a0c['MailAccount']['email']},'body':_0x1f769e[_0xe426('0x4b')]};var _0x373bd0={'account':{'id':_0xc28a0c['MailAccountId']},'body':_0x4256ef,'log':_0xe426('0xde')};return respondWithRpcPromise('NotifyMailAccount',_0xe426('0xdf'),_0x373bd0,client9001)[_0xe426('0x17')](function(){return _0x1f769e;})[_0xe426('0x20')](function(_0x582450){logger[_0xe426('0x1c')](_0x582450);});}return;})['then'](function(){if(_0x1f769e){return _0x1f769e;}})[_0xe426('0x17')](respondWithResult(_0x2bb0c1,null))[_0xe426('0x20')](function(_0xe9c092){logger[_0xe426('0x1c')](_0xe426('0x20'),_0xe9c092);for(var _0x5edb84 of _0xc8340){var _0x36d29c=path[_0xe426('0x6a')](config['root'],_0xe426('0xe0'),_0xe426('0xc8'),_0xe426('0xc9'),_0xe426('0xca'),_0x5edb84[_0xe426('0x63')]);fs_extra[_0xe426('0xe1')](_0x36d29c)['catch'](function(_0x2c02e0){logger[_0xe426('0x1c')](_0xe426('0xe2'),_0x36d29c,_0x2c02e0);});}});};exports['addInteraction']=function(_0x3d9931,_0x1479e2){return db[_0xe426('0xaa')]['find']({'where':{'id':_0x3d9931[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1479e2,null))['then'](function(_0x47c191){if(_0x47c191){return _0x47c191[_0xe426('0xe3')](_0x3d9931[_0xe426('0x4b')]['ids'],_['omit'](_0x3d9931[_0xe426('0x4b')],[_0xe426('0x60'),'id'])||{});}})[_0xe426('0x17')](respondWithResult(_0x1479e2,null))[_0xe426('0x20')](handleError(_0x1479e2,null));};exports[_0xe426('0xe4')]=function(_0x4e204a,_0x140867){var _0x1ee551={'raw':![],'where':{}};var _0x3e3118={};var _0x11a219={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe426('0x57')]({'where':{'id':_0x4e204a[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x140867,null))[_0xe426('0x17')](function(_0x30bce2){if(_0x30bce2){_0x3e3118['model']=_[_0xe426('0x36')](db[_0xe426('0xaa')]['rawAttributes']);_0x3e3118[_0xe426('0x35')]=_[_0xe426('0x36')](_0x4e204a[_0xe426('0x35')]);_0x3e3118['filters']=_['intersection'](_0x3e3118[_0xe426('0x34')],_0x3e3118['query']);_0x1ee551[_0xe426('0x39')]=_['intersection'](_0x3e3118[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x4e204a[_0xe426('0x35')][_0xe426('0x3a')]));_0x1ee551[_0xe426('0x39')]=_0x1ee551[_0xe426('0x39')]['length']?_0x1ee551[_0xe426('0x39')]:_0x3e3118[_0xe426('0x34')];if(!_0x4e204a[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x1ee551['limit']=qs[_0xe426('0x3c')](_0x4e204a[_0xe426('0x35')][_0xe426('0x3c')]);_0x1ee551['offset']=qs[_0xe426('0x25')](_0x4e204a[_0xe426('0x35')]['offset']);}_0x1ee551[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x4e204a[_0xe426('0x35')][_0xe426('0x3e')]);_0x1ee551[_0xe426('0x40')]=qs[_0xe426('0x37')](_['pick'](_0x4e204a['query'],_0x3e3118[_0xe426('0x37')]));_0x1ee551[_0xe426('0x40')][_0xe426('0x55')]=_0x30bce2['id'];if(_0x4e204a[_0xe426('0x35')][_0xe426('0x43')]){_0x1ee551['where']=_[_0xe426('0x41')](_0x1ee551[_0xe426('0x40')],{'$or':_['map'](_0x1ee551[_0xe426('0x39')],function(_0x197e70){var _0xb04408={};_0xb04408[_0x197e70]={'$like':'%'+_0x4e204a[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0xb04408;})});}_0x1ee551=_[_0xe426('0x41')]({},_0x1ee551,_0x4e204a[_0xe426('0x58')]);return db[_0xe426('0xaa')]['count']({'where':_0x1ee551[_0xe426('0x40')]})['then'](function(_0x1e9202){_0x11a219['count']=_0x1e9202;if(_0x4e204a[_0xe426('0x35')][_0xe426('0x44')]){_0x1ee551['include']=[{'model':db[_0xe426('0x7d')],'as':_0xe426('0xe5'),'required':![]},{'model':db['User'],'as':_0xe426('0xe6'),'attributes':[_0xe426('0x2b'),_0xe426('0xe7'),_0xe426('0xe8')],'required':![]},{'model':db[_0xe426('0xe9')],'as':_0xe426('0xea'),'attributes':['id',_0xe426('0x2b'),_0xe426('0xeb')],'where':_0x4e204a[_0xe426('0x35')][_0xe426('0xec')]?{'id':_0x4e204a[_0xe426('0x35')]['tag']}:undefined,'required':_0x4e204a[_0xe426('0x35')][_0xe426('0xec')]?!![]:![]}];}return db[_0xe426('0xaa')]['findAll'](_0x1ee551);})['then'](function(_0x26fa7d){_0x11a219[_0xe426('0x45')]=_0x26fa7d;return _0x11a219;});}})[_0xe426('0x17')](respondWithFilteredResult(_0x140867,_0x1ee551))['catch'](handleError(_0x140867,null));};function iftimePromise(_0xe55103,_0x5639b9){return respondWithRpcPromise(_0xe426('0xed'),'getSnippet',{'command':_0x5639b9[_0xe426('0xee')]?util['format'](_0xe426('0xef'),_0xe55103[_0xe426('0xf0')],_0x5639b9['timezone']):util[_0xe426('0xa4')](_0xe426('0xf1'),_0xe55103[_0xe426('0xf0')])},client9002)[_0xe426('0x17')](function(_0x5f0496){var _0x53be1d=_0x5f0496&&_0x5f0496[_0xe426('0xf2')](_0xe426('0xf3'))>=0x0?!![]:![];logger[_0xe426('0x1e')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5639b9['id'],_0xe55103['id'],_0xe55103[_0xe426('0xf0')],_0x53be1d?_0xe426('0xf4'):_0xe426('0xf5'),_0x5639b9[_0xe426('0xee')]?_0x5639b9[_0xe426('0xee')]:_0xe426('0xf6'));return _0x53be1d;})[_0xe426('0x20')](function(_0x5378ab){logger[_0xe426('0x1c')](_0xe426('0xf7'),_0x5639b9['id'],_0xe55103['id'],_0xe55103['interval'],util[_0xe426('0xf8')](_0x5378ab,{'showHidden':![],'depth':null}),_0x5639b9[_0xe426('0xee')]?_0x5639b9['timezone']:_0xe426('0xf6'));return![];});}exports['getSnippet']=function(_0x1cd7fa,_0xb91145){var _0x26a003=0x0;var _0x4a2f59=0x0;var _0x342ac4=![];var _0x17ac63;var _0x5b6cff;return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x1cd7fa['params']['id']},'include':[{'model':db[_0xe426('0xf9')],'as':_0xe426('0xf9'),'include':[{'model':db[_0xe426('0xf9')],'as':_0xe426('0xfa'),'attributes':['id',_0xe426('0xf0')],'raw':!![]}]}]})[_0xe426('0x17')](handleEntityNotFound(_0xb91145,null))[_0xe426('0x17')](function(_0x4f4dcd){if(_0x4f4dcd){_0x17ac63=_0x4f4dcd;return _0x4f4dcd[_0xe426('0xfb')]({'raw':!![]});}})[_0xe426('0x17')](function(_0x4a7a88){if(_0x17ac63){if(_0x4a7a88){_0x5b6cff=_0x4a7a88;}}return require('../../config/license/util')[_0xe426('0x6d')]();})['then'](function(_0x7b96d0){if(_0x7b96d0){_0x4a2f59=_0x7b96d0[_0xe426('0xfc')];_0x342ac4=_0x7b96d0['custom'];}})['then'](function(){return db[_0xe426('0xaa')][_0xe426('0x27')]({'where':{'closed':![]}});})[_0xe426('0x17')](function(_0x44f0c1){_0x26a003=_0x44f0c1;if(_0x4a2f59&&_0x44f0c1>_0x4a2f59){return db[_0xe426('0xfd')][_0xe426('0x57')]({'where':{'id':0x1}})['then'](function(_0x3a9eec){if(_0x3a9eec){_0x3a9eec[_0xe426('0xfe')](_0xe426('0xff'));}});}})[_0xe426('0x17')](function(){if(_0x17ac63[_0xe426('0xf9')]&&_0x17ac63[_0xe426('0xf9')]['Intervals']){var _0x3cfaf4=[];for(var _0x37f73f=0x0;_0x37f73f<_0x17ac63[_0xe426('0xf9')][_0xe426('0xfa')]['length'];_0x37f73f++){var _0x1d8649=_0x17ac63['Interval'][_0xe426('0xfa')][_0x37f73f]['get']({'plain':!![]});_0x3cfaf4['push'](iftimePromise(_0x1d8649,_0x17ac63));}return BPromise[_0xe426('0x100')](_0x3cfaf4)['then'](function(_0x2228cf){return _[_0xe426('0x101')](_0x2228cf);});}else{return!![];}})[_0xe426('0x17')](function(_0x4c029d){var _0x192f79=fs[_0xe426('0xc1')](path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x102')),_0xe426('0x103'));var _0x26a96a=new url[(_0xe426('0x104'))](_0x17ac63['address'])['origin'];var _0xe7579e=_0xe426('0x105');var _0x4840f7=![];var _0x2a02f4={'chatVersion':_0xe7579e,'chatWebsiteAddressOrigin':_0x26a96a,'remote':_0x17ac63[_0xe426('0x106')],'query':querystring['stringify'](_['merge'](_0x17ac63[_0xe426('0x4c')]({'plain':!![]}),{'customerIp':_0x1cd7fa[_0xe426('0x79')][_0xe426('0x99')]||_0x1cd7fa['headers']['x-real-ip']||_0x1cd7fa[_0xe426('0x107')][_0xe426('0x108')]||_0x1cd7fa['ip'],'referer':_0x1cd7fa[_0xe426('0x79')]['referer'],'openedInteractions':_0x26a003,'maxInteractions':_0x4a2f59,'virtual':_0x342ac4[_0xe426('0xfc')],'online':_0x4c029d,'custom':_0x342ac4}))['replace'](/'/g,'\x5c\x27')};_0xb91145[_0xe426('0x2c')](ejs[_0xe426('0xc3')](Mustache['render'](_0x192f79,_0x2a02f4),{'proactiveActions':_0x5b6cff,'alignment':_0x17ac63[_0xe426('0x109')],'verticalAlignment':_0x17ac63[_0xe426('0x10a')],'div_color':_0x17ac63['color'],'labelText':_0x17ac63[_0xe426('0x10b')],'text_color':_0x17ac63['textColor'],'text_button_color':_0x17ac63[_0xe426('0x10c')],'button_color':_0x17ac63['color_button'],'background_color':_0x17ac63[_0xe426('0x10d')],'hideWhenOffline':_0x17ac63[_0xe426('0x10e')],'intervalId':_0x17ac63[_0xe426('0x10f')],'isDevelopment':_0x4840f7,'chatVersion':_0xe7579e}));})['catch'](handleError(_0xb91145,null));};exports[_0xe426('0x110')]=function(_0x5368d5,_0x38f847){var _0x29b950=_0x5368d5[_0xe426('0x47')]['id'];var _0x482b1e=_0x5368d5[_0xe426('0x4b')];var _0x3d8fa9=0xc8;var _0x2846b2=null;return db['sequelize'][_0xe426('0xcd')]({'isolationLevel':db[_0xe426('0xcc')][_0xe426('0x111')][_0xe426('0x112')]['READ_COMMITTED']},function(_0x47a7fe){return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x29b950},'transaction':_0x47a7fe})[_0xe426('0x17')](function(_0x97c875){if(_0x97c875){return db['ChatApplication'][_0xe426('0x113')]({'where':{'ChatWebsiteId':_0x29b950},'transaction':_0x47a7fe})['then'](function(){var _0x1b7e30=_[_0xe426('0x2f')](_0x482b1e,function(_0x587f6e){_0x587f6e[_0xe426('0x55')]=_0x29b950;return _0x587f6e;});return db[_0xe426('0x90')][_0xe426('0x114')](_0x1b7e30,{'transaction':_0x47a7fe});});}else{_0x3d8fa9=0x194;_0x2846b2=[];}});})[_0xe426('0x17')](function(){if(_0x3d8fa9!==0x194){return db[_0xe426('0x90')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x29b950},'order':_0xe426('0x94')})[_0xe426('0x17')](function(_0x2e9bc8){_0x2846b2=_0x2e9bc8;});}})[_0xe426('0x20')](function(_0x452bf2){_0x3d8fa9=0x1f4;logger[_0xe426('0x1c')](_0x452bf2[_0xe426('0x115')]);if(_0x452bf2['name']){delete _0x452bf2[_0xe426('0x2b')];}_0x2846b2=_0x452bf2;})[_0xe426('0x116')](function(){if(_0x2846b2===null){_0x38f847['sendStatus'](_0x3d8fa9);}else{if(_0x3d8fa9===0x1f4){_0x38f847[_0xe426('0x22')](_0x3d8fa9)[_0xe426('0x2c')](_0x2846b2);}else{_0x38f847[_0xe426('0x22')](_0x3d8fa9)['json'](_0x2846b2);}}});};exports[_0xe426('0x117')]=function(_0x2f0c58,_0x16d1af){var _0x3da150={};var _0x4b73da={};var _0x2be093;var _0x1ea724;return db['ChatWebsite'][_0xe426('0x57')]({'where':{'id':_0x2f0c58['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x16d1af,null))[_0xe426('0x17')](function(_0x26bc6b){if(_0x26bc6b){_0x2be093=_0x26bc6b;_0x4b73da['model']=_[_0xe426('0x36')](db['ChatApplication'][_0xe426('0x31')]);_0x4b73da['query']=_[_0xe426('0x36')](_0x2f0c58[_0xe426('0x35')]);_0x4b73da[_0xe426('0x37')]=_['intersection'](_0x4b73da[_0xe426('0x34')],_0x4b73da[_0xe426('0x35')]);_0x3da150[_0xe426('0x39')]=_[_0xe426('0x38')](_0x4b73da[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x2f0c58['query'][_0xe426('0x3a')]));_0x3da150['attributes']=_0x3da150['attributes']['length']?_0x3da150[_0xe426('0x39')]:_0x4b73da['model'];_0x3da150[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x2f0c58[_0xe426('0x35')]['sort']);_0x3da150[_0xe426('0x40')]=qs[_0xe426('0x37')](_[_0xe426('0x3f')](_0x2f0c58['query'],_0x4b73da['filters']));if(_0x2f0c58[_0xe426('0x35')]['filter']){_0x3da150[_0xe426('0x40')]=_[_0xe426('0x41')](_0x3da150[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x3da150[_0xe426('0x39')],function(_0x1ce007){var _0x288e1c={};_0x288e1c[_0x1ce007]={'$like':'%'+_0x2f0c58['query'][_0xe426('0x43')]+'%'};return _0x288e1c;})});}_0x3da150=_[_0xe426('0x41')]({},_0x3da150,_0x2f0c58[_0xe426('0x58')]);return _0x2be093[_0xe426('0x117')](_0x3da150);}})[_0xe426('0x17')](function(_0x49a551){if(_0x49a551){_0x1ea724=_0x49a551[_0xe426('0x48')];if(!_0x2f0c58[_0xe426('0x35')][_0xe426('0x5d')](_0xe426('0x3b'))){_0x3da150[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x2f0c58[_0xe426('0x35')]['limit']);_0x3da150[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x2f0c58[_0xe426('0x35')][_0xe426('0x25')]);}return _0x2be093['getApplications'](_0x3da150);}})[_0xe426('0x17')](function(_0x533325){if(_0x533325){return _0x533325?{'count':_0x1ea724,'rows':_0x533325}:null;}})[_0xe426('0x17')](respondWithResult(_0x16d1af,null))[_0xe426('0x20')](handleError(_0x16d1af,null));};exports[_0xe426('0x118')]=function(_0x47a0e0,_0x1c43c7){return db[_0xe426('0x119')][_0xe426('0x49')]({'where':{'id':_0x47a0e0[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1c43c7,null))[_0xe426('0x17')](function(_0x4aa808){if(_0x4aa808){return _0x4aa808[_0xe426('0x118')](_0x47a0e0[_0xe426('0x4b')][_0xe426('0x60')],_[_0xe426('0x11a')](_0x47a0e0[_0xe426('0x4b')],[_0xe426('0x60'),'id'])||{});}})[_0xe426('0x17')](respondWithResult(_0x1c43c7,null))[_0xe426('0x20')](handleError(_0x1c43c7,null));};exports[_0xe426('0xfb')]=function(_0x21da57,_0xb80bc7){var _0x224914={};var _0x129b7a={};var _0x3fd503;var _0x54dc09;return db[_0xe426('0x30')]['findOne']({'where':{'id':_0x21da57[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0xb80bc7,null))[_0xe426('0x17')](function(_0x597e56){if(_0x597e56){_0x3fd503=_0x597e56;_0x129b7a['model']=_[_0xe426('0x36')](db[_0xe426('0x11b')][_0xe426('0x31')]);_0x129b7a['query']=_['keys'](_0x21da57[_0xe426('0x35')]);_0x129b7a['filters']=_[_0xe426('0x38')](_0x129b7a[_0xe426('0x34')],_0x129b7a[_0xe426('0x35')]);_0x224914[_0xe426('0x39')]=_['intersection'](_0x129b7a['model'],qs['fields'](_0x21da57['query'][_0xe426('0x3a')]));_0x224914[_0xe426('0x39')]=_0x224914[_0xe426('0x39')][_0xe426('0x48')]?_0x224914[_0xe426('0x39')]:_0x129b7a[_0xe426('0x34')];_0x224914[_0xe426('0x3d')]=qs['sort'](_0x21da57['query'][_0xe426('0x3e')]);_0x224914[_0xe426('0x40')]=qs['filters'](_[_0xe426('0x3f')](_0x21da57[_0xe426('0x35')],_0x129b7a['filters']));if(_0x21da57[_0xe426('0x35')][_0xe426('0x43')]){_0x224914[_0xe426('0x40')]=_[_0xe426('0x41')](_0x224914[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x224914[_0xe426('0x39')],function(_0x519656){var _0x2de78f={};_0x2de78f[_0x519656]={'$like':'%'+_0x21da57[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x2de78f;})});}_0x224914=_[_0xe426('0x41')]({},_0x224914,_0x21da57[_0xe426('0x58')]);return _0x3fd503[_0xe426('0xfb')](_0x224914);}})[_0xe426('0x17')](function(_0x50cdcd){if(_0x50cdcd){_0x54dc09=_0x50cdcd[_0xe426('0x48')];if(!_0x21da57[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x224914[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x21da57['query'][_0xe426('0x3c')]);_0x224914[_0xe426('0x25')]=qs['offset'](_0x21da57[_0xe426('0x35')][_0xe426('0x25')]);}return _0x3fd503['getProactiveActions'](_0x224914);}})[_0xe426('0x17')](function(_0x4d86b5){if(_0x4d86b5){return _0x4d86b5?{'count':_0x54dc09,'rows':_0x4d86b5}:null;}})[_0xe426('0x17')](respondWithResult(_0xb80bc7,null))[_0xe426('0x20')](handleError(_0xb80bc7,null));};exports[_0xe426('0x11c')]=function(_0x1fd656,_0x1910a2){var _0x3894c4=_0x1fd656[_0xe426('0x35')]['online']===_0xe426('0x11d')?_0xe426('0x11e'):'onlineForm';return db[_0xe426('0x30')][_0xe426('0x49')]({'attributes':['id',_0x3894c4],'where':{'id':_0x1fd656['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1910a2,null))[_0xe426('0x17')](function(_0x429f63){if(_0x429f63){var _0x23527f=_0x429f63[_0x3894c4];var _0x1b7b7c=_0x23527f&&_0x23527f['items']?_0x23527f['items']:[];_0x1910a2[_0xe426('0x2c')]({'fromKey':_[_0xe426('0x6f')](_0x23527f[_0xe426('0x11f')])?undefined:_0x23527f[_0xe426('0x11f')],'count':_0x1b7b7c[_0xe426('0x48')],'rows':_0x1b7b7c});}})[_0xe426('0x20')](handleError(_0x1910a2,null));};exports[_0xe426('0x120')]=function(_0x35ccb3,_0x5dbce1){var _0x403c83={'raw':![],'where':{}};var _0x310da6={};var _0x34f7d1={'count':0x0,'rows':[]};return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x35ccb3[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x5dbce1,null))['then'](function(_0x18f545){if(_0x18f545){_0x310da6[_0xe426('0x34')]=_[_0xe426('0x36')](db['ChatOfflineMessage'][_0xe426('0x31')]);_0x310da6[_0xe426('0x35')]=_[_0xe426('0x36')](_0x35ccb3[_0xe426('0x35')]);_0x310da6[_0xe426('0x37')]=_[_0xe426('0x38')](_0x310da6[_0xe426('0x34')],_0x310da6['query']);_0x403c83[_0xe426('0x39')]=_['intersection'](_0x310da6[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x35ccb3[_0xe426('0x35')][_0xe426('0x3a')]));_0x403c83[_0xe426('0x39')]=_0x403c83['attributes'][_0xe426('0x48')]?_0x403c83[_0xe426('0x39')]:_0x310da6[_0xe426('0x34')];if(!_0x35ccb3[_0xe426('0x35')][_0xe426('0x5d')]('nolimit')){_0x403c83[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x35ccb3[_0xe426('0x35')][_0xe426('0x3c')]);_0x403c83['offset']=qs[_0xe426('0x25')](_0x35ccb3[_0xe426('0x35')][_0xe426('0x25')]);}_0x403c83[_0xe426('0x3d')]=qs['sort'](_0x35ccb3['query'][_0xe426('0x3e')]);_0x403c83['where']=qs['filters'](_[_0xe426('0x3f')](_0x35ccb3[_0xe426('0x35')],_0x310da6['filters']));_0x403c83[_0xe426('0x40')]['ChatWebsiteId']=_0x18f545['id'];if(_0x35ccb3[_0xe426('0x35')]['filter']){_0x403c83[_0xe426('0x40')]=_[_0xe426('0x41')](_0x403c83[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x403c83[_0xe426('0x39')],function(_0x1e4f64){var _0x2494b6={};_0x2494b6[_0x1e4f64]={'$like':'%'+_0x35ccb3[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x2494b6;})});}_0x403c83=_[_0xe426('0x41')]({},_0x403c83,_0x35ccb3[_0xe426('0x58')]);return db[_0xe426('0xc6')][_0xe426('0x27')]({'where':_0x403c83[_0xe426('0x40')]})[_0xe426('0x17')](function(_0x21e200){_0x34f7d1[_0xe426('0x27')]=_0x21e200;if(_0x35ccb3['query']['includeAll']){_0x403c83['include']=[{'all':!![]}];}else{_0x403c83[_0xe426('0x5e')]=[{'model':db[_0xe426('0x7d')],'as':_0xe426('0xe5'),'required':![]},{'model':db[_0xe426('0xce')],'as':'Attachments','required':![]}];}return db[_0xe426('0xc6')][_0xe426('0x59')](_0x403c83);})[_0xe426('0x17')](function(_0x7f3b72){_0x34f7d1[_0xe426('0x45')]=_0x7f3b72;return _0x34f7d1;});}})[_0xe426('0x17')](respondWithFilteredResult(_0x5dbce1,_0x403c83))['catch'](handleError(_0x5dbce1,null));};exports[_0xe426('0x121')]=function(_0x48a91d,_0x5ccaff){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x48a91d[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x5ccaff,null))['then'](function(_0x9634e3){if(_0x9634e3){return _0x9634e3[_0xe426('0x121')](_0x48a91d[_0xe426('0x4b')][_0xe426('0x60')],_[_0xe426('0x11a')](_0x48a91d['body'],[_0xe426('0x60'),'id'])||{})[_0xe426('0xad')](function(_0x1463e0){for(var _0x3d0418=0x0;_0x3d0418<_0x48a91d[_0xe426('0x4b')][_0xe426('0x60')]['length'];_0x3d0418+=0x1){socket[_0xe426('0x122')](_0xe426('0x123'),{'UserId':Number(_0x48a91d[_0xe426('0x4b')][_0xe426('0x60')][_0x3d0418]),'ChatWebsiteId':Number(_0x48a91d['params']['id'])});}return _0x1463e0;});}})['then'](respondWithResult(_0x5ccaff,null))[_0xe426('0x20')](handleError(_0x5ccaff,null));};exports[_0xe426('0x124')]=function(_0x9b3b0,_0x2dde1e){return db[_0xe426('0x30')]['find']({'where':{'id':_0x9b3b0[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2dde1e,null))['then'](function(_0x230053){if(_0x230053){return _0x230053[_0xe426('0x124')](_0x9b3b0['query'][_0xe426('0x60')])[_0xe426('0x17')](function(){if(_[_0xe426('0x125')](_0x9b3b0[_0xe426('0x35')][_0xe426('0x60')])){for(var _0x346944=0x0;_0x346944<_0x9b3b0['query'][_0xe426('0x60')][_0xe426('0x48')];_0x346944+=0x1){socket[_0xe426('0x122')](_0xe426('0x126'),{'UserId':Number(_0x9b3b0[_0xe426('0x35')][_0xe426('0x60')][_0x346944]),'ChatWebsiteId':Number(_0x9b3b0['params']['id'])});}}else{socket['emit'](_0xe426('0x126'),{'UserId':Number(_0x9b3b0[_0xe426('0x35')][_0xe426('0x60')]),'ChatWebsiteId':Number(_0x9b3b0[_0xe426('0x47')]['id'])});}});}})[_0xe426('0x17')](respondWithStatusCode(_0x2dde1e,null))[_0xe426('0x20')](handleError(_0x2dde1e,null));};exports[_0xe426('0x127')]=function(_0x1c13d8,_0x3045db){var _0x27cb61={};var _0x1550d0={};var _0x4a968a;var _0x4e06e2;return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x1c13d8['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x3045db,null))['then'](function(_0x251ba6){if(_0x251ba6){_0x4a968a=_0x251ba6;_0x1550d0[_0xe426('0x34')]=_[_0xe426('0x36')](db['User'][_0xe426('0x31')]);_0x1550d0[_0xe426('0x35')]=_[_0xe426('0x36')](_0x1c13d8[_0xe426('0x35')]);_0x1550d0[_0xe426('0x37')]=_[_0xe426('0x38')](_0x1550d0[_0xe426('0x34')],_0x1550d0[_0xe426('0x35')]);_0x27cb61['attributes']=_[_0xe426('0x38')](_0x1550d0[_0xe426('0x34')],qs['fields'](_0x1c13d8[_0xe426('0x35')][_0xe426('0x3a')]));_0x27cb61['attributes']=_0x27cb61[_0xe426('0x39')][_0xe426('0x48')]?_0x27cb61['attributes']:_0x1550d0[_0xe426('0x34')];_0x27cb61[_0xe426('0x3d')]=qs['sort'](_0x1c13d8[_0xe426('0x35')][_0xe426('0x3e')]);_0x27cb61[_0xe426('0x40')]=qs['filters'](_[_0xe426('0x3f')](_0x1c13d8[_0xe426('0x35')],_0x1550d0[_0xe426('0x37')]));if(_0x1c13d8[_0xe426('0x35')][_0xe426('0x43')]){_0x27cb61['where']=_[_0xe426('0x41')](_0x27cb61['where'],{'$or':_[_0xe426('0x2f')](_0x27cb61[_0xe426('0x39')],function(_0x1f7968){var _0x1202e6={};_0x1202e6[_0x1f7968]={'$like':'%'+_0x1c13d8[_0xe426('0x35')]['filter']+'%'};return _0x1202e6;})});}_0x27cb61=_[_0xe426('0x41')]({},_0x27cb61,_0x1c13d8[_0xe426('0x58')]);return _0x4a968a['getAgents'](_0x27cb61);}})['then'](function(_0x928504){if(_0x928504){_0x4e06e2=_0x928504['length'];if(!_0x1c13d8[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x27cb61[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x1c13d8[_0xe426('0x35')][_0xe426('0x3c')]);_0x27cb61[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x1c13d8[_0xe426('0x35')][_0xe426('0x25')]);}return _0x4a968a['getAgents'](_0x27cb61);}})[_0xe426('0x17')](function(_0x2c7361){if(_0x2c7361){return _0x2c7361?{'count':_0x4e06e2,'rows':_0x2c7361}:null;}})[_0xe426('0x17')](respondWithResult(_0x3045db,null))[_0xe426('0x20')](handleError(_0x3045db,null));}; \ No newline at end of file +var _0xe93c=['messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','Command','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','URL','address','origin','3.1.0','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','update','get','ChatWebsites','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','ChatWebsite','rows','show','params','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','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','isNil','existsSync','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','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','List','CmContact','Contacts','DESC','ChatApplication','account','applications','Applications','orderBy','priority','asc','from','contact','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0xe93c,0x82));var _0xce93=function(_0x50324c,_0xae42db){_0x50324c=_0x50324c-0x0;var _0x4b5ab0=_0xe93c[_0x50324c];return _0x4b5ab0;};'use strict';var BPromise=require(_0xce93('0x0'));var Mustache=require('mustache');var util=require(_0xce93('0x1'));var path=require(_0xce93('0x2'));var ejs=require(_0xce93('0x3'));var fs=require('fs');var fs_extra=require(_0xce93('0x4'));var _=require(_0xce93('0x5'));var querystring=require(_0xce93('0x6'));var Redis=require(_0xce93('0x7'));var qs=require(_0xce93('0x8'));var logger=require(_0xce93('0x9'))(_0xce93('0xa'));var config=require(_0xce93('0xb'));var url=require(_0xce93('0xc'));var db=require(_0xce93('0xd'))['db'];config[_0xce93('0xe')]=_[_0xce93('0xf')](config[_0xce93('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xce93('0x10'))(new Redis(config[_0xce93('0xe')]));require(_0xce93('0x11'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0xce93('0x12'));var client=jayson[_0xce93('0x13')][_0xce93('0x14')]({'port':0x232c});var client9002=jayson['client'][_0xce93('0x14')]({'port':0x232a});var client9003=jayson[_0xce93('0x13')]['http']({'port':0x232b});var client9001=jayson[_0xce93('0x13')][_0xce93('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x1c64b7,_0x5f0c9b,_0x3b630f,_0x4c9463){return new BPromise(function(_0x2eb943,_0x5e68cf){var _0x4fe53d=_0x4c9463||client;return _0x4fe53d['request'](_0x1c64b7,_0x3b630f)[_0xce93('0x15')](function(_0x3276ea){logger[_0xce93('0x16')](_0xce93('0x17'),_0x5f0c9b,_0xce93('0x18'));logger[_0xce93('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5f0c9b,'request\x20sent',JSON[_0xce93('0x1a')](_0x3276ea));if(_0x3276ea['error']){if(_0x3276ea[_0xce93('0x1b')][_0xce93('0x1c')]===0x1f4){logger[_0xce93('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x5f0c9b,_0x3276ea[_0xce93('0x1b')][_0xce93('0x1d')]);return _0x5e68cf(_0x3276ea[_0xce93('0x1b')]['message']);}logger[_0xce93('0x1b')](_0xce93('0x17'),_0x5f0c9b,_0x3276ea[_0xce93('0x1b')][_0xce93('0x1d')]);return _0x2eb943(_0x3276ea['error']['message']);}else{logger[_0xce93('0x16')](_0xce93('0x17'),_0x5f0c9b,_0xce93('0x18'));_0x2eb943(_0x3276ea[_0xce93('0x1e')]['message']);}})[_0xce93('0x1f')](function(_0x43a059){logger[_0xce93('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x5f0c9b,_0x43a059);_0x5e68cf(_0x43a059);});});}function respondWithStatusCode(_0x1e7854,_0x1e1e80){_0x1e1e80=_0x1e1e80||0xcc;return function(_0x3181c3){if(_0x3181c3){return _0x1e7854[_0xce93('0x20')](_0x1e1e80);}return _0x1e7854['status'](_0x1e1e80)[_0xce93('0x21')]();};}function respondWithResult(_0x1dab73,_0x191391){_0x191391=_0x191391||0xc8;return function(_0x5392bf){if(_0x5392bf){return _0x1dab73[_0xce93('0x22')](_0x191391)[_0xce93('0x23')](_0x5392bf);}};}function respondWithFilteredResult(_0x437ff0,_0x1fc00d){return function(_0x4697cb){if(_0x4697cb){var _0x51ecd4=typeof _0x1fc00d[_0xce93('0x24')]===_0xce93('0x25')&&typeof _0x1fc00d['limit']===_0xce93('0x25');var _0x66647a=_0x4697cb[_0xce93('0x26')];var _0x1538ff=_0x51ecd4?0x0:_0x1fc00d['offset'];var _0x2fd7e2=_0x51ecd4?_0x4697cb[_0xce93('0x26')]:_0x1fc00d[_0xce93('0x24')]+_0x1fc00d[_0xce93('0x27')];var _0x32c8e8;if(_0x2fd7e2>=_0x66647a){_0x2fd7e2=_0x66647a;_0x32c8e8=0xc8;}else{_0x32c8e8=0xce;}_0x437ff0[_0xce93('0x22')](_0x32c8e8);return _0x437ff0[_0xce93('0x28')]('Content-Range',_0x1538ff+'-'+_0x2fd7e2+'/'+_0x66647a)[_0xce93('0x23')](_0x4697cb);}return null;};}function saveUpdates(_0x305328){return function(_0x5631a8){if(_0x5631a8){return _0x5631a8[_0xce93('0x29')](_0x305328)[_0xce93('0x15')](function(_0x577d54){return _0x577d54;});}return null;};}function removeEntity(_0x4a411a){return function(_0x499e31){if(_0x499e31){return _0x499e31['destroy']()[_0xce93('0x15')](function(){var _0x571162=_0x499e31[_0xce93('0x2a')]({'plain':!![]});var _0x5d9605=_0xce93('0x2b');return db[_0xce93('0x2c')][_0xce93('0x2d')]({'where':{'type':_0x5d9605,'resourceId':_0x571162['id']}})[_0xce93('0x15')](function(){return _0x499e31;});})[_0xce93('0x15')](function(){_0x4a411a[_0xce93('0x22')](0xcc)[_0xce93('0x21')]();});}};}function handleEntityNotFound(_0x540983){return function(_0x44f5e6){if(!_0x44f5e6){_0x540983[_0xce93('0x20')](0x194);}return _0x44f5e6;};}function handleError(_0x5804ca,_0x5c8f9c){_0x5c8f9c=_0x5c8f9c||0x1f4;return function(_0x1cf8ae){logger[_0xce93('0x1b')](_0x1cf8ae['stack']);if(_0x1cf8ae['name']){delete _0x1cf8ae[_0xce93('0x2e')];}_0x5804ca['status'](_0x5c8f9c)[_0xce93('0x2f')](_0x1cf8ae);};}exports[_0xce93('0x30')]=function(_0x56e079,_0x4e9344){var _0x1f0d6a={'include':[{'model':db[_0xce93('0x31')],'as':_0xce93('0x32')}]},_0x3c2509={},_0x4bed94={'count':0x0,'rows':[]};var _0x4269c9=_[_0xce93('0x33')](db['ChatWebsite'][_0xce93('0x34')],function(_0x44df89){return{'name':_0x44df89[_0xce93('0x35')],'type':_0x44df89[_0xce93('0x36')][_0xce93('0x37')]};});_0x3c2509[_0xce93('0x38')]=_[_0xce93('0x33')](_0x4269c9,_0xce93('0x2e'));_0x3c2509[_0xce93('0x39')]=_[_0xce93('0x3a')](_0x56e079[_0xce93('0x39')]);_0x3c2509[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x3c2509[_0xce93('0x38')],_0x3c2509[_0xce93('0x39')]);_0x1f0d6a[_0xce93('0x3d')]=_[_0xce93('0x3c')](_0x3c2509[_0xce93('0x38')],qs[_0xce93('0x3e')](_0x56e079[_0xce93('0x39')][_0xce93('0x3e')]));_0x1f0d6a[_0xce93('0x3d')]=_0x1f0d6a[_0xce93('0x3d')][_0xce93('0x3f')]?_0x1f0d6a['attributes']:_0x3c2509[_0xce93('0x38')];if(!_0x56e079[_0xce93('0x39')][_0xce93('0x40')](_0xce93('0x41'))){_0x1f0d6a[_0xce93('0x27')]=qs['limit'](_0x56e079[_0xce93('0x39')][_0xce93('0x27')]);_0x1f0d6a[_0xce93('0x24')]=qs[_0xce93('0x24')](_0x56e079[_0xce93('0x39')][_0xce93('0x24')]);}_0x1f0d6a[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x56e079['query'][_0xce93('0x43')]);_0x1f0d6a[_0xce93('0x44')]=qs[_0xce93('0x3b')](_[_0xce93('0x45')](_0x56e079['query'],_0x3c2509[_0xce93('0x3b')]),_0x4269c9);if(_0x56e079['query'][_0xce93('0x46')]){_0x1f0d6a[_0xce93('0x44')]=_['merge'](_0x1f0d6a[_0xce93('0x44')],{'$or':_[_0xce93('0x33')](_0x4269c9,function(_0x3b9d31){if(_0x3b9d31['type']!==_0xce93('0x47')){var _0x4a21a1={};_0x4a21a1[_0x3b9d31[_0xce93('0x2e')]]={'$like':'%'+_0x56e079[_0xce93('0x39')][_0xce93('0x46')]+'%'};return _0x4a21a1;}})});}_0x1f0d6a=_[_0xce93('0x48')]({},_0x1f0d6a,_0x56e079[_0xce93('0x49')]);var _0x355d96={'where':_0x1f0d6a[_0xce93('0x44')]};return db['ChatWebsite'][_0xce93('0x26')](_0x355d96)[_0xce93('0x15')](function(_0x164994){_0x4bed94[_0xce93('0x26')]=_0x164994;if(_0x56e079['query'][_0xce93('0x4a')]){_0x1f0d6a[_0xce93('0x4b')]=[{'all':!![]}];}return db[_0xce93('0x4c')]['findAll'](_0x1f0d6a);})['then'](function(_0x5e96eb){_0x4bed94[_0xce93('0x4d')]=_0x5e96eb;return _0x4bed94;})[_0xce93('0x15')](respondWithFilteredResult(_0x4e9344,_0x1f0d6a))['catch'](handleError(_0x4e9344,null));};exports[_0xce93('0x4e')]=function(_0x4c6c,_0x1a9b87){var _0x446eb9={'raw':![],'where':{'id':_0x4c6c[_0xce93('0x4f')]['id']},'include':[{'model':db[_0xce93('0x31')],'as':_0xce93('0x32')}]},_0x49c57c={};_0x49c57c[_0xce93('0x38')]=_['keys'](db[_0xce93('0x4c')]['rawAttributes']);_0x49c57c[_0xce93('0x39')]=_[_0xce93('0x3a')](_0x4c6c['query']);_0x49c57c[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x49c57c[_0xce93('0x38')],_0x49c57c[_0xce93('0x39')]);_0x446eb9[_0xce93('0x3d')]=_['intersection'](_0x49c57c[_0xce93('0x38')],qs[_0xce93('0x3e')](_0x4c6c['query'][_0xce93('0x3e')]));_0x446eb9[_0xce93('0x3d')]=_0x446eb9[_0xce93('0x3d')][_0xce93('0x3f')]?_0x446eb9[_0xce93('0x3d')]:_0x49c57c['model'];if(_0x4c6c[_0xce93('0x39')]['includeAll']){_0x446eb9['include']=[{'all':!![]}];}_0x446eb9=_[_0xce93('0x48')]({},_0x446eb9,_0x4c6c[_0xce93('0x49')]);return db[_0xce93('0x4c')][_0xce93('0x50')](_0x446eb9)['then'](handleEntityNotFound(_0x1a9b87,null))[_0xce93('0x15')](respondWithResult(_0x1a9b87,null))[_0xce93('0x1f')](handleError(_0x1a9b87,null));};exports[_0xce93('0x51')]=function(_0x3bfcc6,_0x1a2133){return db[_0xce93('0x4c')][_0xce93('0x51')](_0x3bfcc6[_0xce93('0x52')],{})['then'](function(_0xaa9301){var _0x34a84d=_0x3bfcc6[_0xce93('0x53')][_0xce93('0x2a')]({'plain':!![]});if(!_0x34a84d)throw new Error(_0xce93('0x54'));if(_0x34a84d[_0xce93('0x55')]===_0xce93('0x53')){var _0x29b080=_0xaa9301['get']({'plain':!![]});var _0xb598f='ChatWebsites';return db[_0xce93('0x56')]['find']({'where':{'name':_0xb598f,'userProfileId':_0x34a84d[_0xce93('0x57')]},'raw':!![]})['then'](function(_0x156ec7){if(_0x156ec7&&_0x156ec7[_0xce93('0x58')]===0x0){return db[_0xce93('0x2c')][_0xce93('0x51')]({'name':_0x29b080[_0xce93('0x2e')],'resourceId':_0x29b080['id'],'type':_0x156ec7[_0xce93('0x2e')],'sectionId':_0x156ec7['id']},{})[_0xce93('0x15')](function(){return _0xaa9301;});}else{return _0xaa9301;}})['catch'](function(_0x41aa5e){logger[_0xce93('0x1b')](_0xce93('0x59'),_0x41aa5e);throw _0x41aa5e;});}return _0xaa9301;})[_0xce93('0x15')](respondWithResult(_0x1a2133,0xc9))[_0xce93('0x1f')](handleError(_0x1a2133,null));};exports[_0xce93('0x29')]=function(_0x2f17d7,_0x46bc25){if(_0x2f17d7[_0xce93('0x52')]['id']){delete _0x2f17d7[_0xce93('0x52')]['id'];}return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x2f17d7[_0xce93('0x4f')]['id']},'include':[{'model':db[_0xce93('0x31')],'as':'mandatoryDispositionPause'}]})[_0xce93('0x15')](handleEntityNotFound(_0x46bc25,null))[_0xce93('0x15')](saveUpdates(_0x2f17d7['body'],null))['then'](respondWithResult(_0x46bc25,null))[_0xce93('0x1f')](handleError(_0x46bc25,null));};exports[_0xce93('0x2d')]=function(_0x771657,_0x319a68){return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x771657[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x319a68,null))['then'](removeEntity(_0x319a68,null))[_0xce93('0x1f')](handleError(_0x319a68,null));};exports[_0xce93('0x5a')]=function(_0x11dba3,_0x3c4651){return db['ChatWebsite'][_0xce93('0x5a')]()[_0xce93('0x15')](respondWithResult(_0x3c4651,null))[_0xce93('0x1f')](handleError(_0x3c4651,null));};exports[_0xce93('0x5b')]=function(_0x366438,_0x196c27){if(_0x366438[_0xce93('0x52')]['id']){delete _0x366438[_0xce93('0x52')]['id'];}return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x366438[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x196c27,null))[_0xce93('0x15')](function(_0x510a43){if(_0x510a43){_0x366438['body'][_0xce93('0x5c')]=_0x510a43['id'];return db['Disposition'][_0xce93('0x51')](_0x366438['body']);}})['then'](respondWithResult(_0x196c27,null))['catch'](handleError(_0x196c27,null));};exports[_0xce93('0x5d')]=function(_0x5f1c2c,_0x1a364f){var _0x16d71f={'raw':![],'where':{}};var _0x204c38={};var _0x11e743={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xce93('0x5e')]({'where':{'id':_0x5f1c2c[_0xce93('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a364f,null))['then'](function(_0x15c0e3){if(_0x15c0e3){_0x204c38['model']=_[_0xce93('0x3a')](db[_0xce93('0x5f')]['rawAttributes']);_0x204c38['query']=_[_0xce93('0x3a')](_0x5f1c2c[_0xce93('0x39')]);_0x204c38[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x204c38[_0xce93('0x38')],_0x204c38[_0xce93('0x39')]);_0x16d71f[_0xce93('0x3d')]=_[_0xce93('0x3c')](_0x204c38[_0xce93('0x38')],qs['fields'](_0x5f1c2c['query']['fields']));_0x16d71f['attributes']=_0x16d71f[_0xce93('0x3d')][_0xce93('0x3f')]?_0x16d71f[_0xce93('0x3d')]:_0x204c38['model'];if(!_0x5f1c2c['query']['hasOwnProperty'](_0xce93('0x41'))){_0x16d71f[_0xce93('0x27')]=qs[_0xce93('0x27')](_0x5f1c2c[_0xce93('0x39')][_0xce93('0x27')]);_0x16d71f[_0xce93('0x24')]=qs[_0xce93('0x24')](_0x5f1c2c[_0xce93('0x39')][_0xce93('0x24')]);}_0x16d71f[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x5f1c2c[_0xce93('0x39')]['sort']);_0x16d71f[_0xce93('0x44')]=qs[_0xce93('0x3b')](_[_0xce93('0x45')](_0x5f1c2c[_0xce93('0x39')],_0x204c38[_0xce93('0x3b')]));_0x16d71f[_0xce93('0x44')][_0xce93('0x5c')]=_0x15c0e3['id'];if(_0x5f1c2c[_0xce93('0x39')][_0xce93('0x46')]){_0x16d71f[_0xce93('0x44')]=_[_0xce93('0x48')](_0x16d71f[_0xce93('0x44')],{'$or':_['map'](_0x16d71f[_0xce93('0x3d')],function(_0x33f27c){var _0x4936a7={};_0x4936a7[_0x33f27c]={'$like':'%'+_0x5f1c2c[_0xce93('0x39')]['filter']+'%'};return _0x4936a7;})});}_0x16d71f=_[_0xce93('0x48')]({},_0x16d71f,_0x5f1c2c[_0xce93('0x49')]);return db[_0xce93('0x5f')][_0xce93('0x26')]({'where':_0x16d71f[_0xce93('0x44')]})[_0xce93('0x15')](function(_0x331126){_0x11e743[_0xce93('0x26')]=_0x331126;if(_0x5f1c2c[_0xce93('0x39')]['includeAll']){_0x16d71f[_0xce93('0x4b')]=[{'all':!![]}];}return db[_0xce93('0x5f')][_0xce93('0x60')](_0x16d71f);})[_0xce93('0x15')](function(_0xd9c3a0){_0x11e743[_0xce93('0x4d')]=_0xd9c3a0;return _0x11e743;});}})['then'](respondWithFilteredResult(_0x1a364f,_0x16d71f))['catch'](handleError(_0x1a364f,null));};exports['removeDispositions']=function(_0x4556cc,_0x37f15a){return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x4556cc[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x37f15a,null))[_0xce93('0x15')](function(_0x2d3a26){if(_0x2d3a26){return _0x2d3a26[_0xce93('0x61')](_0x4556cc['query'][_0xce93('0x62')]);}})[_0xce93('0x15')](respondWithStatusCode(_0x37f15a,null))[_0xce93('0x1f')](handleError(_0x37f15a,null));};exports[_0xce93('0x63')]=function(_0x1835b0,_0xb4b0fe){if(_0x1835b0[_0xce93('0x52')]['id']){delete _0x1835b0[_0xce93('0x52')]['id'];}return db['ChatWebsite'][_0xce93('0x50')]({'where':{'id':_0x1835b0[_0xce93('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb4b0fe,null))[_0xce93('0x15')](function(_0x1d8c3d){if(_0x1d8c3d){_0x1835b0['body']['ChatWebsiteId']=_0x1d8c3d['id'];return db[_0xce93('0x64')][_0xce93('0x51')](_0x1835b0[_0xce93('0x52')]);}})[_0xce93('0x15')](respondWithResult(_0xb4b0fe,null))['catch'](handleError(_0xb4b0fe,null));};exports[_0xce93('0x65')]=function(_0x51eabb,_0x3df115){var _0x4918e2={'raw':![],'where':{}};var _0x350cbc={};var _0x1eb806={'count':0x0,'rows':[]};return db[_0xce93('0x4c')]['findOne']({'where':{'id':_0x51eabb[_0xce93('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3df115,null))[_0xce93('0x15')](function(_0x1d6530){if(_0x1d6530){_0x350cbc[_0xce93('0x38')]=_[_0xce93('0x3a')](db[_0xce93('0x64')]['rawAttributes']);_0x350cbc['query']=_['keys'](_0x51eabb['query']);_0x350cbc[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x350cbc[_0xce93('0x38')],_0x350cbc[_0xce93('0x39')]);_0x4918e2[_0xce93('0x3d')]=_['intersection'](_0x350cbc['model'],qs[_0xce93('0x3e')](_0x51eabb[_0xce93('0x39')][_0xce93('0x3e')]));_0x4918e2[_0xce93('0x3d')]=_0x4918e2[_0xce93('0x3d')][_0xce93('0x3f')]?_0x4918e2[_0xce93('0x3d')]:_0x350cbc[_0xce93('0x38')];if(!_0x51eabb['query'][_0xce93('0x40')](_0xce93('0x41'))){_0x4918e2['limit']=qs[_0xce93('0x27')](_0x51eabb[_0xce93('0x39')][_0xce93('0x27')]);_0x4918e2[_0xce93('0x24')]=qs[_0xce93('0x24')](_0x51eabb[_0xce93('0x39')][_0xce93('0x24')]);}_0x4918e2[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x51eabb[_0xce93('0x39')][_0xce93('0x43')]);_0x4918e2['where']=qs['filters'](_[_0xce93('0x45')](_0x51eabb[_0xce93('0x39')],_0x350cbc[_0xce93('0x3b')]));_0x4918e2['where']['ChatWebsiteId']=_0x1d6530['id'];if(_0x51eabb[_0xce93('0x39')]['filter']){_0x4918e2[_0xce93('0x44')]=_[_0xce93('0x48')](_0x4918e2['where'],{'$or':_[_0xce93('0x33')](_0x4918e2[_0xce93('0x3d')],function(_0x4e9f0b){var _0x150cb5={};_0x150cb5[_0x4e9f0b]={'$like':'%'+_0x51eabb[_0xce93('0x39')][_0xce93('0x46')]+'%'};return _0x150cb5;})});}_0x4918e2=_[_0xce93('0x48')]({},_0x4918e2,_0x51eabb['options']);return db[_0xce93('0x64')][_0xce93('0x26')]({'where':_0x4918e2['where']})[_0xce93('0x15')](function(_0x81fc4d){_0x1eb806[_0xce93('0x26')]=_0x81fc4d;if(_0x51eabb[_0xce93('0x39')]['includeAll']){_0x4918e2[_0xce93('0x4b')]=[{'all':!![]}];}return db[_0xce93('0x64')][_0xce93('0x60')](_0x4918e2);})['then'](function(_0x41d20c){_0x1eb806[_0xce93('0x4d')]=_0x41d20c;return _0x1eb806;});}})[_0xce93('0x15')](respondWithFilteredResult(_0x3df115,_0x4918e2))[_0xce93('0x1f')](handleError(_0x3df115,null));};exports['removeAnswers']=function(_0x184198,_0x350c5f){return db[_0xce93('0x4c')]['find']({'where':{'id':_0x184198[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x350c5f,null))[_0xce93('0x15')](function(_0x45c6e1){if(_0x45c6e1){return _0x45c6e1['removeAnswers'](_0x184198[_0xce93('0x39')][_0xce93('0x62')]);}})[_0xce93('0x15')](respondWithStatusCode(_0x350c5f,null))[_0xce93('0x1f')](handleError(_0x350c5f,null));};exports[_0xce93('0x66')]=function(_0x197023,_0x19a658){_0x197023[_0xce93('0x52')][_0xce93('0x67')]=_0x197023[_0xce93('0x68')][_0xce93('0x69')];return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x197023[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x19a658,null))[_0xce93('0x15')](saveUpdates(_0x197023['body'],null))[_0xce93('0x15')](respondWithResult(_0x19a658,null))[_0xce93('0x1f')](handleError(_0x19a658,null));};exports[_0xce93('0x6a')]=function(_0x152f08,_0xba8527){_0x152f08[_0xce93('0x52')][_0xce93('0x6b')]=_0x152f08[_0xce93('0x68')][_0xce93('0x69')];return db[_0xce93('0x4c')]['find']({'where':{'id':_0x152f08[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0xba8527,null))[_0xce93('0x15')](saveUpdates(_0x152f08['body'],null))[_0xce93('0x15')](respondWithResult(_0xba8527,null))[_0xce93('0x1f')](handleError(_0xba8527,null));};exports[_0xce93('0x6c')]=function(_0x4db3e8,_0x20d964){_0x4db3e8[_0xce93('0x52')][_0xce93('0x6d')]=_0x4db3e8[_0xce93('0x68')][_0xce93('0x69')];return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x4db3e8['params']['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x20d964,null))[_0xce93('0x15')](saveUpdates(_0x4db3e8[_0xce93('0x52')],null))[_0xce93('0x15')](respondWithResult(_0x20d964,null))[_0xce93('0x1f')](handleError(_0x20d964,null));};exports[_0xce93('0x6e')]=function(_0x409b3c,_0x3a1575){_0x409b3c[_0xce93('0x52')][_0xce93('0x6f')]=_0x409b3c[_0xce93('0x68')][_0xce93('0x69')];return db['ChatWebsite'][_0xce93('0x50')]({'where':{'id':_0x409b3c[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x3a1575,null))[_0xce93('0x15')](saveUpdates(_0x409b3c[_0xce93('0x52')],null))[_0xce93('0x15')](respondWithResult(_0x3a1575,null))[_0xce93('0x1f')](handleError(_0x3a1575,null));};exports[_0xce93('0x70')]=function(_0x20de07,_0x125045){var _0x56f90c=path[_0xce93('0x71')](config[_0xce93('0x72')],_0xce93('0x73'));var _0x232ad5={'where':{'id':_0x20de07[_0xce93('0x4f')]['id']},'attributes':['id',_0xce93('0x67')],'raw':!![]};var _0x1db582=![];return require(_0xce93('0x74'))[_0xce93('0x75')]()[_0xce93('0x15')](function(_0xbba83a){if(_0xbba83a){_0x1db582=_0xbba83a[_0xce93('0x76')];}})['then'](function(){return db[_0xce93('0x4c')][_0xce93('0x50')](_0x232ad5);})[_0xce93('0x15')](handleEntityNotFound(_0x125045,null))[_0xce93('0x15')](function(_0x2d5832){if(_0x2d5832){if(!_['isNil'](_0x2d5832[_0xce93('0x67')])){if(fs['existsSync'](path['join'](config[_0xce93('0x72')],_0xce93('0x77'),_0x2d5832['sitepic']))&&_0x1db582){_0x56f90c=path['join'](config[_0xce93('0x72')],_0xce93('0x77'),_0x2d5832[_0xce93('0x67')]);}}return _0x125045[_0xce93('0x78')](_0x56f90c);}})[_0xce93('0x1f')](handleError(_0x125045,null));};exports[_0xce93('0x79')]=function(_0x112fb0,_0x3b7bf3){var _0x8ecd95=path['join'](config[_0xce93('0x72')],'server/files/images/avatars/default_avatar.png');var _0x3ee0d4={'where':{'id':_0x112fb0['params']['id']},'attributes':['id',_0xce93('0x6b')],'raw':!![]};return db[_0xce93('0x4c')][_0xce93('0x50')](_0x3ee0d4)['then'](handleEntityNotFound(_0x3b7bf3,null))[_0xce93('0x15')](function(_0x7b4ae3){if(_0x7b4ae3){if(!_['isNil'](_0x7b4ae3[_0xce93('0x6b')])){if(fs['existsSync'](path[_0xce93('0x71')](config[_0xce93('0x72')],_0xce93('0x7a'),_0x7b4ae3[_0xce93('0x6b')]))){_0x8ecd95=path[_0xce93('0x71')](config['root'],'server/files/images/avatars/',_0x7b4ae3[_0xce93('0x6b')]);}}return _0x3b7bf3[_0xce93('0x78')](_0x8ecd95);}})[_0xce93('0x1f')](handleError(_0x3b7bf3,null));};exports[_0xce93('0x7b')]=function(_0x488d0e,_0x338cf7){var _0x254dd1=path[_0xce93('0x71')](config[_0xce93('0x72')],'server/files/images/avatars/customer_avatar.png');var _0x3ec24a={'where':{'id':_0x488d0e[_0xce93('0x4f')]['id']},'attributes':['id','customerAvatar',_0xce93('0x7c')],'raw':!![]};return db[_0xce93('0x4c')][_0xce93('0x50')](_0x3ec24a)[_0xce93('0x15')](handleEntityNotFound(_0x338cf7,null))[_0xce93('0x15')](function(_0x3dbe5b){if(_0x3dbe5b){if(!_[_0xce93('0x7d')](_0x3dbe5b[_0xce93('0x6d')])){if(fs[_0xce93('0x7e')](path[_0xce93('0x71')](config[_0xce93('0x72')],_0xce93('0x7a'),_0x3dbe5b[_0xce93('0x6d')]))&&_0x3dbe5b[_0xce93('0x7c')]){_0x254dd1=path['join'](config[_0xce93('0x72')],_0xce93('0x7a'),_0x3dbe5b['customerAvatar']);}}return _0x338cf7[_0xce93('0x78')](_0x254dd1);}})[_0xce93('0x1f')](handleError(_0x338cf7,null));};exports['getSystemAvatar']=function(_0x307e10,_0x5551){var _0x1b45c6=path['join'](config[_0xce93('0x72')],_0xce93('0x7f'));var _0x153583={'where':{'id':_0x307e10['params']['id']},'attributes':['id',_0xce93('0x6f')],'raw':!![]};return db['ChatWebsite'][_0xce93('0x50')](_0x153583)[_0xce93('0x15')](handleEntityNotFound(_0x5551,null))[_0xce93('0x15')](function(_0x43b04d){if(_0x43b04d){if(!_[_0xce93('0x7d')](_0x43b04d['systemAvatar'])){if(fs[_0xce93('0x7e')](path[_0xce93('0x71')](config[_0xce93('0x72')],_0xce93('0x7a'),_0x43b04d[_0xce93('0x6f')]))){_0x1b45c6=path[_0xce93('0x71')](config[_0xce93('0x72')],_0xce93('0x7a'),_0x43b04d[_0xce93('0x6f')]);}}return _0x5551[_0xce93('0x78')](_0x1b45c6);}})[_0xce93('0x1f')](handleError(_0x5551,null));};exports['notify']=function(_0x46442b,_0x255841){var _0x15996b=require(_0xce93('0x80'));var _0x565b29=new _0x15996b();var _0x52e5fb=_0x565b29[_0xce93('0x81')](_0x46442b[_0xce93('0x82')][_0xce93('0x83')])[_0xce93('0x84')]();var _0x476de3={'body':_0x46442b['body'],'channel':_0xce93('0x85')};var _0x4a6976=[];var _0x3c4422=[];var _0x2710dc={};var _0x14f6cb=![];return db['CmContact'][_0xce93('0x5a')]()['then'](function(_0x2e884a){if(!_0x2e884a){throw new db[(_0xce93('0x86'))][(_0xce93('0x87'))](_0xce93('0x88'));}_0x4a6976=_[_0xce93('0x89')](_[_0xce93('0x3a')](_0x2e884a),[_0xce93('0x8a'),_0xce93('0x8b')]);_0x3c4422=_[_0xce93('0x89')](_[_0xce93('0x3a')](_0x2e884a),[_0xce93('0x8a'),'updatedAt',_0xce93('0x8c'),_0xce93('0x8d')]);if(_0x46442b[_0xce93('0x52')]['id']){delete _0x46442b[_0xce93('0x52')]['id'];}if(_['isNil'](_0x46442b[_0xce93('0x52')]['from'])){throw new db[(_0xce93('0x86'))][(_0xce93('0x87'))]('from\x20is\x20mandatory');}if(_[_0xce93('0x7d')](_0x46442b[_0xce93('0x52')][_0xce93('0x52')])||_0x46442b[_0xce93('0x52')][_0xce93('0x52')]===''){throw new db[(_0xce93('0x86'))][(_0xce93('0x87'))](_0xce93('0x8e'));}if(_[_0xce93('0x7d')](_0x46442b[_0xce93('0x52')][_0xce93('0x8f')])){throw new db[(_0xce93('0x86'))][(_0xce93('0x87'))](_0xce93('0x90')+_0x3c4422);}if(!_['includes'](_0x3c4422,_0x46442b[_0xce93('0x52')][_0xce93('0x8f')])){throw new db[(_0xce93('0x86'))][(_0xce93('0x87'))](_0xce93('0x91')+_0x3c4422);}_0x2710dc[_0x46442b[_0xce93('0x52')][_0xce93('0x8f')]]=_0x46442b['body']['from'];})[_0xce93('0x15')](function(){return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x46442b[_0xce93('0x4f')]['id']},'include':[{'model':db[_0xce93('0x92')],'as':_0xce93('0x93'),'include':[{'model':db[_0xce93('0x94')],'as':_0xce93('0x95'),'where':_0x2710dc,'limit':0x1,'order':[[_0xce93('0x8b'),_0xce93('0x96')]]}]},{'model':db[_0xce93('0x97')],'as':'Applications'}]});})[_0xce93('0x15')](handleEntityNotFound(_0x255841,null))[_0xce93('0x15')](function(_0x504c5b){if(_0x504c5b&&_0x504c5b[_0xce93('0x93')]){_0x476de3[_0xce93('0x98')]=_0x504c5b;_0x476de3[_0xce93('0x99')]=_0x504c5b[_0xce93('0x9a')];_0x476de3['list']=_0x504c5b['List'];_0x476de3['applications']=_[_0xce93('0x9b')](_0x476de3[_0xce93('0x99')],[_0xce93('0x9c')],[_0xce93('0x9d')]);if(_0x476de3[_0xce93('0x98')][_0xce93('0x9a')]){delete _0x476de3[_0xce93('0x98')][_0xce93('0x9a')];}if(_0x476de3[_0xce93('0x98')]['List']&&_0x476de3[_0xce93('0x98')]['List'][_0xce93('0x95')][_0xce93('0x3f')]){return _0x476de3[_0xce93('0x98')][_0xce93('0x93')][_0xce93('0x95')][0x0];}var _0xf8fad7=_[_0xce93('0xf')](_0x46442b[_0xce93('0x52')],{'firstName':_0x46442b[_0xce93('0x52')][_0xce93('0x9e')],'ListId':_0x504c5b['ListId']});_0xf8fad7[_0x46442b[_0xce93('0x52')]['mapKey']]=_0x46442b[_0xce93('0x52')]['from'];return db[_0xce93('0x94')][_0xce93('0x51')](_0xf8fad7,{'fields':_0x4a6976,'raw':!![]});}})['then'](handleEntityNotFound(_0x255841,null))[_0xce93('0x15')](function(_0x556764){_0x476de3[_0xce93('0x9f')]=_0x556764;var _0x2e09bd=_0x46442b[_0xce93('0x52')]['customerIp'];if(_0x46442b['headers']['cf-connecting-ip']){_0x2e09bd=_0x46442b['headers'][_0xce93('0xa0')];}else if(_0x46442b[_0xce93('0x82')][_0xce93('0xa1')]){_0x2e09bd=_[_0xce93('0xa2')](_0x46442b['headers'][_0xce93('0xa1')]['split'](','));}if(_0x556764){var _0x32e2d3={'ContactId':_0x556764['id'],'ChatWebsiteId':_0x46442b[_0xce93('0x4f')]['id'],'from':(_0x556764[_0xce93('0xa3')]||'')+'\x20'+(_0x556764[_0xce93('0xa4')]||''),'customerIp':_0x2e09bd,'customerPort':_0x46442b[_0xce93('0x82')][_0xce93('0xa5')]?_0x46442b[_0xce93('0x82')][_0xce93('0xa5')]:null,'referer':_0x46442b[_0xce93('0x52')][_0xce93('0xa6')],'browserName':_0x52e5fb[_0xce93('0xa7')][_0xce93('0x2e')]&&_0x52e5fb[_0xce93('0xa7')][_0xce93('0xa8')]?util[_0xce93('0xa9')]('%s\x20%s',_0x52e5fb[_0xce93('0xa7')][_0xce93('0x2e')],_0x52e5fb[_0xce93('0xa7')][_0xce93('0xa8')]):'unknown','browserVersion':_0x52e5fb['browser'][_0xce93('0xa8')]||_0xce93('0xaa'),'osName':util[_0xce93('0xa9')](_0xce93('0xab'),_0x52e5fb['os'][_0xce93('0x2e')],_0x52e5fb['os']['version']),'osVersion':_0x52e5fb['os'][_0xce93('0xa8')],'deviceModel':_0x52e5fb[_0xce93('0xac')][_0xce93('0x38')]&&_0x52e5fb[_0xce93('0xac')]['vendor']?util['format'](_0xce93('0xad'),_0x52e5fb[_0xce93('0xac')]['model'],_0x52e5fb[_0xce93('0xac')]['vendor'],_0x52e5fb['device']['type']):null,'deviceVendor':_0x52e5fb[_0xce93('0xac')][_0xce93('0xae')],'deviceType':_0x52e5fb[_0xce93('0xac')][_0xce93('0x36')],'formData':JSON[_0xce93('0x1a')](_0x46442b[_0xce93('0x52')])};var _0x16da90={'ChatWebsiteId':_0x46442b[_0xce93('0x4f')]['id'],'closed':![]};if(_0x46442b[_0xce93('0x52')][_0xce93('0xaf')]){_0x16da90[_0xce93('0xaf')]=_0x46442b[_0xce93('0x52')][_0xce93('0xaf')];return db['ChatInteraction'][_0xce93('0x50')]({'where':_0x16da90})[_0xce93('0x15')](function(_0x388199){if(_0x388199){return[_0x388199,![]];}_0x32e2d3[_0xce93('0xaf')]=_0x46442b['body'][_0xce93('0xaf')];_0x32e2d3['externalUrl']=_0x46442b['body'][_0xce93('0xb0')];return db[_0xce93('0xb1')]['create'](_0x32e2d3)['then'](function(_0xb877fb){return[_0xb877fb,!![]];});});}_0x16da90[_0xce93('0xb2')]=_0x556764['id'];if(_0x46442b[_0xce93('0x52')][_0xce93('0xb3')]&&_0x46442b[_0xce93('0x52')][_0xce93('0xb3')]['id']){_0x16da90['id']=_0x46442b[_0xce93('0x52')][_0xce93('0xb3')]['id'];return db[_0xce93('0xb1')][_0xce93('0x50')]({'where':_0x16da90})[_0xce93('0x15')](function(_0x182335){if(_0x182335){return[_0x182335,![]];}return db[_0xce93('0xb1')][_0xce93('0x51')](_0x32e2d3)[_0xce93('0x15')](function(_0xedf977){return[_0xedf977,!![]];});});}return db[_0xce93('0xb1')]['create'](_0x32e2d3)[_0xce93('0x15')](function(_0x4c54d1){return[_0x4c54d1,!![]];});}})[_0xce93('0xb4')](function(_0x3b5016,_0x86ad8d){if(_0x3b5016){_0x14f6cb=_0x86ad8d;if(!_0x86ad8d){var _0x4f4e17={'from':(_0x476de3['contact'][_0xce93('0xa3')]||'')+'\x20'+(_0x476de3['contact'][_0xce93('0xa4')]||'')};if(_0x46442b[_0xce93('0x52')]['threadId']&&_0x46442b[_0xce93('0x52')][_0xce93('0xb5')]&&_0x46442b[_0xce93('0x52')][_0xce93('0xaf')]!=_0x46442b[_0xce93('0x52')]['messageId']){_0x4f4e17[_0xce93('0xaf')]=_0x46442b[_0xce93('0x52')][_0xce93('0xb5')];}return _0x3b5016[_0xce93('0x29')](_0x4f4e17);}else{return _0x3b5016;}}})[_0xce93('0x15')](function(_0xe7d67c){_0x476de3[_0xce93('0xb3')]=_0xe7d67c[_0xce93('0x2a')]({'plain':!![]});_0x476de3[_0xce93('0xb3')][_0xce93('0xb6')]=_0x14f6cb;if(_0x476de3['interaction'][_0xce93('0xb6')]){if(_0x476de3[_0xce93('0x98')][_0xce93('0xb7')]){_0x476de3[_0xce93('0x99')][_0xce93('0xb8')]({'id':0x0,'priority':_0x476de3['applications'][_0xce93('0x3f')]+0x1,'app':_0xce93('0xb9'),'appdata':_0xce93('0xba'),'interval':'*,*,*,*'});}}return db[_0xce93('0xbb')][_0xce93('0x51')]({'body':_0x46442b[_0xce93('0x52')]['body'],'ChatWebsiteId':_0x46442b[_0xce93('0x4f')]['id'],'ChatInteractionId':_0xe7d67c['id'],'direction':'in','ContactId':_0x476de3[_0xce93('0x9f')]['id'],'AttachmentId':_0x46442b[_0xce93('0x52')][_0xce93('0xbc')]});})[_0xce93('0x15')](function(_0x4dc4fd){_0x476de3[_0xce93('0x1d')]=_0x4dc4fd;if(_0x476de3[_0xce93('0xb3')][_0xce93('0xbd')]){return db[_0xce93('0xbe')]['find']({'attributes':['id',_0xce93('0x2e')],'where':{'id':_0x476de3['interaction'][_0xce93('0xbd')]}})[_0xce93('0x15')](function(_0x27cd1a){if(_0x27cd1a){_0x476de3['applications'][_0xce93('0xbf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x27cd1a[_0xce93('0x2e')]+','+(_0x476de3[_0xce93('0x98')][_0xce93('0xc0')]||0xa),'interval':_0xce93('0xc1')});_0x476de3[_0xce93('0xc2')]=!![];}return respondWithRpcPromise(_0xce93('0xc3'),'startRouting',_0x476de3);});}return respondWithRpcPromise(_0xce93('0xc3'),_0xce93('0xc4'),_0x476de3);})[_0xce93('0x15')](function(_0x1ed5f7){respondWithRpcPromise(_0xce93('0xc5'),_0xce93('0xc5'),{'event':'notify','message':_0x1ed5f7},client9002);return _0x1ed5f7;})[_0xce93('0x15')](respondWithResult(_0x255841,null))[_0xce93('0x1f')](handleError(_0x255841,null));};exports['offline']=function(_0x595b50,_0x348a8c){var _0x34e462,_0x28bd2b,_0x181dc8;var _0x1b8a20=[];var _0x395e7e={};var _0x3678a1=_0x595b50[_0xce93('0xc6')]||[];var _0x502c9f=[];var _0x4a4c7d;return db[_0xce93('0x94')]['describe']()[_0xce93('0x15')](function(_0x59cfbe){if(!_0x59cfbe){throw new db[(_0xce93('0x86'))][(_0xce93('0x87'))](_0xce93('0x88'));}_0x1b8a20=_['difference'](_[_0xce93('0x3a')](_0x59cfbe),['createdAt',_0xce93('0x8b'),'CompanyId',_0xce93('0x8d')]);if(_0x595b50[_0xce93('0x52')]['id']){delete _0x595b50[_0xce93('0x52')]['id'];}if(_[_0xce93('0x7d')](_0x595b50[_0xce93('0x52')][_0xce93('0x9e')])){throw _0x348a8c[_0xce93('0x22')](0x1f4)[_0xce93('0x2f')](new db['Sequelize'][(_0xce93('0x87'))]('from\x20is\x20mandatory'));}if(_[_0xce93('0x7d')](_0x595b50[_0xce93('0x52')][_0xce93('0x52')])||_0x595b50[_0xce93('0x52')][_0xce93('0x52')]===''){throw _0x348a8c[_0xce93('0x22')](0x1f4)[_0xce93('0x2f')](new db[(_0xce93('0x86'))]['ValidationError'](_0xce93('0x8e')));}if(_[_0xce93('0x7d')](_0x595b50['body']['mapKeyOffline'])){throw _0x348a8c[_0xce93('0x22')](0x1f4)[_0xce93('0x2f')](new db[(_0xce93('0x86'))][(_0xce93('0x87'))](_0xce93('0xc7')+_0x1b8a20));}if(!_[_0xce93('0xc8')](_0x1b8a20,_0x595b50['body'][_0xce93('0xc9')])){throw _0x348a8c[_0xce93('0x22')](0x1f4)[_0xce93('0x2f')](new db[(_0xce93('0x86'))]['ValidationError'](_0xce93('0xca')+_0x1b8a20));}_0x395e7e[_0x595b50[_0xce93('0x52')]['mapKeyOffline']]=_0x595b50[_0xce93('0x52')][_0xce93('0x9e')];})[_0xce93('0x15')](function(){return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x595b50['params']['id']},'include':[{'model':db[_0xce93('0x92')],'as':'List'},{'model':db[_0xce93('0xcb')],'as':_0xce93('0xcb')}]});})[_0xce93('0x15')](handleEntityNotFound(_0x348a8c,null))[_0xce93('0x15')](function(_0x4eee58){if(_0x4eee58&&_0x4eee58['List']){_0x28bd2b=_0x4eee58;var _0x249911=_[_0xce93('0xf')](_0x595b50[_0xce93('0x52')],{'firstName':_0x595b50[_0xce93('0x52')][_0xce93('0x9e')],'phone':_0x595b50[_0xce93('0x52')][_0xce93('0x9e')],'ListId':_0x4eee58[_0xce93('0x8d')]});_0x249911[_0x595b50[_0xce93('0x52')][_0xce93('0xc9')]]=_0x595b50[_0xce93('0x52')][_0xce93('0x9e')];return db[_0xce93('0x94')][_0xce93('0xcc')]({'where':_0x395e7e,'defaults':_0x249911});}})['spread'](function(_0x18e7c6){if(_0x18e7c6){_0x181dc8=_0x18e7c6;var _0x78da47=fs['readFileSync'](path[_0xce93('0x71')](config[_0xce93('0x72')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x3b91db=ejs[_0xce93('0xcd')](_0x78da47,{'body':_[_0xce93('0xce')](_0x595b50[_0xce93('0x52')][_0xce93('0x52')]),'bodyTitle':_0x28bd2b[_0xce93('0xcf')]});return db[_0xce93('0xd0')][_0xce93('0x51')]({'body':_0x3b91db,'plainBody':htmlToText[_0xce93('0xd1')](_0x3b91db),'ContactId':_0x18e7c6['id'],'ChatWebsiteId':_0x28bd2b['id']});}})[_0xce93('0x15')](function(_0x4af521){_0x4a4c7d=_0x4af521;if(_0x3678a1[_0xce93('0x3f')]){var _0x364c64=_0x3678a1[_0xce93('0x33')](function(_0x566084){return{'name':_0x566084[_0xce93('0xd2')],'basename':_0x566084['filename'],'type':_0x566084[_0xce93('0xd3')],'ChatOfflineMessageId':_0x4af521['id']};});_0x502c9f=_0x364c64[_0xce93('0x33')](_0x24ce6a=>{var _0xafa536={'filename':_0x24ce6a[_0xce93('0x2e')],'path':path['join'](config[_0xce93('0x72')],_0xce93('0xd4'),_0xce93('0xc6'),_0xce93('0xd5'),_0xce93('0xd6'),_0x24ce6a[_0xce93('0xd7')])};return _0xafa536;});if(!_0x28bd2b['openNewInteraction']){return db[_0xce93('0xd8')][_0xce93('0xd9')](function(_0x40dfe3){return db[_0xce93('0xda')][_0xce93('0xdb')](_0x364c64,{'transaction':_0x40dfe3});});}}})['then'](function(){if(_0x4a4c7d){_0x34e462=_0x4a4c7d;return db[_0xce93('0xcb')][_0xce93('0x5e')]({'where':{'service':!![]},'include':[{'model':db[_0xce93('0xdc')],'as':_0xce93('0xdd'),'raw':!![],'include':[{'model':db[_0xce93('0xde')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xce93('0x15')](function(_0x470c21){if(_0x470c21&&_0x470c21[_0xce93('0xdd')]&&_0x28bd2b[_0xce93('0xdf')]&&_0x28bd2b[_0xce93('0xe0')]){var _0x1b083a=_0x470c21[_0xce93('0xe1')]();return respondWithRpcPromise('SendMail',_0xce93('0xe2'),{'account':_0x1b083a,'message':{'from':util[_0xce93('0xa9')](_0xce93('0xe3'),_0x470c21[_0xce93('0x2e')],_0x470c21[_0xce93('0xe4')]||_0x470c21[_0xce93('0xdd')][_0xce93('0x53')]),'to':_0x28bd2b['forwardOfflineAddress'],'subject':_0x28bd2b[_0xce93('0xe5')],'html':_0x34e462[_0xce93('0x52')],'attachments':_0x502c9f}},client9003)[_0xce93('0x15')](function(){return _0x34e462;})[_0xce93('0x1f')](function(_0x48ece0){logger[_0xce93('0x1b')](_0x48ece0);});}})['then'](function(){if(_0x28bd2b&&_0x28bd2b[_0xce93('0xe6')]&&_0x28bd2b[_0xce93('0xe7')]){var _0x6723ae=[];if(_0x3678a1[_0xce93('0x3f')]){_0x6723ae=_0x3678a1[_0xce93('0x33')](function(_0x1c6269){return{'name':_0x1c6269['originalname'],'basename':_0x1c6269[_0xce93('0x69')],'type':_0x1c6269['mimetype'],'ChatOfflineMessageId':_0x4a4c7d['id']};});}var _0x43fc47;if(!_[_0xce93('0x7d')](_0x28bd2b[_0xce93('0xe8')])){var _0x398bfd=_[_0xce93('0x33')](_0x595b50[_0xce93('0x52')],function(_0x44be71){return _0x44be71;});var _0xf91098=_[_0xce93('0xe9')](_0x398bfd)[0x0];var _0x5c2c4c=_[_0xce93('0xea')](_0xf91098,function(_0x44c0de){return _0x44c0de;});_0x43fc47=_0x5c2c4c[0x1][_0x28bd2b['subjectOffline']];}var _0x5382a7={'from':_0x181dc8['email'],'firstName':_0x181dc8[_0xce93('0xa3')],'lastName':_0x181dc8[_0xce93('0xa4')],'mapKey':_0xce93('0xe4'),'message':{'from':_0x181dc8[_0xce93('0xe4')],'to':_0x28bd2b[_0xce93('0xcb')][_0xce93('0xe4')],'cc':'','subject':_[_0xce93('0x7d')](_0x43fc47)?_0x28bd2b['offlineMessageSubject']:_0x43fc47,'messageId':'','sentAt':new Date(),'attach':_0x6723ae[_0xce93('0x3f')],'attachments':_0x6723ae,'originChannel':_0xce93('0xeb'),'ChatWebsiteId':_0x28bd2b['id'],'ChatOfflineMessageId':_0x34e462['id'],'originTo':_0x28bd2b[_0xce93('0xcb')][_0xce93('0xe4')]},'body':_0x34e462['body']};var _0x202fa9={'account':{'id':_0x28bd2b[_0xce93('0xe7')]},'body':_0x5382a7,'log':_0xce93('0xec')};return respondWithRpcPromise(_0xce93('0xec'),_0xce93('0xed'),_0x202fa9,client9001)[_0xce93('0x15')](function(){return _0x34e462;})[_0xce93('0x1f')](function(_0x47bb05){logger['error'](_0x47bb05);});}return;})[_0xce93('0x15')](function(){if(_0x34e462){return _0x34e462;}})[_0xce93('0x15')](respondWithResult(_0x348a8c,null))[_0xce93('0x1f')](function(_0x3cda42){logger[_0xce93('0x1b')]('catch',_0x3cda42);for(var _0x3d2d18 of _0x3678a1){var _0x5acb2c=path[_0xce93('0x71')](config[_0xce93('0x72')],'server',_0xce93('0xc6'),_0xce93('0xd5'),_0xce93('0xd6'),_0x3d2d18['filename']);fs_extra[_0xce93('0xee')](_0x5acb2c)['catch'](function(_0x2b544a){logger[_0xce93('0x1b')](_0xce93('0xef'),_0x5acb2c,_0x2b544a);});}});};exports[_0xce93('0xf0')]=function(_0x2495d0,_0x33a2da){return db[_0xce93('0xb1')][_0xce93('0x50')]({'where':{'id':_0x2495d0[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x33a2da,null))[_0xce93('0x15')](function(_0x33441e){if(_0x33441e){return _0x33441e[_0xce93('0xf0')](_0x2495d0[_0xce93('0x52')][_0xce93('0x62')],_[_0xce93('0xf1')](_0x2495d0[_0xce93('0x52')],[_0xce93('0x62'),'id'])||{});}})[_0xce93('0x15')](respondWithResult(_0x33a2da,null))[_0xce93('0x1f')](handleError(_0x33a2da,null));};exports[_0xce93('0xf2')]=function(_0x2a9f3e,_0x2e1f10){var _0x2a7b28={'raw':![],'where':{}};var _0x18cbe8={};var _0x37af3a={'count':0x0,'rows':[]};return db[_0xce93('0x4c')][_0xce93('0x5e')]({'where':{'id':_0x2a9f3e['params']['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x2e1f10,null))[_0xce93('0x15')](function(_0x4f22b7){if(_0x4f22b7){_0x18cbe8[_0xce93('0x38')]=_[_0xce93('0x3a')](db['ChatInteraction'][_0xce93('0x34')]);_0x18cbe8[_0xce93('0x39')]=_[_0xce93('0x3a')](_0x2a9f3e['query']);_0x18cbe8[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x18cbe8['model'],_0x18cbe8[_0xce93('0x39')]);_0x2a7b28[_0xce93('0x3d')]=_[_0xce93('0x3c')](_0x18cbe8[_0xce93('0x38')],qs[_0xce93('0x3e')](_0x2a9f3e[_0xce93('0x39')][_0xce93('0x3e')]));_0x2a7b28[_0xce93('0x3d')]=_0x2a7b28['attributes']['length']?_0x2a7b28['attributes']:_0x18cbe8[_0xce93('0x38')];if(!_0x2a9f3e['query'][_0xce93('0x40')](_0xce93('0x41'))){_0x2a7b28['limit']=qs[_0xce93('0x27')](_0x2a9f3e[_0xce93('0x39')][_0xce93('0x27')]);_0x2a7b28[_0xce93('0x24')]=qs['offset'](_0x2a9f3e[_0xce93('0x39')][_0xce93('0x24')]);}_0x2a7b28[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x2a9f3e[_0xce93('0x39')][_0xce93('0x43')]);_0x2a7b28[_0xce93('0x44')]=qs[_0xce93('0x3b')](_[_0xce93('0x45')](_0x2a9f3e['query'],_0x18cbe8[_0xce93('0x3b')]));_0x2a7b28[_0xce93('0x44')]['ChatWebsiteId']=_0x4f22b7['id'];if(_0x2a9f3e[_0xce93('0x39')][_0xce93('0x46')]){_0x2a7b28[_0xce93('0x44')]=_[_0xce93('0x48')](_0x2a7b28[_0xce93('0x44')],{'$or':_['map'](_0x2a7b28[_0xce93('0x3d')],function(_0x4c6ef9){var _0x27ec2d={};_0x27ec2d[_0x4c6ef9]={'$like':'%'+_0x2a9f3e['query'][_0xce93('0x46')]+'%'};return _0x27ec2d;})});}_0x2a7b28=_[_0xce93('0x48')]({},_0x2a7b28,_0x2a9f3e[_0xce93('0x49')]);return db['ChatInteraction'][_0xce93('0x26')]({'where':_0x2a7b28['where']})[_0xce93('0x15')](function(_0x12b869){_0x37af3a[_0xce93('0x26')]=_0x12b869;if(_0x2a9f3e[_0xce93('0x39')][_0xce93('0x4a')]){_0x2a7b28['include']=[{'model':db[_0xce93('0x94')],'as':_0xce93('0xf3'),'required':![]},{'model':db[_0xce93('0xbe')],'as':_0xce93('0xf4'),'attributes':[_0xce93('0x2e'),_0xce93('0xf5'),_0xce93('0xf6')],'required':![]},{'model':db[_0xce93('0xf7')],'as':'Tags','attributes':['id',_0xce93('0x2e'),_0xce93('0xf8')],'where':_0x2a9f3e['query'][_0xce93('0xf9')]?{'id':_0x2a9f3e['query'][_0xce93('0xf9')]}:undefined,'required':_0x2a9f3e[_0xce93('0x39')][_0xce93('0xf9')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x2a7b28);})['then'](function(_0x9a1a77){_0x37af3a[_0xce93('0x4d')]=_0x9a1a77;return _0x37af3a;});}})[_0xce93('0x15')](respondWithFilteredResult(_0x2e1f10,_0x2a7b28))[_0xce93('0x1f')](handleError(_0x2e1f10,null));};function iftimePromise(_0x40a757,_0x5d822d){return respondWithRpcPromise(_0xce93('0xfa'),'getSnippet',{'command':_0x5d822d['timezone']?util[_0xce93('0xa9')](_0xce93('0xfb'),_0x40a757[_0xce93('0xfc')],_0x5d822d[_0xce93('0xfd')]):util[_0xce93('0xa9')](_0xce93('0xfe'),_0x40a757[_0xce93('0xfc')])},client9002)[_0xce93('0x15')](function(_0xc53dc9){var _0x577122=_0xc53dc9&&_0xc53dc9[_0xce93('0xff')](_0xce93('0x100'))>=0x0?!![]:![];logger[_0xce93('0x16')](_0xce93('0x101'),_0x5d822d['id'],_0x40a757['id'],_0x40a757[_0xce93('0xfc')],_0x577122?_0xce93('0x102'):'OFFLINE',_0x5d822d[_0xce93('0xfd')]?_0x5d822d['timezone']:_0xce93('0x103'));return _0x577122;})[_0xce93('0x1f')](function(_0x4eadc5){logger[_0xce93('0x1b')](_0xce93('0x101'),_0x5d822d['id'],_0x40a757['id'],_0x40a757['interval'],util['inspect'](_0x4eadc5,{'showHidden':![],'depth':null}),_0x5d822d['timezone']?_0x5d822d[_0xce93('0xfd')]:'No\x20timezone');return![];});}exports[_0xce93('0x104')]=function(_0x2ef3d3,_0xa278e1){var _0x3e358f=0x0;var _0x5ea8c0=0x0;var _0x1e87f8=![];var _0x516462;var _0x28b172;return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x2ef3d3[_0xce93('0x4f')]['id']},'include':[{'model':db[_0xce93('0x105')],'as':_0xce93('0x105'),'include':[{'model':db[_0xce93('0x105')],'as':_0xce93('0x106'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xce93('0x15')](handleEntityNotFound(_0xa278e1,null))['then'](function(_0x2adf53){if(_0x2adf53){_0x516462=_0x2adf53;return _0x2adf53[_0xce93('0x107')]({'raw':!![]});}})[_0xce93('0x15')](function(_0x2782bc){if(_0x516462){if(_0x2782bc){_0x28b172=_0x2782bc;}}return require(_0xce93('0x74'))[_0xce93('0x75')]();})[_0xce93('0x15')](function(_0x2c3c18){if(_0x2c3c18){_0x5ea8c0=_0x2c3c18[_0xce93('0x108')];_0x1e87f8=_0x2c3c18[_0xce93('0x76')];}})['then'](function(){return db[_0xce93('0xb1')][_0xce93('0x26')]({'where':{'closed':![]}});})[_0xce93('0x15')](function(_0x398257){_0x3e358f=_0x398257;if(_0x5ea8c0&&_0x398257>_0x5ea8c0){return db[_0xce93('0x109')]['findOne']({'where':{'id':0x1}})['then'](function(_0x4e72c6){if(_0x4e72c6){_0x4e72c6[_0xce93('0x10a')](_0xce93('0x10b'));}});}})[_0xce93('0x15')](function(){if(_0x516462[_0xce93('0x105')]&&_0x516462[_0xce93('0x105')]['Intervals']){var _0x14d888=[];for(var _0x1e03f8=0x0;_0x1e03f8<_0x516462[_0xce93('0x105')][_0xce93('0x106')]['length'];_0x1e03f8++){var _0x109748=_0x516462[_0xce93('0x105')][_0xce93('0x106')][_0x1e03f8]['get']({'plain':!![]});_0x14d888[_0xce93('0xb8')](iftimePromise(_0x109748,_0x516462));}return BPromise[_0xce93('0x10c')](_0x14d888)[_0xce93('0x15')](function(_0x529d41){return _[_0xce93('0x10d')](_0x529d41);});}else{return!![];}})[_0xce93('0x15')](function(_0x5986ee){var _0x982f50=fs['readFileSync'](path['join'](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x4fddde=new url[(_0xce93('0x10e'))](_0x516462[_0xce93('0x10f')])[_0xce93('0x110')];var _0x44f4c9=_0xce93('0x111');var _0x349389=![];var _0x51194b={'chatVersion':_0x44f4c9,'chatWebsiteAddressOrigin':_0x4fddde,'remote':_0x516462[_0xce93('0x112')],'query':querystring['stringify'](_[_0xce93('0x48')](_0x516462[_0xce93('0x2a')]({'plain':!![]}),{'customerIp':_0x2ef3d3[_0xce93('0x82')][_0xce93('0xa1')]||_0x2ef3d3['headers']['x-real-ip']||_0x2ef3d3[_0xce93('0x113')][_0xce93('0x114')]||_0x2ef3d3['ip'],'referer':_0x2ef3d3[_0xce93('0x82')][_0xce93('0xa6')],'openedInteractions':_0x3e358f,'maxInteractions':_0x5ea8c0,'virtual':_0x1e87f8[_0xce93('0x108')],'online':_0x5986ee,'custom':_0x1e87f8}))[_0xce93('0x115')](/'/g,'\x5c\x27')};_0xa278e1[_0xce93('0x2f')](ejs[_0xce93('0xcd')](Mustache[_0xce93('0xcd')](_0x982f50,_0x51194b),{'proactiveActions':_0x28b172,'alignment':_0x516462[_0xce93('0x116')],'verticalAlignment':_0x516462[_0xce93('0x117')],'div_color':_0x516462['color'],'labelText':_0x516462['labelText'],'text_color':_0x516462[_0xce93('0x118')],'text_button_color':_0x516462[_0xce93('0x119')],'button_color':_0x516462[_0xce93('0x11a')],'background_color':_0x516462[_0xce93('0x11b')],'hideWhenOffline':_0x516462['hideWhenOffline'],'intervalId':_0x516462[_0xce93('0x11c')],'isDevelopment':_0x349389,'chatVersion':_0x44f4c9}));})[_0xce93('0x1f')](handleError(_0xa278e1,null));};exports[_0xce93('0x11d')]=function(_0x5bb406,_0xe824e7){var _0x1be6f3=_0x5bb406['params']['id'];var _0x1562e9=_0x5bb406[_0xce93('0x52')];var _0x21afa4=0xc8;var _0x436dc7=null;return db[_0xce93('0xd8')]['transaction']({'isolationLevel':db[_0xce93('0xd8')][_0xce93('0x11e')][_0xce93('0x11f')][_0xce93('0x120')]},function(_0x4d28fb){return db['ChatWebsite'][_0xce93('0x5e')]({'where':{'id':_0x1be6f3},'transaction':_0x4d28fb})[_0xce93('0x15')](function(_0x4db7c3){if(_0x4db7c3){return db[_0xce93('0x97')]['destroy']({'where':{'ChatWebsiteId':_0x1be6f3},'transaction':_0x4d28fb})[_0xce93('0x15')](function(){var _0x202d08=_['map'](_0x1562e9,function(_0x5622c2){_0x5622c2[_0xce93('0x5c')]=_0x1be6f3;return _0x5622c2;});return db[_0xce93('0x97')][_0xce93('0xdb')](_0x202d08,{'transaction':_0x4d28fb});});}else{_0x21afa4=0x194;_0x436dc7=[];}});})[_0xce93('0x15')](function(){if(_0x21afa4!==0x194){return db[_0xce93('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1be6f3},'order':_0xce93('0x9c')})['then'](function(_0x585089){_0x436dc7=_0x585089;});}})[_0xce93('0x1f')](function(_0x2339ee){_0x21afa4=0x1f4;logger[_0xce93('0x1b')](_0x2339ee[_0xce93('0x121')]);if(_0x2339ee[_0xce93('0x2e')]){delete _0x2339ee[_0xce93('0x2e')];}_0x436dc7=_0x2339ee;})[_0xce93('0x122')](function(){if(_0x436dc7===null){_0xe824e7[_0xce93('0x20')](_0x21afa4);}else{if(_0x21afa4===0x1f4){_0xe824e7[_0xce93('0x22')](_0x21afa4)['send'](_0x436dc7);}else{_0xe824e7['status'](_0x21afa4)[_0xce93('0x23')](_0x436dc7);}}});};exports[_0xce93('0x123')]=function(_0x9f0307,_0x24a999){var _0x52ca4b={};var _0x44ff16={};var _0x149ded;var _0x3e0be2;return db[_0xce93('0x4c')][_0xce93('0x5e')]({'where':{'id':_0x9f0307[_0xce93('0x4f')]['id']}})['then'](handleEntityNotFound(_0x24a999,null))[_0xce93('0x15')](function(_0x335215){if(_0x335215){_0x149ded=_0x335215;_0x44ff16[_0xce93('0x38')]=_[_0xce93('0x3a')](db[_0xce93('0x97')]['rawAttributes']);_0x44ff16[_0xce93('0x39')]=_[_0xce93('0x3a')](_0x9f0307[_0xce93('0x39')]);_0x44ff16[_0xce93('0x3b')]=_['intersection'](_0x44ff16['model'],_0x44ff16['query']);_0x52ca4b['attributes']=_['intersection'](_0x44ff16[_0xce93('0x38')],qs[_0xce93('0x3e')](_0x9f0307[_0xce93('0x39')]['fields']));_0x52ca4b[_0xce93('0x3d')]=_0x52ca4b['attributes'][_0xce93('0x3f')]?_0x52ca4b[_0xce93('0x3d')]:_0x44ff16[_0xce93('0x38')];_0x52ca4b[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x9f0307['query'][_0xce93('0x43')]);_0x52ca4b[_0xce93('0x44')]=qs[_0xce93('0x3b')](_['pick'](_0x9f0307['query'],_0x44ff16[_0xce93('0x3b')]));if(_0x9f0307[_0xce93('0x39')][_0xce93('0x46')]){_0x52ca4b[_0xce93('0x44')]=_[_0xce93('0x48')](_0x52ca4b['where'],{'$or':_[_0xce93('0x33')](_0x52ca4b[_0xce93('0x3d')],function(_0x302415){var _0x57ef58={};_0x57ef58[_0x302415]={'$like':'%'+_0x9f0307[_0xce93('0x39')][_0xce93('0x46')]+'%'};return _0x57ef58;})});}_0x52ca4b=_['merge']({},_0x52ca4b,_0x9f0307['options']);return _0x149ded[_0xce93('0x123')](_0x52ca4b);}})[_0xce93('0x15')](function(_0x42c8a6){if(_0x42c8a6){_0x3e0be2=_0x42c8a6[_0xce93('0x3f')];if(!_0x9f0307[_0xce93('0x39')][_0xce93('0x40')](_0xce93('0x41'))){_0x52ca4b['limit']=qs[_0xce93('0x27')](_0x9f0307[_0xce93('0x39')][_0xce93('0x27')]);_0x52ca4b[_0xce93('0x24')]=qs[_0xce93('0x24')](_0x9f0307[_0xce93('0x39')][_0xce93('0x24')]);}return _0x149ded[_0xce93('0x123')](_0x52ca4b);}})[_0xce93('0x15')](function(_0x3bc20c){if(_0x3bc20c){return _0x3bc20c?{'count':_0x3e0be2,'rows':_0x3bc20c}:null;}})[_0xce93('0x15')](respondWithResult(_0x24a999,null))['catch'](handleError(_0x24a999,null));};exports[_0xce93('0x124')]=function(_0x68ac18,_0x483afa){return db[_0xce93('0x125')][_0xce93('0x50')]({'where':{'id':_0x68ac18[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x483afa,null))[_0xce93('0x15')](function(_0x5e130e){if(_0x5e130e){return _0x5e130e[_0xce93('0x124')](_0x68ac18[_0xce93('0x52')][_0xce93('0x62')],_[_0xce93('0xf1')](_0x68ac18[_0xce93('0x52')],[_0xce93('0x62'),'id'])||{});}})['then'](respondWithResult(_0x483afa,null))[_0xce93('0x1f')](handleError(_0x483afa,null));};exports[_0xce93('0x107')]=function(_0x84ac8b,_0x33a184){var _0x572590={};var _0x390421={};var _0x21ede4;var _0x175ebe;return db[_0xce93('0x4c')][_0xce93('0x5e')]({'where':{'id':_0x84ac8b['params']['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x33a184,null))[_0xce93('0x15')](function(_0x112828){if(_0x112828){_0x21ede4=_0x112828;_0x390421[_0xce93('0x38')]=_['keys'](db[_0xce93('0x126')][_0xce93('0x34')]);_0x390421[_0xce93('0x39')]=_[_0xce93('0x3a')](_0x84ac8b[_0xce93('0x39')]);_0x390421[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x390421[_0xce93('0x38')],_0x390421[_0xce93('0x39')]);_0x572590[_0xce93('0x3d')]=_['intersection'](_0x390421[_0xce93('0x38')],qs['fields'](_0x84ac8b['query'][_0xce93('0x3e')]));_0x572590['attributes']=_0x572590['attributes'][_0xce93('0x3f')]?_0x572590[_0xce93('0x3d')]:_0x390421[_0xce93('0x38')];_0x572590[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x84ac8b[_0xce93('0x39')][_0xce93('0x43')]);_0x572590[_0xce93('0x44')]=qs[_0xce93('0x3b')](_[_0xce93('0x45')](_0x84ac8b[_0xce93('0x39')],_0x390421[_0xce93('0x3b')]));if(_0x84ac8b[_0xce93('0x39')][_0xce93('0x46')]){_0x572590[_0xce93('0x44')]=_['merge'](_0x572590[_0xce93('0x44')],{'$or':_['map'](_0x572590[_0xce93('0x3d')],function(_0x38a5ca){var _0x279292={};_0x279292[_0x38a5ca]={'$like':'%'+_0x84ac8b[_0xce93('0x39')][_0xce93('0x46')]+'%'};return _0x279292;})});}_0x572590=_[_0xce93('0x48')]({},_0x572590,_0x84ac8b[_0xce93('0x49')]);return _0x21ede4[_0xce93('0x107')](_0x572590);}})[_0xce93('0x15')](function(_0x14d1c7){if(_0x14d1c7){_0x175ebe=_0x14d1c7['length'];if(!_0x84ac8b[_0xce93('0x39')][_0xce93('0x40')](_0xce93('0x41'))){_0x572590[_0xce93('0x27')]=qs[_0xce93('0x27')](_0x84ac8b['query'][_0xce93('0x27')]);_0x572590['offset']=qs[_0xce93('0x24')](_0x84ac8b[_0xce93('0x39')][_0xce93('0x24')]);}return _0x21ede4[_0xce93('0x107')](_0x572590);}})[_0xce93('0x15')](function(_0x3eff61){if(_0x3eff61){return _0x3eff61?{'count':_0x175ebe,'rows':_0x3eff61}:null;}})[_0xce93('0x15')](respondWithResult(_0x33a184,null))[_0xce93('0x1f')](handleError(_0x33a184,null));};exports[_0xce93('0x127')]=function(_0x4d9201,_0x6dcb52){var _0x2aa53c=_0x4d9201['query'][_0xce93('0x128')]===_0xce93('0x129')?_0xce93('0x12a'):_0xce93('0x12b');return db['ChatWebsite']['find']({'attributes':['id',_0x2aa53c],'where':{'id':_0x4d9201['params']['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x6dcb52,null))[_0xce93('0x15')](function(_0x48782e){if(_0x48782e){var _0x1edad3=_0x48782e[_0x2aa53c];var _0x8cc697=_0x1edad3&&_0x1edad3[_0xce93('0x12c')]?_0x1edad3[_0xce93('0x12c')]:[];_0x6dcb52[_0xce93('0x2f')]({'fromKey':_[_0xce93('0x7d')](_0x1edad3['fromKey'])?undefined:_0x1edad3[_0xce93('0x12d')],'count':_0x8cc697[_0xce93('0x3f')],'rows':_0x8cc697});}})[_0xce93('0x1f')](handleError(_0x6dcb52,null));};exports[_0xce93('0x12e')]=function(_0x7b683e,_0x132266){var _0x11a358={'raw':![],'where':{}};var _0x2a9598={};var _0x3c7fd8={'count':0x0,'rows':[]};return db[_0xce93('0x4c')][_0xce93('0x5e')]({'where':{'id':_0x7b683e['params']['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x132266,null))[_0xce93('0x15')](function(_0xc802ba){if(_0xc802ba){_0x2a9598['model']=_[_0xce93('0x3a')](db[_0xce93('0xd0')][_0xce93('0x34')]);_0x2a9598[_0xce93('0x39')]=_['keys'](_0x7b683e['query']);_0x2a9598[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x2a9598[_0xce93('0x38')],_0x2a9598[_0xce93('0x39')]);_0x11a358['attributes']=_[_0xce93('0x3c')](_0x2a9598[_0xce93('0x38')],qs[_0xce93('0x3e')](_0x7b683e['query']['fields']));_0x11a358['attributes']=_0x11a358['attributes'][_0xce93('0x3f')]?_0x11a358[_0xce93('0x3d')]:_0x2a9598[_0xce93('0x38')];if(!_0x7b683e[_0xce93('0x39')][_0xce93('0x40')](_0xce93('0x41'))){_0x11a358[_0xce93('0x27')]=qs[_0xce93('0x27')](_0x7b683e[_0xce93('0x39')][_0xce93('0x27')]);_0x11a358[_0xce93('0x24')]=qs['offset'](_0x7b683e[_0xce93('0x39')][_0xce93('0x24')]);}_0x11a358[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x7b683e['query'][_0xce93('0x43')]);_0x11a358['where']=qs['filters'](_[_0xce93('0x45')](_0x7b683e['query'],_0x2a9598[_0xce93('0x3b')]));_0x11a358['where'][_0xce93('0x5c')]=_0xc802ba['id'];if(_0x7b683e[_0xce93('0x39')][_0xce93('0x46')]){_0x11a358[_0xce93('0x44')]=_[_0xce93('0x48')](_0x11a358[_0xce93('0x44')],{'$or':_['map'](_0x11a358['attributes'],function(_0x198555){var _0x938929={};_0x938929[_0x198555]={'$like':'%'+_0x7b683e[_0xce93('0x39')][_0xce93('0x46')]+'%'};return _0x938929;})});}_0x11a358=_[_0xce93('0x48')]({},_0x11a358,_0x7b683e[_0xce93('0x49')]);return db[_0xce93('0xd0')][_0xce93('0x26')]({'where':_0x11a358[_0xce93('0x44')]})[_0xce93('0x15')](function(_0x18796b){_0x3c7fd8[_0xce93('0x26')]=_0x18796b;if(_0x7b683e['query'][_0xce93('0x4a')]){_0x11a358['include']=[{'all':!![]}];}else{_0x11a358[_0xce93('0x4b')]=[{'model':db[_0xce93('0x94')],'as':'Contact','required':![]},{'model':db[_0xce93('0xda')],'as':_0xce93('0x12f'),'required':![]}];}return db[_0xce93('0xd0')][_0xce93('0x60')](_0x11a358);})[_0xce93('0x15')](function(_0x17326b){_0x3c7fd8[_0xce93('0x4d')]=_0x17326b;return _0x3c7fd8;});}})[_0xce93('0x15')](respondWithFilteredResult(_0x132266,_0x11a358))['catch'](handleError(_0x132266,null));};exports['addAgents']=function(_0x3d641b,_0x49f58d){return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x3d641b[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x49f58d,null))['then'](function(_0x1ff614){if(_0x1ff614){return _0x1ff614[_0xce93('0x130')](_0x3d641b[_0xce93('0x52')][_0xce93('0x62')],_[_0xce93('0xf1')](_0x3d641b[_0xce93('0x52')],['ids','id'])||{})[_0xce93('0xb4')](function(_0x4f5af1){for(var _0x56cffc=0x0;_0x56cffc<_0x3d641b[_0xce93('0x52')][_0xce93('0x62')][_0xce93('0x3f')];_0x56cffc+=0x1){socket['emit'](_0xce93('0x131'),{'UserId':Number(_0x3d641b[_0xce93('0x52')][_0xce93('0x62')][_0x56cffc]),'ChatWebsiteId':Number(_0x3d641b['params']['id'])});}return _0x4f5af1;});}})[_0xce93('0x15')](respondWithResult(_0x49f58d,null))[_0xce93('0x1f')](handleError(_0x49f58d,null));};exports[_0xce93('0x132')]=function(_0x1027d9,_0x20457e){return db[_0xce93('0x4c')][_0xce93('0x50')]({'where':{'id':_0x1027d9[_0xce93('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20457e,null))[_0xce93('0x15')](function(_0x110057){if(_0x110057){return _0x110057['removeAgents'](_0x1027d9[_0xce93('0x39')][_0xce93('0x62')])[_0xce93('0x15')](function(){if(_[_0xce93('0x133')](_0x1027d9[_0xce93('0x39')][_0xce93('0x62')])){for(var _0x56f70d=0x0;_0x56f70d<_0x1027d9[_0xce93('0x39')][_0xce93('0x62')][_0xce93('0x3f')];_0x56f70d+=0x1){socket[_0xce93('0x134')](_0xce93('0x135'),{'UserId':Number(_0x1027d9[_0xce93('0x39')][_0xce93('0x62')][_0x56f70d]),'ChatWebsiteId':Number(_0x1027d9[_0xce93('0x4f')]['id'])});}}else{socket[_0xce93('0x134')](_0xce93('0x135'),{'UserId':Number(_0x1027d9['query']['ids']),'ChatWebsiteId':Number(_0x1027d9[_0xce93('0x4f')]['id'])});}});}})[_0xce93('0x15')](respondWithStatusCode(_0x20457e,null))[_0xce93('0x1f')](handleError(_0x20457e,null));};exports[_0xce93('0x136')]=function(_0x45e7b8,_0x4c2a1e){var _0x59638d={};var _0x243137={};var _0x286688;var _0x59c629;return db[_0xce93('0x4c')][_0xce93('0x5e')]({'where':{'id':_0x45e7b8[_0xce93('0x4f')]['id']}})[_0xce93('0x15')](handleEntityNotFound(_0x4c2a1e,null))['then'](function(_0x183b8e){if(_0x183b8e){_0x286688=_0x183b8e;_0x243137[_0xce93('0x38')]=_['keys'](db[_0xce93('0xbe')][_0xce93('0x34')]);_0x243137[_0xce93('0x39')]=_[_0xce93('0x3a')](_0x45e7b8[_0xce93('0x39')]);_0x243137[_0xce93('0x3b')]=_[_0xce93('0x3c')](_0x243137[_0xce93('0x38')],_0x243137[_0xce93('0x39')]);_0x59638d[_0xce93('0x3d')]=_[_0xce93('0x3c')](_0x243137[_0xce93('0x38')],qs['fields'](_0x45e7b8[_0xce93('0x39')]['fields']));_0x59638d[_0xce93('0x3d')]=_0x59638d[_0xce93('0x3d')][_0xce93('0x3f')]?_0x59638d['attributes']:_0x243137[_0xce93('0x38')];_0x59638d[_0xce93('0x42')]=qs[_0xce93('0x43')](_0x45e7b8[_0xce93('0x39')][_0xce93('0x43')]);_0x59638d['where']=qs[_0xce93('0x3b')](_[_0xce93('0x45')](_0x45e7b8[_0xce93('0x39')],_0x243137['filters']));if(_0x45e7b8[_0xce93('0x39')][_0xce93('0x46')]){_0x59638d[_0xce93('0x44')]=_[_0xce93('0x48')](_0x59638d[_0xce93('0x44')],{'$or':_[_0xce93('0x33')](_0x59638d[_0xce93('0x3d')],function(_0x3a6c1a){var _0x1db032={};_0x1db032[_0x3a6c1a]={'$like':'%'+_0x45e7b8[_0xce93('0x39')][_0xce93('0x46')]+'%'};return _0x1db032;})});}_0x59638d=_[_0xce93('0x48')]({},_0x59638d,_0x45e7b8[_0xce93('0x49')]);return _0x286688[_0xce93('0x136')](_0x59638d);}})[_0xce93('0x15')](function(_0x346c73){if(_0x346c73){_0x59c629=_0x346c73['length'];if(!_0x45e7b8[_0xce93('0x39')]['hasOwnProperty'](_0xce93('0x41'))){_0x59638d['limit']=qs[_0xce93('0x27')](_0x45e7b8[_0xce93('0x39')]['limit']);_0x59638d[_0xce93('0x24')]=qs['offset'](_0x45e7b8[_0xce93('0x39')][_0xce93('0x24')]);}return _0x286688['getAgents'](_0x59638d);}})[_0xce93('0x15')](function(_0x15e045){if(_0x15e045){return _0x15e045?{'count':_0x59c629,'rows':_0x15e045}:null;}})['then'](respondWithResult(_0x4c2a1e,null))[_0xce93('0x1f')](handleError(_0x4c2a1e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c3201ea..ec39e3f 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 _0xe599=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x29bc23,_0x470822){var _0x8116bf=function(_0x40df49){while(--_0x40df49){_0x29bc23['push'](_0x29bc23['shift']());}};_0x8116bf(++_0x470822);}(_0xe599,0x1e5));var _0x9e59=function(_0x4ca3d6,_0x48e3ae){_0x4ca3d6=_0x4ca3d6-0x0;var _0x117506=_0xe599[_0x4ca3d6];return _0x117506;};'use strict';var EventEmitter=require(_0x9e59('0x0'));var ChatWebsite=require(_0x9e59('0x1'))['db'][_0x9e59('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9e59('0x3')](0x0);var events={'afterCreate':_0x9e59('0x4'),'afterUpdate':_0x9e59('0x5'),'afterDestroy':_0x9e59('0x6')};function emitEvent(_0x296a98){return function(_0x3b40cc,_0x568c08,_0x156af6){ChatWebsiteEvents[_0x9e59('0x7')](_0x296a98+':'+_0x3b40cc['id'],_0x3b40cc);ChatWebsiteEvents['emit'](_0x296a98,_0x3b40cc);_0x156af6(null);};}for(var e in events){if(events[_0x9e59('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9e59('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6753=['../../mysqldb','ChatWebsite','setMaxListeners','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x6753,0xa1));var _0x3675=function(_0x343113,_0x3c73ca){_0x343113=_0x343113-0x0;var _0x586d2b=_0x6753[_0x343113];return _0x586d2b;};'use strict';var EventEmitter=require(_0x3675('0x0'));var ChatWebsite=require(_0x3675('0x1'))['db'][_0x3675('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3675('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3675('0x4'),'afterDestroy':_0x3675('0x5')};function emitEvent(_0x5966cb){return function(_0x2c892a,_0x2b2c83,_0x5bc3f8){ChatWebsiteEvents['emit'](_0x5966cb+':'+_0x2c892a['id'],_0x2c892a);ChatWebsiteEvents['emit'](_0x5966cb,_0x2c892a);_0x5bc3f8(null);};}for(var e in events){if(events[_0x3675('0x6')](e)){var event=events[e];ChatWebsite[_0x3675('0x7')](e,emitEvent(event));}}module[_0x3675('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1a78889..89a3da2 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 _0x9fe0=['ChatWebsite','chat_websites','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x553870,_0x247a0d){var _0x406fa4=function(_0x3ee467){while(--_0x3ee467){_0x553870['push'](_0x553870['shift']());}};_0x406fa4(++_0x247a0d);}(_0x9fe0,0x7b));var _0x09fe=function(_0x45ce62,_0x1b1631){_0x45ce62=_0x45ce62-0x0;var _0x2d5b0e=_0x9fe0[_0x45ce62];return _0x2d5b0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x09fe('0x0'))(_0x09fe('0x1'));var moment=require(_0x09fe('0x2'));var BPromise=require(_0x09fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09fe('0x4'));var config=require(_0x09fe('0x5'));var attributes=require(_0x09fe('0x6'));module[_0x09fe('0x7')]=function(_0x5e2622,_0x202979){return _0x5e2622[_0x09fe('0x8')](_0x09fe('0x9'),attributes,{'tableName':_0x09fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf935=['moment','request-promise','path','rimraf','./chatWebsite.attributes','define','chat_websites','util','../../config/logger'];(function(_0xeb54bb,_0x2d8002){var _0x4d430f=function(_0x16bdd3){while(--_0x16bdd3){_0xeb54bb['push'](_0xeb54bb['shift']());}};_0x4d430f(++_0x2d8002);}(_0xf935,0x1ed));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x5f93('0x0'));var logger=require(_0x5f93('0x1'))('api');var moment=require(_0x5f93('0x2'));var BPromise=require('bluebird');var rp=require(_0x5f93('0x3'));var fs=require('fs');var path=require(_0x5f93('0x4'));var rimraf=require(_0x5f93('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f93('0x6'));module['exports']=function(_0x22221b,_0x131330){return _0x22221b[_0x5f93('0x7')]('ChatWebsite',attributes,{'tableName':_0x5f93('0x8'),'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 4f4dbbd..e8cf81d 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 _0x0df5=['rpc','jayson/promise','client','http','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x48935f,_0x534032){var _0xc8e4c6=function(_0x5737b7){while(--_0x5737b7){_0x48935f['push'](_0x48935f['shift']());}};_0xc8e4c6(++_0x534032);}(_0x0df5,0xaf));var _0x50df=function(_0x1f8f0a,_0x52a210){_0x1f8f0a=_0x1f8f0a-0x0;var _0x5b32e4=_0x0df5[_0x1f8f0a];return _0x5b32e4;};'use strict';var _=require('lodash');var util=require(_0x50df('0x0'));var moment=require(_0x50df('0x1'));var BPromise=require(_0x50df('0x2'));var rs=require(_0x50df('0x3'));var fs=require('fs');var Redis=require(_0x50df('0x4'));var db=require(_0x50df('0x5'))['db'];var utils=require(_0x50df('0x6'));var logger=require('../../config/logger')(_0x50df('0x7'));var config=require('../../config/environment');var jayson=require(_0x50df('0x8'));var client=jayson[_0x50df('0x9')][_0x50df('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x50df('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x50df('0xc'))(new Redis(config[_0x50df('0xb')]));require(_0x50df('0xd'))[_0x50df('0xe')](socket);function respondWithRpcPromise(_0x4955df,_0x2a1e87,_0x33903d){return new BPromise(function(_0xf11104,_0x458f7c){return client[_0x50df('0xf')](_0x4955df,_0x33903d)[_0x50df('0x10')](function(_0x4e3f9a){logger[_0x50df('0x11')](_0x50df('0x12'),_0x2a1e87,'request\x20sent');logger[_0x50df('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2a1e87,'request\x20sent',JSON[_0x50df('0x14')](_0x4e3f9a));if(_0x4e3f9a[_0x50df('0x15')]){if(_0x4e3f9a[_0x50df('0x15')]['code']===0x1f4){logger[_0x50df('0x15')](_0x50df('0x12'),_0x2a1e87,_0x4e3f9a[_0x50df('0x15')][_0x50df('0x16')]);return _0x458f7c(_0x4e3f9a[_0x50df('0x15')][_0x50df('0x16')]);}logger[_0x50df('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x2a1e87,_0x4e3f9a[_0x50df('0x15')][_0x50df('0x16')]);return _0xf11104(_0x4e3f9a[_0x50df('0x15')]['message']);}else{logger['info'](_0x50df('0x12'),_0x2a1e87,_0x50df('0x17'));_0xf11104(_0x4e3f9a[_0x50df('0x18')][_0x50df('0x16')]);}})[_0x50df('0x19')](function(_0x1f0f71){logger[_0x50df('0x15')](_0x50df('0x12'),_0x2a1e87,_0x1f0f71);_0x458f7c(_0x1f0f71);});});} \ No newline at end of file +var _0xcec3=['result','catch','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x146fc2,_0x132e53){var _0x38154f=function(_0xa9cb29){while(--_0xa9cb29){_0x146fc2['push'](_0x146fc2['shift']());}};_0x38154f(++_0x132e53);}(_0xcec3,0xd1));var _0x3cec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcec3[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x3cec('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3cec('0x1'));var fs=require('fs');var Redis=require(_0x3cec('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3cec('0x3'))(_0x3cec('0x4'));var config=require('../../config/environment');var jayson=require(_0x3cec('0x5'));var client=jayson[_0x3cec('0x6')][_0x3cec('0x7')]({'port':0x232a});config[_0x3cec('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3cec('0x9'))(new Redis(config[_0x3cec('0x8')]));require(_0x3cec('0xa'))[_0x3cec('0xb')](socket);function respondWithRpcPromise(_0x302ae0,_0x57002e,_0x1d276c){return new BPromise(function(_0x2fdd00,_0x465781){return client[_0x3cec('0xc')](_0x302ae0,_0x1d276c)[_0x3cec('0xd')](function(_0x6d5d5c){logger['info'](_0x3cec('0xe'),_0x57002e,_0x3cec('0xf'));logger['debug'](_0x3cec('0x10'),_0x57002e,_0x3cec('0xf'),JSON[_0x3cec('0x11')](_0x6d5d5c));if(_0x6d5d5c[_0x3cec('0x12')]){if(_0x6d5d5c[_0x3cec('0x12')][_0x3cec('0x13')]===0x1f4){logger[_0x3cec('0x12')](_0x3cec('0xe'),_0x57002e,_0x6d5d5c[_0x3cec('0x12')]['message']);return _0x465781(_0x6d5d5c[_0x3cec('0x12')]['message']);}logger[_0x3cec('0x12')](_0x3cec('0xe'),_0x57002e,_0x6d5d5c['error'][_0x3cec('0x14')]);return _0x2fdd00(_0x6d5d5c['error'][_0x3cec('0x14')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x57002e,'request\x20sent');_0x2fdd00(_0x6d5d5c[_0x3cec('0x15')][_0x3cec('0x14')]);}})[_0x3cec('0x16')](function(_0x52caef){logger['error'](_0x3cec('0xe'),_0x57002e,_0x52caef);_0x465781(_0x52caef);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index cacb637..fba8ea8 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 _0x5633=['chatWebsite:','./chatWebsite.events','save','update','emit','removeListener','register','length'];(function(_0x69555a,_0x5f0c36){var _0x5c9b69=function(_0xa4f5ff){while(--_0xa4f5ff){_0x69555a['push'](_0x69555a['shift']());}};_0x5c9b69(++_0x5f0c36);}(_0x5633,0x121));var _0x3563=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5633[_0x36eaaa];return _0x461349;};'use strict';var ChatWebsiteEvents=require(_0x3563('0x0'));var events=[_0x3563('0x1'),'remove',_0x3563('0x2')];function createListener(_0x4df85,_0x346bd0){return function(_0x4e229b){_0x346bd0[_0x3563('0x3')](_0x4df85,_0x4e229b);};}function removeListener(_0x237de0,_0x36f937){return function(){ChatWebsiteEvents[_0x3563('0x4')](_0x237de0,_0x36f937);};}exports[_0x3563('0x5')]=function(_0x2a6f2d){for(var _0x3c81c7=0x0,_0x4eb8e6=events[_0x3563('0x6')];_0x3c81c7<_0x4eb8e6;_0x3c81c7++){var _0xfb3507=events[_0x3c81c7];var _0x109dad=createListener(_0x3563('0x7')+_0xfb3507,_0x2a6f2d);ChatWebsiteEvents['on'](_0xfb3507,_0x109dad);}}; \ No newline at end of file +var _0x4f50=['chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f50,0x123));var _0x04f5=function(_0x558f9c,_0x1dee8b){_0x558f9c=_0x558f9c-0x0;var _0x5122ee=_0x4f50[_0x558f9c];return _0x5122ee;};'use strict';var ChatWebsiteEvents=require(_0x04f5('0x0'));var events=[_0x04f5('0x1'),_0x04f5('0x2'),_0x04f5('0x3')];function createListener(_0x2c2f3c,_0x3134ea){return function(_0x4c8a48){_0x3134ea['emit'](_0x2c2f3c,_0x4c8a48);};}function removeListener(_0x1bc6f4,_0x49cff7){return function(){ChatWebsiteEvents['removeListener'](_0x1bc6f4,_0x49cff7);};}exports['register']=function(_0x5919d6){for(var _0x3dbeb2=0x0,_0x46948f=events['length'];_0x3dbeb2<_0x46948f;_0x3dbeb2++){var _0x47a28b=events[_0x3dbeb2];var _0xbeb9f7=createListener(_0x04f5('0x4')+_0x47a28b,_0x5919d6);ChatWebsiteEvents['on'](_0x47a28b,_0xbeb9f7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index be54f05..728f564 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 _0xa4ef=['replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','/:id/users','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','file','addLogo','root','server/files/images/avatars/','now','single','addAvatar','originalname','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','offline-chat','ensureDir'];(function(_0x3cb4c7,_0xf4a50e){var _0x3c6060=function(_0xbea008){while(--_0xbea008){_0x3cb4c7['push'](_0x3cb4c7['shift']());}};_0x3c6060(++_0xf4a50e);}(_0xa4ef,0xee));var _0xfa4e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa4ef[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xfa4e('0x0'));var util=require(_0xfa4e('0x1'));var path=require(_0xfa4e('0x2'));var timeout=require(_0xfa4e('0x3'));var express=require(_0xfa4e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa4e('0x6'));var controller=require(_0xfa4e('0x7'));router[_0xfa4e('0x8')]('/',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0xa')]);router[_0xfa4e('0x8')](_0xfa4e('0xb'),auth[_0xfa4e('0x9')](),controller['describe']);router['get']('/:id',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0xc')]);router[_0xfa4e('0x8')](_0xfa4e('0xd'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0xe')]);router[_0xfa4e('0x8')](_0xfa4e('0xf'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x10')]);router[_0xfa4e('0x8')](_0xfa4e('0x11'),controller[_0xfa4e('0x12')]);router[_0xfa4e('0x8')](_0xfa4e('0x13'),controller[_0xfa4e('0x14')]);router[_0xfa4e('0x8')]('/:id/customer_avatar',controller[_0xfa4e('0x15')]);router[_0xfa4e('0x8')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0xfa4e('0x8')]('/:id/interactions',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x16')]);router[_0xfa4e('0x8')](_0xfa4e('0x17'),controller[_0xfa4e('0x18')]);router['get']('/:id/applications',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x19')]);router[_0xfa4e('0x8')](_0xfa4e('0x1a'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x1b')]);router[_0xfa4e('0x8')]('/:id/fields',controller[_0xfa4e('0x1c')]);router[_0xfa4e('0x8')](_0xfa4e('0x1d'),auth[_0xfa4e('0x9')](),controller['getOfflineMessages']);router[_0xfa4e('0x8')](_0xfa4e('0x1e'),auth[_0xfa4e('0x9')](),controller['getAgents']);router[_0xfa4e('0x1f')]('/',auth[_0xfa4e('0x9')](),controller['create']);router[_0xfa4e('0x1f')](_0xfa4e('0xd'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x20')]);router[_0xfa4e('0x1f')](_0xfa4e('0xf'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x21')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0x15d93d,_0x3d5837,_0x474078){_0x474078(null,path[_0xfa4e('0x23')](config['root'],_0xfa4e('0x24')));},'filename':function(_0x394678,_0x37a27f,_0xeef2c){_0xeef2c(null,util[_0xfa4e('0x25')](_0xfa4e('0x26'),Date['now'](),_0x37a27f['originalname']));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x11'),upload['single'](_0xfa4e('0x27')),controller[_0xfa4e('0x28')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0xeeec03,_0x4bfdb0,_0x1e6b84){_0x1e6b84(null,path[_0xfa4e('0x23')](config[_0xfa4e('0x29')],_0xfa4e('0x2a')));},'filename':function(_0xa141a3,_0xea5d4f,_0x5cd3f8){_0x5cd3f8(null,util[_0xfa4e('0x25')]('%s-%s',Date[_0xfa4e('0x2b')](),_0xea5d4f['originalname']));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x13'),upload[_0xfa4e('0x2c')](_0xfa4e('0x27')),controller[_0xfa4e('0x2d')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0x56c8f1,_0x39144d,_0x58d70b){_0x58d70b(null,path[_0xfa4e('0x23')](config[_0xfa4e('0x29')],_0xfa4e('0x2a')));},'filename':function(_0x2bb059,_0xcdb8a6,_0x252f06){_0x252f06(null,util[_0xfa4e('0x25')](_0xfa4e('0x26'),Date[_0xfa4e('0x2b')](),_0xcdb8a6[_0xfa4e('0x2e')]));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x2f'),upload[_0xfa4e('0x2c')](_0xfa4e('0x27')),controller[_0xfa4e('0x30')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0x3df91a,_0x84b6c5,_0x44ea68){_0x44ea68(null,path[_0xfa4e('0x23')](config['root'],_0xfa4e('0x2a')));},'filename':function(_0x1f42ba,_0x4341fd,_0x309996){_0x309996(null,util['format'](_0xfa4e('0x26'),Date['now'](),_0x4341fd['originalname']));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x31'),upload[_0xfa4e('0x2c')](_0xfa4e('0x27')),controller[_0xfa4e('0x32')]);router['post'](_0xfa4e('0x33'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x33906f,_0x3f2131,_0x3aaaaf){const _0x31888d=path[_0xfa4e('0x23')](config['root'],'server/files','attachments',_0xfa4e('0x34'));fs_extra[_0xfa4e('0x35')](_0x31888d,function(){_0x3aaaaf(null,_0x31888d);});},'filename':function(_0x2b0fdc,_0x4c0aad,_0x5f2035){const _0x4ae65e=_0x4c0aad['originalname'][_0xfa4e('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1f9113=path[_0xfa4e('0x37')](_0x4ae65e);const _0x7dfc64=Date['now']()+'-'+_0x4ae65e[_0xfa4e('0x36')](_0x1f9113,'')+_0x1f9113;_0x5f2035(null,_0x7dfc64);}})});router[_0xfa4e('0x1f')](_0xfa4e('0x38'),offlineUploadMulter[_0xfa4e('0x39')](),controller[_0xfa4e('0x3a')]);router[_0xfa4e('0x1f')](_0xfa4e('0x3b'),auth['isAuthenticated'](),controller[_0xfa4e('0x3c')]);router[_0xfa4e('0x1f')](_0xfa4e('0x3d'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x3e')]);router[_0xfa4e('0x1f')](_0xfa4e('0x1a'),auth['isAuthenticated'](),controller[_0xfa4e('0x3f')]);router['post'](_0xfa4e('0x1e'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x40')]);router[_0xfa4e('0x41')]('/:id',auth['isAuthenticated'](),controller[_0xfa4e('0x42')]);router[_0xfa4e('0x43')]('/:id',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x44')]);router[_0xfa4e('0x43')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xfa4e('0x45')]);router['delete'](_0xfa4e('0xf'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x46')]);router['delete'](_0xfa4e('0x1e'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x47')]);module[_0xfa4e('0x48')]=router; \ No newline at end of file +var _0x07fb=['/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','file','addLogo','now','/:id/avatar','single','addAvatar','server/files/images/avatars/','diskStorage','originalname','/:id/system_avatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07fb,0x163));var _0xb07f=function(_0x21f089,_0x5ebacd){_0x21f089=_0x21f089-0x0;var _0x59c5e7=_0x07fb[_0x21f089];return _0x59c5e7;};'use strict';var multer=require(_0xb07f('0x0'));var util=require(_0xb07f('0x1'));var path=require('path');var timeout=require(_0xb07f('0x2'));var express=require(_0xb07f('0x3'));var router=express[_0xb07f('0x4')]();var fs_extra=require(_0xb07f('0x5'));var auth=require(_0xb07f('0x6'));var interaction=require(_0xb07f('0x7'));var config=require(_0xb07f('0x8'));var controller=require(_0xb07f('0x9'));router[_0xb07f('0xa')]('/',auth[_0xb07f('0xb')](),controller[_0xb07f('0xc')]);router[_0xb07f('0xa')]('/describe',auth[_0xb07f('0xb')](),controller[_0xb07f('0xd')]);router[_0xb07f('0xa')](_0xb07f('0xe'),auth[_0xb07f('0xb')](),controller[_0xb07f('0xf')]);router['get'](_0xb07f('0x10'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x11')]);router[_0xb07f('0xa')](_0xb07f('0x12'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x13')]);router[_0xb07f('0xa')](_0xb07f('0x14'),controller[_0xb07f('0x15')]);router['get']('/:id/avatar',controller[_0xb07f('0x16')]);router[_0xb07f('0xa')](_0xb07f('0x17'),controller['getCustomerAvatar']);router[_0xb07f('0xa')]('/:id/system_avatar',controller[_0xb07f('0x18')]);router[_0xb07f('0xa')](_0xb07f('0x19'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x1a')]);router[_0xb07f('0xa')](_0xb07f('0x1b'),controller[_0xb07f('0x1c')]);router['get'](_0xb07f('0x1d'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x1e')]);router[_0xb07f('0xa')](_0xb07f('0x1f'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x20')]);router['get'](_0xb07f('0x21'),controller['getFields']);router[_0xb07f('0xa')](_0xb07f('0x22'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xb07f('0xa')](_0xb07f('0x23'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x24')]);router[_0xb07f('0x25')]('/',auth[_0xb07f('0xb')](),controller[_0xb07f('0x26')]);router[_0xb07f('0x25')](_0xb07f('0x10'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x27')]);router[_0xb07f('0x25')]('/:id/canned_answers',auth[_0xb07f('0xb')](),controller[_0xb07f('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20a673,_0x354edd,_0x335b22){_0x335b22(null,path[_0xb07f('0x29')](config[_0xb07f('0x2a')],_0xb07f('0x2b')));},'filename':function(_0x2fa33f,_0x39850a,_0x4dda97){_0x4dda97(null,util[_0xb07f('0x2c')](_0xb07f('0x2d'),Date['now'](),_0x39850a['originalname']));}})});router[_0xb07f('0x25')](_0xb07f('0x14'),upload['single'](_0xb07f('0x2e')),controller[_0xb07f('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x941938,_0x56b146,_0x2ecd40){_0x2ecd40(null,path[_0xb07f('0x29')](config[_0xb07f('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x40a4a8,_0xf6e534,_0x32cc8f){_0x32cc8f(null,util[_0xb07f('0x2c')]('%s-%s',Date[_0xb07f('0x30')](),_0xf6e534['originalname']));}})});router[_0xb07f('0x25')](_0xb07f('0x31'),upload[_0xb07f('0x32')](_0xb07f('0x2e')),controller[_0xb07f('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x389d7a,_0x162f4b,_0x1a52af){_0x1a52af(null,path[_0xb07f('0x29')](config[_0xb07f('0x2a')],_0xb07f('0x34')));},'filename':function(_0x4fbbb2,_0x4bbf52,_0xef1aab){_0xef1aab(null,util['format'](_0xb07f('0x2d'),Date[_0xb07f('0x30')](),_0x4bbf52['originalname']));}})});router['post'](_0xb07f('0x17'),upload[_0xb07f('0x32')](_0xb07f('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xb07f('0x35')]({'destination':function(_0x1df108,_0x5dcabe,_0x4c9a10){_0x4c9a10(null,path[_0xb07f('0x29')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x31a520,_0x5f54fa,_0x3b2bed){_0x3b2bed(null,util[_0xb07f('0x2c')](_0xb07f('0x2d'),Date[_0xb07f('0x30')](),_0x5f54fa[_0xb07f('0x36')]));}})});router[_0xb07f('0x25')](_0xb07f('0x37'),upload[_0xb07f('0x32')](_0xb07f('0x2e')),controller[_0xb07f('0x38')]);router['post']('/:id/notify',controller[_0xb07f('0x39')]);const offlineUploadMulter=multer({'storage':multer[_0xb07f('0x35')]({'destination':function(_0x1d15fb,_0x29ff20,_0x50dea0){const _0x30dfba=path[_0xb07f('0x29')](config[_0xb07f('0x2a')],_0xb07f('0x3a'),_0xb07f('0x3b'),_0xb07f('0x3c'));fs_extra[_0xb07f('0x3d')](_0x30dfba,function(){_0x50dea0(null,_0x30dfba);});},'filename':function(_0x5acb8e,_0x55201b,_0x52d2d8){const _0x2816a4=_0x55201b[_0xb07f('0x36')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1072d6=path[_0xb07f('0x3e')](_0x2816a4);const _0x321e77=Date[_0xb07f('0x30')]()+'-'+_0x2816a4['replace'](_0x1072d6,'')+_0x1072d6;_0x52d2d8(null,_0x321e77);}})});router[_0xb07f('0x25')](_0xb07f('0x3f'),offlineUploadMulter[_0xb07f('0x40')](),controller[_0xb07f('0x41')]);router[_0xb07f('0x25')]('/:id/interactions',auth[_0xb07f('0xb')](),controller[_0xb07f('0x42')]);router[_0xb07f('0x25')](_0xb07f('0x1d'),auth[_0xb07f('0xb')](),controller['addApplications']);router['post'](_0xb07f('0x1f'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x43')]);router[_0xb07f('0x25')](_0xb07f('0x23'),auth['isAuthenticated'](),controller[_0xb07f('0x44')]);router[_0xb07f('0x45')](_0xb07f('0xe'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x46')]);router[_0xb07f('0x47')](_0xb07f('0xe'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x48')]);router[_0xb07f('0x47')](_0xb07f('0x10'),auth['isAuthenticated'](),controller[_0xb07f('0x49')]);router['delete'](_0xb07f('0x12'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xb07f('0x47')](_0xb07f('0x23'),auth[_0xb07f('0xb')](),controller[_0xb07f('0x4a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 79a07a1..8fee3bd 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 _0x7920=['Client-Side\x20logger\x20not\x20found!','/client-logs','exports','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7920,0x19a));var _0x0792=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7920[_0x1a36a5];return _0x746243;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x0792('0x0'));var config=require(_0x0792('0x1'));var router=express[_0x0792('0x2')]();var isProduction=config[_0x0792('0x3')]===_0x0792('0x4')||![];function clientSideLogs(_0xa82dc5,_0xe45935,_0x5d3a12){var _0x4d61f3=_0xa82dc5[_0x0792('0x5')][_0x0792('0x6')](_0x0792('0x7'));if(!_0x4d61f3){throw new Error(_0x0792('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x0792('0x9'),'logger':_0x4d61f3,'enableCors':!isProduction})(_0xa82dc5,_0xe45935,_0x5d3a12);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x0792('0xa')]=router; \ No newline at end of file +var _0x1b31=['exports','beaver-logger/server','express','../config/environment','Router','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x1b31,0xc7));var _0x11b3=function(_0x17c5e6,_0x35cb81){_0x17c5e6=_0x17c5e6-0x0;var _0x5c0f0c=_0x1b31[_0x17c5e6];return _0x5c0f0c;};var beaverLogger=require(_0x11b3('0x0'));var express=require(_0x11b3('0x1'));var auth=require('../components/auth/service');var config=require(_0x11b3('0x2'));var router=express[_0x11b3('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x1d0ba3,_0x3ea25e,_0x3f81ea){var _0x4cbb11=_0x1d0ba3['app'][_0x11b3('0x4')](_0x11b3('0x5'));if(!_0x4cbb11){throw new Error(_0x11b3('0x6'));}return beaverLogger[_0x11b3('0x7')]({'uri':_0x11b3('0x8'),'logger':_0x4cbb11,'enableCors':!isProduction})(_0x1d0ba3,_0x3ea25e,_0x3f81ea);}router[_0x11b3('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x11b3('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 71ac0d6..d3abebf 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 _0x5502=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x1dbaf1,_0x16ae3b){var _0x3bcc08=function(_0x4ec701){while(--_0x4ec701){_0x1dbaf1['push'](_0x1dbaf1['shift']());}};_0x3bcc08(++_0x16ae3b);}(_0x5502,0x7b));var _0x2550=function(_0xb6cc07,_0x3ef661){_0xb6cc07=_0xb6cc07-0x0;var _0x5c8c21=_0x5502[_0xb6cc07];return _0x5c8c21;};'use strict';var Sequelize=require(_0x2550('0x0'));module[_0x2550('0x1')]={'name':{'type':Sequelize[_0x2550('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2550('0x3')](_0x2550('0x4'),_0x2550('0x5'),_0x2550('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x2550('0x3')](_0x2550('0x7'),_0x2550('0x8'))},'data1':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0x9')},'data2':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0xa')},'data3':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0xb')},'data4':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0xc')},'data5':{'type':Sequelize[_0x2550('0xd')],'comment':_0x2550('0xe')},'data6':{'type':Sequelize[_0x2550('0xd')],'comment':_0x2550('0xf')},'data7':{'type':Sequelize['TEXT'],'comment':_0x2550('0x10')}}; \ No newline at end of file +var _0xce6c=['exports','STRING','AmazonAWS','Google','ENUM','Outlook365','Dynamics365','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'];(function(_0xcadac8,_0x17c02f){var _0x4dded6=function(_0x2660a0){while(--_0x2660a0){_0xcadac8['push'](_0xcadac8['shift']());}};_0x4dded6(++_0x17c02f);}(_0xce6c,0x11d));var _0xcce6=function(_0x3280c2,_0x3e1a74){_0x3280c2=_0x3280c2-0x0;var _0xf9fc14=_0xce6c[_0x3280c2];return _0xf9fc14;};'use strict';var Sequelize=require('sequelize');module[_0xcce6('0x0')]={'name':{'type':Sequelize[_0xcce6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xcce6('0x2'),_0xcce6('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xcce6('0x4')](_0xcce6('0x5'),_0xcce6('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xcce6('0x7')},'data2':{'type':Sequelize[_0xcce6('0x1')],'comment':_0xcce6('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0xcce6('0x9')},'data4':{'type':Sequelize[_0xcce6('0x1')],'comment':_0xcce6('0xa')},'data5':{'type':Sequelize[_0xcce6('0xb')],'comment':_0xcce6('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0xcce6('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0xcce6('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0c3a465..9e8c1fd 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 _0x81ad=['join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','Invalid\x20state\x20parameter','parse','from','state','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/encryptor','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','find','decryptString','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'];(function(_0x4b368a,_0x5e4556){var _0x1e16fb=function(_0x4ab059){while(--_0x4ab059){_0x4b368a['push'](_0x4b368a['shift']());}};_0x1e16fb(++_0x5e4556);}(_0x81ad,0xdf));var _0xd81a=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x81ad[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0xd81a('0x0'));var Redis=require(_0xd81a('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xd81a('0x2'));var config=require('../../config/environment');var logger=require(_0xd81a('0x3'))('api');var db=require(_0xd81a('0x4'))['db'];var oauth=require(_0xd81a('0x5'));config[_0xd81a('0x6')]=_[_0xd81a('0x7')](config[_0xd81a('0x6')],{'host':_0xd81a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4a7a4f,_0x1feb24){_0x1feb24=_0x1feb24||0xcc;return function(_0x10b1b6){if(_0x10b1b6){return _0x4a7a4f[_0xd81a('0x9')](_0x1feb24);}return _0x4a7a4f[_0xd81a('0xa')](_0x1feb24)[_0xd81a('0xb')]();};}function respondWithResult(_0x33ec2c,_0x4f6655){_0x4f6655=_0x4f6655||0xc8;return function(_0xd3b543){if(_0xd3b543){return _0x33ec2c[_0xd81a('0xa')](_0x4f6655)[_0xd81a('0xc')](_0xd3b543);}};}function respondWithFilteredResult(_0x19de1a,_0x1e0124){return function(_0x1ddcb4){if(_0x1ddcb4){var _0x79614b=typeof _0x1e0124[_0xd81a('0xd')]===_0xd81a('0xe')&&typeof _0x1e0124[_0xd81a('0xf')]===_0xd81a('0xe');var _0x2f4ae8=_0x1ddcb4[_0xd81a('0x10')];var _0x5f2fba=_0x79614b?0x0:_0x1e0124[_0xd81a('0xd')];var _0xaa87fb=_0x79614b?_0x1ddcb4['count']:_0x1e0124[_0xd81a('0xd')]+_0x1e0124[_0xd81a('0xf')];var _0x4262a3;if(_0xaa87fb>=_0x2f4ae8){_0xaa87fb=_0x2f4ae8;_0x4262a3=0xc8;}else{_0x4262a3=0xce;}_0x19de1a['status'](_0x4262a3);return _0x19de1a[_0xd81a('0x11')](_0xd81a('0x12'),_0x5f2fba+'-'+_0xaa87fb+'/'+_0x2f4ae8)[_0xd81a('0xc')](_0x1ddcb4);}return null;};}function saveUpdates(_0x508b78){return function(_0x335345){if(_0x335345){return _0x335345[_0xd81a('0x13')](_0x508b78)[_0xd81a('0x14')](function(_0x14dfe4){return _0x14dfe4;});}return null;};}function removeEntity(_0x2faa06){return function(_0x5d48e4){if(_0x5d48e4){return _0x5d48e4[_0xd81a('0x15')]()[_0xd81a('0x14')](function(){_0x2faa06[_0xd81a('0xa')](0xcc)[_0xd81a('0xb')]();});}};}function handleEntityNotFound(_0x3a5e1c){return function(_0x45f993){if(!_0x45f993){_0x3a5e1c[_0xd81a('0x9')](0x194);}return _0x45f993;};}function handleError(_0x1e5188,_0x4afcac){_0x4afcac=_0x4afcac||0x1f4;return function(_0x172247){logger[_0xd81a('0x16')](_0x172247[_0xd81a('0x17')]);if(_0x172247[_0xd81a('0x18')]){delete _0x172247[_0xd81a('0x18')];}_0x1e5188['status'](_0x4afcac)['send'](_0x172247);};}function maskClientSecret(_0x4d429f){return _[_0xd81a('0x19')](_0x4d429f[_0xd81a('0x1a')](0x0,0x3),0x14,'*');}exports[_0xd81a('0x1b')]=function(_0x336a42,_0x340eac){var _0x4ab3cb={},_0x14bcbb={},_0x24ba29={'count':0x0,'rows':[]};var _0x99697d=_[_0xd81a('0x1c')](db[_0xd81a('0x1d')][_0xd81a('0x1e')],function(_0x3bca33){return{'name':_0x3bca33[_0xd81a('0x1f')],'type':_0x3bca33['type'][_0xd81a('0x20')]};});_0x14bcbb['model']=_[_0xd81a('0x1c')](_0x99697d,_0xd81a('0x18'));_0x14bcbb[_0xd81a('0x21')]=_[_0xd81a('0x22')](_0x336a42['query']);_0x14bcbb[_0xd81a('0x23')]=_[_0xd81a('0x24')](_0x14bcbb[_0xd81a('0x25')],_0x14bcbb[_0xd81a('0x21')]);_0x4ab3cb[_0xd81a('0x26')]=_[_0xd81a('0x24')](_0x14bcbb[_0xd81a('0x25')],qs[_0xd81a('0x27')](_0x336a42[_0xd81a('0x21')][_0xd81a('0x27')]));_0x4ab3cb[_0xd81a('0x26')]=_0x4ab3cb[_0xd81a('0x26')][_0xd81a('0x28')]?_0x4ab3cb[_0xd81a('0x26')]:_0x14bcbb[_0xd81a('0x25')];if(!_0x336a42['query'][_0xd81a('0x29')](_0xd81a('0x2a'))){_0x4ab3cb[_0xd81a('0xf')]=qs[_0xd81a('0xf')](_0x336a42['query'][_0xd81a('0xf')]);_0x4ab3cb[_0xd81a('0xd')]=qs[_0xd81a('0xd')](_0x336a42[_0xd81a('0x21')]['offset']);}_0x4ab3cb['order']=qs[_0xd81a('0x2b')](_0x336a42[_0xd81a('0x21')][_0xd81a('0x2b')]);_0x4ab3cb[_0xd81a('0x2c')]=qs['filters'](_[_0xd81a('0x2d')](_0x336a42[_0xd81a('0x21')],_0x14bcbb[_0xd81a('0x23')]),_0x99697d);if(_0x336a42[_0xd81a('0x21')][_0xd81a('0x2e')]){_0x4ab3cb[_0xd81a('0x2c')]=_['merge'](_0x4ab3cb['where'],{'$or':_['map'](_0x99697d,function(_0x2ebd87){if(_0x2ebd87[_0xd81a('0x2f')]!==_0xd81a('0x30')){var _0x52f763={};_0x52f763[_0x2ebd87[_0xd81a('0x18')]]={'$like':'%'+_0x336a42[_0xd81a('0x21')]['filter']+'%'};return _0x52f763;}})});}_0x4ab3cb=_[_0xd81a('0x31')]({},_0x4ab3cb,_0x336a42['options']);var _0xeb1e61={'where':_0x4ab3cb[_0xd81a('0x2c')]};return db[_0xd81a('0x1d')][_0xd81a('0x10')](_0xeb1e61)['then'](function(_0x45a46b){_0x24ba29[_0xd81a('0x10')]=_0x45a46b;if(_0x336a42[_0xd81a('0x21')][_0xd81a('0x32')]){_0x4ab3cb[_0xd81a('0x33')]=[{'all':!![]}];}return db[_0xd81a('0x1d')][_0xd81a('0x34')](_0x4ab3cb);})[_0xd81a('0x14')](function(_0x562ae4){_0x24ba29[_0xd81a('0x35')]=_[_0xd81a('0x1c')](_0x562ae4,function(_0x1838bc){if(_0x1838bc[_0xd81a('0x36')]===_0xd81a('0x37')){var _0x497134=encryptor['decryptString'](_0x1838bc[_0xd81a('0x38')]);_0x1838bc[_0xd81a('0x38')]=maskClientSecret(_0x497134);}return _0x1838bc;});return _0x24ba29;})[_0xd81a('0x14')](respondWithFilteredResult(_0x340eac,_0x4ab3cb))[_0xd81a('0x39')](handleError(_0x340eac,null));};exports[_0xd81a('0x3a')]=function(_0x28cb14,_0x8f5f56){var _0x51c27c={'raw':!![],'where':{'id':_0x28cb14[_0xd81a('0x3b')]['id']}},_0x1abced={};_0x1abced[_0xd81a('0x25')]=_[_0xd81a('0x22')](db['CloudProvider'][_0xd81a('0x1e')]);_0x1abced[_0xd81a('0x21')]=_[_0xd81a('0x22')](_0x28cb14[_0xd81a('0x21')]);_0x1abced[_0xd81a('0x23')]=_[_0xd81a('0x24')](_0x1abced['model'],_0x1abced[_0xd81a('0x21')]);_0x51c27c[_0xd81a('0x26')]=_[_0xd81a('0x24')](_0x1abced[_0xd81a('0x25')],qs['fields'](_0x28cb14[_0xd81a('0x21')][_0xd81a('0x27')]));_0x51c27c['attributes']=_0x51c27c['attributes']['length']?_0x51c27c[_0xd81a('0x26')]:_0x1abced['model'];if(_0x28cb14[_0xd81a('0x21')][_0xd81a('0x32')]){_0x51c27c['include']=[{'all':!![]}];}_0x51c27c=_['merge']({},_0x51c27c,_0x28cb14['options']);return db[_0xd81a('0x1d')][_0xd81a('0x3c')](_0x51c27c)['then'](handleEntityNotFound(_0x8f5f56,null))[_0xd81a('0x14')](function(_0x453f5a){if(_0x453f5a[_0xd81a('0x36')]==='MicrosoftAzure'){var _0x3c72e1=encryptor[_0xd81a('0x3d')](_0x453f5a[_0xd81a('0x38')]);_0x453f5a[_0xd81a('0x38')]=maskClientSecret(_0x3c72e1);}return _0x453f5a;})[_0xd81a('0x14')](respondWithResult(_0x8f5f56,null))['catch'](handleError(_0x8f5f56,null));};exports['create']=function(_0x462e4d,_0x4fbd6c){if(!_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x18')])throw new Error(_0xd81a('0x3f'));if(!_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x36')])throw new Error(_0xd81a('0x40'));var _0x8e7353=db[_0xd81a('0x1d')][_0xd81a('0x1e')][_0xd81a('0x36')][_0xd81a('0x41')];if(!_0x8e7353[_0xd81a('0x42')](_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x36')]))throw new Error(_0xd81a('0x43')+_0x8e7353[_0xd81a('0x44')](',\x20'));if(_0x462e4d[_0xd81a('0x3e')]['service']===_0xd81a('0x37')&&_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x38')]){_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x38')]=encryptor[_0xd81a('0x45')](_0x462e4d['body']['data3']);}return db[_0xd81a('0x1d')][_0xd81a('0x46')](_0x462e4d['body'],{})[_0xd81a('0x14')](respondWithResult(_0x4fbd6c,0xc9))[_0xd81a('0x39')](handleError(_0x4fbd6c,null));};exports[_0xd81a('0x13')]=function(_0x302a54,_0x3fadba){if(_0x302a54[_0xd81a('0x3e')]['id']){delete _0x302a54[_0xd81a('0x3e')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x302a54[_0xd81a('0x3b')]['id']}})[_0xd81a('0x14')](handleEntityNotFound(_0x3fadba,null))[_0xd81a('0x14')](function(_0x18b7a0){if(_0x18b7a0['service']===_0xd81a('0x37')&&_0x302a54[_0xd81a('0x3e')][_0xd81a('0x38')]){_0x302a54['body'][_0xd81a('0x38')]=encryptor[_0xd81a('0x45')](_0x302a54[_0xd81a('0x3e')][_0xd81a('0x38')]);}return _0x18b7a0;})[_0xd81a('0x14')](saveUpdates(_0x302a54[_0xd81a('0x3e')],null))['then'](respondWithResult(_0x3fadba,null))[_0xd81a('0x39')](handleError(_0x3fadba,null));};exports[_0xd81a('0x15')]=function(_0x2175b5,_0x363ab6){return db[_0xd81a('0x1d')][_0xd81a('0x3c')]({'where':{'id':_0x2175b5['params']['id']}})[_0xd81a('0x14')](handleEntityNotFound(_0x363ab6,null))['then'](removeEntity(_0x363ab6,null))[_0xd81a('0x39')](handleError(_0x363ab6,null));};exports[_0xd81a('0x47')]=function(_0x381c5d,_0x48dbb8){return db[_0xd81a('0x1d')][_0xd81a('0x48')]({'where':{'id':_0x381c5d[_0xd81a('0x3b')]['id']},'raw':!![]})['then'](function(_0x46210a){if(!_0x46210a)return _0x48dbb8['sendStatus'](0x194);return{'url':oauth[_0xd81a('0x49')](_0x46210a,_0x381c5d[_0xd81a('0x4a')]['id'])};})['then'](respondWithResult(_0x48dbb8,null))[_0xd81a('0x39')](handleError(_0x48dbb8,null));};exports['oauth2MicrosoftCallback']=function(_0x479365,_0x1e33f4){var _0x959526=_0x479365[_0xd81a('0x3e')];var _0x370bde;var _0x4b54b4;if(_0x959526['error'])throw _0x959526;redis['get'](_0x959526['state'])[_0xd81a('0x14')](function(_0x503f59){if(!_0x503f59)throw new Error(_0xd81a('0x4b'));_0x370bde=JSON[_0xd81a('0x4c')](_0x503f59);var _0x9edb31=Buffer[_0xd81a('0x4d')](_0x959526[_0xd81a('0x4e')],'base64')[_0xd81a('0x4f')](_0xd81a('0x50'));_0x4b54b4=JSON[_0xd81a('0x4c')](_0x9edb31);if(!oauth['isValidIdToken'](_0x959526[_0xd81a('0x51')],_0x370bde[_0xd81a('0x52')]))throw new Error(_0xd81a('0x53'));redis[_0xd81a('0x54')](_0x959526[_0xd81a('0x4e')]);return oauth[_0xd81a('0x55')](_0x959526[_0xd81a('0x56')],_0x370bde);})[_0xd81a('0x14')](function(_0xc25183){_0x370bde[_0xd81a('0x57')]=_0xc25183[_0xd81a('0x58')];_0x370bde[_0xd81a('0x59')]=_0xc25183[_0xd81a('0x5a')];return db[_0xd81a('0x1d')][_0xd81a('0x13')]({'data5':_0x370bde[_0xd81a('0x57')],'data6':_0x370bde['data6']},{'where':{'id':_0x370bde['id']}});})['then'](function(){oauth[_0xd81a('0x5b')](_0x370bde);socket[_0xd81a('0x5c')](_0xd81a('0x5d'),{'id':_0x4b54b4['id']});return;})['then'](respondWithStatusCode(_0x1e33f4,null))[_0xd81a('0x39')](function(_0x20bfd4){if(_0x4b54b4){socket[_0xd81a('0x5c')](_0xd81a('0x5e'),{'id':_0x4b54b4['id']});}if(!_0x370bde){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x20bfd4);return _0x1e33f4[_0xd81a('0xa')](0x1f4)[_0xd81a('0x5f')](_0x20bfd4['message']);}logger['error'](_0xd81a('0x60'),_0x370bde['id'],JSON['stringify'](_0x20bfd4));});}; \ No newline at end of file +var _0x4502=['microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','status','json','offset','undefined','limit','count','set','update','then','destroy','end','stack','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','keys','include','find','service','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','startRefreshInterval'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x4502,0x69));var _0x2450=function(_0x120514,_0x6cb110){_0x120514=_0x120514-0x0;var _0x1a9ba0=_0x4502[_0x120514];return _0x1a9ba0;};'use strict';var _=require('lodash');var Redis=require(_0x2450('0x0'));var qs=require(_0x2450('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x2450('0x2'));var logger=require(_0x2450('0x3'))(_0x2450('0x4'));var db=require(_0x2450('0x5'))['db'];var oauth=require(_0x2450('0x6'));config[_0x2450('0x7')]=_[_0x2450('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2450('0x9'))(new Redis(config[_0x2450('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x233cfd,_0x561eed){_0x561eed=_0x561eed||0xcc;return function(_0x3ae7ad){if(_0x3ae7ad){return _0x233cfd['sendStatus'](_0x561eed);}return _0x233cfd[_0x2450('0xa')](_0x561eed)['end']();};}function respondWithResult(_0x56532f,_0x174f60){_0x174f60=_0x174f60||0xc8;return function(_0x488029){if(_0x488029){return _0x56532f[_0x2450('0xa')](_0x174f60)[_0x2450('0xb')](_0x488029);}};}function respondWithFilteredResult(_0x5f018c,_0x41a131){return function(_0x64046e){if(_0x64046e){var _0xcec0a8=typeof _0x41a131[_0x2450('0xc')]===_0x2450('0xd')&&typeof _0x41a131[_0x2450('0xe')]==='undefined';var _0x9d567d=_0x64046e[_0x2450('0xf')];var _0x2b331a=_0xcec0a8?0x0:_0x41a131[_0x2450('0xc')];var _0x268404=_0xcec0a8?_0x64046e['count']:_0x41a131[_0x2450('0xc')]+_0x41a131[_0x2450('0xe')];var _0x4cb3fe;if(_0x268404>=_0x9d567d){_0x268404=_0x9d567d;_0x4cb3fe=0xc8;}else{_0x4cb3fe=0xce;}_0x5f018c[_0x2450('0xa')](_0x4cb3fe);return _0x5f018c[_0x2450('0x10')]('Content-Range',_0x2b331a+'-'+_0x268404+'/'+_0x9d567d)[_0x2450('0xb')](_0x64046e);}return null;};}function saveUpdates(_0x528ea4){return function(_0x3d7a9e){if(_0x3d7a9e){return _0x3d7a9e[_0x2450('0x11')](_0x528ea4)[_0x2450('0x12')](function(_0x4e9af1){return _0x4e9af1;});}return null;};}function removeEntity(_0x52a908){return function(_0x1af30e){if(_0x1af30e){return _0x1af30e[_0x2450('0x13')]()['then'](function(){_0x52a908[_0x2450('0xa')](0xcc)[_0x2450('0x14')]();});}};}function handleEntityNotFound(_0x4b4c6e){return function(_0x2e2631){if(!_0x2e2631){_0x4b4c6e['sendStatus'](0x194);}return _0x2e2631;};}function handleError(_0xe6e024,_0x142165){_0x142165=_0x142165||0x1f4;return function(_0x24bae3){logger['error'](_0x24bae3[_0x2450('0x15')]);if(_0x24bae3['name']){delete _0x24bae3['name'];}_0xe6e024[_0x2450('0xa')](_0x142165)['send'](_0x24bae3);};}function maskClientSecret(_0x180a10){return _[_0x2450('0x16')](_0x180a10[_0x2450('0x17')](0x0,0x3),0x14,'*');}exports[_0x2450('0x18')]=function(_0x27f1d1,_0x3b03ec){var _0x365df2={},_0x5d3ea3={},_0x1eb8df={'count':0x0,'rows':[]};var _0x40aafb=_[_0x2450('0x19')](db[_0x2450('0x1a')][_0x2450('0x1b')],function(_0x50b695){return{'name':_0x50b695[_0x2450('0x1c')],'type':_0x50b695[_0x2450('0x1d')][_0x2450('0x1e')]};});_0x5d3ea3[_0x2450('0x1f')]=_[_0x2450('0x19')](_0x40aafb,_0x2450('0x20'));_0x5d3ea3[_0x2450('0x21')]=_['keys'](_0x27f1d1[_0x2450('0x21')]);_0x5d3ea3[_0x2450('0x22')]=_[_0x2450('0x23')](_0x5d3ea3[_0x2450('0x1f')],_0x5d3ea3[_0x2450('0x21')]);_0x365df2['attributes']=_[_0x2450('0x23')](_0x5d3ea3[_0x2450('0x1f')],qs[_0x2450('0x24')](_0x27f1d1[_0x2450('0x21')]['fields']));_0x365df2['attributes']=_0x365df2[_0x2450('0x25')][_0x2450('0x26')]?_0x365df2[_0x2450('0x25')]:_0x5d3ea3['model'];if(!_0x27f1d1[_0x2450('0x21')][_0x2450('0x27')](_0x2450('0x28'))){_0x365df2[_0x2450('0xe')]=qs['limit'](_0x27f1d1[_0x2450('0x21')][_0x2450('0xe')]);_0x365df2[_0x2450('0xc')]=qs[_0x2450('0xc')](_0x27f1d1[_0x2450('0x21')][_0x2450('0xc')]);}_0x365df2[_0x2450('0x29')]=qs[_0x2450('0x2a')](_0x27f1d1[_0x2450('0x21')][_0x2450('0x2a')]);_0x365df2[_0x2450('0x2b')]=qs['filters'](_['pick'](_0x27f1d1[_0x2450('0x21')],_0x5d3ea3[_0x2450('0x22')]),_0x40aafb);if(_0x27f1d1[_0x2450('0x21')][_0x2450('0x2c')]){_0x365df2['where']=_[_0x2450('0x2d')](_0x365df2[_0x2450('0x2b')],{'$or':_[_0x2450('0x19')](_0x40aafb,function(_0x365b8b){if(_0x365b8b['type']!==_0x2450('0x2e')){var _0x6dfc4f={};_0x6dfc4f[_0x365b8b[_0x2450('0x20')]]={'$like':'%'+_0x27f1d1[_0x2450('0x21')]['filter']+'%'};return _0x6dfc4f;}})});}_0x365df2=_[_0x2450('0x2d')]({},_0x365df2,_0x27f1d1[_0x2450('0x2f')]);var _0xa62012={'where':_0x365df2[_0x2450('0x2b')]};return db['CloudProvider']['count'](_0xa62012)['then'](function(_0xcd44e1){_0x1eb8df[_0x2450('0xf')]=_0xcd44e1;if(_0x27f1d1['query'][_0x2450('0x30')]){_0x365df2['include']=[{'all':!![]}];}return db[_0x2450('0x1a')][_0x2450('0x31')](_0x365df2);})[_0x2450('0x12')](function(_0x3229c1){_0x1eb8df[_0x2450('0x32')]=_['map'](_0x3229c1,function(_0x5bd325){if(_0x5bd325['service']===_0x2450('0x33')){var _0x9a797f=encryptor[_0x2450('0x34')](_0x5bd325['data3']);_0x5bd325[_0x2450('0x35')]=maskClientSecret(_0x9a797f);}return _0x5bd325;});return _0x1eb8df;})[_0x2450('0x12')](respondWithFilteredResult(_0x3b03ec,_0x365df2))[_0x2450('0x36')](handleError(_0x3b03ec,null));};exports[_0x2450('0x37')]=function(_0x1c5baa,_0x477098){var _0x50d8f5={'raw':!![],'where':{'id':_0x1c5baa[_0x2450('0x38')]['id']}},_0x3d3be3={};_0x3d3be3['model']=_[_0x2450('0x39')](db['CloudProvider'][_0x2450('0x1b')]);_0x3d3be3['query']=_[_0x2450('0x39')](_0x1c5baa[_0x2450('0x21')]);_0x3d3be3[_0x2450('0x22')]=_['intersection'](_0x3d3be3[_0x2450('0x1f')],_0x3d3be3[_0x2450('0x21')]);_0x50d8f5[_0x2450('0x25')]=_[_0x2450('0x23')](_0x3d3be3['model'],qs[_0x2450('0x24')](_0x1c5baa[_0x2450('0x21')][_0x2450('0x24')]));_0x50d8f5['attributes']=_0x50d8f5[_0x2450('0x25')][_0x2450('0x26')]?_0x50d8f5[_0x2450('0x25')]:_0x3d3be3[_0x2450('0x1f')];if(_0x1c5baa[_0x2450('0x21')]['includeAll']){_0x50d8f5[_0x2450('0x3a')]=[{'all':!![]}];}_0x50d8f5=_[_0x2450('0x2d')]({},_0x50d8f5,_0x1c5baa[_0x2450('0x2f')]);return db[_0x2450('0x1a')][_0x2450('0x3b')](_0x50d8f5)[_0x2450('0x12')](handleEntityNotFound(_0x477098,null))[_0x2450('0x12')](function(_0x2e79fa){if(_0x2e79fa[_0x2450('0x3c')]===_0x2450('0x33')){var _0x1081bf=encryptor[_0x2450('0x34')](_0x2e79fa[_0x2450('0x35')]);_0x2e79fa[_0x2450('0x35')]=maskClientSecret(_0x1081bf);}return _0x2e79fa;})[_0x2450('0x12')](respondWithResult(_0x477098,null))[_0x2450('0x36')](handleError(_0x477098,null));};exports[_0x2450('0x3d')]=function(_0x4115a0,_0x1fc135){if(!_0x4115a0[_0x2450('0x3e')][_0x2450('0x20')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4115a0['body']['service'])throw new Error(_0x2450('0x3f'));var _0xcf8325=db[_0x2450('0x1a')][_0x2450('0x1b')][_0x2450('0x3c')][_0x2450('0x40')];if(!_0xcf8325[_0x2450('0x41')](_0x4115a0['body'][_0x2450('0x3c')]))throw new Error(_0x2450('0x42')+_0xcf8325[_0x2450('0x43')](',\x20'));if(_0x4115a0[_0x2450('0x3e')]['service']==='MicrosoftAzure'&&_0x4115a0[_0x2450('0x3e')][_0x2450('0x35')]){_0x4115a0[_0x2450('0x3e')][_0x2450('0x35')]=encryptor['encryptString'](_0x4115a0[_0x2450('0x3e')]['data3']);}return db[_0x2450('0x1a')]['create'](_0x4115a0['body'],{})[_0x2450('0x12')](respondWithResult(_0x1fc135,0xc9))[_0x2450('0x36')](handleError(_0x1fc135,null));};exports['update']=function(_0x148152,_0x4dc7f3){if(_0x148152[_0x2450('0x3e')]['id']){delete _0x148152[_0x2450('0x3e')]['id'];}return db[_0x2450('0x1a')][_0x2450('0x3b')]({'where':{'id':_0x148152[_0x2450('0x38')]['id']}})[_0x2450('0x12')](handleEntityNotFound(_0x4dc7f3,null))['then'](function(_0x1e1e31){if(_0x1e1e31['service']===_0x2450('0x33')&&_0x148152[_0x2450('0x3e')][_0x2450('0x35')]){_0x148152[_0x2450('0x3e')][_0x2450('0x35')]=encryptor[_0x2450('0x44')](_0x148152[_0x2450('0x3e')][_0x2450('0x35')]);}return _0x1e1e31;})[_0x2450('0x12')](saveUpdates(_0x148152['body'],null))['then'](respondWithResult(_0x4dc7f3,null))[_0x2450('0x36')](handleError(_0x4dc7f3,null));};exports[_0x2450('0x13')]=function(_0x24d4dc,_0x1db7a8){return db[_0x2450('0x1a')][_0x2450('0x3b')]({'where':{'id':_0x24d4dc[_0x2450('0x38')]['id']}})[_0x2450('0x12')](handleEntityNotFound(_0x1db7a8,null))[_0x2450('0x12')](removeEntity(_0x1db7a8,null))['catch'](handleError(_0x1db7a8,null));};exports[_0x2450('0x45')]=function(_0x3b316c,_0x20fe8e){return db[_0x2450('0x1a')][_0x2450('0x46')]({'where':{'id':_0x3b316c[_0x2450('0x38')]['id']},'raw':!![]})['then'](function(_0x354e7a){if(!_0x354e7a)return _0x20fe8e['sendStatus'](0x194);return{'url':oauth[_0x2450('0x47')](_0x354e7a,_0x3b316c['user']['id'])};})['then'](respondWithResult(_0x20fe8e,null))['catch'](handleError(_0x20fe8e,null));};exports[_0x2450('0x48')]=function(_0x554826,_0x1ef099){var _0x9dfa08=_0x554826['body'];var _0x34fd18;var _0x4effd6;if(_0x9dfa08[_0x2450('0x49')])throw _0x9dfa08;redis[_0x2450('0x4a')](_0x9dfa08[_0x2450('0x4b')])[_0x2450('0x12')](function(_0x4678f8){if(!_0x4678f8)throw new Error(_0x2450('0x4c'));_0x34fd18=JSON[_0x2450('0x4d')](_0x4678f8);var _0x5273ab=Buffer[_0x2450('0x4e')](_0x9dfa08[_0x2450('0x4b')],_0x2450('0x4f'))[_0x2450('0x50')](_0x2450('0x51'));_0x4effd6=JSON[_0x2450('0x4d')](_0x5273ab);if(!oauth[_0x2450('0x52')](_0x9dfa08[_0x2450('0x53')],_0x34fd18[_0x2450('0x54')]))throw new Error(_0x2450('0x55'));redis[_0x2450('0x56')](_0x9dfa08[_0x2450('0x4b')]);return oauth[_0x2450('0x57')](_0x9dfa08['code'],_0x34fd18);})[_0x2450('0x12')](function(_0x1904c0){_0x34fd18[_0x2450('0x58')]=_0x1904c0[_0x2450('0x59')];_0x34fd18[_0x2450('0x5a')]=_0x1904c0[_0x2450('0x5b')];return db['CloudProvider'][_0x2450('0x11')]({'data5':_0x34fd18['data5'],'data6':_0x34fd18[_0x2450('0x5a')]},{'where':{'id':_0x34fd18['id']}});})[_0x2450('0x12')](function(){oauth[_0x2450('0x5c')](_0x34fd18);socket['emit'](_0x2450('0x5d'),{'id':_0x4effd6['id']});return;})[_0x2450('0x12')](respondWithStatusCode(_0x1ef099,null))['catch'](function(_0x40075f){if(_0x4effd6){socket[_0x2450('0x5e')](_0x2450('0x5f'),{'id':_0x4effd6['id']});}if(!_0x34fd18){logger['error'](_0x2450('0x60'),_0x40075f);return _0x1ef099[_0x2450('0xa')](0x1f4)[_0x2450('0x61')](_0x40075f['message']);}logger[_0x2450('0x49')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x34fd18['id'],JSON[_0x2450('0x62')](_0x40075f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2ff0847..7b37726 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 _0xe52c=['path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','../../config/logger','api','moment','bluebird'];(function(_0x19b2d2,_0x2485b2){var _0x183e8e=function(_0x47b88b){while(--_0x47b88b){_0x19b2d2['push'](_0x19b2d2['shift']());}};_0x183e8e(++_0x2485b2);}(_0xe52c,0x196));var _0xce52=function(_0x3c36aa,_0x52a733){_0x3c36aa=_0x3c36aa-0x0;var _0x210dfb=_0xe52c[_0x3c36aa];return _0x210dfb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xce52('0x0'))(_0xce52('0x1'));var moment=require(_0xce52('0x2'));var BPromise=require(_0xce52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce52('0x4'));var rimraf=require(_0xce52('0x5'));var config=require('../../config/environment');var attributes=require(_0xce52('0x6'));module[_0xce52('0x7')]=function(_0xf4bd3,_0xd1fe8f){return _0xf4bd3[_0xce52('0x8')](_0xce52('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe30f=['exports','CloudProvider','cloud_providers','util','api','bluebird','path','../../config/environment','./cloudProvider.attributes'];(function(_0x18e8c8,_0x5b6b81){var _0x1fa76e=function(_0x369790){while(--_0x369790){_0x18e8c8['push'](_0x18e8c8['shift']());}};_0x1fa76e(++_0x5b6b81);}(_0xe30f,0x11a));var _0xfe30=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe30f[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xfe30('0x0'));var logger=require('../../config/logger')(_0xfe30('0x1'));var moment=require('moment');var BPromise=require(_0xfe30('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe30('0x3'));var rimraf=require('rimraf');var config=require(_0xfe30('0x4'));var attributes=require(_0xfe30('0x5'));module[_0xfe30('0x6')]=function(_0x18a534,_0xae8747){return _0x18a534['define'](_0xfe30('0x7'),attributes,{'tableName':_0xfe30('0x8'),'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 d5a19a5..2e5290f 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 _0x492a=['catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','findAll','all','exports','lodash','crypto','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','Dynamics365','push','data7','/.default','join','type','Outlook365','replace','{TENANT_ID}','id_token','from','stringify','base64','randomBytes','toString','hex','response_type','redirect_uri','response_mode','form_post','scope','state','login','key','oauth2Claims','oauth2/','data1','set','decode','payload','iss','audience','nonce','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','data4','POST','data5','update'];(function(_0x34ced0,_0x21907f){var _0x3db58d=function(_0x51fb31){while(--_0x51fb31){_0x34ced0['push'](_0x34ced0['shift']());}};_0x3db58d(++_0x21907f);}(_0x492a,0x1cb));var _0xa492=function(_0x9ef902,_0x25ed15){_0x9ef902=_0x9ef902-0x0;var _0x126e46=_0x492a[_0x9ef902];return _0x126e46;};'use strict';var _=require(_0xa492('0x0'));var crypto=require(_0xa492('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0xa492('0x2'));var rp=require(_0xa492('0x3'));var util=require('util');var encryptor=require(_0xa492('0x4'));var config=require(_0xa492('0x5'));var logger=require(_0xa492('0x6'))(_0xa492('0x7'));var schedule=require(_0xa492('0x8'));var db=require(_0xa492('0x9'))['db'];config[_0xa492('0xa')]=_[_0xa492('0xb')](config[_0xa492('0xa')],{'host':_0xa492('0xc'),'port':0x18eb});var redis=new Redis(config[_0xa492('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xa492('0xd'),'profile',_0xa492('0xe'),'offline_access',_0xa492('0xf'),_0xa492('0x10'),_0xa492('0x11')],'Dynamics365':[_0xa492('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xa492('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xa492('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x220cea){var _0xe165c=_[_0xa492('0x14')](AZURE_AUTH_SCOPES[_0x220cea['type']]);if(_0x220cea['type']===_0xa492('0x15'))_0xe165c[_0xa492('0x16')](_0x220cea[_0xa492('0x17')]+_0xa492('0x18'));return _0xe165c[_0xa492('0x19')]('\x20');}function getAccessTokenScope(_0x18e52e){if(_0x18e52e[_0xa492('0x1a')]===_0xa492('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x18e52e['type']===_0xa492('0x15'))return _0x18e52e[_0xa492('0x17')]+_0xa492('0x18');}function generateMicrosoftAuthorizationUrl(_0x59a70a,_0x23eda0){var _0x93fa60=MICROSOFT_AUTH_URL[_0xa492('0x1c')](_0xa492('0x1d'),_0x59a70a['data2']);var _0x1422c9=['code',_0xa492('0x1e')];var _0x4c663a=Buffer[_0xa492('0x1f')](JSON[_0xa492('0x20')]({'id':_0x23eda0}))['toString'](_0xa492('0x21'));var _0x339984=crypto[_0xa492('0x22')](0x10)[_0xa492('0x23')](_0xa492('0x24'));var _0x1caf9d=getAuthorizationScopes(_0x59a70a);var _0x460734=[{'key':'client_id','value':_0x59a70a['data1']},{'key':_0xa492('0x25'),'value':encodeURIComponent(_0x1422c9[_0xa492('0x19')]('\x20'))},{'key':_0xa492('0x26'),'value':_0x59a70a['data4']},{'key':_0xa492('0x27'),'value':_0xa492('0x28')},{'key':_0xa492('0x29'),'value':encodeURIComponent(_0x1caf9d)},{'key':_0xa492('0x2a'),'value':_0x4c663a},{'key':'nonce','value':_0x339984},{'key':'prompt','value':_0xa492('0x2b')}];var _0x5d66f0=_0x93fa60+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa492('0x14')](_0x460734,function(_0x44aa2d){return _0x44aa2d[_0xa492('0x2c')]+'='+_0x44aa2d['value'];})[_0xa492('0x19')]('&');_0x59a70a[_0xa492('0x2d')]={'issuer':_0x93fa60[_0xa492('0x1c')](_0xa492('0x2e'),''),'audience':_0x59a70a[_0xa492('0x2f')],'state':_0x4c663a,'nonce':_0x339984};redis[_0xa492('0x30')](_0x4c663a,JSON[_0xa492('0x20')](_0x59a70a));return _0x5d66f0;}function isValidIdToken(_0x4fa3a3,_0x1d89ef){try{var _0x52f9a7=jwt[_0xa492('0x31')](_0x4fa3a3,{'complete':!![]});var _0x17a1ec=_0x52f9a7[_0xa492('0x32')];if(_0x17a1ec[_0xa492('0x33')]!==_0x1d89ef['issuer'])return![];if(_0x17a1ec['aud']!==_0x1d89ef[_0xa492('0x34')])return![];if(_0x17a1ec[_0xa492('0x35')]!==_0x1d89ef[_0xa492('0x35')])return![];if(moment()['isAfter'](moment[_0xa492('0x36')](_0x17a1ec['exp'])))return![];return!![];}catch(_0x5938da){throw _0x5938da;}}function refreshOauth2MicrosoftAccessToken(_0x2759eb){return Promise[_0xa492('0x37')]()[_0xa492('0x38')](function(){if(_0x2759eb[_0xa492('0x39')])return _0x2759eb;return db[_0xa492('0x3a')][_0xa492('0x3b')]({'where':{'id':_0x2759eb['id']},'raw':!![]});})[_0xa492('0x38')](function(_0x1cdd56){var _0x4b12d7={'grant_type':_0xa492('0x3c'),'refresh_token':_0x1cdd56[_0xa492('0x3d')],'scope':getAccessTokenScope(_0x1cdd56),'redirect_uri':_0x1cdd56[_0xa492('0x3e')],'client_id':_0x1cdd56[_0xa492('0x2f')],'client_secret':encryptor['decryptString'](_0x1cdd56[_0xa492('0x39')])};var _0x14dbf2={'method':_0xa492('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xa492('0x1d'),_0x1cdd56['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4b12d7,'json':!![]};return rp(_0x14dbf2);})[_0xa492('0x38')](function(_0x40ac73){_0x2759eb[_0xa492('0x40')]=_0x40ac73['access_token'];_0x2759eb[_0xa492('0x3d')]=_0x40ac73[_0xa492('0x3c')];return db[_0xa492('0x3a')][_0xa492('0x41')]({'data5':_0x2759eb[_0xa492('0x40')],'data6':_0x2759eb[_0xa492('0x3d')]},{'where':{'id':_0x2759eb['id']}});})['then'](function(){return _0x2759eb;})[_0xa492('0x42')](function(_0xefea69){logger[_0xa492('0x43')](_0xa492('0x44'),_0x2759eb['id'],_0xefea69);});}function getOauth2MicrosoftAccessToken(_0x575c6b,_0x1585bb){var _0x46b7bc={'grant_type':_0xa492('0x45'),'code':_0x575c6b,'scope':getAccessTokenScope(_0x1585bb),'redirect_uri':_0x1585bb['data4'],'client_id':_0x1585bb[_0xa492('0x2f')],'client_secret':encryptor[_0xa492('0x46')](_0x1585bb[_0xa492('0x39')])};var _0x20a0a5={'method':_0xa492('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xa492('0x1c')]('{TENANT_ID}',_0x1585bb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x46b7bc,'json':!![]};return rp(_0x20a0a5);}function startRefreshInterval(_0x3c4411){var _0x5ca6d6=schedule['intervals'];if(_0x5ca6d6[_0x3c4411['id']])clearInterval(_0x5ca6d6[_0x3c4411['id']]);_0x5ca6d6[_0x3c4411['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3c4411['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa492('0x47')]=_0x5ca6d6;}function startAllRefreshIntervals(){return db[_0xa492('0x3a')][_0xa492('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa492('0x38')](function(_0x4a9c60){var _0x56919c=_0x4a9c60[_0xa492('0x14')](function(_0xef644a){return refreshOauth2MicrosoftAccessToken(_0xef644a)[_0xa492('0x38')](function(_0x35f4a7){startRefreshInterval(_0x35f4a7);});});return Promise[_0xa492('0x49')](_0x56919c);})['catch'](function(_0x487bad){var _0x3ea61f=_0x487bad?util['inspect'](_0x487bad,{'showHidden':![],'depth':null}):'';logger[_0xa492('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3ea61f);});}module[_0xa492('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xf8de=['bind','intervals','CloudProvider','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','ioredis','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','/.default','join','Outlook365','Dynamics365','data7','replace','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','toString','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','prompt','login','map','key','oauth2Claims','oauth2/','set','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','findOne','refresh_token','data6','decryptString','data3','POST','data5','access_token','update','catch','error','authorization_code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf8de,0x144));var _0xef8d=function(_0x3020ed,_0x2fb8e2){_0x3020ed=_0x3020ed-0x0;var _0x2645ea=_0xf8de[_0x3020ed];return _0x2645ea;};'use strict';var _=require(_0xef8d('0x0'));var crypto=require(_0xef8d('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0xef8d('0x2'));var rp=require('request-promise');var util=require(_0xef8d('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0xef8d('0x4'));var logger=require(_0xef8d('0x5'))(_0xef8d('0x6'));var schedule=require(_0xef8d('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xef8d('0x8')]);var MICROSOFT_AUTH_URL=_0xef8d('0x9');var AZURE_AUTH_SCOPES={'Outlook365':[_0xef8d('0xa'),_0xef8d('0xb'),_0xef8d('0xc'),'offline_access',_0xef8d('0xd'),_0xef8d('0xe'),_0xef8d('0xf')],'Dynamics365':[_0xef8d('0xa'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xef8d('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0xef8d('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5d2937){var _0x864920=_['map'](AZURE_AUTH_SCOPES[_0x5d2937[_0xef8d('0x12')]]);if(_0x5d2937[_0xef8d('0x12')]==='Dynamics365')_0x864920[_0xef8d('0x13')](_0x5d2937['data7']+_0xef8d('0x14'));return _0x864920[_0xef8d('0x15')]('\x20');}function getAccessTokenScope(_0x2981bf){if(_0x2981bf[_0xef8d('0x12')]===_0xef8d('0x16'))return _0xef8d('0xd');if(_0x2981bf['type']===_0xef8d('0x17'))return _0x2981bf[_0xef8d('0x18')]+_0xef8d('0x14');}function generateMicrosoftAuthorizationUrl(_0x1f299d,_0x3699b9){var _0x572976=MICROSOFT_AUTH_URL[_0xef8d('0x19')](_0xef8d('0x1a'),_0x1f299d[_0xef8d('0x1b')]);var _0x2a304a=[_0xef8d('0x1c'),_0xef8d('0x1d')];var _0x271a8a=Buffer[_0xef8d('0x1e')](JSON[_0xef8d('0x1f')]({'id':_0x3699b9}))['toString'](_0xef8d('0x20'));var _0x54be0a=crypto[_0xef8d('0x21')](0x10)[_0xef8d('0x22')]('hex');var _0x5d8d64=getAuthorizationScopes(_0x1f299d);var _0x18cc8b=[{'key':'client_id','value':_0x1f299d[_0xef8d('0x23')]},{'key':_0xef8d('0x24'),'value':encodeURIComponent(_0x2a304a[_0xef8d('0x15')]('\x20'))},{'key':_0xef8d('0x25'),'value':_0x1f299d[_0xef8d('0x26')]},{'key':'response_mode','value':_0xef8d('0x27')},{'key':_0xef8d('0x28'),'value':encodeURIComponent(_0x5d8d64)},{'key':_0xef8d('0x29'),'value':_0x271a8a},{'key':_0xef8d('0x2a'),'value':_0x54be0a},{'key':_0xef8d('0x2b'),'value':_0xef8d('0x2c')}];var _0x32f675=_0x572976+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xef8d('0x2d')](_0x18cc8b,function(_0x423643){return _0x423643[_0xef8d('0x2e')]+'='+_0x423643['value'];})[_0xef8d('0x15')]('&');_0x1f299d[_0xef8d('0x2f')]={'issuer':_0x572976[_0xef8d('0x19')](_0xef8d('0x30'),''),'audience':_0x1f299d[_0xef8d('0x23')],'state':_0x271a8a,'nonce':_0x54be0a};redis[_0xef8d('0x31')](_0x271a8a,JSON[_0xef8d('0x1f')](_0x1f299d));return _0x32f675;}function isValidIdToken(_0x270797,_0x2756b2){try{var _0x174e1f=jwt['decode'](_0x270797,{'complete':!![]});var _0x1d4117=_0x174e1f['payload'];if(_0x1d4117[_0xef8d('0x32')]!==_0x2756b2[_0xef8d('0x33')])return![];if(_0x1d4117[_0xef8d('0x34')]!==_0x2756b2[_0xef8d('0x35')])return![];if(_0x1d4117[_0xef8d('0x2a')]!==_0x2756b2['nonce'])return![];if(moment()[_0xef8d('0x36')](moment[_0xef8d('0x37')](_0x1d4117[_0xef8d('0x38')])))return![];return!![];}catch(_0xdf1b5d){throw _0xdf1b5d;}}function refreshOauth2MicrosoftAccessToken(_0x5db57a){return Promise[_0xef8d('0x39')]()[_0xef8d('0x3a')](function(){if(_0x5db57a['data3'])return _0x5db57a;return db['CloudProvider'][_0xef8d('0x3b')]({'where':{'id':_0x5db57a['id']},'raw':!![]});})[_0xef8d('0x3a')](function(_0x427911){var _0x58d153={'grant_type':_0xef8d('0x3c'),'refresh_token':_0x427911[_0xef8d('0x3d')],'scope':getAccessTokenScope(_0x427911),'redirect_uri':_0x427911[_0xef8d('0x26')],'client_id':_0x427911[_0xef8d('0x23')],'client_secret':encryptor[_0xef8d('0x3e')](_0x427911[_0xef8d('0x3f')])};var _0x572794={'method':_0xef8d('0x40'),'uri':MICROSOFT_AUTH_URL[_0xef8d('0x19')]('{TENANT_ID}',_0x427911[_0xef8d('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x58d153,'json':!![]};return rp(_0x572794);})['then'](function(_0xda554){_0x5db57a[_0xef8d('0x41')]=_0xda554[_0xef8d('0x42')];_0x5db57a['data6']=_0xda554[_0xef8d('0x3c')];return db['CloudProvider'][_0xef8d('0x43')]({'data5':_0x5db57a[_0xef8d('0x41')],'data6':_0x5db57a['data6']},{'where':{'id':_0x5db57a['id']}});})[_0xef8d('0x3a')](function(){return _0x5db57a;})[_0xef8d('0x44')](function(_0x3d3af0){logger[_0xef8d('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5db57a['id'],_0x3d3af0);});}function getOauth2MicrosoftAccessToken(_0x1e0a85,_0x42a775){var _0x42e7d2={'grant_type':_0xef8d('0x46'),'code':_0x1e0a85,'scope':getAccessTokenScope(_0x42a775),'redirect_uri':_0x42a775[_0xef8d('0x26')],'client_id':_0x42a775[_0xef8d('0x23')],'client_secret':encryptor[_0xef8d('0x3e')](_0x42a775['data3'])};var _0x5d84a4={'method':_0xef8d('0x40'),'uri':MICROSOFT_AUTH_URL[_0xef8d('0x19')](_0xef8d('0x1a'),_0x42a775[_0xef8d('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x42e7d2,'json':!![]};return rp(_0x5d84a4);}function startRefreshInterval(_0x5a800b){var _0x5f4511=schedule['intervals'];if(_0x5f4511[_0x5a800b['id']])clearInterval(_0x5f4511[_0x5a800b['id']]);_0x5f4511[_0x5a800b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xef8d('0x47')](this,{'id':_0x5a800b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xef8d('0x48')]=_0x5f4511;}function startAllRefreshIntervals(){return db[_0xef8d('0x49')][_0xef8d('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x5ad64d){var _0x217ff4=_0x5ad64d[_0xef8d('0x2d')](function(_0x4187fe){return refreshOauth2MicrosoftAccessToken(_0x4187fe)[_0xef8d('0x3a')](function(_0x252114){startRefreshInterval(_0x252114);});});return Promise[_0xef8d('0x4b')](_0x217ff4);})[_0xef8d('0x44')](function(_0x18acb9){var _0x55b87d=_0x18acb9?util[_0xef8d('0x4c')](_0x18acb9,{'showHidden':![],'depth':null}):'';logger[_0xef8d('0x45')](_0xef8d('0x4d'),_0x55b87d);});}module[_0xef8d('0x4e')]={'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 130884a..5190457 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 _0x8325=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8325,0x1f1));var _0x5832=function(_0x37a73b,_0x569e74){_0x37a73b=_0x37a73b-0x0;var _0x39cee2=_0x8325[_0x37a73b];return _0x39cee2;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var moment=require(_0x5832('0x1'));var BPromise=require('bluebird');var rs=require(_0x5832('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5832('0x3'))['db'];var utils=require(_0x5832('0x4'));var logger=require(_0x5832('0x5'))(_0x5832('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5832('0x7')][_0x5832('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8b3b30,_0xe80d1d,_0xb4e9b9){return new BPromise(function(_0x333780,_0x495531){return client[_0x5832('0x9')](_0x8b3b30,_0xb4e9b9)[_0x5832('0xa')](function(_0x10192d){logger[_0x5832('0xb')](_0x5832('0xc'),_0xe80d1d,_0x5832('0xd'));logger[_0x5832('0xe')](_0x5832('0xf'),_0xe80d1d,_0x5832('0xd'),JSON['stringify'](_0x10192d));if(_0x10192d['error']){if(_0x10192d[_0x5832('0x10')][_0x5832('0x11')]===0x1f4){logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x10192d['error']['message']);return _0x495531(_0x10192d[_0x5832('0x10')][_0x5832('0x12')]);}logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x10192d['error'][_0x5832('0x12')]);return _0x333780(_0x10192d[_0x5832('0x10')][_0x5832('0x12')]);}else{logger[_0x5832('0xb')]('CloudProvider,\x20%s,\x20%s',_0xe80d1d,_0x5832('0xd'));_0x333780(_0x10192d[_0x5832('0x13')][_0x5832('0x12')]);}})['catch'](function(_0x32d360){logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x32d360);_0x495531(_0x32d360);});});} \ No newline at end of file +var _0x72d7=['../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x35d0dc,_0x1b5050){var _0x10a4d9=function(_0x17fc39){while(--_0x17fc39){_0x35d0dc['push'](_0x35d0dc['shift']());}};_0x10a4d9(++_0x1b5050);}(_0x72d7,0x19b));var _0x772d=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x72d7[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x772d('0x0'));var util=require(_0x772d('0x1'));var moment=require(_0x772d('0x2'));var BPromise=require(_0x772d('0x3'));var rs=require(_0x772d('0x4'));var fs=require('fs');var Redis=require(_0x772d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x772d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x772d('0x7'));var jayson=require(_0x772d('0x8'));var client=jayson[_0x772d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5bc4,_0x141516,_0x1daa77){return new BPromise(function(_0x36d077,_0xf6a873){return client[_0x772d('0xa')](_0x1b5bc4,_0x1daa77)[_0x772d('0xb')](function(_0x5e8a53){logger[_0x772d('0xc')]('CloudProvider,\x20%s,\x20%s',_0x141516,'request\x20sent');logger['debug'](_0x772d('0xd'),_0x141516,_0x772d('0xe'),JSON[_0x772d('0xf')](_0x5e8a53));if(_0x5e8a53[_0x772d('0x10')]){if(_0x5e8a53[_0x772d('0x10')][_0x772d('0x11')]===0x1f4){logger[_0x772d('0x10')](_0x772d('0x12'),_0x141516,_0x5e8a53['error'][_0x772d('0x13')]);return _0xf6a873(_0x5e8a53[_0x772d('0x10')][_0x772d('0x13')]);}logger[_0x772d('0x10')](_0x772d('0x12'),_0x141516,_0x5e8a53['error'][_0x772d('0x13')]);return _0x36d077(_0x5e8a53['error']['message']);}else{logger[_0x772d('0xc')](_0x772d('0x12'),_0x141516,'request\x20sent');_0x36d077(_0x5e8a53[_0x772d('0x14')][_0x772d('0x13')]);}})[_0x772d('0x15')](function(_0x53a421){logger[_0x772d('0x10')](_0x772d('0x12'),_0x141516,_0x53a421);_0xf6a873(_0x53a421);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index fea1fe4..6f9b0be 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c3f08,_0x380f2b){_0x2c3f08=_0x2c3f08-0x0;var _0x4ea2ab=_0x5f2f[_0x2c3f08];return _0x4ea2ab;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +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(_0x4cc4c5,_0x182abd){var _0x3058c1=function(_0x3ec5c8){while(--_0x3ec5c8){_0x4cc4c5['push'](_0x4cc4c5['shift']());}};_0x3058c1(++_0x182abd);}(_0xdb28,0x106));var _0x8db2=function(_0x4da502,_0x22a2ed){_0x4da502=_0x4da502-0x0;var _0x4870e7=_0xdb28[_0x4da502];return _0x4870e7;};'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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d88ce70..6143d86 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 _0x1d6f=['STRING','sequelize'];(function(_0x340165,_0x27fd27){var _0x346e2a=function(_0x4b3839){while(--_0x4b3839){_0x340165['push'](_0x340165['shift']());}};_0x346e2a(++_0x27fd27);}(_0x1d6f,0x171));var _0xf1d6=function(_0x141323,_0x4c0370){_0x141323=_0x141323-0x0;var _0x1cb78f=_0x1d6f[_0x141323];return _0x1cb78f;};'use strict';var Sequelize=require(_0xf1d6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf1d6('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xf1d6('0x1')]},'phone':{'type':Sequelize[_0xf1d6('0x1')]},'fax':{'type':Sequelize[_0xf1d6('0x1')]},'type':{'type':Sequelize[_0xf1d6('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xf1d6('0x1')]},'city':{'type':Sequelize[_0xf1d6('0x1')]},'country':{'type':Sequelize[_0xf1d6('0x1')]},'email':{'type':Sequelize[_0xf1d6('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xf1d6('0x1')]},'sPostalCode':{'type':Sequelize[_0xf1d6('0x1')]},'sCity':{'type':Sequelize[_0xf1d6('0x1')]},'sCountry':{'type':Sequelize[_0xf1d6('0x1')]},'description':{'type':Sequelize[_0xf1d6('0x1')]}}; \ No newline at end of file +var _0xcc7f=['sequelize','STRING'];(function(_0x57b5d5,_0x25b4ee){var _0x24e2b5=function(_0xdf9111){while(--_0xdf9111){_0x57b5d5['push'](_0x57b5d5['shift']());}};_0x24e2b5(++_0x25b4ee);}(_0xcc7f,0x1cc));var _0xfcc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc7f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfcc7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfcc7('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xfcc7('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfcc7('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xfcc7('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xfcc7('0x1')]},'email':{'type':Sequelize[_0xfcc7('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfcc7('0x1')]},'sStreet':{'type':Sequelize[_0xfcc7('0x1')]},'sPostalCode':{'type':Sequelize[_0xfcc7('0x1')]},'sCity':{'type':Sequelize[_0xfcc7('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfcc7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d7c1abe..51af407 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 _0xbeb0=['merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x224721,_0x45b988){var _0x145358=function(_0x42305e){while(--_0x42305e){_0x224721['push'](_0x224721['shift']());}};_0x145358(++_0x45b988);}(_0xbeb0,0x69));var _0x0beb=function(_0x5a5b49,_0x2a11fb){_0x5a5b49=_0x5a5b49-0x0;var _0x42e871=_0xbeb0[_0x5a5b49];return _0x42e871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0beb('0x0'));var jsonpatch=require(_0x0beb('0x1'));var rp=require(_0x0beb('0x2'));var moment=require(_0x0beb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0beb('0x4'));var util=require(_0x0beb('0x5'));var path=require(_0x0beb('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0beb('0x7'));var _=require(_0x0beb('0x8'));var squel=require(_0x0beb('0x9'));var crypto=require('crypto');var jsforce=require(_0x0beb('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0beb('0xb'));var Papa=require(_0x0beb('0xc'));var Redis=require(_0x0beb('0xd'));var authService=require(_0x0beb('0xe'));var qs=require(_0x0beb('0xf'));var as=require(_0x0beb('0x10'));var hardwareService=require(_0x0beb('0x11'));var logger=require('../../config/logger')(_0x0beb('0x12'));var utils=require(_0x0beb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0beb('0x14'));var db=require(_0x0beb('0x15'))['db'];function respondWithStatusCode(_0x480eb3,_0x5dc202){_0x5dc202=_0x5dc202||0xcc;return function(_0x459f86){if(_0x459f86){return _0x480eb3[_0x0beb('0x16')](_0x5dc202);}return _0x480eb3[_0x0beb('0x17')](_0x5dc202)[_0x0beb('0x18')]();};}function respondWithResult(_0x47129e,_0x39f5ad){_0x39f5ad=_0x39f5ad||0xc8;return function(_0x2e7d6e){if(_0x2e7d6e){return _0x47129e[_0x0beb('0x17')](_0x39f5ad)['json'](_0x2e7d6e);}};}function respondWithFilteredResult(_0x3311c3,_0x54a760){return function(_0x527c78){if(_0x527c78){var _0x4419da=typeof _0x54a760[_0x0beb('0x19')]===_0x0beb('0x1a')&&typeof _0x54a760[_0x0beb('0x1b')]==='undefined';var _0x28a30f=_0x527c78[_0x0beb('0x1c')];var _0x549a96=_0x4419da?0x0:_0x54a760[_0x0beb('0x19')];var _0x4fd805=_0x4419da?_0x527c78['count']:_0x54a760[_0x0beb('0x19')]+_0x54a760[_0x0beb('0x1b')];var _0x145884;if(_0x4fd805>=_0x28a30f){_0x4fd805=_0x28a30f;_0x145884=0xc8;}else{_0x145884=0xce;}_0x3311c3[_0x0beb('0x17')](_0x145884);return _0x3311c3['set'](_0x0beb('0x1d'),_0x549a96+'-'+_0x4fd805+'/'+_0x28a30f)[_0x0beb('0x1e')](_0x527c78);}return null;};}function patchUpdates(_0x446a62){return function(_0x5a5931){try{jsonpatch[_0x0beb('0x1f')](_0x5a5931,_0x446a62,!![]);}catch(_0x469365){return BPromise['reject'](_0x469365);}return _0x5a5931[_0x0beb('0x20')]();};}function saveUpdates(_0x34eb24,_0x8b150b){return function(_0x3c285d){if(_0x3c285d){return _0x3c285d[_0x0beb('0x21')](_0x34eb24)[_0x0beb('0x22')](function(_0x35f63e){return _0x35f63e;});}return null;};}function removeEntity(_0x5ca394,_0x5c49ba){return function(_0xde42af){if(_0xde42af){return _0xde42af[_0x0beb('0x23')]()[_0x0beb('0x22')](function(){var _0x347023=_0xde42af[_0x0beb('0x24')]({'plain':!![]});var _0x83dbb2=_0x0beb('0x25');return db[_0x0beb('0x26')][_0x0beb('0x23')]({'where':{'type':_0x83dbb2,'resourceId':_0x347023['id']}})['then'](function(){return _0xde42af;});})[_0x0beb('0x22')](function(){_0x5ca394['status'](0xcc)[_0x0beb('0x18')]();});}};}function handleEntityNotFound(_0x274cdd,_0x480d10){return function(_0x2a3f75){if(!_0x2a3f75){_0x274cdd[_0x0beb('0x16')](0x194);}return _0x2a3f75;};}function handleError(_0x5d5765,_0x55f287){_0x55f287=_0x55f287||0x1f4;return function(_0x1370e8){logger[_0x0beb('0x27')](_0x1370e8[_0x0beb('0x28')]);if(_0x1370e8[_0x0beb('0x29')]){delete _0x1370e8[_0x0beb('0x29')];}_0x5d5765[_0x0beb('0x17')](_0x55f287)[_0x0beb('0x2a')](_0x1370e8);};}exports[_0x0beb('0x2b')]=function(_0x5f1dd6,_0x527152){var _0x5b8b2a={},_0x43ae7e={},_0x9043b3={'count':0x0,'rows':[]};return db[_0x0beb('0x2c')][_0x0beb('0x2d')]()[_0x0beb('0x22')](function(_0x26ed6e){_0x43ae7e[_0x0beb('0x2e')]=_[_0x0beb('0x2f')](_0x26ed6e);_0x43ae7e[_0x0beb('0x30')]=_[_0x0beb('0x2f')](_0x5f1dd6['query']);_0x43ae7e[_0x0beb('0x31')]=_[_0x0beb('0x32')](_0x43ae7e[_0x0beb('0x2e')],_0x43ae7e[_0x0beb('0x30')]);_0x5b8b2a[_0x0beb('0x33')]=_[_0x0beb('0x32')](_0x43ae7e['model'],qs[_0x0beb('0x34')](_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x34')]));_0x5b8b2a[_0x0beb('0x33')]=_0x5b8b2a[_0x0beb('0x33')][_0x0beb('0x35')]?_0x5b8b2a[_0x0beb('0x33')]:_0x43ae7e[_0x0beb('0x2e')];if(!_0x5f1dd6['query'][_0x0beb('0x36')](_0x0beb('0x37'))){_0x5b8b2a[_0x0beb('0x1b')]=qs[_0x0beb('0x1b')](_0x5f1dd6[_0x0beb('0x30')]['limit']);_0x5b8b2a[_0x0beb('0x19')]=qs['offset'](_0x5f1dd6[_0x0beb('0x30')]['offset']);}_0x5b8b2a[_0x0beb('0x38')]=qs[_0x0beb('0x39')](_0x5f1dd6[_0x0beb('0x30')]['sort']);_0x5b8b2a[_0x0beb('0x3a')]=qs[_0x0beb('0x31')](_[_0x0beb('0x3b')](_0x5f1dd6['query'],_0x43ae7e[_0x0beb('0x31')]),_0x26ed6e);if(_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x3c')]){_0x5b8b2a[_0x0beb('0x3a')]=_[_0x0beb('0x3d')](_0x5b8b2a[_0x0beb('0x3a')],{'$or':_[_0x0beb('0x3e')](_0x5b8b2a['attributes'],function(_0x363064){var _0x4d451d={};_0x4d451d[_0x363064]={'$like':'%'+_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x3c')]+'%'};return _0x4d451d;})});}_0x5b8b2a=_[_0x0beb('0x3d')]({},_0x5b8b2a,_0x5f1dd6[_0x0beb('0x3f')]);var _0x1f06e9={'where':_0x5b8b2a[_0x0beb('0x3a')]};return db['CmCompany'][_0x0beb('0x1c')](_0x1f06e9)['then'](function(_0x13cb13){_0x9043b3[_0x0beb('0x1c')]=_0x13cb13;if(_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x40')]){_0x5b8b2a[_0x0beb('0x41')]=[{'all':!![]}];}return db[_0x0beb('0x2c')]['findAll'](_0x5b8b2a);})[_0x0beb('0x22')](function(_0x2ba7d5){_0x9043b3[_0x0beb('0x42')]=_0x2ba7d5;return _0x9043b3;})[_0x0beb('0x22')](respondWithFilteredResult(_0x527152,_0x5b8b2a))[_0x0beb('0x43')](handleError(_0x527152,null));})['catch'](handleError(_0x527152,null));};exports[_0x0beb('0x44')]=function(_0x599393,_0x440790){var _0x578de0={'raw':![],'where':{'id':_0x599393[_0x0beb('0x45')]['id']}},_0x19c6c0={};_0x19c6c0[_0x0beb('0x2e')]=_[_0x0beb('0x2f')](db[_0x0beb('0x2c')][_0x0beb('0x46')]);_0x19c6c0[_0x0beb('0x30')]=_[_0x0beb('0x2f')](_0x599393['query']);_0x19c6c0['filters']=_[_0x0beb('0x32')](_0x19c6c0['model'],_0x19c6c0['query']);_0x578de0[_0x0beb('0x33')]=_[_0x0beb('0x32')](_0x19c6c0[_0x0beb('0x2e')],qs[_0x0beb('0x34')](_0x599393[_0x0beb('0x30')][_0x0beb('0x34')]));_0x578de0['attributes']=_0x578de0[_0x0beb('0x33')]['length']?_0x578de0['attributes']:_0x19c6c0[_0x0beb('0x2e')];if(_0x599393['query'][_0x0beb('0x40')]){_0x578de0[_0x0beb('0x41')]=[{'all':!![]}];}_0x578de0=_['merge']({},_0x578de0,_0x599393[_0x0beb('0x3f')]);return db['CmCompany'][_0x0beb('0x47')](_0x578de0)[_0x0beb('0x22')](handleEntityNotFound(_0x440790,null))[_0x0beb('0x22')](respondWithResult(_0x440790,null))[_0x0beb('0x43')](handleError(_0x440790,null));};exports[_0x0beb('0x48')]=function(_0x49e17c,_0x2d88dd){return db[_0x0beb('0x2c')]['create'](_0x49e17c[_0x0beb('0x49')],{})[_0x0beb('0x22')](function(_0xc35b29){var _0x311abf=_0x49e17c[_0x0beb('0x4a')][_0x0beb('0x24')]({'plain':!![]});if(!_0x311abf)throw new Error(_0x0beb('0x4b'));if(_0x311abf['role']===_0x0beb('0x4a')){var _0x5232ef=_0xc35b29[_0x0beb('0x24')]({'plain':!![]});var _0x285d23='Companies';return db[_0x0beb('0x4c')][_0x0beb('0x47')]({'where':{'name':_0x285d23,'userProfileId':_0x311abf[_0x0beb('0x4d')]},'raw':!![]})[_0x0beb('0x22')](function(_0x1cd63c){if(_0x1cd63c&&_0x1cd63c[_0x0beb('0x4e')]===0x0){return db[_0x0beb('0x26')][_0x0beb('0x48')]({'name':_0x5232ef['name'],'resourceId':_0x5232ef['id'],'type':_0x1cd63c[_0x0beb('0x29')],'sectionId':_0x1cd63c['id']},{})['then'](function(){return _0xc35b29;});}else{return _0xc35b29;}})[_0x0beb('0x43')](function(_0x256d92){logger[_0x0beb('0x27')](_0x0beb('0x4f'),_0x256d92);throw _0x256d92;});}return _0xc35b29;})[_0x0beb('0x22')](respondWithResult(_0x2d88dd,0xc9))[_0x0beb('0x43')](handleError(_0x2d88dd,null));};exports[_0x0beb('0x21')]=function(_0x19042e,_0x44f75d){if(_0x19042e[_0x0beb('0x49')]['id']){delete _0x19042e['body']['id'];}return db[_0x0beb('0x2c')][_0x0beb('0x47')]({'where':{'id':_0x19042e['params']['id']}})[_0x0beb('0x22')](handleEntityNotFound(_0x44f75d,null))[_0x0beb('0x22')](saveUpdates(_0x19042e[_0x0beb('0x49')],null))['then'](respondWithResult(_0x44f75d,null))[_0x0beb('0x43')](handleError(_0x44f75d,null));};exports['destroy']=function(_0x346f0b,_0x11a64b){return db[_0x0beb('0x2c')]['find']({'where':{'id':_0x346f0b[_0x0beb('0x45')]['id']}})[_0x0beb('0x22')](handleEntityNotFound(_0x11a64b,null))[_0x0beb('0x22')](removeEntity(_0x11a64b,null))[_0x0beb('0x43')](handleError(_0x11a64b,null));};exports[_0x0beb('0x2d')]=function(_0x5c81f3,_0x3f7b04){return db['CmCompany'][_0x0beb('0x2d')]()[_0x0beb('0x22')](respondWithResult(_0x3f7b04,null))[_0x0beb('0x43')](handleError(_0x3f7b04,null));};exports[_0x0beb('0x50')]=function(_0x48c2a1,_0x337045,_0x4b4a20){return db[_0x0beb('0x51')][_0x0beb('0x47')]({'where':{'id':_0x48c2a1[_0x0beb('0x45')]['id']}})['then'](handleEntityNotFound(_0x337045,null))['then'](function(_0x483ac5){if(_0x483ac5){return _0x483ac5[_0x0beb('0x50')](_0x48c2a1['body'][_0x0beb('0x52')],_['omit'](_0x48c2a1[_0x0beb('0x49')],[_0x0beb('0x52'),'id'])||{});}})[_0x0beb('0x22')](respondWithResult(_0x337045,null))[_0x0beb('0x43')](handleError(_0x337045,null));};exports['getContacts']=function(_0x17bae4,_0x5190fd,_0x2ab3d7){var _0x464b31={};var _0x1facc2={};var _0x1a04d1;var _0xef30d1;return db[_0x0beb('0x2c')]['findOne']({'where':{'id':_0x17bae4['params']['id']}})[_0x0beb('0x22')](handleEntityNotFound(_0x5190fd,null))[_0x0beb('0x22')](function(_0x4f5b3a){if(_0x4f5b3a){_0x1a04d1=_0x4f5b3a;_0x1facc2[_0x0beb('0x2e')]=_[_0x0beb('0x2f')](db[_0x0beb('0x51')][_0x0beb('0x46')]);_0x1facc2[_0x0beb('0x30')]=_[_0x0beb('0x2f')](_0x17bae4[_0x0beb('0x30')]);_0x1facc2['filters']=_[_0x0beb('0x32')](_0x1facc2['model'],_0x1facc2['query']);_0x464b31[_0x0beb('0x33')]=_[_0x0beb('0x32')](_0x1facc2[_0x0beb('0x2e')],qs[_0x0beb('0x34')](_0x17bae4['query'][_0x0beb('0x34')]));_0x464b31['attributes']=_0x464b31['attributes'][_0x0beb('0x35')]?_0x464b31[_0x0beb('0x33')]:_0x1facc2[_0x0beb('0x2e')];_0x464b31[_0x0beb('0x38')]=qs['sort'](_0x17bae4[_0x0beb('0x30')][_0x0beb('0x39')]);_0x464b31[_0x0beb('0x3a')]=qs[_0x0beb('0x31')](_[_0x0beb('0x3b')](_0x17bae4['query'],_0x1facc2[_0x0beb('0x31')]));if(_0x17bae4[_0x0beb('0x30')]['filter']){_0x464b31['where']=_[_0x0beb('0x3d')](_0x464b31['where'],{'$or':_['map'](_0x464b31[_0x0beb('0x33')],function(_0x587d7e){var _0x39b8b1={};_0x39b8b1[_0x587d7e]={'$like':'%'+_0x17bae4['query'][_0x0beb('0x3c')]+'%'};return _0x39b8b1;})});}_0x464b31=_[_0x0beb('0x3d')]({},_0x464b31,_0x17bae4[_0x0beb('0x3f')]);return _0x1a04d1['getContacts'](_0x464b31);}})[_0x0beb('0x22')](function(_0x507ad6){if(_0x507ad6){_0xef30d1=_0x507ad6[_0x0beb('0x35')];if(!_0x17bae4[_0x0beb('0x30')][_0x0beb('0x36')](_0x0beb('0x37'))){_0x464b31['limit']=qs[_0x0beb('0x1b')](_0x17bae4[_0x0beb('0x30')][_0x0beb('0x1b')]);_0x464b31[_0x0beb('0x19')]=qs['offset'](_0x17bae4[_0x0beb('0x30')]['offset']);}return _0x1a04d1['getContacts'](_0x464b31);}})['then'](function(_0x16ad9c){if(_0x16ad9c){return _0x16ad9c?{'count':_0xef30d1,'rows':_0x16ad9c}:null;}})['then'](respondWithResult(_0x5190fd,null))[_0x0beb('0x43')](handleError(_0x5190fd,null));}; \ No newline at end of file +var _0x906c=['options','count','includeAll','include','findAll','rows','catch','show','params','find','create','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','omit','getContacts','findOne','CmContact','rawAttributes','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','error','stack','name','send','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','filter'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x906c,0x1d1));var _0xc906=function(_0xb0fe9a,_0x137310){_0xb0fe9a=_0xb0fe9a-0x0;var _0x581d4b=_0x906c[_0xb0fe9a];return _0x581d4b;};'use strict';var emlformat=require(_0xc906('0x0'));var rimraf=require(_0xc906('0x1'));var zipdir=require(_0xc906('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc906('0x3'));var moment=require(_0xc906('0x4'));var BPromise=require(_0xc906('0x5'));var Mustache=require(_0xc906('0x6'));var util=require(_0xc906('0x7'));var path=require(_0xc906('0x8'));var sox=require(_0xc906('0x9'));var csv=require(_0xc906('0xa'));var ejs=require(_0xc906('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc906('0xc'));var jsforce=require(_0xc906('0xd'));var deskjs=require(_0xc906('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc906('0xf'));var Papa=require('papaparse');var Redis=require(_0xc906('0x10'));var authService=require(_0xc906('0x11'));var qs=require(_0xc906('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc906('0x13'))('api');var utils=require(_0xc906('0x14'));var config=require(_0xc906('0x15'));var licenseUtil=require(_0xc906('0x16'));var db=require(_0xc906('0x17'))['db'];function respondWithStatusCode(_0x3d9fcb,_0x344f31){_0x344f31=_0x344f31||0xcc;return function(_0x44f273){if(_0x44f273){return _0x3d9fcb[_0xc906('0x18')](_0x344f31);}return _0x3d9fcb[_0xc906('0x19')](_0x344f31)[_0xc906('0x1a')]();};}function respondWithResult(_0x293c91,_0x4fd868){_0x4fd868=_0x4fd868||0xc8;return function(_0x24e105){if(_0x24e105){return _0x293c91[_0xc906('0x19')](_0x4fd868)[_0xc906('0x1b')](_0x24e105);}};}function respondWithFilteredResult(_0x56567c,_0x1fa277){return function(_0x566e58){if(_0x566e58){var _0xf6f67f=typeof _0x1fa277['offset']===_0xc906('0x1c')&&typeof _0x1fa277['limit']===_0xc906('0x1c');var _0x3e497a=_0x566e58['count'];var _0x59c5a6=_0xf6f67f?0x0:_0x1fa277[_0xc906('0x1d')];var _0x3335c4=_0xf6f67f?_0x566e58['count']:_0x1fa277[_0xc906('0x1d')]+_0x1fa277[_0xc906('0x1e')];var _0x1d278e;if(_0x3335c4>=_0x3e497a){_0x3335c4=_0x3e497a;_0x1d278e=0xc8;}else{_0x1d278e=0xce;}_0x56567c[_0xc906('0x19')](_0x1d278e);return _0x56567c[_0xc906('0x1f')](_0xc906('0x20'),_0x59c5a6+'-'+_0x3335c4+'/'+_0x3e497a)[_0xc906('0x1b')](_0x566e58);}return null;};}function patchUpdates(_0x387d1c){return function(_0x3cfd85){try{jsonpatch[_0xc906('0x21')](_0x3cfd85,_0x387d1c,!![]);}catch(_0x58e846){return BPromise[_0xc906('0x22')](_0x58e846);}return _0x3cfd85[_0xc906('0x23')]();};}function saveUpdates(_0x60e923,_0x2a2420){return function(_0x554d23){if(_0x554d23){return _0x554d23[_0xc906('0x24')](_0x60e923)[_0xc906('0x25')](function(_0x58e247){return _0x58e247;});}return null;};}function removeEntity(_0x33a205,_0x399b67){return function(_0x809d0a){if(_0x809d0a){return _0x809d0a[_0xc906('0x26')]()[_0xc906('0x25')](function(){var _0x544102=_0x809d0a[_0xc906('0x27')]({'plain':!![]});var _0x26aec8=_0xc906('0x28');return db['UserProfileResource'][_0xc906('0x26')]({'where':{'type':_0x26aec8,'resourceId':_0x544102['id']}})[_0xc906('0x25')](function(){return _0x809d0a;});})[_0xc906('0x25')](function(){_0x33a205[_0xc906('0x19')](0xcc)[_0xc906('0x1a')]();});}};}function handleEntityNotFound(_0x3a4f5a,_0x8c753c){return function(_0x3fed4e){if(!_0x3fed4e){_0x3a4f5a[_0xc906('0x18')](0x194);}return _0x3fed4e;};}function handleError(_0x2027c3,_0x13f9f0){_0x13f9f0=_0x13f9f0||0x1f4;return function(_0x41375b){logger[_0xc906('0x29')](_0x41375b[_0xc906('0x2a')]);if(_0x41375b['name']){delete _0x41375b[_0xc906('0x2b')];}_0x2027c3[_0xc906('0x19')](_0x13f9f0)[_0xc906('0x2c')](_0x41375b);};}exports['index']=function(_0x51c559,_0x46d9cd){var _0xfc373={},_0x49a499={},_0x6d0101={'count':0x0,'rows':[]};return db[_0xc906('0x2d')][_0xc906('0x2e')]()[_0xc906('0x25')](function(_0x2b9a4d){_0x49a499['model']=_[_0xc906('0x2f')](_0x2b9a4d);_0x49a499['query']=_[_0xc906('0x2f')](_0x51c559[_0xc906('0x30')]);_0x49a499[_0xc906('0x31')]=_[_0xc906('0x32')](_0x49a499[_0xc906('0x33')],_0x49a499[_0xc906('0x30')]);_0xfc373[_0xc906('0x34')]=_[_0xc906('0x32')](_0x49a499['model'],qs[_0xc906('0x35')](_0x51c559[_0xc906('0x30')][_0xc906('0x35')]));_0xfc373[_0xc906('0x34')]=_0xfc373[_0xc906('0x34')][_0xc906('0x36')]?_0xfc373[_0xc906('0x34')]:_0x49a499[_0xc906('0x33')];if(!_0x51c559[_0xc906('0x30')]['hasOwnProperty'](_0xc906('0x37'))){_0xfc373[_0xc906('0x1e')]=qs[_0xc906('0x1e')](_0x51c559[_0xc906('0x30')][_0xc906('0x1e')]);_0xfc373[_0xc906('0x1d')]=qs[_0xc906('0x1d')](_0x51c559[_0xc906('0x30')][_0xc906('0x1d')]);}_0xfc373[_0xc906('0x38')]=qs[_0xc906('0x39')](_0x51c559[_0xc906('0x30')]['sort']);_0xfc373[_0xc906('0x3a')]=qs[_0xc906('0x31')](_[_0xc906('0x3b')](_0x51c559[_0xc906('0x30')],_0x49a499[_0xc906('0x31')]),_0x2b9a4d);if(_0x51c559[_0xc906('0x30')]['filter']){_0xfc373[_0xc906('0x3a')]=_[_0xc906('0x3c')](_0xfc373[_0xc906('0x3a')],{'$or':_[_0xc906('0x3d')](_0xfc373[_0xc906('0x34')],function(_0x5e525c){var _0x478eb2={};_0x478eb2[_0x5e525c]={'$like':'%'+_0x51c559[_0xc906('0x30')][_0xc906('0x3e')]+'%'};return _0x478eb2;})});}_0xfc373=_['merge']({},_0xfc373,_0x51c559[_0xc906('0x3f')]);var _0x38e48e={'where':_0xfc373['where']};return db['CmCompany'][_0xc906('0x40')](_0x38e48e)[_0xc906('0x25')](function(_0x4d5a21){_0x6d0101[_0xc906('0x40')]=_0x4d5a21;if(_0x51c559[_0xc906('0x30')][_0xc906('0x41')]){_0xfc373[_0xc906('0x42')]=[{'all':!![]}];}return db[_0xc906('0x2d')][_0xc906('0x43')](_0xfc373);})[_0xc906('0x25')](function(_0x7d7531){_0x6d0101[_0xc906('0x44')]=_0x7d7531;return _0x6d0101;})[_0xc906('0x25')](respondWithFilteredResult(_0x46d9cd,_0xfc373))[_0xc906('0x45')](handleError(_0x46d9cd,null));})['catch'](handleError(_0x46d9cd,null));};exports[_0xc906('0x46')]=function(_0x3e84a9,_0x4cd25e){var _0x20ff13={'raw':![],'where':{'id':_0x3e84a9[_0xc906('0x47')]['id']}},_0x401cb2={};_0x401cb2[_0xc906('0x33')]=_[_0xc906('0x2f')](db[_0xc906('0x2d')]['rawAttributes']);_0x401cb2[_0xc906('0x30')]=_['keys'](_0x3e84a9['query']);_0x401cb2[_0xc906('0x31')]=_[_0xc906('0x32')](_0x401cb2[_0xc906('0x33')],_0x401cb2[_0xc906('0x30')]);_0x20ff13[_0xc906('0x34')]=_[_0xc906('0x32')](_0x401cb2[_0xc906('0x33')],qs[_0xc906('0x35')](_0x3e84a9[_0xc906('0x30')][_0xc906('0x35')]));_0x20ff13[_0xc906('0x34')]=_0x20ff13[_0xc906('0x34')][_0xc906('0x36')]?_0x20ff13[_0xc906('0x34')]:_0x401cb2['model'];if(_0x3e84a9['query'][_0xc906('0x41')]){_0x20ff13[_0xc906('0x42')]=[{'all':!![]}];}_0x20ff13=_['merge']({},_0x20ff13,_0x3e84a9['options']);return db[_0xc906('0x2d')][_0xc906('0x48')](_0x20ff13)[_0xc906('0x25')](handleEntityNotFound(_0x4cd25e,null))[_0xc906('0x25')](respondWithResult(_0x4cd25e,null))[_0xc906('0x45')](handleError(_0x4cd25e,null));};exports['create']=function(_0x2f71b2,_0x3775f0){return db[_0xc906('0x2d')][_0xc906('0x49')](_0x2f71b2['body'],{})['then'](function(_0x4b61f3){var _0x2d8f79=_0x2f71b2['user']['get']({'plain':!![]});if(!_0x2d8f79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d8f79['role']===_0xc906('0x4a')){var _0x538c70=_0x4b61f3[_0xc906('0x27')]({'plain':!![]});var _0x4c532a='Companies';return db[_0xc906('0x4b')][_0xc906('0x48')]({'where':{'name':_0x4c532a,'userProfileId':_0x2d8f79[_0xc906('0x4c')]},'raw':!![]})['then'](function(_0x57535f){if(_0x57535f&&_0x57535f['autoAssociation']===0x0){return db[_0xc906('0x4d')][_0xc906('0x49')]({'name':_0x538c70[_0xc906('0x2b')],'resourceId':_0x538c70['id'],'type':_0x57535f[_0xc906('0x2b')],'sectionId':_0x57535f['id']},{})[_0xc906('0x25')](function(){return _0x4b61f3;});}else{return _0x4b61f3;}})[_0xc906('0x45')](function(_0x2b90e2){logger[_0xc906('0x29')](_0xc906('0x4e'),_0x2b90e2);throw _0x2b90e2;});}return _0x4b61f3;})[_0xc906('0x25')](respondWithResult(_0x3775f0,0xc9))[_0xc906('0x45')](handleError(_0x3775f0,null));};exports[_0xc906('0x24')]=function(_0x594d02,_0x3e0103){if(_0x594d02[_0xc906('0x4f')]['id']){delete _0x594d02[_0xc906('0x4f')]['id'];}return db['CmCompany'][_0xc906('0x48')]({'where':{'id':_0x594d02[_0xc906('0x47')]['id']}})[_0xc906('0x25')](handleEntityNotFound(_0x3e0103,null))[_0xc906('0x25')](saveUpdates(_0x594d02[_0xc906('0x4f')],null))[_0xc906('0x25')](respondWithResult(_0x3e0103,null))[_0xc906('0x45')](handleError(_0x3e0103,null));};exports['destroy']=function(_0x3e899c,_0x1b5728){return db[_0xc906('0x2d')][_0xc906('0x48')]({'where':{'id':_0x3e899c['params']['id']}})[_0xc906('0x25')](handleEntityNotFound(_0x1b5728,null))[_0xc906('0x25')](removeEntity(_0x1b5728,null))['catch'](handleError(_0x1b5728,null));};exports[_0xc906('0x2e')]=function(_0x468466,_0xc01166){return db[_0xc906('0x2d')][_0xc906('0x2e')]()[_0xc906('0x25')](respondWithResult(_0xc01166,null))['catch'](handleError(_0xc01166,null));};exports[_0xc906('0x50')]=function(_0x3008f2,_0x228e69,_0x4deca6){return db['CmContact'][_0xc906('0x48')]({'where':{'id':_0x3008f2[_0xc906('0x47')]['id']}})['then'](handleEntityNotFound(_0x228e69,null))[_0xc906('0x25')](function(_0x445c3c){if(_0x445c3c){return _0x445c3c[_0xc906('0x50')](_0x3008f2[_0xc906('0x4f')][_0xc906('0x51')],_[_0xc906('0x52')](_0x3008f2['body'],['ids','id'])||{});}})[_0xc906('0x25')](respondWithResult(_0x228e69,null))[_0xc906('0x45')](handleError(_0x228e69,null));};exports[_0xc906('0x53')]=function(_0x9dd6db,_0x219391,_0x16aea4){var _0xf64792={};var _0xdf385d={};var _0x38e661;var _0x435ffb;return db[_0xc906('0x2d')][_0xc906('0x54')]({'where':{'id':_0x9dd6db[_0xc906('0x47')]['id']}})[_0xc906('0x25')](handleEntityNotFound(_0x219391,null))[_0xc906('0x25')](function(_0x119e86){if(_0x119e86){_0x38e661=_0x119e86;_0xdf385d[_0xc906('0x33')]=_[_0xc906('0x2f')](db[_0xc906('0x55')][_0xc906('0x56')]);_0xdf385d[_0xc906('0x30')]=_[_0xc906('0x2f')](_0x9dd6db[_0xc906('0x30')]);_0xdf385d['filters']=_[_0xc906('0x32')](_0xdf385d['model'],_0xdf385d['query']);_0xf64792[_0xc906('0x34')]=_[_0xc906('0x32')](_0xdf385d[_0xc906('0x33')],qs[_0xc906('0x35')](_0x9dd6db[_0xc906('0x30')][_0xc906('0x35')]));_0xf64792[_0xc906('0x34')]=_0xf64792[_0xc906('0x34')][_0xc906('0x36')]?_0xf64792[_0xc906('0x34')]:_0xdf385d[_0xc906('0x33')];_0xf64792[_0xc906('0x38')]=qs[_0xc906('0x39')](_0x9dd6db[_0xc906('0x30')][_0xc906('0x39')]);_0xf64792[_0xc906('0x3a')]=qs[_0xc906('0x31')](_[_0xc906('0x3b')](_0x9dd6db['query'],_0xdf385d['filters']));if(_0x9dd6db[_0xc906('0x30')][_0xc906('0x3e')]){_0xf64792[_0xc906('0x3a')]=_[_0xc906('0x3c')](_0xf64792[_0xc906('0x3a')],{'$or':_[_0xc906('0x3d')](_0xf64792[_0xc906('0x34')],function(_0x28092a){var _0x1cc1b3={};_0x1cc1b3[_0x28092a]={'$like':'%'+_0x9dd6db[_0xc906('0x30')][_0xc906('0x3e')]+'%'};return _0x1cc1b3;})});}_0xf64792=_[_0xc906('0x3c')]({},_0xf64792,_0x9dd6db[_0xc906('0x3f')]);return _0x38e661[_0xc906('0x53')](_0xf64792);}})[_0xc906('0x25')](function(_0x46f449){if(_0x46f449){_0x435ffb=_0x46f449[_0xc906('0x36')];if(!_0x9dd6db['query'][_0xc906('0x57')](_0xc906('0x37'))){_0xf64792[_0xc906('0x1e')]=qs['limit'](_0x9dd6db[_0xc906('0x30')][_0xc906('0x1e')]);_0xf64792[_0xc906('0x1d')]=qs[_0xc906('0x1d')](_0x9dd6db[_0xc906('0x30')]['offset']);}return _0x38e661[_0xc906('0x53')](_0xf64792);}})[_0xc906('0x25')](function(_0x14a88a){if(_0x14a88a){return _0x14a88a?{'count':_0x435ffb,'rows':_0x14a88a}:null;}})[_0xc906('0x25')](respondWithResult(_0x219391,null))[_0xc906('0x45')](handleError(_0x219391,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 54e1eeb..754745f 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 _0x2767=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','CmCompany','cm_companies'];(function(_0x20e07a,_0x53d32e){var _0xacd186=function(_0x387593){while(--_0x387593){_0x20e07a['push'](_0x20e07a['shift']());}};_0xacd186(++_0x53d32e);}(_0x2767,0x8f));var _0x7276=function(_0x42dd13,_0x408c01){_0x42dd13=_0x42dd13-0x0;var _0x18cfdd=_0x2767[_0x42dd13];return _0x18cfdd;};'use strict';var _=require(_0x7276('0x0'));var util=require(_0x7276('0x1'));var logger=require(_0x7276('0x2'))(_0x7276('0x3'));var moment=require(_0x7276('0x4'));var BPromise=require(_0x7276('0x5'));var rp=require(_0x7276('0x6'));var fs=require('fs');var path=require(_0x7276('0x7'));var rimraf=require(_0x7276('0x8'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x7276('0x9')]=function(_0x6d8f27,_0x42cfed){return _0x6d8f27[_0x7276('0xa')](_0x7276('0xb'),attributes,{'tableName':_0x7276('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe27=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','lodash','util','../../config/logger','api','moment'];(function(_0xb3747a,_0x660f3d){var _0x94e9ba=function(_0x17a9c0){while(--_0x17a9c0){_0xb3747a['push'](_0xb3747a['shift']());}};_0x94e9ba(++_0x660f3d);}(_0xfe27,0x127));var _0x7fe2=function(_0x3e38c3,_0x27971b){_0x3e38c3=_0x3e38c3-0x0;var _0x98b7e2=_0xfe27[_0x3e38c3];return _0x98b7e2;};'use strict';var _=require(_0x7fe2('0x0'));var util=require(_0x7fe2('0x1'));var logger=require(_0x7fe2('0x2'))(_0x7fe2('0x3'));var moment=require(_0x7fe2('0x4'));var BPromise=require(_0x7fe2('0x5'));var rp=require(_0x7fe2('0x6'));var fs=require('fs');var path=require(_0x7fe2('0x7'));var rimraf=require(_0x7fe2('0x8'));var config=require(_0x7fe2('0x9'));var attributes=require(_0x7fe2('0xa'));module[_0x7fe2('0xb')]=function(_0x5d3875,_0x2e43e8){return _0x5d3875['define']('CmCompany',attributes,{'tableName':'cm_companies','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 3cdb30c..29cd695 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 _0x0f40=['jayson/promise','client','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xdcbbb,_0x39b964){var _0x19bb4e=function(_0x4952b7){while(--_0x4952b7){_0xdcbbb['push'](_0xdcbbb['shift']());}};_0x19bb4e(++_0x39b964);}(_0x0f40,0xc9));var _0x00f4=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0x0f40[_0x59522a];return _0x30f09d;};'use strict';var _=require(_0x00f4('0x0'));var util=require(_0x00f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x00f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00f4('0x3'))['db'];var utils=require(_0x00f4('0x4'));var logger=require(_0x00f4('0x5'))(_0x00f4('0x6'));var config=require(_0x00f4('0x7'));var jayson=require(_0x00f4('0x8'));var client=jayson[_0x00f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed2f9,_0xd66c18,_0x36001c){return new BPromise(function(_0x10fb70,_0x13b260){return client['request'](_0x2ed2f9,_0x36001c)['then'](function(_0x3aa3bb){logger['info'](_0x00f4('0xa'),_0xd66c18,_0x00f4('0xb'));logger[_0x00f4('0xc')](_0x00f4('0xd'),_0xd66c18,_0x00f4('0xb'),JSON['stringify'](_0x3aa3bb));if(_0x3aa3bb[_0x00f4('0xe')]){if(_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0xf')]===0x1f4){logger['error'](_0x00f4('0xa'),_0xd66c18,_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0x10')]);return _0x13b260(_0x3aa3bb['error']['message']);}logger[_0x00f4('0xe')](_0x00f4('0xa'),_0xd66c18,_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0x10')]);return _0x10fb70(_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0x10')]);}else{logger['info'](_0x00f4('0xa'),_0xd66c18,_0x00f4('0xb'));_0x10fb70(_0x3aa3bb[_0x00f4('0x11')][_0x00f4('0x10')]);}})[_0x00f4('0x12')](function(_0x5a8da2){logger[_0x00f4('0xe')](_0x00f4('0xa'),_0xd66c18,_0x5a8da2);_0x13b260(_0x5a8da2);});});} \ No newline at end of file +var _0x473c=['info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','code','error','CmCompany,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x4193ea,_0x4df371){var _0x2d4a6b=function(_0x434835){while(--_0x434835){_0x4193ea['push'](_0x4193ea['shift']());}};_0x2d4a6b(++_0x4df371);}(_0x473c,0x88));var _0xc473=function(_0x356dfb,_0x561ad6){_0x356dfb=_0x356dfb-0x0;var _0x782a63=_0x473c[_0x356dfb];return _0x782a63;};'use strict';var _=require('lodash');var util=require(_0xc473('0x0'));var moment=require(_0xc473('0x1'));var BPromise=require('bluebird');var rs=require(_0xc473('0x2'));var fs=require('fs');var Redis=require(_0xc473('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc473('0x4'))(_0xc473('0x5'));var config=require('../../config/environment');var jayson=require(_0xc473('0x6'));var client=jayson[_0xc473('0x7')][_0xc473('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x753238,_0x195c02,_0x4cb7cb){return new BPromise(function(_0x1bf76d,_0x1c353d){return client[_0xc473('0x9')](_0x753238,_0x4cb7cb)[_0xc473('0xa')](function(_0x7dbcf6){logger[_0xc473('0xb')]('CmCompany,\x20%s,\x20%s',_0x195c02,_0xc473('0xc'));logger[_0xc473('0xd')](_0xc473('0xe'),_0x195c02,_0xc473('0xc'),JSON['stringify'](_0x7dbcf6));if(_0x7dbcf6['error']){if(_0x7dbcf6['error'][_0xc473('0xf')]===0x1f4){logger[_0xc473('0x10')](_0xc473('0x11'),_0x195c02,_0x7dbcf6[_0xc473('0x10')]['message']);return _0x1c353d(_0x7dbcf6[_0xc473('0x10')][_0xc473('0x12')]);}logger[_0xc473('0x10')](_0xc473('0x11'),_0x195c02,_0x7dbcf6[_0xc473('0x10')][_0xc473('0x12')]);return _0x1bf76d(_0x7dbcf6[_0xc473('0x10')][_0xc473('0x12')]);}else{logger[_0xc473('0xb')](_0xc473('0x11'),_0x195c02,_0xc473('0xc'));_0x1bf76d(_0x7dbcf6[_0xc473('0x13')][_0xc473('0x12')]);}})[_0xc473('0x14')](function(_0x4eb877){logger[_0xc473('0x10')]('CmCompany,\x20%s,\x20%s',_0x195c02,_0x4eb877);_0x1c353d(_0x4eb877);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0e1c7ba..49723bf 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 _0x66a3=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','create','post','addContacts'];(function(_0x1e032e,_0xcaea0a){var _0x3dc166=function(_0x2710fb){while(--_0x2710fb){_0x1e032e['push'](_0x1e032e['shift']());}};_0x3dc166(++_0xcaea0a);}(_0x66a3,0x1c5));var _0x366a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x366a('0x0'));var util=require(_0x366a('0x1'));var path=require(_0x366a('0x2'));var timeout=require(_0x366a('0x3'));var express=require(_0x366a('0x4'));var router=express[_0x366a('0x5')]();var fs_extra=require(_0x366a('0x6'));var auth=require(_0x366a('0x7'));var interaction=require(_0x366a('0x8'));var config=require(_0x366a('0x9'));var controller=require(_0x366a('0xa'));router[_0x366a('0xb')]('/',auth[_0x366a('0xc')](),controller[_0x366a('0xd')]);router['get'](_0x366a('0xe'),auth[_0x366a('0xc')](),controller['describe']);router['get'](_0x366a('0xf'),auth[_0x366a('0xc')](),controller[_0x366a('0x10')]);router[_0x366a('0xb')](_0x366a('0x11'),auth[_0x366a('0xc')](),controller[_0x366a('0x12')]);router['post']('/',auth[_0x366a('0xc')](),controller[_0x366a('0x13')]);router[_0x366a('0x14')]('/:id/contacts',auth[_0x366a('0xc')](),controller[_0x366a('0x15')]);router[_0x366a('0x16')](_0x366a('0xf'),auth[_0x366a('0xc')](),controller[_0x366a('0x17')]);router[_0x366a('0x18')]('/:id',auth[_0x366a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa0ef=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getContacts','create','post','addContacts','put','update','delete','multer'];(function(_0x5fa9c0,_0x5a5fa7){var _0x12000a=function(_0x35a256){while(--_0x35a256){_0x5fa9c0['push'](_0x5fa9c0['shift']());}};_0x12000a(++_0x5a5fa7);}(_0xa0ef,0xf1));var _0xfa0e=function(_0x42e5da,_0x1a7f02){_0x42e5da=_0x42e5da-0x0;var _0x8d741d=_0xa0ef[_0x42e5da];return _0x8d741d;};'use strict';var multer=require(_0xfa0e('0x0'));var util=require('util');var path=require(_0xfa0e('0x1'));var timeout=require('connect-timeout');var express=require(_0xfa0e('0x2'));var router=express[_0xfa0e('0x3')]();var fs_extra=require(_0xfa0e('0x4'));var auth=require(_0xfa0e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa0e('0x6'));var controller=require(_0xfa0e('0x7'));router[_0xfa0e('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa0e('0x9')]);router[_0xfa0e('0x8')](_0xfa0e('0xa'),auth['isAuthenticated'](),controller[_0xfa0e('0xb')]);router[_0xfa0e('0x8')](_0xfa0e('0xc'),auth[_0xfa0e('0xd')](),controller[_0xfa0e('0xe')]);router[_0xfa0e('0x8')]('/:id/contacts',auth[_0xfa0e('0xd')](),controller[_0xfa0e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa0e('0x10')]);router[_0xfa0e('0x11')]('/:id/contacts',auth[_0xfa0e('0xd')](),controller[_0xfa0e('0x12')]);router[_0xfa0e('0x13')](_0xfa0e('0xc'),auth[_0xfa0e('0xd')](),controller[_0xfa0e('0x14')]);router[_0xfa0e('0x15')](_0xfa0e('0xc'),auth[_0xfa0e('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0efef7f..23c2a85 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 _0xf5f3=['NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xf5f3,0xb9));var _0x3f5f=function(_0x563828,_0xa51f73){_0x563828=_0x563828-0x0;var _0x3508d2=_0xf5f3[_0x563828];return _0x3508d2;};'use strict';var _=require('lodash');var Sequelize=require(_0x3f5f('0x0'));module[_0x3f5f('0x1')]={'firstName':{'type':Sequelize[_0x3f5f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3f5f('0x2')]},'street':{'type':Sequelize[_0x3f5f('0x2')]},'postalCode':{'type':Sequelize[_0x3f5f('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3f5f('0x2')]},'dateOfBirth':{'type':Sequelize[_0x3f5f('0x2')]},'description':{'type':Sequelize[_0x3f5f('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3f5f('0x2')]},'email':{'type':Sequelize[_0x3f5f('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x3f5f('0x2')]},'twitter':{'type':Sequelize[_0x3f5f('0x2')]},'skype':{'type':Sequelize[_0x3f5f('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x3f5f('0x2')]},'line':{'type':Sequelize[_0x3f5f('0x2')]},'wechat':{'type':Sequelize[_0x3f5f('0x2')]},'telegram':{'type':Sequelize[_0x3f5f('0x2')]},'UserId':{'type':Sequelize[_0x3f5f('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3f5f('0x4')](0x2)[_0x3f5f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3f5f('0x6')],'defaultValue':Sequelize[_0x3f5f('0x7')]},'dialTimezone':{'type':Sequelize[_0x3f5f('0x2')]},'utcOffset':{'type':Sequelize[_0x3f5f('0x4')]}}; \ No newline at end of file +var _0xe2f6=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe2f6,0x1cd));var _0x6e2f=function(_0x5de61a,_0x43ead4){_0x5de61a=_0x5de61a-0x0;var _0x4bed02=_0xe2f6[_0x5de61a];return _0x4bed02;};'use strict';var _=require(_0x6e2f('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x6e2f('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6e2f('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6e2f('0x1')]},'country':{'type':Sequelize[_0x6e2f('0x1')]},'dateOfBirth':{'type':Sequelize[_0x6e2f('0x1')]},'description':{'type':Sequelize[_0x6e2f('0x2')]},'phone':{'type':Sequelize[_0x6e2f('0x1')]},'mobile':{'type':Sequelize[_0x6e2f('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6e2f('0x1')]},'url':{'type':Sequelize[_0x6e2f('0x1')]},'facebook':{'type':Sequelize[_0x6e2f('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x6e2f('0x1')]},'skype':{'type':Sequelize[_0x6e2f('0x1')]},'teams':{'type':Sequelize[_0x6e2f('0x1')]},'viber':{'type':Sequelize[_0x6e2f('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x6e2f('0x1')]},'telegram':{'type':Sequelize[_0x6e2f('0x1')]},'UserId':{'type':Sequelize[_0x6e2f('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x6e2f('0x1')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x6e2f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6e2f('0x5')],'defaultValue':Sequelize[_0x6e2f('0x6')]},'dialTimezone':{'type':Sequelize[_0x6e2f('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ea42a4c..4391630 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 9efe812..994301c 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 _0x0b8c=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4458f3,_0x4056f9){var _0x28db0e=function(_0x3ad12b){while(--_0x3ad12b){_0x4458f3['push'](_0x4458f3['shift']());}};_0x28db0e(++_0x4056f9);}(_0x0b8c,0x9f));var _0xc0b8=function(_0x21b088,_0x1facfb){_0x21b088=_0x21b088-0x0;var _0x816fb0=_0x0b8c[_0x21b088];return _0x816fb0;};'use strict';var EventEmitter=require(_0xc0b8('0x0'));var CmContact=require(_0xc0b8('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc0b8('0x2')](0x0);var events={'afterCreate':_0xc0b8('0x3'),'afterUpdate':_0xc0b8('0x4'),'afterDestroy':_0xc0b8('0x5')};function emitEvent(_0x3fa859){return function(_0x5cc64e,_0x54e104,_0x4ead87){CmContactEvents[_0xc0b8('0x6')](_0x3fa859+':'+_0x5cc64e['id'],_0x5cc64e);CmContactEvents['emit'](_0x3fa859,_0x5cc64e);_0x4ead87(null);};}for(var e in events){if(events[_0xc0b8('0x7')](e)){var event=events[e];CmContact[_0xc0b8('0x8')](e,emitEvent(event));}}module[_0xc0b8('0x9')]=CmContactEvents; \ No newline at end of file +var _0x3aec=['hook','../../mysqldb','CmContact','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x54023e,_0x46ea57){var _0x2f5591=function(_0x4b7349){while(--_0x4b7349){_0x54023e['push'](_0x54023e['shift']());}};_0x2f5591(++_0x46ea57);}(_0x3aec,0x1d9));var _0xc3ae=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x3aec[_0x3740fe];return _0x55492b;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xc3ae('0x0'))['db'][_0xc3ae('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc3ae('0x2')](0x0);var events={'afterCreate':_0xc3ae('0x3'),'afterUpdate':'update','afterDestroy':_0xc3ae('0x4')};function emitEvent(_0x8bd333){return function(_0x3a758e,_0x45a230,_0x47842b){CmContactEvents['emit'](_0x8bd333+':'+_0x3a758e['id'],_0x3a758e);CmContactEvents[_0xc3ae('0x5')](_0x8bd333,_0x3a758e);_0x47842b(null);};}for(var e in events){if(events[_0xc3ae('0x6')](e)){var event=events[e];CmContact[_0xc3ae('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 53e0e0f..38b6286 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 _0xc03a=['dialCheckDuplicateType','CmList','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Lists','message','List\x20not\x20found','models','isEmpty','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment/shared','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','Campaign','add','\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','findAll','outbound'];(function(_0x5c7f6d,_0x5d03a3){var _0x128160=function(_0x177de9){while(--_0x177de9){_0x5c7f6d['push'](_0x5c7f6d['shift']());}};_0x128160(++_0x5d03a3);}(_0xc03a,0x180));var _0xac03=function(_0x24afdb,_0x4ef53b){_0x24afdb=_0x24afdb-0x0;var _0x3c4604=_0xc03a[_0x24afdb];return _0x3c4604;};'use strict';var _=require(_0xac03('0x0'));var util=require(_0xac03('0x1'));var logger=require(_0xac03('0x2'))(_0xac03('0x3'));var moment=require('moment');var BPromise=require(_0xac03('0x4'));var rp=require(_0xac03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac03('0x6'));var config=require('../../config/environment');var shared=require(_0xac03('0x7'));var attributes=require('./cmContact.attributes');module[_0xac03('0x8')]=function(_0x229fd6,_0x27999e){return _0x229fd6[_0xac03('0x9')](_0xac03('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xac03('0xb'),'fields':[_0xac03('0xb')]},{'name':_0xac03('0xc'),'fields':[_0xac03('0xd'),_0xac03('0xe'),_0xac03('0xb'),_0xac03('0xf'),_0xac03('0x10'),_0xac03('0x11')],'type':_0xac03('0x12')}],'timestamps':!![],'charset':_0xac03('0x13'),'collate':_0xac03('0x14'),'hooks':{'afterCreate':function(_0x34a4a7,_0x2b2481,_0x10b372){var _0x5a793f=_0x229fd6['models'];var _0x435721=_0x34a4a7[_0xac03('0x15')]({'plain':!![]});function _0x15f402(){return function(_0x5c42b8){logger[_0xac03('0x16')](_0xac03('0x17'),_0xac03('0x18'),util[_0xac03('0x19')](_0x5c42b8,{'showHidden':![],'depth':null}));};}function _0x6193e3(_0x176d20,_0x5e30b5){var _0x3f0529=_0x5e30b5[_0xac03('0x1a')]?_0x5e30b5[_0xac03('0x1a')]:moment()[_0xac03('0x1b')](_0xac03('0x1c'));return new BPromise(function(_0x10a77a,_0x1a6ab9){if(_[_0xac03('0x1d')](_0x5e30b5[_0xac03('0x1e')])){_0x10a77a({'ret':_0x3f0529});}else{_0x5a793f[_0xac03('0x1f')][_0xac03('0x20')]({'where':{'id':_0x176d20['id']}})[_0xac03('0x21')](function(_0x497073){if(!_[_0xac03('0x1d')](_0x497073)){var _0x24db35=_0x497073['dialTimezone'];if(!_['isNil'](_0x24db35)){var _0x2006ec=shared[_0xac03('0x22')];var _0x45fc58=_0x2006ec[_0x24db35];var _0x4aa181=_0x2006ec[_0x5e30b5[_0xac03('0x1e')]];if(!_['isNil'](_0x45fc58)&&!_[_0xac03('0x1d')](_0x4aa181)){var _0x3df97e=_0x45fc58[_0xac03('0x23')]-_0x4aa181[_0xac03('0x23')];_0x3f0529=_0x5e30b5[_0xac03('0x1a')]?_0x5e30b5['scheduledat']:moment();var _0x3b1361=moment(_0x3f0529)['add'](_0x3df97e,'minutes');_0x10a77a({'ret':_0x3b1361[_0xac03('0x1b')](_0xac03('0x1c'))});}else _0x10a77a({'ret':_0x3f0529});}else _0x10a77a({'ret':_0x3f0529});}else{_0x10a77a({'ret':_0x3f0529});}});}});return 0xa;}var _0x313cb8=function(_0x49d934){return new BPromise(function(_0x4573c1,_0x20e94c){_0x6193e3(_0x49d934,_0x435721)[_0xac03('0x21')](function(_0xedc8b9){_0x435721[_0xac03('0x1a')]=_0xedc8b9[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')]['findOne']({'where':{'phone':_0x435721[_0xac03('0xb')],'VoiceQueueId':_0x49d934['id']}})[_0xac03('0x21')](function(_0x160f24){if(!_['isNil'](_0x160f24)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+_0xac03('0x27')+_0x49d934['id']);}return _0x5a793f['CmHopper'][_0xac03('0x28')]({'phone':_0x435721['phone'],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format'](_0xac03('0x1c')),'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721['callbackUniqueid']:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')](_0xac03('0x1c')):undefined,'VoiceQueueId':_0x49d934['id']});})['catch'](function(_0x1c26f2){_0x20e94c(_0x1c26f2);});});});};var _0x460003=function(_0x346474){return new BPromise(function(_0x28e8cf,_0x500b9e){_0x6193e3(_0x346474,_0x435721)['then'](function(_0xa8842f){_0x435721[_0xac03('0x1a')]=_0xa8842f[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')]['findOne']({'where':{'phone':_0x435721[_0xac03('0xb')],'VoiceQueueId':_0x346474['id']}})[_0xac03('0x21')](function(_0x151f9a){if(!_['isNil'](_0x151f9a)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x346474['id']);}return _0x5a793f['CmHopperFinal'][_0xac03('0x20')]({'where':{'calleridnum':_0x435721['phone'],'VoiceQueueId':_0x346474['id']}});})[_0xac03('0x21')](function(_0x18f92e){if(!_[_0xac03('0x1d')](_0x18f92e)){throw new Error(_0xac03('0x2c')+_0x435721['phone']+_0xac03('0x2d')+_0x346474['id']);}return _0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721['phone'],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format'](_0xac03('0x1c')),'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721['callbackUniqueid']?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721['callbackUniqueid']?moment()[_0xac03('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x346474['id']});})[_0xac03('0x2e')](function(_0x3ca718){_0x500b9e(_0x3ca718);});});});};function _0x5d12c8(){return function(_0x2b85e5){logger[_0xac03('0x16')](_0xac03('0x17'),_0xac03('0x18'),util[_0xac03('0x19')](_0x2b85e5,{'showHidden':![],'depth':null}));};}function _0x58beac(_0x3ab85e,_0x947bea){var _0x2767c9=_0x947bea['scheduledat']?_0x947bea[_0xac03('0x1a')]:moment()[_0xac03('0x1b')](_0xac03('0x1c'));return new BPromise(function(_0x130d50,_0x520ac5){if(_[_0xac03('0x1d')](_0x947bea[_0xac03('0x1e')])){_0x130d50({'ret':_0x2767c9});}else{_0x5a793f[_0xac03('0x2f')][_0xac03('0x20')]({'where':{'id':_0x3ab85e['id']}})[_0xac03('0x21')](function(_0x55acc8){if(!_[_0xac03('0x1d')](_0x55acc8)){var _0x34289a=_0x55acc8[_0xac03('0x1e')];if(!_[_0xac03('0x1d')](_0x34289a)){var _0x1480ce=shared[_0xac03('0x22')];var _0x4a324d=_0x1480ce[_0x34289a];var _0x3d9821=_0x1480ce[_0x947bea[_0xac03('0x1e')]];if(!_[_0xac03('0x1d')](_0x4a324d)&&!_['isNil'](_0x3d9821)){var _0x39fe2d=_0x4a324d[_0xac03('0x23')]-_0x3d9821[_0xac03('0x23')];_0x2767c9=_0x947bea[_0xac03('0x1a')]?_0x947bea[_0xac03('0x1a')]:moment();var _0x1d51dc=moment(_0x2767c9)[_0xac03('0x30')](_0x39fe2d,'minutes');_0x130d50({'ret':_0x1d51dc[_0xac03('0x1b')](_0xac03('0x1c'))});}else _0x130d50({'ret':_0x2767c9});}else _0x130d50({'ret':_0x2767c9});}else{_0x130d50({'ret':_0x2767c9});}});}});return 0xa;}var _0x3e5faf=function(_0x30161c){return new BPromise(function(_0x35e0d3,_0x5dd99b){_0x58beac(_0x30161c,_0x435721)[_0xac03('0x21')](function(_0x288b50){_0x435721['scheduledat']=_0x288b50[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')][_0xac03('0x20')]({'where':{'phone':_0x435721[_0xac03('0xb')],'CampaignId':_0x30161c['id']}})[_0xac03('0x21')](function(_0x4a2437){if(!_[_0xac03('0x1d')](_0x4a2437)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+_0xac03('0x31')+_0x30161c['id']);}return _0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721['ListId'],'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721['scheduledat']:moment()[_0xac03('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x30161c['id']});})[_0xac03('0x2e')](function(_0x1f60d9){_0x5dd99b(_0x1f60d9);});});});};var _0x1e86d8=function(_0x5ce735){return new BPromise(function(_0x1d2a96,_0x157157){_0x58beac(_0x5ce735,_0x435721)['then'](function(_0x537825){_0x435721[_0xac03('0x1a')]=_0x537825[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')][_0xac03('0x20')]({'where':{'phone':_0x435721[_0xac03('0xb')],'CampaignId':_0x5ce735['id']}})[_0xac03('0x21')](function(_0x582463){if(!_[_0xac03('0x1d')](_0x582463)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+_0xac03('0x32')+_0x5ce735['id']);}return _0x5a793f['CmHopperFinal'][_0xac03('0x20')]({'where':{'calleridnum':_0x435721['phone'],'CampaignId':_0x5ce735['id']}});})[_0xac03('0x21')](function(_0x491ab7){if(!_[_0xac03('0x1d')](_0x491ab7)){throw new Error(_0xac03('0x2c')+_0x435721['phone']+_0xac03('0x33')+_0x5ce735['id']);}return _0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'priority':_0x435721['priority']?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format'](_0xac03('0x1c')),'callback':_0x435721['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x435721['callbackUniqueid']?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')](_0xac03('0x1c')):undefined,'CampaignId':_0x5ce735['id']});})[_0xac03('0x2e')](function(_0x389d8f){_0x157157(_0x389d8f);});});});};if(_0x435721[_0xac03('0x29')]){_0x5a793f[_0xac03('0x1f')][_0xac03('0x34')]({'where':{'type':_0xac03('0x35')},'attributes':['id',_0xac03('0x36'),_0xac03('0x1e')],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':'Lists','where':{'id':_0x435721[_0xac03('0x29')]}}]})[_0xac03('0x21')](function(_0x2d8489){if(_0x2d8489){var _0x4048ce=[];for(var _0x440111=0x0,_0x13b53a;_0x440111<_0x2d8489[_0xac03('0x38')];_0x440111+=0x1){_0x13b53a=_0x2d8489[_0x440111][_0xac03('0x15')]({'plain':!![]});switch(_0x13b53a['dialCheckDuplicateType']){case _0xac03('0x39'):_0x460003(_0x13b53a)['catch'](_0x15f402());break;case _0xac03('0x3a'):_0x313cb8(_0x13b53a)['catch'](_0x15f402());break;default:_0x58beac(_0x13b53a,_0x435721)[_0xac03('0x21')](function(_0x3298c8){_0x435721[_0xac03('0x1a')]=_0x3298c8[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721['ListId'],'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721['callbackUniqueid']:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')](_0xac03('0x1c')):undefined,'VoiceQueueId':_0x13b53a['id']})['catch'](_0x15f402());});}}}})[_0xac03('0x21')](function(){return _0x5a793f[_0xac03('0x1f')][_0xac03('0x34')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':_0xac03('0x3b'),'where':{'id':_0x435721[_0xac03('0x29')]}}]})[_0xac03('0x21')](function(_0x27e0e0){if(_0x27e0e0){var _0xa8a87a=[];for(var _0x29a0b7=0x0,_0x4df0a3;_0x29a0b7<_0x27e0e0[_0xac03('0x38')];_0x29a0b7+=0x1){_0x4df0a3=_0x27e0e0[_0x29a0b7][_0xac03('0x15')]({'plain':!![]});_0x5a793f[_0xac03('0x3c')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721['ListId'],'VoiceQueueId':_0x4df0a3['id']})[_0xac03('0x2e')](function(_0x1a4f7e){logger[_0xac03('0x16')](_0xac03('0x3d'),'afterCreate',_0x1a4f7e['message']);});}}});})[_0xac03('0x21')](function(){return _0x5a793f['Campaign']['findAll']({'attributes':['id',_0xac03('0x36'),'dialTimezone'],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':_0xac03('0x3e'),'where':{'id':_0x435721[_0xac03('0x29')]}}]})['then'](function(_0x5d0b5c){if(_0x5d0b5c){var _0x1d06e3=[];for(var _0x68ef6f=0x0,_0x559a3d;_0x68ef6f<_0x5d0b5c[_0xac03('0x38')];_0x68ef6f+=0x1){_0x559a3d=_0x5d0b5c[_0x68ef6f][_0xac03('0x15')]({'plain':!![]});switch(_0x559a3d[_0xac03('0x36')]){case _0xac03('0x39'):_0x1e86d8(_0x559a3d)[_0xac03('0x2e')](_0x5d12c8());break;case _0xac03('0x3a'):_0x3e5faf(_0x559a3d)[_0xac03('0x2e')](_0x5d12c8());break;default:_0x5a793f[_0xac03('0x25')]['create']({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'scheduledat':_0x435721['scheduledat']?_0x435721['scheduledat']:moment()[_0xac03('0x1b')](_0xac03('0x1c')),'priority':_0x435721['priority']?_0x435721[_0xac03('0x2a')]:0x2,'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x559a3d['id']})[_0xac03('0x2e')](_0x5d12c8());}}}});})[_0xac03('0x21')](function(){return _0x5a793f['Campaign'][_0xac03('0x34')]({'attributes':['id'],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':_0xac03('0x3b'),'where':{'id':_0x435721[_0xac03('0x29')]}}]})[_0xac03('0x21')](function(_0x593050){if(_0x593050){var _0x371dd9=[];for(var _0xe9e4dd=0x0,_0x1feba7;_0xe9e4dd<_0x593050['length'];_0xe9e4dd+=0x1){_0x1feba7=_0x593050[_0xe9e4dd]['get']({'plain':!![]});_0x5a793f[_0xac03('0x3c')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'CampaignId':_0x1feba7['id']})['catch'](function(_0x309bb4){logger[_0xac03('0x16')]('cmContact,\x20%s,\x20%s',_0xac03('0x18'),_0x309bb4[_0xac03('0x3f')]);});}}});})[_0xac03('0x21')](function(){_0x10b372();})['catch'](function(_0x8ebd2a){logger[_0xac03('0x16')]('cmContact,\x20%s,\x20%s',_0xac03('0x18'),_0x8ebd2a[_0xac03('0x3f')]);_0x10b372(_0x8ebd2a);});}else{_0x10b372(new Error(_0xac03('0x40')));}},'afterDestroy':function(_0x39f6d4,_0x5eac76,_0x3e6d7d){var _0x2f84c5=_0x229fd6[_0xac03('0x41')];var _0x3a5bd7=_0x39f6d4[_0xac03('0x15')]({'plain':!![]});return _0x2f84c5[_0xac03('0x25')][_0xac03('0x34')]({'raw':!![],'where':{'ListId':_0x3a5bd7[_0xac03('0x29')],'ContactId':_0x3a5bd7['id']}})[_0xac03('0x21')](function(_0x1ffc5d){if(!_[_0xac03('0x42')](_0x1ffc5d)){var _0x30f305=[];for(var _0x62767c=0x0;_0x62767c<_0x1ffc5d[_0xac03('0x38')];_0x62767c+=0x1){var _0x2d5f34=_0x2f84c5[_0xac03('0x25')]['destroy']({'where':{'ListId':_0x1ffc5d[_0x62767c][_0xac03('0x29')],'ContactId':_0x1ffc5d[_0x62767c][_0xac03('0x43')],'VoiceQueueId':_0x1ffc5d[_0x62767c]['VoiceQueueId'],'CampaignId':_0x1ffc5d[_0x62767c][_0xac03('0x44')]}});_0x30f305[_0xac03('0x45')](_0x2d5f34);}return BPromise['all'](_0x30f305);}})[_0xac03('0x21')](function(_0x5b856d){logger[_0xac03('0x46')](_0xac03('0x47'),util[_0xac03('0x19')](_0x5b856d,{'showHidden':![],'depth':null}));_0x3e6d7d();})[_0xac03('0x2e')](function(_0x29a526){logger[_0xac03('0x16')](_0xac03('0x48'),util[_0xac03('0x19')](_0x29a526,{'showHidden':![],'depth':null}));_0x3e6d7d(_0x29a526);});}}});}; \ No newline at end of file +var _0xcda6=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','callbackUniqueid','catch','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','priority','cmContact','add','\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','outbound','dialCheckDuplicateType','Lists','length','findAll','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','Campaign','BlackLists','message','isEmpty','destroy','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','mobile','fax','email','models','get','error','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','findOne','then','isNil','dialTimezone','timezones','utcOffset','minutes','format','CmHopper'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xcda6,0xf4));var _0x6cda=function(_0x56aa2,_0x30c8ef){_0x56aa2=_0x56aa2-0x0;var _0x42e95c=_0xcda6[_0x56aa2];return _0x42e95c;};'use strict';var _=require(_0x6cda('0x0'));var util=require(_0x6cda('0x1'));var logger=require(_0x6cda('0x2'))(_0x6cda('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6cda('0x4'));var fs=require('fs');var path=require(_0x6cda('0x5'));var rimraf=require(_0x6cda('0x6'));var config=require(_0x6cda('0x7'));var shared=require(_0x6cda('0x8'));var attributes=require(_0x6cda('0x9'));module[_0x6cda('0xa')]=function(_0x5393fa,_0x5de6f6){return _0x5393fa[_0x6cda('0xb')](_0x6cda('0xc'),attributes,{'tableName':_0x6cda('0xd'),'paranoid':!![],'indexes':[{'name':_0x6cda('0xe'),'fields':[_0x6cda('0xe')]},{'name':'fti_cm_contacts','fields':[_0x6cda('0xf'),'lastName',_0x6cda('0xe'),_0x6cda('0x10'),_0x6cda('0x11'),_0x6cda('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x16cc6a,_0x11586c,_0x4bc28e){var _0x1e465d=_0x5393fa[_0x6cda('0x13')];var _0x30abed=_0x16cc6a[_0x6cda('0x14')]({'plain':!![]});function _0x2664fb(){return function(_0x4616e0){logger[_0x6cda('0x15')]('cmContact',_0x6cda('0x16'),util[_0x6cda('0x17')](_0x4616e0,{'showHidden':![],'depth':null}));};}function _0x353a13(_0x34b97d,_0x5aa99e){var _0x57f874=_0x5aa99e[_0x6cda('0x18')]?_0x5aa99e[_0x6cda('0x18')]:moment()['format'](_0x6cda('0x19'));return new BPromise(function(_0x122553,_0x52a99f){if(_['isNil'](_0x5aa99e['dialTimezone'])){_0x122553({'ret':_0x57f874});}else{_0x1e465d[_0x6cda('0x1a')][_0x6cda('0x1b')]({'where':{'id':_0x34b97d['id']}})[_0x6cda('0x1c')](function(_0x42fdf5){if(!_[_0x6cda('0x1d')](_0x42fdf5)){var _0x305d3c=_0x42fdf5[_0x6cda('0x1e')];if(!_['isNil'](_0x305d3c)){var _0x5d825d=shared[_0x6cda('0x1f')];var _0x5aeaec=_0x5d825d[_0x305d3c];var _0x3348fd=_0x5d825d[_0x5aa99e[_0x6cda('0x1e')]];if(!_[_0x6cda('0x1d')](_0x5aeaec)&&!_[_0x6cda('0x1d')](_0x3348fd)){var _0x189851=_0x5aeaec[_0x6cda('0x20')]-_0x3348fd['utcOffset'];_0x57f874=_0x5aa99e[_0x6cda('0x18')]?_0x5aa99e[_0x6cda('0x18')]:moment();var _0x1f9964=moment(_0x57f874)['add'](_0x189851,_0x6cda('0x21'));_0x122553({'ret':_0x1f9964[_0x6cda('0x22')](_0x6cda('0x19'))});}else _0x122553({'ret':_0x57f874});}else _0x122553({'ret':_0x57f874});}else{_0x122553({'ret':_0x57f874});}});}});return 0xa;}var _0x2f01c3=function(_0x53b36c){return new BPromise(function(_0x142194,_0x3278cb){_0x353a13(_0x53b36c,_0x30abed)[_0x6cda('0x1c')](function(_0x59c889){_0x30abed['scheduledat']=_0x59c889['ret'];_0x1e465d[_0x6cda('0x23')][_0x6cda('0x1b')]({'where':{'phone':_0x30abed[_0x6cda('0xe')],'VoiceQueueId':_0x53b36c['id']}})['then'](function(_0x1cd9cc){if(!_[_0x6cda('0x1d')](_0x1cd9cc)){throw new Error('cmContact,\x20afterCreate\x20'+_0x30abed['phone']+_0x6cda('0x24')+_0x53b36c['id']);}return _0x1e465d[_0x6cda('0x23')][_0x6cda('0x25')]({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed[_0x6cda('0x26')],'priority':_0x30abed['priority']?_0x30abed['priority']:0x2,'scheduledat':_0x30abed['scheduledat']?_0x30abed[_0x6cda('0x18')]:moment()[_0x6cda('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x30abed['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x30abed[_0x6cda('0x27')]?_0x30abed[_0x6cda('0x27')]:undefined,'callbackat':_0x30abed[_0x6cda('0x27')]?moment()[_0x6cda('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x53b36c['id']});})[_0x6cda('0x28')](function(_0x3aade6){_0x3278cb(_0x3aade6);});});});};var _0x793500=function(_0x4f6814){return new BPromise(function(_0x3e7792,_0x1a2499){_0x353a13(_0x4f6814,_0x30abed)[_0x6cda('0x1c')](function(_0x348cb2){_0x30abed[_0x6cda('0x18')]=_0x348cb2[_0x6cda('0x29')];_0x1e465d[_0x6cda('0x23')][_0x6cda('0x1b')]({'where':{'phone':_0x30abed[_0x6cda('0xe')],'VoiceQueueId':_0x4f6814['id']}})[_0x6cda('0x1c')](function(_0x2ecf59){if(!_[_0x6cda('0x1d')](_0x2ecf59)){throw new Error(_0x6cda('0x2a')+_0x30abed[_0x6cda('0xe')]+_0x6cda('0x2b')+_0x4f6814['id']);}return _0x1e465d[_0x6cda('0x2c')][_0x6cda('0x1b')]({'where':{'calleridnum':_0x30abed[_0x6cda('0xe')],'VoiceQueueId':_0x4f6814['id']}});})[_0x6cda('0x1c')](function(_0x550f54){if(!_[_0x6cda('0x1d')](_0x550f54)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x30abed[_0x6cda('0xe')]+_0x6cda('0x2d')+_0x4f6814['id']);}return _0x1e465d['CmHopper'][_0x6cda('0x25')]({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed[_0x6cda('0x26')],'priority':_0x30abed['priority']?_0x30abed[_0x6cda('0x2e')]:0x2,'scheduledat':_0x30abed['scheduledat']?_0x30abed[_0x6cda('0x18')]:moment()[_0x6cda('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x30abed[_0x6cda('0x27')]?!![]:![],'callbackuniqueid':_0x30abed[_0x6cda('0x27')]?_0x30abed[_0x6cda('0x27')]:undefined,'callbackat':_0x30abed[_0x6cda('0x27')]?moment()[_0x6cda('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4f6814['id']});})['catch'](function(_0x2e112e){_0x1a2499(_0x2e112e);});});});};function _0x40104a(){return function(_0x4efc28){logger[_0x6cda('0x15')](_0x6cda('0x2f'),_0x6cda('0x16'),util[_0x6cda('0x17')](_0x4efc28,{'showHidden':![],'depth':null}));};}function _0x43e1b4(_0x8e8c5c,_0x17b037){var _0x319c9e=_0x17b037[_0x6cda('0x18')]?_0x17b037[_0x6cda('0x18')]:moment()[_0x6cda('0x22')](_0x6cda('0x19'));return new BPromise(function(_0x1ea02e,_0x53429e){if(_[_0x6cda('0x1d')](_0x17b037[_0x6cda('0x1e')])){_0x1ea02e({'ret':_0x319c9e});}else{_0x1e465d['Campaign'][_0x6cda('0x1b')]({'where':{'id':_0x8e8c5c['id']}})['then'](function(_0x293b88){if(!_[_0x6cda('0x1d')](_0x293b88)){var _0x5f0ad5=_0x293b88['dialTimezone'];if(!_[_0x6cda('0x1d')](_0x5f0ad5)){var _0x8ce069=shared['timezones'];var _0x98540d=_0x8ce069[_0x5f0ad5];var _0x333d52=_0x8ce069[_0x17b037[_0x6cda('0x1e')]];if(!_[_0x6cda('0x1d')](_0x98540d)&&!_['isNil'](_0x333d52)){var _0xa61e65=_0x98540d['utcOffset']-_0x333d52[_0x6cda('0x20')];_0x319c9e=_0x17b037[_0x6cda('0x18')]?_0x17b037[_0x6cda('0x18')]:moment();var _0x594bb5=moment(_0x319c9e)[_0x6cda('0x30')](_0xa61e65,_0x6cda('0x21'));_0x1ea02e({'ret':_0x594bb5[_0x6cda('0x22')](_0x6cda('0x19'))});}else _0x1ea02e({'ret':_0x319c9e});}else _0x1ea02e({'ret':_0x319c9e});}else{_0x1ea02e({'ret':_0x319c9e});}});}});return 0xa;}var _0x3d1fcd=function(_0x3bd4f3){return new BPromise(function(_0x23354a,_0x14fcd2){_0x43e1b4(_0x3bd4f3,_0x30abed)[_0x6cda('0x1c')](function(_0x4f98a5){_0x30abed[_0x6cda('0x18')]=_0x4f98a5[_0x6cda('0x29')];_0x1e465d[_0x6cda('0x23')][_0x6cda('0x1b')]({'where':{'phone':_0x30abed[_0x6cda('0xe')],'CampaignId':_0x3bd4f3['id']}})['then'](function(_0x1b157b){if(!_[_0x6cda('0x1d')](_0x1b157b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x30abed[_0x6cda('0xe')]+_0x6cda('0x31')+_0x3bd4f3['id']);}return _0x1e465d[_0x6cda('0x23')][_0x6cda('0x25')]({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed[_0x6cda('0x26')],'priority':_0x30abed[_0x6cda('0x2e')]?_0x30abed[_0x6cda('0x2e')]:0x2,'scheduledat':_0x30abed[_0x6cda('0x18')]?_0x30abed['scheduledat']:moment()[_0x6cda('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x30abed[_0x6cda('0x27')]?!![]:![],'callbackuniqueid':_0x30abed[_0x6cda('0x27')]?_0x30abed[_0x6cda('0x27')]:undefined,'callbackat':_0x30abed[_0x6cda('0x27')]?moment()[_0x6cda('0x22')](_0x6cda('0x19')):undefined,'CampaignId':_0x3bd4f3['id']});})[_0x6cda('0x28')](function(_0x48eed6){_0x14fcd2(_0x48eed6);});});});};var _0x53ec30=function(_0x3041d5){return new BPromise(function(_0x13f4f6,_0x3b0a7e){_0x43e1b4(_0x3041d5,_0x30abed)['then'](function(_0xb64b7c){_0x30abed['scheduledat']=_0xb64b7c[_0x6cda('0x29')];_0x1e465d[_0x6cda('0x23')][_0x6cda('0x1b')]({'where':{'phone':_0x30abed[_0x6cda('0xe')],'CampaignId':_0x3041d5['id']}})['then'](function(_0x3cca63){if(!_['isNil'](_0x3cca63)){throw new Error('cmContact,\x20afterCreate\x20'+_0x30abed['phone']+_0x6cda('0x32')+_0x3041d5['id']);}return _0x1e465d['CmHopperFinal'][_0x6cda('0x1b')]({'where':{'calleridnum':_0x30abed[_0x6cda('0xe')],'CampaignId':_0x3041d5['id']}});})[_0x6cda('0x1c')](function(_0x2d74ae){if(!_['isNil'](_0x2d74ae)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x30abed[_0x6cda('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x3041d5['id']);}return _0x1e465d[_0x6cda('0x23')][_0x6cda('0x25')]({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed['ListId'],'priority':_0x30abed[_0x6cda('0x2e')]?_0x30abed[_0x6cda('0x2e')]:0x2,'scheduledat':_0x30abed[_0x6cda('0x18')]?_0x30abed[_0x6cda('0x18')]:moment()['format'](_0x6cda('0x19')),'callback':_0x30abed[_0x6cda('0x27')]?!![]:![],'callbackuniqueid':_0x30abed[_0x6cda('0x27')]?_0x30abed[_0x6cda('0x27')]:undefined,'callbackat':_0x30abed[_0x6cda('0x27')]?moment()[_0x6cda('0x22')](_0x6cda('0x19')):undefined,'CampaignId':_0x3041d5['id']});})[_0x6cda('0x28')](function(_0x57d058){_0x3b0a7e(_0x57d058);});});});};if(_0x30abed[_0x6cda('0x26')]){_0x1e465d['VoiceQueue']['findAll']({'where':{'type':_0x6cda('0x33')},'attributes':['id',_0x6cda('0x34'),_0x6cda('0x1e')],'include':[{'model':_0x1e465d['CmList'],'as':_0x6cda('0x35'),'where':{'id':_0x30abed['ListId']}}]})[_0x6cda('0x1c')](function(_0x79c468){if(_0x79c468){var _0x4ea49b=[];for(var _0x41e785=0x0,_0x359ccf;_0x41e785<_0x79c468[_0x6cda('0x36')];_0x41e785+=0x1){_0x359ccf=_0x79c468[_0x41e785][_0x6cda('0x14')]({'plain':!![]});switch(_0x359ccf[_0x6cda('0x34')]){case'always':_0x793500(_0x359ccf)[_0x6cda('0x28')](_0x2664fb());break;case'onlyIfOpen':_0x2f01c3(_0x359ccf)[_0x6cda('0x28')](_0x2664fb());break;default:_0x43e1b4(_0x359ccf,_0x30abed)[_0x6cda('0x1c')](function(_0x3bf311){_0x30abed['scheduledat']=_0x3bf311[_0x6cda('0x29')];_0x1e465d[_0x6cda('0x23')][_0x6cda('0x25')]({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed[_0x6cda('0x26')],'scheduledat':_0x30abed[_0x6cda('0x18')]?_0x30abed[_0x6cda('0x18')]:moment()['format'](_0x6cda('0x19')),'priority':_0x30abed['priority']?_0x30abed[_0x6cda('0x2e')]:0x2,'callback':_0x30abed[_0x6cda('0x27')]?!![]:![],'callbackuniqueid':_0x30abed['callbackUniqueid']?_0x30abed[_0x6cda('0x27')]:undefined,'callbackat':_0x30abed[_0x6cda('0x27')]?moment()[_0x6cda('0x22')](_0x6cda('0x19')):undefined,'VoiceQueueId':_0x359ccf['id']})[_0x6cda('0x28')](_0x2664fb());});}}}})[_0x6cda('0x1c')](function(){return _0x1e465d[_0x6cda('0x1a')][_0x6cda('0x37')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x1e465d[_0x6cda('0x38')],'as':'BlackLists','where':{'id':_0x30abed['ListId']}}]})[_0x6cda('0x1c')](function(_0x1bd5c5){if(_0x1bd5c5){var _0x1ef9b7=[];for(var _0x5bec61=0x0,_0x106049;_0x5bec61<_0x1bd5c5['length'];_0x5bec61+=0x1){_0x106049=_0x1bd5c5[_0x5bec61][_0x6cda('0x14')]({'plain':!![]});_0x1e465d[_0x6cda('0x39')][_0x6cda('0x25')]({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed[_0x6cda('0x26')],'VoiceQueueId':_0x106049['id']})['catch'](function(_0x474b08){logger[_0x6cda('0x15')](_0x6cda('0x3a'),_0x6cda('0x16'),_0x474b08['message']);});}}});})[_0x6cda('0x1c')](function(){return _0x1e465d[_0x6cda('0x3b')][_0x6cda('0x37')]({'attributes':['id',_0x6cda('0x34'),_0x6cda('0x1e')],'include':[{'model':_0x1e465d['CmList'],'as':_0x6cda('0x35'),'where':{'id':_0x30abed[_0x6cda('0x26')]}}]})[_0x6cda('0x1c')](function(_0x8d7f69){if(_0x8d7f69){var _0x515851=[];for(var _0x5b1f96=0x0,_0x273885;_0x5b1f96<_0x8d7f69[_0x6cda('0x36')];_0x5b1f96+=0x1){_0x273885=_0x8d7f69[_0x5b1f96][_0x6cda('0x14')]({'plain':!![]});switch(_0x273885['dialCheckDuplicateType']){case'always':_0x53ec30(_0x273885)[_0x6cda('0x28')](_0x40104a());break;case'onlyIfOpen':_0x3d1fcd(_0x273885)[_0x6cda('0x28')](_0x40104a());break;default:_0x1e465d[_0x6cda('0x23')]['create']({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed[_0x6cda('0x26')],'scheduledat':_0x30abed[_0x6cda('0x18')]?_0x30abed[_0x6cda('0x18')]:moment()['format'](_0x6cda('0x19')),'priority':_0x30abed[_0x6cda('0x2e')]?_0x30abed['priority']:0x2,'callback':_0x30abed['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x30abed[_0x6cda('0x27')]?_0x30abed[_0x6cda('0x27')]:undefined,'callbackat':_0x30abed[_0x6cda('0x27')]?moment()[_0x6cda('0x22')](_0x6cda('0x19')):undefined,'CampaignId':_0x273885['id']})[_0x6cda('0x28')](_0x40104a());}}}});})['then'](function(){return _0x1e465d['Campaign'][_0x6cda('0x37')]({'attributes':['id'],'include':[{'model':_0x1e465d['CmList'],'as':_0x6cda('0x3c'),'where':{'id':_0x30abed[_0x6cda('0x26')]}}]})[_0x6cda('0x1c')](function(_0x1c9608){if(_0x1c9608){var _0x2fcbbb=[];for(var _0x5b1bf8=0x0,_0x25ee14;_0x5b1bf8<_0x1c9608[_0x6cda('0x36')];_0x5b1bf8+=0x1){_0x25ee14=_0x1c9608[_0x5b1bf8][_0x6cda('0x14')]({'plain':!![]});_0x1e465d[_0x6cda('0x39')][_0x6cda('0x25')]({'phone':_0x30abed[_0x6cda('0xe')],'ContactId':_0x30abed['id'],'ListId':_0x30abed[_0x6cda('0x26')],'CampaignId':_0x25ee14['id']})[_0x6cda('0x28')](function(_0x10c875){logger[_0x6cda('0x15')](_0x6cda('0x3a'),_0x6cda('0x16'),_0x10c875[_0x6cda('0x3d')]);});}}});})[_0x6cda('0x1c')](function(){_0x4bc28e();})[_0x6cda('0x28')](function(_0x202858){logger['error'](_0x6cda('0x3a'),_0x6cda('0x16'),_0x202858['message']);_0x4bc28e(_0x202858);});}else{_0x4bc28e(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x1e5788,_0x2c5962,_0x19282e){var _0x6d73dd=_0x5393fa[_0x6cda('0x13')];var _0x407c02=_0x1e5788[_0x6cda('0x14')]({'plain':!![]});return _0x6d73dd[_0x6cda('0x23')][_0x6cda('0x37')]({'raw':!![],'where':{'ListId':_0x407c02[_0x6cda('0x26')],'ContactId':_0x407c02['id']}})[_0x6cda('0x1c')](function(_0x5b2405){if(!_[_0x6cda('0x3e')](_0x5b2405)){var _0x5998ec=[];for(var _0x1318c0=0x0;_0x1318c0<_0x5b2405['length'];_0x1318c0+=0x1){var _0x3ffd64=_0x6d73dd[_0x6cda('0x23')][_0x6cda('0x3f')]({'where':{'ListId':_0x5b2405[_0x1318c0][_0x6cda('0x26')],'ContactId':_0x5b2405[_0x1318c0]['ContactId'],'VoiceQueueId':_0x5b2405[_0x1318c0][_0x6cda('0x40')],'CampaignId':_0x5b2405[_0x1318c0][_0x6cda('0x41')]}});_0x5998ec[_0x6cda('0x42')](_0x3ffd64);}return BPromise['all'](_0x5998ec);}})[_0x6cda('0x1c')](function(_0x25585b){logger[_0x6cda('0x43')](_0x6cda('0x44'),util['inspect'](_0x25585b,{'showHidden':![],'depth':null}));_0x19282e();})[_0x6cda('0x28')](function(_0x1dcc5e){logger['error'](_0x6cda('0x45'),util[_0x6cda('0x17')](_0x1dcc5e,{'showHidden':![],'depth':null}));_0x19282e(_0x1dcc5e);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f2baf22..7184651 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(_0x43a8db,_0x25d398){var _0x245a9f=function(_0x3152fc){while(--_0x3152fc){_0x43a8db['push'](_0x43a8db['shift']());}};_0x245a9f(++_0x25d398);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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(_0x1d4c1b,_0x3ba60a){var _0x40ff9f=function(_0x4e4340){while(--_0x4e4340){_0x1d4c1b['push'](_0x1d4c1b['shift']());}};_0x40ff9f(++_0x3ba60a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 0d58b00..6b0e4c4 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 _0x238f=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x4d9cad,_0x5562ff){var _0x23efed=function(_0x402bec){while(--_0x402bec){_0x4d9cad['push'](_0x4d9cad['shift']());}};_0x23efed(++_0x5562ff);}(_0x238f,0xa5));var _0xf238=function(_0x599aa8,_0x41505c){_0x599aa8=_0x599aa8-0x0;var _0x23ef8f=_0x238f[_0x599aa8];return _0x23ef8f;};'use strict';var Sequelize=require(_0xf238('0x0'));module[_0xf238('0x1')]={'CmContactId':{'type':Sequelize[_0xf238('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xf238('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xf238('0x3')],'defaultValue':_0xf238('0x4')},'OrderBy':{'type':Sequelize[_0xf238('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xf238('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x6732=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x2d918a,_0x1f6e95){var _0x22c47d=function(_0x438560){while(--_0x438560){_0x2d918a['push'](_0x2d918a['shift']());}};_0x22c47d(++_0x1f6e95);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'CmContactId':{'type':Sequelize[_0x2673('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2673('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2673('0x3')],'defaultValue':_0x2673('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x2673('0x3')],'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 ea16741..9b0466f 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 _0xae91=['save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','json','offset','undefined','limit','Content-Range','apply','reject'];(function(_0x3091ed,_0x5d45a0){var _0x1e63f4=function(_0x161834){while(--_0x161834){_0x3091ed['push'](_0x3091ed['shift']());}};_0x1e63f4(++_0x5d45a0);}(_0xae91,0x1e6));var _0x1ae9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xae91[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1ae9('0x0'));var rimraf=require(_0x1ae9('0x1'));var zipdir=require(_0x1ae9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ae9('0x3'));var moment=require(_0x1ae9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ae9('0x5'));var util=require(_0x1ae9('0x6'));var path=require(_0x1ae9('0x7'));var sox=require(_0x1ae9('0x8'));var csv=require(_0x1ae9('0x9'));var ejs=require(_0x1ae9('0xa'));var fs=require('fs');var fs_extra=require(_0x1ae9('0xb'));var _=require(_0x1ae9('0xc'));var squel=require(_0x1ae9('0xd'));var crypto=require('crypto');var jsforce=require(_0x1ae9('0xe'));var deskjs=require(_0x1ae9('0xf'));var toCsv=require(_0x1ae9('0x9'));var querystring=require('querystring');var Papa=require(_0x1ae9('0x10'));var Redis=require(_0x1ae9('0x11'));var authService=require(_0x1ae9('0x12'));var qs=require(_0x1ae9('0x13'));var as=require(_0x1ae9('0x14'));var hardwareService=require(_0x1ae9('0x15'));var logger=require(_0x1ae9('0x16'))('api');var utils=require(_0x1ae9('0x17'));var config=require(_0x1ae9('0x18'));var licenseUtil=require(_0x1ae9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2dcacb,_0x2258c0){_0x2258c0=_0x2258c0||0xcc;return function(_0x17f601){if(_0x17f601){return _0x2dcacb[_0x1ae9('0x1a')](_0x2258c0);}return _0x2dcacb['status'](_0x2258c0)[_0x1ae9('0x1b')]();};}function respondWithResult(_0x15a5f5,_0xc4891d){_0xc4891d=_0xc4891d||0xc8;return function(_0x22efc6){if(_0x22efc6){return _0x15a5f5[_0x1ae9('0x1c')](_0xc4891d)[_0x1ae9('0x1d')](_0x22efc6);}};}function respondWithFilteredResult(_0x8d10d5,_0x27c05e){return function(_0x579358){if(_0x579358){var _0x1dbb69=typeof _0x27c05e[_0x1ae9('0x1e')]===_0x1ae9('0x1f')&&typeof _0x27c05e[_0x1ae9('0x20')]==='undefined';var _0x2baf11=_0x579358['count'];var _0x5b46ec=_0x1dbb69?0x0:_0x27c05e[_0x1ae9('0x1e')];var _0x418778=_0x1dbb69?_0x579358['count']:_0x27c05e[_0x1ae9('0x1e')]+_0x27c05e[_0x1ae9('0x20')];var _0x1af5ae;if(_0x418778>=_0x2baf11){_0x418778=_0x2baf11;_0x1af5ae=0xc8;}else{_0x1af5ae=0xce;}_0x8d10d5[_0x1ae9('0x1c')](_0x1af5ae);return _0x8d10d5['set'](_0x1ae9('0x21'),_0x5b46ec+'-'+_0x418778+'/'+_0x2baf11)[_0x1ae9('0x1d')](_0x579358);}return null;};}function patchUpdates(_0x518f3c){return function(_0x7bfc3c){try{jsonpatch[_0x1ae9('0x22')](_0x7bfc3c,_0x518f3c,!![]);}catch(_0x118010){return BPromise[_0x1ae9('0x23')](_0x118010);}return _0x7bfc3c[_0x1ae9('0x24')]();};}function saveUpdates(_0x3ed7de,_0x243bb2){return function(_0x5f224a){if(_0x5f224a){return _0x5f224a[_0x1ae9('0x25')](_0x3ed7de)[_0x1ae9('0x26')](function(_0x453b1e){return _0x453b1e;});}return null;};}function removeEntity(_0x28b3b9,_0x4c19f2){return function(_0x29e483){if(_0x29e483){return _0x29e483[_0x1ae9('0x27')]()[_0x1ae9('0x26')](function(){var _0x3c2328=_0x29e483[_0x1ae9('0x28')]({'plain':!![]});var _0x58c03d=_0x1ae9('0x29');return db[_0x1ae9('0x2a')][_0x1ae9('0x27')]({'where':{'type':_0x58c03d,'resourceId':_0x3c2328['id']}})[_0x1ae9('0x26')](function(){return _0x29e483;});})[_0x1ae9('0x26')](function(){_0x28b3b9[_0x1ae9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d039,_0x3cbfbe){return function(_0x1dfb51){if(!_0x1dfb51){_0x14d039['sendStatus'](0x194);}return _0x1dfb51;};}function handleError(_0x1f2687,_0xfea4bc){_0xfea4bc=_0xfea4bc||0x1f4;return function(_0x5983e1){logger[_0x1ae9('0x2b')](_0x5983e1[_0x1ae9('0x2c')]);if(_0x5983e1[_0x1ae9('0x2d')]){delete _0x5983e1[_0x1ae9('0x2d')];}_0x1f2687[_0x1ae9('0x1c')](_0xfea4bc)[_0x1ae9('0x2e')](_0x5983e1);};}exports[_0x1ae9('0x2f')]=function(_0x1818f9,_0xe68d17){var _0x491214={},_0x6c023b={},_0xa20ec4={'count':0x0,'rows':[]};var _0x4ebc9e=_[_0x1ae9('0x30')](db[_0x1ae9('0x31')][_0x1ae9('0x32')],function(_0xa681){return{'name':_0xa681[_0x1ae9('0x33')],'type':_0xa681['type'][_0x1ae9('0x34')]};});_0x6c023b[_0x1ae9('0x35')]=_[_0x1ae9('0x30')](_0x4ebc9e,'name');_0x6c023b[_0x1ae9('0x36')]=_[_0x1ae9('0x37')](_0x1818f9['query']);_0x6c023b['filters']=_[_0x1ae9('0x38')](_0x6c023b['model'],_0x6c023b['query']);_0x491214[_0x1ae9('0x39')]=_[_0x1ae9('0x38')](_0x6c023b[_0x1ae9('0x35')],qs['fields'](_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x3a')]));_0x491214['attributes']=_0x491214[_0x1ae9('0x39')][_0x1ae9('0x3b')]?_0x491214[_0x1ae9('0x39')]:_0x6c023b[_0x1ae9('0x35')];if(!_0x1818f9['query'][_0x1ae9('0x3c')]('nolimit')){_0x491214[_0x1ae9('0x20')]=qs[_0x1ae9('0x20')](_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x20')]);_0x491214[_0x1ae9('0x1e')]=qs[_0x1ae9('0x1e')](_0x1818f9[_0x1ae9('0x36')]['offset']);}_0x491214[_0x1ae9('0x3d')]=qs['sort'](_0x1818f9['query'][_0x1ae9('0x3e')]);_0x491214[_0x1ae9('0x3f')]=qs[_0x1ae9('0x40')](_['pick'](_0x1818f9[_0x1ae9('0x36')],_0x6c023b[_0x1ae9('0x40')]),_0x4ebc9e);if(_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x41')]){_0x491214[_0x1ae9('0x3f')]=_['merge'](_0x491214[_0x1ae9('0x3f')],{'$or':_[_0x1ae9('0x30')](_0x4ebc9e,function(_0x13c95f){if(_0x13c95f[_0x1ae9('0x42')]!==_0x1ae9('0x43')){var _0x891b02={};_0x891b02[_0x13c95f[_0x1ae9('0x2d')]]={'$like':'%'+_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x41')]+'%'};return _0x891b02;}})});}_0x491214=_['merge']({},_0x491214,_0x1818f9[_0x1ae9('0x44')]);var _0x2024b7={'where':_0x491214[_0x1ae9('0x3f')]};return db[_0x1ae9('0x31')][_0x1ae9('0x45')](_0x2024b7)[_0x1ae9('0x26')](function(_0x245df4){_0xa20ec4[_0x1ae9('0x45')]=_0x245df4;if(_0x1818f9['query']['includeAll']){_0x491214[_0x1ae9('0x46')]=[{'all':!![]}];}return db[_0x1ae9('0x31')][_0x1ae9('0x47')](_0x491214);})[_0x1ae9('0x26')](function(_0x4616b4){_0xa20ec4[_0x1ae9('0x48')]=_0x4616b4;return _0xa20ec4;})[_0x1ae9('0x26')](respondWithFilteredResult(_0xe68d17,_0x491214))[_0x1ae9('0x49')](handleError(_0xe68d17,null));};exports['show']=function(_0x12ccba,_0x21af7a){var _0x3891ab={'raw':!![],'where':{'id':_0x12ccba[_0x1ae9('0x4a')]['id']}},_0x15d778={};_0x15d778[_0x1ae9('0x35')]=_[_0x1ae9('0x37')](db[_0x1ae9('0x31')]['rawAttributes']);_0x15d778['query']=_['keys'](_0x12ccba[_0x1ae9('0x36')]);_0x15d778[_0x1ae9('0x40')]=_['intersection'](_0x15d778[_0x1ae9('0x35')],_0x15d778[_0x1ae9('0x36')]);_0x3891ab[_0x1ae9('0x39')]=_[_0x1ae9('0x38')](_0x15d778[_0x1ae9('0x35')],qs[_0x1ae9('0x3a')](_0x12ccba[_0x1ae9('0x36')][_0x1ae9('0x3a')]));_0x3891ab[_0x1ae9('0x39')]=_0x3891ab[_0x1ae9('0x39')][_0x1ae9('0x3b')]?_0x3891ab[_0x1ae9('0x39')]:_0x15d778[_0x1ae9('0x35')];if(_0x12ccba['query'][_0x1ae9('0x4b')]){_0x3891ab[_0x1ae9('0x46')]=[{'all':!![]}];}_0x3891ab=_[_0x1ae9('0x4c')]({},_0x3891ab,_0x12ccba[_0x1ae9('0x44')]);return db[_0x1ae9('0x31')][_0x1ae9('0x4d')](_0x3891ab)[_0x1ae9('0x26')](handleEntityNotFound(_0x21af7a,null))['then'](respondWithResult(_0x21af7a,null))[_0x1ae9('0x49')](handleError(_0x21af7a,null));};exports[_0x1ae9('0x4e')]=function(_0x5a862a,_0x56c817){return db[_0x1ae9('0x31')]['create'](_0x5a862a[_0x1ae9('0x4f')],{})[_0x1ae9('0x26')](function(_0x300865){var _0x41391d=_0x5a862a['user'][_0x1ae9('0x28')]({'plain':!![]});if(!_0x41391d)throw new Error(_0x1ae9('0x50'));if(_0x41391d[_0x1ae9('0x51')]===_0x1ae9('0x52')){var _0x2777eb=_0x300865[_0x1ae9('0x28')]({'plain':!![]});var _0x1d8127=_0x1ae9('0x29');return db[_0x1ae9('0x53')][_0x1ae9('0x4d')]({'where':{'name':_0x1d8127,'userProfileId':_0x41391d[_0x1ae9('0x54')]},'raw':!![]})[_0x1ae9('0x26')](function(_0x14a600){if(_0x14a600&&_0x14a600[_0x1ae9('0x55')]===0x0){return db['UserProfileResource'][_0x1ae9('0x4e')]({'name':_0x2777eb['name'],'resourceId':_0x2777eb['id'],'type':_0x14a600['name'],'sectionId':_0x14a600['id']},{})[_0x1ae9('0x26')](function(){return _0x300865;});}else{return _0x300865;}})['catch'](function(_0x410fd2){logger[_0x1ae9('0x2b')](_0x1ae9('0x56'),_0x410fd2);throw _0x410fd2;});}return _0x300865;})['then'](respondWithResult(_0x56c817,0xc9))[_0x1ae9('0x49')](handleError(_0x56c817,null));};exports[_0x1ae9('0x25')]=function(_0x205ef6,_0xb1474f){if(_0x205ef6[_0x1ae9('0x4f')]['id']){delete _0x205ef6[_0x1ae9('0x4f')]['id'];}return db[_0x1ae9('0x31')][_0x1ae9('0x4d')]({'where':{'id':_0x205ef6[_0x1ae9('0x4a')]['id']}})[_0x1ae9('0x26')](handleEntityNotFound(_0xb1474f,null))[_0x1ae9('0x26')](saveUpdates(_0x205ef6[_0x1ae9('0x4f')],null))['then'](respondWithResult(_0xb1474f,null))['catch'](handleError(_0xb1474f,null));};exports[_0x1ae9('0x27')]=function(_0x30d635,_0x4f541f){return db[_0x1ae9('0x31')]['find']({'where':{'id':_0x30d635[_0x1ae9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f541f,null))[_0x1ae9('0x26')](removeEntity(_0x4f541f,null))[_0x1ae9('0x49')](handleError(_0x4f541f,null));}; \ No newline at end of file +var _0xae88=['fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','options','rows','catch','show','rawAttributes','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','get','CmContactHasItems','UserProfileResource','name','send','index','map','CmContactHasItem','fieldName','key','query','keys','filters','intersection','model'];(function(_0x2bcebf,_0xf06cb7){var _0x407614=function(_0x576742){while(--_0x576742){_0x2bcebf['push'](_0x2bcebf['shift']());}};_0x407614(++_0xf06cb7);}(_0xae88,0x161));var _0x8ae8=function(_0x2ec4dd,_0x376ed0){_0x2ec4dd=_0x2ec4dd-0x0;var _0x2b9e16=_0xae88[_0x2ec4dd];return _0x2b9e16;};'use strict';var emlformat=require(_0x8ae8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ae8('0x1'));var jsonpatch=require(_0x8ae8('0x2'));var rp=require('request-promise');var moment=require(_0x8ae8('0x3'));var BPromise=require(_0x8ae8('0x4'));var Mustache=require(_0x8ae8('0x5'));var util=require('util');var path=require(_0x8ae8('0x6'));var sox=require(_0x8ae8('0x7'));var csv=require(_0x8ae8('0x8'));var ejs=require(_0x8ae8('0x9'));var fs=require('fs');var fs_extra=require(_0x8ae8('0xa'));var _=require(_0x8ae8('0xb'));var squel=require('squel');var crypto=require(_0x8ae8('0xc'));var jsforce=require(_0x8ae8('0xd'));var deskjs=require(_0x8ae8('0xe'));var toCsv=require(_0x8ae8('0x8'));var querystring=require(_0x8ae8('0xf'));var Papa=require(_0x8ae8('0x10'));var Redis=require(_0x8ae8('0x11'));var authService=require(_0x8ae8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8ae8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ae8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8ae8('0x15'));var licenseUtil=require(_0x8ae8('0x16'));var db=require(_0x8ae8('0x17'))['db'];function respondWithStatusCode(_0x3b944a,_0x178513){_0x178513=_0x178513||0xcc;return function(_0x3acd16){if(_0x3acd16){return _0x3b944a[_0x8ae8('0x18')](_0x178513);}return _0x3b944a[_0x8ae8('0x19')](_0x178513)[_0x8ae8('0x1a')]();};}function respondWithResult(_0x387a8d,_0x295e3b){_0x295e3b=_0x295e3b||0xc8;return function(_0x1788c9){if(_0x1788c9){return _0x387a8d[_0x8ae8('0x19')](_0x295e3b)[_0x8ae8('0x1b')](_0x1788c9);}};}function respondWithFilteredResult(_0x4f4b41,_0x2a008f){return function(_0x30ff0e){if(_0x30ff0e){var _0x469c34=typeof _0x2a008f[_0x8ae8('0x1c')]==='undefined'&&typeof _0x2a008f[_0x8ae8('0x1d')]==='undefined';var _0x3d5f43=_0x30ff0e[_0x8ae8('0x1e')];var _0x1e7de4=_0x469c34?0x0:_0x2a008f[_0x8ae8('0x1c')];var _0x5b2934=_0x469c34?_0x30ff0e['count']:_0x2a008f[_0x8ae8('0x1c')]+_0x2a008f['limit'];var _0x4d355c;if(_0x5b2934>=_0x3d5f43){_0x5b2934=_0x3d5f43;_0x4d355c=0xc8;}else{_0x4d355c=0xce;}_0x4f4b41['status'](_0x4d355c);return _0x4f4b41[_0x8ae8('0x1f')](_0x8ae8('0x20'),_0x1e7de4+'-'+_0x5b2934+'/'+_0x3d5f43)[_0x8ae8('0x1b')](_0x30ff0e);}return null;};}function patchUpdates(_0x1e221a){return function(_0x47566a){try{jsonpatch[_0x8ae8('0x21')](_0x47566a,_0x1e221a,!![]);}catch(_0x51695a){return BPromise['reject'](_0x51695a);}return _0x47566a[_0x8ae8('0x22')]();};}function saveUpdates(_0x27f1b6,_0x486e61){return function(_0x2b2585){if(_0x2b2585){return _0x2b2585['update'](_0x27f1b6)[_0x8ae8('0x23')](function(_0x24fe43){return _0x24fe43;});}return null;};}function removeEntity(_0x54a498,_0xef2a84){return function(_0x216048){if(_0x216048){return _0x216048[_0x8ae8('0x24')]()[_0x8ae8('0x23')](function(){var _0x5b5369=_0x216048[_0x8ae8('0x25')]({'plain':!![]});var _0x2774c1=_0x8ae8('0x26');return db[_0x8ae8('0x27')][_0x8ae8('0x24')]({'where':{'type':_0x2774c1,'resourceId':_0x5b5369['id']}})[_0x8ae8('0x23')](function(){return _0x216048;});})[_0x8ae8('0x23')](function(){_0x54a498['status'](0xcc)[_0x8ae8('0x1a')]();});}};}function handleEntityNotFound(_0x43cbb2,_0x298927){return function(_0x55fc31){if(!_0x55fc31){_0x43cbb2[_0x8ae8('0x18')](0x194);}return _0x55fc31;};}function handleError(_0x4283a9,_0x58de2e){_0x58de2e=_0x58de2e||0x1f4;return function(_0x251075){logger['error'](_0x251075['stack']);if(_0x251075[_0x8ae8('0x28')]){delete _0x251075['name'];}_0x4283a9[_0x8ae8('0x19')](_0x58de2e)[_0x8ae8('0x29')](_0x251075);};}exports[_0x8ae8('0x2a')]=function(_0x312f72,_0xccda67){var _0x40f1ce={},_0xe706bd={},_0x1f3dcb={'count':0x0,'rows':[]};var _0x555061=_[_0x8ae8('0x2b')](db[_0x8ae8('0x2c')]['rawAttributes'],function(_0x2a1bd8){return{'name':_0x2a1bd8[_0x8ae8('0x2d')],'type':_0x2a1bd8['type'][_0x8ae8('0x2e')]};});_0xe706bd['model']=_[_0x8ae8('0x2b')](_0x555061,_0x8ae8('0x28'));_0xe706bd[_0x8ae8('0x2f')]=_[_0x8ae8('0x30')](_0x312f72[_0x8ae8('0x2f')]);_0xe706bd[_0x8ae8('0x31')]=_[_0x8ae8('0x32')](_0xe706bd['model'],_0xe706bd[_0x8ae8('0x2f')]);_0x40f1ce['attributes']=_[_0x8ae8('0x32')](_0xe706bd[_0x8ae8('0x33')],qs[_0x8ae8('0x34')](_0x312f72[_0x8ae8('0x2f')]['fields']));_0x40f1ce[_0x8ae8('0x35')]=_0x40f1ce[_0x8ae8('0x35')][_0x8ae8('0x36')]?_0x40f1ce['attributes']:_0xe706bd[_0x8ae8('0x33')];if(!_0x312f72['query'][_0x8ae8('0x37')]('nolimit')){_0x40f1ce['limit']=qs[_0x8ae8('0x1d')](_0x312f72[_0x8ae8('0x2f')][_0x8ae8('0x1d')]);_0x40f1ce[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x312f72['query'][_0x8ae8('0x1c')]);}_0x40f1ce[_0x8ae8('0x38')]=qs[_0x8ae8('0x39')](_0x312f72[_0x8ae8('0x2f')][_0x8ae8('0x39')]);_0x40f1ce[_0x8ae8('0x3a')]=qs['filters'](_['pick'](_0x312f72[_0x8ae8('0x2f')],_0xe706bd['filters']),_0x555061);if(_0x312f72[_0x8ae8('0x2f')][_0x8ae8('0x3b')]){_0x40f1ce['where']=_[_0x8ae8('0x3c')](_0x40f1ce[_0x8ae8('0x3a')],{'$or':_['map'](_0x555061,function(_0xe28087){if(_0xe28087[_0x8ae8('0x3d')]!=='VIRTUAL'){var _0x22f32a={};_0x22f32a[_0xe28087[_0x8ae8('0x28')]]={'$like':'%'+_0x312f72[_0x8ae8('0x2f')]['filter']+'%'};return _0x22f32a;}})});}_0x40f1ce=_[_0x8ae8('0x3c')]({},_0x40f1ce,_0x312f72[_0x8ae8('0x3e')]);var _0x2e3de7={'where':_0x40f1ce[_0x8ae8('0x3a')]};return db[_0x8ae8('0x2c')]['count'](_0x2e3de7)['then'](function(_0x4b0eea){_0x1f3dcb[_0x8ae8('0x1e')]=_0x4b0eea;if(_0x312f72[_0x8ae8('0x2f')]['includeAll']){_0x40f1ce['include']=[{'all':!![]}];}return db[_0x8ae8('0x2c')]['findAll'](_0x40f1ce);})[_0x8ae8('0x23')](function(_0x5be537){_0x1f3dcb[_0x8ae8('0x3f')]=_0x5be537;return _0x1f3dcb;})['then'](respondWithFilteredResult(_0xccda67,_0x40f1ce))[_0x8ae8('0x40')](handleError(_0xccda67,null));};exports[_0x8ae8('0x41')]=function(_0x55dfd6,_0x45ab39){var _0x244ac6={'raw':!![],'where':{'id':_0x55dfd6['params']['id']}},_0x31e1f4={};_0x31e1f4[_0x8ae8('0x33')]=_[_0x8ae8('0x30')](db[_0x8ae8('0x2c')][_0x8ae8('0x42')]);_0x31e1f4[_0x8ae8('0x2f')]=_[_0x8ae8('0x30')](_0x55dfd6['query']);_0x31e1f4['filters']=_['intersection'](_0x31e1f4[_0x8ae8('0x33')],_0x31e1f4[_0x8ae8('0x2f')]);_0x244ac6[_0x8ae8('0x35')]=_[_0x8ae8('0x32')](_0x31e1f4[_0x8ae8('0x33')],qs['fields'](_0x55dfd6['query'][_0x8ae8('0x34')]));_0x244ac6[_0x8ae8('0x35')]=_0x244ac6[_0x8ae8('0x35')][_0x8ae8('0x36')]?_0x244ac6[_0x8ae8('0x35')]:_0x31e1f4['model'];if(_0x55dfd6[_0x8ae8('0x2f')][_0x8ae8('0x43')]){_0x244ac6[_0x8ae8('0x44')]=[{'all':!![]}];}_0x244ac6=_[_0x8ae8('0x3c')]({},_0x244ac6,_0x55dfd6['options']);return db['CmContactHasItem'][_0x8ae8('0x45')](_0x244ac6)[_0x8ae8('0x23')](handleEntityNotFound(_0x45ab39,null))[_0x8ae8('0x23')](respondWithResult(_0x45ab39,null))[_0x8ae8('0x40')](handleError(_0x45ab39,null));};exports[_0x8ae8('0x46')]=function(_0x3f1e67,_0x13607c){return db['CmContactHasItem'][_0x8ae8('0x46')](_0x3f1e67[_0x8ae8('0x47')],{})['then'](function(_0x135eb7){var _0x4942e7=_0x3f1e67['user'][_0x8ae8('0x25')]({'plain':!![]});if(!_0x4942e7)throw new Error(_0x8ae8('0x48'));if(_0x4942e7[_0x8ae8('0x49')]==='user'){var _0x40135b=_0x135eb7['get']({'plain':!![]});var _0x2b476a=_0x8ae8('0x26');return db[_0x8ae8('0x4a')][_0x8ae8('0x45')]({'where':{'name':_0x2b476a,'userProfileId':_0x4942e7[_0x8ae8('0x4b')]},'raw':!![]})[_0x8ae8('0x23')](function(_0x178790){if(_0x178790&&_0x178790[_0x8ae8('0x4c')]===0x0){return db[_0x8ae8('0x27')]['create']({'name':_0x40135b[_0x8ae8('0x28')],'resourceId':_0x40135b['id'],'type':_0x178790['name'],'sectionId':_0x178790['id']},{})[_0x8ae8('0x23')](function(){return _0x135eb7;});}else{return _0x135eb7;}})['catch'](function(_0x209b78){logger[_0x8ae8('0x4d')](_0x8ae8('0x4e'),_0x209b78);throw _0x209b78;});}return _0x135eb7;})[_0x8ae8('0x23')](respondWithResult(_0x13607c,0xc9))[_0x8ae8('0x40')](handleError(_0x13607c,null));};exports[_0x8ae8('0x4f')]=function(_0x689c7e,_0x82f5b6){if(_0x689c7e['body']['id']){delete _0x689c7e[_0x8ae8('0x47')]['id'];}return db[_0x8ae8('0x2c')][_0x8ae8('0x45')]({'where':{'id':_0x689c7e[_0x8ae8('0x50')]['id']}})['then'](handleEntityNotFound(_0x82f5b6,null))[_0x8ae8('0x23')](saveUpdates(_0x689c7e[_0x8ae8('0x47')],null))[_0x8ae8('0x23')](respondWithResult(_0x82f5b6,null))[_0x8ae8('0x40')](handleError(_0x82f5b6,null));};exports[_0x8ae8('0x24')]=function(_0x2167ba,_0x1a1109){return db[_0x8ae8('0x2c')][_0x8ae8('0x45')]({'where':{'id':_0x2167ba[_0x8ae8('0x50')]['id']}})[_0x8ae8('0x23')](handleEntityNotFound(_0x1a1109,null))[_0x8ae8('0x23')](removeEntity(_0x1a1109,null))['catch'](handleError(_0x1a1109,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2b8e05e..db71542 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 _0xed5f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','util'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xed5f,0x106));var _0xfed5=function(_0x21b4f3,_0x388c0a){_0x21b4f3=_0x21b4f3-0x0;var _0x59031c=_0xed5f[_0x21b4f3];return _0x59031c;};'use strict';var _=require(_0xfed5('0x0'));var util=require(_0xfed5('0x1'));var logger=require(_0xfed5('0x2'))('api');var moment=require(_0xfed5('0x3'));var BPromise=require(_0xfed5('0x4'));var rp=require(_0xfed5('0x5'));var fs=require('fs');var path=require(_0xfed5('0x6'));var rimraf=require(_0xfed5('0x7'));var config=require(_0xfed5('0x8'));var attributes=require(_0xfed5('0x9'));module['exports']=function(_0xe65ec5,_0x4c5f15){return _0xe65ec5[_0xfed5('0xa')]('CmContactHasItem',attributes,{'tableName':_0xfed5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9710=['exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','./cmContactHasItem.attributes'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x9710,0x1b0));var _0x0971=function(_0x68e594,_0x62181d){_0x68e594=_0x68e594-0x0;var _0x5a6a2a=_0x9710[_0x68e594];return _0x5a6a2a;};'use strict';var _=require(_0x0971('0x0'));var util=require(_0x0971('0x1'));var logger=require(_0x0971('0x2'))(_0x0971('0x3'));var moment=require('moment');var BPromise=require(_0x0971('0x4'));var rp=require(_0x0971('0x5'));var fs=require('fs');var path=require(_0x0971('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0971('0x7'));module[_0x0971('0x8')]=function(_0x1998a1,_0x239599){return _0x1998a1['define'](_0x0971('0x9'),attributes,{'tableName':_0x0971('0xa'),'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 0b00f67..7ba5bee 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 _0x58ef=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x58ef,0xf1));var _0xf58e=function(_0x16e8bd,_0x4c99b2){_0x16e8bd=_0x16e8bd-0x0;var _0x1516ba=_0x58ef[_0x16e8bd];return _0x1516ba;};'use strict';var _=require(_0xf58e('0x0'));var util=require(_0xf58e('0x1'));var moment=require(_0xf58e('0x2'));var BPromise=require(_0xf58e('0x3'));var rs=require(_0xf58e('0x4'));var fs=require('fs');var Redis=require(_0xf58e('0x5'));var db=require(_0xf58e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf58e('0x7'))(_0xf58e('0x8'));var config=require(_0xf58e('0x9'));var jayson=require(_0xf58e('0xa'));var client=jayson['client'][_0xf58e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f1b8a,_0x57e8f2,_0x3cab93){return new BPromise(function(_0x3685cb,_0x95df9b){return client[_0xf58e('0xc')](_0x3f1b8a,_0x3cab93)[_0xf58e('0xd')](function(_0x27446c){logger[_0xf58e('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x57e8f2,_0xf58e('0xf'));logger[_0xf58e('0x10')](_0xf58e('0x11'),_0x57e8f2,_0xf58e('0xf'),JSON[_0xf58e('0x12')](_0x27446c));if(_0x27446c[_0xf58e('0x13')]){if(_0x27446c[_0xf58e('0x13')][_0xf58e('0x14')]===0x1f4){logger[_0xf58e('0x13')](_0xf58e('0x15'),_0x57e8f2,_0x27446c[_0xf58e('0x13')]['message']);return _0x95df9b(_0x27446c['error'][_0xf58e('0x16')]);}logger[_0xf58e('0x13')](_0xf58e('0x15'),_0x57e8f2,_0x27446c[_0xf58e('0x13')][_0xf58e('0x16')]);return _0x3685cb(_0x27446c[_0xf58e('0x13')][_0xf58e('0x16')]);}else{logger[_0xf58e('0xe')](_0xf58e('0x15'),_0x57e8f2,_0xf58e('0xf'));_0x3685cb(_0x27446c['result'][_0xf58e('0x16')]);}})[_0xf58e('0x17')](function(_0x4ce455){logger['error'](_0xf58e('0x15'),_0x57e8f2,_0x4ce455);_0x95df9b(_0x4ce455);});});} \ No newline at end of file +var _0x1cf8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment'];(function(_0x443519,_0x53f071){var _0x4ba98a=function(_0x20f79f){while(--_0x20f79f){_0x443519['push'](_0x443519['shift']());}};_0x4ba98a(++_0x53f071);}(_0x1cf8,0x133));var _0x81cf=function(_0x534157,_0x5e0173){_0x534157=_0x534157-0x0;var _0x2bb356=_0x1cf8[_0x534157];return _0x2bb356;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x81cf('0x0'));var BPromise=require(_0x81cf('0x1'));var rs=require(_0x81cf('0x2'));var fs=require('fs');var Redis=require(_0x81cf('0x3'));var db=require(_0x81cf('0x4'))['db'];var utils=require(_0x81cf('0x5'));var logger=require(_0x81cf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x81cf('0x7'));var client=jayson[_0x81cf('0x8')][_0x81cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360f24,_0x554f17,_0x571d44){return new BPromise(function(_0x36458c,_0x872e1){return client[_0x81cf('0xa')](_0x360f24,_0x571d44)[_0x81cf('0xb')](function(_0x51414e){logger[_0x81cf('0xc')](_0x81cf('0xd'),_0x554f17,_0x81cf('0xe'));logger[_0x81cf('0xf')](_0x81cf('0x10'),_0x554f17,'request\x20sent',JSON[_0x81cf('0x11')](_0x51414e));if(_0x51414e[_0x81cf('0x12')]){if(_0x51414e[_0x81cf('0x12')]['code']===0x1f4){logger[_0x81cf('0x12')](_0x81cf('0xd'),_0x554f17,_0x51414e[_0x81cf('0x12')][_0x81cf('0x13')]);return _0x872e1(_0x51414e['error'][_0x81cf('0x13')]);}logger[_0x81cf('0x12')](_0x81cf('0xd'),_0x554f17,_0x51414e['error'][_0x81cf('0x13')]);return _0x36458c(_0x51414e['error'][_0x81cf('0x13')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x554f17,_0x81cf('0xe'));_0x36458c(_0x51414e[_0x81cf('0x14')]['message']);}})[_0x81cf('0x15')](function(_0x2b7824){logger[_0x81cf('0x12')](_0x81cf('0xd'),_0x554f17,_0x2b7824);_0x872e1(_0x2b7824);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index a10fb03..ae92dc0 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 _0x9124=['fs-extra','../../config/environment','./cmContactHasItem.controller','index','/:id','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x143f68,_0x3435f6){var _0x2fc373=function(_0xdc1b5d){while(--_0xdc1b5d){_0x143f68['push'](_0x143f68['shift']());}};_0x2fc373(++_0x3435f6);}(_0x9124,0x83));var _0x4912=function(_0x105176,_0xb7816a){_0x105176=_0x105176-0x0;var _0x3c0709=_0x9124[_0x105176];return _0x3c0709;};'use strict';var multer=require(_0x4912('0x0'));var util=require(_0x4912('0x1'));var path=require('path');var timeout=require(_0x4912('0x2'));var express=require(_0x4912('0x3'));var router=express[_0x4912('0x4')]();var fs_extra=require(_0x4912('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4912('0x6'));var controller=require(_0x4912('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4912('0x8')]);router['get'](_0x4912('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4912('0xa')]('/',auth[_0x4912('0xb')](),controller[_0x4912('0xc')]);router['put'](_0x4912('0x9'),auth[_0x4912('0xb')](),controller[_0x4912('0xd')]);router[_0x4912('0xe')](_0x4912('0x9'),auth['isAuthenticated'](),controller[_0x4912('0xf')]);module[_0x4912('0x10')]=router; \ No newline at end of file +var _0xb97e=['show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0xb97e,0xb2));var _0xeb97=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xb97e[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0xeb97('0x0'));var util=require(_0xeb97('0x1'));var path=require('path');var timeout=require(_0xeb97('0x2'));var express=require(_0xeb97('0x3'));var router=express[_0xeb97('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeb97('0x5'));var interaction=require(_0xeb97('0x6'));var config=require(_0xeb97('0x7'));var controller=require('./cmContactHasItem.controller');router[_0xeb97('0x8')]('/',auth['isAuthenticated'](),controller[_0xeb97('0x9')]);router[_0xeb97('0x8')](_0xeb97('0xa'),auth[_0xeb97('0xb')](),controller[_0xeb97('0xc')]);router[_0xeb97('0xd')]('/',auth[_0xeb97('0xb')](),controller['create']);router[_0xeb97('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xeb97('0xf')]);router[_0xeb97('0x10')](_0xeb97('0xa'),auth['isAuthenticated'](),controller[_0xeb97('0x11')]);module[_0xeb97('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 6a9d27c..4dfa497 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 _0xa35c=['setDataValue','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','STRING'];(function(_0x10adbe,_0x24bbe8){var _0x181f45=function(_0x163953){while(--_0x163953){_0x10adbe['push'](_0x10adbe['shift']());}};_0x181f45(++_0x24bbe8);}(_0xa35c,0xf6));var _0xca35=function(_0x40d661,_0xc26671){_0x40d661=_0x40d661-0x0;var _0x228bae=_0xa35c[_0x40d661];return _0x228bae;};'use strict';var Sequelize=require('sequelize');var _=require(_0xca35('0x0'));module[_0xca35('0x1')]={'name':{'type':Sequelize[_0xca35('0x2')],'get':function(_0x306489){return this[_0xca35('0x3')](_0xca35('0x4'));}},'alias':{'type':Sequelize[_0xca35('0x5')],'allowNull':![],'set':function(_0x5382c0){this[_0xca35('0x6')](_0xca35('0x4'),_0x5382c0?_0x5382c0:this[_0xca35('0x3')]('name'));}},'type':{'type':Sequelize[_0xca35('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xca35('0x7')](_0xca35('0x8')),'get':function(){if(this['getDataValue'](_0xca35('0x9'))===_0xca35('0xa')){return JSON[_0xca35('0xb')](this[_0xca35('0x3')](_0xca35('0xc')));}else{return this[_0xca35('0x3')]('values');}},'set':function(_0x3692fe){if(Array[_0xca35('0xd')](_0x3692fe)){this[_0xca35('0x6')](_0xca35('0xc'),JSON[_0xca35('0xe')](_0x3692fe));}else{this['setDataValue'](_0xca35('0xc'),_0x3692fe);}}},'required':{'type':Sequelize[_0xca35('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xca35('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xca35('0x10')](_0xca35('0x11'))}}; \ No newline at end of file +var _0x45c2=['parse','values','isArray','BOOLEAN','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type'];(function(_0x360f82,_0x3659cd){var _0x42c981=function(_0x277741){while(--_0x277741){_0x360f82['push'](_0x360f82['shift']());}};_0x42c981(++_0x3659cd);}(_0x45c2,0x1d5));var _0x245c=function(_0x2976de,_0x4c546d){_0x2976de=_0x2976de-0x0;var _0xecbf51=_0x45c2[_0x2976de];return _0xecbf51;};'use strict';var Sequelize=require(_0x245c('0x0'));var _=require(_0x245c('0x1'));module['exports']={'name':{'type':Sequelize[_0x245c('0x2')],'get':function(_0x2214bc){return this[_0x245c('0x3')](_0x245c('0x4'));}},'alias':{'type':Sequelize[_0x245c('0x5')],'allowNull':![],'set':function(_0x2c8830){this[_0x245c('0x6')](_0x245c('0x4'),_0x2c8830?_0x2c8830:this[_0x245c('0x3')](_0x245c('0x7')));}},'type':{'type':Sequelize[_0x245c('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x245c('0x8')](_0x245c('0x9')),'get':function(){if(this[_0x245c('0x3')](_0x245c('0xa'))==='select'){return JSON[_0x245c('0xb')](this[_0x245c('0x3')](_0x245c('0xc')));}else{return this[_0x245c('0x3')](_0x245c('0xc'));}},'set':function(_0x336dcf){if(Array[_0x245c('0xd')](_0x336dcf)){this[_0x245c('0x6')](_0x245c('0xc'),JSON['stringify'](_0x336dcf));}else{this[_0x245c('0x6')](_0x245c('0xc'),_0x336dcf);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x245c('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x245c('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 451c2b8..3c09503 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 _0x5bf7=['text','Sequelize','number','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','CmCustomField','include','findAll','rows','catch','show','params','keys','length','includeAll','options','body','find','create','sequelize','TEXT'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x5bf7,0xb4));var _0x75bf=function(_0x56719a,_0x460df3){_0x56719a=_0x56719a-0x0;var _0x44e892=_0x5bf7[_0x56719a];return _0x44e892;};'use strict';var emlformat=require(_0x75bf('0x0'));var rimraf=require(_0x75bf('0x1'));var zipdir=require(_0x75bf('0x2'));var jsonpatch=require(_0x75bf('0x3'));var rp=require('request-promise');var moment=require(_0x75bf('0x4'));var BPromise=require(_0x75bf('0x5'));var Mustache=require(_0x75bf('0x6'));var util=require(_0x75bf('0x7'));var path=require(_0x75bf('0x8'));var sox=require(_0x75bf('0x9'));var csv=require(_0x75bf('0xa'));var ejs=require(_0x75bf('0xb'));var fs=require('fs');var fs_extra=require(_0x75bf('0xc'));var _=require(_0x75bf('0xd'));var squel=require(_0x75bf('0xe'));var crypto=require(_0x75bf('0xf'));var jsforce=require(_0x75bf('0x10'));var deskjs=require(_0x75bf('0x11'));var toCsv=require(_0x75bf('0xa'));var querystring=require(_0x75bf('0x12'));var Papa=require('papaparse');var Redis=require(_0x75bf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x75bf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75bf('0x15'));var logger=require(_0x75bf('0x16'))(_0x75bf('0x17'));var utils=require(_0x75bf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x75bf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x185e00,_0x3d33a9){_0x3d33a9=_0x3d33a9||0xcc;return function(_0x228128){if(_0x228128){return _0x185e00['sendStatus'](_0x3d33a9);}return _0x185e00[_0x75bf('0x1a')](_0x3d33a9)[_0x75bf('0x1b')]();};}function respondWithResult(_0x231641,_0x590668){_0x590668=_0x590668||0xc8;return function(_0x4adffe){if(_0x4adffe){return _0x231641[_0x75bf('0x1a')](_0x590668)[_0x75bf('0x1c')](_0x4adffe);}};}function respondWithFilteredResult(_0x147b98,_0x494c47){return function(_0x3313ad){if(_0x3313ad){var _0xddf84b=typeof _0x494c47['offset']===_0x75bf('0x1d')&&typeof _0x494c47['limit']===_0x75bf('0x1d');var _0x5c3c70=_0x3313ad[_0x75bf('0x1e')];var _0x4d9c46=_0xddf84b?0x0:_0x494c47[_0x75bf('0x1f')];var _0x306c51=_0xddf84b?_0x3313ad[_0x75bf('0x1e')]:_0x494c47['offset']+_0x494c47[_0x75bf('0x20')];var _0x17875d;if(_0x306c51>=_0x5c3c70){_0x306c51=_0x5c3c70;_0x17875d=0xc8;}else{_0x17875d=0xce;}_0x147b98[_0x75bf('0x1a')](_0x17875d);return _0x147b98[_0x75bf('0x21')](_0x75bf('0x22'),_0x4d9c46+'-'+_0x306c51+'/'+_0x5c3c70)['json'](_0x3313ad);}return null;};}function patchUpdates(_0x4ede56){return function(_0x1d7c22){try{jsonpatch[_0x75bf('0x23')](_0x1d7c22,_0x4ede56,!![]);}catch(_0x2bb280){return BPromise[_0x75bf('0x24')](_0x2bb280);}return _0x1d7c22[_0x75bf('0x25')]();};}function saveUpdates(_0x335110,_0x1fe6d4){return function(_0xefd52){if(_0xefd52){return _0xefd52[_0x75bf('0x26')](_0x335110)[_0x75bf('0x27')](function(_0x3bf909){return _0x3bf909;});}return null;};}function removeEntity(_0x2337b4,_0x1c0949){return function(_0x605790){if(_0x605790){return _0x605790[_0x75bf('0x28')]()[_0x75bf('0x27')](function(){_0x2337b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd45c,_0x247ec7){return function(_0x1e419e){if(!_0x1e419e){_0x3bd45c['sendStatus'](0x194);}return _0x1e419e;};}function handleError(_0x437c65,_0x1b8bd3){_0x1b8bd3=_0x1b8bd3||0x1f4;return function(_0x3a1e78){logger[_0x75bf('0x29')](_0x3a1e78['stack']);if(_0x3a1e78[_0x75bf('0x2a')]){delete _0x3a1e78[_0x75bf('0x2a')];}_0x437c65['status'](_0x1b8bd3)['send'](_0x3a1e78);};}exports['index']=function(_0x514fe3,_0x2c90fc){var _0xe68661={},_0x1e31ab={},_0x427493={'count':0x0,'rows':[]};var _0xe969bf=_[_0x75bf('0x2b')](db['CmCustomField'][_0x75bf('0x2c')],function(_0x2d4f99){return{'name':_0x2d4f99[_0x75bf('0x2d')],'type':_0x2d4f99[_0x75bf('0x2e')][_0x75bf('0x2f')]};});_0x1e31ab[_0x75bf('0x30')]=_[_0x75bf('0x31')](_['map'](_0xe969bf,_0x75bf('0x2a')),['name']);_0x1e31ab[_0x75bf('0x32')]=_['keys'](_0x514fe3[_0x75bf('0x32')]);_0x1e31ab[_0x75bf('0x33')]=_[_0x75bf('0x34')](_0x1e31ab[_0x75bf('0x30')],_0x1e31ab[_0x75bf('0x32')]);_0xe68661[_0x75bf('0x35')]=_[_0x75bf('0x34')](_0x1e31ab[_0x75bf('0x30')],qs[_0x75bf('0x36')](_0x514fe3[_0x75bf('0x32')]['fields']));_0xe68661[_0x75bf('0x35')]=_0xe68661[_0x75bf('0x35')]['length']?_0xe68661['attributes']:_0x1e31ab[_0x75bf('0x30')];if(!_0x514fe3['query']['hasOwnProperty'](_0x75bf('0x37'))){_0xe68661['limit']=qs[_0x75bf('0x20')](_0x514fe3[_0x75bf('0x32')][_0x75bf('0x20')]);_0xe68661['offset']=qs[_0x75bf('0x1f')](_0x514fe3[_0x75bf('0x32')][_0x75bf('0x1f')]);}_0xe68661['order']=qs[_0x75bf('0x38')](_0x514fe3['query'][_0x75bf('0x38')]);_0xe68661[_0x75bf('0x39')]=qs[_0x75bf('0x33')](_[_0x75bf('0x3a')](_0x514fe3[_0x75bf('0x32')],_0x1e31ab[_0x75bf('0x33')]),_0xe969bf);if(_0x514fe3['query'][_0x75bf('0x3b')]){_0xe68661['where']=_[_0x75bf('0x3c')](_0xe68661[_0x75bf('0x39')],{'$or':_['map'](_0xe969bf,function(_0x8c55aa){if(_0x8c55aa[_0x75bf('0x2e')]!==_0x75bf('0x3d')){var _0x30914b={};_0x30914b[_0x8c55aa[_0x75bf('0x2a')]]={'$like':'%'+_0x514fe3[_0x75bf('0x32')][_0x75bf('0x3b')]+'%'};return _0x30914b;}})});}_0xe68661=_['merge']({},_0xe68661,_0x514fe3['options']);var _0x469b97={'where':_0xe68661[_0x75bf('0x39')]};return db[_0x75bf('0x3e')]['count'](_0x469b97)[_0x75bf('0x27')](function(_0x2c3faa){_0x427493[_0x75bf('0x1e')]=_0x2c3faa;if(_0x514fe3[_0x75bf('0x32')]['includeAll']){_0xe68661[_0x75bf('0x3f')]=[{'all':!![]}];}return db[_0x75bf('0x3e')][_0x75bf('0x40')](_0xe68661);})[_0x75bf('0x27')](function(_0x505a9b){_0x427493[_0x75bf('0x41')]=_0x505a9b;return _0x427493;})[_0x75bf('0x27')](respondWithFilteredResult(_0x2c90fc,_0xe68661))[_0x75bf('0x42')](handleError(_0x2c90fc,null));};exports[_0x75bf('0x43')]=function(_0x37db2f,_0x24fa1b){var _0x585a38={'raw':!![],'where':{'id':_0x37db2f[_0x75bf('0x44')]['id']}},_0x552ba2={};_0x552ba2['model']=_[_0x75bf('0x45')](db[_0x75bf('0x3e')]['rawAttributes']);_0x552ba2[_0x75bf('0x32')]=_[_0x75bf('0x45')](_0x37db2f[_0x75bf('0x32')]);_0x552ba2['filters']=_[_0x75bf('0x34')](_0x552ba2['model'],_0x552ba2[_0x75bf('0x32')]);_0x585a38[_0x75bf('0x35')]=_[_0x75bf('0x34')](_0x552ba2[_0x75bf('0x30')],qs[_0x75bf('0x36')](_0x37db2f[_0x75bf('0x32')][_0x75bf('0x36')]));_0x585a38['attributes']=_0x585a38[_0x75bf('0x35')][_0x75bf('0x46')]?_0x585a38[_0x75bf('0x35')]:_0x552ba2[_0x75bf('0x30')];if(_0x37db2f[_0x75bf('0x32')][_0x75bf('0x47')]){_0x585a38['include']=[{'all':!![]}];}_0x585a38=_[_0x75bf('0x3c')]({},_0x585a38,_0x37db2f[_0x75bf('0x48')]);return db[_0x75bf('0x3e')]['find'](_0x585a38)[_0x75bf('0x27')](handleEntityNotFound(_0x24fa1b,null))['then'](respondWithResult(_0x24fa1b,null))['catch'](handleError(_0x24fa1b,null));};exports[_0x75bf('0x26')]=function(_0xa66bd7,_0x1f30e8){if(_0xa66bd7[_0x75bf('0x49')]['id']){delete _0xa66bd7['body']['id'];}return db[_0x75bf('0x3e')][_0x75bf('0x4a')]({'where':{'id':_0xa66bd7[_0x75bf('0x44')]['id']}})[_0x75bf('0x27')](handleEntityNotFound(_0x1f30e8,null))[_0x75bf('0x27')](saveUpdates(_0xa66bd7[_0x75bf('0x49')],null))[_0x75bf('0x27')](respondWithResult(_0x1f30e8,null))[_0x75bf('0x42')](handleError(_0x1f30e8,null));};exports[_0x75bf('0x28')]=function(_0x5c243e,_0xe54eeb){return db[_0x75bf('0x3e')][_0x75bf('0x4a')]({'where':{'id':_0x5c243e[_0x75bf('0x44')]['id']}})[_0x75bf('0x27')](handleEntityNotFound(_0xe54eeb,null))['then'](removeEntity(_0xe54eeb,null))[_0x75bf('0x42')](handleError(_0xe54eeb,null));};exports[_0x75bf('0x4b')]=function(_0x5a4ab9,_0x354bc4){var _0x5ce1ff;return db[_0x75bf('0x4c')]['transaction'](function(_0x21d70f){return db[_0x75bf('0x3e')][_0x75bf('0x4b')](_0x5a4ab9['body'],{'transaction':_0x21d70f})[_0x75bf('0x27')](function(_0xddd8f8){_0x5ce1ff=_0xddd8f8;var _0x4aad13={'type':db['Sequelize'][_0x75bf('0x4d')],'transaction':_0x21d70f};switch(_0x5a4ab9[_0x75bf('0x49')]['type']){case _0x75bf('0x4e'):_0x4aad13['type']=db[_0x75bf('0x4f')]['TEXT'];break;case _0x75bf('0x50'):_0x4aad13[_0x75bf('0x2e')]=db[_0x75bf('0x4f')]['INTEGER'];break;case'switch':_0x4aad13['type']=db[_0x75bf('0x4f')][_0x75bf('0x51')];_0x4aad13[_0x75bf('0x52')]=![];break;default:}return db[_0x75bf('0x4c')]['queryInterface'][_0x75bf('0x53')](_0x75bf('0x54'),util['format'](_0x75bf('0x55'),_0x5ce1ff['id']),_0x4aad13);})[_0x75bf('0x27')](function(){return _0x5ce1ff;});})[_0x75bf('0x27')](respondWithResult(_0x354bc4,0xc9))[_0x75bf('0x42')](handleError(_0x354bc4,null));}; \ No newline at end of file +var _0xf5fb=['lodash','squel','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','save','update','then','destroy','error','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','catch','params','include','find','body','create','sequelize','transaction','Sequelize','TEXT','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x7e3f06,_0x426f70){var _0x12b8ff=function(_0x47c83c){while(--_0x47c83c){_0x7e3f06['push'](_0x7e3f06['shift']());}};_0x12b8ff(++_0x426f70);}(_0xf5fb,0x15d));var _0xbf5f=function(_0x1a73f7,_0x20cee3){_0x1a73f7=_0x1a73f7-0x0;var _0x46aabb=_0xf5fb[_0x1a73f7];return _0x46aabb;};'use strict';var emlformat=require(_0xbf5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf5f('0x1'));var jsonpatch=require(_0xbf5f('0x2'));var rp=require(_0xbf5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf5f('0x4'));var util=require(_0xbf5f('0x5'));var path=require(_0xbf5f('0x6'));var sox=require(_0xbf5f('0x7'));var csv=require(_0xbf5f('0x8'));var ejs=require(_0xbf5f('0x9'));var fs=require('fs');var fs_extra=require(_0xbf5f('0xa'));var _=require(_0xbf5f('0xb'));var squel=require(_0xbf5f('0xc'));var crypto=require(_0xbf5f('0xd'));var jsforce=require(_0xbf5f('0xe'));var deskjs=require(_0xbf5f('0xf'));var toCsv=require(_0xbf5f('0x8'));var querystring=require(_0xbf5f('0x10'));var Papa=require(_0xbf5f('0x11'));var Redis=require(_0xbf5f('0x12'));var authService=require(_0xbf5f('0x13'));var qs=require(_0xbf5f('0x14'));var as=require(_0xbf5f('0x15'));var hardwareService=require(_0xbf5f('0x16'));var logger=require('../../config/logger')(_0xbf5f('0x17'));var utils=require(_0xbf5f('0x18'));var config=require(_0xbf5f('0x19'));var licenseUtil=require(_0xbf5f('0x1a'));var db=require(_0xbf5f('0x1b'))['db'];function respondWithStatusCode(_0x3b217d,_0x505f7c){_0x505f7c=_0x505f7c||0xcc;return function(_0x4fb77b){if(_0x4fb77b){return _0x3b217d[_0xbf5f('0x1c')](_0x505f7c);}return _0x3b217d[_0xbf5f('0x1d')](_0x505f7c)[_0xbf5f('0x1e')]();};}function respondWithResult(_0x4c6b6c,_0x5a3e31){_0x5a3e31=_0x5a3e31||0xc8;return function(_0x406602){if(_0x406602){return _0x4c6b6c['status'](_0x5a3e31)[_0xbf5f('0x1f')](_0x406602);}};}function respondWithFilteredResult(_0x145ab,_0x30bd52){return function(_0x68a47b){if(_0x68a47b){var _0x1d40cf=typeof _0x30bd52[_0xbf5f('0x20')]===_0xbf5f('0x21')&&typeof _0x30bd52[_0xbf5f('0x22')]===_0xbf5f('0x21');var _0x190967=_0x68a47b[_0xbf5f('0x23')];var _0x39721e=_0x1d40cf?0x0:_0x30bd52[_0xbf5f('0x20')];var _0x15990b=_0x1d40cf?_0x68a47b[_0xbf5f('0x23')]:_0x30bd52[_0xbf5f('0x20')]+_0x30bd52[_0xbf5f('0x22')];var _0x385dec;if(_0x15990b>=_0x190967){_0x15990b=_0x190967;_0x385dec=0xc8;}else{_0x385dec=0xce;}_0x145ab[_0xbf5f('0x1d')](_0x385dec);return _0x145ab[_0xbf5f('0x24')](_0xbf5f('0x25'),_0x39721e+'-'+_0x15990b+'/'+_0x190967)[_0xbf5f('0x1f')](_0x68a47b);}return null;};}function patchUpdates(_0x4ebdac){return function(_0x4ae1d0){try{jsonpatch[_0xbf5f('0x26')](_0x4ae1d0,_0x4ebdac,!![]);}catch(_0x4a1b44){return BPromise['reject'](_0x4a1b44);}return _0x4ae1d0[_0xbf5f('0x27')]();};}function saveUpdates(_0x5e7e2a,_0x54da2){return function(_0x2c53fc){if(_0x2c53fc){return _0x2c53fc[_0xbf5f('0x28')](_0x5e7e2a)[_0xbf5f('0x29')](function(_0x94f59d){return _0x94f59d;});}return null;};}function removeEntity(_0x3d3c35,_0x1da823){return function(_0x1422aa){if(_0x1422aa){return _0x1422aa[_0xbf5f('0x2a')]()[_0xbf5f('0x29')](function(){_0x3d3c35['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dd582,_0x552504){return function(_0x22ff0d){if(!_0x22ff0d){_0x5dd582['sendStatus'](0x194);}return _0x22ff0d;};}function handleError(_0x1478c2,_0x83fff8){_0x83fff8=_0x83fff8||0x1f4;return function(_0x52b9af){logger[_0xbf5f('0x2b')](_0x52b9af['stack']);if(_0x52b9af[_0xbf5f('0x2c')]){delete _0x52b9af[_0xbf5f('0x2c')];}_0x1478c2[_0xbf5f('0x1d')](_0x83fff8)[_0xbf5f('0x2d')](_0x52b9af);};}exports[_0xbf5f('0x2e')]=function(_0x54a6a1,_0x1c55da){var _0x37a905={},_0x1ae04e={},_0x4dc57c={'count':0x0,'rows':[]};var _0x310d0b=_['map'](db[_0xbf5f('0x2f')][_0xbf5f('0x30')],function(_0x1f94b2){return{'name':_0x1f94b2[_0xbf5f('0x31')],'type':_0x1f94b2[_0xbf5f('0x32')][_0xbf5f('0x33')]};});_0x1ae04e['model']=_[_0xbf5f('0x34')](_[_0xbf5f('0x35')](_0x310d0b,_0xbf5f('0x2c')),[_0xbf5f('0x2c')]);_0x1ae04e[_0xbf5f('0x36')]=_[_0xbf5f('0x37')](_0x54a6a1[_0xbf5f('0x36')]);_0x1ae04e[_0xbf5f('0x38')]=_[_0xbf5f('0x39')](_0x1ae04e[_0xbf5f('0x3a')],_0x1ae04e[_0xbf5f('0x36')]);_0x37a905[_0xbf5f('0x3b')]=_[_0xbf5f('0x39')](_0x1ae04e[_0xbf5f('0x3a')],qs[_0xbf5f('0x3c')](_0x54a6a1['query'][_0xbf5f('0x3c')]));_0x37a905[_0xbf5f('0x3b')]=_0x37a905[_0xbf5f('0x3b')]['length']?_0x37a905[_0xbf5f('0x3b')]:_0x1ae04e['model'];if(!_0x54a6a1[_0xbf5f('0x36')][_0xbf5f('0x3d')](_0xbf5f('0x3e'))){_0x37a905[_0xbf5f('0x22')]=qs[_0xbf5f('0x22')](_0x54a6a1[_0xbf5f('0x36')][_0xbf5f('0x22')]);_0x37a905['offset']=qs['offset'](_0x54a6a1[_0xbf5f('0x36')][_0xbf5f('0x20')]);}_0x37a905[_0xbf5f('0x3f')]=qs[_0xbf5f('0x40')](_0x54a6a1['query'][_0xbf5f('0x40')]);_0x37a905['where']=qs['filters'](_[_0xbf5f('0x41')](_0x54a6a1[_0xbf5f('0x36')],_0x1ae04e['filters']),_0x310d0b);if(_0x54a6a1[_0xbf5f('0x36')][_0xbf5f('0x42')]){_0x37a905['where']=_[_0xbf5f('0x43')](_0x37a905['where'],{'$or':_[_0xbf5f('0x35')](_0x310d0b,function(_0xe8d405){if(_0xe8d405[_0xbf5f('0x32')]!==_0xbf5f('0x44')){var _0x101d45={};_0x101d45[_0xe8d405['name']]={'$like':'%'+_0x54a6a1['query'][_0xbf5f('0x42')]+'%'};return _0x101d45;}})});}_0x37a905=_[_0xbf5f('0x43')]({},_0x37a905,_0x54a6a1[_0xbf5f('0x45')]);var _0x2f268f={'where':_0x37a905[_0xbf5f('0x46')]};return db['CmCustomField'][_0xbf5f('0x23')](_0x2f268f)['then'](function(_0x21adad){_0x4dc57c[_0xbf5f('0x23')]=_0x21adad;if(_0x54a6a1[_0xbf5f('0x36')][_0xbf5f('0x47')]){_0x37a905['include']=[{'all':!![]}];}return db[_0xbf5f('0x2f')][_0xbf5f('0x48')](_0x37a905);})[_0xbf5f('0x29')](function(_0xfe3d12){_0x4dc57c['rows']=_0xfe3d12;return _0x4dc57c;})[_0xbf5f('0x29')](respondWithFilteredResult(_0x1c55da,_0x37a905))[_0xbf5f('0x49')](handleError(_0x1c55da,null));};exports['show']=function(_0x33ae31,_0xb74824){var _0x5756f3={'raw':!![],'where':{'id':_0x33ae31[_0xbf5f('0x4a')]['id']}},_0x11af96={};_0x11af96['model']=_[_0xbf5f('0x37')](db[_0xbf5f('0x2f')][_0xbf5f('0x30')]);_0x11af96[_0xbf5f('0x36')]=_[_0xbf5f('0x37')](_0x33ae31['query']);_0x11af96[_0xbf5f('0x38')]=_[_0xbf5f('0x39')](_0x11af96[_0xbf5f('0x3a')],_0x11af96[_0xbf5f('0x36')]);_0x5756f3[_0xbf5f('0x3b')]=_[_0xbf5f('0x39')](_0x11af96[_0xbf5f('0x3a')],qs['fields'](_0x33ae31[_0xbf5f('0x36')][_0xbf5f('0x3c')]));_0x5756f3[_0xbf5f('0x3b')]=_0x5756f3['attributes']['length']?_0x5756f3['attributes']:_0x11af96['model'];if(_0x33ae31['query'][_0xbf5f('0x47')]){_0x5756f3[_0xbf5f('0x4b')]=[{'all':!![]}];}_0x5756f3=_['merge']({},_0x5756f3,_0x33ae31['options']);return db['CmCustomField'][_0xbf5f('0x4c')](_0x5756f3)[_0xbf5f('0x29')](handleEntityNotFound(_0xb74824,null))[_0xbf5f('0x29')](respondWithResult(_0xb74824,null))[_0xbf5f('0x49')](handleError(_0xb74824,null));};exports[_0xbf5f('0x28')]=function(_0x62694a,_0x5c6f44){if(_0x62694a[_0xbf5f('0x4d')]['id']){delete _0x62694a[_0xbf5f('0x4d')]['id'];}return db[_0xbf5f('0x2f')]['find']({'where':{'id':_0x62694a[_0xbf5f('0x4a')]['id']}})[_0xbf5f('0x29')](handleEntityNotFound(_0x5c6f44,null))[_0xbf5f('0x29')](saveUpdates(_0x62694a[_0xbf5f('0x4d')],null))[_0xbf5f('0x29')](respondWithResult(_0x5c6f44,null))[_0xbf5f('0x49')](handleError(_0x5c6f44,null));};exports[_0xbf5f('0x2a')]=function(_0xe69549,_0x357051){return db['CmCustomField']['find']({'where':{'id':_0xe69549[_0xbf5f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x357051,null))[_0xbf5f('0x29')](removeEntity(_0x357051,null))[_0xbf5f('0x49')](handleError(_0x357051,null));};exports[_0xbf5f('0x4e')]=function(_0x5c0bb2,_0x3ba6e0){var _0x2d2685;return db[_0xbf5f('0x4f')][_0xbf5f('0x50')](function(_0x47e4cd){return db[_0xbf5f('0x2f')]['create'](_0x5c0bb2[_0xbf5f('0x4d')],{'transaction':_0x47e4cd})['then'](function(_0x1acbff){_0x2d2685=_0x1acbff;var _0x28e870={'type':db[_0xbf5f('0x51')]['TEXT'],'transaction':_0x47e4cd};switch(_0x5c0bb2[_0xbf5f('0x4d')][_0xbf5f('0x32')]){case'text':_0x28e870[_0xbf5f('0x32')]=db['Sequelize'][_0xbf5f('0x52')];break;case _0xbf5f('0x53'):_0x28e870[_0xbf5f('0x32')]=db['Sequelize']['INTEGER'];break;case _0xbf5f('0x54'):_0x28e870[_0xbf5f('0x32')]=db[_0xbf5f('0x51')]['BOOLEAN'];_0x28e870[_0xbf5f('0x55')]=![];break;default:}return db[_0xbf5f('0x4f')][_0xbf5f('0x56')][_0xbf5f('0x57')](_0xbf5f('0x58'),util['format'](_0xbf5f('0x59'),_0x2d2685['id']),_0x28e870);})['then'](function(){return _0x2d2685;});})[_0xbf5f('0x29')](respondWithResult(_0x3ba6e0,0xc9))[_0xbf5f('0x49')](handleError(_0x3ba6e0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8369dcd..dc24971 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 _0xd275=['rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd275,0x10e));var _0x5d27=function(_0xb45ffc,_0x2e7440){_0xb45ffc=_0xb45ffc-0x0;var _0x1fbe30=_0xd275[_0xb45ffc];return _0x1fbe30;};'use strict';var _=require(_0x5d27('0x0'));var util=require('util');var logger=require(_0x5d27('0x1'))(_0x5d27('0x2'));var moment=require(_0x5d27('0x3'));var BPromise=require(_0x5d27('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d27('0x5'));var config=require(_0x5d27('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x5d27('0x7')]=function(_0x44f7f8,_0x48e7de){return _0x44f7f8[_0x5d27('0x8')](_0x5d27('0x9'),attributes,{'tableName':_0x5d27('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc597=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment'];(function(_0x2e4df8,_0x3edeac){var _0x22e5d4=function(_0x3facd7){while(--_0x3facd7){_0x2e4df8['push'](_0x2e4df8['shift']());}};_0x22e5d4(++_0x3edeac);}(_0xc597,0xdd));var _0x7c59=function(_0x54e856,_0x313d5c){_0x54e856=_0x54e856-0x0;var _0x124873=_0xc597[_0x54e856];return _0x124873;};'use strict';var _=require('lodash');var util=require(_0x7c59('0x0'));var logger=require(_0x7c59('0x1'))(_0x7c59('0x2'));var moment=require(_0x7c59('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7c59('0x4'));var attributes=require(_0x7c59('0x5'));module[_0x7c59('0x6')]=function(_0x8f5e9a,_0xbaa3cc){return _0x8f5e9a['define'](_0x7c59('0x7'),attributes,{'tableName':_0x7c59('0x8'),'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 3384883..a375d56 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 _0x99f3=['../../config/environment','client','http','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x436a4a,_0x5622d3){var _0x39e3ec=function(_0x40b558){while(--_0x40b558){_0x436a4a['push'](_0x436a4a['shift']());}};_0x39e3ec(++_0x5622d3);}(_0x99f3,0x1dc));var _0x399f=function(_0x37dcf8,_0x50437b){_0x37dcf8=_0x37dcf8-0x0;var _0x1d121c=_0x99f3[_0x37dcf8];return _0x1d121c;};'use strict';var _=require('lodash');var util=require(_0x399f('0x0'));var moment=require(_0x399f('0x1'));var BPromise=require('bluebird');var rs=require(_0x399f('0x2'));var fs=require('fs');var Redis=require(_0x399f('0x3'));var db=require(_0x399f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x399f('0x5'))(_0x399f('0x6'));var config=require(_0x399f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x399f('0x8')][_0x399f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ec4b,_0x472a55,_0x2a2927){return new BPromise(function(_0x4e2e7e,_0x2bf589){return client['request'](_0x55ec4b,_0x2a2927)['then'](function(_0x123610){logger[_0x399f('0xa')]('CmCustomField,\x20%s,\x20%s',_0x472a55,'request\x20sent');logger[_0x399f('0xb')](_0x399f('0xc'),_0x472a55,_0x399f('0xd'),JSON[_0x399f('0xe')](_0x123610));if(_0x123610['error']){if(_0x123610[_0x399f('0xf')][_0x399f('0x10')]===0x1f4){logger[_0x399f('0xf')](_0x399f('0x11'),_0x472a55,_0x123610[_0x399f('0xf')]['message']);return _0x2bf589(_0x123610[_0x399f('0xf')][_0x399f('0x12')]);}logger[_0x399f('0xf')]('CmCustomField,\x20%s,\x20%s',_0x472a55,_0x123610[_0x399f('0xf')][_0x399f('0x12')]);return _0x4e2e7e(_0x123610[_0x399f('0xf')][_0x399f('0x12')]);}else{logger['info'](_0x399f('0x11'),_0x472a55,_0x399f('0xd'));_0x4e2e7e(_0x123610[_0x399f('0x13')][_0x399f('0x12')]);}})[_0x399f('0x14')](function(_0x199420){logger['error'](_0x399f('0x11'),_0x472a55,_0x199420);_0x2bf589(_0x199420);});});} \ No newline at end of file +var _0xc10c=['rpc','client','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc10c,0x10d));var _0xcc10=function(_0x647508,_0x39d116){_0x647508=_0x647508-0x0;var _0x4c54b1=_0xc10c[_0x647508];return _0x4c54b1;};'use strict';var _=require(_0xcc10('0x0'));var util=require(_0xcc10('0x1'));var moment=require(_0xcc10('0x2'));var BPromise=require(_0xcc10('0x3'));var rs=require(_0xcc10('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc10('0x5'));var logger=require(_0xcc10('0x6'))(_0xcc10('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc10('0x8')][_0xcc10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x199d72,_0x625b55,_0x13af76){return new BPromise(function(_0x1730e2,_0x33f807){return client[_0xcc10('0xa')](_0x199d72,_0x13af76)[_0xcc10('0xb')](function(_0x5a8a1d){logger[_0xcc10('0xc')]('CmCustomField,\x20%s,\x20%s',_0x625b55,'request\x20sent');logger[_0xcc10('0xd')](_0xcc10('0xe'),_0x625b55,_0xcc10('0xf'),JSON[_0xcc10('0x10')](_0x5a8a1d));if(_0x5a8a1d[_0xcc10('0x11')]){if(_0x5a8a1d[_0xcc10('0x11')][_0xcc10('0x12')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x625b55,_0x5a8a1d[_0xcc10('0x11')]['message']);return _0x33f807(_0x5a8a1d[_0xcc10('0x11')][_0xcc10('0x13')]);}logger[_0xcc10('0x11')](_0xcc10('0x14'),_0x625b55,_0x5a8a1d[_0xcc10('0x11')]['message']);return _0x1730e2(_0x5a8a1d['error'][_0xcc10('0x13')]);}else{logger['info'](_0xcc10('0x14'),_0x625b55,_0xcc10('0xf'));_0x1730e2(_0x5a8a1d[_0xcc10('0x15')][_0xcc10('0x13')]);}})[_0xcc10('0x16')](function(_0x32e07a){logger[_0xcc10('0x11')](_0xcc10('0x14'),_0x625b55,_0x32e07a);_0x33f807(_0x32e07a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index da5b1d2..3214839 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 _0xd5b2=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x1f8cf7,_0xc62474){var _0x5ac9d4=function(_0x5a6cf0){while(--_0x5a6cf0){_0x1f8cf7['push'](_0x1f8cf7['shift']());}};_0x5ac9d4(++_0xc62474);}(_0xd5b2,0x10e));var _0x2d5b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd5b2[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0x2d5b('0x0'));var path=require(_0x2d5b('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d5b('0x2'));var router=express[_0x2d5b('0x3')]();var fs_extra=require(_0x2d5b('0x4'));var auth=require(_0x2d5b('0x5'));var interaction=require(_0x2d5b('0x6'));var config=require(_0x2d5b('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2d5b('0x8')]);router['get'](_0x2d5b('0x9'),auth['isAuthenticated'](),controller[_0x2d5b('0xa')]);router['post']('/',auth[_0x2d5b('0xb')](),controller[_0x2d5b('0xc')]);router[_0x2d5b('0xd')](_0x2d5b('0x9'),auth[_0x2d5b('0xb')](),controller[_0x2d5b('0xe')]);router[_0x2d5b('0xf')](_0x2d5b('0x9'),auth[_0x2d5b('0xb')](),controller[_0x2d5b('0x10')]);module[_0x2d5b('0x11')]=router; \ No newline at end of file +var _0x06f4=['delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','create'];(function(_0x1ccc03,_0x2b4bcb){var _0x4f335a=function(_0x34bc3b){while(--_0x34bc3b){_0x1ccc03['push'](_0x1ccc03['shift']());}};_0x4f335a(++_0x2b4bcb);}(_0x06f4,0x136));var _0x406f=function(_0x17822a,_0x31daba){_0x17822a=_0x17822a-0x0;var _0x4fb945=_0x06f4[_0x17822a];return _0x4fb945;};'use strict';var multer=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var path=require('path');var timeout=require(_0x406f('0x2'));var express=require(_0x406f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x406f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x406f('0x5'));var controller=require(_0x406f('0x6'));router[_0x406f('0x7')]('/',auth[_0x406f('0x8')](),controller['index']);router[_0x406f('0x7')]('/:id',auth[_0x406f('0x8')](),controller[_0x406f('0x9')]);router[_0x406f('0xa')]('/',auth['isAuthenticated'](),controller[_0x406f('0xb')]);router['put']('/:id',auth[_0x406f('0x8')](),controller['update']);router[_0x406f('0xc')]('/:id',auth[_0x406f('0x8')](),controller['destroy']);module[_0x406f('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 11b50b8..7925571 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 _0xe413=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x53ae51,_0x2a0cc4){var _0x593ed8=function(_0x18aa50){while(--_0x18aa50){_0x53ae51['push'](_0x53ae51['shift']());}};_0x593ed8(++_0x2a0cc4);}(_0xe413,0xa5));var _0x3e41=function(_0xa4495a,_0x521f12){_0xa4495a=_0xa4495a-0x0;var _0x362289=_0xe413[_0xa4495a];return _0x362289;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e41('0x0'));module[_0x3e41('0x1')]={'phone':{'type':Sequelize[_0x3e41('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x3e41('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3e41('0x4')],'defaultValue':moment()[_0x3e41('0x5')](_0x3e41('0x6'))},'countbusyretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3e41('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3e41('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3e41('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3e41('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3e41('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3e41('0x7')],'unique':_0x3e41('0x8')},'UserId':{'type':Sequelize[_0x3e41('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x3e41('0x7')],'unique':_0x3e41('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3e41('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3e41('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x84e9=['INTEGER','UNSIGNED','BOOLEAN','contactListQueue','STRING','moment','sequelize','exports','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x16fb48,_0x4a6c2c){var _0x5c3997=function(_0x5d51c9){while(--_0x5d51c9){_0x16fb48['push'](_0x16fb48['shift']());}};_0x5c3997(++_0x4a6c2c);}(_0x84e9,0x1b2));var _0x984e=function(_0x489e0c,_0x4f57e1){_0x489e0c=_0x489e0c-0x0;var _0x47e86e=_0x84e9[_0x489e0c];return _0x47e86e;};'use strict';var moment=require(_0x984e('0x0'));var Sequelize=require(_0x984e('0x1'));module[_0x984e('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x984e('0x3')],'defaultValue':moment()[_0x984e('0x4')](_0x984e('0x5'))},'countbusyretry':{'type':Sequelize[_0x984e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x984e('0x6')](0x2)[_0x984e('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x984e('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x984e('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x984e('0x6')],'unique':_0x984e('0x9')},'UserId':{'type':Sequelize[_0x984e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x984e('0x6')],'unique':_0x984e('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x984e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x984e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x984e('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x984e('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x984e('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x984e('0xa')]},'recallmeNotifiedDate':{'type':Sequelize[_0x984e('0x3')],'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 7affd07..c4ec0df 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 _0x9f5a=['omit','dataValues','state','statedesc','campaign','membername','user','UserId','deleted','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','finally','CmHopperFinal','end','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','phone','LOCK','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','findOne','scheduledat','UPDATE','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','rows','catch','params','length','includeAll','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue'];(function(_0x5f1b05,_0x5b61d2){var _0x140a0d=function(_0x242f7a){while(--_0x242f7a){_0x5f1b05['push'](_0x5f1b05['shift']());}};_0x140a0d(++_0x5b61d2);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x45587c,_0x4610dc){_0x45587c=_0x45587c-0x0;var _0xc76f17=_0x9f5a[_0x45587c];return _0xc76f17;};'use strict';var moment=require(_0xa9f5('0x0'));var _=require(_0xa9f5('0x1'));var qs=require(_0xa9f5('0x2'));var logger=require(_0xa9f5('0x3'))('api');var shared=require(_0xa9f5('0x4'));var db=require(_0xa9f5('0x5'))['db'];function respondWithResult(_0x3cdf79,_0x4eeedd){_0x4eeedd=_0x4eeedd||0xc8;return function(_0x20f51f){if(_0x20f51f){return _0x3cdf79['status'](_0x4eeedd)[_0xa9f5('0x6')](_0x20f51f);}};}function respondWithFilteredResult(_0x219e89,_0x49e337){return function(_0x6c040d){if(_0x6c040d){var _0x285dad=typeof _0x49e337[_0xa9f5('0x7')]===_0xa9f5('0x8')&&typeof _0x49e337[_0xa9f5('0x9')]===_0xa9f5('0x8');var _0x189ef8=_0x6c040d['count'];var _0x2e0ff8=_0x285dad?0x0:_0x49e337[_0xa9f5('0x7')];var _0x4bb362=_0x285dad?_0x6c040d[_0xa9f5('0xa')]:_0x49e337[_0xa9f5('0x7')]+_0x49e337['limit'];var _0x5866a1;if(_0x4bb362>=_0x189ef8){_0x4bb362=_0x189ef8;_0x5866a1=0xc8;}else{_0x5866a1=0xce;}_0x219e89[_0xa9f5('0xb')](_0x5866a1);return _0x219e89[_0xa9f5('0xc')](_0xa9f5('0xd'),_0x2e0ff8+'-'+_0x4bb362+'/'+_0x189ef8)[_0xa9f5('0x6')](_0x6c040d);}return null;};}function saveUpdates(_0x4c26a8,_0x788dec){return function(_0x24ce85){if(_0x24ce85){return _0x24ce85[_0xa9f5('0xe')](_0x4c26a8)['then'](function(_0xc78de5){return _0xc78de5;});}return null;};}function handleEntityNotFound(_0x899513,_0x5a5653){return function(_0x58609c){if(!_0x58609c){_0x899513['sendStatus'](0x194);}return _0x58609c;};}function handleError(_0x100e72,_0x48bfdc){_0x48bfdc=_0x48bfdc||0x1f4;return function(_0x5f2b6a){logger[_0xa9f5('0xf')](_0x5f2b6a[_0xa9f5('0x10')]);if(_0x5f2b6a[_0xa9f5('0x11')]){delete _0x5f2b6a[_0xa9f5('0x11')];}_0x100e72['status'](_0x48bfdc)[_0xa9f5('0x12')](_0x5f2b6a);};}exports[_0xa9f5('0x13')]=function(_0x230fc2,_0x45af85){var _0x2fe6a7={},_0x1ee027={},_0x3b706b={'count':0x0,'rows':[]};var _0x430acb=_[_0xa9f5('0x14')](db[_0xa9f5('0x15')][_0xa9f5('0x16')],function(_0x27a7b0){return{'name':_0x27a7b0['fieldName'],'type':_0x27a7b0[_0xa9f5('0x17')][_0xa9f5('0x18')]};});_0x1ee027[_0xa9f5('0x19')]=_[_0xa9f5('0x14')](_0x430acb,_0xa9f5('0x11'));_0x1ee027[_0xa9f5('0x1a')]=_[_0xa9f5('0x1b')](_0x230fc2['query']);_0x1ee027[_0xa9f5('0x1c')]=_[_0xa9f5('0x1d')](_0x1ee027[_0xa9f5('0x19')],_0x1ee027[_0xa9f5('0x1a')]);_0x1ee027[_0xa9f5('0x1c')]=_[_0xa9f5('0x1e')](_0x1ee027[_0xa9f5('0x1c')],[_0xa9f5('0x1f'),'$or',_0xa9f5('0x20'),_0xa9f5('0x21'),_0xa9f5('0x22'),_0xa9f5('0x23'),_0xa9f5('0x24'),_0xa9f5('0x25'),'$not',_0xa9f5('0x26'),'$notBetween','$in','$notIn',_0xa9f5('0x27'),_0xa9f5('0x28'),_0xa9f5('0x29'),_0xa9f5('0x2a'),_0xa9f5('0x27'),_0xa9f5('0x2b'),'$contains',_0xa9f5('0x2c'),_0xa9f5('0x2d')]);_0x2fe6a7[_0xa9f5('0x2e')]=_[_0xa9f5('0x1d')](_0x1ee027[_0xa9f5('0x19')],qs[_0xa9f5('0x2f')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x2f')]));_0x2fe6a7['attributes']=_0x2fe6a7['attributes']['length']?_0x2fe6a7[_0xa9f5('0x2e')]:_0x1ee027[_0xa9f5('0x19')];if(!_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x30')](_0xa9f5('0x31'))){_0x2fe6a7[_0xa9f5('0x9')]=qs[_0xa9f5('0x9')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x9')]);_0x2fe6a7[_0xa9f5('0x7')]=qs[_0xa9f5('0x7')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x7')]);}_0x2fe6a7['order']=qs[_0xa9f5('0x32')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x32')]);_0x2fe6a7[_0xa9f5('0x33')]=qs[_0xa9f5('0x1c')](_[_0xa9f5('0x34')](_0x230fc2[_0xa9f5('0x1a')],_0x1ee027[_0xa9f5('0x1c')]),_0x430acb);if(_0x230fc2['query'][_0xa9f5('0x35')]){_0x2fe6a7['where']=_[_0xa9f5('0x36')](_0x2fe6a7[_0xa9f5('0x33')],{'$or':_['map'](_0x430acb,function(_0x11cc39){if(_0x11cc39[_0xa9f5('0x17')]!==_0xa9f5('0x37')){var _0x2cbd28={};_0x2cbd28[_0x11cc39['name']]={'$like':'%'+_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x35')]+'%'};return _0x2cbd28;}})});}_0x2fe6a7=_['merge']({},_0x2fe6a7,_0x230fc2[_0xa9f5('0x38')]);var _0x23232b={'where':_0x2fe6a7[_0xa9f5('0x33')]};return db[_0xa9f5('0x15')][_0xa9f5('0xa')](_0x23232b)[_0xa9f5('0x39')](function(_0x1d71f8){_0x3b706b[_0xa9f5('0xa')]=_0x1d71f8;if(_0x230fc2[_0xa9f5('0x1a')]['includeAll']){_0x2fe6a7['include']=[{'all':!![]}];}return db[_0xa9f5('0x15')][_0xa9f5('0x3a')](_0x2fe6a7);})['then'](function(_0x90b200){_0x3b706b[_0xa9f5('0x3b')]=_0x90b200;return _0x3b706b;})[_0xa9f5('0x39')](respondWithFilteredResult(_0x45af85,_0x2fe6a7))[_0xa9f5('0x3c')](handleError(_0x45af85,null));};exports['show']=function(_0x2bc650,_0x39f83f){var _0x5a4715={'raw':!![],'where':{'id':_0x2bc650[_0xa9f5('0x3d')]['id']}},_0x1d856f={};_0x1d856f['model']=_[_0xa9f5('0x1b')](db[_0xa9f5('0x15')]['rawAttributes']);_0x1d856f[_0xa9f5('0x1a')]=_[_0xa9f5('0x1b')](_0x2bc650['query']);_0x1d856f[_0xa9f5('0x1c')]=_[_0xa9f5('0x1d')](_0x1d856f['model'],_0x1d856f[_0xa9f5('0x1a')]);_0x5a4715['attributes']=_[_0xa9f5('0x1d')](_0x1d856f[_0xa9f5('0x19')],qs['fields'](_0x2bc650[_0xa9f5('0x1a')]['fields']));_0x5a4715['attributes']=_0x5a4715[_0xa9f5('0x2e')][_0xa9f5('0x3e')]?_0x5a4715[_0xa9f5('0x2e')]:_0x1d856f[_0xa9f5('0x19')];if(_0x2bc650[_0xa9f5('0x1a')][_0xa9f5('0x3f')]){_0x5a4715[_0xa9f5('0x40')]=[{'all':!![]}];}_0x5a4715=_[_0xa9f5('0x36')]({},_0x5a4715,_0x2bc650[_0xa9f5('0x38')]);return db['CmHopper'][_0xa9f5('0x41')](_0x5a4715)[_0xa9f5('0x39')](handleEntityNotFound(_0x39f83f,null))[_0xa9f5('0x39')](respondWithResult(_0x39f83f,null))[_0xa9f5('0x3c')](handleError(_0x39f83f,null));};exports[_0xa9f5('0x42')]=function(_0x2b00db,_0x11c1d4){return db[_0xa9f5('0x15')][_0xa9f5('0x42')](_0x2b00db[_0xa9f5('0x43')],{})[_0xa9f5('0x39')](respondWithResult(_0x11c1d4,0xc9))[_0xa9f5('0x3c')](handleError(_0x11c1d4,null));};exports[_0xa9f5('0xe')]=function(_0xd95e3,_0x2dc190){if(_0xd95e3[_0xa9f5('0x43')]['id']){delete _0xd95e3[_0xa9f5('0x43')]['id'];}return db[_0xa9f5('0x15')][_0xa9f5('0x41')]({'where':{'id':_0xd95e3['params']['id']}})['then'](handleEntityNotFound(_0x2dc190,null))[_0xa9f5('0x39')](saveUpdates(_0xd95e3[_0xa9f5('0x43')],null))['then'](respondWithResult(_0x2dc190,null))[_0xa9f5('0x3c')](handleError(_0x2dc190,null));};exports[_0xa9f5('0x44')]=function(_0x44ee96,_0x59e5b7){return db[_0xa9f5('0x15')]['describe']()[_0xa9f5('0x39')](respondWithResult(_0x59e5b7,null))[_0xa9f5('0x3c')](handleError(_0x59e5b7,null));};exports[_0xa9f5('0x45')]=function(_0x836a8d,_0x102ed8){var _0x57c877;var _0x4e17a9=_0x836a8d[_0xa9f5('0x3d')]['id'];return db['CmHopper']['find']({'where':{'id':_0x836a8d[_0xa9f5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x102ed8,null))[_0xa9f5('0x39')](function(_0x56fe65){if(_0x56fe65){return _0x56fe65[_0xa9f5('0x45')]()[_0xa9f5('0x39')](function(_0xafeecc){return _0xafeecc;});}})['then'](function(_0x2cc06e){_0x57c877=_0x2cc06e;if(_0x2cc06e){if(_0x2cc06e[_0xa9f5('0x46')]||_0x2cc06e[_0xa9f5('0x47')]){return db[_0x2cc06e['VoiceQueueId']?_0xa9f5('0x48'):'Campaign']['find']({'where':{'id':_0x2cc06e[_0xa9f5('0x46')]?_0x2cc06e[_0xa9f5('0x46')]:_0x2cc06e[_0xa9f5('0x47')]},'attributes':['id',_0xa9f5('0x11')],'raw':!![]});}}})['then'](function(_0x31cf70){var _0x58b278={};if(_0x31cf70){_[_0xa9f5('0x36')](_0x58b278,_[_0xa9f5('0x49')](_0x57c877[_0xa9f5('0x4a')],['createdAt','updatedAt','id']));_0x58b278[_0xa9f5('0x4b')]=0x15;_0x58b278[_0xa9f5('0x4c')]='deleted';_0x58b278[_0xa9f5('0x4d')]=_0x31cf70[_0xa9f5('0x11')];_0x58b278[_0xa9f5('0x4e')]=_0x836a8d[_0xa9f5('0x4f')][_0xa9f5('0x11')];_0x58b278[_0xa9f5('0x50')]=_0x836a8d[_0xa9f5('0x4f')]['id'];_0x58b278[_0xa9f5('0x51')]=!![];_0x58b278['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58b278[_0xa9f5('0x52')]=_0x57c877['phone'];_0x58b278[_0xa9f5('0x53')]=_0x57c877[_0xa9f5('0x46')]?_0xa9f5('0x54'):_0xa9f5('0x55');return db[_0xa9f5('0x56')][_0xa9f5('0x41')]({'where':{'id':_0x58b278['ContactId']},'attributes':[_0xa9f5('0x57'),_0xa9f5('0x58')]})[_0xa9f5('0x39')](function(_0x19dad6){if(!_[_0xa9f5('0x59')](_0x102ed8)&&!_['isNil'](_0x19dad6[_0xa9f5('0x57')])){_0x58b278['calleridname']=_0x19dad6['firstName'];if(!_['isNil'](_0x19dad6[_0xa9f5('0x58')])){_0x58b278['calleridname']+='\x20'+_0x19dad6[_0xa9f5('0x58')];}}})[_0xa9f5('0x5a')](function(){return db[_0xa9f5('0x5b')]['create'](_0x58b278);});}})['then'](function(_0x2ee9cf){return db['CmHopperAdditionalPhone'][_0xa9f5('0x45')]({'where':{'CmHopperId':_0x4e17a9}});})[_0xa9f5('0x39')](function(){return _0x102ed8[_0xa9f5('0xb')](0xcc)[_0xa9f5('0x5c')]();})[_0xa9f5('0x3c')](handleError(_0x102ed8,null));};exports[_0xa9f5('0x5d')]=function(_0x34c6cb,_0x28ee02){var _0x326a87=[];return db['CmContact']['describe']()[_0xa9f5('0x39')](function(_0x51bd6f){_0x326a87=_[_0xa9f5('0x1b')](_0x51bd6f);return _0x34c6cb[_0xa9f5('0x4f')]['getVoiceQueues']({'where':{'type':_0xa9f5('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa9f5('0x5f'),_0xa9f5('0x60')],'raw':!![]});})[_0xa9f5('0x39')](function(_0x5c661e){if(_0x5c661e&&_0x5c661e[_0xa9f5('0x3e')]){return db[_0xa9f5('0x61')][_0xa9f5('0x62')](function(_0x5ab4c0){var _0x2eaa8c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9f5('0x63')](_0xa9f5('0x64'))},'VoiceQueueId':{'$in':_[_0xa9f5('0x14')](_0x5c661e,'id')},'$or':[{'UserId':null},{'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']}]};var _0x5f0986={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5c661e)[_0xa9f5('0x35')](['dialPreviewAutoRecallMe',0x0])[_0xa9f5('0x14')]('id')[_0xa9f5('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']}]};var _0x272c19={'$or':[_0x2eaa8c,_0x5f0986]};var _0x3a79f1=[];if(_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x66')]&&_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x66')]===_0xa9f5('0x67')){if(!_[_0xa9f5('0x68')](_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')])){_0x272c19['id']={'$in':_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')]};}_0x3a79f1=[['priority',_0xa9f5('0x6a')],[_0xa9f5('0x6b'),_0x5c661e[0x0][_0xa9f5('0x5f')]===_0xa9f5('0x6a')?'DESC':_0xa9f5('0x6a')],db[_0xa9f5('0x61')][_0xa9f5('0x6c')](_0xa9f5('0x6d')),['id','DESC']];}else{if(!_[_0xa9f5('0x68')](_0x34c6cb[_0xa9f5('0x43')]['hopperIds'])){_0x272c19['id']={'$notIn':_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')]};}_0x3a79f1=[['priority','DESC'],[_0xa9f5('0x6b'),_0x5c661e[0x0][_0xa9f5('0x5f')]],db[_0xa9f5('0x61')][_0xa9f5('0x6c')](_0xa9f5('0x6e')),['id',_0xa9f5('0x6a')]];}return db[_0xa9f5('0x15')]['findOne']({'attributes':['id','scheduledat',_0xa9f5('0x6f'),'recallme'],'where':_0x272c19,'order':_0x3a79f1,'transaction':_0x5ab4c0,'lock':_0x5ab4c0[_0xa9f5('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa9f5('0x71'),'attributes':_0x326a87,'include':[{'model':db[_0xa9f5('0x72')],'as':_0xa9f5('0x73'),'attributes':['id',_0xa9f5('0x11')]}]},{'model':db['CmList'],'as':_0xa9f5('0x74'),'attributes':['id',_0xa9f5('0x11')]},{'model':db[_0xa9f5('0x48')],'as':_0xa9f5('0x75'),'attributes':['id',_0xa9f5('0x11'),_0xa9f5('0x76')]}]})[_0xa9f5('0x39')](function(_0x25da3e){if(_0x25da3e){return _0x25da3e[_0xa9f5('0xe')]({'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']},{'transaction':_0x5ab4c0});}});});}})['then'](handleEntityNotFound(_0x28ee02,null))['then'](respondWithResult(_0x28ee02,null))[_0xa9f5('0x3c')](handleError(_0x28ee02,null));};exports[_0xa9f5('0x77')]=function(_0x53875e,_0x52cae4,_0x3c754a){var _0x18647f=[];var _0x36b1a0=_0x53875e[_0xa9f5('0x3d')]['id'];var _0x26a27a=_0x53875e[_0xa9f5('0x4f')]['id'];return db[_0xa9f5('0x56')][_0xa9f5('0x44')]()[_0xa9f5('0x39')](function(_0x56d603){_0x18647f=_['keys'](_0x56d603);return db[_0xa9f5('0x61')][_0xa9f5('0x62')](function(_0x5a8788){const _0x5e7a9b={'id':_0x36b1a0};return db[_0xa9f5('0x15')][_0xa9f5('0x78')]({'attributes':['id',_0xa9f5('0x79'),'recallme'],'where':_0x5e7a9b,'transaction':_0x5a8788,'lock':_0x5a8788[_0xa9f5('0x70')][_0xa9f5('0x7a')],'include':[{'model':db[_0xa9f5('0x56')],'as':'Contact','attributes':_0x18647f,'include':[{'model':db[_0xa9f5('0x72')],'as':_0xa9f5('0x73'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xa9f5('0x74'),'attributes':['id','name']},{'model':db[_0xa9f5('0x48')],'as':_0xa9f5('0x75'),'attributes':['id',_0xa9f5('0x11'),'dialActive']}]})[_0xa9f5('0x39')](function(_0x4b61e5){if(_0x4b61e5){return _0x4b61e5['update']({'UserId':_0x26a27a},{'transaction':_0x5a8788});}});});})[_0xa9f5('0x39')](handleEntityNotFound(_0x52cae4,null))[_0xa9f5('0x39')](respondWithResult(_0x52cae4,null))[_0xa9f5('0x3c')](handleError(_0x52cae4,null));};exports[_0xa9f5('0x7b')]=function(_0x4e874b,_0x2ba0c2){return _0x4e874b[_0xa9f5('0x4f')]['getVoiceQueues']({'where':{'type':_0xa9f5('0x5e'),'dialActive':!![],'dialMethod':_0xa9f5('0x7c')},'attributes':['id'],'raw':!![]})['then'](function(_0x5effe9){if(_0x5effe9&&_0x5effe9[_0xa9f5('0x3e')]){return db[_0xa9f5('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9f5('0x63')](_0xa9f5('0x64'))},'VoiceQueueId':{'$in':_[_0xa9f5('0x14')](_0x5effe9,'id')},'$or':[{'UserId':null},{'UserId':_0x4e874b[_0xa9f5('0x4f')]['id']}]}});}return 0x0;})[_0xa9f5('0x39')](function(_0x413ad5){if(!_[_0xa9f5('0x59')](_0x413ad5)&&_[_0xa9f5('0x7d')](_0x413ad5)){return _0x2ba0c2[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')]({'contacts':_0x413ad5});}else{logger[_0xa9f5('0xf')](_0xa9f5('0x7e'),_0xa9f5('0x7b'),0x194,_0xa9f5('0x7f'));_0x2ba0c2[_0xa9f5('0x80')](0x194);}})['catch'](handleError(_0x2ba0c2,null));};exports[_0xa9f5('0x81')]=function(_0x32e2d5,_0x5662ce){var _0x2b44c0=shared[_0xa9f5('0x82')];var _0x314942=[];_[_0xa9f5('0x14')](_0x2b44c0,function(_0x2e5e6c){_0x314942['push']({'id':_0x2e5e6c['name'],'name':_0x2e5e6c[_0xa9f5('0x11')],'utcOffset':_0x2e5e6c['utcOffset']});});return _0x5662ce[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')]({'tz':_0x314942});};exports['getTimezone']=function(_0xabacab,_0x4ebc6e){var _0x3afef3=shared[_0xa9f5('0x82')];var _0x37be26={};if(!_[_0xa9f5('0x59')](_0x3afef3[_0xabacab['body']['id']]))_0x37be26=_0x3afef3[_0xabacab[_0xa9f5('0x43')]['id']];return _0x4ebc6e[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')](_0x37be26);}; \ No newline at end of file +var _0x08d9=['Campaign','dataValues','createdAt','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','CmCompany','CmList','dialActive','getOpenContacts','getVoiceQueues','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','update','then','error','name','send','index','map','CmHopper','fieldName','type','model','query','keys','filters','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','rawAttributes','include','create','catch','body','find','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue'];(function(_0x47084d,_0x1c491f){var _0x5065c7=function(_0x11a89e){while(--_0x11a89e){_0x47084d['push'](_0x47084d['shift']());}};_0x5065c7(++_0x1c491f);}(_0x08d9,0xc2));var _0x908d=function(_0x1aee79,_0x2cd632){_0x1aee79=_0x1aee79-0x0;var _0x360cd5=_0x08d9[_0x1aee79];return _0x360cd5;};'use strict';var moment=require(_0x908d('0x0'));var _=require('lodash');var qs=require(_0x908d('0x1'));var logger=require('../../config/logger')(_0x908d('0x2'));var shared=require(_0x908d('0x3'));var db=require(_0x908d('0x4'))['db'];function respondWithResult(_0x5228dd,_0x53cef4){_0x53cef4=_0x53cef4||0xc8;return function(_0x15dfb3){if(_0x15dfb3){return _0x5228dd[_0x908d('0x5')](_0x53cef4)[_0x908d('0x6')](_0x15dfb3);}};}function respondWithFilteredResult(_0xe780e0,_0xb63409){return function(_0x5d67d6){if(_0x5d67d6){var _0x52cd93=typeof _0xb63409[_0x908d('0x7')]===_0x908d('0x8')&&typeof _0xb63409[_0x908d('0x9')]===_0x908d('0x8');var _0x44b888=_0x5d67d6[_0x908d('0xa')];var _0x24113f=_0x52cd93?0x0:_0xb63409[_0x908d('0x7')];var _0x2ac2b7=_0x52cd93?_0x5d67d6['count']:_0xb63409[_0x908d('0x7')]+_0xb63409[_0x908d('0x9')];var _0xbba8e2;if(_0x2ac2b7>=_0x44b888){_0x2ac2b7=_0x44b888;_0xbba8e2=0xc8;}else{_0xbba8e2=0xce;}_0xe780e0[_0x908d('0x5')](_0xbba8e2);return _0xe780e0[_0x908d('0xb')]('Content-Range',_0x24113f+'-'+_0x2ac2b7+'/'+_0x44b888)['json'](_0x5d67d6);}return null;};}function saveUpdates(_0x588cc3,_0x3213df){return function(_0x2c92df){if(_0x2c92df){return _0x2c92df[_0x908d('0xc')](_0x588cc3)[_0x908d('0xd')](function(_0x2e1a77){return _0x2e1a77;});}return null;};}function handleEntityNotFound(_0x3c1149,_0x9dbb7f){return function(_0x4dcd6f){if(!_0x4dcd6f){_0x3c1149['sendStatus'](0x194);}return _0x4dcd6f;};}function handleError(_0x3e1c4f,_0x207ac1){_0x207ac1=_0x207ac1||0x1f4;return function(_0x178809){logger[_0x908d('0xe')](_0x178809['stack']);if(_0x178809['name']){delete _0x178809[_0x908d('0xf')];}_0x3e1c4f[_0x908d('0x5')](_0x207ac1)[_0x908d('0x10')](_0x178809);};}exports[_0x908d('0x11')]=function(_0x4cc9ba,_0x9438c7){var _0x3b83aa={},_0x3dea46={},_0x4101c1={'count':0x0,'rows':[]};var _0x209ffd=_[_0x908d('0x12')](db[_0x908d('0x13')]['rawAttributes'],function(_0x34a524){return{'name':_0x34a524[_0x908d('0x14')],'type':_0x34a524[_0x908d('0x15')]['key']};});_0x3dea46[_0x908d('0x16')]=_[_0x908d('0x12')](_0x209ffd,_0x908d('0xf'));_0x3dea46[_0x908d('0x17')]=_[_0x908d('0x18')](_0x4cc9ba['query']);_0x3dea46[_0x908d('0x19')]=_['intersection'](_0x3dea46[_0x908d('0x16')],_0x3dea46[_0x908d('0x17')]);_0x3dea46[_0x908d('0x19')]=_[_0x908d('0x1a')](_0x3dea46[_0x908d('0x19')],[_0x908d('0x1b'),_0x908d('0x1c'),_0x908d('0x1d'),'$gte',_0x908d('0x1e'),_0x908d('0x1f'),_0x908d('0x20'),_0x908d('0x21'),_0x908d('0x22'),'$between','$notBetween',_0x908d('0x23'),_0x908d('0x24'),_0x908d('0x25'),_0x908d('0x26'),_0x908d('0x27'),'$notILike',_0x908d('0x25'),_0x908d('0x28'),'$contains',_0x908d('0x29'),_0x908d('0x2a')]);_0x3b83aa[_0x908d('0x2b')]=_[_0x908d('0x2c')](_0x3dea46[_0x908d('0x16')],qs[_0x908d('0x2d')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x2d')]));_0x3b83aa[_0x908d('0x2b')]=_0x3b83aa[_0x908d('0x2b')][_0x908d('0x2e')]?_0x3b83aa['attributes']:_0x3dea46[_0x908d('0x16')];if(!_0x4cc9ba[_0x908d('0x17')][_0x908d('0x2f')](_0x908d('0x30'))){_0x3b83aa['limit']=qs[_0x908d('0x9')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x9')]);_0x3b83aa[_0x908d('0x7')]=qs[_0x908d('0x7')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x7')]);}_0x3b83aa[_0x908d('0x31')]=qs[_0x908d('0x32')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x32')]);_0x3b83aa['where']=qs['filters'](_[_0x908d('0x33')](_0x4cc9ba[_0x908d('0x17')],_0x3dea46['filters']),_0x209ffd);if(_0x4cc9ba['query'][_0x908d('0x34')]){_0x3b83aa[_0x908d('0x35')]=_[_0x908d('0x36')](_0x3b83aa[_0x908d('0x35')],{'$or':_[_0x908d('0x12')](_0x209ffd,function(_0x5ad500){if(_0x5ad500[_0x908d('0x15')]!==_0x908d('0x37')){var _0x2a766f={};_0x2a766f[_0x5ad500[_0x908d('0xf')]]={'$like':'%'+_0x4cc9ba[_0x908d('0x17')]['filter']+'%'};return _0x2a766f;}})});}_0x3b83aa=_['merge']({},_0x3b83aa,_0x4cc9ba[_0x908d('0x38')]);var _0x522ef1={'where':_0x3b83aa[_0x908d('0x35')]};return db[_0x908d('0x13')][_0x908d('0xa')](_0x522ef1)[_0x908d('0xd')](function(_0x3ef848){_0x4101c1[_0x908d('0xa')]=_0x3ef848;if(_0x4cc9ba[_0x908d('0x17')][_0x908d('0x39')]){_0x3b83aa['include']=[{'all':!![]}];}return db['CmHopper'][_0x908d('0x3a')](_0x3b83aa);})[_0x908d('0xd')](function(_0x297366){_0x4101c1['rows']=_0x297366;return _0x4101c1;})['then'](respondWithFilteredResult(_0x9438c7,_0x3b83aa))['catch'](handleError(_0x9438c7,null));};exports[_0x908d('0x3b')]=function(_0x54982f,_0x2b0108){var _0x10667b={'raw':!![],'where':{'id':_0x54982f['params']['id']}},_0x1dd840={};_0x1dd840['model']=_['keys'](db[_0x908d('0x13')][_0x908d('0x3c')]);_0x1dd840['query']=_[_0x908d('0x18')](_0x54982f['query']);_0x1dd840[_0x908d('0x19')]=_[_0x908d('0x2c')](_0x1dd840[_0x908d('0x16')],_0x1dd840['query']);_0x10667b[_0x908d('0x2b')]=_[_0x908d('0x2c')](_0x1dd840[_0x908d('0x16')],qs[_0x908d('0x2d')](_0x54982f['query'][_0x908d('0x2d')]));_0x10667b[_0x908d('0x2b')]=_0x10667b[_0x908d('0x2b')][_0x908d('0x2e')]?_0x10667b[_0x908d('0x2b')]:_0x1dd840['model'];if(_0x54982f[_0x908d('0x17')][_0x908d('0x39')]){_0x10667b[_0x908d('0x3d')]=[{'all':!![]}];}_0x10667b=_[_0x908d('0x36')]({},_0x10667b,_0x54982f[_0x908d('0x38')]);return db[_0x908d('0x13')]['find'](_0x10667b)['then'](handleEntityNotFound(_0x2b0108,null))[_0x908d('0xd')](respondWithResult(_0x2b0108,null))['catch'](handleError(_0x2b0108,null));};exports[_0x908d('0x3e')]=function(_0x1ab59a,_0x5b28ad){return db[_0x908d('0x13')][_0x908d('0x3e')](_0x1ab59a['body'],{})[_0x908d('0xd')](respondWithResult(_0x5b28ad,0xc9))[_0x908d('0x3f')](handleError(_0x5b28ad,null));};exports[_0x908d('0xc')]=function(_0x447f75,_0x53fdf4){if(_0x447f75[_0x908d('0x40')]['id']){delete _0x447f75['body']['id'];}return db[_0x908d('0x13')][_0x908d('0x41')]({'where':{'id':_0x447f75['params']['id']}})[_0x908d('0xd')](handleEntityNotFound(_0x53fdf4,null))['then'](saveUpdates(_0x447f75['body'],null))[_0x908d('0xd')](respondWithResult(_0x53fdf4,null))[_0x908d('0x3f')](handleError(_0x53fdf4,null));};exports[_0x908d('0x42')]=function(_0x3cffc4,_0x4e498c){return db['CmHopper']['describe']()[_0x908d('0xd')](respondWithResult(_0x4e498c,null))[_0x908d('0x3f')](handleError(_0x4e498c,null));};exports[_0x908d('0x43')]=function(_0x19d277,_0x44d091){var _0x1fd1bf;var _0x3f5d4f=_0x19d277[_0x908d('0x44')]['id'];return db['CmHopper'][_0x908d('0x41')]({'where':{'id':_0x19d277['params']['id']}})[_0x908d('0xd')](handleEntityNotFound(_0x44d091,null))[_0x908d('0xd')](function(_0x192554){if(_0x192554){return _0x192554[_0x908d('0x43')]()['then'](function(_0x51df00){return _0x51df00;});}})[_0x908d('0xd')](function(_0x297681){_0x1fd1bf=_0x297681;if(_0x297681){if(_0x297681[_0x908d('0x45')]||_0x297681[_0x908d('0x46')]){return db[_0x297681[_0x908d('0x45')]?_0x908d('0x47'):_0x908d('0x48')][_0x908d('0x41')]({'where':{'id':_0x297681[_0x908d('0x45')]?_0x297681[_0x908d('0x45')]:_0x297681['CampaignId']},'attributes':['id',_0x908d('0xf')],'raw':!![]});}}})[_0x908d('0xd')](function(_0x4d8abe){var _0x5d98f8={};if(_0x4d8abe){_[_0x908d('0x36')](_0x5d98f8,_['omit'](_0x1fd1bf[_0x908d('0x49')],[_0x908d('0x4a'),'updatedAt','id']));_0x5d98f8['state']=0x15;_0x5d98f8[_0x908d('0x4b')]=_0x908d('0x4c');_0x5d98f8['campaign']=_0x4d8abe[_0x908d('0xf')];_0x5d98f8[_0x908d('0x4d')]=_0x19d277[_0x908d('0x4e')][_0x908d('0xf')];_0x5d98f8[_0x908d('0x4f')]=_0x19d277[_0x908d('0x4e')]['id'];_0x5d98f8[_0x908d('0x4c')]=!![];_0x5d98f8[_0x908d('0x50')]=moment()[_0x908d('0x51')](_0x908d('0x52'));_0x5d98f8[_0x908d('0x53')]=_0x1fd1bf[_0x908d('0x54')];_0x5d98f8['campaigntype']=_0x1fd1bf['VoiceQueueId']?_0x908d('0x55'):'ivr';return db[_0x908d('0x56')][_0x908d('0x41')]({'where':{'id':_0x5d98f8[_0x908d('0x57')]},'attributes':[_0x908d('0x58'),_0x908d('0x59')]})[_0x908d('0xd')](function(_0x1eba12){if(!_[_0x908d('0x5a')](_0x44d091)&&!_[_0x908d('0x5a')](_0x1eba12[_0x908d('0x58')])){_0x5d98f8['calleridname']=_0x1eba12[_0x908d('0x58')];if(!_[_0x908d('0x5a')](_0x1eba12[_0x908d('0x59')])){_0x5d98f8[_0x908d('0x5b')]+='\x20'+_0x1eba12[_0x908d('0x59')];}}})[_0x908d('0x5c')](function(){return db['CmHopperFinal'][_0x908d('0x3e')](_0x5d98f8);});}})['then'](function(_0x3875c6){return db[_0x908d('0x5d')][_0x908d('0x43')]({'where':{'CmHopperId':_0x3f5d4f}});})[_0x908d('0xd')](function(){return _0x44d091[_0x908d('0x5')](0xcc)[_0x908d('0x5e')]();})['catch'](handleError(_0x44d091,null));};exports[_0x908d('0x5f')]=function(_0x2489d2,_0x3bf30c){var _0x24c79d=[];return db[_0x908d('0x56')][_0x908d('0x42')]()['then'](function(_0x29fd0a){_0x24c79d=_[_0x908d('0x18')](_0x29fd0a);return _0x2489d2[_0x908d('0x4e')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x908d('0x60')],'raw':!![]});})[_0x908d('0xd')](function(_0xfd6c9){if(_0xfd6c9&&_0xfd6c9[_0x908d('0x2e')]){return db[_0x908d('0x61')][_0x908d('0x62')](function(_0x11bf76){var _0xa9b13a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x908d('0x51')](_0x908d('0x52'))},'VoiceQueueId':{'$in':_['map'](_0xfd6c9,'id')},'$or':[{'UserId':null},{'UserId':_0x2489d2[_0x908d('0x4e')]['id']}]};var _0x330fa2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xfd6c9)[_0x908d('0x34')]([_0x908d('0x60'),0x0])[_0x908d('0x12')]('id')[_0x908d('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x2489d2[_0x908d('0x4e')]['id']}]};var _0x144d04={'$or':[_0xa9b13a,_0x330fa2]};var _0x4bde16=[];if(_0x2489d2[_0x908d('0x40')][_0x908d('0x64')]&&_0x2489d2[_0x908d('0x40')][_0x908d('0x64')]===_0x908d('0x65')){if(!_[_0x908d('0x66')](_0x2489d2[_0x908d('0x40')][_0x908d('0x67')])){_0x144d04['id']={'$in':_0x2489d2[_0x908d('0x40')]['hopperIds']};}_0x4bde16=[[_0x908d('0x68'),_0x908d('0x69')],[_0x908d('0x6a'),_0xfd6c9[0x0]['dialOrderByScheduledAt']===_0x908d('0x69')?_0x908d('0x6b'):'ASC'],db[_0x908d('0x61')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x908d('0x6b')]];}else{if(!_[_0x908d('0x66')](_0x2489d2['body'][_0x908d('0x67')])){_0x144d04['id']={'$notIn':_0x2489d2[_0x908d('0x40')][_0x908d('0x67')]};}_0x4bde16=[[_0x908d('0x68'),_0x908d('0x6b')],[_0x908d('0x6a'),_0xfd6c9[0x0][_0x908d('0x6c')]],db[_0x908d('0x61')][_0x908d('0x6d')](_0x908d('0x6e')),['id',_0x908d('0x69')]];}return db[_0x908d('0x13')][_0x908d('0x6f')]({'attributes':['id',_0x908d('0x70'),_0x908d('0x54'),_0x908d('0x71')],'where':_0x144d04,'order':_0x4bde16,'transaction':_0x11bf76,'lock':_0x11bf76['LOCK'][_0x908d('0x72')],'include':[{'model':db['CmContact'],'as':_0x908d('0x73'),'attributes':_0x24c79d,'include':[{'model':db['CmCompany'],'as':_0x908d('0x74'),'attributes':['id',_0x908d('0xf')]}]},{'model':db['CmList'],'as':_0x908d('0x75'),'attributes':['id','name']},{'model':db[_0x908d('0x47')],'as':_0x908d('0x76'),'attributes':['id',_0x908d('0xf'),'dialActive']}]})['then'](function(_0x3d4d9d){if(_0x3d4d9d){return _0x3d4d9d[_0x908d('0xc')]({'UserId':_0x2489d2[_0x908d('0x4e')]['id']},{'transaction':_0x11bf76});}});});}})[_0x908d('0xd')](handleEntityNotFound(_0x3bf30c,null))[_0x908d('0xd')](respondWithResult(_0x3bf30c,null))[_0x908d('0x3f')](handleError(_0x3bf30c,null));};exports[_0x908d('0x77')]=function(_0x5edbd9,_0x1a4afa,_0x3aa2a6){var _0x31d4e9=[];var _0x35c028=_0x5edbd9[_0x908d('0x44')]['id'];var _0xae854c=_0x5edbd9['user']['id'];return db[_0x908d('0x56')][_0x908d('0x42')]()[_0x908d('0xd')](function(_0x51c6d4){_0x31d4e9=_[_0x908d('0x18')](_0x51c6d4);return db[_0x908d('0x61')][_0x908d('0x62')](function(_0x32fc44){const _0x5065e4={'id':_0x35c028};return db['CmHopper'][_0x908d('0x6f')]({'attributes':['id','scheduledat',_0x908d('0x71')],'where':_0x5065e4,'transaction':_0x32fc44,'lock':_0x32fc44['LOCK'][_0x908d('0x72')],'include':[{'model':db[_0x908d('0x56')],'as':_0x908d('0x73'),'attributes':_0x31d4e9,'include':[{'model':db[_0x908d('0x78')],'as':_0x908d('0x74'),'attributes':['id',_0x908d('0xf')]}]},{'model':db[_0x908d('0x79')],'as':_0x908d('0x75'),'attributes':['id',_0x908d('0xf')]},{'model':db['VoiceQueue'],'as':_0x908d('0x76'),'attributes':['id',_0x908d('0xf'),_0x908d('0x7a')]}]})[_0x908d('0xd')](function(_0xb24af7){if(_0xb24af7){return _0xb24af7[_0x908d('0xc')]({'UserId':_0xae854c},{'transaction':_0x32fc44});}});});})['then'](handleEntityNotFound(_0x1a4afa,null))['then'](respondWithResult(_0x1a4afa,null))['catch'](handleError(_0x1a4afa,null));};exports[_0x908d('0x7b')]=function(_0x5e6a28,_0x1238d9){return _0x5e6a28['user'][_0x908d('0x7c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x908d('0x7d')},'attributes':['id'],'raw':!![]})[_0x908d('0xd')](function(_0x31401f){if(_0x31401f&&_0x31401f[_0x908d('0x2e')]){return db[_0x908d('0x13')][_0x908d('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x908d('0x51')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x908d('0x12')](_0x31401f,'id')},'$or':[{'UserId':null},{'UserId':_0x5e6a28['user']['id']}]}});}return 0x0;})[_0x908d('0xd')](function(_0xaa6114){if(!_[_0x908d('0x5a')](_0xaa6114)&&_[_0x908d('0x7e')](_0xaa6114)){return _0x1238d9[_0x908d('0x5')](0xc8)['json']({'contacts':_0xaa6114});}else{logger['error'](_0x908d('0x7f'),_0x908d('0x7b'),0x194,_0x908d('0x80'));_0x1238d9[_0x908d('0x81')](0x194);}})['catch'](handleError(_0x1238d9,null));};exports[_0x908d('0x82')]=function(_0x121c99,_0xc2f39b){var _0xde7683=shared['timezones'];var _0x7f57c6=[];_[_0x908d('0x12')](_0xde7683,function(_0x430d93){_0x7f57c6[_0x908d('0x83')]({'id':_0x430d93[_0x908d('0xf')],'name':_0x430d93[_0x908d('0xf')],'utcOffset':_0x430d93[_0x908d('0x84')]});});return _0xc2f39b[_0x908d('0x5')](0xc8)[_0x908d('0x6')]({'tz':_0x7f57c6});};exports['getTimezone']=function(_0x3d0d5a,_0xc9be1c){var _0x3fbad0=shared['timezones'];var _0xd20668={};if(!_['isNil'](_0x3fbad0[_0x3d0d5a[_0x908d('0x40')]['id']]))_0xd20668=_0x3fbad0[_0x3d0d5a[_0x908d('0x40')]['id']];return _0xc9be1c[_0x908d('0x5')](0xc8)[_0x908d('0x6')](_0xd20668);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d1441ff..5981493 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 _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x119a07,_0x2289f6){var _0x36025c=function(_0xf28f4){while(--_0xf28f4){_0x119a07['push'](_0x119a07['shift']());}};_0x36025c(++_0x2289f6);}(_0xba34,0x119));var _0x4ba3=function(_0x495114,_0x1ec1a4){_0x495114=_0x495114-0x0;var _0x246a6b=_0xba34[_0x495114];return _0x246a6b;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x3bafe6,_0x3432b7){var _0x30bc43=function(_0x1e8389){while(--_0x1e8389){_0x3bafe6['push'](_0x3bafe6['shift']());}};_0x30bc43(++_0x3432b7);}(_0x2a07,0x74));var _0x72a0=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x2a07[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b4ba614..a5057d6 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 _0x6f75=['push','includes','all','dataValues','active','MoveContactManagedDialer','transaction','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','\x20MINUTE','NOW()','name','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','options','attributes','limit','include','map','model','then','info','GetCmHopper','debug','stringify','catch','message','ShowCmHopper','CmHopper','find','raw','error','CreateCmHopper','UpdateCmHopper','update','body','where','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','findAll','order','Contact','User','Agent','voicePause','length','UserId'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6f75,0x71));var _0x56f7=function(_0x1e2dd4,_0x2e27a1){_0x1e2dd4=_0x1e2dd4-0x0;var _0x583cce=_0x6f75[_0x1e2dd4];return _0x583cce;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var db=require(_0x56f7('0x4'))['db'];var logger=require(_0x56f7('0x5'))(_0x56f7('0x6'));exports['GetCmHopper']=function(_0x3443a5){var _0x150c16=this;return new Promise(function(_0x433c6c,_0x4cfe87){return db['CmHopper']['findAll']({'raw':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x3443a5[_0x56f7('0x7')]?_0x3443a5['options']['where']||null:null,'attributes':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')][_0x56f7('0x8')]||null:null,'limit':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')][_0x56f7('0x9')]||null:null,'include':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')][_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x3443a5[_0x56f7('0x7')][_0x56f7('0xa')],function(_0x1fb37d){return{'model':db[_0x1fb37d[_0x56f7('0xc')]],'as':_0x1fb37d['as'],'attributes':_0x1fb37d['attributes'],'include':_0x1fb37d[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x1fb37d[_0x56f7('0xa')],function(_0x19a47f){return{'model':db[_0x19a47f[_0x56f7('0xc')]],'as':_0x19a47f['as'],'attributes':_0x19a47f[_0x56f7('0x8')],'include':_0x19a47f[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x19a47f[_0x56f7('0xa')],function(_0x519336){return{'model':db[_0x519336['model']],'as':_0x519336['as'],'attributes':_0x519336[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x436a07){logger[_0x56f7('0xe')](_0x56f7('0xf'),_0x3443a5);logger[_0x56f7('0x10')]('GetCmHopper',_0x3443a5,JSON[_0x56f7('0x11')](_0x436a07));_0x433c6c(_0x436a07);})[_0x56f7('0x12')](function(_0x4f0e3a){logger['error'](_0x56f7('0xf'),_0x4f0e3a[_0x56f7('0x13')],_0x3443a5);_0x4cfe87(_0x150c16['error'](0x1f4,_0x4f0e3a[_0x56f7('0x13')]));});});};exports[_0x56f7('0x14')]=function(_0x1d4e8b){var _0x5abaeb=this;return new Promise(function(_0x5a944d,_0x5cf936){return db[_0x56f7('0x15')][_0x56f7('0x16')]({'raw':_0x1d4e8b[_0x56f7('0x7')]?_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![],'where':_0x1d4e8b[_0x56f7('0x7')]?_0x1d4e8b['options']['where']||null:null,'attributes':_0x1d4e8b[_0x56f7('0x7')]?_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0x8')]||null:null,'include':_0x1d4e8b['options']?_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0xa')],function(_0x443db4){return{'model':db[_0x443db4[_0x56f7('0xc')]],'as':_0x443db4['as'],'attributes':_0x443db4[_0x56f7('0x8')],'include':_0x443db4[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x443db4[_0x56f7('0xa')],function(_0x4d6db4){return{'model':db[_0x4d6db4[_0x56f7('0xc')]],'as':_0x4d6db4['as'],'attributes':_0x4d6db4[_0x56f7('0x8')],'include':_0x4d6db4['include']?_[_0x56f7('0xb')](_0x4d6db4[_0x56f7('0xa')],function(_0x209648){return{'model':db[_0x209648[_0x56f7('0xc')]],'as':_0x209648['as'],'attributes':_0x209648[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x72fbcb){logger[_0x56f7('0xe')]('ShowCmHopper',_0x1d4e8b);logger[_0x56f7('0x10')](_0x56f7('0x14'),_0x1d4e8b,JSON['stringify'](_0x72fbcb));_0x5a944d(_0x72fbcb);})['catch'](function(_0x47699e){logger[_0x56f7('0x18')]('ShowCmHopper',_0x47699e[_0x56f7('0x13')],_0x1d4e8b);_0x5cf936(_0x5abaeb[_0x56f7('0x18')](0x1f4,_0x47699e[_0x56f7('0x13')]));});});};exports[_0x56f7('0x19')]=function(_0x59c65d){var _0x4a2be0=this;return new Promise(function(_0x5acd7b,_0x2dbe0a){return db['CmHopper']['create'](_0x59c65d['body'],{'raw':_0x59c65d[_0x56f7('0x7')]?_0x59c65d[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![]})[_0x56f7('0xd')](function(_0x5e051c){logger[_0x56f7('0xe')](_0x56f7('0x19'),_0x59c65d);logger[_0x56f7('0x10')](_0x56f7('0x19'),_0x59c65d,JSON[_0x56f7('0x11')](_0x5e051c));_0x5acd7b(_0x5e051c);})['catch'](function(_0x3a1afc){logger['error'](_0x56f7('0x19'),_0x3a1afc['message'],_0x59c65d);_0x2dbe0a(_0x4a2be0['error'](0x1f4,_0x3a1afc[_0x56f7('0x13')]));});});};exports[_0x56f7('0x1a')]=function(_0x275176){var _0x1a254e=this;return new Promise(function(_0x903324,_0x2afcc8){return db['CmHopper'][_0x56f7('0x1b')](_0x275176[_0x56f7('0x1c')],{'raw':_0x275176['options']?_0x275176['options'][_0x56f7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x275176[_0x56f7('0x7')]?_0x275176[_0x56f7('0x7')]['where']||null:null,'attributes':_0x275176[_0x56f7('0x7')]?_0x275176[_0x56f7('0x7')][_0x56f7('0x8')]||null:null,'limit':_0x275176[_0x56f7('0x7')]?_0x275176['options'][_0x56f7('0x9')]||null:null})[_0x56f7('0xd')](function(_0x53435e){logger[_0x56f7('0xe')](_0x56f7('0x1a'),_0x275176);logger[_0x56f7('0xe')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x56f7('0x11')](_0x275176[_0x56f7('0x7')][_0x56f7('0x1d')]),_0x275176[_0x56f7('0x1c')]['active']);logger[_0x56f7('0x10')](_0x56f7('0x1a'),_0x275176,JSON[_0x56f7('0x11')](_0x53435e));_0x903324(_0x53435e);})['catch'](function(_0x549c10){logger['error'](_0x56f7('0x1a'),_0x549c10[_0x56f7('0x13')],_0x275176);_0x2afcc8(_0x1a254e['error'](0x1f4,_0x549c10['message']));});});};exports[_0x56f7('0x1e')]=function(_0x1748df){var _0x6d8054=this;return new Promise(function(_0x57e9a7,_0x4bed45){return db[_0x56f7('0x15')]['destroy']({'where':_0x1748df[_0x56f7('0x7')]?_0x1748df[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null})['then'](function(_0xbb2154){logger[_0x56f7('0xe')](_0x56f7('0x1e'),_0x1748df);logger[_0x56f7('0x10')](_0x56f7('0x1e'),_0x1748df,JSON[_0x56f7('0x11')](_0xbb2154));_0x57e9a7(_0xbb2154);})['catch'](function(_0x3d2c61){logger[_0x56f7('0x18')](_0x56f7('0x1e'),_0x3d2c61['message'],_0x1748df);_0x4bed45(_0x6d8054[_0x56f7('0x18')](0x1f4,_0x3d2c61['message']));});});};exports[_0x56f7('0x1f')]=function(_0x129892){var _0x543939=this;return new Promise(function(_0x1bc07e,_0x303c32){return db[_0x56f7('0x20')][_0x56f7('0x21')]()[_0x56f7('0xd')](function(_0x5a9398){return db[_0x56f7('0x22')]['transaction'](function(_0x2a06c2){return db['CmHopper'][_0x56f7('0x23')]({'where':_0x129892['options']?_0x129892[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':_0x129892[_0x56f7('0x7')]?_0x129892['options']['attributes']||null:null,'limit':_0x129892[_0x56f7('0x7')]?_0x129892[_0x56f7('0x7')]['limit']||null:null,'order':_0x129892[_0x56f7('0x7')]?_0x129892['options'][_0x56f7('0x24')]||null:null,'transaction':_0x2a06c2,'lock':_0x2a06c2['LOCK']['UPDATE'],'include':[{'model':db[_0x56f7('0x20')],'as':_0x56f7('0x25'),'attributes':_['keys'](_0x5a9398)},{'model':db[_0x56f7('0x26')],'as':_0x56f7('0x27'),'attributes':['id','name',_0x56f7('0x28')]}]})['then'](function(_0x214a49){var _0x135466=[];var _0x2a944f=[];for(var _0xb156e8=0x0;_0xb156e8<_0x214a49[_0x56f7('0x29')];_0xb156e8+=0x1){var _0x5059dd=_0x214a49[_0xb156e8][_0x56f7('0x2a')];if(_0x5059dd===null){_0x135466[_0x56f7('0x2b')](_0x214a49[_0xb156e8][_0x56f7('0x1b')](_0x129892['body'],{'transaction':_0x2a06c2}));}else if(!_0x2a944f[_0x56f7('0x2c')](_0x5059dd)){_0x2a944f[_0x56f7('0x2b')](_0x5059dd);_0x135466['push'](_0x214a49[_0xb156e8][_0x56f7('0x1b')](_0x129892[_0x56f7('0x1c')],{'transaction':_0x2a06c2}));}}return BPromise[_0x56f7('0x2d')](_0x135466);});})['then'](function(_0x758e00){logger[_0x56f7('0xe')](_0x56f7('0x1f'),_0x129892);if(_0x758e00[_0x56f7('0x29')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x758e00[0x0][_0x56f7('0x2e')]['id'],_0x758e00[0x0]['dataValues']['ContactId'],_0x758e00[0x0][_0x56f7('0x2e')][_0x56f7('0x2f')]);}logger['debug']('GetContactDialer',_0x129892,JSON[_0x56f7('0x11')](_0x758e00));_0x1bc07e(_0x758e00);})[_0x56f7('0x12')](function(_0x8a8e04){logger[_0x56f7('0x18')](_0x56f7('0x1f'),_0x8a8e04[_0x56f7('0x13')],_0x129892);_0x303c32(_0x543939['error'](0x1f4,_0x8a8e04['message']));});});});};exports[_0x56f7('0x30')]=function(_0x394ab8){var _0x154ae6=this;return new Promise(function(_0x774c3a,_0x352740){return db[_0x56f7('0x22')][_0x56f7('0x31')](function(_0x582fef){return db[_0x56f7('0x32')][_0x56f7('0x33')](_0x394ab8[_0x56f7('0x1c')],{'raw':_0x394ab8[_0x56f7('0x7')]?_0x394ab8[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![],'transaction':_0x582fef})['then'](function(){logger['info'](_0x56f7('0x34'),JSON[_0x56f7('0x11')](_0x394ab8['options'][_0x56f7('0x1d')]),_0x394ab8[_0x56f7('0x7')]['where'][_0x56f7('0x2f')]);return db[_0x56f7('0x15')][_0x56f7('0x35')]({'where':_0x394ab8[_0x56f7('0x7')]?_0x394ab8[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'transaction':_0x582fef});});})[_0x56f7('0xd')](function(_0x225d18){logger['info'](_0x56f7('0x30'),_0x394ab8);logger[_0x56f7('0x10')](_0x56f7('0x30'),_0x394ab8,JSON['stringify'](_0x225d18));_0x774c3a(_0x225d18);})[_0x56f7('0x12')](function(_0x540581){logger[_0x56f7('0x18')](_0x56f7('0x30'),_0x540581[_0x56f7('0x13')],_0x394ab8);_0x352740(_0x154ae6[_0x56f7('0x18')](0x1f4,_0x540581[_0x56f7('0x13')]));});});};exports[_0x56f7('0x36')]=function(_0x47a657){var _0x3c7139=this;return new Promise(function(_0xdb8bce,_0x37da8b){return db['CmHopper'][_0x56f7('0x23')]({'raw':_0x47a657[_0x56f7('0x7')]?_0x47a657[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![],'where':_0x47a657['options']?_0x47a657[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':[[db[_0x56f7('0x22')]['fn'](_0x56f7('0x37'),db[_0x56f7('0x22')]['fn']('IF',db[_0x56f7('0x22')][_0x56f7('0x38')]('`scheduledat`\x20>=\x20'+util[_0x56f7('0x39')](_0x56f7('0x3a'),moment()[_0x56f7('0x39')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x56f7('0x3b')))),_0x56f7('0x3c')]]})[_0x56f7('0xd')](function(_0x336656){logger[_0x56f7('0xe')](_0x56f7('0x36'),_0x47a657);logger[_0x56f7('0x10')](_0x56f7('0x36'),_0x47a657,JSON[_0x56f7('0x11')](_0x336656));_0xdb8bce(_0x336656);})[_0x56f7('0x12')](function(_0x5ce35a){logger[_0x56f7('0x18')](_0x56f7('0x36'),_0x5ce35a[_0x56f7('0x13')],_0x47a657);_0x37da8b(_0x3c7139[_0x56f7('0x18')](0x1f4,_0x5ce35a['message']));});});};exports[_0x56f7('0x3d')]=function(_0x11f21f){var _0x3e1ab1=this;return new Promise(function(_0xd88e00,_0x422a8d){return db['CmContact'][_0x56f7('0x21')]()[_0x56f7('0xd')](function(){return db['sequelize'][_0x56f7('0x31')](function(_0x3d6e23){return db[_0x56f7('0x15')][_0x56f7('0x23')]({'where':_0x11f21f['options']?_0x11f21f[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':_0x11f21f[_0x56f7('0x7')]?_0x11f21f['options']['attributes']||null:null,'limit':0x1,'order':_0x11f21f[_0x56f7('0x7')]?_0x11f21f[_0x56f7('0x7')]['order']||null:null,'group':db[_0x56f7('0x15')][_0x56f7('0x2a')],'transaction':_0x3d6e23,'lock':_0x3d6e23[_0x56f7('0x3e')][_0x56f7('0x3f')],'include':_0x11f21f[_0x56f7('0x7')]?_0x11f21f[_0x56f7('0x7')][_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x11f21f['options'][_0x56f7('0xa')],function(_0x19b437){return{'model':db[_0x19b437['model']],'as':_0x19b437['as'],'attributes':_0x19b437['attributes'],'include':_0x19b437[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x19b437[_0x56f7('0xa')],function(_0x47ecda){return{'model':db[_0x47ecda['model']],'as':_0x47ecda['as'],'attributes':_0x47ecda[_0x56f7('0x8')],'include':_0x47ecda[_0x56f7('0xa')]?_['map'](_0x47ecda['include'],function(_0x5f0a0c){return{'model':db[_0x5f0a0c[_0x56f7('0xc')]],'as':_0x5f0a0c['as'],'attributes':_0x5f0a0c[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x2d925b){var _0x5156c1=[];for(var _0x227b56=0x0;_0x227b56<_0x2d925b[_0x56f7('0x29')];_0x227b56+=0x1){_0x5156c1[_0x56f7('0x2b')](_0x2d925b[_0x227b56]['update'](_0x11f21f[_0x56f7('0x1c')],{'transaction':_0x3d6e23}));}return BPromise[_0x56f7('0x2d')](_0x5156c1);});})[_0x56f7('0xd')](function(_0x462c8a){logger[_0x56f7('0xe')](_0x56f7('0x3d'),_0x11f21f);logger[_0x56f7('0x10')](_0x56f7('0x3d'),_0x11f21f,JSON[_0x56f7('0x11')](_0x462c8a));_0xd88e00(_0x462c8a);})['catch'](function(_0x396cc7){logger[_0x56f7('0x18')]('GetContactRecallMe',_0x396cc7['message'],_0x11f21f);_0x422a8d(_0x3e1ab1[_0x56f7('0x18')](0x1f4,_0x396cc7['message']));});});});};exports[_0x56f7('0x40')]=function(_0x24cbe8){var _0xd0495f=this;return new Promise(function(_0x55442b,_0x14bd22){db[_0x56f7('0x20')][_0x56f7('0x21')]()['then'](function(_0x1c091f){return db[_0x56f7('0x15')]['findAll']({'raw':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8['options']['raw']===undefined?!![]:![]:!![],'where':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8[_0x56f7('0x7')]['attributes']||null:null,'limit':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8[_0x56f7('0x7')][_0x56f7('0x9')]||null:null,'include':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8['options']['include']?_[_0x56f7('0xb')](_0x24cbe8[_0x56f7('0x7')]['include'],function(_0x453063){return{'model':db[_0x453063[_0x56f7('0xc')]],'as':_0x453063['as'],'attributes':_0x453063['as']===_0x56f7('0x25')?_[_0x56f7('0x41')](_0x1c091f):_0x453063[_0x56f7('0x8')],'include':_0x453063[_0x56f7('0xa')]?_['map'](_0x453063[_0x56f7('0xa')],function(_0x57c300){return{'model':db[_0x57c300[_0x56f7('0xc')]],'as':_0x57c300['as'],'attributes':_0x57c300[_0x56f7('0x8')],'include':_0x57c300[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x57c300[_0x56f7('0xa')],function(_0x4aa804){return{'model':db[_0x4aa804[_0x56f7('0xc')]],'as':_0x4aa804['as'],'attributes':_0x4aa804[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x2e1e6b){logger[_0x56f7('0xe')](_0x56f7('0xf'),_0x24cbe8);logger[_0x56f7('0x10')](_0x56f7('0xf'),_0x24cbe8,JSON['stringify'](_0x2e1e6b));_0x55442b(_0x2e1e6b);})[_0x56f7('0x12')](function(_0x538863){logger[_0x56f7('0x18')]('GetCmHopper',_0x538863[_0x56f7('0x13')],_0x24cbe8);_0x14bd22(_0xd0495f[_0x56f7('0x18')](0x1f4,_0x538863[_0x56f7('0x13')]));});});});};exports[_0x56f7('0x42')]=function(_0x13085c){var _0x533786=this;return new Promise(function(_0x4efc5a,_0x46fe8b){return db[_0x56f7('0x20')][_0x56f7('0x43')]({'raw':!![],'where':{'phone':_0x13085c['options'][_0x56f7('0x1d')][_0x56f7('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0x56f7('0x45')]]})[_0x56f7('0xd')](function(_0x10e320){logger[_0x56f7('0xe')]('getContactByPhone',_0x13085c);logger[_0x56f7('0x10')]('getContactByPhone',_0x13085c,JSON[_0x56f7('0x11')](_0x10e320));_0x4efc5a(_0x10e320);})[_0x56f7('0x12')](function(_0x1d060d){logger['error'](_0x56f7('0x46'),_0x1d060d[_0x56f7('0x13')],_0x13085c);_0x46fe8b(_0x533786['error'](0x1f4,_0x1d060d[_0x56f7('0x13')]));});});};exports[_0x56f7('0x47')]=function(_0x2c2a96){var _0x395c37=this;return new Promise(function(_0x2bdaf1,_0x35de00){return db[_0x56f7('0x22')][_0x56f7('0x31')](function(_0xf18236){var _0x4a21d6=_0x2c2a96[_0x56f7('0x7')]&&_0x2c2a96[_0x56f7('0x7')][_0x56f7('0x1d')]?_0x2c2a96[_0x56f7('0x7')][_0x56f7('0x1d')]:{};return db[_0x56f7('0x15')][_0x56f7('0x1b')](_0x2c2a96[_0x56f7('0x1c')],{'where':_0x4a21d6,'transaction':_0xf18236})['then'](function(_0xb1de49){logger['info'](_0x56f7('0x47'),_0x2c2a96);logger[_0x56f7('0x10')](_0x56f7('0x47'),_0x2c2a96,JSON[_0x56f7('0x11')](_0xb1de49));_0x2bdaf1(_0xb1de49);})[_0x56f7('0x12')](function(_0x1e74d2){logger[_0x56f7('0x18')](_0x56f7('0x47'),_0x1e74d2['message'],_0x2c2a96);_0x35de00(_0x395c37[_0x56f7('0x18')](0x1f4,_0x1e74d2[_0x56f7('0x13')]));});});});};exports[_0x56f7('0x48')]=function(_0x358715){var _0x32a588=this;var _0x3a9c89=_0x358715['body'][_0x56f7('0x1d')]['voiceQueueIds'];var _0x10ca03=_0x358715[_0x56f7('0x1c')]['where'][_0x56f7('0x49')];var _0x4e9060=_0x358715[_0x56f7('0x1c')][_0x56f7('0x1d')]['availableAgentsIds'];return new Promise(function(_0x217bc5,_0x27057a){return db[_0x56f7('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3a9c89},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x56f7('0x22')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x10ca03+_0x56f7('0x4a')),'$gt':db[_0x56f7('0x22')][_0x56f7('0x38')](_0x56f7('0x4b'))}},'UserId':{'$in':_0x4e9060}},'include':[{'model':db['CmContact'],'as':_0x56f7('0x25')},{'model':db[_0x56f7('0x26')],'as':_0x56f7('0x27'),'attributes':['id',_0x56f7('0x4c'),_0x56f7('0x28')]},{'model':db['CmList'],'as':_0x56f7('0x4d')}]})['then'](function(_0x37f0df){if(_0x37f0df[_0x56f7('0x29')]>0x0){return db['sequelize'][_0x56f7('0x31')](function(_0x32894c){return db[_0x56f7('0x15')]['update']({'recallmeNotifiedDate':db[_0x56f7('0x22')][_0x56f7('0x38')](_0x56f7('0x4b'))},{'where':{'id':{'$in':_[_0x56f7('0xb')](_0x37f0df,'id')}},'transaction':_0x32894c})[_0x56f7('0xd')](function(){_0x217bc5(_0x37f0df);})[_0x56f7('0x12')](function(_0x2557f6){logger[_0x56f7('0x18')](_0x56f7('0x48'),_0x2557f6[_0x56f7('0x13')],_0x358715);_0x27057a(_0x32a588[_0x56f7('0x18')](0x1f4,_0x2557f6[_0x56f7('0x13')]));});})[_0x56f7('0x12')](function(_0x28d0ae){logger['error'](_0x56f7('0x48'),_0x28d0ae[_0x56f7('0x13')],_0x358715);_0x27057a(_0x32a588[_0x56f7('0x18')](0x1f4,_0x28d0ae[_0x56f7('0x13')]));});}else{_0x217bc5(_0x37f0df);}});});}; \ No newline at end of file +var _0xd7cf=['include','map','model','attributes','then','info','GetCmHopper','stringify','catch','error','message','ShowCmHopper','find','create','body','CreateCmHopper','debug','UpdateCmHopper','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','keys','User','Agent','name','length','update','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','UserId','findAll','Contact','GetContactByPhone','phone','dialTimezone','DESC','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','voicePause','CmList','List','NOW()','moment','bluebird','../../config/logger','rpc','CmHopper','options','raw','where','limit'];(function(_0x152a03,_0x41a4fe){var _0x3ccbd0=function(_0x4fbf24){while(--_0x4fbf24){_0x152a03['push'](_0x152a03['shift']());}};_0x3ccbd0(++_0x41a4fe);}(_0xd7cf,0x12b));var _0xfd7c=function(_0x3feab5,_0x1849cb){_0x3feab5=_0x3feab5-0x0;var _0x4fb9e9=_0xd7cf[_0x3feab5];return _0x4fb9e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd7c('0x0'));var BPromise=require(_0xfd7c('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xfd7c('0x2'))(_0xfd7c('0x3'));exports['GetCmHopper']=function(_0x5b85eb){var _0x3f2f11=this;return new Promise(function(_0x3ee563,_0x394cc9){return db[_0xfd7c('0x4')]['findAll']({'raw':_0x5b85eb[_0xfd7c('0x5')]?_0x5b85eb[_0xfd7c('0x5')][_0xfd7c('0x6')]===undefined?!![]:![]:!![],'where':_0x5b85eb[_0xfd7c('0x5')]?_0x5b85eb['options'][_0xfd7c('0x7')]||null:null,'attributes':_0x5b85eb[_0xfd7c('0x5')]?_0x5b85eb[_0xfd7c('0x5')]['attributes']||null:null,'limit':_0x5b85eb[_0xfd7c('0x5')]?_0x5b85eb[_0xfd7c('0x5')][_0xfd7c('0x8')]||null:null,'include':_0x5b85eb['options']?_0x5b85eb[_0xfd7c('0x5')][_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0x5b85eb[_0xfd7c('0x5')][_0xfd7c('0x9')],function(_0x508f59){return{'model':db[_0x508f59[_0xfd7c('0xb')]],'as':_0x508f59['as'],'attributes':_0x508f59[_0xfd7c('0xc')],'include':_0x508f59[_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0x508f59[_0xfd7c('0x9')],function(_0x593f65){return{'model':db[_0x593f65[_0xfd7c('0xb')]],'as':_0x593f65['as'],'attributes':_0x593f65[_0xfd7c('0xc')],'include':_0x593f65[_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0x593f65['include'],function(_0x5ae65a){return{'model':db[_0x5ae65a['model']],'as':_0x5ae65a['as'],'attributes':_0x5ae65a[_0xfd7c('0xc')]};}):[]};}):[]};}):[]:[]})[_0xfd7c('0xd')](function(_0x59314e){logger[_0xfd7c('0xe')](_0xfd7c('0xf'),_0x5b85eb);logger['debug'](_0xfd7c('0xf'),_0x5b85eb,JSON[_0xfd7c('0x10')](_0x59314e));_0x3ee563(_0x59314e);})[_0xfd7c('0x11')](function(_0x4d8a26){logger[_0xfd7c('0x12')](_0xfd7c('0xf'),_0x4d8a26['message'],_0x5b85eb);_0x394cc9(_0x3f2f11[_0xfd7c('0x12')](0x1f4,_0x4d8a26[_0xfd7c('0x13')]));});});};exports[_0xfd7c('0x14')]=function(_0x484adc){var _0x58a155=this;return new Promise(function(_0x4d86c4,_0x483cc4){return db['CmHopper'][_0xfd7c('0x15')]({'raw':_0x484adc[_0xfd7c('0x5')]?_0x484adc[_0xfd7c('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x484adc[_0xfd7c('0x5')]?_0x484adc[_0xfd7c('0x5')][_0xfd7c('0x7')]||null:null,'attributes':_0x484adc[_0xfd7c('0x5')]?_0x484adc[_0xfd7c('0x5')][_0xfd7c('0xc')]||null:null,'include':_0x484adc['options']?_0x484adc[_0xfd7c('0x5')][_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0x484adc[_0xfd7c('0x5')][_0xfd7c('0x9')],function(_0xb4ba3c){return{'model':db[_0xb4ba3c[_0xfd7c('0xb')]],'as':_0xb4ba3c['as'],'attributes':_0xb4ba3c[_0xfd7c('0xc')],'include':_0xb4ba3c[_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0xb4ba3c[_0xfd7c('0x9')],function(_0x56e0d1){return{'model':db[_0x56e0d1[_0xfd7c('0xb')]],'as':_0x56e0d1['as'],'attributes':_0x56e0d1[_0xfd7c('0xc')],'include':_0x56e0d1['include']?_[_0xfd7c('0xa')](_0x56e0d1[_0xfd7c('0x9')],function(_0x339b24){return{'model':db[_0x339b24['model']],'as':_0x339b24['as'],'attributes':_0x339b24['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd7c('0xd')](function(_0x1bd79b){logger[_0xfd7c('0xe')](_0xfd7c('0x14'),_0x484adc);logger['debug']('ShowCmHopper',_0x484adc,JSON['stringify'](_0x1bd79b));_0x4d86c4(_0x1bd79b);})[_0xfd7c('0x11')](function(_0xdae07){logger[_0xfd7c('0x12')](_0xfd7c('0x14'),_0xdae07[_0xfd7c('0x13')],_0x484adc);_0x483cc4(_0x58a155[_0xfd7c('0x12')](0x1f4,_0xdae07[_0xfd7c('0x13')]));});});};exports['CreateCmHopper']=function(_0x310d40){var _0x4ae022=this;return new Promise(function(_0x3f5f91,_0x4f6d24){return db[_0xfd7c('0x4')][_0xfd7c('0x16')](_0x310d40[_0xfd7c('0x17')],{'raw':_0x310d40[_0xfd7c('0x5')]?_0x310d40[_0xfd7c('0x5')]['raw']===undefined?!![]:![]:!![]})[_0xfd7c('0xd')](function(_0x51c8eb){logger[_0xfd7c('0xe')](_0xfd7c('0x18'),_0x310d40);logger[_0xfd7c('0x19')](_0xfd7c('0x18'),_0x310d40,JSON[_0xfd7c('0x10')](_0x51c8eb));_0x3f5f91(_0x51c8eb);})['catch'](function(_0x5c276f){logger[_0xfd7c('0x12')](_0xfd7c('0x18'),_0x5c276f['message'],_0x310d40);_0x4f6d24(_0x4ae022[_0xfd7c('0x12')](0x1f4,_0x5c276f[_0xfd7c('0x13')]));});});};exports['UpdateCmHopper']=function(_0x1c341d){var _0x3a960e=this;return new Promise(function(_0x138ca6,_0x22359b){return db[_0xfd7c('0x4')]['update'](_0x1c341d[_0xfd7c('0x17')],{'raw':_0x1c341d[_0xfd7c('0x5')]?_0x1c341d[_0xfd7c('0x5')][_0xfd7c('0x6')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c341d[_0xfd7c('0x5')]?_0x1c341d[_0xfd7c('0x5')][_0xfd7c('0x7')]||null:null,'attributes':_0x1c341d[_0xfd7c('0x5')]?_0x1c341d[_0xfd7c('0x5')]['attributes']||null:null,'limit':_0x1c341d[_0xfd7c('0x5')]?_0x1c341d[_0xfd7c('0x5')]['limit']||null:null})[_0xfd7c('0xd')](function(_0x203cc8){logger[_0xfd7c('0xe')](_0xfd7c('0x1a'),_0x1c341d);logger[_0xfd7c('0xe')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xfd7c('0x10')](_0x1c341d[_0xfd7c('0x5')][_0xfd7c('0x7')]),_0x1c341d[_0xfd7c('0x17')][_0xfd7c('0x1b')]);logger['debug']('UpdateCmHopper',_0x1c341d,JSON['stringify'](_0x203cc8));_0x138ca6(_0x203cc8);})[_0xfd7c('0x11')](function(_0x2b2881){logger[_0xfd7c('0x12')](_0xfd7c('0x1a'),_0x2b2881[_0xfd7c('0x13')],_0x1c341d);_0x22359b(_0x3a960e['error'](0x1f4,_0x2b2881['message']));});});};exports[_0xfd7c('0x1c')]=function(_0x269b9e){var _0x32222c=this;return new Promise(function(_0x34acb9,_0x55d690){return db[_0xfd7c('0x4')]['destroy']({'where':_0x269b9e[_0xfd7c('0x5')]?_0x269b9e[_0xfd7c('0x5')][_0xfd7c('0x7')]||null:null})['then'](function(_0x145786){logger[_0xfd7c('0xe')](_0xfd7c('0x1c'),_0x269b9e);logger[_0xfd7c('0x19')](_0xfd7c('0x1c'),_0x269b9e,JSON[_0xfd7c('0x10')](_0x145786));_0x34acb9(_0x145786);})[_0xfd7c('0x11')](function(_0x56cd1a){logger[_0xfd7c('0x12')](_0xfd7c('0x1c'),_0x56cd1a['message'],_0x269b9e);_0x55d690(_0x32222c[_0xfd7c('0x12')](0x1f4,_0x56cd1a[_0xfd7c('0x13')]));});});};exports[_0xfd7c('0x1d')]=function(_0x6dbec5){var _0x37aaf6=this;return new Promise(function(_0x4be98d,_0x4775fa){return db[_0xfd7c('0x1e')][_0xfd7c('0x1f')]()[_0xfd7c('0xd')](function(_0x28adff){return db[_0xfd7c('0x20')][_0xfd7c('0x21')](function(_0x38276f){return db[_0xfd7c('0x4')]['findAll']({'where':_0x6dbec5[_0xfd7c('0x5')]?_0x6dbec5[_0xfd7c('0x5')][_0xfd7c('0x7')]||null:null,'attributes':_0x6dbec5[_0xfd7c('0x5')]?_0x6dbec5[_0xfd7c('0x5')][_0xfd7c('0xc')]||null:null,'limit':_0x6dbec5[_0xfd7c('0x5')]?_0x6dbec5[_0xfd7c('0x5')][_0xfd7c('0x8')]||null:null,'order':_0x6dbec5[_0xfd7c('0x5')]?_0x6dbec5[_0xfd7c('0x5')][_0xfd7c('0x22')]||null:null,'transaction':_0x38276f,'lock':_0x38276f[_0xfd7c('0x23')][_0xfd7c('0x24')],'include':[{'model':db[_0xfd7c('0x1e')],'as':'Contact','attributes':_[_0xfd7c('0x25')](_0x28adff)},{'model':db[_0xfd7c('0x26')],'as':_0xfd7c('0x27'),'attributes':['id',_0xfd7c('0x28'),'voicePause']}]})[_0xfd7c('0xd')](function(_0x4af2d3){var _0x59fd95=[];var _0x433ef7=[];for(var _0x4979d4=0x0;_0x4979d4<_0x4af2d3[_0xfd7c('0x29')];_0x4979d4+=0x1){var _0x4cc13a=_0x4af2d3[_0x4979d4]['UserId'];if(_0x4cc13a===null){_0x59fd95['push'](_0x4af2d3[_0x4979d4][_0xfd7c('0x2a')](_0x6dbec5[_0xfd7c('0x17')],{'transaction':_0x38276f}));}else if(!_0x433ef7['includes'](_0x4cc13a)){_0x433ef7[_0xfd7c('0x2b')](_0x4cc13a);_0x59fd95['push'](_0x4af2d3[_0x4979d4]['update'](_0x6dbec5[_0xfd7c('0x17')],{'transaction':_0x38276f}));}}return BPromise[_0xfd7c('0x2c')](_0x59fd95);});})[_0xfd7c('0xd')](function(_0x25ad1a){logger[_0xfd7c('0xe')](_0xfd7c('0x1d'),_0x6dbec5);if(_0x25ad1a[_0xfd7c('0x29')]>0x0){logger[_0xfd7c('0xe')](_0xfd7c('0x2d'),_0x25ad1a[0x0][_0xfd7c('0x2e')]['id'],_0x25ad1a[0x0][_0xfd7c('0x2e')][_0xfd7c('0x2f')],_0x25ad1a[0x0][_0xfd7c('0x2e')][_0xfd7c('0x1b')]);}logger[_0xfd7c('0x19')]('GetContactDialer',_0x6dbec5,JSON[_0xfd7c('0x10')](_0x25ad1a));_0x4be98d(_0x25ad1a);})[_0xfd7c('0x11')](function(_0x2697fc){logger[_0xfd7c('0x12')]('GetContactDialer',_0x2697fc[_0xfd7c('0x13')],_0x6dbec5);_0x4775fa(_0x37aaf6['error'](0x1f4,_0x2697fc[_0xfd7c('0x13')]));});});});};exports[_0xfd7c('0x30')]=function(_0x43f3e9){var _0x5aabce=this;return new Promise(function(_0x226209,_0x544abf){return db[_0xfd7c('0x20')][_0xfd7c('0x21')](function(_0x5ed0a5){return db['CmHopperFinal'][_0xfd7c('0x16')](_0x43f3e9[_0xfd7c('0x17')],{'raw':_0x43f3e9[_0xfd7c('0x5')]?_0x43f3e9[_0xfd7c('0x5')][_0xfd7c('0x6')]===undefined?!![]:![]:!![],'transaction':_0x5ed0a5})[_0xfd7c('0xd')](function(){logger['info'](_0xfd7c('0x31'),JSON[_0xfd7c('0x10')](_0x43f3e9[_0xfd7c('0x5')][_0xfd7c('0x7')]),_0x43f3e9[_0xfd7c('0x5')]['where'][_0xfd7c('0x1b')]);return db['CmHopper'][_0xfd7c('0x32')]({'where':_0x43f3e9[_0xfd7c('0x5')]?_0x43f3e9[_0xfd7c('0x5')][_0xfd7c('0x7')]||null:null,'transaction':_0x5ed0a5});});})[_0xfd7c('0xd')](function(_0x5cc016){logger[_0xfd7c('0xe')]('MoveContactManagedDialer',_0x43f3e9);logger[_0xfd7c('0x19')](_0xfd7c('0x30'),_0x43f3e9,JSON[_0xfd7c('0x10')](_0x5cc016));_0x226209(_0x5cc016);})['catch'](function(_0x4bcd3c){logger[_0xfd7c('0x12')]('MoveContactManagedDialer',_0x4bcd3c[_0xfd7c('0x13')],_0x43f3e9);_0x544abf(_0x5aabce[_0xfd7c('0x12')](0x1f4,_0x4bcd3c[_0xfd7c('0x13')]));});});};exports['CountReScheduled']=function(_0x1c42ac){var _0x180527=this;return new Promise(function(_0x9edc4d,_0x35bb66){return db['CmHopper']['findAll']({'raw':_0x1c42ac[_0xfd7c('0x5')]?_0x1c42ac[_0xfd7c('0x5')][_0xfd7c('0x6')]===undefined?!![]:![]:!![],'where':_0x1c42ac[_0xfd7c('0x5')]?_0x1c42ac[_0xfd7c('0x5')][_0xfd7c('0x7')]||null:null,'attributes':[[db[_0xfd7c('0x20')]['fn'](_0xfd7c('0x33'),db['sequelize']['fn']('IF',db[_0xfd7c('0x20')][_0xfd7c('0x34')](_0xfd7c('0x35')+util[_0xfd7c('0x36')](_0xfd7c('0x37'),moment()[_0xfd7c('0x36')](_0xfd7c('0x38')))+_0xfd7c('0x39')))),'contactsRescheduled']]})[_0xfd7c('0xd')](function(_0x313f64){logger[_0xfd7c('0xe')](_0xfd7c('0x3a'),_0x1c42ac);logger[_0xfd7c('0x19')](_0xfd7c('0x3a'),_0x1c42ac,JSON['stringify'](_0x313f64));_0x9edc4d(_0x313f64);})['catch'](function(_0x56992a){logger[_0xfd7c('0x12')](_0xfd7c('0x3a'),_0x56992a[_0xfd7c('0x13')],_0x1c42ac);_0x35bb66(_0x180527[_0xfd7c('0x12')](0x1f4,_0x56992a[_0xfd7c('0x13')]));});});};exports[_0xfd7c('0x3b')]=function(_0x3ed302){var _0x49399d=this;return new Promise(function(_0x2d9b8a,_0x1089ab){return db[_0xfd7c('0x1e')]['describe']()['then'](function(){return db[_0xfd7c('0x20')]['transaction'](function(_0x2c4557){return db['CmHopper']['findAll']({'where':_0x3ed302['options']?_0x3ed302['options'][_0xfd7c('0x7')]||null:null,'attributes':_0x3ed302[_0xfd7c('0x5')]?_0x3ed302[_0xfd7c('0x5')][_0xfd7c('0xc')]||null:null,'limit':0x1,'order':_0x3ed302[_0xfd7c('0x5')]?_0x3ed302[_0xfd7c('0x5')][_0xfd7c('0x22')]||null:null,'group':db[_0xfd7c('0x4')][_0xfd7c('0x3c')],'transaction':_0x2c4557,'lock':_0x2c4557[_0xfd7c('0x23')]['UPDATE'],'include':_0x3ed302[_0xfd7c('0x5')]?_0x3ed302[_0xfd7c('0x5')]['include']?_[_0xfd7c('0xa')](_0x3ed302['options']['include'],function(_0x164c84){return{'model':db[_0x164c84[_0xfd7c('0xb')]],'as':_0x164c84['as'],'attributes':_0x164c84[_0xfd7c('0xc')],'include':_0x164c84[_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0x164c84[_0xfd7c('0x9')],function(_0x3de85b){return{'model':db[_0x3de85b['model']],'as':_0x3de85b['as'],'attributes':_0x3de85b[_0xfd7c('0xc')],'include':_0x3de85b[_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0x3de85b['include'],function(_0x139eba){return{'model':db[_0x139eba[_0xfd7c('0xb')]],'as':_0x139eba['as'],'attributes':_0x139eba['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd7c('0xd')](function(_0x12d49d){var _0x2e7397=[];for(var _0x42f01c=0x0;_0x42f01c<_0x12d49d[_0xfd7c('0x29')];_0x42f01c+=0x1){_0x2e7397[_0xfd7c('0x2b')](_0x12d49d[_0x42f01c][_0xfd7c('0x2a')](_0x3ed302[_0xfd7c('0x17')],{'transaction':_0x2c4557}));}return BPromise[_0xfd7c('0x2c')](_0x2e7397);});})[_0xfd7c('0xd')](function(_0x1ec243){logger[_0xfd7c('0xe')](_0xfd7c('0x3b'),_0x3ed302);logger['debug']('GetContactRecallMe',_0x3ed302,JSON[_0xfd7c('0x10')](_0x1ec243));_0x2d9b8a(_0x1ec243);})[_0xfd7c('0x11')](function(_0x560bc4){logger[_0xfd7c('0x12')](_0xfd7c('0x3b'),_0x560bc4[_0xfd7c('0x13')],_0x3ed302);_0x1089ab(_0x49399d['error'](0x1f4,_0x560bc4['message']));});});});};exports['GetCmHopperPreview']=function(_0xcce368){var _0x3b2a50=this;return new Promise(function(_0x59c021,_0x79f81){db[_0xfd7c('0x1e')][_0xfd7c('0x1f')]()[_0xfd7c('0xd')](function(_0x5165d0){return db[_0xfd7c('0x4')][_0xfd7c('0x3d')]({'raw':_0xcce368[_0xfd7c('0x5')]?_0xcce368[_0xfd7c('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0xcce368[_0xfd7c('0x5')]?_0xcce368[_0xfd7c('0x5')]['where']||null:null,'attributes':_0xcce368[_0xfd7c('0x5')]?_0xcce368[_0xfd7c('0x5')][_0xfd7c('0xc')]||null:null,'limit':_0xcce368[_0xfd7c('0x5')]?_0xcce368[_0xfd7c('0x5')]['limit']||null:null,'include':_0xcce368['options']?_0xcce368['options']['include']?_[_0xfd7c('0xa')](_0xcce368['options'][_0xfd7c('0x9')],function(_0x1b0d1e){return{'model':db[_0x1b0d1e[_0xfd7c('0xb')]],'as':_0x1b0d1e['as'],'attributes':_0x1b0d1e['as']===_0xfd7c('0x3e')?_[_0xfd7c('0x25')](_0x5165d0):_0x1b0d1e['attributes'],'include':_0x1b0d1e[_0xfd7c('0x9')]?_[_0xfd7c('0xa')](_0x1b0d1e[_0xfd7c('0x9')],function(_0x2077b6){return{'model':db[_0x2077b6[_0xfd7c('0xb')]],'as':_0x2077b6['as'],'attributes':_0x2077b6['attributes'],'include':_0x2077b6[_0xfd7c('0x9')]?_['map'](_0x2077b6[_0xfd7c('0x9')],function(_0x766b79){return{'model':db[_0x766b79['model']],'as':_0x766b79['as'],'attributes':_0x766b79[_0xfd7c('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x441361){logger[_0xfd7c('0xe')]('GetCmHopper',_0xcce368);logger['debug'](_0xfd7c('0xf'),_0xcce368,JSON[_0xfd7c('0x10')](_0x441361));_0x59c021(_0x441361);})[_0xfd7c('0x11')](function(_0x50021f){logger[_0xfd7c('0x12')]('GetCmHopper',_0x50021f['message'],_0xcce368);_0x79f81(_0x3b2a50[_0xfd7c('0x12')](0x1f4,_0x50021f[_0xfd7c('0x13')]));});});});};exports[_0xfd7c('0x3f')]=function(_0x2d3a49){var _0x4e1a65=this;return new Promise(function(_0x53f722,_0x2fa612){return db[_0xfd7c('0x1e')]['findOne']({'raw':!![],'where':{'phone':_0x2d3a49[_0xfd7c('0x5')][_0xfd7c('0x7')][_0xfd7c('0x40')]},'attributes':['id',_0xfd7c('0x41')],'order':[['id',_0xfd7c('0x42')]]})[_0xfd7c('0xd')](function(_0x3d3bae){logger['info']('getContactByPhone',_0x2d3a49);logger[_0xfd7c('0x19')]('getContactByPhone',_0x2d3a49,JSON[_0xfd7c('0x10')](_0x3d3bae));_0x53f722(_0x3d3bae);})[_0xfd7c('0x11')](function(_0x468ea6){logger[_0xfd7c('0x12')]('getContactByPhone',_0x468ea6['message'],_0x2d3a49);_0x2fa612(_0x4e1a65[_0xfd7c('0x12')](0x1f4,_0x468ea6[_0xfd7c('0x13')]));});});};exports['ResetActiveCalls']=function(_0x1a74a7){var _0x596626=this;return new Promise(function(_0x478c84,_0x130489){return db['sequelize'][_0xfd7c('0x21')](function(_0x5ee4ed){var _0x506035=_0x1a74a7['options']&&_0x1a74a7[_0xfd7c('0x5')][_0xfd7c('0x7')]?_0x1a74a7[_0xfd7c('0x5')][_0xfd7c('0x7')]:{};return db[_0xfd7c('0x4')]['update'](_0x1a74a7[_0xfd7c('0x17')],{'where':_0x506035,'transaction':_0x5ee4ed})[_0xfd7c('0xd')](function(_0x44fdee){logger['info']('ResetActiveCalls',_0x1a74a7);logger[_0xfd7c('0x19')](_0xfd7c('0x43'),_0x1a74a7,JSON[_0xfd7c('0x10')](_0x44fdee));_0x478c84(_0x44fdee);})['catch'](function(_0x1b5c4e){logger[_0xfd7c('0x12')](_0xfd7c('0x43'),_0x1b5c4e['message'],_0x1a74a7);_0x130489(_0x596626[_0xfd7c('0x12')](0x1f4,_0x1b5c4e[_0xfd7c('0x13')]));});});});};exports[_0xfd7c('0x44')]=function(_0x1d1a9f){var _0x259530=this;var _0x237a95=_0x1d1a9f[_0xfd7c('0x17')]['where']['voiceQueueIds'];var _0x19da43=_0x1d1a9f[_0xfd7c('0x17')]['where'][_0xfd7c('0x45')];var _0x1d7ee7=_0x1d1a9f[_0xfd7c('0x17')][_0xfd7c('0x7')][_0xfd7c('0x46')];return new Promise(function(_0x26c4bd,_0x1d9e0a){return db[_0xfd7c('0x4')][_0xfd7c('0x3d')]({'where':{'voiceQueueId':{'$in':_0x237a95},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xfd7c('0x20')][_0xfd7c('0x34')](_0xfd7c('0x47')+_0x19da43+_0xfd7c('0x48')),'$gt':db[_0xfd7c('0x20')][_0xfd7c('0x34')]('NOW()')}},'UserId':{'$in':_0x1d7ee7}},'include':[{'model':db[_0xfd7c('0x1e')],'as':_0xfd7c('0x3e')},{'model':db['User'],'as':_0xfd7c('0x27'),'attributes':['id',_0xfd7c('0x28'),_0xfd7c('0x49')]},{'model':db[_0xfd7c('0x4a')],'as':_0xfd7c('0x4b')}]})[_0xfd7c('0xd')](function(_0x2391a6){if(_0x2391a6[_0xfd7c('0x29')]>0x0){return db['sequelize']['transaction'](function(_0x5c39f1){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0xfd7c('0x20')][_0xfd7c('0x34')](_0xfd7c('0x4c'))},{'where':{'id':{'$in':_[_0xfd7c('0xa')](_0x2391a6,'id')}},'transaction':_0x5c39f1})['then'](function(){_0x26c4bd(_0x2391a6);})[_0xfd7c('0x11')](function(_0x4ab5fe){logger[_0xfd7c('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x4ab5fe['message'],_0x1d1a9f);_0x1d9e0a(_0x259530[_0xfd7c('0x12')](0x1f4,_0x4ab5fe[_0xfd7c('0x13')]));});})[_0xfd7c('0x11')](function(_0x280de3){logger[_0xfd7c('0x12')](_0xfd7c('0x44'),_0x280de3[_0xfd7c('0x13')],_0x1d1a9f);_0x1d9e0a(_0x259530[_0xfd7c('0x12')](0x1f4,_0x280de3['message']));});}else{_0x26c4bd(_0x2391a6);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7749f53..28fdde2 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 _0x57a1=['create','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','express','Router','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x57a1,0x159));var _0x157a=function(_0x5dbc6a,_0x55c7c6){_0x5dbc6a=_0x5dbc6a-0x0;var _0x33c9c7=_0x57a1[_0x5dbc6a];return _0x33c9c7;};'use strict';var express=require(_0x157a('0x0'));var router=express[_0x157a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x157a('0x2'));router[_0x157a('0x3')]('/',auth[_0x157a('0x4')](),controller[_0x157a('0x5')]);router['get']('/describe',auth[_0x157a('0x4')](),controller[_0x157a('0x6')]);router[_0x157a('0x3')](_0x157a('0x7'),auth[_0x157a('0x4')](),controller[_0x157a('0x8')]);router['get'](_0x157a('0x9'),auth[_0x157a('0x4')](),controller[_0x157a('0xa')]);router[_0x157a('0x3')](_0x157a('0xb'),auth['isAuthenticated'](),controller[_0x157a('0xc')]);router[_0x157a('0x3')]('/:id/previewrecall',auth[_0x157a('0x4')](),controller[_0x157a('0xd')]);router[_0x157a('0xe')]('/',auth[_0x157a('0x4')](),controller[_0x157a('0xf')]);router[_0x157a('0xe')](_0x157a('0x10'),auth['isAuthenticated'](),controller[_0x157a('0x11')]);router[_0x157a('0xe')](_0x157a('0x12'),auth[_0x157a('0x4')](),controller[_0x157a('0x13')]);router[_0x157a('0x14')](_0x157a('0xb'),auth[_0x157a('0x4')](),controller[_0x157a('0x15')]);router[_0x157a('0x16')]('/:id',auth[_0x157a('0x4')](),controller[_0x157a('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5dce=['update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','/opencontacts','getOpenContacts','/timezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','put'];(function(_0x19e825,_0x3f19e2){var _0x398d49=function(_0x35f009){while(--_0x35f009){_0x19e825['push'](_0x19e825['shift']());}};_0x398d49(++_0x3f19e2);}(_0x5dce,0xa4));var _0xe5dc=function(_0x3a5f6b,_0x2f7eb9){_0x3a5f6b=_0x3a5f6b-0x0;var _0x1d65f0=_0x5dce[_0x3a5f6b];return _0x1d65f0;};'use strict';var express=require(_0xe5dc('0x0'));var router=express[_0xe5dc('0x1')]();var auth=require(_0xe5dc('0x2'));var controller=require(_0xe5dc('0x3'));router['get']('/',auth[_0xe5dc('0x4')](),controller[_0xe5dc('0x5')]);router[_0xe5dc('0x6')](_0xe5dc('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xe5dc('0x6')](_0xe5dc('0x8'),auth[_0xe5dc('0x4')](),controller[_0xe5dc('0x9')]);router[_0xe5dc('0x6')](_0xe5dc('0xa'),auth[_0xe5dc('0x4')](),controller['getTimezones']);router[_0xe5dc('0x6')](_0xe5dc('0xb'),auth[_0xe5dc('0x4')](),controller[_0xe5dc('0xc')]);router[_0xe5dc('0x6')](_0xe5dc('0xd'),auth[_0xe5dc('0x4')](),controller[_0xe5dc('0xe')]);router[_0xe5dc('0xf')]('/',auth['isAuthenticated'](),controller[_0xe5dc('0x10')]);router[_0xe5dc('0xf')]('/preview',auth[_0xe5dc('0x4')](),controller[_0xe5dc('0x11')]);router[_0xe5dc('0xf')](_0xe5dc('0x12'),auth[_0xe5dc('0x4')](),controller['getTimezone']);router[_0xe5dc('0x13')](_0xe5dc('0xb'),auth[_0xe5dc('0x4')](),controller[_0xe5dc('0x14')]);router[_0xe5dc('0x15')](_0xe5dc('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe5dc('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 82107ad..a339f91 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 _0xc540=['sequelize','exports','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x25949d,_0x49889d){var _0x321fac=function(_0x345e70){while(--_0x345e70){_0x25949d['push'](_0x25949d['shift']());}};_0x321fac(++_0x49889d);}(_0xc540,0x150));var _0x0c54=function(_0x4007e7,_0x4d6055){_0x4007e7=_0x4007e7-0x0;var _0x24eb90=_0xc540[_0x4007e7];return _0x24eb90;};'use strict';var moment=require('moment');var Sequelize=require(_0x0c54('0x0'));module[_0x0c54('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0c54('0x4')],'defaultValue':moment()[_0x0c54('0x5')](_0x0c54('0x6'))},'countbusyretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c2e=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','DATE'];(function(_0x1c876a,_0x51a697){var _0x54e988=function(_0x429d7d){while(--_0x429d7d){_0x1c876a['push'](_0x1c876a['shift']());}};_0x54e988(++_0x51a697);}(_0x6c2e,0x193));var _0xe6c2=function(_0x3434fd,_0x18facf){_0x3434fd=_0x3434fd-0x0;var _0x3c21a6=_0x6c2e[_0x3434fd];return _0x3c21a6;};'use strict';var moment=require(_0xe6c2('0x0'));var Sequelize=require(_0xe6c2('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xe6c2('0x2')]},'phone':{'type':Sequelize[_0xe6c2('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe6c2('0x4')],'defaultValue':moment()['format'](_0xe6c2('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe6c2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe6c2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe6c2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe6c2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe6c2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe6c2('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 9c91573..8012bd0 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 _0xfb86=['limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','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/logger','api','status','json','offset','undefined'];(function(_0x557b09,_0x51faeb){var _0x10fd19=function(_0x10e707){while(--_0x10e707){_0x557b09['push'](_0x557b09['shift']());}};_0x10fd19(++_0x51faeb);}(_0xfb86,0x1c6));var _0x6fb8=function(_0x30dba7,_0x2fb710){_0x30dba7=_0x30dba7-0x0;var _0x1a9a83=_0xfb86[_0x30dba7];return _0x1a9a83;};'use strict';var emlformat=require(_0x6fb8('0x0'));var rimraf=require(_0x6fb8('0x1'));var zipdir=require(_0x6fb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fb8('0x3'));var BPromise=require(_0x6fb8('0x4'));var Mustache=require(_0x6fb8('0x5'));var util=require(_0x6fb8('0x6'));var path=require(_0x6fb8('0x7'));var sox=require(_0x6fb8('0x8'));var csv=require(_0x6fb8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fb8('0xa'));var _=require(_0x6fb8('0xb'));var squel=require(_0x6fb8('0xc'));var crypto=require(_0x6fb8('0xd'));var jsforce=require(_0x6fb8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6fb8('0x9'));var querystring=require('querystring');var Papa=require(_0x6fb8('0xf'));var Redis=require(_0x6fb8('0x10'));var authService=require(_0x6fb8('0x11'));var qs=require(_0x6fb8('0x12'));var as=require(_0x6fb8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fb8('0x14'))(_0x6fb8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43e8f0,_0x4b002c){_0x4b002c=_0x4b002c||0xcc;return function(_0x4d17af){if(_0x4d17af){return _0x43e8f0['sendStatus'](_0x4b002c);}return _0x43e8f0[_0x6fb8('0x16')](_0x4b002c)['end']();};}function respondWithResult(_0x4eb0e9,_0x5cd90c){_0x5cd90c=_0x5cd90c||0xc8;return function(_0x46e6c4){if(_0x46e6c4){return _0x4eb0e9['status'](_0x5cd90c)[_0x6fb8('0x17')](_0x46e6c4);}};}function respondWithFilteredResult(_0x563a1f,_0x436d90){return function(_0x1acfe9){if(_0x1acfe9){var _0x2b292e=typeof _0x436d90[_0x6fb8('0x18')]===_0x6fb8('0x19')&&typeof _0x436d90[_0x6fb8('0x1a')]===_0x6fb8('0x19');var _0x113884=_0x1acfe9[_0x6fb8('0x1b')];var _0x397a6d=_0x2b292e?0x0:_0x436d90[_0x6fb8('0x18')];var _0x4f3cb8=_0x2b292e?_0x1acfe9[_0x6fb8('0x1b')]:_0x436d90['offset']+_0x436d90[_0x6fb8('0x1a')];var _0x1ffcfb;if(_0x4f3cb8>=_0x113884){_0x4f3cb8=_0x113884;_0x1ffcfb=0xc8;}else{_0x1ffcfb=0xce;}_0x563a1f[_0x6fb8('0x16')](_0x1ffcfb);return _0x563a1f['set'](_0x6fb8('0x1c'),_0x397a6d+'-'+_0x4f3cb8+'/'+_0x113884)[_0x6fb8('0x17')](_0x1acfe9);}return null;};}function patchUpdates(_0xd2b4d){return function(_0x1bd9aa){try{jsonpatch[_0x6fb8('0x1d')](_0x1bd9aa,_0xd2b4d,!![]);}catch(_0x1b976f){return BPromise[_0x6fb8('0x1e')](_0x1b976f);}return _0x1bd9aa[_0x6fb8('0x1f')]();};}function saveUpdates(_0x4e74bc,_0x487204){return function(_0xc0e255){if(_0xc0e255){return _0xc0e255[_0x6fb8('0x20')](_0x4e74bc)[_0x6fb8('0x21')](function(_0x107f94){return _0x107f94;});}return null;};}function removeEntity(_0x3dea5d,_0x17cf86){return function(_0x2782b2){if(_0x2782b2){return _0x2782b2[_0x6fb8('0x22')]()[_0x6fb8('0x21')](function(){var _0x1850cd=_0x2782b2[_0x6fb8('0x23')]({'plain':!![]});var _0x5f01eb=_0x6fb8('0x24');return db[_0x6fb8('0x25')][_0x6fb8('0x22')]({'where':{'type':_0x5f01eb,'resourceId':_0x1850cd['id']}})[_0x6fb8('0x21')](function(){return _0x2782b2;});})[_0x6fb8('0x21')](function(){_0x3dea5d[_0x6fb8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49337a,_0x268b8f){return function(_0x16b3d3){if(!_0x16b3d3){_0x49337a[_0x6fb8('0x26')](0x194);}return _0x16b3d3;};}function handleError(_0x6be768,_0x107ce7){_0x107ce7=_0x107ce7||0x1f4;return function(_0xd8ef3b){logger['error'](_0xd8ef3b[_0x6fb8('0x27')]);if(_0xd8ef3b[_0x6fb8('0x28')]){delete _0xd8ef3b[_0x6fb8('0x28')];}_0x6be768[_0x6fb8('0x16')](_0x107ce7)[_0x6fb8('0x29')](_0xd8ef3b);};}exports[_0x6fb8('0x2a')]=function(_0x52c5ff,_0x58b5b8){var _0x268ac9={},_0x5342cc={},_0x41f932={'count':0x0,'rows':[]};var _0x749590=_[_0x6fb8('0x2b')](db[_0x6fb8('0x2c')][_0x6fb8('0x2d')],function(_0x4973f9){return{'name':_0x4973f9['fieldName'],'type':_0x4973f9[_0x6fb8('0x2e')][_0x6fb8('0x2f')]};});_0x5342cc['model']=_[_0x6fb8('0x2b')](_0x749590,_0x6fb8('0x28'));_0x5342cc[_0x6fb8('0x30')]=_['keys'](_0x52c5ff['query']);_0x5342cc[_0x6fb8('0x31')]=_['intersection'](_0x5342cc[_0x6fb8('0x32')],_0x5342cc['query']);_0x268ac9[_0x6fb8('0x33')]=_[_0x6fb8('0x34')](_0x5342cc[_0x6fb8('0x32')],qs[_0x6fb8('0x35')](_0x52c5ff[_0x6fb8('0x30')]['fields']));_0x268ac9[_0x6fb8('0x33')]=_0x268ac9[_0x6fb8('0x33')][_0x6fb8('0x36')]?_0x268ac9['attributes']:_0x5342cc['model'];if(!_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x37')](_0x6fb8('0x38'))){_0x268ac9['limit']=qs[_0x6fb8('0x1a')](_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x1a')]);_0x268ac9[_0x6fb8('0x18')]=qs['offset'](_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x18')]);}_0x268ac9[_0x6fb8('0x39')]=qs[_0x6fb8('0x3a')](_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x3a')]);_0x268ac9[_0x6fb8('0x3b')]=qs['filters'](_[_0x6fb8('0x3c')](_0x52c5ff[_0x6fb8('0x30')],_0x5342cc['filters']),_0x749590);if(_0x52c5ff['query'][_0x6fb8('0x3d')]){_0x268ac9[_0x6fb8('0x3b')]=_[_0x6fb8('0x3e')](_0x268ac9['where'],{'$or':_[_0x6fb8('0x2b')](_0x749590,function(_0x484677){if(_0x484677[_0x6fb8('0x2e')]!=='VIRTUAL'){var _0xca26e0={};_0xca26e0[_0x484677['name']]={'$like':'%'+_0x52c5ff[_0x6fb8('0x30')]['filter']+'%'};return _0xca26e0;}})});}_0x268ac9=_[_0x6fb8('0x3e')]({},_0x268ac9,_0x52c5ff[_0x6fb8('0x3f')]);var _0x215cee={'where':_0x268ac9[_0x6fb8('0x3b')]};return db[_0x6fb8('0x2c')][_0x6fb8('0x1b')](_0x215cee)[_0x6fb8('0x21')](function(_0x26249b){_0x41f932[_0x6fb8('0x1b')]=_0x26249b;if(_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x40')]){_0x268ac9['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x268ac9);})[_0x6fb8('0x21')](function(_0x1136c7){_0x41f932[_0x6fb8('0x41')]=_0x1136c7;return _0x41f932;})[_0x6fb8('0x21')](respondWithFilteredResult(_0x58b5b8,_0x268ac9))[_0x6fb8('0x42')](handleError(_0x58b5b8,null));};exports['show']=function(_0x1f0649,_0x2a24c8){var _0x3d2b8e={'raw':!![],'where':{'id':_0x1f0649[_0x6fb8('0x43')]['id']}},_0x56d6b8={};_0x56d6b8['model']=_[_0x6fb8('0x44')](db[_0x6fb8('0x2c')][_0x6fb8('0x2d')]);_0x56d6b8['query']=_[_0x6fb8('0x44')](_0x1f0649[_0x6fb8('0x30')]);_0x56d6b8[_0x6fb8('0x31')]=_[_0x6fb8('0x34')](_0x56d6b8[_0x6fb8('0x32')],_0x56d6b8[_0x6fb8('0x30')]);_0x3d2b8e['attributes']=_[_0x6fb8('0x34')](_0x56d6b8[_0x6fb8('0x32')],qs[_0x6fb8('0x35')](_0x1f0649[_0x6fb8('0x30')]['fields']));_0x3d2b8e[_0x6fb8('0x33')]=_0x3d2b8e[_0x6fb8('0x33')]['length']?_0x3d2b8e[_0x6fb8('0x33')]:_0x56d6b8[_0x6fb8('0x32')];if(_0x1f0649[_0x6fb8('0x30')]['includeAll']){_0x3d2b8e[_0x6fb8('0x45')]=[{'all':!![]}];}_0x3d2b8e=_[_0x6fb8('0x3e')]({},_0x3d2b8e,_0x1f0649[_0x6fb8('0x3f')]);return db[_0x6fb8('0x2c')][_0x6fb8('0x46')](_0x3d2b8e)[_0x6fb8('0x21')](handleEntityNotFound(_0x2a24c8,null))['then'](respondWithResult(_0x2a24c8,null))['catch'](handleError(_0x2a24c8,null));};exports[_0x6fb8('0x47')]=function(_0x1bd2f0,_0x5107c0){return db[_0x6fb8('0x2c')][_0x6fb8('0x47')](_0x1bd2f0[_0x6fb8('0x48')],{})['then'](function(_0x1b76cb){var _0x4765ab=_0x1bd2f0[_0x6fb8('0x49')][_0x6fb8('0x23')]({'plain':!![]});if(!_0x4765ab)throw new Error(_0x6fb8('0x4a'));if(_0x4765ab['role']===_0x6fb8('0x49')){var _0xd47955=_0x1b76cb[_0x6fb8('0x23')]({'plain':!![]});var _0x52d9df=_0x6fb8('0x24');return db[_0x6fb8('0x4b')][_0x6fb8('0x46')]({'where':{'name':_0x52d9df,'userProfileId':_0x4765ab[_0x6fb8('0x4c')]},'raw':!![]})[_0x6fb8('0x21')](function(_0x2aef40){if(_0x2aef40&&_0x2aef40[_0x6fb8('0x4d')]===0x0){return db[_0x6fb8('0x25')][_0x6fb8('0x47')]({'name':_0xd47955[_0x6fb8('0x28')],'resourceId':_0xd47955['id'],'type':_0x2aef40[_0x6fb8('0x28')],'sectionId':_0x2aef40['id']},{})[_0x6fb8('0x21')](function(){return _0x1b76cb;});}else{return _0x1b76cb;}})[_0x6fb8('0x42')](function(_0x354ef6){logger[_0x6fb8('0x4e')](_0x6fb8('0x4f'),_0x354ef6);throw _0x354ef6;});}return _0x1b76cb;})[_0x6fb8('0x21')](respondWithResult(_0x5107c0,0xc9))[_0x6fb8('0x42')](handleError(_0x5107c0,null));};exports[_0x6fb8('0x20')]=function(_0x1ce626,_0x3e29b5){if(_0x1ce626[_0x6fb8('0x48')]['id']){delete _0x1ce626[_0x6fb8('0x48')]['id'];}return db[_0x6fb8('0x2c')][_0x6fb8('0x46')]({'where':{'id':_0x1ce626[_0x6fb8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e29b5,null))['then'](saveUpdates(_0x1ce626[_0x6fb8('0x48')],null))[_0x6fb8('0x21')](respondWithResult(_0x3e29b5,null))[_0x6fb8('0x42')](handleError(_0x3e29b5,null));};exports[_0x6fb8('0x22')]=function(_0x3136e7,_0x10df32){return db['CmHopperAdditionalPhone'][_0x6fb8('0x46')]({'where':{'id':_0x3136e7[_0x6fb8('0x43')]['id']}})[_0x6fb8('0x21')](handleEntityNotFound(_0x10df32,null))[_0x6fb8('0x21')](removeEntity(_0x10df32,null))['catch'](handleError(_0x10df32,null));}; \ No newline at end of file +var _0x0618=['end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','mustache','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','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x381b84,_0x55d045){var _0x5b11dc=function(_0x262e92){while(--_0x262e92){_0x381b84['push'](_0x381b84['shift']());}};_0x5b11dc(++_0x55d045);}(_0x0618,0x1c8));var _0x8061=function(_0xaa1863,_0x21163f){_0xaa1863=_0xaa1863-0x0;var _0x5a4298=_0x0618[_0xaa1863];return _0x5a4298;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8061('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8061('0x1'));var rp=require(_0x8061('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8061('0x3'));var util=require(_0x8061('0x4'));var path=require(_0x8061('0x5'));var sox=require(_0x8061('0x6'));var csv=require(_0x8061('0x7'));var ejs=require(_0x8061('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8061('0x9'));var squel=require('squel');var crypto=require(_0x8061('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8061('0xb'));var toCsv=require(_0x8061('0x7'));var querystring=require(_0x8061('0xc'));var Papa=require(_0x8061('0xd'));var Redis=require(_0x8061('0xe'));var authService=require(_0x8061('0xf'));var qs=require(_0x8061('0x10'));var as=require(_0x8061('0x11'));var hardwareService=require(_0x8061('0x12'));var logger=require(_0x8061('0x13'))(_0x8061('0x14'));var utils=require(_0x8061('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8061('0x16'))['db'];function respondWithStatusCode(_0x166359,_0x27e898){_0x27e898=_0x27e898||0xcc;return function(_0x4756f4){if(_0x4756f4){return _0x166359[_0x8061('0x17')](_0x27e898);}return _0x166359['status'](_0x27e898)[_0x8061('0x18')]();};}function respondWithResult(_0x386147,_0x416d6d){_0x416d6d=_0x416d6d||0xc8;return function(_0x1bb57e){if(_0x1bb57e){return _0x386147[_0x8061('0x19')](_0x416d6d)[_0x8061('0x1a')](_0x1bb57e);}};}function respondWithFilteredResult(_0x4100ce,_0x2e0d0c){return function(_0x3122ef){if(_0x3122ef){var _0x5d9137=typeof _0x2e0d0c[_0x8061('0x1b')]===_0x8061('0x1c')&&typeof _0x2e0d0c[_0x8061('0x1d')]===_0x8061('0x1c');var _0x11b41c=_0x3122ef[_0x8061('0x1e')];var _0x17ede5=_0x5d9137?0x0:_0x2e0d0c[_0x8061('0x1b')];var _0x360b8a=_0x5d9137?_0x3122ef['count']:_0x2e0d0c[_0x8061('0x1b')]+_0x2e0d0c[_0x8061('0x1d')];var _0x336fdb;if(_0x360b8a>=_0x11b41c){_0x360b8a=_0x11b41c;_0x336fdb=0xc8;}else{_0x336fdb=0xce;}_0x4100ce['status'](_0x336fdb);return _0x4100ce['set'](_0x8061('0x1f'),_0x17ede5+'-'+_0x360b8a+'/'+_0x11b41c)[_0x8061('0x1a')](_0x3122ef);}return null;};}function patchUpdates(_0x4a5543){return function(_0x492593){try{jsonpatch[_0x8061('0x20')](_0x492593,_0x4a5543,!![]);}catch(_0x196742){return BPromise[_0x8061('0x21')](_0x196742);}return _0x492593[_0x8061('0x22')]();};}function saveUpdates(_0x5a3965,_0x2c26cd){return function(_0x12ca9b){if(_0x12ca9b){return _0x12ca9b[_0x8061('0x23')](_0x5a3965)[_0x8061('0x24')](function(_0x4545ea){return _0x4545ea;});}return null;};}function removeEntity(_0x170dfd,_0x147bfe){return function(_0x20c4c1){if(_0x20c4c1){return _0x20c4c1[_0x8061('0x25')]()['then'](function(){var _0x18c5ad=_0x20c4c1[_0x8061('0x26')]({'plain':!![]});var _0x5f1344=_0x8061('0x27');return db[_0x8061('0x28')][_0x8061('0x25')]({'where':{'type':_0x5f1344,'resourceId':_0x18c5ad['id']}})[_0x8061('0x24')](function(){return _0x20c4c1;});})[_0x8061('0x24')](function(){_0x170dfd[_0x8061('0x19')](0xcc)[_0x8061('0x18')]();});}};}function handleEntityNotFound(_0x4b02f5,_0x1c1894){return function(_0x33c51a){if(!_0x33c51a){_0x4b02f5[_0x8061('0x17')](0x194);}return _0x33c51a;};}function handleError(_0x3f4818,_0x72122f){_0x72122f=_0x72122f||0x1f4;return function(_0x59715e){logger[_0x8061('0x29')](_0x59715e[_0x8061('0x2a')]);if(_0x59715e[_0x8061('0x2b')]){delete _0x59715e['name'];}_0x3f4818[_0x8061('0x19')](_0x72122f)[_0x8061('0x2c')](_0x59715e);};}exports[_0x8061('0x2d')]=function(_0x17f480,_0x57575c){var _0x486a53={},_0x8cae8b={},_0x16642c={'count':0x0,'rows':[]};var _0x143407=_[_0x8061('0x2e')](db[_0x8061('0x2f')][_0x8061('0x30')],function(_0x1be8d0){return{'name':_0x1be8d0[_0x8061('0x31')],'type':_0x1be8d0[_0x8061('0x32')]['key']};});_0x8cae8b[_0x8061('0x33')]=_[_0x8061('0x2e')](_0x143407,_0x8061('0x2b'));_0x8cae8b[_0x8061('0x34')]=_[_0x8061('0x35')](_0x17f480[_0x8061('0x34')]);_0x8cae8b[_0x8061('0x36')]=_[_0x8061('0x37')](_0x8cae8b[_0x8061('0x33')],_0x8cae8b[_0x8061('0x34')]);_0x486a53[_0x8061('0x38')]=_['intersection'](_0x8cae8b[_0x8061('0x33')],qs[_0x8061('0x39')](_0x17f480[_0x8061('0x34')][_0x8061('0x39')]));_0x486a53[_0x8061('0x38')]=_0x486a53[_0x8061('0x38')][_0x8061('0x3a')]?_0x486a53[_0x8061('0x38')]:_0x8cae8b[_0x8061('0x33')];if(!_0x17f480[_0x8061('0x34')]['hasOwnProperty']('nolimit')){_0x486a53['limit']=qs[_0x8061('0x1d')](_0x17f480[_0x8061('0x34')][_0x8061('0x1d')]);_0x486a53[_0x8061('0x1b')]=qs['offset'](_0x17f480['query'][_0x8061('0x1b')]);}_0x486a53['order']=qs['sort'](_0x17f480[_0x8061('0x34')][_0x8061('0x3b')]);_0x486a53[_0x8061('0x3c')]=qs['filters'](_[_0x8061('0x3d')](_0x17f480[_0x8061('0x34')],_0x8cae8b['filters']),_0x143407);if(_0x17f480[_0x8061('0x34')][_0x8061('0x3e')]){_0x486a53[_0x8061('0x3c')]=_[_0x8061('0x3f')](_0x486a53['where'],{'$or':_[_0x8061('0x2e')](_0x143407,function(_0x186496){if(_0x186496[_0x8061('0x32')]!==_0x8061('0x40')){var _0xb32cc7={};_0xb32cc7[_0x186496[_0x8061('0x2b')]]={'$like':'%'+_0x17f480['query'][_0x8061('0x3e')]+'%'};return _0xb32cc7;}})});}_0x486a53=_[_0x8061('0x3f')]({},_0x486a53,_0x17f480[_0x8061('0x41')]);var _0x3a9fa6={'where':_0x486a53[_0x8061('0x3c')]};return db[_0x8061('0x2f')]['count'](_0x3a9fa6)[_0x8061('0x24')](function(_0x23a958){_0x16642c[_0x8061('0x1e')]=_0x23a958;if(_0x17f480['query'][_0x8061('0x42')]){_0x486a53[_0x8061('0x43')]=[{'all':!![]}];}return db[_0x8061('0x2f')]['findAll'](_0x486a53);})[_0x8061('0x24')](function(_0x519802){_0x16642c[_0x8061('0x44')]=_0x519802;return _0x16642c;})[_0x8061('0x24')](respondWithFilteredResult(_0x57575c,_0x486a53))[_0x8061('0x45')](handleError(_0x57575c,null));};exports[_0x8061('0x46')]=function(_0x34a553,_0x1d9258){var _0x16de4f={'raw':!![],'where':{'id':_0x34a553[_0x8061('0x47')]['id']}},_0x310e65={};_0x310e65[_0x8061('0x33')]=_[_0x8061('0x35')](db[_0x8061('0x2f')][_0x8061('0x30')]);_0x310e65[_0x8061('0x34')]=_[_0x8061('0x35')](_0x34a553[_0x8061('0x34')]);_0x310e65[_0x8061('0x36')]=_[_0x8061('0x37')](_0x310e65[_0x8061('0x33')],_0x310e65['query']);_0x16de4f[_0x8061('0x38')]=_['intersection'](_0x310e65['model'],qs[_0x8061('0x39')](_0x34a553[_0x8061('0x34')][_0x8061('0x39')]));_0x16de4f['attributes']=_0x16de4f['attributes'][_0x8061('0x3a')]?_0x16de4f['attributes']:_0x310e65['model'];if(_0x34a553[_0x8061('0x34')]['includeAll']){_0x16de4f[_0x8061('0x43')]=[{'all':!![]}];}_0x16de4f=_[_0x8061('0x3f')]({},_0x16de4f,_0x34a553[_0x8061('0x41')]);return db[_0x8061('0x2f')][_0x8061('0x48')](_0x16de4f)[_0x8061('0x24')](handleEntityNotFound(_0x1d9258,null))[_0x8061('0x24')](respondWithResult(_0x1d9258,null))[_0x8061('0x45')](handleError(_0x1d9258,null));};exports['create']=function(_0x137aee,_0x572549){return db[_0x8061('0x2f')][_0x8061('0x49')](_0x137aee[_0x8061('0x4a')],{})[_0x8061('0x24')](function(_0x358122){var _0x143f8a=_0x137aee[_0x8061('0x4b')][_0x8061('0x26')]({'plain':!![]});if(!_0x143f8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x143f8a[_0x8061('0x4c')]==='user'){var _0x216cad=_0x358122['get']({'plain':!![]});var _0x475831='CmHopperAdditionalPhones';return db['UserProfileSection'][_0x8061('0x48')]({'where':{'name':_0x475831,'userProfileId':_0x143f8a[_0x8061('0x4d')]},'raw':!![]})['then'](function(_0x628356){if(_0x628356&&_0x628356[_0x8061('0x4e')]===0x0){return db[_0x8061('0x28')][_0x8061('0x49')]({'name':_0x216cad[_0x8061('0x2b')],'resourceId':_0x216cad['id'],'type':_0x628356[_0x8061('0x2b')],'sectionId':_0x628356['id']},{})[_0x8061('0x24')](function(){return _0x358122;});}else{return _0x358122;}})[_0x8061('0x45')](function(_0x15e0ea){logger[_0x8061('0x29')](_0x8061('0x4f'),_0x15e0ea);throw _0x15e0ea;});}return _0x358122;})[_0x8061('0x24')](respondWithResult(_0x572549,0xc9))[_0x8061('0x45')](handleError(_0x572549,null));};exports[_0x8061('0x23')]=function(_0x12e212,_0x15d674){if(_0x12e212['body']['id']){delete _0x12e212[_0x8061('0x4a')]['id'];}return db[_0x8061('0x2f')][_0x8061('0x48')]({'where':{'id':_0x12e212[_0x8061('0x47')]['id']}})['then'](handleEntityNotFound(_0x15d674,null))[_0x8061('0x24')](saveUpdates(_0x12e212[_0x8061('0x4a')],null))[_0x8061('0x24')](respondWithResult(_0x15d674,null))[_0x8061('0x45')](handleError(_0x15d674,null));};exports[_0x8061('0x25')]=function(_0x2d6834,_0x258bc6){return db[_0x8061('0x2f')][_0x8061('0x48')]({'where':{'id':_0x2d6834[_0x8061('0x47')]['id']}})[_0x8061('0x24')](handleEntityNotFound(_0x258bc6,null))[_0x8061('0x24')](removeEntity(_0x258bc6,null))[_0x8061('0x45')](handleError(_0x258bc6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 3a3c66d..eeba6f0 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 _0xc01c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','util','../../config/logger','api'];(function(_0x25e7bc,_0x6c04a4){var _0x42ecf6=function(_0x5c47df){while(--_0x5c47df){_0x25e7bc['push'](_0x25e7bc['shift']());}};_0x42ecf6(++_0x6c04a4);}(_0xc01c,0x1dd));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcc01('0x0'));var logger=require(_0xcc01('0x1'))(_0xcc01('0x2'));var moment=require(_0xcc01('0x3'));var BPromise=require(_0xcc01('0x4'));var rp=require(_0xcc01('0x5'));var fs=require('fs');var path=require(_0xcc01('0x6'));var rimraf=require(_0xcc01('0x7'));var config=require(_0xcc01('0x8'));var attributes=require(_0xcc01('0x9'));module[_0xcc01('0xa')]=function(_0x4f650e,_0x1d77cc){return _0x4f650e[_0xcc01('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01a3=['define','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x01a3,0x13a));var _0x301a=function(_0x510b13,_0x45f755){_0x510b13=_0x510b13-0x0;var _0x5b7a6e=_0x01a3[_0x510b13];return _0x5b7a6e;};'use strict';var _=require(_0x301a('0x0'));var util=require(_0x301a('0x1'));var logger=require(_0x301a('0x2'))(_0x301a('0x3'));var moment=require(_0x301a('0x4'));var BPromise=require(_0x301a('0x5'));var rp=require(_0x301a('0x6'));var fs=require('fs');var path=require(_0x301a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x301a('0x8'));module[_0x301a('0x9')]=function(_0x33c685,_0x506808){return _0x33c685[_0x301a('0xa')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x301a('0xb'),'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 208a740..a379f4f 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 _0xaeea=['client','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countnosuchnumberretry','countmachineretry','entity','waitTime','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x50c7d6,_0x43aaed){var _0x4e1b11=function(_0x247a15){while(--_0x247a15){_0x50c7d6['push'](_0x50c7d6['shift']());}};_0x4e1b11(++_0x43aaed);}(_0xaeea,0x1bf));var _0xaaee=function(_0x595c9c,_0x281699){_0x595c9c=_0x595c9c-0x0;var _0x58e095=_0xaeea[_0x595c9c];return _0x58e095;};'use strict';var _=require('lodash');var util=require(_0xaaee('0x0'));var moment=require(_0xaaee('0x1'));var BPromise=require(_0xaaee('0x2'));var rs=require(_0xaaee('0x3'));var fs=require('fs');var Redis=require(_0xaaee('0x4'));var db=require(_0xaaee('0x5'))['db'];var utils=require(_0xaaee('0x6'));var logger=require('../../config/logger')(_0xaaee('0x7'));var config=require('../../config/environment');var jayson=require(_0xaaee('0x8'));var client=jayson[_0xaaee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eceb5,_0x37c7e7,_0x4f85bb){return new BPromise(function(_0x362558,_0xf9a1c0){return client[_0xaaee('0xa')](_0x1eceb5,_0x4f85bb)[_0xaaee('0xb')](function(_0x360856){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x37c7e7,_0xaaee('0xc'));logger['debug'](_0xaaee('0xd'),_0x37c7e7,_0xaaee('0xc'),JSON[_0xaaee('0xe')](_0x360856));if(_0x360856['error']){if(_0x360856[_0xaaee('0xf')][_0xaaee('0x10')]===0x1f4){logger[_0xaaee('0xf')](_0xaaee('0x11'),_0x37c7e7,_0x360856[_0xaaee('0xf')][_0xaaee('0x12')]);return _0xf9a1c0(_0x360856[_0xaaee('0xf')]['message']);}logger[_0xaaee('0xf')](_0xaaee('0x11'),_0x37c7e7,_0x360856[_0xaaee('0xf')]['message']);return _0x362558(_0x360856[_0xaaee('0xf')][_0xaaee('0x12')]);}else{logger[_0xaaee('0x13')](_0xaaee('0x11'),_0x37c7e7,'request\x20sent');_0x362558(_0x360856[_0xaaee('0x14')]['message']);}})[_0xaaee('0x15')](function(_0x21a250){logger[_0xaaee('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x37c7e7,_0x21a250);_0xf9a1c0(_0x21a250);});});}exports[_0xaaee('0x16')]=function(_0x2e1f21){var _0x38761f=this;return new Promise(function(_0x39ac37,_0x943caa){return db[_0xaaee('0x17')][_0xaaee('0x18')]({'raw':!![],'where':{'ContactId':_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1a')],'ListId':_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1b')],'VoiceQueueId':_0x2e1f21['body'][_0xaaee('0x1c')]===undefined?null:_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1c')],'CampaignId':_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1d')]===undefined?null:_0x2e1f21[_0xaaee('0x19')]['CampaignId']}})[_0xaaee('0xb')](function(_0x5308cb){if(_0x5308cb!=null){return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x5308cb['id'],'OrderBy':{'$gt':_0x5308cb[_0xaaee('0x1f')]}},'order':[['OrderBy',_0xaaee('0x20')]]})[_0xaaee('0xb')](function(_0x111683){var _0x3151a9=0x0;if(_0x111683){if(_0x111683[_0xaaee('0x21')]+_0x111683[_0xaaee('0x22')]+_0x111683[_0xaaee('0x23')]+_0x111683['countnosuchnumberretry']+_0x111683[_0xaaee('0x24')]+_0x111683[_0xaaee('0x25')]+_0x111683['countmachineretry']+_0x111683[_0xaaee('0x26')]<_0x2e1f21['entity'][_0xaaee('0x27')])_0x3151a9=0x1;_0x39ac37({'additional':_0x3151a9});}else{return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x5308cb['id']},'order':[[_0xaaee('0x1f'),_0xaaee('0x20')]]})[_0xaaee('0xb')](function(_0x2ff78f){var _0x5ea1a6=0x0;if(_0x2ff78f){if(_0x2ff78f[_0xaaee('0x21')]+_0x2ff78f['countcongestionretry']+_0x2ff78f[_0xaaee('0x23')]+_0x2ff78f[_0xaaee('0x28')]+_0x2ff78f[_0xaaee('0x24')]+_0x2ff78f['countabandonedretry']+_0x2ff78f[_0xaaee('0x29')]+_0x2ff78f[_0xaaee('0x26')]<_0x2e1f21[_0xaaee('0x2a')]['dialGlobalMaxRetry'])_0x5ea1a6=0x1;_0x39ac37({'additional':_0x5ea1a6});}else{_0x39ac37({'additional':0x0});}})[_0xaaee('0x15')](function(_0x7c118b){logger['error'](_0xaaee('0x16'),_0x7c118b['message']);_0x943caa(_0x38761f[_0xaaee('0xf')](0x1f4,_0x7c118b[_0xaaee('0x12')]));});}})[_0xaaee('0x15')](function(_0x579dcb){logger['error']('VerifyAdditionalPhones',_0x579dcb[_0xaaee('0x12')]);_0x943caa(_0x38761f[_0xaaee('0xf')](0x1f4,_0x579dcb[_0xaaee('0x12')]));});}else _0x39ac37({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0xbc6d4e){var _0x20ef27=this;return new Promise(function(_0x29950a,_0x505c83){return db[_0xaaee('0x17')][_0xaaee('0x18')]({'raw':!![],'where':{'ContactId':_0xbc6d4e[_0xaaee('0x19')][_0xaaee('0x1a')],'ListId':_0xbc6d4e['body'][_0xaaee('0x1b')],'VoiceQueueId':_0xbc6d4e['body'][_0xaaee('0x1c')]===undefined?null:_0xbc6d4e[_0xaaee('0x19')][_0xaaee('0x1c')],'CampaignId':_0xbc6d4e[_0xaaee('0x19')][_0xaaee('0x1d')]===undefined?null:_0xbc6d4e[_0xaaee('0x19')]['CampaignId']}})[_0xaaee('0xb')](function(_0x22d73c){if(_0x22d73c!=null){return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x22d73c['id'],'OrderBy':{'$gte':_0x22d73c['OrderBy']}},'order':[[_0xaaee('0x1f'),_0xaaee('0x20')]]})[_0xaaee('0xb')](function(_0x1c1d1a){if(_0x1c1d1a)return activateAdditionalPhone(_0x22d73c,_0xbc6d4e[_0xaaee('0x19')],_0x1c1d1a,_0xbc6d4e['duration'],_0xbc6d4e[_0xaaee('0x2b')])[_0xaaee('0xb')](function(_0x1118f0){_0x29950a(_0x1118f0);});else{return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x22d73c['id']},'order':[[_0xaaee('0x1f'),_0xaaee('0x20')]]})['then'](function(_0x47e529){if(_0x47e529)return activateAdditionalPhone(_0x22d73c,_0xbc6d4e[_0xaaee('0x19')],_0x47e529,_0xbc6d4e[_0xaaee('0x2c')],_0xbc6d4e[_0xaaee('0x2b')])[_0xaaee('0xb')](function(_0x5abe39){_0x29950a(_0x5abe39);});else{_0x29950a({'id':_0x22d73c['id'],'phone':''});}})[_0xaaee('0x15')](function(_0x5b11f1){logger['error']('VerifyAdditionalPhones',_0x5b11f1[_0xaaee('0x12')]);_0x505c83(_0x20ef27[_0xaaee('0xf')](0x1f4,_0x5b11f1[_0xaaee('0x12')]));});}})[_0xaaee('0x15')](function(_0x49f0e7){logger[_0xaaee('0xf')](_0xaaee('0x16'),_0x49f0e7[_0xaaee('0x12')]);_0x505c83(_0x20ef27['error'](0x1f4,_0x49f0e7[_0xaaee('0x12')]));});}else _0x29950a(0x1);});});};function activateAdditionalPhone(_0xd37c20,_0x18505e,_0x6c88ce,_0x1865d2,_0x2cde19){return new Promise(function(_0x253d15,_0x57c62b){var _0x9beb08;if(_[_0xaaee('0x2d')](_0x6c88ce[_0xaaee('0x2e')])){_0x6c88ce[_0xaaee('0x2e')]=moment();}if(moment()>moment(_0x6c88ce[_0xaaee('0x2e')])){_0x9beb08=moment()[_0xaaee('0x2f')](_0x2cde19||0x3,_0xaaee('0x30'));}else{if(_0x6c88ce[_0xaaee('0x1f')]==0x0){_0x9beb08=moment(_0x6c88ce[_0xaaee('0x2e')]);}else{_0x9beb08=moment()[_0xaaee('0x2f')](_0x2cde19||0x3,_0xaaee('0x30'));}}if(_['isNil'](_0x9beb08)){_0x9beb08=moment()[_0xaaee('0x2f')](_0x2cde19||0x3,'minutes');}var _0x2cd5da={'phone':_0xd37c20[_0xaaee('0x31')],'active':0x0,'OrderBy':_[_0xaaee('0x2d')](_0xd37c20[_0xaaee('0x1f')])?0x0:_0xd37c20[_0xaaee('0x1f')],'scheduledat':moment()[_0xaaee('0x2f')](_0x1865d2||0x1,'minutes'),'countbusyretry':_0x18505e[_0xaaee('0x21')],'countcongestionretry':_0x18505e[_0xaaee('0x22')],'countnoanswerretry':_0x18505e['countnoanswerretry'],'countnosuchnumberretry':_0x18505e[_0xaaee('0x28')],'countdropretry':_0x18505e[_0xaaee('0x24')],'countabandonedretry':_0x18505e[_0xaaee('0x25')],'countmachineretry':_0x18505e['countmachineretry'],'countagentrejectretry':_0x18505e[_0xaaee('0x26')],'createdAt':_0x18505e[_0xaaee('0x32')],'updatedAt':_0x18505e['updatedAt']};var _0x10622e={'CmHopperId':_0xd37c20['id'],'phone':_0x6c88ce[_0xaaee('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x6c88ce[_0xaaee('0x1f')])?0x0:_0x6c88ce[_0xaaee('0x1f')],'scheduledat':_0x9beb08,'countbusyretry':_0x6c88ce[_0xaaee('0x21')],'countcongestionretry':_0x6c88ce['countcongestionretry'],'countnoanswerretry':_0x6c88ce[_0xaaee('0x23')],'countnosuchnumberretry':_0x6c88ce[_0xaaee('0x28')],'countdropretry':_0x6c88ce[_0xaaee('0x24')],'countabandonedretry':_0x6c88ce['countabandonedretry'],'countmachineretry':_0x6c88ce[_0xaaee('0x29')],'countagentrejectretry':_0x6c88ce['countagentrejectretry'],'createdAt':_0x6c88ce['createdAt'],'updatedAt':_0x6c88ce[_0xaaee('0x33')]};return db[_0xaaee('0x34')]['transaction'](function(_0x15afd4){return db['CmHopperAdditionalPhone']['update'](_0x2cd5da,{'where':{'id':_0x6c88ce['id']}},{'transaction':_0x15afd4})[_0xaaee('0xb')](function(){return db[_0xaaee('0x17')][_0xaaee('0x35')](_0x10622e,{'where':{'id':_0xd37c20['id']}},{'transaction':_0x15afd4});});})[_0xaaee('0xb')](function(_0xdf111a){_0x253d15({'id':_0xd37c20['id'],'phone':_0x6c88ce[_0xaaee('0x31')]});})['catch'](function(_0x3d9ccf){logger[_0xaaee('0xf')](_0xaaee('0x36'),_0x3d9ccf[_0xaaee('0x12')]);_0x57c62b({'error':_0x3d9ccf[_0xaaee('0x12')]});});});}exports[_0xaaee('0x37')]=function(_0x325d39){var _0x551046=this;return new Promise(function(_0x34c238,_0x3a9e8d){return db[_0xaaee('0x17')][_0xaaee('0x35')](_0x325d39[_0xaaee('0x19')][_0xaaee('0x38')],{'where':{'id':_0x325d39[_0xaaee('0x19')]['id']}})[_0xaaee('0xb')](function(_0x5cc3b3){_0x34c238(_0x5cc3b3);})[_0xaaee('0x15')](function(_0x3854dc){logger[_0xaaee('0xf')]('IncrementPreviewCounters',_0x3854dc['message']);_0x3a9e8d(_0x551046['error'](0x1f4,_0x3854dc[_0xaaee('0x12')]));});});}; \ No newline at end of file +var _0x43bf=['duration','VerifyAdditionalPhones','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countcongestionretry','countabandonedretry','SwapAdditionalPhones','ListId','OrderBy'];(function(_0x195094,_0x40e44f){var _0x5d5ef2=function(_0x40c470){while(--_0x40c470){_0x195094['push'](_0x195094['shift']());}};_0x5d5ef2(++_0x40e44f);}(_0x43bf,0x169));var _0xf43b=function(_0x657a68,_0x4ef12e){_0x657a68=_0x657a68-0x0;var _0x483b44=_0x43bf[_0x657a68];return _0x483b44;};'use strict';var _=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var moment=require('moment');var BPromise=require(_0xf43b('0x2'));var rs=require(_0xf43b('0x3'));var fs=require('fs');var Redis=require(_0xf43b('0x4'));var db=require(_0xf43b('0x5'))['db'];var utils=require(_0xf43b('0x6'));var logger=require(_0xf43b('0x7'))(_0xf43b('0x8'));var config=require(_0xf43b('0x9'));var jayson=require(_0xf43b('0xa'));var client=jayson[_0xf43b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57be22,_0x4c4bb5,_0x534b77){return new BPromise(function(_0x36bea1,_0x52d998){return client[_0xf43b('0xc')](_0x57be22,_0x534b77)['then'](function(_0x34379a){logger[_0xf43b('0xd')](_0xf43b('0xe'),_0x4c4bb5,_0xf43b('0xf'));logger[_0xf43b('0x10')](_0xf43b('0x11'),_0x4c4bb5,_0xf43b('0xf'),JSON[_0xf43b('0x12')](_0x34379a));if(_0x34379a['error']){if(_0x34379a[_0xf43b('0x13')][_0xf43b('0x14')]===0x1f4){logger['error'](_0xf43b('0xe'),_0x4c4bb5,_0x34379a['error'][_0xf43b('0x15')]);return _0x52d998(_0x34379a[_0xf43b('0x13')][_0xf43b('0x15')]);}logger[_0xf43b('0x13')](_0xf43b('0xe'),_0x4c4bb5,_0x34379a[_0xf43b('0x13')][_0xf43b('0x15')]);return _0x36bea1(_0x34379a[_0xf43b('0x13')][_0xf43b('0x15')]);}else{logger[_0xf43b('0xd')](_0xf43b('0xe'),_0x4c4bb5,_0xf43b('0xf'));_0x36bea1(_0x34379a[_0xf43b('0x16')]['message']);}})[_0xf43b('0x17')](function(_0x46013b){logger[_0xf43b('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4c4bb5,_0x46013b);_0x52d998(_0x46013b);});});}exports['VerifyAdditionalPhones']=function(_0x384fc8){var _0x27e9f=this;return new Promise(function(_0x51309b,_0x3b0c34){return db[_0xf43b('0x18')][_0xf43b('0x19')]({'raw':!![],'where':{'ContactId':_0x384fc8[_0xf43b('0x1a')][_0xf43b('0x1b')],'ListId':_0x384fc8[_0xf43b('0x1a')]['ListId'],'VoiceQueueId':_0x384fc8['body'][_0xf43b('0x1c')]===undefined?null:_0x384fc8[_0xf43b('0x1a')]['VoiceQueueId'],'CampaignId':_0x384fc8['body'][_0xf43b('0x1d')]===undefined?null:_0x384fc8[_0xf43b('0x1a')][_0xf43b('0x1d')]}})[_0xf43b('0x1e')](function(_0x1e7175){if(_0x1e7175!=null){return db[_0xf43b('0x1f')][_0xf43b('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1e7175['id'],'OrderBy':{'$gt':_0x1e7175['OrderBy']}},'order':[['OrderBy',_0xf43b('0x20')]]})[_0xf43b('0x1e')](function(_0x3603fa){var _0xdf1f49=0x0;if(_0x3603fa){if(_0x3603fa[_0xf43b('0x21')]+_0x3603fa['countcongestionretry']+_0x3603fa[_0xf43b('0x22')]+_0x3603fa[_0xf43b('0x23')]+_0x3603fa[_0xf43b('0x24')]+_0x3603fa['countabandonedretry']+_0x3603fa[_0xf43b('0x25')]+_0x3603fa[_0xf43b('0x26')]<_0x384fc8['entity'][_0xf43b('0x27')])_0xdf1f49=0x1;_0x51309b({'additional':_0xdf1f49});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1e7175['id']},'order':[['OrderBy',_0xf43b('0x20')]]})[_0xf43b('0x1e')](function(_0xca0c02){var _0x2f4de4=0x0;if(_0xca0c02){if(_0xca0c02[_0xf43b('0x21')]+_0xca0c02[_0xf43b('0x28')]+_0xca0c02[_0xf43b('0x22')]+_0xca0c02[_0xf43b('0x23')]+_0xca0c02[_0xf43b('0x24')]+_0xca0c02[_0xf43b('0x29')]+_0xca0c02['countmachineretry']+_0xca0c02[_0xf43b('0x26')]<_0x384fc8['entity'][_0xf43b('0x27')])_0x2f4de4=0x1;_0x51309b({'additional':_0x2f4de4});}else{_0x51309b({'additional':0x0});}})[_0xf43b('0x17')](function(_0x2476eb){logger[_0xf43b('0x13')]('VerifyAdditionalPhones',_0x2476eb[_0xf43b('0x15')]);_0x3b0c34(_0x27e9f[_0xf43b('0x13')](0x1f4,_0x2476eb[_0xf43b('0x15')]));});}})[_0xf43b('0x17')](function(_0x55d501){logger[_0xf43b('0x13')]('VerifyAdditionalPhones',_0x55d501[_0xf43b('0x15')]);_0x3b0c34(_0x27e9f[_0xf43b('0x13')](0x1f4,_0x55d501[_0xf43b('0x15')]));});}else _0x51309b({'additional':0x0});});});};exports[_0xf43b('0x2a')]=function(_0x27624a){var _0x496fee=this;return new Promise(function(_0x15ef04,_0x540466){return db[_0xf43b('0x18')][_0xf43b('0x19')]({'raw':!![],'where':{'ContactId':_0x27624a['body'][_0xf43b('0x1b')],'ListId':_0x27624a['body'][_0xf43b('0x2b')],'VoiceQueueId':_0x27624a[_0xf43b('0x1a')]['VoiceQueueId']===undefined?null:_0x27624a['body']['VoiceQueueId'],'CampaignId':_0x27624a[_0xf43b('0x1a')][_0xf43b('0x1d')]===undefined?null:_0x27624a[_0xf43b('0x1a')][_0xf43b('0x1d')]}})['then'](function(_0x19597d){if(_0x19597d!=null){return db[_0xf43b('0x1f')][_0xf43b('0x19')]({'raw':!![],'where':{'CmHopperId':_0x19597d['id'],'OrderBy':{'$gte':_0x19597d[_0xf43b('0x2c')]}},'order':[[_0xf43b('0x2c'),_0xf43b('0x20')]]})['then'](function(_0xc87c9b){if(_0xc87c9b)return activateAdditionalPhone(_0x19597d,_0x27624a[_0xf43b('0x1a')],_0xc87c9b,_0x27624a[_0xf43b('0x2d')],_0x27624a['waitTime'])[_0xf43b('0x1e')](function(_0x3a8700){_0x15ef04(_0x3a8700);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x19597d['id']},'order':[['OrderBy',_0xf43b('0x20')]]})[_0xf43b('0x1e')](function(_0x4bd6b0){if(_0x4bd6b0)return activateAdditionalPhone(_0x19597d,_0x27624a['body'],_0x4bd6b0,_0x27624a[_0xf43b('0x2d')],_0x27624a['waitTime'])[_0xf43b('0x1e')](function(_0x47185a){_0x15ef04(_0x47185a);});else{_0x15ef04({'id':_0x19597d['id'],'phone':''});}})[_0xf43b('0x17')](function(_0x38670c){logger[_0xf43b('0x13')](_0xf43b('0x2e'),_0x38670c[_0xf43b('0x15')]);_0x540466(_0x496fee['error'](0x1f4,_0x38670c[_0xf43b('0x15')]));});}})['catch'](function(_0x5f423){logger['error'](_0xf43b('0x2e'),_0x5f423[_0xf43b('0x15')]);_0x540466(_0x496fee[_0xf43b('0x13')](0x1f4,_0x5f423[_0xf43b('0x15')]));});}else _0x15ef04(0x1);});});};function activateAdditionalPhone(_0x1d0b8e,_0x52ef4f,_0x4ec82a,_0xd22d00,_0x4ffc73){return new Promise(function(_0x68a4e3,_0x19b829){var _0x4e8783;if(_['isNil'](_0x4ec82a[_0xf43b('0x2f')])){_0x4ec82a['scheduledat']=moment();}if(moment()>moment(_0x4ec82a[_0xf43b('0x2f')])){_0x4e8783=moment()[_0xf43b('0x30')](_0x4ffc73||0x3,_0xf43b('0x31'));}else{if(_0x4ec82a['OrderBy']==0x0){_0x4e8783=moment(_0x4ec82a[_0xf43b('0x2f')]);}else{_0x4e8783=moment()[_0xf43b('0x30')](_0x4ffc73||0x3,'minutes');}}if(_['isNil'](_0x4e8783)){_0x4e8783=moment()[_0xf43b('0x30')](_0x4ffc73||0x3,_0xf43b('0x31'));}var _0x256849={'phone':_0x1d0b8e[_0xf43b('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x1d0b8e[_0xf43b('0x2c')])?0x0:_0x1d0b8e[_0xf43b('0x2c')],'scheduledat':moment()[_0xf43b('0x30')](_0xd22d00||0x1,_0xf43b('0x31')),'countbusyretry':_0x52ef4f[_0xf43b('0x21')],'countcongestionretry':_0x52ef4f['countcongestionretry'],'countnoanswerretry':_0x52ef4f[_0xf43b('0x22')],'countnosuchnumberretry':_0x52ef4f['countnosuchnumberretry'],'countdropretry':_0x52ef4f['countdropretry'],'countabandonedretry':_0x52ef4f[_0xf43b('0x29')],'countmachineretry':_0x52ef4f[_0xf43b('0x25')],'countagentrejectretry':_0x52ef4f[_0xf43b('0x26')],'createdAt':_0x52ef4f['createdAt'],'updatedAt':_0x52ef4f['updatedAt']};var _0x5783fd={'CmHopperId':_0x1d0b8e['id'],'phone':_0x4ec82a[_0xf43b('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x4ec82a[_0xf43b('0x2c')])?0x0:_0x4ec82a[_0xf43b('0x2c')],'scheduledat':_0x4e8783,'countbusyretry':_0x4ec82a[_0xf43b('0x21')],'countcongestionretry':_0x4ec82a[_0xf43b('0x28')],'countnoanswerretry':_0x4ec82a[_0xf43b('0x22')],'countnosuchnumberretry':_0x4ec82a[_0xf43b('0x23')],'countdropretry':_0x4ec82a[_0xf43b('0x24')],'countabandonedretry':_0x4ec82a[_0xf43b('0x29')],'countmachineretry':_0x4ec82a[_0xf43b('0x25')],'countagentrejectretry':_0x4ec82a[_0xf43b('0x26')],'createdAt':_0x4ec82a[_0xf43b('0x33')],'updatedAt':_0x4ec82a[_0xf43b('0x34')]};return db['sequelize'][_0xf43b('0x35')](function(_0x13747a){return db[_0xf43b('0x1f')][_0xf43b('0x36')](_0x256849,{'where':{'id':_0x4ec82a['id']}},{'transaction':_0x13747a})[_0xf43b('0x1e')](function(){return db[_0xf43b('0x18')]['update'](_0x5783fd,{'where':{'id':_0x1d0b8e['id']}},{'transaction':_0x13747a});});})[_0xf43b('0x1e')](function(_0x412002){_0x68a4e3({'id':_0x1d0b8e['id'],'phone':_0x4ec82a[_0xf43b('0x32')]});})[_0xf43b('0x17')](function(_0x271d5f){logger['error'](_0xf43b('0x37'),_0x271d5f[_0xf43b('0x15')]);_0x19b829({'error':_0x271d5f['message']});});});}exports['IncrementPreviewCounters']=function(_0x828d05){var _0x149e5d=this;return new Promise(function(_0x33cada,_0x9eb63a){return db[_0xf43b('0x18')][_0xf43b('0x36')](_0x828d05[_0xf43b('0x1a')][_0xf43b('0x38')],{'where':{'id':_0x828d05[_0xf43b('0x1a')]['id']}})[_0xf43b('0x1e')](function(_0x26df1c){_0x33cada(_0x26df1c);})['catch'](function(_0x570515){logger[_0xf43b('0x13')](_0xf43b('0x39'),_0x570515[_0xf43b('0x15')]);_0x9eb63a(_0x149e5d[_0xf43b('0x13')](0x1f4,_0x570515[_0xf43b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index c5a0df3..a85e183 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 _0x3cac=['../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3e2df7,_0x117d02){var _0x2b9d39=function(_0x550a16){while(--_0x550a16){_0x3e2df7['push'](_0x3e2df7['shift']());}};_0x2b9d39(++_0x117d02);}(_0x3cac,0x176));var _0xc3ca=function(_0xf3b7fe,_0x21c801){_0xf3b7fe=_0xf3b7fe-0x0;var _0x7a96ad=_0x3cac[_0xf3b7fe];return _0x7a96ad;};'use strict';var multer=require(_0xc3ca('0x0'));var util=require(_0xc3ca('0x1'));var path=require('path');var timeout=require(_0xc3ca('0x2'));var express=require(_0xc3ca('0x3'));var router=express[_0xc3ca('0x4')]();var fs_extra=require(_0xc3ca('0x5'));var auth=require(_0xc3ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc3ca('0x7'));var controller=require(_0xc3ca('0x8'));router['get']('/',auth[_0xc3ca('0x9')](),controller[_0xc3ca('0xa')]);router[_0xc3ca('0xb')](_0xc3ca('0xc'),auth[_0xc3ca('0x9')](),controller[_0xc3ca('0xd')]);router[_0xc3ca('0xe')]('/',auth[_0xc3ca('0x9')](),controller['create']);router[_0xc3ca('0xf')](_0xc3ca('0xc'),auth[_0xc3ca('0x9')](),controller[_0xc3ca('0x10')]);router[_0xc3ca('0x11')](_0xc3ca('0xc'),auth['isAuthenticated'](),controller[_0xc3ca('0x12')]);module['exports']=router; \ No newline at end of file +var _0x71f4=['Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x5c7a79,_0x2433bb){var _0xd9ea52=function(_0x1bdd59){while(--_0x1bdd59){_0x5c7a79['push'](_0x5c7a79['shift']());}};_0xd9ea52(++_0x2433bb);}(_0x71f4,0xf9));var _0x471f=function(_0x521d9c,_0x58828e){_0x521d9c=_0x521d9c-0x0;var _0x375908=_0x71f4[_0x521d9c];return _0x375908;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x471f('0x0'));var timeout=require(_0x471f('0x1'));var express=require(_0x471f('0x2'));var router=express[_0x471f('0x3')]();var fs_extra=require(_0x471f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x471f('0x5'));var config=require('../../config/environment');var controller=require(_0x471f('0x6'));router['get']('/',auth[_0x471f('0x7')](),controller[_0x471f('0x8')]);router[_0x471f('0x9')](_0x471f('0xa'),auth[_0x471f('0x7')](),controller[_0x471f('0xb')]);router[_0x471f('0xc')]('/',auth[_0x471f('0x7')](),controller[_0x471f('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x471f('0xe')]);router[_0x471f('0xf')]('/:id',auth[_0x471f('0x7')](),controller[_0x471f('0x10')]);module[_0x471f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 9037927..db84d7c 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 _0x2b34=['contactListQueue','INTEGER','moment','sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b34,0x165));var _0x42b3=function(_0x15ddc9,_0x209223){_0x15ddc9=_0x15ddc9-0x0;var _0x2fc9e8=_0x2b34[_0x15ddc9];return _0x2fc9e8;};'use strict';var moment=require(_0x42b3('0x0'));var Sequelize=require(_0x42b3('0x1'));module['exports']={'phone':{'type':Sequelize[_0x42b3('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x42b3('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x42b3('0x3')},'VoiceQueueId':{'type':Sequelize[_0x42b3('0x4')],'unique':_0x42b3('0x3')}}; \ No newline at end of file +var _0xe0ae=['INTEGER','exports','STRING','contactListQueue'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0xe0ae[_0x1559a5];return _0x17a783;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xee0a('0x0')]={'phone':{'type':Sequelize[_0xee0a('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xee0a('0x2')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xee0a('0x2')},'VoiceQueueId':{'type':Sequelize[_0xee0a('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 3480043..2a57971 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 _0x4d1f=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperBlack','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','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','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','send','map','rawAttributes','fieldName','key','name'];(function(_0x319152,_0x21851a){var _0x4beaa1=function(_0x301550){while(--_0x301550){_0x319152['push'](_0x319152['shift']());}};_0x4beaa1(++_0x21851a);}(_0x4d1f,0x141));var _0xf4d1=function(_0x488914,_0x4732e3){_0x488914=_0x488914-0x0;var _0xd1402=_0x4d1f[_0x488914];return _0xd1402;};'use strict';var emlformat=require(_0xf4d1('0x0'));var rimraf=require(_0xf4d1('0x1'));var zipdir=require(_0xf4d1('0x2'));var jsonpatch=require(_0xf4d1('0x3'));var rp=require(_0xf4d1('0x4'));var moment=require(_0xf4d1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf4d1('0x6'));var path=require('path');var sox=require(_0xf4d1('0x7'));var csv=require('to-csv');var ejs=require(_0xf4d1('0x8'));var fs=require('fs');var fs_extra=require(_0xf4d1('0x9'));var _=require(_0xf4d1('0xa'));var squel=require(_0xf4d1('0xb'));var crypto=require(_0xf4d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4d1('0xd'));var Redis=require(_0xf4d1('0xe'));var authService=require(_0xf4d1('0xf'));var qs=require(_0xf4d1('0x10'));var as=require(_0xf4d1('0x11'));var hardwareService=require(_0xf4d1('0x12'));var logger=require(_0xf4d1('0x13'))('api');var utils=require(_0xf4d1('0x14'));var config=require(_0xf4d1('0x15'));var licenseUtil=require(_0xf4d1('0x16'));var db=require(_0xf4d1('0x17'))['db'];function respondWithStatusCode(_0x4b3c0f,_0x23eed8){_0x23eed8=_0x23eed8||0xcc;return function(_0x572d11){if(_0x572d11){return _0x4b3c0f[_0xf4d1('0x18')](_0x23eed8);}return _0x4b3c0f[_0xf4d1('0x19')](_0x23eed8)[_0xf4d1('0x1a')]();};}function respondWithResult(_0x239a80,_0x4cce73){_0x4cce73=_0x4cce73||0xc8;return function(_0x5736b3){if(_0x5736b3){return _0x239a80[_0xf4d1('0x19')](_0x4cce73)[_0xf4d1('0x1b')](_0x5736b3);}};}function respondWithFilteredResult(_0x1f07a7,_0x293f17){return function(_0x111815){if(_0x111815){var _0x4dc791=typeof _0x293f17[_0xf4d1('0x1c')]===_0xf4d1('0x1d')&&typeof _0x293f17[_0xf4d1('0x1e')]==='undefined';var _0x70ffdc=_0x111815[_0xf4d1('0x1f')];var _0x4cfeb5=_0x4dc791?0x0:_0x293f17[_0xf4d1('0x1c')];var _0x23b36e=_0x4dc791?_0x111815['count']:_0x293f17[_0xf4d1('0x1c')]+_0x293f17[_0xf4d1('0x1e')];var _0xfd3e27;if(_0x23b36e>=_0x70ffdc){_0x23b36e=_0x70ffdc;_0xfd3e27=0xc8;}else{_0xfd3e27=0xce;}_0x1f07a7[_0xf4d1('0x19')](_0xfd3e27);return _0x1f07a7['set']('Content-Range',_0x4cfeb5+'-'+_0x23b36e+'/'+_0x70ffdc)[_0xf4d1('0x1b')](_0x111815);}return null;};}function patchUpdates(_0x1c6499){return function(_0x2c5e9f){try{jsonpatch[_0xf4d1('0x20')](_0x2c5e9f,_0x1c6499,!![]);}catch(_0x4cae24){return BPromise[_0xf4d1('0x21')](_0x4cae24);}return _0x2c5e9f[_0xf4d1('0x22')]();};}function saveUpdates(_0x2de8f6,_0x452aa2){return function(_0x48fab7){if(_0x48fab7){return _0x48fab7[_0xf4d1('0x23')](_0x2de8f6)[_0xf4d1('0x24')](function(_0x41ecae){return _0x41ecae;});}return null;};}function removeEntity(_0x103000,_0x5ae0cf){return function(_0x205243){if(_0x205243){return _0x205243[_0xf4d1('0x25')]()['then'](function(){_0x103000[_0xf4d1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e25f6,_0x3d316d){return function(_0x52f4a5){if(!_0x52f4a5){_0x2e25f6[_0xf4d1('0x18')](0x194);}return _0x52f4a5;};}function handleError(_0x49d323,_0x1ac6e1){_0x1ac6e1=_0x1ac6e1||0x1f4;return function(_0x43d80e){logger['error'](_0x43d80e['stack']);if(_0x43d80e['name']){delete _0x43d80e['name'];}_0x49d323[_0xf4d1('0x19')](_0x1ac6e1)[_0xf4d1('0x26')](_0x43d80e);};}exports['index']=function(_0x505a10,_0xd7f553){var _0x4718a3={},_0x42dcef={},_0x4bebad={'count':0x0,'rows':[]};var _0x17da0c=_[_0xf4d1('0x27')](db['CmHopperBlack'][_0xf4d1('0x28')],function(_0x4fee5a){return{'name':_0x4fee5a[_0xf4d1('0x29')],'type':_0x4fee5a['type'][_0xf4d1('0x2a')]};});_0x42dcef['model']=_['map'](_0x17da0c,_0xf4d1('0x2b'));_0x42dcef[_0xf4d1('0x2c')]=_['keys'](_0x505a10[_0xf4d1('0x2c')]);_0x42dcef[_0xf4d1('0x2d')]=_[_0xf4d1('0x2e')](_0x42dcef[_0xf4d1('0x2f')],_0x42dcef['query']);_0x4718a3[_0xf4d1('0x30')]=_['intersection'](_0x42dcef[_0xf4d1('0x2f')],qs[_0xf4d1('0x31')](_0x505a10[_0xf4d1('0x2c')]['fields']));_0x4718a3[_0xf4d1('0x30')]=_0x4718a3['attributes'][_0xf4d1('0x32')]?_0x4718a3[_0xf4d1('0x30')]:_0x42dcef[_0xf4d1('0x2f')];if(!_0x505a10['query'][_0xf4d1('0x33')](_0xf4d1('0x34'))){_0x4718a3['limit']=qs[_0xf4d1('0x1e')](_0x505a10['query'][_0xf4d1('0x1e')]);_0x4718a3[_0xf4d1('0x1c')]=qs[_0xf4d1('0x1c')](_0x505a10[_0xf4d1('0x2c')][_0xf4d1('0x1c')]);}_0x4718a3[_0xf4d1('0x35')]=qs[_0xf4d1('0x36')](_0x505a10[_0xf4d1('0x2c')]['sort']);_0x4718a3[_0xf4d1('0x37')]=qs[_0xf4d1('0x2d')](_[_0xf4d1('0x38')](_0x505a10[_0xf4d1('0x2c')],_0x42dcef[_0xf4d1('0x2d')]),_0x17da0c);if(_0x505a10[_0xf4d1('0x2c')][_0xf4d1('0x39')]){_0x4718a3[_0xf4d1('0x37')]=_[_0xf4d1('0x3a')](_0x4718a3[_0xf4d1('0x37')],{'$or':_[_0xf4d1('0x27')](_0x17da0c,function(_0xb5b489){if(_0xb5b489[_0xf4d1('0x3b')]!==_0xf4d1('0x3c')){var _0x3b2246={};_0x3b2246[_0xb5b489[_0xf4d1('0x2b')]]={'$like':'%'+_0x505a10[_0xf4d1('0x2c')][_0xf4d1('0x39')]+'%'};return _0x3b2246;}})});}_0x4718a3=_[_0xf4d1('0x3a')]({},_0x4718a3,_0x505a10[_0xf4d1('0x3d')]);var _0xabbc41={'where':_0x4718a3['where']};return db[_0xf4d1('0x3e')][_0xf4d1('0x1f')](_0xabbc41)[_0xf4d1('0x24')](function(_0x1d2cf8){_0x4bebad[_0xf4d1('0x1f')]=_0x1d2cf8;if(_0x505a10[_0xf4d1('0x2c')]['includeAll']){_0x4718a3[_0xf4d1('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4718a3);})['then'](function(_0x4b876c){_0x4bebad[_0xf4d1('0x40')]=_0x4b876c;return _0x4bebad;})[_0xf4d1('0x24')](respondWithFilteredResult(_0xd7f553,_0x4718a3))[_0xf4d1('0x41')](handleError(_0xd7f553,null));};exports[_0xf4d1('0x42')]=function(_0x480db1,_0x5281de){var _0x52c271={'raw':!![],'where':{'id':_0x480db1[_0xf4d1('0x43')]['id']}},_0x47b2e3={};_0x47b2e3[_0xf4d1('0x2f')]=_[_0xf4d1('0x44')](db[_0xf4d1('0x3e')][_0xf4d1('0x28')]);_0x47b2e3[_0xf4d1('0x2c')]=_['keys'](_0x480db1[_0xf4d1('0x2c')]);_0x47b2e3['filters']=_['intersection'](_0x47b2e3[_0xf4d1('0x2f')],_0x47b2e3['query']);_0x52c271[_0xf4d1('0x30')]=_[_0xf4d1('0x2e')](_0x47b2e3[_0xf4d1('0x2f')],qs['fields'](_0x480db1[_0xf4d1('0x2c')][_0xf4d1('0x31')]));_0x52c271['attributes']=_0x52c271[_0xf4d1('0x30')][_0xf4d1('0x32')]?_0x52c271['attributes']:_0x47b2e3[_0xf4d1('0x2f')];if(_0x480db1[_0xf4d1('0x2c')][_0xf4d1('0x45')]){_0x52c271[_0xf4d1('0x3f')]=[{'all':!![]}];}_0x52c271=_[_0xf4d1('0x3a')]({},_0x52c271,_0x480db1['options']);return db[_0xf4d1('0x3e')][_0xf4d1('0x46')](_0x52c271)[_0xf4d1('0x24')](handleEntityNotFound(_0x5281de,null))[_0xf4d1('0x24')](respondWithResult(_0x5281de,null))[_0xf4d1('0x41')](handleError(_0x5281de,null));};exports[_0xf4d1('0x23')]=function(_0x3bde58,_0x3e93bc){if(_0x3bde58[_0xf4d1('0x47')]['id']){delete _0x3bde58[_0xf4d1('0x47')]['id'];}return db['CmHopperBlack'][_0xf4d1('0x46')]({'where':{'id':_0x3bde58['params']['id']}})[_0xf4d1('0x24')](handleEntityNotFound(_0x3e93bc,null))[_0xf4d1('0x24')](saveUpdates(_0x3bde58['body'],null))['then'](respondWithResult(_0x3e93bc,null))['catch'](handleError(_0x3e93bc,null));};exports[_0xf4d1('0x25')]=function(_0x334f24,_0x428868){return db[_0xf4d1('0x3e')][_0xf4d1('0x46')]({'where':{'id':_0x334f24['params']['id']}})[_0xf4d1('0x24')](handleEntityNotFound(_0x428868,null))[_0xf4d1('0x24')](removeEntity(_0x428868,null))[_0xf4d1('0x41')](handleError(_0x428868,null));};exports[_0xf4d1('0x48')]=function(_0x2691b,_0x2b7504){return db['CmHopperBlack'][_0xf4d1('0x48')]()[_0xf4d1('0x24')](respondWithResult(_0x2b7504,null))[_0xf4d1('0x41')](handleError(_0x2b7504,null));}; \ No newline at end of file +var _0x86a8=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','find','catch','body','params','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','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName'];(function(_0x1f1cfd,_0x1191ec){var _0x27dcdf=function(_0x3ed66a){while(--_0x3ed66a){_0x1f1cfd['push'](_0x1f1cfd['shift']());}};_0x27dcdf(++_0x1191ec);}(_0x86a8,0xc0));var _0x886a=function(_0x164a19,_0xb7ec6d){_0x164a19=_0x164a19-0x0;var _0x5d1305=_0x86a8[_0x164a19];return _0x5d1305;};'use strict';var emlformat=require(_0x886a('0x0'));var rimraf=require(_0x886a('0x1'));var zipdir=require(_0x886a('0x2'));var jsonpatch=require(_0x886a('0x3'));var rp=require(_0x886a('0x4'));var moment=require(_0x886a('0x5'));var BPromise=require(_0x886a('0x6'));var Mustache=require(_0x886a('0x7'));var util=require(_0x886a('0x8'));var path=require(_0x886a('0x9'));var sox=require(_0x886a('0xa'));var csv=require(_0x886a('0xb'));var ejs=require(_0x886a('0xc'));var fs=require('fs');var fs_extra=require(_0x886a('0xd'));var _=require(_0x886a('0xe'));var squel=require(_0x886a('0xf'));var crypto=require(_0x886a('0x10'));var jsforce=require(_0x886a('0x11'));var deskjs=require(_0x886a('0x12'));var toCsv=require(_0x886a('0xb'));var querystring=require(_0x886a('0x13'));var Papa=require(_0x886a('0x14'));var Redis=require(_0x886a('0x15'));var authService=require(_0x886a('0x16'));var qs=require(_0x886a('0x17'));var as=require(_0x886a('0x18'));var hardwareService=require(_0x886a('0x19'));var logger=require('../../config/logger')('api');var utils=require(_0x886a('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x886a('0x1b'));var db=require(_0x886a('0x1c'))['db'];function respondWithStatusCode(_0x58e64c,_0x3d490f){_0x3d490f=_0x3d490f||0xcc;return function(_0x4d1628){if(_0x4d1628){return _0x58e64c[_0x886a('0x1d')](_0x3d490f);}return _0x58e64c[_0x886a('0x1e')](_0x3d490f)[_0x886a('0x1f')]();};}function respondWithResult(_0x5e8838,_0x476823){_0x476823=_0x476823||0xc8;return function(_0x20b577){if(_0x20b577){return _0x5e8838[_0x886a('0x1e')](_0x476823)[_0x886a('0x20')](_0x20b577);}};}function respondWithFilteredResult(_0x104ca5,_0x587343){return function(_0x42bd52){if(_0x42bd52){var _0x3b4827=typeof _0x587343[_0x886a('0x21')]===_0x886a('0x22')&&typeof _0x587343[_0x886a('0x23')]==='undefined';var _0x159139=_0x42bd52[_0x886a('0x24')];var _0x548fd8=_0x3b4827?0x0:_0x587343[_0x886a('0x21')];var _0x26e757=_0x3b4827?_0x42bd52[_0x886a('0x24')]:_0x587343[_0x886a('0x21')]+_0x587343[_0x886a('0x23')];var _0x2d6974;if(_0x26e757>=_0x159139){_0x26e757=_0x159139;_0x2d6974=0xc8;}else{_0x2d6974=0xce;}_0x104ca5[_0x886a('0x1e')](_0x2d6974);return _0x104ca5[_0x886a('0x25')](_0x886a('0x26'),_0x548fd8+'-'+_0x26e757+'/'+_0x159139)[_0x886a('0x20')](_0x42bd52);}return null;};}function patchUpdates(_0x5188b0){return function(_0x43e24f){try{jsonpatch[_0x886a('0x27')](_0x43e24f,_0x5188b0,!![]);}catch(_0x5bc662){return BPromise[_0x886a('0x28')](_0x5bc662);}return _0x43e24f[_0x886a('0x29')]();};}function saveUpdates(_0x60017d,_0x44ce57){return function(_0x393c55){if(_0x393c55){return _0x393c55[_0x886a('0x2a')](_0x60017d)[_0x886a('0x2b')](function(_0x53d063){return _0x53d063;});}return null;};}function removeEntity(_0xb6b3b,_0x50de3c){return function(_0x4065fe){if(_0x4065fe){return _0x4065fe['destroy']()[_0x886a('0x2b')](function(){_0xb6b3b[_0x886a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1116a,_0x362f9e){return function(_0x501f79){if(!_0x501f79){_0xd1116a['sendStatus'](0x194);}return _0x501f79;};}function handleError(_0x36f74d,_0x43d4da){_0x43d4da=_0x43d4da||0x1f4;return function(_0x1b659a){logger[_0x886a('0x2c')](_0x1b659a['stack']);if(_0x1b659a[_0x886a('0x2d')]){delete _0x1b659a['name'];}_0x36f74d['status'](_0x43d4da)[_0x886a('0x2e')](_0x1b659a);};}exports[_0x886a('0x2f')]=function(_0x387608,_0x2e2381){var _0x310d52={},_0x4d89a9={},_0x4f55fb={'count':0x0,'rows':[]};var _0x2929f4=_[_0x886a('0x30')](db['CmHopperBlack'][_0x886a('0x31')],function(_0x15137c){return{'name':_0x15137c[_0x886a('0x32')],'type':_0x15137c[_0x886a('0x33')][_0x886a('0x34')]};});_0x4d89a9[_0x886a('0x35')]=_['map'](_0x2929f4,'name');_0x4d89a9[_0x886a('0x36')]=_[_0x886a('0x37')](_0x387608[_0x886a('0x36')]);_0x4d89a9[_0x886a('0x38')]=_[_0x886a('0x39')](_0x4d89a9[_0x886a('0x35')],_0x4d89a9[_0x886a('0x36')]);_0x310d52[_0x886a('0x3a')]=_['intersection'](_0x4d89a9['model'],qs['fields'](_0x387608['query'][_0x886a('0x3b')]));_0x310d52['attributes']=_0x310d52[_0x886a('0x3a')][_0x886a('0x3c')]?_0x310d52[_0x886a('0x3a')]:_0x4d89a9['model'];if(!_0x387608['query'][_0x886a('0x3d')](_0x886a('0x3e'))){_0x310d52['limit']=qs[_0x886a('0x23')](_0x387608['query'][_0x886a('0x23')]);_0x310d52[_0x886a('0x21')]=qs[_0x886a('0x21')](_0x387608['query'][_0x886a('0x21')]);}_0x310d52['order']=qs[_0x886a('0x3f')](_0x387608['query'][_0x886a('0x3f')]);_0x310d52[_0x886a('0x40')]=qs[_0x886a('0x38')](_[_0x886a('0x41')](_0x387608[_0x886a('0x36')],_0x4d89a9[_0x886a('0x38')]),_0x2929f4);if(_0x387608[_0x886a('0x36')][_0x886a('0x42')]){_0x310d52[_0x886a('0x40')]=_[_0x886a('0x43')](_0x310d52[_0x886a('0x40')],{'$or':_[_0x886a('0x30')](_0x2929f4,function(_0x331999){if(_0x331999['type']!==_0x886a('0x44')){var _0x31eae2={};_0x31eae2[_0x331999['name']]={'$like':'%'+_0x387608[_0x886a('0x36')][_0x886a('0x42')]+'%'};return _0x31eae2;}})});}_0x310d52=_[_0x886a('0x43')]({},_0x310d52,_0x387608[_0x886a('0x45')]);var _0x16bd05={'where':_0x310d52['where']};return db[_0x886a('0x46')][_0x886a('0x24')](_0x16bd05)['then'](function(_0x59e4e8){_0x4f55fb['count']=_0x59e4e8;if(_0x387608[_0x886a('0x36')][_0x886a('0x47')]){_0x310d52[_0x886a('0x48')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x886a('0x49')](_0x310d52);})['then'](function(_0x58f21b){_0x4f55fb[_0x886a('0x4a')]=_0x58f21b;return _0x4f55fb;})[_0x886a('0x2b')](respondWithFilteredResult(_0x2e2381,_0x310d52))['catch'](handleError(_0x2e2381,null));};exports['show']=function(_0x3867e4,_0x219a94){var _0x3647fe={'raw':!![],'where':{'id':_0x3867e4['params']['id']}},_0x180357={};_0x180357[_0x886a('0x35')]=_['keys'](db[_0x886a('0x46')][_0x886a('0x31')]);_0x180357['query']=_[_0x886a('0x37')](_0x3867e4[_0x886a('0x36')]);_0x180357[_0x886a('0x38')]=_['intersection'](_0x180357[_0x886a('0x35')],_0x180357[_0x886a('0x36')]);_0x3647fe[_0x886a('0x3a')]=_[_0x886a('0x39')](_0x180357[_0x886a('0x35')],qs['fields'](_0x3867e4[_0x886a('0x36')][_0x886a('0x3b')]));_0x3647fe[_0x886a('0x3a')]=_0x3647fe[_0x886a('0x3a')]['length']?_0x3647fe[_0x886a('0x3a')]:_0x180357['model'];if(_0x3867e4[_0x886a('0x36')][_0x886a('0x47')]){_0x3647fe[_0x886a('0x48')]=[{'all':!![]}];}_0x3647fe=_['merge']({},_0x3647fe,_0x3867e4['options']);return db['CmHopperBlack'][_0x886a('0x4b')](_0x3647fe)[_0x886a('0x2b')](handleEntityNotFound(_0x219a94,null))[_0x886a('0x2b')](respondWithResult(_0x219a94,null))[_0x886a('0x4c')](handleError(_0x219a94,null));};exports[_0x886a('0x2a')]=function(_0x2a851a,_0x43b81b){if(_0x2a851a[_0x886a('0x4d')]['id']){delete _0x2a851a['body']['id'];}return db[_0x886a('0x46')][_0x886a('0x4b')]({'where':{'id':_0x2a851a[_0x886a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x43b81b,null))[_0x886a('0x2b')](saveUpdates(_0x2a851a['body'],null))[_0x886a('0x2b')](respondWithResult(_0x43b81b,null))[_0x886a('0x4c')](handleError(_0x43b81b,null));};exports[_0x886a('0x4f')]=function(_0x17c9fb,_0x17830f){return db[_0x886a('0x46')][_0x886a('0x4b')]({'where':{'id':_0x17c9fb['params']['id']}})['then'](handleEntityNotFound(_0x17830f,null))[_0x886a('0x2b')](removeEntity(_0x17830f,null))[_0x886a('0x4c')](handleError(_0x17830f,null));};exports['describe']=function(_0x5a1e6f,_0x40e341){return db[_0x886a('0x46')][_0x886a('0x50')]()['then'](respondWithResult(_0x40e341,null))[_0x886a('0x4c')](handleError(_0x40e341,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f43afa4..59ea1e8 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 _0xf4b0=['cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopperBlack'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4b0,0x177));var _0x0f4b=function(_0x3a3ba3,_0x25d3fb){_0x3a3ba3=_0x3a3ba3-0x0;var _0x283e50=_0xf4b0[_0x3a3ba3];return _0x283e50;};'use strict';var _=require(_0x0f4b('0x0'));var util=require(_0x0f4b('0x1'));var logger=require(_0x0f4b('0x2'))('api');var moment=require(_0x0f4b('0x3'));var BPromise=require(_0x0f4b('0x4'));var rp=require(_0x0f4b('0x5'));var fs=require('fs');var path=require(_0x0f4b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x0f4b('0x7')]=function(_0x2b015d,_0x49f3de){return _0x2b015d[_0x0f4b('0x8')](_0x0f4b('0x9'),attributes,{'tableName':_0x0f4b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc25e=['define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0xc25e,0xed));var _0xec25=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc25e[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xec25('0x0'));var util=require('util');var logger=require(_0xec25('0x1'))(_0xec25('0x2'));var moment=require(_0xec25('0x3'));var BPromise=require(_0xec25('0x4'));var rp=require(_0xec25('0x5'));var fs=require('fs');var path=require(_0xec25('0x6'));var rimraf=require(_0xec25('0x7'));var config=require(_0xec25('0x8'));var attributes=require(_0xec25('0x9'));module['exports']=function(_0x38483e,_0x3cb02e){return _0x38483e[_0xec25('0xa')](_0xec25('0xb'),attributes,{'tableName':_0xec25('0xc'),'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 9ec07d9..831b4c9 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 _0xbe67=['../../config/environment','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2a2fdb,_0x5b5d57){var _0x34fbbf=function(_0x414ba3){while(--_0x414ba3){_0x2a2fdb['push'](_0x2a2fdb['shift']());}};_0x34fbbf(++_0x5b5d57);}(_0xbe67,0x120));var _0x7be6=function(_0x181f22,_0x2a983d){_0x181f22=_0x181f22-0x0;var _0x5ea458=_0xbe67[_0x181f22];return _0x5ea458;};'use strict';var _=require(_0x7be6('0x0'));var util=require(_0x7be6('0x1'));var moment=require(_0x7be6('0x2'));var BPromise=require(_0x7be6('0x3'));var rs=require(_0x7be6('0x4'));var fs=require('fs');var Redis=require(_0x7be6('0x5'));var db=require(_0x7be6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7be6('0x7'))('rpc');var config=require(_0x7be6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7be6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c97a7,_0x21d32b,_0xb7b664){return new BPromise(function(_0x324783,_0x5a7f03){return client[_0x7be6('0xa')](_0x6c97a7,_0xb7b664)[_0x7be6('0xb')](function(_0x1df368){logger[_0x7be6('0xc')](_0x7be6('0xd'),_0x21d32b,'request\x20sent');logger[_0x7be6('0xe')](_0x7be6('0xf'),_0x21d32b,'request\x20sent',JSON['stringify'](_0x1df368));if(_0x1df368[_0x7be6('0x10')]){if(_0x1df368['error'][_0x7be6('0x11')]===0x1f4){logger[_0x7be6('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x21d32b,_0x1df368[_0x7be6('0x10')][_0x7be6('0x12')]);return _0x5a7f03(_0x1df368[_0x7be6('0x10')][_0x7be6('0x12')]);}logger[_0x7be6('0x10')](_0x7be6('0xd'),_0x21d32b,_0x1df368['error'][_0x7be6('0x12')]);return _0x324783(_0x1df368['error'][_0x7be6('0x12')]);}else{logger[_0x7be6('0xc')](_0x7be6('0xd'),_0x21d32b,'request\x20sent');_0x324783(_0x1df368[_0x7be6('0x13')][_0x7be6('0x12')]);}})[_0x7be6('0x14')](function(_0x2d86f7){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x21d32b,_0x2d86f7);_0x5a7f03(_0x2d86f7);});});}exports[_0x7be6('0x15')]=function(_0xbe554d){var _0x51b73c=this;return new Promise(function(_0x1fa4e0,_0x316336){return db[_0x7be6('0x16')][_0x7be6('0x17')]({'raw':_0xbe554d['options']?_0xbe554d[_0x7be6('0x18')][_0x7be6('0x19')]===undefined?!![]:![]:!![],'where':_0xbe554d[_0x7be6('0x18')]?_0xbe554d['options'][_0x7be6('0x1a')]||null:null,'attributes':_0xbe554d[_0x7be6('0x18')]?_0xbe554d['options'][_0x7be6('0x1b')]||null:null,'limit':_0xbe554d[_0x7be6('0x18')]?_0xbe554d[_0x7be6('0x18')][_0x7be6('0x1c')]||null:null,'include':_0xbe554d[_0x7be6('0x18')]?_0xbe554d[_0x7be6('0x18')][_0x7be6('0x1d')]?_[_0x7be6('0x1e')](_0xbe554d[_0x7be6('0x18')][_0x7be6('0x1d')],function(_0x4da074){return{'model':db[_0x4da074['model']],'as':_0x4da074['as'],'attributes':_0x4da074['attributes'],'include':_0x4da074[_0x7be6('0x1d')]?_[_0x7be6('0x1e')](_0x4da074[_0x7be6('0x1d')],function(_0x3d1598){return{'model':db[_0x3d1598[_0x7be6('0x1f')]],'as':_0x3d1598['as'],'attributes':_0x3d1598[_0x7be6('0x1b')],'include':_0x3d1598[_0x7be6('0x1d')]?_[_0x7be6('0x1e')](_0x3d1598[_0x7be6('0x1d')],function(_0x5b102e){return{'model':db[_0x5b102e[_0x7be6('0x1f')]],'as':_0x5b102e['as'],'attributes':_0x5b102e[_0x7be6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7be6('0xb')](function(_0x2e6a26){logger[_0x7be6('0xc')](_0x7be6('0x15'),_0xbe554d);logger['debug'](_0x7be6('0x15'),_0xbe554d,JSON[_0x7be6('0x20')](_0x2e6a26));_0x1fa4e0(_0x2e6a26);})[_0x7be6('0x14')](function(_0x115a0d){logger[_0x7be6('0x10')]('GetCmHopperBlack',_0x115a0d['message'],_0xbe554d);_0x316336(_0x51b73c[_0x7be6('0x10')](0x1f4,_0x115a0d[_0x7be6('0x12')]));});});};exports[_0x7be6('0x21')]=function(_0x5eae6e){var _0x37f2ed=this;return new Promise(function(_0x218aa6,_0x3378db){return db['CmHopperBlack'][_0x7be6('0x22')](_0x5eae6e['body'],{'raw':_0x5eae6e['options']?_0x5eae6e['options'][_0x7be6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eae6e['options']?_0x5eae6e[_0x7be6('0x18')][_0x7be6('0x1a')]||null:null,'attributes':_0x5eae6e[_0x7be6('0x18')]?_0x5eae6e[_0x7be6('0x18')][_0x7be6('0x1b')]||null:null,'limit':_0x5eae6e[_0x7be6('0x18')]?_0x5eae6e[_0x7be6('0x18')][_0x7be6('0x1c')]||null:null})[_0x7be6('0xb')](function(_0x4cb815){logger[_0x7be6('0xc')]('UpdateCmHopperBlack',_0x5eae6e);logger[_0x7be6('0xe')](_0x7be6('0x21'),_0x5eae6e,JSON[_0x7be6('0x20')](_0x4cb815));_0x218aa6(_0x4cb815);})['catch'](function(_0x3abfbb){logger['error'](_0x7be6('0x21'),_0x3abfbb[_0x7be6('0x12')],_0x5eae6e);_0x3378db(_0x37f2ed[_0x7be6('0x10')](0x1f4,_0x3abfbb[_0x7be6('0x12')]));});});};exports[_0x7be6('0x23')]=function(_0x30bb65){var _0x1b54ae=this;return new Promise(function(_0x274a9e,_0x1b984f){return db[_0x7be6('0x16')][_0x7be6('0x24')]({'where':_0x30bb65['options']?_0x30bb65[_0x7be6('0x18')][_0x7be6('0x1a')]||null:null})['then'](function(_0x2f3277){logger[_0x7be6('0xc')](_0x7be6('0x23'),_0x30bb65);logger[_0x7be6('0xe')](_0x7be6('0x23'),_0x30bb65,JSON['stringify'](_0x2f3277));_0x274a9e(_0x2f3277);})['catch'](function(_0x5a995b){logger[_0x7be6('0x10')](_0x7be6('0x23'),_0x5a995b[_0x7be6('0x12')],_0x30bb65);_0x1b984f(_0x1b54ae['error'](0x1f4,_0x5a995b[_0x7be6('0x12')]));});});}; \ No newline at end of file +var _0xdcff=['http','request','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetCmHopperBlack','findAll','options','raw','where','limit','include','map','attributes','model','CmHopperBlack','then','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x360b7d,_0x25d94b){var _0x322235=function(_0x12cc19){while(--_0x12cc19){_0x360b7d['push'](_0x360b7d['shift']());}};_0x322235(++_0x25d94b);}(_0xdcff,0x1cb));var _0xfdcf=function(_0x26d498,_0xcbbfaa){_0x26d498=_0x26d498-0x0;var _0x4f8eda=_0xdcff[_0x26d498];return _0x4f8eda;};'use strict';var _=require(_0xfdcf('0x0'));var util=require(_0xfdcf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdcf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdcf('0x3'))['db'];var utils=require(_0xfdcf('0x4'));var logger=require(_0xfdcf('0x5'))(_0xfdcf('0x6'));var config=require(_0xfdcf('0x7'));var jayson=require(_0xfdcf('0x8'));var client=jayson['client'][_0xfdcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534bbc,_0x2c3830,_0x214f44){return new BPromise(function(_0x295a13,_0x5073ff){return client[_0xfdcf('0xa')](_0x534bbc,_0x214f44)['then'](function(_0x3245a3){logger[_0xfdcf('0xb')](_0xfdcf('0xc'),_0x2c3830,'request\x20sent');logger[_0xfdcf('0xd')](_0xfdcf('0xe'),_0x2c3830,'request\x20sent',JSON[_0xfdcf('0xf')](_0x3245a3));if(_0x3245a3[_0xfdcf('0x10')]){if(_0x3245a3['error'][_0xfdcf('0x11')]===0x1f4){logger[_0xfdcf('0x10')](_0xfdcf('0xc'),_0x2c3830,_0x3245a3[_0xfdcf('0x10')][_0xfdcf('0x12')]);return _0x5073ff(_0x3245a3['error'][_0xfdcf('0x12')]);}logger[_0xfdcf('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2c3830,_0x3245a3[_0xfdcf('0x10')][_0xfdcf('0x12')]);return _0x295a13(_0x3245a3[_0xfdcf('0x10')][_0xfdcf('0x12')]);}else{logger[_0xfdcf('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x2c3830,_0xfdcf('0x13'));_0x295a13(_0x3245a3['result'][_0xfdcf('0x12')]);}})[_0xfdcf('0x14')](function(_0x57268d){logger[_0xfdcf('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2c3830,_0x57268d);_0x5073ff(_0x57268d);});});}exports[_0xfdcf('0x15')]=function(_0x2af7da){var _0x35169a=this;return new Promise(function(_0x11b06d,_0x41950e){return db['CmHopperBlack'][_0xfdcf('0x16')]({'raw':_0x2af7da['options']?_0x2af7da[_0xfdcf('0x17')][_0xfdcf('0x18')]===undefined?!![]:![]:!![],'where':_0x2af7da['options']?_0x2af7da[_0xfdcf('0x17')][_0xfdcf('0x19')]||null:null,'attributes':_0x2af7da['options']?_0x2af7da[_0xfdcf('0x17')]['attributes']||null:null,'limit':_0x2af7da['options']?_0x2af7da[_0xfdcf('0x17')][_0xfdcf('0x1a')]||null:null,'include':_0x2af7da[_0xfdcf('0x17')]?_0x2af7da[_0xfdcf('0x17')][_0xfdcf('0x1b')]?_[_0xfdcf('0x1c')](_0x2af7da['options'][_0xfdcf('0x1b')],function(_0x5cd98c){return{'model':db[_0x5cd98c['model']],'as':_0x5cd98c['as'],'attributes':_0x5cd98c[_0xfdcf('0x1d')],'include':_0x5cd98c['include']?_[_0xfdcf('0x1c')](_0x5cd98c[_0xfdcf('0x1b')],function(_0x2c8d66){return{'model':db[_0x2c8d66['model']],'as':_0x2c8d66['as'],'attributes':_0x2c8d66['attributes'],'include':_0x2c8d66[_0xfdcf('0x1b')]?_['map'](_0x2c8d66[_0xfdcf('0x1b')],function(_0xc46733){return{'model':db[_0xc46733[_0xfdcf('0x1e')]],'as':_0xc46733['as'],'attributes':_0xc46733[_0xfdcf('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e8550){logger['info'](_0xfdcf('0x15'),_0x2af7da);logger[_0xfdcf('0xd')](_0xfdcf('0x15'),_0x2af7da,JSON['stringify'](_0x2e8550));_0x11b06d(_0x2e8550);})[_0xfdcf('0x14')](function(_0x38beef){logger[_0xfdcf('0x10')](_0xfdcf('0x15'),_0x38beef['message'],_0x2af7da);_0x41950e(_0x35169a[_0xfdcf('0x10')](0x1f4,_0x38beef[_0xfdcf('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x523992){var _0x5a8419=this;return new Promise(function(_0x5d7177,_0x2d9322){return db[_0xfdcf('0x1f')]['update'](_0x523992['body'],{'raw':_0x523992[_0xfdcf('0x17')]?_0x523992[_0xfdcf('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x523992['options']?_0x523992[_0xfdcf('0x17')][_0xfdcf('0x19')]||null:null,'attributes':_0x523992[_0xfdcf('0x17')]?_0x523992[_0xfdcf('0x17')][_0xfdcf('0x1d')]||null:null,'limit':_0x523992['options']?_0x523992['options']['limit']||null:null})[_0xfdcf('0x20')](function(_0x27be3d){logger[_0xfdcf('0xb')]('UpdateCmHopperBlack',_0x523992);logger['debug'](_0xfdcf('0x21'),_0x523992,JSON[_0xfdcf('0xf')](_0x27be3d));_0x5d7177(_0x27be3d);})['catch'](function(_0x13f074){logger[_0xfdcf('0x10')](_0xfdcf('0x21'),_0x13f074['message'],_0x523992);_0x2d9322(_0x5a8419[_0xfdcf('0x10')](0x1f4,_0x13f074[_0xfdcf('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x468e64){var _0x368814=this;return new Promise(function(_0x35af3e,_0x117f56){return db[_0xfdcf('0x1f')][_0xfdcf('0x22')]({'where':_0x468e64[_0xfdcf('0x17')]?_0x468e64['options'][_0xfdcf('0x19')]||null:null})[_0xfdcf('0x20')](function(_0x37147c){logger[_0xfdcf('0xb')]('DestroyCmHopperBlack',_0x468e64);logger[_0xfdcf('0xd')](_0xfdcf('0x23'),_0x468e64,JSON['stringify'](_0x37147c));_0x35af3e(_0x37147c);})[_0xfdcf('0x14')](function(_0x56d012){logger['error'](_0xfdcf('0x23'),_0x56d012[_0xfdcf('0x12')],_0x468e64);_0x117f56(_0x368814['error'](0x1f4,_0x56d012['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a7b9df2..3dd1124 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 _0xcaf2=['./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0xd5d4ab,_0x20bf18){var _0x30ca91=function(_0x22dc57){while(--_0x22dc57){_0xd5d4ab['push'](_0xd5d4ab['shift']());}};_0x30ca91(++_0x20bf18);}(_0xcaf2,0x8a));var _0x2caf=function(_0x407b00,_0x3868c1){_0x407b00=_0x407b00-0x0;var _0x2450aa=_0xcaf2[_0x407b00];return _0x2450aa;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0xb'),auth['isAuthenticated'](),controller[_0x2caf('0x10')]);module[_0x2caf('0x11')]=router; \ No newline at end of file +var _0x81c6=['delete','util','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','/:id','update'];(function(_0x2a410a,_0x1a1db5){var _0x155b9d=function(_0x1f2182){while(--_0x1f2182){_0x2a410a['push'](_0x2a410a['shift']());}};_0x155b9d(++_0x1a1db5);}(_0x81c6,0x1d5));var _0x681c=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x81c6[_0x102977];return _0x15c466;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var fs_extra=require(_0x681c('0x2'));var auth=require(_0x681c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x681c('0x4'));var controller=require(_0x681c('0x5'));router[_0x681c('0x6')]('/',auth[_0x681c('0x7')](),controller['index']);router[_0x681c('0x6')](_0x681c('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x681c('0x6')](_0x681c('0x9'),auth[_0x681c('0x7')](),controller['show']);router['put'](_0x681c('0x9'),auth['isAuthenticated'](),controller[_0x681c('0xa')]);router[_0x681c('0xb')](_0x681c('0x9'),auth[_0x681c('0x7')](),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 a31f0d6..a034766 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 _0xef0b=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff'];(function(_0x104504,_0x443c9b){var _0x2f3e8f=function(_0x31c8ca){while(--_0x31c8ca){_0x104504['push'](_0x104504['shift']());}};_0x2f3e8f(++_0x443c9b);}(_0xef0b,0xa6));var _0xbef0=function(_0x2fc44f,_0x378dc5){_0x2fc44f=_0x2fc44f-0x0;var _0x13984c=_0xef0b[_0x2fc44f];return _0x13984c;};'use strict';var Sequelize=require(_0xbef0('0x0'));var moment=require(_0xbef0('0x1'));module[_0xbef0('0x2')]={'state':{'type':Sequelize[_0xbef0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xbef0('0x4')]},'scheduledat':{'type':Sequelize[_0xbef0('0x5')]},'countbusyretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbef0('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xbef0('0x4')]},'calleridnum':{'type':Sequelize[_0xbef0('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbef0('0x5')]},'answertime':{'type':Sequelize[_0xbef0('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xbef0('0x4')]},'campaigntype':{'type':Sequelize[_0xbef0('0x4')]},'membername':{'type':Sequelize[_0xbef0('0x4')]},'reason':{'type':Sequelize[_0xbef0('0x4')]},'disposition':{'type':Sequelize[_0xbef0('0x4')]},'secondDisposition':{'type':Sequelize[_0xbef0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbef0('0x4')]},'dispositionat':{'type':Sequelize[_0xbef0('0x5')],'set':function(_0x4bd1d9){var _0xcedf98=this[_0xbef0('0x6')](_0xbef0('0x7'));if(_0xcedf98&&_0x4bd1d9){this[_0xbef0('0x8')]('followuptime',moment(_0x4bd1d9)[_0xbef0('0x9')](moment(_0xcedf98),'seconds'));}}},'amd':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbef0('0x5')]},'callback':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbef0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbef0('0x5')]},'deleted':{'type':Sequelize[_0xbef0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbef0('0x5')]},'recallme':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbef0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9780=['seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','setDataValue','followuptime'];(function(_0x1fa005,_0x1d7c16){var _0x4097b9=function(_0x2d846a){while(--_0x2d846a){_0x1fa005['push'](_0x1fa005['shift']());}};_0x4097b9(++_0x1d7c16);}(_0x9780,0x1d8));var _0x0978=function(_0x540511,_0x201e3b){_0x540511=_0x540511-0x0;var _0x5c1ac6=_0x9780[_0x540511];return _0x5c1ac6;};'use strict';var Sequelize=require(_0x0978('0x0'));var moment=require(_0x0978('0x1'));module[_0x0978('0x2')]={'state':{'type':Sequelize[_0x0978('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x0978('0x4')]},'scheduledat':{'type':Sequelize[_0x0978('0x5')]},'countbusyretry':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0978('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0978('0x4')]},'calleridnum':{'type':Sequelize[_0x0978('0x4')]},'calleridname':{'type':Sequelize[_0x0978('0x4')]},'starttime':{'type':Sequelize[_0x0978('0x5')]},'responsetime':{'type':Sequelize[_0x0978('0x5')]},'answertime':{'type':Sequelize[_0x0978('0x5')]},'droptime':{'type':Sequelize[_0x0978('0x5')]},'endtime':{'type':Sequelize[_0x0978('0x5')]},'ringtime':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0978('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0978('0x4')]},'membername':{'type':Sequelize[_0x0978('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0978('0x4')]},'secondDisposition':{'type':Sequelize[_0x0978('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0978('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5bf49b){var _0xdefdfc=this['getDataValue']('endtime');if(_0xdefdfc&&_0x5bf49b){this[_0x0978('0x6')](_0x0978('0x7'),moment(_0x5bf49b)['diff'](moment(_0xdefdfc),_0x0978('0x8')));}}},'amd':{'type':Sequelize[_0x0978('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0978('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0978('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0978('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0978('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0978('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0978('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0978('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0978('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0978('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 ae7f7fe..1ae2b8a 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 _0xeff8=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne'];(function(_0x2a46ae,_0x2490f4){var _0x4e0564=function(_0x578e7e){while(--_0x578e7e){_0x2a46ae['push'](_0x2a46ae['shift']());}};_0x4e0564(++_0x2490f4);}(_0xeff8,0x186));var _0x8eff=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xeff8[_0x52085a];return _0x5afc1a;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['CmHopperFinal'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['CmHopperFinal']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')]()[_0x8eff('0x26')](respondWithResult(_0x1b5fda,null))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x3287d6,_0x4c7013){if(_0x3287d6[_0x8eff('0x4a')]['uniqueid']){delete _0x3287d6[_0x8eff('0x4a')][_0x8eff('0x4b')];}return db[_0x8eff('0x2d')][_0x8eff('0x4c')]({'where':{'uniqueid':_0x3287d6[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x4c7013,null))[_0x8eff('0x26')](saveUpdates(_0x3287d6[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x4c7013,null))[_0x8eff('0x44')](handleError(_0x4c7013,null));};exports[_0x8eff('0x4d')]=function(_0x452f7a,_0x47b28d,_0x13ae7c){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x452f7a[_0x8eff('0x46')]['id']},'attributes':[[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),'noAnswerContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),_0x8eff('0x53')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x54')))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),_0x8eff('0x57')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8eff('0x58')],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x59')))),_0x8eff('0x5a')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal'](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x47b28d,null))[_0x8eff('0x26')](respondWithResult(_0x47b28d,null))[_0x8eff('0x44')](handleError(_0x47b28d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4064bd,_0x36afc3,_0x1813df){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'CampaignId':_0x4064bd[_0x8eff('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x8eff('0x5d')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),_0x8eff('0x5e')],[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),'busyContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5f')))),_0x8eff('0x58')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x36afc3,null))['then'](respondWithResult(_0x36afc3,null))[_0x8eff('0x44')](handleError(_0x36afc3,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x42efc6,_0x35a221,_0x12ebd1){return db[_0x8eff('0x60')][_0x8eff('0x4c')]({'where':{'id':_0x42efc6[_0x8eff('0x46')]['id']}})['then'](handleEntityNotFound(_0x35a221,null))[_0x8eff('0x26')](function(_0x545fcf){var _0x1d8d8f;if(_0x545fcf){_0x1d8d8f=squel[_0x8eff('0x61')]()[_0x8eff('0x62')](_0x8eff('0x63'))[_0x8eff('0x64')]([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),'VoiceQueueId',_0x8eff('0x69'),_0x8eff('0x6a')],squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x6d'),_0x8eff('0x65'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x66'))[_0x8eff('0x6c')]('ANY_VALUE(ContactId)','ContactId')['field']('ANY_VALUE(ListId)',_0x8eff('0x68'))[_0x8eff('0x6c')](_0x8eff('0x6f'),_0x8eff('0x70'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))['field'](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))['where'](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x42efc6[_0x8eff('0x4a')]['state']['toString']())['where'](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x65'))[_0x8eff('0x71')](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']()))[_0x8eff('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')]('calleridnum')[_0x8eff('0x71')]('cm_hopper_final')[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))[_0x8eff('0x78')](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')][_0x8eff('0x33')](_0x1d8d8f);}return[];})[_0x8eff('0x26')](respondWithResult(_0x35a221,null))[_0x8eff('0x44')](handleError(_0x35a221,null));};exports[_0x8eff('0x79')]=function(_0x23a771,_0x452b90,_0x43bbce){return db['Campaign'][_0x8eff('0x4c')]({'where':{'id':_0x23a771[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452b90,null))[_0x8eff('0x26')](function(_0x17f63b){var _0x582478;if(_0x17f63b){_0x582478=squel[_0x8eff('0x61')]()[_0x8eff('0x62')]('cm_hopper')['fromQuery']([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),_0x8eff('0x7a'),_0x8eff('0x69'),'updatedAt'],squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x6d'),_0x8eff('0x65'))['field'](_0x8eff('0x6e'),'scheduledAt')['field'](_0x8eff('0x7b'),'ContactId')[_0x8eff('0x6c')](_0x8eff('0x7c'),'ListId')[_0x8eff('0x6c')](_0x8eff('0x7d'),'CampaignId')[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771['params']['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x23a771[_0x8eff('0x4a')]['state'][_0x8eff('0x77')]())[_0x8eff('0x3b')](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x65'))['from'](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x7e'),_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]()))[_0x8eff('0x3b')](_0x8eff('0x76'),squel['select']()[_0x8eff('0x6c')](_0x8eff('0x7f'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))['group'](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')]['query'](_0x582478);}return[];})[_0x8eff('0x26')](respondWithResult(_0x452b90,null))['catch'](handleError(_0x452b90,null));};exports['checkContactHopper']=function(_0x10b9ac,_0x6bc93b,_0x10ade6){return db[_0x8eff('0x80')][_0x8eff('0x81')]({'where':{'VoiceQueueId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x70')],'CampaignId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x7a')],'ContactId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x67')]}})[_0x8eff('0x26')](handleEntityNotFound(_0x6bc93b,null))['then'](function(_0x34a0f7){if(_0x34a0f7){return _0x34a0f7;}return null;})[_0x8eff('0x26')](respondWithResult(_0x6bc93b,null))[_0x8eff('0x44')](handleError(_0x6bc93b,null));}; \ No newline at end of file +var _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end'];(function(_0x396a14,_0x7f27cc){var _0x4caa54=function(_0x5e1d6b){while(--_0x5e1d6b){_0x396a14['push'](_0x396a14['shift']());}};_0x4caa54(++_0x7f27cc);}(_0xb016,0x159));var _0x6b01=function(_0x220ac3,_0x24220c){_0x220ac3=_0x220ac3-0x0;var _0xb4b3e1=_0xb016[_0x220ac3];return _0xb4b3e1;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2a09df9..c07129c 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 _0xf7d7=['moment','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','../../config/logger','api'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf7d7,0x17d));var _0x7f7d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf7d7[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x7f7d('0x0'));var util=require('util');var logger=require(_0x7f7d('0x1'))(_0x7f7d('0x2'));var moment=require(_0x7f7d('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f7d('0x4'));var fs=require('fs');var path=require(_0x7f7d('0x5'));var rimraf=require(_0x7f7d('0x6'));var config=require('../../config/environment');var attributes=require(_0x7f7d('0x7'));module[_0x7f7d('0x8')]=function(_0x4f7618,_0x347aba){return _0x4f7618[_0x7f7d('0x9')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x7f7d('0xa'),'fields':['calleridnum']},{'name':_0x7f7d('0xb'),'fields':[_0x7f7d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbbfc=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','moment','bluebird','request-promise'];(function(_0x140933,_0x3486ec){var _0xb82c29=function(_0xd0e21b){while(--_0xd0e21b){_0x140933['push'](_0x140933['shift']());}};_0xb82c29(++_0x3486ec);}(_0xbbfc,0xc2));var _0xcbbf=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xbbfc[_0x11a220];return _0x20d8fe;};'use strict';var _=require(_0xcbbf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcbbf('0x1'));var BPromise=require(_0xcbbf('0x2'));var rp=require(_0xcbbf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbf('0x4'));var config=require(_0xcbbf('0x5'));var attributes=require(_0xcbbf('0x6'));module[_0xcbbf('0x7')]=function(_0x180032,_0x119c45){return _0x180032[_0xcbbf('0x8')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xcbbf('0x9'),'fields':[_0xcbbf('0x9')]},{'name':_0xcbbf('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index c9ed162..4427064 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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4c72f3,_0x243a08){var _0x19bf85=function(_0x450442){while(--_0x450442){_0x4c72f3['push'](_0x4c72f3['shift']());}};_0x19bf85(++_0x243a08);}(_0xb10b,0x12a));var _0xbb10=function(_0x57b5d5,_0x25b4ee){_0x57b5d5=_0x57b5d5-0x0;var _0x24e2b5=_0xb10b[_0x57b5d5];return _0x24e2b5;};'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')]('CreateCmHopperFinal',_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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x521876,_0x2ea3d7){var _0x5a883e=function(_0x297f01){while(--_0x297f01){_0x521876['push'](_0x521876['shift']());}};_0x5a883e(++_0x2ea3d7);}(_0xb10b,0x12a));var _0xbb10=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xb10b[_0x397f37];return _0x31cae6;};'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')]('CreateCmHopperFinal',_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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 34930ae..78f56b0 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 _0x23c8=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','put','update','multer','util','path','connect-timeout','Router'];(function(_0x568bd6,_0x31ebb3){var _0x3e5d0d=function(_0x5aeab5){while(--_0x5aeab5){_0x568bd6['push'](_0x568bd6['shift']());}};_0x3e5d0d(++_0x31ebb3);}(_0x23c8,0xca));var _0x823c=function(_0x3377bd,_0xd90a06){_0x3377bd=_0x3377bd-0x0;var _0x10365a=_0x23c8[_0x3377bd];return _0x10365a;};'use strict';var multer=require(_0x823c('0x0'));var util=require(_0x823c('0x1'));var path=require(_0x823c('0x2'));var timeout=require(_0x823c('0x3'));var express=require('express');var router=express[_0x823c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x823c('0x5'));var config=require(_0x823c('0x6'));var controller=require(_0x823c('0x7'));router[_0x823c('0x8')]('/',auth[_0x823c('0x9')](),controller[_0x823c('0xa')]);router[_0x823c('0x8')](_0x823c('0xb'),auth['isAuthenticated'](),controller[_0x823c('0xc')]);router[_0x823c('0x8')](_0x823c('0xd'),auth[_0x823c('0x9')](),controller[_0x823c('0xe')]);router['get'](_0x823c('0xf'),auth[_0x823c('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x823c('0x8')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x823c('0x10')]);router[_0x823c('0x11')](_0x823c('0x12'),auth['isAuthenticated'](),controller[_0x823c('0x13')]);router['post'](_0x823c('0x14'),auth[_0x823c('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router['post']('/checkContactHopper',auth[_0x823c('0x9')](),controller['checkContactHopper']);router[_0x823c('0x15')](_0x823c('0xd'),auth[_0x823c('0x9')](),controller[_0x823c('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7366=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','isAuthenticated','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7366,0x9d));var _0x6736=function(_0x5b6d2a,_0x2a4e3b){_0x5b6d2a=_0x5b6d2a-0x0;var _0x536640=_0x7366[_0x5b6d2a];return _0x536640;};'use strict';var multer=require(_0x6736('0x0'));var util=require(_0x6736('0x1'));var path=require(_0x6736('0x2'));var timeout=require(_0x6736('0x3'));var express=require(_0x6736('0x4'));var router=express[_0x6736('0x5')]();var fs_extra=require(_0x6736('0x6'));var auth=require(_0x6736('0x7'));var interaction=require(_0x6736('0x8'));var config=require('../../config/environment');var controller=require(_0x6736('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6736('0xa')]);router[_0x6736('0xb')](_0x6736('0xc'),auth['isAuthenticated'](),controller[_0x6736('0xd')]);router[_0x6736('0xb')](_0x6736('0xe'),auth['isAuthenticated'](),controller[_0x6736('0xf')]);router[_0x6736('0xb')](_0x6736('0x10'),auth['isAuthenticated'](),controller[_0x6736('0x11')]);router['get'](_0x6736('0x12'),auth[_0x6736('0x13')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x6736('0x14')](_0x6736('0x15'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x6736('0x16'),auth[_0x6736('0x13')](),controller[_0x6736('0x17')]);router[_0x6736('0x14')](_0x6736('0x18'),auth[_0x6736('0x13')](),controller[_0x6736('0x19')]);router[_0x6736('0x1a')](_0x6736('0xe'),auth[_0x6736('0x13')](),controller[_0x6736('0x1b')]);module[_0x6736('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c35c026..cf0fbbb 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 _0xcd15=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0xcd15,0xf6));var _0x5cd1=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0xcd15[_0x10df1e];return _0x3e24fb;};'use strict';var Sequelize=require(_0x5cd1('0x0'));module[_0x5cd1('0x1')]={'state':{'type':Sequelize[_0x5cd1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5cd1('0x3')]},'scheduledat':{'type':Sequelize[_0x5cd1('0x4')]},'countbusyretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5cd1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5cd1('0x3')]},'calleridnum':{'type':Sequelize[_0x5cd1('0x3')]},'calleridname':{'type':Sequelize[_0x5cd1('0x3')]},'starttime':{'type':Sequelize[_0x5cd1('0x4')]},'responsetime':{'type':Sequelize[_0x5cd1('0x4')]},'answertime':{'type':Sequelize[_0x5cd1('0x4')]},'droptime':{'type':Sequelize[_0x5cd1('0x4')]},'endtime':{'type':Sequelize[_0x5cd1('0x4')]},'ringtime':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5cd1('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5cd1('0x3')]},'membername':{'type':Sequelize[_0x5cd1('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5cd1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5cd1('0x4')]},'recallme':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5cd1('0x4')]},'edited':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5cd1('0x3')]}}; \ No newline at end of file +var _0x4f9a=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x2ba390,_0x220237){var _0xa7563d=function(_0x4a7772){while(--_0x4a7772){_0x2ba390['push'](_0x2ba390['shift']());}};_0xa7563d(++_0x220237);}(_0x4f9a,0xd1));var _0xa4f9=function(_0x25bdc2,_0x368a51){_0x25bdc2=_0x25bdc2-0x0;var _0x526582=_0x4f9a[_0x25bdc2];return _0x526582;};'use strict';var Sequelize=require('sequelize');module[_0xa4f9('0x0')]={'state':{'type':Sequelize[_0xa4f9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa4f9('0x2')]},'scheduledat':{'type':Sequelize[_0xa4f9('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa4f9('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xa4f9('0x2')]},'originatecalleridname':{'type':Sequelize[_0xa4f9('0x2')]},'calleridnum':{'type':Sequelize[_0xa4f9('0x2')]},'calleridname':{'type':Sequelize[_0xa4f9('0x2')]},'starttime':{'type':Sequelize[_0xa4f9('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa4f9('0x3')]},'droptime':{'type':Sequelize[_0xa4f9('0x3')]},'endtime':{'type':Sequelize[_0xa4f9('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa4f9('0x2')]},'campaign':{'type':Sequelize[_0xa4f9('0x2')]},'campaigntype':{'type':Sequelize[_0xa4f9('0x2')]},'membername':{'type':Sequelize[_0xa4f9('0x2')]},'reason':{'type':Sequelize[_0xa4f9('0x2')]},'amd':{'type':Sequelize[_0xa4f9('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa4f9('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xa4f9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa4f9('0x3')]},'recallme':{'type':Sequelize[_0xa4f9('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa4f9('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa4f9('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa4f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ec247c6..230858b 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 _0xed83=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','keys','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x19a11f,_0x6d8be7){var _0x51485f=function(_0x1394a1){while(--_0x1394a1){_0x19a11f['push'](_0x19a11f['shift']());}};_0x51485f(++_0x6d8be7);}(_0xed83,0x91));var _0x3ed8=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0xed83[_0xa98302];return _0x1ad8e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ed8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ed8('0x1'));var rp=require(_0x3ed8('0x2'));var moment=require(_0x3ed8('0x3'));var BPromise=require(_0x3ed8('0x4'));var Mustache=require(_0x3ed8('0x5'));var util=require(_0x3ed8('0x6'));var path=require(_0x3ed8('0x7'));var sox=require(_0x3ed8('0x8'));var csv=require(_0x3ed8('0x9'));var ejs=require(_0x3ed8('0xa'));var fs=require('fs');var fs_extra=require(_0x3ed8('0xb'));var _=require(_0x3ed8('0xc'));var squel=require(_0x3ed8('0xd'));var crypto=require(_0x3ed8('0xe'));var jsforce=require(_0x3ed8('0xf'));var deskjs=require(_0x3ed8('0x10'));var toCsv=require(_0x3ed8('0x9'));var querystring=require(_0x3ed8('0x11'));var Papa=require(_0x3ed8('0x12'));var Redis=require(_0x3ed8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3ed8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ed8('0x15'));var logger=require(_0x3ed8('0x16'))(_0x3ed8('0x17'));var utils=require(_0x3ed8('0x18'));var config=require(_0x3ed8('0x19'));var licenseUtil=require(_0x3ed8('0x1a'));var db=require(_0x3ed8('0x1b'))['db'];function respondWithStatusCode(_0x5e32aa,_0x2cc167){_0x2cc167=_0x2cc167||0xcc;return function(_0x4b71c9){if(_0x4b71c9){return _0x5e32aa[_0x3ed8('0x1c')](_0x2cc167);}return _0x5e32aa[_0x3ed8('0x1d')](_0x2cc167)['end']();};}function respondWithResult(_0x1ebf8a,_0x3e2909){_0x3e2909=_0x3e2909||0xc8;return function(_0x138710){if(_0x138710){return _0x1ebf8a[_0x3ed8('0x1d')](_0x3e2909)[_0x3ed8('0x1e')](_0x138710);}};}function respondWithFilteredResult(_0x4c1f55,_0x47153c){return function(_0x1ebd4f){if(_0x1ebd4f){var _0xfa3cce=typeof _0x47153c[_0x3ed8('0x1f')]==='undefined'&&typeof _0x47153c[_0x3ed8('0x20')]===_0x3ed8('0x21');var _0x4b194f=_0x1ebd4f['count'];var _0x49c363=_0xfa3cce?0x0:_0x47153c[_0x3ed8('0x1f')];var _0xbeedc4=_0xfa3cce?_0x1ebd4f[_0x3ed8('0x22')]:_0x47153c[_0x3ed8('0x1f')]+_0x47153c['limit'];var _0x346e06;if(_0xbeedc4>=_0x4b194f){_0xbeedc4=_0x4b194f;_0x346e06=0xc8;}else{_0x346e06=0xce;}_0x4c1f55[_0x3ed8('0x1d')](_0x346e06);return _0x4c1f55[_0x3ed8('0x23')](_0x3ed8('0x24'),_0x49c363+'-'+_0xbeedc4+'/'+_0x4b194f)[_0x3ed8('0x1e')](_0x1ebd4f);}return null;};}function patchUpdates(_0x34b8ed){return function(_0xfe4505){try{jsonpatch[_0x3ed8('0x25')](_0xfe4505,_0x34b8ed,!![]);}catch(_0x4ec305){return BPromise[_0x3ed8('0x26')](_0x4ec305);}return _0xfe4505['save']();};}function saveUpdates(_0x4a91bb,_0x285632){return function(_0x35064b){if(_0x35064b){return _0x35064b[_0x3ed8('0x27')](_0x4a91bb)['then'](function(_0x4ef9b6){return _0x4ef9b6;});}return null;};}function removeEntity(_0x3f597b,_0x3a2971){return function(_0x42e5ef){if(_0x42e5ef){return _0x42e5ef[_0x3ed8('0x28')]()[_0x3ed8('0x29')](function(){_0x3f597b[_0x3ed8('0x1d')](0xcc)[_0x3ed8('0x2a')]();});}};}function handleEntityNotFound(_0x155392,_0x253be4){return function(_0x3c7ce6){if(!_0x3c7ce6){_0x155392[_0x3ed8('0x1c')](0x194);}return _0x3c7ce6;};}function handleError(_0x1b5bb3,_0x17fd0a){_0x17fd0a=_0x17fd0a||0x1f4;return function(_0x1ddedc){logger['error'](_0x1ddedc[_0x3ed8('0x2b')]);if(_0x1ddedc[_0x3ed8('0x2c')]){delete _0x1ddedc[_0x3ed8('0x2c')];}_0x1b5bb3[_0x3ed8('0x1d')](_0x17fd0a)[_0x3ed8('0x2d')](_0x1ddedc);};}exports[_0x3ed8('0x2e')]=function(_0x56c8ab,_0x32ea61){var _0x5e1ec9={},_0x12a650={},_0x25cb0f={'count':0x0,'rows':[]};var _0x230840=_[_0x3ed8('0x2f')](db[_0x3ed8('0x30')][_0x3ed8('0x31')],function(_0x472112){return{'name':_0x472112['fieldName'],'type':_0x472112[_0x3ed8('0x32')][_0x3ed8('0x33')]};});_0x12a650['model']=_['map'](_0x230840,_0x3ed8('0x2c'));_0x12a650[_0x3ed8('0x34')]=_['keys'](_0x56c8ab[_0x3ed8('0x34')]);_0x12a650[_0x3ed8('0x35')]=_[_0x3ed8('0x36')](_0x12a650[_0x3ed8('0x37')],_0x12a650['query']);_0x5e1ec9[_0x3ed8('0x38')]=_[_0x3ed8('0x36')](_0x12a650[_0x3ed8('0x37')],qs[_0x3ed8('0x39')](_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x39')]));_0x5e1ec9[_0x3ed8('0x38')]=_0x5e1ec9[_0x3ed8('0x38')][_0x3ed8('0x3a')]?_0x5e1ec9[_0x3ed8('0x38')]:_0x12a650[_0x3ed8('0x37')];if(!_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x3b')](_0x3ed8('0x3c'))){_0x5e1ec9[_0x3ed8('0x20')]=qs['limit'](_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x20')]);_0x5e1ec9[_0x3ed8('0x1f')]=qs['offset'](_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x1f')]);}_0x5e1ec9[_0x3ed8('0x3d')]=qs[_0x3ed8('0x3e')](_0x56c8ab['query'][_0x3ed8('0x3e')]);_0x5e1ec9[_0x3ed8('0x3f')]=qs[_0x3ed8('0x35')](_[_0x3ed8('0x40')](_0x56c8ab[_0x3ed8('0x34')],_0x12a650[_0x3ed8('0x35')]),_0x230840);if(_0x56c8ab[_0x3ed8('0x34')]['filter']){_0x5e1ec9[_0x3ed8('0x3f')]=_[_0x3ed8('0x41')](_0x5e1ec9[_0x3ed8('0x3f')],{'$or':_[_0x3ed8('0x2f')](_0x230840,function(_0x39bf55){if(_0x39bf55[_0x3ed8('0x32')]!=='VIRTUAL'){var _0x5a4831={};_0x5a4831[_0x39bf55[_0x3ed8('0x2c')]]={'$like':'%'+_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x42')]+'%'};return _0x5a4831;}})});}_0x5e1ec9=_[_0x3ed8('0x41')]({},_0x5e1ec9,_0x56c8ab[_0x3ed8('0x43')]);var _0x20a5ae={'where':_0x5e1ec9['where']};return db[_0x3ed8('0x30')][_0x3ed8('0x22')](_0x20a5ae)[_0x3ed8('0x29')](function(_0x32d551){_0x25cb0f['count']=_0x32d551;if(_0x56c8ab[_0x3ed8('0x34')]['includeAll']){_0x5e1ec9[_0x3ed8('0x44')]=[{'all':!![]}];}return db[_0x3ed8('0x30')][_0x3ed8('0x45')](_0x5e1ec9);})[_0x3ed8('0x29')](function(_0x1a7655){_0x25cb0f['rows']=_0x1a7655;return _0x25cb0f;})[_0x3ed8('0x29')](respondWithFilteredResult(_0x32ea61,_0x5e1ec9))[_0x3ed8('0x46')](handleError(_0x32ea61,null));};exports[_0x3ed8('0x47')]=function(_0x16ad77,_0x3fbf82){var _0x278d79={'raw':!![],'where':{'id':_0x16ad77[_0x3ed8('0x48')]['id']}},_0x39cb85={};_0x39cb85['model']=_[_0x3ed8('0x49')](db[_0x3ed8('0x30')][_0x3ed8('0x31')]);_0x39cb85[_0x3ed8('0x34')]=_['keys'](_0x16ad77[_0x3ed8('0x34')]);_0x39cb85['filters']=_[_0x3ed8('0x36')](_0x39cb85[_0x3ed8('0x37')],_0x39cb85[_0x3ed8('0x34')]);_0x278d79[_0x3ed8('0x38')]=_[_0x3ed8('0x36')](_0x39cb85[_0x3ed8('0x37')],qs[_0x3ed8('0x39')](_0x16ad77[_0x3ed8('0x34')][_0x3ed8('0x39')]));_0x278d79[_0x3ed8('0x38')]=_0x278d79[_0x3ed8('0x38')][_0x3ed8('0x3a')]?_0x278d79['attributes']:_0x39cb85['model'];if(_0x16ad77[_0x3ed8('0x34')]['includeAll']){_0x278d79[_0x3ed8('0x44')]=[{'all':!![]}];}_0x278d79=_[_0x3ed8('0x41')]({},_0x278d79,_0x16ad77['options']);return db[_0x3ed8('0x30')][_0x3ed8('0x4a')](_0x278d79)[_0x3ed8('0x29')](handleEntityNotFound(_0x3fbf82,null))[_0x3ed8('0x29')](respondWithResult(_0x3fbf82,null))['catch'](handleError(_0x3fbf82,null));};exports[_0x3ed8('0x4b')]=function(_0x3ad494,_0x157b99){return db[_0x3ed8('0x30')][_0x3ed8('0x4b')](_0x3ad494[_0x3ed8('0x4c')],{})['then'](respondWithResult(_0x157b99,0xc9))[_0x3ed8('0x46')](handleError(_0x157b99,null));};exports['describe']=function(_0x11814e,_0x10a619){return db['CmHopperHistory'][_0x3ed8('0x4d')]()['then'](respondWithResult(_0x10a619,null))[_0x3ed8('0x46')](handleError(_0x10a619,null));};exports[_0x3ed8('0x27')]=function(_0x4651d1,_0x530892){if(_0x4651d1[_0x3ed8('0x4c')][_0x3ed8('0x4e')]){delete _0x4651d1[_0x3ed8('0x4c')][_0x3ed8('0x4e')];}return db[_0x3ed8('0x30')][_0x3ed8('0x4a')]({'where':{'uniqueid':_0x4651d1[_0x3ed8('0x48')]['id']}})[_0x3ed8('0x29')](handleEntityNotFound(_0x530892,null))['then'](saveUpdates(_0x4651d1[_0x3ed8('0x4c')],null))['then'](respondWithResult(_0x530892,null))[_0x3ed8('0x46')](handleError(_0x530892,null));}; \ No newline at end of file +var _0x2b1f=['squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','save','then','destroy','error','stack','name','index','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','describe','update','body','uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash'];(function(_0x368931,_0xba04aa){var _0x5b540c=function(_0x26df9a){while(--_0x26df9a){_0x368931['push'](_0x368931['shift']());}};_0x5b540c(++_0xba04aa);}(_0x2b1f,0x16b));var _0xf2b1=function(_0x590a94,_0x61e61){_0x590a94=_0x590a94-0x0;var _0x865e8=_0x2b1f[_0x590a94];return _0x865e8;};'use strict';var emlformat=require(_0xf2b1('0x0'));var rimraf=require(_0xf2b1('0x1'));var zipdir=require(_0xf2b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2b1('0x3'));var moment=require(_0xf2b1('0x4'));var BPromise=require(_0xf2b1('0x5'));var Mustache=require(_0xf2b1('0x6'));var util=require('util');var path=require(_0xf2b1('0x7'));var sox=require(_0xf2b1('0x8'));var csv=require('to-csv');var ejs=require(_0xf2b1('0x9'));var fs=require('fs');var fs_extra=require(_0xf2b1('0xa'));var _=require(_0xf2b1('0xb'));var squel=require(_0xf2b1('0xc'));var crypto=require(_0xf2b1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf2b1('0xe'));var toCsv=require(_0xf2b1('0xf'));var querystring=require(_0xf2b1('0x10'));var Papa=require('papaparse');var Redis=require(_0xf2b1('0x11'));var authService=require(_0xf2b1('0x12'));var qs=require(_0xf2b1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf2b1('0x14'));var utils=require(_0xf2b1('0x15'));var config=require(_0xf2b1('0x16'));var licenseUtil=require(_0xf2b1('0x17'));var db=require(_0xf2b1('0x18'))['db'];function respondWithStatusCode(_0x9e80f,_0x27ed06){_0x27ed06=_0x27ed06||0xcc;return function(_0x58c987){if(_0x58c987){return _0x9e80f[_0xf2b1('0x19')](_0x27ed06);}return _0x9e80f['status'](_0x27ed06)[_0xf2b1('0x1a')]();};}function respondWithResult(_0x57da36,_0x2b7104){_0x2b7104=_0x2b7104||0xc8;return function(_0x31e59e){if(_0x31e59e){return _0x57da36['status'](_0x2b7104)[_0xf2b1('0x1b')](_0x31e59e);}};}function respondWithFilteredResult(_0x2304c7,_0x15d309){return function(_0x173b94){if(_0x173b94){var _0x21b213=typeof _0x15d309[_0xf2b1('0x1c')]===_0xf2b1('0x1d')&&typeof _0x15d309['limit']==='undefined';var _0xfa81cb=_0x173b94[_0xf2b1('0x1e')];var _0x1f2a2a=_0x21b213?0x0:_0x15d309[_0xf2b1('0x1c')];var _0x3b6a83=_0x21b213?_0x173b94[_0xf2b1('0x1e')]:_0x15d309[_0xf2b1('0x1c')]+_0x15d309[_0xf2b1('0x1f')];var _0x1c929f;if(_0x3b6a83>=_0xfa81cb){_0x3b6a83=_0xfa81cb;_0x1c929f=0xc8;}else{_0x1c929f=0xce;}_0x2304c7[_0xf2b1('0x20')](_0x1c929f);return _0x2304c7[_0xf2b1('0x21')](_0xf2b1('0x22'),_0x1f2a2a+'-'+_0x3b6a83+'/'+_0xfa81cb)[_0xf2b1('0x1b')](_0x173b94);}return null;};}function patchUpdates(_0x4e3de8){return function(_0x15f533){try{jsonpatch['apply'](_0x15f533,_0x4e3de8,!![]);}catch(_0x3952a6){return BPromise['reject'](_0x3952a6);}return _0x15f533[_0xf2b1('0x23')]();};}function saveUpdates(_0x4c9fb7,_0x30d0cb){return function(_0x383051){if(_0x383051){return _0x383051['update'](_0x4c9fb7)[_0xf2b1('0x24')](function(_0x168731){return _0x168731;});}return null;};}function removeEntity(_0x5eb9a4,_0x3a8013){return function(_0x357a08){if(_0x357a08){return _0x357a08[_0xf2b1('0x25')]()[_0xf2b1('0x24')](function(){_0x5eb9a4[_0xf2b1('0x20')](0xcc)[_0xf2b1('0x1a')]();});}};}function handleEntityNotFound(_0x228935,_0xb180ab){return function(_0x3eb135){if(!_0x3eb135){_0x228935['sendStatus'](0x194);}return _0x3eb135;};}function handleError(_0x3d1f60,_0x3c2955){_0x3c2955=_0x3c2955||0x1f4;return function(_0x32346e){logger[_0xf2b1('0x26')](_0x32346e[_0xf2b1('0x27')]);if(_0x32346e[_0xf2b1('0x28')]){delete _0x32346e['name'];}_0x3d1f60['status'](_0x3c2955)['send'](_0x32346e);};}exports[_0xf2b1('0x29')]=function(_0x4c37ee,_0x457c85){var _0x9c4198={},_0x1b6acc={},_0x57755f={'count':0x0,'rows':[]};var _0x53ad4d=_[_0xf2b1('0x2a')](db[_0xf2b1('0x2b')][_0xf2b1('0x2c')],function(_0x30c023){return{'name':_0x30c023['fieldName'],'type':_0x30c023[_0xf2b1('0x2d')][_0xf2b1('0x2e')]};});_0x1b6acc[_0xf2b1('0x2f')]=_['map'](_0x53ad4d,'name');_0x1b6acc[_0xf2b1('0x30')]=_[_0xf2b1('0x31')](_0x4c37ee['query']);_0x1b6acc[_0xf2b1('0x32')]=_[_0xf2b1('0x33')](_0x1b6acc[_0xf2b1('0x2f')],_0x1b6acc[_0xf2b1('0x30')]);_0x9c4198[_0xf2b1('0x34')]=_[_0xf2b1('0x33')](_0x1b6acc[_0xf2b1('0x2f')],qs[_0xf2b1('0x35')](_0x4c37ee[_0xf2b1('0x30')][_0xf2b1('0x35')]));_0x9c4198[_0xf2b1('0x34')]=_0x9c4198['attributes'][_0xf2b1('0x36')]?_0x9c4198[_0xf2b1('0x34')]:_0x1b6acc[_0xf2b1('0x2f')];if(!_0x4c37ee[_0xf2b1('0x30')][_0xf2b1('0x37')]('nolimit')){_0x9c4198[_0xf2b1('0x1f')]=qs[_0xf2b1('0x1f')](_0x4c37ee['query'][_0xf2b1('0x1f')]);_0x9c4198['offset']=qs[_0xf2b1('0x1c')](_0x4c37ee[_0xf2b1('0x30')][_0xf2b1('0x1c')]);}_0x9c4198[_0xf2b1('0x38')]=qs[_0xf2b1('0x39')](_0x4c37ee[_0xf2b1('0x30')][_0xf2b1('0x39')]);_0x9c4198[_0xf2b1('0x3a')]=qs['filters'](_[_0xf2b1('0x3b')](_0x4c37ee[_0xf2b1('0x30')],_0x1b6acc[_0xf2b1('0x32')]),_0x53ad4d);if(_0x4c37ee[_0xf2b1('0x30')][_0xf2b1('0x3c')]){_0x9c4198[_0xf2b1('0x3a')]=_[_0xf2b1('0x3d')](_0x9c4198['where'],{'$or':_[_0xf2b1('0x2a')](_0x53ad4d,function(_0x2c4eb0){if(_0x2c4eb0[_0xf2b1('0x2d')]!==_0xf2b1('0x3e')){var _0x5bb9c4={};_0x5bb9c4[_0x2c4eb0['name']]={'$like':'%'+_0x4c37ee[_0xf2b1('0x30')][_0xf2b1('0x3c')]+'%'};return _0x5bb9c4;}})});}_0x9c4198=_[_0xf2b1('0x3d')]({},_0x9c4198,_0x4c37ee[_0xf2b1('0x3f')]);var _0x4584ca={'where':_0x9c4198[_0xf2b1('0x3a')]};return db[_0xf2b1('0x2b')]['count'](_0x4584ca)[_0xf2b1('0x24')](function(_0x587839){_0x57755f['count']=_0x587839;if(_0x4c37ee[_0xf2b1('0x30')][_0xf2b1('0x40')]){_0x9c4198[_0xf2b1('0x41')]=[{'all':!![]}];}return db[_0xf2b1('0x2b')]['findAll'](_0x9c4198);})[_0xf2b1('0x24')](function(_0x4ba1a7){_0x57755f['rows']=_0x4ba1a7;return _0x57755f;})[_0xf2b1('0x24')](respondWithFilteredResult(_0x457c85,_0x9c4198))[_0xf2b1('0x42')](handleError(_0x457c85,null));};exports[_0xf2b1('0x43')]=function(_0x84ecba,_0x5b2501){var _0x25946b={'raw':!![],'where':{'id':_0x84ecba['params']['id']}},_0x36f7f5={};_0x36f7f5[_0xf2b1('0x2f')]=_[_0xf2b1('0x31')](db[_0xf2b1('0x2b')]['rawAttributes']);_0x36f7f5['query']=_[_0xf2b1('0x31')](_0x84ecba['query']);_0x36f7f5[_0xf2b1('0x32')]=_[_0xf2b1('0x33')](_0x36f7f5[_0xf2b1('0x2f')],_0x36f7f5[_0xf2b1('0x30')]);_0x25946b['attributes']=_[_0xf2b1('0x33')](_0x36f7f5[_0xf2b1('0x2f')],qs[_0xf2b1('0x35')](_0x84ecba['query'][_0xf2b1('0x35')]));_0x25946b['attributes']=_0x25946b[_0xf2b1('0x34')][_0xf2b1('0x36')]?_0x25946b['attributes']:_0x36f7f5[_0xf2b1('0x2f')];if(_0x84ecba['query']['includeAll']){_0x25946b[_0xf2b1('0x41')]=[{'all':!![]}];}_0x25946b=_['merge']({},_0x25946b,_0x84ecba[_0xf2b1('0x3f')]);return db['CmHopperHistory'][_0xf2b1('0x44')](_0x25946b)['then'](handleEntityNotFound(_0x5b2501,null))[_0xf2b1('0x24')](respondWithResult(_0x5b2501,null))[_0xf2b1('0x42')](handleError(_0x5b2501,null));};exports['create']=function(_0x46e9e0,_0x2c51f6){return db[_0xf2b1('0x2b')][_0xf2b1('0x45')](_0x46e9e0['body'],{})[_0xf2b1('0x24')](respondWithResult(_0x2c51f6,0xc9))[_0xf2b1('0x42')](handleError(_0x2c51f6,null));};exports[_0xf2b1('0x46')]=function(_0x50dceb,_0x165b43){return db[_0xf2b1('0x2b')][_0xf2b1('0x46')]()['then'](respondWithResult(_0x165b43,null))['catch'](handleError(_0x165b43,null));};exports[_0xf2b1('0x47')]=function(_0x3cf341,_0x2b46db){if(_0x3cf341[_0xf2b1('0x48')][_0xf2b1('0x49')]){delete _0x3cf341[_0xf2b1('0x48')][_0xf2b1('0x49')];}return db[_0xf2b1('0x2b')][_0xf2b1('0x44')]({'where':{'uniqueid':_0x3cf341[_0xf2b1('0x4a')]['id']}})[_0xf2b1('0x24')](handleEntityNotFound(_0x2b46db,null))[_0xf2b1('0x24')](saveUpdates(_0x3cf341[_0xf2b1('0x48')],null))[_0xf2b1('0x24')](respondWithResult(_0x2b46db,null))[_0xf2b1('0x42')](handleError(_0x2b46db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 536bf6f..e9412c8 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 _0x77a9=['../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77a9,0x19e));var _0x977a=function(_0x41ec1a,_0x4702bc){_0x41ec1a=_0x41ec1a-0x0;var _0xe4ffc7=_0x77a9[_0x41ec1a];return _0xe4ffc7;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var logger=require(_0x977a('0x1'))('api');var moment=require(_0x977a('0x2'));var BPromise=require(_0x977a('0x3'));var rp=require(_0x977a('0x4'));var fs=require('fs');var path=require(_0x977a('0x5'));var rimraf=require('rimraf');var config=require(_0x977a('0x6'));var attributes=require(_0x977a('0x7'));module[_0x977a('0x8')]=function(_0x2b4ba5,_0x261e46){return _0x2b4ba5['define']('CmHopperHistory',attributes,{'tableName':_0x977a('0x9'),'paranoid':![],'indexes':[{'name':_0x977a('0xa'),'fields':['endtime']},{'name':_0x977a('0xb'),'fields':[_0x977a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e4d=['endtime','uniqueid','lodash','../../config/logger','request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history'];(function(_0x43e6f1,_0x14e7f2){var _0xa0b470=function(_0x52e6a6){while(--_0x52e6a6){_0x43e6f1['push'](_0x43e6f1['shift']());}};_0xa0b470(++_0x14e7f2);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x3057cb,_0x3d5db1){_0x3057cb=_0x3057cb-0x0;var _0x37a59d=_0x3e4d[_0x3057cb];return _0x37a59d;};'use strict';var _=require(_0xd3e4('0x0'));var util=require('util');var logger=require(_0xd3e4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd3e4('0x2'));var fs=require('fs');var path=require(_0xd3e4('0x3'));var rimraf=require(_0xd3e4('0x4'));var config=require('../../config/environment');var attributes=require(_0xd3e4('0x5'));module['exports']=function(_0x4b9a10,_0x7b42fe){return _0x4b9a10[_0xd3e4('0x6')](_0xd3e4('0x7'),attributes,{'tableName':_0xd3e4('0x8'),'paranoid':![],'indexes':[{'name':_0xd3e4('0x9'),'fields':['endtime']},{'name':_0xd3e4('0xa'),'fields':[_0xd3e4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 65b603f..3556713 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 _0xd01f=['AvgHandleTime','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','catch'];(function(_0x3780f1,_0x2bd1cd){var _0x33b372=function(_0x57af75){while(--_0x57af75){_0x3780f1['push'](_0x3780f1['shift']());}};_0x33b372(++_0x2bd1cd);}(_0xd01f,0x1d6));var _0xfd01=function(_0x590a7d,_0x47938e){_0x590a7d=_0x590a7d-0x0;var _0x3ce2b1=_0xd01f[_0x590a7d];return _0x3ce2b1;};'use strict';var _=require(_0xfd01('0x0'));var util=require('util');var moment=require(_0xfd01('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd01('0x2'));var fs=require('fs');var Redis=require(_0xfd01('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd01('0x4'));var logger=require('../../config/logger')(_0xfd01('0x5'));var config=require(_0xfd01('0x6'));var jayson=require(_0xfd01('0x7'));var client=jayson['client'][_0xfd01('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b1a99,_0x585168,_0x580990){return new BPromise(function(_0x36a127,_0x4593f0){return client[_0xfd01('0x9')](_0x2b1a99,_0x580990)[_0xfd01('0xa')](function(_0x2e2e38){logger[_0xfd01('0xb')](_0xfd01('0xc'),_0x585168,_0xfd01('0xd'));logger[_0xfd01('0xe')](_0xfd01('0xf'),_0x585168,_0xfd01('0xd'),JSON[_0xfd01('0x10')](_0x2e2e38));if(_0x2e2e38['error']){if(_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x12')]===0x1f4){logger[_0xfd01('0x11')](_0xfd01('0xc'),_0x585168,_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x13')]);return _0x4593f0(_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x13')]);}logger[_0xfd01('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x585168,_0x2e2e38['error'][_0xfd01('0x13')]);return _0x36a127(_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x13')]);}else{logger[_0xfd01('0xb')](_0xfd01('0xc'),_0x585168,_0xfd01('0xd'));_0x36a127(_0x2e2e38[_0xfd01('0x14')][_0xfd01('0x13')]);}})['catch'](function(_0x4d832a){logger['error'](_0xfd01('0xc'),_0x585168,_0x4d832a);_0x4593f0(_0x4d832a);});});}exports[_0xfd01('0x15')]=function(_0x41e195){var _0x1f10c6=this;return new Promise(function(_0x29e375,_0x2108a0){return db[_0xfd01('0x16')][_0xfd01('0x17')](_0x41e195['body'],{'raw':_0x41e195['options']?_0x41e195[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![]})[_0xfd01('0xa')](function(_0x136338){logger['info']('CreateCmHopperHistory',_0x41e195);logger[_0xfd01('0xe')](_0xfd01('0x15'),_0x41e195,JSON[_0xfd01('0x10')](_0x136338));_0x29e375(_0x136338);})[_0xfd01('0x1a')](function(_0x2dd343){logger['error'](_0xfd01('0x15'),_0x2dd343[_0xfd01('0x13')],_0x41e195);_0x2108a0(_0x1f10c6[_0xfd01('0x11')](0x1f4,_0x2dd343['message']));});});};exports[_0xfd01('0x1b')]=function(_0x5dcc54){var _0x3b2c22=this;return new Promise(function(_0x2f6dcd,_0x470244){return db[_0xfd01('0x16')]['findAll']({'raw':_0x5dcc54['options']?_0x5dcc54[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![],'where':_0x5dcc54[_0xfd01('0x18')]?_0x5dcc54[_0xfd01('0x18')][_0xfd01('0x1c')]||null:null,'attributes':[[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')][_0xfd01('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x21')))),_0xfd01('0x22')],[db[_0xfd01('0x1d')]['fn']('COUNT',db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xfd01('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0xfd01('0x24')],[db['sequelize']['fn']('AVG',db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x25')))),_0xfd01('0x26')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x27'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x28')))),_0xfd01('0x29')]]})[_0xfd01('0xa')](function(_0x3685cd){logger[_0xfd01('0xb')](_0xfd01('0x1b'),_0x5dcc54);logger[_0xfd01('0xe')]('AvgHandleTime',_0x5dcc54,JSON[_0xfd01('0x10')](_0x3685cd));_0x2f6dcd(_0x3685cd);})[_0xfd01('0x1a')](function(_0x1b9b3b){logger[_0xfd01('0x11')](_0xfd01('0x1b'),_0x1b9b3b[_0xfd01('0x13')],_0x5dcc54);_0x470244(_0x3b2c22[_0xfd01('0x11')](0x1f4,_0x1b9b3b['message']));});});};exports[_0xfd01('0x2a')]=function(_0x469c09){var _0x298116=this;return new Promise(function(_0x3e0803,_0x33339b){return db[_0xfd01('0x16')][_0xfd01('0x2b')]({'raw':_0x469c09[_0xfd01('0x18')]?_0x469c09[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![],'where':_0x469c09[_0xfd01('0x18')]?_0x469c09[_0xfd01('0x18')][_0xfd01('0x1c')]||null:null,'attributes':[[_0xfd01('0x2c'),'name'],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x2d')))),_0xfd01('0x2e')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x2f')))),_0xfd01('0x30')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x21')))),'outboundAnswerCallsDay'],[db[_0xfd01('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd01('0x1d')]['literal'](_0xfd01('0x31')))),_0xfd01('0x32')],[db[_0xfd01('0x1d')]['fn']('COUNT',db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x33')))),_0xfd01('0x34')],[db['sequelize']['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x35')))),_0xfd01('0x36')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db['sequelize'][_0xfd01('0x20')](_0xfd01('0x38')))),_0xfd01('0x39')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')]['literal'](_0xfd01('0x3a')))),_0xfd01('0x3b')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xfd01('0x20')](_0xfd01('0x3c')))),_0xfd01('0x3d')],[db[_0xfd01('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0xfd01('0x3e')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x3f')))),_0xfd01('0x40')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x41')))),_0xfd01('0x3e')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x42')))),_0xfd01('0x43')]],'group':[_0xfd01('0x2c')]})['then'](function(_0x5ccf6e){logger[_0xfd01('0xb')](_0xfd01('0x2a'),_0x469c09);logger[_0xfd01('0xe')](_0xfd01('0x2a'),_0x469c09,JSON[_0xfd01('0x10')](_0x5ccf6e));_0x3e0803(_0x5ccf6e);})[_0xfd01('0x1a')](function(_0x857530){logger[_0xfd01('0x11')](_0xfd01('0x2a'),_0x857530[_0xfd01('0x13')],_0x469c09);_0x33339b(_0x298116['error'](0x1f4,_0x857530['message']));});});};exports[_0xfd01('0x44')]=function(_0xa88b45){var _0x505426=this;return new Promise(function(_0x4ece45,_0x17abff){return db['CmHopperHistory'][_0xfd01('0x2b')]({'raw':_0xa88b45[_0xfd01('0x18')]?_0xa88b45[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![],'where':_0xa88b45[_0xfd01('0x18')]?_0xa88b45[_0xfd01('0x18')]['where']||null:null,'attributes':[['campaign',_0xfd01('0x45')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['col']('id')),_0xfd01('0x46')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x21')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xfd01('0xa')](function(_0x2d60e3){logger[_0xfd01('0xb')]('GetCampaignHopperHistory',_0xa88b45);logger[_0xfd01('0xe')]('GetCampaignHopperHistory',_0xa88b45,JSON[_0xfd01('0x10')](_0x2d60e3));_0x4ece45(_0x2d60e3);})[_0xfd01('0x1a')](function(_0x53fb98){logger['error']('GetCampaignHopperHistory',_0x53fb98[_0xfd01('0x13')],_0xa88b45);_0x17abff(_0x505426['error'](0x1f4,_0x53fb98['message']));});});}; \ No newline at end of file +var _0xadb4=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','catch','CreateCmHopperHistory','create','body','options','raw','then','AvgHandleTime','CmHopperHistory','findAll','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xadb4,0x1b6));var _0x4adb=function(_0x5e601d,_0x5b6ef6){_0x5e601d=_0x5e601d-0x0;var _0x5547ab=_0xadb4[_0x5e601d];return _0x5547ab;};'use strict';var _=require(_0x4adb('0x0'));var util=require(_0x4adb('0x1'));var moment=require('moment');var BPromise=require(_0x4adb('0x2'));var rs=require(_0x4adb('0x3'));var fs=require('fs');var Redis=require(_0x4adb('0x4'));var db=require(_0x4adb('0x5'))['db'];var utils=require(_0x4adb('0x6'));var logger=require('../../config/logger')(_0x4adb('0x7'));var config=require(_0x4adb('0x8'));var jayson=require(_0x4adb('0x9'));var client=jayson[_0x4adb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c07e,_0x15c33e,_0x30c0b7){return new BPromise(function(_0x26ea0d,_0x440b6f){return client[_0x4adb('0xb')](_0x14c07e,_0x30c0b7)['then'](function(_0x2f247a){logger[_0x4adb('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x15c33e,'request\x20sent');logger[_0x4adb('0xd')](_0x4adb('0xe'),_0x15c33e,_0x4adb('0xf'),JSON[_0x4adb('0x10')](_0x2f247a));if(_0x2f247a[_0x4adb('0x11')]){if(_0x2f247a['error'][_0x4adb('0x12')]===0x1f4){logger[_0x4adb('0x11')](_0x4adb('0x13'),_0x15c33e,_0x2f247a[_0x4adb('0x11')]['message']);return _0x440b6f(_0x2f247a[_0x4adb('0x11')][_0x4adb('0x14')]);}logger[_0x4adb('0x11')](_0x4adb('0x13'),_0x15c33e,_0x2f247a['error'][_0x4adb('0x14')]);return _0x26ea0d(_0x2f247a[_0x4adb('0x11')][_0x4adb('0x14')]);}else{logger[_0x4adb('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x15c33e,_0x4adb('0xf'));_0x26ea0d(_0x2f247a['result'][_0x4adb('0x14')]);}})[_0x4adb('0x15')](function(_0x46d875){logger[_0x4adb('0x11')](_0x4adb('0x13'),_0x15c33e,_0x46d875);_0x440b6f(_0x46d875);});});}exports[_0x4adb('0x16')]=function(_0x5749b8){var _0x5301bc=this;return new Promise(function(_0x5cde52,_0x590530){return db['CmHopperHistory'][_0x4adb('0x17')](_0x5749b8[_0x4adb('0x18')],{'raw':_0x5749b8['options']?_0x5749b8[_0x4adb('0x19')][_0x4adb('0x1a')]===undefined?!![]:![]:!![]})[_0x4adb('0x1b')](function(_0x1a61d3){logger['info'](_0x4adb('0x16'),_0x5749b8);logger[_0x4adb('0xd')](_0x4adb('0x16'),_0x5749b8,JSON['stringify'](_0x1a61d3));_0x5cde52(_0x1a61d3);})[_0x4adb('0x15')](function(_0x50f699){logger[_0x4adb('0x11')](_0x4adb('0x16'),_0x50f699['message'],_0x5749b8);_0x590530(_0x5301bc[_0x4adb('0x11')](0x1f4,_0x50f699[_0x4adb('0x14')]));});});};exports[_0x4adb('0x1c')]=function(_0x76d342){var _0x35a1c4=this;return new Promise(function(_0x3a1b5d,_0x1552c5){return db[_0x4adb('0x1d')][_0x4adb('0x1e')]({'raw':_0x76d342[_0x4adb('0x19')]?_0x76d342[_0x4adb('0x19')][_0x4adb('0x1a')]===undefined?!![]:![]:!![],'where':_0x76d342['options']?_0x76d342[_0x4adb('0x19')]['where']||null:null,'attributes':[[db[_0x4adb('0x1f')]['fn']('COUNT',db[_0x4adb('0x1f')][_0x4adb('0x20')]('id')),_0x4adb('0x21')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db['sequelize']['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x24')))),_0x4adb('0x25')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db['sequelize'][_0x4adb('0x23')](_0x4adb('0x26')))),_0x4adb('0x27')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')]['literal'](_0x4adb('0x28')))),_0x4adb('0x29')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x2a'),db['sequelize']['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x2b')))),_0x4adb('0x2c')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x2a'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x2d')))),_0x4adb('0x2e')]]})[_0x4adb('0x1b')](function(_0x5cd037){logger[_0x4adb('0xc')](_0x4adb('0x1c'),_0x76d342);logger['debug'](_0x4adb('0x1c'),_0x76d342,JSON['stringify'](_0x5cd037));_0x3a1b5d(_0x5cd037);})['catch'](function(_0xcecdb6){logger[_0x4adb('0x11')]('AvgHandleTime',_0xcecdb6[_0x4adb('0x14')],_0x76d342);_0x1552c5(_0x35a1c4[_0x4adb('0x11')](0x1f4,_0xcecdb6[_0x4adb('0x14')]));});});};exports[_0x4adb('0x2f')]=function(_0x1f8869){var _0x1293a9=this;return new Promise(function(_0x93d1e9,_0x37c21f){return db[_0x4adb('0x1d')][_0x4adb('0x1e')]({'raw':_0x1f8869[_0x4adb('0x19')]?_0x1f8869['options'][_0x4adb('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f8869['options']?_0x1f8869['options'][_0x4adb('0x30')]||null:null,'attributes':[[_0x4adb('0x31'),_0x4adb('0x32')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db['sequelize']['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db['sequelize']['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x33')))),_0x4adb('0x34')],[db['sequelize']['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')]['literal'](_0x4adb('0x24')))),_0x4adb('0x35')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')]['literal'](_0x4adb('0x36')))),_0x4adb('0x37')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db['sequelize'][_0x4adb('0x23')](_0x4adb('0x38')))),'outboundCongestionCallsDay'],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4adb('0x39')],[db[_0x4adb('0x1f')]['fn']('COUNT',db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4adb('0x3a')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x4adb('0x23')](_0x4adb('0x3b')))),_0x4adb('0x3c')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x3d')))),'outboundBlacklistCallsDay'],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db['sequelize']['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x3e')))),_0x4adb('0x3f')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db['sequelize'][_0x4adb('0x23')](_0x4adb('0x40')))),_0x4adb('0x41')],[db['sequelize']['fn'](_0x4adb('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x4adb('0x23')](_0x4adb('0x42')))),_0x4adb('0x43')],[db['sequelize']['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')]['literal'](_0x4adb('0x44')))),_0x4adb('0x41')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x45')))),_0x4adb('0x46')]],'group':[_0x4adb('0x31')]})[_0x4adb('0x1b')](function(_0x56cc68){logger[_0x4adb('0xc')]('GetVoiceQueueHopperHistory',_0x1f8869);logger['debug']('GetVoiceQueueHopperHistory',_0x1f8869,JSON[_0x4adb('0x10')](_0x56cc68));_0x93d1e9(_0x56cc68);})['catch'](function(_0x3c1235){logger['error'](_0x4adb('0x2f'),_0x3c1235[_0x4adb('0x14')],_0x1f8869);_0x37c21f(_0x1293a9['error'](0x1f4,_0x3c1235[_0x4adb('0x14')]));});});};exports[_0x4adb('0x47')]=function(_0x33fa32){var _0x48dd0f=this;return new Promise(function(_0x4ec673,_0x380833){return db[_0x4adb('0x1d')][_0x4adb('0x1e')]({'raw':_0x33fa32[_0x4adb('0x19')]?_0x33fa32[_0x4adb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x33fa32['options']?_0x33fa32[_0x4adb('0x19')][_0x4adb('0x30')]||null:null,'attributes':[['campaign',_0x4adb('0x32')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['col']('id')),_0x4adb('0x48')],[db[_0x4adb('0x1f')]['fn'](_0x4adb('0x22'),db[_0x4adb('0x1f')]['fn']('IF',db[_0x4adb('0x1f')][_0x4adb('0x23')](_0x4adb('0x24')))),'ivrAnswerCallsDay']],'group':[_0x4adb('0x31')]})[_0x4adb('0x1b')](function(_0x5aa72b){logger[_0x4adb('0xc')](_0x4adb('0x47'),_0x33fa32);logger[_0x4adb('0xd')](_0x4adb('0x47'),_0x33fa32,JSON[_0x4adb('0x10')](_0x5aa72b));_0x4ec673(_0x5aa72b);})['catch'](function(_0xa26d63){logger[_0x4adb('0x11')](_0x4adb('0x47'),_0xa26d63[_0x4adb('0x14')],_0x33fa32);_0x380833(_0x48dd0f[_0x4adb('0x11')](0x1f4,_0xa26d63[_0x4adb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e4dc8ff..842589a 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 _0x3d8e=['isAuthenticated','show','post','create','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','index','get','/describe','describe'];(function(_0x49af09,_0xafac0){var _0x317b0a=function(_0x93fe40){while(--_0x93fe40){_0x49af09['push'](_0x49af09['shift']());}};_0x317b0a(++_0xafac0);}(_0x3d8e,0x196));var _0xe3d8=function(_0x2709bb,_0x41eede){_0x2709bb=_0x2709bb-0x0;var _0x5a5bbd=_0x3d8e[_0x2709bb];return _0x5a5bbd;};'use strict';var multer=require(_0xe3d8('0x0'));var util=require(_0xe3d8('0x1'));var path=require(_0xe3d8('0x2'));var timeout=require(_0xe3d8('0x3'));var express=require(_0xe3d8('0x4'));var router=express[_0xe3d8('0x5')]();var fs_extra=require(_0xe3d8('0x6'));var auth=require(_0xe3d8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe3d8('0x8'));var controller=require(_0xe3d8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe3d8('0xa')]);router[_0xe3d8('0xb')](_0xe3d8('0xc'),auth['isAuthenticated'](),controller[_0xe3d8('0xd')]);router['get']('/:id',auth[_0xe3d8('0xe')](),controller[_0xe3d8('0xf')]);router[_0xe3d8('0x10')]('/',auth['isAuthenticated'](),controller[_0xe3d8('0x11')]);router['put'](_0xe3d8('0x12'),auth[_0xe3d8('0xe')](),controller['update']);module[_0xe3d8('0x13')]=router; \ No newline at end of file +var _0xf75f=['create','put','/:id','update','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','post'];(function(_0x28af0a,_0x5386b9){var _0x3f087e=function(_0x4bc005){while(--_0x4bc005){_0x28af0a['push'](_0x28af0a['shift']());}};_0x3f087e(++_0x5386b9);}(_0xf75f,0x137));var _0xff75=function(_0x2f6548,_0x5278af){_0x2f6548=_0x2f6548-0x0;var _0x207ac3=_0xf75f[_0x2f6548];return _0x207ac3;};'use strict';var multer=require('multer');var util=require(_0xff75('0x0'));var path=require('path');var timeout=require(_0xff75('0x1'));var express=require(_0xff75('0x2'));var router=express['Router']();var fs_extra=require(_0xff75('0x3'));var auth=require(_0xff75('0x4'));var interaction=require(_0xff75('0x5'));var config=require(_0xff75('0x6'));var controller=require(_0xff75('0x7'));router[_0xff75('0x8')]('/',auth['isAuthenticated'](),controller[_0xff75('0x9')]);router[_0xff75('0x8')](_0xff75('0xa'),auth[_0xff75('0xb')](),controller['describe']);router[_0xff75('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xff75('0xc')]('/',auth[_0xff75('0xb')](),controller[_0xff75('0xd')]);router[_0xff75('0xe')](_0xff75('0xf'),auth[_0xff75('0xb')](),controller[_0xff75('0x10')]);module[_0xff75('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e50cec0..73d33c9 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 _0xe700=['STRING','name','sequelize','exports'];(function(_0xc1af5c,_0x3ee814){var _0x47a61c=function(_0x5c406f){while(--_0x5c406f){_0xc1af5c['push'](_0xc1af5c['shift']());}};_0x47a61c(++_0x3ee814);}(_0xe700,0x16a));var _0x0e70=function(_0x3781b4,_0x39f19d){_0x3781b4=_0x3781b4-0x0;var _0x3b280e=_0xe700[_0x3781b4];return _0x3b280e;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'name':{'type':Sequelize[_0x0e70('0x2')],'unique':_0x0e70('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0e70('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x943c=['sequelize','exports','STRING','name'];(function(_0x48ea83,_0xb7b30b){var _0x1f6925=function(_0x1f307f){while(--_0x1f307f){_0x48ea83['push'](_0x48ea83['shift']());}};_0x1f6925(++_0xb7b30b);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc943('0x0'));module[_0xc943('0x1')]={'name':{'type':Sequelize[_0xc943('0x2')],'unique':_0xc943('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 366708e..89e5883 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 _0xb50d=['emit','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','update','then','get','Lists','destroy','stack','name','send','index','map','CmList','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','ListId','findOne','Disposition','nolimit','order','removeDispositions','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','hasOwnProperty','getContactsCsv','OrderBy','alias','cm_contacts','c.ListId\x20=\x20?','distinct','customField_','field','item','CmContactId\x20=\x20c.id','additionalPhone_','select','description','cm_contact_has_items','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','findAndCountAll','addAgents','spread','userCmList:save','removeAgents'];(function(_0x1fdd50,_0x478860){var _0xd2c2f3=function(_0x49bfe0){while(--_0x49bfe0){_0x1fdd50['push'](_0x1fdd50['shift']());}};_0xd2c2f3(++_0x478860);}(_0xb50d,0x14d));var _0xdb50=function(_0x474985,_0x5cce35){_0x474985=_0x474985-0x0;var _0x559926=_0xb50d[_0x474985];return _0x559926;};'use strict';var emlformat=require(_0xdb50('0x0'));var rimraf=require(_0xdb50('0x1'));var zipdir=require(_0xdb50('0x2'));var jsonpatch=require(_0xdb50('0x3'));var rp=require('request-promise');var moment=require(_0xdb50('0x4'));var BPromise=require(_0xdb50('0x5'));var Mustache=require(_0xdb50('0x6'));var util=require(_0xdb50('0x7'));var path=require(_0xdb50('0x8'));var sox=require(_0xdb50('0x9'));var csv=require(_0xdb50('0xa'));var ejs=require(_0xdb50('0xb'));var fs=require('fs');var fs_extra=require(_0xdb50('0xc'));var _=require(_0xdb50('0xd'));var squel=require('squel');var crypto=require(_0xdb50('0xe'));var jsforce=require(_0xdb50('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdb50('0xa'));var querystring=require(_0xdb50('0x10'));var Papa=require('papaparse');var Redis=require(_0xdb50('0x11'));var authService=require(_0xdb50('0x12'));var qs=require(_0xdb50('0x13'));var as=require(_0xdb50('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb50('0x15'))(_0xdb50('0x16'));var utils=require(_0xdb50('0x17'));var config=require(_0xdb50('0x18'));var licenseUtil=require(_0xdb50('0x19'));var db=require(_0xdb50('0x1a'))['db'];var csv_results;config[_0xdb50('0x1b')]=_[_0xdb50('0x1c')](config[_0xdb50('0x1b')],{'host':_0xdb50('0x1d'),'port':0x18eb});var socket=require(_0xdb50('0x1e'))(new Redis(config[_0xdb50('0x1b')]));require('./cmList.socket')[_0xdb50('0x1f')](socket);function respondWithStatusCode(_0x469509,_0x583e17){_0x583e17=_0x583e17||0xcc;return function(_0x4fdbd8){if(_0x4fdbd8){return _0x469509[_0xdb50('0x20')](_0x583e17);}return _0x469509[_0xdb50('0x21')](_0x583e17)[_0xdb50('0x22')]();};}function respondWithResult(_0x43b7c2,_0x5dda5d){_0x5dda5d=_0x5dda5d||0xc8;return function(_0x219a97){if(_0x219a97){return _0x43b7c2[_0xdb50('0x21')](_0x5dda5d)[_0xdb50('0x23')](_0x219a97);}};}function respondWithFilteredResult(_0x5a7ad1,_0x4bf0bb){return function(_0x259dfc){if(_0x259dfc){var _0xa725e=typeof _0x4bf0bb[_0xdb50('0x24')]===_0xdb50('0x25')&&typeof _0x4bf0bb['limit']==='undefined';var _0xfe02ac=_0x259dfc[_0xdb50('0x26')];var _0xd393bc=_0xa725e?0x0:_0x4bf0bb['offset'];var _0x23e58a=_0xa725e?_0x259dfc[_0xdb50('0x26')]:_0x4bf0bb[_0xdb50('0x24')]+_0x4bf0bb['limit'];var _0x35cf4f;if(_0x23e58a>=_0xfe02ac){_0x23e58a=_0xfe02ac;_0x35cf4f=0xc8;}else{_0x35cf4f=0xce;}_0x5a7ad1['status'](_0x35cf4f);return _0x5a7ad1['set'](_0xdb50('0x27'),_0xd393bc+'-'+_0x23e58a+'/'+_0xfe02ac)[_0xdb50('0x23')](_0x259dfc);}return null;};}function patchUpdates(_0x412699){return function(_0x206cf1){try{jsonpatch['apply'](_0x206cf1,_0x412699,!![]);}catch(_0x14bdb1){return BPromise[_0xdb50('0x28')](_0x14bdb1);}return _0x206cf1['save']();};}function saveUpdates(_0x57dda7,_0x5b697c){return function(_0x20562d){if(_0x20562d){return _0x20562d[_0xdb50('0x29')](_0x57dda7)['then'](function(_0x5f36c9){return _0x5f36c9;});}return null;};}function removeEntity(_0x5c6800,_0x3b5736){return function(_0x5d8b67){if(_0x5d8b67){return _0x5d8b67['destroy']()[_0xdb50('0x2a')](function(){var _0x5ad6e0=_0x5d8b67[_0xdb50('0x2b')]({'plain':!![]});var _0x305be7=_0xdb50('0x2c');return db['UserProfileResource'][_0xdb50('0x2d')]({'where':{'type':_0x305be7,'resourceId':_0x5ad6e0['id']}})[_0xdb50('0x2a')](function(){return _0x5d8b67;});})['then'](function(){_0x5c6800[_0xdb50('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45aef9,_0x50b215){return function(_0x270fa8){if(!_0x270fa8){_0x45aef9[_0xdb50('0x20')](0x194);}return _0x270fa8;};}function handleError(_0x77721b,_0x5d7c5a){_0x5d7c5a=_0x5d7c5a||0x1f4;return function(_0x44dc48){logger['error'](_0x44dc48[_0xdb50('0x2e')]);if(_0x44dc48[_0xdb50('0x2f')]){delete _0x44dc48[_0xdb50('0x2f')];}_0x77721b[_0xdb50('0x21')](_0x5d7c5a)[_0xdb50('0x30')](_0x44dc48);};}exports[_0xdb50('0x31')]=function(_0x4301dd,_0x26276b){var _0xce323={},_0x45d163={},_0x3cf70b={'count':0x0,'rows':[]};var _0x2350bc=_[_0xdb50('0x32')](db[_0xdb50('0x33')][_0xdb50('0x34')],function(_0x18d993){return{'name':_0x18d993['fieldName'],'type':_0x18d993['type'][_0xdb50('0x35')]};});_0x45d163[_0xdb50('0x36')]=_[_0xdb50('0x32')](_0x2350bc,_0xdb50('0x2f'));_0x45d163['query']=_['keys'](_0x4301dd[_0xdb50('0x37')]);_0x45d163[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0x45d163[_0xdb50('0x36')],_0x45d163[_0xdb50('0x37')]);_0xce323[_0xdb50('0x3a')]=_[_0xdb50('0x39')](_0x45d163['model'],qs[_0xdb50('0x3b')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x3b')]));_0xce323[_0xdb50('0x3a')]=_0xce323[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0xce323[_0xdb50('0x3a')]:_0x45d163[_0xdb50('0x36')];if(!_0x4301dd['query']['hasOwnProperty']('nolimit')){_0xce323[_0xdb50('0x3d')]=qs[_0xdb50('0x3d')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x3d')]);_0xce323[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x24')]);}_0xce323['order']=qs[_0xdb50('0x3e')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x3e')]);_0xce323[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x4301dd[_0xdb50('0x37')],_0x45d163[_0xdb50('0x38')]),_0x2350bc);if(_0x4301dd[_0xdb50('0x37')][_0xdb50('0x41')]){_0xce323[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0xce323[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x2350bc,function(_0x5efad8){if(_0x5efad8[_0xdb50('0x43')]!==_0xdb50('0x44')){var _0x4108a6={};_0x4108a6[_0x5efad8[_0xdb50('0x2f')]]={'$like':'%'+_0x4301dd['query'][_0xdb50('0x41')]+'%'};return _0x4108a6;}})});}_0xce323=_[_0xdb50('0x42')]({},_0xce323,_0x4301dd[_0xdb50('0x45')]);var _0xb15bb4={'where':_0xce323[_0xdb50('0x3f')]};return db[_0xdb50('0x33')]['count'](_0xb15bb4)['then'](function(_0x3e2f55){_0x3cf70b[_0xdb50('0x26')]=_0x3e2f55;if(_0x4301dd[_0xdb50('0x37')]['includeAll']){_0xce323[_0xdb50('0x46')]=[{'all':!![]}];}return db[_0xdb50('0x33')][_0xdb50('0x47')](_0xce323);})[_0xdb50('0x2a')](function(_0x122a87){_0x3cf70b[_0xdb50('0x48')]=_0x122a87;return _0x3cf70b;})[_0xdb50('0x2a')](respondWithFilteredResult(_0x26276b,_0xce323))[_0xdb50('0x49')](handleError(_0x26276b,null));};exports[_0xdb50('0x4a')]=function(_0x39055c,_0x14b53f){var _0x39f941={'raw':![],'where':{'id':_0x39055c['params']['id']}},_0xc9f120={};_0xc9f120[_0xdb50('0x36')]=_[_0xdb50('0x4b')](db[_0xdb50('0x33')][_0xdb50('0x34')]);_0xc9f120[_0xdb50('0x37')]=_[_0xdb50('0x4b')](_0x39055c['query']);_0xc9f120[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0xc9f120[_0xdb50('0x36')],_0xc9f120['query']);_0x39f941[_0xdb50('0x3a')]=_[_0xdb50('0x39')](_0xc9f120['model'],qs[_0xdb50('0x3b')](_0x39055c[_0xdb50('0x37')][_0xdb50('0x3b')]));_0x39f941[_0xdb50('0x3a')]=_0x39f941['attributes'][_0xdb50('0x3c')]?_0x39f941[_0xdb50('0x3a')]:_0xc9f120[_0xdb50('0x36')];if(_0x39055c[_0xdb50('0x37')][_0xdb50('0x4c')]){_0x39f941[_0xdb50('0x46')]=[{'all':!![]}];}_0x39f941=_[_0xdb50('0x42')]({},_0x39f941,_0x39055c['options']);return db[_0xdb50('0x33')][_0xdb50('0x4d')](_0x39f941)['then'](handleEntityNotFound(_0x14b53f,null))[_0xdb50('0x2a')](respondWithResult(_0x14b53f,null))[_0xdb50('0x49')](handleError(_0x14b53f,null));};exports['create']=function(_0x252612,_0x43ba87){return db[_0xdb50('0x33')]['create'](_0x252612[_0xdb50('0x4e')],{})['then'](function(_0x300890){var _0x564924=_0x252612[_0xdb50('0x4f')][_0xdb50('0x2b')]({'plain':!![]});if(!_0x564924)throw new Error(_0xdb50('0x50'));if(_0x564924[_0xdb50('0x51')]===_0xdb50('0x4f')){var _0x5366df=_0x300890[_0xdb50('0x2b')]({'plain':!![]});var _0x2003d9=_0xdb50('0x2c');return db[_0xdb50('0x52')]['find']({'where':{'name':_0x2003d9,'userProfileId':_0x564924[_0xdb50('0x53')]},'raw':!![]})[_0xdb50('0x2a')](function(_0x80c0d6){if(_0x80c0d6&&_0x80c0d6['autoAssociation']===0x0){return db[_0xdb50('0x54')][_0xdb50('0x55')]({'name':_0x5366df[_0xdb50('0x2f')],'resourceId':_0x5366df['id'],'type':_0x80c0d6[_0xdb50('0x2f')],'sectionId':_0x80c0d6['id']},{})[_0xdb50('0x2a')](function(){return _0x300890;});}else{return _0x300890;}})[_0xdb50('0x49')](function(_0x1697e9){logger[_0xdb50('0x56')](_0xdb50('0x57'),_0x1697e9);throw _0x1697e9;});}return _0x300890;})['then'](respondWithResult(_0x43ba87,0xc9))[_0xdb50('0x49')](handleError(_0x43ba87,null));};exports[_0xdb50('0x29')]=function(_0x463ea5,_0x24ea5f){if(_0x463ea5['body']['id']){delete _0x463ea5[_0xdb50('0x4e')]['id'];}return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x463ea5[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x24ea5f,null))[_0xdb50('0x2a')](saveUpdates(_0x463ea5['body'],null))[_0xdb50('0x2a')](respondWithResult(_0x24ea5f,null))[_0xdb50('0x49')](handleError(_0x24ea5f,null));};exports['destroy']=function(_0x526d1d,_0xb54004){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x526d1d[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0xb54004,null))[_0xdb50('0x2a')](removeEntity(_0xb54004,null))[_0xdb50('0x49')](handleError(_0xb54004,null));};exports['describe']=function(_0x4dfbf4,_0x5f2dd9){return db[_0xdb50('0x33')]['describe']()[_0xdb50('0x2a')](respondWithResult(_0x5f2dd9,null))[_0xdb50('0x49')](handleError(_0x5f2dd9,null));};exports[_0xdb50('0x59')]=function(_0x366e03,_0x20365d,_0x5a5fae){if(_0x366e03['body']['id']){delete _0x366e03[_0xdb50('0x4e')]['id'];}return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x366e03[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x20365d,null))[_0xdb50('0x2a')](function(_0x29d9fc){if(_0x29d9fc){_0x366e03['body'][_0xdb50('0x5a')]=_0x29d9fc['id'];return db['Disposition'][_0xdb50('0x55')](_0x366e03[_0xdb50('0x4e')]);}})[_0xdb50('0x2a')](respondWithResult(_0x20365d,null))[_0xdb50('0x49')](handleError(_0x20365d,null));};exports['getDispositions']=function(_0x1c3f99,_0x54c332,_0x14a9ee){var _0x380aa3={'raw':![],'where':{}};var _0x1fdb35={};var _0x39258a={'count':0x0,'rows':[]};return db[_0xdb50('0x33')][_0xdb50('0x5b')]({'where':{'id':_0x1c3f99[_0xdb50('0x58')]['id']}})['then'](handleEntityNotFound(_0x54c332,null))['then'](function(_0x2fc09f){if(_0x2fc09f){_0x1fdb35['model']=_['keys'](db[_0xdb50('0x5c')]['rawAttributes']);_0x1fdb35[_0xdb50('0x37')]=_[_0xdb50('0x4b')](_0x1c3f99[_0xdb50('0x37')]);_0x1fdb35[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0x1fdb35[_0xdb50('0x36')],_0x1fdb35[_0xdb50('0x37')]);_0x380aa3['attributes']=_[_0xdb50('0x39')](_0x1fdb35['model'],qs['fields'](_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x3b')]));_0x380aa3['attributes']=_0x380aa3[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0x380aa3['attributes']:_0x1fdb35[_0xdb50('0x36')];if(!_0x1c3f99[_0xdb50('0x37')]['hasOwnProperty'](_0xdb50('0x5d'))){_0x380aa3[_0xdb50('0x3d')]=qs['limit'](_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x3d')]);_0x380aa3[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x24')]);}_0x380aa3[_0xdb50('0x5e')]=qs[_0xdb50('0x3e')](_0x1c3f99['query'][_0xdb50('0x3e')]);_0x380aa3['where']=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x1c3f99[_0xdb50('0x37')],_0x1fdb35[_0xdb50('0x38')]));_0x380aa3[_0xdb50('0x3f')]['ListId']=_0x2fc09f['id'];if(_0x1c3f99[_0xdb50('0x37')]['filter']){_0x380aa3[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0x380aa3[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x380aa3[_0xdb50('0x3a')],function(_0x2623e9){var _0x1bf5a4={};_0x1bf5a4[_0x2623e9]={'$like':'%'+_0x1c3f99[_0xdb50('0x37')]['filter']+'%'};return _0x1bf5a4;})});}_0x380aa3=_[_0xdb50('0x42')]({},_0x380aa3,_0x1c3f99[_0xdb50('0x45')]);return db['Disposition'][_0xdb50('0x26')]({'where':_0x380aa3[_0xdb50('0x3f')]})['then'](function(_0x197331){_0x39258a[_0xdb50('0x26')]=_0x197331;if(_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x4c')]){_0x380aa3[_0xdb50('0x46')]=[{'all':!![]}];}return db[_0xdb50('0x5c')][_0xdb50('0x47')](_0x380aa3);})[_0xdb50('0x2a')](function(_0x193370){_0x39258a[_0xdb50('0x48')]=_0x193370;return _0x39258a;});}})['then'](respondWithFilteredResult(_0x54c332,_0x380aa3))[_0xdb50('0x49')](handleError(_0x54c332,null));};exports['removeDispositions']=function(_0x222dae,_0xa21111,_0x558bd7){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x222dae['params']['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0xa21111,null))[_0xdb50('0x2a')](function(_0x434a28){if(_0x434a28){return _0x434a28[_0xdb50('0x5f')](_0x222dae[_0xdb50('0x37')][_0xdb50('0x60')]);}})[_0xdb50('0x2a')](respondWithStatusCode(_0xa21111,null))[_0xdb50('0x49')](handleError(_0xa21111,null));};exports['addContacts']=function(_0x533c9e,_0x203854,_0x3dacff){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x533c9e[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x203854,null))[_0xdb50('0x2a')](function(_0x4c4a77){if(_0x4c4a77){var _0x2eb39f=[];var _0x551f37={'success':[],'errors':[]};return db[_0xdb50('0x61')][_0xdb50('0x62')]()[_0xdb50('0x2a')](function(_0x364c5f){if(_0x533c9e[_0xdb50('0x4e')][_0xdb50('0x63')]&&_[_0xdb50('0x64')](_0x533c9e[_0xdb50('0x4e')][_0xdb50('0x63')])){if(_0x533c9e[_0xdb50('0x4e')][_0xdb50('0x63')][_0xdb50('0x3c')]){_0x533c9e['body']['tags']=_0x533c9e['body'][_0xdb50('0x63')][_0xdb50('0x65')](';')+';';}else{_0x533c9e[_0xdb50('0x4e')]['tags']=null;}}else{_0x533c9e['body']['tags']=null;}if(_0x533c9e[_0xdb50('0x4e')]&&_['isArray'](_0x533c9e[_0xdb50('0x4e')])){for(var _0x34ba08=0x0;_0x34ba08<_0x533c9e['body'][_0xdb50('0x3c')];_0x34ba08+=0x1){_0x533c9e[_0xdb50('0x4e')][_0x34ba08]['ListId']=_0x533c9e[_0xdb50('0x58')]['id'];_0x2eb39f[_0xdb50('0x66')](_0x533c9e[_0xdb50('0x4e')][_0x34ba08]);}return BPromise[_0xdb50('0x67')](_0x2eb39f,function(_0x30d275){return db[_0xdb50('0x61')][_0xdb50('0x55')](_[_0xdb50('0x68')](_0x30d275,[_0xdb50('0x60'),'id'])||{},{'fields':_[_0xdb50('0x4b')](_0x364c5f),'raw':!![]})[_0xdb50('0x2a')](function(_0x1b389d){_0x551f37[_0xdb50('0x69')]['push'](_0x1b389d[_0xdb50('0x6a')]);})['catch'](function(_0x3a4037){_0x551f37['errors']['push']({'data':_0x30d275,'error':_0x3a4037[_0xdb50('0x6b')]});});})[_0xdb50('0x2a')](function(_0xae3c1){return _0x551f37;})['catch'](function(_0x4d099d){return _0x4d099d;});}else{_0x203854[_0xdb50('0x21')](0x190)[_0xdb50('0x23')]({'message':_0xdb50('0x6c')});}});}})[_0xdb50('0x2a')](respondWithResult(_0x203854,null))['catch'](handleError(_0x203854,null));};exports[_0xdb50('0x6d')]=function(_0x1cd8e7,_0x206469,_0x3a6174){var _0x79ffda;return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x1cd8e7['params']['id']},'include':[{'model':db[_0xdb50('0x6e')],'as':_0xdb50('0x6f')}]})[_0xdb50('0x2a')](handleEntityNotFound(_0x206469,null))[_0xdb50('0x2a')](function(_0x4ce491){if(_0x4ce491){_0x79ffda=_0x4ce491;return db[_0xdb50('0x61')]['rawAttributes'];}})[_0xdb50('0x2a')](function(_0x105142){if(_0x105142){var _0x2b4907={};var _0x16d924={};_0x16d924[_0xdb50('0x36')]=_[_0xdb50('0x70')](_[_0xdb50('0x4b')](_0x105142),_[_0xdb50('0x32')](_0x79ffda[_0xdb50('0x6f')],function(_0x5ac133){return util[_0xdb50('0x71')]('cf_%d',_0x5ac133['id']);}));_0x16d924[_0xdb50('0x37')]=_['keys'](_0x1cd8e7['query']);_0x16d924[_0xdb50('0x38')]=_['intersection'](_0x16d924[_0xdb50('0x36')],_0x16d924['query']);_0x2b4907[_0xdb50('0x3a')]=_['intersection'](_0x16d924['model'],qs[_0xdb50('0x3b')](_0x1cd8e7['query']['fields']));_0x2b4907[_0xdb50('0x3a')]=_0x2b4907['attributes'][_0xdb50('0x3c')]?_0x2b4907[_0xdb50('0x3a')]:_0x16d924[_0xdb50('0x36')];if(!_0x1cd8e7['query'][_0xdb50('0x72')]('nolimit')){_0x2b4907[_0xdb50('0x3d')]=qs['limit'](_0x1cd8e7[_0xdb50('0x37')][_0xdb50('0x3d')]);_0x2b4907[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x1cd8e7['query'][_0xdb50('0x24')]);}_0x2b4907[_0xdb50('0x5e')]=qs['sort'](_0x1cd8e7[_0xdb50('0x37')]['sort']);_0x2b4907[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x1cd8e7[_0xdb50('0x37')],_0x16d924['filters']));_0x2b4907['raw']=!![];if(_0x1cd8e7[_0xdb50('0x37')]['filter']){_0x2b4907[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0x2b4907[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x2b4907[_0xdb50('0x3a')],function(_0x32a5bc){var _0x5bbe26={};_0x5bbe26[_0x32a5bc]={'$like':'%'+_0x1cd8e7['query'][_0xdb50('0x41')]+'%'};return _0x5bbe26;})});}_0x2b4907=_[_0xdb50('0x42')]({},_0x2b4907,_0x1cd8e7[_0xdb50('0x45')]);return _0x79ffda[_0xdb50('0x6d')](_0x2b4907);}})[_0xdb50('0x2a')](respondWithResult(_0x206469,null))[_0xdb50('0x49')](handleError(_0x206469,null));};exports[_0xdb50('0x73')]=function(_0x365e78,_0x2a3ed1,_0x7de05c){var _0x57c084;var _0x324d0e;var _0x315e0c;var _0x1c0707=_0x365e78[_0xdb50('0x58')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0xdb50('0x2f')],'raw':!![],'order':[_0xdb50('0x74')]})[_0xdb50('0x2a')](function(_0x41b7cb){_0x57c084=_0x41b7cb;var _0x2f8073=_[_0xdb50('0x4b')](db[_0xdb50('0x61')]['rawAttributes']);return db[_0xdb50('0x6e')][_0xdb50('0x47')]({'raw':!![],'attributes':['id',_0xdb50('0x75')]})['then'](function(_0x17d3db){_0x324d0e=_0x17d3db;var _0x8c9cca=squel['select']()['fields'](_0x2f8073)['from'](_0xdb50('0x76'),'c')[_0xdb50('0x3f')](_0xdb50('0x77'),_0x1c0707)['where']('c.deletedAt\x20is\x20null')[_0xdb50('0x78')]();for(var _0x4b1ab2=0x0;_0x4b1ab2<_0x324d0e['length'];_0x4b1ab2++){_0x8c9cca['field']('c.cf_'+_0x324d0e[_0x4b1ab2]['id'],_0xdb50('0x79')+_0x324d0e[_0x4b1ab2][_0xdb50('0x75')]);}for(var _0x4b1ab2=0x0;_0x4b1ab2<_0x57c084[_0xdb50('0x3c')];_0x4b1ab2++){_0x8c9cca[_0xdb50('0x7a')](squel['select']()[_0xdb50('0x7a')](_0xdb50('0x7b'))['from']('cm_contact_has_items')[_0xdb50('0x3f')]('ItemTypeId\x20=\x20?',_0x57c084[_0x4b1ab2]['id'])[_0xdb50('0x3f')](_0xdb50('0x7c')),_0xdb50('0x7d')+_0x57c084[_0x4b1ab2][_0xdb50('0x2f')]);_0x8c9cca[_0xdb50('0x7a')](squel[_0xdb50('0x7e')]()['field'](_0xdb50('0x7f'))['from'](_0xdb50('0x80'))[_0xdb50('0x3f')](_0xdb50('0x81'),_0x57c084[_0x4b1ab2]['id'])['where']('CmContactId\x20=\x20c.id'),_0xdb50('0x82')+_0x57c084[_0x4b1ab2]['name']);}var _0x19a879=[];_0x19a879[_0xdb50('0x66')](_0x8c9cca[_0xdb50('0x83')]());BPromise['each'](_0x19a879,handleQuery)[_0xdb50('0x2a')](function(_0x42bd88){handleQuery(_0x8c9cca[_0xdb50('0x83')]());var _0x50ec48=csv_results[0x0];if(!_[_0xdb50('0x84')](_0x50ec48)){var _0x438772=toCsv(_0x50ec48);var _0x1fc920=Date[_0xdb50('0x85')]();fs['writeFileSync'](util[_0xdb50('0x71')](_0xdb50('0x86'),_0x1c0707,_0x1fc920),_0x438772);_0x2a3ed1[_0xdb50('0x87')](_0xdb50('0x88'),_0xdb50('0x89')+util[_0xdb50('0x71')](_0xdb50('0x8a'),_0x1c0707,_0x1fc920));_0x2a3ed1[_0xdb50('0x87')](_0xdb50('0x8b'),'text/csv');return _0x2a3ed1[_0xdb50('0x8c')](util[_0xdb50('0x71')](_0xdb50('0x86'),_0x1c0707,_0x1fc920));}else{return _0x2a3ed1[_0xdb50('0x20')](0xcc);}});});});};exports['addCustomField']=function(_0x438e45,_0x3e5d99,_0x4d2ea7){var _0xc67b06;delete _0x438e45[_0xdb50('0x4e')]['id'];return db[_0xdb50('0x33')]['findOne']({'where':{'id':_0x438e45[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x3e5d99,null))[_0xdb50('0x2a')](function(_0x56a2f3){if(_0x56a2f3){return db[_0xdb50('0x8d')][_0xdb50('0x8e')](function(_0x2bcc4a){return db['CmCustomField'][_0xdb50('0x55')](_0x438e45[_0xdb50('0x4e')],{'transaction':_0x2bcc4a})[_0xdb50('0x2a')](function(_0x265084){_0xc67b06=_0x265084;return _0x56a2f3[_0xdb50('0x8f')](_0x265084,{'transaction':_0x2bcc4a});})['then'](function(){var _0x305d4a={'type':db[_0xdb50('0x90')][_0xdb50('0x91')],'transaction':_0x2bcc4a};switch(_0x438e45[_0xdb50('0x4e')][_0xdb50('0x43')]){case _0xdb50('0x92'):_0x305d4a[_0xdb50('0x43')]=db[_0xdb50('0x90')]['TEXT'];break;case _0xdb50('0x93'):_0x305d4a[_0xdb50('0x43')]=db[_0xdb50('0x90')][_0xdb50('0x94')];break;case _0xdb50('0x95'):_0x305d4a[_0xdb50('0x43')]=db[_0xdb50('0x90')][_0xdb50('0x96')];_0x305d4a[_0xdb50('0x97')]=![];break;default:}return db[_0xdb50('0x8d')][_0xdb50('0x98')][_0xdb50('0x99')](_0xdb50('0x76'),util[_0xdb50('0x71')]('cf_%s',_0xc67b06['id']),_0x305d4a);})[_0xdb50('0x2a')](function(){return _0xc67b06;});});}})[_0xdb50('0x2a')](respondWithResult(_0x3e5d99,null))[_0xdb50('0x49')](handleError(_0x3e5d99,null));};exports['getCustomFields']=function(_0x4f1fbd,_0x3afca4,_0x599ae1){var _0x117fac={};var _0x2a11f7={};var _0x5f4f32;var _0x3bd114;return db[_0xdb50('0x33')][_0xdb50('0x5b')]({'where':{'id':_0x4f1fbd['params']['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x3afca4,null))[_0xdb50('0x2a')](function(_0x2a125e){if(_0x2a125e){_0x5f4f32=_0x2a125e;_0x2a11f7[_0xdb50('0x36')]=_[_0xdb50('0x4b')](db[_0xdb50('0x6e')][_0xdb50('0x34')]);_0x2a11f7[_0xdb50('0x37')]=_[_0xdb50('0x4b')](_0x4f1fbd['query']);_0x2a11f7[_0xdb50('0x38')]=_['intersection'](_0x2a11f7[_0xdb50('0x36')],_0x2a11f7[_0xdb50('0x37')]);_0x117fac[_0xdb50('0x3a')]=_[_0xdb50('0x39')](_0x2a11f7['model'],qs[_0xdb50('0x3b')](_0x4f1fbd[_0xdb50('0x37')][_0xdb50('0x3b')]));_0x117fac[_0xdb50('0x3a')]=_0x117fac[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0x117fac[_0xdb50('0x3a')]:_0x2a11f7[_0xdb50('0x36')];_0x117fac[_0xdb50('0x5e')]=qs[_0xdb50('0x3e')](_0x4f1fbd[_0xdb50('0x37')]['sort']);_0x117fac[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x4f1fbd[_0xdb50('0x37')],_0x2a11f7[_0xdb50('0x38')]));_0x117fac[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0x117fac[_0xdb50('0x3f')],{'$or':[{'ListId':_0x2a125e['id']},{'ListId':null}]});if(_0x4f1fbd[_0xdb50('0x37')][_0xdb50('0x41')]){_0x117fac['where']=_[_0xdb50('0x42')](_0x117fac[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x117fac[_0xdb50('0x3a')],function(_0x4e5109){var _0x508440={};_0x508440[_0x4e5109]={'$like':'%'+_0x4f1fbd[_0xdb50('0x37')]['filter']+'%'};return _0x508440;})});}_0x117fac=_[_0xdb50('0x42')]({},_0x117fac,_0x4f1fbd[_0xdb50('0x45')]);return db[_0xdb50('0x6e')][_0xdb50('0x9a')](_0x117fac);}})[_0xdb50('0x2a')](respondWithResult(_0x3afca4,null))[_0xdb50('0x49')](handleError(_0x3afca4,null));};exports['getGlobalCustomFields']=function(_0x4e7a62,_0x4b5cfe){return db[_0xdb50('0x6e')][_0xdb50('0x9a')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x4b5cfe,null))[_0xdb50('0x2a')](function(_0x238652){return _0x238652;})['then'](respondWithResult(_0x4b5cfe,null))['catch'](handleError(_0x4b5cfe,null));};exports[_0xdb50('0x9b')]=function(_0x1bb1bd,_0x5615e5,_0x260681){return db['CmList'][_0xdb50('0x4d')]({'where':{'id':_0x1bb1bd[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x5615e5,null))[_0xdb50('0x2a')](function(_0x1c941a){if(_0x1c941a){return _0x1c941a[_0xdb50('0x9b')](_0x1bb1bd['body'][_0xdb50('0x60')],_[_0xdb50('0x68')](_0x1bb1bd[_0xdb50('0x4e')],['ids','id'])||{})[_0xdb50('0x9c')](function(_0x49f7e4){for(var _0x15a763=0x0;_0x15a763<_0x1bb1bd[_0xdb50('0x4e')][_0xdb50('0x60')][_0xdb50('0x3c')];_0x15a763+=0x1){socket['emit'](_0xdb50('0x9d'),{'UserId':Number(_0x1bb1bd[_0xdb50('0x4e')][_0xdb50('0x60')][_0x15a763]),'CmListId':Number(_0x1bb1bd[_0xdb50('0x58')]['id'])});}return _0x49f7e4;});}})[_0xdb50('0x2a')](respondWithResult(_0x5615e5,null))[_0xdb50('0x49')](handleError(_0x5615e5,null));};exports['removeAgents']=function(_0x39add9,_0x39ce20,_0x7d9a7e){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x39add9[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x39ce20,null))['then'](function(_0x2e08c1){if(_0x2e08c1){return _0x2e08c1[_0xdb50('0x9e')](_0x39add9[_0xdb50('0x37')][_0xdb50('0x60')])['then'](function(){if(_[_0xdb50('0x64')](_0x39add9[_0xdb50('0x37')]['ids'])){for(var _0x58c178=0x0;_0x58c178<_0x39add9['query'][_0xdb50('0x60')][_0xdb50('0x3c')];_0x58c178+=0x1){socket[_0xdb50('0x9f')](_0xdb50('0xa0'),{'UserId':Number(_0x39add9[_0xdb50('0x37')][_0xdb50('0x60')][_0x58c178]),'CmListId':Number(_0x39add9[_0xdb50('0x58')]['id'])});}}else{socket['emit'](_0xdb50('0xa0'),{'UserId':Number(_0x39add9[_0xdb50('0x37')][_0xdb50('0x60')]),'CmListId':Number(_0x39add9['params']['id'])});}});}})[_0xdb50('0x2a')](respondWithStatusCode(_0x39ce20,null))[_0xdb50('0x49')](handleError(_0x39ce20,null));};exports['getAgents']=function(_0x40831d,_0x4cd1d0,_0x3ccd4e){var _0xa25a88={};var _0x26176b={};var _0x2bd12d;var _0x9c0fa9;return db['CmList'][_0xdb50('0x5b')]({'where':{'id':_0x40831d[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x4cd1d0,null))[_0xdb50('0x2a')](function(_0x25a443){if(_0x25a443){_0x2bd12d=_0x25a443;_0x26176b[_0xdb50('0x36')]=_[_0xdb50('0x4b')](db[_0xdb50('0xa1')][_0xdb50('0x34')]);_0x26176b['query']=_[_0xdb50('0x4b')](_0x40831d[_0xdb50('0x37')]);_0x26176b[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0x26176b[_0xdb50('0x36')],_0x26176b['query']);_0xa25a88['attributes']=_[_0xdb50('0x39')](_0x26176b['model'],qs[_0xdb50('0x3b')](_0x40831d[_0xdb50('0x37')]['fields']));_0xa25a88[_0xdb50('0x3a')]=_0xa25a88[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0xa25a88['attributes']:_0x26176b[_0xdb50('0x36')];_0xa25a88[_0xdb50('0x5e')]=qs['sort'](_0x40831d[_0xdb50('0x37')][_0xdb50('0x3e')]);_0xa25a88[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x40831d[_0xdb50('0x37')],_0x26176b[_0xdb50('0x38')]));if(_0x40831d[_0xdb50('0x37')][_0xdb50('0x41')]){_0xa25a88['where']=_['merge'](_0xa25a88['where'],{'$or':_['map'](_0xa25a88['attributes'],function(_0x375e38){var _0x2995af={};_0x2995af[_0x375e38]={'$like':'%'+_0x40831d['query']['filter']+'%'};return _0x2995af;})});}_0xa25a88=_['merge']({},_0xa25a88,_0x40831d['options']);return _0x2bd12d[_0xdb50('0xa2')](_0xa25a88);}})['then'](function(_0x461558){if(_0x461558){_0x9c0fa9=_0x461558[_0xdb50('0x3c')];if(!_0x40831d[_0xdb50('0x37')][_0xdb50('0x72')](_0xdb50('0x5d'))){_0xa25a88[_0xdb50('0x3d')]=qs[_0xdb50('0x3d')](_0x40831d[_0xdb50('0x37')][_0xdb50('0x3d')]);_0xa25a88[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x40831d[_0xdb50('0x37')][_0xdb50('0x24')]);}return _0x2bd12d[_0xdb50('0xa2')](_0xa25a88);}})[_0xdb50('0x2a')](function(_0x2f5356){if(_0x2f5356){return _0x2f5356?{'count':_0x9c0fa9,'rows':_0x2f5356}:null;}})[_0xdb50('0x2a')](respondWithResult(_0x4cd1d0,null))[_0xdb50('0x49')](handleError(_0x4cd1d0,null));};function handleQuery(_0xd137){logger[_0xdb50('0xa3')](_0xd137);return db[_0xdb50('0x8d')][_0xdb50('0x37')](_0xd137)[_0xdb50('0x9c')](function(_0x4dda21){csv_results['push'](_0x4dda21);})[_0xdb50('0x49')](function(_0x507b24){logger[_0xdb50('0x56')](_0x507b24[_0xdb50('0x6b')]);});} \ No newline at end of file +var _0x92eb=['then','destroy','Lists','UserProfileResource','error','stack','name','index','map','CmList','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','type','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','describe','addDisposition','ListId','Disposition','getDispositions','hasOwnProperty','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','Sequelize','TEXT','number','BOOLEAN','defaultValue','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save'];(function(_0x2237f4,_0x236af6){var _0x2d73b0=function(_0x2cfaec){while(--_0x2cfaec){_0x2237f4['push'](_0x2237f4['shift']());}};_0x2d73b0(++_0x236af6);}(_0x92eb,0x1b6));var _0xb92e=function(_0x29dfa1,_0x9f9e4e){_0x29dfa1=_0x29dfa1-0x0;var _0x215d84=_0x92eb[_0x29dfa1];return _0x215d84;};'use strict';var emlformat=require(_0xb92e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb92e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb92e('0x2'));var moment=require(_0xb92e('0x3'));var BPromise=require(_0xb92e('0x4'));var Mustache=require(_0xb92e('0x5'));var util=require(_0xb92e('0x6'));var path=require(_0xb92e('0x7'));var sox=require(_0xb92e('0x8'));var csv=require(_0xb92e('0x9'));var ejs=require(_0xb92e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb92e('0xb'));var squel=require('squel');var crypto=require(_0xb92e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb92e('0xd'));var toCsv=require(_0xb92e('0x9'));var querystring=require('querystring');var Papa=require(_0xb92e('0xe'));var Redis=require(_0xb92e('0xf'));var authService=require(_0xb92e('0x10'));var qs=require(_0xb92e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb92e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb92e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0xb92e('0x14')]=_['defaults'](config[_0xb92e('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xb92e('0x15'))(new Redis(config[_0xb92e('0x14')]));require(_0xb92e('0x16'))[_0xb92e('0x17')](socket);function respondWithStatusCode(_0x49a0d4,_0x5ba3c8){_0x5ba3c8=_0x5ba3c8||0xcc;return function(_0x19db0a){if(_0x19db0a){return _0x49a0d4[_0xb92e('0x18')](_0x5ba3c8);}return _0x49a0d4[_0xb92e('0x19')](_0x5ba3c8)[_0xb92e('0x1a')]();};}function respondWithResult(_0xd7d9b4,_0xc33944){_0xc33944=_0xc33944||0xc8;return function(_0x581a1a){if(_0x581a1a){return _0xd7d9b4['status'](_0xc33944)[_0xb92e('0x1b')](_0x581a1a);}};}function respondWithFilteredResult(_0x1b2c12,_0x222023){return function(_0x5c7ce0){if(_0x5c7ce0){var _0x187531=typeof _0x222023['offset']===_0xb92e('0x1c')&&typeof _0x222023[_0xb92e('0x1d')]===_0xb92e('0x1c');var _0xa1a31c=_0x5c7ce0['count'];var _0x389e42=_0x187531?0x0:_0x222023[_0xb92e('0x1e')];var _0xbc35ae=_0x187531?_0x5c7ce0[_0xb92e('0x1f')]:_0x222023[_0xb92e('0x1e')]+_0x222023[_0xb92e('0x1d')];var _0x130e08;if(_0xbc35ae>=_0xa1a31c){_0xbc35ae=_0xa1a31c;_0x130e08=0xc8;}else{_0x130e08=0xce;}_0x1b2c12['status'](_0x130e08);return _0x1b2c12[_0xb92e('0x20')]('Content-Range',_0x389e42+'-'+_0xbc35ae+'/'+_0xa1a31c)[_0xb92e('0x1b')](_0x5c7ce0);}return null;};}function patchUpdates(_0x358d4f){return function(_0x28eff1){try{jsonpatch[_0xb92e('0x21')](_0x28eff1,_0x358d4f,!![]);}catch(_0x1ebe20){return BPromise[_0xb92e('0x22')](_0x1ebe20);}return _0x28eff1[_0xb92e('0x23')]();};}function saveUpdates(_0x10e123,_0x32761b){return function(_0x3aca81){if(_0x3aca81){return _0x3aca81['update'](_0x10e123)[_0xb92e('0x24')](function(_0x1cbe5d){return _0x1cbe5d;});}return null;};}function removeEntity(_0xde9966,_0x435a1e){return function(_0x522244){if(_0x522244){return _0x522244[_0xb92e('0x25')]()[_0xb92e('0x24')](function(){var _0x5c74a8=_0x522244['get']({'plain':!![]});var _0xd81667=_0xb92e('0x26');return db[_0xb92e('0x27')][_0xb92e('0x25')]({'where':{'type':_0xd81667,'resourceId':_0x5c74a8['id']}})[_0xb92e('0x24')](function(){return _0x522244;});})[_0xb92e('0x24')](function(){_0xde9966['status'](0xcc)[_0xb92e('0x1a')]();});}};}function handleEntityNotFound(_0x231aa8,_0x38d3a5){return function(_0x72a053){if(!_0x72a053){_0x231aa8[_0xb92e('0x18')](0x194);}return _0x72a053;};}function handleError(_0xbf744f,_0xc4403a){_0xc4403a=_0xc4403a||0x1f4;return function(_0x349a29){logger[_0xb92e('0x28')](_0x349a29[_0xb92e('0x29')]);if(_0x349a29[_0xb92e('0x2a')]){delete _0x349a29[_0xb92e('0x2a')];}_0xbf744f[_0xb92e('0x19')](_0xc4403a)['send'](_0x349a29);};}exports[_0xb92e('0x2b')]=function(_0x44bf98,_0x1e55cd){var _0x178593={},_0x27ec00={},_0x5ddfee={'count':0x0,'rows':[]};var _0x1c37d2=_[_0xb92e('0x2c')](db[_0xb92e('0x2d')][_0xb92e('0x2e')],function(_0x2e9963){return{'name':_0x2e9963[_0xb92e('0x2f')],'type':_0x2e9963['type'][_0xb92e('0x30')]};});_0x27ec00[_0xb92e('0x31')]=_[_0xb92e('0x2c')](_0x1c37d2,'name');_0x27ec00['query']=_[_0xb92e('0x32')](_0x44bf98[_0xb92e('0x33')]);_0x27ec00[_0xb92e('0x34')]=_['intersection'](_0x27ec00['model'],_0x27ec00['query']);_0x178593[_0xb92e('0x35')]=_[_0xb92e('0x36')](_0x27ec00[_0xb92e('0x31')],qs['fields'](_0x44bf98[_0xb92e('0x33')][_0xb92e('0x37')]));_0x178593[_0xb92e('0x35')]=_0x178593[_0xb92e('0x35')][_0xb92e('0x38')]?_0x178593[_0xb92e('0x35')]:_0x27ec00['model'];if(!_0x44bf98['query']['hasOwnProperty']('nolimit')){_0x178593['limit']=qs[_0xb92e('0x1d')](_0x44bf98[_0xb92e('0x33')][_0xb92e('0x1d')]);_0x178593['offset']=qs['offset'](_0x44bf98[_0xb92e('0x33')]['offset']);}_0x178593[_0xb92e('0x39')]=qs[_0xb92e('0x3a')](_0x44bf98[_0xb92e('0x33')]['sort']);_0x178593[_0xb92e('0x3b')]=qs[_0xb92e('0x34')](_[_0xb92e('0x3c')](_0x44bf98[_0xb92e('0x33')],_0x27ec00[_0xb92e('0x34')]),_0x1c37d2);if(_0x44bf98['query'][_0xb92e('0x3d')]){_0x178593[_0xb92e('0x3b')]=_['merge'](_0x178593['where'],{'$or':_[_0xb92e('0x2c')](_0x1c37d2,function(_0x147e9e){if(_0x147e9e[_0xb92e('0x3e')]!=='VIRTUAL'){var _0x6be7a9={};_0x6be7a9[_0x147e9e['name']]={'$like':'%'+_0x44bf98['query'][_0xb92e('0x3d')]+'%'};return _0x6be7a9;}})});}_0x178593=_[_0xb92e('0x3f')]({},_0x178593,_0x44bf98['options']);var _0x4e09f3={'where':_0x178593[_0xb92e('0x3b')]};return db[_0xb92e('0x2d')]['count'](_0x4e09f3)[_0xb92e('0x24')](function(_0x261cf9){_0x5ddfee[_0xb92e('0x1f')]=_0x261cf9;if(_0x44bf98[_0xb92e('0x33')][_0xb92e('0x40')]){_0x178593[_0xb92e('0x41')]=[{'all':!![]}];}return db[_0xb92e('0x2d')][_0xb92e('0x42')](_0x178593);})['then'](function(_0x410261){_0x5ddfee['rows']=_0x410261;return _0x5ddfee;})[_0xb92e('0x24')](respondWithFilteredResult(_0x1e55cd,_0x178593))[_0xb92e('0x43')](handleError(_0x1e55cd,null));};exports[_0xb92e('0x44')]=function(_0x39a3fd,_0x5f1694){var _0x46f5a9={'raw':![],'where':{'id':_0x39a3fd[_0xb92e('0x45')]['id']}},_0x3afb07={};_0x3afb07[_0xb92e('0x31')]=_[_0xb92e('0x32')](db[_0xb92e('0x2d')]['rawAttributes']);_0x3afb07[_0xb92e('0x33')]=_[_0xb92e('0x32')](_0x39a3fd[_0xb92e('0x33')]);_0x3afb07['filters']=_[_0xb92e('0x36')](_0x3afb07[_0xb92e('0x31')],_0x3afb07[_0xb92e('0x33')]);_0x46f5a9[_0xb92e('0x35')]=_['intersection'](_0x3afb07[_0xb92e('0x31')],qs[_0xb92e('0x37')](_0x39a3fd[_0xb92e('0x33')][_0xb92e('0x37')]));_0x46f5a9[_0xb92e('0x35')]=_0x46f5a9['attributes'][_0xb92e('0x38')]?_0x46f5a9[_0xb92e('0x35')]:_0x3afb07[_0xb92e('0x31')];if(_0x39a3fd[_0xb92e('0x33')]['includeAll']){_0x46f5a9[_0xb92e('0x41')]=[{'all':!![]}];}_0x46f5a9=_['merge']({},_0x46f5a9,_0x39a3fd[_0xb92e('0x46')]);return db['CmList'][_0xb92e('0x47')](_0x46f5a9)[_0xb92e('0x24')](handleEntityNotFound(_0x5f1694,null))[_0xb92e('0x24')](respondWithResult(_0x5f1694,null))[_0xb92e('0x43')](handleError(_0x5f1694,null));};exports['create']=function(_0x29b6f5,_0x21cbc3){return db[_0xb92e('0x2d')][_0xb92e('0x48')](_0x29b6f5[_0xb92e('0x49')],{})[_0xb92e('0x24')](function(_0x4061f8){var _0x287bc1=_0x29b6f5['user']['get']({'plain':!![]});if(!_0x287bc1)throw new Error(_0xb92e('0x4a'));if(_0x287bc1[_0xb92e('0x4b')]===_0xb92e('0x4c')){var _0x2bfda3=_0x4061f8[_0xb92e('0x4d')]({'plain':!![]});var _0x29d847=_0xb92e('0x26');return db['UserProfileSection'][_0xb92e('0x47')]({'where':{'name':_0x29d847,'userProfileId':_0x287bc1[_0xb92e('0x4e')]},'raw':!![]})[_0xb92e('0x24')](function(_0x4b4143){if(_0x4b4143&&_0x4b4143[_0xb92e('0x4f')]===0x0){return db[_0xb92e('0x27')]['create']({'name':_0x2bfda3[_0xb92e('0x2a')],'resourceId':_0x2bfda3['id'],'type':_0x4b4143['name'],'sectionId':_0x4b4143['id']},{})[_0xb92e('0x24')](function(){return _0x4061f8;});}else{return _0x4061f8;}})['catch'](function(_0x40d23e){logger[_0xb92e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40d23e);throw _0x40d23e;});}return _0x4061f8;})['then'](respondWithResult(_0x21cbc3,0xc9))['catch'](handleError(_0x21cbc3,null));};exports['update']=function(_0xba32d3,_0x84fe02){if(_0xba32d3[_0xb92e('0x49')]['id']){delete _0xba32d3[_0xb92e('0x49')]['id'];}return db['CmList'][_0xb92e('0x47')]({'where':{'id':_0xba32d3[_0xb92e('0x45')]['id']}})['then'](handleEntityNotFound(_0x84fe02,null))[_0xb92e('0x24')](saveUpdates(_0xba32d3[_0xb92e('0x49')],null))['then'](respondWithResult(_0x84fe02,null))['catch'](handleError(_0x84fe02,null));};exports[_0xb92e('0x25')]=function(_0x1ad877,_0x2731c7){return db[_0xb92e('0x2d')][_0xb92e('0x47')]({'where':{'id':_0x1ad877['params']['id']}})[_0xb92e('0x24')](handleEntityNotFound(_0x2731c7,null))[_0xb92e('0x24')](removeEntity(_0x2731c7,null))[_0xb92e('0x43')](handleError(_0x2731c7,null));};exports['describe']=function(_0x28f2ed,_0x4e6a13){return db['CmList'][_0xb92e('0x50')]()[_0xb92e('0x24')](respondWithResult(_0x4e6a13,null))['catch'](handleError(_0x4e6a13,null));};exports[_0xb92e('0x51')]=function(_0x46bba5,_0x4e18a4,_0x20ca1f){if(_0x46bba5[_0xb92e('0x49')]['id']){delete _0x46bba5['body']['id'];}return db['CmList']['find']({'where':{'id':_0x46bba5['params']['id']}})[_0xb92e('0x24')](handleEntityNotFound(_0x4e18a4,null))[_0xb92e('0x24')](function(_0x3d09e5){if(_0x3d09e5){_0x46bba5['body'][_0xb92e('0x52')]=_0x3d09e5['id'];return db[_0xb92e('0x53')]['create'](_0x46bba5['body']);}})[_0xb92e('0x24')](respondWithResult(_0x4e18a4,null))[_0xb92e('0x43')](handleError(_0x4e18a4,null));};exports[_0xb92e('0x54')]=function(_0x260a0,_0x2d665e,_0x247f68){var _0x467dd6={'raw':![],'where':{}};var _0x35b1aa={};var _0x30940c={'count':0x0,'rows':[]};return db[_0xb92e('0x2d')]['findOne']({'where':{'id':_0x260a0['params']['id']}})['then'](handleEntityNotFound(_0x2d665e,null))[_0xb92e('0x24')](function(_0x59e072){if(_0x59e072){_0x35b1aa[_0xb92e('0x31')]=_['keys'](db['Disposition']['rawAttributes']);_0x35b1aa[_0xb92e('0x33')]=_[_0xb92e('0x32')](_0x260a0[_0xb92e('0x33')]);_0x35b1aa[_0xb92e('0x34')]=_[_0xb92e('0x36')](_0x35b1aa[_0xb92e('0x31')],_0x35b1aa[_0xb92e('0x33')]);_0x467dd6[_0xb92e('0x35')]=_['intersection'](_0x35b1aa[_0xb92e('0x31')],qs[_0xb92e('0x37')](_0x260a0['query'][_0xb92e('0x37')]));_0x467dd6['attributes']=_0x467dd6[_0xb92e('0x35')]['length']?_0x467dd6[_0xb92e('0x35')]:_0x35b1aa['model'];if(!_0x260a0[_0xb92e('0x33')][_0xb92e('0x55')](_0xb92e('0x56'))){_0x467dd6['limit']=qs[_0xb92e('0x1d')](_0x260a0[_0xb92e('0x33')][_0xb92e('0x1d')]);_0x467dd6['offset']=qs[_0xb92e('0x1e')](_0x260a0['query']['offset']);}_0x467dd6['order']=qs[_0xb92e('0x3a')](_0x260a0['query']['sort']);_0x467dd6['where']=qs['filters'](_[_0xb92e('0x3c')](_0x260a0[_0xb92e('0x33')],_0x35b1aa[_0xb92e('0x34')]));_0x467dd6['where'][_0xb92e('0x52')]=_0x59e072['id'];if(_0x260a0['query'][_0xb92e('0x3d')]){_0x467dd6[_0xb92e('0x3b')]=_['merge'](_0x467dd6[_0xb92e('0x3b')],{'$or':_[_0xb92e('0x2c')](_0x467dd6[_0xb92e('0x35')],function(_0x24f6e4){var _0x525045={};_0x525045[_0x24f6e4]={'$like':'%'+_0x260a0[_0xb92e('0x33')][_0xb92e('0x3d')]+'%'};return _0x525045;})});}_0x467dd6=_[_0xb92e('0x3f')]({},_0x467dd6,_0x260a0['options']);return db[_0xb92e('0x53')]['count']({'where':_0x467dd6[_0xb92e('0x3b')]})[_0xb92e('0x24')](function(_0x63748e){_0x30940c[_0xb92e('0x1f')]=_0x63748e;if(_0x260a0[_0xb92e('0x33')][_0xb92e('0x40')]){_0x467dd6[_0xb92e('0x41')]=[{'all':!![]}];}return db[_0xb92e('0x53')]['findAll'](_0x467dd6);})[_0xb92e('0x24')](function(_0x300d34){_0x30940c['rows']=_0x300d34;return _0x30940c;});}})['then'](respondWithFilteredResult(_0x2d665e,_0x467dd6))[_0xb92e('0x43')](handleError(_0x2d665e,null));};exports['removeDispositions']=function(_0x3f04e8,_0x21b912,_0x5790d6){return db[_0xb92e('0x2d')][_0xb92e('0x47')]({'where':{'id':_0x3f04e8[_0xb92e('0x45')]['id']}})[_0xb92e('0x24')](handleEntityNotFound(_0x21b912,null))[_0xb92e('0x24')](function(_0x326b8b){if(_0x326b8b){return _0x326b8b[_0xb92e('0x57')](_0x3f04e8[_0xb92e('0x33')][_0xb92e('0x58')]);}})[_0xb92e('0x24')](respondWithStatusCode(_0x21b912,null))[_0xb92e('0x43')](handleError(_0x21b912,null));};exports[_0xb92e('0x59')]=function(_0x57ea40,_0x30f949,_0x3ed570){return db[_0xb92e('0x2d')][_0xb92e('0x47')]({'where':{'id':_0x57ea40[_0xb92e('0x45')]['id']}})[_0xb92e('0x24')](handleEntityNotFound(_0x30f949,null))[_0xb92e('0x24')](function(_0x4c9e0a){if(_0x4c9e0a){var _0x125614=[];var _0xa3c11={'success':[],'errors':[]};return db[_0xb92e('0x5a')][_0xb92e('0x50')]()[_0xb92e('0x24')](function(_0x113e95){if(_0x57ea40['body'][_0xb92e('0x5b')]&&_['isArray'](_0x57ea40['body'][_0xb92e('0x5b')])){if(_0x57ea40[_0xb92e('0x49')]['tags'][_0xb92e('0x38')]){_0x57ea40['body']['tags']=_0x57ea40[_0xb92e('0x49')][_0xb92e('0x5b')]['join'](';')+';';}else{_0x57ea40['body'][_0xb92e('0x5b')]=null;}}else{_0x57ea40[_0xb92e('0x49')][_0xb92e('0x5b')]=null;}if(_0x57ea40[_0xb92e('0x49')]&&_[_0xb92e('0x5c')](_0x57ea40['body'])){for(var _0x46efc9=0x0;_0x46efc9<_0x57ea40[_0xb92e('0x49')][_0xb92e('0x38')];_0x46efc9+=0x1){_0x57ea40[_0xb92e('0x49')][_0x46efc9][_0xb92e('0x52')]=_0x57ea40[_0xb92e('0x45')]['id'];_0x125614[_0xb92e('0x5d')](_0x57ea40[_0xb92e('0x49')][_0x46efc9]);}return BPromise[_0xb92e('0x5e')](_0x125614,function(_0x1945a0){return db[_0xb92e('0x5a')][_0xb92e('0x48')](_['omit'](_0x1945a0,[_0xb92e('0x58'),'id'])||{},{'fields':_[_0xb92e('0x32')](_0x113e95),'raw':!![]})['then'](function(_0x28a022){_0xa3c11[_0xb92e('0x5f')][_0xb92e('0x5d')](_0x28a022[_0xb92e('0x60')]);})[_0xb92e('0x43')](function(_0x3ecdbb){_0xa3c11['errors'][_0xb92e('0x5d')]({'data':_0x1945a0,'error':_0x3ecdbb[_0xb92e('0x61')]});});})[_0xb92e('0x24')](function(_0x4631db){return _0xa3c11;})[_0xb92e('0x43')](function(_0x3b4c5b){return _0x3b4c5b;});}else{_0x30f949[_0xb92e('0x19')](0x190)[_0xb92e('0x1b')]({'message':_0xb92e('0x62')});}});}})[_0xb92e('0x24')](respondWithResult(_0x30f949,null))[_0xb92e('0x43')](handleError(_0x30f949,null));};exports['getContacts']=function(_0x441196,_0x5bb0f4,_0x2208de){var _0x379802;return db['CmList']['find']({'where':{'id':_0x441196['params']['id']},'include':[{'model':db[_0xb92e('0x63')],'as':_0xb92e('0x64')}]})[_0xb92e('0x24')](handleEntityNotFound(_0x5bb0f4,null))[_0xb92e('0x24')](function(_0x5419a1){if(_0x5419a1){_0x379802=_0x5419a1;return db[_0xb92e('0x5a')][_0xb92e('0x2e')];}})[_0xb92e('0x24')](function(_0x12f35d){if(_0x12f35d){var _0x1fb554={};var _0x11acfa={};_0x11acfa[_0xb92e('0x31')]=_[_0xb92e('0x65')](_[_0xb92e('0x32')](_0x12f35d),_[_0xb92e('0x2c')](_0x379802[_0xb92e('0x64')],function(_0x532ae7){return util['format'](_0xb92e('0x66'),_0x532ae7['id']);}));_0x11acfa['query']=_[_0xb92e('0x32')](_0x441196['query']);_0x11acfa[_0xb92e('0x34')]=_[_0xb92e('0x36')](_0x11acfa['model'],_0x11acfa[_0xb92e('0x33')]);_0x1fb554[_0xb92e('0x35')]=_['intersection'](_0x11acfa[_0xb92e('0x31')],qs['fields'](_0x441196['query'][_0xb92e('0x37')]));_0x1fb554[_0xb92e('0x35')]=_0x1fb554[_0xb92e('0x35')][_0xb92e('0x38')]?_0x1fb554[_0xb92e('0x35')]:_0x11acfa['model'];if(!_0x441196['query'][_0xb92e('0x55')](_0xb92e('0x56'))){_0x1fb554[_0xb92e('0x1d')]=qs[_0xb92e('0x1d')](_0x441196[_0xb92e('0x33')][_0xb92e('0x1d')]);_0x1fb554[_0xb92e('0x1e')]=qs[_0xb92e('0x1e')](_0x441196[_0xb92e('0x33')][_0xb92e('0x1e')]);}_0x1fb554[_0xb92e('0x39')]=qs[_0xb92e('0x3a')](_0x441196[_0xb92e('0x33')]['sort']);_0x1fb554[_0xb92e('0x3b')]=qs[_0xb92e('0x34')](_[_0xb92e('0x3c')](_0x441196['query'],_0x11acfa['filters']));_0x1fb554[_0xb92e('0x67')]=!![];if(_0x441196[_0xb92e('0x33')]['filter']){_0x1fb554[_0xb92e('0x3b')]=_[_0xb92e('0x3f')](_0x1fb554[_0xb92e('0x3b')],{'$or':_[_0xb92e('0x2c')](_0x1fb554[_0xb92e('0x35')],function(_0x39292f){var _0xe5d72b={};_0xe5d72b[_0x39292f]={'$like':'%'+_0x441196['query'][_0xb92e('0x3d')]+'%'};return _0xe5d72b;})});}_0x1fb554=_['merge']({},_0x1fb554,_0x441196[_0xb92e('0x46')]);return _0x379802[_0xb92e('0x68')](_0x1fb554);}})['then'](respondWithResult(_0x5bb0f4,null))[_0xb92e('0x43')](handleError(_0x5bb0f4,null));};exports[_0xb92e('0x69')]=function(_0x46d4d4,_0x26d74b,_0xb8b523){var _0x1e5a78;var _0x82054c;var _0x3c349e;var _0x26b10c=_0x46d4d4[_0xb92e('0x45')]['id'];csv_results=[];return db[_0xb92e('0x6a')][_0xb92e('0x42')]({'attributes':['id',_0xb92e('0x2a')],'raw':!![],'order':[_0xb92e('0x6b')]})[_0xb92e('0x24')](function(_0x289e57){_0x1e5a78=_0x289e57;var _0x9a75f=_['keys'](db[_0xb92e('0x5a')]['rawAttributes']);return db[_0xb92e('0x63')]['findAll']({'raw':!![],'attributes':['id',_0xb92e('0x6c')]})[_0xb92e('0x24')](function(_0xb392f2){_0x82054c=_0xb392f2;var _0x3a7a13=squel[_0xb92e('0x6d')]()[_0xb92e('0x37')](_0x9a75f)[_0xb92e('0x6e')](_0xb92e('0x6f'),'c')[_0xb92e('0x3b')]('c.ListId\x20=\x20?',_0x26b10c)[_0xb92e('0x3b')](_0xb92e('0x70'))[_0xb92e('0x71')]();for(var _0x41fa98=0x0;_0x41fa98<_0x82054c['length'];_0x41fa98++){_0x3a7a13[_0xb92e('0x72')](_0xb92e('0x73')+_0x82054c[_0x41fa98]['id'],_0xb92e('0x74')+_0x82054c[_0x41fa98][_0xb92e('0x6c')]);}for(var _0x41fa98=0x0;_0x41fa98<_0x1e5a78['length'];_0x41fa98++){_0x3a7a13[_0xb92e('0x72')](squel['select']()[_0xb92e('0x72')](_0xb92e('0x75'))[_0xb92e('0x6e')](_0xb92e('0x76'))[_0xb92e('0x3b')](_0xb92e('0x77'),_0x1e5a78[_0x41fa98]['id'])[_0xb92e('0x3b')](_0xb92e('0x78')),_0xb92e('0x79')+_0x1e5a78[_0x41fa98][_0xb92e('0x2a')]);_0x3a7a13[_0xb92e('0x72')](squel[_0xb92e('0x6d')]()[_0xb92e('0x72')]('description')[_0xb92e('0x6e')]('cm_contact_has_items')[_0xb92e('0x3b')](_0xb92e('0x77'),_0x1e5a78[_0x41fa98]['id'])['where']('CmContactId\x20=\x20c.id'),_0xb92e('0x7a')+_0x1e5a78[_0x41fa98]['name']);}var _0x1465c9=[];_0x1465c9[_0xb92e('0x5d')](_0x3a7a13['toString']());BPromise[_0xb92e('0x5e')](_0x1465c9,handleQuery)[_0xb92e('0x24')](function(_0x14e3b5){handleQuery(_0x3a7a13[_0xb92e('0x7b')]());var _0x292a07=csv_results[0x0];if(!_[_0xb92e('0x7c')](_0x292a07)){var _0x457e9e=toCsv(_0x292a07);var _0x5cc9d9=Date[_0xb92e('0x7d')]();fs[_0xb92e('0x7e')](util[_0xb92e('0x7f')]('/tmp/list_%d_%s.csv',_0x26b10c,_0x5cc9d9),_0x457e9e);_0x26d74b[_0xb92e('0x80')](_0xb92e('0x81'),_0xb92e('0x82')+util[_0xb92e('0x7f')](_0xb92e('0x83'),_0x26b10c,_0x5cc9d9));_0x26d74b[_0xb92e('0x80')](_0xb92e('0x84'),_0xb92e('0x85'));return _0x26d74b[_0xb92e('0x86')](util[_0xb92e('0x7f')](_0xb92e('0x87'),_0x26b10c,_0x5cc9d9));}else{return _0x26d74b[_0xb92e('0x18')](0xcc);}});});});};exports[_0xb92e('0x88')]=function(_0x594589,_0x4ee794,_0x1cf08f){var _0x2bbd53;delete _0x594589[_0xb92e('0x49')]['id'];return db[_0xb92e('0x2d')][_0xb92e('0x89')]({'where':{'id':_0x594589[_0xb92e('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ee794,null))['then'](function(_0x4101e0){if(_0x4101e0){return db[_0xb92e('0x8a')][_0xb92e('0x8b')](function(_0x5f0037){return db['CmCustomField'][_0xb92e('0x48')](_0x594589[_0xb92e('0x49')],{'transaction':_0x5f0037})[_0xb92e('0x24')](function(_0x199d96){_0x2bbd53=_0x199d96;return _0x4101e0['addCustomFields'](_0x199d96,{'transaction':_0x5f0037});})[_0xb92e('0x24')](function(){var _0x5042cc={'type':db[_0xb92e('0x8c')][_0xb92e('0x8d')],'transaction':_0x5f0037};switch(_0x594589[_0xb92e('0x49')][_0xb92e('0x3e')]){case'text':_0x5042cc[_0xb92e('0x3e')]=db[_0xb92e('0x8c')][_0xb92e('0x8d')];break;case _0xb92e('0x8e'):_0x5042cc[_0xb92e('0x3e')]=db[_0xb92e('0x8c')]['INTEGER'];break;case'switch':_0x5042cc['type']=db[_0xb92e('0x8c')][_0xb92e('0x8f')];_0x5042cc[_0xb92e('0x90')]=![];break;default:}return db['sequelize']['queryInterface'][_0xb92e('0x91')](_0xb92e('0x6f'),util[_0xb92e('0x7f')](_0xb92e('0x92'),_0x2bbd53['id']),_0x5042cc);})[_0xb92e('0x24')](function(){return _0x2bbd53;});});}})[_0xb92e('0x24')](respondWithResult(_0x4ee794,null))['catch'](handleError(_0x4ee794,null));};exports[_0xb92e('0x93')]=function(_0x516c56,_0x29b966,_0x2c7ea3){var _0x1d11aa={};var _0x5210e0={};var _0x32e2c5;var _0x4ef631;return db[_0xb92e('0x2d')][_0xb92e('0x89')]({'where':{'id':_0x516c56[_0xb92e('0x45')]['id']}})['then'](handleEntityNotFound(_0x29b966,null))[_0xb92e('0x24')](function(_0x589137){if(_0x589137){_0x32e2c5=_0x589137;_0x5210e0[_0xb92e('0x31')]=_['keys'](db[_0xb92e('0x63')][_0xb92e('0x2e')]);_0x5210e0['query']=_['keys'](_0x516c56['query']);_0x5210e0[_0xb92e('0x34')]=_[_0xb92e('0x36')](_0x5210e0[_0xb92e('0x31')],_0x5210e0['query']);_0x1d11aa['attributes']=_[_0xb92e('0x36')](_0x5210e0[_0xb92e('0x31')],qs['fields'](_0x516c56[_0xb92e('0x33')][_0xb92e('0x37')]));_0x1d11aa[_0xb92e('0x35')]=_0x1d11aa[_0xb92e('0x35')]['length']?_0x1d11aa[_0xb92e('0x35')]:_0x5210e0[_0xb92e('0x31')];_0x1d11aa[_0xb92e('0x39')]=qs['sort'](_0x516c56[_0xb92e('0x33')]['sort']);_0x1d11aa[_0xb92e('0x3b')]=qs[_0xb92e('0x34')](_[_0xb92e('0x3c')](_0x516c56['query'],_0x5210e0['filters']));_0x1d11aa['where']=_['merge'](_0x1d11aa[_0xb92e('0x3b')],{'$or':[{'ListId':_0x589137['id']},{'ListId':null}]});if(_0x516c56['query'][_0xb92e('0x3d')]){_0x1d11aa[_0xb92e('0x3b')]=_[_0xb92e('0x3f')](_0x1d11aa['where'],{'$or':_[_0xb92e('0x2c')](_0x1d11aa[_0xb92e('0x35')],function(_0x49360c){var _0x5afb0b={};_0x5afb0b[_0x49360c]={'$like':'%'+_0x516c56[_0xb92e('0x33')]['filter']+'%'};return _0x5afb0b;})});}_0x1d11aa=_[_0xb92e('0x3f')]({},_0x1d11aa,_0x516c56[_0xb92e('0x46')]);return db['CmCustomField']['findAndCountAll'](_0x1d11aa);}})[_0xb92e('0x24')](respondWithResult(_0x29b966,null))[_0xb92e('0x43')](handleError(_0x29b966,null));};exports[_0xb92e('0x94')]=function(_0x59ad79,_0x2b2cf0){return db[_0xb92e('0x63')]['findAndCountAll']({'where':{'ListId':null}})[_0xb92e('0x24')](handleEntityNotFound(_0x2b2cf0,null))[_0xb92e('0x24')](function(_0x43964c){return _0x43964c;})['then'](respondWithResult(_0x2b2cf0,null))[_0xb92e('0x43')](handleError(_0x2b2cf0,null));};exports['addAgents']=function(_0x3077ff,_0x2e7eab,_0x2ddf4f){return db[_0xb92e('0x2d')][_0xb92e('0x47')]({'where':{'id':_0x3077ff[_0xb92e('0x45')]['id']}})[_0xb92e('0x24')](handleEntityNotFound(_0x2e7eab,null))[_0xb92e('0x24')](function(_0xef55bd){if(_0xef55bd){return _0xef55bd[_0xb92e('0x95')](_0x3077ff[_0xb92e('0x49')][_0xb92e('0x58')],_[_0xb92e('0x96')](_0x3077ff[_0xb92e('0x49')],[_0xb92e('0x58'),'id'])||{})[_0xb92e('0x97')](function(_0x5d2969){for(var _0x6437a3=0x0;_0x6437a3<_0x3077ff['body'][_0xb92e('0x58')][_0xb92e('0x38')];_0x6437a3+=0x1){socket[_0xb92e('0x98')]('userCmList:save',{'UserId':Number(_0x3077ff[_0xb92e('0x49')][_0xb92e('0x58')][_0x6437a3]),'CmListId':Number(_0x3077ff['params']['id'])});}return _0x5d2969;});}})['then'](respondWithResult(_0x2e7eab,null))[_0xb92e('0x43')](handleError(_0x2e7eab,null));};exports[_0xb92e('0x99')]=function(_0x4c2e1b,_0x189b54,_0x534319){return db[_0xb92e('0x2d')][_0xb92e('0x47')]({'where':{'id':_0x4c2e1b[_0xb92e('0x45')]['id']}})[_0xb92e('0x24')](handleEntityNotFound(_0x189b54,null))[_0xb92e('0x24')](function(_0x50f95a){if(_0x50f95a){return _0x50f95a[_0xb92e('0x99')](_0x4c2e1b[_0xb92e('0x33')]['ids'])[_0xb92e('0x24')](function(){if(_[_0xb92e('0x5c')](_0x4c2e1b['query'][_0xb92e('0x58')])){for(var _0x16ddb8=0x0;_0x16ddb8<_0x4c2e1b[_0xb92e('0x33')]['ids'][_0xb92e('0x38')];_0x16ddb8+=0x1){socket['emit'](_0xb92e('0x9a'),{'UserId':Number(_0x4c2e1b['query'][_0xb92e('0x58')][_0x16ddb8]),'CmListId':Number(_0x4c2e1b[_0xb92e('0x45')]['id'])});}}else{socket[_0xb92e('0x98')]('userCmList:remove',{'UserId':Number(_0x4c2e1b[_0xb92e('0x33')][_0xb92e('0x58')]),'CmListId':Number(_0x4c2e1b['params']['id'])});}});}})[_0xb92e('0x24')](respondWithStatusCode(_0x189b54,null))['catch'](handleError(_0x189b54,null));};exports[_0xb92e('0x9b')]=function(_0x1604f8,_0x4adeae,_0x986dd4){var _0x4c4cb8={};var _0xbbaafc={};var _0x12fa02;var _0x590bca;return db[_0xb92e('0x2d')][_0xb92e('0x89')]({'where':{'id':_0x1604f8[_0xb92e('0x45')]['id']}})[_0xb92e('0x24')](handleEntityNotFound(_0x4adeae,null))[_0xb92e('0x24')](function(_0x4227b2){if(_0x4227b2){_0x12fa02=_0x4227b2;_0xbbaafc[_0xb92e('0x31')]=_[_0xb92e('0x32')](db[_0xb92e('0x9c')]['rawAttributes']);_0xbbaafc[_0xb92e('0x33')]=_['keys'](_0x1604f8[_0xb92e('0x33')]);_0xbbaafc[_0xb92e('0x34')]=_[_0xb92e('0x36')](_0xbbaafc[_0xb92e('0x31')],_0xbbaafc['query']);_0x4c4cb8['attributes']=_[_0xb92e('0x36')](_0xbbaafc[_0xb92e('0x31')],qs[_0xb92e('0x37')](_0x1604f8['query'][_0xb92e('0x37')]));_0x4c4cb8[_0xb92e('0x35')]=_0x4c4cb8['attributes'][_0xb92e('0x38')]?_0x4c4cb8[_0xb92e('0x35')]:_0xbbaafc[_0xb92e('0x31')];_0x4c4cb8['order']=qs[_0xb92e('0x3a')](_0x1604f8[_0xb92e('0x33')][_0xb92e('0x3a')]);_0x4c4cb8[_0xb92e('0x3b')]=qs[_0xb92e('0x34')](_['pick'](_0x1604f8[_0xb92e('0x33')],_0xbbaafc['filters']));if(_0x1604f8[_0xb92e('0x33')][_0xb92e('0x3d')]){_0x4c4cb8[_0xb92e('0x3b')]=_[_0xb92e('0x3f')](_0x4c4cb8[_0xb92e('0x3b')],{'$or':_['map'](_0x4c4cb8[_0xb92e('0x35')],function(_0x4841c2){var _0x47afc6={};_0x47afc6[_0x4841c2]={'$like':'%'+_0x1604f8[_0xb92e('0x33')]['filter']+'%'};return _0x47afc6;})});}_0x4c4cb8=_[_0xb92e('0x3f')]({},_0x4c4cb8,_0x1604f8[_0xb92e('0x46')]);return _0x12fa02[_0xb92e('0x9b')](_0x4c4cb8);}})['then'](function(_0x460557){if(_0x460557){_0x590bca=_0x460557[_0xb92e('0x38')];if(!_0x1604f8[_0xb92e('0x33')]['hasOwnProperty']('nolimit')){_0x4c4cb8[_0xb92e('0x1d')]=qs[_0xb92e('0x1d')](_0x1604f8[_0xb92e('0x33')]['limit']);_0x4c4cb8['offset']=qs['offset'](_0x1604f8[_0xb92e('0x33')]['offset']);}return _0x12fa02[_0xb92e('0x9b')](_0x4c4cb8);}})[_0xb92e('0x24')](function(_0x57db24){if(_0x57db24){return _0x57db24?{'count':_0x590bca,'rows':_0x57db24}:null;}})[_0xb92e('0x24')](respondWithResult(_0x4adeae,null))[_0xb92e('0x43')](handleError(_0x4adeae,null));};function handleQuery(_0x4ca4f3){logger[_0xb92e('0x9d')](_0x4ca4f3);return db['sequelize']['query'](_0x4ca4f3)['spread'](function(_0xfec30e){csv_results[_0xb92e('0x5d')](_0xfec30e);})['catch'](function(_0x539afc){logger[_0xb92e('0x28')](_0x539afc['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c3d7c84..493bb09 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x55ca,0x126));var _0xa55c=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0x55ca[_0x1aac60];return _0x186adf;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x55ca,0x126));var _0xa55c=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x55ca[_0x35d3a8];return _0x182378;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 26f2642..c7f2a74 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 _0x4483=['define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0xc6a72f,_0x1ac77c){var _0x3728f7=function(_0x3d1427){while(--_0x3d1427){_0xc6a72f['push'](_0xc6a72f['shift']());}};_0x3728f7(++_0x1ac77c);}(_0x4483,0x1a3));var _0x3448=function(_0xa1dc15,_0x2f3c63){_0xa1dc15=_0xa1dc15-0x0;var _0x2c4d39=_0x4483[_0xa1dc15];return _0x2c4d39;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var fs=require('fs');var path=require(_0x3448('0x6'));var rimraf=require(_0x3448('0x7'));var config=require('../../config/environment');var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x1b05db,_0xd3606d){return _0x1b05db[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x1ab5ea,_0x3cc0d4){var _0x3d46c4=function(_0x13a5f8){while(--_0x13a5f8){_0x1ab5ea['push'](_0x1ab5ea['shift']());}};_0x3d46c4(++_0x3cc0d4);}(_0xac4a,0x13f));var _0xaac4=function(_0x35c6f1,_0x447902){_0x35c6f1=_0x35c6f1-0x0;var _0x5897ac=_0xac4a[_0x35c6f1];return _0x5897ac;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'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 6d25941..8fe0ab0 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 _0xc709=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d386b,_0x352e3f){var _0xdfc622=function(_0xad5ee7){while(--_0xad5ee7){_0x5d386b['push'](_0x5d386b['shift']());}};_0xdfc622(++_0x352e3f);}(_0xc709,0xc4));var _0x9c70=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0xc709[_0xc753c8];return _0xd02f5c;};'use strict';var _=require(_0x9c70('0x0'));var util=require(_0x9c70('0x1'));var moment=require('moment');var BPromise=require(_0x9c70('0x2'));var rs=require(_0x9c70('0x3'));var fs=require('fs');var Redis=require(_0x9c70('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c70('0x5'));var logger=require(_0x9c70('0x6'))(_0x9c70('0x7'));var config=require('../../config/environment');var jayson=require(_0x9c70('0x8'));var client=jayson[_0x9c70('0x9')]['http']({'port':0x232a});config[_0x9c70('0xa')]=_[_0x9c70('0xb')](config[_0x9c70('0xa')],{'host':_0x9c70('0xc'),'port':0x18eb});var socket=require(_0x9c70('0xd'))(new Redis(config[_0x9c70('0xa')]));require(_0x9c70('0xe'))[_0x9c70('0xf')](socket);function respondWithRpcPromise(_0x297aa7,_0x1989a9,_0x208f0f){return new BPromise(function(_0x5ca722,_0x4000b5){return client['request'](_0x297aa7,_0x208f0f)['then'](function(_0x8ec694){logger[_0x9c70('0x10')](_0x9c70('0x11'),_0x1989a9,_0x9c70('0x12'));logger[_0x9c70('0x13')](_0x9c70('0x14'),_0x1989a9,_0x9c70('0x12'),JSON[_0x9c70('0x15')](_0x8ec694));if(_0x8ec694['error']){if(_0x8ec694[_0x9c70('0x16')][_0x9c70('0x17')]===0x1f4){logger['error'](_0x9c70('0x11'),_0x1989a9,_0x8ec694[_0x9c70('0x16')]['message']);return _0x4000b5(_0x8ec694[_0x9c70('0x16')][_0x9c70('0x18')]);}logger[_0x9c70('0x16')](_0x9c70('0x11'),_0x1989a9,_0x8ec694['error'][_0x9c70('0x18')]);return _0x5ca722(_0x8ec694['error'][_0x9c70('0x18')]);}else{logger['info'](_0x9c70('0x11'),_0x1989a9,_0x9c70('0x12'));_0x5ca722(_0x8ec694[_0x9c70('0x19')][_0x9c70('0x18')]);}})[_0x9c70('0x1a')](function(_0xf4e370){logger['error'](_0x9c70('0x11'),_0x1989a9,_0xf4e370);_0x4000b5(_0xf4e370);});});} \ No newline at end of file +var _0x0d4e=['localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x576297,_0xf0286a){var _0x4e8e98=function(_0x34e2ac){while(--_0x34e2ac){_0x576297['push'](_0x576297['shift']());}};_0x4e8e98(++_0xf0286a);}(_0x0d4e,0x113));var _0xe0d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0d4e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe0d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe0d4('0x1'));var rs=require(_0xe0d4('0x2'));var fs=require('fs');var Redis=require(_0xe0d4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0d4('0x4'));var logger=require('../../config/logger')(_0xe0d4('0x5'));var config=require(_0xe0d4('0x6'));var jayson=require(_0xe0d4('0x7'));var client=jayson[_0xe0d4('0x8')]['http']({'port':0x232a});config[_0xe0d4('0x9')]=_[_0xe0d4('0xa')](config[_0xe0d4('0x9')],{'host':_0xe0d4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe0d4('0xc'))[_0xe0d4('0xd')](socket);function respondWithRpcPromise(_0x260dda,_0x1181ee,_0x2225cc){return new BPromise(function(_0xba657,_0x5e1132){return client[_0xe0d4('0xe')](_0x260dda,_0x2225cc)[_0xe0d4('0xf')](function(_0x47ff34){logger[_0xe0d4('0x10')](_0xe0d4('0x11'),_0x1181ee,_0xe0d4('0x12'));logger[_0xe0d4('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x1181ee,'request\x20sent',JSON[_0xe0d4('0x14')](_0x47ff34));if(_0x47ff34[_0xe0d4('0x15')]){if(_0x47ff34['error'][_0xe0d4('0x16')]===0x1f4){logger['error'](_0xe0d4('0x11'),_0x1181ee,_0x47ff34[_0xe0d4('0x15')]['message']);return _0x5e1132(_0x47ff34[_0xe0d4('0x15')][_0xe0d4('0x17')]);}logger[_0xe0d4('0x15')]('CmList,\x20%s,\x20%s',_0x1181ee,_0x47ff34[_0xe0d4('0x15')][_0xe0d4('0x17')]);return _0xba657(_0x47ff34[_0xe0d4('0x15')][_0xe0d4('0x17')]);}else{logger[_0xe0d4('0x10')]('CmList,\x20%s,\x20%s',_0x1181ee,_0xe0d4('0x12'));_0xba657(_0x47ff34[_0xe0d4('0x18')][_0xe0d4('0x17')]);}})[_0xe0d4('0x19')](function(_0x300e9f){logger[_0xe0d4('0x15')](_0xe0d4('0x11'),_0x1181ee,_0x300e9f);_0x5e1132(_0x300e9f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7a3d4af..31bedd3 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 _0x1b42=['remove','emit','removeListener','register','length','cmList:'];(function(_0x3b37a9,_0x4fce02){var _0x1a7fee=function(_0x429579){while(--_0x429579){_0x3b37a9['push'](_0x3b37a9['shift']());}};_0x1a7fee(++_0x4fce02);}(_0x1b42,0x1c2));var _0x21b4=function(_0x5a67d0,_0x2f62ce){_0x5a67d0=_0x5a67d0-0x0;var _0x1ef0b5=_0x1b42[_0x5a67d0];return _0x1ef0b5;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x21b4('0x0'),'update'];function createListener(_0xdefbc,_0xe29a32){return function(_0x12878e){_0xe29a32[_0x21b4('0x1')](_0xdefbc,_0x12878e);};}function removeListener(_0x5c05f7,_0x6faa99){return function(){CmListEvents[_0x21b4('0x2')](_0x5c05f7,_0x6faa99);};}exports[_0x21b4('0x3')]=function(_0x35aa13){for(var _0x2fd9e9=0x0,_0x49fe71=events[_0x21b4('0x4')];_0x2fd9e9<_0x49fe71;_0x2fd9e9++){var _0xf97829=events[_0x2fd9e9];var _0x50ecac=createListener(_0x21b4('0x5')+_0xf97829,_0x35aa13);CmListEvents['on'](_0xf97829,_0x50ecac);}}; \ No newline at end of file +var _0x8a01=['./cmList.events','save','remove','emit','register','cmList:'];(function(_0x183a34,_0x1213a2){var _0xe63b9a=function(_0x31e47a){while(--_0x31e47a){_0x183a34['push'](_0x183a34['shift']());}};_0xe63b9a(++_0x1213a2);}(_0x8a01,0x96));var _0x18a0=function(_0x259af9,_0x48e01c){_0x259af9=_0x259af9-0x0;var _0x3c73a1=_0x8a01[_0x259af9];return _0x3c73a1;};'use strict';var CmListEvents=require(_0x18a0('0x0'));var events=[_0x18a0('0x1'),_0x18a0('0x2'),'update'];function createListener(_0x33c60c,_0x3fe000){return function(_0x258f2f){_0x3fe000[_0x18a0('0x3')](_0x33c60c,_0x258f2f);};}function removeListener(_0x70d21e,_0x5edd57){return function(){CmListEvents['removeListener'](_0x70d21e,_0x5edd57);};}exports[_0x18a0('0x4')]=function(_0x32639b){for(var _0xb4d28a=0x0,_0x2975b4=events['length'];_0xb4d28a<_0x2975b4;_0xb4d28a++){var _0x46ad0d=events[_0xb4d28a];var _0x4943e6=createListener(_0x18a0('0x5')+_0x46ad0d,_0x32639b);CmListEvents['on'](_0x46ad0d,_0x4943e6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 73e8d77..e955db1 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 _0x18b8=['/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','update','destroy','removeDispositions','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getGlobalCustomFields','/:id','show'];(function(_0x218c0c,_0x2b21e3){var _0xf0347d=function(_0xb3b51c){while(--_0xb3b51c){_0x218c0c['push'](_0x218c0c['shift']());}};_0xf0347d(++_0x2b21e3);}(_0x18b8,0xff));var _0x818b=function(_0x57c7d7,_0x245a80){_0x57c7d7=_0x57c7d7-0x0;var _0x59cab1=_0x18b8[_0x57c7d7];return _0x59cab1;};'use strict';var multer=require(_0x818b('0x0'));var util=require(_0x818b('0x1'));var path=require(_0x818b('0x2'));var timeout=require(_0x818b('0x3'));var express=require(_0x818b('0x4'));var router=express[_0x818b('0x5')]();var fs_extra=require(_0x818b('0x6'));var auth=require(_0x818b('0x7'));var interaction=require(_0x818b('0x8'));var config=require(_0x818b('0x9'));var controller=require('./cmList.controller');router[_0x818b('0xa')]('/',auth[_0x818b('0xb')](),controller[_0x818b('0xc')]);router[_0x818b('0xa')](_0x818b('0xd'),auth[_0x818b('0xb')](),controller[_0x818b('0xe')]);router[_0x818b('0xa')]('/global_fields',auth[_0x818b('0xb')](),controller[_0x818b('0xf')]);router[_0x818b('0xa')](_0x818b('0x10'),auth['isAuthenticated'](),controller[_0x818b('0x11')]);router[_0x818b('0xa')](_0x818b('0x12'),auth[_0x818b('0xb')](),controller[_0x818b('0x13')]);router[_0x818b('0xa')](_0x818b('0x14'),auth[_0x818b('0xb')](),controller[_0x818b('0x15')]);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x818b('0x16')]);router[_0x818b('0xa')](_0x818b('0x17'),auth[_0x818b('0xb')](),controller[_0x818b('0x18')]);router[_0x818b('0xa')](_0x818b('0x19'),auth[_0x818b('0xb')](),controller[_0x818b('0x1a')]);router[_0x818b('0x1b')]('/',auth['isAuthenticated'](),controller[_0x818b('0x1c')]);router[_0x818b('0x1b')](_0x818b('0x12'),auth[_0x818b('0xb')](),controller[_0x818b('0x1d')]);router['post'](_0x818b('0x14'),auth[_0x818b('0xb')](),controller[_0x818b('0x1e')]);router[_0x818b('0x1b')](_0x818b('0x17'),auth[_0x818b('0xb')](),controller[_0x818b('0x1f')]);router[_0x818b('0x1b')](_0x818b('0x19'),auth[_0x818b('0xb')](),controller[_0x818b('0x20')]);router['put'](_0x818b('0x10'),auth[_0x818b('0xb')](),controller[_0x818b('0x21')]);router['delete'](_0x818b('0x10'),auth[_0x818b('0xb')](),controller[_0x818b('0x22')]);router['delete'](_0x818b('0x12'),auth[_0x818b('0xb')](),controller[_0x818b('0x23')]);router[_0x818b('0x24')](_0x818b('0x19'),auth[_0x818b('0xb')](),controller[_0x818b('0x25')]);module[_0x818b('0x26')]=router; \ No newline at end of file +var _0x5145=['update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','show','getContacts','/:id/contacts/csv','/:id/users','getAgents','post','create','/:id/dispositions','addContacts','addCustomField','addAgents','put'];(function(_0x180680,_0x27cb27){var _0xd4f2dc=function(_0x7762b0){while(--_0x7762b0){_0x180680['push'](_0x180680['shift']());}};_0xd4f2dc(++_0x27cb27);}(_0x5145,0x1bf));var _0x5514=function(_0x4f81b8,_0x5ab18b){_0x4f81b8=_0x4f81b8-0x0;var _0x3408c1=_0x5145[_0x4f81b8];return _0x3408c1;};'use strict';var multer=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var path=require(_0x5514('0x2'));var timeout=require(_0x5514('0x3'));var express=require(_0x5514('0x4'));var router=express[_0x5514('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5514('0x6'));var interaction=require(_0x5514('0x7'));var config=require(_0x5514('0x8'));var controller=require(_0x5514('0x9'));router[_0x5514('0xa')]('/',auth[_0x5514('0xb')](),controller[_0x5514('0xc')]);router['get']('/describe',auth[_0x5514('0xb')](),controller[_0x5514('0xd')]);router[_0x5514('0xa')](_0x5514('0xe'),auth[_0x5514('0xb')](),controller[_0x5514('0xf')]);router[_0x5514('0xa')](_0x5514('0x10'),auth['isAuthenticated'](),controller[_0x5514('0x11')]);router[_0x5514('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x5514('0xa')]('/:id/contacts',auth[_0x5514('0xb')](),controller[_0x5514('0x12')]);router['get'](_0x5514('0x13'),auth[_0x5514('0xb')](),controller['getContactsCsv']);router[_0x5514('0xa')]('/:id/fields',auth[_0x5514('0xb')](),controller['getCustomFields']);router['get'](_0x5514('0x14'),auth['isAuthenticated'](),controller[_0x5514('0x15')]);router[_0x5514('0x16')]('/',auth[_0x5514('0xb')](),controller[_0x5514('0x17')]);router['post'](_0x5514('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x5514('0x16')]('/:id/contacts',auth[_0x5514('0xb')](),controller[_0x5514('0x19')]);router[_0x5514('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5514('0x1a')]);router[_0x5514('0x16')](_0x5514('0x14'),auth['isAuthenticated'](),controller[_0x5514('0x1b')]);router[_0x5514('0x1c')](_0x5514('0x10'),auth[_0x5514('0xb')](),controller[_0x5514('0x1d')]);router[_0x5514('0x1e')](_0x5514('0x10'),auth[_0x5514('0xb')](),controller[_0x5514('0x1f')]);router[_0x5514('0x1e')]('/:id/dispositions',auth[_0x5514('0xb')](),controller[_0x5514('0x20')]);router[_0x5514('0x1e')]('/:id/users',auth[_0x5514('0xb')](),controller['removeAgents']);module[_0x5514('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a264b22..aa771e5 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 _0x1713=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x676a53,_0x2d7dda){var _0x1a4a81=function(_0x25c3f5){while(--_0x25c3f5){_0x676a53['push'](_0x676a53['shift']());}};_0x1a4a81(++_0x2d7dda);}(_0x1713,0x1a8));var _0x3171=function(_0x4432a5,_0x170722){_0x4432a5=_0x4432a5-0x0;var _0x3db217=_0x1713[_0x4432a5];return _0x3db217;};'use strict';var Sequelize=require(_0x3171('0x0'));module[_0x3171('0x1')]={'name':{'type':Sequelize[_0x3171('0x2')],'get':function(_0x52b20c){return this['getDataValue'](_0x3171('0x3'));}},'field':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x89fa=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x18cec0,_0x55feaf){var _0x53c59a=function(_0x521285){while(--_0x521285){_0x18cec0['push'](_0x18cec0['shift']());}};_0x53c59a(++_0x55feaf);}(_0x89fa,0x15b));var _0xa89f=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x89fa[_0x338f73];return _0x163fdf;};'use strict';var Sequelize=require(_0xa89f('0x0'));module[_0xa89f('0x1')]={'name':{'type':Sequelize[_0xa89f('0x2')],'get':function(_0x55297e){return this[_0xa89f('0x3')](_0xa89f('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xa89f('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xa89f('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 9cb4b61..36bea58 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(_0x10dfd0,_0x514dfb){var _0x737d94=function(_0x1ba65e){while(--_0x1ba65e){_0x10dfd0['push'](_0x10dfd0['shift']());}};_0x737d94(++_0x514dfb);}(_0x7a54,0x106));var _0x47a5=function(_0x5d7782,_0x352112){_0x5d7782=_0x5d7782-0x0;var _0x33d729=_0x7a54[_0x5d7782];return _0x33d729;};'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 _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(_0x295115,_0x17ebc2){var _0x3515a5=function(_0x5cb91b){while(--_0x5cb91b){_0x295115['push'](_0x295115['shift']());}};_0x3515a5(++_0x17ebc2);}(_0x7a54,0x106));var _0x47a5=function(_0x4b4962,_0x3baa27){_0x4b4962=_0x4b4962-0x0;var _0x2150cd=_0x7a54[_0x4b4962];return _0x2150cd;};'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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 50629a7..cc1c624 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 _0x426e=['tools_conditions','util','../../config/logger','api','path','../../config/environment','./condition.attributes','exports','define','Condition'];(function(_0x11da1e,_0x597cc5){var _0x404daa=function(_0x3de8f7){while(--_0x3de8f7){_0x11da1e['push'](_0x11da1e['shift']());}};_0x404daa(++_0x597cc5);}(_0x426e,0xfb));var _0xe426=function(_0x18db49,_0x20affd){_0x18db49=_0x18db49-0x0;var _0x1e80e4=_0x426e[_0x18db49];return _0x1e80e4;};'use strict';var _=require('lodash');var util=require(_0xe426('0x0'));var logger=require(_0xe426('0x1'))(_0xe426('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe426('0x3'));var rimraf=require('rimraf');var config=require(_0xe426('0x4'));var attributes=require(_0xe426('0x5'));module[_0xe426('0x6')]=function(_0x119d37,_0x2697bd){return _0x119d37[_0xe426('0x7')](_0xe426('0x8'),attributes,{'tableName':_0xe426('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fc9=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','define'];(function(_0x569d6c,_0x38e90e){var _0x5462bd=function(_0x502129){while(--_0x502129){_0x569d6c['push'](_0x569d6c['shift']());}};_0x5462bd(++_0x38e90e);}(_0x8fc9,0xbb));var _0x98fc=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x8fc9[_0x28611e];return _0x530f69;};'use strict';var _=require(_0x98fc('0x0'));var util=require(_0x98fc('0x1'));var logger=require(_0x98fc('0x2'))(_0x98fc('0x3'));var moment=require(_0x98fc('0x4'));var BPromise=require(_0x98fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98fc('0x6'));var rimraf=require(_0x98fc('0x7'));var config=require(_0x98fc('0x8'));var attributes=require(_0x98fc('0x9'));module['exports']=function(_0x1ebb8e,_0x4366e2){return _0x1ebb8e[_0x98fc('0xa')]('Condition',attributes,{'tableName':'tools_conditions','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 c25ae9c..72ce264 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 _0x4140=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x323aa0,_0x1998f6){var _0x5176fb=function(_0x190866){while(--_0x190866){_0x323aa0['push'](_0x323aa0['shift']());}};_0x5176fb(++_0x1998f6);}(_0x4140,0x12b));var _0x0414=function(_0x43b609,_0xcf0924){_0x43b609=_0x43b609-0x0;var _0x5d4cef=_0x4140[_0x43b609];return _0x5d4cef;};'use strict';var _=require(_0x0414('0x0'));var util=require(_0x0414('0x1'));var moment=require('moment');var BPromise=require(_0x0414('0x2'));var rs=require(_0x0414('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0414('0x4'))['db'];var utils=require(_0x0414('0x5'));var logger=require(_0x0414('0x6'))('rpc');var config=require(_0x0414('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0414('0x8')][_0x0414('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11fc2b,_0x25ce3d,_0x1d0bf9){return new BPromise(function(_0x59c110,_0xfabcf5){return client[_0x0414('0xa')](_0x11fc2b,_0x1d0bf9)['then'](function(_0x57b46d){logger[_0x0414('0xb')](_0x0414('0xc'),_0x25ce3d,_0x0414('0xd'));logger[_0x0414('0xe')](_0x0414('0xf'),_0x25ce3d,_0x0414('0xd'),JSON[_0x0414('0x10')](_0x57b46d));if(_0x57b46d[_0x0414('0x11')]){if(_0x57b46d['error'][_0x0414('0x12')]===0x1f4){logger[_0x0414('0x11')](_0x0414('0xc'),_0x25ce3d,_0x57b46d[_0x0414('0x11')][_0x0414('0x13')]);return _0xfabcf5(_0x57b46d['error']['message']);}logger['error'](_0x0414('0xc'),_0x25ce3d,_0x57b46d[_0x0414('0x11')][_0x0414('0x13')]);return _0x59c110(_0x57b46d[_0x0414('0x11')][_0x0414('0x13')]);}else{logger['info'](_0x0414('0xc'),_0x25ce3d,_0x0414('0xd'));_0x59c110(_0x57b46d['result'][_0x0414('0x13')]);}})[_0x0414('0x14')](function(_0x2fe551){logger['error'](_0x0414('0xc'),_0x25ce3d,_0x2fe551);_0xfabcf5(_0x2fe551);});});} \ No newline at end of file +var _0x078e=['util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash'];(function(_0x444609,_0x181d97){var _0x1ed8ea=function(_0x1b0b45){while(--_0x1b0b45){_0x444609['push'](_0x444609['shift']());}};_0x1ed8ea(++_0x181d97);}(_0x078e,0x107));var _0xe078=function(_0x22a640,_0x589baf){_0x22a640=_0x22a640-0x0;var _0x1a99f8=_0x078e[_0x22a640];return _0x1a99f8;};'use strict';var _=require(_0xe078('0x0'));var util=require(_0xe078('0x1'));var moment=require(_0xe078('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe078('0x3'));var db=require(_0xe078('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe078('0x5'))(_0xe078('0x6'));var config=require(_0xe078('0x7'));var jayson=require(_0xe078('0x8'));var client=jayson[_0xe078('0x9')][_0xe078('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x568236,_0x515862,_0x377aed){return new BPromise(function(_0x85bc3c,_0xdba823){return client[_0xe078('0xb')](_0x568236,_0x377aed)[_0xe078('0xc')](function(_0x52f254){logger['info'](_0xe078('0xd'),_0x515862,_0xe078('0xe'));logger[_0xe078('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x515862,_0xe078('0xe'),JSON[_0xe078('0x10')](_0x52f254));if(_0x52f254[_0xe078('0x11')]){if(_0x52f254['error'][_0xe078('0x12')]===0x1f4){logger['error'](_0xe078('0xd'),_0x515862,_0x52f254['error'][_0xe078('0x13')]);return _0xdba823(_0x52f254['error'][_0xe078('0x13')]);}logger['error'](_0xe078('0xd'),_0x515862,_0x52f254['error']['message']);return _0x85bc3c(_0x52f254[_0xe078('0x11')][_0xe078('0x13')]);}else{logger[_0xe078('0x14')]('Condition,\x20%s,\x20%s',_0x515862,'request\x20sent');_0x85bc3c(_0x52f254['result'][_0xe078('0x13')]);}})[_0xe078('0x15')](function(_0x3580e9){logger[_0xe078('0x11')]('Condition,\x20%s,\x20%s',_0x515862,_0x3580e9);_0xdba823(_0x3580e9);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index ea4dd95..d9ca22e 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 _0xf44d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','/:id','isAuthenticated'];(function(_0x1f4e10,_0x1db2a1){var _0x4c9c4d=function(_0x2b21af){while(--_0x2b21af){_0x1f4e10['push'](_0x1f4e10['shift']());}};_0x4c9c4d(++_0x1db2a1);}(_0xf44d,0x120));var _0xdf44=function(_0x3ceecc,_0x184ee8){_0x3ceecc=_0x3ceecc-0x0;var _0x4eeb95=_0xf44d[_0x3ceecc];return _0x4eeb95;};'use strict';var multer=require(_0xdf44('0x0'));var util=require(_0xdf44('0x1'));var path=require(_0xdf44('0x2'));var timeout=require(_0xdf44('0x3'));var express=require(_0xdf44('0x4'));var router=express[_0xdf44('0x5')]();var fs_extra=require(_0xdf44('0x6'));var auth=require(_0xdf44('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdf44('0x8'));var controller=require(_0xdf44('0x9'));router['put'](_0xdf44('0xa'),auth[_0xdf44('0xb')](),controller['update']);router[_0xdf44('0xc')](_0xdf44('0xa'),auth[_0xdf44('0xb')](),controller[_0xdf44('0xd')]);module[_0xdf44('0xe')]=router; \ No newline at end of file +var _0x1c6c=['../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x22766f,_0x577e75){var _0x5e0773=function(_0x137a40){while(--_0x137a40){_0x22766f['push'](_0x22766f['shift']());}};_0x5e0773(++_0x577e75);}(_0x1c6c,0x1ba));var _0xc1c6=function(_0xdf3c94,_0x24f3e0){_0xdf3c94=_0xdf3c94-0x0;var _0x2362c9=_0x1c6c[_0xdf3c94];return _0x2362c9;};'use strict';var multer=require(_0xc1c6('0x0'));var util=require(_0xc1c6('0x1'));var path=require('path');var timeout=require(_0xc1c6('0x2'));var express=require(_0xc1c6('0x3'));var router=express[_0xc1c6('0x4')]();var fs_extra=require(_0xc1c6('0x5'));var auth=require(_0xc1c6('0x6'));var interaction=require(_0xc1c6('0x7'));var config=require(_0xc1c6('0x8'));var controller=require('./condition.controller');router[_0xc1c6('0x9')](_0xc1c6('0xa'),auth[_0xc1c6('0xb')](),controller[_0xc1c6('0xc')]);router['delete'](_0xc1c6('0xa'),auth[_0xc1c6('0xb')](),controller[_0xc1c6('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 23daea4..e5947d3 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 _0x0e0f=['STRING','sequelize','name','INTEGER'];(function(_0x5f0335,_0x4c9cc3){var _0x3d775a=function(_0x1cc3e8){while(--_0x1cc3e8){_0x5f0335['push'](_0x5f0335['shift']());}};_0x3d775a(++_0x4c9cc3);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x9881c5,_0x57fe72){_0x9881c5=_0x9881c5-0x0;var _0x19cd18=_0x0e0f[_0x9881c5];return _0x19cd18;};'use strict';var Sequelize=require(_0xf0e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf0e0('0x1')},'OrderBy':{'type':Sequelize[_0xf0e0('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf0e0('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x48a3=['sequelize','exports','STRING','INTEGER'];(function(_0xa1f5c4,_0x247496){var _0x3f2f74=function(_0x3dae53){while(--_0x3dae53){_0xa1f5c4['push'](_0xa1f5c4['shift']());}};_0x3f2f74(++_0x247496);}(_0x48a3,0x74));var _0x348a=function(_0x238f08,_0x17b2d6){_0x238f08=_0x238f08-0x0;var _0x306697=_0x48a3[_0x238f08];return _0x306697;};'use strict';var Sequelize=require(_0x348a('0x0'));module[_0x348a('0x1')]={'name':{'type':Sequelize[_0x348a('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x348a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x348a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 206336b..3a63867 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 _0x1399=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName'];(function(_0x4192da,_0x46b408){var _0xe87ea6=function(_0x123fb2){while(--_0x123fb2){_0x4192da['push'](_0x4192da['shift']());}};_0xe87ea6(++_0x46b408);}(_0x1399,0x16c));var _0x9139=function(_0x4fcb0f,_0x5e8627){_0x4fcb0f=_0x4fcb0f-0x0;var _0xf9107d=_0x1399[_0x4fcb0f];return _0xf9107d;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){var _0x31c22d=_0x1a7350['get']({'plain':!![]});var _0x3ed4da=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x3ed4da,'resourceId':_0x31c22d['id']}})[_0x9139('0x22')](function(){return _0x1a7350;});})[_0x9139('0x22')](function(){_0x1aee3b['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x39e8cf,_0x452d9a){return function(_0x55e95f){if(!_0x55e95f){_0x39e8cf[_0x9139('0x25')](0x194);}return _0x55e95f;};}function handleError(_0x22e11e,_0x2a35fd){_0x2a35fd=_0x2a35fd||0x1f4;return function(_0x22994c){logger[_0x9139('0x26')](_0x22994c[_0x9139('0x27')]);if(_0x22994c[_0x9139('0x28')]){delete _0x22994c['name'];}_0x22e11e['status'](_0x2a35fd)[_0x9139('0x29')](_0x22994c);};}exports[_0x9139('0x2a')]=function(_0xd27355,_0x4c1693){var _0x50d545={},_0x24e8d5={},_0x2118a2={'count':0x0,'rows':[]};var _0x2dff49=_[_0x9139('0x2b')](db[_0x9139('0x2c')]['rawAttributes'],function(_0x5a1673){return{'name':_0x5a1673[_0x9139('0x2d')],'type':_0x5a1673['type']['key']};});_0x24e8d5[_0x9139('0x2e')]=_[_0x9139('0x2b')](_0x2dff49,'name');_0x24e8d5[_0x9139('0x2f')]=_[_0x9139('0x30')](_0xd27355['query']);_0x24e8d5[_0x9139('0x31')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],_0x24e8d5[_0x9139('0x2f')]);_0x50d545[_0x9139('0x33')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],qs[_0x9139('0x34')](_0xd27355[_0x9139('0x2f')][_0x9139('0x34')]));_0x50d545[_0x9139('0x33')]=_0x50d545['attributes'][_0x9139('0x35')]?_0x50d545[_0x9139('0x33')]:_0x24e8d5['model'];if(!_0xd27355[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x50d545['limit']=qs[_0x9139('0x1a')](_0xd27355[_0x9139('0x2f')][_0x9139('0x1a')]);_0x50d545[_0x9139('0x18')]=qs[_0x9139('0x18')](_0xd27355[_0x9139('0x2f')][_0x9139('0x18')]);}_0x50d545[_0x9139('0x38')]=qs[_0x9139('0x39')](_0xd27355[_0x9139('0x2f')]['sort']);_0x50d545[_0x9139('0x3a')]=qs[_0x9139('0x31')](_[_0x9139('0x3b')](_0xd27355[_0x9139('0x2f')],_0x24e8d5[_0x9139('0x31')]),_0x2dff49);if(_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]){_0x50d545['where']=_[_0x9139('0x3d')](_0x50d545['where'],{'$or':_[_0x9139('0x2b')](_0x2dff49,function(_0x11789e){if(_0x11789e[_0x9139('0x3e')]!=='VIRTUAL'){var _0x1228b6={};_0x1228b6[_0x11789e[_0x9139('0x28')]]={'$like':'%'+_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x1228b6;}})});}_0x50d545=_[_0x9139('0x3d')]({},_0x50d545,_0xd27355[_0x9139('0x3f')]);var _0x3c98a4={'where':_0x50d545[_0x9139('0x3a')]};return db[_0x9139('0x2c')][_0x9139('0x40')](_0x3c98a4)['then'](function(_0xf14393){_0x2118a2[_0x9139('0x40')]=_0xf14393;if(_0xd27355[_0x9139('0x2f')]['includeAll']){_0x50d545['include']=[{'all':!![]}];}return db['ContactItemType'][_0x9139('0x41')](_0x50d545);})[_0x9139('0x22')](function(_0x3611b4){_0x2118a2[_0x9139('0x42')]=_0x3611b4;return _0x2118a2;})[_0x9139('0x22')](respondWithFilteredResult(_0x4c1693,_0x50d545))['catch'](handleError(_0x4c1693,null));};exports[_0x9139('0x43')]=function(_0x2f3ed4,_0x40fd52){var _0xf81f77={'raw':!![],'where':{'id':_0x2f3ed4['params']['id']}},_0x2197ff={};_0x2197ff[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2197ff['query']=_['keys'](_0x2f3ed4[_0x9139('0x2f')]);_0x2197ff[_0x9139('0x31')]=_['intersection'](_0x2197ff['model'],_0x2197ff[_0x9139('0x2f')]);_0xf81f77[_0x9139('0x33')]=_['intersection'](_0x2197ff[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2f3ed4['query'][_0x9139('0x34')]));_0xf81f77['attributes']=_0xf81f77['attributes'][_0x9139('0x35')]?_0xf81f77[_0x9139('0x33')]:_0x2197ff[_0x9139('0x2e')];if(_0x2f3ed4[_0x9139('0x2f')][_0x9139('0x45')]){_0xf81f77['include']=[{'all':!![]}];}_0xf81f77=_[_0x9139('0x3d')]({},_0xf81f77,_0x2f3ed4[_0x9139('0x3f')]);return db[_0x9139('0x2c')]['find'](_0xf81f77)[_0x9139('0x22')](handleEntityNotFound(_0x40fd52,null))[_0x9139('0x22')](respondWithResult(_0x40fd52,null))[_0x9139('0x46')](handleError(_0x40fd52,null));};exports[_0x9139('0x47')]=function(_0x215793,_0x31395f){return db[_0x9139('0x2c')][_0x9139('0x47')](_0x215793[_0x9139('0x48')],{})[_0x9139('0x22')](function(_0x2da28c){var _0x54c926=_0x215793[_0x9139('0x49')][_0x9139('0x4a')]({'plain':!![]});if(!_0x54c926)throw new Error(_0x9139('0x4b'));if(_0x54c926['role']===_0x9139('0x49')){var _0x46f77a=_0x2da28c['get']({'plain':!![]});var _0x2f4a6f=_0x9139('0x23');return db[_0x9139('0x4c')]['find']({'where':{'name':_0x2f4a6f,'userProfileId':_0x54c926[_0x9139('0x4d')]},'raw':!![]})[_0x9139('0x22')](function(_0x1404ce){if(_0x1404ce&&_0x1404ce[_0x9139('0x4e')]===0x0){return db['UserProfileResource'][_0x9139('0x47')]({'name':_0x46f77a[_0x9139('0x28')],'resourceId':_0x46f77a['id'],'type':_0x1404ce[_0x9139('0x28')],'sectionId':_0x1404ce['id']},{})['then'](function(){return _0x2da28c;});}else{return _0x2da28c;}})[_0x9139('0x46')](function(_0x146201){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x146201);throw _0x146201;});}return _0x2da28c;})[_0x9139('0x22')](respondWithResult(_0x31395f,0xc9))[_0x9139('0x46')](handleError(_0x31395f,null));};exports[_0x9139('0x21')]=function(_0x5857bf,_0x35002d){if(_0x5857bf[_0x9139('0x48')]['id']){delete _0x5857bf['body']['id'];}return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x5857bf[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x35002d,null))[_0x9139('0x22')](saveUpdates(_0x5857bf['body'],null))[_0x9139('0x22')](respondWithResult(_0x35002d,null))[_0x9139('0x46')](handleError(_0x35002d,null));};exports['destroy']=function(_0x500863,_0x212d56){return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x500863['params']['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x212d56,null))['then'](db['CmContactHasItem'][_0x9139('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x500863[_0x9139('0x51')]['id']}}))[_0x9139('0x22')](removeEntity(_0x212d56,null))[_0x9139('0x46')](handleError(_0x212d56,null));}; \ No newline at end of file +var _0x4137=['userProfileId','autoAssociation','find','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','get','end','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','query','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x206247,_0x149b6c){var _0x523c16=function(_0x2ee1b2){while(--_0x2ee1b2){_0x206247['push'](_0x206247['shift']());}};_0x523c16(++_0x149b6c);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){var _0x1d97fd=_0x2fc0f4[_0x7413('0x26')]({'plain':!![]});var _0x1d455b='ContactItemTypes';return db['UserProfileResource'][_0x7413('0x24')]({'where':{'type':_0x1d455b,'resourceId':_0x1d97fd['id']}})['then'](function(){return _0x2fc0f4;});})[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x27')]();});}};}function handleEntityNotFound(_0x4c2e90,_0x35e0fd){return function(_0x896552){if(!_0x896552){_0x4c2e90[_0x7413('0x28')](0x194);}return _0x896552;};}function handleError(_0x4843fd,_0x19970c){_0x19970c=_0x19970c||0x1f4;return function(_0x2e521f){logger['error'](_0x2e521f[_0x7413('0x29')]);if(_0x2e521f['name']){delete _0x2e521f[_0x7413('0x2a')];}_0x4843fd[_0x7413('0x1a')](_0x19970c)[_0x7413('0x2b')](_0x2e521f);};}exports[_0x7413('0x2c')]=function(_0x25fa52,_0x2004ea){var _0x5bb3ea={},_0x1ffb6f={},_0x17c342={'count':0x0,'rows':[]};var _0x39db32=_[_0x7413('0x2d')](db[_0x7413('0x2e')][_0x7413('0x2f')],function(_0x185cfe){return{'name':_0x185cfe['fieldName'],'type':_0x185cfe[_0x7413('0x30')][_0x7413('0x31')]};});_0x1ffb6f[_0x7413('0x32')]=_[_0x7413('0x2d')](_0x39db32,_0x7413('0x2a'));_0x1ffb6f['query']=_[_0x7413('0x33')](_0x25fa52['query']);_0x1ffb6f[_0x7413('0x34')]=_[_0x7413('0x35')](_0x1ffb6f[_0x7413('0x32')],_0x1ffb6f['query']);_0x5bb3ea[_0x7413('0x36')]=_['intersection'](_0x1ffb6f[_0x7413('0x32')],qs[_0x7413('0x37')](_0x25fa52['query']['fields']));_0x5bb3ea[_0x7413('0x36')]=_0x5bb3ea[_0x7413('0x36')][_0x7413('0x38')]?_0x5bb3ea['attributes']:_0x1ffb6f['model'];if(!_0x25fa52[_0x7413('0x39')]['hasOwnProperty']('nolimit')){_0x5bb3ea[_0x7413('0x1d')]=qs['limit'](_0x25fa52[_0x7413('0x39')][_0x7413('0x1d')]);_0x5bb3ea[_0x7413('0x1c')]=qs[_0x7413('0x1c')](_0x25fa52[_0x7413('0x39')]['offset']);}_0x5bb3ea[_0x7413('0x3a')]=qs[_0x7413('0x3b')](_0x25fa52[_0x7413('0x39')][_0x7413('0x3b')]);_0x5bb3ea[_0x7413('0x3c')]=qs[_0x7413('0x34')](_[_0x7413('0x3d')](_0x25fa52[_0x7413('0x39')],_0x1ffb6f[_0x7413('0x34')]),_0x39db32);if(_0x25fa52[_0x7413('0x39')][_0x7413('0x3e')]){_0x5bb3ea[_0x7413('0x3c')]=_['merge'](_0x5bb3ea[_0x7413('0x3c')],{'$or':_['map'](_0x39db32,function(_0x56cb6f){if(_0x56cb6f['type']!=='VIRTUAL'){var _0x5c86ad={};_0x5c86ad[_0x56cb6f[_0x7413('0x2a')]]={'$like':'%'+_0x25fa52['query']['filter']+'%'};return _0x5c86ad;}})});}_0x5bb3ea=_[_0x7413('0x3f')]({},_0x5bb3ea,_0x25fa52['options']);var _0x4c6746={'where':_0x5bb3ea[_0x7413('0x3c')]};return db[_0x7413('0x2e')][_0x7413('0x1e')](_0x4c6746)[_0x7413('0x25')](function(_0x8049c0){_0x17c342['count']=_0x8049c0;if(_0x25fa52[_0x7413('0x39')]['includeAll']){_0x5bb3ea[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2e')][_0x7413('0x41')](_0x5bb3ea);})[_0x7413('0x25')](function(_0x3f7da2){_0x17c342[_0x7413('0x42')]=_0x3f7da2;return _0x17c342;})[_0x7413('0x25')](respondWithFilteredResult(_0x2004ea,_0x5bb3ea))[_0x7413('0x43')](handleError(_0x2004ea,null));};exports[_0x7413('0x44')]=function(_0x1dd908,_0x38cd61){var _0x1e8bbd={'raw':!![],'where':{'id':_0x1dd908['params']['id']}},_0x3fbec4={};_0x3fbec4[_0x7413('0x32')]=_[_0x7413('0x33')](db[_0x7413('0x2e')][_0x7413('0x2f')]);_0x3fbec4[_0x7413('0x39')]=_[_0x7413('0x33')](_0x1dd908[_0x7413('0x39')]);_0x3fbec4[_0x7413('0x34')]=_[_0x7413('0x35')](_0x3fbec4[_0x7413('0x32')],_0x3fbec4[_0x7413('0x39')]);_0x1e8bbd['attributes']=_[_0x7413('0x35')](_0x3fbec4['model'],qs[_0x7413('0x37')](_0x1dd908[_0x7413('0x39')][_0x7413('0x37')]));_0x1e8bbd[_0x7413('0x36')]=_0x1e8bbd[_0x7413('0x36')][_0x7413('0x38')]?_0x1e8bbd[_0x7413('0x36')]:_0x3fbec4[_0x7413('0x32')];if(_0x1dd908[_0x7413('0x39')][_0x7413('0x45')]){_0x1e8bbd['include']=[{'all':!![]}];}_0x1e8bbd=_['merge']({},_0x1e8bbd,_0x1dd908[_0x7413('0x46')]);return db['ContactItemType']['find'](_0x1e8bbd)[_0x7413('0x25')](handleEntityNotFound(_0x38cd61,null))[_0x7413('0x25')](respondWithResult(_0x38cd61,null))['catch'](handleError(_0x38cd61,null));};exports[_0x7413('0x47')]=function(_0x586d25,_0x562bae){return db[_0x7413('0x2e')]['create'](_0x586d25[_0x7413('0x48')],{})[_0x7413('0x25')](function(_0x1a7338){var _0x5fe361=_0x586d25[_0x7413('0x49')][_0x7413('0x26')]({'plain':!![]});if(!_0x5fe361)throw new Error(_0x7413('0x4a'));if(_0x5fe361[_0x7413('0x4b')]===_0x7413('0x49')){var _0x2031e3=_0x1a7338['get']({'plain':!![]});var _0x369891='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x369891,'userProfileId':_0x5fe361[_0x7413('0x4c')]},'raw':!![]})[_0x7413('0x25')](function(_0x453510){if(_0x453510&&_0x453510[_0x7413('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2031e3[_0x7413('0x2a')],'resourceId':_0x2031e3['id'],'type':_0x453510['name'],'sectionId':_0x453510['id']},{})[_0x7413('0x25')](function(){return _0x1a7338;});}else{return _0x1a7338;}})['catch'](function(_0x4f8353){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f8353);throw _0x4f8353;});}return _0x1a7338;})['then'](respondWithResult(_0x562bae,0xc9))[_0x7413('0x43')](handleError(_0x562bae,null));};exports[_0x7413('0x23')]=function(_0x229573,_0x2ffec6){if(_0x229573[_0x7413('0x48')]['id']){delete _0x229573['body']['id'];}return db[_0x7413('0x2e')][_0x7413('0x4e')]({'where':{'id':_0x229573[_0x7413('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ffec6,null))[_0x7413('0x25')](saveUpdates(_0x229573['body'],null))['then'](respondWithResult(_0x2ffec6,null))[_0x7413('0x43')](handleError(_0x2ffec6,null));};exports[_0x7413('0x24')]=function(_0x1939a8,_0x287365){return db[_0x7413('0x2e')][_0x7413('0x4e')]({'where':{'id':_0x1939a8['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x287365,null))['then'](db[_0x7413('0x50')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1939a8[_0x7413('0x4f')]['id']}}))['then'](removeEntity(_0x287365,null))[_0x7413('0x43')](handleError(_0x287365,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 0ee9bb7..8e64c32 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 _0x4156=['define','ContactItemType','tools_contact_item_types','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0xc315de,_0x5dc877){var _0x11a627=function(_0x4039d6){while(--_0x4039d6){_0xc315de['push'](_0xc315de['shift']());}};_0x11a627(++_0x5dc877);}(_0x4156,0x1e4));var _0x6415=function(_0x8b88e2,_0x49149d){_0x8b88e2=_0x8b88e2-0x0;var _0x2b7a43=_0x4156[_0x8b88e2];return _0x2b7a43;};'use strict';var _=require('lodash');var util=require(_0x6415('0x0'));var logger=require(_0x6415('0x1'))(_0x6415('0x2'));var moment=require(_0x6415('0x3'));var BPromise=require(_0x6415('0x4'));var rp=require(_0x6415('0x5'));var fs=require('fs');var path=require(_0x6415('0x6'));var rimraf=require(_0x6415('0x7'));var config=require(_0x6415('0x8'));var attributes=require(_0x6415('0x9'));module['exports']=function(_0x2236a6,_0x3ee00a){return _0x2236a6[_0x6415('0xa')](_0x6415('0xb'),attributes,{'tableName':_0x6415('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6422=['./contactItemType.attributes','exports','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x1f7b1c,_0x56462f){var _0x53c917=function(_0x5af2af){while(--_0x5af2af){_0x1f7b1c['push'](_0x1f7b1c['shift']());}};_0x53c917(++_0x56462f);}(_0x6422,0x163));var _0x2642=function(_0x57072f,_0x4cc521){_0x57072f=_0x57072f-0x0;var _0x290e8b=_0x6422[_0x57072f];return _0x290e8b;};'use strict';var _=require(_0x2642('0x0'));var util=require(_0x2642('0x1'));var logger=require(_0x2642('0x2'))(_0x2642('0x3'));var moment=require(_0x2642('0x4'));var BPromise=require(_0x2642('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2642('0x6'));var config=require(_0x2642('0x7'));var attributes=require(_0x2642('0x8'));module[_0x2642('0x9')]=function(_0x45c10f,_0x48727a){return _0x45c10f['define']('ContactItemType',attributes,{'tableName':_0x2642('0xa'),'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 14e4c34..c60fc9d 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 _0x3b51=['request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xff7722,_0x169000){var _0x12a189=function(_0x114286){while(--_0x114286){_0xff7722['push'](_0xff7722['shift']());}};_0x12a189(++_0x169000);}(_0x3b51,0x19a));var _0x13b5=function(_0x11eec5,_0x49c834){_0x11eec5=_0x11eec5-0x0;var _0x184378=_0x3b51[_0x11eec5];return _0x184378;};'use strict';var _=require('lodash');var util=require(_0x13b5('0x0'));var moment=require(_0x13b5('0x1'));var BPromise=require(_0x13b5('0x2'));var rs=require(_0x13b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13b5('0x4'))('rpc');var config=require(_0x13b5('0x5'));var jayson=require(_0x13b5('0x6'));var client=jayson['client'][_0x13b5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x196568,_0x2659e1,_0x1d9d0d){return new BPromise(function(_0xf05cde,_0x328e2b){return client[_0x13b5('0x8')](_0x196568,_0x1d9d0d)[_0x13b5('0x9')](function(_0x5c392c){logger[_0x13b5('0xa')](_0x13b5('0xb'),_0x2659e1,'request\x20sent');logger[_0x13b5('0xc')](_0x13b5('0xd'),_0x2659e1,_0x13b5('0xe'),JSON['stringify'](_0x5c392c));if(_0x5c392c['error']){if(_0x5c392c['error']['code']===0x1f4){logger[_0x13b5('0xf')](_0x13b5('0xb'),_0x2659e1,_0x5c392c['error'][_0x13b5('0x10')]);return _0x328e2b(_0x5c392c[_0x13b5('0xf')][_0x13b5('0x10')]);}logger[_0x13b5('0xf')](_0x13b5('0xb'),_0x2659e1,_0x5c392c[_0x13b5('0xf')]['message']);return _0xf05cde(_0x5c392c[_0x13b5('0xf')][_0x13b5('0x10')]);}else{logger['info'](_0x13b5('0xb'),_0x2659e1,'request\x20sent');_0xf05cde(_0x5c392c[_0x13b5('0x11')]['message']);}})[_0x13b5('0x12')](function(_0x3d3c1a){logger[_0x13b5('0xf')](_0x13b5('0xb'),_0x2659e1,_0x3d3c1a);_0x328e2b(_0x3d3c1a);});});} \ No newline at end of file +var _0x9dc4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4ba21d,_0x42b3a3){var _0xdf968a=function(_0xb3be52){while(--_0xb3be52){_0x4ba21d['push'](_0x4ba21d['shift']());}};_0xdf968a(++_0x42b3a3);}(_0x9dc4,0x6c));var _0x49dc=function(_0x49fb04,_0x572713){_0x49fb04=_0x49fb04-0x0;var _0x34492b=_0x9dc4[_0x49fb04];return _0x34492b;};'use strict';var _=require(_0x49dc('0x0'));var util=require(_0x49dc('0x1'));var moment=require(_0x49dc('0x2'));var BPromise=require(_0x49dc('0x3'));var rs=require(_0x49dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49dc('0x5'))['db'];var utils=require(_0x49dc('0x6'));var logger=require(_0x49dc('0x7'))(_0x49dc('0x8'));var config=require(_0x49dc('0x9'));var jayson=require(_0x49dc('0xa'));var client=jayson[_0x49dc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d892d,_0x43cd02,_0x3cc694){return new BPromise(function(_0x325133,_0x576212){return client[_0x49dc('0xc')](_0x3d892d,_0x3cc694)['then'](function(_0x2edc23){logger[_0x49dc('0xd')]('ContactItemType,\x20%s,\x20%s',_0x43cd02,_0x49dc('0xe'));logger[_0x49dc('0xf')](_0x49dc('0x10'),_0x43cd02,_0x49dc('0xe'),JSON[_0x49dc('0x11')](_0x2edc23));if(_0x2edc23[_0x49dc('0x12')]){if(_0x2edc23[_0x49dc('0x12')][_0x49dc('0x13')]===0x1f4){logger[_0x49dc('0x12')](_0x49dc('0x14'),_0x43cd02,_0x2edc23[_0x49dc('0x12')][_0x49dc('0x15')]);return _0x576212(_0x2edc23[_0x49dc('0x12')][_0x49dc('0x15')]);}logger['error'](_0x49dc('0x14'),_0x43cd02,_0x2edc23['error'][_0x49dc('0x15')]);return _0x325133(_0x2edc23['error'][_0x49dc('0x15')]);}else{logger[_0x49dc('0xd')](_0x49dc('0x14'),_0x43cd02,_0x49dc('0xe'));_0x325133(_0x2edc23[_0x49dc('0x16')]['message']);}})['catch'](function(_0x2a3581){logger[_0x49dc('0x12')](_0x49dc('0x14'),_0x43cd02,_0x2a3581);_0x576212(_0x2a3581);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 05d050f..40a1b9d 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 _0x830f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x36dc6c,_0x478105){var _0x11d279=function(_0x4ebc90){while(--_0x4ebc90){_0x36dc6c['push'](_0x36dc6c['shift']());}};_0x11d279(++_0x478105);}(_0x830f,0x17a));var _0xf830=function(_0xa42968,_0x5996ec){_0xa42968=_0xa42968-0x0;var _0xc72bb3=_0x830f[_0xa42968];return _0xc72bb3;};'use strict';var multer=require(_0xf830('0x0'));var util=require(_0xf830('0x1'));var path=require('path');var timeout=require(_0xf830('0x2'));var express=require('express');var router=express[_0xf830('0x3')]();var fs_extra=require(_0xf830('0x4'));var auth=require(_0xf830('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf830('0x6'));var controller=require(_0xf830('0x7'));router[_0xf830('0x8')]('/',auth[_0xf830('0x9')](),controller['index']);router[_0xf830('0x8')](_0xf830('0xa'),auth[_0xf830('0x9')](),controller[_0xf830('0xb')]);router[_0xf830('0xc')]('/',auth[_0xf830('0x9')](),controller[_0xf830('0xd')]);router[_0xf830('0xe')](_0xf830('0xa'),auth[_0xf830('0x9')](),controller[_0xf830('0xf')]);router[_0xf830('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf830('0x11')]);module[_0xf830('0x12')]=router; \ No newline at end of file +var _0x4a08=['../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','multer','path','express','../../components/auth/service'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x4a08,0x1dc));var _0x84a0=function(_0x2e1f05,_0x1fbfc7){_0x2e1f05=_0x2e1f05-0x0;var _0xdb750f=_0x4a08[_0x2e1f05];return _0xdb750f;};'use strict';var multer=require(_0x84a0('0x0'));var util=require('util');var path=require(_0x84a0('0x1'));var timeout=require('connect-timeout');var express=require(_0x84a0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x84a0('0x3'));var interaction=require(_0x84a0('0x4'));var config=require(_0x84a0('0x5'));var controller=require(_0x84a0('0x6'));router['get']('/',auth[_0x84a0('0x7')](),controller['index']);router[_0x84a0('0x8')](_0x84a0('0x9'),auth['isAuthenticated'](),controller[_0x84a0('0xa')]);router[_0x84a0('0xb')]('/',auth[_0x84a0('0x7')](),controller[_0x84a0('0xc')]);router[_0x84a0('0xd')](_0x84a0('0x9'),auth[_0x84a0('0x7')](),controller[_0x84a0('0xe')]);router['delete'](_0x84a0('0x9'),auth['isAuthenticated'](),controller[_0x84a0('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5cdbe1b..c82a065 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 _0xbaf0=['name','exports','STRING'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3e75e42..4c70b87 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 _0xcb1e=['./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','Dashboard','include','findAll','rows','catch','show','keys','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','body','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','DashboardId','DashboardItem','options','getItems','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x4fcb90,_0x3c427a){var _0x4a7111=function(_0x1e6530){while(--_0x1e6530){_0x4fcb90['push'](_0x4fcb90['shift']());}};_0x4a7111(++_0x3c427a);}(_0xcb1e,0x1d8));var _0xecb1=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xcb1e[_0x3b7b8a];return _0x441206;};'use strict';var emlformat=require(_0xecb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecb1('0x1'));var jsonpatch=require(_0xecb1('0x2'));var rp=require(_0xecb1('0x3'));var moment=require(_0xecb1('0x4'));var BPromise=require(_0xecb1('0x5'));var Mustache=require(_0xecb1('0x6'));var util=require(_0xecb1('0x7'));var path=require('path');var sox=require(_0xecb1('0x8'));var csv=require(_0xecb1('0x9'));var ejs=require(_0xecb1('0xa'));var fs=require('fs');var fs_extra=require(_0xecb1('0xb'));var _=require('lodash');var squel=require(_0xecb1('0xc'));var crypto=require(_0xecb1('0xd'));var jsforce=require(_0xecb1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xecb1('0x9'));var querystring=require(_0xecb1('0xf'));var Papa=require(_0xecb1('0x10'));var Redis=require('ioredis');var authService=require(_0xecb1('0x11'));var qs=require(_0xecb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecb1('0x13'));var logger=require('../../config/logger')(_0xecb1('0x14'));var utils=require(_0xecb1('0x15'));var config=require(_0xecb1('0x16'));var licenseUtil=require(_0xecb1('0x17'));var db=require(_0xecb1('0x18'))['db'];config[_0xecb1('0x19')]=_[_0xecb1('0x1a')](config[_0xecb1('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xecb1('0x1b'))(new Redis(config[_0xecb1('0x19')]));require(_0xecb1('0x1c'))[_0xecb1('0x1d')](socket);function respondWithStatusCode(_0x1e7222,_0x3087ca){_0x3087ca=_0x3087ca||0xcc;return function(_0xc88714){if(_0xc88714){return _0x1e7222[_0xecb1('0x1e')](_0x3087ca);}return _0x1e7222[_0xecb1('0x1f')](_0x3087ca)['end']();};}function respondWithResult(_0x25cd90,_0x5af590){_0x5af590=_0x5af590||0xc8;return function(_0x43c192){if(_0x43c192){return _0x25cd90[_0xecb1('0x1f')](_0x5af590)[_0xecb1('0x20')](_0x43c192);}};}function respondWithFilteredResult(_0x4b1026,_0x46498f){return function(_0x32fdc2){if(_0x32fdc2){var _0x58bf02=typeof _0x46498f[_0xecb1('0x21')]===_0xecb1('0x22')&&typeof _0x46498f['limit']==='undefined';var _0x3e0db0=_0x32fdc2['count'];var _0xbe330f=_0x58bf02?0x0:_0x46498f['offset'];var _0x528cbe=_0x58bf02?_0x32fdc2[_0xecb1('0x23')]:_0x46498f[_0xecb1('0x21')]+_0x46498f[_0xecb1('0x24')];var _0x302850;if(_0x528cbe>=_0x3e0db0){_0x528cbe=_0x3e0db0;_0x302850=0xc8;}else{_0x302850=0xce;}_0x4b1026[_0xecb1('0x1f')](_0x302850);return _0x4b1026[_0xecb1('0x25')]('Content-Range',_0xbe330f+'-'+_0x528cbe+'/'+_0x3e0db0)[_0xecb1('0x20')](_0x32fdc2);}return null;};}function patchUpdates(_0x471395){return function(_0x72dff4){try{jsonpatch[_0xecb1('0x26')](_0x72dff4,_0x471395,!![]);}catch(_0x130149){return BPromise[_0xecb1('0x27')](_0x130149);}return _0x72dff4[_0xecb1('0x28')]();};}function saveUpdates(_0x2ddd09,_0x16f545){return function(_0x49bbae){if(_0x49bbae){return _0x49bbae[_0xecb1('0x29')](_0x2ddd09)['then'](function(_0x15a53a){return _0x15a53a;});}return null;};}function removeEntity(_0x2ebb78,_0x32bc70){return function(_0x2b0799){if(_0x2b0799){return _0x2b0799['destroy']()[_0xecb1('0x2a')](function(){var _0x15af43=_0x2b0799[_0xecb1('0x2b')]({'plain':!![]});var _0x224d8f=_0xecb1('0x2c');return db[_0xecb1('0x2d')][_0xecb1('0x2e')]({'where':{'type':_0x224d8f,'resourceId':_0x15af43['id']}})['then'](function(){return _0x2b0799;});})[_0xecb1('0x2a')](function(){_0x2ebb78['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da4bf,_0x42ceb0){return function(_0x118669){if(!_0x118669){_0x2da4bf['sendStatus'](0x194);}return _0x118669;};}function handleError(_0xcfde64,_0x478620){_0x478620=_0x478620||0x1f4;return function(_0x1f971b){logger[_0xecb1('0x2f')](_0x1f971b['stack']);if(_0x1f971b['name']){delete _0x1f971b[_0xecb1('0x30')];}_0xcfde64[_0xecb1('0x1f')](_0x478620)[_0xecb1('0x31')](_0x1f971b);};}exports[_0xecb1('0x32')]=function(_0x1b2938,_0x209e46){var _0x249523={},_0x4b3b19={},_0x4a41f3={'count':0x0,'rows':[]};var _0x75ca8b=_[_0xecb1('0x33')](db['Dashboard'][_0xecb1('0x34')],function(_0x223f1e){return{'name':_0x223f1e[_0xecb1('0x35')],'type':_0x223f1e['type'][_0xecb1('0x36')]};});_0x4b3b19[_0xecb1('0x37')]=_['map'](_0x75ca8b,'name');_0x4b3b19[_0xecb1('0x38')]=_['keys'](_0x1b2938[_0xecb1('0x38')]);_0x4b3b19[_0xecb1('0x39')]=_[_0xecb1('0x3a')](_0x4b3b19[_0xecb1('0x37')],_0x4b3b19[_0xecb1('0x38')]);_0x249523[_0xecb1('0x3b')]=_['intersection'](_0x4b3b19['model'],qs['fields'](_0x1b2938['query'][_0xecb1('0x3c')]));_0x249523[_0xecb1('0x3b')]=_0x249523[_0xecb1('0x3b')]['length']?_0x249523['attributes']:_0x4b3b19[_0xecb1('0x37')];if(!_0x1b2938[_0xecb1('0x38')][_0xecb1('0x3d')](_0xecb1('0x3e'))){_0x249523['limit']=qs['limit'](_0x1b2938[_0xecb1('0x38')][_0xecb1('0x24')]);_0x249523[_0xecb1('0x21')]=qs[_0xecb1('0x21')](_0x1b2938[_0xecb1('0x38')]['offset']);}_0x249523[_0xecb1('0x3f')]=qs[_0xecb1('0x40')](_0x1b2938[_0xecb1('0x38')][_0xecb1('0x40')]);_0x249523[_0xecb1('0x41')]=qs['filters'](_[_0xecb1('0x42')](_0x1b2938[_0xecb1('0x38')],_0x4b3b19[_0xecb1('0x39')]),_0x75ca8b);if(_0x1b2938[_0xecb1('0x38')]['filter']){_0x249523[_0xecb1('0x41')]=_[_0xecb1('0x43')](_0x249523[_0xecb1('0x41')],{'$or':_[_0xecb1('0x33')](_0x75ca8b,function(_0x22111d){if(_0x22111d[_0xecb1('0x44')]!=='VIRTUAL'){var _0x4570db={};_0x4570db[_0x22111d[_0xecb1('0x30')]]={'$like':'%'+_0x1b2938['query'][_0xecb1('0x45')]+'%'};return _0x4570db;}})});}_0x249523=_[_0xecb1('0x43')]({},_0x249523,_0x1b2938['options']);var _0x3cf8db={'where':_0x249523[_0xecb1('0x41')]};return db[_0xecb1('0x46')]['count'](_0x3cf8db)['then'](function(_0x534ee4){_0x4a41f3['count']=_0x534ee4;if(_0x1b2938[_0xecb1('0x38')]['includeAll']){_0x249523[_0xecb1('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0xecb1('0x48')](_0x249523);})[_0xecb1('0x2a')](function(_0x131a91){_0x4a41f3[_0xecb1('0x49')]=_0x131a91;return _0x4a41f3;})['then'](respondWithFilteredResult(_0x209e46,_0x249523))[_0xecb1('0x4a')](handleError(_0x209e46,null));};exports[_0xecb1('0x4b')]=function(_0x13dd3e,_0x5ef9ae){var _0x17fa3b={'raw':![],'where':{'id':_0x13dd3e['params']['id']}},_0x449f4c={};_0x449f4c['model']=_['keys'](db[_0xecb1('0x46')][_0xecb1('0x34')]);_0x449f4c[_0xecb1('0x38')]=_[_0xecb1('0x4c')](_0x13dd3e[_0xecb1('0x38')]);_0x449f4c[_0xecb1('0x39')]=_[_0xecb1('0x3a')](_0x449f4c[_0xecb1('0x37')],_0x449f4c[_0xecb1('0x38')]);_0x17fa3b[_0xecb1('0x3b')]=_[_0xecb1('0x3a')](_0x449f4c[_0xecb1('0x37')],qs[_0xecb1('0x3c')](_0x13dd3e[_0xecb1('0x38')][_0xecb1('0x3c')]));_0x17fa3b['attributes']=_0x17fa3b[_0xecb1('0x3b')][_0xecb1('0x4d')]?_0x17fa3b['attributes']:_0x449f4c[_0xecb1('0x37')];if(_0x13dd3e[_0xecb1('0x38')][_0xecb1('0x4e')]){_0x17fa3b[_0xecb1('0x47')]=[{'all':!![]}];}_0x17fa3b=_[_0xecb1('0x43')]({},_0x17fa3b,_0x13dd3e['options']);return db[_0xecb1('0x46')][_0xecb1('0x4f')](_0x17fa3b)['then'](handleEntityNotFound(_0x5ef9ae,null))['then'](respondWithResult(_0x5ef9ae,null))[_0xecb1('0x4a')](handleError(_0x5ef9ae,null));};exports[_0xecb1('0x50')]=function(_0x18e902,_0x3f3ff7){return db[_0xecb1('0x46')][_0xecb1('0x50')](_0x18e902['body'],{})['then'](function(_0x1eb022){var _0x2a49bd=_0x18e902['user'][_0xecb1('0x2b')]({'plain':!![]});if(!_0x2a49bd)throw new Error(_0xecb1('0x51'));if(_0x2a49bd[_0xecb1('0x52')]===_0xecb1('0x53')){var _0x3a43c2=_0x1eb022[_0xecb1('0x2b')]({'plain':!![]});var _0x519c47=_0xecb1('0x2c');return db[_0xecb1('0x54')]['find']({'where':{'name':_0x519c47,'userProfileId':_0x2a49bd[_0xecb1('0x55')]},'raw':!![]})[_0xecb1('0x2a')](function(_0x26ca55){if(_0x26ca55&&_0x26ca55[_0xecb1('0x56')]===0x0){return db[_0xecb1('0x2d')]['create']({'name':_0x3a43c2[_0xecb1('0x30')],'resourceId':_0x3a43c2['id'],'type':_0x26ca55[_0xecb1('0x30')],'sectionId':_0x26ca55['id']},{})[_0xecb1('0x2a')](function(){return _0x1eb022;});}else{return _0x1eb022;}})['catch'](function(_0xeb96c3){logger[_0xecb1('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeb96c3);throw _0xeb96c3;});}return _0x1eb022;})[_0xecb1('0x2a')](respondWithResult(_0x3f3ff7,0xc9))['catch'](handleError(_0x3f3ff7,null));};exports['clone']=function(_0x1ba28e,_0x2bd484){var _0x1bc479={'where':{'id':_0x1ba28e[_0xecb1('0x57')]['id']}},_0x44fe49={};_0x44fe49[_0xecb1('0x37')]=_[_0xecb1('0x4c')](db[_0xecb1('0x46')][_0xecb1('0x34')]);_0x1bc479[_0xecb1('0x3b')]=_[_0xecb1('0x3a')](_0x44fe49[_0xecb1('0x37')],qs['fields'](_0x1ba28e[_0xecb1('0x38')][_0xecb1('0x3c')]));_0x1bc479['attributes']=_0x1bc479[_0xecb1('0x3b')][_0xecb1('0x4d')]?_0x1bc479[_0xecb1('0x3b')]:_0x44fe49[_0xecb1('0x37')];if(_0x1ba28e['query'][_0xecb1('0x4e')]){_0x1bc479[_0xecb1('0x47')]=[{'all':!![]}];}_0x1bc479=_[_0xecb1('0x43')]({},_0x1bc479,_0x1ba28e['options']);return db[_0xecb1('0x46')][_0xecb1('0x4f')](_0x1bc479)[_0xecb1('0x2a')](handleEntityNotFound(_0x2bd484,null))['then'](function(_0x38c9a7){if(_0x38c9a7){var _0x2b2bc7=_0x38c9a7[_0xecb1('0x2b')]({'plain':!![]});_0x2b2bc7=qs[_0xecb1('0x58')](_0x2b2bc7,['id',_0xecb1('0x59'),_0xecb1('0x5a')]);_0x1ba28e[_0xecb1('0x5b')]=_['omit'](_0x1ba28e[_0xecb1('0x5b')],['id','createdAt','updatedAt']);return db[_0xecb1('0x46')][_0xecb1('0x50')](_[_0xecb1('0x43')](_0x2b2bc7,_0x1ba28e[_0xecb1('0x5b')]),{'include':_0x1ba28e[_0xecb1('0x38')][_0xecb1('0x4e')]?[{'all':!![]}]:undefined})[_0xecb1('0x2a')](function(_0x571a58){var _0x362145=_0x1ba28e[_0xecb1('0x53')][_0xecb1('0x2b')]({'plain':!![]});if(!_0x362145)throw new Error(_0xecb1('0x51'));if(_0x362145['role']===_0xecb1('0x53')){var _0x108cc1=_0x571a58['get']({'plain':!![]});var _0x2ee05e='CustomDashboards';return db[_0xecb1('0x54')][_0xecb1('0x4f')]({'where':{'name':_0x2ee05e,'userProfileId':_0x362145[_0xecb1('0x55')]},'raw':!![]})['then'](function(_0x184a0a){if(_0x184a0a&&_0x184a0a[_0xecb1('0x56')]===0x0){return db[_0xecb1('0x2d')][_0xecb1('0x50')]({'name':_0x108cc1['name'],'resourceId':_0x108cc1['id'],'type':_0x184a0a[_0xecb1('0x30')],'sectionId':_0x184a0a['id']},{})[_0xecb1('0x2a')](function(){return _0x571a58;});}else{return _0x571a58;}})[_0xecb1('0x4a')](function(_0x4d51fb){logger[_0xecb1('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d51fb);throw _0x4d51fb;});}return _0x571a58;});}})['then'](respondWithResult(_0x2bd484,0xc9))[_0xecb1('0x4a')](handleError(_0x2bd484,null));};exports[_0xecb1('0x29')]=function(_0x127124,_0x2b7a9f){if(_0x127124['body']['id']){delete _0x127124['body']['id'];}return db[_0xecb1('0x46')]['find']({'where':{'id':_0x127124[_0xecb1('0x57')]['id']}})[_0xecb1('0x2a')](handleEntityNotFound(_0x2b7a9f,null))['then'](saveUpdates(_0x127124[_0xecb1('0x5b')],null))[_0xecb1('0x2a')](respondWithResult(_0x2b7a9f,null))[_0xecb1('0x4a')](handleError(_0x2b7a9f,null));};exports[_0xecb1('0x2e')]=function(_0x2b5627,_0x39b95d){return db['Dashboard']['find']({'where':{'id':_0x2b5627[_0xecb1('0x57')]['id']}})[_0xecb1('0x2a')](handleEntityNotFound(_0x39b95d,null))[_0xecb1('0x2a')](removeEntity(_0x39b95d,null))[_0xecb1('0x4a')](handleError(_0x39b95d,null));};function widgetAttributes(_0xf1ea74){try{switch(_0xf1ea74[_0xecb1('0x44')]){case'iframe':return[{'name':_0xecb1('0x5c'),'value':_0xf1ea74[_0xecb1('0x5c')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0]['value']:undefined)||_0xecb1('0x5e')}];case _0xecb1('0x5f'):return[{'name':_0xecb1('0x60'),'value':_0xf1ea74[_0xecb1('0x60')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0][_0xecb1('0x61')]:undefined)||''}];case'clock':return[{'name':_0xecb1('0x62'),'value':_0xf1ea74[_0xecb1('0x62')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0][_0xecb1('0x61')]:undefined)||_0xecb1('0x63')},{'name':'attrTimezone','value':_0xf1ea74[_0xecb1('0x64')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x1]?_0xf1ea74[_0xecb1('0x5d')][0x1][_0xecb1('0x61')]:undefined)||_0xecb1('0x65')},{'name':_0xecb1('0x66'),'value':_0xf1ea74[_0xecb1('0x66')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x2]?_0xf1ea74[_0xecb1('0x5d')][0x2][_0xecb1('0x61')]:undefined)||0xc}];case'counter':return[{'name':_0xecb1('0x67'),'value':_0xf1ea74[_0xecb1('0x67')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0][_0xecb1('0x61')]:undefined)||_0xecb1('0x68')},{'name':_0xecb1('0x69'),'value':_0xf1ea74[_0xecb1('0x69')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x1]?_0xf1ea74[_0xecb1('0x5d')][0x1][_0xecb1('0x61')]:undefined)||[]},{'name':_0xecb1('0x66'),'value':_0xf1ea74[_0xecb1('0x66')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x2]?_0xf1ea74[_0xecb1('0x5d')][0x2][_0xecb1('0x61')]:undefined)||0x14},{'name':_0xecb1('0x6a'),'value':_0xf1ea74[_0xecb1('0x6a')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x3]?_0xf1ea74[_0xecb1('0x5d')][0x3]['value']:undefined)||_0xecb1('0x6b')},{'name':_0xecb1('0x6c'),'value':_0xf1ea74['attrEmailAccounts']||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x4]?_0xf1ea74[_0xecb1('0x5d')][0x4][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6d'),'value':_0xf1ea74[_0xecb1('0x6d')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x5]?_0xf1ea74[_0xecb1('0x5d')][0x5][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6e'),'value':_0xf1ea74['attrSmsAccounts']||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x6]?_0xf1ea74[_0xecb1('0x5d')][0x6][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6f'),'value':_0xf1ea74[_0xecb1('0x6f')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x7]?_0xf1ea74['attrs'][0x7][_0xecb1('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xf1ea74[_0xecb1('0x70')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x8]?_0xf1ea74['attrs'][0x8][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x71'),'value':_0xf1ea74['attrChatWebsites']||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x9]?_0xf1ea74['attrs'][0x9][_0xecb1('0x61')]:undefined)||''}];case'multibar-chart':case _0xecb1('0x72'):return[{'name':'attrSerie1','value':_0xf1ea74[_0xecb1('0x73')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0]['value']:undefined)||_0xecb1('0x68')},{'name':_0xecb1('0x74'),'value':_0xf1ea74[_0xecb1('0x74')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x1]?_0xf1ea74['attrs'][0x1][_0xecb1('0x61')]:undefined)||null},{'name':_0xecb1('0x75'),'value':_0xf1ea74[_0xecb1('0x75')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x2]?_0xf1ea74[_0xecb1('0x5d')][0x2]['value']:undefined)||null},{'name':_0xecb1('0x69'),'value':_0xf1ea74[_0xecb1('0x69')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x3]?_0xf1ea74['attrs'][0x3][_0xecb1('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0xf1ea74[_0xecb1('0x6a')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x4]?_0xf1ea74['attrs'][0x4][_0xecb1('0x61')]:undefined)||_0xecb1('0x6b')},{'name':'attrEmailAccounts','value':_0xf1ea74[_0xecb1('0x6c')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x5]?_0xf1ea74['attrs'][0x5][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6d'),'value':_0xf1ea74[_0xecb1('0x6d')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x6]?_0xf1ea74['attrs'][0x6][_0xecb1('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xf1ea74[_0xecb1('0x6e')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x7]?_0xf1ea74[_0xecb1('0x5d')][0x7][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6f'),'value':_0xf1ea74[_0xecb1('0x6f')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x8]?_0xf1ea74[_0xecb1('0x5d')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xf1ea74[_0xecb1('0x70')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x9]?_0xf1ea74['attrs'][0x9][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x71'),'value':_0xf1ea74[_0xecb1('0x71')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0xa]?_0xf1ea74['attrs'][0xa]['value']:undefined)||''}];case _0xecb1('0x76'):return[{'name':_0xecb1('0x77'),'type':_0xf1ea74['reportType']||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74['attrs'][0x0][_0xecb1('0x44')]:undefined)||null,'value':_0xf1ea74['attrReport']||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74['attrs'][0x0][_0xecb1('0x61')]:undefined)||null},{'name':_0xecb1('0x78'),'value':_0xf1ea74[_0xecb1('0x78')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x1]?_0xf1ea74['attrs'][0x1][_0xecb1('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4f1d63){logger[_0xecb1('0x2f')]('widgetAttributes:\x20%s',JSON['stringify'](_0x4f1d63));return[];}}exports['addItem']=function(_0xceba65,_0x5cf960,_0x480a1e){if(_0xceba65['body']['id']){delete _0xceba65[_0xecb1('0x5b')]['id'];}return db[_0xecb1('0x46')][_0xecb1('0x4f')]({'where':{'id':_0xceba65[_0xecb1('0x57')]['id']}})[_0xecb1('0x2a')](handleEntityNotFound(_0x5cf960,null))[_0xecb1('0x2a')](function(_0x5a1015){if(_0x5a1015){_0xceba65[_0xecb1('0x5b')][_0xecb1('0x79')]=_0x5a1015['id'];_0xceba65[_0xecb1('0x5b')][_0xecb1('0x5d')]=widgetAttributes(_0xceba65['body']);return db['DashboardItem']['create'](_0xceba65[_0xecb1('0x5b')]);}})[_0xecb1('0x2a')](respondWithResult(_0x5cf960,null))[_0xecb1('0x4a')](handleError(_0x5cf960,null));};exports['getItems']=function(_0x1444b4,_0x196a28,_0x323600){var _0x5e4144={};var _0x38ec17={};var _0x333cb2;var _0x21d3de;return db['Dashboard']['findOne']({'where':{'id':_0x1444b4['params']['id']}})['then'](handleEntityNotFound(_0x196a28,null))['then'](function(_0x19f6f9){if(_0x19f6f9){_0x333cb2=_0x19f6f9;_0x38ec17[_0xecb1('0x37')]=_[_0xecb1('0x4c')](db[_0xecb1('0x7a')][_0xecb1('0x34')]);_0x38ec17[_0xecb1('0x38')]=_[_0xecb1('0x4c')](_0x1444b4[_0xecb1('0x38')]);_0x38ec17[_0xecb1('0x39')]=_['intersection'](_0x38ec17[_0xecb1('0x37')],_0x38ec17[_0xecb1('0x38')]);_0x5e4144[_0xecb1('0x3b')]=_[_0xecb1('0x3a')](_0x38ec17['model'],qs[_0xecb1('0x3c')](_0x1444b4[_0xecb1('0x38')]['fields']));_0x5e4144[_0xecb1('0x3b')]=_0x5e4144['attributes'][_0xecb1('0x4d')]?_0x5e4144[_0xecb1('0x3b')]:_0x38ec17[_0xecb1('0x37')];_0x5e4144[_0xecb1('0x3f')]=qs[_0xecb1('0x40')](_0x1444b4[_0xecb1('0x38')][_0xecb1('0x40')]);_0x5e4144[_0xecb1('0x41')]=qs[_0xecb1('0x39')](_[_0xecb1('0x42')](_0x1444b4['query'],_0x38ec17[_0xecb1('0x39')]));if(_0x1444b4['query'][_0xecb1('0x45')]){_0x5e4144[_0xecb1('0x41')]=_[_0xecb1('0x43')](_0x5e4144[_0xecb1('0x41')],{'$or':_[_0xecb1('0x33')](_0x5e4144['attributes'],function(_0x4f888d){var _0x3e7a6f={};_0x3e7a6f[_0x4f888d]={'$like':'%'+_0x1444b4[_0xecb1('0x38')][_0xecb1('0x45')]+'%'};return _0x3e7a6f;})});}_0x5e4144=_[_0xecb1('0x43')]({},_0x5e4144,_0x1444b4[_0xecb1('0x7b')]);return _0x333cb2[_0xecb1('0x7c')](_0x5e4144);}})[_0xecb1('0x2a')](function(_0x339362){if(_0x339362){_0x21d3de=_0x339362[_0xecb1('0x4d')];if(!_0x1444b4[_0xecb1('0x38')][_0xecb1('0x3d')]('nolimit')){_0x5e4144[_0xecb1('0x24')]=qs[_0xecb1('0x24')](_0x1444b4[_0xecb1('0x38')][_0xecb1('0x24')]);_0x5e4144[_0xecb1('0x21')]=qs[_0xecb1('0x21')](_0x1444b4['query'][_0xecb1('0x21')]);}return _0x333cb2['getItems'](_0x5e4144);}})[_0xecb1('0x2a')](function(_0x3cbc0d){if(_0x3cbc0d){return _0x3cbc0d?{'count':_0x21d3de,'rows':_0x3cbc0d}:null;}})[_0xecb1('0x2a')](respondWithResult(_0x196a28,null))[_0xecb1('0x4a')](handleError(_0x196a28,null));}; \ No newline at end of file +var _0xcf72=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','status','undefined','limit','count','offset','Content-Range','json','apply','reject','then','destroy','CustomDashboards','end','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardItem','getItems','findOne','eml-format','rimraf','request-promise'];(function(_0x5c860f,_0x4b0de7){var _0xdc8aea=function(_0x119c6c){while(--_0x119c6c){_0x5c860f['push'](_0x5c860f['shift']());}};_0xdc8aea(++_0x4b0de7);}(_0xcf72,0x7f));var _0x2cf7=function(_0x5b3f4a,_0x3c7edc){_0x5b3f4a=_0x5b3f4a-0x0;var _0x8bd566=_0xcf72[_0x5b3f4a];return _0x8bd566;};'use strict';var emlformat=require(_0x2cf7('0x0'));var rimraf=require(_0x2cf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2cf7('0x2'));var moment=require(_0x2cf7('0x3'));var BPromise=require(_0x2cf7('0x4'));var Mustache=require(_0x2cf7('0x5'));var util=require(_0x2cf7('0x6'));var path=require('path');var sox=require(_0x2cf7('0x7'));var csv=require(_0x2cf7('0x8'));var ejs=require(_0x2cf7('0x9'));var fs=require('fs');var fs_extra=require(_0x2cf7('0xa'));var _=require(_0x2cf7('0xb'));var squel=require(_0x2cf7('0xc'));var crypto=require(_0x2cf7('0xd'));var jsforce=require(_0x2cf7('0xe'));var deskjs=require(_0x2cf7('0xf'));var toCsv=require(_0x2cf7('0x8'));var querystring=require('querystring');var Papa=require(_0x2cf7('0x10'));var Redis=require('ioredis');var authService=require(_0x2cf7('0x11'));var qs=require(_0x2cf7('0x12'));var as=require(_0x2cf7('0x13'));var hardwareService=require(_0x2cf7('0x14'));var logger=require('../../config/logger')(_0x2cf7('0x15'));var utils=require(_0x2cf7('0x16'));var config=require(_0x2cf7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2cf7('0x18')]=_['defaults'](config[_0x2cf7('0x18')],{'host':_0x2cf7('0x19'),'port':0x18eb});var socket=require(_0x2cf7('0x1a'))(new Redis(config[_0x2cf7('0x18')]));require('./dashboard.socket')[_0x2cf7('0x1b')](socket);function respondWithStatusCode(_0x44d0fc,_0x84265f){_0x84265f=_0x84265f||0xcc;return function(_0x597cca){if(_0x597cca){return _0x44d0fc['sendStatus'](_0x84265f);}return _0x44d0fc[_0x2cf7('0x1c')](_0x84265f)['end']();};}function respondWithResult(_0x468057,_0x151b41){_0x151b41=_0x151b41||0xc8;return function(_0x44c8f1){if(_0x44c8f1){return _0x468057['status'](_0x151b41)['json'](_0x44c8f1);}};}function respondWithFilteredResult(_0x376545,_0x5d5006){return function(_0x5e6d6a){if(_0x5e6d6a){var _0x5b670f=typeof _0x5d5006['offset']===_0x2cf7('0x1d')&&typeof _0x5d5006[_0x2cf7('0x1e')]===_0x2cf7('0x1d');var _0x328e90=_0x5e6d6a[_0x2cf7('0x1f')];var _0x4ba098=_0x5b670f?0x0:_0x5d5006[_0x2cf7('0x20')];var _0x1c9ccc=_0x5b670f?_0x5e6d6a[_0x2cf7('0x1f')]:_0x5d5006[_0x2cf7('0x20')]+_0x5d5006[_0x2cf7('0x1e')];var _0x24fcd1;if(_0x1c9ccc>=_0x328e90){_0x1c9ccc=_0x328e90;_0x24fcd1=0xc8;}else{_0x24fcd1=0xce;}_0x376545['status'](_0x24fcd1);return _0x376545['set'](_0x2cf7('0x21'),_0x4ba098+'-'+_0x1c9ccc+'/'+_0x328e90)[_0x2cf7('0x22')](_0x5e6d6a);}return null;};}function patchUpdates(_0x4174b2){return function(_0x5e864d){try{jsonpatch[_0x2cf7('0x23')](_0x5e864d,_0x4174b2,!![]);}catch(_0x3b2e4d){return BPromise[_0x2cf7('0x24')](_0x3b2e4d);}return _0x5e864d['save']();};}function saveUpdates(_0x17c86a,_0x2f5cdd){return function(_0x52b658){if(_0x52b658){return _0x52b658['update'](_0x17c86a)[_0x2cf7('0x25')](function(_0xd9c377){return _0xd9c377;});}return null;};}function removeEntity(_0xf623fd,_0x1cb2b6){return function(_0x17f7f6){if(_0x17f7f6){return _0x17f7f6[_0x2cf7('0x26')]()['then'](function(){var _0x2eaae0=_0x17f7f6['get']({'plain':!![]});var _0x4c8803=_0x2cf7('0x27');return db['UserProfileResource'][_0x2cf7('0x26')]({'where':{'type':_0x4c8803,'resourceId':_0x2eaae0['id']}})[_0x2cf7('0x25')](function(){return _0x17f7f6;});})[_0x2cf7('0x25')](function(){_0xf623fd[_0x2cf7('0x1c')](0xcc)[_0x2cf7('0x28')]();});}};}function handleEntityNotFound(_0x38f207,_0x26b678){return function(_0x228384){if(!_0x228384){_0x38f207[_0x2cf7('0x29')](0x194);}return _0x228384;};}function handleError(_0x24e264,_0xe61c51){_0xe61c51=_0xe61c51||0x1f4;return function(_0x4ea9e0){logger[_0x2cf7('0x2a')](_0x4ea9e0[_0x2cf7('0x2b')]);if(_0x4ea9e0[_0x2cf7('0x2c')]){delete _0x4ea9e0[_0x2cf7('0x2c')];}_0x24e264[_0x2cf7('0x1c')](_0xe61c51)[_0x2cf7('0x2d')](_0x4ea9e0);};}exports[_0x2cf7('0x2e')]=function(_0x29ab90,_0x555e20){var _0x5432f={},_0x59ee7c={},_0x3403b6={'count':0x0,'rows':[]};var _0x1b65c1=_[_0x2cf7('0x2f')](db[_0x2cf7('0x30')][_0x2cf7('0x31')],function(_0x3e7546){return{'name':_0x3e7546[_0x2cf7('0x32')],'type':_0x3e7546[_0x2cf7('0x33')][_0x2cf7('0x34')]};});_0x59ee7c[_0x2cf7('0x35')]=_['map'](_0x1b65c1,_0x2cf7('0x2c'));_0x59ee7c[_0x2cf7('0x36')]=_[_0x2cf7('0x37')](_0x29ab90[_0x2cf7('0x36')]);_0x59ee7c[_0x2cf7('0x38')]=_[_0x2cf7('0x39')](_0x59ee7c[_0x2cf7('0x35')],_0x59ee7c[_0x2cf7('0x36')]);_0x5432f[_0x2cf7('0x3a')]=_['intersection'](_0x59ee7c[_0x2cf7('0x35')],qs[_0x2cf7('0x3b')](_0x29ab90[_0x2cf7('0x36')]['fields']));_0x5432f['attributes']=_0x5432f[_0x2cf7('0x3a')][_0x2cf7('0x3c')]?_0x5432f[_0x2cf7('0x3a')]:_0x59ee7c[_0x2cf7('0x35')];if(!_0x29ab90[_0x2cf7('0x36')][_0x2cf7('0x3d')](_0x2cf7('0x3e'))){_0x5432f[_0x2cf7('0x1e')]=qs[_0x2cf7('0x1e')](_0x29ab90['query'][_0x2cf7('0x1e')]);_0x5432f[_0x2cf7('0x20')]=qs[_0x2cf7('0x20')](_0x29ab90[_0x2cf7('0x36')][_0x2cf7('0x20')]);}_0x5432f[_0x2cf7('0x3f')]=qs[_0x2cf7('0x40')](_0x29ab90[_0x2cf7('0x36')]['sort']);_0x5432f[_0x2cf7('0x41')]=qs['filters'](_[_0x2cf7('0x42')](_0x29ab90[_0x2cf7('0x36')],_0x59ee7c[_0x2cf7('0x38')]),_0x1b65c1);if(_0x29ab90[_0x2cf7('0x36')][_0x2cf7('0x43')]){_0x5432f[_0x2cf7('0x41')]=_[_0x2cf7('0x44')](_0x5432f[_0x2cf7('0x41')],{'$or':_[_0x2cf7('0x2f')](_0x1b65c1,function(_0x16e83e){if(_0x16e83e[_0x2cf7('0x33')]!=='VIRTUAL'){var _0xb6cdbb={};_0xb6cdbb[_0x16e83e[_0x2cf7('0x2c')]]={'$like':'%'+_0x29ab90[_0x2cf7('0x36')][_0x2cf7('0x43')]+'%'};return _0xb6cdbb;}})});}_0x5432f=_[_0x2cf7('0x44')]({},_0x5432f,_0x29ab90['options']);var _0x1465e1={'where':_0x5432f['where']};return db[_0x2cf7('0x30')]['count'](_0x1465e1)['then'](function(_0x1436b2){_0x3403b6[_0x2cf7('0x1f')]=_0x1436b2;if(_0x29ab90['query'][_0x2cf7('0x45')]){_0x5432f['include']=[{'all':!![]}];}return db['Dashboard'][_0x2cf7('0x46')](_0x5432f);})[_0x2cf7('0x25')](function(_0x1247ca){_0x3403b6[_0x2cf7('0x47')]=_0x1247ca;return _0x3403b6;})[_0x2cf7('0x25')](respondWithFilteredResult(_0x555e20,_0x5432f))[_0x2cf7('0x48')](handleError(_0x555e20,null));};exports[_0x2cf7('0x49')]=function(_0x40591f,_0x2bf0b3){var _0xc7d0fd={'raw':![],'where':{'id':_0x40591f['params']['id']}},_0x3cb1e5={};_0x3cb1e5[_0x2cf7('0x35')]=_[_0x2cf7('0x37')](db[_0x2cf7('0x30')][_0x2cf7('0x31')]);_0x3cb1e5[_0x2cf7('0x36')]=_['keys'](_0x40591f['query']);_0x3cb1e5[_0x2cf7('0x38')]=_[_0x2cf7('0x39')](_0x3cb1e5[_0x2cf7('0x35')],_0x3cb1e5['query']);_0xc7d0fd[_0x2cf7('0x3a')]=_[_0x2cf7('0x39')](_0x3cb1e5[_0x2cf7('0x35')],qs['fields'](_0x40591f[_0x2cf7('0x36')][_0x2cf7('0x3b')]));_0xc7d0fd[_0x2cf7('0x3a')]=_0xc7d0fd[_0x2cf7('0x3a')]['length']?_0xc7d0fd[_0x2cf7('0x3a')]:_0x3cb1e5[_0x2cf7('0x35')];if(_0x40591f[_0x2cf7('0x36')][_0x2cf7('0x45')]){_0xc7d0fd[_0x2cf7('0x4a')]=[{'all':!![]}];}_0xc7d0fd=_[_0x2cf7('0x44')]({},_0xc7d0fd,_0x40591f[_0x2cf7('0x4b')]);return db[_0x2cf7('0x30')][_0x2cf7('0x4c')](_0xc7d0fd)[_0x2cf7('0x25')](handleEntityNotFound(_0x2bf0b3,null))['then'](respondWithResult(_0x2bf0b3,null))[_0x2cf7('0x48')](handleError(_0x2bf0b3,null));};exports[_0x2cf7('0x4d')]=function(_0xb735bc,_0x35a1d9){return db[_0x2cf7('0x30')][_0x2cf7('0x4d')](_0xb735bc[_0x2cf7('0x4e')],{})['then'](function(_0x2b5d45){var _0x1c31c5=_0xb735bc[_0x2cf7('0x4f')][_0x2cf7('0x50')]({'plain':!![]});if(!_0x1c31c5)throw new Error(_0x2cf7('0x51'));if(_0x1c31c5[_0x2cf7('0x52')]===_0x2cf7('0x4f')){var _0x2051df=_0x2b5d45[_0x2cf7('0x50')]({'plain':!![]});var _0x38fa64=_0x2cf7('0x27');return db[_0x2cf7('0x53')]['find']({'where':{'name':_0x38fa64,'userProfileId':_0x1c31c5[_0x2cf7('0x54')]},'raw':!![]})[_0x2cf7('0x25')](function(_0x6c623f){if(_0x6c623f&&_0x6c623f[_0x2cf7('0x55')]===0x0){return db[_0x2cf7('0x56')][_0x2cf7('0x4d')]({'name':_0x2051df[_0x2cf7('0x2c')],'resourceId':_0x2051df['id'],'type':_0x6c623f[_0x2cf7('0x2c')],'sectionId':_0x6c623f['id']},{})[_0x2cf7('0x25')](function(){return _0x2b5d45;});}else{return _0x2b5d45;}})[_0x2cf7('0x48')](function(_0x254b45){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x254b45);throw _0x254b45;});}return _0x2b5d45;})[_0x2cf7('0x25')](respondWithResult(_0x35a1d9,0xc9))['catch'](handleError(_0x35a1d9,null));};exports[_0x2cf7('0x57')]=function(_0x3bbd02,_0x27d6e7){var _0x4d8b22={'where':{'id':_0x3bbd02[_0x2cf7('0x58')]['id']}},_0x393bc2={};_0x393bc2[_0x2cf7('0x35')]=_[_0x2cf7('0x37')](db[_0x2cf7('0x30')]['rawAttributes']);_0x4d8b22[_0x2cf7('0x3a')]=_['intersection'](_0x393bc2[_0x2cf7('0x35')],qs['fields'](_0x3bbd02[_0x2cf7('0x36')]['fields']));_0x4d8b22[_0x2cf7('0x3a')]=_0x4d8b22[_0x2cf7('0x3a')]['length']?_0x4d8b22[_0x2cf7('0x3a')]:_0x393bc2[_0x2cf7('0x35')];if(_0x3bbd02[_0x2cf7('0x36')][_0x2cf7('0x45')]){_0x4d8b22[_0x2cf7('0x4a')]=[{'all':!![]}];}_0x4d8b22=_[_0x2cf7('0x44')]({},_0x4d8b22,_0x3bbd02['options']);return db[_0x2cf7('0x30')][_0x2cf7('0x4c')](_0x4d8b22)[_0x2cf7('0x25')](handleEntityNotFound(_0x27d6e7,null))[_0x2cf7('0x25')](function(_0x1a8ae6){if(_0x1a8ae6){var _0x41135f=_0x1a8ae6[_0x2cf7('0x50')]({'plain':!![]});_0x41135f=qs[_0x2cf7('0x59')](_0x41135f,['id',_0x2cf7('0x5a'),_0x2cf7('0x5b')]);_0x3bbd02['body']=_[_0x2cf7('0x59')](_0x3bbd02[_0x2cf7('0x4e')],['id',_0x2cf7('0x5a'),_0x2cf7('0x5b')]);return db['Dashboard'][_0x2cf7('0x4d')](_['merge'](_0x41135f,_0x3bbd02[_0x2cf7('0x4e')]),{'include':_0x3bbd02['query'][_0x2cf7('0x45')]?[{'all':!![]}]:undefined})[_0x2cf7('0x25')](function(_0x46d0cb){var _0x3a2dd2=_0x3bbd02[_0x2cf7('0x4f')]['get']({'plain':!![]});if(!_0x3a2dd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a2dd2[_0x2cf7('0x52')]===_0x2cf7('0x4f')){var _0x210824=_0x46d0cb[_0x2cf7('0x50')]({'plain':!![]});var _0x438dc1=_0x2cf7('0x27');return db[_0x2cf7('0x53')][_0x2cf7('0x4c')]({'where':{'name':_0x438dc1,'userProfileId':_0x3a2dd2[_0x2cf7('0x54')]},'raw':!![]})[_0x2cf7('0x25')](function(_0x512a6e){if(_0x512a6e&&_0x512a6e['autoAssociation']===0x0){return db[_0x2cf7('0x56')][_0x2cf7('0x4d')]({'name':_0x210824['name'],'resourceId':_0x210824['id'],'type':_0x512a6e['name'],'sectionId':_0x512a6e['id']},{})[_0x2cf7('0x25')](function(){return _0x46d0cb;});}else{return _0x46d0cb;}})[_0x2cf7('0x48')](function(_0x2b5aa4){logger['error'](_0x2cf7('0x5c'),_0x2b5aa4);throw _0x2b5aa4;});}return _0x46d0cb;});}})[_0x2cf7('0x25')](respondWithResult(_0x27d6e7,0xc9))[_0x2cf7('0x48')](handleError(_0x27d6e7,null));};exports[_0x2cf7('0x5d')]=function(_0x1c35d3,_0x820ecd){if(_0x1c35d3[_0x2cf7('0x4e')]['id']){delete _0x1c35d3[_0x2cf7('0x4e')]['id'];}return db[_0x2cf7('0x30')][_0x2cf7('0x4c')]({'where':{'id':_0x1c35d3[_0x2cf7('0x58')]['id']}})[_0x2cf7('0x25')](handleEntityNotFound(_0x820ecd,null))[_0x2cf7('0x25')](saveUpdates(_0x1c35d3[_0x2cf7('0x4e')],null))[_0x2cf7('0x25')](respondWithResult(_0x820ecd,null))[_0x2cf7('0x48')](handleError(_0x820ecd,null));};exports[_0x2cf7('0x26')]=function(_0x13da59,_0x5be993){return db[_0x2cf7('0x30')]['find']({'where':{'id':_0x13da59['params']['id']}})[_0x2cf7('0x25')](handleEntityNotFound(_0x5be993,null))[_0x2cf7('0x25')](removeEntity(_0x5be993,null))[_0x2cf7('0x48')](handleError(_0x5be993,null));};function widgetAttributes(_0xaa858a){try{switch(_0xaa858a[_0x2cf7('0x33')]){case _0x2cf7('0x5e'):return[{'name':'attrUrl','value':_0xaa858a[_0x2cf7('0x5f')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x0]?_0xaa858a[_0x2cf7('0x60')][0x0]['value']:undefined)||'https://'}];case _0x2cf7('0x61'):return[{'name':_0x2cf7('0x62'),'value':_0xaa858a['attrPath']||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x0]?_0xaa858a['attrs'][0x0][_0x2cf7('0x63')]:undefined)||''}];case _0x2cf7('0x64'):return[{'name':_0x2cf7('0x65'),'value':_0xaa858a['attrHourFormat']||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x0]?_0xaa858a[_0x2cf7('0x60')][0x0][_0x2cf7('0x63')]:undefined)||_0x2cf7('0x66')},{'name':_0x2cf7('0x67'),'value':_0xaa858a['attrTimezone']||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x1]?_0xaa858a['attrs'][0x1][_0x2cf7('0x63')]:undefined)||_0x2cf7('0x68')},{'name':_0x2cf7('0x69'),'value':_0xaa858a[_0x2cf7('0x69')]||(_0xaa858a['attrs']&&_0xaa858a[_0x2cf7('0x60')][0x2]?_0xaa858a[_0x2cf7('0x60')][0x2][_0x2cf7('0x63')]:undefined)||0xc}];case _0x2cf7('0x6a'):return[{'name':_0x2cf7('0x6b'),'value':_0xaa858a[_0x2cf7('0x6b')]||(_0xaa858a['attrs']&&_0xaa858a[_0x2cf7('0x60')][0x0]?_0xaa858a[_0x2cf7('0x60')][0x0][_0x2cf7('0x63')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0xaa858a[_0x2cf7('0x6c')]||(_0xaa858a['attrs']&&_0xaa858a[_0x2cf7('0x60')][0x1]?_0xaa858a[_0x2cf7('0x60')][0x1][_0x2cf7('0x63')]:undefined)||[]},{'name':_0x2cf7('0x69'),'value':_0xaa858a['attrFontSize']||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x2]?_0xaa858a['attrs'][0x2][_0x2cf7('0x63')]:undefined)||0x14},{'name':_0x2cf7('0x6d'),'value':_0xaa858a[_0x2cf7('0x6d')]||(_0xaa858a['attrs']&&_0xaa858a[_0x2cf7('0x60')][0x3]?_0xaa858a[_0x2cf7('0x60')][0x3][_0x2cf7('0x63')]:undefined)||_0x2cf7('0x6e')},{'name':_0x2cf7('0x6f'),'value':_0xaa858a[_0x2cf7('0x6f')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x4]?_0xaa858a[_0x2cf7('0x60')][0x4][_0x2cf7('0x63')]:undefined)||''},{'name':_0x2cf7('0x70'),'value':_0xaa858a[_0x2cf7('0x70')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x5]?_0xaa858a[_0x2cf7('0x60')][0x5][_0x2cf7('0x63')]:undefined)||''},{'name':_0x2cf7('0x71'),'value':_0xaa858a[_0x2cf7('0x71')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x6]?_0xaa858a['attrs'][0x6][_0x2cf7('0x63')]:undefined)||''},{'name':_0x2cf7('0x72'),'value':_0xaa858a[_0x2cf7('0x72')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x7]?_0xaa858a['attrs'][0x7][_0x2cf7('0x63')]:undefined)||''},{'name':_0x2cf7('0x73'),'value':_0xaa858a[_0x2cf7('0x73')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x8]?_0xaa858a[_0x2cf7('0x60')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xaa858a[_0x2cf7('0x74')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x9]?_0xaa858a[_0x2cf7('0x60')][0x9][_0x2cf7('0x63')]:undefined)||''}];case _0x2cf7('0x75'):case'pie-chart':return[{'name':_0x2cf7('0x76'),'value':_0xaa858a['attrSerie1']||(_0xaa858a['attrs']&&_0xaa858a[_0x2cf7('0x60')][0x0]?_0xaa858a[_0x2cf7('0x60')][0x0][_0x2cf7('0x63')]:undefined)||_0x2cf7('0x77')},{'name':'attrSerie2','value':_0xaa858a[_0x2cf7('0x78')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x1]?_0xaa858a[_0x2cf7('0x60')][0x1][_0x2cf7('0x63')]:undefined)||null},{'name':_0x2cf7('0x79'),'value':_0xaa858a[_0x2cf7('0x79')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x2]?_0xaa858a[_0x2cf7('0x60')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0xaa858a[_0x2cf7('0x6c')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x3]?_0xaa858a[_0x2cf7('0x60')][0x3][_0x2cf7('0x63')]:undefined)||[]},{'name':'attrChannel','value':_0xaa858a['attrChannel']||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x4]?_0xaa858a[_0x2cf7('0x60')][0x4][_0x2cf7('0x63')]:undefined)||'voice'},{'name':_0x2cf7('0x6f'),'value':_0xaa858a[_0x2cf7('0x6f')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x5]?_0xaa858a['attrs'][0x5]['value']:undefined)||''},{'name':_0x2cf7('0x70'),'value':_0xaa858a[_0x2cf7('0x70')]||(_0xaa858a['attrs']&&_0xaa858a['attrs'][0x6]?_0xaa858a[_0x2cf7('0x60')][0x6][_0x2cf7('0x63')]:undefined)||''},{'name':_0x2cf7('0x71'),'value':_0xaa858a[_0x2cf7('0x71')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a['attrs'][0x7]?_0xaa858a['attrs'][0x7][_0x2cf7('0x63')]:undefined)||''},{'name':_0x2cf7('0x72'),'value':_0xaa858a[_0x2cf7('0x72')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x8]?_0xaa858a[_0x2cf7('0x60')][0x8][_0x2cf7('0x63')]:undefined)||''},{'name':_0x2cf7('0x73'),'value':_0xaa858a['attrWhatsappAccounts']||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x9]?_0xaa858a['attrs'][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xaa858a[_0x2cf7('0x74')]||(_0xaa858a['attrs']&&_0xaa858a[_0x2cf7('0x60')][0xa]?_0xaa858a[_0x2cf7('0x60')][0xa][_0x2cf7('0x63')]:undefined)||''}];case _0x2cf7('0x7a'):return[{'name':_0x2cf7('0x7b'),'type':_0xaa858a['reportType']||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x0]?_0xaa858a['attrs'][0x0]['type']:undefined)||null,'value':_0xaa858a[_0x2cf7('0x7b')]||(_0xaa858a['attrs']&&_0xaa858a[_0x2cf7('0x60')][0x0]?_0xaa858a['attrs'][0x0]['value']:undefined)||null},{'name':_0x2cf7('0x7c'),'value':_0xaa858a[_0x2cf7('0x7c')]||(_0xaa858a[_0x2cf7('0x60')]&&_0xaa858a[_0x2cf7('0x60')][0x1]?_0xaa858a[_0x2cf7('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4e996f){logger['error']('widgetAttributes:\x20%s',JSON[_0x2cf7('0x7d')](_0x4e996f));return[];}}exports[_0x2cf7('0x7e')]=function(_0x2d0553,_0x30fed1,_0xd7a50b){if(_0x2d0553[_0x2cf7('0x4e')]['id']){delete _0x2d0553[_0x2cf7('0x4e')]['id'];}return db[_0x2cf7('0x30')][_0x2cf7('0x4c')]({'where':{'id':_0x2d0553[_0x2cf7('0x58')]['id']}})['then'](handleEntityNotFound(_0x30fed1,null))['then'](function(_0x21ab0a){if(_0x21ab0a){_0x2d0553[_0x2cf7('0x4e')]['DashboardId']=_0x21ab0a['id'];_0x2d0553[_0x2cf7('0x4e')]['attrs']=widgetAttributes(_0x2d0553['body']);return db[_0x2cf7('0x7f')]['create'](_0x2d0553[_0x2cf7('0x4e')]);}})['then'](respondWithResult(_0x30fed1,null))[_0x2cf7('0x48')](handleError(_0x30fed1,null));};exports[_0x2cf7('0x80')]=function(_0x3074b9,_0x358bb2,_0x35bf91){var _0x84be3e={};var _0x5b8423={};var _0x2070a8;var _0x495b0e;return db[_0x2cf7('0x30')][_0x2cf7('0x81')]({'where':{'id':_0x3074b9[_0x2cf7('0x58')]['id']}})[_0x2cf7('0x25')](handleEntityNotFound(_0x358bb2,null))[_0x2cf7('0x25')](function(_0x3e5753){if(_0x3e5753){_0x2070a8=_0x3e5753;_0x5b8423[_0x2cf7('0x35')]=_[_0x2cf7('0x37')](db[_0x2cf7('0x7f')][_0x2cf7('0x31')]);_0x5b8423[_0x2cf7('0x36')]=_[_0x2cf7('0x37')](_0x3074b9[_0x2cf7('0x36')]);_0x5b8423[_0x2cf7('0x38')]=_[_0x2cf7('0x39')](_0x5b8423[_0x2cf7('0x35')],_0x5b8423['query']);_0x84be3e['attributes']=_[_0x2cf7('0x39')](_0x5b8423[_0x2cf7('0x35')],qs[_0x2cf7('0x3b')](_0x3074b9['query'][_0x2cf7('0x3b')]));_0x84be3e[_0x2cf7('0x3a')]=_0x84be3e[_0x2cf7('0x3a')][_0x2cf7('0x3c')]?_0x84be3e[_0x2cf7('0x3a')]:_0x5b8423[_0x2cf7('0x35')];_0x84be3e[_0x2cf7('0x3f')]=qs[_0x2cf7('0x40')](_0x3074b9[_0x2cf7('0x36')][_0x2cf7('0x40')]);_0x84be3e[_0x2cf7('0x41')]=qs[_0x2cf7('0x38')](_[_0x2cf7('0x42')](_0x3074b9['query'],_0x5b8423[_0x2cf7('0x38')]));if(_0x3074b9[_0x2cf7('0x36')]['filter']){_0x84be3e[_0x2cf7('0x41')]=_[_0x2cf7('0x44')](_0x84be3e[_0x2cf7('0x41')],{'$or':_[_0x2cf7('0x2f')](_0x84be3e[_0x2cf7('0x3a')],function(_0x6addb3){var _0x56bb83={};_0x56bb83[_0x6addb3]={'$like':'%'+_0x3074b9[_0x2cf7('0x36')][_0x2cf7('0x43')]+'%'};return _0x56bb83;})});}_0x84be3e=_[_0x2cf7('0x44')]({},_0x84be3e,_0x3074b9[_0x2cf7('0x4b')]);return _0x2070a8[_0x2cf7('0x80')](_0x84be3e);}})[_0x2cf7('0x25')](function(_0xb02414){if(_0xb02414){_0x495b0e=_0xb02414[_0x2cf7('0x3c')];if(!_0x3074b9[_0x2cf7('0x36')][_0x2cf7('0x3d')](_0x2cf7('0x3e'))){_0x84be3e[_0x2cf7('0x1e')]=qs['limit'](_0x3074b9[_0x2cf7('0x36')]['limit']);_0x84be3e[_0x2cf7('0x20')]=qs['offset'](_0x3074b9[_0x2cf7('0x36')][_0x2cf7('0x20')]);}return _0x2070a8[_0x2cf7('0x80')](_0x84be3e);}})[_0x2cf7('0x25')](function(_0x1e7131){if(_0x1e7131){return _0x1e7131?{'count':_0x495b0e,'rows':_0x1e7131}:null;}})['then'](respondWithResult(_0x358bb2,null))[_0x2cf7('0x48')](handleError(_0x358bb2,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a909c82..d059fe4 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 _0x92ca=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1c1172,_0x27c3c4){var _0x300943=function(_0x3f8b89){while(--_0x3f8b89){_0x1c1172['push'](_0x1c1172['shift']());}};_0x300943(++_0x27c3c4);}(_0x92ca,0x16c));var _0xa92c=function(_0x4eda15,_0x28fa8c){_0x4eda15=_0x4eda15-0x0;var _0x292fe7=_0x92ca[_0x4eda15];return _0x292fe7;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xa92c('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa92c('0x1')](0x0);var events={'afterCreate':_0xa92c('0x2'),'afterUpdate':_0xa92c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51be50){return function(_0x47a452,_0x1fa08a,_0x21260c){DashboardEvents['emit'](_0x51be50+':'+_0x47a452['id'],_0x47a452);DashboardEvents[_0xa92c('0x4')](_0x51be50,_0x47a452);_0x21260c(null);};}for(var e in events){if(events[_0xa92c('0x5')](e)){var event=events[e];Dashboard[_0xa92c('0x6')](e,emitEvent(event));}}module[_0xa92c('0x7')]=DashboardEvents; \ No newline at end of file +var _0xb764=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x302464,_0x75ad0a){var _0x3cf631=function(_0x50e273){while(--_0x50e273){_0x302464['push'](_0x302464['shift']());}};_0x3cf631(++_0x75ad0a);}(_0xb764,0x97));var _0x4b76=function(_0x175b3b,_0x40ff55){_0x175b3b=_0x175b3b-0x0;var _0x170cb7=_0xb764[_0x175b3b];return _0x170cb7;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x4b76('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4b76('0x1')](0x0);var events={'afterCreate':_0x4b76('0x2'),'afterUpdate':_0x4b76('0x3'),'afterDestroy':_0x4b76('0x4')};function emitEvent(_0x4f7d5d){return function(_0x5d5de6,_0x5e697f,_0x47f5bc){DashboardEvents[_0x4b76('0x5')](_0x4f7d5d+':'+_0x5d5de6['id'],_0x5d5de6);DashboardEvents['emit'](_0x4f7d5d,_0x5d5de6);_0x47f5bc(null);};}for(var e in events){if(events[_0x4b76('0x6')](e)){var event=events[e];Dashboard[_0x4b76('0x7')](e,emitEvent(event));}}module[_0x4b76('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 08ac9a2..0193bdf 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 _0xad00=['Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad00,0x195));var _0x0ad0=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xad00[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var logger=require(_0x0ad0('0x2'))(_0x0ad0('0x3'));var moment=require(_0x0ad0('0x4'));var BPromise=require(_0x0ad0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ad0('0x6'));var rimraf=require(_0x0ad0('0x7'));var config=require(_0x0ad0('0x8'));var attributes=require('./dashboard.attributes');module[_0x0ad0('0x9')]=function(_0x4165e6,_0x1f33d8){return _0x4165e6[_0x0ad0('0xa')](_0x0ad0('0xb'),attributes,{'tableName':_0x0ad0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96dd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x96dd,0x1d0));var _0xd96d=function(_0x42adf,_0x1b0690){_0x42adf=_0x42adf-0x0;var _0x2da4b9=_0x96dd[_0x42adf];return _0x2da4b9;};'use strict';var _=require(_0xd96d('0x0'));var util=require(_0xd96d('0x1'));var logger=require(_0xd96d('0x2'))(_0xd96d('0x3'));var moment=require(_0xd96d('0x4'));var BPromise=require(_0xd96d('0x5'));var rp=require(_0xd96d('0x6'));var fs=require('fs');var path=require(_0xd96d('0x7'));var rimraf=require(_0xd96d('0x8'));var config=require(_0xd96d('0x9'));var attributes=require(_0xd96d('0xa'));module[_0xd96d('0xb')]=function(_0x171224,_0x363b35){return _0x171224[_0xd96d('0xc')](_0xd96d('0xd'),attributes,{'tableName':_0xd96d('0xe'),'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 56f091d..d2cb1bc 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 _0xdf1c=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','lodash','util'];(function(_0x2e7b28,_0x14094e){var _0x24e5bd=function(_0x3a762d){while(--_0x3a762d){_0x2e7b28['push'](_0x2e7b28['shift']());}};_0x24e5bd(++_0x14094e);}(_0xdf1c,0x112));var _0xcdf1=function(_0x151076,_0x11d021){_0x151076=_0x151076-0x0;var _0x230967=_0xdf1c[_0x151076];return _0x230967;};'use strict';var _=require(_0xcdf1('0x0'));var util=require(_0xcdf1('0x1'));var moment=require('moment');var BPromise=require(_0xcdf1('0x2'));var rs=require(_0xcdf1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdf1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdf1('0x5'))(_0xcdf1('0x6'));var config=require(_0xcdf1('0x7'));var jayson=require(_0xcdf1('0x8'));var client=jayson[_0xcdf1('0x9')]['http']({'port':0x232a});config[_0xcdf1('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdf1('0xb'))(new Redis(config[_0xcdf1('0xa')]));require(_0xcdf1('0xc'))[_0xcdf1('0xd')](socket);function respondWithRpcPromise(_0x4fdcd6,_0x813af7,_0x33ae76){return new BPromise(function(_0xa26a5e,_0x27099e){return client[_0xcdf1('0xe')](_0x4fdcd6,_0x33ae76)[_0xcdf1('0xf')](function(_0x537c5a){logger['info'](_0xcdf1('0x10'),_0x813af7,_0xcdf1('0x11'));logger[_0xcdf1('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x813af7,_0xcdf1('0x11'),JSON['stringify'](_0x537c5a));if(_0x537c5a['error']){if(_0x537c5a['error'][_0xcdf1('0x13')]===0x1f4){logger[_0xcdf1('0x14')](_0xcdf1('0x10'),_0x813af7,_0x537c5a[_0xcdf1('0x14')]['message']);return _0x27099e(_0x537c5a[_0xcdf1('0x14')][_0xcdf1('0x15')]);}logger[_0xcdf1('0x14')]('Dashboard,\x20%s,\x20%s',_0x813af7,_0x537c5a[_0xcdf1('0x14')]['message']);return _0xa26a5e(_0x537c5a[_0xcdf1('0x14')][_0xcdf1('0x15')]);}else{logger[_0xcdf1('0x16')](_0xcdf1('0x10'),_0x813af7,_0xcdf1('0x11'));_0xa26a5e(_0x537c5a['result'][_0xcdf1('0x15')]);}})['catch'](function(_0x2d899c){logger[_0xcdf1('0x14')](_0xcdf1('0x10'),_0x813af7,_0x2d899c);_0x27099e(_0x2d899c);});});} \ No newline at end of file +var _0x32d3=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32d3,0x1c4));var _0x332d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x32d3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x332d('0x0'));var util=require('util');var moment=require(_0x332d('0x1'));var BPromise=require(_0x332d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x332d('0x3'));var db=require(_0x332d('0x4'))['db'];var utils=require(_0x332d('0x5'));var logger=require(_0x332d('0x6'))(_0x332d('0x7'));var config=require('../../config/environment');var jayson=require(_0x332d('0x8'));var client=jayson[_0x332d('0x9')][_0x332d('0xa')]({'port':0x232a});config[_0x332d('0xb')]=_[_0x332d('0xc')](config[_0x332d('0xb')],{'host':_0x332d('0xd'),'port':0x18eb});var socket=require(_0x332d('0xe'))(new Redis(config[_0x332d('0xb')]));require('./dashboard.socket')[_0x332d('0xf')](socket);function respondWithRpcPromise(_0x1baa8a,_0x25866,_0x11d863){return new BPromise(function(_0x1ff13b,_0x3ed555){return client[_0x332d('0x10')](_0x1baa8a,_0x11d863)[_0x332d('0x11')](function(_0x1cc79f){logger[_0x332d('0x12')](_0x332d('0x13'),_0x25866,_0x332d('0x14'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x25866,_0x332d('0x14'),JSON[_0x332d('0x15')](_0x1cc79f));if(_0x1cc79f[_0x332d('0x16')]){if(_0x1cc79f[_0x332d('0x16')][_0x332d('0x17')]===0x1f4){logger[_0x332d('0x16')](_0x332d('0x13'),_0x25866,_0x1cc79f[_0x332d('0x16')][_0x332d('0x18')]);return _0x3ed555(_0x1cc79f[_0x332d('0x16')]['message']);}logger['error'](_0x332d('0x13'),_0x25866,_0x1cc79f[_0x332d('0x16')][_0x332d('0x18')]);return _0x1ff13b(_0x1cc79f['error'][_0x332d('0x18')]);}else{logger[_0x332d('0x12')](_0x332d('0x13'),_0x25866,_0x332d('0x14'));_0x1ff13b(_0x1cc79f[_0x332d('0x19')][_0x332d('0x18')]);}})[_0x332d('0x1a')](function(_0x251c5c){logger[_0x332d('0x16')]('Dashboard,\x20%s,\x20%s',_0x25866,_0x251c5c);_0x3ed555(_0x251c5c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bf02ead..8164e6c 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 _0x05f0=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','length'];(function(_0x29d63a,_0x41634b){var _0x585d57=function(_0x5ba8b4){while(--_0x5ba8b4){_0x29d63a['push'](_0x29d63a['shift']());}};_0x585d57(++_0x41634b);}(_0x05f0,0x179));var _0x005f=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x05f0[_0x5d5bcb];return _0x4ea5eb;};'use strict';var DashboardEvents=require(_0x005f('0x0'));var events=[_0x005f('0x1'),_0x005f('0x2'),_0x005f('0x3')];function createListener(_0x44fcc2,_0x2281be){return function(_0x1feb13){_0x2281be[_0x005f('0x4')](_0x44fcc2,_0x1feb13);};}function removeListener(_0x5ab2ad,_0x38ec02){return function(){DashboardEvents[_0x005f('0x5')](_0x5ab2ad,_0x38ec02);};}exports['register']=function(_0x4743a7){for(var _0x5a5952=0x0,_0x217f98=events[_0x005f('0x6')];_0x5a5952<_0x217f98;_0x5a5952++){var _0x5af1c9=events[_0x5a5952];var _0x2e4ba1=createListener(_0x005f('0x7')+_0x5af1c9,_0x4743a7);DashboardEvents['on'](_0x5af1c9,_0x2e4ba1);}}; \ No newline at end of file +var _0xcde4=['emit','removeListener','./dashboard.events'];(function(_0x45dbb1,_0x2ecd87){var _0x5ad59a=function(_0x26c42a){while(--_0x26c42a){_0x45dbb1['push'](_0x45dbb1['shift']());}};_0x5ad59a(++_0x2ecd87);}(_0xcde4,0x19a));var _0x4cde=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0xcde4[_0x3cfb0d];return _0x3486b4;};'use strict';var DashboardEvents=require(_0x4cde('0x0'));var events=['save','remove','update'];function createListener(_0x18a30e,_0x1b58c8){return function(_0x3d2e5e){_0x1b58c8[_0x4cde('0x1')](_0x18a30e,_0x3d2e5e);};}function removeListener(_0x2e297f,_0xe9c844){return function(){DashboardEvents[_0x4cde('0x2')](_0x2e297f,_0xe9c844);};}exports['register']=function(_0x3bbe95){for(var _0x49fe5a=0x0,_0xc80a95=events['length'];_0x49fe5a<_0xc80a95;_0x49fe5a++){var _0x4712dc=events[_0x49fe5a];var _0x2b3cce=createListener('dashboard:'+_0x4712dc,_0x3bbe95);DashboardEvents['on'](_0x4712dc,_0x2b3cce);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1d8bcf5..d59020e 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 _0x2e77=['./dashboard.controller','isAuthenticated','get','/:id','show','/:id/items','post','create','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xad1d34,_0x5a748b){var _0x4e4701=function(_0x2209cc){while(--_0x2209cc){_0xad1d34['push'](_0xad1d34['shift']());}};_0x4e4701(++_0x5a748b);}(_0x2e77,0x159));var _0x72e7=function(_0x1bc35e,_0x4095be){_0x1bc35e=_0x1bc35e-0x0;var _0x22cd9f=_0x2e77[_0x1bc35e];return _0x22cd9f;};'use strict';var multer=require(_0x72e7('0x0'));var util=require(_0x72e7('0x1'));var path=require(_0x72e7('0x2'));var timeout=require(_0x72e7('0x3'));var express=require('express');var router=express[_0x72e7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x72e7('0x5'));var interaction=require(_0x72e7('0x6'));var config=require('../../config/environment');var controller=require(_0x72e7('0x7'));router['get']('/',auth[_0x72e7('0x8')](),controller['index']);router[_0x72e7('0x9')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller[_0x72e7('0xb')]);router[_0x72e7('0x9')](_0x72e7('0xc'),auth[_0x72e7('0x8')](),controller['getItems']);router[_0x72e7('0xd')]('/',auth[_0x72e7('0x8')](),controller[_0x72e7('0xe')]);router[_0x72e7('0xd')]('/:id/clone',auth[_0x72e7('0x8')](),controller[_0x72e7('0xf')]);router[_0x72e7('0xd')](_0x72e7('0xc'),auth[_0x72e7('0x8')](),controller[_0x72e7('0x10')]);router[_0x72e7('0x11')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller[_0x72e7('0x12')]);router[_0x72e7('0x13')]('/:id',auth[_0x72e7('0x8')](),controller[_0x72e7('0x14')]);module[_0x72e7('0x15')]=router; \ No newline at end of file +var _0xf0b3=['addItem','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/items','post','/:id/clone'];(function(_0x57c93f,_0x351f05){var _0x10cc88=function(_0x5cedb0){while(--_0x5cedb0){_0x57c93f['push'](_0x57c93f['shift']());}};_0x10cc88(++_0x351f05);}(_0xf0b3,0xce));var _0x3f0b=function(_0x1f69bc,_0xaffd71){_0x1f69bc=_0x1f69bc-0x0;var _0x1ac3c5=_0xf0b3[_0x1f69bc];return _0x1ac3c5;};'use strict';var multer=require(_0x3f0b('0x0'));var util=require(_0x3f0b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f0b('0x2'));var router=express['Router']();var fs_extra=require(_0x3f0b('0x3'));var auth=require(_0x3f0b('0x4'));var interaction=require(_0x3f0b('0x5'));var config=require(_0x3f0b('0x6'));var controller=require('./dashboard.controller');router[_0x3f0b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3f0b('0x7')](_0x3f0b('0x8'),auth[_0x3f0b('0x9')](),controller[_0x3f0b('0xa')]);router['get'](_0x3f0b('0xb'),auth[_0x3f0b('0x9')](),controller['getItems']);router[_0x3f0b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f0b('0xc')](_0x3f0b('0xd'),auth[_0x3f0b('0x9')](),controller['clone']);router[_0x3f0b('0xc')](_0x3f0b('0xb'),auth[_0x3f0b('0x9')](),controller[_0x3f0b('0xe')]);router[_0x3f0b('0xf')]('/:id',auth[_0x3f0b('0x9')](),controller[_0x3f0b('0x10')]);router[_0x3f0b('0x11')](_0x3f0b('0x8'),auth[_0x3f0b('0x9')](),controller[_0x3f0b('0x12')]);module[_0x3f0b('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 7792d1d..624745f 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 _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x14b792,_0x4b4c7f){var _0x1f9eb0=function(_0x46699b){while(--_0x46699b){_0x14b792['push'](_0x14b792['shift']());}};_0x1f9eb0(++_0x4b4c7f);}(_0x2ef3,0xba));var _0x32ef=function(_0x43fbea,_0x20a528){_0x43fbea=_0x43fbea-0x0;var _0x3174bd=_0x2ef3[_0x43fbea];return _0x3174bd;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x58a681,_0x5b91a8){var _0x4b4dd5=function(_0x402426){while(--_0x402426){_0x58a681['push'](_0x58a681['shift']());}};_0x4b4dd5(++_0x5b91a8);}(_0x2ef3,0xba));var _0x32ef=function(_0x1d5677,_0x4d6507){_0x1d5677=_0x1d5677-0x0;var _0x59d4cf=_0x2ef3[_0x1d5677];return _0x59d4cf;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('0xa')],'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 3909e48..b45750f 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 _0x1261=['offset','undefined','set','Content-Range','json','apply','reject','update','then','destroy','error','name','show','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','include','merge','options','catch','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','counter','attrMetric','attrVoiceQueues','attrFontSize','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie3','attrChannel','web-report','type','attrReport','attrRefresh','widgetAttributes:\x20%s','body','create','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status'];(function(_0x24aff9,_0x479f13){var _0x53f9b1=function(_0x2346da){while(--_0x2346da){_0x24aff9['push'](_0x24aff9['shift']());}};_0x53f9b1(++_0x479f13);}(_0x1261,0x144));var _0x1126=function(_0x225d44,_0x399b52){_0x225d44=_0x225d44-0x0;var _0x4aa98a=_0x1261[_0x225d44];return _0x4aa98a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];config[_0x1126('0x18')]=_[_0x1126('0x19')](config[_0x1126('0x18')],{'host':_0x1126('0x1a'),'port':0x18eb});var socket=require(_0x1126('0x1b'))(new Redis(config[_0x1126('0x18')]));require(_0x1126('0x1c'))['register'](socket);function respondWithStatusCode(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xcc;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1d')](_0x1af673);}return _0x5de9a7['status'](_0x1af673)[_0x1126('0x1e')]();};}function respondWithResult(_0x4794a7,_0x35fe9f){_0x35fe9f=_0x35fe9f||0xc8;return function(_0x42f379){if(_0x42f379){return _0x4794a7[_0x1126('0x1f')](_0x35fe9f)['json'](_0x42f379);}};}function respondWithFilteredResult(_0x245cd7,_0x1695f6){return function(_0x4a7b49){if(_0x4a7b49){var _0x4d2b38=typeof _0x1695f6[_0x1126('0x20')]===_0x1126('0x21')&&typeof _0x1695f6['limit']==='undefined';var _0x4564c0=_0x4a7b49['count'];var _0x22ed37=_0x4d2b38?0x0:_0x1695f6[_0x1126('0x20')];var _0x2f70ac=_0x4d2b38?_0x4a7b49['count']:_0x1695f6[_0x1126('0x20')]+_0x1695f6['limit'];var _0x56efeb;if(_0x2f70ac>=_0x4564c0){_0x2f70ac=_0x4564c0;_0x56efeb=0xc8;}else{_0x56efeb=0xce;}_0x245cd7[_0x1126('0x1f')](_0x56efeb);return _0x245cd7[_0x1126('0x22')](_0x1126('0x23'),_0x22ed37+'-'+_0x2f70ac+'/'+_0x4564c0)[_0x1126('0x24')](_0x4a7b49);}return null;};}function patchUpdates(_0x526ca1){return function(_0x29ab60){try{jsonpatch[_0x1126('0x25')](_0x29ab60,_0x526ca1,!![]);}catch(_0x48a08d){return BPromise[_0x1126('0x26')](_0x48a08d);}return _0x29ab60['save']();};}function saveUpdates(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x27')](_0x529dd9)[_0x1126('0x28')](function(_0x34bcf1){return _0x34bcf1;});}return null;};}function removeEntity(_0x566c09,_0x1b07a7){return function(_0xea0971){if(_0xea0971){return _0xea0971[_0x1126('0x29')]()['then'](function(){_0x566c09[_0x1126('0x1f')](0xcc)[_0x1126('0x1e')]();});}};}function handleEntityNotFound(_0xa293f4,_0x5ddf63){return function(_0x541bc9){if(!_0x541bc9){_0xa293f4[_0x1126('0x1d')](0x194);}return _0x541bc9;};}function handleError(_0x39bf0e,_0x55e195){_0x55e195=_0x55e195||0x1f4;return function(_0x2fb797){logger[_0x1126('0x2a')](_0x2fb797['stack']);if(_0x2fb797[_0x1126('0x2b')]){delete _0x2fb797['name'];}_0x39bf0e[_0x1126('0x1f')](_0x55e195)['send'](_0x2fb797);};}exports[_0x1126('0x2c')]=function(_0x583ce6,_0x378f4d){var _0x5f2611={'raw':![],'where':{'id':_0x583ce6['params']['id']}},_0x5252e0={};_0x5252e0[_0x1126('0x2d')]=_[_0x1126('0x2e')](db[_0x1126('0x2f')]['rawAttributes']);_0x5252e0[_0x1126('0x30')]=_[_0x1126('0x2e')](_0x583ce6['query']);_0x5252e0[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5252e0[_0x1126('0x2d')],_0x5252e0[_0x1126('0x30')]);_0x5f2611['attributes']=_['intersection'](_0x5252e0[_0x1126('0x2d')],qs[_0x1126('0x33')](_0x583ce6[_0x1126('0x30')][_0x1126('0x33')]));_0x5f2611['attributes']=_0x5f2611[_0x1126('0x34')][_0x1126('0x35')]?_0x5f2611[_0x1126('0x34')]:_0x5252e0[_0x1126('0x2d')];if(_0x583ce6[_0x1126('0x30')]['includeAll']){_0x5f2611[_0x1126('0x36')]=[{'all':!![]}];}_0x5f2611=_[_0x1126('0x37')]({},_0x5f2611,_0x583ce6[_0x1126('0x38')]);return db[_0x1126('0x2f')]['find'](_0x5f2611)['then'](handleEntityNotFound(_0x378f4d,null))[_0x1126('0x28')](respondWithResult(_0x378f4d,null))[_0x1126('0x39')](handleError(_0x378f4d,null));};exports['destroy']=function(_0xde37cf,_0xf3c21b){return db[_0x1126('0x2f')]['find']({'where':{'id':_0xde37cf['params']['id']}})[_0x1126('0x28')](handleEntityNotFound(_0xf3c21b,null))[_0x1126('0x28')](removeEntity(_0xf3c21b,null))[_0x1126('0x39')](handleError(_0xf3c21b,null));};function widgetAttributes(_0x156554){try{switch(_0x156554['type']){case _0x1126('0x3a'):return[{'name':'attrUrl','value':_0x156554[_0x1126('0x3b')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'https://'}];case _0x1126('0x3e'):return[{'name':_0x1126('0x3f'),'value':_0x156554[_0x1126('0x3f')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||''}];case'clock':return[{'name':_0x1126('0x40'),'value':_0x156554[_0x1126('0x40')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x1126('0x41'),'value':_0x156554[_0x1126('0x41')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1][_0x1126('0x3d')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x156554['attrFontSize']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x2]?_0x156554[_0x1126('0x3c')][0x2][_0x1126('0x3d')]:undefined)||0xc}];case _0x1126('0x42'):return[{'name':_0x1126('0x43'),'value':_0x156554['attrMetric']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'total'},{'name':_0x1126('0x44'),'value':_0x156554['attrVoiceQueues']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x1]?_0x156554[_0x1126('0x3c')][0x1][_0x1126('0x3d')]:undefined)||[]},{'name':_0x1126('0x45'),'value':_0x156554['attrFontSize']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x2]?_0x156554[_0x1126('0x3c')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x156554['attrChannel']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x3]?_0x156554[_0x1126('0x3c')][0x3]['value']:undefined)||_0x1126('0x46')},{'name':_0x1126('0x47'),'value':_0x156554[_0x1126('0x47')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x4]?_0x156554['attrs'][0x4][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x48'),'value':_0x156554['attrFaxAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x5]?_0x156554['attrs'][0x5][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x49'),'value':_0x156554['attrSmsAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x6]?_0x156554[_0x1126('0x3c')][0x6]['value']:undefined)||''},{'name':_0x1126('0x4a'),'value':_0x156554[_0x1126('0x4a')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x7]?_0x156554[_0x1126('0x3c')][0x7][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4b'),'value':_0x156554[_0x1126('0x4b')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x8]?_0x156554['attrs'][0x8][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4c'),'value':_0x156554['attrChatWebsites']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x9]?_0x156554[_0x1126('0x3c')][0x9][_0x1126('0x3d')]:undefined)||''}];case'multibar-chart':case _0x1126('0x4d'):return[{'name':_0x1126('0x4e'),'value':_0x156554[_0x1126('0x4e')]||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'total'},{'name':'attrSerie2','value':_0x156554['attrSerie2']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1]['value']:undefined)||null},{'name':_0x1126('0x4f'),'value':_0x156554[_0x1126('0x4f')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x2]?_0x156554[_0x1126('0x3c')][0x2]['value']:undefined)||null},{'name':_0x1126('0x44'),'value':_0x156554[_0x1126('0x44')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x3]?_0x156554[_0x1126('0x3c')][0x3][_0x1126('0x3d')]:undefined)||[]},{'name':_0x1126('0x50'),'value':_0x156554[_0x1126('0x50')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x4]?_0x156554['attrs'][0x4][_0x1126('0x3d')]:undefined)||_0x1126('0x46')},{'name':_0x1126('0x47'),'value':_0x156554['attrEmailAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x5]?_0x156554['attrs'][0x5][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x48'),'value':_0x156554[_0x1126('0x48')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x6]?_0x156554[_0x1126('0x3c')][0x6][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x49'),'value':_0x156554[_0x1126('0x49')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x7]?_0x156554[_0x1126('0x3c')][0x7]['value']:undefined)||''},{'name':_0x1126('0x4a'),'value':_0x156554[_0x1126('0x4a')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x8]?_0x156554[_0x1126('0x3c')][0x8]['value']:undefined)||''},{'name':_0x1126('0x4b'),'value':_0x156554[_0x1126('0x4b')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x9]?_0x156554['attrs'][0x9][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4c'),'value':_0x156554['attrChatWebsites']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0xa]?_0x156554[_0x1126('0x3c')][0xa]['value']:undefined)||''}];case _0x1126('0x51'):return[{'name':'attrReport','type':_0x156554['reportType']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x52')]:undefined)||null,'value':_0x156554[_0x1126('0x53')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554['attrs'][0x0][_0x1126('0x3d')]:undefined)||null},{'name':_0x1126('0x54'),'value':_0x156554[_0x1126('0x54')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5b17d6){logger[_0x1126('0x2a')](_0x1126('0x55'),JSON['stringify'](_0x5b17d6));return[];}}exports['create']=function(_0x5e9260,_0x51a28d){if(_0x5e9260[_0x1126('0x56')]){_0x5e9260[_0x1126('0x56')][_0x1126('0x3c')]=widgetAttributes(_0x5e9260['body']);}return db[_0x1126('0x2f')][_0x1126('0x57')](_0x5e9260[_0x1126('0x56')],{})[_0x1126('0x28')](respondWithResult(_0x51a28d,0xc9))[_0x1126('0x39')](handleError(_0x51a28d,null));};exports[_0x1126('0x27')]=function(_0x131056,_0x49a0a3){if(_0x131056[_0x1126('0x56')]['id']){delete _0x131056[_0x1126('0x56')]['id'];}_0x131056[_0x1126('0x56')][_0x1126('0x3c')]=widgetAttributes(_0x131056[_0x1126('0x56')]);return db['DashboardItem']['find']({'where':{'id':_0x131056[_0x1126('0x58')]['id']}})[_0x1126('0x28')](handleEntityNotFound(_0x49a0a3,null))['then'](saveUpdates(_0x131056[_0x1126('0x56')],null))[_0x1126('0x28')](respondWithResult(_0x49a0a3,null))[_0x1126('0x39')](handleError(_0x49a0a3,null));}; \ No newline at end of file +var _0xc0f9=['moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','params','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','options','DashboardItem','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x171b03,_0x30931c){var _0x1b5e6f=function(_0x457b02){while(--_0x457b02){_0x171b03['push'](_0x171b03['shift']());}};_0x1b5e6f(++_0x30931c);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0xc0f9[_0x121b1a];return _0x2d89a6;};'use strict';var emlformat=require(_0x9c0f('0x0'));var rimraf=require(_0x9c0f('0x1'));var zipdir=require(_0x9c0f('0x2'));var jsonpatch=require(_0x9c0f('0x3'));var rp=require(_0x9c0f('0x4'));var moment=require(_0x9c0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c0f('0x6'));var util=require(_0x9c0f('0x7'));var path=require(_0x9c0f('0x8'));var sox=require('sox');var csv=require(_0x9c0f('0x9'));var ejs=require(_0x9c0f('0xa'));var fs=require('fs');var fs_extra=require(_0x9c0f('0xb'));var _=require(_0x9c0f('0xc'));var squel=require('squel');var crypto=require(_0x9c0f('0xd'));var jsforce=require(_0x9c0f('0xe'));var deskjs=require(_0x9c0f('0xf'));var toCsv=require(_0x9c0f('0x9'));var querystring=require('querystring');var Papa=require(_0x9c0f('0x10'));var Redis=require(_0x9c0f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9c0f('0x12'));var as=require(_0x9c0f('0x13'));var hardwareService=require(_0x9c0f('0x14'));var logger=require(_0x9c0f('0x15'))(_0x9c0f('0x16'));var utils=require(_0x9c0f('0x17'));var config=require(_0x9c0f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c0f('0x19'))['db'];config[_0x9c0f('0x1a')]=_[_0x9c0f('0x1b')](config[_0x9c0f('0x1a')],{'host':_0x9c0f('0x1c'),'port':0x18eb});var socket=require(_0x9c0f('0x1d'))(new Redis(config[_0x9c0f('0x1a')]));require(_0x9c0f('0x1e'))[_0x9c0f('0x1f')](socket);function respondWithStatusCode(_0x1201db,_0x38749d){_0x38749d=_0x38749d||0xcc;return function(_0x5cb198){if(_0x5cb198){return _0x1201db[_0x9c0f('0x20')](_0x38749d);}return _0x1201db['status'](_0x38749d)[_0x9c0f('0x21')]();};}function respondWithResult(_0x4d2611,_0x455a04){_0x455a04=_0x455a04||0xc8;return function(_0x307696){if(_0x307696){return _0x4d2611[_0x9c0f('0x22')](_0x455a04)['json'](_0x307696);}};}function respondWithFilteredResult(_0x58a631,_0x2274f9){return function(_0x339c47){if(_0x339c47){var _0x32d253=typeof _0x2274f9[_0x9c0f('0x23')]===_0x9c0f('0x24')&&typeof _0x2274f9['limit']===_0x9c0f('0x24');var _0x2aa887=_0x339c47[_0x9c0f('0x25')];var _0x1f3016=_0x32d253?0x0:_0x2274f9['offset'];var _0x33dff7=_0x32d253?_0x339c47[_0x9c0f('0x25')]:_0x2274f9[_0x9c0f('0x23')]+_0x2274f9[_0x9c0f('0x26')];var _0x2485dc;if(_0x33dff7>=_0x2aa887){_0x33dff7=_0x2aa887;_0x2485dc=0xc8;}else{_0x2485dc=0xce;}_0x58a631['status'](_0x2485dc);return _0x58a631['set'](_0x9c0f('0x27'),_0x1f3016+'-'+_0x33dff7+'/'+_0x2aa887)[_0x9c0f('0x28')](_0x339c47);}return null;};}function patchUpdates(_0x3b16dc){return function(_0x2f1bd6){try{jsonpatch[_0x9c0f('0x29')](_0x2f1bd6,_0x3b16dc,!![]);}catch(_0x4f5f61){return BPromise['reject'](_0x4f5f61);}return _0x2f1bd6[_0x9c0f('0x2a')]();};}function saveUpdates(_0x463ea6,_0x5c4df9){return function(_0x3c8efd){if(_0x3c8efd){return _0x3c8efd[_0x9c0f('0x2b')](_0x463ea6)[_0x9c0f('0x2c')](function(_0x1af538){return _0x1af538;});}return null;};}function removeEntity(_0x56e12e,_0x540842){return function(_0x2145e2){if(_0x2145e2){return _0x2145e2[_0x9c0f('0x2d')]()[_0x9c0f('0x2c')](function(){_0x56e12e[_0x9c0f('0x22')](0xcc)[_0x9c0f('0x21')]();});}};}function handleEntityNotFound(_0x46e1c6,_0x192799){return function(_0x257fca){if(!_0x257fca){_0x46e1c6[_0x9c0f('0x20')](0x194);}return _0x257fca;};}function handleError(_0x56a3b7,_0x3adc6b){_0x3adc6b=_0x3adc6b||0x1f4;return function(_0x497f24){logger[_0x9c0f('0x2e')](_0x497f24[_0x9c0f('0x2f')]);if(_0x497f24[_0x9c0f('0x30')]){delete _0x497f24[_0x9c0f('0x30')];}_0x56a3b7['status'](_0x3adc6b)['send'](_0x497f24);};}exports['show']=function(_0x5d6f25,_0x222d97){var _0x18b564={'raw':![],'where':{'id':_0x5d6f25[_0x9c0f('0x31')]['id']}},_0x37f059={};_0x37f059['model']=_[_0x9c0f('0x32')](db['DashboardItem'][_0x9c0f('0x33')]);_0x37f059[_0x9c0f('0x34')]=_['keys'](_0x5d6f25[_0x9c0f('0x34')]);_0x37f059[_0x9c0f('0x35')]=_['intersection'](_0x37f059[_0x9c0f('0x36')],_0x37f059[_0x9c0f('0x34')]);_0x18b564[_0x9c0f('0x37')]=_[_0x9c0f('0x38')](_0x37f059[_0x9c0f('0x36')],qs[_0x9c0f('0x39')](_0x5d6f25['query'][_0x9c0f('0x39')]));_0x18b564['attributes']=_0x18b564[_0x9c0f('0x37')][_0x9c0f('0x3a')]?_0x18b564[_0x9c0f('0x37')]:_0x37f059[_0x9c0f('0x36')];if(_0x5d6f25['query']['includeAll']){_0x18b564['include']=[{'all':!![]}];}_0x18b564=_['merge']({},_0x18b564,_0x5d6f25[_0x9c0f('0x3b')]);return db[_0x9c0f('0x3c')]['find'](_0x18b564)[_0x9c0f('0x2c')](handleEntityNotFound(_0x222d97,null))[_0x9c0f('0x2c')](respondWithResult(_0x222d97,null))[_0x9c0f('0x3d')](handleError(_0x222d97,null));};exports[_0x9c0f('0x2d')]=function(_0x75caac,_0x552b81){return db[_0x9c0f('0x3c')]['find']({'where':{'id':_0x75caac[_0x9c0f('0x31')]['id']}})[_0x9c0f('0x2c')](handleEntityNotFound(_0x552b81,null))[_0x9c0f('0x2c')](removeEntity(_0x552b81,null))[_0x9c0f('0x3d')](handleError(_0x552b81,null));};function widgetAttributes(_0x2d7aa0){try{switch(_0x2d7aa0[_0x9c0f('0x3e')]){case'iframe':return[{'name':_0x9c0f('0x3f'),'value':_0x2d7aa0['attrUrl']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x42')}];case _0x9c0f('0x43'):return[{'name':'attrPath','value':_0x2d7aa0[_0x9c0f('0x44')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0]['value']:undefined)||''}];case _0x9c0f('0x45'):return[{'name':'attrHourFormat','value':_0x2d7aa0[_0x9c0f('0x46')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x47')},{'name':_0x9c0f('0x48'),'value':_0x2d7aa0[_0x9c0f('0x48')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x49')},{'name':_0x9c0f('0x4a'),'value':_0x2d7aa0[_0x9c0f('0x4a')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x2]?_0x2d7aa0['attrs'][0x2][_0x9c0f('0x41')]:undefined)||0xc}];case _0x9c0f('0x4b'):return[{'name':_0x9c0f('0x4c'),'value':_0x2d7aa0['attrMetric']||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0]['value']:undefined)||_0x9c0f('0x4d')},{'name':'attrVoiceQueues','value':_0x2d7aa0[_0x9c0f('0x4e')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x2d7aa0[_0x9c0f('0x4a')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x2]?_0x2d7aa0[_0x9c0f('0x40')][0x2][_0x9c0f('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x2d7aa0['attrChannel']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x3]?_0x2d7aa0[_0x9c0f('0x40')][0x3][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4f')},{'name':_0x9c0f('0x50'),'value':_0x2d7aa0[_0x9c0f('0x50')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x4]?_0x2d7aa0[_0x9c0f('0x40')][0x4]['value']:undefined)||''},{'name':_0x9c0f('0x51'),'value':_0x2d7aa0[_0x9c0f('0x51')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x5]?_0x2d7aa0[_0x9c0f('0x40')][0x5][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x52'),'value':_0x2d7aa0['attrSmsAccounts']||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x6]?_0x2d7aa0[_0x9c0f('0x40')][0x6][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x53'),'value':_0x2d7aa0[_0x9c0f('0x53')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x7]?_0x2d7aa0[_0x9c0f('0x40')][0x7][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x54'),'value':_0x2d7aa0[_0x9c0f('0x54')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x8]?_0x2d7aa0[_0x9c0f('0x40')][0x8][_0x9c0f('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2d7aa0[_0x9c0f('0x55')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x9]?_0x2d7aa0['attrs'][0x9][_0x9c0f('0x41')]:undefined)||''}];case _0x9c0f('0x56'):case _0x9c0f('0x57'):return[{'name':_0x9c0f('0x58'),'value':_0x2d7aa0[_0x9c0f('0x58')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0[_0x9c0f('0x40')][0x0][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4d')},{'name':_0x9c0f('0x59'),'value':_0x2d7aa0[_0x9c0f('0x59')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2d7aa0[_0x9c0f('0x5a')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x2]?_0x2d7aa0[_0x9c0f('0x40')][0x2][_0x9c0f('0x41')]:undefined)||null},{'name':_0x9c0f('0x4e'),'value':_0x2d7aa0['attrVoiceQueues']||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x3]?_0x2d7aa0[_0x9c0f('0x40')][0x3][_0x9c0f('0x41')]:undefined)||[]},{'name':_0x9c0f('0x5b'),'value':_0x2d7aa0[_0x9c0f('0x5b')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x4]?_0x2d7aa0['attrs'][0x4][_0x9c0f('0x41')]:undefined)||_0x9c0f('0x4f')},{'name':_0x9c0f('0x50'),'value':_0x2d7aa0[_0x9c0f('0x50')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x5]?_0x2d7aa0[_0x9c0f('0x40')][0x5][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x51'),'value':_0x2d7aa0[_0x9c0f('0x51')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x6]?_0x2d7aa0[_0x9c0f('0x40')][0x6][_0x9c0f('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2d7aa0[_0x9c0f('0x52')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0['attrs'][0x7]?_0x2d7aa0[_0x9c0f('0x40')][0x7][_0x9c0f('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2d7aa0[_0x9c0f('0x53')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x8]?_0x2d7aa0['attrs'][0x8][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x54'),'value':_0x2d7aa0[_0x9c0f('0x54')]||(_0x2d7aa0['attrs']&&_0x2d7aa0['attrs'][0x9]?_0x2d7aa0[_0x9c0f('0x40')][0x9][_0x9c0f('0x41')]:undefined)||''},{'name':_0x9c0f('0x55'),'value':_0x2d7aa0[_0x9c0f('0x55')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0xa]?_0x2d7aa0[_0x9c0f('0x40')][0xa][_0x9c0f('0x41')]:undefined)||''}];case _0x9c0f('0x5c'):return[{'name':_0x9c0f('0x5d'),'type':_0x2d7aa0[_0x9c0f('0x5e')]||(_0x2d7aa0[_0x9c0f('0x40')]&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0][_0x9c0f('0x3e')]:undefined)||null,'value':_0x2d7aa0[_0x9c0f('0x5d')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x0]?_0x2d7aa0['attrs'][0x0][_0x9c0f('0x41')]:undefined)||null},{'name':_0x9c0f('0x5f'),'value':_0x2d7aa0[_0x9c0f('0x5f')]||(_0x2d7aa0['attrs']&&_0x2d7aa0[_0x9c0f('0x40')][0x1]?_0x2d7aa0[_0x9c0f('0x40')][0x1][_0x9c0f('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x5df9a6){logger['error'](_0x9c0f('0x60'),JSON[_0x9c0f('0x61')](_0x5df9a6));return[];}}exports[_0x9c0f('0x62')]=function(_0x40890b,_0x53abc8){if(_0x40890b[_0x9c0f('0x63')]){_0x40890b[_0x9c0f('0x63')][_0x9c0f('0x40')]=widgetAttributes(_0x40890b[_0x9c0f('0x63')]);}return db[_0x9c0f('0x3c')][_0x9c0f('0x62')](_0x40890b['body'],{})[_0x9c0f('0x2c')](respondWithResult(_0x53abc8,0xc9))[_0x9c0f('0x3d')](handleError(_0x53abc8,null));};exports[_0x9c0f('0x2b')]=function(_0x14e1be,_0xc0b6b5){if(_0x14e1be[_0x9c0f('0x63')]['id']){delete _0x14e1be[_0x9c0f('0x63')]['id'];}_0x14e1be[_0x9c0f('0x63')][_0x9c0f('0x40')]=widgetAttributes(_0x14e1be[_0x9c0f('0x63')]);return db['DashboardItem'][_0x9c0f('0x64')]({'where':{'id':_0x14e1be[_0x9c0f('0x31')]['id']}})[_0x9c0f('0x2c')](handleEntityNotFound(_0xc0b6b5,null))[_0x9c0f('0x2c')](saveUpdates(_0x14e1be[_0x9c0f('0x63')],null))[_0x9c0f('0x2c')](respondWithResult(_0xc0b6b5,null))[_0x9c0f('0x3d')](handleError(_0xc0b6b5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8d5a2eb..1586e98 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 _0x140e=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0xdae6b9,_0x370831){var _0x4f7567=function(_0x2b96b6){while(--_0x2b96b6){_0xdae6b9['push'](_0xdae6b9['shift']());}};_0x4f7567(++_0x370831);}(_0x140e,0xea));var _0xe140=function(_0x4f5b8c,_0x17f8d8){_0x4f5b8c=_0x4f5b8c-0x0;var _0x592a7b=_0x140e[_0x4f5b8c];return _0x592a7b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xe140('0x0'))['db'][_0xe140('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe140('0x2')](0x0);var events={'afterCreate':_0xe140('0x3'),'afterUpdate':_0xe140('0x4'),'afterDestroy':_0xe140('0x5')};function emitEvent(_0x15e998){return function(_0x59a505,_0x32b90b,_0x1ea51d){DashboardItemEvents['emit'](_0x15e998+':'+_0x59a505['id'],_0x59a505);DashboardItemEvents[_0xe140('0x6')](_0x15e998,_0x59a505);_0x1ea51d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xe140('0x7')](e,emitEvent(event));}}module[_0xe140('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x0cdd=['DashboardItem','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x454d68,_0x39be1f){var _0x4742fb=function(_0x2c541a){while(--_0x2c541a){_0x454d68['push'](_0x454d68['shift']());}};_0x4742fb(++_0x39be1f);}(_0x0cdd,0x184));var _0xd0cd=function(_0x54046b,_0x98b2db){_0x54046b=_0x54046b-0x0;var _0x2470ea=_0x0cdd[_0x54046b];return _0x2470ea;};'use strict';var EventEmitter=require(_0xd0cd('0x0'));var DashboardItem=require(_0xd0cd('0x1'))['db'][_0xd0cd('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd0cd('0x3'),'afterUpdate':_0xd0cd('0x4'),'afterDestroy':_0xd0cd('0x5')};function emitEvent(_0x8bde47){return function(_0x296fc8,_0x3a78dd,_0x154a77){DashboardItemEvents[_0xd0cd('0x6')](_0x8bde47+':'+_0x296fc8['id'],_0x296fc8);DashboardItemEvents[_0xd0cd('0x6')](_0x8bde47,_0x296fc8);_0x154a77(null);};}for(var e in events){if(events[_0xd0cd('0x7')](e)){var event=events[e];DashboardItem[_0xd0cd('0x8')](e,emitEvent(event));}}module[_0xd0cd('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 0bc9356..cb618f5 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 _0xa204=['path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','util','../../config/logger','api','bluebird'];(function(_0x14ab6e,_0x567125){var _0x67bd15=function(_0x2e1128){while(--_0x2e1128){_0x14ab6e['push'](_0x14ab6e['shift']());}};_0x67bd15(++_0x567125);}(_0xa204,0xb7));var _0x4a20=function(_0x4e946a,_0x50f6e8){_0x4e946a=_0x4e946a-0x0;var _0x8550b2=_0xa204[_0x4e946a];return _0x8550b2;};'use strict';var _=require('lodash');var util=require(_0x4a20('0x0'));var logger=require(_0x4a20('0x1'))(_0x4a20('0x2'));var moment=require('moment');var BPromise=require(_0x4a20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a20('0x4'));var rimraf=require(_0x4a20('0x5'));var config=require(_0x4a20('0x6'));var attributes=require(_0x4a20('0x7'));module['exports']=function(_0x31eb77,_0x556a37){return _0x31eb77[_0x4a20('0x8')](_0x4a20('0x9'),attributes,{'tableName':_0x4a20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9789=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x49cd89,_0x2ecaef){var _0x2d4ec9=function(_0x4623e1){while(--_0x4623e1){_0x49cd89['push'](_0x49cd89['shift']());}};_0x2d4ec9(++_0x2ecaef);}(_0x9789,0x1bc));var _0x9978=function(_0x183aea,_0x2a88b5){_0x183aea=_0x183aea-0x0;var _0x1ea092=_0x9789[_0x183aea];return _0x1ea092;};'use strict';var _=require(_0x9978('0x0'));var util=require(_0x9978('0x1'));var logger=require(_0x9978('0x2'))(_0x9978('0x3'));var moment=require(_0x9978('0x4'));var BPromise=require(_0x9978('0x5'));var rp=require(_0x9978('0x6'));var fs=require('fs');var path=require(_0x9978('0x7'));var rimraf=require(_0x9978('0x8'));var config=require(_0x9978('0x9'));var attributes=require(_0x9978('0xa'));module[_0x9978('0xb')]=function(_0x2ba7b5,_0x4386e1){return _0x2ba7b5[_0x9978('0xc')](_0x9978('0xd'),attributes,{'tableName':_0x9978('0xe'),'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 5ebae43..8523a1c 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 _0x1f59=['rpc','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32646f,_0x42824e){var _0x4f169f=function(_0x3d48bb){while(--_0x3d48bb){_0x32646f['push'](_0x32646f['shift']());}};_0x4f169f(++_0x42824e);}(_0x1f59,0x67));var _0x91f5=function(_0x52c28f,_0x317791){_0x52c28f=_0x52c28f-0x0;var _0x3daa4a=_0x1f59[_0x52c28f];return _0x3daa4a;};'use strict';var _=require(_0x91f5('0x0'));var util=require(_0x91f5('0x1'));var moment=require(_0x91f5('0x2'));var BPromise=require(_0x91f5('0x3'));var rs=require(_0x91f5('0x4'));var fs=require('fs');var Redis=require(_0x91f5('0x5'));var db=require(_0x91f5('0x6'))['db'];var utils=require(_0x91f5('0x7'));var logger=require(_0x91f5('0x8'))(_0x91f5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x91f5('0xa')]['http']({'port':0x232a});config['redis']=_[_0x91f5('0xb')](config[_0x91f5('0xc')],{'host':_0x91f5('0xd'),'port':0x18eb});var socket=require(_0x91f5('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x91f5('0xf')](socket);function respondWithRpcPromise(_0x5f1ad3,_0x1a55e1,_0x3faf13){return new BPromise(function(_0x5d959c,_0x5d1cad){return client[_0x91f5('0x10')](_0x5f1ad3,_0x3faf13)[_0x91f5('0x11')](function(_0xc41897){logger[_0x91f5('0x12')](_0x91f5('0x13'),_0x1a55e1,_0x91f5('0x14'));logger[_0x91f5('0x15')](_0x91f5('0x16'),_0x1a55e1,_0x91f5('0x14'),JSON[_0x91f5('0x17')](_0xc41897));if(_0xc41897[_0x91f5('0x18')]){if(_0xc41897[_0x91f5('0x18')][_0x91f5('0x19')]===0x1f4){logger[_0x91f5('0x18')](_0x91f5('0x13'),_0x1a55e1,_0xc41897[_0x91f5('0x18')][_0x91f5('0x1a')]);return _0x5d1cad(_0xc41897[_0x91f5('0x18')][_0x91f5('0x1a')]);}logger[_0x91f5('0x18')](_0x91f5('0x13'),_0x1a55e1,_0xc41897[_0x91f5('0x18')]['message']);return _0x5d959c(_0xc41897['error'][_0x91f5('0x1a')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x1a55e1,'request\x20sent');_0x5d959c(_0xc41897['result'][_0x91f5('0x1a')]);}})[_0x91f5('0x1b')](function(_0xe7d695){logger[_0x91f5('0x18')](_0x91f5('0x13'),_0x1a55e1,_0xe7d695);_0x5d1cad(_0xe7d695);});});} \ No newline at end of file +var _0x8d61=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8d61,0x1b3));var _0x18d6=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x8d61[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0x18d6('0x0'));var util=require(_0x18d6('0x1'));var moment=require(_0x18d6('0x2'));var BPromise=require(_0x18d6('0x3'));var rs=require(_0x18d6('0x4'));var fs=require('fs');var Redis=require(_0x18d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x18d6('0x6'));var logger=require('../../config/logger')(_0x18d6('0x7'));var config=require('../../config/environment');var jayson=require(_0x18d6('0x8'));var client=jayson[_0x18d6('0x9')][_0x18d6('0xa')]({'port':0x232a});config[_0x18d6('0xb')]=_[_0x18d6('0xc')](config[_0x18d6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x18d6('0xd'))(new Redis(config[_0x18d6('0xb')]));require(_0x18d6('0xe'))['register'](socket);function respondWithRpcPromise(_0x52f264,_0x56c10c,_0x11fe08){return new BPromise(function(_0x17f661,_0x470931){return client[_0x18d6('0xf')](_0x52f264,_0x11fe08)[_0x18d6('0x10')](function(_0x15464b){logger[_0x18d6('0x11')]('DashboardItem,\x20%s,\x20%s',_0x56c10c,_0x18d6('0x12'));logger[_0x18d6('0x13')](_0x18d6('0x14'),_0x56c10c,_0x18d6('0x12'),JSON[_0x18d6('0x15')](_0x15464b));if(_0x15464b[_0x18d6('0x16')]){if(_0x15464b[_0x18d6('0x16')][_0x18d6('0x17')]===0x1f4){logger[_0x18d6('0x16')]('DashboardItem,\x20%s,\x20%s',_0x56c10c,_0x15464b[_0x18d6('0x16')][_0x18d6('0x18')]);return _0x470931(_0x15464b[_0x18d6('0x16')]['message']);}logger[_0x18d6('0x16')]('DashboardItem,\x20%s,\x20%s',_0x56c10c,_0x15464b['error'][_0x18d6('0x18')]);return _0x17f661(_0x15464b[_0x18d6('0x16')][_0x18d6('0x18')]);}else{logger[_0x18d6('0x11')]('DashboardItem,\x20%s,\x20%s',_0x56c10c,_0x18d6('0x12'));_0x17f661(_0x15464b[_0x18d6('0x19')][_0x18d6('0x18')]);}})[_0x18d6('0x1a')](function(_0x4baedf){logger['error']('DashboardItem,\x20%s,\x20%s',_0x56c10c,_0x4baedf);_0x470931(_0x4baedf);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 9af7549..691b3b2 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 _0xa4e0=['length','dashboardItem:','./dashboardItem.events','save','update','emit','removeListener','register'];(function(_0x27c4b8,_0x114101){var _0x1c3671=function(_0x1adfb9){while(--_0x1adfb9){_0x27c4b8['push'](_0x27c4b8['shift']());}};_0x1c3671(++_0x114101);}(_0xa4e0,0x1b2));var _0x0a4e=function(_0x41caac,_0x50c421){_0x41caac=_0x41caac-0x0;var _0x28d2ba=_0xa4e0[_0x41caac];return _0x28d2ba;};'use strict';var DashboardItemEvents=require(_0x0a4e('0x0'));var events=[_0x0a4e('0x1'),'remove',_0x0a4e('0x2')];function createListener(_0x150e12,_0x4bf8f5){return function(_0x21dfc3){_0x4bf8f5[_0x0a4e('0x3')](_0x150e12,_0x21dfc3);};}function removeListener(_0x249c91,_0x411c32){return function(){DashboardItemEvents[_0x0a4e('0x4')](_0x249c91,_0x411c32);};}exports[_0x0a4e('0x5')]=function(_0x33a452){for(var _0x37bf40=0x0,_0x4ad405=events[_0x0a4e('0x6')];_0x37bf40<_0x4ad405;_0x37bf40++){var _0x319178=events[_0x37bf40];var _0x2fafb2=createListener(_0x0a4e('0x7')+_0x319178,_0x33a452);DashboardItemEvents['on'](_0x319178,_0x2fafb2);}}; \ No newline at end of file +var _0xb10c=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x5ad454,_0x35ca3c){var _0xcdbc88=function(_0x3ab4e9){while(--_0x3ab4e9){_0x5ad454['push'](_0x5ad454['shift']());}};_0xcdbc88(++_0x35ca3c);}(_0xb10c,0xd1));var _0xcb10=function(_0x5967df,_0x4c334f){_0x5967df=_0x5967df-0x0;var _0x43d062=_0xb10c[_0x5967df];return _0x43d062;};'use strict';var DashboardItemEvents=require(_0xcb10('0x0'));var events=[_0xcb10('0x1'),_0xcb10('0x2'),_0xcb10('0x3')];function createListener(_0x2c542b,_0x18b08b){return function(_0xc7cafa){_0x18b08b[_0xcb10('0x4')](_0x2c542b,_0xc7cafa);};}function removeListener(_0x400793,_0x400839){return function(){DashboardItemEvents[_0xcb10('0x5')](_0x400793,_0x400839);};}exports[_0xcb10('0x6')]=function(_0x1cf722){for(var _0x2f84e7=0x0,_0xad911f=events[_0xcb10('0x7')];_0x2f84e7<_0xad911f;_0x2f84e7++){var _0x47f4b4=events[_0x2f84e7];var _0x4320e8=createListener(_0xcb10('0x8')+_0x47f4b4,_0x1cf722);DashboardItemEvents['on'](_0x47f4b4,_0x4320e8);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 503eb35..b277f27 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 _0xc74c=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports'];(function(_0x52565a,_0x18e624){var _0x55b78e=function(_0x54cb00){while(--_0x54cb00){_0x52565a['push'](_0x52565a['shift']());}};_0x55b78e(++_0x18e624);}(_0xc74c,0x1a9));var _0xcc74=function(_0x5eb750,_0x42146f){_0x5eb750=_0x5eb750-0x0;var _0xa8e5d7=_0xc74c[_0x5eb750];return _0xa8e5d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcc74('0x0'));var timeout=require('connect-timeout');var express=require(_0xcc74('0x1'));var router=express[_0xcc74('0x2')]();var fs_extra=require(_0xcc74('0x3'));var auth=require(_0xcc74('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcc74('0x5'));var controller=require(_0xcc74('0x6'));router[_0xcc74('0x7')](_0xcc74('0x8'),auth[_0xcc74('0x9')](),controller[_0xcc74('0xa')]);router[_0xcc74('0xb')]('/',auth[_0xcc74('0x9')](),controller[_0xcc74('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcc74('0xd')]);router[_0xcc74('0xe')](_0xcc74('0x8'),auth[_0xcc74('0x9')](),controller[_0xcc74('0xf')]);module[_0xcc74('0x10')]=router; \ No newline at end of file +var _0x176b=['update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x176b,0x1b3));var _0xb176=function(_0x5ba304,_0x4c97c9){_0x5ba304=_0x5ba304-0x0;var _0x1fa547=_0x176b[_0x5ba304];return _0x1fa547;};'use strict';var multer=require(_0xb176('0x0'));var util=require(_0xb176('0x1'));var path=require(_0xb176('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb176('0x3'));var interaction=require(_0xb176('0x4'));var config=require(_0xb176('0x5'));var controller=require('./dashboardItem.controller');router[_0xb176('0x6')](_0xb176('0x7'),auth['isAuthenticated'](),controller[_0xb176('0x8')]);router[_0xb176('0x9')]('/',auth[_0xb176('0xa')](),controller[_0xb176('0xb')]);router[_0xb176('0xc')](_0xb176('0x7'),auth[_0xb176('0xa')](),controller[_0xb176('0xd')]);router[_0xb176('0xe')](_0xb176('0x7'),auth[_0xb176('0xa')](),controller['destroy']);module[_0xb176('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 91d264b..06e29db 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 _0x7977=['ENUM','first','second','third','exports','STRING'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x7977,0x8e));var _0x7797=function(_0x4e29f1,_0x3da155){_0x4e29f1=_0x4e29f1-0x0;var _0x4bc72f=_0x7977[_0x4e29f1];return _0x4bc72f;};'use strict';var Sequelize=require('sequelize');module[_0x7797('0x0')]={'name':{'type':Sequelize[_0x7797('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x7797('0x2')](_0x7797('0x3'),_0x7797('0x4'),_0x7797('0x5')),'allowNull':![],'defaultValue':_0x7797('0x3')},'description':{'type':Sequelize[_0x7797('0x1')]}}; \ No newline at end of file +var _0x4104=['third','sequelize','exports','STRING','first','second'];(function(_0x1762ba,_0x5010ea){var _0x213fd8=function(_0x2a075f){while(--_0x2a075f){_0x1762ba['push'](_0x1762ba['shift']());}};_0x213fd8(++_0x5010ea);}(_0x4104,0x139));var _0x4410=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0x4104[_0x3877c1];return _0x59056a;};'use strict';var Sequelize=require(_0x4410('0x0'));module[_0x4410('0x1')]={'name':{'type':Sequelize[_0x4410('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4410('0x3'),_0x4410('0x4'),_0x4410('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x4410('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d8865aa..59caceb 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 _0x4f0d=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','get','Dispositions','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','Disposition','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x592a9d,_0x434abb){_0x592a9d=_0x592a9d-0x0;var _0x59d2b3=_0x4f0d[_0x592a9d];return _0x59d2b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4f0('0x0'));var BPromise=require(_0xd4f0('0x1'));var Mustache=require(_0xd4f0('0x2'));var util=require('util');var path=require(_0xd4f0('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4f0('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4f0('0x5'));var squel=require(_0xd4f0('0x6'));var crypto=require('crypto');var jsforce=require(_0xd4f0('0x7'));var deskjs=require(_0xd4f0('0x8'));var toCsv=require(_0xd4f0('0x9'));var querystring=require(_0xd4f0('0xa'));var Papa=require(_0xd4f0('0xb'));var Redis=require('ioredis');var authService=require(_0xd4f0('0xc'));var qs=require(_0xd4f0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4f0('0xe'))(_0xd4f0('0xf'));var utils=require('../../config/utils');var config=require(_0xd4f0('0x10'));var licenseUtil=require(_0xd4f0('0x11'));var db=require(_0xd4f0('0x12'))['db'];function respondWithStatusCode(_0x2cd80d,_0x333ea5){_0x333ea5=_0x333ea5||0xcc;return function(_0x4d004f){if(_0x4d004f){return _0x2cd80d[_0xd4f0('0x13')](_0x333ea5);}return _0x2cd80d[_0xd4f0('0x14')](_0x333ea5)[_0xd4f0('0x15')]();};}function respondWithResult(_0x46b4de,_0x2fbeab){_0x2fbeab=_0x2fbeab||0xc8;return function(_0x544936){if(_0x544936){return _0x46b4de[_0xd4f0('0x14')](_0x2fbeab)[_0xd4f0('0x16')](_0x544936);}};}function respondWithFilteredResult(_0x89a7a4,_0x21eb54){return function(_0x44cf9f){if(_0x44cf9f){var _0x2dd02d=typeof _0x21eb54['offset']==='undefined'&&typeof _0x21eb54[_0xd4f0('0x17')]===_0xd4f0('0x18');var _0xff90e=_0x44cf9f[_0xd4f0('0x19')];var _0x4d0dcc=_0x2dd02d?0x0:_0x21eb54['offset'];var _0x122d27=_0x2dd02d?_0x44cf9f[_0xd4f0('0x19')]:_0x21eb54[_0xd4f0('0x1a')]+_0x21eb54[_0xd4f0('0x17')];var _0x7560d6;if(_0x122d27>=_0xff90e){_0x122d27=_0xff90e;_0x7560d6=0xc8;}else{_0x7560d6=0xce;}_0x89a7a4[_0xd4f0('0x14')](_0x7560d6);return _0x89a7a4[_0xd4f0('0x1b')](_0xd4f0('0x1c'),_0x4d0dcc+'-'+_0x122d27+'/'+_0xff90e)[_0xd4f0('0x16')](_0x44cf9f);}return null;};}function patchUpdates(_0x297e3c){return function(_0x5af067){try{jsonpatch[_0xd4f0('0x1d')](_0x5af067,_0x297e3c,!![]);}catch(_0x474c22){return BPromise[_0xd4f0('0x1e')](_0x474c22);}return _0x5af067['save']();};}function saveUpdates(_0x2c2bd5,_0x31c7a0){return function(_0x655480){if(_0x655480){return _0x655480['update'](_0x2c2bd5)[_0xd4f0('0x1f')](function(_0x174e52){return _0x174e52;});}return null;};}function removeEntity(_0xe85527,_0x143aee){return function(_0x4fd650){if(_0x4fd650){return _0x4fd650[_0xd4f0('0x20')]()[_0xd4f0('0x1f')](function(){var _0x9a1fe6=_0x4fd650[_0xd4f0('0x21')]({'plain':!![]});var _0x5f4858=_0xd4f0('0x22');return db['UserProfileResource'][_0xd4f0('0x20')]({'where':{'type':_0x5f4858,'resourceId':_0x9a1fe6['id']}})[_0xd4f0('0x1f')](function(){return _0x4fd650;});})[_0xd4f0('0x1f')](function(){_0xe85527[_0xd4f0('0x14')](0xcc)[_0xd4f0('0x15')]();});}};}function handleEntityNotFound(_0x2f4291,_0x1dd584){return function(_0xe25e57){if(!_0xe25e57){_0x2f4291[_0xd4f0('0x13')](0x194);}return _0xe25e57;};}function handleError(_0x2c1f4f,_0xe2bf28){_0xe2bf28=_0xe2bf28||0x1f4;return function(_0x4ea8aa){logger[_0xd4f0('0x23')](_0x4ea8aa[_0xd4f0('0x24')]);if(_0x4ea8aa[_0xd4f0('0x25')]){delete _0x4ea8aa[_0xd4f0('0x25')];}_0x2c1f4f['status'](_0xe2bf28)[_0xd4f0('0x26')](_0x4ea8aa);};}exports[_0xd4f0('0x27')]=function(_0x401a5b,_0x40da73){var _0x4b8244={},_0x39c44a={},_0x1b074f={'count':0x0,'rows':[]};var _0x132524=_[_0xd4f0('0x28')](db['Disposition'][_0xd4f0('0x29')],function(_0x2cb68f){return{'name':_0x2cb68f[_0xd4f0('0x2a')],'type':_0x2cb68f[_0xd4f0('0x2b')][_0xd4f0('0x2c')]};});_0x39c44a[_0xd4f0('0x2d')]=_[_0xd4f0('0x28')](_0x132524,_0xd4f0('0x25'));_0x39c44a[_0xd4f0('0x2e')]=_[_0xd4f0('0x2f')](_0x401a5b[_0xd4f0('0x2e')]);_0x39c44a['filters']=_[_0xd4f0('0x30')](_0x39c44a[_0xd4f0('0x2d')],_0x39c44a[_0xd4f0('0x2e')]);_0x4b8244[_0xd4f0('0x31')]=_[_0xd4f0('0x30')](_0x39c44a['model'],qs[_0xd4f0('0x32')](_0x401a5b[_0xd4f0('0x2e')]['fields']));_0x4b8244[_0xd4f0('0x31')]=_0x4b8244[_0xd4f0('0x31')][_0xd4f0('0x33')]?_0x4b8244['attributes']:_0x39c44a[_0xd4f0('0x2d')];if(!_0x401a5b['query']['hasOwnProperty']('nolimit')){_0x4b8244[_0xd4f0('0x17')]=qs[_0xd4f0('0x17')](_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x17')]);_0x4b8244[_0xd4f0('0x1a')]=qs['offset'](_0x401a5b['query'][_0xd4f0('0x1a')]);}_0x4b8244[_0xd4f0('0x34')]=qs[_0xd4f0('0x35')](_0x401a5b['query'][_0xd4f0('0x35')]);_0x4b8244[_0xd4f0('0x36')]=qs[_0xd4f0('0x37')](_['pick'](_0x401a5b[_0xd4f0('0x2e')],_0x39c44a['filters']),_0x132524);if(_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x38')]){_0x4b8244[_0xd4f0('0x36')]=_[_0xd4f0('0x39')](_0x4b8244[_0xd4f0('0x36')],{'$or':_[_0xd4f0('0x28')](_0x132524,function(_0x50904e){if(_0x50904e['type']!==_0xd4f0('0x3a')){var _0x2df381={};_0x2df381[_0x50904e['name']]={'$like':'%'+_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x38')]+'%'};return _0x2df381;}})});}_0x4b8244=_[_0xd4f0('0x39')]({},_0x4b8244,_0x401a5b[_0xd4f0('0x3b')]);var _0x29e48f={'where':_0x4b8244[_0xd4f0('0x36')]};return db['Disposition'][_0xd4f0('0x19')](_0x29e48f)[_0xd4f0('0x1f')](function(_0x2e59e4){_0x1b074f[_0xd4f0('0x19')]=_0x2e59e4;if(_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x3c')]){_0x4b8244['include']=[{'all':!![]}];}return db[_0xd4f0('0x3d')][_0xd4f0('0x3e')](_0x4b8244);})['then'](function(_0x50ccda){_0x1b074f[_0xd4f0('0x3f')]=_0x50ccda;return _0x1b074f;})[_0xd4f0('0x1f')](respondWithFilteredResult(_0x40da73,_0x4b8244))[_0xd4f0('0x40')](handleError(_0x40da73,null));};exports['show']=function(_0x4af132,_0x43fdc8){var _0x453675={'raw':!![],'where':{'id':_0x4af132[_0xd4f0('0x41')]['id']}},_0xcd831={};_0xcd831[_0xd4f0('0x2d')]=_[_0xd4f0('0x2f')](db[_0xd4f0('0x3d')][_0xd4f0('0x29')]);_0xcd831[_0xd4f0('0x2e')]=_[_0xd4f0('0x2f')](_0x4af132[_0xd4f0('0x2e')]);_0xcd831[_0xd4f0('0x37')]=_[_0xd4f0('0x30')](_0xcd831['model'],_0xcd831[_0xd4f0('0x2e')]);_0x453675['attributes']=_[_0xd4f0('0x30')](_0xcd831['model'],qs[_0xd4f0('0x32')](_0x4af132[_0xd4f0('0x2e')][_0xd4f0('0x32')]));_0x453675['attributes']=_0x453675[_0xd4f0('0x31')][_0xd4f0('0x33')]?_0x453675['attributes']:_0xcd831[_0xd4f0('0x2d')];if(_0x4af132['query'][_0xd4f0('0x3c')]){_0x453675[_0xd4f0('0x42')]=[{'all':!![]}];}_0x453675=_['merge']({},_0x453675,_0x4af132[_0xd4f0('0x3b')]);return db[_0xd4f0('0x3d')][_0xd4f0('0x43')](_0x453675)[_0xd4f0('0x1f')](handleEntityNotFound(_0x43fdc8,null))[_0xd4f0('0x1f')](respondWithResult(_0x43fdc8,null))[_0xd4f0('0x40')](handleError(_0x43fdc8,null));};exports[_0xd4f0('0x44')]=function(_0x42f52d,_0x63d99){return db[_0xd4f0('0x3d')][_0xd4f0('0x44')](_0x42f52d[_0xd4f0('0x45')],{})['then'](function(_0x1426c2){var _0x3cb364=_0x42f52d[_0xd4f0('0x46')][_0xd4f0('0x21')]({'plain':!![]});if(!_0x3cb364)throw new Error(_0xd4f0('0x47'));if(_0x3cb364['role']===_0xd4f0('0x46')){var _0x353f82=_0x1426c2[_0xd4f0('0x21')]({'plain':!![]});var _0x1f5c98=_0xd4f0('0x22');return db[_0xd4f0('0x48')][_0xd4f0('0x43')]({'where':{'name':_0x1f5c98,'userProfileId':_0x3cb364[_0xd4f0('0x49')]},'raw':!![]})[_0xd4f0('0x1f')](function(_0x8b388d){if(_0x8b388d&&_0x8b388d[_0xd4f0('0x4a')]===0x0){return db[_0xd4f0('0x4b')][_0xd4f0('0x44')]({'name':_0x353f82[_0xd4f0('0x25')],'resourceId':_0x353f82['id'],'type':_0x8b388d[_0xd4f0('0x25')],'sectionId':_0x8b388d['id']},{})['then'](function(){return _0x1426c2;});}else{return _0x1426c2;}})[_0xd4f0('0x40')](function(_0x4e3b6f){logger[_0xd4f0('0x23')](_0xd4f0('0x4c'),_0x4e3b6f);throw _0x4e3b6f;});}return _0x1426c2;})[_0xd4f0('0x1f')](respondWithResult(_0x63d99,0xc9))['catch'](handleError(_0x63d99,null));};exports[_0xd4f0('0x4d')]=function(_0xf5e504,_0x486044){if(_0xf5e504[_0xd4f0('0x45')]['id']){delete _0xf5e504[_0xd4f0('0x45')]['id'];}return db[_0xd4f0('0x3d')][_0xd4f0('0x43')]({'where':{'id':_0xf5e504['params']['id']}})[_0xd4f0('0x1f')](handleEntityNotFound(_0x486044,null))['then'](saveUpdates(_0xf5e504[_0xd4f0('0x45')],null))[_0xd4f0('0x1f')](respondWithResult(_0x486044,null))[_0xd4f0('0x40')](handleError(_0x486044,null));};exports[_0xd4f0('0x20')]=function(_0x2c9478,_0x4c663d){return db['Disposition'][_0xd4f0('0x43')]({'where':{'id':_0x2c9478[_0xd4f0('0x41')]['id']}})[_0xd4f0('0x1f')](handleEntityNotFound(_0x4c663d,null))[_0xd4f0('0x1f')](removeEntity(_0x4c663d,null))[_0xd4f0('0x40')](handleError(_0x4c663d,null));}; \ No newline at end of file +var _0x640a=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','name','status','send','index','map','Disposition','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x10c838,_0x2ed7eb){var _0x222f94=function(_0x57cc7d){while(--_0x57cc7d){_0x10c838['push'](_0x10c838['shift']());}};_0x222f94(++_0x2ed7eb);}(_0x640a,0x133));var _0xa640=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x640a[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xa640('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa640('0x1'));var rp=require(_0xa640('0x2'));var moment=require('moment');var BPromise=require(_0xa640('0x3'));var Mustache=require(_0xa640('0x4'));var util=require(_0xa640('0x5'));var path=require(_0xa640('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa640('0x7'));var fs=require('fs');var fs_extra=require(_0xa640('0x8'));var _=require(_0xa640('0x9'));var squel=require(_0xa640('0xa'));var crypto=require('crypto');var jsforce=require(_0xa640('0xb'));var deskjs=require(_0xa640('0xc'));var toCsv=require(_0xa640('0xd'));var querystring=require('querystring');var Papa=require(_0xa640('0xe'));var Redis=require(_0xa640('0xf'));var authService=require(_0xa640('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa640('0x11'));var hardwareService=require(_0xa640('0x12'));var logger=require(_0xa640('0x13'))('api');var utils=require(_0xa640('0x14'));var config=require(_0xa640('0x15'));var licenseUtil=require(_0xa640('0x16'));var db=require(_0xa640('0x17'))['db'];function respondWithStatusCode(_0x5c8e46,_0x422b79){_0x422b79=_0x422b79||0xcc;return function(_0x55b769){if(_0x55b769){return _0x5c8e46[_0xa640('0x18')](_0x422b79);}return _0x5c8e46['status'](_0x422b79)['end']();};}function respondWithResult(_0x4207d5,_0x5843a4){_0x5843a4=_0x5843a4||0xc8;return function(_0x2ef193){if(_0x2ef193){return _0x4207d5['status'](_0x5843a4)['json'](_0x2ef193);}};}function respondWithFilteredResult(_0x2bb8c5,_0x196af5){return function(_0x332e5c){if(_0x332e5c){var _0x181a9a=typeof _0x196af5[_0xa640('0x19')]==='undefined'&&typeof _0x196af5['limit']===_0xa640('0x1a');var _0xb0d836=_0x332e5c[_0xa640('0x1b')];var _0x72680e=_0x181a9a?0x0:_0x196af5[_0xa640('0x19')];var _0x23a765=_0x181a9a?_0x332e5c[_0xa640('0x1b')]:_0x196af5[_0xa640('0x19')]+_0x196af5[_0xa640('0x1c')];var _0x4d79a5;if(_0x23a765>=_0xb0d836){_0x23a765=_0xb0d836;_0x4d79a5=0xc8;}else{_0x4d79a5=0xce;}_0x2bb8c5['status'](_0x4d79a5);return _0x2bb8c5[_0xa640('0x1d')](_0xa640('0x1e'),_0x72680e+'-'+_0x23a765+'/'+_0xb0d836)[_0xa640('0x1f')](_0x332e5c);}return null;};}function patchUpdates(_0x2bdc54){return function(_0x10d84e){try{jsonpatch[_0xa640('0x20')](_0x10d84e,_0x2bdc54,!![]);}catch(_0x4c35fa){return BPromise['reject'](_0x4c35fa);}return _0x10d84e[_0xa640('0x21')]();};}function saveUpdates(_0x363df6,_0x3e5a8e){return function(_0x1ed06c){if(_0x1ed06c){return _0x1ed06c[_0xa640('0x22')](_0x363df6)[_0xa640('0x23')](function(_0x5a5ad7){return _0x5a5ad7;});}return null;};}function removeEntity(_0x4a66c6,_0x16940d){return function(_0x395c1f){if(_0x395c1f){return _0x395c1f[_0xa640('0x24')]()[_0xa640('0x23')](function(){var _0x1c152f=_0x395c1f[_0xa640('0x25')]({'plain':!![]});var _0x5949ec=_0xa640('0x26');return db[_0xa640('0x27')][_0xa640('0x24')]({'where':{'type':_0x5949ec,'resourceId':_0x1c152f['id']}})[_0xa640('0x23')](function(){return _0x395c1f;});})[_0xa640('0x23')](function(){_0x4a66c6['status'](0xcc)[_0xa640('0x28')]();});}};}function handleEntityNotFound(_0x53775e,_0xf5f89c){return function(_0x571a17){if(!_0x571a17){_0x53775e['sendStatus'](0x194);}return _0x571a17;};}function handleError(_0x169231,_0x47f291){_0x47f291=_0x47f291||0x1f4;return function(_0x36fb5d){logger[_0xa640('0x29')](_0x36fb5d[_0xa640('0x2a')]);if(_0x36fb5d[_0xa640('0x2b')]){delete _0x36fb5d[_0xa640('0x2b')];}_0x169231[_0xa640('0x2c')](_0x47f291)[_0xa640('0x2d')](_0x36fb5d);};}exports[_0xa640('0x2e')]=function(_0x1cf547,_0x4030f9){var _0x558ff9={},_0x57b94b={},_0x4ee03b={'count':0x0,'rows':[]};var _0x2af7f5=_[_0xa640('0x2f')](db[_0xa640('0x30')]['rawAttributes'],function(_0x371c45){return{'name':_0x371c45[_0xa640('0x31')],'type':_0x371c45['type'][_0xa640('0x32')]};});_0x57b94b[_0xa640('0x33')]=_[_0xa640('0x2f')](_0x2af7f5,_0xa640('0x2b'));_0x57b94b[_0xa640('0x34')]=_[_0xa640('0x35')](_0x1cf547[_0xa640('0x34')]);_0x57b94b[_0xa640('0x36')]=_['intersection'](_0x57b94b[_0xa640('0x33')],_0x57b94b['query']);_0x558ff9[_0xa640('0x37')]=_[_0xa640('0x38')](_0x57b94b[_0xa640('0x33')],qs[_0xa640('0x39')](_0x1cf547[_0xa640('0x34')]['fields']));_0x558ff9[_0xa640('0x37')]=_0x558ff9['attributes'][_0xa640('0x3a')]?_0x558ff9[_0xa640('0x37')]:_0x57b94b[_0xa640('0x33')];if(!_0x1cf547[_0xa640('0x34')]['hasOwnProperty']('nolimit')){_0x558ff9[_0xa640('0x1c')]=qs[_0xa640('0x1c')](_0x1cf547[_0xa640('0x34')][_0xa640('0x1c')]);_0x558ff9['offset']=qs['offset'](_0x1cf547[_0xa640('0x34')][_0xa640('0x19')]);}_0x558ff9[_0xa640('0x3b')]=qs[_0xa640('0x3c')](_0x1cf547[_0xa640('0x34')][_0xa640('0x3c')]);_0x558ff9['where']=qs['filters'](_['pick'](_0x1cf547[_0xa640('0x34')],_0x57b94b[_0xa640('0x36')]),_0x2af7f5);if(_0x1cf547[_0xa640('0x34')]['filter']){_0x558ff9['where']=_['merge'](_0x558ff9[_0xa640('0x3d')],{'$or':_['map'](_0x2af7f5,function(_0x33d51a){if(_0x33d51a['type']!=='VIRTUAL'){var _0x4e8790={};_0x4e8790[_0x33d51a[_0xa640('0x2b')]]={'$like':'%'+_0x1cf547['query'][_0xa640('0x3e')]+'%'};return _0x4e8790;}})});}_0x558ff9=_[_0xa640('0x3f')]({},_0x558ff9,_0x1cf547[_0xa640('0x40')]);var _0x3b0135={'where':_0x558ff9[_0xa640('0x3d')]};return db[_0xa640('0x30')][_0xa640('0x1b')](_0x3b0135)[_0xa640('0x23')](function(_0x50f95f){_0x4ee03b[_0xa640('0x1b')]=_0x50f95f;if(_0x1cf547[_0xa640('0x34')]['includeAll']){_0x558ff9[_0xa640('0x41')]=[{'all':!![]}];}return db[_0xa640('0x30')][_0xa640('0x42')](_0x558ff9);})[_0xa640('0x23')](function(_0x4f05ef){_0x4ee03b[_0xa640('0x43')]=_0x4f05ef;return _0x4ee03b;})[_0xa640('0x23')](respondWithFilteredResult(_0x4030f9,_0x558ff9))[_0xa640('0x44')](handleError(_0x4030f9,null));};exports[_0xa640('0x45')]=function(_0x259304,_0x375baf){var _0x1b3706={'raw':!![],'where':{'id':_0x259304['params']['id']}},_0x288d20={};_0x288d20[_0xa640('0x33')]=_[_0xa640('0x35')](db[_0xa640('0x30')]['rawAttributes']);_0x288d20['query']=_[_0xa640('0x35')](_0x259304['query']);_0x288d20['filters']=_[_0xa640('0x38')](_0x288d20[_0xa640('0x33')],_0x288d20['query']);_0x1b3706['attributes']=_[_0xa640('0x38')](_0x288d20[_0xa640('0x33')],qs[_0xa640('0x39')](_0x259304['query'][_0xa640('0x39')]));_0x1b3706[_0xa640('0x37')]=_0x1b3706[_0xa640('0x37')][_0xa640('0x3a')]?_0x1b3706[_0xa640('0x37')]:_0x288d20[_0xa640('0x33')];if(_0x259304[_0xa640('0x34')][_0xa640('0x46')]){_0x1b3706['include']=[{'all':!![]}];}_0x1b3706=_['merge']({},_0x1b3706,_0x259304['options']);return db[_0xa640('0x30')][_0xa640('0x47')](_0x1b3706)[_0xa640('0x23')](handleEntityNotFound(_0x375baf,null))[_0xa640('0x23')](respondWithResult(_0x375baf,null))[_0xa640('0x44')](handleError(_0x375baf,null));};exports[_0xa640('0x48')]=function(_0x226a71,_0x327fe4){return db[_0xa640('0x30')][_0xa640('0x48')](_0x226a71[_0xa640('0x49')],{})[_0xa640('0x23')](function(_0x26ce6d){var _0x1a7493=_0x226a71[_0xa640('0x4a')][_0xa640('0x25')]({'plain':!![]});if(!_0x1a7493)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a7493[_0xa640('0x4b')]===_0xa640('0x4a')){var _0x378ecd=_0x26ce6d[_0xa640('0x25')]({'plain':!![]});var _0x223cfb=_0xa640('0x26');return db[_0xa640('0x4c')][_0xa640('0x47')]({'where':{'name':_0x223cfb,'userProfileId':_0x1a7493['userProfileId']},'raw':!![]})[_0xa640('0x23')](function(_0x45023f){if(_0x45023f&&_0x45023f[_0xa640('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x378ecd[_0xa640('0x2b')],'resourceId':_0x378ecd['id'],'type':_0x45023f['name'],'sectionId':_0x45023f['id']},{})['then'](function(){return _0x26ce6d;});}else{return _0x26ce6d;}})[_0xa640('0x44')](function(_0x23d518){logger['error'](_0xa640('0x4e'),_0x23d518);throw _0x23d518;});}return _0x26ce6d;})[_0xa640('0x23')](respondWithResult(_0x327fe4,0xc9))[_0xa640('0x44')](handleError(_0x327fe4,null));};exports[_0xa640('0x22')]=function(_0x39b98e,_0x373955){if(_0x39b98e[_0xa640('0x49')]['id']){delete _0x39b98e[_0xa640('0x49')]['id'];}return db['Disposition'][_0xa640('0x47')]({'where':{'id':_0x39b98e['params']['id']}})[_0xa640('0x23')](handleEntityNotFound(_0x373955,null))['then'](saveUpdates(_0x39b98e[_0xa640('0x49')],null))[_0xa640('0x23')](respondWithResult(_0x373955,null))[_0xa640('0x44')](handleError(_0x373955,null));};exports[_0xa640('0x24')]=function(_0x5db0b9,_0x2d8820){return db[_0xa640('0x30')][_0xa640('0x47')]({'where':{'id':_0x5db0b9[_0xa640('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d8820,null))[_0xa640('0x23')](removeEntity(_0x2d8820,null))[_0xa640('0x44')](handleError(_0x2d8820,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 244509f..3ce9ebf 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 _0xb094=['./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb094,0xb1));var _0x4b09=function(_0x4199c3,_0x3d2223){_0x4199c3=_0x4199c3-0x0;var _0x3ccdab=_0xb094[_0x4199c3];return _0x3ccdab;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4b09('0x2'));var BPromise=require(_0x4b09('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b09('0x4'));var rimraf=require(_0x4b09('0x5'));var config=require(_0x4b09('0x6'));var attributes=require(_0x4b09('0x7'));module[_0x4b09('0x8')]=function(_0x10bf22,_0xc193a8){return _0x10bf22[_0x4b09('0x9')](_0x4b09('0xa'),attributes,{'tableName':_0x4b09('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x4b09('0xc'),_0x4b09('0xd')]},{'unique':!![],'name':_0x4b09('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x4b09('0xf'),'fields':['name',_0x4b09('0x10')]},{'unique':!![],'name':_0x4b09('0x11'),'fields':[_0x4b09('0xc'),_0x4b09('0x12')]},{'unique':!![],'name':_0x4b09('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x4b09('0x14'),'fields':[_0x4b09('0xc'),_0x4b09('0x15')]},{'unique':!![],'name':_0x4b09('0x16'),'fields':[_0x4b09('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf952=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','Disposition','tools_dispositions','name_voice','ListId','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','name_sms','SmsAccountId'];(function(_0x15876c,_0x510dd4){var _0x39d91b=function(_0x2a692c){while(--_0x2a692c){_0x15876c['push'](_0x15876c['shift']());}};_0x39d91b(++_0x510dd4);}(_0xf952,0x158));var _0x2f95=function(_0x588a66,_0x571fc2){_0x588a66=_0x588a66-0x0;var _0x5bca4c=_0xf952[_0x588a66];return _0x5bca4c;};'use strict';var _=require(_0x2f95('0x0'));var util=require(_0x2f95('0x1'));var logger=require(_0x2f95('0x2'))(_0x2f95('0x3'));var moment=require('moment');var BPromise=require(_0x2f95('0x4'));var rp=require(_0x2f95('0x5'));var fs=require('fs');var path=require(_0x2f95('0x6'));var rimraf=require(_0x2f95('0x7'));var config=require(_0x2f95('0x8'));var attributes=require('./disposition.attributes');module['exports']=function(_0x6ef1ba,_0x1706c7){return _0x6ef1ba['define'](_0x2f95('0x9'),attributes,{'tableName':_0x2f95('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2f95('0xb'),'fields':['name',_0x2f95('0xc')]},{'unique':!![],'name':_0x2f95('0xd'),'fields':['name',_0x2f95('0xe')]},{'unique':!![],'name':_0x2f95('0xf'),'fields':[_0x2f95('0x10'),_0x2f95('0x11')]},{'unique':!![],'name':_0x2f95('0x12'),'fields':['name',_0x2f95('0x13')]},{'unique':!![],'name':_0x2f95('0x14'),'fields':[_0x2f95('0x10'),_0x2f95('0x15')]},{'unique':!![],'name':_0x2f95('0x16'),'fields':[_0x2f95('0x10'),_0x2f95('0x17')]},{'unique':!![],'name':_0x2f95('0x18'),'fields':[_0x2f95('0x10'),_0x2f95('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 84bc25b..129aeaa 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(_0x25f63b,_0x151e6f){var _0x150168=function(_0x359477){while(--_0x359477){_0x25f63b['push'](_0x25f63b['shift']());}};_0x150168(++_0x151e6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x2cb1f9,_0xe344ae){var _0x593ba6=function(_0x347443){while(--_0x347443){_0x2cb1f9['push'](_0x2cb1f9['shift']());}};_0x593ba6(++_0xe344ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 f6be36d..b89ee36 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 _0x5ee9=['update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x275357,_0x126c88){var _0x237d0a=function(_0x3276b8){while(--_0x3276b8){_0x275357['push'](_0x275357['shift']());}};_0x237d0a(++_0x126c88);}(_0x5ee9,0x120));var _0x95ee=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5ee9[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var path=require(_0x95ee('0x2'));var timeout=require('connect-timeout');var express=require(_0x95ee('0x3'));var router=express['Router']();var fs_extra=require(_0x95ee('0x4'));var auth=require(_0x95ee('0x5'));var interaction=require(_0x95ee('0x6'));var config=require(_0x95ee('0x7'));var controller=require(_0x95ee('0x8'));router[_0x95ee('0x9')]('/',auth[_0x95ee('0xa')](),controller[_0x95ee('0xb')]);router[_0x95ee('0x9')](_0x95ee('0xc'),auth[_0x95ee('0xa')](),controller['show']);router[_0x95ee('0xd')]('/',auth[_0x95ee('0xa')](),controller[_0x95ee('0xe')]);router[_0x95ee('0xf')]('/:id',auth[_0x95ee('0xa')](),controller[_0x95ee('0x10')]);router[_0x95ee('0x11')](_0x95ee('0xc'),auth[_0x95ee('0xa')](),controller['destroy']);module[_0x95ee('0x12')]=router; \ No newline at end of file +var _0x1da3=['get','index','isAuthenticated','post','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x5e455f,_0x1bbf06){var _0x368c4d=function(_0x236e34){while(--_0x236e34){_0x5e455f['push'](_0x5e455f['shift']());}};_0x368c4d(++_0x1bbf06);}(_0x1da3,0x118));var _0x31da=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1da3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x31da('0x0'));var path=require(_0x31da('0x1'));var timeout=require(_0x31da('0x2'));var express=require(_0x31da('0x3'));var router=express[_0x31da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x31da('0x5'));var interaction=require(_0x31da('0x6'));var config=require(_0x31da('0x7'));var controller=require(_0x31da('0x8'));router[_0x31da('0x9')]('/',auth['isAuthenticated'](),controller[_0x31da('0xa')]);router[_0x31da('0x9')]('/:id',auth[_0x31da('0xb')](),controller['show']);router[_0x31da('0xc')]('/',auth[_0x31da('0xb')](),controller['create']);router[_0x31da('0xd')](_0x31da('0xe'),auth[_0x31da('0xb')](),controller[_0x31da('0xf')]);router[_0x31da('0x10')]('/:id',auth['isAuthenticated'](),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 4cf1f86..87655c6 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 _0x689c=['DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','ENUM','yes','STRING','localstationid','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x689c,0xd0));var _0xc689=function(_0x3acef5,_0x33189f){_0x3acef5=_0x3acef5-0x0;var _0x2db9dc=_0x689c[_0x3acef5];return _0x2db9dc;};'use strict';var Sequelize=require(_0xc689('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xc689('0x1')]('yes','no'),'defaultValue':_0xc689('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xc689('0x3')],'unique':_0xc689('0x4')},'minrate':{'type':Sequelize[_0xc689('0x1')]('2400',_0xc689('0x5'),_0xc689('0x6'),_0xc689('0x7'),_0xc689('0x8'),_0xc689('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc689('0x1')]('2400',_0xc689('0x5'),_0xc689('0x6'),_0xc689('0x7'),_0xc689('0x8'),_0xc689('0x9')),'defaultValue':_0xc689('0x9')},'modem':{'type':Sequelize[_0xc689('0x3')],'defaultValue':_0xc689('0xa')},'gateway':{'type':Sequelize[_0xc689('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc689('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc689('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0xc689('0xc'),_0xc689('0xd')),'defaultValue':_0xc689('0xe')},'key':{'type':Sequelize[_0xc689('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc689('0xf')],'defaultValue':function(){return _0xc689('0x10');}},'notificationSound':{'type':Sequelize[_0xc689('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc689('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc689('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc689('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![],'comment':_0xc689('0x12'),'set':function(_0x58cfab){if(!_0x58cfab)this[_0xc689('0x13')](_0xc689('0x14'),null);this['setDataValue'](_0xc689('0x15'),_0x58cfab);}}}; \ No newline at end of file +var _0xcf67=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4b0a81,_0x3ba31c){var _0x10e369=function(_0x714c5f){while(--_0x714c5f){_0x4b0a81['push'](_0x4b0a81['shift']());}};_0x10e369(++_0x3ba31c);}(_0xcf67,0x94));var _0x7cf6=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xcf67[_0x398294];return _0x2a872d;};'use strict';var Sequelize=require(_0x7cf6('0x0'));module['exports']={'name':{'type':Sequelize[_0x7cf6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7cf6('0x1')]},'ecm':{'type':Sequelize[_0x7cf6('0x2')](_0x7cf6('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x7cf6('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x7cf6('0x5')},'minrate':{'type':Sequelize[_0x7cf6('0x2')](_0x7cf6('0x6'),_0x7cf6('0x7'),_0x7cf6('0x8'),_0x7cf6('0x9'),_0x7cf6('0xa'),_0x7cf6('0xb')),'defaultValue':_0x7cf6('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x7cf6('0x6'),_0x7cf6('0x7'),_0x7cf6('0x8'),_0x7cf6('0x9'),_0x7cf6('0xa'),_0x7cf6('0xb')),'defaultValue':_0x7cf6('0xb')},'modem':{'type':Sequelize[_0x7cf6('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x7cf6('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[_0x7cf6('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7cf6('0x2')](_0x7cf6('0xd'),_0x7cf6('0xe'),_0x7cf6('0xf'),_0x7cf6('0x10')),'defaultValue':_0x7cf6('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7cf6('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7cf6('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7cf6('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7cf6('0xc')],'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[_0x7cf6('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7cf6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7cf6('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x7cf6('0x12')],'defaultValue':![],'comment':_0x7cf6('0x14'),'set':function(_0x3531ab){if(!_0x3531ab)this[_0x7cf6('0x15')](_0x7cf6('0x16'),null);this[_0x7cf6('0x15')](_0x7cf6('0x17'),_0x3531ab);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f6d1acc..a6db675 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 _0x8a4b=['ecm','localstationid','gateway','headerinfo','maxrate','minrate','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','transaction','get','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','update','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','map','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','include','Pause','length','includeAll','merge','find','create','body','user','role','FaxAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','filter','findAll','rows','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','FaxApplication','priority','finally','sendStatus','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x8a4b,0xfe));var _0xb8a4=function(_0x4ce46c,_0x3002e5){_0x4ce46c=_0x4ce46c-0x0;var _0x132542=_0x8a4b[_0x4ce46c];return _0x132542;};'use strict';var emlformat=require(_0xb8a4('0x0'));var rimraf=require(_0xb8a4('0x1'));var zipdir=require(_0xb8a4('0x2'));var jsonpatch=require(_0xb8a4('0x3'));var rp=require(_0xb8a4('0x4'));var moment=require(_0xb8a4('0x5'));var BPromise=require(_0xb8a4('0x6'));var Mustache=require(_0xb8a4('0x7'));var util=require('util');var path=require(_0xb8a4('0x8'));var sox=require(_0xb8a4('0x9'));var csv=require(_0xb8a4('0xa'));var ejs=require(_0xb8a4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8a4('0xc'));var squel=require(_0xb8a4('0xd'));var crypto=require(_0xb8a4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb8a4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb8a4('0x10'));var Redis=require('ioredis');var authService=require(_0xb8a4('0x11'));var qs=require(_0xb8a4('0x12'));var as=require(_0xb8a4('0x13'));var hardwareService=require(_0xb8a4('0x14'));var logger=require(_0xb8a4('0x15'))(_0xb8a4('0x16'));var utils=require('../../config/utils');var config=require(_0xb8a4('0x17'));var licenseUtil=require(_0xb8a4('0x18'));var db=require(_0xb8a4('0x19'))['db'];config[_0xb8a4('0x1a')]=_['defaults'](config[_0xb8a4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb8a4('0x1a')]));require(_0xb8a4('0x1b'))[_0xb8a4('0x1c')](socket);var jayson=require(_0xb8a4('0x1d'));var client=jayson[_0xb8a4('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xb8a4('0x1e')][_0xb8a4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xd7d383,_0x29cc72,_0x2b6d73,_0x44d1b8){return new BPromise(function(_0xbaca69,_0x1b48e3){var _0x2d7997=_0x44d1b8||client;return _0x2d7997[_0xb8a4('0x20')](_0xd7d383,_0x2b6d73)[_0xb8a4('0x21')](function(_0x981a1){logger['info'](_0xb8a4('0x22'),_0x29cc72,_0xb8a4('0x23'));logger[_0xb8a4('0x24')](_0xb8a4('0x25'),_0x29cc72,_0xb8a4('0x23'),JSON[_0xb8a4('0x26')](_0x981a1));if(_0x981a1[_0xb8a4('0x27')]){if(_0x981a1['error'][_0xb8a4('0x28')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0x981a1[_0xb8a4('0x27')][_0xb8a4('0x29')]);return _0x1b48e3(_0x981a1['error'][_0xb8a4('0x29')]);}logger[_0xb8a4('0x27')]('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0x981a1[_0xb8a4('0x27')][_0xb8a4('0x29')]);return _0xbaca69(_0x981a1[_0xb8a4('0x27')][_0xb8a4('0x29')]);}else{logger[_0xb8a4('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0xb8a4('0x23'));_0xbaca69(_0x981a1[_0xb8a4('0x2b')]['message']);}})[_0xb8a4('0x2c')](function(_0xc64b1e){logger[_0xb8a4('0x27')]('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0xc64b1e);_0x1b48e3(_0xc64b1e);});});}function respondWithStatusCode(_0x297847,_0x9994a0){_0x9994a0=_0x9994a0||0xcc;return function(_0xba589b){if(_0xba589b){return _0x297847['sendStatus'](_0x9994a0);}return _0x297847[_0xb8a4('0x2d')](_0x9994a0)[_0xb8a4('0x2e')]();};}function respondWithResult(_0x7bf67d,_0x588c0b){_0x588c0b=_0x588c0b||0xc8;return function(_0x5520c3){if(_0x5520c3){return _0x7bf67d[_0xb8a4('0x2d')](_0x588c0b)[_0xb8a4('0x2f')](_0x5520c3);}};}function respondWithFilteredResult(_0x16cccf,_0x1432cf){return function(_0x3bc146){if(_0x3bc146){var _0x5d9d1d=typeof _0x1432cf[_0xb8a4('0x30')]===_0xb8a4('0x31')&&typeof _0x1432cf[_0xb8a4('0x32')]===_0xb8a4('0x31');var _0x3fec8e=_0x3bc146[_0xb8a4('0x33')];var _0x47477b=_0x5d9d1d?0x0:_0x1432cf['offset'];var _0x5725a4=_0x5d9d1d?_0x3bc146['count']:_0x1432cf[_0xb8a4('0x30')]+_0x1432cf[_0xb8a4('0x32')];var _0x341d21;if(_0x5725a4>=_0x3fec8e){_0x5725a4=_0x3fec8e;_0x341d21=0xc8;}else{_0x341d21=0xce;}_0x16cccf[_0xb8a4('0x2d')](_0x341d21);return _0x16cccf[_0xb8a4('0x34')]('Content-Range',_0x47477b+'-'+_0x5725a4+'/'+_0x3fec8e)['json'](_0x3bc146);}return null;};}function patchUpdates(_0x26f787){return function(_0x1b3353){try{jsonpatch[_0xb8a4('0x35')](_0x1b3353,_0x26f787,!![]);}catch(_0x4560e7){return BPromise[_0xb8a4('0x36')](_0x4560e7);}return _0x1b3353['save']();};}function saveUpdates(_0x1b79ef,_0x36a1e3){return function(_0x2e4c1e){if(_0x2e4c1e){return _0x2e4c1e[_0xb8a4('0x37')](_0x1b79ef)['then'](function(_0x516c33){return _0x516c33;});}return null;};}function removeEntity(_0x4668da,_0xedda85){return function(_0x483ed8){if(_0x483ed8){return _0x483ed8['destroy']()[_0xb8a4('0x21')](function(){var _0x135157=_0x483ed8['get']({'plain':!![]});var _0x1bc918='FaxAccounts';return db[_0xb8a4('0x38')][_0xb8a4('0x39')]({'where':{'type':_0x1bc918,'resourceId':_0x135157['id']}})['then'](function(){return _0x483ed8;});})[_0xb8a4('0x21')](function(){_0x4668da[_0xb8a4('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374eac,_0x1b9201){return function(_0x35a6bd){if(!_0x35a6bd){_0x374eac['sendStatus'](0x194);}return _0x35a6bd;};}function handleError(_0x26814d,_0x292045){_0x292045=_0x292045||0x1f4;return function(_0x2ef894){logger[_0xb8a4('0x27')](_0x2ef894[_0xb8a4('0x3a')]);if(_0x2ef894[_0xb8a4('0x3b')]){delete _0x2ef894['name'];}_0x26814d[_0xb8a4('0x2d')](_0x292045)[_0xb8a4('0x3c')](_0x2ef894);};}exports[_0xb8a4('0x3d')]=function(_0x31736b,_0x52e6c5){var _0x2b0daf={'include':[{'model':db['Pause'],'as':_0xb8a4('0x3e')}]},_0x17ddfb={},_0x2ffd04={'count':0x0,'rows':[]};var _0x1085bc=_['map'](db[_0xb8a4('0x3f')][_0xb8a4('0x40')],function(_0x22a78b){return{'name':_0x22a78b['fieldName'],'type':_0x22a78b[_0xb8a4('0x41')][_0xb8a4('0x42')]};});_0x17ddfb[_0xb8a4('0x43')]=_[_0xb8a4('0x44')](_0x1085bc,_0xb8a4('0x3b'));_0x17ddfb['query']=_[_0xb8a4('0x45')](_0x31736b['query']);_0x17ddfb[_0xb8a4('0x46')]=_['intersection'](_0x17ddfb[_0xb8a4('0x43')],_0x17ddfb['query']);_0x2b0daf[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x17ddfb[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x2b0daf[_0xb8a4('0x47')]=_0x2b0daf[_0xb8a4('0x47')]['length']?_0x2b0daf['attributes']:_0x17ddfb[_0xb8a4('0x43')];if(!_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x4b')](_0xb8a4('0x4c'))){_0x2b0daf[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x31736b[_0xb8a4('0x4a')]['limit']);_0x2b0daf[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x2b0daf[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x2b0daf[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x31736b['query'],_0x17ddfb['filters']),_0x1085bc);if(_0x31736b[_0xb8a4('0x4a')]['filter']){_0x2b0daf[_0xb8a4('0x4f')]=_['merge'](_0x2b0daf[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x1085bc,function(_0x2ec493){if(_0x2ec493[_0xb8a4('0x41')]!==_0xb8a4('0x51')){var _0x36d1af={};_0x36d1af[_0x2ec493['name']]={'$like':'%'+_0x31736b[_0xb8a4('0x4a')]['filter']+'%'};return _0x36d1af;}})});}_0x2b0daf=_['merge']({},_0x2b0daf,_0x31736b[_0xb8a4('0x52')]);var _0x52e0c7={'where':_0x2b0daf[_0xb8a4('0x4f')]};return db[_0xb8a4('0x3f')][_0xb8a4('0x33')](_0x52e0c7)[_0xb8a4('0x21')](function(_0x392f65){_0x2ffd04[_0xb8a4('0x33')]=_0x392f65;if(_0x31736b['query']['includeAll']){_0x2b0daf[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0x3f')]['findAll'](_0x2b0daf);})[_0xb8a4('0x21')](function(_0x1a64a1){_0x2ffd04['rows']=_0x1a64a1;return _0x2ffd04;})['then'](respondWithFilteredResult(_0x52e6c5,_0x2b0daf))[_0xb8a4('0x2c')](handleError(_0x52e6c5,null));};exports['show']=function(_0x16c61e,_0x46d9b8){var _0xc525f4={'raw':![],'where':{'id':_0x16c61e['params']['id']},'include':[{'model':db[_0xb8a4('0x54')],'as':_0xb8a4('0x3e')}]},_0x5f22dd={};_0x5f22dd[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x3f')]['rawAttributes']);_0x5f22dd[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0x16c61e['query']);_0x5f22dd[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x5f22dd[_0xb8a4('0x43')],_0x5f22dd['query']);_0xc525f4[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x5f22dd[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x16c61e[_0xb8a4('0x4a')]['fields']));_0xc525f4[_0xb8a4('0x47')]=_0xc525f4[_0xb8a4('0x47')][_0xb8a4('0x55')]?_0xc525f4[_0xb8a4('0x47')]:_0x5f22dd[_0xb8a4('0x43')];if(_0x16c61e[_0xb8a4('0x4a')][_0xb8a4('0x56')]){_0xc525f4[_0xb8a4('0x53')]=[{'all':!![]}];}_0xc525f4=_[_0xb8a4('0x57')]({},_0xc525f4,_0x16c61e[_0xb8a4('0x52')]);return db[_0xb8a4('0x3f')][_0xb8a4('0x58')](_0xc525f4)[_0xb8a4('0x21')](handleEntityNotFound(_0x46d9b8,null))[_0xb8a4('0x21')](respondWithResult(_0x46d9b8,null))[_0xb8a4('0x2c')](handleError(_0x46d9b8,null));};exports['create']=function(_0x182348,_0x1a4ec2){return db[_0xb8a4('0x3f')][_0xb8a4('0x59')](_0x182348[_0xb8a4('0x5a')],{})[_0xb8a4('0x21')](function(_0x381533){var _0x3b462c=_0x182348[_0xb8a4('0x5b')]['get']({'plain':!![]});if(!_0x3b462c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b462c[_0xb8a4('0x5c')]===_0xb8a4('0x5b')){var _0x25cad7=_0x381533['get']({'plain':!![]});var _0x39de94=_0xb8a4('0x5d');return db['UserProfileSection']['find']({'where':{'name':_0x39de94,'userProfileId':_0x3b462c['userProfileId']},'raw':!![]})['then'](function(_0x1fbe86){if(_0x1fbe86&&_0x1fbe86['autoAssociation']===0x0){return db[_0xb8a4('0x38')][_0xb8a4('0x59')]({'name':_0x25cad7[_0xb8a4('0x3b')],'resourceId':_0x25cad7['id'],'type':_0x1fbe86[_0xb8a4('0x3b')],'sectionId':_0x1fbe86['id']},{})[_0xb8a4('0x21')](function(){return _0x381533;});}else{return _0x381533;}})['catch'](function(_0x506b98){logger['error'](_0xb8a4('0x5e'),_0x506b98);throw _0x506b98;});}return _0x381533;})['then'](respondWithResult(_0x1a4ec2,0xc9))[_0xb8a4('0x2c')](handleError(_0x1a4ec2,null));};exports[_0xb8a4('0x37')]=function(_0x214f59,_0xf6b1c3){if(_0x214f59[_0xb8a4('0x5a')]['id']){delete _0x214f59[_0xb8a4('0x5a')]['id'];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x214f59['params']['id']},'include':[{'model':db[_0xb8a4('0x54')],'as':_0xb8a4('0x3e')}]})[_0xb8a4('0x21')](handleEntityNotFound(_0xf6b1c3,null))[_0xb8a4('0x21')](saveUpdates(_0x214f59[_0xb8a4('0x5a')],null))[_0xb8a4('0x21')](respondWithResult(_0xf6b1c3,null))[_0xb8a4('0x2c')](handleError(_0xf6b1c3,null));};exports['destroy']=function(_0x5912f2,_0x55e802){return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x5912f2[_0xb8a4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x55e802,null))['then'](removeEntity(_0x55e802,null))[_0xb8a4('0x2c')](handleError(_0x55e802,null));};exports[_0xb8a4('0x60')]=function(_0x555b57,_0x148709){return db[_0xb8a4('0x3f')][_0xb8a4('0x60')]()['then'](respondWithResult(_0x148709,null))[_0xb8a4('0x2c')](handleError(_0x148709,null));};exports[_0xb8a4('0x61')]=function(_0x2d07d7,_0xdb5e37,_0x295d9b){if(_0x2d07d7[_0xb8a4('0x5a')]['id']){delete _0x2d07d7[_0xb8a4('0x5a')]['id'];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x2d07d7['params']['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0xdb5e37,null))['then'](function(_0x51eaeb){if(_0x51eaeb){_0x2d07d7[_0xb8a4('0x5a')][_0xb8a4('0x62')]=_0x51eaeb['id'];return db[_0xb8a4('0x63')][_0xb8a4('0x59')](_0x2d07d7[_0xb8a4('0x5a')]);}})[_0xb8a4('0x21')](respondWithResult(_0xdb5e37,null))[_0xb8a4('0x2c')](handleError(_0xdb5e37,null));};exports[_0xb8a4('0x64')]=function(_0x198fb0,_0x236f39,_0x3960fd){var _0x55f310={'raw':![],'where':{}};var _0x2436d8={};var _0x28dcc3={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x198fb0[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x236f39,null))[_0xb8a4('0x21')](function(_0x4eebed){if(_0x4eebed){_0x2436d8[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x63')][_0xb8a4('0x40')]);_0x2436d8[_0xb8a4('0x4a')]=_['keys'](_0x198fb0[_0xb8a4('0x4a')]);_0x2436d8[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x2436d8[_0xb8a4('0x43')],_0x2436d8[_0xb8a4('0x4a')]);_0x55f310[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x2436d8[_0xb8a4('0x43')],qs['fields'](_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x55f310[_0xb8a4('0x47')]=_0x55f310[_0xb8a4('0x47')][_0xb8a4('0x55')]?_0x55f310[_0xb8a4('0x47')]:_0x2436d8['model'];if(!_0x198fb0[_0xb8a4('0x4a')]['hasOwnProperty'](_0xb8a4('0x4c'))){_0x55f310[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x55f310[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x55f310[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x198fb0['query']['sort']);_0x55f310['where']=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x198fb0['query'],_0x2436d8['filters']));_0x55f310[_0xb8a4('0x4f')][_0xb8a4('0x62')]=_0x4eebed['id'];if(_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x55f310[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x55f310[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x55f310['attributes'],function(_0x511149){var _0x42f1f3={};_0x42f1f3[_0x511149]={'$like':'%'+_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x42f1f3;})});}_0x55f310=_['merge']({},_0x55f310,_0x198fb0[_0xb8a4('0x52')]);return db[_0xb8a4('0x63')][_0xb8a4('0x33')]({'where':_0x55f310[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x502f86){_0x28dcc3[_0xb8a4('0x33')]=_0x502f86;if(_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x56')]){_0x55f310[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0x63')][_0xb8a4('0x66')](_0x55f310);})[_0xb8a4('0x21')](function(_0x5eda38){_0x28dcc3[_0xb8a4('0x67')]=_0x5eda38;return _0x28dcc3;});}})[_0xb8a4('0x21')](respondWithFilteredResult(_0x236f39,_0x55f310))['catch'](handleError(_0x236f39,null));};exports[_0xb8a4('0x68')]=function(_0x417e50,_0x30d61f,_0x3122c0){return db['FaxAccount'][_0xb8a4('0x58')]({'where':{'id':_0x417e50[_0xb8a4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x30d61f,null))['then'](function(_0x3318ff){if(_0x3318ff){return _0x3318ff[_0xb8a4('0x68')](_0x417e50[_0xb8a4('0x4a')]['ids']);}})[_0xb8a4('0x21')](respondWithStatusCode(_0x30d61f,null))[_0xb8a4('0x2c')](handleError(_0x30d61f,null));};exports['addAnswer']=function(_0x3282bb,_0x43908a,_0x43df53){if(_0x3282bb[_0xb8a4('0x5a')]['id']){delete _0x3282bb[_0xb8a4('0x5a')]['id'];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x3282bb[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x43908a,null))[_0xb8a4('0x21')](function(_0x550685){if(_0x550685){_0x3282bb['body'][_0xb8a4('0x62')]=_0x550685['id'];return db[_0xb8a4('0x69')][_0xb8a4('0x59')](_0x3282bb[_0xb8a4('0x5a')]);}})[_0xb8a4('0x21')](respondWithResult(_0x43908a,null))[_0xb8a4('0x2c')](handleError(_0x43908a,null));};exports[_0xb8a4('0x6a')]=function(_0xaeb9b3,_0x3b32aa,_0x17acf9){var _0x16afd6={'raw':![],'where':{}};var _0x510535={};var _0x518010={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')][_0xb8a4('0x6b')]({'where':{'id':_0xaeb9b3['params']['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x3b32aa,null))[_0xb8a4('0x21')](function(_0x51b935){if(_0x51b935){_0x510535[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x69')][_0xb8a4('0x40')]);_0x510535[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0xaeb9b3[_0xb8a4('0x4a')]);_0x510535['filters']=_[_0xb8a4('0x48')](_0x510535[_0xb8a4('0x43')],_0x510535[_0xb8a4('0x4a')]);_0x16afd6[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x510535[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0xaeb9b3[_0xb8a4('0x4a')]['fields']));_0x16afd6[_0xb8a4('0x47')]=_0x16afd6['attributes'][_0xb8a4('0x55')]?_0x16afd6['attributes']:_0x510535[_0xb8a4('0x43')];if(!_0xaeb9b3[_0xb8a4('0x4a')]['hasOwnProperty']('nolimit')){_0x16afd6[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0xaeb9b3[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x16afd6[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0xaeb9b3['query'][_0xb8a4('0x30')]);}_0x16afd6[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0xaeb9b3[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x16afd6[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0xaeb9b3[_0xb8a4('0x4a')],_0x510535[_0xb8a4('0x46')]));_0x16afd6['where']['FaxAccountId']=_0x51b935['id'];if(_0xaeb9b3['query'][_0xb8a4('0x65')]){_0x16afd6[_0xb8a4('0x4f')]=_['merge'](_0x16afd6[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x16afd6['attributes'],function(_0x521201){var _0x3003ab={};_0x3003ab[_0x521201]={'$like':'%'+_0xaeb9b3[_0xb8a4('0x4a')]['filter']+'%'};return _0x3003ab;})});}_0x16afd6=_[_0xb8a4('0x57')]({},_0x16afd6,_0xaeb9b3[_0xb8a4('0x52')]);return db['CannedAnswer'][_0xb8a4('0x33')]({'where':_0x16afd6[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x4a8e9f){_0x518010['count']=_0x4a8e9f;if(_0xaeb9b3[_0xb8a4('0x4a')]['includeAll']){_0x16afd6[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0x69')][_0xb8a4('0x66')](_0x16afd6);})[_0xb8a4('0x21')](function(_0x20e8c5){_0x518010['rows']=_0x20e8c5;return _0x518010;});}})['then'](respondWithFilteredResult(_0x3b32aa,_0x16afd6))[_0xb8a4('0x2c')](handleError(_0x3b32aa,null));};exports['removeAnswers']=function(_0x569002,_0x1e5366,_0x485bae){return db[_0xb8a4('0x3f')]['find']({'where':{'id':_0x569002[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x1e5366,null))['then'](function(_0x2ab562){if(_0x2ab562){return _0x2ab562[_0xb8a4('0x6c')](_0x569002[_0xb8a4('0x4a')][_0xb8a4('0x6d')]);}})[_0xb8a4('0x21')](respondWithStatusCode(_0x1e5366,null))[_0xb8a4('0x2c')](handleError(_0x1e5366,null));};exports[_0xb8a4('0x6e')]=function(_0x5b939b,_0x1c8107,_0x10b8ff){return db[_0xb8a4('0x6f')][_0xb8a4('0x58')]({'where':{'id':_0x5b939b[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x1c8107,null))['then'](function(_0x572a68){if(_0x572a68){return _0x572a68[_0xb8a4('0x6e')](_0x5b939b[_0xb8a4('0x5a')]['ids'],_[_0xb8a4('0x70')](_0x5b939b['body'],[_0xb8a4('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x1c8107,null))[_0xb8a4('0x2c')](handleError(_0x1c8107,null));};exports['getInteractions']=function(_0x7c08d3,_0x17adde,_0x257f5a){var _0x671aaf={'raw':![],'where':{}};var _0xb118f4={};var _0x369899={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x7c08d3[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x17adde,null))[_0xb8a4('0x21')](function(_0x2f5f3b){if(_0x2f5f3b){_0xb118f4[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x6f')][_0xb8a4('0x40')]);_0xb118f4[_0xb8a4('0x4a')]=_['keys'](_0x7c08d3[_0xb8a4('0x4a')]);_0xb118f4[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0xb118f4[_0xb8a4('0x43')],_0xb118f4[_0xb8a4('0x4a')]);_0x671aaf[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0xb118f4[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x671aaf['attributes']=_0x671aaf[_0xb8a4('0x47')]['length']?_0x671aaf['attributes']:_0xb118f4[_0xb8a4('0x43')];if(!_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x4b')](_0xb8a4('0x4c'))){_0x671aaf[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x671aaf['offset']=qs[_0xb8a4('0x30')](_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x671aaf['order']=qs[_0xb8a4('0x4e')](_0x7c08d3['query'][_0xb8a4('0x4e')]);_0x671aaf['where']=qs[_0xb8a4('0x46')](_['pick'](_0x7c08d3[_0xb8a4('0x4a')],_0xb118f4[_0xb8a4('0x46')]));_0x671aaf['where']['FaxAccountId']=_0x2f5f3b['id'];if(_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x671aaf[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x671aaf[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x671aaf[_0xb8a4('0x47')],function(_0x31b313){var _0x319542={};_0x319542[_0x31b313]={'$like':'%'+_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x319542;})});}_0x671aaf=_[_0xb8a4('0x57')]({},_0x671aaf,_0x7c08d3[_0xb8a4('0x52')]);return db[_0xb8a4('0x6f')][_0xb8a4('0x33')]({'where':_0x671aaf[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x55518f){_0x369899[_0xb8a4('0x33')]=_0x55518f;if(_0x7c08d3['query']['includeAll']){_0x671aaf['include']=[{'model':db[_0xb8a4('0x71')],'as':_0xb8a4('0x72'),'required':![]},{'model':db[_0xb8a4('0x73')],'as':_0xb8a4('0x74'),'attributes':['name',_0xb8a4('0x75'),_0xb8a4('0x76')],'required':![]},{'model':db[_0xb8a4('0x77')],'as':_0xb8a4('0x78'),'attributes':['id',_0xb8a4('0x3b'),'color'],'where':_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x79')]?{'id':_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x79')]}:undefined,'required':_0x7c08d3[_0xb8a4('0x4a')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xb8a4('0x66')](_0x671aaf);})[_0xb8a4('0x21')](function(_0x1eee7e){_0x369899['rows']=_0x1eee7e;return _0x369899;});}})['then'](respondWithFilteredResult(_0x17adde,_0x671aaf))[_0xb8a4('0x2c')](handleError(_0x17adde,null));};exports['addApplications']=function(_0x56edea,_0x188005){var _0x37af88=_0x56edea[_0xb8a4('0x5f')]['id'];var _0x345c87=_0x56edea['body'];var _0x5c7fda=0xc8;var _0x230615=null;return db[_0xb8a4('0x7a')]['transaction']({'isolationLevel':db[_0xb8a4('0x7a')][_0xb8a4('0x7b')][_0xb8a4('0x7c')][_0xb8a4('0x7d')]},function(_0x1cb760){return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x37af88},'transaction':_0x1cb760})['then'](function(_0x4de0bb){if(_0x4de0bb){return db['FaxApplication'][_0xb8a4('0x39')]({'where':{'FaxAccountId':_0x37af88},'transaction':_0x1cb760})['then'](function(){var _0x1c1b09=_['map'](_0x345c87,function(_0x492eac){_0x492eac['FaxAccountId']=_0x37af88;return _0x492eac;});return db['FaxApplication'][_0xb8a4('0x7e')](_0x1c1b09,{'transaction':_0x1cb760});});}else{_0x5c7fda=0x194;_0x230615=[];}});})[_0xb8a4('0x21')](function(){if(_0x5c7fda!==0x194){return db[_0xb8a4('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x37af88},'order':_0xb8a4('0x80')})[_0xb8a4('0x21')](function(_0x5ca4d0){_0x230615=_0x5ca4d0;});}})['catch'](function(_0x5ad668){_0x5c7fda=0x1f4;logger[_0xb8a4('0x27')](_0x5ad668[_0xb8a4('0x3a')]);if(_0x5ad668[_0xb8a4('0x3b')]){delete _0x5ad668[_0xb8a4('0x3b')];}_0x230615=_0x5ad668;})[_0xb8a4('0x81')](function(){if(_0x230615===null){_0x188005[_0xb8a4('0x82')](_0x5c7fda);}else{if(_0x5c7fda===0x1f4){_0x188005['status'](_0x5c7fda)[_0xb8a4('0x3c')](_0x230615);}else{_0x188005['status'](_0x5c7fda)[_0xb8a4('0x2f')](_0x230615);}}});};exports[_0xb8a4('0x83')]=function(_0x32c54d,_0x4c93a5,_0x961813){var _0x3d0de5={};var _0x5f4bb9={};var _0xe427ad;var _0x46ca32;return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x32c54d[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x4c93a5,null))[_0xb8a4('0x21')](function(_0x17fb27){if(_0x17fb27){_0xe427ad=_0x17fb27;_0x5f4bb9[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x7f')][_0xb8a4('0x40')]);_0x5f4bb9[_0xb8a4('0x4a')]=_['keys'](_0x32c54d[_0xb8a4('0x4a')]);_0x5f4bb9[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x5f4bb9[_0xb8a4('0x43')],_0x5f4bb9[_0xb8a4('0x4a')]);_0x3d0de5[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x5f4bb9[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x32c54d[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x3d0de5[_0xb8a4('0x47')]=_0x3d0de5[_0xb8a4('0x47')]['length']?_0x3d0de5[_0xb8a4('0x47')]:_0x5f4bb9[_0xb8a4('0x43')];_0x3d0de5[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x32c54d['query'][_0xb8a4('0x4e')]);_0x3d0de5[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x32c54d['query'],_0x5f4bb9[_0xb8a4('0x46')]));if(_0x32c54d['query'][_0xb8a4('0x65')]){_0x3d0de5[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x3d0de5['where'],{'$or':_['map'](_0x3d0de5[_0xb8a4('0x47')],function(_0x2560b0){var _0x5f29fc={};_0x5f29fc[_0x2560b0]={'$like':'%'+_0x32c54d[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x5f29fc;})});}_0x3d0de5=_[_0xb8a4('0x57')]({},_0x3d0de5,_0x32c54d[_0xb8a4('0x52')]);return _0xe427ad['getApplications'](_0x3d0de5);}})[_0xb8a4('0x21')](function(_0xfd01e7){if(_0xfd01e7){_0x46ca32=_0xfd01e7[_0xb8a4('0x55')];if(!_0x32c54d[_0xb8a4('0x4a')]['hasOwnProperty'](_0xb8a4('0x4c'))){_0x3d0de5[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x32c54d[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x3d0de5[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x32c54d[_0xb8a4('0x4a')]['offset']);}return _0xe427ad['getApplications'](_0x3d0de5);}})[_0xb8a4('0x21')](function(_0x155dd8){if(_0x155dd8){return _0x155dd8?{'count':_0x46ca32,'rows':_0x155dd8}:null;}})[_0xb8a4('0x21')](respondWithResult(_0x4c93a5,null))['catch'](handleError(_0x4c93a5,null));};function Extension(_0x2b9728,_0x3ac77d,_0x28b670,_0x5a1245){this[_0xb8a4('0x84')]=_0xb8a4('0x85');this[_0xb8a4('0x86')]=_0x2b9728['localstationid'];this[_0xb8a4('0x87')]=_0x5a1245;this[_0xb8a4('0x41')]=_0xb8a4('0x88');this[_0xb8a4('0x89')]=_0xb8a4('0x8a');this[_0xb8a4('0x62')]=_0x2b9728['id'];this[_0xb8a4('0x80')]=_0x3ac77d;this[_0xb8a4('0x8b')]=_0x28b670;}function createExtensionsReciveFax(_0x5e2cec){var _0x5f5ccc=0x1;var _0x571886=[];_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,'',_0xb8a4('0x8d')));_0x5f5ccc+=0x1;_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,_0xb8a4('0x8e'),_0xb8a4('0x8f')));_0x5f5ccc+=0x1;for(var _0x54d259 in _0x5e2cec){if(_0x5e2cec[_0xb8a4('0x4b')](_0x54d259)&&(_0x54d259===_0xb8a4('0x90')||_0x54d259===_0xb8a4('0x91')||_0x54d259===_0xb8a4('0x92')||_0x54d259==='faxdetect'||_0x54d259===_0xb8a4('0x93')||_0x54d259===_0xb8a4('0x94')||_0x54d259===_0xb8a4('0x95')||_0x54d259==='modem'||_0x54d259==='t38timeout')){_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,_0xb8a4('0x96')+_0x54d259+')='+_0x5e2cec[_0x54d259],_0xb8a4('0x8f')));_0x5f5ccc+=0x1;}}_0x571886['push'](new Extension(_0x5e2cec,_0x5f5ccc,'6',_0xb8a4('0x97')));_0x5f5ccc+=0x1;_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,_0xb8a4('0x98'),_0xb8a4('0x99')));_0x5f5ccc=0x0;return _0x571886;}exports[_0xb8a4('0x9a')]=function(_0xfa0eeb,_0x4c6201,_0x483262){var _0x4f74a1;return db[_0xb8a4('0x7a')][_0xb8a4('0x9b')](function(_0x5c54ef){return db[_0xb8a4('0x3f')]['create'](_0xfa0eeb['body'],{'transaction':_0x5c54ef})[_0xb8a4('0x21')](function(_0x3ebd0a){_0x4f74a1=_0x3ebd0a[_0xb8a4('0x9c')]({'plain':!![]});return db[_0xb8a4('0x9d')][_0xb8a4('0x7e')](createExtensionsReciveFax(_0x4f74a1),{'transaction':_0x5c54ef});});})[_0xb8a4('0x21')](function(){return _0x4f74a1;})[_0xb8a4('0x21')](respondWithResult(_0x4c6201,null))[_0xb8a4('0x2c')](handleError(_0x4c6201,null));};exports[_0xb8a4('0x9e')]=function(_0x4ae715,_0x9f8dd6,_0x1e6f23){var _0x58141c;return db['sequelize'][_0xb8a4('0x9b')](function(_0x26ba86){return db[_0xb8a4('0x3f')][_0xb8a4('0x37')](_0x4ae715[_0xb8a4('0x5a')],{'where':{'id':_0x4ae715['body']['id']},'transaction':_0x26ba86})[_0xb8a4('0x21')](function(_0x153ead){return db[_0xb8a4('0x9d')]['destroy']({'where':{'FaxAccountId':_0x4ae715[_0xb8a4('0x5a')]['id']},'transaction':_0x26ba86})[_0xb8a4('0x21')](function(_0x248f35){return db[_0xb8a4('0x9d')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x4ae715[_0xb8a4('0x5a')],[_0xb8a4('0x9f'),_0xb8a4('0x42'),_0xb8a4('0xa0'),_0xb8a4('0xa1'),'TrunkId',_0xb8a4('0xa2')])),{'transaction':_0x26ba86});});});})[_0xb8a4('0x21')](function(){return db[_0xb8a4('0x3f')][_0xb8a4('0xa3')](_0x4ae715[_0xb8a4('0x5a')]['id']);})[_0xb8a4('0x21')](respondWithResult(_0x9f8dd6,null))[_0xb8a4('0x2c')](handleError(_0x9f8dd6,null));};exports[_0xb8a4('0xa4')]=function(_0x4cbde6,_0x59e7a0,_0x54107c){var _0x57f4ad={'raw':!![],'where':{}};var _0x25de87={};var _0x16240d={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')][_0xb8a4('0x6b')]({'where':{'id':_0x4cbde6[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x59e7a0,null))[_0xb8a4('0x21')](function(_0x131c68){if(_0x131c68){_0x25de87['model']=_['keys'](db['FaxMessage'][_0xb8a4('0x40')]);_0x25de87[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0x4cbde6[_0xb8a4('0x4a')]);_0x25de87[_0xb8a4('0x46')]=_['intersection'](_0x25de87[_0xb8a4('0x43')],_0x25de87[_0xb8a4('0x4a')]);_0x57f4ad[_0xb8a4('0x47')]=_['intersection'](_0x25de87[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x4cbde6['query'][_0xb8a4('0x49')]));_0x57f4ad[_0xb8a4('0x47')]=_0x57f4ad['attributes'][_0xb8a4('0x55')]?_0x57f4ad[_0xb8a4('0x47')]:_0x25de87[_0xb8a4('0x43')];if(!_0x4cbde6[_0xb8a4('0x4a')]['hasOwnProperty']('nolimit')){_0x57f4ad['limit']=qs[_0xb8a4('0x32')](_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x57f4ad[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x57f4ad[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x57f4ad[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x4cbde6['query'],_0x25de87['filters']));_0x57f4ad[_0xb8a4('0x4f')][_0xb8a4('0x62')]=_0x131c68['id'];if(_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x57f4ad[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x57f4ad[_0xb8a4('0x4f')],{'$or':_['map'](_0x57f4ad[_0xb8a4('0x47')],function(_0x4588d8){var _0x3ccd39={};_0x3ccd39[_0x4588d8]={'$like':'%'+_0x4cbde6['query'][_0xb8a4('0x65')]+'%'};return _0x3ccd39;})});}if(_0x4cbde6['query'][_0xb8a4('0xa5')]){var _0x31f934=_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0xa5')]['split'](',');var _0x4690dd={};_0x4690dd[_0x31f934[0x0]]={'$gte':moment(_0x31f934[0x1])['format'](_0xb8a4('0xa6'))};_0x57f4ad[_0xb8a4('0x4f')]=_['merge'](_0x57f4ad['where'],_0x4690dd);}_0x57f4ad=_[_0xb8a4('0x57')]({},_0x57f4ad,_0x4cbde6[_0xb8a4('0x52')]);return db[_0xb8a4('0xa7')]['count']({'where':_0x57f4ad[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x31b165){_0x16240d[_0xb8a4('0x33')]=_0x31b165;if(_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x56')]){_0x57f4ad[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0xa7')][_0xb8a4('0x66')](_0x57f4ad);})[_0xb8a4('0x21')](function(_0x5f217){_0x16240d['rows']=_0x5f217;return _0x16240d;});}})[_0xb8a4('0x21')](respondWithFilteredResult(_0x59e7a0,_0x57f4ad))[_0xb8a4('0x2c')](handleError(_0x59e7a0,null));};exports[_0xb8a4('0x3c')]=function(_0x160287,_0x54b519,_0x5d2f2e){var _0x2a5276,_0x49dc8d={},_0x4c4b29;if(_0x160287['body']['to']){_0x4c4b29=_0x160287[_0xb8a4('0x5a')]['to'][0x0];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x160287[_0xb8a4('0x5f')]['id']},'include':[{'model':db[_0xb8a4('0xa8')],'as':'List','include':[{'model':db[_0xb8a4('0x71')],'as':_0xb8a4('0xa9'),'where':{'fax':_0x4c4b29},'limit':0x1,'order':[[_0xb8a4('0xa1'),_0xb8a4('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x54b519,null))[_0xb8a4('0x21')](function(_0x550183){_0x2a5276=_0x550183;if(_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')]&&_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0xb8a4('0x55')]){for(var _0x36cb2e=0x0;_0x36cb2e<_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0xb8a4('0x55')];_0x36cb2e+=0x1){_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e]={'filename':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e][_0xb8a4('0x3b')],'id':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e]['id'],'path':path[_0xb8a4('0xac')](config['root'],_0xb8a4('0xad'),_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e][_0xb8a4('0xae')])};}}return respondWithRpcPromise(_0xb8a4('0xaf'),'CheckAfterSend',{'FaxAccountId':_[_0xb8a4('0xb0')](_0x160287[_0xb8a4('0x5f')]['id'])?undefined:_0x160287['params']['id'],'path':_[_0xb8a4('0xb0')](_0x160287['body']['attachments'][0x0]['path'])?undefined:_0x160287['body'][_0xb8a4('0xab')][0x0][_0xb8a4('0x8')],'fax':_[_0xb8a4('0xb0')](_0x160287[_0xb8a4('0x5a')]['to'][0x0])?undefined:_0x160287[_0xb8a4('0x5a')]['to'][0x0]},client9002);})[_0xb8a4('0x21')](function(){if(_0x2a5276){if(_[_0xb8a4('0xb0')](_0x160287['body'][_0xb8a4('0xb1')])){_0x160287[_0xb8a4('0x5a')]['from']=util[_0xb8a4('0xb2')](_0xb8a4('0xb3'),_0x2a5276['name'],_0x2a5276['fax']);}if(_0x2a5276[_0xb8a4('0xb4')]){if(_0x2a5276[_0xb8a4('0xb4')]['Contacts']['length']){return _0x2a5276['List'][_0xb8a4('0xa9')][0x0];}else{return db['CmContact'][_0xb8a4('0x59')](_['defaults'](_0x160287['body'],{'firstName':_0x160287[_0xb8a4('0x5a')]['to'][0x0],'phone':_0x160287[_0xb8a4('0x5a')]['to'][0x0],'fax':_0x160287[_0xb8a4('0x5a')]['to'][0x0],'ListId':_0x2a5276[_0xb8a4('0xa2')]}));}}else{throw new Error(_0xb8a4('0xb5'));}}else{throw new Error(_0xb8a4('0xb6'));}})['then'](function(_0x28c4e3){if(_0x28c4e3){return db['FaxInteraction'][_0xb8a4('0x58')]({'where':{'ContactId':_0x28c4e3['id'],'closed':![],'FaxAccountId':_0x2a5276['id']}})[_0xb8a4('0x21')](function(_0x45663b){if(_0x45663b){return[_0x45663b,![]];}return db[_0xb8a4('0x6f')][_0xb8a4('0x59')]({'UserId':_0x160287[_0xb8a4('0x5b')]['id'],'ContactId':_0x28c4e3['id'],'FaxAccountId':_0x2a5276['id'],'fax':_0x160287['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x160287[_0xb8a4('0x5a')],{'read':![],'body':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][0x0]['filename'],'FaxAccountId':_0x2a5276['id'],'UserId':_0x160287[_0xb8a4('0x5b')]['id'],'ContactId':_0x28c4e3['id'],'AttachmentId':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xb8a4('0xa7')],'as':_0xb8a4('0xb7')}]})[_0xb8a4('0x21')](function(_0x293b69){return[_0x293b69,!![]];});});}else{throw new Error(_0xb8a4('0xb8'));}})[_0xb8a4('0xb9')](function(_0x1de8f2,_0x388096){if(_0x388096){return _0x1de8f2;}return db['FaxMessage'][_0xb8a4('0x59')]({'direction':_0xb8a4('0xba'),'read':![],'body':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][0x0][_0xb8a4('0xbb')],'FaxAccountId':_0x2a5276['id'],'FaxInteractionId':_0x1de8f2['id'],'UserId':_0x160287['user']['id'],'ContactId':_0x1de8f2[_0xb8a4('0xbc')],'AttachmentId':_0x160287[_0xb8a4('0x5a')]['attachments'][0x0]['id']})[_0xb8a4('0x21')](function(_0xacc11b){_0x1de8f2[_0xb8a4('0xbd')]['Messages']=[];_0x1de8f2[_0xb8a4('0xbd')][_0xb8a4('0xb7')][_0xb8a4('0x8c')](_0xacc11b[_0xb8a4('0xbd')]);return _0x1de8f2;});})[_0xb8a4('0x21')](function(_0x3f1aaa){respondWithRpcPromise('SendFax',_0xb8a4('0xbe'),{'FaxAccountId':_[_0xb8a4('0xb0')](_0x160287['params']['id'])?undefined:_0x160287[_0xb8a4('0x5f')]['id'],'path':_[_0xb8a4('0xb0')](_0x160287['body'][_0xb8a4('0xab')][0x0][_0xb8a4('0x8')])?undefined:_0x160287[_0xb8a4('0x5a')]['attachments'][0x0][_0xb8a4('0x8')],'fax':_[_0xb8a4('0xb0')](_0x160287[_0xb8a4('0x5a')]['to'][0x0])?undefined:_0x160287['body']['to'][0x0],'AttachmentId':_0x160287[_0xb8a4('0x5a')]['attachments'][0x0]['id']},client9002)[_0xb8a4('0x21')](function(_0x3ada33){logger['info'](_0xb8a4('0xbf'),_0x3ada33);})[_0xb8a4('0x2c')](function(_0x5135e6){logger[_0xb8a4('0x2a')]('SendFaxRpc,\x20%s',_0x5135e6);});return _0x3f1aaa;})[_0xb8a4('0x21')](respondWithResult(_0x54b519,null))[_0xb8a4('0x2c')](handleError(_0x54b519,null));};exports['addAgents']=function(_0x4a76d1,_0x3c1c94,_0x47015c){return db['FaxAccount'][_0xb8a4('0x58')]({'where':{'id':_0x4a76d1['params']['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x3c1c94,null))[_0xb8a4('0x21')](function(_0x208444){if(_0x208444){return _0x208444[_0xb8a4('0xc0')](_0x4a76d1['body'][_0xb8a4('0x6d')],_[_0xb8a4('0x70')](_0x4a76d1['body'],[_0xb8a4('0x6d'),'id'])||{})[_0xb8a4('0xb9')](function(_0x375b2c){for(var _0x57569d=0x0;_0x57569d<_0x4a76d1[_0xb8a4('0x5a')][_0xb8a4('0x6d')][_0xb8a4('0x55')];_0x57569d+=0x1){socket['emit'](_0xb8a4('0xc1'),{'UserId':Number(_0x4a76d1['body'][_0xb8a4('0x6d')][_0x57569d]),'FaxAccountId':Number(_0x4a76d1[_0xb8a4('0x5f')]['id'])});}return _0x375b2c;});}})['then'](respondWithResult(_0x3c1c94,null))[_0xb8a4('0x2c')](handleError(_0x3c1c94,null));};exports[_0xb8a4('0xc2')]=function(_0x3288f6,_0x4a31b5,_0x38284e){return db['FaxAccount']['find']({'where':{'id':_0x3288f6[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x4a31b5,null))[_0xb8a4('0x21')](function(_0x41dafc){if(_0x41dafc){return _0x41dafc[_0xb8a4('0xc2')](_0x3288f6[_0xb8a4('0x4a')][_0xb8a4('0x6d')])[_0xb8a4('0x21')](function(){if(_[_0xb8a4('0xc3')](_0x3288f6['query'][_0xb8a4('0x6d')])){for(var _0x4e3f01=0x0;_0x4e3f01<_0x3288f6[_0xb8a4('0x4a')]['ids']['length'];_0x4e3f01+=0x1){socket['emit'](_0xb8a4('0xc4'),{'UserId':Number(_0x3288f6[_0xb8a4('0x4a')][_0xb8a4('0x6d')][_0x4e3f01]),'FaxAccountId':Number(_0x3288f6['params']['id'])});}}else{socket[_0xb8a4('0xc5')](_0xb8a4('0xc4'),{'UserId':Number(_0x3288f6[_0xb8a4('0x4a')][_0xb8a4('0x6d')]),'FaxAccountId':Number(_0x3288f6[_0xb8a4('0x5f')]['id'])});}});}})[_0xb8a4('0x21')](respondWithStatusCode(_0x4a31b5,null))['catch'](handleError(_0x4a31b5,null));};exports[_0xb8a4('0xc6')]=function(_0x4d14cc,_0x56aabe,_0x2dd944){var _0x4f5a0e={};var _0x3699b2={};var _0x2d3094;var _0x5d7a72;return db[_0xb8a4('0x3f')][_0xb8a4('0x6b')]({'where':{'id':_0x4d14cc[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x56aabe,null))[_0xb8a4('0x21')](function(_0x5d006b){if(_0x5d006b){_0x2d3094=_0x5d006b;_0x3699b2[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db['User'][_0xb8a4('0x40')]);_0x3699b2[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0x4d14cc[_0xb8a4('0x4a')]);_0x3699b2[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x3699b2[_0xb8a4('0x43')],_0x3699b2['query']);_0x4f5a0e[_0xb8a4('0x47')]=_['intersection'](_0x3699b2[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x4d14cc[_0xb8a4('0x4a')]['fields']));_0x4f5a0e['attributes']=_0x4f5a0e['attributes'][_0xb8a4('0x55')]?_0x4f5a0e[_0xb8a4('0x47')]:_0x3699b2[_0xb8a4('0x43')];_0x4f5a0e[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x4d14cc[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x4f5a0e[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x4d14cc[_0xb8a4('0x4a')],_0x3699b2[_0xb8a4('0x46')]));if(_0x4d14cc[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x4f5a0e[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x4f5a0e[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x4f5a0e[_0xb8a4('0x47')],function(_0x56c4fd){var _0x9c79ab={};_0x9c79ab[_0x56c4fd]={'$like':'%'+_0x4d14cc[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x9c79ab;})});}_0x4f5a0e=_[_0xb8a4('0x57')]({},_0x4f5a0e,_0x4d14cc[_0xb8a4('0x52')]);return _0x2d3094[_0xb8a4('0xc6')](_0x4f5a0e);}})[_0xb8a4('0x21')](function(_0x5f0526){if(_0x5f0526){_0x5d7a72=_0x5f0526[_0xb8a4('0x55')];if(!_0x4d14cc['query'][_0xb8a4('0x4b')](_0xb8a4('0x4c'))){_0x4f5a0e[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x4d14cc['query'][_0xb8a4('0x32')]);_0x4f5a0e[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x4d14cc[_0xb8a4('0x4a')]['offset']);}return _0x2d3094[_0xb8a4('0xc6')](_0x4f5a0e);}})['then'](function(_0x2bf7f7){if(_0x2bf7f7){return _0x2bf7f7?{'count':_0x5d7a72,'rows':_0x2bf7f7}:null;}})[_0xb8a4('0x21')](respondWithResult(_0x56aabe,null))[_0xb8a4('0x2c')](handleError(_0x56aabe,null));}; \ No newline at end of file +var _0x9631=['Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','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','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','isNil','from','fax','defaults','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','FaxAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','FaxAccount','type','key','model','map','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','show','params','rawAttributes','length','includeAll','include','options','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','findOne','rows','removeDispositions','CannedAnswer','getAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push'];(function(_0x3f4bfb,_0x17f774){var _0x3475c2=function(_0x2a37ff){while(--_0x2a37ff){_0x3f4bfb['push'](_0x3f4bfb['shift']());}};_0x3475c2(++_0x17f774);}(_0x9631,0x1c2));var _0x1963=function(_0x494fa2,_0x84b5d8){_0x494fa2=_0x494fa2-0x0;var _0xf013c7=_0x9631[_0x494fa2];return _0xf013c7;};'use strict';var emlformat=require(_0x1963('0x0'));var rimraf=require(_0x1963('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1963('0x2'));var rp=require(_0x1963('0x3'));var moment=require(_0x1963('0x4'));var BPromise=require(_0x1963('0x5'));var Mustache=require(_0x1963('0x6'));var util=require(_0x1963('0x7'));var path=require(_0x1963('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1963('0x9'));var _=require(_0x1963('0xa'));var squel=require(_0x1963('0xb'));var crypto=require('crypto');var jsforce=require(_0x1963('0xc'));var deskjs=require(_0x1963('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1963('0xe'));var Papa=require(_0x1963('0xf'));var Redis=require('ioredis');var authService=require(_0x1963('0x10'));var qs=require(_0x1963('0x11'));var as=require(_0x1963('0x12'));var hardwareService=require(_0x1963('0x13'));var logger=require('../../config/logger')(_0x1963('0x14'));var utils=require(_0x1963('0x15'));var config=require(_0x1963('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1963('0x17')]=_['defaults'](config['redis'],{'host':_0x1963('0x18'),'port':0x18eb});var socket=require(_0x1963('0x19'))(new Redis(config[_0x1963('0x17')]));require(_0x1963('0x1a'))['register'](socket);var jayson=require(_0x1963('0x1b'));var client=jayson[_0x1963('0x1c')][_0x1963('0x1d')]({'port':0x232c});var client9002=jayson[_0x1963('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd269a0,_0x561176,_0x12e331,_0x3a0923){return new BPromise(function(_0x4527dd,_0x49c200){var _0x54ac1a=_0x3a0923||client;return _0x54ac1a[_0x1963('0x1e')](_0xd269a0,_0x12e331)['then'](function(_0x7af6c3){logger['info']('FaxAccount,\x20%s,\x20%s',_0x561176,_0x1963('0x1f'));logger[_0x1963('0x20')](_0x1963('0x21'),_0x561176,_0x1963('0x1f'),JSON['stringify'](_0x7af6c3));if(_0x7af6c3['error']){if(_0x7af6c3[_0x1963('0x22')][_0x1963('0x23')]===0x1f4){logger[_0x1963('0x22')](_0x1963('0x24'),_0x561176,_0x7af6c3[_0x1963('0x22')][_0x1963('0x25')]);return _0x49c200(_0x7af6c3['error'][_0x1963('0x25')]);}logger[_0x1963('0x22')](_0x1963('0x24'),_0x561176,_0x7af6c3[_0x1963('0x22')][_0x1963('0x25')]);return _0x4527dd(_0x7af6c3['error'][_0x1963('0x25')]);}else{logger[_0x1963('0x26')]('FaxAccount,\x20%s,\x20%s',_0x561176,_0x1963('0x1f'));_0x4527dd(_0x7af6c3[_0x1963('0x27')][_0x1963('0x25')]);}})[_0x1963('0x28')](function(_0x4d527e){logger[_0x1963('0x22')](_0x1963('0x24'),_0x561176,_0x4d527e);_0x49c200(_0x4d527e);});});}function respondWithStatusCode(_0x5b2fd8,_0x4cd21f){_0x4cd21f=_0x4cd21f||0xcc;return function(_0x1307af){if(_0x1307af){return _0x5b2fd8[_0x1963('0x29')](_0x4cd21f);}return _0x5b2fd8[_0x1963('0x2a')](_0x4cd21f)[_0x1963('0x2b')]();};}function respondWithResult(_0xeed797,_0x3e643f){_0x3e643f=_0x3e643f||0xc8;return function(_0x2e6cc){if(_0x2e6cc){return _0xeed797['status'](_0x3e643f)[_0x1963('0x2c')](_0x2e6cc);}};}function respondWithFilteredResult(_0x105054,_0x36642b){return function(_0x41b408){if(_0x41b408){var _0x34d84f=typeof _0x36642b[_0x1963('0x2d')]===_0x1963('0x2e')&&typeof _0x36642b[_0x1963('0x2f')]==='undefined';var _0x27733d=_0x41b408[_0x1963('0x30')];var _0x2a610e=_0x34d84f?0x0:_0x36642b[_0x1963('0x2d')];var _0x3cb849=_0x34d84f?_0x41b408[_0x1963('0x30')]:_0x36642b[_0x1963('0x2d')]+_0x36642b[_0x1963('0x2f')];var _0x3bb5d3;if(_0x3cb849>=_0x27733d){_0x3cb849=_0x27733d;_0x3bb5d3=0xc8;}else{_0x3bb5d3=0xce;}_0x105054['status'](_0x3bb5d3);return _0x105054[_0x1963('0x31')]('Content-Range',_0x2a610e+'-'+_0x3cb849+'/'+_0x27733d)['json'](_0x41b408);}return null;};}function patchUpdates(_0x497678){return function(_0xb84753){try{jsonpatch[_0x1963('0x32')](_0xb84753,_0x497678,!![]);}catch(_0x17bae0){return BPromise[_0x1963('0x33')](_0x17bae0);}return _0xb84753['save']();};}function saveUpdates(_0x5de1fe,_0x3d460a){return function(_0x5516df){if(_0x5516df){return _0x5516df[_0x1963('0x34')](_0x5de1fe)['then'](function(_0x3ebdc0){return _0x3ebdc0;});}return null;};}function removeEntity(_0x1b4e8c,_0x18441b){return function(_0x21c778){if(_0x21c778){return _0x21c778['destroy']()[_0x1963('0x35')](function(){var _0x4b51a8=_0x21c778[_0x1963('0x36')]({'plain':!![]});var _0x1dafd6=_0x1963('0x37');return db[_0x1963('0x38')][_0x1963('0x39')]({'where':{'type':_0x1dafd6,'resourceId':_0x4b51a8['id']}})[_0x1963('0x35')](function(){return _0x21c778;});})[_0x1963('0x35')](function(){_0x1b4e8c[_0x1963('0x2a')](0xcc)[_0x1963('0x2b')]();});}};}function handleEntityNotFound(_0x456968,_0x1e7ee2){return function(_0xb8bb6a){if(!_0xb8bb6a){_0x456968['sendStatus'](0x194);}return _0xb8bb6a;};}function handleError(_0x27a348,_0x56a412){_0x56a412=_0x56a412||0x1f4;return function(_0x355c93){logger[_0x1963('0x22')](_0x355c93['stack']);if(_0x355c93[_0x1963('0x3a')]){delete _0x355c93[_0x1963('0x3a')];}_0x27a348[_0x1963('0x2a')](_0x56a412)[_0x1963('0x3b')](_0x355c93);};}exports['index']=function(_0xac6de3,_0x566e26){var _0x34826c={'include':[{'model':db[_0x1963('0x3c')],'as':_0x1963('0x3d')}]},_0x202c73={},_0x34c490={'count':0x0,'rows':[]};var _0x428723=_['map'](db[_0x1963('0x3e')]['rawAttributes'],function(_0x4558b1){return{'name':_0x4558b1['fieldName'],'type':_0x4558b1[_0x1963('0x3f')][_0x1963('0x40')]};});_0x202c73[_0x1963('0x41')]=_[_0x1963('0x42')](_0x428723,_0x1963('0x3a'));_0x202c73['query']=_[_0x1963('0x43')](_0xac6de3['query']);_0x202c73[_0x1963('0x44')]=_['intersection'](_0x202c73[_0x1963('0x41')],_0x202c73['query']);_0x34826c[_0x1963('0x45')]=_[_0x1963('0x46')](_0x202c73[_0x1963('0x41')],qs[_0x1963('0x47')](_0xac6de3['query'][_0x1963('0x47')]));_0x34826c[_0x1963('0x45')]=_0x34826c[_0x1963('0x45')]['length']?_0x34826c[_0x1963('0x45')]:_0x202c73[_0x1963('0x41')];if(!_0xac6de3[_0x1963('0x48')][_0x1963('0x49')](_0x1963('0x4a'))){_0x34826c[_0x1963('0x2f')]=qs[_0x1963('0x2f')](_0xac6de3['query'][_0x1963('0x2f')]);_0x34826c[_0x1963('0x2d')]=qs[_0x1963('0x2d')](_0xac6de3[_0x1963('0x48')][_0x1963('0x2d')]);}_0x34826c[_0x1963('0x4b')]=qs[_0x1963('0x4c')](_0xac6de3[_0x1963('0x48')]['sort']);_0x34826c[_0x1963('0x4d')]=qs['filters'](_[_0x1963('0x4e')](_0xac6de3[_0x1963('0x48')],_0x202c73[_0x1963('0x44')]),_0x428723);if(_0xac6de3[_0x1963('0x48')][_0x1963('0x4f')]){_0x34826c[_0x1963('0x4d')]=_[_0x1963('0x50')](_0x34826c['where'],{'$or':_[_0x1963('0x42')](_0x428723,function(_0x1c1bb3){if(_0x1c1bb3['type']!==_0x1963('0x51')){var _0x511b9e={};_0x511b9e[_0x1c1bb3[_0x1963('0x3a')]]={'$like':'%'+_0xac6de3[_0x1963('0x48')][_0x1963('0x4f')]+'%'};return _0x511b9e;}})});}_0x34826c=_[_0x1963('0x50')]({},_0x34826c,_0xac6de3['options']);var _0x2ae134={'where':_0x34826c['where']};return db[_0x1963('0x3e')][_0x1963('0x30')](_0x2ae134)['then'](function(_0x1135d5){_0x34c490[_0x1963('0x30')]=_0x1135d5;if(_0xac6de3[_0x1963('0x48')]['includeAll']){_0x34826c['include']=[{'all':!![]}];}return db[_0x1963('0x3e')][_0x1963('0x52')](_0x34826c);})[_0x1963('0x35')](function(_0x52a0d2){_0x34c490['rows']=_0x52a0d2;return _0x34c490;})[_0x1963('0x35')](respondWithFilteredResult(_0x566e26,_0x34826c))[_0x1963('0x28')](handleError(_0x566e26,null));};exports[_0x1963('0x53')]=function(_0x11e6bc,_0x21f952){var _0x5874d7={'raw':![],'where':{'id':_0x11e6bc[_0x1963('0x54')]['id']},'include':[{'model':db[_0x1963('0x3c')],'as':_0x1963('0x3d')}]},_0x481456={};_0x481456[_0x1963('0x41')]=_[_0x1963('0x43')](db['FaxAccount'][_0x1963('0x55')]);_0x481456[_0x1963('0x48')]=_[_0x1963('0x43')](_0x11e6bc[_0x1963('0x48')]);_0x481456['filters']=_[_0x1963('0x46')](_0x481456[_0x1963('0x41')],_0x481456[_0x1963('0x48')]);_0x5874d7[_0x1963('0x45')]=_[_0x1963('0x46')](_0x481456[_0x1963('0x41')],qs['fields'](_0x11e6bc[_0x1963('0x48')][_0x1963('0x47')]));_0x5874d7[_0x1963('0x45')]=_0x5874d7[_0x1963('0x45')][_0x1963('0x56')]?_0x5874d7['attributes']:_0x481456[_0x1963('0x41')];if(_0x11e6bc[_0x1963('0x48')][_0x1963('0x57')]){_0x5874d7[_0x1963('0x58')]=[{'all':!![]}];}_0x5874d7=_[_0x1963('0x50')]({},_0x5874d7,_0x11e6bc[_0x1963('0x59')]);return db[_0x1963('0x3e')][_0x1963('0x5a')](_0x5874d7)[_0x1963('0x35')](handleEntityNotFound(_0x21f952,null))[_0x1963('0x35')](respondWithResult(_0x21f952,null))[_0x1963('0x28')](handleError(_0x21f952,null));};exports[_0x1963('0x5b')]=function(_0x3d4efd,_0xd6f64){return db[_0x1963('0x3e')]['create'](_0x3d4efd[_0x1963('0x5c')],{})['then'](function(_0x327572){var _0x444cee=_0x3d4efd[_0x1963('0x5d')][_0x1963('0x36')]({'plain':!![]});if(!_0x444cee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x444cee[_0x1963('0x5e')]===_0x1963('0x5d')){var _0x30c199=_0x327572[_0x1963('0x36')]({'plain':!![]});var _0x3c7d97=_0x1963('0x37');return db[_0x1963('0x5f')][_0x1963('0x5a')]({'where':{'name':_0x3c7d97,'userProfileId':_0x444cee[_0x1963('0x60')]},'raw':!![]})[_0x1963('0x35')](function(_0x514cf0){if(_0x514cf0&&_0x514cf0['autoAssociation']===0x0){return db['UserProfileResource'][_0x1963('0x5b')]({'name':_0x30c199[_0x1963('0x3a')],'resourceId':_0x30c199['id'],'type':_0x514cf0['name'],'sectionId':_0x514cf0['id']},{})[_0x1963('0x35')](function(){return _0x327572;});}else{return _0x327572;}})[_0x1963('0x28')](function(_0x2a7e82){logger[_0x1963('0x22')](_0x1963('0x61'),_0x2a7e82);throw _0x2a7e82;});}return _0x327572;})[_0x1963('0x35')](respondWithResult(_0xd6f64,0xc9))[_0x1963('0x28')](handleError(_0xd6f64,null));};exports[_0x1963('0x34')]=function(_0x4430e1,_0xaf6e2c){if(_0x4430e1[_0x1963('0x5c')]['id']){delete _0x4430e1[_0x1963('0x5c')]['id'];}return db[_0x1963('0x3e')][_0x1963('0x5a')]({'where':{'id':_0x4430e1[_0x1963('0x54')]['id']},'include':[{'model':db[_0x1963('0x3c')],'as':_0x1963('0x3d')}]})[_0x1963('0x35')](handleEntityNotFound(_0xaf6e2c,null))[_0x1963('0x35')](saveUpdates(_0x4430e1[_0x1963('0x5c')],null))[_0x1963('0x35')](respondWithResult(_0xaf6e2c,null))[_0x1963('0x28')](handleError(_0xaf6e2c,null));};exports['destroy']=function(_0x202f99,_0x58a151){return db[_0x1963('0x3e')][_0x1963('0x5a')]({'where':{'id':_0x202f99['params']['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x58a151,null))['then'](removeEntity(_0x58a151,null))[_0x1963('0x28')](handleError(_0x58a151,null));};exports['describe']=function(_0x1bde0f,_0x35119f){return db['FaxAccount'][_0x1963('0x62')]()[_0x1963('0x35')](respondWithResult(_0x35119f,null))[_0x1963('0x28')](handleError(_0x35119f,null));};exports['addDisposition']=function(_0x47ecb0,_0x28b2ac,_0x21f7ff){if(_0x47ecb0['body']['id']){delete _0x47ecb0[_0x1963('0x5c')]['id'];}return db['FaxAccount'][_0x1963('0x5a')]({'where':{'id':_0x47ecb0[_0x1963('0x54')]['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x28b2ac,null))['then'](function(_0x1d9a52){if(_0x1d9a52){_0x47ecb0[_0x1963('0x5c')][_0x1963('0x63')]=_0x1d9a52['id'];return db[_0x1963('0x64')]['create'](_0x47ecb0[_0x1963('0x5c')]);}})[_0x1963('0x35')](respondWithResult(_0x28b2ac,null))[_0x1963('0x28')](handleError(_0x28b2ac,null));};exports['getDispositions']=function(_0x31d3e5,_0x499e49,_0x4232cf){var _0xf06964={'raw':![],'where':{}};var _0x3fed19={};var _0xcb69f8={'count':0x0,'rows':[]};return db[_0x1963('0x3e')][_0x1963('0x65')]({'where':{'id':_0x31d3e5[_0x1963('0x54')]['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x499e49,null))[_0x1963('0x35')](function(_0x35c2aa){if(_0x35c2aa){_0x3fed19[_0x1963('0x41')]=_['keys'](db['Disposition']['rawAttributes']);_0x3fed19[_0x1963('0x48')]=_['keys'](_0x31d3e5[_0x1963('0x48')]);_0x3fed19[_0x1963('0x44')]=_['intersection'](_0x3fed19[_0x1963('0x41')],_0x3fed19[_0x1963('0x48')]);_0xf06964[_0x1963('0x45')]=_[_0x1963('0x46')](_0x3fed19[_0x1963('0x41')],qs[_0x1963('0x47')](_0x31d3e5[_0x1963('0x48')][_0x1963('0x47')]));_0xf06964['attributes']=_0xf06964['attributes']['length']?_0xf06964[_0x1963('0x45')]:_0x3fed19[_0x1963('0x41')];if(!_0x31d3e5[_0x1963('0x48')][_0x1963('0x49')]('nolimit')){_0xf06964['limit']=qs['limit'](_0x31d3e5[_0x1963('0x48')][_0x1963('0x2f')]);_0xf06964[_0x1963('0x2d')]=qs['offset'](_0x31d3e5['query'][_0x1963('0x2d')]);}_0xf06964[_0x1963('0x4b')]=qs[_0x1963('0x4c')](_0x31d3e5['query'][_0x1963('0x4c')]);_0xf06964['where']=qs[_0x1963('0x44')](_[_0x1963('0x4e')](_0x31d3e5['query'],_0x3fed19[_0x1963('0x44')]));_0xf06964[_0x1963('0x4d')]['FaxAccountId']=_0x35c2aa['id'];if(_0x31d3e5[_0x1963('0x48')][_0x1963('0x4f')]){_0xf06964[_0x1963('0x4d')]=_[_0x1963('0x50')](_0xf06964[_0x1963('0x4d')],{'$or':_['map'](_0xf06964[_0x1963('0x45')],function(_0x44d5f6){var _0x2ef8c2={};_0x2ef8c2[_0x44d5f6]={'$like':'%'+_0x31d3e5[_0x1963('0x48')][_0x1963('0x4f')]+'%'};return _0x2ef8c2;})});}_0xf06964=_['merge']({},_0xf06964,_0x31d3e5[_0x1963('0x59')]);return db[_0x1963('0x64')][_0x1963('0x30')]({'where':_0xf06964[_0x1963('0x4d')]})[_0x1963('0x35')](function(_0xafec4f){_0xcb69f8[_0x1963('0x30')]=_0xafec4f;if(_0x31d3e5['query'][_0x1963('0x57')]){_0xf06964[_0x1963('0x58')]=[{'all':!![]}];}return db[_0x1963('0x64')][_0x1963('0x52')](_0xf06964);})[_0x1963('0x35')](function(_0x477ff7){_0xcb69f8[_0x1963('0x66')]=_0x477ff7;return _0xcb69f8;});}})[_0x1963('0x35')](respondWithFilteredResult(_0x499e49,_0xf06964))[_0x1963('0x28')](handleError(_0x499e49,null));};exports[_0x1963('0x67')]=function(_0x6bcb0c,_0x4db994,_0x23d59f){return db['FaxAccount'][_0x1963('0x5a')]({'where':{'id':_0x6bcb0c[_0x1963('0x54')]['id']}})['then'](handleEntityNotFound(_0x4db994,null))[_0x1963('0x35')](function(_0x343529){if(_0x343529){return _0x343529['removeDispositions'](_0x6bcb0c[_0x1963('0x48')]['ids']);}})[_0x1963('0x35')](respondWithStatusCode(_0x4db994,null))[_0x1963('0x28')](handleError(_0x4db994,null));};exports['addAnswer']=function(_0x11236a,_0x24b4e3,_0x2beea6){if(_0x11236a[_0x1963('0x5c')]['id']){delete _0x11236a[_0x1963('0x5c')]['id'];}return db[_0x1963('0x3e')][_0x1963('0x5a')]({'where':{'id':_0x11236a[_0x1963('0x54')]['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x24b4e3,null))['then'](function(_0xb6c06b){if(_0xb6c06b){_0x11236a[_0x1963('0x5c')][_0x1963('0x63')]=_0xb6c06b['id'];return db[_0x1963('0x68')][_0x1963('0x5b')](_0x11236a[_0x1963('0x5c')]);}})[_0x1963('0x35')](respondWithResult(_0x24b4e3,null))[_0x1963('0x28')](handleError(_0x24b4e3,null));};exports[_0x1963('0x69')]=function(_0x80be87,_0x4ea3d7,_0x27a62f){var _0x5262d5={'raw':![],'where':{}};var _0x3bc518={};var _0x2c9897={'count':0x0,'rows':[]};return db[_0x1963('0x3e')]['findOne']({'where':{'id':_0x80be87[_0x1963('0x54')]['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x4ea3d7,null))[_0x1963('0x35')](function(_0x138691){if(_0x138691){_0x3bc518[_0x1963('0x41')]=_['keys'](db[_0x1963('0x68')][_0x1963('0x55')]);_0x3bc518[_0x1963('0x48')]=_[_0x1963('0x43')](_0x80be87[_0x1963('0x48')]);_0x3bc518[_0x1963('0x44')]=_[_0x1963('0x46')](_0x3bc518[_0x1963('0x41')],_0x3bc518[_0x1963('0x48')]);_0x5262d5['attributes']=_[_0x1963('0x46')](_0x3bc518[_0x1963('0x41')],qs[_0x1963('0x47')](_0x80be87['query'][_0x1963('0x47')]));_0x5262d5[_0x1963('0x45')]=_0x5262d5[_0x1963('0x45')][_0x1963('0x56')]?_0x5262d5['attributes']:_0x3bc518[_0x1963('0x41')];if(!_0x80be87['query']['hasOwnProperty'](_0x1963('0x4a'))){_0x5262d5['limit']=qs['limit'](_0x80be87[_0x1963('0x48')][_0x1963('0x2f')]);_0x5262d5[_0x1963('0x2d')]=qs[_0x1963('0x2d')](_0x80be87[_0x1963('0x48')][_0x1963('0x2d')]);}_0x5262d5[_0x1963('0x4b')]=qs[_0x1963('0x4c')](_0x80be87[_0x1963('0x48')]['sort']);_0x5262d5['where']=qs[_0x1963('0x44')](_[_0x1963('0x4e')](_0x80be87[_0x1963('0x48')],_0x3bc518[_0x1963('0x44')]));_0x5262d5['where']['FaxAccountId']=_0x138691['id'];if(_0x80be87[_0x1963('0x48')][_0x1963('0x4f')]){_0x5262d5[_0x1963('0x4d')]=_[_0x1963('0x50')](_0x5262d5[_0x1963('0x4d')],{'$or':_[_0x1963('0x42')](_0x5262d5['attributes'],function(_0x46f9e1){var _0x22c52c={};_0x22c52c[_0x46f9e1]={'$like':'%'+_0x80be87[_0x1963('0x48')][_0x1963('0x4f')]+'%'};return _0x22c52c;})});}_0x5262d5=_[_0x1963('0x50')]({},_0x5262d5,_0x80be87[_0x1963('0x59')]);return db[_0x1963('0x68')][_0x1963('0x30')]({'where':_0x5262d5[_0x1963('0x4d')]})[_0x1963('0x35')](function(_0x5cb235){_0x2c9897[_0x1963('0x30')]=_0x5cb235;if(_0x80be87[_0x1963('0x48')][_0x1963('0x57')]){_0x5262d5[_0x1963('0x58')]=[{'all':!![]}];}return db[_0x1963('0x68')][_0x1963('0x52')](_0x5262d5);})[_0x1963('0x35')](function(_0x5ea315){_0x2c9897['rows']=_0x5ea315;return _0x2c9897;});}})['then'](respondWithFilteredResult(_0x4ea3d7,_0x5262d5))[_0x1963('0x28')](handleError(_0x4ea3d7,null));};exports['removeAnswers']=function(_0x2d5f4f,_0x4bc125,_0x4c7017){return db['FaxAccount'][_0x1963('0x5a')]({'where':{'id':_0x2d5f4f['params']['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x4bc125,null))[_0x1963('0x35')](function(_0x5e9b61){if(_0x5e9b61){return _0x5e9b61['removeAnswers'](_0x2d5f4f[_0x1963('0x48')][_0x1963('0x6a')]);}})['then'](respondWithStatusCode(_0x4bc125,null))[_0x1963('0x28')](handleError(_0x4bc125,null));};exports['addInteraction']=function(_0x2b309f,_0x32e5d1,_0x485739){return db[_0x1963('0x6b')][_0x1963('0x5a')]({'where':{'id':_0x2b309f[_0x1963('0x54')]['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x32e5d1,null))['then'](function(_0x21ba2f){if(_0x21ba2f){return _0x21ba2f[_0x1963('0x6c')](_0x2b309f[_0x1963('0x5c')][_0x1963('0x6a')],_[_0x1963('0x6d')](_0x2b309f[_0x1963('0x5c')],[_0x1963('0x6a'),'id'])||{});}})[_0x1963('0x35')](respondWithResult(_0x32e5d1,null))[_0x1963('0x28')](handleError(_0x32e5d1,null));};exports[_0x1963('0x6e')]=function(_0x3c7952,_0x5e66b5,_0x3fd389){var _0x272a1c={'raw':![],'where':{}};var _0x4ca407={};var _0x5ca0e8={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1963('0x65')]({'where':{'id':_0x3c7952[_0x1963('0x54')]['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x5e66b5,null))['then'](function(_0x21ca6a){if(_0x21ca6a){_0x4ca407[_0x1963('0x41')]=_[_0x1963('0x43')](db[_0x1963('0x6b')][_0x1963('0x55')]);_0x4ca407['query']=_[_0x1963('0x43')](_0x3c7952[_0x1963('0x48')]);_0x4ca407[_0x1963('0x44')]=_['intersection'](_0x4ca407[_0x1963('0x41')],_0x4ca407['query']);_0x272a1c['attributes']=_[_0x1963('0x46')](_0x4ca407[_0x1963('0x41')],qs[_0x1963('0x47')](_0x3c7952[_0x1963('0x48')][_0x1963('0x47')]));_0x272a1c[_0x1963('0x45')]=_0x272a1c[_0x1963('0x45')]['length']?_0x272a1c[_0x1963('0x45')]:_0x4ca407[_0x1963('0x41')];if(!_0x3c7952['query']['hasOwnProperty'](_0x1963('0x4a'))){_0x272a1c['limit']=qs[_0x1963('0x2f')](_0x3c7952[_0x1963('0x48')][_0x1963('0x2f')]);_0x272a1c[_0x1963('0x2d')]=qs[_0x1963('0x2d')](_0x3c7952[_0x1963('0x48')]['offset']);}_0x272a1c[_0x1963('0x4b')]=qs[_0x1963('0x4c')](_0x3c7952[_0x1963('0x48')]['sort']);_0x272a1c['where']=qs[_0x1963('0x44')](_[_0x1963('0x4e')](_0x3c7952[_0x1963('0x48')],_0x4ca407['filters']));_0x272a1c[_0x1963('0x4d')]['FaxAccountId']=_0x21ca6a['id'];if(_0x3c7952[_0x1963('0x48')][_0x1963('0x4f')]){_0x272a1c[_0x1963('0x4d')]=_[_0x1963('0x50')](_0x272a1c[_0x1963('0x4d')],{'$or':_['map'](_0x272a1c[_0x1963('0x45')],function(_0x27db94){var _0x253a30={};_0x253a30[_0x27db94]={'$like':'%'+_0x3c7952[_0x1963('0x48')][_0x1963('0x4f')]+'%'};return _0x253a30;})});}_0x272a1c=_[_0x1963('0x50')]({},_0x272a1c,_0x3c7952[_0x1963('0x59')]);return db[_0x1963('0x6b')]['count']({'where':_0x272a1c[_0x1963('0x4d')]})[_0x1963('0x35')](function(_0x392c21){_0x5ca0e8['count']=_0x392c21;if(_0x3c7952[_0x1963('0x48')][_0x1963('0x57')]){_0x272a1c['include']=[{'model':db[_0x1963('0x6f')],'as':_0x1963('0x70'),'required':![]},{'model':db[_0x1963('0x71')],'as':_0x1963('0x72'),'attributes':[_0x1963('0x3a'),_0x1963('0x73'),_0x1963('0x74')],'required':![]},{'model':db[_0x1963('0x75')],'as':'Tags','attributes':['id','name','color'],'where':_0x3c7952[_0x1963('0x48')][_0x1963('0x76')]?{'id':_0x3c7952[_0x1963('0x48')][_0x1963('0x76')]}:undefined,'required':_0x3c7952[_0x1963('0x48')][_0x1963('0x76')]?!![]:![]}];}return db[_0x1963('0x6b')][_0x1963('0x52')](_0x272a1c);})[_0x1963('0x35')](function(_0x1e14bd){_0x5ca0e8[_0x1963('0x66')]=_0x1e14bd;return _0x5ca0e8;});}})[_0x1963('0x35')](respondWithFilteredResult(_0x5e66b5,_0x272a1c))['catch'](handleError(_0x5e66b5,null));};exports[_0x1963('0x77')]=function(_0x5ea8b8,_0x5b26ab){var _0x222acd=_0x5ea8b8[_0x1963('0x54')]['id'];var _0xe0ce63=_0x5ea8b8[_0x1963('0x5c')];var _0x58a7e1=0xc8;var _0x25ad08=null;return db[_0x1963('0x78')][_0x1963('0x79')]({'isolationLevel':db[_0x1963('0x78')][_0x1963('0x7a')][_0x1963('0x7b')][_0x1963('0x7c')]},function(_0x177ac6){return db[_0x1963('0x3e')]['findOne']({'where':{'id':_0x222acd},'transaction':_0x177ac6})[_0x1963('0x35')](function(_0x37c875){if(_0x37c875){return db[_0x1963('0x7d')][_0x1963('0x39')]({'where':{'FaxAccountId':_0x222acd},'transaction':_0x177ac6})[_0x1963('0x35')](function(){var _0x28cdad=_[_0x1963('0x42')](_0xe0ce63,function(_0x1894f1){_0x1894f1[_0x1963('0x63')]=_0x222acd;return _0x1894f1;});return db[_0x1963('0x7d')]['bulkCreate'](_0x28cdad,{'transaction':_0x177ac6});});}else{_0x58a7e1=0x194;_0x25ad08=[];}});})[_0x1963('0x35')](function(){if(_0x58a7e1!==0x194){return db[_0x1963('0x7d')][_0x1963('0x7e')]({'where':{'FaxAccountId':_0x222acd},'order':_0x1963('0x7f')})['then'](function(_0x3c7734){_0x25ad08=_0x3c7734;});}})[_0x1963('0x28')](function(_0x1c870c){_0x58a7e1=0x1f4;logger['error'](_0x1c870c[_0x1963('0x80')]);if(_0x1c870c[_0x1963('0x3a')]){delete _0x1c870c[_0x1963('0x3a')];}_0x25ad08=_0x1c870c;})[_0x1963('0x81')](function(){if(_0x25ad08===null){_0x5b26ab[_0x1963('0x29')](_0x58a7e1);}else{if(_0x58a7e1===0x1f4){_0x5b26ab['status'](_0x58a7e1)[_0x1963('0x3b')](_0x25ad08);}else{_0x5b26ab['status'](_0x58a7e1)['json'](_0x25ad08);}}});};exports[_0x1963('0x82')]=function(_0x32c1e7,_0x3aee26,_0x14f6b9){var _0x414293={};var _0x171ea7={};var _0x330c83;var _0x2cf925;return db[_0x1963('0x3e')][_0x1963('0x65')]({'where':{'id':_0x32c1e7[_0x1963('0x54')]['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x3aee26,null))['then'](function(_0x120400){if(_0x120400){_0x330c83=_0x120400;_0x171ea7[_0x1963('0x41')]=_[_0x1963('0x43')](db[_0x1963('0x7d')]['rawAttributes']);_0x171ea7[_0x1963('0x48')]=_[_0x1963('0x43')](_0x32c1e7[_0x1963('0x48')]);_0x171ea7[_0x1963('0x44')]=_[_0x1963('0x46')](_0x171ea7[_0x1963('0x41')],_0x171ea7[_0x1963('0x48')]);_0x414293[_0x1963('0x45')]=_[_0x1963('0x46')](_0x171ea7[_0x1963('0x41')],qs[_0x1963('0x47')](_0x32c1e7[_0x1963('0x48')][_0x1963('0x47')]));_0x414293[_0x1963('0x45')]=_0x414293['attributes'][_0x1963('0x56')]?_0x414293[_0x1963('0x45')]:_0x171ea7['model'];_0x414293[_0x1963('0x4b')]=qs[_0x1963('0x4c')](_0x32c1e7[_0x1963('0x48')][_0x1963('0x4c')]);_0x414293[_0x1963('0x4d')]=qs['filters'](_['pick'](_0x32c1e7['query'],_0x171ea7[_0x1963('0x44')]));if(_0x32c1e7[_0x1963('0x48')][_0x1963('0x4f')]){_0x414293['where']=_['merge'](_0x414293[_0x1963('0x4d')],{'$or':_[_0x1963('0x42')](_0x414293[_0x1963('0x45')],function(_0x1d8a8a){var _0x3df14e={};_0x3df14e[_0x1d8a8a]={'$like':'%'+_0x32c1e7[_0x1963('0x48')][_0x1963('0x4f')]+'%'};return _0x3df14e;})});}_0x414293=_['merge']({},_0x414293,_0x32c1e7[_0x1963('0x59')]);return _0x330c83[_0x1963('0x82')](_0x414293);}})[_0x1963('0x35')](function(_0xf9577){if(_0xf9577){_0x2cf925=_0xf9577[_0x1963('0x56')];if(!_0x32c1e7['query'][_0x1963('0x49')]('nolimit')){_0x414293[_0x1963('0x2f')]=qs[_0x1963('0x2f')](_0x32c1e7[_0x1963('0x48')][_0x1963('0x2f')]);_0x414293[_0x1963('0x2d')]=qs[_0x1963('0x2d')](_0x32c1e7[_0x1963('0x48')][_0x1963('0x2d')]);}return _0x330c83[_0x1963('0x82')](_0x414293);}})[_0x1963('0x35')](function(_0x2e7e5a){if(_0x2e7e5a){return _0x2e7e5a?{'count':_0x2cf925,'rows':_0x2e7e5a}:null;}})['then'](respondWithResult(_0x3aee26,null))['catch'](handleError(_0x3aee26,null));};function Extension(_0x2fb3f3,_0x460c34,_0x222d36,_0x473e2e){this[_0x1963('0x83')]=_0x1963('0x84');this[_0x1963('0x85')]=_0x2fb3f3[_0x1963('0x86')];this[_0x1963('0x87')]=_0x473e2e;this[_0x1963('0x3f')]=_0x1963('0x88');this[_0x1963('0x89')]=_0x1963('0x8a');this[_0x1963('0x63')]=_0x2fb3f3['id'];this[_0x1963('0x7f')]=_0x460c34;this[_0x1963('0x8b')]=_0x222d36;}function createExtensionsReciveFax(_0x3438c7){var _0x4e9433=0x1;var _0x2fc164=[];_0x2fc164[_0x1963('0x8c')](new Extension(_0x3438c7,_0x4e9433,'',_0x1963('0x8d')));_0x4e9433+=0x1;_0x2fc164[_0x1963('0x8c')](new Extension(_0x3438c7,_0x4e9433,_0x1963('0x8e'),_0x1963('0x8f')));_0x4e9433+=0x1;for(var _0x5ab6e8 in _0x3438c7){if(_0x3438c7[_0x1963('0x49')](_0x5ab6e8)&&(_0x5ab6e8===_0x1963('0x90')||_0x5ab6e8===_0x1963('0x86')||_0x5ab6e8===_0x1963('0x91')||_0x5ab6e8===_0x1963('0x92')||_0x5ab6e8===_0x1963('0x93')||_0x5ab6e8===_0x1963('0x94')||_0x5ab6e8===_0x1963('0x95')||_0x5ab6e8===_0x1963('0x96')||_0x5ab6e8===_0x1963('0x97'))){_0x2fc164[_0x1963('0x8c')](new Extension(_0x3438c7,_0x4e9433,_0x1963('0x98')+_0x5ab6e8+')='+_0x3438c7[_0x5ab6e8],_0x1963('0x8f')));_0x4e9433+=0x1;}}_0x2fc164[_0x1963('0x8c')](new Extension(_0x3438c7,_0x4e9433,'6',_0x1963('0x99')));_0x4e9433+=0x1;_0x2fc164['push'](new Extension(_0x3438c7,_0x4e9433,_0x1963('0x9a'),'ReceiveFax'));_0x4e9433=0x0;return _0x2fc164;}exports[_0x1963('0x9b')]=function(_0x53cc4e,_0x37c449,_0x4f0cb0){var _0x4eac9f;return db['sequelize'][_0x1963('0x79')](function(_0x37141a){return db[_0x1963('0x3e')][_0x1963('0x5b')](_0x53cc4e[_0x1963('0x5c')],{'transaction':_0x37141a})[_0x1963('0x35')](function(_0x210e15){_0x4eac9f=_0x210e15['get']({'plain':!![]});return db[_0x1963('0x9c')][_0x1963('0x9d')](createExtensionsReciveFax(_0x4eac9f),{'transaction':_0x37141a});});})[_0x1963('0x35')](function(){return _0x4eac9f;})[_0x1963('0x35')](respondWithResult(_0x37c449,null))[_0x1963('0x28')](handleError(_0x37c449,null));};exports[_0x1963('0x9e')]=function(_0x4364b4,_0x515cb7,_0x117458){var _0x3e3336;return db[_0x1963('0x78')][_0x1963('0x79')](function(_0x19aab8){return db[_0x1963('0x3e')]['update'](_0x4364b4[_0x1963('0x5c')],{'where':{'id':_0x4364b4[_0x1963('0x5c')]['id']},'transaction':_0x19aab8})[_0x1963('0x35')](function(_0x5bc02f){return db[_0x1963('0x9c')]['destroy']({'where':{'FaxAccountId':_0x4364b4[_0x1963('0x5c')]['id']},'transaction':_0x19aab8})[_0x1963('0x35')](function(_0x4a4d72){return db[_0x1963('0x9c')][_0x1963('0x9d')](createExtensionsReciveFax(_['omit'](_0x4364b4['body'],[_0x1963('0x9f'),_0x1963('0x40'),_0x1963('0xa0'),_0x1963('0xa1'),'TrunkId',_0x1963('0xa2')])),{'transaction':_0x19aab8});});});})[_0x1963('0x35')](function(){return db[_0x1963('0x3e')][_0x1963('0xa3')](_0x4364b4[_0x1963('0x5c')]['id']);})[_0x1963('0x35')](respondWithResult(_0x515cb7,null))['catch'](handleError(_0x515cb7,null));};exports[_0x1963('0xa4')]=function(_0x4e19ae,_0x392f11,_0x35bfdd){var _0x1da9bf={'raw':!![],'where':{}};var _0x987d85={};var _0x204c9f={'count':0x0,'rows':[]};return db[_0x1963('0x3e')][_0x1963('0x65')]({'where':{'id':_0x4e19ae['params']['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x392f11,null))[_0x1963('0x35')](function(_0x1418ce){if(_0x1418ce){_0x987d85[_0x1963('0x41')]=_[_0x1963('0x43')](db[_0x1963('0xa5')][_0x1963('0x55')]);_0x987d85['query']=_['keys'](_0x4e19ae[_0x1963('0x48')]);_0x987d85[_0x1963('0x44')]=_[_0x1963('0x46')](_0x987d85[_0x1963('0x41')],_0x987d85[_0x1963('0x48')]);_0x1da9bf[_0x1963('0x45')]=_[_0x1963('0x46')](_0x987d85['model'],qs['fields'](_0x4e19ae[_0x1963('0x48')][_0x1963('0x47')]));_0x1da9bf['attributes']=_0x1da9bf[_0x1963('0x45')][_0x1963('0x56')]?_0x1da9bf[_0x1963('0x45')]:_0x987d85[_0x1963('0x41')];if(!_0x4e19ae[_0x1963('0x48')][_0x1963('0x49')](_0x1963('0x4a'))){_0x1da9bf[_0x1963('0x2f')]=qs['limit'](_0x4e19ae['query'][_0x1963('0x2f')]);_0x1da9bf[_0x1963('0x2d')]=qs[_0x1963('0x2d')](_0x4e19ae[_0x1963('0x48')]['offset']);}_0x1da9bf[_0x1963('0x4b')]=qs['sort'](_0x4e19ae[_0x1963('0x48')][_0x1963('0x4c')]);_0x1da9bf['where']=qs['filters'](_[_0x1963('0x4e')](_0x4e19ae['query'],_0x987d85[_0x1963('0x44')]));_0x1da9bf[_0x1963('0x4d')][_0x1963('0x63')]=_0x1418ce['id'];if(_0x4e19ae[_0x1963('0x48')][_0x1963('0x4f')]){_0x1da9bf[_0x1963('0x4d')]=_['merge'](_0x1da9bf[_0x1963('0x4d')],{'$or':_['map'](_0x1da9bf['attributes'],function(_0xf79195){var _0x51dc25={};_0x51dc25[_0xf79195]={'$like':'%'+_0x4e19ae[_0x1963('0x48')][_0x1963('0x4f')]+'%'};return _0x51dc25;})});}if(_0x4e19ae[_0x1963('0x48')][_0x1963('0xa6')]){var _0x43fff5=_0x4e19ae[_0x1963('0x48')][_0x1963('0xa6')][_0x1963('0xa7')](',');var _0x447cf2={};_0x447cf2[_0x43fff5[0x0]]={'$gte':moment(_0x43fff5[0x1])['format'](_0x1963('0xa8'))};_0x1da9bf[_0x1963('0x4d')]=_[_0x1963('0x50')](_0x1da9bf[_0x1963('0x4d')],_0x447cf2);}_0x1da9bf=_[_0x1963('0x50')]({},_0x1da9bf,_0x4e19ae['options']);return db[_0x1963('0xa5')][_0x1963('0x30')]({'where':_0x1da9bf[_0x1963('0x4d')]})[_0x1963('0x35')](function(_0x4cbea1){_0x204c9f[_0x1963('0x30')]=_0x4cbea1;if(_0x4e19ae[_0x1963('0x48')][_0x1963('0x57')]){_0x1da9bf[_0x1963('0x58')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1da9bf);})[_0x1963('0x35')](function(_0x19ae03){_0x204c9f[_0x1963('0x66')]=_0x19ae03;return _0x204c9f;});}})[_0x1963('0x35')](respondWithFilteredResult(_0x392f11,_0x1da9bf))['catch'](handleError(_0x392f11,null));};exports[_0x1963('0x3b')]=function(_0x7214f0,_0x5d8c14,_0x4212d9){var _0x26ba38,_0x242c22={},_0x534de7;if(_0x7214f0[_0x1963('0x5c')]['to']){_0x534de7=_0x7214f0[_0x1963('0x5c')]['to'][0x0];}return db['FaxAccount'][_0x1963('0x5a')]({'where':{'id':_0x7214f0[_0x1963('0x54')]['id']},'include':[{'model':db[_0x1963('0xa9')],'as':_0x1963('0xaa'),'include':[{'model':db[_0x1963('0x6f')],'as':_0x1963('0xab'),'where':{'fax':_0x534de7},'limit':0x1,'order':[[_0x1963('0xa1'),_0x1963('0xac')]]}]}]})['then'](handleEntityNotFound(_0x5d8c14,null))[_0x1963('0x35')](function(_0x2105b4){_0x26ba38=_0x2105b4;if(_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')]&&_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][_0x1963('0x56')]){for(var _0x3a8aab=0x0;_0x3a8aab<_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][_0x1963('0x56')];_0x3a8aab+=0x1){_0x7214f0['body'][_0x1963('0xad')][_0x3a8aab]={'filename':_0x7214f0['body'][_0x1963('0xad')][_0x3a8aab][_0x1963('0x3a')],'id':_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][_0x3a8aab]['id'],'path':path[_0x1963('0xae')](config[_0x1963('0xaf')],_0x1963('0xb0'),_0x7214f0[_0x1963('0x5c')]['attachments'][_0x3a8aab]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x7214f0[_0x1963('0x54')]['id'])?undefined:_0x7214f0[_0x1963('0x54')]['id'],'path':_['isNil'](_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][0x0][_0x1963('0x8')])?undefined:_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][0x0][_0x1963('0x8')],'fax':_['isNil'](_0x7214f0[_0x1963('0x5c')]['to'][0x0])?undefined:_0x7214f0[_0x1963('0x5c')]['to'][0x0]},client9002);})[_0x1963('0x35')](function(){if(_0x26ba38){if(_[_0x1963('0xb1')](_0x7214f0['body'][_0x1963('0xb2')])){_0x7214f0[_0x1963('0x5c')]['from']=util['format']('\x22%s\x22\x20<%s>',_0x26ba38['name'],_0x26ba38[_0x1963('0xb3')]);}if(_0x26ba38[_0x1963('0xaa')]){if(_0x26ba38['List'][_0x1963('0xab')]['length']){return _0x26ba38[_0x1963('0xaa')][_0x1963('0xab')][0x0];}else{return db[_0x1963('0x6f')]['create'](_[_0x1963('0xb4')](_0x7214f0[_0x1963('0x5c')],{'firstName':_0x7214f0[_0x1963('0x5c')]['to'][0x0],'phone':_0x7214f0['body']['to'][0x0],'fax':_0x7214f0[_0x1963('0x5c')]['to'][0x0],'ListId':_0x26ba38['ListId']}));}}else{throw new Error(_0x1963('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1963('0x35')](function(_0x3fa127){if(_0x3fa127){return db[_0x1963('0x6b')]['find']({'where':{'ContactId':_0x3fa127['id'],'closed':![],'FaxAccountId':_0x26ba38['id']}})['then'](function(_0x38aabf){if(_0x38aabf){return[_0x38aabf,![]];}return db['FaxInteraction'][_0x1963('0x5b')]({'UserId':_0x7214f0[_0x1963('0x5d')]['id'],'ContactId':_0x3fa127['id'],'FaxAccountId':_0x26ba38['id'],'fax':_0x7214f0[_0x1963('0x5c')]['to'][0x0],'firstMsgDirection':_0x1963('0xb6'),'Messages':[_['merge'](_0x7214f0[_0x1963('0x5c')],{'read':![],'body':_0x7214f0[_0x1963('0x5c')]['attachments'][0x0]['filename'],'FaxAccountId':_0x26ba38['id'],'UserId':_0x7214f0['user']['id'],'ContactId':_0x3fa127['id'],'AttachmentId':_0x7214f0[_0x1963('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x1963('0xa5')],'as':_0x1963('0xb7')}]})['then'](function(_0x4cae64){return[_0x4cae64,!![]];});});}else{throw new Error(_0x1963('0xb8'));}})[_0x1963('0xb9')](function(_0xadeb9d,_0x5067c1){if(_0x5067c1){return _0xadeb9d;}return db[_0x1963('0xa5')][_0x1963('0x5b')]({'direction':'out','read':![],'body':_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][0x0][_0x1963('0xba')],'FaxAccountId':_0x26ba38['id'],'FaxInteractionId':_0xadeb9d['id'],'UserId':_0x7214f0[_0x1963('0x5d')]['id'],'ContactId':_0xadeb9d['ContactId'],'AttachmentId':_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][0x0]['id']})[_0x1963('0x35')](function(_0x108f62){_0xadeb9d[_0x1963('0xbb')][_0x1963('0xb7')]=[];_0xadeb9d[_0x1963('0xbb')]['Messages'][_0x1963('0x8c')](_0x108f62[_0x1963('0xbb')]);return _0xadeb9d;});})[_0x1963('0x35')](function(_0x1e0654){respondWithRpcPromise('SendFax',_0x1963('0xbc'),{'FaxAccountId':_[_0x1963('0xb1')](_0x7214f0['params']['id'])?undefined:_0x7214f0[_0x1963('0x54')]['id'],'path':_[_0x1963('0xb1')](_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][0x0][_0x1963('0x8')])?undefined:_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][0x0]['path'],'fax':_[_0x1963('0xb1')](_0x7214f0[_0x1963('0x5c')]['to'][0x0])?undefined:_0x7214f0[_0x1963('0x5c')]['to'][0x0],'AttachmentId':_0x7214f0[_0x1963('0x5c')][_0x1963('0xad')][0x0]['id']},client9002)['then'](function(_0x5f55fc){logger[_0x1963('0x26')](_0x1963('0xbd'),_0x5f55fc);})[_0x1963('0x28')](function(_0x492e6a){logger[_0x1963('0x26')]('SendFaxRpc,\x20%s',_0x492e6a);});return _0x1e0654;})[_0x1963('0x35')](respondWithResult(_0x5d8c14,null))[_0x1963('0x28')](handleError(_0x5d8c14,null));};exports[_0x1963('0xbe')]=function(_0x234b3a,_0xdff398,_0x3a239a){return db[_0x1963('0x3e')][_0x1963('0x5a')]({'where':{'id':_0x234b3a[_0x1963('0x54')]['id']}})['then'](handleEntityNotFound(_0xdff398,null))[_0x1963('0x35')](function(_0x58adf9){if(_0x58adf9){return _0x58adf9[_0x1963('0xbe')](_0x234b3a['body'][_0x1963('0x6a')],_[_0x1963('0x6d')](_0x234b3a[_0x1963('0x5c')],['ids','id'])||{})[_0x1963('0xb9')](function(_0x54ad51){for(var _0x15b835=0x0;_0x15b835<_0x234b3a[_0x1963('0x5c')][_0x1963('0x6a')][_0x1963('0x56')];_0x15b835+=0x1){socket[_0x1963('0xbf')](_0x1963('0xc0'),{'UserId':Number(_0x234b3a[_0x1963('0x5c')][_0x1963('0x6a')][_0x15b835]),'FaxAccountId':Number(_0x234b3a['params']['id'])});}return _0x54ad51;});}})[_0x1963('0x35')](respondWithResult(_0xdff398,null))[_0x1963('0x28')](handleError(_0xdff398,null));};exports[_0x1963('0xc1')]=function(_0x59e054,_0x22b527,_0xfd9f41){return db[_0x1963('0x3e')][_0x1963('0x5a')]({'where':{'id':_0x59e054['params']['id']}})[_0x1963('0x35')](handleEntityNotFound(_0x22b527,null))[_0x1963('0x35')](function(_0x7dea93){if(_0x7dea93){return _0x7dea93[_0x1963('0xc1')](_0x59e054[_0x1963('0x48')]['ids'])[_0x1963('0x35')](function(){if(_[_0x1963('0xc2')](_0x59e054[_0x1963('0x48')][_0x1963('0x6a')])){for(var _0x3927e1=0x0;_0x3927e1<_0x59e054[_0x1963('0x48')][_0x1963('0x6a')]['length'];_0x3927e1+=0x1){socket[_0x1963('0xbf')](_0x1963('0xc3'),{'UserId':Number(_0x59e054['query']['ids'][_0x3927e1]),'FaxAccountId':Number(_0x59e054[_0x1963('0x54')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x59e054[_0x1963('0x48')][_0x1963('0x6a')]),'FaxAccountId':Number(_0x59e054['params']['id'])});}});}})[_0x1963('0x35')](respondWithStatusCode(_0x22b527,null))[_0x1963('0x28')](handleError(_0x22b527,null));};exports[_0x1963('0xc4')]=function(_0x7f3198,_0x23e63d,_0x4fc2b5){var _0x5adc77={};var _0x465225={};var _0x116422;var _0x5b5c4c;return db[_0x1963('0x3e')][_0x1963('0x65')]({'where':{'id':_0x7f3198[_0x1963('0x54')]['id']}})['then'](handleEntityNotFound(_0x23e63d,null))[_0x1963('0x35')](function(_0x43306e){if(_0x43306e){_0x116422=_0x43306e;_0x465225[_0x1963('0x41')]=_[_0x1963('0x43')](db[_0x1963('0x71')]['rawAttributes']);_0x465225[_0x1963('0x48')]=_['keys'](_0x7f3198[_0x1963('0x48')]);_0x465225['filters']=_[_0x1963('0x46')](_0x465225['model'],_0x465225[_0x1963('0x48')]);_0x5adc77[_0x1963('0x45')]=_[_0x1963('0x46')](_0x465225['model'],qs['fields'](_0x7f3198[_0x1963('0x48')][_0x1963('0x47')]));_0x5adc77[_0x1963('0x45')]=_0x5adc77['attributes']['length']?_0x5adc77[_0x1963('0x45')]:_0x465225['model'];_0x5adc77[_0x1963('0x4b')]=qs['sort'](_0x7f3198[_0x1963('0x48')][_0x1963('0x4c')]);_0x5adc77[_0x1963('0x4d')]=qs[_0x1963('0x44')](_['pick'](_0x7f3198['query'],_0x465225[_0x1963('0x44')]));if(_0x7f3198[_0x1963('0x48')]['filter']){_0x5adc77[_0x1963('0x4d')]=_[_0x1963('0x50')](_0x5adc77['where'],{'$or':_[_0x1963('0x42')](_0x5adc77[_0x1963('0x45')],function(_0x2f6c26){var _0x506d80={};_0x506d80[_0x2f6c26]={'$like':'%'+_0x7f3198['query'][_0x1963('0x4f')]+'%'};return _0x506d80;})});}_0x5adc77=_[_0x1963('0x50')]({},_0x5adc77,_0x7f3198['options']);return _0x116422[_0x1963('0xc4')](_0x5adc77);}})[_0x1963('0x35')](function(_0x8468cc){if(_0x8468cc){_0x5b5c4c=_0x8468cc['length'];if(!_0x7f3198[_0x1963('0x48')]['hasOwnProperty'](_0x1963('0x4a'))){_0x5adc77['limit']=qs[_0x1963('0x2f')](_0x7f3198['query'][_0x1963('0x2f')]);_0x5adc77[_0x1963('0x2d')]=qs[_0x1963('0x2d')](_0x7f3198[_0x1963('0x48')][_0x1963('0x2d')]);}return _0x116422[_0x1963('0xc4')](_0x5adc77);}})[_0x1963('0x35')](function(_0x1ff022){if(_0x1ff022){return _0x1ff022?{'count':_0x5b5c4c,'rows':_0x1ff022}:null;}})[_0x1963('0x35')](respondWithResult(_0x23e63d,null))[_0x1963('0x28')](handleError(_0x23e63d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 428c7fc..0b5e01f 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 _0x0c71=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x3cd204,_0x273fe7){var _0x2338d4=function(_0x1a95b5){while(--_0x1a95b5){_0x3cd204['push'](_0x3cd204['shift']());}};_0x2338d4(++_0x273fe7);}(_0x0c71,0xfb));var _0x10c7=function(_0x36d554,_0xbf52a0){_0x36d554=_0x36d554-0x0;var _0x3718f8=_0x0c71[_0x36d554];return _0x3718f8;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x10c7('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x10c7('0x1')](0x0);var events={'afterCreate':_0x10c7('0x2'),'afterUpdate':_0x10c7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5832f1){return function(_0xa72176,_0x57f92f,_0x2397ae){FaxAccountEvents[_0x10c7('0x4')](_0x5832f1+':'+_0xa72176['id'],_0xa72176);FaxAccountEvents[_0x10c7('0x4')](_0x5832f1,_0xa72176);_0x2397ae(null);};}for(var e in events){if(events[_0x10c7('0x5')](e)){var event=events[e];FaxAccount[_0x10c7('0x6')](e,emitEvent(event));}}module[_0x10c7('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xf56c=['../../mysqldb','FaxAccount','save','remove','emit','hasOwnProperty','exports'];(function(_0x1137f4,_0x6a959b){var _0x45dee8=function(_0x53b27d){while(--_0x53b27d){_0x1137f4['push'](_0x1137f4['shift']());}};_0x45dee8(++_0x6a959b);}(_0xf56c,0x1c0));var _0xcf56=function(_0x595764,_0x1cc566){_0x595764=_0x595764-0x0;var _0x16e598=_0xf56c[_0x595764];return _0x16e598;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xcf56('0x0'))['db'][_0xcf56('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcf56('0x2'),'afterUpdate':'update','afterDestroy':_0xcf56('0x3')};function emitEvent(_0x173f46){return function(_0x2dfabe,_0x50ad14,_0x4716fa){FaxAccountEvents['emit'](_0x173f46+':'+_0x2dfabe['id'],_0x2dfabe);FaxAccountEvents[_0xcf56('0x4')](_0x173f46,_0x2dfabe);_0x4716fa(null);};}for(var e in events){if(events[_0xcf56('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xcf56('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a98c49e..bb8b473 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 _0x740e=['rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4c4b63,_0x18703c){var _0x1a10e4=function(_0x26bc6b){while(--_0x26bc6b){_0x4c4b63['push'](_0x4c4b63['shift']());}};_0x1a10e4(++_0x18703c);}(_0x740e,0x123));var _0xe740=function(_0x143e1f,_0x51102b){_0x143e1f=_0x143e1f-0x0;var _0x45aee3=_0x740e[_0x143e1f];return _0x45aee3;};'use strict';var _=require(_0xe740('0x0'));var util=require(_0xe740('0x1'));var logger=require(_0xe740('0x2'))(_0xe740('0x3'));var moment=require('moment');var BPromise=require(_0xe740('0x4'));var rp=require(_0xe740('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe740('0x6'));var config=require(_0xe740('0x7'));var attributes=require(_0xe740('0x8'));module['exports']=function(_0x1363ce,_0x553dbe){return _0x1363ce[_0xe740('0x9')](_0xe740('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x595c=['../../config/logger','api','request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x595c,0xce));var _0xc595=function(_0x45c1e8,_0x11e7b9){_0x45c1e8=_0x45c1e8-0x0;var _0x22c14e=_0x595c[_0x45c1e8];return _0x22c14e;};'use strict';var _=require(_0xc595('0x0'));var util=require('util');var logger=require(_0xc595('0x1'))(_0xc595('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc595('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc595('0x4'));var config=require(_0xc595('0x5'));var attributes=require(_0xc595('0x6'));module['exports']=function(_0x513dce,_0x486734){return _0x513dce[_0xc595('0x7')]('FaxAccount',attributes,{'tableName':_0xc595('0x8'),'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 6972964..5e0f4a3 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 _0xd8bc=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','get','applications','Applications','list','orderBy','priority','account','length','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','options','where','attributes','limit','include','map','model','NotifyFaxAccount','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey'];(function(_0x5be55c,_0x2190b7){var _0x1aea2b=function(_0x56212a){while(--_0x56212a){_0x5be55c['push'](_0x5be55c['shift']());}};_0x1aea2b(++_0x2190b7);}(_0xd8bc,0xd1));var _0xcd8b=function(_0x44e755,_0x346947){_0x44e755=_0x44e755-0x0;var _0x10e812=_0xd8bc[_0x44e755];return _0x10e812;};'use strict';var _=require(_0xcd8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd8b('0x1'));var rs=require(_0xcd8b('0x2'));var fs=require('fs');var Redis=require(_0xcd8b('0x3'));var db=require(_0xcd8b('0x4'))['db'];var utils=require(_0xcd8b('0x5'));var logger=require(_0xcd8b('0x6'))(_0xcd8b('0x7'));var config=require('../../config/environment');var jayson=require(_0xcd8b('0x8'));var client=jayson['client'][_0xcd8b('0x9')]({'port':0x232c});config[_0xcd8b('0xa')]=_['defaults'](config[_0xcd8b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xcd8b('0xb')](socket);function respondWithRpcPromise(_0x95411b,_0x1736f6,_0x53b0cb){return new BPromise(function(_0x36f53f,_0x1bbd02){return client['request'](_0x95411b,_0x53b0cb)[_0xcd8b('0xc')](function(_0x2722cf){logger[_0xcd8b('0xd')]('FaxAccount,\x20%s,\x20%s',_0x1736f6,_0xcd8b('0xe'));logger[_0xcd8b('0xf')](_0xcd8b('0x10'),_0x1736f6,'request\x20sent',JSON[_0xcd8b('0x11')](_0x2722cf));if(_0x2722cf[_0xcd8b('0x12')]){if(_0x2722cf[_0xcd8b('0x12')][_0xcd8b('0x13')]===0x1f4){logger[_0xcd8b('0x12')]('FaxAccount,\x20%s,\x20%s',_0x1736f6,_0x2722cf[_0xcd8b('0x12')]['message']);return _0x1bbd02(_0x2722cf[_0xcd8b('0x12')][_0xcd8b('0x14')]);}logger[_0xcd8b('0x12')](_0xcd8b('0x15'),_0x1736f6,_0x2722cf[_0xcd8b('0x12')]['message']);return _0x36f53f(_0x2722cf['error'][_0xcd8b('0x14')]);}else{logger['info'](_0xcd8b('0x15'),_0x1736f6,_0xcd8b('0xe'));_0x36f53f(_0x2722cf[_0xcd8b('0x16')][_0xcd8b('0x14')]);}})[_0xcd8b('0x17')](function(_0x4cb511){logger[_0xcd8b('0x12')](_0xcd8b('0x15'),_0x1736f6,_0x4cb511);_0x1bbd02(_0x4cb511);});});}exports[_0xcd8b('0x18')]=function(_0x38e32e){var _0x3ca6ef=this;return new Promise(function(_0x212906,_0x274db7){return db[_0xcd8b('0x19')]['findAll']({'raw':_0x38e32e[_0xcd8b('0x1a')]?_0x38e32e[_0xcd8b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x38e32e['options']?_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1b')]||null:null,'attributes':_0x38e32e[_0xcd8b('0x1a')]?_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1c')]||null:null,'limit':_0x38e32e['options']?_0x38e32e['options'][_0xcd8b('0x1d')]||null:null,'include':_0x38e32e[_0xcd8b('0x1a')]?_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1e')]?_[_0xcd8b('0x1f')](_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1e')],function(_0x5e7470){return{'model':db[_0x5e7470[_0xcd8b('0x20')]],'as':_0x5e7470['as'],'attributes':_0x5e7470[_0xcd8b('0x1c')],'include':_0x5e7470[_0xcd8b('0x1e')]?_[_0xcd8b('0x1f')](_0x5e7470[_0xcd8b('0x1e')],function(_0x352195){return{'model':db[_0x352195[_0xcd8b('0x20')]],'as':_0x352195['as'],'attributes':_0x352195[_0xcd8b('0x1c')],'include':_0x352195[_0xcd8b('0x1e')]?_[_0xcd8b('0x1f')](_0x352195['include'],function(_0x478ded){return{'model':db[_0x478ded[_0xcd8b('0x20')]],'as':_0x478ded['as'],'attributes':_0x478ded[_0xcd8b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcd8b('0xc')](function(_0x47f8bd){logger[_0xcd8b('0xd')](_0xcd8b('0x18'),_0x38e32e);logger[_0xcd8b('0xf')](_0xcd8b('0x18'),_0x38e32e,JSON[_0xcd8b('0x11')](_0x47f8bd));_0x212906(_0x47f8bd);})[_0xcd8b('0x17')](function(_0x283fb7){logger[_0xcd8b('0x12')](_0xcd8b('0x18'),_0x283fb7['message'],_0x38e32e);_0x274db7(_0x3ca6ef[_0xcd8b('0x12')](0x1f4,_0x283fb7[_0xcd8b('0x14')]));});});};exports[_0xcd8b('0x21')]=function(_0x1a3a83,_0x1ce5a5,_0x2fa30e){var _0x40b1aa=this;return new Promise(function(_0x1aff43,_0x435bb3){var _0x164060={'body':_0x1a3a83['body'],'channel':'fax'};var _0x1e086b=[];var _0x3ba38c=[];var _0x345886={};return db['CmContact'][_0xcd8b('0x22')]()[_0xcd8b('0xc')](function(_0x2767a2){if(!_0x2767a2){throw new db[(_0xcd8b('0x23'))][(_0xcd8b('0x24'))](_0xcd8b('0x25'));}_0x1e086b=_[_0xcd8b('0x26')](_[_0xcd8b('0x27')](_0x2767a2),['createdAt',_0xcd8b('0x28')]);_0x3ba38c=_[_0xcd8b('0x26')](_[_0xcd8b('0x27')](_0x2767a2),['createdAt',_0xcd8b('0x28'),'CompanyId',_0xcd8b('0x29')]);if(_0x1a3a83[_0xcd8b('0x2a')]['id']){delete _0x1a3a83[_0xcd8b('0x2a')]['id'];}if(_[_0xcd8b('0x2b')](_0x1a3a83['body']['from'])){throw new db[(_0xcd8b('0x23'))]['ValidationError'](_0xcd8b('0x2c'));}if(_[_0xcd8b('0x2b')](_0x1a3a83['body']['body'])||_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x2a')]===''){throw new db[(_0xcd8b('0x23'))]['ValidationError'](_0xcd8b('0x2d'));}if(_[_0xcd8b('0x2b')](_0x1a3a83['body']['mapKey'])){throw new db['Sequelize'][(_0xcd8b('0x24'))](_0xcd8b('0x2e')+_0x3ba38c);}if(!_[_0xcd8b('0x2f')](_0x3ba38c,_0x1a3a83['body'][_0xcd8b('0x30')])){throw new db[(_0xcd8b('0x23'))][(_0xcd8b('0x24'))](_0xcd8b('0x31')+_0x3ba38c);}_0x345886[_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x30')]]=_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x32')];})[_0xcd8b('0xc')](function(){return db[_0xcd8b('0x19')]['find']({'where':{'id':_0x1a3a83['account']['id']},'include':[{'model':db[_0xcd8b('0x33')],'as':_0xcd8b('0x34'),'include':[{'model':db['CmContact'],'as':_0xcd8b('0x35'),'where':_0x345886,'limit':0x1,'order':[['updatedAt',_0xcd8b('0x36')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x3ca837){if(_0x3ca837&&_0x3ca837[_0xcd8b('0x34')]){var _0x21166c=_0x3ca837[_0xcd8b('0x37')]({'plain':!![]});_0x164060['account']=_0x21166c;_0x164060[_0xcd8b('0x38')]=_0x21166c[_0xcd8b('0x39')];_0x164060[_0xcd8b('0x3a')]=_0x21166c['List'];_0x164060[_0xcd8b('0x38')]=_[_0xcd8b('0x3b')](_0x164060[_0xcd8b('0x38')],[_0xcd8b('0x3c')],['asc']);if(_0x164060[_0xcd8b('0x3d')]['Applications']){delete _0x164060[_0xcd8b('0x3d')]['Applications'];}if(_0x164060[_0xcd8b('0x3d')][_0xcd8b('0x34')]&&_0x164060[_0xcd8b('0x3d')][_0xcd8b('0x34')][_0xcd8b('0x35')][_0xcd8b('0x3e')]){return _0x164060[_0xcd8b('0x3d')][_0xcd8b('0x34')][_0xcd8b('0x35')][0x0];}var _0x12c1d3=_['defaults'](_0x1a3a83[_0xcd8b('0x2a')],{'firstName':_0x1a3a83[_0xcd8b('0x2a')]['from'],'ListId':_0x21166c[_0xcd8b('0x29')]});_0x12c1d3[_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x30')]]=_0x1a3a83[_0xcd8b('0x2a')]['from'];return db['CmContact'][_0xcd8b('0x3f')](_0x12c1d3,{'fields':_0x1e086b,'raw':!![]});}})[_0xcd8b('0xc')](function(_0x59fa3e){_0x164060[_0xcd8b('0x40')]=_0x59fa3e;if(_0x59fa3e){var _0x1d6d40={'ContactId':_0x59fa3e['id'],'FaxAccountId':_0x1a3a83[_0xcd8b('0x3d')]['id'],'fax':_0x59fa3e['fax']};return db[_0xcd8b('0x41')][_0xcd8b('0x42')]({'where':{'ContactId':_0x59fa3e['id'],'closed':![],'FaxAccountId':_0x1a3a83[_0xcd8b('0x3d')]['id']}})[_0xcd8b('0xc')](function(_0x4162f8){if(_0x4162f8){return[_0x4162f8,![]];}return db[_0xcd8b('0x41')][_0xcd8b('0x3f')](_0x1d6d40)[_0xcd8b('0xc')](function(_0x4d5786){return[_0x4d5786,!![]];});});}else{throw new Error(_0xcd8b('0x43'));}})[_0xcd8b('0x44')](function(_0x2513af,_0x3f2043){var _0x5d7c23=_0x2513af[_0xcd8b('0x37')]({'plain':!![]});if(_0x3f2043){if(_0x164060['account'][_0xcd8b('0x45')]){_0x164060[_0xcd8b('0x38')][_0xcd8b('0x46')]({'id':0x0,'priority':_0x164060[_0xcd8b('0x38')][_0xcd8b('0x3e')]+0x1,'app':_0xcd8b('0x47'),'appdata':'unmanaged','interval':_0xcd8b('0x48')});}_0x5d7c23[_0xcd8b('0x49')]=!![];}else{_0x5d7c23[_0xcd8b('0x49')]=![];}_0x164060[_0xcd8b('0x4a')]=_0x5d7c23;return db[_0xcd8b('0x4b')][_0xcd8b('0x3f')]({'body':_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x2a')],'FaxAccountId':_0x1a3a83[_0xcd8b('0x3d')]['id'],'FaxInteractionId':_0x2513af['id'],'direction':'in','ContactId':_0x2513af[_0xcd8b('0x4c')],'AttachmentId':_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x4d')]});})[_0xcd8b('0xc')](function(_0x499d45){_0x164060[_0xcd8b('0x14')]=_0x499d45;if(_0x164060['interaction'][_0xcd8b('0x4e')]){return db[_0xcd8b('0x4f')]['find']({'attributes':['id',_0xcd8b('0x50')],'where':{'id':_0x164060[_0xcd8b('0x4a')][_0xcd8b('0x4e')]}})[_0xcd8b('0xc')](function(_0x568456){if(_0x568456){_0x164060[_0xcd8b('0x38')][_0xcd8b('0x51')]({'id':0x0,'priority':0x0,'app':_0xcd8b('0x52'),'appdata':_0x568456['name']+','+(_0x164060['account'][_0xcd8b('0x53')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcd8b('0x54'),_0xcd8b('0x55'),_0x164060);});}return respondWithRpcPromise('Start',_0xcd8b('0x55'),_0x164060);})[_0xcd8b('0xc')](function(_0x3a4342){_0x1aff43(_0x3a4342);})[_0xcd8b('0x17')](function(_0x7aafcd){_0x435bb3(_0x40b1aa[_0xcd8b('0x12')](0x1f4,_0x7aafcd['message']));});});}; \ No newline at end of file +var _0xd2b4=['rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxAccount','findAll','options','raw','where','limit','include','model','map','attributes','GetFaxAccount','body','CmContact','describe','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','Applications','get','list','applications','priority','asc','Contacts','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','push','close','*,*,*,*','created','interaction','ContactId','AttachmentId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','startRouting','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x2ee790,_0x5a8661){var _0x5a54a5=function(_0x2713a4){while(--_0x2713a4){_0x2ee790['push'](_0x2ee790['shift']());}};_0x5a54a5(++_0x5a8661);}(_0xd2b4,0x163));var _0x4d2b=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0xd2b4[_0x58f245];return _0x1f0cfb;};'use strict';var _=require('lodash');var util=require(_0x4d2b('0x0'));var moment=require(_0x4d2b('0x1'));var BPromise=require(_0x4d2b('0x2'));var rs=require(_0x4d2b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d2b('0x4'));var logger=require('../../config/logger')(_0x4d2b('0x5'));var config=require(_0x4d2b('0x6'));var jayson=require(_0x4d2b('0x7'));var client=jayson[_0x4d2b('0x8')]['http']({'port':0x232c});config['redis']=_[_0x4d2b('0x9')](config[_0x4d2b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d2b('0xb'))(new Redis(config[_0x4d2b('0xa')]));require(_0x4d2b('0xc'))[_0x4d2b('0xd')](socket);function respondWithRpcPromise(_0x5cee4e,_0x44a51d,_0x4ea64d){return new BPromise(function(_0xe14bcd,_0x820c90){return client[_0x4d2b('0xe')](_0x5cee4e,_0x4ea64d)[_0x4d2b('0xf')](function(_0x9c3bcf){logger['info'](_0x4d2b('0x10'),_0x44a51d,_0x4d2b('0x11'));logger['debug'](_0x4d2b('0x12'),_0x44a51d,'request\x20sent',JSON[_0x4d2b('0x13')](_0x9c3bcf));if(_0x9c3bcf[_0x4d2b('0x14')]){if(_0x9c3bcf[_0x4d2b('0x14')][_0x4d2b('0x15')]===0x1f4){logger[_0x4d2b('0x14')]('FaxAccount,\x20%s,\x20%s',_0x44a51d,_0x9c3bcf[_0x4d2b('0x14')][_0x4d2b('0x16')]);return _0x820c90(_0x9c3bcf['error']['message']);}logger[_0x4d2b('0x14')](_0x4d2b('0x10'),_0x44a51d,_0x9c3bcf[_0x4d2b('0x14')]['message']);return _0xe14bcd(_0x9c3bcf[_0x4d2b('0x14')]['message']);}else{logger[_0x4d2b('0x17')]('FaxAccount,\x20%s,\x20%s',_0x44a51d,'request\x20sent');_0xe14bcd(_0x9c3bcf[_0x4d2b('0x18')][_0x4d2b('0x16')]);}})[_0x4d2b('0x19')](function(_0x3cc09e){logger['error']('FaxAccount,\x20%s,\x20%s',_0x44a51d,_0x3cc09e);_0x820c90(_0x3cc09e);});});}exports['GetFaxAccount']=function(_0x826828){var _0x5c22ac=this;return new Promise(function(_0x431328,_0x5e70a3){return db[_0x4d2b('0x1a')][_0x4d2b('0x1b')]({'raw':_0x826828[_0x4d2b('0x1c')]?_0x826828[_0x4d2b('0x1c')][_0x4d2b('0x1d')]===undefined?!![]:![]:!![],'where':_0x826828[_0x4d2b('0x1c')]?_0x826828['options'][_0x4d2b('0x1e')]||null:null,'attributes':_0x826828[_0x4d2b('0x1c')]?_0x826828[_0x4d2b('0x1c')]['attributes']||null:null,'limit':_0x826828[_0x4d2b('0x1c')]?_0x826828[_0x4d2b('0x1c')][_0x4d2b('0x1f')]||null:null,'include':_0x826828[_0x4d2b('0x1c')]?_0x826828[_0x4d2b('0x1c')][_0x4d2b('0x20')]?_['map'](_0x826828['options'][_0x4d2b('0x20')],function(_0xcb701b){return{'model':db[_0xcb701b[_0x4d2b('0x21')]],'as':_0xcb701b['as'],'attributes':_0xcb701b['attributes'],'include':_0xcb701b[_0x4d2b('0x20')]?_[_0x4d2b('0x22')](_0xcb701b[_0x4d2b('0x20')],function(_0x257489){return{'model':db[_0x257489['model']],'as':_0x257489['as'],'attributes':_0x257489['attributes'],'include':_0x257489[_0x4d2b('0x20')]?_[_0x4d2b('0x22')](_0x257489['include'],function(_0x41713b){return{'model':db[_0x41713b[_0x4d2b('0x21')]],'as':_0x41713b['as'],'attributes':_0x41713b[_0x4d2b('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a8ff9){logger[_0x4d2b('0x17')](_0x4d2b('0x24'),_0x826828);logger['debug']('GetFaxAccount',_0x826828,JSON['stringify'](_0x2a8ff9));_0x431328(_0x2a8ff9);})[_0x4d2b('0x19')](function(_0x5d7f77){logger['error']('GetFaxAccount',_0x5d7f77['message'],_0x826828);_0x5e70a3(_0x5c22ac[_0x4d2b('0x14')](0x1f4,_0x5d7f77[_0x4d2b('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x4636f2,_0x196bfd,_0x12d096){var _0x566cab=this;return new Promise(function(_0x62aad7,_0x1c32ea){var _0x1bba36={'body':_0x4636f2[_0x4d2b('0x25')],'channel':'fax'};var _0x1e84c9=[];var _0x2754e4=[];var _0x25a3be={};return db[_0x4d2b('0x26')][_0x4d2b('0x27')]()[_0x4d2b('0xf')](function(_0x54fc82){if(!_0x54fc82){throw new db['Sequelize']['ValidationError'](_0x4d2b('0x28'));}_0x1e84c9=_[_0x4d2b('0x29')](_[_0x4d2b('0x2a')](_0x54fc82),['createdAt',_0x4d2b('0x2b')]);_0x2754e4=_[_0x4d2b('0x29')](_[_0x4d2b('0x2a')](_0x54fc82),[_0x4d2b('0x2c'),'updatedAt','CompanyId',_0x4d2b('0x2d')]);if(_0x4636f2[_0x4d2b('0x25')]['id']){delete _0x4636f2['body']['id'];}if(_['isNil'](_0x4636f2['body'][_0x4d2b('0x2e')])){throw new db[(_0x4d2b('0x2f'))]['ValidationError'](_0x4d2b('0x30'));}if(_[_0x4d2b('0x31')](_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x25')])||_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x25')]===''){throw new db['Sequelize'][(_0x4d2b('0x32'))](_0x4d2b('0x33'));}if(_[_0x4d2b('0x31')](_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x34')])){throw new db[(_0x4d2b('0x2f'))][(_0x4d2b('0x32'))](_0x4d2b('0x35')+_0x2754e4);}if(!_[_0x4d2b('0x36')](_0x2754e4,_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x34')])){throw new db['Sequelize'][(_0x4d2b('0x32'))](_0x4d2b('0x37')+_0x2754e4);}_0x25a3be[_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x34')]]=_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x2e')];})[_0x4d2b('0xf')](function(){return db[_0x4d2b('0x1a')][_0x4d2b('0x38')]({'where':{'id':_0x4636f2[_0x4d2b('0x39')]['id']},'include':[{'model':db[_0x4d2b('0x3a')],'as':_0x4d2b('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x25a3be,'limit':0x1,'order':[['updatedAt',_0x4d2b('0x3c')]]}]},{'model':db[_0x4d2b('0x3d')],'as':_0x4d2b('0x3e')}]});})['then'](function(_0x3e97b0){if(_0x3e97b0&&_0x3e97b0['List']){var _0x3d0195=_0x3e97b0[_0x4d2b('0x3f')]({'plain':!![]});_0x1bba36[_0x4d2b('0x39')]=_0x3d0195;_0x1bba36['applications']=_0x3d0195[_0x4d2b('0x3e')];_0x1bba36[_0x4d2b('0x40')]=_0x3d0195['List'];_0x1bba36[_0x4d2b('0x41')]=_['orderBy'](_0x1bba36[_0x4d2b('0x41')],[_0x4d2b('0x42')],[_0x4d2b('0x43')]);if(_0x1bba36[_0x4d2b('0x39')][_0x4d2b('0x3e')]){delete _0x1bba36[_0x4d2b('0x39')]['Applications'];}if(_0x1bba36[_0x4d2b('0x39')][_0x4d2b('0x3b')]&&_0x1bba36['account'][_0x4d2b('0x3b')][_0x4d2b('0x44')][_0x4d2b('0x45')]){return _0x1bba36[_0x4d2b('0x39')]['List'][_0x4d2b('0x44')][0x0];}var _0x5ef1fc=_['defaults'](_0x4636f2[_0x4d2b('0x25')],{'firstName':_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x2e')],'ListId':_0x3d0195[_0x4d2b('0x2d')]});_0x5ef1fc[_0x4636f2['body'][_0x4d2b('0x34')]]=_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x2e')];return db[_0x4d2b('0x26')][_0x4d2b('0x46')](_0x5ef1fc,{'fields':_0x1e84c9,'raw':!![]});}})[_0x4d2b('0xf')](function(_0x3dfa7f){_0x1bba36[_0x4d2b('0x47')]=_0x3dfa7f;if(_0x3dfa7f){var _0xa40bbc={'ContactId':_0x3dfa7f['id'],'FaxAccountId':_0x4636f2[_0x4d2b('0x39')]['id'],'fax':_0x3dfa7f[_0x4d2b('0x48')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x3dfa7f['id'],'closed':![],'FaxAccountId':_0x4636f2[_0x4d2b('0x39')]['id']}})[_0x4d2b('0xf')](function(_0x40859c){if(_0x40859c){return[_0x40859c,![]];}return db[_0x4d2b('0x49')]['create'](_0xa40bbc)[_0x4d2b('0xf')](function(_0xa05ec6){return[_0xa05ec6,!![]];});});}else{throw new Error(_0x4d2b('0x4a'));}})[_0x4d2b('0x4b')](function(_0x193466,_0x5613be){var _0x892cfe=_0x193466['get']({'plain':!![]});if(_0x5613be){if(_0x1bba36['account']['autoclose']){_0x1bba36[_0x4d2b('0x41')][_0x4d2b('0x4c')]({'id':0x0,'priority':_0x1bba36['applications']['length']+0x1,'app':_0x4d2b('0x4d'),'appdata':'unmanaged','interval':_0x4d2b('0x4e')});}_0x892cfe[_0x4d2b('0x4f')]=!![];}else{_0x892cfe[_0x4d2b('0x4f')]=![];}_0x1bba36[_0x4d2b('0x50')]=_0x892cfe;return db['FaxMessage'][_0x4d2b('0x46')]({'body':_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x25')],'FaxAccountId':_0x4636f2[_0x4d2b('0x39')]['id'],'FaxInteractionId':_0x193466['id'],'direction':'in','ContactId':_0x193466[_0x4d2b('0x51')],'AttachmentId':_0x4636f2[_0x4d2b('0x25')][_0x4d2b('0x52')]});})[_0x4d2b('0xf')](function(_0x53d997){_0x1bba36[_0x4d2b('0x16')]=_0x53d997;if(_0x1bba36['interaction']['UserId']){return db[_0x4d2b('0x53')][_0x4d2b('0x38')]({'attributes':['id','name'],'where':{'id':_0x1bba36[_0x4d2b('0x50')][_0x4d2b('0x54')]}})[_0x4d2b('0xf')](function(_0x5db2e4){if(_0x5db2e4){_0x1bba36[_0x4d2b('0x41')][_0x4d2b('0x55')]({'id':0x0,'priority':0x0,'app':_0x4d2b('0x56'),'appdata':_0x5db2e4[_0x4d2b('0x57')]+','+(_0x1bba36[_0x4d2b('0x39')][_0x4d2b('0x58')]||0xa),'interval':_0x4d2b('0x4e')});}return respondWithRpcPromise('Start','startRouting',_0x1bba36);});}return respondWithRpcPromise('Start',_0x4d2b('0x59'),_0x1bba36);})[_0x4d2b('0xf')](function(_0x3e86de){_0x62aad7(_0x3e86de);})['catch'](function(_0x3bb999){_0x1c32ea(_0x566cab[_0x4d2b('0x14')](0x1f4,_0x3bb999[_0x4d2b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c57e8c7..a50cd09 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 _0x645f=['emit','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x1bfbef,_0x41ae01){var _0x360503=function(_0x59576c){while(--_0x59576c){_0x1bfbef['push'](_0x1bfbef['shift']());}};_0x360503(++_0x41ae01);}(_0x645f,0x194));var _0xf645=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x645f[_0x122ef9];return _0x42fba0;};'use strict';var FaxAccountEvents=require(_0xf645('0x0'));var events=[_0xf645('0x1'),_0xf645('0x2'),_0xf645('0x3')];function createListener(_0x43e2fa,_0x2fb562){return function(_0x7e730a){_0x2fb562[_0xf645('0x4')](_0x43e2fa,_0x7e730a);};}function removeListener(_0x47b2f9,_0x34fb28){return function(){FaxAccountEvents['removeListener'](_0x47b2f9,_0x34fb28);};}exports[_0xf645('0x5')]=function(_0x1108e5){for(var _0x45ac4f=0x0,_0x1d89c6=events[_0xf645('0x6')];_0x45ac4f<_0x1d89c6;_0x45ac4f++){var _0x2ae65a=events[_0x45ac4f];var _0x530e58=createListener(_0xf645('0x7')+_0x2ae65a,_0x1108e5);FaxAccountEvents['on'](_0x2ae65a,_0x530e58);}}; \ No newline at end of file +var _0xca89=['faxAccount:','./faxAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xca89,0x189));var _0x9ca8=function(_0x4bdd8e,_0x36b5a2){_0x4bdd8e=_0x4bdd8e-0x0;var _0xee856=_0xca89[_0x4bdd8e];return _0xee856;};'use strict';var FaxAccountEvents=require(_0x9ca8('0x0'));var events=[_0x9ca8('0x1'),_0x9ca8('0x2'),'update'];function createListener(_0x31b48a,_0x2dd8b9){return function(_0x3dff66){_0x2dd8b9[_0x9ca8('0x3')](_0x31b48a,_0x3dff66);};}function removeListener(_0x291267,_0x39c436){return function(){FaxAccountEvents[_0x9ca8('0x4')](_0x291267,_0x39c436);};}exports[_0x9ca8('0x5')]=function(_0x4e264d){for(var _0x30f7da=0x0,_0x266e7e=events[_0x9ca8('0x6')];_0x30f7da<_0x266e7e;_0x30f7da++){var _0x2fad1d=events[_0x30f7da];var _0x4a711d=createListener(_0x9ca8('0x7')+_0x2fad1d,_0x4e264d);FaxAccountEvents['on'](_0x2fad1d,_0x4a711d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 48fdfd5..97f160a 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x4f5a01,_0x590de4){var _0x3c882a=function(_0x260482){while(--_0x260482){_0x4f5a01['push'](_0x4f5a01['shift']());}};_0x3c882a(++_0x590de4);}(_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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5346fd,_0x403746){var _0x42bef8=function(_0x32df87){while(--_0x32df87){_0x5346fd['push'](_0x5346fd['shift']());}};_0x42bef8(++_0x403746);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 2e741f0..88c8ea8 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 _0xe350=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xe350,0x1c9));var _0x0e35=function(_0x284c2c,_0x46553){_0x284c2c=_0x284c2c-0x0;var _0x266db2=_0xe350[_0x284c2c];return _0x266db2;};'use strict';var Sequelize=require(_0x0e35('0x0'));module[_0x0e35('0x1')]={'priority':{'type':Sequelize[_0x0e35('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0e35('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0e35('0x4')],'defaultValue':_0x0e35('0x5')}}; \ No newline at end of file +var _0xffee=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5756a9,_0x27ea13){var _0x274a8e=function(_0x437e17){while(--_0x437e17){_0x5756a9['push'](_0x5756a9['shift']());}};_0x274a8e(++_0x27ea13);}(_0xffee,0x131));var _0xeffe=function(_0x48ee45,_0x5430e8){_0x48ee45=_0x48ee45-0x0;var _0x9037ec=_0xffee[_0x48ee45];return _0x9037ec;};'use strict';var Sequelize=require(_0xeffe('0x0'));module['exports']={'priority':{'type':Sequelize[_0xeffe('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xeffe('0x2')],'allowNull':![],'defaultValue':_0xeffe('0x3')},'appdata':{'type':Sequelize[_0xeffe('0x4')]()},'description':{'type':Sequelize[_0xeffe('0x2')]},'interval':{'type':Sequelize[_0xeffe('0x2')],'defaultValue':_0xeffe('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index dd1d106..bbbf6ac 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 _0x0f5f=['apply','update','destroy','then','end','error','stack','name','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','catch','includeAll','find','create','body','params','eml-format','zip-dir','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x1fcbd8,_0x9da9aa){var _0x3ad2aa=function(_0x35d98d){while(--_0x35d98d){_0x1fcbd8['push'](_0x1fcbd8['shift']());}};_0x3ad2aa(++_0x9da9aa);}(_0x0f5f,0x153));var _0xf0f5=function(_0x577ff1,_0x377206){_0x577ff1=_0x577ff1-0x0;var _0x527bd9=_0x0f5f[_0x577ff1];return _0x527bd9;};'use strict';var emlformat=require(_0xf0f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0f5('0x2'));var moment=require(_0xf0f5('0x3'));var BPromise=require(_0xf0f5('0x4'));var Mustache=require(_0xf0f5('0x5'));var util=require(_0xf0f5('0x6'));var path=require(_0xf0f5('0x7'));var sox=require(_0xf0f5('0x8'));var csv=require(_0xf0f5('0x9'));var ejs=require(_0xf0f5('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f5('0xb'));var _=require(_0xf0f5('0xc'));var squel=require(_0xf0f5('0xd'));var crypto=require(_0xf0f5('0xe'));var jsforce=require(_0xf0f5('0xf'));var deskjs=require(_0xf0f5('0x10'));var toCsv=require(_0xf0f5('0x9'));var querystring=require(_0xf0f5('0x11'));var Papa=require(_0xf0f5('0x12'));var Redis=require(_0xf0f5('0x13'));var authService=require(_0xf0f5('0x14'));var qs=require(_0xf0f5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0f5('0x16'))(_0xf0f5('0x17'));var utils=require(_0xf0f5('0x18'));var config=require(_0xf0f5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0f5('0x1a'))['db'];function respondWithStatusCode(_0x491e4e,_0xd16317){_0xd16317=_0xd16317||0xcc;return function(_0x39baaa){if(_0x39baaa){return _0x491e4e[_0xf0f5('0x1b')](_0xd16317);}return _0x491e4e[_0xf0f5('0x1c')](_0xd16317)['end']();};}function respondWithResult(_0x3f220c,_0x1f6d66){_0x1f6d66=_0x1f6d66||0xc8;return function(_0x23b63){if(_0x23b63){return _0x3f220c[_0xf0f5('0x1c')](_0x1f6d66)[_0xf0f5('0x1d')](_0x23b63);}};}function respondWithFilteredResult(_0x102c45,_0x3b35b3){return function(_0x49726f){if(_0x49726f){var _0x34ea92=typeof _0x3b35b3[_0xf0f5('0x1e')]===_0xf0f5('0x1f')&&typeof _0x3b35b3[_0xf0f5('0x20')]===_0xf0f5('0x1f');var _0x26aa35=_0x49726f[_0xf0f5('0x21')];var _0x4ecdb1=_0x34ea92?0x0:_0x3b35b3['offset'];var _0xc4ca0=_0x34ea92?_0x49726f[_0xf0f5('0x21')]:_0x3b35b3[_0xf0f5('0x1e')]+_0x3b35b3[_0xf0f5('0x20')];var _0x3dab79;if(_0xc4ca0>=_0x26aa35){_0xc4ca0=_0x26aa35;_0x3dab79=0xc8;}else{_0x3dab79=0xce;}_0x102c45['status'](_0x3dab79);return _0x102c45[_0xf0f5('0x22')](_0xf0f5('0x23'),_0x4ecdb1+'-'+_0xc4ca0+'/'+_0x26aa35)[_0xf0f5('0x1d')](_0x49726f);}return null;};}function patchUpdates(_0x21fb1d){return function(_0x252075){try{jsonpatch[_0xf0f5('0x24')](_0x252075,_0x21fb1d,!![]);}catch(_0x55d846){return BPromise['reject'](_0x55d846);}return _0x252075['save']();};}function saveUpdates(_0x42142d,_0x41c700){return function(_0x2d6d6e){if(_0x2d6d6e){return _0x2d6d6e[_0xf0f5('0x25')](_0x42142d)['then'](function(_0x258809){return _0x258809;});}return null;};}function removeEntity(_0x2b245c,_0x20ea06){return function(_0x1ed8b4){if(_0x1ed8b4){return _0x1ed8b4[_0xf0f5('0x26')]()[_0xf0f5('0x27')](function(){_0x2b245c['status'](0xcc)[_0xf0f5('0x28')]();});}};}function handleEntityNotFound(_0x239230,_0x1561ce){return function(_0x520a35){if(!_0x520a35){_0x239230[_0xf0f5('0x1b')](0x194);}return _0x520a35;};}function handleError(_0x13a212,_0x1bfec0){_0x1bfec0=_0x1bfec0||0x1f4;return function(_0x131f0b){logger[_0xf0f5('0x29')](_0x131f0b[_0xf0f5('0x2a')]);if(_0x131f0b[_0xf0f5('0x2b')]){delete _0x131f0b[_0xf0f5('0x2b')];}_0x13a212[_0xf0f5('0x1c')](_0x1bfec0)['send'](_0x131f0b);};}exports['index']=function(_0x4fa71f,_0x192a5c){var _0x43002b={},_0x1fe6de={},_0x1c9286={'count':0x0,'rows':[]};var _0x485304=_[_0xf0f5('0x2c')](db[_0xf0f5('0x2d')][_0xf0f5('0x2e')],function(_0x2c5896){return{'name':_0x2c5896[_0xf0f5('0x2f')],'type':_0x2c5896[_0xf0f5('0x30')][_0xf0f5('0x31')]};});_0x1fe6de[_0xf0f5('0x32')]=_[_0xf0f5('0x2c')](_0x485304,_0xf0f5('0x2b'));_0x1fe6de['query']=_[_0xf0f5('0x33')](_0x4fa71f['query']);_0x1fe6de[_0xf0f5('0x34')]=_[_0xf0f5('0x35')](_0x1fe6de[_0xf0f5('0x32')],_0x1fe6de[_0xf0f5('0x36')]);_0x43002b[_0xf0f5('0x37')]=_[_0xf0f5('0x35')](_0x1fe6de[_0xf0f5('0x32')],qs[_0xf0f5('0x38')](_0x4fa71f[_0xf0f5('0x36')]['fields']));_0x43002b[_0xf0f5('0x37')]=_0x43002b['attributes'][_0xf0f5('0x39')]?_0x43002b[_0xf0f5('0x37')]:_0x1fe6de[_0xf0f5('0x32')];if(!_0x4fa71f[_0xf0f5('0x36')][_0xf0f5('0x3a')](_0xf0f5('0x3b'))){_0x43002b[_0xf0f5('0x20')]=qs[_0xf0f5('0x20')](_0x4fa71f['query']['limit']);_0x43002b['offset']=qs[_0xf0f5('0x1e')](_0x4fa71f[_0xf0f5('0x36')]['offset']);}_0x43002b[_0xf0f5('0x3c')]=qs[_0xf0f5('0x3d')](_0x4fa71f[_0xf0f5('0x36')][_0xf0f5('0x3d')]);_0x43002b[_0xf0f5('0x3e')]=qs[_0xf0f5('0x34')](_['pick'](_0x4fa71f['query'],_0x1fe6de[_0xf0f5('0x34')]),_0x485304);if(_0x4fa71f['query']['filter']){_0x43002b[_0xf0f5('0x3e')]=_['merge'](_0x43002b['where'],{'$or':_[_0xf0f5('0x2c')](_0x485304,function(_0x5be44a){if(_0x5be44a['type']!==_0xf0f5('0x3f')){var _0x5861c2={};_0x5861c2[_0x5be44a['name']]={'$like':'%'+_0x4fa71f[_0xf0f5('0x36')][_0xf0f5('0x40')]+'%'};return _0x5861c2;}})});}_0x43002b=_[_0xf0f5('0x41')]({},_0x43002b,_0x4fa71f[_0xf0f5('0x42')]);var _0xf3debc={'where':_0x43002b[_0xf0f5('0x3e')]};return db['FaxApplication'][_0xf0f5('0x21')](_0xf3debc)[_0xf0f5('0x27')](function(_0x280268){_0x1c9286[_0xf0f5('0x21')]=_0x280268;if(_0x4fa71f['query']['includeAll']){_0x43002b[_0xf0f5('0x43')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x43002b);})['then'](function(_0x157a37){_0x1c9286[_0xf0f5('0x44')]=_0x157a37;return _0x1c9286;})['then'](respondWithFilteredResult(_0x192a5c,_0x43002b))[_0xf0f5('0x45')](handleError(_0x192a5c,null));};exports['show']=function(_0x407345,_0xd7f29f){var _0x5b2455={'raw':!![],'where':{'id':_0x407345['params']['id']}},_0x4cc9df={};_0x4cc9df[_0xf0f5('0x32')]=_['keys'](db[_0xf0f5('0x2d')][_0xf0f5('0x2e')]);_0x4cc9df[_0xf0f5('0x36')]=_[_0xf0f5('0x33')](_0x407345[_0xf0f5('0x36')]);_0x4cc9df[_0xf0f5('0x34')]=_[_0xf0f5('0x35')](_0x4cc9df[_0xf0f5('0x32')],_0x4cc9df['query']);_0x5b2455['attributes']=_[_0xf0f5('0x35')](_0x4cc9df[_0xf0f5('0x32')],qs['fields'](_0x407345[_0xf0f5('0x36')][_0xf0f5('0x38')]));_0x5b2455[_0xf0f5('0x37')]=_0x5b2455[_0xf0f5('0x37')][_0xf0f5('0x39')]?_0x5b2455[_0xf0f5('0x37')]:_0x4cc9df['model'];if(_0x407345[_0xf0f5('0x36')][_0xf0f5('0x46')]){_0x5b2455['include']=[{'all':!![]}];}_0x5b2455=_[_0xf0f5('0x41')]({},_0x5b2455,_0x407345[_0xf0f5('0x42')]);return db[_0xf0f5('0x2d')][_0xf0f5('0x47')](_0x5b2455)[_0xf0f5('0x27')](handleEntityNotFound(_0xd7f29f,null))[_0xf0f5('0x27')](respondWithResult(_0xd7f29f,null))[_0xf0f5('0x45')](handleError(_0xd7f29f,null));};exports[_0xf0f5('0x48')]=function(_0x5ad953,_0x2abc67){return db[_0xf0f5('0x2d')][_0xf0f5('0x48')](_0x5ad953[_0xf0f5('0x49')],{})['then'](respondWithResult(_0x2abc67,0xc9))[_0xf0f5('0x45')](handleError(_0x2abc67,null));};exports[_0xf0f5('0x25')]=function(_0x5b6889,_0x3e5484){if(_0x5b6889[_0xf0f5('0x49')]['id']){delete _0x5b6889[_0xf0f5('0x49')]['id'];}return db['FaxApplication'][_0xf0f5('0x47')]({'where':{'id':_0x5b6889[_0xf0f5('0x4a')]['id']}})[_0xf0f5('0x27')](handleEntityNotFound(_0x3e5484,null))[_0xf0f5('0x27')](saveUpdates(_0x5b6889[_0xf0f5('0x49')],null))[_0xf0f5('0x27')](respondWithResult(_0x3e5484,null))[_0xf0f5('0x45')](handleError(_0x3e5484,null));};exports[_0xf0f5('0x26')]=function(_0x5642bf,_0x44009c){return db['FaxApplication'][_0xf0f5('0x47')]({'where':{'id':_0x5642bf[_0xf0f5('0x4a')]['id']}})[_0xf0f5('0x27')](handleEntityNotFound(_0x44009c,null))['then'](removeEntity(_0x44009c,null))['catch'](handleError(_0x44009c,null));}; \ No newline at end of file +var _0x9cce=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','includeAll','include','FaxApplication','findAll','rows','catch','params','keys','rawAttributes','create','body','find','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x461749,_0x59f1f3){var _0x339dd6=function(_0x11d289){while(--_0x11d289){_0x461749['push'](_0x461749['shift']());}};_0x339dd6(++_0x59f1f3);}(_0x9cce,0x1ee));var _0xe9cc=function(_0x4cea40,_0x53f3a2){_0x4cea40=_0x4cea40-0x0;var _0x5a830a=_0x9cce[_0x4cea40];return _0x5a830a;};'use strict';var emlformat=require(_0xe9cc('0x0'));var rimraf=require(_0xe9cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe9cc('0x2'));var BPromise=require(_0xe9cc('0x3'));var Mustache=require(_0xe9cc('0x4'));var util=require(_0xe9cc('0x5'));var path=require(_0xe9cc('0x6'));var sox=require('sox');var csv=require(_0xe9cc('0x7'));var ejs=require(_0xe9cc('0x8'));var fs=require('fs');var fs_extra=require(_0xe9cc('0x9'));var _=require(_0xe9cc('0xa'));var squel=require(_0xe9cc('0xb'));var crypto=require('crypto');var jsforce=require(_0xe9cc('0xc'));var deskjs=require(_0xe9cc('0xd'));var toCsv=require(_0xe9cc('0x7'));var querystring=require(_0xe9cc('0xe'));var Papa=require(_0xe9cc('0xf'));var Redis=require('ioredis');var authService=require(_0xe9cc('0x10'));var qs=require(_0xe9cc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9cc('0x12'));var logger=require(_0xe9cc('0x13'))('api');var utils=require(_0xe9cc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe9cc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x63953a,_0x475089){_0x475089=_0x475089||0xcc;return function(_0x4518f4){if(_0x4518f4){return _0x63953a[_0xe9cc('0x16')](_0x475089);}return _0x63953a[_0xe9cc('0x17')](_0x475089)[_0xe9cc('0x18')]();};}function respondWithResult(_0x4d2f4d,_0x4d1f71){_0x4d1f71=_0x4d1f71||0xc8;return function(_0x185fd2){if(_0x185fd2){return _0x4d2f4d[_0xe9cc('0x17')](_0x4d1f71)[_0xe9cc('0x19')](_0x185fd2);}};}function respondWithFilteredResult(_0x391220,_0x51677a){return function(_0x19a459){if(_0x19a459){var _0x1103b1=typeof _0x51677a['offset']===_0xe9cc('0x1a')&&typeof _0x51677a[_0xe9cc('0x1b')]==='undefined';var _0x22d092=_0x19a459[_0xe9cc('0x1c')];var _0x1f7a3c=_0x1103b1?0x0:_0x51677a[_0xe9cc('0x1d')];var _0x187667=_0x1103b1?_0x19a459[_0xe9cc('0x1c')]:_0x51677a[_0xe9cc('0x1d')]+_0x51677a[_0xe9cc('0x1b')];var _0x549756;if(_0x187667>=_0x22d092){_0x187667=_0x22d092;_0x549756=0xc8;}else{_0x549756=0xce;}_0x391220[_0xe9cc('0x17')](_0x549756);return _0x391220['set'](_0xe9cc('0x1e'),_0x1f7a3c+'-'+_0x187667+'/'+_0x22d092)[_0xe9cc('0x19')](_0x19a459);}return null;};}function patchUpdates(_0x253114){return function(_0x25a2dd){try{jsonpatch[_0xe9cc('0x1f')](_0x25a2dd,_0x253114,!![]);}catch(_0x21f878){return BPromise[_0xe9cc('0x20')](_0x21f878);}return _0x25a2dd[_0xe9cc('0x21')]();};}function saveUpdates(_0x5a02dd,_0x209e20){return function(_0x5a5e81){if(_0x5a5e81){return _0x5a5e81[_0xe9cc('0x22')](_0x5a02dd)[_0xe9cc('0x23')](function(_0x7adb67){return _0x7adb67;});}return null;};}function removeEntity(_0x136955,_0x7e997d){return function(_0x14c24e){if(_0x14c24e){return _0x14c24e[_0xe9cc('0x24')]()[_0xe9cc('0x23')](function(){_0x136955['status'](0xcc)[_0xe9cc('0x18')]();});}};}function handleEntityNotFound(_0x49c5ea,_0xebf390){return function(_0x2916bc){if(!_0x2916bc){_0x49c5ea[_0xe9cc('0x16')](0x194);}return _0x2916bc;};}function handleError(_0x1337ea,_0x51434b){_0x51434b=_0x51434b||0x1f4;return function(_0x1d67fc){logger[_0xe9cc('0x25')](_0x1d67fc[_0xe9cc('0x26')]);if(_0x1d67fc[_0xe9cc('0x27')]){delete _0x1d67fc[_0xe9cc('0x27')];}_0x1337ea[_0xe9cc('0x17')](_0x51434b)[_0xe9cc('0x28')](_0x1d67fc);};}exports[_0xe9cc('0x29')]=function(_0xa0ecdb,_0x22eefc){var _0x586a57={},_0x1df2e6={},_0x1c5489={'count':0x0,'rows':[]};var _0x38a99f=_['map'](db['FaxApplication']['rawAttributes'],function(_0x5e6dc2){return{'name':_0x5e6dc2['fieldName'],'type':_0x5e6dc2['type'][_0xe9cc('0x2a')]};});_0x1df2e6[_0xe9cc('0x2b')]=_[_0xe9cc('0x2c')](_0x38a99f,'name');_0x1df2e6[_0xe9cc('0x2d')]=_['keys'](_0xa0ecdb[_0xe9cc('0x2d')]);_0x1df2e6[_0xe9cc('0x2e')]=_[_0xe9cc('0x2f')](_0x1df2e6[_0xe9cc('0x2b')],_0x1df2e6[_0xe9cc('0x2d')]);_0x586a57[_0xe9cc('0x30')]=_[_0xe9cc('0x2f')](_0x1df2e6[_0xe9cc('0x2b')],qs[_0xe9cc('0x31')](_0xa0ecdb[_0xe9cc('0x2d')][_0xe9cc('0x31')]));_0x586a57['attributes']=_0x586a57[_0xe9cc('0x30')][_0xe9cc('0x32')]?_0x586a57[_0xe9cc('0x30')]:_0x1df2e6[_0xe9cc('0x2b')];if(!_0xa0ecdb[_0xe9cc('0x2d')][_0xe9cc('0x33')](_0xe9cc('0x34'))){_0x586a57['limit']=qs[_0xe9cc('0x1b')](_0xa0ecdb[_0xe9cc('0x2d')][_0xe9cc('0x1b')]);_0x586a57[_0xe9cc('0x1d')]=qs[_0xe9cc('0x1d')](_0xa0ecdb[_0xe9cc('0x2d')][_0xe9cc('0x1d')]);}_0x586a57[_0xe9cc('0x35')]=qs['sort'](_0xa0ecdb[_0xe9cc('0x2d')][_0xe9cc('0x36')]);_0x586a57['where']=qs[_0xe9cc('0x2e')](_[_0xe9cc('0x37')](_0xa0ecdb[_0xe9cc('0x2d')],_0x1df2e6['filters']),_0x38a99f);if(_0xa0ecdb[_0xe9cc('0x2d')]['filter']){_0x586a57[_0xe9cc('0x38')]=_['merge'](_0x586a57[_0xe9cc('0x38')],{'$or':_[_0xe9cc('0x2c')](_0x38a99f,function(_0x3dca8a){if(_0x3dca8a[_0xe9cc('0x39')]!==_0xe9cc('0x3a')){var _0x49664c={};_0x49664c[_0x3dca8a[_0xe9cc('0x27')]]={'$like':'%'+_0xa0ecdb[_0xe9cc('0x2d')][_0xe9cc('0x3b')]+'%'};return _0x49664c;}})});}_0x586a57=_[_0xe9cc('0x3c')]({},_0x586a57,_0xa0ecdb['options']);var _0x514cbf={'where':_0x586a57[_0xe9cc('0x38')]};return db['FaxApplication'][_0xe9cc('0x1c')](_0x514cbf)[_0xe9cc('0x23')](function(_0x2fc2ad){_0x1c5489[_0xe9cc('0x1c')]=_0x2fc2ad;if(_0xa0ecdb[_0xe9cc('0x2d')][_0xe9cc('0x3d')]){_0x586a57[_0xe9cc('0x3e')]=[{'all':!![]}];}return db[_0xe9cc('0x3f')][_0xe9cc('0x40')](_0x586a57);})[_0xe9cc('0x23')](function(_0x464927){_0x1c5489[_0xe9cc('0x41')]=_0x464927;return _0x1c5489;})[_0xe9cc('0x23')](respondWithFilteredResult(_0x22eefc,_0x586a57))[_0xe9cc('0x42')](handleError(_0x22eefc,null));};exports['show']=function(_0x1f6032,_0x9715ee){var _0xc5b754={'raw':!![],'where':{'id':_0x1f6032[_0xe9cc('0x43')]['id']}},_0x348ddb={};_0x348ddb['model']=_[_0xe9cc('0x44')](db[_0xe9cc('0x3f')][_0xe9cc('0x45')]);_0x348ddb[_0xe9cc('0x2d')]=_[_0xe9cc('0x44')](_0x1f6032['query']);_0x348ddb[_0xe9cc('0x2e')]=_[_0xe9cc('0x2f')](_0x348ddb[_0xe9cc('0x2b')],_0x348ddb['query']);_0xc5b754['attributes']=_[_0xe9cc('0x2f')](_0x348ddb[_0xe9cc('0x2b')],qs[_0xe9cc('0x31')](_0x1f6032[_0xe9cc('0x2d')][_0xe9cc('0x31')]));_0xc5b754['attributes']=_0xc5b754['attributes']['length']?_0xc5b754[_0xe9cc('0x30')]:_0x348ddb['model'];if(_0x1f6032[_0xe9cc('0x2d')]['includeAll']){_0xc5b754[_0xe9cc('0x3e')]=[{'all':!![]}];}_0xc5b754=_[_0xe9cc('0x3c')]({},_0xc5b754,_0x1f6032['options']);return db[_0xe9cc('0x3f')]['find'](_0xc5b754)[_0xe9cc('0x23')](handleEntityNotFound(_0x9715ee,null))['then'](respondWithResult(_0x9715ee,null))['catch'](handleError(_0x9715ee,null));};exports[_0xe9cc('0x46')]=function(_0x7b24cf,_0x26171e){return db[_0xe9cc('0x3f')][_0xe9cc('0x46')](_0x7b24cf['body'],{})[_0xe9cc('0x23')](respondWithResult(_0x26171e,0xc9))[_0xe9cc('0x42')](handleError(_0x26171e,null));};exports[_0xe9cc('0x22')]=function(_0x3d0b7b,_0x512a42){if(_0x3d0b7b[_0xe9cc('0x47')]['id']){delete _0x3d0b7b[_0xe9cc('0x47')]['id'];}return db[_0xe9cc('0x3f')][_0xe9cc('0x48')]({'where':{'id':_0x3d0b7b[_0xe9cc('0x43')]['id']}})[_0xe9cc('0x23')](handleEntityNotFound(_0x512a42,null))[_0xe9cc('0x23')](saveUpdates(_0x3d0b7b[_0xe9cc('0x47')],null))['then'](respondWithResult(_0x512a42,null))[_0xe9cc('0x42')](handleError(_0x512a42,null));};exports[_0xe9cc('0x24')]=function(_0x2c0423,_0x2d10f4){return db[_0xe9cc('0x3f')][_0xe9cc('0x48')]({'where':{'id':_0x2c0423[_0xe9cc('0x43')]['id']}})[_0xe9cc('0x23')](handleEntityNotFound(_0x2d10f4,null))[_0xe9cc('0x23')](removeEntity(_0x2d10f4,null))[_0xe9cc('0x42')](handleError(_0x2d10f4,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6925cfa..0a34290 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 _0x4e64=['../../config/logger','api','moment','bluebird','path','rimraf','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','lodash','util'];(function(_0x372433,_0xb55d02){var _0x375ac3=function(_0x1c1d22){while(--_0x1c1d22){_0x372433['push'](_0x372433['shift']());}};_0x375ac3(++_0xb55d02);}(_0x4e64,0xb2));var _0x44e6=function(_0x3f6d50,_0x2b09ba){_0x3f6d50=_0x3f6d50-0x0;var _0x41c69f=_0x4e64[_0x3f6d50];return _0x41c69f;};'use strict';var _=require(_0x44e6('0x0'));var util=require(_0x44e6('0x1'));var logger=require(_0x44e6('0x2'))(_0x44e6('0x3'));var moment=require(_0x44e6('0x4'));var BPromise=require(_0x44e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44e6('0x6'));var rimraf=require(_0x44e6('0x7'));var config=require('../../config/environment');var attributes=require(_0x44e6('0x8'));module['exports']=function(_0x35bf52,_0x2b8737){return _0x35bf52['define'](_0x44e6('0x9'),attributes,{'tableName':_0x44e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44e6('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf7d7=['exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf7d7,0x75));var _0x7f7d=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf7d7[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x7f7d('0x0'));var util=require(_0x7f7d('0x1'));var logger=require(_0x7f7d('0x2'))(_0x7f7d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7f7d('0x4'));var fs=require('fs');var path=require(_0x7f7d('0x5'));var rimraf=require(_0x7f7d('0x6'));var config=require(_0x7f7d('0x7'));var attributes=require(_0x7f7d('0x8'));module[_0x7f7d('0x9')]=function(_0x38f15c,_0xd87d86){return _0x38f15c[_0x7f7d('0xa')](_0x7f7d('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f7d('0xc'),'collate':_0x7f7d('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5d32b05..2698b07 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 _0x260f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','lodash','util','bluebird'];(function(_0x526a61,_0x1fe433){var _0x29b6ee=function(_0x2eb234){while(--_0x2eb234){_0x526a61['push'](_0x526a61['shift']());}};_0x29b6ee(++_0x1fe433);}(_0x260f,0xfd));var _0xf260=function(_0x360f77,_0x2c095e){_0x360f77=_0x360f77-0x0;var _0x77e350=_0x260f[_0x360f77];return _0x77e350;};'use strict';var _=require(_0xf260('0x0'));var util=require(_0xf260('0x1'));var moment=require('moment');var BPromise=require(_0xf260('0x2'));var rs=require(_0xf260('0x3'));var fs=require('fs');var Redis=require(_0xf260('0x4'));var db=require(_0xf260('0x5'))['db'];var utils=require(_0xf260('0x6'));var logger=require(_0xf260('0x7'))(_0xf260('0x8'));var config=require(_0xf260('0x9'));var jayson=require(_0xf260('0xa'));var client=jayson[_0xf260('0xb')][_0xf260('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58c05c,_0x4e6157,_0x514d72){return new BPromise(function(_0x1fd4b0,_0x432bbc){return client[_0xf260('0xd')](_0x58c05c,_0x514d72)[_0xf260('0xe')](function(_0x3e0fea){logger['info'](_0xf260('0xf'),_0x4e6157,_0xf260('0x10'));logger[_0xf260('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4e6157,_0xf260('0x10'),JSON[_0xf260('0x12')](_0x3e0fea));if(_0x3e0fea[_0xf260('0x13')]){if(_0x3e0fea['error']['code']===0x1f4){logger[_0xf260('0x13')](_0xf260('0xf'),_0x4e6157,_0x3e0fea[_0xf260('0x13')][_0xf260('0x14')]);return _0x432bbc(_0x3e0fea[_0xf260('0x13')][_0xf260('0x14')]);}logger[_0xf260('0x13')](_0xf260('0xf'),_0x4e6157,_0x3e0fea[_0xf260('0x13')]['message']);return _0x1fd4b0(_0x3e0fea[_0xf260('0x13')][_0xf260('0x14')]);}else{logger[_0xf260('0x15')](_0xf260('0xf'),_0x4e6157,_0xf260('0x10'));_0x1fd4b0(_0x3e0fea[_0xf260('0x16')]['message']);}})[_0xf260('0x17')](function(_0x5e5d9a){logger['error'](_0xf260('0xf'),_0x4e6157,_0x5e5d9a);_0x432bbc(_0x5e5d9a);});});}exports[_0xf260('0x18')]=function(_0x2f8714){var _0x550de6=this;return new Promise(function(_0x3aa06d,_0x2805f4){return db[_0xf260('0x19')][_0xf260('0x1a')](_0x2f8714[_0xf260('0x1b')],{'raw':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')][_0xf260('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')][_0xf260('0x1e')]||null:null,'attributes':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')]['attributes']||null:null,'limit':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')][_0xf260('0x1f')]||null:null})[_0xf260('0xe')](function(_0x52d220){logger[_0xf260('0x15')]('UpdateFaxApplication',_0x2f8714);logger['debug'](_0xf260('0x18'),_0x2f8714,JSON['stringify'](_0x52d220));_0x3aa06d(_0x52d220);})[_0xf260('0x17')](function(_0x223338){logger[_0xf260('0x13')](_0xf260('0x18'),_0x223338[_0xf260('0x14')],_0x2f8714);_0x2805f4(_0x550de6[_0xf260('0x13')](0x1f4,_0x223338['message']));});});}; \ No newline at end of file +var _0xc95c=['where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','info','request\x20sent','debug','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw'];(function(_0x56359d,_0x175869){var _0x40a5a0=function(_0x394691){while(--_0x394691){_0x56359d['push'](_0x56359d['shift']());}};_0x40a5a0(++_0x175869);}(_0xc95c,0x130));var _0xcc95=function(_0x4e3a94,_0x65c4da){_0x4e3a94=_0x4e3a94-0x0;var _0x315aca=_0xc95c[_0x4e3a94];return _0x315aca;};'use strict';var _=require(_0xcc95('0x0'));var util=require(_0xcc95('0x1'));var moment=require(_0xcc95('0x2'));var BPromise=require(_0xcc95('0x3'));var rs=require(_0xcc95('0x4'));var fs=require('fs');var Redis=require(_0xcc95('0x5'));var db=require(_0xcc95('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc95('0x7'))('rpc');var config=require(_0xcc95('0x8'));var jayson=require(_0xcc95('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290da6,_0x39eb8c,_0x5b8016){return new BPromise(function(_0x548269,_0x32c480){return client['request'](_0x290da6,_0x5b8016)[_0xcc95('0xa')](function(_0x123c36){logger[_0xcc95('0xb')]('FaxApplication,\x20%s,\x20%s',_0x39eb8c,_0xcc95('0xc'));logger[_0xcc95('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x39eb8c,_0xcc95('0xc'),JSON['stringify'](_0x123c36));if(_0x123c36[_0xcc95('0xe')]){if(_0x123c36['error'][_0xcc95('0xf')]===0x1f4){logger[_0xcc95('0xe')](_0xcc95('0x10'),_0x39eb8c,_0x123c36[_0xcc95('0xe')][_0xcc95('0x11')]);return _0x32c480(_0x123c36[_0xcc95('0xe')][_0xcc95('0x11')]);}logger[_0xcc95('0xe')](_0xcc95('0x10'),_0x39eb8c,_0x123c36['error']['message']);return _0x548269(_0x123c36[_0xcc95('0xe')][_0xcc95('0x11')]);}else{logger[_0xcc95('0xb')](_0xcc95('0x10'),_0x39eb8c,_0xcc95('0xc'));_0x548269(_0x123c36[_0xcc95('0x12')][_0xcc95('0x11')]);}})[_0xcc95('0x13')](function(_0x55113b){logger['error'](_0xcc95('0x10'),_0x39eb8c,_0x55113b);_0x32c480(_0x55113b);});});}exports[_0xcc95('0x14')]=function(_0x1af89e){var _0x1e8f9c=this;return new Promise(function(_0x5dce93,_0x396f2f){return db[_0xcc95('0x15')][_0xcc95('0x16')](_0x1af89e[_0xcc95('0x17')],{'raw':_0x1af89e[_0xcc95('0x18')]?_0x1af89e[_0xcc95('0x18')][_0xcc95('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af89e[_0xcc95('0x18')]?_0x1af89e[_0xcc95('0x18')][_0xcc95('0x1a')]||null:null,'attributes':_0x1af89e[_0xcc95('0x18')]?_0x1af89e['options'][_0xcc95('0x1b')]||null:null,'limit':_0x1af89e[_0xcc95('0x18')]?_0x1af89e['options'][_0xcc95('0x1c')]||null:null})['then'](function(_0x4ce27c){logger[_0xcc95('0xb')]('UpdateFaxApplication',_0x1af89e);logger['debug'](_0xcc95('0x14'),_0x1af89e,JSON[_0xcc95('0x1d')](_0x4ce27c));_0x5dce93(_0x4ce27c);})[_0xcc95('0x13')](function(_0x3c3202){logger[_0xcc95('0xe')](_0xcc95('0x14'),_0x3c3202[_0xcc95('0x11')],_0x1af89e);_0x396f2f(_0x1e8f9c[_0xcc95('0xe')](0x1f4,_0x3c3202[_0xcc95('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a233744..32d3e97 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x2134da,_0x7b3d){var _0xe3c737=function(_0x446b51){while(--_0x446b51){_0x2134da['push'](_0x2134da['shift']());}};_0xe3c737(++_0x7b3d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb7e7[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +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(_0x418c63,_0x452763){var _0x5f3bdc=function(_0x2f55ba){while(--_0x2f55ba){_0x418c63['push'](_0x418c63['shift']());}};_0x5f3bdc(++_0x452763);}(_0x13f6,0x124));var _0x613f=function(_0x4ebf1c,_0x467def){_0x4ebf1c=_0x4ebf1c-0x0;var _0x2efe7a=_0x13f6[_0x4ebf1c];return _0x2efe7a;};'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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a828d78..8fef11d 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 _0x0b2b=['ENUM','exports','BOOLEAN','DATE','STRING','out'];(function(_0x3e55dc,_0x160219){var _0x4e4906=function(_0x17f4ec){while(--_0x17f4ec){_0x3e55dc['push'](_0x3e55dc['shift']());}};_0x4e4906(++_0x160219);}(_0x0b2b,0x15d));var _0xb0b2=function(_0x233f21,_0x58e9a9){_0x233f21=_0x233f21-0x0;var _0x297913=_0x0b2b[_0x233f21];return _0x297913;};'use strict';var Sequelize=require('sequelize');module[_0xb0b2('0x0')]={'closed':{'type':Sequelize[_0xb0b2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb0b2('0x2')]},'disposition':{'type':Sequelize[_0xb0b2('0x3')]},'secondDisposition':{'type':Sequelize[_0xb0b2('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb0b2('0x3')]},'note':{'type':Sequelize[_0xb0b2('0x3')]},'read1stAt':{'type':Sequelize[_0xb0b2('0x2')]},'fax':{'type':Sequelize[_0xb0b2('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb0b2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb0b2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb0b2('0x5')]('in',_0xb0b2('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5914=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x559546,_0x29df33){var _0xbb1e3f=function(_0x35d1a4){while(--_0x35d1a4){_0x559546['push'](_0x559546['shift']());}};_0xbb1e3f(++_0x29df33);}(_0x5914,0xd8));var _0x4591=function(_0x7cd54d,_0x21b176){_0x7cd54d=_0x7cd54d-0x0;var _0x9a6c6b=_0x5914[_0x7cd54d];return _0x9a6c6b;};'use strict';var Sequelize=require(_0x4591('0x0'));module[_0x4591('0x1')]={'closed':{'type':Sequelize[_0x4591('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4591('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4591('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4591('0x4')]},'read1stAt':{'type':Sequelize[_0x4591('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x4591('0x5')]('in',_0x4591('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4591('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4591('0x5')]('in',_0x4591('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index d597bbd..cbe2d40 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 _0xb05e=['describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','length','sort','where','pick','FaxInteractionId','filter','$gte','split','format','findAll','rows','addTags','setTags','spread','Tag','emit','removeTags','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','getOptions','fax','query','user','catch','show','params','keys','filters','intersection','attributes','model','fields','includeAll','include','merge','create','body','FaxInteraction','find'];(function(_0x1ca69a,_0x1d42e2){var _0x505965=function(_0x4a2b34){while(--_0x4a2b34){_0x1ca69a['push'](_0x1ca69a['shift']());}};_0x505965(++_0x1d42e2);}(_0xb05e,0x160));var _0xeb05=function(_0xf6cd94,_0x25d081){_0xf6cd94=_0xf6cd94-0x0;var _0x527621=_0xb05e[_0xf6cd94];return _0x527621;};'use strict';var rimraf=require(_0xeb05('0x0'));var zipdir=require(_0xeb05('0x1'));var moment=require(_0xeb05('0x2'));var BPromise=require(_0xeb05('0x3'));var util=require(_0xeb05('0x4'));var path=require(_0xeb05('0x5'));var fs=require('fs');var _=require(_0xeb05('0x6'));var Redis=require('ioredis');var interaction=require(_0xeb05('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xeb05('0x8'))(_0xeb05('0x9'));var config=require('../../config/environment');var db=require(_0xeb05('0xa'))['db'];config['redis']=_[_0xeb05('0xb')](config[_0xeb05('0xc')],{'host':_0xeb05('0xd'),'port':0x18eb});var socket=require(_0xeb05('0xe'))(new Redis(config[_0xeb05('0xc')]));require(_0xeb05('0xf'))[_0xeb05('0x10')](socket);function respondWithStatusCode(_0x2a6e58,_0x153113){_0x153113=_0x153113||0xcc;return function(_0x545659){if(_0x545659){return _0x2a6e58['sendStatus'](_0x153113);}return _0x2a6e58[_0xeb05('0x11')](_0x153113)[_0xeb05('0x12')]();};}function respondWithResult(_0x32bbf0,_0x1d858c){_0x1d858c=_0x1d858c||0xc8;return function(_0x2a8758){if(_0x2a8758){return _0x32bbf0[_0xeb05('0x11')](_0x1d858c)[_0xeb05('0x13')](_0x2a8758);}};}function respondWithFilteredResult(_0xb6c239,_0x248c58){return function(_0x557e55){if(_0x557e55){var _0x312da6=typeof _0x248c58[_0xeb05('0x14')]===_0xeb05('0x15')&&typeof _0x248c58[_0xeb05('0x16')]==='undefined';var _0x2f4eba=_0x557e55[_0xeb05('0x17')];var _0x311832=_0x312da6?0x0:_0x248c58[_0xeb05('0x14')];var _0x198d01=_0x312da6?_0x557e55[_0xeb05('0x17')]:_0x248c58[_0xeb05('0x14')]+_0x248c58[_0xeb05('0x16')];var _0x2fb048;if(_0x198d01>=_0x2f4eba){_0x198d01=_0x2f4eba;_0x2fb048=0xc8;}else{_0x2fb048=0xce;}_0xb6c239[_0xeb05('0x11')](_0x2fb048);return _0xb6c239[_0xeb05('0x18')](_0xeb05('0x19'),_0x311832+'-'+_0x198d01+'/'+_0x2f4eba)[_0xeb05('0x13')](_0x557e55);}return null;};}function saveUpdates(_0x2f7612){return function(_0x2b370c){if(_0x2b370c){return _0x2b370c[_0xeb05('0x1a')](_0x2f7612)[_0xeb05('0x1b')](function(_0x1cd890){return _0x1cd890;});}return null;};}function removeEntity(_0x129099){return function(_0x3b3a87){if(_0x3b3a87){return _0x3b3a87[_0xeb05('0x1c')]()[_0xeb05('0x1b')](function(){_0x129099[_0xeb05('0x11')](0xcc)[_0xeb05('0x12')]();});}};}function handleEntityNotFound(_0x218ccf){return function(_0x4e3ded){if(!_0x4e3ded){_0x218ccf['sendStatus'](0x194);}return _0x4e3ded;};}function handleError(_0x5eb2e8,_0x47c0de){_0x47c0de=_0x47c0de||0x1f4;return function(_0x3b6ea7){logger[_0xeb05('0x1d')](_0x3b6ea7['stack']);if(_0x3b6ea7[_0xeb05('0x1e')]){delete _0x3b6ea7[_0xeb05('0x1e')];}_0x5eb2e8[_0xeb05('0x11')](_0x47c0de)['send'](_0x3b6ea7);};}exports[_0xeb05('0x1f')]=function(_0x3f3716,_0x13cdb3){var _0x5c4f75={};var _0x3002ab=_[_0xeb05('0x20')](db['FaxInteraction'][_0xeb05('0x21')],function(_0x3e6162){return{'name':_0x3e6162[_0xeb05('0x22')],'type':_0x3e6162[_0xeb05('0x23')]['key']};});_0x5c4f75=qs[_0xeb05('0x24')](_0x3002ab,_0x3f3716);return interaction['findAll'](_0xeb05('0x25'),_0x3f3716[_0xeb05('0x26')],_0x3f3716[_0xeb05('0x27')],_0x5c4f75,_0x3002ab)['then'](respondWithFilteredResult(_0x13cdb3,_0x5c4f75))[_0xeb05('0x28')](handleError(_0x13cdb3,null));};exports[_0xeb05('0x29')]=function(_0x51768d,_0x10e2a2){var _0x40fb0e={'raw':![],'where':{'id':_0x51768d[_0xeb05('0x2a')]['id']}},_0x2a2e5b={};_0x2a2e5b['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0x2a2e5b[_0xeb05('0x26')]=_[_0xeb05('0x2b')](_0x51768d[_0xeb05('0x26')]);_0x2a2e5b[_0xeb05('0x2c')]=_[_0xeb05('0x2d')](_0x2a2e5b['model'],_0x2a2e5b[_0xeb05('0x26')]);_0x40fb0e[_0xeb05('0x2e')]=_[_0xeb05('0x2d')](_0x2a2e5b[_0xeb05('0x2f')],qs[_0xeb05('0x30')](_0x51768d[_0xeb05('0x26')][_0xeb05('0x30')]));_0x40fb0e[_0xeb05('0x2e')]=_0x40fb0e[_0xeb05('0x2e')]['length']?_0x40fb0e[_0xeb05('0x2e')]:_0x2a2e5b[_0xeb05('0x2f')];if(_0x51768d[_0xeb05('0x26')][_0xeb05('0x31')]){_0x40fb0e[_0xeb05('0x32')]=[{'all':!![]}];}_0x40fb0e=_[_0xeb05('0x33')]({},_0x40fb0e,_0x51768d['options']);return db['FaxInteraction']['find'](_0x40fb0e)[_0xeb05('0x1b')](handleEntityNotFound(_0x10e2a2,null))[_0xeb05('0x1b')](respondWithResult(_0x10e2a2,null))[_0xeb05('0x28')](handleError(_0x10e2a2,null));};exports[_0xeb05('0x34')]=function(_0x38f9f9,_0x4709b4){return db['FaxInteraction'][_0xeb05('0x34')](_0x38f9f9[_0xeb05('0x35')],{})[_0xeb05('0x1b')](respondWithResult(_0x4709b4,0xc9))['catch'](handleError(_0x4709b4,null));};exports[_0xeb05('0x1a')]=function(_0x3c4a6f,_0x4cea31){if(_0x3c4a6f[_0xeb05('0x35')]['id']){delete _0x3c4a6f[_0xeb05('0x35')]['id'];}return db[_0xeb05('0x36')][_0xeb05('0x37')]({'where':{'id':_0x3c4a6f[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x4cea31,null))[_0xeb05('0x1b')](saveUpdates(_0x3c4a6f[_0xeb05('0x35')],null))['then'](respondWithResult(_0x4cea31,null))['catch'](handleError(_0x4cea31,null));};exports[_0xeb05('0x1c')]=function(_0xce632c,_0x48137c){return db['FaxInteraction'][_0xeb05('0x37')]({'where':{'id':_0xce632c['params']['id']}})['then'](handleEntityNotFound(_0x48137c,null))[_0xeb05('0x1b')](removeEntity(_0x48137c,null))[_0xeb05('0x28')](handleError(_0x48137c,null));};exports[_0xeb05('0x38')]=function(_0x3d0f76,_0x8037fc){return db[_0xeb05('0x36')][_0xeb05('0x38')]()[_0xeb05('0x1b')](respondWithResult(_0x8037fc,null))[_0xeb05('0x28')](handleError(_0x8037fc,null));};exports['addMessage']=function(_0x3e3b53,_0x2eaea8){return db[_0xeb05('0x39')][_0xeb05('0x37')]({'where':{'id':_0x3e3b53[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x2eaea8,null))[_0xeb05('0x1b')](function(_0x548129){if(_0x548129){return _0x548129[_0xeb05('0x3a')](_0x3e3b53[_0xeb05('0x35')][_0xeb05('0x3b')],_[_0xeb05('0x3c')](_0x3e3b53[_0xeb05('0x35')],[_0xeb05('0x3b'),'id'])||{});}})[_0xeb05('0x1b')](respondWithResult(_0x2eaea8,null))[_0xeb05('0x28')](handleError(_0x2eaea8,null));};exports[_0xeb05('0x3d')]=function(_0x503f3e,_0x1b90b2){var _0x196dc2={'raw':![],'where':{}};var _0x3b7abe={};var _0x379dbf={'count':0x0,'rows':[]};return db[_0xeb05('0x36')][_0xeb05('0x3e')]({'where':{'id':_0x503f3e['params']['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x1b90b2,null))[_0xeb05('0x1b')](function(_0x514db5){if(_0x514db5){_0x3b7abe[_0xeb05('0x2f')]=_[_0xeb05('0x2b')](db[_0xeb05('0x39')][_0xeb05('0x21')]);_0x3b7abe[_0xeb05('0x26')]=_['keys'](_0x503f3e[_0xeb05('0x26')]);_0x3b7abe[_0xeb05('0x2c')]=_['intersection'](_0x3b7abe[_0xeb05('0x2f')],_0x3b7abe[_0xeb05('0x26')]);_0x196dc2['attributes']=_[_0xeb05('0x2d')](_0x3b7abe['model'],qs[_0xeb05('0x30')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x30')]));_0x196dc2[_0xeb05('0x2e')]=_0x196dc2[_0xeb05('0x2e')][_0xeb05('0x3f')]?_0x196dc2[_0xeb05('0x2e')]:_0x3b7abe['model'];if(!_0x503f3e['query']['hasOwnProperty']('nolimit')){_0x196dc2['limit']=qs[_0xeb05('0x16')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x16')]);_0x196dc2[_0xeb05('0x14')]=qs[_0xeb05('0x14')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x14')]);}_0x196dc2['order']=qs[_0xeb05('0x40')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x40')]);_0x196dc2[_0xeb05('0x41')]=qs[_0xeb05('0x2c')](_[_0xeb05('0x42')](_0x503f3e[_0xeb05('0x26')],_0x3b7abe[_0xeb05('0x2c')]));_0x196dc2[_0xeb05('0x41')][_0xeb05('0x43')]=_0x514db5['id'];if(_0x503f3e['query']['filter']){_0x196dc2['where']=_[_0xeb05('0x33')](_0x196dc2[_0xeb05('0x41')],{'$or':_[_0xeb05('0x20')](_0x196dc2[_0xeb05('0x2e')],function(_0x3f05ce){var _0x4422b0={};_0x4422b0[_0x3f05ce]={'$like':'%'+_0x503f3e[_0xeb05('0x26')][_0xeb05('0x44')]+'%'};return _0x4422b0;})});}if(_0x503f3e[_0xeb05('0x26')]['$gte']){var _0xf0dc91=_0x503f3e[_0xeb05('0x26')][_0xeb05('0x45')][_0xeb05('0x46')](',');var _0x3f9169={};_0x3f9169[_0xf0dc91[0x0]]={'$gte':moment(_0xf0dc91[0x1])[_0xeb05('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x196dc2['where']=_[_0xeb05('0x33')](_0x196dc2['where'],_0x3f9169);}_0x196dc2=_[_0xeb05('0x33')]({},_0x196dc2,_0x503f3e['options']);return db['FaxMessage'][_0xeb05('0x17')]({'where':_0x196dc2[_0xeb05('0x41')]})[_0xeb05('0x1b')](function(_0x360b53){_0x379dbf[_0xeb05('0x17')]=_0x360b53;if(_0x503f3e[_0xeb05('0x26')]['includeAll']){_0x196dc2[_0xeb05('0x32')]=[{'all':!![]}];}return db[_0xeb05('0x39')][_0xeb05('0x48')](_0x196dc2);})[_0xeb05('0x1b')](function(_0x979da){_0x379dbf[_0xeb05('0x49')]=_0x979da;return _0x379dbf;});}})[_0xeb05('0x1b')](respondWithFilteredResult(_0x1b90b2,_0x196dc2))[_0xeb05('0x28')](handleError(_0x1b90b2,null));};exports[_0xeb05('0x4a')]=function(_0x3f1898,_0x3ebb4d){return db['FaxInteraction'][_0xeb05('0x37')]({'where':{'id':_0x3f1898[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x3ebb4d,null))[_0xeb05('0x1b')](function(_0x56c2af){if(_0x56c2af){return _0x56c2af[_0xeb05('0x4b')](_0x3f1898[_0xeb05('0x35')]['ids'],_[_0xeb05('0x3c')](_0x3f1898[_0xeb05('0x35')],['ids','id'])||{})[_0xeb05('0x4c')](function(){return db[_0xeb05('0x4d')][_0xeb05('0x48')]({'attributes':['id',_0xeb05('0x1e'),'color'],'where':{'id':_0x3f1898[_0xeb05('0x35')][_0xeb05('0x3b')]}});})['then'](function(_0x177e09){socket[_0xeb05('0x4e')]('faxInteractionTags:save',{'id':Number(_0x3f1898[_0xeb05('0x2a')]['id']),'tags':_0x177e09||[]});return{'id':Number(_0x3f1898[_0xeb05('0x2a')]['id']),'tags':_0x177e09||[]};});}})[_0xeb05('0x1b')](respondWithResult(_0x3ebb4d,null))[_0xeb05('0x28')](handleError(_0x3ebb4d,null));};exports[_0xeb05('0x4f')]=function(_0x372f4a,_0x191c3a){return db[_0xeb05('0x36')]['find']({'where':{'id':_0x372f4a[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x191c3a,null))[_0xeb05('0x1b')](function(_0xcc057b){if(_0xcc057b){return _0xcc057b[_0xeb05('0x4f')](_0x372f4a[_0xeb05('0x26')][_0xeb05('0x3b')]);}})['then'](respondWithStatusCode(_0x191c3a,null))['catch'](handleError(_0x191c3a,null));};exports['download']=function(_0x45b8f6,_0x2dca90){var _0x417102=moment()[_0xeb05('0x50')]()[_0xeb05('0x51')]();var _0x406359=path['join'](config[_0xeb05('0x52')],_0xeb05('0x53'),_0xeb05('0x54'),_0xeb05('0x55'));var _0xbe3462=path[_0xeb05('0x56')](config['root'],_0xeb05('0x53'),'files',_0xeb05('0x57'));var _0x384269=path['join'](_0x406359,_0x417102);var _0x41c273=util[_0xeb05('0x47')](_0xeb05('0x58'),_0x45b8f6[_0xeb05('0x2a')]['id'],_0x417102);var _0x2cb6f7=path['join'](_0x406359,_0x41c273);var _0x55a275=[];_0x55a275[_0xeb05('0x59')]({'model':db[_0xeb05('0x5a')],'as':'Attachment','raw':!![]});var _0x1056c9=[{'model':db[_0xeb05('0x39')],'as':_0xeb05('0x5b'),'attributes':['id',_0xeb05('0x35'),'createdAt'],'include':_0x55a275}];return db[_0xeb05('0x36')]['find']({'where':{'id':_0x45b8f6[_0xeb05('0x2a')]['id']},'include':_0x1056c9})[_0xeb05('0x1b')](handleEntityNotFound(_0x2dca90,null))[_0xeb05('0x1b')](function(_0x3b0faf){if(_0x3b0faf&&_0x3b0faf[_0xeb05('0x5b')]){var _0x406d1f=_0x3b0faf['get']({'plain':!![]});fs[_0xeb05('0x5c')](_0x384269);for(var _0x134f3d=0x0;_0x134f3d<_0x406d1f[_0xeb05('0x5b')][_0xeb05('0x3f')];_0x134f3d++){var _0x347ef1=_0x406d1f[_0xeb05('0x5b')][_0x134f3d][_0xeb05('0x5a')];if(_0x347ef1){var _0x5781cd=path[_0xeb05('0x56')](_0xbe3462,_0x347ef1[_0xeb05('0x5d')]);if(fs[_0xeb05('0x5e')](_0x5781cd)){fs[_0xeb05('0x5f')](_0x5781cd)[_0xeb05('0x60')](fs[_0xeb05('0x61')](path[_0xeb05('0x56')](_0x384269,_0x347ef1[_0xeb05('0x5d')])));}}}return BPromise[_0xeb05('0x62')]()[_0xeb05('0x1b')](function(){return new BPromise(function(_0x412bb6,_0x246334){zipdir(_0x384269,{'saveTo':_0x2cb6f7},function(_0x40f0fa,_0x37ad09){if(_0x40f0fa)return _0x246334(_0x40f0fa);return _0x412bb6(_0x37ad09);});})[_0xeb05('0x1b')](function(){return new BPromise(function(_0x30ee6f,_0x204a15){rimraf(_0x384269,function(_0x237e19){if(_0x237e19)_0x204a15(_0x237e19);return _0x30ee6f();});});})[_0xeb05('0x1b')](function(){return _0x2dca90[_0xeb05('0x63')](_0x2cb6f7,_0x41c273,function(_0x5cdb3b){if(_0x5cdb3b){console['log']('err',_0x5cdb3b);}else{fs[_0xeb05('0x64')](_0x2cb6f7);}});});});}else{return _0x2dca90[_0xeb05('0x65')](0xc8);}})['catch'](handleError(_0x2dca90,null));}; \ No newline at end of file +var _0x954a=['server','attachments','Attachment','Messages','basename','existsSync','createWriteStream','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','then','error','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','create','body','find','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','merge','rows','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp'];(function(_0x3f2647,_0x4447ac){var _0xbd8415=function(_0x232300){while(--_0x232300){_0x3f2647['push'](_0x3f2647['shift']());}};_0xbd8415(++_0x4447ac);}(_0x954a,0x6c));var _0xa954=function(_0x410d6e,_0x1c7e29){_0x410d6e=_0x410d6e-0x0;var _0x444fbf=_0x954a[_0x410d6e];return _0x444fbf;};'use strict';var rimraf=require(_0xa954('0x0'));var zipdir=require(_0xa954('0x1'));var moment=require(_0xa954('0x2'));var BPromise=require(_0xa954('0x3'));var util=require(_0xa954('0x4'));var path=require(_0xa954('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa954('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xa954('0x7'));var logger=require(_0xa954('0x8'))(_0xa954('0x9'));var config=require('../../config/environment');var db=require(_0xa954('0xa'))['db'];config['redis']=_[_0xa954('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa954('0xc'))(new Redis(config[_0xa954('0xd')]));require(_0xa954('0xe'))[_0xa954('0xf')](socket);function respondWithStatusCode(_0x356933,_0x3b93d7){_0x3b93d7=_0x3b93d7||0xcc;return function(_0x97b66a){if(_0x97b66a){return _0x356933[_0xa954('0x10')](_0x3b93d7);}return _0x356933['status'](_0x3b93d7)[_0xa954('0x11')]();};}function respondWithResult(_0x305ebe,_0x1d99a7){_0x1d99a7=_0x1d99a7||0xc8;return function(_0x52363a){if(_0x52363a){return _0x305ebe[_0xa954('0x12')](_0x1d99a7)['json'](_0x52363a);}};}function respondWithFilteredResult(_0x4dac26,_0x30f31a){return function(_0x300b53){if(_0x300b53){var _0x39218a=typeof _0x30f31a[_0xa954('0x13')]==='undefined'&&typeof _0x30f31a[_0xa954('0x14')]===_0xa954('0x15');var _0x2fc2ea=_0x300b53[_0xa954('0x16')];var _0x1378f0=_0x39218a?0x0:_0x30f31a['offset'];var _0x2226cb=_0x39218a?_0x300b53['count']:_0x30f31a[_0xa954('0x13')]+_0x30f31a[_0xa954('0x14')];var _0x32b775;if(_0x2226cb>=_0x2fc2ea){_0x2226cb=_0x2fc2ea;_0x32b775=0xc8;}else{_0x32b775=0xce;}_0x4dac26[_0xa954('0x12')](_0x32b775);return _0x4dac26[_0xa954('0x17')](_0xa954('0x18'),_0x1378f0+'-'+_0x2226cb+'/'+_0x2fc2ea)[_0xa954('0x19')](_0x300b53);}return null;};}function saveUpdates(_0x4451ac){return function(_0x21d4ec){if(_0x21d4ec){return _0x21d4ec[_0xa954('0x1a')](_0x4451ac)['then'](function(_0x327a8c){return _0x327a8c;});}return null;};}function removeEntity(_0x1d040c){return function(_0x465bc5){if(_0x465bc5){return _0x465bc5[_0xa954('0x1b')]()[_0xa954('0x1c')](function(){_0x1d040c[_0xa954('0x12')](0xcc)[_0xa954('0x11')]();});}};}function handleEntityNotFound(_0xeaad7){return function(_0x4b1e1b){if(!_0x4b1e1b){_0xeaad7[_0xa954('0x10')](0x194);}return _0x4b1e1b;};}function handleError(_0x484558,_0x1cb7d0){_0x1cb7d0=_0x1cb7d0||0x1f4;return function(_0x1a8711){logger[_0xa954('0x1d')](_0x1a8711['stack']);if(_0x1a8711['name']){delete _0x1a8711[_0xa954('0x1e')];}_0x484558[_0xa954('0x12')](_0x1cb7d0)[_0xa954('0x1f')](_0x1a8711);};}exports[_0xa954('0x20')]=function(_0x20779e,_0x2e68b4){var _0x104936={};var _0x4fba5e=_[_0xa954('0x21')](db[_0xa954('0x22')][_0xa954('0x23')],function(_0x1012bd){return{'name':_0x1012bd['fieldName'],'type':_0x1012bd[_0xa954('0x24')][_0xa954('0x25')]};});_0x104936=qs[_0xa954('0x26')](_0x4fba5e,_0x20779e);return interaction[_0xa954('0x27')](_0xa954('0x28'),_0x20779e[_0xa954('0x29')],_0x20779e['user'],_0x104936,_0x4fba5e)[_0xa954('0x1c')](respondWithFilteredResult(_0x2e68b4,_0x104936))[_0xa954('0x2a')](handleError(_0x2e68b4,null));};exports[_0xa954('0x2b')]=function(_0x4f435b,_0x47173b){var _0x2427ad={'raw':![],'where':{'id':_0x4f435b['params']['id']}},_0x28edad={};_0x28edad[_0xa954('0x2c')]=_[_0xa954('0x2d')](db[_0xa954('0x22')][_0xa954('0x23')]);_0x28edad[_0xa954('0x29')]=_['keys'](_0x4f435b[_0xa954('0x29')]);_0x28edad[_0xa954('0x2e')]=_[_0xa954('0x2f')](_0x28edad['model'],_0x28edad[_0xa954('0x29')]);_0x2427ad[_0xa954('0x30')]=_[_0xa954('0x2f')](_0x28edad[_0xa954('0x2c')],qs[_0xa954('0x31')](_0x4f435b[_0xa954('0x29')][_0xa954('0x31')]));_0x2427ad[_0xa954('0x30')]=_0x2427ad[_0xa954('0x30')][_0xa954('0x32')]?_0x2427ad[_0xa954('0x30')]:_0x28edad[_0xa954('0x2c')];if(_0x4f435b[_0xa954('0x29')][_0xa954('0x33')]){_0x2427ad[_0xa954('0x34')]=[{'all':!![]}];}_0x2427ad=_['merge']({},_0x2427ad,_0x4f435b[_0xa954('0x35')]);return db[_0xa954('0x22')]['find'](_0x2427ad)[_0xa954('0x1c')](handleEntityNotFound(_0x47173b,null))['then'](respondWithResult(_0x47173b,null))[_0xa954('0x2a')](handleError(_0x47173b,null));};exports[_0xa954('0x36')]=function(_0x287d9f,_0x3d7b46){return db[_0xa954('0x22')][_0xa954('0x36')](_0x287d9f[_0xa954('0x37')],{})[_0xa954('0x1c')](respondWithResult(_0x3d7b46,0xc9))[_0xa954('0x2a')](handleError(_0x3d7b46,null));};exports[_0xa954('0x1a')]=function(_0x297761,_0x2faa8a){if(_0x297761[_0xa954('0x37')]['id']){delete _0x297761[_0xa954('0x37')]['id'];}return db[_0xa954('0x22')][_0xa954('0x38')]({'where':{'id':_0x297761[_0xa954('0x39')]['id']}})['then'](handleEntityNotFound(_0x2faa8a,null))[_0xa954('0x1c')](saveUpdates(_0x297761[_0xa954('0x37')],null))['then'](respondWithResult(_0x2faa8a,null))[_0xa954('0x2a')](handleError(_0x2faa8a,null));};exports['destroy']=function(_0x43e043,_0x5c4689){return db[_0xa954('0x22')]['find']({'where':{'id':_0x43e043['params']['id']}})['then'](handleEntityNotFound(_0x5c4689,null))[_0xa954('0x1c')](removeEntity(_0x5c4689,null))[_0xa954('0x2a')](handleError(_0x5c4689,null));};exports[_0xa954('0x3a')]=function(_0x2939ba,_0x56b87d){return db[_0xa954('0x22')][_0xa954('0x3a')]()[_0xa954('0x1c')](respondWithResult(_0x56b87d,null))['catch'](handleError(_0x56b87d,null));};exports[_0xa954('0x3b')]=function(_0x2697fc,_0x1fa08f){return db[_0xa954('0x3c')][_0xa954('0x38')]({'where':{'id':_0x2697fc['params']['id']}})[_0xa954('0x1c')](handleEntityNotFound(_0x1fa08f,null))['then'](function(_0x562f7a){if(_0x562f7a){return _0x562f7a[_0xa954('0x3b')](_0x2697fc[_0xa954('0x37')][_0xa954('0x3d')],_[_0xa954('0x3e')](_0x2697fc[_0xa954('0x37')],[_0xa954('0x3d'),'id'])||{});}})[_0xa954('0x1c')](respondWithResult(_0x1fa08f,null))[_0xa954('0x2a')](handleError(_0x1fa08f,null));};exports[_0xa954('0x3f')]=function(_0x21eeba,_0x49c784){var _0x244ae1={'raw':![],'where':{}};var _0x5bd438={};var _0x5b2e72={'count':0x0,'rows':[]};return db[_0xa954('0x22')][_0xa954('0x40')]({'where':{'id':_0x21eeba['params']['id']}})['then'](handleEntityNotFound(_0x49c784,null))[_0xa954('0x1c')](function(_0x23a16e){if(_0x23a16e){_0x5bd438[_0xa954('0x2c')]=_[_0xa954('0x2d')](db['FaxMessage'][_0xa954('0x23')]);_0x5bd438['query']=_[_0xa954('0x2d')](_0x21eeba[_0xa954('0x29')]);_0x5bd438[_0xa954('0x2e')]=_[_0xa954('0x2f')](_0x5bd438['model'],_0x5bd438[_0xa954('0x29')]);_0x244ae1[_0xa954('0x30')]=_['intersection'](_0x5bd438[_0xa954('0x2c')],qs[_0xa954('0x31')](_0x21eeba[_0xa954('0x29')][_0xa954('0x31')]));_0x244ae1[_0xa954('0x30')]=_0x244ae1['attributes']['length']?_0x244ae1[_0xa954('0x30')]:_0x5bd438[_0xa954('0x2c')];if(!_0x21eeba[_0xa954('0x29')][_0xa954('0x41')](_0xa954('0x42'))){_0x244ae1[_0xa954('0x14')]=qs['limit'](_0x21eeba[_0xa954('0x29')][_0xa954('0x14')]);_0x244ae1[_0xa954('0x13')]=qs[_0xa954('0x13')](_0x21eeba[_0xa954('0x29')][_0xa954('0x13')]);}_0x244ae1['order']=qs[_0xa954('0x43')](_0x21eeba['query'][_0xa954('0x43')]);_0x244ae1[_0xa954('0x44')]=qs['filters'](_[_0xa954('0x45')](_0x21eeba['query'],_0x5bd438[_0xa954('0x2e')]));_0x244ae1[_0xa954('0x44')]['FaxInteractionId']=_0x23a16e['id'];if(_0x21eeba[_0xa954('0x29')][_0xa954('0x46')]){_0x244ae1[_0xa954('0x44')]=_['merge'](_0x244ae1[_0xa954('0x44')],{'$or':_[_0xa954('0x21')](_0x244ae1[_0xa954('0x30')],function(_0x5683ab){var _0x1e81f2={};_0x1e81f2[_0x5683ab]={'$like':'%'+_0x21eeba[_0xa954('0x29')][_0xa954('0x46')]+'%'};return _0x1e81f2;})});}if(_0x21eeba[_0xa954('0x29')][_0xa954('0x47')]){var _0x298506=_0x21eeba[_0xa954('0x29')]['$gte']['split'](',');var _0x46d5be={};_0x46d5be[_0x298506[0x0]]={'$gte':moment(_0x298506[0x1])['format'](_0xa954('0x48'))};_0x244ae1[_0xa954('0x44')]=_[_0xa954('0x49')](_0x244ae1[_0xa954('0x44')],_0x46d5be);}_0x244ae1=_['merge']({},_0x244ae1,_0x21eeba[_0xa954('0x35')]);return db[_0xa954('0x3c')]['count']({'where':_0x244ae1[_0xa954('0x44')]})[_0xa954('0x1c')](function(_0x2fa6c8){_0x5b2e72[_0xa954('0x16')]=_0x2fa6c8;if(_0x21eeba[_0xa954('0x29')][_0xa954('0x33')]){_0x244ae1[_0xa954('0x34')]=[{'all':!![]}];}return db[_0xa954('0x3c')][_0xa954('0x27')](_0x244ae1);})['then'](function(_0x31a43f){_0x5b2e72[_0xa954('0x4a')]=_0x31a43f;return _0x5b2e72;});}})['then'](respondWithFilteredResult(_0x49c784,_0x244ae1))[_0xa954('0x2a')](handleError(_0x49c784,null));};exports['addTags']=function(_0x293203,_0x4888c7){return db['FaxInteraction'][_0xa954('0x38')]({'where':{'id':_0x293203[_0xa954('0x39')]['id']}})[_0xa954('0x1c')](handleEntityNotFound(_0x4888c7,null))['then'](function(_0x543195){if(_0x543195){return _0x543195[_0xa954('0x4b')](_0x293203[_0xa954('0x37')][_0xa954('0x3d')],_['omit'](_0x293203['body'],[_0xa954('0x3d'),'id'])||{})[_0xa954('0x4c')](function(){return db['Tag'][_0xa954('0x27')]({'attributes':['id',_0xa954('0x1e'),_0xa954('0x4d')],'where':{'id':_0x293203[_0xa954('0x37')][_0xa954('0x3d')]}});})[_0xa954('0x1c')](function(_0x9691b6){socket[_0xa954('0x4e')](_0xa954('0x4f'),{'id':Number(_0x293203[_0xa954('0x39')]['id']),'tags':_0x9691b6||[]});return{'id':Number(_0x293203[_0xa954('0x39')]['id']),'tags':_0x9691b6||[]};});}})[_0xa954('0x1c')](respondWithResult(_0x4888c7,null))[_0xa954('0x2a')](handleError(_0x4888c7,null));};exports[_0xa954('0x50')]=function(_0x413997,_0x66d3e7){return db[_0xa954('0x22')][_0xa954('0x38')]({'where':{'id':_0x413997[_0xa954('0x39')]['id']}})['then'](handleEntityNotFound(_0x66d3e7,null))[_0xa954('0x1c')](function(_0x257960){if(_0x257960){return _0x257960[_0xa954('0x50')](_0x413997[_0xa954('0x29')][_0xa954('0x3d')]);}})[_0xa954('0x1c')](respondWithStatusCode(_0x66d3e7,null))[_0xa954('0x2a')](handleError(_0x66d3e7,null));};exports[_0xa954('0x51')]=function(_0x13ab36,_0x19c49b){var _0x4e3010=moment()[_0xa954('0x52')]()[_0xa954('0x53')]();var _0x46dafa=path[_0xa954('0x54')](config[_0xa954('0x55')],'server',_0xa954('0x56'),_0xa954('0x57'));var _0x40dd90=path[_0xa954('0x54')](config[_0xa954('0x55')],_0xa954('0x58'),_0xa954('0x56'),_0xa954('0x59'));var _0x5bf54e=path['join'](_0x46dafa,_0x4e3010);var _0x4c9815=util['format']('transcript-%d-%s.zip',_0x13ab36[_0xa954('0x39')]['id'],_0x4e3010);var _0x198538=path[_0xa954('0x54')](_0x46dafa,_0x4c9815);var _0x26b650=[];_0x26b650['push']({'model':db[_0xa954('0x5a')],'as':_0xa954('0x5a'),'raw':!![]});var _0x8dad1d=[{'model':db[_0xa954('0x3c')],'as':_0xa954('0x5b'),'attributes':['id','body','createdAt'],'include':_0x26b650}];return db[_0xa954('0x22')][_0xa954('0x38')]({'where':{'id':_0x13ab36[_0xa954('0x39')]['id']},'include':_0x8dad1d})[_0xa954('0x1c')](handleEntityNotFound(_0x19c49b,null))[_0xa954('0x1c')](function(_0x5be39e){if(_0x5be39e&&_0x5be39e[_0xa954('0x5b')]){var _0x4b712c=_0x5be39e['get']({'plain':!![]});fs['mkdirSync'](_0x5bf54e);for(var _0x5e708c=0x0;_0x5e708c<_0x4b712c[_0xa954('0x5b')][_0xa954('0x32')];_0x5e708c++){var _0x459570=_0x4b712c['Messages'][_0x5e708c][_0xa954('0x5a')];if(_0x459570){var _0x1a3f8a=path[_0xa954('0x54')](_0x40dd90,_0x459570[_0xa954('0x5c')]);if(fs[_0xa954('0x5d')](_0x1a3f8a)){fs['createReadStream'](_0x1a3f8a)['pipe'](fs[_0xa954('0x5e')](path['join'](_0x5bf54e,_0x459570[_0xa954('0x5c')])));}}}return BPromise['resolve']()[_0xa954('0x1c')](function(){return new BPromise(function(_0x319fc9,_0x23839a){zipdir(_0x5bf54e,{'saveTo':_0x198538},function(_0x4594b1,_0xe4b09e){if(_0x4594b1)return _0x23839a(_0x4594b1);return _0x319fc9(_0xe4b09e);});})[_0xa954('0x1c')](function(){return new BPromise(function(_0x454030,_0x35288d){rimraf(_0x5bf54e,function(_0x37bfc1){if(_0x37bfc1)_0x35288d(_0x37bfc1);return _0x454030();});});})[_0xa954('0x1c')](function(){return _0x19c49b[_0xa954('0x51')](_0x198538,_0x4c9815,function(_0x5c64ba){if(_0x5c64ba){console[_0xa954('0x5f')](_0xa954('0x60'),_0x5c64ba);}else{fs[_0xa954('0x61')](_0x198538);}});});});}else{return _0x19c49b['sendStatus'](0xc8);}})[_0xa954('0x2a')](handleError(_0x19c49b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 558a189..954cee3 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 _0x898c=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x898c,0x1b1));var _0xc898=function(_0x3c5c3c,_0x13b428){_0x3c5c3c=_0x3c5c3c-0x0;var _0x2a4714=_0x898c[_0x3c5c3c];return _0x2a4714;};'use strict';var EventEmitter=require(_0xc898('0x0'));var FaxInteraction=require(_0xc898('0x1'))['db'][_0xc898('0x2')];var FaxMessage=require(_0xc898('0x1'))['db'][_0xc898('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc898('0x4')](0x0);var events={'afterCreate':_0xc898('0x5'),'afterUpdate':'update','afterDestroy':_0xc898('0x6')};function emitEvent(_0x52d8f6){return function(_0x32a822,_0xdc6134,_0x4b3cfb){_0x32a822[_0xc898('0x7')]({'attributes':['id'],'raw':!![]})[_0xc898('0x8')](function(_0x289c10){_0x32a822[_0xc898('0x9')](_0xc898('0xa'),_0x289c10[_0xc898('0xb')](function(_0x2137c1){return{'id':_0x2137c1['id']};}));return FaxMessage[_0xc898('0xc')]({'where':{'FaxInteractionId':_0x32a822['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc898('0x8')](function(_0x3b3809){_0x32a822['setDataValue']('unreadMessages',_0x3b3809[_0xc898('0xd')]);FaxInteractionEvents[_0xc898('0xe')](_0x52d8f6+':'+_0x32a822['id'],_0x32a822);FaxInteractionEvents['emit'](_0x52d8f6,_0x32a822);_0x4b3cfb(null);})[_0xc898('0xf')](_0x4b3cfb(null));};}for(var e in events){if(events[_0xc898('0x10')](e)){var event=events[e];FaxInteraction[_0xc898('0x11')](e,emitEvent(event));}}module[_0xc898('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0xb278=['hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xb278,0x158));var _0x8b27=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xb278[_0x40bffc];return _0x3007e9;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x8b27('0x0'))['db'][_0x8b27('0x1')];var FaxMessage=require(_0x8b27('0x0'))['db'][_0x8b27('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8b27('0x3')](0x0);var events={'afterCreate':_0x8b27('0x4'),'afterUpdate':'update','afterDestroy':_0x8b27('0x5')};function emitEvent(_0x37120a){return function(_0x95595,_0x56d554,_0x249d71){_0x95595[_0x8b27('0x6')]({'attributes':['id'],'raw':!![]})[_0x8b27('0x7')](function(_0x18ec0a){_0x95595[_0x8b27('0x8')](_0x8b27('0x9'),_0x18ec0a[_0x8b27('0xa')](function(_0x1e5625){return{'id':_0x1e5625['id']};}));return FaxMessage[_0x8b27('0xb')]({'where':{'FaxInteractionId':_0x95595['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b27('0x7')](function(_0x2ef144){_0x95595[_0x8b27('0x8')](_0x8b27('0xc'),_0x2ef144[_0x8b27('0xd')]);FaxInteractionEvents[_0x8b27('0xe')](_0x37120a+':'+_0x95595['id'],_0x95595);FaxInteractionEvents['emit'](_0x37120a,_0x95595);_0x249d71(null);})[_0x8b27('0xf')](_0x249d71(null));};}for(var e in events){if(events[_0x8b27('0x10')](e)){var event=events[e];FaxInteraction[_0x8b27('0x11')](e,emitEvent(event));}}module[_0x8b27('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index dbddb53..034611a 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 _0xb928=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x2fbdda,_0x3e935a){var _0x48defb=function(_0x41f4b9){while(--_0x41f4b9){_0x2fbdda['push'](_0x2fbdda['shift']());}};_0x48defb(++_0x3e935a);}(_0xb928,0x16e));var _0x8b92=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xb928[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0x8b92('0x0'));var util=require(_0x8b92('0x1'));var logger=require(_0x8b92('0x2'))(_0x8b92('0x3'));var moment=require(_0x8b92('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b92('0x6'));var config=require(_0x8b92('0x7'));var attributes=require(_0x8b92('0x8'));module[_0x8b92('0x9')]=function(_0x11678f,_0x59cc61){return _0x11678f[_0x8b92('0xa')](_0x8b92('0xb'),attributes,{'tableName':_0x8b92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb4e233,_0x42f79b,_0x1c6677){if(_0xb4e233[_0x8b92('0xd')](_0x8b92('0xe'))){_0xb4e233[_0x8b92('0xf')]=moment()[_0x8b92('0x10')](_0x8b92('0x11'));}_0x1c6677(null,_0xb4e233);}}});}; \ No newline at end of file +var _0xa46e=['../../config/environment','exports','define','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path'];(function(_0x3ff332,_0x145564){var _0x5a2264=function(_0x36e730){while(--_0x36e730){_0x3ff332['push'](_0x3ff332['shift']());}};_0x5a2264(++_0x145564);}(_0xa46e,0x8a));var _0xea46=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xa46e[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./faxInteraction.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('FaxInteraction',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42771a,_0xe7d428,_0x3db7a2){if(_0x42771a[_0xea46('0xa')]('closed')){_0x42771a['closedAt']=moment()['format'](_0xea46('0xb'));}_0x3db7a2(null,_0x42771a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 76c6273..59dab7b 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 _0x7a7b=['socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','limit','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a7b,0x15d));var _0xb7a7=function(_0x3a2aab,_0x47b12d){_0x3a2aab=_0x3a2aab-0x0;var _0x404775=_0x7a7b[_0x3a2aab];return _0x404775;};'use strict';var _=require(_0xb7a7('0x0'));var util=require(_0xb7a7('0x1'));var moment=require(_0xb7a7('0x2'));var BPromise=require(_0xb7a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7a7('0x4'))['db'];var utils=require(_0xb7a7('0x5'));var logger=require('../../config/logger')(_0xb7a7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb7a7('0x7')]({'port':0x232a});config[_0xb7a7('0x8')]=_[_0xb7a7('0x9')](config[_0xb7a7('0x8')],{'host':_0xb7a7('0xa'),'port':0x18eb});var socket=require(_0xb7a7('0xb'))(new Redis(config[_0xb7a7('0x8')]));require(_0xb7a7('0xc'))[_0xb7a7('0xd')](socket);function respondWithRpcPromise(_0x4fd507,_0x36e1e0,_0x132ac2){return new BPromise(function(_0x7f665c,_0x3e769e){return client[_0xb7a7('0xe')](_0x4fd507,_0x132ac2)[_0xb7a7('0xf')](function(_0x5aa903){logger['info'](_0xb7a7('0x10'),_0x36e1e0,_0xb7a7('0x11'));logger[_0xb7a7('0x12')](_0xb7a7('0x13'),_0x36e1e0,_0xb7a7('0x11'),JSON[_0xb7a7('0x14')](_0x5aa903));if(_0x5aa903[_0xb7a7('0x15')]){if(_0x5aa903['error'][_0xb7a7('0x16')]===0x1f4){logger['error'](_0xb7a7('0x10'),_0x36e1e0,_0x5aa903[_0xb7a7('0x15')]['message']);return _0x3e769e(_0x5aa903[_0xb7a7('0x15')]['message']);}logger[_0xb7a7('0x15')](_0xb7a7('0x10'),_0x36e1e0,_0x5aa903[_0xb7a7('0x15')][_0xb7a7('0x17')]);return _0x7f665c(_0x5aa903[_0xb7a7('0x15')][_0xb7a7('0x17')]);}else{logger[_0xb7a7('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x36e1e0,_0xb7a7('0x11'));_0x7f665c(_0x5aa903[_0xb7a7('0x19')][_0xb7a7('0x17')]);}})[_0xb7a7('0x1a')](function(_0x3e271d){logger[_0xb7a7('0x15')](_0xb7a7('0x10'),_0x36e1e0,_0x3e271d);_0x3e769e(_0x3e271d);});});}exports[_0xb7a7('0x1b')]=function(_0x2c5242){var _0x1214a6=this;return new Promise(function(_0x4ba3f0,_0x4b65d5){return db[_0xb7a7('0x1c')][_0xb7a7('0x1d')](_0x2c5242[_0xb7a7('0x1e')],{'raw':_0x2c5242['options']?_0x2c5242[_0xb7a7('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c5242[_0xb7a7('0x1f')]?_0x2c5242[_0xb7a7('0x1f')]['where']||null:null,'attributes':_0x2c5242[_0xb7a7('0x1f')]?_0x2c5242[_0xb7a7('0x1f')]['attributes']||null:null,'limit':_0x2c5242[_0xb7a7('0x1f')]?_0x2c5242[_0xb7a7('0x1f')][_0xb7a7('0x20')]||null:null})[_0xb7a7('0xf')](function(_0x5558ac){logger[_0xb7a7('0x18')](_0xb7a7('0x1b'),_0x2c5242);logger[_0xb7a7('0x12')]('UpdateFaxInteraction',_0x2c5242,JSON[_0xb7a7('0x14')](_0x5558ac));_0x4ba3f0(_0x5558ac);})[_0xb7a7('0x1a')](function(_0x1fe19c){logger[_0xb7a7('0x15')](_0xb7a7('0x1b'),_0x1fe19c['message'],_0x2c5242);_0x4b65d5(_0x1214a6[_0xb7a7('0x15')](0x1f4,_0x1fe19c[_0xb7a7('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x17860f){return new Promise(function(_0x4c063a,_0x5c3b73){return db['FaxInteraction'][_0xb7a7('0x21')]({'where':_0x17860f['options']?_0x17860f[_0xb7a7('0x1f')][_0xb7a7('0x22')]||null:null})[_0xb7a7('0xf')](function(_0x534ab3){if(_0x534ab3){return _0x534ab3[_0xb7a7('0x23')](_0x17860f[_0xb7a7('0x1e')][_0xb7a7('0x24')],_[_0xb7a7('0x25')](_0x17860f[_0xb7a7('0x1e')],[_0xb7a7('0x24'),'id'])||{});}})[_0xb7a7('0x26')](function(_0x2b75c0){logger[_0xb7a7('0x18')](_0xb7a7('0x27'),_0x17860f);logger[_0xb7a7('0x12')](_0xb7a7('0x27'),_0x17860f,JSON[_0xb7a7('0x14')](_0x2b75c0));_0x4c063a(_0x2b75c0);})['catch'](function(_0xc69632){logger['error'](_0xb7a7('0x27'),_0xc69632[_0xb7a7('0x17')],_0x17860f);_0x5c3b73(_this[_0xb7a7('0x15')](0x1f4,_0xc69632[_0xb7a7('0x17')]));});});}; \ No newline at end of file +var _0xf5f1=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','body','options','where','attributes','limit','FaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x3542e3,_0x44495b){var _0x1a4a89=function(_0x5229de){while(--_0x5229de){_0x3542e3['push'](_0x3542e3['shift']());}};_0x1a4a89(++_0x44495b);}(_0xf5f1,0x166));var _0x1f5f=function(_0x4d818b,_0x4bb351){_0x4d818b=_0x4d818b-0x0;var _0x3b346a=_0xf5f1[_0x4d818b];return _0x3b346a;};'use strict';var _=require(_0x1f5f('0x0'));var util=require(_0x1f5f('0x1'));var moment=require('moment');var BPromise=require(_0x1f5f('0x2'));var rs=require(_0x1f5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f5f('0x4'));var logger=require(_0x1f5f('0x5'))(_0x1f5f('0x6'));var config=require('../../config/environment');var jayson=require(_0x1f5f('0x7'));var client=jayson[_0x1f5f('0x8')]['http']({'port':0x232a});config[_0x1f5f('0x9')]=_[_0x1f5f('0xa')](config['redis'],{'host':_0x1f5f('0xb'),'port':0x18eb});var socket=require(_0x1f5f('0xc'))(new Redis(config[_0x1f5f('0x9')]));require(_0x1f5f('0xd'))[_0x1f5f('0xe')](socket);function respondWithRpcPromise(_0x1fb835,_0x7896d4,_0x52f039){return new BPromise(function(_0x4a13a9,_0x37c9dd){return client[_0x1f5f('0xf')](_0x1fb835,_0x52f039)[_0x1f5f('0x10')](function(_0x3de04b){logger[_0x1f5f('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x7896d4,_0x1f5f('0x12'));logger[_0x1f5f('0x13')](_0x1f5f('0x14'),_0x7896d4,_0x1f5f('0x12'),JSON[_0x1f5f('0x15')](_0x3de04b));if(_0x3de04b['error']){if(_0x3de04b[_0x1f5f('0x16')]['code']===0x1f4){logger[_0x1f5f('0x16')](_0x1f5f('0x17'),_0x7896d4,_0x3de04b['error'][_0x1f5f('0x18')]);return _0x37c9dd(_0x3de04b[_0x1f5f('0x16')][_0x1f5f('0x18')]);}logger[_0x1f5f('0x16')](_0x1f5f('0x17'),_0x7896d4,_0x3de04b[_0x1f5f('0x16')][_0x1f5f('0x18')]);return _0x4a13a9(_0x3de04b[_0x1f5f('0x16')][_0x1f5f('0x18')]);}else{logger['info'](_0x1f5f('0x17'),_0x7896d4,'request\x20sent');_0x4a13a9(_0x3de04b[_0x1f5f('0x19')][_0x1f5f('0x18')]);}})[_0x1f5f('0x1a')](function(_0x246711){logger[_0x1f5f('0x16')](_0x1f5f('0x17'),_0x7896d4,_0x246711);_0x37c9dd(_0x246711);});});}exports[_0x1f5f('0x1b')]=function(_0x26c192){var _0x7cc0da=this;return new Promise(function(_0xb4a640,_0x5d6097){return db['FaxInteraction']['update'](_0x26c192[_0x1f5f('0x1c')],{'raw':_0x26c192[_0x1f5f('0x1d')]?_0x26c192[_0x1f5f('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c192[_0x1f5f('0x1d')]?_0x26c192[_0x1f5f('0x1d')][_0x1f5f('0x1e')]||null:null,'attributes':_0x26c192['options']?_0x26c192[_0x1f5f('0x1d')][_0x1f5f('0x1f')]||null:null,'limit':_0x26c192[_0x1f5f('0x1d')]?_0x26c192[_0x1f5f('0x1d')][_0x1f5f('0x20')]||null:null})[_0x1f5f('0x10')](function(_0x259d85){logger[_0x1f5f('0x11')]('UpdateFaxInteraction',_0x26c192);logger[_0x1f5f('0x13')](_0x1f5f('0x1b'),_0x26c192,JSON['stringify'](_0x259d85));_0xb4a640(_0x259d85);})[_0x1f5f('0x1a')](function(_0x443d0d){logger[_0x1f5f('0x16')](_0x1f5f('0x1b'),_0x443d0d[_0x1f5f('0x18')],_0x26c192);_0x5d6097(_0x7cc0da['error'](0x1f4,_0x443d0d[_0x1f5f('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0xdd7fad){return new Promise(function(_0x202fef,_0x398c4b){return db[_0x1f5f('0x21')][_0x1f5f('0x22')]({'where':_0xdd7fad['options']?_0xdd7fad[_0x1f5f('0x1d')][_0x1f5f('0x1e')]||null:null})[_0x1f5f('0x10')](function(_0x2b8caa){if(_0x2b8caa){return _0x2b8caa[_0x1f5f('0x23')](_0xdd7fad['body'][_0x1f5f('0x24')],_[_0x1f5f('0x25')](_0xdd7fad[_0x1f5f('0x1c')],[_0x1f5f('0x24'),'id'])||{});}})[_0x1f5f('0x26')](function(_0x4d27eb){logger[_0x1f5f('0x11')](_0x1f5f('0x27'),_0xdd7fad);logger[_0x1f5f('0x13')](_0x1f5f('0x27'),_0xdd7fad,JSON[_0x1f5f('0x15')](_0x4d27eb));_0x202fef(_0x4d27eb);})[_0x1f5f('0x1a')](function(_0x4c2391){logger[_0x1f5f('0x16')](_0x1f5f('0x27'),_0x4c2391[_0x1f5f('0x18')],_0xdd7fad);_0x398c4b(_this[_0x1f5f('0x16')](0x1f4,_0x4c2391['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4719b40..64a7506 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 _0x464f=['save','remove','update','emit','removeListener','register','faxInteraction:','./faxInteraction.events'];(function(_0x95572,_0x7c3d86){var _0x2a0565=function(_0x159c64){while(--_0x159c64){_0x95572['push'](_0x95572['shift']());}};_0x2a0565(++_0x7c3d86);}(_0x464f,0x127));var _0xf464=function(_0x4b4d99,_0x2e19f3){_0x4b4d99=_0x4b4d99-0x0;var _0x2908aa=_0x464f[_0x4b4d99];return _0x2908aa;};'use strict';var FaxInteractionEvents=require(_0xf464('0x0'));var events=[_0xf464('0x1'),_0xf464('0x2'),_0xf464('0x3')];function createListener(_0x246d6c,_0x30a338){return function(_0x5ae3f7){_0x30a338[_0xf464('0x4')](_0x246d6c,_0x5ae3f7);};}function removeListener(_0x363944,_0xb1022){return function(){FaxInteractionEvents[_0xf464('0x5')](_0x363944,_0xb1022);};}exports[_0xf464('0x6')]=function(_0x3f8eee){for(var _0x3f0fd0=0x0,_0x25901e=events['length'];_0x3f0fd0<_0x25901e;_0x3f0fd0++){var _0x5df3b7=events[_0x3f0fd0];var _0x22f33f=createListener(_0xf464('0x7')+_0x5df3b7,_0x3f8eee);FaxInteractionEvents['on'](_0x5df3b7,_0x22f33f);}}; \ No newline at end of file +var _0x011c=['save','remove','update','emit','removeListener','register','faxInteraction:','./faxInteraction.events'];(function(_0x101877,_0xba0b56){var _0x34c79a=function(_0x1aba0f){while(--_0x1aba0f){_0x101877['push'](_0x101877['shift']());}};_0x34c79a(++_0xba0b56);}(_0x011c,0xcf));var _0xc011=function(_0x2a3c11,_0x20ab70){_0x2a3c11=_0x2a3c11-0x0;var _0x273a2b=_0x011c[_0x2a3c11];return _0x273a2b;};'use strict';var FaxInteractionEvents=require(_0xc011('0x0'));var events=[_0xc011('0x1'),_0xc011('0x2'),_0xc011('0x3')];function createListener(_0x5665cc,_0x14b794){return function(_0x33b28f){_0x14b794[_0xc011('0x4')](_0x5665cc,_0x33b28f);};}function removeListener(_0xc32155,_0x36e0b0){return function(){FaxInteractionEvents[_0xc011('0x5')](_0xc32155,_0x36e0b0);};}exports[_0xc011('0x6')]=function(_0x39d3e6){for(var _0x40638b=0x0,_0xecaf2=events['length'];_0x40638b<_0xecaf2;_0x40638b++){var _0x2939ad=events[_0x40638b];var _0x6b06f2=createListener(_0xc011('0x7')+_0x2939ad,_0x39d3e6);FaxInteractionEvents['on'](_0x2939ad,_0x6b06f2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8a52e81..2a6da7d 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 _0xe555=['download','post','create','/:id/tags','tracked','addTags','put','fax','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages'];(function(_0x1fedd1,_0x9e045e){var _0x262a23=function(_0x10906e){while(--_0x10906e){_0x1fedd1['push'](_0x1fedd1['shift']());}};_0x262a23(++_0x9e045e);}(_0xe555,0x158));var _0x5e55=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0xe555[_0x1f239e];return _0x826971;};'use strict';var multer=require(_0x5e55('0x0'));var util=require(_0x5e55('0x1'));var path=require('path');var timeout=require(_0x5e55('0x2'));var express=require(_0x5e55('0x3'));var router=express['Router']();var fs_extra=require(_0x5e55('0x4'));var auth=require(_0x5e55('0x5'));var interaction=require(_0x5e55('0x6'));var config=require(_0x5e55('0x7'));var controller=require(_0x5e55('0x8'));router[_0x5e55('0x9')]('/',auth[_0x5e55('0xa')](),controller[_0x5e55('0xb')]);router[_0x5e55('0x9')](_0x5e55('0xc'),auth[_0x5e55('0xa')](),controller['describe']);router[_0x5e55('0x9')](_0x5e55('0xd'),auth[_0x5e55('0xa')](),controller['show']);router['get'](_0x5e55('0xe'),auth['isAuthenticated'](),controller[_0x5e55('0xf')]);router['get']('/:id/download',auth[_0x5e55('0xa')](),controller[_0x5e55('0x10')]);router[_0x5e55('0x11')]('/',auth[_0x5e55('0xa')](),controller[_0x5e55('0x12')]);router['post'](_0x5e55('0xe'),auth[_0x5e55('0xa')](),controller['addMessage']);router[_0x5e55('0x11')](_0x5e55('0x13'),auth[_0x5e55('0xa')](),interaction[_0x5e55('0x14')]('fax','faxinteraction:addtags'),controller[_0x5e55('0x15')]);router[_0x5e55('0x16')]('/:id',auth[_0x5e55('0xa')](),interaction[_0x5e55('0x14')](_0x5e55('0x17'),_0x5e55('0x18')),controller['update']);router[_0x5e55('0x19')](_0x5e55('0xd'),auth[_0x5e55('0xa')](),interaction['tracked'](_0x5e55('0x17'),_0x5e55('0x1a')),controller[_0x5e55('0x1b')]);router[_0x5e55('0x19')](_0x5e55('0x13'),auth['isAuthenticated'](),controller[_0x5e55('0x1c')]);module[_0x5e55('0x1d')]=router; \ No newline at end of file +var _0x8a47=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util'];(function(_0x5903cc,_0x576d33){var _0x4ce958=function(_0x434d78){while(--_0x434d78){_0x5903cc['push'](_0x5903cc['shift']());}};_0x4ce958(++_0x576d33);}(_0x8a47,0x17e));var _0x78a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8a47[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x78a4('0x0'));var util=require(_0x78a4('0x1'));var path=require(_0x78a4('0x2'));var timeout=require(_0x78a4('0x3'));var express=require('express');var router=express[_0x78a4('0x4')]();var fs_extra=require(_0x78a4('0x5'));var auth=require(_0x78a4('0x6'));var interaction=require(_0x78a4('0x7'));var config=require('../../config/environment');var controller=require(_0x78a4('0x8'));router['get']('/',auth[_0x78a4('0x9')](),controller[_0x78a4('0xa')]);router['get']('/describe',auth[_0x78a4('0x9')](),controller['describe']);router[_0x78a4('0xb')](_0x78a4('0xc'),auth[_0x78a4('0x9')](),controller[_0x78a4('0xd')]);router[_0x78a4('0xb')](_0x78a4('0xe'),auth[_0x78a4('0x9')](),controller[_0x78a4('0xf')]);router[_0x78a4('0xb')](_0x78a4('0x10'),auth[_0x78a4('0x9')](),controller[_0x78a4('0x11')]);router[_0x78a4('0x12')]('/',auth[_0x78a4('0x9')](),controller['create']);router[_0x78a4('0x12')](_0x78a4('0xe'),auth[_0x78a4('0x9')](),controller[_0x78a4('0x13')]);router[_0x78a4('0x12')]('/:id/tags',auth[_0x78a4('0x9')](),interaction[_0x78a4('0x14')](_0x78a4('0x15'),_0x78a4('0x16')),controller[_0x78a4('0x17')]);router[_0x78a4('0x18')](_0x78a4('0xc'),auth[_0x78a4('0x9')](),interaction[_0x78a4('0x14')](_0x78a4('0x15'),'faxinteraction:update'),controller[_0x78a4('0x19')]);router[_0x78a4('0x1a')](_0x78a4('0xc'),auth[_0x78a4('0x9')](),interaction[_0x78a4('0x14')](_0x78a4('0x15'),_0x78a4('0x1b')),controller[_0x78a4('0x1c')]);router[_0x78a4('0x1a')](_0x78a4('0x1d'),auth['isAuthenticated'](),controller[_0x78a4('0x1e')]);module[_0x78a4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 9b2fca1..95b3472 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 _0x89e8=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x1baa9b,_0x2e5917){var _0x538a9e=function(_0x5be711){while(--_0x5be711){_0x1baa9b['push'](_0x1baa9b['shift']());}};_0x538a9e(++_0x2e5917);}(_0x89e8,0x74));var _0x889e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x89e8[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x889e('0x0'));module[_0x889e('0x1')]={'body':{'type':Sequelize[_0x889e('0x2')](_0x889e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x889e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x889e('0x5')]('in',_0x889e('0x6')),'defaultValue':_0x889e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xc125=['exports','medium','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x5d44b2,_0x5456de){var _0x2b58a6=function(_0x5c8a29){while(--_0x5c8a29){_0x5d44b2['push'](_0x5d44b2['shift']());}};_0x2b58a6(++_0x5456de);}(_0xc125,0x150));var _0x5c12=function(_0x5358c1,_0x20d8f3){_0x5358c1=_0x5358c1-0x0;var _0x3af904=_0xc125[_0x5358c1];return _0x3af904;};'use strict';var Sequelize=require('sequelize');module[_0x5c12('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5c12('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5c12('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5c12('0x3')]('in',_0x5c12('0x4')),'defaultValue':_0x5c12('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5c12('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5c12('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 637f169..56b5393 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 _0xef18=['fullname','email','manual','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','Sequelize','internal','motionChannel','rejectmessage','create','Attachment','findOne','SendFax','FaxAccountId','AttachmentId','join','root','server','files','attachments','download','basename','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','then','findAll','rows','show','params','rawAttributes','includeAll','include','body','find','describe','accept','fax','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','update','isNil','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact'];(function(_0x179b74,_0x5dc97d){var _0x268f76=function(_0x19c8c2){while(--_0x19c8c2){_0x179b74['push'](_0x179b74['shift']());}};_0x268f76(++_0x5dc97d);}(_0xef18,0xac));var _0x8ef1=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xef18[_0x45d1fd];return _0xd0e542;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ef1('0x0'));var zipdir=require(_0x8ef1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ef1('0x2'));var BPromise=require(_0x8ef1('0x3'));var Mustache=require(_0x8ef1('0x4'));var util=require(_0x8ef1('0x5'));var path=require(_0x8ef1('0x6'));var sox=require(_0x8ef1('0x7'));var csv=require(_0x8ef1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ef1('0x9'));var _=require(_0x8ef1('0xa'));var squel=require(_0x8ef1('0xb'));var crypto=require(_0x8ef1('0xc'));var jsforce=require(_0x8ef1('0xd'));var deskjs=require(_0x8ef1('0xe'));var toCsv=require(_0x8ef1('0x8'));var querystring=require(_0x8ef1('0xf'));var Papa=require(_0x8ef1('0x10'));var Redis=require(_0x8ef1('0x11'));var authService=require(_0x8ef1('0x12'));var qs=require(_0x8ef1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ef1('0x14'))('api');var utils=require(_0x8ef1('0x15'));var config=require(_0x8ef1('0x16'));var licenseUtil=require(_0x8ef1('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8ef1('0x18')](config[_0x8ef1('0x19')],{'host':_0x8ef1('0x1a'),'port':0x18eb});var socket=require(_0x8ef1('0x1b'))(new Redis(config[_0x8ef1('0x19')]));require(_0x8ef1('0x1c'))[_0x8ef1('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8ef1('0x1e')][_0x8ef1('0x1f')]({'port':0x232c});var client9002=jayson[_0x8ef1('0x1e')][_0x8ef1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2ba15f,_0x1daa7c,_0x532b80,_0xf84418){return new BPromise(function(_0x33a7ce,_0x43836f){var _0x29cf80=_0xf84418||client;return _0x29cf80[_0x8ef1('0x20')](_0x2ba15f,_0x532b80)['then'](function(_0x5c5a2d){logger[_0x8ef1('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1daa7c,_0x8ef1('0x22'));logger[_0x8ef1('0x23')](_0x8ef1('0x24'),_0x1daa7c,_0x8ef1('0x22'),JSON['stringify'](_0x5c5a2d));if(_0x5c5a2d[_0x8ef1('0x25')]){if(_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x26')]===0x1f4){logger[_0x8ef1('0x25')](_0x8ef1('0x27'),_0x1daa7c,_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x28')]);return _0x43836f(_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x28')]);}logger[_0x8ef1('0x25')](_0x8ef1('0x27'),_0x1daa7c,_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x28')]);return _0x33a7ce(_0x5c5a2d[_0x8ef1('0x25')]['message']);}else{logger['info'](_0x8ef1('0x27'),_0x1daa7c,_0x8ef1('0x22'));_0x33a7ce(_0x5c5a2d[_0x8ef1('0x29')][_0x8ef1('0x28')]);}})[_0x8ef1('0x2a')](function(_0x18ca7c){logger[_0x8ef1('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1daa7c,_0x18ca7c);_0x43836f(_0x18ca7c);});});}function respondWithStatusCode(_0x18ec91,_0xf5f47){_0xf5f47=_0xf5f47||0xcc;return function(_0x226dcb){if(_0x226dcb){return _0x18ec91[_0x8ef1('0x2b')](_0xf5f47);}return _0x18ec91[_0x8ef1('0x2c')](_0xf5f47)[_0x8ef1('0x2d')]();};}function respondWithResult(_0xf57fe1,_0x4e72af){_0x4e72af=_0x4e72af||0xc8;return function(_0x4d345b){if(_0x4d345b){return _0xf57fe1[_0x8ef1('0x2c')](_0x4e72af)[_0x8ef1('0x2e')](_0x4d345b);}};}function respondWithFilteredResult(_0x233a39,_0x36540a){return function(_0xd8c8a1){if(_0xd8c8a1){var _0x4b7cf3=typeof _0x36540a['offset']===_0x8ef1('0x2f')&&typeof _0x36540a['limit']===_0x8ef1('0x2f');var _0x5ae32b=_0xd8c8a1['count'];var _0x1b979b=_0x4b7cf3?0x0:_0x36540a[_0x8ef1('0x30')];var _0x2fcba4=_0x4b7cf3?_0xd8c8a1[_0x8ef1('0x31')]:_0x36540a[_0x8ef1('0x30')]+_0x36540a['limit'];var _0x46974c;if(_0x2fcba4>=_0x5ae32b){_0x2fcba4=_0x5ae32b;_0x46974c=0xc8;}else{_0x46974c=0xce;}_0x233a39[_0x8ef1('0x2c')](_0x46974c);return _0x233a39[_0x8ef1('0x32')](_0x8ef1('0x33'),_0x1b979b+'-'+_0x2fcba4+'/'+_0x5ae32b)[_0x8ef1('0x2e')](_0xd8c8a1);}return null;};}function patchUpdates(_0x3f4051){return function(_0x148a26){try{jsonpatch[_0x8ef1('0x34')](_0x148a26,_0x3f4051,!![]);}catch(_0x3f7bb0){return BPromise[_0x8ef1('0x35')](_0x3f7bb0);}return _0x148a26[_0x8ef1('0x36')]();};}function saveUpdates(_0x1652bb,_0x31f4a2){return function(_0x5f5536){if(_0x5f5536){return _0x5f5536['update'](_0x1652bb)['then'](function(_0x2ae5a4){return _0x2ae5a4;});}return null;};}function removeEntity(_0x3364dd,_0x3ad01b){return function(_0x14cb60){if(_0x14cb60){return _0x14cb60[_0x8ef1('0x37')]()['then'](function(){_0x3364dd[_0x8ef1('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8fe0,_0x27948b){return function(_0x5d1f14){if(!_0x5d1f14){_0x3e8fe0[_0x8ef1('0x2b')](0x194);}return _0x5d1f14;};}function handleError(_0x52dca8,_0xc02b57){_0xc02b57=_0xc02b57||0x1f4;return function(_0x52f4e4){logger[_0x8ef1('0x25')](_0x52f4e4[_0x8ef1('0x38')]);if(_0x52f4e4['name']){delete _0x52f4e4[_0x8ef1('0x39')];}_0x52dca8[_0x8ef1('0x2c')](_0xc02b57)[_0x8ef1('0x3a')](_0x52f4e4);};}exports['index']=function(_0x1aba77,_0xe98d05){var _0x500723={},_0x33ec97={},_0x1a1eb6={'count':0x0,'rows':[]};var _0xffa52d=_[_0x8ef1('0x3b')](db[_0x8ef1('0x3c')]['rawAttributes'],function(_0x6d5a8b){return{'name':_0x6d5a8b[_0x8ef1('0x3d')],'type':_0x6d5a8b[_0x8ef1('0x3e')][_0x8ef1('0x3f')]};});_0x33ec97[_0x8ef1('0x40')]=_['map'](_0xffa52d,_0x8ef1('0x39'));_0x33ec97[_0x8ef1('0x41')]=_[_0x8ef1('0x42')](_0x1aba77[_0x8ef1('0x41')]);_0x33ec97[_0x8ef1('0x43')]=_[_0x8ef1('0x44')](_0x33ec97['model'],_0x33ec97[_0x8ef1('0x41')]);_0x500723[_0x8ef1('0x45')]=_[_0x8ef1('0x44')](_0x33ec97[_0x8ef1('0x40')],qs[_0x8ef1('0x46')](_0x1aba77[_0x8ef1('0x41')]['fields']));_0x500723['attributes']=_0x500723[_0x8ef1('0x45')]['length']?_0x500723[_0x8ef1('0x45')]:_0x33ec97[_0x8ef1('0x40')];if(!_0x1aba77['query'][_0x8ef1('0x47')](_0x8ef1('0x48'))){_0x500723['limit']=qs[_0x8ef1('0x49')](_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x49')]);_0x500723[_0x8ef1('0x30')]=qs[_0x8ef1('0x30')](_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x30')]);}_0x500723['order']=qs[_0x8ef1('0x4a')](_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x4a')]);_0x500723[_0x8ef1('0x4b')]=qs['filters'](_[_0x8ef1('0x4c')](_0x1aba77[_0x8ef1('0x41')],_0x33ec97[_0x8ef1('0x43')]),_0xffa52d);if(_0x1aba77['query'][_0x8ef1('0x4d')]){_0x500723['where']=_['merge'](_0x500723[_0x8ef1('0x4b')],{'$or':_[_0x8ef1('0x3b')](_0xffa52d,function(_0x3fcb87){if(_0x3fcb87[_0x8ef1('0x3e')]!==_0x8ef1('0x4e')){var _0x2e4585={};_0x2e4585[_0x3fcb87[_0x8ef1('0x39')]]={'$like':'%'+_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x4d')]+'%'};return _0x2e4585;}})});}_0x500723=_[_0x8ef1('0x4f')]({},_0x500723,_0x1aba77[_0x8ef1('0x50')]);var _0x41230e={'where':_0x500723[_0x8ef1('0x4b')]};return db[_0x8ef1('0x3c')][_0x8ef1('0x31')](_0x41230e)[_0x8ef1('0x51')](function(_0x2c3689){_0x1a1eb6[_0x8ef1('0x31')]=_0x2c3689;if(_0x1aba77[_0x8ef1('0x41')]['includeAll']){_0x500723['include']=[{'all':!![]}];}return db[_0x8ef1('0x3c')][_0x8ef1('0x52')](_0x500723);})[_0x8ef1('0x51')](function(_0x3274b8){_0x1a1eb6[_0x8ef1('0x53')]=_0x3274b8;return _0x1a1eb6;})[_0x8ef1('0x51')](respondWithFilteredResult(_0xe98d05,_0x500723))[_0x8ef1('0x2a')](handleError(_0xe98d05,null));};exports[_0x8ef1('0x54')]=function(_0x1f5bd6,_0x1eb345){var _0xc6da21={'raw':!![],'where':{'id':_0x1f5bd6[_0x8ef1('0x55')]['id']}},_0x2eeeca={};_0x2eeeca[_0x8ef1('0x40')]=_[_0x8ef1('0x42')](db[_0x8ef1('0x3c')][_0x8ef1('0x56')]);_0x2eeeca[_0x8ef1('0x41')]=_[_0x8ef1('0x42')](_0x1f5bd6['query']);_0x2eeeca[_0x8ef1('0x43')]=_[_0x8ef1('0x44')](_0x2eeeca[_0x8ef1('0x40')],_0x2eeeca[_0x8ef1('0x41')]);_0xc6da21[_0x8ef1('0x45')]=_[_0x8ef1('0x44')](_0x2eeeca[_0x8ef1('0x40')],qs['fields'](_0x1f5bd6[_0x8ef1('0x41')][_0x8ef1('0x46')]));_0xc6da21['attributes']=_0xc6da21[_0x8ef1('0x45')]['length']?_0xc6da21['attributes']:_0x2eeeca[_0x8ef1('0x40')];if(_0x1f5bd6[_0x8ef1('0x41')][_0x8ef1('0x57')]){_0xc6da21[_0x8ef1('0x58')]=[{'all':!![]}];}_0xc6da21=_[_0x8ef1('0x4f')]({},_0xc6da21,_0x1f5bd6[_0x8ef1('0x50')]);return db[_0x8ef1('0x3c')]['find'](_0xc6da21)[_0x8ef1('0x51')](handleEntityNotFound(_0x1eb345,null))['then'](respondWithResult(_0x1eb345,null))[_0x8ef1('0x2a')](handleError(_0x1eb345,null));};exports['update']=function(_0x499aa6,_0x3477ba){if(_0x499aa6[_0x8ef1('0x59')]['id']){delete _0x499aa6[_0x8ef1('0x59')]['id'];}return db[_0x8ef1('0x3c')][_0x8ef1('0x5a')]({'where':{'id':_0x499aa6[_0x8ef1('0x55')]['id']}})[_0x8ef1('0x51')](handleEntityNotFound(_0x3477ba,null))[_0x8ef1('0x51')](saveUpdates(_0x499aa6[_0x8ef1('0x59')],null))[_0x8ef1('0x51')](respondWithResult(_0x3477ba,null))['catch'](handleError(_0x3477ba,null));};exports[_0x8ef1('0x37')]=function(_0x3c4c3d,_0x169ac4){return db[_0x8ef1('0x3c')][_0x8ef1('0x5a')]({'where':{'id':_0x3c4c3d[_0x8ef1('0x55')]['id']}})[_0x8ef1('0x51')](handleEntityNotFound(_0x169ac4,null))[_0x8ef1('0x51')](removeEntity(_0x169ac4,null))[_0x8ef1('0x2a')](handleError(_0x169ac4,null));};exports['describe']=function(_0x37852b,_0x15ff69){return db[_0x8ef1('0x3c')][_0x8ef1('0x5b')]()[_0x8ef1('0x51')](respondWithResult(_0x15ff69,null))[_0x8ef1('0x2a')](handleError(_0x15ff69,null));};var interaction_log=require(_0x8ef1('0x14'))('fax-interactions');exports[_0x8ef1('0x5c')]=function(_0xd7b905,_0x30e6b2,_0x528d01){var _0x21b7ad={'agent':{},'channel':_0x8ef1('0x5d')};if(_0xd7b905[_0x8ef1('0x59')]['id']){delete _0xd7b905[_0x8ef1('0x59')]['id'];}_0xd7b905[_0x8ef1('0x59')]['read']=!![];_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x5e')]=moment()[_0x8ef1('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')]=_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')]||_0xd7b905[_0x8ef1('0x61')]['id'];_0x21b7ad[_0x8ef1('0x62')]['id']=_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')];return db[_0x8ef1('0x3c')]['find']({'where':{'id':_0xd7b905[_0x8ef1('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30e6b2,null))[_0x8ef1('0x51')](saveUpdates(_0xd7b905['body'],null))[_0x8ef1('0x51')](function(_0x83d6b0){if(_0x83d6b0){_0x21b7ad['message']=_0x83d6b0[_0x8ef1('0x63')]({'plain':!![]});return db[_0x8ef1('0x64')][_0x8ef1('0x5a')]({'where':{'id':_0x83d6b0[_0x8ef1('0x65')]}});}return null;})[_0x8ef1('0x51')](handleEntityNotFound(_0x30e6b2,null))[_0x8ef1('0x51')](function(_0xe5becc){if(_0xe5becc){return _0xe5becc[_0x8ef1('0x66')]({'UserId':_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')],'read1stAt':_[_0x8ef1('0x67')](_0xe5becc['read1stAt'])?moment()[_0x8ef1('0x5f')](_0x8ef1('0x68')):undefined});}return null;})[_0x8ef1('0x51')](function(_0x57f2ed){if(_0x57f2ed){_0x21b7ad['interaction']=_0x57f2ed['get']({'plain':!![]});interaction_log['info'](_0x8ef1('0x69'),_0xd7b905[_0x8ef1('0x61')]['id'],_0xd7b905['user'][_0x8ef1('0x39')],_0xd7b905[_0x8ef1('0x61')][_0x8ef1('0x6a')],_0x21b7ad[_0x8ef1('0x6b')]['id'],_0xd7b905['body']?JSON['stringify'](_0xd7b905['body']):_0x8ef1('0x6c'));return respondWithRpcPromise(_0x8ef1('0x6d'),'acceptMessage',_0x21b7ad);}return null;})[_0x8ef1('0x51')](function(_0x24cab7){var _0x21197b=_0x8ef1('0x6e')+_0x24cab7[_0x8ef1('0x28')][_0x8ef1('0x6f')];return db[_0x8ef1('0x70')][_0x8ef1('0x41')](_0x21197b,{'type':db['Sequelize'][_0x8ef1('0x71')][_0x8ef1('0x72')],'raw':!![]})[_0x8ef1('0x51')](function(_0x39e095){return _0x39e095;});})['then'](function(_0x69fdac){if(_0x69fdac){_0x21b7ad[_0x8ef1('0x28')][_0x8ef1('0x73')]=_0x69fdac[0x0];if(!_0xd7b905['body'][_0x8ef1('0x60')])return;return db['User'][_0x8ef1('0x5a')]({'where':{'id':_0xd7b905['body'][_0x8ef1('0x60')],'role':_0x8ef1('0x62')},'attributes':['id','name',_0x8ef1('0x74'),_0x8ef1('0x75'),'internal'],'raw':!![]});}return null;})[_0x8ef1('0x51')](function(_0x325a02){if(!_0x325a02)return null;_0x21b7ad[_0x8ef1('0x28')][_0x8ef1('0x62')]=_0x325a02;return _0x21b7ad;})['then'](function(_0x232e56){if(_0x232e56){if(_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x76')]){_0x21b7ad['message']['interface']=util[_0x8ef1('0x5f')](_0x8ef1('0x77'),_0xd7b905['user']['name']);_0x21b7ad['message'][_0x8ef1('0x78')]=_0x21b7ad['channel'];_0x21b7ad[_0x8ef1('0x28')]['motionChannel']=_0x21b7ad[_0x8ef1('0x78')];_0x21b7ad[_0x8ef1('0x28')][_0x8ef1('0x79')]='accept';return respondWithRpcPromise(_0x8ef1('0x7a'),'EventManager',{'event':_0x8ef1('0x7b'),'message':_0x21b7ad[_0x8ef1('0x28')]},client9002)[_0x8ef1('0x51')](function(){return _0x21b7ad;});}return _0x21b7ad;}return null;})[_0x8ef1('0x51')](respondWithResult(_0x30e6b2,null))['catch'](handleError(_0x30e6b2,null));};var interaction_log=require(_0x8ef1('0x14'))('fax-interactions');exports[_0x8ef1('0x35')]=function(_0x1a18cc,_0x58aab9,_0xf2f6ac){var _0x4ef4b4={'agent':{},'channel':'fax'};if(_0x1a18cc[_0x8ef1('0x59')]['id']){delete _0x1a18cc['body']['id'];}_0x1a18cc['body'][_0x8ef1('0x60')]=_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')]||_0x1a18cc[_0x8ef1('0x61')]['id'];_0x4ef4b4[_0x8ef1('0x62')]['id']=_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')];return db['FaxMessage'][_0x8ef1('0x5a')]({'where':{'id':_0x1a18cc[_0x8ef1('0x55')]['id'],'UserId':null}})[_0x8ef1('0x51')](handleEntityNotFound(_0x58aab9,null))[_0x8ef1('0x51')](function(_0x124885){if(_0x124885){_0x4ef4b4[_0x8ef1('0x28')]=_0x124885[_0x8ef1('0x63')]({'plain':!![]});return db[_0x8ef1('0x64')][_0x8ef1('0x5a')]({'where':{'id':_0x124885[_0x8ef1('0x65')]}});}return null;})[_0x8ef1('0x51')](handleEntityNotFound(_0x58aab9,null))[_0x8ef1('0x51')](function(_0x3c4326){if(_0x3c4326){_0x4ef4b4[_0x8ef1('0x6b')]=_0x3c4326[_0x8ef1('0x63')]({'plain':!![]});interaction_log['info'](_0x8ef1('0x7c'),_0x1a18cc['user']['id'],_0x1a18cc[_0x8ef1('0x61')][_0x8ef1('0x39')],_0x1a18cc['user'][_0x8ef1('0x6a')],_0x4ef4b4[_0x8ef1('0x6b')]['id'],_0x1a18cc[_0x8ef1('0x59')]?JSON[_0x8ef1('0x7d')](_0x1a18cc[_0x8ef1('0x59')]):_0x8ef1('0x6c'));return respondWithRpcPromise('RejectMessage',_0x8ef1('0x7e'),_0x4ef4b4);}return null;})[_0x8ef1('0x51')](function(_0x565d59){var _0x32c53b=_0x8ef1('0x6e')+_0x565d59[_0x8ef1('0x28')][_0x8ef1('0x6f')];return db[_0x8ef1('0x70')][_0x8ef1('0x41')](_0x32c53b,{'type':db[_0x8ef1('0x7f')][_0x8ef1('0x71')]['SELECT'],'raw':!![]})[_0x8ef1('0x51')](function(_0x113cbb){return _0x113cbb;});})['then'](function(_0x4beeed){if(_0x4beeed){_0x4ef4b4[_0x8ef1('0x28')][_0x8ef1('0x73')]=_0x4beeed[0x0];if(!_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')])return;return db['User'][_0x8ef1('0x5a')]({'where':{'id':_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')],'role':_0x8ef1('0x62')},'attributes':['id',_0x8ef1('0x39'),'fullname','email',_0x8ef1('0x80')],'raw':!![]});}return null;})[_0x8ef1('0x51')](function(_0x414d55){if(!_0x414d55)return null;_0x4ef4b4['message'][_0x8ef1('0x62')]=_0x414d55;return _0x4ef4b4;})['then'](function(_0x14b765){if(_0x14b765){_0x14b765['message']['interface']=util['format'](_0x8ef1('0x77'),_0x1a18cc[_0x8ef1('0x61')][_0x8ef1('0x39')]);_0x14b765[_0x8ef1('0x28')]['channel']=_0x4ef4b4[_0x8ef1('0x78')];_0x14b765['message'][_0x8ef1('0x81')]=_0x4ef4b4[_0x8ef1('0x78')];_0x14b765[_0x8ef1('0x28')]['event']=_0x8ef1('0x35');respondWithRpcPromise(_0x8ef1('0x7a'),_0x8ef1('0x7a'),{'event':_0x8ef1('0x82'),'message':_0x14b765[_0x8ef1('0x28')]},client9002);return _0x4ef4b4;}return null;})['then'](respondWithResult(_0x58aab9,null))[_0x8ef1('0x2a')](handleError(_0x58aab9,null));};exports[_0x8ef1('0x83')]=function(_0x45a6a9,_0x826a9e){var _0x63479c;return db['FaxMessage']['create'](_0x45a6a9[_0x8ef1('0x59')],{})[_0x8ef1('0x51')](function(_0x694b55){_0x63479c=_0x694b55;return db['CmContact']['findOne']({'where':{'id':_0x63479c[_0x8ef1('0x6f')]}});})[_0x8ef1('0x51')](function(_0x5492d0){if(_[_0x8ef1('0x67')](_0x5492d0)){return;}else{_0x63479c['fax']=_0x5492d0[_0x8ef1('0x5d')];return db[_0x8ef1('0x84')][_0x8ef1('0x85')]({'where':{'id':_0x63479c['AttachmentId']}});}})[_0x8ef1('0x51')](function(_0x3790de){return respondWithRpcPromise('SendFax',_0x8ef1('0x86'),{'FaxAccountId':_[_0x8ef1('0x67')](_0x45a6a9[_0x8ef1('0x59')])?undefined:_0x45a6a9['body'][_0x8ef1('0x87')],'path':_[_0x8ef1('0x67')](_0x3790de)?undefined:util[_0x8ef1('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x3790de['basename']),'fax':_['isNil'](_0x63479c[_0x8ef1('0x5d')])?undefined:_0x63479c['fax'],'AttachmentId':_0x63479c[_0x8ef1('0x88')]},client9002);})['then'](respondWithResult(_0x826a9e,0xc9))[_0x8ef1('0x2a')](handleError(_0x826a9e,null));};exports['download']=function(_0x35125a,_0x3d8682){var _0x7ca40d=path[_0x8ef1('0x89')](config[_0x8ef1('0x8a')],_0x8ef1('0x8b'),_0x8ef1('0x8c'),_0x8ef1('0x8d'));return db['FaxMessage'][_0x8ef1('0x5a')]({'where':{'id':_0x35125a[_0x8ef1('0x55')]['id']},'include':[{'model':db[_0x8ef1('0x84')],'as':_0x8ef1('0x84')}]})['then'](handleEntityNotFound(_0x3d8682,null))[_0x8ef1('0x51')](function(_0x17f729){if(_0x17f729){return _0x3d8682[_0x8ef1('0x8e')](path[_0x8ef1('0x89')](_0x7ca40d,_0x17f729[_0x8ef1('0x84')][_0x8ef1('0x8f')]));}})[_0x8ef1('0x2a')](handleError(_0x3d8682,null));}; \ No newline at end of file +var _0xf784=['socket.io-emitter','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','count','offset','set','Content-Range','json','apply','save','update','destroy','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','show','params','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','name','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','reject','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','interface','create','CmContact','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','defaults','redis'];(function(_0x1a49fc,_0x527071){var _0x5589fc=function(_0x1bf972){while(--_0x1bf972){_0x1a49fc['push'](_0x1a49fc['shift']());}};_0x5589fc(++_0x527071);}(_0xf784,0x185));var _0x4f78=function(_0x12752a,_0x2d9868){_0x12752a=_0x12752a-0x0;var _0x585a58=_0xf784[_0x12752a];return _0x585a58;};'use strict';var emlformat=require(_0x4f78('0x0'));var rimraf=require(_0x4f78('0x1'));var zipdir=require(_0x4f78('0x2'));var jsonpatch=require(_0x4f78('0x3'));var rp=require(_0x4f78('0x4'));var moment=require(_0x4f78('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f78('0x6'));var path=require(_0x4f78('0x7'));var sox=require(_0x4f78('0x8'));var csv=require(_0x4f78('0x9'));var ejs=require(_0x4f78('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f78('0xb'));var squel=require(_0x4f78('0xc'));var crypto=require('crypto');var jsforce=require(_0x4f78('0xd'));var deskjs=require(_0x4f78('0xe'));var toCsv=require(_0x4f78('0x9'));var querystring=require(_0x4f78('0xf'));var Papa=require(_0x4f78('0x10'));var Redis=require(_0x4f78('0x11'));var authService=require(_0x4f78('0x12'));var qs=require(_0x4f78('0x13'));var as=require(_0x4f78('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4f78('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4f78('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4f78('0x17')](config[_0x4f78('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f78('0x19'))(new Redis(config[_0x4f78('0x18')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x4f78('0x1a'));var client=jayson[_0x4f78('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x4f78('0x1b')][_0x4f78('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1d2520,_0x3bd484,_0x3fe7d9,_0x1edc74){return new BPromise(function(_0x2b0354,_0x3d9962){var _0x35633d=_0x1edc74||client;return _0x35633d[_0x4f78('0x1d')](_0x1d2520,_0x3fe7d9)[_0x4f78('0x1e')](function(_0x25d3ab){logger[_0x4f78('0x1f')](_0x4f78('0x20'),_0x3bd484,'request\x20sent');logger[_0x4f78('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3bd484,_0x4f78('0x22'),JSON[_0x4f78('0x23')](_0x25d3ab));if(_0x25d3ab[_0x4f78('0x24')]){if(_0x25d3ab['error'][_0x4f78('0x25')]===0x1f4){logger[_0x4f78('0x24')](_0x4f78('0x20'),_0x3bd484,_0x25d3ab[_0x4f78('0x24')]['message']);return _0x3d9962(_0x25d3ab[_0x4f78('0x24')][_0x4f78('0x26')]);}logger[_0x4f78('0x24')](_0x4f78('0x20'),_0x3bd484,_0x25d3ab[_0x4f78('0x24')][_0x4f78('0x26')]);return _0x2b0354(_0x25d3ab[_0x4f78('0x24')][_0x4f78('0x26')]);}else{logger[_0x4f78('0x1f')](_0x4f78('0x20'),_0x3bd484,_0x4f78('0x22'));_0x2b0354(_0x25d3ab[_0x4f78('0x27')][_0x4f78('0x26')]);}})[_0x4f78('0x28')](function(_0x1717e4){logger[_0x4f78('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3bd484,_0x1717e4);_0x3d9962(_0x1717e4);});});}function respondWithStatusCode(_0x299597,_0x24c800){_0x24c800=_0x24c800||0xcc;return function(_0x30145){if(_0x30145){return _0x299597['sendStatus'](_0x24c800);}return _0x299597[_0x4f78('0x29')](_0x24c800)[_0x4f78('0x2a')]();};}function respondWithResult(_0x497d3c,_0x5a32ae){_0x5a32ae=_0x5a32ae||0xc8;return function(_0x330df5){if(_0x330df5){return _0x497d3c[_0x4f78('0x29')](_0x5a32ae)['json'](_0x330df5);}};}function respondWithFilteredResult(_0xca6ab8,_0x2bdfea){return function(_0x1fd9f3){if(_0x1fd9f3){var _0x687f16=typeof _0x2bdfea['offset']===_0x4f78('0x2b')&&typeof _0x2bdfea['limit']===_0x4f78('0x2b');var _0x8d7eab=_0x1fd9f3[_0x4f78('0x2c')];var _0x1f3395=_0x687f16?0x0:_0x2bdfea[_0x4f78('0x2d')];var _0x2db1d6=_0x687f16?_0x1fd9f3[_0x4f78('0x2c')]:_0x2bdfea[_0x4f78('0x2d')]+_0x2bdfea['limit'];var _0x34007c;if(_0x2db1d6>=_0x8d7eab){_0x2db1d6=_0x8d7eab;_0x34007c=0xc8;}else{_0x34007c=0xce;}_0xca6ab8[_0x4f78('0x29')](_0x34007c);return _0xca6ab8[_0x4f78('0x2e')](_0x4f78('0x2f'),_0x1f3395+'-'+_0x2db1d6+'/'+_0x8d7eab)[_0x4f78('0x30')](_0x1fd9f3);}return null;};}function patchUpdates(_0x12eacd){return function(_0x26525f){try{jsonpatch[_0x4f78('0x31')](_0x26525f,_0x12eacd,!![]);}catch(_0x2ab7bd){return BPromise['reject'](_0x2ab7bd);}return _0x26525f[_0x4f78('0x32')]();};}function saveUpdates(_0x10736f,_0x3eac72){return function(_0x249cb5){if(_0x249cb5){return _0x249cb5[_0x4f78('0x33')](_0x10736f)[_0x4f78('0x1e')](function(_0x2c9378){return _0x2c9378;});}return null;};}function removeEntity(_0x8e2f9b,_0x435d14){return function(_0x52b1c9){if(_0x52b1c9){return _0x52b1c9[_0x4f78('0x34')]()['then'](function(){_0x8e2f9b[_0x4f78('0x29')](0xcc)[_0x4f78('0x2a')]();});}};}function handleEntityNotFound(_0x32258a,_0x2c6808){return function(_0x321e01){if(!_0x321e01){_0x32258a['sendStatus'](0x194);}return _0x321e01;};}function handleError(_0x224175,_0x346171){_0x346171=_0x346171||0x1f4;return function(_0x5c7044){logger[_0x4f78('0x24')](_0x5c7044['stack']);if(_0x5c7044['name']){delete _0x5c7044['name'];}_0x224175[_0x4f78('0x29')](_0x346171)[_0x4f78('0x35')](_0x5c7044);};}exports[_0x4f78('0x36')]=function(_0x1b5ee3,_0x19946e){var _0x3db7b3={},_0x33d70c={},_0x3dc8b3={'count':0x0,'rows':[]};var _0x48da54=_['map'](db[_0x4f78('0x37')][_0x4f78('0x38')],function(_0x4b2633){return{'name':_0x4b2633[_0x4f78('0x39')],'type':_0x4b2633[_0x4f78('0x3a')][_0x4f78('0x3b')]};});_0x33d70c[_0x4f78('0x3c')]=_[_0x4f78('0x3d')](_0x48da54,'name');_0x33d70c[_0x4f78('0x3e')]=_[_0x4f78('0x3f')](_0x1b5ee3[_0x4f78('0x3e')]);_0x33d70c[_0x4f78('0x40')]=_['intersection'](_0x33d70c[_0x4f78('0x3c')],_0x33d70c[_0x4f78('0x3e')]);_0x3db7b3[_0x4f78('0x41')]=_[_0x4f78('0x42')](_0x33d70c[_0x4f78('0x3c')],qs['fields'](_0x1b5ee3[_0x4f78('0x3e')][_0x4f78('0x43')]));_0x3db7b3[_0x4f78('0x41')]=_0x3db7b3['attributes'][_0x4f78('0x44')]?_0x3db7b3['attributes']:_0x33d70c[_0x4f78('0x3c')];if(!_0x1b5ee3[_0x4f78('0x3e')][_0x4f78('0x45')](_0x4f78('0x46'))){_0x3db7b3[_0x4f78('0x47')]=qs[_0x4f78('0x47')](_0x1b5ee3['query'][_0x4f78('0x47')]);_0x3db7b3[_0x4f78('0x2d')]=qs['offset'](_0x1b5ee3[_0x4f78('0x3e')][_0x4f78('0x2d')]);}_0x3db7b3[_0x4f78('0x48')]=qs['sort'](_0x1b5ee3[_0x4f78('0x3e')][_0x4f78('0x49')]);_0x3db7b3[_0x4f78('0x4a')]=qs[_0x4f78('0x40')](_[_0x4f78('0x4b')](_0x1b5ee3[_0x4f78('0x3e')],_0x33d70c['filters']),_0x48da54);if(_0x1b5ee3[_0x4f78('0x3e')][_0x4f78('0x4c')]){_0x3db7b3[_0x4f78('0x4a')]=_['merge'](_0x3db7b3['where'],{'$or':_[_0x4f78('0x3d')](_0x48da54,function(_0x1acf86){if(_0x1acf86[_0x4f78('0x3a')]!=='VIRTUAL'){var _0x5e44cc={};_0x5e44cc[_0x1acf86['name']]={'$like':'%'+_0x1b5ee3[_0x4f78('0x3e')][_0x4f78('0x4c')]+'%'};return _0x5e44cc;}})});}_0x3db7b3=_[_0x4f78('0x4d')]({},_0x3db7b3,_0x1b5ee3['options']);var _0x4e2448={'where':_0x3db7b3[_0x4f78('0x4a')]};return db[_0x4f78('0x37')][_0x4f78('0x2c')](_0x4e2448)[_0x4f78('0x1e')](function(_0x348e83){_0x3dc8b3[_0x4f78('0x2c')]=_0x348e83;if(_0x1b5ee3[_0x4f78('0x3e')][_0x4f78('0x4e')]){_0x3db7b3[_0x4f78('0x4f')]=[{'all':!![]}];}return db[_0x4f78('0x37')]['findAll'](_0x3db7b3);})['then'](function(_0x111b66){_0x3dc8b3[_0x4f78('0x50')]=_0x111b66;return _0x3dc8b3;})[_0x4f78('0x1e')](respondWithFilteredResult(_0x19946e,_0x3db7b3))['catch'](handleError(_0x19946e,null));};exports[_0x4f78('0x51')]=function(_0xc3cddc,_0x2aadd9){var _0x5c74f4={'raw':!![],'where':{'id':_0xc3cddc[_0x4f78('0x52')]['id']}},_0x4c01e6={};_0x4c01e6[_0x4f78('0x3c')]=_[_0x4f78('0x3f')](db[_0x4f78('0x37')]['rawAttributes']);_0x4c01e6['query']=_[_0x4f78('0x3f')](_0xc3cddc[_0x4f78('0x3e')]);_0x4c01e6['filters']=_[_0x4f78('0x42')](_0x4c01e6[_0x4f78('0x3c')],_0x4c01e6['query']);_0x5c74f4[_0x4f78('0x41')]=_[_0x4f78('0x42')](_0x4c01e6[_0x4f78('0x3c')],qs[_0x4f78('0x43')](_0xc3cddc['query'][_0x4f78('0x43')]));_0x5c74f4[_0x4f78('0x41')]=_0x5c74f4[_0x4f78('0x41')][_0x4f78('0x44')]?_0x5c74f4[_0x4f78('0x41')]:_0x4c01e6[_0x4f78('0x3c')];if(_0xc3cddc[_0x4f78('0x3e')][_0x4f78('0x4e')]){_0x5c74f4['include']=[{'all':!![]}];}_0x5c74f4=_[_0x4f78('0x4d')]({},_0x5c74f4,_0xc3cddc['options']);return db[_0x4f78('0x37')][_0x4f78('0x53')](_0x5c74f4)[_0x4f78('0x1e')](handleEntityNotFound(_0x2aadd9,null))['then'](respondWithResult(_0x2aadd9,null))[_0x4f78('0x28')](handleError(_0x2aadd9,null));};exports[_0x4f78('0x33')]=function(_0x462c83,_0x52b70b){if(_0x462c83[_0x4f78('0x54')]['id']){delete _0x462c83[_0x4f78('0x54')]['id'];}return db[_0x4f78('0x37')][_0x4f78('0x53')]({'where':{'id':_0x462c83[_0x4f78('0x52')]['id']}})[_0x4f78('0x1e')](handleEntityNotFound(_0x52b70b,null))['then'](saveUpdates(_0x462c83[_0x4f78('0x54')],null))[_0x4f78('0x1e')](respondWithResult(_0x52b70b,null))[_0x4f78('0x28')](handleError(_0x52b70b,null));};exports[_0x4f78('0x34')]=function(_0x4ad4e3,_0x774170){return db[_0x4f78('0x37')][_0x4f78('0x53')]({'where':{'id':_0x4ad4e3[_0x4f78('0x52')]['id']}})[_0x4f78('0x1e')](handleEntityNotFound(_0x774170,null))[_0x4f78('0x1e')](removeEntity(_0x774170,null))[_0x4f78('0x28')](handleError(_0x774170,null));};exports[_0x4f78('0x55')]=function(_0x292ada,_0x592329){return db[_0x4f78('0x37')]['describe']()[_0x4f78('0x1e')](respondWithResult(_0x592329,null))['catch'](handleError(_0x592329,null));};var interaction_log=require(_0x4f78('0x56'))(_0x4f78('0x57'));exports[_0x4f78('0x58')]=function(_0x224692,_0x4d6f91,_0x2ef2f3){var _0x37d0b4={'agent':{},'channel':_0x4f78('0x59')};if(_0x224692[_0x4f78('0x54')]['id']){delete _0x224692['body']['id'];}_0x224692[_0x4f78('0x54')][_0x4f78('0x5a')]=!![];_0x224692[_0x4f78('0x54')][_0x4f78('0x5b')]=moment()[_0x4f78('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x224692[_0x4f78('0x54')][_0x4f78('0x5d')]=_0x224692['body'][_0x4f78('0x5d')]||_0x224692[_0x4f78('0x5e')]['id'];_0x37d0b4[_0x4f78('0x5f')]['id']=_0x224692[_0x4f78('0x54')][_0x4f78('0x5d')];return db[_0x4f78('0x37')][_0x4f78('0x53')]({'where':{'id':_0x224692[_0x4f78('0x52')]['id'],'UserId':null}})[_0x4f78('0x1e')](handleEntityNotFound(_0x4d6f91,null))['then'](saveUpdates(_0x224692['body'],null))[_0x4f78('0x1e')](function(_0x217b00){if(_0x217b00){_0x37d0b4['message']=_0x217b00[_0x4f78('0x60')]({'plain':!![]});return db[_0x4f78('0x61')][_0x4f78('0x53')]({'where':{'id':_0x217b00[_0x4f78('0x62')]}});}return null;})[_0x4f78('0x1e')](handleEntityNotFound(_0x4d6f91,null))[_0x4f78('0x1e')](function(_0x31aee8){if(_0x31aee8){return _0x31aee8[_0x4f78('0x33')]({'UserId':_0x224692['body'][_0x4f78('0x5d')],'read1stAt':_[_0x4f78('0x63')](_0x31aee8[_0x4f78('0x64')])?moment()[_0x4f78('0x5c')](_0x4f78('0x65')):undefined});}return null;})[_0x4f78('0x1e')](function(_0x230e83){if(_0x230e83){_0x37d0b4['interaction']=_0x230e83[_0x4f78('0x60')]({'plain':!![]});interaction_log[_0x4f78('0x1f')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x224692['user']['id'],_0x224692[_0x4f78('0x5e')]['name'],_0x224692[_0x4f78('0x5e')][_0x4f78('0x66')],_0x37d0b4['interaction']['id'],_0x224692[_0x4f78('0x54')]?JSON[_0x4f78('0x23')](_0x224692[_0x4f78('0x54')]):_0x4f78('0x67'));return respondWithRpcPromise(_0x4f78('0x68'),'acceptMessage',_0x37d0b4);}return null;})[_0x4f78('0x1e')](function(_0x4b7716){var _0x36ce57='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b7716['message'][_0x4f78('0x69')];return db[_0x4f78('0x6a')]['query'](_0x36ce57,{'type':db[_0x4f78('0x6b')][_0x4f78('0x6c')][_0x4f78('0x6d')],'raw':!![]})[_0x4f78('0x1e')](function(_0x300269){return _0x300269;});})[_0x4f78('0x1e')](function(_0x494342){if(_0x494342){_0x37d0b4['message']['contact']=_0x494342[0x0];if(!_0x224692[_0x4f78('0x54')][_0x4f78('0x5d')])return;return db[_0x4f78('0x6e')]['find']({'where':{'id':_0x224692[_0x4f78('0x54')][_0x4f78('0x5d')],'role':_0x4f78('0x5f')},'attributes':['id',_0x4f78('0x6f'),_0x4f78('0x70'),_0x4f78('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x566fd1){if(!_0x566fd1)return null;_0x37d0b4[_0x4f78('0x26')][_0x4f78('0x5f')]=_0x566fd1;return _0x37d0b4;})[_0x4f78('0x1e')](function(_0x5b5009){if(_0x5b5009){if(_0x224692['body'][_0x4f78('0x72')]){_0x37d0b4[_0x4f78('0x26')]['interface']=util[_0x4f78('0x5c')](_0x4f78('0x73'),_0x224692[_0x4f78('0x5e')][_0x4f78('0x6f')]);_0x37d0b4[_0x4f78('0x26')][_0x4f78('0x74')]=_0x37d0b4[_0x4f78('0x74')];_0x37d0b4[_0x4f78('0x26')][_0x4f78('0x75')]=_0x37d0b4[_0x4f78('0x74')];_0x37d0b4[_0x4f78('0x26')][_0x4f78('0x76')]='accept';return respondWithRpcPromise(_0x4f78('0x77'),'EventManager',{'event':'acceptmessage','message':_0x37d0b4['message']},client9002)['then'](function(){return _0x37d0b4;});}return _0x37d0b4;}return null;})['then'](respondWithResult(_0x4d6f91,null))['catch'](handleError(_0x4d6f91,null));};var interaction_log=require(_0x4f78('0x56'))(_0x4f78('0x57'));exports[_0x4f78('0x78')]=function(_0x1a24ef,_0x100b25,_0x2202ad){var _0x3ef4f8={'agent':{},'channel':'fax'};if(_0x1a24ef[_0x4f78('0x54')]['id']){delete _0x1a24ef[_0x4f78('0x54')]['id'];}_0x1a24ef[_0x4f78('0x54')]['UserId']=_0x1a24ef[_0x4f78('0x54')][_0x4f78('0x5d')]||_0x1a24ef[_0x4f78('0x5e')]['id'];_0x3ef4f8[_0x4f78('0x5f')]['id']=_0x1a24ef[_0x4f78('0x54')][_0x4f78('0x5d')];return db['FaxMessage'][_0x4f78('0x53')]({'where':{'id':_0x1a24ef['params']['id'],'UserId':null}})[_0x4f78('0x1e')](handleEntityNotFound(_0x100b25,null))['then'](function(_0x296220){if(_0x296220){_0x3ef4f8['message']=_0x296220[_0x4f78('0x60')]({'plain':!![]});return db[_0x4f78('0x61')]['find']({'where':{'id':_0x296220['FaxInteractionId']}});}return null;})[_0x4f78('0x1e')](handleEntityNotFound(_0x100b25,null))[_0x4f78('0x1e')](function(_0x4b10b1){if(_0x4b10b1){_0x3ef4f8[_0x4f78('0x79')]=_0x4b10b1[_0x4f78('0x60')]({'plain':!![]});interaction_log[_0x4f78('0x1f')](_0x4f78('0x7a'),_0x1a24ef[_0x4f78('0x5e')]['id'],_0x1a24ef['user']['name'],_0x1a24ef[_0x4f78('0x5e')][_0x4f78('0x66')],_0x3ef4f8[_0x4f78('0x79')]['id'],_0x1a24ef[_0x4f78('0x54')]?JSON['stringify'](_0x1a24ef[_0x4f78('0x54')]):'null');return respondWithRpcPromise('RejectMessage',_0x4f78('0x7b'),_0x3ef4f8);}return null;})[_0x4f78('0x1e')](function(_0xef5c40){var _0x1d096e=_0x4f78('0x7c')+_0xef5c40[_0x4f78('0x26')]['ContactId'];return db[_0x4f78('0x6a')][_0x4f78('0x3e')](_0x1d096e,{'type':db[_0x4f78('0x6b')]['QueryTypes'][_0x4f78('0x6d')],'raw':!![]})[_0x4f78('0x1e')](function(_0x12bcce){return _0x12bcce;});})[_0x4f78('0x1e')](function(_0xb0a480){if(_0xb0a480){_0x3ef4f8['message']['contact']=_0xb0a480[0x0];if(!_0x1a24ef['body']['UserId'])return;return db[_0x4f78('0x6e')][_0x4f78('0x53')]({'where':{'id':_0x1a24ef['body'][_0x4f78('0x5d')],'role':_0x4f78('0x5f')},'attributes':['id',_0x4f78('0x6f'),'fullname','email',_0x4f78('0x7d')],'raw':!![]});}return null;})[_0x4f78('0x1e')](function(_0x95d69c){if(!_0x95d69c)return null;_0x3ef4f8[_0x4f78('0x26')][_0x4f78('0x5f')]=_0x95d69c;return _0x3ef4f8;})[_0x4f78('0x1e')](function(_0x5c6653){if(_0x5c6653){_0x5c6653[_0x4f78('0x26')][_0x4f78('0x7e')]=util[_0x4f78('0x5c')](_0x4f78('0x73'),_0x1a24ef[_0x4f78('0x5e')][_0x4f78('0x6f')]);_0x5c6653[_0x4f78('0x26')][_0x4f78('0x74')]=_0x3ef4f8[_0x4f78('0x74')];_0x5c6653[_0x4f78('0x26')][_0x4f78('0x75')]=_0x3ef4f8[_0x4f78('0x74')];_0x5c6653[_0x4f78('0x26')][_0x4f78('0x76')]=_0x4f78('0x78');respondWithRpcPromise('EventManager',_0x4f78('0x77'),{'event':'rejectmessage','message':_0x5c6653['message']},client9002);return _0x3ef4f8;}return null;})[_0x4f78('0x1e')](respondWithResult(_0x100b25,null))[_0x4f78('0x28')](handleError(_0x100b25,null));};exports[_0x4f78('0x7f')]=function(_0x502c2c,_0x880e62){var _0x40c0e4;return db[_0x4f78('0x37')][_0x4f78('0x7f')](_0x502c2c[_0x4f78('0x54')],{})[_0x4f78('0x1e')](function(_0x3b1699){_0x40c0e4=_0x3b1699;return db[_0x4f78('0x80')]['findOne']({'where':{'id':_0x40c0e4['ContactId']}});})[_0x4f78('0x1e')](function(_0x49d78f){if(_[_0x4f78('0x63')](_0x49d78f)){return;}else{_0x40c0e4[_0x4f78('0x59')]=_0x49d78f[_0x4f78('0x59')];return db['Attachment']['findOne']({'where':{'id':_0x40c0e4['AttachmentId']}});}})['then'](function(_0xef1d4a){return respondWithRpcPromise(_0x4f78('0x81'),_0x4f78('0x81'),{'FaxAccountId':_[_0x4f78('0x63')](_0x502c2c[_0x4f78('0x54')])?undefined:_0x502c2c[_0x4f78('0x54')]['FaxAccountId'],'path':_[_0x4f78('0x63')](_0xef1d4a)?undefined:util['format'](_0x4f78('0x82'),_0xef1d4a[_0x4f78('0x83')]),'fax':_[_0x4f78('0x63')](_0x40c0e4[_0x4f78('0x59')])?undefined:_0x40c0e4[_0x4f78('0x59')],'AttachmentId':_0x40c0e4[_0x4f78('0x84')]},client9002);})['then'](respondWithResult(_0x880e62,0xc9))['catch'](handleError(_0x880e62,null));};exports[_0x4f78('0x85')]=function(_0x4e68c9,_0x42b984){var _0x1878a7=path[_0x4f78('0x86')](config[_0x4f78('0x87')],_0x4f78('0x88'),'files','attachments');return db[_0x4f78('0x37')][_0x4f78('0x53')]({'where':{'id':_0x4e68c9[_0x4f78('0x52')]['id']},'include':[{'model':db[_0x4f78('0x89')],'as':'Attachment'}]})[_0x4f78('0x1e')](handleEntityNotFound(_0x42b984,null))[_0x4f78('0x1e')](function(_0x50be89){if(_0x50be89){return _0x42b984[_0x4f78('0x85')](path[_0x4f78('0x86')](_0x1878a7,_0x50be89[_0x4f78('0x89')][_0x4f78('0x83')]));}})[_0x4f78('0x28')](handleError(_0x42b984,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e35beb9..14888c4 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 _0x110e=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x110e,0x68));var _0xe110=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x110e[_0x599f41];return _0x2e4d58;};'use strict';var EventEmitter=require(_0xe110('0x0'));var FaxMessage=require(_0xe110('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe110('0x2')](0x0);var events={'afterCreate':_0xe110('0x3'),'afterUpdate':_0xe110('0x4'),'afterDestroy':_0xe110('0x5')};function emitEvent(_0x3f8825){return function(_0x4d182f,_0x563977,_0x5032de){FaxMessageEvents['emit'](_0x3f8825+':'+_0x4d182f['id'],_0x4d182f);FaxMessageEvents[_0xe110('0x6')](_0x3f8825,_0x4d182f);_0x5032de(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xe110('0x7')](e,emitEvent(event));}}module[_0xe110('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xdbb1=['exports','events','save','hasOwnProperty','hook'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xdbb1,0x105));var _0x1dbb=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xdbb1[_0x543084];return _0x306a57;};'use strict';var EventEmitter=require(_0x1dbb('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1dbb('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x395788){return function(_0x483e15,_0xa1e321,_0xd53e45){FaxMessageEvents['emit'](_0x395788+':'+_0x483e15['id'],_0x483e15);FaxMessageEvents['emit'](_0x395788,_0x483e15);_0xd53e45(null);};}for(var e in events){if(events[_0x1dbb('0x2')](e)){var event=events[e];FaxMessage[_0x1dbb('0x3')](e,emitEvent(event));}}module[_0x1dbb('0x4')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d22231d..3336627 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 _0x36f4=['exports','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','FaxInteraction','FaxInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxMessage.attributes'];(function(_0x123902,_0x4912bf){var _0x1464f1=function(_0x4d95db){while(--_0x4d95db){_0x123902['push'](_0x123902['shift']());}};_0x1464f1(++_0x4912bf);}(_0x36f4,0x163));var _0x436f=function(_0x16d416,_0x2791dc){_0x16d416=_0x16d416-0x0;var _0x1c592c=_0x36f4[_0x16d416];return _0x1c592c;};'use strict';var _=require(_0x436f('0x0'));var util=require(_0x436f('0x1'));var logger=require(_0x436f('0x2'))(_0x436f('0x3'));var moment=require(_0x436f('0x4'));var BPromise=require('bluebird');var rp=require(_0x436f('0x5'));var fs=require('fs');var path=require(_0x436f('0x6'));var rimraf=require('rimraf');var config=require(_0x436f('0x7'));var attributes=require(_0x436f('0x8'));module[_0x436f('0x9')]=function(_0x280e2b,_0x12a45b){return _0x280e2b['define'](_0x436f('0xa'),attributes,{'tableName':_0x436f('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x436f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x206452,_0x4b269,_0x3064f5){var _0x104db7=_0x280e2b[_0x436f('0xd')];var _0x226d73=_0x206452[_0x436f('0xe')]({'plain':!![]});if(_0x226d73['direction']['toLowerCase']()==='in'||_0x226d73[_0x436f('0xf')][_0x436f('0x10')]()==='out'&&!_0x226d73['secret']&&!_[_0x436f('0x11')](_0x226d73[_0x436f('0x12')])){_0x104db7[_0x436f('0x13')]['findOne']({'where':{'id':_0x226d73[_0x436f('0x14')]}})['then'](function(_0x4c36ee){if(_0x4c36ee){_0x4c36ee[_0x436f('0x15')]({'lastMsgAt':_0x226d73[_0x436f('0x16')],'lastMsgDirection':_0x226d73[_0x436f('0xf')][_0x436f('0x10')]()});}})[_0x436f('0x17')](function(_0xd59c0){console[_0x436f('0x18')](_0xd59c0);});}_0x3064f5();}},'charset':_0x436f('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3870=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2aa4a8,_0xa97ccb){var _0x59261c=function(_0x26f279){while(--_0x26f279){_0x2aa4a8['push'](_0x2aa4a8['shift']());}};_0x59261c(++_0xa97ccb);}(_0x3870,0x97));var _0x0387=function(_0x33c75c,_0x44747c){_0x33c75c=_0x33c75c-0x0;var _0x2c0c4c=_0x3870[_0x33c75c];return _0x2c0c4c;};'use strict';var _=require(_0x0387('0x0'));var util=require('util');var logger=require(_0x0387('0x1'))(_0x0387('0x2'));var moment=require(_0x0387('0x3'));var BPromise=require(_0x0387('0x4'));var rp=require(_0x0387('0x5'));var fs=require('fs');var path=require(_0x0387('0x6'));var rimraf=require(_0x0387('0x7'));var config=require(_0x0387('0x8'));var attributes=require(_0x0387('0x9'));module[_0x0387('0xa')]=function(_0x3fe330,_0x3db3f0){return _0x3fe330[_0x0387('0xb')](_0x0387('0xc'),attributes,{'tableName':_0x0387('0xd'),'paranoid':![],'indexes':[{'name':_0x0387('0xe'),'fields':[_0x0387('0xf')],'type':_0x0387('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16f58c,_0x4618dd,_0x5a16ec){var _0x5499c3=_0x3fe330[_0x0387('0x11')];var _0x46b525=_0x16f58c[_0x0387('0x12')]({'plain':!![]});if(_0x46b525[_0x0387('0x13')][_0x0387('0x14')]()==='in'||_0x46b525[_0x0387('0x13')][_0x0387('0x14')]()===_0x0387('0x15')&&!_0x46b525[_0x0387('0x16')]&&!_[_0x0387('0x17')](_0x46b525[_0x0387('0x18')])){_0x5499c3['FaxInteraction'][_0x0387('0x19')]({'where':{'id':_0x46b525[_0x0387('0x1a')]}})[_0x0387('0x1b')](function(_0x135ee8){if(_0x135ee8){_0x135ee8['update']({'lastMsgAt':_0x46b525[_0x0387('0x1c')],'lastMsgDirection':_0x46b525[_0x0387('0x13')][_0x0387('0x14')]()});}})['catch'](function(_0x780601){console[_0x0387('0x1d')](_0x780601);});}_0x5a16ec();}},'charset':_0x0387('0x1e'),'collate':_0x0387('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 7ab5d08..357ab84 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 _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(_0x566f61,_0x443ab7){var _0x25863c=function(_0x5a2e57){while(--_0x5a2e57){_0x566f61['push'](_0x566f61['shift']());}};_0x25863c(++_0x443ab7);}(_0x84ab,0x12f));var _0xb84a=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x84ab[_0x4d67b8];return _0x55af3b;};'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 +var _0x207c=['result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x241afd,_0x1ab49f){var _0x8d8aa2=function(_0x4a772d){while(--_0x4a772d){_0x241afd['push'](_0x241afd['shift']());}};_0x8d8aa2(++_0x1ab49f);}(_0x207c,0x1e8));var _0xc207=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x207c[_0xd2d54];return _0x78b113;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});config[_0xc207('0x9')]=_[_0xc207('0xa')](config['redis'],{'host':_0xc207('0xb'),'port':0x18eb});var socket=require(_0xc207('0xc'))(new Redis(config[_0xc207('0x9')]));require('./faxMessage.socket')[_0xc207('0xd')](socket);function respondWithRpcPromise(_0x817576,_0x216e14,_0x13ec41){return new BPromise(function(_0x201162,_0x347549){return client['request'](_0x817576,_0x13ec41)['then'](function(_0x5b556f){logger[_0xc207('0xe')]('FaxMessage,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'));logger[_0xc207('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'),JSON[_0xc207('0x11')](_0x5b556f));if(_0x5b556f[_0xc207('0x12')]){if(_0x5b556f[_0xc207('0x12')][_0xc207('0x13')]===0x1f4){logger['error'](_0xc207('0x14'),_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x347549(_0x5b556f[_0xc207('0x12')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x201162(_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);}else{logger['info'](_0xc207('0x14'),_0x216e14,_0xc207('0xf'));_0x201162(_0x5b556f[_0xc207('0x16')]['message']);}})[_0xc207('0x17')](function(_0x488cc0){logger[_0xc207('0x12')](_0xc207('0x14'),_0x216e14,_0x488cc0);_0x347549(_0x488cc0);});});}exports[_0xc207('0x18')]=function(_0x461f6a){var _0xce0770=this;return new Promise(function(_0x2caec5,_0x35c0b0){return db[_0xc207('0x19')][_0xc207('0x1a')](_0x461f6a[_0xc207('0x1b')],{'raw':_0x461f6a[_0xc207('0x1c')]?_0x461f6a[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x163b36){logger['info'](_0xc207('0x18'),_0x461f6a);logger[_0xc207('0x10')](_0xc207('0x18'),_0x461f6a,JSON[_0xc207('0x11')](_0x163b36));_0x2caec5(_0x163b36);})[_0xc207('0x17')](function(_0xd209ac){logger[_0xc207('0x12')](_0xc207('0x18'),_0xd209ac[_0xc207('0x15')],_0x461f6a);_0x35c0b0(_0xce0770[_0xc207('0x12')](0x1f4,_0xd209ac[_0xc207('0x15')]));});});};exports[_0xc207('0x1e')]=function(_0x3f738e){var _0x138970=this;return new Promise(function(_0x1445d3,_0x56a066){return db[_0xc207('0x19')]['update'](_0x3f738e['body'],{'raw':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')]['where']||null:null,'attributes':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1f')]||null:null,'limit':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x20')]||null:null})[_0xc207('0x21')](function(_0x27bc72){logger[_0xc207('0xe')](_0xc207('0x1e'),_0x3f738e);logger[_0xc207('0x10')](_0xc207('0x1e'),_0x3f738e,JSON[_0xc207('0x11')](_0x27bc72));_0x1445d3(_0x27bc72);})['catch'](function(_0x1cc799){logger[_0xc207('0x12')](_0xc207('0x1e'),_0x1cc799[_0xc207('0x15')],_0x3f738e);_0x56a066(_0x138970[_0xc207('0x12')](0x1f4,_0x1cc799[_0xc207('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4fd0b6f..665c321 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 _0xa2b0=['register','length','faxMessage:','save','remove','update','emit'];(function(_0x4a5516,_0x4cf973){var _0x161148=function(_0xe05e8a){while(--_0xe05e8a){_0x4a5516['push'](_0x4a5516['shift']());}};_0x161148(++_0x4cf973);}(_0xa2b0,0xc0));var _0x0a2b=function(_0x2bd9f4,_0x43e4a6){_0x2bd9f4=_0x2bd9f4-0x0;var _0x25cabc=_0xa2b0[_0x2bd9f4];return _0x25cabc;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x0a2b('0x0'),_0x0a2b('0x1'),_0x0a2b('0x2')];function createListener(_0x1aecaf,_0x36d0c2){return function(_0x37bf3f){_0x36d0c2[_0x0a2b('0x3')](_0x1aecaf,_0x37bf3f);};}function removeListener(_0x39be0d,_0x3d69e5){return function(){FaxMessageEvents['removeListener'](_0x39be0d,_0x3d69e5);};}exports[_0x0a2b('0x4')]=function(_0x415007){for(var _0x2cdff0=0x0,_0x3d95c3=events[_0x0a2b('0x5')];_0x2cdff0<_0x3d95c3;_0x2cdff0++){var _0x692554=events[_0x2cdff0];var _0x37a4d9=createListener(_0x0a2b('0x6')+_0x692554,_0x415007);FaxMessageEvents['on'](_0x692554,_0x37a4d9);}}; \ No newline at end of file +var _0xa4d3=['remove','update','removeListener','register','length','./faxMessage.events','save'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa4d3,0x16a));var _0x3a4d=function(_0x4f68c7,_0x691333){_0x4f68c7=_0x4f68c7-0x0;var _0x38624c=_0xa4d3[_0x4f68c7];return _0x38624c;};'use strict';var FaxMessageEvents=require(_0x3a4d('0x0'));var events=[_0x3a4d('0x1'),_0x3a4d('0x2'),_0x3a4d('0x3')];function createListener(_0x3308e7,_0x2c8bae){return function(_0xf5a84d){_0x2c8bae['emit'](_0x3308e7,_0xf5a84d);};}function removeListener(_0x4c83fa,_0x1e1d28){return function(){FaxMessageEvents[_0x3a4d('0x4')](_0x4c83fa,_0x1e1d28);};}exports[_0x3a4d('0x5')]=function(_0x3b3a9b){for(var _0x27c190=0x0,_0x39f431=events[_0x3a4d('0x6')];_0x27c190<_0x39f431;_0x27c190++){var _0x1cba32=events[_0x27c190];var _0x1f28cf=createListener('faxMessage:'+_0x1cba32,_0x3b3a9b);FaxMessageEvents['on'](_0x1cba32,_0x1f28cf);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3df053d..1e03e13 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 _0xc6d8=['describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','path','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x2cce65,_0x432a8b){var _0x413539=function(_0x1b0cf2){while(--_0x1b0cf2){_0x2cce65['push'](_0x2cce65['shift']());}};_0x413539(++_0x432a8b);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x5383f1,_0x327fb3){_0x5383f1=_0x5383f1-0x0;var _0xa23930=_0xc6d8[_0x5383f1];return _0xa23930;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),auth['isAuthenticated'](),controller[_0x8c6d('0xa')]);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth['isAuthenticated'](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0x6')](_0x8c6d('0xd'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')]('/',auth[_0x8c6d('0x7')](),interaction[_0x8c6d('0x10')]('fax',_0x8c6d('0x11')),controller['create']);router['put'](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x12')]);router[_0x8c6d('0x13')](_0x8c6d('0x14'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x15')]);router[_0x8c6d('0x13')](_0x8c6d('0x16'),auth[_0x8c6d('0x7')](),controller['reject']);router[_0x8c6d('0x17')]('/:id',auth[_0x8c6d('0x7')](),controller['destroy']);module[_0x8c6d('0x18')]=router; \ No newline at end of file +var _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0bd7f2b..3d42c15 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 _0xd9ce=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x1adccf,_0x266fca){var _0x2ffe3b=function(_0x5c3b29){while(--_0x5c3b29){_0x1adccf['push'](_0x1adccf['shift']());}};_0x2ffe3b(++_0x266fca);}(_0xd9ce,0xeb));var _0xed9c=function(_0x1aaf79,_0x298f15){_0x1aaf79=_0x1aaf79-0x0;var _0x12e371=_0xd9ce[_0x1aaf79];return _0x12e371;};'use strict';var Sequelize=require(_0xed9c('0x0'));module[_0xed9c('0x1')]={'name':{'type':Sequelize[_0xed9c('0x2')],'unique':_0xed9c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed9c('0x2')]},'timeout':{'type':Sequelize[_0xed9c('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed9c('0x5')](_0xed9c('0x6'),'beepall',_0xed9c('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xed9c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1642=['rrmemory','roundrobin','INTEGER','STRING','name'];(function(_0x303be2,_0x2e740e){var _0x231ac0=function(_0x15ab8a){while(--_0x15ab8a){_0x303be2['push'](_0x303be2['shift']());}};_0x231ac0(++_0x2e740e);}(_0x1642,0x1e8));var _0x2164=function(_0x318780,_0x3b4b87){_0x318780=_0x318780-0x0;var _0x2ac964=_0x1642[_0x318780];return _0x2ac964;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2164('0x0')],'unique':_0x2164('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2164('0x2'),'beepall',_0x2164('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2164('0x4')],'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 bf627d4..a049916 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 _0x93de=['updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','findOne','Team','addTeams','findAll','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','getAgents','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','body','describe','UserFaxQueue','FaxQueueId','User','UserId'];(function(_0x178f72,_0x18da4f){var _0x267367=function(_0x532b2f){while(--_0x532b2f){_0x178f72['push'](_0x178f72['shift']());}};_0x267367(++_0x18da4f);}(_0x93de,0xc0));var _0xe93d=function(_0x27e443,_0x1bcf60){_0x27e443=_0x27e443-0x0;var _0x3305fc=_0x93de[_0x27e443];return _0x3305fc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe93d('0x0'));var jsonpatch=require(_0xe93d('0x1'));var rp=require(_0xe93d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe93d('0x3'));var util=require(_0xe93d('0x4'));var path=require(_0xe93d('0x5'));var sox=require(_0xe93d('0x6'));var csv=require(_0xe93d('0x7'));var ejs=require(_0xe93d('0x8'));var fs=require('fs');var fs_extra=require(_0xe93d('0x9'));var _=require(_0xe93d('0xa'));var squel=require(_0xe93d('0xb'));var crypto=require(_0xe93d('0xc'));var jsforce=require(_0xe93d('0xd'));var deskjs=require(_0xe93d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe93d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe93d('0x10'));var as=require(_0xe93d('0x11'));var hardwareService=require(_0xe93d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe93d('0x13'));var config=require(_0xe93d('0x14'));var licenseUtil=require(_0xe93d('0x15'));var db=require(_0xe93d('0x16'))['db'];config[_0xe93d('0x17')]=_[_0xe93d('0x18')](config[_0xe93d('0x17')],{'host':_0xe93d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe93d('0x17')]));require(_0xe93d('0x1a'))[_0xe93d('0x1b')](socket);function respondWithStatusCode(_0x4f82d4,_0xf79da7){_0xf79da7=_0xf79da7||0xcc;return function(_0x2081fc){if(_0x2081fc){return _0x4f82d4['sendStatus'](_0xf79da7);}return _0x4f82d4[_0xe93d('0x1c')](_0xf79da7)['end']();};}function respondWithResult(_0x16719b,_0x3cb2d7){_0x3cb2d7=_0x3cb2d7||0xc8;return function(_0x20e896){if(_0x20e896){return _0x16719b[_0xe93d('0x1c')](_0x3cb2d7)[_0xe93d('0x1d')](_0x20e896);}};}function respondWithFilteredResult(_0x174411,_0x14aa5e){return function(_0x478902){if(_0x478902){var _0x4d6989=typeof _0x14aa5e[_0xe93d('0x1e')]==='undefined'&&typeof _0x14aa5e['limit']===_0xe93d('0x1f');var _0x114b0b=_0x478902[_0xe93d('0x20')];var _0x1c749f=_0x4d6989?0x0:_0x14aa5e[_0xe93d('0x1e')];var _0x669cc2=_0x4d6989?_0x478902['count']:_0x14aa5e[_0xe93d('0x1e')]+_0x14aa5e[_0xe93d('0x21')];var _0x23384d;if(_0x669cc2>=_0x114b0b){_0x669cc2=_0x114b0b;_0x23384d=0xc8;}else{_0x23384d=0xce;}_0x174411['status'](_0x23384d);return _0x174411['set'](_0xe93d('0x22'),_0x1c749f+'-'+_0x669cc2+'/'+_0x114b0b)['json'](_0x478902);}return null;};}function patchUpdates(_0xb88f85){return function(_0x435f40){try{jsonpatch['apply'](_0x435f40,_0xb88f85,!![]);}catch(_0x367c79){return BPromise[_0xe93d('0x23')](_0x367c79);}return _0x435f40[_0xe93d('0x24')]();};}function saveUpdates(_0x3517ee,_0x3dd728){return function(_0x5d048f){if(_0x5d048f){return _0x5d048f[_0xe93d('0x25')](_0x3517ee)[_0xe93d('0x26')](function(_0xb5885){return _0xb5885;});}return null;};}function removeEntity(_0x49bae5,_0x987d5){return function(_0x47d776){if(_0x47d776){return _0x47d776[_0xe93d('0x27')]()[_0xe93d('0x26')](function(){var _0x14e4c9=_0x47d776[_0xe93d('0x28')]({'plain':!![]});var _0x2b45c8='FaxQueues';return db[_0xe93d('0x29')]['destroy']({'where':{'type':_0x2b45c8,'resourceId':_0x14e4c9['id']}})['then'](function(){return _0x47d776;});})[_0xe93d('0x26')](function(){_0x49bae5['status'](0xcc)[_0xe93d('0x2a')]();});}};}function handleEntityNotFound(_0x15efa5,_0x4b0e54){return function(_0x5de3dd){if(!_0x5de3dd){_0x15efa5['sendStatus'](0x194);}return _0x5de3dd;};}function handleError(_0xaaf9bd,_0x593bf0){_0x593bf0=_0x593bf0||0x1f4;return function(_0x5d4cf9){logger[_0xe93d('0x2b')](_0x5d4cf9[_0xe93d('0x2c')]);if(_0x5d4cf9[_0xe93d('0x2d')]){delete _0x5d4cf9[_0xe93d('0x2d')];}_0xaaf9bd[_0xe93d('0x1c')](_0x593bf0)[_0xe93d('0x2e')](_0x5d4cf9);};}exports[_0xe93d('0x2f')]=function(_0x5d0000,_0x3ac3b3){var _0x28b59a={},_0x3dd437={},_0x3c0ffa={'count':0x0,'rows':[]};var _0x5fe54c=_[_0xe93d('0x30')](db[_0xe93d('0x31')][_0xe93d('0x32')],function(_0x272fbb){return{'name':_0x272fbb['fieldName'],'type':_0x272fbb[_0xe93d('0x33')][_0xe93d('0x34')]};});_0x3dd437[_0xe93d('0x35')]=_['map'](_0x5fe54c,_0xe93d('0x2d'));_0x3dd437[_0xe93d('0x36')]=_[_0xe93d('0x37')](_0x5d0000[_0xe93d('0x36')]);_0x3dd437[_0xe93d('0x38')]=_[_0xe93d('0x39')](_0x3dd437['model'],_0x3dd437['query']);_0x28b59a['attributes']=_[_0xe93d('0x39')](_0x3dd437['model'],qs[_0xe93d('0x3a')](_0x5d0000[_0xe93d('0x36')][_0xe93d('0x3a')]));_0x28b59a[_0xe93d('0x3b')]=_0x28b59a[_0xe93d('0x3b')][_0xe93d('0x3c')]?_0x28b59a[_0xe93d('0x3b')]:_0x3dd437[_0xe93d('0x35')];if(!_0x5d0000[_0xe93d('0x36')][_0xe93d('0x3d')](_0xe93d('0x3e'))){_0x28b59a[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x5d0000[_0xe93d('0x36')][_0xe93d('0x21')]);_0x28b59a[_0xe93d('0x1e')]=qs[_0xe93d('0x1e')](_0x5d0000[_0xe93d('0x36')][_0xe93d('0x1e')]);}_0x28b59a[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x5d0000[_0xe93d('0x36')]['sort']);_0x28b59a[_0xe93d('0x41')]=qs[_0xe93d('0x38')](_[_0xe93d('0x42')](_0x5d0000[_0xe93d('0x36')],_0x3dd437[_0xe93d('0x38')]),_0x5fe54c);if(_0x5d0000['query'][_0xe93d('0x43')]){_0x28b59a[_0xe93d('0x41')]=_[_0xe93d('0x44')](_0x28b59a[_0xe93d('0x41')],{'$or':_['map'](_0x5fe54c,function(_0x50455c){if(_0x50455c['type']!=='VIRTUAL'){var _0x2f6e89={};_0x2f6e89[_0x50455c[_0xe93d('0x2d')]]={'$like':'%'+_0x5d0000['query'][_0xe93d('0x43')]+'%'};return _0x2f6e89;}})});}_0x28b59a=_['merge']({},_0x28b59a,_0x5d0000['options']);var _0x52e717={'where':_0x28b59a[_0xe93d('0x41')]};return db[_0xe93d('0x31')][_0xe93d('0x20')](_0x52e717)[_0xe93d('0x26')](function(_0x14e5ac){_0x3c0ffa[_0xe93d('0x20')]=_0x14e5ac;if(_0x5d0000[_0xe93d('0x36')][_0xe93d('0x45')]){_0x28b59a[_0xe93d('0x46')]=[{'all':!![]}];}return db[_0xe93d('0x31')]['findAll'](_0x28b59a);})[_0xe93d('0x26')](function(_0xc58133){_0x3c0ffa[_0xe93d('0x47')]=_0xc58133;return _0x3c0ffa;})[_0xe93d('0x26')](respondWithFilteredResult(_0x3ac3b3,_0x28b59a))[_0xe93d('0x48')](handleError(_0x3ac3b3,null));};exports[_0xe93d('0x49')]=function(_0x9fb93c,_0x61bfe2){var _0x37811e={'raw':!![],'where':{'id':_0x9fb93c[_0xe93d('0x4a')]['id']}},_0x261b13={};_0x261b13[_0xe93d('0x35')]=_[_0xe93d('0x37')](db[_0xe93d('0x31')]['rawAttributes']);_0x261b13[_0xe93d('0x36')]=_[_0xe93d('0x37')](_0x9fb93c[_0xe93d('0x36')]);_0x261b13['filters']=_['intersection'](_0x261b13[_0xe93d('0x35')],_0x261b13[_0xe93d('0x36')]);_0x37811e[_0xe93d('0x3b')]=_['intersection'](_0x261b13['model'],qs[_0xe93d('0x3a')](_0x9fb93c[_0xe93d('0x36')][_0xe93d('0x3a')]));_0x37811e[_0xe93d('0x3b')]=_0x37811e[_0xe93d('0x3b')][_0xe93d('0x3c')]?_0x37811e[_0xe93d('0x3b')]:_0x261b13[_0xe93d('0x35')];if(_0x9fb93c[_0xe93d('0x36')]['includeAll']){_0x37811e['include']=[{'all':!![]}];}_0x37811e=_['merge']({},_0x37811e,_0x9fb93c[_0xe93d('0x4b')]);return db['FaxQueue'][_0xe93d('0x4c')](_0x37811e)['then'](handleEntityNotFound(_0x61bfe2,null))[_0xe93d('0x26')](respondWithResult(_0x61bfe2,null))[_0xe93d('0x48')](handleError(_0x61bfe2,null));};exports[_0xe93d('0x4d')]=function(_0x44a3ae,_0x18f65a){return db[_0xe93d('0x31')][_0xe93d('0x4d')](_0x44a3ae['body'],{})[_0xe93d('0x26')](function(_0x4b6371){var _0x52a806=_0x44a3ae[_0xe93d('0x4e')][_0xe93d('0x28')]({'plain':!![]});if(!_0x52a806)throw new Error(_0xe93d('0x4f'));if(_0x52a806[_0xe93d('0x50')]===_0xe93d('0x4e')){var _0x3c0098=_0x4b6371[_0xe93d('0x28')]({'plain':!![]});var _0x22c226=_0xe93d('0x51');return db[_0xe93d('0x52')]['find']({'where':{'name':_0x22c226,'userProfileId':_0x52a806[_0xe93d('0x53')]},'raw':!![]})['then'](function(_0x296e25){if(_0x296e25&&_0x296e25['autoAssociation']===0x0){return db[_0xe93d('0x29')][_0xe93d('0x4d')]({'name':_0x3c0098[_0xe93d('0x2d')],'resourceId':_0x3c0098['id'],'type':_0x296e25['name'],'sectionId':_0x296e25['id']},{})[_0xe93d('0x26')](function(){return _0x4b6371;});}else{return _0x4b6371;}})[_0xe93d('0x48')](function(_0x2b82d9){logger[_0xe93d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b82d9);throw _0x2b82d9;});}return _0x4b6371;})[_0xe93d('0x26')](respondWithResult(_0x18f65a,0xc9))[_0xe93d('0x48')](handleError(_0x18f65a,null));};exports['update']=function(_0x49a66e,_0x44a276){if(_0x49a66e['body']['id']){delete _0x49a66e[_0xe93d('0x54')]['id'];}return db[_0xe93d('0x31')][_0xe93d('0x4c')]({'where':{'id':_0x49a66e[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x44a276,null))[_0xe93d('0x26')](saveUpdates(_0x49a66e[_0xe93d('0x54')],null))['then'](respondWithResult(_0x44a276,null))[_0xe93d('0x48')](handleError(_0x44a276,null));};exports[_0xe93d('0x27')]=function(_0x2ee769,_0x59ea54){return db['FaxQueue'][_0xe93d('0x4c')]({'where':{'id':_0x2ee769['params']['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x59ea54,null))[_0xe93d('0x26')](removeEntity(_0x59ea54,null))[_0xe93d('0x48')](handleError(_0x59ea54,null));};exports[_0xe93d('0x55')]=function(_0x31c24a,_0x65b91a){return db[_0xe93d('0x31')][_0xe93d('0x55')]()[_0xe93d('0x26')](respondWithResult(_0x65b91a,null))[_0xe93d('0x48')](handleError(_0x65b91a,null));};exports['getMembers']=function(_0x12b41f,_0x14c537,_0xdf95a6){var _0xd2ac17={'raw':!![],'where':{}},_0x2dbb36={},_0x49b5e;return db[_0xe93d('0x31')]['findOne']({'where':{'id':_0x12b41f[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x14c537,null))[_0xe93d('0x26')](function(_0x41fcc4){if(_0x41fcc4){_0x49b5e=_0x41fcc4[_0xe93d('0x28')]({'plain':!![]});_0x2dbb36[_0xe93d('0x35')]=_[_0xe93d('0x37')](db[_0xe93d('0x56')][_0xe93d('0x32')]);_0x2dbb36['query']=_[_0xe93d('0x37')](_0x12b41f['query']);_0x2dbb36[_0xe93d('0x38')]=_[_0xe93d('0x39')](_0x2dbb36[_0xe93d('0x35')],_0x2dbb36['query']);_0xd2ac17[_0xe93d('0x3b')]=_[_0xe93d('0x39')](_0x2dbb36[_0xe93d('0x35')],qs[_0xe93d('0x3a')](_0x12b41f[_0xe93d('0x36')][_0xe93d('0x3a')]));_0xd2ac17[_0xe93d('0x3b')]=_0xd2ac17['attributes'][_0xe93d('0x3c')]?_0xd2ac17[_0xe93d('0x3b')]:_0x2dbb36[_0xe93d('0x35')];if(!_0x12b41f[_0xe93d('0x36')][_0xe93d('0x3d')](_0xe93d('0x3e'))){_0xd2ac17[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x12b41f['query']['limit']);_0xd2ac17['offset']=qs[_0xe93d('0x1e')](_0x12b41f['query'][_0xe93d('0x1e')]);}_0xd2ac17[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x12b41f[_0xe93d('0x36')]['sort']);_0xd2ac17[_0xe93d('0x41')]=qs[_0xe93d('0x38')](_['pick'](_0x12b41f[_0xe93d('0x36')],_0x2dbb36[_0xe93d('0x38')]));_0xd2ac17[_0xe93d('0x41')][_0xe93d('0x57')]=_0x41fcc4['id'];if(_0x12b41f[_0xe93d('0x36')][_0xe93d('0x43')]){_0xd2ac17[_0xe93d('0x41')]=_['merge'](_0xd2ac17[_0xe93d('0x41')],{'$or':_[_0xe93d('0x30')](_0xd2ac17['attributes'],function(_0x509331){var _0xc00c1b={};_0xc00c1b[_0x509331]={'$like':'%'+_0x12b41f[_0xe93d('0x36')][_0xe93d('0x43')]+'%'};return _0xc00c1b;})});}_0xd2ac17=_[_0xe93d('0x44')]({},_0xd2ac17,_0x12b41f[_0xe93d('0x4b')]);return db[_0xe93d('0x56')]['findAll'](_0xd2ac17);}})[_0xe93d('0x26')](function(_0x2cbb9c){if(_0x2cbb9c){return db[_0xe93d('0x58')]['findAndCountAll']({'where':{'id':_[_0xe93d('0x30')](_0x2cbb9c,_0xe93d('0x59')),'role':'agent'},'attributes':['id',_0xe93d('0x2d'),'faxPause',_0xe93d('0x5a'),_0xe93d('0x5b')]});}})[_0xe93d('0x26')](function(_0xee216c){if(_0xee216c){return{'count':_0xee216c['count'],'rows':_['map'](_0xee216c[_0xe93d('0x47')],function(_0x20aeff){return{'membername':_0x20aeff['name'],'UserId':_0x20aeff['id'],'queue_name':_0x49b5e[_0xe93d('0x2d')],'FaxQueueId':_0x49b5e['id'],'interface':util[_0xe93d('0x5c')](_0xe93d('0x5d'),_0xe93d('0x5e'),_0x20aeff[_0xe93d('0x2d')]),'penalty':0x0,'paused':_0x20aeff[_0xe93d('0x5f')],'createdAt':_0x20aeff['createdAt'],'updatedAt':_0x20aeff[_0xe93d('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe93d('0x26')](respondWithFilteredResult(_0x14c537,_0xd2ac17))['catch'](handleError(_0x14c537,null));};exports[_0xe93d('0x60')]=function(_0x2c0ef8,_0x2eecea,_0x48c2ff){var _0x3bf6db={};var _0x2a0aef={};var _0x2f4900;var _0x10597f;return db[_0xe93d('0x31')][_0xe93d('0x61')]({'where':{'id':_0x2c0ef8['params']['id']}})['then'](handleEntityNotFound(_0x2eecea,null))[_0xe93d('0x26')](function(_0x372e50){if(_0x372e50){_0x2f4900=_0x372e50;_0x2a0aef[_0xe93d('0x35')]=_[_0xe93d('0x37')](db[_0xe93d('0x62')]['rawAttributes']);_0x2a0aef[_0xe93d('0x36')]=_[_0xe93d('0x37')](_0x2c0ef8['query']);_0x2a0aef['filters']=_[_0xe93d('0x39')](_0x2a0aef[_0xe93d('0x35')],_0x2a0aef[_0xe93d('0x36')]);_0x3bf6db['attributes']=_['intersection'](_0x2a0aef[_0xe93d('0x35')],qs['fields'](_0x2c0ef8['query'][_0xe93d('0x3a')]));_0x3bf6db[_0xe93d('0x3b')]=_0x3bf6db['attributes'][_0xe93d('0x3c')]?_0x3bf6db[_0xe93d('0x3b')]:_0x2a0aef[_0xe93d('0x35')];_0x3bf6db[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x2c0ef8[_0xe93d('0x36')]['sort']);_0x3bf6db['where']=qs[_0xe93d('0x38')](_[_0xe93d('0x42')](_0x2c0ef8[_0xe93d('0x36')],_0x2a0aef[_0xe93d('0x38')]));if(_0x2c0ef8[_0xe93d('0x36')][_0xe93d('0x43')]){_0x3bf6db[_0xe93d('0x41')]=_[_0xe93d('0x44')](_0x3bf6db[_0xe93d('0x41')],{'$or':_['map'](_0x3bf6db[_0xe93d('0x3b')],function(_0x5ba3e2){var _0x2e1634={};_0x2e1634[_0x5ba3e2]={'$like':'%'+_0x2c0ef8[_0xe93d('0x36')]['filter']+'%'};return _0x2e1634;})});}_0x3bf6db=_[_0xe93d('0x44')]({},_0x3bf6db,_0x2c0ef8[_0xe93d('0x4b')]);return _0x2f4900[_0xe93d('0x60')](_0x3bf6db);}})[_0xe93d('0x26')](function(_0xd26deb){if(_0xd26deb){_0x10597f=_0xd26deb['length'];if(!_0x2c0ef8[_0xe93d('0x36')][_0xe93d('0x3d')](_0xe93d('0x3e'))){_0x3bf6db[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x2c0ef8[_0xe93d('0x36')]['limit']);_0x3bf6db['offset']=qs['offset'](_0x2c0ef8[_0xe93d('0x36')][_0xe93d('0x1e')]);}return _0x2f4900[_0xe93d('0x60')](_0x3bf6db);}})[_0xe93d('0x26')](function(_0x321ebe){if(_0x321ebe){return _0x321ebe?{'count':_0x10597f,'rows':_0x321ebe}:null;}})['then'](respondWithResult(_0x2eecea,null))[_0xe93d('0x48')](handleError(_0x2eecea,null));};exports[_0xe93d('0x63')]=function(_0x44fbb5,_0x40ce73,_0x3cf141){var _0x39686a=_0x44fbb5[_0xe93d('0x54')]['ids'];return db['Team'][_0xe93d('0x64')]({'where':{'id':_0x39686a},'attributes':['id'],'include':[{'model':db[_0xe93d('0x58')],'as':_0xe93d('0x65'),'attributes':['id',_0xe93d('0x2d'),_0xe93d('0x66'),_0xe93d('0x67'),_0xe93d('0x68')],'raw':!![]}]})[_0xe93d('0x26')](function(_0x1b4211){if(_0x1b4211){var _0x533974=_[_0xe93d('0x69')](_0x1b4211,function(_0x5317bb){var _0x557190=_0x5317bb[_0xe93d('0x28')]({'plain':!![]});return _0x557190[_0xe93d('0x65')];});return db[_0xe93d('0x31')][_0xe93d('0x4c')]({'where':{'id':_0x44fbb5[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](function(_0xe5f10d){return db['sequelize'][_0xe93d('0x6a')](function(_0x5d203c){return _0xe5f10d[_0xe93d('0x63')](_0x39686a,{'transaction':_0x5d203c})[_0xe93d('0x26')](function(){return BPromise[_0xe93d('0x6b')](_0x533974,function(_0x343a5b){return db['UserFaxQueue'][_0xe93d('0x6c')]({'where':{'UserId':_0x343a5b['id'],'FaxQueueId':_0x44fbb5[_0xe93d('0x4a')]['id']},'transaction':_0x5d203c});});})[_0xe93d('0x26')](function(){_0x533974[_0xe93d('0x6d')](function(_0x9e3c62){socket[_0xe93d('0x6e')]('userFaxQueue:save',{'UserId':_0x9e3c62['id'],'FaxQueueId':_0xe5f10d['id']});});});});});}})[_0xe93d('0x26')](respondWithStatusCode(_0x40ce73,null))[_0xe93d('0x48')](handleError(_0x40ce73,null));};exports[_0xe93d('0x6f')]=function(_0xd8d10b,_0x15961f,_0x3ed70f){return db['Team'][_0xe93d('0x64')]({'where':{'id':_0xd8d10b['query'][_0xe93d('0x70')]},'attributes':['id'],'include':[{'model':db[_0xe93d('0x58')],'as':_0xe93d('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x15961f,null))['then'](function(_0x3e2955){var _0x12f869=_['map'](_0x3e2955,'id');var _0x4d07a7=[];var _0x1b6d8f=[];var _0x2f13f1=squel['select']();_0x2f13f1[_0xe93d('0x71')](_0xe93d('0x72'))[_0xe93d('0x73')](_0xe93d('0x74'),'tq')[_0xe93d('0x75')](_0xe93d('0x76'),'ut',_0xe93d('0x77'))[_0xe93d('0x41')](_0xe93d('0x78'),_0xd8d10b[_0xe93d('0x4a')]['id']);for(var _0x202e97=0x0;_0x202e97<_0x3e2955['length'];_0x202e97+=0x1){let _0x16cd7b=_0x3e2955[_0x202e97];for(var _0x12e90e=0x0;_0x12e90e<_0x16cd7b['Agents'][_0xe93d('0x3c')];_0x12e90e+=0x1){let _0x57fac8=_0x16cd7b[_0xe93d('0x65')][_0x12e90e];var _0x3dc2e4=_0x2f13f1[_0xe93d('0x79')]();_0x3dc2e4[_0xe93d('0x41')](_0xe93d('0x7a'),_0x57fac8['id']);_0x1b6d8f[_0xe93d('0x7b')](db[_0xe93d('0x7c')][_0xe93d('0x36')](_0x3dc2e4[_0xe93d('0x7d')](),{'type':db[_0xe93d('0x7c')][_0xe93d('0x7e')][_0xe93d('0x7f')]})['then'](function(_0x8a7390){if(_0x8a7390[_0xe93d('0x3c')]===0x1){return _0x57fac8['id'];}else{var _0x5406d2=_[_0xe93d('0x80')](_[_0xe93d('0x30')](_0x8a7390,_0xe93d('0x81')),function(_0x352abe){return _[_0xe93d('0x82')](_0x12f869,_0x352abe);});if(_0x5406d2){return _0x57fac8['id'];}}}));}}return BPromise[_0xe93d('0x83')](_0x1b6d8f)[_0xe93d('0x26')](function(_0x4f1196){_0x4d07a7=_(_0x4d07a7)['union'](_0x4f1196)[_0xe93d('0x84')]()[_0xe93d('0x85')]();return db[_0xe93d('0x31')]['find']({'where':{'id':_0xd8d10b[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](function(_0x1f97d4){return db['sequelize']['transaction'](function(_0xc3855e){return _0x1f97d4[_0xe93d('0x6f')](_0xd8d10b['query'][_0xe93d('0x70')],{'transaction':_0xc3855e})[_0xe93d('0x26')](function(){if(!_[_0xe93d('0x86')](_0x4d07a7)){return _0x1f97d4[_0xe93d('0x87')](_0x4d07a7,{'transaction':_0xc3855e});}})['then'](function(){_0x4d07a7[_0xe93d('0x6d')](function(_0x3fe668){socket[_0xe93d('0x6e')](_0xe93d('0x88'),{'UserId':_0x3fe668,'FaxQueueId':_0x1f97d4['id']});});});});});});})[_0xe93d('0x26')](respondWithStatusCode(_0x15961f,null))[_0xe93d('0x48')](handleError(_0x15961f,null));};exports['addAgents']=function(_0x3cff84,_0x1af865,_0xa465a9){return db[_0xe93d('0x31')][_0xe93d('0x4c')]({'where':{'id':_0x3cff84[_0xe93d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1af865,null))['then'](function(_0x59b0c7){if(_0x59b0c7){return _0x59b0c7[_0xe93d('0x89')](_0x3cff84['body'][_0xe93d('0x70')],_[_0xe93d('0x8a')](_0x3cff84['body'],['ids','id'])||{})['spread'](function(_0x35fe0d){for(var _0x4b78d1=0x0;_0x4b78d1<_0x3cff84[_0xe93d('0x54')]['ids'][_0xe93d('0x3c')];_0x4b78d1+=0x1){socket[_0xe93d('0x6e')](_0xe93d('0x8b'),{'UserId':Number(_0x3cff84['body'][_0xe93d('0x70')][_0x4b78d1]),'FaxQueueId':Number(_0x3cff84['params']['id'])});}return _0x35fe0d;});}})[_0xe93d('0x26')](respondWithResult(_0x1af865,null))[_0xe93d('0x48')](handleError(_0x1af865,null));};exports[_0xe93d('0x87')]=function(_0x329116,_0x1d0230,_0x568ae1){return db[_0xe93d('0x31')]['find']({'where':{'id':_0x329116['params']['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x1d0230,null))[_0xe93d('0x26')](function(_0x53de3e){if(_0x53de3e){return _0x53de3e['removeAgents'](_0x329116[_0xe93d('0x36')][_0xe93d('0x70')])['then'](function(){if(_['isArray'](_0x329116[_0xe93d('0x36')][_0xe93d('0x70')])){for(var _0x3fb517=0x0;_0x3fb517<_0x329116['query'][_0xe93d('0x70')][_0xe93d('0x3c')];_0x3fb517+=0x1){socket[_0xe93d('0x6e')](_0xe93d('0x88'),{'UserId':Number(_0x329116[_0xe93d('0x36')][_0xe93d('0x70')][_0x3fb517]),'FaxQueueId':Number(_0x329116[_0xe93d('0x4a')]['id'])});}}else{socket['emit'](_0xe93d('0x88'),{'UserId':Number(_0x329116[_0xe93d('0x36')][_0xe93d('0x70')]),'FaxQueueId':Number(_0x329116[_0xe93d('0x4a')]['id'])});}});}})[_0xe93d('0x26')](respondWithStatusCode(_0x1d0230,null))['catch'](handleError(_0x1d0230,null));};exports[_0xe93d('0x8c')]=function(_0x4bae8f,_0x5ac560,_0x36cc8d){var _0x18cdaa={};var _0x57a80a={};var _0x482d27;var _0x139102;return db[_0xe93d('0x31')][_0xe93d('0x61')]({'where':{'id':_0x4bae8f[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x5ac560,null))[_0xe93d('0x26')](function(_0x54f0ba){if(_0x54f0ba){_0x482d27=_0x54f0ba;_0x57a80a[_0xe93d('0x35')]=_[_0xe93d('0x37')](db['User'][_0xe93d('0x32')]);_0x57a80a['query']=_[_0xe93d('0x37')](_0x4bae8f[_0xe93d('0x36')]);_0x57a80a[_0xe93d('0x38')]=_[_0xe93d('0x39')](_0x57a80a[_0xe93d('0x35')],_0x57a80a['query']);_0x18cdaa['attributes']=_[_0xe93d('0x39')](_0x57a80a[_0xe93d('0x35')],qs[_0xe93d('0x3a')](_0x4bae8f[_0xe93d('0x36')]['fields']));_0x18cdaa[_0xe93d('0x3b')]=_0x18cdaa[_0xe93d('0x3b')][_0xe93d('0x3c')]?_0x18cdaa[_0xe93d('0x3b')]:_0x57a80a[_0xe93d('0x35')];_0x18cdaa[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x40')]);_0x18cdaa[_0xe93d('0x41')]=qs[_0xe93d('0x38')](_[_0xe93d('0x42')](_0x4bae8f[_0xe93d('0x36')],_0x57a80a[_0xe93d('0x38')]));if(_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x43')]){_0x18cdaa['where']=_[_0xe93d('0x44')](_0x18cdaa['where'],{'$or':_[_0xe93d('0x30')](_0x18cdaa[_0xe93d('0x3b')],function(_0x384b53){var _0x2d847a={};_0x2d847a[_0x384b53]={'$like':'%'+_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x43')]+'%'};return _0x2d847a;})});}_0x18cdaa=_[_0xe93d('0x44')]({},_0x18cdaa,_0x4bae8f[_0xe93d('0x4b')]);return _0x482d27[_0xe93d('0x8c')](_0x18cdaa);}})[_0xe93d('0x26')](function(_0x316d52){if(_0x316d52){_0x139102=_0x316d52[_0xe93d('0x3c')];if(!_0x4bae8f[_0xe93d('0x36')]['hasOwnProperty'](_0xe93d('0x3e'))){_0x18cdaa[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x4bae8f[_0xe93d('0x36')]['limit']);_0x18cdaa[_0xe93d('0x1e')]=qs['offset'](_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x1e')]);}return _0x482d27[_0xe93d('0x8c')](_0x18cdaa);}})[_0xe93d('0x26')](function(_0x406698){if(_0x406698){return _0x406698?{'count':_0x139102,'rows':_0x406698}:null;}})[_0xe93d('0x26')](respondWithResult(_0x5ac560,null))[_0xe93d('0x48')](handleError(_0x5ac560,null));}; \ No newline at end of file +var _0x1f7e=['FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','sort','FaxQueueId','User','findAndCountAll','agent','faxPause','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','ids','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x365d67,_0x588a04){var _0x50ef98=function(_0x583678){while(--_0x583678){_0x365d67['push'](_0x365d67['shift']());}};_0x50ef98(++_0x588a04);}(_0x1f7e,0xa2));var _0xe1f7=function(_0x499fb2,_0x47517a){_0x499fb2=_0x499fb2-0x0;var _0x1bfc30=_0x1f7e[_0x499fb2];return _0x1bfc30;};'use strict';var emlformat=require(_0xe1f7('0x0'));var rimraf=require(_0xe1f7('0x1'));var zipdir=require(_0xe1f7('0x2'));var jsonpatch=require(_0xe1f7('0x3'));var rp=require('request-promise');var moment=require(_0xe1f7('0x4'));var BPromise=require(_0xe1f7('0x5'));var Mustache=require(_0xe1f7('0x6'));var util=require(_0xe1f7('0x7'));var path=require(_0xe1f7('0x8'));var sox=require(_0xe1f7('0x9'));var csv=require('to-csv');var ejs=require(_0xe1f7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe1f7('0xb'));var crypto=require(_0xe1f7('0xc'));var jsforce=require(_0xe1f7('0xd'));var deskjs=require(_0xe1f7('0xe'));var toCsv=require(_0xe1f7('0xf'));var querystring=require(_0xe1f7('0x10'));var Papa=require(_0xe1f7('0x11'));var Redis=require(_0xe1f7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe1f7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1f7('0x14'))('api');var utils=require(_0xe1f7('0x15'));var config=require(_0xe1f7('0x16'));var licenseUtil=require(_0xe1f7('0x17'));var db=require(_0xe1f7('0x18'))['db'];config['redis']=_[_0xe1f7('0x19')](config[_0xe1f7('0x1a')],{'host':_0xe1f7('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1f7('0x1a')]));require(_0xe1f7('0x1c'))['register'](socket);function respondWithStatusCode(_0x5034ad,_0x23e7ac){_0x23e7ac=_0x23e7ac||0xcc;return function(_0xb38ac4){if(_0xb38ac4){return _0x5034ad[_0xe1f7('0x1d')](_0x23e7ac);}return _0x5034ad[_0xe1f7('0x1e')](_0x23e7ac)[_0xe1f7('0x1f')]();};}function respondWithResult(_0x5d6327,_0x493a29){_0x493a29=_0x493a29||0xc8;return function(_0x437ee1){if(_0x437ee1){return _0x5d6327[_0xe1f7('0x1e')](_0x493a29)[_0xe1f7('0x20')](_0x437ee1);}};}function respondWithFilteredResult(_0x25a135,_0x27e703){return function(_0x4f6a1c){if(_0x4f6a1c){var _0x27e809=typeof _0x27e703[_0xe1f7('0x21')]===_0xe1f7('0x22')&&typeof _0x27e703['limit']===_0xe1f7('0x22');var _0x4c431d=_0x4f6a1c[_0xe1f7('0x23')];var _0x1d9613=_0x27e809?0x0:_0x27e703[_0xe1f7('0x21')];var _0x2b0f75=_0x27e809?_0x4f6a1c[_0xe1f7('0x23')]:_0x27e703[_0xe1f7('0x21')]+_0x27e703[_0xe1f7('0x24')];var _0x49aa92;if(_0x2b0f75>=_0x4c431d){_0x2b0f75=_0x4c431d;_0x49aa92=0xc8;}else{_0x49aa92=0xce;}_0x25a135[_0xe1f7('0x1e')](_0x49aa92);return _0x25a135['set'](_0xe1f7('0x25'),_0x1d9613+'-'+_0x2b0f75+'/'+_0x4c431d)[_0xe1f7('0x20')](_0x4f6a1c);}return null;};}function patchUpdates(_0x520d41){return function(_0x199328){try{jsonpatch[_0xe1f7('0x26')](_0x199328,_0x520d41,!![]);}catch(_0x24a133){return BPromise['reject'](_0x24a133);}return _0x199328[_0xe1f7('0x27')]();};}function saveUpdates(_0x422061,_0xfbcb38){return function(_0x3130ef){if(_0x3130ef){return _0x3130ef[_0xe1f7('0x28')](_0x422061)[_0xe1f7('0x29')](function(_0x2a0c33){return _0x2a0c33;});}return null;};}function removeEntity(_0x252c84,_0x24c4a6){return function(_0x4d4e13){if(_0x4d4e13){return _0x4d4e13[_0xe1f7('0x2a')]()[_0xe1f7('0x29')](function(){var _0x38e915=_0x4d4e13[_0xe1f7('0x2b')]({'plain':!![]});var _0x5e97cd=_0xe1f7('0x2c');return db[_0xe1f7('0x2d')]['destroy']({'where':{'type':_0x5e97cd,'resourceId':_0x38e915['id']}})[_0xe1f7('0x29')](function(){return _0x4d4e13;});})[_0xe1f7('0x29')](function(){_0x252c84[_0xe1f7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa48fe6,_0x4ae2eb){return function(_0x591354){if(!_0x591354){_0xa48fe6['sendStatus'](0x194);}return _0x591354;};}function handleError(_0x18ada4,_0x33ba07){_0x33ba07=_0x33ba07||0x1f4;return function(_0x4160a1){logger[_0xe1f7('0x2e')](_0x4160a1[_0xe1f7('0x2f')]);if(_0x4160a1[_0xe1f7('0x30')]){delete _0x4160a1[_0xe1f7('0x30')];}_0x18ada4[_0xe1f7('0x1e')](_0x33ba07)[_0xe1f7('0x31')](_0x4160a1);};}exports[_0xe1f7('0x32')]=function(_0x41df8a,_0x120625){var _0x3cf0d8={},_0xe29b6d={},_0x4533f8={'count':0x0,'rows':[]};var _0x44c684=_[_0xe1f7('0x33')](db[_0xe1f7('0x34')][_0xe1f7('0x35')],function(_0x550dab){return{'name':_0x550dab['fieldName'],'type':_0x550dab['type'][_0xe1f7('0x36')]};});_0xe29b6d['model']=_['map'](_0x44c684,_0xe1f7('0x30'));_0xe29b6d[_0xe1f7('0x37')]=_[_0xe1f7('0x38')](_0x41df8a[_0xe1f7('0x37')]);_0xe29b6d[_0xe1f7('0x39')]=_[_0xe1f7('0x3a')](_0xe29b6d[_0xe1f7('0x3b')],_0xe29b6d[_0xe1f7('0x37')]);_0x3cf0d8[_0xe1f7('0x3c')]=_[_0xe1f7('0x3a')](_0xe29b6d[_0xe1f7('0x3b')],qs[_0xe1f7('0x3d')](_0x41df8a['query'][_0xe1f7('0x3d')]));_0x3cf0d8[_0xe1f7('0x3c')]=_0x3cf0d8[_0xe1f7('0x3c')][_0xe1f7('0x3e')]?_0x3cf0d8['attributes']:_0xe29b6d['model'];if(!_0x41df8a[_0xe1f7('0x37')][_0xe1f7('0x3f')]('nolimit')){_0x3cf0d8[_0xe1f7('0x24')]=qs['limit'](_0x41df8a[_0xe1f7('0x37')][_0xe1f7('0x24')]);_0x3cf0d8[_0xe1f7('0x21')]=qs['offset'](_0x41df8a[_0xe1f7('0x37')][_0xe1f7('0x21')]);}_0x3cf0d8[_0xe1f7('0x40')]=qs['sort'](_0x41df8a[_0xe1f7('0x37')]['sort']);_0x3cf0d8[_0xe1f7('0x41')]=qs[_0xe1f7('0x39')](_[_0xe1f7('0x42')](_0x41df8a[_0xe1f7('0x37')],_0xe29b6d[_0xe1f7('0x39')]),_0x44c684);if(_0x41df8a[_0xe1f7('0x37')][_0xe1f7('0x43')]){_0x3cf0d8[_0xe1f7('0x41')]=_[_0xe1f7('0x44')](_0x3cf0d8[_0xe1f7('0x41')],{'$or':_[_0xe1f7('0x33')](_0x44c684,function(_0x5221dd){if(_0x5221dd[_0xe1f7('0x45')]!==_0xe1f7('0x46')){var _0x199a70={};_0x199a70[_0x5221dd['name']]={'$like':'%'+_0x41df8a['query'][_0xe1f7('0x43')]+'%'};return _0x199a70;}})});}_0x3cf0d8=_['merge']({},_0x3cf0d8,_0x41df8a[_0xe1f7('0x47')]);var _0x3cc5cf={'where':_0x3cf0d8['where']};return db['FaxQueue'][_0xe1f7('0x23')](_0x3cc5cf)['then'](function(_0x1ce86c){_0x4533f8[_0xe1f7('0x23')]=_0x1ce86c;if(_0x41df8a['query']['includeAll']){_0x3cf0d8[_0xe1f7('0x48')]=[{'all':!![]}];}return db[_0xe1f7('0x34')][_0xe1f7('0x49')](_0x3cf0d8);})[_0xe1f7('0x29')](function(_0x2519cd){_0x4533f8[_0xe1f7('0x4a')]=_0x2519cd;return _0x4533f8;})[_0xe1f7('0x29')](respondWithFilteredResult(_0x120625,_0x3cf0d8))[_0xe1f7('0x4b')](handleError(_0x120625,null));};exports[_0xe1f7('0x4c')]=function(_0x434327,_0x98cef1){var _0x13e150={'raw':!![],'where':{'id':_0x434327[_0xe1f7('0x4d')]['id']}},_0x70410d={};_0x70410d['model']=_[_0xe1f7('0x38')](db['FaxQueue'][_0xe1f7('0x35')]);_0x70410d[_0xe1f7('0x37')]=_[_0xe1f7('0x38')](_0x434327[_0xe1f7('0x37')]);_0x70410d['filters']=_[_0xe1f7('0x3a')](_0x70410d['model'],_0x70410d[_0xe1f7('0x37')]);_0x13e150['attributes']=_[_0xe1f7('0x3a')](_0x70410d[_0xe1f7('0x3b')],qs[_0xe1f7('0x3d')](_0x434327[_0xe1f7('0x37')][_0xe1f7('0x3d')]));_0x13e150[_0xe1f7('0x3c')]=_0x13e150[_0xe1f7('0x3c')][_0xe1f7('0x3e')]?_0x13e150[_0xe1f7('0x3c')]:_0x70410d[_0xe1f7('0x3b')];if(_0x434327[_0xe1f7('0x37')][_0xe1f7('0x4e')]){_0x13e150[_0xe1f7('0x48')]=[{'all':!![]}];}_0x13e150=_[_0xe1f7('0x44')]({},_0x13e150,_0x434327[_0xe1f7('0x47')]);return db[_0xe1f7('0x34')][_0xe1f7('0x4f')](_0x13e150)[_0xe1f7('0x29')](handleEntityNotFound(_0x98cef1,null))[_0xe1f7('0x29')](respondWithResult(_0x98cef1,null))['catch'](handleError(_0x98cef1,null));};exports['create']=function(_0x1c1020,_0xc24de8){return db[_0xe1f7('0x34')][_0xe1f7('0x50')](_0x1c1020[_0xe1f7('0x51')],{})[_0xe1f7('0x29')](function(_0x37c06a){var _0x345194=_0x1c1020[_0xe1f7('0x52')][_0xe1f7('0x2b')]({'plain':!![]});if(!_0x345194)throw new Error(_0xe1f7('0x53'));if(_0x345194[_0xe1f7('0x54')]===_0xe1f7('0x52')){var _0x469fcb=_0x37c06a[_0xe1f7('0x2b')]({'plain':!![]});var _0x262f1f='FaxQueues';return db['UserProfileSection'][_0xe1f7('0x4f')]({'where':{'name':_0x262f1f,'userProfileId':_0x345194['userProfileId']},'raw':!![]})['then'](function(_0x318cf1){if(_0x318cf1&&_0x318cf1[_0xe1f7('0x55')]===0x0){return db[_0xe1f7('0x2d')][_0xe1f7('0x50')]({'name':_0x469fcb[_0xe1f7('0x30')],'resourceId':_0x469fcb['id'],'type':_0x318cf1['name'],'sectionId':_0x318cf1['id']},{})[_0xe1f7('0x29')](function(){return _0x37c06a;});}else{return _0x37c06a;}})[_0xe1f7('0x4b')](function(_0x12d2a4){logger[_0xe1f7('0x2e')](_0xe1f7('0x56'),_0x12d2a4);throw _0x12d2a4;});}return _0x37c06a;})['then'](respondWithResult(_0xc24de8,0xc9))['catch'](handleError(_0xc24de8,null));};exports[_0xe1f7('0x28')]=function(_0x310ad9,_0x2befae){if(_0x310ad9[_0xe1f7('0x51')]['id']){delete _0x310ad9['body']['id'];}return db[_0xe1f7('0x34')][_0xe1f7('0x4f')]({'where':{'id':_0x310ad9['params']['id']}})[_0xe1f7('0x29')](handleEntityNotFound(_0x2befae,null))[_0xe1f7('0x29')](saveUpdates(_0x310ad9['body'],null))[_0xe1f7('0x29')](respondWithResult(_0x2befae,null))[_0xe1f7('0x4b')](handleError(_0x2befae,null));};exports[_0xe1f7('0x2a')]=function(_0x47d58a,_0x366ce6){return db[_0xe1f7('0x34')]['find']({'where':{'id':_0x47d58a[_0xe1f7('0x4d')]['id']}})[_0xe1f7('0x29')](handleEntityNotFound(_0x366ce6,null))[_0xe1f7('0x29')](removeEntity(_0x366ce6,null))[_0xe1f7('0x4b')](handleError(_0x366ce6,null));};exports[_0xe1f7('0x57')]=function(_0x296e4d,_0x7f457f){return db['FaxQueue']['describe']()[_0xe1f7('0x29')](respondWithResult(_0x7f457f,null))['catch'](handleError(_0x7f457f,null));};exports[_0xe1f7('0x58')]=function(_0x26db99,_0x33ae70,_0x2ce3b1){var _0x166d81={'raw':!![],'where':{}},_0x17ead3={},_0x529aa7;return db[_0xe1f7('0x34')][_0xe1f7('0x59')]({'where':{'id':_0x26db99['params']['id']}})[_0xe1f7('0x29')](handleEntityNotFound(_0x33ae70,null))[_0xe1f7('0x29')](function(_0x91044e){if(_0x91044e){_0x529aa7=_0x91044e[_0xe1f7('0x2b')]({'plain':!![]});_0x17ead3['model']=_[_0xe1f7('0x38')](db[_0xe1f7('0x5a')]['rawAttributes']);_0x17ead3[_0xe1f7('0x37')]=_[_0xe1f7('0x38')](_0x26db99[_0xe1f7('0x37')]);_0x17ead3[_0xe1f7('0x39')]=_[_0xe1f7('0x3a')](_0x17ead3['model'],_0x17ead3['query']);_0x166d81[_0xe1f7('0x3c')]=_[_0xe1f7('0x3a')](_0x17ead3[_0xe1f7('0x3b')],qs[_0xe1f7('0x3d')](_0x26db99['query']['fields']));_0x166d81[_0xe1f7('0x3c')]=_0x166d81[_0xe1f7('0x3c')]['length']?_0x166d81[_0xe1f7('0x3c')]:_0x17ead3[_0xe1f7('0x3b')];if(!_0x26db99['query'][_0xe1f7('0x3f')](_0xe1f7('0x5b'))){_0x166d81['limit']=qs[_0xe1f7('0x24')](_0x26db99[_0xe1f7('0x37')][_0xe1f7('0x24')]);_0x166d81[_0xe1f7('0x21')]=qs[_0xe1f7('0x21')](_0x26db99[_0xe1f7('0x37')][_0xe1f7('0x21')]);}_0x166d81[_0xe1f7('0x40')]=qs[_0xe1f7('0x5c')](_0x26db99[_0xe1f7('0x37')]['sort']);_0x166d81[_0xe1f7('0x41')]=qs[_0xe1f7('0x39')](_[_0xe1f7('0x42')](_0x26db99[_0xe1f7('0x37')],_0x17ead3[_0xe1f7('0x39')]));_0x166d81['where'][_0xe1f7('0x5d')]=_0x91044e['id'];if(_0x26db99[_0xe1f7('0x37')][_0xe1f7('0x43')]){_0x166d81[_0xe1f7('0x41')]=_[_0xe1f7('0x44')](_0x166d81['where'],{'$or':_[_0xe1f7('0x33')](_0x166d81[_0xe1f7('0x3c')],function(_0x1b846b){var _0x479093={};_0x479093[_0x1b846b]={'$like':'%'+_0x26db99[_0xe1f7('0x37')]['filter']+'%'};return _0x479093;})});}_0x166d81=_['merge']({},_0x166d81,_0x26db99['options']);return db[_0xe1f7('0x5a')][_0xe1f7('0x49')](_0x166d81);}})[_0xe1f7('0x29')](function(_0xb52758){if(_0xb52758){return db[_0xe1f7('0x5e')][_0xe1f7('0x5f')]({'where':{'id':_[_0xe1f7('0x33')](_0xb52758,'UserId'),'role':_0xe1f7('0x60')},'attributes':['id',_0xe1f7('0x30'),_0xe1f7('0x61'),'updatedAt','createdAt']});}})[_0xe1f7('0x29')](function(_0x573d93){if(_0x573d93){return{'count':_0x573d93['count'],'rows':_[_0xe1f7('0x33')](_0x573d93[_0xe1f7('0x4a')],function(_0x102775){return{'membername':_0x102775['name'],'UserId':_0x102775['id'],'queue_name':_0x529aa7[_0xe1f7('0x30')],'FaxQueueId':_0x529aa7['id'],'interface':util[_0xe1f7('0x62')](_0xe1f7('0x63'),_0xe1f7('0x64'),_0x102775[_0xe1f7('0x30')]),'penalty':0x0,'paused':_0x102775[_0xe1f7('0x61')],'createdAt':_0x102775[_0xe1f7('0x65')],'updatedAt':_0x102775['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x33ae70,_0x166d81))[_0xe1f7('0x4b')](handleError(_0x33ae70,null));};exports[_0xe1f7('0x66')]=function(_0x314943,_0x20686f,_0x5cddf7){var _0x26dd60={};var _0x21bc5f={};var _0x6f599f;var _0x4ce4bc;return db[_0xe1f7('0x34')]['findOne']({'where':{'id':_0x314943[_0xe1f7('0x4d')]['id']}})[_0xe1f7('0x29')](handleEntityNotFound(_0x20686f,null))[_0xe1f7('0x29')](function(_0x187488){if(_0x187488){_0x6f599f=_0x187488;_0x21bc5f[_0xe1f7('0x3b')]=_[_0xe1f7('0x38')](db[_0xe1f7('0x67')][_0xe1f7('0x35')]);_0x21bc5f['query']=_[_0xe1f7('0x38')](_0x314943[_0xe1f7('0x37')]);_0x21bc5f['filters']=_['intersection'](_0x21bc5f[_0xe1f7('0x3b')],_0x21bc5f[_0xe1f7('0x37')]);_0x26dd60[_0xe1f7('0x3c')]=_[_0xe1f7('0x3a')](_0x21bc5f[_0xe1f7('0x3b')],qs[_0xe1f7('0x3d')](_0x314943['query']['fields']));_0x26dd60[_0xe1f7('0x3c')]=_0x26dd60[_0xe1f7('0x3c')][_0xe1f7('0x3e')]?_0x26dd60[_0xe1f7('0x3c')]:_0x21bc5f[_0xe1f7('0x3b')];_0x26dd60['order']=qs[_0xe1f7('0x5c')](_0x314943[_0xe1f7('0x37')][_0xe1f7('0x5c')]);_0x26dd60[_0xe1f7('0x41')]=qs[_0xe1f7('0x39')](_[_0xe1f7('0x42')](_0x314943[_0xe1f7('0x37')],_0x21bc5f[_0xe1f7('0x39')]));if(_0x314943[_0xe1f7('0x37')][_0xe1f7('0x43')]){_0x26dd60[_0xe1f7('0x41')]=_['merge'](_0x26dd60[_0xe1f7('0x41')],{'$or':_[_0xe1f7('0x33')](_0x26dd60[_0xe1f7('0x3c')],function(_0x418642){var _0x1343a0={};_0x1343a0[_0x418642]={'$like':'%'+_0x314943[_0xe1f7('0x37')][_0xe1f7('0x43')]+'%'};return _0x1343a0;})});}_0x26dd60=_['merge']({},_0x26dd60,_0x314943[_0xe1f7('0x47')]);return _0x6f599f[_0xe1f7('0x66')](_0x26dd60);}})['then'](function(_0x42fc86){if(_0x42fc86){_0x4ce4bc=_0x42fc86[_0xe1f7('0x3e')];if(!_0x314943[_0xe1f7('0x37')][_0xe1f7('0x3f')]('nolimit')){_0x26dd60['limit']=qs[_0xe1f7('0x24')](_0x314943[_0xe1f7('0x37')][_0xe1f7('0x24')]);_0x26dd60[_0xe1f7('0x21')]=qs[_0xe1f7('0x21')](_0x314943[_0xe1f7('0x37')][_0xe1f7('0x21')]);}return _0x6f599f[_0xe1f7('0x66')](_0x26dd60);}})[_0xe1f7('0x29')](function(_0x3a38d7){if(_0x3a38d7){return _0x3a38d7?{'count':_0x4ce4bc,'rows':_0x3a38d7}:null;}})[_0xe1f7('0x29')](respondWithResult(_0x20686f,null))['catch'](handleError(_0x20686f,null));};exports[_0xe1f7('0x68')]=function(_0x3b09d4,_0x6a3533,_0x5823fa){var _0x452b77=_0x3b09d4['body']['ids'];return db[_0xe1f7('0x67')][_0xe1f7('0x49')]({'where':{'id':_0x452b77},'attributes':['id'],'include':[{'model':db[_0xe1f7('0x5e')],'as':_0xe1f7('0x69'),'attributes':['id',_0xe1f7('0x30'),'online',_0xe1f7('0x6a'),'interface'],'raw':!![]}]})[_0xe1f7('0x29')](function(_0xb065c){if(_0xb065c){var _0xbbe87d=_[_0xe1f7('0x6b')](_0xb065c,function(_0x5350f6){var _0x281031=_0x5350f6[_0xe1f7('0x2b')]({'plain':!![]});return _0x281031[_0xe1f7('0x69')];});return db[_0xe1f7('0x34')]['find']({'where':{'id':_0x3b09d4[_0xe1f7('0x4d')]['id']}})[_0xe1f7('0x29')](function(_0x1a4af2){return db[_0xe1f7('0x6c')][_0xe1f7('0x6d')](function(_0x34d512){return _0x1a4af2['addTeams'](_0x452b77,{'transaction':_0x34d512})['then'](function(){return BPromise[_0xe1f7('0x6e')](_0xbbe87d,function(_0x5a5788){return db[_0xe1f7('0x5a')][_0xe1f7('0x6f')]({'where':{'UserId':_0x5a5788['id'],'FaxQueueId':_0x3b09d4['params']['id']},'transaction':_0x34d512});});})['then'](function(){_0xbbe87d[_0xe1f7('0x70')](function(_0x21bac3){socket[_0xe1f7('0x71')](_0xe1f7('0x72'),{'UserId':_0x21bac3['id'],'FaxQueueId':_0x1a4af2['id']});});});});});}})[_0xe1f7('0x29')](respondWithStatusCode(_0x6a3533,null))[_0xe1f7('0x4b')](handleError(_0x6a3533,null));};exports['removeTeams']=function(_0x394c03,_0x1e3786,_0x162c79){return db[_0xe1f7('0x67')][_0xe1f7('0x49')]({'where':{'id':_0x394c03[_0xe1f7('0x37')][_0xe1f7('0x73')]},'attributes':['id'],'include':[{'model':db[_0xe1f7('0x5e')],'as':_0xe1f7('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe1f7('0x29')](handleEntityNotFound(_0x1e3786,null))[_0xe1f7('0x29')](function(_0x1352a0){var _0x5c31a8=_['map'](_0x1352a0,'id');var _0x2cc7a3=[];var _0x9a56f7=[];var _0x35f359=squel['select']();_0x35f359['field'](_0xe1f7('0x74'))[_0xe1f7('0x75')]('team_has_fax_queues','tq')[_0xe1f7('0x76')]('user_has_teams','ut',_0xe1f7('0x77'))['where'](_0xe1f7('0x78'),_0x394c03[_0xe1f7('0x4d')]['id']);for(var _0x1e15fb=0x0;_0x1e15fb<_0x1352a0[_0xe1f7('0x3e')];_0x1e15fb+=0x1){let _0x432da8=_0x1352a0[_0x1e15fb];for(var _0x3725ce=0x0;_0x3725ce<_0x432da8['Agents']['length'];_0x3725ce+=0x1){let _0x242baa=_0x432da8['Agents'][_0x3725ce];var _0x3eaaeb=_0x35f359[_0xe1f7('0x79')]();_0x3eaaeb[_0xe1f7('0x41')]('ut.UserId\x20=\x20?',_0x242baa['id']);_0x9a56f7[_0xe1f7('0x7a')](db[_0xe1f7('0x6c')][_0xe1f7('0x37')](_0x3eaaeb[_0xe1f7('0x7b')](),{'type':db['sequelize'][_0xe1f7('0x7c')]['SELECT']})[_0xe1f7('0x29')](function(_0x10c5ff){if(_0x10c5ff[_0xe1f7('0x3e')]===0x1){return _0x242baa['id'];}else{var _0x1630d6=_[_0xe1f7('0x7d')](_['map'](_0x10c5ff,_0xe1f7('0x7e')),function(_0x2f6fb0){return _[_0xe1f7('0x7f')](_0x5c31a8,_0x2f6fb0);});if(_0x1630d6){return _0x242baa['id'];}}}));}}return BPromise[_0xe1f7('0x80')](_0x9a56f7)[_0xe1f7('0x29')](function(_0x282595){_0x2cc7a3=_(_0x2cc7a3)[_0xe1f7('0x81')](_0x282595)[_0xe1f7('0x82')]()[_0xe1f7('0x83')]();return db[_0xe1f7('0x34')][_0xe1f7('0x4f')]({'where':{'id':_0x394c03[_0xe1f7('0x4d')]['id']}})[_0xe1f7('0x29')](function(_0x5cdaca){return db['sequelize'][_0xe1f7('0x6d')](function(_0x71b28a){return _0x5cdaca[_0xe1f7('0x84')](_0x394c03['query'][_0xe1f7('0x73')],{'transaction':_0x71b28a})[_0xe1f7('0x29')](function(){if(!_[_0xe1f7('0x85')](_0x2cc7a3)){return _0x5cdaca[_0xe1f7('0x86')](_0x2cc7a3,{'transaction':_0x71b28a});}})[_0xe1f7('0x29')](function(){_0x2cc7a3[_0xe1f7('0x70')](function(_0x34bee0){socket['emit'](_0xe1f7('0x87'),{'UserId':_0x34bee0,'FaxQueueId':_0x5cdaca['id']});});});});});});})[_0xe1f7('0x29')](respondWithStatusCode(_0x1e3786,null))[_0xe1f7('0x4b')](handleError(_0x1e3786,null));};exports[_0xe1f7('0x88')]=function(_0x1caf1e,_0x2500bc,_0x1bed10){return db['FaxQueue']['find']({'where':{'id':_0x1caf1e['params']['id']}})[_0xe1f7('0x29')](handleEntityNotFound(_0x2500bc,null))[_0xe1f7('0x29')](function(_0x53490e){if(_0x53490e){return _0x53490e['addAgents'](_0x1caf1e[_0xe1f7('0x51')][_0xe1f7('0x73')],_[_0xe1f7('0x89')](_0x1caf1e[_0xe1f7('0x51')],['ids','id'])||{})[_0xe1f7('0x8a')](function(_0x4995c5){for(var _0x3a0128=0x0;_0x3a0128<_0x1caf1e['body'][_0xe1f7('0x73')][_0xe1f7('0x3e')];_0x3a0128+=0x1){socket['emit'](_0xe1f7('0x72'),{'UserId':Number(_0x1caf1e[_0xe1f7('0x51')][_0xe1f7('0x73')][_0x3a0128]),'FaxQueueId':Number(_0x1caf1e[_0xe1f7('0x4d')]['id'])});}return _0x4995c5;});}})[_0xe1f7('0x29')](respondWithResult(_0x2500bc,null))[_0xe1f7('0x4b')](handleError(_0x2500bc,null));};exports[_0xe1f7('0x86')]=function(_0x5d46cf,_0x3cf7d8,_0x32d626){return db['FaxQueue'][_0xe1f7('0x4f')]({'where':{'id':_0x5d46cf[_0xe1f7('0x4d')]['id']}})[_0xe1f7('0x29')](handleEntityNotFound(_0x3cf7d8,null))['then'](function(_0x530c0d){if(_0x530c0d){return _0x530c0d[_0xe1f7('0x86')](_0x5d46cf[_0xe1f7('0x37')][_0xe1f7('0x73')])[_0xe1f7('0x29')](function(){if(_[_0xe1f7('0x8b')](_0x5d46cf['query'][_0xe1f7('0x73')])){for(var _0x3d2be9=0x0;_0x3d2be9<_0x5d46cf['query'][_0xe1f7('0x73')][_0xe1f7('0x3e')];_0x3d2be9+=0x1){socket[_0xe1f7('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x5d46cf[_0xe1f7('0x37')][_0xe1f7('0x73')][_0x3d2be9]),'FaxQueueId':Number(_0x5d46cf[_0xe1f7('0x4d')]['id'])});}}else{socket['emit'](_0xe1f7('0x87'),{'UserId':Number(_0x5d46cf[_0xe1f7('0x37')][_0xe1f7('0x73')]),'FaxQueueId':Number(_0x5d46cf['params']['id'])});}});}})[_0xe1f7('0x29')](respondWithStatusCode(_0x3cf7d8,null))[_0xe1f7('0x4b')](handleError(_0x3cf7d8,null));};exports[_0xe1f7('0x8c')]=function(_0x496685,_0x5b5403,_0x26df98){var _0xcceffa={};var _0x32da7c={};var _0x513395;var _0x2d00a1;return db['FaxQueue'][_0xe1f7('0x59')]({'where':{'id':_0x496685[_0xe1f7('0x4d')]['id']}})[_0xe1f7('0x29')](handleEntityNotFound(_0x5b5403,null))[_0xe1f7('0x29')](function(_0x55bf20){if(_0x55bf20){_0x513395=_0x55bf20;_0x32da7c[_0xe1f7('0x3b')]=_[_0xe1f7('0x38')](db[_0xe1f7('0x5e')][_0xe1f7('0x35')]);_0x32da7c['query']=_[_0xe1f7('0x38')](_0x496685[_0xe1f7('0x37')]);_0x32da7c[_0xe1f7('0x39')]=_[_0xe1f7('0x3a')](_0x32da7c['model'],_0x32da7c['query']);_0xcceffa[_0xe1f7('0x3c')]=_[_0xe1f7('0x3a')](_0x32da7c[_0xe1f7('0x3b')],qs[_0xe1f7('0x3d')](_0x496685[_0xe1f7('0x37')]['fields']));_0xcceffa[_0xe1f7('0x3c')]=_0xcceffa[_0xe1f7('0x3c')][_0xe1f7('0x3e')]?_0xcceffa[_0xe1f7('0x3c')]:_0x32da7c[_0xe1f7('0x3b')];_0xcceffa[_0xe1f7('0x40')]=qs[_0xe1f7('0x5c')](_0x496685[_0xe1f7('0x37')][_0xe1f7('0x5c')]);_0xcceffa[_0xe1f7('0x41')]=qs[_0xe1f7('0x39')](_['pick'](_0x496685['query'],_0x32da7c[_0xe1f7('0x39')]));if(_0x496685[_0xe1f7('0x37')]['filter']){_0xcceffa[_0xe1f7('0x41')]=_['merge'](_0xcceffa[_0xe1f7('0x41')],{'$or':_[_0xe1f7('0x33')](_0xcceffa['attributes'],function(_0x158e30){var _0x290f01={};_0x290f01[_0x158e30]={'$like':'%'+_0x496685[_0xe1f7('0x37')]['filter']+'%'};return _0x290f01;})});}_0xcceffa=_[_0xe1f7('0x44')]({},_0xcceffa,_0x496685['options']);return _0x513395[_0xe1f7('0x8c')](_0xcceffa);}})[_0xe1f7('0x29')](function(_0x2fac05){if(_0x2fac05){_0x2d00a1=_0x2fac05[_0xe1f7('0x3e')];if(!_0x496685[_0xe1f7('0x37')][_0xe1f7('0x3f')](_0xe1f7('0x5b'))){_0xcceffa[_0xe1f7('0x24')]=qs[_0xe1f7('0x24')](_0x496685['query'][_0xe1f7('0x24')]);_0xcceffa[_0xe1f7('0x21')]=qs[_0xe1f7('0x21')](_0x496685['query']['offset']);}return _0x513395['getAgents'](_0xcceffa);}})[_0xe1f7('0x29')](function(_0x36714b){if(_0x36714b){return _0x36714b?{'count':_0x2d00a1,'rows':_0x36714b}:null;}})['then'](respondWithResult(_0x5b5403,null))[_0xe1f7('0x4b')](handleError(_0x5b5403,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 179c4e8..8b62df3 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 _0xfad6=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hook'];(function(_0x59e2d2,_0x1f6357){var _0x38326a=function(_0x244dab){while(--_0x244dab){_0x59e2d2['push'](_0x59e2d2['shift']());}};_0x38326a(++_0x1f6357);}(_0xfad6,0x13c));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6fad('0x0'));var FaxQueue=require(_0x6fad('0x1'))['db'][_0x6fad('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6fad('0x3')](0x0);var events={'afterCreate':_0x6fad('0x4'),'afterUpdate':_0x6fad('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c6b45){return function(_0x301618,_0x2e199e,_0x37f972){FaxQueueEvents[_0x6fad('0x6')](_0x2c6b45+':'+_0x301618['id'],_0x301618);FaxQueueEvents[_0x6fad('0x6')](_0x2c6b45,_0x301618);_0x37f972(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x6fad('0x7')](e,emitEvent(event));}}module[_0x6fad('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xcb5d=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xcb5d,0xef));var _0xdcb5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcb5d[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0xdcb5('0x0'));var FaxQueue=require(_0xdcb5('0x1'))['db'][_0xdcb5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdcb5('0x3')](0x0);var events={'afterCreate':_0xdcb5('0x4'),'afterUpdate':_0xdcb5('0x5'),'afterDestroy':_0xdcb5('0x6')};function emitEvent(_0x2b9e86){return function(_0xccc2eb,_0x3a4437,_0x2374cb){FaxQueueEvents[_0xdcb5('0x7')](_0x2b9e86+':'+_0xccc2eb['id'],_0xccc2eb);FaxQueueEvents[_0xdcb5('0x7')](_0x2b9e86,_0xccc2eb);_0x2374cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xdcb5('0x8')](e,emitEvent(event));}}module[_0xdcb5('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index fbfff67..77ed815 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 _0x026d=['define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxQueue.attributes'];(function(_0x109ca8,_0x3a0ced){var _0x6c7ac3=function(_0x184d29){while(--_0x184d29){_0x109ca8['push'](_0x109ca8['shift']());}};_0x6c7ac3(++_0x3a0ced);}(_0x026d,0x1e7));var _0xd026=function(_0xa0abad,_0x3adedb){_0xa0abad=_0xa0abad-0x0;var _0x1632ab=_0x026d[_0xa0abad];return _0x1632ab;};'use strict';var _=require(_0xd026('0x0'));var util=require('util');var logger=require(_0xd026('0x1'))(_0xd026('0x2'));var moment=require(_0xd026('0x3'));var BPromise=require('bluebird');var rp=require(_0xd026('0x4'));var fs=require('fs');var path=require(_0xd026('0x5'));var rimraf=require('rimraf');var config=require(_0xd026('0x6'));var attributes=require(_0xd026('0x7'));module['exports']=function(_0x9f644c,_0x12762b){return _0x9f644c[_0xd026('0x8')](_0xd026('0x9'),attributes,{'tableName':_0xd026('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2945=['../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util','api','moment','path'];(function(_0x14e5ad,_0x1f5b10){var _0x48bf09=function(_0x12e4e0){while(--_0x12e4e0){_0x14e5ad['push'](_0x14e5ad['shift']());}};_0x48bf09(++_0x1f5b10);}(_0x2945,0x1db));var _0x5294=function(_0x4ecffb,_0x58d337){_0x4ecffb=_0x4ecffb-0x0;var _0x34c6c5=_0x2945[_0x4ecffb];return _0x34c6c5;};'use strict';var _=require(_0x5294('0x0'));var util=require(_0x5294('0x1'));var logger=require('../../config/logger')(_0x5294('0x2'));var moment=require(_0x5294('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5294('0x4'));var rimraf=require('rimraf');var config=require(_0x5294('0x5'));var attributes=require('./faxQueue.attributes');module[_0x5294('0x6')]=function(_0x3fdb3a,_0x819191){return _0x3fdb3a[_0x5294('0x7')](_0x5294('0x8'),attributes,{'tableName':_0x5294('0x9'),'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 6372aef..dfcc105 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 _0x0e96=['error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','map','include','model','ShowFaxQueue','find','raw','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3efc74,_0x5075a7){var _0x4d4853=function(_0x6f3f25){while(--_0x6f3f25){_0x3efc74['push'](_0x3efc74['shift']());}};_0x4d4853(++_0x5075a7);}(_0x0e96,0xb2));var _0x60e9=function(_0x5e26f0,_0x3fe2e0){_0x5e26f0=_0x5e26f0-0x0;var _0x513758=_0x0e96[_0x5e26f0];return _0x513758;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60e9('0x0'));var BPromise=require(_0x60e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60e9('0x2'));var db=require(_0x60e9('0x3'))['db'];var utils=require(_0x60e9('0x4'));var logger=require(_0x60e9('0x5'))(_0x60e9('0x6'));var config=require('../../config/environment');var jayson=require(_0x60e9('0x7'));var client=jayson[_0x60e9('0x8')]['http']({'port':0x232a});config[_0x60e9('0x9')]=_[_0x60e9('0xa')](config['redis'],{'host':_0x60e9('0xb'),'port':0x18eb});var socket=require(_0x60e9('0xc'))(new Redis(config[_0x60e9('0x9')]));require('./faxQueue.socket')[_0x60e9('0xd')](socket);function respondWithRpcPromise(_0x500f36,_0x31d217,_0x982261){return new BPromise(function(_0x4fcbb0,_0x19d8c4){return client[_0x60e9('0xe')](_0x500f36,_0x982261)[_0x60e9('0xf')](function(_0x5e2247){logger[_0x60e9('0x10')](_0x60e9('0x11'),_0x31d217,_0x60e9('0x12'));logger[_0x60e9('0x13')](_0x60e9('0x14'),_0x31d217,_0x60e9('0x12'),JSON[_0x60e9('0x15')](_0x5e2247));if(_0x5e2247[_0x60e9('0x16')]){if(_0x5e2247[_0x60e9('0x16')][_0x60e9('0x17')]===0x1f4){logger[_0x60e9('0x16')](_0x60e9('0x11'),_0x31d217,_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);return _0x19d8c4(_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);}logger[_0x60e9('0x16')]('FaxQueue,\x20%s,\x20%s',_0x31d217,_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);return _0x4fcbb0(_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);}else{logger['info'](_0x60e9('0x11'),_0x31d217,_0x60e9('0x12'));_0x4fcbb0(_0x5e2247[_0x60e9('0x19')][_0x60e9('0x18')]);}})['catch'](function(_0xd9c80f){logger[_0x60e9('0x16')](_0x60e9('0x11'),_0x31d217,_0xd9c80f);_0x19d8c4(_0xd9c80f);});});}exports[_0x60e9('0x1a')]=function(_0x1546e1){var _0x12726c=this;return new Promise(function(_0x395a17,_0x1966f8){return db[_0x60e9('0x1b')][_0x60e9('0x1c')]({'raw':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1[_0x60e9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1['options'][_0x60e9('0x1e')]||null:null,'attributes':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1[_0x60e9('0x1d')][_0x60e9('0x1f')]||null:null,'limit':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1['options'][_0x60e9('0x20')]||null:null,'include':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1[_0x60e9('0x1d')]['include']?_[_0x60e9('0x21')](_0x1546e1[_0x60e9('0x1d')][_0x60e9('0x22')],function(_0x1a5ece){return{'model':db[_0x1a5ece[_0x60e9('0x23')]],'as':_0x1a5ece['as'],'attributes':_0x1a5ece[_0x60e9('0x1f')],'include':_0x1a5ece['include']?_[_0x60e9('0x21')](_0x1a5ece[_0x60e9('0x22')],function(_0x22348b){return{'model':db[_0x22348b['model']],'as':_0x22348b['as'],'attributes':_0x22348b[_0x60e9('0x1f')],'include':_0x22348b[_0x60e9('0x22')]?_['map'](_0x22348b[_0x60e9('0x22')],function(_0x9ea7b1){return{'model':db[_0x9ea7b1[_0x60e9('0x23')]],'as':_0x9ea7b1['as'],'attributes':_0x9ea7b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x60e9('0xf')](function(_0x2d42e9){logger[_0x60e9('0x10')](_0x60e9('0x1a'),_0x1546e1);logger[_0x60e9('0x13')](_0x60e9('0x1a'),_0x1546e1,JSON[_0x60e9('0x15')](_0x2d42e9));_0x395a17(_0x2d42e9);})['catch'](function(_0x505121){logger[_0x60e9('0x16')]('GetFaxQueue',_0x505121[_0x60e9('0x18')],_0x1546e1);_0x1966f8(_0x12726c[_0x60e9('0x16')](0x1f4,_0x505121[_0x60e9('0x18')]));});});};exports[_0x60e9('0x24')]=function(_0x5c47c7){var _0x57b621=this;return new Promise(function(_0x28c571,_0x4043a2){return db[_0x60e9('0x1b')][_0x60e9('0x25')]({'raw':_0x5c47c7['options']?_0x5c47c7['options'][_0x60e9('0x26')]===undefined?!![]:![]:!![],'where':_0x5c47c7[_0x60e9('0x1d')]?_0x5c47c7['options'][_0x60e9('0x1e')]||null:null,'attributes':_0x5c47c7[_0x60e9('0x1d')]?_0x5c47c7[_0x60e9('0x1d')][_0x60e9('0x1f')]||null:null,'include':_0x5c47c7['options']?_0x5c47c7[_0x60e9('0x1d')][_0x60e9('0x22')]?_['map'](_0x5c47c7[_0x60e9('0x1d')][_0x60e9('0x22')],function(_0x1c5819){return{'model':db[_0x1c5819[_0x60e9('0x23')]],'as':_0x1c5819['as'],'attributes':_0x1c5819['attributes'],'include':_0x1c5819[_0x60e9('0x22')]?_[_0x60e9('0x21')](_0x1c5819[_0x60e9('0x22')],function(_0x40eae5){return{'model':db[_0x40eae5[_0x60e9('0x23')]],'as':_0x40eae5['as'],'attributes':_0x40eae5[_0x60e9('0x1f')],'include':_0x40eae5[_0x60e9('0x22')]?_[_0x60e9('0x21')](_0x40eae5[_0x60e9('0x22')],function(_0x33f108){return{'model':db[_0x33f108['model']],'as':_0x33f108['as'],'attributes':_0x33f108[_0x60e9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x60e9('0xf')](function(_0x44497e){logger[_0x60e9('0x10')](_0x60e9('0x24'),_0x5c47c7);logger[_0x60e9('0x13')](_0x60e9('0x24'),_0x5c47c7,JSON['stringify'](_0x44497e));_0x28c571(_0x44497e);})[_0x60e9('0x27')](function(_0x1374d7){logger[_0x60e9('0x16')](_0x60e9('0x24'),_0x1374d7[_0x60e9('0x18')],_0x5c47c7);_0x4043a2(_0x57b621['error'](0x1f4,_0x1374d7[_0x60e9('0x18')]));});});}; \ No newline at end of file +var _0x9108=['limit','include','model','map','find','ShowFaxQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes'];(function(_0x5070a4,_0x1db896){var _0x179668=function(_0x43b757){while(--_0x43b757){_0x5070a4['push'](_0x5070a4['shift']());}};_0x179668(++_0x1db896);}(_0x9108,0x1c9));var _0x8910=function(_0xc95cd2,_0xabae69){_0xc95cd2=_0xc95cd2-0x0;var _0xbaaf68=_0x9108[_0xc95cd2];return _0xbaaf68;};'use strict';var _=require(_0x8910('0x0'));var util=require('util');var moment=require(_0x8910('0x1'));var BPromise=require(_0x8910('0x2'));var rs=require(_0x8910('0x3'));var fs=require('fs');var Redis=require(_0x8910('0x4'));var db=require(_0x8910('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8910('0x6'));var config=require(_0x8910('0x7'));var jayson=require(_0x8910('0x8'));var client=jayson[_0x8910('0x9')][_0x8910('0xa')]({'port':0x232a});config['redis']=_[_0x8910('0xb')](config[_0x8910('0xc')],{'host':_0x8910('0xd'),'port':0x18eb});var socket=require(_0x8910('0xe'))(new Redis(config[_0x8910('0xc')]));require(_0x8910('0xf'))[_0x8910('0x10')](socket);function respondWithRpcPromise(_0x5d7574,_0x5a0f38,_0x3f14cd){return new BPromise(function(_0x3f54d2,_0x36c9f4){return client[_0x8910('0x11')](_0x5d7574,_0x3f14cd)[_0x8910('0x12')](function(_0x3f57c4){logger[_0x8910('0x13')]('FaxQueue,\x20%s,\x20%s',_0x5a0f38,_0x8910('0x14'));logger[_0x8910('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5a0f38,'request\x20sent',JSON[_0x8910('0x16')](_0x3f57c4));if(_0x3f57c4[_0x8910('0x17')]){if(_0x3f57c4['error']['code']===0x1f4){logger[_0x8910('0x17')](_0x8910('0x18'),_0x5a0f38,_0x3f57c4[_0x8910('0x17')][_0x8910('0x19')]);return _0x36c9f4(_0x3f57c4[_0x8910('0x17')]['message']);}logger[_0x8910('0x17')](_0x8910('0x18'),_0x5a0f38,_0x3f57c4[_0x8910('0x17')][_0x8910('0x19')]);return _0x3f54d2(_0x3f57c4['error']['message']);}else{logger[_0x8910('0x13')](_0x8910('0x18'),_0x5a0f38,_0x8910('0x14'));_0x3f54d2(_0x3f57c4[_0x8910('0x1a')][_0x8910('0x19')]);}})[_0x8910('0x1b')](function(_0x4007a1){logger[_0x8910('0x17')](_0x8910('0x18'),_0x5a0f38,_0x4007a1);_0x36c9f4(_0x4007a1);});});}exports[_0x8910('0x1c')]=function(_0x65fdad){var _0x585dd4=this;return new Promise(function(_0x52a8c8,_0x4d54b2){return db[_0x8910('0x1d')][_0x8910('0x1e')]({'raw':_0x65fdad[_0x8910('0x1f')]?_0x65fdad[_0x8910('0x1f')][_0x8910('0x20')]===undefined?!![]:![]:!![],'where':_0x65fdad['options']?_0x65fdad[_0x8910('0x1f')][_0x8910('0x21')]||null:null,'attributes':_0x65fdad[_0x8910('0x1f')]?_0x65fdad[_0x8910('0x1f')][_0x8910('0x22')]||null:null,'limit':_0x65fdad[_0x8910('0x1f')]?_0x65fdad[_0x8910('0x1f')][_0x8910('0x23')]||null:null,'include':_0x65fdad[_0x8910('0x1f')]?_0x65fdad[_0x8910('0x1f')][_0x8910('0x24')]?_['map'](_0x65fdad['options'][_0x8910('0x24')],function(_0x273e30){return{'model':db[_0x273e30[_0x8910('0x25')]],'as':_0x273e30['as'],'attributes':_0x273e30[_0x8910('0x22')],'include':_0x273e30[_0x8910('0x24')]?_[_0x8910('0x26')](_0x273e30[_0x8910('0x24')],function(_0x551f93){return{'model':db[_0x551f93[_0x8910('0x25')]],'as':_0x551f93['as'],'attributes':_0x551f93[_0x8910('0x22')],'include':_0x551f93[_0x8910('0x24')]?_['map'](_0x551f93[_0x8910('0x24')],function(_0x394233){return{'model':db[_0x394233['model']],'as':_0x394233['as'],'attributes':_0x394233[_0x8910('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8910('0x12')](function(_0x3511f9){logger[_0x8910('0x13')](_0x8910('0x1c'),_0x65fdad);logger[_0x8910('0x15')](_0x8910('0x1c'),_0x65fdad,JSON[_0x8910('0x16')](_0x3511f9));_0x52a8c8(_0x3511f9);})['catch'](function(_0x591b12){logger['error']('GetFaxQueue',_0x591b12[_0x8910('0x19')],_0x65fdad);_0x4d54b2(_0x585dd4['error'](0x1f4,_0x591b12[_0x8910('0x19')]));});});};exports['ShowFaxQueue']=function(_0x38f762){var _0x172df7=this;return new Promise(function(_0x20109f,_0x1a93fe){return db['FaxQueue'][_0x8910('0x27')]({'raw':_0x38f762['options']?_0x38f762[_0x8910('0x1f')][_0x8910('0x20')]===undefined?!![]:![]:!![],'where':_0x38f762['options']?_0x38f762['options'][_0x8910('0x21')]||null:null,'attributes':_0x38f762['options']?_0x38f762['options'][_0x8910('0x22')]||null:null,'include':_0x38f762[_0x8910('0x1f')]?_0x38f762[_0x8910('0x1f')][_0x8910('0x24')]?_['map'](_0x38f762[_0x8910('0x1f')]['include'],function(_0x244673){return{'model':db[_0x244673[_0x8910('0x25')]],'as':_0x244673['as'],'attributes':_0x244673['attributes'],'include':_0x244673[_0x8910('0x24')]?_[_0x8910('0x26')](_0x244673[_0x8910('0x24')],function(_0x409077){return{'model':db[_0x409077[_0x8910('0x25')]],'as':_0x409077['as'],'attributes':_0x409077['attributes'],'include':_0x409077[_0x8910('0x24')]?_[_0x8910('0x26')](_0x409077[_0x8910('0x24')],function(_0x1e24ca){return{'model':db[_0x1e24ca[_0x8910('0x25')]],'as':_0x1e24ca['as'],'attributes':_0x1e24ca[_0x8910('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8910('0x12')](function(_0x167c05){logger[_0x8910('0x13')](_0x8910('0x28'),_0x38f762);logger[_0x8910('0x15')]('ShowFaxQueue',_0x38f762,JSON[_0x8910('0x16')](_0x167c05));_0x20109f(_0x167c05);})[_0x8910('0x1b')](function(_0xac17af){logger['error'](_0x8910('0x28'),_0xac17af['message'],_0x38f762);_0x1a93fe(_0x172df7[_0x8910('0x17')](0x1f4,_0xac17af[_0x8910('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b46f9e2..8e47abd 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 _0x9278=['update','removeListener','register','length','faxQueue:','./faxQueue.events','remove'];(function(_0x25836c,_0x1047c4){var _0x383e29=function(_0x2b47ba){while(--_0x2b47ba){_0x25836c['push'](_0x25836c['shift']());}};_0x383e29(++_0x1047c4);}(_0x9278,0x1c5));var _0x8927=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9278[_0x1cc8fe];return _0x230054;};'use strict';var FaxQueueEvents=require(_0x8927('0x0'));var events=['save',_0x8927('0x1'),_0x8927('0x2')];function createListener(_0x81d15d,_0x232fb6){return function(_0xf435c2){_0x232fb6['emit'](_0x81d15d,_0xf435c2);};}function removeListener(_0x307db7,_0x4e1287){return function(){FaxQueueEvents[_0x8927('0x3')](_0x307db7,_0x4e1287);};}exports[_0x8927('0x4')]=function(_0x56cb52){for(var _0x308ad1=0x0,_0x9ada3e=events[_0x8927('0x5')];_0x308ad1<_0x9ada3e;_0x308ad1++){var _0x4b1242=events[_0x308ad1];var _0x5aa23b=createListener(_0x8927('0x6')+_0x4b1242,_0x56cb52);FaxQueueEvents['on'](_0x4b1242,_0x5aa23b);}}; \ No newline at end of file +var _0xcf6a=['remove','emit','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x1f6d50,_0x74c5d6){var _0x965189=function(_0x398bb1){while(--_0x398bb1){_0x1f6d50['push'](_0x1f6d50['shift']());}};_0x965189(++_0x74c5d6);}(_0xcf6a,0xbb));var _0xacf6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xcf6a[_0x3ab9ee];return _0x82ee88;};'use strict';var FaxQueueEvents=require(_0xacf6('0x0'));var events=[_0xacf6('0x1'),_0xacf6('0x2'),'update'];function createListener(_0x4ea285,_0x2a420d){return function(_0x1e7563){_0x2a420d[_0xacf6('0x3')](_0x4ea285,_0x1e7563);};}function removeListener(_0x870e11,_0xb1c6e4){return function(){FaxQueueEvents['removeListener'](_0x870e11,_0xb1c6e4);};}exports[_0xacf6('0x4')]=function(_0x13b5c1){for(var _0x38d067=0x0,_0x29c5aa=events[_0xacf6('0x5')];_0x38d067<_0x29c5aa;_0x38d067++){var _0x5579cc=events[_0x38d067];var _0x3b4cfb=createListener(_0xacf6('0x6')+_0x5579cc,_0x13b5c1);FaxQueueEvents['on'](_0x5579cc,_0x3b4cfb);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 66a267d..132d898 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 _0x8aad=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x2697dd,_0x55851a){var _0x75f500=function(_0xb846fd){while(--_0xb846fd){_0x2697dd['push'](_0x2697dd['shift']());}};_0x75f500(++_0x55851a);}(_0x8aad,0x146));var _0xd8aa=function(_0x7a1151,_0x5a193d){_0x7a1151=_0x7a1151-0x0;var _0x56e54f=_0x8aad[_0x7a1151];return _0x56e54f;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/describe',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd8aa('0x8')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0x8')]('/:id/teams',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x8')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);router[_0xd8aa('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8aa('0x12')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0x13')]);router[_0xd8aa('0x14')](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller['update']);router[_0xd8aa('0x15')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller[_0xd8aa('0x16')]);router[_0xd8aa('0x15')](_0xd8aa('0x17'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x18')]);router['delete'](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x19')]);module[_0xd8aa('0x1a')]=router; \ No newline at end of file +var _0x7bd0=['fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x583761,_0x119f81){var _0x4b72f0=function(_0x351cad){while(--_0x351cad){_0x583761['push'](_0x583761['shift']());}};_0x4b72f0(++_0x119f81);}(_0x7bd0,0x111));var _0x07bd=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7bd0[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['get'](_0x07bd('0x11'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x12')]);router[_0x07bd('0xa')]('/:id/teams',auth[_0x07bd('0xb')](),controller[_0x07bd('0x13')]);router[_0x07bd('0xa')](_0x07bd('0x14'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x15')]);router[_0x07bd('0x16')]('/',auth[_0x07bd('0xb')](),controller['create']);router['post'](_0x07bd('0x17'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x18')]);router[_0x07bd('0x16')](_0x07bd('0x14'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x19')]);router['put'](_0x07bd('0xf'),auth['isAuthenticated'](),controller[_0x07bd('0x1a')]);router[_0x07bd('0x1b')](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x1c')]);router['delete'](_0x07bd('0x17'),auth[_0x07bd('0xb')](),controller['removeTeams']);router[_0x07bd('0x1b')](_0x07bd('0x14'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x1d')]);module[_0x07bd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0e614fd..57d461d 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 _0xc6a1=['STRING','DATE','moment','sequelize','exports'];(function(_0x179c9d,_0x1e576d){var _0x2195c8=function(_0x1d637c){while(--_0x1d637c){_0x179c9d['push'](_0x179c9d['shift']());}};_0x2195c8(++_0x1e576d);}(_0xc6a1,0xb1));var _0x1c6a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc6a1[_0x3e5086];return _0xfeb102;};'use strict';var moment=require(_0x1c6a('0x0'));var Sequelize=require(_0x1c6a('0x1'));module[_0x1c6a('0x2')]={'uniqueid':{'type':Sequelize[_0x1c6a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1c6a('0x3')]},'joinAt':{'type':Sequelize[_0x1c6a('0x4')]},'leaveAt':{'type':Sequelize[_0x1c6a('0x4')]},'acceptAt':{'type':Sequelize[_0x1c6a('0x4')]},'exitAt':{'type':Sequelize[_0x1c6a('0x4')]},'reason':{'type':Sequelize[_0x1c6a('0x3')]}}; \ No newline at end of file +var _0xdbbc=['STRING','DATE','moment'];(function(_0x472b43,_0x542745){var _0x483774=function(_0x4eb348){while(--_0x4eb348){_0x472b43['push'](_0x472b43['shift']());}};_0x483774(++_0x542745);}(_0xdbbc,0x19d));var _0xcdbb=function(_0x1b88fd,_0x3fc359){_0x1b88fd=_0x1b88fd-0x0;var _0x287cd1=_0xdbbc[_0x1b88fd];return _0x287cd1;};'use strict';var moment=require(_0xcdbb('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcdbb('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xcdbb('0x1')]},'joinAt':{'type':Sequelize[_0xcdbb('0x2')]},'leaveAt':{'type':Sequelize[_0xcdbb('0x2')]},'acceptAt':{'type':Sequelize[_0xcdbb('0x2')]},'exitAt':{'type':Sequelize[_0xcdbb('0x2')]},'reason':{'type':Sequelize[_0xcdbb('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0365934..24564b0 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 _0xb4e6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','end','error','stack','name','index','FaxQueueReport','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4688c6,_0x51fd26){var _0x3dc94a=function(_0x35be21){while(--_0x35be21){_0x4688c6['push'](_0x4688c6['shift']());}};_0x3dc94a(++_0x51fd26);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0xb4e6[_0x179e11];return _0x549f04;};'use strict';var emlformat=require(_0x6b4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b4e('0x1'));var jsonpatch=require(_0x6b4e('0x2'));var rp=require(_0x6b4e('0x3'));var moment=require(_0x6b4e('0x4'));var BPromise=require(_0x6b4e('0x5'));var Mustache=require(_0x6b4e('0x6'));var util=require(_0x6b4e('0x7'));var path=require('path');var sox=require(_0x6b4e('0x8'));var csv=require(_0x6b4e('0x9'));var ejs=require(_0x6b4e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b4e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b4e('0xd'));var Papa=require(_0x6b4e('0xe'));var Redis=require(_0x6b4e('0xf'));var authService=require(_0x6b4e('0x10'));var qs=require(_0x6b4e('0x11'));var as=require(_0x6b4e('0x12'));var hardwareService=require(_0x6b4e('0x13'));var logger=require('../../config/logger')(_0x6b4e('0x14'));var utils=require(_0x6b4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b4e('0x16'));var db=require(_0x6b4e('0x17'))['db'];function respondWithStatusCode(_0x432399,_0x2b2ce0){_0x2b2ce0=_0x2b2ce0||0xcc;return function(_0x9f8f6c){if(_0x9f8f6c){return _0x432399[_0x6b4e('0x18')](_0x2b2ce0);}return _0x432399[_0x6b4e('0x19')](_0x2b2ce0)['end']();};}function respondWithResult(_0x36f8a5,_0x29bdee){_0x29bdee=_0x29bdee||0xc8;return function(_0x4788cf){if(_0x4788cf){return _0x36f8a5[_0x6b4e('0x19')](_0x29bdee)['json'](_0x4788cf);}};}function respondWithFilteredResult(_0x355f10,_0x2195c1){return function(_0x3ba513){if(_0x3ba513){var _0x42e265=typeof _0x2195c1[_0x6b4e('0x1a')]===_0x6b4e('0x1b')&&typeof _0x2195c1['limit']==='undefined';var _0x67496d=_0x3ba513[_0x6b4e('0x1c')];var _0x10d2b1=_0x42e265?0x0:_0x2195c1[_0x6b4e('0x1a')];var _0x101d0a=_0x42e265?_0x3ba513[_0x6b4e('0x1c')]:_0x2195c1[_0x6b4e('0x1a')]+_0x2195c1[_0x6b4e('0x1d')];var _0x35aee1;if(_0x101d0a>=_0x67496d){_0x101d0a=_0x67496d;_0x35aee1=0xc8;}else{_0x35aee1=0xce;}_0x355f10[_0x6b4e('0x19')](_0x35aee1);return _0x355f10[_0x6b4e('0x1e')]('Content-Range',_0x10d2b1+'-'+_0x101d0a+'/'+_0x67496d)[_0x6b4e('0x1f')](_0x3ba513);}return null;};}function patchUpdates(_0x248fea){return function(_0x31fb9d){try{jsonpatch[_0x6b4e('0x20')](_0x31fb9d,_0x248fea,!![]);}catch(_0x5e5dcd){return BPromise[_0x6b4e('0x21')](_0x5e5dcd);}return _0x31fb9d['save']();};}function saveUpdates(_0x2503a5,_0x163dea){return function(_0x165a99){if(_0x165a99){return _0x165a99[_0x6b4e('0x22')](_0x2503a5)[_0x6b4e('0x23')](function(_0x346566){return _0x346566;});}return null;};}function removeEntity(_0x3e636f,_0x5c33be){return function(_0x2e36db){if(_0x2e36db){return _0x2e36db['destroy']()[_0x6b4e('0x23')](function(){_0x3e636f[_0x6b4e('0x19')](0xcc)[_0x6b4e('0x24')]();});}};}function handleEntityNotFound(_0xdba4fe,_0x4ec9cc){return function(_0xec7d35){if(!_0xec7d35){_0xdba4fe[_0x6b4e('0x18')](0x194);}return _0xec7d35;};}function handleError(_0x4e217c,_0x32102f){_0x32102f=_0x32102f||0x1f4;return function(_0x381ff0){logger[_0x6b4e('0x25')](_0x381ff0[_0x6b4e('0x26')]);if(_0x381ff0['name']){delete _0x381ff0[_0x6b4e('0x27')];}_0x4e217c[_0x6b4e('0x19')](_0x32102f)['send'](_0x381ff0);};}exports[_0x6b4e('0x28')]=function(_0x453beb,_0x2f1129){var _0x143de5={},_0x4a6c90={},_0x445278={'count':0x0,'rows':[]};var _0x4007b6=_['map'](db[_0x6b4e('0x29')][_0x6b4e('0x2a')],function(_0x37b636){return{'name':_0x37b636['fieldName'],'type':_0x37b636['type'][_0x6b4e('0x2b')]};});_0x4a6c90[_0x6b4e('0x2c')]=_[_0x6b4e('0x2d')](_0x4007b6,'name');_0x4a6c90[_0x6b4e('0x2e')]=_[_0x6b4e('0x2f')](_0x453beb[_0x6b4e('0x2e')]);_0x4a6c90['filters']=_['intersection'](_0x4a6c90[_0x6b4e('0x2c')],_0x4a6c90['query']);_0x143de5[_0x6b4e('0x30')]=_[_0x6b4e('0x31')](_0x4a6c90['model'],qs[_0x6b4e('0x32')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x32')]));_0x143de5[_0x6b4e('0x30')]=_0x143de5['attributes']['length']?_0x143de5[_0x6b4e('0x30')]:_0x4a6c90[_0x6b4e('0x2c')];if(!_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x33')](_0x6b4e('0x34'))){_0x143de5[_0x6b4e('0x1d')]=qs[_0x6b4e('0x1d')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x1d')]);_0x143de5[_0x6b4e('0x1a')]=qs[_0x6b4e('0x1a')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x1a')]);}_0x143de5['order']=qs[_0x6b4e('0x35')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x35')]);_0x143de5['where']=qs[_0x6b4e('0x36')](_['pick'](_0x453beb[_0x6b4e('0x2e')],_0x4a6c90[_0x6b4e('0x36')]),_0x4007b6);if(_0x453beb[_0x6b4e('0x2e')]['filter']){_0x143de5['where']=_[_0x6b4e('0x37')](_0x143de5[_0x6b4e('0x38')],{'$or':_['map'](_0x4007b6,function(_0x4d61dc){if(_0x4d61dc[_0x6b4e('0x39')]!==_0x6b4e('0x3a')){var _0x303507={};_0x303507[_0x4d61dc[_0x6b4e('0x27')]]={'$like':'%'+_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x3b')]+'%'};return _0x303507;}})});}_0x143de5=_[_0x6b4e('0x37')]({},_0x143de5,_0x453beb[_0x6b4e('0x3c')]);var _0x2faf8d={'where':_0x143de5[_0x6b4e('0x38')]};return db[_0x6b4e('0x29')]['count'](_0x2faf8d)[_0x6b4e('0x23')](function(_0x5516e7){_0x445278['count']=_0x5516e7;if(_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x3d')]){_0x143de5[_0x6b4e('0x3e')]=[{'all':!![]}];}return db[_0x6b4e('0x29')][_0x6b4e('0x3f')](_0x143de5);})['then'](function(_0x4e545c){_0x445278[_0x6b4e('0x40')]=_0x4e545c;return _0x445278;})['then'](respondWithFilteredResult(_0x2f1129,_0x143de5))[_0x6b4e('0x41')](handleError(_0x2f1129,null));};exports[_0x6b4e('0x42')]=function(_0x4d8227,_0xf70c24){var _0x50f0e7={'raw':!![],'where':{'id':_0x4d8227['params']['id']}},_0x3dec0f={};_0x3dec0f[_0x6b4e('0x2c')]=_[_0x6b4e('0x2f')](db[_0x6b4e('0x29')][_0x6b4e('0x2a')]);_0x3dec0f['query']=_[_0x6b4e('0x2f')](_0x4d8227[_0x6b4e('0x2e')]);_0x3dec0f[_0x6b4e('0x36')]=_['intersection'](_0x3dec0f[_0x6b4e('0x2c')],_0x3dec0f[_0x6b4e('0x2e')]);_0x50f0e7[_0x6b4e('0x30')]=_[_0x6b4e('0x31')](_0x3dec0f[_0x6b4e('0x2c')],qs[_0x6b4e('0x32')](_0x4d8227[_0x6b4e('0x2e')][_0x6b4e('0x32')]));_0x50f0e7[_0x6b4e('0x30')]=_0x50f0e7['attributes'][_0x6b4e('0x43')]?_0x50f0e7[_0x6b4e('0x30')]:_0x3dec0f[_0x6b4e('0x2c')];if(_0x4d8227[_0x6b4e('0x2e')][_0x6b4e('0x3d')]){_0x50f0e7['include']=[{'all':!![]}];}_0x50f0e7=_[_0x6b4e('0x37')]({},_0x50f0e7,_0x4d8227['options']);return db[_0x6b4e('0x29')][_0x6b4e('0x44')](_0x50f0e7)[_0x6b4e('0x23')](handleEntityNotFound(_0xf70c24,null))[_0x6b4e('0x23')](respondWithResult(_0xf70c24,null))['catch'](handleError(_0xf70c24,null));};exports[_0x6b4e('0x45')]=function(_0x46467e,_0x1d0eb3){return db['FaxQueueReport'][_0x6b4e('0x45')](_0x46467e[_0x6b4e('0x46')],{})[_0x6b4e('0x23')](respondWithResult(_0x1d0eb3,0xc9))[_0x6b4e('0x41')](handleError(_0x1d0eb3,null));};exports[_0x6b4e('0x22')]=function(_0x33c797,_0x289dfa){if(_0x33c797[_0x6b4e('0x46')]['id']){delete _0x33c797[_0x6b4e('0x46')]['id'];}return db[_0x6b4e('0x29')]['find']({'where':{'id':_0x33c797[_0x6b4e('0x47')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x289dfa,null))[_0x6b4e('0x23')](saveUpdates(_0x33c797['body'],null))[_0x6b4e('0x23')](respondWithResult(_0x289dfa,null))[_0x6b4e('0x41')](handleError(_0x289dfa,null));};exports[_0x6b4e('0x48')]=function(_0x738ee5,_0x73c6be){return db[_0x6b4e('0x29')][_0x6b4e('0x44')]({'where':{'id':_0x738ee5[_0x6b4e('0x47')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x73c6be,null))[_0x6b4e('0x23')](removeEntity(_0x73c6be,null))[_0x6b4e('0x41')](handleError(_0x73c6be,null));};exports['describe']=function(_0x4e183b,_0x2e67cd){return db[_0x6b4e('0x29')][_0x6b4e('0x49')]()[_0x6b4e('0x23')](respondWithResult(_0x2e67cd,null))['catch'](handleError(_0x2e67cd,null));}; \ No newline at end of file +var _0xa25c=['model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type'];(function(_0x13d697,_0x54d7af){var _0x25d4a3=function(_0x563fb1){while(--_0x563fb1){_0x13d697['push'](_0x13d697['shift']());}};_0x25d4a3(++_0x54d7af);}(_0xa25c,0x13f));var _0xca25=function(_0x59566d,_0x3640b7){_0x59566d=_0x59566d-0x0;var _0x139267=_0xa25c[_0x59566d];return _0x139267;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca25('0x0'));var zipdir=require(_0xca25('0x1'));var jsonpatch=require(_0xca25('0x2'));var rp=require(_0xca25('0x3'));var moment=require(_0xca25('0x4'));var BPromise=require(_0xca25('0x5'));var Mustache=require(_0xca25('0x6'));var util=require(_0xca25('0x7'));var path=require('path');var sox=require(_0xca25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca25('0x9'));var _=require('lodash');var squel=require(_0xca25('0xa'));var crypto=require(_0xca25('0xb'));var jsforce=require(_0xca25('0xc'));var deskjs=require(_0xca25('0xd'));var toCsv=require(_0xca25('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca25('0x10'));var as=require(_0xca25('0x11'));var hardwareService=require(_0xca25('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca25('0x13'));var licenseUtil=require(_0xca25('0x14'));var db=require(_0xca25('0x15'))['db'];function respondWithStatusCode(_0x5697aa,_0x534bca){_0x534bca=_0x534bca||0xcc;return function(_0x2a7a97){if(_0x2a7a97){return _0x5697aa['sendStatus'](_0x534bca);}return _0x5697aa[_0xca25('0x16')](_0x534bca)[_0xca25('0x17')]();};}function respondWithResult(_0x35093c,_0x1a3207){_0x1a3207=_0x1a3207||0xc8;return function(_0x307e9e){if(_0x307e9e){return _0x35093c[_0xca25('0x16')](_0x1a3207)[_0xca25('0x18')](_0x307e9e);}};}function respondWithFilteredResult(_0x33aa25,_0x2a1af3){return function(_0x42bc1e){if(_0x42bc1e){var _0x2b5cef=typeof _0x2a1af3['offset']===_0xca25('0x19')&&typeof _0x2a1af3[_0xca25('0x1a')]==='undefined';var _0x411230=_0x42bc1e[_0xca25('0x1b')];var _0x3705a0=_0x2b5cef?0x0:_0x2a1af3[_0xca25('0x1c')];var _0x155cf2=_0x2b5cef?_0x42bc1e['count']:_0x2a1af3[_0xca25('0x1c')]+_0x2a1af3[_0xca25('0x1a')];var _0x143243;if(_0x155cf2>=_0x411230){_0x155cf2=_0x411230;_0x143243=0xc8;}else{_0x143243=0xce;}_0x33aa25[_0xca25('0x16')](_0x143243);return _0x33aa25[_0xca25('0x1d')]('Content-Range',_0x3705a0+'-'+_0x155cf2+'/'+_0x411230)[_0xca25('0x18')](_0x42bc1e);}return null;};}function patchUpdates(_0x3598c7){return function(_0x235d92){try{jsonpatch[_0xca25('0x1e')](_0x235d92,_0x3598c7,!![]);}catch(_0x327719){return BPromise[_0xca25('0x1f')](_0x327719);}return _0x235d92[_0xca25('0x20')]();};}function saveUpdates(_0x54c91a,_0x48fdf5){return function(_0x23f69a){if(_0x23f69a){return _0x23f69a[_0xca25('0x21')](_0x54c91a)[_0xca25('0x22')](function(_0x1596dd){return _0x1596dd;});}return null;};}function removeEntity(_0x2615d4,_0x40e5e2){return function(_0x8cec43){if(_0x8cec43){return _0x8cec43[_0xca25('0x23')]()[_0xca25('0x22')](function(){_0x2615d4[_0xca25('0x16')](0xcc)[_0xca25('0x17')]();});}};}function handleEntityNotFound(_0x20dc6d,_0x4dffad){return function(_0x1aa848){if(!_0x1aa848){_0x20dc6d[_0xca25('0x24')](0x194);}return _0x1aa848;};}function handleError(_0x7ceacb,_0x374cde){_0x374cde=_0x374cde||0x1f4;return function(_0x220546){logger['error'](_0x220546[_0xca25('0x25')]);if(_0x220546[_0xca25('0x26')]){delete _0x220546[_0xca25('0x26')];}_0x7ceacb[_0xca25('0x16')](_0x374cde)[_0xca25('0x27')](_0x220546);};}exports[_0xca25('0x28')]=function(_0xfd888c,_0x1660a5){var _0x3e72cb={},_0x7b67f4={},_0x190f27={'count':0x0,'rows':[]};var _0x315f76=_[_0xca25('0x29')](db[_0xca25('0x2a')][_0xca25('0x2b')],function(_0x2433bb){return{'name':_0x2433bb[_0xca25('0x2c')],'type':_0x2433bb[_0xca25('0x2d')]['key']};});_0x7b67f4[_0xca25('0x2e')]=_[_0xca25('0x29')](_0x315f76,_0xca25('0x26'));_0x7b67f4['query']=_[_0xca25('0x2f')](_0xfd888c[_0xca25('0x30')]);_0x7b67f4[_0xca25('0x31')]=_[_0xca25('0x32')](_0x7b67f4[_0xca25('0x2e')],_0x7b67f4[_0xca25('0x30')]);_0x3e72cb['attributes']=_[_0xca25('0x32')](_0x7b67f4['model'],qs[_0xca25('0x33')](_0xfd888c[_0xca25('0x30')][_0xca25('0x33')]));_0x3e72cb['attributes']=_0x3e72cb[_0xca25('0x34')][_0xca25('0x35')]?_0x3e72cb[_0xca25('0x34')]:_0x7b67f4[_0xca25('0x2e')];if(!_0xfd888c[_0xca25('0x30')]['hasOwnProperty'](_0xca25('0x36'))){_0x3e72cb[_0xca25('0x1a')]=qs[_0xca25('0x1a')](_0xfd888c[_0xca25('0x30')][_0xca25('0x1a')]);_0x3e72cb[_0xca25('0x1c')]=qs[_0xca25('0x1c')](_0xfd888c['query']['offset']);}_0x3e72cb[_0xca25('0x37')]=qs[_0xca25('0x38')](_0xfd888c['query']['sort']);_0x3e72cb[_0xca25('0x39')]=qs[_0xca25('0x31')](_[_0xca25('0x3a')](_0xfd888c['query'],_0x7b67f4[_0xca25('0x31')]),_0x315f76);if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]){_0x3e72cb[_0xca25('0x39')]=_[_0xca25('0x3c')](_0x3e72cb[_0xca25('0x39')],{'$or':_['map'](_0x315f76,function(_0x290537){if(_0x290537['type']!==_0xca25('0x3d')){var _0x25880f={};_0x25880f[_0x290537[_0xca25('0x26')]]={'$like':'%'+_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]+'%'};return _0x25880f;}})});}_0x3e72cb=_[_0xca25('0x3c')]({},_0x3e72cb,_0xfd888c[_0xca25('0x3e')]);var _0x19984f={'where':_0x3e72cb[_0xca25('0x39')]};return db['FaxQueueReport'][_0xca25('0x1b')](_0x19984f)['then'](function(_0x2d6f27){_0x190f27['count']=_0x2d6f27;if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3f')]){_0x3e72cb[_0xca25('0x40')]=[{'all':!![]}];}return db[_0xca25('0x2a')]['findAll'](_0x3e72cb);})[_0xca25('0x22')](function(_0x5aafa5){_0x190f27[_0xca25('0x41')]=_0x5aafa5;return _0x190f27;})[_0xca25('0x22')](respondWithFilteredResult(_0x1660a5,_0x3e72cb))['catch'](handleError(_0x1660a5,null));};exports[_0xca25('0x42')]=function(_0x183135,_0x52799a){var _0x2ff9c2={'raw':!![],'where':{'id':_0x183135[_0xca25('0x43')]['id']}},_0x1068c9={};_0x1068c9[_0xca25('0x2e')]=_['keys'](db[_0xca25('0x2a')][_0xca25('0x2b')]);_0x1068c9['query']=_['keys'](_0x183135['query']);_0x1068c9['filters']=_[_0xca25('0x32')](_0x1068c9[_0xca25('0x2e')],_0x1068c9[_0xca25('0x30')]);_0x2ff9c2[_0xca25('0x34')]=_['intersection'](_0x1068c9[_0xca25('0x2e')],qs[_0xca25('0x33')](_0x183135[_0xca25('0x30')][_0xca25('0x33')]));_0x2ff9c2['attributes']=_0x2ff9c2[_0xca25('0x34')]['length']?_0x2ff9c2[_0xca25('0x34')]:_0x1068c9[_0xca25('0x2e')];if(_0x183135[_0xca25('0x30')][_0xca25('0x3f')]){_0x2ff9c2[_0xca25('0x40')]=[{'all':!![]}];}_0x2ff9c2=_[_0xca25('0x3c')]({},_0x2ff9c2,_0x183135['options']);return db[_0xca25('0x2a')][_0xca25('0x44')](_0x2ff9c2)[_0xca25('0x22')](handleEntityNotFound(_0x52799a,null))[_0xca25('0x22')](respondWithResult(_0x52799a,null))[_0xca25('0x45')](handleError(_0x52799a,null));};exports[_0xca25('0x46')]=function(_0x1ad2d0,_0x352a17){return db[_0xca25('0x2a')][_0xca25('0x46')](_0x1ad2d0[_0xca25('0x47')],{})[_0xca25('0x22')](respondWithResult(_0x352a17,0xc9))[_0xca25('0x45')](handleError(_0x352a17,null));};exports[_0xca25('0x21')]=function(_0x3279e0,_0x1fba32){if(_0x3279e0[_0xca25('0x47')]['id']){delete _0x3279e0[_0xca25('0x47')]['id'];}return db['FaxQueueReport'][_0xca25('0x44')]({'where':{'id':_0x3279e0[_0xca25('0x43')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x1fba32,null))[_0xca25('0x22')](saveUpdates(_0x3279e0['body'],null))[_0xca25('0x22')](respondWithResult(_0x1fba32,null))[_0xca25('0x45')](handleError(_0x1fba32,null));};exports['destroy']=function(_0x2bc528,_0x10692f){return db[_0xca25('0x2a')][_0xca25('0x44')]({'where':{'id':_0x2bc528['params']['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x10692f,null))['then'](removeEntity(_0x10692f,null))[_0xca25('0x45')](handleError(_0x10692f,null));};exports['describe']=function(_0x5c59a1,_0x1a38db){return db[_0xca25('0x2a')][_0xca25('0x48')]()[_0xca25('0x22')](respondWithResult(_0x1a38db,null))['catch'](handleError(_0x1a38db,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 322f11d..f4c6a07 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4dda23,_0x5240d1){var _0x3a90e0=function(_0x4099ff){while(--_0x4099ff){_0x4dda23['push'](_0x4dda23['shift']());}};_0x3a90e0(++_0x5240d1);}(_0x4975,0x86));var _0x5497=function(_0x4cc74f,_0x4b18ee){_0x4cc74f=_0x4cc74f-0x0;var _0x2554a7=_0x4975[_0x4cc74f];return _0x2554a7;};'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'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x4381b0,_0x105b49){var _0x1833d1=function(_0xaeca7c){while(--_0xaeca7c){_0x4381b0['push'](_0x4381b0['shift']());}};_0x1833d1(++_0x105b49);}(_0x326f,0xd1));var _0xf326=function(_0x30d703,_0x24dae4){_0x30d703=_0x30d703-0x0;var _0x427f50=_0x326f[_0x30d703];return _0x427f50;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'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 dcc5c4a..dcf79f5 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 _0xd109=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment'];(function(_0x201715,_0x445f6c){var _0x56008a=function(_0x538d32){while(--_0x538d32){_0x201715['push'](_0x201715['shift']());}};_0x56008a(++_0x445f6c);}(_0xd109,0x19d));var _0x9d10=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd109[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x9d10('0x0'));var util=require(_0x9d10('0x1'));var moment=require(_0x9d10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d10('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d10('0x5'))(_0x9d10('0x6'));var config=require('../../config/environment');var jayson=require(_0x9d10('0x7'));var client=jayson['client'][_0x9d10('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35882d,_0x923de0,_0x3a474c){return new BPromise(function(_0x374fc2,_0x5ae044){return client[_0x9d10('0x9')](_0x35882d,_0x3a474c)[_0x9d10('0xa')](function(_0x2b71b1){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x923de0,_0x9d10('0xb'));logger[_0x9d10('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x923de0,_0x9d10('0xb'),JSON[_0x9d10('0xd')](_0x2b71b1));if(_0x2b71b1[_0x9d10('0xe')]){if(_0x2b71b1['error'][_0x9d10('0xf')]===0x1f4){logger[_0x9d10('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x923de0,_0x2b71b1[_0x9d10('0xe')][_0x9d10('0x10')]);return _0x5ae044(_0x2b71b1['error'][_0x9d10('0x10')]);}logger[_0x9d10('0xe')](_0x9d10('0x11'),_0x923de0,_0x2b71b1[_0x9d10('0xe')][_0x9d10('0x10')]);return _0x374fc2(_0x2b71b1[_0x9d10('0xe')]['message']);}else{logger[_0x9d10('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x923de0,_0x9d10('0xb'));_0x374fc2(_0x2b71b1[_0x9d10('0x13')][_0x9d10('0x10')]);}})[_0x9d10('0x14')](function(_0x34410c){logger['error'](_0x9d10('0x11'),_0x923de0,_0x34410c);_0x5ae044(_0x34410c);});});}exports['CreateFaxQueueReport']=function(_0x41d600){var _0x53f3aa=this;return new Promise(function(_0x2e99c8,_0x3372c6){return db[_0x9d10('0x15')][_0x9d10('0x16')](_0x41d600['body'],{'raw':_0x41d600[_0x9d10('0x17')]?_0x41d600[_0x9d10('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x500c0a){logger[_0x9d10('0x12')](_0x9d10('0x18'),_0x41d600);logger[_0x9d10('0xc')](_0x9d10('0x18'),_0x41d600,JSON['stringify'](_0x500c0a));_0x2e99c8(_0x500c0a);})[_0x9d10('0x14')](function(_0xb0016c){logger['error'](_0x9d10('0x18'),_0xb0016c[_0x9d10('0x10')],_0x41d600);_0x3372c6(_0x53f3aa[_0x9d10('0xe')](0x1f4,_0xb0016c[_0x9d10('0x10')]));});});};exports[_0x9d10('0x19')]=function(_0x403cc2){var _0x358265=this;return new Promise(function(_0x1c435f,_0x44dbf6){return db['FaxQueueReport'][_0x9d10('0x1a')](_0x403cc2[_0x9d10('0x1b')],{'raw':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1d')]||null:null,'attributes':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1e')]||null:null,'limit':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1f')]||null:null})[_0x9d10('0xa')](function(_0x45d8ad){logger[_0x9d10('0x12')](_0x9d10('0x19'),_0x403cc2);logger['debug'](_0x9d10('0x19'),_0x403cc2,JSON[_0x9d10('0xd')](_0x45d8ad));_0x1c435f(_0x45d8ad);})[_0x9d10('0x14')](function(_0x447a27){logger['error'](_0x9d10('0x19'),_0x447a27['message'],_0x403cc2);_0x44dbf6(_0x358265[_0x9d10('0xe')](0x1f4,_0x447a27['message']));});});}; \ No newline at end of file +var _0x772c=['raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','create','body','options'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x772c,0x82));var _0xc772=function(_0x24c7e3,_0x519cfc){_0x24c7e3=_0x24c7e3-0x0;var _0x531590=_0x772c[_0x24c7e3];return _0x531590;};'use strict';var _=require(_0xc772('0x0'));var util=require(_0xc772('0x1'));var moment=require(_0xc772('0x2'));var BPromise=require(_0xc772('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc772('0x4'));var db=require(_0xc772('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc772('0x6'))(_0xc772('0x7'));var config=require(_0xc772('0x8'));var jayson=require(_0xc772('0x9'));var client=jayson[_0xc772('0xa')][_0xc772('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x429346,_0x547f95,_0x2a1f2c){return new BPromise(function(_0x3785a1,_0x3ce7bd){return client['request'](_0x429346,_0x2a1f2c)[_0xc772('0xc')](function(_0x1e7009){logger[_0xc772('0xd')](_0xc772('0xe'),_0x547f95,_0xc772('0xf'));logger[_0xc772('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x547f95,'request\x20sent',JSON[_0xc772('0x11')](_0x1e7009));if(_0x1e7009['error']){if(_0x1e7009[_0xc772('0x12')]['code']===0x1f4){logger[_0xc772('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x547f95,_0x1e7009['error'][_0xc772('0x13')]);return _0x3ce7bd(_0x1e7009[_0xc772('0x12')][_0xc772('0x13')]);}logger[_0xc772('0x12')](_0xc772('0xe'),_0x547f95,_0x1e7009['error'][_0xc772('0x13')]);return _0x3785a1(_0x1e7009[_0xc772('0x12')][_0xc772('0x13')]);}else{logger[_0xc772('0xd')](_0xc772('0xe'),_0x547f95,_0xc772('0xf'));_0x3785a1(_0x1e7009[_0xc772('0x14')][_0xc772('0x13')]);}})[_0xc772('0x15')](function(_0x39cf5a){logger[_0xc772('0x12')](_0xc772('0xe'),_0x547f95,_0x39cf5a);_0x3ce7bd(_0x39cf5a);});});}exports['CreateFaxQueueReport']=function(_0x240db3){var _0x435ea1=this;return new Promise(function(_0x194c95,_0x1e2174){return db['FaxQueueReport'][_0xc772('0x16')](_0x240db3[_0xc772('0x17')],{'raw':_0x240db3[_0xc772('0x18')]?_0x240db3['options'][_0xc772('0x19')]===undefined?!![]:![]:!![]})[_0xc772('0xc')](function(_0x1722b5){logger[_0xc772('0xd')](_0xc772('0x1a'),_0x240db3);logger[_0xc772('0x10')](_0xc772('0x1a'),_0x240db3,JSON['stringify'](_0x1722b5));_0x194c95(_0x1722b5);})[_0xc772('0x15')](function(_0x482570){logger[_0xc772('0x12')]('CreateFaxQueueReport',_0x482570[_0xc772('0x13')],_0x240db3);_0x1e2174(_0x435ea1['error'](0x1f4,_0x482570['message']));});});};exports[_0xc772('0x1b')]=function(_0x172ce1){var _0x489e55=this;return new Promise(function(_0xec5a3c,_0x110185){return db[_0xc772('0x1c')]['update'](_0x172ce1[_0xc772('0x17')],{'raw':_0x172ce1[_0xc772('0x18')]?_0x172ce1[_0xc772('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172ce1[_0xc772('0x18')]?_0x172ce1['options'][_0xc772('0x1d')]||null:null,'attributes':_0x172ce1['options']?_0x172ce1[_0xc772('0x18')]['attributes']||null:null,'limit':_0x172ce1[_0xc772('0x18')]?_0x172ce1['options'][_0xc772('0x1e')]||null:null})[_0xc772('0xc')](function(_0x3c6c7d){logger[_0xc772('0xd')](_0xc772('0x1b'),_0x172ce1);logger['debug'](_0xc772('0x1b'),_0x172ce1,JSON[_0xc772('0x11')](_0x3c6c7d));_0xec5a3c(_0x3c6c7d);})[_0xc772('0x15')](function(_0x4d3325){logger['error']('UpdateFaxQueueReport',_0x4d3325[_0xc772('0x13')],_0x172ce1);_0x110185(_0x489e55[_0xc772('0x12')](0x1f4,_0x4d3325[_0xc772('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b777568..b2bf4ca 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 _0x1858=['post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x2ce596,_0x10313b){var _0x2e65a4=function(_0x2f6e17){while(--_0x2f6e17){_0x2ce596['push'](_0x2ce596['shift']());}};_0x2e65a4(++_0x10313b);}(_0x1858,0x1e8));var _0x8185=function(_0x45e3ce,_0x416ceb){_0x45e3ce=_0x45e3ce-0x0;var _0xef3d06=_0x1858[_0x45e3ce];return _0xef3d06;};'use strict';var multer=require(_0x8185('0x0'));var util=require(_0x8185('0x1'));var path=require(_0x8185('0x2'));var timeout=require(_0x8185('0x3'));var express=require(_0x8185('0x4'));var router=express[_0x8185('0x5')]();var fs_extra=require(_0x8185('0x6'));var auth=require(_0x8185('0x7'));var interaction=require(_0x8185('0x8'));var config=require(_0x8185('0x9'));var controller=require(_0x8185('0xa'));router[_0x8185('0xb')]('/',auth[_0x8185('0xc')](),controller['index']);router[_0x8185('0xb')]('/describe',auth[_0x8185('0xc')](),controller[_0x8185('0xd')]);router[_0x8185('0xb')](_0x8185('0xe'),auth[_0x8185('0xc')](),controller[_0x8185('0xf')]);router[_0x8185('0x10')]('/',auth[_0x8185('0xc')](),controller[_0x8185('0x11')]);router['put'](_0x8185('0xe'),auth[_0x8185('0xc')](),controller[_0x8185('0x12')]);router['delete'](_0x8185('0xe'),auth[_0x8185('0xc')](),controller[_0x8185('0x13')]);module[_0x8185('0x14')]=router; \ No newline at end of file +var _0x0397=['post','create','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./faxQueueReport.controller','isAuthenticated','index','get','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0397,0x137));var _0x7039=function(_0x1f2dda,_0x539c5f){_0x1f2dda=_0x1f2dda-0x0;var _0x29b49e=_0x0397[_0x1f2dda];return _0x29b49e;};'use strict';var multer=require(_0x7039('0x0'));var util=require(_0x7039('0x1'));var path=require(_0x7039('0x2'));var timeout=require(_0x7039('0x3'));var express=require(_0x7039('0x4'));var router=express[_0x7039('0x5')]();var fs_extra=require(_0x7039('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7039('0x7'));router['get']('/',auth[_0x7039('0x8')](),controller[_0x7039('0x9')]);router[_0x7039('0xa')]('/describe',auth[_0x7039('0x8')](),controller['describe']);router[_0x7039('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7039('0xb')]);router[_0x7039('0xc')]('/',auth[_0x7039('0x8')](),controller[_0x7039('0xd')]);router['put'](_0x7039('0xe'),auth[_0x7039('0x8')](),controller['update']);router['delete']('/:id',auth[_0x7039('0x8')](),controller[_0x7039('0xf')]);module[_0x7039('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 805a519..d8d4f69 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(_0x5c31dc,_0x4a598f){var _0x2f48c2=function(_0x182653){while(--_0x182653){_0x5c31dc['push'](_0x5c31dc['shift']());}};_0x2f48c2(++_0x4a598f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xf3cd[_0x17784a];return _0x41aded;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x59ee77,_0x2a8d58){_0x59ee77=_0x59ee77-0x0;var _0xe8136=_0xb43b[_0x59ee77];return _0xe8136;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 09ee953..c7db734 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 _0xf19c=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','error','name','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','rawAttributes','include','find','create','body','catch','update','params','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0xf19c,0x11b));var _0xcf19=function(_0x409ed5,_0x1fad5f){_0x409ed5=_0x409ed5-0x0;var _0x3de2c5=_0xf19c[_0x409ed5];return _0x3de2c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcf19('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf19('0x1'));var moment=require(_0xcf19('0x2'));var BPromise=require(_0xcf19('0x3'));var Mustache=require(_0xcf19('0x4'));var util=require(_0xcf19('0x5'));var path=require(_0xcf19('0x6'));var sox=require(_0xcf19('0x7'));var csv=require(_0xcf19('0x8'));var ejs=require(_0xcf19('0x9'));var fs=require('fs');var fs_extra=require(_0xcf19('0xa'));var _=require(_0xcf19('0xb'));var squel=require(_0xcf19('0xc'));var crypto=require('crypto');var jsforce=require(_0xcf19('0xd'));var deskjs=require(_0xcf19('0xe'));var toCsv=require(_0xcf19('0x8'));var querystring=require(_0xcf19('0xf'));var Papa=require(_0xcf19('0x10'));var Redis=require(_0xcf19('0x11'));var authService=require(_0xcf19('0x12'));var qs=require(_0xcf19('0x13'));var as=require(_0xcf19('0x14'));var hardwareService=require(_0xcf19('0x15'));var logger=require(_0xcf19('0x16'))('api');var utils=require(_0xcf19('0x17'));var config=require(_0xcf19('0x18'));var licenseUtil=require(_0xcf19('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc108b0,_0x2a9d9a){_0x2a9d9a=_0x2a9d9a||0xcc;return function(_0x3bc40f){if(_0x3bc40f){return _0xc108b0['sendStatus'](_0x2a9d9a);}return _0xc108b0['status'](_0x2a9d9a)[_0xcf19('0x1a')]();};}function respondWithResult(_0x82d6c7,_0xca3e2c){_0xca3e2c=_0xca3e2c||0xc8;return function(_0x57fec5){if(_0x57fec5){return _0x82d6c7[_0xcf19('0x1b')](_0xca3e2c)['json'](_0x57fec5);}};}function respondWithFilteredResult(_0x3ce77c,_0x5adf2f){return function(_0x4ff469){if(_0x4ff469){var _0x169f04=typeof _0x5adf2f['offset']===_0xcf19('0x1c')&&typeof _0x5adf2f[_0xcf19('0x1d')]===_0xcf19('0x1c');var _0x47d474=_0x4ff469[_0xcf19('0x1e')];var _0x42769c=_0x169f04?0x0:_0x5adf2f[_0xcf19('0x1f')];var _0x325918=_0x169f04?_0x4ff469[_0xcf19('0x1e')]:_0x5adf2f[_0xcf19('0x1f')]+_0x5adf2f[_0xcf19('0x1d')];var _0x2fcd14;if(_0x325918>=_0x47d474){_0x325918=_0x47d474;_0x2fcd14=0xc8;}else{_0x2fcd14=0xce;}_0x3ce77c[_0xcf19('0x1b')](_0x2fcd14);return _0x3ce77c[_0xcf19('0x20')](_0xcf19('0x21'),_0x42769c+'-'+_0x325918+'/'+_0x47d474)[_0xcf19('0x22')](_0x4ff469);}return null;};}function patchUpdates(_0x21cfd0){return function(_0x5eed59){try{jsonpatch[_0xcf19('0x23')](_0x5eed59,_0x21cfd0,!![]);}catch(_0x272988){return BPromise['reject'](_0x272988);}return _0x5eed59[_0xcf19('0x24')]();};}function saveUpdates(_0x1209be,_0xa43e69){return function(_0x324f9c){if(_0x324f9c){return _0x324f9c['update'](_0x1209be)[_0xcf19('0x25')](function(_0x43bb81){return _0x43bb81;});}return null;};}function removeEntity(_0x339bfe,_0x47fc66){return function(_0x4acce0){if(_0x4acce0){return _0x4acce0[_0xcf19('0x26')]()[_0xcf19('0x25')](function(){_0x339bfe['status'](0xcc)[_0xcf19('0x1a')]();});}};}function handleEntityNotFound(_0x158ed8,_0x9c5efc){return function(_0x158ff4){if(!_0x158ff4){_0x158ed8['sendStatus'](0x194);}return _0x158ff4;};}function handleError(_0x32af40,_0x5d9043){_0x5d9043=_0x5d9043||0x1f4;return function(_0x316810){logger[_0xcf19('0x27')](_0x316810['stack']);if(_0x316810['name']){delete _0x316810[_0xcf19('0x28')];}_0x32af40[_0xcf19('0x1b')](_0x5d9043)['send'](_0x316810);};}exports[_0xcf19('0x29')]=function(_0x5ea79a,_0x33d892){var _0x1daec7={},_0x4d6b4b={},_0x3f0b03={'count':0x0,'rows':[]};var _0x24452f=_[_0xcf19('0x2a')](db[_0xcf19('0x2b')]['rawAttributes'],function(_0x46003f){return{'name':_0x46003f[_0xcf19('0x2c')],'type':_0x46003f[_0xcf19('0x2d')][_0xcf19('0x2e')]};});_0x4d6b4b[_0xcf19('0x2f')]=_['map'](_0x24452f,_0xcf19('0x28'));_0x4d6b4b[_0xcf19('0x30')]=_[_0xcf19('0x31')](_0x5ea79a[_0xcf19('0x30')]);_0x4d6b4b[_0xcf19('0x32')]=_[_0xcf19('0x33')](_0x4d6b4b[_0xcf19('0x2f')],_0x4d6b4b[_0xcf19('0x30')]);_0x1daec7[_0xcf19('0x34')]=_[_0xcf19('0x33')](_0x4d6b4b[_0xcf19('0x2f')],qs[_0xcf19('0x35')](_0x5ea79a['query']['fields']));_0x1daec7['attributes']=_0x1daec7['attributes'][_0xcf19('0x36')]?_0x1daec7[_0xcf19('0x34')]:_0x4d6b4b[_0xcf19('0x2f')];if(!_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x37')](_0xcf19('0x38'))){_0x1daec7[_0xcf19('0x1d')]=qs['limit'](_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x1d')]);_0x1daec7[_0xcf19('0x1f')]=qs[_0xcf19('0x1f')](_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x1f')]);}_0x1daec7[_0xcf19('0x39')]=qs[_0xcf19('0x3a')](_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x3a')]);_0x1daec7[_0xcf19('0x3b')]=qs[_0xcf19('0x32')](_[_0xcf19('0x3c')](_0x5ea79a[_0xcf19('0x30')],_0x4d6b4b[_0xcf19('0x32')]),_0x24452f);if(_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x3d')]){_0x1daec7['where']=_[_0xcf19('0x3e')](_0x1daec7[_0xcf19('0x3b')],{'$or':_[_0xcf19('0x2a')](_0x24452f,function(_0x47de15){if(_0x47de15[_0xcf19('0x2d')]!=='VIRTUAL'){var _0x1c9449={};_0x1c9449[_0x47de15[_0xcf19('0x28')]]={'$like':'%'+_0x5ea79a['query']['filter']+'%'};return _0x1c9449;}})});}_0x1daec7=_[_0xcf19('0x3e')]({},_0x1daec7,_0x5ea79a[_0xcf19('0x3f')]);var _0x3639a1={'where':_0x1daec7[_0xcf19('0x3b')]};return db[_0xcf19('0x2b')]['count'](_0x3639a1)['then'](function(_0x363aaf){_0x3f0b03[_0xcf19('0x1e')]=_0x363aaf;if(_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x40')]){_0x1daec7['include']=[{'all':!![]}];}return db[_0xcf19('0x2b')][_0xcf19('0x41')](_0x1daec7);})[_0xcf19('0x25')](function(_0xf35942){_0x3f0b03[_0xcf19('0x42')]=_0xf35942;return _0x3f0b03;})['then'](respondWithFilteredResult(_0x33d892,_0x1daec7))['catch'](handleError(_0x33d892,null));};exports['show']=function(_0x3ed15a,_0xb51718){var _0x99f65a={'raw':!![],'where':{'id':_0x3ed15a['params']['id']}},_0x175d8f={};_0x175d8f['model']=_[_0xcf19('0x31')](db[_0xcf19('0x2b')][_0xcf19('0x43')]);_0x175d8f['query']=_[_0xcf19('0x31')](_0x3ed15a[_0xcf19('0x30')]);_0x175d8f[_0xcf19('0x32')]=_[_0xcf19('0x33')](_0x175d8f[_0xcf19('0x2f')],_0x175d8f[_0xcf19('0x30')]);_0x99f65a[_0xcf19('0x34')]=_['intersection'](_0x175d8f['model'],qs['fields'](_0x3ed15a[_0xcf19('0x30')]['fields']));_0x99f65a[_0xcf19('0x34')]=_0x99f65a['attributes'][_0xcf19('0x36')]?_0x99f65a['attributes']:_0x175d8f[_0xcf19('0x2f')];if(_0x3ed15a['query'][_0xcf19('0x40')]){_0x99f65a[_0xcf19('0x44')]=[{'all':!![]}];}_0x99f65a=_[_0xcf19('0x3e')]({},_0x99f65a,_0x3ed15a['options']);return db[_0xcf19('0x2b')][_0xcf19('0x45')](_0x99f65a)['then'](handleEntityNotFound(_0xb51718,null))[_0xcf19('0x25')](respondWithResult(_0xb51718,null))['catch'](handleError(_0xb51718,null));};exports['create']=function(_0x5114eb,_0x1c8d18){return db['FaxTransferReport'][_0xcf19('0x46')](_0x5114eb[_0xcf19('0x47')],{})[_0xcf19('0x25')](respondWithResult(_0x1c8d18,0xc9))[_0xcf19('0x48')](handleError(_0x1c8d18,null));};exports[_0xcf19('0x49')]=function(_0x25a55a,_0x11e8c1){if(_0x25a55a['body']['id']){delete _0x25a55a[_0xcf19('0x47')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x25a55a[_0xcf19('0x4a')]['id']}})[_0xcf19('0x25')](handleEntityNotFound(_0x11e8c1,null))[_0xcf19('0x25')](saveUpdates(_0x25a55a[_0xcf19('0x47')],null))[_0xcf19('0x25')](respondWithResult(_0x11e8c1,null))[_0xcf19('0x48')](handleError(_0x11e8c1,null));};exports[_0xcf19('0x26')]=function(_0x2b3488,_0x4ffa57){return db[_0xcf19('0x2b')][_0xcf19('0x45')]({'where':{'id':_0x2b3488[_0xcf19('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ffa57,null))[_0xcf19('0x25')](removeEntity(_0x4ffa57,null))[_0xcf19('0x48')](handleError(_0x4ffa57,null));};exports['describe']=function(_0x45b6c9,_0x7e90af){return db['FaxTransferReport'][_0xcf19('0x4b')]()[_0xcf19('0x25')](respondWithResult(_0x7e90af,null))[_0xcf19('0x48')](handleError(_0x7e90af,null));}; \ No newline at end of file +var _0x1988=['count','set','reject','save','update','then','destroy','end','error','name','send','index','map','FaxTransferReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','status','json','offset','limit','undefined'];(function(_0x3bedc3,_0x2bf958){var _0x2a3c69=function(_0x2d24f9){while(--_0x2d24f9){_0x3bedc3['push'](_0x3bedc3['shift']());}};_0x2a3c69(++_0x2bf958);}(_0x1988,0x1b6));var _0x8198=function(_0x3ce15d,_0x11ca28){_0x3ce15d=_0x3ce15d-0x0;var _0x3f62d0=_0x1988[_0x3ce15d];return _0x3f62d0;};'use strict';var emlformat=require(_0x8198('0x0'));var rimraf=require(_0x8198('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8198('0x2'));var rp=require(_0x8198('0x3'));var moment=require(_0x8198('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8198('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8198('0x6'));var fs=require('fs');var fs_extra=require(_0x8198('0x7'));var _=require(_0x8198('0x8'));var squel=require(_0x8198('0x9'));var crypto=require(_0x8198('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8198('0xb'));var querystring=require(_0x8198('0xc'));var Papa=require('papaparse');var Redis=require(_0x8198('0xd'));var authService=require(_0x8198('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8198('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8198('0x10'))(_0x8198('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8198('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58e1a3,_0x642d58){_0x642d58=_0x642d58||0xcc;return function(_0x2fbb1d){if(_0x2fbb1d){return _0x58e1a3['sendStatus'](_0x642d58);}return _0x58e1a3[_0x8198('0x13')](_0x642d58)['end']();};}function respondWithResult(_0x56f7bc,_0x54403a){_0x54403a=_0x54403a||0xc8;return function(_0x16fd9d){if(_0x16fd9d){return _0x56f7bc['status'](_0x54403a)[_0x8198('0x14')](_0x16fd9d);}};}function respondWithFilteredResult(_0x19b552,_0x1c8dd2){return function(_0x4db5f4){if(_0x4db5f4){var _0x394d49=typeof _0x1c8dd2[_0x8198('0x15')]==='undefined'&&typeof _0x1c8dd2[_0x8198('0x16')]===_0x8198('0x17');var _0x1ec899=_0x4db5f4[_0x8198('0x18')];var _0x5bd02e=_0x394d49?0x0:_0x1c8dd2[_0x8198('0x15')];var _0x100e53=_0x394d49?_0x4db5f4[_0x8198('0x18')]:_0x1c8dd2[_0x8198('0x15')]+_0x1c8dd2['limit'];var _0x49a374;if(_0x100e53>=_0x1ec899){_0x100e53=_0x1ec899;_0x49a374=0xc8;}else{_0x49a374=0xce;}_0x19b552[_0x8198('0x13')](_0x49a374);return _0x19b552[_0x8198('0x19')]('Content-Range',_0x5bd02e+'-'+_0x100e53+'/'+_0x1ec899)[_0x8198('0x14')](_0x4db5f4);}return null;};}function patchUpdates(_0x316995){return function(_0x2176d3){try{jsonpatch['apply'](_0x2176d3,_0x316995,!![]);}catch(_0x477e4b){return BPromise[_0x8198('0x1a')](_0x477e4b);}return _0x2176d3[_0x8198('0x1b')]();};}function saveUpdates(_0x53010b,_0x404fe7){return function(_0x441bd3){if(_0x441bd3){return _0x441bd3[_0x8198('0x1c')](_0x53010b)[_0x8198('0x1d')](function(_0xd84bf6){return _0xd84bf6;});}return null;};}function removeEntity(_0x591fc5,_0x228ab4){return function(_0xf3642c){if(_0xf3642c){return _0xf3642c[_0x8198('0x1e')]()[_0x8198('0x1d')](function(){_0x591fc5[_0x8198('0x13')](0xcc)[_0x8198('0x1f')]();});}};}function handleEntityNotFound(_0x471b39,_0x27a5ef){return function(_0x5164c3){if(!_0x5164c3){_0x471b39['sendStatus'](0x194);}return _0x5164c3;};}function handleError(_0xd31887,_0x54f293){_0x54f293=_0x54f293||0x1f4;return function(_0x51a023){logger[_0x8198('0x20')](_0x51a023['stack']);if(_0x51a023[_0x8198('0x21')]){delete _0x51a023['name'];}_0xd31887[_0x8198('0x13')](_0x54f293)[_0x8198('0x22')](_0x51a023);};}exports[_0x8198('0x23')]=function(_0xce7fda,_0x2b2826){var _0x3ae830={},_0x5dc5ae={},_0x367953={'count':0x0,'rows':[]};var _0x2acb2d=_[_0x8198('0x24')](db[_0x8198('0x25')]['rawAttributes'],function(_0x304be8){return{'name':_0x304be8[_0x8198('0x26')],'type':_0x304be8['type'][_0x8198('0x27')]};});_0x5dc5ae[_0x8198('0x28')]=_['map'](_0x2acb2d,'name');_0x5dc5ae[_0x8198('0x29')]=_[_0x8198('0x2a')](_0xce7fda[_0x8198('0x29')]);_0x5dc5ae[_0x8198('0x2b')]=_['intersection'](_0x5dc5ae[_0x8198('0x28')],_0x5dc5ae[_0x8198('0x29')]);_0x3ae830[_0x8198('0x2c')]=_[_0x8198('0x2d')](_0x5dc5ae['model'],qs[_0x8198('0x2e')](_0xce7fda[_0x8198('0x29')][_0x8198('0x2e')]));_0x3ae830[_0x8198('0x2c')]=_0x3ae830['attributes'][_0x8198('0x2f')]?_0x3ae830[_0x8198('0x2c')]:_0x5dc5ae[_0x8198('0x28')];if(!_0xce7fda[_0x8198('0x29')]['hasOwnProperty'](_0x8198('0x30'))){_0x3ae830[_0x8198('0x16')]=qs[_0x8198('0x16')](_0xce7fda[_0x8198('0x29')][_0x8198('0x16')]);_0x3ae830[_0x8198('0x15')]=qs[_0x8198('0x15')](_0xce7fda[_0x8198('0x29')][_0x8198('0x15')]);}_0x3ae830['order']=qs[_0x8198('0x31')](_0xce7fda[_0x8198('0x29')]['sort']);_0x3ae830[_0x8198('0x32')]=qs[_0x8198('0x2b')](_[_0x8198('0x33')](_0xce7fda[_0x8198('0x29')],_0x5dc5ae[_0x8198('0x2b')]),_0x2acb2d);if(_0xce7fda['query']['filter']){_0x3ae830[_0x8198('0x32')]=_[_0x8198('0x34')](_0x3ae830[_0x8198('0x32')],{'$or':_[_0x8198('0x24')](_0x2acb2d,function(_0x6bd228){if(_0x6bd228['type']!=='VIRTUAL'){var _0xe45bfc={};_0xe45bfc[_0x6bd228[_0x8198('0x21')]]={'$like':'%'+_0xce7fda[_0x8198('0x29')][_0x8198('0x35')]+'%'};return _0xe45bfc;}})});}_0x3ae830=_[_0x8198('0x34')]({},_0x3ae830,_0xce7fda[_0x8198('0x36')]);var _0x47b834={'where':_0x3ae830[_0x8198('0x32')]};return db['FaxTransferReport'][_0x8198('0x18')](_0x47b834)['then'](function(_0x2b5186){_0x367953[_0x8198('0x18')]=_0x2b5186;if(_0xce7fda['query'][_0x8198('0x37')]){_0x3ae830[_0x8198('0x38')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x8198('0x39')](_0x3ae830);})[_0x8198('0x1d')](function(_0x3db360){_0x367953[_0x8198('0x3a')]=_0x3db360;return _0x367953;})['then'](respondWithFilteredResult(_0x2b2826,_0x3ae830))['catch'](handleError(_0x2b2826,null));};exports[_0x8198('0x3b')]=function(_0x272d2b,_0x2bca86){var _0x1e25b9={'raw':!![],'where':{'id':_0x272d2b[_0x8198('0x3c')]['id']}},_0x1df43c={};_0x1df43c[_0x8198('0x28')]=_['keys'](db[_0x8198('0x25')][_0x8198('0x3d')]);_0x1df43c[_0x8198('0x29')]=_[_0x8198('0x2a')](_0x272d2b[_0x8198('0x29')]);_0x1df43c[_0x8198('0x2b')]=_['intersection'](_0x1df43c[_0x8198('0x28')],_0x1df43c[_0x8198('0x29')]);_0x1e25b9['attributes']=_[_0x8198('0x2d')](_0x1df43c[_0x8198('0x28')],qs[_0x8198('0x2e')](_0x272d2b[_0x8198('0x29')][_0x8198('0x2e')]));_0x1e25b9[_0x8198('0x2c')]=_0x1e25b9[_0x8198('0x2c')][_0x8198('0x2f')]?_0x1e25b9[_0x8198('0x2c')]:_0x1df43c[_0x8198('0x28')];if(_0x272d2b[_0x8198('0x29')][_0x8198('0x37')]){_0x1e25b9['include']=[{'all':!![]}];}_0x1e25b9=_[_0x8198('0x34')]({},_0x1e25b9,_0x272d2b[_0x8198('0x36')]);return db[_0x8198('0x25')][_0x8198('0x3e')](_0x1e25b9)[_0x8198('0x1d')](handleEntityNotFound(_0x2bca86,null))[_0x8198('0x1d')](respondWithResult(_0x2bca86,null))[_0x8198('0x3f')](handleError(_0x2bca86,null));};exports[_0x8198('0x40')]=function(_0x4ede1f,_0x12fedf){return db[_0x8198('0x25')]['create'](_0x4ede1f['body'],{})['then'](respondWithResult(_0x12fedf,0xc9))[_0x8198('0x3f')](handleError(_0x12fedf,null));};exports[_0x8198('0x1c')]=function(_0x4674cc,_0x300947){if(_0x4674cc[_0x8198('0x41')]['id']){delete _0x4674cc[_0x8198('0x41')]['id'];}return db['FaxTransferReport'][_0x8198('0x3e')]({'where':{'id':_0x4674cc[_0x8198('0x3c')]['id']}})[_0x8198('0x1d')](handleEntityNotFound(_0x300947,null))['then'](saveUpdates(_0x4674cc[_0x8198('0x41')],null))[_0x8198('0x1d')](respondWithResult(_0x300947,null))[_0x8198('0x3f')](handleError(_0x300947,null));};exports['destroy']=function(_0x43fc7f,_0x22f4aa){return db[_0x8198('0x25')][_0x8198('0x3e')]({'where':{'id':_0x43fc7f[_0x8198('0x3c')]['id']}})[_0x8198('0x1d')](handleEntityNotFound(_0x22f4aa,null))[_0x8198('0x1d')](removeEntity(_0x22f4aa,null))[_0x8198('0x3f')](handleError(_0x22f4aa,null));};exports['describe']=function(_0x12bd15,_0x24cdf7){return db[_0x8198('0x25')]['describe']()['then'](respondWithResult(_0x24cdf7,null))['catch'](handleError(_0x24cdf7,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 28b2f39..9feb4d3 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 _0x6918=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6918,0xc8));var _0x8691=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6918[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x8691('0x0'));var logger=require(_0x8691('0x1'))(_0x8691('0x2'));var moment=require(_0x8691('0x3'));var BPromise=require(_0x8691('0x4'));var rp=require(_0x8691('0x5'));var fs=require('fs');var path=require(_0x8691('0x6'));var rimraf=require(_0x8691('0x7'));var config=require(_0x8691('0x8'));var attributes=require(_0x8691('0x9'));module[_0x8691('0xa')]=function(_0x49a440,_0x4a5f14){return _0x49a440[_0x8691('0xb')](_0x8691('0xc'),attributes,{'tableName':_0x8691('0xd'),'paranoid':![],'indexes':[{'name':_0x8691('0xe'),'fields':[_0x8691('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd84=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','FaxTransferReport','report_fax_transfer'];(function(_0x2e0732,_0x532f3b){var _0x5d6915=function(_0x21e64e){while(--_0x21e64e){_0x2e0732['push'](_0x2e0732['shift']());}};_0x5d6915(++_0x532f3b);}(_0xbd84,0xb5));var _0x4bd8=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xbd84[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x4bd8('0x0'));var logger=require(_0x4bd8('0x1'))(_0x4bd8('0x2'));var moment=require(_0x4bd8('0x3'));var BPromise=require(_0x4bd8('0x4'));var rp=require(_0x4bd8('0x5'));var fs=require('fs');var path=require(_0x4bd8('0x6'));var rimraf=require(_0x4bd8('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x4bd8('0x8')]=function(_0x4f9ce5,_0x348940){return _0x4f9ce5['define'](_0x4bd8('0x9'),attributes,{'tableName':_0x4bd8('0xa'),'paranoid':![],'indexes':[{'name':_0x4bd8('0xb'),'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 765b673..009d235 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 _0x818c=['../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x15c623,_0x2a2355){var _0x44a7fe=function(_0x1e5172){while(--_0x1e5172){_0x15c623['push'](_0x15c623['shift']());}};_0x44a7fe(++_0x2a2355);}(_0x818c,0x14e));var _0xc818=function(_0xb7eab8,_0x2dac09){_0xb7eab8=_0xb7eab8-0x0;var _0x29b77b=_0x818c[_0xb7eab8];return _0x29b77b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc818('0x0'));var BPromise=require(_0xc818('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc818('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc818('0x3'));var logger=require(_0xc818('0x4'))(_0xc818('0x5'));var config=require(_0xc818('0x6'));var jayson=require(_0xc818('0x7'));var client=jayson[_0xc818('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x362cc7,_0x14ff59,_0x8cc82c){return new BPromise(function(_0x1415c7,_0x53b678){return client[_0xc818('0x9')](_0x362cc7,_0x8cc82c)[_0xc818('0xa')](function(_0x29985e){logger[_0xc818('0xb')](_0xc818('0xc'),_0x14ff59,_0xc818('0xd'));logger[_0xc818('0xe')](_0xc818('0xf'),_0x14ff59,'request\x20sent',JSON['stringify'](_0x29985e));if(_0x29985e[_0xc818('0x10')]){if(_0x29985e['error'][_0xc818('0x11')]===0x1f4){logger[_0xc818('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x14ff59,_0x29985e['error'][_0xc818('0x12')]);return _0x53b678(_0x29985e['error']['message']);}logger[_0xc818('0x10')](_0xc818('0xc'),_0x14ff59,_0x29985e[_0xc818('0x10')][_0xc818('0x12')]);return _0x1415c7(_0x29985e[_0xc818('0x10')][_0xc818('0x12')]);}else{logger['info'](_0xc818('0xc'),_0x14ff59,_0xc818('0xd'));_0x1415c7(_0x29985e['result'][_0xc818('0x12')]);}})[_0xc818('0x13')](function(_0x27f227){logger[_0xc818('0x10')](_0xc818('0xc'),_0x14ff59,_0x27f227);_0x53b678(_0x27f227);});});} \ No newline at end of file +var _0x23ae=['code','message','result','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x387897,_0x5c0aa6){var _0x2760f1=function(_0x586b69){while(--_0x586b69){_0x387897['push'](_0x387897['shift']());}};_0x2760f1(++_0x5c0aa6);}(_0x23ae,0x10d));var _0xe23a=function(_0x356596,_0x1a1a8c){_0x356596=_0x356596-0x0;var _0x231fa9=_0x23ae[_0x356596];return _0x231fa9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe23a('0x0'));var BPromise=require(_0xe23a('0x1'));var rs=require(_0xe23a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe23a('0x3'));var logger=require(_0xe23a('0x4'))('rpc');var config=require(_0xe23a('0x5'));var jayson=require(_0xe23a('0x6'));var client=jayson['client'][_0xe23a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3664af,_0x3a0749,_0x5d6402){return new BPromise(function(_0x26f7dc,_0x2e3d61){return client[_0xe23a('0x8')](_0x3664af,_0x5d6402)[_0xe23a('0x9')](function(_0x17c781){logger[_0xe23a('0xa')](_0xe23a('0xb'),_0x3a0749,'request\x20sent');logger['debug'](_0xe23a('0xc'),_0x3a0749,_0xe23a('0xd'),JSON[_0xe23a('0xe')](_0x17c781));if(_0x17c781[_0xe23a('0xf')]){if(_0x17c781[_0xe23a('0xf')][_0xe23a('0x10')]===0x1f4){logger[_0xe23a('0xf')](_0xe23a('0xb'),_0x3a0749,_0x17c781[_0xe23a('0xf')][_0xe23a('0x11')]);return _0x2e3d61(_0x17c781[_0xe23a('0xf')][_0xe23a('0x11')]);}logger[_0xe23a('0xf')](_0xe23a('0xb'),_0x3a0749,_0x17c781[_0xe23a('0xf')][_0xe23a('0x11')]);return _0x26f7dc(_0x17c781[_0xe23a('0xf')]['message']);}else{logger[_0xe23a('0xa')](_0xe23a('0xb'),_0x3a0749,_0xe23a('0xd'));_0x26f7dc(_0x17c781[_0xe23a('0x12')]['message']);}})['catch'](function(_0x3d8574){logger[_0xe23a('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3a0749,_0x3d8574);_0x2e3d61(_0x3d8574);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 326cd20..fbaa9df 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 _0xe79d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x59f812,_0x8dd430){var _0x1e1e63=function(_0x4d3de9){while(--_0x4d3de9){_0x59f812['push'](_0x59f812['shift']());}};_0x1e1e63(++_0x8dd430);}(_0xe79d,0x111));var _0xde79=function(_0x3bf873,_0x9afb55){_0x3bf873=_0x3bf873-0x0;var _0x1283e3=_0xe79d[_0x3bf873];return _0x1283e3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde79('0x0'));var timeout=require(_0xde79('0x1'));var express=require(_0xde79('0x2'));var router=express[_0xde79('0x3')]();var fs_extra=require(_0xde79('0x4'));var auth=require(_0xde79('0x5'));var interaction=require(_0xde79('0x6'));var config=require(_0xde79('0x7'));var controller=require('./faxTransferReport.controller');router[_0xde79('0x8')]('/',auth[_0xde79('0x9')](),controller[_0xde79('0xa')]);router[_0xde79('0x8')](_0xde79('0xb'),auth[_0xde79('0x9')](),controller[_0xde79('0xc')]);router[_0xde79('0x8')](_0xde79('0xd'),auth[_0xde79('0x9')](),controller[_0xde79('0xe')]);router[_0xde79('0xf')]('/',auth[_0xde79('0x9')](),controller[_0xde79('0x10')]);router[_0xde79('0x11')](_0xde79('0xd'),auth[_0xde79('0x9')](),controller[_0xde79('0x12')]);router['delete'](_0xde79('0xd'),auth[_0xde79('0x9')](),controller[_0xde79('0x13')]);module[_0xde79('0x14')]=router; \ No newline at end of file +var _0x38f2=['post','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5f5c34,_0x23e89){var _0x48c0a7=function(_0x12124a){while(--_0x12124a){_0x5f5c34['push'](_0x5f5c34['shift']());}};_0x48c0a7(++_0x23e89);}(_0x38f2,0x1cb));var _0x238f=function(_0x330267,_0x25d74f){_0x330267=_0x330267-0x0;var _0x236e38=_0x38f2[_0x330267];return _0x236e38;};'use strict';var multer=require(_0x238f('0x0'));var util=require(_0x238f('0x1'));var path=require('path');var timeout=require(_0x238f('0x2'));var express=require(_0x238f('0x3'));var router=express[_0x238f('0x4')]();var fs_extra=require(_0x238f('0x5'));var auth=require(_0x238f('0x6'));var interaction=require(_0x238f('0x7'));var config=require('../../config/environment');var controller=require(_0x238f('0x8'));router[_0x238f('0x9')]('/',auth[_0x238f('0xa')](),controller[_0x238f('0xb')]);router[_0x238f('0x9')](_0x238f('0xc'),auth[_0x238f('0xa')](),controller[_0x238f('0xd')]);router[_0x238f('0x9')](_0x238f('0xe'),auth[_0x238f('0xa')](),controller[_0x238f('0xf')]);router[_0x238f('0x10')]('/',auth[_0x238f('0xa')](),controller['create']);router['put']('/:id',auth[_0x238f('0xa')](),controller[_0x238f('0x11')]);router[_0x238f('0x12')](_0x238f('0xe'),auth[_0x238f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 6db8bc6..902c9cb 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 _0xc64b=['put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x524bc1,_0x230985){var _0x5c112f=function(_0x4583e1){while(--_0x4583e1){_0x524bc1['push'](_0x524bc1['shift']());}};_0x5c112f(++_0x230985);}(_0xc64b,0x16d));var _0xbc64=function(_0x38ff2b,_0x3a0316){_0x38ff2b=_0x38ff2b-0x0;var _0x341f5e=_0xc64b[_0x38ff2b];return _0x341f5e;};'use strict';var multer=require(_0xbc64('0x0'));var util=require('util');var path=require(_0xbc64('0x1'));var timeout=require(_0xbc64('0x2'));var express=require(_0xbc64('0x3'));var router=express[_0xbc64('0x4')]();var fs_extra=require(_0xbc64('0x5'));var auth=require(_0xbc64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbc64('0x7'));var controller=require(_0xbc64('0x8'));router[_0xbc64('0x9')]('/',auth['isAuthenticated'](),controller[_0xbc64('0xa')]);router[_0xbc64('0x9')]('/:id',auth[_0xbc64('0xb')](),controller[_0xbc64('0xc')]);router[_0xbc64('0x9')](_0xbc64('0xd'),auth[_0xbc64('0xb')](),controller[_0xbc64('0xe')]);router[_0xbc64('0x9')](_0xbc64('0xf'),auth[_0xbc64('0xb')](),controller[_0xbc64('0x10')]);router[_0xbc64('0x11')]('/',auth[_0xbc64('0xb')](),controller['create']);router[_0xbc64('0x11')]('/:id/configurations',auth[_0xbc64('0xb')](),controller[_0xbc64('0x12')]);router[_0xbc64('0x13')](_0xbc64('0x14'),auth[_0xbc64('0xb')](),controller[_0xbc64('0x15')]);router[_0xbc64('0x16')](_0xbc64('0x14'),auth[_0xbc64('0xb')](),controller[_0xbc64('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3323=['addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x58288c,_0x18ab10){var _0xc12f64=function(_0x7f3f29){while(--_0x7f3f29){_0x58288c['push'](_0x58288c['shift']());}};_0xc12f64(++_0x18ab10);}(_0x3323,0x187));var _0x3332=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x3323[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x3332('0x0'));var util=require('util');var path=require(_0x3332('0x1'));var timeout=require(_0x3332('0x2'));var express=require(_0x3332('0x3'));var router=express[_0x3332('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3332('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3332('0x6'));router[_0x3332('0x7')]('/',auth[_0x3332('0x8')](),controller[_0x3332('0x9')]);router[_0x3332('0x7')]('/:id',auth[_0x3332('0x8')](),controller[_0x3332('0xa')]);router[_0x3332('0x7')](_0x3332('0xb'),auth[_0x3332('0x8')](),controller[_0x3332('0xc')]);router['get'](_0x3332('0xd'),auth[_0x3332('0x8')](),controller[_0x3332('0xe')]);router[_0x3332('0xf')]('/',auth[_0x3332('0x8')](),controller[_0x3332('0x10')]);router[_0x3332('0xf')]('/:id/configurations',auth[_0x3332('0x8')](),controller[_0x3332('0x11')]);router[_0x3332('0x12')](_0x3332('0x13'),auth[_0x3332('0x8')](),controller[_0x3332('0x14')]);router[_0x3332('0x15')]('/:id',auth[_0x3332('0x8')](),controller[_0x3332('0x16')]);module[_0x3332('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a73ce6d..d41607e 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 _0xc5ac=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x55b2b6,_0x5d8933){var _0x2c4f02=function(_0x3af0e0){while(--_0x3af0e0){_0x55b2b6['push'](_0x55b2b6['shift']());}};_0x2c4f02(++_0x5d8933);}(_0xc5ac,0x1bd));var _0xcc5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5ac[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xcc5a('0x0'));module[_0xcc5a('0x1')]={'name':{'type':Sequelize[_0xcc5a('0x2')]},'description':{'type':Sequelize[_0xcc5a('0x2')]},'username':{'type':Sequelize[_0xcc5a('0x2')]},'remoteUri':{'type':Sequelize[_0xcc5a('0x2')]},'authType':{'type':Sequelize[_0xcc5a('0x3')](_0xcc5a('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xcc5a('0x2')]},'consumerKey':{'type':Sequelize[_0xcc5a('0x2')]},'consumerSecret':{'type':Sequelize[_0xcc5a('0x2')]},'token':{'type':Sequelize[_0xcc5a('0x2')]},'tokenSecret':{'type':Sequelize[_0xcc5a('0x2')]},'serverUrl':{'type':Sequelize[_0xcc5a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcc5a('0x5'),_0xcc5a('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfb16=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x17ff35,_0xfeab61){var _0x368137=function(_0x284fda){while(--_0x284fda){_0x17ff35['push'](_0x17ff35['shift']());}};_0x368137(++_0xfeab61);}(_0xfb16,0x10b));var _0x6fb1=function(_0x2dbf61,_0x38ade7){_0x2dbf61=_0x2dbf61-0x0;var _0x57755c=_0xfb16[_0x2dbf61];return _0x57755c;};'use strict';var Sequelize=require(_0x6fb1('0x0'));module[_0x6fb1('0x1')]={'name':{'type':Sequelize[_0x6fb1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6fb1('0x2')]},'authType':{'type':Sequelize[_0x6fb1('0x3')](_0x6fb1('0x4')),'defaultValue':_0x6fb1('0x4')},'password':{'type':Sequelize[_0x6fb1('0x2')]},'consumerKey':{'type':Sequelize[_0x6fb1('0x2')]},'consumerSecret':{'type':Sequelize[_0x6fb1('0x2')]},'token':{'type':Sequelize[_0x6fb1('0x2')]},'tokenSecret':{'type':Sequelize[_0x6fb1('0x2')]},'serverUrl':{'type':Sequelize[_0x6fb1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6fb1('0x3')](_0x6fb1('0x5'),_0x6fb1('0x6')),'defaultValue':_0x6fb1('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 52a4dff..869c1d3 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 _0xcc8a=['end','json','offset','undefined','count','set','Content-Range','apply','reject','then','stack','name','send','map','DeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','update','destroy','getConfigurations','findOne','DeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','concat','_embedded','entries','active','label','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','crypto','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','../../components/integrations/configuration','sendStatus','status'];(function(_0x221f3f,_0x572f89){var _0x4cee7c=function(_0x474015){while(--_0x474015){_0x221f3f['push'](_0x221f3f['shift']());}};_0x4cee7c(++_0x572f89);}(_0xcc8a,0x1b5));var _0xacc8=function(_0x3bf9cc,_0x38a7bf){_0x3bf9cc=_0x3bf9cc-0x0;var _0x270534=_0xcc8a[_0x3bf9cc];return _0x270534;};'use strict';var emlformat=require(_0xacc8('0x0'));var rimraf=require(_0xacc8('0x1'));var zipdir=require(_0xacc8('0x2'));var jsonpatch=require(_0xacc8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacc8('0x4'));var Mustache=require('mustache');var util=require(_0xacc8('0x5'));var path=require(_0xacc8('0x6'));var sox=require(_0xacc8('0x7'));var csv=require(_0xacc8('0x8'));var ejs=require(_0xacc8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xacc8('0xa'));var jsforce=require(_0xacc8('0xb'));var deskjs=require(_0xacc8('0xc'));var toCsv=require(_0xacc8('0x8'));var querystring=require('querystring');var Papa=require(_0xacc8('0xd'));var Redis=require(_0xacc8('0xe'));var authService=require(_0xacc8('0xf'));var qs=require(_0xacc8('0x10'));var as=require(_0xacc8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacc8('0x12'))(_0xacc8('0x13'));var utils=require(_0xacc8('0x14'));var config=require(_0xacc8('0x15'));var licenseUtil=require(_0xacc8('0x16'));var db=require(_0xacc8('0x17'))['db'];var integrations=require(_0xacc8('0x18'));function respondWithStatusCode(_0x448fcc,_0x420302){_0x420302=_0x420302||0xcc;return function(_0x59b6be){if(_0x59b6be){return _0x448fcc[_0xacc8('0x19')](_0x420302);}return _0x448fcc[_0xacc8('0x1a')](_0x420302)[_0xacc8('0x1b')]();};}function respondWithResult(_0x2bc564,_0x2a2b93){_0x2a2b93=_0x2a2b93||0xc8;return function(_0xd8f5b6){if(_0xd8f5b6){return _0x2bc564[_0xacc8('0x1a')](_0x2a2b93)[_0xacc8('0x1c')](_0xd8f5b6);}};}function respondWithFilteredResult(_0x3ae070,_0x51ddbb){return function(_0x465143){if(_0x465143){var _0xd33fcb=typeof _0x51ddbb[_0xacc8('0x1d')]===_0xacc8('0x1e')&&typeof _0x51ddbb['limit']===_0xacc8('0x1e');var _0x96a5ad=_0x465143[_0xacc8('0x1f')];var _0x3a2d36=_0xd33fcb?0x0:_0x51ddbb[_0xacc8('0x1d')];var _0xea2b34=_0xd33fcb?_0x465143['count']:_0x51ddbb[_0xacc8('0x1d')]+_0x51ddbb['limit'];var _0x22bfb1;if(_0xea2b34>=_0x96a5ad){_0xea2b34=_0x96a5ad;_0x22bfb1=0xc8;}else{_0x22bfb1=0xce;}_0x3ae070[_0xacc8('0x1a')](_0x22bfb1);return _0x3ae070[_0xacc8('0x20')](_0xacc8('0x21'),_0x3a2d36+'-'+_0xea2b34+'/'+_0x96a5ad)[_0xacc8('0x1c')](_0x465143);}return null;};}function patchUpdates(_0x25befa){return function(_0x42fcc4){try{jsonpatch[_0xacc8('0x22')](_0x42fcc4,_0x25befa,!![]);}catch(_0x3619e7){return BPromise[_0xacc8('0x23')](_0x3619e7);}return _0x42fcc4['save']();};}function saveUpdates(_0x4def38,_0x482d51){return function(_0x2bfdce){if(_0x2bfdce){return _0x2bfdce['update'](_0x4def38)[_0xacc8('0x24')](function(_0x37f9ea){return _0x37f9ea;});}return null;};}function removeEntity(_0x46e51b,_0x184c49){return function(_0x25ca7a){if(_0x25ca7a){return _0x25ca7a['destroy']()[_0xacc8('0x24')](function(){_0x46e51b[_0xacc8('0x1a')](0xcc)[_0xacc8('0x1b')]();});}};}function handleEntityNotFound(_0x42dd09,_0x2ad302){return function(_0x243cef){if(!_0x243cef){_0x42dd09['sendStatus'](0x194);}return _0x243cef;};}function handleError(_0x130a58,_0x2eff78){_0x2eff78=_0x2eff78||0x1f4;return function(_0x37b7b4){logger['error'](_0x37b7b4[_0xacc8('0x25')]);if(_0x37b7b4['name']){delete _0x37b7b4[_0xacc8('0x26')];}_0x130a58[_0xacc8('0x1a')](_0x2eff78)[_0xacc8('0x27')](_0x37b7b4);};}exports['index']=function(_0x43d7b9,_0x2dd449){var _0x33d9ad={},_0x5c032f={},_0x3494c5={'count':0x0,'rows':[]};var _0x294b90=_[_0xacc8('0x28')](db[_0xacc8('0x29')][_0xacc8('0x2a')],function(_0x4081f9){return{'name':_0x4081f9['fieldName'],'type':_0x4081f9['type'][_0xacc8('0x2b')]};});_0x5c032f[_0xacc8('0x2c')]=_[_0xacc8('0x28')](_0x294b90,_0xacc8('0x26'));_0x5c032f[_0xacc8('0x2d')]=_[_0xacc8('0x2e')](_0x43d7b9['query']);_0x5c032f[_0xacc8('0x2f')]=_[_0xacc8('0x30')](_0x5c032f['model'],_0x5c032f[_0xacc8('0x2d')]);_0x33d9ad['attributes']=_[_0xacc8('0x30')](_0x5c032f[_0xacc8('0x2c')],qs['fields'](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x31')]));_0x33d9ad[_0xacc8('0x32')]=_0x33d9ad[_0xacc8('0x32')][_0xacc8('0x33')]?_0x33d9ad[_0xacc8('0x32')]:_0x5c032f[_0xacc8('0x2c')];if(!_0x43d7b9[_0xacc8('0x2d')]['hasOwnProperty'](_0xacc8('0x34'))){_0x33d9ad[_0xacc8('0x35')]=qs[_0xacc8('0x35')](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x35')]);_0x33d9ad[_0xacc8('0x1d')]=qs[_0xacc8('0x1d')](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x1d')]);}_0x33d9ad['order']=qs[_0xacc8('0x36')](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x36')]);_0x33d9ad[_0xacc8('0x37')]=qs[_0xacc8('0x2f')](_[_0xacc8('0x38')](_0x43d7b9['query'],_0x5c032f[_0xacc8('0x2f')]),_0x294b90);if(_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x39')]){_0x33d9ad[_0xacc8('0x37')]=_['merge'](_0x33d9ad['where'],{'$or':_['map'](_0x294b90,function(_0x1320cd){if(_0x1320cd[_0xacc8('0x3a')]!==_0xacc8('0x3b')){var _0x2de267={};_0x2de267[_0x1320cd['name']]={'$like':'%'+_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x39')]+'%'};return _0x2de267;}})});}_0x33d9ad=_[_0xacc8('0x3c')]({},_0x33d9ad,_0x43d7b9['options']);var _0x1ab443={'where':_0x33d9ad[_0xacc8('0x37')]};return db[_0xacc8('0x29')]['count'](_0x1ab443)[_0xacc8('0x24')](function(_0x5b907a){_0x3494c5[_0xacc8('0x1f')]=_0x5b907a;if(_0x43d7b9[_0xacc8('0x2d')]['includeAll']){_0x33d9ad[_0xacc8('0x3d')]=[{'all':!![]}];}return db[_0xacc8('0x29')][_0xacc8('0x3e')](_0x33d9ad);})['then'](function(_0x4df855){_0x3494c5[_0xacc8('0x3f')]=_0x4df855;return _0x3494c5;})[_0xacc8('0x24')](respondWithFilteredResult(_0x2dd449,_0x33d9ad))[_0xacc8('0x40')](handleError(_0x2dd449,null));};exports['show']=function(_0x919304,_0xa5c476){var _0x33eaf1={'raw':![],'where':{'id':_0x919304[_0xacc8('0x41')]['id']}},_0x1b2f67={};_0x1b2f67['model']=_[_0xacc8('0x2e')](db[_0xacc8('0x29')]['rawAttributes']);_0x1b2f67[_0xacc8('0x2d')]=_[_0xacc8('0x2e')](_0x919304[_0xacc8('0x2d')]);_0x1b2f67[_0xacc8('0x2f')]=_[_0xacc8('0x30')](_0x1b2f67[_0xacc8('0x2c')],_0x1b2f67['query']);_0x33eaf1[_0xacc8('0x32')]=_[_0xacc8('0x30')](_0x1b2f67[_0xacc8('0x2c')],qs['fields'](_0x919304[_0xacc8('0x2d')]['fields']));_0x33eaf1[_0xacc8('0x32')]=_0x33eaf1[_0xacc8('0x32')][_0xacc8('0x33')]?_0x33eaf1[_0xacc8('0x32')]:_0x1b2f67[_0xacc8('0x2c')];if(_0x919304['query'][_0xacc8('0x42')]){_0x33eaf1[_0xacc8('0x3d')]=[{'all':!![]}];}_0x33eaf1=_[_0xacc8('0x3c')]({},_0x33eaf1,_0x919304[_0xacc8('0x43')]);return db[_0xacc8('0x29')][_0xacc8('0x44')](_0x33eaf1)[_0xacc8('0x24')](handleEntityNotFound(_0xa5c476,null))[_0xacc8('0x24')](respondWithResult(_0xa5c476,null))[_0xacc8('0x40')](handleError(_0xa5c476,null));};exports[_0xacc8('0x45')]=function(_0x1d0689,_0x36cbfb){return db[_0xacc8('0x29')]['create'](_0x1d0689[_0xacc8('0x46')],{})['then'](respondWithResult(_0x36cbfb,0xc9))['catch'](handleError(_0x36cbfb,null));};exports[_0xacc8('0x47')]=function(_0x1ad32d,_0x32a5a4){if(_0x1ad32d[_0xacc8('0x46')]['id']){delete _0x1ad32d['body']['id'];}return db[_0xacc8('0x29')][_0xacc8('0x44')]({'where':{'id':_0x1ad32d[_0xacc8('0x41')]['id']}})[_0xacc8('0x24')](handleEntityNotFound(_0x32a5a4,null))[_0xacc8('0x24')](saveUpdates(_0x1ad32d[_0xacc8('0x46')],null))[_0xacc8('0x24')](respondWithResult(_0x32a5a4,null))[_0xacc8('0x40')](handleError(_0x32a5a4,null));};exports[_0xacc8('0x48')]=function(_0x14812a,_0x2d7935){return db[_0xacc8('0x29')][_0xacc8('0x44')]({'where':{'id':_0x14812a[_0xacc8('0x41')]['id']}})[_0xacc8('0x24')](handleEntityNotFound(_0x2d7935,null))[_0xacc8('0x24')](removeEntity(_0x2d7935,null))[_0xacc8('0x40')](handleError(_0x2d7935,null));};exports[_0xacc8('0x49')]=function(_0x1acb6b,_0x79b6a4,_0x4803c9){var _0x12eba9={};var _0x53a329={};var _0x3af2ce;var _0x428949;return db['DeskAccount'][_0xacc8('0x4a')]({'where':{'id':_0x1acb6b[_0xacc8('0x41')]['id']}})['then'](handleEntityNotFound(_0x79b6a4,null))['then'](function(_0x3bfd0c){if(_0x3bfd0c){_0x3af2ce=_0x3bfd0c;_0x53a329[_0xacc8('0x2c')]=_['keys'](db[_0xacc8('0x4b')][_0xacc8('0x2a')]);_0x53a329[_0xacc8('0x2d')]=_[_0xacc8('0x2e')](_0x1acb6b[_0xacc8('0x2d')]);_0x53a329[_0xacc8('0x2f')]=_['intersection'](_0x53a329[_0xacc8('0x2c')],_0x53a329[_0xacc8('0x2d')]);_0x12eba9[_0xacc8('0x32')]=_[_0xacc8('0x30')](_0x53a329[_0xacc8('0x2c')],qs['fields'](_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x31')]));_0x12eba9[_0xacc8('0x32')]=_0x12eba9[_0xacc8('0x32')]['length']?_0x12eba9[_0xacc8('0x32')]:_0x53a329[_0xacc8('0x2c')];_0x12eba9[_0xacc8('0x4c')]=qs[_0xacc8('0x36')](_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x36')]);_0x12eba9[_0xacc8('0x37')]=qs[_0xacc8('0x2f')](_['pick'](_0x1acb6b[_0xacc8('0x2d')],_0x53a329[_0xacc8('0x2f')]));if(_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x39')]){_0x12eba9[_0xacc8('0x37')]=_[_0xacc8('0x3c')](_0x12eba9[_0xacc8('0x37')],{'$or':_['map'](_0x12eba9[_0xacc8('0x32')],function(_0x5de483){var _0x552180={};_0x552180[_0x5de483]={'$like':'%'+_0x1acb6b['query']['filter']+'%'};return _0x552180;})});}_0x12eba9=_[_0xacc8('0x3c')]({},_0x12eba9,_0x1acb6b[_0xacc8('0x43')]);return _0x3af2ce[_0xacc8('0x49')](_0x12eba9);}})[_0xacc8('0x24')](function(_0x542a79){if(_0x542a79){_0x428949=_0x542a79[_0xacc8('0x33')];if(!_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x4d')](_0xacc8('0x34'))){_0x12eba9[_0xacc8('0x35')]=qs[_0xacc8('0x35')](_0x1acb6b['query'][_0xacc8('0x35')]);_0x12eba9['offset']=qs[_0xacc8('0x1d')](_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x1d')]);}return _0x3af2ce[_0xacc8('0x49')](_0x12eba9);}})[_0xacc8('0x24')](function(_0x33963f){if(_0x33963f){return _0x33963f?{'count':_0x428949,'rows':_0x33963f}:null;}})[_0xacc8('0x24')](respondWithResult(_0x79b6a4,null))[_0xacc8('0x40')](handleError(_0x79b6a4,null));};exports[_0xacc8('0x4e')]=function(_0x54cc24,_0x4652ba,_0x2fcc75){if(_0x54cc24['body']['id']){delete _0x54cc24[_0xacc8('0x46')]['id'];}return db[_0xacc8('0x29')][_0xacc8('0x4a')]({'where':{'id':_0x54cc24[_0xacc8('0x41')]['id']}})[_0xacc8('0x24')](handleEntityNotFound(_0x4652ba,null))[_0xacc8('0x24')](function(_0x43f659){if(_0x43f659){_0x54cc24[_0xacc8('0x46')][_0xacc8('0x4f')]=_0x43f659['id'];_0x54cc24['body'][_0xacc8('0x50')]=integrations[_0xacc8('0x51')](_0x54cc24[_0xacc8('0x46')][_0xacc8('0x52')],_0x54cc24[_0xacc8('0x46')][_0xacc8('0x3a')]);_0x54cc24[_0xacc8('0x46')][_0xacc8('0x53')]=integrations[_0xacc8('0x54')](_0x54cc24[_0xacc8('0x46')][_0xacc8('0x52')],_0x54cc24['body'][_0xacc8('0x3a')]);return db[_0xacc8('0x4b')][_0xacc8('0x45')](_0x54cc24[_0xacc8('0x46')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xacc8('0x55')],'as':_0xacc8('0x53')}]});}return null;})[_0xacc8('0x24')](respondWithResult(_0x4652ba,null))[_0xacc8('0x40')](handleError(_0x4652ba,null));};exports[_0xacc8('0x56')]=function(_0x26a9f1,_0x4aa967,_0x4b7013){var _0x27126c=[{'name':_0xacc8('0x57'),'label':'priority','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 _0x4e296d='';return db[_0xacc8('0x29')][_0xacc8('0x4a')]({'where':{'id':_0x26a9f1[_0xacc8('0x41')]['id']},'attributes':['id',_0xacc8('0x58'),_0xacc8('0x59'),_0xacc8('0x5a'),_0xacc8('0x5b'),_0xacc8('0x5c'),_0xacc8('0x5d'),_0xacc8('0x5e'),_0xacc8('0x5f')]})['then'](handleEntityNotFound(_0x4aa967,null))['then'](function(_0x572e42){if(_0x572e42){_0x4e296d=_0x572e42[_0xacc8('0x58')];var _0x44af5e=_0x4e296d[_0xacc8('0x60')](-0x1);if(_0x44af5e==='/'){_0x4e296d=_0x4e296d['substring'](0x0,_0x4e296d['lastIndexOf'](_0x44af5e));}var _0x5a37de={'method':_0xacc8('0x61'),'uri':util[_0xacc8('0x62')](_0xacc8('0x63'),_0x4e296d),'headers':{'Content-Type':_0xacc8('0x64'),'Accept':_0xacc8('0x64')},'json':!![]};if(_0x572e42['authType']===_0xacc8('0x65')){_0x5a37de[_0xacc8('0x66')][_0xacc8('0x67')]=util[_0xacc8('0x62')](_0xacc8('0x68'),new Buffer(util[_0xacc8('0x62')](_0xacc8('0x69'),_0x572e42['username'],_0x572e42[_0xacc8('0x5b')]))['toString']('base64'));}return rp(_0x5a37de)[_0xacc8('0x24')](function(_0x532281){return _0x27126c[_0xacc8('0x6a')](_['map'](_0x532281[_0xacc8('0x6b')][_0xacc8('0x6c')],function(_0x52a8d6){return{'id':_0x52a8d6[_0xacc8('0x26')],'name':_0x52a8d6[_0xacc8('0x26')],'type':_0x52a8d6['type'],'active':_0x52a8d6[_0xacc8('0x6d')],'label':_0x52a8d6[_0xacc8('0x6e')],'custom':!![]};}));});}})[_0xacc8('0x24')](function(_0x45571b){return{'count':_0x45571b['length'],'rows':_0x45571b};})['then'](respondWithResult(_0x4aa967,null))[_0xacc8('0x40')](function(_0x2fdf5f){var _0x4748ba=_0x26a9f1[_0xacc8('0x2d')]['test']?0x1f4:_0x2fdf5f['statusCode']||0x1f4;logger[_0xacc8('0x6f')](_0xacc8('0x70'),_0xacc8('0x56'),_0x4748ba,JSON[_0xacc8('0x71')](_0x2fdf5f));delete _0x2fdf5f[_0xacc8('0x26')];if(_0x4748ba===0x191){_0x4748ba=0x190;}_0x4aa967[_0xacc8('0x1a')](_0x4748ba)['send'](_0x26a9f1[_0xacc8('0x2d')][_0xacc8('0x72')]?{'message':_0xacc8('0x73'),'statusCode':_0x2fdf5f['statusCode']}:_0x2fdf5f);});}; \ No newline at end of file +var _0x625d=['params','find','create','body','getConfigurations','findOne','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Basic\x20%s','username','concat','_embedded','entries','label','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','status','apply','reject','update','then','destroy','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x625d,0x17b));var _0xd625=function(_0x26fdb5,_0x47f4b9){_0x26fdb5=_0x26fdb5-0x0;var _0x5bc218=_0x625d[_0x26fdb5];return _0x5bc218;};'use strict';var emlformat=require(_0xd625('0x0'));var rimraf=require(_0xd625('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd625('0x2'));var rp=require(_0xd625('0x3'));var moment=require(_0xd625('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd625('0x5'));var util=require(_0xd625('0x6'));var path=require('path');var sox=require(_0xd625('0x7'));var csv=require(_0xd625('0x8'));var ejs=require(_0xd625('0x9'));var fs=require('fs');var fs_extra=require(_0xd625('0xa'));var _=require(_0xd625('0xb'));var squel=require(_0xd625('0xc'));var crypto=require('crypto');var jsforce=require(_0xd625('0xd'));var deskjs=require(_0xd625('0xe'));var toCsv=require(_0xd625('0x8'));var querystring=require('querystring');var Papa=require(_0xd625('0xf'));var Redis=require(_0xd625('0x10'));var authService=require(_0xd625('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd625('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd625('0x13'))('api');var utils=require(_0xd625('0x14'));var config=require(_0xd625('0x15'));var licenseUtil=require(_0xd625('0x16'));var db=require(_0xd625('0x17'))['db'];var integrations=require(_0xd625('0x18'));function respondWithStatusCode(_0x306dfd,_0x25ae31){_0x25ae31=_0x25ae31||0xcc;return function(_0x2ea3e5){if(_0x2ea3e5){return _0x306dfd[_0xd625('0x19')](_0x25ae31);}return _0x306dfd['status'](_0x25ae31)[_0xd625('0x1a')]();};}function respondWithResult(_0x4411e3,_0x47beb0){_0x47beb0=_0x47beb0||0xc8;return function(_0xd5a762){if(_0xd5a762){return _0x4411e3['status'](_0x47beb0)[_0xd625('0x1b')](_0xd5a762);}};}function respondWithFilteredResult(_0x136292,_0x199bee){return function(_0x2dddd3){if(_0x2dddd3){var _0x583bc5=typeof _0x199bee[_0xd625('0x1c')]==='undefined'&&typeof _0x199bee[_0xd625('0x1d')]===_0xd625('0x1e');var _0x5de95c=_0x2dddd3['count'];var _0x5574f0=_0x583bc5?0x0:_0x199bee['offset'];var _0x1199f9=_0x583bc5?_0x2dddd3[_0xd625('0x1f')]:_0x199bee[_0xd625('0x1c')]+_0x199bee[_0xd625('0x1d')];var _0xfa5c59;if(_0x1199f9>=_0x5de95c){_0x1199f9=_0x5de95c;_0xfa5c59=0xc8;}else{_0xfa5c59=0xce;}_0x136292[_0xd625('0x20')](_0xfa5c59);return _0x136292['set']('Content-Range',_0x5574f0+'-'+_0x1199f9+'/'+_0x5de95c)[_0xd625('0x1b')](_0x2dddd3);}return null;};}function patchUpdates(_0x293ab4){return function(_0x3de4de){try{jsonpatch[_0xd625('0x21')](_0x3de4de,_0x293ab4,!![]);}catch(_0x527377){return BPromise[_0xd625('0x22')](_0x527377);}return _0x3de4de['save']();};}function saveUpdates(_0x5f1915,_0x5d2624){return function(_0x249053){if(_0x249053){return _0x249053[_0xd625('0x23')](_0x5f1915)[_0xd625('0x24')](function(_0xa5fc7b){return _0xa5fc7b;});}return null;};}function removeEntity(_0x39a6b6,_0x3af541){return function(_0x27d83d){if(_0x27d83d){return _0x27d83d[_0xd625('0x25')]()['then'](function(){_0x39a6b6[_0xd625('0x20')](0xcc)[_0xd625('0x1a')]();});}};}function handleEntityNotFound(_0x490d67,_0x1ff09e){return function(_0x40aab6){if(!_0x40aab6){_0x490d67[_0xd625('0x19')](0x194);}return _0x40aab6;};}function handleError(_0x1f17e1,_0x563442){_0x563442=_0x563442||0x1f4;return function(_0x3c6efa){logger['error'](_0x3c6efa['stack']);if(_0x3c6efa[_0xd625('0x26')]){delete _0x3c6efa['name'];}_0x1f17e1[_0xd625('0x20')](_0x563442)[_0xd625('0x27')](_0x3c6efa);};}exports[_0xd625('0x28')]=function(_0x29eebe,_0x1f5dff){var _0x30de3e={},_0x44352f={},_0x2641be={'count':0x0,'rows':[]};var _0x4f4058=_[_0xd625('0x29')](db[_0xd625('0x2a')][_0xd625('0x2b')],function(_0x4f0854){return{'name':_0x4f0854['fieldName'],'type':_0x4f0854[_0xd625('0x2c')][_0xd625('0x2d')]};});_0x44352f[_0xd625('0x2e')]=_[_0xd625('0x29')](_0x4f4058,_0xd625('0x26'));_0x44352f[_0xd625('0x2f')]=_[_0xd625('0x30')](_0x29eebe[_0xd625('0x2f')]);_0x44352f[_0xd625('0x31')]=_[_0xd625('0x32')](_0x44352f[_0xd625('0x2e')],_0x44352f[_0xd625('0x2f')]);_0x30de3e[_0xd625('0x33')]=_[_0xd625('0x32')](_0x44352f[_0xd625('0x2e')],qs['fields'](_0x29eebe[_0xd625('0x2f')][_0xd625('0x34')]));_0x30de3e['attributes']=_0x30de3e[_0xd625('0x33')][_0xd625('0x35')]?_0x30de3e['attributes']:_0x44352f[_0xd625('0x2e')];if(!_0x29eebe[_0xd625('0x2f')][_0xd625('0x36')]('nolimit')){_0x30de3e[_0xd625('0x1d')]=qs[_0xd625('0x1d')](_0x29eebe[_0xd625('0x2f')]['limit']);_0x30de3e[_0xd625('0x1c')]=qs[_0xd625('0x1c')](_0x29eebe[_0xd625('0x2f')]['offset']);}_0x30de3e[_0xd625('0x37')]=qs['sort'](_0x29eebe[_0xd625('0x2f')]['sort']);_0x30de3e[_0xd625('0x38')]=qs[_0xd625('0x31')](_[_0xd625('0x39')](_0x29eebe[_0xd625('0x2f')],_0x44352f[_0xd625('0x31')]),_0x4f4058);if(_0x29eebe[_0xd625('0x2f')][_0xd625('0x3a')]){_0x30de3e['where']=_[_0xd625('0x3b')](_0x30de3e['where'],{'$or':_[_0xd625('0x29')](_0x4f4058,function(_0x43bf06){if(_0x43bf06[_0xd625('0x2c')]!==_0xd625('0x3c')){var _0x811746={};_0x811746[_0x43bf06['name']]={'$like':'%'+_0x29eebe[_0xd625('0x2f')][_0xd625('0x3a')]+'%'};return _0x811746;}})});}_0x30de3e=_[_0xd625('0x3b')]({},_0x30de3e,_0x29eebe[_0xd625('0x3d')]);var _0x47d410={'where':_0x30de3e[_0xd625('0x38')]};return db[_0xd625('0x2a')][_0xd625('0x1f')](_0x47d410)[_0xd625('0x24')](function(_0x594b48){_0x2641be[_0xd625('0x1f')]=_0x594b48;if(_0x29eebe[_0xd625('0x2f')][_0xd625('0x3e')]){_0x30de3e[_0xd625('0x3f')]=[{'all':!![]}];}return db[_0xd625('0x2a')]['findAll'](_0x30de3e);})[_0xd625('0x24')](function(_0x3be9ee){_0x2641be['rows']=_0x3be9ee;return _0x2641be;})['then'](respondWithFilteredResult(_0x1f5dff,_0x30de3e))[_0xd625('0x40')](handleError(_0x1f5dff,null));};exports['show']=function(_0x6ebb88,_0x56744e){var _0x2fc7ee={'raw':![],'where':{'id':_0x6ebb88[_0xd625('0x41')]['id']}},_0x10eb2d={};_0x10eb2d[_0xd625('0x2e')]=_[_0xd625('0x30')](db[_0xd625('0x2a')][_0xd625('0x2b')]);_0x10eb2d[_0xd625('0x2f')]=_[_0xd625('0x30')](_0x6ebb88[_0xd625('0x2f')]);_0x10eb2d['filters']=_[_0xd625('0x32')](_0x10eb2d[_0xd625('0x2e')],_0x10eb2d['query']);_0x2fc7ee[_0xd625('0x33')]=_[_0xd625('0x32')](_0x10eb2d[_0xd625('0x2e')],qs[_0xd625('0x34')](_0x6ebb88[_0xd625('0x2f')][_0xd625('0x34')]));_0x2fc7ee[_0xd625('0x33')]=_0x2fc7ee[_0xd625('0x33')]['length']?_0x2fc7ee[_0xd625('0x33')]:_0x10eb2d[_0xd625('0x2e')];if(_0x6ebb88[_0xd625('0x2f')]['includeAll']){_0x2fc7ee['include']=[{'all':!![]}];}_0x2fc7ee=_[_0xd625('0x3b')]({},_0x2fc7ee,_0x6ebb88[_0xd625('0x3d')]);return db['DeskAccount'][_0xd625('0x42')](_0x2fc7ee)[_0xd625('0x24')](handleEntityNotFound(_0x56744e,null))[_0xd625('0x24')](respondWithResult(_0x56744e,null))[_0xd625('0x40')](handleError(_0x56744e,null));};exports[_0xd625('0x43')]=function(_0x380b08,_0x50e3c8){return db[_0xd625('0x2a')]['create'](_0x380b08['body'],{})['then'](respondWithResult(_0x50e3c8,0xc9))['catch'](handleError(_0x50e3c8,null));};exports[_0xd625('0x23')]=function(_0x2b29bd,_0xdd2d54){if(_0x2b29bd[_0xd625('0x44')]['id']){delete _0x2b29bd[_0xd625('0x44')]['id'];}return db[_0xd625('0x2a')]['find']({'where':{'id':_0x2b29bd[_0xd625('0x41')]['id']}})['then'](handleEntityNotFound(_0xdd2d54,null))[_0xd625('0x24')](saveUpdates(_0x2b29bd['body'],null))[_0xd625('0x24')](respondWithResult(_0xdd2d54,null))[_0xd625('0x40')](handleError(_0xdd2d54,null));};exports[_0xd625('0x25')]=function(_0x3d781a,_0x27e02f){return db[_0xd625('0x2a')]['find']({'where':{'id':_0x3d781a[_0xd625('0x41')]['id']}})[_0xd625('0x24')](handleEntityNotFound(_0x27e02f,null))[_0xd625('0x24')](removeEntity(_0x27e02f,null))[_0xd625('0x40')](handleError(_0x27e02f,null));};exports[_0xd625('0x45')]=function(_0x36a60c,_0x7a0a57,_0x13672f){var _0x42e650={};var _0x30bad7={};var _0x5debd8;var _0x748c1f;return db[_0xd625('0x2a')][_0xd625('0x46')]({'where':{'id':_0x36a60c[_0xd625('0x41')]['id']}})['then'](handleEntityNotFound(_0x7a0a57,null))[_0xd625('0x24')](function(_0x21d4d8){if(_0x21d4d8){_0x5debd8=_0x21d4d8;_0x30bad7[_0xd625('0x2e')]=_['keys'](db['DeskConfiguration'][_0xd625('0x2b')]);_0x30bad7[_0xd625('0x2f')]=_[_0xd625('0x30')](_0x36a60c['query']);_0x30bad7['filters']=_[_0xd625('0x32')](_0x30bad7['model'],_0x30bad7['query']);_0x42e650[_0xd625('0x33')]=_[_0xd625('0x32')](_0x30bad7[_0xd625('0x2e')],qs[_0xd625('0x34')](_0x36a60c['query'][_0xd625('0x34')]));_0x42e650[_0xd625('0x33')]=_0x42e650[_0xd625('0x33')][_0xd625('0x35')]?_0x42e650[_0xd625('0x33')]:_0x30bad7[_0xd625('0x2e')];_0x42e650['order']=qs[_0xd625('0x47')](_0x36a60c['query'][_0xd625('0x47')]);_0x42e650[_0xd625('0x38')]=qs[_0xd625('0x31')](_['pick'](_0x36a60c[_0xd625('0x2f')],_0x30bad7[_0xd625('0x31')]));if(_0x36a60c[_0xd625('0x2f')][_0xd625('0x3a')]){_0x42e650[_0xd625('0x38')]=_[_0xd625('0x3b')](_0x42e650[_0xd625('0x38')],{'$or':_[_0xd625('0x29')](_0x42e650['attributes'],function(_0x3d3627){var _0x52e2bf={};_0x52e2bf[_0x3d3627]={'$like':'%'+_0x36a60c[_0xd625('0x2f')][_0xd625('0x3a')]+'%'};return _0x52e2bf;})});}_0x42e650=_[_0xd625('0x3b')]({},_0x42e650,_0x36a60c[_0xd625('0x3d')]);return _0x5debd8['getConfigurations'](_0x42e650);}})[_0xd625('0x24')](function(_0x43b3cf){if(_0x43b3cf){_0x748c1f=_0x43b3cf[_0xd625('0x35')];if(!_0x36a60c[_0xd625('0x2f')][_0xd625('0x36')](_0xd625('0x48'))){_0x42e650[_0xd625('0x1d')]=qs[_0xd625('0x1d')](_0x36a60c[_0xd625('0x2f')]['limit']);_0x42e650[_0xd625('0x1c')]=qs['offset'](_0x36a60c['query'][_0xd625('0x1c')]);}return _0x5debd8[_0xd625('0x45')](_0x42e650);}})['then'](function(_0x4826a2){if(_0x4826a2){return _0x4826a2?{'count':_0x748c1f,'rows':_0x4826a2}:null;}})[_0xd625('0x24')](respondWithResult(_0x7a0a57,null))[_0xd625('0x40')](handleError(_0x7a0a57,null));};exports[_0xd625('0x49')]=function(_0x3e5bcd,_0x317853,_0x18819d){if(_0x3e5bcd[_0xd625('0x44')]['id']){delete _0x3e5bcd[_0xd625('0x44')]['id'];}return db[_0xd625('0x2a')][_0xd625('0x46')]({'where':{'id':_0x3e5bcd[_0xd625('0x41')]['id']}})[_0xd625('0x24')](handleEntityNotFound(_0x317853,null))['then'](function(_0x32d2c9){if(_0x32d2c9){_0x3e5bcd[_0xd625('0x44')][_0xd625('0x4a')]=_0x32d2c9['id'];_0x3e5bcd[_0xd625('0x44')][_0xd625('0x4b')]=integrations[_0xd625('0x4c')](_0x3e5bcd[_0xd625('0x44')][_0xd625('0x4d')],_0x3e5bcd[_0xd625('0x44')][_0xd625('0x2c')]);_0x3e5bcd['body'][_0xd625('0x4e')]=integrations[_0xd625('0x4f')](_0x3e5bcd[_0xd625('0x44')][_0xd625('0x4d')],_0x3e5bcd[_0xd625('0x44')][_0xd625('0x2c')]);return db[_0xd625('0x50')][_0xd625('0x43')](_0x3e5bcd[_0xd625('0x44')],{'include':[{'model':db['DeskField'],'as':_0xd625('0x4b')},{'model':db[_0xd625('0x51')],'as':_0xd625('0x4e')}]});}return null;})['then'](respondWithResult(_0x317853,null))[_0xd625('0x40')](handleError(_0x317853,null));};exports[_0xd625('0x52')]=function(_0x2fc6b1,_0xafaca4,_0x356939){var _0x5da767=[{'name':_0xd625('0x53'),'label':_0xd625('0x53'),'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 _0x32b74f='';return db[_0xd625('0x2a')][_0xd625('0x46')]({'where':{'id':_0x2fc6b1[_0xd625('0x41')]['id']},'attributes':['id',_0xd625('0x54'),_0xd625('0x55'),'username',_0xd625('0x56'),_0xd625('0x57'),_0xd625('0x58'),_0xd625('0x59'),_0xd625('0x5a')]})[_0xd625('0x24')](handleEntityNotFound(_0xafaca4,null))[_0xd625('0x24')](function(_0x3e3fa4){if(_0x3e3fa4){_0x32b74f=_0x3e3fa4[_0xd625('0x54')];var _0x37e642=_0x32b74f[_0xd625('0x5b')](-0x1);if(_0x37e642==='/'){_0x32b74f=_0x32b74f[_0xd625('0x5c')](0x0,_0x32b74f[_0xd625('0x5d')](_0x37e642));}var _0x5d95dd={'method':_0xd625('0x5e'),'uri':util[_0xd625('0x5f')]('%s/custom_fields',_0x32b74f),'headers':{'Content-Type':_0xd625('0x60'),'Accept':'application/json'},'json':!![]};if(_0x3e3fa4[_0xd625('0x55')]===_0xd625('0x61')){_0x5d95dd[_0xd625('0x62')]['Authorization']=util['format'](_0xd625('0x63'),new Buffer(util[_0xd625('0x5f')]('%s:%s',_0x3e3fa4[_0xd625('0x64')],_0x3e3fa4[_0xd625('0x56')]))['toString']('base64'));}return rp(_0x5d95dd)[_0xd625('0x24')](function(_0xb50234){return _0x5da767[_0xd625('0x65')](_[_0xd625('0x29')](_0xb50234[_0xd625('0x66')][_0xd625('0x67')],function(_0x3e9391){return{'id':_0x3e9391[_0xd625('0x26')],'name':_0x3e9391[_0xd625('0x26')],'type':_0x3e9391[_0xd625('0x2c')],'active':_0x3e9391['active'],'label':_0x3e9391[_0xd625('0x68')],'custom':!![]};}));});}})[_0xd625('0x24')](function(_0x4c16a6){return{'count':_0x4c16a6['length'],'rows':_0x4c16a6};})[_0xd625('0x24')](respondWithResult(_0xafaca4,null))[_0xd625('0x40')](function(_0x2c1546){var _0x388062=_0x2fc6b1[_0xd625('0x2f')][_0xd625('0x69')]?0x1f4:_0x2c1546['statusCode']||0x1f4;logger[_0xd625('0x6a')](_0xd625('0x6b'),'getFields',_0x388062,JSON[_0xd625('0x6c')](_0x2c1546));delete _0x2c1546[_0xd625('0x26')];if(_0x388062===0x191){_0x388062=0x190;}_0xafaca4[_0xd625('0x20')](_0x388062)[_0xd625('0x27')](_0x2fc6b1[_0xd625('0x2f')][_0xd625('0x69')]?{'message':_0xd625('0x6d'),'statusCode':_0x2c1546[_0xd625('0x6e')]}:_0x2c1546);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d9ffd0e..a2958b9 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 _0xdd94=['./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1496c1,_0x29c931){var _0xf87499=function(_0xa8e12a){while(--_0xa8e12a){_0x1496c1['push'](_0x1496c1['shift']());}};_0xf87499(++_0x29c931);}(_0xdd94,0x148));var _0x4dd9=function(_0x327a3d,_0x39376b){_0x327a3d=_0x327a3d-0x0;var _0x35f844=_0xdd94[_0x327a3d];return _0x35f844;};'use strict';var _=require('lodash');var util=require(_0x4dd9('0x0'));var logger=require(_0x4dd9('0x1'))(_0x4dd9('0x2'));var moment=require(_0x4dd9('0x3'));var BPromise=require(_0x4dd9('0x4'));var rp=require(_0x4dd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dd9('0x6'));var config=require(_0x4dd9('0x7'));var attributes=require(_0x4dd9('0x8'));var integrations=require(_0x4dd9('0x9'));module['exports']=function(_0x807f3c,_0x2c6637){return _0x807f3c[_0x4dd9('0xa')](_0x4dd9('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe32f=['rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x29a389,_0x3a2246){var _0x1982f4=function(_0x5c491a){while(--_0x5c491a){_0x29a389['push'](_0x29a389['shift']());}};_0x1982f4(++_0x3a2246);}(_0xe32f,0xef));var _0xfe32=function(_0x2e9dca,_0x47129a){_0x2e9dca=_0x2e9dca-0x0;var _0x4b4efd=_0xe32f[_0x2e9dca];return _0x4b4efd;};'use strict';var _=require(_0xfe32('0x0'));var util=require(_0xfe32('0x1'));var logger=require(_0xfe32('0x2'))(_0xfe32('0x3'));var moment=require(_0xfe32('0x4'));var BPromise=require(_0xfe32('0x5'));var rp=require(_0xfe32('0x6'));var fs=require('fs');var path=require(_0xfe32('0x7'));var rimraf=require(_0xfe32('0x8'));var config=require(_0xfe32('0x9'));var attributes=require(_0xfe32('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xfe32('0xb')]=function(_0xec2917,_0x1eec7c){return _0xec2917[_0xfe32('0xc')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','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 e8d9efb..ddb87df 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 _0x50cc=['rpc','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','map','include','model','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22a941,_0xadc989){var _0x35e762=function(_0x2a5d1b){while(--_0x2a5d1b){_0x22a941['push'](_0x22a941['shift']());}};_0x35e762(++_0xadc989);}(_0x50cc,0x110));var _0xc50c=function(_0x4168c8,_0x21464a){_0x4168c8=_0x4168c8-0x0;var _0x56db03=_0x50cc[_0x4168c8];return _0x56db03;};'use strict';var _=require(_0xc50c('0x0'));var util=require(_0xc50c('0x1'));var moment=require(_0xc50c('0x2'));var BPromise=require(_0xc50c('0x3'));var rs=require(_0xc50c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc50c('0x5'))['db'];var utils=require(_0xc50c('0x6'));var logger=require(_0xc50c('0x7'))(_0xc50c('0x8'));var config=require('../../config/environment');var jayson=require(_0xc50c('0x9'));var client=jayson[_0xc50c('0xa')][_0xc50c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34a446,_0x92deb4,_0x4f9a2b){return new BPromise(function(_0x3a3669,_0x5dd7c3){return client['request'](_0x34a446,_0x4f9a2b)[_0xc50c('0xc')](function(_0x69a950){logger['info'](_0xc50c('0xd'),_0x92deb4,'request\x20sent');logger[_0xc50c('0xe')](_0xc50c('0xf'),_0x92deb4,_0xc50c('0x10'),JSON[_0xc50c('0x11')](_0x69a950));if(_0x69a950[_0xc50c('0x12')]){if(_0x69a950['error']['code']===0x1f4){logger['error'](_0xc50c('0xd'),_0x92deb4,_0x69a950[_0xc50c('0x12')][_0xc50c('0x13')]);return _0x5dd7c3(_0x69a950[_0xc50c('0x12')][_0xc50c('0x13')]);}logger[_0xc50c('0x12')](_0xc50c('0xd'),_0x92deb4,_0x69a950[_0xc50c('0x12')][_0xc50c('0x13')]);return _0x3a3669(_0x69a950['error'][_0xc50c('0x13')]);}else{logger[_0xc50c('0x14')](_0xc50c('0xd'),_0x92deb4,_0xc50c('0x10'));_0x3a3669(_0x69a950['result'][_0xc50c('0x13')]);}})[_0xc50c('0x15')](function(_0x802177){logger[_0xc50c('0x12')](_0xc50c('0xd'),_0x92deb4,_0x802177);_0x5dd7c3(_0x802177);});});}exports[_0xc50c('0x16')]=function(_0x51a924){var _0xcc4e27=this;return new Promise(function(_0x7d1715,_0x345e26){return db[_0xc50c('0x17')][_0xc50c('0x18')]({'raw':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')][_0xc50c('0x1a')]||null:null,'attributes':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')][_0xc50c('0x1b')]||null:null,'limit':_0x51a924['options']?_0x51a924[_0xc50c('0x19')][_0xc50c('0x1c')]||null:null,'include':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')]['include']?_[_0xc50c('0x1d')](_0x51a924[_0xc50c('0x19')][_0xc50c('0x1e')],function(_0x17c497){return{'model':db[_0x17c497[_0xc50c('0x1f')]],'as':_0x17c497['as'],'attributes':_0x17c497[_0xc50c('0x1b')],'include':_0x17c497['include']?_[_0xc50c('0x1d')](_0x17c497['include'],function(_0x15097e){return{'model':db[_0x15097e[_0xc50c('0x1f')]],'as':_0x15097e['as'],'attributes':_0x15097e[_0xc50c('0x1b')],'include':_0x15097e['include']?_[_0xc50c('0x1d')](_0x15097e['include'],function(_0x2c157c){return{'model':db[_0x2c157c[_0xc50c('0x1f')]],'as':_0x2c157c['as'],'attributes':_0x2c157c[_0xc50c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc50c('0xc')](function(_0x7834dc){logger[_0xc50c('0x14')](_0xc50c('0x16'),_0x51a924);logger['debug'](_0xc50c('0x16'),_0x51a924,JSON[_0xc50c('0x11')](_0x7834dc));_0x7d1715(_0x7834dc);})['catch'](function(_0x26be21){logger['error'](_0xc50c('0x16'),_0x26be21[_0xc50c('0x13')],_0x51a924);_0x345e26(_0xcc4e27['error'](0x1f4,_0x26be21[_0xc50c('0x13')]));});});};exports[_0xc50c('0x20')]=function(_0x35fda5){var _0x56f8c3=this;return new Promise(function(_0x167739,_0x4cb5c9){return db['DeskAccount'][_0xc50c('0x21')]({'raw':_0x35fda5[_0xc50c('0x19')]?_0x35fda5[_0xc50c('0x19')][_0xc50c('0x22')]===undefined?!![]:![]:!![],'where':_0x35fda5[_0xc50c('0x19')]?_0x35fda5[_0xc50c('0x19')][_0xc50c('0x1a')]||null:null,'attributes':_0x35fda5['options']?_0x35fda5['options'][_0xc50c('0x1b')]||null:null,'include':_0x35fda5[_0xc50c('0x19')]?_0x35fda5[_0xc50c('0x19')][_0xc50c('0x1e')]?_[_0xc50c('0x1d')](_0x35fda5[_0xc50c('0x19')][_0xc50c('0x1e')],function(_0x16b908){return{'model':db[_0x16b908['model']],'as':_0x16b908['as'],'attributes':_0x16b908[_0xc50c('0x1b')],'include':_0x16b908[_0xc50c('0x1e')]?_['map'](_0x16b908[_0xc50c('0x1e')],function(_0x42d630){return{'model':db[_0x42d630[_0xc50c('0x1f')]],'as':_0x42d630['as'],'attributes':_0x42d630[_0xc50c('0x1b')],'include':_0x42d630[_0xc50c('0x1e')]?_[_0xc50c('0x1d')](_0x42d630[_0xc50c('0x1e')],function(_0x17cb9d){return{'model':db[_0x17cb9d[_0xc50c('0x1f')]],'as':_0x17cb9d['as'],'attributes':_0x17cb9d[_0xc50c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc50c('0xc')](function(_0x205583){logger[_0xc50c('0x14')](_0xc50c('0x20'),_0x35fda5);logger[_0xc50c('0xe')]('ShowDeskAccount',_0x35fda5,JSON[_0xc50c('0x11')](_0x205583));_0x167739(_0x205583);})[_0xc50c('0x15')](function(_0x2d14ac){logger[_0xc50c('0x12')](_0xc50c('0x20'),_0x2d14ac[_0xc50c('0x13')],_0x35fda5);_0x4cb5c9(_0x56f8c3[_0xc50c('0x12')](0x1f4,_0x2d14ac[_0xc50c('0x13')]));});});}; \ No newline at end of file +var _0xfcf3=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map','model','info','ShowDeskAccount','find'];(function(_0x50dba1,_0x18bd26){var _0xd2cb06=function(_0x5b992b){while(--_0x5b992b){_0x50dba1['push'](_0x50dba1['shift']());}};_0xd2cb06(++_0x18bd26);}(_0xfcf3,0x1a0));var _0x3fcf=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xfcf3[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x3fcf('0x0'));var util=require(_0x3fcf('0x1'));var moment=require(_0x3fcf('0x2'));var BPromise=require(_0x3fcf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3fcf('0x4'));var logger=require(_0x3fcf('0x5'))(_0x3fcf('0x6'));var config=require(_0x3fcf('0x7'));var jayson=require(_0x3fcf('0x8'));var client=jayson['client'][_0x3fcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7099e,_0x4f44c7,_0x5e68ef){return new BPromise(function(_0x1f00b2,_0x3123ab){return client['request'](_0x7099e,_0x5e68ef)[_0x3fcf('0xa')](function(_0xa31928){logger['info'](_0x3fcf('0xb'),_0x4f44c7,'request\x20sent');logger[_0x3fcf('0xc')](_0x3fcf('0xd'),_0x4f44c7,_0x3fcf('0xe'),JSON[_0x3fcf('0xf')](_0xa31928));if(_0xa31928['error']){if(_0xa31928['error'][_0x3fcf('0x10')]===0x1f4){logger[_0x3fcf('0x11')](_0x3fcf('0xb'),_0x4f44c7,_0xa31928[_0x3fcf('0x11')][_0x3fcf('0x12')]);return _0x3123ab(_0xa31928[_0x3fcf('0x11')][_0x3fcf('0x12')]);}logger['error'](_0x3fcf('0xb'),_0x4f44c7,_0xa31928[_0x3fcf('0x11')][_0x3fcf('0x12')]);return _0x1f00b2(_0xa31928[_0x3fcf('0x11')][_0x3fcf('0x12')]);}else{logger['info'](_0x3fcf('0xb'),_0x4f44c7,_0x3fcf('0xe'));_0x1f00b2(_0xa31928['result'][_0x3fcf('0x12')]);}})[_0x3fcf('0x13')](function(_0x233098){logger[_0x3fcf('0x11')](_0x3fcf('0xb'),_0x4f44c7,_0x233098);_0x3123ab(_0x233098);});});}exports[_0x3fcf('0x14')]=function(_0x5b3db0){var _0x236e0f=this;return new Promise(function(_0x30e605,_0x3a1ea7){return db[_0x3fcf('0x15')]['findAll']({'raw':_0x5b3db0[_0x3fcf('0x16')]?_0x5b3db0[_0x3fcf('0x16')][_0x3fcf('0x17')]===undefined?!![]:![]:!![],'where':_0x5b3db0[_0x3fcf('0x16')]?_0x5b3db0[_0x3fcf('0x16')][_0x3fcf('0x18')]||null:null,'attributes':_0x5b3db0['options']?_0x5b3db0[_0x3fcf('0x16')][_0x3fcf('0x19')]||null:null,'limit':_0x5b3db0[_0x3fcf('0x16')]?_0x5b3db0[_0x3fcf('0x16')]['limit']||null:null,'include':_0x5b3db0[_0x3fcf('0x16')]?_0x5b3db0[_0x3fcf('0x16')][_0x3fcf('0x1a')]?_[_0x3fcf('0x1b')](_0x5b3db0[_0x3fcf('0x16')]['include'],function(_0x4d254d){return{'model':db[_0x4d254d[_0x3fcf('0x1c')]],'as':_0x4d254d['as'],'attributes':_0x4d254d[_0x3fcf('0x19')],'include':_0x4d254d[_0x3fcf('0x1a')]?_[_0x3fcf('0x1b')](_0x4d254d[_0x3fcf('0x1a')],function(_0x187ef3){return{'model':db[_0x187ef3[_0x3fcf('0x1c')]],'as':_0x187ef3['as'],'attributes':_0x187ef3[_0x3fcf('0x19')],'include':_0x187ef3[_0x3fcf('0x1a')]?_[_0x3fcf('0x1b')](_0x187ef3[_0x3fcf('0x1a')],function(_0x53b842){return{'model':db[_0x53b842[_0x3fcf('0x1c')]],'as':_0x53b842['as'],'attributes':_0x53b842[_0x3fcf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3fcf('0xa')](function(_0x17bc91){logger[_0x3fcf('0x1d')]('GetDeskAccount',_0x5b3db0);logger[_0x3fcf('0xc')](_0x3fcf('0x14'),_0x5b3db0,JSON[_0x3fcf('0xf')](_0x17bc91));_0x30e605(_0x17bc91);})['catch'](function(_0x53644f){logger[_0x3fcf('0x11')](_0x3fcf('0x14'),_0x53644f[_0x3fcf('0x12')],_0x5b3db0);_0x3a1ea7(_0x236e0f[_0x3fcf('0x11')](0x1f4,_0x53644f[_0x3fcf('0x12')]));});});};exports[_0x3fcf('0x1e')]=function(_0x110547){var _0x527573=this;return new Promise(function(_0x4ec759,_0x29f23e){return db['DeskAccount'][_0x3fcf('0x1f')]({'raw':_0x110547[_0x3fcf('0x16')]?_0x110547['options'][_0x3fcf('0x17')]===undefined?!![]:![]:!![],'where':_0x110547[_0x3fcf('0x16')]?_0x110547[_0x3fcf('0x16')][_0x3fcf('0x18')]||null:null,'attributes':_0x110547[_0x3fcf('0x16')]?_0x110547[_0x3fcf('0x16')][_0x3fcf('0x19')]||null:null,'include':_0x110547['options']?_0x110547[_0x3fcf('0x16')]['include']?_[_0x3fcf('0x1b')](_0x110547[_0x3fcf('0x16')]['include'],function(_0x19f256){return{'model':db[_0x19f256[_0x3fcf('0x1c')]],'as':_0x19f256['as'],'attributes':_0x19f256['attributes'],'include':_0x19f256['include']?_['map'](_0x19f256[_0x3fcf('0x1a')],function(_0x3d6665){return{'model':db[_0x3d6665[_0x3fcf('0x1c')]],'as':_0x3d6665['as'],'attributes':_0x3d6665['attributes'],'include':_0x3d6665[_0x3fcf('0x1a')]?_[_0x3fcf('0x1b')](_0x3d6665[_0x3fcf('0x1a')],function(_0x49017f){return{'model':db[_0x49017f[_0x3fcf('0x1c')]],'as':_0x49017f['as'],'attributes':_0x49017f[_0x3fcf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3fcf('0xa')](function(_0x3346fe){logger[_0x3fcf('0x1d')](_0x3fcf('0x1e'),_0x110547);logger[_0x3fcf('0xc')](_0x3fcf('0x1e'),_0x110547,JSON[_0x3fcf('0xf')](_0x3346fe));_0x4ec759(_0x3346fe);})[_0x3fcf('0x13')](function(_0x434b36){logger['error']('ShowDeskAccount',_0x434b36['message'],_0x110547);_0x29f23e(_0x527573[_0x3fcf('0x11')](0x1f4,_0x434b36[_0x3fcf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 878064d..f0fb9b4 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 _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(_0x2fb9dd,_0x24ca8a){var _0x123df9=function(_0x5ceb99){while(--_0x5ceb99){_0x2fb9dd['push'](_0x2fb9dd['shift']());}};_0x123df9(++_0x24ca8a);}(_0x008c,0x188));var _0xc008=function(_0x542ab0,_0x4f10d5){_0x542ab0=_0x542ab0-0x0;var _0x165baa=_0x008c[_0x542ab0];return _0x165baa;};'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 +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(_0x422c1c,_0x1861e8){var _0x452365=function(_0x5713a9){while(--_0x5713a9){_0x422c1c['push'](_0x422c1c['shift']());}};_0x452365(++_0x1861e8);}(_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/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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 44665dd..1ef997a 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 _0x4c62=['STRING'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x4c62,0x17f));var _0x24c6=function(_0x43b9fd,_0x5c3b2a){_0x43b9fd=_0x43b9fd-0x0;var _0x4f9b48=_0x4c62[_0x43b9fd];return _0x4f9b48;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x24c6('0x0')]},'description':{'type':Sequelize[_0x24c6('0x0')]}}; \ No newline at end of file +var _0xc28c=['STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc28c,0x149));var _0xcc28=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xc28c[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcc28('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8fb5e81..a8fb68f 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 _0x348f=['send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','body','getFields','findOne','pick','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x348f,0x16e));var _0xf348=function(_0x2c466f,_0x3692e1){_0x2c466f=_0x2c466f-0x0;var _0x46c775=_0x348f[_0x2c466f];return _0x46c775;};'use strict';var emlformat=require(_0xf348('0x0'));var rimraf=require(_0xf348('0x1'));var zipdir=require(_0xf348('0x2'));var jsonpatch=require(_0xf348('0x3'));var rp=require('request-promise');var moment=require(_0xf348('0x4'));var BPromise=require(_0xf348('0x5'));var Mustache=require('mustache');var util=require(_0xf348('0x6'));var path=require(_0xf348('0x7'));var sox=require(_0xf348('0x8'));var csv=require(_0xf348('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf348('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf348('0x9'));var querystring=require(_0xf348('0xb'));var Papa=require(_0xf348('0xc'));var Redis=require(_0xf348('0xd'));var authService=require(_0xf348('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf348('0xf'));var hardwareService=require(_0xf348('0x10'));var logger=require(_0xf348('0x11'))('api');var utils=require(_0xf348('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf348('0x13'));var db=require(_0xf348('0x14'))['db'];function respondWithStatusCode(_0x4c81ef,_0x406d0b){_0x406d0b=_0x406d0b||0xcc;return function(_0xe4594){if(_0xe4594){return _0x4c81ef[_0xf348('0x15')](_0x406d0b);}return _0x4c81ef[_0xf348('0x16')](_0x406d0b)['end']();};}function respondWithResult(_0x5e3008,_0x1dd878){_0x1dd878=_0x1dd878||0xc8;return function(_0x3bc1dc){if(_0x3bc1dc){return _0x5e3008[_0xf348('0x16')](_0x1dd878)[_0xf348('0x17')](_0x3bc1dc);}};}function respondWithFilteredResult(_0x3f6b59,_0x4d9203){return function(_0x3907a3){if(_0x3907a3){var _0x481703=typeof _0x4d9203['offset']===_0xf348('0x18')&&typeof _0x4d9203['limit']===_0xf348('0x18');var _0x45e9ae=_0x3907a3[_0xf348('0x19')];var _0x5662a8=_0x481703?0x0:_0x4d9203[_0xf348('0x1a')];var _0x3ee0e8=_0x481703?_0x3907a3['count']:_0x4d9203[_0xf348('0x1a')]+_0x4d9203[_0xf348('0x1b')];var _0x15994d;if(_0x3ee0e8>=_0x45e9ae){_0x3ee0e8=_0x45e9ae;_0x15994d=0xc8;}else{_0x15994d=0xce;}_0x3f6b59[_0xf348('0x16')](_0x15994d);return _0x3f6b59[_0xf348('0x1c')](_0xf348('0x1d'),_0x5662a8+'-'+_0x3ee0e8+'/'+_0x45e9ae)[_0xf348('0x17')](_0x3907a3);}return null;};}function patchUpdates(_0x126214){return function(_0x309726){try{jsonpatch[_0xf348('0x1e')](_0x309726,_0x126214,!![]);}catch(_0x316c7c){return BPromise[_0xf348('0x1f')](_0x316c7c);}return _0x309726[_0xf348('0x20')]();};}function saveUpdates(_0x11b94f,_0x16c80d){return function(_0x11871a){if(_0x11871a){return _0x11871a[_0xf348('0x21')](_0x11b94f)['then'](function(_0x514338){return _0x514338;});}return null;};}function removeEntity(_0x4e8a0a,_0x51c10c){return function(_0x3eec19){if(_0x3eec19){return _0x3eec19[_0xf348('0x22')]()[_0xf348('0x23')](function(){_0x4e8a0a[_0xf348('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da69b,_0x44aef5){return function(_0x3e3113){if(!_0x3e3113){_0x2da69b[_0xf348('0x15')](0x194);}return _0x3e3113;};}function handleError(_0x239035,_0x981665){_0x981665=_0x981665||0x1f4;return function(_0x2a4401){logger[_0xf348('0x24')](_0x2a4401[_0xf348('0x25')]);if(_0x2a4401[_0xf348('0x26')]){delete _0x2a4401['name'];}_0x239035[_0xf348('0x16')](_0x981665)[_0xf348('0x27')](_0x2a4401);};}exports[_0xf348('0x28')]=function(_0x4a5d58,_0x12064c){var _0x20e703={},_0x1d20d3={},_0x31ade3={'count':0x0,'rows':[]};var _0x67ed85=_['map'](db['DeskConfiguration'][_0xf348('0x29')],function(_0x1f6e09){return{'name':_0x1f6e09['fieldName'],'type':_0x1f6e09[_0xf348('0x2a')][_0xf348('0x2b')]};});_0x1d20d3['model']=_[_0xf348('0x2c')](_0x67ed85,_0xf348('0x26'));_0x1d20d3[_0xf348('0x2d')]=_[_0xf348('0x2e')](_0x4a5d58[_0xf348('0x2d')]);_0x1d20d3['filters']=_[_0xf348('0x2f')](_0x1d20d3[_0xf348('0x30')],_0x1d20d3[_0xf348('0x2d')]);_0x20e703[_0xf348('0x31')]=_['intersection'](_0x1d20d3[_0xf348('0x30')],qs['fields'](_0x4a5d58[_0xf348('0x2d')][_0xf348('0x32')]));_0x20e703['attributes']=_0x20e703['attributes'][_0xf348('0x33')]?_0x20e703[_0xf348('0x31')]:_0x1d20d3['model'];if(!_0x4a5d58[_0xf348('0x2d')][_0xf348('0x34')](_0xf348('0x35'))){_0x20e703[_0xf348('0x1b')]=qs[_0xf348('0x1b')](_0x4a5d58['query']['limit']);_0x20e703['offset']=qs[_0xf348('0x1a')](_0x4a5d58[_0xf348('0x2d')][_0xf348('0x1a')]);}_0x20e703[_0xf348('0x36')]=qs['sort'](_0x4a5d58[_0xf348('0x2d')][_0xf348('0x37')]);_0x20e703[_0xf348('0x38')]=qs[_0xf348('0x39')](_['pick'](_0x4a5d58['query'],_0x1d20d3[_0xf348('0x39')]),_0x67ed85);if(_0x4a5d58['query'][_0xf348('0x3a')]){_0x20e703['where']=_[_0xf348('0x3b')](_0x20e703[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0x67ed85,function(_0x3950e2){if(_0x3950e2[_0xf348('0x2a')]!==_0xf348('0x3c')){var _0x58bca1={};_0x58bca1[_0x3950e2[_0xf348('0x26')]]={'$like':'%'+_0x4a5d58['query'][_0xf348('0x3a')]+'%'};return _0x58bca1;}})});}_0x20e703=_[_0xf348('0x3b')]({},_0x20e703,_0x4a5d58[_0xf348('0x3d')]);var _0x51d8ec={'where':_0x20e703[_0xf348('0x38')]};return db[_0xf348('0x3e')][_0xf348('0x19')](_0x51d8ec)[_0xf348('0x23')](function(_0x4f1a59){_0x31ade3['count']=_0x4f1a59;if(_0x4a5d58['query'][_0xf348('0x3f')]){_0x20e703[_0xf348('0x40')]=[{'all':!![]}];}return db[_0xf348('0x3e')][_0xf348('0x41')](_0x20e703);})[_0xf348('0x23')](function(_0x265c19){_0x31ade3[_0xf348('0x42')]=_0x265c19;return _0x31ade3;})[_0xf348('0x23')](respondWithFilteredResult(_0x12064c,_0x20e703))[_0xf348('0x43')](handleError(_0x12064c,null));};exports[_0xf348('0x44')]=function(_0x490f32,_0x1d763c){var _0x9a1f47={'raw':![],'where':{'id':_0x490f32[_0xf348('0x45')]['id']}},_0x584b53={};_0x584b53[_0xf348('0x30')]=_[_0xf348('0x2e')](db[_0xf348('0x3e')][_0xf348('0x29')]);_0x584b53[_0xf348('0x2d')]=_['keys'](_0x490f32[_0xf348('0x2d')]);_0x584b53[_0xf348('0x39')]=_['intersection'](_0x584b53[_0xf348('0x30')],_0x584b53['query']);_0x9a1f47[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x584b53[_0xf348('0x30')],qs[_0xf348('0x32')](_0x490f32[_0xf348('0x2d')][_0xf348('0x32')]));_0x9a1f47[_0xf348('0x31')]=_0x9a1f47[_0xf348('0x31')]['length']?_0x9a1f47['attributes']:_0x584b53['model'];if(_0x490f32[_0xf348('0x2d')][_0xf348('0x3f')]){_0x9a1f47[_0xf348('0x40')]=[{'all':!![]}];}_0x9a1f47=_[_0xf348('0x3b')]({},_0x9a1f47,_0x490f32[_0xf348('0x3d')]);return db[_0xf348('0x3e')][_0xf348('0x46')](_0x9a1f47)['then'](handleEntityNotFound(_0x1d763c,null))['then'](respondWithResult(_0x1d763c,null))[_0xf348('0x43')](handleError(_0x1d763c,null));};exports['create']=function(_0x4db7b6,_0x33774e){return db['DeskConfiguration']['create'](_0x4db7b6[_0xf348('0x47')],{})[_0xf348('0x23')](respondWithResult(_0x33774e,0xc9))[_0xf348('0x43')](handleError(_0x33774e,null));};exports[_0xf348('0x21')]=function(_0x4927f0,_0x7b3559){if(_0x4927f0[_0xf348('0x47')]['id']){delete _0x4927f0['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x4927f0['params']['id']}})['then'](handleEntityNotFound(_0x7b3559,null))[_0xf348('0x23')](saveUpdates(_0x4927f0[_0xf348('0x47')],null))[_0xf348('0x23')](respondWithResult(_0x7b3559,null))['catch'](handleError(_0x7b3559,null));};exports[_0xf348('0x22')]=function(_0x490e41,_0x20f231){return db[_0xf348('0x3e')]['find']({'where':{'id':_0x490e41[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x20f231,null))[_0xf348('0x23')](removeEntity(_0x20f231,null))[_0xf348('0x43')](handleError(_0x20f231,null));};exports[_0xf348('0x48')]=function(_0x35c400,_0x2fc883,_0x4231dc){var _0x3777a9={};var _0x25cd6d={};var _0x125286;var _0x3d0f7a;return db['DeskConfiguration'][_0xf348('0x49')]({'where':{'id':_0x35c400['params']['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x2fc883,null))[_0xf348('0x23')](function(_0x2dfde8){if(_0x2dfde8){_0x125286=_0x2dfde8;_0x25cd6d[_0xf348('0x30')]=_['keys'](db['DeskField'][_0xf348('0x29')]);_0x25cd6d['query']=_[_0xf348('0x2e')](_0x35c400[_0xf348('0x2d')]);_0x25cd6d['filters']=_[_0xf348('0x2f')](_0x25cd6d[_0xf348('0x30')],_0x25cd6d[_0xf348('0x2d')]);_0x3777a9[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x25cd6d[_0xf348('0x30')],qs['fields'](_0x35c400[_0xf348('0x2d')][_0xf348('0x32')]));_0x3777a9[_0xf348('0x31')]=_0x3777a9[_0xf348('0x31')][_0xf348('0x33')]?_0x3777a9['attributes']:_0x25cd6d[_0xf348('0x30')];_0x3777a9[_0xf348('0x36')]=qs[_0xf348('0x37')](_0x35c400[_0xf348('0x2d')]['sort']);_0x3777a9[_0xf348('0x38')]=qs[_0xf348('0x39')](_[_0xf348('0x4a')](_0x35c400['query'],_0x25cd6d[_0xf348('0x39')]));if(_0x35c400[_0xf348('0x2d')]['filter']){_0x3777a9[_0xf348('0x38')]=_[_0xf348('0x3b')](_0x3777a9[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0x3777a9[_0xf348('0x31')],function(_0x8cf7e1){var _0x57c678={};_0x57c678[_0x8cf7e1]={'$like':'%'+_0x35c400[_0xf348('0x2d')]['filter']+'%'};return _0x57c678;})});}_0x3777a9=_[_0xf348('0x3b')]({},_0x3777a9,_0x35c400['options']);return _0x125286['getFields'](_0x3777a9);}})[_0xf348('0x23')](function(_0x155c3e){if(_0x155c3e){_0x3d0f7a=_0x155c3e[_0xf348('0x33')];if(!_0x35c400['query'][_0xf348('0x34')]('nolimit')){_0x3777a9[_0xf348('0x1b')]=qs[_0xf348('0x1b')](_0x35c400[_0xf348('0x2d')][_0xf348('0x1b')]);_0x3777a9[_0xf348('0x1a')]=qs[_0xf348('0x1a')](_0x35c400[_0xf348('0x2d')]['offset']);}return _0x125286[_0xf348('0x48')](_0x3777a9);}})[_0xf348('0x23')](function(_0x1087ea){if(_0x1087ea){return _0x1087ea?{'count':_0x3d0f7a,'rows':_0x1087ea}:null;}})['then'](respondWithResult(_0x2fc883,null))[_0xf348('0x43')](handleError(_0x2fc883,null));};exports[_0xf348('0x4b')]=function(_0x579d63,_0x448032,_0x39be78){var _0xc9efe2={};var _0x28ec5e={};var _0x2c7f62;var _0x20a958;return db[_0xf348('0x3e')]['findOne']({'where':{'id':_0x579d63[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x448032,null))[_0xf348('0x23')](function(_0x53f0db){if(_0x53f0db){_0x2c7f62=_0x53f0db;_0x28ec5e[_0xf348('0x30')]=_['keys'](db[_0xf348('0x4c')]['rawAttributes']);_0x28ec5e[_0xf348('0x2d')]=_['keys'](_0x579d63['query']);_0x28ec5e[_0xf348('0x39')]=_[_0xf348('0x2f')](_0x28ec5e[_0xf348('0x30')],_0x28ec5e[_0xf348('0x2d')]);_0xc9efe2[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x28ec5e[_0xf348('0x30')],qs[_0xf348('0x32')](_0x579d63['query'][_0xf348('0x32')]));_0xc9efe2['attributes']=_0xc9efe2[_0xf348('0x31')][_0xf348('0x33')]?_0xc9efe2['attributes']:_0x28ec5e[_0xf348('0x30')];_0xc9efe2[_0xf348('0x36')]=qs[_0xf348('0x37')](_0x579d63[_0xf348('0x2d')][_0xf348('0x37')]);_0xc9efe2[_0xf348('0x38')]=qs[_0xf348('0x39')](_[_0xf348('0x4a')](_0x579d63[_0xf348('0x2d')],_0x28ec5e['filters']));if(_0x579d63[_0xf348('0x2d')]['filter']){_0xc9efe2['where']=_[_0xf348('0x3b')](_0xc9efe2[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0xc9efe2[_0xf348('0x31')],function(_0x4cb6c4){var _0x2e85a1={};_0x2e85a1[_0x4cb6c4]={'$like':'%'+_0x579d63[_0xf348('0x2d')][_0xf348('0x3a')]+'%'};return _0x2e85a1;})});}_0xc9efe2=_[_0xf348('0x3b')]({},_0xc9efe2,_0x579d63[_0xf348('0x3d')]);return _0x2c7f62[_0xf348('0x4b')](_0xc9efe2);}})[_0xf348('0x23')](function(_0xd278e7){if(_0xd278e7){_0x20a958=_0xd278e7[_0xf348('0x33')];if(!_0x579d63[_0xf348('0x2d')][_0xf348('0x34')](_0xf348('0x35'))){_0xc9efe2[_0xf348('0x1b')]=qs[_0xf348('0x1b')](_0x579d63[_0xf348('0x2d')]['limit']);_0xc9efe2[_0xf348('0x1a')]=qs[_0xf348('0x1a')](_0x579d63['query'][_0xf348('0x1a')]);}return _0x2c7f62['getSubjects'](_0xc9efe2);}})[_0xf348('0x23')](function(_0x13a330){if(_0x13a330){return _0x13a330?{'count':_0x20a958,'rows':_0x13a330}:null;}})[_0xf348('0x23')](respondWithResult(_0x448032,null))[_0xf348('0x43')](handleError(_0x448032,null));};exports['getDescriptions']=function(_0x190d7e,_0x4ab331,_0x421d73){var _0x3c311c={};var _0x3296b7={};var _0x1bac9f;var _0x2e1ec4;return db['DeskConfiguration'][_0xf348('0x49')]({'where':{'id':_0x190d7e[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x4ab331,null))['then'](function(_0x4914b0){if(_0x4914b0){_0x1bac9f=_0x4914b0;_0x3296b7['model']=_['keys'](db[_0xf348('0x4c')][_0xf348('0x29')]);_0x3296b7[_0xf348('0x2d')]=_[_0xf348('0x2e')](_0x190d7e['query']);_0x3296b7[_0xf348('0x39')]=_[_0xf348('0x2f')](_0x3296b7['model'],_0x3296b7['query']);_0x3c311c[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x3296b7[_0xf348('0x30')],qs[_0xf348('0x32')](_0x190d7e[_0xf348('0x2d')][_0xf348('0x32')]));_0x3c311c[_0xf348('0x31')]=_0x3c311c[_0xf348('0x31')][_0xf348('0x33')]?_0x3c311c[_0xf348('0x31')]:_0x3296b7[_0xf348('0x30')];_0x3c311c['order']=qs[_0xf348('0x37')](_0x190d7e[_0xf348('0x2d')]['sort']);_0x3c311c['where']=qs[_0xf348('0x39')](_['pick'](_0x190d7e[_0xf348('0x2d')],_0x3296b7[_0xf348('0x39')]));if(_0x190d7e[_0xf348('0x2d')][_0xf348('0x3a')]){_0x3c311c[_0xf348('0x38')]=_[_0xf348('0x3b')](_0x3c311c[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0x3c311c[_0xf348('0x31')],function(_0x5f446b){var _0x93aeca={};_0x93aeca[_0x5f446b]={'$like':'%'+_0x190d7e[_0xf348('0x2d')][_0xf348('0x3a')]+'%'};return _0x93aeca;})});}_0x3c311c=_[_0xf348('0x3b')]({},_0x3c311c,_0x190d7e[_0xf348('0x3d')]);return _0x1bac9f[_0xf348('0x4d')](_0x3c311c);}})['then'](function(_0x294429){if(_0x294429){_0x2e1ec4=_0x294429[_0xf348('0x33')];if(!_0x190d7e[_0xf348('0x2d')][_0xf348('0x34')](_0xf348('0x35'))){_0x3c311c['limit']=qs[_0xf348('0x1b')](_0x190d7e['query']['limit']);_0x3c311c[_0xf348('0x1a')]=qs['offset'](_0x190d7e[_0xf348('0x2d')]['offset']);}return _0x1bac9f[_0xf348('0x4d')](_0x3c311c);}})[_0xf348('0x23')](function(_0x34e2ba){if(_0x34e2ba){return _0x34e2ba?{'count':_0x2e1ec4,'rows':_0x34e2ba}:null;}})[_0xf348('0x23')](respondWithResult(_0x4ab331,null))['catch'](handleError(_0x4ab331,null));};exports[_0xf348('0x4e')]=function(_0x137938,_0x41c376,_0x4294a7){var _0x3e1b87={};var _0xf7405e={};var _0x3f6182;var _0x10d707;return db[_0xf348('0x3e')][_0xf348('0x49')]({'where':{'id':_0x137938['params']['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x41c376,null))[_0xf348('0x23')](function(_0x3a2978){if(_0x3a2978){_0x3f6182=_0x3a2978;_0xf7405e['model']=_['keys'](db[_0xf348('0x4f')][_0xf348('0x29')]);_0xf7405e[_0xf348('0x2d')]=_[_0xf348('0x2e')](_0x137938['query']);_0xf7405e[_0xf348('0x39')]=_[_0xf348('0x2f')](_0xf7405e[_0xf348('0x30')],_0xf7405e[_0xf348('0x2d')]);_0x3e1b87[_0xf348('0x31')]=_[_0xf348('0x2f')](_0xf7405e['model'],qs[_0xf348('0x32')](_0x137938[_0xf348('0x2d')][_0xf348('0x32')]));_0x3e1b87[_0xf348('0x31')]=_0x3e1b87[_0xf348('0x31')][_0xf348('0x33')]?_0x3e1b87[_0xf348('0x31')]:_0xf7405e[_0xf348('0x30')];_0x3e1b87[_0xf348('0x36')]=qs[_0xf348('0x37')](_0x137938['query'][_0xf348('0x37')]);_0x3e1b87['where']=qs[_0xf348('0x39')](_[_0xf348('0x4a')](_0x137938[_0xf348('0x2d')],_0xf7405e['filters']));if(_0x137938[_0xf348('0x2d')][_0xf348('0x3a')]){_0x3e1b87[_0xf348('0x38')]=_['merge'](_0x3e1b87[_0xf348('0x38')],{'$or':_['map'](_0x3e1b87[_0xf348('0x31')],function(_0x4f1450){var _0x43c2fb={};_0x43c2fb[_0x4f1450]={'$like':'%'+_0x137938[_0xf348('0x2d')][_0xf348('0x3a')]+'%'};return _0x43c2fb;})});}_0x3e1b87=_[_0xf348('0x3b')]({},_0x3e1b87,_0x137938[_0xf348('0x3d')]);return _0x3f6182[_0xf348('0x4e')](_0x3e1b87);}})[_0xf348('0x23')](function(_0x20fd94){if(_0x20fd94){_0x10d707=_0x20fd94['length'];if(!_0x137938[_0xf348('0x2d')]['hasOwnProperty'](_0xf348('0x35'))){_0x3e1b87['limit']=qs[_0xf348('0x1b')](_0x137938[_0xf348('0x2d')]['limit']);_0x3e1b87[_0xf348('0x1a')]=qs[_0xf348('0x1a')](_0x137938[_0xf348('0x2d')][_0xf348('0x1a')]);}return _0x3f6182[_0xf348('0x4e')](_0x3e1b87);}})[_0xf348('0x23')](function(_0x403de0){if(_0x403de0){return _0x403de0?{'count':_0x10d707,'rows':_0x403de0}:null;}})[_0xf348('0x23')](respondWithResult(_0x41c376,null))['catch'](handleError(_0x41c376,null));};exports[_0xf348('0x50')]=function(_0x479a41,_0x233690,_0x16bc55){if(_0x479a41['body']['id']){delete _0x479a41[_0xf348('0x47')]['id'];}return db[_0xf348('0x3e')][_0xf348('0x49')]({'where':{'id':_0x479a41[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x233690,null))[_0xf348('0x23')](function(_0x459b75){if(_0x459b75){return _0x459b75['setTags'](_0x479a41['body']['ids']||[]);}return null;})[_0xf348('0x23')](respondWithResult(_0x233690,null))['catch'](handleError(_0x233690,null));}; \ No newline at end of file +var _0x5b7a=['fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','length','includeAll','include','create','body','update','params','getFields','findOne','order','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','mustache','util','path','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','error','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection'];(function(_0x2549ec,_0x104b04){var _0x34db1c=function(_0xec466b){while(--_0xec466b){_0x2549ec['push'](_0x2549ec['shift']());}};_0x34db1c(++_0x104b04);}(_0x5b7a,0x1a9));var _0xa5b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5b7a[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xa5b7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa5b7('0x1'));var rp=require(_0xa5b7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5b7('0x3'));var util=require(_0xa5b7('0x4'));var path=require(_0xa5b7('0x5'));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(_0xa5b7('0x6'));var crypto=require(_0xa5b7('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xa5b7('0x8'));var toCsv=require(_0xa5b7('0x9'));var querystring=require('querystring');var Papa=require(_0xa5b7('0xa'));var Redis=require(_0xa5b7('0xb'));var authService=require(_0xa5b7('0xc'));var qs=require(_0xa5b7('0xd'));var as=require(_0xa5b7('0xe'));var hardwareService=require(_0xa5b7('0xf'));var logger=require(_0xa5b7('0x10'))(_0xa5b7('0x11'));var utils=require(_0xa5b7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa5b7('0x13'));var db=require(_0xa5b7('0x14'))['db'];function respondWithStatusCode(_0x392dcc,_0x33b75d){_0x33b75d=_0x33b75d||0xcc;return function(_0x1d7de5){if(_0x1d7de5){return _0x392dcc[_0xa5b7('0x15')](_0x33b75d);}return _0x392dcc['status'](_0x33b75d)[_0xa5b7('0x16')]();};}function respondWithResult(_0x4d9bc9,_0x2406b0){_0x2406b0=_0x2406b0||0xc8;return function(_0x3686e4){if(_0x3686e4){return _0x4d9bc9[_0xa5b7('0x17')](_0x2406b0)[_0xa5b7('0x18')](_0x3686e4);}};}function respondWithFilteredResult(_0x2a3b89,_0x58c2f2){return function(_0x2008f1){if(_0x2008f1){var _0x2fcfcb=typeof _0x58c2f2[_0xa5b7('0x19')]===_0xa5b7('0x1a')&&typeof _0x58c2f2[_0xa5b7('0x1b')]===_0xa5b7('0x1a');var _0x3fb4d0=_0x2008f1[_0xa5b7('0x1c')];var _0x9e30ff=_0x2fcfcb?0x0:_0x58c2f2['offset'];var _0x26fb8e=_0x2fcfcb?_0x2008f1[_0xa5b7('0x1c')]:_0x58c2f2[_0xa5b7('0x19')]+_0x58c2f2[_0xa5b7('0x1b')];var _0x413870;if(_0x26fb8e>=_0x3fb4d0){_0x26fb8e=_0x3fb4d0;_0x413870=0xc8;}else{_0x413870=0xce;}_0x2a3b89['status'](_0x413870);return _0x2a3b89['set'](_0xa5b7('0x1d'),_0x9e30ff+'-'+_0x26fb8e+'/'+_0x3fb4d0)[_0xa5b7('0x18')](_0x2008f1);}return null;};}function patchUpdates(_0x384b6a){return function(_0x4fc408){try{jsonpatch['apply'](_0x4fc408,_0x384b6a,!![]);}catch(_0x31d0a3){return BPromise[_0xa5b7('0x1e')](_0x31d0a3);}return _0x4fc408['save']();};}function saveUpdates(_0x3b2a7b,_0x3ca40a){return function(_0x409f1c){if(_0x409f1c){return _0x409f1c['update'](_0x3b2a7b)[_0xa5b7('0x1f')](function(_0xe53cc7){return _0xe53cc7;});}return null;};}function removeEntity(_0x3f19e7,_0x246332){return function(_0x358be8){if(_0x358be8){return _0x358be8[_0xa5b7('0x20')]()['then'](function(){_0x3f19e7[_0xa5b7('0x17')](0xcc)[_0xa5b7('0x16')]();});}};}function handleEntityNotFound(_0x4aa9a0,_0x5d6852){return function(_0x42fdc8){if(!_0x42fdc8){_0x4aa9a0[_0xa5b7('0x15')](0x194);}return _0x42fdc8;};}function handleError(_0x1a5527,_0x142697){_0x142697=_0x142697||0x1f4;return function(_0x1d8e03){logger[_0xa5b7('0x21')](_0x1d8e03['stack']);if(_0x1d8e03['name']){delete _0x1d8e03[_0xa5b7('0x22')];}_0x1a5527[_0xa5b7('0x17')](_0x142697)[_0xa5b7('0x23')](_0x1d8e03);};}exports[_0xa5b7('0x24')]=function(_0x3e7885,_0xdf3c79){var _0x1bea58={},_0x13c2f1={},_0x137c06={'count':0x0,'rows':[]};var _0x11e078=_['map'](db[_0xa5b7('0x25')][_0xa5b7('0x26')],function(_0x12c5e1){return{'name':_0x12c5e1[_0xa5b7('0x27')],'type':_0x12c5e1[_0xa5b7('0x28')][_0xa5b7('0x29')]};});_0x13c2f1[_0xa5b7('0x2a')]=_[_0xa5b7('0x2b')](_0x11e078,_0xa5b7('0x22'));_0x13c2f1[_0xa5b7('0x2c')]=_[_0xa5b7('0x2d')](_0x3e7885[_0xa5b7('0x2c')]);_0x13c2f1[_0xa5b7('0x2e')]=_['intersection'](_0x13c2f1[_0xa5b7('0x2a')],_0x13c2f1[_0xa5b7('0x2c')]);_0x1bea58[_0xa5b7('0x2f')]=_[_0xa5b7('0x30')](_0x13c2f1[_0xa5b7('0x2a')],qs[_0xa5b7('0x31')](_0x3e7885[_0xa5b7('0x2c')][_0xa5b7('0x31')]));_0x1bea58['attributes']=_0x1bea58[_0xa5b7('0x2f')]['length']?_0x1bea58[_0xa5b7('0x2f')]:_0x13c2f1['model'];if(!_0x3e7885[_0xa5b7('0x2c')][_0xa5b7('0x32')](_0xa5b7('0x33'))){_0x1bea58[_0xa5b7('0x1b')]=qs['limit'](_0x3e7885['query']['limit']);_0x1bea58[_0xa5b7('0x19')]=qs[_0xa5b7('0x19')](_0x3e7885['query'][_0xa5b7('0x19')]);}_0x1bea58['order']=qs[_0xa5b7('0x34')](_0x3e7885['query'][_0xa5b7('0x34')]);_0x1bea58[_0xa5b7('0x35')]=qs[_0xa5b7('0x2e')](_[_0xa5b7('0x36')](_0x3e7885[_0xa5b7('0x2c')],_0x13c2f1[_0xa5b7('0x2e')]),_0x11e078);if(_0x3e7885[_0xa5b7('0x2c')][_0xa5b7('0x37')]){_0x1bea58[_0xa5b7('0x35')]=_[_0xa5b7('0x38')](_0x1bea58[_0xa5b7('0x35')],{'$or':_[_0xa5b7('0x2b')](_0x11e078,function(_0x1481ac){if(_0x1481ac[_0xa5b7('0x28')]!==_0xa5b7('0x39')){var _0x3aa2c4={};_0x3aa2c4[_0x1481ac['name']]={'$like':'%'+_0x3e7885['query'][_0xa5b7('0x37')]+'%'};return _0x3aa2c4;}})});}_0x1bea58=_[_0xa5b7('0x38')]({},_0x1bea58,_0x3e7885[_0xa5b7('0x3a')]);var _0x2933e4={'where':_0x1bea58[_0xa5b7('0x35')]};return db[_0xa5b7('0x25')]['count'](_0x2933e4)[_0xa5b7('0x1f')](function(_0xe7d538){_0x137c06[_0xa5b7('0x1c')]=_0xe7d538;if(_0x3e7885[_0xa5b7('0x2c')]['includeAll']){_0x1bea58['include']=[{'all':!![]}];}return db[_0xa5b7('0x25')][_0xa5b7('0x3b')](_0x1bea58);})[_0xa5b7('0x1f')](function(_0x2fdb60){_0x137c06['rows']=_0x2fdb60;return _0x137c06;})['then'](respondWithFilteredResult(_0xdf3c79,_0x1bea58))[_0xa5b7('0x3c')](handleError(_0xdf3c79,null));};exports[_0xa5b7('0x3d')]=function(_0x363d01,_0x220ac0){var _0x5d5da2={'raw':![],'where':{'id':_0x363d01['params']['id']}},_0xdcdb6c={};_0xdcdb6c[_0xa5b7('0x2a')]=_[_0xa5b7('0x2d')](db['DeskConfiguration'][_0xa5b7('0x26')]);_0xdcdb6c[_0xa5b7('0x2c')]=_[_0xa5b7('0x2d')](_0x363d01['query']);_0xdcdb6c[_0xa5b7('0x2e')]=_[_0xa5b7('0x30')](_0xdcdb6c[_0xa5b7('0x2a')],_0xdcdb6c[_0xa5b7('0x2c')]);_0x5d5da2[_0xa5b7('0x2f')]=_[_0xa5b7('0x30')](_0xdcdb6c[_0xa5b7('0x2a')],qs[_0xa5b7('0x31')](_0x363d01[_0xa5b7('0x2c')][_0xa5b7('0x31')]));_0x5d5da2[_0xa5b7('0x2f')]=_0x5d5da2[_0xa5b7('0x2f')][_0xa5b7('0x3e')]?_0x5d5da2[_0xa5b7('0x2f')]:_0xdcdb6c[_0xa5b7('0x2a')];if(_0x363d01[_0xa5b7('0x2c')][_0xa5b7('0x3f')]){_0x5d5da2[_0xa5b7('0x40')]=[{'all':!![]}];}_0x5d5da2=_[_0xa5b7('0x38')]({},_0x5d5da2,_0x363d01[_0xa5b7('0x3a')]);return db[_0xa5b7('0x25')]['find'](_0x5d5da2)[_0xa5b7('0x1f')](handleEntityNotFound(_0x220ac0,null))[_0xa5b7('0x1f')](respondWithResult(_0x220ac0,null))[_0xa5b7('0x3c')](handleError(_0x220ac0,null));};exports[_0xa5b7('0x41')]=function(_0x121865,_0x1b93e9){return db['DeskConfiguration'][_0xa5b7('0x41')](_0x121865[_0xa5b7('0x42')],{})[_0xa5b7('0x1f')](respondWithResult(_0x1b93e9,0xc9))[_0xa5b7('0x3c')](handleError(_0x1b93e9,null));};exports[_0xa5b7('0x43')]=function(_0x3ffdf5,_0x5c7673){if(_0x3ffdf5['body']['id']){delete _0x3ffdf5[_0xa5b7('0x42')]['id'];}return db[_0xa5b7('0x25')]['find']({'where':{'id':_0x3ffdf5['params']['id']}})[_0xa5b7('0x1f')](handleEntityNotFound(_0x5c7673,null))['then'](saveUpdates(_0x3ffdf5[_0xa5b7('0x42')],null))[_0xa5b7('0x1f')](respondWithResult(_0x5c7673,null))['catch'](handleError(_0x5c7673,null));};exports[_0xa5b7('0x20')]=function(_0x27d027,_0x343420){return db['DeskConfiguration']['find']({'where':{'id':_0x27d027[_0xa5b7('0x44')]['id']}})[_0xa5b7('0x1f')](handleEntityNotFound(_0x343420,null))['then'](removeEntity(_0x343420,null))[_0xa5b7('0x3c')](handleError(_0x343420,null));};exports[_0xa5b7('0x45')]=function(_0x5d0d77,_0x17a2b3,_0x345944){var _0x41fe3c={};var _0x200c46={};var _0x5a0be8;var _0x27de72;return db[_0xa5b7('0x25')][_0xa5b7('0x46')]({'where':{'id':_0x5d0d77[_0xa5b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x17a2b3,null))[_0xa5b7('0x1f')](function(_0x29403c){if(_0x29403c){_0x5a0be8=_0x29403c;_0x200c46[_0xa5b7('0x2a')]=_[_0xa5b7('0x2d')](db['DeskField'][_0xa5b7('0x26')]);_0x200c46[_0xa5b7('0x2c')]=_['keys'](_0x5d0d77[_0xa5b7('0x2c')]);_0x200c46[_0xa5b7('0x2e')]=_['intersection'](_0x200c46[_0xa5b7('0x2a')],_0x200c46['query']);_0x41fe3c[_0xa5b7('0x2f')]=_['intersection'](_0x200c46[_0xa5b7('0x2a')],qs[_0xa5b7('0x31')](_0x5d0d77['query']['fields']));_0x41fe3c[_0xa5b7('0x2f')]=_0x41fe3c[_0xa5b7('0x2f')][_0xa5b7('0x3e')]?_0x41fe3c[_0xa5b7('0x2f')]:_0x200c46['model'];_0x41fe3c[_0xa5b7('0x47')]=qs[_0xa5b7('0x34')](_0x5d0d77['query'][_0xa5b7('0x34')]);_0x41fe3c['where']=qs[_0xa5b7('0x2e')](_[_0xa5b7('0x36')](_0x5d0d77[_0xa5b7('0x2c')],_0x200c46[_0xa5b7('0x2e')]));if(_0x5d0d77[_0xa5b7('0x2c')][_0xa5b7('0x37')]){_0x41fe3c['where']=_[_0xa5b7('0x38')](_0x41fe3c[_0xa5b7('0x35')],{'$or':_[_0xa5b7('0x2b')](_0x41fe3c['attributes'],function(_0x38a879){var _0x11ef70={};_0x11ef70[_0x38a879]={'$like':'%'+_0x5d0d77[_0xa5b7('0x2c')]['filter']+'%'};return _0x11ef70;})});}_0x41fe3c=_[_0xa5b7('0x38')]({},_0x41fe3c,_0x5d0d77['options']);return _0x5a0be8[_0xa5b7('0x45')](_0x41fe3c);}})[_0xa5b7('0x1f')](function(_0x3dbe57){if(_0x3dbe57){_0x27de72=_0x3dbe57['length'];if(!_0x5d0d77[_0xa5b7('0x2c')]['hasOwnProperty'](_0xa5b7('0x33'))){_0x41fe3c[_0xa5b7('0x1b')]=qs['limit'](_0x5d0d77[_0xa5b7('0x2c')]['limit']);_0x41fe3c['offset']=qs[_0xa5b7('0x19')](_0x5d0d77[_0xa5b7('0x2c')]['offset']);}return _0x5a0be8['getFields'](_0x41fe3c);}})['then'](function(_0x5347a6){if(_0x5347a6){return _0x5347a6?{'count':_0x27de72,'rows':_0x5347a6}:null;}})[_0xa5b7('0x1f')](respondWithResult(_0x17a2b3,null))[_0xa5b7('0x3c')](handleError(_0x17a2b3,null));};exports['getSubjects']=function(_0x18f988,_0x2fc43d,_0x2031a5){var _0x22140f={};var _0x11e098={};var _0x37a0a8;var _0x542b1d;return db[_0xa5b7('0x25')][_0xa5b7('0x46')]({'where':{'id':_0x18f988[_0xa5b7('0x44')]['id']}})[_0xa5b7('0x1f')](handleEntityNotFound(_0x2fc43d,null))['then'](function(_0x57dc90){if(_0x57dc90){_0x37a0a8=_0x57dc90;_0x11e098[_0xa5b7('0x2a')]=_[_0xa5b7('0x2d')](db[_0xa5b7('0x48')][_0xa5b7('0x26')]);_0x11e098['query']=_[_0xa5b7('0x2d')](_0x18f988['query']);_0x11e098[_0xa5b7('0x2e')]=_[_0xa5b7('0x30')](_0x11e098[_0xa5b7('0x2a')],_0x11e098['query']);_0x22140f[_0xa5b7('0x2f')]=_[_0xa5b7('0x30')](_0x11e098[_0xa5b7('0x2a')],qs[_0xa5b7('0x31')](_0x18f988[_0xa5b7('0x2c')]['fields']));_0x22140f[_0xa5b7('0x2f')]=_0x22140f[_0xa5b7('0x2f')][_0xa5b7('0x3e')]?_0x22140f[_0xa5b7('0x2f')]:_0x11e098[_0xa5b7('0x2a')];_0x22140f[_0xa5b7('0x47')]=qs['sort'](_0x18f988['query'][_0xa5b7('0x34')]);_0x22140f[_0xa5b7('0x35')]=qs[_0xa5b7('0x2e')](_[_0xa5b7('0x36')](_0x18f988['query'],_0x11e098[_0xa5b7('0x2e')]));if(_0x18f988[_0xa5b7('0x2c')]['filter']){_0x22140f[_0xa5b7('0x35')]=_['merge'](_0x22140f['where'],{'$or':_[_0xa5b7('0x2b')](_0x22140f[_0xa5b7('0x2f')],function(_0x1e051a){var _0x512cbd={};_0x512cbd[_0x1e051a]={'$like':'%'+_0x18f988['query'][_0xa5b7('0x37')]+'%'};return _0x512cbd;})});}_0x22140f=_[_0xa5b7('0x38')]({},_0x22140f,_0x18f988[_0xa5b7('0x3a')]);return _0x37a0a8[_0xa5b7('0x49')](_0x22140f);}})[_0xa5b7('0x1f')](function(_0x531383){if(_0x531383){_0x542b1d=_0x531383[_0xa5b7('0x3e')];if(!_0x18f988['query']['hasOwnProperty'](_0xa5b7('0x33'))){_0x22140f[_0xa5b7('0x1b')]=qs['limit'](_0x18f988[_0xa5b7('0x2c')][_0xa5b7('0x1b')]);_0x22140f[_0xa5b7('0x19')]=qs['offset'](_0x18f988[_0xa5b7('0x2c')][_0xa5b7('0x19')]);}return _0x37a0a8[_0xa5b7('0x49')](_0x22140f);}})['then'](function(_0x3f65be){if(_0x3f65be){return _0x3f65be?{'count':_0x542b1d,'rows':_0x3f65be}:null;}})[_0xa5b7('0x1f')](respondWithResult(_0x2fc43d,null))[_0xa5b7('0x3c')](handleError(_0x2fc43d,null));};exports[_0xa5b7('0x4a')]=function(_0x38294c,_0xf38c7d,_0x96d7b5){var _0x524075={};var _0x4880a1={};var _0x9d180b;var _0xcf17df;return db[_0xa5b7('0x25')][_0xa5b7('0x46')]({'where':{'id':_0x38294c[_0xa5b7('0x44')]['id']}})[_0xa5b7('0x1f')](handleEntityNotFound(_0xf38c7d,null))[_0xa5b7('0x1f')](function(_0x2fa9d3){if(_0x2fa9d3){_0x9d180b=_0x2fa9d3;_0x4880a1[_0xa5b7('0x2a')]=_[_0xa5b7('0x2d')](db[_0xa5b7('0x48')][_0xa5b7('0x26')]);_0x4880a1[_0xa5b7('0x2c')]=_[_0xa5b7('0x2d')](_0x38294c[_0xa5b7('0x2c')]);_0x4880a1[_0xa5b7('0x2e')]=_[_0xa5b7('0x30')](_0x4880a1[_0xa5b7('0x2a')],_0x4880a1[_0xa5b7('0x2c')]);_0x524075['attributes']=_[_0xa5b7('0x30')](_0x4880a1[_0xa5b7('0x2a')],qs[_0xa5b7('0x31')](_0x38294c[_0xa5b7('0x2c')][_0xa5b7('0x31')]));_0x524075[_0xa5b7('0x2f')]=_0x524075[_0xa5b7('0x2f')]['length']?_0x524075['attributes']:_0x4880a1[_0xa5b7('0x2a')];_0x524075[_0xa5b7('0x47')]=qs[_0xa5b7('0x34')](_0x38294c[_0xa5b7('0x2c')][_0xa5b7('0x34')]);_0x524075['where']=qs[_0xa5b7('0x2e')](_[_0xa5b7('0x36')](_0x38294c['query'],_0x4880a1['filters']));if(_0x38294c[_0xa5b7('0x2c')]['filter']){_0x524075[_0xa5b7('0x35')]=_[_0xa5b7('0x38')](_0x524075['where'],{'$or':_['map'](_0x524075[_0xa5b7('0x2f')],function(_0x1962ba){var _0x64bfcb={};_0x64bfcb[_0x1962ba]={'$like':'%'+_0x38294c[_0xa5b7('0x2c')][_0xa5b7('0x37')]+'%'};return _0x64bfcb;})});}_0x524075=_[_0xa5b7('0x38')]({},_0x524075,_0x38294c['options']);return _0x9d180b[_0xa5b7('0x4a')](_0x524075);}})[_0xa5b7('0x1f')](function(_0x1b59d3){if(_0x1b59d3){_0xcf17df=_0x1b59d3[_0xa5b7('0x3e')];if(!_0x38294c['query'][_0xa5b7('0x32')](_0xa5b7('0x33'))){_0x524075[_0xa5b7('0x1b')]=qs[_0xa5b7('0x1b')](_0x38294c[_0xa5b7('0x2c')][_0xa5b7('0x1b')]);_0x524075['offset']=qs['offset'](_0x38294c[_0xa5b7('0x2c')]['offset']);}return _0x9d180b[_0xa5b7('0x4a')](_0x524075);}})[_0xa5b7('0x1f')](function(_0x3b4602){if(_0x3b4602){return _0x3b4602?{'count':_0xcf17df,'rows':_0x3b4602}:null;}})['then'](respondWithResult(_0xf38c7d,null))[_0xa5b7('0x3c')](handleError(_0xf38c7d,null));};exports[_0xa5b7('0x4b')]=function(_0x14e602,_0x21d68f,_0x1028fd){var _0x48d079={};var _0x28c900={};var _0x216c1b;var _0x2f1e29;return db[_0xa5b7('0x25')]['findOne']({'where':{'id':_0x14e602['params']['id']}})[_0xa5b7('0x1f')](handleEntityNotFound(_0x21d68f,null))['then'](function(_0x5816c9){if(_0x5816c9){_0x216c1b=_0x5816c9;_0x28c900['model']=_[_0xa5b7('0x2d')](db[_0xa5b7('0x4c')][_0xa5b7('0x26')]);_0x28c900[_0xa5b7('0x2c')]=_['keys'](_0x14e602[_0xa5b7('0x2c')]);_0x28c900[_0xa5b7('0x2e')]=_['intersection'](_0x28c900[_0xa5b7('0x2a')],_0x28c900[_0xa5b7('0x2c')]);_0x48d079[_0xa5b7('0x2f')]=_[_0xa5b7('0x30')](_0x28c900['model'],qs[_0xa5b7('0x31')](_0x14e602['query'][_0xa5b7('0x31')]));_0x48d079[_0xa5b7('0x2f')]=_0x48d079[_0xa5b7('0x2f')]['length']?_0x48d079[_0xa5b7('0x2f')]:_0x28c900[_0xa5b7('0x2a')];_0x48d079['order']=qs[_0xa5b7('0x34')](_0x14e602[_0xa5b7('0x2c')][_0xa5b7('0x34')]);_0x48d079[_0xa5b7('0x35')]=qs[_0xa5b7('0x2e')](_['pick'](_0x14e602['query'],_0x28c900[_0xa5b7('0x2e')]));if(_0x14e602[_0xa5b7('0x2c')][_0xa5b7('0x37')]){_0x48d079[_0xa5b7('0x35')]=_[_0xa5b7('0x38')](_0x48d079[_0xa5b7('0x35')],{'$or':_[_0xa5b7('0x2b')](_0x48d079[_0xa5b7('0x2f')],function(_0x9bc092){var _0x41cc38={};_0x41cc38[_0x9bc092]={'$like':'%'+_0x14e602['query'][_0xa5b7('0x37')]+'%'};return _0x41cc38;})});}_0x48d079=_[_0xa5b7('0x38')]({},_0x48d079,_0x14e602[_0xa5b7('0x3a')]);return _0x216c1b[_0xa5b7('0x4b')](_0x48d079);}})[_0xa5b7('0x1f')](function(_0x2c9686){if(_0x2c9686){_0x2f1e29=_0x2c9686[_0xa5b7('0x3e')];if(!_0x14e602[_0xa5b7('0x2c')][_0xa5b7('0x32')](_0xa5b7('0x33'))){_0x48d079[_0xa5b7('0x1b')]=qs[_0xa5b7('0x1b')](_0x14e602['query'][_0xa5b7('0x1b')]);_0x48d079[_0xa5b7('0x19')]=qs[_0xa5b7('0x19')](_0x14e602[_0xa5b7('0x2c')][_0xa5b7('0x19')]);}return _0x216c1b['getTags'](_0x48d079);}})[_0xa5b7('0x1f')](function(_0x4677da){if(_0x4677da){return _0x4677da?{'count':_0x2f1e29,'rows':_0x4677da}:null;}})['then'](respondWithResult(_0x21d68f,null))[_0xa5b7('0x3c')](handleError(_0x21d68f,null));};exports[_0xa5b7('0x4d')]=function(_0x15896b,_0x38ea35,_0x5b29ca){if(_0x15896b[_0xa5b7('0x42')]['id']){delete _0x15896b['body']['id'];}return db[_0xa5b7('0x25')][_0xa5b7('0x46')]({'where':{'id':_0x15896b[_0xa5b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x38ea35,null))[_0xa5b7('0x1f')](function(_0x3daf79){if(_0x3daf79){return _0x3daf79[_0xa5b7('0x4d')](_0x15896b[_0xa5b7('0x42')][_0xa5b7('0x4e')]||[]);}return null;})[_0xa5b7('0x1f')](respondWithResult(_0x38ea35,null))[_0xa5b7('0x3c')](handleError(_0x38ea35,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 143ea21..4229efa 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 _0x5e9e=['path','rimraf','../../config/environment','exports','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','request-promise'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x5e9e,0x145));var _0xe5e9=function(_0x37ef22,_0x348c92){_0x37ef22=_0x37ef22-0x0;var _0x49eeb3=_0x5e9e[_0x37ef22];return _0x49eeb3;};'use strict';var _=require(_0xe5e9('0x0'));var util=require(_0xe5e9('0x1'));var logger=require('../../config/logger')(_0xe5e9('0x2'));var moment=require(_0xe5e9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5e9('0x4'));var fs=require('fs');var path=require(_0xe5e9('0x5'));var rimraf=require(_0xe5e9('0x6'));var config=require(_0xe5e9('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xe5e9('0x8')]=function(_0x4eb5ef,_0x65419a){return _0x4eb5ef['define'](_0xe5e9('0x9'),attributes,{'tableName':_0xe5e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad9a=['rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xad9a,0x172));var _0xaad9=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xad9a[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xaad9('0x0'));var util=require(_0xaad9('0x1'));var logger=require(_0xaad9('0x2'))('api');var moment=require(_0xaad9('0x3'));var BPromise=require(_0xaad9('0x4'));var rp=require(_0xaad9('0x5'));var fs=require('fs');var path=require(_0xaad9('0x6'));var rimraf=require(_0xaad9('0x7'));var config=require(_0xaad9('0x8'));var attributes=require(_0xaad9('0x9'));module['exports']=function(_0x3ad583,_0xaed0ec){return _0x3ad583[_0xaad9('0xa')](_0xaad9('0xb'),attributes,{'tableName':_0xaad9('0xc'),'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 20146d1..b4176c4 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 _0x4201=['debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','request\x20sent'];(function(_0x55c40f,_0x867562){var _0x241ce8=function(_0x514ed6){while(--_0x514ed6){_0x55c40f['push'](_0x55c40f['shift']());}};_0x241ce8(++_0x867562);}(_0x4201,0x71));var _0x1420=function(_0x5cc30e,_0x2646b6){_0x5cc30e=_0x5cc30e-0x0;var _0x208c6d=_0x4201[_0x5cc30e];return _0x208c6d;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require('moment');var BPromise=require(_0x1420('0x2'));var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require(_0x1420('0x6'));var logger=require(_0x1420('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a8ba,_0x239e16,_0x59ddc5){return new BPromise(function(_0x5a925c,_0x46d303){return client[_0x1420('0xb')](_0x35a8ba,_0x59ddc5)['then'](function(_0x1d52ff){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'));logger[_0x1420('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'),JSON[_0x1420('0xe')](_0x1d52ff));if(_0x1d52ff[_0x1420('0xf')]){if(_0x1d52ff[_0x1420('0xf')][_0x1420('0x10')]===0x1f4){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')]['message']);return _0x46d303(_0x1d52ff['error']['message']);}logger['error'](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);return _0x5a925c(_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);}else{logger[_0x1420('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x239e16,'request\x20sent');_0x5a925c(_0x1d52ff[_0x1420('0x14')]['message']);}})['catch'](function(_0x231659){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x231659);_0x46d303(_0x231659);});});} \ No newline at end of file +var _0xbc5e=['request','then','info','request\x20sent','debug','stringify','error','message','DeskConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3bfd22,_0x400fb1){var _0x5cccac=function(_0xcd2a4){while(--_0xcd2a4){_0x3bfd22['push'](_0x3bfd22['shift']());}};_0x5cccac(++_0x400fb1);}(_0xbc5e,0x7d));var _0xebc5=function(_0x176d04,_0xacf3d0){_0x176d04=_0x176d04-0x0;var _0x448969=_0xbc5e[_0x176d04];return _0x448969;};'use strict';var _=require(_0xebc5('0x0'));var util=require(_0xebc5('0x1'));var moment=require(_0xebc5('0x2'));var BPromise=require(_0xebc5('0x3'));var rs=require(_0xebc5('0x4'));var fs=require('fs');var Redis=require(_0xebc5('0x5'));var db=require(_0xebc5('0x6'))['db'];var utils=require(_0xebc5('0x7'));var logger=require(_0xebc5('0x8'))('rpc');var config=require(_0xebc5('0x9'));var jayson=require(_0xebc5('0xa'));var client=jayson[_0xebc5('0xb')][_0xebc5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c2ff6,_0x5927ab,_0x5c3136){return new BPromise(function(_0x197a10,_0x469973){return client[_0xebc5('0xd')](_0x3c2ff6,_0x5c3136)[_0xebc5('0xe')](function(_0x5a336e){logger[_0xebc5('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x5927ab,_0xebc5('0x10'));logger[_0xebc5('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5927ab,_0xebc5('0x10'),JSON[_0xebc5('0x12')](_0x5a336e));if(_0x5a336e[_0xebc5('0x13')]){if(_0x5a336e['error']['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5927ab,_0x5a336e[_0xebc5('0x13')][_0xebc5('0x14')]);return _0x469973(_0x5a336e[_0xebc5('0x13')][_0xebc5('0x14')]);}logger[_0xebc5('0x13')](_0xebc5('0x15'),_0x5927ab,_0x5a336e['error'][_0xebc5('0x14')]);return _0x197a10(_0x5a336e['error'][_0xebc5('0x14')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x5927ab,_0xebc5('0x10'));_0x197a10(_0x5a336e['result']['message']);}})[_0xebc5('0x16')](function(_0x16a784){logger[_0xebc5('0x13')](_0xebc5('0x15'),_0x5927ab,_0x16a784);_0x469973(_0x16a784);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ca5ba34..6298795 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 _0x221c=['index','/:id','create','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x46612e,_0x9ed8d2){var _0x4ec3d9=function(_0x1d80b6){while(--_0x1d80b6){_0x46612e['push'](_0x46612e['shift']());}};_0x4ec3d9(++_0x9ed8d2);}(_0x221c,0x17c));var _0xc221=function(_0x45944a,_0x18827c){_0x45944a=_0x45944a-0x0;var _0x28df7d=_0x221c[_0x45944a];return _0x28df7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc221('0x0'));var timeout=require(_0xc221('0x1'));var express=require(_0xc221('0x2'));var router=express[_0xc221('0x3')]();var fs_extra=require(_0xc221('0x4'));var auth=require(_0xc221('0x5'));var interaction=require(_0xc221('0x6'));var config=require(_0xc221('0x7'));var controller=require(_0xc221('0x8'));router[_0xc221('0x9')]('/',auth[_0xc221('0xa')](),controller[_0xc221('0xb')]);router['get'](_0xc221('0xc'),auth[_0xc221('0xa')](),controller['show']);router['post']('/',auth[_0xc221('0xa')](),controller[_0xc221('0xd')]);router['put'](_0xc221('0xc'),auth[_0xc221('0xa')](),controller[_0xc221('0xe')]);router['delete']('/:id',auth[_0xc221('0xa')](),controller[_0xc221('0xf')]);module[_0xc221('0x10')]=router; \ No newline at end of file +var _0x9ebb=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2797ae,_0x436b18){var _0x1dd243=function(_0x1819f4){while(--_0x1819f4){_0x2797ae['push'](_0x2797ae['shift']());}};_0x1dd243(++_0x436b18);}(_0x9ebb,0x11a));var _0xb9eb=function(_0x50d708,_0x161891){_0x50d708=_0x50d708-0x0;var _0x4f9421=_0x9ebb[_0x50d708];return _0x4f9421;};'use strict';var multer=require(_0xb9eb('0x0'));var util=require('util');var path=require(_0xb9eb('0x1'));var timeout=require(_0xb9eb('0x2'));var express=require(_0xb9eb('0x3'));var router=express[_0xb9eb('0x4')]();var fs_extra=require(_0xb9eb('0x5'));var auth=require(_0xb9eb('0x6'));var interaction=require(_0xb9eb('0x7'));var config=require(_0xb9eb('0x8'));var controller=require('./intDeskField.controller');router[_0xb9eb('0x9')]('/',auth[_0xb9eb('0xa')](),controller[_0xb9eb('0xb')]);router['get'](_0xb9eb('0xc'),auth[_0xb9eb('0xa')](),controller['show']);router[_0xb9eb('0xd')]('/',auth[_0xb9eb('0xa')](),controller[_0xb9eb('0xe')]);router['put'](_0xb9eb('0xc'),auth[_0xb9eb('0xa')](),controller['update']);router[_0xb9eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb9eb('0x10')]);module[_0xb9eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2928c35..89475c8 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 _0xbcd1=['ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','STRING'];(function(_0x7cb5eb,_0x40e72c){var _0x5006df=function(_0x282b85){while(--_0x282b85){_0x7cb5eb['push'](_0x7cb5eb['shift']());}};_0x5006df(++_0x40e72c);}(_0xbcd1,0x89));var _0x1bcd=function(_0x6be029,_0x1ebc18){_0x6be029=_0x6be029-0x0;var _0xe2df60=_0xbcd1[_0x6be029];return _0xe2df60;};'use strict';var Sequelize=require(_0x1bcd('0x0'));module[_0x1bcd('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1bcd('0x2'),_0x1bcd('0x3'),_0x1bcd('0x4'),_0x1bcd('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1bcd('0x6')]},'key':{'type':Sequelize[_0x1bcd('0x6')]},'keyType':{'type':Sequelize[_0x1bcd('0x7')]('string',_0x1bcd('0x2'),_0x1bcd('0x3'))},'keyContent':{'type':Sequelize[_0x1bcd('0x6')]},'idField':{'type':Sequelize[_0x1bcd('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1bcd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1bcd('0x6')]}}; \ No newline at end of file +var _0xf8b8=['picklist','string','STRING','customVariable','sequelize','exports','ENUM','variable','keyValue'];(function(_0x566e1f,_0x499819){var _0x391ea8=function(_0x2a170a){while(--_0x2a170a){_0x566e1f['push'](_0x566e1f['shift']());}};_0x391ea8(++_0x499819);}(_0xf8b8,0x13f));var _0x8f8b=function(_0x4dbe80,_0x222ad4){_0x4dbe80=_0x4dbe80-0x0;var _0x2efc14=_0xf8b8[_0x4dbe80];return _0x2efc14;};'use strict';var Sequelize=require(_0x8f8b('0x0'));module[_0x8f8b('0x1')]={'type':{'type':Sequelize[_0x8f8b('0x2')]('string',_0x8f8b('0x3'),'customVariable',_0x8f8b('0x4'),_0x8f8b('0x5')),'defaultValue':_0x8f8b('0x6')},'content':{'type':Sequelize[_0x8f8b('0x7')]},'key':{'type':Sequelize[_0x8f8b('0x7')]},'keyType':{'type':Sequelize[_0x8f8b('0x2')](_0x8f8b('0x6'),_0x8f8b('0x3'),_0x8f8b('0x8'))},'keyContent':{'type':Sequelize[_0x8f8b('0x7')]},'idField':{'type':Sequelize[_0x8f8b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f8b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d2dd39b..1aeb421 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 _0xb76d=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','params','filters','intersection','includeAll','include','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3d5709,_0x1318fd){var _0x409bb5=function(_0x3c4e3c){while(--_0x3c4e3c){_0x3d5709['push'](_0x3d5709['shift']());}};_0x409bb5(++_0x1318fd);}(_0xb76d,0x119));var _0xdb76=function(_0x1f9055,_0xe7a919){_0x1f9055=_0x1f9055-0x0;var _0x576999=_0xb76d[_0x1f9055];return _0x576999;};'use strict';var emlformat=require(_0xdb76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb76('0x1'));var jsonpatch=require(_0xdb76('0x2'));var rp=require(_0xdb76('0x3'));var moment=require('moment');var BPromise=require(_0xdb76('0x4'));var Mustache=require(_0xdb76('0x5'));var util=require(_0xdb76('0x6'));var path=require(_0xdb76('0x7'));var sox=require(_0xdb76('0x8'));var csv=require(_0xdb76('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb76('0xa'));var _=require(_0xdb76('0xb'));var squel=require(_0xdb76('0xc'));var crypto=require(_0xdb76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdb76('0xe'));var toCsv=require(_0xdb76('0x9'));var querystring=require('querystring');var Papa=require(_0xdb76('0xf'));var Redis=require(_0xdb76('0x10'));var authService=require(_0xdb76('0x11'));var qs=require(_0xdb76('0x12'));var as=require(_0xdb76('0x13'));var hardwareService=require(_0xdb76('0x14'));var logger=require(_0xdb76('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdb76('0x16'));var licenseUtil=require(_0xdb76('0x17'));var db=require(_0xdb76('0x18'))['db'];function respondWithStatusCode(_0x579435,_0x4efbbd){_0x4efbbd=_0x4efbbd||0xcc;return function(_0x35c8ba){if(_0x35c8ba){return _0x579435['sendStatus'](_0x4efbbd);}return _0x579435[_0xdb76('0x19')](_0x4efbbd)['end']();};}function respondWithResult(_0x4d2970,_0xcc589e){_0xcc589e=_0xcc589e||0xc8;return function(_0x28d3a5){if(_0x28d3a5){return _0x4d2970[_0xdb76('0x19')](_0xcc589e)[_0xdb76('0x1a')](_0x28d3a5);}};}function respondWithFilteredResult(_0x4e6963,_0x7fd0ef){return function(_0x2f1e41){if(_0x2f1e41){var _0x5a1017=typeof _0x7fd0ef[_0xdb76('0x1b')]===_0xdb76('0x1c')&&typeof _0x7fd0ef[_0xdb76('0x1d')]===_0xdb76('0x1c');var _0x388fb0=_0x2f1e41[_0xdb76('0x1e')];var _0x557649=_0x5a1017?0x0:_0x7fd0ef[_0xdb76('0x1b')];var _0x11ae59=_0x5a1017?_0x2f1e41[_0xdb76('0x1e')]:_0x7fd0ef['offset']+_0x7fd0ef[_0xdb76('0x1d')];var _0xf06f1c;if(_0x11ae59>=_0x388fb0){_0x11ae59=_0x388fb0;_0xf06f1c=0xc8;}else{_0xf06f1c=0xce;}_0x4e6963[_0xdb76('0x19')](_0xf06f1c);return _0x4e6963['set'](_0xdb76('0x1f'),_0x557649+'-'+_0x11ae59+'/'+_0x388fb0)[_0xdb76('0x1a')](_0x2f1e41);}return null;};}function patchUpdates(_0x3c786c){return function(_0x468cd1){try{jsonpatch[_0xdb76('0x20')](_0x468cd1,_0x3c786c,!![]);}catch(_0xa574d4){return BPromise[_0xdb76('0x21')](_0xa574d4);}return _0x468cd1[_0xdb76('0x22')]();};}function saveUpdates(_0x54706a,_0x389668){return function(_0x3718e1){if(_0x3718e1){return _0x3718e1[_0xdb76('0x23')](_0x54706a)[_0xdb76('0x24')](function(_0x560433){return _0x560433;});}return null;};}function removeEntity(_0xd3f54f,_0x5cbf51){return function(_0x12f479){if(_0x12f479){return _0x12f479[_0xdb76('0x25')]()[_0xdb76('0x24')](function(){_0xd3f54f[_0xdb76('0x19')](0xcc)[_0xdb76('0x26')]();});}};}function handleEntityNotFound(_0x25d904,_0xec9e4b){return function(_0x168dc4){if(!_0x168dc4){_0x25d904[_0xdb76('0x27')](0x194);}return _0x168dc4;};}function handleError(_0x4534b5,_0x1244b9){_0x1244b9=_0x1244b9||0x1f4;return function(_0x51f919){logger[_0xdb76('0x28')](_0x51f919['stack']);if(_0x51f919[_0xdb76('0x29')]){delete _0x51f919[_0xdb76('0x29')];}_0x4534b5[_0xdb76('0x19')](_0x1244b9)['send'](_0x51f919);};}exports['index']=function(_0x1ffce7,_0xa68943){var _0x258df1={},_0x53ec87={},_0x309cc0={'count':0x0,'rows':[]};var _0x6600a1=_[_0xdb76('0x2a')](db[_0xdb76('0x2b')][_0xdb76('0x2c')],function(_0x13b7a0){return{'name':_0x13b7a0[_0xdb76('0x2d')],'type':_0x13b7a0[_0xdb76('0x2e')][_0xdb76('0x2f')]};});_0x53ec87[_0xdb76('0x30')]=_['map'](_0x6600a1,_0xdb76('0x29'));_0x53ec87[_0xdb76('0x31')]=_[_0xdb76('0x32')](_0x1ffce7[_0xdb76('0x31')]);_0x53ec87['filters']=_['intersection'](_0x53ec87[_0xdb76('0x30')],_0x53ec87[_0xdb76('0x31')]);_0x258df1[_0xdb76('0x33')]=_['intersection'](_0x53ec87['model'],qs[_0xdb76('0x34')](_0x1ffce7['query']['fields']));_0x258df1[_0xdb76('0x33')]=_0x258df1[_0xdb76('0x33')][_0xdb76('0x35')]?_0x258df1[_0xdb76('0x33')]:_0x53ec87[_0xdb76('0x30')];if(!_0x1ffce7['query']['hasOwnProperty'](_0xdb76('0x36'))){_0x258df1[_0xdb76('0x1d')]=qs[_0xdb76('0x1d')](_0x1ffce7['query']['limit']);_0x258df1[_0xdb76('0x1b')]=qs[_0xdb76('0x1b')](_0x1ffce7[_0xdb76('0x31')][_0xdb76('0x1b')]);}_0x258df1[_0xdb76('0x37')]=qs[_0xdb76('0x38')](_0x1ffce7[_0xdb76('0x31')][_0xdb76('0x38')]);_0x258df1[_0xdb76('0x39')]=qs['filters'](_[_0xdb76('0x3a')](_0x1ffce7[_0xdb76('0x31')],_0x53ec87['filters']),_0x6600a1);if(_0x1ffce7[_0xdb76('0x31')][_0xdb76('0x3b')]){_0x258df1[_0xdb76('0x39')]=_[_0xdb76('0x3c')](_0x258df1[_0xdb76('0x39')],{'$or':_[_0xdb76('0x2a')](_0x6600a1,function(_0x16769c){if(_0x16769c['type']!=='VIRTUAL'){var _0x2aa60d={};_0x2aa60d[_0x16769c[_0xdb76('0x29')]]={'$like':'%'+_0x1ffce7['query'][_0xdb76('0x3b')]+'%'};return _0x2aa60d;}})});}_0x258df1=_['merge']({},_0x258df1,_0x1ffce7[_0xdb76('0x3d')]);var _0x363976={'where':_0x258df1['where']};return db[_0xdb76('0x2b')][_0xdb76('0x1e')](_0x363976)[_0xdb76('0x24')](function(_0x1cd77e){_0x309cc0[_0xdb76('0x1e')]=_0x1cd77e;if(_0x1ffce7[_0xdb76('0x31')]['includeAll']){_0x258df1['include']=[{'all':!![]}];}return db['DeskField'][_0xdb76('0x3e')](_0x258df1);})[_0xdb76('0x24')](function(_0x8c79e6){_0x309cc0['rows']=_0x8c79e6;return _0x309cc0;})['then'](respondWithFilteredResult(_0xa68943,_0x258df1))[_0xdb76('0x3f')](handleError(_0xa68943,null));};exports['show']=function(_0x588c50,_0x5259c3){var _0x66dd8d={'raw':!![],'where':{'id':_0x588c50[_0xdb76('0x40')]['id']}},_0x92f567={};_0x92f567[_0xdb76('0x30')]=_['keys'](db[_0xdb76('0x2b')][_0xdb76('0x2c')]);_0x92f567[_0xdb76('0x31')]=_['keys'](_0x588c50['query']);_0x92f567[_0xdb76('0x41')]=_[_0xdb76('0x42')](_0x92f567[_0xdb76('0x30')],_0x92f567['query']);_0x66dd8d['attributes']=_[_0xdb76('0x42')](_0x92f567[_0xdb76('0x30')],qs[_0xdb76('0x34')](_0x588c50[_0xdb76('0x31')][_0xdb76('0x34')]));_0x66dd8d[_0xdb76('0x33')]=_0x66dd8d[_0xdb76('0x33')]['length']?_0x66dd8d[_0xdb76('0x33')]:_0x92f567['model'];if(_0x588c50[_0xdb76('0x31')][_0xdb76('0x43')]){_0x66dd8d[_0xdb76('0x44')]=[{'all':!![]}];}_0x66dd8d=_['merge']({},_0x66dd8d,_0x588c50[_0xdb76('0x3d')]);return db[_0xdb76('0x2b')]['find'](_0x66dd8d)['then'](handleEntityNotFound(_0x5259c3,null))[_0xdb76('0x24')](respondWithResult(_0x5259c3,null))[_0xdb76('0x3f')](handleError(_0x5259c3,null));};exports[_0xdb76('0x45')]=function(_0x4be87e,_0x26c062){return db[_0xdb76('0x2b')][_0xdb76('0x45')](_0x4be87e['body'],{})[_0xdb76('0x24')](respondWithResult(_0x26c062,0xc9))[_0xdb76('0x3f')](handleError(_0x26c062,null));};exports[_0xdb76('0x23')]=function(_0x31e5fd,_0x265d9c){if(_0x31e5fd['body']['id']){delete _0x31e5fd[_0xdb76('0x46')]['id'];}return db[_0xdb76('0x2b')][_0xdb76('0x47')]({'where':{'id':_0x31e5fd[_0xdb76('0x40')]['id']}})[_0xdb76('0x24')](handleEntityNotFound(_0x265d9c,null))['then'](saveUpdates(_0x31e5fd[_0xdb76('0x46')],null))[_0xdb76('0x24')](respondWithResult(_0x265d9c,null))[_0xdb76('0x3f')](handleError(_0x265d9c,null));};exports[_0xdb76('0x25')]=function(_0x14a780,_0x199186){return db['DeskField'][_0xdb76('0x47')]({'where':{'id':_0x14a780[_0xdb76('0x40')]['id']}})[_0xdb76('0x24')](handleEntityNotFound(_0x199186,null))[_0xdb76('0x24')](removeEntity(_0x199186,null))[_0xdb76('0x3f')](handleError(_0x199186,null));}; \ No newline at end of file +var _0xd10b=['hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','type','DeskField','includeAll','show','keys','attributes','length','include','options','find','create','body','catch','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','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','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','apply','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','query','model','intersection','fields'];(function(_0x383571,_0x22e721){var _0x28bc7b=function(_0x40791e){while(--_0x40791e){_0x383571['push'](_0x383571['shift']());}};_0x28bc7b(++_0x22e721);}(_0xd10b,0x189));var _0xbd10=function(_0x2ab07d,_0x30867e){_0x2ab07d=_0x2ab07d-0x0;var _0x4e8f58=_0xd10b[_0x2ab07d];return _0x4e8f58;};'use strict';var emlformat=require(_0xbd10('0x0'));var rimraf=require(_0xbd10('0x1'));var zipdir=require(_0xbd10('0x2'));var jsonpatch=require(_0xbd10('0x3'));var rp=require(_0xbd10('0x4'));var moment=require(_0xbd10('0x5'));var BPromise=require(_0xbd10('0x6'));var Mustache=require(_0xbd10('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbd10('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd10('0x9'));var _=require(_0xbd10('0xa'));var squel=require(_0xbd10('0xb'));var crypto=require(_0xbd10('0xc'));var jsforce=require(_0xbd10('0xd'));var deskjs=require(_0xbd10('0xe'));var toCsv=require(_0xbd10('0xf'));var querystring=require(_0xbd10('0x10'));var Papa=require(_0xbd10('0x11'));var Redis=require(_0xbd10('0x12'));var authService=require(_0xbd10('0x13'));var qs=require(_0xbd10('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd10('0x15'));var logger=require(_0xbd10('0x16'))(_0xbd10('0x17'));var utils=require(_0xbd10('0x18'));var config=require(_0xbd10('0x19'));var licenseUtil=require(_0xbd10('0x1a'));var db=require(_0xbd10('0x1b'))['db'];function respondWithStatusCode(_0x482969,_0x1c2fe5){_0x1c2fe5=_0x1c2fe5||0xcc;return function(_0x4d811d){if(_0x4d811d){return _0x482969[_0xbd10('0x1c')](_0x1c2fe5);}return _0x482969[_0xbd10('0x1d')](_0x1c2fe5)[_0xbd10('0x1e')]();};}function respondWithResult(_0x7fb718,_0x4b2f84){_0x4b2f84=_0x4b2f84||0xc8;return function(_0xc115fb){if(_0xc115fb){return _0x7fb718['status'](_0x4b2f84)['json'](_0xc115fb);}};}function respondWithFilteredResult(_0x271943,_0x18a536){return function(_0x2c74a2){if(_0x2c74a2){var _0x2ee5fc=typeof _0x18a536[_0xbd10('0x1f')]==='undefined'&&typeof _0x18a536[_0xbd10('0x20')]===_0xbd10('0x21');var _0x7efcf0=_0x2c74a2[_0xbd10('0x22')];var _0x418e27=_0x2ee5fc?0x0:_0x18a536[_0xbd10('0x1f')];var _0x28f9a0=_0x2ee5fc?_0x2c74a2[_0xbd10('0x22')]:_0x18a536[_0xbd10('0x1f')]+_0x18a536[_0xbd10('0x20')];var _0x3fd56d;if(_0x28f9a0>=_0x7efcf0){_0x28f9a0=_0x7efcf0;_0x3fd56d=0xc8;}else{_0x3fd56d=0xce;}_0x271943['status'](_0x3fd56d);return _0x271943['set']('Content-Range',_0x418e27+'-'+_0x28f9a0+'/'+_0x7efcf0)['json'](_0x2c74a2);}return null;};}function patchUpdates(_0x3eea42){return function(_0xf75fe){try{jsonpatch[_0xbd10('0x23')](_0xf75fe,_0x3eea42,!![]);}catch(_0x55b0aa){return BPromise['reject'](_0x55b0aa);}return _0xf75fe[_0xbd10('0x24')]();};}function saveUpdates(_0x189633,_0x3e8e4b){return function(_0x128c6c){if(_0x128c6c){return _0x128c6c[_0xbd10('0x25')](_0x189633)[_0xbd10('0x26')](function(_0x1b8555){return _0x1b8555;});}return null;};}function removeEntity(_0x10a164,_0x5ab431){return function(_0x1ccf39){if(_0x1ccf39){return _0x1ccf39['destroy']()['then'](function(){_0x10a164[_0xbd10('0x1d')](0xcc)[_0xbd10('0x1e')]();});}};}function handleEntityNotFound(_0x2f21d3,_0x9189cf){return function(_0x2ebf75){if(!_0x2ebf75){_0x2f21d3[_0xbd10('0x1c')](0x194);}return _0x2ebf75;};}function handleError(_0xc2c6be,_0x4f8571){_0x4f8571=_0x4f8571||0x1f4;return function(_0x3f949e){logger[_0xbd10('0x27')](_0x3f949e[_0xbd10('0x28')]);if(_0x3f949e[_0xbd10('0x29')]){delete _0x3f949e['name'];}_0xc2c6be['status'](_0x4f8571)[_0xbd10('0x2a')](_0x3f949e);};}exports['index']=function(_0x3d80c0,_0x536718){var _0x45db01={},_0x1cea00={},_0x45ffa7={'count':0x0,'rows':[]};var _0x47e89b=_[_0xbd10('0x2b')](db['DeskField'][_0xbd10('0x2c')],function(_0xb83018){return{'name':_0xb83018[_0xbd10('0x2d')],'type':_0xb83018['type'][_0xbd10('0x2e')]};});_0x1cea00['model']=_[_0xbd10('0x2b')](_0x47e89b,_0xbd10('0x29'));_0x1cea00['query']=_['keys'](_0x3d80c0[_0xbd10('0x2f')]);_0x1cea00['filters']=_['intersection'](_0x1cea00[_0xbd10('0x30')],_0x1cea00[_0xbd10('0x2f')]);_0x45db01['attributes']=_[_0xbd10('0x31')](_0x1cea00[_0xbd10('0x30')],qs[_0xbd10('0x32')](_0x3d80c0[_0xbd10('0x2f')][_0xbd10('0x32')]));_0x45db01['attributes']=_0x45db01['attributes']['length']?_0x45db01['attributes']:_0x1cea00[_0xbd10('0x30')];if(!_0x3d80c0['query'][_0xbd10('0x33')](_0xbd10('0x34'))){_0x45db01[_0xbd10('0x20')]=qs[_0xbd10('0x20')](_0x3d80c0[_0xbd10('0x2f')][_0xbd10('0x20')]);_0x45db01[_0xbd10('0x1f')]=qs[_0xbd10('0x1f')](_0x3d80c0['query'][_0xbd10('0x1f')]);}_0x45db01['order']=qs[_0xbd10('0x35')](_0x3d80c0[_0xbd10('0x2f')][_0xbd10('0x35')]);_0x45db01['where']=qs[_0xbd10('0x36')](_[_0xbd10('0x37')](_0x3d80c0['query'],_0x1cea00[_0xbd10('0x36')]),_0x47e89b);if(_0x3d80c0[_0xbd10('0x2f')][_0xbd10('0x38')]){_0x45db01['where']=_[_0xbd10('0x39')](_0x45db01[_0xbd10('0x3a')],{'$or':_[_0xbd10('0x2b')](_0x47e89b,function(_0x30610f){if(_0x30610f[_0xbd10('0x3b')]!=='VIRTUAL'){var _0x17f84d={};_0x17f84d[_0x30610f[_0xbd10('0x29')]]={'$like':'%'+_0x3d80c0['query']['filter']+'%'};return _0x17f84d;}})});}_0x45db01=_[_0xbd10('0x39')]({},_0x45db01,_0x3d80c0['options']);var _0x80e242={'where':_0x45db01[_0xbd10('0x3a')]};return db[_0xbd10('0x3c')][_0xbd10('0x22')](_0x80e242)[_0xbd10('0x26')](function(_0x33f5b9){_0x45ffa7[_0xbd10('0x22')]=_0x33f5b9;if(_0x3d80c0[_0xbd10('0x2f')][_0xbd10('0x3d')]){_0x45db01['include']=[{'all':!![]}];}return db[_0xbd10('0x3c')]['findAll'](_0x45db01);})[_0xbd10('0x26')](function(_0xba2982){_0x45ffa7['rows']=_0xba2982;return _0x45ffa7;})[_0xbd10('0x26')](respondWithFilteredResult(_0x536718,_0x45db01))['catch'](handleError(_0x536718,null));};exports[_0xbd10('0x3e')]=function(_0x1c13ad,_0x534317){var _0x65cb55={'raw':!![],'where':{'id':_0x1c13ad['params']['id']}},_0x4dde68={};_0x4dde68[_0xbd10('0x30')]=_[_0xbd10('0x3f')](db['DeskField'][_0xbd10('0x2c')]);_0x4dde68[_0xbd10('0x2f')]=_[_0xbd10('0x3f')](_0x1c13ad[_0xbd10('0x2f')]);_0x4dde68['filters']=_[_0xbd10('0x31')](_0x4dde68['model'],_0x4dde68[_0xbd10('0x2f')]);_0x65cb55[_0xbd10('0x40')]=_[_0xbd10('0x31')](_0x4dde68[_0xbd10('0x30')],qs[_0xbd10('0x32')](_0x1c13ad[_0xbd10('0x2f')]['fields']));_0x65cb55[_0xbd10('0x40')]=_0x65cb55[_0xbd10('0x40')][_0xbd10('0x41')]?_0x65cb55[_0xbd10('0x40')]:_0x4dde68['model'];if(_0x1c13ad[_0xbd10('0x2f')][_0xbd10('0x3d')]){_0x65cb55[_0xbd10('0x42')]=[{'all':!![]}];}_0x65cb55=_[_0xbd10('0x39')]({},_0x65cb55,_0x1c13ad[_0xbd10('0x43')]);return db[_0xbd10('0x3c')][_0xbd10('0x44')](_0x65cb55)[_0xbd10('0x26')](handleEntityNotFound(_0x534317,null))[_0xbd10('0x26')](respondWithResult(_0x534317,null))['catch'](handleError(_0x534317,null));};exports[_0xbd10('0x45')]=function(_0x3ac9cf,_0x4b02a0){return db['DeskField'][_0xbd10('0x45')](_0x3ac9cf[_0xbd10('0x46')],{})[_0xbd10('0x26')](respondWithResult(_0x4b02a0,0xc9))[_0xbd10('0x47')](handleError(_0x4b02a0,null));};exports[_0xbd10('0x25')]=function(_0x571236,_0x5b0290){if(_0x571236[_0xbd10('0x46')]['id']){delete _0x571236['body']['id'];}return db[_0xbd10('0x3c')][_0xbd10('0x44')]({'where':{'id':_0x571236[_0xbd10('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b0290,null))[_0xbd10('0x26')](saveUpdates(_0x571236['body'],null))[_0xbd10('0x26')](respondWithResult(_0x5b0290,null))[_0xbd10('0x47')](handleError(_0x5b0290,null));};exports[_0xbd10('0x49')]=function(_0x3cd09b,_0x2d1608){return db[_0xbd10('0x3c')]['find']({'where':{'id':_0x3cd09b[_0xbd10('0x48')]['id']}})[_0xbd10('0x26')](handleEntityNotFound(_0x2d1608,null))[_0xbd10('0x26')](removeEntity(_0x2d1608,null))[_0xbd10('0x47')](handleError(_0x2d1608,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 34267d3..37f5170 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 _0x662f=['rimraf','exports','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x662f,0x1f4));var _0xf662=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x662f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf662('0x0'));var util=require(_0xf662('0x1'));var logger=require(_0xf662('0x2'))(_0xf662('0x3'));var moment=require(_0xf662('0x4'));var BPromise=require('bluebird');var rp=require(_0xf662('0x5'));var fs=require('fs');var path=require(_0xf662('0x6'));var rimraf=require(_0xf662('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xf662('0x8')]=function(_0x3e6aa1,_0x5e8f3b){return _0x3e6aa1['define'](_0xf662('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xf662('0xa'),'fields':[_0xf662('0xb'),_0xf662('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4151=['util','../../config/logger','moment','request-promise','path','rimraf','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x2d129b,_0x178354){var _0x1a65c9=function(_0x4690d4){while(--_0x4690d4){_0x2d129b['push'](_0x2d129b['shift']());}};_0x1a65c9(++_0x178354);}(_0x4151,0x84));var _0x1415=function(_0x3da1c5,_0x53f43f){_0x3da1c5=_0x3da1c5-0x0;var _0x20d262=_0x4151[_0x3da1c5];return _0x20d262;};'use strict';var _=require('lodash');var util=require(_0x1415('0x0'));var logger=require(_0x1415('0x1'))('api');var moment=require(_0x1415('0x2'));var BPromise=require('bluebird');var rp=require(_0x1415('0x3'));var fs=require('fs');var path=require(_0x1415('0x4'));var rimraf=require(_0x1415('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x1415('0x6')]=function(_0x20ca76,_0x438069){return _0x20ca76[_0x1415('0x7')](_0x1415('0x8'),attributes,{'tableName':_0x1415('0x9'),'paranoid':![],'indexes':[{'name':_0x1415('0xa'),'fields':['idField','FieldId'],'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 8f063e8..2bd26f1 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 _0x40b2=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x903dcc,_0x10d4f8){var _0x24d5ce=function(_0x4aadfa){while(--_0x4aadfa){_0x903dcc['push'](_0x903dcc['shift']());}};_0x24d5ce(++_0x10d4f8);}(_0x40b2,0xa9));var _0x240b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x40b2[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x240b('0x0'));var util=require(_0x240b('0x1'));var moment=require('moment');var BPromise=require(_0x240b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x240b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x240b('0x4'));var logger=require(_0x240b('0x5'))(_0x240b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x240b('0x7')][_0x240b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x544332,_0x59dea9,_0x27fef3){return new BPromise(function(_0x1366f3,_0x3b906c){return client['request'](_0x544332,_0x27fef3)[_0x240b('0x9')](function(_0x522ae8){logger[_0x240b('0xa')](_0x240b('0xb'),_0x59dea9,_0x240b('0xc'));logger[_0x240b('0xd')](_0x240b('0xe'),_0x59dea9,_0x240b('0xc'),JSON[_0x240b('0xf')](_0x522ae8));if(_0x522ae8[_0x240b('0x10')]){if(_0x522ae8[_0x240b('0x10')][_0x240b('0x11')]===0x1f4){logger[_0x240b('0x10')](_0x240b('0xb'),_0x59dea9,_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);return _0x3b906c(_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x59dea9,_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);return _0x1366f3(_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);}else{logger[_0x240b('0xa')]('DeskField,\x20%s,\x20%s',_0x59dea9,_0x240b('0xc'));_0x1366f3(_0x522ae8['result']['message']);}})['catch'](function(_0xc433ee){logger[_0x240b('0x10')](_0x240b('0xb'),_0x59dea9,_0xc433ee);_0x3b906c(_0xc433ee);});});} \ No newline at end of file +var _0x3269=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4952e0,_0xb0128){var _0x242292=function(_0x1e54e3){while(--_0x1e54e3){_0x4952e0['push'](_0x4952e0['shift']());}};_0x242292(++_0xb0128);}(_0x3269,0x17b));var _0x9326=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3269[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9326('0x0'));var util=require(_0x9326('0x1'));var moment=require('moment');var BPromise=require(_0x9326('0x2'));var rs=require(_0x9326('0x3'));var fs=require('fs');var Redis=require(_0x9326('0x4'));var db=require(_0x9326('0x5'))['db'];var utils=require(_0x9326('0x6'));var logger=require(_0x9326('0x7'))(_0x9326('0x8'));var config=require(_0x9326('0x9'));var jayson=require(_0x9326('0xa'));var client=jayson[_0x9326('0xb')][_0x9326('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x585ebe,_0x4b90ac,_0x33e449){return new BPromise(function(_0x2e8049,_0x4060f8){return client[_0x9326('0xd')](_0x585ebe,_0x33e449)[_0x9326('0xe')](function(_0x4f34be){logger[_0x9326('0xf')](_0x9326('0x10'),_0x4b90ac,_0x9326('0x11'));logger['debug'](_0x9326('0x12'),_0x4b90ac,_0x9326('0x11'),JSON[_0x9326('0x13')](_0x4f34be));if(_0x4f34be[_0x9326('0x14')]){if(_0x4f34be['error'][_0x9326('0x15')]===0x1f4){logger[_0x9326('0x14')](_0x9326('0x10'),_0x4b90ac,_0x4f34be[_0x9326('0x14')][_0x9326('0x16')]);return _0x4060f8(_0x4f34be[_0x9326('0x14')][_0x9326('0x16')]);}logger[_0x9326('0x14')]('DeskField,\x20%s,\x20%s',_0x4b90ac,_0x4f34be['error']['message']);return _0x2e8049(_0x4f34be[_0x9326('0x14')][_0x9326('0x16')]);}else{logger[_0x9326('0xf')](_0x9326('0x10'),_0x4b90ac,_0x9326('0x11'));_0x2e8049(_0x4f34be[_0x9326('0x17')]['message']);}})[_0x9326('0x18')](function(_0x56ec7c){logger[_0x9326('0x14')](_0x9326('0x10'),_0x4b90ac,_0x56ec7c);_0x4060f8(_0x56ec7c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 73c94a1..d9513b9 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 _0x4ed8=['/:id','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id/configurations','getConfigurations','isAuthenticated','getFields','create','post','addConfiguration','put'];(function(_0x5e767a,_0x47bc4e){var _0x29a6fe=function(_0xabd17d){while(--_0xabd17d){_0x5e767a['push'](_0x5e767a['shift']());}};_0x29a6fe(++_0x47bc4e);}(_0x4ed8,0x1bc));var _0x84ed=function(_0x378d69,_0x35e775){_0x378d69=_0x378d69-0x0;var _0x5b75ef=_0x4ed8[_0x378d69];return _0x5b75ef;};'use strict';var multer=require(_0x84ed('0x0'));var util=require('util');var path=require(_0x84ed('0x1'));var timeout=require(_0x84ed('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x84ed('0x3'));var auth=require(_0x84ed('0x4'));var interaction=require(_0x84ed('0x5'));var config=require(_0x84ed('0x6'));var controller=require(_0x84ed('0x7'));router[_0x84ed('0x8')]('/',auth['isAuthenticated'](),controller[_0x84ed('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x84ed('0x8')](_0x84ed('0xa'),auth['isAuthenticated'](),controller[_0x84ed('0xb')]);router[_0x84ed('0x8')]('/:id/fields',auth[_0x84ed('0xc')](),controller[_0x84ed('0xd')]);router['post']('/',auth[_0x84ed('0xc')](),controller[_0x84ed('0xe')]);router[_0x84ed('0xf')](_0x84ed('0xa'),auth[_0x84ed('0xc')](),controller[_0x84ed('0x10')]);router[_0x84ed('0x11')](_0x84ed('0x12'),auth[_0x84ed('0xc')](),controller[_0x84ed('0x13')]);router[_0x84ed('0x14')](_0x84ed('0x12'),auth[_0x84ed('0xc')](),controller[_0x84ed('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5dc7=['show','getConfigurations','getFields','post','create','/:id/configurations','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get'];(function(_0x427dc3,_0xed2f69){var _0x245846=function(_0xd77d68){while(--_0xd77d68){_0x427dc3['push'](_0x427dc3['shift']());}};_0x245846(++_0xed2f69);}(_0x5dc7,0x155));var _0x75dc=function(_0x4b73cb,_0x334779){_0x4b73cb=_0x4b73cb-0x0;var _0x516fc3=_0x5dc7[_0x4b73cb];return _0x516fc3;};'use strict';var multer=require(_0x75dc('0x0'));var util=require(_0x75dc('0x1'));var path=require(_0x75dc('0x2'));var timeout=require(_0x75dc('0x3'));var express=require(_0x75dc('0x4'));var router=express[_0x75dc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x75dc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x75dc('0x7'));var controller=require(_0x75dc('0x8'));router['get']('/',auth[_0x75dc('0x9')](),controller['index']);router[_0x75dc('0xa')]('/:id',auth[_0x75dc('0x9')](),controller[_0x75dc('0xb')]);router[_0x75dc('0xa')]('/:id/configurations',auth[_0x75dc('0x9')](),controller[_0x75dc('0xc')]);router['get']('/:id/fields',auth[_0x75dc('0x9')](),controller[_0x75dc('0xd')]);router[_0x75dc('0xe')]('/',auth[_0x75dc('0x9')](),controller[_0x75dc('0xf')]);router[_0x75dc('0xe')](_0x75dc('0x10'),auth[_0x75dc('0x9')](),controller['addConfiguration']);router[_0x75dc('0x11')](_0x75dc('0x12'),auth[_0x75dc('0x9')](),controller['update']);router[_0x75dc('0x13')](_0x75dc('0x12'),auth[_0x75dc('0x9')](),controller[_0x75dc('0x14')]);module[_0x75dc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 905252b..46b408f 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 _0x90b5=['BOOLEAN','sequelize','STRING'];(function(_0x385344,_0x3bce76){var _0x321ce3=function(_0x373cbd){while(--_0x373cbd){_0x385344['push'](_0x385344['shift']());}};_0x321ce3(++_0x3bce76);}(_0x90b5,0x139));var _0x590b=function(_0x16559e,_0x35954b){_0x16559e=_0x16559e-0x0;var _0x326a83=_0x90b5[_0x16559e];return _0x326a83;};'use strict';var Sequelize=require(_0x590b('0x0'));module['exports']={'name':{'type':Sequelize[_0x590b('0x1')]},'username':{'type':Sequelize[_0x590b('0x1')]},'password':{'type':Sequelize[_0x590b('0x1')]},'remoteUri':{'type':Sequelize[_0x590b('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x590b('0x1')]},'serverUrl':{'type':Sequelize[_0x590b('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x590b('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaf1b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x41d3e0,_0x3e52a7){var _0x5c058c=function(_0x55da35){while(--_0x55da35){_0x41d3e0['push'](_0x41d3e0['shift']());}};_0x5c058c(++_0x3e52a7);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x449259,_0x2fce9a){_0x449259=_0x449259-0x0;var _0x58c969=_0xaf1b[_0x449259];return _0x58c969;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')]},'username':{'type':Sequelize[_0xbaf1('0x2')]},'password':{'type':Sequelize[_0xbaf1('0x2')]},'remoteUri':{'type':Sequelize[_0xbaf1('0x2')]},'tenantId':{'type':Sequelize[_0xbaf1('0x2')]},'clientId':{'type':Sequelize[_0xbaf1('0x2')]},'clientSecret':{'type':Sequelize[_0xbaf1('0x2')]},'serverUrl':{'type':Sequelize[_0xbaf1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbaf1('0x2')]},'modernAuthentication':{'type':Sequelize[_0xbaf1('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index bd3d6f6..c83b705 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 _0xe9e8=['contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','lastIndexOf','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','LogicalName','UserLocalizedLabel','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','json','offset','undefined','limit','count','status','set','update','then','destroy','end','sendStatus','error','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','params','Dynamics365Configuration','hasOwnProperty','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame'];(function(_0x5004ab,_0x2dbfaa){var _0x34ec4b=function(_0x4e38e8){while(--_0x4e38e8){_0x5004ab['push'](_0x5004ab['shift']());}};_0x34ec4b(++_0x2dbfaa);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x551368,_0x35e717){_0x551368=_0x551368-0x0;var _0x4feceb=_0xe9e8[_0x551368];return _0x4feceb;};'use strict';var rp=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var _=require(_0x8e9e('0x2'));var qs=require(_0x8e9e('0x3'));var logger=require(_0x8e9e('0x4'))(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x103d8b,_0x2a1d41){_0x2a1d41=_0x2a1d41||0xc8;return function(_0x1c09c6){if(_0x1c09c6){return _0x103d8b['status'](_0x2a1d41)[_0x8e9e('0x7')](_0x1c09c6);}};}function respondWithFilteredResult(_0x39983a,_0x204f5c){return function(_0x1fb8d3){if(_0x1fb8d3){var _0x58f822=typeof _0x204f5c[_0x8e9e('0x8')]===_0x8e9e('0x9')&&typeof _0x204f5c[_0x8e9e('0xa')]==='undefined';var _0x39f5e5=_0x1fb8d3[_0x8e9e('0xb')];var _0x449f72=_0x58f822?0x0:_0x204f5c['offset'];var _0xbcfd72=_0x58f822?_0x1fb8d3[_0x8e9e('0xb')]:_0x204f5c[_0x8e9e('0x8')]+_0x204f5c[_0x8e9e('0xa')];var _0x35f014;if(_0xbcfd72>=_0x39f5e5){_0xbcfd72=_0x39f5e5;_0x35f014=0xc8;}else{_0x35f014=0xce;}_0x39983a[_0x8e9e('0xc')](_0x35f014);return _0x39983a[_0x8e9e('0xd')]('Content-Range',_0x449f72+'-'+_0xbcfd72+'/'+_0x39f5e5)[_0x8e9e('0x7')](_0x1fb8d3);}return null;};}function saveUpdates(_0x4af4da){return function(_0x29d7ec){if(_0x29d7ec){return _0x29d7ec[_0x8e9e('0xe')](_0x4af4da)[_0x8e9e('0xf')](function(_0x4355ca){return _0x4355ca;});}return null;};}function removeEntity(_0x1683ba){return function(_0x1c927d){if(_0x1c927d){return _0x1c927d[_0x8e9e('0x10')]()['then'](function(){_0x1683ba['status'](0xcc)[_0x8e9e('0x11')]();});}};}function handleEntityNotFound(_0x36ca0a){return function(_0x5674ef){if(!_0x5674ef){_0x36ca0a[_0x8e9e('0x12')](0x194);}return _0x5674ef;};}function handleError(_0xb67ecc,_0xa45d92){_0xa45d92=_0xa45d92||0x1f4;return function(_0x22b2c7){logger[_0x8e9e('0x13')](_0x22b2c7['stack']);if(_0x22b2c7['name']){delete _0x22b2c7[_0x8e9e('0x14')];}_0xb67ecc[_0x8e9e('0xc')](_0xa45d92)[_0x8e9e('0x15')](_0x22b2c7);};}exports[_0x8e9e('0x16')]=function(_0xa079b5,_0x1b56db){var _0x311697={},_0x5dc0b1={},_0x461d00={'count':0x0,'rows':[]};var _0x5ad498=_[_0x8e9e('0x17')](db[_0x8e9e('0x18')]['rawAttributes'],function(_0x3cbf6b){return{'name':_0x3cbf6b[_0x8e9e('0x19')],'type':_0x3cbf6b[_0x8e9e('0x1a')][_0x8e9e('0x1b')]};});_0x5dc0b1[_0x8e9e('0x1c')]=_[_0x8e9e('0x17')](_0x5ad498,_0x8e9e('0x14'));_0x5dc0b1[_0x8e9e('0x1d')]=_['keys'](_0xa079b5['query']);_0x5dc0b1[_0x8e9e('0x1e')]=_[_0x8e9e('0x1f')](_0x5dc0b1[_0x8e9e('0x1c')],_0x5dc0b1['query']);_0x311697[_0x8e9e('0x20')]=_['intersection'](_0x5dc0b1[_0x8e9e('0x1c')],qs[_0x8e9e('0x21')](_0xa079b5[_0x8e9e('0x1d')]['fields']));_0x311697[_0x8e9e('0x20')]=_0x311697['attributes']['length']?_0x311697[_0x8e9e('0x20')]:_0x5dc0b1['model'];if(!_0xa079b5[_0x8e9e('0x1d')]['hasOwnProperty'](_0x8e9e('0x22'))){_0x311697[_0x8e9e('0xa')]=qs['limit'](_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0xa')]);_0x311697[_0x8e9e('0x8')]=qs[_0x8e9e('0x8')](_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0x8')]);}_0x311697[_0x8e9e('0x23')]=qs[_0x8e9e('0x24')](_0xa079b5[_0x8e9e('0x1d')]['sort']);_0x311697[_0x8e9e('0x25')]=qs[_0x8e9e('0x1e')](_[_0x8e9e('0x26')](_0xa079b5[_0x8e9e('0x1d')],_0x5dc0b1['filters']),_0x5ad498);if(_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0x27')]){_0x311697[_0x8e9e('0x25')]=_[_0x8e9e('0x28')](_0x311697[_0x8e9e('0x25')],{'$or':_[_0x8e9e('0x17')](_0x5ad498,function(_0x221dab){if(_0x221dab[_0x8e9e('0x1a')]!=='VIRTUAL'){var _0x48aa5f={};_0x48aa5f[_0x221dab[_0x8e9e('0x14')]]={'$like':'%'+_0xa079b5['query'][_0x8e9e('0x27')]+'%'};return _0x48aa5f;}})});}_0x311697=_[_0x8e9e('0x28')]({},_0x311697,_0xa079b5[_0x8e9e('0x29')]);var _0x385dae={'where':_0x311697[_0x8e9e('0x25')]};return db[_0x8e9e('0x18')][_0x8e9e('0xb')](_0x385dae)[_0x8e9e('0xf')](function(_0x563903){_0x461d00[_0x8e9e('0xb')]=_0x563903;if(_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0x2a')]){_0x311697[_0x8e9e('0x2b')]=[{'all':!![]}];}return db[_0x8e9e('0x18')][_0x8e9e('0x2c')](_0x311697);})['then'](function(_0x51e8da){_0x461d00[_0x8e9e('0x2d')]=_0x51e8da;return _0x461d00;})['then'](respondWithFilteredResult(_0x1b56db,_0x311697))[_0x8e9e('0x2e')](handleError(_0x1b56db,null));};exports[_0x8e9e('0x2f')]=function(_0x5df186,_0x412d65){var _0x575190={'raw':![],'where':{'id':_0x5df186['params']['id']}},_0x11a378={};_0x11a378[_0x8e9e('0x1c')]=_[_0x8e9e('0x30')](db['Dynamics365Account'][_0x8e9e('0x31')]);_0x11a378[_0x8e9e('0x1d')]=_[_0x8e9e('0x30')](_0x5df186[_0x8e9e('0x1d')]);_0x11a378[_0x8e9e('0x1e')]=_[_0x8e9e('0x1f')](_0x11a378[_0x8e9e('0x1c')],_0x11a378['query']);_0x575190[_0x8e9e('0x20')]=_[_0x8e9e('0x1f')](_0x11a378[_0x8e9e('0x1c')],qs[_0x8e9e('0x21')](_0x5df186[_0x8e9e('0x1d')]['fields']));_0x575190['attributes']=_0x575190[_0x8e9e('0x20')][_0x8e9e('0x32')]?_0x575190[_0x8e9e('0x20')]:_0x11a378[_0x8e9e('0x1c')];if(_0x5df186[_0x8e9e('0x1d')][_0x8e9e('0x2a')]){_0x575190[_0x8e9e('0x2b')]=[{'all':!![]}];}_0x575190=_['merge']({},_0x575190,_0x5df186[_0x8e9e('0x29')]);return db[_0x8e9e('0x18')][_0x8e9e('0x33')](_0x575190)[_0x8e9e('0xf')](handleEntityNotFound(_0x412d65,null))[_0x8e9e('0xf')](respondWithResult(_0x412d65,null))['catch'](handleError(_0x412d65,null));};exports['create']=function(_0x17e215,_0x513fc9){return db[_0x8e9e('0x18')][_0x8e9e('0x34')](_0x17e215[_0x8e9e('0x35')],{})['then'](respondWithResult(_0x513fc9,0xc9))[_0x8e9e('0x2e')](handleError(_0x513fc9,null));};exports[_0x8e9e('0xe')]=function(_0x474b01,_0x3ba910){if(_0x474b01[_0x8e9e('0x35')]['id']){delete _0x474b01[_0x8e9e('0x35')]['id'];}return db[_0x8e9e('0x18')][_0x8e9e('0x33')]({'where':{'id':_0x474b01[_0x8e9e('0x36')]['id']}})[_0x8e9e('0xf')](handleEntityNotFound(_0x3ba910,null))[_0x8e9e('0xf')](saveUpdates(_0x474b01['body'],null))[_0x8e9e('0xf')](respondWithResult(_0x3ba910,null))[_0x8e9e('0x2e')](handleError(_0x3ba910,null));};exports[_0x8e9e('0x10')]=function(_0x4d15b9,_0x57bf29){return db[_0x8e9e('0x18')][_0x8e9e('0x33')]({'where':{'id':_0x4d15b9[_0x8e9e('0x36')]['id']}})[_0x8e9e('0xf')](handleEntityNotFound(_0x57bf29,null))[_0x8e9e('0xf')](removeEntity(_0x57bf29,null))[_0x8e9e('0x2e')](handleError(_0x57bf29,null));};exports['getConfigurations']=function(_0x5c0abc,_0x30ebf5){var _0x12229b={};var _0x58b1d1={};var _0x3bdf84;var _0x488948;return db[_0x8e9e('0x18')]['findOne']({'where':{'id':_0x5c0abc['params']['id']}})[_0x8e9e('0xf')](handleEntityNotFound(_0x30ebf5,null))[_0x8e9e('0xf')](function(_0xe14a7){if(_0xe14a7){_0x3bdf84=_0xe14a7;_0x58b1d1['model']=_['keys'](db[_0x8e9e('0x37')][_0x8e9e('0x31')]);_0x58b1d1[_0x8e9e('0x1d')]=_[_0x8e9e('0x30')](_0x5c0abc[_0x8e9e('0x1d')]);_0x58b1d1[_0x8e9e('0x1e')]=_[_0x8e9e('0x1f')](_0x58b1d1[_0x8e9e('0x1c')],_0x58b1d1[_0x8e9e('0x1d')]);_0x12229b[_0x8e9e('0x20')]=_['intersection'](_0x58b1d1[_0x8e9e('0x1c')],qs[_0x8e9e('0x21')](_0x5c0abc[_0x8e9e('0x1d')]['fields']));_0x12229b[_0x8e9e('0x20')]=_0x12229b['attributes']['length']?_0x12229b[_0x8e9e('0x20')]:_0x58b1d1[_0x8e9e('0x1c')];_0x12229b[_0x8e9e('0x23')]=qs[_0x8e9e('0x24')](_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x24')]);_0x12229b[_0x8e9e('0x25')]=qs['filters'](_['pick'](_0x5c0abc['query'],_0x58b1d1[_0x8e9e('0x1e')]));if(_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x27')]){_0x12229b[_0x8e9e('0x25')]=_[_0x8e9e('0x28')](_0x12229b[_0x8e9e('0x25')],{'$or':_['map'](_0x12229b['attributes'],function(_0x238aca){var _0x32606f={};_0x32606f[_0x238aca]={'$like':'%'+_0x5c0abc['query']['filter']+'%'};return _0x32606f;})});}_0x12229b=_['merge']({},_0x12229b,_0x5c0abc['options']);return _0x3bdf84['getConfigurations'](_0x12229b);}})['then'](function(_0x6d7fe1){if(_0x6d7fe1){_0x488948=_0x6d7fe1[_0x8e9e('0x32')];if(!_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x38')](_0x8e9e('0x22'))){_0x12229b[_0x8e9e('0xa')]=qs['limit'](_0x5c0abc[_0x8e9e('0x1d')]['limit']);_0x12229b[_0x8e9e('0x8')]=qs[_0x8e9e('0x8')](_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x8')]);}return _0x3bdf84[_0x8e9e('0x39')](_0x12229b);}})[_0x8e9e('0xf')](function(_0x127589){if(_0x127589){return _0x127589?{'count':_0x488948,'rows':_0x127589}:null;}})[_0x8e9e('0xf')](respondWithResult(_0x30ebf5,null))[_0x8e9e('0x2e')](handleError(_0x30ebf5,null));};exports[_0x8e9e('0x3a')]=function(_0x1e43a8,_0x367f2c){if(_0x1e43a8[_0x8e9e('0x35')]['id']){delete _0x1e43a8[_0x8e9e('0x35')]['id'];}return db[_0x8e9e('0x18')][_0x8e9e('0x3b')]({'where':{'id':_0x1e43a8[_0x8e9e('0x36')]['id']}})['then'](handleEntityNotFound(_0x367f2c,null))[_0x8e9e('0xf')](function(_0x3e538a){if(_0x3e538a){_0x1e43a8['body'][_0x8e9e('0x3c')]=_0x3e538a['id'];_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3d')]=integrations['getSubjects'](_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3e')],_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x1a')]);_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3f')]=integrations[_0x8e9e('0x40')](_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3e')],_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x1a')]);return db[_0x8e9e('0x37')][_0x8e9e('0x34')](_0x1e43a8['body'],{'include':[{'model':db[_0x8e9e('0x41')],'as':_0x8e9e('0x3d')},{'model':db[_0x8e9e('0x41')],'as':_0x8e9e('0x3f')}]});}return null;})[_0x8e9e('0xf')](respondWithResult(_0x367f2c,null))[_0x8e9e('0x2e')](handleError(_0x367f2c,null));};function sanitizeRemoteUri(_0x2bcebf){var _0x4d6041=_0x2bcebf[_0x8e9e('0x42')](-0x1);if(_0x4d6041==='/')return _0x2bcebf[_0x8e9e('0x43')](0x0,_0x2bcebf['lastIndexOf'](_0x4d6041));return _0x2bcebf;}function getWebApiUrl(_0x598676){return util[_0x8e9e('0x44')](_0x8e9e('0x45'),_0x598676);}exports[_0x8e9e('0x46')]=function(_0x557ee5,_0x366359){var _0xe8efe4=_0x557ee5[_0x8e9e('0x1d')]['ticketType'];var _0x4663e4=_0xe8efe4==='incident'?_0x8e9e('0x47'):_0x8e9e('0x48');var _0x74076f='';var _0x2aaadc='';var _0x287cdd='';var _0x507f5f='';var _0x8ff8a6='';var _0x1dd757='';var _0x5c9b5f='';var _0x476176='';var _0x1f51df=[_0x8e9e('0x49'),_0x8e9e('0x4a'),_0x8e9e('0x4b'),_0x8e9e('0x4c'),_0x8e9e('0x4d'),'subject',_0x8e9e('0x4e'),_0x8e9e('0x4f'),_0x8e9e('0x50'),_0x8e9e('0x51')];var _0x59f9b4=[_0x8e9e('0x52'),_0x8e9e('0x53'),_0x8e9e('0x54'),_0x8e9e('0x55'),_0x8e9e('0x56'),_0x8e9e('0x57'),_0x8e9e('0x58'),_0x8e9e('0x59'),'createdbyexternalpartyname',_0x8e9e('0x5a'),_0x8e9e('0x5b'),'createdbyyominame',_0x8e9e('0x5c'),_0x8e9e('0x5d'),'createdonbehalfbyyominame',_0x8e9e('0x5e'),_0x8e9e('0x5f'),_0x8e9e('0x60'),_0x8e9e('0x61'),'entitlementidname',_0x8e9e('0x62'),_0x8e9e('0x63'),_0x8e9e('0x64'),_0x8e9e('0x65'),'firstresponsebykpiidname',_0x8e9e('0x66'),_0x8e9e('0x67'),_0x8e9e('0x68'),'kbarticleidname',_0x8e9e('0x69'),_0x8e9e('0x6a'),'modifiedbyexternalpartyname',_0x8e9e('0x6b'),_0x8e9e('0x6c'),_0x8e9e('0x6d'),_0x8e9e('0x6e'),_0x8e9e('0x6f'),_0x8e9e('0x70'),_0x8e9e('0x71'),_0x8e9e('0x72'),'numberofchildincidents',_0x8e9e('0x73'),_0x8e9e('0x74'),_0x8e9e('0x75'),_0x8e9e('0x76'),_0x8e9e('0x77'),_0x8e9e('0x78'),'primarycontactidname','primarycontactidyominame',_0x8e9e('0x79'),'productidname',_0x8e9e('0x7a'),_0x8e9e('0x7b'),_0x8e9e('0x7c'),'responseby',_0x8e9e('0x7d'),_0x8e9e('0x7e'),'sentimentvalue','slainvokedidname',_0x8e9e('0x7f'),_0x8e9e('0x80'),_0x8e9e('0x81'),_0x8e9e('0x82'),_0x8e9e('0x83'),'ticketnumber',_0x8e9e('0x84'),_0x8e9e('0x85'),_0x8e9e('0x86'),'utcconversiontimezonecode',_0x8e9e('0x87')];var _0x14fc5d=_0x1f51df[_0x8e9e('0x88')](_0x59f9b4);return db[_0x8e9e('0x18')][_0x8e9e('0x3b')]({'where':{'id':_0x557ee5['params']['id']},'attributes':['id',_0x8e9e('0x89'),_0x8e9e('0x8a'),_0x8e9e('0x8b'),_0x8e9e('0x8c'),'clientId',_0x8e9e('0x8d'),_0x8e9e('0x8e')],'include':[{'model':db[_0x8e9e('0x8f')],'as':_0x8e9e('0x8f'),'attributes':['id',_0x8e9e('0x90'),_0x8e9e('0x91')]}]})[_0x8e9e('0xf')](handleEntityNotFound(_0x366359,null))['then'](function(_0x338dee){if(_0x338dee){if(_0x338dee['modernAuthentication']){_0x338dee['access_token']=_0x338dee[_0x8e9e('0x8f')][_0x8e9e('0x90')];_0x476176=sanitizeRemoteUri(_0x338dee[_0x8e9e('0x8f')][_0x8e9e('0x91')]);_0x5c9b5f=getWebApiUrl(_0x476176);return _0x338dee;}_0x476176=sanitizeRemoteUri(_0x338dee[_0x8e9e('0x8b')]);_0x5c9b5f=getWebApiUrl(_0x476176);var _0x49695c={'method':_0x8e9e('0x92'),'uri':_0x8e9e('0x93')+_0x338dee['tenantId']+_0x8e9e('0x94'),'form':{'client_id':_0x338dee[_0x8e9e('0x95')],'resource':_0x476176,'username':_0x338dee['username'],'password':_0x338dee[_0x8e9e('0x8a')],'grant_type':_0x8e9e('0x8a'),'client_secret':_0x338dee[_0x8e9e('0x8d')]},'json':!![]};return rp(_0x49695c);}})[_0x8e9e('0xf')](function(_0x46a515){_0x1dd757=_0x46a515['access_token'];var _0x212066={'method':_0x8e9e('0x96'),'uri':encodeURI(_0x5c9b5f+_0x8e9e('0x97')+_0x4663e4+'\x27'),'headers':{'Authorization':_0x8e9e('0x98')+_0x1dd757,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x212066);})[_0x8e9e('0xf')](function(_0x461d0e){var _0x1979a7=_0x461d0e[_0x8e9e('0x9a')][0x0];var _0x4ae037=_0x1979a7[_0x8e9e('0x9b')];var _0x5f3e11={'method':'GET','uri':_0x5c9b5f+_0x8e9e('0x9c')+_0x4ae037+_0x8e9e('0x9d'),'headers':{'Authorization':_0x8e9e('0x98')+_0x1dd757,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x5f3e11);})['then'](function(_0xa5ad0b){_0x74076f=_0xa5ad0b;_0x2aaadc=_0x74076f['Attributes'];_0x2aaadc=_[_0x8e9e('0x9e')](_0x2aaadc,function(_0x12e9a0){return!_0x14fc5d[_0x8e9e('0x9f')](_0x12e9a0['LogicalName']);});var _0x1da900=[];var _0x4fbf2f=[];_0x2aaadc[_0x8e9e('0xa0')](function(_0x18996f){if(_0x18996f['@odata.type']){var _0x1110c7=_0x18996f[_0x8e9e('0xa1')][_0x8e9e('0x43')](_0x18996f[_0x8e9e('0xa1')]['lastIndexOf']('.')+0x1);if(_0x1110c7===_0x8e9e('0xa2')){_0x1da900[_0x8e9e('0xa3')](getSelectList(_0x5c9b5f,_0xe8efe4,_0x4fbf2f,_0x74076f[_0x8e9e('0x9b')],_0x18996f['MetadataId'],_0x1dd757));}}});return Promise['all'](_0x1da900);})[_0x8e9e('0xf')](function(_0x1ba8b8){_0x287cdd=_0x1ba8b8[0x0];var _0x68ae35=[];var _0x3e4133=[];_0x2aaadc[_0x8e9e('0xa0')](function(_0xa5d58d){if(!_[_0x8e9e('0xa4')](_0xa5d58d['@odata.type'])){var _0xc266ad=_0xa5d58d[_0x8e9e('0xa1')][_0x8e9e('0x43')](_0xa5d58d['@odata.type'][_0x8e9e('0xa5')]('.')+0x1);if(_0xc266ad===_0x8e9e('0xa6')){_0x68ae35[_0x8e9e('0xa3')](getBooleanList(_0x5c9b5f,_0xe8efe4,_0x3e4133,_0x74076f[_0x8e9e('0x9b')],_0xa5d58d[_0x8e9e('0x9b')],_0x1dd757));}}});return Promise[_0x8e9e('0xa7')](_0x68ae35);})[_0x8e9e('0xf')](function(_0x4e5584){_0x507f5f=_0x4e5584[0x0];var _0x3678d2=[];var _0x1d3fef=[];_0x2aaadc['forEach'](function(_0x8d171a){if(_0x8d171a[_0x8e9e('0xa1')]){var _0x506559=_0x8d171a[_0x8e9e('0xa1')]['substring'](_0x8d171a['@odata.type'][_0x8e9e('0xa5')]('.')+0x1);if(_0x506559===_0x8e9e('0xa8')||_0x506559===_0x8e9e('0xa9')||_0x506559===_0x8e9e('0xaa')||_0x506559==='IntegerAttributeMetadata'||_0x506559==='MemoAttributeMetadata'||_0x506559===_0x8e9e('0xab')||_0x506559===_0x8e9e('0xac')||_0x506559===_0x8e9e('0xad')||_0x506559===_0x8e9e('0xae')||_0x506559===_0x8e9e('0xaf')){_0x3678d2[_0x8e9e('0xa3')](getInputList(_0x5c9b5f,_0xe8efe4,_0x506559,_0x1d3fef,_0x74076f[_0x8e9e('0x9b')],_0x8d171a[_0x8e9e('0x9b')],_0x1dd757));}}});return Promise['all'](_0x3678d2);})[_0x8e9e('0xf')](function(_0x243bd9){_0x8ff8a6=_0x243bd9[0x0];var _0x3827fd=_0x287cdd['concat'](_0x507f5f)[_0x8e9e('0x88')](_0x8ff8a6);var _0x55bcdd={'count':_0x3827fd[_0x8e9e('0x32')],'rows':_0x3827fd};return _0x55bcdd;})['then'](respondWithResult(_0x366359,null))[_0x8e9e('0x2e')](function(_0x6cfb02){var _0x16da90=_0x557ee5[_0x8e9e('0x1d')][_0x8e9e('0xb0')]?0x1f4:_0x6cfb02[_0x8e9e('0xb1')]||0x1f4;logger[_0x8e9e('0x13')](_0x6cfb02[_0x8e9e('0xb2')]);delete _0x6cfb02[_0x8e9e('0x14')];if(_0x16da90===0x191){_0x16da90=0x190;}_0x366359[_0x8e9e('0xc')](_0x16da90)[_0x8e9e('0x15')](_0x557ee5[_0x8e9e('0x1d')][_0x8e9e('0xb0')]?{'message':_0x8e9e('0xb3'),'statusCode':_0x6cfb02[_0x8e9e('0xb1')]}:_0x6cfb02);});};function getSelectList(_0x309085,_0x3b411b,_0x3b89a4,_0x44be22,_0xe6dc68,_0x56c887){var _0x7ea3f5={'method':'GET','uri':_0x309085+_0x8e9e('0x9c')+_0x44be22+_0x8e9e('0xb4')+_0xe6dc68+_0x8e9e('0xb5')+_0x8e9e('0xb6'),'headers':{'Authorization':_0x8e9e('0x98')+_0x56c887,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7ea3f5)['then'](function(_0x2c9267){var _0x3ec38b=[];var _0x5dcd42=_0x2c9267['OptionSet'][_0x8e9e('0xb7')];_0x5dcd42[_0x8e9e('0xa0')](function(_0x10e276){_0x3ec38b[_0x8e9e('0xa3')]({'name':_0x10e276['Label']['UserLocalizedLabel']['Label'],'value':String(_0x10e276['Value'])});});var _0x505997={'id':_0x3b411b+'_'+_0x2c9267[_0x8e9e('0xb8')],'name':_0x2c9267['DisplayName'][_0x8e9e('0xb9')][_0x8e9e('0xba')],'custom':![],'options':_0x3ec38b};_0x3b89a4[_0x8e9e('0xa3')](_0x505997);return _0x3b89a4;});}function getBooleanList(_0x40e854,_0x404b46,_0x11685e,_0x30068e,_0x5e321a,_0x3a3054){var _0x7e4276={'method':'GET','uri':_0x40e854+'EntityDefinitions('+_0x30068e+_0x8e9e('0xb4')+_0x5e321a+_0x8e9e('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x3a3054,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x7e4276)['then'](function(_0x42412e){var _0x309e51=[];_0x309e51[_0x8e9e('0xa3')]({'name':_0x42412e[_0x8e9e('0xbc')][_0x8e9e('0xbd')][_0x8e9e('0xba')][_0x8e9e('0xb9')][_0x8e9e('0xba')],'value':_0x8e9e('0xbe')},{'name':_0x42412e['OptionSet'][_0x8e9e('0xbf')][_0x8e9e('0xba')][_0x8e9e('0xb9')][_0x8e9e('0xba')],'value':_0x8e9e('0xc0')});var _0x1cb605={'id':_0x404b46+'_'+_0x42412e[_0x8e9e('0xb8')],'name':_0x42412e[_0x8e9e('0xc1')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x309e51};_0x11685e[_0x8e9e('0xa3')](_0x1cb605);return _0x11685e;});}function getInputList(_0x41af6b,_0x3dfc57,_0x237f3a,_0x5c0793,_0x35c2ba,_0x607ee2,_0x543eb2){var _0x452c84={'method':'GET','uri':_0x41af6b+_0x8e9e('0x9c')+_0x35c2ba+_0x8e9e('0xb4')+_0x607ee2+_0x8e9e('0xc2')+_0x237f3a+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x543eb2,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x452c84)[_0x8e9e('0xf')](function(_0x41ee31){var _0x40fbb6={'id':_0x3dfc57+'_'+_0x41ee31['LogicalName'],'name':_0x41ee31[_0x8e9e('0xc1')][_0x8e9e('0xb9')]?_0x41ee31[_0x8e9e('0xc1')]['UserLocalizedLabel'][_0x8e9e('0xba')]:_0x41ee31[_0x8e9e('0xb8')],'custom':![],'options':[]};_0x5c0793[_0x8e9e('0xa3')](_0x40fbb6);return _0x5c0793;});} \ No newline at end of file +var _0x5f90=['FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','status','json','offset','undefined','count','set','update','then','destroy','end','sendStatus','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','query','filters','attributes','intersection','model','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','keys','include','catch','create','body','find','Dynamics365Configuration','pick','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data5','data7','https://login.microsoftonline.com/','/oauth2/token','username','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true'];(function(_0x409d34,_0x400f1d){var _0x1a38bc=function(_0x568ada){while(--_0x568ada){_0x409d34['push'](_0x409d34['shift']());}};_0x1a38bc(++_0x400f1d);}(_0x5f90,0xc6));var _0x05f9=function(_0x5a792c,_0x4534c7){_0x5a792c=_0x5a792c-0x0;var _0x1c686a=_0x5f90[_0x5a792c];return _0x1c686a;};'use strict';var rp=require(_0x05f9('0x0'));var util=require(_0x05f9('0x1'));var _=require(_0x05f9('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x05f9('0x3'))(_0x05f9('0x4'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x29cf27,_0x48db61){_0x48db61=_0x48db61||0xc8;return function(_0x3e4303){if(_0x3e4303){return _0x29cf27[_0x05f9('0x5')](_0x48db61)[_0x05f9('0x6')](_0x3e4303);}};}function respondWithFilteredResult(_0x30bf1e,_0x56c069){return function(_0x34b077){if(_0x34b077){var _0x417d86=typeof _0x56c069[_0x05f9('0x7')]===_0x05f9('0x8')&&typeof _0x56c069['limit']===_0x05f9('0x8');var _0x54bb18=_0x34b077[_0x05f9('0x9')];var _0x434b5d=_0x417d86?0x0:_0x56c069[_0x05f9('0x7')];var _0x1c48d5=_0x417d86?_0x34b077[_0x05f9('0x9')]:_0x56c069[_0x05f9('0x7')]+_0x56c069['limit'];var _0x17ff72;if(_0x1c48d5>=_0x54bb18){_0x1c48d5=_0x54bb18;_0x17ff72=0xc8;}else{_0x17ff72=0xce;}_0x30bf1e[_0x05f9('0x5')](_0x17ff72);return _0x30bf1e[_0x05f9('0xa')]('Content-Range',_0x434b5d+'-'+_0x1c48d5+'/'+_0x54bb18)[_0x05f9('0x6')](_0x34b077);}return null;};}function saveUpdates(_0x4dd7fa){return function(_0x1e478e){if(_0x1e478e){return _0x1e478e[_0x05f9('0xb')](_0x4dd7fa)[_0x05f9('0xc')](function(_0x560075){return _0x560075;});}return null;};}function removeEntity(_0x4cca02){return function(_0x317475){if(_0x317475){return _0x317475[_0x05f9('0xd')]()[_0x05f9('0xc')](function(){_0x4cca02[_0x05f9('0x5')](0xcc)[_0x05f9('0xe')]();});}};}function handleEntityNotFound(_0x4fa385){return function(_0x22f748){if(!_0x22f748){_0x4fa385[_0x05f9('0xf')](0x194);}return _0x22f748;};}function handleError(_0x54398e,_0x116de3){_0x116de3=_0x116de3||0x1f4;return function(_0x425f18){logger[_0x05f9('0x10')](_0x425f18[_0x05f9('0x11')]);if(_0x425f18['name']){delete _0x425f18[_0x05f9('0x12')];}_0x54398e['status'](_0x116de3)[_0x05f9('0x13')](_0x425f18);};}exports['index']=function(_0x137293,_0x261532){var _0xb226df={},_0x21bf14={},_0x295112={'count':0x0,'rows':[]};var _0x2150f9=_[_0x05f9('0x14')](db[_0x05f9('0x15')][_0x05f9('0x16')],function(_0x456dcb){return{'name':_0x456dcb[_0x05f9('0x17')],'type':_0x456dcb[_0x05f9('0x18')]['key']};});_0x21bf14['model']=_[_0x05f9('0x14')](_0x2150f9,_0x05f9('0x12'));_0x21bf14[_0x05f9('0x19')]=_['keys'](_0x137293[_0x05f9('0x19')]);_0x21bf14[_0x05f9('0x1a')]=_['intersection'](_0x21bf14['model'],_0x21bf14['query']);_0xb226df[_0x05f9('0x1b')]=_[_0x05f9('0x1c')](_0x21bf14[_0x05f9('0x1d')],qs[_0x05f9('0x1e')](_0x137293[_0x05f9('0x19')][_0x05f9('0x1e')]));_0xb226df[_0x05f9('0x1b')]=_0xb226df[_0x05f9('0x1b')][_0x05f9('0x1f')]?_0xb226df[_0x05f9('0x1b')]:_0x21bf14['model'];if(!_0x137293[_0x05f9('0x19')]['hasOwnProperty'](_0x05f9('0x20'))){_0xb226df[_0x05f9('0x21')]=qs[_0x05f9('0x21')](_0x137293[_0x05f9('0x19')][_0x05f9('0x21')]);_0xb226df[_0x05f9('0x7')]=qs[_0x05f9('0x7')](_0x137293['query'][_0x05f9('0x7')]);}_0xb226df[_0x05f9('0x22')]=qs['sort'](_0x137293[_0x05f9('0x19')][_0x05f9('0x23')]);_0xb226df[_0x05f9('0x24')]=qs['filters'](_['pick'](_0x137293['query'],_0x21bf14[_0x05f9('0x1a')]),_0x2150f9);if(_0x137293[_0x05f9('0x19')][_0x05f9('0x25')]){_0xb226df[_0x05f9('0x24')]=_['merge'](_0xb226df['where'],{'$or':_[_0x05f9('0x14')](_0x2150f9,function(_0x1192a4){if(_0x1192a4[_0x05f9('0x18')]!==_0x05f9('0x26')){var _0x2049d0={};_0x2049d0[_0x1192a4[_0x05f9('0x12')]]={'$like':'%'+_0x137293[_0x05f9('0x19')]['filter']+'%'};return _0x2049d0;}})});}_0xb226df=_[_0x05f9('0x27')]({},_0xb226df,_0x137293[_0x05f9('0x28')]);var _0x4f50c4={'where':_0xb226df[_0x05f9('0x24')]};return db['Dynamics365Account']['count'](_0x4f50c4)[_0x05f9('0xc')](function(_0x400887){_0x295112[_0x05f9('0x9')]=_0x400887;if(_0x137293[_0x05f9('0x19')][_0x05f9('0x29')]){_0xb226df['include']=[{'all':!![]}];}return db[_0x05f9('0x15')][_0x05f9('0x2a')](_0xb226df);})['then'](function(_0x5ae0b9){_0x295112['rows']=_0x5ae0b9;return _0x295112;})[_0x05f9('0xc')](respondWithFilteredResult(_0x261532,_0xb226df))['catch'](handleError(_0x261532,null));};exports[_0x05f9('0x2b')]=function(_0x33be6f,_0x1308d7){var _0x4ac3e1={'raw':![],'where':{'id':_0x33be6f[_0x05f9('0x2c')]['id']}},_0x3d19f1={};_0x3d19f1[_0x05f9('0x1d')]=_['keys'](db['Dynamics365Account'][_0x05f9('0x16')]);_0x3d19f1[_0x05f9('0x19')]=_[_0x05f9('0x2d')](_0x33be6f[_0x05f9('0x19')]);_0x3d19f1[_0x05f9('0x1a')]=_['intersection'](_0x3d19f1[_0x05f9('0x1d')],_0x3d19f1[_0x05f9('0x19')]);_0x4ac3e1[_0x05f9('0x1b')]=_['intersection'](_0x3d19f1[_0x05f9('0x1d')],qs[_0x05f9('0x1e')](_0x33be6f[_0x05f9('0x19')][_0x05f9('0x1e')]));_0x4ac3e1[_0x05f9('0x1b')]=_0x4ac3e1['attributes'][_0x05f9('0x1f')]?_0x4ac3e1['attributes']:_0x3d19f1['model'];if(_0x33be6f[_0x05f9('0x19')][_0x05f9('0x29')]){_0x4ac3e1[_0x05f9('0x2e')]=[{'all':!![]}];}_0x4ac3e1=_['merge']({},_0x4ac3e1,_0x33be6f[_0x05f9('0x28')]);return db[_0x05f9('0x15')]['find'](_0x4ac3e1)['then'](handleEntityNotFound(_0x1308d7,null))[_0x05f9('0xc')](respondWithResult(_0x1308d7,null))[_0x05f9('0x2f')](handleError(_0x1308d7,null));};exports[_0x05f9('0x30')]=function(_0x21c1bb,_0x5a2ede){return db['Dynamics365Account']['create'](_0x21c1bb[_0x05f9('0x31')],{})[_0x05f9('0xc')](respondWithResult(_0x5a2ede,0xc9))[_0x05f9('0x2f')](handleError(_0x5a2ede,null));};exports[_0x05f9('0xb')]=function(_0x338da7,_0x5a54c4){if(_0x338da7[_0x05f9('0x31')]['id']){delete _0x338da7[_0x05f9('0x31')]['id'];}return db[_0x05f9('0x15')][_0x05f9('0x32')]({'where':{'id':_0x338da7[_0x05f9('0x2c')]['id']}})[_0x05f9('0xc')](handleEntityNotFound(_0x5a54c4,null))[_0x05f9('0xc')](saveUpdates(_0x338da7['body'],null))['then'](respondWithResult(_0x5a54c4,null))[_0x05f9('0x2f')](handleError(_0x5a54c4,null));};exports[_0x05f9('0xd')]=function(_0x604a91,_0x540137){return db[_0x05f9('0x15')][_0x05f9('0x32')]({'where':{'id':_0x604a91[_0x05f9('0x2c')]['id']}})[_0x05f9('0xc')](handleEntityNotFound(_0x540137,null))[_0x05f9('0xc')](removeEntity(_0x540137,null))[_0x05f9('0x2f')](handleError(_0x540137,null));};exports['getConfigurations']=function(_0x335230,_0x39c7f0){var _0xd001f6={};var _0x4f20f3={};var _0x2505ce;var _0x30b9b0;return db['Dynamics365Account']['findOne']({'where':{'id':_0x335230[_0x05f9('0x2c')]['id']}})[_0x05f9('0xc')](handleEntityNotFound(_0x39c7f0,null))['then'](function(_0x97ec0){if(_0x97ec0){_0x2505ce=_0x97ec0;_0x4f20f3[_0x05f9('0x1d')]=_[_0x05f9('0x2d')](db[_0x05f9('0x33')][_0x05f9('0x16')]);_0x4f20f3[_0x05f9('0x19')]=_[_0x05f9('0x2d')](_0x335230['query']);_0x4f20f3[_0x05f9('0x1a')]=_[_0x05f9('0x1c')](_0x4f20f3[_0x05f9('0x1d')],_0x4f20f3[_0x05f9('0x19')]);_0xd001f6[_0x05f9('0x1b')]=_[_0x05f9('0x1c')](_0x4f20f3['model'],qs[_0x05f9('0x1e')](_0x335230[_0x05f9('0x19')][_0x05f9('0x1e')]));_0xd001f6['attributes']=_0xd001f6[_0x05f9('0x1b')]['length']?_0xd001f6[_0x05f9('0x1b')]:_0x4f20f3[_0x05f9('0x1d')];_0xd001f6[_0x05f9('0x22')]=qs[_0x05f9('0x23')](_0x335230['query'][_0x05f9('0x23')]);_0xd001f6['where']=qs[_0x05f9('0x1a')](_[_0x05f9('0x34')](_0x335230['query'],_0x4f20f3['filters']));if(_0x335230['query'][_0x05f9('0x25')]){_0xd001f6[_0x05f9('0x24')]=_[_0x05f9('0x27')](_0xd001f6[_0x05f9('0x24')],{'$or':_[_0x05f9('0x14')](_0xd001f6[_0x05f9('0x1b')],function(_0x433ad5){var _0x3318e0={};_0x3318e0[_0x433ad5]={'$like':'%'+_0x335230[_0x05f9('0x19')][_0x05f9('0x25')]+'%'};return _0x3318e0;})});}_0xd001f6=_[_0x05f9('0x27')]({},_0xd001f6,_0x335230[_0x05f9('0x28')]);return _0x2505ce[_0x05f9('0x35')](_0xd001f6);}})[_0x05f9('0xc')](function(_0x46196e){if(_0x46196e){_0x30b9b0=_0x46196e[_0x05f9('0x1f')];if(!_0x335230[_0x05f9('0x19')][_0x05f9('0x36')]('nolimit')){_0xd001f6[_0x05f9('0x21')]=qs[_0x05f9('0x21')](_0x335230['query'][_0x05f9('0x21')]);_0xd001f6[_0x05f9('0x7')]=qs['offset'](_0x335230['query'][_0x05f9('0x7')]);}return _0x2505ce[_0x05f9('0x35')](_0xd001f6);}})[_0x05f9('0xc')](function(_0x40cbdc){if(_0x40cbdc){return _0x40cbdc?{'count':_0x30b9b0,'rows':_0x40cbdc}:null;}})[_0x05f9('0xc')](respondWithResult(_0x39c7f0,null))[_0x05f9('0x2f')](handleError(_0x39c7f0,null));};exports[_0x05f9('0x37')]=function(_0x22582a,_0x539bd4){if(_0x22582a[_0x05f9('0x31')]['id']){delete _0x22582a[_0x05f9('0x31')]['id'];}return db[_0x05f9('0x15')][_0x05f9('0x38')]({'where':{'id':_0x22582a['params']['id']}})['then'](handleEntityNotFound(_0x539bd4,null))[_0x05f9('0xc')](function(_0x864dd9){if(_0x864dd9){_0x22582a['body'][_0x05f9('0x39')]=_0x864dd9['id'];_0x22582a['body'][_0x05f9('0x3a')]=integrations[_0x05f9('0x3b')](_0x22582a[_0x05f9('0x31')][_0x05f9('0x3c')],_0x22582a[_0x05f9('0x31')][_0x05f9('0x18')]);_0x22582a['body'][_0x05f9('0x3d')]=integrations[_0x05f9('0x3e')](_0x22582a[_0x05f9('0x31')]['channel'],_0x22582a[_0x05f9('0x31')][_0x05f9('0x18')]);return db[_0x05f9('0x33')][_0x05f9('0x30')](_0x22582a['body'],{'include':[{'model':db[_0x05f9('0x3f')],'as':'Subjects'},{'model':db[_0x05f9('0x3f')],'as':'Descriptions'}]});}return null;})[_0x05f9('0xc')](respondWithResult(_0x539bd4,null))[_0x05f9('0x2f')](handleError(_0x539bd4,null));};function sanitizeRemoteUri(_0x4c414a){var _0x494264=_0x4c414a[_0x05f9('0x40')](-0x1);if(_0x494264==='/')return _0x4c414a['substring'](0x0,_0x4c414a[_0x05f9('0x41')](_0x494264));return _0x4c414a;}function getWebApiUrl(_0x25ed7f){return util[_0x05f9('0x42')]('%s/api/data/v9.0/',_0x25ed7f);}exports[_0x05f9('0x43')]=function(_0x1b08f0,_0x6f4e92){var _0x3bcdf3=_0x1b08f0['query'][_0x05f9('0x44')];var _0x593138=_0x3bcdf3===_0x05f9('0x45')?_0x05f9('0x46'):_0x05f9('0x47');var _0x4a6b54='';var _0x30b63a='';var _0x21a46f='';var _0x68bee2='';var _0x49b119='';var _0x542e63='';var _0x5d0ab5='';var _0x420842='';var _0x5de6f5=[_0x05f9('0x48'),_0x05f9('0x49'),_0x05f9('0x4a'),_0x05f9('0x4b'),_0x05f9('0x4c'),_0x05f9('0x4d'),_0x05f9('0x4e'),_0x05f9('0x4f'),_0x05f9('0x50'),_0x05f9('0x51')];var _0x359837=['accountidname',_0x05f9('0x52'),'actualserviceunits',_0x05f9('0x53'),_0x05f9('0x54'),_0x05f9('0x55'),_0x05f9('0x56'),_0x05f9('0x57'),_0x05f9('0x58'),_0x05f9('0x59'),'createdbyname',_0x05f9('0x5a'),_0x05f9('0x5b'),'createdonbehalfbyname',_0x05f9('0x5c'),_0x05f9('0x5d'),'customeridtype',_0x05f9('0x5e'),_0x05f9('0x5f'),_0x05f9('0x60'),'entityimage_timestamp',_0x05f9('0x61'),_0x05f9('0x62'),_0x05f9('0x63'),_0x05f9('0x64'),_0x05f9('0x65'),_0x05f9('0x66'),_0x05f9('0x67'),_0x05f9('0x68'),_0x05f9('0x69'),'masteridname','modifiedbyexternalpartyname',_0x05f9('0x6a'),_0x05f9('0x6b'),_0x05f9('0x6c'),_0x05f9('0x6d'),_0x05f9('0x6e'),_0x05f9('0x6f'),'msdyn_incidenttypename',_0x05f9('0x70'),'numberofchildincidents','onholdtime','overriddencreatedon','owneridname',_0x05f9('0x71'),_0x05f9('0x72'),_0x05f9('0x73'),'primarycontactidname','primarycontactidyominame',_0x05f9('0x74'),_0x05f9('0x75'),_0x05f9('0x76'),_0x05f9('0x77'),_0x05f9('0x78'),_0x05f9('0x79'),_0x05f9('0x7a'),_0x05f9('0x7b'),_0x05f9('0x7c'),_0x05f9('0x7d'),_0x05f9('0x7e'),_0x05f9('0x7f'),_0x05f9('0x80'),_0x05f9('0x81'),_0x05f9('0x82'),_0x05f9('0x83'),'timezoneruleversionnumber',_0x05f9('0x84'),_0x05f9('0x85'),_0x05f9('0x86'),_0x05f9('0x87')];var _0x30c5e5=_0x5de6f5['concat'](_0x359837);return db[_0x05f9('0x15')][_0x05f9('0x38')]({'where':{'id':_0x1b08f0[_0x05f9('0x2c')]['id']},'attributes':['id','username',_0x05f9('0x88'),_0x05f9('0x89'),_0x05f9('0x8a'),_0x05f9('0x8b'),_0x05f9('0x8c'),_0x05f9('0x8d')],'include':[{'model':db[_0x05f9('0x8e')],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0x05f9('0xc')](handleEntityNotFound(_0x6f4e92,null))[_0x05f9('0xc')](function(_0x5b6038){if(_0x5b6038){if(_0x5b6038['modernAuthentication']){_0x5b6038[_0x05f9('0x8f')]=_0x5b6038['CloudProvider'][_0x05f9('0x90')];_0x420842=sanitizeRemoteUri(_0x5b6038[_0x05f9('0x8e')][_0x05f9('0x91')]);_0x5d0ab5=getWebApiUrl(_0x420842);return _0x5b6038;}_0x420842=sanitizeRemoteUri(_0x5b6038[_0x05f9('0x89')]);_0x5d0ab5=getWebApiUrl(_0x420842);var _0x2fb55e={'method':'POST','uri':_0x05f9('0x92')+_0x5b6038[_0x05f9('0x8a')]+_0x05f9('0x93'),'form':{'client_id':_0x5b6038['clientId'],'resource':_0x420842,'username':_0x5b6038[_0x05f9('0x94')],'password':_0x5b6038[_0x05f9('0x88')],'grant_type':'password','client_secret':_0x5b6038['clientSecret']},'json':!![]};return rp(_0x2fb55e);}})[_0x05f9('0xc')](function(_0x3c1845){_0x542e63=_0x3c1845['access_token'];var _0x55143b={'method':'GET','uri':encodeURI(_0x5d0ab5+_0x05f9('0x95')+_0x593138+'\x27'),'headers':{'Authorization':_0x05f9('0x96')+_0x542e63,'If-None-Match':null,'OData-Version':_0x05f9('0x97')},'json':!![]};return rp(_0x55143b);})[_0x05f9('0xc')](function(_0x48815f){var _0x6febd9=_0x48815f[_0x05f9('0x98')][0x0];var _0xf04553=_0x6febd9[_0x05f9('0x99')];var _0x846afd={'method':_0x05f9('0x9a'),'uri':_0x5d0ab5+_0x05f9('0x9b')+_0xf04553+_0x05f9('0x9c'),'headers':{'Authorization':_0x05f9('0x96')+_0x542e63,'If-None-Match':null,'OData-Version':_0x05f9('0x97')},'json':!![]};return rp(_0x846afd);})[_0x05f9('0xc')](function(_0x194a2a){_0x4a6b54=_0x194a2a;_0x30b63a=_0x4a6b54[_0x05f9('0x9d')];_0x30b63a=_['remove'](_0x30b63a,function(_0x1b3cb0){return!_0x30c5e5[_0x05f9('0x9e')](_0x1b3cb0[_0x05f9('0x9f')]);});var _0x1de449=[];var _0x4668cd=[];_0x30b63a[_0x05f9('0xa0')](function(_0x95d69a){if(_0x95d69a['@odata.type']){var _0x2777d0=_0x95d69a[_0x05f9('0xa1')][_0x05f9('0xa2')](_0x95d69a[_0x05f9('0xa1')][_0x05f9('0x41')]('.')+0x1);if(_0x2777d0===_0x05f9('0xa3')){_0x1de449[_0x05f9('0xa4')](getSelectList(_0x5d0ab5,_0x3bcdf3,_0x4668cd,_0x4a6b54['MetadataId'],_0x95d69a[_0x05f9('0x99')],_0x542e63));}}});return Promise[_0x05f9('0xa5')](_0x1de449);})['then'](function(_0x2095ba){_0x21a46f=_0x2095ba[0x0];var _0x4c8231=[];var _0xba23a=[];_0x30b63a[_0x05f9('0xa0')](function(_0x3bac54){if(!_['isNil'](_0x3bac54[_0x05f9('0xa1')])){var _0x10ab11=_0x3bac54[_0x05f9('0xa1')]['substring'](_0x3bac54[_0x05f9('0xa1')][_0x05f9('0x41')]('.')+0x1);if(_0x10ab11===_0x05f9('0xa6')){_0x4c8231[_0x05f9('0xa4')](getBooleanList(_0x5d0ab5,_0x3bcdf3,_0xba23a,_0x4a6b54[_0x05f9('0x99')],_0x3bac54[_0x05f9('0x99')],_0x542e63));}}});return Promise[_0x05f9('0xa5')](_0x4c8231);})['then'](function(_0x4c0813){_0x68bee2=_0x4c0813[0x0];var _0x4e984f=[];var _0x5aae71=[];_0x30b63a['forEach'](function(_0x3d891d){if(_0x3d891d[_0x05f9('0xa1')]){var _0x9ae257=_0x3d891d[_0x05f9('0xa1')][_0x05f9('0xa2')](_0x3d891d['@odata.type'][_0x05f9('0x41')]('.')+0x1);if(_0x9ae257===_0x05f9('0xa7')||_0x9ae257===_0x05f9('0xa8')||_0x9ae257===_0x05f9('0xa9')||_0x9ae257===_0x05f9('0xaa')||_0x9ae257===_0x05f9('0xab')||_0x9ae257===_0x05f9('0xac')||_0x9ae257==='StatusAttributeMetadata'||_0x9ae257===_0x05f9('0xad')||_0x9ae257===_0x05f9('0xae')||_0x9ae257===_0x05f9('0xaf')){_0x4e984f[_0x05f9('0xa4')](getInputList(_0x5d0ab5,_0x3bcdf3,_0x9ae257,_0x5aae71,_0x4a6b54[_0x05f9('0x99')],_0x3d891d['MetadataId'],_0x542e63));}}});return Promise[_0x05f9('0xa5')](_0x4e984f);})[_0x05f9('0xc')](function(_0x356621){_0x49b119=_0x356621[0x0];var _0x5c8759=_0x21a46f[_0x05f9('0xb0')](_0x68bee2)[_0x05f9('0xb0')](_0x49b119);var _0x1b39ec={'count':_0x5c8759[_0x05f9('0x1f')],'rows':_0x5c8759};return _0x1b39ec;})[_0x05f9('0xc')](respondWithResult(_0x6f4e92,null))[_0x05f9('0x2f')](function(_0x38bdbe){var _0x4a1d31=_0x1b08f0[_0x05f9('0x19')][_0x05f9('0xb1')]?0x1f4:_0x38bdbe[_0x05f9('0xb2')]||0x1f4;logger[_0x05f9('0x10')](_0x38bdbe[_0x05f9('0x11')]);delete _0x38bdbe[_0x05f9('0x12')];if(_0x4a1d31===0x191){_0x4a1d31=0x190;}_0x6f4e92['status'](_0x4a1d31)['send'](_0x1b08f0[_0x05f9('0x19')][_0x05f9('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x38bdbe[_0x05f9('0xb2')]}:_0x38bdbe);});};function getSelectList(_0xe93bbd,_0x1f7772,_0x15a5ed,_0x3f2ce6,_0x3e2efc,_0x22ffce){var _0x1c9120={'method':_0x05f9('0x9a'),'uri':_0xe93bbd+_0x05f9('0x9b')+_0x3f2ce6+_0x05f9('0xb3')+_0x3e2efc+_0x05f9('0xb4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x05f9('0x96')+_0x22ffce,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c9120)['then'](function(_0x2ceaeb){var _0x1da757=[];var _0xfb1da3=_0x2ceaeb['OptionSet'][_0x05f9('0xb5')];_0xfb1da3[_0x05f9('0xa0')](function(_0x5e8e57){_0x1da757['push']({'name':_0x5e8e57[_0x05f9('0xb6')][_0x05f9('0xb7')][_0x05f9('0xb6')],'value':String(_0x5e8e57[_0x05f9('0xb8')])});});var _0x175286={'id':_0x1f7772+'_'+_0x2ceaeb['LogicalName'],'name':_0x2ceaeb[_0x05f9('0xb9')][_0x05f9('0xb7')][_0x05f9('0xb6')],'custom':![],'options':_0x1da757};_0x15a5ed[_0x05f9('0xa4')](_0x175286);return _0x15a5ed;});}function getBooleanList(_0x421c85,_0x3c89bf,_0x15f480,_0x4c24d4,_0x4c01de,_0x539690){var _0x519471={'method':_0x05f9('0x9a'),'uri':_0x421c85+'EntityDefinitions('+_0x4c24d4+')/Attributes('+_0x4c01de+_0x05f9('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x539690,'If-None-Match':null,'OData-Version':_0x05f9('0x97')},'json':!![]};return rp(_0x519471)[_0x05f9('0xc')](function(_0x4916c8){var _0x45c266=[];_0x45c266[_0x05f9('0xa4')]({'name':_0x4916c8[_0x05f9('0xbb')][_0x05f9('0xbc')][_0x05f9('0xb6')]['UserLocalizedLabel']['Label'],'value':_0x05f9('0xbd')},{'name':_0x4916c8[_0x05f9('0xbb')][_0x05f9('0xbe')][_0x05f9('0xb6')][_0x05f9('0xb7')][_0x05f9('0xb6')],'value':_0x05f9('0xbf')});var _0x1640df={'id':_0x3c89bf+'_'+_0x4916c8[_0x05f9('0x9f')],'name':_0x4916c8[_0x05f9('0xb9')][_0x05f9('0xb7')][_0x05f9('0xb6')],'custom':![],'options':_0x45c266};_0x15f480['push'](_0x1640df);return _0x15f480;});}function getInputList(_0x38180b,_0x2f6619,_0xf3e5bd,_0x134c85,_0x41789b,_0x2a2f01,_0x362557){var _0x5edc84={'method':_0x05f9('0x9a'),'uri':_0x38180b+_0x05f9('0x9b')+_0x41789b+')/Attributes('+_0x2a2f01+_0x05f9('0xc0')+_0xf3e5bd+_0x05f9('0xc1'),'headers':{'Authorization':_0x05f9('0x96')+_0x362557,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5edc84)[_0x05f9('0xc')](function(_0x232d97){var _0x401006={'id':_0x2f6619+'_'+_0x232d97[_0x05f9('0x9f')],'name':_0x232d97[_0x05f9('0xb9')][_0x05f9('0xb7')]?_0x232d97[_0x05f9('0xb9')][_0x05f9('0xb7')][_0x05f9('0xb6')]:_0x232d97[_0x05f9('0x9f')],'custom':![],'options':[]};_0x134c85[_0x05f9('0xa4')](_0x401006);return _0x134c85;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 41b593b..59a666c 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x56f437,_0x16b910){var _0x1ede62=function(_0x5a65ab){while(--_0x5a65ab){_0x56f437['push'](_0x56f437['shift']());}};_0x1ede62(++_0x16b910);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x2fc1ec,_0x2442fc){var _0x360d22=function(_0x5bc7b1){while(--_0x5bc7b1){_0x2fc1ec['push'](_0x2fc1ec['shift']());}};_0x360d22(++_0x2442fc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index a9d51d0..f9ae330 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 _0x4def=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowDynamics365Account','then','debug','util'];(function(_0x51b66f,_0x23c9b0){var _0x545f8f=function(_0x175d84){while(--_0x175d84){_0x51b66f['push'](_0x51b66f['shift']());}};_0x545f8f(++_0x23c9b0);}(_0x4def,0xcb));var _0xf4de=function(_0x3f9aa0,_0x478ec3){_0x3f9aa0=_0x3f9aa0-0x0;var _0x4a82c0=_0x4def[_0x3f9aa0];return _0x4a82c0;};'use strict';var _=require('lodash');var util=require(_0xf4de('0x0'));var moment=require('moment');var BPromise=require(_0xf4de('0x1'));var rs=require(_0xf4de('0x2'));var fs=require('fs');var Redis=require(_0xf4de('0x3'));var db=require(_0xf4de('0x4'))['db'];var utils=require(_0xf4de('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf4de('0x6'));var jayson=require(_0xf4de('0x7'));var client=jayson[_0xf4de('0x8')][_0xf4de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47ad79,_0x27465f,_0x31316b){return new BPromise(function(_0x456168,_0x4eb27a){return client[_0xf4de('0xa')](_0x47ad79,_0x31316b)['then'](function(_0xd6aa2d){logger[_0xf4de('0xb')](_0xf4de('0xc'),_0x27465f,_0xf4de('0xd'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x27465f,_0xf4de('0xd'),JSON['stringify'](_0xd6aa2d));if(_0xd6aa2d[_0xf4de('0xe')]){if(_0xd6aa2d[_0xf4de('0xe')][_0xf4de('0xf')]===0x1f4){logger['error'](_0xf4de('0xc'),_0x27465f,_0xd6aa2d[_0xf4de('0xe')][_0xf4de('0x10')]);return _0x4eb27a(_0xd6aa2d[_0xf4de('0xe')]['message']);}logger[_0xf4de('0xe')](_0xf4de('0xc'),_0x27465f,_0xd6aa2d[_0xf4de('0xe')]['message']);return _0x456168(_0xd6aa2d[_0xf4de('0xe')][_0xf4de('0x10')]);}else{logger[_0xf4de('0xb')](_0xf4de('0xc'),_0x27465f,'request\x20sent');_0x456168(_0xd6aa2d[_0xf4de('0x11')][_0xf4de('0x10')]);}})[_0xf4de('0x12')](function(_0x341bc4){logger[_0xf4de('0xe')](_0xf4de('0xc'),_0x27465f,_0x341bc4);_0x4eb27a(_0x341bc4);});});}exports[_0xf4de('0x13')]=function(_0x5cbaad){var _0x32f9b3=this;return new Promise(function(_0x2e3fb5,_0x27c47a){return db[_0xf4de('0x14')][_0xf4de('0x15')]({'raw':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad['options'][_0xf4de('0x17')]===undefined?!![]:![]:!![],'where':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x18')]||null:null,'attributes':_0x5cbaad['options']?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x19')]||null:null,'limit':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x1a')]||null:null,'include':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x1b')]?_['map'](_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x1b')],function(_0x3859d8){return{'model':db[_0x3859d8[_0xf4de('0x1c')]],'as':_0x3859d8['as'],'attributes':_0x3859d8[_0xf4de('0x19')],'include':_0x3859d8[_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x3859d8[_0xf4de('0x1b')],function(_0x3090a1){return{'model':db[_0x3090a1[_0xf4de('0x1c')]],'as':_0x3090a1['as'],'attributes':_0x3090a1[_0xf4de('0x19')],'include':_0x3090a1[_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x3090a1[_0xf4de('0x1b')],function(_0xfaf430){return{'model':db[_0xfaf430[_0xf4de('0x1c')]],'as':_0xfaf430['as'],'attributes':_0xfaf430[_0xf4de('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x374a65){logger[_0xf4de('0xb')](_0xf4de('0x13'),_0x5cbaad);logger['debug'](_0xf4de('0x13'),_0x5cbaad,JSON[_0xf4de('0x1e')](_0x374a65));_0x2e3fb5(_0x374a65);})[_0xf4de('0x12')](function(_0x37ed72){logger[_0xf4de('0xe')](_0xf4de('0x13'),_0x37ed72[_0xf4de('0x10')],_0x5cbaad);_0x27c47a(_0x32f9b3[_0xf4de('0xe')](0x1f4,_0x37ed72[_0xf4de('0x10')]));});});};exports[_0xf4de('0x1f')]=function(_0x5e8b06){var _0x176620=this;return new Promise(function(_0x5a90ea,_0x3c2a12){return db[_0xf4de('0x14')]['find']({'raw':_0x5e8b06['options']?_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x17')]===undefined?!![]:![]:!![],'where':_0x5e8b06[_0xf4de('0x16')]?_0x5e8b06[_0xf4de('0x16')]['where']||null:null,'attributes':_0x5e8b06[_0xf4de('0x16')]?_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x19')]||null:null,'include':_0x5e8b06[_0xf4de('0x16')]?_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x1b')],function(_0x5b6298){return{'model':db[_0x5b6298[_0xf4de('0x1c')]],'as':_0x5b6298['as'],'attributes':_0x5b6298[_0xf4de('0x19')],'include':_0x5b6298[_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x5b6298['include'],function(_0x1dfa07){return{'model':db[_0x1dfa07[_0xf4de('0x1c')]],'as':_0x1dfa07['as'],'attributes':_0x1dfa07[_0xf4de('0x19')],'include':_0x1dfa07[_0xf4de('0x1b')]?_['map'](_0x1dfa07[_0xf4de('0x1b')],function(_0x3e0e12){return{'model':db[_0x3e0e12[_0xf4de('0x1c')]],'as':_0x3e0e12['as'],'attributes':_0x3e0e12[_0xf4de('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf4de('0x20')](function(_0x15612b){logger[_0xf4de('0xb')]('ShowDynamics365Account',_0x5e8b06);logger[_0xf4de('0x21')](_0xf4de('0x1f'),_0x5e8b06,JSON[_0xf4de('0x1e')](_0x15612b));_0x5a90ea(_0x15612b);})[_0xf4de('0x12')](function(_0x190e63){logger[_0xf4de('0xe')](_0xf4de('0x1f'),_0x190e63[_0xf4de('0x10')],_0x5e8b06);_0x3c2a12(_0x176620[_0xf4de('0xe')](0x1f4,_0x190e63['message']));});});}; \ No newline at end of file +var _0x2645=['attributes','limit','include','map','model','catch','ShowDynamics365Account','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where'];(function(_0x2b4bfd,_0x2454eb){var _0x2142d1=function(_0x64bd62){while(--_0x64bd62){_0x2b4bfd['push'](_0x2b4bfd['shift']());}};_0x2142d1(++_0x2454eb);}(_0x2645,0x6e));var _0x5264=function(_0xe00187,_0x4c061d){_0xe00187=_0xe00187-0x0;var _0x37a216=_0x2645[_0xe00187];return _0x37a216;};'use strict';var _=require(_0x5264('0x0'));var util=require(_0x5264('0x1'));var moment=require('moment');var BPromise=require(_0x5264('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5264('0x3'));var db=require(_0x5264('0x4'))['db'];var utils=require(_0x5264('0x5'));var logger=require('../../config/logger')(_0x5264('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5264('0x7')][_0x5264('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30fc62,_0x534979,_0x345919){return new BPromise(function(_0x2be9bf,_0x51b663){return client[_0x5264('0x9')](_0x30fc62,_0x345919)[_0x5264('0xa')](function(_0x3a10dd){logger[_0x5264('0xb')](_0x5264('0xc'),_0x534979,_0x5264('0xd'));logger[_0x5264('0xe')](_0x5264('0xf'),_0x534979,'request\x20sent',JSON[_0x5264('0x10')](_0x3a10dd));if(_0x3a10dd[_0x5264('0x11')]){if(_0x3a10dd[_0x5264('0x11')][_0x5264('0x12')]===0x1f4){logger[_0x5264('0x11')](_0x5264('0xc'),_0x534979,_0x3a10dd[_0x5264('0x11')][_0x5264('0x13')]);return _0x51b663(_0x3a10dd[_0x5264('0x11')][_0x5264('0x13')]);}logger[_0x5264('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x534979,_0x3a10dd[_0x5264('0x11')]['message']);return _0x2be9bf(_0x3a10dd[_0x5264('0x11')][_0x5264('0x13')]);}else{logger[_0x5264('0xb')](_0x5264('0xc'),_0x534979,_0x5264('0xd'));_0x2be9bf(_0x3a10dd['result'][_0x5264('0x13')]);}})['catch'](function(_0x46aac3){logger[_0x5264('0x11')](_0x5264('0xc'),_0x534979,_0x46aac3);_0x51b663(_0x46aac3);});});}exports[_0x5264('0x14')]=function(_0x1dd7b2){var _0x40bc29=this;return new Promise(function(_0x286d91,_0x394e37){return db[_0x5264('0x15')][_0x5264('0x16')]({'raw':_0x1dd7b2[_0x5264('0x17')]?_0x1dd7b2['options'][_0x5264('0x18')]===undefined?!![]:![]:!![],'where':_0x1dd7b2[_0x5264('0x17')]?_0x1dd7b2[_0x5264('0x17')][_0x5264('0x19')]||null:null,'attributes':_0x1dd7b2[_0x5264('0x17')]?_0x1dd7b2[_0x5264('0x17')][_0x5264('0x1a')]||null:null,'limit':_0x1dd7b2['options']?_0x1dd7b2[_0x5264('0x17')][_0x5264('0x1b')]||null:null,'include':_0x1dd7b2['options']?_0x1dd7b2[_0x5264('0x17')][_0x5264('0x1c')]?_[_0x5264('0x1d')](_0x1dd7b2[_0x5264('0x17')][_0x5264('0x1c')],function(_0x27bdbc){return{'model':db[_0x27bdbc[_0x5264('0x1e')]],'as':_0x27bdbc['as'],'attributes':_0x27bdbc[_0x5264('0x1a')],'include':_0x27bdbc['include']?_['map'](_0x27bdbc['include'],function(_0x1705df){return{'model':db[_0x1705df[_0x5264('0x1e')]],'as':_0x1705df['as'],'attributes':_0x1705df[_0x5264('0x1a')],'include':_0x1705df['include']?_[_0x5264('0x1d')](_0x1705df[_0x5264('0x1c')],function(_0x59a2d7){return{'model':db[_0x59a2d7['model']],'as':_0x59a2d7['as'],'attributes':_0x59a2d7[_0x5264('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5264('0xa')](function(_0x169ce8){logger['info'](_0x5264('0x14'),_0x1dd7b2);logger['debug'](_0x5264('0x14'),_0x1dd7b2,JSON[_0x5264('0x10')](_0x169ce8));_0x286d91(_0x169ce8);})[_0x5264('0x1f')](function(_0xec9530){logger[_0x5264('0x11')]('GetDynamics365Account',_0xec9530['message'],_0x1dd7b2);_0x394e37(_0x40bc29[_0x5264('0x11')](0x1f4,_0xec9530['message']));});});};exports[_0x5264('0x20')]=function(_0x526685){var _0x4e3521=this;return new Promise(function(_0x226d37,_0x56eb30){return db[_0x5264('0x15')][_0x5264('0x21')]({'raw':_0x526685[_0x5264('0x17')]?_0x526685[_0x5264('0x17')][_0x5264('0x18')]===undefined?!![]:![]:!![],'where':_0x526685[_0x5264('0x17')]?_0x526685[_0x5264('0x17')][_0x5264('0x19')]||null:null,'attributes':_0x526685['options']?_0x526685[_0x5264('0x17')][_0x5264('0x1a')]||null:null,'include':_0x526685['options']?_0x526685[_0x5264('0x17')][_0x5264('0x1c')]?_['map'](_0x526685['options'][_0x5264('0x1c')],function(_0x4ac351){return{'model':db[_0x4ac351[_0x5264('0x1e')]],'as':_0x4ac351['as'],'attributes':_0x4ac351[_0x5264('0x1a')],'include':_0x4ac351[_0x5264('0x1c')]?_['map'](_0x4ac351[_0x5264('0x1c')],function(_0x44cbae){return{'model':db[_0x44cbae['model']],'as':_0x44cbae['as'],'attributes':_0x44cbae[_0x5264('0x1a')],'include':_0x44cbae[_0x5264('0x1c')]?_['map'](_0x44cbae[_0x5264('0x1c')],function(_0x34d630){return{'model':db[_0x34d630[_0x5264('0x1e')]],'as':_0x34d630['as'],'attributes':_0x34d630[_0x5264('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5264('0xa')](function(_0x2b10ff){logger[_0x5264('0xb')](_0x5264('0x20'),_0x526685);logger['debug']('ShowDynamics365Account',_0x526685,JSON['stringify'](_0x2b10ff));_0x226d37(_0x2b10ff);})[_0x5264('0x1f')](function(_0x5c8ccc){logger[_0x5264('0x11')](_0x5264('0x20'),_0x5c8ccc[_0x5264('0x13')],_0x526685);_0x56eb30(_0x4e3521[_0x5264('0x11')](0x1f4,_0x5c8ccc[_0x5264('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e38d6ac..3449508 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 _0xb7e2=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','path','express','fs-extra','../../components/interaction/service'];(function(_0x208dcd,_0x21b78a){var _0x471717=function(_0x4bf68a){while(--_0x4bf68a){_0x208dcd['push'](_0x208dcd['shift']());}};_0x471717(++_0x21b78a);}(_0xb7e2,0x103));var _0x2b7e=function(_0x2ef84a,_0xdf6a89){_0x2ef84a=_0x2ef84a-0x0;var _0x20b62a=_0xb7e2[_0x2ef84a];return _0x20b62a;};'use strict';var multer=require(_0x2b7e('0x0'));var util=require('util');var path=require(_0x2b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x2b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2b7e('0x4'));var config=require(_0x2b7e('0x5'));var controller=require(_0x2b7e('0x6'));router[_0x2b7e('0x7')]('/',auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x9')]);router['get'](_0x2b7e('0xa'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0xb')]);router['get'](_0x2b7e('0xc'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0xd')]);router[_0x2b7e('0x7')](_0x2b7e('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2b7e('0x7')](_0x2b7e('0xf'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x10')]);router[_0x2b7e('0x11')]('/',auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x12')]);router['put'](_0x2b7e('0xa'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x13')]);router[_0x2b7e('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2b7e('0x15')]=router; \ No newline at end of file +var _0x81b7=['../../config/environment','./intDynamics365Configuration.controller','get','index','show','/:id/fields','isAuthenticated','/:id/subjects','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x541a10,_0x53f603){var _0x45a4a6=function(_0x184540){while(--_0x184540){_0x541a10['push'](_0x541a10['shift']());}};_0x45a4a6(++_0x53f603);}(_0x81b7,0x1f2));var _0x781b=function(_0x516192,_0x254d8f){_0x516192=_0x516192-0x0;var _0x4ff148=_0x81b7[_0x516192];return _0x4ff148;};'use strict';var multer=require('multer');var util=require(_0x781b('0x0'));var path=require(_0x781b('0x1'));var timeout=require(_0x781b('0x2'));var express=require(_0x781b('0x3'));var router=express['Router']();var fs_extra=require(_0x781b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x781b('0x5'));var config=require(_0x781b('0x6'));var controller=require(_0x781b('0x7'));router[_0x781b('0x8')]('/',auth['isAuthenticated'](),controller[_0x781b('0x9')]);router[_0x781b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x781b('0xa')]);router[_0x781b('0x8')](_0x781b('0xb'),auth[_0x781b('0xc')](),controller['getFields']);router[_0x781b('0x8')](_0x781b('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x781b('0x8')]('/:id/descriptions',auth[_0x781b('0xc')](),controller['getDescriptions']);router[_0x781b('0xe')]('/',auth['isAuthenticated'](),controller[_0x781b('0xf')]);router['put'](_0x781b('0x10'),auth[_0x781b('0xc')](),controller[_0x781b('0x11')]);router[_0x781b('0x12')](_0x781b('0x10'),auth['isAuthenticated'](),controller[_0x781b('0x13')]);module[_0x781b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 019ce41..27cad4d 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 _0x8057=['sequelize','exports','STRING','ENUM','incident','phonecall','contact','nothing'];(function(_0x50d5ae,_0x22a349){var _0x1e8d74=function(_0xd256a9){while(--_0xd256a9){_0x50d5ae['push'](_0x50d5ae['shift']());}};_0x1e8d74(++_0x22a349);}(_0x8057,0x150));var _0x7805=function(_0x2ebd47,_0x5c7d31){_0x2ebd47=_0x2ebd47-0x0;var _0x21cea0=_0x8057[_0x2ebd47];return _0x21cea0;};'use strict';var Sequelize=require(_0x7805('0x0'));module[_0x7805('0x1')]={'name':{'type':Sequelize[_0x7805('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x7805('0x3')](_0x7805('0x4'),_0x7805('0x5')),'defaultValue':_0x7805('0x4')},'moduleCreate':{'type':Sequelize[_0x7805('0x3')](_0x7805('0x6'),_0x7805('0x7')),'defaultValue':_0x7805('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7805('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xc91b=['STRING','ENUM','incident','contact','nothing','sequelize','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc91b,0x67));var _0xbc91=function(_0x4e106b,_0x2f6518){_0x4e106b=_0x4e106b-0x0;var _0x401e47=_0xc91b[_0x4e106b];return _0x401e47;};'use strict';var Sequelize=require(_0xbc91('0x0'));module[_0xbc91('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbc91('0x2')]},'ticketType':{'type':Sequelize[_0xbc91('0x3')](_0xbc91('0x4'),'phonecall'),'defaultValue':_0xbc91('0x4')},'moduleCreate':{'type':Sequelize[_0xbc91('0x3')](_0xbc91('0x5'),_0xbc91('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8a0d077..f5a1735 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 _0xbb62=['sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','intersection','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','request-promise','moment','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','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','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x55fbea,_0x381e55){var _0x13520d=function(_0x3ef0eb){while(--_0x3ef0eb){_0x55fbea['push'](_0x55fbea['shift']());}};_0x13520d(++_0x381e55);}(_0xbb62,0x163));var _0x2bb6=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xbb62[_0x54d4a8];return _0x3b321b;};'use strict';var emlformat=require(_0x2bb6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bb6('0x1'));var moment=require(_0x2bb6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2bb6('0x3'));var path=require('path');var sox=require(_0x2bb6('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bb6('0x5'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2bb6('0x6'));var jsforce=require(_0x2bb6('0x7'));var deskjs=require(_0x2bb6('0x8'));var toCsv=require(_0x2bb6('0x9'));var querystring=require(_0x2bb6('0xa'));var Papa=require(_0x2bb6('0xb'));var Redis=require('ioredis');var authService=require(_0x2bb6('0xc'));var qs=require(_0x2bb6('0xd'));var as=require(_0x2bb6('0xe'));var hardwareService=require(_0x2bb6('0xf'));var logger=require(_0x2bb6('0x10'))(_0x2bb6('0x11'));var utils=require(_0x2bb6('0x12'));var config=require(_0x2bb6('0x13'));var licenseUtil=require(_0x2bb6('0x14'));var db=require(_0x2bb6('0x15'))['db'];function respondWithStatusCode(_0x6a86d6,_0x24209d){_0x24209d=_0x24209d||0xcc;return function(_0x29e289){if(_0x29e289){return _0x6a86d6['sendStatus'](_0x24209d);}return _0x6a86d6[_0x2bb6('0x16')](_0x24209d)[_0x2bb6('0x17')]();};}function respondWithResult(_0x436c94,_0x34fc14){_0x34fc14=_0x34fc14||0xc8;return function(_0x21899d){if(_0x21899d){return _0x436c94[_0x2bb6('0x16')](_0x34fc14)['json'](_0x21899d);}};}function respondWithFilteredResult(_0x4f8abc,_0x5d31a0){return function(_0x1805e4){if(_0x1805e4){var _0x526b33=typeof _0x5d31a0[_0x2bb6('0x18')]===_0x2bb6('0x19')&&typeof _0x5d31a0[_0x2bb6('0x1a')]===_0x2bb6('0x19');var _0x37a109=_0x1805e4['count'];var _0x2972ec=_0x526b33?0x0:_0x5d31a0[_0x2bb6('0x18')];var _0x3ce6f0=_0x526b33?_0x1805e4[_0x2bb6('0x1b')]:_0x5d31a0[_0x2bb6('0x18')]+_0x5d31a0[_0x2bb6('0x1a')];var _0x13dc30;if(_0x3ce6f0>=_0x37a109){_0x3ce6f0=_0x37a109;_0x13dc30=0xc8;}else{_0x13dc30=0xce;}_0x4f8abc[_0x2bb6('0x16')](_0x13dc30);return _0x4f8abc[_0x2bb6('0x1c')]('Content-Range',_0x2972ec+'-'+_0x3ce6f0+'/'+_0x37a109)['json'](_0x1805e4);}return null;};}function patchUpdates(_0xa16f1a){return function(_0x22ca5c){try{jsonpatch[_0x2bb6('0x1d')](_0x22ca5c,_0xa16f1a,!![]);}catch(_0x48c2a4){return BPromise[_0x2bb6('0x1e')](_0x48c2a4);}return _0x22ca5c[_0x2bb6('0x1f')]();};}function saveUpdates(_0x5c2c58,_0x7adeed){return function(_0x2a4079){if(_0x2a4079){return _0x2a4079[_0x2bb6('0x20')](_0x5c2c58)[_0x2bb6('0x21')](function(_0x3822ad){return _0x3822ad;});}return null;};}function removeEntity(_0x576828,_0x79ba0d){return function(_0x432a53){if(_0x432a53){return _0x432a53[_0x2bb6('0x22')]()[_0x2bb6('0x21')](function(){_0x576828[_0x2bb6('0x16')](0xcc)[_0x2bb6('0x17')]();});}};}function handleEntityNotFound(_0xec3671,_0x5365d0){return function(_0x516279){if(!_0x516279){_0xec3671[_0x2bb6('0x23')](0x194);}return _0x516279;};}function handleError(_0x3f55fe,_0x282b05){_0x282b05=_0x282b05||0x1f4;return function(_0x3b0360){logger[_0x2bb6('0x24')](_0x3b0360[_0x2bb6('0x25')]);if(_0x3b0360[_0x2bb6('0x26')]){delete _0x3b0360[_0x2bb6('0x26')];}_0x3f55fe['status'](_0x282b05)[_0x2bb6('0x27')](_0x3b0360);};}exports[_0x2bb6('0x28')]=function(_0x53939a,_0x5eefcf){var _0x6aa513={},_0x31bf78={},_0x2c44d4={'count':0x0,'rows':[]};var _0x276e6d=_['map'](db[_0x2bb6('0x29')][_0x2bb6('0x2a')],function(_0x9fc1de){return{'name':_0x9fc1de[_0x2bb6('0x2b')],'type':_0x9fc1de[_0x2bb6('0x2c')][_0x2bb6('0x2d')]};});_0x31bf78['model']=_[_0x2bb6('0x2e')](_0x276e6d,_0x2bb6('0x26'));_0x31bf78[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x53939a['query']);_0x31bf78[_0x2bb6('0x31')]=_['intersection'](_0x31bf78['model'],_0x31bf78[_0x2bb6('0x2f')]);_0x6aa513[_0x2bb6('0x32')]=_['intersection'](_0x31bf78[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x53939a['query'][_0x2bb6('0x34')]));_0x6aa513[_0x2bb6('0x32')]=_0x6aa513[_0x2bb6('0x32')][_0x2bb6('0x35')]?_0x6aa513[_0x2bb6('0x32')]:_0x31bf78[_0x2bb6('0x33')];if(!_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x6aa513[_0x2bb6('0x1a')]=qs['limit'](_0x53939a['query'][_0x2bb6('0x1a')]);_0x6aa513[_0x2bb6('0x18')]=qs['offset'](_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x18')]);}_0x6aa513[_0x2bb6('0x38')]=qs[_0x2bb6('0x39')](_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x39')]);_0x6aa513[_0x2bb6('0x3a')]=qs[_0x2bb6('0x31')](_[_0x2bb6('0x3b')](_0x53939a[_0x2bb6('0x2f')],_0x31bf78[_0x2bb6('0x31')]),_0x276e6d);if(_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]){_0x6aa513[_0x2bb6('0x3a')]=_['merge'](_0x6aa513[_0x2bb6('0x3a')],{'$or':_[_0x2bb6('0x2e')](_0x276e6d,function(_0xcb0a60){if(_0xcb0a60[_0x2bb6('0x2c')]!==_0x2bb6('0x3d')){var _0x20f9a3={};_0x20f9a3[_0xcb0a60[_0x2bb6('0x26')]]={'$like':'%'+_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]+'%'};return _0x20f9a3;}})});}_0x6aa513=_[_0x2bb6('0x3e')]({},_0x6aa513,_0x53939a[_0x2bb6('0x3f')]);var _0x41f4cc={'where':_0x6aa513[_0x2bb6('0x3a')]};return db[_0x2bb6('0x29')]['count'](_0x41f4cc)['then'](function(_0x5babca){_0x2c44d4[_0x2bb6('0x1b')]=_0x5babca;if(_0x53939a[_0x2bb6('0x2f')]['includeAll']){_0x6aa513['include']=[{'all':!![]}];}return db[_0x2bb6('0x29')][_0x2bb6('0x40')](_0x6aa513);})[_0x2bb6('0x21')](function(_0x10fa31){_0x2c44d4[_0x2bb6('0x41')]=_0x10fa31;return _0x2c44d4;})[_0x2bb6('0x21')](respondWithFilteredResult(_0x5eefcf,_0x6aa513))[_0x2bb6('0x42')](handleError(_0x5eefcf,null));};exports[_0x2bb6('0x43')]=function(_0x1af582,_0x3d9514){var _0x53fc50={'raw':![],'where':{'id':_0x1af582[_0x2bb6('0x44')]['id']}},_0x7f1118={};_0x7f1118[_0x2bb6('0x33')]=_[_0x2bb6('0x30')](db['Dynamics365Configuration'][_0x2bb6('0x2a')]);_0x7f1118[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x1af582['query']);_0x7f1118[_0x2bb6('0x31')]=_[_0x2bb6('0x45')](_0x7f1118[_0x2bb6('0x33')],_0x7f1118[_0x2bb6('0x2f')]);_0x53fc50[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x7f1118[_0x2bb6('0x33')],qs['fields'](_0x1af582['query'][_0x2bb6('0x34')]));_0x53fc50[_0x2bb6('0x32')]=_0x53fc50[_0x2bb6('0x32')][_0x2bb6('0x35')]?_0x53fc50[_0x2bb6('0x32')]:_0x7f1118[_0x2bb6('0x33')];if(_0x1af582[_0x2bb6('0x2f')]['includeAll']){_0x53fc50['include']=[{'all':!![]}];}_0x53fc50=_[_0x2bb6('0x3e')]({},_0x53fc50,_0x1af582[_0x2bb6('0x3f')]);return db['Dynamics365Configuration'][_0x2bb6('0x46')](_0x53fc50)[_0x2bb6('0x21')](handleEntityNotFound(_0x3d9514,null))[_0x2bb6('0x21')](respondWithResult(_0x3d9514,null))[_0x2bb6('0x42')](handleError(_0x3d9514,null));};exports[_0x2bb6('0x47')]=function(_0x27bf53,_0x3799c9){return db[_0x2bb6('0x29')][_0x2bb6('0x47')](_0x27bf53[_0x2bb6('0x48')],{})[_0x2bb6('0x21')](respondWithResult(_0x3799c9,0xc9))[_0x2bb6('0x42')](handleError(_0x3799c9,null));};exports[_0x2bb6('0x20')]=function(_0x4268f8,_0x2dbda8){if(_0x4268f8['body']['id']){delete _0x4268f8['body']['id'];}return db['Dynamics365Configuration'][_0x2bb6('0x46')]({'where':{'id':_0x4268f8['params']['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0x2dbda8,null))['then'](saveUpdates(_0x4268f8[_0x2bb6('0x48')],null))['then'](respondWithResult(_0x2dbda8,null))[_0x2bb6('0x42')](handleError(_0x2dbda8,null));};exports[_0x2bb6('0x22')]=function(_0x4e9f99,_0xab715c){return db[_0x2bb6('0x29')][_0x2bb6('0x46')]({'where':{'id':_0x4e9f99[_0x2bb6('0x44')]['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0xab715c,null))[_0x2bb6('0x21')](removeEntity(_0xab715c,null))['catch'](handleError(_0xab715c,null));};exports[_0x2bb6('0x49')]=function(_0x59757a,_0x5e9f49,_0x3c26ff){var _0x40b5ad={};var _0x3d879e={};var _0x5c7a2a;var _0x3d163d;return db['Dynamics365Configuration'][_0x2bb6('0x4a')]({'where':{'id':_0x59757a[_0x2bb6('0x44')]['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0x5e9f49,null))['then'](function(_0x63af98){if(_0x63af98){_0x5c7a2a=_0x63af98;_0x3d879e['model']=_[_0x2bb6('0x30')](db[_0x2bb6('0x4b')]['rawAttributes']);_0x3d879e[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x59757a[_0x2bb6('0x2f')]);_0x3d879e[_0x2bb6('0x31')]=_['intersection'](_0x3d879e['model'],_0x3d879e[_0x2bb6('0x2f')]);_0x40b5ad[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x3d879e[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x59757a['query'][_0x2bb6('0x34')]));_0x40b5ad[_0x2bb6('0x32')]=_0x40b5ad['attributes'][_0x2bb6('0x35')]?_0x40b5ad[_0x2bb6('0x32')]:_0x3d879e[_0x2bb6('0x33')];_0x40b5ad[_0x2bb6('0x38')]=qs[_0x2bb6('0x39')](_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x39')]);_0x40b5ad['where']=qs[_0x2bb6('0x31')](_[_0x2bb6('0x3b')](_0x59757a[_0x2bb6('0x2f')],_0x3d879e['filters']));if(_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]){_0x40b5ad[_0x2bb6('0x3a')]=_['merge'](_0x40b5ad['where'],{'$or':_['map'](_0x40b5ad[_0x2bb6('0x32')],function(_0x30181a){var _0x4da381={};_0x4da381[_0x30181a]={'$like':'%'+_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]+'%'};return _0x4da381;})});}_0x40b5ad=_['merge']({},_0x40b5ad,_0x59757a[_0x2bb6('0x3f')]);return _0x5c7a2a[_0x2bb6('0x49')](_0x40b5ad);}})[_0x2bb6('0x21')](function(_0x142ad4){if(_0x142ad4){_0x3d163d=_0x142ad4['length'];if(!_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x40b5ad['limit']=qs[_0x2bb6('0x1a')](_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x1a')]);_0x40b5ad[_0x2bb6('0x18')]=qs['offset'](_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x18')]);}return _0x5c7a2a['getFields'](_0x40b5ad);}})[_0x2bb6('0x21')](function(_0x4bfadf){if(_0x4bfadf){return _0x4bfadf?{'count':_0x3d163d,'rows':_0x4bfadf}:null;}})[_0x2bb6('0x21')](respondWithResult(_0x5e9f49,null))[_0x2bb6('0x42')](handleError(_0x5e9f49,null));};exports['getSubjects']=function(_0x583558,_0x3778d6,_0x45f74d){var _0x51fc68={};var _0x246f2c={};var _0x5d56fb;var _0x491007;return db[_0x2bb6('0x29')][_0x2bb6('0x4a')]({'where':{'id':_0x583558[_0x2bb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x3778d6,null))['then'](function(_0x3e5a05){if(_0x3e5a05){_0x5d56fb=_0x3e5a05;_0x246f2c['model']=_[_0x2bb6('0x30')](db[_0x2bb6('0x4b')][_0x2bb6('0x2a')]);_0x246f2c[_0x2bb6('0x2f')]=_['keys'](_0x583558[_0x2bb6('0x2f')]);_0x246f2c[_0x2bb6('0x31')]=_[_0x2bb6('0x45')](_0x246f2c['model'],_0x246f2c['query']);_0x51fc68[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x246f2c[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x583558['query'][_0x2bb6('0x34')]));_0x51fc68['attributes']=_0x51fc68['attributes'][_0x2bb6('0x35')]?_0x51fc68['attributes']:_0x246f2c[_0x2bb6('0x33')];_0x51fc68[_0x2bb6('0x38')]=qs[_0x2bb6('0x39')](_0x583558[_0x2bb6('0x2f')]['sort']);_0x51fc68['where']=qs[_0x2bb6('0x31')](_[_0x2bb6('0x3b')](_0x583558[_0x2bb6('0x2f')],_0x246f2c['filters']));if(_0x583558['query']['filter']){_0x51fc68[_0x2bb6('0x3a')]=_[_0x2bb6('0x3e')](_0x51fc68[_0x2bb6('0x3a')],{'$or':_[_0x2bb6('0x2e')](_0x51fc68[_0x2bb6('0x32')],function(_0x1ac1b6){var _0x3967bd={};_0x3967bd[_0x1ac1b6]={'$like':'%'+_0x583558[_0x2bb6('0x2f')][_0x2bb6('0x3c')]+'%'};return _0x3967bd;})});}_0x51fc68=_['merge']({},_0x51fc68,_0x583558[_0x2bb6('0x3f')]);return _0x5d56fb[_0x2bb6('0x4c')](_0x51fc68);}})[_0x2bb6('0x21')](function(_0x490f88){if(_0x490f88){_0x491007=_0x490f88['length'];if(!_0x583558[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x51fc68[_0x2bb6('0x1a')]=qs[_0x2bb6('0x1a')](_0x583558[_0x2bb6('0x2f')][_0x2bb6('0x1a')]);_0x51fc68['offset']=qs[_0x2bb6('0x18')](_0x583558['query'][_0x2bb6('0x18')]);}return _0x5d56fb[_0x2bb6('0x4c')](_0x51fc68);}})[_0x2bb6('0x21')](function(_0x267276){if(_0x267276){return _0x267276?{'count':_0x491007,'rows':_0x267276}:null;}})[_0x2bb6('0x21')](respondWithResult(_0x3778d6,null))['catch'](handleError(_0x3778d6,null));};exports[_0x2bb6('0x4d')]=function(_0x3ca302,_0x2667c1,_0x480d34){var _0x20c9a2={};var _0x189820={};var _0xac2e9d;var _0x1ac821;return db[_0x2bb6('0x29')]['findOne']({'where':{'id':_0x3ca302[_0x2bb6('0x44')]['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0x2667c1,null))[_0x2bb6('0x21')](function(_0x34001b){if(_0x34001b){_0xac2e9d=_0x34001b;_0x189820[_0x2bb6('0x33')]=_[_0x2bb6('0x30')](db[_0x2bb6('0x4b')][_0x2bb6('0x2a')]);_0x189820[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x3ca302['query']);_0x189820[_0x2bb6('0x31')]=_['intersection'](_0x189820[_0x2bb6('0x33')],_0x189820['query']);_0x20c9a2[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x189820[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x3ca302['query']['fields']));_0x20c9a2[_0x2bb6('0x32')]=_0x20c9a2[_0x2bb6('0x32')]['length']?_0x20c9a2[_0x2bb6('0x32')]:_0x189820[_0x2bb6('0x33')];_0x20c9a2[_0x2bb6('0x38')]=qs['sort'](_0x3ca302[_0x2bb6('0x2f')]['sort']);_0x20c9a2[_0x2bb6('0x3a')]=qs['filters'](_[_0x2bb6('0x3b')](_0x3ca302['query'],_0x189820['filters']));if(_0x3ca302[_0x2bb6('0x2f')][_0x2bb6('0x3c')]){_0x20c9a2[_0x2bb6('0x3a')]=_[_0x2bb6('0x3e')](_0x20c9a2[_0x2bb6('0x3a')],{'$or':_[_0x2bb6('0x2e')](_0x20c9a2[_0x2bb6('0x32')],function(_0x3e1dc4){var _0x580699={};_0x580699[_0x3e1dc4]={'$like':'%'+_0x3ca302[_0x2bb6('0x2f')]['filter']+'%'};return _0x580699;})});}_0x20c9a2=_[_0x2bb6('0x3e')]({},_0x20c9a2,_0x3ca302[_0x2bb6('0x3f')]);return _0xac2e9d[_0x2bb6('0x4d')](_0x20c9a2);}})[_0x2bb6('0x21')](function(_0x5ba71f){if(_0x5ba71f){_0x1ac821=_0x5ba71f[_0x2bb6('0x35')];if(!_0x3ca302[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x20c9a2['limit']=qs[_0x2bb6('0x1a')](_0x3ca302[_0x2bb6('0x2f')]['limit']);_0x20c9a2[_0x2bb6('0x18')]=qs['offset'](_0x3ca302[_0x2bb6('0x2f')][_0x2bb6('0x18')]);}return _0xac2e9d[_0x2bb6('0x4d')](_0x20c9a2);}})[_0x2bb6('0x21')](function(_0x135954){if(_0x135954){return _0x135954?{'count':_0x1ac821,'rows':_0x135954}:null;}})['then'](respondWithResult(_0x2667c1,null))[_0x2bb6('0x42')](handleError(_0x2667c1,null));}; \ No newline at end of file +var _0x4543=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','sendStatus','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','create','body','getFields','findOne','getSubjects','Dynamics365Field','nolimit','getDescriptions','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x4543,0xf4));var _0x3454=function(_0x503f72,_0x150d00){_0x503f72=_0x503f72-0x0;var _0x325f48=_0x4543[_0x503f72];return _0x325f48;};'use strict';var emlformat=require(_0x3454('0x0'));var rimraf=require(_0x3454('0x1'));var zipdir=require(_0x3454('0x2'));var jsonpatch=require(_0x3454('0x3'));var rp=require(_0x3454('0x4'));var moment=require(_0x3454('0x5'));var BPromise=require(_0x3454('0x6'));var Mustache=require(_0x3454('0x7'));var util=require(_0x3454('0x8'));var path=require(_0x3454('0x9'));var sox=require(_0x3454('0xa'));var csv=require(_0x3454('0xb'));var ejs=require(_0x3454('0xc'));var fs=require('fs');var fs_extra=require(_0x3454('0xd'));var _=require('lodash');var squel=require(_0x3454('0xe'));var crypto=require('crypto');var jsforce=require(_0x3454('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3454('0xb'));var querystring=require(_0x3454('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3454('0x11'));var qs=require(_0x3454('0x12'));var as=require(_0x3454('0x13'));var hardwareService=require(_0x3454('0x14'));var logger=require(_0x3454('0x15'))(_0x3454('0x16'));var utils=require(_0x3454('0x17'));var config=require(_0x3454('0x18'));var licenseUtil=require(_0x3454('0x19'));var db=require(_0x3454('0x1a'))['db'];function respondWithStatusCode(_0xa7026f,_0x4d9cbb){_0x4d9cbb=_0x4d9cbb||0xcc;return function(_0x42a22d){if(_0x42a22d){return _0xa7026f['sendStatus'](_0x4d9cbb);}return _0xa7026f['status'](_0x4d9cbb)['end']();};}function respondWithResult(_0x2c7a0f,_0x1670f5){_0x1670f5=_0x1670f5||0xc8;return function(_0x4b18d3){if(_0x4b18d3){return _0x2c7a0f[_0x3454('0x1b')](_0x1670f5)['json'](_0x4b18d3);}};}function respondWithFilteredResult(_0x499a8e,_0x49fb15){return function(_0x407a8f){if(_0x407a8f){var _0x23bd1f=typeof _0x49fb15[_0x3454('0x1c')]===_0x3454('0x1d')&&typeof _0x49fb15[_0x3454('0x1e')]==='undefined';var _0x192fcd=_0x407a8f[_0x3454('0x1f')];var _0x3a33b6=_0x23bd1f?0x0:_0x49fb15['offset'];var _0x20acb8=_0x23bd1f?_0x407a8f['count']:_0x49fb15[_0x3454('0x1c')]+_0x49fb15[_0x3454('0x1e')];var _0x249671;if(_0x20acb8>=_0x192fcd){_0x20acb8=_0x192fcd;_0x249671=0xc8;}else{_0x249671=0xce;}_0x499a8e[_0x3454('0x1b')](_0x249671);return _0x499a8e[_0x3454('0x20')](_0x3454('0x21'),_0x3a33b6+'-'+_0x20acb8+'/'+_0x192fcd)[_0x3454('0x22')](_0x407a8f);}return null;};}function patchUpdates(_0x3d3bc8){return function(_0x58fb4f){try{jsonpatch[_0x3454('0x23')](_0x58fb4f,_0x3d3bc8,!![]);}catch(_0x370567){return BPromise['reject'](_0x370567);}return _0x58fb4f[_0x3454('0x24')]();};}function saveUpdates(_0x3f8bfe,_0x1f6f3e){return function(_0x425dfe){if(_0x425dfe){return _0x425dfe[_0x3454('0x25')](_0x3f8bfe)[_0x3454('0x26')](function(_0x33a35f){return _0x33a35f;});}return null;};}function removeEntity(_0x240256,_0x1b16ab){return function(_0x56bddb){if(_0x56bddb){return _0x56bddb[_0x3454('0x27')]()['then'](function(){_0x240256['status'](0xcc)[_0x3454('0x28')]();});}};}function handleEntityNotFound(_0x18be40,_0x3e639b){return function(_0x5647ea){if(!_0x5647ea){_0x18be40[_0x3454('0x29')](0x194);}return _0x5647ea;};}function handleError(_0x203b30,_0x3e69e8){_0x3e69e8=_0x3e69e8||0x1f4;return function(_0x285d13){logger['error'](_0x285d13['stack']);if(_0x285d13[_0x3454('0x2a')]){delete _0x285d13[_0x3454('0x2a')];}_0x203b30[_0x3454('0x1b')](_0x3e69e8)[_0x3454('0x2b')](_0x285d13);};}exports['index']=function(_0x31af74,_0x261a32){var _0x4e23c7={},_0x819e33={},_0x372575={'count':0x0,'rows':[]};var _0x21a942=_[_0x3454('0x2c')](db[_0x3454('0x2d')][_0x3454('0x2e')],function(_0x3a0e97){return{'name':_0x3a0e97[_0x3454('0x2f')],'type':_0x3a0e97[_0x3454('0x30')][_0x3454('0x31')]};});_0x819e33[_0x3454('0x32')]=_['map'](_0x21a942,_0x3454('0x2a'));_0x819e33[_0x3454('0x33')]=_['keys'](_0x31af74['query']);_0x819e33['filters']=_[_0x3454('0x34')](_0x819e33[_0x3454('0x32')],_0x819e33[_0x3454('0x33')]);_0x4e23c7['attributes']=_['intersection'](_0x819e33[_0x3454('0x32')],qs['fields'](_0x31af74['query']['fields']));_0x4e23c7[_0x3454('0x35')]=_0x4e23c7[_0x3454('0x35')][_0x3454('0x36')]?_0x4e23c7[_0x3454('0x35')]:_0x819e33[_0x3454('0x32')];if(!_0x31af74[_0x3454('0x33')][_0x3454('0x37')]('nolimit')){_0x4e23c7['limit']=qs[_0x3454('0x1e')](_0x31af74[_0x3454('0x33')]['limit']);_0x4e23c7['offset']=qs[_0x3454('0x1c')](_0x31af74[_0x3454('0x33')]['offset']);}_0x4e23c7[_0x3454('0x38')]=qs[_0x3454('0x39')](_0x31af74[_0x3454('0x33')][_0x3454('0x39')]);_0x4e23c7[_0x3454('0x3a')]=qs[_0x3454('0x3b')](_['pick'](_0x31af74['query'],_0x819e33[_0x3454('0x3b')]),_0x21a942);if(_0x31af74['query'][_0x3454('0x3c')]){_0x4e23c7['where']=_[_0x3454('0x3d')](_0x4e23c7[_0x3454('0x3a')],{'$or':_[_0x3454('0x2c')](_0x21a942,function(_0x4dac09){if(_0x4dac09[_0x3454('0x30')]!==_0x3454('0x3e')){var _0x12f4b4={};_0x12f4b4[_0x4dac09[_0x3454('0x2a')]]={'$like':'%'+_0x31af74['query'][_0x3454('0x3c')]+'%'};return _0x12f4b4;}})});}_0x4e23c7=_[_0x3454('0x3d')]({},_0x4e23c7,_0x31af74[_0x3454('0x3f')]);var _0xc44706={'where':_0x4e23c7['where']};return db['Dynamics365Configuration'][_0x3454('0x1f')](_0xc44706)[_0x3454('0x26')](function(_0x504bf1){_0x372575[_0x3454('0x1f')]=_0x504bf1;if(_0x31af74[_0x3454('0x33')][_0x3454('0x40')]){_0x4e23c7[_0x3454('0x41')]=[{'all':!![]}];}return db[_0x3454('0x2d')][_0x3454('0x42')](_0x4e23c7);})[_0x3454('0x26')](function(_0x5c006b){_0x372575[_0x3454('0x43')]=_0x5c006b;return _0x372575;})['then'](respondWithFilteredResult(_0x261a32,_0x4e23c7))['catch'](handleError(_0x261a32,null));};exports[_0x3454('0x44')]=function(_0xbde788,_0x4e91ec){var _0x20d67f={'raw':![],'where':{'id':_0xbde788[_0x3454('0x45')]['id']}},_0x18c726={};_0x18c726[_0x3454('0x32')]=_[_0x3454('0x46')](db['Dynamics365Configuration'][_0x3454('0x2e')]);_0x18c726['query']=_[_0x3454('0x46')](_0xbde788[_0x3454('0x33')]);_0x18c726['filters']=_[_0x3454('0x34')](_0x18c726[_0x3454('0x32')],_0x18c726[_0x3454('0x33')]);_0x20d67f[_0x3454('0x35')]=_[_0x3454('0x34')](_0x18c726[_0x3454('0x32')],qs[_0x3454('0x47')](_0xbde788[_0x3454('0x33')][_0x3454('0x47')]));_0x20d67f[_0x3454('0x35')]=_0x20d67f[_0x3454('0x35')][_0x3454('0x36')]?_0x20d67f[_0x3454('0x35')]:_0x18c726[_0x3454('0x32')];if(_0xbde788['query']['includeAll']){_0x20d67f[_0x3454('0x41')]=[{'all':!![]}];}_0x20d67f=_[_0x3454('0x3d')]({},_0x20d67f,_0xbde788[_0x3454('0x3f')]);return db['Dynamics365Configuration'][_0x3454('0x48')](_0x20d67f)['then'](handleEntityNotFound(_0x4e91ec,null))[_0x3454('0x26')](respondWithResult(_0x4e91ec,null))[_0x3454('0x49')](handleError(_0x4e91ec,null));};exports[_0x3454('0x4a')]=function(_0xec3b77,_0x3deb81){return db['Dynamics365Configuration']['create'](_0xec3b77['body'],{})[_0x3454('0x26')](respondWithResult(_0x3deb81,0xc9))[_0x3454('0x49')](handleError(_0x3deb81,null));};exports[_0x3454('0x25')]=function(_0x4d547c,_0x3d039b){if(_0x4d547c[_0x3454('0x4b')]['id']){delete _0x4d547c['body']['id'];}return db[_0x3454('0x2d')][_0x3454('0x48')]({'where':{'id':_0x4d547c['params']['id']}})[_0x3454('0x26')](handleEntityNotFound(_0x3d039b,null))[_0x3454('0x26')](saveUpdates(_0x4d547c['body'],null))[_0x3454('0x26')](respondWithResult(_0x3d039b,null))[_0x3454('0x49')](handleError(_0x3d039b,null));};exports[_0x3454('0x27')]=function(_0x2215d7,_0x4edc64){return db[_0x3454('0x2d')][_0x3454('0x48')]({'where':{'id':_0x2215d7[_0x3454('0x45')]['id']}})[_0x3454('0x26')](handleEntityNotFound(_0x4edc64,null))['then'](removeEntity(_0x4edc64,null))[_0x3454('0x49')](handleError(_0x4edc64,null));};exports[_0x3454('0x4c')]=function(_0x11c44d,_0x3eaeae,_0x1b0166){var _0x22ea53={};var _0x2de3b5={};var _0x20adb0;var _0x3659ed;return db[_0x3454('0x2d')][_0x3454('0x4d')]({'where':{'id':_0x11c44d[_0x3454('0x45')]['id']}})[_0x3454('0x26')](handleEntityNotFound(_0x3eaeae,null))[_0x3454('0x26')](function(_0x433346){if(_0x433346){_0x20adb0=_0x433346;_0x2de3b5[_0x3454('0x32')]=_[_0x3454('0x46')](db['Dynamics365Field'][_0x3454('0x2e')]);_0x2de3b5['query']=_[_0x3454('0x46')](_0x11c44d[_0x3454('0x33')]);_0x2de3b5[_0x3454('0x3b')]=_[_0x3454('0x34')](_0x2de3b5['model'],_0x2de3b5[_0x3454('0x33')]);_0x22ea53[_0x3454('0x35')]=_['intersection'](_0x2de3b5[_0x3454('0x32')],qs['fields'](_0x11c44d[_0x3454('0x33')][_0x3454('0x47')]));_0x22ea53['attributes']=_0x22ea53[_0x3454('0x35')][_0x3454('0x36')]?_0x22ea53['attributes']:_0x2de3b5[_0x3454('0x32')];_0x22ea53[_0x3454('0x38')]=qs[_0x3454('0x39')](_0x11c44d['query'][_0x3454('0x39')]);_0x22ea53[_0x3454('0x3a')]=qs['filters'](_['pick'](_0x11c44d['query'],_0x2de3b5[_0x3454('0x3b')]));if(_0x11c44d[_0x3454('0x33')]['filter']){_0x22ea53[_0x3454('0x3a')]=_['merge'](_0x22ea53['where'],{'$or':_[_0x3454('0x2c')](_0x22ea53['attributes'],function(_0x24458d){var _0x3a716e={};_0x3a716e[_0x24458d]={'$like':'%'+_0x11c44d[_0x3454('0x33')]['filter']+'%'};return _0x3a716e;})});}_0x22ea53=_[_0x3454('0x3d')]({},_0x22ea53,_0x11c44d[_0x3454('0x3f')]);return _0x20adb0[_0x3454('0x4c')](_0x22ea53);}})[_0x3454('0x26')](function(_0x14e3ad){if(_0x14e3ad){_0x3659ed=_0x14e3ad['length'];if(!_0x11c44d[_0x3454('0x33')]['hasOwnProperty']('nolimit')){_0x22ea53['limit']=qs[_0x3454('0x1e')](_0x11c44d['query'][_0x3454('0x1e')]);_0x22ea53['offset']=qs['offset'](_0x11c44d[_0x3454('0x33')][_0x3454('0x1c')]);}return _0x20adb0[_0x3454('0x4c')](_0x22ea53);}})[_0x3454('0x26')](function(_0x359d79){if(_0x359d79){return _0x359d79?{'count':_0x3659ed,'rows':_0x359d79}:null;}})[_0x3454('0x26')](respondWithResult(_0x3eaeae,null))[_0x3454('0x49')](handleError(_0x3eaeae,null));};exports[_0x3454('0x4e')]=function(_0x1f6867,_0x234fd5,_0x500b75){var _0x5ae7da={};var _0x180e1b={};var _0x3590a9;var _0x41d708;return db[_0x3454('0x2d')]['findOne']({'where':{'id':_0x1f6867[_0x3454('0x45')]['id']}})[_0x3454('0x26')](handleEntityNotFound(_0x234fd5,null))[_0x3454('0x26')](function(_0x5d1ce4){if(_0x5d1ce4){_0x3590a9=_0x5d1ce4;_0x180e1b[_0x3454('0x32')]=_[_0x3454('0x46')](db[_0x3454('0x4f')][_0x3454('0x2e')]);_0x180e1b[_0x3454('0x33')]=_[_0x3454('0x46')](_0x1f6867[_0x3454('0x33')]);_0x180e1b[_0x3454('0x3b')]=_[_0x3454('0x34')](_0x180e1b[_0x3454('0x32')],_0x180e1b[_0x3454('0x33')]);_0x5ae7da[_0x3454('0x35')]=_[_0x3454('0x34')](_0x180e1b['model'],qs[_0x3454('0x47')](_0x1f6867[_0x3454('0x33')][_0x3454('0x47')]));_0x5ae7da[_0x3454('0x35')]=_0x5ae7da['attributes'][_0x3454('0x36')]?_0x5ae7da['attributes']:_0x180e1b[_0x3454('0x32')];_0x5ae7da[_0x3454('0x38')]=qs[_0x3454('0x39')](_0x1f6867[_0x3454('0x33')][_0x3454('0x39')]);_0x5ae7da['where']=qs['filters'](_['pick'](_0x1f6867[_0x3454('0x33')],_0x180e1b[_0x3454('0x3b')]));if(_0x1f6867[_0x3454('0x33')][_0x3454('0x3c')]){_0x5ae7da[_0x3454('0x3a')]=_['merge'](_0x5ae7da['where'],{'$or':_['map'](_0x5ae7da[_0x3454('0x35')],function(_0x51363b){var _0x2f3d5f={};_0x2f3d5f[_0x51363b]={'$like':'%'+_0x1f6867[_0x3454('0x33')][_0x3454('0x3c')]+'%'};return _0x2f3d5f;})});}_0x5ae7da=_[_0x3454('0x3d')]({},_0x5ae7da,_0x1f6867[_0x3454('0x3f')]);return _0x3590a9[_0x3454('0x4e')](_0x5ae7da);}})[_0x3454('0x26')](function(_0x525740){if(_0x525740){_0x41d708=_0x525740[_0x3454('0x36')];if(!_0x1f6867[_0x3454('0x33')]['hasOwnProperty'](_0x3454('0x50'))){_0x5ae7da['limit']=qs[_0x3454('0x1e')](_0x1f6867['query'][_0x3454('0x1e')]);_0x5ae7da[_0x3454('0x1c')]=qs[_0x3454('0x1c')](_0x1f6867[_0x3454('0x33')][_0x3454('0x1c')]);}return _0x3590a9[_0x3454('0x4e')](_0x5ae7da);}})[_0x3454('0x26')](function(_0x164b2b){if(_0x164b2b){return _0x164b2b?{'count':_0x41d708,'rows':_0x164b2b}:null;}})[_0x3454('0x26')](respondWithResult(_0x234fd5,null))[_0x3454('0x49')](handleError(_0x234fd5,null));};exports[_0x3454('0x51')]=function(_0x544341,_0x1d0fd3,_0x273470){var _0x928e7f={};var _0x551b96={};var _0x34f75b;var _0x58b127;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x544341['params']['id']}})[_0x3454('0x26')](handleEntityNotFound(_0x1d0fd3,null))[_0x3454('0x26')](function(_0x2f1fdd){if(_0x2f1fdd){_0x34f75b=_0x2f1fdd;_0x551b96[_0x3454('0x32')]=_[_0x3454('0x46')](db['Dynamics365Field'][_0x3454('0x2e')]);_0x551b96[_0x3454('0x33')]=_[_0x3454('0x46')](_0x544341['query']);_0x551b96[_0x3454('0x3b')]=_['intersection'](_0x551b96[_0x3454('0x32')],_0x551b96[_0x3454('0x33')]);_0x928e7f[_0x3454('0x35')]=_['intersection'](_0x551b96[_0x3454('0x32')],qs[_0x3454('0x47')](_0x544341[_0x3454('0x33')][_0x3454('0x47')]));_0x928e7f[_0x3454('0x35')]=_0x928e7f[_0x3454('0x35')][_0x3454('0x36')]?_0x928e7f[_0x3454('0x35')]:_0x551b96[_0x3454('0x32')];_0x928e7f['order']=qs[_0x3454('0x39')](_0x544341[_0x3454('0x33')][_0x3454('0x39')]);_0x928e7f[_0x3454('0x3a')]=qs[_0x3454('0x3b')](_[_0x3454('0x52')](_0x544341[_0x3454('0x33')],_0x551b96[_0x3454('0x3b')]));if(_0x544341[_0x3454('0x33')][_0x3454('0x3c')]){_0x928e7f[_0x3454('0x3a')]=_[_0x3454('0x3d')](_0x928e7f[_0x3454('0x3a')],{'$or':_[_0x3454('0x2c')](_0x928e7f[_0x3454('0x35')],function(_0x3063de){var _0x40ba43={};_0x40ba43[_0x3063de]={'$like':'%'+_0x544341[_0x3454('0x33')]['filter']+'%'};return _0x40ba43;})});}_0x928e7f=_['merge']({},_0x928e7f,_0x544341[_0x3454('0x3f')]);return _0x34f75b[_0x3454('0x51')](_0x928e7f);}})[_0x3454('0x26')](function(_0x510a70){if(_0x510a70){_0x58b127=_0x510a70[_0x3454('0x36')];if(!_0x544341['query'][_0x3454('0x37')](_0x3454('0x50'))){_0x928e7f[_0x3454('0x1e')]=qs[_0x3454('0x1e')](_0x544341[_0x3454('0x33')][_0x3454('0x1e')]);_0x928e7f[_0x3454('0x1c')]=qs[_0x3454('0x1c')](_0x544341[_0x3454('0x33')][_0x3454('0x1c')]);}return _0x34f75b[_0x3454('0x51')](_0x928e7f);}})[_0x3454('0x26')](function(_0x5d257c){if(_0x5d257c){return _0x5d257c?{'count':_0x58b127,'rows':_0x5d257c}:null;}})['then'](respondWithResult(_0x1d0fd3,null))['catch'](handleError(_0x1d0fd3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 3a3a2b5..71c3504 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x97e5c7,_0x32ff6b){var _0x2cb195=function(_0x4a634f){while(--_0x4a634f){_0x97e5c7['push'](_0x97e5c7['shift']());}};_0x2cb195(++_0x32ff6b);}(_0x9f62,0x154));var _0x29f6=function(_0x102783,_0x813a64){_0x102783=_0x102783-0x0;var _0x51d466=_0x9f62[_0x102783];return _0x51d466;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x3afb9c,_0x4cea42){var _0x52ee94=function(_0x29c1f9){while(--_0x29c1f9){_0x3afb9c['push'](_0x3afb9c['shift']());}};_0x52ee94(++_0x4cea42);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1f1ad4,_0x37e331){_0x1f1ad4=_0x1f1ad4-0x0;var _0x19ce91=_0x9bde[_0x1f1ad4];return _0x19ce91;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'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 84b1ee8..0b6d1f6 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 _0x508b=['catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message'];(function(_0x32a6ae,_0x337b8c){var _0xb55768=function(_0x360a39){while(--_0x360a39){_0x32a6ae['push'](_0x32a6ae['shift']());}};_0xb55768(++_0x337b8c);}(_0x508b,0x13c));var _0xb508=function(_0x218479,_0x4fb190){_0x218479=_0x218479-0x0;var _0x3b67a0=_0x508b[_0x218479];return _0x3b67a0;};'use strict';var _=require(_0xb508('0x0'));var util=require('util');var moment=require(_0xb508('0x1'));var BPromise=require(_0xb508('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb508('0x3'))['db'];var utils=require(_0xb508('0x4'));var logger=require(_0xb508('0x5'))('rpc');var config=require(_0xb508('0x6'));var jayson=require(_0xb508('0x7'));var client=jayson[_0xb508('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5962d9,_0x5a6b69,_0x230b76){return new BPromise(function(_0x5fab3c,_0x284167){return client[_0xb508('0x9')](_0x5962d9,_0x230b76)[_0xb508('0xa')](function(_0x2f6f60){logger[_0xb508('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a6b69,_0xb508('0xc'));logger[_0xb508('0xd')](_0xb508('0xe'),_0x5a6b69,'request\x20sent',JSON[_0xb508('0xf')](_0x2f6f60));if(_0x2f6f60[_0xb508('0x10')]){if(_0x2f6f60[_0xb508('0x10')][_0xb508('0x11')]===0x1f4){logger[_0xb508('0x10')](_0xb508('0x12'),_0x5a6b69,_0x2f6f60[_0xb508('0x10')]['message']);return _0x284167(_0x2f6f60[_0xb508('0x10')][_0xb508('0x13')]);}logger[_0xb508('0x10')](_0xb508('0x12'),_0x5a6b69,_0x2f6f60[_0xb508('0x10')]['message']);return _0x5fab3c(_0x2f6f60[_0xb508('0x10')][_0xb508('0x13')]);}else{logger[_0xb508('0xb')](_0xb508('0x12'),_0x5a6b69,_0xb508('0xc'));_0x5fab3c(_0x2f6f60['result']['message']);}})[_0xb508('0x14')](function(_0x2b81c){logger[_0xb508('0x10')](_0xb508('0x12'),_0x5a6b69,_0x2b81c);_0x284167(_0x2b81c);});});} \ No newline at end of file +var _0x87b9=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x36a848,_0x4ae61b){var _0x422ed7=function(_0x530cb0){while(--_0x530cb0){_0x36a848['push'](_0x36a848['shift']());}};_0x422ed7(++_0x4ae61b);}(_0x87b9,0x17f));var _0x987b=function(_0x20d237,_0x596cf0){_0x20d237=_0x20d237-0x0;var _0x107bc9=_0x87b9[_0x20d237];return _0x107bc9;};'use strict';var _=require(_0x987b('0x0'));var util=require(_0x987b('0x1'));var moment=require(_0x987b('0x2'));var BPromise=require('bluebird');var rs=require(_0x987b('0x3'));var fs=require('fs');var Redis=require(_0x987b('0x4'));var db=require(_0x987b('0x5'))['db'];var utils=require(_0x987b('0x6'));var logger=require(_0x987b('0x7'))('rpc');var config=require(_0x987b('0x8'));var jayson=require(_0x987b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31c395,_0x5e33ae,_0x1a7156){return new BPromise(function(_0x264e1f,_0x42b86b){return client['request'](_0x31c395,_0x1a7156)[_0x987b('0xa')](function(_0x5431ea){logger[_0x987b('0xb')](_0x987b('0xc'),_0x5e33ae,'request\x20sent');logger[_0x987b('0xd')](_0x987b('0xe'),_0x5e33ae,_0x987b('0xf'),JSON[_0x987b('0x10')](_0x5431ea));if(_0x5431ea[_0x987b('0x11')]){if(_0x5431ea[_0x987b('0x11')][_0x987b('0x12')]===0x1f4){logger['error'](_0x987b('0xc'),_0x5e33ae,_0x5431ea['error'][_0x987b('0x13')]);return _0x42b86b(_0x5431ea[_0x987b('0x11')][_0x987b('0x13')]);}logger['error'](_0x987b('0xc'),_0x5e33ae,_0x5431ea[_0x987b('0x11')][_0x987b('0x13')]);return _0x264e1f(_0x5431ea[_0x987b('0x11')]['message']);}else{logger[_0x987b('0xb')](_0x987b('0xc'),_0x5e33ae,_0x987b('0xf'));_0x264e1f(_0x5431ea[_0x987b('0x14')][_0x987b('0x13')]);}})[_0x987b('0x15')](function(_0x28c04e){logger[_0x987b('0x11')](_0x987b('0xc'),_0x5e33ae,_0x28c04e);_0x42b86b(_0x28c04e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 959463f..ec85fcf 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 _0xc2fa=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer'];(function(_0xd202f5,_0x4a372a){var _0x55df8b=function(_0x313463){while(--_0x313463){_0xd202f5['push'](_0xd202f5['shift']());}};_0x55df8b(++_0x4a372a);}(_0xc2fa,0x143));var _0xac2f=function(_0x481bb5,_0x168c2e){_0x481bb5=_0x481bb5-0x0;var _0x5e0e44=_0xc2fa[_0x481bb5];return _0x5e0e44;};'use strict';var multer=require(_0xac2f('0x0'));var util=require('util');var path=require(_0xac2f('0x1'));var timeout=require(_0xac2f('0x2'));var express=require(_0xac2f('0x3'));var router=express[_0xac2f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xac2f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac2f('0x6'));var controller=require(_0xac2f('0x7'));router[_0xac2f('0x8')]('/',auth['isAuthenticated'](),controller[_0xac2f('0x9')]);router[_0xac2f('0x8')](_0xac2f('0xa'),auth[_0xac2f('0xb')](),controller[_0xac2f('0xc')]);router[_0xac2f('0xd')]('/',auth['isAuthenticated'](),controller[_0xac2f('0xe')]);router['put'](_0xac2f('0xa'),auth[_0xac2f('0xb')](),controller[_0xac2f('0xf')]);router[_0xac2f('0x10')](_0xac2f('0xa'),auth['isAuthenticated'](),controller[_0xac2f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1bce=['/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get'];(function(_0x3018eb,_0x570c63){var _0x23131f=function(_0x33656f){while(--_0x33656f){_0x3018eb['push'](_0x3018eb['shift']());}};_0x23131f(++_0x570c63);}(_0x1bce,0x1a6));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe1bc('0x0'));var timeout=require(_0xe1bc('0x1'));var express=require(_0xe1bc('0x2'));var router=express['Router']();var fs_extra=require(_0xe1bc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe1bc('0x4'));var config=require(_0xe1bc('0x5'));var controller=require(_0xe1bc('0x6'));router['get']('/',auth[_0xe1bc('0x7')](),controller[_0xe1bc('0x8')]);router[_0xe1bc('0x9')](_0xe1bc('0xa'),auth[_0xe1bc('0x7')](),controller[_0xe1bc('0xb')]);router[_0xe1bc('0xc')]('/',auth[_0xe1bc('0x7')](),controller[_0xe1bc('0xd')]);router[_0xe1bc('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe1bc('0xf')]);router[_0xe1bc('0x10')](_0xe1bc('0xa'),auth[_0xe1bc('0x7')](),controller[_0xe1bc('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 770ecea..ba2faa9 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 _0xae78=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x5edc38,_0x1fee22){var _0xe32e5=function(_0x2d6490){while(--_0x2d6490){_0x5edc38['push'](_0x5edc38['shift']());}};_0xe32e5(++_0x1fee22);}(_0xae78,0x19d));var _0x8ae7=function(_0x4cc070,_0x476313){_0x4cc070=_0x4cc070-0x0;var _0x161feb=_0xae78[_0x4cc070];return _0x161feb;};'use strict';var Sequelize=require(_0x8ae7('0x0'));module[_0x8ae7('0x1')]={'type':{'type':Sequelize[_0x8ae7('0x2')](_0x8ae7('0x3'),'variable',_0x8ae7('0x4'),_0x8ae7('0x5'),_0x8ae7('0x6')),'defaultValue':_0x8ae7('0x3')},'content':{'type':Sequelize[_0x8ae7('0x7')]},'key':{'type':Sequelize[_0x8ae7('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x8ae7('0x3'),_0x8ae7('0x8'),_0x8ae7('0x4'))},'keyContent':{'type':Sequelize[_0x8ae7('0x7')]},'idField':{'type':Sequelize[_0x8ae7('0x7')]},'nameField':{'type':Sequelize[_0x8ae7('0x7')]},'customField':{'type':Sequelize[_0x8ae7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ae7('0x7')]}}; \ No newline at end of file +var _0xd738=['variable','customVariable','string','ENUM','STRING','BOOLEAN','sequelize','exports'];(function(_0x16558b,_0x18d637){var _0x80da2c=function(_0x1404f5){while(--_0x1404f5){_0x16558b['push'](_0x16558b['shift']());}};_0x80da2c(++_0x18d637);}(_0xd738,0x13e));var _0x8d73=function(_0x15c562,_0xc3ae4){_0x15c562=_0x15c562-0x0;var _0x34c712=_0xd738[_0x15c562];return _0x34c712;};'use strict';var Sequelize=require(_0x8d73('0x0'));module[_0x8d73('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8d73('0x2'),_0x8d73('0x3'),'keyValue','picklist'),'defaultValue':_0x8d73('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8d73('0x5')](_0x8d73('0x4'),_0x8d73('0x2'),_0x8d73('0x3'))},'keyContent':{'type':Sequelize[_0x8d73('0x6')]},'idField':{'type':Sequelize[_0x8d73('0x6')]},'nameField':{'type':Sequelize[_0x8d73('0x6')]},'customField':{'type':Sequelize[_0x8d73('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ec15323..e16a782 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 _0x8604=['apply','reject','then','error','stack','name','index','map','Dynamics365Field','rawAttributes','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','keys','intersection','find','create','update','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x8604,0x1a8));var _0x4860=function(_0x4e86c2,_0xf1a379){_0x4e86c2=_0x4e86c2-0x0;var _0x1bea6c=_0x8604[_0x4e86c2];return _0x1bea6c;};'use strict';var emlformat=require(_0x4860('0x0'));var rimraf=require(_0x4860('0x1'));var zipdir=require(_0x4860('0x2'));var jsonpatch=require(_0x4860('0x3'));var rp=require(_0x4860('0x4'));var moment=require(_0x4860('0x5'));var BPromise=require(_0x4860('0x6'));var Mustache=require(_0x4860('0x7'));var util=require(_0x4860('0x8'));var path=require(_0x4860('0x9'));var sox=require(_0x4860('0xa'));var csv=require(_0x4860('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4860('0xc'));var _=require(_0x4860('0xd'));var squel=require(_0x4860('0xe'));var crypto=require(_0x4860('0xf'));var jsforce=require(_0x4860('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4860('0xb'));var querystring=require(_0x4860('0x11'));var Papa=require(_0x4860('0x12'));var Redis=require(_0x4860('0x13'));var authService=require(_0x4860('0x14'));var qs=require(_0x4860('0x15'));var as=require(_0x4860('0x16'));var hardwareService=require(_0x4860('0x17'));var logger=require(_0x4860('0x18'))(_0x4860('0x19'));var utils=require('../../config/utils');var config=require(_0x4860('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4860('0x1b'))['db'];function respondWithStatusCode(_0x2d365f,_0x8eeaf){_0x8eeaf=_0x8eeaf||0xcc;return function(_0x599fb3){if(_0x599fb3){return _0x2d365f[_0x4860('0x1c')](_0x8eeaf);}return _0x2d365f[_0x4860('0x1d')](_0x8eeaf)[_0x4860('0x1e')]();};}function respondWithResult(_0x205cb5,_0x3d0a1a){_0x3d0a1a=_0x3d0a1a||0xc8;return function(_0x5da0ea){if(_0x5da0ea){return _0x205cb5[_0x4860('0x1d')](_0x3d0a1a)['json'](_0x5da0ea);}};}function respondWithFilteredResult(_0x51e90d,_0x4c0214){return function(_0x2dc3f1){if(_0x2dc3f1){var _0x454345=typeof _0x4c0214['offset']===_0x4860('0x1f')&&typeof _0x4c0214[_0x4860('0x20')]===_0x4860('0x1f');var _0x80c52f=_0x2dc3f1[_0x4860('0x21')];var _0x169369=_0x454345?0x0:_0x4c0214[_0x4860('0x22')];var _0x2a7950=_0x454345?_0x2dc3f1[_0x4860('0x21')]:_0x4c0214[_0x4860('0x22')]+_0x4c0214[_0x4860('0x20')];var _0x1b7420;if(_0x2a7950>=_0x80c52f){_0x2a7950=_0x80c52f;_0x1b7420=0xc8;}else{_0x1b7420=0xce;}_0x51e90d[_0x4860('0x1d')](_0x1b7420);return _0x51e90d[_0x4860('0x23')](_0x4860('0x24'),_0x169369+'-'+_0x2a7950+'/'+_0x80c52f)[_0x4860('0x25')](_0x2dc3f1);}return null;};}function patchUpdates(_0x512423){return function(_0x120ed4){try{jsonpatch[_0x4860('0x26')](_0x120ed4,_0x512423,!![]);}catch(_0xb62c2b){return BPromise[_0x4860('0x27')](_0xb62c2b);}return _0x120ed4['save']();};}function saveUpdates(_0x32cb85,_0x1465e4){return function(_0x42d9c8){if(_0x42d9c8){return _0x42d9c8['update'](_0x32cb85)[_0x4860('0x28')](function(_0x1236d5){return _0x1236d5;});}return null;};}function removeEntity(_0xee53d9,_0x2efc55){return function(_0x473512){if(_0x473512){return _0x473512['destroy']()[_0x4860('0x28')](function(){_0xee53d9[_0x4860('0x1d')](0xcc)[_0x4860('0x1e')]();});}};}function handleEntityNotFound(_0x54f084,_0x445be8){return function(_0x147ae4){if(!_0x147ae4){_0x54f084[_0x4860('0x1c')](0x194);}return _0x147ae4;};}function handleError(_0x43ca95,_0x4ae93a){_0x4ae93a=_0x4ae93a||0x1f4;return function(_0x346cdf){logger[_0x4860('0x29')](_0x346cdf[_0x4860('0x2a')]);if(_0x346cdf[_0x4860('0x2b')]){delete _0x346cdf['name'];}_0x43ca95[_0x4860('0x1d')](_0x4ae93a)['send'](_0x346cdf);};}exports[_0x4860('0x2c')]=function(_0x40b995,_0x11ecd4){var _0x6d08e8={},_0x3106ce={},_0x321eb1={'count':0x0,'rows':[]};var _0x1ce86d=_[_0x4860('0x2d')](db[_0x4860('0x2e')][_0x4860('0x2f')],function(_0x26f683){return{'name':_0x26f683['fieldName'],'type':_0x26f683[_0x4860('0x30')][_0x4860('0x31')]};});_0x3106ce[_0x4860('0x32')]=_[_0x4860('0x2d')](_0x1ce86d,_0x4860('0x2b'));_0x3106ce[_0x4860('0x33')]=_['keys'](_0x40b995[_0x4860('0x33')]);_0x3106ce[_0x4860('0x34')]=_['intersection'](_0x3106ce[_0x4860('0x32')],_0x3106ce[_0x4860('0x33')]);_0x6d08e8['attributes']=_['intersection'](_0x3106ce[_0x4860('0x32')],qs[_0x4860('0x35')](_0x40b995['query'][_0x4860('0x35')]));_0x6d08e8[_0x4860('0x36')]=_0x6d08e8['attributes'][_0x4860('0x37')]?_0x6d08e8['attributes']:_0x3106ce[_0x4860('0x32')];if(!_0x40b995['query'][_0x4860('0x38')](_0x4860('0x39'))){_0x6d08e8[_0x4860('0x20')]=qs[_0x4860('0x20')](_0x40b995['query'][_0x4860('0x20')]);_0x6d08e8[_0x4860('0x22')]=qs[_0x4860('0x22')](_0x40b995[_0x4860('0x33')][_0x4860('0x22')]);}_0x6d08e8[_0x4860('0x3a')]=qs[_0x4860('0x3b')](_0x40b995['query'][_0x4860('0x3b')]);_0x6d08e8[_0x4860('0x3c')]=qs[_0x4860('0x34')](_[_0x4860('0x3d')](_0x40b995['query'],_0x3106ce[_0x4860('0x34')]),_0x1ce86d);if(_0x40b995[_0x4860('0x33')]['filter']){_0x6d08e8[_0x4860('0x3c')]=_[_0x4860('0x3e')](_0x6d08e8[_0x4860('0x3c')],{'$or':_[_0x4860('0x2d')](_0x1ce86d,function(_0x58cd83){if(_0x58cd83[_0x4860('0x30')]!=='VIRTUAL'){var _0x15c813={};_0x15c813[_0x58cd83['name']]={'$like':'%'+_0x40b995[_0x4860('0x33')]['filter']+'%'};return _0x15c813;}})});}_0x6d08e8=_[_0x4860('0x3e')]({},_0x6d08e8,_0x40b995[_0x4860('0x3f')]);var _0x5b0254={'where':_0x6d08e8['where']};return db[_0x4860('0x2e')][_0x4860('0x21')](_0x5b0254)[_0x4860('0x28')](function(_0x3897b0){_0x321eb1[_0x4860('0x21')]=_0x3897b0;if(_0x40b995[_0x4860('0x33')][_0x4860('0x40')]){_0x6d08e8[_0x4860('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x4860('0x42')](_0x6d08e8);})[_0x4860('0x28')](function(_0x579bf3){_0x321eb1['rows']=_0x579bf3;return _0x321eb1;})[_0x4860('0x28')](respondWithFilteredResult(_0x11ecd4,_0x6d08e8))[_0x4860('0x43')](handleError(_0x11ecd4,null));};exports[_0x4860('0x44')]=function(_0x1d64c4,_0x2cc863){var _0x4f7bd0={'raw':!![],'where':{'id':_0x1d64c4['params']['id']}},_0x1a7af4={};_0x1a7af4[_0x4860('0x32')]=_[_0x4860('0x45')](db[_0x4860('0x2e')][_0x4860('0x2f')]);_0x1a7af4[_0x4860('0x33')]=_[_0x4860('0x45')](_0x1d64c4[_0x4860('0x33')]);_0x1a7af4[_0x4860('0x34')]=_['intersection'](_0x1a7af4[_0x4860('0x32')],_0x1a7af4[_0x4860('0x33')]);_0x4f7bd0[_0x4860('0x36')]=_[_0x4860('0x46')](_0x1a7af4[_0x4860('0x32')],qs[_0x4860('0x35')](_0x1d64c4[_0x4860('0x33')]['fields']));_0x4f7bd0[_0x4860('0x36')]=_0x4f7bd0[_0x4860('0x36')][_0x4860('0x37')]?_0x4f7bd0[_0x4860('0x36')]:_0x1a7af4[_0x4860('0x32')];if(_0x1d64c4['query'][_0x4860('0x40')]){_0x4f7bd0[_0x4860('0x41')]=[{'all':!![]}];}_0x4f7bd0=_['merge']({},_0x4f7bd0,_0x1d64c4[_0x4860('0x3f')]);return db['Dynamics365Field'][_0x4860('0x47')](_0x4f7bd0)['then'](handleEntityNotFound(_0x2cc863,null))['then'](respondWithResult(_0x2cc863,null))[_0x4860('0x43')](handleError(_0x2cc863,null));};exports[_0x4860('0x48')]=function(_0x15c4f8,_0x4e0b8a){return db[_0x4860('0x2e')][_0x4860('0x48')](_0x15c4f8['body'],{})[_0x4860('0x28')](respondWithResult(_0x4e0b8a,0xc9))[_0x4860('0x43')](handleError(_0x4e0b8a,null));};exports[_0x4860('0x49')]=function(_0x4178c5,_0x3af29d){if(_0x4178c5[_0x4860('0x4a')]['id']){delete _0x4178c5[_0x4860('0x4a')]['id'];}return db[_0x4860('0x2e')][_0x4860('0x47')]({'where':{'id':_0x4178c5[_0x4860('0x4b')]['id']}})[_0x4860('0x28')](handleEntityNotFound(_0x3af29d,null))['then'](saveUpdates(_0x4178c5[_0x4860('0x4a')],null))['then'](respondWithResult(_0x3af29d,null))[_0x4860('0x43')](handleError(_0x3af29d,null));};exports[_0x4860('0x4c')]=function(_0x161ec4,_0x43a498){return db[_0x4860('0x2e')]['find']({'where':{'id':_0x161ec4[_0x4860('0x4b')]['id']}})['then'](handleEntityNotFound(_0x43a498,null))['then'](removeEntity(_0x43a498,null))[_0x4860('0x43')](handleError(_0x43a498,null));}; \ No newline at end of file +var _0x1a5b=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','intersection','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1a5b,0x1ca));var _0xb1a5=function(_0x258acd,_0x419149){_0x258acd=_0x258acd-0x0;var _0x530789=_0x1a5b[_0x258acd];return _0x530789;};'use strict';var emlformat=require(_0xb1a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1a5('0x1'));var jsonpatch=require(_0xb1a5('0x2'));var rp=require(_0xb1a5('0x3'));var moment=require(_0xb1a5('0x4'));var BPromise=require(_0xb1a5('0x5'));var Mustache=require(_0xb1a5('0x6'));var util=require(_0xb1a5('0x7'));var path=require(_0xb1a5('0x8'));var sox=require(_0xb1a5('0x9'));var csv=require(_0xb1a5('0xa'));var ejs=require(_0xb1a5('0xb'));var fs=require('fs');var fs_extra=require(_0xb1a5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb1a5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb1a5('0xe'));var toCsv=require(_0xb1a5('0xa'));var querystring=require(_0xb1a5('0xf'));var Papa=require(_0xb1a5('0x10'));var Redis=require('ioredis');var authService=require(_0xb1a5('0x11'));var qs=require(_0xb1a5('0x12'));var as=require(_0xb1a5('0x13'));var hardwareService=require(_0xb1a5('0x14'));var logger=require('../../config/logger')(_0xb1a5('0x15'));var utils=require(_0xb1a5('0x16'));var config=require(_0xb1a5('0x17'));var licenseUtil=require(_0xb1a5('0x18'));var db=require(_0xb1a5('0x19'))['db'];function respondWithStatusCode(_0x434e2a,_0x50cd0a){_0x50cd0a=_0x50cd0a||0xcc;return function(_0x44afd4){if(_0x44afd4){return _0x434e2a[_0xb1a5('0x1a')](_0x50cd0a);}return _0x434e2a[_0xb1a5('0x1b')](_0x50cd0a)['end']();};}function respondWithResult(_0x249637,_0x3caf60){_0x3caf60=_0x3caf60||0xc8;return function(_0x4713b5){if(_0x4713b5){return _0x249637[_0xb1a5('0x1b')](_0x3caf60)[_0xb1a5('0x1c')](_0x4713b5);}};}function respondWithFilteredResult(_0x3784b7,_0x20d7d0){return function(_0x175ec1){if(_0x175ec1){var _0x40adf3=typeof _0x20d7d0[_0xb1a5('0x1d')]===_0xb1a5('0x1e')&&typeof _0x20d7d0['limit']==='undefined';var _0x12380a=_0x175ec1[_0xb1a5('0x1f')];var _0x57f33c=_0x40adf3?0x0:_0x20d7d0[_0xb1a5('0x1d')];var _0x540039=_0x40adf3?_0x175ec1['count']:_0x20d7d0[_0xb1a5('0x1d')]+_0x20d7d0[_0xb1a5('0x20')];var _0x5cfc8c;if(_0x540039>=_0x12380a){_0x540039=_0x12380a;_0x5cfc8c=0xc8;}else{_0x5cfc8c=0xce;}_0x3784b7['status'](_0x5cfc8c);return _0x3784b7[_0xb1a5('0x21')](_0xb1a5('0x22'),_0x57f33c+'-'+_0x540039+'/'+_0x12380a)[_0xb1a5('0x1c')](_0x175ec1);}return null;};}function patchUpdates(_0x4a069d){return function(_0x1a8b3b){try{jsonpatch[_0xb1a5('0x23')](_0x1a8b3b,_0x4a069d,!![]);}catch(_0x5aea3a){return BPromise['reject'](_0x5aea3a);}return _0x1a8b3b[_0xb1a5('0x24')]();};}function saveUpdates(_0x13eb47,_0x18de33){return function(_0x207076){if(_0x207076){return _0x207076[_0xb1a5('0x25')](_0x13eb47)[_0xb1a5('0x26')](function(_0x5af85d){return _0x5af85d;});}return null;};}function removeEntity(_0x23398d,_0x38f216){return function(_0x10d229){if(_0x10d229){return _0x10d229['destroy']()['then'](function(){_0x23398d[_0xb1a5('0x1b')](0xcc)[_0xb1a5('0x27')]();});}};}function handleEntityNotFound(_0x3a97c1,_0x47db8d){return function(_0x2f1042){if(!_0x2f1042){_0x3a97c1[_0xb1a5('0x1a')](0x194);}return _0x2f1042;};}function handleError(_0x32dc1d,_0x25f6f3){_0x25f6f3=_0x25f6f3||0x1f4;return function(_0x2c6248){logger['error'](_0x2c6248[_0xb1a5('0x28')]);if(_0x2c6248[_0xb1a5('0x29')]){delete _0x2c6248[_0xb1a5('0x29')];}_0x32dc1d['status'](_0x25f6f3)[_0xb1a5('0x2a')](_0x2c6248);};}exports[_0xb1a5('0x2b')]=function(_0x5dbeb0,_0x35c87b){var _0x101f9a={},_0x5d9850={},_0x37959e={'count':0x0,'rows':[]};var _0x28237f=_[_0xb1a5('0x2c')](db[_0xb1a5('0x2d')][_0xb1a5('0x2e')],function(_0x453605){return{'name':_0x453605[_0xb1a5('0x2f')],'type':_0x453605[_0xb1a5('0x30')][_0xb1a5('0x31')]};});_0x5d9850[_0xb1a5('0x32')]=_[_0xb1a5('0x2c')](_0x28237f,'name');_0x5d9850['query']=_[_0xb1a5('0x33')](_0x5dbeb0[_0xb1a5('0x34')]);_0x5d9850['filters']=_['intersection'](_0x5d9850[_0xb1a5('0x32')],_0x5d9850[_0xb1a5('0x34')]);_0x101f9a['attributes']=_['intersection'](_0x5d9850[_0xb1a5('0x32')],qs['fields'](_0x5dbeb0[_0xb1a5('0x34')][_0xb1a5('0x35')]));_0x101f9a[_0xb1a5('0x36')]=_0x101f9a[_0xb1a5('0x36')][_0xb1a5('0x37')]?_0x101f9a[_0xb1a5('0x36')]:_0x5d9850['model'];if(!_0x5dbeb0['query'][_0xb1a5('0x38')](_0xb1a5('0x39'))){_0x101f9a['limit']=qs[_0xb1a5('0x20')](_0x5dbeb0[_0xb1a5('0x34')][_0xb1a5('0x20')]);_0x101f9a[_0xb1a5('0x1d')]=qs[_0xb1a5('0x1d')](_0x5dbeb0[_0xb1a5('0x34')]['offset']);}_0x101f9a[_0xb1a5('0x3a')]=qs[_0xb1a5('0x3b')](_0x5dbeb0['query'][_0xb1a5('0x3b')]);_0x101f9a['where']=qs[_0xb1a5('0x3c')](_[_0xb1a5('0x3d')](_0x5dbeb0[_0xb1a5('0x34')],_0x5d9850[_0xb1a5('0x3c')]),_0x28237f);if(_0x5dbeb0[_0xb1a5('0x34')][_0xb1a5('0x3e')]){_0x101f9a['where']=_['merge'](_0x101f9a[_0xb1a5('0x3f')],{'$or':_[_0xb1a5('0x2c')](_0x28237f,function(_0x42433d){if(_0x42433d[_0xb1a5('0x30')]!==_0xb1a5('0x40')){var _0x11296e={};_0x11296e[_0x42433d['name']]={'$like':'%'+_0x5dbeb0[_0xb1a5('0x34')][_0xb1a5('0x3e')]+'%'};return _0x11296e;}})});}_0x101f9a=_[_0xb1a5('0x41')]({},_0x101f9a,_0x5dbeb0[_0xb1a5('0x42')]);var _0x431ddf={'where':_0x101f9a['where']};return db[_0xb1a5('0x2d')]['count'](_0x431ddf)['then'](function(_0x5d6b41){_0x37959e[_0xb1a5('0x1f')]=_0x5d6b41;if(_0x5dbeb0[_0xb1a5('0x34')][_0xb1a5('0x43')]){_0x101f9a[_0xb1a5('0x44')]=[{'all':!![]}];}return db[_0xb1a5('0x2d')]['findAll'](_0x101f9a);})['then'](function(_0x1f11f7){_0x37959e[_0xb1a5('0x45')]=_0x1f11f7;return _0x37959e;})[_0xb1a5('0x26')](respondWithFilteredResult(_0x35c87b,_0x101f9a))[_0xb1a5('0x46')](handleError(_0x35c87b,null));};exports['show']=function(_0x55dcf5,_0x3a3d6f){var _0x20011a={'raw':!![],'where':{'id':_0x55dcf5['params']['id']}},_0x413f74={};_0x413f74['model']=_['keys'](db['Dynamics365Field'][_0xb1a5('0x2e')]);_0x413f74[_0xb1a5('0x34')]=_['keys'](_0x55dcf5[_0xb1a5('0x34')]);_0x413f74[_0xb1a5('0x3c')]=_[_0xb1a5('0x47')](_0x413f74[_0xb1a5('0x32')],_0x413f74[_0xb1a5('0x34')]);_0x20011a[_0xb1a5('0x36')]=_['intersection'](_0x413f74[_0xb1a5('0x32')],qs[_0xb1a5('0x35')](_0x55dcf5[_0xb1a5('0x34')][_0xb1a5('0x35')]));_0x20011a[_0xb1a5('0x36')]=_0x20011a['attributes'][_0xb1a5('0x37')]?_0x20011a[_0xb1a5('0x36')]:_0x413f74[_0xb1a5('0x32')];if(_0x55dcf5['query'][_0xb1a5('0x43')]){_0x20011a[_0xb1a5('0x44')]=[{'all':!![]}];}_0x20011a=_[_0xb1a5('0x41')]({},_0x20011a,_0x55dcf5[_0xb1a5('0x42')]);return db[_0xb1a5('0x2d')][_0xb1a5('0x48')](_0x20011a)['then'](handleEntityNotFound(_0x3a3d6f,null))[_0xb1a5('0x26')](respondWithResult(_0x3a3d6f,null))[_0xb1a5('0x46')](handleError(_0x3a3d6f,null));};exports[_0xb1a5('0x49')]=function(_0x32d33e,_0xe73c3b){return db[_0xb1a5('0x2d')][_0xb1a5('0x49')](_0x32d33e[_0xb1a5('0x4a')],{})[_0xb1a5('0x26')](respondWithResult(_0xe73c3b,0xc9))[_0xb1a5('0x46')](handleError(_0xe73c3b,null));};exports['update']=function(_0x12dee8,_0x3b1cf4){if(_0x12dee8[_0xb1a5('0x4a')]['id']){delete _0x12dee8['body']['id'];}return db[_0xb1a5('0x2d')][_0xb1a5('0x48')]({'where':{'id':_0x12dee8[_0xb1a5('0x4b')]['id']}})[_0xb1a5('0x26')](handleEntityNotFound(_0x3b1cf4,null))['then'](saveUpdates(_0x12dee8[_0xb1a5('0x4a')],null))[_0xb1a5('0x26')](respondWithResult(_0x3b1cf4,null))[_0xb1a5('0x46')](handleError(_0x3b1cf4,null));};exports[_0xb1a5('0x4c')]=function(_0x584280,_0x4f798d){return db['Dynamics365Field'][_0xb1a5('0x48')]({'where':{'id':_0x584280['params']['id']}})[_0xb1a5('0x26')](handleEntityNotFound(_0x4f798d,null))[_0xb1a5('0x26')](removeEntity(_0x4f798d,null))[_0xb1a5('0x46')](handleError(_0x4f798d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 798cd29..eb55ef3 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 _0x60dd=['Dynamics365Field','int_dynamics365_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x60dd,0x15c));var _0xd60d=function(_0x128520,_0x2e65ee){_0x128520=_0x128520-0x0;var _0x191542=_0x60dd[_0x128520];return _0x191542;};'use strict';var _=require(_0xd60d('0x0'));var util=require(_0xd60d('0x1'));var logger=require(_0xd60d('0x2'))(_0xd60d('0x3'));var moment=require(_0xd60d('0x4'));var BPromise=require(_0xd60d('0x5'));var rp=require(_0xd60d('0x6'));var fs=require('fs');var path=require(_0xd60d('0x7'));var rimraf=require(_0xd60d('0x8'));var config=require('../../config/environment');var attributes=require(_0xd60d('0x9'));module[_0xd60d('0xa')]=function(_0x199f1d,_0x4646f1){return _0x199f1d[_0xd60d('0xb')](_0xd60d('0xc'),attributes,{'tableName':_0xd60d('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xd60d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc874=['lodash','util','../../config/logger','api','moment','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x227edb,_0x40ef5e){var _0x28710b=function(_0x402b8f){while(--_0x402b8f){_0x227edb['push'](_0x227edb['shift']());}};_0x28710b(++_0x40ef5e);}(_0xc874,0xb6));var _0x4c87=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc874[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x4c87('0x0'));var util=require(_0x4c87('0x1'));var logger=require(_0x4c87('0x2'))(_0x4c87('0x3'));var moment=require(_0x4c87('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c87('0x5'));var rimraf=require(_0x4c87('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c87('0x7'));module[_0x4c87('0x8')]=function(_0x3e6c91,_0x4886f8){return _0x3e6c91['define'](_0x4c87('0x9'),attributes,{'tableName':_0x4c87('0xa'),'paranoid':![],'indexes':[{'name':_0x4c87('0xb'),'fields':[_0x4c87('0xc'),_0x4c87('0xd')],'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 dd1450a..f8016d4 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 _0x4c2e=['jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x460e05,_0x37f195){var _0x48dcd9=function(_0x29712d){while(--_0x29712d){_0x460e05['push'](_0x460e05['shift']());}};_0x48dcd9(++_0x37f195);}(_0x4c2e,0x1ed));var _0xe4c2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4c2e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe4c2('0x0'));var util=require(_0xe4c2('0x1'));var moment=require(_0xe4c2('0x2'));var BPromise=require(_0xe4c2('0x3'));var rs=require(_0xe4c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe4c2('0x5'))('rpc');var config=require(_0xe4c2('0x6'));var jayson=require(_0xe4c2('0x7'));var client=jayson[_0xe4c2('0x8')][_0xe4c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16d3a1,_0x5cbedd,_0x4fd68e){return new BPromise(function(_0x2c1fe7,_0x14f43e){return client[_0xe4c2('0xa')](_0x16d3a1,_0x4fd68e)[_0xe4c2('0xb')](function(_0x24d681){logger['info'](_0xe4c2('0xc'),_0x5cbedd,'request\x20sent');logger[_0xe4c2('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5cbedd,_0xe4c2('0xe'),JSON['stringify'](_0x24d681));if(_0x24d681[_0xe4c2('0xf')]){if(_0x24d681['error'][_0xe4c2('0x10')]===0x1f4){logger['error'](_0xe4c2('0xc'),_0x5cbedd,_0x24d681['error']['message']);return _0x14f43e(_0x24d681[_0xe4c2('0xf')][_0xe4c2('0x11')]);}logger[_0xe4c2('0xf')](_0xe4c2('0xc'),_0x5cbedd,_0x24d681[_0xe4c2('0xf')][_0xe4c2('0x11')]);return _0x2c1fe7(_0x24d681['error'][_0xe4c2('0x11')]);}else{logger['info'](_0xe4c2('0xc'),_0x5cbedd,_0xe4c2('0xe'));_0x2c1fe7(_0x24d681[_0xe4c2('0x12')][_0xe4c2('0x11')]);}})[_0xe4c2('0x13')](function(_0x355e4a){logger[_0xe4c2('0xf')](_0xe4c2('0xc'),_0x5cbedd,_0x355e4a);_0x14f43e(_0x355e4a);});});} \ No newline at end of file +var _0xdd41=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd41,0xc4));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var moment=require('moment');var BPromise=require(_0x1dd4('0x2'));var rs=require(_0x1dd4('0x3'));var fs=require('fs');var Redis=require(_0x1dd4('0x4'));var db=require(_0x1dd4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dd4('0x6'))(_0x1dd4('0x7'));var config=require('../../config/environment');var jayson=require(_0x1dd4('0x8'));var client=jayson[_0x1dd4('0x9')][_0x1dd4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x232608,_0x1a962a,_0x42e9e3){return new BPromise(function(_0x3be2f3,_0xa2b001){return client[_0x1dd4('0xb')](_0x232608,_0x42e9e3)['then'](function(_0x55adca){logger[_0x1dd4('0xc')](_0x1dd4('0xd'),_0x1a962a,_0x1dd4('0xe'));logger[_0x1dd4('0xf')](_0x1dd4('0x10'),_0x1a962a,_0x1dd4('0xe'),JSON[_0x1dd4('0x11')](_0x55adca));if(_0x55adca[_0x1dd4('0x12')]){if(_0x55adca[_0x1dd4('0x12')]['code']===0x1f4){logger[_0x1dd4('0x12')](_0x1dd4('0xd'),_0x1a962a,_0x55adca[_0x1dd4('0x12')][_0x1dd4('0x13')]);return _0xa2b001(_0x55adca[_0x1dd4('0x12')][_0x1dd4('0x13')]);}logger[_0x1dd4('0x12')](_0x1dd4('0xd'),_0x1a962a,_0x55adca[_0x1dd4('0x12')][_0x1dd4('0x13')]);return _0x3be2f3(_0x55adca[_0x1dd4('0x12')][_0x1dd4('0x13')]);}else{logger[_0x1dd4('0xc')](_0x1dd4('0xd'),_0x1a962a,'request\x20sent');_0x3be2f3(_0x55adca[_0x1dd4('0x14')][_0x1dd4('0x13')]);}})[_0x1dd4('0x15')](function(_0x2f16d2){logger[_0x1dd4('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x1a962a,_0x2f16d2);_0xa2b001(_0x2f16d2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a2d6cea..6274415 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 _0xb858=['create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x562d26,_0x2cf731){var _0x493266=function(_0x5e38df){while(--_0x5e38df){_0x562d26['push'](_0x562d26['shift']());}};_0x493266(++_0x2cf731);}(_0xb858,0x6c));var _0x8b85=function(_0xf3d5a0,_0x4c3828){_0xf3d5a0=_0xf3d5a0-0x0;var _0x1c3150=_0xb858[_0xf3d5a0];return _0x1c3150;};'use strict';var multer=require(_0x8b85('0x0'));var util=require(_0x8b85('0x1'));var path=require('path');var timeout=require(_0x8b85('0x2'));var express=require('express');var router=express[_0x8b85('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8b85('0x4'));var interaction=require(_0x8b85('0x5'));var config=require(_0x8b85('0x6'));var controller=require(_0x8b85('0x7'));router[_0x8b85('0x8')]('/',auth['isAuthenticated'](),controller[_0x8b85('0x9')]);router['get'](_0x8b85('0xa'),auth['isAuthenticated'](),controller[_0x8b85('0xb')]);router[_0x8b85('0x8')](_0x8b85('0xc'),auth[_0x8b85('0xd')](),controller[_0x8b85('0xe')]);router[_0x8b85('0x8')](_0x8b85('0xf'),auth['isAuthenticated'](),controller[_0x8b85('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8b85('0x11')]);router[_0x8b85('0x12')](_0x8b85('0xc'),auth[_0x8b85('0xd')](),controller[_0x8b85('0x13')]);router[_0x8b85('0x14')](_0x8b85('0xa'),auth[_0x8b85('0xd')](),controller[_0x8b85('0x15')]);router[_0x8b85('0x16')]('/:id',auth[_0x8b85('0xd')](),controller[_0x8b85('0x17')]);module[_0x8b85('0x18')]=router; \ No newline at end of file +var _0x98a5=['/:id/fields','post','addConfiguration','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations'];(function(_0x5c8718,_0xaaeaa6){var _0x8e660c=function(_0x5db21f){while(--_0x5db21f){_0x5c8718['push'](_0x5c8718['shift']());}};_0x8e660c(++_0xaaeaa6);}(_0x98a5,0x1be));var _0x598a=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x98a5[_0x5eef05];return _0x56d4b8;};'use strict';var multer=require('multer');var util=require(_0x598a('0x0'));var path=require(_0x598a('0x1'));var timeout=require(_0x598a('0x2'));var express=require(_0x598a('0x3'));var router=express[_0x598a('0x4')]();var fs_extra=require(_0x598a('0x5'));var auth=require(_0x598a('0x6'));var interaction=require(_0x598a('0x7'));var config=require(_0x598a('0x8'));var controller=require(_0x598a('0x9'));router['get']('/',auth[_0x598a('0xa')](),controller[_0x598a('0xb')]);router[_0x598a('0xc')](_0x598a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x598a('0xc')](_0x598a('0xe'),auth[_0x598a('0xa')](),controller[_0x598a('0xf')]);router['get'](_0x598a('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x598a('0x11')]('/',auth[_0x598a('0xa')](),controller['create']);router['post'](_0x598a('0xe'),auth[_0x598a('0xa')](),controller[_0x598a('0x12')]);router['put'](_0x598a('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x598a('0xd'),auth['isAuthenticated'](),controller[_0x598a('0x13')]);module[_0x598a('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 e473b26..801d4a3 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 _0xb145=['STRING','username','remoteUri','exports'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xb145,0xa3));var _0x5b14=function(_0x5161a6,_0x58e171){_0x5161a6=_0x5161a6-0x0;var _0x490c6d=_0xb145[_0x5161a6];return _0x490c6d;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4325=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4c2b60,_0x38081e){var _0x46cb8e=function(_0x1b2b9c){while(--_0x1b2b9c){_0x4c2b60['push'](_0x4c2b60['shift']());}};_0x46cb8e(++_0x38081e);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5432('0x4')},'serverUrl':{'type':Sequelize[_0x5432('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 3cdf117..37860a7 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 _0x55f1=['addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','%s:X','toString','requester','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','params','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','length','nolimit'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0x55f1,0x9b));var _0x155f=function(_0x2fbc8c,_0x3d8a8f){_0x2fbc8c=_0x2fbc8c-0x0;var _0x2885b6=_0x55f1[_0x2fbc8c];return _0x2885b6;};'use strict';var emlformat=require(_0x155f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x155f('0x1'));var jsonpatch=require(_0x155f('0x2'));var rp=require(_0x155f('0x3'));var moment=require(_0x155f('0x4'));var BPromise=require(_0x155f('0x5'));var Mustache=require(_0x155f('0x6'));var util=require(_0x155f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x155f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x155f('0x9'));var _=require(_0x155f('0xa'));var squel=require(_0x155f('0xb'));var crypto=require(_0x155f('0xc'));var jsforce=require(_0x155f('0xd'));var deskjs=require(_0x155f('0xe'));var toCsv=require(_0x155f('0x8'));var querystring=require(_0x155f('0xf'));var Papa=require(_0x155f('0x10'));var Redis=require(_0x155f('0x11'));var authService=require(_0x155f('0x12'));var qs=require(_0x155f('0x13'));var as=require(_0x155f('0x14'));var hardwareService=require(_0x155f('0x15'));var logger=require(_0x155f('0x16'))(_0x155f('0x17'));var utils=require(_0x155f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x155f('0x19'));var db=require(_0x155f('0x1a'))['db'];var integrations=require(_0x155f('0x1b'));function respondWithStatusCode(_0x56f9e9,_0x517753){_0x517753=_0x517753||0xcc;return function(_0x2aaa3c){if(_0x2aaa3c){return _0x56f9e9[_0x155f('0x1c')](_0x517753);}return _0x56f9e9[_0x155f('0x1d')](_0x517753)[_0x155f('0x1e')]();};}function respondWithResult(_0x177c4e,_0x2fa0d4){_0x2fa0d4=_0x2fa0d4||0xc8;return function(_0x14dad8){if(_0x14dad8){return _0x177c4e['status'](_0x2fa0d4)[_0x155f('0x1f')](_0x14dad8);}};}function respondWithFilteredResult(_0x2ef684,_0x581ee9){return function(_0x44c018){if(_0x44c018){var _0x1c2d06=typeof _0x581ee9[_0x155f('0x20')]===_0x155f('0x21')&&typeof _0x581ee9[_0x155f('0x22')]===_0x155f('0x21');var _0x1cca82=_0x44c018[_0x155f('0x23')];var _0x2f5b83=_0x1c2d06?0x0:_0x581ee9[_0x155f('0x20')];var _0x2e248d=_0x1c2d06?_0x44c018[_0x155f('0x23')]:_0x581ee9[_0x155f('0x20')]+_0x581ee9[_0x155f('0x22')];var _0x1f76e9;if(_0x2e248d>=_0x1cca82){_0x2e248d=_0x1cca82;_0x1f76e9=0xc8;}else{_0x1f76e9=0xce;}_0x2ef684[_0x155f('0x1d')](_0x1f76e9);return _0x2ef684['set'](_0x155f('0x24'),_0x2f5b83+'-'+_0x2e248d+'/'+_0x1cca82)[_0x155f('0x1f')](_0x44c018);}return null;};}function patchUpdates(_0x39c362){return function(_0x5ec409){try{jsonpatch['apply'](_0x5ec409,_0x39c362,!![]);}catch(_0x5786f1){return BPromise['reject'](_0x5786f1);}return _0x5ec409[_0x155f('0x25')]();};}function saveUpdates(_0x3a40b4,_0x2e337e){return function(_0x54366f){if(_0x54366f){return _0x54366f[_0x155f('0x26')](_0x3a40b4)['then'](function(_0x1855cd){return _0x1855cd;});}return null;};}function removeEntity(_0x2047c2,_0x172077){return function(_0x348240){if(_0x348240){return _0x348240[_0x155f('0x27')]()[_0x155f('0x28')](function(){_0x2047c2[_0x155f('0x1d')](0xcc)[_0x155f('0x1e')]();});}};}function handleEntityNotFound(_0x45b580,_0x2bc5b5){return function(_0x143749){if(!_0x143749){_0x45b580[_0x155f('0x1c')](0x194);}return _0x143749;};}function handleError(_0x52af8e,_0x5c0a30){_0x5c0a30=_0x5c0a30||0x1f4;return function(_0x346a14){logger[_0x155f('0x29')](_0x346a14[_0x155f('0x2a')]);if(_0x346a14[_0x155f('0x2b')]){delete _0x346a14['name'];}_0x52af8e[_0x155f('0x1d')](_0x5c0a30)[_0x155f('0x2c')](_0x346a14);};}exports[_0x155f('0x2d')]=function(_0x29e9dd,_0x1f53c8){var _0x3d3e46={},_0x1a89bb={},_0x54cc56={'count':0x0,'rows':[]};var _0x142e32=_[_0x155f('0x2e')](db[_0x155f('0x2f')][_0x155f('0x30')],function(_0x189315){return{'name':_0x189315[_0x155f('0x31')],'type':_0x189315[_0x155f('0x32')][_0x155f('0x33')]};});_0x1a89bb[_0x155f('0x34')]=_['map'](_0x142e32,_0x155f('0x2b'));_0x1a89bb[_0x155f('0x35')]=_[_0x155f('0x36')](_0x29e9dd['query']);_0x1a89bb[_0x155f('0x37')]=_[_0x155f('0x38')](_0x1a89bb['model'],_0x1a89bb[_0x155f('0x35')]);_0x3d3e46['attributes']=_[_0x155f('0x38')](_0x1a89bb[_0x155f('0x34')],qs['fields'](_0x29e9dd['query'][_0x155f('0x39')]));_0x3d3e46[_0x155f('0x3a')]=_0x3d3e46[_0x155f('0x3a')]['length']?_0x3d3e46[_0x155f('0x3a')]:_0x1a89bb[_0x155f('0x34')];if(!_0x29e9dd[_0x155f('0x35')][_0x155f('0x3b')]('nolimit')){_0x3d3e46[_0x155f('0x22')]=qs[_0x155f('0x22')](_0x29e9dd['query'][_0x155f('0x22')]);_0x3d3e46['offset']=qs[_0x155f('0x20')](_0x29e9dd['query'][_0x155f('0x20')]);}_0x3d3e46['order']=qs['sort'](_0x29e9dd[_0x155f('0x35')][_0x155f('0x3c')]);_0x3d3e46[_0x155f('0x3d')]=qs[_0x155f('0x37')](_[_0x155f('0x3e')](_0x29e9dd[_0x155f('0x35')],_0x1a89bb['filters']),_0x142e32);if(_0x29e9dd[_0x155f('0x35')][_0x155f('0x3f')]){_0x3d3e46[_0x155f('0x3d')]=_['merge'](_0x3d3e46[_0x155f('0x3d')],{'$or':_[_0x155f('0x2e')](_0x142e32,function(_0x1be700){if(_0x1be700[_0x155f('0x32')]!==_0x155f('0x40')){var _0x3c02fb={};_0x3c02fb[_0x1be700['name']]={'$like':'%'+_0x29e9dd[_0x155f('0x35')][_0x155f('0x3f')]+'%'};return _0x3c02fb;}})});}_0x3d3e46=_[_0x155f('0x41')]({},_0x3d3e46,_0x29e9dd['options']);var _0xa0d308={'where':_0x3d3e46['where']};return db[_0x155f('0x2f')][_0x155f('0x23')](_0xa0d308)[_0x155f('0x28')](function(_0x1f23ab){_0x54cc56[_0x155f('0x23')]=_0x1f23ab;if(_0x29e9dd['query'][_0x155f('0x42')]){_0x3d3e46['include']=[{'all':!![]}];}return db[_0x155f('0x2f')][_0x155f('0x43')](_0x3d3e46);})[_0x155f('0x28')](function(_0x55eebe){_0x54cc56['rows']=_0x55eebe;return _0x54cc56;})[_0x155f('0x28')](respondWithFilteredResult(_0x1f53c8,_0x3d3e46))[_0x155f('0x44')](handleError(_0x1f53c8,null));};exports['show']=function(_0x4dcbd5,_0x105a85){var _0x51f824={'raw':![],'where':{'id':_0x4dcbd5[_0x155f('0x45')]['id']}},_0x2d0e67={};_0x2d0e67['model']=_[_0x155f('0x36')](db[_0x155f('0x2f')][_0x155f('0x30')]);_0x2d0e67['query']=_[_0x155f('0x36')](_0x4dcbd5['query']);_0x2d0e67['filters']=_[_0x155f('0x38')](_0x2d0e67[_0x155f('0x34')],_0x2d0e67['query']);_0x51f824[_0x155f('0x3a')]=_[_0x155f('0x38')](_0x2d0e67[_0x155f('0x34')],qs[_0x155f('0x39')](_0x4dcbd5[_0x155f('0x35')][_0x155f('0x39')]));_0x51f824[_0x155f('0x3a')]=_0x51f824['attributes']['length']?_0x51f824['attributes']:_0x2d0e67[_0x155f('0x34')];if(_0x4dcbd5['query'][_0x155f('0x42')]){_0x51f824['include']=[{'all':!![]}];}_0x51f824=_['merge']({},_0x51f824,_0x4dcbd5[_0x155f('0x46')]);return db[_0x155f('0x2f')][_0x155f('0x47')](_0x51f824)[_0x155f('0x28')](handleEntityNotFound(_0x105a85,null))[_0x155f('0x28')](respondWithResult(_0x105a85,null))[_0x155f('0x44')](handleError(_0x105a85,null));};exports[_0x155f('0x48')]=function(_0x321e96,_0x3cb4b1){return db[_0x155f('0x2f')][_0x155f('0x48')](_0x321e96[_0x155f('0x49')],{})[_0x155f('0x28')](respondWithResult(_0x3cb4b1,0xc9))[_0x155f('0x44')](handleError(_0x3cb4b1,null));};exports[_0x155f('0x26')]=function(_0x150c16,_0x3cf6d3){if(_0x150c16[_0x155f('0x49')]['id']){delete _0x150c16[_0x155f('0x49')]['id'];}return db[_0x155f('0x2f')]['find']({'where':{'id':_0x150c16[_0x155f('0x45')]['id']}})[_0x155f('0x28')](handleEntityNotFound(_0x3cf6d3,null))[_0x155f('0x28')](saveUpdates(_0x150c16[_0x155f('0x49')],null))['then'](respondWithResult(_0x3cf6d3,null))[_0x155f('0x44')](handleError(_0x3cf6d3,null));};exports[_0x155f('0x27')]=function(_0x9855f4,_0xeeeef7){return db[_0x155f('0x2f')][_0x155f('0x47')]({'where':{'id':_0x9855f4[_0x155f('0x45')]['id']}})[_0x155f('0x28')](handleEntityNotFound(_0xeeeef7,null))[_0x155f('0x28')](removeEntity(_0xeeeef7,null))[_0x155f('0x44')](handleError(_0xeeeef7,null));};exports[_0x155f('0x4a')]=function(_0x42eabb,_0x438a8d,_0x41a6bc){var _0x389be1={};var _0x2a2b05={};var _0x1ff18c;var _0x4ae039;return db[_0x155f('0x2f')][_0x155f('0x4b')]({'where':{'id':_0x42eabb[_0x155f('0x45')]['id']}})[_0x155f('0x28')](handleEntityNotFound(_0x438a8d,null))[_0x155f('0x28')](function(_0x47d85d){if(_0x47d85d){_0x1ff18c=_0x47d85d;_0x2a2b05[_0x155f('0x34')]=_['keys'](db[_0x155f('0x4c')][_0x155f('0x30')]);_0x2a2b05[_0x155f('0x35')]=_[_0x155f('0x36')](_0x42eabb[_0x155f('0x35')]);_0x2a2b05[_0x155f('0x37')]=_['intersection'](_0x2a2b05[_0x155f('0x34')],_0x2a2b05[_0x155f('0x35')]);_0x389be1[_0x155f('0x3a')]=_[_0x155f('0x38')](_0x2a2b05[_0x155f('0x34')],qs[_0x155f('0x39')](_0x42eabb['query'][_0x155f('0x39')]));_0x389be1[_0x155f('0x3a')]=_0x389be1[_0x155f('0x3a')][_0x155f('0x4d')]?_0x389be1[_0x155f('0x3a')]:_0x2a2b05[_0x155f('0x34')];_0x389be1['order']=qs[_0x155f('0x3c')](_0x42eabb[_0x155f('0x35')][_0x155f('0x3c')]);_0x389be1[_0x155f('0x3d')]=qs['filters'](_[_0x155f('0x3e')](_0x42eabb[_0x155f('0x35')],_0x2a2b05[_0x155f('0x37')]));if(_0x42eabb[_0x155f('0x35')][_0x155f('0x3f')]){_0x389be1[_0x155f('0x3d')]=_[_0x155f('0x41')](_0x389be1[_0x155f('0x3d')],{'$or':_[_0x155f('0x2e')](_0x389be1['attributes'],function(_0x38f90a){var _0x2c23b1={};_0x2c23b1[_0x38f90a]={'$like':'%'+_0x42eabb[_0x155f('0x35')][_0x155f('0x3f')]+'%'};return _0x2c23b1;})});}_0x389be1=_[_0x155f('0x41')]({},_0x389be1,_0x42eabb[_0x155f('0x46')]);return _0x1ff18c['getConfigurations'](_0x389be1);}})[_0x155f('0x28')](function(_0x10bcbc){if(_0x10bcbc){_0x4ae039=_0x10bcbc[_0x155f('0x4d')];if(!_0x42eabb[_0x155f('0x35')][_0x155f('0x3b')](_0x155f('0x4e'))){_0x389be1[_0x155f('0x22')]=qs[_0x155f('0x22')](_0x42eabb[_0x155f('0x35')][_0x155f('0x22')]);_0x389be1[_0x155f('0x20')]=qs['offset'](_0x42eabb[_0x155f('0x35')][_0x155f('0x20')]);}return _0x1ff18c['getConfigurations'](_0x389be1);}})[_0x155f('0x28')](function(_0xc4d1a8){if(_0xc4d1a8){return _0xc4d1a8?{'count':_0x4ae039,'rows':_0xc4d1a8}:null;}})['then'](respondWithResult(_0x438a8d,null))['catch'](handleError(_0x438a8d,null));};exports[_0x155f('0x4f')]=function(_0x4182e1,_0x2a3312,_0x46cd52){if(_0x4182e1[_0x155f('0x49')]['id']){delete _0x4182e1['body']['id'];}return db[_0x155f('0x2f')][_0x155f('0x4b')]({'where':{'id':_0x4182e1['params']['id']}})[_0x155f('0x28')](handleEntityNotFound(_0x2a3312,null))[_0x155f('0x28')](function(_0x389cd1){if(_0x389cd1){_0x4182e1['body'][_0x155f('0x50')]=_0x389cd1['id'];_0x4182e1[_0x155f('0x49')]['Subjects']=integrations[_0x155f('0x51')](_0x4182e1[_0x155f('0x49')][_0x155f('0x52')],_0x4182e1[_0x155f('0x49')][_0x155f('0x32')]);_0x4182e1['body'][_0x155f('0x53')]=integrations[_0x155f('0x54')](_0x4182e1[_0x155f('0x49')][_0x155f('0x52')],_0x4182e1['body'][_0x155f('0x32')]);return db[_0x155f('0x4c')]['create'](_0x4182e1[_0x155f('0x49')],{'include':[{'model':db[_0x155f('0x55')],'as':'Subjects'},{'model':db[_0x155f('0x55')],'as':'Descriptions'}]});}return null;})[_0x155f('0x28')](respondWithResult(_0x2a3312,null))[_0x155f('0x44')](handleError(_0x2a3312,null));};exports[_0x155f('0x56')]=function(_0x415626,_0x1d7cfa,_0x289ed4){var _0x5ebb09='';return db[_0x155f('0x2f')][_0x155f('0x4b')]({'where':{'id':_0x415626[_0x155f('0x45')]['id']},'attributes':['id',_0x155f('0x57'),_0x155f('0x58')]})[_0x155f('0x28')](handleEntityNotFound(_0x1d7cfa,null))[_0x155f('0x28')](function(_0x135752){if(_0x135752){_0x5ebb09=_0x135752[_0x155f('0x57')];var _0x217301=_0x5ebb09['slice'](-0x1);if(_0x217301==='/'){_0x5ebb09=_0x5ebb09[_0x155f('0x59')](0x0,_0x5ebb09[_0x155f('0x5a')](_0x217301));}return rp({'method':_0x155f('0x5b'),'uri':util['format'](_0x155f('0x5c'),_0x5ebb09,_0x155f('0x5d')),'headers':{'Authorization':util['format'](_0x155f('0x5e'),new Buffer(util[_0x155f('0x5f')](_0x155f('0x60'),_0x135752['apiKey']))[_0x155f('0x61')]('base64'))},'json':!![]});}})[_0x155f('0x28')](function(_0xfd302f){if(_0xfd302f){var _0x4a0faf=[_0x155f('0x62'),'subject','agent',_0x155f('0x63'),_0x155f('0x1d'),_0x155f('0x64'),_0x155f('0x65'),_0x155f('0x66'),_0x155f('0x67'),_0x155f('0x65'),_0x155f('0x68')];_[_0x155f('0x69')](_0xfd302f,function(_0x3be629){return _0x4a0faf[_0x155f('0x6a')](_0x3be629[_0x155f('0x2b')])||!_0x3be629[_0x155f('0x6b')]&&_0x3be629[_0x155f('0x32')]!==_0x155f('0x6c')&&_0x3be629[_0x155f('0x32')]!==_0x155f('0x6d');});return{'count':_0xfd302f[_0x155f('0x4d')],'rows':_['map'](_0xfd302f,function(_0x1ad198){return{'id':_0x1ad198[_0x155f('0x2b')],'name':_0x1ad198[_0x155f('0x6e')],'custom':!_0x1ad198[_0x155f('0x6b')],'options':_0x1ad198[_0x155f('0x6f')]?_[_0x155f('0x2e')](_0x1ad198['choices'],function(_0x2e85ad){return{'name':_['capitalize'](_0x2e85ad),'value':_0x2e85ad};}):[]};})};}})[_0x155f('0x28')](respondWithResult(_0x1d7cfa,null))[_0x155f('0x44')](function(_0x25d6d4){var _0x4b95aa=_0x415626[_0x155f('0x35')][_0x155f('0x70')]?0x1f4:_0x25d6d4[_0x155f('0x71')]||0x1f4;logger['error'](_0x155f('0x72'),_0x155f('0x56'),_0x4b95aa,JSON[_0x155f('0x73')](_0x25d6d4));delete _0x25d6d4[_0x155f('0x2b')];if(_0x4b95aa===0x191){_0x4b95aa=0x190;}_0x1d7cfa[_0x155f('0x1d')](_0x4b95aa)[_0x155f('0x2c')](_0x415626['query'][_0x155f('0x70')]?{'message':_0x155f('0x74'),'statusCode':_0x25d6d4[_0x155f('0x71')]}:_0x25d6d4);});}; \ No newline at end of file +var _0xb01a=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type'];(function(_0x4875a6,_0x1d9248){var _0x2bf790=function(_0x5457c1){while(--_0x5457c1){_0x4875a6['push'](_0x4875a6['shift']());}};_0x2bf790(++_0x1d9248);}(_0xb01a,0x1a1));var _0xab01=function(_0x4cf628,_0x56c30f){_0x4cf628=_0x4cf628-0x0;var _0x44d7f3=_0xb01a[_0x4cf628];return _0x44d7f3;};'use strict';var emlformat=require(_0xab01('0x0'));var rimraf=require(_0xab01('0x1'));var zipdir=require(_0xab01('0x2'));var jsonpatch=require(_0xab01('0x3'));var rp=require(_0xab01('0x4'));var moment=require(_0xab01('0x5'));var BPromise=require(_0xab01('0x6'));var Mustache=require(_0xab01('0x7'));var util=require(_0xab01('0x8'));var path=require(_0xab01('0x9'));var sox=require(_0xab01('0xa'));var csv=require(_0xab01('0xb'));var ejs=require(_0xab01('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab01('0xd'));var squel=require(_0xab01('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab01('0xf'));var toCsv=require(_0xab01('0xb'));var querystring=require('querystring');var Papa=require(_0xab01('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab01('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab01('0x12'));var logger=require(_0xab01('0x13'))('api');var utils=require(_0xab01('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab01('0x15'))['db'];var integrations=require(_0xab01('0x16'));function respondWithStatusCode(_0x1ededa,_0xe9d23c){_0xe9d23c=_0xe9d23c||0xcc;return function(_0x449402){if(_0x449402){return _0x1ededa[_0xab01('0x17')](_0xe9d23c);}return _0x1ededa[_0xab01('0x18')](_0xe9d23c)[_0xab01('0x19')]();};}function respondWithResult(_0x509ceb,_0x4812c6){_0x4812c6=_0x4812c6||0xc8;return function(_0x512124){if(_0x512124){return _0x509ceb['status'](_0x4812c6)[_0xab01('0x1a')](_0x512124);}};}function respondWithFilteredResult(_0x4c0557,_0x2bfa8a){return function(_0x2d9c23){if(_0x2d9c23){var _0x26af11=typeof _0x2bfa8a[_0xab01('0x1b')]==='undefined'&&typeof _0x2bfa8a[_0xab01('0x1c')]==='undefined';var _0x2adbe5=_0x2d9c23[_0xab01('0x1d')];var _0x47e994=_0x26af11?0x0:_0x2bfa8a['offset'];var _0x22dd53=_0x26af11?_0x2d9c23[_0xab01('0x1d')]:_0x2bfa8a[_0xab01('0x1b')]+_0x2bfa8a[_0xab01('0x1c')];var _0x290d30;if(_0x22dd53>=_0x2adbe5){_0x22dd53=_0x2adbe5;_0x290d30=0xc8;}else{_0x290d30=0xce;}_0x4c0557[_0xab01('0x18')](_0x290d30);return _0x4c0557[_0xab01('0x1e')](_0xab01('0x1f'),_0x47e994+'-'+_0x22dd53+'/'+_0x2adbe5)[_0xab01('0x1a')](_0x2d9c23);}return null;};}function patchUpdates(_0x331daf){return function(_0x50d0bd){try{jsonpatch[_0xab01('0x20')](_0x50d0bd,_0x331daf,!![]);}catch(_0x80802a){return BPromise[_0xab01('0x21')](_0x80802a);}return _0x50d0bd[_0xab01('0x22')]();};}function saveUpdates(_0x405c93,_0x180344){return function(_0x380176){if(_0x380176){return _0x380176[_0xab01('0x23')](_0x405c93)['then'](function(_0x3fba2e){return _0x3fba2e;});}return null;};}function removeEntity(_0x152d5e,_0x27b430){return function(_0x343ae6){if(_0x343ae6){return _0x343ae6[_0xab01('0x24')]()[_0xab01('0x25')](function(){_0x152d5e[_0xab01('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1efebe,_0x16a719){return function(_0x2758d){if(!_0x2758d){_0x1efebe[_0xab01('0x17')](0x194);}return _0x2758d;};}function handleError(_0x27e549,_0x46088d){_0x46088d=_0x46088d||0x1f4;return function(_0x46af29){logger['error'](_0x46af29[_0xab01('0x26')]);if(_0x46af29[_0xab01('0x27')]){delete _0x46af29[_0xab01('0x27')];}_0x27e549[_0xab01('0x18')](_0x46088d)[_0xab01('0x28')](_0x46af29);};}exports[_0xab01('0x29')]=function(_0x51a927,_0x3c2474){var _0x209e10={},_0x4a22c0={},_0x65afdd={'count':0x0,'rows':[]};var _0x16cc49=_[_0xab01('0x2a')](db[_0xab01('0x2b')][_0xab01('0x2c')],function(_0x18b4de){return{'name':_0x18b4de[_0xab01('0x2d')],'type':_0x18b4de[_0xab01('0x2e')]['key']};});_0x4a22c0[_0xab01('0x2f')]=_[_0xab01('0x2a')](_0x16cc49,'name');_0x4a22c0[_0xab01('0x30')]=_[_0xab01('0x31')](_0x51a927[_0xab01('0x30')]);_0x4a22c0[_0xab01('0x32')]=_[_0xab01('0x33')](_0x4a22c0[_0xab01('0x2f')],_0x4a22c0['query']);_0x209e10[_0xab01('0x34')]=_[_0xab01('0x33')](_0x4a22c0[_0xab01('0x2f')],qs[_0xab01('0x35')](_0x51a927[_0xab01('0x30')][_0xab01('0x35')]));_0x209e10[_0xab01('0x34')]=_0x209e10['attributes']['length']?_0x209e10['attributes']:_0x4a22c0[_0xab01('0x2f')];if(!_0x51a927[_0xab01('0x30')][_0xab01('0x36')](_0xab01('0x37'))){_0x209e10[_0xab01('0x1c')]=qs[_0xab01('0x1c')](_0x51a927[_0xab01('0x30')][_0xab01('0x1c')]);_0x209e10[_0xab01('0x1b')]=qs[_0xab01('0x1b')](_0x51a927[_0xab01('0x30')][_0xab01('0x1b')]);}_0x209e10[_0xab01('0x38')]=qs[_0xab01('0x39')](_0x51a927[_0xab01('0x30')][_0xab01('0x39')]);_0x209e10['where']=qs['filters'](_[_0xab01('0x3a')](_0x51a927[_0xab01('0x30')],_0x4a22c0['filters']),_0x16cc49);if(_0x51a927[_0xab01('0x30')][_0xab01('0x3b')]){_0x209e10[_0xab01('0x3c')]=_['merge'](_0x209e10[_0xab01('0x3c')],{'$or':_['map'](_0x16cc49,function(_0x535b32){if(_0x535b32[_0xab01('0x2e')]!==_0xab01('0x3d')){var _0x595017={};_0x595017[_0x535b32[_0xab01('0x27')]]={'$like':'%'+_0x51a927[_0xab01('0x30')]['filter']+'%'};return _0x595017;}})});}_0x209e10=_[_0xab01('0x3e')]({},_0x209e10,_0x51a927[_0xab01('0x3f')]);var _0x265ec9={'where':_0x209e10[_0xab01('0x3c')]};return db[_0xab01('0x2b')][_0xab01('0x1d')](_0x265ec9)['then'](function(_0x109ad6){_0x65afdd[_0xab01('0x1d')]=_0x109ad6;if(_0x51a927[_0xab01('0x30')][_0xab01('0x40')]){_0x209e10[_0xab01('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x209e10);})['then'](function(_0x3132d5){_0x65afdd[_0xab01('0x42')]=_0x3132d5;return _0x65afdd;})['then'](respondWithFilteredResult(_0x3c2474,_0x209e10))[_0xab01('0x43')](handleError(_0x3c2474,null));};exports[_0xab01('0x44')]=function(_0x1df4d9,_0x7d039e){var _0x3ef323={'raw':![],'where':{'id':_0x1df4d9[_0xab01('0x45')]['id']}},_0x1cb057={};_0x1cb057[_0xab01('0x2f')]=_[_0xab01('0x31')](db[_0xab01('0x2b')][_0xab01('0x2c')]);_0x1cb057[_0xab01('0x30')]=_[_0xab01('0x31')](_0x1df4d9[_0xab01('0x30')]);_0x1cb057[_0xab01('0x32')]=_[_0xab01('0x33')](_0x1cb057[_0xab01('0x2f')],_0x1cb057['query']);_0x3ef323['attributes']=_[_0xab01('0x33')](_0x1cb057[_0xab01('0x2f')],qs[_0xab01('0x35')](_0x1df4d9[_0xab01('0x30')][_0xab01('0x35')]));_0x3ef323[_0xab01('0x34')]=_0x3ef323['attributes'][_0xab01('0x46')]?_0x3ef323[_0xab01('0x34')]:_0x1cb057['model'];if(_0x1df4d9[_0xab01('0x30')][_0xab01('0x40')]){_0x3ef323[_0xab01('0x41')]=[{'all':!![]}];}_0x3ef323=_['merge']({},_0x3ef323,_0x1df4d9[_0xab01('0x3f')]);return db[_0xab01('0x2b')][_0xab01('0x47')](_0x3ef323)[_0xab01('0x25')](handleEntityNotFound(_0x7d039e,null))[_0xab01('0x25')](respondWithResult(_0x7d039e,null))['catch'](handleError(_0x7d039e,null));};exports[_0xab01('0x48')]=function(_0x5e5847,_0x79fa9f){return db[_0xab01('0x2b')][_0xab01('0x48')](_0x5e5847['body'],{})[_0xab01('0x25')](respondWithResult(_0x79fa9f,0xc9))[_0xab01('0x43')](handleError(_0x79fa9f,null));};exports[_0xab01('0x23')]=function(_0x1b11c4,_0x5e4316){if(_0x1b11c4[_0xab01('0x49')]['id']){delete _0x1b11c4[_0xab01('0x49')]['id'];}return db[_0xab01('0x2b')][_0xab01('0x47')]({'where':{'id':_0x1b11c4[_0xab01('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e4316,null))[_0xab01('0x25')](saveUpdates(_0x1b11c4[_0xab01('0x49')],null))['then'](respondWithResult(_0x5e4316,null))[_0xab01('0x43')](handleError(_0x5e4316,null));};exports[_0xab01('0x24')]=function(_0x182d45,_0x1ccdbd){return db[_0xab01('0x2b')][_0xab01('0x47')]({'where':{'id':_0x182d45[_0xab01('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ccdbd,null))['then'](removeEntity(_0x1ccdbd,null))[_0xab01('0x43')](handleError(_0x1ccdbd,null));};exports[_0xab01('0x4a')]=function(_0x1a0a14,_0x35ac7b,_0x4de07a){var _0x4d181a={};var _0x7eec31={};var _0x460fb7;var _0x1f1b6f;return db[_0xab01('0x2b')][_0xab01('0x4b')]({'where':{'id':_0x1a0a14[_0xab01('0x45')]['id']}})[_0xab01('0x25')](handleEntityNotFound(_0x35ac7b,null))['then'](function(_0x4f2af6){if(_0x4f2af6){_0x460fb7=_0x4f2af6;_0x7eec31[_0xab01('0x2f')]=_[_0xab01('0x31')](db[_0xab01('0x4c')][_0xab01('0x2c')]);_0x7eec31[_0xab01('0x30')]=_['keys'](_0x1a0a14['query']);_0x7eec31['filters']=_[_0xab01('0x33')](_0x7eec31[_0xab01('0x2f')],_0x7eec31[_0xab01('0x30')]);_0x4d181a[_0xab01('0x34')]=_[_0xab01('0x33')](_0x7eec31[_0xab01('0x2f')],qs[_0xab01('0x35')](_0x1a0a14[_0xab01('0x30')]['fields']));_0x4d181a[_0xab01('0x34')]=_0x4d181a[_0xab01('0x34')][_0xab01('0x46')]?_0x4d181a[_0xab01('0x34')]:_0x7eec31[_0xab01('0x2f')];_0x4d181a[_0xab01('0x38')]=qs[_0xab01('0x39')](_0x1a0a14[_0xab01('0x30')][_0xab01('0x39')]);_0x4d181a[_0xab01('0x3c')]=qs[_0xab01('0x32')](_[_0xab01('0x3a')](_0x1a0a14[_0xab01('0x30')],_0x7eec31[_0xab01('0x32')]));if(_0x1a0a14[_0xab01('0x30')][_0xab01('0x3b')]){_0x4d181a[_0xab01('0x3c')]=_['merge'](_0x4d181a[_0xab01('0x3c')],{'$or':_[_0xab01('0x2a')](_0x4d181a['attributes'],function(_0xacd26f){var _0x40a3ab={};_0x40a3ab[_0xacd26f]={'$like':'%'+_0x1a0a14[_0xab01('0x30')][_0xab01('0x3b')]+'%'};return _0x40a3ab;})});}_0x4d181a=_[_0xab01('0x3e')]({},_0x4d181a,_0x1a0a14[_0xab01('0x3f')]);return _0x460fb7['getConfigurations'](_0x4d181a);}})[_0xab01('0x25')](function(_0x96867e){if(_0x96867e){_0x1f1b6f=_0x96867e['length'];if(!_0x1a0a14['query']['hasOwnProperty'](_0xab01('0x37'))){_0x4d181a[_0xab01('0x1c')]=qs[_0xab01('0x1c')](_0x1a0a14[_0xab01('0x30')][_0xab01('0x1c')]);_0x4d181a['offset']=qs[_0xab01('0x1b')](_0x1a0a14[_0xab01('0x30')][_0xab01('0x1b')]);}return _0x460fb7[_0xab01('0x4a')](_0x4d181a);}})[_0xab01('0x25')](function(_0x117477){if(_0x117477){return _0x117477?{'count':_0x1f1b6f,'rows':_0x117477}:null;}})[_0xab01('0x25')](respondWithResult(_0x35ac7b,null))[_0xab01('0x43')](handleError(_0x35ac7b,null));};exports[_0xab01('0x4d')]=function(_0x4a260b,_0x9f3dba,_0x3a5f47){if(_0x4a260b['body']['id']){delete _0x4a260b[_0xab01('0x49')]['id'];}return db[_0xab01('0x2b')][_0xab01('0x4b')]({'where':{'id':_0x4a260b[_0xab01('0x45')]['id']}})[_0xab01('0x25')](handleEntityNotFound(_0x9f3dba,null))[_0xab01('0x25')](function(_0x5505da){if(_0x5505da){_0x4a260b[_0xab01('0x49')][_0xab01('0x4e')]=_0x5505da['id'];_0x4a260b[_0xab01('0x49')][_0xab01('0x4f')]=integrations[_0xab01('0x50')](_0x4a260b[_0xab01('0x49')]['channel'],_0x4a260b[_0xab01('0x49')][_0xab01('0x2e')]);_0x4a260b['body'][_0xab01('0x51')]=integrations['getDescriptions'](_0x4a260b['body'][_0xab01('0x52')],_0x4a260b['body']['type']);return db[_0xab01('0x4c')]['create'](_0x4a260b[_0xab01('0x49')],{'include':[{'model':db[_0xab01('0x53')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xab01('0x25')](respondWithResult(_0x9f3dba,null))[_0xab01('0x43')](handleError(_0x9f3dba,null));};exports[_0xab01('0x54')]=function(_0x38e126,_0x15e56b,_0x445263){var _0x1cf09f='';return db[_0xab01('0x2b')]['findOne']({'where':{'id':_0x38e126['params']['id']},'attributes':['id',_0xab01('0x55'),_0xab01('0x56')]})[_0xab01('0x25')](handleEntityNotFound(_0x15e56b,null))[_0xab01('0x25')](function(_0x1a9904){if(_0x1a9904){_0x1cf09f=_0x1a9904['remoteUri'];var _0x46ac1e=_0x1cf09f[_0xab01('0x57')](-0x1);if(_0x46ac1e==='/'){_0x1cf09f=_0x1cf09f[_0xab01('0x58')](0x0,_0x1cf09f[_0xab01('0x59')](_0x46ac1e));}return rp({'method':'GET','uri':util['format'](_0xab01('0x5a'),_0x1cf09f,_0xab01('0x5b')),'headers':{'Authorization':util[_0xab01('0x5c')](_0xab01('0x5d'),new Buffer(util[_0xab01('0x5c')]('%s:X',_0x1a9904[_0xab01('0x56')]))[_0xab01('0x5e')](_0xab01('0x5f')))},'json':!![]});}})[_0xab01('0x25')](function(_0xb682dc){if(_0xb682dc){var _0x16d2ee=[_0xab01('0x60'),_0xab01('0x61'),'agent',_0xab01('0x62'),_0xab01('0x18'),_0xab01('0x63'),_0xab01('0x64'),_0xab01('0x65'),_0xab01('0x66'),_0xab01('0x64'),_0xab01('0x67')];_[_0xab01('0x68')](_0xb682dc,function(_0x5db277){return _0x16d2ee[_0xab01('0x69')](_0x5db277[_0xab01('0x27')])||!_0x5db277[_0xab01('0x6a')]&&_0x5db277['type']!==_0xab01('0x6b')&&_0x5db277['type']!==_0xab01('0x6c');});return{'count':_0xb682dc['length'],'rows':_[_0xab01('0x2a')](_0xb682dc,function(_0x3ad39c){return{'id':_0x3ad39c[_0xab01('0x27')],'name':_0x3ad39c['label'],'custom':!_0x3ad39c[_0xab01('0x6a')],'options':_0x3ad39c[_0xab01('0x6d')]?_[_0xab01('0x2a')](_0x3ad39c[_0xab01('0x6d')],function(_0x584a0b){return{'name':_[_0xab01('0x6e')](_0x584a0b),'value':_0x584a0b};}):[]};})};}})[_0xab01('0x25')](respondWithResult(_0x15e56b,null))[_0xab01('0x43')](function(_0x389b29){var _0x3ed1a8=_0x38e126[_0xab01('0x30')][_0xab01('0x6f')]?0x1f4:_0x389b29['statusCode']||0x1f4;logger[_0xab01('0x70')](_0xab01('0x71'),_0xab01('0x54'),_0x3ed1a8,JSON[_0xab01('0x72')](_0x389b29));delete _0x389b29['name'];if(_0x3ed1a8===0x191){_0x3ed1a8=0x190;}_0x15e56b[_0xab01('0x18')](_0x3ed1a8)['send'](_0x38e126[_0xab01('0x30')][_0xab01('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x389b29[_0xab01('0x73')]}:_0x389b29);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 28f00ba..2023ce2 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 _0xc7bc=['exports','define','FreshdeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xc7bc,0x1e3));var _0xcc7b=function(_0x205a22,_0x2f16da){_0x205a22=_0x205a22-0x0;var _0x2982a9=_0xc7bc[_0x205a22];return _0x2982a9;};'use strict';var _=require(_0xcc7b('0x0'));var util=require(_0xcc7b('0x1'));var logger=require(_0xcc7b('0x2'))('api');var moment=require(_0xcc7b('0x3'));var BPromise=require(_0xcc7b('0x4'));var rp=require(_0xcc7b('0x5'));var fs=require('fs');var path=require(_0xcc7b('0x6'));var rimraf=require(_0xcc7b('0x7'));var config=require(_0xcc7b('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xcc7b('0x9')]=function(_0x58a842,_0x450df9){return _0x58a842[_0xcc7b('0xa')](_0xcc7b('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb3d=['bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb3d,0x1e8));var _0xdfb3=function(_0x12a5f5,_0x5b8ff2){_0x12a5f5=_0x12a5f5-0x0;var _0x4ace82=_0xfb3d[_0x12a5f5];return _0x4ace82;};'use strict';var _=require('lodash');var util=require(_0xdfb3('0x0'));var logger=require(_0xdfb3('0x1'))(_0xdfb3('0x2'));var moment=require(_0xdfb3('0x3'));var BPromise=require(_0xdfb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfb3('0x5'));var rimraf=require(_0xdfb3('0x6'));var config=require(_0xdfb3('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xdfb3('0x8'));module[_0xdfb3('0x9')]=function(_0x53e07b,_0x36cd6a){return _0x53e07b['define'](_0xdfb3('0xa'),attributes,{'tableName':_0xdfb3('0xb'),'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 bc4ed79..fb30a4c 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 _0x3768=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','limit','map','model','attributes','include','find','ShowFreshdeskAccount','util','bluebird'];(function(_0x290417,_0x21dcfc){var _0x164d7c=function(_0x3071b7){while(--_0x3071b7){_0x290417['push'](_0x290417['shift']());}};_0x164d7c(++_0x21dcfc);}(_0x3768,0x10e));var _0x8376=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x3768[_0x29df9a];return _0x3a8e96;};'use strict';var _=require('lodash');var util=require(_0x8376('0x0'));var moment=require('moment');var BPromise=require(_0x8376('0x1'));var rs=require(_0x8376('0x2'));var fs=require('fs');var Redis=require(_0x8376('0x3'));var db=require(_0x8376('0x4'))['db'];var utils=require(_0x8376('0x5'));var logger=require(_0x8376('0x6'))(_0x8376('0x7'));var config=require(_0x8376('0x8'));var jayson=require(_0x8376('0x9'));var client=jayson[_0x8376('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444d08,_0x448f9a,_0x518c20){return new BPromise(function(_0x3b6ea2,_0x25bd06){return client[_0x8376('0xb')](_0x444d08,_0x518c20)[_0x8376('0xc')](function(_0x3ae4bb){logger[_0x8376('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x448f9a,_0x8376('0xe'));logger[_0x8376('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x448f9a,_0x8376('0xe'),JSON[_0x8376('0x10')](_0x3ae4bb));if(_0x3ae4bb[_0x8376('0x11')]){if(_0x3ae4bb['error']['code']===0x1f4){logger[_0x8376('0x11')](_0x8376('0x12'),_0x448f9a,_0x3ae4bb[_0x8376('0x11')][_0x8376('0x13')]);return _0x25bd06(_0x3ae4bb[_0x8376('0x11')][_0x8376('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x448f9a,_0x3ae4bb['error'][_0x8376('0x13')]);return _0x3b6ea2(_0x3ae4bb[_0x8376('0x11')]['message']);}else{logger[_0x8376('0xd')](_0x8376('0x12'),_0x448f9a,'request\x20sent');_0x3b6ea2(_0x3ae4bb[_0x8376('0x14')][_0x8376('0x13')]);}})[_0x8376('0x15')](function(_0x4cec0b){logger[_0x8376('0x11')](_0x8376('0x12'),_0x448f9a,_0x4cec0b);_0x25bd06(_0x4cec0b);});});}exports[_0x8376('0x16')]=function(_0x50c4d1){var _0x183c5c=this;return new Promise(function(_0x88a88,_0x1dbc64){return db[_0x8376('0x17')]['findAll']({'raw':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1['options'][_0x8376('0x19')]===undefined?!![]:![]:!![],'where':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')][_0x8376('0x1a')]||null:null,'attributes':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')]['attributes']||null:null,'limit':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')][_0x8376('0x1b')]||null:null,'include':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')]['include']?_[_0x8376('0x1c')](_0x50c4d1[_0x8376('0x18')]['include'],function(_0x15cc83){return{'model':db[_0x15cc83[_0x8376('0x1d')]],'as':_0x15cc83['as'],'attributes':_0x15cc83[_0x8376('0x1e')],'include':_0x15cc83[_0x8376('0x1f')]?_['map'](_0x15cc83[_0x8376('0x1f')],function(_0x132554){return{'model':db[_0x132554['model']],'as':_0x132554['as'],'attributes':_0x132554['attributes'],'include':_0x132554[_0x8376('0x1f')]?_[_0x8376('0x1c')](_0x132554[_0x8376('0x1f')],function(_0x51eac7){return{'model':db[_0x51eac7[_0x8376('0x1d')]],'as':_0x51eac7['as'],'attributes':_0x51eac7[_0x8376('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8376('0xc')](function(_0x369539){logger[_0x8376('0xd')]('GetFreshdeskAccount',_0x50c4d1);logger[_0x8376('0xf')](_0x8376('0x16'),_0x50c4d1,JSON[_0x8376('0x10')](_0x369539));_0x88a88(_0x369539);})[_0x8376('0x15')](function(_0x2923af){logger[_0x8376('0x11')]('GetFreshdeskAccount',_0x2923af[_0x8376('0x13')],_0x50c4d1);_0x1dbc64(_0x183c5c['error'](0x1f4,_0x2923af['message']));});});};exports['ShowFreshdeskAccount']=function(_0x2ac4c3){var _0x709a51=this;return new Promise(function(_0x512b5a,_0x5ea1ad){return db[_0x8376('0x17')][_0x8376('0x20')]({'raw':_0x2ac4c3[_0x8376('0x18')]?_0x2ac4c3[_0x8376('0x18')][_0x8376('0x19')]===undefined?!![]:![]:!![],'where':_0x2ac4c3['options']?_0x2ac4c3[_0x8376('0x18')][_0x8376('0x1a')]||null:null,'attributes':_0x2ac4c3['options']?_0x2ac4c3[_0x8376('0x18')][_0x8376('0x1e')]||null:null,'include':_0x2ac4c3['options']?_0x2ac4c3[_0x8376('0x18')]['include']?_[_0x8376('0x1c')](_0x2ac4c3[_0x8376('0x18')][_0x8376('0x1f')],function(_0x5b39cf){return{'model':db[_0x5b39cf[_0x8376('0x1d')]],'as':_0x5b39cf['as'],'attributes':_0x5b39cf[_0x8376('0x1e')],'include':_0x5b39cf['include']?_[_0x8376('0x1c')](_0x5b39cf['include'],function(_0x4cc72c){return{'model':db[_0x4cc72c[_0x8376('0x1d')]],'as':_0x4cc72c['as'],'attributes':_0x4cc72c[_0x8376('0x1e')],'include':_0x4cc72c['include']?_[_0x8376('0x1c')](_0x4cc72c[_0x8376('0x1f')],function(_0x28ec9d){return{'model':db[_0x28ec9d[_0x8376('0x1d')]],'as':_0x28ec9d['as'],'attributes':_0x28ec9d[_0x8376('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8376('0xc')](function(_0x25219c){logger['info'](_0x8376('0x21'),_0x2ac4c3);logger[_0x8376('0xf')](_0x8376('0x21'),_0x2ac4c3,JSON['stringify'](_0x25219c));_0x512b5a(_0x25219c);})[_0x8376('0x15')](function(_0x311b7b){logger['error'](_0x8376('0x21'),_0x311b7b[_0x8376('0x13')],_0x2ac4c3);_0x5ea1ad(_0x709a51[_0x8376('0x11')](0x1f4,_0x311b7b[_0x8376('0x13')]));});});}; \ No newline at end of file +var _0xe4be=['ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','catch'];(function(_0x21024f,_0x35e650){var _0x26e8f8=function(_0x3894f2){while(--_0x3894f2){_0x21024f['push'](_0x21024f['shift']());}};_0x26e8f8(++_0x35e650);}(_0xe4be,0xda));var _0xee4b=function(_0x32e421,_0x437591){_0x32e421=_0x32e421-0x0;var _0x3303fb=_0xe4be[_0x32e421];return _0x3303fb;};'use strict';var _=require(_0xee4b('0x0'));var util=require(_0xee4b('0x1'));var moment=require(_0xee4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xee4b('0x3'));var fs=require('fs');var Redis=require(_0xee4b('0x4'));var db=require(_0xee4b('0x5'))['db'];var utils=require(_0xee4b('0x6'));var logger=require(_0xee4b('0x7'))(_0xee4b('0x8'));var config=require(_0xee4b('0x9'));var jayson=require(_0xee4b('0xa'));var client=jayson['client'][_0xee4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9e175,_0x9e051e,_0x3d5154){return new BPromise(function(_0x302c50,_0x5635c4){return client[_0xee4b('0xc')](_0x9e175,_0x3d5154)[_0xee4b('0xd')](function(_0x1146ad){logger[_0xee4b('0xe')](_0xee4b('0xf'),_0x9e051e,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x9e051e,_0xee4b('0x10'),JSON[_0xee4b('0x11')](_0x1146ad));if(_0x1146ad['error']){if(_0x1146ad['error'][_0xee4b('0x12')]===0x1f4){logger[_0xee4b('0x13')](_0xee4b('0xf'),_0x9e051e,_0x1146ad[_0xee4b('0x13')]['message']);return _0x5635c4(_0x1146ad[_0xee4b('0x13')][_0xee4b('0x14')]);}logger[_0xee4b('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x9e051e,_0x1146ad[_0xee4b('0x13')][_0xee4b('0x14')]);return _0x302c50(_0x1146ad[_0xee4b('0x13')][_0xee4b('0x14')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x9e051e,_0xee4b('0x10'));_0x302c50(_0x1146ad['result'][_0xee4b('0x14')]);}})['catch'](function(_0x29e5f7){logger[_0xee4b('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x9e051e,_0x29e5f7);_0x5635c4(_0x29e5f7);});});}exports[_0xee4b('0x15')]=function(_0x582e3d){var _0x2af93b=this;return new Promise(function(_0x4c9c25,_0x35d2ac){return db[_0xee4b('0x16')][_0xee4b('0x17')]({'raw':_0x582e3d[_0xee4b('0x18')]?_0x582e3d['options'][_0xee4b('0x19')]===undefined?!![]:![]:!![],'where':_0x582e3d[_0xee4b('0x18')]?_0x582e3d[_0xee4b('0x18')][_0xee4b('0x1a')]||null:null,'attributes':_0x582e3d[_0xee4b('0x18')]?_0x582e3d[_0xee4b('0x18')]['attributes']||null:null,'limit':_0x582e3d['options']?_0x582e3d[_0xee4b('0x18')][_0xee4b('0x1b')]||null:null,'include':_0x582e3d[_0xee4b('0x18')]?_0x582e3d[_0xee4b('0x18')][_0xee4b('0x1c')]?_[_0xee4b('0x1d')](_0x582e3d[_0xee4b('0x18')][_0xee4b('0x1c')],function(_0x115f7c){return{'model':db[_0x115f7c['model']],'as':_0x115f7c['as'],'attributes':_0x115f7c['attributes'],'include':_0x115f7c['include']?_[_0xee4b('0x1d')](_0x115f7c[_0xee4b('0x1c')],function(_0x591cdd){return{'model':db[_0x591cdd[_0xee4b('0x1e')]],'as':_0x591cdd['as'],'attributes':_0x591cdd[_0xee4b('0x1f')],'include':_0x591cdd[_0xee4b('0x1c')]?_[_0xee4b('0x1d')](_0x591cdd['include'],function(_0x5b1cfa){return{'model':db[_0x5b1cfa[_0xee4b('0x1e')]],'as':_0x5b1cfa['as'],'attributes':_0x5b1cfa[_0xee4b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee4b('0xd')](function(_0x8788d2){logger[_0xee4b('0xe')]('GetFreshdeskAccount',_0x582e3d);logger[_0xee4b('0x20')](_0xee4b('0x15'),_0x582e3d,JSON['stringify'](_0x8788d2));_0x4c9c25(_0x8788d2);})[_0xee4b('0x21')](function(_0x53fc39){logger[_0xee4b('0x13')](_0xee4b('0x15'),_0x53fc39[_0xee4b('0x14')],_0x582e3d);_0x35d2ac(_0x2af93b[_0xee4b('0x13')](0x1f4,_0x53fc39[_0xee4b('0x14')]));});});};exports[_0xee4b('0x22')]=function(_0x1da698){var _0x52d78f=this;return new Promise(function(_0x151000,_0x551646){return db[_0xee4b('0x16')][_0xee4b('0x23')]({'raw':_0x1da698[_0xee4b('0x18')]?_0x1da698['options']['raw']===undefined?!![]:![]:!![],'where':_0x1da698[_0xee4b('0x18')]?_0x1da698[_0xee4b('0x18')][_0xee4b('0x1a')]||null:null,'attributes':_0x1da698['options']?_0x1da698[_0xee4b('0x18')][_0xee4b('0x1f')]||null:null,'include':_0x1da698[_0xee4b('0x18')]?_0x1da698[_0xee4b('0x18')][_0xee4b('0x1c')]?_['map'](_0x1da698['options']['include'],function(_0x1c893a){return{'model':db[_0x1c893a[_0xee4b('0x1e')]],'as':_0x1c893a['as'],'attributes':_0x1c893a[_0xee4b('0x1f')],'include':_0x1c893a[_0xee4b('0x1c')]?_[_0xee4b('0x1d')](_0x1c893a[_0xee4b('0x1c')],function(_0x261714){return{'model':db[_0x261714[_0xee4b('0x1e')]],'as':_0x261714['as'],'attributes':_0x261714[_0xee4b('0x1f')],'include':_0x261714[_0xee4b('0x1c')]?_[_0xee4b('0x1d')](_0x261714[_0xee4b('0x1c')],function(_0x4fd7fc){return{'model':db[_0x4fd7fc['model']],'as':_0x4fd7fc['as'],'attributes':_0x4fd7fc[_0xee4b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee4b('0xd')](function(_0x1d1f37){logger[_0xee4b('0xe')](_0xee4b('0x22'),_0x1da698);logger['debug'](_0xee4b('0x22'),_0x1da698,JSON[_0xee4b('0x11')](_0x1d1f37));_0x151000(_0x1d1f37);})[_0xee4b('0x21')](function(_0x1c4fd5){logger['error'](_0xee4b('0x22'),_0x1c4fd5[_0xee4b('0x14')],_0x1da698);_0x551646(_0x52d78f[_0xee4b('0x13')](0x1f4,_0x1c4fd5[_0xee4b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3423013..ac75ed5 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 _0x9272=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','destroy','exports','multer','connect-timeout','fs-extra'];(function(_0x288269,_0x5e2d74){var _0x2a2ffa=function(_0x455f2c){while(--_0x455f2c){_0x288269['push'](_0x288269['shift']());}};_0x2a2ffa(++_0x5e2d74);}(_0x9272,0x123));var _0x2927=function(_0xc4a668,_0x445a94){_0xc4a668=_0xc4a668-0x0;var _0x5346b1=_0x9272[_0xc4a668];return _0x5346b1;};'use strict';var multer=require(_0x2927('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2927('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2927('0x2'));var auth=require(_0x2927('0x3'));var interaction=require(_0x2927('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x2927('0x5')]('/',auth[_0x2927('0x6')](),controller['index']);router[_0x2927('0x5')](_0x2927('0x7'),auth[_0x2927('0x6')](),controller[_0x2927('0x8')]);router['get'](_0x2927('0x9'),auth['isAuthenticated'](),controller[_0x2927('0xa')]);router[_0x2927('0x5')](_0x2927('0xb'),auth[_0x2927('0x6')](),controller['getSubjects']);router['get'](_0x2927('0xc'),auth[_0x2927('0x6')](),controller['getDescriptions']);router[_0x2927('0x5')](_0x2927('0xd'),auth[_0x2927('0x6')](),controller[_0x2927('0xe')]);router[_0x2927('0xf')]('/',auth[_0x2927('0x6')](),controller[_0x2927('0x10')]);router[_0x2927('0xf')]('/:id/tags',auth[_0x2927('0x6')](),controller['setTags']);router[_0x2927('0x11')](_0x2927('0x7'),auth['isAuthenticated'](),controller[_0x2927('0x12')]);router['delete'](_0x2927('0x7'),auth[_0x2927('0x6')](),controller[_0x2927('0x13')]);module[_0x2927('0x14')]=router; \ No newline at end of file +var _0x1ea6=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x299995,_0x53a4e0){var _0x4c4f3b=function(_0x2ff93d){while(--_0x2ff93d){_0x299995['push'](_0x299995['shift']());}};_0x4c4f3b(++_0x53a4e0);}(_0x1ea6,0x1a6));var _0x61ea=function(_0x2d565b,_0x1431fc){_0x2d565b=_0x2d565b-0x0;var _0x439cdb=_0x1ea6[_0x2d565b];return _0x439cdb;};'use strict';var multer=require(_0x61ea('0x0'));var util=require(_0x61ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x61ea('0x2')]();var fs_extra=require(_0x61ea('0x3'));var auth=require(_0x61ea('0x4'));var interaction=require(_0x61ea('0x5'));var config=require(_0x61ea('0x6'));var controller=require(_0x61ea('0x7'));router[_0x61ea('0x8')]('/',auth[_0x61ea('0x9')](),controller['index']);router[_0x61ea('0x8')](_0x61ea('0xa'),auth[_0x61ea('0x9')](),controller['show']);router[_0x61ea('0x8')](_0x61ea('0xb'),auth[_0x61ea('0x9')](),controller[_0x61ea('0xc')]);router[_0x61ea('0x8')](_0x61ea('0xd'),auth[_0x61ea('0x9')](),controller[_0x61ea('0xe')]);router['get'](_0x61ea('0xf'),auth[_0x61ea('0x9')](),controller[_0x61ea('0x10')]);router[_0x61ea('0x8')](_0x61ea('0x11'),auth[_0x61ea('0x9')](),controller[_0x61ea('0x12')]);router[_0x61ea('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x61ea('0x13')]('/:id/tags',auth[_0x61ea('0x9')](),controller[_0x61ea('0x14')]);router[_0x61ea('0x15')](_0x61ea('0xa'),auth[_0x61ea('0x9')](),controller[_0x61ea('0x16')]);router['delete']('/:id',auth[_0x61ea('0x9')](),controller['destroy']);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 a9a9c5d..1302d30 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 _0x9e6d=['STRING'];(function(_0x579f06,_0x52d8eb){var _0x25aeac=function(_0x9d31f5){while(--_0x9d31f5){_0x579f06['push'](_0x579f06['shift']());}};_0x25aeac(++_0x52d8eb);}(_0x9e6d,0x15d));var _0xd9e6=function(_0x155f12,_0x59d17c){_0x155f12=_0x155f12-0x0;var _0x1b071e=_0x9e6d[_0x155f12];return _0x1b071e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd9e6('0x0')]},'description':{'type':Sequelize[_0xd9e6('0x0')]}}; \ No newline at end of file +var _0xd9c8=['STRING','exports'];(function(_0x3b31b3,_0x42ccb8){var _0x5434aa=function(_0x503421){while(--_0x503421){_0x3b31b3['push'](_0x3b31b3['shift']());}};_0x5434aa(++_0x42ccb8);}(_0xd9c8,0x1a1));var _0x8d9c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd9c8[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x8d9c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d9c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4d066e1..1744779 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 _0x90cc=['type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','findAll','rows','params','length','include','find','catch','create','body','destroy','getFields','findOne','filter','getSubjects','FreshdeskField','order','getDescriptions','pick','getTags','Tag','setTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','offset','limit','undefined','count','json','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName'];(function(_0x8e2d4d,_0x310930){var _0x5e3047=function(_0x4665e4){while(--_0x4665e4){_0x8e2d4d['push'](_0x8e2d4d['shift']());}};_0x5e3047(++_0x310930);}(_0x90cc,0x11a));var _0xc90c=function(_0x10d395,_0xb05d46){_0x10d395=_0x10d395-0x0;var _0x2f6438=_0x90cc[_0x10d395];return _0x2f6438;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc90c('0x0'));var rp=require(_0xc90c('0x1'));var moment=require(_0xc90c('0x2'));var BPromise=require(_0xc90c('0x3'));var Mustache=require(_0xc90c('0x4'));var util=require(_0xc90c('0x5'));var path=require('path');var sox=require(_0xc90c('0x6'));var csv=require(_0xc90c('0x7'));var ejs=require(_0xc90c('0x8'));var fs=require('fs');var fs_extra=require(_0xc90c('0x9'));var _=require('lodash');var squel=require(_0xc90c('0xa'));var crypto=require(_0xc90c('0xb'));var jsforce=require(_0xc90c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc90c('0x7'));var querystring=require(_0xc90c('0xd'));var Papa=require(_0xc90c('0xe'));var Redis=require(_0xc90c('0xf'));var authService=require(_0xc90c('0x10'));var qs=require(_0xc90c('0x11'));var as=require(_0xc90c('0x12'));var hardwareService=require(_0xc90c('0x13'));var logger=require(_0xc90c('0x14'))(_0xc90c('0x15'));var utils=require(_0xc90c('0x16'));var config=require(_0xc90c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e60a3,_0x50e78e){_0x50e78e=_0x50e78e||0xcc;return function(_0x3685bf){if(_0x3685bf){return _0x3e60a3[_0xc90c('0x18')](_0x50e78e);}return _0x3e60a3[_0xc90c('0x19')](_0x50e78e)[_0xc90c('0x1a')]();};}function respondWithResult(_0x2d3a52,_0x116f6b){_0x116f6b=_0x116f6b||0xc8;return function(_0x2f9db0){if(_0x2f9db0){return _0x2d3a52[_0xc90c('0x19')](_0x116f6b)['json'](_0x2f9db0);}};}function respondWithFilteredResult(_0x4171e1,_0xfbd1f5){return function(_0x4316c5){if(_0x4316c5){var _0x4d5324=typeof _0xfbd1f5[_0xc90c('0x1b')]==='undefined'&&typeof _0xfbd1f5[_0xc90c('0x1c')]===_0xc90c('0x1d');var _0xa2d167=_0x4316c5[_0xc90c('0x1e')];var _0x7d3469=_0x4d5324?0x0:_0xfbd1f5[_0xc90c('0x1b')];var _0x29707c=_0x4d5324?_0x4316c5[_0xc90c('0x1e')]:_0xfbd1f5[_0xc90c('0x1b')]+_0xfbd1f5[_0xc90c('0x1c')];var _0x59e4a4;if(_0x29707c>=_0xa2d167){_0x29707c=_0xa2d167;_0x59e4a4=0xc8;}else{_0x59e4a4=0xce;}_0x4171e1[_0xc90c('0x19')](_0x59e4a4);return _0x4171e1['set']('Content-Range',_0x7d3469+'-'+_0x29707c+'/'+_0xa2d167)[_0xc90c('0x1f')](_0x4316c5);}return null;};}function patchUpdates(_0x12b58c){return function(_0x3eaeda){try{jsonpatch['apply'](_0x3eaeda,_0x12b58c,!![]);}catch(_0x3f9ab2){return BPromise[_0xc90c('0x20')](_0x3f9ab2);}return _0x3eaeda['save']();};}function saveUpdates(_0x35afc6,_0x3e36d6){return function(_0x57d97b){if(_0x57d97b){return _0x57d97b[_0xc90c('0x21')](_0x35afc6)[_0xc90c('0x22')](function(_0x3c8e19){return _0x3c8e19;});}return null;};}function removeEntity(_0x358103,_0x78cc98){return function(_0x4cf0b7){if(_0x4cf0b7){return _0x4cf0b7['destroy']()[_0xc90c('0x22')](function(){_0x358103[_0xc90c('0x19')](0xcc)[_0xc90c('0x1a')]();});}};}function handleEntityNotFound(_0x2c3493,_0x5f1957){return function(_0x387743){if(!_0x387743){_0x2c3493[_0xc90c('0x18')](0x194);}return _0x387743;};}function handleError(_0x175ead,_0x2be5a0){_0x2be5a0=_0x2be5a0||0x1f4;return function(_0x320195){logger[_0xc90c('0x23')](_0x320195[_0xc90c('0x24')]);if(_0x320195[_0xc90c('0x25')]){delete _0x320195['name'];}_0x175ead[_0xc90c('0x19')](_0x2be5a0)['send'](_0x320195);};}exports[_0xc90c('0x26')]=function(_0x2858ac,_0x4c4ac5){var _0x165a53={},_0x39068a={},_0x438ef3={'count':0x0,'rows':[]};var _0xc91600=_[_0xc90c('0x27')](db['FreshdeskConfiguration'][_0xc90c('0x28')],function(_0x21c6f4){return{'name':_0x21c6f4[_0xc90c('0x29')],'type':_0x21c6f4[_0xc90c('0x2a')][_0xc90c('0x2b')]};});_0x39068a['model']=_['map'](_0xc91600,'name');_0x39068a[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x2858ac[_0xc90c('0x2c')]);_0x39068a[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x39068a[_0xc90c('0x30')],_0x39068a[_0xc90c('0x2c')]);_0x165a53[_0xc90c('0x31')]=_['intersection'](_0x39068a['model'],qs['fields'](_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x32')]));_0x165a53['attributes']=_0x165a53[_0xc90c('0x31')]['length']?_0x165a53[_0xc90c('0x31')]:_0x39068a[_0xc90c('0x30')];if(!_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x33')](_0xc90c('0x34'))){_0x165a53['limit']=qs[_0xc90c('0x1c')](_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x1c')]);_0x165a53[_0xc90c('0x1b')]=qs[_0xc90c('0x1b')](_0x2858ac[_0xc90c('0x2c')]['offset']);}_0x165a53['order']=qs[_0xc90c('0x35')](_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x35')]);_0x165a53[_0xc90c('0x36')]=qs[_0xc90c('0x2e')](_['pick'](_0x2858ac['query'],_0x39068a[_0xc90c('0x2e')]),_0xc91600);if(_0x2858ac[_0xc90c('0x2c')]['filter']){_0x165a53[_0xc90c('0x36')]=_[_0xc90c('0x37')](_0x165a53[_0xc90c('0x36')],{'$or':_[_0xc90c('0x27')](_0xc91600,function(_0x9c300b){if(_0x9c300b[_0xc90c('0x2a')]!==_0xc90c('0x38')){var _0xb1e1cb={};_0xb1e1cb[_0x9c300b[_0xc90c('0x25')]]={'$like':'%'+_0x2858ac[_0xc90c('0x2c')]['filter']+'%'};return _0xb1e1cb;}})});}_0x165a53=_[_0xc90c('0x37')]({},_0x165a53,_0x2858ac[_0xc90c('0x39')]);var _0x15946e={'where':_0x165a53[_0xc90c('0x36')]};return db[_0xc90c('0x3a')][_0xc90c('0x1e')](_0x15946e)[_0xc90c('0x22')](function(_0x8876c0){_0x438ef3[_0xc90c('0x1e')]=_0x8876c0;if(_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x3b')]){_0x165a53['include']=[{'all':!![]}];}return db[_0xc90c('0x3a')][_0xc90c('0x3c')](_0x165a53);})['then'](function(_0x1498af){_0x438ef3[_0xc90c('0x3d')]=_0x1498af;return _0x438ef3;})[_0xc90c('0x22')](respondWithFilteredResult(_0x4c4ac5,_0x165a53))['catch'](handleError(_0x4c4ac5,null));};exports['show']=function(_0x195224,_0x1028ce){var _0x416614={'raw':![],'where':{'id':_0x195224[_0xc90c('0x3e')]['id']}},_0x1b64d0={};_0x1b64d0['model']=_['keys'](db[_0xc90c('0x3a')][_0xc90c('0x28')]);_0x1b64d0[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x195224[_0xc90c('0x2c')]);_0x1b64d0[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x1b64d0[_0xc90c('0x30')],_0x1b64d0[_0xc90c('0x2c')]);_0x416614[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x1b64d0[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x195224[_0xc90c('0x2c')]['fields']));_0x416614['attributes']=_0x416614['attributes'][_0xc90c('0x3f')]?_0x416614[_0xc90c('0x31')]:_0x1b64d0[_0xc90c('0x30')];if(_0x195224[_0xc90c('0x2c')]['includeAll']){_0x416614[_0xc90c('0x40')]=[{'all':!![]}];}_0x416614=_['merge']({},_0x416614,_0x195224['options']);return db['FreshdeskConfiguration'][_0xc90c('0x41')](_0x416614)[_0xc90c('0x22')](handleEntityNotFound(_0x1028ce,null))[_0xc90c('0x22')](respondWithResult(_0x1028ce,null))[_0xc90c('0x42')](handleError(_0x1028ce,null));};exports[_0xc90c('0x43')]=function(_0x59182c,_0x47e59e){return db['FreshdeskConfiguration'][_0xc90c('0x43')](_0x59182c[_0xc90c('0x44')],{})['then'](respondWithResult(_0x47e59e,0xc9))['catch'](handleError(_0x47e59e,null));};exports['update']=function(_0x5d0019,_0x45305b){if(_0x5d0019[_0xc90c('0x44')]['id']){delete _0x5d0019[_0xc90c('0x44')]['id'];}return db['FreshdeskConfiguration'][_0xc90c('0x41')]({'where':{'id':_0x5d0019[_0xc90c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x45305b,null))[_0xc90c('0x22')](saveUpdates(_0x5d0019[_0xc90c('0x44')],null))[_0xc90c('0x22')](respondWithResult(_0x45305b,null))[_0xc90c('0x42')](handleError(_0x45305b,null));};exports[_0xc90c('0x45')]=function(_0x480577,_0x1d3a8a){return db[_0xc90c('0x3a')][_0xc90c('0x41')]({'where':{'id':_0x480577['params']['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x1d3a8a,null))[_0xc90c('0x22')](removeEntity(_0x1d3a8a,null))[_0xc90c('0x42')](handleError(_0x1d3a8a,null));};exports[_0xc90c('0x46')]=function(_0x10db93,_0x11200d,_0x2d811a){var _0x5a9766={};var _0x2619b9={};var _0x39d84c;var _0xcd3d8b;return db[_0xc90c('0x3a')][_0xc90c('0x47')]({'where':{'id':_0x10db93['params']['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x11200d,null))[_0xc90c('0x22')](function(_0x433648){if(_0x433648){_0x39d84c=_0x433648;_0x2619b9['model']=_[_0xc90c('0x2d')](db['FreshdeskField'][_0xc90c('0x28')]);_0x2619b9[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x10db93['query']);_0x2619b9[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x2619b9[_0xc90c('0x30')],_0x2619b9['query']);_0x5a9766[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x2619b9[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x10db93[_0xc90c('0x2c')][_0xc90c('0x32')]));_0x5a9766[_0xc90c('0x31')]=_0x5a9766['attributes'][_0xc90c('0x3f')]?_0x5a9766['attributes']:_0x2619b9['model'];_0x5a9766['order']=qs[_0xc90c('0x35')](_0x10db93['query'][_0xc90c('0x35')]);_0x5a9766[_0xc90c('0x36')]=qs[_0xc90c('0x2e')](_['pick'](_0x10db93[_0xc90c('0x2c')],_0x2619b9[_0xc90c('0x2e')]));if(_0x10db93[_0xc90c('0x2c')][_0xc90c('0x48')]){_0x5a9766['where']=_[_0xc90c('0x37')](_0x5a9766['where'],{'$or':_[_0xc90c('0x27')](_0x5a9766[_0xc90c('0x31')],function(_0x3eb467){var _0x4e2531={};_0x4e2531[_0x3eb467]={'$like':'%'+_0x10db93[_0xc90c('0x2c')][_0xc90c('0x48')]+'%'};return _0x4e2531;})});}_0x5a9766=_['merge']({},_0x5a9766,_0x10db93[_0xc90c('0x39')]);return _0x39d84c['getFields'](_0x5a9766);}})[_0xc90c('0x22')](function(_0x545e83){if(_0x545e83){_0xcd3d8b=_0x545e83[_0xc90c('0x3f')];if(!_0x10db93['query']['hasOwnProperty'](_0xc90c('0x34'))){_0x5a9766[_0xc90c('0x1c')]=qs[_0xc90c('0x1c')](_0x10db93[_0xc90c('0x2c')]['limit']);_0x5a9766[_0xc90c('0x1b')]=qs['offset'](_0x10db93[_0xc90c('0x2c')][_0xc90c('0x1b')]);}return _0x39d84c[_0xc90c('0x46')](_0x5a9766);}})[_0xc90c('0x22')](function(_0x492972){if(_0x492972){return _0x492972?{'count':_0xcd3d8b,'rows':_0x492972}:null;}})[_0xc90c('0x22')](respondWithResult(_0x11200d,null))[_0xc90c('0x42')](handleError(_0x11200d,null));};exports[_0xc90c('0x49')]=function(_0x14002e,_0x5091ca,_0x2d90e5){var _0x16d860={};var _0x34dede={};var _0xd29323;var _0x15afc5;return db[_0xc90c('0x3a')][_0xc90c('0x47')]({'where':{'id':_0x14002e[_0xc90c('0x3e')]['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x5091ca,null))[_0xc90c('0x22')](function(_0x4de1c6){if(_0x4de1c6){_0xd29323=_0x4de1c6;_0x34dede[_0xc90c('0x30')]=_[_0xc90c('0x2d')](db[_0xc90c('0x4a')]['rawAttributes']);_0x34dede['query']=_[_0xc90c('0x2d')](_0x14002e[_0xc90c('0x2c')]);_0x34dede['filters']=_[_0xc90c('0x2f')](_0x34dede[_0xc90c('0x30')],_0x34dede[_0xc90c('0x2c')]);_0x16d860[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x34dede[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x14002e[_0xc90c('0x2c')][_0xc90c('0x32')]));_0x16d860[_0xc90c('0x31')]=_0x16d860[_0xc90c('0x31')][_0xc90c('0x3f')]?_0x16d860[_0xc90c('0x31')]:_0x34dede['model'];_0x16d860[_0xc90c('0x4b')]=qs[_0xc90c('0x35')](_0x14002e['query'][_0xc90c('0x35')]);_0x16d860[_0xc90c('0x36')]=qs['filters'](_['pick'](_0x14002e[_0xc90c('0x2c')],_0x34dede['filters']));if(_0x14002e[_0xc90c('0x2c')][_0xc90c('0x48')]){_0x16d860[_0xc90c('0x36')]=_['merge'](_0x16d860['where'],{'$or':_['map'](_0x16d860['attributes'],function(_0x37844f){var _0x4ffa26={};_0x4ffa26[_0x37844f]={'$like':'%'+_0x14002e[_0xc90c('0x2c')][_0xc90c('0x48')]+'%'};return _0x4ffa26;})});}_0x16d860=_[_0xc90c('0x37')]({},_0x16d860,_0x14002e[_0xc90c('0x39')]);return _0xd29323[_0xc90c('0x49')](_0x16d860);}})[_0xc90c('0x22')](function(_0x32bae0){if(_0x32bae0){_0x15afc5=_0x32bae0[_0xc90c('0x3f')];if(!_0x14002e['query'][_0xc90c('0x33')](_0xc90c('0x34'))){_0x16d860[_0xc90c('0x1c')]=qs[_0xc90c('0x1c')](_0x14002e[_0xc90c('0x2c')][_0xc90c('0x1c')]);_0x16d860[_0xc90c('0x1b')]=qs[_0xc90c('0x1b')](_0x14002e[_0xc90c('0x2c')][_0xc90c('0x1b')]);}return _0xd29323['getSubjects'](_0x16d860);}})['then'](function(_0x2b60ac){if(_0x2b60ac){return _0x2b60ac?{'count':_0x15afc5,'rows':_0x2b60ac}:null;}})[_0xc90c('0x22')](respondWithResult(_0x5091ca,null))[_0xc90c('0x42')](handleError(_0x5091ca,null));};exports[_0xc90c('0x4c')]=function(_0x4d0493,_0x454791,_0x6c9b09){var _0xac679c={};var _0x1f53d5={};var _0x332433;var _0x5e18b7;return db['FreshdeskConfiguration'][_0xc90c('0x47')]({'where':{'id':_0x4d0493[_0xc90c('0x3e')]['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x454791,null))[_0xc90c('0x22')](function(_0x218227){if(_0x218227){_0x332433=_0x218227;_0x1f53d5[_0xc90c('0x30')]=_[_0xc90c('0x2d')](db['FreshdeskField']['rawAttributes']);_0x1f53d5[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x4d0493[_0xc90c('0x2c')]);_0x1f53d5[_0xc90c('0x2e')]=_['intersection'](_0x1f53d5[_0xc90c('0x30')],_0x1f53d5['query']);_0xac679c['attributes']=_['intersection'](_0x1f53d5[_0xc90c('0x30')],qs['fields'](_0x4d0493['query']['fields']));_0xac679c[_0xc90c('0x31')]=_0xac679c[_0xc90c('0x31')][_0xc90c('0x3f')]?_0xac679c['attributes']:_0x1f53d5['model'];_0xac679c[_0xc90c('0x4b')]=qs[_0xc90c('0x35')](_0x4d0493[_0xc90c('0x2c')][_0xc90c('0x35')]);_0xac679c['where']=qs[_0xc90c('0x2e')](_[_0xc90c('0x4d')](_0x4d0493[_0xc90c('0x2c')],_0x1f53d5[_0xc90c('0x2e')]));if(_0x4d0493[_0xc90c('0x2c')]['filter']){_0xac679c[_0xc90c('0x36')]=_[_0xc90c('0x37')](_0xac679c[_0xc90c('0x36')],{'$or':_['map'](_0xac679c[_0xc90c('0x31')],function(_0x3ffc3f){var _0x1b62d9={};_0x1b62d9[_0x3ffc3f]={'$like':'%'+_0x4d0493['query'][_0xc90c('0x48')]+'%'};return _0x1b62d9;})});}_0xac679c=_[_0xc90c('0x37')]({},_0xac679c,_0x4d0493['options']);return _0x332433[_0xc90c('0x4c')](_0xac679c);}})[_0xc90c('0x22')](function(_0x3624c6){if(_0x3624c6){_0x5e18b7=_0x3624c6[_0xc90c('0x3f')];if(!_0x4d0493[_0xc90c('0x2c')][_0xc90c('0x33')](_0xc90c('0x34'))){_0xac679c[_0xc90c('0x1c')]=qs[_0xc90c('0x1c')](_0x4d0493[_0xc90c('0x2c')]['limit']);_0xac679c['offset']=qs['offset'](_0x4d0493[_0xc90c('0x2c')]['offset']);}return _0x332433[_0xc90c('0x4c')](_0xac679c);}})[_0xc90c('0x22')](function(_0x40b62d){if(_0x40b62d){return _0x40b62d?{'count':_0x5e18b7,'rows':_0x40b62d}:null;}})['then'](respondWithResult(_0x454791,null))[_0xc90c('0x42')](handleError(_0x454791,null));};exports[_0xc90c('0x4e')]=function(_0x51a83d,_0x5d15c4,_0x41aba5){var _0xa9c026={};var _0x3040a1={};var _0x757376;var _0x1273c7;return db[_0xc90c('0x3a')][_0xc90c('0x47')]({'where':{'id':_0x51a83d['params']['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x5d15c4,null))[_0xc90c('0x22')](function(_0x1d78ce){if(_0x1d78ce){_0x757376=_0x1d78ce;_0x3040a1[_0xc90c('0x30')]=_[_0xc90c('0x2d')](db[_0xc90c('0x4f')][_0xc90c('0x28')]);_0x3040a1['query']=_[_0xc90c('0x2d')](_0x51a83d['query']);_0x3040a1[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x3040a1['model'],_0x3040a1[_0xc90c('0x2c')]);_0xa9c026[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x3040a1[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x32')]));_0xa9c026['attributes']=_0xa9c026[_0xc90c('0x31')]['length']?_0xa9c026['attributes']:_0x3040a1[_0xc90c('0x30')];_0xa9c026[_0xc90c('0x4b')]=qs['sort'](_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x35')]);_0xa9c026['where']=qs[_0xc90c('0x2e')](_[_0xc90c('0x4d')](_0x51a83d[_0xc90c('0x2c')],_0x3040a1['filters']));if(_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x48')]){_0xa9c026[_0xc90c('0x36')]=_[_0xc90c('0x37')](_0xa9c026[_0xc90c('0x36')],{'$or':_['map'](_0xa9c026[_0xc90c('0x31')],function(_0x17d235){var _0x4933ee={};_0x4933ee[_0x17d235]={'$like':'%'+_0x51a83d['query'][_0xc90c('0x48')]+'%'};return _0x4933ee;})});}_0xa9c026=_[_0xc90c('0x37')]({},_0xa9c026,_0x51a83d[_0xc90c('0x39')]);return _0x757376[_0xc90c('0x4e')](_0xa9c026);}})[_0xc90c('0x22')](function(_0x2a19e5){if(_0x2a19e5){_0x1273c7=_0x2a19e5['length'];if(!_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x33')](_0xc90c('0x34'))){_0xa9c026['limit']=qs['limit'](_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x1c')]);_0xa9c026['offset']=qs['offset'](_0x51a83d['query'][_0xc90c('0x1b')]);}return _0x757376['getTags'](_0xa9c026);}})[_0xc90c('0x22')](function(_0x118fcd){if(_0x118fcd){return _0x118fcd?{'count':_0x1273c7,'rows':_0x118fcd}:null;}})[_0xc90c('0x22')](respondWithResult(_0x5d15c4,null))[_0xc90c('0x42')](handleError(_0x5d15c4,null));};exports['setTags']=function(_0xcbaf3b,_0x23867f,_0x377ea5){if(_0xcbaf3b[_0xc90c('0x44')]['id']){delete _0xcbaf3b[_0xc90c('0x44')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xcbaf3b[_0xc90c('0x3e')]['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x23867f,null))['then'](function(_0x31ee72){if(_0x31ee72){return _0x31ee72[_0xc90c('0x50')](_0xcbaf3b[_0xc90c('0x44')]['ids']||[]);}return null;})[_0xc90c('0x22')](respondWithResult(_0x23867f,null))[_0xc90c('0x42')](handleError(_0x23867f,null));}; \ No newline at end of file +var _0xdc6b=['type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','catch','params','include','create','body','find','getFields','findOne','FreshdeskField','getSubjects','pick','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','FreshdeskConfiguration','rawAttributes'];(function(_0xef5b89,_0x567165){var _0x383050=function(_0x256cec){while(--_0x256cec){_0xef5b89['push'](_0xef5b89['shift']());}};_0x383050(++_0x567165);}(_0xdc6b,0x75));var _0xbdc6=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xdc6b[_0x1dd532];return _0x3732aa;};'use strict';var emlformat=require(_0xbdc6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdc6('0x1'));var jsonpatch=require(_0xbdc6('0x2'));var rp=require(_0xbdc6('0x3'));var moment=require(_0xbdc6('0x4'));var BPromise=require(_0xbdc6('0x5'));var Mustache=require(_0xbdc6('0x6'));var util=require('util');var path=require(_0xbdc6('0x7'));var sox=require(_0xbdc6('0x8'));var csv=require(_0xbdc6('0x9'));var ejs=require(_0xbdc6('0xa'));var fs=require('fs');var fs_extra=require(_0xbdc6('0xb'));var _=require('lodash');var squel=require(_0xbdc6('0xc'));var crypto=require(_0xbdc6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbdc6('0x9'));var querystring=require(_0xbdc6('0xe'));var Papa=require(_0xbdc6('0xf'));var Redis=require(_0xbdc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbdc6('0x11'));var as=require(_0xbdc6('0x12'));var hardwareService=require(_0xbdc6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbdc6('0x14'));var config=require(_0xbdc6('0x15'));var licenseUtil=require(_0xbdc6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f557d,_0x575357){_0x575357=_0x575357||0xcc;return function(_0x187040){if(_0x187040){return _0x4f557d[_0xbdc6('0x17')](_0x575357);}return _0x4f557d['status'](_0x575357)['end']();};}function respondWithResult(_0xe8b81c,_0x4ba26d){_0x4ba26d=_0x4ba26d||0xc8;return function(_0x2940dd){if(_0x2940dd){return _0xe8b81c[_0xbdc6('0x18')](_0x4ba26d)['json'](_0x2940dd);}};}function respondWithFilteredResult(_0x5c7bf8,_0x4b373a){return function(_0x330978){if(_0x330978){var _0x3eda11=typeof _0x4b373a[_0xbdc6('0x19')]===_0xbdc6('0x1a')&&typeof _0x4b373a[_0xbdc6('0x1b')]===_0xbdc6('0x1a');var _0x247796=_0x330978[_0xbdc6('0x1c')];var _0x731a3b=_0x3eda11?0x0:_0x4b373a[_0xbdc6('0x19')];var _0xc993a=_0x3eda11?_0x330978[_0xbdc6('0x1c')]:_0x4b373a[_0xbdc6('0x19')]+_0x4b373a[_0xbdc6('0x1b')];var _0x12c0cb;if(_0xc993a>=_0x247796){_0xc993a=_0x247796;_0x12c0cb=0xc8;}else{_0x12c0cb=0xce;}_0x5c7bf8[_0xbdc6('0x18')](_0x12c0cb);return _0x5c7bf8[_0xbdc6('0x1d')](_0xbdc6('0x1e'),_0x731a3b+'-'+_0xc993a+'/'+_0x247796)[_0xbdc6('0x1f')](_0x330978);}return null;};}function patchUpdates(_0x5de84f){return function(_0x42d44a){try{jsonpatch[_0xbdc6('0x20')](_0x42d44a,_0x5de84f,!![]);}catch(_0x476885){return BPromise[_0xbdc6('0x21')](_0x476885);}return _0x42d44a[_0xbdc6('0x22')]();};}function saveUpdates(_0x5f0aac,_0x2ca5da){return function(_0x4adfc9){if(_0x4adfc9){return _0x4adfc9[_0xbdc6('0x23')](_0x5f0aac)[_0xbdc6('0x24')](function(_0x54dbed){return _0x54dbed;});}return null;};}function removeEntity(_0x53d708,_0x1f1764){return function(_0x1a4abb){if(_0x1a4abb){return _0x1a4abb[_0xbdc6('0x25')]()[_0xbdc6('0x24')](function(){_0x53d708[_0xbdc6('0x18')](0xcc)[_0xbdc6('0x26')]();});}};}function handleEntityNotFound(_0x1aa943,_0x3e5165){return function(_0x2b2e5c){if(!_0x2b2e5c){_0x1aa943['sendStatus'](0x194);}return _0x2b2e5c;};}function handleError(_0x57c7e0,_0x907b1){_0x907b1=_0x907b1||0x1f4;return function(_0x4ca64e){logger['error'](_0x4ca64e[_0xbdc6('0x27')]);if(_0x4ca64e[_0xbdc6('0x28')]){delete _0x4ca64e['name'];}_0x57c7e0[_0xbdc6('0x18')](_0x907b1)[_0xbdc6('0x29')](_0x4ca64e);};}exports['index']=function(_0x330fed,_0x43c210){var _0x59f8b7={},_0xdb6a4b={},_0x38e001={'count':0x0,'rows':[]};var _0x3d173a=_[_0xbdc6('0x2a')](db[_0xbdc6('0x2b')][_0xbdc6('0x2c')],function(_0x49afc8){return{'name':_0x49afc8['fieldName'],'type':_0x49afc8[_0xbdc6('0x2d')][_0xbdc6('0x2e')]};});_0xdb6a4b['model']=_[_0xbdc6('0x2a')](_0x3d173a,_0xbdc6('0x28'));_0xdb6a4b[_0xbdc6('0x2f')]=_[_0xbdc6('0x30')](_0x330fed[_0xbdc6('0x2f')]);_0xdb6a4b[_0xbdc6('0x31')]=_[_0xbdc6('0x32')](_0xdb6a4b[_0xbdc6('0x33')],_0xdb6a4b[_0xbdc6('0x2f')]);_0x59f8b7['attributes']=_[_0xbdc6('0x32')](_0xdb6a4b[_0xbdc6('0x33')],qs['fields'](_0x330fed[_0xbdc6('0x2f')][_0xbdc6('0x34')]));_0x59f8b7['attributes']=_0x59f8b7[_0xbdc6('0x35')][_0xbdc6('0x36')]?_0x59f8b7['attributes']:_0xdb6a4b[_0xbdc6('0x33')];if(!_0x330fed['query']['hasOwnProperty'](_0xbdc6('0x37'))){_0x59f8b7[_0xbdc6('0x1b')]=qs[_0xbdc6('0x1b')](_0x330fed[_0xbdc6('0x2f')][_0xbdc6('0x1b')]);_0x59f8b7[_0xbdc6('0x19')]=qs[_0xbdc6('0x19')](_0x330fed[_0xbdc6('0x2f')][_0xbdc6('0x19')]);}_0x59f8b7[_0xbdc6('0x38')]=qs[_0xbdc6('0x39')](_0x330fed[_0xbdc6('0x2f')][_0xbdc6('0x39')]);_0x59f8b7[_0xbdc6('0x3a')]=qs['filters'](_['pick'](_0x330fed[_0xbdc6('0x2f')],_0xdb6a4b['filters']),_0x3d173a);if(_0x330fed[_0xbdc6('0x2f')][_0xbdc6('0x3b')]){_0x59f8b7[_0xbdc6('0x3a')]=_['merge'](_0x59f8b7[_0xbdc6('0x3a')],{'$or':_[_0xbdc6('0x2a')](_0x3d173a,function(_0x39b850){if(_0x39b850[_0xbdc6('0x2d')]!==_0xbdc6('0x3c')){var _0x1bb942={};_0x1bb942[_0x39b850[_0xbdc6('0x28')]]={'$like':'%'+_0x330fed[_0xbdc6('0x2f')][_0xbdc6('0x3b')]+'%'};return _0x1bb942;}})});}_0x59f8b7=_[_0xbdc6('0x3d')]({},_0x59f8b7,_0x330fed[_0xbdc6('0x3e')]);var _0x4ab804={'where':_0x59f8b7[_0xbdc6('0x3a')]};return db[_0xbdc6('0x2b')][_0xbdc6('0x1c')](_0x4ab804)[_0xbdc6('0x24')](function(_0x5371d1){_0x38e001[_0xbdc6('0x1c')]=_0x5371d1;if(_0x330fed[_0xbdc6('0x2f')][_0xbdc6('0x3f')]){_0x59f8b7['include']=[{'all':!![]}];}return db[_0xbdc6('0x2b')]['findAll'](_0x59f8b7);})[_0xbdc6('0x24')](function(_0x57ed47){_0x38e001['rows']=_0x57ed47;return _0x38e001;})[_0xbdc6('0x24')](respondWithFilteredResult(_0x43c210,_0x59f8b7))[_0xbdc6('0x40')](handleError(_0x43c210,null));};exports['show']=function(_0x74288,_0x373a92){var _0x21da9d={'raw':![],'where':{'id':_0x74288[_0xbdc6('0x41')]['id']}},_0xda4b09={};_0xda4b09[_0xbdc6('0x33')]=_[_0xbdc6('0x30')](db[_0xbdc6('0x2b')][_0xbdc6('0x2c')]);_0xda4b09[_0xbdc6('0x2f')]=_[_0xbdc6('0x30')](_0x74288[_0xbdc6('0x2f')]);_0xda4b09[_0xbdc6('0x31')]=_[_0xbdc6('0x32')](_0xda4b09[_0xbdc6('0x33')],_0xda4b09[_0xbdc6('0x2f')]);_0x21da9d[_0xbdc6('0x35')]=_[_0xbdc6('0x32')](_0xda4b09[_0xbdc6('0x33')],qs[_0xbdc6('0x34')](_0x74288[_0xbdc6('0x2f')][_0xbdc6('0x34')]));_0x21da9d['attributes']=_0x21da9d['attributes'][_0xbdc6('0x36')]?_0x21da9d[_0xbdc6('0x35')]:_0xda4b09[_0xbdc6('0x33')];if(_0x74288[_0xbdc6('0x2f')]['includeAll']){_0x21da9d[_0xbdc6('0x42')]=[{'all':!![]}];}_0x21da9d=_[_0xbdc6('0x3d')]({},_0x21da9d,_0x74288['options']);return db[_0xbdc6('0x2b')]['find'](_0x21da9d)[_0xbdc6('0x24')](handleEntityNotFound(_0x373a92,null))[_0xbdc6('0x24')](respondWithResult(_0x373a92,null))[_0xbdc6('0x40')](handleError(_0x373a92,null));};exports[_0xbdc6('0x43')]=function(_0x171db9,_0x5ef677){return db[_0xbdc6('0x2b')][_0xbdc6('0x43')](_0x171db9[_0xbdc6('0x44')],{})[_0xbdc6('0x24')](respondWithResult(_0x5ef677,0xc9))[_0xbdc6('0x40')](handleError(_0x5ef677,null));};exports[_0xbdc6('0x23')]=function(_0x112c77,_0x251d54){if(_0x112c77[_0xbdc6('0x44')]['id']){delete _0x112c77[_0xbdc6('0x44')]['id'];}return db[_0xbdc6('0x2b')][_0xbdc6('0x45')]({'where':{'id':_0x112c77[_0xbdc6('0x41')]['id']}})['then'](handleEntityNotFound(_0x251d54,null))[_0xbdc6('0x24')](saveUpdates(_0x112c77['body'],null))[_0xbdc6('0x24')](respondWithResult(_0x251d54,null))[_0xbdc6('0x40')](handleError(_0x251d54,null));};exports['destroy']=function(_0x107ebf,_0x1b10c6){return db[_0xbdc6('0x2b')]['find']({'where':{'id':_0x107ebf[_0xbdc6('0x41')]['id']}})[_0xbdc6('0x24')](handleEntityNotFound(_0x1b10c6,null))['then'](removeEntity(_0x1b10c6,null))['catch'](handleError(_0x1b10c6,null));};exports[_0xbdc6('0x46')]=function(_0x2657cf,_0x87ac7f,_0x138461){var _0x2740a5={};var _0xd07fe6={};var _0x597746;var _0x45951c;return db[_0xbdc6('0x2b')][_0xbdc6('0x47')]({'where':{'id':_0x2657cf[_0xbdc6('0x41')]['id']}})[_0xbdc6('0x24')](handleEntityNotFound(_0x87ac7f,null))[_0xbdc6('0x24')](function(_0x4cc465){if(_0x4cc465){_0x597746=_0x4cc465;_0xd07fe6['model']=_['keys'](db[_0xbdc6('0x48')][_0xbdc6('0x2c')]);_0xd07fe6['query']=_[_0xbdc6('0x30')](_0x2657cf[_0xbdc6('0x2f')]);_0xd07fe6['filters']=_[_0xbdc6('0x32')](_0xd07fe6[_0xbdc6('0x33')],_0xd07fe6[_0xbdc6('0x2f')]);_0x2740a5[_0xbdc6('0x35')]=_[_0xbdc6('0x32')](_0xd07fe6[_0xbdc6('0x33')],qs[_0xbdc6('0x34')](_0x2657cf['query'][_0xbdc6('0x34')]));_0x2740a5[_0xbdc6('0x35')]=_0x2740a5[_0xbdc6('0x35')]['length']?_0x2740a5['attributes']:_0xd07fe6['model'];_0x2740a5['order']=qs[_0xbdc6('0x39')](_0x2657cf[_0xbdc6('0x2f')]['sort']);_0x2740a5['where']=qs[_0xbdc6('0x31')](_['pick'](_0x2657cf['query'],_0xd07fe6[_0xbdc6('0x31')]));if(_0x2657cf['query']['filter']){_0x2740a5[_0xbdc6('0x3a')]=_[_0xbdc6('0x3d')](_0x2740a5[_0xbdc6('0x3a')],{'$or':_[_0xbdc6('0x2a')](_0x2740a5[_0xbdc6('0x35')],function(_0x72fcf){var _0x517085={};_0x517085[_0x72fcf]={'$like':'%'+_0x2657cf[_0xbdc6('0x2f')][_0xbdc6('0x3b')]+'%'};return _0x517085;})});}_0x2740a5=_[_0xbdc6('0x3d')]({},_0x2740a5,_0x2657cf[_0xbdc6('0x3e')]);return _0x597746[_0xbdc6('0x46')](_0x2740a5);}})['then'](function(_0x594a77){if(_0x594a77){_0x45951c=_0x594a77[_0xbdc6('0x36')];if(!_0x2657cf[_0xbdc6('0x2f')]['hasOwnProperty'](_0xbdc6('0x37'))){_0x2740a5[_0xbdc6('0x1b')]=qs['limit'](_0x2657cf['query'][_0xbdc6('0x1b')]);_0x2740a5['offset']=qs['offset'](_0x2657cf['query'][_0xbdc6('0x19')]);}return _0x597746[_0xbdc6('0x46')](_0x2740a5);}})[_0xbdc6('0x24')](function(_0x36031a){if(_0x36031a){return _0x36031a?{'count':_0x45951c,'rows':_0x36031a}:null;}})['then'](respondWithResult(_0x87ac7f,null))[_0xbdc6('0x40')](handleError(_0x87ac7f,null));};exports[_0xbdc6('0x49')]=function(_0x18101d,_0x11446a,_0x425e77){var _0xd1b11d={};var _0x593d98={};var _0x2aa924;var _0x35ad5c;return db[_0xbdc6('0x2b')][_0xbdc6('0x47')]({'where':{'id':_0x18101d['params']['id']}})[_0xbdc6('0x24')](handleEntityNotFound(_0x11446a,null))['then'](function(_0x1c2bbf){if(_0x1c2bbf){_0x2aa924=_0x1c2bbf;_0x593d98['model']=_[_0xbdc6('0x30')](db[_0xbdc6('0x48')][_0xbdc6('0x2c')]);_0x593d98[_0xbdc6('0x2f')]=_[_0xbdc6('0x30')](_0x18101d['query']);_0x593d98[_0xbdc6('0x31')]=_['intersection'](_0x593d98[_0xbdc6('0x33')],_0x593d98[_0xbdc6('0x2f')]);_0xd1b11d[_0xbdc6('0x35')]=_[_0xbdc6('0x32')](_0x593d98[_0xbdc6('0x33')],qs[_0xbdc6('0x34')](_0x18101d[_0xbdc6('0x2f')][_0xbdc6('0x34')]));_0xd1b11d[_0xbdc6('0x35')]=_0xd1b11d[_0xbdc6('0x35')][_0xbdc6('0x36')]?_0xd1b11d[_0xbdc6('0x35')]:_0x593d98[_0xbdc6('0x33')];_0xd1b11d[_0xbdc6('0x38')]=qs[_0xbdc6('0x39')](_0x18101d[_0xbdc6('0x2f')][_0xbdc6('0x39')]);_0xd1b11d['where']=qs[_0xbdc6('0x31')](_[_0xbdc6('0x4a')](_0x18101d[_0xbdc6('0x2f')],_0x593d98[_0xbdc6('0x31')]));if(_0x18101d['query'][_0xbdc6('0x3b')]){_0xd1b11d[_0xbdc6('0x3a')]=_['merge'](_0xd1b11d['where'],{'$or':_['map'](_0xd1b11d['attributes'],function(_0x515b0a){var _0x30c6d9={};_0x30c6d9[_0x515b0a]={'$like':'%'+_0x18101d[_0xbdc6('0x2f')]['filter']+'%'};return _0x30c6d9;})});}_0xd1b11d=_['merge']({},_0xd1b11d,_0x18101d[_0xbdc6('0x3e')]);return _0x2aa924[_0xbdc6('0x49')](_0xd1b11d);}})[_0xbdc6('0x24')](function(_0x445640){if(_0x445640){_0x35ad5c=_0x445640[_0xbdc6('0x36')];if(!_0x18101d['query'][_0xbdc6('0x4b')](_0xbdc6('0x37'))){_0xd1b11d[_0xbdc6('0x1b')]=qs[_0xbdc6('0x1b')](_0x18101d[_0xbdc6('0x2f')]['limit']);_0xd1b11d['offset']=qs[_0xbdc6('0x19')](_0x18101d[_0xbdc6('0x2f')][_0xbdc6('0x19')]);}return _0x2aa924[_0xbdc6('0x49')](_0xd1b11d);}})[_0xbdc6('0x24')](function(_0xcd00e9){if(_0xcd00e9){return _0xcd00e9?{'count':_0x35ad5c,'rows':_0xcd00e9}:null;}})[_0xbdc6('0x24')](respondWithResult(_0x11446a,null))[_0xbdc6('0x40')](handleError(_0x11446a,null));};exports[_0xbdc6('0x4c')]=function(_0x192dfb,_0xc2829e,_0x3a29a7){var _0x165da5={};var _0x2f42d8={};var _0x11a6c5;var _0x350606;return db[_0xbdc6('0x2b')][_0xbdc6('0x47')]({'where':{'id':_0x192dfb[_0xbdc6('0x41')]['id']}})['then'](handleEntityNotFound(_0xc2829e,null))[_0xbdc6('0x24')](function(_0x22f930){if(_0x22f930){_0x11a6c5=_0x22f930;_0x2f42d8['model']=_[_0xbdc6('0x30')](db[_0xbdc6('0x48')][_0xbdc6('0x2c')]);_0x2f42d8[_0xbdc6('0x2f')]=_[_0xbdc6('0x30')](_0x192dfb[_0xbdc6('0x2f')]);_0x2f42d8[_0xbdc6('0x31')]=_[_0xbdc6('0x32')](_0x2f42d8['model'],_0x2f42d8[_0xbdc6('0x2f')]);_0x165da5[_0xbdc6('0x35')]=_[_0xbdc6('0x32')](_0x2f42d8[_0xbdc6('0x33')],qs[_0xbdc6('0x34')](_0x192dfb[_0xbdc6('0x2f')][_0xbdc6('0x34')]));_0x165da5['attributes']=_0x165da5['attributes'][_0xbdc6('0x36')]?_0x165da5[_0xbdc6('0x35')]:_0x2f42d8['model'];_0x165da5['order']=qs[_0xbdc6('0x39')](_0x192dfb[_0xbdc6('0x2f')][_0xbdc6('0x39')]);_0x165da5[_0xbdc6('0x3a')]=qs[_0xbdc6('0x31')](_[_0xbdc6('0x4a')](_0x192dfb['query'],_0x2f42d8[_0xbdc6('0x31')]));if(_0x192dfb['query'][_0xbdc6('0x3b')]){_0x165da5['where']=_[_0xbdc6('0x3d')](_0x165da5[_0xbdc6('0x3a')],{'$or':_[_0xbdc6('0x2a')](_0x165da5[_0xbdc6('0x35')],function(_0x1dc608){var _0x5a9588={};_0x5a9588[_0x1dc608]={'$like':'%'+_0x192dfb[_0xbdc6('0x2f')][_0xbdc6('0x3b')]+'%'};return _0x5a9588;})});}_0x165da5=_[_0xbdc6('0x3d')]({},_0x165da5,_0x192dfb[_0xbdc6('0x3e')]);return _0x11a6c5[_0xbdc6('0x4c')](_0x165da5);}})['then'](function(_0x4f670b){if(_0x4f670b){_0x350606=_0x4f670b[_0xbdc6('0x36')];if(!_0x192dfb[_0xbdc6('0x2f')][_0xbdc6('0x4b')]('nolimit')){_0x165da5[_0xbdc6('0x1b')]=qs['limit'](_0x192dfb[_0xbdc6('0x2f')][_0xbdc6('0x1b')]);_0x165da5[_0xbdc6('0x19')]=qs[_0xbdc6('0x19')](_0x192dfb['query']['offset']);}return _0x11a6c5['getDescriptions'](_0x165da5);}})[_0xbdc6('0x24')](function(_0x45bcb9){if(_0x45bcb9){return _0x45bcb9?{'count':_0x350606,'rows':_0x45bcb9}:null;}})[_0xbdc6('0x24')](respondWithResult(_0xc2829e,null))[_0xbdc6('0x40')](handleError(_0xc2829e,null));};exports[_0xbdc6('0x4d')]=function(_0x4d13ad,_0x4c6068,_0x3d34ce){var _0x414ba2={};var _0x35686f={};var _0x27c968;var _0x1f2f6a;return db['FreshdeskConfiguration'][_0xbdc6('0x47')]({'where':{'id':_0x4d13ad[_0xbdc6('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c6068,null))['then'](function(_0x514e67){if(_0x514e67){_0x27c968=_0x514e67;_0x35686f[_0xbdc6('0x33')]=_[_0xbdc6('0x30')](db[_0xbdc6('0x4e')][_0xbdc6('0x2c')]);_0x35686f[_0xbdc6('0x2f')]=_[_0xbdc6('0x30')](_0x4d13ad['query']);_0x35686f[_0xbdc6('0x31')]=_[_0xbdc6('0x32')](_0x35686f['model'],_0x35686f[_0xbdc6('0x2f')]);_0x414ba2[_0xbdc6('0x35')]=_[_0xbdc6('0x32')](_0x35686f[_0xbdc6('0x33')],qs['fields'](_0x4d13ad[_0xbdc6('0x2f')]['fields']));_0x414ba2[_0xbdc6('0x35')]=_0x414ba2['attributes'][_0xbdc6('0x36')]?_0x414ba2[_0xbdc6('0x35')]:_0x35686f[_0xbdc6('0x33')];_0x414ba2[_0xbdc6('0x38')]=qs[_0xbdc6('0x39')](_0x4d13ad['query']['sort']);_0x414ba2[_0xbdc6('0x3a')]=qs[_0xbdc6('0x31')](_[_0xbdc6('0x4a')](_0x4d13ad[_0xbdc6('0x2f')],_0x35686f['filters']));if(_0x4d13ad['query'][_0xbdc6('0x3b')]){_0x414ba2[_0xbdc6('0x3a')]=_[_0xbdc6('0x3d')](_0x414ba2[_0xbdc6('0x3a')],{'$or':_[_0xbdc6('0x2a')](_0x414ba2[_0xbdc6('0x35')],function(_0x2ccb39){var _0x3f5371={};_0x3f5371[_0x2ccb39]={'$like':'%'+_0x4d13ad[_0xbdc6('0x2f')][_0xbdc6('0x3b')]+'%'};return _0x3f5371;})});}_0x414ba2=_['merge']({},_0x414ba2,_0x4d13ad[_0xbdc6('0x3e')]);return _0x27c968[_0xbdc6('0x4d')](_0x414ba2);}})[_0xbdc6('0x24')](function(_0x38b595){if(_0x38b595){_0x1f2f6a=_0x38b595[_0xbdc6('0x36')];if(!_0x4d13ad[_0xbdc6('0x2f')]['hasOwnProperty'](_0xbdc6('0x37'))){_0x414ba2['limit']=qs[_0xbdc6('0x1b')](_0x4d13ad[_0xbdc6('0x2f')][_0xbdc6('0x1b')]);_0x414ba2[_0xbdc6('0x19')]=qs[_0xbdc6('0x19')](_0x4d13ad[_0xbdc6('0x2f')][_0xbdc6('0x19')]);}return _0x27c968['getTags'](_0x414ba2);}})[_0xbdc6('0x24')](function(_0x5ca002){if(_0x5ca002){return _0x5ca002?{'count':_0x1f2f6a,'rows':_0x5ca002}:null;}})[_0xbdc6('0x24')](respondWithResult(_0x4c6068,null))['catch'](handleError(_0x4c6068,null));};exports[_0xbdc6('0x4f')]=function(_0x35e397,_0x3e9c2e,_0x4c79ce){if(_0x35e397['body']['id']){delete _0x35e397[_0xbdc6('0x44')]['id'];}return db[_0xbdc6('0x2b')]['findOne']({'where':{'id':_0x35e397[_0xbdc6('0x41')]['id']}})[_0xbdc6('0x24')](handleEntityNotFound(_0x3e9c2e,null))[_0xbdc6('0x24')](function(_0xe35c8c){if(_0xe35c8c){return _0xe35c8c[_0xbdc6('0x4f')](_0x35e397['body'][_0xbdc6('0x50')]||[]);}return null;})[_0xbdc6('0x24')](respondWithResult(_0x3e9c2e,null))['catch'](handleError(_0x3e9c2e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 63bb600..59445f6 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 _0x10aa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x5a8269,_0xfb2f54){var _0x539ed7=function(_0x31ce98){while(--_0x31ce98){_0x5a8269['push'](_0x5a8269['shift']());}};_0x539ed7(++_0xfb2f54);}(_0x10aa,0x8c));var _0xa10a=function(_0x16c121,_0x544d17){_0x16c121=_0x16c121-0x0;var _0x5a9e7d=_0x10aa[_0x16c121];return _0x5a9e7d;};'use strict';var _=require(_0xa10a('0x0'));var util=require(_0xa10a('0x1'));var logger=require(_0xa10a('0x2'))('api');var moment=require(_0xa10a('0x3'));var BPromise=require(_0xa10a('0x4'));var rp=require(_0xa10a('0x5'));var fs=require('fs');var path=require(_0xa10a('0x6'));var rimraf=require(_0xa10a('0x7'));var config=require(_0xa10a('0x8'));var attributes=require(_0xa10a('0x9'));module['exports']=function(_0x2951c9,_0xca0eae){return _0x2951c9[_0xa10a('0xa')](_0xa10a('0xb'),attributes,{'tableName':_0xa10a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39a9=['rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x349bb5,_0x32a7ef){var _0x15c91a=function(_0x18664a){while(--_0x18664a){_0x349bb5['push'](_0x349bb5['shift']());}};_0x15c91a(++_0x32a7ef);}(_0x39a9,0xd2));var _0x939a=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x39a9[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var logger=require(_0x939a('0x2'))(_0x939a('0x3'));var moment=require('moment');var BPromise=require(_0x939a('0x4'));var rp=require(_0x939a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x939a('0x6'));var config=require('../../config/environment');var attributes=require(_0x939a('0x7'));module[_0x939a('0x8')]=function(_0x1756cf,_0x31ae9a){return _0x1756cf[_0x939a('0x9')](_0x939a('0xa'),attributes,{'tableName':_0x939a('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 6be257f..e511cc4 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 _0xbd68=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0xbd68,0x133));var _0x8bd6=function(_0x2b2d47,_0x1e1d5e){_0x2b2d47=_0x2b2d47-0x0;var _0x3e2be7=_0xbd68[_0x2b2d47];return _0x3e2be7;};'use strict';var _=require(_0x8bd6('0x0'));var util=require('util');var moment=require(_0x8bd6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bd6('0x2'));var db=require(_0x8bd6('0x3'))['db'];var utils=require(_0x8bd6('0x4'));var logger=require(_0x8bd6('0x5'))(_0x8bd6('0x6'));var config=require(_0x8bd6('0x7'));var jayson=require(_0x8bd6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x370181,_0x47de89,_0x4e4afc){return new BPromise(function(_0x1c289c,_0x1eeb5f){return client['request'](_0x370181,_0x4e4afc)[_0x8bd6('0x9')](function(_0x50413c){logger['info'](_0x8bd6('0xa'),_0x47de89,_0x8bd6('0xb'));logger[_0x8bd6('0xc')](_0x8bd6('0xd'),_0x47de89,_0x8bd6('0xb'),JSON[_0x8bd6('0xe')](_0x50413c));if(_0x50413c['error']){if(_0x50413c[_0x8bd6('0xf')][_0x8bd6('0x10')]===0x1f4){logger['error'](_0x8bd6('0xa'),_0x47de89,_0x50413c['error']['message']);return _0x1eeb5f(_0x50413c['error'][_0x8bd6('0x11')]);}logger[_0x8bd6('0xf')](_0x8bd6('0xa'),_0x47de89,_0x50413c['error'][_0x8bd6('0x11')]);return _0x1c289c(_0x50413c[_0x8bd6('0xf')][_0x8bd6('0x11')]);}else{logger[_0x8bd6('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x47de89,_0x8bd6('0xb'));_0x1c289c(_0x50413c['result']['message']);}})[_0x8bd6('0x13')](function(_0xbeb838){logger['error'](_0x8bd6('0xa'),_0x47de89,_0xbeb838);_0x1eeb5f(_0xbeb838);});});} \ No newline at end of file +var _0xb7db=['message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x49ccaa,_0x5944f2){var _0x2c1ae1=function(_0x3e02b8){while(--_0x3e02b8){_0x49ccaa['push'](_0x49ccaa['shift']());}};_0x2c1ae1(++_0x5944f2);}(_0xb7db,0x115));var _0xbb7d=function(_0x1813b8,_0x133b5a){_0x1813b8=_0x1813b8-0x0;var _0x2f52ba=_0xb7db[_0x1813b8];return _0x2f52ba;};'use strict';var _=require(_0xbb7d('0x0'));var util=require(_0xbb7d('0x1'));var moment=require(_0xbb7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb7d('0x3'));var db=require(_0xbb7d('0x4'))['db'];var utils=require(_0xbb7d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbb7d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbb7d('0x7')][_0xbb7d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f30d9,_0x995731,_0x3c83a1){return new BPromise(function(_0x22ee6b,_0x2bb06a){return client[_0xbb7d('0x9')](_0x1f30d9,_0x3c83a1)[_0xbb7d('0xa')](function(_0x6b1b6e){logger['info'](_0xbb7d('0xb'),_0x995731,_0xbb7d('0xc'));logger[_0xbb7d('0xd')](_0xbb7d('0xe'),_0x995731,'request\x20sent',JSON[_0xbb7d('0xf')](_0x6b1b6e));if(_0x6b1b6e[_0xbb7d('0x10')]){if(_0x6b1b6e[_0xbb7d('0x10')]['code']===0x1f4){logger[_0xbb7d('0x10')](_0xbb7d('0xb'),_0x995731,_0x6b1b6e[_0xbb7d('0x10')][_0xbb7d('0x11')]);return _0x2bb06a(_0x6b1b6e['error'][_0xbb7d('0x11')]);}logger['error'](_0xbb7d('0xb'),_0x995731,_0x6b1b6e[_0xbb7d('0x10')][_0xbb7d('0x11')]);return _0x22ee6b(_0x6b1b6e[_0xbb7d('0x10')][_0xbb7d('0x11')]);}else{logger[_0xbb7d('0x12')](_0xbb7d('0xb'),_0x995731,_0xbb7d('0xc'));_0x22ee6b(_0x6b1b6e[_0xbb7d('0x13')][_0xbb7d('0x11')]);}})[_0xbb7d('0x14')](function(_0x242147){logger[_0xbb7d('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x995731,_0x242147);_0x2bb06a(_0x242147);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 47022ff..e486a52 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 _0x68c6=['show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','isAuthenticated'];(function(_0x467d78,_0x1b657c){var _0x5af294=function(_0x1b289f){while(--_0x1b289f){_0x467d78['push'](_0x467d78['shift']());}};_0x5af294(++_0x1b657c);}(_0x68c6,0x85));var _0x668c=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x68c6[_0x1ca890];return _0x3f8e01;};'use strict';var multer=require(_0x668c('0x0'));var util=require(_0x668c('0x1'));var path=require(_0x668c('0x2'));var timeout=require(_0x668c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x668c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x668c('0x5'));var config=require(_0x668c('0x6'));var controller=require(_0x668c('0x7'));router[_0x668c('0x8')]('/',auth['isAuthenticated'](),controller[_0x668c('0x9')]);router[_0x668c('0x8')]('/:id',auth[_0x668c('0xa')](),controller[_0x668c('0xb')]);router[_0x668c('0xc')]('/',auth[_0x668c('0xa')](),controller[_0x668c('0xd')]);router[_0x668c('0xe')](_0x668c('0xf'),auth['isAuthenticated'](),controller[_0x668c('0x10')]);router[_0x668c('0x11')](_0x668c('0xf'),auth[_0x668c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf31b=['show','post','create','put','/:id','update','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xf31b,0x1c8));var _0xbf31=function(_0xff0ae8,_0x152aff){_0xff0ae8=_0xff0ae8-0x0;var _0x4ee460=_0xf31b[_0xff0ae8];return _0x4ee460;};'use strict';var multer=require('multer');var util=require(_0xbf31('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf31('0x1'));var router=express[_0xbf31('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbf31('0x3'));var interaction=require(_0xbf31('0x4'));var config=require('../../config/environment');var controller=require(_0xbf31('0x5'));router[_0xbf31('0x6')]('/',auth[_0xbf31('0x7')](),controller['index']);router[_0xbf31('0x6')]('/:id',auth[_0xbf31('0x7')](),controller[_0xbf31('0x8')]);router[_0xbf31('0x9')]('/',auth[_0xbf31('0x7')](),controller[_0xbf31('0xa')]);router[_0xbf31('0xb')](_0xbf31('0xc'),auth[_0xbf31('0x7')](),controller[_0xbf31('0xd')]);router['delete'](_0xbf31('0xc'),auth[_0xbf31('0x7')](),controller[_0xbf31('0xe')]);module[_0xbf31('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5d7d76a..6b7129a 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 _0x24c1=['keyValue','string','STRING','customVariable','sequelize','exports','ENUM','variable'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x24c1,0x174));var _0x124c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x24c1[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x124c('0x0'));module[_0x124c('0x1')]={'type':{'type':Sequelize[_0x124c('0x2')]('string',_0x124c('0x3'),'customVariable',_0x124c('0x4'),'picklist'),'defaultValue':_0x124c('0x5')},'content':{'type':Sequelize[_0x124c('0x6')]},'key':{'type':Sequelize[_0x124c('0x6')]},'keyType':{'type':Sequelize[_0x124c('0x2')](_0x124c('0x5'),_0x124c('0x3'),_0x124c('0x7'))},'keyContent':{'type':Sequelize[_0x124c('0x6')]},'idField':{'type':Sequelize[_0x124c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x124c('0x6')]}}; \ No newline at end of file +var _0x94e9=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x94e9,0x161));var _0x994e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x94e9[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x994e('0x0'));module[_0x994e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x994e('0x2'),_0x994e('0x3'),_0x994e('0x4'),_0x994e('0x5'),_0x994e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x994e('0x7')]},'key':{'type':Sequelize[_0x994e('0x7')]},'keyType':{'type':Sequelize[_0x994e('0x8')]('string',_0x994e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x994e('0x7')]},'idField':{'type':Sequelize[_0x994e('0x7')]},'nameField':{'type':Sequelize[_0x994e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'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 f1a6ac5..c121b1d 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 _0x3c81=['apply','reject','save','update','then','destroy','end','error','name','send','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c81,0x102));var _0x13c8=function(_0x439fba,_0x2937b8){_0x439fba=_0x439fba-0x0;var _0x19659b=_0x3c81[_0x439fba];return _0x19659b;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x28')]();});}};}function handleEntityNotFound(_0x4aff35,_0x47e8ae){return function(_0x5ad0dc){if(!_0x5ad0dc){_0x4aff35[_0x13c8('0x19')](0x194);}return _0x5ad0dc;};}function handleError(_0xc7f1b6,_0x53ada9){_0x53ada9=_0x53ada9||0x1f4;return function(_0x4df077){logger[_0x13c8('0x29')](_0x4df077['stack']);if(_0x4df077['name']){delete _0x4df077[_0x13c8('0x2a')];}_0xc7f1b6[_0x13c8('0x1a')](_0x53ada9)[_0x13c8('0x2b')](_0x4df077);};}exports['index']=function(_0x5ef2f7,_0x277a89){var _0x1071a0={},_0x399840={},_0x441182={'count':0x0,'rows':[]};var _0x138017=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x109cb8){return{'name':_0x109cb8[_0x13c8('0x2e')],'type':_0x109cb8['type']['key']};});_0x399840[_0x13c8('0x2f')]=_[_0x13c8('0x2c')](_0x138017,'name');_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x31')](_0x5ef2f7['query']);_0x399840[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],_0x399840[_0x13c8('0x30')]);_0x1071a0[_0x13c8('0x34')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x5ef2f7['query']['fields']));_0x1071a0[_0x13c8('0x34')]=_0x1071a0[_0x13c8('0x34')]['length']?_0x1071a0[_0x13c8('0x34')]:_0x399840['model'];if(!_0x5ef2f7[_0x13c8('0x30')]['hasOwnProperty'](_0x13c8('0x36'))){_0x1071a0[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x1d')]);_0x1071a0[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x5ef2f7['query'][_0x13c8('0x1c')]);}_0x1071a0[_0x13c8('0x37')]=qs['sort'](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x38')]);_0x1071a0[_0x13c8('0x39')]=qs['filters'](_['pick'](_0x5ef2f7['query'],_0x399840[_0x13c8('0x32')]),_0x138017);if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]){_0x1071a0[_0x13c8('0x39')]=_[_0x13c8('0x3b')](_0x1071a0[_0x13c8('0x39')],{'$or':_[_0x13c8('0x2c')](_0x138017,function(_0xe19858){if(_0xe19858[_0x13c8('0x3c')]!=='VIRTUAL'){var _0x5b2a28={};_0x5b2a28[_0xe19858[_0x13c8('0x2a')]]={'$like':'%'+_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]+'%'};return _0x5b2a28;}})});}_0x1071a0=_[_0x13c8('0x3b')]({},_0x1071a0,_0x5ef2f7['options']);var _0x35e1e7={'where':_0x1071a0['where']};return db[_0x13c8('0x2d')][_0x13c8('0x1f')](_0x35e1e7)[_0x13c8('0x26')](function(_0x1cd02c){_0x441182[_0x13c8('0x1f')]=_0x1cd02c;if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3d')]){_0x1071a0[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x1071a0);})[_0x13c8('0x26')](function(_0x416169){_0x441182[_0x13c8('0x40')]=_0x416169;return _0x441182;})[_0x13c8('0x26')](respondWithFilteredResult(_0x277a89,_0x1071a0))[_0x13c8('0x41')](handleError(_0x277a89,null));};exports[_0x13c8('0x42')]=function(_0x1b2ada,_0x1505fb){var _0xc5eb86={'raw':!![],'where':{'id':_0x1b2ada[_0x13c8('0x43')]['id']}},_0x1cff99={};_0x1cff99[_0x13c8('0x2f')]=_[_0x13c8('0x31')](db[_0x13c8('0x2d')][_0x13c8('0x44')]);_0x1cff99['query']=_[_0x13c8('0x31')](_0x1b2ada[_0x13c8('0x30')]);_0x1cff99[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],_0x1cff99['query']);_0xc5eb86['attributes']=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x1b2ada['query']['fields']));_0xc5eb86['attributes']=_0xc5eb86[_0x13c8('0x34')]['length']?_0xc5eb86[_0x13c8('0x34')]:_0x1cff99['model'];if(_0x1b2ada[_0x13c8('0x30')][_0x13c8('0x3d')]){_0xc5eb86[_0x13c8('0x3e')]=[{'all':!![]}];}_0xc5eb86=_[_0x13c8('0x3b')]({},_0xc5eb86,_0x1b2ada[_0x13c8('0x45')]);return db[_0x13c8('0x2d')]['find'](_0xc5eb86)[_0x13c8('0x26')](handleEntityNotFound(_0x1505fb,null))[_0x13c8('0x26')](respondWithResult(_0x1505fb,null))['catch'](handleError(_0x1505fb,null));};exports[_0x13c8('0x46')]=function(_0x26155d,_0x2e925f){return db[_0x13c8('0x2d')][_0x13c8('0x46')](_0x26155d['body'],{})[_0x13c8('0x26')](respondWithResult(_0x2e925f,0xc9))[_0x13c8('0x41')](handleError(_0x2e925f,null));};exports[_0x13c8('0x25')]=function(_0x38418b,_0x185d18){if(_0x38418b['body']['id']){delete _0x38418b[_0x13c8('0x47')]['id'];}return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x38418b[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x185d18,null))[_0x13c8('0x26')](saveUpdates(_0x38418b[_0x13c8('0x47')],null))[_0x13c8('0x26')](respondWithResult(_0x185d18,null))[_0x13c8('0x41')](handleError(_0x185d18,null));};exports[_0x13c8('0x27')]=function(_0x266f4e,_0x5e1fe5){return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x266f4e[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x5e1fe5,null))[_0x13c8('0x26')](removeEntity(_0x5e1fe5,null))[_0x13c8('0x41')](handleError(_0x5e1fe5,null));}; \ No newline at end of file +var _0x6c76=['pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskField','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c76,0x184));var _0x66c7=function(_0x4514a3,_0x404720){_0x4514a3=_0x4514a3-0x0;var _0x193f68=_0x6c76[_0x4514a3];return _0x193f68;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];function respondWithStatusCode(_0x5176a3,_0x18c309){_0x18c309=_0x18c309||0xcc;return function(_0x760e36){if(_0x760e36){return _0x5176a3[_0x66c7('0x17')](_0x18c309);}return _0x5176a3[_0x66c7('0x18')](_0x18c309)[_0x66c7('0x19')]();};}function respondWithResult(_0x1e91d1,_0x618bd7){_0x618bd7=_0x618bd7||0xc8;return function(_0xf3b04){if(_0xf3b04){return _0x1e91d1[_0x66c7('0x18')](_0x618bd7)['json'](_0xf3b04);}};}function respondWithFilteredResult(_0x110f6d,_0x4dd902){return function(_0x208010){if(_0x208010){var _0x39f951=typeof _0x4dd902[_0x66c7('0x1a')]===_0x66c7('0x1b')&&typeof _0x4dd902[_0x66c7('0x1c')]==='undefined';var _0x5cf913=_0x208010['count'];var _0x5129f6=_0x39f951?0x0:_0x4dd902[_0x66c7('0x1a')];var _0x19f29d=_0x39f951?_0x208010['count']:_0x4dd902['offset']+_0x4dd902[_0x66c7('0x1c')];var _0x9b65cf;if(_0x19f29d>=_0x5cf913){_0x19f29d=_0x5cf913;_0x9b65cf=0xc8;}else{_0x9b65cf=0xce;}_0x110f6d[_0x66c7('0x18')](_0x9b65cf);return _0x110f6d[_0x66c7('0x1d')]('Content-Range',_0x5129f6+'-'+_0x19f29d+'/'+_0x5cf913)['json'](_0x208010);}return null;};}function patchUpdates(_0x1853b2){return function(_0x237177){try{jsonpatch[_0x66c7('0x1e')](_0x237177,_0x1853b2,!![]);}catch(_0x1c43c4){return BPromise[_0x66c7('0x1f')](_0x1c43c4);}return _0x237177[_0x66c7('0x20')]();};}function saveUpdates(_0x4804cf,_0x4ddbd2){return function(_0x366e9b){if(_0x366e9b){return _0x366e9b['update'](_0x4804cf)[_0x66c7('0x21')](function(_0x8b96b1){return _0x8b96b1;});}return null;};}function removeEntity(_0x44bdef,_0x1fc9d3){return function(_0x5bfaf6){if(_0x5bfaf6){return _0x5bfaf6[_0x66c7('0x22')]()[_0x66c7('0x21')](function(){_0x44bdef['status'](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x11a6b9,_0x2bb86d){return function(_0x2ef6a2){if(!_0x2ef6a2){_0x11a6b9[_0x66c7('0x17')](0x194);}return _0x2ef6a2;};}function handleError(_0x54d45d,_0x5bc4e6){_0x5bc4e6=_0x5bc4e6||0x1f4;return function(_0x4e514a){logger[_0x66c7('0x23')](_0x4e514a[_0x66c7('0x24')]);if(_0x4e514a['name']){delete _0x4e514a[_0x66c7('0x25')];}_0x54d45d[_0x66c7('0x18')](_0x5bc4e6)[_0x66c7('0x26')](_0x4e514a);};}exports[_0x66c7('0x27')]=function(_0x36a830,_0x27be81){var _0x570f0d={},_0xccefb2={},_0x2e2560={'count':0x0,'rows':[]};var _0xc4b2bf=_[_0x66c7('0x28')](db[_0x66c7('0x29')]['rawAttributes'],function(_0x263b48){return{'name':_0x263b48['fieldName'],'type':_0x263b48[_0x66c7('0x2a')]['key']};});_0xccefb2[_0x66c7('0x2b')]=_[_0x66c7('0x28')](_0xc4b2bf,_0x66c7('0x25'));_0xccefb2[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x36a830[_0x66c7('0x2c')]);_0xccefb2['filters']=_['intersection'](_0xccefb2[_0x66c7('0x2b')],_0xccefb2[_0x66c7('0x2c')]);_0x570f0d[_0x66c7('0x2e')]=_[_0x66c7('0x2f')](_0xccefb2[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x30')]));_0x570f0d[_0x66c7('0x2e')]=_0x570f0d[_0x66c7('0x2e')][_0x66c7('0x31')]?_0x570f0d[_0x66c7('0x2e')]:_0xccefb2['model'];if(!_0x36a830['query'][_0x66c7('0x32')](_0x66c7('0x33'))){_0x570f0d[_0x66c7('0x1c')]=qs[_0x66c7('0x1c')](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x1c')]);_0x570f0d[_0x66c7('0x1a')]=qs['offset'](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x1a')]);}_0x570f0d[_0x66c7('0x34')]=qs[_0x66c7('0x35')](_0x36a830[_0x66c7('0x2c')][_0x66c7('0x35')]);_0x570f0d[_0x66c7('0x36')]=qs[_0x66c7('0x37')](_[_0x66c7('0x38')](_0x36a830[_0x66c7('0x2c')],_0xccefb2[_0x66c7('0x37')]),_0xc4b2bf);if(_0x36a830['query']['filter']){_0x570f0d[_0x66c7('0x36')]=_[_0x66c7('0x39')](_0x570f0d[_0x66c7('0x36')],{'$or':_['map'](_0xc4b2bf,function(_0x4d46dd){if(_0x4d46dd[_0x66c7('0x2a')]!==_0x66c7('0x3a')){var _0x501771={};_0x501771[_0x4d46dd[_0x66c7('0x25')]]={'$like':'%'+_0x36a830[_0x66c7('0x2c')][_0x66c7('0x3b')]+'%'};return _0x501771;}})});}_0x570f0d=_['merge']({},_0x570f0d,_0x36a830[_0x66c7('0x3c')]);var _0x16b754={'where':_0x570f0d[_0x66c7('0x36')]};return db[_0x66c7('0x29')][_0x66c7('0x3d')](_0x16b754)[_0x66c7('0x21')](function(_0x21deb3){_0x2e2560[_0x66c7('0x3d')]=_0x21deb3;if(_0x36a830[_0x66c7('0x2c')]['includeAll']){_0x570f0d[_0x66c7('0x3e')]=[{'all':!![]}];}return db[_0x66c7('0x29')][_0x66c7('0x3f')](_0x570f0d);})[_0x66c7('0x21')](function(_0x3f169e){_0x2e2560[_0x66c7('0x40')]=_0x3f169e;return _0x2e2560;})[_0x66c7('0x21')](respondWithFilteredResult(_0x27be81,_0x570f0d))[_0x66c7('0x41')](handleError(_0x27be81,null));};exports[_0x66c7('0x42')]=function(_0x3d371a,_0x513317){var _0x5bb5fc={'raw':!![],'where':{'id':_0x3d371a[_0x66c7('0x43')]['id']}},_0x528f5c={};_0x528f5c[_0x66c7('0x2b')]=_['keys'](db['FreshdeskField'][_0x66c7('0x44')]);_0x528f5c[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x3d371a[_0x66c7('0x2c')]);_0x528f5c[_0x66c7('0x37')]=_['intersection'](_0x528f5c[_0x66c7('0x2b')],_0x528f5c['query']);_0x5bb5fc['attributes']=_[_0x66c7('0x2f')](_0x528f5c[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x3d371a[_0x66c7('0x2c')]['fields']));_0x5bb5fc['attributes']=_0x5bb5fc[_0x66c7('0x2e')]['length']?_0x5bb5fc['attributes']:_0x528f5c[_0x66c7('0x2b')];if(_0x3d371a[_0x66c7('0x2c')][_0x66c7('0x45')]){_0x5bb5fc[_0x66c7('0x3e')]=[{'all':!![]}];}_0x5bb5fc=_['merge']({},_0x5bb5fc,_0x3d371a[_0x66c7('0x3c')]);return db[_0x66c7('0x29')][_0x66c7('0x46')](_0x5bb5fc)['then'](handleEntityNotFound(_0x513317,null))[_0x66c7('0x21')](respondWithResult(_0x513317,null))[_0x66c7('0x41')](handleError(_0x513317,null));};exports[_0x66c7('0x47')]=function(_0x3c45cd,_0x1b78a6){return db[_0x66c7('0x29')][_0x66c7('0x47')](_0x3c45cd[_0x66c7('0x48')],{})['then'](respondWithResult(_0x1b78a6,0xc9))[_0x66c7('0x41')](handleError(_0x1b78a6,null));};exports[_0x66c7('0x49')]=function(_0x23d0eb,_0x1386a2){if(_0x23d0eb[_0x66c7('0x48')]['id']){delete _0x23d0eb[_0x66c7('0x48')]['id'];}return db[_0x66c7('0x29')][_0x66c7('0x46')]({'where':{'id':_0x23d0eb[_0x66c7('0x43')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x1386a2,null))[_0x66c7('0x21')](saveUpdates(_0x23d0eb[_0x66c7('0x48')],null))[_0x66c7('0x21')](respondWithResult(_0x1386a2,null))[_0x66c7('0x41')](handleError(_0x1386a2,null));};exports['destroy']=function(_0x43d4db,_0x225fb6){return db[_0x66c7('0x29')][_0x66c7('0x46')]({'where':{'id':_0x43d4db['params']['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x225fb6,null))[_0x66c7('0x21')](removeEntity(_0x225fb6,null))['catch'](handleError(_0x225fb6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 38ffd26..ceb49e9 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 _0xd78b=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger','api','bluebird','request-promise','./intFreshdeskField.attributes','exports'];(function(_0x2b1c74,_0x27db09){var _0x2fc80a=function(_0x1ecfde){while(--_0x1ecfde){_0x2b1c74['push'](_0x2b1c74['shift']());}};_0x2fc80a(++_0x27db09);}(_0xd78b,0x155));var _0xbd78=function(_0x4a4d6e,_0x38ab14){_0x4a4d6e=_0x4a4d6e-0x0;var _0x377fa8=_0xd78b[_0x4a4d6e];return _0x377fa8;};'use strict';var _=require('lodash');var util=require(_0xbd78('0x0'));var logger=require(_0xbd78('0x1'))(_0xbd78('0x2'));var moment=require('moment');var BPromise=require(_0xbd78('0x3'));var rp=require(_0xbd78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbd78('0x5'));module[_0xbd78('0x6')]=function(_0x4d8ef1,_0x404d1c){return _0x4d8ef1[_0xbd78('0x7')](_0xbd78('0x8'),attributes,{'tableName':_0xbd78('0x9'),'paranoid':![],'indexes':[{'name':_0xbd78('0xa'),'fields':[_0xbd78('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6064=['int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField'];(function(_0x3df1ca,_0x49fb2a){var _0x5e7db8=function(_0x5aad74){while(--_0x5aad74){_0x3df1ca['push'](_0x3df1ca['shift']());}};_0x5e7db8(++_0x49fb2a);}(_0x6064,0xe3));var _0x4606=function(_0x1e5b19,_0x742d5d){_0x1e5b19=_0x1e5b19-0x0;var _0x47efc8=_0x6064[_0x1e5b19];return _0x47efc8;};'use strict';var _=require(_0x4606('0x0'));var util=require('util');var logger=require(_0x4606('0x1'))(_0x4606('0x2'));var moment=require('moment');var BPromise=require(_0x4606('0x3'));var rp=require(_0x4606('0x4'));var fs=require('fs');var path=require(_0x4606('0x5'));var rimraf=require(_0x4606('0x6'));var config=require(_0x4606('0x7'));var attributes=require(_0x4606('0x8'));module['exports']=function(_0x3b6a70,_0x32a18b){return _0x3b6a70[_0x4606('0x9')](_0x4606('0xa'),attributes,{'tableName':_0x4606('0xb'),'paranoid':![],'indexes':[{'name':_0x4606('0xc'),'fields':['idField',_0x4606('0xd')],'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 068ce26..e3f11e9 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 _0x2fbc=['rpc','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x2fbc,0x1c6));var _0xc2fb=function(_0x2b9255,_0x5be6c6){_0x2b9255=_0x2b9255-0x0;var _0x104ca4=_0x2fbc[_0x2b9255];return _0x104ca4;};'use strict';var _=require(_0xc2fb('0x0'));var util=require(_0xc2fb('0x1'));var moment=require(_0xc2fb('0x2'));var BPromise=require(_0xc2fb('0x3'));var rs=require(_0xc2fb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2fb('0x5'))['db'];var utils=require(_0xc2fb('0x6'));var logger=require(_0xc2fb('0x7'))(_0xc2fb('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2fb('0x9'));var client=jayson[_0xc2fb('0xa')][_0xc2fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ce4b6,_0xa90b9e,_0x543e77){return new BPromise(function(_0x204da9,_0x4e9e98){return client['request'](_0x5ce4b6,_0x543e77)[_0xc2fb('0xc')](function(_0x98a4d8){logger['info'](_0xc2fb('0xd'),_0xa90b9e,_0xc2fb('0xe'));logger['debug'](_0xc2fb('0xf'),_0xa90b9e,_0xc2fb('0xe'),JSON[_0xc2fb('0x10')](_0x98a4d8));if(_0x98a4d8[_0xc2fb('0x11')]){if(_0x98a4d8['error']['code']===0x1f4){logger[_0xc2fb('0x11')](_0xc2fb('0xd'),_0xa90b9e,_0x98a4d8['error'][_0xc2fb('0x12')]);return _0x4e9e98(_0x98a4d8['error']['message']);}logger['error'](_0xc2fb('0xd'),_0xa90b9e,_0x98a4d8[_0xc2fb('0x11')][_0xc2fb('0x12')]);return _0x204da9(_0x98a4d8[_0xc2fb('0x11')][_0xc2fb('0x12')]);}else{logger[_0xc2fb('0x13')]('FreshdeskField,\x20%s,\x20%s',_0xa90b9e,_0xc2fb('0xe'));_0x204da9(_0x98a4d8[_0xc2fb('0x14')][_0xc2fb('0x12')]);}})[_0xc2fb('0x15')](function(_0x15044f){logger['error'](_0xc2fb('0xd'),_0xa90b9e,_0x15044f);_0x4e9e98(_0x15044f);});});} \ No newline at end of file +var _0xbb01=['request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xbb01,0x196));var _0x1bb0=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0xbb01[_0x385c76];return _0x5c8367;};'use strict';var _=require('lodash');var util=require(_0x1bb0('0x0'));var moment=require(_0x1bb0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bb0('0x2'));var db=require(_0x1bb0('0x3'))['db'];var utils=require(_0x1bb0('0x4'));var logger=require(_0x1bb0('0x5'))(_0x1bb0('0x6'));var config=require(_0x1bb0('0x7'));var jayson=require(_0x1bb0('0x8'));var client=jayson[_0x1bb0('0x9')][_0x1bb0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcbd654,_0x3abba1,_0x181b6f){return new BPromise(function(_0x58cad9,_0x12b987){return client[_0x1bb0('0xb')](_0xcbd654,_0x181b6f)[_0x1bb0('0xc')](function(_0x20473f){logger['info'](_0x1bb0('0xd'),_0x3abba1,_0x1bb0('0xe'));logger['debug'](_0x1bb0('0xf'),_0x3abba1,_0x1bb0('0xe'),JSON[_0x1bb0('0x10')](_0x20473f));if(_0x20473f[_0x1bb0('0x11')]){if(_0x20473f[_0x1bb0('0x11')]['code']===0x1f4){logger['error'](_0x1bb0('0xd'),_0x3abba1,_0x20473f[_0x1bb0('0x11')][_0x1bb0('0x12')]);return _0x12b987(_0x20473f[_0x1bb0('0x11')]['message']);}logger[_0x1bb0('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x3abba1,_0x20473f[_0x1bb0('0x11')]['message']);return _0x58cad9(_0x20473f[_0x1bb0('0x11')][_0x1bb0('0x12')]);}else{logger[_0x1bb0('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x3abba1,_0x1bb0('0xe'));_0x58cad9(_0x20473f['result'][_0x1bb0('0x12')]);}})[_0x1bb0('0x14')](function(_0x4c6ab5){logger[_0x1bb0('0x11')](_0x1bb0('0xd'),_0x3abba1,_0x4c6ab5);_0x12b987(_0x4c6ab5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 64742a0..4bfa0cd 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 _0xa5fa=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','destroy','exports','util','path'];(function(_0x458d40,_0x51ba41){var _0x4ed6e9=function(_0x2ff091){while(--_0x2ff091){_0x458d40['push'](_0x458d40['shift']());}};_0x4ed6e9(++_0x51ba41);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xa5fa[_0x967959];return _0x5c4489;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa5f('0x10')]);router['post'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x11')]);router[_0xaa5f('0x12')](_0xaa5f('0xb'),auth['isAuthenticated'](),controller[_0xaa5f('0x13')]);router['delete'](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);module[_0xaa5f('0x15')]=router; \ No newline at end of file +var _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1db5ba,_0x25ddfc){var _0x1a9d8a=function(_0x52f40b){while(--_0x52f40b){_0x1db5ba['push'](_0x1db5ba['shift']());}};_0x1a9d8a(++_0x25ddfc);}(_0xc900,0xb3));var _0x0c90=function(_0x19fce3,_0x4d3a99){_0x19fce3=_0x19fce3-0x0;var _0xc5bf8e=_0xc900[_0x19fce3];return _0xc5bf8e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 015426b..bdb383b 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 _0x5b12=['STRING','sequelize','exports'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5b12,0xa3));var _0x25b1=function(_0xb895b0,_0x4dbd2b){_0xb895b0=_0xb895b0-0x0;var _0x338338=_0x5b12[_0xb895b0];return _0x338338;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x430c=['sequelize','STRING','username'];(function(_0x5dbea5,_0x3f558b){var _0xdde54f=function(_0xddc359){while(--_0xddc359){_0x5dbea5['push'](_0x5dbea5['shift']());}};_0xdde54f(++_0x3f558b);}(_0x430c,0x1a1));var _0xc430=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x430c[_0x529abc];return _0x453afa;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc430('0x1')]},'username':{'type':Sequelize[_0xc430('0x1')],'unique':_0xc430('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 948fb8f..ae43b31 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 _0x0303=['email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','apply','reject','save','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users'];(function(_0x5e0bfe,_0x747312){var _0x6468b8=function(_0x20e5e0){while(--_0x20e5e0){_0x5e0bfe['push'](_0x5e0bfe['shift']());}};_0x6468b8(++_0x747312);}(_0x0303,0x19f));var _0x3030=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x0303[_0x432fca];return _0x3adba4;};'use strict';var emlformat=require(_0x3030('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3030('0x1'));var rp=require('request-promise');var moment=require(_0x3030('0x2'));var BPromise=require(_0x3030('0x3'));var Mustache=require(_0x3030('0x4'));var util=require(_0x3030('0x5'));var path=require(_0x3030('0x6'));var sox=require('sox');var csv=require(_0x3030('0x7'));var ejs=require(_0x3030('0x8'));var fs=require('fs');var fs_extra=require(_0x3030('0x9'));var _=require(_0x3030('0xa'));var squel=require('squel');var crypto=require(_0x3030('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3030('0xc'));var toCsv=require(_0x3030('0x7'));var querystring=require(_0x3030('0xd'));var Papa=require(_0x3030('0xe'));var Redis=require(_0x3030('0xf'));var authService=require(_0x3030('0x10'));var qs=require(_0x3030('0x11'));var as=require(_0x3030('0x12'));var hardwareService=require(_0x3030('0x13'));var logger=require('../../config/logger')(_0x3030('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3030('0x15'));var db=require(_0x3030('0x16'))['db'];var integrations=require(_0x3030('0x17'));function respondWithStatusCode(_0x57b72,_0x2cffc6){_0x2cffc6=_0x2cffc6||0xcc;return function(_0xc65e4f){if(_0xc65e4f){return _0x57b72['sendStatus'](_0x2cffc6);}return _0x57b72[_0x3030('0x18')](_0x2cffc6)[_0x3030('0x19')]();};}function respondWithResult(_0x3db098,_0x2441fe){_0x2441fe=_0x2441fe||0xc8;return function(_0x12526f){if(_0x12526f){return _0x3db098[_0x3030('0x18')](_0x2441fe)[_0x3030('0x1a')](_0x12526f);}};}function respondWithFilteredResult(_0x57ebd3,_0x265666){return function(_0x575dce){if(_0x575dce){var _0x37d2fa=typeof _0x265666[_0x3030('0x1b')]===_0x3030('0x1c')&&typeof _0x265666[_0x3030('0x1d')]===_0x3030('0x1c');var _0x5d0a18=_0x575dce[_0x3030('0x1e')];var _0x48ddde=_0x37d2fa?0x0:_0x265666[_0x3030('0x1b')];var _0x1b8259=_0x37d2fa?_0x575dce[_0x3030('0x1e')]:_0x265666[_0x3030('0x1b')]+_0x265666[_0x3030('0x1d')];var _0x24c647;if(_0x1b8259>=_0x5d0a18){_0x1b8259=_0x5d0a18;_0x24c647=0xc8;}else{_0x24c647=0xce;}_0x57ebd3[_0x3030('0x18')](_0x24c647);return _0x57ebd3['set']('Content-Range',_0x48ddde+'-'+_0x1b8259+'/'+_0x5d0a18)['json'](_0x575dce);}return null;};}function patchUpdates(_0x19649f){return function(_0x382b94){try{jsonpatch[_0x3030('0x1f')](_0x382b94,_0x19649f,!![]);}catch(_0x1cca6c){return BPromise[_0x3030('0x20')](_0x1cca6c);}return _0x382b94[_0x3030('0x21')]();};}function saveUpdates(_0x4b45d9,_0x4462d3){return function(_0x36515b){if(_0x36515b){return _0x36515b['update'](_0x4b45d9)[_0x3030('0x22')](function(_0x49edee){return _0x49edee;});}return null;};}function removeEntity(_0x39cb50,_0x21e4b2){return function(_0x55aeff){if(_0x55aeff){return _0x55aeff['destroy']()[_0x3030('0x22')](function(){_0x39cb50['status'](0xcc)[_0x3030('0x19')]();});}};}function handleEntityNotFound(_0x510b21,_0x229caf){return function(_0x11a334){if(!_0x11a334){_0x510b21[_0x3030('0x23')](0x194);}return _0x11a334;};}function handleError(_0x588f1c,_0x5e6f05){_0x5e6f05=_0x5e6f05||0x1f4;return function(_0x1eca42){logger['error'](_0x1eca42[_0x3030('0x24')]);if(_0x1eca42[_0x3030('0x25')]){delete _0x1eca42['name'];}_0x588f1c[_0x3030('0x18')](_0x5e6f05)[_0x3030('0x26')](_0x1eca42);};}exports[_0x3030('0x27')]=function(_0x11c2b5,_0x575b06){var _0x842f0e={},_0x2d088b={},_0x24e7c1={'count':0x0,'rows':[]};var _0x19540a=_[_0x3030('0x28')](db[_0x3030('0x29')][_0x3030('0x2a')],function(_0x494ec8){return{'name':_0x494ec8['fieldName'],'type':_0x494ec8['type'][_0x3030('0x2b')]};});_0x2d088b[_0x3030('0x2c')]=_[_0x3030('0x28')](_0x19540a,'name');_0x2d088b[_0x3030('0x2d')]=_[_0x3030('0x2e')](_0x11c2b5[_0x3030('0x2d')]);_0x2d088b[_0x3030('0x2f')]=_[_0x3030('0x30')](_0x2d088b[_0x3030('0x2c')],_0x2d088b[_0x3030('0x2d')]);_0x842f0e[_0x3030('0x31')]=_['intersection'](_0x2d088b[_0x3030('0x2c')],qs[_0x3030('0x32')](_0x11c2b5[_0x3030('0x2d')][_0x3030('0x32')]));_0x842f0e['attributes']=_0x842f0e['attributes']['length']?_0x842f0e[_0x3030('0x31')]:_0x2d088b[_0x3030('0x2c')];if(!_0x11c2b5[_0x3030('0x2d')][_0x3030('0x33')](_0x3030('0x34'))){_0x842f0e['limit']=qs[_0x3030('0x1d')](_0x11c2b5[_0x3030('0x2d')][_0x3030('0x1d')]);_0x842f0e[_0x3030('0x1b')]=qs['offset'](_0x11c2b5['query']['offset']);}_0x842f0e[_0x3030('0x35')]=qs[_0x3030('0x36')](_0x11c2b5[_0x3030('0x2d')]['sort']);_0x842f0e[_0x3030('0x37')]=qs['filters'](_[_0x3030('0x38')](_0x11c2b5[_0x3030('0x2d')],_0x2d088b[_0x3030('0x2f')]),_0x19540a);if(_0x11c2b5[_0x3030('0x2d')][_0x3030('0x39')]){_0x842f0e[_0x3030('0x37')]=_[_0x3030('0x3a')](_0x842f0e[_0x3030('0x37')],{'$or':_[_0x3030('0x28')](_0x19540a,function(_0x590aae){if(_0x590aae[_0x3030('0x3b')]!=='VIRTUAL'){var _0x261e1c={};_0x261e1c[_0x590aae[_0x3030('0x25')]]={'$like':'%'+_0x11c2b5[_0x3030('0x2d')][_0x3030('0x39')]+'%'};return _0x261e1c;}})});}_0x842f0e=_[_0x3030('0x3a')]({},_0x842f0e,_0x11c2b5[_0x3030('0x3c')]);var _0x2cefa1={'where':_0x842f0e[_0x3030('0x37')]};return db[_0x3030('0x29')][_0x3030('0x1e')](_0x2cefa1)[_0x3030('0x22')](function(_0x41c564){_0x24e7c1[_0x3030('0x1e')]=_0x41c564;if(_0x11c2b5[_0x3030('0x2d')][_0x3030('0x3d')]){_0x842f0e[_0x3030('0x3e')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x3030('0x3f')](_0x842f0e);})['then'](function(_0x23bef7){_0x24e7c1[_0x3030('0x40')]=_0x23bef7;return _0x24e7c1;})[_0x3030('0x22')](respondWithFilteredResult(_0x575b06,_0x842f0e))[_0x3030('0x41')](handleError(_0x575b06,null));};exports[_0x3030('0x42')]=function(_0x5627c8,_0x2dcad5){var _0x5d9e1d={'raw':![],'where':{'id':_0x5627c8[_0x3030('0x43')]['id']}},_0x3eec7b={};_0x3eec7b['model']=_[_0x3030('0x2e')](db['FreshsalesAccount'][_0x3030('0x2a')]);_0x3eec7b[_0x3030('0x2d')]=_[_0x3030('0x2e')](_0x5627c8[_0x3030('0x2d')]);_0x3eec7b[_0x3030('0x2f')]=_[_0x3030('0x30')](_0x3eec7b[_0x3030('0x2c')],_0x3eec7b[_0x3030('0x2d')]);_0x5d9e1d[_0x3030('0x31')]=_['intersection'](_0x3eec7b[_0x3030('0x2c')],qs[_0x3030('0x32')](_0x5627c8[_0x3030('0x2d')]['fields']));_0x5d9e1d[_0x3030('0x31')]=_0x5d9e1d[_0x3030('0x31')][_0x3030('0x44')]?_0x5d9e1d['attributes']:_0x3eec7b[_0x3030('0x2c')];if(_0x5627c8[_0x3030('0x2d')]['includeAll']){_0x5d9e1d[_0x3030('0x3e')]=[{'all':!![]}];}_0x5d9e1d=_[_0x3030('0x3a')]({},_0x5d9e1d,_0x5627c8[_0x3030('0x3c')]);return db[_0x3030('0x29')][_0x3030('0x45')](_0x5d9e1d)['then'](handleEntityNotFound(_0x2dcad5,null))[_0x3030('0x22')](respondWithResult(_0x2dcad5,null))[_0x3030('0x41')](handleError(_0x2dcad5,null));};exports[_0x3030('0x46')]=function(_0x440ccb,_0x5be8bc){return db[_0x3030('0x29')][_0x3030('0x46')](_0x440ccb[_0x3030('0x47')],{})[_0x3030('0x22')](respondWithResult(_0x5be8bc,0xc9))[_0x3030('0x41')](handleError(_0x5be8bc,null));};exports[_0x3030('0x48')]=function(_0xe48f28,_0x40da52){if(_0xe48f28['body']['id']){delete _0xe48f28[_0x3030('0x47')]['id'];}return db[_0x3030('0x29')][_0x3030('0x45')]({'where':{'id':_0xe48f28[_0x3030('0x43')]['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x40da52,null))[_0x3030('0x22')](saveUpdates(_0xe48f28[_0x3030('0x47')],null))[_0x3030('0x22')](respondWithResult(_0x40da52,null))[_0x3030('0x41')](handleError(_0x40da52,null));};exports['destroy']=function(_0x15de23,_0x583474){return db[_0x3030('0x29')][_0x3030('0x45')]({'where':{'id':_0x15de23[_0x3030('0x43')]['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x583474,null))[_0x3030('0x22')](removeEntity(_0x583474,null))[_0x3030('0x41')](handleError(_0x583474,null));};exports[_0x3030('0x49')]=function(_0x5061e0,_0x5ccecc,_0x4fc177){var _0x27fe36={};var _0x49ecb1={};var _0x121aa7;var _0x55fbe1;return db[_0x3030('0x29')][_0x3030('0x4a')]({'where':{'id':_0x5061e0['params']['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x5ccecc,null))[_0x3030('0x22')](function(_0x5b9cfa){if(_0x5b9cfa){_0x121aa7=_0x5b9cfa;_0x49ecb1[_0x3030('0x2c')]=_['keys'](db[_0x3030('0x4b')][_0x3030('0x2a')]);_0x49ecb1[_0x3030('0x2d')]=_[_0x3030('0x2e')](_0x5061e0[_0x3030('0x2d')]);_0x49ecb1['filters']=_[_0x3030('0x30')](_0x49ecb1[_0x3030('0x2c')],_0x49ecb1[_0x3030('0x2d')]);_0x27fe36[_0x3030('0x31')]=_[_0x3030('0x30')](_0x49ecb1[_0x3030('0x2c')],qs[_0x3030('0x32')](_0x5061e0[_0x3030('0x2d')][_0x3030('0x32')]));_0x27fe36['attributes']=_0x27fe36[_0x3030('0x31')][_0x3030('0x44')]?_0x27fe36[_0x3030('0x31')]:_0x49ecb1[_0x3030('0x2c')];_0x27fe36[_0x3030('0x35')]=qs[_0x3030('0x36')](_0x5061e0[_0x3030('0x2d')][_0x3030('0x36')]);_0x27fe36[_0x3030('0x37')]=qs[_0x3030('0x2f')](_[_0x3030('0x38')](_0x5061e0[_0x3030('0x2d')],_0x49ecb1[_0x3030('0x2f')]));if(_0x5061e0['query'][_0x3030('0x39')]){_0x27fe36['where']=_['merge'](_0x27fe36['where'],{'$or':_['map'](_0x27fe36[_0x3030('0x31')],function(_0x378b7f){var _0x53f4eb={};_0x53f4eb[_0x378b7f]={'$like':'%'+_0x5061e0[_0x3030('0x2d')][_0x3030('0x39')]+'%'};return _0x53f4eb;})});}_0x27fe36=_[_0x3030('0x3a')]({},_0x27fe36,_0x5061e0['options']);return _0x121aa7[_0x3030('0x49')](_0x27fe36);}})[_0x3030('0x22')](function(_0x4a22a0){if(_0x4a22a0){_0x55fbe1=_0x4a22a0['length'];if(!_0x5061e0[_0x3030('0x2d')][_0x3030('0x33')](_0x3030('0x34'))){_0x27fe36['limit']=qs['limit'](_0x5061e0[_0x3030('0x2d')][_0x3030('0x1d')]);_0x27fe36[_0x3030('0x1b')]=qs['offset'](_0x5061e0[_0x3030('0x2d')][_0x3030('0x1b')]);}return _0x121aa7[_0x3030('0x49')](_0x27fe36);}})[_0x3030('0x22')](function(_0x437348){if(_0x437348){return _0x437348?{'count':_0x55fbe1,'rows':_0x437348}:null;}})[_0x3030('0x22')](respondWithResult(_0x5ccecc,null))['catch'](handleError(_0x5ccecc,null));};exports[_0x3030('0x4c')]=function(_0x3a963f,_0x3eda44,_0x454eda){if(_0x3a963f[_0x3030('0x47')]['id']){delete _0x3a963f[_0x3030('0x47')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3a963f[_0x3030('0x43')]['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x3eda44,null))[_0x3030('0x22')](function(_0x337fa7){if(_0x337fa7){_0x3a963f['body'][_0x3030('0x4d')]=_0x337fa7['id'];_0x3a963f['body'][_0x3030('0x4e')]=integrations[_0x3030('0x4f')](_0x3a963f[_0x3030('0x47')][_0x3030('0x50')],_0x3a963f[_0x3030('0x47')][_0x3030('0x3b')]);_0x3a963f[_0x3030('0x47')][_0x3030('0x51')]=integrations[_0x3030('0x52')](_0x3a963f[_0x3030('0x47')][_0x3030('0x50')],_0x3a963f['body'][_0x3030('0x3b')]);return db['FreshsalesConfiguration'][_0x3030('0x46')](_0x3a963f[_0x3030('0x47')],{'include':[{'model':db[_0x3030('0x53')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x3030('0x51')}]});}return null;})[_0x3030('0x22')](respondWithResult(_0x3eda44,null))[_0x3030('0x41')](handleError(_0x3eda44,null));};exports[_0x3030('0x54')]=function(_0x2e3e93,_0x485587,_0x2cd05f){var _0x19f760='';var _0x529e7b='';return db[_0x3030('0x29')][_0x3030('0x4a')]({'where':{'id':_0x2e3e93[_0x3030('0x43')]['id']},'attributes':['id',_0x3030('0x55'),'remoteUri',_0x3030('0x56')]})['then'](handleEntityNotFound(_0x485587,null))[_0x3030('0x22')](function(_0x3d673b){if(_0x3d673b){_0x529e7b=_0x3d673b['username'];_0x19f760=_0x3d673b[_0x3030('0x57')];var _0x48f32a=_0x3d673b['remoteUri'][_0x3030('0x58')](-0x1);if(_0x48f32a==='/'){_0x19f760=_0x19f760['substring'](0x0,_0x19f760['lastIndexOf'](_0x48f32a));}return rp({'method':_0x3030('0x59'),'uri':util[_0x3030('0x5a')](_0x3030('0x5b'),_0x19f760,_0x3030('0x5c')),'headers':{'Authorization':_0x3030('0x5d')+_0x3d673b[_0x3030('0x56')]},'json':!![]});}})[_0x3030('0x22')](function(_0x4d5f18){if(_0x4d5f18){var _0x8dd55e=_0x4d5f18[_0x3030('0x5e')];var _0x8e2179=![];var _0x2c7b21=null;for(_0x2c7b21=0x0;_0x2c7b21<_0x8dd55e[_0x3030('0x44')];_0x2c7b21++){if(_0x8dd55e[_0x2c7b21][_0x3030('0x5f')]===_0x529e7b){_0x8e2179=!![];}}if(_0x8e2179){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3030('0x60')});}}})[_0x3030('0x22')](respondWithResult(_0x485587,null))[_0x3030('0x41')](function(_0x7a2424){var _0x156551=_0x2e3e93[_0x3030('0x2d')][_0x3030('0x61')]?0x1f4:_0x7a2424['statusCode']||0x1f4;logger[_0x3030('0x62')](_0x3030('0x63'),_0x3030('0x54'),_0x156551,JSON[_0x3030('0x64')](_0x7a2424));delete _0x7a2424[_0x3030('0x25')];if(_0x156551===0x191){_0x156551=0x190;}_0x485587['status'](_0x156551)[_0x3030('0x26')](_0x2e3e93[_0x3030('0x2d')]['test']?{'message':_0x3030('0x65'),'statusCode':_0x7a2424['statusCode']}:_0x7a2424);});}; \ No newline at end of file +var _0x35c1=['end','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','FreshsalesAccount','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','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/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x70bb8,_0x1da278){var _0x48ba84=function(_0xb567b9){while(--_0xb567b9){_0x70bb8['push'](_0x70bb8['shift']());}};_0x48ba84(++_0x1da278);}(_0x35c1,0x186));var _0x135c=function(_0x1778a1,_0x50cba4){_0x1778a1=_0x1778a1-0x0;var _0x1b9222=_0x35c1[_0x1778a1];return _0x1b9222;};'use strict';var emlformat=require(_0x135c('0x0'));var rimraf=require(_0x135c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x135c('0x2'));var rp=require(_0x135c('0x3'));var moment=require('moment');var BPromise=require(_0x135c('0x4'));var Mustache=require(_0x135c('0x5'));var util=require(_0x135c('0x6'));var path=require(_0x135c('0x7'));var sox=require(_0x135c('0x8'));var csv=require(_0x135c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x135c('0xa'));var _=require(_0x135c('0xb'));var squel=require(_0x135c('0xc'));var crypto=require(_0x135c('0xd'));var jsforce=require(_0x135c('0xe'));var deskjs=require(_0x135c('0xf'));var toCsv=require(_0x135c('0x9'));var querystring=require(_0x135c('0x10'));var Papa=require(_0x135c('0x11'));var Redis=require(_0x135c('0x12'));var authService=require(_0x135c('0x13'));var qs=require(_0x135c('0x14'));var as=require(_0x135c('0x15'));var hardwareService=require(_0x135c('0x16'));var logger=require(_0x135c('0x17'))(_0x135c('0x18'));var utils=require('../../config/utils');var config=require(_0x135c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x135c('0x1a'))['db'];var integrations=require(_0x135c('0x1b'));function respondWithStatusCode(_0x4324f5,_0xa73e10){_0xa73e10=_0xa73e10||0xcc;return function(_0x46b5e2){if(_0x46b5e2){return _0x4324f5[_0x135c('0x1c')](_0xa73e10);}return _0x4324f5[_0x135c('0x1d')](_0xa73e10)[_0x135c('0x1e')]();};}function respondWithResult(_0x3df95c,_0x5ace1f){_0x5ace1f=_0x5ace1f||0xc8;return function(_0x1e7ba8){if(_0x1e7ba8){return _0x3df95c['status'](_0x5ace1f)['json'](_0x1e7ba8);}};}function respondWithFilteredResult(_0x1916f4,_0x52212e){return function(_0xd2f45d){if(_0xd2f45d){var _0x3949cc=typeof _0x52212e[_0x135c('0x1f')]===_0x135c('0x20')&&typeof _0x52212e[_0x135c('0x21')]===_0x135c('0x20');var _0x3ce58a=_0xd2f45d[_0x135c('0x22')];var _0x10e042=_0x3949cc?0x0:_0x52212e[_0x135c('0x1f')];var _0x1cc5e4=_0x3949cc?_0xd2f45d[_0x135c('0x22')]:_0x52212e[_0x135c('0x1f')]+_0x52212e[_0x135c('0x21')];var _0xdc30ee;if(_0x1cc5e4>=_0x3ce58a){_0x1cc5e4=_0x3ce58a;_0xdc30ee=0xc8;}else{_0xdc30ee=0xce;}_0x1916f4[_0x135c('0x1d')](_0xdc30ee);return _0x1916f4[_0x135c('0x23')]('Content-Range',_0x10e042+'-'+_0x1cc5e4+'/'+_0x3ce58a)['json'](_0xd2f45d);}return null;};}function patchUpdates(_0x4c7c88){return function(_0x507518){try{jsonpatch[_0x135c('0x24')](_0x507518,_0x4c7c88,!![]);}catch(_0x2b4941){return BPromise[_0x135c('0x25')](_0x2b4941);}return _0x507518[_0x135c('0x26')]();};}function saveUpdates(_0x29be03,_0x3ab03f){return function(_0x1f816e){if(_0x1f816e){return _0x1f816e[_0x135c('0x27')](_0x29be03)['then'](function(_0x207c00){return _0x207c00;});}return null;};}function removeEntity(_0x1ba195,_0x4e3f3e){return function(_0x45e505){if(_0x45e505){return _0x45e505[_0x135c('0x28')]()[_0x135c('0x29')](function(){_0x1ba195[_0x135c('0x1d')](0xcc)[_0x135c('0x1e')]();});}};}function handleEntityNotFound(_0x10d70f,_0x325e18){return function(_0x12dc3f){if(!_0x12dc3f){_0x10d70f[_0x135c('0x1c')](0x194);}return _0x12dc3f;};}function handleError(_0x5a403d,_0x5353d5){_0x5353d5=_0x5353d5||0x1f4;return function(_0x44f394){logger[_0x135c('0x2a')](_0x44f394[_0x135c('0x2b')]);if(_0x44f394[_0x135c('0x2c')]){delete _0x44f394['name'];}_0x5a403d[_0x135c('0x1d')](_0x5353d5)['send'](_0x44f394);};}exports[_0x135c('0x2d')]=function(_0xc97881,_0x475583){var _0x226619={},_0x3f5f15={},_0x272c70={'count':0x0,'rows':[]};var _0x18121f=_[_0x135c('0x2e')](db[_0x135c('0x2f')]['rawAttributes'],function(_0x2fad65){return{'name':_0x2fad65['fieldName'],'type':_0x2fad65[_0x135c('0x30')]['key']};});_0x3f5f15[_0x135c('0x31')]=_[_0x135c('0x2e')](_0x18121f,_0x135c('0x2c'));_0x3f5f15['query']=_[_0x135c('0x32')](_0xc97881[_0x135c('0x33')]);_0x3f5f15['filters']=_[_0x135c('0x34')](_0x3f5f15[_0x135c('0x31')],_0x3f5f15[_0x135c('0x33')]);_0x226619[_0x135c('0x35')]=_[_0x135c('0x34')](_0x3f5f15[_0x135c('0x31')],qs[_0x135c('0x36')](_0xc97881['query'][_0x135c('0x36')]));_0x226619['attributes']=_0x226619[_0x135c('0x35')][_0x135c('0x37')]?_0x226619['attributes']:_0x3f5f15[_0x135c('0x31')];if(!_0xc97881[_0x135c('0x33')][_0x135c('0x38')](_0x135c('0x39'))){_0x226619[_0x135c('0x21')]=qs[_0x135c('0x21')](_0xc97881[_0x135c('0x33')]['limit']);_0x226619[_0x135c('0x1f')]=qs[_0x135c('0x1f')](_0xc97881[_0x135c('0x33')][_0x135c('0x1f')]);}_0x226619['order']=qs[_0x135c('0x3a')](_0xc97881['query']['sort']);_0x226619[_0x135c('0x3b')]=qs[_0x135c('0x3c')](_[_0x135c('0x3d')](_0xc97881[_0x135c('0x33')],_0x3f5f15[_0x135c('0x3c')]),_0x18121f);if(_0xc97881[_0x135c('0x33')][_0x135c('0x3e')]){_0x226619[_0x135c('0x3b')]=_[_0x135c('0x3f')](_0x226619[_0x135c('0x3b')],{'$or':_[_0x135c('0x2e')](_0x18121f,function(_0x5bb293){if(_0x5bb293['type']!==_0x135c('0x40')){var _0x4f4f5c={};_0x4f4f5c[_0x5bb293['name']]={'$like':'%'+_0xc97881[_0x135c('0x33')][_0x135c('0x3e')]+'%'};return _0x4f4f5c;}})});}_0x226619=_[_0x135c('0x3f')]({},_0x226619,_0xc97881['options']);var _0x742c07={'where':_0x226619['where']};return db[_0x135c('0x2f')][_0x135c('0x22')](_0x742c07)[_0x135c('0x29')](function(_0xa8b4cc){_0x272c70[_0x135c('0x22')]=_0xa8b4cc;if(_0xc97881[_0x135c('0x33')][_0x135c('0x41')]){_0x226619['include']=[{'all':!![]}];}return db[_0x135c('0x2f')][_0x135c('0x42')](_0x226619);})[_0x135c('0x29')](function(_0x45ecf9){_0x272c70[_0x135c('0x43')]=_0x45ecf9;return _0x272c70;})['then'](respondWithFilteredResult(_0x475583,_0x226619))[_0x135c('0x44')](handleError(_0x475583,null));};exports[_0x135c('0x45')]=function(_0x5714a9,_0x4bae44){var _0x1acdfc={'raw':![],'where':{'id':_0x5714a9[_0x135c('0x46')]['id']}},_0x402003={};_0x402003['model']=_[_0x135c('0x32')](db[_0x135c('0x2f')][_0x135c('0x47')]);_0x402003['query']=_[_0x135c('0x32')](_0x5714a9[_0x135c('0x33')]);_0x402003[_0x135c('0x3c')]=_[_0x135c('0x34')](_0x402003[_0x135c('0x31')],_0x402003['query']);_0x1acdfc[_0x135c('0x35')]=_[_0x135c('0x34')](_0x402003[_0x135c('0x31')],qs['fields'](_0x5714a9['query']['fields']));_0x1acdfc['attributes']=_0x1acdfc[_0x135c('0x35')][_0x135c('0x37')]?_0x1acdfc[_0x135c('0x35')]:_0x402003[_0x135c('0x31')];if(_0x5714a9['query'][_0x135c('0x41')]){_0x1acdfc[_0x135c('0x48')]=[{'all':!![]}];}_0x1acdfc=_[_0x135c('0x3f')]({},_0x1acdfc,_0x5714a9[_0x135c('0x49')]);return db['FreshsalesAccount']['find'](_0x1acdfc)[_0x135c('0x29')](handleEntityNotFound(_0x4bae44,null))['then'](respondWithResult(_0x4bae44,null))[_0x135c('0x44')](handleError(_0x4bae44,null));};exports[_0x135c('0x4a')]=function(_0x409668,_0x563a3c){return db['FreshsalesAccount'][_0x135c('0x4a')](_0x409668[_0x135c('0x4b')],{})[_0x135c('0x29')](respondWithResult(_0x563a3c,0xc9))['catch'](handleError(_0x563a3c,null));};exports[_0x135c('0x27')]=function(_0x59ed98,_0x26a2fd){if(_0x59ed98[_0x135c('0x4b')]['id']){delete _0x59ed98[_0x135c('0x4b')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x59ed98[_0x135c('0x46')]['id']}})[_0x135c('0x29')](handleEntityNotFound(_0x26a2fd,null))[_0x135c('0x29')](saveUpdates(_0x59ed98[_0x135c('0x4b')],null))[_0x135c('0x29')](respondWithResult(_0x26a2fd,null))[_0x135c('0x44')](handleError(_0x26a2fd,null));};exports[_0x135c('0x28')]=function(_0x2d4c01,_0x1f018b){return db[_0x135c('0x2f')][_0x135c('0x4c')]({'where':{'id':_0x2d4c01['params']['id']}})[_0x135c('0x29')](handleEntityNotFound(_0x1f018b,null))[_0x135c('0x29')](removeEntity(_0x1f018b,null))[_0x135c('0x44')](handleError(_0x1f018b,null));};exports[_0x135c('0x4d')]=function(_0x4ac39b,_0x1a8942,_0x4c9e7c){var _0x23f595={};var _0x115d60={};var _0x28c902;var _0x34b03a;return db[_0x135c('0x2f')][_0x135c('0x4e')]({'where':{'id':_0x4ac39b[_0x135c('0x46')]['id']}})[_0x135c('0x29')](handleEntityNotFound(_0x1a8942,null))[_0x135c('0x29')](function(_0x5b56b8){if(_0x5b56b8){_0x28c902=_0x5b56b8;_0x115d60[_0x135c('0x31')]=_['keys'](db[_0x135c('0x4f')]['rawAttributes']);_0x115d60['query']=_[_0x135c('0x32')](_0x4ac39b['query']);_0x115d60['filters']=_[_0x135c('0x34')](_0x115d60[_0x135c('0x31')],_0x115d60[_0x135c('0x33')]);_0x23f595['attributes']=_[_0x135c('0x34')](_0x115d60[_0x135c('0x31')],qs[_0x135c('0x36')](_0x4ac39b[_0x135c('0x33')][_0x135c('0x36')]));_0x23f595[_0x135c('0x35')]=_0x23f595[_0x135c('0x35')][_0x135c('0x37')]?_0x23f595[_0x135c('0x35')]:_0x115d60[_0x135c('0x31')];_0x23f595['order']=qs[_0x135c('0x3a')](_0x4ac39b[_0x135c('0x33')][_0x135c('0x3a')]);_0x23f595[_0x135c('0x3b')]=qs[_0x135c('0x3c')](_['pick'](_0x4ac39b[_0x135c('0x33')],_0x115d60[_0x135c('0x3c')]));if(_0x4ac39b[_0x135c('0x33')]['filter']){_0x23f595[_0x135c('0x3b')]=_[_0x135c('0x3f')](_0x23f595[_0x135c('0x3b')],{'$or':_[_0x135c('0x2e')](_0x23f595[_0x135c('0x35')],function(_0x4f1fb5){var _0x47463d={};_0x47463d[_0x4f1fb5]={'$like':'%'+_0x4ac39b[_0x135c('0x33')][_0x135c('0x3e')]+'%'};return _0x47463d;})});}_0x23f595=_[_0x135c('0x3f')]({},_0x23f595,_0x4ac39b[_0x135c('0x49')]);return _0x28c902[_0x135c('0x4d')](_0x23f595);}})[_0x135c('0x29')](function(_0x5b2a28){if(_0x5b2a28){_0x34b03a=_0x5b2a28[_0x135c('0x37')];if(!_0x4ac39b[_0x135c('0x33')][_0x135c('0x38')](_0x135c('0x39'))){_0x23f595['limit']=qs[_0x135c('0x21')](_0x4ac39b[_0x135c('0x33')][_0x135c('0x21')]);_0x23f595['offset']=qs[_0x135c('0x1f')](_0x4ac39b[_0x135c('0x33')][_0x135c('0x1f')]);}return _0x28c902[_0x135c('0x4d')](_0x23f595);}})[_0x135c('0x29')](function(_0x560b22){if(_0x560b22){return _0x560b22?{'count':_0x34b03a,'rows':_0x560b22}:null;}})[_0x135c('0x29')](respondWithResult(_0x1a8942,null))[_0x135c('0x44')](handleError(_0x1a8942,null));};exports[_0x135c('0x50')]=function(_0x4166aa,_0x25304c,_0x1060e7){if(_0x4166aa['body']['id']){delete _0x4166aa[_0x135c('0x4b')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4166aa[_0x135c('0x46')]['id']}})[_0x135c('0x29')](handleEntityNotFound(_0x25304c,null))[_0x135c('0x29')](function(_0x116625){if(_0x116625){_0x4166aa[_0x135c('0x4b')]['AccountId']=_0x116625['id'];_0x4166aa[_0x135c('0x4b')][_0x135c('0x51')]=integrations['getSubjects'](_0x4166aa['body'][_0x135c('0x52')],_0x4166aa[_0x135c('0x4b')][_0x135c('0x30')]);_0x4166aa[_0x135c('0x4b')]['Descriptions']=integrations[_0x135c('0x53')](_0x4166aa[_0x135c('0x4b')][_0x135c('0x52')],_0x4166aa['body']['type']);return db[_0x135c('0x4f')][_0x135c('0x4a')](_0x4166aa[_0x135c('0x4b')],{'include':[{'model':db[_0x135c('0x54')],'as':_0x135c('0x51')},{'model':db[_0x135c('0x54')],'as':_0x135c('0x55')}]});}return null;})['then'](respondWithResult(_0x25304c,null))[_0x135c('0x44')](handleError(_0x25304c,null));};exports[_0x135c('0x56')]=function(_0xc32964,_0x549a4f,_0x3e28d5){var _0x240c73='';var _0x7d45d8='';return db['FreshsalesAccount'][_0x135c('0x4e')]({'where':{'id':_0xc32964[_0x135c('0x46')]['id']},'attributes':['id',_0x135c('0x57'),_0x135c('0x58'),_0x135c('0x59')]})['then'](handleEntityNotFound(_0x549a4f,null))[_0x135c('0x29')](function(_0x21799e){if(_0x21799e){_0x7d45d8=_0x21799e[_0x135c('0x57')];_0x240c73=_0x21799e[_0x135c('0x58')];var _0x22d392=_0x21799e[_0x135c('0x58')][_0x135c('0x5a')](-0x1);if(_0x22d392==='/'){_0x240c73=_0x240c73[_0x135c('0x5b')](0x0,_0x240c73[_0x135c('0x5c')](_0x22d392));}return rp({'method':_0x135c('0x5d'),'uri':util[_0x135c('0x5e')](_0x135c('0x5f'),_0x240c73,_0x135c('0x60')),'headers':{'Authorization':_0x135c('0x61')+_0x21799e['apiKey']},'json':!![]});}})[_0x135c('0x29')](function(_0x5d6be7){if(_0x5d6be7){var _0x12d9e0=_0x5d6be7[_0x135c('0x62')];var _0x66f3f=![];var _0x199ebe=null;for(_0x199ebe=0x0;_0x199ebe<_0x12d9e0[_0x135c('0x37')];_0x199ebe++){if(_0x12d9e0[_0x199ebe][_0x135c('0x63')]===_0x7d45d8){_0x66f3f=!![];}}if(_0x66f3f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x135c('0x64')});}}})[_0x135c('0x29')](respondWithResult(_0x549a4f,null))['catch'](function(_0x6ee477){var _0x1ef5c9=_0xc32964[_0x135c('0x33')][_0x135c('0x65')]?0x1f4:_0x6ee477['statusCode']||0x1f4;logger[_0x135c('0x2a')](_0x135c('0x66'),_0x135c('0x56'),_0x1ef5c9,JSON[_0x135c('0x67')](_0x6ee477));delete _0x6ee477[_0x135c('0x2c')];if(_0x1ef5c9===0x191){_0x1ef5c9=0x190;}_0x549a4f[_0x135c('0x1d')](_0x1ef5c9)[_0x135c('0x68')](_0xc32964['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x6ee477['statusCode']}:_0x6ee477);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8f95bd0..b133140 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 _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x6a55,0xdb));var _0x56a5=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x6a55[_0x2eea9a];return _0x1ec61e;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1e82b6,_0x4d8f82){var _0x5eaa3c=function(_0x195fbc){while(--_0x195fbc){_0x1e82b6['push'](_0x1e82b6['shift']());}};_0x5eaa3c(++_0x4d8f82);}(_0x7278,0x161));var _0x8727=function(_0x240ac2,_0x10c2b5){_0x240ac2=_0x240ac2-0x0;var _0x429638=_0x7278[_0x240ac2];return _0x429638;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));var integrations=require(_0x8727('0xa'));module[_0x8727('0xb')]=function(_0x5549d5,_0xfd1902){return _0x5549d5[_0x8727('0xc')](_0x8727('0xd'),attributes,{'tableName':_0x8727('0xe'),'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 03b4d85..754fd01 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 _0xd943=['limit','include','map','model','attributes','debug','ShowFreshsalesAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where'];(function(_0x435150,_0x591cd9){var _0x13b3a4=function(_0x44eb28){while(--_0x44eb28){_0x435150['push'](_0x435150['shift']());}};_0x13b3a4(++_0x591cd9);}(_0xd943,0x15d));var _0x3d94=function(_0x2ccfa0,_0x53bc22){_0x2ccfa0=_0x2ccfa0-0x0;var _0x4d0510=_0xd943[_0x2ccfa0];return _0x4d0510;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['findAll']({'raw':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options'][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x18')]||null:null,'attributes':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options']['attributes']||null:null,'limit':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x19')]||null:null,'include':_0x2acee3['options']?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')],function(_0x4093a4){return{'model':db[_0x4093a4[_0x3d94('0x1c')]],'as':_0x4093a4['as'],'attributes':_0x4093a4[_0x3d94('0x1d')],'include':_0x4093a4[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4093a4[_0x3d94('0x1a')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1c')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1d')],'include':_0x192839[_0x3d94('0x1a')]?_['map'](_0x192839[_0x3d94('0x1a')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1c')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xa')](function(_0x439173){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1e')]('GetFreshsalesAccount',_0x2acee3,JSON['stringify'](_0x439173));_0x4afc92(_0x439173);})[_0x3d94('0x13')](function(_0x4813e1){logger['error'](_0x3d94('0x14'),_0x4813e1['message'],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0x4813e1[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1f')]=function(_0x4cef9c){var _0x2a07b4=this;return new Promise(function(_0x4c1237,_0x3d4994){return db['FreshsalesAccount'][_0x3d94('0x20')]({'raw':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')]['where']||null:null,'attributes':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')]['attributes']||null:null,'include':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4cef9c['options'][_0x3d94('0x1a')],function(_0x3d29fd){return{'model':db[_0x3d29fd['model']],'as':_0x3d29fd['as'],'attributes':_0x3d29fd[_0x3d94('0x1d')],'include':_0x3d29fd[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x3d29fd[_0x3d94('0x1a')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1d')],'include':_0x782c1[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x782c1[_0x3d94('0x1a')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1c')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe58eb){logger[_0x3d94('0xb')](_0x3d94('0x1f'),_0x4cef9c);logger[_0x3d94('0x1e')](_0x3d94('0x1f'),_0x4cef9c,JSON[_0x3d94('0x21')](_0xfe58eb));_0x4c1237(_0xfe58eb);})[_0x3d94('0x13')](function(_0x12c01a){logger[_0x3d94('0xe')](_0x3d94('0x1f'),_0x12c01a['message'],_0x4cef9c);_0x3d4994(_0x2a07b4[_0x3d94('0xe')](0x1f4,_0x12c01a[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x5c3c=['find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','debug','catch','ShowFreshsalesAccount'];(function(_0x1216d2,_0x50dda4){var _0xf213e2=function(_0x10a974){while(--_0x10a974){_0x1216d2['push'](_0x1216d2['shift']());}};_0xf213e2(++_0x50dda4);}(_0x5c3c,0x132));var _0xc5c3=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x5c3c[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')]({'raw':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['attributes']||null:null,'limit':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1c')]||null:null,'include':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x2ff158['options']['include'],function(_0x45affe){return{'model':db[_0x45affe[_0xc5c3('0x1f')]],'as':_0x45affe['as'],'attributes':_0x45affe['attributes'],'include':_0x45affe['include']?_[_0xc5c3('0x1e')](_0x45affe[_0xc5c3('0x1d')],function(_0x38a3df){return{'model':db[_0x38a3df['model']],'as':_0x38a3df['as'],'attributes':_0x38a3df['attributes'],'include':_0x38a3df[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x38a3df[_0xc5c3('0x1d')],function(_0x29791c){return{'model':db[_0x29791c['model']],'as':_0x29791c['as'],'attributes':_0x29791c[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eacec){logger['info'](_0xc5c3('0x17'),_0x2ff158);logger[_0xc5c3('0x21')](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x2eacec));_0x28bae6(_0x2eacec);})[_0xc5c3('0x22')](function(_0x2d07e1){logger[_0xc5c3('0x12')]('GetFreshsalesAccount',_0x2d07e1[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2d07e1[_0xc5c3('0x14')]));});});};exports[_0xc5c3('0x23')]=function(_0x5b26e9){var _0x4daa8b=this;return new Promise(function(_0x2e648f,_0x46f149){return db[_0xc5c3('0x18')][_0xc5c3('0x24')]({'raw':_0x5b26e9['options']?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x25')]===undefined?!![]:![]:!![],'where':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x20')]||null:null,'include':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9['options'][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1d')],function(_0x330391){return{'model':db[_0x330391[_0xc5c3('0x1f')]],'as':_0x330391['as'],'attributes':_0x330391[_0xc5c3('0x20')],'include':_0x330391['include']?_['map'](_0x330391[_0xc5c3('0x1d')],function(_0x55fccf){return{'model':db[_0x55fccf[_0xc5c3('0x1f')]],'as':_0x55fccf['as'],'attributes':_0x55fccf[_0xc5c3('0x20')],'include':_0x55fccf[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x55fccf[_0xc5c3('0x1d')],function(_0x498677){return{'model':db[_0x498677[_0xc5c3('0x1f')]],'as':_0x498677['as'],'attributes':_0x498677[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f57d){logger[_0xc5c3('0x15')](_0xc5c3('0x23'),_0x5b26e9);logger[_0xc5c3('0x21')](_0xc5c3('0x23'),_0x5b26e9,JSON[_0xc5c3('0x11')](_0x29f57d));_0x2e648f(_0x29f57d);})[_0xc5c3('0x22')](function(_0x2ad440){logger[_0xc5c3('0x12')](_0xc5c3('0x23'),_0x2ad440['message'],_0x5b26e9);_0x46f149(_0x4daa8b[_0xc5c3('0x12')](0x1f4,_0x2ad440['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 0666f26..34fcf81 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 _0x2013=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2013,0x111));var _0x3201=function(_0x1dcd67,_0x35d318){_0x1dcd67=_0x1dcd67-0x0;var _0x4b21e0=_0x2013[_0x1dcd67];return _0x4b21e0;};'use strict';var multer=require(_0x3201('0x0'));var util=require(_0x3201('0x1'));var path=require(_0x3201('0x2'));var timeout=require(_0x3201('0x3'));var express=require('express');var router=express[_0x3201('0x4')]();var fs_extra=require(_0x3201('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3201('0x6'));var config=require(_0x3201('0x7'));var controller=require(_0x3201('0x8'));router[_0x3201('0x9')]('/',auth[_0x3201('0xa')](),controller['index']);router[_0x3201('0x9')](_0x3201('0xb'),auth[_0x3201('0xa')](),controller[_0x3201('0xc')]);router[_0x3201('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x3201('0xd'),auth[_0x3201('0xa')](),controller[_0x3201('0xe')]);router[_0x3201('0x9')](_0x3201('0xf'),auth[_0x3201('0xa')](),controller[_0x3201('0x10')]);router[_0x3201('0x11')]('/',auth[_0x3201('0xa')](),controller[_0x3201('0x12')]);router[_0x3201('0x13')](_0x3201('0xb'),auth[_0x3201('0xa')](),controller['update']);router[_0x3201('0x14')]('/:id',auth[_0x3201('0xa')](),controller[_0x3201('0x15')]);module[_0x3201('0x16')]=router; \ No newline at end of file +var _0xcd98=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','/:id/subjects','getDescriptions','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1fa8ce,_0x3dc572){var _0xe5715d=function(_0x274fac){while(--_0x274fac){_0x1fa8ce['push'](_0x1fa8ce['shift']());}};_0xe5715d(++_0x3dc572);}(_0xcd98,0x10c));var _0x8cd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd98[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8cd9('0x0'));var util=require('util');var path=require(_0x8cd9('0x1'));var timeout=require(_0x8cd9('0x2'));var express=require('express');var router=express[_0x8cd9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8cd9('0x4'));var interaction=require(_0x8cd9('0x5'));var config=require(_0x8cd9('0x6'));var controller=require(_0x8cd9('0x7'));router[_0x8cd9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8cd9('0x8')](_0x8cd9('0x9'),auth[_0x8cd9('0xa')](),controller['show']);router[_0x8cd9('0x8')](_0x8cd9('0xb'),auth[_0x8cd9('0xa')](),controller['getSubjects']);router[_0x8cd9('0x8')]('/:id/descriptions',auth[_0x8cd9('0xa')](),controller[_0x8cd9('0xc')]);router['get']('/:id/fields',auth[_0x8cd9('0xa')](),controller[_0x8cd9('0xd')]);router[_0x8cd9('0xe')]('/',auth[_0x8cd9('0xa')](),controller[_0x8cd9('0xf')]);router[_0x8cd9('0x10')](_0x8cd9('0x9'),auth['isAuthenticated'](),controller[_0x8cd9('0x11')]);router[_0x8cd9('0x12')](_0x8cd9('0x9'),auth[_0x8cd9('0xa')](),controller[_0x8cd9('0x13')]);module[_0x8cd9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6ca972e..22a2404 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 _0x0ade=['STRING'];(function(_0x188c88,_0x210793){var _0x4e4c38=function(_0x3d9e41){while(--_0x3d9e41){_0x188c88['push'](_0x188c88['shift']());}};_0x4e4c38(++_0x210793);}(_0x0ade,0x82));var _0xe0ad=function(_0xc94f90,_0x5d7f52){_0xc94f90=_0xc94f90-0x0;var _0x546e42=_0x0ade[_0xc94f90];return _0x546e42;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe0ad('0x0')]},'description':{'type':Sequelize[_0xe0ad('0x0')]}}; \ No newline at end of file +var _0x6e6c=['exports','STRING','sequelize'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x6e6c,0xf2));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'name':{'type':Sequelize[_0xc6e6('0x2')]},'description':{'type':Sequelize[_0xc6e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d2fb2de..42c7a44 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 _0x4be7=['end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','bluebird','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','../../mysqldb','sendStatus','status'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x4be7,0x16f));var _0x74be=function(_0x3500f2,_0x142fb1){_0x3500f2=_0x3500f2-0x0;var _0x7ad03f=_0x4be7[_0x3500f2];return _0x7ad03f;};'use strict';var emlformat=require(_0x74be('0x0'));var rimraf=require(_0x74be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x74be('0x2'));var moment=require(_0x74be('0x3'));var BPromise=require(_0x74be('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x74be('0x5'));var sox=require(_0x74be('0x6'));var csv=require(_0x74be('0x7'));var ejs=require(_0x74be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74be('0x9'));var squel=require('squel');var crypto=require(_0x74be('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x74be('0xb'));var toCsv=require(_0x74be('0x7'));var querystring=require(_0x74be('0xc'));var Papa=require(_0x74be('0xd'));var Redis=require(_0x74be('0xe'));var authService=require(_0x74be('0xf'));var qs=require(_0x74be('0x10'));var as=require(_0x74be('0x11'));var hardwareService=require(_0x74be('0x12'));var logger=require(_0x74be('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74be('0x14'))['db'];function respondWithStatusCode(_0xb266da,_0x10b23b){_0x10b23b=_0x10b23b||0xcc;return function(_0x474e8c){if(_0x474e8c){return _0xb266da[_0x74be('0x15')](_0x10b23b);}return _0xb266da[_0x74be('0x16')](_0x10b23b)[_0x74be('0x17')]();};}function respondWithResult(_0x2fa66c,_0x13d628){_0x13d628=_0x13d628||0xc8;return function(_0x206d46){if(_0x206d46){return _0x2fa66c[_0x74be('0x16')](_0x13d628)['json'](_0x206d46);}};}function respondWithFilteredResult(_0x5bfa13,_0x4909ad){return function(_0x52c2d5){if(_0x52c2d5){var _0x2fda71=typeof _0x4909ad[_0x74be('0x18')]===_0x74be('0x19')&&typeof _0x4909ad[_0x74be('0x1a')]==='undefined';var _0x585f54=_0x52c2d5['count'];var _0x6def45=_0x2fda71?0x0:_0x4909ad['offset'];var _0x4e46d0=_0x2fda71?_0x52c2d5[_0x74be('0x1b')]:_0x4909ad[_0x74be('0x18')]+_0x4909ad['limit'];var _0x44cf60;if(_0x4e46d0>=_0x585f54){_0x4e46d0=_0x585f54;_0x44cf60=0xc8;}else{_0x44cf60=0xce;}_0x5bfa13[_0x74be('0x16')](_0x44cf60);return _0x5bfa13[_0x74be('0x1c')](_0x74be('0x1d'),_0x6def45+'-'+_0x4e46d0+'/'+_0x585f54)[_0x74be('0x1e')](_0x52c2d5);}return null;};}function patchUpdates(_0x44d458){return function(_0x4ec0d5){try{jsonpatch[_0x74be('0x1f')](_0x4ec0d5,_0x44d458,!![]);}catch(_0x532923){return BPromise[_0x74be('0x20')](_0x532923);}return _0x4ec0d5[_0x74be('0x21')]();};}function saveUpdates(_0x150057,_0x4ecb78){return function(_0x22c3d8){if(_0x22c3d8){return _0x22c3d8[_0x74be('0x22')](_0x150057)[_0x74be('0x23')](function(_0x2d2a5b){return _0x2d2a5b;});}return null;};}function removeEntity(_0x166e09,_0x372cb3){return function(_0x274878){if(_0x274878){return _0x274878[_0x74be('0x24')]()['then'](function(){_0x166e09[_0x74be('0x16')](0xcc)[_0x74be('0x17')]();});}};}function handleEntityNotFound(_0x336978,_0x3ac6c8){return function(_0x5d88f6){if(!_0x5d88f6){_0x336978[_0x74be('0x15')](0x194);}return _0x5d88f6;};}function handleError(_0x5b8633,_0x1d815f){_0x1d815f=_0x1d815f||0x1f4;return function(_0xf6fc30){logger[_0x74be('0x25')](_0xf6fc30[_0x74be('0x26')]);if(_0xf6fc30['name']){delete _0xf6fc30[_0x74be('0x27')];}_0x5b8633[_0x74be('0x16')](_0x1d815f)[_0x74be('0x28')](_0xf6fc30);};}exports[_0x74be('0x29')]=function(_0x173b8e,_0x184a5c){var _0x566098={},_0xa85903={},_0xe68c6c={'count':0x0,'rows':[]};var _0x30ea93=_[_0x74be('0x2a')](db[_0x74be('0x2b')][_0x74be('0x2c')],function(_0x546c81){return{'name':_0x546c81['fieldName'],'type':_0x546c81[_0x74be('0x2d')][_0x74be('0x2e')]};});_0xa85903['model']=_['map'](_0x30ea93,_0x74be('0x27'));_0xa85903['query']=_[_0x74be('0x2f')](_0x173b8e[_0x74be('0x30')]);_0xa85903[_0x74be('0x31')]=_[_0x74be('0x32')](_0xa85903[_0x74be('0x33')],_0xa85903[_0x74be('0x30')]);_0x566098[_0x74be('0x34')]=_['intersection'](_0xa85903['model'],qs[_0x74be('0x35')](_0x173b8e[_0x74be('0x30')][_0x74be('0x35')]));_0x566098[_0x74be('0x34')]=_0x566098[_0x74be('0x34')][_0x74be('0x36')]?_0x566098[_0x74be('0x34')]:_0xa85903[_0x74be('0x33')];if(!_0x173b8e['query']['hasOwnProperty'](_0x74be('0x37'))){_0x566098[_0x74be('0x1a')]=qs[_0x74be('0x1a')](_0x173b8e[_0x74be('0x30')][_0x74be('0x1a')]);_0x566098[_0x74be('0x18')]=qs[_0x74be('0x18')](_0x173b8e[_0x74be('0x30')][_0x74be('0x18')]);}_0x566098['order']=qs['sort'](_0x173b8e[_0x74be('0x30')][_0x74be('0x38')]);_0x566098[_0x74be('0x39')]=qs[_0x74be('0x31')](_[_0x74be('0x3a')](_0x173b8e[_0x74be('0x30')],_0xa85903[_0x74be('0x31')]),_0x30ea93);if(_0x173b8e[_0x74be('0x30')][_0x74be('0x3b')]){_0x566098['where']=_[_0x74be('0x3c')](_0x566098[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x30ea93,function(_0x566818){if(_0x566818[_0x74be('0x2d')]!=='VIRTUAL'){var _0x3bdc15={};_0x3bdc15[_0x566818[_0x74be('0x27')]]={'$like':'%'+_0x173b8e[_0x74be('0x30')][_0x74be('0x3b')]+'%'};return _0x3bdc15;}})});}_0x566098=_[_0x74be('0x3c')]({},_0x566098,_0x173b8e['options']);var _0x5a687d={'where':_0x566098[_0x74be('0x39')]};return db['FreshsalesConfiguration']['count'](_0x5a687d)[_0x74be('0x23')](function(_0x37e752){_0xe68c6c['count']=_0x37e752;if(_0x173b8e[_0x74be('0x30')][_0x74be('0x3d')]){_0x566098[_0x74be('0x3e')]=[{'all':!![]}];}return db[_0x74be('0x2b')][_0x74be('0x3f')](_0x566098);})[_0x74be('0x23')](function(_0x2925ef){_0xe68c6c[_0x74be('0x40')]=_0x2925ef;return _0xe68c6c;})[_0x74be('0x23')](respondWithFilteredResult(_0x184a5c,_0x566098))[_0x74be('0x41')](handleError(_0x184a5c,null));};exports[_0x74be('0x42')]=function(_0x327295,_0x18de8e){var _0x2f8f69={'raw':![],'where':{'id':_0x327295[_0x74be('0x43')]['id']}},_0x49154a={};_0x49154a['model']=_[_0x74be('0x2f')](db['FreshsalesConfiguration'][_0x74be('0x2c')]);_0x49154a[_0x74be('0x30')]=_[_0x74be('0x2f')](_0x327295[_0x74be('0x30')]);_0x49154a[_0x74be('0x31')]=_[_0x74be('0x32')](_0x49154a[_0x74be('0x33')],_0x49154a['query']);_0x2f8f69[_0x74be('0x34')]=_[_0x74be('0x32')](_0x49154a[_0x74be('0x33')],qs[_0x74be('0x35')](_0x327295['query'][_0x74be('0x35')]));_0x2f8f69[_0x74be('0x34')]=_0x2f8f69[_0x74be('0x34')][_0x74be('0x36')]?_0x2f8f69[_0x74be('0x34')]:_0x49154a[_0x74be('0x33')];if(_0x327295['query']['includeAll']){_0x2f8f69['include']=[{'all':!![]}];}_0x2f8f69=_[_0x74be('0x3c')]({},_0x2f8f69,_0x327295[_0x74be('0x44')]);return db[_0x74be('0x2b')]['find'](_0x2f8f69)[_0x74be('0x23')](handleEntityNotFound(_0x18de8e,null))[_0x74be('0x23')](respondWithResult(_0x18de8e,null))[_0x74be('0x41')](handleError(_0x18de8e,null));};exports[_0x74be('0x45')]=function(_0x1dce69,_0x3fb867){return db[_0x74be('0x2b')][_0x74be('0x45')](_0x1dce69[_0x74be('0x46')],{})[_0x74be('0x23')](respondWithResult(_0x3fb867,0xc9))[_0x74be('0x41')](handleError(_0x3fb867,null));};exports['update']=function(_0x36c185,_0x29c284){if(_0x36c185['body']['id']){delete _0x36c185[_0x74be('0x46')]['id'];}return db[_0x74be('0x2b')][_0x74be('0x47')]({'where':{'id':_0x36c185[_0x74be('0x43')]['id']}})['then'](handleEntityNotFound(_0x29c284,null))[_0x74be('0x23')](saveUpdates(_0x36c185[_0x74be('0x46')],null))[_0x74be('0x23')](respondWithResult(_0x29c284,null))[_0x74be('0x41')](handleError(_0x29c284,null));};exports[_0x74be('0x24')]=function(_0x530dad,_0x9926ba){return db[_0x74be('0x2b')][_0x74be('0x47')]({'where':{'id':_0x530dad[_0x74be('0x43')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x9926ba,null))[_0x74be('0x23')](removeEntity(_0x9926ba,null))[_0x74be('0x41')](handleError(_0x9926ba,null));};exports[_0x74be('0x48')]=function(_0x2d96a4,_0x12859f,_0x579808){var _0x386a7e={};var _0x58fe4c={};var _0x5ebc4c;var _0x107fbc;return db[_0x74be('0x2b')][_0x74be('0x49')]({'where':{'id':_0x2d96a4[_0x74be('0x43')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x12859f,null))['then'](function(_0x710c5b){if(_0x710c5b){_0x5ebc4c=_0x710c5b;_0x58fe4c['model']=_[_0x74be('0x2f')](db[_0x74be('0x4a')][_0x74be('0x2c')]);_0x58fe4c['query']=_[_0x74be('0x2f')](_0x2d96a4[_0x74be('0x30')]);_0x58fe4c[_0x74be('0x31')]=_[_0x74be('0x32')](_0x58fe4c['model'],_0x58fe4c[_0x74be('0x30')]);_0x386a7e[_0x74be('0x34')]=_['intersection'](_0x58fe4c['model'],qs[_0x74be('0x35')](_0x2d96a4[_0x74be('0x30')][_0x74be('0x35')]));_0x386a7e[_0x74be('0x34')]=_0x386a7e[_0x74be('0x34')][_0x74be('0x36')]?_0x386a7e[_0x74be('0x34')]:_0x58fe4c['model'];_0x386a7e['order']=qs[_0x74be('0x38')](_0x2d96a4[_0x74be('0x30')]['sort']);_0x386a7e[_0x74be('0x39')]=qs[_0x74be('0x31')](_['pick'](_0x2d96a4[_0x74be('0x30')],_0x58fe4c[_0x74be('0x31')]));if(_0x2d96a4[_0x74be('0x30')]['filter']){_0x386a7e[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x386a7e[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x386a7e['attributes'],function(_0xca1bb3){var _0xa580ee={};_0xa580ee[_0xca1bb3]={'$like':'%'+_0x2d96a4[_0x74be('0x30')][_0x74be('0x3b')]+'%'};return _0xa580ee;})});}_0x386a7e=_[_0x74be('0x3c')]({},_0x386a7e,_0x2d96a4[_0x74be('0x44')]);return _0x5ebc4c['getSubjects'](_0x386a7e);}})[_0x74be('0x23')](function(_0x21dfdc){if(_0x21dfdc){_0x107fbc=_0x21dfdc[_0x74be('0x36')];if(!_0x2d96a4[_0x74be('0x30')][_0x74be('0x4b')](_0x74be('0x37'))){_0x386a7e[_0x74be('0x1a')]=qs[_0x74be('0x1a')](_0x2d96a4['query'][_0x74be('0x1a')]);_0x386a7e[_0x74be('0x18')]=qs[_0x74be('0x18')](_0x2d96a4[_0x74be('0x30')]['offset']);}return _0x5ebc4c[_0x74be('0x48')](_0x386a7e);}})[_0x74be('0x23')](function(_0x1b0894){if(_0x1b0894){return _0x1b0894?{'count':_0x107fbc,'rows':_0x1b0894}:null;}})[_0x74be('0x23')](respondWithResult(_0x12859f,null))[_0x74be('0x41')](handleError(_0x12859f,null));};exports[_0x74be('0x4c')]=function(_0x480960,_0x3ead83,_0x253bf8){var _0x58ba65={};var _0x49dde5={};var _0x53d9cc;var _0x4dcbc5;return db[_0x74be('0x2b')][_0x74be('0x49')]({'where':{'id':_0x480960['params']['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x3ead83,null))[_0x74be('0x23')](function(_0x4f1469){if(_0x4f1469){_0x53d9cc=_0x4f1469;_0x49dde5[_0x74be('0x33')]=_[_0x74be('0x2f')](db[_0x74be('0x4a')][_0x74be('0x2c')]);_0x49dde5[_0x74be('0x30')]=_[_0x74be('0x2f')](_0x480960[_0x74be('0x30')]);_0x49dde5[_0x74be('0x31')]=_[_0x74be('0x32')](_0x49dde5['model'],_0x49dde5[_0x74be('0x30')]);_0x58ba65[_0x74be('0x34')]=_[_0x74be('0x32')](_0x49dde5['model'],qs[_0x74be('0x35')](_0x480960[_0x74be('0x30')][_0x74be('0x35')]));_0x58ba65[_0x74be('0x34')]=_0x58ba65[_0x74be('0x34')][_0x74be('0x36')]?_0x58ba65[_0x74be('0x34')]:_0x49dde5[_0x74be('0x33')];_0x58ba65['order']=qs['sort'](_0x480960[_0x74be('0x30')][_0x74be('0x38')]);_0x58ba65[_0x74be('0x39')]=qs[_0x74be('0x31')](_['pick'](_0x480960[_0x74be('0x30')],_0x49dde5[_0x74be('0x31')]));if(_0x480960['query'][_0x74be('0x3b')]){_0x58ba65[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x58ba65['where'],{'$or':_['map'](_0x58ba65[_0x74be('0x34')],function(_0x4c4bfe){var _0x34cc4b={};_0x34cc4b[_0x4c4bfe]={'$like':'%'+_0x480960[_0x74be('0x30')][_0x74be('0x3b')]+'%'};return _0x34cc4b;})});}_0x58ba65=_[_0x74be('0x3c')]({},_0x58ba65,_0x480960[_0x74be('0x44')]);return _0x53d9cc[_0x74be('0x4c')](_0x58ba65);}})['then'](function(_0x31d860){if(_0x31d860){_0x4dcbc5=_0x31d860[_0x74be('0x36')];if(!_0x480960['query']['hasOwnProperty'](_0x74be('0x37'))){_0x58ba65[_0x74be('0x1a')]=qs[_0x74be('0x1a')](_0x480960[_0x74be('0x30')][_0x74be('0x1a')]);_0x58ba65[_0x74be('0x18')]=qs['offset'](_0x480960['query']['offset']);}return _0x53d9cc[_0x74be('0x4c')](_0x58ba65);}})[_0x74be('0x23')](function(_0x188e97){if(_0x188e97){return _0x188e97?{'count':_0x4dcbc5,'rows':_0x188e97}:null;}})[_0x74be('0x23')](respondWithResult(_0x3ead83,null))[_0x74be('0x41')](handleError(_0x3ead83,null));};exports['getFields']=function(_0x3ada42,_0x1995e1,_0x4bd7a1){var _0x2546f6={};var _0x3a3a30={};var _0x560e70;var _0x2a438b;return db[_0x74be('0x2b')][_0x74be('0x49')]({'where':{'id':_0x3ada42[_0x74be('0x43')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x1995e1,null))[_0x74be('0x23')](function(_0x4203f1){if(_0x4203f1){_0x560e70=_0x4203f1;_0x3a3a30[_0x74be('0x33')]=_[_0x74be('0x2f')](db[_0x74be('0x4a')]['rawAttributes']);_0x3a3a30[_0x74be('0x30')]=_[_0x74be('0x2f')](_0x3ada42[_0x74be('0x30')]);_0x3a3a30[_0x74be('0x31')]=_['intersection'](_0x3a3a30['model'],_0x3a3a30[_0x74be('0x30')]);_0x2546f6['attributes']=_[_0x74be('0x32')](_0x3a3a30['model'],qs[_0x74be('0x35')](_0x3ada42[_0x74be('0x30')][_0x74be('0x35')]));_0x2546f6[_0x74be('0x34')]=_0x2546f6[_0x74be('0x34')][_0x74be('0x36')]?_0x2546f6[_0x74be('0x34')]:_0x3a3a30['model'];_0x2546f6['order']=qs['sort'](_0x3ada42[_0x74be('0x30')]['sort']);_0x2546f6[_0x74be('0x39')]=qs[_0x74be('0x31')](_[_0x74be('0x3a')](_0x3ada42[_0x74be('0x30')],_0x3a3a30[_0x74be('0x31')]));if(_0x3ada42['query']['filter']){_0x2546f6[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x2546f6[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x2546f6[_0x74be('0x34')],function(_0x224d4a){var _0x283749={};_0x283749[_0x224d4a]={'$like':'%'+_0x3ada42[_0x74be('0x30')]['filter']+'%'};return _0x283749;})});}_0x2546f6=_[_0x74be('0x3c')]({},_0x2546f6,_0x3ada42[_0x74be('0x44')]);return _0x560e70['getFields'](_0x2546f6);}})[_0x74be('0x23')](function(_0x2feb9b){if(_0x2feb9b){_0x2a438b=_0x2feb9b[_0x74be('0x36')];if(!_0x3ada42[_0x74be('0x30')]['hasOwnProperty'](_0x74be('0x37'))){_0x2546f6['limit']=qs[_0x74be('0x1a')](_0x3ada42['query'][_0x74be('0x1a')]);_0x2546f6[_0x74be('0x18')]=qs[_0x74be('0x18')](_0x3ada42[_0x74be('0x30')][_0x74be('0x18')]);}return _0x560e70[_0x74be('0x4d')](_0x2546f6);}})[_0x74be('0x23')](function(_0x4eff87){if(_0x4eff87){return _0x4eff87?{'count':_0x2a438b,'rows':_0x4eff87}:null;}})[_0x74be('0x23')](respondWithResult(_0x1995e1,null))[_0x74be('0x41')](handleError(_0x1995e1,null));}; \ No newline at end of file +var _0x712d=['length','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','keys','include','find','create','body','update','getSubjects','nolimit','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','query','filters','intersection','attributes','fields'];(function(_0x412615,_0x5a57e9){var _0xc22ca2=function(_0x51ced4){while(--_0x51ced4){_0x412615['push'](_0x412615['shift']());}};_0xc22ca2(++_0x5a57e9);}(_0x712d,0x1b6));var _0xd712=function(_0x26b479,_0x4b8818){_0x26b479=_0x26b479-0x0;var _0x3acbfc=_0x712d[_0x26b479];return _0x3acbfc;};'use strict';var emlformat=require(_0xd712('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd712('0x1'));var jsonpatch=require(_0xd712('0x2'));var rp=require('request-promise');var moment=require(_0xd712('0x3'));var BPromise=require(_0xd712('0x4'));var Mustache=require('mustache');var util=require(_0xd712('0x5'));var path=require(_0xd712('0x6'));var sox=require(_0xd712('0x7'));var csv=require('to-csv');var ejs=require(_0xd712('0x8'));var fs=require('fs');var fs_extra=require(_0xd712('0x9'));var _=require(_0xd712('0xa'));var squel=require(_0xd712('0xb'));var crypto=require(_0xd712('0xc'));var jsforce=require(_0xd712('0xd'));var deskjs=require(_0xd712('0xe'));var toCsv=require(_0xd712('0xf'));var querystring=require(_0xd712('0x10'));var Papa=require(_0xd712('0x11'));var Redis=require(_0xd712('0x12'));var authService=require(_0xd712('0x13'));var qs=require(_0xd712('0x14'));var as=require(_0xd712('0x15'));var hardwareService=require(_0xd712('0x16'));var logger=require(_0xd712('0x17'))(_0xd712('0x18'));var utils=require('../../config/utils');var config=require(_0xd712('0x19'));var licenseUtil=require(_0xd712('0x1a'));var db=require(_0xd712('0x1b'))['db'];function respondWithStatusCode(_0x4835cb,_0x19acda){_0x19acda=_0x19acda||0xcc;return function(_0x2d5fc6){if(_0x2d5fc6){return _0x4835cb[_0xd712('0x1c')](_0x19acda);}return _0x4835cb[_0xd712('0x1d')](_0x19acda)['end']();};}function respondWithResult(_0xc4e277,_0x4cf8ca){_0x4cf8ca=_0x4cf8ca||0xc8;return function(_0x16c51f){if(_0x16c51f){return _0xc4e277[_0xd712('0x1d')](_0x4cf8ca)['json'](_0x16c51f);}};}function respondWithFilteredResult(_0x998b40,_0x44239e){return function(_0x104b7a){if(_0x104b7a){var _0x392c9d=typeof _0x44239e['offset']===_0xd712('0x1e')&&typeof _0x44239e[_0xd712('0x1f')]===_0xd712('0x1e');var _0x682b07=_0x104b7a[_0xd712('0x20')];var _0x2adaee=_0x392c9d?0x0:_0x44239e['offset'];var _0x14e08e=_0x392c9d?_0x104b7a['count']:_0x44239e[_0xd712('0x21')]+_0x44239e[_0xd712('0x1f')];var _0x539ea8;if(_0x14e08e>=_0x682b07){_0x14e08e=_0x682b07;_0x539ea8=0xc8;}else{_0x539ea8=0xce;}_0x998b40[_0xd712('0x1d')](_0x539ea8);return _0x998b40[_0xd712('0x22')](_0xd712('0x23'),_0x2adaee+'-'+_0x14e08e+'/'+_0x682b07)[_0xd712('0x24')](_0x104b7a);}return null;};}function patchUpdates(_0x3e6da6){return function(_0x249bf2){try{jsonpatch['apply'](_0x249bf2,_0x3e6da6,!![]);}catch(_0xf9dfe6){return BPromise['reject'](_0xf9dfe6);}return _0x249bf2['save']();};}function saveUpdates(_0x212471,_0x591457){return function(_0x5211cd){if(_0x5211cd){return _0x5211cd['update'](_0x212471)[_0xd712('0x25')](function(_0x15f0d7){return _0x15f0d7;});}return null;};}function removeEntity(_0x4814cd,_0x4624f1){return function(_0xd224ef){if(_0xd224ef){return _0xd224ef[_0xd712('0x26')]()[_0xd712('0x25')](function(){_0x4814cd[_0xd712('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b67b5,_0x3953b1){return function(_0x2d1fb1){if(!_0x2d1fb1){_0x1b67b5[_0xd712('0x1c')](0x194);}return _0x2d1fb1;};}function handleError(_0x15e295,_0xd5ed16){_0xd5ed16=_0xd5ed16||0x1f4;return function(_0x5c14b3){logger[_0xd712('0x27')](_0x5c14b3[_0xd712('0x28')]);if(_0x5c14b3[_0xd712('0x29')]){delete _0x5c14b3[_0xd712('0x29')];}_0x15e295[_0xd712('0x1d')](_0xd5ed16)[_0xd712('0x2a')](_0x5c14b3);};}exports[_0xd712('0x2b')]=function(_0x1bae91,_0x2ecc8a){var _0x535433={},_0x209f93={},_0x34adc3={'count':0x0,'rows':[]};var _0xed1bf7=_[_0xd712('0x2c')](db[_0xd712('0x2d')]['rawAttributes'],function(_0x29bf03){return{'name':_0x29bf03[_0xd712('0x2e')],'type':_0x29bf03[_0xd712('0x2f')][_0xd712('0x30')]};});_0x209f93['model']=_[_0xd712('0x2c')](_0xed1bf7,_0xd712('0x29'));_0x209f93[_0xd712('0x31')]=_['keys'](_0x1bae91[_0xd712('0x31')]);_0x209f93[_0xd712('0x32')]=_[_0xd712('0x33')](_0x209f93['model'],_0x209f93['query']);_0x535433[_0xd712('0x34')]=_[_0xd712('0x33')](_0x209f93['model'],qs[_0xd712('0x35')](_0x1bae91[_0xd712('0x31')][_0xd712('0x35')]));_0x535433[_0xd712('0x34')]=_0x535433[_0xd712('0x34')][_0xd712('0x36')]?_0x535433[_0xd712('0x34')]:_0x209f93[_0xd712('0x37')];if(!_0x1bae91[_0xd712('0x31')][_0xd712('0x38')]('nolimit')){_0x535433[_0xd712('0x1f')]=qs['limit'](_0x1bae91[_0xd712('0x31')]['limit']);_0x535433[_0xd712('0x21')]=qs['offset'](_0x1bae91['query'][_0xd712('0x21')]);}_0x535433[_0xd712('0x39')]=qs[_0xd712('0x3a')](_0x1bae91['query'][_0xd712('0x3a')]);_0x535433[_0xd712('0x3b')]=qs['filters'](_[_0xd712('0x3c')](_0x1bae91[_0xd712('0x31')],_0x209f93[_0xd712('0x32')]),_0xed1bf7);if(_0x1bae91['query'][_0xd712('0x3d')]){_0x535433[_0xd712('0x3b')]=_[_0xd712('0x3e')](_0x535433['where'],{'$or':_[_0xd712('0x2c')](_0xed1bf7,function(_0x49c52e){if(_0x49c52e[_0xd712('0x2f')]!==_0xd712('0x3f')){var _0x462d35={};_0x462d35[_0x49c52e[_0xd712('0x29')]]={'$like':'%'+_0x1bae91[_0xd712('0x31')]['filter']+'%'};return _0x462d35;}})});}_0x535433=_[_0xd712('0x3e')]({},_0x535433,_0x1bae91[_0xd712('0x40')]);var _0x5dfe6e={'where':_0x535433[_0xd712('0x3b')]};return db['FreshsalesConfiguration'][_0xd712('0x20')](_0x5dfe6e)[_0xd712('0x25')](function(_0x1f335c){_0x34adc3[_0xd712('0x20')]=_0x1f335c;if(_0x1bae91['query'][_0xd712('0x41')]){_0x535433['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x535433);})[_0xd712('0x25')](function(_0x2cd14a){_0x34adc3[_0xd712('0x42')]=_0x2cd14a;return _0x34adc3;})[_0xd712('0x25')](respondWithFilteredResult(_0x2ecc8a,_0x535433))[_0xd712('0x43')](handleError(_0x2ecc8a,null));};exports[_0xd712('0x44')]=function(_0x274287,_0x1800a1){var _0x539277={'raw':![],'where':{'id':_0x274287[_0xd712('0x45')]['id']}},_0x27d2f1={};_0x27d2f1['model']=_['keys'](db[_0xd712('0x2d')][_0xd712('0x46')]);_0x27d2f1[_0xd712('0x31')]=_[_0xd712('0x47')](_0x274287[_0xd712('0x31')]);_0x27d2f1['filters']=_[_0xd712('0x33')](_0x27d2f1[_0xd712('0x37')],_0x27d2f1[_0xd712('0x31')]);_0x539277[_0xd712('0x34')]=_[_0xd712('0x33')](_0x27d2f1[_0xd712('0x37')],qs[_0xd712('0x35')](_0x274287[_0xd712('0x31')][_0xd712('0x35')]));_0x539277[_0xd712('0x34')]=_0x539277[_0xd712('0x34')][_0xd712('0x36')]?_0x539277[_0xd712('0x34')]:_0x27d2f1['model'];if(_0x274287['query']['includeAll']){_0x539277[_0xd712('0x48')]=[{'all':!![]}];}_0x539277=_[_0xd712('0x3e')]({},_0x539277,_0x274287[_0xd712('0x40')]);return db[_0xd712('0x2d')][_0xd712('0x49')](_0x539277)[_0xd712('0x25')](handleEntityNotFound(_0x1800a1,null))[_0xd712('0x25')](respondWithResult(_0x1800a1,null))[_0xd712('0x43')](handleError(_0x1800a1,null));};exports[_0xd712('0x4a')]=function(_0x1a6085,_0x18f8c9){return db[_0xd712('0x2d')][_0xd712('0x4a')](_0x1a6085[_0xd712('0x4b')],{})[_0xd712('0x25')](respondWithResult(_0x18f8c9,0xc9))[_0xd712('0x43')](handleError(_0x18f8c9,null));};exports[_0xd712('0x4c')]=function(_0x53f2ec,_0xabc571){if(_0x53f2ec['body']['id']){delete _0x53f2ec[_0xd712('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0xd712('0x49')]({'where':{'id':_0x53f2ec[_0xd712('0x45')]['id']}})[_0xd712('0x25')](handleEntityNotFound(_0xabc571,null))['then'](saveUpdates(_0x53f2ec['body'],null))[_0xd712('0x25')](respondWithResult(_0xabc571,null))[_0xd712('0x43')](handleError(_0xabc571,null));};exports['destroy']=function(_0x515dc3,_0x1ca5af){return db[_0xd712('0x2d')][_0xd712('0x49')]({'where':{'id':_0x515dc3['params']['id']}})[_0xd712('0x25')](handleEntityNotFound(_0x1ca5af,null))[_0xd712('0x25')](removeEntity(_0x1ca5af,null))[_0xd712('0x43')](handleError(_0x1ca5af,null));};exports[_0xd712('0x4d')]=function(_0x260c7d,_0x235511,_0x412a45){var _0xca0e0b={};var _0x4680ae={};var _0x3b8c70;var _0x29eca1;return db[_0xd712('0x2d')]['findOne']({'where':{'id':_0x260c7d[_0xd712('0x45')]['id']}})['then'](handleEntityNotFound(_0x235511,null))[_0xd712('0x25')](function(_0x4ab443){if(_0x4ab443){_0x3b8c70=_0x4ab443;_0x4680ae[_0xd712('0x37')]=_[_0xd712('0x47')](db['FreshsalesField'][_0xd712('0x46')]);_0x4680ae[_0xd712('0x31')]=_[_0xd712('0x47')](_0x260c7d[_0xd712('0x31')]);_0x4680ae[_0xd712('0x32')]=_['intersection'](_0x4680ae[_0xd712('0x37')],_0x4680ae[_0xd712('0x31')]);_0xca0e0b['attributes']=_[_0xd712('0x33')](_0x4680ae['model'],qs[_0xd712('0x35')](_0x260c7d['query'][_0xd712('0x35')]));_0xca0e0b[_0xd712('0x34')]=_0xca0e0b['attributes'][_0xd712('0x36')]?_0xca0e0b['attributes']:_0x4680ae[_0xd712('0x37')];_0xca0e0b[_0xd712('0x39')]=qs[_0xd712('0x3a')](_0x260c7d[_0xd712('0x31')][_0xd712('0x3a')]);_0xca0e0b[_0xd712('0x3b')]=qs[_0xd712('0x32')](_[_0xd712('0x3c')](_0x260c7d[_0xd712('0x31')],_0x4680ae[_0xd712('0x32')]));if(_0x260c7d[_0xd712('0x31')]['filter']){_0xca0e0b[_0xd712('0x3b')]=_[_0xd712('0x3e')](_0xca0e0b[_0xd712('0x3b')],{'$or':_[_0xd712('0x2c')](_0xca0e0b[_0xd712('0x34')],function(_0x301aed){var _0x700449={};_0x700449[_0x301aed]={'$like':'%'+_0x260c7d[_0xd712('0x31')][_0xd712('0x3d')]+'%'};return _0x700449;})});}_0xca0e0b=_[_0xd712('0x3e')]({},_0xca0e0b,_0x260c7d[_0xd712('0x40')]);return _0x3b8c70[_0xd712('0x4d')](_0xca0e0b);}})['then'](function(_0x5e20e4){if(_0x5e20e4){_0x29eca1=_0x5e20e4[_0xd712('0x36')];if(!_0x260c7d[_0xd712('0x31')][_0xd712('0x38')](_0xd712('0x4e'))){_0xca0e0b[_0xd712('0x1f')]=qs['limit'](_0x260c7d[_0xd712('0x31')][_0xd712('0x1f')]);_0xca0e0b[_0xd712('0x21')]=qs[_0xd712('0x21')](_0x260c7d[_0xd712('0x31')][_0xd712('0x21')]);}return _0x3b8c70['getSubjects'](_0xca0e0b);}})['then'](function(_0x39f3cd){if(_0x39f3cd){return _0x39f3cd?{'count':_0x29eca1,'rows':_0x39f3cd}:null;}})[_0xd712('0x25')](respondWithResult(_0x235511,null))[_0xd712('0x43')](handleError(_0x235511,null));};exports[_0xd712('0x4f')]=function(_0x90ee7a,_0x3c708d,_0xd8ed5f){var _0xb16d9e={};var _0x353f06={};var _0x47912b;var _0x1bef45;return db[_0xd712('0x2d')][_0xd712('0x50')]({'where':{'id':_0x90ee7a['params']['id']}})[_0xd712('0x25')](handleEntityNotFound(_0x3c708d,null))[_0xd712('0x25')](function(_0x2c81de){if(_0x2c81de){_0x47912b=_0x2c81de;_0x353f06[_0xd712('0x37')]=_[_0xd712('0x47')](db['FreshsalesField'][_0xd712('0x46')]);_0x353f06[_0xd712('0x31')]=_[_0xd712('0x47')](_0x90ee7a['query']);_0x353f06[_0xd712('0x32')]=_['intersection'](_0x353f06['model'],_0x353f06[_0xd712('0x31')]);_0xb16d9e[_0xd712('0x34')]=_[_0xd712('0x33')](_0x353f06[_0xd712('0x37')],qs['fields'](_0x90ee7a['query'][_0xd712('0x35')]));_0xb16d9e[_0xd712('0x34')]=_0xb16d9e[_0xd712('0x34')][_0xd712('0x36')]?_0xb16d9e[_0xd712('0x34')]:_0x353f06[_0xd712('0x37')];_0xb16d9e[_0xd712('0x39')]=qs[_0xd712('0x3a')](_0x90ee7a[_0xd712('0x31')][_0xd712('0x3a')]);_0xb16d9e[_0xd712('0x3b')]=qs[_0xd712('0x32')](_[_0xd712('0x3c')](_0x90ee7a[_0xd712('0x31')],_0x353f06[_0xd712('0x32')]));if(_0x90ee7a[_0xd712('0x31')][_0xd712('0x3d')]){_0xb16d9e['where']=_[_0xd712('0x3e')](_0xb16d9e[_0xd712('0x3b')],{'$or':_[_0xd712('0x2c')](_0xb16d9e['attributes'],function(_0x34fc0f){var _0x26854b={};_0x26854b[_0x34fc0f]={'$like':'%'+_0x90ee7a[_0xd712('0x31')][_0xd712('0x3d')]+'%'};return _0x26854b;})});}_0xb16d9e=_[_0xd712('0x3e')]({},_0xb16d9e,_0x90ee7a[_0xd712('0x40')]);return _0x47912b[_0xd712('0x4f')](_0xb16d9e);}})[_0xd712('0x25')](function(_0x1103c3){if(_0x1103c3){_0x1bef45=_0x1103c3[_0xd712('0x36')];if(!_0x90ee7a[_0xd712('0x31')]['hasOwnProperty'](_0xd712('0x4e'))){_0xb16d9e[_0xd712('0x1f')]=qs[_0xd712('0x1f')](_0x90ee7a['query'][_0xd712('0x1f')]);_0xb16d9e[_0xd712('0x21')]=qs[_0xd712('0x21')](_0x90ee7a['query'][_0xd712('0x21')]);}return _0x47912b[_0xd712('0x4f')](_0xb16d9e);}})[_0xd712('0x25')](function(_0x146e84){if(_0x146e84){return _0x146e84?{'count':_0x1bef45,'rows':_0x146e84}:null;}})[_0xd712('0x25')](respondWithResult(_0x3c708d,null))['catch'](handleError(_0x3c708d,null));};exports[_0xd712('0x51')]=function(_0x12bbfb,_0x4ccf51,_0x4ebdb7){var _0x286780={};var _0x252865={};var _0xd72089;var _0x257100;return db[_0xd712('0x2d')][_0xd712('0x50')]({'where':{'id':_0x12bbfb[_0xd712('0x45')]['id']}})[_0xd712('0x25')](handleEntityNotFound(_0x4ccf51,null))[_0xd712('0x25')](function(_0x13c116){if(_0x13c116){_0xd72089=_0x13c116;_0x252865['model']=_[_0xd712('0x47')](db['FreshsalesField'][_0xd712('0x46')]);_0x252865[_0xd712('0x31')]=_[_0xd712('0x47')](_0x12bbfb[_0xd712('0x31')]);_0x252865[_0xd712('0x32')]=_[_0xd712('0x33')](_0x252865[_0xd712('0x37')],_0x252865[_0xd712('0x31')]);_0x286780[_0xd712('0x34')]=_['intersection'](_0x252865[_0xd712('0x37')],qs['fields'](_0x12bbfb[_0xd712('0x31')][_0xd712('0x35')]));_0x286780[_0xd712('0x34')]=_0x286780['attributes']['length']?_0x286780['attributes']:_0x252865[_0xd712('0x37')];_0x286780[_0xd712('0x39')]=qs['sort'](_0x12bbfb[_0xd712('0x31')]['sort']);_0x286780[_0xd712('0x3b')]=qs['filters'](_[_0xd712('0x3c')](_0x12bbfb['query'],_0x252865[_0xd712('0x32')]));if(_0x12bbfb['query'][_0xd712('0x3d')]){_0x286780[_0xd712('0x3b')]=_[_0xd712('0x3e')](_0x286780[_0xd712('0x3b')],{'$or':_[_0xd712('0x2c')](_0x286780[_0xd712('0x34')],function(_0x341ec6){var _0xd4896f={};_0xd4896f[_0x341ec6]={'$like':'%'+_0x12bbfb['query'][_0xd712('0x3d')]+'%'};return _0xd4896f;})});}_0x286780=_['merge']({},_0x286780,_0x12bbfb['options']);return _0xd72089['getFields'](_0x286780);}})[_0xd712('0x25')](function(_0x47a0f9){if(_0x47a0f9){_0x257100=_0x47a0f9[_0xd712('0x36')];if(!_0x12bbfb[_0xd712('0x31')][_0xd712('0x38')]('nolimit')){_0x286780[_0xd712('0x1f')]=qs[_0xd712('0x1f')](_0x12bbfb[_0xd712('0x31')]['limit']);_0x286780[_0xd712('0x21')]=qs['offset'](_0x12bbfb[_0xd712('0x31')][_0xd712('0x21')]);}return _0xd72089['getFields'](_0x286780);}})[_0xd712('0x25')](function(_0x9cbc21){if(_0x9cbc21){return _0x9cbc21?{'count':_0x257100,'rows':_0x9cbc21}:null;}})[_0xd712('0x25')](respondWithResult(_0x4ccf51,null))[_0xd712('0x43')](handleError(_0x4ccf51,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a6a202b..8542097 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 _0x7388=['bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','api','moment'];(function(_0x4a4e5e,_0x346d8d){var _0x15b0c2=function(_0x5edcd1){while(--_0x5edcd1){_0x4a4e5e['push'](_0x4a4e5e['shift']());}};_0x15b0c2(++_0x346d8d);}(_0x7388,0x167));var _0x8738=function(_0x2cb5c4,_0x114ab1){_0x2cb5c4=_0x2cb5c4-0x0;var _0x524247=_0x7388[_0x2cb5c4];return _0x524247;};'use strict';var _=require(_0x8738('0x0'));var util=require('util');var logger=require(_0x8738('0x1'))(_0x8738('0x2'));var moment=require(_0x8738('0x3'));var BPromise=require(_0x8738('0x4'));var rp=require(_0x8738('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8738('0x6'));var attributes=require(_0x8738('0x7'));module[_0x8738('0x8')]=function(_0x339c56,_0x2f5030){return _0x339c56[_0x8738('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x8738('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecaa=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','api','moment','bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x39e7d1,_0x5c4987){var _0x4a18f1=function(_0x27fd26){while(--_0x27fd26){_0x39e7d1['push'](_0x39e7d1['shift']());}};_0x4a18f1(++_0x5c4987);}(_0xecaa,0x1f3));var _0xaeca=function(_0x3fddf7,_0x440eda){_0x3fddf7=_0x3fddf7-0x0;var _0x2b0732=_0xecaa[_0x3fddf7];return _0x2b0732;};'use strict';var _=require('lodash');var util=require(_0xaeca('0x0'));var logger=require('../../config/logger')(_0xaeca('0x1'));var moment=require(_0xaeca('0x2'));var BPromise=require(_0xaeca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaeca('0x4'));var config=require(_0xaeca('0x5'));var attributes=require(_0xaeca('0x6'));module[_0xaeca('0x7')]=function(_0x43e8af,_0x10c3e7){return _0x43e8af[_0xaeca('0x8')](_0xaeca('0x9'),attributes,{'tableName':_0xaeca('0xa'),'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 62901ec..bd22936 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 _0x8518=['message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x3be309,_0x1a2e45){var _0x25d5db=function(_0x4df36a){while(--_0x4df36a){_0x3be309['push'](_0x3be309['shift']());}};_0x25d5db(++_0x1a2e45);}(_0x8518,0x1d2));var _0x8851=function(_0x21f19a,_0x12adef){_0x21f19a=_0x21f19a-0x0;var _0x14edb2=_0x8518[_0x21f19a];return _0x14edb2;};'use strict';var _=require(_0x8851('0x0'));var util=require('util');var moment=require(_0x8851('0x1'));var BPromise=require(_0x8851('0x2'));var rs=require(_0x8851('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8851('0x4'))['db'];var utils=require(_0x8851('0x5'));var logger=require(_0x8851('0x6'))(_0x8851('0x7'));var config=require('../../config/environment');var jayson=require(_0x8851('0x8'));var client=jayson[_0x8851('0x9')][_0x8851('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcb5a71,_0x55833e,_0x2c8de9){return new BPromise(function(_0x4f00b7,_0xa47a8d){return client['request'](_0xcb5a71,_0x2c8de9)[_0x8851('0xb')](function(_0x50c3d8){logger['info'](_0x8851('0xc'),_0x55833e,_0x8851('0xd'));logger[_0x8851('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x55833e,'request\x20sent',JSON['stringify'](_0x50c3d8));if(_0x50c3d8[_0x8851('0xf')]){if(_0x50c3d8['error'][_0x8851('0x10')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x55833e,_0x50c3d8[_0x8851('0xf')]['message']);return _0xa47a8d(_0x50c3d8[_0x8851('0xf')]['message']);}logger[_0x8851('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x55833e,_0x50c3d8[_0x8851('0xf')]['message']);return _0x4f00b7(_0x50c3d8['error'][_0x8851('0x11')]);}else{logger[_0x8851('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x55833e,_0x8851('0xd'));_0x4f00b7(_0x50c3d8[_0x8851('0x13')]['message']);}})[_0x8851('0x14')](function(_0x44478c){logger[_0x8851('0xf')](_0x8851('0xc'),_0x55833e,_0x44478c);_0xa47a8d(_0x44478c);});});} \ No newline at end of file +var _0xb36f=['http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment'];(function(_0x2ecad4,_0x386df7){var _0x1b9be4=function(_0xdf6559){while(--_0xdf6559){_0x2ecad4['push'](_0x2ecad4['shift']());}};_0x1b9be4(++_0x386df7);}(_0xb36f,0x89));var _0xfb36=function(_0x4b6380,_0x1c4757){_0x4b6380=_0x4b6380-0x0;var _0x35efce=_0xb36f[_0x4b6380];return _0x35efce;};'use strict';var _=require(_0xfb36('0x0'));var util=require(_0xfb36('0x1'));var moment=require(_0xfb36('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb36('0x3'));var fs=require('fs');var Redis=require(_0xfb36('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfb36('0x5'));var config=require(_0xfb36('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb36('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cf362,_0x3c1c33,_0x2b37c4){return new BPromise(function(_0x32509d,_0x46334a){return client['request'](_0x1cf362,_0x2b37c4)[_0xfb36('0x8')](function(_0x32c117){logger[_0xfb36('0x9')](_0xfb36('0xa'),_0x3c1c33,_0xfb36('0xb'));logger[_0xfb36('0xc')](_0xfb36('0xd'),_0x3c1c33,_0xfb36('0xb'),JSON[_0xfb36('0xe')](_0x32c117));if(_0x32c117[_0xfb36('0xf')]){if(_0x32c117[_0xfb36('0xf')]['code']===0x1f4){logger[_0xfb36('0xf')](_0xfb36('0xa'),_0x3c1c33,_0x32c117[_0xfb36('0xf')][_0xfb36('0x10')]);return _0x46334a(_0x32c117[_0xfb36('0xf')][_0xfb36('0x10')]);}logger[_0xfb36('0xf')](_0xfb36('0xa'),_0x3c1c33,_0x32c117[_0xfb36('0xf')][_0xfb36('0x10')]);return _0x32509d(_0x32c117[_0xfb36('0xf')]['message']);}else{logger[_0xfb36('0x9')](_0xfb36('0xa'),_0x3c1c33,_0xfb36('0xb'));_0x32509d(_0x32c117[_0xfb36('0x11')][_0xfb36('0x10')]);}})['catch'](function(_0x345f44){logger[_0xfb36('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c1c33,_0x345f44);_0x46334a(_0x345f44);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c6ec81d..2e48231 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 _0x19ea=['connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x8042a9,_0x51c8cd){var _0x489878=function(_0x290921){while(--_0x290921){_0x8042a9['push'](_0x8042a9['shift']());}};_0x489878(++_0x51c8cd);}(_0x19ea,0xfe));var _0xa19e=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x19ea[_0x4e93a9];return _0x43013c;};'use strict';var multer=require(_0xa19e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa19e('0x1'));var express=require('express');var router=express[_0xa19e('0x2')]();var fs_extra=require(_0xa19e('0x3'));var auth=require(_0xa19e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa19e('0x5'));router[_0xa19e('0x6')]('/',auth[_0xa19e('0x7')](),controller[_0xa19e('0x8')]);router[_0xa19e('0x6')](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xa')]);router[_0xa19e('0xb')]('/',auth[_0xa19e('0x7')](),controller[_0xa19e('0xc')]);router['put'](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xd')]);router[_0xa19e('0xe')]('/:id',auth[_0xa19e('0x7')](),controller[_0xa19e('0xf')]);module[_0xa19e('0x10')]=router; \ No newline at end of file +var _0x3c6d=['./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3c6d,0x199));var _0xd3c6=function(_0x54c2f0,_0x5cfe1d){_0x54c2f0=_0x54c2f0-0x0;var _0x236e30=_0x3c6d[_0x54c2f0];return _0x236e30;};'use strict';var multer=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var path=require(_0xd3c6('0x2'));var timeout=require(_0xd3c6('0x3'));var express=require('express');var router=express[_0xd3c6('0x4')]();var fs_extra=require(_0xd3c6('0x5'));var auth=require(_0xd3c6('0x6'));var interaction=require(_0xd3c6('0x7'));var config=require(_0xd3c6('0x8'));var controller=require(_0xd3c6('0x9'));router['get']('/',auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xb')]);router[_0xd3c6('0xc')](_0xd3c6('0xd'),auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd3c6('0xf')]);router[_0xd3c6('0x10')](_0xd3c6('0xd'),auth['isAuthenticated'](),controller[_0xd3c6('0x11')]);router['delete'](_0xd3c6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 3d68084..c149aff 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 _0x932f=['sequelize','string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x932f,0x19e));var _0xf932=function(_0x9e15aa,_0x55276a){_0x9e15aa=_0x9e15aa-0x0;var _0x17a76c=_0x932f[_0x9e15aa];return _0x17a76c;};'use strict';var Sequelize=require(_0xf932('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf932('0x1'),_0xf932('0x2'),'customVariable',_0xf932('0x3'),_0xf932('0x4')),'defaultValue':_0xf932('0x1')},'content':{'type':Sequelize[_0xf932('0x5')]},'key':{'type':Sequelize[_0xf932('0x5')]},'keyType':{'type':Sequelize[_0xf932('0x6')]('string',_0xf932('0x2'),_0xf932('0x7'))},'keyContent':{'type':Sequelize[_0xf932('0x5')]},'idField':{'type':Sequelize[_0xf932('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf932('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf932('0x5')]}}; \ No newline at end of file +var _0xe21c=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xe21c,0x1a4));var _0xce21=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0xe21c[_0x3f1710];return _0x528458;};'use strict';var Sequelize=require(_0xce21('0x0'));module[_0xce21('0x1')]={'type':{'type':Sequelize[_0xce21('0x2')](_0xce21('0x3'),_0xce21('0x4'),_0xce21('0x5'),_0xce21('0x6'),_0xce21('0x7')),'defaultValue':_0xce21('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xce21('0x2')](_0xce21('0x3'),_0xce21('0x4'),_0xce21('0x5'))},'keyContent':{'type':Sequelize[_0xce21('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xce21('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce21('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 3c5a296..b036e13 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 _0x73cb=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','FreshsalesField','rawAttributes','type','model','map','keys'];(function(_0x306548,_0x1054aa){var _0x389d27=function(_0x2ed19b){while(--_0x2ed19b){_0x306548['push'](_0x306548['shift']());}};_0x389d27(++_0x1054aa);}(_0x73cb,0x1dc));var _0xb73c=function(_0x72db45,_0x2dd78d){_0x72db45=_0x72db45-0x0;var _0x407749=_0x73cb[_0x72db45];return _0x407749;};'use strict';var emlformat=require(_0xb73c('0x0'));var rimraf=require(_0xb73c('0x1'));var zipdir=require(_0xb73c('0x2'));var jsonpatch=require(_0xb73c('0x3'));var rp=require('request-promise');var moment=require(_0xb73c('0x4'));var BPromise=require(_0xb73c('0x5'));var Mustache=require(_0xb73c('0x6'));var util=require(_0xb73c('0x7'));var path=require(_0xb73c('0x8'));var sox=require(_0xb73c('0x9'));var csv=require('to-csv');var ejs=require(_0xb73c('0xa'));var fs=require('fs');var fs_extra=require(_0xb73c('0xb'));var _=require('lodash');var squel=require(_0xb73c('0xc'));var crypto=require('crypto');var jsforce=require(_0xb73c('0xd'));var deskjs=require(_0xb73c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb73c('0xf'));var Papa=require(_0xb73c('0x10'));var Redis=require(_0xb73c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb73c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb73c('0x13'));var logger=require(_0xb73c('0x14'))(_0xb73c('0x15'));var utils=require(_0xb73c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb73c('0x17'));var db=require(_0xb73c('0x18'))['db'];function respondWithStatusCode(_0x2f6d01,_0x4b712c){_0x4b712c=_0x4b712c||0xcc;return function(_0x41695){if(_0x41695){return _0x2f6d01[_0xb73c('0x19')](_0x4b712c);}return _0x2f6d01[_0xb73c('0x1a')](_0x4b712c)['end']();};}function respondWithResult(_0x2b31b9,_0x1cb798){_0x1cb798=_0x1cb798||0xc8;return function(_0x172c4c){if(_0x172c4c){return _0x2b31b9[_0xb73c('0x1a')](_0x1cb798)[_0xb73c('0x1b')](_0x172c4c);}};}function respondWithFilteredResult(_0x328e04,_0x2156a9){return function(_0x498f7b){if(_0x498f7b){var _0x1d2474=typeof _0x2156a9[_0xb73c('0x1c')]===_0xb73c('0x1d')&&typeof _0x2156a9[_0xb73c('0x1e')]===_0xb73c('0x1d');var _0x2fb8f6=_0x498f7b[_0xb73c('0x1f')];var _0x519dfb=_0x1d2474?0x0:_0x2156a9[_0xb73c('0x1c')];var _0x12034e=_0x1d2474?_0x498f7b[_0xb73c('0x1f')]:_0x2156a9[_0xb73c('0x1c')]+_0x2156a9['limit'];var _0x926dc6;if(_0x12034e>=_0x2fb8f6){_0x12034e=_0x2fb8f6;_0x926dc6=0xc8;}else{_0x926dc6=0xce;}_0x328e04[_0xb73c('0x1a')](_0x926dc6);return _0x328e04[_0xb73c('0x20')](_0xb73c('0x21'),_0x519dfb+'-'+_0x12034e+'/'+_0x2fb8f6)['json'](_0x498f7b);}return null;};}function patchUpdates(_0x357afb){return function(_0x347659){try{jsonpatch[_0xb73c('0x22')](_0x347659,_0x357afb,!![]);}catch(_0x13dd5d){return BPromise[_0xb73c('0x23')](_0x13dd5d);}return _0x347659['save']();};}function saveUpdates(_0xfe01cc,_0x39e029){return function(_0x4b033b){if(_0x4b033b){return _0x4b033b[_0xb73c('0x24')](_0xfe01cc)[_0xb73c('0x25')](function(_0x3bea4c){return _0x3bea4c;});}return null;};}function removeEntity(_0x5d8cb3,_0x4ddd91){return function(_0x2ad2b3){if(_0x2ad2b3){return _0x2ad2b3['destroy']()[_0xb73c('0x25')](function(){_0x5d8cb3[_0xb73c('0x1a')](0xcc)[_0xb73c('0x26')]();});}};}function handleEntityNotFound(_0x5cf431,_0x194c6b){return function(_0x2b5b6b){if(!_0x2b5b6b){_0x5cf431[_0xb73c('0x19')](0x194);}return _0x2b5b6b;};}function handleError(_0x230c6c,_0x16ee76){_0x16ee76=_0x16ee76||0x1f4;return function(_0x2c7187){logger['error'](_0x2c7187[_0xb73c('0x27')]);if(_0x2c7187[_0xb73c('0x28')]){delete _0x2c7187[_0xb73c('0x28')];}_0x230c6c[_0xb73c('0x1a')](_0x16ee76)[_0xb73c('0x29')](_0x2c7187);};}exports[_0xb73c('0x2a')]=function(_0x22e710,_0x50a966){var _0x298972={},_0xb6743={},_0x3865d0={'count':0x0,'rows':[]};var _0x342c4e=_['map'](db[_0xb73c('0x2b')][_0xb73c('0x2c')],function(_0x37bcc3){return{'name':_0x37bcc3['fieldName'],'type':_0x37bcc3[_0xb73c('0x2d')]['key']};});_0xb6743[_0xb73c('0x2e')]=_[_0xb73c('0x2f')](_0x342c4e,_0xb73c('0x28'));_0xb6743['query']=_[_0xb73c('0x30')](_0x22e710[_0xb73c('0x31')]);_0xb6743[_0xb73c('0x32')]=_[_0xb73c('0x33')](_0xb6743[_0xb73c('0x2e')],_0xb6743['query']);_0x298972[_0xb73c('0x34')]=_[_0xb73c('0x33')](_0xb6743[_0xb73c('0x2e')],qs['fields'](_0x22e710[_0xb73c('0x31')][_0xb73c('0x35')]));_0x298972[_0xb73c('0x34')]=_0x298972[_0xb73c('0x34')][_0xb73c('0x36')]?_0x298972[_0xb73c('0x34')]:_0xb6743['model'];if(!_0x22e710['query'][_0xb73c('0x37')](_0xb73c('0x38'))){_0x298972['limit']=qs[_0xb73c('0x1e')](_0x22e710[_0xb73c('0x31')][_0xb73c('0x1e')]);_0x298972[_0xb73c('0x1c')]=qs['offset'](_0x22e710[_0xb73c('0x31')][_0xb73c('0x1c')]);}_0x298972[_0xb73c('0x39')]=qs[_0xb73c('0x3a')](_0x22e710[_0xb73c('0x31')][_0xb73c('0x3a')]);_0x298972[_0xb73c('0x3b')]=qs[_0xb73c('0x32')](_[_0xb73c('0x3c')](_0x22e710[_0xb73c('0x31')],_0xb6743[_0xb73c('0x32')]),_0x342c4e);if(_0x22e710[_0xb73c('0x31')][_0xb73c('0x3d')]){_0x298972[_0xb73c('0x3b')]=_['merge'](_0x298972[_0xb73c('0x3b')],{'$or':_['map'](_0x342c4e,function(_0x49bfd8){if(_0x49bfd8[_0xb73c('0x2d')]!==_0xb73c('0x3e')){var _0x540d65={};_0x540d65[_0x49bfd8[_0xb73c('0x28')]]={'$like':'%'+_0x22e710[_0xb73c('0x31')][_0xb73c('0x3d')]+'%'};return _0x540d65;}})});}_0x298972=_[_0xb73c('0x3f')]({},_0x298972,_0x22e710[_0xb73c('0x40')]);var _0x37f678={'where':_0x298972[_0xb73c('0x3b')]};return db[_0xb73c('0x2b')][_0xb73c('0x1f')](_0x37f678)['then'](function(_0x57d8f3){_0x3865d0[_0xb73c('0x1f')]=_0x57d8f3;if(_0x22e710[_0xb73c('0x31')][_0xb73c('0x41')]){_0x298972[_0xb73c('0x42')]=[{'all':!![]}];}return db[_0xb73c('0x2b')]['findAll'](_0x298972);})['then'](function(_0x3d9758){_0x3865d0[_0xb73c('0x43')]=_0x3d9758;return _0x3865d0;})[_0xb73c('0x25')](respondWithFilteredResult(_0x50a966,_0x298972))[_0xb73c('0x44')](handleError(_0x50a966,null));};exports[_0xb73c('0x45')]=function(_0x4982ae,_0x26e5ea){var _0x42e8b0={'raw':!![],'where':{'id':_0x4982ae[_0xb73c('0x46')]['id']}},_0x201ce9={};_0x201ce9[_0xb73c('0x2e')]=_[_0xb73c('0x30')](db['FreshsalesField'][_0xb73c('0x2c')]);_0x201ce9[_0xb73c('0x31')]=_['keys'](_0x4982ae['query']);_0x201ce9[_0xb73c('0x32')]=_['intersection'](_0x201ce9['model'],_0x201ce9[_0xb73c('0x31')]);_0x42e8b0[_0xb73c('0x34')]=_[_0xb73c('0x33')](_0x201ce9[_0xb73c('0x2e')],qs['fields'](_0x4982ae[_0xb73c('0x31')][_0xb73c('0x35')]));_0x42e8b0[_0xb73c('0x34')]=_0x42e8b0['attributes'][_0xb73c('0x36')]?_0x42e8b0[_0xb73c('0x34')]:_0x201ce9[_0xb73c('0x2e')];if(_0x4982ae[_0xb73c('0x31')]['includeAll']){_0x42e8b0[_0xb73c('0x42')]=[{'all':!![]}];}_0x42e8b0=_[_0xb73c('0x3f')]({},_0x42e8b0,_0x4982ae[_0xb73c('0x40')]);return db['FreshsalesField'][_0xb73c('0x47')](_0x42e8b0)['then'](handleEntityNotFound(_0x26e5ea,null))['then'](respondWithResult(_0x26e5ea,null))[_0xb73c('0x44')](handleError(_0x26e5ea,null));};exports[_0xb73c('0x48')]=function(_0x494e29,_0x3592ed){return db[_0xb73c('0x2b')][_0xb73c('0x48')](_0x494e29['body'],{})[_0xb73c('0x25')](respondWithResult(_0x3592ed,0xc9))[_0xb73c('0x44')](handleError(_0x3592ed,null));};exports[_0xb73c('0x24')]=function(_0x2e969b,_0x5057e3){if(_0x2e969b[_0xb73c('0x49')]['id']){delete _0x2e969b['body']['id'];}return db[_0xb73c('0x2b')][_0xb73c('0x47')]({'where':{'id':_0x2e969b[_0xb73c('0x46')]['id']}})[_0xb73c('0x25')](handleEntityNotFound(_0x5057e3,null))[_0xb73c('0x25')](saveUpdates(_0x2e969b[_0xb73c('0x49')],null))[_0xb73c('0x25')](respondWithResult(_0x5057e3,null))[_0xb73c('0x44')](handleError(_0x5057e3,null));};exports[_0xb73c('0x4a')]=function(_0x1d868f,_0x58ac25){return db[_0xb73c('0x2b')][_0xb73c('0x47')]({'where':{'id':_0x1d868f[_0xb73c('0x46')]['id']}})[_0xb73c('0x25')](handleEntityNotFound(_0x58ac25,null))[_0xb73c('0x25')](removeEntity(_0x58ac25,null))['catch'](handleError(_0x58ac25,null));}; \ No newline at end of file +var _0x7fac=['pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','request-promise','moment','mustache','util','sox','to-csv','ejs','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/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort'];(function(_0x52eff3,_0xbed008){var _0x11362b=function(_0x2f559f){while(--_0x2f559f){_0x52eff3['push'](_0x52eff3['shift']());}};_0x11362b(++_0xbed008);}(_0x7fac,0xa0));var _0xc7fa=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x7fac[_0x1cd47d];return _0x29d52f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc7fa('0x0'));var moment=require(_0xc7fa('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc7fa('0x2'));var util=require(_0xc7fa('0x3'));var path=require('path');var sox=require(_0xc7fa('0x4'));var csv=require(_0xc7fa('0x5'));var ejs=require(_0xc7fa('0x6'));var fs=require('fs');var fs_extra=require(_0xc7fa('0x7'));var _=require(_0xc7fa('0x8'));var squel=require('squel');var crypto=require(_0xc7fa('0x9'));var jsforce=require(_0xc7fa('0xa'));var deskjs=require(_0xc7fa('0xb'));var toCsv=require(_0xc7fa('0x5'));var querystring=require(_0xc7fa('0xc'));var Papa=require(_0xc7fa('0xd'));var Redis=require(_0xc7fa('0xe'));var authService=require(_0xc7fa('0xf'));var qs=require(_0xc7fa('0x10'));var as=require(_0xc7fa('0x11'));var hardwareService=require(_0xc7fa('0x12'));var logger=require(_0xc7fa('0x13'))(_0xc7fa('0x14'));var utils=require(_0xc7fa('0x15'));var config=require(_0xc7fa('0x16'));var licenseUtil=require(_0xc7fa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x206f2d,_0x1fcd0d){_0x1fcd0d=_0x1fcd0d||0xcc;return function(_0x23f0aa){if(_0x23f0aa){return _0x206f2d[_0xc7fa('0x18')](_0x1fcd0d);}return _0x206f2d[_0xc7fa('0x19')](_0x1fcd0d)[_0xc7fa('0x1a')]();};}function respondWithResult(_0x146281,_0x3646dd){_0x3646dd=_0x3646dd||0xc8;return function(_0x4c5108){if(_0x4c5108){return _0x146281['status'](_0x3646dd)[_0xc7fa('0x1b')](_0x4c5108);}};}function respondWithFilteredResult(_0x593f1f,_0xb50bb4){return function(_0x4a9385){if(_0x4a9385){var _0x27bc89=typeof _0xb50bb4[_0xc7fa('0x1c')]===_0xc7fa('0x1d')&&typeof _0xb50bb4['limit']===_0xc7fa('0x1d');var _0x1b4faa=_0x4a9385['count'];var _0x2c14a3=_0x27bc89?0x0:_0xb50bb4[_0xc7fa('0x1c')];var _0xd80c52=_0x27bc89?_0x4a9385[_0xc7fa('0x1e')]:_0xb50bb4[_0xc7fa('0x1c')]+_0xb50bb4['limit'];var _0x1befc1;if(_0xd80c52>=_0x1b4faa){_0xd80c52=_0x1b4faa;_0x1befc1=0xc8;}else{_0x1befc1=0xce;}_0x593f1f[_0xc7fa('0x19')](_0x1befc1);return _0x593f1f['set'](_0xc7fa('0x1f'),_0x2c14a3+'-'+_0xd80c52+'/'+_0x1b4faa)[_0xc7fa('0x1b')](_0x4a9385);}return null;};}function patchUpdates(_0x4eb65c){return function(_0x19627e){try{jsonpatch[_0xc7fa('0x20')](_0x19627e,_0x4eb65c,!![]);}catch(_0x32a81c){return BPromise['reject'](_0x32a81c);}return _0x19627e['save']();};}function saveUpdates(_0x15d9db,_0x1369fa){return function(_0x48a719){if(_0x48a719){return _0x48a719['update'](_0x15d9db)[_0xc7fa('0x21')](function(_0x272c75){return _0x272c75;});}return null;};}function removeEntity(_0x3b752b,_0xe26f77){return function(_0x1927f9){if(_0x1927f9){return _0x1927f9['destroy']()[_0xc7fa('0x21')](function(){_0x3b752b[_0xc7fa('0x19')](0xcc)[_0xc7fa('0x1a')]();});}};}function handleEntityNotFound(_0x255c1c,_0x110fd7){return function(_0x54ee43){if(!_0x54ee43){_0x255c1c['sendStatus'](0x194);}return _0x54ee43;};}function handleError(_0x27573b,_0xc5974){_0xc5974=_0xc5974||0x1f4;return function(_0x8f8f02){logger[_0xc7fa('0x22')](_0x8f8f02[_0xc7fa('0x23')]);if(_0x8f8f02[_0xc7fa('0x24')]){delete _0x8f8f02[_0xc7fa('0x24')];}_0x27573b[_0xc7fa('0x19')](_0xc5974)[_0xc7fa('0x25')](_0x8f8f02);};}exports[_0xc7fa('0x26')]=function(_0x15d5c3,_0x385101){var _0x35e3ed={},_0x272f46={},_0x423ab7={'count':0x0,'rows':[]};var _0x35bd94=_[_0xc7fa('0x27')](db[_0xc7fa('0x28')][_0xc7fa('0x29')],function(_0x50db7a){return{'name':_0x50db7a[_0xc7fa('0x2a')],'type':_0x50db7a['type'][_0xc7fa('0x2b')]};});_0x272f46[_0xc7fa('0x2c')]=_[_0xc7fa('0x27')](_0x35bd94,_0xc7fa('0x24'));_0x272f46[_0xc7fa('0x2d')]=_[_0xc7fa('0x2e')](_0x15d5c3['query']);_0x272f46[_0xc7fa('0x2f')]=_[_0xc7fa('0x30')](_0x272f46['model'],_0x272f46['query']);_0x35e3ed['attributes']=_[_0xc7fa('0x30')](_0x272f46['model'],qs[_0xc7fa('0x31')](_0x15d5c3[_0xc7fa('0x2d')]['fields']));_0x35e3ed['attributes']=_0x35e3ed[_0xc7fa('0x32')][_0xc7fa('0x33')]?_0x35e3ed[_0xc7fa('0x32')]:_0x272f46[_0xc7fa('0x2c')];if(!_0x15d5c3[_0xc7fa('0x2d')]['hasOwnProperty'](_0xc7fa('0x34'))){_0x35e3ed[_0xc7fa('0x35')]=qs['limit'](_0x15d5c3[_0xc7fa('0x2d')][_0xc7fa('0x35')]);_0x35e3ed[_0xc7fa('0x1c')]=qs[_0xc7fa('0x1c')](_0x15d5c3[_0xc7fa('0x2d')][_0xc7fa('0x1c')]);}_0x35e3ed[_0xc7fa('0x36')]=qs[_0xc7fa('0x37')](_0x15d5c3['query'][_0xc7fa('0x37')]);_0x35e3ed['where']=qs[_0xc7fa('0x2f')](_[_0xc7fa('0x38')](_0x15d5c3[_0xc7fa('0x2d')],_0x272f46['filters']),_0x35bd94);if(_0x15d5c3[_0xc7fa('0x2d')][_0xc7fa('0x39')]){_0x35e3ed[_0xc7fa('0x3a')]=_['merge'](_0x35e3ed[_0xc7fa('0x3a')],{'$or':_[_0xc7fa('0x27')](_0x35bd94,function(_0x48f9cc){if(_0x48f9cc['type']!=='VIRTUAL'){var _0x2a1879={};_0x2a1879[_0x48f9cc[_0xc7fa('0x24')]]={'$like':'%'+_0x15d5c3[_0xc7fa('0x2d')][_0xc7fa('0x39')]+'%'};return _0x2a1879;}})});}_0x35e3ed=_[_0xc7fa('0x3b')]({},_0x35e3ed,_0x15d5c3[_0xc7fa('0x3c')]);var _0x3a6a08={'where':_0x35e3ed['where']};return db[_0xc7fa('0x28')][_0xc7fa('0x1e')](_0x3a6a08)['then'](function(_0x1518f4){_0x423ab7[_0xc7fa('0x1e')]=_0x1518f4;if(_0x15d5c3[_0xc7fa('0x2d')][_0xc7fa('0x3d')]){_0x35e3ed['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xc7fa('0x3e')](_0x35e3ed);})[_0xc7fa('0x21')](function(_0x2765fc){_0x423ab7[_0xc7fa('0x3f')]=_0x2765fc;return _0x423ab7;})[_0xc7fa('0x21')](respondWithFilteredResult(_0x385101,_0x35e3ed))[_0xc7fa('0x40')](handleError(_0x385101,null));};exports[_0xc7fa('0x41')]=function(_0x231d53,_0x50193c){var _0x4e153d={'raw':!![],'where':{'id':_0x231d53[_0xc7fa('0x42')]['id']}},_0x4c195e={};_0x4c195e[_0xc7fa('0x2c')]=_[_0xc7fa('0x2e')](db[_0xc7fa('0x28')][_0xc7fa('0x29')]);_0x4c195e[_0xc7fa('0x2d')]=_[_0xc7fa('0x2e')](_0x231d53[_0xc7fa('0x2d')]);_0x4c195e[_0xc7fa('0x2f')]=_[_0xc7fa('0x30')](_0x4c195e[_0xc7fa('0x2c')],_0x4c195e[_0xc7fa('0x2d')]);_0x4e153d[_0xc7fa('0x32')]=_[_0xc7fa('0x30')](_0x4c195e[_0xc7fa('0x2c')],qs[_0xc7fa('0x31')](_0x231d53['query'][_0xc7fa('0x31')]));_0x4e153d['attributes']=_0x4e153d[_0xc7fa('0x32')][_0xc7fa('0x33')]?_0x4e153d['attributes']:_0x4c195e['model'];if(_0x231d53['query'][_0xc7fa('0x3d')]){_0x4e153d[_0xc7fa('0x43')]=[{'all':!![]}];}_0x4e153d=_[_0xc7fa('0x3b')]({},_0x4e153d,_0x231d53[_0xc7fa('0x3c')]);return db[_0xc7fa('0x28')][_0xc7fa('0x44')](_0x4e153d)['then'](handleEntityNotFound(_0x50193c,null))[_0xc7fa('0x21')](respondWithResult(_0x50193c,null))[_0xc7fa('0x40')](handleError(_0x50193c,null));};exports[_0xc7fa('0x45')]=function(_0x576c81,_0x109f8a){return db[_0xc7fa('0x28')][_0xc7fa('0x45')](_0x576c81[_0xc7fa('0x46')],{})[_0xc7fa('0x21')](respondWithResult(_0x109f8a,0xc9))[_0xc7fa('0x40')](handleError(_0x109f8a,null));};exports[_0xc7fa('0x47')]=function(_0x715ea1,_0x598b24){if(_0x715ea1[_0xc7fa('0x46')]['id']){delete _0x715ea1['body']['id'];}return db[_0xc7fa('0x28')][_0xc7fa('0x44')]({'where':{'id':_0x715ea1[_0xc7fa('0x42')]['id']}})[_0xc7fa('0x21')](handleEntityNotFound(_0x598b24,null))['then'](saveUpdates(_0x715ea1[_0xc7fa('0x46')],null))[_0xc7fa('0x21')](respondWithResult(_0x598b24,null))[_0xc7fa('0x40')](handleError(_0x598b24,null));};exports['destroy']=function(_0x38dca6,_0x49c91f){return db[_0xc7fa('0x28')][_0xc7fa('0x44')]({'where':{'id':_0x38dca6[_0xc7fa('0x42')]['id']}})[_0xc7fa('0x21')](handleEntityNotFound(_0x49c91f,null))['then'](removeEntity(_0x49c91f,null))[_0xc7fa('0x40')](handleError(_0x49c91f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 9bd43de..8e938fc 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 _0xb350=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb350,0x6f));var _0x0b35=function(_0x208d6d,_0x47f7b6){_0x208d6d=_0x208d6d-0x0;var _0x432519=_0xb350[_0x208d6d];return _0x432519;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require(_0x0b35('0x2'))(_0x0b35('0x3'));var moment=require('moment');var BPromise=require(_0x0b35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b35('0x5'));var rimraf=require('rimraf');var config=require(_0x0b35('0x6'));var attributes=require(_0x0b35('0x7'));module[_0x0b35('0x8')]=function(_0x1218c3,_0x417722){return _0x1218c3[_0x0b35('0x9')](_0x0b35('0xa'),attributes,{'tableName':_0x0b35('0xb'),'paranoid':![],'indexes':[{'name':_0x0b35('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11f3=['FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','define'];(function(_0x1b7492,_0x413027){var _0x1b6bd1=function(_0x338073){while(--_0x338073){_0x1b7492['push'](_0x1b7492['shift']());}};_0x1b6bd1(++_0x413027);}(_0x11f3,0x149));var _0x311f=function(_0x1f8a8c,_0x43ae12){_0x1f8a8c=_0x1f8a8c-0x0;var _0x2254ba=_0x11f3[_0x1f8a8c];return _0x2254ba;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var logger=require(_0x311f('0x2'))('api');var moment=require(_0x311f('0x3'));var BPromise=require('bluebird');var rp=require(_0x311f('0x4'));var fs=require('fs');var path=require(_0x311f('0x5'));var rimraf=require(_0x311f('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x311f('0x7')]=function(_0x57ee36,_0x30d05f){return _0x57ee36[_0x311f('0x8')](_0x311f('0x9'),attributes,{'tableName':_0x311f('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x311f('0xb'),_0x311f('0xc')],'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 821c598..bdc8fa1 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 _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x1c5b76,_0x1d3c41){var _0x179518=function(_0x3601d7){while(--_0x3601d7){_0x1c5b76['push'](_0x1c5b76['shift']());}};_0x179518(++_0x1d3c41);}(_0xeda8,0x104));var _0x8eda=function(_0x2b9003,_0x466ad8){_0x2b9003=_0x2b9003-0x0;var _0x555984=_0xeda8[_0x2b9003];return _0x555984;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4e33c0,_0x555fda){var _0x1f7aa3=function(_0x2b688b){while(--_0x2b688b){_0x4e33c0['push'](_0x4e33c0['shift']());}};_0x1f7aa3(++_0x555fda);}(_0x31f0,0xb7));var _0x031f=function(_0x552d08,_0x5b341e){_0x552d08=_0x552d08-0x0;var _0x595563=_0x31f0[_0x552d08];return _0x595563;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3025d57..626c879 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x26966d,_0x18fd70){var _0x4e5754=function(_0x46f33f){while(--_0x46f33f){_0x26966d['push'](_0x26966d['shift']());}};_0x4e5754(++_0x18fd70);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4481c6,_0x131afa){var _0x2aeded=function(_0x7f7d67){while(--_0x7f7d67){_0x4481c6['push'](_0x4481c6['shift']());}};_0x2aeded(++_0x131afa);}(_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('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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3dfd5e3..053d504 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 _0xbd36=['exports','STRING','username','integrationTab','newTab','sequelize'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xbd36,0x65));var _0x6bd3=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbd36[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x6bd3('0x0'));module[_0x6bd3('0x1')]={'name':{'type':Sequelize[_0x6bd3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6bd3('0x3')},'remoteUri':{'type':Sequelize[_0x6bd3('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6bd3('0x2')]},'clientSecret':{'type':Sequelize[_0x6bd3('0x2')]},'securityToken':{'type':Sequelize[_0x6bd3('0x2')]},'serverUrl':{'type':Sequelize[_0x6bd3('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6bd3('0x4'),_0x6bd3('0x5')),'defaultValue':_0x6bd3('0x4')}}; \ No newline at end of file +var _0x0699=['newTab','sequelize','STRING','username','ENUM','integrationTab'];(function(_0x49433f,_0x19f019){var _0x473015=function(_0xd7616){while(--_0xd7616){_0x49433f['push'](_0x49433f['shift']());}};_0x473015(++_0x19f019);}(_0x0699,0x1db));var _0x9069=function(_0x59d6d1,_0x11326b){_0x59d6d1=_0x59d6d1-0x0;var _0x38520e=_0x0699[_0x59d6d1];return _0x38520e;};'use strict';var Sequelize=require(_0x9069('0x0'));module['exports']={'name':{'type':Sequelize[_0x9069('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9069('0x1')],'unique':_0x9069('0x2')},'remoteUri':{'type':Sequelize[_0x9069('0x1')]},'password':{'type':Sequelize[_0x9069('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x9069('0x1')]},'securityToken':{'type':Sequelize[_0x9069('0x1')]},'serverUrl':{'type':Sequelize[_0x9069('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9069('0x3')](_0x9069('0x4'),_0x9069('0x5')),'defaultValue':_0x9069('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index ac54d56..a02327d 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 _0x36f2=['email','textarea','phone','remove','includes','picklistValues','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','show','params','find','create','body','catch','findOne','SalesforceConfiguration','order','pick','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','Subjects','Task','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean'];(function(_0xb3bbc8,_0x2a3635){var _0x3254b7=function(_0x823e23){while(--_0x823e23){_0xb3bbc8['push'](_0xb3bbc8['shift']());}};_0x3254b7(++_0x2a3635);}(_0x36f2,0x8b));var _0x236f=function(_0x38d154,_0x3e835b){_0x38d154=_0x38d154-0x0;var _0x50c412=_0x36f2[_0x38d154];return _0x50c412;};'use strict';var emlformat=require(_0x236f('0x0'));var rimraf=require(_0x236f('0x1'));var zipdir=require(_0x236f('0x2'));var jsonpatch=require(_0x236f('0x3'));var rp=require(_0x236f('0x4'));var moment=require(_0x236f('0x5'));var BPromise=require(_0x236f('0x6'));var Mustache=require(_0x236f('0x7'));var util=require(_0x236f('0x8'));var path=require(_0x236f('0x9'));var sox=require(_0x236f('0xa'));var csv=require('to-csv');var ejs=require(_0x236f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x236f('0xc'));var squel=require(_0x236f('0xd'));var crypto=require(_0x236f('0xe'));var jsforce=require(_0x236f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x236f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x236f('0x11'));var qs=require(_0x236f('0x12'));var as=require(_0x236f('0x13'));var hardwareService=require(_0x236f('0x14'));var logger=require(_0x236f('0x15'))('api');var utils=require(_0x236f('0x16'));var config=require(_0x236f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x236f('0x18'))['db'];var integrations=require(_0x236f('0x19'));function respondWithStatusCode(_0x2e5631,_0x11d619){_0x11d619=_0x11d619||0xcc;return function(_0x1d82da){if(_0x1d82da){return _0x2e5631[_0x236f('0x1a')](_0x11d619);}return _0x2e5631[_0x236f('0x1b')](_0x11d619)[_0x236f('0x1c')]();};}function respondWithResult(_0x2be4f8,_0x41fdb5){_0x41fdb5=_0x41fdb5||0xc8;return function(_0x1081ac){if(_0x1081ac){return _0x2be4f8[_0x236f('0x1b')](_0x41fdb5)[_0x236f('0x1d')](_0x1081ac);}};}function respondWithFilteredResult(_0x3574b3,_0x39dfa0){return function(_0x4adfbf){if(_0x4adfbf){var _0xf6f6d5=typeof _0x39dfa0['offset']===_0x236f('0x1e')&&typeof _0x39dfa0['limit']==='undefined';var _0x254e94=_0x4adfbf['count'];var _0x345b69=_0xf6f6d5?0x0:_0x39dfa0[_0x236f('0x1f')];var _0x8b1f35=_0xf6f6d5?_0x4adfbf[_0x236f('0x20')]:_0x39dfa0[_0x236f('0x1f')]+_0x39dfa0[_0x236f('0x21')];var _0x22b4e5;if(_0x8b1f35>=_0x254e94){_0x8b1f35=_0x254e94;_0x22b4e5=0xc8;}else{_0x22b4e5=0xce;}_0x3574b3[_0x236f('0x1b')](_0x22b4e5);return _0x3574b3[_0x236f('0x22')](_0x236f('0x23'),_0x345b69+'-'+_0x8b1f35+'/'+_0x254e94)[_0x236f('0x1d')](_0x4adfbf);}return null;};}function patchUpdates(_0x90fdd5){return function(_0x5df2fb){try{jsonpatch['apply'](_0x5df2fb,_0x90fdd5,!![]);}catch(_0x8f4727){return BPromise[_0x236f('0x24')](_0x8f4727);}return _0x5df2fb['save']();};}function saveUpdates(_0x480a13,_0x48cfa2){return function(_0x2a4dbf){if(_0x2a4dbf){return _0x2a4dbf[_0x236f('0x25')](_0x480a13)['then'](function(_0x521d4b){return _0x521d4b;});}return null;};}function removeEntity(_0x5cf7d2,_0x47f644){return function(_0x416ae1){if(_0x416ae1){return _0x416ae1[_0x236f('0x26')]()[_0x236f('0x27')](function(){_0x5cf7d2[_0x236f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc5dc,_0x1b420a){return function(_0x446221){if(!_0x446221){_0x2dc5dc[_0x236f('0x1a')](0x194);}return _0x446221;};}function handleError(_0x46d739,_0xb14373){_0xb14373=_0xb14373||0x1f4;return function(_0x338170){logger['error'](_0x338170[_0x236f('0x28')]);if(_0x338170[_0x236f('0x29')]){delete _0x338170[_0x236f('0x29')];}_0x46d739['status'](_0xb14373)[_0x236f('0x2a')](_0x338170);};}exports[_0x236f('0x2b')]=function(_0x34b514,_0x5b230c){var _0x5b37c0={},_0x294599={},_0x3fdb2d={'count':0x0,'rows':[]};var _0x30ea85=_[_0x236f('0x2c')](db['SalesforceAccount'][_0x236f('0x2d')],function(_0x4648f7){return{'name':_0x4648f7[_0x236f('0x2e')],'type':_0x4648f7[_0x236f('0x2f')][_0x236f('0x30')]};});_0x294599[_0x236f('0x31')]=_[_0x236f('0x2c')](_0x30ea85,'name');_0x294599[_0x236f('0x32')]=_[_0x236f('0x33')](_0x34b514['query']);_0x294599[_0x236f('0x34')]=_[_0x236f('0x35')](_0x294599[_0x236f('0x31')],_0x294599[_0x236f('0x32')]);_0x5b37c0[_0x236f('0x36')]=_[_0x236f('0x35')](_0x294599[_0x236f('0x31')],qs[_0x236f('0x37')](_0x34b514[_0x236f('0x32')]['fields']));_0x5b37c0[_0x236f('0x36')]=_0x5b37c0['attributes'][_0x236f('0x38')]?_0x5b37c0[_0x236f('0x36')]:_0x294599[_0x236f('0x31')];if(!_0x34b514[_0x236f('0x32')][_0x236f('0x39')](_0x236f('0x3a'))){_0x5b37c0[_0x236f('0x21')]=qs[_0x236f('0x21')](_0x34b514[_0x236f('0x32')]['limit']);_0x5b37c0[_0x236f('0x1f')]=qs['offset'](_0x34b514[_0x236f('0x32')][_0x236f('0x1f')]);}_0x5b37c0['order']=qs[_0x236f('0x3b')](_0x34b514[_0x236f('0x32')][_0x236f('0x3b')]);_0x5b37c0['where']=qs['filters'](_['pick'](_0x34b514[_0x236f('0x32')],_0x294599[_0x236f('0x34')]),_0x30ea85);if(_0x34b514['query'][_0x236f('0x3c')]){_0x5b37c0[_0x236f('0x3d')]=_[_0x236f('0x3e')](_0x5b37c0[_0x236f('0x3d')],{'$or':_[_0x236f('0x2c')](_0x30ea85,function(_0x327181){if(_0x327181[_0x236f('0x2f')]!==_0x236f('0x3f')){var _0xb9d27={};_0xb9d27[_0x327181[_0x236f('0x29')]]={'$like':'%'+_0x34b514[_0x236f('0x32')]['filter']+'%'};return _0xb9d27;}})});}_0x5b37c0=_[_0x236f('0x3e')]({},_0x5b37c0,_0x34b514[_0x236f('0x40')]);var _0x53a7ca={'where':_0x5b37c0['where']};return db[_0x236f('0x41')]['count'](_0x53a7ca)['then'](function(_0x586ba2){_0x3fdb2d[_0x236f('0x20')]=_0x586ba2;if(_0x34b514[_0x236f('0x32')][_0x236f('0x42')]){_0x5b37c0[_0x236f('0x43')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x236f('0x44')](_0x5b37c0);})[_0x236f('0x27')](function(_0x2b1663){_0x3fdb2d[_0x236f('0x45')]=_0x2b1663;return _0x3fdb2d;})['then'](respondWithFilteredResult(_0x5b230c,_0x5b37c0))['catch'](handleError(_0x5b230c,null));};exports[_0x236f('0x46')]=function(_0x5f0bbe,_0x5adc47){var _0x34bcbe={'raw':![],'where':{'id':_0x5f0bbe[_0x236f('0x47')]['id']}},_0x1aaa43={};_0x1aaa43['model']=_[_0x236f('0x33')](db['SalesforceAccount'][_0x236f('0x2d')]);_0x1aaa43[_0x236f('0x32')]=_['keys'](_0x5f0bbe[_0x236f('0x32')]);_0x1aaa43[_0x236f('0x34')]=_[_0x236f('0x35')](_0x1aaa43[_0x236f('0x31')],_0x1aaa43[_0x236f('0x32')]);_0x34bcbe[_0x236f('0x36')]=_[_0x236f('0x35')](_0x1aaa43[_0x236f('0x31')],qs[_0x236f('0x37')](_0x5f0bbe[_0x236f('0x32')][_0x236f('0x37')]));_0x34bcbe[_0x236f('0x36')]=_0x34bcbe['attributes'][_0x236f('0x38')]?_0x34bcbe[_0x236f('0x36')]:_0x1aaa43[_0x236f('0x31')];if(_0x5f0bbe[_0x236f('0x32')]['includeAll']){_0x34bcbe['include']=[{'all':!![]}];}_0x34bcbe=_['merge']({},_0x34bcbe,_0x5f0bbe['options']);return db['SalesforceAccount'][_0x236f('0x48')](_0x34bcbe)[_0x236f('0x27')](handleEntityNotFound(_0x5adc47,null))[_0x236f('0x27')](respondWithResult(_0x5adc47,null))['catch'](handleError(_0x5adc47,null));};exports[_0x236f('0x49')]=function(_0x2d5ff3,_0x58ba27){return db['SalesforceAccount']['create'](_0x2d5ff3[_0x236f('0x4a')],{})[_0x236f('0x27')](respondWithResult(_0x58ba27,0xc9))['catch'](handleError(_0x58ba27,null));};exports[_0x236f('0x25')]=function(_0x145b29,_0x5845a9){if(_0x145b29[_0x236f('0x4a')]['id']){delete _0x145b29[_0x236f('0x4a')]['id'];}return db[_0x236f('0x41')][_0x236f('0x48')]({'where':{'id':_0x145b29['params']['id']}})[_0x236f('0x27')](handleEntityNotFound(_0x5845a9,null))[_0x236f('0x27')](saveUpdates(_0x145b29[_0x236f('0x4a')],null))['then'](respondWithResult(_0x5845a9,null))['catch'](handleError(_0x5845a9,null));};exports['destroy']=function(_0x1122d8,_0x561d76){return db[_0x236f('0x41')][_0x236f('0x48')]({'where':{'id':_0x1122d8['params']['id']}})[_0x236f('0x27')](handleEntityNotFound(_0x561d76,null))[_0x236f('0x27')](removeEntity(_0x561d76,null))[_0x236f('0x4b')](handleError(_0x561d76,null));};exports['getConfigurations']=function(_0x1cb094,_0x2897ff,_0x59232f){var _0x481619={};var _0x1b5cbb={};var _0x62287c;var _0x41b8ec;return db[_0x236f('0x41')][_0x236f('0x4c')]({'where':{'id':_0x1cb094[_0x236f('0x47')]['id']}})[_0x236f('0x27')](handleEntityNotFound(_0x2897ff,null))['then'](function(_0x3ebd6a){if(_0x3ebd6a){_0x62287c=_0x3ebd6a;_0x1b5cbb['model']=_['keys'](db[_0x236f('0x4d')][_0x236f('0x2d')]);_0x1b5cbb['query']=_[_0x236f('0x33')](_0x1cb094[_0x236f('0x32')]);_0x1b5cbb[_0x236f('0x34')]=_[_0x236f('0x35')](_0x1b5cbb[_0x236f('0x31')],_0x1b5cbb[_0x236f('0x32')]);_0x481619[_0x236f('0x36')]=_[_0x236f('0x35')](_0x1b5cbb[_0x236f('0x31')],qs[_0x236f('0x37')](_0x1cb094[_0x236f('0x32')][_0x236f('0x37')]));_0x481619['attributes']=_0x481619[_0x236f('0x36')][_0x236f('0x38')]?_0x481619[_0x236f('0x36')]:_0x1b5cbb[_0x236f('0x31')];_0x481619[_0x236f('0x4e')]=qs[_0x236f('0x3b')](_0x1cb094[_0x236f('0x32')][_0x236f('0x3b')]);_0x481619[_0x236f('0x3d')]=qs['filters'](_[_0x236f('0x4f')](_0x1cb094[_0x236f('0x32')],_0x1b5cbb[_0x236f('0x34')]));if(_0x1cb094['query'][_0x236f('0x3c')]){_0x481619[_0x236f('0x3d')]=_[_0x236f('0x3e')](_0x481619[_0x236f('0x3d')],{'$or':_[_0x236f('0x2c')](_0x481619[_0x236f('0x36')],function(_0x5b87e2){var _0x42a2ba={};_0x42a2ba[_0x5b87e2]={'$like':'%'+_0x1cb094[_0x236f('0x32')][_0x236f('0x3c')]+'%'};return _0x42a2ba;})});}_0x481619=_[_0x236f('0x3e')]({},_0x481619,_0x1cb094['options']);return _0x62287c[_0x236f('0x50')](_0x481619);}})[_0x236f('0x27')](function(_0xb1725b){if(_0xb1725b){_0x41b8ec=_0xb1725b['length'];if(!_0x1cb094[_0x236f('0x32')][_0x236f('0x39')](_0x236f('0x3a'))){_0x481619[_0x236f('0x21')]=qs[_0x236f('0x21')](_0x1cb094[_0x236f('0x32')][_0x236f('0x21')]);_0x481619[_0x236f('0x1f')]=qs[_0x236f('0x1f')](_0x1cb094['query'][_0x236f('0x1f')]);}return _0x62287c[_0x236f('0x50')](_0x481619);}})[_0x236f('0x27')](function(_0x3fc443){if(_0x3fc443){return _0x3fc443?{'count':_0x41b8ec,'rows':_0x3fc443}:null;}})[_0x236f('0x27')](respondWithResult(_0x2897ff,null))[_0x236f('0x4b')](handleError(_0x2897ff,null));};exports[_0x236f('0x51')]=function(_0x4ffdcd,_0x482b39,_0x13c2d7){if(_0x4ffdcd['body']['id']){delete _0x4ffdcd[_0x236f('0x4a')]['id'];}return db[_0x236f('0x41')][_0x236f('0x4c')]({'where':{'id':_0x4ffdcd[_0x236f('0x47')]['id']}})['then'](handleEntityNotFound(_0x482b39,null))[_0x236f('0x27')](function(_0x2b9497){if(_0x2b9497){_0x4ffdcd[_0x236f('0x4a')][_0x236f('0x52')]=_0x2b9497['id'];_0x4ffdcd['body']['Subjects']=integrations[_0x236f('0x53')](_0x4ffdcd['body'][_0x236f('0x54')],_0x4ffdcd[_0x236f('0x4a')]['type']);_0x4ffdcd['body'][_0x236f('0x55')]=integrations['getDescriptions'](_0x4ffdcd[_0x236f('0x4a')][_0x236f('0x54')],_0x4ffdcd[_0x236f('0x4a')][_0x236f('0x2f')]);return db['SalesforceConfiguration'][_0x236f('0x49')](_0x4ffdcd[_0x236f('0x4a')],{'include':[{'model':db[_0x236f('0x56')],'as':_0x236f('0x57')},{'model':db['SalesforceField'],'as':_0x236f('0x55')}]});}return null;})[_0x236f('0x27')](respondWithResult(_0x482b39,null))['catch'](handleError(_0x482b39,null));};exports['getFields']=function(_0x506c41,_0x27c616,_0x1d4a51){var _0x196bc5;var _0x687369='';var _0x11a3f0=_0x236f('0x58');return db[_0x236f('0x41')]['findOne']({'where':{'id':_0x506c41[_0x236f('0x47')]['id']},'attributes':['id',_0x236f('0x59'),_0x236f('0x5a'),'clientSecret',_0x236f('0x5b'),'password',_0x236f('0x5c')]})['then'](handleEntityNotFound(_0x27c616,null))['then'](function(_0x341e3a){if(_0x341e3a){_0x687369=_0x341e3a[_0x236f('0x59')];var _0x5b4b72=_0x687369[_0x236f('0x5d')](-0x1);if(_0x5b4b72==='/'){_0x687369=_0x687369[_0x236f('0x5e')](0x0,_0x687369[_0x236f('0x5f')](_0x5b4b72));}_0x196bc5=new jsforce[(_0x236f('0x60'))]({'oauth2':{'loginUrl':_0x687369,'clientId':_0x341e3a[_0x236f('0x5a')],'clientSecret':_0x341e3a[_0x236f('0x61')]}});return _0x196bc5[_0x236f('0x62')](_0x341e3a['username'],_0x341e3a['password'][_0x236f('0x63')](_0x341e3a[_0x236f('0x5c')]));}})[_0x236f('0x27')](function(_0x3f7242){if(_0x3f7242){if(!_[_0x236f('0x64')](_0x506c41[_0x236f('0x32')][_0x236f('0x65')])){_0x11a3f0=_0x506c41[_0x236f('0x32')][_0x236f('0x65')];}return _0x196bc5[_0x236f('0x66')](_0x11a3f0)[_0x236f('0x67')]();}})[_0x236f('0x27')](function(_0x51a95d){var _0x48469c=[_0x236f('0x68'),_0x236f('0x69'),_0x236f('0x6a'),_0x236f('0x6b'),_0x236f('0x6c'),'Description'];var _0x45f948=[_0x236f('0x6d'),_0x236f('0x6e'),_0x236f('0x6f'),_0x236f('0x70'),_0x236f('0x71'),_0x236f('0x72'),_0x236f('0x73')];if(_0x51a95d){_[_0x236f('0x74')](_0x51a95d['fields'],function(_0x45a0a1){return _0x48469c[_0x236f('0x75')](_0x45a0a1['name'])||!_0x45f948[_0x236f('0x75')](_0x45a0a1[_0x236f('0x2f')]);});return{'count':_0x51a95d[_0x236f('0x37')][_0x236f('0x38')],'rows':_[_0x236f('0x2c')](_0x51a95d[_0x236f('0x37')],function(_0x388854){return{'id':_0x388854[_0x236f('0x29')],'name':_0x388854['label'],'custom':_0x388854['custom'],'options':_0x388854[_0x236f('0x76')]['length']>0x0?_[_0x236f('0x2c')](_0x388854[_0x236f('0x76')],function(_0x7accd7){return{'name':_0x7accd7['label'],'value':_0x7accd7['value']};}):_0x388854[_0x236f('0x2f')]==_0x236f('0x70')?[{'name':'True','value':'true'},{'name':'False','value':_0x236f('0x77')}]:[]};})};}})['then'](respondWithResult(_0x27c616,null))[_0x236f('0x4b')](function(_0x4793){var _0x2e8b80=_0x506c41['query'][_0x236f('0x78')]?0x1f4:_0x4793[_0x236f('0x79')]||0x1f4;logger['error'](_0x236f('0x7a'),_0x236f('0x7b'),_0x2e8b80,JSON[_0x236f('0x7c')](_0x4793));delete _0x4793[_0x236f('0x29')];if(_0x2e8b80===0x191){_0x2e8b80=0x190;}_0x27c616['status'](_0x2e8b80)[_0x236f('0x2a')](_0x506c41[_0x236f('0x32')][_0x236f('0x78')]?{'message':_0x236f('0x7d'),'statusCode':_0x4793[_0x236f('0x79')]}:_0x4793);});}; \ No newline at end of file +var _0x9747=['../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','VIRTUAL','options','includeAll','rows','catch','params','keys','merge','create','body','find','getConfigurations','findOne','SalesforceConfiguration','filter','addConfiguration','Subjects','getSubjects','Descriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','substring','lastIndexOf','Connection','securityToken','isNil','ticketType','IsReminderSet','IsRecurrence','Subject','int','boolean','email','phone','remove','includes','label','custom','picklistValues','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0x9747,0x14c));var _0x7974=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9747[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7974('0x0'));var rimraf=require(_0x7974('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7974('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7974('0x3'));var util=require(_0x7974('0x4'));var path=require(_0x7974('0x5'));var sox=require(_0x7974('0x6'));var csv=require('to-csv');var ejs=require(_0x7974('0x7'));var fs=require('fs');var fs_extra=require(_0x7974('0x8'));var _=require(_0x7974('0x9'));var squel=require(_0x7974('0xa'));var crypto=require(_0x7974('0xb'));var jsforce=require(_0x7974('0xc'));var deskjs=require(_0x7974('0xd'));var toCsv=require(_0x7974('0xe'));var querystring=require('querystring');var Papa=require(_0x7974('0xf'));var Redis=require(_0x7974('0x10'));var authService=require(_0x7974('0x11'));var qs=require(_0x7974('0x12'));var as=require(_0x7974('0x13'));var hardwareService=require(_0x7974('0x14'));var logger=require(_0x7974('0x15'))(_0x7974('0x16'));var utils=require(_0x7974('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7974('0x18'))['db'];var integrations=require(_0x7974('0x19'));function respondWithStatusCode(_0xfaa3c3,_0x1cd54d){_0x1cd54d=_0x1cd54d||0xcc;return function(_0x419763){if(_0x419763){return _0xfaa3c3[_0x7974('0x1a')](_0x1cd54d);}return _0xfaa3c3[_0x7974('0x1b')](_0x1cd54d)[_0x7974('0x1c')]();};}function respondWithResult(_0x159dfe,_0x2b2eae){_0x2b2eae=_0x2b2eae||0xc8;return function(_0x5c92db){if(_0x5c92db){return _0x159dfe[_0x7974('0x1b')](_0x2b2eae)['json'](_0x5c92db);}};}function respondWithFilteredResult(_0x7c30a7,_0x122381){return function(_0x36a4b3){if(_0x36a4b3){var _0x45beb8=typeof _0x122381[_0x7974('0x1d')]===_0x7974('0x1e')&&typeof _0x122381['limit']==='undefined';var _0xc61bb0=_0x36a4b3[_0x7974('0x1f')];var _0x3b9ffc=_0x45beb8?0x0:_0x122381['offset'];var _0x554123=_0x45beb8?_0x36a4b3[_0x7974('0x1f')]:_0x122381[_0x7974('0x1d')]+_0x122381['limit'];var _0x5e404e;if(_0x554123>=_0xc61bb0){_0x554123=_0xc61bb0;_0x5e404e=0xc8;}else{_0x5e404e=0xce;}_0x7c30a7[_0x7974('0x1b')](_0x5e404e);return _0x7c30a7[_0x7974('0x20')](_0x7974('0x21'),_0x3b9ffc+'-'+_0x554123+'/'+_0xc61bb0)[_0x7974('0x22')](_0x36a4b3);}return null;};}function patchUpdates(_0x24d7e7){return function(_0x55dbe3){try{jsonpatch[_0x7974('0x23')](_0x55dbe3,_0x24d7e7,!![]);}catch(_0x2447ba){return BPromise[_0x7974('0x24')](_0x2447ba);}return _0x55dbe3[_0x7974('0x25')]();};}function saveUpdates(_0x4c7f92,_0x3b1985){return function(_0x201f46){if(_0x201f46){return _0x201f46[_0x7974('0x26')](_0x4c7f92)[_0x7974('0x27')](function(_0x3c30a5){return _0x3c30a5;});}return null;};}function removeEntity(_0x1311b5,_0x5ddeb0){return function(_0x718fee){if(_0x718fee){return _0x718fee[_0x7974('0x28')]()[_0x7974('0x27')](function(){_0x1311b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c8212,_0x109965){return function(_0x99b932){if(!_0x99b932){_0x4c8212[_0x7974('0x1a')](0x194);}return _0x99b932;};}function handleError(_0x4146c6,_0x568f3b){_0x568f3b=_0x568f3b||0x1f4;return function(_0x591e4c){logger[_0x7974('0x29')](_0x591e4c[_0x7974('0x2a')]);if(_0x591e4c[_0x7974('0x2b')]){delete _0x591e4c[_0x7974('0x2b')];}_0x4146c6[_0x7974('0x1b')](_0x568f3b)[_0x7974('0x2c')](_0x591e4c);};}exports[_0x7974('0x2d')]=function(_0x32d7ee,_0x2109a0){var _0x19f21f={},_0x3fc857={},_0x140645={'count':0x0,'rows':[]};var _0x561bef=_[_0x7974('0x2e')](db[_0x7974('0x2f')][_0x7974('0x30')],function(_0x1d9727){return{'name':_0x1d9727[_0x7974('0x31')],'type':_0x1d9727[_0x7974('0x32')][_0x7974('0x33')]};});_0x3fc857[_0x7974('0x34')]=_[_0x7974('0x2e')](_0x561bef,_0x7974('0x2b'));_0x3fc857[_0x7974('0x35')]=_['keys'](_0x32d7ee[_0x7974('0x35')]);_0x3fc857[_0x7974('0x36')]=_[_0x7974('0x37')](_0x3fc857['model'],_0x3fc857[_0x7974('0x35')]);_0x19f21f[_0x7974('0x38')]=_[_0x7974('0x37')](_0x3fc857[_0x7974('0x34')],qs['fields'](_0x32d7ee['query'][_0x7974('0x39')]));_0x19f21f['attributes']=_0x19f21f['attributes'][_0x7974('0x3a')]?_0x19f21f[_0x7974('0x38')]:_0x3fc857[_0x7974('0x34')];if(!_0x32d7ee[_0x7974('0x35')]['hasOwnProperty'](_0x7974('0x3b'))){_0x19f21f[_0x7974('0x3c')]=qs[_0x7974('0x3c')](_0x32d7ee[_0x7974('0x35')][_0x7974('0x3c')]);_0x19f21f['offset']=qs[_0x7974('0x1d')](_0x32d7ee[_0x7974('0x35')][_0x7974('0x1d')]);}_0x19f21f[_0x7974('0x3d')]=qs[_0x7974('0x3e')](_0x32d7ee[_0x7974('0x35')][_0x7974('0x3e')]);_0x19f21f[_0x7974('0x3f')]=qs[_0x7974('0x36')](_[_0x7974('0x40')](_0x32d7ee[_0x7974('0x35')],_0x3fc857[_0x7974('0x36')]),_0x561bef);if(_0x32d7ee[_0x7974('0x35')]['filter']){_0x19f21f[_0x7974('0x3f')]=_['merge'](_0x19f21f['where'],{'$or':_[_0x7974('0x2e')](_0x561bef,function(_0x510d48){if(_0x510d48[_0x7974('0x32')]!==_0x7974('0x41')){var _0x2181b0={};_0x2181b0[_0x510d48[_0x7974('0x2b')]]={'$like':'%'+_0x32d7ee[_0x7974('0x35')]['filter']+'%'};return _0x2181b0;}})});}_0x19f21f=_['merge']({},_0x19f21f,_0x32d7ee[_0x7974('0x42')]);var _0x3af9e6={'where':_0x19f21f[_0x7974('0x3f')]};return db['SalesforceAccount'][_0x7974('0x1f')](_0x3af9e6)[_0x7974('0x27')](function(_0x457bec){_0x140645[_0x7974('0x1f')]=_0x457bec;if(_0x32d7ee[_0x7974('0x35')][_0x7974('0x43')]){_0x19f21f['include']=[{'all':!![]}];}return db[_0x7974('0x2f')]['findAll'](_0x19f21f);})[_0x7974('0x27')](function(_0x19f2c4){_0x140645[_0x7974('0x44')]=_0x19f2c4;return _0x140645;})[_0x7974('0x27')](respondWithFilteredResult(_0x2109a0,_0x19f21f))[_0x7974('0x45')](handleError(_0x2109a0,null));};exports['show']=function(_0x2581e7,_0x659467){var _0x5d0656={'raw':![],'where':{'id':_0x2581e7[_0x7974('0x46')]['id']}},_0x131221={};_0x131221[_0x7974('0x34')]=_[_0x7974('0x47')](db[_0x7974('0x2f')]['rawAttributes']);_0x131221['query']=_[_0x7974('0x47')](_0x2581e7[_0x7974('0x35')]);_0x131221[_0x7974('0x36')]=_[_0x7974('0x37')](_0x131221[_0x7974('0x34')],_0x131221[_0x7974('0x35')]);_0x5d0656[_0x7974('0x38')]=_[_0x7974('0x37')](_0x131221['model'],qs['fields'](_0x2581e7['query'][_0x7974('0x39')]));_0x5d0656[_0x7974('0x38')]=_0x5d0656[_0x7974('0x38')]['length']?_0x5d0656[_0x7974('0x38')]:_0x131221[_0x7974('0x34')];if(_0x2581e7['query'][_0x7974('0x43')]){_0x5d0656['include']=[{'all':!![]}];}_0x5d0656=_[_0x7974('0x48')]({},_0x5d0656,_0x2581e7[_0x7974('0x42')]);return db[_0x7974('0x2f')]['find'](_0x5d0656)['then'](handleEntityNotFound(_0x659467,null))[_0x7974('0x27')](respondWithResult(_0x659467,null))[_0x7974('0x45')](handleError(_0x659467,null));};exports[_0x7974('0x49')]=function(_0x511e20,_0x5dd66a){return db['SalesforceAccount'][_0x7974('0x49')](_0x511e20[_0x7974('0x4a')],{})[_0x7974('0x27')](respondWithResult(_0x5dd66a,0xc9))[_0x7974('0x45')](handleError(_0x5dd66a,null));};exports['update']=function(_0x2f181f,_0x4d047e){if(_0x2f181f[_0x7974('0x4a')]['id']){delete _0x2f181f[_0x7974('0x4a')]['id'];}return db[_0x7974('0x2f')]['find']({'where':{'id':_0x2f181f['params']['id']}})['then'](handleEntityNotFound(_0x4d047e,null))[_0x7974('0x27')](saveUpdates(_0x2f181f['body'],null))[_0x7974('0x27')](respondWithResult(_0x4d047e,null))['catch'](handleError(_0x4d047e,null));};exports[_0x7974('0x28')]=function(_0x19d1d7,_0x9622cb){return db[_0x7974('0x2f')][_0x7974('0x4b')]({'where':{'id':_0x19d1d7[_0x7974('0x46')]['id']}})[_0x7974('0x27')](handleEntityNotFound(_0x9622cb,null))['then'](removeEntity(_0x9622cb,null))[_0x7974('0x45')](handleError(_0x9622cb,null));};exports[_0x7974('0x4c')]=function(_0x341e7c,_0x4686ad,_0x5c17ea){var _0x2ecc58={};var _0x4c280a={};var _0x435319;var _0x1bdfaa;return db['SalesforceAccount'][_0x7974('0x4d')]({'where':{'id':_0x341e7c[_0x7974('0x46')]['id']}})[_0x7974('0x27')](handleEntityNotFound(_0x4686ad,null))['then'](function(_0x130a6f){if(_0x130a6f){_0x435319=_0x130a6f;_0x4c280a[_0x7974('0x34')]=_[_0x7974('0x47')](db[_0x7974('0x4e')][_0x7974('0x30')]);_0x4c280a[_0x7974('0x35')]=_['keys'](_0x341e7c[_0x7974('0x35')]);_0x4c280a[_0x7974('0x36')]=_[_0x7974('0x37')](_0x4c280a[_0x7974('0x34')],_0x4c280a['query']);_0x2ecc58['attributes']=_[_0x7974('0x37')](_0x4c280a[_0x7974('0x34')],qs[_0x7974('0x39')](_0x341e7c[_0x7974('0x35')][_0x7974('0x39')]));_0x2ecc58[_0x7974('0x38')]=_0x2ecc58[_0x7974('0x38')][_0x7974('0x3a')]?_0x2ecc58['attributes']:_0x4c280a[_0x7974('0x34')];_0x2ecc58[_0x7974('0x3d')]=qs[_0x7974('0x3e')](_0x341e7c[_0x7974('0x35')][_0x7974('0x3e')]);_0x2ecc58[_0x7974('0x3f')]=qs[_0x7974('0x36')](_[_0x7974('0x40')](_0x341e7c[_0x7974('0x35')],_0x4c280a[_0x7974('0x36')]));if(_0x341e7c[_0x7974('0x35')][_0x7974('0x4f')]){_0x2ecc58[_0x7974('0x3f')]=_[_0x7974('0x48')](_0x2ecc58['where'],{'$or':_[_0x7974('0x2e')](_0x2ecc58[_0x7974('0x38')],function(_0x4ca1d6){var _0x5546a1={};_0x5546a1[_0x4ca1d6]={'$like':'%'+_0x341e7c['query']['filter']+'%'};return _0x5546a1;})});}_0x2ecc58=_[_0x7974('0x48')]({},_0x2ecc58,_0x341e7c[_0x7974('0x42')]);return _0x435319[_0x7974('0x4c')](_0x2ecc58);}})[_0x7974('0x27')](function(_0x43dc3b){if(_0x43dc3b){_0x1bdfaa=_0x43dc3b['length'];if(!_0x341e7c[_0x7974('0x35')]['hasOwnProperty'](_0x7974('0x3b'))){_0x2ecc58[_0x7974('0x3c')]=qs['limit'](_0x341e7c['query'][_0x7974('0x3c')]);_0x2ecc58['offset']=qs[_0x7974('0x1d')](_0x341e7c['query']['offset']);}return _0x435319[_0x7974('0x4c')](_0x2ecc58);}})[_0x7974('0x27')](function(_0x203536){if(_0x203536){return _0x203536?{'count':_0x1bdfaa,'rows':_0x203536}:null;}})['then'](respondWithResult(_0x4686ad,null))['catch'](handleError(_0x4686ad,null));};exports[_0x7974('0x50')]=function(_0xb2b4cf,_0x1435e9,_0x1317b0){if(_0xb2b4cf['body']['id']){delete _0xb2b4cf[_0x7974('0x4a')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0xb2b4cf[_0x7974('0x46')]['id']}})[_0x7974('0x27')](handleEntityNotFound(_0x1435e9,null))[_0x7974('0x27')](function(_0x13bbc8){if(_0x13bbc8){_0xb2b4cf['body']['AccountId']=_0x13bbc8['id'];_0xb2b4cf[_0x7974('0x4a')][_0x7974('0x51')]=integrations[_0x7974('0x52')](_0xb2b4cf[_0x7974('0x4a')]['channel'],_0xb2b4cf[_0x7974('0x4a')]['type']);_0xb2b4cf[_0x7974('0x4a')][_0x7974('0x53')]=integrations['getDescriptions'](_0xb2b4cf['body'][_0x7974('0x54')],_0xb2b4cf[_0x7974('0x4a')][_0x7974('0x32')]);return db[_0x7974('0x4e')][_0x7974('0x49')](_0xb2b4cf['body'],{'include':[{'model':db['SalesforceField'],'as':_0x7974('0x51')},{'model':db[_0x7974('0x55')],'as':_0x7974('0x53')}]});}return null;})[_0x7974('0x27')](respondWithResult(_0x1435e9,null))[_0x7974('0x45')](handleError(_0x1435e9,null));};exports[_0x7974('0x56')]=function(_0xeb7231,_0x144e91,_0x3e3a99){var _0x4578f3;var _0x5eaa78='';var _0x340d51=_0x7974('0x57');return db[_0x7974('0x2f')][_0x7974('0x4d')]({'where':{'id':_0xeb7231[_0x7974('0x46')]['id']},'attributes':['id',_0x7974('0x58'),_0x7974('0x59'),_0x7974('0x5a'),_0x7974('0x5b'),_0x7974('0x5c'),'securityToken']})[_0x7974('0x27')](handleEntityNotFound(_0x144e91,null))[_0x7974('0x27')](function(_0xe06b6e){if(_0xe06b6e){_0x5eaa78=_0xe06b6e[_0x7974('0x58')];var _0x5d29ba=_0x5eaa78['slice'](-0x1);if(_0x5d29ba==='/'){_0x5eaa78=_0x5eaa78[_0x7974('0x5d')](0x0,_0x5eaa78[_0x7974('0x5e')](_0x5d29ba));}_0x4578f3=new jsforce[(_0x7974('0x5f'))]({'oauth2':{'loginUrl':_0x5eaa78,'clientId':_0xe06b6e[_0x7974('0x59')],'clientSecret':_0xe06b6e[_0x7974('0x5a')]}});return _0x4578f3['login'](_0xe06b6e[_0x7974('0x5b')],_0xe06b6e['password']['concat'](_0xe06b6e[_0x7974('0x60')]));}})['then'](function(_0x525434){if(_0x525434){if(!_[_0x7974('0x61')](_0xeb7231['query']['ticketType'])){_0x340d51=_0xeb7231[_0x7974('0x35')][_0x7974('0x62')];}return _0x4578f3['sobject'](_0x340d51)['describe']();}})['then'](function(_0x381a65){var _0x55a20e=['OwnerId','ActivityDate',_0x7974('0x63'),_0x7974('0x64'),_0x7974('0x65'),'Description'];var _0x59be2f=['string',_0x7974('0x66'),'picklist',_0x7974('0x67'),_0x7974('0x68'),'textarea',_0x7974('0x69')];if(_0x381a65){_[_0x7974('0x6a')](_0x381a65[_0x7974('0x39')],function(_0x18b99b){return _0x55a20e['includes'](_0x18b99b['name'])||!_0x59be2f[_0x7974('0x6b')](_0x18b99b[_0x7974('0x32')]);});return{'count':_0x381a65[_0x7974('0x39')][_0x7974('0x3a')],'rows':_['map'](_0x381a65[_0x7974('0x39')],function(_0x457596){return{'id':_0x457596[_0x7974('0x2b')],'name':_0x457596[_0x7974('0x6c')],'custom':_0x457596[_0x7974('0x6d')],'options':_0x457596[_0x7974('0x6e')][_0x7974('0x3a')]>0x0?_[_0x7974('0x2e')](_0x457596[_0x7974('0x6e')],function(_0x2c6fac){return{'name':_0x2c6fac[_0x7974('0x6c')],'value':_0x2c6fac[_0x7974('0x6f')]};}):_0x457596[_0x7974('0x32')]=='boolean'?[{'name':'True','value':_0x7974('0x70')},{'name':_0x7974('0x71'),'value':_0x7974('0x72')}]:[]};})};}})['then'](respondWithResult(_0x144e91,null))[_0x7974('0x45')](function(_0x68de2e){var _0x51e8e8=_0xeb7231[_0x7974('0x35')]['test']?0x1f4:_0x68de2e[_0x7974('0x73')]||0x1f4;logger[_0x7974('0x29')](_0x7974('0x74'),_0x7974('0x56'),_0x51e8e8,JSON['stringify'](_0x68de2e));delete _0x68de2e[_0x7974('0x2b')];if(_0x51e8e8===0x191){_0x51e8e8=0x190;}_0x144e91['status'](_0x51e8e8)[_0x7974('0x2c')](_0xeb7231[_0x7974('0x35')][_0x7974('0x75')]?{'message':_0x7974('0x76'),'statusCode':_0x68de2e['statusCode']}:_0x68de2e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2f1b3c5..f8a187c 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 _0x48e0=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','util','../../config/logger','api','moment'];(function(_0x15d68a,_0x2cbb0f){var _0x311647=function(_0x45e54f){while(--_0x45e54f){_0x15d68a['push'](_0x15d68a['shift']());}};_0x311647(++_0x2cbb0f);}(_0x48e0,0x146));var _0x048e=function(_0x31dbf1,_0x424a9c){_0x31dbf1=_0x31dbf1-0x0;var _0x3966cb=_0x48e0[_0x31dbf1];return _0x3966cb;};'use strict';var _=require('lodash');var util=require(_0x048e('0x0'));var logger=require(_0x048e('0x1'))(_0x048e('0x2'));var moment=require(_0x048e('0x3'));var BPromise=require(_0x048e('0x4'));var rp=require(_0x048e('0x5'));var fs=require('fs');var path=require(_0x048e('0x6'));var rimraf=require(_0x048e('0x7'));var config=require(_0x048e('0x8'));var attributes=require(_0x048e('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x133959,_0x12a9ba){return _0x133959['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae4a=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x6b2c5c,_0x3f6949){var _0x18e3ce=function(_0x1a143f){while(--_0x1a143f){_0x6b2c5c['push'](_0x6b2c5c['shift']());}};_0x18e3ce(++_0x3f6949);}(_0xae4a,0x68));var _0xaae4=function(_0x3843e6,_0x5089fa){_0x3843e6=_0x3843e6-0x0;var _0x4dda06=_0xae4a[_0x3843e6];return _0x4dda06;};'use strict';var _=require(_0xaae4('0x0'));var util=require(_0xaae4('0x1'));var logger=require('../../config/logger')(_0xaae4('0x2'));var moment=require(_0xaae4('0x3'));var BPromise=require('bluebird');var rp=require(_0xaae4('0x4'));var fs=require('fs');var path=require(_0xaae4('0x5'));var rimraf=require(_0xaae4('0x6'));var config=require(_0xaae4('0x7'));var attributes=require(_0xaae4('0x8'));var integrations=require(_0xaae4('0x9'));module[_0xaae4('0xa')]=function(_0x454d54,_0x106f6b){return _0x454d54[_0xaae4('0xb')](_0xaae4('0xc'),attributes,{'tableName':_0xaae4('0xd'),'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 c9c127c..4e9bf7b 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 _0x6aba=['SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowSalesforceAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x6aba,0x1e8));var _0xa6ab=function(_0x20f1ac,_0x2ffdb4){_0x20f1ac=_0x20f1ac-0x0;var _0xcb2985=_0x6aba[_0x20f1ac];return _0xcb2985;};'use strict';var _=require(_0xa6ab('0x0'));var util=require('util');var moment=require(_0xa6ab('0x1'));var BPromise=require('bluebird');var rs=require(_0xa6ab('0x2'));var fs=require('fs');var Redis=require(_0xa6ab('0x3'));var db=require(_0xa6ab('0x4'))['db'];var utils=require(_0xa6ab('0x5'));var logger=require(_0xa6ab('0x6'))(_0xa6ab('0x7'));var config=require('../../config/environment');var jayson=require(_0xa6ab('0x8'));var client=jayson[_0xa6ab('0x9')][_0xa6ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee3bb0,_0xc2242b,_0x67d233){return new BPromise(function(_0x3c7f00,_0x3edd63){return client['request'](_0xee3bb0,_0x67d233)[_0xa6ab('0xb')](function(_0x3cf302){logger[_0xa6ab('0xc')](_0xa6ab('0xd'),_0xc2242b,_0xa6ab('0xe'));logger[_0xa6ab('0xf')](_0xa6ab('0x10'),_0xc2242b,_0xa6ab('0xe'),JSON['stringify'](_0x3cf302));if(_0x3cf302[_0xa6ab('0x11')]){if(_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x12')]===0x1f4){logger[_0xa6ab('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0xc2242b,_0x3cf302['error'][_0xa6ab('0x13')]);return _0x3edd63(_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x13')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xc2242b,_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x13')]);return _0x3c7f00(_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x13')]);}else{logger[_0xa6ab('0xc')](_0xa6ab('0xd'),_0xc2242b,_0xa6ab('0xe'));_0x3c7f00(_0x3cf302[_0xa6ab('0x14')]['message']);}})['catch'](function(_0x2e83a6){logger[_0xa6ab('0x11')](_0xa6ab('0xd'),_0xc2242b,_0x2e83a6);_0x3edd63(_0x2e83a6);});});}exports[_0xa6ab('0x15')]=function(_0x213283){var _0x18d855=this;return new Promise(function(_0x202d13,_0x35bf06){return db[_0xa6ab('0x16')][_0xa6ab('0x17')]({'raw':_0x213283[_0xa6ab('0x18')]?_0x213283[_0xa6ab('0x18')][_0xa6ab('0x19')]===undefined?!![]:![]:!![],'where':_0x213283['options']?_0x213283[_0xa6ab('0x18')][_0xa6ab('0x1a')]||null:null,'attributes':_0x213283[_0xa6ab('0x18')]?_0x213283['options'][_0xa6ab('0x1b')]||null:null,'limit':_0x213283[_0xa6ab('0x18')]?_0x213283['options'][_0xa6ab('0x1c')]||null:null,'include':_0x213283[_0xa6ab('0x18')]?_0x213283['options'][_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x213283[_0xa6ab('0x18')][_0xa6ab('0x1d')],function(_0x1cb08f){return{'model':db[_0x1cb08f[_0xa6ab('0x1f')]],'as':_0x1cb08f['as'],'attributes':_0x1cb08f['attributes'],'include':_0x1cb08f[_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x1cb08f[_0xa6ab('0x1d')],function(_0x11ecaa){return{'model':db[_0x11ecaa['model']],'as':_0x11ecaa['as'],'attributes':_0x11ecaa[_0xa6ab('0x1b')],'include':_0x11ecaa[_0xa6ab('0x1d')]?_['map'](_0x11ecaa[_0xa6ab('0x1d')],function(_0x369c1d){return{'model':db[_0x369c1d[_0xa6ab('0x1f')]],'as':_0x369c1d['as'],'attributes':_0x369c1d[_0xa6ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa6ab('0xb')](function(_0x1dcefe){logger[_0xa6ab('0xc')](_0xa6ab('0x15'),_0x213283);logger[_0xa6ab('0xf')](_0xa6ab('0x15'),_0x213283,JSON[_0xa6ab('0x20')](_0x1dcefe));_0x202d13(_0x1dcefe);})[_0xa6ab('0x21')](function(_0x4845b5){logger[_0xa6ab('0x11')](_0xa6ab('0x15'),_0x4845b5[_0xa6ab('0x13')],_0x213283);_0x35bf06(_0x18d855[_0xa6ab('0x11')](0x1f4,_0x4845b5[_0xa6ab('0x13')]));});});};exports[_0xa6ab('0x22')]=function(_0xc3ad54){var _0x252fd6=this;return new Promise(function(_0x567b29,_0x1f5326){return db[_0xa6ab('0x16')][_0xa6ab('0x23')]({'raw':_0xc3ad54['options']?_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x19')]===undefined?!![]:![]:!![],'where':_0xc3ad54['options']?_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x1a')]||null:null,'attributes':_0xc3ad54[_0xa6ab('0x18')]?_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x1b')]||null:null,'include':_0xc3ad54[_0xa6ab('0x18')]?_0xc3ad54['options']['include']?_['map'](_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x1d')],function(_0x37e673){return{'model':db[_0x37e673['model']],'as':_0x37e673['as'],'attributes':_0x37e673[_0xa6ab('0x1b')],'include':_0x37e673[_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x37e673[_0xa6ab('0x1d')],function(_0x22f736){return{'model':db[_0x22f736['model']],'as':_0x22f736['as'],'attributes':_0x22f736['attributes'],'include':_0x22f736[_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x22f736[_0xa6ab('0x1d')],function(_0x224eb4){return{'model':db[_0x224eb4[_0xa6ab('0x1f')]],'as':_0x224eb4['as'],'attributes':_0x224eb4[_0xa6ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa6ab('0xb')](function(_0x461065){logger[_0xa6ab('0xc')](_0xa6ab('0x22'),_0xc3ad54);logger[_0xa6ab('0xf')](_0xa6ab('0x22'),_0xc3ad54,JSON['stringify'](_0x461065));_0x567b29(_0x461065);})[_0xa6ab('0x21')](function(_0x4aa5c1){logger[_0xa6ab('0x11')]('ShowSalesforceAccount',_0x4aa5c1['message'],_0xc3ad54);_0x1f5326(_0x252fd6[_0xa6ab('0x11')](0x1f4,_0x4aa5c1[_0xa6ab('0x13')]));});});}; \ No newline at end of file +var _0x99e9=['jayson/promise','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5480f6,_0x329b66){var _0x88d18f=function(_0x318aaf){while(--_0x318aaf){_0x5480f6['push'](_0x5480f6['shift']());}};_0x88d18f(++_0x329b66);}(_0x99e9,0xec));var _0x999e=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x99e9[_0x90a39a];return _0x2b62f7;};'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(_0x999e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))(_0x999e('0x7'));var config=require(_0x999e('0x8'));var jayson=require(_0x999e('0x9'));var client=jayson[_0x999e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x374c32,_0x4835ed,_0x58490b){return new BPromise(function(_0xd95429,_0x2b2e5c){return client[_0x999e('0xb')](_0x374c32,_0x58490b)['then'](function(_0xba31c){logger[_0x999e('0xc')](_0x999e('0xd'),_0x4835ed,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x4835ed,_0x999e('0xe'),JSON[_0x999e('0x11')](_0xba31c));if(_0xba31c[_0x999e('0x12')]){if(_0xba31c[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x4835ed,_0xba31c[_0x999e('0x12')][_0x999e('0x14')]);return _0x2b2e5c(_0xba31c[_0x999e('0x12')][_0x999e('0x14')]);}logger['error'](_0x999e('0xd'),_0x4835ed,_0xba31c[_0x999e('0x12')][_0x999e('0x14')]);return _0xd95429(_0xba31c[_0x999e('0x12')][_0x999e('0x14')]);}else{logger[_0x999e('0xc')](_0x999e('0xd'),_0x4835ed,_0x999e('0xe'));_0xd95429(_0xba31c['result'][_0x999e('0x14')]);}})[_0x999e('0x15')](function(_0x5c1791){logger[_0x999e('0x12')](_0x999e('0xd'),_0x4835ed,_0x5c1791);_0x2b2e5c(_0x5c1791);});});}exports[_0x999e('0x16')]=function(_0x3200e1){var _0x35e610=this;return new Promise(function(_0x6bf9a7,_0x4f828e){return db['SalesforceAccount'][_0x999e('0x17')]({'raw':_0x3200e1['options']?_0x3200e1[_0x999e('0x18')][_0x999e('0x19')]===undefined?!![]:![]:!![],'where':_0x3200e1['options']?_0x3200e1[_0x999e('0x18')][_0x999e('0x1a')]||null:null,'attributes':_0x3200e1[_0x999e('0x18')]?_0x3200e1['options'][_0x999e('0x1b')]||null:null,'limit':_0x3200e1[_0x999e('0x18')]?_0x3200e1[_0x999e('0x18')][_0x999e('0x1c')]||null:null,'include':_0x3200e1[_0x999e('0x18')]?_0x3200e1[_0x999e('0x18')][_0x999e('0x1d')]?_[_0x999e('0x1e')](_0x3200e1[_0x999e('0x18')][_0x999e('0x1d')],function(_0x2118ef){return{'model':db[_0x2118ef[_0x999e('0x1f')]],'as':_0x2118ef['as'],'attributes':_0x2118ef[_0x999e('0x1b')],'include':_0x2118ef['include']?_[_0x999e('0x1e')](_0x2118ef[_0x999e('0x1d')],function(_0x11450e){return{'model':db[_0x11450e[_0x999e('0x1f')]],'as':_0x11450e['as'],'attributes':_0x11450e[_0x999e('0x1b')],'include':_0x11450e['include']?_[_0x999e('0x1e')](_0x11450e['include'],function(_0x36d04f){return{'model':db[_0x36d04f[_0x999e('0x1f')]],'as':_0x36d04f['as'],'attributes':_0x36d04f[_0x999e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d9ff0){logger[_0x999e('0xc')](_0x999e('0x16'),_0x3200e1);logger[_0x999e('0xf')](_0x999e('0x16'),_0x3200e1,JSON[_0x999e('0x11')](_0x2d9ff0));_0x6bf9a7(_0x2d9ff0);})['catch'](function(_0x1ea236){logger[_0x999e('0x12')](_0x999e('0x16'),_0x1ea236[_0x999e('0x14')],_0x3200e1);_0x4f828e(_0x35e610['error'](0x1f4,_0x1ea236[_0x999e('0x14')]));});});};exports[_0x999e('0x20')]=function(_0x411b73){var _0x41a1f7=this;return new Promise(function(_0x2c3557,_0x50019e){return db['SalesforceAccount'][_0x999e('0x21')]({'raw':_0x411b73[_0x999e('0x18')]?_0x411b73[_0x999e('0x18')][_0x999e('0x19')]===undefined?!![]:![]:!![],'where':_0x411b73[_0x999e('0x18')]?_0x411b73[_0x999e('0x18')]['where']||null:null,'attributes':_0x411b73[_0x999e('0x18')]?_0x411b73[_0x999e('0x18')][_0x999e('0x1b')]||null:null,'include':_0x411b73[_0x999e('0x18')]?_0x411b73[_0x999e('0x18')][_0x999e('0x1d')]?_[_0x999e('0x1e')](_0x411b73[_0x999e('0x18')][_0x999e('0x1d')],function(_0x335ae9){return{'model':db[_0x335ae9[_0x999e('0x1f')]],'as':_0x335ae9['as'],'attributes':_0x335ae9[_0x999e('0x1b')],'include':_0x335ae9['include']?_[_0x999e('0x1e')](_0x335ae9[_0x999e('0x1d')],function(_0x1cfa21){return{'model':db[_0x1cfa21[_0x999e('0x1f')]],'as':_0x1cfa21['as'],'attributes':_0x1cfa21[_0x999e('0x1b')],'include':_0x1cfa21[_0x999e('0x1d')]?_[_0x999e('0x1e')](_0x1cfa21[_0x999e('0x1d')],function(_0x1b7935){return{'model':db[_0x1b7935['model']],'as':_0x1b7935['as'],'attributes':_0x1b7935[_0x999e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x999e('0x22')](function(_0x5a34c5){logger['info'](_0x999e('0x20'),_0x411b73);logger[_0x999e('0xf')](_0x999e('0x20'),_0x411b73,JSON[_0x999e('0x11')](_0x5a34c5));_0x2c3557(_0x5a34c5);})[_0x999e('0x15')](function(_0x256ab9){logger[_0x999e('0x12')]('ShowSalesforceAccount',_0x256ab9['message'],_0x411b73);_0x50019e(_0x41a1f7[_0x999e('0x12')](0x1f4,_0x256ab9[_0x999e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index fa4f0e2..32f65ce 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x36eeaf,_0x3daec3){var _0x1f0282=function(_0x1fcfa6){while(--_0x1fcfa6){_0x36eeaf['push'](_0x36eeaf['shift']());}};_0x1f0282(++_0x3daec3);}(_0x7a54,0x106));var _0x47a5=function(_0x3ed2a7,_0x30f86b){_0x3ed2a7=_0x3ed2a7-0x0;var _0x56693f=_0x7a54[_0x3ed2a7];return _0x56693f;};'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('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2f4d63,_0xea1a19){var _0x22ff66=function(_0x41745e){while(--_0x41745e){_0x2f4d63['push'](_0x2f4d63['shift']());}};_0x22ff66(++_0xea1a19);}(_0x2ef3,0xba));var _0x32ef=function(_0x76d235,_0x5cc584){_0x76d235=_0x76d235-0x0;var _0x480be9=_0x2ef3[_0x76d235];return _0x480be9;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1f2074d..5781bee 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 _0x2f78=['Task','Case','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize','STRING','ENUM'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0x2f78,0x19f));var _0x82f7=function(_0xba11f6,_0x3026e1){_0xba11f6=_0xba11f6-0x0;var _0x4fe35f=_0x2f78[_0xba11f6];return _0x4fe35f;};'use strict';var Sequelize=require(_0x82f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x82f7('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x82f7('0x2')](_0x82f7('0x3'),_0x82f7('0x4')),'defaultValue':_0x82f7('0x3')},'moduleSearch':{'type':Sequelize[_0x82f7('0x2')](_0x82f7('0x5'),'contact',_0x82f7('0x6'),_0x82f7('0x7'),_0x82f7('0x8')),'defaultValue':_0x82f7('0x5')},'moduleCreate':{'type':Sequelize[_0x82f7('0x2')](_0x82f7('0x9'),_0x82f7('0xa'),_0x82f7('0x6'),_0x82f7('0x8')),'defaultValue':_0x82f7('0x6')},'leadId':{'type':Sequelize[_0x82f7('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x82f7('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x82f7('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x82f7('0x1')]}}; \ No newline at end of file +var _0x9043=['STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9043,0x116));var _0x3904=function(_0xe20554,_0x22df52){_0xe20554=_0xe20554-0x0;var _0x58356f=_0x9043[_0xe20554];return _0x58356f;};'use strict';var Sequelize=require(_0x3904('0x0'));module[_0x3904('0x1')]={'name':{'type':Sequelize[_0x3904('0x2')]},'description':{'type':Sequelize[_0x3904('0x2')]},'ticketType':{'type':Sequelize[_0x3904('0x3')]('Task','Case'),'defaultValue':_0x3904('0x4')},'moduleSearch':{'type':Sequelize[_0x3904('0x3')](_0x3904('0x5'),_0x3904('0x6'),_0x3904('0x7'),_0x3904('0x8'),_0x3904('0x9')),'defaultValue':_0x3904('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x3904('0x6'),'lead',_0x3904('0x9')),'defaultValue':_0x3904('0x7')},'leadId':{'type':Sequelize[_0x3904('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x3904('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x3904('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index c230908..345431a 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 _0x50cd=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','type','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','find','create','body','params','getFields','findOne','SalesforceField','where','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','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','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x50cd,0x6e));var _0xd50c=function(_0xd5bb22,_0x5cfccb){_0xd5bb22=_0xd5bb22-0x0;var _0x2d105a=_0x50cd[_0xd5bb22];return _0x2d105a;};'use strict';var emlformat=require(_0xd50c('0x0'));var rimraf=require(_0xd50c('0x1'));var zipdir=require(_0xd50c('0x2'));var jsonpatch=require(_0xd50c('0x3'));var rp=require(_0xd50c('0x4'));var moment=require(_0xd50c('0x5'));var BPromise=require(_0xd50c('0x6'));var Mustache=require(_0xd50c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd50c('0x8'));var csv=require(_0xd50c('0x9'));var ejs=require(_0xd50c('0xa'));var fs=require('fs');var fs_extra=require(_0xd50c('0xb'));var _=require('lodash');var squel=require(_0xd50c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd50c('0xd'));var deskjs=require(_0xd50c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd50c('0xf'));var Redis=require(_0xd50c('0x10'));var authService=require(_0xd50c('0x11'));var qs=require(_0xd50c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd50c('0x13'));var logger=require('../../config/logger')(_0xd50c('0x14'));var utils=require(_0xd50c('0x15'));var config=require(_0xd50c('0x16'));var licenseUtil=require(_0xd50c('0x17'));var db=require(_0xd50c('0x18'))['db'];function respondWithStatusCode(_0x164a6f,_0x4b9f0d){_0x4b9f0d=_0x4b9f0d||0xcc;return function(_0x1da3ee){if(_0x1da3ee){return _0x164a6f[_0xd50c('0x19')](_0x4b9f0d);}return _0x164a6f[_0xd50c('0x1a')](_0x4b9f0d)[_0xd50c('0x1b')]();};}function respondWithResult(_0x310f12,_0x58a1e2){_0x58a1e2=_0x58a1e2||0xc8;return function(_0x58d1d0){if(_0x58d1d0){return _0x310f12[_0xd50c('0x1a')](_0x58a1e2)[_0xd50c('0x1c')](_0x58d1d0);}};}function respondWithFilteredResult(_0x485dea,_0x5c08cf){return function(_0x42c09a){if(_0x42c09a){var _0x2909e5=typeof _0x5c08cf[_0xd50c('0x1d')]===_0xd50c('0x1e')&&typeof _0x5c08cf[_0xd50c('0x1f')]==='undefined';var _0x286b02=_0x42c09a[_0xd50c('0x20')];var _0x4e2739=_0x2909e5?0x0:_0x5c08cf['offset'];var _0x595919=_0x2909e5?_0x42c09a[_0xd50c('0x20')]:_0x5c08cf[_0xd50c('0x1d')]+_0x5c08cf[_0xd50c('0x1f')];var _0x395c99;if(_0x595919>=_0x286b02){_0x595919=_0x286b02;_0x395c99=0xc8;}else{_0x395c99=0xce;}_0x485dea[_0xd50c('0x1a')](_0x395c99);return _0x485dea[_0xd50c('0x21')](_0xd50c('0x22'),_0x4e2739+'-'+_0x595919+'/'+_0x286b02)[_0xd50c('0x1c')](_0x42c09a);}return null;};}function patchUpdates(_0x471f87){return function(_0x4a8c46){try{jsonpatch[_0xd50c('0x23')](_0x4a8c46,_0x471f87,!![]);}catch(_0x3a85f5){return BPromise[_0xd50c('0x24')](_0x3a85f5);}return _0x4a8c46[_0xd50c('0x25')]();};}function saveUpdates(_0x218795,_0x106f6f){return function(_0x4b0239){if(_0x4b0239){return _0x4b0239[_0xd50c('0x26')](_0x218795)[_0xd50c('0x27')](function(_0x5a9ada){return _0x5a9ada;});}return null;};}function removeEntity(_0x51741d,_0x1cda85){return function(_0x2cbceb){if(_0x2cbceb){return _0x2cbceb[_0xd50c('0x28')]()[_0xd50c('0x27')](function(){_0x51741d[_0xd50c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x109543,_0x110682){return function(_0x310828){if(!_0x310828){_0x109543[_0xd50c('0x19')](0x194);}return _0x310828;};}function handleError(_0xbba714,_0x58988b){_0x58988b=_0x58988b||0x1f4;return function(_0xfd2aea){logger[_0xd50c('0x29')](_0xfd2aea['stack']);if(_0xfd2aea[_0xd50c('0x2a')]){delete _0xfd2aea['name'];}_0xbba714[_0xd50c('0x1a')](_0x58988b)[_0xd50c('0x2b')](_0xfd2aea);};}exports['index']=function(_0x27e247,_0x2ed105){var _0x2a9d0a={},_0x48489f={},_0xf46bd={'count':0x0,'rows':[]};var _0x2567bc=_[_0xd50c('0x2c')](db['SalesforceConfiguration'][_0xd50c('0x2d')],function(_0x55089f){return{'name':_0x55089f[_0xd50c('0x2e')],'type':_0x55089f['type'][_0xd50c('0x2f')]};});_0x48489f[_0xd50c('0x30')]=_[_0xd50c('0x2c')](_0x2567bc,'name');_0x48489f[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x27e247[_0xd50c('0x31')]);_0x48489f[_0xd50c('0x33')]=_[_0xd50c('0x34')](_0x48489f['model'],_0x48489f[_0xd50c('0x31')]);_0x2a9d0a[_0xd50c('0x35')]=_[_0xd50c('0x34')](_0x48489f[_0xd50c('0x30')],qs[_0xd50c('0x36')](_0x27e247['query'][_0xd50c('0x36')]));_0x2a9d0a[_0xd50c('0x35')]=_0x2a9d0a[_0xd50c('0x35')][_0xd50c('0x37')]?_0x2a9d0a[_0xd50c('0x35')]:_0x48489f[_0xd50c('0x30')];if(!_0x27e247[_0xd50c('0x31')][_0xd50c('0x38')](_0xd50c('0x39'))){_0x2a9d0a[_0xd50c('0x1f')]=qs['limit'](_0x27e247[_0xd50c('0x31')][_0xd50c('0x1f')]);_0x2a9d0a[_0xd50c('0x1d')]=qs['offset'](_0x27e247[_0xd50c('0x31')][_0xd50c('0x1d')]);}_0x2a9d0a[_0xd50c('0x3a')]=qs[_0xd50c('0x3b')](_0x27e247[_0xd50c('0x31')]['sort']);_0x2a9d0a['where']=qs[_0xd50c('0x33')](_[_0xd50c('0x3c')](_0x27e247[_0xd50c('0x31')],_0x48489f['filters']),_0x2567bc);if(_0x27e247[_0xd50c('0x31')][_0xd50c('0x3d')]){_0x2a9d0a['where']=_['merge'](_0x2a9d0a['where'],{'$or':_[_0xd50c('0x2c')](_0x2567bc,function(_0xb79f12){if(_0xb79f12[_0xd50c('0x3e')]!=='VIRTUAL'){var _0x26b2dd={};_0x26b2dd[_0xb79f12[_0xd50c('0x2a')]]={'$like':'%'+_0x27e247[_0xd50c('0x31')]['filter']+'%'};return _0x26b2dd;}})});}_0x2a9d0a=_[_0xd50c('0x3f')]({},_0x2a9d0a,_0x27e247[_0xd50c('0x40')]);var _0x537d68={'where':_0x2a9d0a['where']};return db[_0xd50c('0x41')][_0xd50c('0x20')](_0x537d68)['then'](function(_0x187a05){_0xf46bd['count']=_0x187a05;if(_0x27e247[_0xd50c('0x31')][_0xd50c('0x42')]){_0x2a9d0a[_0xd50c('0x43')]=[{'all':!![]}];}return db[_0xd50c('0x41')][_0xd50c('0x44')](_0x2a9d0a);})[_0xd50c('0x27')](function(_0x596c57){_0xf46bd[_0xd50c('0x45')]=_0x596c57;return _0xf46bd;})[_0xd50c('0x27')](respondWithFilteredResult(_0x2ed105,_0x2a9d0a))[_0xd50c('0x46')](handleError(_0x2ed105,null));};exports['show']=function(_0x103402,_0x128b92){var _0x514605={'raw':![],'where':{'id':_0x103402['params']['id']}},_0xe901b5={};_0xe901b5[_0xd50c('0x30')]=_['keys'](db[_0xd50c('0x41')]['rawAttributes']);_0xe901b5[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x103402['query']);_0xe901b5[_0xd50c('0x33')]=_[_0xd50c('0x34')](_0xe901b5['model'],_0xe901b5[_0xd50c('0x31')]);_0x514605[_0xd50c('0x35')]=_[_0xd50c('0x34')](_0xe901b5[_0xd50c('0x30')],qs[_0xd50c('0x36')](_0x103402['query']['fields']));_0x514605[_0xd50c('0x35')]=_0x514605['attributes'][_0xd50c('0x37')]?_0x514605[_0xd50c('0x35')]:_0xe901b5[_0xd50c('0x30')];if(_0x103402[_0xd50c('0x31')][_0xd50c('0x42')]){_0x514605['include']=[{'all':!![]}];}_0x514605=_['merge']({},_0x514605,_0x103402[_0xd50c('0x40')]);return db[_0xd50c('0x41')][_0xd50c('0x47')](_0x514605)[_0xd50c('0x27')](handleEntityNotFound(_0x128b92,null))[_0xd50c('0x27')](respondWithResult(_0x128b92,null))[_0xd50c('0x46')](handleError(_0x128b92,null));};exports[_0xd50c('0x48')]=function(_0x9dc79e,_0x59acdb){return db[_0xd50c('0x41')][_0xd50c('0x48')](_0x9dc79e[_0xd50c('0x49')],{})[_0xd50c('0x27')](respondWithResult(_0x59acdb,0xc9))[_0xd50c('0x46')](handleError(_0x59acdb,null));};exports[_0xd50c('0x26')]=function(_0x5b0d95,_0x138488){if(_0x5b0d95['body']['id']){delete _0x5b0d95[_0xd50c('0x49')]['id'];}return db[_0xd50c('0x41')][_0xd50c('0x47')]({'where':{'id':_0x5b0d95['params']['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x138488,null))['then'](saveUpdates(_0x5b0d95['body'],null))[_0xd50c('0x27')](respondWithResult(_0x138488,null))[_0xd50c('0x46')](handleError(_0x138488,null));};exports[_0xd50c('0x28')]=function(_0x1c0e95,_0x2a8f0c){return db[_0xd50c('0x41')][_0xd50c('0x47')]({'where':{'id':_0x1c0e95[_0xd50c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a8f0c,null))['then'](removeEntity(_0x2a8f0c,null))[_0xd50c('0x46')](handleError(_0x2a8f0c,null));};exports[_0xd50c('0x4b')]=function(_0x169001,_0x163e59,_0x4264b6){var _0x5d7ac6={};var _0x1827d2={};var _0x494d7b;var _0x2d8b29;return db['SalesforceConfiguration'][_0xd50c('0x4c')]({'where':{'id':_0x169001[_0xd50c('0x4a')]['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x163e59,null))['then'](function(_0x35653a){if(_0x35653a){_0x494d7b=_0x35653a;_0x1827d2[_0xd50c('0x30')]=_[_0xd50c('0x32')](db[_0xd50c('0x4d')][_0xd50c('0x2d')]);_0x1827d2[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x169001[_0xd50c('0x31')]);_0x1827d2[_0xd50c('0x33')]=_[_0xd50c('0x34')](_0x1827d2['model'],_0x1827d2[_0xd50c('0x31')]);_0x5d7ac6[_0xd50c('0x35')]=_[_0xd50c('0x34')](_0x1827d2[_0xd50c('0x30')],qs[_0xd50c('0x36')](_0x169001[_0xd50c('0x31')][_0xd50c('0x36')]));_0x5d7ac6[_0xd50c('0x35')]=_0x5d7ac6[_0xd50c('0x35')][_0xd50c('0x37')]?_0x5d7ac6[_0xd50c('0x35')]:_0x1827d2[_0xd50c('0x30')];_0x5d7ac6[_0xd50c('0x3a')]=qs['sort'](_0x169001[_0xd50c('0x31')][_0xd50c('0x3b')]);_0x5d7ac6['where']=qs['filters'](_[_0xd50c('0x3c')](_0x169001['query'],_0x1827d2[_0xd50c('0x33')]));if(_0x169001[_0xd50c('0x31')][_0xd50c('0x3d')]){_0x5d7ac6[_0xd50c('0x4e')]=_[_0xd50c('0x3f')](_0x5d7ac6['where'],{'$or':_[_0xd50c('0x2c')](_0x5d7ac6[_0xd50c('0x35')],function(_0x2614a8){var _0x1d04c1={};_0x1d04c1[_0x2614a8]={'$like':'%'+_0x169001[_0xd50c('0x31')][_0xd50c('0x3d')]+'%'};return _0x1d04c1;})});}_0x5d7ac6=_[_0xd50c('0x3f')]({},_0x5d7ac6,_0x169001[_0xd50c('0x40')]);return _0x494d7b[_0xd50c('0x4b')](_0x5d7ac6);}})[_0xd50c('0x27')](function(_0x4a9784){if(_0x4a9784){_0x2d8b29=_0x4a9784[_0xd50c('0x37')];if(!_0x169001[_0xd50c('0x31')][_0xd50c('0x38')](_0xd50c('0x39'))){_0x5d7ac6['limit']=qs[_0xd50c('0x1f')](_0x169001['query'][_0xd50c('0x1f')]);_0x5d7ac6[_0xd50c('0x1d')]=qs[_0xd50c('0x1d')](_0x169001[_0xd50c('0x31')][_0xd50c('0x1d')]);}return _0x494d7b[_0xd50c('0x4b')](_0x5d7ac6);}})[_0xd50c('0x27')](function(_0x2f9b4b){if(_0x2f9b4b){return _0x2f9b4b?{'count':_0x2d8b29,'rows':_0x2f9b4b}:null;}})[_0xd50c('0x27')](respondWithResult(_0x163e59,null))[_0xd50c('0x46')](handleError(_0x163e59,null));};exports[_0xd50c('0x4f')]=function(_0x1d166d,_0x5be3cf,_0x34b3d9){var _0x29b4cf={};var _0x329cf1={};var _0x515356;var _0x39d208;return db['SalesforceConfiguration'][_0xd50c('0x4c')]({'where':{'id':_0x1d166d[_0xd50c('0x4a')]['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x5be3cf,null))[_0xd50c('0x27')](function(_0x3b5e43){if(_0x3b5e43){_0x515356=_0x3b5e43;_0x329cf1[_0xd50c('0x30')]=_[_0xd50c('0x32')](db[_0xd50c('0x4d')][_0xd50c('0x2d')]);_0x329cf1[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x1d166d['query']);_0x329cf1['filters']=_[_0xd50c('0x34')](_0x329cf1[_0xd50c('0x30')],_0x329cf1[_0xd50c('0x31')]);_0x29b4cf['attributes']=_[_0xd50c('0x34')](_0x329cf1['model'],qs['fields'](_0x1d166d[_0xd50c('0x31')][_0xd50c('0x36')]));_0x29b4cf[_0xd50c('0x35')]=_0x29b4cf[_0xd50c('0x35')]['length']?_0x29b4cf[_0xd50c('0x35')]:_0x329cf1[_0xd50c('0x30')];_0x29b4cf['order']=qs['sort'](_0x1d166d[_0xd50c('0x31')]['sort']);_0x29b4cf[_0xd50c('0x4e')]=qs[_0xd50c('0x33')](_['pick'](_0x1d166d[_0xd50c('0x31')],_0x329cf1['filters']));if(_0x1d166d['query'][_0xd50c('0x3d')]){_0x29b4cf[_0xd50c('0x4e')]=_[_0xd50c('0x3f')](_0x29b4cf[_0xd50c('0x4e')],{'$or':_['map'](_0x29b4cf['attributes'],function(_0x3006bd){var _0x212b55={};_0x212b55[_0x3006bd]={'$like':'%'+_0x1d166d[_0xd50c('0x31')][_0xd50c('0x3d')]+'%'};return _0x212b55;})});}_0x29b4cf=_['merge']({},_0x29b4cf,_0x1d166d['options']);return _0x515356[_0xd50c('0x4f')](_0x29b4cf);}})[_0xd50c('0x27')](function(_0x17be29){if(_0x17be29){_0x39d208=_0x17be29['length'];if(!_0x1d166d[_0xd50c('0x31')][_0xd50c('0x38')](_0xd50c('0x39'))){_0x29b4cf[_0xd50c('0x1f')]=qs['limit'](_0x1d166d['query'][_0xd50c('0x1f')]);_0x29b4cf[_0xd50c('0x1d')]=qs[_0xd50c('0x1d')](_0x1d166d[_0xd50c('0x31')]['offset']);}return _0x515356[_0xd50c('0x4f')](_0x29b4cf);}})[_0xd50c('0x27')](function(_0x6d4f71){if(_0x6d4f71){return _0x6d4f71?{'count':_0x39d208,'rows':_0x6d4f71}:null;}})[_0xd50c('0x27')](respondWithResult(_0x5be3cf,null))[_0xd50c('0x46')](handleError(_0x5be3cf,null));};exports[_0xd50c('0x50')]=function(_0x3e1c4d,_0x505d8f,_0xd82673){var _0x238001={};var _0x13403f={};var _0x5d974e;var _0x228f70;return db['SalesforceConfiguration'][_0xd50c('0x4c')]({'where':{'id':_0x3e1c4d[_0xd50c('0x4a')]['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x505d8f,null))[_0xd50c('0x27')](function(_0x4ea75b){if(_0x4ea75b){_0x5d974e=_0x4ea75b;_0x13403f[_0xd50c('0x30')]=_[_0xd50c('0x32')](db['SalesforceField'][_0xd50c('0x2d')]);_0x13403f['query']=_[_0xd50c('0x32')](_0x3e1c4d['query']);_0x13403f['filters']=_[_0xd50c('0x34')](_0x13403f[_0xd50c('0x30')],_0x13403f['query']);_0x238001['attributes']=_[_0xd50c('0x34')](_0x13403f['model'],qs[_0xd50c('0x36')](_0x3e1c4d[_0xd50c('0x31')]['fields']));_0x238001['attributes']=_0x238001['attributes'][_0xd50c('0x37')]?_0x238001[_0xd50c('0x35')]:_0x13403f[_0xd50c('0x30')];_0x238001[_0xd50c('0x3a')]=qs['sort'](_0x3e1c4d['query'][_0xd50c('0x3b')]);_0x238001[_0xd50c('0x4e')]=qs[_0xd50c('0x33')](_['pick'](_0x3e1c4d[_0xd50c('0x31')],_0x13403f[_0xd50c('0x33')]));if(_0x3e1c4d['query']['filter']){_0x238001[_0xd50c('0x4e')]=_[_0xd50c('0x3f')](_0x238001[_0xd50c('0x4e')],{'$or':_[_0xd50c('0x2c')](_0x238001[_0xd50c('0x35')],function(_0xc78f61){var _0x1549bc={};_0x1549bc[_0xc78f61]={'$like':'%'+_0x3e1c4d['query'][_0xd50c('0x3d')]+'%'};return _0x1549bc;})});}_0x238001=_[_0xd50c('0x3f')]({},_0x238001,_0x3e1c4d['options']);return _0x5d974e[_0xd50c('0x50')](_0x238001);}})[_0xd50c('0x27')](function(_0x1dc0b2){if(_0x1dc0b2){_0x228f70=_0x1dc0b2[_0xd50c('0x37')];if(!_0x3e1c4d['query']['hasOwnProperty'](_0xd50c('0x39'))){_0x238001[_0xd50c('0x1f')]=qs[_0xd50c('0x1f')](_0x3e1c4d[_0xd50c('0x31')]['limit']);_0x238001[_0xd50c('0x1d')]=qs['offset'](_0x3e1c4d[_0xd50c('0x31')][_0xd50c('0x1d')]);}return _0x5d974e[_0xd50c('0x50')](_0x238001);}})['then'](function(_0x6dfe43){if(_0x6dfe43){return _0x6dfe43?{'count':_0x228f70,'rows':_0x6dfe43}:null;}})[_0xd50c('0x27')](respondWithResult(_0x505d8f,null))[_0xd50c('0x46')](handleError(_0x505d8f,null));}; \ No newline at end of file +var _0x0be3=['request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','include','options','find','catch','create','body','getFields','findOne','keys','SalesforceField','sort','hasOwnProperty','getSubjects','getDescriptions','zip-dir','fast-json-patch'];(function(_0x51c602,_0x2e29e5){var _0x138c5a=function(_0x471078){while(--_0x471078){_0x51c602['push'](_0x51c602['shift']());}};_0x138c5a(++_0x2e29e5);}(_0x0be3,0x9a));var _0x30be=function(_0x1325b5,_0x20c67e){_0x1325b5=_0x1325b5-0x0;var _0x49e29c=_0x0be3[_0x1325b5];return _0x49e29c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x30be('0x0'));var jsonpatch=require(_0x30be('0x1'));var rp=require(_0x30be('0x2'));var moment=require('moment');var BPromise=require(_0x30be('0x3'));var Mustache=require('mustache');var util=require(_0x30be('0x4'));var path=require(_0x30be('0x5'));var sox=require(_0x30be('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30be('0x7'));var _=require(_0x30be('0x8'));var squel=require('squel');var crypto=require(_0x30be('0x9'));var jsforce=require(_0x30be('0xa'));var deskjs=require(_0x30be('0xb'));var toCsv=require('to-csv');var querystring=require(_0x30be('0xc'));var Papa=require(_0x30be('0xd'));var Redis=require(_0x30be('0xe'));var authService=require(_0x30be('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x30be('0x10'))('api');var utils=require(_0x30be('0x11'));var config=require(_0x30be('0x12'));var licenseUtil=require(_0x30be('0x13'));var db=require(_0x30be('0x14'))['db'];function respondWithStatusCode(_0x381ace,_0x2cf4aa){_0x2cf4aa=_0x2cf4aa||0xcc;return function(_0x1cf2f){if(_0x1cf2f){return _0x381ace[_0x30be('0x15')](_0x2cf4aa);}return _0x381ace[_0x30be('0x16')](_0x2cf4aa)['end']();};}function respondWithResult(_0x460bc7,_0x5b303a){_0x5b303a=_0x5b303a||0xc8;return function(_0x779c45){if(_0x779c45){return _0x460bc7[_0x30be('0x16')](_0x5b303a)['json'](_0x779c45);}};}function respondWithFilteredResult(_0x108972,_0x7e4c86){return function(_0x542c79){if(_0x542c79){var _0xd6aa18=typeof _0x7e4c86[_0x30be('0x17')]===_0x30be('0x18')&&typeof _0x7e4c86[_0x30be('0x19')]===_0x30be('0x18');var _0x3538ba=_0x542c79[_0x30be('0x1a')];var _0x3eea62=_0xd6aa18?0x0:_0x7e4c86[_0x30be('0x17')];var _0x2e50e5=_0xd6aa18?_0x542c79['count']:_0x7e4c86[_0x30be('0x17')]+_0x7e4c86[_0x30be('0x19')];var _0xec2b2c;if(_0x2e50e5>=_0x3538ba){_0x2e50e5=_0x3538ba;_0xec2b2c=0xc8;}else{_0xec2b2c=0xce;}_0x108972[_0x30be('0x16')](_0xec2b2c);return _0x108972[_0x30be('0x1b')](_0x30be('0x1c'),_0x3eea62+'-'+_0x2e50e5+'/'+_0x3538ba)[_0x30be('0x1d')](_0x542c79);}return null;};}function patchUpdates(_0x216ae0){return function(_0x323940){try{jsonpatch[_0x30be('0x1e')](_0x323940,_0x216ae0,!![]);}catch(_0x18747f){return BPromise[_0x30be('0x1f')](_0x18747f);}return _0x323940[_0x30be('0x20')]();};}function saveUpdates(_0x29d6f6,_0x5adc8c){return function(_0x526af1){if(_0x526af1){return _0x526af1[_0x30be('0x21')](_0x29d6f6)['then'](function(_0x3dfa0f){return _0x3dfa0f;});}return null;};}function removeEntity(_0x4d1b93,_0x251572){return function(_0x1ca6ac){if(_0x1ca6ac){return _0x1ca6ac[_0x30be('0x22')]()[_0x30be('0x23')](function(){_0x4d1b93[_0x30be('0x16')](0xcc)[_0x30be('0x24')]();});}};}function handleEntityNotFound(_0x431e12,_0x45b94e){return function(_0x16c619){if(!_0x16c619){_0x431e12[_0x30be('0x15')](0x194);}return _0x16c619;};}function handleError(_0x2bd8b6,_0xb3cef6){_0xb3cef6=_0xb3cef6||0x1f4;return function(_0x589cf3){logger[_0x30be('0x25')](_0x589cf3['stack']);if(_0x589cf3[_0x30be('0x26')]){delete _0x589cf3[_0x30be('0x26')];}_0x2bd8b6[_0x30be('0x16')](_0xb3cef6)[_0x30be('0x27')](_0x589cf3);};}exports['index']=function(_0x2fbb13,_0x289dd2){var _0x5d2aad={},_0x580cd5={},_0x4511ca={'count':0x0,'rows':[]};var _0xd22652=_[_0x30be('0x28')](db[_0x30be('0x29')][_0x30be('0x2a')],function(_0x33cc56){return{'name':_0x33cc56[_0x30be('0x2b')],'type':_0x33cc56[_0x30be('0x2c')][_0x30be('0x2d')]};});_0x580cd5['model']=_['map'](_0xd22652,_0x30be('0x26'));_0x580cd5['query']=_['keys'](_0x2fbb13[_0x30be('0x2e')]);_0x580cd5['filters']=_['intersection'](_0x580cd5[_0x30be('0x2f')],_0x580cd5['query']);_0x5d2aad[_0x30be('0x30')]=_[_0x30be('0x31')](_0x580cd5[_0x30be('0x2f')],qs[_0x30be('0x32')](_0x2fbb13[_0x30be('0x2e')]['fields']));_0x5d2aad[_0x30be('0x30')]=_0x5d2aad[_0x30be('0x30')][_0x30be('0x33')]?_0x5d2aad['attributes']:_0x580cd5[_0x30be('0x2f')];if(!_0x2fbb13[_0x30be('0x2e')]['hasOwnProperty'](_0x30be('0x34'))){_0x5d2aad[_0x30be('0x19')]=qs['limit'](_0x2fbb13[_0x30be('0x2e')]['limit']);_0x5d2aad['offset']=qs['offset'](_0x2fbb13[_0x30be('0x2e')][_0x30be('0x17')]);}_0x5d2aad[_0x30be('0x35')]=qs['sort'](_0x2fbb13[_0x30be('0x2e')]['sort']);_0x5d2aad[_0x30be('0x36')]=qs[_0x30be('0x37')](_[_0x30be('0x38')](_0x2fbb13[_0x30be('0x2e')],_0x580cd5['filters']),_0xd22652);if(_0x2fbb13[_0x30be('0x2e')][_0x30be('0x39')]){_0x5d2aad['where']=_[_0x30be('0x3a')](_0x5d2aad[_0x30be('0x36')],{'$or':_[_0x30be('0x28')](_0xd22652,function(_0xa61636){if(_0xa61636['type']!==_0x30be('0x3b')){var _0x58c801={};_0x58c801[_0xa61636[_0x30be('0x26')]]={'$like':'%'+_0x2fbb13[_0x30be('0x2e')][_0x30be('0x39')]+'%'};return _0x58c801;}})});}_0x5d2aad=_[_0x30be('0x3a')]({},_0x5d2aad,_0x2fbb13['options']);var _0x35b566={'where':_0x5d2aad[_0x30be('0x36')]};return db[_0x30be('0x29')]['count'](_0x35b566)[_0x30be('0x23')](function(_0x37eaa2){_0x4511ca['count']=_0x37eaa2;if(_0x2fbb13['query'][_0x30be('0x3c')]){_0x5d2aad['include']=[{'all':!![]}];}return db[_0x30be('0x29')][_0x30be('0x3d')](_0x5d2aad);})[_0x30be('0x23')](function(_0x140855){_0x4511ca['rows']=_0x140855;return _0x4511ca;})['then'](respondWithFilteredResult(_0x289dd2,_0x5d2aad))['catch'](handleError(_0x289dd2,null));};exports[_0x30be('0x3e')]=function(_0x11b1c0,_0xe98bfa){var _0x258793={'raw':![],'where':{'id':_0x11b1c0[_0x30be('0x3f')]['id']}},_0x4eab2e={};_0x4eab2e[_0x30be('0x2f')]=_['keys'](db[_0x30be('0x29')][_0x30be('0x2a')]);_0x4eab2e[_0x30be('0x2e')]=_['keys'](_0x11b1c0[_0x30be('0x2e')]);_0x4eab2e['filters']=_[_0x30be('0x31')](_0x4eab2e[_0x30be('0x2f')],_0x4eab2e['query']);_0x258793['attributes']=_[_0x30be('0x31')](_0x4eab2e[_0x30be('0x2f')],qs[_0x30be('0x32')](_0x11b1c0['query']['fields']));_0x258793[_0x30be('0x30')]=_0x258793[_0x30be('0x30')][_0x30be('0x33')]?_0x258793['attributes']:_0x4eab2e[_0x30be('0x2f')];if(_0x11b1c0['query']['includeAll']){_0x258793[_0x30be('0x40')]=[{'all':!![]}];}_0x258793=_['merge']({},_0x258793,_0x11b1c0[_0x30be('0x41')]);return db[_0x30be('0x29')][_0x30be('0x42')](_0x258793)[_0x30be('0x23')](handleEntityNotFound(_0xe98bfa,null))[_0x30be('0x23')](respondWithResult(_0xe98bfa,null))[_0x30be('0x43')](handleError(_0xe98bfa,null));};exports[_0x30be('0x44')]=function(_0x301df0,_0x3eefa0){return db['SalesforceConfiguration'][_0x30be('0x44')](_0x301df0[_0x30be('0x45')],{})[_0x30be('0x23')](respondWithResult(_0x3eefa0,0xc9))[_0x30be('0x43')](handleError(_0x3eefa0,null));};exports[_0x30be('0x21')]=function(_0x109860,_0x2aabd3){if(_0x109860[_0x30be('0x45')]['id']){delete _0x109860[_0x30be('0x45')]['id'];}return db['SalesforceConfiguration'][_0x30be('0x42')]({'where':{'id':_0x109860['params']['id']}})[_0x30be('0x23')](handleEntityNotFound(_0x2aabd3,null))[_0x30be('0x23')](saveUpdates(_0x109860['body'],null))[_0x30be('0x23')](respondWithResult(_0x2aabd3,null))[_0x30be('0x43')](handleError(_0x2aabd3,null));};exports[_0x30be('0x22')]=function(_0x2285af,_0x50e4a0){return db[_0x30be('0x29')][_0x30be('0x42')]({'where':{'id':_0x2285af[_0x30be('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50e4a0,null))['then'](removeEntity(_0x50e4a0,null))[_0x30be('0x43')](handleError(_0x50e4a0,null));};exports[_0x30be('0x46')]=function(_0x376013,_0x4c4313,_0x4f8eb6){var _0x5c2db4={};var _0x9bdea0={};var _0x174453;var _0x598818;return db[_0x30be('0x29')][_0x30be('0x47')]({'where':{'id':_0x376013[_0x30be('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4c4313,null))[_0x30be('0x23')](function(_0xeae276){if(_0xeae276){_0x174453=_0xeae276;_0x9bdea0[_0x30be('0x2f')]=_[_0x30be('0x48')](db[_0x30be('0x49')][_0x30be('0x2a')]);_0x9bdea0[_0x30be('0x2e')]=_[_0x30be('0x48')](_0x376013[_0x30be('0x2e')]);_0x9bdea0['filters']=_['intersection'](_0x9bdea0[_0x30be('0x2f')],_0x9bdea0[_0x30be('0x2e')]);_0x5c2db4[_0x30be('0x30')]=_[_0x30be('0x31')](_0x9bdea0[_0x30be('0x2f')],qs[_0x30be('0x32')](_0x376013[_0x30be('0x2e')][_0x30be('0x32')]));_0x5c2db4['attributes']=_0x5c2db4[_0x30be('0x30')][_0x30be('0x33')]?_0x5c2db4[_0x30be('0x30')]:_0x9bdea0[_0x30be('0x2f')];_0x5c2db4[_0x30be('0x35')]=qs[_0x30be('0x4a')](_0x376013[_0x30be('0x2e')][_0x30be('0x4a')]);_0x5c2db4[_0x30be('0x36')]=qs[_0x30be('0x37')](_[_0x30be('0x38')](_0x376013[_0x30be('0x2e')],_0x9bdea0[_0x30be('0x37')]));if(_0x376013[_0x30be('0x2e')]['filter']){_0x5c2db4['where']=_['merge'](_0x5c2db4[_0x30be('0x36')],{'$or':_[_0x30be('0x28')](_0x5c2db4['attributes'],function(_0x5da182){var _0x32247f={};_0x32247f[_0x5da182]={'$like':'%'+_0x376013['query'][_0x30be('0x39')]+'%'};return _0x32247f;})});}_0x5c2db4=_[_0x30be('0x3a')]({},_0x5c2db4,_0x376013[_0x30be('0x41')]);return _0x174453[_0x30be('0x46')](_0x5c2db4);}})['then'](function(_0xc79477){if(_0xc79477){_0x598818=_0xc79477['length'];if(!_0x376013[_0x30be('0x2e')][_0x30be('0x4b')](_0x30be('0x34'))){_0x5c2db4[_0x30be('0x19')]=qs[_0x30be('0x19')](_0x376013['query']['limit']);_0x5c2db4[_0x30be('0x17')]=qs[_0x30be('0x17')](_0x376013[_0x30be('0x2e')]['offset']);}return _0x174453[_0x30be('0x46')](_0x5c2db4);}})['then'](function(_0x265ce7){if(_0x265ce7){return _0x265ce7?{'count':_0x598818,'rows':_0x265ce7}:null;}})['then'](respondWithResult(_0x4c4313,null))[_0x30be('0x43')](handleError(_0x4c4313,null));};exports[_0x30be('0x4c')]=function(_0x360423,_0x20d280,_0x2d856c){var _0x1608be={};var _0x131901={};var _0x39d6f2;var _0x23d946;return db[_0x30be('0x29')][_0x30be('0x47')]({'where':{'id':_0x360423[_0x30be('0x3f')]['id']}})['then'](handleEntityNotFound(_0x20d280,null))[_0x30be('0x23')](function(_0x4f5ea7){if(_0x4f5ea7){_0x39d6f2=_0x4f5ea7;_0x131901['model']=_['keys'](db[_0x30be('0x49')][_0x30be('0x2a')]);_0x131901[_0x30be('0x2e')]=_[_0x30be('0x48')](_0x360423[_0x30be('0x2e')]);_0x131901[_0x30be('0x37')]=_[_0x30be('0x31')](_0x131901[_0x30be('0x2f')],_0x131901[_0x30be('0x2e')]);_0x1608be['attributes']=_[_0x30be('0x31')](_0x131901[_0x30be('0x2f')],qs[_0x30be('0x32')](_0x360423[_0x30be('0x2e')]['fields']));_0x1608be['attributes']=_0x1608be[_0x30be('0x30')][_0x30be('0x33')]?_0x1608be[_0x30be('0x30')]:_0x131901['model'];_0x1608be[_0x30be('0x35')]=qs[_0x30be('0x4a')](_0x360423['query']['sort']);_0x1608be[_0x30be('0x36')]=qs['filters'](_[_0x30be('0x38')](_0x360423[_0x30be('0x2e')],_0x131901[_0x30be('0x37')]));if(_0x360423[_0x30be('0x2e')][_0x30be('0x39')]){_0x1608be['where']=_['merge'](_0x1608be['where'],{'$or':_[_0x30be('0x28')](_0x1608be[_0x30be('0x30')],function(_0x28314f){var _0x19f17e={};_0x19f17e[_0x28314f]={'$like':'%'+_0x360423['query']['filter']+'%'};return _0x19f17e;})});}_0x1608be=_[_0x30be('0x3a')]({},_0x1608be,_0x360423[_0x30be('0x41')]);return _0x39d6f2['getSubjects'](_0x1608be);}})[_0x30be('0x23')](function(_0x11222f){if(_0x11222f){_0x23d946=_0x11222f[_0x30be('0x33')];if(!_0x360423[_0x30be('0x2e')]['hasOwnProperty'](_0x30be('0x34'))){_0x1608be[_0x30be('0x19')]=qs['limit'](_0x360423[_0x30be('0x2e')][_0x30be('0x19')]);_0x1608be['offset']=qs['offset'](_0x360423[_0x30be('0x2e')][_0x30be('0x17')]);}return _0x39d6f2[_0x30be('0x4c')](_0x1608be);}})[_0x30be('0x23')](function(_0x52a50b){if(_0x52a50b){return _0x52a50b?{'count':_0x23d946,'rows':_0x52a50b}:null;}})[_0x30be('0x23')](respondWithResult(_0x20d280,null))[_0x30be('0x43')](handleError(_0x20d280,null));};exports[_0x30be('0x4d')]=function(_0x1a7726,_0x3776e8,_0x509839){var _0x582487={};var _0x31a065={};var _0x56da98;var _0x3d6aab;return db['SalesforceConfiguration'][_0x30be('0x47')]({'where':{'id':_0x1a7726[_0x30be('0x3f')]['id']}})[_0x30be('0x23')](handleEntityNotFound(_0x3776e8,null))[_0x30be('0x23')](function(_0x4fb677){if(_0x4fb677){_0x56da98=_0x4fb677;_0x31a065[_0x30be('0x2f')]=_['keys'](db['SalesforceField'][_0x30be('0x2a')]);_0x31a065[_0x30be('0x2e')]=_[_0x30be('0x48')](_0x1a7726[_0x30be('0x2e')]);_0x31a065[_0x30be('0x37')]=_[_0x30be('0x31')](_0x31a065['model'],_0x31a065[_0x30be('0x2e')]);_0x582487[_0x30be('0x30')]=_[_0x30be('0x31')](_0x31a065[_0x30be('0x2f')],qs[_0x30be('0x32')](_0x1a7726[_0x30be('0x2e')]['fields']));_0x582487[_0x30be('0x30')]=_0x582487[_0x30be('0x30')][_0x30be('0x33')]?_0x582487[_0x30be('0x30')]:_0x31a065[_0x30be('0x2f')];_0x582487['order']=qs[_0x30be('0x4a')](_0x1a7726['query'][_0x30be('0x4a')]);_0x582487[_0x30be('0x36')]=qs[_0x30be('0x37')](_[_0x30be('0x38')](_0x1a7726[_0x30be('0x2e')],_0x31a065['filters']));if(_0x1a7726[_0x30be('0x2e')][_0x30be('0x39')]){_0x582487[_0x30be('0x36')]=_[_0x30be('0x3a')](_0x582487[_0x30be('0x36')],{'$or':_[_0x30be('0x28')](_0x582487[_0x30be('0x30')],function(_0x3e4f84){var _0x195003={};_0x195003[_0x3e4f84]={'$like':'%'+_0x1a7726[_0x30be('0x2e')][_0x30be('0x39')]+'%'};return _0x195003;})});}_0x582487=_[_0x30be('0x3a')]({},_0x582487,_0x1a7726[_0x30be('0x41')]);return _0x56da98['getDescriptions'](_0x582487);}})['then'](function(_0x4c7d52){if(_0x4c7d52){_0x3d6aab=_0x4c7d52[_0x30be('0x33')];if(!_0x1a7726['query'][_0x30be('0x4b')](_0x30be('0x34'))){_0x582487[_0x30be('0x19')]=qs['limit'](_0x1a7726[_0x30be('0x2e')][_0x30be('0x19')]);_0x582487[_0x30be('0x17')]=qs[_0x30be('0x17')](_0x1a7726[_0x30be('0x2e')][_0x30be('0x17')]);}return _0x56da98[_0x30be('0x4d')](_0x582487);}})[_0x30be('0x23')](function(_0x4035cf){if(_0x4035cf){return _0x4035cf?{'count':_0x3d6aab,'rows':_0x4035cf}:null;}})[_0x30be('0x23')](respondWithResult(_0x3776e8,null))[_0x30be('0x43')](handleError(_0x3776e8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index bfadeb5..651e2db 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 _0xf3b4=['int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x24e713,_0x331e42){var _0x2dc97e=function(_0xb8c750){while(--_0xb8c750){_0x24e713['push'](_0x24e713['shift']());}};_0x2dc97e(++_0x331e42);}(_0xf3b4,0x15d));var _0x4f3b=function(_0x3c2081,_0x1cd2b3){_0x3c2081=_0x3c2081-0x0;var _0x29d6dc=_0xf3b4[_0x3c2081];return _0x29d6dc;};'use strict';var _=require(_0x4f3b('0x0'));var util=require('util');var logger=require(_0x4f3b('0x1'))(_0x4f3b('0x2'));var moment=require(_0x4f3b('0x3'));var BPromise=require(_0x4f3b('0x4'));var rp=require(_0x4f3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f3b('0x6'));var config=require(_0x4f3b('0x7'));var attributes=require(_0x4f3b('0x8'));module[_0x4f3b('0x9')]=function(_0x4443bb,_0x88e379){return _0x4443bb['define'](_0x4f3b('0xa'),attributes,{'tableName':_0x4f3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7109=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util','request-promise'];(function(_0x32d464,_0x2f88ae){var _0x1d3983=function(_0x33fa1c){while(--_0x33fa1c){_0x32d464['push'](_0x32d464['shift']());}};_0x1d3983(++_0x2f88ae);}(_0x7109,0x181));var _0x9710=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x7109[_0x596f6e];return _0x1e0803;};'use strict';var _=require('lodash');var util=require(_0x9710('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9710('0x1'));var fs=require('fs');var path=require(_0x9710('0x2'));var rimraf=require(_0x9710('0x3'));var config=require(_0x9710('0x4'));var attributes=require(_0x9710('0x5'));module[_0x9710('0x6')]=function(_0x35bebf,_0x114551){return _0x35bebf[_0x9710('0x7')]('SalesforceConfiguration',attributes,{'tableName':_0x9710('0x8'),'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 c715b78..045baeb 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 _0x5f19=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x5a85a6,_0x36c627){var _0x230ae8=function(_0x5042a8){while(--_0x5042a8){_0x5a85a6['push'](_0x5a85a6['shift']());}};_0x230ae8(++_0x36c627);}(_0x5f19,0x7a));var _0x95f1=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x5f19[_0x476c7];return _0x47ae56;};'use strict';var _=require(_0x95f1('0x0'));var util=require('util');var moment=require(_0x95f1('0x1'));var BPromise=require(_0x95f1('0x2'));var rs=require(_0x95f1('0x3'));var fs=require('fs');var Redis=require(_0x95f1('0x4'));var db=require(_0x95f1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95f1('0x6'));var config=require(_0x95f1('0x7'));var jayson=require(_0x95f1('0x8'));var client=jayson['client'][_0x95f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c6f48,_0x33782b,_0x15897f){return new BPromise(function(_0x5502ec,_0x3031c7){return client[_0x95f1('0xa')](_0x7c6f48,_0x15897f)[_0x95f1('0xb')](function(_0x104859){logger[_0x95f1('0xc')](_0x95f1('0xd'),_0x33782b,_0x95f1('0xe'));logger[_0x95f1('0xf')](_0x95f1('0x10'),_0x33782b,'request\x20sent',JSON[_0x95f1('0x11')](_0x104859));if(_0x104859[_0x95f1('0x12')]){if(_0x104859['error']['code']===0x1f4){logger[_0x95f1('0x12')](_0x95f1('0xd'),_0x33782b,_0x104859[_0x95f1('0x12')][_0x95f1('0x13')]);return _0x3031c7(_0x104859[_0x95f1('0x12')]['message']);}logger[_0x95f1('0x12')](_0x95f1('0xd'),_0x33782b,_0x104859[_0x95f1('0x12')][_0x95f1('0x13')]);return _0x5502ec(_0x104859[_0x95f1('0x12')]['message']);}else{logger[_0x95f1('0xc')](_0x95f1('0xd'),_0x33782b,_0x95f1('0xe'));_0x5502ec(_0x104859[_0x95f1('0x14')][_0x95f1('0x13')]);}})[_0x95f1('0x15')](function(_0x22322a){logger[_0x95f1('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x33782b,_0x22322a);_0x3031c7(_0x22322a);});});} \ No newline at end of file +var _0xde32=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xde32,0x1df));var _0x2de3=function(_0x420c93,_0x12644b){_0x420c93=_0x420c93-0x0;var _0x1e9779=_0xde32[_0x420c93];return _0x1e9779;};'use strict';var _=require('lodash');var util=require(_0x2de3('0x0'));var moment=require(_0x2de3('0x1'));var BPromise=require(_0x2de3('0x2'));var rs=require(_0x2de3('0x3'));var fs=require('fs');var Redis=require(_0x2de3('0x4'));var db=require(_0x2de3('0x5'))['db'];var utils=require(_0x2de3('0x6'));var logger=require(_0x2de3('0x7'))('rpc');var config=require(_0x2de3('0x8'));var jayson=require(_0x2de3('0x9'));var client=jayson[_0x2de3('0xa')][_0x2de3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3671,_0xb38bd3,_0x5e045b){return new BPromise(function(_0x442eac,_0x589500){return client[_0x2de3('0xc')](_0x1f3671,_0x5e045b)['then'](function(_0x10dc78){logger[_0x2de3('0xd')](_0x2de3('0xe'),_0xb38bd3,_0x2de3('0xf'));logger['debug'](_0x2de3('0x10'),_0xb38bd3,_0x2de3('0xf'),JSON[_0x2de3('0x11')](_0x10dc78));if(_0x10dc78[_0x2de3('0x12')]){if(_0x10dc78[_0x2de3('0x12')][_0x2de3('0x13')]===0x1f4){logger[_0x2de3('0x12')](_0x2de3('0xe'),_0xb38bd3,_0x10dc78[_0x2de3('0x12')][_0x2de3('0x14')]);return _0x589500(_0x10dc78['error'][_0x2de3('0x14')]);}logger[_0x2de3('0x12')](_0x2de3('0xe'),_0xb38bd3,_0x10dc78['error'][_0x2de3('0x14')]);return _0x442eac(_0x10dc78['error'][_0x2de3('0x14')]);}else{logger[_0x2de3('0xd')](_0x2de3('0xe'),_0xb38bd3,_0x2de3('0xf'));_0x442eac(_0x10dc78[_0x2de3('0x15')][_0x2de3('0x14')]);}})[_0x2de3('0x16')](function(_0x29cbd7){logger[_0x2de3('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0xb38bd3,_0x29cbd7);_0x589500(_0x29cbd7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2f25d81..bec2bd6 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 _0x3c8a=['../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','path','connect-timeout','fs-extra'];(function(_0x49c580,_0xaec7a1){var _0x4d230e=function(_0x355d30){while(--_0x355d30){_0x49c580['push'](_0x49c580['shift']());}};_0x4d230e(++_0xaec7a1);}(_0x3c8a,0x8d));var _0xa3c8=function(_0x3a8b7c,_0x3e5db2){_0x3a8b7c=_0x3a8b7c-0x0;var _0x40eb80=_0x3c8a[_0x3a8b7c];return _0x40eb80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3c8('0x0'));var timeout=require(_0xa3c8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa3c8('0x2'));var auth=require(_0xa3c8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa3c8('0x4'));var controller=require(_0xa3c8('0x5'));router[_0xa3c8('0x6')]('/',auth[_0xa3c8('0x7')](),controller[_0xa3c8('0x8')]);router['get'](_0xa3c8('0x9'),auth[_0xa3c8('0x7')](),controller[_0xa3c8('0xa')]);router[_0xa3c8('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa3c8('0xc')]('/:id',auth[_0xa3c8('0x7')](),controller[_0xa3c8('0xd')]);router[_0xa3c8('0xe')]('/:id',auth[_0xa3c8('0x7')](),controller[_0xa3c8('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0e80=['create','put','update','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','post'];(function(_0x46b338,_0x2c158f){var _0x3b6593=function(_0x5ce72f){while(--_0x5ce72f){_0x46b338['push'](_0x46b338['shift']());}};_0x3b6593(++_0x2c158f);}(_0x0e80,0x114));var _0x00e8=function(_0x582d04,_0x208aef){_0x582d04=_0x582d04-0x0;var _0x5eab51=_0x0e80[_0x582d04];return _0x5eab51;};'use strict';var multer=require(_0x00e8('0x0'));var util=require(_0x00e8('0x1'));var path=require(_0x00e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x00e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x00e8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x00e8('0x5'));var controller=require(_0x00e8('0x6'));router['get']('/',auth[_0x00e8('0x7')](),controller[_0x00e8('0x8')]);router[_0x00e8('0x9')](_0x00e8('0xa'),auth[_0x00e8('0x7')](),controller['show']);router[_0x00e8('0xb')]('/',auth['isAuthenticated'](),controller[_0x00e8('0xc')]);router[_0x00e8('0xd')](_0x00e8('0xa'),auth[_0x00e8('0x7')](),controller[_0x00e8('0xe')]);router['delete'](_0x00e8('0xa'),auth[_0x00e8('0x7')](),controller['destroy']);module[_0x00e8('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 741dd01..8b9a512 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 _0x3fc1=['exports','ENUM','string','customVariable','picklist','STRING','variable','sequelize'];(function(_0x4d0074,_0x333127){var _0x44cc5e=function(_0x4ae899){while(--_0x4ae899){_0x4d0074['push'](_0x4d0074['shift']());}};_0x44cc5e(++_0x333127);}(_0x3fc1,0xaf));var _0x13fc=function(_0xed1070,_0x34a8fa){_0xed1070=_0xed1070-0x0;var _0x36a8bc=_0x3fc1[_0xed1070];return _0x36a8bc;};'use strict';var Sequelize=require(_0x13fc('0x0'));module[_0x13fc('0x1')]={'type':{'type':Sequelize[_0x13fc('0x2')](_0x13fc('0x3'),'variable',_0x13fc('0x4'),'keyValue',_0x13fc('0x5')),'defaultValue':_0x13fc('0x3')},'content':{'type':Sequelize[_0x13fc('0x6')]},'key':{'type':Sequelize[_0x13fc('0x6')]},'keyType':{'type':Sequelize[_0x13fc('0x2')](_0x13fc('0x3'),_0x13fc('0x7'),_0x13fc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x13fc('0x6')]},'variableName':{'type':Sequelize[_0x13fc('0x6')]}}; \ No newline at end of file +var _0x3bd4=['sequelize','exports','string','variable','keyValue','STRING','ENUM'];(function(_0x4347c6,_0x3969cc){var _0x106db2=function(_0x22e587){while(--_0x22e587){_0x4347c6['push'](_0x4347c6['shift']());}};_0x106db2(++_0x3969cc);}(_0x3bd4,0x7e));var _0x43bd=function(_0x4052c0,_0x4271ab){_0x4052c0=_0x4052c0-0x0;var _0x296f04=_0x3bd4[_0x4052c0];return _0x296f04;};'use strict';var Sequelize=require(_0x43bd('0x0'));module[_0x43bd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x43bd('0x2'),_0x43bd('0x3'),'customVariable',_0x43bd('0x4'),'picklist'),'defaultValue':_0x43bd('0x2')},'content':{'type':Sequelize[_0x43bd('0x5')]},'key':{'type':Sequelize[_0x43bd('0x5')]},'keyType':{'type':Sequelize[_0x43bd('0x6')](_0x43bd('0x2'),_0x43bd('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x43bd('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7ffed9b..d70d4f7 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 _0xe21f=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SalesforceField','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x20f04d,_0x532d73){var _0x58a0e5=function(_0x273a58){while(--_0x273a58){_0x20f04d['push'](_0x20f04d['shift']());}};_0x58a0e5(++_0x532d73);}(_0xe21f,0x102));var _0xfe21=function(_0x586b6b,_0x4e1aeb){_0x586b6b=_0x586b6b-0x0;var _0x4eb7d4=_0xe21f[_0x586b6b];return _0x4eb7d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe21('0x0'));var zipdir=require(_0xfe21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe21('0x2'));var moment=require(_0xfe21('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe21('0x4'));var util=require(_0xfe21('0x5'));var path=require(_0xfe21('0x6'));var sox=require(_0xfe21('0x7'));var csv=require(_0xfe21('0x8'));var ejs=require(_0xfe21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe21('0xa'));var squel=require(_0xfe21('0xb'));var crypto=require(_0xfe21('0xc'));var jsforce=require(_0xfe21('0xd'));var deskjs=require(_0xfe21('0xe'));var toCsv=require(_0xfe21('0x8'));var querystring=require(_0xfe21('0xf'));var Papa=require(_0xfe21('0x10'));var Redis=require(_0xfe21('0x11'));var authService=require(_0xfe21('0x12'));var qs=require(_0xfe21('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe21('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfe21('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfe21('0x16'));var db=require(_0xfe21('0x17'))['db'];function respondWithStatusCode(_0x1f8b97,_0x3447fb){_0x3447fb=_0x3447fb||0xcc;return function(_0x34fd96){if(_0x34fd96){return _0x1f8b97['sendStatus'](_0x3447fb);}return _0x1f8b97[_0xfe21('0x18')](_0x3447fb)[_0xfe21('0x19')]();};}function respondWithResult(_0x21a9d0,_0x2eee35){_0x2eee35=_0x2eee35||0xc8;return function(_0x4fb915){if(_0x4fb915){return _0x21a9d0[_0xfe21('0x18')](_0x2eee35)[_0xfe21('0x1a')](_0x4fb915);}};}function respondWithFilteredResult(_0x296c8f,_0x51c8c1){return function(_0x2ad1fb){if(_0x2ad1fb){var _0x5cead4=typeof _0x51c8c1[_0xfe21('0x1b')]==='undefined'&&typeof _0x51c8c1[_0xfe21('0x1c')]===_0xfe21('0x1d');var _0x221881=_0x2ad1fb[_0xfe21('0x1e')];var _0x534d6e=_0x5cead4?0x0:_0x51c8c1[_0xfe21('0x1b')];var _0x97079d=_0x5cead4?_0x2ad1fb[_0xfe21('0x1e')]:_0x51c8c1['offset']+_0x51c8c1[_0xfe21('0x1c')];var _0x732600;if(_0x97079d>=_0x221881){_0x97079d=_0x221881;_0x732600=0xc8;}else{_0x732600=0xce;}_0x296c8f[_0xfe21('0x18')](_0x732600);return _0x296c8f[_0xfe21('0x1f')](_0xfe21('0x20'),_0x534d6e+'-'+_0x97079d+'/'+_0x221881)[_0xfe21('0x1a')](_0x2ad1fb);}return null;};}function patchUpdates(_0x8bbe5d){return function(_0x46d48f){try{jsonpatch[_0xfe21('0x21')](_0x46d48f,_0x8bbe5d,!![]);}catch(_0x3c1f7){return BPromise['reject'](_0x3c1f7);}return _0x46d48f['save']();};}function saveUpdates(_0x63ea51,_0x5bfb8e){return function(_0x1d00e8){if(_0x1d00e8){return _0x1d00e8[_0xfe21('0x22')](_0x63ea51)[_0xfe21('0x23')](function(_0x58bc41){return _0x58bc41;});}return null;};}function removeEntity(_0x17d96d,_0x55baf0){return function(_0x117224){if(_0x117224){return _0x117224[_0xfe21('0x24')]()[_0xfe21('0x23')](function(){_0x17d96d['status'](0xcc)[_0xfe21('0x19')]();});}};}function handleEntityNotFound(_0xa35e39,_0x556e64){return function(_0x5c00a0){if(!_0x5c00a0){_0xa35e39[_0xfe21('0x25')](0x194);}return _0x5c00a0;};}function handleError(_0x4e027e,_0x5bde56){_0x5bde56=_0x5bde56||0x1f4;return function(_0x3649a1){logger[_0xfe21('0x26')](_0x3649a1[_0xfe21('0x27')]);if(_0x3649a1[_0xfe21('0x28')]){delete _0x3649a1['name'];}_0x4e027e[_0xfe21('0x18')](_0x5bde56)[_0xfe21('0x29')](_0x3649a1);};}exports[_0xfe21('0x2a')]=function(_0x4c8aba,_0x311eb0){var _0x5d5d05={},_0x5c7191={},_0x3cfd93={'count':0x0,'rows':[]};var _0x2a983d=_[_0xfe21('0x2b')](db['SalesforceField'][_0xfe21('0x2c')],function(_0x59539e){return{'name':_0x59539e[_0xfe21('0x2d')],'type':_0x59539e[_0xfe21('0x2e')][_0xfe21('0x2f')]};});_0x5c7191[_0xfe21('0x30')]=_['map'](_0x2a983d,'name');_0x5c7191[_0xfe21('0x31')]=_[_0xfe21('0x32')](_0x4c8aba[_0xfe21('0x31')]);_0x5c7191[_0xfe21('0x33')]=_[_0xfe21('0x34')](_0x5c7191[_0xfe21('0x30')],_0x5c7191[_0xfe21('0x31')]);_0x5d5d05['attributes']=_[_0xfe21('0x34')](_0x5c7191[_0xfe21('0x30')],qs[_0xfe21('0x35')](_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x35')]));_0x5d5d05[_0xfe21('0x36')]=_0x5d5d05[_0xfe21('0x36')][_0xfe21('0x37')]?_0x5d5d05['attributes']:_0x5c7191['model'];if(!_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x38')](_0xfe21('0x39'))){_0x5d5d05['limit']=qs[_0xfe21('0x1c')](_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x1c')]);_0x5d5d05['offset']=qs[_0xfe21('0x1b')](_0x4c8aba['query'][_0xfe21('0x1b')]);}_0x5d5d05[_0xfe21('0x3a')]=qs[_0xfe21('0x3b')](_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x3b')]);_0x5d5d05['where']=qs[_0xfe21('0x33')](_[_0xfe21('0x3c')](_0x4c8aba[_0xfe21('0x31')],_0x5c7191[_0xfe21('0x33')]),_0x2a983d);if(_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x3d')]){_0x5d5d05[_0xfe21('0x3e')]=_[_0xfe21('0x3f')](_0x5d5d05['where'],{'$or':_[_0xfe21('0x2b')](_0x2a983d,function(_0x5baeb7){if(_0x5baeb7[_0xfe21('0x2e')]!==_0xfe21('0x40')){var _0x307043={};_0x307043[_0x5baeb7[_0xfe21('0x28')]]={'$like':'%'+_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x3d')]+'%'};return _0x307043;}})});}_0x5d5d05=_[_0xfe21('0x3f')]({},_0x5d5d05,_0x4c8aba['options']);var _0x59dcae={'where':_0x5d5d05['where']};return db[_0xfe21('0x41')]['count'](_0x59dcae)['then'](function(_0x496ea3){_0x3cfd93['count']=_0x496ea3;if(_0x4c8aba['query'][_0xfe21('0x42')]){_0x5d5d05[_0xfe21('0x43')]=[{'all':!![]}];}return db[_0xfe21('0x41')][_0xfe21('0x44')](_0x5d5d05);})[_0xfe21('0x23')](function(_0x3f94bb){_0x3cfd93[_0xfe21('0x45')]=_0x3f94bb;return _0x3cfd93;})[_0xfe21('0x23')](respondWithFilteredResult(_0x311eb0,_0x5d5d05))['catch'](handleError(_0x311eb0,null));};exports[_0xfe21('0x46')]=function(_0x483e41,_0x6b1b5e){var _0x4ce39c={'raw':!![],'where':{'id':_0x483e41[_0xfe21('0x47')]['id']}},_0x1ea12b={};_0x1ea12b[_0xfe21('0x30')]=_[_0xfe21('0x32')](db[_0xfe21('0x41')][_0xfe21('0x2c')]);_0x1ea12b[_0xfe21('0x31')]=_[_0xfe21('0x32')](_0x483e41[_0xfe21('0x31')]);_0x1ea12b[_0xfe21('0x33')]=_[_0xfe21('0x34')](_0x1ea12b[_0xfe21('0x30')],_0x1ea12b['query']);_0x4ce39c['attributes']=_[_0xfe21('0x34')](_0x1ea12b[_0xfe21('0x30')],qs[_0xfe21('0x35')](_0x483e41['query'][_0xfe21('0x35')]));_0x4ce39c[_0xfe21('0x36')]=_0x4ce39c[_0xfe21('0x36')]['length']?_0x4ce39c[_0xfe21('0x36')]:_0x1ea12b[_0xfe21('0x30')];if(_0x483e41['query'][_0xfe21('0x42')]){_0x4ce39c[_0xfe21('0x43')]=[{'all':!![]}];}_0x4ce39c=_[_0xfe21('0x3f')]({},_0x4ce39c,_0x483e41[_0xfe21('0x48')]);return db[_0xfe21('0x41')][_0xfe21('0x49')](_0x4ce39c)[_0xfe21('0x23')](handleEntityNotFound(_0x6b1b5e,null))['then'](respondWithResult(_0x6b1b5e,null))[_0xfe21('0x4a')](handleError(_0x6b1b5e,null));};exports[_0xfe21('0x4b')]=function(_0x4c2b5d,_0xac6346){return db[_0xfe21('0x41')][_0xfe21('0x4b')](_0x4c2b5d[_0xfe21('0x4c')],{})['then'](respondWithResult(_0xac6346,0xc9))['catch'](handleError(_0xac6346,null));};exports[_0xfe21('0x22')]=function(_0x3a08fe,_0x2a3024){if(_0x3a08fe[_0xfe21('0x4c')]['id']){delete _0x3a08fe[_0xfe21('0x4c')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x3a08fe['params']['id']}})[_0xfe21('0x23')](handleEntityNotFound(_0x2a3024,null))[_0xfe21('0x23')](saveUpdates(_0x3a08fe[_0xfe21('0x4c')],null))[_0xfe21('0x23')](respondWithResult(_0x2a3024,null))[_0xfe21('0x4a')](handleError(_0x2a3024,null));};exports['destroy']=function(_0x19e4ea,_0xbfba55){return db[_0xfe21('0x41')]['find']({'where':{'id':_0x19e4ea['params']['id']}})[_0xfe21('0x23')](handleEntityNotFound(_0xbfba55,null))[_0xfe21('0x23')](removeEntity(_0xbfba55,null))[_0xfe21('0x4a')](handleError(_0xbfba55,null));}; \ No newline at end of file +var _0x4362=['includeAll','include','findAll','catch','show','params','length','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','SalesforceField'];(function(_0x22b071,_0x218563){var _0x2122a7=function(_0x54fab9){while(--_0x54fab9){_0x22b071['push'](_0x22b071['shift']());}};_0x2122a7(++_0x218563);}(_0x4362,0xdd));var _0x2436=function(_0x5cdb8d,_0xad2c83){_0x5cdb8d=_0x5cdb8d-0x0;var _0x596af4=_0x4362[_0x5cdb8d];return _0x596af4;};'use strict';var emlformat=require(_0x2436('0x0'));var rimraf=require(_0x2436('0x1'));var zipdir=require(_0x2436('0x2'));var jsonpatch=require(_0x2436('0x3'));var rp=require(_0x2436('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2436('0x5'));var util=require(_0x2436('0x6'));var path=require(_0x2436('0x7'));var sox=require(_0x2436('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2436('0x9'));var _=require(_0x2436('0xa'));var squel=require(_0x2436('0xb'));var crypto=require(_0x2436('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2436('0xd'));var toCsv=require(_0x2436('0xe'));var querystring=require('querystring');var Papa=require(_0x2436('0xf'));var Redis=require('ioredis');var authService=require(_0x2436('0x10'));var qs=require(_0x2436('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2436('0x12'))(_0x2436('0x13'));var utils=require(_0x2436('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2436('0x15'))['db'];function respondWithStatusCode(_0xc10f28,_0x440ed7){_0x440ed7=_0x440ed7||0xcc;return function(_0x268221){if(_0x268221){return _0xc10f28[_0x2436('0x16')](_0x440ed7);}return _0xc10f28['status'](_0x440ed7)[_0x2436('0x17')]();};}function respondWithResult(_0x4f50dc,_0x575add){_0x575add=_0x575add||0xc8;return function(_0x5c7296){if(_0x5c7296){return _0x4f50dc[_0x2436('0x18')](_0x575add)[_0x2436('0x19')](_0x5c7296);}};}function respondWithFilteredResult(_0x16f91f,_0x5115d5){return function(_0x25a5d3){if(_0x25a5d3){var _0x2aae63=typeof _0x5115d5[_0x2436('0x1a')]===_0x2436('0x1b')&&typeof _0x5115d5[_0x2436('0x1c')]==='undefined';var _0xc367dc=_0x25a5d3['count'];var _0xef44fe=_0x2aae63?0x0:_0x5115d5[_0x2436('0x1a')];var _0x4dd9eb=_0x2aae63?_0x25a5d3[_0x2436('0x1d')]:_0x5115d5[_0x2436('0x1a')]+_0x5115d5['limit'];var _0x3d7196;if(_0x4dd9eb>=_0xc367dc){_0x4dd9eb=_0xc367dc;_0x3d7196=0xc8;}else{_0x3d7196=0xce;}_0x16f91f[_0x2436('0x18')](_0x3d7196);return _0x16f91f[_0x2436('0x1e')](_0x2436('0x1f'),_0xef44fe+'-'+_0x4dd9eb+'/'+_0xc367dc)[_0x2436('0x19')](_0x25a5d3);}return null;};}function patchUpdates(_0x35e7a7){return function(_0x7169a6){try{jsonpatch[_0x2436('0x20')](_0x7169a6,_0x35e7a7,!![]);}catch(_0x23555d){return BPromise[_0x2436('0x21')](_0x23555d);}return _0x7169a6[_0x2436('0x22')]();};}function saveUpdates(_0x1771d3,_0x2c5825){return function(_0x77d2e6){if(_0x77d2e6){return _0x77d2e6['update'](_0x1771d3)[_0x2436('0x23')](function(_0x6e54ec){return _0x6e54ec;});}return null;};}function removeEntity(_0x4541d7,_0x15569b){return function(_0x2c87e8){if(_0x2c87e8){return _0x2c87e8[_0x2436('0x24')]()[_0x2436('0x23')](function(){_0x4541d7[_0x2436('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b66a,_0x323481){return function(_0x4ba06c){if(!_0x4ba06c){_0x15b66a['sendStatus'](0x194);}return _0x4ba06c;};}function handleError(_0x131d77,_0x5d1d31){_0x5d1d31=_0x5d1d31||0x1f4;return function(_0x423967){logger['error'](_0x423967['stack']);if(_0x423967[_0x2436('0x25')]){delete _0x423967[_0x2436('0x25')];}_0x131d77[_0x2436('0x18')](_0x5d1d31)[_0x2436('0x26')](_0x423967);};}exports['index']=function(_0x1d6d1d,_0x46612c){var _0x3d3b4b={},_0x133be1={},_0x479623={'count':0x0,'rows':[]};var _0x2159ae=_[_0x2436('0x27')](db['SalesforceField'][_0x2436('0x28')],function(_0x38441f){return{'name':_0x38441f['fieldName'],'type':_0x38441f['type'][_0x2436('0x29')]};});_0x133be1[_0x2436('0x2a')]=_[_0x2436('0x27')](_0x2159ae,'name');_0x133be1['query']=_[_0x2436('0x2b')](_0x1d6d1d[_0x2436('0x2c')]);_0x133be1[_0x2436('0x2d')]=_[_0x2436('0x2e')](_0x133be1[_0x2436('0x2a')],_0x133be1['query']);_0x3d3b4b[_0x2436('0x2f')]=_[_0x2436('0x2e')](_0x133be1[_0x2436('0x2a')],qs[_0x2436('0x30')](_0x1d6d1d[_0x2436('0x2c')]['fields']));_0x3d3b4b[_0x2436('0x2f')]=_0x3d3b4b[_0x2436('0x2f')]['length']?_0x3d3b4b[_0x2436('0x2f')]:_0x133be1['model'];if(!_0x1d6d1d[_0x2436('0x2c')]['hasOwnProperty'](_0x2436('0x31'))){_0x3d3b4b[_0x2436('0x1c')]=qs[_0x2436('0x1c')](_0x1d6d1d[_0x2436('0x2c')]['limit']);_0x3d3b4b[_0x2436('0x1a')]=qs[_0x2436('0x1a')](_0x1d6d1d[_0x2436('0x2c')][_0x2436('0x1a')]);}_0x3d3b4b[_0x2436('0x32')]=qs[_0x2436('0x33')](_0x1d6d1d[_0x2436('0x2c')]['sort']);_0x3d3b4b[_0x2436('0x34')]=qs[_0x2436('0x2d')](_['pick'](_0x1d6d1d['query'],_0x133be1[_0x2436('0x2d')]),_0x2159ae);if(_0x1d6d1d[_0x2436('0x2c')][_0x2436('0x35')]){_0x3d3b4b[_0x2436('0x34')]=_[_0x2436('0x36')](_0x3d3b4b[_0x2436('0x34')],{'$or':_[_0x2436('0x27')](_0x2159ae,function(_0x314609){if(_0x314609[_0x2436('0x37')]!==_0x2436('0x38')){var _0x49567b={};_0x49567b[_0x314609[_0x2436('0x25')]]={'$like':'%'+_0x1d6d1d[_0x2436('0x2c')][_0x2436('0x35')]+'%'};return _0x49567b;}})});}_0x3d3b4b=_[_0x2436('0x36')]({},_0x3d3b4b,_0x1d6d1d[_0x2436('0x39')]);var _0xfca186={'where':_0x3d3b4b[_0x2436('0x34')]};return db[_0x2436('0x3a')][_0x2436('0x1d')](_0xfca186)[_0x2436('0x23')](function(_0x2a1c22){_0x479623['count']=_0x2a1c22;if(_0x1d6d1d[_0x2436('0x2c')][_0x2436('0x3b')]){_0x3d3b4b[_0x2436('0x3c')]=[{'all':!![]}];}return db[_0x2436('0x3a')][_0x2436('0x3d')](_0x3d3b4b);})['then'](function(_0x384d12){_0x479623['rows']=_0x384d12;return _0x479623;})['then'](respondWithFilteredResult(_0x46612c,_0x3d3b4b))[_0x2436('0x3e')](handleError(_0x46612c,null));};exports[_0x2436('0x3f')]=function(_0x38aa86,_0x257d14){var _0x530291={'raw':!![],'where':{'id':_0x38aa86[_0x2436('0x40')]['id']}},_0x42ed9f={};_0x42ed9f['model']=_['keys'](db[_0x2436('0x3a')][_0x2436('0x28')]);_0x42ed9f[_0x2436('0x2c')]=_[_0x2436('0x2b')](_0x38aa86[_0x2436('0x2c')]);_0x42ed9f[_0x2436('0x2d')]=_['intersection'](_0x42ed9f[_0x2436('0x2a')],_0x42ed9f['query']);_0x530291[_0x2436('0x2f')]=_['intersection'](_0x42ed9f[_0x2436('0x2a')],qs['fields'](_0x38aa86[_0x2436('0x2c')][_0x2436('0x30')]));_0x530291[_0x2436('0x2f')]=_0x530291[_0x2436('0x2f')][_0x2436('0x41')]?_0x530291[_0x2436('0x2f')]:_0x42ed9f[_0x2436('0x2a')];if(_0x38aa86[_0x2436('0x2c')][_0x2436('0x3b')]){_0x530291[_0x2436('0x3c')]=[{'all':!![]}];}_0x530291=_['merge']({},_0x530291,_0x38aa86[_0x2436('0x39')]);return db['SalesforceField']['find'](_0x530291)[_0x2436('0x23')](handleEntityNotFound(_0x257d14,null))['then'](respondWithResult(_0x257d14,null))[_0x2436('0x3e')](handleError(_0x257d14,null));};exports['create']=function(_0x13e64a,_0x41bbff){return db['SalesforceField'][_0x2436('0x42')](_0x13e64a[_0x2436('0x43')],{})[_0x2436('0x23')](respondWithResult(_0x41bbff,0xc9))[_0x2436('0x3e')](handleError(_0x41bbff,null));};exports[_0x2436('0x44')]=function(_0x6aa4e4,_0xd0e002){if(_0x6aa4e4[_0x2436('0x43')]['id']){delete _0x6aa4e4['body']['id'];}return db['SalesforceField'][_0x2436('0x45')]({'where':{'id':_0x6aa4e4[_0x2436('0x40')]['id']}})[_0x2436('0x23')](handleEntityNotFound(_0xd0e002,null))[_0x2436('0x23')](saveUpdates(_0x6aa4e4[_0x2436('0x43')],null))['then'](respondWithResult(_0xd0e002,null))[_0x2436('0x3e')](handleError(_0xd0e002,null));};exports[_0x2436('0x24')]=function(_0x43e444,_0x4fefad){return db[_0x2436('0x3a')][_0x2436('0x45')]({'where':{'id':_0x43e444[_0x2436('0x40')]['id']}})[_0x2436('0x23')](handleEntityNotFound(_0x4fefad,null))['then'](removeEntity(_0x4fefad,null))[_0x2436('0x3e')](handleError(_0x4fefad,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 125a43e..e4f901f 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 _0x0357=['../../config/logger','api','moment','bluebird','path','./intSalesforceField.attributes','exports','define','salesforce_unique_index','idField','FieldId','lodash','util'];(function(_0x4a0086,_0x5b2ad3){var _0x3857f6=function(_0x50186c){while(--_0x50186c){_0x4a0086['push'](_0x4a0086['shift']());}};_0x3857f6(++_0x5b2ad3);}(_0x0357,0x11c));var _0x7035=function(_0x4452f1,_0x5ad396){_0x4452f1=_0x4452f1-0x0;var _0x6cedd0=_0x0357[_0x4452f1];return _0x6cedd0;};'use strict';var _=require(_0x7035('0x0'));var util=require(_0x7035('0x1'));var logger=require(_0x7035('0x2'))(_0x7035('0x3'));var moment=require(_0x7035('0x4'));var BPromise=require(_0x7035('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7035('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7035('0x7'));module[_0x7035('0x8')]=function(_0x3c8142,_0x404702){return _0x3c8142[_0x7035('0x9')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x7035('0xa'),'fields':[_0x7035('0xb'),_0x7035('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f15=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x3bccd7,_0x16fdbf){var _0x52492f=function(_0x3ffe88){while(--_0x3ffe88){_0x3bccd7['push'](_0x3bccd7['shift']());}};_0x52492f(++_0x16fdbf);}(_0x8f15,0xf1));var _0x58f1=function(_0xd4c527,_0x4008ab){_0xd4c527=_0xd4c527-0x0;var _0x460408=_0x8f15[_0xd4c527];return _0x460408;};'use strict';var _=require(_0x58f1('0x0'));var util=require(_0x58f1('0x1'));var logger=require('../../config/logger')(_0x58f1('0x2'));var moment=require(_0x58f1('0x3'));var BPromise=require(_0x58f1('0x4'));var rp=require(_0x58f1('0x5'));var fs=require('fs');var path=require(_0x58f1('0x6'));var rimraf=require(_0x58f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x58f1('0x8'));module[_0x58f1('0x9')]=function(_0x5e33ab,_0x531550){return _0x5e33ab[_0x58f1('0xa')]('SalesforceField',attributes,{'tableName':_0x58f1('0xb'),'paranoid':![],'indexes':[{'name':_0x58f1('0xc'),'fields':[_0x58f1('0xd'),_0x58f1('0xe')],'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 b9bd04e..8bd5c12 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 _0x21ad=['client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x517dbd,_0x2bfecb){var _0x4d8ffb=function(_0x213a75){while(--_0x213a75){_0x517dbd['push'](_0x517dbd['shift']());}};_0x4d8ffb(++_0x2bfecb);}(_0x21ad,0x13a));var _0xd21a=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x21ad[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xd21a('0x0'));var util=require(_0xd21a('0x1'));var moment=require(_0xd21a('0x2'));var BPromise=require(_0xd21a('0x3'));var rs=require(_0xd21a('0x4'));var fs=require('fs');var Redis=require(_0xd21a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd21a('0x6'));var logger=require(_0xd21a('0x7'))(_0xd21a('0x8'));var config=require(_0xd21a('0x9'));var jayson=require(_0xd21a('0xa'));var client=jayson[_0xd21a('0xb')][_0xd21a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b2553,_0x57f2c7,_0x193d12){return new BPromise(function(_0x56ecdd,_0x278ae5){return client[_0xd21a('0xd')](_0x3b2553,_0x193d12)[_0xd21a('0xe')](function(_0x47e56d){logger[_0xd21a('0xf')](_0xd21a('0x10'),_0x57f2c7,_0xd21a('0x11'));logger[_0xd21a('0x12')](_0xd21a('0x13'),_0x57f2c7,_0xd21a('0x11'),JSON[_0xd21a('0x14')](_0x47e56d));if(_0x47e56d['error']){if(_0x47e56d['error'][_0xd21a('0x15')]===0x1f4){logger['error'](_0xd21a('0x10'),_0x57f2c7,_0x47e56d[_0xd21a('0x16')][_0xd21a('0x17')]);return _0x278ae5(_0x47e56d[_0xd21a('0x16')]['message']);}logger[_0xd21a('0x16')](_0xd21a('0x10'),_0x57f2c7,_0x47e56d[_0xd21a('0x16')][_0xd21a('0x17')]);return _0x56ecdd(_0x47e56d[_0xd21a('0x16')][_0xd21a('0x17')]);}else{logger[_0xd21a('0xf')](_0xd21a('0x10'),_0x57f2c7,_0xd21a('0x11'));_0x56ecdd(_0x47e56d[_0xd21a('0x18')][_0xd21a('0x17')]);}})['catch'](function(_0x1c94eb){logger[_0xd21a('0x16')](_0xd21a('0x10'),_0x57f2c7,_0x1c94eb);_0x278ae5(_0x1c94eb);});});} \ No newline at end of file +var _0x3717=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x46f997,_0x1b7a77){var _0x378663=function(_0x231289){while(--_0x231289){_0x46f997['push'](_0x46f997['shift']());}};_0x378663(++_0x1b7a77);}(_0x3717,0x71));var _0x7371=function(_0x41ce68,_0x5d78ef){_0x41ce68=_0x41ce68-0x0;var _0xbe8b17=_0x3717[_0x41ce68];return _0xbe8b17;};'use strict';var _=require(_0x7371('0x0'));var util=require(_0x7371('0x1'));var moment=require(_0x7371('0x2'));var BPromise=require(_0x7371('0x3'));var rs=require(_0x7371('0x4'));var fs=require('fs');var Redis=require(_0x7371('0x5'));var db=require(_0x7371('0x6'))['db'];var utils=require(_0x7371('0x7'));var logger=require(_0x7371('0x8'))(_0x7371('0x9'));var config=require(_0x7371('0xa'));var jayson=require(_0x7371('0xb'));var client=jayson['client'][_0x7371('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ad94c,_0x3f7405,_0x3bedc2){return new BPromise(function(_0x15065b,_0x4406b6){return client['request'](_0x5ad94c,_0x3bedc2)[_0x7371('0xd')](function(_0x3e4658){logger[_0x7371('0xe')](_0x7371('0xf'),_0x3f7405,_0x7371('0x10'));logger['debug'](_0x7371('0x11'),_0x3f7405,_0x7371('0x10'),JSON[_0x7371('0x12')](_0x3e4658));if(_0x3e4658[_0x7371('0x13')]){if(_0x3e4658[_0x7371('0x13')][_0x7371('0x14')]===0x1f4){logger[_0x7371('0x13')](_0x7371('0xf'),_0x3f7405,_0x3e4658['error'][_0x7371('0x15')]);return _0x4406b6(_0x3e4658[_0x7371('0x13')][_0x7371('0x15')]);}logger[_0x7371('0x13')]('SalesforceField,\x20%s,\x20%s',_0x3f7405,_0x3e4658[_0x7371('0x13')][_0x7371('0x15')]);return _0x15065b(_0x3e4658[_0x7371('0x13')][_0x7371('0x15')]);}else{logger[_0x7371('0xe')](_0x7371('0xf'),_0x3f7405,_0x7371('0x10'));_0x15065b(_0x3e4658[_0x7371('0x16')][_0x7371('0x15')]);}})[_0x7371('0x17')](function(_0xcd5f72){logger['error'](_0x7371('0xf'),_0x3f7405,_0xcd5f72);_0x4406b6(_0xcd5f72);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 7ce7238..78582a9 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 _0x09d3=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','update','multer','util','path','connect-timeout','express','Router'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0x09d3,0xa5));var _0x309d=function(_0x1c64b0,_0x57d581){_0x1c64b0=_0x1c64b0-0x0;var _0x11ac72=_0x09d3[_0x1c64b0];return _0x11ac72;};'use strict';var multer=require(_0x309d('0x0'));var util=require(_0x309d('0x1'));var path=require(_0x309d('0x2'));var timeout=require(_0x309d('0x3'));var express=require(_0x309d('0x4'));var router=express[_0x309d('0x5')]();var fs_extra=require(_0x309d('0x6'));var auth=require(_0x309d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x309d('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x309d('0x9')]('/',auth[_0x309d('0xa')](),controller['index']);router[_0x309d('0x9')](_0x309d('0xb'),auth['isAuthenticated'](),controller[_0x309d('0xc')]);router[_0x309d('0x9')](_0x309d('0xd'),auth[_0x309d('0xa')](),controller[_0x309d('0xe')]);router[_0x309d('0x9')]('/:id/fields',auth[_0x309d('0xa')](),controller[_0x309d('0xf')]);router[_0x309d('0x10')]('/',auth[_0x309d('0xa')](),controller[_0x309d('0x11')]);router[_0x309d('0x10')]('/:id/configurations',auth[_0x309d('0xa')](),controller['addConfiguration']);router['put'](_0x309d('0xb'),auth[_0x309d('0xa')](),controller[_0x309d('0x12')]);router['delete'](_0x309d('0xb'),auth[_0x309d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1c57=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','getConfigurations','/:id/fields','getFields','post','isAuthenticated','create','/:id/configurations','addConfiguration','put'];(function(_0x58dd36,_0x535bb5){var _0x56ee1c=function(_0x9f9719){while(--_0x9f9719){_0x58dd36['push'](_0x58dd36['shift']());}};_0x56ee1c(++_0x535bb5);}(_0x1c57,0xf5));var _0x71c5=function(_0x4a35eb,_0x378981){_0x4a35eb=_0x4a35eb-0x0;var _0x1687cf=_0x1c57[_0x4a35eb];return _0x1687cf;};'use strict';var multer=require(_0x71c5('0x0'));var util=require('util');var path=require(_0x71c5('0x1'));var timeout=require(_0x71c5('0x2'));var express=require('express');var router=express[_0x71c5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x71c5('0x4'));var interaction=require(_0x71c5('0x5'));var config=require(_0x71c5('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x71c5('0x7')]('/',auth['isAuthenticated'](),controller[_0x71c5('0x8')]);router[_0x71c5('0x7')](_0x71c5('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x71c5('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x71c5('0xa')]);router[_0x71c5('0x7')](_0x71c5('0xb'),auth['isAuthenticated'](),controller[_0x71c5('0xc')]);router[_0x71c5('0xd')]('/',auth[_0x71c5('0xe')](),controller[_0x71c5('0xf')]);router[_0x71c5('0xd')](_0x71c5('0x10'),auth['isAuthenticated'](),controller[_0x71c5('0x11')]);router[_0x71c5('0x12')](_0x71c5('0x9'),auth[_0x71c5('0xe')](),controller['update']);router[_0x71c5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x71c5('0x14')]);module[_0x71c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ee56f6f..4b3d85e 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 _0xa995=['exports','STRING','username','remoteUri','sequelize'];(function(_0x34bf32,_0x3ad851){var _0x4a4036=function(_0x70413a){while(--_0x70413a){_0x34bf32['push'](_0x34bf32['shift']());}};_0x4a4036(++_0x3ad851);}(_0xa995,0x95));var _0x5a99=function(_0x57286f,_0x2f693c){_0x57286f=_0x57286f-0x0;var _0x3fd803=_0xa995[_0x57286f];return _0x3fd803;};'use strict';var Sequelize=require(_0x5a99('0x0'));module[_0x5a99('0x1')]={'name':{'type':Sequelize[_0x5a99('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5a99('0x2')],'unique':_0x5a99('0x3')},'password':{'type':Sequelize[_0x5a99('0x2')]},'email':{'type':Sequelize[_0x5a99('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5a99('0x4')},'serverUrl':{'type':Sequelize[_0x5a99('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x71cc=['username','remoteUri','exports','STRING'];(function(_0x53594e,_0x4ae44a){var _0x17c86d=function(_0x41f2ca){while(--_0x41f2ca){_0x53594e['push'](_0x53594e['shift']());}};_0x17c86d(++_0x4ae44a);}(_0x71cc,0xfa));var _0xc71c=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x71cc[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require('sequelize');module[_0xc71c('0x0')]={'name':{'type':Sequelize[_0xc71c('0x1')]},'description':{'type':Sequelize[_0xc71c('0x1')]},'username':{'type':Sequelize[_0xc71c('0x1')],'unique':_0xc71c('0x2')},'password':{'type':Sequelize[_0xc71c('0x1')]},'email':{'type':Sequelize[_0xc71c('0x1')]},'remoteUri':{'type':Sequelize[_0xc71c('0x1')],'unique':_0xc71c('0x3')},'serverUrl':{'type':Sequelize[_0xc71c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ce04f44..3bb893e 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 _0x47ae=['Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','sys_id','reopened_by','urgency','company','reassignment_count','assigned_to','severity','comments','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','serverUrl','remoteUri','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','error','stack','name','send','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ServicenowAccount','includeAll','include','findAll','show','params','rawAttributes','length','options','find','create','body','catch','update','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x47ae,0x11f));var _0xe47a=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x47ae[_0x510c60];return _0x49c4aa;};'use strict';var emlformat=require(_0xe47a('0x0'));var rimraf=require(_0xe47a('0x1'));var zipdir=require(_0xe47a('0x2'));var jsonpatch=require(_0xe47a('0x3'));var rp=require(_0xe47a('0x4'));var moment=require('moment');var BPromise=require(_0xe47a('0x5'));var Mustache=require('mustache');var util=require(_0xe47a('0x6'));var path=require(_0xe47a('0x7'));var sox=require('sox');var csv=require(_0xe47a('0x8'));var ejs=require(_0xe47a('0x9'));var fs=require('fs');var fs_extra=require(_0xe47a('0xa'));var _=require(_0xe47a('0xb'));var squel=require(_0xe47a('0xc'));var crypto=require(_0xe47a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe47a('0xe'));var toCsv=require(_0xe47a('0x8'));var querystring=require('querystring');var Papa=require(_0xe47a('0xf'));var Redis=require(_0xe47a('0x10'));var authService=require(_0xe47a('0x11'));var qs=require(_0xe47a('0x12'));var as=require(_0xe47a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe47a('0x14'));var utils=require('../../config/utils');var config=require(_0xe47a('0x15'));var licenseUtil=require(_0xe47a('0x16'));var db=require(_0xe47a('0x17'))['db'];var integrations=require(_0xe47a('0x18'));function respondWithStatusCode(_0x3cdbbc,_0x2bb831){_0x2bb831=_0x2bb831||0xcc;return function(_0x79a932){if(_0x79a932){return _0x3cdbbc[_0xe47a('0x19')](_0x2bb831);}return _0x3cdbbc['status'](_0x2bb831)[_0xe47a('0x1a')]();};}function respondWithResult(_0x1d6858,_0x570ba3){_0x570ba3=_0x570ba3||0xc8;return function(_0x119103){if(_0x119103){return _0x1d6858[_0xe47a('0x1b')](_0x570ba3)[_0xe47a('0x1c')](_0x119103);}};}function respondWithFilteredResult(_0x13c6ca,_0x38bf8e){return function(_0x1003d5){if(_0x1003d5){var _0x5d67ae=typeof _0x38bf8e['offset']===_0xe47a('0x1d')&&typeof _0x38bf8e[_0xe47a('0x1e')]===_0xe47a('0x1d');var _0x32a91d=_0x1003d5[_0xe47a('0x1f')];var _0x364452=_0x5d67ae?0x0:_0x38bf8e[_0xe47a('0x20')];var _0x2df864=_0x5d67ae?_0x1003d5[_0xe47a('0x1f')]:_0x38bf8e[_0xe47a('0x20')]+_0x38bf8e[_0xe47a('0x1e')];var _0x4a1d18;if(_0x2df864>=_0x32a91d){_0x2df864=_0x32a91d;_0x4a1d18=0xc8;}else{_0x4a1d18=0xce;}_0x13c6ca[_0xe47a('0x1b')](_0x4a1d18);return _0x13c6ca['set']('Content-Range',_0x364452+'-'+_0x2df864+'/'+_0x32a91d)[_0xe47a('0x1c')](_0x1003d5);}return null;};}function patchUpdates(_0x5e6ab4){return function(_0x5ccc0f){try{jsonpatch[_0xe47a('0x21')](_0x5ccc0f,_0x5e6ab4,!![]);}catch(_0x23516e){return BPromise[_0xe47a('0x22')](_0x23516e);}return _0x5ccc0f[_0xe47a('0x23')]();};}function saveUpdates(_0x4f9d7c,_0x4f009c){return function(_0x5badd2){if(_0x5badd2){return _0x5badd2['update'](_0x4f9d7c)[_0xe47a('0x24')](function(_0x2940a4){return _0x2940a4;});}return null;};}function removeEntity(_0x4e5ce3,_0x109c5f){return function(_0x56eaad){if(_0x56eaad){return _0x56eaad[_0xe47a('0x25')]()['then'](function(){_0x4e5ce3[_0xe47a('0x1b')](0xcc)[_0xe47a('0x1a')]();});}};}function handleEntityNotFound(_0x14efc2,_0x12d5e1){return function(_0x24b50b){if(!_0x24b50b){_0x14efc2['sendStatus'](0x194);}return _0x24b50b;};}function handleError(_0x1877f4,_0x59257e){_0x59257e=_0x59257e||0x1f4;return function(_0x2350d8){logger[_0xe47a('0x26')](_0x2350d8[_0xe47a('0x27')]);if(_0x2350d8[_0xe47a('0x28')]){delete _0x2350d8[_0xe47a('0x28')];}_0x1877f4[_0xe47a('0x1b')](_0x59257e)[_0xe47a('0x29')](_0x2350d8);};}exports['index']=function(_0x1d7be8,_0x17fa85){var _0x6b0c13={},_0x444f5c={},_0xa70ca8={'count':0x0,'rows':[]};var _0xc18430=_[_0xe47a('0x2a')](db['ServicenowAccount']['rawAttributes'],function(_0x244977){return{'name':_0x244977[_0xe47a('0x2b')],'type':_0x244977[_0xe47a('0x2c')][_0xe47a('0x2d')]};});_0x444f5c['model']=_[_0xe47a('0x2a')](_0xc18430,_0xe47a('0x28'));_0x444f5c['query']=_[_0xe47a('0x2e')](_0x1d7be8[_0xe47a('0x2f')]);_0x444f5c[_0xe47a('0x30')]=_[_0xe47a('0x31')](_0x444f5c[_0xe47a('0x32')],_0x444f5c[_0xe47a('0x2f')]);_0x6b0c13[_0xe47a('0x33')]=_[_0xe47a('0x31')](_0x444f5c['model'],qs['fields'](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x34')]));_0x6b0c13[_0xe47a('0x33')]=_0x6b0c13[_0xe47a('0x33')]['length']?_0x6b0c13[_0xe47a('0x33')]:_0x444f5c[_0xe47a('0x32')];if(!_0x1d7be8['query'][_0xe47a('0x35')](_0xe47a('0x36'))){_0x6b0c13[_0xe47a('0x1e')]=qs[_0xe47a('0x1e')](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x1e')]);_0x6b0c13[_0xe47a('0x20')]=qs['offset'](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x20')]);}_0x6b0c13[_0xe47a('0x37')]=qs['sort'](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x38')]);_0x6b0c13[_0xe47a('0x39')]=qs['filters'](_[_0xe47a('0x3a')](_0x1d7be8[_0xe47a('0x2f')],_0x444f5c[_0xe47a('0x30')]),_0xc18430);if(_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x3b')]){_0x6b0c13['where']=_[_0xe47a('0x3c')](_0x6b0c13[_0xe47a('0x39')],{'$or':_['map'](_0xc18430,function(_0x205f6c){if(_0x205f6c['type']!==_0xe47a('0x3d')){var _0x5300e8={};_0x5300e8[_0x205f6c[_0xe47a('0x28')]]={'$like':'%'+_0x1d7be8['query'][_0xe47a('0x3b')]+'%'};return _0x5300e8;}})});}_0x6b0c13=_[_0xe47a('0x3c')]({},_0x6b0c13,_0x1d7be8['options']);var _0x5d9546={'where':_0x6b0c13['where']};return db[_0xe47a('0x3e')][_0xe47a('0x1f')](_0x5d9546)[_0xe47a('0x24')](function(_0x455f28){_0xa70ca8[_0xe47a('0x1f')]=_0x455f28;if(_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x3f')]){_0x6b0c13[_0xe47a('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xe47a('0x41')](_0x6b0c13);})[_0xe47a('0x24')](function(_0x5e522c){_0xa70ca8['rows']=_0x5e522c;return _0xa70ca8;})[_0xe47a('0x24')](respondWithFilteredResult(_0x17fa85,_0x6b0c13))['catch'](handleError(_0x17fa85,null));};exports[_0xe47a('0x42')]=function(_0x511c7a,_0x74899e){var _0x1de1e2={'raw':![],'where':{'id':_0x511c7a[_0xe47a('0x43')]['id']}},_0x37a826={};_0x37a826['model']=_['keys'](db[_0xe47a('0x3e')][_0xe47a('0x44')]);_0x37a826[_0xe47a('0x2f')]=_['keys'](_0x511c7a['query']);_0x37a826[_0xe47a('0x30')]=_[_0xe47a('0x31')](_0x37a826[_0xe47a('0x32')],_0x37a826[_0xe47a('0x2f')]);_0x1de1e2['attributes']=_[_0xe47a('0x31')](_0x37a826['model'],qs[_0xe47a('0x34')](_0x511c7a['query']['fields']));_0x1de1e2['attributes']=_0x1de1e2[_0xe47a('0x33')][_0xe47a('0x45')]?_0x1de1e2[_0xe47a('0x33')]:_0x37a826[_0xe47a('0x32')];if(_0x511c7a[_0xe47a('0x2f')]['includeAll']){_0x1de1e2[_0xe47a('0x40')]=[{'all':!![]}];}_0x1de1e2=_[_0xe47a('0x3c')]({},_0x1de1e2,_0x511c7a[_0xe47a('0x46')]);return db['ServicenowAccount'][_0xe47a('0x47')](_0x1de1e2)['then'](handleEntityNotFound(_0x74899e,null))['then'](respondWithResult(_0x74899e,null))['catch'](handleError(_0x74899e,null));};exports['create']=function(_0x35ae1b,_0xcd1859){return db['ServicenowAccount'][_0xe47a('0x48')](_0x35ae1b[_0xe47a('0x49')],{})[_0xe47a('0x24')](respondWithResult(_0xcd1859,0xc9))[_0xe47a('0x4a')](handleError(_0xcd1859,null));};exports[_0xe47a('0x4b')]=function(_0x217411,_0x315c5a){if(_0x217411['body']['id']){delete _0x217411[_0xe47a('0x49')]['id'];}return db['ServicenowAccount'][_0xe47a('0x47')]({'where':{'id':_0x217411['params']['id']}})[_0xe47a('0x24')](handleEntityNotFound(_0x315c5a,null))[_0xe47a('0x24')](saveUpdates(_0x217411['body'],null))[_0xe47a('0x24')](respondWithResult(_0x315c5a,null))['catch'](handleError(_0x315c5a,null));};exports[_0xe47a('0x25')]=function(_0x2fcf41,_0x546ca8){return db['ServicenowAccount'][_0xe47a('0x47')]({'where':{'id':_0x2fcf41['params']['id']}})[_0xe47a('0x24')](handleEntityNotFound(_0x546ca8,null))['then'](removeEntity(_0x546ca8,null))[_0xe47a('0x4a')](handleError(_0x546ca8,null));};exports[_0xe47a('0x4c')]=function(_0x770875,_0x221568,_0x2e4b9f){var _0x3d4a14={};var _0x5f55f2={};var _0x47eb93;var _0x57fe81;return db[_0xe47a('0x3e')][_0xe47a('0x4d')]({'where':{'id':_0x770875[_0xe47a('0x43')]['id']}})['then'](handleEntityNotFound(_0x221568,null))[_0xe47a('0x24')](function(_0x2d98ea){if(_0x2d98ea){_0x47eb93=_0x2d98ea;_0x5f55f2[_0xe47a('0x32')]=_[_0xe47a('0x2e')](db[_0xe47a('0x4e')][_0xe47a('0x44')]);_0x5f55f2['query']=_[_0xe47a('0x2e')](_0x770875[_0xe47a('0x2f')]);_0x5f55f2[_0xe47a('0x30')]=_['intersection'](_0x5f55f2[_0xe47a('0x32')],_0x5f55f2['query']);_0x3d4a14['attributes']=_[_0xe47a('0x31')](_0x5f55f2[_0xe47a('0x32')],qs[_0xe47a('0x34')](_0x770875[_0xe47a('0x2f')][_0xe47a('0x34')]));_0x3d4a14[_0xe47a('0x33')]=_0x3d4a14[_0xe47a('0x33')][_0xe47a('0x45')]?_0x3d4a14[_0xe47a('0x33')]:_0x5f55f2[_0xe47a('0x32')];_0x3d4a14[_0xe47a('0x37')]=qs[_0xe47a('0x38')](_0x770875['query'][_0xe47a('0x38')]);_0x3d4a14[_0xe47a('0x39')]=qs[_0xe47a('0x30')](_['pick'](_0x770875[_0xe47a('0x2f')],_0x5f55f2[_0xe47a('0x30')]));if(_0x770875['query']['filter']){_0x3d4a14[_0xe47a('0x39')]=_['merge'](_0x3d4a14['where'],{'$or':_['map'](_0x3d4a14[_0xe47a('0x33')],function(_0x4f6b38){var _0x19655c={};_0x19655c[_0x4f6b38]={'$like':'%'+_0x770875[_0xe47a('0x2f')][_0xe47a('0x3b')]+'%'};return _0x19655c;})});}_0x3d4a14=_[_0xe47a('0x3c')]({},_0x3d4a14,_0x770875[_0xe47a('0x46')]);return _0x47eb93['getConfigurations'](_0x3d4a14);}})[_0xe47a('0x24')](function(_0x33fb38){if(_0x33fb38){_0x57fe81=_0x33fb38[_0xe47a('0x45')];if(!_0x770875[_0xe47a('0x2f')][_0xe47a('0x35')]('nolimit')){_0x3d4a14[_0xe47a('0x1e')]=qs[_0xe47a('0x1e')](_0x770875['query'][_0xe47a('0x1e')]);_0x3d4a14[_0xe47a('0x20')]=qs[_0xe47a('0x20')](_0x770875['query'][_0xe47a('0x20')]);}return _0x47eb93['getConfigurations'](_0x3d4a14);}})[_0xe47a('0x24')](function(_0x48fa30){if(_0x48fa30){return _0x48fa30?{'count':_0x57fe81,'rows':_0x48fa30}:null;}})[_0xe47a('0x24')](respondWithResult(_0x221568,null))[_0xe47a('0x4a')](handleError(_0x221568,null));};exports[_0xe47a('0x4f')]=function(_0x1c4307,_0x1533c4,_0x593826){if(_0x1c4307['body']['id']){delete _0x1c4307[_0xe47a('0x49')]['id'];}return db[_0xe47a('0x3e')][_0xe47a('0x4d')]({'where':{'id':_0x1c4307['params']['id']}})[_0xe47a('0x24')](handleEntityNotFound(_0x1533c4,null))[_0xe47a('0x24')](function(_0x11ff96){if(_0x11ff96){_0x1c4307[_0xe47a('0x49')][_0xe47a('0x50')]=_0x11ff96['id'];_0x1c4307[_0xe47a('0x49')][_0xe47a('0x51')]=integrations[_0xe47a('0x52')](_0x1c4307[_0xe47a('0x49')][_0xe47a('0x53')],_0x1c4307['body'][_0xe47a('0x2c')]);_0x1c4307[_0xe47a('0x49')][_0xe47a('0x54')]=integrations[_0xe47a('0x55')](_0x1c4307['body'][_0xe47a('0x53')],_0x1c4307['body'][_0xe47a('0x2c')]);return db['ServicenowConfiguration']['create'](_0x1c4307[_0xe47a('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0xe47a('0x51')},{'model':db['ServicenowField'],'as':_0xe47a('0x54')}]});}return null;})[_0xe47a('0x24')](respondWithResult(_0x1533c4,null))[_0xe47a('0x4a')](handleError(_0x1533c4,null));};exports[_0xe47a('0x56')]=function(_0x4e8015,_0x541fb6,_0x3e2e9b){var _0x5c6756=['made_sla',_0xe47a('0x57'),_0xe47a('0x58'),_0xe47a('0x59'),_0xe47a('0x5a'),'notify',_0xe47a('0x5b'),'severity',_0xe47a('0x5c')];var _0x3ad1e0=[_0xe47a('0x5d'),_0xe47a('0x5e'),_0xe47a('0x5f'),_0xe47a('0x60'),'upon_reject',_0xe47a('0x61'),_0xe47a('0x62'),_0xe47a('0x57'),_0xe47a('0x63'),_0xe47a('0x64'),_0xe47a('0x65'),_0xe47a('0x66'),_0xe47a('0x67'),_0xe47a('0x68'),_0xe47a('0x69'),'sys_domain',_0xe47a('0x6a'),_0xe47a('0x6b'),_0xe47a('0x58'),_0xe47a('0x37'),_0xe47a('0x6c'),_0xe47a('0x6d'),'cmdb_ci',_0xe47a('0x6e'),_0xe47a('0x6f'),_0xe47a('0x70'),_0xe47a('0x71'),_0xe47a('0x72'),_0xe47a('0x73'),'sys_domain_path',_0xe47a('0x74'),_0xe47a('0x75'),'expected_start','opened_at',_0xe47a('0x76'),_0xe47a('0x77'),_0xe47a('0x78'),_0xe47a('0x79'),_0xe47a('0x7a'),_0xe47a('0x7b'),_0xe47a('0x7c'),'subcategory',_0xe47a('0x7d'),_0xe47a('0x7e'),_0xe47a('0x5a'),_0xe47a('0x7f'),'delivery_task',_0xe47a('0x80'),_0xe47a('0x81'),_0xe47a('0x82'),_0xe47a('0x83'),_0xe47a('0x84'),_0xe47a('0x85'),'notify',_0xe47a('0x86'),'close_notes',_0xe47a('0x87'),_0xe47a('0x88'),'parent_incident',_0xe47a('0x89'),'contact_type',_0xe47a('0x8a'),_0xe47a('0x5b'),_0xe47a('0x8b'),'problem_id',_0xe47a('0x8c'),_0xe47a('0x8d'),'activity_due',_0xe47a('0x8e'),_0xe47a('0x8f'),_0xe47a('0x90'),'sla_due','approval',_0xe47a('0x91'),'due_date',_0xe47a('0x92'),_0xe47a('0x93'),_0xe47a('0x94'),'escalation',_0xe47a('0x95'),_0xe47a('0x96'),_0xe47a('0x97'),_0xe47a('0x5c')];var _0x167118='';var _0x2335fa='';var _0x4f85b3=[];var _0x5aba73='';var _0x5eedce='';var _0x5121ac=[];var _0x591ebf='';var _0x17a171='';var _0x223eb8={};var _0x5adb14='';return db[_0xe47a('0x3e')][_0xe47a('0x4d')]({'where':{'id':_0x4e8015[_0xe47a('0x43')]['id']},'attributes':['id',_0xe47a('0x98'),_0xe47a('0x99'),'email','remoteUri',_0xe47a('0x9a')]})[_0xe47a('0x24')](handleEntityNotFound(_0x541fb6,null))[_0xe47a('0x24')](function(_0x7a10cc){if(_0x7a10cc){_0x5adb14=_0x7a10cc[_0xe47a('0x9b')];var _0x265910=_0x5adb14[_0xe47a('0x9c')](-0x1);if(_0x265910==='/'){_0x5adb14=_0x5adb14['substring'](0x0,_0x5adb14['lastIndexOf'](_0x265910));}_0x17a171=util[_0xe47a('0x9d')](_0xe47a('0x9e'),_0x5adb14);_0x591ebf=util[_0xe47a('0x9d')](_0xe47a('0x9f'),_0x5adb14);_0x223eb8={'user':_0x7a10cc[_0xe47a('0x98')],'pass':_0x7a10cc[_0xe47a('0x99')]};var _0x11b35f={'method':_0xe47a('0xa0'),'uri':_0x17a171+_0xe47a('0xa1'),'auth':_0x223eb8,'json':!![]};return rp(_0x11b35f);}})['then'](function(_0x10da82){if(_0x10da82[_0xe47a('0xa2')]['length']>0x0){_0x167118=_0x10da82[_0xe47a('0xa2')];}console['log'](_0xe47a('0xa3'),_0x167118);_0x5121ac=[];_0x2335fa=Object['assign']([],_0x167118);_[_0xe47a('0xa4')](_0x2335fa,function(_0x3b4d37){return!_0x5c6756[_0xe47a('0xa5')](_0x3b4d37[_0xe47a('0x28')]);});_0x2335fa[_0xe47a('0xa6')](function(_0x5db042){var _0x5f7fde=createFieldObject(_0x591ebf,_0x223eb8,_0x5db042[_0xe47a('0xa7')],_0x5db042['name'],_0x5db042[_0xe47a('0xa8')],![]);_0x5121ac[_0xe47a('0xa9')](_0x5f7fde);});return Promise[_0xe47a('0xaa')](_0x5121ac);})[_0xe47a('0x24')](function(_0x53439d){_0x4f85b3=_0x53439d;_0x5aba73=Object['assign']([],_0x167118);console[_0xe47a('0xab')](_0xe47a('0xac'),_0x167118);_[_0xe47a('0xa4')](_0x5aba73,function(_0x2a0a3a){return _0x3ad1e0[_0xe47a('0xa5')](_0x2a0a3a['name']);});console[_0xe47a('0xab')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5aba73);_0x5121ac=[];_0x5aba73[_0xe47a('0xa6')](function(_0x5a3cc4){var _0x3a76c3=createFieldObject(_0x591ebf,_0x223eb8,_0x5a3cc4[_0xe47a('0xa7')],_0x5a3cc4['name'],_0x5a3cc4[_0xe47a('0xa8')],!![]);_0x5121ac[_0xe47a('0xa9')](_0x3a76c3);});return Promise[_0xe47a('0xaa')](_0x5121ac);})['then'](function(_0x4fc5df){_0x5eedce=_0x4fc5df;var _0x27b397=_0x4f85b3['concat'](_0x5eedce);return{'count':_0x27b397['length'],'rows':_0x27b397};})[_0xe47a('0x24')](respondWithResult(_0x541fb6,null))['catch'](function(_0x27ca9d){console['log'](_0xe47a('0xad')+_0x27ca9d);var _0x5953fc=_0x4e8015['query'][_0xe47a('0xae')]?0x1f4:_0x27ca9d[_0xe47a('0xaf')]||0x1f4;logger['error'](_0x27ca9d[_0xe47a('0x27')]);delete _0x27ca9d[_0xe47a('0x28')];if(_0x5953fc===0x191){_0x5953fc=0x190;}_0x541fb6['status'](_0x5953fc)[_0xe47a('0x29')](_0x4e8015[_0xe47a('0x2f')][_0xe47a('0xae')]?{'message':_0xe47a('0xb0'),'statusCode':_0x27ca9d[_0xe47a('0xaf')]}:_0x27ca9d);});};function createFieldObject(_0x1dde8a,_0x2292ab,_0x43a3c1,_0x539fef,_0x23e8df,_0x300c61){return new Promise(function(_0x2bcbd1,_0x2c122d){var _0xb6de8d={'id':_0x539fef,'name':_0x23e8df,'custom':_0x300c61};if(_0x43a3c1===_0xe47a('0xb1')){_0xb6de8d[_0xe47a('0x46')]=[{'name':'True','value':_0xe47a('0xb2')},{'name':_0xe47a('0xb3'),'value':_0xe47a('0xb4')}];_0x2bcbd1(_0xb6de8d);}else{var _0x1e7831={'method':'GET','uri':_0x1dde8a+_0xe47a('0xb5')+_0x539fef,'auth':_0x2292ab,'json':!![]};return rp(_0x1e7831)[_0xe47a('0x24')](function(_0x185a4c){var _0x41b214=[];if(_0x185a4c[_0xe47a('0xa2')][_0xe47a('0x45')]>0x0){_0x185a4c[_0xe47a('0xa2')][_0xe47a('0xa6')](function(_0x207514){if(_0x207514[_0xe47a('0xb6')]===_0xe47a('0xb4')){var _0x500ea1={'name':_0x207514[_0xe47a('0xa8')],'value':_0x207514[_0xe47a('0xb7')]};_0x41b214['push'](_0x500ea1);}});}_0xb6de8d[_0xe47a('0x46')]=_0x41b214;if(_0xb6de8d[_0xe47a('0x46')][_0xe47a('0x45')]>0x0){_0x2bcbd1(_0xb6de8d);}else{if(_0x300c61==![]){_0x2bcbd1();}else{_0x2bcbd1(_0xb6de8d);}}});}});} \ No newline at end of file +var _0xfb92=['hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','rfc','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','escalation','correlation_id','username','password','email','serverUrl','remoteUri','slice','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','forEach','label','push','all','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','count','set','json','apply','reject','save','then','destroy','sendStatus','error','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','catch','update','getConfigurations','findOne','ServicenowConfiguration','order','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla'];(function(_0x43b884,_0x4343b1){var _0x3396dd=function(_0x13d321){while(--_0x13d321){_0x43b884['push'](_0x43b884['shift']());}};_0x3396dd(++_0x4343b1);}(_0xfb92,0x1c6));var _0x2fb9=function(_0x5354cd,_0x3b23c4){_0x5354cd=_0x5354cd-0x0;var _0x200342=_0xfb92[_0x5354cd];return _0x200342;};'use strict';var emlformat=require(_0x2fb9('0x0'));var rimraf=require(_0x2fb9('0x1'));var zipdir=require(_0x2fb9('0x2'));var jsonpatch=require(_0x2fb9('0x3'));var rp=require('request-promise');var moment=require(_0x2fb9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2fb9('0x5'));var sox=require(_0x2fb9('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fb9('0x7'));var _=require(_0x2fb9('0x8'));var squel=require(_0x2fb9('0x9'));var crypto=require(_0x2fb9('0xa'));var jsforce=require(_0x2fb9('0xb'));var deskjs=require(_0x2fb9('0xc'));var toCsv=require(_0x2fb9('0xd'));var querystring=require(_0x2fb9('0xe'));var Papa=require(_0x2fb9('0xf'));var Redis=require('ioredis');var authService=require(_0x2fb9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2fb9('0x11'));var hardwareService=require(_0x2fb9('0x12'));var logger=require(_0x2fb9('0x13'))('api');var utils=require(_0x2fb9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2fb9('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2fb9('0x16'));function respondWithStatusCode(_0x549ae9,_0x334cdd){_0x334cdd=_0x334cdd||0xcc;return function(_0x27cf79){if(_0x27cf79){return _0x549ae9['sendStatus'](_0x334cdd);}return _0x549ae9[_0x2fb9('0x17')](_0x334cdd)[_0x2fb9('0x18')]();};}function respondWithResult(_0xed16ec,_0x48cc3c){_0x48cc3c=_0x48cc3c||0xc8;return function(_0x1b4d5e){if(_0x1b4d5e){return _0xed16ec[_0x2fb9('0x17')](_0x48cc3c)['json'](_0x1b4d5e);}};}function respondWithFilteredResult(_0x496604,_0x43b61e){return function(_0xb21fb1){if(_0xb21fb1){var _0x5accbc=typeof _0x43b61e[_0x2fb9('0x19')]===_0x2fb9('0x1a')&&typeof _0x43b61e['limit']==='undefined';var _0xbad884=_0xb21fb1[_0x2fb9('0x1b')];var _0x72b0b8=_0x5accbc?0x0:_0x43b61e['offset'];var _0x484be4=_0x5accbc?_0xb21fb1[_0x2fb9('0x1b')]:_0x43b61e[_0x2fb9('0x19')]+_0x43b61e['limit'];var _0x761703;if(_0x484be4>=_0xbad884){_0x484be4=_0xbad884;_0x761703=0xc8;}else{_0x761703=0xce;}_0x496604['status'](_0x761703);return _0x496604[_0x2fb9('0x1c')]('Content-Range',_0x72b0b8+'-'+_0x484be4+'/'+_0xbad884)[_0x2fb9('0x1d')](_0xb21fb1);}return null;};}function patchUpdates(_0x1fc550){return function(_0x78a05d){try{jsonpatch[_0x2fb9('0x1e')](_0x78a05d,_0x1fc550,!![]);}catch(_0x50c055){return BPromise[_0x2fb9('0x1f')](_0x50c055);}return _0x78a05d[_0x2fb9('0x20')]();};}function saveUpdates(_0x293ca1,_0x48bacf){return function(_0x40446c){if(_0x40446c){return _0x40446c['update'](_0x293ca1)[_0x2fb9('0x21')](function(_0x590a5e){return _0x590a5e;});}return null;};}function removeEntity(_0x3f85a3,_0x1dd658){return function(_0x4d0a20){if(_0x4d0a20){return _0x4d0a20[_0x2fb9('0x22')]()[_0x2fb9('0x21')](function(){_0x3f85a3[_0x2fb9('0x17')](0xcc)[_0x2fb9('0x18')]();});}};}function handleEntityNotFound(_0x3072db,_0x20ec77){return function(_0x415a32){if(!_0x415a32){_0x3072db[_0x2fb9('0x23')](0x194);}return _0x415a32;};}function handleError(_0x5df242,_0x4c589f){_0x4c589f=_0x4c589f||0x1f4;return function(_0x46ddb0){logger[_0x2fb9('0x24')](_0x46ddb0['stack']);if(_0x46ddb0['name']){delete _0x46ddb0['name'];}_0x5df242[_0x2fb9('0x17')](_0x4c589f)[_0x2fb9('0x25')](_0x46ddb0);};}exports['index']=function(_0x56ffea,_0x283793){var _0x142751={},_0x46cb68={},_0x436d03={'count':0x0,'rows':[]};var _0x5c0044=_[_0x2fb9('0x26')](db[_0x2fb9('0x27')][_0x2fb9('0x28')],function(_0x366d7d){return{'name':_0x366d7d[_0x2fb9('0x29')],'type':_0x366d7d[_0x2fb9('0x2a')][_0x2fb9('0x2b')]};});_0x46cb68[_0x2fb9('0x2c')]=_[_0x2fb9('0x26')](_0x5c0044,_0x2fb9('0x2d'));_0x46cb68['query']=_[_0x2fb9('0x2e')](_0x56ffea[_0x2fb9('0x2f')]);_0x46cb68[_0x2fb9('0x30')]=_[_0x2fb9('0x31')](_0x46cb68[_0x2fb9('0x2c')],_0x46cb68[_0x2fb9('0x2f')]);_0x142751[_0x2fb9('0x32')]=_[_0x2fb9('0x31')](_0x46cb68[_0x2fb9('0x2c')],qs[_0x2fb9('0x33')](_0x56ffea[_0x2fb9('0x2f')][_0x2fb9('0x33')]));_0x142751[_0x2fb9('0x32')]=_0x142751[_0x2fb9('0x32')]['length']?_0x142751['attributes']:_0x46cb68[_0x2fb9('0x2c')];if(!_0x56ffea['query'][_0x2fb9('0x34')](_0x2fb9('0x35'))){_0x142751[_0x2fb9('0x36')]=qs[_0x2fb9('0x36')](_0x56ffea['query'][_0x2fb9('0x36')]);_0x142751[_0x2fb9('0x19')]=qs[_0x2fb9('0x19')](_0x56ffea[_0x2fb9('0x2f')]['offset']);}_0x142751['order']=qs[_0x2fb9('0x37')](_0x56ffea[_0x2fb9('0x2f')]['sort']);_0x142751[_0x2fb9('0x38')]=qs['filters'](_[_0x2fb9('0x39')](_0x56ffea[_0x2fb9('0x2f')],_0x46cb68[_0x2fb9('0x30')]),_0x5c0044);if(_0x56ffea[_0x2fb9('0x2f')][_0x2fb9('0x3a')]){_0x142751[_0x2fb9('0x38')]=_[_0x2fb9('0x3b')](_0x142751[_0x2fb9('0x38')],{'$or':_[_0x2fb9('0x26')](_0x5c0044,function(_0x4f2cac){if(_0x4f2cac[_0x2fb9('0x2a')]!==_0x2fb9('0x3c')){var _0x27061e={};_0x27061e[_0x4f2cac[_0x2fb9('0x2d')]]={'$like':'%'+_0x56ffea['query'][_0x2fb9('0x3a')]+'%'};return _0x27061e;}})});}_0x142751=_[_0x2fb9('0x3b')]({},_0x142751,_0x56ffea[_0x2fb9('0x3d')]);var _0x5be36d={'where':_0x142751[_0x2fb9('0x38')]};return db[_0x2fb9('0x27')]['count'](_0x5be36d)[_0x2fb9('0x21')](function(_0x552843){_0x436d03['count']=_0x552843;if(_0x56ffea[_0x2fb9('0x2f')][_0x2fb9('0x3e')]){_0x142751[_0x2fb9('0x3f')]=[{'all':!![]}];}return db[_0x2fb9('0x27')]['findAll'](_0x142751);})['then'](function(_0x312639){_0x436d03[_0x2fb9('0x40')]=_0x312639;return _0x436d03;})[_0x2fb9('0x21')](respondWithFilteredResult(_0x283793,_0x142751))['catch'](handleError(_0x283793,null));};exports[_0x2fb9('0x41')]=function(_0x21ee94,_0x2311b7){var _0x3383ac={'raw':![],'where':{'id':_0x21ee94[_0x2fb9('0x42')]['id']}},_0x64789a={};_0x64789a[_0x2fb9('0x2c')]=_[_0x2fb9('0x2e')](db['ServicenowAccount'][_0x2fb9('0x28')]);_0x64789a[_0x2fb9('0x2f')]=_['keys'](_0x21ee94['query']);_0x64789a[_0x2fb9('0x30')]=_[_0x2fb9('0x31')](_0x64789a[_0x2fb9('0x2c')],_0x64789a[_0x2fb9('0x2f')]);_0x3383ac[_0x2fb9('0x32')]=_[_0x2fb9('0x31')](_0x64789a[_0x2fb9('0x2c')],qs[_0x2fb9('0x33')](_0x21ee94[_0x2fb9('0x2f')][_0x2fb9('0x33')]));_0x3383ac[_0x2fb9('0x32')]=_0x3383ac[_0x2fb9('0x32')]['length']?_0x3383ac[_0x2fb9('0x32')]:_0x64789a['model'];if(_0x21ee94[_0x2fb9('0x2f')][_0x2fb9('0x3e')]){_0x3383ac['include']=[{'all':!![]}];}_0x3383ac=_[_0x2fb9('0x3b')]({},_0x3383ac,_0x21ee94[_0x2fb9('0x3d')]);return db[_0x2fb9('0x27')][_0x2fb9('0x43')](_0x3383ac)[_0x2fb9('0x21')](handleEntityNotFound(_0x2311b7,null))[_0x2fb9('0x21')](respondWithResult(_0x2311b7,null))['catch'](handleError(_0x2311b7,null));};exports[_0x2fb9('0x44')]=function(_0x5c6fb4,_0xde9848){return db[_0x2fb9('0x27')][_0x2fb9('0x44')](_0x5c6fb4[_0x2fb9('0x45')],{})[_0x2fb9('0x21')](respondWithResult(_0xde9848,0xc9))[_0x2fb9('0x46')](handleError(_0xde9848,null));};exports[_0x2fb9('0x47')]=function(_0x13b7a4,_0x5f184a){if(_0x13b7a4['body']['id']){delete _0x13b7a4[_0x2fb9('0x45')]['id'];}return db['ServicenowAccount'][_0x2fb9('0x43')]({'where':{'id':_0x13b7a4[_0x2fb9('0x42')]['id']}})[_0x2fb9('0x21')](handleEntityNotFound(_0x5f184a,null))[_0x2fb9('0x21')](saveUpdates(_0x13b7a4['body'],null))[_0x2fb9('0x21')](respondWithResult(_0x5f184a,null))[_0x2fb9('0x46')](handleError(_0x5f184a,null));};exports[_0x2fb9('0x22')]=function(_0x128bf8,_0x2a15d9){return db[_0x2fb9('0x27')][_0x2fb9('0x43')]({'where':{'id':_0x128bf8[_0x2fb9('0x42')]['id']}})[_0x2fb9('0x21')](handleEntityNotFound(_0x2a15d9,null))[_0x2fb9('0x21')](removeEntity(_0x2a15d9,null))['catch'](handleError(_0x2a15d9,null));};exports[_0x2fb9('0x48')]=function(_0x265210,_0x5e2aee,_0x56316f){var _0xae5d68={};var _0x566ced={};var _0xc4853a;var _0x41a0bf;return db['ServicenowAccount'][_0x2fb9('0x49')]({'where':{'id':_0x265210['params']['id']}})[_0x2fb9('0x21')](handleEntityNotFound(_0x5e2aee,null))['then'](function(_0x267d38){if(_0x267d38){_0xc4853a=_0x267d38;_0x566ced[_0x2fb9('0x2c')]=_[_0x2fb9('0x2e')](db[_0x2fb9('0x4a')][_0x2fb9('0x28')]);_0x566ced['query']=_[_0x2fb9('0x2e')](_0x265210[_0x2fb9('0x2f')]);_0x566ced[_0x2fb9('0x30')]=_['intersection'](_0x566ced[_0x2fb9('0x2c')],_0x566ced['query']);_0xae5d68[_0x2fb9('0x32')]=_[_0x2fb9('0x31')](_0x566ced['model'],qs[_0x2fb9('0x33')](_0x265210[_0x2fb9('0x2f')][_0x2fb9('0x33')]));_0xae5d68[_0x2fb9('0x32')]=_0xae5d68['attributes']['length']?_0xae5d68[_0x2fb9('0x32')]:_0x566ced['model'];_0xae5d68[_0x2fb9('0x4b')]=qs[_0x2fb9('0x37')](_0x265210['query'][_0x2fb9('0x37')]);_0xae5d68[_0x2fb9('0x38')]=qs['filters'](_[_0x2fb9('0x39')](_0x265210[_0x2fb9('0x2f')],_0x566ced[_0x2fb9('0x30')]));if(_0x265210['query']['filter']){_0xae5d68['where']=_[_0x2fb9('0x3b')](_0xae5d68[_0x2fb9('0x38')],{'$or':_[_0x2fb9('0x26')](_0xae5d68[_0x2fb9('0x32')],function(_0x117b25){var _0x547d64={};_0x547d64[_0x117b25]={'$like':'%'+_0x265210[_0x2fb9('0x2f')][_0x2fb9('0x3a')]+'%'};return _0x547d64;})});}_0xae5d68=_['merge']({},_0xae5d68,_0x265210[_0x2fb9('0x3d')]);return _0xc4853a['getConfigurations'](_0xae5d68);}})[_0x2fb9('0x21')](function(_0x455edc){if(_0x455edc){_0x41a0bf=_0x455edc[_0x2fb9('0x4c')];if(!_0x265210[_0x2fb9('0x2f')][_0x2fb9('0x34')]('nolimit')){_0xae5d68['limit']=qs[_0x2fb9('0x36')](_0x265210[_0x2fb9('0x2f')][_0x2fb9('0x36')]);_0xae5d68[_0x2fb9('0x19')]=qs[_0x2fb9('0x19')](_0x265210[_0x2fb9('0x2f')]['offset']);}return _0xc4853a[_0x2fb9('0x48')](_0xae5d68);}})[_0x2fb9('0x21')](function(_0x2ddd9b){if(_0x2ddd9b){return _0x2ddd9b?{'count':_0x41a0bf,'rows':_0x2ddd9b}:null;}})[_0x2fb9('0x21')](respondWithResult(_0x5e2aee,null))[_0x2fb9('0x46')](handleError(_0x5e2aee,null));};exports[_0x2fb9('0x4d')]=function(_0x2d345e,_0x3ecb42,_0x1b520e){if(_0x2d345e[_0x2fb9('0x45')]['id']){delete _0x2d345e[_0x2fb9('0x45')]['id'];}return db[_0x2fb9('0x27')][_0x2fb9('0x49')]({'where':{'id':_0x2d345e['params']['id']}})[_0x2fb9('0x21')](handleEntityNotFound(_0x3ecb42,null))['then'](function(_0x35e5c3){if(_0x35e5c3){_0x2d345e['body'][_0x2fb9('0x4e')]=_0x35e5c3['id'];_0x2d345e[_0x2fb9('0x45')][_0x2fb9('0x4f')]=integrations[_0x2fb9('0x50')](_0x2d345e[_0x2fb9('0x45')][_0x2fb9('0x51')],_0x2d345e[_0x2fb9('0x45')]['type']);_0x2d345e['body'][_0x2fb9('0x52')]=integrations['getDescriptions'](_0x2d345e['body'][_0x2fb9('0x51')],_0x2d345e[_0x2fb9('0x45')]['type']);return db[_0x2fb9('0x4a')]['create'](_0x2d345e['body'],{'include':[{'model':db[_0x2fb9('0x53')],'as':'Subjects'},{'model':db[_0x2fb9('0x53')],'as':_0x2fb9('0x52')}]});}return null;})['then'](respondWithResult(_0x3ecb42,null))[_0x2fb9('0x46')](handleError(_0x3ecb42,null));};exports[_0x2fb9('0x54')]=function(_0x25b57d,_0x2f05d3,_0x4e74b5){var _0x469558=[_0x2fb9('0x55'),_0x2fb9('0x56'),_0x2fb9('0x57'),_0x2fb9('0x58'),_0x2fb9('0x59'),_0x2fb9('0x5a'),'incident_state',_0x2fb9('0x5b'),_0x2fb9('0x5c')];var _0x245f87=[_0x2fb9('0x5d'),_0x2fb9('0x55'),'caused_by',_0x2fb9('0x5e'),'upon_reject',_0x2fb9('0x5f'),_0x2fb9('0x60'),_0x2fb9('0x56'),_0x2fb9('0x61'),_0x2fb9('0x62'),_0x2fb9('0x63'),_0x2fb9('0x64'),'opened_by','user_input','sys_created_on',_0x2fb9('0x65'),_0x2fb9('0x66'),_0x2fb9('0x67'),_0x2fb9('0x57'),'order',_0x2fb9('0x68'),'closed_at',_0x2fb9('0x69'),_0x2fb9('0x6a'),_0x2fb9('0x6b'),'active',_0x2fb9('0x6c'),_0x2fb9('0x6d'),_0x2fb9('0x6e'),'sys_domain_path',_0x2fb9('0x6f'),'time_worked',_0x2fb9('0x70'),_0x2fb9('0x71'),'business_duration',_0x2fb9('0x72'),_0x2fb9('0x73'),_0x2fb9('0x74'),_0x2fb9('0x75'),'caller_id',_0x2fb9('0x76'),_0x2fb9('0x58'),'work_notes',_0x2fb9('0x77'),_0x2fb9('0x59'),_0x2fb9('0x78'),_0x2fb9('0x79'),_0x2fb9('0x7a'),_0x2fb9('0x7b'),_0x2fb9('0x7c'),_0x2fb9('0x7d'),_0x2fb9('0x7e'),'calendar_duration',_0x2fb9('0x5a'),_0x2fb9('0x7f'),_0x2fb9('0x80'),_0x2fb9('0x81'),_0x2fb9('0x82'),_0x2fb9('0x83'),_0x2fb9('0x84'),_0x2fb9('0x85'),_0x2fb9('0x86'),_0x2fb9('0x87'),_0x2fb9('0x88'),_0x2fb9('0x89'),_0x2fb9('0x8a'),_0x2fb9('0x8b'),'activity_due',_0x2fb9('0x8c'),_0x2fb9('0x5b'),_0x2fb9('0x8d'),_0x2fb9('0x8e'),'approval',_0x2fb9('0x8f'),'due_date',_0x2fb9('0x90'),'reopen_count','sys_tags',_0x2fb9('0x91'),'upon_approval',_0x2fb9('0x92'),'location',_0x2fb9('0x5c')];var _0x3a422b='';var _0x552993='';var _0x14c4b0=[];var _0xab96f0='';var _0x4f5840='';var _0x55ed80=[];var _0x392e11='';var _0x5bd918='';var _0x33a962={};var _0x559eac='';return db[_0x2fb9('0x27')][_0x2fb9('0x49')]({'where':{'id':_0x25b57d[_0x2fb9('0x42')]['id']},'attributes':['id',_0x2fb9('0x93'),_0x2fb9('0x94'),_0x2fb9('0x95'),'remoteUri',_0x2fb9('0x96')]})[_0x2fb9('0x21')](handleEntityNotFound(_0x2f05d3,null))[_0x2fb9('0x21')](function(_0x3985cb){if(_0x3985cb){_0x559eac=_0x3985cb[_0x2fb9('0x97')];var _0x3adf32=_0x559eac[_0x2fb9('0x98')](-0x1);if(_0x3adf32==='/'){_0x559eac=_0x559eac['substring'](0x0,_0x559eac['lastIndexOf'](_0x3adf32));}_0x5bd918=util[_0x2fb9('0x99')](_0x2fb9('0x9a'),_0x559eac);_0x392e11=util[_0x2fb9('0x99')]('%s/api/now/table/',_0x559eac);_0x33a962={'user':_0x3985cb['username'],'pass':_0x3985cb[_0x2fb9('0x94')]};var _0x15bbd9={'method':_0x2fb9('0x9b'),'uri':_0x5bd918+_0x2fb9('0x9c'),'auth':_0x33a962,'json':!![]};return rp(_0x15bbd9);}})[_0x2fb9('0x21')](function(_0x31a597){if(_0x31a597[_0x2fb9('0x9d')][_0x2fb9('0x4c')]>0x0){_0x3a422b=_0x31a597['result'];}console['log'](_0x2fb9('0x9e'),_0x3a422b);_0x55ed80=[];_0x552993=Object[_0x2fb9('0x9f')]([],_0x3a422b);_['remove'](_0x552993,function(_0x35f74a){return!_0x469558[_0x2fb9('0xa0')](_0x35f74a['name']);});_0x552993[_0x2fb9('0xa1')](function(_0x38a876){var _0x1ea634=createFieldObject(_0x392e11,_0x33a962,_0x38a876['internalType'],_0x38a876[_0x2fb9('0x2d')],_0x38a876[_0x2fb9('0xa2')],![]);_0x55ed80[_0x2fb9('0xa3')](_0x1ea634);});return Promise[_0x2fb9('0xa4')](_0x55ed80);})['then'](function(_0x2b56d0){_0x14c4b0=_0x2b56d0;_0xab96f0=Object[_0x2fb9('0x9f')]([],_0x3a422b);console[_0x2fb9('0xa5')](_0x2fb9('0xa6'),_0x3a422b);_[_0x2fb9('0xa7')](_0xab96f0,function(_0x4c0ac1){return _0x245f87[_0x2fb9('0xa0')](_0x4c0ac1[_0x2fb9('0x2d')]);});console[_0x2fb9('0xa5')](_0x2fb9('0xa8'),_0xab96f0);_0x55ed80=[];_0xab96f0[_0x2fb9('0xa1')](function(_0x570777){var _0x170e18=createFieldObject(_0x392e11,_0x33a962,_0x570777['internalType'],_0x570777[_0x2fb9('0x2d')],_0x570777[_0x2fb9('0xa2')],!![]);_0x55ed80[_0x2fb9('0xa3')](_0x170e18);});return Promise[_0x2fb9('0xa4')](_0x55ed80);})['then'](function(_0x25a86a){_0x4f5840=_0x25a86a;var _0x2e1a7a=_0x14c4b0['concat'](_0x4f5840);return{'count':_0x2e1a7a[_0x2fb9('0x4c')],'rows':_0x2e1a7a};})[_0x2fb9('0x21')](respondWithResult(_0x2f05d3,null))['catch'](function(_0x49e6e4){console[_0x2fb9('0xa5')](_0x2fb9('0xa9')+_0x49e6e4);var _0x1da1a6=_0x25b57d[_0x2fb9('0x2f')]['test']?0x1f4:_0x49e6e4[_0x2fb9('0xaa')]||0x1f4;logger[_0x2fb9('0x24')](_0x49e6e4['stack']);delete _0x49e6e4[_0x2fb9('0x2d')];if(_0x1da1a6===0x191){_0x1da1a6=0x190;}_0x2f05d3[_0x2fb9('0x17')](_0x1da1a6)[_0x2fb9('0x25')](_0x25b57d[_0x2fb9('0x2f')][_0x2fb9('0xab')]?{'message':_0x2fb9('0xac'),'statusCode':_0x49e6e4[_0x2fb9('0xaa')]}:_0x49e6e4);});};function createFieldObject(_0x5329fe,_0x1a2c93,_0x337474,_0xdf7f23,_0x33b135,_0x345fd6){return new Promise(function(_0x404481,_0x416995){var _0x527c25={'id':_0xdf7f23,'name':_0x33b135,'custom':_0x345fd6};if(_0x337474===_0x2fb9('0xad')){_0x527c25[_0x2fb9('0x3d')]=[{'name':_0x2fb9('0xae'),'value':_0x2fb9('0xaf')},{'name':'False','value':_0x2fb9('0xb0')}];_0x404481(_0x527c25);}else{var _0x2546be={'method':'GET','uri':_0x5329fe+_0x2fb9('0xb1')+_0xdf7f23,'auth':_0x1a2c93,'json':!![]};return rp(_0x2546be)[_0x2fb9('0x21')](function(_0xf1db22){var _0x349758=[];if(_0xf1db22['result'][_0x2fb9('0x4c')]>0x0){_0xf1db22['result'][_0x2fb9('0xa1')](function(_0x41db65){if(_0x41db65[_0x2fb9('0xb2')]===_0x2fb9('0xb0')){var _0xbd190b={'name':_0x41db65[_0x2fb9('0xa2')],'value':_0x41db65[_0x2fb9('0xb3')]};_0x349758[_0x2fb9('0xa3')](_0xbd190b);}});}_0x527c25[_0x2fb9('0x3d')]=_0x349758;if(_0x527c25[_0x2fb9('0x3d')][_0x2fb9('0x4c')]>0x0){_0x404481(_0x527c25);}else{if(_0x345fd6==![]){_0x404481();}else{_0x404481(_0x527c25);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7d2f951..dde7cb6 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x4c8e4f,_0x397749){var _0x125abf=function(_0x10ab66){while(--_0x10ab66){_0x4c8e4f['push'](_0x4c8e4f['shift']());}};_0x125abf(++_0x397749);}(_0x7217,0x19e));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x4bf671,_0x5ee852){var _0x5dc289=function(_0x39e7b3){while(--_0x39e7b3){_0x4bf671['push'](_0x4bf671['shift']());}};_0x5dc289(++_0x5ee852);}(_0x038b,0x114));var _0xb038=function(_0x469233,_0x138817){_0x469233=_0x469233-0x0;var _0x10210b=_0x038b[_0x469233];return _0x10210b;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','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 ae78547..5ebcfff 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 _0x2ea0=['code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error'];(function(_0x468e6c,_0x5e150b){var _0x54c64b=function(_0x44559f){while(--_0x44559f){_0x468e6c['push'](_0x468e6c['shift']());}};_0x54c64b(++_0x5e150b);}(_0x2ea0,0xe4));var _0x02ea=function(_0x454db7,_0x19898f){_0x454db7=_0x454db7-0x0;var _0x520d54=_0x2ea0[_0x454db7];return _0x520d54;};'use strict';var _=require('lodash');var util=require(_0x02ea('0x0'));var moment=require('moment');var BPromise=require(_0x02ea('0x1'));var rs=require(_0x02ea('0x2'));var fs=require('fs');var Redis=require(_0x02ea('0x3'));var db=require(_0x02ea('0x4'))['db'];var utils=require(_0x02ea('0x5'));var logger=require(_0x02ea('0x6'))(_0x02ea('0x7'));var config=require(_0x02ea('0x8'));var jayson=require(_0x02ea('0x9'));var client=jayson[_0x02ea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45cdbc,_0x961d3f,_0x1d56b3){return new BPromise(function(_0x41641c,_0x55c9c6){return client[_0x02ea('0xb')](_0x45cdbc,_0x1d56b3)[_0x02ea('0xc')](function(_0x151fff){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x961d3f,_0x02ea('0xd'));logger[_0x02ea('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x961d3f,_0x02ea('0xd'),JSON[_0x02ea('0xf')](_0x151fff));if(_0x151fff['error']){if(_0x151fff[_0x02ea('0x10')][_0x02ea('0x11')]===0x1f4){logger[_0x02ea('0x10')](_0x02ea('0x12'),_0x961d3f,_0x151fff[_0x02ea('0x10')]['message']);return _0x55c9c6(_0x151fff[_0x02ea('0x10')][_0x02ea('0x13')]);}logger[_0x02ea('0x10')](_0x02ea('0x12'),_0x961d3f,_0x151fff[_0x02ea('0x10')][_0x02ea('0x13')]);return _0x41641c(_0x151fff['error'][_0x02ea('0x13')]);}else{logger[_0x02ea('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x961d3f,'request\x20sent');_0x41641c(_0x151fff[_0x02ea('0x15')][_0x02ea('0x13')]);}})[_0x02ea('0x16')](function(_0x251957){logger[_0x02ea('0x10')](_0x02ea('0x12'),_0x961d3f,_0x251957);_0x55c9c6(_0x251957);});});}exports[_0x02ea('0x17')]=function(_0x47fb0e){var _0x16bbaf=this;return new Promise(function(_0x527d0b,_0x3d13a2){return db[_0x02ea('0x18')]['findAll']({'raw':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e['options'][_0x02ea('0x1a')]===undefined?!![]:![]:!![],'where':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e['options'][_0x02ea('0x1b')]||null:null,'attributes':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e['options'][_0x02ea('0x1c')]||null:null,'limit':_0x47fb0e['options']?_0x47fb0e['options'][_0x02ea('0x1d')]||null:null,'include':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e[_0x02ea('0x19')][_0x02ea('0x1e')]?_['map'](_0x47fb0e[_0x02ea('0x19')]['include'],function(_0x5f0d29){return{'model':db[_0x5f0d29[_0x02ea('0x1f')]],'as':_0x5f0d29['as'],'attributes':_0x5f0d29[_0x02ea('0x1c')],'include':_0x5f0d29[_0x02ea('0x1e')]?_[_0x02ea('0x20')](_0x5f0d29[_0x02ea('0x1e')],function(_0x53fbe1){return{'model':db[_0x53fbe1[_0x02ea('0x1f')]],'as':_0x53fbe1['as'],'attributes':_0x53fbe1[_0x02ea('0x1c')],'include':_0x53fbe1['include']?_['map'](_0x53fbe1[_0x02ea('0x1e')],function(_0x357bdd){return{'model':db[_0x357bdd['model']],'as':_0x357bdd['as'],'attributes':_0x357bdd[_0x02ea('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e9f3b){logger[_0x02ea('0x14')](_0x02ea('0x17'),_0x47fb0e);logger['debug'](_0x02ea('0x17'),_0x47fb0e,JSON[_0x02ea('0xf')](_0x2e9f3b));_0x527d0b(_0x2e9f3b);})[_0x02ea('0x16')](function(_0x1004a1){logger['error']('GetServicenowAccount',_0x1004a1[_0x02ea('0x13')],_0x47fb0e);_0x3d13a2(_0x16bbaf[_0x02ea('0x10')](0x1f4,_0x1004a1[_0x02ea('0x13')]));});});};exports[_0x02ea('0x21')]=function(_0x38bec9){var _0x5a1df8=this;return new Promise(function(_0x1e319a,_0x259408){return db[_0x02ea('0x18')][_0x02ea('0x22')]({'raw':_0x38bec9['options']?_0x38bec9[_0x02ea('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38bec9[_0x02ea('0x19')]?_0x38bec9[_0x02ea('0x19')][_0x02ea('0x1b')]||null:null,'attributes':_0x38bec9[_0x02ea('0x19')]?_0x38bec9[_0x02ea('0x19')]['attributes']||null:null,'include':_0x38bec9[_0x02ea('0x19')]?_0x38bec9[_0x02ea('0x19')][_0x02ea('0x1e')]?_[_0x02ea('0x20')](_0x38bec9['options']['include'],function(_0x4ef7d3){return{'model':db[_0x4ef7d3[_0x02ea('0x1f')]],'as':_0x4ef7d3['as'],'attributes':_0x4ef7d3[_0x02ea('0x1c')],'include':_0x4ef7d3[_0x02ea('0x1e')]?_[_0x02ea('0x20')](_0x4ef7d3['include'],function(_0x1ea2ee){return{'model':db[_0x1ea2ee[_0x02ea('0x1f')]],'as':_0x1ea2ee['as'],'attributes':_0x1ea2ee[_0x02ea('0x1c')],'include':_0x1ea2ee['include']?_[_0x02ea('0x20')](_0x1ea2ee[_0x02ea('0x1e')],function(_0xa44925){return{'model':db[_0xa44925[_0x02ea('0x1f')]],'as':_0xa44925['as'],'attributes':_0xa44925[_0x02ea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x02ea('0xc')](function(_0x8271b1){logger[_0x02ea('0x14')](_0x02ea('0x21'),_0x38bec9);logger[_0x02ea('0xe')](_0x02ea('0x21'),_0x38bec9,JSON[_0x02ea('0xf')](_0x8271b1));_0x1e319a(_0x8271b1);})[_0x02ea('0x16')](function(_0x4df351){logger[_0x02ea('0x10')](_0x02ea('0x21'),_0x4df351[_0x02ea('0x13')],_0x38bec9);_0x259408(_0x5a1df8[_0x02ea('0x10')](0x1f4,_0x4df351[_0x02ea('0x13')]));});});}; \ No newline at end of file +var _0x0b78=['find','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0b78,0x86));var _0x80b7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0b78[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x80b7('0x0'));var moment=require(_0x80b7('0x1'));var BPromise=require('bluebird');var rs=require(_0x80b7('0x2'));var fs=require('fs');var Redis=require(_0x80b7('0x3'));var db=require(_0x80b7('0x4'))['db'];var utils=require(_0x80b7('0x5'));var logger=require(_0x80b7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x80b7('0x7'));var client=jayson[_0x80b7('0x8')][_0x80b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x556e53,_0x5de009,_0x290295){return new BPromise(function(_0x34e226,_0xffb3f0){return client['request'](_0x556e53,_0x290295)['then'](function(_0x3a57a1){logger[_0x80b7('0xa')](_0x80b7('0xb'),_0x5de009,_0x80b7('0xc'));logger[_0x80b7('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5de009,_0x80b7('0xc'),JSON[_0x80b7('0xe')](_0x3a57a1));if(_0x3a57a1[_0x80b7('0xf')]){if(_0x3a57a1[_0x80b7('0xf')][_0x80b7('0x10')]===0x1f4){logger[_0x80b7('0xf')](_0x80b7('0xb'),_0x5de009,_0x3a57a1[_0x80b7('0xf')][_0x80b7('0x11')]);return _0xffb3f0(_0x3a57a1[_0x80b7('0xf')]['message']);}logger[_0x80b7('0xf')](_0x80b7('0xb'),_0x5de009,_0x3a57a1[_0x80b7('0xf')][_0x80b7('0x11')]);return _0x34e226(_0x3a57a1[_0x80b7('0xf')][_0x80b7('0x11')]);}else{logger['info'](_0x80b7('0xb'),_0x5de009,_0x80b7('0xc'));_0x34e226(_0x3a57a1['result'][_0x80b7('0x11')]);}})[_0x80b7('0x12')](function(_0x2458d5){logger[_0x80b7('0xf')](_0x80b7('0xb'),_0x5de009,_0x2458d5);_0xffb3f0(_0x2458d5);});});}exports[_0x80b7('0x13')]=function(_0x14d86d){var _0xef43d0=this;return new Promise(function(_0x34c92f,_0x5c97ae){return db[_0x80b7('0x14')][_0x80b7('0x15')]({'raw':_0x14d86d[_0x80b7('0x16')]?_0x14d86d['options'][_0x80b7('0x17')]===undefined?!![]:![]:!![],'where':_0x14d86d[_0x80b7('0x16')]?_0x14d86d['options'][_0x80b7('0x18')]||null:null,'attributes':_0x14d86d[_0x80b7('0x16')]?_0x14d86d[_0x80b7('0x16')][_0x80b7('0x19')]||null:null,'limit':_0x14d86d['options']?_0x14d86d[_0x80b7('0x16')][_0x80b7('0x1a')]||null:null,'include':_0x14d86d[_0x80b7('0x16')]?_0x14d86d['options'][_0x80b7('0x1b')]?_[_0x80b7('0x1c')](_0x14d86d[_0x80b7('0x16')][_0x80b7('0x1b')],function(_0x29d9f8){return{'model':db[_0x29d9f8[_0x80b7('0x1d')]],'as':_0x29d9f8['as'],'attributes':_0x29d9f8[_0x80b7('0x19')],'include':_0x29d9f8[_0x80b7('0x1b')]?_[_0x80b7('0x1c')](_0x29d9f8[_0x80b7('0x1b')],function(_0x5bbdb4){return{'model':db[_0x5bbdb4[_0x80b7('0x1d')]],'as':_0x5bbdb4['as'],'attributes':_0x5bbdb4[_0x80b7('0x19')],'include':_0x5bbdb4[_0x80b7('0x1b')]?_[_0x80b7('0x1c')](_0x5bbdb4['include'],function(_0x308bb9){return{'model':db[_0x308bb9[_0x80b7('0x1d')]],'as':_0x308bb9['as'],'attributes':_0x308bb9[_0x80b7('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc3ddfe){logger[_0x80b7('0xa')](_0x80b7('0x13'),_0x14d86d);logger['debug']('GetServicenowAccount',_0x14d86d,JSON[_0x80b7('0xe')](_0xc3ddfe));_0x34c92f(_0xc3ddfe);})[_0x80b7('0x12')](function(_0x3e4aa9){logger[_0x80b7('0xf')](_0x80b7('0x13'),_0x3e4aa9[_0x80b7('0x11')],_0x14d86d);_0x5c97ae(_0xef43d0[_0x80b7('0xf')](0x1f4,_0x3e4aa9[_0x80b7('0x11')]));});});};exports[_0x80b7('0x1e')]=function(_0x140434){var _0x2bcd41=this;return new Promise(function(_0x1e4b2b,_0x228022){return db[_0x80b7('0x14')][_0x80b7('0x1f')]({'raw':_0x140434[_0x80b7('0x16')]?_0x140434[_0x80b7('0x16')][_0x80b7('0x17')]===undefined?!![]:![]:!![],'where':_0x140434[_0x80b7('0x16')]?_0x140434[_0x80b7('0x16')][_0x80b7('0x18')]||null:null,'attributes':_0x140434[_0x80b7('0x16')]?_0x140434[_0x80b7('0x16')]['attributes']||null:null,'include':_0x140434[_0x80b7('0x16')]?_0x140434[_0x80b7('0x16')][_0x80b7('0x1b')]?_['map'](_0x140434[_0x80b7('0x16')][_0x80b7('0x1b')],function(_0xb2c3c3){return{'model':db[_0xb2c3c3[_0x80b7('0x1d')]],'as':_0xb2c3c3['as'],'attributes':_0xb2c3c3[_0x80b7('0x19')],'include':_0xb2c3c3['include']?_['map'](_0xb2c3c3[_0x80b7('0x1b')],function(_0x183165){return{'model':db[_0x183165[_0x80b7('0x1d')]],'as':_0x183165['as'],'attributes':_0x183165[_0x80b7('0x19')],'include':_0x183165[_0x80b7('0x1b')]?_[_0x80b7('0x1c')](_0x183165['include'],function(_0x1dfad1){return{'model':db[_0x1dfad1[_0x80b7('0x1d')]],'as':_0x1dfad1['as'],'attributes':_0x1dfad1[_0x80b7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x80b7('0x20')](function(_0x57e7d1){logger[_0x80b7('0xa')]('ShowServicenowAccount',_0x140434);logger[_0x80b7('0xd')](_0x80b7('0x1e'),_0x140434,JSON[_0x80b7('0xe')](_0x57e7d1));_0x1e4b2b(_0x57e7d1);})[_0x80b7('0x12')](function(_0x4055ec){logger[_0x80b7('0xf')]('ShowServicenowAccount',_0x4055ec[_0x80b7('0x11')],_0x140434);_0x228022(_0x2bcd41[_0x80b7('0xf')](0x1f4,_0x4055ec[_0x80b7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 37b2fcf..6381f83 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 _0xb83b=['/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x261021,_0x3bff86){var _0x556374=function(_0x3990a7){while(--_0x3990a7){_0x261021['push'](_0x261021['shift']());}};_0x556374(++_0x3bff86);}(_0xb83b,0x178));var _0xbb83=function(_0xe30e59,_0x2d7005){_0xe30e59=_0xe30e59-0x0;var _0x5021d4=_0xb83b[_0xe30e59];return _0x5021d4;};'use strict';var multer=require(_0xbb83('0x0'));var util=require(_0xbb83('0x1'));var path=require(_0xbb83('0x2'));var timeout=require(_0xbb83('0x3'));var express=require(_0xbb83('0x4'));var router=express[_0xbb83('0x5')]();var fs_extra=require(_0xbb83('0x6'));var auth=require(_0xbb83('0x7'));var interaction=require(_0xbb83('0x8'));var config=require(_0xbb83('0x9'));var controller=require(_0xbb83('0xa'));router[_0xbb83('0xb')]('/',auth[_0xbb83('0xc')](),controller[_0xbb83('0xd')]);router['get'](_0xbb83('0xe'),auth[_0xbb83('0xc')](),controller[_0xbb83('0xf')]);router[_0xbb83('0xb')]('/:id/fields',auth[_0xbb83('0xc')](),controller[_0xbb83('0x10')]);router['get'](_0xbb83('0x11'),auth['isAuthenticated'](),controller[_0xbb83('0x12')]);router[_0xbb83('0xb')](_0xbb83('0x13'),auth[_0xbb83('0xc')](),controller[_0xbb83('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb83('0x15')]);router[_0xbb83('0x16')](_0xbb83('0xe'),auth[_0xbb83('0xc')](),controller['update']);router[_0xbb83('0x17')](_0xbb83('0xe'),auth[_0xbb83('0xc')](),controller[_0xbb83('0x18')]);module[_0xbb83('0x19')]=router; \ No newline at end of file +var _0xe03d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5f48dd,_0x2f1024){var _0x5ef353=function(_0x5597ae){while(--_0x5597ae){_0x5f48dd['push'](_0x5f48dd['shift']());}};_0x5ef353(++_0x2f1024);}(_0xe03d,0x168));var _0xde03=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xe03d[_0x4f83ca];return _0x1fbac3;};'use strict';var multer=require(_0xde03('0x0'));var util=require(_0xde03('0x1'));var path=require(_0xde03('0x2'));var timeout=require(_0xde03('0x3'));var express=require(_0xde03('0x4'));var router=express[_0xde03('0x5')]();var fs_extra=require(_0xde03('0x6'));var auth=require(_0xde03('0x7'));var interaction=require(_0xde03('0x8'));var config=require(_0xde03('0x9'));var controller=require('./intServicenowConfiguration.controller');router[_0xde03('0xa')]('/',auth[_0xde03('0xb')](),controller[_0xde03('0xc')]);router[_0xde03('0xa')]('/:id',auth[_0xde03('0xb')](),controller[_0xde03('0xd')]);router[_0xde03('0xa')](_0xde03('0xe'),auth[_0xde03('0xb')](),controller[_0xde03('0xf')]);router['get'](_0xde03('0x10'),auth[_0xde03('0xb')](),controller[_0xde03('0x11')]);router[_0xde03('0xa')]('/:id/descriptions',auth[_0xde03('0xb')](),controller[_0xde03('0x12')]);router[_0xde03('0x13')]('/',auth[_0xde03('0xb')](),controller[_0xde03('0x14')]);router[_0xde03('0x15')](_0xde03('0x16'),auth[_0xde03('0xb')](),controller['update']);router[_0xde03('0x17')](_0xde03('0x16'),auth[_0xde03('0xb')](),controller[_0xde03('0x18')]);module[_0xde03('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 93305d4..75b6e9e 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 _0x7290=['exports','STRING','sequelize'];(function(_0x55cf47,_0x3d037b){var _0x42bf2b=function(_0x2edd84){while(--_0x2edd84){_0x55cf47['push'](_0x55cf47['shift']());}};_0x42bf2b(++_0x3d037b);}(_0x7290,0xda));var _0x0729=function(_0x3b6d58,_0xb29c70){_0x3b6d58=_0x3b6d58-0x0;var _0x64d7dc=_0x7290[_0x3b6d58];return _0x64d7dc;};'use strict';var Sequelize=require(_0x0729('0x0'));module[_0x0729('0x1')]={'name':{'type':Sequelize[_0x0729('0x2')]},'description':{'type':Sequelize[_0x0729('0x2')]}}; \ No newline at end of file +var _0x6a84=['sequelize','exports','STRING'];(function(_0x299d4,_0x3e2ba6){var _0x38688c=function(_0x26c98f){while(--_0x26c98f){_0x299d4['push'](_0x299d4['shift']());}};_0x38688c(++_0x3e2ba6);}(_0x6a84,0x135));var _0x46a8=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x6a84[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x46a8('0x0'));module[_0x46a8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x46a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a94f8d1..5b1d9fa 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 _0xaa78=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','getFields','sort','getSubjects','findOne','ServicenowField','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4565eb,_0x167f79){var _0x67832=function(_0x5322ff){while(--_0x5322ff){_0x4565eb['push'](_0x4565eb['shift']());}};_0x67832(++_0x167f79);}(_0xaa78,0x186));var _0x8aa7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xaa78[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0x8aa7('0x0'));var rimraf=require(_0x8aa7('0x1'));var zipdir=require(_0x8aa7('0x2'));var jsonpatch=require(_0x8aa7('0x3'));var rp=require(_0x8aa7('0x4'));var moment=require(_0x8aa7('0x5'));var BPromise=require(_0x8aa7('0x6'));var Mustache=require(_0x8aa7('0x7'));var util=require(_0x8aa7('0x8'));var path=require('path');var sox=require(_0x8aa7('0x9'));var csv=require(_0x8aa7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa7('0xb'));var _=require(_0x8aa7('0xc'));var squel=require(_0x8aa7('0xd'));var crypto=require(_0x8aa7('0xe'));var jsforce=require(_0x8aa7('0xf'));var deskjs=require(_0x8aa7('0x10'));var toCsv=require(_0x8aa7('0xa'));var querystring=require(_0x8aa7('0x11'));var Papa=require(_0x8aa7('0x12'));var Redis=require(_0x8aa7('0x13'));var authService=require(_0x8aa7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8aa7('0x15'));var hardwareService=require(_0x8aa7('0x16'));var logger=require(_0x8aa7('0x17'))('api');var utils=require(_0x8aa7('0x18'));var config=require(_0x8aa7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa7('0x1a'))['db'];function respondWithStatusCode(_0x2fd807,_0x4ea65c){_0x4ea65c=_0x4ea65c||0xcc;return function(_0x42ac92){if(_0x42ac92){return _0x2fd807[_0x8aa7('0x1b')](_0x4ea65c);}return _0x2fd807[_0x8aa7('0x1c')](_0x4ea65c)[_0x8aa7('0x1d')]();};}function respondWithResult(_0x10b013,_0x3aacf9){_0x3aacf9=_0x3aacf9||0xc8;return function(_0x40e4eb){if(_0x40e4eb){return _0x10b013[_0x8aa7('0x1c')](_0x3aacf9)[_0x8aa7('0x1e')](_0x40e4eb);}};}function respondWithFilteredResult(_0x2dd069,_0xe0230c){return function(_0x19672d){if(_0x19672d){var _0x411269=typeof _0xe0230c[_0x8aa7('0x1f')]===_0x8aa7('0x20')&&typeof _0xe0230c['limit']===_0x8aa7('0x20');var _0x392135=_0x19672d[_0x8aa7('0x21')];var _0xe26163=_0x411269?0x0:_0xe0230c[_0x8aa7('0x1f')];var _0x413433=_0x411269?_0x19672d[_0x8aa7('0x21')]:_0xe0230c[_0x8aa7('0x1f')]+_0xe0230c[_0x8aa7('0x22')];var _0x3b6432;if(_0x413433>=_0x392135){_0x413433=_0x392135;_0x3b6432=0xc8;}else{_0x3b6432=0xce;}_0x2dd069[_0x8aa7('0x1c')](_0x3b6432);return _0x2dd069['set']('Content-Range',_0xe26163+'-'+_0x413433+'/'+_0x392135)[_0x8aa7('0x1e')](_0x19672d);}return null;};}function patchUpdates(_0x1051b5){return function(_0x21008c){try{jsonpatch[_0x8aa7('0x23')](_0x21008c,_0x1051b5,!![]);}catch(_0x37af80){return BPromise[_0x8aa7('0x24')](_0x37af80);}return _0x21008c[_0x8aa7('0x25')]();};}function saveUpdates(_0x4d6eb6,_0x63edbe){return function(_0x5242f0){if(_0x5242f0){return _0x5242f0[_0x8aa7('0x26')](_0x4d6eb6)[_0x8aa7('0x27')](function(_0x2caef6){return _0x2caef6;});}return null;};}function removeEntity(_0x586f9e,_0x1978d8){return function(_0x4d4dd0){if(_0x4d4dd0){return _0x4d4dd0[_0x8aa7('0x28')]()[_0x8aa7('0x27')](function(){_0x586f9e['status'](0xcc)[_0x8aa7('0x1d')]();});}};}function handleEntityNotFound(_0x5012f0,_0x1b5581){return function(_0x58dd07){if(!_0x58dd07){_0x5012f0[_0x8aa7('0x1b')](0x194);}return _0x58dd07;};}function handleError(_0x37f798,_0x500af9){_0x500af9=_0x500af9||0x1f4;return function(_0x1bfa9f){logger['error'](_0x1bfa9f['stack']);if(_0x1bfa9f['name']){delete _0x1bfa9f[_0x8aa7('0x29')];}_0x37f798[_0x8aa7('0x1c')](_0x500af9)[_0x8aa7('0x2a')](_0x1bfa9f);};}exports[_0x8aa7('0x2b')]=function(_0x401373,_0x35dfb0){var _0x3b0eab={},_0x1eb192={},_0x1679bb={'count':0x0,'rows':[]};var _0x26eea6=_['map'](db[_0x8aa7('0x2c')][_0x8aa7('0x2d')],function(_0x458678){return{'name':_0x458678[_0x8aa7('0x2e')],'type':_0x458678[_0x8aa7('0x2f')][_0x8aa7('0x30')]};});_0x1eb192[_0x8aa7('0x31')]=_[_0x8aa7('0x32')](_0x26eea6,_0x8aa7('0x29'));_0x1eb192[_0x8aa7('0x33')]=_['keys'](_0x401373[_0x8aa7('0x33')]);_0x1eb192[_0x8aa7('0x34')]=_[_0x8aa7('0x35')](_0x1eb192[_0x8aa7('0x31')],_0x1eb192['query']);_0x3b0eab['attributes']=_[_0x8aa7('0x35')](_0x1eb192[_0x8aa7('0x31')],qs[_0x8aa7('0x36')](_0x401373[_0x8aa7('0x33')][_0x8aa7('0x36')]));_0x3b0eab[_0x8aa7('0x37')]=_0x3b0eab[_0x8aa7('0x37')][_0x8aa7('0x38')]?_0x3b0eab[_0x8aa7('0x37')]:_0x1eb192['model'];if(!_0x401373[_0x8aa7('0x33')]['hasOwnProperty'](_0x8aa7('0x39'))){_0x3b0eab[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x401373[_0x8aa7('0x33')][_0x8aa7('0x22')]);_0x3b0eab[_0x8aa7('0x1f')]=qs[_0x8aa7('0x1f')](_0x401373[_0x8aa7('0x33')][_0x8aa7('0x1f')]);}_0x3b0eab[_0x8aa7('0x3a')]=qs['sort'](_0x401373[_0x8aa7('0x33')]['sort']);_0x3b0eab[_0x8aa7('0x3b')]=qs['filters'](_[_0x8aa7('0x3c')](_0x401373['query'],_0x1eb192['filters']),_0x26eea6);if(_0x401373[_0x8aa7('0x33')]['filter']){_0x3b0eab[_0x8aa7('0x3b')]=_[_0x8aa7('0x3d')](_0x3b0eab[_0x8aa7('0x3b')],{'$or':_[_0x8aa7('0x32')](_0x26eea6,function(_0x5c541a){if(_0x5c541a[_0x8aa7('0x2f')]!==_0x8aa7('0x3e')){var _0x3924af={};_0x3924af[_0x5c541a[_0x8aa7('0x29')]]={'$like':'%'+_0x401373[_0x8aa7('0x33')][_0x8aa7('0x3f')]+'%'};return _0x3924af;}})});}_0x3b0eab=_[_0x8aa7('0x3d')]({},_0x3b0eab,_0x401373[_0x8aa7('0x40')]);var _0x2facd9={'where':_0x3b0eab[_0x8aa7('0x3b')]};return db[_0x8aa7('0x2c')]['count'](_0x2facd9)['then'](function(_0x3389ae){_0x1679bb['count']=_0x3389ae;if(_0x401373[_0x8aa7('0x33')][_0x8aa7('0x41')]){_0x3b0eab[_0x8aa7('0x42')]=[{'all':!![]}];}return db[_0x8aa7('0x2c')][_0x8aa7('0x43')](_0x3b0eab);})[_0x8aa7('0x27')](function(_0x264894){_0x1679bb[_0x8aa7('0x44')]=_0x264894;return _0x1679bb;})['then'](respondWithFilteredResult(_0x35dfb0,_0x3b0eab))['catch'](handleError(_0x35dfb0,null));};exports[_0x8aa7('0x45')]=function(_0x2570ca,_0x5b38bd){var _0x3a0d89={'raw':![],'where':{'id':_0x2570ca[_0x8aa7('0x46')]['id']}},_0x3d5ab5={};_0x3d5ab5[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db[_0x8aa7('0x2c')][_0x8aa7('0x2d')]);_0x3d5ab5[_0x8aa7('0x33')]=_[_0x8aa7('0x47')](_0x2570ca[_0x8aa7('0x33')]);_0x3d5ab5['filters']=_[_0x8aa7('0x35')](_0x3d5ab5[_0x8aa7('0x31')],_0x3d5ab5[_0x8aa7('0x33')]);_0x3a0d89['attributes']=_[_0x8aa7('0x35')](_0x3d5ab5['model'],qs[_0x8aa7('0x36')](_0x2570ca[_0x8aa7('0x33')]['fields']));_0x3a0d89[_0x8aa7('0x37')]=_0x3a0d89[_0x8aa7('0x37')][_0x8aa7('0x38')]?_0x3a0d89['attributes']:_0x3d5ab5[_0x8aa7('0x31')];if(_0x2570ca[_0x8aa7('0x33')][_0x8aa7('0x41')]){_0x3a0d89[_0x8aa7('0x42')]=[{'all':!![]}];}_0x3a0d89=_[_0x8aa7('0x3d')]({},_0x3a0d89,_0x2570ca['options']);return db['ServicenowConfiguration'][_0x8aa7('0x48')](_0x3a0d89)[_0x8aa7('0x27')](handleEntityNotFound(_0x5b38bd,null))['then'](respondWithResult(_0x5b38bd,null))['catch'](handleError(_0x5b38bd,null));};exports['create']=function(_0x2f65b9,_0x3e04e9){return db['ServicenowConfiguration'][_0x8aa7('0x49')](_0x2f65b9[_0x8aa7('0x4a')],{})[_0x8aa7('0x27')](respondWithResult(_0x3e04e9,0xc9))['catch'](handleError(_0x3e04e9,null));};exports[_0x8aa7('0x26')]=function(_0x34b2ac,_0xb538a0){if(_0x34b2ac[_0x8aa7('0x4a')]['id']){delete _0x34b2ac[_0x8aa7('0x4a')]['id'];}return db[_0x8aa7('0x2c')][_0x8aa7('0x48')]({'where':{'id':_0x34b2ac['params']['id']}})[_0x8aa7('0x27')](handleEntityNotFound(_0xb538a0,null))[_0x8aa7('0x27')](saveUpdates(_0x34b2ac[_0x8aa7('0x4a')],null))[_0x8aa7('0x27')](respondWithResult(_0xb538a0,null))[_0x8aa7('0x4b')](handleError(_0xb538a0,null));};exports[_0x8aa7('0x28')]=function(_0xdfeb1c,_0x4de203){return db['ServicenowConfiguration'][_0x8aa7('0x48')]({'where':{'id':_0xdfeb1c[_0x8aa7('0x46')]['id']}})['then'](handleEntityNotFound(_0x4de203,null))[_0x8aa7('0x27')](removeEntity(_0x4de203,null))[_0x8aa7('0x4b')](handleError(_0x4de203,null));};exports[_0x8aa7('0x4c')]=function(_0x2d9011,_0x2a0135,_0xee2649){var _0x40468f={};var _0x4ec4e3={};var _0x3bc5e3;var _0x5cbfba;return db[_0x8aa7('0x2c')]['findOne']({'where':{'id':_0x2d9011[_0x8aa7('0x46')]['id']}})[_0x8aa7('0x27')](handleEntityNotFound(_0x2a0135,null))[_0x8aa7('0x27')](function(_0x20d0bf){if(_0x20d0bf){_0x3bc5e3=_0x20d0bf;_0x4ec4e3[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db['ServicenowField']['rawAttributes']);_0x4ec4e3[_0x8aa7('0x33')]=_['keys'](_0x2d9011[_0x8aa7('0x33')]);_0x4ec4e3[_0x8aa7('0x34')]=_['intersection'](_0x4ec4e3['model'],_0x4ec4e3[_0x8aa7('0x33')]);_0x40468f[_0x8aa7('0x37')]=_[_0x8aa7('0x35')](_0x4ec4e3[_0x8aa7('0x31')],qs[_0x8aa7('0x36')](_0x2d9011[_0x8aa7('0x33')]['fields']));_0x40468f['attributes']=_0x40468f['attributes'][_0x8aa7('0x38')]?_0x40468f[_0x8aa7('0x37')]:_0x4ec4e3[_0x8aa7('0x31')];_0x40468f[_0x8aa7('0x3a')]=qs[_0x8aa7('0x4d')](_0x2d9011[_0x8aa7('0x33')][_0x8aa7('0x4d')]);_0x40468f['where']=qs[_0x8aa7('0x34')](_[_0x8aa7('0x3c')](_0x2d9011['query'],_0x4ec4e3['filters']));if(_0x2d9011[_0x8aa7('0x33')]['filter']){_0x40468f[_0x8aa7('0x3b')]=_[_0x8aa7('0x3d')](_0x40468f['where'],{'$or':_[_0x8aa7('0x32')](_0x40468f[_0x8aa7('0x37')],function(_0x4c1640){var _0x2b5027={};_0x2b5027[_0x4c1640]={'$like':'%'+_0x2d9011[_0x8aa7('0x33')][_0x8aa7('0x3f')]+'%'};return _0x2b5027;})});}_0x40468f=_[_0x8aa7('0x3d')]({},_0x40468f,_0x2d9011[_0x8aa7('0x40')]);return _0x3bc5e3[_0x8aa7('0x4c')](_0x40468f);}})[_0x8aa7('0x27')](function(_0x2d9c69){if(_0x2d9c69){_0x5cbfba=_0x2d9c69[_0x8aa7('0x38')];if(!_0x2d9011[_0x8aa7('0x33')]['hasOwnProperty'](_0x8aa7('0x39'))){_0x40468f[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x2d9011[_0x8aa7('0x33')][_0x8aa7('0x22')]);_0x40468f['offset']=qs[_0x8aa7('0x1f')](_0x2d9011['query'][_0x8aa7('0x1f')]);}return _0x3bc5e3['getFields'](_0x40468f);}})[_0x8aa7('0x27')](function(_0x483241){if(_0x483241){return _0x483241?{'count':_0x5cbfba,'rows':_0x483241}:null;}})['then'](respondWithResult(_0x2a0135,null))[_0x8aa7('0x4b')](handleError(_0x2a0135,null));};exports[_0x8aa7('0x4e')]=function(_0x3e7092,_0xc33f33,_0x2332e1){var _0x5660f1={};var _0xeb209c={};var _0x5c5cb7;var _0x5cce45;return db[_0x8aa7('0x2c')][_0x8aa7('0x4f')]({'where':{'id':_0x3e7092[_0x8aa7('0x46')]['id']}})['then'](handleEntityNotFound(_0xc33f33,null))[_0x8aa7('0x27')](function(_0x576c15){if(_0x576c15){_0x5c5cb7=_0x576c15;_0xeb209c[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db[_0x8aa7('0x50')][_0x8aa7('0x2d')]);_0xeb209c['query']=_[_0x8aa7('0x47')](_0x3e7092['query']);_0xeb209c[_0x8aa7('0x34')]=_[_0x8aa7('0x35')](_0xeb209c[_0x8aa7('0x31')],_0xeb209c[_0x8aa7('0x33')]);_0x5660f1[_0x8aa7('0x37')]=_['intersection'](_0xeb209c[_0x8aa7('0x31')],qs['fields'](_0x3e7092['query']['fields']));_0x5660f1[_0x8aa7('0x37')]=_0x5660f1[_0x8aa7('0x37')][_0x8aa7('0x38')]?_0x5660f1[_0x8aa7('0x37')]:_0xeb209c[_0x8aa7('0x31')];_0x5660f1[_0x8aa7('0x3a')]=qs[_0x8aa7('0x4d')](_0x3e7092[_0x8aa7('0x33')]['sort']);_0x5660f1['where']=qs['filters'](_[_0x8aa7('0x3c')](_0x3e7092['query'],_0xeb209c['filters']));if(_0x3e7092[_0x8aa7('0x33')]['filter']){_0x5660f1['where']=_['merge'](_0x5660f1[_0x8aa7('0x3b')],{'$or':_[_0x8aa7('0x32')](_0x5660f1['attributes'],function(_0x3b7b1a){var _0x5de160={};_0x5de160[_0x3b7b1a]={'$like':'%'+_0x3e7092[_0x8aa7('0x33')][_0x8aa7('0x3f')]+'%'};return _0x5de160;})});}_0x5660f1=_['merge']({},_0x5660f1,_0x3e7092['options']);return _0x5c5cb7[_0x8aa7('0x4e')](_0x5660f1);}})['then'](function(_0x53bdd8){if(_0x53bdd8){_0x5cce45=_0x53bdd8[_0x8aa7('0x38')];if(!_0x3e7092[_0x8aa7('0x33')]['hasOwnProperty']('nolimit')){_0x5660f1[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x3e7092['query'][_0x8aa7('0x22')]);_0x5660f1[_0x8aa7('0x1f')]=qs['offset'](_0x3e7092[_0x8aa7('0x33')][_0x8aa7('0x1f')]);}return _0x5c5cb7[_0x8aa7('0x4e')](_0x5660f1);}})[_0x8aa7('0x27')](function(_0x2866a8){if(_0x2866a8){return _0x2866a8?{'count':_0x5cce45,'rows':_0x2866a8}:null;}})['then'](respondWithResult(_0xc33f33,null))[_0x8aa7('0x4b')](handleError(_0xc33f33,null));};exports['getDescriptions']=function(_0x2863ac,_0x2a75f7,_0x3631a1){var _0x2e2950={};var _0x586588={};var _0x399f26;var _0x2d8600;return db['ServicenowConfiguration'][_0x8aa7('0x4f')]({'where':{'id':_0x2863ac[_0x8aa7('0x46')]['id']}})[_0x8aa7('0x27')](handleEntityNotFound(_0x2a75f7,null))[_0x8aa7('0x27')](function(_0x256d50){if(_0x256d50){_0x399f26=_0x256d50;_0x586588[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db[_0x8aa7('0x50')][_0x8aa7('0x2d')]);_0x586588[_0x8aa7('0x33')]=_[_0x8aa7('0x47')](_0x2863ac[_0x8aa7('0x33')]);_0x586588[_0x8aa7('0x34')]=_['intersection'](_0x586588[_0x8aa7('0x31')],_0x586588['query']);_0x2e2950[_0x8aa7('0x37')]=_[_0x8aa7('0x35')](_0x586588[_0x8aa7('0x31')],qs[_0x8aa7('0x36')](_0x2863ac['query']['fields']));_0x2e2950[_0x8aa7('0x37')]=_0x2e2950['attributes']['length']?_0x2e2950[_0x8aa7('0x37')]:_0x586588['model'];_0x2e2950[_0x8aa7('0x3a')]=qs[_0x8aa7('0x4d')](_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x4d')]);_0x2e2950[_0x8aa7('0x3b')]=qs[_0x8aa7('0x34')](_[_0x8aa7('0x3c')](_0x2863ac['query'],_0x586588[_0x8aa7('0x34')]));if(_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x3f')]){_0x2e2950[_0x8aa7('0x3b')]=_['merge'](_0x2e2950[_0x8aa7('0x3b')],{'$or':_[_0x8aa7('0x32')](_0x2e2950['attributes'],function(_0xb35589){var _0x2a5c9c={};_0x2a5c9c[_0xb35589]={'$like':'%'+_0x2863ac['query']['filter']+'%'};return _0x2a5c9c;})});}_0x2e2950=_['merge']({},_0x2e2950,_0x2863ac[_0x8aa7('0x40')]);return _0x399f26[_0x8aa7('0x51')](_0x2e2950);}})[_0x8aa7('0x27')](function(_0x17fc03){if(_0x17fc03){_0x2d8600=_0x17fc03[_0x8aa7('0x38')];if(!_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x52')](_0x8aa7('0x39'))){_0x2e2950[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x22')]);_0x2e2950[_0x8aa7('0x1f')]=qs[_0x8aa7('0x1f')](_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x1f')]);}return _0x399f26['getDescriptions'](_0x2e2950);}})[_0x8aa7('0x27')](function(_0x256a65){if(_0x256a65){return _0x256a65?{'count':_0x2d8600,'rows':_0x256a65}:null;}})['then'](respondWithResult(_0x2a75f7,null))[_0x8aa7('0x4b')](handleError(_0x2a75f7,null));}; \ No newline at end of file +var _0x5c91=['create','body','getFields','findOne','ServicenowField','sort','hasOwnProperty','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find'];(function(_0x5b4222,_0x986d97){var _0x12c9d5=function(_0x6e6a57){while(--_0x6e6a57){_0x5b4222['push'](_0x5b4222['shift']());}};_0x12c9d5(++_0x986d97);}(_0x5c91,0xae));var _0x15c9=function(_0xf03525,_0xfb64e2){_0xf03525=_0xf03525-0x0;var _0x4ee2b1=_0x5c91[_0xf03525];return _0x4ee2b1;};'use strict';var emlformat=require(_0x15c9('0x0'));var rimraf=require(_0x15c9('0x1'));var zipdir=require(_0x15c9('0x2'));var jsonpatch=require(_0x15c9('0x3'));var rp=require('request-promise');var moment=require(_0x15c9('0x4'));var BPromise=require(_0x15c9('0x5'));var Mustache=require(_0x15c9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x15c9('0x7'));var csv=require(_0x15c9('0x8'));var ejs=require(_0x15c9('0x9'));var fs=require('fs');var fs_extra=require(_0x15c9('0xa'));var _=require(_0x15c9('0xb'));var squel=require(_0x15c9('0xc'));var crypto=require(_0x15c9('0xd'));var jsforce=require(_0x15c9('0xe'));var deskjs=require(_0x15c9('0xf'));var toCsv=require(_0x15c9('0x8'));var querystring=require(_0x15c9('0x10'));var Papa=require(_0x15c9('0x11'));var Redis=require(_0x15c9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x15c9('0x13'));var as=require(_0x15c9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x15c9('0x15'))('api');var utils=require(_0x15c9('0x16'));var config=require(_0x15c9('0x17'));var licenseUtil=require(_0x15c9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f4dc4,_0x1b41b7){_0x1b41b7=_0x1b41b7||0xcc;return function(_0xb0b89c){if(_0xb0b89c){return _0x8f4dc4['sendStatus'](_0x1b41b7);}return _0x8f4dc4['status'](_0x1b41b7)[_0x15c9('0x19')]();};}function respondWithResult(_0x3ff298,_0x6d0d7e){_0x6d0d7e=_0x6d0d7e||0xc8;return function(_0x57baff){if(_0x57baff){return _0x3ff298[_0x15c9('0x1a')](_0x6d0d7e)[_0x15c9('0x1b')](_0x57baff);}};}function respondWithFilteredResult(_0x40099c,_0x2da210){return function(_0x5f4316){if(_0x5f4316){var _0x2d76bf=typeof _0x2da210['offset']===_0x15c9('0x1c')&&typeof _0x2da210[_0x15c9('0x1d')]===_0x15c9('0x1c');var _0x308fe3=_0x5f4316[_0x15c9('0x1e')];var _0x2b7d07=_0x2d76bf?0x0:_0x2da210[_0x15c9('0x1f')];var _0x54451e=_0x2d76bf?_0x5f4316['count']:_0x2da210[_0x15c9('0x1f')]+_0x2da210[_0x15c9('0x1d')];var _0x3e216d;if(_0x54451e>=_0x308fe3){_0x54451e=_0x308fe3;_0x3e216d=0xc8;}else{_0x3e216d=0xce;}_0x40099c[_0x15c9('0x1a')](_0x3e216d);return _0x40099c[_0x15c9('0x20')](_0x15c9('0x21'),_0x2b7d07+'-'+_0x54451e+'/'+_0x308fe3)['json'](_0x5f4316);}return null;};}function patchUpdates(_0x273883){return function(_0x50335f){try{jsonpatch[_0x15c9('0x22')](_0x50335f,_0x273883,!![]);}catch(_0xcbe814){return BPromise[_0x15c9('0x23')](_0xcbe814);}return _0x50335f[_0x15c9('0x24')]();};}function saveUpdates(_0x3e27df,_0x2d9156){return function(_0x4f744b){if(_0x4f744b){return _0x4f744b[_0x15c9('0x25')](_0x3e27df)[_0x15c9('0x26')](function(_0x109394){return _0x109394;});}return null;};}function removeEntity(_0x67a150,_0x31b461){return function(_0x396e3e){if(_0x396e3e){return _0x396e3e[_0x15c9('0x27')]()[_0x15c9('0x26')](function(){_0x67a150[_0x15c9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x233da5,_0x3fa1cd){return function(_0x26d436){if(!_0x26d436){_0x233da5[_0x15c9('0x28')](0x194);}return _0x26d436;};}function handleError(_0x3bf69b,_0x5b1b82){_0x5b1b82=_0x5b1b82||0x1f4;return function(_0x49c782){logger[_0x15c9('0x29')](_0x49c782[_0x15c9('0x2a')]);if(_0x49c782[_0x15c9('0x2b')]){delete _0x49c782[_0x15c9('0x2b')];}_0x3bf69b[_0x15c9('0x1a')](_0x5b1b82)[_0x15c9('0x2c')](_0x49c782);};}exports[_0x15c9('0x2d')]=function(_0x50afc4,_0x47ad47){var _0x577bf9={},_0x50d9f8={},_0x455844={'count':0x0,'rows':[]};var _0x79a6d2=_[_0x15c9('0x2e')](db[_0x15c9('0x2f')][_0x15c9('0x30')],function(_0x4da087){return{'name':_0x4da087[_0x15c9('0x31')],'type':_0x4da087[_0x15c9('0x32')]['key']};});_0x50d9f8['model']=_['map'](_0x79a6d2,_0x15c9('0x2b'));_0x50d9f8[_0x15c9('0x33')]=_[_0x15c9('0x34')](_0x50afc4[_0x15c9('0x33')]);_0x50d9f8[_0x15c9('0x35')]=_[_0x15c9('0x36')](_0x50d9f8['model'],_0x50d9f8[_0x15c9('0x33')]);_0x577bf9['attributes']=_[_0x15c9('0x36')](_0x50d9f8[_0x15c9('0x37')],qs[_0x15c9('0x38')](_0x50afc4['query'][_0x15c9('0x38')]));_0x577bf9['attributes']=_0x577bf9[_0x15c9('0x39')][_0x15c9('0x3a')]?_0x577bf9[_0x15c9('0x39')]:_0x50d9f8[_0x15c9('0x37')];if(!_0x50afc4[_0x15c9('0x33')]['hasOwnProperty'](_0x15c9('0x3b'))){_0x577bf9['limit']=qs['limit'](_0x50afc4[_0x15c9('0x33')][_0x15c9('0x1d')]);_0x577bf9[_0x15c9('0x1f')]=qs[_0x15c9('0x1f')](_0x50afc4[_0x15c9('0x33')]['offset']);}_0x577bf9[_0x15c9('0x3c')]=qs['sort'](_0x50afc4[_0x15c9('0x33')]['sort']);_0x577bf9[_0x15c9('0x3d')]=qs['filters'](_['pick'](_0x50afc4['query'],_0x50d9f8['filters']),_0x79a6d2);if(_0x50afc4[_0x15c9('0x33')][_0x15c9('0x3e')]){_0x577bf9[_0x15c9('0x3d')]=_[_0x15c9('0x3f')](_0x577bf9['where'],{'$or':_[_0x15c9('0x2e')](_0x79a6d2,function(_0x1fbad1){if(_0x1fbad1[_0x15c9('0x32')]!==_0x15c9('0x40')){var _0x2cd4de={};_0x2cd4de[_0x1fbad1['name']]={'$like':'%'+_0x50afc4['query']['filter']+'%'};return _0x2cd4de;}})});}_0x577bf9=_[_0x15c9('0x3f')]({},_0x577bf9,_0x50afc4[_0x15c9('0x41')]);var _0x3792b9={'where':_0x577bf9[_0x15c9('0x3d')]};return db[_0x15c9('0x2f')]['count'](_0x3792b9)[_0x15c9('0x26')](function(_0x1a16d2){_0x455844['count']=_0x1a16d2;if(_0x50afc4[_0x15c9('0x33')][_0x15c9('0x42')]){_0x577bf9[_0x15c9('0x43')]=[{'all':!![]}];}return db[_0x15c9('0x2f')]['findAll'](_0x577bf9);})[_0x15c9('0x26')](function(_0x519be1){_0x455844[_0x15c9('0x44')]=_0x519be1;return _0x455844;})[_0x15c9('0x26')](respondWithFilteredResult(_0x47ad47,_0x577bf9))[_0x15c9('0x45')](handleError(_0x47ad47,null));};exports['show']=function(_0x26e4fb,_0x4f4986){var _0x2bb72c={'raw':![],'where':{'id':_0x26e4fb[_0x15c9('0x46')]['id']}},_0x1e14f3={};_0x1e14f3['model']=_[_0x15c9('0x34')](db[_0x15c9('0x2f')][_0x15c9('0x30')]);_0x1e14f3[_0x15c9('0x33')]=_[_0x15c9('0x34')](_0x26e4fb[_0x15c9('0x33')]);_0x1e14f3[_0x15c9('0x35')]=_[_0x15c9('0x36')](_0x1e14f3[_0x15c9('0x37')],_0x1e14f3['query']);_0x2bb72c['attributes']=_['intersection'](_0x1e14f3[_0x15c9('0x37')],qs[_0x15c9('0x38')](_0x26e4fb[_0x15c9('0x33')][_0x15c9('0x38')]));_0x2bb72c['attributes']=_0x2bb72c[_0x15c9('0x39')][_0x15c9('0x3a')]?_0x2bb72c[_0x15c9('0x39')]:_0x1e14f3[_0x15c9('0x37')];if(_0x26e4fb[_0x15c9('0x33')][_0x15c9('0x42')]){_0x2bb72c[_0x15c9('0x43')]=[{'all':!![]}];}_0x2bb72c=_[_0x15c9('0x3f')]({},_0x2bb72c,_0x26e4fb[_0x15c9('0x41')]);return db[_0x15c9('0x2f')][_0x15c9('0x47')](_0x2bb72c)[_0x15c9('0x26')](handleEntityNotFound(_0x4f4986,null))[_0x15c9('0x26')](respondWithResult(_0x4f4986,null))[_0x15c9('0x45')](handleError(_0x4f4986,null));};exports[_0x15c9('0x48')]=function(_0x2b9890,_0x52c03d){return db[_0x15c9('0x2f')][_0x15c9('0x48')](_0x2b9890['body'],{})[_0x15c9('0x26')](respondWithResult(_0x52c03d,0xc9))[_0x15c9('0x45')](handleError(_0x52c03d,null));};exports['update']=function(_0x2c6860,_0x1c28e3){if(_0x2c6860[_0x15c9('0x49')]['id']){delete _0x2c6860[_0x15c9('0x49')]['id'];}return db[_0x15c9('0x2f')][_0x15c9('0x47')]({'where':{'id':_0x2c6860['params']['id']}})[_0x15c9('0x26')](handleEntityNotFound(_0x1c28e3,null))[_0x15c9('0x26')](saveUpdates(_0x2c6860[_0x15c9('0x49')],null))[_0x15c9('0x26')](respondWithResult(_0x1c28e3,null))['catch'](handleError(_0x1c28e3,null));};exports['destroy']=function(_0x3d3a74,_0x8e402){return db[_0x15c9('0x2f')][_0x15c9('0x47')]({'where':{'id':_0x3d3a74['params']['id']}})[_0x15c9('0x26')](handleEntityNotFound(_0x8e402,null))[_0x15c9('0x26')](removeEntity(_0x8e402,null))['catch'](handleError(_0x8e402,null));};exports[_0x15c9('0x4a')]=function(_0x305939,_0x313085,_0x2e502e){var _0xb788c1={};var _0x4d5d04={};var _0x36ef81;var _0x19d2c4;return db[_0x15c9('0x2f')][_0x15c9('0x4b')]({'where':{'id':_0x305939[_0x15c9('0x46')]['id']}})['then'](handleEntityNotFound(_0x313085,null))[_0x15c9('0x26')](function(_0x3d033c){if(_0x3d033c){_0x36ef81=_0x3d033c;_0x4d5d04[_0x15c9('0x37')]=_[_0x15c9('0x34')](db[_0x15c9('0x4c')][_0x15c9('0x30')]);_0x4d5d04[_0x15c9('0x33')]=_[_0x15c9('0x34')](_0x305939[_0x15c9('0x33')]);_0x4d5d04[_0x15c9('0x35')]=_[_0x15c9('0x36')](_0x4d5d04[_0x15c9('0x37')],_0x4d5d04[_0x15c9('0x33')]);_0xb788c1['attributes']=_['intersection'](_0x4d5d04[_0x15c9('0x37')],qs[_0x15c9('0x38')](_0x305939[_0x15c9('0x33')][_0x15c9('0x38')]));_0xb788c1[_0x15c9('0x39')]=_0xb788c1[_0x15c9('0x39')]['length']?_0xb788c1[_0x15c9('0x39')]:_0x4d5d04[_0x15c9('0x37')];_0xb788c1[_0x15c9('0x3c')]=qs[_0x15c9('0x4d')](_0x305939[_0x15c9('0x33')][_0x15c9('0x4d')]);_0xb788c1[_0x15c9('0x3d')]=qs[_0x15c9('0x35')](_['pick'](_0x305939[_0x15c9('0x33')],_0x4d5d04[_0x15c9('0x35')]));if(_0x305939[_0x15c9('0x33')]['filter']){_0xb788c1['where']=_[_0x15c9('0x3f')](_0xb788c1[_0x15c9('0x3d')],{'$or':_['map'](_0xb788c1['attributes'],function(_0x834ac2){var _0x41a8df={};_0x41a8df[_0x834ac2]={'$like':'%'+_0x305939[_0x15c9('0x33')]['filter']+'%'};return _0x41a8df;})});}_0xb788c1=_[_0x15c9('0x3f')]({},_0xb788c1,_0x305939['options']);return _0x36ef81[_0x15c9('0x4a')](_0xb788c1);}})[_0x15c9('0x26')](function(_0x379388){if(_0x379388){_0x19d2c4=_0x379388[_0x15c9('0x3a')];if(!_0x305939[_0x15c9('0x33')][_0x15c9('0x4e')]('nolimit')){_0xb788c1['limit']=qs[_0x15c9('0x1d')](_0x305939[_0x15c9('0x33')]['limit']);_0xb788c1[_0x15c9('0x1f')]=qs[_0x15c9('0x1f')](_0x305939['query'][_0x15c9('0x1f')]);}return _0x36ef81[_0x15c9('0x4a')](_0xb788c1);}})['then'](function(_0x3c3de1){if(_0x3c3de1){return _0x3c3de1?{'count':_0x19d2c4,'rows':_0x3c3de1}:null;}})[_0x15c9('0x26')](respondWithResult(_0x313085,null))[_0x15c9('0x45')](handleError(_0x313085,null));};exports[_0x15c9('0x4f')]=function(_0x2024a7,_0x5020ad,_0x551ed6){var _0x3b9918={};var _0x28f9a2={};var _0x940923;var _0x494ffa;return db['ServicenowConfiguration'][_0x15c9('0x4b')]({'where':{'id':_0x2024a7[_0x15c9('0x46')]['id']}})['then'](handleEntityNotFound(_0x5020ad,null))['then'](function(_0xf2073f){if(_0xf2073f){_0x940923=_0xf2073f;_0x28f9a2[_0x15c9('0x37')]=_['keys'](db[_0x15c9('0x4c')][_0x15c9('0x30')]);_0x28f9a2[_0x15c9('0x33')]=_[_0x15c9('0x34')](_0x2024a7[_0x15c9('0x33')]);_0x28f9a2[_0x15c9('0x35')]=_[_0x15c9('0x36')](_0x28f9a2[_0x15c9('0x37')],_0x28f9a2[_0x15c9('0x33')]);_0x3b9918[_0x15c9('0x39')]=_[_0x15c9('0x36')](_0x28f9a2[_0x15c9('0x37')],qs[_0x15c9('0x38')](_0x2024a7[_0x15c9('0x33')][_0x15c9('0x38')]));_0x3b9918[_0x15c9('0x39')]=_0x3b9918[_0x15c9('0x39')][_0x15c9('0x3a')]?_0x3b9918['attributes']:_0x28f9a2[_0x15c9('0x37')];_0x3b9918[_0x15c9('0x3c')]=qs[_0x15c9('0x4d')](_0x2024a7[_0x15c9('0x33')][_0x15c9('0x4d')]);_0x3b9918['where']=qs[_0x15c9('0x35')](_[_0x15c9('0x50')](_0x2024a7[_0x15c9('0x33')],_0x28f9a2[_0x15c9('0x35')]));if(_0x2024a7[_0x15c9('0x33')][_0x15c9('0x3e')]){_0x3b9918['where']=_[_0x15c9('0x3f')](_0x3b9918[_0x15c9('0x3d')],{'$or':_[_0x15c9('0x2e')](_0x3b9918[_0x15c9('0x39')],function(_0x3e591e){var _0x1b057a={};_0x1b057a[_0x3e591e]={'$like':'%'+_0x2024a7['query'][_0x15c9('0x3e')]+'%'};return _0x1b057a;})});}_0x3b9918=_['merge']({},_0x3b9918,_0x2024a7['options']);return _0x940923[_0x15c9('0x4f')](_0x3b9918);}})[_0x15c9('0x26')](function(_0xa55b9e){if(_0xa55b9e){_0x494ffa=_0xa55b9e[_0x15c9('0x3a')];if(!_0x2024a7[_0x15c9('0x33')][_0x15c9('0x4e')](_0x15c9('0x3b'))){_0x3b9918['limit']=qs[_0x15c9('0x1d')](_0x2024a7[_0x15c9('0x33')][_0x15c9('0x1d')]);_0x3b9918['offset']=qs['offset'](_0x2024a7[_0x15c9('0x33')][_0x15c9('0x1f')]);}return _0x940923[_0x15c9('0x4f')](_0x3b9918);}})[_0x15c9('0x26')](function(_0x2664f7){if(_0x2664f7){return _0x2664f7?{'count':_0x494ffa,'rows':_0x2664f7}:null;}})[_0x15c9('0x26')](respondWithResult(_0x5020ad,null))['catch'](handleError(_0x5020ad,null));};exports[_0x15c9('0x51')]=function(_0x49e393,_0x4a1708,_0x354a0b){var _0x3ca2e0={};var _0x5551ad={};var _0x5e0e72;var _0x17c387;return db[_0x15c9('0x2f')][_0x15c9('0x4b')]({'where':{'id':_0x49e393[_0x15c9('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a1708,null))[_0x15c9('0x26')](function(_0x54bc9c){if(_0x54bc9c){_0x5e0e72=_0x54bc9c;_0x5551ad[_0x15c9('0x37')]=_['keys'](db[_0x15c9('0x4c')]['rawAttributes']);_0x5551ad[_0x15c9('0x33')]=_[_0x15c9('0x34')](_0x49e393[_0x15c9('0x33')]);_0x5551ad['filters']=_[_0x15c9('0x36')](_0x5551ad['model'],_0x5551ad[_0x15c9('0x33')]);_0x3ca2e0[_0x15c9('0x39')]=_[_0x15c9('0x36')](_0x5551ad[_0x15c9('0x37')],qs['fields'](_0x49e393['query']['fields']));_0x3ca2e0[_0x15c9('0x39')]=_0x3ca2e0[_0x15c9('0x39')][_0x15c9('0x3a')]?_0x3ca2e0['attributes']:_0x5551ad[_0x15c9('0x37')];_0x3ca2e0[_0x15c9('0x3c')]=qs[_0x15c9('0x4d')](_0x49e393[_0x15c9('0x33')]['sort']);_0x3ca2e0['where']=qs['filters'](_[_0x15c9('0x50')](_0x49e393[_0x15c9('0x33')],_0x5551ad['filters']));if(_0x49e393[_0x15c9('0x33')][_0x15c9('0x3e')]){_0x3ca2e0['where']=_[_0x15c9('0x3f')](_0x3ca2e0[_0x15c9('0x3d')],{'$or':_['map'](_0x3ca2e0[_0x15c9('0x39')],function(_0x4dcee1){var _0x5631cb={};_0x5631cb[_0x4dcee1]={'$like':'%'+_0x49e393[_0x15c9('0x33')]['filter']+'%'};return _0x5631cb;})});}_0x3ca2e0=_[_0x15c9('0x3f')]({},_0x3ca2e0,_0x49e393[_0x15c9('0x41')]);return _0x5e0e72['getDescriptions'](_0x3ca2e0);}})[_0x15c9('0x26')](function(_0x787eb6){if(_0x787eb6){_0x17c387=_0x787eb6[_0x15c9('0x3a')];if(!_0x49e393[_0x15c9('0x33')][_0x15c9('0x4e')](_0x15c9('0x3b'))){_0x3ca2e0[_0x15c9('0x1d')]=qs[_0x15c9('0x1d')](_0x49e393['query'][_0x15c9('0x1d')]);_0x3ca2e0[_0x15c9('0x1f')]=qs[_0x15c9('0x1f')](_0x49e393[_0x15c9('0x33')][_0x15c9('0x1f')]);}return _0x5e0e72[_0x15c9('0x51')](_0x3ca2e0);}})['then'](function(_0x1a829d){if(_0x1a829d){return _0x1a829d?{'count':_0x17c387,'rows':_0x1a829d}:null;}})[_0x15c9('0x26')](respondWithResult(_0x4a1708,null))[_0x15c9('0x45')](handleError(_0x4a1708,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1c36dda..2f81220 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 _0x723c=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x723c,0x1ad));var _0xc723=function(_0x558ffb,_0x5a93d9){_0x558ffb=_0x558ffb-0x0;var _0x78ab6a=_0x723c[_0x558ffb];return _0x78ab6a;};'use strict';var _=require('lodash');var util=require(_0xc723('0x0'));var logger=require(_0xc723('0x1'))('api');var moment=require(_0xc723('0x2'));var BPromise=require('bluebird');var rp=require(_0xc723('0x3'));var fs=require('fs');var path=require(_0xc723('0x4'));var rimraf=require(_0xc723('0x5'));var config=require(_0xc723('0x6'));var attributes=require(_0xc723('0x7'));module[_0xc723('0x8')]=function(_0xa08b3,_0x4eb5ff){return _0xa08b3[_0xc723('0x9')](_0xc723('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2884=['request-promise','path','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','../../config/logger','api','moment'];(function(_0x499826,_0xc37e60){var _0x23da09=function(_0x46bb64){while(--_0x46bb64){_0x499826['push'](_0x499826['shift']());}};_0x23da09(++_0xc37e60);}(_0x2884,0x1eb));var _0x4288=function(_0x35cc99,_0x5bb972){_0x35cc99=_0x35cc99-0x0;var _0x14373c=_0x2884[_0x35cc99];return _0x14373c;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var logger=require(_0x4288('0x1'))(_0x4288('0x2'));var moment=require(_0x4288('0x3'));var BPromise=require('bluebird');var rp=require(_0x4288('0x4'));var fs=require('fs');var path=require(_0x4288('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4288('0x6'));module[_0x4288('0x7')]=function(_0x3d67f7,_0x59dffa){return _0x3d67f7['define'](_0x4288('0x8'),attributes,{'tableName':'int_servicenow_configurations','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 15b618f..a567358 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 _0xed9b=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0xed9b,0xd2));var _0xbed9=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xed9b[_0x382a62];return _0x490a25;};'use strict';var _=require('lodash');var util=require(_0xbed9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbed9('0x1'));var fs=require('fs');var Redis=require(_0xbed9('0x2'));var db=require(_0xbed9('0x3'))['db'];var utils=require(_0xbed9('0x4'));var logger=require(_0xbed9('0x5'))(_0xbed9('0x6'));var config=require(_0xbed9('0x7'));var jayson=require(_0xbed9('0x8'));var client=jayson['client'][_0xbed9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x707232,_0x5d404a,_0x2c7a27){return new BPromise(function(_0x4f65dc,_0x9c3f38){return client[_0xbed9('0xa')](_0x707232,_0x2c7a27)[_0xbed9('0xb')](function(_0x1f807a){logger[_0xbed9('0xc')](_0xbed9('0xd'),_0x5d404a,_0xbed9('0xe'));logger[_0xbed9('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5d404a,'request\x20sent',JSON[_0xbed9('0x10')](_0x1f807a));if(_0x1f807a[_0xbed9('0x11')]){if(_0x1f807a[_0xbed9('0x11')]['code']===0x1f4){logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);return _0x9c3f38(_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);}logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);return _0x4f65dc(_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);}else{logger[_0xbed9('0xc')](_0xbed9('0xd'),_0x5d404a,_0xbed9('0xe'));_0x4f65dc(_0x1f807a[_0xbed9('0x13')][_0xbed9('0x12')]);}})[_0xbed9('0x14')](function(_0x4f4d19){logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x4f4d19);_0x9c3f38(_0x4f4d19);});});} \ No newline at end of file +var _0x9655=['request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5da47a,_0x198e3d){var _0x3c25c7=function(_0x52331b){while(--_0x52331b){_0x5da47a['push'](_0x5da47a['shift']());}};_0x3c25c7(++_0x198e3d);}(_0x9655,0xe5));var _0x5965=function(_0x24e81d,_0x3982db){_0x24e81d=_0x24e81d-0x0;var _0x2114f5=_0x9655[_0x24e81d];return _0x2114f5;};'use strict';var _=require(_0x5965('0x0'));var util=require(_0x5965('0x1'));var moment=require(_0x5965('0x2'));var BPromise=require('bluebird');var rs=require(_0x5965('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5965('0x4'))['db'];var utils=require(_0x5965('0x5'));var logger=require('../../config/logger')(_0x5965('0x6'));var config=require(_0x5965('0x7'));var jayson=require(_0x5965('0x8'));var client=jayson[_0x5965('0x9')][_0x5965('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bb7d7,_0x4ea543,_0x3f6566){return new BPromise(function(_0x471737,_0x1f6385){return client[_0x5965('0xb')](_0x5bb7d7,_0x3f6566)[_0x5965('0xc')](function(_0x453185){logger[_0x5965('0xd')](_0x5965('0xe'),_0x4ea543,_0x5965('0xf'));logger[_0x5965('0x10')](_0x5965('0x11'),_0x4ea543,_0x5965('0xf'),JSON[_0x5965('0x12')](_0x453185));if(_0x453185[_0x5965('0x13')]){if(_0x453185[_0x5965('0x13')][_0x5965('0x14')]===0x1f4){logger['error'](_0x5965('0xe'),_0x4ea543,_0x453185['error'][_0x5965('0x15')]);return _0x1f6385(_0x453185[_0x5965('0x13')][_0x5965('0x15')]);}logger[_0x5965('0x13')](_0x5965('0xe'),_0x4ea543,_0x453185[_0x5965('0x13')][_0x5965('0x15')]);return _0x471737(_0x453185[_0x5965('0x13')][_0x5965('0x15')]);}else{logger[_0x5965('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4ea543,_0x5965('0xf'));_0x471737(_0x453185[_0x5965('0x16')][_0x5965('0x15')]);}})[_0x5965('0x17')](function(_0x319c25){logger[_0x5965('0x13')](_0x5965('0xe'),_0x4ea543,_0x319c25);_0x1f6385(_0x319c25);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e18ed8f..3b4e45f 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 _0xdfc5=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy'];(function(_0x56f43b,_0x12f74b){var _0x2a81de=function(_0x3e22c4){while(--_0x3e22c4){_0x56f43b['push'](_0x56f43b['shift']());}};_0x2a81de(++_0x12f74b);}(_0xdfc5,0x133));var _0x5dfc=function(_0x8eb1b7,_0x38a33b){_0x8eb1b7=_0x8eb1b7-0x0;var _0x39d8a2=_0xdfc5[_0x8eb1b7];return _0x39d8a2;};'use strict';var multer=require(_0x5dfc('0x0'));var util=require('util');var path=require(_0x5dfc('0x1'));var timeout=require(_0x5dfc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5dfc('0x3'));var auth=require(_0x5dfc('0x4'));var interaction=require(_0x5dfc('0x5'));var config=require(_0x5dfc('0x6'));var controller=require(_0x5dfc('0x7'));router[_0x5dfc('0x8')]('/',auth[_0x5dfc('0x9')](),controller[_0x5dfc('0xa')]);router[_0x5dfc('0x8')](_0x5dfc('0xb'),auth[_0x5dfc('0x9')](),controller['show']);router['post']('/',auth[_0x5dfc('0x9')](),controller[_0x5dfc('0xc')]);router[_0x5dfc('0xd')](_0x5dfc('0xb'),auth[_0x5dfc('0x9')](),controller[_0x5dfc('0xe')]);router[_0x5dfc('0xf')]('/:id',auth[_0x5dfc('0x9')](),controller[_0x5dfc('0x10')]);module[_0x5dfc('0x11')]=router; \ No newline at end of file +var _0x001b=['Router','fs-extra','./intServicenowField.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','multer','util','connect-timeout'];(function(_0x3763c9,_0xe3883d){var _0xd09a5=function(_0x4e7ada){while(--_0x4e7ada){_0x3763c9['push'](_0x3763c9['shift']());}};_0xd09a5(++_0xe3883d);}(_0x001b,0x18d));var _0xb001=function(_0x1c5765,_0x34e245){_0x1c5765=_0x1c5765-0x0;var _0x2709c0=_0x001b[_0x1c5765];return _0x2709c0;};'use strict';var multer=require(_0xb001('0x0'));var util=require(_0xb001('0x1'));var path=require('path');var timeout=require(_0xb001('0x2'));var express=require('express');var router=express[_0xb001('0x3')]();var fs_extra=require(_0xb001('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb001('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xb001('0x6')]);router[_0xb001('0x7')](_0xb001('0x8'),auth['isAuthenticated'](),controller[_0xb001('0x9')]);router[_0xb001('0xa')]('/',auth[_0xb001('0xb')](),controller[_0xb001('0xc')]);router[_0xb001('0xd')](_0xb001('0x8'),auth[_0xb001('0xb')](),controller[_0xb001('0xe')]);router[_0xb001('0xf')](_0xb001('0x8'),auth[_0xb001('0xb')](),controller['destroy']);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 86935c1..39719c8 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 _0xe34d=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xe34d,0x1b0));var _0xde34=function(_0x11b34a,_0x52229a){_0x11b34a=_0x11b34a-0x0;var _0x5fc431=_0xe34d[_0x11b34a];return _0x5fc431;};'use strict';var Sequelize=require('sequelize');module[_0xde34('0x0')]={'type':{'type':Sequelize[_0xde34('0x1')](_0xde34('0x2'),_0xde34('0x3'),_0xde34('0x4'),_0xde34('0x5'),'picklist'),'defaultValue':_0xde34('0x2')},'content':{'type':Sequelize[_0xde34('0x6')]},'key':{'type':Sequelize[_0xde34('0x6')]},'keyType':{'type':Sequelize[_0xde34('0x1')](_0xde34('0x2'),_0xde34('0x3'),_0xde34('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde34('0x6')]},'nameField':{'type':Sequelize[_0xde34('0x6')]},'customField':{'type':Sequelize[_0xde34('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde34('0x6')]}}; \ No newline at end of file +var _0x84ba=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x4c2d4a,_0x8655a0){var _0x6348dc=function(_0x1f59c8){while(--_0x1f59c8){_0x4c2d4a['push'](_0x4c2d4a['shift']());}};_0x6348dc(++_0x8655a0);}(_0x84ba,0x1ce));var _0xa84b=function(_0x227c19,_0x34d3c0){_0x227c19=_0x227c19-0x0;var _0x3936be=_0x84ba[_0x227c19];return _0x3936be;};'use strict';var Sequelize=require(_0xa84b('0x0'));module[_0xa84b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa84b('0x2'),_0xa84b('0x3'),_0xa84b('0x4'),_0xa84b('0x5'),_0xa84b('0x6')),'defaultValue':_0xa84b('0x2')},'content':{'type':Sequelize[_0xa84b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa84b('0x8')](_0xa84b('0x2'),_0xa84b('0x3'),_0xa84b('0x4'))},'keyContent':{'type':Sequelize[_0xa84b('0x7')]},'idField':{'type':Sequelize[_0xa84b('0x7')]},'nameField':{'type':Sequelize[_0xa84b('0x7')]},'customField':{'type':Sequelize[_0xa84b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa84b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 7668815..9d3d774 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 _0xc57a=['create','update','body','params','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ServicenowField','findAll','catch','show','keys','length','find'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xc57a,0x1ba));var _0xac57=function(_0x5b8685,_0x1a1c28){_0x5b8685=_0x5b8685-0x0;var _0xa3ef57=_0xc57a[_0x5b8685];return _0xa3ef57;};'use strict';var emlformat=require(_0xac57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac57('0x1'));var jsonpatch=require(_0xac57('0x2'));var rp=require('request-promise');var moment=require(_0xac57('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac57('0x4'));var util=require(_0xac57('0x5'));var path=require(_0xac57('0x6'));var sox=require(_0xac57('0x7'));var csv=require(_0xac57('0x8'));var ejs=require(_0xac57('0x9'));var fs=require('fs');var fs_extra=require(_0xac57('0xa'));var _=require(_0xac57('0xb'));var squel=require(_0xac57('0xc'));var crypto=require(_0xac57('0xd'));var jsforce=require(_0xac57('0xe'));var deskjs=require(_0xac57('0xf'));var toCsv=require(_0xac57('0x8'));var querystring=require(_0xac57('0x10'));var Papa=require(_0xac57('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac57('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac57('0x13'));var logger=require(_0xac57('0x14'))(_0xac57('0x15'));var utils=require('../../config/utils');var config=require(_0xac57('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xac57('0x17'))['db'];function respondWithStatusCode(_0x974d58,_0x47c0ed){_0x47c0ed=_0x47c0ed||0xcc;return function(_0x26dbbd){if(_0x26dbbd){return _0x974d58['sendStatus'](_0x47c0ed);}return _0x974d58[_0xac57('0x18')](_0x47c0ed)[_0xac57('0x19')]();};}function respondWithResult(_0x58e951,_0x3d7379){_0x3d7379=_0x3d7379||0xc8;return function(_0x28830a){if(_0x28830a){return _0x58e951[_0xac57('0x18')](_0x3d7379)['json'](_0x28830a);}};}function respondWithFilteredResult(_0x3df109,_0x47f560){return function(_0x54f4e7){if(_0x54f4e7){var _0x4b9d97=typeof _0x47f560[_0xac57('0x1a')]===_0xac57('0x1b')&&typeof _0x47f560[_0xac57('0x1c')]===_0xac57('0x1b');var _0xb9e9ed=_0x54f4e7[_0xac57('0x1d')];var _0x37e0d9=_0x4b9d97?0x0:_0x47f560['offset'];var _0x3827c2=_0x4b9d97?_0x54f4e7[_0xac57('0x1d')]:_0x47f560[_0xac57('0x1a')]+_0x47f560['limit'];var _0xcd236c;if(_0x3827c2>=_0xb9e9ed){_0x3827c2=_0xb9e9ed;_0xcd236c=0xc8;}else{_0xcd236c=0xce;}_0x3df109[_0xac57('0x18')](_0xcd236c);return _0x3df109['set'](_0xac57('0x1e'),_0x37e0d9+'-'+_0x3827c2+'/'+_0xb9e9ed)[_0xac57('0x1f')](_0x54f4e7);}return null;};}function patchUpdates(_0x91190c){return function(_0x5a9e74){try{jsonpatch['apply'](_0x5a9e74,_0x91190c,!![]);}catch(_0x4a01c7){return BPromise[_0xac57('0x20')](_0x4a01c7);}return _0x5a9e74[_0xac57('0x21')]();};}function saveUpdates(_0x26cf58,_0x125fca){return function(_0x540b88){if(_0x540b88){return _0x540b88['update'](_0x26cf58)[_0xac57('0x22')](function(_0x47cd7d){return _0x47cd7d;});}return null;};}function removeEntity(_0x548018,_0x38d1b1){return function(_0x20d165){if(_0x20d165){return _0x20d165[_0xac57('0x23')]()[_0xac57('0x22')](function(){_0x548018[_0xac57('0x18')](0xcc)[_0xac57('0x19')]();});}};}function handleEntityNotFound(_0x2e01b2,_0x4566c4){return function(_0x21b9e4){if(!_0x21b9e4){_0x2e01b2[_0xac57('0x24')](0x194);}return _0x21b9e4;};}function handleError(_0x3b73dc,_0xc870e){_0xc870e=_0xc870e||0x1f4;return function(_0x37790e){logger[_0xac57('0x25')](_0x37790e[_0xac57('0x26')]);if(_0x37790e[_0xac57('0x27')]){delete _0x37790e['name'];}_0x3b73dc[_0xac57('0x18')](_0xc870e)['send'](_0x37790e);};}exports[_0xac57('0x28')]=function(_0x190bc9,_0x30aaac){var _0x4c26fd={},_0x4051f6={},_0xde003f={'count':0x0,'rows':[]};var _0x5bd70c=_[_0xac57('0x29')](db['ServicenowField'][_0xac57('0x2a')],function(_0x7999f0){return{'name':_0x7999f0[_0xac57('0x2b')],'type':_0x7999f0[_0xac57('0x2c')]['key']};});_0x4051f6[_0xac57('0x2d')]=_[_0xac57('0x29')](_0x5bd70c,_0xac57('0x27'));_0x4051f6[_0xac57('0x2e')]=_['keys'](_0x190bc9['query']);_0x4051f6[_0xac57('0x2f')]=_[_0xac57('0x30')](_0x4051f6[_0xac57('0x2d')],_0x4051f6[_0xac57('0x2e')]);_0x4c26fd[_0xac57('0x31')]=_[_0xac57('0x30')](_0x4051f6[_0xac57('0x2d')],qs[_0xac57('0x32')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x32')]));_0x4c26fd[_0xac57('0x31')]=_0x4c26fd['attributes']['length']?_0x4c26fd[_0xac57('0x31')]:_0x4051f6['model'];if(!_0x190bc9[_0xac57('0x2e')][_0xac57('0x33')](_0xac57('0x34'))){_0x4c26fd[_0xac57('0x1c')]=qs[_0xac57('0x1c')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x1c')]);_0x4c26fd[_0xac57('0x1a')]=qs[_0xac57('0x1a')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x1a')]);}_0x4c26fd['order']=qs[_0xac57('0x35')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x35')]);_0x4c26fd[_0xac57('0x36')]=qs[_0xac57('0x2f')](_[_0xac57('0x37')](_0x190bc9[_0xac57('0x2e')],_0x4051f6['filters']),_0x5bd70c);if(_0x190bc9[_0xac57('0x2e')][_0xac57('0x38')]){_0x4c26fd[_0xac57('0x36')]=_[_0xac57('0x39')](_0x4c26fd[_0xac57('0x36')],{'$or':_[_0xac57('0x29')](_0x5bd70c,function(_0x2c9ad0){if(_0x2c9ad0[_0xac57('0x2c')]!==_0xac57('0x3a')){var _0x2a32a5={};_0x2a32a5[_0x2c9ad0[_0xac57('0x27')]]={'$like':'%'+_0x190bc9[_0xac57('0x2e')][_0xac57('0x38')]+'%'};return _0x2a32a5;}})});}_0x4c26fd=_[_0xac57('0x39')]({},_0x4c26fd,_0x190bc9[_0xac57('0x3b')]);var _0xa6adb6={'where':_0x4c26fd[_0xac57('0x36')]};return db['ServicenowField']['count'](_0xa6adb6)['then'](function(_0x10d9d8){_0xde003f[_0xac57('0x1d')]=_0x10d9d8;if(_0x190bc9['query'][_0xac57('0x3c')]){_0x4c26fd[_0xac57('0x3d')]=[{'all':!![]}];}return db[_0xac57('0x3e')][_0xac57('0x3f')](_0x4c26fd);})['then'](function(_0xa200f9){_0xde003f['rows']=_0xa200f9;return _0xde003f;})[_0xac57('0x22')](respondWithFilteredResult(_0x30aaac,_0x4c26fd))[_0xac57('0x40')](handleError(_0x30aaac,null));};exports[_0xac57('0x41')]=function(_0x529c44,_0xbd48cb){var _0x232c22={'raw':!![],'where':{'id':_0x529c44['params']['id']}},_0x2b0bd4={};_0x2b0bd4[_0xac57('0x2d')]=_[_0xac57('0x42')](db[_0xac57('0x3e')][_0xac57('0x2a')]);_0x2b0bd4[_0xac57('0x2e')]=_[_0xac57('0x42')](_0x529c44['query']);_0x2b0bd4[_0xac57('0x2f')]=_[_0xac57('0x30')](_0x2b0bd4[_0xac57('0x2d')],_0x2b0bd4[_0xac57('0x2e')]);_0x232c22[_0xac57('0x31')]=_[_0xac57('0x30')](_0x2b0bd4['model'],qs[_0xac57('0x32')](_0x529c44[_0xac57('0x2e')][_0xac57('0x32')]));_0x232c22[_0xac57('0x31')]=_0x232c22[_0xac57('0x31')][_0xac57('0x43')]?_0x232c22[_0xac57('0x31')]:_0x2b0bd4[_0xac57('0x2d')];if(_0x529c44[_0xac57('0x2e')][_0xac57('0x3c')]){_0x232c22['include']=[{'all':!![]}];}_0x232c22=_[_0xac57('0x39')]({},_0x232c22,_0x529c44['options']);return db[_0xac57('0x3e')][_0xac57('0x44')](_0x232c22)[_0xac57('0x22')](handleEntityNotFound(_0xbd48cb,null))['then'](respondWithResult(_0xbd48cb,null))[_0xac57('0x40')](handleError(_0xbd48cb,null));};exports[_0xac57('0x45')]=function(_0x10c84e,_0x1d42d2){return db[_0xac57('0x3e')][_0xac57('0x45')](_0x10c84e['body'],{})[_0xac57('0x22')](respondWithResult(_0x1d42d2,0xc9))[_0xac57('0x40')](handleError(_0x1d42d2,null));};exports[_0xac57('0x46')]=function(_0x4595c2,_0x14c6ca){if(_0x4595c2[_0xac57('0x47')]['id']){delete _0x4595c2[_0xac57('0x47')]['id'];}return db['ServicenowField'][_0xac57('0x44')]({'where':{'id':_0x4595c2[_0xac57('0x48')]['id']}})[_0xac57('0x22')](handleEntityNotFound(_0x14c6ca,null))[_0xac57('0x22')](saveUpdates(_0x4595c2[_0xac57('0x47')],null))[_0xac57('0x22')](respondWithResult(_0x14c6ca,null))['catch'](handleError(_0x14c6ca,null));};exports[_0xac57('0x23')]=function(_0x2d8ffa,_0x70cebe){return db[_0xac57('0x3e')][_0xac57('0x44')]({'where':{'id':_0x2d8ffa['params']['id']}})['then'](handleEntityNotFound(_0x70cebe,null))['then'](removeEntity(_0x70cebe,null))['catch'](handleError(_0x70cebe,null));}; \ No newline at end of file +var _0x752f=['fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','map','ServicenowField','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x23113a,_0x5ce02c){var _0x1a868d=function(_0x7b2d19){while(--_0x7b2d19){_0x23113a['push'](_0x23113a['shift']());}};_0x1a868d(++_0x5ce02c);}(_0x752f,0x11e));var _0xf752=function(_0x347bf3,_0x575f2b){_0x347bf3=_0x347bf3-0x0;var _0x18815d=_0x752f[_0x347bf3];return _0x18815d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf752('0x0'));var zipdir=require(_0xf752('0x1'));var jsonpatch=require(_0xf752('0x2'));var rp=require('request-promise');var moment=require(_0xf752('0x3'));var BPromise=require(_0xf752('0x4'));var Mustache=require('mustache');var util=require(_0xf752('0x5'));var path=require(_0xf752('0x6'));var sox=require(_0xf752('0x7'));var csv=require(_0xf752('0x8'));var ejs=require(_0xf752('0x9'));var fs=require('fs');var fs_extra=require(_0xf752('0xa'));var _=require('lodash');var squel=require(_0xf752('0xb'));var crypto=require(_0xf752('0xc'));var jsforce=require(_0xf752('0xd'));var deskjs=require(_0xf752('0xe'));var toCsv=require(_0xf752('0x8'));var querystring=require(_0xf752('0xf'));var Papa=require('papaparse');var Redis=require(_0xf752('0x10'));var authService=require(_0xf752('0x11'));var qs=require(_0xf752('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf752('0x13'));var logger=require(_0xf752('0x14'))(_0xf752('0x15'));var utils=require(_0xf752('0x16'));var config=require(_0xf752('0x17'));var licenseUtil=require(_0xf752('0x18'));var db=require(_0xf752('0x19'))['db'];function respondWithStatusCode(_0x5a0e84,_0x3a6907){_0x3a6907=_0x3a6907||0xcc;return function(_0x4677bf){if(_0x4677bf){return _0x5a0e84['sendStatus'](_0x3a6907);}return _0x5a0e84[_0xf752('0x1a')](_0x3a6907)[_0xf752('0x1b')]();};}function respondWithResult(_0x3fd756,_0x2178a0){_0x2178a0=_0x2178a0||0xc8;return function(_0x2cd69b){if(_0x2cd69b){return _0x3fd756[_0xf752('0x1a')](_0x2178a0)[_0xf752('0x1c')](_0x2cd69b);}};}function respondWithFilteredResult(_0x5c79bf,_0x63ba25){return function(_0x249173){if(_0x249173){var _0x590e10=typeof _0x63ba25[_0xf752('0x1d')]==='undefined'&&typeof _0x63ba25['limit']===_0xf752('0x1e');var _0x3d9961=_0x249173[_0xf752('0x1f')];var _0x50def9=_0x590e10?0x0:_0x63ba25['offset'];var _0x48c898=_0x590e10?_0x249173[_0xf752('0x1f')]:_0x63ba25[_0xf752('0x1d')]+_0x63ba25[_0xf752('0x20')];var _0x306ede;if(_0x48c898>=_0x3d9961){_0x48c898=_0x3d9961;_0x306ede=0xc8;}else{_0x306ede=0xce;}_0x5c79bf['status'](_0x306ede);return _0x5c79bf['set'](_0xf752('0x21'),_0x50def9+'-'+_0x48c898+'/'+_0x3d9961)[_0xf752('0x1c')](_0x249173);}return null;};}function patchUpdates(_0x193bab){return function(_0x38674e){try{jsonpatch[_0xf752('0x22')](_0x38674e,_0x193bab,!![]);}catch(_0x586058){return BPromise[_0xf752('0x23')](_0x586058);}return _0x38674e[_0xf752('0x24')]();};}function saveUpdates(_0x45bdb2,_0x3214da){return function(_0x2d6a44){if(_0x2d6a44){return _0x2d6a44[_0xf752('0x25')](_0x45bdb2)[_0xf752('0x26')](function(_0x311fd4){return _0x311fd4;});}return null;};}function removeEntity(_0x5ec8d7,_0x931e6a){return function(_0x1b98ad){if(_0x1b98ad){return _0x1b98ad[_0xf752('0x27')]()[_0xf752('0x26')](function(){_0x5ec8d7[_0xf752('0x1a')](0xcc)[_0xf752('0x1b')]();});}};}function handleEntityNotFound(_0x1316bc,_0x3ef7f9){return function(_0x15f8f4){if(!_0x15f8f4){_0x1316bc[_0xf752('0x28')](0x194);}return _0x15f8f4;};}function handleError(_0x4eb838,_0x3fbf11){_0x3fbf11=_0x3fbf11||0x1f4;return function(_0x4caa8a){logger['error'](_0x4caa8a['stack']);if(_0x4caa8a['name']){delete _0x4caa8a['name'];}_0x4eb838['status'](_0x3fbf11)[_0xf752('0x29')](_0x4caa8a);};}exports['index']=function(_0x1939fc,_0x3abb2f){var _0x227fc1={},_0x181f27={},_0x5da436={'count':0x0,'rows':[]};var _0x4842bd=_[_0xf752('0x2a')](db[_0xf752('0x2b')]['rawAttributes'],function(_0x3c7f05){return{'name':_0x3c7f05[_0xf752('0x2c')],'type':_0x3c7f05[_0xf752('0x2d')]['key']};});_0x181f27[_0xf752('0x2e')]=_[_0xf752('0x2a')](_0x4842bd,_0xf752('0x2f'));_0x181f27[_0xf752('0x30')]=_[_0xf752('0x31')](_0x1939fc[_0xf752('0x30')]);_0x181f27[_0xf752('0x32')]=_[_0xf752('0x33')](_0x181f27['model'],_0x181f27[_0xf752('0x30')]);_0x227fc1[_0xf752('0x34')]=_['intersection'](_0x181f27[_0xf752('0x2e')],qs[_0xf752('0x35')](_0x1939fc[_0xf752('0x30')][_0xf752('0x35')]));_0x227fc1[_0xf752('0x34')]=_0x227fc1[_0xf752('0x34')]['length']?_0x227fc1[_0xf752('0x34')]:_0x181f27['model'];if(!_0x1939fc[_0xf752('0x30')][_0xf752('0x36')]('nolimit')){_0x227fc1[_0xf752('0x20')]=qs['limit'](_0x1939fc['query'][_0xf752('0x20')]);_0x227fc1[_0xf752('0x1d')]=qs['offset'](_0x1939fc['query'][_0xf752('0x1d')]);}_0x227fc1[_0xf752('0x37')]=qs[_0xf752('0x38')](_0x1939fc[_0xf752('0x30')][_0xf752('0x38')]);_0x227fc1[_0xf752('0x39')]=qs['filters'](_[_0xf752('0x3a')](_0x1939fc[_0xf752('0x30')],_0x181f27[_0xf752('0x32')]),_0x4842bd);if(_0x1939fc[_0xf752('0x30')][_0xf752('0x3b')]){_0x227fc1['where']=_[_0xf752('0x3c')](_0x227fc1[_0xf752('0x39')],{'$or':_[_0xf752('0x2a')](_0x4842bd,function(_0xd60f0f){if(_0xd60f0f[_0xf752('0x2d')]!==_0xf752('0x3d')){var _0x3bcb97={};_0x3bcb97[_0xd60f0f[_0xf752('0x2f')]]={'$like':'%'+_0x1939fc[_0xf752('0x30')][_0xf752('0x3b')]+'%'};return _0x3bcb97;}})});}_0x227fc1=_[_0xf752('0x3c')]({},_0x227fc1,_0x1939fc[_0xf752('0x3e')]);var _0x29115c={'where':_0x227fc1[_0xf752('0x39')]};return db['ServicenowField']['count'](_0x29115c)[_0xf752('0x26')](function(_0x4aa0a3){_0x5da436[_0xf752('0x1f')]=_0x4aa0a3;if(_0x1939fc[_0xf752('0x30')][_0xf752('0x3f')]){_0x227fc1[_0xf752('0x40')]=[{'all':!![]}];}return db[_0xf752('0x2b')][_0xf752('0x41')](_0x227fc1);})[_0xf752('0x26')](function(_0x2136a6){_0x5da436[_0xf752('0x42')]=_0x2136a6;return _0x5da436;})[_0xf752('0x26')](respondWithFilteredResult(_0x3abb2f,_0x227fc1))[_0xf752('0x43')](handleError(_0x3abb2f,null));};exports[_0xf752('0x44')]=function(_0x49df07,_0x956426){var _0x5d851d={'raw':!![],'where':{'id':_0x49df07['params']['id']}},_0x192fc7={};_0x192fc7['model']=_[_0xf752('0x31')](db[_0xf752('0x2b')][_0xf752('0x45')]);_0x192fc7['query']=_['keys'](_0x49df07[_0xf752('0x30')]);_0x192fc7['filters']=_['intersection'](_0x192fc7[_0xf752('0x2e')],_0x192fc7[_0xf752('0x30')]);_0x5d851d[_0xf752('0x34')]=_[_0xf752('0x33')](_0x192fc7[_0xf752('0x2e')],qs[_0xf752('0x35')](_0x49df07[_0xf752('0x30')][_0xf752('0x35')]));_0x5d851d[_0xf752('0x34')]=_0x5d851d['attributes']['length']?_0x5d851d['attributes']:_0x192fc7[_0xf752('0x2e')];if(_0x49df07[_0xf752('0x30')][_0xf752('0x3f')]){_0x5d851d['include']=[{'all':!![]}];}_0x5d851d=_[_0xf752('0x3c')]({},_0x5d851d,_0x49df07['options']);return db[_0xf752('0x2b')][_0xf752('0x46')](_0x5d851d)[_0xf752('0x26')](handleEntityNotFound(_0x956426,null))[_0xf752('0x26')](respondWithResult(_0x956426,null))[_0xf752('0x43')](handleError(_0x956426,null));};exports[_0xf752('0x47')]=function(_0x1ffdbd,_0x50361d){return db[_0xf752('0x2b')]['create'](_0x1ffdbd[_0xf752('0x48')],{})[_0xf752('0x26')](respondWithResult(_0x50361d,0xc9))[_0xf752('0x43')](handleError(_0x50361d,null));};exports[_0xf752('0x25')]=function(_0x3a85fe,_0x3536b4){if(_0x3a85fe[_0xf752('0x48')]['id']){delete _0x3a85fe['body']['id'];}return db['ServicenowField'][_0xf752('0x46')]({'where':{'id':_0x3a85fe[_0xf752('0x49')]['id']}})[_0xf752('0x26')](handleEntityNotFound(_0x3536b4,null))[_0xf752('0x26')](saveUpdates(_0x3a85fe['body'],null))[_0xf752('0x26')](respondWithResult(_0x3536b4,null))[_0xf752('0x43')](handleError(_0x3536b4,null));};exports[_0xf752('0x27')]=function(_0x52c13a,_0x1f772f){return db[_0xf752('0x2b')][_0xf752('0x46')]({'where':{'id':_0x52c13a[_0xf752('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f772f,null))['then'](removeEntity(_0x1f772f,null))[_0xf752('0x43')](handleError(_0x1f772f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2ac838d..97b27c2 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 _0x36f3=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3cab38,_0x439e61){var _0x187d60=function(_0x285a14){while(--_0x285a14){_0x3cab38['push'](_0x3cab38['shift']());}};_0x187d60(++_0x439e61);}(_0x36f3,0x180));var _0x336f=function(_0x29a39d,_0x4c9e6c){_0x29a39d=_0x29a39d-0x0;var _0x561210=_0x36f3[_0x29a39d];return _0x561210;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x336f('0x0'))(_0x336f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x336f('0x2'));var fs=require('fs');var path=require(_0x336f('0x3'));var rimraf=require(_0x336f('0x4'));var config=require(_0x336f('0x5'));var attributes=require(_0x336f('0x6'));module[_0x336f('0x7')]=function(_0x2f85c1,_0xd107a7){return _0x2f85c1[_0x336f('0x8')](_0x336f('0x9'),attributes,{'tableName':_0x336f('0xa'),'paranoid':![],'indexes':[{'name':_0x336f('0xb'),'fields':[_0x336f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf417=['./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xf417,0x180));var _0x7f41=function(_0x292827,_0x95f387){_0x292827=_0x292827-0x0;var _0x485407=_0xf417[_0x292827];return _0x485407;};'use strict';var _=require('lodash');var util=require(_0x7f41('0x0'));var logger=require(_0x7f41('0x1'))(_0x7f41('0x2'));var moment=require(_0x7f41('0x3'));var BPromise=require(_0x7f41('0x4'));var rp=require(_0x7f41('0x5'));var fs=require('fs');var path=require(_0x7f41('0x6'));var rimraf=require('rimraf');var config=require(_0x7f41('0x7'));var attributes=require(_0x7f41('0x8'));module['exports']=function(_0x48ea56,_0x4b9356){return _0x48ea56['define'](_0x7f41('0x9'),attributes,{'tableName':_0x7f41('0xa'),'paranoid':![],'indexes':[{'name':_0x7f41('0xb'),'fields':[_0x7f41('0xc'),_0x7f41('0xd')],'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 1f9974e..351c3ad 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x383082,_0x3bfc3b){var _0x86bd64=function(_0x558704){while(--_0x558704){_0x383082['push'](_0x383082['shift']());}};_0x86bd64(++_0x3bfc3b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0xcb91[_0x143565];return _0x4dc1d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3af704,_0x58486b){_0x3af704=_0x3af704-0x0;var _0x4ac16c=_0xbdb7[_0x3af704];return _0x4ac16c;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index d7ba0ae..ffc83c5 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(_0x5e5e77,_0x7cddb5){var _0x3f0a23=function(_0x112905){while(--_0x112905){_0x5e5e77['push'](_0x5e5e77['shift']());}};_0x3f0a23(++_0x7cddb5);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5e03c7,_0x2f95da){var _0x260535=function(_0x2bf2de){while(--_0x2bf2de){_0x5e03c7['push'](_0x5e03c7['shift']());}};_0x260535(++_0x2f95da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3b485f8..06efdb6 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(_0xd8671e,_0x11627b){var _0x2ba27d=function(_0x4bfc9e){while(--_0x4bfc9e){_0xd8671e['push'](_0xd8671e['shift']());}};_0x2ba27d(++_0x11627b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x207dac,_0x9834d5){var _0xff09c4=function(_0x52b080){while(--_0x52b080){_0x207dac['push'](_0x207dac['shift']());}};_0xff09c4(++_0x9834d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 1971eb2..36d3e77 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 _0x3bd3=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','reject','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','%s%s','get_module_fields','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf'];(function(_0x3349bc,_0x5eabf1){var _0x1784cc=function(_0x5f4796){while(--_0x5f4796){_0x3349bc['push'](_0x3349bc['shift']());}};_0x1784cc(++_0x5eabf1);}(_0x3bd3,0x1d6));var _0x33bd=function(_0x1f803d,_0x1c966e){_0x1f803d=_0x1f803d-0x0;var _0x549186=_0x3bd3[_0x1f803d];return _0x549186;};'use strict';var emlformat=require(_0x33bd('0x0'));var rimraf=require(_0x33bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x33bd('0x2'));var moment=require(_0x33bd('0x3'));var BPromise=require(_0x33bd('0x4'));var Mustache=require(_0x33bd('0x5'));var util=require(_0x33bd('0x6'));var path=require(_0x33bd('0x7'));var sox=require(_0x33bd('0x8'));var csv=require(_0x33bd('0x9'));var ejs=require(_0x33bd('0xa'));var fs=require('fs');var fs_extra=require(_0x33bd('0xb'));var _=require(_0x33bd('0xc'));var squel=require(_0x33bd('0xd'));var crypto=require(_0x33bd('0xe'));var jsforce=require(_0x33bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x33bd('0x9'));var querystring=require(_0x33bd('0x10'));var Papa=require(_0x33bd('0x11'));var Redis=require(_0x33bd('0x12'));var authService=require(_0x33bd('0x13'));var qs=require(_0x33bd('0x14'));var as=require(_0x33bd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33bd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x33bd('0x17'));var licenseUtil=require(_0x33bd('0x18'));var db=require(_0x33bd('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x226997,_0x3d7ebe){_0x3d7ebe=_0x3d7ebe||0xcc;return function(_0x58d92b){if(_0x58d92b){return _0x226997[_0x33bd('0x1a')](_0x3d7ebe);}return _0x226997[_0x33bd('0x1b')](_0x3d7ebe)[_0x33bd('0x1c')]();};}function respondWithResult(_0x2c84d9,_0xe2f16c){_0xe2f16c=_0xe2f16c||0xc8;return function(_0xd6cbb4){if(_0xd6cbb4){return _0x2c84d9[_0x33bd('0x1b')](_0xe2f16c)['json'](_0xd6cbb4);}};}function respondWithFilteredResult(_0x2c0932,_0x567141){return function(_0xbaa28e){if(_0xbaa28e){var _0x3d4896=typeof _0x567141['offset']===_0x33bd('0x1d')&&typeof _0x567141['limit']===_0x33bd('0x1d');var _0x91a901=_0xbaa28e[_0x33bd('0x1e')];var _0x3c6c88=_0x3d4896?0x0:_0x567141['offset'];var _0x5574f3=_0x3d4896?_0xbaa28e[_0x33bd('0x1e')]:_0x567141[_0x33bd('0x1f')]+_0x567141['limit'];var _0x1c387d;if(_0x5574f3>=_0x91a901){_0x5574f3=_0x91a901;_0x1c387d=0xc8;}else{_0x1c387d=0xce;}_0x2c0932[_0x33bd('0x1b')](_0x1c387d);return _0x2c0932[_0x33bd('0x20')](_0x33bd('0x21'),_0x3c6c88+'-'+_0x5574f3+'/'+_0x91a901)['json'](_0xbaa28e);}return null;};}function patchUpdates(_0x43b582){return function(_0x9f4c87){try{jsonpatch['apply'](_0x9f4c87,_0x43b582,!![]);}catch(_0x729277){return BPromise[_0x33bd('0x22')](_0x729277);}return _0x9f4c87['save']();};}function saveUpdates(_0x5c2162,_0x108a4a){return function(_0x55d64e){if(_0x55d64e){return _0x55d64e['update'](_0x5c2162)[_0x33bd('0x23')](function(_0xbd46b6){return _0xbd46b6;});}return null;};}function removeEntity(_0x67461d,_0x5e3f7a){return function(_0x502d8b){if(_0x502d8b){return _0x502d8b[_0x33bd('0x24')]()[_0x33bd('0x23')](function(){_0x67461d[_0x33bd('0x1b')](0xcc)[_0x33bd('0x1c')]();});}};}function handleEntityNotFound(_0x1dc63a,_0x2e25db){return function(_0xd53740){if(!_0xd53740){_0x1dc63a['sendStatus'](0x194);}return _0xd53740;};}function handleError(_0x1b2f53,_0x591123){_0x591123=_0x591123||0x1f4;return function(_0x587b3d){logger[_0x33bd('0x25')](_0x587b3d['stack']);if(_0x587b3d['name']){delete _0x587b3d[_0x33bd('0x26')];}_0x1b2f53[_0x33bd('0x1b')](_0x591123)[_0x33bd('0x27')](_0x587b3d);};}exports[_0x33bd('0x28')]=function(_0x362571,_0x276e18){var _0x407703={},_0x480c74={},_0x4161c7={'count':0x0,'rows':[]};var _0x499be6=_[_0x33bd('0x29')](db[_0x33bd('0x2a')][_0x33bd('0x2b')],function(_0x4f323b){return{'name':_0x4f323b['fieldName'],'type':_0x4f323b['type'][_0x33bd('0x2c')]};});_0x480c74[_0x33bd('0x2d')]=_[_0x33bd('0x29')](_0x499be6,_0x33bd('0x26'));_0x480c74[_0x33bd('0x2e')]=_[_0x33bd('0x2f')](_0x362571['query']);_0x480c74[_0x33bd('0x30')]=_[_0x33bd('0x31')](_0x480c74['model'],_0x480c74[_0x33bd('0x2e')]);_0x407703[_0x33bd('0x32')]=_['intersection'](_0x480c74[_0x33bd('0x2d')],qs['fields'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x33')]));_0x407703[_0x33bd('0x32')]=_0x407703[_0x33bd('0x32')][_0x33bd('0x34')]?_0x407703['attributes']:_0x480c74['model'];if(!_0x362571['query']['hasOwnProperty'](_0x33bd('0x35'))){_0x407703['limit']=qs['limit'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x36')]);_0x407703[_0x33bd('0x1f')]=qs['offset'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x1f')]);}_0x407703[_0x33bd('0x37')]=qs['sort'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x38')]);_0x407703['where']=qs[_0x33bd('0x30')](_[_0x33bd('0x39')](_0x362571['query'],_0x480c74[_0x33bd('0x30')]),_0x499be6);if(_0x362571[_0x33bd('0x2e')][_0x33bd('0x3a')]){_0x407703[_0x33bd('0x3b')]=_[_0x33bd('0x3c')](_0x407703[_0x33bd('0x3b')],{'$or':_[_0x33bd('0x29')](_0x499be6,function(_0x17bef1){if(_0x17bef1[_0x33bd('0x3d')]!==_0x33bd('0x3e')){var _0xb1ff6={};_0xb1ff6[_0x17bef1['name']]={'$like':'%'+_0x362571[_0x33bd('0x2e')][_0x33bd('0x3a')]+'%'};return _0xb1ff6;}})});}_0x407703=_[_0x33bd('0x3c')]({},_0x407703,_0x362571[_0x33bd('0x3f')]);var _0x5bc65e={'where':_0x407703[_0x33bd('0x3b')]};return db[_0x33bd('0x2a')]['count'](_0x5bc65e)[_0x33bd('0x23')](function(_0x11f1cc){_0x4161c7[_0x33bd('0x1e')]=_0x11f1cc;if(_0x362571[_0x33bd('0x2e')][_0x33bd('0x40')]){_0x407703[_0x33bd('0x41')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x33bd('0x42')](_0x407703);})['then'](function(_0x1f12ae){_0x4161c7[_0x33bd('0x43')]=_0x1f12ae;return _0x4161c7;})['then'](respondWithFilteredResult(_0x276e18,_0x407703))[_0x33bd('0x44')](handleError(_0x276e18,null));};exports[_0x33bd('0x45')]=function(_0x16e1e7,_0x7268b){var _0x2e4e0d={'raw':![],'where':{'id':_0x16e1e7[_0x33bd('0x46')]['id']}},_0x340a0a={};_0x340a0a[_0x33bd('0x2d')]=_['keys'](db[_0x33bd('0x2a')][_0x33bd('0x2b')]);_0x340a0a['query']=_[_0x33bd('0x2f')](_0x16e1e7['query']);_0x340a0a[_0x33bd('0x30')]=_[_0x33bd('0x31')](_0x340a0a[_0x33bd('0x2d')],_0x340a0a[_0x33bd('0x2e')]);_0x2e4e0d['attributes']=_[_0x33bd('0x31')](_0x340a0a[_0x33bd('0x2d')],qs[_0x33bd('0x33')](_0x16e1e7[_0x33bd('0x2e')][_0x33bd('0x33')]));_0x2e4e0d['attributes']=_0x2e4e0d['attributes'][_0x33bd('0x34')]?_0x2e4e0d['attributes']:_0x340a0a[_0x33bd('0x2d')];if(_0x16e1e7[_0x33bd('0x2e')]['includeAll']){_0x2e4e0d['include']=[{'all':!![]}];}_0x2e4e0d=_[_0x33bd('0x3c')]({},_0x2e4e0d,_0x16e1e7['options']);return db['SugarcrmAccount'][_0x33bd('0x47')](_0x2e4e0d)[_0x33bd('0x23')](handleEntityNotFound(_0x7268b,null))[_0x33bd('0x23')](respondWithResult(_0x7268b,null))[_0x33bd('0x44')](handleError(_0x7268b,null));};exports['create']=function(_0x1ab987,_0x4cc054){return db[_0x33bd('0x2a')][_0x33bd('0x48')](_0x1ab987[_0x33bd('0x49')],{})[_0x33bd('0x23')](respondWithResult(_0x4cc054,0xc9))[_0x33bd('0x44')](handleError(_0x4cc054,null));};exports[_0x33bd('0x4a')]=function(_0x29a6d6,_0x20d212){if(_0x29a6d6[_0x33bd('0x49')]['id']){delete _0x29a6d6['body']['id'];}return db[_0x33bd('0x2a')][_0x33bd('0x47')]({'where':{'id':_0x29a6d6['params']['id']}})[_0x33bd('0x23')](handleEntityNotFound(_0x20d212,null))[_0x33bd('0x23')](saveUpdates(_0x29a6d6[_0x33bd('0x49')],null))[_0x33bd('0x23')](respondWithResult(_0x20d212,null))[_0x33bd('0x44')](handleError(_0x20d212,null));};exports[_0x33bd('0x24')]=function(_0x51400a,_0x414490){return db[_0x33bd('0x2a')][_0x33bd('0x47')]({'where':{'id':_0x51400a['params']['id']}})['then'](handleEntityNotFound(_0x414490,null))[_0x33bd('0x23')](removeEntity(_0x414490,null))['catch'](handleError(_0x414490,null));};exports[_0x33bd('0x4b')]=function(_0xe18f6b,_0x17f0ec,_0x12cc4b){var _0x27ff11={};var _0x346635={};var _0x286770;var _0x43ed17;return db['SugarcrmAccount'][_0x33bd('0x4c')]({'where':{'id':_0xe18f6b[_0x33bd('0x46')]['id']}})[_0x33bd('0x23')](handleEntityNotFound(_0x17f0ec,null))[_0x33bd('0x23')](function(_0x2f4146){if(_0x2f4146){_0x286770=_0x2f4146;_0x346635[_0x33bd('0x2d')]=_[_0x33bd('0x2f')](db[_0x33bd('0x4d')]['rawAttributes']);_0x346635[_0x33bd('0x2e')]=_[_0x33bd('0x2f')](_0xe18f6b[_0x33bd('0x2e')]);_0x346635['filters']=_['intersection'](_0x346635['model'],_0x346635[_0x33bd('0x2e')]);_0x27ff11[_0x33bd('0x32')]=_['intersection'](_0x346635[_0x33bd('0x2d')],qs[_0x33bd('0x33')](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x33')]));_0x27ff11['attributes']=_0x27ff11[_0x33bd('0x32')]['length']?_0x27ff11[_0x33bd('0x32')]:_0x346635[_0x33bd('0x2d')];_0x27ff11[_0x33bd('0x37')]=qs['sort'](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x38')]);_0x27ff11[_0x33bd('0x3b')]=qs[_0x33bd('0x30')](_[_0x33bd('0x39')](_0xe18f6b['query'],_0x346635[_0x33bd('0x30')]));if(_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x3a')]){_0x27ff11[_0x33bd('0x3b')]=_[_0x33bd('0x3c')](_0x27ff11[_0x33bd('0x3b')],{'$or':_[_0x33bd('0x29')](_0x27ff11[_0x33bd('0x32')],function(_0x4eaa2c){var _0x41abc8={};_0x41abc8[_0x4eaa2c]={'$like':'%'+_0xe18f6b['query'][_0x33bd('0x3a')]+'%'};return _0x41abc8;})});}_0x27ff11=_[_0x33bd('0x3c')]({},_0x27ff11,_0xe18f6b['options']);return _0x286770[_0x33bd('0x4b')](_0x27ff11);}})['then'](function(_0x48f400){if(_0x48f400){_0x43ed17=_0x48f400[_0x33bd('0x34')];if(!_0xe18f6b['query'][_0x33bd('0x4e')](_0x33bd('0x35'))){_0x27ff11[_0x33bd('0x36')]=qs['limit'](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x36')]);_0x27ff11[_0x33bd('0x1f')]=qs[_0x33bd('0x1f')](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x1f')]);}return _0x286770[_0x33bd('0x4b')](_0x27ff11);}})[_0x33bd('0x23')](function(_0x35748d){if(_0x35748d){return _0x35748d?{'count':_0x43ed17,'rows':_0x35748d}:null;}})['then'](respondWithResult(_0x17f0ec,null))['catch'](handleError(_0x17f0ec,null));};exports[_0x33bd('0x4f')]=function(_0x2f23d7,_0x335134,_0x49542b){if(_0x2f23d7[_0x33bd('0x49')]['id']){delete _0x2f23d7['body']['id'];}return db[_0x33bd('0x2a')][_0x33bd('0x4c')]({'where':{'id':_0x2f23d7[_0x33bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x335134,null))[_0x33bd('0x23')](function(_0x4ec689){if(_0x4ec689){_0x2f23d7[_0x33bd('0x49')][_0x33bd('0x50')]=_0x4ec689['id'];_0x2f23d7['body'][_0x33bd('0x51')]=integrations['getSubjects'](_0x2f23d7[_0x33bd('0x49')]['channel'],_0x2f23d7[_0x33bd('0x49')][_0x33bd('0x3d')]);_0x2f23d7['body'][_0x33bd('0x52')]=integrations[_0x33bd('0x53')](_0x2f23d7[_0x33bd('0x49')]['channel'],_0x2f23d7[_0x33bd('0x49')][_0x33bd('0x3d')]);return db[_0x33bd('0x4d')][_0x33bd('0x48')](_0x2f23d7['body'],{'include':[{'model':db[_0x33bd('0x54')],'as':_0x33bd('0x51')},{'model':db[_0x33bd('0x54')],'as':_0x33bd('0x52')}]});}return null;})['then'](respondWithResult(_0x335134,null))[_0x33bd('0x44')](handleError(_0x335134,null));};exports[_0x33bd('0x55')]=function(_0x385f12,_0x4700c8,_0xf3af12){var _0x10e697='';var _0x5a1595=['id','name',_0x33bd('0x56'),_0x33bd('0x57'),_0x33bd('0x58'),_0x33bd('0x59'),'duration_hours',_0x33bd('0x5a'),_0x33bd('0x5b'),'parent_type',_0x33bd('0x5c'),_0x33bd('0x5d')];return db[_0x33bd('0x2a')][_0x33bd('0x4c')]({'where':{'id':_0x385f12['params']['id']},'attributes':['id',_0x33bd('0x5e'),_0x33bd('0x5f'),_0x33bd('0x60')]})['then'](handleEntityNotFound(_0x4700c8,null))[_0x33bd('0x23')](function(_0x1dedd0){if(_0x1dedd0){_0x10e697=_0x1dedd0[_0x33bd('0x60')];var _0x376899=_0x10e697[_0x33bd('0x61')](-0x1);if(_0x376899==='/'){_0x10e697=_0x10e697['substring'](0x0,_0x10e697[_0x33bd('0x62')](_0x376899));}return rp({'method':_0x33bd('0x63'),'uri':util['format']('%s%s',_0x10e697,_0x33bd('0x64')),'json':!![],'form':{'method':_0x33bd('0x65'),'input_type':_0x33bd('0x66'),'response_type':_0x33bd('0x66'),'rest_data':JSON[_0x33bd('0x67')]({'user_auth':{'user_name':_0x1dedd0[_0x33bd('0x5e')],'password':_0x1dedd0['password'],'encryption':_0x33bd('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x467c26){if(_0x467c26&&_0x467c26[_0x33bd('0x26')]!==_0x33bd('0x69')&&_0x467c26['name']!=='Password\x20Expired'){return rp({'method':_0x33bd('0x63'),'uri':util['format'](_0x33bd('0x6a'),_0x10e697,_0x33bd('0x64')),'json':!![],'form':{'method':_0x33bd('0x6b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x33bd('0x67')]({'session':_0x467c26['id'],'module_name':'Calls'})}})[_0x33bd('0x23')](function(_0x107cec){if(_0x107cec){var _0x49dfde=_[_0x33bd('0x6c')](_0x107cec[_0x33bd('0x6d')]);_[_0x33bd('0x6e')](_0x49dfde,function(_0x2178c7){return _0x5a1595['includes'](_0x2178c7['name']);});return{'count':_0x49dfde['length'],'rows':_[_0x33bd('0x29')](_0x49dfde,function(_0xd2c7d1){return{'id':_0xd2c7d1[_0x33bd('0x26')],'name':_0xd2c7d1[_0x33bd('0x6f')],'custom':_[_0x33bd('0x70')](_0xd2c7d1[_0x33bd('0x26')],'_c')?!![]:![],'options':_0xd2c7d1[_0x33bd('0x3f')]?_[_0x33bd('0x29')](_['values'](_0xd2c7d1[_0x33bd('0x3f')]),function(_0x4e7d18){return{'name':_0x4e7d18[_0x33bd('0x71')],'value':_0x4e7d18[_0x33bd('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x4700c8,null))[_0x33bd('0x44')](function(_0x4fafcd){var _0x1f1050=_0x385f12[_0x33bd('0x2e')][_0x33bd('0x72')]?0x1f4:_0x4fafcd[_0x33bd('0x73')]||0x1f4;logger[_0x33bd('0x25')](_0x33bd('0x74'),_0x33bd('0x55'),_0x1f1050,JSON['stringify'](_0x4fafcd));delete _0x4fafcd['name'];if(_0x1f1050===0x191){_0x1f1050=0x190;}_0x4700c8[_0x33bd('0x1b')](_0x1f1050)['send'](_0x385f12[_0x33bd('0x2e')][_0x33bd('0x72')]?{'message':_0x33bd('0x75'),'statusCode':_0x4fafcd[_0x33bd('0x73')]}:_0x4fafcd);});}else{var _0x15f768=0x1f4;_0x4700c8[_0x33bd('0x1b')](_0x15f768)[_0x33bd('0x27')]({'message':_0x33bd('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8c17=['Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','findOne','username','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','destroy','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','update','getConfigurations','nolimit','addConfiguration','AccountId'];(function(_0xc15821,_0x507db7){var _0x54a35c=function(_0x2994f9){while(--_0x2994f9){_0xc15821['push'](_0xc15821['shift']());}};_0x54a35c(++_0x507db7);}(_0x8c17,0xa1));var _0x78c1=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x8c17[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78c1('0x1'));var rp=require(_0x78c1('0x2'));var moment=require(_0x78c1('0x3'));var BPromise=require(_0x78c1('0x4'));var Mustache=require(_0x78c1('0x5'));var util=require(_0x78c1('0x6'));var path=require(_0x78c1('0x7'));var sox=require(_0x78c1('0x8'));var csv=require(_0x78c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78c1('0xa'));var _=require(_0x78c1('0xb'));var squel=require(_0x78c1('0xc'));var crypto=require('crypto');var jsforce=require(_0x78c1('0xd'));var deskjs=require(_0x78c1('0xe'));var toCsv=require(_0x78c1('0x9'));var querystring=require('querystring');var Papa=require(_0x78c1('0xf'));var Redis=require(_0x78c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x78c1('0x11'));var as=require(_0x78c1('0x12'));var hardwareService=require(_0x78c1('0x13'));var logger=require('../../config/logger')(_0x78c1('0x14'));var utils=require(_0x78c1('0x15'));var config=require(_0x78c1('0x16'));var licenseUtil=require(_0x78c1('0x17'));var db=require(_0x78c1('0x18'))['db'];var integrations=require(_0x78c1('0x19'));function respondWithStatusCode(_0x15be6f,_0x4e096a){_0x4e096a=_0x4e096a||0xcc;return function(_0x5dff44){if(_0x5dff44){return _0x15be6f[_0x78c1('0x1a')](_0x4e096a);}return _0x15be6f[_0x78c1('0x1b')](_0x4e096a)['end']();};}function respondWithResult(_0x438601,_0x46d3de){_0x46d3de=_0x46d3de||0xc8;return function(_0x14360b){if(_0x14360b){return _0x438601['status'](_0x46d3de)[_0x78c1('0x1c')](_0x14360b);}};}function respondWithFilteredResult(_0x22c9ea,_0x446c72){return function(_0x4aa0ad){if(_0x4aa0ad){var _0x5b62e6=typeof _0x446c72[_0x78c1('0x1d')]===_0x78c1('0x1e')&&typeof _0x446c72[_0x78c1('0x1f')]===_0x78c1('0x1e');var _0x49205d=_0x4aa0ad['count'];var _0xa42d31=_0x5b62e6?0x0:_0x446c72['offset'];var _0x5ceb77=_0x5b62e6?_0x4aa0ad['count']:_0x446c72[_0x78c1('0x1d')]+_0x446c72['limit'];var _0x176a22;if(_0x5ceb77>=_0x49205d){_0x5ceb77=_0x49205d;_0x176a22=0xc8;}else{_0x176a22=0xce;}_0x22c9ea[_0x78c1('0x1b')](_0x176a22);return _0x22c9ea[_0x78c1('0x20')](_0x78c1('0x21'),_0xa42d31+'-'+_0x5ceb77+'/'+_0x49205d)[_0x78c1('0x1c')](_0x4aa0ad);}return null;};}function patchUpdates(_0x41af59){return function(_0x2a6736){try{jsonpatch['apply'](_0x2a6736,_0x41af59,!![]);}catch(_0x115981){return BPromise['reject'](_0x115981);}return _0x2a6736['save']();};}function saveUpdates(_0x5d1509,_0x10ea0b){return function(_0x58f1f8){if(_0x58f1f8){return _0x58f1f8['update'](_0x5d1509)['then'](function(_0x3c18bd){return _0x3c18bd;});}return null;};}function removeEntity(_0x297034,_0x1ac89e){return function(_0x14590d){if(_0x14590d){return _0x14590d[_0x78c1('0x22')]()[_0x78c1('0x23')](function(){_0x297034[_0x78c1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3680f1,_0x4aa825){return function(_0x1bd6e1){if(!_0x1bd6e1){_0x3680f1[_0x78c1('0x1a')](0x194);}return _0x1bd6e1;};}function handleError(_0x4159eb,_0x2ffab9){_0x2ffab9=_0x2ffab9||0x1f4;return function(_0x1ff230){logger[_0x78c1('0x24')](_0x1ff230[_0x78c1('0x25')]);if(_0x1ff230[_0x78c1('0x26')]){delete _0x1ff230[_0x78c1('0x26')];}_0x4159eb[_0x78c1('0x1b')](_0x2ffab9)[_0x78c1('0x27')](_0x1ff230);};}exports[_0x78c1('0x28')]=function(_0x3b51ca,_0xfd71c6){var _0x8a4963={},_0x10c063={},_0x995777={'count':0x0,'rows':[]};var _0x55dd1d=_[_0x78c1('0x29')](db[_0x78c1('0x2a')][_0x78c1('0x2b')],function(_0x177020){return{'name':_0x177020[_0x78c1('0x2c')],'type':_0x177020[_0x78c1('0x2d')]['key']};});_0x10c063['model']=_[_0x78c1('0x29')](_0x55dd1d,'name');_0x10c063[_0x78c1('0x2e')]=_[_0x78c1('0x2f')](_0x3b51ca[_0x78c1('0x2e')]);_0x10c063[_0x78c1('0x30')]=_[_0x78c1('0x31')](_0x10c063['model'],_0x10c063[_0x78c1('0x2e')]);_0x8a4963[_0x78c1('0x32')]=_['intersection'](_0x10c063['model'],qs[_0x78c1('0x33')](_0x3b51ca['query'][_0x78c1('0x33')]));_0x8a4963[_0x78c1('0x32')]=_0x8a4963['attributes']['length']?_0x8a4963[_0x78c1('0x32')]:_0x10c063[_0x78c1('0x34')];if(!_0x3b51ca['query'][_0x78c1('0x35')]('nolimit')){_0x8a4963[_0x78c1('0x1f')]=qs['limit'](_0x3b51ca[_0x78c1('0x2e')][_0x78c1('0x1f')]);_0x8a4963['offset']=qs[_0x78c1('0x1d')](_0x3b51ca[_0x78c1('0x2e')][_0x78c1('0x1d')]);}_0x8a4963['order']=qs[_0x78c1('0x36')](_0x3b51ca['query'][_0x78c1('0x36')]);_0x8a4963[_0x78c1('0x37')]=qs[_0x78c1('0x30')](_[_0x78c1('0x38')](_0x3b51ca[_0x78c1('0x2e')],_0x10c063[_0x78c1('0x30')]),_0x55dd1d);if(_0x3b51ca[_0x78c1('0x2e')]['filter']){_0x8a4963[_0x78c1('0x37')]=_[_0x78c1('0x39')](_0x8a4963[_0x78c1('0x37')],{'$or':_[_0x78c1('0x29')](_0x55dd1d,function(_0x196fc1){if(_0x196fc1['type']!==_0x78c1('0x3a')){var _0x31fbb6={};_0x31fbb6[_0x196fc1['name']]={'$like':'%'+_0x3b51ca[_0x78c1('0x2e')][_0x78c1('0x3b')]+'%'};return _0x31fbb6;}})});}_0x8a4963=_['merge']({},_0x8a4963,_0x3b51ca['options']);var _0x480ad5={'where':_0x8a4963[_0x78c1('0x37')]};return db[_0x78c1('0x2a')][_0x78c1('0x3c')](_0x480ad5)[_0x78c1('0x23')](function(_0x143b4d){_0x995777[_0x78c1('0x3c')]=_0x143b4d;if(_0x3b51ca['query'][_0x78c1('0x3d')]){_0x8a4963[_0x78c1('0x3e')]=[{'all':!![]}];}return db[_0x78c1('0x2a')][_0x78c1('0x3f')](_0x8a4963);})[_0x78c1('0x23')](function(_0x26e4c6){_0x995777[_0x78c1('0x40')]=_0x26e4c6;return _0x995777;})[_0x78c1('0x23')](respondWithFilteredResult(_0xfd71c6,_0x8a4963))[_0x78c1('0x41')](handleError(_0xfd71c6,null));};exports['show']=function(_0x4c0f77,_0xd4f821){var _0x13b670={'raw':![],'where':{'id':_0x4c0f77[_0x78c1('0x42')]['id']}},_0x5b896f={};_0x5b896f[_0x78c1('0x34')]=_[_0x78c1('0x2f')](db[_0x78c1('0x2a')][_0x78c1('0x2b')]);_0x5b896f['query']=_[_0x78c1('0x2f')](_0x4c0f77[_0x78c1('0x2e')]);_0x5b896f['filters']=_['intersection'](_0x5b896f[_0x78c1('0x34')],_0x5b896f[_0x78c1('0x2e')]);_0x13b670['attributes']=_['intersection'](_0x5b896f[_0x78c1('0x34')],qs[_0x78c1('0x33')](_0x4c0f77['query']['fields']));_0x13b670[_0x78c1('0x32')]=_0x13b670[_0x78c1('0x32')][_0x78c1('0x43')]?_0x13b670['attributes']:_0x5b896f[_0x78c1('0x34')];if(_0x4c0f77[_0x78c1('0x2e')][_0x78c1('0x3d')]){_0x13b670[_0x78c1('0x3e')]=[{'all':!![]}];}_0x13b670=_[_0x78c1('0x39')]({},_0x13b670,_0x4c0f77[_0x78c1('0x44')]);return db[_0x78c1('0x2a')][_0x78c1('0x45')](_0x13b670)[_0x78c1('0x23')](handleEntityNotFound(_0xd4f821,null))[_0x78c1('0x23')](respondWithResult(_0xd4f821,null))[_0x78c1('0x41')](handleError(_0xd4f821,null));};exports[_0x78c1('0x46')]=function(_0x3f50e4,_0x4a018d){return db[_0x78c1('0x2a')][_0x78c1('0x46')](_0x3f50e4[_0x78c1('0x47')],{})[_0x78c1('0x23')](respondWithResult(_0x4a018d,0xc9))['catch'](handleError(_0x4a018d,null));};exports[_0x78c1('0x48')]=function(_0x4a5a81,_0x2fda69){if(_0x4a5a81[_0x78c1('0x47')]['id']){delete _0x4a5a81['body']['id'];}return db[_0x78c1('0x2a')][_0x78c1('0x45')]({'where':{'id':_0x4a5a81[_0x78c1('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fda69,null))[_0x78c1('0x23')](saveUpdates(_0x4a5a81['body'],null))['then'](respondWithResult(_0x2fda69,null))[_0x78c1('0x41')](handleError(_0x2fda69,null));};exports[_0x78c1('0x22')]=function(_0x481e38,_0x38659e){return db['SugarcrmAccount'][_0x78c1('0x45')]({'where':{'id':_0x481e38[_0x78c1('0x42')]['id']}})[_0x78c1('0x23')](handleEntityNotFound(_0x38659e,null))[_0x78c1('0x23')](removeEntity(_0x38659e,null))[_0x78c1('0x41')](handleError(_0x38659e,null));};exports[_0x78c1('0x49')]=function(_0x2f7042,_0x23e3b8,_0x404f0b){var _0x51b89c={};var _0x2afde3={};var _0x4075ce;var _0x3fce01;return db[_0x78c1('0x2a')]['findOne']({'where':{'id':_0x2f7042['params']['id']}})[_0x78c1('0x23')](handleEntityNotFound(_0x23e3b8,null))['then'](function(_0x8321d8){if(_0x8321d8){_0x4075ce=_0x8321d8;_0x2afde3[_0x78c1('0x34')]=_[_0x78c1('0x2f')](db['SugarcrmConfiguration']['rawAttributes']);_0x2afde3['query']=_[_0x78c1('0x2f')](_0x2f7042[_0x78c1('0x2e')]);_0x2afde3[_0x78c1('0x30')]=_[_0x78c1('0x31')](_0x2afde3[_0x78c1('0x34')],_0x2afde3[_0x78c1('0x2e')]);_0x51b89c['attributes']=_[_0x78c1('0x31')](_0x2afde3[_0x78c1('0x34')],qs[_0x78c1('0x33')](_0x2f7042[_0x78c1('0x2e')][_0x78c1('0x33')]));_0x51b89c['attributes']=_0x51b89c['attributes'][_0x78c1('0x43')]?_0x51b89c[_0x78c1('0x32')]:_0x2afde3[_0x78c1('0x34')];_0x51b89c['order']=qs[_0x78c1('0x36')](_0x2f7042[_0x78c1('0x2e')][_0x78c1('0x36')]);_0x51b89c[_0x78c1('0x37')]=qs[_0x78c1('0x30')](_[_0x78c1('0x38')](_0x2f7042[_0x78c1('0x2e')],_0x2afde3['filters']));if(_0x2f7042['query'][_0x78c1('0x3b')]){_0x51b89c[_0x78c1('0x37')]=_[_0x78c1('0x39')](_0x51b89c['where'],{'$or':_[_0x78c1('0x29')](_0x51b89c[_0x78c1('0x32')],function(_0x41ab33){var _0x51e219={};_0x51e219[_0x41ab33]={'$like':'%'+_0x2f7042[_0x78c1('0x2e')]['filter']+'%'};return _0x51e219;})});}_0x51b89c=_['merge']({},_0x51b89c,_0x2f7042['options']);return _0x4075ce[_0x78c1('0x49')](_0x51b89c);}})['then'](function(_0x1840ee){if(_0x1840ee){_0x3fce01=_0x1840ee[_0x78c1('0x43')];if(!_0x2f7042[_0x78c1('0x2e')][_0x78c1('0x35')](_0x78c1('0x4a'))){_0x51b89c[_0x78c1('0x1f')]=qs[_0x78c1('0x1f')](_0x2f7042['query'][_0x78c1('0x1f')]);_0x51b89c[_0x78c1('0x1d')]=qs[_0x78c1('0x1d')](_0x2f7042[_0x78c1('0x2e')][_0x78c1('0x1d')]);}return _0x4075ce[_0x78c1('0x49')](_0x51b89c);}})['then'](function(_0x1b5164){if(_0x1b5164){return _0x1b5164?{'count':_0x3fce01,'rows':_0x1b5164}:null;}})[_0x78c1('0x23')](respondWithResult(_0x23e3b8,null))[_0x78c1('0x41')](handleError(_0x23e3b8,null));};exports[_0x78c1('0x4b')]=function(_0x3668bc,_0x2fc7a9,_0x237346){if(_0x3668bc[_0x78c1('0x47')]['id']){delete _0x3668bc[_0x78c1('0x47')]['id'];}return db[_0x78c1('0x2a')]['findOne']({'where':{'id':_0x3668bc[_0x78c1('0x42')]['id']}})[_0x78c1('0x23')](handleEntityNotFound(_0x2fc7a9,null))[_0x78c1('0x23')](function(_0x5c70b3){if(_0x5c70b3){_0x3668bc[_0x78c1('0x47')][_0x78c1('0x4c')]=_0x5c70b3['id'];_0x3668bc[_0x78c1('0x47')][_0x78c1('0x4d')]=integrations[_0x78c1('0x4e')](_0x3668bc[_0x78c1('0x47')][_0x78c1('0x4f')],_0x3668bc['body'][_0x78c1('0x2d')]);_0x3668bc[_0x78c1('0x47')][_0x78c1('0x50')]=integrations[_0x78c1('0x51')](_0x3668bc['body'][_0x78c1('0x4f')],_0x3668bc[_0x78c1('0x47')][_0x78c1('0x2d')]);return db[_0x78c1('0x52')][_0x78c1('0x46')](_0x3668bc[_0x78c1('0x47')],{'include':[{'model':db['SugarcrmField'],'as':_0x78c1('0x4d')},{'model':db[_0x78c1('0x53')],'as':'Descriptions'}]});}return null;})[_0x78c1('0x23')](respondWithResult(_0x2fc7a9,null))[_0x78c1('0x41')](handleError(_0x2fc7a9,null));};exports['getFields']=function(_0x58e45f,_0x249a7f,_0x140336){var _0x18640c='';var _0x180470=['id',_0x78c1('0x26'),_0x78c1('0x54'),'created_by','description',_0x78c1('0x55'),_0x78c1('0x56'),_0x78c1('0x57'),_0x78c1('0x58'),'parent_type',_0x78c1('0x59'),_0x78c1('0x5a')];return db[_0x78c1('0x2a')][_0x78c1('0x5b')]({'where':{'id':_0x58e45f['params']['id']},'attributes':['id',_0x78c1('0x5c'),_0x78c1('0x5d'),_0x78c1('0x5e')]})[_0x78c1('0x23')](handleEntityNotFound(_0x249a7f,null))[_0x78c1('0x23')](function(_0x7b4eda){if(_0x7b4eda){_0x18640c=_0x7b4eda['remoteUri'];var _0x2e2af4=_0x18640c[_0x78c1('0x5f')](-0x1);if(_0x2e2af4==='/'){_0x18640c=_0x18640c['substring'](0x0,_0x18640c[_0x78c1('0x60')](_0x2e2af4));}return rp({'method':_0x78c1('0x61'),'uri':util['format'](_0x78c1('0x62'),_0x18640c,_0x78c1('0x63')),'json':!![],'form':{'method':_0x78c1('0x64'),'input_type':_0x78c1('0x65'),'response_type':'JSON','rest_data':JSON[_0x78c1('0x66')]({'user_auth':{'user_name':_0x7b4eda[_0x78c1('0x5c')],'password':_0x7b4eda['password'],'encryption':'PLAIN'},'application':_0x78c1('0x67')})}});}})[_0x78c1('0x23')](function(_0x1362d3){if(_0x1362d3&&_0x1362d3[_0x78c1('0x26')]!==_0x78c1('0x68')&&_0x1362d3['name']!==_0x78c1('0x69')){return rp({'method':_0x78c1('0x61'),'uri':util['format']('%s%s',_0x18640c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x78c1('0x6a'),'input_type':_0x78c1('0x65'),'response_type':_0x78c1('0x65'),'rest_data':JSON[_0x78c1('0x66')]({'session':_0x1362d3['id'],'module_name':'Calls'})}})[_0x78c1('0x23')](function(_0x45c86f){if(_0x45c86f){var _0x11572d=_[_0x78c1('0x6b')](_0x45c86f[_0x78c1('0x6c')]);_[_0x78c1('0x6d')](_0x11572d,function(_0x3fec5f){return _0x180470[_0x78c1('0x6e')](_0x3fec5f[_0x78c1('0x26')]);});return{'count':_0x11572d[_0x78c1('0x43')],'rows':_[_0x78c1('0x29')](_0x11572d,function(_0x2382f4){return{'id':_0x2382f4['name'],'name':_0x2382f4[_0x78c1('0x6f')],'custom':_[_0x78c1('0x70')](_0x2382f4[_0x78c1('0x26')],'_c')?!![]:![],'options':_0x2382f4['options']?_['map'](_[_0x78c1('0x6b')](_0x2382f4[_0x78c1('0x44')]),function(_0x21eef0){return{'name':_0x21eef0[_0x78c1('0x71')],'value':_0x21eef0[_0x78c1('0x26')]};}):[]};})};}})[_0x78c1('0x23')](respondWithResult(_0x249a7f,null))[_0x78c1('0x41')](function(_0x182ff8){var _0x2ba19a=_0x58e45f[_0x78c1('0x2e')][_0x78c1('0x72')]?0x1f4:_0x182ff8[_0x78c1('0x73')]||0x1f4;logger[_0x78c1('0x24')](_0x78c1('0x74'),_0x78c1('0x75'),_0x2ba19a,JSON[_0x78c1('0x66')](_0x182ff8));delete _0x182ff8[_0x78c1('0x26')];if(_0x2ba19a===0x191){_0x2ba19a=0x190;}_0x249a7f[_0x78c1('0x1b')](_0x2ba19a)[_0x78c1('0x27')](_0x58e45f[_0x78c1('0x2e')][_0x78c1('0x72')]?{'message':_0x78c1('0x76'),'statusCode':_0x182ff8[_0x78c1('0x73')]}:_0x182ff8);});}else{var _0x2a51b9=0x1f4;_0x249a7f[_0x78c1('0x1b')](_0x2a51b9)[_0x78c1('0x27')]({'message':_0x78c1('0x76'),'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 b2a9534..54846fa 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 _0xfb10=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb10,0x191));var _0x0fb1=function(_0x12f70f,_0x1bf532){_0x12f70f=_0x12f70f-0x0;var _0x1f742c=_0xfb10[_0x12f70f];return _0x1f742c;};'use strict';var _=require('lodash');var util=require(_0x0fb1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0fb1('0x1'));var BPromise=require(_0x0fb1('0x2'));var rp=require(_0x0fb1('0x3'));var fs=require('fs');var path=require(_0x0fb1('0x4'));var rimraf=require(_0x0fb1('0x5'));var config=require(_0x0fb1('0x6'));var attributes=require(_0x0fb1('0x7'));var integrations=require(_0x0fb1('0x8'));module[_0x0fb1('0x9')]=function(_0x94d0ed,_0x3c55e9){return _0x94d0ed[_0x0fb1('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x0fb1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28cd=['define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x28cd,0x177));var _0xd28c=function(_0x29e500,_0x3ee7f3){_0x29e500=_0x29e500-0x0;var _0x3ed816=_0x28cd[_0x29e500];return _0x3ed816;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd28c('0x0'))(_0xd28c('0x1'));var moment=require(_0xd28c('0x2'));var BPromise=require(_0xd28c('0x3'));var rp=require(_0xd28c('0x4'));var fs=require('fs');var path=require(_0xd28c('0x5'));var rimraf=require(_0xd28c('0x6'));var config=require(_0xd28c('0x7'));var attributes=require(_0xd28c('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5d2fc2,_0x28dc1c){return _0x5d2fc2[_0xd28c('0x9')](_0xd28c('0xa'),attributes,{'tableName':_0xd28c('0xb'),'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 bd817c8..816e16d 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 _0xe2f3=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','map','include','model','debug','ShowSugarcrmAccount','find','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0xe2f3,0x1db));var _0x3e2f=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0xe2f3[_0x5e7e1a];return _0x46b94f;};'use strict';var _=require('lodash');var util=require(_0x3e2f('0x0'));var moment=require('moment');var BPromise=require(_0x3e2f('0x1'));var rs=require(_0x3e2f('0x2'));var fs=require('fs');var Redis=require(_0x3e2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e2f('0x4'));var logger=require(_0x3e2f('0x5'))(_0x3e2f('0x6'));var config=require(_0x3e2f('0x7'));var jayson=require(_0x3e2f('0x8'));var client=jayson[_0x3e2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc27986,_0x3a05fe,_0xf79b24){return new BPromise(function(_0xdd0457,_0x2fea4f){return client[_0x3e2f('0xa')](_0xc27986,_0xf79b24)[_0x3e2f('0xb')](function(_0x4a3aa0){logger[_0x3e2f('0xc')](_0x3e2f('0xd'),_0x3a05fe,_0x3e2f('0xe'));logger['debug'](_0x3e2f('0xf'),_0x3a05fe,'request\x20sent',JSON[_0x3e2f('0x10')](_0x4a3aa0));if(_0x4a3aa0[_0x3e2f('0x11')]){if(_0x4a3aa0[_0x3e2f('0x11')][_0x3e2f('0x12')]===0x1f4){logger[_0x3e2f('0x11')](_0x3e2f('0xd'),_0x3a05fe,_0x4a3aa0[_0x3e2f('0x11')][_0x3e2f('0x13')]);return _0x2fea4f(_0x4a3aa0['error']['message']);}logger[_0x3e2f('0x11')](_0x3e2f('0xd'),_0x3a05fe,_0x4a3aa0[_0x3e2f('0x11')]['message']);return _0xdd0457(_0x4a3aa0[_0x3e2f('0x11')][_0x3e2f('0x13')]);}else{logger[_0x3e2f('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x3a05fe,_0x3e2f('0xe'));_0xdd0457(_0x4a3aa0[_0x3e2f('0x14')][_0x3e2f('0x13')]);}})[_0x3e2f('0x15')](function(_0x50a4ee){logger['error'](_0x3e2f('0xd'),_0x3a05fe,_0x50a4ee);_0x2fea4f(_0x50a4ee);});});}exports[_0x3e2f('0x16')]=function(_0x467ad2){var _0x5b1b6b=this;return new Promise(function(_0x568642,_0x17d46c){return db[_0x3e2f('0x17')][_0x3e2f('0x18')]({'raw':_0x467ad2[_0x3e2f('0x19')]?_0x467ad2[_0x3e2f('0x19')][_0x3e2f('0x1a')]===undefined?!![]:![]:!![],'where':_0x467ad2['options']?_0x467ad2[_0x3e2f('0x19')][_0x3e2f('0x1b')]||null:null,'attributes':_0x467ad2[_0x3e2f('0x19')]?_0x467ad2['options'][_0x3e2f('0x1c')]||null:null,'limit':_0x467ad2[_0x3e2f('0x19')]?_0x467ad2[_0x3e2f('0x19')]['limit']||null:null,'include':_0x467ad2['options']?_0x467ad2['options']['include']?_[_0x3e2f('0x1d')](_0x467ad2[_0x3e2f('0x19')][_0x3e2f('0x1e')],function(_0x4d2295){return{'model':db[_0x4d2295['model']],'as':_0x4d2295['as'],'attributes':_0x4d2295['attributes'],'include':_0x4d2295['include']?_['map'](_0x4d2295[_0x3e2f('0x1e')],function(_0x1b8466){return{'model':db[_0x1b8466['model']],'as':_0x1b8466['as'],'attributes':_0x1b8466[_0x3e2f('0x1c')],'include':_0x1b8466['include']?_[_0x3e2f('0x1d')](_0x1b8466[_0x3e2f('0x1e')],function(_0x132b5a){return{'model':db[_0x132b5a[_0x3e2f('0x1f')]],'as':_0x132b5a['as'],'attributes':_0x132b5a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e2f('0xb')](function(_0xa454f){logger[_0x3e2f('0xc')]('GetSugarcrmAccount',_0x467ad2);logger[_0x3e2f('0x20')](_0x3e2f('0x16'),_0x467ad2,JSON[_0x3e2f('0x10')](_0xa454f));_0x568642(_0xa454f);})['catch'](function(_0x235596){logger[_0x3e2f('0x11')]('GetSugarcrmAccount',_0x235596[_0x3e2f('0x13')],_0x467ad2);_0x17d46c(_0x5b1b6b[_0x3e2f('0x11')](0x1f4,_0x235596['message']));});});};exports[_0x3e2f('0x21')]=function(_0x54838b){var _0x134e93=this;return new Promise(function(_0x2afdf5,_0x40019a){return db[_0x3e2f('0x17')][_0x3e2f('0x22')]({'raw':_0x54838b[_0x3e2f('0x19')]?_0x54838b[_0x3e2f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x54838b[_0x3e2f('0x19')]?_0x54838b['options']['where']||null:null,'attributes':_0x54838b[_0x3e2f('0x19')]?_0x54838b['options'][_0x3e2f('0x1c')]||null:null,'include':_0x54838b['options']?_0x54838b[_0x3e2f('0x19')][_0x3e2f('0x1e')]?_[_0x3e2f('0x1d')](_0x54838b[_0x3e2f('0x19')]['include'],function(_0x4caf46){return{'model':db[_0x4caf46[_0x3e2f('0x1f')]],'as':_0x4caf46['as'],'attributes':_0x4caf46[_0x3e2f('0x1c')],'include':_0x4caf46[_0x3e2f('0x1e')]?_[_0x3e2f('0x1d')](_0x4caf46['include'],function(_0x3a1dd0){return{'model':db[_0x3a1dd0[_0x3e2f('0x1f')]],'as':_0x3a1dd0['as'],'attributes':_0x3a1dd0[_0x3e2f('0x1c')],'include':_0x3a1dd0[_0x3e2f('0x1e')]?_[_0x3e2f('0x1d')](_0x3a1dd0[_0x3e2f('0x1e')],function(_0x5e48ab){return{'model':db[_0x5e48ab[_0x3e2f('0x1f')]],'as':_0x5e48ab['as'],'attributes':_0x5e48ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e2f('0xb')](function(_0x361399){logger['info'](_0x3e2f('0x21'),_0x54838b);logger[_0x3e2f('0x20')](_0x3e2f('0x21'),_0x54838b,JSON['stringify'](_0x361399));_0x2afdf5(_0x361399);})[_0x3e2f('0x15')](function(_0x5b0eda){logger[_0x3e2f('0x11')](_0x3e2f('0x21'),_0x5b0eda[_0x3e2f('0x13')],_0x54838b);_0x40019a(_0x134e93[_0x3e2f('0x11')](0x1f4,_0x5b0eda[_0x3e2f('0x13')]));});});}; \ No newline at end of file +var _0x0146=['options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount'];(function(_0xf3b1df,_0x452eb6){var _0x371354=function(_0x1c2432){while(--_0x1c2432){_0xf3b1df['push'](_0xf3b1df['shift']());}};_0x371354(++_0x452eb6);}(_0x0146,0x123));var _0x6014=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x0146[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x6014('0x0'));var util=require(_0x6014('0x1'));var moment=require(_0x6014('0x2'));var BPromise=require('bluebird');var rs=require(_0x6014('0x3'));var fs=require('fs');var Redis=require(_0x6014('0x4'));var db=require(_0x6014('0x5'))['db'];var utils=require(_0x6014('0x6'));var logger=require('../../config/logger')(_0x6014('0x7'));var config=require('../../config/environment');var jayson=require(_0x6014('0x8'));var client=jayson[_0x6014('0x9')][_0x6014('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x205827,_0x29e7f8,_0x5606e3){return new BPromise(function(_0x5516d9,_0x1b0cd2){return client['request'](_0x205827,_0x5606e3)[_0x6014('0xb')](function(_0x247752){logger[_0x6014('0xc')](_0x6014('0xd'),_0x29e7f8,_0x6014('0xe'));logger[_0x6014('0xf')](_0x6014('0x10'),_0x29e7f8,'request\x20sent',JSON[_0x6014('0x11')](_0x247752));if(_0x247752[_0x6014('0x12')]){if(_0x247752['error'][_0x6014('0x13')]===0x1f4){logger[_0x6014('0x12')](_0x6014('0xd'),_0x29e7f8,_0x247752[_0x6014('0x12')][_0x6014('0x14')]);return _0x1b0cd2(_0x247752[_0x6014('0x12')][_0x6014('0x14')]);}logger[_0x6014('0x12')](_0x6014('0xd'),_0x29e7f8,_0x247752[_0x6014('0x12')][_0x6014('0x14')]);return _0x5516d9(_0x247752[_0x6014('0x12')][_0x6014('0x14')]);}else{logger[_0x6014('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x29e7f8,_0x6014('0xe'));_0x5516d9(_0x247752[_0x6014('0x15')][_0x6014('0x14')]);}})[_0x6014('0x16')](function(_0x237eb2){logger[_0x6014('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x29e7f8,_0x237eb2);_0x1b0cd2(_0x237eb2);});});}exports[_0x6014('0x17')]=function(_0x30a603){var _0xd5d5f4=this;return new Promise(function(_0x58d6d8,_0x28a723){return db['SugarcrmAccount']['findAll']({'raw':_0x30a603[_0x6014('0x18')]?_0x30a603['options'][_0x6014('0x19')]===undefined?!![]:![]:!![],'where':_0x30a603[_0x6014('0x18')]?_0x30a603[_0x6014('0x18')][_0x6014('0x1a')]||null:null,'attributes':_0x30a603[_0x6014('0x18')]?_0x30a603[_0x6014('0x18')][_0x6014('0x1b')]||null:null,'limit':_0x30a603['options']?_0x30a603[_0x6014('0x18')][_0x6014('0x1c')]||null:null,'include':_0x30a603[_0x6014('0x18')]?_0x30a603[_0x6014('0x18')][_0x6014('0x1d')]?_[_0x6014('0x1e')](_0x30a603['options']['include'],function(_0x10a2da){return{'model':db[_0x10a2da[_0x6014('0x1f')]],'as':_0x10a2da['as'],'attributes':_0x10a2da[_0x6014('0x1b')],'include':_0x10a2da[_0x6014('0x1d')]?_[_0x6014('0x1e')](_0x10a2da[_0x6014('0x1d')],function(_0x410382){return{'model':db[_0x410382[_0x6014('0x1f')]],'as':_0x410382['as'],'attributes':_0x410382[_0x6014('0x1b')],'include':_0x410382['include']?_['map'](_0x410382['include'],function(_0x30878e){return{'model':db[_0x30878e[_0x6014('0x1f')]],'as':_0x30878e['as'],'attributes':_0x30878e[_0x6014('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6014('0xb')](function(_0x4a1435){logger[_0x6014('0xc')]('GetSugarcrmAccount',_0x30a603);logger['debug'](_0x6014('0x17'),_0x30a603,JSON['stringify'](_0x4a1435));_0x58d6d8(_0x4a1435);})[_0x6014('0x16')](function(_0x107351){logger[_0x6014('0x12')](_0x6014('0x17'),_0x107351[_0x6014('0x14')],_0x30a603);_0x28a723(_0xd5d5f4['error'](0x1f4,_0x107351[_0x6014('0x14')]));});});};exports[_0x6014('0x20')]=function(_0xc8723e){var _0x34f7b6=this;return new Promise(function(_0x35603a,_0x549b20){return db[_0x6014('0x21')][_0x6014('0x22')]({'raw':_0xc8723e['options']?_0xc8723e[_0x6014('0x18')][_0x6014('0x19')]===undefined?!![]:![]:!![],'where':_0xc8723e[_0x6014('0x18')]?_0xc8723e[_0x6014('0x18')][_0x6014('0x1a')]||null:null,'attributes':_0xc8723e[_0x6014('0x18')]?_0xc8723e[_0x6014('0x18')][_0x6014('0x1b')]||null:null,'include':_0xc8723e['options']?_0xc8723e[_0x6014('0x18')]['include']?_['map'](_0xc8723e[_0x6014('0x18')][_0x6014('0x1d')],function(_0x33fe3b){return{'model':db[_0x33fe3b[_0x6014('0x1f')]],'as':_0x33fe3b['as'],'attributes':_0x33fe3b['attributes'],'include':_0x33fe3b[_0x6014('0x1d')]?_[_0x6014('0x1e')](_0x33fe3b['include'],function(_0x1a3abc){return{'model':db[_0x1a3abc[_0x6014('0x1f')]],'as':_0x1a3abc['as'],'attributes':_0x1a3abc[_0x6014('0x1b')],'include':_0x1a3abc[_0x6014('0x1d')]?_[_0x6014('0x1e')](_0x1a3abc[_0x6014('0x1d')],function(_0x32c31f){return{'model':db[_0x32c31f['model']],'as':_0x32c31f['as'],'attributes':_0x32c31f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6014('0xb')](function(_0x58b2d4){logger[_0x6014('0xc')]('ShowSugarcrmAccount',_0xc8723e);logger[_0x6014('0xf')](_0x6014('0x20'),_0xc8723e,JSON[_0x6014('0x11')](_0x58b2d4));_0x35603a(_0x58b2d4);})[_0x6014('0x16')](function(_0xa59260){logger[_0x6014('0x12')](_0x6014('0x20'),_0xa59260[_0x6014('0x14')],_0xc8723e);_0x549b20(_0x34f7b6[_0x6014('0x12')](0x1f4,_0xa59260[_0x6014('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a28412a..658a1cb 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 _0x8a82=['getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x8a82,0xc5));var _0x28a8=function(_0x4b01e0,_0x5ef558){_0x4b01e0=_0x4b01e0-0x0;var _0x57b177=_0x8a82[_0x4b01e0];return _0x57b177;};'use strict';var multer=require(_0x28a8('0x0'));var util=require(_0x28a8('0x1'));var path=require(_0x28a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x28a8('0x3'));var router=express['Router']();var fs_extra=require(_0x28a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x28a8('0x5'));var config=require(_0x28a8('0x6'));var controller=require(_0x28a8('0x7'));router[_0x28a8('0x8')]('/',auth[_0x28a8('0x9')](),controller[_0x28a8('0xa')]);router[_0x28a8('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x28a8('0xb'),auth[_0x28a8('0x9')](),controller[_0x28a8('0xc')]);router[_0x28a8('0x8')]('/:id/subjects',auth[_0x28a8('0x9')](),controller['getSubjects']);router[_0x28a8('0x8')]('/:id/descriptions',auth[_0x28a8('0x9')](),controller[_0x28a8('0xd')]);router[_0x28a8('0xe')]('/',auth[_0x28a8('0x9')](),controller[_0x28a8('0xf')]);router[_0x28a8('0x10')](_0x28a8('0x11'),auth[_0x28a8('0x9')](),controller[_0x28a8('0x12')]);router['delete']('/:id',auth[_0x28a8('0x9')](),controller[_0x28a8('0x13')]);module[_0x28a8('0x14')]=router; \ No newline at end of file +var _0x39f2=['../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x491ce5,_0x5caca6){var _0x4236e3=function(_0x4ee361){while(--_0x4ee361){_0x491ce5['push'](_0x491ce5['shift']());}};_0x4236e3(++_0x5caca6);}(_0x39f2,0x94));var _0x239f=function(_0x1b5f03,_0x3b7fb1){_0x1b5f03=_0x1b5f03-0x0;var _0x442bae=_0x39f2[_0x1b5f03];return _0x442bae;};'use strict';var multer=require(_0x239f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x239f('0x1'));var express=require(_0x239f('0x2'));var router=express[_0x239f('0x3')]();var fs_extra=require(_0x239f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x239f('0x5'));var config=require(_0x239f('0x6'));var controller=require(_0x239f('0x7'));router[_0x239f('0x8')]('/',auth['isAuthenticated'](),controller[_0x239f('0x9')]);router[_0x239f('0x8')](_0x239f('0xa'),auth[_0x239f('0xb')](),controller[_0x239f('0xc')]);router[_0x239f('0x8')](_0x239f('0xd'),auth[_0x239f('0xb')](),controller[_0x239f('0xe')]);router[_0x239f('0x8')](_0x239f('0xf'),auth[_0x239f('0xb')](),controller['getSubjects']);router[_0x239f('0x8')](_0x239f('0x10'),auth[_0x239f('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0x239f('0xb')](),controller[_0x239f('0x11')]);router[_0x239f('0x12')](_0x239f('0xa'),auth[_0x239f('0xb')](),controller[_0x239f('0x13')]);router[_0x239f('0x14')](_0x239f('0xa'),auth[_0x239f('0xb')](),controller['destroy']);module[_0x239f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c9eec02..62d78ea 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 _0x09fb=['STRING','sequelize'];(function(_0x4c93d4,_0x5a17bd){var _0x29caca=function(_0x32f7fa){while(--_0x32f7fa){_0x4c93d4['push'](_0x4c93d4['shift']());}};_0x29caca(++_0x5a17bd);}(_0x09fb,0xd5));var _0xb09f=function(_0x4a2a8c,_0x5ec6d6){_0x4a2a8c=_0x4a2a8c-0x0;var _0x327a89=_0x09fb[_0x4a2a8c];return _0x327a89;};'use strict';var Sequelize=require(_0xb09f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb09f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6096=['STRING','sequelize'];(function(_0x13e04d,_0x40a506){var _0x2b0a95=function(_0xfa0d96){while(--_0xfa0d96){_0x13e04d['push'](_0x13e04d['shift']());}};_0x2b0a95(++_0x40a506);}(_0x6096,0x135));var _0x6609=function(_0x2f8dc8,_0x1e1cb5){_0x2f8dc8=_0x2f8dc8-0x0;var _0x6cd31f=_0x6096[_0x2f8dc8];return _0x6cd31f;};'use strict';var Sequelize=require(_0x6609('0x0'));module['exports']={'name':{'type':Sequelize[_0x6609('0x1')]},'description':{'type':Sequelize[_0x6609('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9759635..ee66178 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 _0x820e=['status','end','offset','undefined','limit','Content-Range','json','reject','save','destroy','then','error','name','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','count','includeAll','include','rows','catch','show','keys','find','create','body','update','params','getFields','findOne','SugarcrmField','filter','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3e0b36,_0x3d7bec){var _0x18f252=function(_0x534c22){while(--_0x534c22){_0x3e0b36['push'](_0x3e0b36['shift']());}};_0x18f252(++_0x3d7bec);}(_0x820e,0x80));var _0xe820=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x820e[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe820('0x0'));var zipdir=require(_0xe820('0x1'));var jsonpatch=require(_0xe820('0x2'));var rp=require('request-promise');var moment=require(_0xe820('0x3'));var BPromise=require(_0xe820('0x4'));var Mustache=require(_0xe820('0x5'));var util=require('util');var path=require(_0xe820('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe820('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe820('0x8'));var crypto=require('crypto');var jsforce=require(_0xe820('0x9'));var deskjs=require(_0xe820('0xa'));var toCsv=require(_0xe820('0xb'));var querystring=require(_0xe820('0xc'));var Papa=require(_0xe820('0xd'));var Redis=require(_0xe820('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe820('0xf'));var logger=require(_0xe820('0x10'))('api');var utils=require(_0xe820('0x11'));var config=require(_0xe820('0x12'));var licenseUtil=require(_0xe820('0x13'));var db=require(_0xe820('0x14'))['db'];function respondWithStatusCode(_0x51be01,_0xe883a9){_0xe883a9=_0xe883a9||0xcc;return function(_0x29d296){if(_0x29d296){return _0x51be01[_0xe820('0x15')](_0xe883a9);}return _0x51be01[_0xe820('0x16')](_0xe883a9)[_0xe820('0x17')]();};}function respondWithResult(_0x476f65,_0x1af4ad){_0x1af4ad=_0x1af4ad||0xc8;return function(_0x2aef20){if(_0x2aef20){return _0x476f65['status'](_0x1af4ad)['json'](_0x2aef20);}};}function respondWithFilteredResult(_0x15ee7d,_0x50705b){return function(_0x581d93){if(_0x581d93){var _0xc1dd58=typeof _0x50705b[_0xe820('0x18')]===_0xe820('0x19')&&typeof _0x50705b[_0xe820('0x1a')]==='undefined';var _0x421c35=_0x581d93['count'];var _0xe94749=_0xc1dd58?0x0:_0x50705b[_0xe820('0x18')];var _0x42c340=_0xc1dd58?_0x581d93['count']:_0x50705b[_0xe820('0x18')]+_0x50705b[_0xe820('0x1a')];var _0x439504;if(_0x42c340>=_0x421c35){_0x42c340=_0x421c35;_0x439504=0xc8;}else{_0x439504=0xce;}_0x15ee7d[_0xe820('0x16')](_0x439504);return _0x15ee7d['set'](_0xe820('0x1b'),_0xe94749+'-'+_0x42c340+'/'+_0x421c35)[_0xe820('0x1c')](_0x581d93);}return null;};}function patchUpdates(_0x40eac6){return function(_0x34f226){try{jsonpatch['apply'](_0x34f226,_0x40eac6,!![]);}catch(_0x5fb7fc){return BPromise[_0xe820('0x1d')](_0x5fb7fc);}return _0x34f226[_0xe820('0x1e')]();};}function saveUpdates(_0x10da56,_0x1491dc){return function(_0x3702c6){if(_0x3702c6){return _0x3702c6['update'](_0x10da56)['then'](function(_0x364d78){return _0x364d78;});}return null;};}function removeEntity(_0x1aa486,_0x2c5d40){return function(_0x2dbb4d){if(_0x2dbb4d){return _0x2dbb4d[_0xe820('0x1f')]()[_0xe820('0x20')](function(){_0x1aa486[_0xe820('0x16')](0xcc)[_0xe820('0x17')]();});}};}function handleEntityNotFound(_0x130200,_0x45d87f){return function(_0x32348f){if(!_0x32348f){_0x130200[_0xe820('0x15')](0x194);}return _0x32348f;};}function handleError(_0x29a775,_0x289366){_0x289366=_0x289366||0x1f4;return function(_0x795aa9){logger[_0xe820('0x21')](_0x795aa9['stack']);if(_0x795aa9[_0xe820('0x22')]){delete _0x795aa9[_0xe820('0x22')];}_0x29a775[_0xe820('0x16')](_0x289366)['send'](_0x795aa9);};}exports[_0xe820('0x23')]=function(_0x51731f,_0x27a419){var _0xaf16c5={},_0x50977a={},_0x318c79={'count':0x0,'rows':[]};var _0x53ca5e=_['map'](db[_0xe820('0x24')][_0xe820('0x25')],function(_0x1b1e51){return{'name':_0x1b1e51[_0xe820('0x26')],'type':_0x1b1e51[_0xe820('0x27')][_0xe820('0x28')]};});_0x50977a[_0xe820('0x29')]=_[_0xe820('0x2a')](_0x53ca5e,_0xe820('0x22'));_0x50977a[_0xe820('0x2b')]=_['keys'](_0x51731f[_0xe820('0x2b')]);_0x50977a['filters']=_[_0xe820('0x2c')](_0x50977a[_0xe820('0x29')],_0x50977a['query']);_0xaf16c5['attributes']=_[_0xe820('0x2c')](_0x50977a[_0xe820('0x29')],qs['fields'](_0x51731f[_0xe820('0x2b')][_0xe820('0x2d')]));_0xaf16c5['attributes']=_0xaf16c5['attributes'][_0xe820('0x2e')]?_0xaf16c5[_0xe820('0x2f')]:_0x50977a[_0xe820('0x29')];if(!_0x51731f[_0xe820('0x2b')][_0xe820('0x30')](_0xe820('0x31'))){_0xaf16c5[_0xe820('0x1a')]=qs['limit'](_0x51731f['query']['limit']);_0xaf16c5['offset']=qs[_0xe820('0x18')](_0x51731f['query'][_0xe820('0x18')]);}_0xaf16c5[_0xe820('0x32')]=qs['sort'](_0x51731f[_0xe820('0x2b')][_0xe820('0x33')]);_0xaf16c5['where']=qs[_0xe820('0x34')](_[_0xe820('0x35')](_0x51731f[_0xe820('0x2b')],_0x50977a['filters']),_0x53ca5e);if(_0x51731f[_0xe820('0x2b')]['filter']){_0xaf16c5[_0xe820('0x36')]=_[_0xe820('0x37')](_0xaf16c5[_0xe820('0x36')],{'$or':_[_0xe820('0x2a')](_0x53ca5e,function(_0x4a42b3){if(_0x4a42b3[_0xe820('0x27')]!=='VIRTUAL'){var _0xd0f8d={};_0xd0f8d[_0x4a42b3[_0xe820('0x22')]]={'$like':'%'+_0x51731f[_0xe820('0x2b')]['filter']+'%'};return _0xd0f8d;}})});}_0xaf16c5=_[_0xe820('0x37')]({},_0xaf16c5,_0x51731f['options']);var _0x51bcc2={'where':_0xaf16c5[_0xe820('0x36')]};return db[_0xe820('0x24')]['count'](_0x51bcc2)['then'](function(_0x23efe4){_0x318c79[_0xe820('0x38')]=_0x23efe4;if(_0x51731f['query'][_0xe820('0x39')]){_0xaf16c5[_0xe820('0x3a')]=[{'all':!![]}];}return db[_0xe820('0x24')]['findAll'](_0xaf16c5);})[_0xe820('0x20')](function(_0x38462a){_0x318c79[_0xe820('0x3b')]=_0x38462a;return _0x318c79;})[_0xe820('0x20')](respondWithFilteredResult(_0x27a419,_0xaf16c5))[_0xe820('0x3c')](handleError(_0x27a419,null));};exports[_0xe820('0x3d')]=function(_0x68b3ad,_0x302b39){var _0x3fabec={'raw':![],'where':{'id':_0x68b3ad['params']['id']}},_0x32b0d3={};_0x32b0d3[_0xe820('0x29')]=_[_0xe820('0x3e')](db[_0xe820('0x24')][_0xe820('0x25')]);_0x32b0d3[_0xe820('0x2b')]=_[_0xe820('0x3e')](_0x68b3ad[_0xe820('0x2b')]);_0x32b0d3[_0xe820('0x34')]=_[_0xe820('0x2c')](_0x32b0d3[_0xe820('0x29')],_0x32b0d3['query']);_0x3fabec['attributes']=_[_0xe820('0x2c')](_0x32b0d3['model'],qs[_0xe820('0x2d')](_0x68b3ad[_0xe820('0x2b')][_0xe820('0x2d')]));_0x3fabec[_0xe820('0x2f')]=_0x3fabec[_0xe820('0x2f')][_0xe820('0x2e')]?_0x3fabec[_0xe820('0x2f')]:_0x32b0d3[_0xe820('0x29')];if(_0x68b3ad[_0xe820('0x2b')][_0xe820('0x39')]){_0x3fabec[_0xe820('0x3a')]=[{'all':!![]}];}_0x3fabec=_[_0xe820('0x37')]({},_0x3fabec,_0x68b3ad['options']);return db[_0xe820('0x24')][_0xe820('0x3f')](_0x3fabec)[_0xe820('0x20')](handleEntityNotFound(_0x302b39,null))['then'](respondWithResult(_0x302b39,null))[_0xe820('0x3c')](handleError(_0x302b39,null));};exports[_0xe820('0x40')]=function(_0x173e2b,_0x49c509){return db['SugarcrmConfiguration'][_0xe820('0x40')](_0x173e2b[_0xe820('0x41')],{})['then'](respondWithResult(_0x49c509,0xc9))[_0xe820('0x3c')](handleError(_0x49c509,null));};exports[_0xe820('0x42')]=function(_0x306f93,_0x4d69d1){if(_0x306f93[_0xe820('0x41')]['id']){delete _0x306f93[_0xe820('0x41')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x306f93[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x4d69d1,null))['then'](saveUpdates(_0x306f93[_0xe820('0x41')],null))['then'](respondWithResult(_0x4d69d1,null))[_0xe820('0x3c')](handleError(_0x4d69d1,null));};exports[_0xe820('0x1f')]=function(_0x35adfc,_0x5a725a){return db['SugarcrmConfiguration'][_0xe820('0x3f')]({'where':{'id':_0x35adfc['params']['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x5a725a,null))['then'](removeEntity(_0x5a725a,null))[_0xe820('0x3c')](handleError(_0x5a725a,null));};exports[_0xe820('0x44')]=function(_0xbd03c1,_0x1c2334,_0x583a5a){var _0x4bf07f={};var _0x3486ef={};var _0x30eb64;var _0x49fb4b;return db[_0xe820('0x24')][_0xe820('0x45')]({'where':{'id':_0xbd03c1[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x1c2334,null))[_0xe820('0x20')](function(_0x59c9c6){if(_0x59c9c6){_0x30eb64=_0x59c9c6;_0x3486ef[_0xe820('0x29')]=_['keys'](db[_0xe820('0x46')][_0xe820('0x25')]);_0x3486ef[_0xe820('0x2b')]=_[_0xe820('0x3e')](_0xbd03c1['query']);_0x3486ef[_0xe820('0x34')]=_['intersection'](_0x3486ef[_0xe820('0x29')],_0x3486ef[_0xe820('0x2b')]);_0x4bf07f[_0xe820('0x2f')]=_[_0xe820('0x2c')](_0x3486ef['model'],qs[_0xe820('0x2d')](_0xbd03c1[_0xe820('0x2b')][_0xe820('0x2d')]));_0x4bf07f['attributes']=_0x4bf07f[_0xe820('0x2f')][_0xe820('0x2e')]?_0x4bf07f[_0xe820('0x2f')]:_0x3486ef[_0xe820('0x29')];_0x4bf07f[_0xe820('0x32')]=qs[_0xe820('0x33')](_0xbd03c1[_0xe820('0x2b')][_0xe820('0x33')]);_0x4bf07f[_0xe820('0x36')]=qs[_0xe820('0x34')](_['pick'](_0xbd03c1[_0xe820('0x2b')],_0x3486ef[_0xe820('0x34')]));if(_0xbd03c1['query'][_0xe820('0x47')]){_0x4bf07f[_0xe820('0x36')]=_[_0xe820('0x37')](_0x4bf07f[_0xe820('0x36')],{'$or':_['map'](_0x4bf07f[_0xe820('0x2f')],function(_0x1ba010){var _0x1db302={};_0x1db302[_0x1ba010]={'$like':'%'+_0xbd03c1[_0xe820('0x2b')][_0xe820('0x47')]+'%'};return _0x1db302;})});}_0x4bf07f=_[_0xe820('0x37')]({},_0x4bf07f,_0xbd03c1[_0xe820('0x48')]);return _0x30eb64[_0xe820('0x44')](_0x4bf07f);}})[_0xe820('0x20')](function(_0x5587d8){if(_0x5587d8){_0x49fb4b=_0x5587d8[_0xe820('0x2e')];if(!_0xbd03c1[_0xe820('0x2b')]['hasOwnProperty'](_0xe820('0x31'))){_0x4bf07f[_0xe820('0x1a')]=qs[_0xe820('0x1a')](_0xbd03c1['query']['limit']);_0x4bf07f[_0xe820('0x18')]=qs['offset'](_0xbd03c1[_0xe820('0x2b')][_0xe820('0x18')]);}return _0x30eb64[_0xe820('0x44')](_0x4bf07f);}})[_0xe820('0x20')](function(_0x1087ce){if(_0x1087ce){return _0x1087ce?{'count':_0x49fb4b,'rows':_0x1087ce}:null;}})[_0xe820('0x20')](respondWithResult(_0x1c2334,null))['catch'](handleError(_0x1c2334,null));};exports[_0xe820('0x49')]=function(_0x2c861c,_0x29e710,_0x32a1c7){var _0x559eba={};var _0x57899d={};var _0x35c1e8;var _0x16b447;return db[_0xe820('0x24')][_0xe820('0x45')]({'where':{'id':_0x2c861c[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x29e710,null))[_0xe820('0x20')](function(_0x113769){if(_0x113769){_0x35c1e8=_0x113769;_0x57899d[_0xe820('0x29')]=_[_0xe820('0x3e')](db[_0xe820('0x46')][_0xe820('0x25')]);_0x57899d['query']=_[_0xe820('0x3e')](_0x2c861c['query']);_0x57899d[_0xe820('0x34')]=_['intersection'](_0x57899d[_0xe820('0x29')],_0x57899d[_0xe820('0x2b')]);_0x559eba['attributes']=_[_0xe820('0x2c')](_0x57899d['model'],qs[_0xe820('0x2d')](_0x2c861c['query'][_0xe820('0x2d')]));_0x559eba[_0xe820('0x2f')]=_0x559eba[_0xe820('0x2f')][_0xe820('0x2e')]?_0x559eba[_0xe820('0x2f')]:_0x57899d[_0xe820('0x29')];_0x559eba[_0xe820('0x32')]=qs[_0xe820('0x33')](_0x2c861c['query'][_0xe820('0x33')]);_0x559eba[_0xe820('0x36')]=qs[_0xe820('0x34')](_['pick'](_0x2c861c['query'],_0x57899d['filters']));if(_0x2c861c[_0xe820('0x2b')][_0xe820('0x47')]){_0x559eba['where']=_[_0xe820('0x37')](_0x559eba[_0xe820('0x36')],{'$or':_[_0xe820('0x2a')](_0x559eba[_0xe820('0x2f')],function(_0x31b513){var _0x55f0ed={};_0x55f0ed[_0x31b513]={'$like':'%'+_0x2c861c[_0xe820('0x2b')][_0xe820('0x47')]+'%'};return _0x55f0ed;})});}_0x559eba=_[_0xe820('0x37')]({},_0x559eba,_0x2c861c[_0xe820('0x48')]);return _0x35c1e8['getSubjects'](_0x559eba);}})[_0xe820('0x20')](function(_0x365cba){if(_0x365cba){_0x16b447=_0x365cba['length'];if(!_0x2c861c[_0xe820('0x2b')][_0xe820('0x30')](_0xe820('0x31'))){_0x559eba['limit']=qs[_0xe820('0x1a')](_0x2c861c[_0xe820('0x2b')][_0xe820('0x1a')]);_0x559eba[_0xe820('0x18')]=qs['offset'](_0x2c861c[_0xe820('0x2b')][_0xe820('0x18')]);}return _0x35c1e8[_0xe820('0x49')](_0x559eba);}})['then'](function(_0x4ba500){if(_0x4ba500){return _0x4ba500?{'count':_0x16b447,'rows':_0x4ba500}:null;}})[_0xe820('0x20')](respondWithResult(_0x29e710,null))['catch'](handleError(_0x29e710,null));};exports[_0xe820('0x4a')]=function(_0x45a9f9,_0x42c553,_0x415a55){var _0x3f5e0f={};var _0x92dcba={};var _0x35dd23;var _0x3b611c;return db[_0xe820('0x24')]['findOne']({'where':{'id':_0x45a9f9[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x42c553,null))['then'](function(_0x2e8312){if(_0x2e8312){_0x35dd23=_0x2e8312;_0x92dcba[_0xe820('0x29')]=_[_0xe820('0x3e')](db[_0xe820('0x46')][_0xe820('0x25')]);_0x92dcba[_0xe820('0x2b')]=_[_0xe820('0x3e')](_0x45a9f9[_0xe820('0x2b')]);_0x92dcba[_0xe820('0x34')]=_['intersection'](_0x92dcba[_0xe820('0x29')],_0x92dcba[_0xe820('0x2b')]);_0x3f5e0f[_0xe820('0x2f')]=_[_0xe820('0x2c')](_0x92dcba['model'],qs[_0xe820('0x2d')](_0x45a9f9[_0xe820('0x2b')][_0xe820('0x2d')]));_0x3f5e0f[_0xe820('0x2f')]=_0x3f5e0f['attributes'][_0xe820('0x2e')]?_0x3f5e0f[_0xe820('0x2f')]:_0x92dcba[_0xe820('0x29')];_0x3f5e0f[_0xe820('0x32')]=qs[_0xe820('0x33')](_0x45a9f9[_0xe820('0x2b')][_0xe820('0x33')]);_0x3f5e0f[_0xe820('0x36')]=qs[_0xe820('0x34')](_[_0xe820('0x35')](_0x45a9f9[_0xe820('0x2b')],_0x92dcba['filters']));if(_0x45a9f9[_0xe820('0x2b')][_0xe820('0x47')]){_0x3f5e0f[_0xe820('0x36')]=_[_0xe820('0x37')](_0x3f5e0f[_0xe820('0x36')],{'$or':_[_0xe820('0x2a')](_0x3f5e0f[_0xe820('0x2f')],function(_0x3e0520){var _0x2c0937={};_0x2c0937[_0x3e0520]={'$like':'%'+_0x45a9f9[_0xe820('0x2b')][_0xe820('0x47')]+'%'};return _0x2c0937;})});}_0x3f5e0f=_[_0xe820('0x37')]({},_0x3f5e0f,_0x45a9f9['options']);return _0x35dd23[_0xe820('0x4a')](_0x3f5e0f);}})[_0xe820('0x20')](function(_0x2e12f0){if(_0x2e12f0){_0x3b611c=_0x2e12f0[_0xe820('0x2e')];if(!_0x45a9f9[_0xe820('0x2b')][_0xe820('0x30')]('nolimit')){_0x3f5e0f[_0xe820('0x1a')]=qs['limit'](_0x45a9f9['query'][_0xe820('0x1a')]);_0x3f5e0f[_0xe820('0x18')]=qs[_0xe820('0x18')](_0x45a9f9[_0xe820('0x2b')]['offset']);}return _0x35dd23[_0xe820('0x4a')](_0x3f5e0f);}})[_0xe820('0x20')](function(_0x2f6f2b){if(_0x2f6f2b){return _0x2f6f2b?{'count':_0x3b611c,'rows':_0x2f6f2b}:null;}})[_0xe820('0x20')](respondWithResult(_0x42c553,null))[_0xe820('0x3c')](handleError(_0x42c553,null));}; \ No newline at end of file +var _0xa038=['rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','limit','count','offset','set','Content-Range','json','reject','save','then','destroy','end','sendStatus','error','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','catch','show','params','keys','create','body','find','getFields','findOne','SugarcrmField','length','where','hasOwnProperty','nolimit','getSubjects','rawAttributes','getDescriptions','eml-format'];(function(_0x41904c,_0x4f6b93){var _0xe97d41=function(_0x3b83b4){while(--_0x3b83b4){_0x41904c['push'](_0x41904c['shift']());}};_0xe97d41(++_0x4f6b93);}(_0xa038,0x9f));var _0x8a03=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xa038[_0x25d386];return _0x857f4a;};'use strict';var emlformat=require(_0x8a03('0x0'));var rimraf=require(_0x8a03('0x1'));var zipdir=require(_0x8a03('0x2'));var jsonpatch=require(_0x8a03('0x3'));var rp=require('request-promise');var moment=require(_0x8a03('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a03('0x5'));var util=require(_0x8a03('0x6'));var path=require(_0x8a03('0x7'));var sox=require(_0x8a03('0x8'));var csv=require(_0x8a03('0x9'));var ejs=require(_0x8a03('0xa'));var fs=require('fs');var fs_extra=require(_0x8a03('0xb'));var _=require(_0x8a03('0xc'));var squel=require(_0x8a03('0xd'));var crypto=require(_0x8a03('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8a03('0xf'));var toCsv=require(_0x8a03('0x9'));var querystring=require(_0x8a03('0x10'));var Papa=require(_0x8a03('0x11'));var Redis=require(_0x8a03('0x12'));var authService=require(_0x8a03('0x13'));var qs=require(_0x8a03('0x14'));var as=require(_0x8a03('0x15'));var hardwareService=require(_0x8a03('0x16'));var logger=require('../../config/logger')(_0x8a03('0x17'));var utils=require(_0x8a03('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8a03('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x497461,_0x549d79){_0x549d79=_0x549d79||0xcc;return function(_0x39d3c6){if(_0x39d3c6){return _0x497461['sendStatus'](_0x549d79);}return _0x497461[_0x8a03('0x1a')](_0x549d79)['end']();};}function respondWithResult(_0x5ca425,_0x5adb5e){_0x5adb5e=_0x5adb5e||0xc8;return function(_0xe0845d){if(_0xe0845d){return _0x5ca425[_0x8a03('0x1a')](_0x5adb5e)['json'](_0xe0845d);}};}function respondWithFilteredResult(_0x306845,_0x4d6b84){return function(_0x2d05ba){if(_0x2d05ba){var _0x5148ea=typeof _0x4d6b84['offset']==='undefined'&&typeof _0x4d6b84[_0x8a03('0x1b')]==='undefined';var _0x2d46a8=_0x2d05ba[_0x8a03('0x1c')];var _0x7d6460=_0x5148ea?0x0:_0x4d6b84['offset'];var _0xc27901=_0x5148ea?_0x2d05ba[_0x8a03('0x1c')]:_0x4d6b84[_0x8a03('0x1d')]+_0x4d6b84['limit'];var _0x4ef806;if(_0xc27901>=_0x2d46a8){_0xc27901=_0x2d46a8;_0x4ef806=0xc8;}else{_0x4ef806=0xce;}_0x306845[_0x8a03('0x1a')](_0x4ef806);return _0x306845[_0x8a03('0x1e')](_0x8a03('0x1f'),_0x7d6460+'-'+_0xc27901+'/'+_0x2d46a8)[_0x8a03('0x20')](_0x2d05ba);}return null;};}function patchUpdates(_0x472164){return function(_0x310554){try{jsonpatch['apply'](_0x310554,_0x472164,!![]);}catch(_0x3b8fbd){return BPromise[_0x8a03('0x21')](_0x3b8fbd);}return _0x310554[_0x8a03('0x22')]();};}function saveUpdates(_0x707b53,_0x3c36d2){return function(_0x7fb2fa){if(_0x7fb2fa){return _0x7fb2fa['update'](_0x707b53)[_0x8a03('0x23')](function(_0x545289){return _0x545289;});}return null;};}function removeEntity(_0x28fef7,_0x4546e8){return function(_0x3fd256){if(_0x3fd256){return _0x3fd256[_0x8a03('0x24')]()[_0x8a03('0x23')](function(){_0x28fef7[_0x8a03('0x1a')](0xcc)[_0x8a03('0x25')]();});}};}function handleEntityNotFound(_0x269c93,_0x41b5e0){return function(_0x1389fd){if(!_0x1389fd){_0x269c93[_0x8a03('0x26')](0x194);}return _0x1389fd;};}function handleError(_0x30a2a7,_0x47f151){_0x47f151=_0x47f151||0x1f4;return function(_0x12dde5){logger[_0x8a03('0x27')](_0x12dde5[_0x8a03('0x28')]);if(_0x12dde5[_0x8a03('0x29')]){delete _0x12dde5['name'];}_0x30a2a7[_0x8a03('0x1a')](_0x47f151)['send'](_0x12dde5);};}exports[_0x8a03('0x2a')]=function(_0x506e40,_0x1f5c46){var _0x571c0c={},_0x23a36b={},_0x2f416f={'count':0x0,'rows':[]};var _0x450c8f=_[_0x8a03('0x2b')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x1fa7e6){return{'name':_0x1fa7e6[_0x8a03('0x2c')],'type':_0x1fa7e6[_0x8a03('0x2d')][_0x8a03('0x2e')]};});_0x23a36b[_0x8a03('0x2f')]=_[_0x8a03('0x2b')](_0x450c8f,_0x8a03('0x29'));_0x23a36b[_0x8a03('0x30')]=_['keys'](_0x506e40[_0x8a03('0x30')]);_0x23a36b[_0x8a03('0x31')]=_[_0x8a03('0x32')](_0x23a36b[_0x8a03('0x2f')],_0x23a36b['query']);_0x571c0c['attributes']=_['intersection'](_0x23a36b[_0x8a03('0x2f')],qs[_0x8a03('0x33')](_0x506e40[_0x8a03('0x30')][_0x8a03('0x33')]));_0x571c0c[_0x8a03('0x34')]=_0x571c0c['attributes']['length']?_0x571c0c[_0x8a03('0x34')]:_0x23a36b['model'];if(!_0x506e40['query']['hasOwnProperty']('nolimit')){_0x571c0c['limit']=qs[_0x8a03('0x1b')](_0x506e40[_0x8a03('0x30')][_0x8a03('0x1b')]);_0x571c0c[_0x8a03('0x1d')]=qs['offset'](_0x506e40[_0x8a03('0x30')]['offset']);}_0x571c0c[_0x8a03('0x35')]=qs[_0x8a03('0x36')](_0x506e40[_0x8a03('0x30')][_0x8a03('0x36')]);_0x571c0c['where']=qs[_0x8a03('0x31')](_[_0x8a03('0x37')](_0x506e40['query'],_0x23a36b[_0x8a03('0x31')]),_0x450c8f);if(_0x506e40[_0x8a03('0x30')][_0x8a03('0x38')]){_0x571c0c['where']=_[_0x8a03('0x39')](_0x571c0c['where'],{'$or':_['map'](_0x450c8f,function(_0x269d79){if(_0x269d79['type']!==_0x8a03('0x3a')){var _0x388cd7={};_0x388cd7[_0x269d79[_0x8a03('0x29')]]={'$like':'%'+_0x506e40[_0x8a03('0x30')][_0x8a03('0x38')]+'%'};return _0x388cd7;}})});}_0x571c0c=_[_0x8a03('0x39')]({},_0x571c0c,_0x506e40[_0x8a03('0x3b')]);var _0x21d558={'where':_0x571c0c['where']};return db[_0x8a03('0x3c')][_0x8a03('0x1c')](_0x21d558)[_0x8a03('0x23')](function(_0xd1d838){_0x2f416f[_0x8a03('0x1c')]=_0xd1d838;if(_0x506e40[_0x8a03('0x30')][_0x8a03('0x3d')]){_0x571c0c[_0x8a03('0x3e')]=[{'all':!![]}];}return db[_0x8a03('0x3c')]['findAll'](_0x571c0c);})[_0x8a03('0x23')](function(_0x2d81aa){_0x2f416f['rows']=_0x2d81aa;return _0x2f416f;})[_0x8a03('0x23')](respondWithFilteredResult(_0x1f5c46,_0x571c0c))[_0x8a03('0x3f')](handleError(_0x1f5c46,null));};exports[_0x8a03('0x40')]=function(_0x2d8025,_0x172644){var _0x163685={'raw':![],'where':{'id':_0x2d8025[_0x8a03('0x41')]['id']}},_0x2d881e={};_0x2d881e[_0x8a03('0x2f')]=_[_0x8a03('0x42')](db['SugarcrmConfiguration']['rawAttributes']);_0x2d881e['query']=_[_0x8a03('0x42')](_0x2d8025['query']);_0x2d881e['filters']=_['intersection'](_0x2d881e[_0x8a03('0x2f')],_0x2d881e[_0x8a03('0x30')]);_0x163685[_0x8a03('0x34')]=_[_0x8a03('0x32')](_0x2d881e[_0x8a03('0x2f')],qs[_0x8a03('0x33')](_0x2d8025[_0x8a03('0x30')][_0x8a03('0x33')]));_0x163685['attributes']=_0x163685[_0x8a03('0x34')]['length']?_0x163685[_0x8a03('0x34')]:_0x2d881e[_0x8a03('0x2f')];if(_0x2d8025[_0x8a03('0x30')][_0x8a03('0x3d')]){_0x163685[_0x8a03('0x3e')]=[{'all':!![]}];}_0x163685=_[_0x8a03('0x39')]({},_0x163685,_0x2d8025['options']);return db[_0x8a03('0x3c')]['find'](_0x163685)[_0x8a03('0x23')](handleEntityNotFound(_0x172644,null))['then'](respondWithResult(_0x172644,null))['catch'](handleError(_0x172644,null));};exports[_0x8a03('0x43')]=function(_0x43deba,_0x5700f6){return db[_0x8a03('0x3c')][_0x8a03('0x43')](_0x43deba[_0x8a03('0x44')],{})[_0x8a03('0x23')](respondWithResult(_0x5700f6,0xc9))[_0x8a03('0x3f')](handleError(_0x5700f6,null));};exports['update']=function(_0x422a4f,_0xe4de03){if(_0x422a4f['body']['id']){delete _0x422a4f[_0x8a03('0x44')]['id'];}return db['SugarcrmConfiguration'][_0x8a03('0x45')]({'where':{'id':_0x422a4f[_0x8a03('0x41')]['id']}})[_0x8a03('0x23')](handleEntityNotFound(_0xe4de03,null))[_0x8a03('0x23')](saveUpdates(_0x422a4f[_0x8a03('0x44')],null))['then'](respondWithResult(_0xe4de03,null))[_0x8a03('0x3f')](handleError(_0xe4de03,null));};exports[_0x8a03('0x24')]=function(_0x2ec3a9,_0x2db22c){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2ec3a9[_0x8a03('0x41')]['id']}})['then'](handleEntityNotFound(_0x2db22c,null))[_0x8a03('0x23')](removeEntity(_0x2db22c,null))[_0x8a03('0x3f')](handleError(_0x2db22c,null));};exports[_0x8a03('0x46')]=function(_0x29b142,_0x3f0a45,_0x517756){var _0x110511={};var _0x48697b={};var _0x594c21;var _0x41f55d;return db[_0x8a03('0x3c')][_0x8a03('0x47')]({'where':{'id':_0x29b142[_0x8a03('0x41')]['id']}})[_0x8a03('0x23')](handleEntityNotFound(_0x3f0a45,null))[_0x8a03('0x23')](function(_0x1a9fff){if(_0x1a9fff){_0x594c21=_0x1a9fff;_0x48697b[_0x8a03('0x2f')]=_[_0x8a03('0x42')](db[_0x8a03('0x48')]['rawAttributes']);_0x48697b[_0x8a03('0x30')]=_['keys'](_0x29b142['query']);_0x48697b[_0x8a03('0x31')]=_['intersection'](_0x48697b[_0x8a03('0x2f')],_0x48697b['query']);_0x110511[_0x8a03('0x34')]=_['intersection'](_0x48697b[_0x8a03('0x2f')],qs[_0x8a03('0x33')](_0x29b142[_0x8a03('0x30')][_0x8a03('0x33')]));_0x110511[_0x8a03('0x34')]=_0x110511[_0x8a03('0x34')][_0x8a03('0x49')]?_0x110511[_0x8a03('0x34')]:_0x48697b['model'];_0x110511['order']=qs[_0x8a03('0x36')](_0x29b142[_0x8a03('0x30')][_0x8a03('0x36')]);_0x110511['where']=qs[_0x8a03('0x31')](_[_0x8a03('0x37')](_0x29b142['query'],_0x48697b['filters']));if(_0x29b142[_0x8a03('0x30')][_0x8a03('0x38')]){_0x110511['where']=_[_0x8a03('0x39')](_0x110511[_0x8a03('0x4a')],{'$or':_[_0x8a03('0x2b')](_0x110511[_0x8a03('0x34')],function(_0x5b3dde){var _0x39bc59={};_0x39bc59[_0x5b3dde]={'$like':'%'+_0x29b142['query'][_0x8a03('0x38')]+'%'};return _0x39bc59;})});}_0x110511=_['merge']({},_0x110511,_0x29b142[_0x8a03('0x3b')]);return _0x594c21[_0x8a03('0x46')](_0x110511);}})[_0x8a03('0x23')](function(_0x55c950){if(_0x55c950){_0x41f55d=_0x55c950['length'];if(!_0x29b142[_0x8a03('0x30')][_0x8a03('0x4b')](_0x8a03('0x4c'))){_0x110511[_0x8a03('0x1b')]=qs[_0x8a03('0x1b')](_0x29b142['query'][_0x8a03('0x1b')]);_0x110511[_0x8a03('0x1d')]=qs['offset'](_0x29b142[_0x8a03('0x30')][_0x8a03('0x1d')]);}return _0x594c21[_0x8a03('0x46')](_0x110511);}})[_0x8a03('0x23')](function(_0x313114){if(_0x313114){return _0x313114?{'count':_0x41f55d,'rows':_0x313114}:null;}})[_0x8a03('0x23')](respondWithResult(_0x3f0a45,null))[_0x8a03('0x3f')](handleError(_0x3f0a45,null));};exports[_0x8a03('0x4d')]=function(_0x4c6fb9,_0xfc6d80,_0x37bae6){var _0x36a8ae={};var _0x45230a={};var _0x31663d;var _0x50920a;return db[_0x8a03('0x3c')][_0x8a03('0x47')]({'where':{'id':_0x4c6fb9[_0x8a03('0x41')]['id']}})[_0x8a03('0x23')](handleEntityNotFound(_0xfc6d80,null))[_0x8a03('0x23')](function(_0x4ed903){if(_0x4ed903){_0x31663d=_0x4ed903;_0x45230a['model']=_[_0x8a03('0x42')](db[_0x8a03('0x48')][_0x8a03('0x4e')]);_0x45230a[_0x8a03('0x30')]=_[_0x8a03('0x42')](_0x4c6fb9[_0x8a03('0x30')]);_0x45230a[_0x8a03('0x31')]=_['intersection'](_0x45230a[_0x8a03('0x2f')],_0x45230a[_0x8a03('0x30')]);_0x36a8ae[_0x8a03('0x34')]=_['intersection'](_0x45230a[_0x8a03('0x2f')],qs['fields'](_0x4c6fb9[_0x8a03('0x30')][_0x8a03('0x33')]));_0x36a8ae[_0x8a03('0x34')]=_0x36a8ae[_0x8a03('0x34')][_0x8a03('0x49')]?_0x36a8ae['attributes']:_0x45230a[_0x8a03('0x2f')];_0x36a8ae['order']=qs[_0x8a03('0x36')](_0x4c6fb9[_0x8a03('0x30')][_0x8a03('0x36')]);_0x36a8ae[_0x8a03('0x4a')]=qs[_0x8a03('0x31')](_['pick'](_0x4c6fb9[_0x8a03('0x30')],_0x45230a[_0x8a03('0x31')]));if(_0x4c6fb9[_0x8a03('0x30')][_0x8a03('0x38')]){_0x36a8ae['where']=_['merge'](_0x36a8ae[_0x8a03('0x4a')],{'$or':_[_0x8a03('0x2b')](_0x36a8ae[_0x8a03('0x34')],function(_0x3f796a){var _0x179d23={};_0x179d23[_0x3f796a]={'$like':'%'+_0x4c6fb9[_0x8a03('0x30')][_0x8a03('0x38')]+'%'};return _0x179d23;})});}_0x36a8ae=_['merge']({},_0x36a8ae,_0x4c6fb9[_0x8a03('0x3b')]);return _0x31663d[_0x8a03('0x4d')](_0x36a8ae);}})['then'](function(_0x17a795){if(_0x17a795){_0x50920a=_0x17a795[_0x8a03('0x49')];if(!_0x4c6fb9['query'][_0x8a03('0x4b')]('nolimit')){_0x36a8ae['limit']=qs[_0x8a03('0x1b')](_0x4c6fb9['query'][_0x8a03('0x1b')]);_0x36a8ae['offset']=qs[_0x8a03('0x1d')](_0x4c6fb9['query'][_0x8a03('0x1d')]);}return _0x31663d[_0x8a03('0x4d')](_0x36a8ae);}})[_0x8a03('0x23')](function(_0x52010c){if(_0x52010c){return _0x52010c?{'count':_0x50920a,'rows':_0x52010c}:null;}})[_0x8a03('0x23')](respondWithResult(_0xfc6d80,null))[_0x8a03('0x3f')](handleError(_0xfc6d80,null));};exports[_0x8a03('0x4f')]=function(_0x29b637,_0x1d8d23,_0x3ae03d){var _0x52543d={};var _0x55f41d={};var _0x2a6f5b;var _0x59cb40;return db[_0x8a03('0x3c')][_0x8a03('0x47')]({'where':{'id':_0x29b637['params']['id']}})[_0x8a03('0x23')](handleEntityNotFound(_0x1d8d23,null))['then'](function(_0x4fe5d0){if(_0x4fe5d0){_0x2a6f5b=_0x4fe5d0;_0x55f41d['model']=_['keys'](db[_0x8a03('0x48')][_0x8a03('0x4e')]);_0x55f41d['query']=_[_0x8a03('0x42')](_0x29b637[_0x8a03('0x30')]);_0x55f41d[_0x8a03('0x31')]=_[_0x8a03('0x32')](_0x55f41d[_0x8a03('0x2f')],_0x55f41d['query']);_0x52543d[_0x8a03('0x34')]=_[_0x8a03('0x32')](_0x55f41d[_0x8a03('0x2f')],qs['fields'](_0x29b637[_0x8a03('0x30')][_0x8a03('0x33')]));_0x52543d[_0x8a03('0x34')]=_0x52543d[_0x8a03('0x34')][_0x8a03('0x49')]?_0x52543d[_0x8a03('0x34')]:_0x55f41d[_0x8a03('0x2f')];_0x52543d[_0x8a03('0x35')]=qs[_0x8a03('0x36')](_0x29b637[_0x8a03('0x30')][_0x8a03('0x36')]);_0x52543d[_0x8a03('0x4a')]=qs['filters'](_[_0x8a03('0x37')](_0x29b637[_0x8a03('0x30')],_0x55f41d[_0x8a03('0x31')]));if(_0x29b637[_0x8a03('0x30')][_0x8a03('0x38')]){_0x52543d['where']=_[_0x8a03('0x39')](_0x52543d[_0x8a03('0x4a')],{'$or':_[_0x8a03('0x2b')](_0x52543d[_0x8a03('0x34')],function(_0x575a2e){var _0x58a7f0={};_0x58a7f0[_0x575a2e]={'$like':'%'+_0x29b637['query']['filter']+'%'};return _0x58a7f0;})});}_0x52543d=_[_0x8a03('0x39')]({},_0x52543d,_0x29b637[_0x8a03('0x3b')]);return _0x2a6f5b[_0x8a03('0x4f')](_0x52543d);}})['then'](function(_0x179be6){if(_0x179be6){_0x59cb40=_0x179be6[_0x8a03('0x49')];if(!_0x29b637[_0x8a03('0x30')]['hasOwnProperty'](_0x8a03('0x4c'))){_0x52543d[_0x8a03('0x1b')]=qs[_0x8a03('0x1b')](_0x29b637[_0x8a03('0x30')]['limit']);_0x52543d[_0x8a03('0x1d')]=qs[_0x8a03('0x1d')](_0x29b637[_0x8a03('0x30')][_0x8a03('0x1d')]);}return _0x2a6f5b[_0x8a03('0x4f')](_0x52543d);}})[_0x8a03('0x23')](function(_0x16078c){if(_0x16078c){return _0x16078c?{'count':_0x59cb40,'rows':_0x16078c}:null;}})[_0x8a03('0x23')](respondWithResult(_0x1d8d23,null))[_0x8a03('0x3f')](handleError(_0x1d8d23,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c05d518..dd29964 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 _0x1e48=['bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','moment'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x1e48,0x170));var _0x81e4=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0x1e48[_0x258919];return _0xfbd68b;};'use strict';var _=require(_0x81e4('0x0'));var util=require('util');var logger=require(_0x81e4('0x1'))(_0x81e4('0x2'));var moment=require(_0x81e4('0x3'));var BPromise=require(_0x81e4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81e4('0x5'));var rimraf=require(_0x81e4('0x6'));var config=require(_0x81e4('0x7'));var attributes=require(_0x81e4('0x8'));module[_0x81e4('0x9')]=function(_0x4adf44,_0x171c17){return _0x4adf44[_0x81e4('0xa')](_0x81e4('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb963=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x298587,_0x20a353){var _0x267bcd=function(_0x597078){while(--_0x597078){_0x298587['push'](_0x298587['shift']());}};_0x267bcd(++_0x20a353);}(_0xb963,0xea));var _0x3b96=function(_0x3c1910,_0x3ef4d2){_0x3c1910=_0x3c1910-0x0;var _0x2124a6=_0xb963[_0x3c1910];return _0x2124a6;};'use strict';var _=require(_0x3b96('0x0'));var util=require(_0x3b96('0x1'));var logger=require(_0x3b96('0x2'))(_0x3b96('0x3'));var moment=require(_0x3b96('0x4'));var BPromise=require(_0x3b96('0x5'));var rp=require(_0x3b96('0x6'));var fs=require('fs');var path=require(_0x3b96('0x7'));var rimraf=require(_0x3b96('0x8'));var config=require(_0x3b96('0x9'));var attributes=require(_0x3b96('0xa'));module[_0x3b96('0xb')]=function(_0x354a01,_0x256bb9){return _0x354a01['define'](_0x3b96('0xc'),attributes,{'tableName':_0x3b96('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 8cf9399..89bd4e6 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 _0xcf5d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x517a47,_0x3ced22){var _0x489798=function(_0x159a7f){while(--_0x159a7f){_0x517a47['push'](_0x517a47['shift']());}};_0x489798(++_0x3ced22);}(_0xcf5d,0x139));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdcf5('0x0'));var util=require(_0xdcf5('0x1'));var moment=require(_0xdcf5('0x2'));var BPromise=require(_0xdcf5('0x3'));var rs=require(_0xdcf5('0x4'));var fs=require('fs');var Redis=require(_0xdcf5('0x5'));var db=require(_0xdcf5('0x6'))['db'];var utils=require(_0xdcf5('0x7'));var logger=require(_0xdcf5('0x8'))(_0xdcf5('0x9'));var config=require(_0xdcf5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdcf5('0xb')][_0xdcf5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x902472,_0x137615,_0x587a07){return new BPromise(function(_0x58539a,_0x5b189b){return client[_0xdcf5('0xd')](_0x902472,_0x587a07)[_0xdcf5('0xe')](function(_0x55e180){logger['info'](_0xdcf5('0xf'),_0x137615,_0xdcf5('0x10'));logger[_0xdcf5('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x137615,'request\x20sent',JSON[_0xdcf5('0x12')](_0x55e180));if(_0x55e180[_0xdcf5('0x13')]){if(_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x14')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x137615,_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x15')]);return _0x5b189b(_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x15')]);}logger[_0xdcf5('0x13')](_0xdcf5('0xf'),_0x137615,_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x15')]);return _0x58539a(_0x55e180[_0xdcf5('0x13')]['message']);}else{logger[_0xdcf5('0x16')](_0xdcf5('0xf'),_0x137615,_0xdcf5('0x10'));_0x58539a(_0x55e180['result'][_0xdcf5('0x15')]);}})[_0xdcf5('0x17')](function(_0x3c6b33){logger[_0xdcf5('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x137615,_0x3c6b33);_0x5b189b(_0x3c6b33);});});} \ No newline at end of file +var _0xeece=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x593f3c,_0x1e4ba1){var _0x16d9dc=function(_0x29f23e){while(--_0x29f23e){_0x593f3c['push'](_0x593f3c['shift']());}};_0x16d9dc(++_0x1e4ba1);}(_0xeece,0x182));var _0xeeec=function(_0x4e7621,_0x4ce924){_0x4e7621=_0x4e7621-0x0;var _0x341911=_0xeece[_0x4e7621];return _0x341911;};'use strict';var _=require(_0xeeec('0x0'));var util=require('util');var moment=require(_0xeeec('0x1'));var BPromise=require(_0xeeec('0x2'));var rs=require(_0xeeec('0x3'));var fs=require('fs');var Redis=require(_0xeeec('0x4'));var db=require(_0xeeec('0x5'))['db'];var utils=require(_0xeeec('0x6'));var logger=require('../../config/logger')(_0xeeec('0x7'));var config=require(_0xeeec('0x8'));var jayson=require(_0xeeec('0x9'));var client=jayson[_0xeeec('0xa')][_0xeeec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b9a69,_0x28641d,_0x363bc9){return new BPromise(function(_0x50c040,_0x1c5e90){return client[_0xeeec('0xc')](_0x1b9a69,_0x363bc9)[_0xeeec('0xd')](function(_0x58758b){logger['info'](_0xeeec('0xe'),_0x28641d,_0xeeec('0xf'));logger['debug'](_0xeeec('0x10'),_0x28641d,'request\x20sent',JSON[_0xeeec('0x11')](_0x58758b));if(_0x58758b[_0xeeec('0x12')]){if(_0x58758b['error'][_0xeeec('0x13')]===0x1f4){logger[_0xeeec('0x12')](_0xeeec('0xe'),_0x28641d,_0x58758b[_0xeeec('0x12')][_0xeeec('0x14')]);return _0x1c5e90(_0x58758b['error'][_0xeeec('0x14')]);}logger[_0xeeec('0x12')](_0xeeec('0xe'),_0x28641d,_0x58758b['error'][_0xeeec('0x14')]);return _0x50c040(_0x58758b[_0xeeec('0x12')]['message']);}else{logger['info'](_0xeeec('0xe'),_0x28641d,_0xeeec('0xf'));_0x50c040(_0x58758b[_0xeeec('0x15')][_0xeeec('0x14')]);}})[_0xeeec('0x16')](function(_0x144cfe){logger[_0xeeec('0x12')](_0xeeec('0xe'),_0x28641d,_0x144cfe);_0x1c5e90(_0x144cfe);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 287d85e..500a289 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 _0x0952=['get','isAuthenticated','show','post','put','/:id','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0x0952,0x6e));var _0x2095=function(_0x3d07d9,_0x1f673d){_0x3d07d9=_0x3d07d9-0x0;var _0x109509=_0x0952[_0x3d07d9];return _0x109509;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2095('0x0'));var timeout=require(_0x2095('0x1'));var express=require(_0x2095('0x2'));var router=express['Router']();var fs_extra=require(_0x2095('0x3'));var auth=require(_0x2095('0x4'));var interaction=require(_0x2095('0x5'));var config=require(_0x2095('0x6'));var controller=require(_0x2095('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2095('0x8')]);router[_0x2095('0x9')]('/:id',auth[_0x2095('0xa')](),controller[_0x2095('0xb')]);router[_0x2095('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2095('0xd')]('/:id',auth[_0x2095('0xa')](),controller['update']);router['delete'](_0x2095('0xe'),auth[_0x2095('0xa')](),controller[_0x2095('0xf')]);module[_0x2095('0x10')]=router; \ No newline at end of file +var _0x0ca7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id','post','create','put'];(function(_0x5b0935,_0x40cf64){var _0x43fe48=function(_0x5c4eab){while(--_0x5c4eab){_0x5b0935['push'](_0x5b0935['shift']());}};_0x43fe48(++_0x40cf64);}(_0x0ca7,0xe8));var _0x70ca=function(_0xe9e6cf,_0x395f6d){_0xe9e6cf=_0xe9e6cf-0x0;var _0x2b8851=_0x0ca7[_0xe9e6cf];return _0x2b8851;};'use strict';var multer=require(_0x70ca('0x0'));var util=require(_0x70ca('0x1'));var path=require(_0x70ca('0x2'));var timeout=require(_0x70ca('0x3'));var express=require(_0x70ca('0x4'));var router=express[_0x70ca('0x5')]();var fs_extra=require(_0x70ca('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x70ca('0x7'));var config=require('../../config/environment');var controller=require(_0x70ca('0x8'));router[_0x70ca('0x9')]('/',auth[_0x70ca('0xa')](),controller['index']);router[_0x70ca('0x9')](_0x70ca('0xb'),auth[_0x70ca('0xa')](),controller['show']);router[_0x70ca('0xc')]('/',auth['isAuthenticated'](),controller[_0x70ca('0xd')]);router[_0x70ca('0xe')](_0x70ca('0xb'),auth['isAuthenticated'](),controller[_0x70ca('0xf')]);router[_0x70ca('0x10')](_0x70ca('0xb'),auth[_0x70ca('0xa')](),controller[_0x70ca('0x11')]);module[_0x70ca('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 ed9a41e..3e6315e 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 _0xa7c2=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xa7c2,0x182));var _0x2a7c=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa7c2[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x2a7c('0x0'));module[_0x2a7c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2a7c('0x2'),_0x2a7c('0x3'),_0x2a7c('0x4'),_0x2a7c('0x5'),_0x2a7c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2a7c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2a7c('0x8')](_0x2a7c('0x2'),_0x2a7c('0x3'),_0x2a7c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2a7c('0x7')]},'nameField':{'type':Sequelize[_0x2a7c('0x7')]},'customField':{'type':Sequelize[_0x2a7c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a7c('0x7')]}}; \ No newline at end of file +var _0xf390=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2e8cda,_0x52d046){var _0x5c1614=function(_0x320711){while(--_0x320711){_0x2e8cda['push'](_0x2e8cda['shift']());}};_0x5c1614(++_0x52d046);}(_0xf390,0x18b));var _0x0f39=function(_0x2bb112,_0x513419){_0x2bb112=_0x2bb112-0x0;var _0x308d5e=_0xf390[_0x2bb112];return _0x308d5e;};'use strict';var Sequelize=require(_0x0f39('0x0'));module[_0x0f39('0x1')]={'type':{'type':Sequelize[_0x0f39('0x2')](_0x0f39('0x3'),_0x0f39('0x4'),'customVariable',_0x0f39('0x5'),_0x0f39('0x6')),'defaultValue':_0x0f39('0x3')},'content':{'type':Sequelize[_0x0f39('0x7')]},'key':{'type':Sequelize[_0x0f39('0x7')]},'keyType':{'type':Sequelize[_0x0f39('0x2')]('string',_0x0f39('0x4'),_0x0f39('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0f39('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0f39('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0f39('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index eb5b6e5..0643a14 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 _0x7201=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0xad5fb2,_0x26966e){var _0x3464c6=function(_0x28083e){while(--_0x28083e){_0xad5fb2['push'](_0xad5fb2['shift']());}};_0x3464c6(++_0x26966e);}(_0x7201,0xf6));var _0x1720=function(_0x523118,_0x2636f9){_0x523118=_0x523118-0x0;var _0x56dc93=_0x7201[_0x523118];return _0x56dc93;};'use strict';var emlformat=require(_0x1720('0x0'));var rimraf=require(_0x1720('0x1'));var zipdir=require(_0x1720('0x2'));var jsonpatch=require(_0x1720('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1720('0x4'));var Mustache=require(_0x1720('0x5'));var util=require(_0x1720('0x6'));var path=require(_0x1720('0x7'));var sox=require(_0x1720('0x8'));var csv=require(_0x1720('0x9'));var ejs=require(_0x1720('0xa'));var fs=require('fs');var fs_extra=require(_0x1720('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1720('0xc'));var jsforce=require(_0x1720('0xd'));var deskjs=require(_0x1720('0xe'));var toCsv=require(_0x1720('0x9'));var querystring=require('querystring');var Papa=require(_0x1720('0xf'));var Redis=require(_0x1720('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1720('0x11'));var as=require(_0x1720('0x12'));var hardwareService=require(_0x1720('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1720('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1720('0x15'));var db=require(_0x1720('0x16'))['db'];function respondWithStatusCode(_0x5c4d64,_0x4b4ff9){_0x4b4ff9=_0x4b4ff9||0xcc;return function(_0x4095a9){if(_0x4095a9){return _0x5c4d64[_0x1720('0x17')](_0x4b4ff9);}return _0x5c4d64[_0x1720('0x18')](_0x4b4ff9)[_0x1720('0x19')]();};}function respondWithResult(_0xd54d75,_0xc468c8){_0xc468c8=_0xc468c8||0xc8;return function(_0x3fd009){if(_0x3fd009){return _0xd54d75[_0x1720('0x18')](_0xc468c8)['json'](_0x3fd009);}};}function respondWithFilteredResult(_0x580a6b,_0xfaf74f){return function(_0x28ee9c){if(_0x28ee9c){var _0x4efe08=typeof _0xfaf74f['offset']===_0x1720('0x1a')&&typeof _0xfaf74f[_0x1720('0x1b')]===_0x1720('0x1a');var _0x1688ec=_0x28ee9c[_0x1720('0x1c')];var _0x205968=_0x4efe08?0x0:_0xfaf74f[_0x1720('0x1d')];var _0xb2cf04=_0x4efe08?_0x28ee9c[_0x1720('0x1c')]:_0xfaf74f['offset']+_0xfaf74f[_0x1720('0x1b')];var _0x4ccf05;if(_0xb2cf04>=_0x1688ec){_0xb2cf04=_0x1688ec;_0x4ccf05=0xc8;}else{_0x4ccf05=0xce;}_0x580a6b[_0x1720('0x18')](_0x4ccf05);return _0x580a6b['set'](_0x1720('0x1e'),_0x205968+'-'+_0xb2cf04+'/'+_0x1688ec)[_0x1720('0x1f')](_0x28ee9c);}return null;};}function patchUpdates(_0x5923aa){return function(_0x2145fb){try{jsonpatch[_0x1720('0x20')](_0x2145fb,_0x5923aa,!![]);}catch(_0x172e67){return BPromise[_0x1720('0x21')](_0x172e67);}return _0x2145fb[_0x1720('0x22')]();};}function saveUpdates(_0x589bf5,_0xd414a4){return function(_0x59b0ea){if(_0x59b0ea){return _0x59b0ea['update'](_0x589bf5)[_0x1720('0x23')](function(_0x1666ba){return _0x1666ba;});}return null;};}function removeEntity(_0x3448d6,_0xd5e8cb){return function(_0x1aa4d1){if(_0x1aa4d1){return _0x1aa4d1['destroy']()[_0x1720('0x23')](function(){_0x3448d6[_0x1720('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56dcb7,_0x268892){return function(_0x5a5c34){if(!_0x5a5c34){_0x56dcb7['sendStatus'](0x194);}return _0x5a5c34;};}function handleError(_0x5e3a9e,_0x61f74c){_0x61f74c=_0x61f74c||0x1f4;return function(_0x52d9d4){logger[_0x1720('0x24')](_0x52d9d4[_0x1720('0x25')]);if(_0x52d9d4[_0x1720('0x26')]){delete _0x52d9d4[_0x1720('0x26')];}_0x5e3a9e[_0x1720('0x18')](_0x61f74c)[_0x1720('0x27')](_0x52d9d4);};}exports[_0x1720('0x28')]=function(_0x1f3369,_0x2c32ce){var _0x205c94={},_0x24bbf6={},_0x37096c={'count':0x0,'rows':[]};var _0x213d5f=_[_0x1720('0x29')](db[_0x1720('0x2a')][_0x1720('0x2b')],function(_0x29f7d7){return{'name':_0x29f7d7[_0x1720('0x2c')],'type':_0x29f7d7[_0x1720('0x2d')]['key']};});_0x24bbf6[_0x1720('0x2e')]=_[_0x1720('0x29')](_0x213d5f,'name');_0x24bbf6[_0x1720('0x2f')]=_[_0x1720('0x30')](_0x1f3369[_0x1720('0x2f')]);_0x24bbf6[_0x1720('0x31')]=_[_0x1720('0x32')](_0x24bbf6[_0x1720('0x2e')],_0x24bbf6[_0x1720('0x2f')]);_0x205c94['attributes']=_[_0x1720('0x32')](_0x24bbf6['model'],qs[_0x1720('0x33')](_0x1f3369['query'][_0x1720('0x33')]));_0x205c94[_0x1720('0x34')]=_0x205c94[_0x1720('0x34')][_0x1720('0x35')]?_0x205c94[_0x1720('0x34')]:_0x24bbf6[_0x1720('0x2e')];if(!_0x1f3369['query'][_0x1720('0x36')](_0x1720('0x37'))){_0x205c94['limit']=qs[_0x1720('0x1b')](_0x1f3369[_0x1720('0x2f')][_0x1720('0x1b')]);_0x205c94['offset']=qs[_0x1720('0x1d')](_0x1f3369[_0x1720('0x2f')][_0x1720('0x1d')]);}_0x205c94[_0x1720('0x38')]=qs[_0x1720('0x39')](_0x1f3369[_0x1720('0x2f')][_0x1720('0x39')]);_0x205c94[_0x1720('0x3a')]=qs['filters'](_[_0x1720('0x3b')](_0x1f3369[_0x1720('0x2f')],_0x24bbf6[_0x1720('0x31')]),_0x213d5f);if(_0x1f3369['query'][_0x1720('0x3c')]){_0x205c94[_0x1720('0x3a')]=_[_0x1720('0x3d')](_0x205c94['where'],{'$or':_[_0x1720('0x29')](_0x213d5f,function(_0x5d07a0){if(_0x5d07a0[_0x1720('0x2d')]!==_0x1720('0x3e')){var _0x3fe337={};_0x3fe337[_0x5d07a0[_0x1720('0x26')]]={'$like':'%'+_0x1f3369['query'][_0x1720('0x3c')]+'%'};return _0x3fe337;}})});}_0x205c94=_[_0x1720('0x3d')]({},_0x205c94,_0x1f3369['options']);var _0x5d697a={'where':_0x205c94[_0x1720('0x3a')]};return db[_0x1720('0x2a')][_0x1720('0x1c')](_0x5d697a)[_0x1720('0x23')](function(_0x172174){_0x37096c[_0x1720('0x1c')]=_0x172174;if(_0x1f3369['query'][_0x1720('0x3f')]){_0x205c94[_0x1720('0x40')]=[{'all':!![]}];}return db[_0x1720('0x2a')][_0x1720('0x41')](_0x205c94);})[_0x1720('0x23')](function(_0x230d5b){_0x37096c[_0x1720('0x42')]=_0x230d5b;return _0x37096c;})[_0x1720('0x23')](respondWithFilteredResult(_0x2c32ce,_0x205c94))[_0x1720('0x43')](handleError(_0x2c32ce,null));};exports['show']=function(_0x1a75ff,_0x4b069b){var _0x2e9b70={'raw':!![],'where':{'id':_0x1a75ff[_0x1720('0x44')]['id']}},_0x489dc={};_0x489dc['model']=_[_0x1720('0x30')](db[_0x1720('0x2a')]['rawAttributes']);_0x489dc[_0x1720('0x2f')]=_[_0x1720('0x30')](_0x1a75ff[_0x1720('0x2f')]);_0x489dc[_0x1720('0x31')]=_['intersection'](_0x489dc[_0x1720('0x2e')],_0x489dc[_0x1720('0x2f')]);_0x2e9b70['attributes']=_[_0x1720('0x32')](_0x489dc[_0x1720('0x2e')],qs['fields'](_0x1a75ff[_0x1720('0x2f')][_0x1720('0x33')]));_0x2e9b70[_0x1720('0x34')]=_0x2e9b70[_0x1720('0x34')][_0x1720('0x35')]?_0x2e9b70['attributes']:_0x489dc[_0x1720('0x2e')];if(_0x1a75ff[_0x1720('0x2f')]['includeAll']){_0x2e9b70['include']=[{'all':!![]}];}_0x2e9b70=_[_0x1720('0x3d')]({},_0x2e9b70,_0x1a75ff[_0x1720('0x45')]);return db[_0x1720('0x2a')][_0x1720('0x46')](_0x2e9b70)['then'](handleEntityNotFound(_0x4b069b,null))[_0x1720('0x23')](respondWithResult(_0x4b069b,null))[_0x1720('0x43')](handleError(_0x4b069b,null));};exports[_0x1720('0x47')]=function(_0x2e130a,_0x40dd41){return db[_0x1720('0x2a')]['create'](_0x2e130a[_0x1720('0x48')],{})['then'](respondWithResult(_0x40dd41,0xc9))[_0x1720('0x43')](handleError(_0x40dd41,null));};exports[_0x1720('0x49')]=function(_0x16d0c1,_0x285340){if(_0x16d0c1['body']['id']){delete _0x16d0c1['body']['id'];}return db[_0x1720('0x2a')][_0x1720('0x46')]({'where':{'id':_0x16d0c1[_0x1720('0x44')]['id']}})[_0x1720('0x23')](handleEntityNotFound(_0x285340,null))['then'](saveUpdates(_0x16d0c1[_0x1720('0x48')],null))[_0x1720('0x23')](respondWithResult(_0x285340,null))['catch'](handleError(_0x285340,null));};exports[_0x1720('0x4a')]=function(_0x50b130,_0x577e50){return db['SugarcrmField'][_0x1720('0x46')]({'where':{'id':_0x50b130[_0x1720('0x44')]['id']}})[_0x1720('0x23')](handleEntityNotFound(_0x577e50,null))[_0x1720('0x23')](removeEntity(_0x577e50,null))[_0x1720('0x43')](handleError(_0x577e50,null));}; \ No newline at end of file +var _0x1357=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','name','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1357,0x78));var _0x7135=function(_0x516220,_0x496e45){_0x516220=_0x516220-0x0;var _0x52ee6e=_0x1357[_0x516220];return _0x52ee6e;};'use strict';var emlformat=require(_0x7135('0x0'));var rimraf=require(_0x7135('0x1'));var zipdir=require(_0x7135('0x2'));var jsonpatch=require(_0x7135('0x3'));var rp=require(_0x7135('0x4'));var moment=require(_0x7135('0x5'));var BPromise=require(_0x7135('0x6'));var Mustache=require('mustache');var util=require(_0x7135('0x7'));var path=require(_0x7135('0x8'));var sox=require(_0x7135('0x9'));var csv=require(_0x7135('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7135('0xb'));var _=require(_0x7135('0xc'));var squel=require(_0x7135('0xd'));var crypto=require('crypto');var jsforce=require(_0x7135('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7135('0xa'));var querystring=require(_0x7135('0xf'));var Papa=require(_0x7135('0x10'));var Redis=require('ioredis');var authService=require(_0x7135('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7135('0x12'));var logger=require(_0x7135('0x13'))(_0x7135('0x14'));var utils=require(_0x7135('0x15'));var config=require(_0x7135('0x16'));var licenseUtil=require(_0x7135('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c8533,_0x2aba3e){_0x2aba3e=_0x2aba3e||0xcc;return function(_0x17e39b){if(_0x17e39b){return _0x2c8533[_0x7135('0x18')](_0x2aba3e);}return _0x2c8533[_0x7135('0x19')](_0x2aba3e)[_0x7135('0x1a')]();};}function respondWithResult(_0x1a8fd8,_0x9c60e8){_0x9c60e8=_0x9c60e8||0xc8;return function(_0x10f5bf){if(_0x10f5bf){return _0x1a8fd8[_0x7135('0x19')](_0x9c60e8)[_0x7135('0x1b')](_0x10f5bf);}};}function respondWithFilteredResult(_0x4c1d43,_0x9fdc1d){return function(_0x48dc2e){if(_0x48dc2e){var _0x26ca7a=typeof _0x9fdc1d[_0x7135('0x1c')]===_0x7135('0x1d')&&typeof _0x9fdc1d[_0x7135('0x1e')]===_0x7135('0x1d');var _0x143e9e=_0x48dc2e[_0x7135('0x1f')];var _0x5773ec=_0x26ca7a?0x0:_0x9fdc1d[_0x7135('0x1c')];var _0x3065c6=_0x26ca7a?_0x48dc2e['count']:_0x9fdc1d[_0x7135('0x1c')]+_0x9fdc1d[_0x7135('0x1e')];var _0x15fa15;if(_0x3065c6>=_0x143e9e){_0x3065c6=_0x143e9e;_0x15fa15=0xc8;}else{_0x15fa15=0xce;}_0x4c1d43['status'](_0x15fa15);return _0x4c1d43[_0x7135('0x20')](_0x7135('0x21'),_0x5773ec+'-'+_0x3065c6+'/'+_0x143e9e)[_0x7135('0x1b')](_0x48dc2e);}return null;};}function patchUpdates(_0x11d3c8){return function(_0x1a06ae){try{jsonpatch[_0x7135('0x22')](_0x1a06ae,_0x11d3c8,!![]);}catch(_0x35f4eb){return BPromise[_0x7135('0x23')](_0x35f4eb);}return _0x1a06ae[_0x7135('0x24')]();};}function saveUpdates(_0x3f7a03,_0x198cd6){return function(_0xaeff25){if(_0xaeff25){return _0xaeff25['update'](_0x3f7a03)[_0x7135('0x25')](function(_0x76bc57){return _0x76bc57;});}return null;};}function removeEntity(_0x440201,_0x22511f){return function(_0x4a08cf){if(_0x4a08cf){return _0x4a08cf['destroy']()[_0x7135('0x25')](function(){_0x440201[_0x7135('0x19')](0xcc)[_0x7135('0x1a')]();});}};}function handleEntityNotFound(_0x15a6e7,_0xa271d){return function(_0xf9c78a){if(!_0xf9c78a){_0x15a6e7[_0x7135('0x18')](0x194);}return _0xf9c78a;};}function handleError(_0x2bbbbe,_0x3e61b4){_0x3e61b4=_0x3e61b4||0x1f4;return function(_0x26695d){logger['error'](_0x26695d[_0x7135('0x26')]);if(_0x26695d['name']){delete _0x26695d['name'];}_0x2bbbbe[_0x7135('0x19')](_0x3e61b4)[_0x7135('0x27')](_0x26695d);};}exports[_0x7135('0x28')]=function(_0xf6337,_0x569ea5){var _0x2c92e6={},_0x373f2f={},_0x2a1137={'count':0x0,'rows':[]};var _0x59de4b=_[_0x7135('0x29')](db[_0x7135('0x2a')][_0x7135('0x2b')],function(_0x3c0f7b){return{'name':_0x3c0f7b[_0x7135('0x2c')],'type':_0x3c0f7b[_0x7135('0x2d')][_0x7135('0x2e')]};});_0x373f2f[_0x7135('0x2f')]=_[_0x7135('0x29')](_0x59de4b,_0x7135('0x30'));_0x373f2f['query']=_['keys'](_0xf6337[_0x7135('0x31')]);_0x373f2f['filters']=_['intersection'](_0x373f2f[_0x7135('0x2f')],_0x373f2f['query']);_0x2c92e6[_0x7135('0x32')]=_[_0x7135('0x33')](_0x373f2f[_0x7135('0x2f')],qs['fields'](_0xf6337[_0x7135('0x31')][_0x7135('0x34')]));_0x2c92e6[_0x7135('0x32')]=_0x2c92e6[_0x7135('0x32')][_0x7135('0x35')]?_0x2c92e6[_0x7135('0x32')]:_0x373f2f[_0x7135('0x2f')];if(!_0xf6337[_0x7135('0x31')][_0x7135('0x36')](_0x7135('0x37'))){_0x2c92e6[_0x7135('0x1e')]=qs['limit'](_0xf6337[_0x7135('0x31')][_0x7135('0x1e')]);_0x2c92e6[_0x7135('0x1c')]=qs[_0x7135('0x1c')](_0xf6337['query'][_0x7135('0x1c')]);}_0x2c92e6[_0x7135('0x38')]=qs['sort'](_0xf6337[_0x7135('0x31')][_0x7135('0x39')]);_0x2c92e6[_0x7135('0x3a')]=qs[_0x7135('0x3b')](_['pick'](_0xf6337['query'],_0x373f2f[_0x7135('0x3b')]),_0x59de4b);if(_0xf6337[_0x7135('0x31')][_0x7135('0x3c')]){_0x2c92e6[_0x7135('0x3a')]=_['merge'](_0x2c92e6[_0x7135('0x3a')],{'$or':_[_0x7135('0x29')](_0x59de4b,function(_0x279d07){if(_0x279d07['type']!==_0x7135('0x3d')){var _0x67ac28={};_0x67ac28[_0x279d07[_0x7135('0x30')]]={'$like':'%'+_0xf6337[_0x7135('0x31')][_0x7135('0x3c')]+'%'};return _0x67ac28;}})});}_0x2c92e6=_[_0x7135('0x3e')]({},_0x2c92e6,_0xf6337[_0x7135('0x3f')]);var _0x577b2b={'where':_0x2c92e6['where']};return db[_0x7135('0x2a')][_0x7135('0x1f')](_0x577b2b)[_0x7135('0x25')](function(_0x428f33){_0x2a1137[_0x7135('0x1f')]=_0x428f33;if(_0xf6337['query'][_0x7135('0x40')]){_0x2c92e6['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x7135('0x41')](_0x2c92e6);})[_0x7135('0x25')](function(_0x9e04ac){_0x2a1137[_0x7135('0x42')]=_0x9e04ac;return _0x2a1137;})[_0x7135('0x25')](respondWithFilteredResult(_0x569ea5,_0x2c92e6))[_0x7135('0x43')](handleError(_0x569ea5,null));};exports['show']=function(_0x29b84c,_0x1fccde){var _0x4fda9f={'raw':!![],'where':{'id':_0x29b84c[_0x7135('0x44')]['id']}},_0x4b73f9={};_0x4b73f9[_0x7135('0x2f')]=_['keys'](db['SugarcrmField'][_0x7135('0x2b')]);_0x4b73f9['query']=_['keys'](_0x29b84c[_0x7135('0x31')]);_0x4b73f9['filters']=_[_0x7135('0x33')](_0x4b73f9['model'],_0x4b73f9[_0x7135('0x31')]);_0x4fda9f[_0x7135('0x32')]=_[_0x7135('0x33')](_0x4b73f9[_0x7135('0x2f')],qs['fields'](_0x29b84c[_0x7135('0x31')][_0x7135('0x34')]));_0x4fda9f[_0x7135('0x32')]=_0x4fda9f[_0x7135('0x32')][_0x7135('0x35')]?_0x4fda9f[_0x7135('0x32')]:_0x4b73f9['model'];if(_0x29b84c[_0x7135('0x31')][_0x7135('0x40')]){_0x4fda9f[_0x7135('0x45')]=[{'all':!![]}];}_0x4fda9f=_[_0x7135('0x3e')]({},_0x4fda9f,_0x29b84c[_0x7135('0x3f')]);return db[_0x7135('0x2a')][_0x7135('0x46')](_0x4fda9f)[_0x7135('0x25')](handleEntityNotFound(_0x1fccde,null))[_0x7135('0x25')](respondWithResult(_0x1fccde,null))['catch'](handleError(_0x1fccde,null));};exports[_0x7135('0x47')]=function(_0x5946cf,_0x24a7f6){return db[_0x7135('0x2a')][_0x7135('0x47')](_0x5946cf['body'],{})[_0x7135('0x25')](respondWithResult(_0x24a7f6,0xc9))[_0x7135('0x43')](handleError(_0x24a7f6,null));};exports['update']=function(_0x950ee,_0x53bb12){if(_0x950ee['body']['id']){delete _0x950ee[_0x7135('0x48')]['id'];}return db[_0x7135('0x2a')][_0x7135('0x46')]({'where':{'id':_0x950ee[_0x7135('0x44')]['id']}})[_0x7135('0x25')](handleEntityNotFound(_0x53bb12,null))[_0x7135('0x25')](saveUpdates(_0x950ee[_0x7135('0x48')],null))[_0x7135('0x25')](respondWithResult(_0x53bb12,null))['catch'](handleError(_0x53bb12,null));};exports[_0x7135('0x49')]=function(_0x495a35,_0x217968){return db[_0x7135('0x2a')][_0x7135('0x46')]({'where':{'id':_0x495a35['params']['id']}})[_0x7135('0x25')](handleEntityNotFound(_0x217968,null))['then'](removeEntity(_0x217968,null))[_0x7135('0x43')](handleError(_0x217968,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6741d83..7068336 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 _0x3366=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x46ea96,_0x2ada2a){var _0x23be1a=function(_0x41fe97){while(--_0x41fe97){_0x46ea96['push'](_0x46ea96['shift']());}};_0x23be1a(++_0x2ada2a);}(_0x3366,0x194));var _0x6336=function(_0x7b341f,_0x11e481){_0x7b341f=_0x7b341f-0x0;var _0x46d0a1=_0x3366[_0x7b341f];return _0x46d0a1;};'use strict';var _=require('lodash');var util=require(_0x6336('0x0'));var logger=require(_0x6336('0x1'))(_0x6336('0x2'));var moment=require(_0x6336('0x3'));var BPromise=require(_0x6336('0x4'));var rp=require(_0x6336('0x5'));var fs=require('fs');var path=require(_0x6336('0x6'));var rimraf=require('rimraf');var config=require(_0x6336('0x7'));var attributes=require(_0x6336('0x8'));module[_0x6336('0x9')]=function(_0x561884,_0x2f47c5){return _0x561884[_0x6336('0xa')](_0x6336('0xb'),attributes,{'tableName':_0x6336('0xc'),'paranoid':![],'indexes':[{'name':_0x6336('0xd'),'fields':[_0x6336('0xe'),_0x6336('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95dc=['path','rimraf','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','request-promise'];(function(_0x479691,_0x1002be){var _0x32a5c1=function(_0x2753f4){while(--_0x2753f4){_0x479691['push'](_0x479691['shift']());}};_0x32a5c1(++_0x1002be);}(_0x95dc,0x140));var _0xc95d=function(_0x37bfbb,_0x4e0dff){_0x37bfbb=_0x37bfbb-0x0;var _0x368984=_0x95dc[_0x37bfbb];return _0x368984;};'use strict';var _=require(_0xc95d('0x0'));var util=require(_0xc95d('0x1'));var logger=require('../../config/logger')(_0xc95d('0x2'));var moment=require(_0xc95d('0x3'));var BPromise=require('bluebird');var rp=require(_0xc95d('0x4'));var fs=require('fs');var path=require(_0xc95d('0x5'));var rimraf=require(_0xc95d('0x6'));var config=require('../../config/environment');var attributes=require(_0xc95d('0x7'));module[_0xc95d('0x8')]=function(_0xe6490a,_0x157c9e){return _0xe6490a['define']('SugarcrmField',attributes,{'tableName':_0xc95d('0x9'),'paranoid':![],'indexes':[{'name':_0xc95d('0xa'),'fields':[_0xc95d('0xb'),_0xc95d('0xc')],'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 4880169..69cf313 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 _0x730a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x730a,0x74));var _0xa730=function(_0x6cf622,_0x146e67){_0x6cf622=_0x6cf622-0x0;var _0x1887fe=_0x730a[_0x6cf622];return _0x1887fe;};'use strict';var _=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var moment=require(_0xa730('0x2'));var BPromise=require(_0xa730('0x3'));var rs=require(_0xa730('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa730('0x5'))['db'];var utils=require(_0xa730('0x6'));var logger=require(_0xa730('0x7'))(_0xa730('0x8'));var config=require(_0xa730('0x9'));var jayson=require(_0xa730('0xa'));var client=jayson[_0xa730('0xb')][_0xa730('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17ee05,_0x47f879,_0x39cb84){return new BPromise(function(_0x577cb3,_0x2ecbe7){return client[_0xa730('0xd')](_0x17ee05,_0x39cb84)[_0xa730('0xe')](function(_0x4dca3b){logger[_0xa730('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x47f879,_0xa730('0x10'));logger[_0xa730('0x11')](_0xa730('0x12'),_0x47f879,_0xa730('0x10'),JSON['stringify'](_0x4dca3b));if(_0x4dca3b[_0xa730('0x13')]){if(_0x4dca3b['error'][_0xa730('0x14')]===0x1f4){logger['error'](_0xa730('0x15'),_0x47f879,_0x4dca3b[_0xa730('0x13')][_0xa730('0x16')]);return _0x2ecbe7(_0x4dca3b[_0xa730('0x13')]['message']);}logger[_0xa730('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x47f879,_0x4dca3b[_0xa730('0x13')][_0xa730('0x16')]);return _0x577cb3(_0x4dca3b[_0xa730('0x13')][_0xa730('0x16')]);}else{logger['info'](_0xa730('0x15'),_0x47f879,_0xa730('0x10'));_0x577cb3(_0x4dca3b['result'][_0xa730('0x16')]);}})[_0xa730('0x17')](function(_0x290528){logger[_0xa730('0x13')](_0xa730('0x15'),_0x47f879,_0x290528);_0x2ecbe7(_0x290528);});});} \ No newline at end of file +var _0xcf42=['rpc','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34eb20,_0x276d5a){var _0x42e34a=function(_0x1b33c9){while(--_0x1b33c9){_0x34eb20['push'](_0x34eb20['shift']());}};_0x42e34a(++_0x276d5a);}(_0xcf42,0x189));var _0x2cf4=function(_0x568f2c,_0xa2ecbf){_0x568f2c=_0x568f2c-0x0;var _0x55a92f=_0xcf42[_0x568f2c];return _0x55a92f;};'use strict';var _=require('lodash');var util=require(_0x2cf4('0x0'));var moment=require(_0x2cf4('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cf4('0x2'));var fs=require('fs');var Redis=require(_0x2cf4('0x3'));var db=require(_0x2cf4('0x4'))['db'];var utils=require(_0x2cf4('0x5'));var logger=require(_0x2cf4('0x6'))(_0x2cf4('0x7'));var config=require('../../config/environment');var jayson=require(_0x2cf4('0x8'));var client=jayson[_0x2cf4('0x9')][_0x2cf4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19624d,_0x4e57ea,_0x19b793){return new BPromise(function(_0x34c9df,_0x32d761){return client['request'](_0x19624d,_0x19b793)[_0x2cf4('0xb')](function(_0x4ce0c3){logger[_0x2cf4('0xc')](_0x2cf4('0xd'),_0x4e57ea,_0x2cf4('0xe'));logger[_0x2cf4('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4e57ea,_0x2cf4('0xe'),JSON['stringify'](_0x4ce0c3));if(_0x4ce0c3[_0x2cf4('0x10')]){if(_0x4ce0c3[_0x2cf4('0x10')]['code']===0x1f4){logger[_0x2cf4('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4e57ea,_0x4ce0c3[_0x2cf4('0x10')][_0x2cf4('0x11')]);return _0x32d761(_0x4ce0c3['error'][_0x2cf4('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4e57ea,_0x4ce0c3[_0x2cf4('0x10')][_0x2cf4('0x11')]);return _0x34c9df(_0x4ce0c3[_0x2cf4('0x10')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x4e57ea,_0x2cf4('0xe'));_0x34c9df(_0x4ce0c3[_0x2cf4('0x12')]['message']);}})[_0x2cf4('0x13')](function(_0x41a3e9){logger[_0x2cf4('0x10')](_0x2cf4('0xd'),_0x4e57ea,_0x41a3e9);_0x32d761(_0x41a3e9);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 86aee8b..2a7d49d 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 _0x28aa=['fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x527c6d,_0x48bcc6){var _0x12463a=function(_0x379e03){while(--_0x379e03){_0x527c6d['push'](_0x527c6d['shift']());}};_0x12463a(++_0x48bcc6);}(_0x28aa,0xf8));var _0xa28a=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x28aa[_0x34bc30];return _0x5706de;};'use strict';var multer=require('multer');var util=require(_0xa28a('0x0'));var path=require(_0xa28a('0x1'));var timeout=require(_0xa28a('0x2'));var express=require(_0xa28a('0x3'));var router=express[_0xa28a('0x4')]();var fs_extra=require(_0xa28a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa28a('0x6'));var config=require(_0xa28a('0x7'));var controller=require(_0xa28a('0x8'));router[_0xa28a('0x9')]('/',auth['isAuthenticated'](),controller[_0xa28a('0xa')]);router[_0xa28a('0x9')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0xd')]);router[_0xa28a('0x9')](_0xa28a('0xe'),auth[_0xa28a('0xc')](),controller[_0xa28a('0xf')]);router[_0xa28a('0x9')](_0xa28a('0x10'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x11')]);router[_0xa28a('0x12')]('/',auth[_0xa28a('0xc')](),controller['create']);router[_0xa28a('0x12')](_0xa28a('0xe'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x13')]);router['put'](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller['update']);router[_0xa28a('0x14')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x15')]);module[_0xa28a('0x16')]=router; \ No newline at end of file +var _0x2621=['post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0xc31ef1,_0x4c1dca){var _0x106ce6=function(_0x2f3241){while(--_0x2f3241){_0xc31ef1['push'](_0xc31ef1['shift']());}};_0x106ce6(++_0x4c1dca);}(_0x2621,0x1d2));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1262('0x0'));var util=require(_0x1262('0x1'));var path=require(_0x1262('0x2'));var timeout=require(_0x1262('0x3'));var express=require(_0x1262('0x4'));var router=express[_0x1262('0x5')]();var fs_extra=require(_0x1262('0x6'));var auth=require(_0x1262('0x7'));var interaction=require(_0x1262('0x8'));var config=require(_0x1262('0x9'));var controller=require(_0x1262('0xa'));router[_0x1262('0xb')]('/',auth[_0x1262('0xc')](),controller[_0x1262('0xd')]);router['get'](_0x1262('0xe'),auth['isAuthenticated'](),controller[_0x1262('0xf')]);router['get'](_0x1262('0x10'),auth[_0x1262('0xc')](),controller[_0x1262('0x11')]);router['get'](_0x1262('0x12'),auth['isAuthenticated'](),controller[_0x1262('0x13')]);router[_0x1262('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1262('0x14')](_0x1262('0x10'),auth[_0x1262('0xc')](),controller[_0x1262('0x15')]);router[_0x1262('0x16')](_0x1262('0xe'),auth['isAuthenticated'](),controller[_0x1262('0x17')]);router[_0x1262('0x18')](_0x1262('0xe'),auth['isAuthenticated'](),controller[_0x1262('0x19')]);module[_0x1262('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 7a2dda0..d1ad133 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 _0x1a14=['exports','STRING','HelpDesk'];(function(_0x17213c,_0x9e6ff7){var _0x53e5ed=function(_0x560b98){while(--_0x560b98){_0x17213c['push'](_0x17213c['shift']());}};_0x53e5ed(++_0x9e6ff7);}(_0x1a14,0xde));var _0x41a1=function(_0x3b0b2e,_0x21e865){_0x3b0b2e=_0x3b0b2e-0x0;var _0x517bc5=_0x1a14[_0x3b0b2e];return _0x517bc5;};'use strict';var Sequelize=require('sequelize');module[_0x41a1('0x0')]={'name':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x41a1('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![],'defaultValue':_0x41a1('0x2')},'remoteUri':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x3309=['sequelize','STRING','HelpDesk'];(function(_0x268308,_0x3c8b08){var _0x3e3672=function(_0x5dc8a9){while(--_0x5dc8a9){_0x268308['push'](_0x268308['shift']());}};_0x3e3672(++_0x3c8b08);}(_0x3309,0x105));var _0x9330=function(_0x43dd72,_0x5bc4c2){_0x43dd72=_0x43dd72-0x0;var _0x42e729=_0x3309[_0x43dd72];return _0x42e729;};'use strict';var Sequelize=require(_0x9330('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9330('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9330('0x1')],'allowNull':![],'defaultValue':_0x9330('0x2')},'remoteUri':{'type':Sequelize[_0x9330('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9330('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9330('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 8152509..1410f77 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 _0xe989=['filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','success','POST','result','sessionName','autogenerated','reference','owner','remove','includes','editable','startsWith','cf_','picklist','picklistValues','label','log','test','statusCode','stringify','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','util','path','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','VtigerAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick'];(function(_0x504a01,_0x3e9259){var _0x2fc524=function(_0x288090){while(--_0x288090){_0x504a01['push'](_0x504a01['shift']());}};_0x2fc524(++_0x3e9259);}(_0xe989,0xa6));var _0x9e98=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0xe989[_0x575446];return _0x2fb644;};'use strict';var emlformat=require(_0x9e98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9e98('0x1'));var moment=require(_0x9e98('0x2'));var BPromise=require(_0x9e98('0x3'));var Mustache=require('mustache');var util=require(_0x9e98('0x4'));var path=require(_0x9e98('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e98('0x6'));var _=require('lodash');var squel=require(_0x9e98('0x7'));var crypto=require('crypto');var jsforce=require(_0x9e98('0x8'));var deskjs=require(_0x9e98('0x9'));var toCsv=require(_0x9e98('0xa'));var querystring=require(_0x9e98('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9e98('0xc'));var qs=require(_0x9e98('0xd'));var as=require(_0x9e98('0xe'));var hardwareService=require(_0x9e98('0xf'));var logger=require(_0x9e98('0x10'))(_0x9e98('0x11'));var utils=require('../../config/utils');var config=require(_0x9e98('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x135948,_0x474a67){_0x474a67=_0x474a67||0xcc;return function(_0x4572da){if(_0x4572da){return _0x135948[_0x9e98('0x13')](_0x474a67);}return _0x135948[_0x9e98('0x14')](_0x474a67)['end']();};}function respondWithResult(_0x155360,_0x5f51f1){_0x5f51f1=_0x5f51f1||0xc8;return function(_0x5686c5){if(_0x5686c5){return _0x155360['status'](_0x5f51f1)[_0x9e98('0x15')](_0x5686c5);}};}function respondWithFilteredResult(_0x587a08,_0x3a4622){return function(_0x4fdb5b){if(_0x4fdb5b){var _0x3dc8c8=typeof _0x3a4622[_0x9e98('0x16')]==='undefined'&&typeof _0x3a4622[_0x9e98('0x17')]===_0x9e98('0x18');var _0x5468fa=_0x4fdb5b[_0x9e98('0x19')];var _0x273778=_0x3dc8c8?0x0:_0x3a4622[_0x9e98('0x16')];var _0x3f628f=_0x3dc8c8?_0x4fdb5b[_0x9e98('0x19')]:_0x3a4622[_0x9e98('0x16')]+_0x3a4622[_0x9e98('0x17')];var _0x41d4a7;if(_0x3f628f>=_0x5468fa){_0x3f628f=_0x5468fa;_0x41d4a7=0xc8;}else{_0x41d4a7=0xce;}_0x587a08[_0x9e98('0x14')](_0x41d4a7);return _0x587a08[_0x9e98('0x1a')](_0x9e98('0x1b'),_0x273778+'-'+_0x3f628f+'/'+_0x5468fa)['json'](_0x4fdb5b);}return null;};}function patchUpdates(_0x4bb134){return function(_0x538a06){try{jsonpatch[_0x9e98('0x1c')](_0x538a06,_0x4bb134,!![]);}catch(_0x10a8e4){return BPromise[_0x9e98('0x1d')](_0x10a8e4);}return _0x538a06[_0x9e98('0x1e')]();};}function saveUpdates(_0x4597f2,_0x21c0c9){return function(_0x55a6b5){if(_0x55a6b5){return _0x55a6b5[_0x9e98('0x1f')](_0x4597f2)[_0x9e98('0x20')](function(_0x9161a6){return _0x9161a6;});}return null;};}function removeEntity(_0x5a4aa0,_0x26c1e3){return function(_0x1f0480){if(_0x1f0480){return _0x1f0480[_0x9e98('0x21')]()[_0x9e98('0x20')](function(){_0x5a4aa0[_0x9e98('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f331,_0x4f7962){return function(_0x5e8721){if(!_0x5e8721){_0x56f331[_0x9e98('0x13')](0x194);}return _0x5e8721;};}function handleError(_0x5d61e0,_0x5e9724){_0x5e9724=_0x5e9724||0x1f4;return function(_0x460afd){logger['error'](_0x460afd['stack']);if(_0x460afd[_0x9e98('0x22')]){delete _0x460afd[_0x9e98('0x22')];}_0x5d61e0[_0x9e98('0x14')](_0x5e9724)[_0x9e98('0x23')](_0x460afd);};}exports['index']=function(_0x34db69,_0x4c10f5){var _0x5db717={},_0x49742f={},_0x5495c7={'count':0x0,'rows':[]};var _0x2c7fc3=_['map'](db[_0x9e98('0x24')][_0x9e98('0x25')],function(_0x4e76b6){return{'name':_0x4e76b6[_0x9e98('0x26')],'type':_0x4e76b6[_0x9e98('0x27')][_0x9e98('0x28')]};});_0x49742f[_0x9e98('0x29')]=_[_0x9e98('0x2a')](_0x2c7fc3,_0x9e98('0x22'));_0x49742f['query']=_[_0x9e98('0x2b')](_0x34db69[_0x9e98('0x2c')]);_0x49742f[_0x9e98('0x2d')]=_[_0x9e98('0x2e')](_0x49742f[_0x9e98('0x29')],_0x49742f[_0x9e98('0x2c')]);_0x5db717['attributes']=_[_0x9e98('0x2e')](_0x49742f[_0x9e98('0x29')],qs[_0x9e98('0x2f')](_0x34db69[_0x9e98('0x2c')]['fields']));_0x5db717[_0x9e98('0x30')]=_0x5db717[_0x9e98('0x30')]['length']?_0x5db717[_0x9e98('0x30')]:_0x49742f[_0x9e98('0x29')];if(!_0x34db69[_0x9e98('0x2c')][_0x9e98('0x31')]('nolimit')){_0x5db717[_0x9e98('0x17')]=qs[_0x9e98('0x17')](_0x34db69[_0x9e98('0x2c')]['limit']);_0x5db717[_0x9e98('0x16')]=qs[_0x9e98('0x16')](_0x34db69['query'][_0x9e98('0x16')]);}_0x5db717[_0x9e98('0x32')]=qs[_0x9e98('0x33')](_0x34db69[_0x9e98('0x2c')][_0x9e98('0x33')]);_0x5db717[_0x9e98('0x34')]=qs['filters'](_[_0x9e98('0x35')](_0x34db69[_0x9e98('0x2c')],_0x49742f[_0x9e98('0x2d')]),_0x2c7fc3);if(_0x34db69[_0x9e98('0x2c')]['filter']){_0x5db717[_0x9e98('0x34')]=_['merge'](_0x5db717[_0x9e98('0x34')],{'$or':_[_0x9e98('0x2a')](_0x2c7fc3,function(_0x2315ef){if(_0x2315ef[_0x9e98('0x27')]!=='VIRTUAL'){var _0x4195b6={};_0x4195b6[_0x2315ef[_0x9e98('0x22')]]={'$like':'%'+_0x34db69[_0x9e98('0x2c')][_0x9e98('0x36')]+'%'};return _0x4195b6;}})});}_0x5db717=_[_0x9e98('0x37')]({},_0x5db717,_0x34db69[_0x9e98('0x38')]);var _0x509d6e={'where':_0x5db717[_0x9e98('0x34')]};return db[_0x9e98('0x24')][_0x9e98('0x19')](_0x509d6e)[_0x9e98('0x20')](function(_0x2d050b){_0x5495c7[_0x9e98('0x19')]=_0x2d050b;if(_0x34db69[_0x9e98('0x2c')][_0x9e98('0x39')]){_0x5db717[_0x9e98('0x3a')]=[{'all':!![]}];}return db[_0x9e98('0x24')][_0x9e98('0x3b')](_0x5db717);})['then'](function(_0xd01ff1){_0x5495c7['rows']=_0xd01ff1;return _0x5495c7;})[_0x9e98('0x20')](respondWithFilteredResult(_0x4c10f5,_0x5db717))[_0x9e98('0x3c')](handleError(_0x4c10f5,null));};exports[_0x9e98('0x3d')]=function(_0x7eaec9,_0x587dd8){var _0x2b98a6={'raw':![],'where':{'id':_0x7eaec9[_0x9e98('0x3e')]['id']}},_0x154aee={};_0x154aee[_0x9e98('0x29')]=_['keys'](db[_0x9e98('0x24')][_0x9e98('0x25')]);_0x154aee['query']=_[_0x9e98('0x2b')](_0x7eaec9[_0x9e98('0x2c')]);_0x154aee[_0x9e98('0x2d')]=_[_0x9e98('0x2e')](_0x154aee[_0x9e98('0x29')],_0x154aee[_0x9e98('0x2c')]);_0x2b98a6[_0x9e98('0x30')]=_[_0x9e98('0x2e')](_0x154aee['model'],qs[_0x9e98('0x2f')](_0x7eaec9['query'][_0x9e98('0x2f')]));_0x2b98a6['attributes']=_0x2b98a6[_0x9e98('0x30')][_0x9e98('0x3f')]?_0x2b98a6[_0x9e98('0x30')]:_0x154aee[_0x9e98('0x29')];if(_0x7eaec9['query'][_0x9e98('0x39')]){_0x2b98a6[_0x9e98('0x3a')]=[{'all':!![]}];}_0x2b98a6=_[_0x9e98('0x37')]({},_0x2b98a6,_0x7eaec9[_0x9e98('0x38')]);return db[_0x9e98('0x24')][_0x9e98('0x40')](_0x2b98a6)[_0x9e98('0x20')](handleEntityNotFound(_0x587dd8,null))[_0x9e98('0x20')](respondWithResult(_0x587dd8,null))[_0x9e98('0x3c')](handleError(_0x587dd8,null));};exports['create']=function(_0x24b192,_0x2f654f){return db[_0x9e98('0x24')][_0x9e98('0x41')](_0x24b192[_0x9e98('0x42')],{})[_0x9e98('0x20')](respondWithResult(_0x2f654f,0xc9))[_0x9e98('0x3c')](handleError(_0x2f654f,null));};exports['update']=function(_0x4815b8,_0x2fa264){if(_0x4815b8[_0x9e98('0x42')]['id']){delete _0x4815b8[_0x9e98('0x42')]['id'];}return db[_0x9e98('0x24')][_0x9e98('0x40')]({'where':{'id':_0x4815b8[_0x9e98('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2fa264,null))[_0x9e98('0x20')](saveUpdates(_0x4815b8[_0x9e98('0x42')],null))['then'](respondWithResult(_0x2fa264,null))[_0x9e98('0x3c')](handleError(_0x2fa264,null));};exports[_0x9e98('0x21')]=function(_0x5d69b5,_0x340941){return db[_0x9e98('0x24')]['find']({'where':{'id':_0x5d69b5[_0x9e98('0x3e')]['id']}})[_0x9e98('0x20')](handleEntityNotFound(_0x340941,null))['then'](removeEntity(_0x340941,null))['catch'](handleError(_0x340941,null));};exports[_0x9e98('0x43')]=function(_0xc7f56f,_0x4dd8fb,_0x1e2793){var _0x16afd6={};var _0x1c93d2={};var _0xd5cc82;var _0x5820ad;return db['VtigerAccount'][_0x9e98('0x44')]({'where':{'id':_0xc7f56f['params']['id']}})[_0x9e98('0x20')](handleEntityNotFound(_0x4dd8fb,null))[_0x9e98('0x20')](function(_0x3f12f0){if(_0x3f12f0){_0xd5cc82=_0x3f12f0;_0x1c93d2[_0x9e98('0x29')]=_[_0x9e98('0x2b')](db['VtigerConfiguration'][_0x9e98('0x25')]);_0x1c93d2['query']=_[_0x9e98('0x2b')](_0xc7f56f[_0x9e98('0x2c')]);_0x1c93d2['filters']=_[_0x9e98('0x2e')](_0x1c93d2[_0x9e98('0x29')],_0x1c93d2[_0x9e98('0x2c')]);_0x16afd6['attributes']=_[_0x9e98('0x2e')](_0x1c93d2['model'],qs[_0x9e98('0x2f')](_0xc7f56f['query'][_0x9e98('0x2f')]));_0x16afd6[_0x9e98('0x30')]=_0x16afd6[_0x9e98('0x30')]['length']?_0x16afd6[_0x9e98('0x30')]:_0x1c93d2[_0x9e98('0x29')];_0x16afd6['order']=qs['sort'](_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x33')]);_0x16afd6[_0x9e98('0x34')]=qs[_0x9e98('0x2d')](_[_0x9e98('0x35')](_0xc7f56f[_0x9e98('0x2c')],_0x1c93d2[_0x9e98('0x2d')]));if(_0xc7f56f['query'][_0x9e98('0x36')]){_0x16afd6['where']=_['merge'](_0x16afd6[_0x9e98('0x34')],{'$or':_[_0x9e98('0x2a')](_0x16afd6['attributes'],function(_0x980078){var _0x58d22e={};_0x58d22e[_0x980078]={'$like':'%'+_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x36')]+'%'};return _0x58d22e;})});}_0x16afd6=_['merge']({},_0x16afd6,_0xc7f56f['options']);return _0xd5cc82[_0x9e98('0x43')](_0x16afd6);}})['then'](function(_0x3d5007){if(_0x3d5007){_0x5820ad=_0x3d5007[_0x9e98('0x3f')];if(!_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x31')]('nolimit')){_0x16afd6[_0x9e98('0x17')]=qs[_0x9e98('0x17')](_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x17')]);_0x16afd6['offset']=qs[_0x9e98('0x16')](_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x16')]);}return _0xd5cc82[_0x9e98('0x43')](_0x16afd6);}})[_0x9e98('0x20')](function(_0x24b1b1){if(_0x24b1b1){return _0x24b1b1?{'count':_0x5820ad,'rows':_0x24b1b1}:null;}})[_0x9e98('0x20')](respondWithResult(_0x4dd8fb,null))[_0x9e98('0x3c')](handleError(_0x4dd8fb,null));};exports[_0x9e98('0x45')]=function(_0x27d3f1,_0x5abd33,_0x4ac1c7){if(_0x27d3f1[_0x9e98('0x42')]['id']){delete _0x27d3f1[_0x9e98('0x42')]['id'];}return db[_0x9e98('0x24')][_0x9e98('0x44')]({'where':{'id':_0x27d3f1[_0x9e98('0x3e')]['id']}})[_0x9e98('0x20')](handleEntityNotFound(_0x5abd33,null))[_0x9e98('0x20')](function(_0x576201){if(_0x576201){_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x46')]=_0x576201['id'];_0x27d3f1['body'][_0x9e98('0x47')]=integrations[_0x9e98('0x48')](_0x27d3f1[_0x9e98('0x42')]['channel'],_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x27')]);_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x49')]=integrations[_0x9e98('0x4a')](_0x27d3f1['body'][_0x9e98('0x4b')],_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x27')]);return db[_0x9e98('0x4c')]['create'](_0x27d3f1[_0x9e98('0x42')],{'include':[{'model':db[_0x9e98('0x4d')],'as':_0x9e98('0x47')},{'model':db[_0x9e98('0x4d')],'as':_0x9e98('0x49')}]});}return null;})[_0x9e98('0x20')](respondWithResult(_0x5abd33,null))[_0x9e98('0x3c')](handleError(_0x5abd33,null));};var md5=require(_0x9e98('0x4e'));exports[_0x9e98('0x4f')]=function(_0x2e9bd7,_0x212016,_0x2baa95){var _0x103ff7=null;var _0x55d13f=null;var _0xb01ad6=null;var _0x242e53=null;var _0x459d5d='';return db[_0x9e98('0x24')][_0x9e98('0x44')]({'where':{'id':_0x2e9bd7[_0x9e98('0x3e')]['id']},'attributes':['id',_0x9e98('0x22'),_0x9e98('0x50'),_0x9e98('0x51'),_0x9e98('0x52'),'remoteUri',_0x9e98('0x53'),_0x9e98('0x54')]})['then'](handleEntityNotFound(_0x212016,null))['then'](function(_0xcad415){if(_0xcad415){_0x103ff7=_0xcad415[_0x9e98('0x50')];_0x55d13f=_0xcad415[_0x9e98('0x54')];_0xb01ad6=_0xcad415[_0x9e98('0x52')];_0x459d5d=_0xcad415['remoteUri'];var _0x5a3357=_0x459d5d[_0x9e98('0x55')](-0x1);if(_0x5a3357==='/'){_0x459d5d=_0x459d5d[_0x9e98('0x56')](0x0,_0x459d5d[_0x9e98('0x57')](_0x5a3357));}_0x242e53=util['format'](_0x9e98('0x58'),_0x459d5d);var _0x149bb8={'method':_0x9e98('0x59'),'uri':_0x242e53,'qs':{'operation':'getchallenge','username':_0xcad415[_0x9e98('0x50')]},'json':!![]};return rp(_0x149bb8);}})[_0x9e98('0x20')](function(_0x3ef45d){if(_0x3ef45d[_0x9e98('0x5a')]){var _0xf77a6f={'method':_0x9e98('0x5b'),'uri':_0x242e53,'form':{'operation':'login','username':_0x103ff7,'accessKey':md5(_0x3ef45d['result']['token']+_0x55d13f)},'json':!![]};return rp(_0xf77a6f);}})['then'](function(_0x206933){if(_0x206933['success']){var _0x5b8c82={'method':_0x9e98('0x59'),'uri':_0x242e53,'qs':{'operation':'describe','username':_0x103ff7,'sessionName':_0x206933[_0x9e98('0x5c')][_0x9e98('0x5d')],'elementType':_0xb01ad6},'json':!![]};return rp(_0x5b8c82);}})[_0x9e98('0x20')](function(_0x59097b){if(_0x59097b[_0x9e98('0x5a')]){var _0x11e5a9=[_0x9e98('0x5e'),_0x9e98('0x5f'),_0x9e98('0x60')];_[_0x9e98('0x61')](_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')],function(_0xaa757e){return _0x11e5a9[_0x9e98('0x62')](_0xaa757e[_0x9e98('0x27')][_0x9e98('0x22')]);});_[_0x9e98('0x61')](_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')],function(_0x5da0b9){return _0x5da0b9[_0x9e98('0x63')]==='false';});return{'count':_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')][_0x9e98('0x3f')],'rows':_[_0x9e98('0x2a')](_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')],function(_0x16596c){return{'id':_0x16596c[_0x9e98('0x22')],'name':_0x16596c['label'],'custom':_[_0x9e98('0x64')](_0x16596c[_0x9e98('0x22')],_0x9e98('0x65'))?!![]:![],'options':_0x16596c[_0x9e98('0x27')][_0x9e98('0x22')]===_0x9e98('0x66')&&_0x16596c[_0x9e98('0x27')][_0x9e98('0x67')]['length']>0x0?_[_0x9e98('0x2a')](_0x16596c[_0x9e98('0x27')][_0x9e98('0x67')],function(_0x4fbcdc){return{'name':_0x4fbcdc[_0x9e98('0x68')],'value':_0x4fbcdc['value']};}):[]};})};}})[_0x9e98('0x20')](respondWithResult(_0x212016,null))[_0x9e98('0x3c')](function(_0x38dfff){console[_0x9e98('0x69')]('vTiger\x20error:\x20'+_0x38dfff);var _0x36dc03=_0x2e9bd7[_0x9e98('0x2c')][_0x9e98('0x6a')]?0x1f4:_0x38dfff[_0x9e98('0x6b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9e98('0x4f'),_0x36dc03,JSON[_0x9e98('0x6c')](_0x38dfff));delete _0x38dfff[_0x9e98('0x22')];if(_0x36dc03===0x191){_0x36dc03=0x190;}_0x212016[_0x9e98('0x14')](_0x36dc03)[_0x9e98('0x23')](_0x2e9bd7[_0x9e98('0x2c')][_0x9e98('0x6a')]?{'message':_0x9e98('0x6d'),'statusCode':_0x38dfff[_0x9e98('0x6b')]}:_0x38dfff);});}; \ No newline at end of file +var _0xa1ad=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VtigerAccount','include','findAll','rows','show','params','keys','length','includeAll','find','catch','create','update','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','GET','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','result','includes','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa1ad,0xeb));var _0xda1a=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0xa1ad[_0x149083];return _0x4dc74e;};'use strict';var emlformat=require(_0xda1a('0x0'));var rimraf=require(_0xda1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda1a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xda1a('0x3'));var Mustache=require(_0xda1a('0x4'));var util=require(_0xda1a('0x5'));var path=require(_0xda1a('0x6'));var sox=require(_0xda1a('0x7'));var csv=require('to-csv');var ejs=require(_0xda1a('0x8'));var fs=require('fs');var fs_extra=require(_0xda1a('0x9'));var _=require(_0xda1a('0xa'));var squel=require(_0xda1a('0xb'));var crypto=require('crypto');var jsforce=require(_0xda1a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda1a('0xd'));var querystring=require(_0xda1a('0xe'));var Papa=require(_0xda1a('0xf'));var Redis=require(_0xda1a('0x10'));var authService=require(_0xda1a('0x11'));var qs=require(_0xda1a('0x12'));var as=require(_0xda1a('0x13'));var hardwareService=require(_0xda1a('0x14'));var logger=require('../../config/logger')(_0xda1a('0x15'));var utils=require(_0xda1a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda1a('0x17'));var db=require(_0xda1a('0x18'))['db'];var integrations=require(_0xda1a('0x19'));function respondWithStatusCode(_0xb77d58,_0x500318){_0x500318=_0x500318||0xcc;return function(_0x52c986){if(_0x52c986){return _0xb77d58[_0xda1a('0x1a')](_0x500318);}return _0xb77d58[_0xda1a('0x1b')](_0x500318)[_0xda1a('0x1c')]();};}function respondWithResult(_0x4c6a19,_0x3a5c54){_0x3a5c54=_0x3a5c54||0xc8;return function(_0x46b54d){if(_0x46b54d){return _0x4c6a19[_0xda1a('0x1b')](_0x3a5c54)[_0xda1a('0x1d')](_0x46b54d);}};}function respondWithFilteredResult(_0x484180,_0x23091b){return function(_0x2c3435){if(_0x2c3435){var _0x52b1bd=typeof _0x23091b[_0xda1a('0x1e')]==='undefined'&&typeof _0x23091b[_0xda1a('0x1f')]===_0xda1a('0x20');var _0x904f43=_0x2c3435[_0xda1a('0x21')];var _0x14e66e=_0x52b1bd?0x0:_0x23091b['offset'];var _0x5345fe=_0x52b1bd?_0x2c3435[_0xda1a('0x21')]:_0x23091b[_0xda1a('0x1e')]+_0x23091b[_0xda1a('0x1f')];var _0x26b669;if(_0x5345fe>=_0x904f43){_0x5345fe=_0x904f43;_0x26b669=0xc8;}else{_0x26b669=0xce;}_0x484180[_0xda1a('0x1b')](_0x26b669);return _0x484180[_0xda1a('0x22')](_0xda1a('0x23'),_0x14e66e+'-'+_0x5345fe+'/'+_0x904f43)[_0xda1a('0x1d')](_0x2c3435);}return null;};}function patchUpdates(_0x1108c2){return function(_0x375d6a){try{jsonpatch[_0xda1a('0x24')](_0x375d6a,_0x1108c2,!![]);}catch(_0x4d019b){return BPromise[_0xda1a('0x25')](_0x4d019b);}return _0x375d6a[_0xda1a('0x26')]();};}function saveUpdates(_0x3a1911,_0x460e69){return function(_0x46f4ca){if(_0x46f4ca){return _0x46f4ca['update'](_0x3a1911)[_0xda1a('0x27')](function(_0xd7333c){return _0xd7333c;});}return null;};}function removeEntity(_0x27caec,_0x4c55c2){return function(_0x23cc62){if(_0x23cc62){return _0x23cc62[_0xda1a('0x28')]()['then'](function(){_0x27caec[_0xda1a('0x1b')](0xcc)[_0xda1a('0x1c')]();});}};}function handleEntityNotFound(_0x1eade5,_0xe649dd){return function(_0x57562c){if(!_0x57562c){_0x1eade5[_0xda1a('0x1a')](0x194);}return _0x57562c;};}function handleError(_0xc3ea54,_0x161a88){_0x161a88=_0x161a88||0x1f4;return function(_0x16b602){logger[_0xda1a('0x29')](_0x16b602['stack']);if(_0x16b602['name']){delete _0x16b602[_0xda1a('0x2a')];}_0xc3ea54[_0xda1a('0x1b')](_0x161a88)[_0xda1a('0x2b')](_0x16b602);};}exports[_0xda1a('0x2c')]=function(_0x19b1a1,_0x18a223){var _0x7ea432={},_0x245bbc={},_0x337de8={'count':0x0,'rows':[]};var _0x256e3e=_[_0xda1a('0x2d')](db['VtigerAccount'][_0xda1a('0x2e')],function(_0x5bf975){return{'name':_0x5bf975['fieldName'],'type':_0x5bf975[_0xda1a('0x2f')]['key']};});_0x245bbc['model']=_[_0xda1a('0x2d')](_0x256e3e,'name');_0x245bbc[_0xda1a('0x30')]=_['keys'](_0x19b1a1[_0xda1a('0x30')]);_0x245bbc[_0xda1a('0x31')]=_[_0xda1a('0x32')](_0x245bbc[_0xda1a('0x33')],_0x245bbc[_0xda1a('0x30')]);_0x7ea432[_0xda1a('0x34')]=_[_0xda1a('0x32')](_0x245bbc[_0xda1a('0x33')],qs[_0xda1a('0x35')](_0x19b1a1[_0xda1a('0x30')]['fields']));_0x7ea432[_0xda1a('0x34')]=_0x7ea432[_0xda1a('0x34')]['length']?_0x7ea432[_0xda1a('0x34')]:_0x245bbc[_0xda1a('0x33')];if(!_0x19b1a1[_0xda1a('0x30')][_0xda1a('0x36')](_0xda1a('0x37'))){_0x7ea432['limit']=qs[_0xda1a('0x1f')](_0x19b1a1['query'][_0xda1a('0x1f')]);_0x7ea432[_0xda1a('0x1e')]=qs[_0xda1a('0x1e')](_0x19b1a1[_0xda1a('0x30')]['offset']);}_0x7ea432[_0xda1a('0x38')]=qs[_0xda1a('0x39')](_0x19b1a1[_0xda1a('0x30')][_0xda1a('0x39')]);_0x7ea432['where']=qs['filters'](_[_0xda1a('0x3a')](_0x19b1a1[_0xda1a('0x30')],_0x245bbc['filters']),_0x256e3e);if(_0x19b1a1[_0xda1a('0x30')][_0xda1a('0x3b')]){_0x7ea432[_0xda1a('0x3c')]=_[_0xda1a('0x3d')](_0x7ea432[_0xda1a('0x3c')],{'$or':_['map'](_0x256e3e,function(_0x567334){if(_0x567334[_0xda1a('0x2f')]!==_0xda1a('0x3e')){var _0x1ef766={};_0x1ef766[_0x567334['name']]={'$like':'%'+_0x19b1a1[_0xda1a('0x30')][_0xda1a('0x3b')]+'%'};return _0x1ef766;}})});}_0x7ea432=_[_0xda1a('0x3d')]({},_0x7ea432,_0x19b1a1[_0xda1a('0x3f')]);var _0x36e7f7={'where':_0x7ea432[_0xda1a('0x3c')]};return db[_0xda1a('0x40')][_0xda1a('0x21')](_0x36e7f7)[_0xda1a('0x27')](function(_0x357eb5){_0x337de8[_0xda1a('0x21')]=_0x357eb5;if(_0x19b1a1[_0xda1a('0x30')]['includeAll']){_0x7ea432[_0xda1a('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0xda1a('0x42')](_0x7ea432);})['then'](function(_0x2a1692){_0x337de8[_0xda1a('0x43')]=_0x2a1692;return _0x337de8;})[_0xda1a('0x27')](respondWithFilteredResult(_0x18a223,_0x7ea432))['catch'](handleError(_0x18a223,null));};exports[_0xda1a('0x44')]=function(_0x354511,_0x35a429){var _0x159ec1={'raw':![],'where':{'id':_0x354511[_0xda1a('0x45')]['id']}},_0x1fb6e0={};_0x1fb6e0[_0xda1a('0x33')]=_[_0xda1a('0x46')](db[_0xda1a('0x40')][_0xda1a('0x2e')]);_0x1fb6e0[_0xda1a('0x30')]=_[_0xda1a('0x46')](_0x354511['query']);_0x1fb6e0[_0xda1a('0x31')]=_[_0xda1a('0x32')](_0x1fb6e0[_0xda1a('0x33')],_0x1fb6e0[_0xda1a('0x30')]);_0x159ec1[_0xda1a('0x34')]=_['intersection'](_0x1fb6e0[_0xda1a('0x33')],qs[_0xda1a('0x35')](_0x354511[_0xda1a('0x30')][_0xda1a('0x35')]));_0x159ec1[_0xda1a('0x34')]=_0x159ec1['attributes'][_0xda1a('0x47')]?_0x159ec1[_0xda1a('0x34')]:_0x1fb6e0[_0xda1a('0x33')];if(_0x354511['query'][_0xda1a('0x48')]){_0x159ec1[_0xda1a('0x41')]=[{'all':!![]}];}_0x159ec1=_[_0xda1a('0x3d')]({},_0x159ec1,_0x354511[_0xda1a('0x3f')]);return db[_0xda1a('0x40')][_0xda1a('0x49')](_0x159ec1)[_0xda1a('0x27')](handleEntityNotFound(_0x35a429,null))[_0xda1a('0x27')](respondWithResult(_0x35a429,null))[_0xda1a('0x4a')](handleError(_0x35a429,null));};exports[_0xda1a('0x4b')]=function(_0x5d2963,_0x46d450){return db[_0xda1a('0x40')][_0xda1a('0x4b')](_0x5d2963['body'],{})[_0xda1a('0x27')](respondWithResult(_0x46d450,0xc9))['catch'](handleError(_0x46d450,null));};exports[_0xda1a('0x4c')]=function(_0xbcd0c9,_0x3293bc){if(_0xbcd0c9[_0xda1a('0x4d')]['id']){delete _0xbcd0c9[_0xda1a('0x4d')]['id'];}return db[_0xda1a('0x40')][_0xda1a('0x49')]({'where':{'id':_0xbcd0c9['params']['id']}})['then'](handleEntityNotFound(_0x3293bc,null))[_0xda1a('0x27')](saveUpdates(_0xbcd0c9[_0xda1a('0x4d')],null))['then'](respondWithResult(_0x3293bc,null))[_0xda1a('0x4a')](handleError(_0x3293bc,null));};exports[_0xda1a('0x28')]=function(_0x196816,_0xbbba65){return db[_0xda1a('0x40')][_0xda1a('0x49')]({'where':{'id':_0x196816[_0xda1a('0x45')]['id']}})[_0xda1a('0x27')](handleEntityNotFound(_0xbbba65,null))[_0xda1a('0x27')](removeEntity(_0xbbba65,null))[_0xda1a('0x4a')](handleError(_0xbbba65,null));};exports['getConfigurations']=function(_0x2c732d,_0x6260c7,_0x17ee3b){var _0x56a143={};var _0x55de1e={};var _0x455a29;var _0x152052;return db[_0xda1a('0x40')][_0xda1a('0x4e')]({'where':{'id':_0x2c732d['params']['id']}})[_0xda1a('0x27')](handleEntityNotFound(_0x6260c7,null))[_0xda1a('0x27')](function(_0x472066){if(_0x472066){_0x455a29=_0x472066;_0x55de1e[_0xda1a('0x33')]=_['keys'](db[_0xda1a('0x4f')][_0xda1a('0x2e')]);_0x55de1e[_0xda1a('0x30')]=_['keys'](_0x2c732d[_0xda1a('0x30')]);_0x55de1e[_0xda1a('0x31')]=_[_0xda1a('0x32')](_0x55de1e[_0xda1a('0x33')],_0x55de1e[_0xda1a('0x30')]);_0x56a143[_0xda1a('0x34')]=_['intersection'](_0x55de1e[_0xda1a('0x33')],qs['fields'](_0x2c732d['query'][_0xda1a('0x35')]));_0x56a143[_0xda1a('0x34')]=_0x56a143[_0xda1a('0x34')][_0xda1a('0x47')]?_0x56a143[_0xda1a('0x34')]:_0x55de1e[_0xda1a('0x33')];_0x56a143[_0xda1a('0x38')]=qs[_0xda1a('0x39')](_0x2c732d[_0xda1a('0x30')][_0xda1a('0x39')]);_0x56a143[_0xda1a('0x3c')]=qs['filters'](_['pick'](_0x2c732d['query'],_0x55de1e[_0xda1a('0x31')]));if(_0x2c732d[_0xda1a('0x30')][_0xda1a('0x3b')]){_0x56a143[_0xda1a('0x3c')]=_[_0xda1a('0x3d')](_0x56a143[_0xda1a('0x3c')],{'$or':_[_0xda1a('0x2d')](_0x56a143[_0xda1a('0x34')],function(_0x101799){var _0x333590={};_0x333590[_0x101799]={'$like':'%'+_0x2c732d[_0xda1a('0x30')][_0xda1a('0x3b')]+'%'};return _0x333590;})});}_0x56a143=_['merge']({},_0x56a143,_0x2c732d[_0xda1a('0x3f')]);return _0x455a29[_0xda1a('0x50')](_0x56a143);}})[_0xda1a('0x27')](function(_0x15af91){if(_0x15af91){_0x152052=_0x15af91[_0xda1a('0x47')];if(!_0x2c732d['query']['hasOwnProperty']('nolimit')){_0x56a143[_0xda1a('0x1f')]=qs['limit'](_0x2c732d[_0xda1a('0x30')][_0xda1a('0x1f')]);_0x56a143[_0xda1a('0x1e')]=qs[_0xda1a('0x1e')](_0x2c732d[_0xda1a('0x30')][_0xda1a('0x1e')]);}return _0x455a29[_0xda1a('0x50')](_0x56a143);}})[_0xda1a('0x27')](function(_0x3799ed){if(_0x3799ed){return _0x3799ed?{'count':_0x152052,'rows':_0x3799ed}:null;}})['then'](respondWithResult(_0x6260c7,null))[_0xda1a('0x4a')](handleError(_0x6260c7,null));};exports[_0xda1a('0x51')]=function(_0x2382dd,_0x14ffbe,_0x3de7dd){if(_0x2382dd['body']['id']){delete _0x2382dd[_0xda1a('0x4d')]['id'];}return db[_0xda1a('0x40')][_0xda1a('0x4e')]({'where':{'id':_0x2382dd['params']['id']}})[_0xda1a('0x27')](handleEntityNotFound(_0x14ffbe,null))['then'](function(_0x27cc0d){if(_0x27cc0d){_0x2382dd[_0xda1a('0x4d')][_0xda1a('0x52')]=_0x27cc0d['id'];_0x2382dd[_0xda1a('0x4d')][_0xda1a('0x53')]=integrations[_0xda1a('0x54')](_0x2382dd['body'][_0xda1a('0x55')],_0x2382dd[_0xda1a('0x4d')][_0xda1a('0x2f')]);_0x2382dd[_0xda1a('0x4d')]['Descriptions']=integrations[_0xda1a('0x56')](_0x2382dd[_0xda1a('0x4d')][_0xda1a('0x55')],_0x2382dd['body'][_0xda1a('0x2f')]);return db[_0xda1a('0x4f')][_0xda1a('0x4b')](_0x2382dd[_0xda1a('0x4d')],{'include':[{'model':db[_0xda1a('0x57')],'as':_0xda1a('0x53')},{'model':db[_0xda1a('0x57')],'as':_0xda1a('0x58')}]});}return null;})['then'](respondWithResult(_0x14ffbe,null))[_0xda1a('0x4a')](handleError(_0x14ffbe,null));};var md5=require(_0xda1a('0x59'));exports[_0xda1a('0x5a')]=function(_0x3771f6,_0x250170,_0x4f4f2c){var _0x3555db=null;var _0x1160fc=null;var _0x1ef215=null;var _0x5bce0d=null;var _0x58980f='';return db[_0xda1a('0x40')][_0xda1a('0x4e')]({'where':{'id':_0x3771f6[_0xda1a('0x45')]['id']},'attributes':['id',_0xda1a('0x2a'),_0xda1a('0x5b'),_0xda1a('0x5c'),_0xda1a('0x5d'),'remoteUri',_0xda1a('0x5e'),_0xda1a('0x5f')]})[_0xda1a('0x27')](handleEntityNotFound(_0x250170,null))[_0xda1a('0x27')](function(_0x1b6365){if(_0x1b6365){_0x3555db=_0x1b6365[_0xda1a('0x5b')];_0x1160fc=_0x1b6365['accessKey'];_0x1ef215=_0x1b6365[_0xda1a('0x5d')];_0x58980f=_0x1b6365[_0xda1a('0x60')];var _0x183403=_0x58980f[_0xda1a('0x61')](-0x1);if(_0x183403==='/'){_0x58980f=_0x58980f[_0xda1a('0x62')](0x0,_0x58980f['lastIndexOf'](_0x183403));}_0x5bce0d=util['format']('%s/webservice.php',_0x58980f);var _0x457fe0={'method':_0xda1a('0x63'),'uri':_0x5bce0d,'qs':{'operation':'getchallenge','username':_0x1b6365[_0xda1a('0x5b')]},'json':!![]};return rp(_0x457fe0);}})[_0xda1a('0x27')](function(_0x4a54a5){if(_0x4a54a5[_0xda1a('0x64')]){var _0xba844f={'method':_0xda1a('0x65'),'uri':_0x5bce0d,'form':{'operation':_0xda1a('0x66'),'username':_0x3555db,'accessKey':md5(_0x4a54a5['result'][_0xda1a('0x67')]+_0x1160fc)},'json':!![]};return rp(_0xba844f);}})[_0xda1a('0x27')](function(_0x364b41){if(_0x364b41[_0xda1a('0x64')]){var _0x1dca16={'method':_0xda1a('0x63'),'uri':_0x5bce0d,'qs':{'operation':_0xda1a('0x68'),'username':_0x3555db,'sessionName':_0x364b41['result'][_0xda1a('0x69')],'elementType':_0x1ef215},'json':!![]};return rp(_0x1dca16);}})['then'](function(_0x13fae6){if(_0x13fae6['success']){var _0x59a84f=[_0xda1a('0x6a'),_0xda1a('0x6b'),_0xda1a('0x6c')];_[_0xda1a('0x6d')](_0x13fae6[_0xda1a('0x6e')][_0xda1a('0x35')],function(_0x50b146){return _0x59a84f[_0xda1a('0x6f')](_0x50b146[_0xda1a('0x2f')]['name']);});_[_0xda1a('0x6d')](_0x13fae6[_0xda1a('0x6e')][_0xda1a('0x35')],function(_0x4f8687){return _0x4f8687['editable']==='false';});return{'count':_0x13fae6[_0xda1a('0x6e')][_0xda1a('0x35')]['length'],'rows':_['map'](_0x13fae6[_0xda1a('0x6e')][_0xda1a('0x35')],function(_0x1bd572){return{'id':_0x1bd572[_0xda1a('0x2a')],'name':_0x1bd572[_0xda1a('0x70')],'custom':_[_0xda1a('0x71')](_0x1bd572[_0xda1a('0x2a')],_0xda1a('0x72'))?!![]:![],'options':_0x1bd572[_0xda1a('0x2f')][_0xda1a('0x2a')]===_0xda1a('0x73')&&_0x1bd572[_0xda1a('0x2f')][_0xda1a('0x74')][_0xda1a('0x47')]>0x0?_['map'](_0x1bd572[_0xda1a('0x2f')]['picklistValues'],function(_0x42ce68){return{'name':_0x42ce68['label'],'value':_0x42ce68[_0xda1a('0x75')]};}):[]};})};}})[_0xda1a('0x27')](respondWithResult(_0x250170,null))[_0xda1a('0x4a')](function(_0x2295b4){console[_0xda1a('0x76')](_0xda1a('0x77')+_0x2295b4);var _0x1b6623=_0x3771f6[_0xda1a('0x30')][_0xda1a('0x78')]?0x1f4:_0x2295b4['statusCode']||0x1f4;logger[_0xda1a('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xda1a('0x5a'),_0x1b6623,JSON[_0xda1a('0x79')](_0x2295b4));delete _0x2295b4[_0xda1a('0x2a')];if(_0x1b6623===0x191){_0x1b6623=0x190;}_0x250170['status'](_0x1b6623)[_0xda1a('0x2b')](_0x3771f6[_0xda1a('0x30')][_0xda1a('0x78')]?{'message':_0xda1a('0x7a'),'statusCode':_0x2295b4[_0xda1a('0x7b')]}:_0x2295b4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ae7446a..5523164 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 _0x33f8=['int_vtiger_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount'];(function(_0x2a8d0f,_0x42983b){var _0xf4cc50=function(_0x15f048){while(--_0x15f048){_0x2a8d0f['push'](_0x2a8d0f['shift']());}};_0xf4cc50(++_0x42983b);}(_0x33f8,0x177));var _0x833f=function(_0x5c938f,_0x1e8963){_0x5c938f=_0x5c938f-0x0;var _0x3f51a5=_0x33f8[_0x5c938f];return _0x3f51a5;};'use strict';var _=require(_0x833f('0x0'));var util=require('util');var logger=require(_0x833f('0x1'))(_0x833f('0x2'));var moment=require('moment');var BPromise=require(_0x833f('0x3'));var rp=require(_0x833f('0x4'));var fs=require('fs');var path=require(_0x833f('0x5'));var rimraf=require('rimraf');var config=require(_0x833f('0x6'));var attributes=require(_0x833f('0x7'));var integrations=require(_0x833f('0x8'));module['exports']=function(_0x4736ec,_0x333b99){return _0x4736ec['define'](_0x833f('0x9'),attributes,{'tableName':_0x833f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f85=['../../config/logger','api','bluebird','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x40ad77,_0x127131){var _0x4b5f84=function(_0x2d122d){while(--_0x2d122d){_0x40ad77['push'](_0x40ad77['shift']());}};_0x4b5f84(++_0x127131);}(_0x7f85,0x18a));var _0x57f8=function(_0xce8183,_0x567545){_0xce8183=_0xce8183-0x0;var _0x27c555=_0x7f85[_0xce8183];return _0x27c555;};'use strict';var _=require(_0x57f8('0x0'));var util=require(_0x57f8('0x1'));var logger=require(_0x57f8('0x2'))(_0x57f8('0x3'));var moment=require('moment');var BPromise=require(_0x57f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57f8('0x5'));var config=require(_0x57f8('0x6'));var attributes=require(_0x57f8('0x7'));var integrations=require(_0x57f8('0x8'));module['exports']=function(_0x4d20cd,_0x552798){return _0x4d20cd['define'](_0x57f8('0x9'),attributes,{'tableName':_0x57f8('0xa'),'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 1475937..551e493 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 _0xeffd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetVtigerAccount','find','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeffd,0x6b));var _0xdeff=function(_0x593b88,_0x2faed9){_0x593b88=_0x593b88-0x0;var _0x4593c2=_0xeffd[_0x593b88];return _0x4593c2;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});}exports['GetVtigerAccount']=function(_0x5c9837){var _0x35635f=this;return new Promise(function(_0x369e13,_0x4b14b6){return db[_0xdeff('0x19')][_0xdeff('0x1a')]({'raw':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x5c9837['options']?_0x5c9837['options']['attributes']||null:null,'limit':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1e')]||null:null,'include':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x5c9837['options']['include'],function(_0x3b2554){return{'model':db[_0x3b2554[_0xdeff('0x21')]],'as':_0x3b2554['as'],'attributes':_0x3b2554[_0xdeff('0x22')],'include':_0x3b2554[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x3b2554['include'],function(_0xb08f19){return{'model':db[_0xb08f19[_0xdeff('0x21')]],'as':_0xb08f19['as'],'attributes':_0xb08f19[_0xdeff('0x22')],'include':_0xb08f19[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0xb08f19[_0xdeff('0x1f')],function(_0x3d0111){return{'model':db[_0x3d0111['model']],'as':_0x3d0111['as'],'attributes':_0x3d0111[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x53b168){logger['info'](_0xdeff('0x23'),_0x5c9837);logger[_0xdeff('0x10')](_0xdeff('0x23'),_0x5c9837,JSON[_0xdeff('0x12')](_0x53b168));_0x369e13(_0x53b168);})[_0xdeff('0x18')](function(_0xf9b278){logger[_0xdeff('0x13')]('GetVtigerAccount',_0xf9b278[_0xdeff('0x16')],_0x5c9837);_0x4b14b6(_0x35635f[_0xdeff('0x13')](0x1f4,_0xf9b278[_0xdeff('0x16')]));});});};exports['ShowVtigerAccount']=function(_0x59f7a0){var _0x346743=this;return new Promise(function(_0x505e3f,_0x69842a){return db[_0xdeff('0x19')][_0xdeff('0x24')]({'raw':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')]['attributes']||null:null,'include':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')],function(_0x321ef0){return{'model':db[_0x321ef0['model']],'as':_0x321ef0['as'],'attributes':_0x321ef0[_0xdeff('0x22')],'include':_0x321ef0['include']?_[_0xdeff('0x20')](_0x321ef0[_0xdeff('0x1f')],function(_0x2e1736){return{'model':db[_0x2e1736[_0xdeff('0x21')]],'as':_0x2e1736['as'],'attributes':_0x2e1736[_0xdeff('0x22')],'include':_0x2e1736[_0xdeff('0x1f')]?_['map'](_0x2e1736[_0xdeff('0x1f')],function(_0x3bf462){return{'model':db[_0x3bf462['model']],'as':_0x3bf462['as'],'attributes':_0x3bf462[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x1c6d4c){logger[_0xdeff('0xe')](_0xdeff('0x25'),_0x59f7a0);logger[_0xdeff('0x10')](_0xdeff('0x25'),_0x59f7a0,JSON[_0xdeff('0x12')](_0x1c6d4c));_0x505e3f(_0x1c6d4c);})['catch'](function(_0x118752){logger['error'](_0xdeff('0x25'),_0x118752[_0xdeff('0x16')],_0x59f7a0);_0x69842a(_0x346743[_0xdeff('0x13')](0x1f4,_0x118752['message']));});});}; \ No newline at end of file +var _0x8f59=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','ShowVtigerAccount','stringify','lodash','util','moment'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x8f59,0x11d));var _0x98f5=function(_0x3f2262,_0x445ffa){_0x3f2262=_0x3f2262-0x0;var _0x293f32=_0x8f59[_0x3f2262];return _0x293f32;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')]({'raw':_0x51a567[_0x98f5('0x17')]?_0x51a567['options'][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x19')]||null:null,'attributes':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'limit':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1b')]||null:null,'include':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')]['include']?_[_0x98f5('0x1c')](_0x51a567['options'][_0x98f5('0x1d')],function(_0x495889){return{'model':db[_0x495889[_0x98f5('0x1e')]],'as':_0x495889['as'],'attributes':_0x495889[_0x98f5('0x1a')],'include':_0x495889[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x495889[_0x98f5('0x1d')],function(_0x18052d){return{'model':db[_0x18052d[_0x98f5('0x1e')]],'as':_0x18052d['as'],'attributes':_0x18052d['attributes'],'include':_0x18052d[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x18052d['include'],function(_0x1a1c55){return{'model':db[_0x1a1c55[_0x98f5('0x1e')]],'as':_0x1a1c55['as'],'attributes':_0x1a1c55[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x230d1b){logger[_0x98f5('0xd')](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x20')]('GetVtigerAccount',_0x51a567,JSON['stringify'](_0x230d1b));_0x9e42dd(_0x230d1b);})[_0x98f5('0x21')](function(_0x71661e){logger[_0x98f5('0x11')](_0x98f5('0x14'),_0x71661e[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c[_0x98f5('0x11')](0x1f4,_0x71661e['message']));});});};exports[_0x98f5('0x22')]=function(_0x6d7418){var _0x7a922b=this;return new Promise(function(_0xd20823,_0x1e7138){return db[_0x98f5('0x15')]['find']({'raw':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x6d7418[_0x98f5('0x17')]?_0x6d7418['options'][_0x98f5('0x19')]||null:null,'attributes':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'include':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')],function(_0x12d874){return{'model':db[_0x12d874[_0x98f5('0x1e')]],'as':_0x12d874['as'],'attributes':_0x12d874[_0x98f5('0x1a')],'include':_0x12d874[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x12d874[_0x98f5('0x1d')],function(_0x2227f1){return{'model':db[_0x2227f1[_0x98f5('0x1e')]],'as':_0x2227f1['as'],'attributes':_0x2227f1[_0x98f5('0x1a')],'include':_0x2227f1[_0x98f5('0x1d')]?_['map'](_0x2227f1[_0x98f5('0x1d')],function(_0x4aba7a){return{'model':db[_0x4aba7a['model']],'as':_0x4aba7a['as'],'attributes':_0x4aba7a[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x65c03b){logger[_0x98f5('0xd')]('ShowVtigerAccount',_0x6d7418);logger[_0x98f5('0x20')](_0x98f5('0x22'),_0x6d7418,JSON[_0x98f5('0x23')](_0x65c03b));_0xd20823(_0x65c03b);})['catch'](function(_0x17bfe2){logger[_0x98f5('0x11')]('ShowVtigerAccount',_0x17bfe2[_0x98f5('0x12')],_0x6d7418);_0x1e7138(_0x7a922b[_0x98f5('0x11')](0x1f4,_0x17bfe2[_0x98f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a754899..69a36c0 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 _0x8a8f=['isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x2bfc60,_0xa254ab){var _0x44ea2c=function(_0x57ca7a){while(--_0x57ca7a){_0x2bfc60['push'](_0x2bfc60['shift']());}};_0x44ea2c(++_0xa254ab);}(_0x8a8f,0x134));var _0xf8a8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8a8f[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0xf8a8('0x0'));var util=require('util');var path=require(_0xf8a8('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8a8('0x2'));var router=express[_0xf8a8('0x3')]();var fs_extra=require(_0xf8a8('0x4'));var auth=require(_0xf8a8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf8a8('0x6')]('/',auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x8')]);router[_0xf8a8('0x6')](_0xf8a8('0x9'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0xa')]);router[_0xf8a8('0x6')](_0xf8a8('0xb'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xf8a8('0xc'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0xd')]);router[_0xf8a8('0x6')]('/:id/descriptions',auth[_0xf8a8('0x7')](),controller[_0xf8a8('0xe')]);router[_0xf8a8('0xf')]('/',auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x10')]);router[_0xf8a8('0x11')](_0xf8a8('0x9'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x12')]);router[_0xf8a8('0x13')](_0xf8a8('0x9'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5d9a=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x46ed76,_0x1526d8){var _0xf8b7e9=function(_0x576481){while(--_0x576481){_0x46ed76['push'](_0x46ed76['shift']());}};_0xf8b7e9(++_0x1526d8);}(_0x5d9a,0x16a));var _0xa5d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5d9a[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xa5d9('0x0'));var util=require(_0xa5d9('0x1'));var path=require(_0xa5d9('0x2'));var timeout=require(_0xa5d9('0x3'));var express=require(_0xa5d9('0x4'));var router=express['Router']();var fs_extra=require(_0xa5d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa5d9('0x6'));var config=require(_0xa5d9('0x7'));var controller=require(_0xa5d9('0x8'));router[_0xa5d9('0x9')]('/',auth['isAuthenticated'](),controller[_0xa5d9('0xa')]);router[_0xa5d9('0x9')](_0xa5d9('0xb'),auth['isAuthenticated'](),controller[_0xa5d9('0xc')]);router[_0xa5d9('0x9')](_0xa5d9('0xd'),auth[_0xa5d9('0xe')](),controller[_0xa5d9('0xf')]);router['get'](_0xa5d9('0x10'),auth[_0xa5d9('0xe')](),controller['getSubjects']);router[_0xa5d9('0x9')](_0xa5d9('0x11'),auth[_0xa5d9('0xe')](),controller[_0xa5d9('0x12')]);router[_0xa5d9('0x13')]('/',auth[_0xa5d9('0xe')](),controller[_0xa5d9('0x14')]);router[_0xa5d9('0x15')](_0xa5d9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa5d9('0x16')](_0xa5d9('0xb'),auth['isAuthenticated'](),controller[_0xa5d9('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5d7ee4b..2730d43 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 _0xe364=['STRING','sequelize','exports'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0xe364,0x190));var _0x4e36=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xe364[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require(_0x4e36('0x0'));module[_0x4e36('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4e36('0x2')]}}; \ No newline at end of file +var _0x13de=['sequelize','STRING'];(function(_0x99c123,_0x288490){var _0x2dafe5=function(_0x440a97){while(--_0x440a97){_0x99c123['push'](_0x99c123['shift']());}};_0x2dafe5(++_0x288490);}(_0x13de,0x108));var _0xe13d=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x13de[_0x3fe042];return _0x7d4a1f;};'use strict';var Sequelize=require(_0xe13d('0x0'));module['exports']={'name':{'type':Sequelize[_0xe13d('0x1')]},'description':{'type':Sequelize[_0xe13d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c9a4ebd..5f09b8b 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 _0x7217=['params','destroy','getFields','VtigerField','order','nolimit','getSubjects','findOne','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','fields','includeAll','find','catch','create','body'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7217,0xa9));var _0x7721=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x7217[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7721('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var BPromise=require(_0x7721('0x3'));var Mustache=require(_0x7721('0x4'));var util=require(_0x7721('0x5'));var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require('lodash');var squel=require(_0x7721('0xb'));var crypto=require(_0x7721('0xc'));var jsforce=require(_0x7721('0xd'));var deskjs=require(_0x7721('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7721('0xf'));var Papa=require(_0x7721('0x10'));var Redis=require('ioredis');var authService=require(_0x7721('0x11'));var qs=require(_0x7721('0x12'));var as=require(_0x7721('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7721('0x14'))(_0x7721('0x15'));var utils=require(_0x7721('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7721('0x17'));var db=require(_0x7721('0x18'))['db'];function respondWithStatusCode(_0x4db091,_0x290415){_0x290415=_0x290415||0xcc;return function(_0xcbb8d5){if(_0xcbb8d5){return _0x4db091['sendStatus'](_0x290415);}return _0x4db091[_0x7721('0x19')](_0x290415)[_0x7721('0x1a')]();};}function respondWithResult(_0xedb98,_0x36f8a0){_0x36f8a0=_0x36f8a0||0xc8;return function(_0x22a78b){if(_0x22a78b){return _0xedb98['status'](_0x36f8a0)[_0x7721('0x1b')](_0x22a78b);}};}function respondWithFilteredResult(_0x353249,_0x2fdfec){return function(_0x281dfd){if(_0x281dfd){var _0x488c09=typeof _0x2fdfec[_0x7721('0x1c')]==='undefined'&&typeof _0x2fdfec[_0x7721('0x1d')]==='undefined';var _0x378dfb=_0x281dfd['count'];var _0x4b64ab=_0x488c09?0x0:_0x2fdfec[_0x7721('0x1c')];var _0x499b28=_0x488c09?_0x281dfd[_0x7721('0x1e')]:_0x2fdfec['offset']+_0x2fdfec[_0x7721('0x1d')];var _0x19f3b4;if(_0x499b28>=_0x378dfb){_0x499b28=_0x378dfb;_0x19f3b4=0xc8;}else{_0x19f3b4=0xce;}_0x353249['status'](_0x19f3b4);return _0x353249[_0x7721('0x1f')](_0x7721('0x20'),_0x4b64ab+'-'+_0x499b28+'/'+_0x378dfb)[_0x7721('0x1b')](_0x281dfd);}return null;};}function patchUpdates(_0x519768){return function(_0x4083dd){try{jsonpatch['apply'](_0x4083dd,_0x519768,!![]);}catch(_0x49b37b){return BPromise[_0x7721('0x21')](_0x49b37b);}return _0x4083dd[_0x7721('0x22')]();};}function saveUpdates(_0x528664,_0x45c389){return function(_0x16c9c4){if(_0x16c9c4){return _0x16c9c4[_0x7721('0x23')](_0x528664)['then'](function(_0x159117){return _0x159117;});}return null;};}function removeEntity(_0x5b7e03,_0x6ab534){return function(_0x1c5511){if(_0x1c5511){return _0x1c5511['destroy']()[_0x7721('0x24')](function(){_0x5b7e03['status'](0xcc)[_0x7721('0x1a')]();});}};}function handleEntityNotFound(_0x6b932b,_0x179d10){return function(_0x126486){if(!_0x126486){_0x6b932b['sendStatus'](0x194);}return _0x126486;};}function handleError(_0x37cbc7,_0x1f3aff){_0x1f3aff=_0x1f3aff||0x1f4;return function(_0x43fa19){logger[_0x7721('0x25')](_0x43fa19[_0x7721('0x26')]);if(_0x43fa19['name']){delete _0x43fa19[_0x7721('0x27')];}_0x37cbc7[_0x7721('0x19')](_0x1f3aff)[_0x7721('0x28')](_0x43fa19);};}exports[_0x7721('0x29')]=function(_0xbb3ce4,_0x265f6d){var _0x1779cb={},_0x459d1f={},_0x3dca94={'count':0x0,'rows':[]};var _0x5771bb=_[_0x7721('0x2a')](db[_0x7721('0x2b')][_0x7721('0x2c')],function(_0x3903f4){return{'name':_0x3903f4['fieldName'],'type':_0x3903f4[_0x7721('0x2d')][_0x7721('0x2e')]};});_0x459d1f[_0x7721('0x2f')]=_['map'](_0x5771bb,'name');_0x459d1f[_0x7721('0x30')]=_[_0x7721('0x31')](_0xbb3ce4[_0x7721('0x30')]);_0x459d1f[_0x7721('0x32')]=_[_0x7721('0x33')](_0x459d1f[_0x7721('0x2f')],_0x459d1f[_0x7721('0x30')]);_0x1779cb[_0x7721('0x34')]=_['intersection'](_0x459d1f[_0x7721('0x2f')],qs['fields'](_0xbb3ce4[_0x7721('0x30')]['fields']));_0x1779cb[_0x7721('0x34')]=_0x1779cb[_0x7721('0x34')][_0x7721('0x35')]?_0x1779cb[_0x7721('0x34')]:_0x459d1f[_0x7721('0x2f')];if(!_0xbb3ce4[_0x7721('0x30')][_0x7721('0x36')]('nolimit')){_0x1779cb[_0x7721('0x1d')]=qs['limit'](_0xbb3ce4[_0x7721('0x30')][_0x7721('0x1d')]);_0x1779cb[_0x7721('0x1c')]=qs['offset'](_0xbb3ce4[_0x7721('0x30')][_0x7721('0x1c')]);}_0x1779cb['order']=qs[_0x7721('0x37')](_0xbb3ce4[_0x7721('0x30')][_0x7721('0x37')]);_0x1779cb[_0x7721('0x38')]=qs['filters'](_[_0x7721('0x39')](_0xbb3ce4[_0x7721('0x30')],_0x459d1f['filters']),_0x5771bb);if(_0xbb3ce4[_0x7721('0x30')]['filter']){_0x1779cb[_0x7721('0x38')]=_['merge'](_0x1779cb['where'],{'$or':_[_0x7721('0x2a')](_0x5771bb,function(_0x52db52){if(_0x52db52[_0x7721('0x2d')]!==_0x7721('0x3a')){var _0x4cee30={};_0x4cee30[_0x52db52[_0x7721('0x27')]]={'$like':'%'+_0xbb3ce4[_0x7721('0x30')][_0x7721('0x3b')]+'%'};return _0x4cee30;}})});}_0x1779cb=_[_0x7721('0x3c')]({},_0x1779cb,_0xbb3ce4[_0x7721('0x3d')]);var _0x22fee7={'where':_0x1779cb[_0x7721('0x38')]};return db[_0x7721('0x2b')][_0x7721('0x1e')](_0x22fee7)[_0x7721('0x24')](function(_0x5014fb){_0x3dca94[_0x7721('0x1e')]=_0x5014fb;if(_0xbb3ce4[_0x7721('0x30')]['includeAll']){_0x1779cb[_0x7721('0x3e')]=[{'all':!![]}];}return db[_0x7721('0x2b')][_0x7721('0x3f')](_0x1779cb);})[_0x7721('0x24')](function(_0x5d56a9){_0x3dca94[_0x7721('0x40')]=_0x5d56a9;return _0x3dca94;})[_0x7721('0x24')](respondWithFilteredResult(_0x265f6d,_0x1779cb))['catch'](handleError(_0x265f6d,null));};exports['show']=function(_0x2f7f64,_0x5b57dc){var _0x2e8e7b={'raw':![],'where':{'id':_0x2f7f64['params']['id']}},_0x21c9cb={};_0x21c9cb['model']=_['keys'](db[_0x7721('0x2b')][_0x7721('0x2c')]);_0x21c9cb[_0x7721('0x30')]=_[_0x7721('0x31')](_0x2f7f64[_0x7721('0x30')]);_0x21c9cb[_0x7721('0x32')]=_[_0x7721('0x33')](_0x21c9cb[_0x7721('0x2f')],_0x21c9cb[_0x7721('0x30')]);_0x2e8e7b[_0x7721('0x34')]=_[_0x7721('0x33')](_0x21c9cb['model'],qs['fields'](_0x2f7f64[_0x7721('0x30')][_0x7721('0x41')]));_0x2e8e7b[_0x7721('0x34')]=_0x2e8e7b[_0x7721('0x34')][_0x7721('0x35')]?_0x2e8e7b[_0x7721('0x34')]:_0x21c9cb[_0x7721('0x2f')];if(_0x2f7f64[_0x7721('0x30')][_0x7721('0x42')]){_0x2e8e7b[_0x7721('0x3e')]=[{'all':!![]}];}_0x2e8e7b=_[_0x7721('0x3c')]({},_0x2e8e7b,_0x2f7f64[_0x7721('0x3d')]);return db[_0x7721('0x2b')][_0x7721('0x43')](_0x2e8e7b)[_0x7721('0x24')](handleEntityNotFound(_0x5b57dc,null))['then'](respondWithResult(_0x5b57dc,null))[_0x7721('0x44')](handleError(_0x5b57dc,null));};exports[_0x7721('0x45')]=function(_0x4a378e,_0x1eb9b4){return db[_0x7721('0x2b')]['create'](_0x4a378e[_0x7721('0x46')],{})[_0x7721('0x24')](respondWithResult(_0x1eb9b4,0xc9))[_0x7721('0x44')](handleError(_0x1eb9b4,null));};exports[_0x7721('0x23')]=function(_0x26357d,_0x4ac85f){if(_0x26357d['body']['id']){delete _0x26357d[_0x7721('0x46')]['id'];}return db[_0x7721('0x2b')][_0x7721('0x43')]({'where':{'id':_0x26357d[_0x7721('0x47')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x4ac85f,null))[_0x7721('0x24')](saveUpdates(_0x26357d[_0x7721('0x46')],null))[_0x7721('0x24')](respondWithResult(_0x4ac85f,null))[_0x7721('0x44')](handleError(_0x4ac85f,null));};exports[_0x7721('0x48')]=function(_0x3ce861,_0x5d8412){return db[_0x7721('0x2b')]['find']({'where':{'id':_0x3ce861[_0x7721('0x47')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x5d8412,null))[_0x7721('0x24')](removeEntity(_0x5d8412,null))['catch'](handleError(_0x5d8412,null));};exports[_0x7721('0x49')]=function(_0x1e7b63,_0x2fc121,_0x225f92){var _0x3c1cf9={};var _0x1e0f5b={};var _0xe3c855;var _0x4982e6;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1e7b63['params']['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x2fc121,null))[_0x7721('0x24')](function(_0x3fbc29){if(_0x3fbc29){_0xe3c855=_0x3fbc29;_0x1e0f5b[_0x7721('0x2f')]=_[_0x7721('0x31')](db[_0x7721('0x4a')][_0x7721('0x2c')]);_0x1e0f5b['query']=_[_0x7721('0x31')](_0x1e7b63[_0x7721('0x30')]);_0x1e0f5b['filters']=_[_0x7721('0x33')](_0x1e0f5b[_0x7721('0x2f')],_0x1e0f5b[_0x7721('0x30')]);_0x3c1cf9['attributes']=_[_0x7721('0x33')](_0x1e0f5b[_0x7721('0x2f')],qs['fields'](_0x1e7b63[_0x7721('0x30')][_0x7721('0x41')]));_0x3c1cf9[_0x7721('0x34')]=_0x3c1cf9[_0x7721('0x34')][_0x7721('0x35')]?_0x3c1cf9['attributes']:_0x1e0f5b['model'];_0x3c1cf9[_0x7721('0x4b')]=qs['sort'](_0x1e7b63[_0x7721('0x30')][_0x7721('0x37')]);_0x3c1cf9[_0x7721('0x38')]=qs[_0x7721('0x32')](_[_0x7721('0x39')](_0x1e7b63[_0x7721('0x30')],_0x1e0f5b['filters']));if(_0x1e7b63[_0x7721('0x30')][_0x7721('0x3b')]){_0x3c1cf9[_0x7721('0x38')]=_[_0x7721('0x3c')](_0x3c1cf9[_0x7721('0x38')],{'$or':_[_0x7721('0x2a')](_0x3c1cf9[_0x7721('0x34')],function(_0x4a54ac){var _0x22acb1={};_0x22acb1[_0x4a54ac]={'$like':'%'+_0x1e7b63['query'][_0x7721('0x3b')]+'%'};return _0x22acb1;})});}_0x3c1cf9=_[_0x7721('0x3c')]({},_0x3c1cf9,_0x1e7b63[_0x7721('0x3d')]);return _0xe3c855[_0x7721('0x49')](_0x3c1cf9);}})[_0x7721('0x24')](function(_0xa97279){if(_0xa97279){_0x4982e6=_0xa97279[_0x7721('0x35')];if(!_0x1e7b63[_0x7721('0x30')][_0x7721('0x36')](_0x7721('0x4c'))){_0x3c1cf9['limit']=qs[_0x7721('0x1d')](_0x1e7b63[_0x7721('0x30')][_0x7721('0x1d')]);_0x3c1cf9[_0x7721('0x1c')]=qs[_0x7721('0x1c')](_0x1e7b63['query'][_0x7721('0x1c')]);}return _0xe3c855['getFields'](_0x3c1cf9);}})[_0x7721('0x24')](function(_0x331ae7){if(_0x331ae7){return _0x331ae7?{'count':_0x4982e6,'rows':_0x331ae7}:null;}})[_0x7721('0x24')](respondWithResult(_0x2fc121,null))['catch'](handleError(_0x2fc121,null));};exports[_0x7721('0x4d')]=function(_0x5b7f27,_0x4c0de6,_0x46a249){var _0x3ed647={};var _0x1697e1={};var _0x2ee874;var _0x562865;return db[_0x7721('0x2b')][_0x7721('0x4e')]({'where':{'id':_0x5b7f27['params']['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x4c0de6,null))['then'](function(_0x4a9b0c){if(_0x4a9b0c){_0x2ee874=_0x4a9b0c;_0x1697e1[_0x7721('0x2f')]=_[_0x7721('0x31')](db[_0x7721('0x4a')]['rawAttributes']);_0x1697e1[_0x7721('0x30')]=_[_0x7721('0x31')](_0x5b7f27[_0x7721('0x30')]);_0x1697e1['filters']=_[_0x7721('0x33')](_0x1697e1['model'],_0x1697e1[_0x7721('0x30')]);_0x3ed647[_0x7721('0x34')]=_[_0x7721('0x33')](_0x1697e1[_0x7721('0x2f')],qs[_0x7721('0x41')](_0x5b7f27[_0x7721('0x30')][_0x7721('0x41')]));_0x3ed647[_0x7721('0x34')]=_0x3ed647[_0x7721('0x34')][_0x7721('0x35')]?_0x3ed647[_0x7721('0x34')]:_0x1697e1[_0x7721('0x2f')];_0x3ed647['order']=qs[_0x7721('0x37')](_0x5b7f27[_0x7721('0x30')][_0x7721('0x37')]);_0x3ed647[_0x7721('0x38')]=qs[_0x7721('0x32')](_[_0x7721('0x39')](_0x5b7f27[_0x7721('0x30')],_0x1697e1[_0x7721('0x32')]));if(_0x5b7f27[_0x7721('0x30')][_0x7721('0x3b')]){_0x3ed647[_0x7721('0x38')]=_[_0x7721('0x3c')](_0x3ed647[_0x7721('0x38')],{'$or':_['map'](_0x3ed647['attributes'],function(_0xe2100a){var _0x8d0821={};_0x8d0821[_0xe2100a]={'$like':'%'+_0x5b7f27[_0x7721('0x30')][_0x7721('0x3b')]+'%'};return _0x8d0821;})});}_0x3ed647=_['merge']({},_0x3ed647,_0x5b7f27[_0x7721('0x3d')]);return _0x2ee874['getSubjects'](_0x3ed647);}})[_0x7721('0x24')](function(_0x58c3f3){if(_0x58c3f3){_0x562865=_0x58c3f3[_0x7721('0x35')];if(!_0x5b7f27[_0x7721('0x30')][_0x7721('0x36')](_0x7721('0x4c'))){_0x3ed647[_0x7721('0x1d')]=qs[_0x7721('0x1d')](_0x5b7f27['query'][_0x7721('0x1d')]);_0x3ed647[_0x7721('0x1c')]=qs[_0x7721('0x1c')](_0x5b7f27[_0x7721('0x30')][_0x7721('0x1c')]);}return _0x2ee874[_0x7721('0x4d')](_0x3ed647);}})['then'](function(_0x265bbd){if(_0x265bbd){return _0x265bbd?{'count':_0x562865,'rows':_0x265bbd}:null;}})['then'](respondWithResult(_0x4c0de6,null))[_0x7721('0x44')](handleError(_0x4c0de6,null));};exports[_0x7721('0x4f')]=function(_0x2b930f,_0x5b4f82,_0x4b836f){var _0x5884a1={};var _0x3cbf76={};var _0x5c6fd8;var _0x233c3d;return db[_0x7721('0x2b')][_0x7721('0x4e')]({'where':{'id':_0x2b930f['params']['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x5b4f82,null))['then'](function(_0x318dfc){if(_0x318dfc){_0x5c6fd8=_0x318dfc;_0x3cbf76[_0x7721('0x2f')]=_[_0x7721('0x31')](db[_0x7721('0x4a')][_0x7721('0x2c')]);_0x3cbf76[_0x7721('0x30')]=_[_0x7721('0x31')](_0x2b930f[_0x7721('0x30')]);_0x3cbf76[_0x7721('0x32')]=_[_0x7721('0x33')](_0x3cbf76[_0x7721('0x2f')],_0x3cbf76[_0x7721('0x30')]);_0x5884a1[_0x7721('0x34')]=_['intersection'](_0x3cbf76[_0x7721('0x2f')],qs[_0x7721('0x41')](_0x2b930f[_0x7721('0x30')][_0x7721('0x41')]));_0x5884a1[_0x7721('0x34')]=_0x5884a1['attributes']['length']?_0x5884a1[_0x7721('0x34')]:_0x3cbf76[_0x7721('0x2f')];_0x5884a1['order']=qs[_0x7721('0x37')](_0x2b930f['query']['sort']);_0x5884a1[_0x7721('0x38')]=qs['filters'](_[_0x7721('0x39')](_0x2b930f[_0x7721('0x30')],_0x3cbf76[_0x7721('0x32')]));if(_0x2b930f[_0x7721('0x30')][_0x7721('0x3b')]){_0x5884a1[_0x7721('0x38')]=_['merge'](_0x5884a1[_0x7721('0x38')],{'$or':_[_0x7721('0x2a')](_0x5884a1[_0x7721('0x34')],function(_0x297787){var _0x2de4dc={};_0x2de4dc[_0x297787]={'$like':'%'+_0x2b930f[_0x7721('0x30')][_0x7721('0x3b')]+'%'};return _0x2de4dc;})});}_0x5884a1=_[_0x7721('0x3c')]({},_0x5884a1,_0x2b930f[_0x7721('0x3d')]);return _0x5c6fd8['getDescriptions'](_0x5884a1);}})['then'](function(_0x74c354){if(_0x74c354){_0x233c3d=_0x74c354[_0x7721('0x35')];if(!_0x2b930f[_0x7721('0x30')]['hasOwnProperty'](_0x7721('0x4c'))){_0x5884a1['limit']=qs[_0x7721('0x1d')](_0x2b930f[_0x7721('0x30')][_0x7721('0x1d')]);_0x5884a1[_0x7721('0x1c')]=qs[_0x7721('0x1c')](_0x2b930f[_0x7721('0x30')]['offset']);}return _0x5c6fd8[_0x7721('0x4f')](_0x5884a1);}})['then'](function(_0x274175){if(_0x274175){return _0x274175?{'count':_0x233c3d,'rows':_0x274175}:null;}})[_0x7721('0x24')](respondWithResult(_0x5b4f82,null))[_0x7721('0x44')](handleError(_0x5b4f82,null));}; \ No newline at end of file +var _0xc4e6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','options','VtigerConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','VtigerField','filter','merge','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1f308a,_0x1edc78){var _0x2e2721=function(_0x1284d2){while(--_0x1284d2){_0x1f308a['push'](_0x1f308a['shift']());}};_0x2e2721(++_0x1edc78);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0xc4e6[_0x45fe9c];return _0x233d48;};'use strict';var emlformat=require(_0x6c4e('0x0'));var rimraf=require(_0x6c4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c4e('0x2'));var rp=require(_0x6c4e('0x3'));var moment=require(_0x6c4e('0x4'));var BPromise=require(_0x6c4e('0x5'));var Mustache=require('mustache');var util=require(_0x6c4e('0x6'));var path=require(_0x6c4e('0x7'));var sox=require(_0x6c4e('0x8'));var csv=require('to-csv');var ejs=require(_0x6c4e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6c4e('0xa'));var crypto=require(_0x6c4e('0xb'));var jsforce=require(_0x6c4e('0xc'));var deskjs=require(_0x6c4e('0xd'));var toCsv=require(_0x6c4e('0xe'));var querystring=require(_0x6c4e('0xf'));var Papa=require(_0x6c4e('0x10'));var Redis=require(_0x6c4e('0x11'));var authService=require(_0x6c4e('0x12'));var qs=require(_0x6c4e('0x13'));var as=require(_0x6c4e('0x14'));var hardwareService=require(_0x6c4e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6c4e('0x16'));var config=require(_0x6c4e('0x17'));var licenseUtil=require(_0x6c4e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13bb88,_0x195cd2){_0x195cd2=_0x195cd2||0xcc;return function(_0x38dc10){if(_0x38dc10){return _0x13bb88[_0x6c4e('0x19')](_0x195cd2);}return _0x13bb88['status'](_0x195cd2)[_0x6c4e('0x1a')]();};}function respondWithResult(_0x12b894,_0x287ffe){_0x287ffe=_0x287ffe||0xc8;return function(_0x48c29e){if(_0x48c29e){return _0x12b894[_0x6c4e('0x1b')](_0x287ffe)['json'](_0x48c29e);}};}function respondWithFilteredResult(_0x25941a,_0x1eaf04){return function(_0x1b7746){if(_0x1b7746){var _0x5b83aa=typeof _0x1eaf04['offset']==='undefined'&&typeof _0x1eaf04['limit']===_0x6c4e('0x1c');var _0x5946e1=_0x1b7746[_0x6c4e('0x1d')];var _0x48e453=_0x5b83aa?0x0:_0x1eaf04[_0x6c4e('0x1e')];var _0x145383=_0x5b83aa?_0x1b7746['count']:_0x1eaf04[_0x6c4e('0x1e')]+_0x1eaf04['limit'];var _0xd851df;if(_0x145383>=_0x5946e1){_0x145383=_0x5946e1;_0xd851df=0xc8;}else{_0xd851df=0xce;}_0x25941a[_0x6c4e('0x1b')](_0xd851df);return _0x25941a[_0x6c4e('0x1f')](_0x6c4e('0x20'),_0x48e453+'-'+_0x145383+'/'+_0x5946e1)['json'](_0x1b7746);}return null;};}function patchUpdates(_0xc41439){return function(_0x6b6a2){try{jsonpatch['apply'](_0x6b6a2,_0xc41439,!![]);}catch(_0x112317){return BPromise[_0x6c4e('0x21')](_0x112317);}return _0x6b6a2[_0x6c4e('0x22')]();};}function saveUpdates(_0x104766,_0x11ea4b){return function(_0x5ba1d2){if(_0x5ba1d2){return _0x5ba1d2[_0x6c4e('0x23')](_0x104766)[_0x6c4e('0x24')](function(_0x5c45f2){return _0x5c45f2;});}return null;};}function removeEntity(_0x5c2898,_0x1664a7){return function(_0x2c8a7e){if(_0x2c8a7e){return _0x2c8a7e[_0x6c4e('0x25')]()[_0x6c4e('0x24')](function(){_0x5c2898[_0x6c4e('0x1b')](0xcc)[_0x6c4e('0x1a')]();});}};}function handleEntityNotFound(_0xf2254f,_0x4cb32b){return function(_0x2790b9){if(!_0x2790b9){_0xf2254f[_0x6c4e('0x19')](0x194);}return _0x2790b9;};}function handleError(_0x3d4547,_0x3ae9c2){_0x3ae9c2=_0x3ae9c2||0x1f4;return function(_0x5ab667){logger[_0x6c4e('0x26')](_0x5ab667[_0x6c4e('0x27')]);if(_0x5ab667[_0x6c4e('0x28')]){delete _0x5ab667[_0x6c4e('0x28')];}_0x3d4547[_0x6c4e('0x1b')](_0x3ae9c2)[_0x6c4e('0x29')](_0x5ab667);};}exports[_0x6c4e('0x2a')]=function(_0x52c934,_0x23f377){var _0x2f6f01={},_0x5bd002={},_0x169830={'count':0x0,'rows':[]};var _0x3b738d=_['map'](db['VtigerConfiguration'][_0x6c4e('0x2b')],function(_0x12fc7c){return{'name':_0x12fc7c['fieldName'],'type':_0x12fc7c[_0x6c4e('0x2c')][_0x6c4e('0x2d')]};});_0x5bd002['model']=_[_0x6c4e('0x2e')](_0x3b738d,'name');_0x5bd002[_0x6c4e('0x2f')]=_[_0x6c4e('0x30')](_0x52c934['query']);_0x5bd002[_0x6c4e('0x31')]=_['intersection'](_0x5bd002[_0x6c4e('0x32')],_0x5bd002[_0x6c4e('0x2f')]);_0x2f6f01['attributes']=_[_0x6c4e('0x33')](_0x5bd002['model'],qs[_0x6c4e('0x34')](_0x52c934[_0x6c4e('0x2f')][_0x6c4e('0x34')]));_0x2f6f01[_0x6c4e('0x35')]=_0x2f6f01[_0x6c4e('0x35')][_0x6c4e('0x36')]?_0x2f6f01['attributes']:_0x5bd002[_0x6c4e('0x32')];if(!_0x52c934[_0x6c4e('0x2f')][_0x6c4e('0x37')](_0x6c4e('0x38'))){_0x2f6f01[_0x6c4e('0x39')]=qs[_0x6c4e('0x39')](_0x52c934[_0x6c4e('0x2f')][_0x6c4e('0x39')]);_0x2f6f01[_0x6c4e('0x1e')]=qs['offset'](_0x52c934['query'][_0x6c4e('0x1e')]);}_0x2f6f01[_0x6c4e('0x3a')]=qs[_0x6c4e('0x3b')](_0x52c934[_0x6c4e('0x2f')][_0x6c4e('0x3b')]);_0x2f6f01[_0x6c4e('0x3c')]=qs[_0x6c4e('0x31')](_[_0x6c4e('0x3d')](_0x52c934[_0x6c4e('0x2f')],_0x5bd002['filters']),_0x3b738d);if(_0x52c934['query']['filter']){_0x2f6f01['where']=_['merge'](_0x2f6f01[_0x6c4e('0x3c')],{'$or':_[_0x6c4e('0x2e')](_0x3b738d,function(_0x444834){if(_0x444834['type']!==_0x6c4e('0x3e')){var _0x4a5d0e={};_0x4a5d0e[_0x444834[_0x6c4e('0x28')]]={'$like':'%'+_0x52c934[_0x6c4e('0x2f')]['filter']+'%'};return _0x4a5d0e;}})});}_0x2f6f01=_['merge']({},_0x2f6f01,_0x52c934[_0x6c4e('0x3f')]);var _0xf88416={'where':_0x2f6f01[_0x6c4e('0x3c')]};return db[_0x6c4e('0x40')][_0x6c4e('0x1d')](_0xf88416)[_0x6c4e('0x24')](function(_0x37c7e6){_0x169830[_0x6c4e('0x1d')]=_0x37c7e6;if(_0x52c934[_0x6c4e('0x2f')][_0x6c4e('0x41')]){_0x2f6f01['include']=[{'all':!![]}];}return db[_0x6c4e('0x40')][_0x6c4e('0x42')](_0x2f6f01);})[_0x6c4e('0x24')](function(_0x2894f6){_0x169830[_0x6c4e('0x43')]=_0x2894f6;return _0x169830;})[_0x6c4e('0x24')](respondWithFilteredResult(_0x23f377,_0x2f6f01))[_0x6c4e('0x44')](handleError(_0x23f377,null));};exports[_0x6c4e('0x45')]=function(_0x429d1d,_0x25d578){var _0x3f3b05={'raw':![],'where':{'id':_0x429d1d[_0x6c4e('0x46')]['id']}},_0x514998={};_0x514998['model']=_[_0x6c4e('0x30')](db[_0x6c4e('0x40')][_0x6c4e('0x2b')]);_0x514998[_0x6c4e('0x2f')]=_['keys'](_0x429d1d[_0x6c4e('0x2f')]);_0x514998['filters']=_[_0x6c4e('0x33')](_0x514998['model'],_0x514998[_0x6c4e('0x2f')]);_0x3f3b05['attributes']=_['intersection'](_0x514998[_0x6c4e('0x32')],qs[_0x6c4e('0x34')](_0x429d1d[_0x6c4e('0x2f')]['fields']));_0x3f3b05[_0x6c4e('0x35')]=_0x3f3b05[_0x6c4e('0x35')][_0x6c4e('0x36')]?_0x3f3b05[_0x6c4e('0x35')]:_0x514998[_0x6c4e('0x32')];if(_0x429d1d[_0x6c4e('0x2f')][_0x6c4e('0x41')]){_0x3f3b05[_0x6c4e('0x47')]=[{'all':!![]}];}_0x3f3b05=_['merge']({},_0x3f3b05,_0x429d1d['options']);return db[_0x6c4e('0x40')][_0x6c4e('0x48')](_0x3f3b05)['then'](handleEntityNotFound(_0x25d578,null))[_0x6c4e('0x24')](respondWithResult(_0x25d578,null))['catch'](handleError(_0x25d578,null));};exports[_0x6c4e('0x49')]=function(_0x3f761e,_0x13c7e8){return db['VtigerConfiguration']['create'](_0x3f761e[_0x6c4e('0x4a')],{})[_0x6c4e('0x24')](respondWithResult(_0x13c7e8,0xc9))[_0x6c4e('0x44')](handleError(_0x13c7e8,null));};exports[_0x6c4e('0x23')]=function(_0x2ceda7,_0x51288c){if(_0x2ceda7[_0x6c4e('0x4a')]['id']){delete _0x2ceda7[_0x6c4e('0x4a')]['id'];}return db['VtigerConfiguration'][_0x6c4e('0x48')]({'where':{'id':_0x2ceda7[_0x6c4e('0x46')]['id']}})[_0x6c4e('0x24')](handleEntityNotFound(_0x51288c,null))[_0x6c4e('0x24')](saveUpdates(_0x2ceda7[_0x6c4e('0x4a')],null))[_0x6c4e('0x24')](respondWithResult(_0x51288c,null))[_0x6c4e('0x44')](handleError(_0x51288c,null));};exports[_0x6c4e('0x25')]=function(_0x17beba,_0x5919d6){return db['VtigerConfiguration'][_0x6c4e('0x48')]({'where':{'id':_0x17beba[_0x6c4e('0x46')]['id']}})[_0x6c4e('0x24')](handleEntityNotFound(_0x5919d6,null))[_0x6c4e('0x24')](removeEntity(_0x5919d6,null))[_0x6c4e('0x44')](handleError(_0x5919d6,null));};exports[_0x6c4e('0x4b')]=function(_0x52dd01,_0x5ec61e,_0x570d3d){var _0x48fed1={};var _0x4045b1={};var _0x2371f3;var _0x8625c0;return db[_0x6c4e('0x40')][_0x6c4e('0x4c')]({'where':{'id':_0x52dd01[_0x6c4e('0x46')]['id']}})[_0x6c4e('0x24')](handleEntityNotFound(_0x5ec61e,null))[_0x6c4e('0x24')](function(_0x185fd0){if(_0x185fd0){_0x2371f3=_0x185fd0;_0x4045b1[_0x6c4e('0x32')]=_['keys'](db[_0x6c4e('0x4d')][_0x6c4e('0x2b')]);_0x4045b1[_0x6c4e('0x2f')]=_[_0x6c4e('0x30')](_0x52dd01[_0x6c4e('0x2f')]);_0x4045b1[_0x6c4e('0x31')]=_[_0x6c4e('0x33')](_0x4045b1[_0x6c4e('0x32')],_0x4045b1[_0x6c4e('0x2f')]);_0x48fed1[_0x6c4e('0x35')]=_[_0x6c4e('0x33')](_0x4045b1['model'],qs['fields'](_0x52dd01[_0x6c4e('0x2f')][_0x6c4e('0x34')]));_0x48fed1['attributes']=_0x48fed1[_0x6c4e('0x35')][_0x6c4e('0x36')]?_0x48fed1['attributes']:_0x4045b1[_0x6c4e('0x32')];_0x48fed1[_0x6c4e('0x3a')]=qs['sort'](_0x52dd01[_0x6c4e('0x2f')][_0x6c4e('0x3b')]);_0x48fed1[_0x6c4e('0x3c')]=qs['filters'](_['pick'](_0x52dd01[_0x6c4e('0x2f')],_0x4045b1[_0x6c4e('0x31')]));if(_0x52dd01['query'][_0x6c4e('0x4e')]){_0x48fed1['where']=_['merge'](_0x48fed1[_0x6c4e('0x3c')],{'$or':_['map'](_0x48fed1[_0x6c4e('0x35')],function(_0x5c02c6){var _0x236723={};_0x236723[_0x5c02c6]={'$like':'%'+_0x52dd01[_0x6c4e('0x2f')][_0x6c4e('0x4e')]+'%'};return _0x236723;})});}_0x48fed1=_[_0x6c4e('0x4f')]({},_0x48fed1,_0x52dd01[_0x6c4e('0x3f')]);return _0x2371f3[_0x6c4e('0x4b')](_0x48fed1);}})[_0x6c4e('0x24')](function(_0x4912cd){if(_0x4912cd){_0x8625c0=_0x4912cd[_0x6c4e('0x36')];if(!_0x52dd01['query']['hasOwnProperty'](_0x6c4e('0x38'))){_0x48fed1[_0x6c4e('0x39')]=qs[_0x6c4e('0x39')](_0x52dd01[_0x6c4e('0x2f')][_0x6c4e('0x39')]);_0x48fed1['offset']=qs['offset'](_0x52dd01[_0x6c4e('0x2f')][_0x6c4e('0x1e')]);}return _0x2371f3[_0x6c4e('0x4b')](_0x48fed1);}})[_0x6c4e('0x24')](function(_0x4898b5){if(_0x4898b5){return _0x4898b5?{'count':_0x8625c0,'rows':_0x4898b5}:null;}})[_0x6c4e('0x24')](respondWithResult(_0x5ec61e,null))[_0x6c4e('0x44')](handleError(_0x5ec61e,null));};exports['getSubjects']=function(_0x267a73,_0x4b08dd,_0x447ba7){var _0x5931b5={};var _0x6b8c97={};var _0x3c6792;var _0x3cabd5;return db[_0x6c4e('0x40')][_0x6c4e('0x4c')]({'where':{'id':_0x267a73[_0x6c4e('0x46')]['id']}})[_0x6c4e('0x24')](handleEntityNotFound(_0x4b08dd,null))[_0x6c4e('0x24')](function(_0x144974){if(_0x144974){_0x3c6792=_0x144974;_0x6b8c97[_0x6c4e('0x32')]=_[_0x6c4e('0x30')](db[_0x6c4e('0x4d')][_0x6c4e('0x2b')]);_0x6b8c97[_0x6c4e('0x2f')]=_['keys'](_0x267a73[_0x6c4e('0x2f')]);_0x6b8c97[_0x6c4e('0x31')]=_[_0x6c4e('0x33')](_0x6b8c97[_0x6c4e('0x32')],_0x6b8c97['query']);_0x5931b5[_0x6c4e('0x35')]=_[_0x6c4e('0x33')](_0x6b8c97[_0x6c4e('0x32')],qs[_0x6c4e('0x34')](_0x267a73['query']['fields']));_0x5931b5[_0x6c4e('0x35')]=_0x5931b5[_0x6c4e('0x35')][_0x6c4e('0x36')]?_0x5931b5[_0x6c4e('0x35')]:_0x6b8c97['model'];_0x5931b5[_0x6c4e('0x3a')]=qs['sort'](_0x267a73[_0x6c4e('0x2f')][_0x6c4e('0x3b')]);_0x5931b5[_0x6c4e('0x3c')]=qs[_0x6c4e('0x31')](_[_0x6c4e('0x3d')](_0x267a73['query'],_0x6b8c97['filters']));if(_0x267a73[_0x6c4e('0x2f')][_0x6c4e('0x4e')]){_0x5931b5[_0x6c4e('0x3c')]=_['merge'](_0x5931b5['where'],{'$or':_[_0x6c4e('0x2e')](_0x5931b5[_0x6c4e('0x35')],function(_0x5d0103){var _0x58eaa1={};_0x58eaa1[_0x5d0103]={'$like':'%'+_0x267a73[_0x6c4e('0x2f')][_0x6c4e('0x4e')]+'%'};return _0x58eaa1;})});}_0x5931b5=_['merge']({},_0x5931b5,_0x267a73[_0x6c4e('0x3f')]);return _0x3c6792[_0x6c4e('0x50')](_0x5931b5);}})[_0x6c4e('0x24')](function(_0xf9c781){if(_0xf9c781){_0x3cabd5=_0xf9c781[_0x6c4e('0x36')];if(!_0x267a73[_0x6c4e('0x2f')][_0x6c4e('0x37')](_0x6c4e('0x38'))){_0x5931b5[_0x6c4e('0x39')]=qs[_0x6c4e('0x39')](_0x267a73[_0x6c4e('0x2f')][_0x6c4e('0x39')]);_0x5931b5['offset']=qs['offset'](_0x267a73[_0x6c4e('0x2f')][_0x6c4e('0x1e')]);}return _0x3c6792[_0x6c4e('0x50')](_0x5931b5);}})[_0x6c4e('0x24')](function(_0x40b359){if(_0x40b359){return _0x40b359?{'count':_0x3cabd5,'rows':_0x40b359}:null;}})[_0x6c4e('0x24')](respondWithResult(_0x4b08dd,null))['catch'](handleError(_0x4b08dd,null));};exports[_0x6c4e('0x51')]=function(_0x7809a4,_0x65f4ac,_0x5c2c17){var _0x371fe2={};var _0x2e8ad2={};var _0x419a1a;var _0x5b998b;return db[_0x6c4e('0x40')][_0x6c4e('0x4c')]({'where':{'id':_0x7809a4[_0x6c4e('0x46')]['id']}})[_0x6c4e('0x24')](handleEntityNotFound(_0x65f4ac,null))['then'](function(_0x59bea2){if(_0x59bea2){_0x419a1a=_0x59bea2;_0x2e8ad2[_0x6c4e('0x32')]=_[_0x6c4e('0x30')](db['VtigerField'][_0x6c4e('0x2b')]);_0x2e8ad2[_0x6c4e('0x2f')]=_[_0x6c4e('0x30')](_0x7809a4[_0x6c4e('0x2f')]);_0x2e8ad2[_0x6c4e('0x31')]=_[_0x6c4e('0x33')](_0x2e8ad2[_0x6c4e('0x32')],_0x2e8ad2[_0x6c4e('0x2f')]);_0x371fe2[_0x6c4e('0x35')]=_['intersection'](_0x2e8ad2[_0x6c4e('0x32')],qs[_0x6c4e('0x34')](_0x7809a4['query']['fields']));_0x371fe2[_0x6c4e('0x35')]=_0x371fe2[_0x6c4e('0x35')][_0x6c4e('0x36')]?_0x371fe2[_0x6c4e('0x35')]:_0x2e8ad2['model'];_0x371fe2[_0x6c4e('0x3a')]=qs[_0x6c4e('0x3b')](_0x7809a4[_0x6c4e('0x2f')][_0x6c4e('0x3b')]);_0x371fe2[_0x6c4e('0x3c')]=qs['filters'](_[_0x6c4e('0x3d')](_0x7809a4['query'],_0x2e8ad2[_0x6c4e('0x31')]));if(_0x7809a4[_0x6c4e('0x2f')][_0x6c4e('0x4e')]){_0x371fe2[_0x6c4e('0x3c')]=_[_0x6c4e('0x4f')](_0x371fe2[_0x6c4e('0x3c')],{'$or':_['map'](_0x371fe2[_0x6c4e('0x35')],function(_0x464cdd){var _0x3ced29={};_0x3ced29[_0x464cdd]={'$like':'%'+_0x7809a4[_0x6c4e('0x2f')]['filter']+'%'};return _0x3ced29;})});}_0x371fe2=_[_0x6c4e('0x4f')]({},_0x371fe2,_0x7809a4[_0x6c4e('0x3f')]);return _0x419a1a[_0x6c4e('0x51')](_0x371fe2);}})['then'](function(_0x5b8bca){if(_0x5b8bca){_0x5b998b=_0x5b8bca[_0x6c4e('0x36')];if(!_0x7809a4[_0x6c4e('0x2f')][_0x6c4e('0x37')](_0x6c4e('0x38'))){_0x371fe2[_0x6c4e('0x39')]=qs['limit'](_0x7809a4[_0x6c4e('0x2f')][_0x6c4e('0x39')]);_0x371fe2[_0x6c4e('0x1e')]=qs[_0x6c4e('0x1e')](_0x7809a4[_0x6c4e('0x2f')][_0x6c4e('0x1e')]);}return _0x419a1a['getDescriptions'](_0x371fe2);}})[_0x6c4e('0x24')](function(_0xc49130){if(_0xc49130){return _0xc49130?{'count':_0x5b998b,'rows':_0xc49130}:null;}})[_0x6c4e('0x24')](respondWithResult(_0x65f4ac,null))[_0x6c4e('0x44')](handleError(_0x65f4ac,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 40fb8bd..d15b16a 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 _0xc3ab=['../../config/logger','moment','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x5462f1,_0xbf5e1b){var _0x32e8c3=function(_0x33021f){while(--_0x33021f){_0x5462f1['push'](_0x5462f1['shift']());}};_0x32e8c3(++_0xbf5e1b);}(_0xc3ab,0x184));var _0xbc3a=function(_0x2845d1,_0x570fe5){_0x2845d1=_0x2845d1-0x0;var _0x5a20d8=_0xc3ab[_0x2845d1];return _0x5a20d8;};'use strict';var _=require(_0xbc3a('0x0'));var util=require(_0xbc3a('0x1'));var logger=require(_0xbc3a('0x2'))('api');var moment=require(_0xbc3a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc3a('0x4'));var rimraf=require(_0xbc3a('0x5'));var config=require('../../config/environment');var attributes=require(_0xbc3a('0x6'));module['exports']=function(_0x5ebd45,_0x308a33){return _0x5ebd45[_0xbc3a('0x7')](_0xbc3a('0x8'),attributes,{'tableName':_0xbc3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0246=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x275b1e,_0x3ba942){var _0x40ae4d=function(_0x429acf){while(--_0x429acf){_0x275b1e['push'](_0x275b1e['shift']());}};_0x40ae4d(++_0x3ba942);}(_0x0246,0xc9));var _0x6024=function(_0x24d801,_0x2761eb){_0x24d801=_0x24d801-0x0;var _0x37ca07=_0x0246[_0x24d801];return _0x37ca07;};'use strict';var _=require(_0x6024('0x0'));var util=require(_0x6024('0x1'));var logger=require(_0x6024('0x2'))(_0x6024('0x3'));var moment=require(_0x6024('0x4'));var BPromise=require(_0x6024('0x5'));var rp=require(_0x6024('0x6'));var fs=require('fs');var path=require(_0x6024('0x7'));var rimraf=require(_0x6024('0x8'));var config=require(_0x6024('0x9'));var attributes=require(_0x6024('0xa'));module[_0x6024('0xb')]=function(_0x10366f,_0x186f7b){return _0x10366f['define']('VtigerConfiguration',attributes,{'tableName':_0x6024('0xc'),'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 d762d00..55ab33e 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 _0xf0d4=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xf0d4,0x15f));var _0x4f0d=function(_0x5eae0c,_0x36d39b){_0x5eae0c=_0x5eae0c-0x0;var _0x1695ed=_0xf0d4[_0x5eae0c];return _0x1695ed;};'use strict';var _=require(_0x4f0d('0x0'));var util=require(_0x4f0d('0x1'));var moment=require(_0x4f0d('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f0d('0x3'));var fs=require('fs');var Redis=require(_0x4f0d('0x4'));var db=require(_0x4f0d('0x5'))['db'];var utils=require(_0x4f0d('0x6'));var logger=require('../../config/logger')(_0x4f0d('0x7'));var config=require(_0x4f0d('0x8'));var jayson=require(_0x4f0d('0x9'));var client=jayson['client'][_0x4f0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4c9f,_0x36bcc8,_0x23f457){return new BPromise(function(_0x71c8b4,_0x40c962){return client[_0x4f0d('0xb')](_0x1c4c9f,_0x23f457)['then'](function(_0x395ff2){logger[_0x4f0d('0xc')](_0x4f0d('0xd'),_0x36bcc8,_0x4f0d('0xe'));logger[_0x4f0d('0xf')](_0x4f0d('0x10'),_0x36bcc8,_0x4f0d('0xe'),JSON[_0x4f0d('0x11')](_0x395ff2));if(_0x395ff2['error']){if(_0x395ff2[_0x4f0d('0x12')][_0x4f0d('0x13')]===0x1f4){logger[_0x4f0d('0x12')](_0x4f0d('0xd'),_0x36bcc8,_0x395ff2[_0x4f0d('0x12')][_0x4f0d('0x14')]);return _0x40c962(_0x395ff2[_0x4f0d('0x12')][_0x4f0d('0x14')]);}logger[_0x4f0d('0x12')](_0x4f0d('0xd'),_0x36bcc8,_0x395ff2[_0x4f0d('0x12')]['message']);return _0x71c8b4(_0x395ff2['error'][_0x4f0d('0x14')]);}else{logger[_0x4f0d('0xc')](_0x4f0d('0xd'),_0x36bcc8,_0x4f0d('0xe'));_0x71c8b4(_0x395ff2['result'][_0x4f0d('0x14')]);}})[_0x4f0d('0x15')](function(_0x57f5cb){logger[_0x4f0d('0x12')](_0x4f0d('0xd'),_0x36bcc8,_0x57f5cb);_0x40c962(_0x57f5cb);});});} \ No newline at end of file +var _0x1efa=['client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x27c06f,_0x45071b){var _0x53a3b6=function(_0xf07c07){while(--_0xf07c07){_0x27c06f['push'](_0x27c06f['shift']());}};_0x53a3b6(++_0x45071b);}(_0x1efa,0xab));var _0xa1ef=function(_0x5634dc,_0x4b5c39){_0x5634dc=_0x5634dc-0x0;var _0x1b37ed=_0x1efa[_0x5634dc];return _0x1b37ed;};'use strict';var _=require(_0xa1ef('0x0'));var util=require(_0xa1ef('0x1'));var moment=require('moment');var BPromise=require(_0xa1ef('0x2'));var rs=require(_0xa1ef('0x3'));var fs=require('fs');var Redis=require(_0xa1ef('0x4'));var db=require(_0xa1ef('0x5'))['db'];var utils=require(_0xa1ef('0x6'));var logger=require(_0xa1ef('0x7'))(_0xa1ef('0x8'));var config=require(_0xa1ef('0x9'));var jayson=require(_0xa1ef('0xa'));var client=jayson[_0xa1ef('0xb')][_0xa1ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dfcc6,_0x3181bc,_0x3fed28){return new BPromise(function(_0x2c60f5,_0xc03b1){return client[_0xa1ef('0xd')](_0x2dfcc6,_0x3fed28)[_0xa1ef('0xe')](function(_0x1dd911){logger['info'](_0xa1ef('0xf'),_0x3181bc,_0xa1ef('0x10'));logger[_0xa1ef('0x11')](_0xa1ef('0x12'),_0x3181bc,'request\x20sent',JSON[_0xa1ef('0x13')](_0x1dd911));if(_0x1dd911[_0xa1ef('0x14')]){if(_0x1dd911['error'][_0xa1ef('0x15')]===0x1f4){logger[_0xa1ef('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3181bc,_0x1dd911[_0xa1ef('0x14')][_0xa1ef('0x16')]);return _0xc03b1(_0x1dd911[_0xa1ef('0x14')][_0xa1ef('0x16')]);}logger[_0xa1ef('0x14')](_0xa1ef('0xf'),_0x3181bc,_0x1dd911[_0xa1ef('0x14')][_0xa1ef('0x16')]);return _0x2c60f5(_0x1dd911[_0xa1ef('0x14')]['message']);}else{logger[_0xa1ef('0x17')](_0xa1ef('0xf'),_0x3181bc,'request\x20sent');_0x2c60f5(_0x1dd911[_0xa1ef('0x18')][_0xa1ef('0x16')]);}})[_0xa1ef('0x19')](function(_0x56a250){logger['error'](_0xa1ef('0xf'),_0x3181bc,_0x56a250);_0xc03b1(_0x56a250);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ec83746..93890b4 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 _0x8514=['post','create','put','update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0x8514,0x1ec));var _0x4851=function(_0x58b61f,_0x2eb440){_0x58b61f=_0x58b61f-0x0;var _0x539372=_0x8514[_0x58b61f];return _0x539372;};'use strict';var multer=require(_0x4851('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4851('0x1'));var express=require('express');var router=express[_0x4851('0x2')]();var fs_extra=require(_0x4851('0x3'));var auth=require(_0x4851('0x4'));var interaction=require(_0x4851('0x5'));var config=require(_0x4851('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x4851('0x7')](),controller[_0x4851('0x8')]);router[_0x4851('0x9')](_0x4851('0xa'),auth[_0x4851('0x7')](),controller[_0x4851('0xb')]);router[_0x4851('0xc')]('/',auth[_0x4851('0x7')](),controller[_0x4851('0xd')]);router[_0x4851('0xe')](_0x4851('0xa'),auth['isAuthenticated'](),controller[_0x4851('0xf')]);router[_0x4851('0x10')](_0x4851('0xa'),auth[_0x4851('0x7')](),controller['destroy']);module[_0x4851('0x11')]=router; \ No newline at end of file +var _0x0c5b=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','util'];(function(_0xef1291,_0x531455){var _0x481753=function(_0x2ab754){while(--_0x2ab754){_0xef1291['push'](_0xef1291['shift']());}};_0x481753(++_0x531455);}(_0x0c5b,0x18f));var _0xb0c5=function(_0xb59086,_0x20249a){_0xb59086=_0xb59086-0x0;var _0x2965b5=_0x0c5b[_0xb59086];return _0x2965b5;};'use strict';var multer=require('multer');var util=require(_0xb0c5('0x0'));var path=require('path');var timeout=require(_0xb0c5('0x1'));var express=require(_0xb0c5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb0c5('0x3'));var interaction=require(_0xb0c5('0x4'));var config=require(_0xb0c5('0x5'));var controller=require(_0xb0c5('0x6'));router[_0xb0c5('0x7')]('/',auth[_0xb0c5('0x8')](),controller['index']);router['get'](_0xb0c5('0x9'),auth['isAuthenticated'](),controller[_0xb0c5('0xa')]);router['post']('/',auth[_0xb0c5('0x8')](),controller[_0xb0c5('0xb')]);router[_0xb0c5('0xc')]('/:id',auth[_0xb0c5('0x8')](),controller[_0xb0c5('0xd')]);router[_0xb0c5('0xe')](_0xb0c5('0x9'),auth['isAuthenticated'](),controller[_0xb0c5('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 11795a7..237737f 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 _0x95fe=['string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x560d66,_0xf86af7){var _0x1a7191=function(_0x47fdbc){while(--_0x47fdbc){_0x560d66['push'](_0x560d66['shift']());}};_0x1a7191(++_0xf86af7);}(_0x95fe,0xcd));var _0xe95f=function(_0x2724e5,_0x229d74){_0x2724e5=_0x2724e5-0x0;var _0x4b6621=_0x95fe[_0x2724e5];return _0x4b6621;};'use strict';var Sequelize=require(_0xe95f('0x0'));module[_0xe95f('0x1')]={'type':{'type':Sequelize[_0xe95f('0x2')]('string',_0xe95f('0x3'),_0xe95f('0x4'),'keyValue','picklist'),'defaultValue':_0xe95f('0x5')},'content':{'type':Sequelize[_0xe95f('0x6')]},'key':{'type':Sequelize[_0xe95f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xe95f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xe95f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe95f('0x6')]}}; \ No newline at end of file +var _0x02b6=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0x02b6,0x1d9));var _0x602b=function(_0x6eee88,_0x5c0416){_0x6eee88=_0x6eee88-0x0;var _0x329faa=_0x02b6[_0x6eee88];return _0x329faa;};'use strict';var Sequelize=require(_0x602b('0x0'));module[_0x602b('0x1')]={'type':{'type':Sequelize[_0x602b('0x2')](_0x602b('0x3'),_0x602b('0x4'),_0x602b('0x5'),_0x602b('0x6'),_0x602b('0x7')),'defaultValue':_0x602b('0x3')},'content':{'type':Sequelize[_0x602b('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x602b('0x3'),'variable',_0x602b('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x602b('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x602b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 8448e58..f56e5bb 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 _0x180b=['bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x42e6ce,_0x511000){var _0xbe41a7=function(_0xb233c0){while(--_0xb233c0){_0x42e6ce['push'](_0x42e6ce['shift']());}};_0xbe41a7(++_0x511000);}(_0x180b,0x185));var _0xb180=function(_0x4ade0d,_0x3bdabd){_0x4ade0d=_0x4ade0d-0x0;var _0x284fd5=_0x180b[_0x4ade0d];return _0x284fd5;};'use strict';var emlformat=require(_0xb180('0x0'));var rimraf=require(_0xb180('0x1'));var zipdir=require(_0xb180('0x2'));var jsonpatch=require(_0xb180('0x3'));var rp=require(_0xb180('0x4'));var moment=require(_0xb180('0x5'));var BPromise=require(_0xb180('0x6'));var Mustache=require(_0xb180('0x7'));var util=require(_0xb180('0x8'));var path=require(_0xb180('0x9'));var sox=require(_0xb180('0xa'));var csv=require('to-csv');var ejs=require(_0xb180('0xb'));var fs=require('fs');var fs_extra=require(_0xb180('0xc'));var _=require('lodash');var squel=require(_0xb180('0xd'));var crypto=require(_0xb180('0xe'));var jsforce=require(_0xb180('0xf'));var deskjs=require(_0xb180('0x10'));var toCsv=require(_0xb180('0x11'));var querystring=require(_0xb180('0x12'));var Papa=require(_0xb180('0x13'));var Redis=require('ioredis');var authService=require(_0xb180('0x14'));var qs=require(_0xb180('0x15'));var as=require(_0xb180('0x16'));var hardwareService=require(_0xb180('0x17'));var logger=require('../../config/logger')(_0xb180('0x18'));var utils=require(_0xb180('0x19'));var config=require(_0xb180('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb180('0x1b'))['db'];function respondWithStatusCode(_0x12e222,_0x5c8ff6){_0x5c8ff6=_0x5c8ff6||0xcc;return function(_0x3d8b9d){if(_0x3d8b9d){return _0x12e222[_0xb180('0x1c')](_0x5c8ff6);}return _0x12e222['status'](_0x5c8ff6)[_0xb180('0x1d')]();};}function respondWithResult(_0x4e6b44,_0x7524c5){_0x7524c5=_0x7524c5||0xc8;return function(_0x129930){if(_0x129930){return _0x4e6b44['status'](_0x7524c5)['json'](_0x129930);}};}function respondWithFilteredResult(_0x2163af,_0x38666a){return function(_0x3b0ffc){if(_0x3b0ffc){var _0x21d55b=typeof _0x38666a['offset']==='undefined'&&typeof _0x38666a['limit']===_0xb180('0x1e');var _0x51723f=_0x3b0ffc[_0xb180('0x1f')];var _0x51d617=_0x21d55b?0x0:_0x38666a[_0xb180('0x20')];var _0x1effdb=_0x21d55b?_0x3b0ffc['count']:_0x38666a[_0xb180('0x20')]+_0x38666a[_0xb180('0x21')];var _0x166593;if(_0x1effdb>=_0x51723f){_0x1effdb=_0x51723f;_0x166593=0xc8;}else{_0x166593=0xce;}_0x2163af[_0xb180('0x22')](_0x166593);return _0x2163af[_0xb180('0x23')](_0xb180('0x24'),_0x51d617+'-'+_0x1effdb+'/'+_0x51723f)['json'](_0x3b0ffc);}return null;};}function patchUpdates(_0x5814fa){return function(_0x251ed4){try{jsonpatch[_0xb180('0x25')](_0x251ed4,_0x5814fa,!![]);}catch(_0x2f3527){return BPromise[_0xb180('0x26')](_0x2f3527);}return _0x251ed4[_0xb180('0x27')]();};}function saveUpdates(_0x39ee2a,_0xa44711){return function(_0x368d73){if(_0x368d73){return _0x368d73[_0xb180('0x28')](_0x39ee2a)[_0xb180('0x29')](function(_0x52271a){return _0x52271a;});}return null;};}function removeEntity(_0x1c9c3d,_0x4767c8){return function(_0x313202){if(_0x313202){return _0x313202[_0xb180('0x2a')]()[_0xb180('0x29')](function(){_0x1c9c3d[_0xb180('0x22')](0xcc)[_0xb180('0x1d')]();});}};}function handleEntityNotFound(_0x38f557,_0x188be4){return function(_0x1b5af9){if(!_0x1b5af9){_0x38f557[_0xb180('0x1c')](0x194);}return _0x1b5af9;};}function handleError(_0x1080c5,_0x381f81){_0x381f81=_0x381f81||0x1f4;return function(_0x3f6b21){logger[_0xb180('0x2b')](_0x3f6b21[_0xb180('0x2c')]);if(_0x3f6b21[_0xb180('0x2d')]){delete _0x3f6b21['name'];}_0x1080c5[_0xb180('0x22')](_0x381f81)['send'](_0x3f6b21);};}exports[_0xb180('0x2e')]=function(_0xadae40,_0x1e81d0){var _0xad909b={},_0x100d58={},_0x2761c1={'count':0x0,'rows':[]};var _0x5c2385=_['map'](db[_0xb180('0x2f')][_0xb180('0x30')],function(_0x46bc09){return{'name':_0x46bc09[_0xb180('0x31')],'type':_0x46bc09[_0xb180('0x32')][_0xb180('0x33')]};});_0x100d58[_0xb180('0x34')]=_[_0xb180('0x35')](_0x5c2385,'name');_0x100d58[_0xb180('0x36')]=_[_0xb180('0x37')](_0xadae40[_0xb180('0x36')]);_0x100d58[_0xb180('0x38')]=_[_0xb180('0x39')](_0x100d58[_0xb180('0x34')],_0x100d58[_0xb180('0x36')]);_0xad909b[_0xb180('0x3a')]=_[_0xb180('0x39')](_0x100d58[_0xb180('0x34')],qs[_0xb180('0x3b')](_0xadae40[_0xb180('0x36')][_0xb180('0x3b')]));_0xad909b[_0xb180('0x3a')]=_0xad909b[_0xb180('0x3a')][_0xb180('0x3c')]?_0xad909b['attributes']:_0x100d58[_0xb180('0x34')];if(!_0xadae40[_0xb180('0x36')][_0xb180('0x3d')](_0xb180('0x3e'))){_0xad909b['limit']=qs[_0xb180('0x21')](_0xadae40['query'][_0xb180('0x21')]);_0xad909b[_0xb180('0x20')]=qs[_0xb180('0x20')](_0xadae40['query'][_0xb180('0x20')]);}_0xad909b['order']=qs['sort'](_0xadae40[_0xb180('0x36')][_0xb180('0x3f')]);_0xad909b[_0xb180('0x40')]=qs[_0xb180('0x38')](_[_0xb180('0x41')](_0xadae40[_0xb180('0x36')],_0x100d58[_0xb180('0x38')]),_0x5c2385);if(_0xadae40['query'][_0xb180('0x42')]){_0xad909b[_0xb180('0x40')]=_[_0xb180('0x43')](_0xad909b[_0xb180('0x40')],{'$or':_[_0xb180('0x35')](_0x5c2385,function(_0x454095){if(_0x454095[_0xb180('0x32')]!==_0xb180('0x44')){var _0x521e9c={};_0x521e9c[_0x454095[_0xb180('0x2d')]]={'$like':'%'+_0xadae40[_0xb180('0x36')][_0xb180('0x42')]+'%'};return _0x521e9c;}})});}_0xad909b=_[_0xb180('0x43')]({},_0xad909b,_0xadae40['options']);var _0x58d277={'where':_0xad909b['where']};return db[_0xb180('0x2f')][_0xb180('0x1f')](_0x58d277)[_0xb180('0x29')](function(_0x4cf61e){_0x2761c1[_0xb180('0x1f')]=_0x4cf61e;if(_0xadae40[_0xb180('0x36')][_0xb180('0x45')]){_0xad909b['include']=[{'all':!![]}];}return db['VtigerField'][_0xb180('0x46')](_0xad909b);})['then'](function(_0x115afe){_0x2761c1[_0xb180('0x47')]=_0x115afe;return _0x2761c1;})[_0xb180('0x29')](respondWithFilteredResult(_0x1e81d0,_0xad909b))[_0xb180('0x48')](handleError(_0x1e81d0,null));};exports[_0xb180('0x49')]=function(_0x3dc6ee,_0x1fd405){var _0xe14f6f={'raw':!![],'where':{'id':_0x3dc6ee['params']['id']}},_0x41b133={};_0x41b133[_0xb180('0x34')]=_[_0xb180('0x37')](db[_0xb180('0x2f')][_0xb180('0x30')]);_0x41b133[_0xb180('0x36')]=_['keys'](_0x3dc6ee['query']);_0x41b133[_0xb180('0x38')]=_[_0xb180('0x39')](_0x41b133[_0xb180('0x34')],_0x41b133[_0xb180('0x36')]);_0xe14f6f[_0xb180('0x3a')]=_['intersection'](_0x41b133[_0xb180('0x34')],qs[_0xb180('0x3b')](_0x3dc6ee[_0xb180('0x36')][_0xb180('0x3b')]));_0xe14f6f[_0xb180('0x3a')]=_0xe14f6f['attributes'][_0xb180('0x3c')]?_0xe14f6f[_0xb180('0x3a')]:_0x41b133['model'];if(_0x3dc6ee[_0xb180('0x36')]['includeAll']){_0xe14f6f['include']=[{'all':!![]}];}_0xe14f6f=_[_0xb180('0x43')]({},_0xe14f6f,_0x3dc6ee[_0xb180('0x4a')]);return db[_0xb180('0x2f')][_0xb180('0x4b')](_0xe14f6f)[_0xb180('0x29')](handleEntityNotFound(_0x1fd405,null))[_0xb180('0x29')](respondWithResult(_0x1fd405,null))[_0xb180('0x48')](handleError(_0x1fd405,null));};exports[_0xb180('0x4c')]=function(_0x3d3a4a,_0x229c23){return db[_0xb180('0x2f')][_0xb180('0x4c')](_0x3d3a4a[_0xb180('0x4d')],{})[_0xb180('0x29')](respondWithResult(_0x229c23,0xc9))[_0xb180('0x48')](handleError(_0x229c23,null));};exports[_0xb180('0x28')]=function(_0x276cc9,_0x476077){if(_0x276cc9['body']['id']){delete _0x276cc9[_0xb180('0x4d')]['id'];}return db[_0xb180('0x2f')][_0xb180('0x4b')]({'where':{'id':_0x276cc9[_0xb180('0x4e')]['id']}})[_0xb180('0x29')](handleEntityNotFound(_0x476077,null))[_0xb180('0x29')](saveUpdates(_0x276cc9[_0xb180('0x4d')],null))['then'](respondWithResult(_0x476077,null))['catch'](handleError(_0x476077,null));};exports[_0xb180('0x2a')]=function(_0x2b314f,_0x33b51c){return db['VtigerField'][_0xb180('0x4b')]({'where':{'id':_0x2b314f[_0xb180('0x4e')]['id']}})[_0xb180('0x29')](handleEntityNotFound(_0x33b51c,null))['then'](removeEntity(_0x33b51c,null))[_0xb180('0x48')](handleError(_0x33b51c,null));}; \ No newline at end of file +var _0x72aa=['error','stack','send','index','VtigerField','rawAttributes','fieldName','key','map','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','create','body','destroy','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x72aa,0x110));var _0xa72a=function(_0xb21204,_0xee0796){_0xb21204=_0xb21204-0x0;var _0x446f6d=_0x72aa[_0xb21204];return _0x446f6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa72a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa72a('0x1'));var rp=require(_0xa72a('0x2'));var moment=require(_0xa72a('0x3'));var BPromise=require(_0xa72a('0x4'));var Mustache=require(_0xa72a('0x5'));var util=require(_0xa72a('0x6'));var path=require(_0xa72a('0x7'));var sox=require('sox');var csv=require(_0xa72a('0x8'));var ejs=require(_0xa72a('0x9'));var fs=require('fs');var fs_extra=require(_0xa72a('0xa'));var _=require(_0xa72a('0xb'));var squel=require(_0xa72a('0xc'));var crypto=require(_0xa72a('0xd'));var jsforce=require(_0xa72a('0xe'));var deskjs=require(_0xa72a('0xf'));var toCsv=require(_0xa72a('0x8'));var querystring=require(_0xa72a('0x10'));var Papa=require('papaparse');var Redis=require(_0xa72a('0x11'));var authService=require(_0xa72a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa72a('0x13'));var hardwareService=require(_0xa72a('0x14'));var logger=require('../../config/logger')(_0xa72a('0x15'));var utils=require(_0xa72a('0x16'));var config=require(_0xa72a('0x17'));var licenseUtil=require(_0xa72a('0x18'));var db=require(_0xa72a('0x19'))['db'];function respondWithStatusCode(_0x39fe93,_0x1b9fee){_0x1b9fee=_0x1b9fee||0xcc;return function(_0x51a1ae){if(_0x51a1ae){return _0x39fe93[_0xa72a('0x1a')](_0x1b9fee);}return _0x39fe93[_0xa72a('0x1b')](_0x1b9fee)['end']();};}function respondWithResult(_0x40417a,_0x2801ae){_0x2801ae=_0x2801ae||0xc8;return function(_0xe82e93){if(_0xe82e93){return _0x40417a[_0xa72a('0x1b')](_0x2801ae)[_0xa72a('0x1c')](_0xe82e93);}};}function respondWithFilteredResult(_0x145d20,_0x32105b){return function(_0xe3030){if(_0xe3030){var _0x388dfb=typeof _0x32105b['offset']===_0xa72a('0x1d')&&typeof _0x32105b[_0xa72a('0x1e')]===_0xa72a('0x1d');var _0x1a2cc9=_0xe3030['count'];var _0x34de31=_0x388dfb?0x0:_0x32105b['offset'];var _0xf25e76=_0x388dfb?_0xe3030[_0xa72a('0x1f')]:_0x32105b[_0xa72a('0x20')]+_0x32105b[_0xa72a('0x1e')];var _0x4d5bba;if(_0xf25e76>=_0x1a2cc9){_0xf25e76=_0x1a2cc9;_0x4d5bba=0xc8;}else{_0x4d5bba=0xce;}_0x145d20['status'](_0x4d5bba);return _0x145d20['set'](_0xa72a('0x21'),_0x34de31+'-'+_0xf25e76+'/'+_0x1a2cc9)[_0xa72a('0x1c')](_0xe3030);}return null;};}function patchUpdates(_0x2b0647){return function(_0x2441aa){try{jsonpatch[_0xa72a('0x22')](_0x2441aa,_0x2b0647,!![]);}catch(_0x3d845c){return BPromise[_0xa72a('0x23')](_0x3d845c);}return _0x2441aa[_0xa72a('0x24')]();};}function saveUpdates(_0x14f3b3,_0x10bfa6){return function(_0x26a3fb){if(_0x26a3fb){return _0x26a3fb[_0xa72a('0x25')](_0x14f3b3)[_0xa72a('0x26')](function(_0x11bc93){return _0x11bc93;});}return null;};}function removeEntity(_0x5e71b6,_0x1cca02){return function(_0x55bde7){if(_0x55bde7){return _0x55bde7['destroy']()[_0xa72a('0x26')](function(){_0x5e71b6[_0xa72a('0x1b')](0xcc)[_0xa72a('0x27')]();});}};}function handleEntityNotFound(_0x1c60c2,_0x1e4ac5){return function(_0x11db0c){if(!_0x11db0c){_0x1c60c2[_0xa72a('0x1a')](0x194);}return _0x11db0c;};}function handleError(_0x244268,_0x274042){_0x274042=_0x274042||0x1f4;return function(_0xd44e68){logger[_0xa72a('0x28')](_0xd44e68[_0xa72a('0x29')]);if(_0xd44e68['name']){delete _0xd44e68['name'];}_0x244268['status'](_0x274042)[_0xa72a('0x2a')](_0xd44e68);};}exports[_0xa72a('0x2b')]=function(_0x5c2371,_0x2dec77){var _0x572e4b={},_0x3136ce={},_0x5dabf5={'count':0x0,'rows':[]};var _0x2879a0=_['map'](db[_0xa72a('0x2c')][_0xa72a('0x2d')],function(_0x50ef9b){return{'name':_0x50ef9b[_0xa72a('0x2e')],'type':_0x50ef9b['type'][_0xa72a('0x2f')]};});_0x3136ce['model']=_[_0xa72a('0x30')](_0x2879a0,_0xa72a('0x31'));_0x3136ce[_0xa72a('0x32')]=_[_0xa72a('0x33')](_0x5c2371['query']);_0x3136ce[_0xa72a('0x34')]=_[_0xa72a('0x35')](_0x3136ce[_0xa72a('0x36')],_0x3136ce[_0xa72a('0x32')]);_0x572e4b[_0xa72a('0x37')]=_[_0xa72a('0x35')](_0x3136ce[_0xa72a('0x36')],qs['fields'](_0x5c2371[_0xa72a('0x32')][_0xa72a('0x38')]));_0x572e4b[_0xa72a('0x37')]=_0x572e4b[_0xa72a('0x37')]['length']?_0x572e4b[_0xa72a('0x37')]:_0x3136ce[_0xa72a('0x36')];if(!_0x5c2371[_0xa72a('0x32')]['hasOwnProperty'](_0xa72a('0x39'))){_0x572e4b[_0xa72a('0x1e')]=qs[_0xa72a('0x1e')](_0x5c2371[_0xa72a('0x32')][_0xa72a('0x1e')]);_0x572e4b[_0xa72a('0x20')]=qs[_0xa72a('0x20')](_0x5c2371[_0xa72a('0x32')][_0xa72a('0x20')]);}_0x572e4b[_0xa72a('0x3a')]=qs['sort'](_0x5c2371[_0xa72a('0x32')][_0xa72a('0x3b')]);_0x572e4b['where']=qs[_0xa72a('0x34')](_[_0xa72a('0x3c')](_0x5c2371[_0xa72a('0x32')],_0x3136ce[_0xa72a('0x34')]),_0x2879a0);if(_0x5c2371['query'][_0xa72a('0x3d')]){_0x572e4b[_0xa72a('0x3e')]=_[_0xa72a('0x3f')](_0x572e4b['where'],{'$or':_[_0xa72a('0x30')](_0x2879a0,function(_0x1db733){if(_0x1db733[_0xa72a('0x40')]!==_0xa72a('0x41')){var _0x50557e={};_0x50557e[_0x1db733['name']]={'$like':'%'+_0x5c2371['query'][_0xa72a('0x3d')]+'%'};return _0x50557e;}})});}_0x572e4b=_[_0xa72a('0x3f')]({},_0x572e4b,_0x5c2371['options']);var _0x45a156={'where':_0x572e4b[_0xa72a('0x3e')]};return db[_0xa72a('0x2c')][_0xa72a('0x1f')](_0x45a156)[_0xa72a('0x26')](function(_0x1125f1){_0x5dabf5[_0xa72a('0x1f')]=_0x1125f1;if(_0x5c2371[_0xa72a('0x32')][_0xa72a('0x42')]){_0x572e4b[_0xa72a('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0xa72a('0x44')](_0x572e4b);})['then'](function(_0x235c5f){_0x5dabf5[_0xa72a('0x45')]=_0x235c5f;return _0x5dabf5;})['then'](respondWithFilteredResult(_0x2dec77,_0x572e4b))[_0xa72a('0x46')](handleError(_0x2dec77,null));};exports['show']=function(_0x155350,_0x57f6c4){var _0x152e10={'raw':!![],'where':{'id':_0x155350[_0xa72a('0x47')]['id']}},_0x5d44a2={};_0x5d44a2['model']=_[_0xa72a('0x33')](db[_0xa72a('0x2c')]['rawAttributes']);_0x5d44a2['query']=_['keys'](_0x155350[_0xa72a('0x32')]);_0x5d44a2[_0xa72a('0x34')]=_[_0xa72a('0x35')](_0x5d44a2[_0xa72a('0x36')],_0x5d44a2['query']);_0x152e10[_0xa72a('0x37')]=_[_0xa72a('0x35')](_0x5d44a2['model'],qs[_0xa72a('0x38')](_0x155350['query'][_0xa72a('0x38')]));_0x152e10['attributes']=_0x152e10[_0xa72a('0x37')][_0xa72a('0x48')]?_0x152e10['attributes']:_0x5d44a2[_0xa72a('0x36')];if(_0x155350[_0xa72a('0x32')][_0xa72a('0x42')]){_0x152e10[_0xa72a('0x43')]=[{'all':!![]}];}_0x152e10=_['merge']({},_0x152e10,_0x155350[_0xa72a('0x49')]);return db['VtigerField']['find'](_0x152e10)['then'](handleEntityNotFound(_0x57f6c4,null))[_0xa72a('0x26')](respondWithResult(_0x57f6c4,null))['catch'](handleError(_0x57f6c4,null));};exports[_0xa72a('0x4a')]=function(_0x5d10f0,_0x56d747){return db[_0xa72a('0x2c')][_0xa72a('0x4a')](_0x5d10f0[_0xa72a('0x4b')],{})[_0xa72a('0x26')](respondWithResult(_0x56d747,0xc9))[_0xa72a('0x46')](handleError(_0x56d747,null));};exports['update']=function(_0x5858d4,_0x407e1f){if(_0x5858d4[_0xa72a('0x4b')]['id']){delete _0x5858d4[_0xa72a('0x4b')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x5858d4['params']['id']}})[_0xa72a('0x26')](handleEntityNotFound(_0x407e1f,null))[_0xa72a('0x26')](saveUpdates(_0x5858d4[_0xa72a('0x4b')],null))[_0xa72a('0x26')](respondWithResult(_0x407e1f,null))[_0xa72a('0x46')](handleError(_0x407e1f,null));};exports[_0xa72a('0x4c')]=function(_0x44631b,_0x132d51){return db[_0xa72a('0x2c')][_0xa72a('0x4d')]({'where':{'id':_0x44631b[_0xa72a('0x47')]['id']}})[_0xa72a('0x26')](handleEntityNotFound(_0x132d51,null))[_0xa72a('0x26')](removeEntity(_0x132d51,null))[_0xa72a('0x46')](handleError(_0x132d51,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ef15d95..9a6193b 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 _0xc9b3=['../../config/logger','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x38e5f0,_0x4fedd8){var _0x5b08dc=function(_0x321b77){while(--_0x321b77){_0x38e5f0['push'](_0x38e5f0['shift']());}};_0x5b08dc(++_0x4fedd8);}(_0xc9b3,0x129));var _0x3c9b=function(_0xcf17f8,_0x1eba10){_0xcf17f8=_0xcf17f8-0x0;var _0x354505=_0xc9b3[_0xcf17f8];return _0x354505;};'use strict';var _=require(_0x3c9b('0x0'));var util=require(_0x3c9b('0x1'));var logger=require(_0x3c9b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c9b('0x3'));var rimraf=require(_0x3c9b('0x4'));var config=require(_0x3c9b('0x5'));var attributes=require('./intVtigerField.attributes');module[_0x3c9b('0x6')]=function(_0x50dab3,_0x47d245){return _0x50dab3[_0x3c9b('0x7')](_0x3c9b('0x8'),attributes,{'tableName':_0x3c9b('0x9'),'paranoid':![],'indexes':[{'name':_0x3c9b('0xa'),'fields':[_0x3c9b('0xb'),_0x3c9b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xccfe=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xccfe,0x1b2));var _0xeccf=function(_0x4f3220,_0x2785b5){_0x4f3220=_0x4f3220-0x0;var _0x4fd37d=_0xccfe[_0x4f3220];return _0x4fd37d;};'use strict';var _=require(_0xeccf('0x0'));var util=require(_0xeccf('0x1'));var logger=require(_0xeccf('0x2'))(_0xeccf('0x3'));var moment=require(_0xeccf('0x4'));var BPromise=require(_0xeccf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeccf('0x6'));var rimraf=require(_0xeccf('0x7'));var config=require(_0xeccf('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xeccf('0x9')]=function(_0x5311db,_0x3d9d73){return _0x5311db[_0xeccf('0xa')](_0xeccf('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xeccf('0xc'),'fields':[_0xeccf('0xd'),_0xeccf('0xe')],'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 4ea1617..bbca25e 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 _0x5352=['../../config/environment','jayson/promise','http','request','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43e3f2,_0x4510f6){var _0x9fa1a2=function(_0x18615d){while(--_0x18615d){_0x43e3f2['push'](_0x43e3f2['shift']());}};_0x9fa1a2(++_0x4510f6);}(_0x5352,0x12c));var _0x2535=function(_0x431f91,_0x29f355){_0x431f91=_0x431f91-0x0;var _0x3a1fd8=_0x5352[_0x431f91];return _0x3a1fd8;};'use strict';var _=require(_0x2535('0x0'));var util=require('util');var moment=require(_0x2535('0x1'));var BPromise=require(_0x2535('0x2'));var rs=require(_0x2535('0x3'));var fs=require('fs');var Redis=require(_0x2535('0x4'));var db=require(_0x2535('0x5'))['db'];var utils=require(_0x2535('0x6'));var logger=require(_0x2535('0x7'))('rpc');var config=require(_0x2535('0x8'));var jayson=require(_0x2535('0x9'));var client=jayson['client'][_0x2535('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb60b91,_0x487c1c,_0x8dd936){return new BPromise(function(_0x374da7,_0x3d0770){return client[_0x2535('0xb')](_0xb60b91,_0x8dd936)['then'](function(_0x1dc7f5){logger[_0x2535('0xc')](_0x2535('0xd'),_0x487c1c,'request\x20sent');logger['debug'](_0x2535('0xe'),_0x487c1c,_0x2535('0xf'),JSON[_0x2535('0x10')](_0x1dc7f5));if(_0x1dc7f5[_0x2535('0x11')]){if(_0x1dc7f5['error'][_0x2535('0x12')]===0x1f4){logger[_0x2535('0x11')](_0x2535('0xd'),_0x487c1c,_0x1dc7f5[_0x2535('0x11')]['message']);return _0x3d0770(_0x1dc7f5['error'][_0x2535('0x13')]);}logger[_0x2535('0x11')](_0x2535('0xd'),_0x487c1c,_0x1dc7f5[_0x2535('0x11')][_0x2535('0x13')]);return _0x374da7(_0x1dc7f5[_0x2535('0x11')][_0x2535('0x13')]);}else{logger[_0x2535('0xc')](_0x2535('0xd'),_0x487c1c,'request\x20sent');_0x374da7(_0x1dc7f5[_0x2535('0x14')][_0x2535('0x13')]);}})[_0x2535('0x15')](function(_0x27351a){logger[_0x2535('0x11')](_0x2535('0xd'),_0x487c1c,_0x27351a);_0x3d0770(_0x27351a);});});} \ No newline at end of file +var _0xfdec=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x32b8c7,_0xeeafb4){var _0x2fcdc8=function(_0x970efe){while(--_0x970efe){_0x32b8c7['push'](_0x32b8c7['shift']());}};_0x2fcdc8(++_0xeeafb4);}(_0xfdec,0xf1));var _0xcfde=function(_0x10d07b,_0xa771c5){_0x10d07b=_0x10d07b-0x0;var _0x2c880e=_0xfdec[_0x10d07b];return _0x2c880e;};'use strict';var _=require(_0xcfde('0x0'));var util=require(_0xcfde('0x1'));var moment=require(_0xcfde('0x2'));var BPromise=require('bluebird');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('../../config/environment');var jayson=require(_0xcfde('0x7'));var client=jayson[_0xcfde('0x8')][_0xcfde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371248,_0x130deb,_0x4a5bab){return new BPromise(function(_0x4f1325,_0x28069e){return client[_0xcfde('0xa')](_0x371248,_0x4a5bab)[_0xcfde('0xb')](function(_0x458b52){logger[_0xcfde('0xc')](_0xcfde('0xd'),_0x130deb,'request\x20sent');logger[_0xcfde('0xe')](_0xcfde('0xf'),_0x130deb,_0xcfde('0x10'),JSON[_0xcfde('0x11')](_0x458b52));if(_0x458b52[_0xcfde('0x12')]){if(_0x458b52[_0xcfde('0x12')][_0xcfde('0x13')]===0x1f4){logger[_0xcfde('0x12')](_0xcfde('0xd'),_0x130deb,_0x458b52['error'][_0xcfde('0x14')]);return _0x28069e(_0x458b52[_0xcfde('0x12')][_0xcfde('0x14')]);}logger[_0xcfde('0x12')](_0xcfde('0xd'),_0x130deb,_0x458b52['error'][_0xcfde('0x14')]);return _0x4f1325(_0x458b52[_0xcfde('0x12')][_0xcfde('0x14')]);}else{logger[_0xcfde('0xc')](_0xcfde('0xd'),_0x130deb,'request\x20sent');_0x4f1325(_0x458b52['result']['message']);}})[_0xcfde('0x15')](function(_0x1f7cb1){logger[_0xcfde('0x12')](_0xcfde('0xd'),_0x130deb,_0x1f7cb1);_0x28069e(_0x1f7cb1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3d29721..6aac214 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 _0x97a0=['express','../../components/auth/service','./intZendeskAccount.controller','get','index','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','delete','destroy','exports','multer','util','path'];(function(_0x5ec6d7,_0x1d3878){var _0x503fb3=function(_0x2a8dc4){while(--_0x2a8dc4){_0x5ec6d7['push'](_0x5ec6d7['shift']());}};_0x503fb3(++_0x1d3878);}(_0x97a0,0xc5));var _0x097a=function(_0x1010ff,_0x419fe6){_0x1010ff=_0x1010ff-0x0;var _0x1843b2=_0x97a0[_0x1010ff];return _0x1843b2;};'use strict';var multer=require(_0x097a('0x0'));var util=require(_0x097a('0x1'));var path=require(_0x097a('0x2'));var timeout=require('connect-timeout');var express=require(_0x097a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x097a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x097a('0x5'));router[_0x097a('0x6')]('/',auth['isAuthenticated'](),controller[_0x097a('0x7')]);router[_0x097a('0x6')]('/:id',auth[_0x097a('0x8')](),controller[_0x097a('0x9')]);router['get']('/:id/configurations',auth[_0x097a('0x8')](),controller[_0x097a('0xa')]);router[_0x097a('0x6')](_0x097a('0xb'),auth[_0x097a('0x8')](),controller[_0x097a('0xc')]);router[_0x097a('0xd')]('/',auth[_0x097a('0x8')](),controller[_0x097a('0xe')]);router[_0x097a('0xd')](_0x097a('0xf'),auth[_0x097a('0x8')](),controller['addConfiguration']);router[_0x097a('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x097a('0x11')]('/:id',auth[_0x097a('0x8')](),controller[_0x097a('0x12')]);module[_0x097a('0x13')]=router; \ No newline at end of file +var _0x668b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x2eec6f,_0x4100c7){var _0x3bdffb=function(_0x4481c2){while(--_0x4481c2){_0x2eec6f['push'](_0x2eec6f['shift']());}};_0x3bdffb(++_0x4100c7);}(_0x668b,0x1b5));var _0xb668=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x668b[_0x2555d0];return _0x3bb486;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require(_0xb668('0x5'));var interaction=require(_0xb668('0x6'));var config=require('../../config/environment');var controller=require(_0xb668('0x7'));router[_0xb668('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb668('0x8')]('/:id',auth[_0xb668('0x9')](),controller['show']);router[_0xb668('0x8')](_0xb668('0xa'),auth[_0xb668('0x9')](),controller['getConfigurations']);router[_0xb668('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb668('0xb')]);router[_0xb668('0xc')]('/',auth[_0xb668('0x9')](),controller[_0xb668('0xd')]);router[_0xb668('0xc')](_0xb668('0xa'),auth[_0xb668('0x9')](),controller[_0xb668('0xe')]);router[_0xb668('0xf')](_0xb668('0x10'),auth['isAuthenticated'](),controller[_0xb668('0x11')]);router[_0xb668('0x12')](_0xb668('0x10'),auth[_0xb668('0x9')](),controller[_0xb668('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index cf23698..16625a5 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 _0x7eff=['integrationTab','newTab','exports','STRING','username','password','token','ENUM'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf7ef('0x0')]={'name':{'type':Sequelize[_0xf7ef('0x1')]},'description':{'type':Sequelize[_0xf7ef('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xf7ef('0x2')},'password':{'type':Sequelize[_0xf7ef('0x1')]},'token':{'type':Sequelize[_0xf7ef('0x1')]},'remoteUri':{'type':Sequelize[_0xf7ef('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xf7ef('0x3'),_0xf7ef('0x4')),'defaultValue':_0xf7ef('0x3')},'serverUrl':{'type':Sequelize[_0xf7ef('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf7ef('0x5')](_0xf7ef('0x6'),_0xf7ef('0x7')),'defaultValue':_0xf7ef('0x6')}}; \ No newline at end of file +var _0x5f2f=['STRING','username','ENUM','password','token','newTab','integrationTab','sequelize','exports'];(function(_0x4c5847,_0xd4a2ad){var _0x5c308b=function(_0x2987a4){while(--_0x2987a4){_0x4c5847['push'](_0x4c5847['shift']());}};_0x5c308b(++_0xd4a2ad);}(_0x5f2f,0x73));var _0xf5f2=function(_0x165715,_0x54ca5d){_0x165715=_0x165715-0x0;var _0x1f56eb=_0x5f2f[_0x165715];return _0x1f56eb;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')]},'description':{'type':Sequelize[_0xf5f2('0x2')]},'username':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3')},'password':{'type':Sequelize[_0xf5f2('0x2')]},'token':{'type':Sequelize[_0xf5f2('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xf5f2('0x4')](_0xf5f2('0x5'),_0xf5f2('0x6')),'defaultValue':_0xf5f2('0x5')},'serverUrl':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x4')]('integrationTab',_0xf5f2('0x7')),'defaultValue':_0xf5f2('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 661f120..13be07b 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 _0xb688=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','name','options','findAll','rows','catch','show','includeAll','include','find','create','params','body','findOne','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','getFields','username','password','token','remoteUri','slice','substring','%s/%s','authType','format','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','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','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xb688,0xcf));var _0x8b68=function(_0x120761,_0x8ef4f1){_0x120761=_0x120761-0x0;var _0x28f6f9=_0xb688[_0x120761];return _0x28f6f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];var integrations=require(_0x8b68('0x1b'));function respondWithStatusCode(_0x2f3af4,_0xaa8725){_0xaa8725=_0xaa8725||0xcc;return function(_0x137c8e){if(_0x137c8e){return _0x2f3af4[_0x8b68('0x1c')](_0xaa8725);}return _0x2f3af4['status'](_0xaa8725)[_0x8b68('0x1d')]();};}function respondWithResult(_0x509033,_0x5e3c66){_0x5e3c66=_0x5e3c66||0xc8;return function(_0x22f75b){if(_0x22f75b){return _0x509033[_0x8b68('0x1e')](_0x5e3c66)[_0x8b68('0x1f')](_0x22f75b);}};}function respondWithFilteredResult(_0x5d3468,_0x5c8d0e){return function(_0x23bd52){if(_0x23bd52){var _0x5c1e44=typeof _0x5c8d0e[_0x8b68('0x20')]===_0x8b68('0x21')&&typeof _0x5c8d0e[_0x8b68('0x22')]===_0x8b68('0x21');var _0x491695=_0x23bd52[_0x8b68('0x23')];var _0x203dd4=_0x5c1e44?0x0:_0x5c8d0e['offset'];var _0x42b3bd=_0x5c1e44?_0x23bd52[_0x8b68('0x23')]:_0x5c8d0e[_0x8b68('0x20')]+_0x5c8d0e[_0x8b68('0x22')];var _0x38b7a7;if(_0x42b3bd>=_0x491695){_0x42b3bd=_0x491695;_0x38b7a7=0xc8;}else{_0x38b7a7=0xce;}_0x5d3468['status'](_0x38b7a7);return _0x5d3468[_0x8b68('0x24')](_0x8b68('0x25'),_0x203dd4+'-'+_0x42b3bd+'/'+_0x491695)[_0x8b68('0x1f')](_0x23bd52);}return null;};}function patchUpdates(_0x1a9788){return function(_0x35d055){try{jsonpatch[_0x8b68('0x26')](_0x35d055,_0x1a9788,!![]);}catch(_0x5603d4){return BPromise['reject'](_0x5603d4);}return _0x35d055[_0x8b68('0x27')]();};}function saveUpdates(_0x59cb26,_0x332202){return function(_0x30b6d0){if(_0x30b6d0){return _0x30b6d0[_0x8b68('0x28')](_0x59cb26)[_0x8b68('0x29')](function(_0x32ddc5){return _0x32ddc5;});}return null;};}function removeEntity(_0x173524,_0x59bb8a){return function(_0x1a6fe8){if(_0x1a6fe8){return _0x1a6fe8[_0x8b68('0x2a')]()['then'](function(){_0x173524[_0x8b68('0x1e')](0xcc)[_0x8b68('0x1d')]();});}};}function handleEntityNotFound(_0x240b0b,_0x5590ec){return function(_0x511ccf){if(!_0x511ccf){_0x240b0b['sendStatus'](0x194);}return _0x511ccf;};}function handleError(_0x92d186,_0x448e43){_0x448e43=_0x448e43||0x1f4;return function(_0x2ba2a3){logger['error'](_0x2ba2a3[_0x8b68('0x2b')]);if(_0x2ba2a3['name']){delete _0x2ba2a3['name'];}_0x92d186[_0x8b68('0x1e')](_0x448e43)['send'](_0x2ba2a3);};}exports[_0x8b68('0x2c')]=function(_0x3ac356,_0x48e2c8){var _0x494ce4={},_0x357635={},_0x1cd230={'count':0x0,'rows':[]};var _0x1e7c06=_[_0x8b68('0x2d')](db[_0x8b68('0x2e')][_0x8b68('0x2f')],function(_0x460c37){return{'name':_0x460c37['fieldName'],'type':_0x460c37[_0x8b68('0x30')]['key']};});_0x357635[_0x8b68('0x31')]=_[_0x8b68('0x2d')](_0x1e7c06,'name');_0x357635[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ac356[_0x8b68('0x32')]);_0x357635['filters']=_['intersection'](_0x357635[_0x8b68('0x31')],_0x357635[_0x8b68('0x32')]);_0x494ce4[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x357635[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x36')]));_0x494ce4[_0x8b68('0x34')]=_0x494ce4[_0x8b68('0x34')][_0x8b68('0x37')]?_0x494ce4[_0x8b68('0x34')]:_0x357635[_0x8b68('0x31')];if(!_0x3ac356[_0x8b68('0x32')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x494ce4[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x22')]);_0x494ce4[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3ac356['query']['offset']);}_0x494ce4[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x494ce4[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x3ac356[_0x8b68('0x32')],_0x357635['filters']),_0x1e7c06);if(_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x494ce4[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x494ce4[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x1e7c06,function(_0xff4080){if(_0xff4080[_0x8b68('0x30')]!=='VIRTUAL'){var _0x3f874c={};_0x3f874c[_0xff4080[_0x8b68('0x41')]]={'$like':'%'+_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]+'%'};return _0x3f874c;}})});}_0x494ce4=_[_0x8b68('0x40')]({},_0x494ce4,_0x3ac356[_0x8b68('0x42')]);var _0xa748c2={'where':_0x494ce4['where']};return db[_0x8b68('0x2e')][_0x8b68('0x23')](_0xa748c2)['then'](function(_0x14ec40){_0x1cd230[_0x8b68('0x23')]=_0x14ec40;if(_0x3ac356['query']['includeAll']){_0x494ce4['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x8b68('0x43')](_0x494ce4);})[_0x8b68('0x29')](function(_0x515815){_0x1cd230[_0x8b68('0x44')]=_0x515815;return _0x1cd230;})['then'](respondWithFilteredResult(_0x48e2c8,_0x494ce4))[_0x8b68('0x45')](handleError(_0x48e2c8,null));};exports[_0x8b68('0x46')]=function(_0x5a3193,_0x2f90d9){var _0x5ae345={'raw':![],'where':{'id':_0x5a3193['params']['id']}},_0x4a718c={};_0x4a718c[_0x8b68('0x31')]=_[_0x8b68('0x33')](db[_0x8b68('0x2e')][_0x8b68('0x2f')]);_0x4a718c['query']=_[_0x8b68('0x33')](_0x5a3193['query']);_0x4a718c[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x4a718c['model'],_0x4a718c[_0x8b68('0x32')]);_0x5ae345[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x4a718c[_0x8b68('0x31')],qs['fields'](_0x5a3193[_0x8b68('0x32')][_0x8b68('0x36')]));_0x5ae345[_0x8b68('0x34')]=_0x5ae345[_0x8b68('0x34')][_0x8b68('0x37')]?_0x5ae345[_0x8b68('0x34')]:_0x4a718c[_0x8b68('0x31')];if(_0x5a3193[_0x8b68('0x32')][_0x8b68('0x47')]){_0x5ae345[_0x8b68('0x48')]=[{'all':!![]}];}_0x5ae345=_[_0x8b68('0x40')]({},_0x5ae345,_0x5a3193[_0x8b68('0x42')]);return db[_0x8b68('0x2e')][_0x8b68('0x49')](_0x5ae345)[_0x8b68('0x29')](handleEntityNotFound(_0x2f90d9,null))[_0x8b68('0x29')](respondWithResult(_0x2f90d9,null))['catch'](handleError(_0x2f90d9,null));};exports[_0x8b68('0x4a')]=function(_0x20681a,_0x5dd099){return db[_0x8b68('0x2e')]['create'](_0x20681a['body'],{})['then'](respondWithResult(_0x5dd099,0xc9))[_0x8b68('0x45')](handleError(_0x5dd099,null));};exports[_0x8b68('0x28')]=function(_0x34047c,_0x6da48b){if(_0x34047c['body']['id']){delete _0x34047c['body']['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x49')]({'where':{'id':_0x34047c[_0x8b68('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6da48b,null))[_0x8b68('0x29')](saveUpdates(_0x34047c[_0x8b68('0x4c')],null))['then'](respondWithResult(_0x6da48b,null))[_0x8b68('0x45')](handleError(_0x6da48b,null));};exports[_0x8b68('0x2a')]=function(_0x595942,_0x18a9ae){return db[_0x8b68('0x2e')]['find']({'where':{'id':_0x595942[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x18a9ae,null))['then'](removeEntity(_0x18a9ae,null))['catch'](handleError(_0x18a9ae,null));};exports['getConfigurations']=function(_0x28f82d,_0x42eabd,_0x3718b2){var _0x3d4b4f={};var _0x55aad3={};var _0x5a1711;var _0x4492fd;return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x28f82d['params']['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x42eabd,null))[_0x8b68('0x29')](function(_0x3f9d34){if(_0x3f9d34){_0x5a1711=_0x3f9d34;_0x55aad3['model']=_[_0x8b68('0x33')](db['ZendeskConfiguration'][_0x8b68('0x2f')]);_0x55aad3[_0x8b68('0x32')]=_['keys'](_0x28f82d[_0x8b68('0x32')]);_0x55aad3[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],_0x55aad3[_0x8b68('0x32')]);_0x3d4b4f['attributes']=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x36')]));_0x3d4b4f[_0x8b68('0x34')]=_0x3d4b4f[_0x8b68('0x34')][_0x8b68('0x37')]?_0x3d4b4f['attributes']:_0x55aad3[_0x8b68('0x31')];_0x3d4b4f[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x3d4b4f[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x28f82d[_0x8b68('0x32')],_0x55aad3[_0x8b68('0x3d')]));if(_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x3d4b4f[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x3d4b4f[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x3d4b4f[_0x8b68('0x34')],function(_0x3da7b4){var _0xae90f0={};_0xae90f0[_0x3da7b4]={'$like':'%'+_0x28f82d[_0x8b68('0x32')]['filter']+'%'};return _0xae90f0;})});}_0x3d4b4f=_[_0x8b68('0x40')]({},_0x3d4b4f,_0x28f82d['options']);return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x5d2476){if(_0x5d2476){_0x4492fd=_0x5d2476[_0x8b68('0x37')];if(!_0x28f82d[_0x8b68('0x32')][_0x8b68('0x38')]('nolimit')){_0x3d4b4f[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x22')]);_0x3d4b4f[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x28f82d[_0x8b68('0x32')]['offset']);}return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x4224f5){if(_0x4224f5){return _0x4224f5?{'count':_0x4492fd,'rows':_0x4224f5}:null;}})[_0x8b68('0x29')](respondWithResult(_0x42eabd,null))[_0x8b68('0x45')](handleError(_0x42eabd,null));};exports[_0x8b68('0x4e')]=function(_0x37da34,_0x2d1519,_0x314f1e){if(_0x37da34[_0x8b68('0x4c')]['id']){delete _0x37da34[_0x8b68('0x4c')]['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x37da34[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x2d1519,null))[_0x8b68('0x29')](function(_0x414096){if(_0x414096){_0x37da34[_0x8b68('0x4c')][_0x8b68('0x4f')]=_0x414096['id'];_0x37da34['body']['Subjects']=integrations[_0x8b68('0x50')](_0x37da34[_0x8b68('0x4c')]['channel'],_0x37da34['body']['type']);_0x37da34[_0x8b68('0x4c')][_0x8b68('0x51')]=integrations[_0x8b68('0x52')](_0x37da34[_0x8b68('0x4c')][_0x8b68('0x53')],_0x37da34['body'][_0x8b68('0x30')]);return db[_0x8b68('0x54')]['create'](_0x37da34[_0x8b68('0x4c')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x8b68('0x51')}]});}return null;})[_0x8b68('0x29')](respondWithResult(_0x2d1519,null))[_0x8b68('0x45')](handleError(_0x2d1519,null));};exports[_0x8b68('0x55')]=function(_0x864b6b,_0x1fc24c,_0x35b22b){var _0x34456d='';return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x864b6b['params']['id']},'attributes':['id',_0x8b68('0x56'),_0x8b68('0x57'),_0x8b68('0x58'),'authType','remoteUri']})[_0x8b68('0x29')](handleEntityNotFound(_0x1fc24c,null))[_0x8b68('0x29')](function(_0x525b41){if(_0x525b41){_0x34456d=_0x525b41[_0x8b68('0x59')];var _0x2c1c96=_0x34456d[_0x8b68('0x5a')](-0x1);if(_0x2c1c96==='/'){_0x34456d=_0x34456d[_0x8b68('0x5b')](0x0,_0x34456d['lastIndexOf'](_0x2c1c96));}var _0x96e526={'method':'GET','uri':util['format'](_0x8b68('0x5c'),_0x34456d,'ticket_fields'),'json':!![]};switch(_0x525b41[_0x8b68('0x5d')]){case _0x8b68('0x57'):_0x96e526['headers']={'Authorization':util[_0x8b68('0x5e')](_0x8b68('0x5f'),new Buffer(util[_0x8b68('0x5e')](_0x8b68('0x60'),_0x525b41[_0x8b68('0x56')],_0x525b41['password']))[_0x8b68('0x61')](_0x8b68('0x62')))};break;case _0x8b68('0x58'):_0x96e526[_0x8b68('0x63')]={'Authorization':util[_0x8b68('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0x8b68('0x64'),_0x525b41['username'],_0x525b41[_0x8b68('0x58')]))[_0x8b68('0x61')](_0x8b68('0x62')))};break;default:throw new db[(_0x8b68('0x65'))][(_0x8b68('0x66'))](_0x8b68('0x67'));}return rp(_0x96e526);}})[_0x8b68('0x29')](function(_0x486be8){if(_0x486be8){var _0x3033b4=['subject',_0x8b68('0x68'),_0x8b68('0x69'),_0x8b68('0x6a')];_['remove'](_0x486be8[_0x8b68('0x6b')],function(_0x50d0b9){return _0x3033b4[_0x8b68('0x6c')](_0x50d0b9['type']);});return{'count':_0x486be8[_0x8b68('0x6b')][_0x8b68('0x37')],'rows':_[_0x8b68('0x2d')](_0x486be8['ticket_fields'],function(_0x33b775){return{'id':_0x33b775['id'],'name':_0x33b775[_0x8b68('0x6d')]>0x7?_0x33b775[_0x8b68('0x6e')]:_0x33b775[_0x8b68('0x30')],'custom':_0x33b775[_0x8b68('0x6d')]>0x7?!![]:![],'options':_0x33b775[_0x8b68('0x6f')]?_0x33b775[_0x8b68('0x6f')]:_0x33b775[_0x8b68('0x70')]?_0x33b775[_0x8b68('0x70')]:[]};})};}})['then'](respondWithResult(_0x1fc24c,null))[_0x8b68('0x45')](function(_0x3cb970){var _0x9a5bec=_0x864b6b[_0x8b68('0x32')][_0x8b68('0x71')]?0x1f4:_0x3cb970['statusCode']||0x1f4;logger[_0x8b68('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x8b68('0x55'),_0x9a5bec,JSON[_0x8b68('0x73')](_0x3cb970));delete _0x3cb970['name'];if(_0x9a5bec===0x191){_0x9a5bec=0x190;}_0x1fc24c[_0x8b68('0x1e')](_0x9a5bec)[_0x8b68('0x74')](_0x864b6b[_0x8b68('0x32')]['test']?{'message':_0x8b68('0x75'),'statusCode':_0x3cb970[_0x8b68('0x76')]}:_0x3cb970);});}; \ No newline at end of file +var _0xb7e7=['channel','getDescriptions','ZendeskField','Subjects','Descriptions','password','token','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','Basic\x20%s','%s:%s','username','base64','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskAccount','findAll','rows','show','params','length','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','options','AccountId','getSubjects'];(function(_0x5f1b1f,_0x33b025){var _0x2cfe70=function(_0x402777){while(--_0x402777){_0x5f1b1f['push'](_0x5f1b1f['shift']());}};_0x2cfe70(++_0x33b025);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb7e7[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];var integrations=require(_0x7b7e('0x19'));function respondWithStatusCode(_0x54d8ce,_0x267446){_0x267446=_0x267446||0xcc;return function(_0x430eab){if(_0x430eab){return _0x54d8ce['sendStatus'](_0x267446);}return _0x54d8ce[_0x7b7e('0x1a')](_0x267446)['end']();};}function respondWithResult(_0x4c6011,_0x2889ed){_0x2889ed=_0x2889ed||0xc8;return function(_0xd304f5){if(_0xd304f5){return _0x4c6011[_0x7b7e('0x1a')](_0x2889ed)[_0x7b7e('0x1b')](_0xd304f5);}};}function respondWithFilteredResult(_0x3d2fb2,_0x5703fd){return function(_0x51baf6){if(_0x51baf6){var _0xc7f087=typeof _0x5703fd[_0x7b7e('0x1c')]===_0x7b7e('0x1d')&&typeof _0x5703fd[_0x7b7e('0x1e')]===_0x7b7e('0x1d');var _0x3bf2f0=_0x51baf6[_0x7b7e('0x1f')];var _0x200ef7=_0xc7f087?0x0:_0x5703fd[_0x7b7e('0x1c')];var _0x429a0e=_0xc7f087?_0x51baf6[_0x7b7e('0x1f')]:_0x5703fd[_0x7b7e('0x1c')]+_0x5703fd[_0x7b7e('0x1e')];var _0x3bec7d;if(_0x429a0e>=_0x3bf2f0){_0x429a0e=_0x3bf2f0;_0x3bec7d=0xc8;}else{_0x3bec7d=0xce;}_0x3d2fb2[_0x7b7e('0x1a')](_0x3bec7d);return _0x3d2fb2[_0x7b7e('0x20')](_0x7b7e('0x21'),_0x200ef7+'-'+_0x429a0e+'/'+_0x3bf2f0)['json'](_0x51baf6);}return null;};}function patchUpdates(_0x69262b){return function(_0x43db4f){try{jsonpatch[_0x7b7e('0x22')](_0x43db4f,_0x69262b,!![]);}catch(_0x4c0647){return BPromise[_0x7b7e('0x23')](_0x4c0647);}return _0x43db4f[_0x7b7e('0x24')]();};}function saveUpdates(_0x14243b,_0x200156){return function(_0x2b7211){if(_0x2b7211){return _0x2b7211[_0x7b7e('0x25')](_0x14243b)[_0x7b7e('0x26')](function(_0x10a66a){return _0x10a66a;});}return null;};}function removeEntity(_0x53bbb3,_0x5d6215){return function(_0x4a836a){if(_0x4a836a){return _0x4a836a[_0x7b7e('0x27')]()[_0x7b7e('0x26')](function(){_0x53bbb3[_0x7b7e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d3b1,_0x5dadbb){return function(_0x182245){if(!_0x182245){_0x51d3b1[_0x7b7e('0x28')](0x194);}return _0x182245;};}function handleError(_0x16a3c7,_0x7aa71){_0x7aa71=_0x7aa71||0x1f4;return function(_0x3ceaf5){logger['error'](_0x3ceaf5[_0x7b7e('0x29')]);if(_0x3ceaf5[_0x7b7e('0x2a')]){delete _0x3ceaf5['name'];}_0x16a3c7['status'](_0x7aa71)['send'](_0x3ceaf5);};}exports[_0x7b7e('0x2b')]=function(_0x423832,_0x503625){var _0x3db8c4={},_0x51d4b5={},_0x1b4341={'count':0x0,'rows':[]};var _0xb9b6bf=_[_0x7b7e('0x2c')](db['ZendeskAccount'][_0x7b7e('0x2d')],function(_0xe31336){return{'name':_0xe31336[_0x7b7e('0x2e')],'type':_0xe31336[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x51d4b5['model']=_[_0x7b7e('0x2c')](_0xb9b6bf,'name');_0x51d4b5[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x423832[_0x7b7e('0x31')]);_0x51d4b5[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x51d4b5[_0x7b7e('0x35')],_0x51d4b5[_0x7b7e('0x31')]);_0x3db8c4['attributes']=_['intersection'](_0x51d4b5[_0x7b7e('0x35')],qs[_0x7b7e('0x36')](_0x423832['query'][_0x7b7e('0x36')]));_0x3db8c4[_0x7b7e('0x37')]=_0x3db8c4[_0x7b7e('0x37')]['length']?_0x3db8c4[_0x7b7e('0x37')]:_0x51d4b5[_0x7b7e('0x35')];if(!_0x423832[_0x7b7e('0x31')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x3db8c4[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x423832[_0x7b7e('0x31')][_0x7b7e('0x1e')]);_0x3db8c4[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x423832[_0x7b7e('0x31')][_0x7b7e('0x1c')]);}_0x3db8c4[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x423832[_0x7b7e('0x31')]['sort']);_0x3db8c4[_0x7b7e('0x3c')]=qs[_0x7b7e('0x33')](_[_0x7b7e('0x3d')](_0x423832[_0x7b7e('0x31')],_0x51d4b5[_0x7b7e('0x33')]),_0xb9b6bf);if(_0x423832[_0x7b7e('0x31')][_0x7b7e('0x3e')]){_0x3db8c4[_0x7b7e('0x3c')]=_[_0x7b7e('0x3f')](_0x3db8c4[_0x7b7e('0x3c')],{'$or':_['map'](_0xb9b6bf,function(_0x3d6571){if(_0x3d6571[_0x7b7e('0x2f')]!==_0x7b7e('0x40')){var _0x1d43da={};_0x1d43da[_0x3d6571['name']]={'$like':'%'+_0x423832[_0x7b7e('0x31')][_0x7b7e('0x3e')]+'%'};return _0x1d43da;}})});}_0x3db8c4=_[_0x7b7e('0x3f')]({},_0x3db8c4,_0x423832['options']);var _0x4a2888={'where':_0x3db8c4[_0x7b7e('0x3c')]};return db['ZendeskAccount'][_0x7b7e('0x1f')](_0x4a2888)[_0x7b7e('0x26')](function(_0x4de331){_0x1b4341[_0x7b7e('0x1f')]=_0x4de331;if(_0x423832[_0x7b7e('0x31')][_0x7b7e('0x41')]){_0x3db8c4[_0x7b7e('0x42')]=[{'all':!![]}];}return db[_0x7b7e('0x43')][_0x7b7e('0x44')](_0x3db8c4);})[_0x7b7e('0x26')](function(_0x1d9bb9){_0x1b4341[_0x7b7e('0x45')]=_0x1d9bb9;return _0x1b4341;})['then'](respondWithFilteredResult(_0x503625,_0x3db8c4))['catch'](handleError(_0x503625,null));};exports[_0x7b7e('0x46')]=function(_0x550ea6,_0x41c8a6){var _0x5e8b5d={'raw':![],'where':{'id':_0x550ea6[_0x7b7e('0x47')]['id']}},_0x48dd74={};_0x48dd74['model']=_[_0x7b7e('0x32')](db['ZendeskAccount'][_0x7b7e('0x2d')]);_0x48dd74[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x550ea6[_0x7b7e('0x31')]);_0x48dd74['filters']=_[_0x7b7e('0x34')](_0x48dd74[_0x7b7e('0x35')],_0x48dd74[_0x7b7e('0x31')]);_0x5e8b5d[_0x7b7e('0x37')]=_[_0x7b7e('0x34')](_0x48dd74[_0x7b7e('0x35')],qs['fields'](_0x550ea6['query']['fields']));_0x5e8b5d[_0x7b7e('0x37')]=_0x5e8b5d[_0x7b7e('0x37')][_0x7b7e('0x48')]?_0x5e8b5d[_0x7b7e('0x37')]:_0x48dd74[_0x7b7e('0x35')];if(_0x550ea6[_0x7b7e('0x31')]['includeAll']){_0x5e8b5d[_0x7b7e('0x42')]=[{'all':!![]}];}_0x5e8b5d=_[_0x7b7e('0x3f')]({},_0x5e8b5d,_0x550ea6['options']);return db['ZendeskAccount'][_0x7b7e('0x49')](_0x5e8b5d)[_0x7b7e('0x26')](handleEntityNotFound(_0x41c8a6,null))[_0x7b7e('0x26')](respondWithResult(_0x41c8a6,null))[_0x7b7e('0x4a')](handleError(_0x41c8a6,null));};exports[_0x7b7e('0x4b')]=function(_0xb46776,_0x590154){return db[_0x7b7e('0x43')]['create'](_0xb46776[_0x7b7e('0x4c')],{})[_0x7b7e('0x26')](respondWithResult(_0x590154,0xc9))[_0x7b7e('0x4a')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x58e4e6,_0x3b649e){if(_0x58e4e6[_0x7b7e('0x4c')]['id']){delete _0x58e4e6[_0x7b7e('0x4c')]['id'];}return db[_0x7b7e('0x43')][_0x7b7e('0x49')]({'where':{'id':_0x58e4e6['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3b649e,null))[_0x7b7e('0x26')](saveUpdates(_0x58e4e6[_0x7b7e('0x4c')],null))[_0x7b7e('0x26')](respondWithResult(_0x3b649e,null))[_0x7b7e('0x4a')](handleError(_0x3b649e,null));};exports['destroy']=function(_0x1d6d18,_0x29024e){return db[_0x7b7e('0x43')][_0x7b7e('0x49')]({'where':{'id':_0x1d6d18[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x29024e,null))[_0x7b7e('0x26')](removeEntity(_0x29024e,null))['catch'](handleError(_0x29024e,null));};exports[_0x7b7e('0x4d')]=function(_0x5d7c89,_0x16730c,_0x766a54){var _0x570303={};var _0x36f1be={};var _0x44e3a0;var _0x16c81d;return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x5d7c89[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x16730c,null))['then'](function(_0xbf044d){if(_0xbf044d){_0x44e3a0=_0xbf044d;_0x36f1be[_0x7b7e('0x35')]=_[_0x7b7e('0x32')](db[_0x7b7e('0x4f')]['rawAttributes']);_0x36f1be['query']=_['keys'](_0x5d7c89[_0x7b7e('0x31')]);_0x36f1be[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x36f1be['model'],_0x36f1be['query']);_0x570303[_0x7b7e('0x37')]=_[_0x7b7e('0x34')](_0x36f1be['model'],qs[_0x7b7e('0x36')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x36')]));_0x570303['attributes']=_0x570303[_0x7b7e('0x37')][_0x7b7e('0x48')]?_0x570303['attributes']:_0x36f1be[_0x7b7e('0x35')];_0x570303[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3b')]);_0x570303[_0x7b7e('0x3c')]=qs[_0x7b7e('0x33')](_[_0x7b7e('0x3d')](_0x5d7c89[_0x7b7e('0x31')],_0x36f1be['filters']));if(_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3e')]){_0x570303['where']=_[_0x7b7e('0x3f')](_0x570303[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x2c')](_0x570303['attributes'],function(_0x1729e0){var _0x4fc349={};_0x4fc349[_0x1729e0]={'$like':'%'+_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3e')]+'%'};return _0x4fc349;})});}_0x570303=_['merge']({},_0x570303,_0x5d7c89[_0x7b7e('0x50')]);return _0x44e3a0[_0x7b7e('0x4d')](_0x570303);}})['then'](function(_0x2dcb35){if(_0x2dcb35){_0x16c81d=_0x2dcb35[_0x7b7e('0x48')];if(!_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x38')]('nolimit')){_0x570303[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x1e')]);_0x570303[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x1c')]);}return _0x44e3a0[_0x7b7e('0x4d')](_0x570303);}})[_0x7b7e('0x26')](function(_0x5b9010){if(_0x5b9010){return _0x5b9010?{'count':_0x16c81d,'rows':_0x5b9010}:null;}})[_0x7b7e('0x26')](respondWithResult(_0x16730c,null))['catch'](handleError(_0x16730c,null));};exports['addConfiguration']=function(_0x2b105a,_0x7cbe6c,_0x1eb4b1){if(_0x2b105a[_0x7b7e('0x4c')]['id']){delete _0x2b105a['body']['id'];}return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x2b105a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x7cbe6c,null))[_0x7b7e('0x26')](function(_0x2b2afd){if(_0x2b2afd){_0x2b105a['body'][_0x7b7e('0x51')]=_0x2b2afd['id'];_0x2b105a['body']['Subjects']=integrations[_0x7b7e('0x52')](_0x2b105a['body'][_0x7b7e('0x53')],_0x2b105a['body'][_0x7b7e('0x2f')]);_0x2b105a[_0x7b7e('0x4c')]['Descriptions']=integrations[_0x7b7e('0x54')](_0x2b105a[_0x7b7e('0x4c')]['channel'],_0x2b105a[_0x7b7e('0x4c')][_0x7b7e('0x2f')]);return db[_0x7b7e('0x4f')][_0x7b7e('0x4b')](_0x2b105a[_0x7b7e('0x4c')],{'include':[{'model':db[_0x7b7e('0x55')],'as':_0x7b7e('0x56')},{'model':db[_0x7b7e('0x55')],'as':_0x7b7e('0x57')}]});}return null;})[_0x7b7e('0x26')](respondWithResult(_0x7cbe6c,null))['catch'](handleError(_0x7cbe6c,null));};exports['getFields']=function(_0x34e7df,_0x46ac1f,_0x2c6e3a){var _0x348c77='';return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x34e7df[_0x7b7e('0x47')]['id']},'attributes':['id','username',_0x7b7e('0x58'),_0x7b7e('0x59'),'authType',_0x7b7e('0x5a')]})[_0x7b7e('0x26')](handleEntityNotFound(_0x46ac1f,null))[_0x7b7e('0x26')](function(_0x271318){if(_0x271318){_0x348c77=_0x271318[_0x7b7e('0x5a')];var _0x40f65e=_0x348c77[_0x7b7e('0x5b')](-0x1);if(_0x40f65e==='/'){_0x348c77=_0x348c77[_0x7b7e('0x5c')](0x0,_0x348c77[_0x7b7e('0x5d')](_0x40f65e));}var _0x3b6bc6={'method':_0x7b7e('0x5e'),'uri':util['format'](_0x7b7e('0x5f'),_0x348c77,_0x7b7e('0x60')),'json':!![]};switch(_0x271318[_0x7b7e('0x61')]){case _0x7b7e('0x58'):_0x3b6bc6[_0x7b7e('0x62')]={'Authorization':util[_0x7b7e('0x63')](_0x7b7e('0x64'),new Buffer(util['format'](_0x7b7e('0x65'),_0x271318[_0x7b7e('0x66')],_0x271318[_0x7b7e('0x58')]))['toString'](_0x7b7e('0x67')))};break;case _0x7b7e('0x59'):_0x3b6bc6[_0x7b7e('0x62')]={'Authorization':util[_0x7b7e('0x63')](_0x7b7e('0x64'),new Buffer(util['format']('%s/token:%s',_0x271318['username'],_0x271318[_0x7b7e('0x59')]))[_0x7b7e('0x68')](_0x7b7e('0x67')))};break;default:throw new db['Sequelize'][(_0x7b7e('0x69'))](_0x7b7e('0x6a'));}return rp(_0x3b6bc6);}})[_0x7b7e('0x26')](function(_0x5bf4d1){if(_0x5bf4d1){var _0x2983bf=[_0x7b7e('0x6b'),_0x7b7e('0x6c'),_0x7b7e('0x6d'),'assignee'];_[_0x7b7e('0x6e')](_0x5bf4d1[_0x7b7e('0x60')],function(_0xa52b93){return _0x2983bf[_0x7b7e('0x6f')](_0xa52b93['type']);});return{'count':_0x5bf4d1['ticket_fields'][_0x7b7e('0x48')],'rows':_['map'](_0x5bf4d1[_0x7b7e('0x60')],function(_0x4215b5){return{'id':_0x4215b5['id'],'name':_0x4215b5[_0x7b7e('0x70')]>0x7?_0x4215b5[_0x7b7e('0x71')]:_0x4215b5['type'],'custom':_0x4215b5[_0x7b7e('0x70')]>0x7?!![]:![],'options':_0x4215b5[_0x7b7e('0x72')]?_0x4215b5[_0x7b7e('0x72')]:_0x4215b5[_0x7b7e('0x73')]?_0x4215b5[_0x7b7e('0x73')]:[]};})};}})[_0x7b7e('0x26')](respondWithResult(_0x46ac1f,null))[_0x7b7e('0x4a')](function(_0x372478){var _0x44d8c4=_0x34e7df[_0x7b7e('0x31')][_0x7b7e('0x74')]?0x1f4:_0x372478[_0x7b7e('0x75')]||0x1f4;logger[_0x7b7e('0x76')](_0x7b7e('0x77'),_0x7b7e('0x78'),_0x44d8c4,JSON[_0x7b7e('0x79')](_0x372478));delete _0x372478['name'];if(_0x44d8c4===0x191){_0x44d8c4=0x190;}_0x46ac1f[_0x7b7e('0x1a')](_0x44d8c4)[_0x7b7e('0x7a')](_0x34e7df[_0x7b7e('0x31')][_0x7b7e('0x74')]?{'message':_0x7b7e('0x7b'),'statusCode':_0x372478[_0x7b7e('0x75')]}:_0x372478);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index fb14b1e..d705a77 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 _0x81d8=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x3be8ac,_0x10454a){var _0x227ca1=function(_0x471067){while(--_0x471067){_0x3be8ac['push'](_0x3be8ac['shift']());}};_0x227ca1(++_0x10454a);}(_0x81d8,0x11e));var _0x881d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x81d8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x881d('0x0'));var logger=require('../../config/logger')(_0x881d('0x1'));var moment=require(_0x881d('0x2'));var BPromise=require(_0x881d('0x3'));var rp=require(_0x881d('0x4'));var fs=require('fs');var path=require(_0x881d('0x5'));var rimraf=require(_0x881d('0x6'));var config=require(_0x881d('0x7'));var attributes=require(_0x881d('0x8'));var integrations=require(_0x881d('0x9'));module[_0x881d('0xa')]=function(_0x512e56,_0x58a2d8){return _0x512e56[_0x881d('0xb')](_0x881d('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7689=['bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','int_zendesk_accounts','api','moment'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7689,0x134));var _0x9768=function(_0x8bee0a,_0x44367b){_0x8bee0a=_0x8bee0a-0x0;var _0x3252a2=_0x7689[_0x8bee0a];return _0x3252a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9768('0x0'));var moment=require(_0x9768('0x1'));var BPromise=require(_0x9768('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9768('0x3'));var rimraf=require(_0x9768('0x4'));var config=require(_0x9768('0x5'));var attributes=require(_0x9768('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x9768('0x7')]=function(_0x51e0c7,_0x36888c){return _0x51e0c7[_0x9768('0x8')]('ZendeskAccount',attributes,{'tableName':_0x9768('0x9'),'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 3219cc9..34916b0 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 _0x8a5c=['client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','stringify','ShowZendeskAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x564f04,_0x29ddcf){var _0x3753e7=function(_0x1efb32){while(--_0x1efb32){_0x564f04['push'](_0x564f04['shift']());}};_0x3753e7(++_0x29ddcf);}(_0x8a5c,0x82));var _0xc8a5=function(_0x12b4de,_0xac4ca9){_0x12b4de=_0x12b4de-0x0;var _0x3e21d1=_0x8a5c[_0x12b4de];return _0x3e21d1;};'use strict';var _=require('lodash');var util=require(_0xc8a5('0x0'));var moment=require(_0xc8a5('0x1'));var BPromise=require(_0xc8a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8a5('0x3'));var db=require(_0xc8a5('0x4'))['db'];var utils=require(_0xc8a5('0x5'));var logger=require(_0xc8a5('0x6'))(_0xc8a5('0x7'));var config=require(_0xc8a5('0x8'));var jayson=require(_0xc8a5('0x9'));var client=jayson[_0xc8a5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e719,_0x456e59,_0x193374){return new BPromise(function(_0x190636,_0x1f92cb){return client[_0xc8a5('0xb')](_0x44e719,_0x193374)[_0xc8a5('0xc')](function(_0x4079c0){logger[_0xc8a5('0xd')](_0xc8a5('0xe'),_0x456e59,_0xc8a5('0xf'));logger[_0xc8a5('0x10')](_0xc8a5('0x11'),_0x456e59,'request\x20sent',JSON['stringify'](_0x4079c0));if(_0x4079c0[_0xc8a5('0x12')]){if(_0x4079c0[_0xc8a5('0x12')][_0xc8a5('0x13')]===0x1f4){logger[_0xc8a5('0x12')](_0xc8a5('0xe'),_0x456e59,_0x4079c0[_0xc8a5('0x12')][_0xc8a5('0x14')]);return _0x1f92cb(_0x4079c0['error'][_0xc8a5('0x14')]);}logger[_0xc8a5('0x12')](_0xc8a5('0xe'),_0x456e59,_0x4079c0[_0xc8a5('0x12')][_0xc8a5('0x14')]);return _0x190636(_0x4079c0['error']['message']);}else{logger[_0xc8a5('0xd')](_0xc8a5('0xe'),_0x456e59,_0xc8a5('0xf'));_0x190636(_0x4079c0[_0xc8a5('0x15')]['message']);}})[_0xc8a5('0x16')](function(_0x431bbf){logger[_0xc8a5('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x456e59,_0x431bbf);_0x1f92cb(_0x431bbf);});});}exports[_0xc8a5('0x17')]=function(_0x32c47a){var _0x5d1809=this;return new Promise(function(_0x4a7fed,_0x4ed446){return db[_0xc8a5('0x18')][_0xc8a5('0x19')]({'raw':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1c')]||null:null,'attributes':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1d')]||null:null,'limit':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a['options']['limit']||null:null,'include':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x32c47a['options']['include'],function(_0x1ab936){return{'model':db[_0x1ab936[_0xc8a5('0x20')]],'as':_0x1ab936['as'],'attributes':_0x1ab936[_0xc8a5('0x1d')],'include':_0x1ab936[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x1ab936[_0xc8a5('0x1e')],function(_0xbb30fb){return{'model':db[_0xbb30fb[_0xc8a5('0x20')]],'as':_0xbb30fb['as'],'attributes':_0xbb30fb[_0xc8a5('0x1d')],'include':_0xbb30fb[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0xbb30fb['include'],function(_0x3f882a){return{'model':db[_0x3f882a[_0xc8a5('0x20')]],'as':_0x3f882a['as'],'attributes':_0x3f882a[_0xc8a5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc8a5('0xc')](function(_0x30c8c7){logger[_0xc8a5('0xd')]('GetZendeskAccount',_0x32c47a);logger['debug'](_0xc8a5('0x17'),_0x32c47a,JSON[_0xc8a5('0x21')](_0x30c8c7));_0x4a7fed(_0x30c8c7);})[_0xc8a5('0x16')](function(_0x555528){logger['error'](_0xc8a5('0x17'),_0x555528['message'],_0x32c47a);_0x4ed446(_0x5d1809[_0xc8a5('0x12')](0x1f4,_0x555528['message']));});});};exports[_0xc8a5('0x22')]=function(_0x2dddfb){var _0x37a0e7=this;return new Promise(function(_0x6a14b,_0x28ca0d){return db[_0xc8a5('0x18')]['find']({'raw':_0x2dddfb[_0xc8a5('0x1a')]?_0x2dddfb[_0xc8a5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2dddfb['options']?_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1c')]||null:null,'attributes':_0x2dddfb['options']?_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1d')]||null:null,'include':_0x2dddfb[_0xc8a5('0x1a')]?_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1e')],function(_0x1b1095){return{'model':db[_0x1b1095[_0xc8a5('0x20')]],'as':_0x1b1095['as'],'attributes':_0x1b1095['attributes'],'include':_0x1b1095[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x1b1095[_0xc8a5('0x1e')],function(_0x3ec6fa){return{'model':db[_0x3ec6fa[_0xc8a5('0x20')]],'as':_0x3ec6fa['as'],'attributes':_0x3ec6fa[_0xc8a5('0x1d')],'include':_0x3ec6fa[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x3ec6fa[_0xc8a5('0x1e')],function(_0x594436){return{'model':db[_0x594436['model']],'as':_0x594436['as'],'attributes':_0x594436[_0xc8a5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52700e){logger[_0xc8a5('0xd')]('ShowZendeskAccount',_0x2dddfb);logger[_0xc8a5('0x10')](_0xc8a5('0x22'),_0x2dddfb,JSON['stringify'](_0x52700e));_0x6a14b(_0x52700e);})[_0xc8a5('0x16')](function(_0x99c008){logger[_0xc8a5('0x12')](_0xc8a5('0x22'),_0x99c008[_0xc8a5('0x14')],_0x2dddfb);_0x28ca0d(_0x37a0e7[_0xc8a5('0x12')](0x1f4,_0x99c008[_0xc8a5('0x14')]));});});}; \ No newline at end of file +var _0x9c0b=['request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','limit','include','model','map','attributes','ShowZendeskAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1fefe3,_0x1145e8){var _0x29dfab=function(_0x2a04ee){while(--_0x2a04ee){_0x1fefe3['push'](_0x1fefe3['shift']());}};_0x29dfab(++_0x1145e8);}(_0x9c0b,0xc8));var _0xb9c0=function(_0x2aa6cf,_0x46b0b4){_0x2aa6cf=_0x2aa6cf-0x0;var _0x489483=_0x9c0b[_0x2aa6cf];return _0x489483;};'use strict';var _=require(_0xb9c0('0x0'));var util=require(_0xb9c0('0x1'));var moment=require('moment');var BPromise=require(_0xb9c0('0x2'));var rs=require(_0xb9c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9c0('0x5'))(_0xb9c0('0x6'));var config=require(_0xb9c0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9c0('0x8')][_0xb9c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c3272,_0x4556dc,_0x334a10){return new BPromise(function(_0x2c6ce5,_0x4bcbf7){return client[_0xb9c0('0xa')](_0x2c3272,_0x334a10)[_0xb9c0('0xb')](function(_0x3e8b88){logger[_0xb9c0('0xc')](_0xb9c0('0xd'),_0x4556dc,_0xb9c0('0xe'));logger[_0xb9c0('0xf')](_0xb9c0('0x10'),_0x4556dc,_0xb9c0('0xe'),JSON[_0xb9c0('0x11')](_0x3e8b88));if(_0x3e8b88[_0xb9c0('0x12')]){if(_0x3e8b88[_0xb9c0('0x12')][_0xb9c0('0x13')]===0x1f4){logger[_0xb9c0('0x12')](_0xb9c0('0xd'),_0x4556dc,_0x3e8b88['error'][_0xb9c0('0x14')]);return _0x4bcbf7(_0x3e8b88[_0xb9c0('0x12')][_0xb9c0('0x14')]);}logger[_0xb9c0('0x12')](_0xb9c0('0xd'),_0x4556dc,_0x3e8b88['error'][_0xb9c0('0x14')]);return _0x2c6ce5(_0x3e8b88[_0xb9c0('0x12')][_0xb9c0('0x14')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x4556dc,_0xb9c0('0xe'));_0x2c6ce5(_0x3e8b88[_0xb9c0('0x15')][_0xb9c0('0x14')]);}})[_0xb9c0('0x16')](function(_0x47a7c2){logger[_0xb9c0('0x12')](_0xb9c0('0xd'),_0x4556dc,_0x47a7c2);_0x4bcbf7(_0x47a7c2);});});}exports[_0xb9c0('0x17')]=function(_0x2fd9ad){var _0x2bb45b=this;return new Promise(function(_0x656e52,_0x3b33cf){return db[_0xb9c0('0x18')]['findAll']({'raw':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad['options'][_0xb9c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad[_0xb9c0('0x19')][_0xb9c0('0x1b')]||null:null,'attributes':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad[_0xb9c0('0x19')]['attributes']||null:null,'limit':_0x2fd9ad['options']?_0x2fd9ad[_0xb9c0('0x19')][_0xb9c0('0x1c')]||null:null,'include':_0x2fd9ad[_0xb9c0('0x19')]?_0x2fd9ad['options'][_0xb9c0('0x1d')]?_['map'](_0x2fd9ad['options'][_0xb9c0('0x1d')],function(_0xc26998){return{'model':db[_0xc26998[_0xb9c0('0x1e')]],'as':_0xc26998['as'],'attributes':_0xc26998['attributes'],'include':_0xc26998[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0xc26998[_0xb9c0('0x1d')],function(_0xf786ab){return{'model':db[_0xf786ab['model']],'as':_0xf786ab['as'],'attributes':_0xf786ab[_0xb9c0('0x20')],'include':_0xf786ab[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0xf786ab[_0xb9c0('0x1d')],function(_0x14f32c){return{'model':db[_0x14f32c[_0xb9c0('0x1e')]],'as':_0x14f32c['as'],'attributes':_0x14f32c[_0xb9c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb9c0('0xb')](function(_0x2aa5eb){logger[_0xb9c0('0xc')](_0xb9c0('0x17'),_0x2fd9ad);logger[_0xb9c0('0xf')]('GetZendeskAccount',_0x2fd9ad,JSON['stringify'](_0x2aa5eb));_0x656e52(_0x2aa5eb);})[_0xb9c0('0x16')](function(_0x4fc718){logger['error'](_0xb9c0('0x17'),_0x4fc718[_0xb9c0('0x14')],_0x2fd9ad);_0x3b33cf(_0x2bb45b['error'](0x1f4,_0x4fc718['message']));});});};exports[_0xb9c0('0x21')]=function(_0xd1a6cf){var _0x1f8116=this;return new Promise(function(_0x35fc26,_0x45ad75){return db['ZendeskAccount'][_0xb9c0('0x22')]({'raw':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x1b')]||null:null,'attributes':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x20')]||null:null,'include':_0xd1a6cf[_0xb9c0('0x19')]?_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x1d')]?_['map'](_0xd1a6cf[_0xb9c0('0x19')][_0xb9c0('0x1d')],function(_0x4a7a2c){return{'model':db[_0x4a7a2c[_0xb9c0('0x1e')]],'as':_0x4a7a2c['as'],'attributes':_0x4a7a2c[_0xb9c0('0x20')],'include':_0x4a7a2c[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0x4a7a2c['include'],function(_0x27cd64){return{'model':db[_0x27cd64[_0xb9c0('0x1e')]],'as':_0x27cd64['as'],'attributes':_0x27cd64[_0xb9c0('0x20')],'include':_0x27cd64[_0xb9c0('0x1d')]?_[_0xb9c0('0x1f')](_0x27cd64[_0xb9c0('0x1d')],function(_0x15f52a){return{'model':db[_0x15f52a[_0xb9c0('0x1e')]],'as':_0x15f52a['as'],'attributes':_0x15f52a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9c0('0xb')](function(_0x266271){logger['info'](_0xb9c0('0x21'),_0xd1a6cf);logger[_0xb9c0('0xf')]('ShowZendeskAccount',_0xd1a6cf,JSON[_0xb9c0('0x11')](_0x266271));_0x35fc26(_0x266271);})[_0xb9c0('0x16')](function(_0x19a344){logger[_0xb9c0('0x12')](_0xb9c0('0x21'),_0x19a344['message'],_0xd1a6cf);_0x45ad75(_0x1f8116['error'](0x1f4,_0x19a344[_0xb9c0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index aa9e915..24eef05 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x5b836a,_0x5cefae){var _0x42c01c=function(_0x5b8b31){while(--_0x5b8b31){_0x5b836a['push'](_0x5b836a['shift']());}};_0x42c01c(++_0x5cefae);}(_0xa571,0x107));var _0x1a57=function(_0x17f285,_0x2d5c87){_0x17f285=_0x17f285-0x0;var _0x402d9c=_0xa571[_0x17f285];return _0x402d9c;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0x153f=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x223b08,_0x2e24f4){var _0x3dc3fc=function(_0x3b326a){while(--_0x3b326a){_0x223b08['push'](_0x223b08['shift']());}};_0x3dc3fc(++_0x2e24f4);}(_0x153f,0x15b));var _0xf153=function(_0x323344,_0x15786a){_0x323344=_0x323344-0x0;var _0x6b99c1=_0x153f[_0x323344];return _0x6b99c1;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['get'](_0xf153('0x11'),auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router['get'](_0xf153('0x13'),auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);router[_0xf153('0x15')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x16')]);router[_0xf153('0x15')](_0xf153('0x13'),auth[_0xf153('0xa')](),controller['setTags']);router[_0xf153('0x17')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b16da00..c19bdc0 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 _0x0bf1=['STRING','exports'];(function(_0x23b7e4,_0x1c9417){var _0x40d91b=function(_0x398d53){while(--_0x398d53){_0x23b7e4['push'](_0x23b7e4['shift']());}};_0x40d91b(++_0x1c9417);}(_0x0bf1,0x10b));var _0x10bf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0bf1[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x10bf('0x0')]={'name':{'type':Sequelize[_0x10bf('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecbd=['exports','STRING','sequelize'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xecbd,0x185));var _0xdecb=function(_0x58b119,_0x123acb){_0x58b119=_0x58b119-0x0;var _0x1be5f9=_0xecbd[_0x58b119];return _0x1be5f9;};'use strict';var Sequelize=require(_0xdecb('0x0'));module[_0xdecb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdecb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 21cac6f..b7a3d09 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 _0x7a30=['json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','ZendeskConfiguration','rawAttributes','length','options','create','body','find','findOne','ZendeskField','sort','pick','nolimit','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','moment','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/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end'];(function(_0x50edfa,_0x589b10){var _0x27d98a=function(_0x1f2280){while(--_0x1f2280){_0x50edfa['push'](_0x50edfa['shift']());}};_0x27d98a(++_0x589b10);}(_0x7a30,0x8e));var _0x07a3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a30[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x07a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x07a3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x07a3('0x3'));var util=require(_0x07a3('0x4'));var path=require(_0x07a3('0x5'));var sox=require(_0x07a3('0x6'));var csv=require(_0x07a3('0x7'));var ejs=require(_0x07a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x07a3('0x9'));var squel=require(_0x07a3('0xa'));var crypto=require(_0x07a3('0xb'));var jsforce=require(_0x07a3('0xc'));var deskjs=require(_0x07a3('0xd'));var toCsv=require(_0x07a3('0x7'));var querystring=require(_0x07a3('0xe'));var Papa=require(_0x07a3('0xf'));var Redis=require(_0x07a3('0x10'));var authService=require(_0x07a3('0x11'));var qs=require(_0x07a3('0x12'));var as=require(_0x07a3('0x13'));var hardwareService=require(_0x07a3('0x14'));var logger=require(_0x07a3('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x07a3('0x16'))['db'];function respondWithStatusCode(_0x366cef,_0xb3e610){_0xb3e610=_0xb3e610||0xcc;return function(_0x35d4ec){if(_0x35d4ec){return _0x366cef[_0x07a3('0x17')](_0xb3e610);}return _0x366cef[_0x07a3('0x18')](_0xb3e610)[_0x07a3('0x19')]();};}function respondWithResult(_0x9b8ab0,_0x17e72c){_0x17e72c=_0x17e72c||0xc8;return function(_0x4b12ec){if(_0x4b12ec){return _0x9b8ab0[_0x07a3('0x18')](_0x17e72c)[_0x07a3('0x1a')](_0x4b12ec);}};}function respondWithFilteredResult(_0x3f09f0,_0xef8c23){return function(_0x2b7143){if(_0x2b7143){var _0x2fa440=typeof _0xef8c23[_0x07a3('0x1b')]===_0x07a3('0x1c')&&typeof _0xef8c23[_0x07a3('0x1d')]==='undefined';var _0x5eaae8=_0x2b7143['count'];var _0x3bb0e3=_0x2fa440?0x0:_0xef8c23['offset'];var _0x3a075d=_0x2fa440?_0x2b7143['count']:_0xef8c23['offset']+_0xef8c23[_0x07a3('0x1d')];var _0x1e3f72;if(_0x3a075d>=_0x5eaae8){_0x3a075d=_0x5eaae8;_0x1e3f72=0xc8;}else{_0x1e3f72=0xce;}_0x3f09f0[_0x07a3('0x18')](_0x1e3f72);return _0x3f09f0[_0x07a3('0x1e')](_0x07a3('0x1f'),_0x3bb0e3+'-'+_0x3a075d+'/'+_0x5eaae8)[_0x07a3('0x1a')](_0x2b7143);}return null;};}function patchUpdates(_0x412460){return function(_0x405061){try{jsonpatch[_0x07a3('0x20')](_0x405061,_0x412460,!![]);}catch(_0x4f3472){return BPromise[_0x07a3('0x21')](_0x4f3472);}return _0x405061[_0x07a3('0x22')]();};}function saveUpdates(_0x266a39,_0x2b5f24){return function(_0x5544a1){if(_0x5544a1){return _0x5544a1[_0x07a3('0x23')](_0x266a39)[_0x07a3('0x24')](function(_0x58a618){return _0x58a618;});}return null;};}function removeEntity(_0x3f8c16,_0x35a75f){return function(_0x5e64a1){if(_0x5e64a1){return _0x5e64a1[_0x07a3('0x25')]()[_0x07a3('0x24')](function(){_0x3f8c16['status'](0xcc)[_0x07a3('0x19')]();});}};}function handleEntityNotFound(_0x5ac2c8,_0x5375bd){return function(_0x2aab21){if(!_0x2aab21){_0x5ac2c8[_0x07a3('0x17')](0x194);}return _0x2aab21;};}function handleError(_0x79d1a0,_0x3212e0){_0x3212e0=_0x3212e0||0x1f4;return function(_0x19b639){logger[_0x07a3('0x26')](_0x19b639[_0x07a3('0x27')]);if(_0x19b639[_0x07a3('0x28')]){delete _0x19b639[_0x07a3('0x28')];}_0x79d1a0[_0x07a3('0x18')](_0x3212e0)[_0x07a3('0x29')](_0x19b639);};}exports['index']=function(_0x1d1972,_0x437175){var _0x22380d={},_0x2bc058={},_0x2c7732={'count':0x0,'rows':[]};var _0x301a28=_[_0x07a3('0x2a')](db['ZendeskConfiguration']['rawAttributes'],function(_0x2b4218){return{'name':_0x2b4218[_0x07a3('0x2b')],'type':_0x2b4218[_0x07a3('0x2c')]['key']};});_0x2bc058[_0x07a3('0x2d')]=_[_0x07a3('0x2a')](_0x301a28,_0x07a3('0x28'));_0x2bc058[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x1d1972['query']);_0x2bc058[_0x07a3('0x30')]=_[_0x07a3('0x31')](_0x2bc058['model'],_0x2bc058[_0x07a3('0x2e')]);_0x22380d['attributes']=_[_0x07a3('0x31')](_0x2bc058['model'],qs[_0x07a3('0x32')](_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x22380d[_0x07a3('0x33')]=_0x22380d[_0x07a3('0x33')]['length']?_0x22380d[_0x07a3('0x33')]:_0x2bc058[_0x07a3('0x2d')];if(!_0x1d1972['query'][_0x07a3('0x34')]('nolimit')){_0x22380d['limit']=qs[_0x07a3('0x1d')](_0x1d1972['query'][_0x07a3('0x1d')]);_0x22380d[_0x07a3('0x1b')]=qs[_0x07a3('0x1b')](_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x1b')]);}_0x22380d[_0x07a3('0x35')]=qs['sort'](_0x1d1972[_0x07a3('0x2e')]['sort']);_0x22380d[_0x07a3('0x36')]=qs[_0x07a3('0x30')](_['pick'](_0x1d1972['query'],_0x2bc058['filters']),_0x301a28);if(_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x22380d['where']=_[_0x07a3('0x38')](_0x22380d[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x301a28,function(_0x1e2dff){if(_0x1e2dff[_0x07a3('0x2c')]!==_0x07a3('0x39')){var _0x525acf={};_0x525acf[_0x1e2dff[_0x07a3('0x28')]]={'$like':'%'+_0x1d1972['query'][_0x07a3('0x37')]+'%'};return _0x525acf;}})});}_0x22380d=_[_0x07a3('0x38')]({},_0x22380d,_0x1d1972['options']);var _0x140498={'where':_0x22380d['where']};return db['ZendeskConfiguration'][_0x07a3('0x3a')](_0x140498)[_0x07a3('0x24')](function(_0xd54229){_0x2c7732[_0x07a3('0x3a')]=_0xd54229;if(_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x3b')]){_0x22380d[_0x07a3('0x3c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x07a3('0x3d')](_0x22380d);})['then'](function(_0x15d476){_0x2c7732[_0x07a3('0x3e')]=_0x15d476;return _0x2c7732;})[_0x07a3('0x24')](respondWithFilteredResult(_0x437175,_0x22380d))[_0x07a3('0x3f')](handleError(_0x437175,null));};exports['show']=function(_0x5a4fe3,_0x207ef9){var _0x331de8={'raw':![],'where':{'id':_0x5a4fe3[_0x07a3('0x40')]['id']}},_0x5e8b36={};_0x5e8b36['model']=_[_0x07a3('0x2f')](db[_0x07a3('0x41')][_0x07a3('0x42')]);_0x5e8b36['query']=_[_0x07a3('0x2f')](_0x5a4fe3[_0x07a3('0x2e')]);_0x5e8b36[_0x07a3('0x30')]=_['intersection'](_0x5e8b36['model'],_0x5e8b36['query']);_0x331de8[_0x07a3('0x33')]=_[_0x07a3('0x31')](_0x5e8b36[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x5a4fe3[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x331de8[_0x07a3('0x33')]=_0x331de8[_0x07a3('0x33')][_0x07a3('0x43')]?_0x331de8[_0x07a3('0x33')]:_0x5e8b36[_0x07a3('0x2d')];if(_0x5a4fe3[_0x07a3('0x2e')]['includeAll']){_0x331de8[_0x07a3('0x3c')]=[{'all':!![]}];}_0x331de8=_[_0x07a3('0x38')]({},_0x331de8,_0x5a4fe3[_0x07a3('0x44')]);return db[_0x07a3('0x41')]['find'](_0x331de8)[_0x07a3('0x24')](handleEntityNotFound(_0x207ef9,null))[_0x07a3('0x24')](respondWithResult(_0x207ef9,null))['catch'](handleError(_0x207ef9,null));};exports[_0x07a3('0x45')]=function(_0x2bd08d,_0x354e3b){return db[_0x07a3('0x41')][_0x07a3('0x45')](_0x2bd08d[_0x07a3('0x46')],{})[_0x07a3('0x24')](respondWithResult(_0x354e3b,0xc9))[_0x07a3('0x3f')](handleError(_0x354e3b,null));};exports[_0x07a3('0x23')]=function(_0x12ff70,_0x16dd38){if(_0x12ff70[_0x07a3('0x46')]['id']){delete _0x12ff70[_0x07a3('0x46')]['id'];}return db[_0x07a3('0x41')][_0x07a3('0x47')]({'where':{'id':_0x12ff70[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x16dd38,null))[_0x07a3('0x24')](saveUpdates(_0x12ff70[_0x07a3('0x46')],null))['then'](respondWithResult(_0x16dd38,null))[_0x07a3('0x3f')](handleError(_0x16dd38,null));};exports[_0x07a3('0x25')]=function(_0xb861e,_0x191f7a){return db[_0x07a3('0x41')]['find']({'where':{'id':_0xb861e[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x191f7a,null))[_0x07a3('0x24')](removeEntity(_0x191f7a,null))[_0x07a3('0x3f')](handleError(_0x191f7a,null));};exports['getFields']=function(_0x3cd7ef,_0x268ac0,_0x247b04){var _0x57702a={};var _0x4eb0bb={};var _0x122306;var _0x551ac5;return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x3cd7ef[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x268ac0,null))[_0x07a3('0x24')](function(_0xb1e449){if(_0xb1e449){_0x122306=_0xb1e449;_0x4eb0bb[_0x07a3('0x2d')]=_[_0x07a3('0x2f')](db[_0x07a3('0x49')][_0x07a3('0x42')]);_0x4eb0bb['query']=_[_0x07a3('0x2f')](_0x3cd7ef[_0x07a3('0x2e')]);_0x4eb0bb['filters']=_[_0x07a3('0x31')](_0x4eb0bb['model'],_0x4eb0bb[_0x07a3('0x2e')]);_0x57702a[_0x07a3('0x33')]=_[_0x07a3('0x31')](_0x4eb0bb[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x3cd7ef[_0x07a3('0x2e')]['fields']));_0x57702a['attributes']=_0x57702a[_0x07a3('0x33')][_0x07a3('0x43')]?_0x57702a[_0x07a3('0x33')]:_0x4eb0bb[_0x07a3('0x2d')];_0x57702a[_0x07a3('0x35')]=qs[_0x07a3('0x4a')](_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x4a')]);_0x57702a[_0x07a3('0x36')]=qs['filters'](_[_0x07a3('0x4b')](_0x3cd7ef[_0x07a3('0x2e')],_0x4eb0bb['filters']));if(_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x57702a['where']=_['merge'](_0x57702a[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x57702a[_0x07a3('0x33')],function(_0x109b57){var _0x166427={};_0x166427[_0x109b57]={'$like':'%'+_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x37')]+'%'};return _0x166427;})});}_0x57702a=_[_0x07a3('0x38')]({},_0x57702a,_0x3cd7ef[_0x07a3('0x44')]);return _0x122306['getFields'](_0x57702a);}})[_0x07a3('0x24')](function(_0x524f16){if(_0x524f16){_0x551ac5=_0x524f16['length'];if(!_0x3cd7ef[_0x07a3('0x2e')]['hasOwnProperty'](_0x07a3('0x4c'))){_0x57702a['limit']=qs['limit'](_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x1d')]);_0x57702a[_0x07a3('0x1b')]=qs[_0x07a3('0x1b')](_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x1b')]);}return _0x122306[_0x07a3('0x4d')](_0x57702a);}})[_0x07a3('0x24')](function(_0x5d6056){if(_0x5d6056){return _0x5d6056?{'count':_0x551ac5,'rows':_0x5d6056}:null;}})[_0x07a3('0x24')](respondWithResult(_0x268ac0,null))[_0x07a3('0x3f')](handleError(_0x268ac0,null));};exports[_0x07a3('0x4e')]=function(_0x27197f,_0x26d597,_0x248f1e){var _0x21f917={};var _0x2e505a={};var _0x4cf4f4;var _0x41c7b5;return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x27197f[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x26d597,null))[_0x07a3('0x24')](function(_0x4eced4){if(_0x4eced4){_0x4cf4f4=_0x4eced4;_0x2e505a[_0x07a3('0x2d')]=_['keys'](db[_0x07a3('0x49')]['rawAttributes']);_0x2e505a[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x27197f[_0x07a3('0x2e')]);_0x2e505a[_0x07a3('0x30')]=_[_0x07a3('0x31')](_0x2e505a[_0x07a3('0x2d')],_0x2e505a[_0x07a3('0x2e')]);_0x21f917['attributes']=_[_0x07a3('0x31')](_0x2e505a[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x27197f[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x21f917['attributes']=_0x21f917[_0x07a3('0x33')][_0x07a3('0x43')]?_0x21f917[_0x07a3('0x33')]:_0x2e505a[_0x07a3('0x2d')];_0x21f917['order']=qs[_0x07a3('0x4a')](_0x27197f[_0x07a3('0x2e')][_0x07a3('0x4a')]);_0x21f917[_0x07a3('0x36')]=qs['filters'](_[_0x07a3('0x4b')](_0x27197f['query'],_0x2e505a['filters']));if(_0x27197f['query'][_0x07a3('0x37')]){_0x21f917[_0x07a3('0x36')]=_[_0x07a3('0x38')](_0x21f917[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x21f917[_0x07a3('0x33')],function(_0x4d4e96){var _0xaa20cc={};_0xaa20cc[_0x4d4e96]={'$like':'%'+_0x27197f[_0x07a3('0x2e')][_0x07a3('0x37')]+'%'};return _0xaa20cc;})});}_0x21f917=_[_0x07a3('0x38')]({},_0x21f917,_0x27197f['options']);return _0x4cf4f4['getSubjects'](_0x21f917);}})[_0x07a3('0x24')](function(_0x4751cf){if(_0x4751cf){_0x41c7b5=_0x4751cf[_0x07a3('0x43')];if(!_0x27197f[_0x07a3('0x2e')][_0x07a3('0x34')]('nolimit')){_0x21f917[_0x07a3('0x1d')]=qs[_0x07a3('0x1d')](_0x27197f[_0x07a3('0x2e')][_0x07a3('0x1d')]);_0x21f917[_0x07a3('0x1b')]=qs['offset'](_0x27197f[_0x07a3('0x2e')]['offset']);}return _0x4cf4f4[_0x07a3('0x4e')](_0x21f917);}})[_0x07a3('0x24')](function(_0x4629d4){if(_0x4629d4){return _0x4629d4?{'count':_0x41c7b5,'rows':_0x4629d4}:null;}})[_0x07a3('0x24')](respondWithResult(_0x26d597,null))[_0x07a3('0x3f')](handleError(_0x26d597,null));};exports[_0x07a3('0x4f')]=function(_0x2b935a,_0x419fe6,_0x14f8bb){var _0x1f6cb0={};var _0x3a41c1={};var _0x244345;var _0x32eba9;return db['ZendeskConfiguration'][_0x07a3('0x48')]({'where':{'id':_0x2b935a[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x419fe6,null))[_0x07a3('0x24')](function(_0x2d7a33){if(_0x2d7a33){_0x244345=_0x2d7a33;_0x3a41c1[_0x07a3('0x2d')]=_[_0x07a3('0x2f')](db[_0x07a3('0x49')][_0x07a3('0x42')]);_0x3a41c1[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x2b935a['query']);_0x3a41c1[_0x07a3('0x30')]=_['intersection'](_0x3a41c1[_0x07a3('0x2d')],_0x3a41c1['query']);_0x1f6cb0[_0x07a3('0x33')]=_[_0x07a3('0x31')](_0x3a41c1['model'],qs[_0x07a3('0x32')](_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x1f6cb0[_0x07a3('0x33')]=_0x1f6cb0[_0x07a3('0x33')][_0x07a3('0x43')]?_0x1f6cb0[_0x07a3('0x33')]:_0x3a41c1['model'];_0x1f6cb0['order']=qs[_0x07a3('0x4a')](_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x4a')]);_0x1f6cb0['where']=qs[_0x07a3('0x30')](_['pick'](_0x2b935a[_0x07a3('0x2e')],_0x3a41c1[_0x07a3('0x30')]));if(_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x1f6cb0[_0x07a3('0x36')]=_[_0x07a3('0x38')](_0x1f6cb0['where'],{'$or':_['map'](_0x1f6cb0[_0x07a3('0x33')],function(_0x1b3111){var _0x23092e={};_0x23092e[_0x1b3111]={'$like':'%'+_0x2b935a['query'][_0x07a3('0x37')]+'%'};return _0x23092e;})});}_0x1f6cb0=_[_0x07a3('0x38')]({},_0x1f6cb0,_0x2b935a['options']);return _0x244345[_0x07a3('0x4f')](_0x1f6cb0);}})[_0x07a3('0x24')](function(_0x16c674){if(_0x16c674){_0x32eba9=_0x16c674[_0x07a3('0x43')];if(!_0x2b935a[_0x07a3('0x2e')]['hasOwnProperty'](_0x07a3('0x4c'))){_0x1f6cb0[_0x07a3('0x1d')]=qs['limit'](_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x1d')]);_0x1f6cb0[_0x07a3('0x1b')]=qs[_0x07a3('0x1b')](_0x2b935a['query'][_0x07a3('0x1b')]);}return _0x244345[_0x07a3('0x4f')](_0x1f6cb0);}})[_0x07a3('0x24')](function(_0x53f97b){if(_0x53f97b){return _0x53f97b?{'count':_0x32eba9,'rows':_0x53f97b}:null;}})[_0x07a3('0x24')](respondWithResult(_0x419fe6,null))['catch'](handleError(_0x419fe6,null));};exports['getTags']=function(_0x3196c6,_0x4210f1,_0x5b9f78){var _0x1347d8={};var _0x47f6a7={};var _0x2cc7c5;var _0x20a90f;return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x3196c6[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x4210f1,null))[_0x07a3('0x24')](function(_0x123948){if(_0x123948){_0x2cc7c5=_0x123948;_0x47f6a7['model']=_[_0x07a3('0x2f')](db[_0x07a3('0x50')][_0x07a3('0x42')]);_0x47f6a7[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x3196c6[_0x07a3('0x2e')]);_0x47f6a7['filters']=_[_0x07a3('0x31')](_0x47f6a7[_0x07a3('0x2d')],_0x47f6a7['query']);_0x1347d8['attributes']=_[_0x07a3('0x31')](_0x47f6a7[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x3196c6[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x1347d8['attributes']=_0x1347d8[_0x07a3('0x33')][_0x07a3('0x43')]?_0x1347d8['attributes']:_0x47f6a7[_0x07a3('0x2d')];_0x1347d8['order']=qs['sort'](_0x3196c6['query'][_0x07a3('0x4a')]);_0x1347d8[_0x07a3('0x36')]=qs['filters'](_[_0x07a3('0x4b')](_0x3196c6[_0x07a3('0x2e')],_0x47f6a7[_0x07a3('0x30')]));if(_0x3196c6[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x1347d8[_0x07a3('0x36')]=_[_0x07a3('0x38')](_0x1347d8[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x1347d8[_0x07a3('0x33')],function(_0x32c965){var _0x42339f={};_0x42339f[_0x32c965]={'$like':'%'+_0x3196c6['query'][_0x07a3('0x37')]+'%'};return _0x42339f;})});}_0x1347d8=_['merge']({},_0x1347d8,_0x3196c6[_0x07a3('0x44')]);return _0x2cc7c5['getTags'](_0x1347d8);}})[_0x07a3('0x24')](function(_0x73ea26){if(_0x73ea26){_0x20a90f=_0x73ea26[_0x07a3('0x43')];if(!_0x3196c6[_0x07a3('0x2e')]['hasOwnProperty'](_0x07a3('0x4c'))){_0x1347d8[_0x07a3('0x1d')]=qs[_0x07a3('0x1d')](_0x3196c6['query'][_0x07a3('0x1d')]);_0x1347d8['offset']=qs[_0x07a3('0x1b')](_0x3196c6[_0x07a3('0x2e')][_0x07a3('0x1b')]);}return _0x2cc7c5[_0x07a3('0x51')](_0x1347d8);}})[_0x07a3('0x24')](function(_0x265706){if(_0x265706){return _0x265706?{'count':_0x20a90f,'rows':_0x265706}:null;}})[_0x07a3('0x24')](respondWithResult(_0x4210f1,null))[_0x07a3('0x3f')](handleError(_0x4210f1,null));};exports['setTags']=function(_0x7d6f70,_0x1b8910,_0xcf0b2c){if(_0x7d6f70[_0x07a3('0x46')]['id']){delete _0x7d6f70[_0x07a3('0x46')]['id'];}return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x7d6f70[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x1b8910,null))[_0x07a3('0x24')](function(_0x40cfc1){if(_0x40cfc1){return _0x40cfc1[_0x07a3('0x52')](_0x7d6f70[_0x07a3('0x46')][_0x07a3('0x53')]||[]);}return null;})['then'](respondWithResult(_0x1b8910,null))[_0x07a3('0x3f')](handleError(_0x1b8910,null));}; \ No newline at end of file +var _0xbe5c=['bluebird','mustache','path','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','error','stack','name','map','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','destroy','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xbe5c,0xf8));var _0xcbe5=function(_0x32c468,_0x4b8201){_0x32c468=_0x32c468-0x0;var _0x2b53bd=_0xbe5c[_0x32c468];return _0x2b53bd;};'use strict';var emlformat=require(_0xcbe5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcbe5('0x1'));var jsonpatch=require(_0xcbe5('0x2'));var rp=require('request-promise');var moment=require(_0xcbe5('0x3'));var BPromise=require(_0xcbe5('0x4'));var Mustache=require(_0xcbe5('0x5'));var util=require('util');var path=require(_0xcbe5('0x6'));var sox=require(_0xcbe5('0x7'));var csv=require(_0xcbe5('0x8'));var ejs=require(_0xcbe5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbe5('0xa'));var squel=require(_0xcbe5('0xb'));var crypto=require(_0xcbe5('0xc'));var jsforce=require(_0xcbe5('0xd'));var deskjs=require(_0xcbe5('0xe'));var toCsv=require(_0xcbe5('0x8'));var querystring=require('querystring');var Papa=require(_0xcbe5('0xf'));var Redis=require(_0xcbe5('0x10'));var authService=require(_0xcbe5('0x11'));var qs=require(_0xcbe5('0x12'));var as=require(_0xcbe5('0x13'));var hardwareService=require(_0xcbe5('0x14'));var logger=require(_0xcbe5('0x15'))(_0xcbe5('0x16'));var utils=require(_0xcbe5('0x17'));var config=require(_0xcbe5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbe5('0x19'))['db'];function respondWithStatusCode(_0x1a6763,_0x3cc8e0){_0x3cc8e0=_0x3cc8e0||0xcc;return function(_0x1a8913){if(_0x1a8913){return _0x1a6763[_0xcbe5('0x1a')](_0x3cc8e0);}return _0x1a6763[_0xcbe5('0x1b')](_0x3cc8e0)[_0xcbe5('0x1c')]();};}function respondWithResult(_0xab2482,_0x25298a){_0x25298a=_0x25298a||0xc8;return function(_0x3bc0f1){if(_0x3bc0f1){return _0xab2482[_0xcbe5('0x1b')](_0x25298a)[_0xcbe5('0x1d')](_0x3bc0f1);}};}function respondWithFilteredResult(_0x41a398,_0x1b10ea){return function(_0x4a367b){if(_0x4a367b){var _0x5b5381=typeof _0x1b10ea[_0xcbe5('0x1e')]===_0xcbe5('0x1f')&&typeof _0x1b10ea[_0xcbe5('0x20')]===_0xcbe5('0x1f');var _0x1f022a=_0x4a367b['count'];var _0x51a37b=_0x5b5381?0x0:_0x1b10ea[_0xcbe5('0x1e')];var _0x2af1c8=_0x5b5381?_0x4a367b[_0xcbe5('0x21')]:_0x1b10ea[_0xcbe5('0x1e')]+_0x1b10ea[_0xcbe5('0x20')];var _0x2d410e;if(_0x2af1c8>=_0x1f022a){_0x2af1c8=_0x1f022a;_0x2d410e=0xc8;}else{_0x2d410e=0xce;}_0x41a398[_0xcbe5('0x1b')](_0x2d410e);return _0x41a398['set']('Content-Range',_0x51a37b+'-'+_0x2af1c8+'/'+_0x1f022a)['json'](_0x4a367b);}return null;};}function patchUpdates(_0x5a72f6){return function(_0x4cf5e7){try{jsonpatch[_0xcbe5('0x22')](_0x4cf5e7,_0x5a72f6,!![]);}catch(_0x227e90){return BPromise['reject'](_0x227e90);}return _0x4cf5e7[_0xcbe5('0x23')]();};}function saveUpdates(_0x3caeb0,_0xc639e7){return function(_0x542a21){if(_0x542a21){return _0x542a21[_0xcbe5('0x24')](_0x3caeb0)['then'](function(_0x388f4c){return _0x388f4c;});}return null;};}function removeEntity(_0x5be0af,_0x5f1e5e){return function(_0x5cdd69){if(_0x5cdd69){return _0x5cdd69['destroy']()['then'](function(){_0x5be0af[_0xcbe5('0x1b')](0xcc)[_0xcbe5('0x1c')]();});}};}function handleEntityNotFound(_0x505d60,_0x3b4275){return function(_0x1445e7){if(!_0x1445e7){_0x505d60[_0xcbe5('0x1a')](0x194);}return _0x1445e7;};}function handleError(_0x590051,_0x35fbc2){_0x35fbc2=_0x35fbc2||0x1f4;return function(_0x1268d3){logger[_0xcbe5('0x25')](_0x1268d3[_0xcbe5('0x26')]);if(_0x1268d3[_0xcbe5('0x27')]){delete _0x1268d3[_0xcbe5('0x27')];}_0x590051[_0xcbe5('0x1b')](_0x35fbc2)['send'](_0x1268d3);};}exports['index']=function(_0x1d105a,_0x136cbc){var _0x14751c={},_0xdf0eeb={},_0x57841e={'count':0x0,'rows':[]};var _0x47ce1a=_[_0xcbe5('0x28')](db['ZendeskConfiguration']['rawAttributes'],function(_0x1de420){return{'name':_0x1de420[_0xcbe5('0x29')],'type':_0x1de420[_0xcbe5('0x2a')][_0xcbe5('0x2b')]};});_0xdf0eeb[_0xcbe5('0x2c')]=_[_0xcbe5('0x28')](_0x47ce1a,_0xcbe5('0x27'));_0xdf0eeb[_0xcbe5('0x2d')]=_[_0xcbe5('0x2e')](_0x1d105a[_0xcbe5('0x2d')]);_0xdf0eeb[_0xcbe5('0x2f')]=_['intersection'](_0xdf0eeb[_0xcbe5('0x2c')],_0xdf0eeb[_0xcbe5('0x2d')]);_0x14751c['attributes']=_['intersection'](_0xdf0eeb[_0xcbe5('0x2c')],qs['fields'](_0x1d105a[_0xcbe5('0x2d')][_0xcbe5('0x30')]));_0x14751c[_0xcbe5('0x31')]=_0x14751c['attributes'][_0xcbe5('0x32')]?_0x14751c[_0xcbe5('0x31')]:_0xdf0eeb['model'];if(!_0x1d105a[_0xcbe5('0x2d')][_0xcbe5('0x33')]('nolimit')){_0x14751c[_0xcbe5('0x20')]=qs[_0xcbe5('0x20')](_0x1d105a[_0xcbe5('0x2d')][_0xcbe5('0x20')]);_0x14751c[_0xcbe5('0x1e')]=qs[_0xcbe5('0x1e')](_0x1d105a[_0xcbe5('0x2d')][_0xcbe5('0x1e')]);}_0x14751c[_0xcbe5('0x34')]=qs[_0xcbe5('0x35')](_0x1d105a[_0xcbe5('0x2d')][_0xcbe5('0x35')]);_0x14751c[_0xcbe5('0x36')]=qs['filters'](_[_0xcbe5('0x37')](_0x1d105a[_0xcbe5('0x2d')],_0xdf0eeb['filters']),_0x47ce1a);if(_0x1d105a[_0xcbe5('0x2d')][_0xcbe5('0x38')]){_0x14751c['where']=_[_0xcbe5('0x39')](_0x14751c[_0xcbe5('0x36')],{'$or':_[_0xcbe5('0x28')](_0x47ce1a,function(_0x4e4479){if(_0x4e4479[_0xcbe5('0x2a')]!==_0xcbe5('0x3a')){var _0x5b5c90={};_0x5b5c90[_0x4e4479['name']]={'$like':'%'+_0x1d105a[_0xcbe5('0x2d')]['filter']+'%'};return _0x5b5c90;}})});}_0x14751c=_['merge']({},_0x14751c,_0x1d105a[_0xcbe5('0x3b')]);var _0x246c74={'where':_0x14751c[_0xcbe5('0x36')]};return db['ZendeskConfiguration'][_0xcbe5('0x21')](_0x246c74)[_0xcbe5('0x3c')](function(_0x4bcedf){_0x57841e[_0xcbe5('0x21')]=_0x4bcedf;if(_0x1d105a[_0xcbe5('0x2d')][_0xcbe5('0x3d')]){_0x14751c[_0xcbe5('0x3e')]=[{'all':!![]}];}return db[_0xcbe5('0x3f')][_0xcbe5('0x40')](_0x14751c);})[_0xcbe5('0x3c')](function(_0x41f05e){_0x57841e[_0xcbe5('0x41')]=_0x41f05e;return _0x57841e;})[_0xcbe5('0x3c')](respondWithFilteredResult(_0x136cbc,_0x14751c))[_0xcbe5('0x42')](handleError(_0x136cbc,null));};exports[_0xcbe5('0x43')]=function(_0x3d356b,_0x32ab3c){var _0x4cfa77={'raw':![],'where':{'id':_0x3d356b[_0xcbe5('0x44')]['id']}},_0x283811={};_0x283811[_0xcbe5('0x2c')]=_[_0xcbe5('0x2e')](db['ZendeskConfiguration'][_0xcbe5('0x45')]);_0x283811[_0xcbe5('0x2d')]=_['keys'](_0x3d356b[_0xcbe5('0x2d')]);_0x283811['filters']=_['intersection'](_0x283811[_0xcbe5('0x2c')],_0x283811[_0xcbe5('0x2d')]);_0x4cfa77[_0xcbe5('0x31')]=_[_0xcbe5('0x46')](_0x283811['model'],qs[_0xcbe5('0x30')](_0x3d356b[_0xcbe5('0x2d')][_0xcbe5('0x30')]));_0x4cfa77['attributes']=_0x4cfa77['attributes']['length']?_0x4cfa77[_0xcbe5('0x31')]:_0x283811[_0xcbe5('0x2c')];if(_0x3d356b['query'][_0xcbe5('0x3d')]){_0x4cfa77['include']=[{'all':!![]}];}_0x4cfa77=_[_0xcbe5('0x39')]({},_0x4cfa77,_0x3d356b[_0xcbe5('0x3b')]);return db[_0xcbe5('0x3f')][_0xcbe5('0x47')](_0x4cfa77)[_0xcbe5('0x3c')](handleEntityNotFound(_0x32ab3c,null))['then'](respondWithResult(_0x32ab3c,null))['catch'](handleError(_0x32ab3c,null));};exports[_0xcbe5('0x48')]=function(_0x853188,_0x2099b4){return db[_0xcbe5('0x3f')][_0xcbe5('0x48')](_0x853188[_0xcbe5('0x49')],{})['then'](respondWithResult(_0x2099b4,0xc9))[_0xcbe5('0x42')](handleError(_0x2099b4,null));};exports[_0xcbe5('0x24')]=function(_0x549a45,_0x23a46e){if(_0x549a45[_0xcbe5('0x49')]['id']){delete _0x549a45['body']['id'];}return db[_0xcbe5('0x3f')]['find']({'where':{'id':_0x549a45[_0xcbe5('0x44')]['id']}})[_0xcbe5('0x3c')](handleEntityNotFound(_0x23a46e,null))[_0xcbe5('0x3c')](saveUpdates(_0x549a45[_0xcbe5('0x49')],null))[_0xcbe5('0x3c')](respondWithResult(_0x23a46e,null))[_0xcbe5('0x42')](handleError(_0x23a46e,null));};exports[_0xcbe5('0x4a')]=function(_0x503fca,_0x549eef){return db[_0xcbe5('0x3f')][_0xcbe5('0x47')]({'where':{'id':_0x503fca[_0xcbe5('0x44')]['id']}})['then'](handleEntityNotFound(_0x549eef,null))[_0xcbe5('0x3c')](removeEntity(_0x549eef,null))[_0xcbe5('0x42')](handleError(_0x549eef,null));};exports[_0xcbe5('0x4b')]=function(_0xc6b9b0,_0x1156ee,_0x4feea9){var _0x2666e7={};var _0x41403c={};var _0x13b4e2;var _0x45b058;return db[_0xcbe5('0x3f')][_0xcbe5('0x4c')]({'where':{'id':_0xc6b9b0[_0xcbe5('0x44')]['id']}})[_0xcbe5('0x3c')](handleEntityNotFound(_0x1156ee,null))[_0xcbe5('0x3c')](function(_0x45aba1){if(_0x45aba1){_0x13b4e2=_0x45aba1;_0x41403c[_0xcbe5('0x2c')]=_[_0xcbe5('0x2e')](db[_0xcbe5('0x4d')][_0xcbe5('0x45')]);_0x41403c[_0xcbe5('0x2d')]=_[_0xcbe5('0x2e')](_0xc6b9b0['query']);_0x41403c[_0xcbe5('0x2f')]=_[_0xcbe5('0x46')](_0x41403c[_0xcbe5('0x2c')],_0x41403c[_0xcbe5('0x2d')]);_0x2666e7[_0xcbe5('0x31')]=_['intersection'](_0x41403c[_0xcbe5('0x2c')],qs[_0xcbe5('0x30')](_0xc6b9b0[_0xcbe5('0x2d')][_0xcbe5('0x30')]));_0x2666e7[_0xcbe5('0x31')]=_0x2666e7[_0xcbe5('0x31')][_0xcbe5('0x32')]?_0x2666e7['attributes']:_0x41403c[_0xcbe5('0x2c')];_0x2666e7[_0xcbe5('0x34')]=qs[_0xcbe5('0x35')](_0xc6b9b0['query'][_0xcbe5('0x35')]);_0x2666e7[_0xcbe5('0x36')]=qs['filters'](_[_0xcbe5('0x37')](_0xc6b9b0[_0xcbe5('0x2d')],_0x41403c[_0xcbe5('0x2f')]));if(_0xc6b9b0['query'][_0xcbe5('0x38')]){_0x2666e7['where']=_['merge'](_0x2666e7[_0xcbe5('0x36')],{'$or':_['map'](_0x2666e7[_0xcbe5('0x31')],function(_0x519b58){var _0x3ef5bc={};_0x3ef5bc[_0x519b58]={'$like':'%'+_0xc6b9b0[_0xcbe5('0x2d')]['filter']+'%'};return _0x3ef5bc;})});}_0x2666e7=_[_0xcbe5('0x39')]({},_0x2666e7,_0xc6b9b0[_0xcbe5('0x3b')]);return _0x13b4e2['getFields'](_0x2666e7);}})[_0xcbe5('0x3c')](function(_0x32491b){if(_0x32491b){_0x45b058=_0x32491b[_0xcbe5('0x32')];if(!_0xc6b9b0[_0xcbe5('0x2d')]['hasOwnProperty'](_0xcbe5('0x4e'))){_0x2666e7['limit']=qs[_0xcbe5('0x20')](_0xc6b9b0[_0xcbe5('0x2d')][_0xcbe5('0x20')]);_0x2666e7[_0xcbe5('0x1e')]=qs['offset'](_0xc6b9b0[_0xcbe5('0x2d')]['offset']);}return _0x13b4e2[_0xcbe5('0x4b')](_0x2666e7);}})[_0xcbe5('0x3c')](function(_0x4e35dd){if(_0x4e35dd){return _0x4e35dd?{'count':_0x45b058,'rows':_0x4e35dd}:null;}})['then'](respondWithResult(_0x1156ee,null))['catch'](handleError(_0x1156ee,null));};exports[_0xcbe5('0x4f')]=function(_0x1fd7e9,_0x4e7c4b,_0x7cead0){var _0x5ecdff={};var _0x4bcf6a={};var _0x27ee62;var _0x440fcc;return db[_0xcbe5('0x3f')][_0xcbe5('0x4c')]({'where':{'id':_0x1fd7e9[_0xcbe5('0x44')]['id']}})[_0xcbe5('0x3c')](handleEntityNotFound(_0x4e7c4b,null))[_0xcbe5('0x3c')](function(_0x20dd2b){if(_0x20dd2b){_0x27ee62=_0x20dd2b;_0x4bcf6a[_0xcbe5('0x2c')]=_[_0xcbe5('0x2e')](db[_0xcbe5('0x4d')][_0xcbe5('0x45')]);_0x4bcf6a[_0xcbe5('0x2d')]=_[_0xcbe5('0x2e')](_0x1fd7e9[_0xcbe5('0x2d')]);_0x4bcf6a[_0xcbe5('0x2f')]=_[_0xcbe5('0x46')](_0x4bcf6a['model'],_0x4bcf6a[_0xcbe5('0x2d')]);_0x5ecdff[_0xcbe5('0x31')]=_[_0xcbe5('0x46')](_0x4bcf6a[_0xcbe5('0x2c')],qs[_0xcbe5('0x30')](_0x1fd7e9['query'][_0xcbe5('0x30')]));_0x5ecdff[_0xcbe5('0x31')]=_0x5ecdff[_0xcbe5('0x31')]['length']?_0x5ecdff[_0xcbe5('0x31')]:_0x4bcf6a[_0xcbe5('0x2c')];_0x5ecdff[_0xcbe5('0x34')]=qs[_0xcbe5('0x35')](_0x1fd7e9[_0xcbe5('0x2d')][_0xcbe5('0x35')]);_0x5ecdff[_0xcbe5('0x36')]=qs[_0xcbe5('0x2f')](_['pick'](_0x1fd7e9[_0xcbe5('0x2d')],_0x4bcf6a[_0xcbe5('0x2f')]));if(_0x1fd7e9[_0xcbe5('0x2d')]['filter']){_0x5ecdff['where']=_[_0xcbe5('0x39')](_0x5ecdff['where'],{'$or':_[_0xcbe5('0x28')](_0x5ecdff[_0xcbe5('0x31')],function(_0x5321e8){var _0x20e284={};_0x20e284[_0x5321e8]={'$like':'%'+_0x1fd7e9['query'][_0xcbe5('0x38')]+'%'};return _0x20e284;})});}_0x5ecdff=_[_0xcbe5('0x39')]({},_0x5ecdff,_0x1fd7e9[_0xcbe5('0x3b')]);return _0x27ee62[_0xcbe5('0x4f')](_0x5ecdff);}})[_0xcbe5('0x3c')](function(_0x3cf27f){if(_0x3cf27f){_0x440fcc=_0x3cf27f[_0xcbe5('0x32')];if(!_0x1fd7e9['query'][_0xcbe5('0x33')]('nolimit')){_0x5ecdff[_0xcbe5('0x20')]=qs['limit'](_0x1fd7e9[_0xcbe5('0x2d')][_0xcbe5('0x20')]);_0x5ecdff[_0xcbe5('0x1e')]=qs['offset'](_0x1fd7e9['query']['offset']);}return _0x27ee62[_0xcbe5('0x4f')](_0x5ecdff);}})['then'](function(_0x290b1f){if(_0x290b1f){return _0x290b1f?{'count':_0x440fcc,'rows':_0x290b1f}:null;}})[_0xcbe5('0x3c')](respondWithResult(_0x4e7c4b,null))[_0xcbe5('0x42')](handleError(_0x4e7c4b,null));};exports[_0xcbe5('0x50')]=function(_0x2580ee,_0x1e6c65,_0x593eb1){var _0x48b319={};var _0x4a6a12={};var _0x4a084b;var _0x2f9637;return db['ZendeskConfiguration'][_0xcbe5('0x4c')]({'where':{'id':_0x2580ee['params']['id']}})[_0xcbe5('0x3c')](handleEntityNotFound(_0x1e6c65,null))[_0xcbe5('0x3c')](function(_0x51de2c){if(_0x51de2c){_0x4a084b=_0x51de2c;_0x4a6a12[_0xcbe5('0x2c')]=_[_0xcbe5('0x2e')](db['ZendeskField'][_0xcbe5('0x45')]);_0x4a6a12[_0xcbe5('0x2d')]=_['keys'](_0x2580ee[_0xcbe5('0x2d')]);_0x4a6a12[_0xcbe5('0x2f')]=_[_0xcbe5('0x46')](_0x4a6a12[_0xcbe5('0x2c')],_0x4a6a12[_0xcbe5('0x2d')]);_0x48b319[_0xcbe5('0x31')]=_[_0xcbe5('0x46')](_0x4a6a12[_0xcbe5('0x2c')],qs[_0xcbe5('0x30')](_0x2580ee[_0xcbe5('0x2d')][_0xcbe5('0x30')]));_0x48b319[_0xcbe5('0x31')]=_0x48b319[_0xcbe5('0x31')][_0xcbe5('0x32')]?_0x48b319['attributes']:_0x4a6a12[_0xcbe5('0x2c')];_0x48b319[_0xcbe5('0x34')]=qs[_0xcbe5('0x35')](_0x2580ee[_0xcbe5('0x2d')][_0xcbe5('0x35')]);_0x48b319[_0xcbe5('0x36')]=qs[_0xcbe5('0x2f')](_[_0xcbe5('0x37')](_0x2580ee['query'],_0x4a6a12[_0xcbe5('0x2f')]));if(_0x2580ee[_0xcbe5('0x2d')][_0xcbe5('0x38')]){_0x48b319[_0xcbe5('0x36')]=_['merge'](_0x48b319['where'],{'$or':_[_0xcbe5('0x28')](_0x48b319[_0xcbe5('0x31')],function(_0x2811a5){var _0x1f2ce4={};_0x1f2ce4[_0x2811a5]={'$like':'%'+_0x2580ee[_0xcbe5('0x2d')][_0xcbe5('0x38')]+'%'};return _0x1f2ce4;})});}_0x48b319=_['merge']({},_0x48b319,_0x2580ee[_0xcbe5('0x3b')]);return _0x4a084b[_0xcbe5('0x50')](_0x48b319);}})['then'](function(_0x5a2c46){if(_0x5a2c46){_0x2f9637=_0x5a2c46[_0xcbe5('0x32')];if(!_0x2580ee['query'][_0xcbe5('0x33')](_0xcbe5('0x4e'))){_0x48b319[_0xcbe5('0x20')]=qs['limit'](_0x2580ee['query'][_0xcbe5('0x20')]);_0x48b319[_0xcbe5('0x1e')]=qs[_0xcbe5('0x1e')](_0x2580ee[_0xcbe5('0x2d')][_0xcbe5('0x1e')]);}return _0x4a084b[_0xcbe5('0x50')](_0x48b319);}})['then'](function(_0x1f7d6d){if(_0x1f7d6d){return _0x1f7d6d?{'count':_0x2f9637,'rows':_0x1f7d6d}:null;}})[_0xcbe5('0x3c')](respondWithResult(_0x1e6c65,null))[_0xcbe5('0x42')](handleError(_0x1e6c65,null));};exports[_0xcbe5('0x51')]=function(_0x34a329,_0x1aabde,_0x40d81a){var _0x2f1e71={};var _0x3dd27c={};var _0x534108;var _0x39fd75;return db[_0xcbe5('0x3f')][_0xcbe5('0x4c')]({'where':{'id':_0x34a329[_0xcbe5('0x44')]['id']}})[_0xcbe5('0x3c')](handleEntityNotFound(_0x1aabde,null))[_0xcbe5('0x3c')](function(_0x184271){if(_0x184271){_0x534108=_0x184271;_0x3dd27c[_0xcbe5('0x2c')]=_[_0xcbe5('0x2e')](db[_0xcbe5('0x52')][_0xcbe5('0x45')]);_0x3dd27c['query']=_[_0xcbe5('0x2e')](_0x34a329[_0xcbe5('0x2d')]);_0x3dd27c[_0xcbe5('0x2f')]=_[_0xcbe5('0x46')](_0x3dd27c[_0xcbe5('0x2c')],_0x3dd27c[_0xcbe5('0x2d')]);_0x2f1e71[_0xcbe5('0x31')]=_[_0xcbe5('0x46')](_0x3dd27c[_0xcbe5('0x2c')],qs[_0xcbe5('0x30')](_0x34a329[_0xcbe5('0x2d')]['fields']));_0x2f1e71[_0xcbe5('0x31')]=_0x2f1e71[_0xcbe5('0x31')][_0xcbe5('0x32')]?_0x2f1e71[_0xcbe5('0x31')]:_0x3dd27c[_0xcbe5('0x2c')];_0x2f1e71[_0xcbe5('0x34')]=qs[_0xcbe5('0x35')](_0x34a329[_0xcbe5('0x2d')][_0xcbe5('0x35')]);_0x2f1e71['where']=qs[_0xcbe5('0x2f')](_['pick'](_0x34a329[_0xcbe5('0x2d')],_0x3dd27c[_0xcbe5('0x2f')]));if(_0x34a329[_0xcbe5('0x2d')]['filter']){_0x2f1e71[_0xcbe5('0x36')]=_['merge'](_0x2f1e71[_0xcbe5('0x36')],{'$or':_[_0xcbe5('0x28')](_0x2f1e71[_0xcbe5('0x31')],function(_0x42dffd){var _0x3d6912={};_0x3d6912[_0x42dffd]={'$like':'%'+_0x34a329[_0xcbe5('0x2d')][_0xcbe5('0x38')]+'%'};return _0x3d6912;})});}_0x2f1e71=_[_0xcbe5('0x39')]({},_0x2f1e71,_0x34a329[_0xcbe5('0x3b')]);return _0x534108[_0xcbe5('0x51')](_0x2f1e71);}})[_0xcbe5('0x3c')](function(_0x394a17){if(_0x394a17){_0x39fd75=_0x394a17[_0xcbe5('0x32')];if(!_0x34a329['query']['hasOwnProperty']('nolimit')){_0x2f1e71[_0xcbe5('0x20')]=qs[_0xcbe5('0x20')](_0x34a329[_0xcbe5('0x2d')][_0xcbe5('0x20')]);_0x2f1e71[_0xcbe5('0x1e')]=qs[_0xcbe5('0x1e')](_0x34a329[_0xcbe5('0x2d')][_0xcbe5('0x1e')]);}return _0x534108[_0xcbe5('0x51')](_0x2f1e71);}})[_0xcbe5('0x3c')](function(_0x4adde1){if(_0x4adde1){return _0x4adde1?{'count':_0x39fd75,'rows':_0x4adde1}:null;}})[_0xcbe5('0x3c')](respondWithResult(_0x1aabde,null))[_0xcbe5('0x42')](handleError(_0x1aabde,null));};exports[_0xcbe5('0x53')]=function(_0x561a39,_0x12f048,_0x3aeca9){if(_0x561a39[_0xcbe5('0x49')]['id']){delete _0x561a39[_0xcbe5('0x49')]['id'];}return db[_0xcbe5('0x3f')][_0xcbe5('0x4c')]({'where':{'id':_0x561a39[_0xcbe5('0x44')]['id']}})[_0xcbe5('0x3c')](handleEntityNotFound(_0x12f048,null))[_0xcbe5('0x3c')](function(_0x184aa0){if(_0x184aa0){return _0x184aa0['setTags'](_0x561a39['body']['ids']||[]);}return null;})[_0xcbe5('0x3c')](respondWithResult(_0x12f048,null))[_0xcbe5('0x42')](handleError(_0x12f048,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 54db7e9..6d79082 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 _0x93e9=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x1f46c0,_0x405b58){var _0x166687=function(_0x59594f){while(--_0x59594f){_0x1f46c0['push'](_0x1f46c0['shift']());}};_0x166687(++_0x405b58);}(_0x93e9,0xcc));var _0x993e=function(_0x5ccb33,_0xa4bcbe){_0x5ccb33=_0x5ccb33-0x0;var _0x4c1db8=_0x93e9[_0x5ccb33];return _0x4c1db8;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x1f60d1,_0xaa73d2){var _0x24c066=function(_0x4ac80e){while(--_0x4ac80e){_0x1f60d1['push'](_0x1f60d1['shift']());}};_0x24c066(++_0xaa73d2);}(_0x14a0,0x8e));var _0x014a=function(_0x587d20,_0x3b8f82){_0x587d20=_0x587d20-0x0;var _0x2b7a9f=_0x14a0[_0x587d20];return _0x2b7a9f;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'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 b462341..a68f3ea 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 _0x944c=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','message','info'];(function(_0x3af704,_0x58486b){var _0x4ac16c=function(_0x1a49b8){while(--_0x1a49b8){_0x3af704['push'](_0x3af704['shift']());}};_0x4ac16c(++_0x58486b);}(_0x944c,0x1c1));var _0xc944=function(_0x3dee2f,_0x4f65d8){_0x3dee2f=_0x3dee2f-0x0;var _0x2acf17=_0x944c[_0x3dee2f];return _0x2acf17;};'use strict';var _=require(_0xc944('0x0'));var util=require(_0xc944('0x1'));var moment=require(_0xc944('0x2'));var BPromise=require(_0xc944('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc944('0x4'));var db=require(_0xc944('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc944('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc944('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x578bc0,_0x21def3,_0x38807c){return new BPromise(function(_0x34dbd6,_0x4dd151){return client['request'](_0x578bc0,_0x38807c)['then'](function(_0x5b83b3){logger['info'](_0xc944('0x8'),_0x21def3,_0xc944('0x9'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x21def3,'request\x20sent',JSON['stringify'](_0x5b83b3));if(_0x5b83b3[_0xc944('0xa')]){if(_0x5b83b3[_0xc944('0xa')]['code']===0x1f4){logger['error'](_0xc944('0x8'),_0x21def3,_0x5b83b3[_0xc944('0xa')]['message']);return _0x4dd151(_0x5b83b3[_0xc944('0xa')]['message']);}logger[_0xc944('0xa')](_0xc944('0x8'),_0x21def3,_0x5b83b3[_0xc944('0xa')][_0xc944('0xb')]);return _0x34dbd6(_0x5b83b3[_0xc944('0xa')]['message']);}else{logger[_0xc944('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x21def3,_0xc944('0x9'));_0x34dbd6(_0x5b83b3[_0xc944('0xd')][_0xc944('0xb')]);}})['catch'](function(_0x2edca8){logger['error'](_0xc944('0x8'),_0x21def3,_0x2edca8);_0x4dd151(_0x2edca8);});});} \ No newline at end of file +var _0x3360=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x326977,_0xc4a15e){var _0xa3a465=function(_0x31629e){while(--_0x31629e){_0x326977['push'](_0x326977['shift']());}};_0xa3a465(++_0xc4a15e);}(_0x3360,0x1c2));var _0x0336=function(_0x2981f9,_0x4e2cb3){_0x2981f9=_0x2981f9-0x0;var _0x4aeeb4=_0x3360[_0x2981f9];return _0x4aeeb4;};'use strict';var _=require(_0x0336('0x0'));var util=require(_0x0336('0x1'));var moment=require(_0x0336('0x2'));var BPromise=require(_0x0336('0x3'));var rs=require(_0x0336('0x4'));var fs=require('fs');var Redis=require(_0x0336('0x5'));var db=require(_0x0336('0x6'))['db'];var utils=require(_0x0336('0x7'));var logger=require(_0x0336('0x8'))(_0x0336('0x9'));var config=require(_0x0336('0xa'));var jayson=require(_0x0336('0xb'));var client=jayson[_0x0336('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x478ce7,_0x3dafd7,_0x3fa915){return new BPromise(function(_0x340bb9,_0x580ef4){return client[_0x0336('0xd')](_0x478ce7,_0x3fa915)['then'](function(_0x2e3c63){logger[_0x0336('0xe')](_0x0336('0xf'),_0x3dafd7,_0x0336('0x10'));logger[_0x0336('0x11')](_0x0336('0x12'),_0x3dafd7,'request\x20sent',JSON[_0x0336('0x13')](_0x2e3c63));if(_0x2e3c63[_0x0336('0x14')]){if(_0x2e3c63[_0x0336('0x14')][_0x0336('0x15')]===0x1f4){logger[_0x0336('0x14')](_0x0336('0xf'),_0x3dafd7,_0x2e3c63[_0x0336('0x14')][_0x0336('0x16')]);return _0x580ef4(_0x2e3c63['error']['message']);}logger[_0x0336('0x14')](_0x0336('0xf'),_0x3dafd7,_0x2e3c63[_0x0336('0x14')][_0x0336('0x16')]);return _0x340bb9(_0x2e3c63['error'][_0x0336('0x16')]);}else{logger[_0x0336('0xe')](_0x0336('0xf'),_0x3dafd7,'request\x20sent');_0x340bb9(_0x2e3c63[_0x0336('0x17')][_0x0336('0x16')]);}})[_0x0336('0x18')](function(_0x5ba515){logger['error'](_0x0336('0xf'),_0x3dafd7,_0x5ba515);_0x580ef4(_0x5ba515);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2acf168..4194502 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 _0x412b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3594e6,_0x93f4e4){var _0x5ad98f=function(_0x9dea4a){while(--_0x9dea4a){_0x3594e6['push'](_0x3594e6['shift']());}};_0x5ad98f(++_0x93f4e4);}(_0x412b,0xb7));var _0xb412=function(_0x184e35,_0x2d7614){_0x184e35=_0x184e35-0x0;var _0x55c5dd=_0x412b[_0x184e35];return _0x55c5dd;};'use strict';var multer=require(_0xb412('0x0'));var util=require('util');var path=require(_0xb412('0x1'));var timeout=require(_0xb412('0x2'));var express=require(_0xb412('0x3'));var router=express[_0xb412('0x4')]();var fs_extra=require(_0xb412('0x5'));var auth=require(_0xb412('0x6'));var interaction=require(_0xb412('0x7'));var config=require(_0xb412('0x8'));var controller=require('./intZendeskField.controller');router[_0xb412('0x9')]('/',auth[_0xb412('0xa')](),controller[_0xb412('0xb')]);router[_0xb412('0x9')]('/:id',auth[_0xb412('0xa')](),controller[_0xb412('0xc')]);router[_0xb412('0xd')]('/',auth[_0xb412('0xa')](),controller[_0xb412('0xe')]);router[_0xb412('0xf')]('/:id',auth[_0xb412('0xa')](),controller[_0xb412('0x10')]);router[_0xb412('0x11')](_0xb412('0x12'),auth[_0xb412('0xa')](),controller[_0xb412('0x13')]);module[_0xb412('0x14')]=router; \ No newline at end of file +var _0xc65a=['isAuthenticated','/:id','show','post','create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZendeskField.controller','get'];(function(_0x4366e0,_0x1e2841){var _0x118994=function(_0x165f3f){while(--_0x165f3f){_0x4366e0['push'](_0x4366e0['shift']());}};_0x118994(++_0x1e2841);}(_0xc65a,0x67));var _0xac65=function(_0x4029bd,_0x448f8c){_0x4029bd=_0x4029bd-0x0;var _0x5f3001=_0xc65a[_0x4029bd];return _0x5f3001;};'use strict';var multer=require(_0xac65('0x0'));var util=require(_0xac65('0x1'));var path=require('path');var timeout=require(_0xac65('0x2'));var express=require(_0xac65('0x3'));var router=express[_0xac65('0x4')]();var fs_extra=require(_0xac65('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xac65('0x6'));var config=require('../../config/environment');var controller=require(_0xac65('0x7'));router[_0xac65('0x8')]('/',auth[_0xac65('0x9')](),controller['index']);router[_0xac65('0x8')](_0xac65('0xa'),auth['isAuthenticated'](),controller[_0xac65('0xb')]);router[_0xac65('0xc')]('/',auth['isAuthenticated'](),controller[_0xac65('0xd')]);router['put'](_0xac65('0xa'),auth[_0xac65('0x9')](),controller[_0xac65('0xe')]);router['delete']('/:id',auth[_0xac65('0x9')](),controller['destroy']);module[_0xac65('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 5c27cea..2deb714 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 _0xa8dd=['ENUM','customVariable','BOOLEAN','sequelize','exports','string','keyValue','picklist','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa8dd,0x1f2));var _0xda8d=function(_0x59bb17,_0x2a1cc5){_0x59bb17=_0x59bb17-0x0;var _0x57fda3=_0xa8dd[_0x59bb17];return _0x57fda3;};'use strict';var Sequelize=require(_0xda8d('0x0'));module[_0xda8d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xda8d('0x2'),'variable','customVariable',_0xda8d('0x3'),_0xda8d('0x4')),'defaultValue':_0xda8d('0x2')},'content':{'type':Sequelize[_0xda8d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xda8d('0x6')](_0xda8d('0x2'),'variable',_0xda8d('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xda8d('0x5')]},'customField':{'type':Sequelize[_0xda8d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda8d('0x5')]}}; \ No newline at end of file +var _0xff5d=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x34502c,_0x142933){var _0x5ac00a=function(_0x4f31f0){while(--_0x4f31f0){_0x34502c['push'](_0x34502c['shift']());}};_0x5ac00a(++_0x142933);}(_0xff5d,0xcd));var _0xdff5=function(_0xa3418c,_0x3340a2){_0xa3418c=_0xa3418c-0x0;var _0x266211=_0xff5d[_0xa3418c];return _0x266211;};'use strict';var Sequelize=require(_0xdff5('0x0'));module[_0xdff5('0x1')]={'type':{'type':Sequelize[_0xdff5('0x2')](_0xdff5('0x3'),_0xdff5('0x4'),'customVariable',_0xdff5('0x5'),_0xdff5('0x6')),'defaultValue':_0xdff5('0x3')},'content':{'type':Sequelize[_0xdff5('0x7')]},'key':{'type':Sequelize[_0xdff5('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xdff5('0x3'),_0xdff5('0x4'),_0xdff5('0x8'))},'keyContent':{'type':Sequelize[_0xdff5('0x7')]},'idField':{'type':Sequelize[_0xdff5('0x7')]},'nameField':{'type':Sequelize[_0xdff5('0x7')]},'customField':{'type':Sequelize[_0xdff5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 21da6e0..86516eb 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 _0x99cd=['reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','ZendeskField','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../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'];(function(_0xc507b7,_0x33044d){var _0x138df1=function(_0x3fd047){while(--_0x3fd047){_0xc507b7['push'](_0xc507b7['shift']());}};_0x138df1(++_0x33044d);}(_0x99cd,0x194));var _0xd99c=function(_0xceb351,_0x2693b0){_0xceb351=_0xceb351-0x0;var _0xf07158=_0x99cd[_0xceb351];return _0xf07158;};'use strict';var emlformat=require(_0xd99c('0x0'));var rimraf=require(_0xd99c('0x1'));var zipdir=require(_0xd99c('0x2'));var jsonpatch=require(_0xd99c('0x3'));var rp=require(_0xd99c('0x4'));var moment=require('moment');var BPromise=require(_0xd99c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd99c('0x6'));var sox=require(_0xd99c('0x7'));var csv=require(_0xd99c('0x8'));var ejs=require(_0xd99c('0x9'));var fs=require('fs');var fs_extra=require(_0xd99c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd99c('0xb'));var toCsv=require(_0xd99c('0x8'));var querystring=require(_0xd99c('0xc'));var Papa=require(_0xd99c('0xd'));var Redis=require('ioredis');var authService=require(_0xd99c('0xe'));var qs=require(_0xd99c('0xf'));var as=require(_0xd99c('0x10'));var hardwareService=require(_0xd99c('0x11'));var logger=require(_0xd99c('0x12'))(_0xd99c('0x13'));var utils=require(_0xd99c('0x14'));var config=require(_0xd99c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd99c('0x16'))['db'];function respondWithStatusCode(_0x4c3659,_0x348c37){_0x348c37=_0x348c37||0xcc;return function(_0x23460c){if(_0x23460c){return _0x4c3659[_0xd99c('0x17')](_0x348c37);}return _0x4c3659[_0xd99c('0x18')](_0x348c37)[_0xd99c('0x19')]();};}function respondWithResult(_0x33695c,_0x2ec005){_0x2ec005=_0x2ec005||0xc8;return function(_0x1454ec){if(_0x1454ec){return _0x33695c[_0xd99c('0x18')](_0x2ec005)['json'](_0x1454ec);}};}function respondWithFilteredResult(_0xb7669a,_0x32fc40){return function(_0x38de40){if(_0x38de40){var _0x27b8a4=typeof _0x32fc40[_0xd99c('0x1a')]==='undefined'&&typeof _0x32fc40[_0xd99c('0x1b')]===_0xd99c('0x1c');var _0x3ca819=_0x38de40[_0xd99c('0x1d')];var _0x35e478=_0x27b8a4?0x0:_0x32fc40[_0xd99c('0x1a')];var _0xaf2092=_0x27b8a4?_0x38de40['count']:_0x32fc40[_0xd99c('0x1a')]+_0x32fc40['limit'];var _0x150277;if(_0xaf2092>=_0x3ca819){_0xaf2092=_0x3ca819;_0x150277=0xc8;}else{_0x150277=0xce;}_0xb7669a[_0xd99c('0x18')](_0x150277);return _0xb7669a[_0xd99c('0x1e')](_0xd99c('0x1f'),_0x35e478+'-'+_0xaf2092+'/'+_0x3ca819)[_0xd99c('0x20')](_0x38de40);}return null;};}function patchUpdates(_0x40c1d2){return function(_0x23d816){try{jsonpatch[_0xd99c('0x21')](_0x23d816,_0x40c1d2,!![]);}catch(_0x365697){return BPromise[_0xd99c('0x22')](_0x365697);}return _0x23d816[_0xd99c('0x23')]();};}function saveUpdates(_0x4443a0,_0xd331c4){return function(_0x19e582){if(_0x19e582){return _0x19e582[_0xd99c('0x24')](_0x4443a0)[_0xd99c('0x25')](function(_0x8382e8){return _0x8382e8;});}return null;};}function removeEntity(_0x6f18b8,_0x316e6f){return function(_0x32fdcf){if(_0x32fdcf){return _0x32fdcf[_0xd99c('0x26')]()[_0xd99c('0x25')](function(){_0x6f18b8[_0xd99c('0x18')](0xcc)[_0xd99c('0x19')]();});}};}function handleEntityNotFound(_0xb83505,_0x5ae22e){return function(_0x44bf91){if(!_0x44bf91){_0xb83505[_0xd99c('0x17')](0x194);}return _0x44bf91;};}function handleError(_0x5dc780,_0xa5982c){_0xa5982c=_0xa5982c||0x1f4;return function(_0x5a58fc){logger[_0xd99c('0x27')](_0x5a58fc[_0xd99c('0x28')]);if(_0x5a58fc[_0xd99c('0x29')]){delete _0x5a58fc[_0xd99c('0x29')];}_0x5dc780['status'](_0xa5982c)[_0xd99c('0x2a')](_0x5a58fc);};}exports[_0xd99c('0x2b')]=function(_0x5c0fb6,_0x314293){var _0x3f2fe0={},_0x364c76={},_0x5bf474={'count':0x0,'rows':[]};var _0x50fcf8=_[_0xd99c('0x2c')](db['ZendeskField'][_0xd99c('0x2d')],function(_0x239cf1){return{'name':_0x239cf1['fieldName'],'type':_0x239cf1[_0xd99c('0x2e')]['key']};});_0x364c76[_0xd99c('0x2f')]=_[_0xd99c('0x2c')](_0x50fcf8,_0xd99c('0x29'));_0x364c76[_0xd99c('0x30')]=_[_0xd99c('0x31')](_0x5c0fb6[_0xd99c('0x30')]);_0x364c76[_0xd99c('0x32')]=_[_0xd99c('0x33')](_0x364c76[_0xd99c('0x2f')],_0x364c76[_0xd99c('0x30')]);_0x3f2fe0[_0xd99c('0x34')]=_[_0xd99c('0x33')](_0x364c76[_0xd99c('0x2f')],qs[_0xd99c('0x35')](_0x5c0fb6[_0xd99c('0x30')][_0xd99c('0x35')]));_0x3f2fe0[_0xd99c('0x34')]=_0x3f2fe0[_0xd99c('0x34')][_0xd99c('0x36')]?_0x3f2fe0[_0xd99c('0x34')]:_0x364c76[_0xd99c('0x2f')];if(!_0x5c0fb6[_0xd99c('0x30')][_0xd99c('0x37')]('nolimit')){_0x3f2fe0[_0xd99c('0x1b')]=qs[_0xd99c('0x1b')](_0x5c0fb6[_0xd99c('0x30')]['limit']);_0x3f2fe0[_0xd99c('0x1a')]=qs[_0xd99c('0x1a')](_0x5c0fb6[_0xd99c('0x30')]['offset']);}_0x3f2fe0['order']=qs[_0xd99c('0x38')](_0x5c0fb6[_0xd99c('0x30')]['sort']);_0x3f2fe0[_0xd99c('0x39')]=qs[_0xd99c('0x32')](_[_0xd99c('0x3a')](_0x5c0fb6[_0xd99c('0x30')],_0x364c76[_0xd99c('0x32')]),_0x50fcf8);if(_0x5c0fb6[_0xd99c('0x30')][_0xd99c('0x3b')]){_0x3f2fe0[_0xd99c('0x39')]=_[_0xd99c('0x3c')](_0x3f2fe0[_0xd99c('0x39')],{'$or':_[_0xd99c('0x2c')](_0x50fcf8,function(_0x16ab1a){if(_0x16ab1a['type']!=='VIRTUAL'){var _0x4f79b4={};_0x4f79b4[_0x16ab1a[_0xd99c('0x29')]]={'$like':'%'+_0x5c0fb6['query'][_0xd99c('0x3b')]+'%'};return _0x4f79b4;}})});}_0x3f2fe0=_[_0xd99c('0x3c')]({},_0x3f2fe0,_0x5c0fb6['options']);var _0x5e9f58={'where':_0x3f2fe0[_0xd99c('0x39')]};return db[_0xd99c('0x3d')][_0xd99c('0x1d')](_0x5e9f58)['then'](function(_0x289be8){_0x5bf474['count']=_0x289be8;if(_0x5c0fb6['query'][_0xd99c('0x3e')]){_0x3f2fe0['include']=[{'all':!![]}];}return db[_0xd99c('0x3d')][_0xd99c('0x3f')](_0x3f2fe0);})[_0xd99c('0x25')](function(_0x1f61e2){_0x5bf474[_0xd99c('0x40')]=_0x1f61e2;return _0x5bf474;})[_0xd99c('0x25')](respondWithFilteredResult(_0x314293,_0x3f2fe0))[_0xd99c('0x41')](handleError(_0x314293,null));};exports[_0xd99c('0x42')]=function(_0x1819a3,_0x550329){var _0x47b16d={'raw':!![],'where':{'id':_0x1819a3['params']['id']}},_0x5cf036={};_0x5cf036[_0xd99c('0x2f')]=_['keys'](db[_0xd99c('0x3d')][_0xd99c('0x2d')]);_0x5cf036[_0xd99c('0x30')]=_['keys'](_0x1819a3[_0xd99c('0x30')]);_0x5cf036[_0xd99c('0x32')]=_[_0xd99c('0x33')](_0x5cf036[_0xd99c('0x2f')],_0x5cf036[_0xd99c('0x30')]);_0x47b16d[_0xd99c('0x34')]=_[_0xd99c('0x33')](_0x5cf036[_0xd99c('0x2f')],qs[_0xd99c('0x35')](_0x1819a3[_0xd99c('0x30')][_0xd99c('0x35')]));_0x47b16d[_0xd99c('0x34')]=_0x47b16d['attributes'][_0xd99c('0x36')]?_0x47b16d[_0xd99c('0x34')]:_0x5cf036['model'];if(_0x1819a3[_0xd99c('0x30')][_0xd99c('0x3e')]){_0x47b16d[_0xd99c('0x43')]=[{'all':!![]}];}_0x47b16d=_[_0xd99c('0x3c')]({},_0x47b16d,_0x1819a3[_0xd99c('0x44')]);return db['ZendeskField'][_0xd99c('0x45')](_0x47b16d)['then'](handleEntityNotFound(_0x550329,null))[_0xd99c('0x25')](respondWithResult(_0x550329,null))[_0xd99c('0x41')](handleError(_0x550329,null));};exports[_0xd99c('0x46')]=function(_0x1fc1c1,_0x5db877){return db[_0xd99c('0x3d')][_0xd99c('0x46')](_0x1fc1c1[_0xd99c('0x47')],{})[_0xd99c('0x25')](respondWithResult(_0x5db877,0xc9))['catch'](handleError(_0x5db877,null));};exports[_0xd99c('0x24')]=function(_0xb7f81b,_0x1f0075){if(_0xb7f81b[_0xd99c('0x47')]['id']){delete _0xb7f81b[_0xd99c('0x47')]['id'];}return db[_0xd99c('0x3d')][_0xd99c('0x45')]({'where':{'id':_0xb7f81b[_0xd99c('0x48')]['id']}})[_0xd99c('0x25')](handleEntityNotFound(_0x1f0075,null))[_0xd99c('0x25')](saveUpdates(_0xb7f81b['body'],null))['then'](respondWithResult(_0x1f0075,null))[_0xd99c('0x41')](handleError(_0x1f0075,null));};exports[_0xd99c('0x26')]=function(_0x22e069,_0x2d1510){return db[_0xd99c('0x3d')][_0xd99c('0x45')]({'where':{'id':_0x22e069[_0xd99c('0x48')]['id']}})[_0xd99c('0x25')](handleEntityNotFound(_0x2d1510,null))['then'](removeEntity(_0x2d1510,null))[_0xd99c('0x41')](handleError(_0x2d1510,null));}; \ No newline at end of file +var _0x44d2=['include','catch','params','includeAll','create','body','find','destroy','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','sendStatus','error','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','options'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x44d2,0x1f2));var _0x244d=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x44d2[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x244d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x244d('0x1'));var rp=require(_0x244d('0x2'));var moment=require('moment');var BPromise=require(_0x244d('0x3'));var Mustache=require(_0x244d('0x4'));var util=require('util');var path=require(_0x244d('0x5'));var sox=require(_0x244d('0x6'));var csv=require(_0x244d('0x7'));var ejs=require(_0x244d('0x8'));var fs=require('fs');var fs_extra=require(_0x244d('0x9'));var _=require(_0x244d('0xa'));var squel=require(_0x244d('0xb'));var crypto=require(_0x244d('0xc'));var jsforce=require(_0x244d('0xd'));var deskjs=require(_0x244d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x244d('0xf'));var Papa=require(_0x244d('0x10'));var Redis=require(_0x244d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x244d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x244d('0x13'));var logger=require('../../config/logger')(_0x244d('0x14'));var utils=require(_0x244d('0x15'));var config=require(_0x244d('0x16'));var licenseUtil=require(_0x244d('0x17'));var db=require(_0x244d('0x18'))['db'];function respondWithStatusCode(_0x1a8240,_0xf600aa){_0xf600aa=_0xf600aa||0xcc;return function(_0x22df8b){if(_0x22df8b){return _0x1a8240['sendStatus'](_0xf600aa);}return _0x1a8240['status'](_0xf600aa)[_0x244d('0x19')]();};}function respondWithResult(_0x45c73c,_0x1d672c){_0x1d672c=_0x1d672c||0xc8;return function(_0x3a3724){if(_0x3a3724){return _0x45c73c[_0x244d('0x1a')](_0x1d672c)[_0x244d('0x1b')](_0x3a3724);}};}function respondWithFilteredResult(_0x1de4d2,_0x56b212){return function(_0x530a55){if(_0x530a55){var _0x2b29ab=typeof _0x56b212[_0x244d('0x1c')]==='undefined'&&typeof _0x56b212[_0x244d('0x1d')]===_0x244d('0x1e');var _0xa5da49=_0x530a55[_0x244d('0x1f')];var _0x351039=_0x2b29ab?0x0:_0x56b212[_0x244d('0x1c')];var _0xb98519=_0x2b29ab?_0x530a55[_0x244d('0x1f')]:_0x56b212[_0x244d('0x1c')]+_0x56b212[_0x244d('0x1d')];var _0x1588d3;if(_0xb98519>=_0xa5da49){_0xb98519=_0xa5da49;_0x1588d3=0xc8;}else{_0x1588d3=0xce;}_0x1de4d2['status'](_0x1588d3);return _0x1de4d2[_0x244d('0x20')]('Content-Range',_0x351039+'-'+_0xb98519+'/'+_0xa5da49)[_0x244d('0x1b')](_0x530a55);}return null;};}function patchUpdates(_0x4bebf5){return function(_0x1ee775){try{jsonpatch[_0x244d('0x21')](_0x1ee775,_0x4bebf5,!![]);}catch(_0x382739){return BPromise['reject'](_0x382739);}return _0x1ee775[_0x244d('0x22')]();};}function saveUpdates(_0x5c15d3,_0x3a456){return function(_0x43c073){if(_0x43c073){return _0x43c073[_0x244d('0x23')](_0x5c15d3)[_0x244d('0x24')](function(_0x5200a3){return _0x5200a3;});}return null;};}function removeEntity(_0x20210b,_0x1294ac){return function(_0x568641){if(_0x568641){return _0x568641['destroy']()[_0x244d('0x24')](function(){_0x20210b[_0x244d('0x1a')](0xcc)[_0x244d('0x19')]();});}};}function handleEntityNotFound(_0x5ebaaa,_0x3607cf){return function(_0x320841){if(!_0x320841){_0x5ebaaa[_0x244d('0x25')](0x194);}return _0x320841;};}function handleError(_0x2229f0,_0x2d8a61){_0x2d8a61=_0x2d8a61||0x1f4;return function(_0x28a1c7){logger[_0x244d('0x26')](_0x28a1c7['stack']);if(_0x28a1c7[_0x244d('0x27')]){delete _0x28a1c7[_0x244d('0x27')];}_0x2229f0[_0x244d('0x1a')](_0x2d8a61)[_0x244d('0x28')](_0x28a1c7);};}exports[_0x244d('0x29')]=function(_0x536d40,_0x24f37c){var _0x26f11b={},_0x3928a6={},_0x43dc48={'count':0x0,'rows':[]};var _0x4ab652=_['map'](db[_0x244d('0x2a')][_0x244d('0x2b')],function(_0x327a05){return{'name':_0x327a05[_0x244d('0x2c')],'type':_0x327a05[_0x244d('0x2d')][_0x244d('0x2e')]};});_0x3928a6[_0x244d('0x2f')]=_[_0x244d('0x30')](_0x4ab652,_0x244d('0x27'));_0x3928a6[_0x244d('0x31')]=_[_0x244d('0x32')](_0x536d40[_0x244d('0x31')]);_0x3928a6[_0x244d('0x33')]=_['intersection'](_0x3928a6[_0x244d('0x2f')],_0x3928a6[_0x244d('0x31')]);_0x26f11b['attributes']=_[_0x244d('0x34')](_0x3928a6[_0x244d('0x2f')],qs[_0x244d('0x35')](_0x536d40['query'][_0x244d('0x35')]));_0x26f11b[_0x244d('0x36')]=_0x26f11b[_0x244d('0x36')][_0x244d('0x37')]?_0x26f11b[_0x244d('0x36')]:_0x3928a6[_0x244d('0x2f')];if(!_0x536d40[_0x244d('0x31')][_0x244d('0x38')](_0x244d('0x39'))){_0x26f11b[_0x244d('0x1d')]=qs[_0x244d('0x1d')](_0x536d40[_0x244d('0x31')][_0x244d('0x1d')]);_0x26f11b['offset']=qs[_0x244d('0x1c')](_0x536d40[_0x244d('0x31')][_0x244d('0x1c')]);}_0x26f11b['order']=qs['sort'](_0x536d40[_0x244d('0x31')]['sort']);_0x26f11b[_0x244d('0x3a')]=qs[_0x244d('0x33')](_['pick'](_0x536d40['query'],_0x3928a6[_0x244d('0x33')]),_0x4ab652);if(_0x536d40[_0x244d('0x31')][_0x244d('0x3b')]){_0x26f11b[_0x244d('0x3a')]=_[_0x244d('0x3c')](_0x26f11b['where'],{'$or':_[_0x244d('0x30')](_0x4ab652,function(_0x1f05f8){if(_0x1f05f8[_0x244d('0x2d')]!=='VIRTUAL'){var _0x4e16ab={};_0x4e16ab[_0x1f05f8[_0x244d('0x27')]]={'$like':'%'+_0x536d40[_0x244d('0x31')][_0x244d('0x3b')]+'%'};return _0x4e16ab;}})});}_0x26f11b=_[_0x244d('0x3c')]({},_0x26f11b,_0x536d40[_0x244d('0x3d')]);var _0x2848b9={'where':_0x26f11b[_0x244d('0x3a')]};return db[_0x244d('0x2a')][_0x244d('0x1f')](_0x2848b9)[_0x244d('0x24')](function(_0x5c2a25){_0x43dc48['count']=_0x5c2a25;if(_0x536d40[_0x244d('0x31')]['includeAll']){_0x26f11b[_0x244d('0x3e')]=[{'all':!![]}];}return db[_0x244d('0x2a')]['findAll'](_0x26f11b);})[_0x244d('0x24')](function(_0x5ee49d){_0x43dc48['rows']=_0x5ee49d;return _0x43dc48;})['then'](respondWithFilteredResult(_0x24f37c,_0x26f11b))[_0x244d('0x3f')](handleError(_0x24f37c,null));};exports['show']=function(_0x1ebda7,_0x2b4ff4){var _0x4f4cd1={'raw':!![],'where':{'id':_0x1ebda7[_0x244d('0x40')]['id']}},_0x5b708b={};_0x5b708b[_0x244d('0x2f')]=_['keys'](db[_0x244d('0x2a')]['rawAttributes']);_0x5b708b[_0x244d('0x31')]=_[_0x244d('0x32')](_0x1ebda7[_0x244d('0x31')]);_0x5b708b['filters']=_[_0x244d('0x34')](_0x5b708b[_0x244d('0x2f')],_0x5b708b[_0x244d('0x31')]);_0x4f4cd1[_0x244d('0x36')]=_['intersection'](_0x5b708b[_0x244d('0x2f')],qs[_0x244d('0x35')](_0x1ebda7[_0x244d('0x31')]['fields']));_0x4f4cd1[_0x244d('0x36')]=_0x4f4cd1[_0x244d('0x36')][_0x244d('0x37')]?_0x4f4cd1['attributes']:_0x5b708b['model'];if(_0x1ebda7[_0x244d('0x31')][_0x244d('0x41')]){_0x4f4cd1[_0x244d('0x3e')]=[{'all':!![]}];}_0x4f4cd1=_[_0x244d('0x3c')]({},_0x4f4cd1,_0x1ebda7[_0x244d('0x3d')]);return db[_0x244d('0x2a')]['find'](_0x4f4cd1)['then'](handleEntityNotFound(_0x2b4ff4,null))[_0x244d('0x24')](respondWithResult(_0x2b4ff4,null))['catch'](handleError(_0x2b4ff4,null));};exports[_0x244d('0x42')]=function(_0x21a5b2,_0x3c8db3){return db[_0x244d('0x2a')]['create'](_0x21a5b2[_0x244d('0x43')],{})[_0x244d('0x24')](respondWithResult(_0x3c8db3,0xc9))[_0x244d('0x3f')](handleError(_0x3c8db3,null));};exports['update']=function(_0x1c4f9d,_0x2d41b8){if(_0x1c4f9d[_0x244d('0x43')]['id']){delete _0x1c4f9d[_0x244d('0x43')]['id'];}return db[_0x244d('0x2a')][_0x244d('0x44')]({'where':{'id':_0x1c4f9d[_0x244d('0x40')]['id']}})[_0x244d('0x24')](handleEntityNotFound(_0x2d41b8,null))[_0x244d('0x24')](saveUpdates(_0x1c4f9d[_0x244d('0x43')],null))[_0x244d('0x24')](respondWithResult(_0x2d41b8,null))[_0x244d('0x3f')](handleError(_0x2d41b8,null));};exports[_0x244d('0x45')]=function(_0x4394c6,_0x5a7365){return db[_0x244d('0x2a')][_0x244d('0x44')]({'where':{'id':_0x4394c6[_0x244d('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a7365,null))[_0x244d('0x24')](removeEntity(_0x5a7365,null))[_0x244d('0x3f')](handleError(_0x5a7365,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 38f6e66..78173ec 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 _0x4fc9=['api','moment','bluebird','request-promise','path','rimraf','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4fc9,0xb5));var _0x94fc=function(_0x512bd3,_0xabe09){_0x512bd3=_0x512bd3-0x0;var _0x212dc8=_0x4fc9[_0x512bd3];return _0x212dc8;};'use strict';var _=require('lodash');var util=require(_0x94fc('0x0'));var logger=require('../../config/logger')(_0x94fc('0x1'));var moment=require(_0x94fc('0x2'));var BPromise=require(_0x94fc('0x3'));var rp=require(_0x94fc('0x4'));var fs=require('fs');var path=require(_0x94fc('0x5'));var rimraf=require(_0x94fc('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x94fc('0x7')]=function(_0x3bb28e,_0x251016){return _0x3bb28e[_0x94fc('0x8')]('ZendeskField',attributes,{'tableName':_0x94fc('0x9'),'paranoid':![],'indexes':[{'name':_0x94fc('0xa'),'fields':[_0x94fc('0xb'),_0x94fc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5dd5=['../../config/environment','define','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x5928a7,_0x54b674){var _0x1fb0dc=function(_0x306388){while(--_0x306388){_0x5928a7['push'](_0x5928a7['shift']());}};_0x1fb0dc(++_0x54b674);}(_0x5dd5,0x186));var _0x55dd=function(_0x432f6a,_0x253cd0){_0x432f6a=_0x432f6a-0x0;var _0x2f100e=_0x5dd5[_0x432f6a];return _0x2f100e;};'use strict';var _=require(_0x55dd('0x0'));var util=require(_0x55dd('0x1'));var logger=require(_0x55dd('0x2'))('api');var moment=require(_0x55dd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x55dd('0x4'));var rimraf=require(_0x55dd('0x5'));var config=require(_0x55dd('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x100dd0,_0x3234f1){return _0x100dd0[_0x55dd('0x7')]('ZendeskField',attributes,{'tableName':_0x55dd('0x8'),'paranoid':![],'indexes':[{'name':_0x55dd('0x9'),'fields':[_0x55dd('0xa'),'FieldId'],'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 8fbe3fe..8fbe734 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 _0x983e=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c18f8,_0x4d1990){var _0x41102b=function(_0x51a095){while(--_0x51a095){_0x5c18f8['push'](_0x5c18f8['shift']());}};_0x41102b(++_0x4d1990);}(_0x983e,0x100));var _0xe983=function(_0x477411,_0x1b1b92){_0x477411=_0x477411-0x0;var _0x4052b0=_0x983e[_0x477411];return _0x4052b0;};'use strict';var _=require(_0xe983('0x0'));var util=require(_0xe983('0x1'));var moment=require('moment');var BPromise=require(_0xe983('0x2'));var rs=require(_0xe983('0x3'));var fs=require('fs');var Redis=require(_0xe983('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe983('0x5'));var config=require(_0xe983('0x6'));var jayson=require(_0xe983('0x7'));var client=jayson[_0xe983('0x8')][_0xe983('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c0e3,_0xa5edb0,_0x3c6f13){return new BPromise(function(_0x2a8fe2,_0xa5d35d){return client[_0xe983('0xa')](_0x20c0e3,_0x3c6f13)[_0xe983('0xb')](function(_0x3ab20f){logger[_0xe983('0xc')](_0xe983('0xd'),_0xa5edb0,_0xe983('0xe'));logger['debug'](_0xe983('0xf'),_0xa5edb0,_0xe983('0xe'),JSON[_0xe983('0x10')](_0x3ab20f));if(_0x3ab20f[_0xe983('0x11')]){if(_0x3ab20f[_0xe983('0x11')][_0xe983('0x12')]===0x1f4){logger['error'](_0xe983('0xd'),_0xa5edb0,_0x3ab20f[_0xe983('0x11')][_0xe983('0x13')]);return _0xa5d35d(_0x3ab20f[_0xe983('0x11')][_0xe983('0x13')]);}logger[_0xe983('0x11')](_0xe983('0xd'),_0xa5edb0,_0x3ab20f[_0xe983('0x11')][_0xe983('0x13')]);return _0x2a8fe2(_0x3ab20f['error']['message']);}else{logger[_0xe983('0xc')]('ZendeskField,\x20%s,\x20%s',_0xa5edb0,_0xe983('0xe'));_0x2a8fe2(_0x3ab20f['result'][_0xe983('0x13')]);}})[_0xe983('0x14')](function(_0x453ab7){logger[_0xe983('0x11')](_0xe983('0xd'),_0xa5edb0,_0x453ab7);_0xa5d35d(_0x453ab7);});});} \ No newline at end of file +var _0xeeae=['request','then','info','request\x20sent','debug','stringify','error','ZendeskField,\x20%s,\x20%s','message','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x16f13c,_0x38afba){var _0x36aac1=function(_0x21866d){while(--_0x21866d){_0x16f13c['push'](_0x16f13c['shift']());}};_0x36aac1(++_0x38afba);}(_0xeeae,0x13a));var _0xeeea=function(_0x542d6b,_0x1615bd){_0x542d6b=_0x542d6b-0x0;var _0x22d616=_0xeeae[_0x542d6b];return _0x22d616;};'use strict';var _=require(_0xeeea('0x0'));var util=require('util');var moment=require(_0xeeea('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeea('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeea('0x3'));var logger=require(_0xeeea('0x4'))('rpc');var config=require(_0xeeea('0x5'));var jayson=require(_0xeeea('0x6'));var client=jayson[_0xeeea('0x7')][_0xeeea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ae566,_0x4b6a2c,_0x26624e){return new BPromise(function(_0x21923e,_0x31217){return client[_0xeeea('0x9')](_0x3ae566,_0x26624e)[_0xeeea('0xa')](function(_0x203303){logger[_0xeeea('0xb')]('ZendeskField,\x20%s,\x20%s',_0x4b6a2c,_0xeeea('0xc'));logger[_0xeeea('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4b6a2c,_0xeeea('0xc'),JSON[_0xeeea('0xe')](_0x203303));if(_0x203303['error']){if(_0x203303[_0xeeea('0xf')]['code']===0x1f4){logger[_0xeeea('0xf')](_0xeeea('0x10'),_0x4b6a2c,_0x203303[_0xeeea('0xf')]['message']);return _0x31217(_0x203303[_0xeeea('0xf')][_0xeeea('0x11')]);}logger['error'](_0xeeea('0x10'),_0x4b6a2c,_0x203303['error']['message']);return _0x21923e(_0x203303[_0xeeea('0xf')][_0xeeea('0x11')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x4b6a2c,'request\x20sent');_0x21923e(_0x203303['result'][_0xeeea('0x11')]);}})[_0xeeea('0x12')](function(_0x343424){logger[_0xeeea('0xf')](_0xeeea('0x10'),_0x4b6a2c,_0x343424);_0x31217(_0x343424);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ee74b6a..7855e56 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 _0x1b96=['index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated'];(function(_0x245275,_0x2e2c4d){var _0x1cdad1=function(_0x4838c4){while(--_0x4838c4){_0x245275['push'](_0x245275['shift']());}};_0x1cdad1(++_0x2e2c4d);}(_0x1b96,0xfe));var _0x61b9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1b96[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x61b9('0x0'));var util=require(_0x61b9('0x1'));var path=require('path');var timeout=require(_0x61b9('0x2'));var express=require('express');var router=express[_0x61b9('0x3')]();var fs_extra=require(_0x61b9('0x4'));var auth=require(_0x61b9('0x5'));var interaction=require(_0x61b9('0x6'));var config=require(_0x61b9('0x7'));var controller=require(_0x61b9('0x8'));router['get']('/',auth[_0x61b9('0x9')](),controller[_0x61b9('0xa')]);router[_0x61b9('0xb')](_0x61b9('0xc'),auth[_0x61b9('0x9')](),controller[_0x61b9('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x61b9('0xe')]);router['get'](_0x61b9('0xf'),auth['isAuthenticated'](),controller[_0x61b9('0x10')]);router[_0x61b9('0x11')]('/',auth[_0x61b9('0x9')](),controller[_0x61b9('0x12')]);router[_0x61b9('0x11')](_0x61b9('0x13'),auth[_0x61b9('0x9')](),controller['addConfiguration']);router[_0x61b9('0x14')](_0x61b9('0xc'),auth[_0x61b9('0x9')](),controller[_0x61b9('0x15')]);router[_0x61b9('0x16')](_0x61b9('0xc'),auth[_0x61b9('0x9')](),controller['destroy']);module[_0x61b9('0x17')]=router; \ No newline at end of file +var _0x4e5b=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','getConfigurations','getFields','post','/:id/configurations','addConfiguration','update','delete','destroy','exports'];(function(_0x2a835f,_0x57d71c){var _0xea4df4=function(_0x5f2743){while(--_0x5f2743){_0x2a835f['push'](_0x2a835f['shift']());}};_0xea4df4(++_0x57d71c);}(_0x4e5b,0x69));var _0xb4e5=function(_0x47408c,_0x16984f){_0x47408c=_0x47408c-0x0;var _0x553932=_0x4e5b[_0x47408c];return _0x553932;};'use strict';var multer=require(_0xb4e5('0x0'));var util=require(_0xb4e5('0x1'));var path=require(_0xb4e5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb4e5('0x3')]();var fs_extra=require(_0xb4e5('0x4'));var auth=require(_0xb4e5('0x5'));var interaction=require(_0xb4e5('0x6'));var config=require(_0xb4e5('0x7'));var controller=require(_0xb4e5('0x8'));router[_0xb4e5('0x9')]('/',auth[_0xb4e5('0xa')](),controller['index']);router['get'](_0xb4e5('0xb'),auth[_0xb4e5('0xa')](),controller['show']);router[_0xb4e5('0x9')]('/:id/configurations',auth[_0xb4e5('0xa')](),controller[_0xb4e5('0xc')]);router[_0xb4e5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb4e5('0xd')]);router[_0xb4e5('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb4e5('0xe')](_0xb4e5('0xf'),auth[_0xb4e5('0xa')](),controller[_0xb4e5('0x10')]);router['put'](_0xb4e5('0xb'),auth[_0xb4e5('0xa')](),controller[_0xb4e5('0x11')]);router[_0xb4e5('0x12')](_0xb4e5('0xb'),auth[_0xb4e5('0xa')](),controller[_0xb4e5('0x13')]);module[_0xb4e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 4b2292b..eafa6d1 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 _0x702d=['sequelize','exports','STRING'];(function(_0xdbea9d,_0x14fbf6){var _0x298662=function(_0x4cfe2a){while(--_0x4cfe2a){_0xdbea9d['push'](_0xdbea9d['shift']());}};_0x298662(++_0x14fbf6);}(_0x702d,0x147));var _0xd702=function(_0x35d3bd,_0x5e292b){_0x35d3bd=_0x35d3bd-0x0;var _0x1ca549=_0x702d[_0x35d3bd];return _0x1ca549;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17ba=['sequelize','exports','STRING'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0x17ba,0xab));var _0xa17b=function(_0x35b36b,_0x54f687){_0x35b36b=_0x35b36b-0x0;var _0x381c54=_0x17ba[_0x35b36b];return _0x381c54;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3219446..7276748 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 _0x8a33=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','getConfigurations','ZohoConfiguration','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x3e7c97,_0x506923){var _0x1310e5=function(_0x44df70){while(--_0x44df70){_0x3e7c97['push'](_0x3e7c97['shift']());}};_0x1310e5(++_0x506923);}(_0x8a33,0x179));var _0x38a3=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0x8a33[_0x2d4340];return _0x5a2e9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38a3('0x0'));var zipdir=require(_0x38a3('0x1'));var jsonpatch=require(_0x38a3('0x2'));var rp=require(_0x38a3('0x3'));var moment=require('moment');var BPromise=require(_0x38a3('0x4'));var Mustache=require(_0x38a3('0x5'));var util=require(_0x38a3('0x6'));var path=require(_0x38a3('0x7'));var sox=require(_0x38a3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38a3('0x9'));var _=require(_0x38a3('0xa'));var squel=require('squel');var crypto=require(_0x38a3('0xb'));var jsforce=require(_0x38a3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x38a3('0xd'));var Papa=require(_0x38a3('0xe'));var Redis=require(_0x38a3('0xf'));var authService=require(_0x38a3('0x10'));var qs=require(_0x38a3('0x11'));var as=require(_0x38a3('0x12'));var hardwareService=require(_0x38a3('0x13'));var logger=require(_0x38a3('0x14'))('api');var utils=require(_0x38a3('0x15'));var config=require(_0x38a3('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x373232,_0x271151){_0x271151=_0x271151||0xcc;return function(_0x3009f6){if(_0x3009f6){return _0x373232[_0x38a3('0x17')](_0x271151);}return _0x373232['status'](_0x271151)[_0x38a3('0x18')]();};}function respondWithResult(_0x502d74,_0x37e4f4){_0x37e4f4=_0x37e4f4||0xc8;return function(_0x249e0a){if(_0x249e0a){return _0x502d74[_0x38a3('0x19')](_0x37e4f4)[_0x38a3('0x1a')](_0x249e0a);}};}function respondWithFilteredResult(_0x31c927,_0x1e516b){return function(_0x2ff045){if(_0x2ff045){var _0x1bee02=typeof _0x1e516b[_0x38a3('0x1b')]===_0x38a3('0x1c')&&typeof _0x1e516b[_0x38a3('0x1d')]===_0x38a3('0x1c');var _0x4fdaa9=_0x2ff045['count'];var _0x3160b0=_0x1bee02?0x0:_0x1e516b[_0x38a3('0x1b')];var _0x32f4b8=_0x1bee02?_0x2ff045[_0x38a3('0x1e')]:_0x1e516b[_0x38a3('0x1b')]+_0x1e516b['limit'];var _0x57847b;if(_0x32f4b8>=_0x4fdaa9){_0x32f4b8=_0x4fdaa9;_0x57847b=0xc8;}else{_0x57847b=0xce;}_0x31c927[_0x38a3('0x19')](_0x57847b);return _0x31c927[_0x38a3('0x1f')]('Content-Range',_0x3160b0+'-'+_0x32f4b8+'/'+_0x4fdaa9)[_0x38a3('0x1a')](_0x2ff045);}return null;};}function patchUpdates(_0x4c8ff9){return function(_0x1e3a1c){try{jsonpatch[_0x38a3('0x20')](_0x1e3a1c,_0x4c8ff9,!![]);}catch(_0x4be72f){return BPromise[_0x38a3('0x21')](_0x4be72f);}return _0x1e3a1c[_0x38a3('0x22')]();};}function saveUpdates(_0x52b784,_0x3e3522){return function(_0x313bbf){if(_0x313bbf){return _0x313bbf[_0x38a3('0x23')](_0x52b784)[_0x38a3('0x24')](function(_0x4cab5d){return _0x4cab5d;});}return null;};}function removeEntity(_0x4441df,_0x470a39){return function(_0x483eac){if(_0x483eac){return _0x483eac[_0x38a3('0x25')]()['then'](function(){_0x4441df[_0x38a3('0x19')](0xcc)[_0x38a3('0x18')]();});}};}function handleEntityNotFound(_0x1a5b9e,_0x4f0e01){return function(_0x5428f3){if(!_0x5428f3){_0x1a5b9e['sendStatus'](0x194);}return _0x5428f3;};}function handleError(_0x4970f7,_0xd8b695){_0xd8b695=_0xd8b695||0x1f4;return function(_0x3fca49){logger[_0x38a3('0x26')](_0x3fca49[_0x38a3('0x27')]);if(_0x3fca49[_0x38a3('0x28')]){delete _0x3fca49[_0x38a3('0x28')];}_0x4970f7['status'](_0xd8b695)[_0x38a3('0x29')](_0x3fca49);};}exports[_0x38a3('0x2a')]=function(_0x1abb91,_0x19d5f8){var _0x358973={},_0x598a5e={},_0x164d01={'count':0x0,'rows':[]};var _0xb9ea26=_[_0x38a3('0x2b')](db[_0x38a3('0x2c')][_0x38a3('0x2d')],function(_0x36631a){return{'name':_0x36631a[_0x38a3('0x2e')],'type':_0x36631a['type']['key']};});_0x598a5e[_0x38a3('0x2f')]=_[_0x38a3('0x2b')](_0xb9ea26,'name');_0x598a5e[_0x38a3('0x30')]=_[_0x38a3('0x31')](_0x1abb91[_0x38a3('0x30')]);_0x598a5e[_0x38a3('0x32')]=_['intersection'](_0x598a5e[_0x38a3('0x2f')],_0x598a5e[_0x38a3('0x30')]);_0x358973['attributes']=_[_0x38a3('0x33')](_0x598a5e[_0x38a3('0x2f')],qs[_0x38a3('0x34')](_0x1abb91[_0x38a3('0x30')]['fields']));_0x358973[_0x38a3('0x35')]=_0x358973[_0x38a3('0x35')]['length']?_0x358973[_0x38a3('0x35')]:_0x598a5e[_0x38a3('0x2f')];if(!_0x1abb91[_0x38a3('0x30')][_0x38a3('0x36')](_0x38a3('0x37'))){_0x358973['limit']=qs['limit'](_0x1abb91[_0x38a3('0x30')]['limit']);_0x358973[_0x38a3('0x1b')]=qs[_0x38a3('0x1b')](_0x1abb91['query'][_0x38a3('0x1b')]);}_0x358973[_0x38a3('0x38')]=qs[_0x38a3('0x39')](_0x1abb91[_0x38a3('0x30')][_0x38a3('0x39')]);_0x358973[_0x38a3('0x3a')]=qs['filters'](_[_0x38a3('0x3b')](_0x1abb91[_0x38a3('0x30')],_0x598a5e[_0x38a3('0x32')]),_0xb9ea26);if(_0x1abb91['query'][_0x38a3('0x3c')]){_0x358973[_0x38a3('0x3a')]=_[_0x38a3('0x3d')](_0x358973[_0x38a3('0x3a')],{'$or':_[_0x38a3('0x2b')](_0xb9ea26,function(_0x2c861e){if(_0x2c861e[_0x38a3('0x3e')]!==_0x38a3('0x3f')){var _0x5405c9={};_0x5405c9[_0x2c861e[_0x38a3('0x28')]]={'$like':'%'+_0x1abb91['query']['filter']+'%'};return _0x5405c9;}})});}_0x358973=_['merge']({},_0x358973,_0x1abb91[_0x38a3('0x40')]);var _0x2a7a8f={'where':_0x358973['where']};return db['ZohoAccount'][_0x38a3('0x1e')](_0x2a7a8f)['then'](function(_0x3e022e){_0x164d01[_0x38a3('0x1e')]=_0x3e022e;if(_0x1abb91['query'][_0x38a3('0x41')]){_0x358973['include']=[{'all':!![]}];}return db[_0x38a3('0x2c')][_0x38a3('0x42')](_0x358973);})['then'](function(_0x4a4e39){_0x164d01[_0x38a3('0x43')]=_0x4a4e39;return _0x164d01;})['then'](respondWithFilteredResult(_0x19d5f8,_0x358973))['catch'](handleError(_0x19d5f8,null));};exports[_0x38a3('0x44')]=function(_0x2faa74,_0x482170){var _0x139037={'raw':![],'where':{'id':_0x2faa74[_0x38a3('0x45')]['id']}},_0x5dbf35={};_0x5dbf35[_0x38a3('0x2f')]=_['keys'](db[_0x38a3('0x2c')]['rawAttributes']);_0x5dbf35[_0x38a3('0x30')]=_[_0x38a3('0x31')](_0x2faa74[_0x38a3('0x30')]);_0x5dbf35[_0x38a3('0x32')]=_[_0x38a3('0x33')](_0x5dbf35[_0x38a3('0x2f')],_0x5dbf35['query']);_0x139037[_0x38a3('0x35')]=_[_0x38a3('0x33')](_0x5dbf35[_0x38a3('0x2f')],qs['fields'](_0x2faa74['query'][_0x38a3('0x34')]));_0x139037[_0x38a3('0x35')]=_0x139037[_0x38a3('0x35')]['length']?_0x139037['attributes']:_0x5dbf35['model'];if(_0x2faa74[_0x38a3('0x30')][_0x38a3('0x41')]){_0x139037['include']=[{'all':!![]}];}_0x139037=_[_0x38a3('0x3d')]({},_0x139037,_0x2faa74['options']);return db[_0x38a3('0x2c')][_0x38a3('0x46')](_0x139037)[_0x38a3('0x24')](handleEntityNotFound(_0x482170,null))[_0x38a3('0x24')](respondWithResult(_0x482170,null))[_0x38a3('0x47')](handleError(_0x482170,null));};exports[_0x38a3('0x48')]=function(_0x275937,_0x3ae304){return db[_0x38a3('0x2c')][_0x38a3('0x48')](_0x275937[_0x38a3('0x49')],{})[_0x38a3('0x24')](respondWithResult(_0x3ae304,0xc9))[_0x38a3('0x47')](handleError(_0x3ae304,null));};exports['update']=function(_0x28ef1d,_0x5c3acc){if(_0x28ef1d['body']['id']){delete _0x28ef1d[_0x38a3('0x49')]['id'];}return db[_0x38a3('0x2c')][_0x38a3('0x46')]({'where':{'id':_0x28ef1d[_0x38a3('0x45')]['id']}})[_0x38a3('0x24')](handleEntityNotFound(_0x5c3acc,null))[_0x38a3('0x24')](saveUpdates(_0x28ef1d[_0x38a3('0x49')],null))[_0x38a3('0x24')](respondWithResult(_0x5c3acc,null))[_0x38a3('0x47')](handleError(_0x5c3acc,null));};exports[_0x38a3('0x25')]=function(_0x1f560a,_0x37038c){return db['ZohoAccount']['find']({'where':{'id':_0x1f560a[_0x38a3('0x45')]['id']}})[_0x38a3('0x24')](handleEntityNotFound(_0x37038c,null))['then'](removeEntity(_0x37038c,null))[_0x38a3('0x47')](handleError(_0x37038c,null));};exports[_0x38a3('0x4a')]=function(_0x51d262,_0x382e0f,_0x440563){var _0x51f55f={};var _0x2281b1={};var _0x5a6f93;var _0x221ba6;return db[_0x38a3('0x2c')]['findOne']({'where':{'id':_0x51d262['params']['id']}})[_0x38a3('0x24')](handleEntityNotFound(_0x382e0f,null))['then'](function(_0x59a583){if(_0x59a583){_0x5a6f93=_0x59a583;_0x2281b1[_0x38a3('0x2f')]=_[_0x38a3('0x31')](db[_0x38a3('0x4b')][_0x38a3('0x2d')]);_0x2281b1[_0x38a3('0x30')]=_[_0x38a3('0x31')](_0x51d262[_0x38a3('0x30')]);_0x2281b1['filters']=_[_0x38a3('0x33')](_0x2281b1[_0x38a3('0x2f')],_0x2281b1['query']);_0x51f55f['attributes']=_['intersection'](_0x2281b1[_0x38a3('0x2f')],qs[_0x38a3('0x34')](_0x51d262[_0x38a3('0x30')][_0x38a3('0x34')]));_0x51f55f[_0x38a3('0x35')]=_0x51f55f[_0x38a3('0x35')][_0x38a3('0x4c')]?_0x51f55f[_0x38a3('0x35')]:_0x2281b1[_0x38a3('0x2f')];_0x51f55f[_0x38a3('0x38')]=qs[_0x38a3('0x39')](_0x51d262[_0x38a3('0x30')][_0x38a3('0x39')]);_0x51f55f[_0x38a3('0x3a')]=qs[_0x38a3('0x32')](_[_0x38a3('0x3b')](_0x51d262['query'],_0x2281b1[_0x38a3('0x32')]));if(_0x51d262[_0x38a3('0x30')][_0x38a3('0x3c')]){_0x51f55f['where']=_[_0x38a3('0x3d')](_0x51f55f[_0x38a3('0x3a')],{'$or':_[_0x38a3('0x2b')](_0x51f55f[_0x38a3('0x35')],function(_0x3103ef){var _0x222c17={};_0x222c17[_0x3103ef]={'$like':'%'+_0x51d262[_0x38a3('0x30')][_0x38a3('0x3c')]+'%'};return _0x222c17;})});}_0x51f55f=_[_0x38a3('0x3d')]({},_0x51f55f,_0x51d262['options']);return _0x5a6f93['getConfigurations'](_0x51f55f);}})[_0x38a3('0x24')](function(_0x122c9d){if(_0x122c9d){_0x221ba6=_0x122c9d[_0x38a3('0x4c')];if(!_0x51d262[_0x38a3('0x30')][_0x38a3('0x36')]('nolimit')){_0x51f55f[_0x38a3('0x1d')]=qs[_0x38a3('0x1d')](_0x51d262['query'][_0x38a3('0x1d')]);_0x51f55f['offset']=qs[_0x38a3('0x1b')](_0x51d262['query'][_0x38a3('0x1b')]);}return _0x5a6f93[_0x38a3('0x4a')](_0x51f55f);}})[_0x38a3('0x24')](function(_0x5ef0fe){if(_0x5ef0fe){return _0x5ef0fe?{'count':_0x221ba6,'rows':_0x5ef0fe}:null;}})[_0x38a3('0x24')](respondWithResult(_0x382e0f,null))[_0x38a3('0x47')](handleError(_0x382e0f,null));};exports[_0x38a3('0x4d')]=function(_0x16a782,_0x30aca1,_0x26f5d6){if(_0x16a782[_0x38a3('0x49')]['id']){delete _0x16a782[_0x38a3('0x49')]['id'];}return db[_0x38a3('0x2c')][_0x38a3('0x4e')]({'where':{'id':_0x16a782[_0x38a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x30aca1,null))[_0x38a3('0x24')](function(_0x414087){if(_0x414087){_0x16a782[_0x38a3('0x49')][_0x38a3('0x4f')]=_0x414087['id'];_0x16a782[_0x38a3('0x49')][_0x38a3('0x50')]=integrations[_0x38a3('0x51')](_0x16a782[_0x38a3('0x49')][_0x38a3('0x52')],_0x16a782[_0x38a3('0x49')]['type']);_0x16a782['body'][_0x38a3('0x53')]=integrations[_0x38a3('0x54')](_0x16a782['body'][_0x38a3('0x52')],_0x16a782['body'][_0x38a3('0x3e')]);return db[_0x38a3('0x4b')][_0x38a3('0x48')](_0x16a782[_0x38a3('0x49')],{'include':[{'model':db[_0x38a3('0x55')],'as':_0x38a3('0x50')},{'model':db[_0x38a3('0x55')],'as':_0x38a3('0x53')}]});}return null;})[_0x38a3('0x24')](respondWithResult(_0x30aca1,null))[_0x38a3('0x47')](handleError(_0x30aca1,null));};function getAccessToken(_0x37a4bb){return new Promise(function(_0x3ef714,_0x200126){var _0x21c247;switch(_0x37a4bb[_0x38a3('0x56')]){case'US':_0x21c247=_0x38a3('0x57');break;case'AU':_0x21c247=_0x38a3('0x58');break;case'EU':_0x21c247='https://accounts.zoho.eu';break;case'IN':_0x21c247='https://accounts.zoho.in';break;case'CN':_0x21c247=_0x38a3('0x59');break;default:_0x21c247=_0x38a3('0x5a');break;}var _0x219c2e={'method':_0x38a3('0x5b'),'uri':_0x21c247+_0x38a3('0x5c'),'qs':{'refresh_token':_0x37a4bb[_0x38a3('0x5d')],'client_id':_0x37a4bb[_0x38a3('0x5e')],'client_secret':_0x37a4bb['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x219c2e)[_0x38a3('0x24')](function(_0x3b2ff6){if(_0x3b2ff6['access_token']){_0x3ef714(_0x3b2ff6[_0x38a3('0x5f')]);}else{_0x200126(_0x38a3('0x60'));}})[_0x38a3('0x47')](function(_0x23e370){_0x200126(_0x23e370);});});}exports[_0x38a3('0x61')]=function(_0x33bca9,_0x4dffa3,_0x6f754f){var _0x4171a9,_0x1cef05,_0x3f0a98,_0x47f291,_0x3a74d9;return db['ZohoAccount'][_0x38a3('0x4e')]({'where':{'id':_0x33bca9[_0x38a3('0x45')]['id']},'attributes':['id',_0x38a3('0x62'),_0x38a3('0x56'),_0x38a3('0x5e'),_0x38a3('0x63'),_0x38a3('0x64'),_0x38a3('0x65'),_0x38a3('0x5d')]})[_0x38a3('0x24')](handleEntityNotFound(_0x4dffa3,null))['then'](function(_0x37f254){_0x3a74d9=_0x37f254;_0x4171a9=_0x3a74d9[_0x38a3('0x62')];_0x1cef05=_0x4171a9===_0x38a3('0x66')?'eu':_0x38a3('0x67');_0x3f0a98=_0x3a74d9['serverUrl'];var _0x12a9bf=_0x3f0a98[_0x38a3('0x68')](-0x1);if(_0x12a9bf==='/'||_0x12a9bf==='\x5c'||_0x12a9bf===':'){_0x3f0a98=_0x3f0a98[_0x38a3('0x69')](0x0,_0x3f0a98[_0x38a3('0x6a')](_0x12a9bf));}if(!_0x3a74d9[_0x38a3('0x5d')]){throw new Error(_0x38a3('0x6b'));}return getAccessToken(_0x3a74d9);})[_0x38a3('0x24')](function(_0x270341){if(_0x270341){return rp({'method':_0x38a3('0x6c'),'uri':util[_0x38a3('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1cef05),'qs':{'module':_0x38a3('0x6e')},'headers':{'Authorization':_0x38a3('0x6f')+_0x270341},'json':!![]});}})['then'](function(_0xde0c61){if(_0xde0c61){if(_0xde0c61[_0x38a3('0x70')]&&_0xde0c61[_0x38a3('0x70')][_0x38a3('0x26')]){throw new Error(_0xde0c61[_0x38a3('0x70')][_0x38a3('0x26')][_0x38a3('0x71')]);}var _0x237103=[];var _0x250f30=[];var _0x57371f=[_0x38a3('0x72'),_0x38a3('0x73'),_0x38a3('0x74'),_0x38a3('0x75'),_0x38a3('0x76'),_0x38a3('0x77'),_0x38a3('0x78'),'Call_Type'];_0x250f30=_[_0x38a3('0x79')](_0xde0c61[_0x38a3('0x34')],function(_0x19f4c6){return _0x57371f[_0x38a3('0x7a')](_0x19f4c6[_0x38a3('0x7b')]);});for(var _0x2f8196=0x0;_0x2f8196<_0x250f30[_0x38a3('0x4c')];_0x2f8196++){if(_0x250f30[_0x2f8196]['system_mandatory']===![]){_0x237103[_0x38a3('0x7c')]({'id':_0x250f30[_0x2f8196]['id'],'name':_0x250f30[_0x2f8196][_0x38a3('0x7d')],'custom':_0x250f30[_0x2f8196]['custom_field'],'options':_0x250f30[_0x2f8196][_0x38a3('0x7e')]===_0x38a3('0x7f')&&_0x250f30[_0x2f8196][_0x38a3('0x80')][_0x38a3('0x4c')]>-0x1?_[_0x38a3('0x2b')](_0x250f30[_0x2f8196][_0x38a3('0x80')],function(_0x211c97){return{'name':_0x211c97,'value':_0x211c97};}):[]});}}return{'count':_0x237103[_0x38a3('0x4c')],'rows':_0x237103};}else{return{'count':0x0,'rows':[]};}})[_0x38a3('0x24')](respondWithResult(_0x4dffa3,null))[_0x38a3('0x47')](function(_0x1bc167){var _0x26ab4d=_0x33bca9[_0x38a3('0x30')][_0x38a3('0x81')]?0x1f4:_0x1bc167[_0x38a3('0x82')]||0x1f4;logger[_0x38a3('0x26')](_0x38a3('0x83'),_0x38a3('0x61'),_0x26ab4d,JSON[_0x38a3('0x84')](_0x1bc167));delete _0x1bc167[_0x38a3('0x28')];if(_0x26ab4d===0x191){_0x26ab4d=0x190;}_0x4dffa3['status'](_0x26ab4d)[_0x38a3('0x29')](_0x33bca9[_0x38a3('0x30')][_0x38a3('0x81')]?{'message':_0x38a3('0x85'),'statusCode':_0x1bc167['statusCode']}:_0x1bc167);});}; \ No newline at end of file +var _0xb8a1=['slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Result','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','set','reject','save','update','destroy','then','end','error','stack','name','send','index','ZohoAccount','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body','params','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','code','refreshToken','zoho.eu','com'];(function(_0x42bf4f,_0x2fea05){var _0x2ed183=function(_0x2f0002){while(--_0x2f0002){_0x42bf4f['push'](_0x42bf4f['shift']());}};_0x2ed183(++_0x2fea05);}(_0xb8a1,0x90));var _0x1b8a=function(_0x48cc1a,_0x1ef81e){_0x48cc1a=_0x48cc1a-0x0;var _0x17093b=_0xb8a1[_0x48cc1a];return _0x17093b;};'use strict';var emlformat=require(_0x1b8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b8a('0x1'));var jsonpatch=require(_0x1b8a('0x2'));var rp=require(_0x1b8a('0x3'));var moment=require(_0x1b8a('0x4'));var BPromise=require(_0x1b8a('0x5'));var Mustache=require(_0x1b8a('0x6'));var util=require(_0x1b8a('0x7'));var path=require(_0x1b8a('0x8'));var sox=require(_0x1b8a('0x9'));var csv=require(_0x1b8a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b8a('0xb'));var squel=require('squel');var crypto=require(_0x1b8a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1b8a('0xd'));var toCsv=require(_0x1b8a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1b8a('0xe'));var qs=require(_0x1b8a('0xf'));var as=require(_0x1b8a('0x10'));var hardwareService=require(_0x1b8a('0x11'));var logger=require('../../config/logger')(_0x1b8a('0x12'));var utils=require(_0x1b8a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b8a('0x14'))['db'];var integrations=require(_0x1b8a('0x15'));function respondWithStatusCode(_0x398d96,_0x34f96b){_0x34f96b=_0x34f96b||0xcc;return function(_0x22d7c9){if(_0x22d7c9){return _0x398d96[_0x1b8a('0x16')](_0x34f96b);}return _0x398d96[_0x1b8a('0x17')](_0x34f96b)['end']();};}function respondWithResult(_0x1472ac,_0x293660){_0x293660=_0x293660||0xc8;return function(_0x3ccc41){if(_0x3ccc41){return _0x1472ac[_0x1b8a('0x17')](_0x293660)[_0x1b8a('0x18')](_0x3ccc41);}};}function respondWithFilteredResult(_0x100181,_0x239e21){return function(_0x52adc0){if(_0x52adc0){var _0x57c8e5=typeof _0x239e21[_0x1b8a('0x19')]==='undefined'&&typeof _0x239e21[_0x1b8a('0x1a')]==='undefined';var _0x1b771d=_0x52adc0[_0x1b8a('0x1b')];var _0x4bbf35=_0x57c8e5?0x0:_0x239e21[_0x1b8a('0x19')];var _0x4bb112=_0x57c8e5?_0x52adc0[_0x1b8a('0x1b')]:_0x239e21[_0x1b8a('0x19')]+_0x239e21[_0x1b8a('0x1a')];var _0x29cd16;if(_0x4bb112>=_0x1b771d){_0x4bb112=_0x1b771d;_0x29cd16=0xc8;}else{_0x29cd16=0xce;}_0x100181[_0x1b8a('0x17')](_0x29cd16);return _0x100181[_0x1b8a('0x1c')]('Content-Range',_0x4bbf35+'-'+_0x4bb112+'/'+_0x1b771d)['json'](_0x52adc0);}return null;};}function patchUpdates(_0x31d5b7){return function(_0x2c84ea){try{jsonpatch['apply'](_0x2c84ea,_0x31d5b7,!![]);}catch(_0x27ef3b){return BPromise[_0x1b8a('0x1d')](_0x27ef3b);}return _0x2c84ea[_0x1b8a('0x1e')]();};}function saveUpdates(_0x5c08ed,_0xbdcb54){return function(_0x4335f6){if(_0x4335f6){return _0x4335f6[_0x1b8a('0x1f')](_0x5c08ed)['then'](function(_0x3af76a){return _0x3af76a;});}return null;};}function removeEntity(_0x1d1762,_0xab42cc){return function(_0x4776c8){if(_0x4776c8){return _0x4776c8[_0x1b8a('0x20')]()[_0x1b8a('0x21')](function(){_0x1d1762[_0x1b8a('0x17')](0xcc)[_0x1b8a('0x22')]();});}};}function handleEntityNotFound(_0x12aabb,_0x185f50){return function(_0x4eb996){if(!_0x4eb996){_0x12aabb['sendStatus'](0x194);}return _0x4eb996;};}function handleError(_0x36ba96,_0x4d4870){_0x4d4870=_0x4d4870||0x1f4;return function(_0x62a31f){logger[_0x1b8a('0x23')](_0x62a31f[_0x1b8a('0x24')]);if(_0x62a31f[_0x1b8a('0x25')]){delete _0x62a31f[_0x1b8a('0x25')];}_0x36ba96[_0x1b8a('0x17')](_0x4d4870)[_0x1b8a('0x26')](_0x62a31f);};}exports[_0x1b8a('0x27')]=function(_0x266ab8,_0x1b0ab4){var _0x38d38e={},_0x442be3={},_0x5715a1={'count':0x0,'rows':[]};var _0x518a67=_['map'](db[_0x1b8a('0x28')][_0x1b8a('0x29')],function(_0x40f2c7){return{'name':_0x40f2c7['fieldName'],'type':_0x40f2c7[_0x1b8a('0x2a')][_0x1b8a('0x2b')]};});_0x442be3['model']=_[_0x1b8a('0x2c')](_0x518a67,'name');_0x442be3[_0x1b8a('0x2d')]=_['keys'](_0x266ab8['query']);_0x442be3[_0x1b8a('0x2e')]=_[_0x1b8a('0x2f')](_0x442be3[_0x1b8a('0x30')],_0x442be3[_0x1b8a('0x2d')]);_0x38d38e[_0x1b8a('0x31')]=_[_0x1b8a('0x2f')](_0x442be3[_0x1b8a('0x30')],qs[_0x1b8a('0x32')](_0x266ab8[_0x1b8a('0x2d')][_0x1b8a('0x32')]));_0x38d38e['attributes']=_0x38d38e[_0x1b8a('0x31')][_0x1b8a('0x33')]?_0x38d38e[_0x1b8a('0x31')]:_0x442be3[_0x1b8a('0x30')];if(!_0x266ab8[_0x1b8a('0x2d')][_0x1b8a('0x34')]('nolimit')){_0x38d38e[_0x1b8a('0x1a')]=qs[_0x1b8a('0x1a')](_0x266ab8[_0x1b8a('0x2d')][_0x1b8a('0x1a')]);_0x38d38e[_0x1b8a('0x19')]=qs[_0x1b8a('0x19')](_0x266ab8[_0x1b8a('0x2d')][_0x1b8a('0x19')]);}_0x38d38e['order']=qs[_0x1b8a('0x35')](_0x266ab8[_0x1b8a('0x2d')][_0x1b8a('0x35')]);_0x38d38e[_0x1b8a('0x36')]=qs['filters'](_[_0x1b8a('0x37')](_0x266ab8[_0x1b8a('0x2d')],_0x442be3[_0x1b8a('0x2e')]),_0x518a67);if(_0x266ab8[_0x1b8a('0x2d')][_0x1b8a('0x38')]){_0x38d38e['where']=_[_0x1b8a('0x39')](_0x38d38e[_0x1b8a('0x36')],{'$or':_[_0x1b8a('0x2c')](_0x518a67,function(_0x1803d8){if(_0x1803d8[_0x1b8a('0x2a')]!==_0x1b8a('0x3a')){var _0x412c6c={};_0x412c6c[_0x1803d8['name']]={'$like':'%'+_0x266ab8['query'][_0x1b8a('0x38')]+'%'};return _0x412c6c;}})});}_0x38d38e=_[_0x1b8a('0x39')]({},_0x38d38e,_0x266ab8['options']);var _0x5add84={'where':_0x38d38e[_0x1b8a('0x36')]};return db[_0x1b8a('0x28')]['count'](_0x5add84)[_0x1b8a('0x21')](function(_0x50d7b0){_0x5715a1[_0x1b8a('0x1b')]=_0x50d7b0;if(_0x266ab8[_0x1b8a('0x2d')][_0x1b8a('0x3b')]){_0x38d38e[_0x1b8a('0x3c')]=[{'all':!![]}];}return db[_0x1b8a('0x28')][_0x1b8a('0x3d')](_0x38d38e);})[_0x1b8a('0x21')](function(_0x40672a){_0x5715a1[_0x1b8a('0x3e')]=_0x40672a;return _0x5715a1;})['then'](respondWithFilteredResult(_0x1b0ab4,_0x38d38e))['catch'](handleError(_0x1b0ab4,null));};exports[_0x1b8a('0x3f')]=function(_0xf103fb,_0x16d8ad){var _0x399e75={'raw':![],'where':{'id':_0xf103fb['params']['id']}},_0x1a5942={};_0x1a5942[_0x1b8a('0x30')]=_[_0x1b8a('0x40')](db['ZohoAccount'][_0x1b8a('0x29')]);_0x1a5942[_0x1b8a('0x2d')]=_[_0x1b8a('0x40')](_0xf103fb[_0x1b8a('0x2d')]);_0x1a5942[_0x1b8a('0x2e')]=_[_0x1b8a('0x2f')](_0x1a5942[_0x1b8a('0x30')],_0x1a5942['query']);_0x399e75['attributes']=_[_0x1b8a('0x2f')](_0x1a5942[_0x1b8a('0x30')],qs[_0x1b8a('0x32')](_0xf103fb[_0x1b8a('0x2d')][_0x1b8a('0x32')]));_0x399e75[_0x1b8a('0x31')]=_0x399e75[_0x1b8a('0x31')][_0x1b8a('0x33')]?_0x399e75['attributes']:_0x1a5942[_0x1b8a('0x30')];if(_0xf103fb[_0x1b8a('0x2d')]['includeAll']){_0x399e75[_0x1b8a('0x3c')]=[{'all':!![]}];}_0x399e75=_['merge']({},_0x399e75,_0xf103fb[_0x1b8a('0x41')]);return db[_0x1b8a('0x28')][_0x1b8a('0x42')](_0x399e75)[_0x1b8a('0x21')](handleEntityNotFound(_0x16d8ad,null))['then'](respondWithResult(_0x16d8ad,null))[_0x1b8a('0x43')](handleError(_0x16d8ad,null));};exports['create']=function(_0x19d464,_0x356ece){return db[_0x1b8a('0x28')][_0x1b8a('0x44')](_0x19d464[_0x1b8a('0x45')],{})['then'](respondWithResult(_0x356ece,0xc9))[_0x1b8a('0x43')](handleError(_0x356ece,null));};exports[_0x1b8a('0x1f')]=function(_0x25da0e,_0xb5c150){if(_0x25da0e[_0x1b8a('0x45')]['id']){delete _0x25da0e['body']['id'];}return db[_0x1b8a('0x28')][_0x1b8a('0x42')]({'where':{'id':_0x25da0e[_0x1b8a('0x46')]['id']}})[_0x1b8a('0x21')](handleEntityNotFound(_0xb5c150,null))[_0x1b8a('0x21')](saveUpdates(_0x25da0e[_0x1b8a('0x45')],null))[_0x1b8a('0x21')](respondWithResult(_0xb5c150,null))['catch'](handleError(_0xb5c150,null));};exports[_0x1b8a('0x20')]=function(_0x443902,_0x365ee3){return db['ZohoAccount'][_0x1b8a('0x42')]({'where':{'id':_0x443902[_0x1b8a('0x46')]['id']}})[_0x1b8a('0x21')](handleEntityNotFound(_0x365ee3,null))[_0x1b8a('0x21')](removeEntity(_0x365ee3,null))[_0x1b8a('0x43')](handleError(_0x365ee3,null));};exports[_0x1b8a('0x47')]=function(_0x228177,_0x1ab086,_0x471b6f){var _0x2393a6={};var _0x42e19a={};var _0x2679c8;var _0x204f37;return db[_0x1b8a('0x28')][_0x1b8a('0x48')]({'where':{'id':_0x228177[_0x1b8a('0x46')]['id']}})[_0x1b8a('0x21')](handleEntityNotFound(_0x1ab086,null))[_0x1b8a('0x21')](function(_0x2aa7a8){if(_0x2aa7a8){_0x2679c8=_0x2aa7a8;_0x42e19a[_0x1b8a('0x30')]=_[_0x1b8a('0x40')](db[_0x1b8a('0x49')][_0x1b8a('0x29')]);_0x42e19a[_0x1b8a('0x2d')]=_[_0x1b8a('0x40')](_0x228177[_0x1b8a('0x2d')]);_0x42e19a[_0x1b8a('0x2e')]=_[_0x1b8a('0x2f')](_0x42e19a[_0x1b8a('0x30')],_0x42e19a[_0x1b8a('0x2d')]);_0x2393a6[_0x1b8a('0x31')]=_['intersection'](_0x42e19a[_0x1b8a('0x30')],qs['fields'](_0x228177['query'][_0x1b8a('0x32')]));_0x2393a6[_0x1b8a('0x31')]=_0x2393a6['attributes']['length']?_0x2393a6[_0x1b8a('0x31')]:_0x42e19a[_0x1b8a('0x30')];_0x2393a6[_0x1b8a('0x4a')]=qs[_0x1b8a('0x35')](_0x228177[_0x1b8a('0x2d')][_0x1b8a('0x35')]);_0x2393a6[_0x1b8a('0x36')]=qs[_0x1b8a('0x2e')](_[_0x1b8a('0x37')](_0x228177[_0x1b8a('0x2d')],_0x42e19a['filters']));if(_0x228177['query'][_0x1b8a('0x38')]){_0x2393a6[_0x1b8a('0x36')]=_['merge'](_0x2393a6['where'],{'$or':_[_0x1b8a('0x2c')](_0x2393a6[_0x1b8a('0x31')],function(_0x5f0863){var _0x9e89d1={};_0x9e89d1[_0x5f0863]={'$like':'%'+_0x228177[_0x1b8a('0x2d')][_0x1b8a('0x38')]+'%'};return _0x9e89d1;})});}_0x2393a6=_[_0x1b8a('0x39')]({},_0x2393a6,_0x228177['options']);return _0x2679c8[_0x1b8a('0x47')](_0x2393a6);}})['then'](function(_0x45fdfa){if(_0x45fdfa){_0x204f37=_0x45fdfa['length'];if(!_0x228177[_0x1b8a('0x2d')][_0x1b8a('0x34')]('nolimit')){_0x2393a6[_0x1b8a('0x1a')]=qs['limit'](_0x228177[_0x1b8a('0x2d')][_0x1b8a('0x1a')]);_0x2393a6[_0x1b8a('0x19')]=qs[_0x1b8a('0x19')](_0x228177[_0x1b8a('0x2d')][_0x1b8a('0x19')]);}return _0x2679c8[_0x1b8a('0x47')](_0x2393a6);}})['then'](function(_0x318fd4){if(_0x318fd4){return _0x318fd4?{'count':_0x204f37,'rows':_0x318fd4}:null;}})['then'](respondWithResult(_0x1ab086,null))[_0x1b8a('0x43')](handleError(_0x1ab086,null));};exports[_0x1b8a('0x4b')]=function(_0x4508a2,_0x3f9184,_0x3c1395){if(_0x4508a2[_0x1b8a('0x45')]['id']){delete _0x4508a2['body']['id'];}return db['ZohoAccount'][_0x1b8a('0x48')]({'where':{'id':_0x4508a2[_0x1b8a('0x46')]['id']}})[_0x1b8a('0x21')](handleEntityNotFound(_0x3f9184,null))[_0x1b8a('0x21')](function(_0x3b855f){if(_0x3b855f){_0x4508a2['body'][_0x1b8a('0x4c')]=_0x3b855f['id'];_0x4508a2['body'][_0x1b8a('0x4d')]=integrations['getSubjects'](_0x4508a2[_0x1b8a('0x45')][_0x1b8a('0x4e')],_0x4508a2['body'][_0x1b8a('0x2a')]);_0x4508a2[_0x1b8a('0x45')]['Descriptions']=integrations[_0x1b8a('0x4f')](_0x4508a2[_0x1b8a('0x45')][_0x1b8a('0x4e')],_0x4508a2['body'][_0x1b8a('0x2a')]);return db[_0x1b8a('0x49')][_0x1b8a('0x44')](_0x4508a2[_0x1b8a('0x45')],{'include':[{'model':db[_0x1b8a('0x50')],'as':_0x1b8a('0x4d')},{'model':db['ZohoField'],'as':_0x1b8a('0x51')}]});}return null;})[_0x1b8a('0x21')](respondWithResult(_0x3f9184,null))[_0x1b8a('0x43')](handleError(_0x3f9184,null));};function getAccessToken(_0x12167a){return new Promise(function(_0x42f043,_0x45742b){var _0x429ab2;switch(_0x12167a['zone']){case'US':_0x429ab2=_0x1b8a('0x52');break;case'AU':_0x429ab2='https://accounts.zoho.com.au';break;case'EU':_0x429ab2=_0x1b8a('0x53');break;case'IN':_0x429ab2=_0x1b8a('0x54');break;case'CN':_0x429ab2='https://accounts.zoho.com.cn';break;default:_0x429ab2=_0x1b8a('0x53');break;}var _0x473993={'method':_0x1b8a('0x55'),'uri':_0x429ab2+_0x1b8a('0x56'),'qs':{'refresh_token':_0x12167a['refreshToken'],'client_id':_0x12167a[_0x1b8a('0x57')],'client_secret':_0x12167a[_0x1b8a('0x58')],'grant_type':_0x1b8a('0x59')},'json':!![]};return rp(_0x473993)[_0x1b8a('0x21')](function(_0x39be5a){if(_0x39be5a['access_token']){_0x42f043(_0x39be5a['access_token']);}else{_0x45742b(_0x1b8a('0x5a'));}})[_0x1b8a('0x43')](function(_0x5f1d05){_0x45742b(_0x5f1d05);});});}exports[_0x1b8a('0x5b')]=function(_0x874d3e,_0x21fda4,_0x406325){var _0x24036b,_0x5361cc,_0x15ccae,_0x34a28c,_0x10d14f;return db[_0x1b8a('0x28')]['findOne']({'where':{'id':_0x874d3e[_0x1b8a('0x46')]['id']},'attributes':['id',_0x1b8a('0x5c'),_0x1b8a('0x5d'),_0x1b8a('0x57'),_0x1b8a('0x58'),'serverUrl',_0x1b8a('0x5e'),_0x1b8a('0x5f')]})[_0x1b8a('0x21')](handleEntityNotFound(_0x21fda4,null))[_0x1b8a('0x21')](function(_0x285c35){_0x10d14f=_0x285c35;_0x24036b=_0x10d14f[_0x1b8a('0x5c')];_0x5361cc=_0x24036b===_0x1b8a('0x60')?'eu':_0x1b8a('0x61');_0x15ccae=_0x10d14f['serverUrl'];var _0x28f009=_0x15ccae[_0x1b8a('0x62')](-0x1);if(_0x28f009==='/'||_0x28f009==='\x5c'||_0x28f009===':'){_0x15ccae=_0x15ccae['substring'](0x0,_0x15ccae['lastIndexOf'](_0x28f009));}if(!_0x10d14f[_0x1b8a('0x5f')]){throw new Error(_0x1b8a('0x63'));}return getAccessToken(_0x10d14f);})[_0x1b8a('0x21')](function(_0x1936b7){if(_0x1936b7){return rp({'method':'GET','uri':util[_0x1b8a('0x64')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5361cc),'qs':{'module':'Calls'},'headers':{'Authorization':_0x1b8a('0x65')+_0x1936b7},'json':!![]});}})[_0x1b8a('0x21')](function(_0x481957){if(_0x481957){if(_0x481957[_0x1b8a('0x66')]&&_0x481957[_0x1b8a('0x66')]['error']){throw new Error(_0x481957['response'][_0x1b8a('0x23')][_0x1b8a('0x67')]);}var _0x3933de=[];var _0x9d21d7=[];var _0x2a67fa=['Owner',_0x1b8a('0x68'),_0x1b8a('0x69'),_0x1b8a('0x6a'),'Call_Duration',_0x1b8a('0x6b'),'Call_Start_Time','Call_Type'];_0x9d21d7=_[_0x1b8a('0x6c')](_0x481957[_0x1b8a('0x32')],function(_0x1b1a2b){return _0x2a67fa[_0x1b8a('0x6d')](_0x1b1a2b[_0x1b8a('0x6e')]);});for(var _0x1cceb0=0x0;_0x1cceb0<_0x9d21d7[_0x1b8a('0x33')];_0x1cceb0++){if(_0x9d21d7[_0x1cceb0][_0x1b8a('0x6f')]===![]){_0x3933de[_0x1b8a('0x70')]({'id':_0x9d21d7[_0x1cceb0]['id'],'name':_0x9d21d7[_0x1cceb0][_0x1b8a('0x71')],'custom':_0x9d21d7[_0x1cceb0][_0x1b8a('0x72')],'options':_0x9d21d7[_0x1cceb0]['data_type']===_0x1b8a('0x73')&&_0x9d21d7[_0x1cceb0][_0x1b8a('0x74')][_0x1b8a('0x33')]>-0x1?_['map'](_0x9d21d7[_0x1cceb0][_0x1b8a('0x74')],function(_0xc093bb){return{'name':_0xc093bb,'value':_0xc093bb};}):[]});}}return{'count':_0x3933de[_0x1b8a('0x33')],'rows':_0x3933de};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x21fda4,null))[_0x1b8a('0x43')](function(_0xf51cc4){var _0x540d61=_0x874d3e[_0x1b8a('0x2d')][_0x1b8a('0x75')]?0x1f4:_0xf51cc4[_0x1b8a('0x76')]||0x1f4;logger[_0x1b8a('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x1b8a('0x5b'),_0x540d61,JSON[_0x1b8a('0x77')](_0xf51cc4));delete _0xf51cc4[_0x1b8a('0x25')];if(_0x540d61===0x191){_0x540d61=0x190;}_0x21fda4[_0x1b8a('0x17')](_0x540d61)[_0x1b8a('0x26')](_0x874d3e['query'][_0x1b8a('0x75')]?{'message':_0x1b8a('0x78'),'statusCode':_0xf51cc4[_0x1b8a('0x76')]}:_0xf51cc4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 000bc87..6299a30 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 _0x2590=['POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','lastIndexOf','zone','https://accounts.zoho.com','lodash','util','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientId','host','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x2590,0x90));var _0x0259=function(_0x27c297,_0x41fd5e){_0x27c297=_0x27c297-0x0;var _0x75d5ae=_0x2590[_0x27c297];return _0x75d5ae;};'use strict';var _=require(_0x0259('0x0'));var util=require(_0x0259('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0259('0x2'));var rp=require(_0x0259('0x3'));var fs=require('fs');var path=require(_0x0259('0x4'));var rimraf=require(_0x0259('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x0259('0x6'));module[_0x0259('0x7')]=function(_0x23c971,_0x1e42d1){return _0x23c971[_0x0259('0x8')](_0x0259('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32ed89,_0x53d399,_0x311074){if(_0x32ed89['changed']('zone')||_0x32ed89[_0x0259('0xa')](_0x0259('0xb'))||_0x32ed89[_0x0259('0xa')](_0x0259('0xc'))||_0x32ed89[_0x0259('0xa')]('clientSecret')||_0x32ed89['changed']('code')||_0x32ed89[_0x0259('0xa')](_0x0259('0xd'))){var _0x4189a0,_0x5728c9;_0x4189a0=_0x32ed89[_0x0259('0xb')];var _0x34b1dc=_0x4189a0[_0x0259('0xe')](-0x1);if(_0x34b1dc==='/'||_0x34b1dc==='\x5c'||_0x34b1dc===':'){_0x4189a0=_0x4189a0[_0x0259('0xf')](0x0,_0x4189a0['lastIndexOf'](_0x34b1dc));}switch(_0x32ed89['zone']){case'US':_0x5728c9='https://accounts.zoho.com';break;case'AU':_0x5728c9=_0x0259('0x10');break;case'IN':_0x5728c9=_0x0259('0x11');break;case'CN':_0x5728c9=_0x0259('0x12');break;default:_0x5728c9=_0x0259('0x13');break;}var _0x314ec6={'method':_0x0259('0x14'),'uri':_0x5728c9+_0x0259('0x15'),'form':{'grant_type':_0x0259('0x16'),'client_id':_0x32ed89[_0x0259('0xc')],'client_secret':_0x32ed89[_0x0259('0x17')],'redirect_uri':_0x32ed89[_0x0259('0xb')],'code':_0x32ed89['code']},'headers':{'Content-Type':_0x0259('0x18')}};return rp(_0x314ec6)[_0x0259('0x19')](function(_0x255260){var _0xc8da23=JSON[_0x0259('0x1a')](_0x255260);if(_0xc8da23[_0x0259('0x1b')]){_0x32ed89[_0x0259('0x1c')]=_0xc8da23[_0x0259('0x1b')];logger[_0x0259('0x1d')](util['format'](_0x0259('0x1e'),_0x32ed89[_0x0259('0x1f')],_0x32ed89['id']));}else{logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x32ed89[_0x0259('0x1f')],_0x32ed89['id']),util[_0x0259('0x23')](_0xc8da23,{'showHidden':![],'depth':null}));}return _0x311074(null,_0x53d399);})[_0x0259('0x24')](function(_0x5e4b64){logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x32ed89[_0x0259('0x1f')],_0x32ed89['id']),util[_0x0259('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x311074(_0x5e4b64);});}else{return _0x311074(null,_0x53d399);}},'beforeUpdate':function(_0x1d0978,_0x9a3a71,_0x48c6e2){if(_0x1d0978[_0x0259('0xa')]('zone')||_0x1d0978['changed'](_0x0259('0xb'))||_0x1d0978[_0x0259('0xa')](_0x0259('0xc'))||_0x1d0978[_0x0259('0xa')](_0x0259('0x17'))||_0x1d0978['changed'](_0x0259('0x25'))||_0x1d0978[_0x0259('0xa')]('host')){var _0x58f5a5,_0x48481c;_0x58f5a5=_0x1d0978[_0x0259('0xb')];var _0x2835b5=_0x58f5a5[_0x0259('0xe')](-0x1);if(_0x2835b5==='/'||_0x2835b5==='\x5c'||_0x2835b5===':'){_0x58f5a5=_0x58f5a5[_0x0259('0xf')](0x0,_0x58f5a5[_0x0259('0x26')](_0x2835b5));}switch(_0x1d0978[_0x0259('0x27')]){case'US':_0x48481c=_0x0259('0x28');break;case'AU':_0x48481c=_0x0259('0x10');break;case'IN':_0x48481c='https://accounts.zoho.in';break;case'CN':_0x48481c=_0x0259('0x12');break;default:_0x48481c=_0x0259('0x13');break;}var _0x411d3f={'method':_0x0259('0x14'),'uri':_0x48481c+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1d0978[_0x0259('0xc')],'client_secret':_0x1d0978[_0x0259('0x17')],'redirect_uri':_0x1d0978['serverUrl'],'code':_0x1d0978[_0x0259('0x25')]},'headers':{'Content-Type':_0x0259('0x18')}};return rp(_0x411d3f)['then'](function(_0x16daab){var _0x1b20bd=JSON[_0x0259('0x1a')](_0x16daab);if(_0x1b20bd[_0x0259('0x1b')]){_0x1d0978[_0x0259('0x1c')]=_0x1b20bd['refresh_token'];logger[_0x0259('0x1d')](util[_0x0259('0x21')](_0x0259('0x1e'),_0x1d0978[_0x0259('0x1f')],_0x1d0978['id']));}else{logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x1d0978['name'],_0x1d0978['id']),util['inspect'](_0x1b20bd,{'showHidden':![],'depth':null}));}return _0x48c6e2(null,_0x9a3a71);})[_0x0259('0x24')](function(_0x299954){logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x1d0978[_0x0259('0x1f')],_0x1d0978['id']),util[_0x0259('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x48c6e2(_0x299954);});}else{return _0x48c6e2(null,_0x9a3a71);}}}});}; \ No newline at end of file +var _0xfc9e=['request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientId','code','host','lastIndexOf','zone','https://accounts.zoho.com','/oauth/v2/token','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','substring','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientSecret','lodash','util','../../config/logger','api','moment'];(function(_0x9ef42e,_0x1a7965){var _0x59d27b=function(_0xaca508){while(--_0xaca508){_0x9ef42e['push'](_0x9ef42e['shift']());}};_0x59d27b(++_0x1a7965);}(_0xfc9e,0x1e7));var _0xefc9=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0xfc9e[_0x522ae8];return _0x3189b9;};'use strict';var _=require(_0xefc9('0x0'));var util=require(_0xefc9('0x1'));var logger=require(_0xefc9('0x2'))(_0xefc9('0x3'));var moment=require(_0xefc9('0x4'));var BPromise=require('bluebird');var rp=require(_0xefc9('0x5'));var fs=require('fs');var path=require(_0xefc9('0x6'));var rimraf=require('rimraf');var config=require(_0xefc9('0x7'));var attributes=require(_0xefc9('0x8'));var integrations=require(_0xefc9('0x9'));module[_0xefc9('0xa')]=function(_0x15d9d2,_0x476d8c){return _0x15d9d2[_0xefc9('0xb')](_0xefc9('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x481c67,_0x4ee149,_0x5c4f94){if(_0x481c67[_0xefc9('0xd')]('zone')||_0x481c67[_0xefc9('0xd')](_0xefc9('0xe'))||_0x481c67[_0xefc9('0xd')](_0xefc9('0xf'))||_0x481c67[_0xefc9('0xd')]('clientSecret')||_0x481c67[_0xefc9('0xd')](_0xefc9('0x10'))||_0x481c67[_0xefc9('0xd')](_0xefc9('0x11'))){var _0x15075b,_0x40f269;_0x15075b=_0x481c67[_0xefc9('0xe')];var _0x510048=_0x15075b['slice'](-0x1);if(_0x510048==='/'||_0x510048==='\x5c'||_0x510048===':'){_0x15075b=_0x15075b['substring'](0x0,_0x15075b[_0xefc9('0x12')](_0x510048));}switch(_0x481c67[_0xefc9('0x13')]){case'US':_0x40f269=_0xefc9('0x14');break;case'AU':_0x40f269='https://accounts.zoho.com.au';break;case'IN':_0x40f269='https://accounts.zoho.in';break;case'CN':_0x40f269='https://accounts.zoho.com.cn';break;default:_0x40f269='https://accounts.zoho.eu';break;}var _0x2da11d={'method':'POST','uri':_0x40f269+_0xefc9('0x15'),'form':{'grant_type':'authorization_code','client_id':_0x481c67[_0xefc9('0xf')],'client_secret':_0x481c67['clientSecret'],'redirect_uri':_0x481c67['serverUrl'],'code':_0x481c67['code']},'headers':{'Content-Type':_0xefc9('0x16')}};return rp(_0x2da11d)[_0xefc9('0x17')](function(_0x5e27c8){var _0xa7671d=JSON['parse'](_0x5e27c8);if(_0xa7671d[_0xefc9('0x18')]){_0x481c67[_0xefc9('0x19')]=_0xa7671d[_0xefc9('0x18')];logger[_0xefc9('0x1a')](util[_0xefc9('0x1b')](_0xefc9('0x1c'),_0x481c67[_0xefc9('0x1d')],_0x481c67['id']));}else{logger[_0xefc9('0x1e')](util[_0xefc9('0x1b')](_0xefc9('0x1f'),_0x481c67[_0xefc9('0x1d')],_0x481c67['id']),util[_0xefc9('0x20')](_0xa7671d,{'showHidden':![],'depth':null}));}return _0x5c4f94(null,_0x4ee149);})[_0xefc9('0x21')](function(_0x3584e5){logger[_0xefc9('0x1e')](util[_0xefc9('0x1b')](_0xefc9('0x1f'),_0x481c67[_0xefc9('0x1d')],_0x481c67['id']),util[_0xefc9('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x5c4f94(_0x3584e5);});}else{return _0x5c4f94(null,_0x4ee149);}},'beforeUpdate':function(_0x3d0ec5,_0x270ea3,_0x14b88d){if(_0x3d0ec5[_0xefc9('0xd')](_0xefc9('0x13'))||_0x3d0ec5[_0xefc9('0xd')](_0xefc9('0xe'))||_0x3d0ec5[_0xefc9('0xd')]('clientId')||_0x3d0ec5[_0xefc9('0xd')]('clientSecret')||_0x3d0ec5[_0xefc9('0xd')](_0xefc9('0x10'))||_0x3d0ec5[_0xefc9('0xd')](_0xefc9('0x11'))){var _0x30d2f1,_0x5cf8ae;_0x30d2f1=_0x3d0ec5[_0xefc9('0xe')];var _0x561605=_0x30d2f1[_0xefc9('0x22')](-0x1);if(_0x561605==='/'||_0x561605==='\x5c'||_0x561605===':'){_0x30d2f1=_0x30d2f1[_0xefc9('0x23')](0x0,_0x30d2f1['lastIndexOf'](_0x561605));}switch(_0x3d0ec5[_0xefc9('0x13')]){case'US':_0x5cf8ae=_0xefc9('0x14');break;case'AU':_0x5cf8ae='https://accounts.zoho.com.au';break;case'IN':_0x5cf8ae=_0xefc9('0x24');break;case'CN':_0x5cf8ae=_0xefc9('0x25');break;default:_0x5cf8ae=_0xefc9('0x26');break;}var _0x3b2047={'method':_0xefc9('0x27'),'uri':_0x5cf8ae+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3d0ec5[_0xefc9('0xf')],'client_secret':_0x3d0ec5[_0xefc9('0x28')],'redirect_uri':_0x3d0ec5[_0xefc9('0xe')],'code':_0x3d0ec5['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3b2047)[_0xefc9('0x17')](function(_0x80bc0a){var _0x2a76fe=JSON['parse'](_0x80bc0a);if(_0x2a76fe[_0xefc9('0x18')]){_0x3d0ec5[_0xefc9('0x19')]=_0x2a76fe['refresh_token'];logger[_0xefc9('0x1a')](util[_0xefc9('0x1b')](_0xefc9('0x1c'),_0x3d0ec5[_0xefc9('0x1d')],_0x3d0ec5['id']));}else{logger['error'](util[_0xefc9('0x1b')](_0xefc9('0x1f'),_0x3d0ec5[_0xefc9('0x1d')],_0x3d0ec5['id']),util[_0xefc9('0x20')](_0x2a76fe,{'showHidden':![],'depth':null}));}return _0x14b88d(null,_0x270ea3);})[_0xefc9('0x21')](function(_0x20ee5e){logger[_0xefc9('0x1e')](util[_0xefc9('0x1b')](_0xefc9('0x1f'),_0x3d0ec5[_0xefc9('0x1d')],_0x3d0ec5['id']),util[_0xefc9('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x14b88d(_0x20ee5e);});}else{return _0x14b88d(null,_0x270ea3);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 6e40473..a0fb409 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 _0xe3da=['then','GetZohoAccount','catch','ShowZohoAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x3d039f,_0x2533bd){var _0x1ddddc=function(_0x1def6b){while(--_0x1def6b){_0x3d039f['push'](_0x3d039f['shift']());}};_0x1ddddc(++_0x2533bd);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['GetZohoAccount']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')]({'raw':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8cf9['options']?_0x3f8cf9[_0xae3d('0x1a')]['where']||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null,'include':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')],function(_0x37f5ff){return{'model':db[_0x37f5ff[_0xae3d('0x20')]],'as':_0x37f5ff['as'],'attributes':_0x37f5ff[_0xae3d('0x1c')],'include':_0x37f5ff[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x37f5ff[_0xae3d('0x1e')],function(_0x2131e9){return{'model':db[_0x2131e9[_0xae3d('0x20')]],'as':_0x2131e9['as'],'attributes':_0x2131e9['attributes'],'include':_0x2131e9[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x2131e9[_0xae3d('0x1e')],function(_0x52df0f){return{'model':db[_0x52df0f[_0xae3d('0x20')]],'as':_0x52df0f['as'],'attributes':_0x52df0f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x54c1e1){logger['info'](_0xae3d('0x22'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x22'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x54c1e1));_0x558e42(_0x54c1e1);})[_0xae3d('0x23')](function(_0x561371){logger[_0xae3d('0x14')](_0xae3d('0x22'),_0x561371['message'],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x561371[_0xae3d('0x16')]));});});};exports[_0xae3d('0x24')]=function(_0x46f484){var _0x432c04=this;return new Promise(function(_0x6ef13c,_0x5356d4){return db['ZohoAccount']['find']({'raw':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x46f484[_0xae3d('0x1a')]?_0x46f484['options'][_0xae3d('0x25')]||null:null,'attributes':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'include':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1e')]?_['map'](_0x46f484[_0xae3d('0x1a')]['include'],function(_0x55aae4){return{'model':db[_0x55aae4[_0xae3d('0x20')]],'as':_0x55aae4['as'],'attributes':_0x55aae4['attributes'],'include':_0x55aae4[_0xae3d('0x1e')]?_['map'](_0x55aae4['include'],function(_0x1a28b5){return{'model':db[_0x1a28b5[_0xae3d('0x20')]],'as':_0x1a28b5['as'],'attributes':_0x1a28b5[_0xae3d('0x1c')],'include':_0x1a28b5['include']?_[_0xae3d('0x1f')](_0x1a28b5['include'],function(_0xce647f){return{'model':db[_0xce647f[_0xae3d('0x20')]],'as':_0xce647f['as'],'attributes':_0xce647f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x18c469){logger[_0xae3d('0xe')](_0xae3d('0x24'),_0x46f484);logger[_0xae3d('0x11')](_0xae3d('0x24'),_0x46f484,JSON[_0xae3d('0x13')](_0x18c469));_0x6ef13c(_0x18c469);})[_0xae3d('0x23')](function(_0x5543ee){logger['error'](_0xae3d('0x24'),_0x5543ee['message'],_0x46f484);_0x5356d4(_0x432c04[_0xae3d('0x14')](0x1f4,_0x5543ee[_0xae3d('0x16')]));});});}; \ No newline at end of file +var _0x25e7=['find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x25e7,0x1d6));var _0x725e=function(_0x48105b,_0x266487){_0x48105b=_0x48105b-0x0;var _0x1ca419=_0x25e7[_0x48105b];return _0x1ca419;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')]({'raw':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x397e33[_0x725e('0x19')]?_0x397e33['options'][_0x725e('0x1b')]||null:null,'attributes':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1c')]||null:null,'limit':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1d')]||null:null,'include':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')]['include']?_[_0x725e('0x1e')](_0x397e33[_0x725e('0x19')][_0x725e('0x1f')],function(_0x3facae){return{'model':db[_0x3facae['model']],'as':_0x3facae['as'],'attributes':_0x3facae[_0x725e('0x1c')],'include':_0x3facae['include']?_['map'](_0x3facae['include'],function(_0x2aad7b){return{'model':db[_0x2aad7b[_0x725e('0x20')]],'as':_0x2aad7b['as'],'attributes':_0x2aad7b[_0x725e('0x1c')],'include':_0x2aad7b['include']?_[_0x725e('0x1e')](_0x2aad7b[_0x725e('0x1f')],function(_0x5a5bef){return{'model':db[_0x5a5bef[_0x725e('0x20')]],'as':_0x5a5bef['as'],'attributes':_0x5a5bef[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x378ace){logger['info']('GetZohoAccount',_0x397e33);logger[_0x725e('0x10')]('GetZohoAccount',_0x397e33,JSON[_0x725e('0x21')](_0x378ace));_0x2811e7(_0x378ace);})['catch'](function(_0x4de2e0){logger[_0x725e('0x12')](_0x725e('0x16'),_0x4de2e0[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438['error'](0x1f4,_0x4de2e0[_0x725e('0x13')]));});});};exports['ShowZohoAccount']=function(_0x85d29c){var _0x1ce9c8=this;return new Promise(function(_0x39932f,_0x28951f){return db[_0x725e('0x17')][_0x725e('0x22')]({'raw':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['where']||null:null,'attributes':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['attributes']||null:null,'include':_0x85d29c[_0x725e('0x19')]?_0x85d29c['options'][_0x725e('0x1f')]?_['map'](_0x85d29c[_0x725e('0x19')][_0x725e('0x1f')],function(_0x1f2898){return{'model':db[_0x1f2898[_0x725e('0x20')]],'as':_0x1f2898['as'],'attributes':_0x1f2898[_0x725e('0x1c')],'include':_0x1f2898[_0x725e('0x1f')]?_['map'](_0x1f2898['include'],function(_0x35e5e7){return{'model':db[_0x35e5e7[_0x725e('0x20')]],'as':_0x35e5e7['as'],'attributes':_0x35e5e7[_0x725e('0x1c')],'include':_0x35e5e7['include']?_[_0x725e('0x1e')](_0x35e5e7['include'],function(_0x3ce327){return{'model':db[_0x3ce327[_0x725e('0x20')]],'as':_0x3ce327['as'],'attributes':_0x3ce327[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x725e('0xc')](function(_0x4f15f3){logger['info'](_0x725e('0x23'),_0x85d29c);logger[_0x725e('0x10')](_0x725e('0x23'),_0x85d29c,JSON['stringify'](_0x4f15f3));_0x39932f(_0x4f15f3);})[_0x725e('0x15')](function(_0xec3b9d){logger[_0x725e('0x12')]('ShowZohoAccount',_0xec3b9d[_0x725e('0x13')],_0x85d29c);_0x28951f(_0x1ce9c8['error'](0x1f4,_0xec3b9d[_0x725e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c7a5af2..58b290e 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 _0x1583=['express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x771f13,_0x3bae19){var _0x4b5a3b=function(_0x4bec6e){while(--_0x4bec6e){_0x771f13['push'](_0x771f13['shift']());}};_0x4b5a3b(++_0x3bae19);}(_0x1583,0x79));var _0x3158=function(_0x563b6a,_0x2a24b1){_0x563b6a=_0x563b6a-0x0;var _0x38c773=_0x1583[_0x563b6a];return _0x38c773;};'use strict';var multer=require(_0x3158('0x0'));var util=require(_0x3158('0x1'));var path=require(_0x3158('0x2'));var timeout=require(_0x3158('0x3'));var express=require(_0x3158('0x4'));var router=express[_0x3158('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3158('0x6'));var config=require(_0x3158('0x7'));var controller=require(_0x3158('0x8'));router[_0x3158('0x9')]('/',auth[_0x3158('0xa')](),controller[_0x3158('0xb')]);router[_0x3158('0x9')]('/:id',auth[_0x3158('0xa')](),controller[_0x3158('0xc')]);router['get']('/:id/fields',auth[_0x3158('0xa')](),controller[_0x3158('0xd')]);router[_0x3158('0x9')](_0x3158('0xe'),auth[_0x3158('0xa')](),controller[_0x3158('0xf')]);router[_0x3158('0x9')](_0x3158('0x10'),auth[_0x3158('0xa')](),controller[_0x3158('0x11')]);router[_0x3158('0x12')]('/',auth['isAuthenticated'](),controller[_0x3158('0x13')]);router[_0x3158('0x14')](_0x3158('0x15'),auth[_0x3158('0xa')](),controller[_0x3158('0x16')]);router[_0x3158('0x17')](_0x3158('0x15'),auth[_0x3158('0xa')](),controller['destroy']);module[_0x3158('0x18')]=router; \ No newline at end of file +var _0x045f=['get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller'];(function(_0x52c486,_0xa8f1e0){var _0x1fdd83=function(_0x519c97){while(--_0x519c97){_0x52c486['push'](_0x52c486['shift']());}};_0x1fdd83(++_0xa8f1e0);}(_0x045f,0xa9));var _0xf045=function(_0x4c074d,_0x343949){_0x4c074d=_0x4c074d-0x0;var _0x5b6b65=_0x045f[_0x4c074d];return _0x5b6b65;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf045('0x0'));var express=require(_0xf045('0x1'));var router=express[_0xf045('0x2')]();var fs_extra=require(_0xf045('0x3'));var auth=require(_0xf045('0x4'));var interaction=require(_0xf045('0x5'));var config=require('../../config/environment');var controller=require(_0xf045('0x6'));router[_0xf045('0x7')]('/',auth['isAuthenticated'](),controller[_0xf045('0x8')]);router['get'](_0xf045('0x9'),auth[_0xf045('0xa')](),controller[_0xf045('0xb')]);router['get'](_0xf045('0xc'),auth[_0xf045('0xa')](),controller[_0xf045('0xd')]);router[_0xf045('0x7')](_0xf045('0xe'),auth['isAuthenticated'](),controller[_0xf045('0xf')]);router[_0xf045('0x7')](_0xf045('0x10'),auth[_0xf045('0xa')](),controller[_0xf045('0x11')]);router['post']('/',auth[_0xf045('0xa')](),controller[_0xf045('0x12')]);router[_0xf045('0x13')](_0xf045('0x9'),auth[_0xf045('0xa')](),controller[_0xf045('0x14')]);router['delete'](_0xf045('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xf045('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 4f73ee5..82662f7 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 _0xb6a9=['nothing','lead','contact_lead','STRING','sequelize','exports','ENUM','contact'];(function(_0x1e73d1,_0x3270f9){var _0x2cf4d2=function(_0x5375d7){while(--_0x5375d7){_0x1e73d1['push'](_0x1e73d1['shift']());}};_0x2cf4d2(++_0x3270f9);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb6a9[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x9b6a('0x0'));module[_0x9b6a('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x9b6a('0x2')]('lead',_0x9b6a('0x3'),_0x9b6a('0x4')),'defaultValue':_0x9b6a('0x5')},'moduleSearch':{'type':Sequelize[_0x9b6a('0x2')](_0x9b6a('0x6'),'contact',_0x9b6a('0x5')),'defaultValue':_0x9b6a('0x6')},'description':{'type':Sequelize[_0x9b6a('0x7')]}}; \ No newline at end of file +var _0xbc8d=['STRING','ENUM','lead','contact','contact_lead','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdbc8('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbc8('0x1')]},'moduleCreate':{'type':Sequelize[_0xdbc8('0x2')](_0xdbc8('0x3'),_0xdbc8('0x4'),'nothing'),'defaultValue':_0xdbc8('0x3')},'moduleSearch':{'type':Sequelize[_0xdbc8('0x2')](_0xdbc8('0x5'),'contact',_0xdbc8('0x3')),'defaultValue':_0xdbc8('0x5')},'description':{'type':Sequelize[_0xdbc8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dfd155f..26f6fbf 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 _0x6282=['findAll','catch','show','params','intersection','find','create','body','update','destroy','getFields','findOne','ZohoField','order','pick','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','apply','then','error','stack','name','send','map','ZohoConfiguration','rawAttributes','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x6282,0x152));var _0x2628=function(_0x24cad0,_0x5df90d){_0x24cad0=_0x24cad0-0x0;var _0xecdecf=_0x6282[_0x24cad0];return _0xecdecf;};'use strict';var emlformat=require(_0x2628('0x0'));var rimraf=require(_0x2628('0x1'));var zipdir=require(_0x2628('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2628('0x3'));var moment=require(_0x2628('0x4'));var BPromise=require(_0x2628('0x5'));var Mustache=require(_0x2628('0x6'));var util=require(_0x2628('0x7'));var path=require(_0x2628('0x8'));var sox=require(_0x2628('0x9'));var csv=require(_0x2628('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2628('0xb'));var _=require(_0x2628('0xc'));var squel=require(_0x2628('0xd'));var crypto=require(_0x2628('0xe'));var jsforce=require(_0x2628('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2628('0x10'));var Redis=require(_0x2628('0x11'));var authService=require(_0x2628('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2628('0x13'));var hardwareService=require(_0x2628('0x14'));var logger=require(_0x2628('0x15'))(_0x2628('0x16'));var utils=require('../../config/utils');var config=require(_0x2628('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2628('0x18'))['db'];function respondWithStatusCode(_0x48bff2,_0x2fb061){_0x2fb061=_0x2fb061||0xcc;return function(_0x3cc410){if(_0x3cc410){return _0x48bff2[_0x2628('0x19')](_0x2fb061);}return _0x48bff2[_0x2628('0x1a')](_0x2fb061)[_0x2628('0x1b')]();};}function respondWithResult(_0x4affcf,_0x28c433){_0x28c433=_0x28c433||0xc8;return function(_0x573845){if(_0x573845){return _0x4affcf[_0x2628('0x1a')](_0x28c433)[_0x2628('0x1c')](_0x573845);}};}function respondWithFilteredResult(_0x11afe8,_0x5a026d){return function(_0x10fd25){if(_0x10fd25){var _0x56757c=typeof _0x5a026d[_0x2628('0x1d')]===_0x2628('0x1e')&&typeof _0x5a026d[_0x2628('0x1f')]===_0x2628('0x1e');var _0x571fee=_0x10fd25['count'];var _0x506e5d=_0x56757c?0x0:_0x5a026d[_0x2628('0x1d')];var _0x20c229=_0x56757c?_0x10fd25[_0x2628('0x20')]:_0x5a026d[_0x2628('0x1d')]+_0x5a026d[_0x2628('0x1f')];var _0x1977f3;if(_0x20c229>=_0x571fee){_0x20c229=_0x571fee;_0x1977f3=0xc8;}else{_0x1977f3=0xce;}_0x11afe8[_0x2628('0x1a')](_0x1977f3);return _0x11afe8[_0x2628('0x21')](_0x2628('0x22'),_0x506e5d+'-'+_0x20c229+'/'+_0x571fee)[_0x2628('0x1c')](_0x10fd25);}return null;};}function patchUpdates(_0x4a3422){return function(_0x4a31c3){try{jsonpatch[_0x2628('0x23')](_0x4a31c3,_0x4a3422,!![]);}catch(_0x43c862){return BPromise['reject'](_0x43c862);}return _0x4a31c3['save']();};}function saveUpdates(_0x6b60c8,_0x4af224){return function(_0x324023){if(_0x324023){return _0x324023['update'](_0x6b60c8)[_0x2628('0x24')](function(_0x5bd2ff){return _0x5bd2ff;});}return null;};}function removeEntity(_0x1684eb,_0x1f727b){return function(_0x5c0627){if(_0x5c0627){return _0x5c0627['destroy']()['then'](function(){_0x1684eb['status'](0xcc)[_0x2628('0x1b')]();});}};}function handleEntityNotFound(_0x1d7a9d,_0x1f9433){return function(_0x4bebd2){if(!_0x4bebd2){_0x1d7a9d[_0x2628('0x19')](0x194);}return _0x4bebd2;};}function handleError(_0x5dc6b8,_0x297ad5){_0x297ad5=_0x297ad5||0x1f4;return function(_0x13efd){logger[_0x2628('0x25')](_0x13efd[_0x2628('0x26')]);if(_0x13efd[_0x2628('0x27')]){delete _0x13efd[_0x2628('0x27')];}_0x5dc6b8[_0x2628('0x1a')](_0x297ad5)[_0x2628('0x28')](_0x13efd);};}exports['index']=function(_0x1ed3ef,_0x43daef){var _0x204c8d={},_0x287f36={},_0x10452e={'count':0x0,'rows':[]};var _0x4e4f95=_[_0x2628('0x29')](db[_0x2628('0x2a')][_0x2628('0x2b')],function(_0x1868de){return{'name':_0x1868de['fieldName'],'type':_0x1868de['type'][_0x2628('0x2c')]};});_0x287f36['model']=_['map'](_0x4e4f95,_0x2628('0x27'));_0x287f36[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x1ed3ef[_0x2628('0x2d')]);_0x287f36[_0x2628('0x2f')]=_['intersection'](_0x287f36['model'],_0x287f36[_0x2628('0x2d')]);_0x204c8d[_0x2628('0x30')]=_['intersection'](_0x287f36[_0x2628('0x31')],qs[_0x2628('0x32')](_0x1ed3ef[_0x2628('0x2d')]['fields']));_0x204c8d['attributes']=_0x204c8d[_0x2628('0x30')][_0x2628('0x33')]?_0x204c8d[_0x2628('0x30')]:_0x287f36[_0x2628('0x31')];if(!_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x34')](_0x2628('0x35'))){_0x204c8d[_0x2628('0x1f')]=qs['limit'](_0x1ed3ef[_0x2628('0x2d')]['limit']);_0x204c8d['offset']=qs[_0x2628('0x1d')](_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x1d')]);}_0x204c8d['order']=qs[_0x2628('0x36')](_0x1ed3ef[_0x2628('0x2d')]['sort']);_0x204c8d[_0x2628('0x37')]=qs[_0x2628('0x2f')](_['pick'](_0x1ed3ef['query'],_0x287f36['filters']),_0x4e4f95);if(_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x38')]){_0x204c8d['where']=_[_0x2628('0x39')](_0x204c8d[_0x2628('0x37')],{'$or':_['map'](_0x4e4f95,function(_0x43a8bc){if(_0x43a8bc[_0x2628('0x3a')]!==_0x2628('0x3b')){var _0xb2c84f={};_0xb2c84f[_0x43a8bc['name']]={'$like':'%'+_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x38')]+'%'};return _0xb2c84f;}})});}_0x204c8d=_[_0x2628('0x39')]({},_0x204c8d,_0x1ed3ef['options']);var _0x231150={'where':_0x204c8d[_0x2628('0x37')]};return db[_0x2628('0x2a')][_0x2628('0x20')](_0x231150)[_0x2628('0x24')](function(_0x168f2e){_0x10452e[_0x2628('0x20')]=_0x168f2e;if(_0x1ed3ef['query'][_0x2628('0x3c')]){_0x204c8d[_0x2628('0x3d')]=[{'all':!![]}];}return db[_0x2628('0x2a')][_0x2628('0x3e')](_0x204c8d);})['then'](function(_0x2078bd){_0x10452e['rows']=_0x2078bd;return _0x10452e;})[_0x2628('0x24')](respondWithFilteredResult(_0x43daef,_0x204c8d))[_0x2628('0x3f')](handleError(_0x43daef,null));};exports[_0x2628('0x40')]=function(_0x584f06,_0x3aa958){var _0x35e4c4={'raw':![],'where':{'id':_0x584f06[_0x2628('0x41')]['id']}},_0x413643={};_0x413643[_0x2628('0x31')]=_[_0x2628('0x2e')](db[_0x2628('0x2a')][_0x2628('0x2b')]);_0x413643['query']=_[_0x2628('0x2e')](_0x584f06[_0x2628('0x2d')]);_0x413643['filters']=_[_0x2628('0x42')](_0x413643[_0x2628('0x31')],_0x413643[_0x2628('0x2d')]);_0x35e4c4[_0x2628('0x30')]=_['intersection'](_0x413643['model'],qs['fields'](_0x584f06[_0x2628('0x2d')][_0x2628('0x32')]));_0x35e4c4['attributes']=_0x35e4c4['attributes'][_0x2628('0x33')]?_0x35e4c4[_0x2628('0x30')]:_0x413643[_0x2628('0x31')];if(_0x584f06[_0x2628('0x2d')][_0x2628('0x3c')]){_0x35e4c4[_0x2628('0x3d')]=[{'all':!![]}];}_0x35e4c4=_[_0x2628('0x39')]({},_0x35e4c4,_0x584f06['options']);return db[_0x2628('0x2a')][_0x2628('0x43')](_0x35e4c4)[_0x2628('0x24')](handleEntityNotFound(_0x3aa958,null))[_0x2628('0x24')](respondWithResult(_0x3aa958,null))[_0x2628('0x3f')](handleError(_0x3aa958,null));};exports['create']=function(_0x5bc9af,_0x4239c7){return db[_0x2628('0x2a')][_0x2628('0x44')](_0x5bc9af[_0x2628('0x45')],{})['then'](respondWithResult(_0x4239c7,0xc9))['catch'](handleError(_0x4239c7,null));};exports[_0x2628('0x46')]=function(_0x2f0c49,_0x4bd048){if(_0x2f0c49[_0x2628('0x45')]['id']){delete _0x2f0c49[_0x2628('0x45')]['id'];}return db['ZohoConfiguration'][_0x2628('0x43')]({'where':{'id':_0x2f0c49[_0x2628('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bd048,null))[_0x2628('0x24')](saveUpdates(_0x2f0c49[_0x2628('0x45')],null))[_0x2628('0x24')](respondWithResult(_0x4bd048,null))[_0x2628('0x3f')](handleError(_0x4bd048,null));};exports[_0x2628('0x47')]=function(_0x1aedd0,_0x22e1e8){return db[_0x2628('0x2a')][_0x2628('0x43')]({'where':{'id':_0x1aedd0['params']['id']}})[_0x2628('0x24')](handleEntityNotFound(_0x22e1e8,null))[_0x2628('0x24')](removeEntity(_0x22e1e8,null))[_0x2628('0x3f')](handleError(_0x22e1e8,null));};exports[_0x2628('0x48')]=function(_0x4e393b,_0x310c0b,_0x286f41){var _0x444e0c={};var _0x557f50={};var _0xb47580;var _0x3241ff;return db[_0x2628('0x2a')][_0x2628('0x49')]({'where':{'id':_0x4e393b[_0x2628('0x41')]['id']}})[_0x2628('0x24')](handleEntityNotFound(_0x310c0b,null))[_0x2628('0x24')](function(_0x5c38b1){if(_0x5c38b1){_0xb47580=_0x5c38b1;_0x557f50[_0x2628('0x31')]=_[_0x2628('0x2e')](db[_0x2628('0x4a')][_0x2628('0x2b')]);_0x557f50[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x4e393b['query']);_0x557f50[_0x2628('0x2f')]=_[_0x2628('0x42')](_0x557f50['model'],_0x557f50[_0x2628('0x2d')]);_0x444e0c[_0x2628('0x30')]=_[_0x2628('0x42')](_0x557f50[_0x2628('0x31')],qs[_0x2628('0x32')](_0x4e393b[_0x2628('0x2d')][_0x2628('0x32')]));_0x444e0c[_0x2628('0x30')]=_0x444e0c[_0x2628('0x30')][_0x2628('0x33')]?_0x444e0c[_0x2628('0x30')]:_0x557f50[_0x2628('0x31')];_0x444e0c[_0x2628('0x4b')]=qs[_0x2628('0x36')](_0x4e393b[_0x2628('0x2d')][_0x2628('0x36')]);_0x444e0c['where']=qs[_0x2628('0x2f')](_[_0x2628('0x4c')](_0x4e393b[_0x2628('0x2d')],_0x557f50[_0x2628('0x2f')]));if(_0x4e393b[_0x2628('0x2d')][_0x2628('0x38')]){_0x444e0c['where']=_[_0x2628('0x39')](_0x444e0c['where'],{'$or':_[_0x2628('0x29')](_0x444e0c['attributes'],function(_0x337ff6){var _0x27b3a2={};_0x27b3a2[_0x337ff6]={'$like':'%'+_0x4e393b['query'][_0x2628('0x38')]+'%'};return _0x27b3a2;})});}_0x444e0c=_['merge']({},_0x444e0c,_0x4e393b[_0x2628('0x4d')]);return _0xb47580[_0x2628('0x48')](_0x444e0c);}})[_0x2628('0x24')](function(_0x29337c){if(_0x29337c){_0x3241ff=_0x29337c['length'];if(!_0x4e393b[_0x2628('0x2d')][_0x2628('0x34')](_0x2628('0x35'))){_0x444e0c['limit']=qs['limit'](_0x4e393b['query'][_0x2628('0x1f')]);_0x444e0c[_0x2628('0x1d')]=qs['offset'](_0x4e393b[_0x2628('0x2d')]['offset']);}return _0xb47580['getFields'](_0x444e0c);}})[_0x2628('0x24')](function(_0x3acf51){if(_0x3acf51){return _0x3acf51?{'count':_0x3241ff,'rows':_0x3acf51}:null;}})[_0x2628('0x24')](respondWithResult(_0x310c0b,null))[_0x2628('0x3f')](handleError(_0x310c0b,null));};exports[_0x2628('0x4e')]=function(_0x7981a4,_0x409c62,_0x204db8){var _0x21547a={};var _0x1c7936={};var _0x944c39;var _0x590b54;return db[_0x2628('0x2a')][_0x2628('0x49')]({'where':{'id':_0x7981a4['params']['id']}})[_0x2628('0x24')](handleEntityNotFound(_0x409c62,null))['then'](function(_0x5c0ea1){if(_0x5c0ea1){_0x944c39=_0x5c0ea1;_0x1c7936['model']=_['keys'](db[_0x2628('0x4a')][_0x2628('0x2b')]);_0x1c7936[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x7981a4[_0x2628('0x2d')]);_0x1c7936[_0x2628('0x2f')]=_['intersection'](_0x1c7936[_0x2628('0x31')],_0x1c7936['query']);_0x21547a['attributes']=_[_0x2628('0x42')](_0x1c7936[_0x2628('0x31')],qs[_0x2628('0x32')](_0x7981a4[_0x2628('0x2d')]['fields']));_0x21547a[_0x2628('0x30')]=_0x21547a[_0x2628('0x30')][_0x2628('0x33')]?_0x21547a[_0x2628('0x30')]:_0x1c7936[_0x2628('0x31')];_0x21547a[_0x2628('0x4b')]=qs['sort'](_0x7981a4[_0x2628('0x2d')][_0x2628('0x36')]);_0x21547a[_0x2628('0x37')]=qs['filters'](_[_0x2628('0x4c')](_0x7981a4[_0x2628('0x2d')],_0x1c7936[_0x2628('0x2f')]));if(_0x7981a4[_0x2628('0x2d')][_0x2628('0x38')]){_0x21547a[_0x2628('0x37')]=_[_0x2628('0x39')](_0x21547a[_0x2628('0x37')],{'$or':_['map'](_0x21547a[_0x2628('0x30')],function(_0x1ebf1b){var _0x52e212={};_0x52e212[_0x1ebf1b]={'$like':'%'+_0x7981a4[_0x2628('0x2d')]['filter']+'%'};return _0x52e212;})});}_0x21547a=_['merge']({},_0x21547a,_0x7981a4[_0x2628('0x4d')]);return _0x944c39[_0x2628('0x4e')](_0x21547a);}})['then'](function(_0x40f169){if(_0x40f169){_0x590b54=_0x40f169[_0x2628('0x33')];if(!_0x7981a4[_0x2628('0x2d')]['hasOwnProperty'](_0x2628('0x35'))){_0x21547a['limit']=qs['limit'](_0x7981a4[_0x2628('0x2d')][_0x2628('0x1f')]);_0x21547a[_0x2628('0x1d')]=qs[_0x2628('0x1d')](_0x7981a4[_0x2628('0x2d')][_0x2628('0x1d')]);}return _0x944c39['getSubjects'](_0x21547a);}})[_0x2628('0x24')](function(_0x22873a){if(_0x22873a){return _0x22873a?{'count':_0x590b54,'rows':_0x22873a}:null;}})[_0x2628('0x24')](respondWithResult(_0x409c62,null))[_0x2628('0x3f')](handleError(_0x409c62,null));};exports['getDescriptions']=function(_0x2c785e,_0x3203d1,_0x7d72d0){var _0x2b8b24={};var _0x9d256a={};var _0x14ce54;var _0x53ddfd;return db[_0x2628('0x2a')][_0x2628('0x49')]({'where':{'id':_0x2c785e[_0x2628('0x41')]['id']}})['then'](handleEntityNotFound(_0x3203d1,null))[_0x2628('0x24')](function(_0x2401fa){if(_0x2401fa){_0x14ce54=_0x2401fa;_0x9d256a[_0x2628('0x31')]=_[_0x2628('0x2e')](db[_0x2628('0x4a')][_0x2628('0x2b')]);_0x9d256a[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x2c785e[_0x2628('0x2d')]);_0x9d256a[_0x2628('0x2f')]=_['intersection'](_0x9d256a[_0x2628('0x31')],_0x9d256a[_0x2628('0x2d')]);_0x2b8b24[_0x2628('0x30')]=_[_0x2628('0x42')](_0x9d256a[_0x2628('0x31')],qs[_0x2628('0x32')](_0x2c785e[_0x2628('0x2d')][_0x2628('0x32')]));_0x2b8b24[_0x2628('0x30')]=_0x2b8b24[_0x2628('0x30')][_0x2628('0x33')]?_0x2b8b24['attributes']:_0x9d256a['model'];_0x2b8b24[_0x2628('0x4b')]=qs[_0x2628('0x36')](_0x2c785e['query'][_0x2628('0x36')]);_0x2b8b24[_0x2628('0x37')]=qs[_0x2628('0x2f')](_['pick'](_0x2c785e[_0x2628('0x2d')],_0x9d256a[_0x2628('0x2f')]));if(_0x2c785e[_0x2628('0x2d')][_0x2628('0x38')]){_0x2b8b24[_0x2628('0x37')]=_[_0x2628('0x39')](_0x2b8b24[_0x2628('0x37')],{'$or':_[_0x2628('0x29')](_0x2b8b24[_0x2628('0x30')],function(_0x3b3095){var _0x1ec61f={};_0x1ec61f[_0x3b3095]={'$like':'%'+_0x2c785e[_0x2628('0x2d')][_0x2628('0x38')]+'%'};return _0x1ec61f;})});}_0x2b8b24=_[_0x2628('0x39')]({},_0x2b8b24,_0x2c785e[_0x2628('0x4d')]);return _0x14ce54[_0x2628('0x4f')](_0x2b8b24);}})[_0x2628('0x24')](function(_0x4daebe){if(_0x4daebe){_0x53ddfd=_0x4daebe[_0x2628('0x33')];if(!_0x2c785e[_0x2628('0x2d')][_0x2628('0x34')]('nolimit')){_0x2b8b24[_0x2628('0x1f')]=qs['limit'](_0x2c785e[_0x2628('0x2d')][_0x2628('0x1f')]);_0x2b8b24['offset']=qs[_0x2628('0x1d')](_0x2c785e[_0x2628('0x2d')][_0x2628('0x1d')]);}return _0x14ce54['getDescriptions'](_0x2b8b24);}})[_0x2628('0x24')](function(_0x2cf603){if(_0x2cf603){return _0x2cf603?{'count':_0x53ddfd,'rows':_0x2cf603}:null;}})[_0x2628('0x24')](respondWithResult(_0x3203d1,null))[_0x2628('0x3f')](handleError(_0x3203d1,null));}; \ No newline at end of file +var _0xe97e=['destroy','then','error','stack','name','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','create','body','catch','params','find','getFields','findOne','ZohoField','getSubjects','options','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','offset','count','json','reject','save','update'];(function(_0x5c07c0,_0x529be7){var _0x5caca9=function(_0x114974){while(--_0x114974){_0x5c07c0['push'](_0x5c07c0['shift']());}};_0x5caca9(++_0x529be7);}(_0xe97e,0x14a));var _0xee97=function(_0xbfb1df,_0x26e6fb){_0xbfb1df=_0xbfb1df-0x0;var _0x190f79=_0xe97e[_0xbfb1df];return _0x190f79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee97('0x0'));var zipdir=require(_0xee97('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee97('0x2'));var moment=require('moment');var BPromise=require(_0xee97('0x3'));var Mustache=require(_0xee97('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xee97('0x5'));var ejs=require(_0xee97('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee97('0x7'));var squel=require('squel');var crypto=require(_0xee97('0x8'));var jsforce=require(_0xee97('0x9'));var deskjs=require(_0xee97('0xa'));var toCsv=require(_0xee97('0x5'));var querystring=require('querystring');var Papa=require(_0xee97('0xb'));var Redis=require(_0xee97('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xee97('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee97('0xe'));var logger=require(_0xee97('0xf'))(_0xee97('0x10'));var utils=require(_0xee97('0x11'));var config=require(_0xee97('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567305,_0x4cc0cc){_0x4cc0cc=_0x4cc0cc||0xcc;return function(_0xd44494){if(_0xd44494){return _0x567305[_0xee97('0x13')](_0x4cc0cc);}return _0x567305[_0xee97('0x14')](_0x4cc0cc)[_0xee97('0x15')]();};}function respondWithResult(_0x3d71a3,_0x3df3b7){_0x3df3b7=_0x3df3b7||0xc8;return function(_0x35cf34){if(_0x35cf34){return _0x3d71a3['status'](_0x3df3b7)['json'](_0x35cf34);}};}function respondWithFilteredResult(_0xdd74a7,_0x1419d5){return function(_0x9aab22){if(_0x9aab22){var _0x34e3d6=typeof _0x1419d5['offset']===_0xee97('0x16')&&typeof _0x1419d5[_0xee97('0x17')]==='undefined';var _0x3fce89=_0x9aab22['count'];var _0x4bac64=_0x34e3d6?0x0:_0x1419d5[_0xee97('0x18')];var _0x3b005a=_0x34e3d6?_0x9aab22[_0xee97('0x19')]:_0x1419d5[_0xee97('0x18')]+_0x1419d5['limit'];var _0x2593b6;if(_0x3b005a>=_0x3fce89){_0x3b005a=_0x3fce89;_0x2593b6=0xc8;}else{_0x2593b6=0xce;}_0xdd74a7[_0xee97('0x14')](_0x2593b6);return _0xdd74a7['set']('Content-Range',_0x4bac64+'-'+_0x3b005a+'/'+_0x3fce89)[_0xee97('0x1a')](_0x9aab22);}return null;};}function patchUpdates(_0x131695){return function(_0x5f2fa0){try{jsonpatch['apply'](_0x5f2fa0,_0x131695,!![]);}catch(_0x2875b5){return BPromise[_0xee97('0x1b')](_0x2875b5);}return _0x5f2fa0[_0xee97('0x1c')]();};}function saveUpdates(_0x4dc6d7,_0x4a84bd){return function(_0x2c9367){if(_0x2c9367){return _0x2c9367[_0xee97('0x1d')](_0x4dc6d7)['then'](function(_0x34ce17){return _0x34ce17;});}return null;};}function removeEntity(_0x11c7e0,_0x425f37){return function(_0x3ed055){if(_0x3ed055){return _0x3ed055[_0xee97('0x1e')]()[_0xee97('0x1f')](function(){_0x11c7e0[_0xee97('0x14')](0xcc)[_0xee97('0x15')]();});}};}function handleEntityNotFound(_0x2c0d08,_0x4164ea){return function(_0x2c1f5a){if(!_0x2c1f5a){_0x2c0d08[_0xee97('0x13')](0x194);}return _0x2c1f5a;};}function handleError(_0x3d45b8,_0x17dd51){_0x17dd51=_0x17dd51||0x1f4;return function(_0xf44fa2){logger[_0xee97('0x20')](_0xf44fa2[_0xee97('0x21')]);if(_0xf44fa2['name']){delete _0xf44fa2[_0xee97('0x22')];}_0x3d45b8[_0xee97('0x14')](_0x17dd51)['send'](_0xf44fa2);};}exports['index']=function(_0x2de175,_0x318c25){var _0x20a5ae={},_0x3ba67f={},_0x96ecab={'count':0x0,'rows':[]};var _0x37d157=_[_0xee97('0x23')](db[_0xee97('0x24')][_0xee97('0x25')],function(_0x5abc81){return{'name':_0x5abc81['fieldName'],'type':_0x5abc81[_0xee97('0x26')][_0xee97('0x27')]};});_0x3ba67f[_0xee97('0x28')]=_[_0xee97('0x23')](_0x37d157,_0xee97('0x22'));_0x3ba67f[_0xee97('0x29')]=_[_0xee97('0x2a')](_0x2de175[_0xee97('0x29')]);_0x3ba67f[_0xee97('0x2b')]=_[_0xee97('0x2c')](_0x3ba67f[_0xee97('0x28')],_0x3ba67f[_0xee97('0x29')]);_0x20a5ae['attributes']=_[_0xee97('0x2c')](_0x3ba67f[_0xee97('0x28')],qs[_0xee97('0x2d')](_0x2de175[_0xee97('0x29')][_0xee97('0x2d')]));_0x20a5ae[_0xee97('0x2e')]=_0x20a5ae['attributes'][_0xee97('0x2f')]?_0x20a5ae[_0xee97('0x2e')]:_0x3ba67f[_0xee97('0x28')];if(!_0x2de175['query'][_0xee97('0x30')](_0xee97('0x31'))){_0x20a5ae[_0xee97('0x17')]=qs[_0xee97('0x17')](_0x2de175[_0xee97('0x29')][_0xee97('0x17')]);_0x20a5ae[_0xee97('0x18')]=qs[_0xee97('0x18')](_0x2de175[_0xee97('0x29')][_0xee97('0x18')]);}_0x20a5ae[_0xee97('0x32')]=qs[_0xee97('0x33')](_0x2de175[_0xee97('0x29')]['sort']);_0x20a5ae[_0xee97('0x34')]=qs[_0xee97('0x2b')](_[_0xee97('0x35')](_0x2de175[_0xee97('0x29')],_0x3ba67f[_0xee97('0x2b')]),_0x37d157);if(_0x2de175['query'][_0xee97('0x36')]){_0x20a5ae[_0xee97('0x34')]=_[_0xee97('0x37')](_0x20a5ae[_0xee97('0x34')],{'$or':_['map'](_0x37d157,function(_0x423e07){if(_0x423e07[_0xee97('0x26')]!=='VIRTUAL'){var _0x5c2df5={};_0x5c2df5[_0x423e07['name']]={'$like':'%'+_0x2de175[_0xee97('0x29')][_0xee97('0x36')]+'%'};return _0x5c2df5;}})});}_0x20a5ae=_['merge']({},_0x20a5ae,_0x2de175['options']);var _0x99d000={'where':_0x20a5ae[_0xee97('0x34')]};return db[_0xee97('0x24')][_0xee97('0x19')](_0x99d000)[_0xee97('0x1f')](function(_0x1da2f3){_0x96ecab[_0xee97('0x19')]=_0x1da2f3;if(_0x2de175[_0xee97('0x29')][_0xee97('0x38')]){_0x20a5ae[_0xee97('0x39')]=[{'all':!![]}];}return db[_0xee97('0x24')][_0xee97('0x3a')](_0x20a5ae);})[_0xee97('0x1f')](function(_0x1c3aff){_0x96ecab[_0xee97('0x3b')]=_0x1c3aff;return _0x96ecab;})[_0xee97('0x1f')](respondWithFilteredResult(_0x318c25,_0x20a5ae))['catch'](handleError(_0x318c25,null));};exports[_0xee97('0x3c')]=function(_0x1eab7f,_0xc24c4f){var _0x4ec4b6={'raw':![],'where':{'id':_0x1eab7f['params']['id']}},_0x501a3b={};_0x501a3b[_0xee97('0x28')]=_[_0xee97('0x2a')](db['ZohoConfiguration'][_0xee97('0x25')]);_0x501a3b[_0xee97('0x29')]=_[_0xee97('0x2a')](_0x1eab7f[_0xee97('0x29')]);_0x501a3b[_0xee97('0x2b')]=_[_0xee97('0x2c')](_0x501a3b[_0xee97('0x28')],_0x501a3b[_0xee97('0x29')]);_0x4ec4b6[_0xee97('0x2e')]=_[_0xee97('0x2c')](_0x501a3b[_0xee97('0x28')],qs[_0xee97('0x2d')](_0x1eab7f[_0xee97('0x29')][_0xee97('0x2d')]));_0x4ec4b6[_0xee97('0x2e')]=_0x4ec4b6['attributes'][_0xee97('0x2f')]?_0x4ec4b6['attributes']:_0x501a3b[_0xee97('0x28')];if(_0x1eab7f[_0xee97('0x29')]['includeAll']){_0x4ec4b6[_0xee97('0x39')]=[{'all':!![]}];}_0x4ec4b6=_[_0xee97('0x37')]({},_0x4ec4b6,_0x1eab7f['options']);return db[_0xee97('0x24')]['find'](_0x4ec4b6)[_0xee97('0x1f')](handleEntityNotFound(_0xc24c4f,null))[_0xee97('0x1f')](respondWithResult(_0xc24c4f,null))['catch'](handleError(_0xc24c4f,null));};exports['create']=function(_0x3e223a,_0x28049a){return db['ZohoConfiguration'][_0xee97('0x3d')](_0x3e223a[_0xee97('0x3e')],{})[_0xee97('0x1f')](respondWithResult(_0x28049a,0xc9))[_0xee97('0x3f')](handleError(_0x28049a,null));};exports[_0xee97('0x1d')]=function(_0x448776,_0xd80f53){if(_0x448776[_0xee97('0x3e')]['id']){delete _0x448776['body']['id'];}return db[_0xee97('0x24')]['find']({'where':{'id':_0x448776[_0xee97('0x40')]['id']}})[_0xee97('0x1f')](handleEntityNotFound(_0xd80f53,null))[_0xee97('0x1f')](saveUpdates(_0x448776[_0xee97('0x3e')],null))[_0xee97('0x1f')](respondWithResult(_0xd80f53,null))['catch'](handleError(_0xd80f53,null));};exports[_0xee97('0x1e')]=function(_0x2be358,_0x5a7046){return db['ZohoConfiguration'][_0xee97('0x41')]({'where':{'id':_0x2be358[_0xee97('0x40')]['id']}})[_0xee97('0x1f')](handleEntityNotFound(_0x5a7046,null))[_0xee97('0x1f')](removeEntity(_0x5a7046,null))[_0xee97('0x3f')](handleError(_0x5a7046,null));};exports[_0xee97('0x42')]=function(_0x33b33a,_0x31022c,_0x4a1a8a){var _0x3dad93={};var _0x420b72={};var _0x3028c8;var _0x22cce3;return db[_0xee97('0x24')][_0xee97('0x43')]({'where':{'id':_0x33b33a[_0xee97('0x40')]['id']}})[_0xee97('0x1f')](handleEntityNotFound(_0x31022c,null))[_0xee97('0x1f')](function(_0x53a2ec){if(_0x53a2ec){_0x3028c8=_0x53a2ec;_0x420b72[_0xee97('0x28')]=_[_0xee97('0x2a')](db[_0xee97('0x44')]['rawAttributes']);_0x420b72[_0xee97('0x29')]=_['keys'](_0x33b33a['query']);_0x420b72[_0xee97('0x2b')]=_[_0xee97('0x2c')](_0x420b72[_0xee97('0x28')],_0x420b72[_0xee97('0x29')]);_0x3dad93[_0xee97('0x2e')]=_[_0xee97('0x2c')](_0x420b72['model'],qs[_0xee97('0x2d')](_0x33b33a[_0xee97('0x29')][_0xee97('0x2d')]));_0x3dad93['attributes']=_0x3dad93[_0xee97('0x2e')][_0xee97('0x2f')]?_0x3dad93[_0xee97('0x2e')]:_0x420b72[_0xee97('0x28')];_0x3dad93[_0xee97('0x32')]=qs[_0xee97('0x33')](_0x33b33a['query'][_0xee97('0x33')]);_0x3dad93[_0xee97('0x34')]=qs['filters'](_[_0xee97('0x35')](_0x33b33a[_0xee97('0x29')],_0x420b72[_0xee97('0x2b')]));if(_0x33b33a[_0xee97('0x29')][_0xee97('0x36')]){_0x3dad93[_0xee97('0x34')]=_[_0xee97('0x37')](_0x3dad93['where'],{'$or':_['map'](_0x3dad93['attributes'],function(_0x97b0e8){var _0x369142={};_0x369142[_0x97b0e8]={'$like':'%'+_0x33b33a['query'][_0xee97('0x36')]+'%'};return _0x369142;})});}_0x3dad93=_['merge']({},_0x3dad93,_0x33b33a['options']);return _0x3028c8[_0xee97('0x42')](_0x3dad93);}})['then'](function(_0x17e703){if(_0x17e703){_0x22cce3=_0x17e703[_0xee97('0x2f')];if(!_0x33b33a[_0xee97('0x29')][_0xee97('0x30')]('nolimit')){_0x3dad93[_0xee97('0x17')]=qs['limit'](_0x33b33a[_0xee97('0x29')]['limit']);_0x3dad93['offset']=qs[_0xee97('0x18')](_0x33b33a[_0xee97('0x29')][_0xee97('0x18')]);}return _0x3028c8[_0xee97('0x42')](_0x3dad93);}})[_0xee97('0x1f')](function(_0x19a140){if(_0x19a140){return _0x19a140?{'count':_0x22cce3,'rows':_0x19a140}:null;}})[_0xee97('0x1f')](respondWithResult(_0x31022c,null))[_0xee97('0x3f')](handleError(_0x31022c,null));};exports[_0xee97('0x45')]=function(_0x4c5a06,_0x3b1d67,_0x45f2e0){var _0x4ab66a={};var _0x35aa70={};var _0x46e9b9;var _0x16b5ab;return db[_0xee97('0x24')][_0xee97('0x43')]({'where':{'id':_0x4c5a06['params']['id']}})[_0xee97('0x1f')](handleEntityNotFound(_0x3b1d67,null))[_0xee97('0x1f')](function(_0x14b0d6){if(_0x14b0d6){_0x46e9b9=_0x14b0d6;_0x35aa70[_0xee97('0x28')]=_[_0xee97('0x2a')](db['ZohoField']['rawAttributes']);_0x35aa70[_0xee97('0x29')]=_[_0xee97('0x2a')](_0x4c5a06[_0xee97('0x29')]);_0x35aa70['filters']=_[_0xee97('0x2c')](_0x35aa70[_0xee97('0x28')],_0x35aa70[_0xee97('0x29')]);_0x4ab66a[_0xee97('0x2e')]=_[_0xee97('0x2c')](_0x35aa70[_0xee97('0x28')],qs[_0xee97('0x2d')](_0x4c5a06[_0xee97('0x29')][_0xee97('0x2d')]));_0x4ab66a['attributes']=_0x4ab66a[_0xee97('0x2e')][_0xee97('0x2f')]?_0x4ab66a[_0xee97('0x2e')]:_0x35aa70[_0xee97('0x28')];_0x4ab66a[_0xee97('0x32')]=qs['sort'](_0x4c5a06['query'][_0xee97('0x33')]);_0x4ab66a[_0xee97('0x34')]=qs[_0xee97('0x2b')](_[_0xee97('0x35')](_0x4c5a06['query'],_0x35aa70[_0xee97('0x2b')]));if(_0x4c5a06['query']['filter']){_0x4ab66a[_0xee97('0x34')]=_[_0xee97('0x37')](_0x4ab66a[_0xee97('0x34')],{'$or':_['map'](_0x4ab66a['attributes'],function(_0x53d1a7){var _0x203f54={};_0x203f54[_0x53d1a7]={'$like':'%'+_0x4c5a06['query'][_0xee97('0x36')]+'%'};return _0x203f54;})});}_0x4ab66a=_[_0xee97('0x37')]({},_0x4ab66a,_0x4c5a06[_0xee97('0x46')]);return _0x46e9b9[_0xee97('0x45')](_0x4ab66a);}})[_0xee97('0x1f')](function(_0xbff347){if(_0xbff347){_0x16b5ab=_0xbff347[_0xee97('0x2f')];if(!_0x4c5a06['query'][_0xee97('0x30')]('nolimit')){_0x4ab66a['limit']=qs[_0xee97('0x17')](_0x4c5a06[_0xee97('0x29')]['limit']);_0x4ab66a['offset']=qs['offset'](_0x4c5a06['query'][_0xee97('0x18')]);}return _0x46e9b9['getSubjects'](_0x4ab66a);}})[_0xee97('0x1f')](function(_0x4ac877){if(_0x4ac877){return _0x4ac877?{'count':_0x16b5ab,'rows':_0x4ac877}:null;}})[_0xee97('0x1f')](respondWithResult(_0x3b1d67,null))['catch'](handleError(_0x3b1d67,null));};exports[_0xee97('0x47')]=function(_0x340713,_0x931e4e,_0x5eaf14){var _0x3d56e7={};var _0x4546b4={};var _0x534a01;var _0x420cf4;return db[_0xee97('0x24')][_0xee97('0x43')]({'where':{'id':_0x340713['params']['id']}})[_0xee97('0x1f')](handleEntityNotFound(_0x931e4e,null))[_0xee97('0x1f')](function(_0x328d69){if(_0x328d69){_0x534a01=_0x328d69;_0x4546b4[_0xee97('0x28')]=_['keys'](db[_0xee97('0x44')]['rawAttributes']);_0x4546b4[_0xee97('0x29')]=_[_0xee97('0x2a')](_0x340713[_0xee97('0x29')]);_0x4546b4[_0xee97('0x2b')]=_['intersection'](_0x4546b4[_0xee97('0x28')],_0x4546b4[_0xee97('0x29')]);_0x3d56e7[_0xee97('0x2e')]=_[_0xee97('0x2c')](_0x4546b4[_0xee97('0x28')],qs[_0xee97('0x2d')](_0x340713[_0xee97('0x29')][_0xee97('0x2d')]));_0x3d56e7[_0xee97('0x2e')]=_0x3d56e7['attributes']['length']?_0x3d56e7[_0xee97('0x2e')]:_0x4546b4['model'];_0x3d56e7['order']=qs['sort'](_0x340713[_0xee97('0x29')][_0xee97('0x33')]);_0x3d56e7[_0xee97('0x34')]=qs[_0xee97('0x2b')](_[_0xee97('0x35')](_0x340713[_0xee97('0x29')],_0x4546b4[_0xee97('0x2b')]));if(_0x340713['query'][_0xee97('0x36')]){_0x3d56e7[_0xee97('0x34')]=_['merge'](_0x3d56e7['where'],{'$or':_[_0xee97('0x23')](_0x3d56e7['attributes'],function(_0x37ebcf){var _0x52f8db={};_0x52f8db[_0x37ebcf]={'$like':'%'+_0x340713['query'][_0xee97('0x36')]+'%'};return _0x52f8db;})});}_0x3d56e7=_[_0xee97('0x37')]({},_0x3d56e7,_0x340713[_0xee97('0x46')]);return _0x534a01[_0xee97('0x47')](_0x3d56e7);}})['then'](function(_0x567783){if(_0x567783){_0x420cf4=_0x567783['length'];if(!_0x340713[_0xee97('0x29')]['hasOwnProperty']('nolimit')){_0x3d56e7['limit']=qs[_0xee97('0x17')](_0x340713['query'][_0xee97('0x17')]);_0x3d56e7[_0xee97('0x18')]=qs[_0xee97('0x18')](_0x340713[_0xee97('0x29')]['offset']);}return _0x534a01[_0xee97('0x47')](_0x3d56e7);}})[_0xee97('0x1f')](function(_0xe7b06e){if(_0xe7b06e){return _0xe7b06e?{'count':_0x420cf4,'rows':_0xe7b06e}:null;}})[_0xee97('0x1f')](respondWithResult(_0x931e4e,null))[_0xee97('0x3f')](handleError(_0x931e4e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8fc552e..f3a9714 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 _0xd788=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1d9d4f,_0x504219){var _0x3577cf=function(_0x3f90c8){while(--_0x3f90c8){_0x1d9d4f['push'](_0x1d9d4f['shift']());}};_0x3577cf(++_0x504219);}(_0xd788,0xcd));var _0x8d78=function(_0xf9da15,_0x9a2849){_0xf9da15=_0xf9da15-0x0;var _0x19d973=_0xd788[_0xf9da15];return _0x19d973;};'use strict';var _=require(_0x8d78('0x0'));var util=require(_0x8d78('0x1'));var logger=require(_0x8d78('0x2'))(_0x8d78('0x3'));var moment=require(_0x8d78('0x4'));var BPromise=require(_0x8d78('0x5'));var rp=require(_0x8d78('0x6'));var fs=require('fs');var path=require(_0x8d78('0x7'));var rimraf=require(_0x8d78('0x8'));var config=require(_0x8d78('0x9'));var attributes=require(_0x8d78('0xa'));module[_0x8d78('0xb')]=function(_0x17407b,_0x5dd517){return _0x17407b[_0x8d78('0xc')](_0x8d78('0xd'),attributes,{'tableName':_0x8d78('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0af9=['exports','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x4ab84a,_0x370dd1){var _0x5bca85=function(_0x4728fc){while(--_0x4728fc){_0x4ab84a['push'](_0x4ab84a['shift']());}};_0x5bca85(++_0x370dd1);}(_0x0af9,0xea));var _0x90af=function(_0x1dd630,_0x164609){_0x1dd630=_0x1dd630-0x0;var _0x595feb=_0x0af9[_0x1dd630];return _0x595feb;};'use strict';var _=require(_0x90af('0x0'));var util=require('util');var logger=require(_0x90af('0x1'))(_0x90af('0x2'));var moment=require('moment');var BPromise=require(_0x90af('0x3'));var rp=require(_0x90af('0x4'));var fs=require('fs');var path=require(_0x90af('0x5'));var rimraf=require('rimraf');var config=require(_0x90af('0x6'));var attributes=require(_0x90af('0x7'));module[_0x90af('0x8')]=function(_0x27386f,_0x4c7672){return _0x27386f['define'](_0x90af('0x9'),attributes,{'tableName':_0x90af('0xa'),'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 ea9f3ae..0d53a50 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 _0xf411=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5cbd05,_0xcead5){var _0x1b961b=function(_0x583302){while(--_0x583302){_0x5cbd05['push'](_0x5cbd05['shift']());}};_0x1b961b(++_0xcead5);}(_0xf411,0x98));var _0x1f41=function(_0x58df94,_0x4d907b){_0x58df94=_0x58df94-0x0;var _0x4e38a8=_0xf411[_0x58df94];return _0x4e38a8;};'use strict';var _=require('lodash');var util=require(_0x1f41('0x0'));var moment=require(_0x1f41('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f41('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f41('0x3'))['db'];var utils=require(_0x1f41('0x4'));var logger=require('../../config/logger')(_0x1f41('0x5'));var config=require(_0x1f41('0x6'));var jayson=require(_0x1f41('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x439974,_0x210096,_0x1973ec){return new BPromise(function(_0x16e88c,_0x1742ea){return client[_0x1f41('0x8')](_0x439974,_0x1973ec)[_0x1f41('0x9')](function(_0x308d9e){logger[_0x1f41('0xa')](_0x1f41('0xb'),_0x210096,_0x1f41('0xc'));logger[_0x1f41('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x210096,'request\x20sent',JSON[_0x1f41('0xe')](_0x308d9e));if(_0x308d9e[_0x1f41('0xf')]){if(_0x308d9e[_0x1f41('0xf')][_0x1f41('0x10')]===0x1f4){logger[_0x1f41('0xf')](_0x1f41('0xb'),_0x210096,_0x308d9e[_0x1f41('0xf')]['message']);return _0x1742ea(_0x308d9e['error']['message']);}logger[_0x1f41('0xf')](_0x1f41('0xb'),_0x210096,_0x308d9e[_0x1f41('0xf')][_0x1f41('0x11')]);return _0x16e88c(_0x308d9e['error']['message']);}else{logger[_0x1f41('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x210096,_0x1f41('0xc'));_0x16e88c(_0x308d9e[_0x1f41('0x12')]['message']);}})['catch'](function(_0x32bc97){logger[_0x1f41('0xf')](_0x1f41('0xb'),_0x210096,_0x32bc97);_0x1742ea(_0x32bc97);});});} \ No newline at end of file +var _0x91c2=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message'];(function(_0x393861,_0xb21b1e){var _0x5e2f67=function(_0x3443ec){while(--_0x3443ec){_0x393861['push'](_0x393861['shift']());}};_0x5e2f67(++_0xb21b1e);}(_0x91c2,0xbf));var _0x291c=function(_0xe4ca7f,_0xa0ba68){_0xe4ca7f=_0xe4ca7f-0x0;var _0x4a64fa=_0x91c2[_0xe4ca7f];return _0x4a64fa;};'use strict';var _=require(_0x291c('0x0'));var util=require(_0x291c('0x1'));var moment=require('moment');var BPromise=require(_0x291c('0x2'));var rs=require(_0x291c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x291c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x291c('0x5'))(_0x291c('0x6'));var config=require(_0x291c('0x7'));var jayson=require(_0x291c('0x8'));var client=jayson['client'][_0x291c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e87a0,_0x3bc4b2,_0x40cf2a){return new BPromise(function(_0x3b975b,_0x136046){return client[_0x291c('0xa')](_0x5e87a0,_0x40cf2a)['then'](function(_0xde03b2){logger[_0x291c('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x3bc4b2,_0x291c('0xc'));logger[_0x291c('0xd')](_0x291c('0xe'),_0x3bc4b2,'request\x20sent',JSON[_0x291c('0xf')](_0xde03b2));if(_0xde03b2[_0x291c('0x10')]){if(_0xde03b2['error']['code']===0x1f4){logger[_0x291c('0x10')](_0x291c('0x11'),_0x3bc4b2,_0xde03b2[_0x291c('0x10')][_0x291c('0x12')]);return _0x136046(_0xde03b2[_0x291c('0x10')][_0x291c('0x12')]);}logger[_0x291c('0x10')](_0x291c('0x11'),_0x3bc4b2,_0xde03b2['error'][_0x291c('0x12')]);return _0x3b975b(_0xde03b2[_0x291c('0x10')]['message']);}else{logger[_0x291c('0xb')](_0x291c('0x11'),_0x3bc4b2,_0x291c('0xc'));_0x3b975b(_0xde03b2[_0x291c('0x13')][_0x291c('0x12')]);}})[_0x291c('0x14')](function(_0x510d3b){logger['error'](_0x291c('0x11'),_0x3bc4b2,_0x510d3b);_0x136046(_0x510d3b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index fc03cf1..64033f8 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 _0xa5c3=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5c3,0x76));var _0x3a5c=function(_0x48774b,_0x177e6b){_0x48774b=_0x48774b-0x0;var _0x24d2cf=_0xa5c3[_0x48774b];return _0x24d2cf;};'use strict';var multer=require(_0x3a5c('0x0'));var util=require(_0x3a5c('0x1'));var path=require(_0x3a5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a5c('0x3'));var router=express['Router']();var fs_extra=require(_0x3a5c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a5c('0x5'));var config=require(_0x3a5c('0x6'));var controller=require(_0x3a5c('0x7'));router[_0x3a5c('0x8')]('/',auth[_0x3a5c('0x9')](),controller[_0x3a5c('0xa')]);router[_0x3a5c('0x8')](_0x3a5c('0xb'),auth[_0x3a5c('0x9')](),controller[_0x3a5c('0xc')]);router[_0x3a5c('0xd')]('/',auth[_0x3a5c('0x9')](),controller[_0x3a5c('0xe')]);router['put'](_0x3a5c('0xb'),auth['isAuthenticated'](),controller[_0x3a5c('0xf')]);router[_0x3a5c('0x10')]('/:id',auth[_0x3a5c('0x9')](),controller[_0x3a5c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3269=['/:id','post','create','update','delete','destroy','exports','multer','path','fs-extra','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x2b5ee5,_0x3741bf){var _0x1c480b=function(_0x437a18){while(--_0x437a18){_0x2b5ee5['push'](_0x2b5ee5['shift']());}};_0x1c480b(++_0x3741bf);}(_0x3269,0x1d5));var _0x9326=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3269[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9326('0x0'));var util=require('util');var path=require(_0x9326('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9326('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9326('0x3'));var controller=require(_0x9326('0x4'));router[_0x9326('0x5')]('/',auth[_0x9326('0x6')](),controller['index']);router['get'](_0x9326('0x7'),auth[_0x9326('0x6')](),controller['show']);router[_0x9326('0x8')]('/',auth[_0x9326('0x6')](),controller[_0x9326('0x9')]);router['put']('/:id',auth[_0x9326('0x6')](),controller[_0x9326('0xa')]);router[_0x9326('0xb')](_0x9326('0x7'),auth['isAuthenticated'](),controller[_0x9326('0xc')]);module[_0x9326('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2e0ef07..7de74ed 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 _0xa970=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x34b02a,_0xc897da){var _0x393178=function(_0x465fbf){while(--_0x465fbf){_0x34b02a['push'](_0x34b02a['shift']());}};_0x393178(++_0xc897da);}(_0xa970,0x1dc));var _0x0a97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa970[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a97('0x0'));module[_0x0a97('0x1')]={'type':{'type':Sequelize[_0x0a97('0x2')](_0x0a97('0x3'),_0x0a97('0x4'),_0x0a97('0x5'),'keyValue',_0x0a97('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0a97('0x7')]},'key':{'type':Sequelize[_0x0a97('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0a97('0x4'),_0x0a97('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0a97('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a97('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0814=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x27125a,_0x252d0d){var _0x391f7a=function(_0x4068fb){while(--_0x4068fb){_0x27125a['push'](_0x27125a['shift']());}};_0x391f7a(++_0x252d0d);}(_0x0814,0x12b));var _0x4081=function(_0x35b3e6,_0x2b1b04){_0x35b3e6=_0x35b3e6-0x0;var _0x379327=_0x0814[_0x35b3e6];return _0x379327;};'use strict';var Sequelize=require(_0x4081('0x0'));module[_0x4081('0x1')]={'type':{'type':Sequelize[_0x4081('0x2')]('string',_0x4081('0x3'),_0x4081('0x4'),_0x4081('0x5'),_0x4081('0x6')),'defaultValue':_0x4081('0x7')},'content':{'type':Sequelize[_0x4081('0x8')]},'key':{'type':Sequelize[_0x4081('0x8')]},'keyType':{'type':Sequelize[_0x4081('0x2')]('string',_0x4081('0x3'),_0x4081('0x4'))},'keyContent':{'type':Sequelize[_0x4081('0x8')]},'idField':{'type':Sequelize[_0x4081('0x8')]},'nameField':{'type':Sequelize[_0x4081('0x8')]},'customField':{'type':Sequelize[_0x4081('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4081('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 39921fa..832e8dd 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 _0x8be9=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','merge','options','include','rows','show','fields','includeAll','find','update','body','catch','params','eml-format'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x8be9,0x8f));var _0x98be=function(_0x25b1ec,_0x2341b2){_0x25b1ec=_0x25b1ec-0x0;var _0x366b78=_0x8be9[_0x25b1ec];return _0x366b78;};'use strict';var emlformat=require(_0x98be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98be('0x1'));var jsonpatch=require(_0x98be('0x2'));var rp=require(_0x98be('0x3'));var moment=require(_0x98be('0x4'));var BPromise=require(_0x98be('0x5'));var Mustache=require(_0x98be('0x6'));var util=require('util');var path=require(_0x98be('0x7'));var sox=require('sox');var csv=require(_0x98be('0x8'));var ejs=require(_0x98be('0x9'));var fs=require('fs');var fs_extra=require(_0x98be('0xa'));var _=require('lodash');var squel=require(_0x98be('0xb'));var crypto=require(_0x98be('0xc'));var jsforce=require(_0x98be('0xd'));var deskjs=require(_0x98be('0xe'));var toCsv=require(_0x98be('0x8'));var querystring=require(_0x98be('0xf'));var Papa=require('papaparse');var Redis=require(_0x98be('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x98be('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98be('0x12'));var logger=require('../../config/logger')(_0x98be('0x13'));var utils=require(_0x98be('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x98be('0x15'));var db=require(_0x98be('0x16'))['db'];function respondWithStatusCode(_0x3079b4,_0x29e79a){_0x29e79a=_0x29e79a||0xcc;return function(_0x54a068){if(_0x54a068){return _0x3079b4[_0x98be('0x17')](_0x29e79a);}return _0x3079b4[_0x98be('0x18')](_0x29e79a)[_0x98be('0x19')]();};}function respondWithResult(_0x2ff1a8,_0x498516){_0x498516=_0x498516||0xc8;return function(_0x390821){if(_0x390821){return _0x2ff1a8[_0x98be('0x18')](_0x498516)[_0x98be('0x1a')](_0x390821);}};}function respondWithFilteredResult(_0x340876,_0x48d941){return function(_0x220935){if(_0x220935){var _0x25f877=typeof _0x48d941[_0x98be('0x1b')]===_0x98be('0x1c')&&typeof _0x48d941['limit']===_0x98be('0x1c');var _0x2db17d=_0x220935[_0x98be('0x1d')];var _0x3d894b=_0x25f877?0x0:_0x48d941[_0x98be('0x1b')];var _0x16cd04=_0x25f877?_0x220935[_0x98be('0x1d')]:_0x48d941[_0x98be('0x1b')]+_0x48d941['limit'];var _0x2b717f;if(_0x16cd04>=_0x2db17d){_0x16cd04=_0x2db17d;_0x2b717f=0xc8;}else{_0x2b717f=0xce;}_0x340876[_0x98be('0x18')](_0x2b717f);return _0x340876[_0x98be('0x1e')](_0x98be('0x1f'),_0x3d894b+'-'+_0x16cd04+'/'+_0x2db17d)[_0x98be('0x1a')](_0x220935);}return null;};}function patchUpdates(_0x447816){return function(_0x2af795){try{jsonpatch['apply'](_0x2af795,_0x447816,!![]);}catch(_0x4f46f6){return BPromise[_0x98be('0x20')](_0x4f46f6);}return _0x2af795[_0x98be('0x21')]();};}function saveUpdates(_0x4812ff,_0x4b9d5e){return function(_0x11bdb1){if(_0x11bdb1){return _0x11bdb1['update'](_0x4812ff)['then'](function(_0x2095ef){return _0x2095ef;});}return null;};}function removeEntity(_0x3ddef1,_0x4c1a79){return function(_0x159c42){if(_0x159c42){return _0x159c42[_0x98be('0x22')]()[_0x98be('0x23')](function(){_0x3ddef1['status'](0xcc)[_0x98be('0x19')]();});}};}function handleEntityNotFound(_0x21636f,_0x1f9e35){return function(_0x5eded3){if(!_0x5eded3){_0x21636f['sendStatus'](0x194);}return _0x5eded3;};}function handleError(_0x2e30ff,_0x556c18){_0x556c18=_0x556c18||0x1f4;return function(_0x33f069){logger[_0x98be('0x24')](_0x33f069[_0x98be('0x25')]);if(_0x33f069[_0x98be('0x26')]){delete _0x33f069[_0x98be('0x26')];}_0x2e30ff['status'](_0x556c18)[_0x98be('0x27')](_0x33f069);};}exports['index']=function(_0x19c1e9,_0x48f8fa){var _0x2d6793={},_0x19842a={},_0x2de5c0={'count':0x0,'rows':[]};var _0x433d4f=_[_0x98be('0x28')](db[_0x98be('0x29')][_0x98be('0x2a')],function(_0x2af772){return{'name':_0x2af772[_0x98be('0x2b')],'type':_0x2af772['type'][_0x98be('0x2c')]};});_0x19842a['model']=_[_0x98be('0x28')](_0x433d4f,'name');_0x19842a['query']=_[_0x98be('0x2d')](_0x19c1e9[_0x98be('0x2e')]);_0x19842a[_0x98be('0x2f')]=_[_0x98be('0x30')](_0x19842a[_0x98be('0x31')],_0x19842a[_0x98be('0x2e')]);_0x2d6793[_0x98be('0x32')]=_[_0x98be('0x30')](_0x19842a[_0x98be('0x31')],qs['fields'](_0x19c1e9['query']['fields']));_0x2d6793[_0x98be('0x32')]=_0x2d6793[_0x98be('0x32')][_0x98be('0x33')]?_0x2d6793[_0x98be('0x32')]:_0x19842a[_0x98be('0x31')];if(!_0x19c1e9[_0x98be('0x2e')][_0x98be('0x34')]('nolimit')){_0x2d6793[_0x98be('0x35')]=qs['limit'](_0x19c1e9['query'][_0x98be('0x35')]);_0x2d6793[_0x98be('0x1b')]=qs[_0x98be('0x1b')](_0x19c1e9[_0x98be('0x2e')][_0x98be('0x1b')]);}_0x2d6793[_0x98be('0x36')]=qs['sort'](_0x19c1e9[_0x98be('0x2e')][_0x98be('0x37')]);_0x2d6793[_0x98be('0x38')]=qs[_0x98be('0x2f')](_[_0x98be('0x39')](_0x19c1e9[_0x98be('0x2e')],_0x19842a['filters']),_0x433d4f);if(_0x19c1e9['query'][_0x98be('0x3a')]){_0x2d6793[_0x98be('0x38')]=_['merge'](_0x2d6793['where'],{'$or':_['map'](_0x433d4f,function(_0x5751f1){if(_0x5751f1[_0x98be('0x3b')]!=='VIRTUAL'){var _0x25fb2d={};_0x25fb2d[_0x5751f1[_0x98be('0x26')]]={'$like':'%'+_0x19c1e9[_0x98be('0x2e')][_0x98be('0x3a')]+'%'};return _0x25fb2d;}})});}_0x2d6793=_[_0x98be('0x3c')]({},_0x2d6793,_0x19c1e9[_0x98be('0x3d')]);var _0x4a074d={'where':_0x2d6793[_0x98be('0x38')]};return db[_0x98be('0x29')][_0x98be('0x1d')](_0x4a074d)[_0x98be('0x23')](function(_0x201de3){_0x2de5c0[_0x98be('0x1d')]=_0x201de3;if(_0x19c1e9[_0x98be('0x2e')]['includeAll']){_0x2d6793[_0x98be('0x3e')]=[{'all':!![]}];}return db[_0x98be('0x29')]['findAll'](_0x2d6793);})[_0x98be('0x23')](function(_0x562663){_0x2de5c0[_0x98be('0x3f')]=_0x562663;return _0x2de5c0;})[_0x98be('0x23')](respondWithFilteredResult(_0x48f8fa,_0x2d6793))['catch'](handleError(_0x48f8fa,null));};exports[_0x98be('0x40')]=function(_0x484064,_0x407e57){var _0x451361={'raw':!![],'where':{'id':_0x484064['params']['id']}},_0x575cbf={};_0x575cbf[_0x98be('0x31')]=_[_0x98be('0x2d')](db[_0x98be('0x29')][_0x98be('0x2a')]);_0x575cbf['query']=_[_0x98be('0x2d')](_0x484064[_0x98be('0x2e')]);_0x575cbf[_0x98be('0x2f')]=_[_0x98be('0x30')](_0x575cbf[_0x98be('0x31')],_0x575cbf[_0x98be('0x2e')]);_0x451361[_0x98be('0x32')]=_[_0x98be('0x30')](_0x575cbf[_0x98be('0x31')],qs[_0x98be('0x41')](_0x484064[_0x98be('0x2e')][_0x98be('0x41')]));_0x451361[_0x98be('0x32')]=_0x451361[_0x98be('0x32')][_0x98be('0x33')]?_0x451361[_0x98be('0x32')]:_0x575cbf[_0x98be('0x31')];if(_0x484064[_0x98be('0x2e')][_0x98be('0x42')]){_0x451361[_0x98be('0x3e')]=[{'all':!![]}];}_0x451361=_[_0x98be('0x3c')]({},_0x451361,_0x484064[_0x98be('0x3d')]);return db['ZohoField'][_0x98be('0x43')](_0x451361)['then'](handleEntityNotFound(_0x407e57,null))[_0x98be('0x23')](respondWithResult(_0x407e57,null))['catch'](handleError(_0x407e57,null));};exports['create']=function(_0x226ce9,_0x18fa37){return db[_0x98be('0x29')]['create'](_0x226ce9['body'],{})[_0x98be('0x23')](respondWithResult(_0x18fa37,0xc9))['catch'](handleError(_0x18fa37,null));};exports[_0x98be('0x44')]=function(_0x2f65e2,_0x3b20a5){if(_0x2f65e2[_0x98be('0x45')]['id']){delete _0x2f65e2[_0x98be('0x45')]['id'];}return db[_0x98be('0x29')][_0x98be('0x43')]({'where':{'id':_0x2f65e2['params']['id']}})[_0x98be('0x23')](handleEntityNotFound(_0x3b20a5,null))[_0x98be('0x23')](saveUpdates(_0x2f65e2[_0x98be('0x45')],null))[_0x98be('0x23')](respondWithResult(_0x3b20a5,null))[_0x98be('0x46')](handleError(_0x3b20a5,null));};exports['destroy']=function(_0x5cf654,_0x41592d){return db['ZohoField'][_0x98be('0x43')]({'where':{'id':_0x5cf654[_0x98be('0x47')]['id']}})[_0x98be('0x23')](handleEntityNotFound(_0x41592d,null))['then'](removeEntity(_0x41592d,null))['catch'](handleError(_0x41592d,null));}; \ No newline at end of file +var _0xb7d4=['body','find','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','save','update','then','destroy','name','send','index','map','ZohoField','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','params','includeAll','merge','create'];(function(_0x35cb96,_0x350fe8){var _0x457b96=function(_0x5789f9){while(--_0x5789f9){_0x35cb96['push'](_0x35cb96['shift']());}};_0x457b96(++_0x350fe8);}(_0xb7d4,0x1ec));var _0x4b7d=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xb7d4[_0x1203f];return _0x365f0a;};'use strict';var emlformat=require(_0x4b7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b7d('0x2'));var moment=require(_0x4b7d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b7d('0x4'));var util=require(_0x4b7d('0x5'));var path=require(_0x4b7d('0x6'));var sox=require(_0x4b7d('0x7'));var csv=require(_0x4b7d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b7d('0x9'));var squel=require(_0x4b7d('0xa'));var crypto=require('crypto');var jsforce=require(_0x4b7d('0xb'));var deskjs=require(_0x4b7d('0xc'));var toCsv=require(_0x4b7d('0x8'));var querystring=require('querystring');var Papa=require(_0x4b7d('0xd'));var Redis=require(_0x4b7d('0xe'));var authService=require(_0x4b7d('0xf'));var qs=require(_0x4b7d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b7d('0x11'));var logger=require(_0x4b7d('0x12'))(_0x4b7d('0x13'));var utils=require('../../config/utils');var config=require(_0x4b7d('0x14'));var licenseUtil=require(_0x4b7d('0x15'));var db=require(_0x4b7d('0x16'))['db'];function respondWithStatusCode(_0x45638a,_0x8b6aa5){_0x8b6aa5=_0x8b6aa5||0xcc;return function(_0x22fa70){if(_0x22fa70){return _0x45638a[_0x4b7d('0x17')](_0x8b6aa5);}return _0x45638a['status'](_0x8b6aa5)[_0x4b7d('0x18')]();};}function respondWithResult(_0x25616d,_0x4a5831){_0x4a5831=_0x4a5831||0xc8;return function(_0x5ae1e0){if(_0x5ae1e0){return _0x25616d[_0x4b7d('0x19')](_0x4a5831)[_0x4b7d('0x1a')](_0x5ae1e0);}};}function respondWithFilteredResult(_0x5d5ffc,_0xde88fa){return function(_0x5880d5){if(_0x5880d5){var _0x3bbcd8=typeof _0xde88fa['offset']==='undefined'&&typeof _0xde88fa[_0x4b7d('0x1b')]==='undefined';var _0x47eed4=_0x5880d5[_0x4b7d('0x1c')];var _0x4f8b3a=_0x3bbcd8?0x0:_0xde88fa[_0x4b7d('0x1d')];var _0x60d541=_0x3bbcd8?_0x5880d5[_0x4b7d('0x1c')]:_0xde88fa[_0x4b7d('0x1d')]+_0xde88fa[_0x4b7d('0x1b')];var _0x2a5a8d;if(_0x60d541>=_0x47eed4){_0x60d541=_0x47eed4;_0x2a5a8d=0xc8;}else{_0x2a5a8d=0xce;}_0x5d5ffc[_0x4b7d('0x19')](_0x2a5a8d);return _0x5d5ffc[_0x4b7d('0x1e')](_0x4b7d('0x1f'),_0x4f8b3a+'-'+_0x60d541+'/'+_0x47eed4)['json'](_0x5880d5);}return null;};}function patchUpdates(_0x24cd95){return function(_0x3f3e8a){try{jsonpatch['apply'](_0x3f3e8a,_0x24cd95,!![]);}catch(_0xa02961){return BPromise['reject'](_0xa02961);}return _0x3f3e8a[_0x4b7d('0x20')]();};}function saveUpdates(_0x49c902,_0x407e75){return function(_0xa63c63){if(_0xa63c63){return _0xa63c63[_0x4b7d('0x21')](_0x49c902)[_0x4b7d('0x22')](function(_0x2eab8d){return _0x2eab8d;});}return null;};}function removeEntity(_0x1d04d7,_0x5e83b6){return function(_0x55feec){if(_0x55feec){return _0x55feec[_0x4b7d('0x23')]()[_0x4b7d('0x22')](function(){_0x1d04d7[_0x4b7d('0x19')](0xcc)[_0x4b7d('0x18')]();});}};}function handleEntityNotFound(_0x30d3e8,_0x594a61){return function(_0x5405ff){if(!_0x5405ff){_0x30d3e8[_0x4b7d('0x17')](0x194);}return _0x5405ff;};}function handleError(_0x2ab4d8,_0x5c2e68){_0x5c2e68=_0x5c2e68||0x1f4;return function(_0x39ccf2){logger['error'](_0x39ccf2['stack']);if(_0x39ccf2[_0x4b7d('0x24')]){delete _0x39ccf2['name'];}_0x2ab4d8[_0x4b7d('0x19')](_0x5c2e68)[_0x4b7d('0x25')](_0x39ccf2);};}exports[_0x4b7d('0x26')]=function(_0x490cc5,_0x117b03){var _0x4971fb={},_0x1605f8={},_0x271920={'count':0x0,'rows':[]};var _0x23a022=_[_0x4b7d('0x27')](db[_0x4b7d('0x28')][_0x4b7d('0x29')],function(_0x62b6eb){return{'name':_0x62b6eb[_0x4b7d('0x2a')],'type':_0x62b6eb[_0x4b7d('0x2b')]['key']};});_0x1605f8['model']=_[_0x4b7d('0x27')](_0x23a022,_0x4b7d('0x24'));_0x1605f8[_0x4b7d('0x2c')]=_[_0x4b7d('0x2d')](_0x490cc5[_0x4b7d('0x2c')]);_0x1605f8[_0x4b7d('0x2e')]=_['intersection'](_0x1605f8[_0x4b7d('0x2f')],_0x1605f8[_0x4b7d('0x2c')]);_0x4971fb['attributes']=_[_0x4b7d('0x30')](_0x1605f8[_0x4b7d('0x2f')],qs[_0x4b7d('0x31')](_0x490cc5['query']['fields']));_0x4971fb['attributes']=_0x4971fb[_0x4b7d('0x32')][_0x4b7d('0x33')]?_0x4971fb[_0x4b7d('0x32')]:_0x1605f8[_0x4b7d('0x2f')];if(!_0x490cc5[_0x4b7d('0x2c')][_0x4b7d('0x34')]('nolimit')){_0x4971fb[_0x4b7d('0x1b')]=qs['limit'](_0x490cc5[_0x4b7d('0x2c')][_0x4b7d('0x1b')]);_0x4971fb['offset']=qs[_0x4b7d('0x1d')](_0x490cc5[_0x4b7d('0x2c')][_0x4b7d('0x1d')]);}_0x4971fb[_0x4b7d('0x35')]=qs[_0x4b7d('0x36')](_0x490cc5[_0x4b7d('0x2c')]['sort']);_0x4971fb[_0x4b7d('0x37')]=qs[_0x4b7d('0x2e')](_[_0x4b7d('0x38')](_0x490cc5[_0x4b7d('0x2c')],_0x1605f8['filters']),_0x23a022);if(_0x490cc5['query'][_0x4b7d('0x39')]){_0x4971fb[_0x4b7d('0x37')]=_['merge'](_0x4971fb[_0x4b7d('0x37')],{'$or':_[_0x4b7d('0x27')](_0x23a022,function(_0x59d412){if(_0x59d412[_0x4b7d('0x2b')]!=='VIRTUAL'){var _0x179322={};_0x179322[_0x59d412[_0x4b7d('0x24')]]={'$like':'%'+_0x490cc5[_0x4b7d('0x2c')][_0x4b7d('0x39')]+'%'};return _0x179322;}})});}_0x4971fb=_['merge']({},_0x4971fb,_0x490cc5[_0x4b7d('0x3a')]);var _0x34cf89={'where':_0x4971fb[_0x4b7d('0x37')]};return db[_0x4b7d('0x28')][_0x4b7d('0x1c')](_0x34cf89)[_0x4b7d('0x22')](function(_0x4e5e04){_0x271920[_0x4b7d('0x1c')]=_0x4e5e04;if(_0x490cc5['query']['includeAll']){_0x4971fb[_0x4b7d('0x3b')]=[{'all':!![]}];}return db[_0x4b7d('0x28')][_0x4b7d('0x3c')](_0x4971fb);})[_0x4b7d('0x22')](function(_0x3d5f0a){_0x271920[_0x4b7d('0x3d')]=_0x3d5f0a;return _0x271920;})[_0x4b7d('0x22')](respondWithFilteredResult(_0x117b03,_0x4971fb))[_0x4b7d('0x3e')](handleError(_0x117b03,null));};exports[_0x4b7d('0x3f')]=function(_0x2f9e17,_0x5cc9eb){var _0x27efb3={'raw':!![],'where':{'id':_0x2f9e17[_0x4b7d('0x40')]['id']}},_0x34fa04={};_0x34fa04['model']=_[_0x4b7d('0x2d')](db['ZohoField'][_0x4b7d('0x29')]);_0x34fa04[_0x4b7d('0x2c')]=_[_0x4b7d('0x2d')](_0x2f9e17[_0x4b7d('0x2c')]);_0x34fa04[_0x4b7d('0x2e')]=_[_0x4b7d('0x30')](_0x34fa04['model'],_0x34fa04[_0x4b7d('0x2c')]);_0x27efb3[_0x4b7d('0x32')]=_[_0x4b7d('0x30')](_0x34fa04[_0x4b7d('0x2f')],qs[_0x4b7d('0x31')](_0x2f9e17[_0x4b7d('0x2c')]['fields']));_0x27efb3['attributes']=_0x27efb3[_0x4b7d('0x32')][_0x4b7d('0x33')]?_0x27efb3[_0x4b7d('0x32')]:_0x34fa04['model'];if(_0x2f9e17[_0x4b7d('0x2c')][_0x4b7d('0x41')]){_0x27efb3['include']=[{'all':!![]}];}_0x27efb3=_[_0x4b7d('0x42')]({},_0x27efb3,_0x2f9e17[_0x4b7d('0x3a')]);return db[_0x4b7d('0x28')]['find'](_0x27efb3)[_0x4b7d('0x22')](handleEntityNotFound(_0x5cc9eb,null))[_0x4b7d('0x22')](respondWithResult(_0x5cc9eb,null))[_0x4b7d('0x3e')](handleError(_0x5cc9eb,null));};exports[_0x4b7d('0x43')]=function(_0x19e547,_0x3c76c5){return db[_0x4b7d('0x28')][_0x4b7d('0x43')](_0x19e547[_0x4b7d('0x44')],{})[_0x4b7d('0x22')](respondWithResult(_0x3c76c5,0xc9))[_0x4b7d('0x3e')](handleError(_0x3c76c5,null));};exports[_0x4b7d('0x21')]=function(_0x594c3b,_0x11c3fc){if(_0x594c3b[_0x4b7d('0x44')]['id']){delete _0x594c3b[_0x4b7d('0x44')]['id'];}return db['ZohoField'][_0x4b7d('0x45')]({'where':{'id':_0x594c3b[_0x4b7d('0x40')]['id']}})[_0x4b7d('0x22')](handleEntityNotFound(_0x11c3fc,null))['then'](saveUpdates(_0x594c3b[_0x4b7d('0x44')],null))[_0x4b7d('0x22')](respondWithResult(_0x11c3fc,null))[_0x4b7d('0x3e')](handleError(_0x11c3fc,null));};exports[_0x4b7d('0x23')]=function(_0x5dd40c,_0x4497ed){return db[_0x4b7d('0x28')]['find']({'where':{'id':_0x5dd40c[_0x4b7d('0x40')]['id']}})[_0x4b7d('0x22')](handleEntityNotFound(_0x4497ed,null))['then'](removeEntity(_0x4497ed,null))[_0x4b7d('0x3e')](handleError(_0x4497ed,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 22c7841..0c500a3 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 _0x4888=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','FieldId'];(function(_0x473dce,_0x3050d1){var _0xbf9beb=function(_0xb07cfb){while(--_0xb07cfb){_0x473dce['push'](_0x473dce['shift']());}};_0xbf9beb(++_0x3050d1);}(_0x4888,0x198));var _0x8488=function(_0x204c59,_0x5614ee){_0x204c59=_0x204c59-0x0;var _0x4cd35b=_0x4888[_0x204c59];return _0x4cd35b;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))(_0x8488('0x2'));var moment=require(_0x8488('0x3'));var BPromise=require(_0x8488('0x4'));var rp=require(_0x8488('0x5'));var fs=require('fs');var path=require(_0x8488('0x6'));var rimraf=require('rimraf');var config=require(_0x8488('0x7'));var attributes=require(_0x8488('0x8'));module[_0x8488('0x9')]=function(_0x421292,_0x326887){return _0x421292[_0x8488('0xa')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x8488('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x21355f,_0x341d7f){var _0x17c9c8=function(_0x139243){while(--_0x139243){_0x21355f['push'](_0x21355f['shift']());}};_0x17c9c8(++_0x341d7f);}(_0x687b,0x14a));var _0xb687=function(_0x39187b,_0x2a6214){_0x39187b=_0x39187b-0x0;var _0x2cf25f=_0x687b[_0x39187b];return _0x2cf25f;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xd'),'FieldId'],'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 6e4ffc6..0ea7a4a 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 _0x52e3=['rpc','../../config/environment','jayson/promise','client','request','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2050f7,_0x3833c6){var _0x219da1=function(_0x554dc1){while(--_0x554dc1){_0x2050f7['push'](_0x2050f7['shift']());}};_0x219da1(++_0x3833c6);}(_0x52e3,0xca));var _0x352e=function(_0x5934e5,_0x146042){_0x5934e5=_0x5934e5-0x0;var _0x3475b9=_0x52e3[_0x5934e5];return _0x3475b9;};'use strict';var _=require(_0x352e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x352e('0x1'));var rs=require(_0x352e('0x2'));var fs=require('fs');var Redis=require(_0x352e('0x3'));var db=require(_0x352e('0x4'))['db'];var utils=require(_0x352e('0x5'));var logger=require(_0x352e('0x6'))(_0x352e('0x7'));var config=require(_0x352e('0x8'));var jayson=require(_0x352e('0x9'));var client=jayson[_0x352e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aefb8,_0x4e7a4c,_0xa3c178){return new BPromise(function(_0x3fc227,_0x468372){return client[_0x352e('0xb')](_0x5aefb8,_0xa3c178)['then'](function(_0x22c25e){logger[_0x352e('0xc')](_0x352e('0xd'),_0x4e7a4c,'request\x20sent');logger['debug'](_0x352e('0xe'),_0x4e7a4c,_0x352e('0xf'),JSON['stringify'](_0x22c25e));if(_0x22c25e['error']){if(_0x22c25e[_0x352e('0x10')][_0x352e('0x11')]===0x1f4){logger['error'](_0x352e('0xd'),_0x4e7a4c,_0x22c25e[_0x352e('0x10')][_0x352e('0x12')]);return _0x468372(_0x22c25e[_0x352e('0x10')][_0x352e('0x12')]);}logger[_0x352e('0x10')]('ZohoField,\x20%s,\x20%s',_0x4e7a4c,_0x22c25e[_0x352e('0x10')][_0x352e('0x12')]);return _0x3fc227(_0x22c25e['error']['message']);}else{logger[_0x352e('0xc')](_0x352e('0xd'),_0x4e7a4c,'request\x20sent');_0x3fc227(_0x22c25e['result'][_0x352e('0x12')]);}})['catch'](function(_0x536b1d){logger[_0x352e('0x10')]('ZohoField,\x20%s,\x20%s',_0x4e7a4c,_0x536b1d);_0x468372(_0x536b1d);});});} \ No newline at end of file +var _0x6003=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x412fe3,_0x534393){var _0x279de5=function(_0x3e0b5d){while(--_0x3e0b5d){_0x412fe3['push'](_0x412fe3['shift']());}};_0x279de5(++_0x534393);}(_0x6003,0x9b));var _0x3600=function(_0x4c8fad,_0x174add){_0x4c8fad=_0x4c8fad-0x0;var _0x46bd02=_0x6003[_0x4c8fad];return _0x46bd02;};'use strict';var _=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var moment=require('moment');var BPromise=require(_0x3600('0x2'));var rs=require(_0x3600('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3600('0x4'));var logger=require(_0x3600('0x5'))(_0x3600('0x6'));var config=require(_0x3600('0x7'));var jayson=require(_0x3600('0x8'));var client=jayson[_0x3600('0x9')][_0x3600('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23eec6,_0x186006,_0xb8c7dc){return new BPromise(function(_0x44aeb4,_0x1b7ae6){return client[_0x3600('0xb')](_0x23eec6,_0xb8c7dc)[_0x3600('0xc')](function(_0x327e17){logger[_0x3600('0xd')](_0x3600('0xe'),_0x186006,_0x3600('0xf'));logger[_0x3600('0x10')](_0x3600('0x11'),_0x186006,_0x3600('0xf'),JSON[_0x3600('0x12')](_0x327e17));if(_0x327e17[_0x3600('0x13')]){if(_0x327e17['error'][_0x3600('0x14')]===0x1f4){logger[_0x3600('0x13')](_0x3600('0xe'),_0x186006,_0x327e17[_0x3600('0x13')][_0x3600('0x15')]);return _0x1b7ae6(_0x327e17['error'][_0x3600('0x15')]);}logger[_0x3600('0x13')](_0x3600('0xe'),_0x186006,_0x327e17['error'][_0x3600('0x15')]);return _0x44aeb4(_0x327e17['error'][_0x3600('0x15')]);}else{logger[_0x3600('0xd')](_0x3600('0xe'),_0x186006,_0x3600('0xf'));_0x44aeb4(_0x327e17[_0x3600('0x16')][_0x3600('0x15')]);}})[_0x3600('0x17')](function(_0x5e933b){logger['error'](_0x3600('0xe'),_0x186006,_0x5e933b);_0x1b7ae6(_0x5e933b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fc94344..7c9c8cb 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(_0x2e5e7f,_0x3518ca){var _0x5d8f7a=function(_0x25a316){while(--_0x25a316){_0x2e5e7f['push'](_0x2e5e7f['shift']());}};_0x5d8f7a(++_0x3518ca);}(_0xe706,0xa3));var _0x6e70=function(_0x17516a,_0x2824c1){_0x17516a=_0x17516a-0x0;var _0x22e61f=_0xe706[_0x17516a];return _0x22e61f;};'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(_0x3759c9,_0x2c3a5b){var _0x878d74=function(_0x339144){while(--_0x339144){_0x3759c9['push'](_0x3759c9['shift']());}};_0x878d74(++_0x2c3a5b);}(_0xe706,0xa3));var _0x6e70=function(_0x301ea6,_0x202cf3){_0x301ea6=_0x301ea6-0x0;var _0x3bd1ae=_0xe706[_0x301ea6];return _0x3bd1ae;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1893391..7194928 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 _0xb67b=['BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x2fd445,_0x36e3ac){var _0x37c758=function(_0x2a3c59){while(--_0x2a3c59){_0x2fd445['push'](_0x2fd445['shift']());}};_0x37c758(++_0x36e3ac);}(_0xb67b,0x1f3));var _0xbb67=function(_0x4e9fed,_0x19f4f3){_0x4e9fed=_0x4e9fed-0x0;var _0x5c8cc0=_0xb67b[_0x4e9fed];return _0x5c8cc0;};'use strict';var Sequelize=require(_0xbb67('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb67('0x1')],'allowNull':![],'unique':_0xbb67('0x2')},'version':{'type':Sequelize[_0xbb67('0x1')],'allowNull':![],'unique':_0xbb67('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xbb67('0x3')},'filename':{'type':Sequelize[_0xbb67('0x1')]},'path':{'type':Sequelize[_0xbb67('0x1')]},'type':{'type':Sequelize[_0xbb67('0x1')]},'size':{'type':Sequelize[_0xbb67('0x4')]},'active':{'type':Sequelize[_0xbb67('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xbb67('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xbb67('0x1')],'unique':_0xbb67('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbb67('0x1')]},'link':{'type':Sequelize[_0xbb67('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x485a=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x485a,0x1d0));var _0xa485=function(_0x1a2ed5,_0x255d82){_0x1a2ed5=_0x1a2ed5-0x0;var _0x5c9cc1=_0x485a[_0x1a2ed5];return _0x5c9cc1;};'use strict';var Sequelize=require('sequelize');module[_0xa485('0x0')]={'name':{'type':Sequelize[_0xa485('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xa485('0x1')],'allowNull':![],'unique':_0xa485('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xa485('0x3')},'filename':{'type':Sequelize[_0xa485('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa485('0x1')]},'size':{'type':Sequelize[_0xa485('0x4')]},'active':{'type':Sequelize[_0xa485('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xa485('0x1')]},'logo':{'type':Sequelize[_0xa485('0x1')]},'state':{'type':Sequelize[_0xa485('0x1')],'unique':_0xa485('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xa485('0x1')]},'remoteUri':{'type':Sequelize[_0xa485('0x1')]},'link':{'type':Sequelize[_0xa485('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 1041395..ec59c4f 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 _0xb016=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end','error','name','send','index','map','Integration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body'];(function(_0x3f5079,_0x10074b){var _0x35063f=function(_0x166780){while(--_0x166780){_0x3f5079['push'](_0x3f5079['shift']());}};_0x35063f(++_0x10074b);}(_0xb016,0x159));var _0x6b01=function(_0x406d13,_0x41fad7){_0x406d13=_0x406d13-0x0;var _0xb13030=_0xb016[_0x406d13];return _0xb13030;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['Integration'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));}; \ No newline at end of file +var _0x53ec=['count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','Integration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x53ec,0x192));var _0xc53e=function(_0x199d4f,_0x49ede1){_0x199d4f=_0x199d4f-0x0;var _0x202d75=_0x53ec[_0x199d4f];return _0x202d75;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 746f5c5..5839d1b 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 _0x98b5=['rimraf','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1931f4,_0x494dfc){var _0x59eb75=function(_0x168db4){while(--_0x168db4){_0x1931f4['push'](_0x1931f4['shift']());}};_0x59eb75(++_0x494dfc);}(_0x98b5,0x191));var _0x598b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x98b5[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x598b('0x0'));var util=require(_0x598b('0x1'));var logger=require(_0x598b('0x2'))(_0x598b('0x3'));var moment=require('moment');var BPromise=require(_0x598b('0x4'));var rp=require(_0x598b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x598b('0x6'));var config=require('../../config/environment');var attributes=require(_0x598b('0x7'));module[_0x598b('0x8')]=function(_0x14f565,_0x5ee66c){return _0x14f565[_0x598b('0x9')]('Integration',attributes,{'tableName':_0x598b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc445=['Integration','lodash','util','api','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define'];(function(_0x42c3ea,_0x2cae04){var _0x294a04=function(_0x265626){while(--_0x265626){_0x42c3ea['push'](_0x42c3ea['shift']());}};_0x294a04(++_0x2cae04);}(_0xc445,0xf3));var _0x5c44=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0xc445[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0x5c44('0x0'));var util=require(_0x5c44('0x1'));var logger=require('../../config/logger')(_0x5c44('0x2'));var moment=require('moment');var BPromise=require(_0x5c44('0x3'));var rp=require(_0x5c44('0x4'));var fs=require('fs');var path=require(_0x5c44('0x5'));var rimraf=require(_0x5c44('0x6'));var config=require('../../config/environment');var attributes=require(_0x5c44('0x7'));module[_0x5c44('0x8')]=function(_0x2a0232,_0x5b4a45){return _0x2a0232[_0x5c44('0x9')](_0x5c44('0xa'),attributes,{'tableName':'integrations','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 44dc471..35ca3ca 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 _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x53f3ad,_0x39163e){var _0x48b203=function(_0x475ced){while(--_0x475ced){_0x53f3ad['push'](_0x53f3ad['shift']());}};_0x48b203(++_0x39163e);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x24be71,_0x21416c){_0x24be71=_0x24be71-0x0;var _0x1b7644=_0xd7d1[_0x24be71];return _0x1b7644;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0xb5c16,_0x225bd2){var _0x2ed8ff=function(_0x302348){while(--_0x302348){_0xb5c16['push'](_0xb5c16['shift']());}};_0x2ed8ff(++_0x225bd2);}(_0x1a85,0x178));var _0x51a8=function(_0x5813eb,_0x157c17){_0x5813eb=_0x5813eb-0x0;var _0x314c58=_0x1a85[_0x5813eb];return _0x314c58;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index cdd396d..8279c31 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 _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46a306,_0x1d65d5){var _0x2b3515=function(_0x3c4d02){while(--_0x3c4d02){_0x46a306['push'](_0x46a306['shift']());}};_0x2b3515(++_0x1d65d5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4257b5,_0x51679a){_0x4257b5=_0x4257b5-0x0;var _0x1fa5c9=_0xc6ac[_0x4257b5];return _0x1fa5c9;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x154f6a,_0x4c617b){var _0x833e6e=function(_0x255f83){while(--_0x255f83){_0x154f6a['push'](_0x154f6a['shift']());}};_0x833e6e(++_0x4c617b);}(_0x9f0e,0x116));var _0xe9f0=function(_0x169ee5,_0x22f19b){_0x169ee5=_0x169ee5-0x0;var _0x243ea4=_0x9f0e[_0x169ee5];return _0x243ea4;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1c5d42d..d13ea8b 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 _0x436b=['RECEIVED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x436b,0x114));var _0xb436=function(_0x819e48,_0x430040){_0x819e48=_0x819e48-0x0;var _0x522d4a=_0x436b[_0x819e48];return _0x522d4a;};'use strict';var Sequelize=require(_0xb436('0x0'));module[_0xb436('0x1')]={'integration':{'type':Sequelize[_0xb436('0x2')]},'eventChannel':{'type':Sequelize[_0xb436('0x2')]},'exitStatus':{'type':Sequelize[_0xb436('0x2')]},'ticketId':{'type':Sequelize[_0xb436('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xb436('0x2')]},'uniqueid':{'type':Sequelize[_0xb436('0x2')]},'calleridnum':{'type':Sequelize[_0xb436('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb436('0x2')]},'interface':{'type':Sequelize[_0xb436('0x2')]},'membername':{'type':Sequelize[_0xb436('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb436('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb436('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb436('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb436('0x3')]},'talktime':{'type':Sequelize[_0xb436('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb436('0x5')]},'reason':{'type':Sequelize[_0xb436('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb436('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb436('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb436('0x2')]},'channelstate':{'type':Sequelize[_0xb436('0x5')]},'channelstatedesc':{'type':Sequelize[_0xb436('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb436('0x2')]},'connectedlinename':{'type':Sequelize[_0xb436('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb436('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb436('0x2')]},'priority':{'type':Sequelize[_0xb436('0x2')]},'destchannel':{'type':Sequelize[_0xb436('0x2')]},'destchannelstate':{'type':Sequelize[_0xb436('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xb436('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb436('0x2')]},'destcalleridname':{'type':Sequelize[_0xb436('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xb436('0x2')]},'destlanguage':{'type':Sequelize[_0xb436('0x2')]},'destaccountcode':{'type':Sequelize[_0xb436('0x2')]},'destcontext':{'type':Sequelize[_0xb436('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb436('0x2')]},'destuniqueid':{'type':Sequelize[_0xb436('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb436('0x2')]},'subject':{'type':Sequelize[_0xb436('0x2')]},'from':{'type':Sequelize[_0xb436('0x2')]},'to':{'type':Sequelize[_0xb436('0x2')]},'cc':{'type':Sequelize[_0xb436('0x2')]},'attachment':{'type':Sequelize[_0xb436('0x6')]},'html':{'type':Sequelize[_0xb436('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xb436('0x7')](_0xb436('0x8'),_0xb436('0x9'),_0xb436('0xa'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xb436('0x2')]},'projectId':{'type':Sequelize[_0xb436('0x5')]}}; \ No newline at end of file +var _0x2cc6=['INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE'];(function(_0x176ddf,_0x36e667){var _0x47333e=function(_0x46a1a7){while(--_0x46a1a7){_0x176ddf['push'](_0x176ddf['shift']());}};_0x47333e(++_0x36e667);}(_0x2cc6,0x170));var _0x62cc=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0x2cc6[_0x383dbb];return _0x6e8bde;};'use strict';var Sequelize=require(_0x62cc('0x0'));module[_0x62cc('0x1')]={'integration':{'type':Sequelize[_0x62cc('0x2')]},'eventChannel':{'type':Sequelize[_0x62cc('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x62cc('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x62cc('0x2')]},'calleridname':{'type':Sequelize[_0x62cc('0x2')]},'queue':{'type':Sequelize[_0x62cc('0x2')]},'interface':{'type':Sequelize[_0x62cc('0x2')]},'membername':{'type':Sequelize[_0x62cc('0x2')]},'agentcalledAt':{'type':Sequelize[_0x62cc('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x62cc('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x62cc('0x3')]},'talktime':{'type':Sequelize[_0x62cc('0x4')]},'agentacw':{'type':Sequelize[_0x62cc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x62cc('0x4')]},'reason':{'type':Sequelize[_0x62cc('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x62cc('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x62cc('0x3')]},'lastevent':{'type':Sequelize[_0x62cc('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x62cc('0x4')]},'channelstatedesc':{'type':Sequelize[_0x62cc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x62cc('0x2')]},'connectedlinename':{'type':Sequelize[_0x62cc('0x2')]},'language':{'type':Sequelize[_0x62cc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x62cc('0x2')]},'priority':{'type':Sequelize[_0x62cc('0x2')]},'destchannel':{'type':Sequelize[_0x62cc('0x2')]},'destchannelstate':{'type':Sequelize[_0x62cc('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x62cc('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x62cc('0x2')]},'destaccountcode':{'type':Sequelize[_0x62cc('0x2')]},'destcontext':{'type':Sequelize[_0x62cc('0x2')]},'destexten':{'type':Sequelize[_0x62cc('0x2')]},'destpriority':{'type':Sequelize[_0x62cc('0x2')]},'destuniqueid':{'type':Sequelize[_0x62cc('0x2')]},'messageId':{'type':Sequelize[_0x62cc('0x2')]},'inReplyTo':{'type':Sequelize[_0x62cc('0x2')]},'subject':{'type':Sequelize[_0x62cc('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x62cc('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x62cc('0x6')]},'html':{'type':Sequelize[_0x62cc('0x6')]},'text':{'type':Sequelize[_0x62cc('0x6')]},'status':{'type':Sequelize[_0x62cc('0x7')](_0x62cc('0x8'),_0x62cc('0x9'),_0x62cc('0xa'),_0x62cc('0xb'))},'url':{'type':Sequelize[_0x62cc('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x62cc('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 7c941af..7537a43 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 _0x47d7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x5cf1c,_0x32b079){var _0x1f0764=function(_0x310037){while(--_0x310037){_0x5cf1c['push'](_0x5cf1c['shift']());}};_0x1f0764(++_0x32b079);}(_0x47d7,0x1c3));var _0x747d=function(_0x3fb5d5,_0x2badc0){_0x3fb5d5=_0x3fb5d5-0x0;var _0x2a7616=_0x47d7[_0x3fb5d5];return _0x2a7616;};'use strict';var emlformat=require(_0x747d('0x0'));var rimraf=require(_0x747d('0x1'));var zipdir=require(_0x747d('0x2'));var jsonpatch=require(_0x747d('0x3'));var rp=require(_0x747d('0x4'));var moment=require(_0x747d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x747d('0x6'));var util=require('util');var path=require(_0x747d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x747d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x747d('0x9'));var squel=require(_0x747d('0xa'));var crypto=require(_0x747d('0xb'));var jsforce=require(_0x747d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x747d('0xd'));var querystring=require(_0x747d('0xe'));var Papa=require('papaparse');var Redis=require(_0x747d('0xf'));var authService=require(_0x747d('0x10'));var qs=require(_0x747d('0x11'));var as=require(_0x747d('0x12'));var hardwareService=require(_0x747d('0x13'));var logger=require(_0x747d('0x14'))('api');var utils=require(_0x747d('0x15'));var config=require(_0x747d('0x16'));var licenseUtil=require(_0x747d('0x17'));var db=require(_0x747d('0x18'))['db'];function respondWithStatusCode(_0x566a8c,_0x1c93ac){_0x1c93ac=_0x1c93ac||0xcc;return function(_0x3fc972){if(_0x3fc972){return _0x566a8c['sendStatus'](_0x1c93ac);}return _0x566a8c[_0x747d('0x19')](_0x1c93ac)[_0x747d('0x1a')]();};}function respondWithResult(_0x539626,_0x480a18){_0x480a18=_0x480a18||0xc8;return function(_0xb2bbf9){if(_0xb2bbf9){return _0x539626[_0x747d('0x19')](_0x480a18)[_0x747d('0x1b')](_0xb2bbf9);}};}function respondWithFilteredResult(_0x4a9aad,_0x4ddedc){return function(_0x15877a){if(_0x15877a){var _0x178719=typeof _0x4ddedc['offset']===_0x747d('0x1c')&&typeof _0x4ddedc['limit']===_0x747d('0x1c');var _0x40ae61=_0x15877a[_0x747d('0x1d')];var _0x203a25=_0x178719?0x0:_0x4ddedc[_0x747d('0x1e')];var _0x97edf9=_0x178719?_0x15877a[_0x747d('0x1d')]:_0x4ddedc['offset']+_0x4ddedc[_0x747d('0x1f')];var _0x458ff0;if(_0x97edf9>=_0x40ae61){_0x97edf9=_0x40ae61;_0x458ff0=0xc8;}else{_0x458ff0=0xce;}_0x4a9aad[_0x747d('0x19')](_0x458ff0);return _0x4a9aad[_0x747d('0x20')](_0x747d('0x21'),_0x203a25+'-'+_0x97edf9+'/'+_0x40ae61)[_0x747d('0x1b')](_0x15877a);}return null;};}function patchUpdates(_0x5dcede){return function(_0x5accf1){try{jsonpatch[_0x747d('0x22')](_0x5accf1,_0x5dcede,!![]);}catch(_0x1cfe20){return BPromise[_0x747d('0x23')](_0x1cfe20);}return _0x5accf1[_0x747d('0x24')]();};}function saveUpdates(_0x507ca8,_0x2aab43){return function(_0x3883d1){if(_0x3883d1){return _0x3883d1[_0x747d('0x25')](_0x507ca8)[_0x747d('0x26')](function(_0x15bf53){return _0x15bf53;});}return null;};}function removeEntity(_0x5c096f,_0x5dcb62){return function(_0x1fc3d8){if(_0x1fc3d8){return _0x1fc3d8[_0x747d('0x27')]()[_0x747d('0x26')](function(){_0x5c096f[_0x747d('0x19')](0xcc)[_0x747d('0x1a')]();});}};}function handleEntityNotFound(_0x4477ce,_0x2083dc){return function(_0x311434){if(!_0x311434){_0x4477ce[_0x747d('0x28')](0x194);}return _0x311434;};}function handleError(_0x22814d,_0x2cba6f){_0x2cba6f=_0x2cba6f||0x1f4;return function(_0x2ece3a){logger[_0x747d('0x29')](_0x2ece3a[_0x747d('0x2a')]);if(_0x2ece3a['name']){delete _0x2ece3a['name'];}_0x22814d['status'](_0x2cba6f)[_0x747d('0x2b')](_0x2ece3a);};}exports[_0x747d('0x2c')]=function(_0x12e413,_0x2a343c){var _0x4d092c={},_0x11e949={},_0x595d10={'count':0x0,'rows':[]};var _0x2478ba=_[_0x747d('0x2d')](db[_0x747d('0x2e')][_0x747d('0x2f')],function(_0x699ee4){return{'name':_0x699ee4[_0x747d('0x30')],'type':_0x699ee4['type'][_0x747d('0x31')]};});_0x11e949[_0x747d('0x32')]=_[_0x747d('0x2d')](_0x2478ba,'name');_0x11e949[_0x747d('0x33')]=_[_0x747d('0x34')](_0x12e413[_0x747d('0x33')]);_0x11e949[_0x747d('0x35')]=_[_0x747d('0x36')](_0x11e949[_0x747d('0x32')],_0x11e949[_0x747d('0x33')]);_0x4d092c['attributes']=_['intersection'](_0x11e949['model'],qs['fields'](_0x12e413[_0x747d('0x33')][_0x747d('0x37')]));_0x4d092c['attributes']=_0x4d092c[_0x747d('0x38')]['length']?_0x4d092c['attributes']:_0x11e949[_0x747d('0x32')];if(!_0x12e413[_0x747d('0x33')]['hasOwnProperty'](_0x747d('0x39'))){_0x4d092c[_0x747d('0x1f')]=qs[_0x747d('0x1f')](_0x12e413[_0x747d('0x33')][_0x747d('0x1f')]);_0x4d092c[_0x747d('0x1e')]=qs['offset'](_0x12e413[_0x747d('0x33')][_0x747d('0x1e')]);}_0x4d092c[_0x747d('0x3a')]=qs[_0x747d('0x3b')](_0x12e413[_0x747d('0x33')]['sort']);_0x4d092c[_0x747d('0x3c')]=qs[_0x747d('0x35')](_[_0x747d('0x3d')](_0x12e413[_0x747d('0x33')],_0x11e949[_0x747d('0x35')]),_0x2478ba);if(_0x12e413[_0x747d('0x33')][_0x747d('0x3e')]){_0x4d092c[_0x747d('0x3c')]=_['merge'](_0x4d092c[_0x747d('0x3c')],{'$or':_[_0x747d('0x2d')](_0x2478ba,function(_0x10f041){if(_0x10f041[_0x747d('0x3f')]!==_0x747d('0x40')){var _0x4c381e={};_0x4c381e[_0x10f041[_0x747d('0x41')]]={'$like':'%'+_0x12e413['query'][_0x747d('0x3e')]+'%'};return _0x4c381e;}})});}_0x4d092c=_[_0x747d('0x42')]({},_0x4d092c,_0x12e413[_0x747d('0x43')]);var _0x314c4c={'where':_0x4d092c['where']};return db[_0x747d('0x2e')]['count'](_0x314c4c)['then'](function(_0x34635d){_0x595d10[_0x747d('0x1d')]=_0x34635d;if(_0x12e413[_0x747d('0x33')][_0x747d('0x44')]){_0x4d092c[_0x747d('0x45')]=[{'all':!![]}];}return db[_0x747d('0x2e')][_0x747d('0x46')](_0x4d092c);})['then'](function(_0x28d110){_0x595d10['rows']=_0x28d110;return _0x595d10;})[_0x747d('0x26')](respondWithFilteredResult(_0x2a343c,_0x4d092c))[_0x747d('0x47')](handleError(_0x2a343c,null));};exports[_0x747d('0x48')]=function(_0x27b3bc,_0x469883){var _0x55b5b6={'raw':![],'where':{'id':_0x27b3bc['params']['id']}},_0x145cbe={};_0x145cbe['model']=_[_0x747d('0x34')](db[_0x747d('0x2e')][_0x747d('0x2f')]);_0x145cbe[_0x747d('0x33')]=_[_0x747d('0x34')](_0x27b3bc[_0x747d('0x33')]);_0x145cbe[_0x747d('0x35')]=_[_0x747d('0x36')](_0x145cbe[_0x747d('0x32')],_0x145cbe[_0x747d('0x33')]);_0x55b5b6[_0x747d('0x38')]=_[_0x747d('0x36')](_0x145cbe[_0x747d('0x32')],qs[_0x747d('0x37')](_0x27b3bc[_0x747d('0x33')]['fields']));_0x55b5b6['attributes']=_0x55b5b6[_0x747d('0x38')]['length']?_0x55b5b6[_0x747d('0x38')]:_0x145cbe[_0x747d('0x32')];if(_0x27b3bc[_0x747d('0x33')][_0x747d('0x44')]){_0x55b5b6['include']=[{'all':!![]}];}_0x55b5b6=_[_0x747d('0x42')]({},_0x55b5b6,_0x27b3bc[_0x747d('0x43')]);return db[_0x747d('0x2e')][_0x747d('0x49')](_0x55b5b6)['then'](handleEntityNotFound(_0x469883,null))[_0x747d('0x26')](respondWithResult(_0x469883,null))[_0x747d('0x47')](handleError(_0x469883,null));};exports[_0x747d('0x4a')]=function(_0x31898a,_0x2a6e31){return db[_0x747d('0x2e')][_0x747d('0x4a')](_0x31898a[_0x747d('0x4b')],{})[_0x747d('0x26')](respondWithResult(_0x2a6e31,0xc9))[_0x747d('0x47')](handleError(_0x2a6e31,null));};exports[_0x747d('0x25')]=function(_0x287cc5,_0x223222){if(_0x287cc5[_0x747d('0x4b')]['id']){delete _0x287cc5[_0x747d('0x4b')]['id'];}return db[_0x747d('0x2e')]['find']({'where':{'id':_0x287cc5[_0x747d('0x4c')]['id']}})[_0x747d('0x26')](handleEntityNotFound(_0x223222,null))[_0x747d('0x26')](saveUpdates(_0x287cc5[_0x747d('0x4b')],null))[_0x747d('0x26')](respondWithResult(_0x223222,null))['catch'](handleError(_0x223222,null));};exports[_0x747d('0x27')]=function(_0xd7cdfe,_0x290951){return db[_0x747d('0x2e')][_0x747d('0x49')]({'where':{'id':_0xd7cdfe['params']['id']}})[_0x747d('0x26')](handleEntityNotFound(_0x290951,null))[_0x747d('0x26')](removeEntity(_0x290951,null))['catch'](handleError(_0x290951,null));};exports[_0x747d('0x4d')]=function(_0x261552,_0x368eaa){return db[_0x747d('0x2e')][_0x747d('0x4d')]()[_0x747d('0x26')](respondWithResult(_0x368eaa,null))[_0x747d('0x47')](handleError(_0x368eaa,null));}; \ No newline at end of file +var _0x3afb=['limit','count','status','set','apply','reject','save','update','then','destroy','error','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset'];(function(_0x3dd3bc,_0x32950b){var _0x172373=function(_0x2b0f0d){while(--_0x2b0f0d){_0x3dd3bc['push'](_0x3dd3bc['shift']());}};_0x172373(++_0x32950b);}(_0x3afb,0xbb));var _0xb3af=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0x3afb[_0x4d08b8];return _0x70214a;};'use strict';var emlformat=require(_0xb3af('0x0'));var rimraf=require(_0xb3af('0x1'));var zipdir=require(_0xb3af('0x2'));var jsonpatch=require(_0xb3af('0x3'));var rp=require(_0xb3af('0x4'));var moment=require(_0xb3af('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb3af('0x6'));var path=require(_0xb3af('0x7'));var sox=require(_0xb3af('0x8'));var csv=require(_0xb3af('0x9'));var ejs=require(_0xb3af('0xa'));var fs=require('fs');var fs_extra=require(_0xb3af('0xb'));var _=require(_0xb3af('0xc'));var squel=require(_0xb3af('0xd'));var crypto=require('crypto');var jsforce=require(_0xb3af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb3af('0x9'));var querystring=require(_0xb3af('0xf'));var Papa=require(_0xb3af('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb3af('0x11'));var as=require(_0xb3af('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3af('0x13'));var utils=require('../../config/utils');var config=require(_0xb3af('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3af('0x15'))['db'];function respondWithStatusCode(_0x1f9bd1,_0x430b37){_0x430b37=_0x430b37||0xcc;return function(_0x46b6f4){if(_0x46b6f4){return _0x1f9bd1[_0xb3af('0x16')](_0x430b37);}return _0x1f9bd1['status'](_0x430b37)[_0xb3af('0x17')]();};}function respondWithResult(_0x1ed575,_0x483b17){_0x483b17=_0x483b17||0xc8;return function(_0x35a773){if(_0x35a773){return _0x1ed575['status'](_0x483b17)[_0xb3af('0x18')](_0x35a773);}};}function respondWithFilteredResult(_0x21d76f,_0x141667){return function(_0x4d978d){if(_0x4d978d){var _0x4d2a8f=typeof _0x141667[_0xb3af('0x19')]==='undefined'&&typeof _0x141667[_0xb3af('0x1a')]==='undefined';var _0x442659=_0x4d978d[_0xb3af('0x1b')];var _0x5d10b6=_0x4d2a8f?0x0:_0x141667[_0xb3af('0x19')];var _0x590404=_0x4d2a8f?_0x4d978d[_0xb3af('0x1b')]:_0x141667[_0xb3af('0x19')]+_0x141667[_0xb3af('0x1a')];var _0x153458;if(_0x590404>=_0x442659){_0x590404=_0x442659;_0x153458=0xc8;}else{_0x153458=0xce;}_0x21d76f[_0xb3af('0x1c')](_0x153458);return _0x21d76f[_0xb3af('0x1d')]('Content-Range',_0x5d10b6+'-'+_0x590404+'/'+_0x442659)[_0xb3af('0x18')](_0x4d978d);}return null;};}function patchUpdates(_0x224581){return function(_0x2369eb){try{jsonpatch[_0xb3af('0x1e')](_0x2369eb,_0x224581,!![]);}catch(_0x5142c4){return BPromise[_0xb3af('0x1f')](_0x5142c4);}return _0x2369eb[_0xb3af('0x20')]();};}function saveUpdates(_0x5fd7af,_0x2e10fd){return function(_0x25b2a4){if(_0x25b2a4){return _0x25b2a4[_0xb3af('0x21')](_0x5fd7af)[_0xb3af('0x22')](function(_0x1c488d){return _0x1c488d;});}return null;};}function removeEntity(_0x513f63,_0x3d71cd){return function(_0x3788f4){if(_0x3788f4){return _0x3788f4[_0xb3af('0x23')]()[_0xb3af('0x22')](function(){_0x513f63[_0xb3af('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265b1e,_0x3d529e){return function(_0x59e7a7){if(!_0x59e7a7){_0x265b1e[_0xb3af('0x16')](0x194);}return _0x59e7a7;};}function handleError(_0x4362ae,_0x4571bd){_0x4571bd=_0x4571bd||0x1f4;return function(_0x5d48ab){logger[_0xb3af('0x24')](_0x5d48ab['stack']);if(_0x5d48ab['name']){delete _0x5d48ab['name'];}_0x4362ae[_0xb3af('0x1c')](_0x4571bd)[_0xb3af('0x25')](_0x5d48ab);};}exports['index']=function(_0x44c666,_0x4be8ab){var _0x49dc16={},_0x34db18={},_0x416bfd={'count':0x0,'rows':[]};var _0x343336=_[_0xb3af('0x26')](db[_0xb3af('0x27')][_0xb3af('0x28')],function(_0x407844){return{'name':_0x407844[_0xb3af('0x29')],'type':_0x407844[_0xb3af('0x2a')][_0xb3af('0x2b')]};});_0x34db18[_0xb3af('0x2c')]=_[_0xb3af('0x26')](_0x343336,_0xb3af('0x2d'));_0x34db18[_0xb3af('0x2e')]=_[_0xb3af('0x2f')](_0x44c666[_0xb3af('0x2e')]);_0x34db18[_0xb3af('0x30')]=_[_0xb3af('0x31')](_0x34db18['model'],_0x34db18[_0xb3af('0x2e')]);_0x49dc16[_0xb3af('0x32')]=_[_0xb3af('0x31')](_0x34db18[_0xb3af('0x2c')],qs['fields'](_0x44c666['query']['fields']));_0x49dc16['attributes']=_0x49dc16[_0xb3af('0x32')]['length']?_0x49dc16[_0xb3af('0x32')]:_0x34db18[_0xb3af('0x2c')];if(!_0x44c666[_0xb3af('0x2e')]['hasOwnProperty'](_0xb3af('0x33'))){_0x49dc16['limit']=qs[_0xb3af('0x1a')](_0x44c666[_0xb3af('0x2e')][_0xb3af('0x1a')]);_0x49dc16['offset']=qs['offset'](_0x44c666[_0xb3af('0x2e')]['offset']);}_0x49dc16['order']=qs['sort'](_0x44c666[_0xb3af('0x2e')][_0xb3af('0x34')]);_0x49dc16[_0xb3af('0x35')]=qs[_0xb3af('0x30')](_[_0xb3af('0x36')](_0x44c666[_0xb3af('0x2e')],_0x34db18[_0xb3af('0x30')]),_0x343336);if(_0x44c666[_0xb3af('0x2e')]['filter']){_0x49dc16[_0xb3af('0x35')]=_['merge'](_0x49dc16[_0xb3af('0x35')],{'$or':_['map'](_0x343336,function(_0x131313){if(_0x131313[_0xb3af('0x2a')]!==_0xb3af('0x37')){var _0x303d97={};_0x303d97[_0x131313['name']]={'$like':'%'+_0x44c666[_0xb3af('0x2e')][_0xb3af('0x38')]+'%'};return _0x303d97;}})});}_0x49dc16=_['merge']({},_0x49dc16,_0x44c666[_0xb3af('0x39')]);var _0x267060={'where':_0x49dc16['where']};return db['IntegrationReport'][_0xb3af('0x1b')](_0x267060)[_0xb3af('0x22')](function(_0x33ecea){_0x416bfd[_0xb3af('0x1b')]=_0x33ecea;if(_0x44c666[_0xb3af('0x2e')][_0xb3af('0x3a')]){_0x49dc16[_0xb3af('0x3b')]=[{'all':!![]}];}return db[_0xb3af('0x27')][_0xb3af('0x3c')](_0x49dc16);})[_0xb3af('0x22')](function(_0x2ec51c){_0x416bfd[_0xb3af('0x3d')]=_0x2ec51c;return _0x416bfd;})[_0xb3af('0x22')](respondWithFilteredResult(_0x4be8ab,_0x49dc16))[_0xb3af('0x3e')](handleError(_0x4be8ab,null));};exports[_0xb3af('0x3f')]=function(_0x1dab5b,_0x2ea368){var _0x32cf51={'raw':![],'where':{'id':_0x1dab5b[_0xb3af('0x40')]['id']}},_0x343328={};_0x343328[_0xb3af('0x2c')]=_[_0xb3af('0x2f')](db[_0xb3af('0x27')][_0xb3af('0x28')]);_0x343328[_0xb3af('0x2e')]=_[_0xb3af('0x2f')](_0x1dab5b[_0xb3af('0x2e')]);_0x343328[_0xb3af('0x30')]=_['intersection'](_0x343328[_0xb3af('0x2c')],_0x343328[_0xb3af('0x2e')]);_0x32cf51[_0xb3af('0x32')]=_[_0xb3af('0x31')](_0x343328[_0xb3af('0x2c')],qs['fields'](_0x1dab5b['query'][_0xb3af('0x41')]));_0x32cf51['attributes']=_0x32cf51[_0xb3af('0x32')]['length']?_0x32cf51[_0xb3af('0x32')]:_0x343328['model'];if(_0x1dab5b['query'][_0xb3af('0x3a')]){_0x32cf51[_0xb3af('0x3b')]=[{'all':!![]}];}_0x32cf51=_[_0xb3af('0x42')]({},_0x32cf51,_0x1dab5b[_0xb3af('0x39')]);return db[_0xb3af('0x27')][_0xb3af('0x43')](_0x32cf51)[_0xb3af('0x22')](handleEntityNotFound(_0x2ea368,null))['then'](respondWithResult(_0x2ea368,null))[_0xb3af('0x3e')](handleError(_0x2ea368,null));};exports['create']=function(_0x2b0c15,_0x2bdc32){return db[_0xb3af('0x27')][_0xb3af('0x44')](_0x2b0c15['body'],{})['then'](respondWithResult(_0x2bdc32,0xc9))[_0xb3af('0x3e')](handleError(_0x2bdc32,null));};exports[_0xb3af('0x21')]=function(_0x2af4ff,_0x33413d){if(_0x2af4ff[_0xb3af('0x45')]['id']){delete _0x2af4ff[_0xb3af('0x45')]['id'];}return db[_0xb3af('0x27')][_0xb3af('0x43')]({'where':{'id':_0x2af4ff['params']['id']}})[_0xb3af('0x22')](handleEntityNotFound(_0x33413d,null))[_0xb3af('0x22')](saveUpdates(_0x2af4ff[_0xb3af('0x45')],null))[_0xb3af('0x22')](respondWithResult(_0x33413d,null))[_0xb3af('0x3e')](handleError(_0x33413d,null));};exports[_0xb3af('0x23')]=function(_0x27833a,_0x11bd1b){return db[_0xb3af('0x27')][_0xb3af('0x43')]({'where':{'id':_0x27833a[_0xb3af('0x40')]['id']}})[_0xb3af('0x22')](handleEntityNotFound(_0x11bd1b,null))['then'](removeEntity(_0x11bd1b,null))[_0xb3af('0x3e')](handleError(_0x11bd1b,null));};exports[_0xb3af('0x46')]=function(_0x4179ed,_0x3f3f1c){return db[_0xb3af('0x27')][_0xb3af('0x46')]()[_0xb3af('0x22')](respondWithResult(_0x3f3f1c,null))[_0xb3af('0x3e')](handleError(_0x3f3f1c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1633291..66d0fcd 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 _0x23d6=['lodash','../../config/logger','moment','bluebird','path','rimraf','exports','define','IntegrationReport','report_integration'];(function(_0x135176,_0x25f953){var _0x1709e6=function(_0x2fe711){while(--_0x2fe711){_0x135176['push'](_0x135176['shift']());}};_0x1709e6(++_0x25f953);}(_0x23d6,0x96));var _0x623d=function(_0x27621c,_0x33125e){_0x27621c=_0x27621c-0x0;var _0x2e2df5=_0x23d6[_0x27621c];return _0x2e2df5;};'use strict';var _=require(_0x623d('0x0'));var util=require('util');var logger=require(_0x623d('0x1'))('api');var moment=require(_0x623d('0x2'));var BPromise=require(_0x623d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x623d('0x4'));var rimraf=require(_0x623d('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x623d('0x6')]=function(_0x5efeb7,_0x4687d6){return _0x5efeb7[_0x623d('0x7')](_0x623d('0x8'),attributes,{'tableName':_0x623d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4827=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe7d29e,_0x2305e2){var _0x51954a=function(_0x85a4e3){while(--_0x85a4e3){_0xe7d29e['push'](_0xe7d29e['shift']());}};_0x51954a(++_0x2305e2);}(_0x4827,0x1d9));var _0x7482=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4827[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7482('0x0'));var util=require(_0x7482('0x1'));var logger=require(_0x7482('0x2'))(_0x7482('0x3'));var moment=require(_0x7482('0x4'));var BPromise=require(_0x7482('0x5'));var rp=require(_0x7482('0x6'));var fs=require('fs');var path=require(_0x7482('0x7'));var rimraf=require(_0x7482('0x8'));var config=require(_0x7482('0x9'));var attributes=require(_0x7482('0xa'));module[_0x7482('0xb')]=function(_0x19f4bd,_0x2eb787){return _0x19f4bd[_0x7482('0xc')](_0x7482('0xd'),attributes,{'tableName':_0x7482('0xe'),'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 f98d91c..0499264 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 _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(_0x49e3b0,_0x5a2cc8){var _0x2592fc=function(_0x1edfd5){while(--_0x1edfd5){_0x49e3b0['push'](_0x49e3b0['shift']());}};_0x2592fc(++_0x5a2cc8);}(_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 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 +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2451c2,_0x2edda2){var _0x284f24=function(_0x4be5cd){while(--_0x4be5cd){_0x2451c2['push'](_0x2451c2['shift']());}};_0x284f24(++_0x2edda2);}(_0x57ca,0x108));var _0xa57c=function(_0x3663e9,_0x2e979b){_0x3663e9=_0x3663e9-0x0;var _0x3618e6=_0x57ca[_0x3663e9];return _0x3618e6;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 117c784..9fbd6dd 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 _0x22da=['/:id','show','get','getIntervals','post','create','/:id/sub_intervals','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index'];(function(_0xd32d70,_0x34a41e){var _0x5e8505=function(_0x5d4460){while(--_0x5d4460){_0xd32d70['push'](_0xd32d70['shift']());}};_0x5e8505(++_0x34a41e);}(_0x22da,0x80));var _0xa22d=function(_0x2b6154,_0x464090){_0x2b6154=_0x2b6154-0x0;var _0x2d27a5=_0x22da[_0x2b6154];return _0x2d27a5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa22d('0x0'));var timeout=require(_0xa22d('0x1'));var express=require(_0xa22d('0x2'));var router=express[_0xa22d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa22d('0x4'));var interaction=require(_0xa22d('0x5'));var config=require(_0xa22d('0x6'));var controller=require(_0xa22d('0x7'));router['get']('/',auth[_0xa22d('0x8')](),controller[_0xa22d('0x9')]);router['get'](_0xa22d('0xa'),auth[_0xa22d('0x8')](),controller[_0xa22d('0xb')]);router[_0xa22d('0xc')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xa22d('0xd')]);router[_0xa22d('0xe')]('/',auth['isAuthenticated'](),controller[_0xa22d('0xf')]);router[_0xa22d('0xe')](_0xa22d('0x10'),auth[_0xa22d('0x8')](),controller['addInterval']);router['post'](_0xa22d('0x11'),auth[_0xa22d('0x8')](),controller['addIntervals']);router[_0xa22d('0x12')]('/:id',auth[_0xa22d('0x8')](),controller[_0xa22d('0x13')]);router[_0xa22d('0x14')]('/:id',auth[_0xa22d('0x8')](),controller[_0xa22d('0x15')]);module[_0xa22d('0x16')]=router; \ No newline at end of file +var _0x7c1f=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7c1f,0x194));var _0xf7c1=function(_0x4213ae,_0x5e0c84){_0x4213ae=_0x4213ae-0x0;var _0x4f2555=_0x7c1f[_0x4213ae];return _0x4f2555;};'use strict';var multer=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var path=require(_0xf7c1('0x2'));var timeout=require(_0xf7c1('0x3'));var express=require(_0xf7c1('0x4'));var router=express['Router']();var fs_extra=require(_0xf7c1('0x5'));var auth=require(_0xf7c1('0x6'));var interaction=require(_0xf7c1('0x7'));var config=require('../../config/environment');var controller=require(_0xf7c1('0x8'));router[_0xf7c1('0x9')]('/',auth[_0xf7c1('0xa')](),controller[_0xf7c1('0xb')]);router['get'](_0xf7c1('0xc'),auth[_0xf7c1('0xa')](),controller[_0xf7c1('0xd')]);router[_0xf7c1('0x9')](_0xf7c1('0xe'),auth[_0xf7c1('0xa')](),controller[_0xf7c1('0xf')]);router[_0xf7c1('0x10')]('/',auth[_0xf7c1('0xa')](),controller[_0xf7c1('0x11')]);router[_0xf7c1('0x10')](_0xf7c1('0xe'),auth['isAuthenticated'](),controller[_0xf7c1('0x12')]);router[_0xf7c1('0x10')](_0xf7c1('0x13'),auth[_0xf7c1('0xa')](),controller[_0xf7c1('0x14')]);router[_0xf7c1('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf7c1('0x16')]);router['delete'](_0xf7c1('0xc'),auth[_0xf7c1('0xa')](),controller['destroy']);module[_0xf7c1('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 f4473b7..cdd7800 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 _0x8b19=['STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8b19,0x183));var _0x98b1=function(_0x4cdcae,_0x288104){_0x4cdcae=_0x4cdcae-0x0;var _0xedd296=_0x8b19[_0x4cdcae];return _0xedd296;};'use strict';var Sequelize=require(_0x98b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x98b1('0x1')]},'description':{'type':Sequelize[_0x98b1('0x1')]},'interval':{'type':Sequelize[_0x98b1('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x1a76=['exports','STRING','sequelize'];(function(_0x53c3dd,_0x583b9a){var _0x6dcf16=function(_0x4a7b80){while(--_0x4a7b80){_0x53c3dd['push'](_0x53c3dd['shift']());}};_0x6dcf16(++_0x583b9a);}(_0x1a76,0x1d3));var _0x61a7=function(_0x425b10,_0xe4cbbe){_0x425b10=_0x425b10-0x0;var _0x1eecfe=_0x1a76[_0x425b10];return _0x1eecfe;};'use strict';var Sequelize=require(_0x61a7('0x0'));module[_0x61a7('0x1')]={'name':{'type':Sequelize[_0x61a7('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 2400390..0e1e80d 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 _0xc002=['user','Intervals','UserProfileSection','userProfileId','autoAssociation','body','addInterval','IntervalId','findOne','filter','getIntervals','addIntervals','transaction','bulkCreate','findAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','catch','show','params','rawAttributes','fields','include','find','create','get','role'];(function(_0x21f803,_0x34a80a){var _0x22b6ab=function(_0x1d87ba){while(--_0x1d87ba){_0x21f803['push'](_0x21f803['shift']());}};_0x22b6ab(++_0x34a80a);}(_0xc002,0x1db));var _0x2c00=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xc002[_0x411017];return _0x2adeea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2c00('0x0'));var jsonpatch=require(_0x2c00('0x1'));var rp=require(_0x2c00('0x2'));var moment=require(_0x2c00('0x3'));var BPromise=require(_0x2c00('0x4'));var Mustache=require(_0x2c00('0x5'));var util=require('util');var path=require(_0x2c00('0x6'));var sox=require(_0x2c00('0x7'));var csv=require('to-csv');var ejs=require(_0x2c00('0x8'));var fs=require('fs');var fs_extra=require(_0x2c00('0x9'));var _=require(_0x2c00('0xa'));var squel=require(_0x2c00('0xb'));var crypto=require(_0x2c00('0xc'));var jsforce=require(_0x2c00('0xd'));var deskjs=require(_0x2c00('0xe'));var toCsv=require(_0x2c00('0xf'));var querystring=require(_0x2c00('0x10'));var Papa=require(_0x2c00('0x11'));var Redis=require('ioredis');var authService=require(_0x2c00('0x12'));var qs=require(_0x2c00('0x13'));var as=require(_0x2c00('0x14'));var hardwareService=require(_0x2c00('0x15'));var logger=require('../../config/logger')(_0x2c00('0x16'));var utils=require(_0x2c00('0x17'));var config=require(_0x2c00('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c00('0x19'))['db'];var extensions=require(_0x2c00('0x1a'));function respondWithStatusCode(_0x5dfb0d,_0xfb1996){_0xfb1996=_0xfb1996||0xcc;return function(_0xc054c1){if(_0xc054c1){return _0x5dfb0d[_0x2c00('0x1b')](_0xfb1996);}return _0x5dfb0d[_0x2c00('0x1c')](_0xfb1996)[_0x2c00('0x1d')]();};}function respondWithResult(_0x1ea9eb,_0x16fce8){_0x16fce8=_0x16fce8||0xc8;return function(_0x34acf3){if(_0x34acf3){return _0x1ea9eb[_0x2c00('0x1c')](_0x16fce8)[_0x2c00('0x1e')](_0x34acf3);}};}function respondWithFilteredResult(_0xbd6dfa,_0x33d735){return function(_0xb4cc8){if(_0xb4cc8){var _0x1169de=typeof _0x33d735[_0x2c00('0x1f')]===_0x2c00('0x20')&&typeof _0x33d735[_0x2c00('0x21')]===_0x2c00('0x20');var _0x20055c=_0xb4cc8[_0x2c00('0x22')];var _0x222a79=_0x1169de?0x0:_0x33d735[_0x2c00('0x1f')];var _0x35763f=_0x1169de?_0xb4cc8[_0x2c00('0x22')]:_0x33d735[_0x2c00('0x1f')]+_0x33d735['limit'];var _0x540ce8;if(_0x35763f>=_0x20055c){_0x35763f=_0x20055c;_0x540ce8=0xc8;}else{_0x540ce8=0xce;}_0xbd6dfa[_0x2c00('0x1c')](_0x540ce8);return _0xbd6dfa['set']('Content-Range',_0x222a79+'-'+_0x35763f+'/'+_0x20055c)[_0x2c00('0x1e')](_0xb4cc8);}return null;};}function patchUpdates(_0x44e575){return function(_0x3d9028){try{jsonpatch[_0x2c00('0x23')](_0x3d9028,_0x44e575,!![]);}catch(_0x553402){return BPromise[_0x2c00('0x24')](_0x553402);}return _0x3d9028['save']();};}function saveUpdates(_0x574796,_0x24b5c1){return function(_0x418593){if(_0x418593){return _0x418593[_0x2c00('0x25')](_0x574796)[_0x2c00('0x26')](function(_0x698b2a){return _0x698b2a;});}return null;};}function removeEntity(_0x53eb19,_0x8bbb9a){return function(_0x4bc9c8){if(_0x4bc9c8){return _0x4bc9c8[_0x2c00('0x27')]()[_0x2c00('0x26')](function(){var _0x15f7b9=_0x4bc9c8['get']({'plain':!![]});var _0x5c2ee6='Intervals';return db[_0x2c00('0x28')]['destroy']({'where':{'type':_0x5c2ee6,'resourceId':_0x15f7b9['id']}})[_0x2c00('0x26')](function(){return _0x4bc9c8;});})[_0x2c00('0x26')](function(){_0x53eb19[_0x2c00('0x1c')](0xcc)[_0x2c00('0x1d')]();});}};}function handleEntityNotFound(_0x2e5fdc,_0x2a0203){return function(_0x4ed920){if(!_0x4ed920){_0x2e5fdc['sendStatus'](0x194);}return _0x4ed920;};}function handleError(_0x4316c3,_0x41c0d5){_0x41c0d5=_0x41c0d5||0x1f4;return function(_0x20dc7c){logger[_0x2c00('0x29')](_0x20dc7c[_0x2c00('0x2a')]);if(_0x20dc7c[_0x2c00('0x2b')]){delete _0x20dc7c[_0x2c00('0x2b')];}_0x4316c3['status'](_0x41c0d5)[_0x2c00('0x2c')](_0x20dc7c);};}exports[_0x2c00('0x2d')]=function(_0x3b2848,_0x4ef986){var _0x2e7f75={},_0x5d061a={},_0x34f912={'count':0x0,'rows':[]};var _0x343e51=_[_0x2c00('0x2e')](db[_0x2c00('0x2f')]['rawAttributes'],function(_0x55c068){return{'name':_0x55c068[_0x2c00('0x30')],'type':_0x55c068[_0x2c00('0x31')][_0x2c00('0x32')]};});_0x5d061a[_0x2c00('0x33')]=_[_0x2c00('0x2e')](_0x343e51,_0x2c00('0x2b'));_0x5d061a[_0x2c00('0x34')]=_[_0x2c00('0x35')](_0x3b2848[_0x2c00('0x34')]);_0x5d061a[_0x2c00('0x36')]=_[_0x2c00('0x37')](_0x5d061a['model'],_0x5d061a[_0x2c00('0x34')]);_0x2e7f75[_0x2c00('0x38')]=_[_0x2c00('0x37')](_0x5d061a['model'],qs['fields'](_0x3b2848[_0x2c00('0x34')]['fields']));_0x2e7f75[_0x2c00('0x38')]=_0x2e7f75[_0x2c00('0x38')][_0x2c00('0x39')]?_0x2e7f75[_0x2c00('0x38')]:_0x5d061a[_0x2c00('0x33')];if(!_0x3b2848[_0x2c00('0x34')][_0x2c00('0x3a')](_0x2c00('0x3b'))){_0x2e7f75[_0x2c00('0x21')]=qs[_0x2c00('0x21')](_0x3b2848['query'][_0x2c00('0x21')]);_0x2e7f75[_0x2c00('0x1f')]=qs[_0x2c00('0x1f')](_0x3b2848['query'][_0x2c00('0x1f')]);}_0x2e7f75[_0x2c00('0x3c')]=qs[_0x2c00('0x3d')](_0x3b2848[_0x2c00('0x34')][_0x2c00('0x3d')]);_0x2e7f75['where']=qs[_0x2c00('0x36')](_[_0x2c00('0x3e')](_0x3b2848[_0x2c00('0x34')],_0x5d061a[_0x2c00('0x36')]),_0x343e51);if(_0x3b2848['query']['filter']){_0x2e7f75[_0x2c00('0x3f')]=_[_0x2c00('0x40')](_0x2e7f75['where'],{'$or':_['map'](_0x343e51,function(_0x4645fa){if(_0x4645fa['type']!=='VIRTUAL'){var _0x11c903={};_0x11c903[_0x4645fa['name']]={'$like':'%'+_0x3b2848[_0x2c00('0x34')]['filter']+'%'};return _0x11c903;}})});}_0x2e7f75=_[_0x2c00('0x40')]({},_0x2e7f75,_0x3b2848[_0x2c00('0x41')]);var _0x1cde21={'where':_0x2e7f75['where']};return db[_0x2c00('0x2f')][_0x2c00('0x22')](_0x1cde21)[_0x2c00('0x26')](function(_0x4d56c7){_0x34f912[_0x2c00('0x22')]=_0x4d56c7;if(_0x3b2848[_0x2c00('0x34')][_0x2c00('0x42')]){_0x2e7f75['include']=[{'all':!![]}];}return db[_0x2c00('0x2f')]['findAll'](_0x2e7f75);})[_0x2c00('0x26')](function(_0x41f758){_0x34f912['rows']=_0x41f758;return _0x34f912;})[_0x2c00('0x26')](respondWithFilteredResult(_0x4ef986,_0x2e7f75))[_0x2c00('0x43')](handleError(_0x4ef986,null));};exports[_0x2c00('0x44')]=function(_0x36e523,_0x2f565a){var _0x5c62d1={'raw':!![],'where':{'id':_0x36e523[_0x2c00('0x45')]['id']}},_0x265252={};_0x265252[_0x2c00('0x33')]=_['keys'](db['Interval'][_0x2c00('0x46')]);_0x265252[_0x2c00('0x34')]=_[_0x2c00('0x35')](_0x36e523['query']);_0x265252[_0x2c00('0x36')]=_['intersection'](_0x265252[_0x2c00('0x33')],_0x265252[_0x2c00('0x34')]);_0x5c62d1[_0x2c00('0x38')]=_[_0x2c00('0x37')](_0x265252[_0x2c00('0x33')],qs[_0x2c00('0x47')](_0x36e523[_0x2c00('0x34')]['fields']));_0x5c62d1[_0x2c00('0x38')]=_0x5c62d1[_0x2c00('0x38')]['length']?_0x5c62d1[_0x2c00('0x38')]:_0x265252[_0x2c00('0x33')];if(_0x36e523['query'][_0x2c00('0x42')]){_0x5c62d1[_0x2c00('0x48')]=[{'all':!![]}];}_0x5c62d1=_[_0x2c00('0x40')]({},_0x5c62d1,_0x36e523[_0x2c00('0x41')]);return db[_0x2c00('0x2f')][_0x2c00('0x49')](_0x5c62d1)['then'](handleEntityNotFound(_0x2f565a,null))['then'](respondWithResult(_0x2f565a,null))['catch'](handleError(_0x2f565a,null));};exports[_0x2c00('0x4a')]=function(_0x1c90af,_0x403a7a){return db[_0x2c00('0x2f')][_0x2c00('0x4a')](_0x1c90af['body'],{})['then'](function(_0x4adfe9){var _0x29be30=_0x1c90af['user'][_0x2c00('0x4b')]({'plain':!![]});if(!_0x29be30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29be30[_0x2c00('0x4c')]===_0x2c00('0x4d')){var _0x2fcb65=_0x4adfe9[_0x2c00('0x4b')]({'plain':!![]});var _0x547a20=_0x2c00('0x4e');return db[_0x2c00('0x4f')][_0x2c00('0x49')]({'where':{'name':_0x547a20,'userProfileId':_0x29be30[_0x2c00('0x50')]},'raw':!![]})[_0x2c00('0x26')](function(_0x11db73){if(_0x11db73&&_0x11db73[_0x2c00('0x51')]===0x0){return db[_0x2c00('0x28')][_0x2c00('0x4a')]({'name':_0x2fcb65[_0x2c00('0x2b')],'resourceId':_0x2fcb65['id'],'type':_0x11db73[_0x2c00('0x2b')],'sectionId':_0x11db73['id']},{})['then'](function(){return _0x4adfe9;});}else{return _0x4adfe9;}})[_0x2c00('0x43')](function(_0x4d91ca){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d91ca);throw _0x4d91ca;});}return _0x4adfe9;})[_0x2c00('0x26')](respondWithResult(_0x403a7a,0xc9))['catch'](handleError(_0x403a7a,null));};exports[_0x2c00('0x25')]=function(_0x4b8811,_0x1f7a9c){if(_0x4b8811['body']['id']){delete _0x4b8811[_0x2c00('0x52')]['id'];}return db[_0x2c00('0x2f')][_0x2c00('0x49')]({'where':{'id':_0x4b8811[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x1f7a9c,null))[_0x2c00('0x26')](saveUpdates(_0x4b8811[_0x2c00('0x52')],null))['then'](respondWithResult(_0x1f7a9c,null))[_0x2c00('0x43')](handleError(_0x1f7a9c,null));};exports[_0x2c00('0x27')]=function(_0x434ad5,_0x4001b9){return db[_0x2c00('0x2f')][_0x2c00('0x49')]({'where':{'id':_0x434ad5[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x4001b9,null))['then'](removeEntity(_0x4001b9,null))['catch'](handleError(_0x4001b9,null));};exports[_0x2c00('0x53')]=function(_0x395f58,_0x11af56,_0x11a07f){if(_0x395f58['body']['id']){delete _0x395f58['body']['id'];}return db['Interval'][_0x2c00('0x49')]({'where':{'id':_0x395f58[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x11af56,null))[_0x2c00('0x26')](function(_0x307cdc){if(_0x307cdc){_0x395f58[_0x2c00('0x52')][_0x2c00('0x54')]=_0x307cdc['id'];return db[_0x2c00('0x2f')]['create'](_0x395f58[_0x2c00('0x52')]);}})[_0x2c00('0x26')](respondWithResult(_0x11af56,null))[_0x2c00('0x43')](handleError(_0x11af56,null));};exports['getIntervals']=function(_0x42ce9a,_0x23916f,_0x5ed8a2){var _0x3c60d9={};var _0x2cc0d2={};var _0x3faf0c;var _0x25daca;return db[_0x2c00('0x2f')][_0x2c00('0x55')]({'where':{'id':_0x42ce9a[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x23916f,null))[_0x2c00('0x26')](function(_0x51d103){if(_0x51d103){_0x3faf0c=_0x51d103;_0x2cc0d2[_0x2c00('0x33')]=_[_0x2c00('0x35')](db['Interval']['rawAttributes']);_0x2cc0d2[_0x2c00('0x34')]=_[_0x2c00('0x35')](_0x42ce9a['query']);_0x2cc0d2[_0x2c00('0x36')]=_[_0x2c00('0x37')](_0x2cc0d2['model'],_0x2cc0d2[_0x2c00('0x34')]);_0x3c60d9[_0x2c00('0x38')]=_[_0x2c00('0x37')](_0x2cc0d2['model'],qs['fields'](_0x42ce9a[_0x2c00('0x34')][_0x2c00('0x47')]));_0x3c60d9[_0x2c00('0x38')]=_0x3c60d9[_0x2c00('0x38')][_0x2c00('0x39')]?_0x3c60d9[_0x2c00('0x38')]:_0x2cc0d2[_0x2c00('0x33')];_0x3c60d9[_0x2c00('0x3c')]=qs[_0x2c00('0x3d')](_0x42ce9a[_0x2c00('0x34')][_0x2c00('0x3d')]);_0x3c60d9['where']=qs[_0x2c00('0x36')](_[_0x2c00('0x3e')](_0x42ce9a[_0x2c00('0x34')],_0x2cc0d2['filters']));if(_0x42ce9a[_0x2c00('0x34')][_0x2c00('0x56')]){_0x3c60d9[_0x2c00('0x3f')]=_[_0x2c00('0x40')](_0x3c60d9[_0x2c00('0x3f')],{'$or':_[_0x2c00('0x2e')](_0x3c60d9['attributes'],function(_0x13a476){var _0x56cad7={};_0x56cad7[_0x13a476]={'$like':'%'+_0x42ce9a[_0x2c00('0x34')]['filter']+'%'};return _0x56cad7;})});}_0x3c60d9=_['merge']({},_0x3c60d9,_0x42ce9a[_0x2c00('0x41')]);return _0x3faf0c[_0x2c00('0x57')](_0x3c60d9);}})['then'](function(_0x189fed){if(_0x189fed){_0x25daca=_0x189fed[_0x2c00('0x39')];if(!_0x42ce9a[_0x2c00('0x34')]['hasOwnProperty'](_0x2c00('0x3b'))){_0x3c60d9[_0x2c00('0x21')]=qs['limit'](_0x42ce9a['query'][_0x2c00('0x21')]);_0x3c60d9[_0x2c00('0x1f')]=qs[_0x2c00('0x1f')](_0x42ce9a[_0x2c00('0x34')]['offset']);}return _0x3faf0c[_0x2c00('0x57')](_0x3c60d9);}})[_0x2c00('0x26')](function(_0x760d8c){if(_0x760d8c){return _0x760d8c?{'count':_0x25daca,'rows':_0x760d8c}:null;}})[_0x2c00('0x26')](respondWithResult(_0x23916f,null))[_0x2c00('0x43')](handleError(_0x23916f,null));};exports[_0x2c00('0x58')]=function(_0x5afea9,_0x2ad428,_0x5e0739){return db[_0x2c00('0x2f')]['findOne']({'where':{'id':_0x5afea9[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x2ad428,null))[_0x2c00('0x26')](function(_0x870884){if(_0x870884){return db['sequelize'][_0x2c00('0x59')](function(_0x144246){return db[_0x2c00('0x2f')][_0x2c00('0x27')]({'where':{'IntervalId':_0x5afea9['params']['id']},'transaction':_0x144246})[_0x2c00('0x26')](function(_0x2a61af){var _0x15d9ae=_[_0x2c00('0x2e')](_0x5afea9[_0x2c00('0x52')],function(_0x28f450){delete _0x28f450['id'];_0x28f450[_0x2c00('0x54')]=_0x5afea9[_0x2c00('0x45')]['id'];return _0x28f450;});return db[_0x2c00('0x2f')][_0x2c00('0x5a')](_0x15d9ae,{'transaction':_0x144246});});})['then'](function(){return db['Interval'][_0x2c00('0x5b')]({'where':{'IntervalId':_0x5afea9[_0x2c00('0x45')]['id']}});});}})[_0x2c00('0x26')](respondWithResult(_0x2ad428,null))['catch'](handleError(_0x2ad428,null));}; \ No newline at end of file +var _0xda10=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','rawAttributes','order','pick','getIntervals','addIntervals','sequelize','transaction','IntervalId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','get','Intervals','UserProfileResource','destroy','send','index','Interval','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0xda10,0x7d));var _0x0da1=function(_0x4e49fd,_0x35e01b){_0x4e49fd=_0x4e49fd-0x0;var _0x4b55e7=_0xda10[_0x4e49fd];return _0x4b55e7;};'use strict';var emlformat=require(_0x0da1('0x0'));var rimraf=require(_0x0da1('0x1'));var zipdir=require(_0x0da1('0x2'));var jsonpatch=require(_0x0da1('0x3'));var rp=require('request-promise');var moment=require(_0x0da1('0x4'));var BPromise=require(_0x0da1('0x5'));var Mustache=require(_0x0da1('0x6'));var util=require(_0x0da1('0x7'));var path=require('path');var sox=require(_0x0da1('0x8'));var csv=require(_0x0da1('0x9'));var ejs=require(_0x0da1('0xa'));var fs=require('fs');var fs_extra=require(_0x0da1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0da1('0xc'));var jsforce=require(_0x0da1('0xd'));var deskjs=require(_0x0da1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0da1('0xf'));var Papa=require('papaparse');var Redis=require(_0x0da1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0da1('0x11'));var as=require(_0x0da1('0x12'));var hardwareService=require(_0x0da1('0x13'));var logger=require(_0x0da1('0x14'))(_0x0da1('0x15'));var utils=require('../../config/utils');var config=require(_0x0da1('0x16'));var licenseUtil=require(_0x0da1('0x17'));var db=require(_0x0da1('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x726d60,_0x223b79){_0x223b79=_0x223b79||0xcc;return function(_0x2d4129){if(_0x2d4129){return _0x726d60[_0x0da1('0x19')](_0x223b79);}return _0x726d60[_0x0da1('0x1a')](_0x223b79)[_0x0da1('0x1b')]();};}function respondWithResult(_0x152501,_0x1fd57d){_0x1fd57d=_0x1fd57d||0xc8;return function(_0x5c230e){if(_0x5c230e){return _0x152501[_0x0da1('0x1a')](_0x1fd57d)[_0x0da1('0x1c')](_0x5c230e);}};}function respondWithFilteredResult(_0x1faa54,_0x368497){return function(_0x1ea9cf){if(_0x1ea9cf){var _0x3ba48f=typeof _0x368497[_0x0da1('0x1d')]==='undefined'&&typeof _0x368497[_0x0da1('0x1e')]===_0x0da1('0x1f');var _0xa56f7a=_0x1ea9cf[_0x0da1('0x20')];var _0x1f56bf=_0x3ba48f?0x0:_0x368497[_0x0da1('0x1d')];var _0x438ae9=_0x3ba48f?_0x1ea9cf['count']:_0x368497[_0x0da1('0x1d')]+_0x368497[_0x0da1('0x1e')];var _0x3defcd;if(_0x438ae9>=_0xa56f7a){_0x438ae9=_0xa56f7a;_0x3defcd=0xc8;}else{_0x3defcd=0xce;}_0x1faa54[_0x0da1('0x1a')](_0x3defcd);return _0x1faa54[_0x0da1('0x21')](_0x0da1('0x22'),_0x1f56bf+'-'+_0x438ae9+'/'+_0xa56f7a)['json'](_0x1ea9cf);}return null;};}function patchUpdates(_0x1ad204){return function(_0x314569){try{jsonpatch[_0x0da1('0x23')](_0x314569,_0x1ad204,!![]);}catch(_0x405884){return BPromise['reject'](_0x405884);}return _0x314569['save']();};}function saveUpdates(_0x38e8d8,_0x319185){return function(_0x305130){if(_0x305130){return _0x305130['update'](_0x38e8d8)['then'](function(_0x2f0bce){return _0x2f0bce;});}return null;};}function removeEntity(_0x2af7c9,_0x33db07){return function(_0x1fdd6c){if(_0x1fdd6c){return _0x1fdd6c['destroy']()[_0x0da1('0x24')](function(){var _0x34232c=_0x1fdd6c[_0x0da1('0x25')]({'plain':!![]});var _0x446d15=_0x0da1('0x26');return db[_0x0da1('0x27')][_0x0da1('0x28')]({'where':{'type':_0x446d15,'resourceId':_0x34232c['id']}})[_0x0da1('0x24')](function(){return _0x1fdd6c;});})['then'](function(){_0x2af7c9['status'](0xcc)[_0x0da1('0x1b')]();});}};}function handleEntityNotFound(_0x270c06,_0x413b78){return function(_0x172ee1){if(!_0x172ee1){_0x270c06['sendStatus'](0x194);}return _0x172ee1;};}function handleError(_0x944a6b,_0x133dfc){_0x133dfc=_0x133dfc||0x1f4;return function(_0x3ae2fa){logger['error'](_0x3ae2fa['stack']);if(_0x3ae2fa['name']){delete _0x3ae2fa['name'];}_0x944a6b[_0x0da1('0x1a')](_0x133dfc)[_0x0da1('0x29')](_0x3ae2fa);};}exports[_0x0da1('0x2a')]=function(_0x5c99e6,_0x15aac1){var _0x129cb9={},_0x403281={},_0xc06ec9={'count':0x0,'rows':[]};var _0x1284c8=_['map'](db[_0x0da1('0x2b')]['rawAttributes'],function(_0x10c28b){return{'name':_0x10c28b[_0x0da1('0x2c')],'type':_0x10c28b[_0x0da1('0x2d')][_0x0da1('0x2e')]};});_0x403281['model']=_[_0x0da1('0x2f')](_0x1284c8,'name');_0x403281[_0x0da1('0x30')]=_['keys'](_0x5c99e6[_0x0da1('0x30')]);_0x403281[_0x0da1('0x31')]=_[_0x0da1('0x32')](_0x403281['model'],_0x403281[_0x0da1('0x30')]);_0x129cb9['attributes']=_[_0x0da1('0x32')](_0x403281[_0x0da1('0x33')],qs[_0x0da1('0x34')](_0x5c99e6[_0x0da1('0x30')][_0x0da1('0x34')]));_0x129cb9['attributes']=_0x129cb9[_0x0da1('0x35')][_0x0da1('0x36')]?_0x129cb9[_0x0da1('0x35')]:_0x403281[_0x0da1('0x33')];if(!_0x5c99e6['query'][_0x0da1('0x37')](_0x0da1('0x38'))){_0x129cb9[_0x0da1('0x1e')]=qs[_0x0da1('0x1e')](_0x5c99e6['query'][_0x0da1('0x1e')]);_0x129cb9[_0x0da1('0x1d')]=qs[_0x0da1('0x1d')](_0x5c99e6[_0x0da1('0x30')][_0x0da1('0x1d')]);}_0x129cb9['order']=qs[_0x0da1('0x39')](_0x5c99e6['query'][_0x0da1('0x39')]);_0x129cb9[_0x0da1('0x3a')]=qs[_0x0da1('0x31')](_['pick'](_0x5c99e6[_0x0da1('0x30')],_0x403281[_0x0da1('0x31')]),_0x1284c8);if(_0x5c99e6[_0x0da1('0x30')][_0x0da1('0x3b')]){_0x129cb9[_0x0da1('0x3a')]=_[_0x0da1('0x3c')](_0x129cb9[_0x0da1('0x3a')],{'$or':_[_0x0da1('0x2f')](_0x1284c8,function(_0xb97f26){if(_0xb97f26[_0x0da1('0x2d')]!==_0x0da1('0x3d')){var _0x58a02a={};_0x58a02a[_0xb97f26['name']]={'$like':'%'+_0x5c99e6['query']['filter']+'%'};return _0x58a02a;}})});}_0x129cb9=_[_0x0da1('0x3c')]({},_0x129cb9,_0x5c99e6[_0x0da1('0x3e')]);var _0x2f5c11={'where':_0x129cb9[_0x0da1('0x3a')]};return db['Interval'][_0x0da1('0x20')](_0x2f5c11)[_0x0da1('0x24')](function(_0x555c60){_0xc06ec9[_0x0da1('0x20')]=_0x555c60;if(_0x5c99e6['query'][_0x0da1('0x3f')]){_0x129cb9[_0x0da1('0x40')]=[{'all':!![]}];}return db['Interval'][_0x0da1('0x41')](_0x129cb9);})['then'](function(_0x451865){_0xc06ec9[_0x0da1('0x42')]=_0x451865;return _0xc06ec9;})[_0x0da1('0x24')](respondWithFilteredResult(_0x15aac1,_0x129cb9))['catch'](handleError(_0x15aac1,null));};exports[_0x0da1('0x43')]=function(_0x3e4e02,_0x1a1a2c){var _0xa753b8={'raw':!![],'where':{'id':_0x3e4e02[_0x0da1('0x44')]['id']}},_0xd84a09={};_0xd84a09[_0x0da1('0x33')]=_[_0x0da1('0x45')](db[_0x0da1('0x2b')]['rawAttributes']);_0xd84a09['query']=_['keys'](_0x3e4e02['query']);_0xd84a09[_0x0da1('0x31')]=_['intersection'](_0xd84a09[_0x0da1('0x33')],_0xd84a09[_0x0da1('0x30')]);_0xa753b8['attributes']=_[_0x0da1('0x32')](_0xd84a09['model'],qs[_0x0da1('0x34')](_0x3e4e02[_0x0da1('0x30')][_0x0da1('0x34')]));_0xa753b8[_0x0da1('0x35')]=_0xa753b8['attributes'][_0x0da1('0x36')]?_0xa753b8[_0x0da1('0x35')]:_0xd84a09[_0x0da1('0x33')];if(_0x3e4e02[_0x0da1('0x30')][_0x0da1('0x3f')]){_0xa753b8['include']=[{'all':!![]}];}_0xa753b8=_[_0x0da1('0x3c')]({},_0xa753b8,_0x3e4e02[_0x0da1('0x3e')]);return db[_0x0da1('0x2b')][_0x0da1('0x46')](_0xa753b8)[_0x0da1('0x24')](handleEntityNotFound(_0x1a1a2c,null))[_0x0da1('0x24')](respondWithResult(_0x1a1a2c,null))[_0x0da1('0x47')](handleError(_0x1a1a2c,null));};exports['create']=function(_0x196935,_0x22e7d1){return db[_0x0da1('0x2b')][_0x0da1('0x48')](_0x196935[_0x0da1('0x49')],{})[_0x0da1('0x24')](function(_0x3d8316){var _0x487e47=_0x196935[_0x0da1('0x4a')][_0x0da1('0x25')]({'plain':!![]});if(!_0x487e47)throw new Error(_0x0da1('0x4b'));if(_0x487e47[_0x0da1('0x4c')]==='user'){var _0x464993=_0x3d8316['get']({'plain':!![]});var _0x401358=_0x0da1('0x26');return db[_0x0da1('0x4d')][_0x0da1('0x46')]({'where':{'name':_0x401358,'userProfileId':_0x487e47[_0x0da1('0x4e')]},'raw':!![]})[_0x0da1('0x24')](function(_0x1cb818){if(_0x1cb818&&_0x1cb818['autoAssociation']===0x0){return db[_0x0da1('0x27')][_0x0da1('0x48')]({'name':_0x464993[_0x0da1('0x4f')],'resourceId':_0x464993['id'],'type':_0x1cb818['name'],'sectionId':_0x1cb818['id']},{})[_0x0da1('0x24')](function(){return _0x3d8316;});}else{return _0x3d8316;}})[_0x0da1('0x47')](function(_0x593282){logger[_0x0da1('0x50')](_0x0da1('0x51'),_0x593282);throw _0x593282;});}return _0x3d8316;})[_0x0da1('0x24')](respondWithResult(_0x22e7d1,0xc9))[_0x0da1('0x47')](handleError(_0x22e7d1,null));};exports['update']=function(_0x3a547f,_0x72c315){if(_0x3a547f[_0x0da1('0x49')]['id']){delete _0x3a547f[_0x0da1('0x49')]['id'];}return db[_0x0da1('0x2b')][_0x0da1('0x46')]({'where':{'id':_0x3a547f[_0x0da1('0x44')]['id']}})[_0x0da1('0x24')](handleEntityNotFound(_0x72c315,null))[_0x0da1('0x24')](saveUpdates(_0x3a547f['body'],null))['then'](respondWithResult(_0x72c315,null))[_0x0da1('0x47')](handleError(_0x72c315,null));};exports[_0x0da1('0x28')]=function(_0x236160,_0x47127c){return db[_0x0da1('0x2b')]['find']({'where':{'id':_0x236160['params']['id']}})['then'](handleEntityNotFound(_0x47127c,null))[_0x0da1('0x24')](removeEntity(_0x47127c,null))[_0x0da1('0x47')](handleError(_0x47127c,null));};exports[_0x0da1('0x52')]=function(_0x7bc689,_0x5c7845,_0x13a9e0){if(_0x7bc689[_0x0da1('0x49')]['id']){delete _0x7bc689[_0x0da1('0x49')]['id'];}return db[_0x0da1('0x2b')][_0x0da1('0x46')]({'where':{'id':_0x7bc689[_0x0da1('0x44')]['id']}})[_0x0da1('0x24')](handleEntityNotFound(_0x5c7845,null))['then'](function(_0x1db0a3){if(_0x1db0a3){_0x7bc689['body']['IntervalId']=_0x1db0a3['id'];return db[_0x0da1('0x2b')]['create'](_0x7bc689[_0x0da1('0x49')]);}})['then'](respondWithResult(_0x5c7845,null))[_0x0da1('0x47')](handleError(_0x5c7845,null));};exports['getIntervals']=function(_0x306b0e,_0x3cca7d,_0x4d27bb){var _0x6cd44={};var _0x824172={};var _0x40a0a8;var _0x1ff995;return db['Interval'][_0x0da1('0x53')]({'where':{'id':_0x306b0e[_0x0da1('0x44')]['id']}})[_0x0da1('0x24')](handleEntityNotFound(_0x3cca7d,null))[_0x0da1('0x24')](function(_0x453fc7){if(_0x453fc7){_0x40a0a8=_0x453fc7;_0x824172[_0x0da1('0x33')]=_[_0x0da1('0x45')](db['Interval'][_0x0da1('0x54')]);_0x824172[_0x0da1('0x30')]=_[_0x0da1('0x45')](_0x306b0e[_0x0da1('0x30')]);_0x824172[_0x0da1('0x31')]=_['intersection'](_0x824172['model'],_0x824172[_0x0da1('0x30')]);_0x6cd44[_0x0da1('0x35')]=_[_0x0da1('0x32')](_0x824172[_0x0da1('0x33')],qs[_0x0da1('0x34')](_0x306b0e[_0x0da1('0x30')][_0x0da1('0x34')]));_0x6cd44['attributes']=_0x6cd44[_0x0da1('0x35')][_0x0da1('0x36')]?_0x6cd44[_0x0da1('0x35')]:_0x824172['model'];_0x6cd44[_0x0da1('0x55')]=qs[_0x0da1('0x39')](_0x306b0e[_0x0da1('0x30')][_0x0da1('0x39')]);_0x6cd44['where']=qs[_0x0da1('0x31')](_[_0x0da1('0x56')](_0x306b0e[_0x0da1('0x30')],_0x824172['filters']));if(_0x306b0e[_0x0da1('0x30')]['filter']){_0x6cd44[_0x0da1('0x3a')]=_[_0x0da1('0x3c')](_0x6cd44[_0x0da1('0x3a')],{'$or':_[_0x0da1('0x2f')](_0x6cd44['attributes'],function(_0x43bb24){var _0xabef8a={};_0xabef8a[_0x43bb24]={'$like':'%'+_0x306b0e['query'][_0x0da1('0x3b')]+'%'};return _0xabef8a;})});}_0x6cd44=_[_0x0da1('0x3c')]({},_0x6cd44,_0x306b0e['options']);return _0x40a0a8[_0x0da1('0x57')](_0x6cd44);}})[_0x0da1('0x24')](function(_0x46c275){if(_0x46c275){_0x1ff995=_0x46c275[_0x0da1('0x36')];if(!_0x306b0e[_0x0da1('0x30')][_0x0da1('0x37')](_0x0da1('0x38'))){_0x6cd44['limit']=qs[_0x0da1('0x1e')](_0x306b0e[_0x0da1('0x30')][_0x0da1('0x1e')]);_0x6cd44[_0x0da1('0x1d')]=qs['offset'](_0x306b0e['query']['offset']);}return _0x40a0a8[_0x0da1('0x57')](_0x6cd44);}})[_0x0da1('0x24')](function(_0x30f4fd){if(_0x30f4fd){return _0x30f4fd?{'count':_0x1ff995,'rows':_0x30f4fd}:null;}})[_0x0da1('0x24')](respondWithResult(_0x3cca7d,null))[_0x0da1('0x47')](handleError(_0x3cca7d,null));};exports[_0x0da1('0x58')]=function(_0x3ac935,_0x129dca,_0x3eb9e6){return db['Interval'][_0x0da1('0x53')]({'where':{'id':_0x3ac935['params']['id']}})[_0x0da1('0x24')](handleEntityNotFound(_0x129dca,null))[_0x0da1('0x24')](function(_0x24d036){if(_0x24d036){return db[_0x0da1('0x59')][_0x0da1('0x5a')](function(_0x18cb09){return db['Interval'][_0x0da1('0x28')]({'where':{'IntervalId':_0x3ac935[_0x0da1('0x44')]['id']},'transaction':_0x18cb09})['then'](function(_0xd432d){var _0x6a4707=_[_0x0da1('0x2f')](_0x3ac935[_0x0da1('0x49')],function(_0x4fab9f){delete _0x4fab9f['id'];_0x4fab9f[_0x0da1('0x5b')]=_0x3ac935[_0x0da1('0x44')]['id'];return _0x4fab9f;});return db['Interval']['bulkCreate'](_0x6a4707,{'transaction':_0x18cb09});});})['then'](function(){return db[_0x0da1('0x2b')][_0x0da1('0x41')]({'where':{'IntervalId':_0x3ac935[_0x0da1('0x44')]['id']}});});}})[_0x0da1('0x24')](respondWithResult(_0x129dca,null))[_0x0da1('0x47')](handleError(_0x129dca,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6138bcb..800456f 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 _0x0e8e=['map','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','Interval','tools_intervals','rewrite','interval','then','all'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x0e8e,0xce));var _0xe0e8=function(_0x3cbda4,_0xb3c9d9){_0x3cbda4=_0x3cbda4-0x0;var _0x26f859=_0x0e8e[_0x3cbda4];return _0x26f859;};'use strict';var attributes=require(_0xe0e8('0x0'));var extensions=require(_0xe0e8('0x1'));var iftime=require('../../utils/iftime')[_0xe0e8('0x2')];module[_0xe0e8('0x3')]=function(_0x42fdbf){return _0x42fdbf['define'](_0xe0e8('0x4'),attributes,{'tableName':_0xe0e8('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5625f3){extensions[_0xe0e8('0x6')](_0x42fdbf,_0x5625f3);},'afterBulkCreate':function(_0x4b56f1,_0x25ae5c,_0x381bfb){_0x381bfb();extensions[_0xe0e8('0x6')](_0x42fdbf,_0x4b56f1[0x0]);},'afterUpdate':function(_0x1c927e){extensions['rewrite'](_0x42fdbf,_0x1c927e);},'afterDestroy':function(_0x53092f){extensions[_0xe0e8('0x6')](_0x42fdbf,_0x53092f);}},'instanceMethods':{'ifTime':function(_0x4b33b2=undefined,_0x493236=new Date()){if(typeof this[_0xe0e8('0x7')]==='string'){return iftime(this[_0xe0e8('0x7')],_0x4b33b2,_0x493236);}else{return this['getIntervals']()[_0xe0e8('0x8')](function(_0x4f16d9){return Promise[_0xe0e8('0x9')](_0x4f16d9[_0xe0e8('0xa')](function(_0x5f4f69){return _0x5f4f69['ifTime'](_0x4b33b2,_0x493236);}));})[_0xe0e8('0x8')](function(_0x1c8878){return _0x1c8878[_0xe0e8('0xb')](function(_0x24447e,_0x1f1695){return _0x24447e||_0x1f1695;},![]);});}}}});}; \ No newline at end of file +var _0x0bd9=['../../components/extensions/rewrite','../../utils/iftime','define','tools_intervals','rewrite','string','all','map','ifTime','then','reduce','./interval.attributes'];(function(_0x3ac879,_0x3f217d){var _0x36adea=function(_0x463d0d){while(--_0x463d0d){_0x3ac879['push'](_0x3ac879['shift']());}};_0x36adea(++_0x3f217d);}(_0x0bd9,0x113));var _0x90bd=function(_0x3abe6a,_0xdd7b1a){_0x3abe6a=_0x3abe6a-0x0;var _0x2fc39e=_0x0bd9[_0x3abe6a];return _0x2fc39e;};'use strict';var attributes=require(_0x90bd('0x0'));var extensions=require(_0x90bd('0x1'));var iftime=require(_0x90bd('0x2'))['iftime'];module['exports']=function(_0x174fc9){return _0x174fc9[_0x90bd('0x3')]('Interval',attributes,{'tableName':_0x90bd('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cf2a3){extensions[_0x90bd('0x5')](_0x174fc9,_0x4cf2a3);},'afterBulkCreate':function(_0x54d932,_0xea4f4f,_0x4aae3d){_0x4aae3d();extensions['rewrite'](_0x174fc9,_0x54d932[0x0]);},'afterUpdate':function(_0x23149d){extensions[_0x90bd('0x5')](_0x174fc9,_0x23149d);},'afterDestroy':function(_0x133c76){extensions[_0x90bd('0x5')](_0x174fc9,_0x133c76);}},'instanceMethods':{'ifTime':function(_0x2d019c=undefined,_0x872796=new Date()){if(typeof this['interval']===_0x90bd('0x6')){return iftime(this['interval'],_0x2d019c,_0x872796);}else{return this['getIntervals']()['then'](function(_0x43a22c){return Promise[_0x90bd('0x7')](_0x43a22c[_0x90bd('0x8')](function(_0x36bbc7){return _0x36bbc7[_0x90bd('0x9')](_0x2d019c,_0x872796);}));})[_0x90bd('0xa')](function(_0x54c5c1){return _0x54c5c1[_0x90bd('0xb')](function(_0x2cb8fe,_0x384177){return _0x2cb8fe||_0x384177;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e115545..c786b30 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 _0xf384=['error','message','ShowInterval','debug','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','IntervalIftime','resolve','util','../../mysqldb','../../utils/iftime','iftime','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','catch'];(function(_0x5b0a4a,_0x11a985){var _0x2ce5c6=function(_0x4b3a55){while(--_0x4b3a55){_0x5b0a4a['push'](_0x5b0a4a['shift']());}};_0x2ce5c6(++_0x11a985);}(_0xf384,0x1c1));var _0x4f38=function(_0x2dcb1b,_0x25aec5){_0x2dcb1b=_0x2dcb1b-0x0;var _0x1edcf4=_0xf384[_0x2dcb1b];return _0x1edcf4;};'use strict';var _=require('lodash');var util=require(_0x4f38('0x0'));var db=require(_0x4f38('0x1'))['db'];var iftime=require(_0x4f38('0x2'))[_0x4f38('0x3')];var logger=require('../../config/logger')('rpc');exports[_0x4f38('0x4')]=function(_0x18c8df){var _0x3b386d=this;return new Promise(function(_0x4cfa5c,_0x2b4637){return db[_0x4f38('0x5')][_0x4f38('0x6')]({'raw':_0x18c8df[_0x4f38('0x7')]?_0x18c8df['options'][_0x4f38('0x8')]===undefined?!![]:![]:!![],'where':_0x18c8df[_0x4f38('0x7')]?_0x18c8df['options'][_0x4f38('0x9')]||null:null,'attributes':_0x18c8df[_0x4f38('0x7')]?_0x18c8df[_0x4f38('0x7')][_0x4f38('0xa')]||null:null,'limit':_0x18c8df[_0x4f38('0x7')]?_0x18c8df[_0x4f38('0x7')][_0x4f38('0xb')]||null:null,'include':_0x18c8df[_0x4f38('0x7')]?_0x18c8df[_0x4f38('0x7')][_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x18c8df[_0x4f38('0x7')][_0x4f38('0xc')],function(_0xfbd1c){return{'model':db[_0xfbd1c[_0x4f38('0xe')]],'as':_0xfbd1c['as'],'attributes':_0xfbd1c[_0x4f38('0xa')],'include':_0xfbd1c['include']?_[_0x4f38('0xd')](_0xfbd1c[_0x4f38('0xc')],function(_0x473c70){return{'model':db[_0x473c70[_0x4f38('0xe')]],'as':_0x473c70['as'],'attributes':_0x473c70[_0x4f38('0xa')],'include':_0x473c70[_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x473c70['include'],function(_0x3d3f26){return{'model':db[_0x3d3f26[_0x4f38('0xe')]],'as':_0x3d3f26['as'],'attributes':_0x3d3f26[_0x4f38('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f38('0xf')](function(_0x45d3ea){logger[_0x4f38('0x10')](_0x4f38('0x4'),_0x18c8df);logger['debug'](_0x4f38('0x4'),_0x18c8df,JSON[_0x4f38('0x11')](_0x45d3ea));_0x4cfa5c(_0x45d3ea);})[_0x4f38('0x12')](function(_0x34c960){logger[_0x4f38('0x13')](_0x4f38('0x4'),_0x34c960[_0x4f38('0x14')],_0x18c8df);_0x2b4637(_0x3b386d[_0x4f38('0x13')](0x1f4,_0x34c960['message']));});});};exports['ShowInterval']=function(_0x2e2e84){var _0x54d42d=this;return new Promise(function(_0xb92466,_0x214e32){return db[_0x4f38('0x5')]['find']({'raw':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84[_0x4f38('0x7')][_0x4f38('0x8')]===undefined?!![]:![]:!![],'where':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84['options'][_0x4f38('0x9')]||null:null,'attributes':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84[_0x4f38('0x7')][_0x4f38('0xa')]||null:null,'include':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84[_0x4f38('0x7')][_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x2e2e84['options'][_0x4f38('0xc')],function(_0x329905){return{'model':db[_0x329905[_0x4f38('0xe')]],'as':_0x329905['as'],'attributes':_0x329905['attributes'],'include':_0x329905[_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x329905[_0x4f38('0xc')],function(_0x226429){return{'model':db[_0x226429[_0x4f38('0xe')]],'as':_0x226429['as'],'attributes':_0x226429[_0x4f38('0xa')],'include':_0x226429[_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x226429['include'],function(_0x5240d2){return{'model':db[_0x5240d2[_0x4f38('0xe')]],'as':_0x5240d2['as'],'attributes':_0x5240d2[_0x4f38('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f38('0xf')](function(_0x3bd89c){logger[_0x4f38('0x10')](_0x4f38('0x15'),_0x2e2e84);logger[_0x4f38('0x16')](_0x4f38('0x15'),_0x2e2e84,JSON[_0x4f38('0x11')](_0x3bd89c));_0xb92466(_0x3bd89c);})['catch'](function(_0x130002){logger[_0x4f38('0x13')](_0x4f38('0x15'),_0x130002[_0x4f38('0x14')],_0x2e2e84);_0x214e32(_0x54d42d[_0x4f38('0x13')](0x1f4,_0x130002['message']));});});};function checkArrayOfIntervals(_0xb5544c,_0x1c1f19){var _0x42ec99=[];return db[_0x4f38('0x5')]['findAll']({'where':{'id':_0xb5544c}})[_0x4f38('0xf')](function(_0x32841e){_0x42ec99=_0x32841e;return Promise[_0x4f38('0x17')](_0x42ec99['map'](function(_0x232ce8){return _0x232ce8[_0x4f38('0x18')](_0x1c1f19);}));})[_0x4f38('0xf')](function(_0x1acac1){var _0x436453=_0x1acac1[_0x4f38('0x19')](function(_0x267d93,_0x1f1fed){return _0x267d93||_0x1f1fed;},![]);logger[_0x4f38('0x10')](util[_0x4f38('0x1a')](_0x4f38('0x1b'),_0x42ec99[_0x4f38('0xd')](function(_0x3180c4){return _0x3180c4[_0x4f38('0x1c')];})['join'](',\x20'),_0x42ec99[_0x4f38('0xd')](function(_0x2dff60){return _0x2dff60['id'];})[_0x4f38('0x1d')](',\x20')));return _0x436453;});}function checkSingleInterval(_0x10c78e,_0x12b7d1){return db[_0x4f38('0x5')][_0x4f38('0x1e')](_0x10c78e)['then'](function(_0x54c5e6){if(_0x54c5e6){logger[_0x4f38('0x10')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x54c5e6['name'],_0x54c5e6['id']));return _0x54c5e6[_0x4f38('0x18')](_0x12b7d1);}});}exports['IntervalIftime']=function(_0xa2a2b1){var _0x24cce4=_0xa2a2b1[_0x4f38('0x1f')];var _0x26e2ed=Array[_0x4f38('0x20')](_0xa2a2b1[_0x4f38('0x21')])?_0xa2a2b1[_0x4f38('0x21')]:typeof _0xa2a2b1['intervals']==='string'?[_0xa2a2b1[_0x4f38('0x21')]]:[];var _0x384751=_0xa2a2b1[_0x4f38('0x22')]||undefined;var _0x2b7b9b=![];if(_0x26e2ed[_0x4f38('0x23')]){logger['info'](util[_0x4f38('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x26e2ed[_0x4f38('0x1d')](';\x20')));}if(_0x384751){logger['info'](util[_0x4f38('0x1a')](_0x4f38('0x24'),_0x384751));}logger[_0x4f38('0x16')]('Iftime',_0x2b7b9b);logger['silly'](_0x4f38('0x25'),_0xa2a2b1);return Promise[_0x4f38('0x26')]()[_0x4f38('0xf')](function(){if(Array[_0x4f38('0x20')](_0x24cce4)){return checkArrayOfIntervals(_0x24cce4,_0x384751);}else if(_0x24cce4){return checkSingleInterval(_0x24cce4,_0x384751);}})[_0x4f38('0xf')](function(_0x4fa40c){var _0x407650=_0x26e2ed[_0x4f38('0x19')](function(_0xf4f963,_0x569abb){return _0xf4f963||iftime(_0x569abb,_0x384751);},![]);_0x2b7b9b=_0x4fa40c||_0x407650;return _0x2b7b9b;})[_0x4f38('0x12')](function(_0x578496){logger['error']('IntervalIftime',_0xa2a2b1,_0x578496);throw this[_0x4f38('0x13')](0x1f4,_0x578496[_0x4f38('0x14')]);});}; \ No newline at end of file +var _0x4af1=['GetInterval','debug','stringify','catch','error','message','info','ShowInterval','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','raw','where','limit','map','include','model','attributes','then'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4af1,0xf6));var _0x14af=function(_0x372b1d,_0x871955){_0x372b1d=_0x372b1d-0x0;var _0x3f8390=_0x4af1[_0x372b1d];return _0x3f8390;};'use strict';var _=require(_0x14af('0x0'));var util=require(_0x14af('0x1'));var db=require(_0x14af('0x2'))['db'];var iftime=require(_0x14af('0x3'))[_0x14af('0x4')];var logger=require(_0x14af('0x5'))(_0x14af('0x6'));exports['GetInterval']=function(_0xe7a786){var _0x58f71a=this;return new Promise(function(_0x2708c8,_0x2b9cd1){return db[_0x14af('0x7')][_0x14af('0x8')]({'raw':_0xe7a786[_0x14af('0x9')]?_0xe7a786['options'][_0x14af('0xa')]===undefined?!![]:![]:!![],'where':_0xe7a786[_0x14af('0x9')]?_0xe7a786[_0x14af('0x9')][_0x14af('0xb')]||null:null,'attributes':_0xe7a786[_0x14af('0x9')]?_0xe7a786[_0x14af('0x9')]['attributes']||null:null,'limit':_0xe7a786[_0x14af('0x9')]?_0xe7a786[_0x14af('0x9')][_0x14af('0xc')]||null:null,'include':_0xe7a786[_0x14af('0x9')]?_0xe7a786[_0x14af('0x9')]['include']?_[_0x14af('0xd')](_0xe7a786['options'][_0x14af('0xe')],function(_0x4a8367){return{'model':db[_0x4a8367[_0x14af('0xf')]],'as':_0x4a8367['as'],'attributes':_0x4a8367[_0x14af('0x10')],'include':_0x4a8367['include']?_[_0x14af('0xd')](_0x4a8367[_0x14af('0xe')],function(_0x8abf09){return{'model':db[_0x8abf09[_0x14af('0xf')]],'as':_0x8abf09['as'],'attributes':_0x8abf09[_0x14af('0x10')],'include':_0x8abf09[_0x14af('0xe')]?_['map'](_0x8abf09[_0x14af('0xe')],function(_0x1ad866){return{'model':db[_0x1ad866[_0x14af('0xf')]],'as':_0x1ad866['as'],'attributes':_0x1ad866['attributes']};}):[]};}):[]};}):[]:[]})[_0x14af('0x11')](function(_0x4da983){logger['info'](_0x14af('0x12'),_0xe7a786);logger[_0x14af('0x13')](_0x14af('0x12'),_0xe7a786,JSON[_0x14af('0x14')](_0x4da983));_0x2708c8(_0x4da983);})[_0x14af('0x15')](function(_0x2c56a8){logger[_0x14af('0x16')](_0x14af('0x12'),_0x2c56a8[_0x14af('0x17')],_0xe7a786);_0x2b9cd1(_0x58f71a[_0x14af('0x16')](0x1f4,_0x2c56a8['message']));});});};exports['ShowInterval']=function(_0x505311){var _0x425ba5=this;return new Promise(function(_0x5bcbe5,_0x568c2d){return db[_0x14af('0x7')]['find']({'raw':_0x505311[_0x14af('0x9')]?_0x505311[_0x14af('0x9')][_0x14af('0xa')]===undefined?!![]:![]:!![],'where':_0x505311[_0x14af('0x9')]?_0x505311[_0x14af('0x9')]['where']||null:null,'attributes':_0x505311[_0x14af('0x9')]?_0x505311[_0x14af('0x9')][_0x14af('0x10')]||null:null,'include':_0x505311['options']?_0x505311['options'][_0x14af('0xe')]?_[_0x14af('0xd')](_0x505311[_0x14af('0x9')][_0x14af('0xe')],function(_0x582f40){return{'model':db[_0x582f40[_0x14af('0xf')]],'as':_0x582f40['as'],'attributes':_0x582f40['attributes'],'include':_0x582f40[_0x14af('0xe')]?_['map'](_0x582f40[_0x14af('0xe')],function(_0x2ff001){return{'model':db[_0x2ff001['model']],'as':_0x2ff001['as'],'attributes':_0x2ff001['attributes'],'include':_0x2ff001[_0x14af('0xe')]?_[_0x14af('0xd')](_0x2ff001[_0x14af('0xe')],function(_0x53b641){return{'model':db[_0x53b641[_0x14af('0xf')]],'as':_0x53b641['as'],'attributes':_0x53b641[_0x14af('0x10')]};}):[]};}):[]};}):[]:[]})[_0x14af('0x11')](function(_0x1baf32){logger[_0x14af('0x18')]('ShowInterval',_0x505311);logger['debug'](_0x14af('0x19'),_0x505311,JSON[_0x14af('0x14')](_0x1baf32));_0x5bcbe5(_0x1baf32);})[_0x14af('0x15')](function(_0x296747){logger[_0x14af('0x16')](_0x14af('0x19'),_0x296747[_0x14af('0x17')],_0x505311);_0x568c2d(_0x425ba5[_0x14af('0x16')](0x1f4,_0x296747['message']));});});};function checkArrayOfIntervals(_0x4e7e15,_0x161f41){var _0x1344ee=[];return db[_0x14af('0x7')][_0x14af('0x8')]({'where':{'id':_0x4e7e15}})[_0x14af('0x11')](function(_0x428d8c){_0x1344ee=_0x428d8c;return Promise[_0x14af('0x1a')](_0x1344ee[_0x14af('0xd')](function(_0x38c25a){return _0x38c25a[_0x14af('0x1b')](_0x161f41);}));})[_0x14af('0x11')](function(_0x36f0b5){var _0x3486dc=_0x36f0b5['reduce'](function(_0x14d487,_0x3754d0){return _0x14d487||_0x3754d0;},![]);logger[_0x14af('0x18')](util[_0x14af('0x1c')](_0x14af('0x1d'),_0x1344ee['map'](function(_0x241b89){return _0x241b89[_0x14af('0x1e')];})['join'](',\x20'),_0x1344ee[_0x14af('0xd')](function(_0x15f094){return _0x15f094['id'];})[_0x14af('0x1f')](',\x20')));return _0x3486dc;});}function checkSingleInterval(_0x336b08,_0x1bf766){return db['Interval']['findById'](_0x336b08)[_0x14af('0x11')](function(_0x39a3a3){if(_0x39a3a3){logger['info'](util[_0x14af('0x1c')](_0x14af('0x20'),_0x39a3a3[_0x14af('0x1e')],_0x39a3a3['id']));return _0x39a3a3[_0x14af('0x1b')](_0x1bf766);}});}exports[_0x14af('0x21')]=function(_0x2600f0){var _0x8ddd4=_0x2600f0[_0x14af('0x22')];var _0x216ad4=Array[_0x14af('0x23')](_0x2600f0[_0x14af('0x24')])?_0x2600f0[_0x14af('0x24')]:typeof _0x2600f0[_0x14af('0x24')]===_0x14af('0x25')?[_0x2600f0[_0x14af('0x24')]]:[];var _0x509d85=_0x2600f0[_0x14af('0x26')]||undefined;var _0x561e58=![];if(_0x216ad4['length']){logger[_0x14af('0x18')](util[_0x14af('0x1c')](_0x14af('0x27'),_0x216ad4[_0x14af('0x1f')](';\x20')));}if(_0x509d85){logger[_0x14af('0x18')](util[_0x14af('0x1c')](_0x14af('0x28'),_0x509d85));}logger[_0x14af('0x13')](_0x14af('0x29'),_0x561e58);logger[_0x14af('0x2a')]('IntervalIftime',_0x2600f0);return Promise['resolve']()[_0x14af('0x11')](function(){if(Array['isArray'](_0x8ddd4)){return checkArrayOfIntervals(_0x8ddd4,_0x509d85);}else if(_0x8ddd4){return checkSingleInterval(_0x8ddd4,_0x509d85);}})['then'](function(_0x5f3168){var _0x16c02e=_0x216ad4[_0x14af('0x2b')](function(_0xfaca90,_0x3d1c4e){return _0xfaca90||iftime(_0x3d1c4e,_0x509d85);},![]);_0x561e58=_0x5f3168||_0x16c02e;return _0x561e58;})[_0x14af('0x15')](function(_0x5be69b){logger[_0x14af('0x16')](_0x14af('0x21'),_0x2600f0,_0x5be69b);throw this['error'](0x1f4,_0x5be69b[_0x14af('0x17')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e63dbe1..550223a 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x584cb0,_0x23e468){var _0x1face9=function(_0x2d6562){while(--_0x2d6562){_0x584cb0['push'](_0x584cb0['shift']());}};_0x1face9(++_0x23e468);}(_0xadb5,0xad));var _0x5adb=function(_0x224fe8,_0x26fb39){_0x224fe8=_0x224fe8-0x0;var _0x205682=_0xadb5[_0x224fe8];return _0x205682;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb10b,0x12a));var _0xbb10=function(_0x19688b,_0x5cae76){_0x19688b=_0x19688b-0x0;var _0x196944=_0xb10b[_0x19688b];return _0x196944;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e14a638..1144b32 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 _0xa167=['Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','track.xcallymotion.com','POST','Basic\x20','toString','base64','setEncoding','data','end','statusCode','json','parse','error','status','api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype'];(function(_0x482c8b,_0x61e45e){var _0x734dfa=function(_0x4626d9){while(--_0x4626d9){_0x482c8b['push'](_0x482c8b['shift']());}};_0x734dfa(++_0x61e45e);}(_0xa167,0xf6));var _0x7a16=function(_0x2a5597,_0x4509d0){_0x2a5597=_0x2a5597-0x0;var _0x24b1f2=_0xa167[_0x2a5597];return _0x24b1f2;};'use strict';var BPromise=require('bluebird');var https=require(_0x7a16('0x0'));var logger=require(_0x7a16('0x1'))(_0x7a16('0x2'));var USERNAME=_0x7a16('0x3');var PASSWORD=_0x7a16('0x4');function openIssue(_0x555c69,_0xb3076f){var _0x4b647a={'fields':{'project':{'key':_0x555c69[_0x7a16('0x5')]||_0x7a16('0x6')},'summary':(_0x555c69['summary']||_0x7a16('0x7'))+_0x7a16('0x8')+_0x555c69['ip'],'description':_0x555c69[_0x7a16('0x9')]||JSON[_0x7a16('0xa')](_0x555c69),'issuetype':{'name':_0x555c69[_0x7a16('0xb')]||_0x7a16('0xc')}}};_0x4b647a[_0x7a16('0xd')][_0x7a16('0xe')]=_0x555c69[_0x7a16('0xf')];_0x4b647a[_0x7a16('0xd')]['customfield_11501']=_0x555c69[_0x7a16('0x10')];_0x4b647a[_0x7a16('0xd')][_0x7a16('0x11')]=_0x555c69[_0x7a16('0x12')];_0x4b647a[_0x7a16('0xd')][_0x7a16('0x13')]=_0x555c69[_0x7a16('0x14')];_0x4b647a[_0x7a16('0xd')]['customfield_11504']=_0x555c69[_0x7a16('0x15')];_0x4b647a[_0x7a16('0xd')]['customfield_10102']=_0x555c69['ip'];var _0x2b1982={'host':_0x7a16('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7a16('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x7a16('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x7a16('0x19')](_0x7a16('0x1a'))}};var _0x22e24d=JSON['stringify'](_0x4b647a);var _0x2752d1=https['request'](_0x2b1982,function(_0x5de12b){_0x5de12b[_0x7a16('0x1b')]('utf8');var _0x5d0e1b='';_0x5de12b['on'](_0x7a16('0x1c'),function(_0x2ac791){_0x5d0e1b+=_0x2ac791;});_0x5de12b['on'](_0x7a16('0x1d'),function(){if(_0xb3076f){return _0xb3076f['status'](_0x5de12b[_0x7a16('0x1e')])[_0x7a16('0x1f')](JSON[_0x7a16('0x20')](_0x5d0e1b));}});});_0x2752d1['on'](_0x7a16('0x21'),function(_0x48a97b){if(_0xb3076f){return _0xb3076f[_0x7a16('0x22')](0x1f4)[_0x7a16('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7a16('0x23')}]});}});_0x2752d1[_0x7a16('0x24')](_0x22e24d);_0x2752d1[_0x7a16('0x1d')]();}exports[_0x7a16('0x25')]=openIssue;exports['send']=function(_0x4c5741,_0x50ab2){_0x4c5741[_0x7a16('0x26')]['ip']=_0x4c5741['headers'][_0x7a16('0x27')]||_0x4c5741[_0x7a16('0x28')][_0x7a16('0x29')]||_0x4c5741[_0x7a16('0x2a')][_0x7a16('0x29')]||_0x4c5741[_0x7a16('0x28')]['socket'][_0x7a16('0x29')];return openIssue(_0x4c5741[_0x7a16('0x26')],_0x50ab2);}; \ No newline at end of file +var _0xfeb7=['../../config/logger','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','base64','setEncoding','data','end','statusCode','json','parse','error','write','openIssue','send','body','headers','remoteAddress','socket','connection','bluebird'];(function(_0x5cae9b,_0xe5fe94){var _0x106b50=function(_0x45852d){while(--_0x45852d){_0x5cae9b['push'](_0x5cae9b['shift']());}};_0x106b50(++_0xe5fe94);}(_0xfeb7,0x1eb));var _0x7feb=function(_0x52daaa,_0x1305e0){_0x52daaa=_0x52daaa-0x0;var _0x173dcf=_0xfeb7[_0x52daaa];return _0x173dcf;};'use strict';var BPromise=require(_0x7feb('0x0'));var https=require('https');var logger=require(_0x7feb('0x1'))('api');var USERNAME=_0x7feb('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x397fa6,_0x309bde){var _0x49522d={'fields':{'project':{'key':_0x397fa6[_0x7feb('0x3')]||_0x7feb('0x4')},'summary':(_0x397fa6[_0x7feb('0x5')]||_0x7feb('0x6'))+_0x7feb('0x7')+_0x397fa6['ip'],'description':_0x397fa6[_0x7feb('0x8')]||JSON[_0x7feb('0x9')](_0x397fa6),'issuetype':{'name':_0x397fa6[_0x7feb('0xa')]||'Bug'}}};_0x49522d[_0x7feb('0xb')][_0x7feb('0xc')]=_0x397fa6[_0x7feb('0xd')];_0x49522d[_0x7feb('0xb')]['customfield_11501']=_0x397fa6[_0x7feb('0xe')];_0x49522d[_0x7feb('0xb')][_0x7feb('0xf')]=_0x397fa6[_0x7feb('0x10')];_0x49522d[_0x7feb('0xb')][_0x7feb('0x11')]=_0x397fa6[_0x7feb('0x12')];_0x49522d[_0x7feb('0xb')][_0x7feb('0x13')]=_0x397fa6[_0x7feb('0x14')];_0x49522d[_0x7feb('0xb')][_0x7feb('0x15')]=_0x397fa6['ip'];var _0x22a4a2={'host':_0x7feb('0x16'),'port':0x1bb,'path':_0x7feb('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x7feb('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x7feb('0x19'))}};var _0x243c00=JSON['stringify'](_0x49522d);var _0x51850a=https['request'](_0x22a4a2,function(_0x290967){_0x290967[_0x7feb('0x1a')]('utf8');var _0x3e550d='';_0x290967['on'](_0x7feb('0x1b'),function(_0x20e90e){_0x3e550d+=_0x20e90e;});_0x290967['on'](_0x7feb('0x1c'),function(){if(_0x309bde){return _0x309bde['status'](_0x290967[_0x7feb('0x1d')])[_0x7feb('0x1e')](JSON[_0x7feb('0x1f')](_0x3e550d));}});});_0x51850a['on'](_0x7feb('0x20'),function(_0x25d106){if(_0x309bde){return _0x309bde['status'](0x1f4)[_0x7feb('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x51850a[_0x7feb('0x21')](_0x243c00);_0x51850a[_0x7feb('0x1c')]();}exports[_0x7feb('0x22')]=openIssue;exports[_0x7feb('0x23')]=function(_0x4966d0,_0xa018d7){_0x4966d0[_0x7feb('0x24')]['ip']=_0x4966d0[_0x7feb('0x25')]['x-forwarded-for']||_0x4966d0['connection'][_0x7feb('0x26')]||_0x4966d0[_0x7feb('0x27')][_0x7feb('0x26')]||_0x4966d0[_0x7feb('0x28')][_0x7feb('0x27')][_0x7feb('0x26')];return openIssue(_0x4966d0['body'],_0xa018d7);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e65ff66..a1fe0e4 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 _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xaa88,0x137));var _0x8aa8=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0xaa88[_0x43941d];return _0x27b82a;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file +var _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x6cf622,_0x146e67){var _0x1887fe=function(_0xe16cbd){while(--_0xe16cbd){_0x6cf622['push'](_0x6cf622['shift']());}};_0x1887fe(++_0x146e67);}(_0xfd28,0x148));var _0x8fd2=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xfd28[_0x46ae5a];return _0x434986;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 506dcf7..a6721dc 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x347614,_0x58ef65){_0x347614=_0x347614-0x0;var _0x2e7867=_0x7a54[_0x347614];return _0x2e7867;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x25810b,_0x372621){_0x25810b=_0x25810b-0x0;var _0x5960cb=_0x7a54[_0x25810b];return _0x5960cb;};'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 2b03488..0a2dfd3 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 _0x37c5=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','update','then','stack','name','index','map','type'];(function(_0x44dff7,_0xa8d824){var _0x14e851=function(_0x4ea125){while(--_0x4ea125){_0x44dff7['push'](_0x44dff7['shift']());}};_0x14e851(++_0xa8d824);}(_0x37c5,0xa7));var _0x537c=function(_0xbec1a6,_0x20b2d3){_0xbec1a6=_0xbec1a6-0x0;var _0x5a4ebb=_0x37c5[_0xbec1a6];return _0x5a4ebb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x537c('0x0'));var zipdir=require(_0x537c('0x1'));var jsonpatch=require(_0x537c('0x2'));var rp=require(_0x537c('0x3'));var moment=require(_0x537c('0x4'));var BPromise=require(_0x537c('0x5'));var Mustache=require(_0x537c('0x6'));var util=require(_0x537c('0x7'));var path=require(_0x537c('0x8'));var sox=require(_0x537c('0x9'));var csv=require('to-csv');var ejs=require(_0x537c('0xa'));var fs=require('fs');var fs_extra=require(_0x537c('0xb'));var _=require(_0x537c('0xc'));var squel=require('squel');var crypto=require(_0x537c('0xd'));var jsforce=require(_0x537c('0xe'));var deskjs=require(_0x537c('0xf'));var toCsv=require(_0x537c('0x10'));var querystring=require('querystring');var Papa=require(_0x537c('0x11'));var Redis=require(_0x537c('0x12'));var authService=require(_0x537c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x537c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x537c('0x15'));var utils=require('../../config/utils');var config=require(_0x537c('0x16'));var licenseUtil=require(_0x537c('0x17'));var db=require(_0x537c('0x18'))['db'];function respondWithStatusCode(_0x473606,_0x1ecb98){_0x1ecb98=_0x1ecb98||0xcc;return function(_0x4554be){if(_0x4554be){return _0x473606[_0x537c('0x19')](_0x1ecb98);}return _0x473606[_0x537c('0x1a')](_0x1ecb98)[_0x537c('0x1b')]();};}function respondWithResult(_0x577981,_0x8d0c3){_0x8d0c3=_0x8d0c3||0xc8;return function(_0x405e39){if(_0x405e39){return _0x577981[_0x537c('0x1a')](_0x8d0c3)[_0x537c('0x1c')](_0x405e39);}};}function respondWithFilteredResult(_0x116453,_0x392421){return function(_0x2158e2){if(_0x2158e2){var _0x3776c3=typeof _0x392421[_0x537c('0x1d')]==='undefined'&&typeof _0x392421[_0x537c('0x1e')]==='undefined';var _0x55df08=_0x2158e2[_0x537c('0x1f')];var _0x237be8=_0x3776c3?0x0:_0x392421[_0x537c('0x1d')];var _0x5f3776=_0x3776c3?_0x2158e2[_0x537c('0x1f')]:_0x392421[_0x537c('0x1d')]+_0x392421['limit'];var _0x5ca4d5;if(_0x5f3776>=_0x55df08){_0x5f3776=_0x55df08;_0x5ca4d5=0xc8;}else{_0x5ca4d5=0xce;}_0x116453[_0x537c('0x1a')](_0x5ca4d5);return _0x116453['set']('Content-Range',_0x237be8+'-'+_0x5f3776+'/'+_0x55df08)[_0x537c('0x1c')](_0x2158e2);}return null;};}function patchUpdates(_0x32be40){return function(_0x5cfd81){try{jsonpatch[_0x537c('0x20')](_0x5cfd81,_0x32be40,!![]);}catch(_0x259ab2){return BPromise['reject'](_0x259ab2);}return _0x5cfd81['save']();};}function saveUpdates(_0x1a91d1,_0x47bece){return function(_0x5d8b9e){if(_0x5d8b9e){return _0x5d8b9e[_0x537c('0x21')](_0x1a91d1)[_0x537c('0x22')](function(_0x13fd5e){return _0x13fd5e;});}return null;};}function removeEntity(_0x28a35a,_0x3698bc){return function(_0x26ab7d){if(_0x26ab7d){return _0x26ab7d['destroy']()[_0x537c('0x22')](function(){_0x28a35a[_0x537c('0x1a')](0xcc)[_0x537c('0x1b')]();});}};}function handleEntityNotFound(_0xcd7d47,_0x428e5d){return function(_0x4b6af1){if(!_0x4b6af1){_0xcd7d47['sendStatus'](0x194);}return _0x4b6af1;};}function handleError(_0x59442f,_0x403ff6){_0x403ff6=_0x403ff6||0x1f4;return function(_0x1fa0ca){logger['error'](_0x1fa0ca[_0x537c('0x23')]);if(_0x1fa0ca[_0x537c('0x24')]){delete _0x1fa0ca[_0x537c('0x24')];}_0x59442f['status'](_0x403ff6)['send'](_0x1fa0ca);};}exports[_0x537c('0x25')]=function(_0x44cc94,_0x11c11e){var _0x4e5f18={},_0x49d60b={},_0x5ca8f6={'count':0x0,'rows':[]};var _0x22f82e=_[_0x537c('0x26')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x50788a){return{'name':_0x50788a['fieldName'],'type':_0x50788a[_0x537c('0x27')][_0x537c('0x28')]};});_0x49d60b[_0x537c('0x29')]=_['map'](_0x22f82e,_0x537c('0x24'));_0x49d60b[_0x537c('0x2a')]=_[_0x537c('0x2b')](_0x44cc94['query']);_0x49d60b[_0x537c('0x2c')]=_[_0x537c('0x2d')](_0x49d60b[_0x537c('0x29')],_0x49d60b['query']);_0x4e5f18['attributes']=_[_0x537c('0x2d')](_0x49d60b[_0x537c('0x29')],qs[_0x537c('0x2e')](_0x44cc94[_0x537c('0x2a')][_0x537c('0x2e')]));_0x4e5f18[_0x537c('0x2f')]=_0x4e5f18[_0x537c('0x2f')][_0x537c('0x30')]?_0x4e5f18['attributes']:_0x49d60b['model'];if(!_0x44cc94[_0x537c('0x2a')][_0x537c('0x31')]('nolimit')){_0x4e5f18[_0x537c('0x1e')]=qs[_0x537c('0x1e')](_0x44cc94[_0x537c('0x2a')][_0x537c('0x1e')]);_0x4e5f18[_0x537c('0x1d')]=qs['offset'](_0x44cc94[_0x537c('0x2a')]['offset']);}_0x4e5f18['order']=qs['sort'](_0x44cc94['query'][_0x537c('0x32')]);_0x4e5f18[_0x537c('0x33')]=qs[_0x537c('0x2c')](_[_0x537c('0x34')](_0x44cc94[_0x537c('0x2a')],_0x49d60b[_0x537c('0x2c')]),_0x22f82e);if(_0x44cc94[_0x537c('0x2a')][_0x537c('0x35')]){_0x4e5f18[_0x537c('0x33')]=_[_0x537c('0x36')](_0x4e5f18[_0x537c('0x33')],{'$or':_[_0x537c('0x26')](_0x22f82e,function(_0x28b222){if(_0x28b222[_0x537c('0x27')]!=='VIRTUAL'){var _0x42ff20={};_0x42ff20[_0x28b222['name']]={'$like':'%'+_0x44cc94[_0x537c('0x2a')][_0x537c('0x35')]+'%'};return _0x42ff20;}})});}_0x4e5f18=_['merge']({},_0x4e5f18,_0x44cc94[_0x537c('0x37')]);var _0x3a05e1={'where':_0x4e5f18[_0x537c('0x33')]};return db[_0x537c('0x38')]['count'](_0x3a05e1)[_0x537c('0x22')](function(_0x189924){_0x5ca8f6[_0x537c('0x1f')]=_0x189924;if(_0x44cc94['query'][_0x537c('0x39')]){_0x4e5f18[_0x537c('0x3a')]=[{'all':!![]}];}return db[_0x537c('0x38')][_0x537c('0x3b')](_0x4e5f18);})[_0x537c('0x22')](function(_0x3fc07a){_0x5ca8f6['rows']=_0x3fc07a;return _0x5ca8f6;})[_0x537c('0x22')](respondWithFilteredResult(_0x11c11e,_0x4e5f18))[_0x537c('0x3c')](handleError(_0x11c11e,null));};exports[_0x537c('0x3d')]=function(_0x2ce967,_0x1f8350){var _0x2590f={'raw':!![],'where':{'id':_0x2ce967['params']['id']}},_0x2f236e={};_0x2f236e[_0x537c('0x29')]=_['keys'](db[_0x537c('0x38')][_0x537c('0x3e')]);_0x2f236e[_0x537c('0x2a')]=_[_0x537c('0x2b')](_0x2ce967[_0x537c('0x2a')]);_0x2f236e['filters']=_['intersection'](_0x2f236e[_0x537c('0x29')],_0x2f236e[_0x537c('0x2a')]);_0x2590f[_0x537c('0x2f')]=_[_0x537c('0x2d')](_0x2f236e[_0x537c('0x29')],qs[_0x537c('0x2e')](_0x2ce967['query'][_0x537c('0x2e')]));_0x2590f[_0x537c('0x2f')]=_0x2590f[_0x537c('0x2f')][_0x537c('0x30')]?_0x2590f[_0x537c('0x2f')]:_0x2f236e[_0x537c('0x29')];if(_0x2ce967[_0x537c('0x2a')][_0x537c('0x39')]){_0x2590f[_0x537c('0x3a')]=[{'all':!![]}];}_0x2590f=_[_0x537c('0x36')]({},_0x2590f,_0x2ce967[_0x537c('0x37')]);return db[_0x537c('0x38')][_0x537c('0x3f')](_0x2590f)[_0x537c('0x22')](handleEntityNotFound(_0x1f8350,null))['then'](respondWithResult(_0x1f8350,null))[_0x537c('0x3c')](handleError(_0x1f8350,null));};exports[_0x537c('0x40')]=function(_0x5bed3b,_0x2ddc3f){return db[_0x537c('0x38')][_0x537c('0x40')](_0x5bed3b['body'],{})[_0x537c('0x22')](respondWithResult(_0x2ddc3f,0xc9))[_0x537c('0x3c')](handleError(_0x2ddc3f,null));};exports[_0x537c('0x21')]=function(_0x432c00,_0x5b0dad){if(_0x432c00[_0x537c('0x41')]['id']){delete _0x432c00[_0x537c('0x41')]['id'];}return db[_0x537c('0x38')]['find']({'where':{'id':_0x432c00[_0x537c('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b0dad,null))[_0x537c('0x22')](saveUpdates(_0x432c00[_0x537c('0x41')],null))[_0x537c('0x22')](respondWithResult(_0x5b0dad,null))[_0x537c('0x3c')](handleError(_0x5b0dad,null));};exports[_0x537c('0x43')]=function(_0x25f216,_0x420f12){return db[_0x537c('0x38')][_0x537c('0x3f')]({'where':{'id':_0x25f216[_0x537c('0x42')]['id']}})['then'](handleEntityNotFound(_0x420f12,null))['then'](removeEntity(_0x420f12,null))[_0x537c('0x3c')](handleError(_0x420f12,null));};exports[_0x537c('0x44')]=function(_0x1d0bff,_0xfa8d30){return db[_0x537c('0x38')][_0x537c('0x44')]()[_0x537c('0x22')](respondWithResult(_0xfa8d30,null))['catch'](handleError(_0xfa8d30,null));}; \ No newline at end of file +var _0x68f5=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','rows','catch','show','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x68f5,0x11a));var _0x568f=function(_0x433326,_0x347edb){_0x433326=_0x433326-0x0;var _0x144f30=_0x68f5[_0x433326];return _0x144f30;};'use strict';var emlformat=require(_0x568f('0x0'));var rimraf=require(_0x568f('0x1'));var zipdir=require(_0x568f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x568f('0x3'));var moment=require(_0x568f('0x4'));var BPromise=require(_0x568f('0x5'));var Mustache=require(_0x568f('0x6'));var util=require(_0x568f('0x7'));var path=require('path');var sox=require(_0x568f('0x8'));var csv=require(_0x568f('0x9'));var ejs=require(_0x568f('0xa'));var fs=require('fs');var fs_extra=require(_0x568f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x568f('0xc'));var jsforce=require(_0x568f('0xd'));var deskjs=require(_0x568f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x568f('0xf'));var Papa=require('papaparse');var Redis=require(_0x568f('0x10'));var authService=require(_0x568f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x568f('0x12'));var hardwareService=require(_0x568f('0x13'));var logger=require(_0x568f('0x14'))(_0x568f('0x15'));var utils=require(_0x568f('0x16'));var config=require(_0x568f('0x17'));var licenseUtil=require(_0x568f('0x18'));var db=require(_0x568f('0x19'))['db'];function respondWithStatusCode(_0x200172,_0x4acf24){_0x4acf24=_0x4acf24||0xcc;return function(_0x341cde){if(_0x341cde){return _0x200172[_0x568f('0x1a')](_0x4acf24);}return _0x200172[_0x568f('0x1b')](_0x4acf24)[_0x568f('0x1c')]();};}function respondWithResult(_0x55fc40,_0x87b903){_0x87b903=_0x87b903||0xc8;return function(_0x53c270){if(_0x53c270){return _0x55fc40['status'](_0x87b903)[_0x568f('0x1d')](_0x53c270);}};}function respondWithFilteredResult(_0x15a4e5,_0x47316e){return function(_0x25e488){if(_0x25e488){var _0xcd73a2=typeof _0x47316e[_0x568f('0x1e')]===_0x568f('0x1f')&&typeof _0x47316e[_0x568f('0x20')]===_0x568f('0x1f');var _0x3d9645=_0x25e488[_0x568f('0x21')];var _0x49b64e=_0xcd73a2?0x0:_0x47316e[_0x568f('0x1e')];var _0x5cc7e2=_0xcd73a2?_0x25e488[_0x568f('0x21')]:_0x47316e[_0x568f('0x1e')]+_0x47316e[_0x568f('0x20')];var _0x1f4912;if(_0x5cc7e2>=_0x3d9645){_0x5cc7e2=_0x3d9645;_0x1f4912=0xc8;}else{_0x1f4912=0xce;}_0x15a4e5[_0x568f('0x1b')](_0x1f4912);return _0x15a4e5[_0x568f('0x22')](_0x568f('0x23'),_0x49b64e+'-'+_0x5cc7e2+'/'+_0x3d9645)[_0x568f('0x1d')](_0x25e488);}return null;};}function patchUpdates(_0x1a09a9){return function(_0x22c4e0){try{jsonpatch[_0x568f('0x24')](_0x22c4e0,_0x1a09a9,!![]);}catch(_0x2c65c6){return BPromise[_0x568f('0x25')](_0x2c65c6);}return _0x22c4e0[_0x568f('0x26')]();};}function saveUpdates(_0x3eb76d,_0x2afe66){return function(_0x2c61ea){if(_0x2c61ea){return _0x2c61ea[_0x568f('0x27')](_0x3eb76d)[_0x568f('0x28')](function(_0x4a248e){return _0x4a248e;});}return null;};}function removeEntity(_0xa2225a,_0x4590a8){return function(_0x20daca){if(_0x20daca){return _0x20daca[_0x568f('0x29')]()['then'](function(){_0xa2225a['status'](0xcc)[_0x568f('0x1c')]();});}};}function handleEntityNotFound(_0x45826b,_0x67f06c){return function(_0x6bb377){if(!_0x6bb377){_0x45826b['sendStatus'](0x194);}return _0x6bb377;};}function handleError(_0x51d57f,_0x3de8ce){_0x3de8ce=_0x3de8ce||0x1f4;return function(_0x577ca6){logger['error'](_0x577ca6['stack']);if(_0x577ca6[_0x568f('0x2a')]){delete _0x577ca6['name'];}_0x51d57f[_0x568f('0x1b')](_0x3de8ce)['send'](_0x577ca6);};}exports[_0x568f('0x2b')]=function(_0x2ff19b,_0x182a1f){var _0x52acac={},_0x209db2={},_0x18530c={'count':0x0,'rows':[]};var _0x4c0729=_[_0x568f('0x2c')](db['JscriptyAnswerReport'][_0x568f('0x2d')],function(_0x543573){return{'name':_0x543573['fieldName'],'type':_0x543573[_0x568f('0x2e')][_0x568f('0x2f')]};});_0x209db2[_0x568f('0x30')]=_[_0x568f('0x2c')](_0x4c0729,_0x568f('0x2a'));_0x209db2[_0x568f('0x31')]=_[_0x568f('0x32')](_0x2ff19b[_0x568f('0x31')]);_0x209db2['filters']=_[_0x568f('0x33')](_0x209db2[_0x568f('0x30')],_0x209db2[_0x568f('0x31')]);_0x52acac[_0x568f('0x34')]=_['intersection'](_0x209db2[_0x568f('0x30')],qs[_0x568f('0x35')](_0x2ff19b[_0x568f('0x31')][_0x568f('0x35')]));_0x52acac[_0x568f('0x34')]=_0x52acac[_0x568f('0x34')][_0x568f('0x36')]?_0x52acac['attributes']:_0x209db2[_0x568f('0x30')];if(!_0x2ff19b[_0x568f('0x31')][_0x568f('0x37')](_0x568f('0x38'))){_0x52acac[_0x568f('0x20')]=qs['limit'](_0x2ff19b['query'][_0x568f('0x20')]);_0x52acac[_0x568f('0x1e')]=qs[_0x568f('0x1e')](_0x2ff19b[_0x568f('0x31')][_0x568f('0x1e')]);}_0x52acac['order']=qs[_0x568f('0x39')](_0x2ff19b[_0x568f('0x31')][_0x568f('0x39')]);_0x52acac[_0x568f('0x3a')]=qs[_0x568f('0x3b')](_[_0x568f('0x3c')](_0x2ff19b[_0x568f('0x31')],_0x209db2[_0x568f('0x3b')]),_0x4c0729);if(_0x2ff19b[_0x568f('0x31')][_0x568f('0x3d')]){_0x52acac[_0x568f('0x3a')]=_[_0x568f('0x3e')](_0x52acac[_0x568f('0x3a')],{'$or':_[_0x568f('0x2c')](_0x4c0729,function(_0x3a2772){if(_0x3a2772['type']!==_0x568f('0x3f')){var _0x493c1d={};_0x493c1d[_0x3a2772['name']]={'$like':'%'+_0x2ff19b[_0x568f('0x31')]['filter']+'%'};return _0x493c1d;}})});}_0x52acac=_[_0x568f('0x3e')]({},_0x52acac,_0x2ff19b[_0x568f('0x40')]);var _0x4c08da={'where':_0x52acac[_0x568f('0x3a')]};return db[_0x568f('0x41')][_0x568f('0x21')](_0x4c08da)[_0x568f('0x28')](function(_0x10c487){_0x18530c['count']=_0x10c487;if(_0x2ff19b[_0x568f('0x31')][_0x568f('0x42')]){_0x52acac['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x52acac);})['then'](function(_0x3bcf12){_0x18530c[_0x568f('0x43')]=_0x3bcf12;return _0x18530c;})[_0x568f('0x28')](respondWithFilteredResult(_0x182a1f,_0x52acac))[_0x568f('0x44')](handleError(_0x182a1f,null));};exports[_0x568f('0x45')]=function(_0x4cdc7a,_0x2f6c1a){var _0xd884b9={'raw':!![],'where':{'id':_0x4cdc7a['params']['id']}},_0x8f3db1={};_0x8f3db1['model']=_[_0x568f('0x32')](db['JscriptyAnswerReport'][_0x568f('0x2d')]);_0x8f3db1[_0x568f('0x31')]=_['keys'](_0x4cdc7a[_0x568f('0x31')]);_0x8f3db1[_0x568f('0x3b')]=_[_0x568f('0x33')](_0x8f3db1['model'],_0x8f3db1['query']);_0xd884b9[_0x568f('0x34')]=_[_0x568f('0x33')](_0x8f3db1['model'],qs['fields'](_0x4cdc7a[_0x568f('0x31')][_0x568f('0x35')]));_0xd884b9['attributes']=_0xd884b9[_0x568f('0x34')]['length']?_0xd884b9[_0x568f('0x34')]:_0x8f3db1['model'];if(_0x4cdc7a[_0x568f('0x31')][_0x568f('0x42')]){_0xd884b9[_0x568f('0x46')]=[{'all':!![]}];}_0xd884b9=_[_0x568f('0x3e')]({},_0xd884b9,_0x4cdc7a['options']);return db[_0x568f('0x41')]['find'](_0xd884b9)[_0x568f('0x28')](handleEntityNotFound(_0x2f6c1a,null))['then'](respondWithResult(_0x2f6c1a,null))['catch'](handleError(_0x2f6c1a,null));};exports[_0x568f('0x47')]=function(_0x502884,_0x210ee9){return db[_0x568f('0x41')]['create'](_0x502884[_0x568f('0x48')],{})[_0x568f('0x28')](respondWithResult(_0x210ee9,0xc9))[_0x568f('0x44')](handleError(_0x210ee9,null));};exports['update']=function(_0x3e85a8,_0x1fe7c5){if(_0x3e85a8[_0x568f('0x48')]['id']){delete _0x3e85a8[_0x568f('0x48')]['id'];}return db['JscriptyAnswerReport'][_0x568f('0x49')]({'where':{'id':_0x3e85a8[_0x568f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1fe7c5,null))[_0x568f('0x28')](saveUpdates(_0x3e85a8[_0x568f('0x48')],null))[_0x568f('0x28')](respondWithResult(_0x1fe7c5,null))[_0x568f('0x44')](handleError(_0x1fe7c5,null));};exports[_0x568f('0x29')]=function(_0x4fd923,_0x406170){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x4fd923[_0x568f('0x4a')]['id']}})[_0x568f('0x28')](handleEntityNotFound(_0x406170,null))[_0x568f('0x28')](removeEntity(_0x406170,null))['catch'](handleError(_0x406170,null));};exports[_0x568f('0x4b')]=function(_0x379f87,_0x556618){return db[_0x568f('0x41')]['describe']()[_0x568f('0x28')](respondWithResult(_0x556618,null))[_0x568f('0x44')](handleError(_0x556618,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7a1416a..bacadf2 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 _0x656e=['report_jscripty_answers','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x1ca4ea,_0x2e44d4){var _0x2d9acc=function(_0x19f5de){while(--_0x19f5de){_0x1ca4ea['push'](_0x1ca4ea['shift']());}};_0x2d9acc(++_0x2e44d4);}(_0x656e,0x194));var _0xe656=function(_0x44881b,_0x541447){_0x44881b=_0x44881b-0x0;var _0x59b5cf=_0x656e[_0x44881b];return _0x59b5cf;};'use strict';var _=require(_0xe656('0x0'));var util=require(_0xe656('0x1'));var logger=require(_0xe656('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe656('0x3'));var rp=require(_0xe656('0x4'));var fs=require('fs');var path=require(_0xe656('0x5'));var rimraf=require(_0xe656('0x6'));var config=require(_0xe656('0x7'));var attributes=require(_0xe656('0x8'));module[_0xe656('0x9')]=function(_0x407156,_0x3f4a36){return _0x407156[_0xe656('0xa')](_0xe656('0xb'),attributes,{'tableName':_0xe656('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3736=['exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x5269d4,_0x317dd2){var _0x2cf22e=function(_0x258567){while(--_0x258567){_0x5269d4['push'](_0x5269d4['shift']());}};_0x2cf22e(++_0x317dd2);}(_0x3736,0xb9));var _0x6373=function(_0x108b66,_0x46f926){_0x108b66=_0x108b66-0x0;var _0x3e3e81=_0x3736[_0x108b66];return _0x3e3e81;};'use strict';var _=require(_0x6373('0x0'));var util=require(_0x6373('0x1'));var logger=require(_0x6373('0x2'))('api');var moment=require(_0x6373('0x3'));var BPromise=require(_0x6373('0x4'));var rp=require(_0x6373('0x5'));var fs=require('fs');var path=require(_0x6373('0x6'));var rimraf=require(_0x6373('0x7'));var config=require(_0x6373('0x8'));var attributes=require(_0x6373('0x9'));module[_0x6373('0xa')]=function(_0x451d23,_0x42ddf0){return _0x451d23['define'](_0x6373('0xb'),attributes,{'tableName':_0x6373('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 536fc20..19eeb87 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 _0x3c44=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x41dee2,_0x1b34ad){var _0x35a3e9=function(_0x8369f1){while(--_0x8369f1){_0x41dee2['push'](_0x41dee2['shift']());}};_0x35a3e9(++_0x1b34ad);}(_0x3c44,0xed));var _0x43c4=function(_0x525bd1,_0x2fa5ce){_0x525bd1=_0x525bd1-0x0;var _0x3a50ab=_0x3c44[_0x525bd1];return _0x3a50ab;};'use strict';var _=require(_0x43c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x43c4('0x1'));var rs=require(_0x43c4('0x2'));var fs=require('fs');var Redis=require(_0x43c4('0x3'));var db=require(_0x43c4('0x4'))['db'];var utils=require(_0x43c4('0x5'));var logger=require(_0x43c4('0x6'))(_0x43c4('0x7'));var config=require(_0x43c4('0x8'));var jayson=require(_0x43c4('0x9'));var client=jayson[_0x43c4('0xa')][_0x43c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd629fa,_0x382fcf,_0x2d9278){return new BPromise(function(_0x21f12c,_0x3ca9b4){return client[_0x43c4('0xc')](_0xd629fa,_0x2d9278)[_0x43c4('0xd')](function(_0x2b7f71){logger[_0x43c4('0xe')](_0x43c4('0xf'),_0x382fcf,_0x43c4('0x10'));logger[_0x43c4('0x11')](_0x43c4('0x12'),_0x382fcf,'request\x20sent',JSON[_0x43c4('0x13')](_0x2b7f71));if(_0x2b7f71[_0x43c4('0x14')]){if(_0x2b7f71[_0x43c4('0x14')][_0x43c4('0x15')]===0x1f4){logger['error'](_0x43c4('0xf'),_0x382fcf,_0x2b7f71['error'][_0x43c4('0x16')]);return _0x3ca9b4(_0x2b7f71[_0x43c4('0x14')][_0x43c4('0x16')]);}logger['error'](_0x43c4('0xf'),_0x382fcf,_0x2b7f71[_0x43c4('0x14')][_0x43c4('0x16')]);return _0x21f12c(_0x2b7f71['error'][_0x43c4('0x16')]);}else{logger[_0x43c4('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x382fcf,_0x43c4('0x10'));_0x21f12c(_0x2b7f71[_0x43c4('0x17')][_0x43c4('0x16')]);}})[_0x43c4('0x18')](function(_0xce3f2f){logger['error'](_0x43c4('0xf'),_0x382fcf,_0xce3f2f);_0x3ca9b4(_0xce3f2f);});});} \ No newline at end of file +var _0x9712=['code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ddda7,_0x39eaf3){var _0x38f5b4=function(_0x49be31){while(--_0x49be31){_0x3ddda7['push'](_0x3ddda7['shift']());}};_0x38f5b4(++_0x39eaf3);}(_0x9712,0xb4));var _0x2971=function(_0x13d9ac,_0x193a78){_0x13d9ac=_0x13d9ac-0x0;var _0x348a17=_0x9712[_0x13d9ac];return _0x348a17;};'use strict';var _=require(_0x2971('0x0'));var util=require(_0x2971('0x1'));var moment=require(_0x2971('0x2'));var BPromise=require('bluebird');var rs=require(_0x2971('0x3'));var fs=require('fs');var Redis=require(_0x2971('0x4'));var db=require(_0x2971('0x5'))['db'];var utils=require(_0x2971('0x6'));var logger=require(_0x2971('0x7'))(_0x2971('0x8'));var config=require(_0x2971('0x9'));var jayson=require(_0x2971('0xa'));var client=jayson[_0x2971('0xb')][_0x2971('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x368982,_0x2cf656,_0x362b13){return new BPromise(function(_0x259d86,_0x2abfde){return client['request'](_0x368982,_0x362b13)[_0x2971('0xd')](function(_0x5a0e8c){logger[_0x2971('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cf656,'request\x20sent');logger[_0x2971('0xf')](_0x2971('0x10'),_0x2cf656,_0x2971('0x11'),JSON[_0x2971('0x12')](_0x5a0e8c));if(_0x5a0e8c[_0x2971('0x13')]){if(_0x5a0e8c[_0x2971('0x13')][_0x2971('0x14')]===0x1f4){logger[_0x2971('0x13')](_0x2971('0x15'),_0x2cf656,_0x5a0e8c[_0x2971('0x13')][_0x2971('0x16')]);return _0x2abfde(_0x5a0e8c['error']['message']);}logger[_0x2971('0x13')](_0x2971('0x15'),_0x2cf656,_0x5a0e8c[_0x2971('0x13')][_0x2971('0x16')]);return _0x259d86(_0x5a0e8c[_0x2971('0x13')][_0x2971('0x16')]);}else{logger['info'](_0x2971('0x15'),_0x2cf656,_0x2971('0x11'));_0x259d86(_0x5a0e8c[_0x2971('0x17')][_0x2971('0x16')]);}})[_0x2971('0x18')](function(_0x58bdea){logger[_0x2971('0x13')](_0x2971('0x15'),_0x2cf656,_0x58bdea);_0x2abfde(_0x58bdea);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index fa0d5f1..6003ca6 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 _0x8895=['post','create','/:id/clone','put','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary'];(function(_0x5e909d,_0xcb0787){var _0x4cf7b5=function(_0x4581c6){while(--_0x4581c6){_0x5e909d['push'](_0x5e909d['shift']());}};_0x4cf7b5(++_0xcb0787);}(_0x8895,0x1bb));var _0x5889=function(_0x34decd,_0x1e22da){_0x34decd=_0x34decd-0x0;var _0x269223=_0x8895[_0x34decd];return _0x269223;};'use strict';var multer=require('multer');var util=require(_0x5889('0x0'));var path=require(_0x5889('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5889('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5889('0x3'));var config=require(_0x5889('0x4'));var controller=require('./jscriptyProject.controller');router[_0x5889('0x5')]('/',auth[_0x5889('0x6')](),controller[_0x5889('0x7')]);router[_0x5889('0x5')](_0x5889('0x8'),auth['isAuthenticated'](),controller[_0x5889('0x9')]);router[_0x5889('0x5')](_0x5889('0xa'),auth[_0x5889('0x6')](),controller[_0x5889('0xb')]);router[_0x5889('0x5')](_0x5889('0xc'),auth[_0x5889('0x6')](),controller[_0x5889('0xd')]);router[_0x5889('0x5')](_0x5889('0xe'),auth['isAuthenticated'](),timeout(_0x5889('0xf')),controller[_0x5889('0x10')]);router[_0x5889('0x11')]('/',auth[_0x5889('0x6')](),controller[_0x5889('0x12')]);router[_0x5889('0x11')](_0x5889('0x13'),auth[_0x5889('0x6')](),controller['clone']);router[_0x5889('0x14')](_0x5889('0x8'),auth[_0x5889('0x6')](),controller['update']);router[_0x5889('0x15')](_0x5889('0x8'),auth[_0x5889('0x6')](),controller['destroy']);module[_0x5889('0x16')]=router; \ No newline at end of file +var _0x949b=['isAuthenticated','index','/:id','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','clone','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x368485,_0x2f25c9){var _0x671469=function(_0x1d372f){while(--_0x1d372f){_0x368485['push'](_0x368485['shift']());}};_0x671469(++_0x2f25c9);}(_0x949b,0xb1));var _0xb949=function(_0x3ac054,_0x558393){_0x3ac054=_0x3ac054-0x0;var _0x472577=_0x949b[_0x3ac054];return _0x472577;};'use strict';var multer=require(_0xb949('0x0'));var util=require(_0xb949('0x1'));var path=require(_0xb949('0x2'));var timeout=require(_0xb949('0x3'));var express=require(_0xb949('0x4'));var router=express[_0xb949('0x5')]();var fs_extra=require(_0xb949('0x6'));var auth=require(_0xb949('0x7'));var interaction=require(_0xb949('0x8'));var config=require(_0xb949('0x9'));var controller=require(_0xb949('0xa'));router[_0xb949('0xb')]('/',auth[_0xb949('0xc')](),controller[_0xb949('0xd')]);router[_0xb949('0xb')](_0xb949('0xe'),auth[_0xb949('0xc')](),controller['show']);router[_0xb949('0xb')]('/:id/sessions',auth[_0xb949('0xc')](),controller[_0xb949('0xf')]);router[_0xb949('0xb')](_0xb949('0x10'),auth[_0xb949('0xc')](),controller[_0xb949('0x11')]);router['get'](_0xb949('0x12'),auth['isAuthenticated'](),timeout(_0xb949('0x13')),controller[_0xb949('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb949('0x15')]);router[_0xb949('0x16')]('/:id/clone',auth['isAuthenticated'](),controller[_0xb949('0x17')]);router['put'](_0xb949('0xe'),auth[_0xb949('0xc')](),controller['update']);router[_0xb949('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xb949('0x19')]);module[_0xb949('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5366197..6394ba2 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 _0xff5d=['getDataValue','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xff5d,0x6a));var _0xdff5=function(_0x35df2e,_0x113474){_0x35df2e=_0x35df2e-0x0;var _0x39456f=_0xff5d[_0x35df2e];return _0x39456f;};'use strict';var Sequelize=require(_0xdff5('0x0'));var _=require(_0xdff5('0x1'));var util=require('util');module[_0xdff5('0x2')]={'name':{'type':Sequelize[_0xdff5('0x3')],'unique':_0xdff5('0x4')},'description':{'type':Sequelize[_0xdff5('0x3')]},'formData':{'type':Sequelize[_0xdff5('0x5')](_0xdff5('0x6')),'set':function(_0x28e003){if(_['isObjectLike'](_0x28e003)){this[_0xdff5('0x7')](_0xdff5('0x8'),JSON['stringify'](_0x28e003));}else if(_[_0xdff5('0x9')](_0x28e003)){this[_0xdff5('0x7')](_0xdff5('0x8'),_0x28e003);}else{this['setDataValue']('formData',util['format'](_0xdff5('0xa'),this['getDataValue'](_0xdff5('0x4'))||'',this[_0xdff5('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdff5('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xdff5('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x8aaa=['long','isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x8aaa,0x10a));var _0xa8aa=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0x8aaa[_0x471448];return _0x38190b;};'use strict';var Sequelize=require(_0xa8aa('0x0'));var _=require(_0xa8aa('0x1'));var util=require('util');module[_0xa8aa('0x2')]={'name':{'type':Sequelize[_0xa8aa('0x3')],'unique':_0xa8aa('0x4')},'description':{'type':Sequelize[_0xa8aa('0x3')]},'formData':{'type':Sequelize[_0xa8aa('0x5')](_0xa8aa('0x6')),'set':function(_0x23ea33){if(_[_0xa8aa('0x7')](_0x23ea33)){this[_0xa8aa('0x8')](_0xa8aa('0x9'),JSON[_0xa8aa('0xa')](_0x23ea33));}else if(_[_0xa8aa('0xb')](_0x23ea33)){this['setDataValue']('formData',_0x23ea33);}else{this[_0xa8aa('0x8')](_0xa8aa('0x9'),util[_0xa8aa('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xa8aa('0xd')](_0xa8aa('0x4'))||'',this['getDataValue'](_0xa8aa('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa8aa('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa8aa('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7d189c9..a9d57d7 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 _0x3495=['setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','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','undefined','count','offset','limit','Content-Range','save','update','then','destroy','get','Projects','error','stack','name','send','map','JscriptyProject','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','nolimit','sort','ProjectId','getAnswers','findOne','JscriptyAnswerReport','number','apply','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x3495,0x1de));var _0x5349=function(_0x3221e4,_0x1cade6){_0x3221e4=_0x3221e4-0x0;var _0x3c4269=_0x3495[_0x3221e4];return _0x3c4269;};'use strict';var emlformat=require(_0x5349('0x0'));var rimraf=require(_0x5349('0x1'));var zipdir=require(_0x5349('0x2'));var jsonpatch=require(_0x5349('0x3'));var rp=require(_0x5349('0x4'));var moment=require(_0x5349('0x5'));var BPromise=require(_0x5349('0x6'));var Mustache=require(_0x5349('0x7'));var util=require(_0x5349('0x8'));var path=require('path');var sox=require(_0x5349('0x9'));var csv=require(_0x5349('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5349('0xb'));var _=require('lodash');var squel=require(_0x5349('0xc'));var crypto=require('crypto');var jsforce=require(_0x5349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5349('0xa'));var querystring=require(_0x5349('0xe'));var Papa=require(_0x5349('0xf'));var Redis=require(_0x5349('0x10'));var authService=require(_0x5349('0x11'));var qs=require(_0x5349('0x12'));var as=require(_0x5349('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5349('0x14'))('api');var utils=require(_0x5349('0x15'));var config=require(_0x5349('0x16'));var licenseUtil=require(_0x5349('0x17'));var db=require(_0x5349('0x18'))['db'];function respondWithStatusCode(_0x2f5172,_0x3c592a){_0x3c592a=_0x3c592a||0xcc;return function(_0x642966){if(_0x642966){return _0x2f5172[_0x5349('0x19')](_0x3c592a);}return _0x2f5172[_0x5349('0x1a')](_0x3c592a)[_0x5349('0x1b')]();};}function respondWithResult(_0x534e31,_0x2fde66){_0x2fde66=_0x2fde66||0xc8;return function(_0x367c25){if(_0x367c25){return _0x534e31['status'](_0x2fde66)[_0x5349('0x1c')](_0x367c25);}};}function respondWithFilteredResult(_0x269f7f,_0x2fe611){return function(_0x49bbec){if(_0x49bbec){var _0x5bcb3a=typeof _0x2fe611['offset']===_0x5349('0x1d')&&typeof _0x2fe611['limit']===_0x5349('0x1d');var _0x5f3cfb=_0x49bbec[_0x5349('0x1e')];var _0x2c1f1=_0x5bcb3a?0x0:_0x2fe611[_0x5349('0x1f')];var _0x132639=_0x5bcb3a?_0x49bbec['count']:_0x2fe611[_0x5349('0x1f')]+_0x2fe611[_0x5349('0x20')];var _0x8abbe3;if(_0x132639>=_0x5f3cfb){_0x132639=_0x5f3cfb;_0x8abbe3=0xc8;}else{_0x8abbe3=0xce;}_0x269f7f[_0x5349('0x1a')](_0x8abbe3);return _0x269f7f['set'](_0x5349('0x21'),_0x2c1f1+'-'+_0x132639+'/'+_0x5f3cfb)[_0x5349('0x1c')](_0x49bbec);}return null;};}function patchUpdates(_0x4f2cb6){return function(_0x4c96dc){try{jsonpatch['apply'](_0x4c96dc,_0x4f2cb6,!![]);}catch(_0x423581){return BPromise['reject'](_0x423581);}return _0x4c96dc[_0x5349('0x22')]();};}function saveUpdates(_0x1ff911,_0x164978){return function(_0x6c80cd){if(_0x6c80cd){return _0x6c80cd[_0x5349('0x23')](_0x1ff911)[_0x5349('0x24')](function(_0x303250){return _0x303250;});}return null;};}function removeEntity(_0x43a0c2,_0x2a3258){return function(_0x34353f){if(_0x34353f){return _0x34353f[_0x5349('0x25')]()[_0x5349('0x24')](function(){var _0x57af6c=_0x34353f[_0x5349('0x26')]({'plain':!![]});var _0x187b39=_0x5349('0x27');return db['UserProfileResource'][_0x5349('0x25')]({'where':{'type':_0x187b39,'resourceId':_0x57af6c['id']}})['then'](function(){return _0x34353f;});})[_0x5349('0x24')](function(){_0x43a0c2[_0x5349('0x1a')](0xcc)[_0x5349('0x1b')]();});}};}function handleEntityNotFound(_0x49153e,_0x1b5e87){return function(_0xc3e727){if(!_0xc3e727){_0x49153e[_0x5349('0x19')](0x194);}return _0xc3e727;};}function handleError(_0x339f9a,_0x180bc7){_0x180bc7=_0x180bc7||0x1f4;return function(_0x16edcb){logger[_0x5349('0x28')](_0x16edcb[_0x5349('0x29')]);if(_0x16edcb[_0x5349('0x2a')]){delete _0x16edcb['name'];}_0x339f9a[_0x5349('0x1a')](_0x180bc7)[_0x5349('0x2b')](_0x16edcb);};}exports['index']=function(_0x3cad49,_0x573ee1){var _0x1df8b0={},_0x262f62={},_0x10c284={'count':0x0,'rows':[]};var _0x16dda8=_[_0x5349('0x2c')](db[_0x5349('0x2d')]['rawAttributes'],function(_0x451120){return{'name':_0x451120[_0x5349('0x2e')],'type':_0x451120[_0x5349('0x2f')][_0x5349('0x30')]};});_0x262f62['model']=_['map'](_0x16dda8,_0x5349('0x2a'));_0x262f62[_0x5349('0x31')]=_[_0x5349('0x32')](_0x3cad49['query']);_0x262f62[_0x5349('0x33')]=_['intersection'](_0x262f62[_0x5349('0x34')],_0x262f62[_0x5349('0x31')]);_0x1df8b0[_0x5349('0x35')]=_[_0x5349('0x36')](_0x262f62[_0x5349('0x34')],qs[_0x5349('0x37')](_0x3cad49['query']['fields']));_0x1df8b0[_0x5349('0x35')]=_0x1df8b0[_0x5349('0x35')][_0x5349('0x38')]?_0x1df8b0[_0x5349('0x35')]:_0x262f62[_0x5349('0x34')];if(!_0x3cad49[_0x5349('0x31')][_0x5349('0x39')]('nolimit')){_0x1df8b0['limit']=qs[_0x5349('0x20')](_0x3cad49['query']['limit']);_0x1df8b0[_0x5349('0x1f')]=qs['offset'](_0x3cad49[_0x5349('0x31')][_0x5349('0x1f')]);}_0x1df8b0[_0x5349('0x3a')]=qs['sort'](_0x3cad49[_0x5349('0x31')]['sort']);_0x1df8b0[_0x5349('0x3b')]=qs[_0x5349('0x33')](_[_0x5349('0x3c')](_0x3cad49['query'],_0x262f62['filters']),_0x16dda8);if(_0x3cad49['query'][_0x5349('0x3d')]){_0x1df8b0[_0x5349('0x3b')]=_[_0x5349('0x3e')](_0x1df8b0[_0x5349('0x3b')],{'$or':_[_0x5349('0x2c')](_0x16dda8,function(_0x44715c){if(_0x44715c['type']!=='VIRTUAL'){var _0x2bda71={};_0x2bda71[_0x44715c[_0x5349('0x2a')]]={'$like':'%'+_0x3cad49[_0x5349('0x31')]['filter']+'%'};return _0x2bda71;}})});}_0x1df8b0=_[_0x5349('0x3e')]({},_0x1df8b0,_0x3cad49[_0x5349('0x3f')]);var _0x30faff={'where':_0x1df8b0[_0x5349('0x3b')]};return db['JscriptyProject'][_0x5349('0x1e')](_0x30faff)['then'](function(_0x39a154){_0x10c284[_0x5349('0x1e')]=_0x39a154;if(_0x3cad49['query'][_0x5349('0x40')]){_0x1df8b0[_0x5349('0x41')]=[{'all':!![]}];}return db[_0x5349('0x2d')][_0x5349('0x42')](_0x1df8b0);})[_0x5349('0x24')](function(_0xd29178){_0x10c284[_0x5349('0x43')]=_0xd29178;return _0x10c284;})['then'](respondWithFilteredResult(_0x573ee1,_0x1df8b0))['catch'](handleError(_0x573ee1,null));};exports[_0x5349('0x44')]=function(_0x36e40f,_0x1ce8f1){var _0x41cf4d={'raw':![],'where':{'id':_0x36e40f[_0x5349('0x45')]['id']}},_0x5d589c={};_0x5d589c['model']=_['keys'](db[_0x5349('0x2d')][_0x5349('0x46')]);_0x5d589c[_0x5349('0x31')]=_[_0x5349('0x32')](_0x36e40f['query']);_0x5d589c[_0x5349('0x33')]=_[_0x5349('0x36')](_0x5d589c[_0x5349('0x34')],_0x5d589c[_0x5349('0x31')]);_0x41cf4d[_0x5349('0x35')]=_[_0x5349('0x36')](_0x5d589c[_0x5349('0x34')],qs[_0x5349('0x37')](_0x36e40f[_0x5349('0x31')][_0x5349('0x37')]));_0x41cf4d[_0x5349('0x35')]=_0x41cf4d[_0x5349('0x35')][_0x5349('0x38')]?_0x41cf4d[_0x5349('0x35')]:_0x5d589c['model'];if(_0x36e40f['query'][_0x5349('0x40')]){_0x41cf4d[_0x5349('0x41')]=[{'all':!![]}];}_0x41cf4d=_[_0x5349('0x3e')]({},_0x41cf4d,_0x36e40f[_0x5349('0x3f')]);return db[_0x5349('0x2d')][_0x5349('0x47')](_0x41cf4d)['then'](handleEntityNotFound(_0x1ce8f1,null))[_0x5349('0x24')](respondWithResult(_0x1ce8f1,null))[_0x5349('0x48')](handleError(_0x1ce8f1,null));};exports[_0x5349('0x49')]=function(_0x3652dc,_0x26d06a){return db[_0x5349('0x2d')]['create'](_0x3652dc[_0x5349('0x4a')],{})['then'](function(_0x7374d6){var _0x39c77b=_0x3652dc[_0x5349('0x4b')][_0x5349('0x26')]({'plain':!![]});if(!_0x39c77b)throw new Error(_0x5349('0x4c'));if(_0x39c77b['role']===_0x5349('0x4b')){var _0x3fca72=_0x7374d6[_0x5349('0x26')]({'plain':!![]});var _0x302aab='Projects';return db[_0x5349('0x4d')][_0x5349('0x47')]({'where':{'name':_0x302aab,'userProfileId':_0x39c77b[_0x5349('0x4e')]},'raw':!![]})[_0x5349('0x24')](function(_0x3047c5){if(_0x3047c5&&_0x3047c5[_0x5349('0x4f')]===0x0){return db[_0x5349('0x50')][_0x5349('0x49')]({'name':_0x3fca72[_0x5349('0x2a')],'resourceId':_0x3fca72['id'],'type':_0x3047c5[_0x5349('0x2a')],'sectionId':_0x3047c5['id']},{})[_0x5349('0x24')](function(){return _0x7374d6;});}else{return _0x7374d6;}})[_0x5349('0x48')](function(_0x1286a2){logger[_0x5349('0x28')](_0x5349('0x51'),_0x1286a2);throw _0x1286a2;});}return _0x7374d6;})[_0x5349('0x24')](respondWithResult(_0x26d06a,0xc9))[_0x5349('0x48')](handleError(_0x26d06a,null));};exports[_0x5349('0x52')]=function(_0x55457d,_0x45afcc){var _0x192d1d={'where':{'id':_0x55457d['params']['id']}},_0x59f481={};_0x59f481[_0x5349('0x34')]=_[_0x5349('0x32')](db[_0x5349('0x2d')][_0x5349('0x46')]);_0x192d1d[_0x5349('0x35')]=_[_0x5349('0x36')](_0x59f481[_0x5349('0x34')],qs['fields'](_0x55457d[_0x5349('0x31')][_0x5349('0x37')]));_0x192d1d[_0x5349('0x35')]=_0x192d1d['attributes']['length']?_0x192d1d[_0x5349('0x35')]:_0x59f481[_0x5349('0x34')];if(_0x55457d[_0x5349('0x31')][_0x5349('0x40')]){_0x192d1d[_0x5349('0x41')]=[{'all':!![]}];}_0x192d1d=_[_0x5349('0x3e')]({},_0x192d1d,_0x55457d[_0x5349('0x3f')]);return db[_0x5349('0x2d')]['find'](_0x192d1d)[_0x5349('0x24')](handleEntityNotFound(_0x45afcc,null))['then'](function(_0x1c1371){if(_0x1c1371){var _0x2d3a20=_0x1c1371[_0x5349('0x26')]({'plain':!![]});_0x2d3a20=qs[_0x5349('0x53')](_0x2d3a20,['id','createdAt','updatedAt']);_0x55457d['body']=_[_0x5349('0x53')](_0x55457d['body'],['id',_0x5349('0x54'),_0x5349('0x55')]);return db[_0x5349('0x2d')][_0x5349('0x49')](_[_0x5349('0x3e')](_0x2d3a20,_0x55457d[_0x5349('0x4a')]),{'include':_0x55457d['query'][_0x5349('0x40')]?[{'all':!![]}]:undefined})[_0x5349('0x24')](function(_0x16f6d3){var _0x2779fd=_0x55457d[_0x5349('0x4b')]['get']({'plain':!![]});if(!_0x2779fd)throw new Error(_0x5349('0x4c'));if(_0x2779fd['role']===_0x5349('0x4b')){var _0x48dcd1=_0x16f6d3['get']({'plain':!![]});var _0x33bb59=_0x5349('0x27');return db[_0x5349('0x4d')][_0x5349('0x47')]({'where':{'name':_0x33bb59,'userProfileId':_0x2779fd[_0x5349('0x4e')]},'raw':!![]})[_0x5349('0x24')](function(_0x266fb1){if(_0x266fb1&&_0x266fb1[_0x5349('0x4f')]===0x0){return db['UserProfileResource'][_0x5349('0x49')]({'name':_0x48dcd1[_0x5349('0x2a')],'resourceId':_0x48dcd1['id'],'type':_0x266fb1[_0x5349('0x2a')],'sectionId':_0x266fb1['id']},{})[_0x5349('0x24')](function(){return _0x16f6d3;});}else{return _0x16f6d3;}})[_0x5349('0x48')](function(_0x5c9efe){logger[_0x5349('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c9efe);throw _0x5c9efe;});}return _0x16f6d3;});}})[_0x5349('0x24')](respondWithResult(_0x45afcc,0xc9))[_0x5349('0x48')](handleError(_0x45afcc,null));};exports[_0x5349('0x23')]=function(_0x49511a,_0x9a5857){if(_0x49511a['body']['id']){delete _0x49511a[_0x5349('0x4a')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x49511a[_0x5349('0x45')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x9a5857,null))['then'](saveUpdates(_0x49511a[_0x5349('0x4a')],null))[_0x5349('0x24')](respondWithResult(_0x9a5857,null))[_0x5349('0x48')](handleError(_0x9a5857,null));};exports['destroy']=function(_0x16ddc5,_0x247cd4){return db['JscriptyProject']['find']({'where':{'id':_0x16ddc5[_0x5349('0x45')]['id']}})['then'](handleEntityNotFound(_0x247cd4,null))['then'](removeEntity(_0x247cd4,null))['catch'](handleError(_0x247cd4,null));};exports[_0x5349('0x56')]=function(_0xffe718,_0x175d0c,_0x48a56e){var _0x253adb={'raw':!![],'where':{}};var _0xd9b996={};var _0x27271e={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0xffe718[_0x5349('0x45')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x175d0c,null))[_0x5349('0x24')](function(_0x3a2738){if(_0x3a2738){_0xd9b996[_0x5349('0x34')]=_[_0x5349('0x32')](db[_0x5349('0x57')][_0x5349('0x46')]);_0xd9b996[_0x5349('0x31')]=_[_0x5349('0x32')](_0xffe718[_0x5349('0x31')]);_0xd9b996[_0x5349('0x33')]=_[_0x5349('0x36')](_0xd9b996[_0x5349('0x34')],_0xd9b996[_0x5349('0x31')]);_0x253adb[_0x5349('0x35')]=_[_0x5349('0x36')](_0xd9b996['model'],qs['fields'](_0xffe718[_0x5349('0x31')][_0x5349('0x37')]));_0x253adb['attributes']=_0x253adb[_0x5349('0x35')][_0x5349('0x38')]?_0x253adb[_0x5349('0x35')]:_0xd9b996['model'];if(!_0xffe718['query']['hasOwnProperty'](_0x5349('0x58'))){_0x253adb['limit']=qs[_0x5349('0x20')](_0xffe718[_0x5349('0x31')][_0x5349('0x20')]);_0x253adb[_0x5349('0x1f')]=qs[_0x5349('0x1f')](_0xffe718[_0x5349('0x31')][_0x5349('0x1f')]);}_0x253adb['order']=qs[_0x5349('0x59')](_0xffe718['query'][_0x5349('0x59')]);_0x253adb[_0x5349('0x3b')]=qs[_0x5349('0x33')](_[_0x5349('0x3c')](_0xffe718[_0x5349('0x31')],_0xd9b996[_0x5349('0x33')]));_0x253adb[_0x5349('0x3b')][_0x5349('0x5a')]=_0x3a2738['id'];if(_0xffe718['query']['filter']){_0x253adb[_0x5349('0x3b')]=_['merge'](_0x253adb['where'],{'$or':_['map'](_0x253adb[_0x5349('0x35')],function(_0x17571f){var _0x30c1c6={};_0x30c1c6[_0x17571f]={'$like':'%'+_0xffe718[_0x5349('0x31')][_0x5349('0x3d')]+'%'};return _0x30c1c6;})});}_0x253adb=_[_0x5349('0x3e')]({},_0x253adb,_0xffe718[_0x5349('0x3f')]);return db[_0x5349('0x57')]['count']({'where':_0x253adb['where']})[_0x5349('0x24')](function(_0x3a28ab){_0x27271e['count']=_0x3a28ab;if(_0xffe718[_0x5349('0x31')][_0x5349('0x40')]){_0x253adb[_0x5349('0x41')]=[{'all':!![]}];}return db[_0x5349('0x57')][_0x5349('0x42')](_0x253adb);})[_0x5349('0x24')](function(_0x5be3c9){_0x27271e[_0x5349('0x43')]=_0x5be3c9;return _0x27271e;});}})['then'](respondWithFilteredResult(_0x175d0c,_0x253adb))[_0x5349('0x48')](handleError(_0x175d0c,null));};exports[_0x5349('0x5b')]=function(_0xc071d,_0x128b71,_0x7702d2){var _0x2bea8d={'raw':!![],'where':{}};var _0x6c54bc={};var _0x570b4f={'count':0x0,'rows':[]};return db[_0x5349('0x2d')][_0x5349('0x5c')]({'where':{'id':_0xc071d[_0x5349('0x45')]['id']}})['then'](handleEntityNotFound(_0x128b71,null))[_0x5349('0x24')](function(_0x455f77){if(_0x455f77){_0x6c54bc[_0x5349('0x34')]=_['keys'](db[_0x5349('0x5d')][_0x5349('0x46')]);_0x6c54bc[_0x5349('0x31')]=_[_0x5349('0x32')](_0xc071d[_0x5349('0x31')]);_0x6c54bc[_0x5349('0x33')]=_[_0x5349('0x36')](_0x6c54bc[_0x5349('0x34')],_0x6c54bc[_0x5349('0x31')]);_0x2bea8d[_0x5349('0x35')]=_[_0x5349('0x36')](_0x6c54bc[_0x5349('0x34')],qs[_0x5349('0x37')](_0xc071d[_0x5349('0x31')]['fields']));_0x2bea8d[_0x5349('0x35')]=_0x2bea8d[_0x5349('0x35')][_0x5349('0x38')]?_0x2bea8d['attributes']:_0x6c54bc['model'];if(!_0xc071d['query'][_0x5349('0x39')](_0x5349('0x58'))){_0x2bea8d['limit']=qs['limit'](_0xc071d[_0x5349('0x31')][_0x5349('0x20')]);_0x2bea8d[_0x5349('0x1f')]=qs[_0x5349('0x1f')](_0xc071d[_0x5349('0x31')][_0x5349('0x1f')]);}_0x2bea8d[_0x5349('0x3a')]=qs[_0x5349('0x59')](_0xc071d['query']['sort']);_0x2bea8d[_0x5349('0x3b')]=qs[_0x5349('0x33')](_[_0x5349('0x3c')](_0xc071d[_0x5349('0x31')],_0x6c54bc[_0x5349('0x33')]));_0x2bea8d[_0x5349('0x3b')]['ProjectId']=_0x455f77['id'];if(_0xc071d[_0x5349('0x31')][_0x5349('0x3d')]){_0x2bea8d[_0x5349('0x3b')]=_['merge'](_0x2bea8d[_0x5349('0x3b')],{'$or':_[_0x5349('0x2c')](_0x2bea8d[_0x5349('0x35')],function(_0x4b5655){var _0x4aad16={};_0x4aad16[_0x4b5655]={'$like':'%'+_0xc071d[_0x5349('0x31')][_0x5349('0x3d')]+'%'};return _0x4aad16;})});}_0x2bea8d=_[_0x5349('0x3e')]({},_0x2bea8d,_0xc071d[_0x5349('0x3f')]);return db[_0x5349('0x5d')][_0x5349('0x1e')]({'where':_0x2bea8d['where']})[_0x5349('0x24')](function(_0x4e5745){_0x570b4f[_0x5349('0x1e')]=_0x4e5745;if(_0xc071d[_0x5349('0x31')]['includeAll']){_0x2bea8d['include']=[{'all':!![]}];}return db[_0x5349('0x5d')][_0x5349('0x42')](_0x2bea8d);})[_0x5349('0x24')](function(_0x520028){_0x570b4f[_0x5349('0x43')]=_0x520028;return _0x570b4f;});}})['then'](respondWithFilteredResult(_0x128b71,_0x2bea8d))[_0x5349('0x48')](handleError(_0x128b71,null));};function char(_0xda7ea6){return _0x5349('0x5e')===typeof _0xda7ea6?String['fromCharCode'][_0x5349('0x5f')](null,arguments):_0xda7ea6;}function needsEncapsulation(_0x415024){return!!_0x415024&&(_0x415024['toString']()[_0x5349('0x60')](char(0xd))>=0x0||_0x415024['toString']()[_0x5349('0x60')](char(0xa))>=0x0||_0x415024[_0x5349('0x61')]()[_0x5349('0x60')](char(0x2c))>=0x0||_0x415024['toString']()[_0x5349('0x60')](char(0x22))>=0x0);}function encapsulate(_0x20e3f6){var _0x21f5c9=char(0x22),_0x315223='\x5c'+char(0x22),_0x3aed99=_0x20e3f6[_0x5349('0x61')]()[_0x5349('0x62')](new RegExp(_0x21f5c9,'g'),_0x315223);return _0x21f5c9+_0x3aed99+_0x21f5c9;}exports[_0x5349('0x63')]=function(_0x182d6b,_0x5e4a78,_0x41da1d){var _0x46f3f2,_0x23d4d2;var _0x5ebddd={'where':{'ProjectId':_0x182d6b[_0x5349('0x45')]['id']}};if(_0x182d6b['query'][_0x5349('0x64')]){_0x5ebddd[_0x5349('0x3b')][_0x5349('0x65')]=JSON[_0x5349('0x66')](_0x182d6b['query'][_0x5349('0x64')]);}return db[_0x5349('0x57')][_0x5349('0x42')](_0x5ebddd)[_0x5349('0x24')](handleEntityNotFound(_0x5e4a78,null))['then'](function(_0x398142){if(_0x398142){_0x46f3f2=_0x398142;return db[_0x5349('0x67')][_0x5349('0x42')]({'where':{'SessionId':{'$in':_[_0x5349('0x2c')](_0x46f3f2,'id')},'ProjectId':_0x182d6b[_0x5349('0x45')]['id']},'order':'-createdAt'});}})[_0x5349('0x24')](handleEntityNotFound(_0x5e4a78,null))[_0x5349('0x24')](function(_0x2860e4){if(_0x2860e4){_0x23d4d2=_0x2860e4;var _0x4602b6={};for(var _0x5d7a22=0x0,_0x251dc1=_0x23d4d2[_0x5349('0x38')];_0x5d7a22<_0x251dc1;_0x5d7a22++){if(!_0x4602b6['hasOwnProperty'](_0x23d4d2[_0x5d7a22]['questionId'])){_0x4602b6[_0x23d4d2[_0x5d7a22][_0x5349('0x68')]]=needsEncapsulation(_0x23d4d2[_0x5d7a22]['question'])?encapsulate(_0x23d4d2[_0x5d7a22][_0x5349('0x69')]):_0x23d4d2[_0x5d7a22]['question'];}}var _0x188df0=[],_0xc2ec62={};for(var _0xff3420=0x0,_0x450b4d=_0x46f3f2['length'];_0xff3420<_0x450b4d;_0xff3420++){_0xc2ec62={'ProjectId':_0x182d6b[_0x5349('0x45')]['id'],'SessionId':_0x46f3f2[_0xff3420]['id'],'StartTime':moment(_0x46f3f2[_0xff3420]['starttime'])[_0x5349('0x6a')](_0x5349('0x6b'))};for(var _0x4a0ba5=0x0,_0x1c55ac=_0x23d4d2[_0x5349('0x38')];_0x4a0ba5<_0x1c55ac;_0x4a0ba5++){if(_0x23d4d2[_0x4a0ba5]['SessionId']==_0x46f3f2[_0xff3420]['id']&&_0x4602b6[_0x5349('0x39')](_0x23d4d2[_0x4a0ba5][_0x5349('0x68')])){_0xc2ec62[_0x4602b6[_0x23d4d2[_0x4a0ba5][_0x5349('0x68')]]]=_0x23d4d2[_0x4a0ba5]['answer'];}}for(var _0x501c62 in _0x4602b6){if(!_0xc2ec62['hasOwnProperty'](_0x4602b6[_0x501c62])){_0xc2ec62[_0x4602b6[_0x501c62]]=null;}}_0x188df0['push'](_0xc2ec62);}return _0x188df0;}})[_0x5349('0x24')](function(_0x8abf04){if(!_[_0x5349('0x6c')](_0x8abf04)){var _0x40bf2c=toCsv(_0x8abf04);var _0x1a6f89=Date[_0x5349('0x6d')]();fs[_0x5349('0x6e')](util[_0x5349('0x6a')](_0x5349('0x6f'),_0x182d6b['params']['id'],_0x1a6f89),_0x40bf2c);_0x5e4a78[_0x5349('0x70')](_0x5349('0x71'),'attachment;\x20filename='+util[_0x5349('0x6a')](_0x5349('0x72'),_0x182d6b['params']['id'],_0x1a6f89));_0x5e4a78[_0x5349('0x70')](_0x5349('0x73'),_0x5349('0x74'));return _0x5e4a78[_0x5349('0x75')](util[_0x5349('0x6a')](_0x5349('0x6f'),_0x182d6b[_0x5349('0x45')]['id'],_0x1a6f89));}else{return _0x5e4a78['sendStatus'](0xcc);}})[_0x5349('0x48')](handleError(_0x5e4a78,null));}; \ No newline at end of file +var _0x17d1=['send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','error','update','getSessions','findOne','order','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','eml-format','rimraf','request-promise','moment','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','UserProfileResource','stack','name'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x17d1,0xc9));var _0x117d=function(_0x595121,_0x65a5de){_0x595121=_0x595121-0x0;var _0x511fbc=_0x17d1[_0x595121];return _0x511fbc;};'use strict';var emlformat=require(_0x117d('0x0'));var rimraf=require(_0x117d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x117d('0x2'));var moment=require(_0x117d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x117d('0x4'));var path=require(_0x117d('0x5'));var sox=require(_0x117d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x117d('0x7'));var _=require('lodash');var squel=require(_0x117d('0x8'));var crypto=require(_0x117d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x117d('0xa'));var toCsv=require(_0x117d('0xb'));var querystring=require(_0x117d('0xc'));var Papa=require(_0x117d('0xd'));var Redis=require(_0x117d('0xe'));var authService=require(_0x117d('0xf'));var qs=require(_0x117d('0x10'));var as=require(_0x117d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x117d('0x12'))(_0x117d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x117d('0x14'));var db=require(_0x117d('0x15'))['db'];function respondWithStatusCode(_0x942e2c,_0x46ba04){_0x46ba04=_0x46ba04||0xcc;return function(_0x4e486d){if(_0x4e486d){return _0x942e2c[_0x117d('0x16')](_0x46ba04);}return _0x942e2c['status'](_0x46ba04)[_0x117d('0x17')]();};}function respondWithResult(_0x4836df,_0x322bd6){_0x322bd6=_0x322bd6||0xc8;return function(_0x2f8e6a){if(_0x2f8e6a){return _0x4836df[_0x117d('0x18')](_0x322bd6)[_0x117d('0x19')](_0x2f8e6a);}};}function respondWithFilteredResult(_0x51752b,_0x3d7151){return function(_0x47055e){if(_0x47055e){var _0x24de6b=typeof _0x3d7151[_0x117d('0x1a')]==='undefined'&&typeof _0x3d7151[_0x117d('0x1b')]===_0x117d('0x1c');var _0x10bb46=_0x47055e[_0x117d('0x1d')];var _0x576a31=_0x24de6b?0x0:_0x3d7151[_0x117d('0x1a')];var _0x4e3900=_0x24de6b?_0x47055e[_0x117d('0x1d')]:_0x3d7151['offset']+_0x3d7151[_0x117d('0x1b')];var _0x3d9f3f;if(_0x4e3900>=_0x10bb46){_0x4e3900=_0x10bb46;_0x3d9f3f=0xc8;}else{_0x3d9f3f=0xce;}_0x51752b[_0x117d('0x18')](_0x3d9f3f);return _0x51752b[_0x117d('0x1e')](_0x117d('0x1f'),_0x576a31+'-'+_0x4e3900+'/'+_0x10bb46)['json'](_0x47055e);}return null;};}function patchUpdates(_0x253a42){return function(_0x1a816f){try{jsonpatch[_0x117d('0x20')](_0x1a816f,_0x253a42,!![]);}catch(_0x2e79f0){return BPromise[_0x117d('0x21')](_0x2e79f0);}return _0x1a816f['save']();};}function saveUpdates(_0x1205fe,_0x1def09){return function(_0x512740){if(_0x512740){return _0x512740['update'](_0x1205fe)[_0x117d('0x22')](function(_0x58ae68){return _0x58ae68;});}return null;};}function removeEntity(_0x4085d0,_0x150cdf){return function(_0x1fb841){if(_0x1fb841){return _0x1fb841[_0x117d('0x23')]()[_0x117d('0x22')](function(){var _0x38bdba=_0x1fb841['get']({'plain':!![]});var _0x1abc1e='Projects';return db[_0x117d('0x24')][_0x117d('0x23')]({'where':{'type':_0x1abc1e,'resourceId':_0x38bdba['id']}})[_0x117d('0x22')](function(){return _0x1fb841;});})[_0x117d('0x22')](function(){_0x4085d0[_0x117d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ce93,_0x264ee8){return function(_0x347a9f){if(!_0x347a9f){_0x24ce93[_0x117d('0x16')](0x194);}return _0x347a9f;};}function handleError(_0x2376da,_0x3a3f97){_0x3a3f97=_0x3a3f97||0x1f4;return function(_0x37778f){logger['error'](_0x37778f[_0x117d('0x25')]);if(_0x37778f[_0x117d('0x26')]){delete _0x37778f[_0x117d('0x26')];}_0x2376da[_0x117d('0x18')](_0x3a3f97)[_0x117d('0x27')](_0x37778f);};}exports[_0x117d('0x28')]=function(_0x256337,_0x29b9b3){var _0x125055={},_0x4ab8c9={},_0x4aff57={'count':0x0,'rows':[]};var _0x4272bd=_[_0x117d('0x29')](db[_0x117d('0x2a')][_0x117d('0x2b')],function(_0x2bcbae){return{'name':_0x2bcbae[_0x117d('0x2c')],'type':_0x2bcbae['type'][_0x117d('0x2d')]};});_0x4ab8c9[_0x117d('0x2e')]=_[_0x117d('0x29')](_0x4272bd,'name');_0x4ab8c9[_0x117d('0x2f')]=_[_0x117d('0x30')](_0x256337[_0x117d('0x2f')]);_0x4ab8c9[_0x117d('0x31')]=_[_0x117d('0x32')](_0x4ab8c9['model'],_0x4ab8c9[_0x117d('0x2f')]);_0x125055[_0x117d('0x33')]=_[_0x117d('0x32')](_0x4ab8c9[_0x117d('0x2e')],qs[_0x117d('0x34')](_0x256337[_0x117d('0x2f')][_0x117d('0x34')]));_0x125055[_0x117d('0x33')]=_0x125055[_0x117d('0x33')][_0x117d('0x35')]?_0x125055[_0x117d('0x33')]:_0x4ab8c9[_0x117d('0x2e')];if(!_0x256337['query'][_0x117d('0x36')](_0x117d('0x37'))){_0x125055[_0x117d('0x1b')]=qs[_0x117d('0x1b')](_0x256337['query'][_0x117d('0x1b')]);_0x125055[_0x117d('0x1a')]=qs[_0x117d('0x1a')](_0x256337[_0x117d('0x2f')][_0x117d('0x1a')]);}_0x125055['order']=qs[_0x117d('0x38')](_0x256337[_0x117d('0x2f')][_0x117d('0x38')]);_0x125055['where']=qs['filters'](_[_0x117d('0x39')](_0x256337[_0x117d('0x2f')],_0x4ab8c9[_0x117d('0x31')]),_0x4272bd);if(_0x256337[_0x117d('0x2f')][_0x117d('0x3a')]){_0x125055[_0x117d('0x3b')]=_['merge'](_0x125055[_0x117d('0x3b')],{'$or':_['map'](_0x4272bd,function(_0x1bafdc){if(_0x1bafdc[_0x117d('0x3c')]!==_0x117d('0x3d')){var _0x21741f={};_0x21741f[_0x1bafdc[_0x117d('0x26')]]={'$like':'%'+_0x256337[_0x117d('0x2f')][_0x117d('0x3a')]+'%'};return _0x21741f;}})});}_0x125055=_[_0x117d('0x3e')]({},_0x125055,_0x256337[_0x117d('0x3f')]);var _0x1ebc5b={'where':_0x125055[_0x117d('0x3b')]};return db[_0x117d('0x2a')][_0x117d('0x1d')](_0x1ebc5b)[_0x117d('0x22')](function(_0x424ac6){_0x4aff57['count']=_0x424ac6;if(_0x256337[_0x117d('0x2f')][_0x117d('0x40')]){_0x125055[_0x117d('0x41')]=[{'all':!![]}];}return db[_0x117d('0x2a')][_0x117d('0x42')](_0x125055);})[_0x117d('0x22')](function(_0x405901){_0x4aff57[_0x117d('0x43')]=_0x405901;return _0x4aff57;})['then'](respondWithFilteredResult(_0x29b9b3,_0x125055))[_0x117d('0x44')](handleError(_0x29b9b3,null));};exports[_0x117d('0x45')]=function(_0x4a84ea,_0x249f72){var _0x4311a7={'raw':![],'where':{'id':_0x4a84ea[_0x117d('0x46')]['id']}},_0x871ff3={};_0x871ff3[_0x117d('0x2e')]=_[_0x117d('0x30')](db[_0x117d('0x2a')][_0x117d('0x2b')]);_0x871ff3[_0x117d('0x2f')]=_['keys'](_0x4a84ea[_0x117d('0x2f')]);_0x871ff3[_0x117d('0x31')]=_['intersection'](_0x871ff3['model'],_0x871ff3[_0x117d('0x2f')]);_0x4311a7[_0x117d('0x33')]=_[_0x117d('0x32')](_0x871ff3[_0x117d('0x2e')],qs[_0x117d('0x34')](_0x4a84ea[_0x117d('0x2f')][_0x117d('0x34')]));_0x4311a7[_0x117d('0x33')]=_0x4311a7[_0x117d('0x33')][_0x117d('0x35')]?_0x4311a7[_0x117d('0x33')]:_0x871ff3[_0x117d('0x2e')];if(_0x4a84ea[_0x117d('0x2f')][_0x117d('0x40')]){_0x4311a7['include']=[{'all':!![]}];}_0x4311a7=_['merge']({},_0x4311a7,_0x4a84ea[_0x117d('0x3f')]);return db[_0x117d('0x2a')][_0x117d('0x47')](_0x4311a7)[_0x117d('0x22')](handleEntityNotFound(_0x249f72,null))[_0x117d('0x22')](respondWithResult(_0x249f72,null))[_0x117d('0x44')](handleError(_0x249f72,null));};exports[_0x117d('0x48')]=function(_0x3e070f,_0x678640){return db['JscriptyProject'][_0x117d('0x48')](_0x3e070f[_0x117d('0x49')],{})[_0x117d('0x22')](function(_0x39624a){var _0x575ee8=_0x3e070f['user'][_0x117d('0x4a')]({'plain':!![]});if(!_0x575ee8)throw new Error(_0x117d('0x4b'));if(_0x575ee8['role']===_0x117d('0x4c')){var _0x1b5ec3=_0x39624a[_0x117d('0x4a')]({'plain':!![]});var _0x2cdbe2=_0x117d('0x4d');return db[_0x117d('0x4e')][_0x117d('0x47')]({'where':{'name':_0x2cdbe2,'userProfileId':_0x575ee8[_0x117d('0x4f')]},'raw':!![]})['then'](function(_0x50cb92){if(_0x50cb92&&_0x50cb92[_0x117d('0x50')]===0x0){return db[_0x117d('0x24')]['create']({'name':_0x1b5ec3[_0x117d('0x26')],'resourceId':_0x1b5ec3['id'],'type':_0x50cb92[_0x117d('0x26')],'sectionId':_0x50cb92['id']},{})['then'](function(){return _0x39624a;});}else{return _0x39624a;}})[_0x117d('0x44')](function(_0x44330c){logger['error'](_0x117d('0x51'),_0x44330c);throw _0x44330c;});}return _0x39624a;})[_0x117d('0x22')](respondWithResult(_0x678640,0xc9))[_0x117d('0x44')](handleError(_0x678640,null));};exports[_0x117d('0x52')]=function(_0xc92cd,_0x2af3da){var _0x2adbb4={'where':{'id':_0xc92cd[_0x117d('0x46')]['id']}},_0x2e74a9={};_0x2e74a9[_0x117d('0x2e')]=_[_0x117d('0x30')](db[_0x117d('0x2a')][_0x117d('0x2b')]);_0x2adbb4[_0x117d('0x33')]=_['intersection'](_0x2e74a9['model'],qs['fields'](_0xc92cd[_0x117d('0x2f')][_0x117d('0x34')]));_0x2adbb4[_0x117d('0x33')]=_0x2adbb4[_0x117d('0x33')][_0x117d('0x35')]?_0x2adbb4[_0x117d('0x33')]:_0x2e74a9[_0x117d('0x2e')];if(_0xc92cd[_0x117d('0x2f')][_0x117d('0x40')]){_0x2adbb4[_0x117d('0x41')]=[{'all':!![]}];}_0x2adbb4=_['merge']({},_0x2adbb4,_0xc92cd[_0x117d('0x3f')]);return db[_0x117d('0x2a')]['find'](_0x2adbb4)[_0x117d('0x22')](handleEntityNotFound(_0x2af3da,null))['then'](function(_0x3af85d){if(_0x3af85d){var _0x97cc27=_0x3af85d[_0x117d('0x4a')]({'plain':!![]});_0x97cc27=qs[_0x117d('0x53')](_0x97cc27,['id','createdAt','updatedAt']);_0xc92cd[_0x117d('0x49')]=_[_0x117d('0x53')](_0xc92cd[_0x117d('0x49')],['id',_0x117d('0x54'),_0x117d('0x55')]);return db[_0x117d('0x2a')][_0x117d('0x48')](_[_0x117d('0x3e')](_0x97cc27,_0xc92cd[_0x117d('0x49')]),{'include':_0xc92cd['query'][_0x117d('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x5d2aaa){var _0x15772f=_0xc92cd[_0x117d('0x4c')][_0x117d('0x4a')]({'plain':!![]});if(!_0x15772f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15772f[_0x117d('0x56')]===_0x117d('0x4c')){var _0x9acfa5=_0x5d2aaa['get']({'plain':!![]});var _0x1ead51='Projects';return db[_0x117d('0x4e')]['find']({'where':{'name':_0x1ead51,'userProfileId':_0x15772f['userProfileId']},'raw':!![]})['then'](function(_0x1eaef0){if(_0x1eaef0&&_0x1eaef0[_0x117d('0x50')]===0x0){return db[_0x117d('0x24')][_0x117d('0x48')]({'name':_0x9acfa5[_0x117d('0x26')],'resourceId':_0x9acfa5['id'],'type':_0x1eaef0['name'],'sectionId':_0x1eaef0['id']},{})[_0x117d('0x22')](function(){return _0x5d2aaa;});}else{return _0x5d2aaa;}})[_0x117d('0x44')](function(_0x5bfffe){logger[_0x117d('0x57')](_0x117d('0x51'),_0x5bfffe);throw _0x5bfffe;});}return _0x5d2aaa;});}})['then'](respondWithResult(_0x2af3da,0xc9))[_0x117d('0x44')](handleError(_0x2af3da,null));};exports[_0x117d('0x58')]=function(_0xe1e45,_0x459a7a){if(_0xe1e45[_0x117d('0x49')]['id']){delete _0xe1e45['body']['id'];}return db[_0x117d('0x2a')][_0x117d('0x47')]({'where':{'id':_0xe1e45[_0x117d('0x46')]['id']}})[_0x117d('0x22')](handleEntityNotFound(_0x459a7a,null))[_0x117d('0x22')](saveUpdates(_0xe1e45[_0x117d('0x49')],null))[_0x117d('0x22')](respondWithResult(_0x459a7a,null))['catch'](handleError(_0x459a7a,null));};exports[_0x117d('0x23')]=function(_0xc2867a,_0x23b7bb){return db['JscriptyProject']['find']({'where':{'id':_0xc2867a[_0x117d('0x46')]['id']}})['then'](handleEntityNotFound(_0x23b7bb,null))[_0x117d('0x22')](removeEntity(_0x23b7bb,null))[_0x117d('0x44')](handleError(_0x23b7bb,null));};exports[_0x117d('0x59')]=function(_0x3ca7f1,_0x2fab75,_0x5161c5){var _0x37a5ea={'raw':!![],'where':{}};var _0x40f77c={};var _0xd9cd9={'count':0x0,'rows':[]};return db[_0x117d('0x2a')][_0x117d('0x5a')]({'where':{'id':_0x3ca7f1['params']['id']}})['then'](handleEntityNotFound(_0x2fab75,null))['then'](function(_0x45b354){if(_0x45b354){_0x40f77c[_0x117d('0x2e')]=_[_0x117d('0x30')](db['JscriptySessionReport']['rawAttributes']);_0x40f77c['query']=_['keys'](_0x3ca7f1[_0x117d('0x2f')]);_0x40f77c[_0x117d('0x31')]=_[_0x117d('0x32')](_0x40f77c[_0x117d('0x2e')],_0x40f77c[_0x117d('0x2f')]);_0x37a5ea[_0x117d('0x33')]=_[_0x117d('0x32')](_0x40f77c[_0x117d('0x2e')],qs[_0x117d('0x34')](_0x3ca7f1[_0x117d('0x2f')][_0x117d('0x34')]));_0x37a5ea[_0x117d('0x33')]=_0x37a5ea['attributes']['length']?_0x37a5ea[_0x117d('0x33')]:_0x40f77c['model'];if(!_0x3ca7f1[_0x117d('0x2f')][_0x117d('0x36')](_0x117d('0x37'))){_0x37a5ea[_0x117d('0x1b')]=qs[_0x117d('0x1b')](_0x3ca7f1[_0x117d('0x2f')][_0x117d('0x1b')]);_0x37a5ea[_0x117d('0x1a')]=qs[_0x117d('0x1a')](_0x3ca7f1[_0x117d('0x2f')]['offset']);}_0x37a5ea[_0x117d('0x5b')]=qs[_0x117d('0x38')](_0x3ca7f1['query']['sort']);_0x37a5ea[_0x117d('0x3b')]=qs[_0x117d('0x31')](_[_0x117d('0x39')](_0x3ca7f1[_0x117d('0x2f')],_0x40f77c[_0x117d('0x31')]));_0x37a5ea[_0x117d('0x3b')]['ProjectId']=_0x45b354['id'];if(_0x3ca7f1['query']['filter']){_0x37a5ea[_0x117d('0x3b')]=_['merge'](_0x37a5ea['where'],{'$or':_['map'](_0x37a5ea['attributes'],function(_0x253b47){var _0xb4c5b0={};_0xb4c5b0[_0x253b47]={'$like':'%'+_0x3ca7f1[_0x117d('0x2f')]['filter']+'%'};return _0xb4c5b0;})});}_0x37a5ea=_['merge']({},_0x37a5ea,_0x3ca7f1[_0x117d('0x3f')]);return db[_0x117d('0x5c')][_0x117d('0x1d')]({'where':_0x37a5ea[_0x117d('0x3b')]})[_0x117d('0x22')](function(_0x4ebf51){_0xd9cd9['count']=_0x4ebf51;if(_0x3ca7f1['query']['includeAll']){_0x37a5ea[_0x117d('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x37a5ea);})[_0x117d('0x22')](function(_0x54d685){_0xd9cd9[_0x117d('0x43')]=_0x54d685;return _0xd9cd9;});}})['then'](respondWithFilteredResult(_0x2fab75,_0x37a5ea))[_0x117d('0x44')](handleError(_0x2fab75,null));};exports[_0x117d('0x5d')]=function(_0x55683f,_0xb06747,_0x3eb69b){var _0x27b751={'raw':!![],'where':{}};var _0x4c4780={};var _0x22ecc4={'count':0x0,'rows':[]};return db[_0x117d('0x2a')][_0x117d('0x5a')]({'where':{'id':_0x55683f[_0x117d('0x46')]['id']}})[_0x117d('0x22')](handleEntityNotFound(_0xb06747,null))[_0x117d('0x22')](function(_0x131732){if(_0x131732){_0x4c4780[_0x117d('0x2e')]=_[_0x117d('0x30')](db[_0x117d('0x5e')][_0x117d('0x2b')]);_0x4c4780[_0x117d('0x2f')]=_[_0x117d('0x30')](_0x55683f[_0x117d('0x2f')]);_0x4c4780['filters']=_['intersection'](_0x4c4780['model'],_0x4c4780['query']);_0x27b751[_0x117d('0x33')]=_[_0x117d('0x32')](_0x4c4780['model'],qs[_0x117d('0x34')](_0x55683f[_0x117d('0x2f')][_0x117d('0x34')]));_0x27b751[_0x117d('0x33')]=_0x27b751['attributes'][_0x117d('0x35')]?_0x27b751['attributes']:_0x4c4780[_0x117d('0x2e')];if(!_0x55683f[_0x117d('0x2f')]['hasOwnProperty']('nolimit')){_0x27b751[_0x117d('0x1b')]=qs[_0x117d('0x1b')](_0x55683f['query'][_0x117d('0x1b')]);_0x27b751[_0x117d('0x1a')]=qs[_0x117d('0x1a')](_0x55683f['query'][_0x117d('0x1a')]);}_0x27b751['order']=qs[_0x117d('0x38')](_0x55683f[_0x117d('0x2f')][_0x117d('0x38')]);_0x27b751[_0x117d('0x3b')]=qs[_0x117d('0x31')](_['pick'](_0x55683f[_0x117d('0x2f')],_0x4c4780[_0x117d('0x31')]));_0x27b751['where'][_0x117d('0x5f')]=_0x131732['id'];if(_0x55683f[_0x117d('0x2f')]['filter']){_0x27b751[_0x117d('0x3b')]=_[_0x117d('0x3e')](_0x27b751[_0x117d('0x3b')],{'$or':_[_0x117d('0x29')](_0x27b751[_0x117d('0x33')],function(_0xc7d67a){var _0x48e763={};_0x48e763[_0xc7d67a]={'$like':'%'+_0x55683f['query'][_0x117d('0x3a')]+'%'};return _0x48e763;})});}_0x27b751=_[_0x117d('0x3e')]({},_0x27b751,_0x55683f['options']);return db[_0x117d('0x5e')]['count']({'where':_0x27b751['where']})[_0x117d('0x22')](function(_0x466adc){_0x22ecc4[_0x117d('0x1d')]=_0x466adc;if(_0x55683f[_0x117d('0x2f')][_0x117d('0x40')]){_0x27b751[_0x117d('0x41')]=[{'all':!![]}];}return db[_0x117d('0x5e')][_0x117d('0x42')](_0x27b751);})[_0x117d('0x22')](function(_0x52112e){_0x22ecc4[_0x117d('0x43')]=_0x52112e;return _0x22ecc4;});}})[_0x117d('0x22')](respondWithFilteredResult(_0xb06747,_0x27b751))[_0x117d('0x44')](handleError(_0xb06747,null));};function char(_0x45c2b1){return _0x117d('0x60')===typeof _0x45c2b1?String[_0x117d('0x61')]['apply'](null,arguments):_0x45c2b1;}function needsEncapsulation(_0x2475c8){return!!_0x2475c8&&(_0x2475c8[_0x117d('0x62')]()[_0x117d('0x63')](char(0xd))>=0x0||_0x2475c8['toString']()[_0x117d('0x63')](char(0xa))>=0x0||_0x2475c8['toString']()[_0x117d('0x63')](char(0x2c))>=0x0||_0x2475c8[_0x117d('0x62')]()[_0x117d('0x63')](char(0x22))>=0x0);}function encapsulate(_0x5a1261){var _0x559f55=char(0x22),_0x4aef6e='\x5c'+char(0x22),_0x1b9679=_0x5a1261['toString']()['replace'](new RegExp(_0x559f55,'g'),_0x4aef6e);return _0x559f55+_0x1b9679+_0x559f55;}exports[_0x117d('0x64')]=function(_0x4bb702,_0x12b229,_0x2aeae3){var _0x12c1a7,_0x41c190;var _0x228989={'where':{'ProjectId':_0x4bb702[_0x117d('0x46')]['id']}};if(_0x4bb702['query'][_0x117d('0x65')]){_0x228989[_0x117d('0x3b')][_0x117d('0x66')]=JSON[_0x117d('0x67')](_0x4bb702[_0x117d('0x2f')]['startTime']);}return db[_0x117d('0x5c')]['findAll'](_0x228989)[_0x117d('0x22')](handleEntityNotFound(_0x12b229,null))[_0x117d('0x22')](function(_0x3418b5){if(_0x3418b5){_0x12c1a7=_0x3418b5;return db[_0x117d('0x68')][_0x117d('0x42')]({'where':{'SessionId':{'$in':_['map'](_0x12c1a7,'id')},'ProjectId':_0x4bb702[_0x117d('0x46')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x12b229,null))[_0x117d('0x22')](function(_0x21f14c){if(_0x21f14c){_0x41c190=_0x21f14c;var _0x3da96d={};for(var _0x531e53=0x0,_0x3a057c=_0x41c190[_0x117d('0x35')];_0x531e53<_0x3a057c;_0x531e53++){if(!_0x3da96d['hasOwnProperty'](_0x41c190[_0x531e53][_0x117d('0x69')])){_0x3da96d[_0x41c190[_0x531e53][_0x117d('0x69')]]=needsEncapsulation(_0x41c190[_0x531e53][_0x117d('0x6a')])?encapsulate(_0x41c190[_0x531e53]['question']):_0x41c190[_0x531e53][_0x117d('0x6a')];}}var _0x573e7c=[],_0x4979df={};for(var _0x3ade85=0x0,_0x1c7ab0=_0x12c1a7[_0x117d('0x35')];_0x3ade85<_0x1c7ab0;_0x3ade85++){_0x4979df={'ProjectId':_0x4bb702[_0x117d('0x46')]['id'],'SessionId':_0x12c1a7[_0x3ade85]['id'],'StartTime':moment(_0x12c1a7[_0x3ade85][_0x117d('0x66')])[_0x117d('0x6b')](_0x117d('0x6c'))};for(var _0x4a3a05=0x0,_0x2ef0c0=_0x41c190[_0x117d('0x35')];_0x4a3a05<_0x2ef0c0;_0x4a3a05++){if(_0x41c190[_0x4a3a05][_0x117d('0x6d')]==_0x12c1a7[_0x3ade85]['id']&&_0x3da96d['hasOwnProperty'](_0x41c190[_0x4a3a05][_0x117d('0x69')])){_0x4979df[_0x3da96d[_0x41c190[_0x4a3a05]['questionId']]]=_0x41c190[_0x4a3a05][_0x117d('0x6e')];}}for(var _0x58943a in _0x3da96d){if(!_0x4979df['hasOwnProperty'](_0x3da96d[_0x58943a])){_0x4979df[_0x3da96d[_0x58943a]]=null;}}_0x573e7c['push'](_0x4979df);}return _0x573e7c;}})[_0x117d('0x22')](function(_0x5c57a0){if(!_[_0x117d('0x6f')](_0x5c57a0)){var _0x585d13=toCsv(_0x5c57a0);var _0x5e8f3b=Date[_0x117d('0x70')]();fs[_0x117d('0x71')](util[_0x117d('0x6b')](_0x117d('0x72'),_0x4bb702[_0x117d('0x46')]['id'],_0x5e8f3b),_0x585d13);_0x12b229['setHeader'](_0x117d('0x73'),'attachment;\x20filename='+util[_0x117d('0x6b')](_0x117d('0x74'),_0x4bb702[_0x117d('0x46')]['id'],_0x5e8f3b));_0x12b229[_0x117d('0x75')](_0x117d('0x76'),'text/csv');return _0x12b229[_0x117d('0x77')](util[_0x117d('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4bb702[_0x117d('0x46')]['id'],_0x5e8f3b));}else{return _0x12b229['sendStatus'](0xcc);}})[_0x117d('0x44')](handleError(_0x12b229,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 94c776a..67ede9e 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 _0x39b3=['define','JscriptyProject','jscripty_projects','lodash','api','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x42a892,_0x59c528){var _0x504383=function(_0x77d3db){while(--_0x77d3db){_0x42a892['push'](_0x42a892['shift']());}};_0x504383(++_0x59c528);}(_0x39b3,0xc9));var _0x339b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x39b3[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x339b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x339b('0x1'));var moment=require('moment');var BPromise=require(_0x339b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x339b('0x3'));var rimraf=require(_0x339b('0x4'));var config=require(_0x339b('0x5'));var attributes=require(_0x339b('0x6'));module[_0x339b('0x7')]=function(_0x3021b1,_0x2394e2){return _0x3021b1[_0x339b('0x8')](_0x339b('0x9'),attributes,{'tableName':_0x339b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab3f=['JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x23cbbd,_0xfe1549){var _0x4c7684=function(_0x594aa5){while(--_0x594aa5){_0x23cbbd['push'](_0x23cbbd['shift']());}};_0x4c7684(++_0xfe1549);}(_0xab3f,0x72));var _0xfab3=function(_0x40c53a,_0x24f04c){_0x40c53a=_0x40c53a-0x0;var _0x2db574=_0xab3f[_0x40c53a];return _0x2db574;};'use strict';var _=require(_0xfab3('0x0'));var util=require('util');var logger=require(_0xfab3('0x1'))(_0xfab3('0x2'));var moment=require(_0xfab3('0x3'));var BPromise=require(_0xfab3('0x4'));var rp=require(_0xfab3('0x5'));var fs=require('fs');var path=require(_0xfab3('0x6'));var rimraf=require(_0xfab3('0x7'));var config=require(_0xfab3('0x8'));var attributes=require(_0xfab3('0x9'));module[_0xfab3('0xa')]=function(_0x2daeb4,_0x5ed108){return _0x2daeb4[_0xfab3('0xb')](_0xfab3('0xc'),attributes,{'tableName':_0xfab3('0xd'),'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 c5d751c..c409b89 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(_0x2274e2,_0x3b70b2){var _0x2c73b4=function(_0x98b116){while(--_0x98b116){_0x2274e2['push'](_0x2274e2['shift']());}};_0x2c73b4(++_0x3b70b2);}(_0xe706,0xa3));var _0x6e70=function(_0x9fdd53,_0xd7b5c0){_0x9fdd53=_0x9fdd53-0x0;var _0x4ed380=_0xe706[_0x9fdd53];return _0x4ed380;};'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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x491ae2,_0x1ae3e0){var _0x5d19b2=function(_0x5f4e48){while(--_0x5f4e48){_0x491ae2['push'](_0x491ae2['shift']());}};_0x5d19b2(++_0x1ae3e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index cfe477c..7b21356 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 _0xb8b8=['../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1c135a,_0x447772){var _0x4e594b=function(_0x4d14b0){while(--_0x4d14b0){_0x1c135a['push'](_0x1c135a['shift']());}};_0x4e594b(++_0x447772);}(_0xb8b8,0xa0));var _0x8b8b=function(_0x2ee046,_0x15c5a0){_0x2ee046=_0x2ee046-0x0;var _0x1576e2=_0xb8b8[_0x2ee046];return _0x1576e2;};'use strict';var multer=require(_0x8b8b('0x0'));var util=require(_0x8b8b('0x1'));var path=require(_0x8b8b('0x2'));var timeout=require(_0x8b8b('0x3'));var express=require(_0x8b8b('0x4'));var router=express[_0x8b8b('0x5')]();var fs_extra=require(_0x8b8b('0x6'));var auth=require(_0x8b8b('0x7'));var interaction=require(_0x8b8b('0x8'));var config=require('../../config/environment');var controller=require(_0x8b8b('0x9'));router['get']('/',auth[_0x8b8b('0xa')](),controller[_0x8b8b('0xb')]);router[_0x8b8b('0xc')](_0x8b8b('0xd'),auth[_0x8b8b('0xa')](),controller[_0x8b8b('0xe')]);router[_0x8b8b('0xc')](_0x8b8b('0xf'),auth[_0x8b8b('0xa')](),controller[_0x8b8b('0x10')]);router[_0x8b8b('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8b8b('0x12')](_0x8b8b('0xf'),auth[_0x8b8b('0xa')](),controller[_0x8b8b('0x13')]);router[_0x8b8b('0x14')](_0x8b8b('0xf'),auth[_0x8b8b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb47e=['describe','/:id','post','create','put','update','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb47e,0x7b));var _0xeb47=function(_0x344b2a,_0x59acf8){_0x344b2a=_0x344b2a-0x0;var _0x9dd03d=_0xb47e[_0x344b2a];return _0x9dd03d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb47('0x0'));var router=express[_0xeb47('0x1')]();var fs_extra=require(_0xeb47('0x2'));var auth=require(_0xeb47('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeb47('0x4'));var controller=require(_0xeb47('0x5'));router['get']('/',auth[_0xeb47('0x6')](),controller['index']);router['get']('/describe',auth[_0xeb47('0x6')](),controller[_0xeb47('0x7')]);router['get'](_0xeb47('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xeb47('0x9')]('/',auth[_0xeb47('0x6')](),controller[_0xeb47('0xa')]);router[_0xeb47('0xb')](_0xeb47('0x8'),auth[_0xeb47('0x6')](),controller[_0xeb47('0xc')]);router['delete'](_0xeb47('0x8'),auth[_0xeb47('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index df5cb88..8f4303e 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x74533a,_0x41c3c5){_0x74533a=_0x74533a-0x0;var _0x1cf02c=_0x7a54[_0x74533a];return _0x1cf02c;};'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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x704cac,_0x3f8709){_0x704cac=_0x704cac-0x0;var _0x32f0fa=_0x7a54[_0x704cac];return _0x32f0fa;};'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 b5d8e94..50db593 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 _0x247a=['stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','error'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x247a,0x14b));var _0xa247=function(_0x4cfaca,_0x477428){_0x4cfaca=_0x4cfaca-0x0;var _0x33d40f=_0x247a[_0x4cfaca];return _0x33d40f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa247('0x0'));var zipdir=require(_0xa247('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa247('0x2'));var moment=require(_0xa247('0x3'));var BPromise=require(_0xa247('0x4'));var Mustache=require(_0xa247('0x5'));var util=require(_0xa247('0x6'));var path=require(_0xa247('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa247('0x8'));var fs=require('fs');var fs_extra=require(_0xa247('0x9'));var _=require(_0xa247('0xa'));var squel=require(_0xa247('0xb'));var crypto=require(_0xa247('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa247('0xd'));var toCsv=require(_0xa247('0xe'));var querystring=require(_0xa247('0xf'));var Papa=require(_0xa247('0x10'));var Redis=require('ioredis');var authService=require(_0xa247('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa247('0x12'));var hardwareService=require(_0xa247('0x13'));var logger=require('../../config/logger')(_0xa247('0x14'));var utils=require(_0xa247('0x15'));var config=require(_0xa247('0x16'));var licenseUtil=require(_0xa247('0x17'));var db=require(_0xa247('0x18'))['db'];function respondWithStatusCode(_0x3f7d4,_0x2c0333){_0x2c0333=_0x2c0333||0xcc;return function(_0x59a172){if(_0x59a172){return _0x3f7d4[_0xa247('0x19')](_0x2c0333);}return _0x3f7d4[_0xa247('0x1a')](_0x2c0333)[_0xa247('0x1b')]();};}function respondWithResult(_0x278410,_0x1ec4a8){_0x1ec4a8=_0x1ec4a8||0xc8;return function(_0xa6e589){if(_0xa6e589){return _0x278410[_0xa247('0x1a')](_0x1ec4a8)['json'](_0xa6e589);}};}function respondWithFilteredResult(_0x59371c,_0x572616){return function(_0x4286ab){if(_0x4286ab){var _0x56770c=typeof _0x572616['offset']===_0xa247('0x1c')&&typeof _0x572616[_0xa247('0x1d')]===_0xa247('0x1c');var _0x1f594a=_0x4286ab[_0xa247('0x1e')];var _0x412d78=_0x56770c?0x0:_0x572616[_0xa247('0x1f')];var _0x45697a=_0x56770c?_0x4286ab[_0xa247('0x1e')]:_0x572616['offset']+_0x572616['limit'];var _0x43db1f;if(_0x45697a>=_0x1f594a){_0x45697a=_0x1f594a;_0x43db1f=0xc8;}else{_0x43db1f=0xce;}_0x59371c['status'](_0x43db1f);return _0x59371c['set'](_0xa247('0x20'),_0x412d78+'-'+_0x45697a+'/'+_0x1f594a)[_0xa247('0x21')](_0x4286ab);}return null;};}function patchUpdates(_0x5b0d02){return function(_0x2455e8){try{jsonpatch[_0xa247('0x22')](_0x2455e8,_0x5b0d02,!![]);}catch(_0x3bd727){return BPromise['reject'](_0x3bd727);}return _0x2455e8[_0xa247('0x23')]();};}function saveUpdates(_0x4be5ca,_0x115c86){return function(_0xcc19b8){if(_0xcc19b8){return _0xcc19b8[_0xa247('0x24')](_0x4be5ca)[_0xa247('0x25')](function(_0x1f823d){return _0x1f823d;});}return null;};}function removeEntity(_0x161c76,_0x36a2e8){return function(_0x3d2bcd){if(_0x3d2bcd){return _0x3d2bcd['destroy']()[_0xa247('0x25')](function(){_0x161c76[_0xa247('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f6a76,_0x41c378){return function(_0x553b57){if(!_0x553b57){_0x3f6a76[_0xa247('0x19')](0x194);}return _0x553b57;};}function handleError(_0xc7ba87,_0x4a3b6e){_0x4a3b6e=_0x4a3b6e||0x1f4;return function(_0x2721df){logger[_0xa247('0x26')](_0x2721df[_0xa247('0x27')]);if(_0x2721df[_0xa247('0x28')]){delete _0x2721df[_0xa247('0x28')];}_0xc7ba87['status'](_0x4a3b6e)[_0xa247('0x29')](_0x2721df);};}exports['index']=function(_0x140990,_0x5043e8){var _0x4fe876={},_0x4366b8={},_0x437eba={'count':0x0,'rows':[]};var _0x5c1f72=_[_0xa247('0x2a')](db[_0xa247('0x2b')][_0xa247('0x2c')],function(_0xe5ec8e){return{'name':_0xe5ec8e[_0xa247('0x2d')],'type':_0xe5ec8e[_0xa247('0x2e')][_0xa247('0x2f')]};});_0x4366b8[_0xa247('0x30')]=_[_0xa247('0x2a')](_0x5c1f72,'name');_0x4366b8[_0xa247('0x31')]=_[_0xa247('0x32')](_0x140990[_0xa247('0x31')]);_0x4366b8[_0xa247('0x33')]=_[_0xa247('0x34')](_0x4366b8[_0xa247('0x30')],_0x4366b8[_0xa247('0x31')]);_0x4fe876[_0xa247('0x35')]=_[_0xa247('0x34')](_0x4366b8[_0xa247('0x30')],qs[_0xa247('0x36')](_0x140990[_0xa247('0x31')][_0xa247('0x36')]));_0x4fe876['attributes']=_0x4fe876[_0xa247('0x35')]['length']?_0x4fe876[_0xa247('0x35')]:_0x4366b8[_0xa247('0x30')];if(!_0x140990[_0xa247('0x31')][_0xa247('0x37')](_0xa247('0x38'))){_0x4fe876[_0xa247('0x1d')]=qs['limit'](_0x140990['query']['limit']);_0x4fe876['offset']=qs[_0xa247('0x1f')](_0x140990[_0xa247('0x31')][_0xa247('0x1f')]);}_0x4fe876['order']=qs[_0xa247('0x39')](_0x140990[_0xa247('0x31')][_0xa247('0x39')]);_0x4fe876[_0xa247('0x3a')]=qs[_0xa247('0x33')](_['pick'](_0x140990[_0xa247('0x31')],_0x4366b8[_0xa247('0x33')]),_0x5c1f72);if(_0x140990[_0xa247('0x31')][_0xa247('0x3b')]){_0x4fe876[_0xa247('0x3a')]=_[_0xa247('0x3c')](_0x4fe876[_0xa247('0x3a')],{'$or':_['map'](_0x5c1f72,function(_0x543a49){if(_0x543a49[_0xa247('0x2e')]!==_0xa247('0x3d')){var _0x2cf382={};_0x2cf382[_0x543a49['name']]={'$like':'%'+_0x140990[_0xa247('0x31')][_0xa247('0x3b')]+'%'};return _0x2cf382;}})});}_0x4fe876=_[_0xa247('0x3c')]({},_0x4fe876,_0x140990[_0xa247('0x3e')]);var _0x52db19={'where':_0x4fe876['where']};return db['JscriptyQuestionReport'][_0xa247('0x1e')](_0x52db19)['then'](function(_0x20fe4e){_0x437eba[_0xa247('0x1e')]=_0x20fe4e;if(_0x140990[_0xa247('0x31')][_0xa247('0x3f')]){_0x4fe876[_0xa247('0x40')]=[{'all':!![]}];}return db[_0xa247('0x2b')][_0xa247('0x41')](_0x4fe876);})['then'](function(_0x49eef0){_0x437eba[_0xa247('0x42')]=_0x49eef0;return _0x437eba;})['then'](respondWithFilteredResult(_0x5043e8,_0x4fe876))['catch'](handleError(_0x5043e8,null));};exports['show']=function(_0x18e46b,_0x2baecb){var _0x1a3c42={'raw':!![],'where':{'id':_0x18e46b['params']['id']}},_0x38ddd8={};_0x38ddd8['model']=_[_0xa247('0x32')](db[_0xa247('0x2b')][_0xa247('0x2c')]);_0x38ddd8['query']=_['keys'](_0x18e46b[_0xa247('0x31')]);_0x38ddd8['filters']=_[_0xa247('0x34')](_0x38ddd8[_0xa247('0x30')],_0x38ddd8[_0xa247('0x31')]);_0x1a3c42[_0xa247('0x35')]=_[_0xa247('0x34')](_0x38ddd8[_0xa247('0x30')],qs[_0xa247('0x36')](_0x18e46b[_0xa247('0x31')][_0xa247('0x36')]));_0x1a3c42[_0xa247('0x35')]=_0x1a3c42[_0xa247('0x35')]['length']?_0x1a3c42[_0xa247('0x35')]:_0x38ddd8[_0xa247('0x30')];if(_0x18e46b[_0xa247('0x31')]['includeAll']){_0x1a3c42[_0xa247('0x40')]=[{'all':!![]}];}_0x1a3c42=_[_0xa247('0x3c')]({},_0x1a3c42,_0x18e46b[_0xa247('0x3e')]);return db[_0xa247('0x2b')][_0xa247('0x43')](_0x1a3c42)[_0xa247('0x25')](handleEntityNotFound(_0x2baecb,null))[_0xa247('0x25')](respondWithResult(_0x2baecb,null))[_0xa247('0x44')](handleError(_0x2baecb,null));};exports[_0xa247('0x45')]=function(_0x52fb5d,_0x160495){return db['JscriptyQuestionReport'][_0xa247('0x45')](_0x52fb5d[_0xa247('0x46')],{})[_0xa247('0x25')](respondWithResult(_0x160495,0xc9))['catch'](handleError(_0x160495,null));};exports['update']=function(_0x5b2bc4,_0x5c9313){if(_0x5b2bc4[_0xa247('0x46')]['id']){delete _0x5b2bc4[_0xa247('0x46')]['id'];}return db[_0xa247('0x2b')][_0xa247('0x43')]({'where':{'id':_0x5b2bc4[_0xa247('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c9313,null))[_0xa247('0x25')](saveUpdates(_0x5b2bc4[_0xa247('0x46')],null))[_0xa247('0x25')](respondWithResult(_0x5c9313,null))[_0xa247('0x44')](handleError(_0x5c9313,null));};exports[_0xa247('0x48')]=function(_0x18cc1c,_0x226bee){return db[_0xa247('0x2b')]['find']({'where':{'id':_0x18cc1c[_0xa247('0x47')]['id']}})[_0xa247('0x25')](handleEntityNotFound(_0x226bee,null))[_0xa247('0x25')](removeEntity(_0x226bee,null))['catch'](handleError(_0x226bee,null));};exports[_0xa247('0x49')]=function(_0x18a1f4,_0x450403){return db[_0xa247('0x2b')][_0xa247('0x49')]()[_0xa247('0x25')](respondWithResult(_0x450403,null))[_0xa247('0x44')](handleError(_0x450403,null));}; \ No newline at end of file +var _0x7db7=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','rows','show','params','options','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x365dd1,_0x2e2371){var _0x55a061=function(_0x2d7ea3){while(--_0x2d7ea3){_0x365dd1['push'](_0x365dd1['shift']());}};_0x55a061(++_0x2e2371);}(_0x7db7,0x1dd));var _0x77db=function(_0x3d0272,_0x349667){_0x3d0272=_0x3d0272-0x0;var _0xdee5bd=_0x7db7[_0x3d0272];return _0xdee5bd;};'use strict';var emlformat=require(_0x77db('0x0'));var rimraf=require(_0x77db('0x1'));var zipdir=require(_0x77db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77db('0x3'));var moment=require(_0x77db('0x4'));var BPromise=require(_0x77db('0x5'));var Mustache=require(_0x77db('0x6'));var util=require(_0x77db('0x7'));var path=require(_0x77db('0x8'));var sox=require(_0x77db('0x9'));var csv=require(_0x77db('0xa'));var ejs=require(_0x77db('0xb'));var fs=require('fs');var fs_extra=require(_0x77db('0xc'));var _=require(_0x77db('0xd'));var squel=require('squel');var crypto=require(_0x77db('0xe'));var jsforce=require(_0x77db('0xf'));var deskjs=require(_0x77db('0x10'));var toCsv=require(_0x77db('0xa'));var querystring=require(_0x77db('0x11'));var Papa=require(_0x77db('0x12'));var Redis=require(_0x77db('0x13'));var authService=require(_0x77db('0x14'));var qs=require(_0x77db('0x15'));var as=require(_0x77db('0x16'));var hardwareService=require(_0x77db('0x17'));var logger=require(_0x77db('0x18'))(_0x77db('0x19'));var utils=require(_0x77db('0x1a'));var config=require(_0x77db('0x1b'));var licenseUtil=require(_0x77db('0x1c'));var db=require(_0x77db('0x1d'))['db'];function respondWithStatusCode(_0x782c5b,_0x36be36){_0x36be36=_0x36be36||0xcc;return function(_0x1b0b56){if(_0x1b0b56){return _0x782c5b[_0x77db('0x1e')](_0x36be36);}return _0x782c5b['status'](_0x36be36)[_0x77db('0x1f')]();};}function respondWithResult(_0x32c466,_0x2ddb90){_0x2ddb90=_0x2ddb90||0xc8;return function(_0x3365e0){if(_0x3365e0){return _0x32c466[_0x77db('0x20')](_0x2ddb90)[_0x77db('0x21')](_0x3365e0);}};}function respondWithFilteredResult(_0x366145,_0x5cd13a){return function(_0x21e2da){if(_0x21e2da){var _0xe43c06=typeof _0x5cd13a['offset']===_0x77db('0x22')&&typeof _0x5cd13a['limit']===_0x77db('0x22');var _0x1fe3a5=_0x21e2da[_0x77db('0x23')];var _0x1314a6=_0xe43c06?0x0:_0x5cd13a['offset'];var _0x5e607a=_0xe43c06?_0x21e2da[_0x77db('0x23')]:_0x5cd13a[_0x77db('0x24')]+_0x5cd13a[_0x77db('0x25')];var _0x3c7475;if(_0x5e607a>=_0x1fe3a5){_0x5e607a=_0x1fe3a5;_0x3c7475=0xc8;}else{_0x3c7475=0xce;}_0x366145[_0x77db('0x20')](_0x3c7475);return _0x366145[_0x77db('0x26')]('Content-Range',_0x1314a6+'-'+_0x5e607a+'/'+_0x1fe3a5)['json'](_0x21e2da);}return null;};}function patchUpdates(_0x57edca){return function(_0x1c7fe6){try{jsonpatch[_0x77db('0x27')](_0x1c7fe6,_0x57edca,!![]);}catch(_0x36a968){return BPromise[_0x77db('0x28')](_0x36a968);}return _0x1c7fe6[_0x77db('0x29')]();};}function saveUpdates(_0x2caaa5,_0x4c5b9f){return function(_0x4af900){if(_0x4af900){return _0x4af900[_0x77db('0x2a')](_0x2caaa5)[_0x77db('0x2b')](function(_0x5f2689){return _0x5f2689;});}return null;};}function removeEntity(_0x3ad979,_0x28e93f){return function(_0x2bf11e){if(_0x2bf11e){return _0x2bf11e['destroy']()[_0x77db('0x2b')](function(){_0x3ad979['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x70a0f7,_0x1562ac){return function(_0x117ffc){if(!_0x117ffc){_0x70a0f7[_0x77db('0x1e')](0x194);}return _0x117ffc;};}function handleError(_0x46df6a,_0x2b9bc9){_0x2b9bc9=_0x2b9bc9||0x1f4;return function(_0x112336){logger[_0x77db('0x2c')](_0x112336[_0x77db('0x2d')]);if(_0x112336[_0x77db('0x2e')]){delete _0x112336[_0x77db('0x2e')];}_0x46df6a['status'](_0x2b9bc9)['send'](_0x112336);};}exports[_0x77db('0x2f')]=function(_0x5897be,_0x3313e8){var _0x324263={},_0x3d2d28={},_0x3520f4={'count':0x0,'rows':[]};var _0x129f00=_[_0x77db('0x30')](db[_0x77db('0x31')][_0x77db('0x32')],function(_0x23e7e4){return{'name':_0x23e7e4['fieldName'],'type':_0x23e7e4[_0x77db('0x33')][_0x77db('0x34')]};});_0x3d2d28['model']=_[_0x77db('0x30')](_0x129f00,_0x77db('0x2e'));_0x3d2d28['query']=_[_0x77db('0x35')](_0x5897be[_0x77db('0x36')]);_0x3d2d28['filters']=_[_0x77db('0x37')](_0x3d2d28[_0x77db('0x38')],_0x3d2d28[_0x77db('0x36')]);_0x324263['attributes']=_[_0x77db('0x37')](_0x3d2d28['model'],qs[_0x77db('0x39')](_0x5897be['query'][_0x77db('0x39')]));_0x324263[_0x77db('0x3a')]=_0x324263[_0x77db('0x3a')][_0x77db('0x3b')]?_0x324263[_0x77db('0x3a')]:_0x3d2d28[_0x77db('0x38')];if(!_0x5897be[_0x77db('0x36')][_0x77db('0x3c')](_0x77db('0x3d'))){_0x324263['limit']=qs[_0x77db('0x25')](_0x5897be[_0x77db('0x36')][_0x77db('0x25')]);_0x324263[_0x77db('0x24')]=qs[_0x77db('0x24')](_0x5897be[_0x77db('0x36')]['offset']);}_0x324263['order']=qs[_0x77db('0x3e')](_0x5897be[_0x77db('0x36')][_0x77db('0x3e')]);_0x324263[_0x77db('0x3f')]=qs['filters'](_[_0x77db('0x40')](_0x5897be['query'],_0x3d2d28[_0x77db('0x41')]),_0x129f00);if(_0x5897be['query'][_0x77db('0x42')]){_0x324263['where']=_['merge'](_0x324263['where'],{'$or':_[_0x77db('0x30')](_0x129f00,function(_0x541fd5){if(_0x541fd5[_0x77db('0x33')]!==_0x77db('0x43')){var _0x55f1c1={};_0x55f1c1[_0x541fd5[_0x77db('0x2e')]]={'$like':'%'+_0x5897be['query'][_0x77db('0x42')]+'%'};return _0x55f1c1;}})});}_0x324263=_['merge']({},_0x324263,_0x5897be['options']);var _0x11278a={'where':_0x324263[_0x77db('0x3f')]};return db[_0x77db('0x31')][_0x77db('0x23')](_0x11278a)[_0x77db('0x2b')](function(_0xcb8a8a){_0x3520f4[_0x77db('0x23')]=_0xcb8a8a;if(_0x5897be[_0x77db('0x36')][_0x77db('0x44')]){_0x324263[_0x77db('0x45')]=[{'all':!![]}];}return db[_0x77db('0x31')]['findAll'](_0x324263);})['then'](function(_0x36a068){_0x3520f4[_0x77db('0x46')]=_0x36a068;return _0x3520f4;})['then'](respondWithFilteredResult(_0x3313e8,_0x324263))['catch'](handleError(_0x3313e8,null));};exports[_0x77db('0x47')]=function(_0x428f1b,_0x5d0f74){var _0x455f9f={'raw':!![],'where':{'id':_0x428f1b[_0x77db('0x48')]['id']}},_0xa0c106={};_0xa0c106[_0x77db('0x38')]=_['keys'](db[_0x77db('0x31')]['rawAttributes']);_0xa0c106[_0x77db('0x36')]=_[_0x77db('0x35')](_0x428f1b[_0x77db('0x36')]);_0xa0c106['filters']=_[_0x77db('0x37')](_0xa0c106[_0x77db('0x38')],_0xa0c106[_0x77db('0x36')]);_0x455f9f[_0x77db('0x3a')]=_[_0x77db('0x37')](_0xa0c106[_0x77db('0x38')],qs[_0x77db('0x39')](_0x428f1b[_0x77db('0x36')]['fields']));_0x455f9f['attributes']=_0x455f9f[_0x77db('0x3a')][_0x77db('0x3b')]?_0x455f9f[_0x77db('0x3a')]:_0xa0c106[_0x77db('0x38')];if(_0x428f1b[_0x77db('0x36')][_0x77db('0x44')]){_0x455f9f[_0x77db('0x45')]=[{'all':!![]}];}_0x455f9f=_['merge']({},_0x455f9f,_0x428f1b[_0x77db('0x49')]);return db[_0x77db('0x31')]['find'](_0x455f9f)['then'](handleEntityNotFound(_0x5d0f74,null))[_0x77db('0x2b')](respondWithResult(_0x5d0f74,null))[_0x77db('0x4a')](handleError(_0x5d0f74,null));};exports[_0x77db('0x4b')]=function(_0x589b9f,_0x43eddc){return db[_0x77db('0x31')]['create'](_0x589b9f[_0x77db('0x4c')],{})[_0x77db('0x2b')](respondWithResult(_0x43eddc,0xc9))['catch'](handleError(_0x43eddc,null));};exports[_0x77db('0x2a')]=function(_0x498ec4,_0x15abd6){if(_0x498ec4[_0x77db('0x4c')]['id']){delete _0x498ec4[_0x77db('0x4c')]['id'];}return db[_0x77db('0x31')][_0x77db('0x4d')]({'where':{'id':_0x498ec4[_0x77db('0x48')]['id']}})['then'](handleEntityNotFound(_0x15abd6,null))[_0x77db('0x2b')](saveUpdates(_0x498ec4['body'],null))[_0x77db('0x2b')](respondWithResult(_0x15abd6,null))[_0x77db('0x4a')](handleError(_0x15abd6,null));};exports[_0x77db('0x4e')]=function(_0x1b5d15,_0x3db124){return db[_0x77db('0x31')][_0x77db('0x4d')]({'where':{'id':_0x1b5d15[_0x77db('0x48')]['id']}})[_0x77db('0x2b')](handleEntityNotFound(_0x3db124,null))[_0x77db('0x2b')](removeEntity(_0x3db124,null))[_0x77db('0x4a')](handleError(_0x3db124,null));};exports[_0x77db('0x4f')]=function(_0x4bb76a,_0x555ff7){return db[_0x77db('0x31')][_0x77db('0x4f')]()[_0x77db('0x2b')](respondWithResult(_0x555ff7,null))[_0x77db('0x4a')](handleError(_0x555ff7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 14713e9..6ab52d6 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 _0x7348=['path','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x495ca4,_0x24e8b4){var _0x5b734d=function(_0x473de2){while(--_0x473de2){_0x495ca4['push'](_0x495ca4['shift']());}};_0x5b734d(++_0x24e8b4);}(_0x7348,0x171));var _0x8734=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7348[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x8734('0x0'));var logger=require(_0x8734('0x1'))('api');var moment=require(_0x8734('0x2'));var BPromise=require(_0x8734('0x3'));var rp=require(_0x8734('0x4'));var fs=require('fs');var path=require(_0x8734('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8734('0x6'));module[_0x8734('0x7')]=function(_0x33b8ac,_0x13657c){return _0x33b8ac[_0x8734('0x8')](_0x8734('0x9'),attributes,{'tableName':_0x8734('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36fd=['../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x36fd,0x117));var _0xd36f=function(_0x4ae2b6,_0x3d6ef0){_0x4ae2b6=_0x4ae2b6-0x0;var _0x1f2037=_0x36fd[_0x4ae2b6];return _0x1f2037;};'use strict';var _=require(_0xd36f('0x0'));var util=require(_0xd36f('0x1'));var logger=require(_0xd36f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd36f('0x3'));var rp=require(_0xd36f('0x4'));var fs=require('fs');var path=require(_0xd36f('0x5'));var rimraf=require(_0xd36f('0x6'));var config=require(_0xd36f('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xd36f('0x8')]=function(_0x23479d,_0x447468){return _0x23479d['define'](_0xd36f('0x9'),attributes,{'tableName':_0xd36f('0xa'),'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 e1fb95b..454a856 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 _0x300f=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x32bcbd,_0x8dcabe){var _0x490e25=function(_0x561540){while(--_0x561540){_0x32bcbd['push'](_0x32bcbd['shift']());}};_0x490e25(++_0x8dcabe);}(_0x300f,0xa6));var _0xf300=function(_0x402f9c,_0x2fe940){_0x402f9c=_0x402f9c-0x0;var _0x2ecedc=_0x300f[_0x402f9c];return _0x2ecedc;};'use strict';var _=require(_0xf300('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf300('0x1'));var rs=require(_0xf300('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf300('0x3'))['db'];var utils=require(_0xf300('0x4'));var logger=require('../../config/logger')(_0xf300('0x5'));var config=require(_0xf300('0x6'));var jayson=require(_0xf300('0x7'));var client=jayson[_0xf300('0x8')][_0xf300('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc487d9,_0x1dcbd4,_0x4b8d15){return new BPromise(function(_0x119136,_0x12c128){return client[_0xf300('0xa')](_0xc487d9,_0x4b8d15)[_0xf300('0xb')](function(_0x352e1c){logger[_0xf300('0xc')](_0xf300('0xd'),_0x1dcbd4,_0xf300('0xe'));logger[_0xf300('0xf')](_0xf300('0x10'),_0x1dcbd4,'request\x20sent',JSON[_0xf300('0x11')](_0x352e1c));if(_0x352e1c[_0xf300('0x12')]){if(_0x352e1c[_0xf300('0x12')][_0xf300('0x13')]===0x1f4){logger[_0xf300('0x12')](_0xf300('0xd'),_0x1dcbd4,_0x352e1c['error'][_0xf300('0x14')]);return _0x12c128(_0x352e1c[_0xf300('0x12')]['message']);}logger[_0xf300('0x12')](_0xf300('0xd'),_0x1dcbd4,_0x352e1c[_0xf300('0x12')]['message']);return _0x119136(_0x352e1c[_0xf300('0x12')][_0xf300('0x14')]);}else{logger[_0xf300('0xc')](_0xf300('0xd'),_0x1dcbd4,_0xf300('0xe'));_0x119136(_0x352e1c['result'][_0xf300('0x14')]);}})[_0xf300('0x15')](function(_0x47604d){logger[_0xf300('0x12')](_0xf300('0xd'),_0x1dcbd4,_0x47604d);_0x12c128(_0x47604d);});});} \ No newline at end of file +var _0x39a1=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x57abee,_0x2c37b0){var _0x539e8b=function(_0x436cad){while(--_0x436cad){_0x57abee['push'](_0x57abee['shift']());}};_0x539e8b(++_0x2c37b0);}(_0x39a1,0x1ac));var _0x139a=function(_0x37b0bd,_0x135f36){_0x37b0bd=_0x37b0bd-0x0;var _0x15137c=_0x39a1[_0x37b0bd];return _0x15137c;};'use strict';var _=require('lodash');var util=require(_0x139a('0x0'));var moment=require(_0x139a('0x1'));var BPromise=require(_0x139a('0x2'));var rs=require(_0x139a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x139a('0x4'))['db'];var utils=require(_0x139a('0x5'));var logger=require(_0x139a('0x6'))(_0x139a('0x7'));var config=require('../../config/environment');var jayson=require(_0x139a('0x8'));var client=jayson['client'][_0x139a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2db655,_0x1196aa,_0x426242){return new BPromise(function(_0x2d6bcf,_0x50163f){return client['request'](_0x2db655,_0x426242)[_0x139a('0xa')](function(_0x541b06){logger['info'](_0x139a('0xb'),_0x1196aa,'request\x20sent');logger[_0x139a('0xc')](_0x139a('0xd'),_0x1196aa,'request\x20sent',JSON['stringify'](_0x541b06));if(_0x541b06[_0x139a('0xe')]){if(_0x541b06[_0x139a('0xe')][_0x139a('0xf')]===0x1f4){logger[_0x139a('0xe')](_0x139a('0xb'),_0x1196aa,_0x541b06[_0x139a('0xe')][_0x139a('0x10')]);return _0x50163f(_0x541b06[_0x139a('0xe')][_0x139a('0x10')]);}logger[_0x139a('0xe')](_0x139a('0xb'),_0x1196aa,_0x541b06['error'][_0x139a('0x10')]);return _0x2d6bcf(_0x541b06[_0x139a('0xe')][_0x139a('0x10')]);}else{logger[_0x139a('0x11')](_0x139a('0xb'),_0x1196aa,_0x139a('0x12'));_0x2d6bcf(_0x541b06[_0x139a('0x13')]['message']);}})['catch'](function(_0x346a81){logger['error'](_0x139a('0xb'),_0x1196aa,_0x346a81);_0x50163f(_0x346a81);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a149f6d..736ebae 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 _0x182b=['/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/:id/questions','getQuestions','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x182b,0x16a));var _0xb182=function(_0x1a191b,_0x1978de){_0x1a191b=_0x1a191b-0x0;var _0xb94b72=_0x182b[_0x1a191b];return _0xb94b72;};'use strict';var multer=require(_0xb182('0x0'));var util=require(_0xb182('0x1'));var path=require(_0xb182('0x2'));var timeout=require(_0xb182('0x3'));var express=require(_0xb182('0x4'));var router=express[_0xb182('0x5')]();var fs_extra=require(_0xb182('0x6'));var auth=require(_0xb182('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb182('0x8'));var controller=require(_0xb182('0x9'));router['get']('/',auth[_0xb182('0xa')](),controller[_0xb182('0xb')]);router['get']('/describe',auth[_0xb182('0xa')](),controller['describe']);router[_0xb182('0xc')]('/:id',auth[_0xb182('0xa')](),controller['show']);router[_0xb182('0xc')](_0xb182('0xd'),auth[_0xb182('0xa')](),controller[_0xb182('0xe')]);router[_0xb182('0xf')]('/',auth['isAuthenticated'](),controller[_0xb182('0x10')]);router[_0xb182('0x11')](_0xb182('0x12'),auth['isAuthenticated'](),controller[_0xb182('0x13')]);router['delete'](_0xb182('0x12'),auth[_0xb182('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4d5c=['./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cc0,_0x41a763){var _0x5e65f0=function(_0x4c0a9f){while(--_0x4c0a9f){_0x3cc0['push'](_0x3cc0['shift']());}};_0x5e65f0(++_0x41a763);}(_0x4d5c,0xed));var _0xc4d5=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4d5c[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4d5('0x0')]();var fs_extra=require(_0xc4d5('0x1'));var auth=require(_0xc4d5('0x2'));var interaction=require(_0xc4d5('0x3'));var config=require(_0xc4d5('0x4'));var controller=require(_0xc4d5('0x5'));router['get']('/',auth[_0xc4d5('0x6')](),controller[_0xc4d5('0x7')]);router['get'](_0xc4d5('0x8'),auth['isAuthenticated'](),controller[_0xc4d5('0x9')]);router[_0xc4d5('0xa')](_0xc4d5('0xb'),auth[_0xc4d5('0x6')](),controller[_0xc4d5('0xc')]);router['get'](_0xc4d5('0xd'),auth[_0xc4d5('0x6')](),controller[_0xc4d5('0xe')]);router[_0xc4d5('0xf')]('/',auth[_0xc4d5('0x6')](),controller[_0xc4d5('0x10')]);router[_0xc4d5('0x11')](_0xc4d5('0xb'),auth[_0xc4d5('0x6')](),controller[_0xc4d5('0x12')]);router[_0xc4d5('0x13')]('/:id',auth[_0xc4d5('0x6')](),controller[_0xc4d5('0x14')]);module[_0xc4d5('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ef3a699..24848bd 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 _0x9e35=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','setDataValue','starttime','format'];(function(_0x5a6eb3,_0xae2835){var _0x3d04c5=function(_0x3639a5){while(--_0x3639a5){_0x5a6eb3['push'](_0x5a6eb3['shift']());}};_0x3d04c5(++_0xae2835);}(_0x9e35,0x1f3));var _0x59e3=function(_0x114b06,_0x4957c5){_0x114b06=_0x114b06-0x0;var _0x3b27b9=_0x9e35[_0x114b06];return _0x3b27b9;};'use strict';var moment=require('moment');var Sequelize=require(_0x59e3('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x59e3('0x1')],'set':function(_0xf79a95){this[_0x59e3('0x2')](_0x59e3('0x3'),_0xf79a95);this[_0x59e3('0x2')]('endtime',moment()[_0x59e3('0x4')](_0x59e3('0x5')));}},'endtime':{'type':Sequelize[_0x59e3('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x59e3('0x6')]},'queue':{'type':Sequelize[_0x59e3('0x6')]},'uniqueid':{'type':Sequelize[_0x59e3('0x6')]},'calleridname':{'type':Sequelize[_0x59e3('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x59e3('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x0599=['exports','setDataValue','starttime','endtime','format','DATE','STRING','sequelize'];(function(_0x49af56,_0x451d7f){var _0x2a7238=function(_0x72cf75){while(--_0x72cf75){_0x49af56['push'](_0x49af56['shift']());}};_0x2a7238(++_0x451d7f);}(_0x0599,0x13f));var _0x9059=function(_0x23a38c,_0x37f3ce){_0x23a38c=_0x23a38c-0x0;var _0x36ca09=_0x0599[_0x23a38c];return _0x36ca09;};'use strict';var moment=require('moment');var Sequelize=require(_0x9059('0x0'));module[_0x9059('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x55a5c5){this[_0x9059('0x2')](_0x9059('0x3'),_0x55a5c5);this[_0x9059('0x2')](_0x9059('0x4'),moment()[_0x9059('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x9059('0x6')]},'membername':{'type':Sequelize[_0x9059('0x7')]},'projectname':{'type':Sequelize[_0x9059('0x7')]},'queue':{'type':Sequelize[_0x9059('0x7')]},'uniqueid':{'type':Sequelize[_0x9059('0x7')]},'calleridname':{'type':Sequelize[_0x9059('0x7')]},'calleridnum':{'type':Sequelize[_0x9059('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index a81c4fb..b5a7705 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 _0x48af=['filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','filters','include','options','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','index','JscriptySessionReport','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x48af,0x148));var _0xf48a=function(_0x571fd6,_0x5223fc){_0x571fd6=_0x571fd6-0x0;var _0x4d6af6=_0x48af[_0x571fd6];return _0x4d6af6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf48a('0x0'));var zipdir=require(_0xf48a('0x1'));var jsonpatch=require(_0xf48a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf48a('0x3'));var Mustache=require(_0xf48a('0x4'));var util=require(_0xf48a('0x5'));var path=require(_0xf48a('0x6'));var sox=require(_0xf48a('0x7'));var csv=require(_0xf48a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf48a('0x9'));var _=require(_0xf48a('0xa'));var squel=require(_0xf48a('0xb'));var crypto=require('crypto');var jsforce=require(_0xf48a('0xc'));var deskjs=require(_0xf48a('0xd'));var toCsv=require(_0xf48a('0x8'));var querystring=require(_0xf48a('0xe'));var Papa=require(_0xf48a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf48a('0x10'));var as=require(_0xf48a('0x11'));var hardwareService=require(_0xf48a('0x12'));var logger=require('../../config/logger')(_0xf48a('0x13'));var utils=require(_0xf48a('0x14'));var config=require(_0xf48a('0x15'));var licenseUtil=require(_0xf48a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426fb1,_0x4a64e3){_0x4a64e3=_0x4a64e3||0xcc;return function(_0xfe406d){if(_0xfe406d){return _0x426fb1['sendStatus'](_0x4a64e3);}return _0x426fb1[_0xf48a('0x17')](_0x4a64e3)[_0xf48a('0x18')]();};}function respondWithResult(_0x13543e,_0x375cd6){_0x375cd6=_0x375cd6||0xc8;return function(_0x34ead3){if(_0x34ead3){return _0x13543e[_0xf48a('0x17')](_0x375cd6)['json'](_0x34ead3);}};}function respondWithFilteredResult(_0x41d811,_0x2c7c74){return function(_0x35f18d){if(_0x35f18d){var _0x48d723=typeof _0x2c7c74[_0xf48a('0x19')]===_0xf48a('0x1a')&&typeof _0x2c7c74['limit']===_0xf48a('0x1a');var _0x4377d7=_0x35f18d[_0xf48a('0x1b')];var _0x508d60=_0x48d723?0x0:_0x2c7c74[_0xf48a('0x19')];var _0x56d99a=_0x48d723?_0x35f18d[_0xf48a('0x1b')]:_0x2c7c74[_0xf48a('0x19')]+_0x2c7c74[_0xf48a('0x1c')];var _0x5158a5;if(_0x56d99a>=_0x4377d7){_0x56d99a=_0x4377d7;_0x5158a5=0xc8;}else{_0x5158a5=0xce;}_0x41d811[_0xf48a('0x17')](_0x5158a5);return _0x41d811['set'](_0xf48a('0x1d'),_0x508d60+'-'+_0x56d99a+'/'+_0x4377d7)[_0xf48a('0x1e')](_0x35f18d);}return null;};}function patchUpdates(_0x253e92){return function(_0x256b49){try{jsonpatch[_0xf48a('0x1f')](_0x256b49,_0x253e92,!![]);}catch(_0x14d4a6){return BPromise[_0xf48a('0x20')](_0x14d4a6);}return _0x256b49['save']();};}function saveUpdates(_0x2d6af1,_0xe1c625){return function(_0x52e210){if(_0x52e210){return _0x52e210[_0xf48a('0x21')](_0x2d6af1)[_0xf48a('0x22')](function(_0x6f1f93){return _0x6f1f93;});}return null;};}function removeEntity(_0x4bfe9b,_0x46cc91){return function(_0x183680){if(_0x183680){return _0x183680[_0xf48a('0x23')]()[_0xf48a('0x22')](function(){_0x4bfe9b['status'](0xcc)[_0xf48a('0x18')]();});}};}function handleEntityNotFound(_0x1b99c7,_0x27c615){return function(_0x5be301){if(!_0x5be301){_0x1b99c7[_0xf48a('0x24')](0x194);}return _0x5be301;};}function handleError(_0x22ae38,_0x3ea63c){_0x3ea63c=_0x3ea63c||0x1f4;return function(_0x2ce475){logger['error'](_0x2ce475[_0xf48a('0x25')]);if(_0x2ce475[_0xf48a('0x26')]){delete _0x2ce475[_0xf48a('0x26')];}_0x22ae38['status'](_0x3ea63c)['send'](_0x2ce475);};}exports[_0xf48a('0x27')]=function(_0xc3154a,_0xbf78e){var _0x4f9142={},_0x2c5240={},_0x213258={'count':0x0,'rows':[]};var _0x185141=_['map'](db[_0xf48a('0x28')][_0xf48a('0x29')],function(_0x3337fb){return{'name':_0x3337fb['fieldName'],'type':_0x3337fb[_0xf48a('0x2a')][_0xf48a('0x2b')]};});_0x2c5240[_0xf48a('0x2c')]=_[_0xf48a('0x2d')](_0x185141,_0xf48a('0x26'));_0x2c5240['query']=_['keys'](_0xc3154a[_0xf48a('0x2e')]);_0x2c5240['filters']=_[_0xf48a('0x2f')](_0x2c5240[_0xf48a('0x2c')],_0x2c5240['query']);_0x4f9142[_0xf48a('0x30')]=_[_0xf48a('0x2f')](_0x2c5240['model'],qs[_0xf48a('0x31')](_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x31')]));_0x4f9142[_0xf48a('0x30')]=_0x4f9142['attributes'][_0xf48a('0x32')]?_0x4f9142[_0xf48a('0x30')]:_0x2c5240[_0xf48a('0x2c')];if(!_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x33')](_0xf48a('0x34'))){_0x4f9142[_0xf48a('0x1c')]=qs['limit'](_0xc3154a[_0xf48a('0x2e')]['limit']);_0x4f9142[_0xf48a('0x19')]=qs[_0xf48a('0x19')](_0xc3154a['query']['offset']);}_0x4f9142[_0xf48a('0x35')]=qs[_0xf48a('0x36')](_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x36')]);_0x4f9142[_0xf48a('0x37')]=qs['filters'](_[_0xf48a('0x38')](_0xc3154a[_0xf48a('0x2e')],_0x2c5240['filters']),_0x185141);if(_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x39')]){_0x4f9142[_0xf48a('0x37')]=_['merge'](_0x4f9142[_0xf48a('0x37')],{'$or':_[_0xf48a('0x2d')](_0x185141,function(_0x342193){if(_0x342193[_0xf48a('0x2a')]!==_0xf48a('0x3a')){var _0x32dd70={};_0x32dd70[_0x342193[_0xf48a('0x26')]]={'$like':'%'+_0xc3154a[_0xf48a('0x2e')]['filter']+'%'};return _0x32dd70;}})});}_0x4f9142=_[_0xf48a('0x3b')]({},_0x4f9142,_0xc3154a['options']);var _0x39d34e={'where':_0x4f9142['where']};return db[_0xf48a('0x28')][_0xf48a('0x1b')](_0x39d34e)['then'](function(_0x13daec){_0x213258[_0xf48a('0x1b')]=_0x13daec;if(_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x3c')]){_0x4f9142['include']=[{'all':!![]}];}return db[_0xf48a('0x28')][_0xf48a('0x3d')](_0x4f9142);})['then'](function(_0x3b508d){_0x213258[_0xf48a('0x3e')]=_0x3b508d;return _0x213258;})[_0xf48a('0x22')](respondWithFilteredResult(_0xbf78e,_0x4f9142))['catch'](handleError(_0xbf78e,null));};exports[_0xf48a('0x3f')]=function(_0x361594,_0x365f7a){var _0x2219e5={'raw':!![],'where':{'id':_0x361594[_0xf48a('0x40')]['id']}},_0xf43829={};_0xf43829[_0xf48a('0x2c')]=_[_0xf48a('0x41')](db['JscriptySessionReport'][_0xf48a('0x29')]);_0xf43829[_0xf48a('0x2e')]=_['keys'](_0x361594[_0xf48a('0x2e')]);_0xf43829[_0xf48a('0x42')]=_['intersection'](_0xf43829['model'],_0xf43829[_0xf48a('0x2e')]);_0x2219e5['attributes']=_[_0xf48a('0x2f')](_0xf43829[_0xf48a('0x2c')],qs[_0xf48a('0x31')](_0x361594[_0xf48a('0x2e')][_0xf48a('0x31')]));_0x2219e5[_0xf48a('0x30')]=_0x2219e5[_0xf48a('0x30')]['length']?_0x2219e5[_0xf48a('0x30')]:_0xf43829['model'];if(_0x361594[_0xf48a('0x2e')][_0xf48a('0x3c')]){_0x2219e5[_0xf48a('0x43')]=[{'all':!![]}];}_0x2219e5=_['merge']({},_0x2219e5,_0x361594[_0xf48a('0x44')]);return db[_0xf48a('0x28')][_0xf48a('0x45')](_0x2219e5)[_0xf48a('0x22')](handleEntityNotFound(_0x365f7a,null))['then'](respondWithResult(_0x365f7a,null))[_0xf48a('0x46')](handleError(_0x365f7a,null));};exports[_0xf48a('0x47')]=function(_0x16e3cf,_0x462825){return db[_0xf48a('0x28')][_0xf48a('0x47')](_0x16e3cf[_0xf48a('0x48')],{})['then'](respondWithResult(_0x462825,0xc9))[_0xf48a('0x46')](handleError(_0x462825,null));};exports['update']=function(_0x543e64,_0x2f1eee){if(_0x543e64[_0xf48a('0x48')]['id']){delete _0x543e64['body']['id'];}return db[_0xf48a('0x28')][_0xf48a('0x45')]({'where':{'id':_0x543e64[_0xf48a('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f1eee,null))[_0xf48a('0x22')](saveUpdates(_0x543e64[_0xf48a('0x48')],null))[_0xf48a('0x22')](respondWithResult(_0x2f1eee,null))['catch'](handleError(_0x2f1eee,null));};exports['destroy']=function(_0x1ed00f,_0x54981a){return db[_0xf48a('0x28')]['find']({'where':{'id':_0x1ed00f[_0xf48a('0x40')]['id']}})['then'](handleEntityNotFound(_0x54981a,null))['then'](removeEntity(_0x54981a,null))[_0xf48a('0x46')](handleError(_0x54981a,null));};exports[_0xf48a('0x49')]=function(_0x1160cf,_0x1acddb){return db[_0xf48a('0x28')][_0xf48a('0x49')]()['then'](respondWithResult(_0x1acddb,null))[_0xf48a('0x46')](handleError(_0x1acddb,null));};exports[_0xf48a('0x4a')]=function(_0x231ae2,_0x16e62d,_0x62854){var _0x5993a8={'raw':!![],'where':{}};var _0x266940={};var _0x6dd18e={'count':0x0,'rows':[]};return db[_0xf48a('0x28')][_0xf48a('0x4b')]({'where':{'id':_0x231ae2[_0xf48a('0x40')]['id']}})[_0xf48a('0x22')](handleEntityNotFound(_0x16e62d,null))['then'](function(_0x244a0c){if(_0x244a0c){_0x266940[_0xf48a('0x2c')]=_[_0xf48a('0x41')](db['JscriptyQuestionReport']['rawAttributes']);_0x266940['query']=_[_0xf48a('0x41')](_0x231ae2[_0xf48a('0x2e')]);_0x266940['filters']=_['intersection'](_0x266940[_0xf48a('0x2c')],_0x266940[_0xf48a('0x2e')]);_0x5993a8[_0xf48a('0x30')]=_[_0xf48a('0x2f')](_0x266940['model'],qs[_0xf48a('0x31')](_0x231ae2['query'][_0xf48a('0x31')]));_0x5993a8[_0xf48a('0x30')]=_0x5993a8['attributes'][_0xf48a('0x32')]?_0x5993a8[_0xf48a('0x30')]:_0x266940[_0xf48a('0x2c')];if(!_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x33')](_0xf48a('0x34'))){_0x5993a8[_0xf48a('0x1c')]=qs[_0xf48a('0x1c')](_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x1c')]);_0x5993a8['offset']=qs[_0xf48a('0x19')](_0x231ae2[_0xf48a('0x2e')]['offset']);}_0x5993a8[_0xf48a('0x35')]=qs[_0xf48a('0x36')](_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x36')]);_0x5993a8[_0xf48a('0x37')]=qs[_0xf48a('0x42')](_[_0xf48a('0x38')](_0x231ae2[_0xf48a('0x2e')],_0x266940[_0xf48a('0x42')]));_0x5993a8[_0xf48a('0x37')]['SessionId']=_0x244a0c['id'];if(_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x39')]){_0x5993a8[_0xf48a('0x37')]=_[_0xf48a('0x3b')](_0x5993a8[_0xf48a('0x37')],{'$or':_[_0xf48a('0x2d')](_0x5993a8[_0xf48a('0x30')],function(_0x300bbf){var _0x2f6a45={};_0x2f6a45[_0x300bbf]={'$like':'%'+_0x231ae2['query'][_0xf48a('0x39')]+'%'};return _0x2f6a45;})});}_0x5993a8=_['merge']({},_0x5993a8,_0x231ae2[_0xf48a('0x44')]);return db[_0xf48a('0x4c')]['count']({'where':_0x5993a8[_0xf48a('0x37')]})[_0xf48a('0x22')](function(_0x10475c){_0x6dd18e[_0xf48a('0x1b')]=_0x10475c;if(_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x3c')]){_0x5993a8[_0xf48a('0x43')]=[{'all':!![]}];}return db[_0xf48a('0x4c')][_0xf48a('0x3d')](_0x5993a8);})[_0xf48a('0x22')](function(_0x22db1a){_0x6dd18e['rows']=_0x22db1a;return _0x6dd18e;});}})[_0xf48a('0x22')](respondWithFilteredResult(_0x16e62d,_0x5993a8))['catch'](handleError(_0x16e62d,null));}; \ No newline at end of file +var _0xc678=['lodash','squel','crypto','jsforce','desk.js','to-csv','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','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','includeAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs'];(function(_0x4ab157,_0x298ced){var _0x33f852=function(_0x1cdecf){while(--_0x1cdecf){_0x4ab157['push'](_0x4ab157['shift']());}};_0x33f852(++_0x298ced);}(_0xc678,0x149));var _0x8c67=function(_0x5586e5,_0x38200e){_0x5586e5=_0x5586e5-0x0;var _0x263383=_0xc678[_0x5586e5];return _0x263383;};'use strict';var emlformat=require(_0x8c67('0x0'));var rimraf=require(_0x8c67('0x1'));var zipdir=require(_0x8c67('0x2'));var jsonpatch=require(_0x8c67('0x3'));var rp=require(_0x8c67('0x4'));var moment=require('moment');var BPromise=require(_0x8c67('0x5'));var Mustache=require(_0x8c67('0x6'));var util=require(_0x8c67('0x7'));var path=require(_0x8c67('0x8'));var sox=require(_0x8c67('0x9'));var csv=require('to-csv');var ejs=require(_0x8c67('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c67('0xb'));var squel=require(_0x8c67('0xc'));var crypto=require(_0x8c67('0xd'));var jsforce=require(_0x8c67('0xe'));var deskjs=require(_0x8c67('0xf'));var toCsv=require(_0x8c67('0x10'));var querystring=require(_0x8c67('0x11'));var Papa=require(_0x8c67('0x12'));var Redis=require('ioredis');var authService=require(_0x8c67('0x13'));var qs=require(_0x8c67('0x14'));var as=require(_0x8c67('0x15'));var hardwareService=require(_0x8c67('0x16'));var logger=require(_0x8c67('0x17'))(_0x8c67('0x18'));var utils=require(_0x8c67('0x19'));var config=require(_0x8c67('0x1a'));var licenseUtil=require(_0x8c67('0x1b'));var db=require(_0x8c67('0x1c'))['db'];function respondWithStatusCode(_0x3425d1,_0x2b247c){_0x2b247c=_0x2b247c||0xcc;return function(_0x26a3bf){if(_0x26a3bf){return _0x3425d1[_0x8c67('0x1d')](_0x2b247c);}return _0x3425d1[_0x8c67('0x1e')](_0x2b247c)['end']();};}function respondWithResult(_0x155020,_0x1429d3){_0x1429d3=_0x1429d3||0xc8;return function(_0x10bc1c){if(_0x10bc1c){return _0x155020['status'](_0x1429d3)[_0x8c67('0x1f')](_0x10bc1c);}};}function respondWithFilteredResult(_0x2b630b,_0x3ff58f){return function(_0x5804f8){if(_0x5804f8){var _0x7476f6=typeof _0x3ff58f['offset']===_0x8c67('0x20')&&typeof _0x3ff58f[_0x8c67('0x21')]===_0x8c67('0x20');var _0x5c3048=_0x5804f8[_0x8c67('0x22')];var _0x200c82=_0x7476f6?0x0:_0x3ff58f[_0x8c67('0x23')];var _0x15451a=_0x7476f6?_0x5804f8['count']:_0x3ff58f[_0x8c67('0x23')]+_0x3ff58f[_0x8c67('0x21')];var _0x5db7a1;if(_0x15451a>=_0x5c3048){_0x15451a=_0x5c3048;_0x5db7a1=0xc8;}else{_0x5db7a1=0xce;}_0x2b630b[_0x8c67('0x1e')](_0x5db7a1);return _0x2b630b[_0x8c67('0x24')](_0x8c67('0x25'),_0x200c82+'-'+_0x15451a+'/'+_0x5c3048)[_0x8c67('0x1f')](_0x5804f8);}return null;};}function patchUpdates(_0x4390c8){return function(_0x1c958c){try{jsonpatch[_0x8c67('0x26')](_0x1c958c,_0x4390c8,!![]);}catch(_0x41220e){return BPromise[_0x8c67('0x27')](_0x41220e);}return _0x1c958c['save']();};}function saveUpdates(_0x2b7259,_0x54c5d7){return function(_0x57ceb0){if(_0x57ceb0){return _0x57ceb0[_0x8c67('0x28')](_0x2b7259)['then'](function(_0x24c9fa){return _0x24c9fa;});}return null;};}function removeEntity(_0x12649a,_0x28b3df){return function(_0x5ddaac){if(_0x5ddaac){return _0x5ddaac[_0x8c67('0x29')]()[_0x8c67('0x2a')](function(){_0x12649a[_0x8c67('0x1e')](0xcc)[_0x8c67('0x2b')]();});}};}function handleEntityNotFound(_0x35a703,_0x37434d){return function(_0x2bbf59){if(!_0x2bbf59){_0x35a703['sendStatus'](0x194);}return _0x2bbf59;};}function handleError(_0x4c432f,_0xaa422a){_0xaa422a=_0xaa422a||0x1f4;return function(_0x7f1f2){logger[_0x8c67('0x2c')](_0x7f1f2[_0x8c67('0x2d')]);if(_0x7f1f2[_0x8c67('0x2e')]){delete _0x7f1f2[_0x8c67('0x2e')];}_0x4c432f[_0x8c67('0x1e')](_0xaa422a)['send'](_0x7f1f2);};}exports[_0x8c67('0x2f')]=function(_0x549e4d,_0x10a9e1){var _0x5680b9={},_0x2fedb1={},_0x248ab3={'count':0x0,'rows':[]};var _0x2d9dd3=_[_0x8c67('0x30')](db[_0x8c67('0x31')][_0x8c67('0x32')],function(_0x160708){return{'name':_0x160708[_0x8c67('0x33')],'type':_0x160708[_0x8c67('0x34')]['key']};});_0x2fedb1[_0x8c67('0x35')]=_['map'](_0x2d9dd3,'name');_0x2fedb1[_0x8c67('0x36')]=_[_0x8c67('0x37')](_0x549e4d[_0x8c67('0x36')]);_0x2fedb1[_0x8c67('0x38')]=_[_0x8c67('0x39')](_0x2fedb1['model'],_0x2fedb1[_0x8c67('0x36')]);_0x5680b9[_0x8c67('0x3a')]=_['intersection'](_0x2fedb1['model'],qs[_0x8c67('0x3b')](_0x549e4d[_0x8c67('0x36')][_0x8c67('0x3b')]));_0x5680b9[_0x8c67('0x3a')]=_0x5680b9[_0x8c67('0x3a')][_0x8c67('0x3c')]?_0x5680b9[_0x8c67('0x3a')]:_0x2fedb1[_0x8c67('0x35')];if(!_0x549e4d['query'][_0x8c67('0x3d')](_0x8c67('0x3e'))){_0x5680b9[_0x8c67('0x21')]=qs[_0x8c67('0x21')](_0x549e4d[_0x8c67('0x36')][_0x8c67('0x21')]);_0x5680b9['offset']=qs[_0x8c67('0x23')](_0x549e4d[_0x8c67('0x36')][_0x8c67('0x23')]);}_0x5680b9[_0x8c67('0x3f')]=qs[_0x8c67('0x40')](_0x549e4d[_0x8c67('0x36')]['sort']);_0x5680b9[_0x8c67('0x41')]=qs[_0x8c67('0x38')](_[_0x8c67('0x42')](_0x549e4d[_0x8c67('0x36')],_0x2fedb1[_0x8c67('0x38')]),_0x2d9dd3);if(_0x549e4d[_0x8c67('0x36')][_0x8c67('0x43')]){_0x5680b9[_0x8c67('0x41')]=_[_0x8c67('0x44')](_0x5680b9[_0x8c67('0x41')],{'$or':_[_0x8c67('0x30')](_0x2d9dd3,function(_0x17e91e){if(_0x17e91e[_0x8c67('0x34')]!==_0x8c67('0x45')){var _0x1dd669={};_0x1dd669[_0x17e91e[_0x8c67('0x2e')]]={'$like':'%'+_0x549e4d[_0x8c67('0x36')][_0x8c67('0x43')]+'%'};return _0x1dd669;}})});}_0x5680b9=_[_0x8c67('0x44')]({},_0x5680b9,_0x549e4d[_0x8c67('0x46')]);var _0x34d3c9={'where':_0x5680b9['where']};return db[_0x8c67('0x31')][_0x8c67('0x22')](_0x34d3c9)[_0x8c67('0x2a')](function(_0x3a5327){_0x248ab3[_0x8c67('0x22')]=_0x3a5327;if(_0x549e4d[_0x8c67('0x36')]['includeAll']){_0x5680b9[_0x8c67('0x47')]=[{'all':!![]}];}return db[_0x8c67('0x31')][_0x8c67('0x48')](_0x5680b9);})[_0x8c67('0x2a')](function(_0x5f2351){_0x248ab3['rows']=_0x5f2351;return _0x248ab3;})[_0x8c67('0x2a')](respondWithFilteredResult(_0x10a9e1,_0x5680b9))['catch'](handleError(_0x10a9e1,null));};exports[_0x8c67('0x49')]=function(_0x551751,_0x44de2a){var _0x2499ec={'raw':!![],'where':{'id':_0x551751[_0x8c67('0x4a')]['id']}},_0x396907={};_0x396907[_0x8c67('0x35')]=_[_0x8c67('0x37')](db[_0x8c67('0x31')]['rawAttributes']);_0x396907[_0x8c67('0x36')]=_[_0x8c67('0x37')](_0x551751[_0x8c67('0x36')]);_0x396907[_0x8c67('0x38')]=_[_0x8c67('0x39')](_0x396907[_0x8c67('0x35')],_0x396907[_0x8c67('0x36')]);_0x2499ec[_0x8c67('0x3a')]=_[_0x8c67('0x39')](_0x396907['model'],qs[_0x8c67('0x3b')](_0x551751[_0x8c67('0x36')][_0x8c67('0x3b')]));_0x2499ec[_0x8c67('0x3a')]=_0x2499ec[_0x8c67('0x3a')][_0x8c67('0x3c')]?_0x2499ec[_0x8c67('0x3a')]:_0x396907[_0x8c67('0x35')];if(_0x551751[_0x8c67('0x36')]['includeAll']){_0x2499ec[_0x8c67('0x47')]=[{'all':!![]}];}_0x2499ec=_['merge']({},_0x2499ec,_0x551751[_0x8c67('0x46')]);return db[_0x8c67('0x31')][_0x8c67('0x4b')](_0x2499ec)['then'](handleEntityNotFound(_0x44de2a,null))['then'](respondWithResult(_0x44de2a,null))[_0x8c67('0x4c')](handleError(_0x44de2a,null));};exports[_0x8c67('0x4d')]=function(_0x493ce1,_0x408e03){return db[_0x8c67('0x31')]['create'](_0x493ce1[_0x8c67('0x4e')],{})['then'](respondWithResult(_0x408e03,0xc9))[_0x8c67('0x4c')](handleError(_0x408e03,null));};exports[_0x8c67('0x28')]=function(_0x4a90b8,_0x4bcbdb){if(_0x4a90b8[_0x8c67('0x4e')]['id']){delete _0x4a90b8[_0x8c67('0x4e')]['id'];}return db[_0x8c67('0x31')][_0x8c67('0x4b')]({'where':{'id':_0x4a90b8['params']['id']}})[_0x8c67('0x2a')](handleEntityNotFound(_0x4bcbdb,null))['then'](saveUpdates(_0x4a90b8[_0x8c67('0x4e')],null))[_0x8c67('0x2a')](respondWithResult(_0x4bcbdb,null))[_0x8c67('0x4c')](handleError(_0x4bcbdb,null));};exports['destroy']=function(_0x27f825,_0x49c568){return db[_0x8c67('0x31')][_0x8c67('0x4b')]({'where':{'id':_0x27f825[_0x8c67('0x4a')]['id']}})[_0x8c67('0x2a')](handleEntityNotFound(_0x49c568,null))[_0x8c67('0x2a')](removeEntity(_0x49c568,null))['catch'](handleError(_0x49c568,null));};exports[_0x8c67('0x4f')]=function(_0x3e0da7,_0x10f64b){return db[_0x8c67('0x31')][_0x8c67('0x4f')]()[_0x8c67('0x2a')](respondWithResult(_0x10f64b,null))['catch'](handleError(_0x10f64b,null));};exports[_0x8c67('0x50')]=function(_0x4e6f5c,_0x155134,_0x1c8a1a){var _0x1105a1={'raw':!![],'where':{}};var _0x7dfa17={};var _0x10cf51={'count':0x0,'rows':[]};return db[_0x8c67('0x31')]['findOne']({'where':{'id':_0x4e6f5c['params']['id']}})[_0x8c67('0x2a')](handleEntityNotFound(_0x155134,null))[_0x8c67('0x2a')](function(_0x1f94ed){if(_0x1f94ed){_0x7dfa17[_0x8c67('0x35')]=_[_0x8c67('0x37')](db[_0x8c67('0x51')][_0x8c67('0x32')]);_0x7dfa17['query']=_['keys'](_0x4e6f5c['query']);_0x7dfa17[_0x8c67('0x38')]=_['intersection'](_0x7dfa17['model'],_0x7dfa17[_0x8c67('0x36')]);_0x1105a1['attributes']=_[_0x8c67('0x39')](_0x7dfa17[_0x8c67('0x35')],qs[_0x8c67('0x3b')](_0x4e6f5c[_0x8c67('0x36')][_0x8c67('0x3b')]));_0x1105a1[_0x8c67('0x3a')]=_0x1105a1[_0x8c67('0x3a')][_0x8c67('0x3c')]?_0x1105a1[_0x8c67('0x3a')]:_0x7dfa17[_0x8c67('0x35')];if(!_0x4e6f5c[_0x8c67('0x36')][_0x8c67('0x3d')](_0x8c67('0x3e'))){_0x1105a1[_0x8c67('0x21')]=qs[_0x8c67('0x21')](_0x4e6f5c[_0x8c67('0x36')]['limit']);_0x1105a1['offset']=qs[_0x8c67('0x23')](_0x4e6f5c[_0x8c67('0x36')][_0x8c67('0x23')]);}_0x1105a1[_0x8c67('0x3f')]=qs[_0x8c67('0x40')](_0x4e6f5c['query'][_0x8c67('0x40')]);_0x1105a1['where']=qs[_0x8c67('0x38')](_[_0x8c67('0x42')](_0x4e6f5c[_0x8c67('0x36')],_0x7dfa17[_0x8c67('0x38')]));_0x1105a1['where'][_0x8c67('0x52')]=_0x1f94ed['id'];if(_0x4e6f5c[_0x8c67('0x36')][_0x8c67('0x43')]){_0x1105a1[_0x8c67('0x41')]=_[_0x8c67('0x44')](_0x1105a1[_0x8c67('0x41')],{'$or':_[_0x8c67('0x30')](_0x1105a1['attributes'],function(_0x32c280){var _0x3dba4d={};_0x3dba4d[_0x32c280]={'$like':'%'+_0x4e6f5c[_0x8c67('0x36')][_0x8c67('0x43')]+'%'};return _0x3dba4d;})});}_0x1105a1=_[_0x8c67('0x44')]({},_0x1105a1,_0x4e6f5c[_0x8c67('0x46')]);return db[_0x8c67('0x51')][_0x8c67('0x22')]({'where':_0x1105a1[_0x8c67('0x41')]})[_0x8c67('0x2a')](function(_0x2be72e){_0x10cf51['count']=_0x2be72e;if(_0x4e6f5c[_0x8c67('0x36')][_0x8c67('0x53')]){_0x1105a1['include']=[{'all':!![]}];}return db[_0x8c67('0x51')]['findAll'](_0x1105a1);})[_0x8c67('0x2a')](function(_0x7bc565){_0x10cf51[_0x8c67('0x54')]=_0x7bc565;return _0x10cf51;});}})[_0x8c67('0x2a')](respondWithFilteredResult(_0x155134,_0x1105a1))[_0x8c67('0x4c')](handleError(_0x155134,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 81e2115..c886662 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash'];(function(_0x2dc621,_0x1c3969){var _0x2a1369=function(_0x8a4843){while(--_0x8a4843){_0x2dc621['push'](_0x2dc621['shift']());}};_0x2a1369(++_0x1c3969);}(_0x5496,0x175));var _0x6549=function(_0x3310f7,_0x416a18){_0x3310f7=_0x3310f7-0x0;var _0x15bcd1=_0x5496[_0x3310f7];return _0x15bcd1;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf69d=['report_jscripty_sessions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0xf69d,0xd3));var _0xdf69=function(_0x598743,_0x515420){_0x598743=_0x598743-0x0;var _0x55795e=_0xf69d[_0x598743];return _0x55795e;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var moment=require(_0xdf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf69('0x5'));var fs=require('fs');var path=require(_0xdf69('0x6'));var rimraf=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var attributes=require(_0xdf69('0x9'));module[_0xdf69('0xa')]=function(_0x2d456f,_0x465b1b){return _0x2d456f[_0xdf69('0xb')](_0xdf69('0xc'),attributes,{'tableName':_0xdf69('0xd'),'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 6af6b67..4a4a58e 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xc2c7,0x134));var _0x7c2c=function(_0x161f42,_0x1a7824){_0x161f42=_0x161f42-0x0;var _0x5d8f3e=_0xc2c7[_0x161f42];return _0x5d8f3e;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0xcaf2=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x5799e1,_0x789913){var _0x271eb3=function(_0x28a787){while(--_0x28a787){_0x5799e1['push'](_0x5799e1['shift']());}};_0x271eb3(++_0x789913);}(_0xcaf2,0x8a));var _0x2caf=function(_0x203a88,_0x32521b){_0x203a88=_0x203a88-0x0;var _0x46e6ce=_0xcaf2[_0x203a88];return _0x46e6ce;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ec6e9b3..615a841 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 _0xec61=['/download_log_file','downloadLogFile','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x11eebf,_0x1d996c){var _0xa22847=function(_0x216d30){while(--_0x216d30){_0x11eebf['push'](_0x11eebf['shift']());}};_0xa22847(++_0x1d996c);}(_0xec61,0x16f));var _0x1ec6=function(_0x478df4,_0x369b3e){_0x478df4=_0x478df4-0x0;var _0x48b89e=_0xec61[_0x478df4];return _0x48b89e;};'use strict';var multer=require('multer');var util=require(_0x1ec6('0x0'));var path=require(_0x1ec6('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ec6('0x2'));var router=express['Router']();var fs_extra=require(_0x1ec6('0x3'));var auth=require(_0x1ec6('0x4'));var interaction=require(_0x1ec6('0x5'));var config=require(_0x1ec6('0x6'));var controller=require('./license.controller');router['get']('/',controller['index']);router[_0x1ec6('0x7')](_0x1ec6('0x8'),auth[_0x1ec6('0x9')](),controller[_0x1ec6('0xa')]);router['get'](_0x1ec6('0xb'),auth[_0x1ec6('0x9')](),controller[_0x1ec6('0xc')]);module[_0x1ec6('0xd')]=router; \ No newline at end of file +var _0x7653=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7653,0xe8));var _0x3765=function(_0x51e136,_0x4eecfd){_0x51e136=_0x51e136-0x0;var _0x52b4f3=_0x7653[_0x51e136];return _0x52b4f3;};'use strict';var multer=require(_0x3765('0x0'));var util=require(_0x3765('0x1'));var path=require(_0x3765('0x2'));var timeout=require(_0x3765('0x3'));var express=require(_0x3765('0x4'));var router=express[_0x3765('0x5')]();var fs_extra=require(_0x3765('0x6'));var auth=require(_0x3765('0x7'));var interaction=require(_0x3765('0x8'));var config=require(_0x3765('0x9'));var controller=require(_0x3765('0xa'));router[_0x3765('0xb')]('/',controller[_0x3765('0xc')]);router[_0x3765('0xd')]('/:id',auth[_0x3765('0xe')](),controller[_0x3765('0xf')]);router['get']('/download_log_file',auth[_0x3765('0xe')](),controller['downloadLogFile']);module[_0x3765('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4664278..86e5aae 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 _0xf05f=['INTEGER','sequelize','TEXT','STRING'];(function(_0x59b63f,_0x47b899){var _0x1ad91a=function(_0x3278a2){while(--_0x3278a2){_0x59b63f['push'](_0x59b63f['shift']());}};_0x1ad91a(++_0x47b899);}(_0xf05f,0x7d));var _0xff05=function(_0x2d85e3,_0x4ea2bf){_0x2d85e3=_0x2d85e3-0x0;var _0x1de29e=_0xf05f[_0x2d85e3];return _0x1de29e;};'use strict';var Sequelize=require(_0xff05('0x0'));module['exports']={'license':{'type':Sequelize[_0xff05('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xff05('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xff05('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5132=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5132,0x7a));var _0x2513=function(_0xc12605,_0x44101f){_0xc12605=_0xc12605-0x0;var _0x4779e1=_0x5132[_0xc12605];return _0x4779e1;};'use strict';var Sequelize=require(_0x2513('0x0'));module[_0x2513('0x1')]={'license':{'type':Sequelize[_0x2513('0x2')]},'data1':{'type':Sequelize[_0x2513('0x3')]},'data2':{'type':Sequelize[_0x2513('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x2513('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 a82d9d3..f599eee 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 _0x7ca3=['get','key','demo','downloadLogFile','license-info.log','join','log','xcally','attachment;\x20filename=','Content-Type','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','model','License','query','keys','filters','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params'];(function(_0x4a530a,_0x3cf908){var _0x3ab3d4=function(_0x1427c7){while(--_0x1427c7){_0x4a530a['push'](_0x4a530a['shift']());}};_0x3ab3d4(++_0x3cf908);}(_0x7ca3,0x9b));var _0x37ca=function(_0x44f781,_0x1b984e){_0x44f781=_0x44f781-0x0;var _0x1b0b31=_0x7ca3[_0x44f781];return _0x1b0b31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37ca('0x0'));var zipdir=require(_0x37ca('0x1'));var jsonpatch=require(_0x37ca('0x2'));var rp=require(_0x37ca('0x3'));var moment=require(_0x37ca('0x4'));var BPromise=require(_0x37ca('0x5'));var Mustache=require(_0x37ca('0x6'));var util=require('util');var path=require(_0x37ca('0x7'));var sox=require('sox');var csv=require(_0x37ca('0x8'));var ejs=require(_0x37ca('0x9'));var fs=require('fs');var fs_extra=require(_0x37ca('0xa'));var _=require('lodash');var squel=require(_0x37ca('0xb'));var crypto=require(_0x37ca('0xc'));var jsforce=require(_0x37ca('0xd'));var deskjs=require(_0x37ca('0xe'));var toCsv=require(_0x37ca('0x8'));var querystring=require(_0x37ca('0xf'));var Papa=require('papaparse');var Redis=require(_0x37ca('0x10'));var authService=require(_0x37ca('0x11'));var qs=require(_0x37ca('0x12'));var as=require(_0x37ca('0x13'));var hardwareService=require(_0x37ca('0x14'));var logger=require(_0x37ca('0x15'))(_0x37ca('0x16'));var utils=require(_0x37ca('0x17'));var config=require(_0x37ca('0x18'));var licenseUtil=require(_0x37ca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x882080,_0x4cdeb1){_0x4cdeb1=_0x4cdeb1||0xcc;return function(_0x5aef8f){if(_0x5aef8f){return _0x882080[_0x37ca('0x1a')](_0x4cdeb1);}return _0x882080[_0x37ca('0x1b')](_0x4cdeb1)[_0x37ca('0x1c')]();};}function respondWithResult(_0x592bd5,_0x47e11c){_0x47e11c=_0x47e11c||0xc8;return function(_0x1b8729){if(_0x1b8729){return _0x592bd5[_0x37ca('0x1b')](_0x47e11c)[_0x37ca('0x1d')](_0x1b8729);}};}function respondWithFilteredResult(_0x4eda6c,_0x48c10f){return function(_0x56d1e0){if(_0x56d1e0){var _0xf8e1fa=typeof _0x48c10f[_0x37ca('0x1e')]===_0x37ca('0x1f')&&typeof _0x48c10f[_0x37ca('0x20')]===_0x37ca('0x1f');var _0x436142=_0x56d1e0[_0x37ca('0x21')];var _0x3d8c18=_0xf8e1fa?0x0:_0x48c10f[_0x37ca('0x1e')];var _0x43769b=_0xf8e1fa?_0x56d1e0['count']:_0x48c10f[_0x37ca('0x1e')]+_0x48c10f[_0x37ca('0x20')];var _0x4ffce5;if(_0x43769b>=_0x436142){_0x43769b=_0x436142;_0x4ffce5=0xc8;}else{_0x4ffce5=0xce;}_0x4eda6c[_0x37ca('0x1b')](_0x4ffce5);return _0x4eda6c[_0x37ca('0x22')](_0x37ca('0x23'),_0x3d8c18+'-'+_0x43769b+'/'+_0x436142)['json'](_0x56d1e0);}return null;};}function patchUpdates(_0x55ffc7){return function(_0x44c02d){try{jsonpatch[_0x37ca('0x24')](_0x44c02d,_0x55ffc7,!![]);}catch(_0x29efd9){return BPromise[_0x37ca('0x25')](_0x29efd9);}return _0x44c02d[_0x37ca('0x26')]();};}function saveUpdates(_0x526197,_0x5e7d37){return function(_0x3fcf67){if(_0x3fcf67){return _0x3fcf67['update'](_0x526197)[_0x37ca('0x27')](function(_0x4b2346){return _0x4b2346;});}return null;};}function removeEntity(_0x147903,_0x2734fd){return function(_0xf06ade){if(_0xf06ade){return _0xf06ade[_0x37ca('0x28')]()['then'](function(){_0x147903[_0x37ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6447,_0x37392e){return function(_0x540653){if(!_0x540653){_0x2d6447[_0x37ca('0x1a')](0x194);}return _0x540653;};}function handleError(_0x4d0939,_0xcfa12e){_0xcfa12e=_0xcfa12e||0x1f4;return function(_0x27cce7){logger[_0x37ca('0x29')](_0x27cce7[_0x37ca('0x2a')]);if(_0x27cce7[_0x37ca('0x2b')]){delete _0x27cce7['name'];}_0x4d0939['status'](_0xcfa12e)[_0x37ca('0x2c')](_0x27cce7);};}var utilLicense=require('../../config/license/util');exports[_0x37ca('0x2d')]=function(_0x362603,_0xb6ce34){var _0x368cad={'raw':!![],'where':{'id':0x1}},_0x5c8d29={};_0x5c8d29[_0x37ca('0x2e')]=_['keys'](db[_0x37ca('0x2f')]['rawAttributes']);_0x5c8d29[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x362603[_0x37ca('0x30')]);_0x5c8d29[_0x37ca('0x32')]=_[_0x37ca('0x33')](_0x5c8d29[_0x37ca('0x2e')],_0x5c8d29[_0x37ca('0x30')]);_0x368cad[_0x37ca('0x34')]=_[_0x37ca('0x33')](_0x5c8d29[_0x37ca('0x2e')],qs[_0x37ca('0x35')](_0x362603['query'][_0x37ca('0x35')]));_0x368cad[_0x37ca('0x34')]=_0x368cad['attributes']['length']?_0x368cad[_0x37ca('0x34')]:_0x5c8d29['model'];_0x368cad=_[_0x37ca('0x36')]({},_0x368cad,_0x362603[_0x37ca('0x37')]);return utilLicense[_0x37ca('0x38')](_0x368cad)['then'](respondWithResult(_0xb6ce34,null))[_0x37ca('0x39')](handleError(_0xb6ce34,null));};exports['update']=function(_0x64c51a,_0x60a540){if(_0x64c51a[_0x37ca('0x3a')]['id']){delete _0x64c51a[_0x37ca('0x3a')]['id'];}return db[_0x37ca('0x2f')][_0x37ca('0x3b')]({'where':{'id':_0x64c51a[_0x37ca('0x3c')]['id']}})['then'](handleEntityNotFound(_0x60a540,null))[_0x37ca('0x27')](function(_0x571022){var _0x6553a0=_0x571022[_0x37ca('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x6553a0,_0x64c51a[_0x37ca('0x3a')][_0x37ca('0x3e')]);})[_0x37ca('0x27')](function(_0x5c5226){if(!_0x5c5226[_0x37ca('0x3f')]){return saveUpdates(_0x64c51a[_0x37ca('0x3a')],null);}return _0x5c5226;})[_0x37ca('0x27')](respondWithResult(_0x60a540,null))[_0x37ca('0x39')](handleError(_0x60a540,null));};exports[_0x37ca('0x40')]=function(_0xe193e7,_0x2eee12){var _0x1ce0f7=_0x37ca('0x41');var _0x155bef=path[_0x37ca('0x42')]('/var',_0x37ca('0x43'),_0x37ca('0x44'),_0x1ce0f7);_0x2eee12['setHeader']('Content-disposition',_0x37ca('0x45')+_0x1ce0f7);_0x2eee12['set'](_0x37ca('0x46'),'text/plain');_0x2eee12[_0x37ca('0x47')](_0x155bef);}; \ No newline at end of file +var _0x1f31=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','../../config/license/util','keys','License','query','filters','intersection','model','attributes','fields','length','merge','options','catch','body','find','params','get','checkLicense','key','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','eml-format'];(function(_0x33dba8,_0x296d5a){var _0x5a22b6=function(_0x11d9bc){while(--_0x11d9bc){_0x33dba8['push'](_0x33dba8['shift']());}};_0x5a22b6(++_0x296d5a);}(_0x1f31,0x153));var _0x11f3=function(_0x56fbaa,_0x3bc5a6){_0x56fbaa=_0x56fbaa-0x0;var _0x49fbc1=_0x1f31[_0x56fbaa];return _0x49fbc1;};'use strict';var emlformat=require(_0x11f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11f3('0x1'));var jsonpatch=require(_0x11f3('0x2'));var rp=require(_0x11f3('0x3'));var moment=require(_0x11f3('0x4'));var BPromise=require(_0x11f3('0x5'));var Mustache=require(_0x11f3('0x6'));var util=require(_0x11f3('0x7'));var path=require(_0x11f3('0x8'));var sox=require(_0x11f3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11f3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x11f3('0xb'));var jsforce=require(_0x11f3('0xc'));var deskjs=require(_0x11f3('0xd'));var toCsv=require(_0x11f3('0xe'));var querystring=require('querystring');var Papa=require(_0x11f3('0xf'));var Redis=require(_0x11f3('0x10'));var authService=require(_0x11f3('0x11'));var qs=require(_0x11f3('0x12'));var as=require(_0x11f3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11f3('0x14'));var utils=require(_0x11f3('0x15'));var config=require(_0x11f3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x11f3('0x17'))['db'];function respondWithStatusCode(_0x6288d4,_0xc41b57){_0xc41b57=_0xc41b57||0xcc;return function(_0x4ae4eb){if(_0x4ae4eb){return _0x6288d4[_0x11f3('0x18')](_0xc41b57);}return _0x6288d4[_0x11f3('0x19')](_0xc41b57)[_0x11f3('0x1a')]();};}function respondWithResult(_0x55f8c8,_0x17a131){_0x17a131=_0x17a131||0xc8;return function(_0x351894){if(_0x351894){return _0x55f8c8[_0x11f3('0x19')](_0x17a131)[_0x11f3('0x1b')](_0x351894);}};}function respondWithFilteredResult(_0xbce00f,_0x5594be){return function(_0x5bc1f1){if(_0x5bc1f1){var _0x569e88=typeof _0x5594be[_0x11f3('0x1c')]===_0x11f3('0x1d')&&typeof _0x5594be['limit']===_0x11f3('0x1d');var _0x95712c=_0x5bc1f1[_0x11f3('0x1e')];var _0x124192=_0x569e88?0x0:_0x5594be[_0x11f3('0x1c')];var _0x4a3fda=_0x569e88?_0x5bc1f1['count']:_0x5594be[_0x11f3('0x1c')]+_0x5594be['limit'];var _0x338256;if(_0x4a3fda>=_0x95712c){_0x4a3fda=_0x95712c;_0x338256=0xc8;}else{_0x338256=0xce;}_0xbce00f['status'](_0x338256);return _0xbce00f[_0x11f3('0x1f')](_0x11f3('0x20'),_0x124192+'-'+_0x4a3fda+'/'+_0x95712c)[_0x11f3('0x1b')](_0x5bc1f1);}return null;};}function patchUpdates(_0x5a4008){return function(_0x351725){try{jsonpatch[_0x11f3('0x21')](_0x351725,_0x5a4008,!![]);}catch(_0x3f8556){return BPromise[_0x11f3('0x22')](_0x3f8556);}return _0x351725[_0x11f3('0x23')]();};}function saveUpdates(_0x3d5b71,_0x524e16){return function(_0x45da2e){if(_0x45da2e){return _0x45da2e[_0x11f3('0x24')](_0x3d5b71)[_0x11f3('0x25')](function(_0xda9fc8){return _0xda9fc8;});}return null;};}function removeEntity(_0x51ef52,_0xb7d1e4){return function(_0x3e8612){if(_0x3e8612){return _0x3e8612[_0x11f3('0x26')]()['then'](function(){_0x51ef52[_0x11f3('0x19')](0xcc)[_0x11f3('0x1a')]();});}};}function handleEntityNotFound(_0x55f67c,_0x440155){return function(_0x2b22e){if(!_0x2b22e){_0x55f67c[_0x11f3('0x18')](0x194);}return _0x2b22e;};}function handleError(_0x4c8bd9,_0x27786c){_0x27786c=_0x27786c||0x1f4;return function(_0x59ce8a){logger['error'](_0x59ce8a[_0x11f3('0x27')]);if(_0x59ce8a['name']){delete _0x59ce8a['name'];}_0x4c8bd9[_0x11f3('0x19')](_0x27786c)['send'](_0x59ce8a);};}var utilLicense=require(_0x11f3('0x28'));exports['index']=function(_0x3fa24c,_0x34a6ce){var _0x5282bb={'raw':!![],'where':{'id':0x1}},_0x3f0e30={};_0x3f0e30['model']=_[_0x11f3('0x29')](db[_0x11f3('0x2a')]['rawAttributes']);_0x3f0e30['query']=_['keys'](_0x3fa24c[_0x11f3('0x2b')]);_0x3f0e30[_0x11f3('0x2c')]=_[_0x11f3('0x2d')](_0x3f0e30[_0x11f3('0x2e')],_0x3f0e30[_0x11f3('0x2b')]);_0x5282bb[_0x11f3('0x2f')]=_[_0x11f3('0x2d')](_0x3f0e30[_0x11f3('0x2e')],qs[_0x11f3('0x30')](_0x3fa24c[_0x11f3('0x2b')]['fields']));_0x5282bb[_0x11f3('0x2f')]=_0x5282bb[_0x11f3('0x2f')][_0x11f3('0x31')]?_0x5282bb[_0x11f3('0x2f')]:_0x3f0e30['model'];_0x5282bb=_[_0x11f3('0x32')]({},_0x5282bb,_0x3fa24c[_0x11f3('0x33')]);return utilLicense['getLicense'](_0x5282bb)['then'](respondWithResult(_0x34a6ce,null))[_0x11f3('0x34')](handleError(_0x34a6ce,null));};exports[_0x11f3('0x24')]=function(_0x5cadc0,_0xfe4de0){if(_0x5cadc0[_0x11f3('0x35')]['id']){delete _0x5cadc0[_0x11f3('0x35')]['id'];}return db['License'][_0x11f3('0x36')]({'where':{'id':_0x5cadc0[_0x11f3('0x37')]['id']}})['then'](handleEntityNotFound(_0xfe4de0,null))[_0x11f3('0x25')](function(_0x365780){var _0x5d3cb4=_0x365780[_0x11f3('0x38')]({'plain':!![]});return utilLicense[_0x11f3('0x39')](_0x5d3cb4,_0x5cadc0['body'][_0x11f3('0x3a')]);})[_0x11f3('0x25')](function(_0x383883){if(!_0x383883['demo']){return saveUpdates(_0x5cadc0[_0x11f3('0x35')],null);}return _0x383883;})[_0x11f3('0x25')](respondWithResult(_0xfe4de0,null))[_0x11f3('0x34')](handleError(_0xfe4de0,null));};exports[_0x11f3('0x3b')]=function(_0x507f6e,_0x3b4aac){var _0x24fb5f=_0x11f3('0x3c');var _0x579b9b=path['join'](_0x11f3('0x3d'),_0x11f3('0x3e'),_0x11f3('0x3f'),_0x24fb5f);_0x3b4aac[_0x11f3('0x40')](_0x11f3('0x41'),'attachment;\x20filename='+_0x24fb5f);_0x3b4aac[_0x11f3('0x1f')](_0x11f3('0x42'),_0x11f3('0x43'));_0x3b4aac['download'](_0x579b9b);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2b9f654..f4f8455 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 _0xe0a5=['moment','request-promise','rimraf','./license.attributes','exports','define','License','license','lodash','../../config/logger','api'];(function(_0x18e1ff,_0x3bbd67){var _0x4a03bb=function(_0x45d21a){while(--_0x45d21a){_0x18e1ff['push'](_0x18e1ff['shift']());}};_0x4a03bb(++_0x3bbd67);}(_0xe0a5,0x1e1));var _0x5e0a=function(_0x46369a,_0x141daa){_0x46369a=_0x46369a-0x0;var _0x59e91d=_0xe0a5[_0x46369a];return _0x59e91d;};'use strict';var _=require(_0x5e0a('0x0'));var util=require('util');var logger=require(_0x5e0a('0x1'))(_0x5e0a('0x2'));var moment=require(_0x5e0a('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e0a('0x5'));var config=require('../../config/environment');var attributes=require(_0x5e0a('0x6'));module[_0x5e0a('0x7')]=function(_0x42de2c,_0x7d08bb){return _0x42de2c[_0x5e0a('0x8')](_0x5e0a('0x9'),attributes,{'tableName':_0x5e0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0850=['bluebird','rimraf','../../config/environment','exports','define','License','lodash','util','../../config/logger','api'];(function(_0x2d5c22,_0x3d6e55){var _0x3bc75e=function(_0x390cda){while(--_0x390cda){_0x2d5c22['push'](_0x2d5c22['shift']());}};_0x3bc75e(++_0x3d6e55);}(_0x0850,0x178));var _0x0085=function(_0x1e8d81,_0x44b08e){_0x1e8d81=_0x1e8d81-0x0;var _0x1658f6=_0x0850[_0x1e8d81];return _0x1658f6;};'use strict';var _=require(_0x0085('0x0'));var util=require(_0x0085('0x1'));var logger=require(_0x0085('0x2'))(_0x0085('0x3'));var moment=require('moment');var BPromise=require(_0x0085('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0085('0x5'));var config=require(_0x0085('0x6'));var attributes=require('./license.attributes');module[_0x0085('0x7')]=function(_0x2db49a,_0x2c0584){return _0x2db49a[_0x0085('0x8')](_0x0085('0x9'),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 e28cb13..fc5d5f8 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 _0x29ef=['message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x29ef,0x12e));var _0xf29e=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x29ef[_0x324012];return _0x435cf2;};'use strict';var _=require('lodash');var util=require(_0xf29e('0x0'));var moment=require(_0xf29e('0x1'));var BPromise=require(_0xf29e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf29e('0x3'))['db'];var utils=require(_0xf29e('0x4'));var logger=require(_0xf29e('0x5'))(_0xf29e('0x6'));var config=require(_0xf29e('0x7'));var jayson=require(_0xf29e('0x8'));var client=jayson['client'][_0xf29e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x470b02,_0x18c9b5,_0x378cb4){return new BPromise(function(_0x44cc1f,_0x52fa5e){return client[_0xf29e('0xa')](_0x470b02,_0x378cb4)[_0xf29e('0xb')](function(_0x5d1c3a){logger[_0xf29e('0xc')](_0xf29e('0xd'),_0x18c9b5,_0xf29e('0xe'));logger[_0xf29e('0xf')](_0xf29e('0x10'),_0x18c9b5,_0xf29e('0xe'),JSON[_0xf29e('0x11')](_0x5d1c3a));if(_0x5d1c3a['error']){if(_0x5d1c3a['error'][_0xf29e('0x12')]===0x1f4){logger[_0xf29e('0x13')](_0xf29e('0xd'),_0x18c9b5,_0x5d1c3a['error'][_0xf29e('0x14')]);return _0x52fa5e(_0x5d1c3a['error'][_0xf29e('0x14')]);}logger[_0xf29e('0x13')]('License,\x20%s,\x20%s',_0x18c9b5,_0x5d1c3a[_0xf29e('0x13')]['message']);return _0x44cc1f(_0x5d1c3a[_0xf29e('0x13')][_0xf29e('0x14')]);}else{logger[_0xf29e('0xc')](_0xf29e('0xd'),_0x18c9b5,_0xf29e('0xe'));_0x44cc1f(_0x5d1c3a[_0xf29e('0x15')][_0xf29e('0x14')]);}})[_0xf29e('0x16')](function(_0x5e2bf4){logger[_0xf29e('0x13')](_0xf29e('0xd'),_0x18c9b5,_0x5e2bf4);_0x52fa5e(_0x5e2bf4);});});} \ No newline at end of file +var _0xeccf=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment'];(function(_0x14d599,_0x1876d6){var _0x6a2df=function(_0x56e3f1){while(--_0x56e3f1){_0x14d599['push'](_0x14d599['shift']());}};_0x6a2df(++_0x1876d6);}(_0xeccf,0x116));var _0xfecc=function(_0x45d843,_0x274d4a){_0x45d843=_0x45d843-0x0;var _0x100330=_0xeccf[_0x45d843];return _0x100330;};'use strict';var _=require('lodash');var util=require(_0xfecc('0x0'));var moment=require(_0xfecc('0x1'));var BPromise=require('bluebird');var rs=require(_0xfecc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfecc('0x3'));var logger=require(_0xfecc('0x4'))(_0xfecc('0x5'));var config=require(_0xfecc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfecc('0x7')][_0xfecc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4165d6,_0x3fad27,_0x58a98a){return new BPromise(function(_0x468b20,_0x508fb7){return client[_0xfecc('0x9')](_0x4165d6,_0x58a98a)['then'](function(_0x181bc7){logger['info'](_0xfecc('0xa'),_0x3fad27,_0xfecc('0xb'));logger[_0xfecc('0xc')](_0xfecc('0xd'),_0x3fad27,_0xfecc('0xb'),JSON['stringify'](_0x181bc7));if(_0x181bc7['error']){if(_0x181bc7[_0xfecc('0xe')][_0xfecc('0xf')]===0x1f4){logger[_0xfecc('0xe')](_0xfecc('0xa'),_0x3fad27,_0x181bc7[_0xfecc('0xe')]['message']);return _0x508fb7(_0x181bc7['error'][_0xfecc('0x10')]);}logger[_0xfecc('0xe')](_0xfecc('0xa'),_0x3fad27,_0x181bc7[_0xfecc('0xe')]['message']);return _0x468b20(_0x181bc7['error'][_0xfecc('0x10')]);}else{logger[_0xfecc('0x11')](_0xfecc('0xa'),_0x3fad27,_0xfecc('0xb'));_0x468b20(_0x181bc7[_0xfecc('0x12')][_0xfecc('0x10')]);}})[_0xfecc('0x13')](function(_0x5d9800){logger['error'](_0xfecc('0xa'),_0x3fad27,_0x5d9800);_0x508fb7(_0x5d9800);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 307ad85..7724a35 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 _0x520e=['index','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','/:id/verify','verifySmtp','/:id/users','post','/:id/dispositions','addDisposition','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeSmtp','destroy','multer','util','path','express','Router','./mailAccount.controller','get'];(function(_0x19dd8a,_0x449861){var _0x212ccc=function(_0x4f52b6){while(--_0x4f52b6){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x212ccc(++_0x449861);}(_0x520e,0x141));var _0xe520=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x520e[_0x3f1710];return _0x528458;};'use strict';var multer=require(_0xe520('0x0'));var util=require(_0xe520('0x1'));var path=require(_0xe520('0x2'));var timeout=require('connect-timeout');var express=require(_0xe520('0x3'));var router=express[_0xe520('0x4')]();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(_0xe520('0x5'));router[_0xe520('0x6')]('/',auth['isAuthenticated'](),controller[_0xe520('0x7')]);router[_0xe520('0x6')]('/describe',auth[_0xe520('0x8')](),controller[_0xe520('0x9')]);router[_0xe520('0x6')](_0xe520('0xa'),auth[_0xe520('0x8')](),controller[_0xe520('0xb')]);router[_0xe520('0x6')]('/:id/dispositions',auth[_0xe520('0x8')](),controller['getDispositions']);router[_0xe520('0x6')](_0xe520('0xc'),auth[_0xe520('0x8')](),controller[_0xe520('0xd')]);router[_0xe520('0x6')](_0xe520('0xe'),auth[_0xe520('0x8')](),controller[_0xe520('0xf')]);router[_0xe520('0x6')](_0xe520('0x10'),auth[_0xe520('0x8')](),controller[_0xe520('0x11')]);router[_0xe520('0x6')](_0xe520('0x12'),auth[_0xe520('0x8')](),controller[_0xe520('0x13')]);router[_0xe520('0x6')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xe520('0x6')](_0xe520('0x14'),auth[_0xe520('0x8')](),controller['getMessages']);router[_0xe520('0x6')](_0xe520('0x15'),auth[_0xe520('0x8')](),controller[_0xe520('0x16')]);router[_0xe520('0x6')](_0xe520('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe520('0x18')](_0xe520('0x19'),auth['isAuthenticated'](),controller[_0xe520('0x1a')]);router[_0xe520('0x18')](_0xe520('0xc'),auth[_0xe520('0x8')](),controller['addAnswer']);router[_0xe520('0x18')]('/',auth['isAuthenticated'](),controller[_0xe520('0x1b')]);router[_0xe520('0x18')](_0xe520('0xe'),auth['isAuthenticated'](),controller[_0xe520('0x1c')]);router[_0xe520('0x18')](_0xe520('0x10'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xe520('0x18')](_0xe520('0x12'),auth[_0xe520('0x8')](),controller[_0xe520('0x1d')]);router[_0xe520('0x18')](_0xe520('0x1e'),auth[_0xe520('0x8')](),controller[_0xe520('0x1f')]);router['post'](_0xe520('0x20'),auth[_0xe520('0x8')](),controller[_0xe520('0x21')]);router[_0xe520('0x18')](_0xe520('0x17'),auth[_0xe520('0x8')](),controller[_0xe520('0x22')]);router[_0xe520('0x23')](_0xe520('0xa'),auth[_0xe520('0x8')](),controller['update']);router[_0xe520('0x24')](_0xe520('0x19'),auth[_0xe520('0x8')](),controller[_0xe520('0x25')]);router['delete'](_0xe520('0xc'),auth[_0xe520('0x8')](),controller[_0xe520('0x26')]);router[_0xe520('0x24')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete'](_0xe520('0x10'),auth['isAuthenticated'](),controller[_0xe520('0x27')]);router[_0xe520('0x24')](_0xe520('0xa'),auth[_0xe520('0x8')](),controller[_0xe520('0x28')]);router['delete'](_0xe520('0x17'),auth[_0xe520('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1d61=['/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addImap','addSmtp','addApplications','addAgents','put','update','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','verifySmtp'];(function(_0x34e791,_0x32aefd){var _0x4894e6=function(_0x856152){while(--_0x856152){_0x34e791['push'](_0x34e791['shift']());}};_0x4894e6(++_0x32aefd);}(_0x1d61,0x170));var _0x11d6=function(_0x2ab0ac,_0x83ca27){_0x2ab0ac=_0x2ab0ac-0x0;var _0x5ee462=_0x1d61[_0x2ab0ac];return _0x5ee462;};'use strict';var multer=require(_0x11d6('0x0'));var util=require(_0x11d6('0x1'));var path=require('path');var timeout=require(_0x11d6('0x2'));var express=require(_0x11d6('0x3'));var router=express[_0x11d6('0x4')]();var fs_extra=require(_0x11d6('0x5'));var auth=require(_0x11d6('0x6'));var interaction=require(_0x11d6('0x7'));var config=require(_0x11d6('0x8'));var controller=require(_0x11d6('0x9'));router[_0x11d6('0xa')]('/',auth[_0x11d6('0xb')](),controller[_0x11d6('0xc')]);router[_0x11d6('0xa')](_0x11d6('0xd'),auth[_0x11d6('0xb')](),controller['describe']);router['get'](_0x11d6('0xe'),auth['isAuthenticated'](),controller[_0x11d6('0xf')]);router[_0x11d6('0xa')]('/:id/dispositions',auth[_0x11d6('0xb')](),controller[_0x11d6('0x10')]);router[_0x11d6('0xa')](_0x11d6('0x11'),auth['isAuthenticated'](),controller[_0x11d6('0x12')]);router['get'](_0x11d6('0x13'),auth[_0x11d6('0xb')](),controller[_0x11d6('0x14')]);router[_0x11d6('0xa')](_0x11d6('0x15'),auth['isAuthenticated'](),controller[_0x11d6('0x16')]);router['get'](_0x11d6('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x11d6('0xa')](_0x11d6('0x18'),auth[_0x11d6('0xb')](),controller[_0x11d6('0x19')]);router[_0x11d6('0xa')]('/:id/messages',auth[_0x11d6('0xb')](),controller[_0x11d6('0x1a')]);router['get']('/:id/verify',auth[_0x11d6('0xb')](),controller[_0x11d6('0x1b')]);router[_0x11d6('0xa')](_0x11d6('0x1c'),auth['isAuthenticated'](),controller[_0x11d6('0x1d')]);router[_0x11d6('0x1e')](_0x11d6('0x1f'),auth[_0x11d6('0xb')](),controller[_0x11d6('0x20')]);router[_0x11d6('0x1e')](_0x11d6('0x11'),auth[_0x11d6('0xb')](),controller[_0x11d6('0x21')]);router['post']('/',auth[_0x11d6('0xb')](),controller['create']);router[_0x11d6('0x1e')](_0x11d6('0x13'),auth['isAuthenticated'](),controller[_0x11d6('0x22')]);router['post'](_0x11d6('0x15'),auth['isAuthenticated'](),controller[_0x11d6('0x23')]);router['post'](_0x11d6('0x17'),auth[_0x11d6('0xb')](),controller['addInteraction']);router[_0x11d6('0x1e')]('/:id/applications',auth['isAuthenticated'](),controller[_0x11d6('0x24')]);router['post']('/:id/send',auth[_0x11d6('0xb')](),controller['send']);router['post']('/:id/users',auth[_0x11d6('0xb')](),controller[_0x11d6('0x25')]);router[_0x11d6('0x26')](_0x11d6('0xe'),auth[_0x11d6('0xb')](),controller[_0x11d6('0x27')]);router[_0x11d6('0x28')](_0x11d6('0x1f'),auth[_0x11d6('0xb')](),controller['removeDispositions']);router[_0x11d6('0x28')]('/:id/canned_answers',auth[_0x11d6('0xb')](),controller[_0x11d6('0x29')]);router[_0x11d6('0x28')](_0x11d6('0x13'),auth[_0x11d6('0xb')](),controller['removeImap']);router[_0x11d6('0x28')](_0x11d6('0x15'),auth[_0x11d6('0xb')](),controller['removeSmtp']);router[_0x11d6('0x28')](_0x11d6('0xe'),auth[_0x11d6('0xb')](),controller['destroy']);router[_0x11d6('0x28')](_0x11d6('0x1c'),auth['isAuthenticated'](),controller[_0x11d6('0x2a')]);module[_0x11d6('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bc4a11d..1cd018b 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 _0x25f8=['Arial,Helvetica,sans-serif','UNSIGNED','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','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN'];(function(_0x261d1b,_0x10174c){var _0x1132c1=function(_0x5bf198){while(--_0x5bf198){_0x261d1b['push'](_0x261d1b['shift']());}};_0x1132c1(++_0x10174c);}(_0x25f8,0x141));var _0x825f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x25f8[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x825f('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x825f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x825f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x825f('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x825f('0x1')],'allowNull':![],'defaultValue':_0x825f('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x825f('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x825f('0x5');}},'notificationSound':{'type':Sequelize[_0x825f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x825f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x825f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x825f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x825f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x825f('0x8'),'set':function(_0xee4fd8){if(!_0xee4fd8)this[_0x825f('0x9')]('mandatoryDispositionPauseId',null);this[_0x825f('0x9')](_0x825f('0xa'),_0xee4fd8);}},'provider':{'type':Sequelize[_0x825f('0xb')]('gmail',_0x825f('0xc'),_0x825f('0xd'),_0x825f('0xe')),'defaultValue':null,'get':function(){if(!this[_0x825f('0xf')](_0x825f('0x10')))return _0x825f('0x11');return this[_0x825f('0xf')]('provider');},'set':function(_0x50464f){if(_0x50464f===_0x825f('0x11'))_0x50464f=null;return this[_0x825f('0x9')](_0x825f('0x10'),_0x50464f);}}}; \ No newline at end of file +var _0x1f34=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x1933c4,_0x1617ad){var _0x1b0340=function(_0x6b0654){while(--_0x6b0654){_0x1933c4['push'](_0x1933c4['shift']());}};_0x1b0340(++_0x1617ad);}(_0x1f34,0x77));var _0x41f3=function(_0x1d596b,_0x38cc58){_0x1d596b=_0x1d596b-0x0;var _0x4c19dc=_0x1f34[_0x1d596b];return _0x4c19dc;};'use strict';var Sequelize=require('sequelize');module[_0x41f3('0x0')]={'description':{'type':Sequelize[_0x41f3('0x1')]},'name':{'type':Sequelize[_0x41f3('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x41f3('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x41f3('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x41f3('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x41f3('0x3')]},'markAsUnread':{'type':Sequelize[_0x41f3('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x41f3('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x41f3('0x4')](0x2)[_0x41f3('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x41f3('0x3')],'defaultValue':function(){return _0x41f3('0x6');}},'notificationSound':{'type':Sequelize[_0x41f3('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x41f3('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x41f3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x41f3('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x41f3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x41f3('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x41f3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x41f3('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x41f3('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x41f3('0x2')],'defaultValue':![],'comment':_0x41f3('0x8'),'set':function(_0x2f5a5a){if(!_0x2f5a5a)this[_0x41f3('0x9')](_0x41f3('0xa'),null);this['setDataValue'](_0x41f3('0xb'),_0x2f5a5a);}},'provider':{'type':Sequelize[_0x41f3('0xc')](_0x41f3('0xd'),'hotmail','yahoo',_0x41f3('0xe')),'defaultValue':null,'get':function(){if(!this[_0x41f3('0xf')](_0x41f3('0x10')))return'custom';return this[_0x41f3('0xf')](_0x41f3('0x10'));},'set':function(_0x1c408f){if(_0x1c408f===_0x41f3('0x11'))_0x1c408f=null;return this[_0x41f3('0x9')]('provider',_0x1c408f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 25eaedb..1036110 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 _0xc737=['List\x20not\x20found','messageId','subject','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','User','getAgents','moment','bluebird','path','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','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.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','Imap','index','MailServerIn','MailServerOut','Smtp','Pause','map','MailAccount','fieldName','type','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','mandatoryDispositionPause','keys','rawAttributes','length','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','params','MailAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','create','getAnswers','removeAnswers','key','ListId','isNil','active','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','MailApplication','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc737,0xd6));var _0x7c73=function(_0x1f4cf9,_0x5048ed){_0x1f4cf9=_0x1f4cf9-0x0;var _0x147f65=_0xc737[_0x1f4cf9];return _0x147f65;};'use strict';var moment=require(_0x7c73('0x0'));var BPromise=require(_0x7c73('0x1'));var util=require('util');var path=require(_0x7c73('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7c73('0x3'))('api');var config=require(_0x7c73('0x4'));var db=require(_0x7c73('0x5'))['db'];config['redis']=_[_0x7c73('0x6')](config[_0x7c73('0x7')],{'host':_0x7c73('0x8'),'port':0x18eb});var socket=require(_0x7c73('0x9'))(new Redis(config[_0x7c73('0x7')]));require(_0x7c73('0xa'))[_0x7c73('0xb')](socket);var jayson=require(_0x7c73('0xc'));var client=jayson[_0x7c73('0xd')][_0x7c73('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x5ba157,_0x45bc7b,_0x15376a,_0x38d3f9){return new BPromise(function(_0x54e771,_0x44ec2a){var _0x198239=_0x38d3f9||client;return _0x198239[_0x7c73('0xf')](_0x5ba157,_0x15376a)[_0x7c73('0x10')](function(_0x2b4da9){logger[_0x7c73('0x11')](_0x7c73('0x12'),_0x45bc7b,_0x7c73('0x13'));logger[_0x7c73('0x14')](_0x7c73('0x15'),_0x45bc7b,_0x7c73('0x13'),JSON[_0x7c73('0x16')](_0x2b4da9));if(_0x2b4da9[_0x7c73('0x17')]){if(_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x18')]===0x1f4){logger[_0x7c73('0x17')](_0x7c73('0x12'),_0x45bc7b,_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x19')]);return _0x44ec2a(_0x2b4da9[_0x7c73('0x17')]['message']);}logger[_0x7c73('0x17')](_0x7c73('0x12'),_0x45bc7b,_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x19')]);return _0x54e771(_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x19')]);}else{logger[_0x7c73('0x11')]('MailAccount,\x20%s,\x20%s',_0x45bc7b,_0x7c73('0x13'));_0x54e771(_0x2b4da9['result'][_0x7c73('0x19')]);}})['catch'](function(_0x321b7d){logger[_0x7c73('0x17')](_0x7c73('0x12'),_0x45bc7b,_0x321b7d);_0x44ec2a(_0x321b7d);});});}function respondWithStatusCode(_0x55cd1a,_0x542f20){_0x542f20=_0x542f20||0xcc;return function(_0x273310){if(_0x273310){return _0x55cd1a[_0x7c73('0x1a')](_0x542f20);}return _0x55cd1a[_0x7c73('0x1b')](_0x542f20)[_0x7c73('0x1c')]();};}function respondWithResult(_0x477f42,_0x818388){_0x818388=_0x818388||0xc8;return function(_0x6a3c36){if(_0x6a3c36){return _0x477f42[_0x7c73('0x1b')](_0x818388)[_0x7c73('0x1d')](_0x6a3c36);}};}function respondWithFilteredResult(_0x34eba2,_0x29996c){return function(_0x3c17bd){if(_0x3c17bd){var _0x57ec4d=typeof _0x29996c['offset']==='undefined'&&typeof _0x29996c['limit']===_0x7c73('0x1e');var _0x2e6c45=_0x3c17bd[_0x7c73('0x1f')];var _0x2b085e=_0x57ec4d?0x0:_0x29996c[_0x7c73('0x20')];var _0x440c10=_0x57ec4d?_0x3c17bd['count']:_0x29996c[_0x7c73('0x20')]+_0x29996c['limit'];var _0x42e238;if(_0x440c10>=_0x2e6c45){_0x440c10=_0x2e6c45;_0x42e238=0xc8;}else{_0x42e238=0xce;}_0x34eba2[_0x7c73('0x1b')](_0x42e238);return _0x34eba2[_0x7c73('0x21')](_0x7c73('0x22'),_0x2b085e+'-'+_0x440c10+'/'+_0x2e6c45)['json'](_0x3c17bd);}return null;};}function saveUpdates(_0x5e37bb){return function(_0x4296c7){if(_0x4296c7){return _0x4296c7[_0x7c73('0x23')](_0x5e37bb)[_0x7c73('0x10')](function(_0x9ecd0){return _0x9ecd0;});}return null;};}function removeEntity(_0x3de707){return function(_0x1db394){if(_0x1db394){return _0x1db394[_0x7c73('0x24')]()['then'](function(){var _0x39077c=_0x1db394['get']({'plain':!![]});var _0x5db1ed=_0x7c73('0x25');return db[_0x7c73('0x26')][_0x7c73('0x24')]({'where':{'type':_0x5db1ed,'resourceId':_0x39077c['id']}})[_0x7c73('0x10')](function(){return _0x1db394;});})[_0x7c73('0x10')](function(){_0x3de707[_0x7c73('0x1b')](0xcc)[_0x7c73('0x1c')]();});}};}function handleEntityNotFound(_0x16b4b8){return function(_0x264fc2){if(!_0x264fc2){_0x16b4b8[_0x7c73('0x1a')](0x194);}return _0x264fc2;};}function handleError(_0xa21300,_0x237923){_0x237923=_0x237923||0x1f4;return function(_0x4d8123){logger[_0x7c73('0x17')](_0x4d8123[_0x7c73('0x27')]);if(_0x4d8123[_0x7c73('0x28')]){delete _0x4d8123['name'];}_0xa21300[_0x7c73('0x1b')](_0x237923)[_0x7c73('0x29')](_0x4d8123);};}function getImapHost(_0x17d997){switch(_0x17d997){case _0x7c73('0x2a'):return _0x7c73('0x2b');case _0x7c73('0x2c'):return _0x7c73('0x2d');case _0x7c73('0x2e'):return _0x7c73('0x2f');case _0x7c73('0x30'):return _0x7c73('0x31');}throw new Error(_0x7c73('0x32'),_0x17d997);}function getSmtpHost(_0x458e1c){switch(_0x458e1c){case _0x7c73('0x2a'):return _0x7c73('0x33');case _0x7c73('0x2c'):return _0x7c73('0x34');case _0x7c73('0x2e'):return'smtp-mail.outlook.com';case _0x7c73('0x30'):return _0x7c73('0x35');}throw new Error(_0x7c73('0x32'),_0x458e1c);}function getAuthenticationOptions(_0x206b78,_0x2231a8){var _0xba3734={};var _0x26da7e={};if(_0x206b78){_0xba3734['user']=_0x26da7e[_0x7c73('0x36')]=_0x2231a8[_0x7c73('0x37')];_0xba3734[_0x7c73('0x38')]=_0x26da7e['pass']=_0x2231a8[_0x7c73('0x38')];if(_0x2231a8[_0x7c73('0x39')]){_0xba3734[_0x7c73('0x39')]=_0x26da7e['modernAuthentication']=!![];_0xba3734[_0x7c73('0x3a')]=_0x26da7e[_0x7c73('0x3a')]=_0x2231a8[_0x7c73('0x3a')];_0xba3734[_0x7c73('0x38')]=_0x26da7e[_0x7c73('0x3b')]=null;}else{_0xba3734[_0x7c73('0x3a')]=_0x26da7e[_0x7c73('0x3a')]=null;}_0xba3734['host']=getImapHost(_0x206b78);_0xba3734[_0x7c73('0x3c')]=0x3e1;_0x26da7e[_0x7c73('0x3d')]=getSmtpHost(_0x206b78);_0x26da7e[_0x7c73('0x3c')]=0x24b;_0x26da7e[_0x7c73('0x3e')]=![];_0xba3734[_0x7c73('0x3f')]=_0x26da7e[_0x7c73('0x3f')]=null;}else{if(_0x2231a8[_0x7c73('0x40')]){_0xba3734[_0x7c73('0x36')]=_0x26da7e[_0x7c73('0x36')]=_0x2231a8[_0x7c73('0x37')];_0xba3734['password']=_0x26da7e[_0x7c73('0x3b')]=_0x2231a8['password'];}else{_0xba3734[_0x7c73('0x40')]=_0x26da7e[_0x7c73('0x40')]=![];_0xba3734[_0x7c73('0x36')]=_0x26da7e[_0x7c73('0x36')]=null;_0xba3734[_0x7c73('0x38')]=_0x26da7e[_0x7c73('0x3b')]=null;}_0xba3734[_0x7c73('0x3d')]=_0x2231a8[_0x7c73('0x41')][_0x7c73('0x3d')];_0xba3734['port']=_0x2231a8[_0x7c73('0x41')][_0x7c73('0x3c')];_0x26da7e[_0x7c73('0x3d')]=_0x2231a8['Smtp'][_0x7c73('0x3d')];_0x26da7e[_0x7c73('0x3c')]=_0x2231a8['Smtp']['port'];}return{'Imap':_0xba3734,'Smtp':_0x26da7e};}exports[_0x7c73('0x42')]=function(_0x558347,_0x127c51){var _0x505ec1={'include':[{'model':db[_0x7c73('0x43')],'as':_0x7c73('0x41')},{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45')},{'model':db[_0x7c73('0x46')],'as':'mandatoryDispositionPause'}]},_0x3c20dd={},_0x121b54={'count':0x0,'rows':[]};var _0x78a6bf=_[_0x7c73('0x47')](db[_0x7c73('0x48')]['rawAttributes'],function(_0x30f97){return{'name':_0x30f97[_0x7c73('0x49')],'type':_0x30f97[_0x7c73('0x4a')]['key']};});_0x3c20dd['model']=_['map'](_0x78a6bf,_0x7c73('0x28'));_0x3c20dd[_0x7c73('0x4b')]=_['keys'](_0x558347[_0x7c73('0x4b')]);_0x3c20dd[_0x7c73('0x4c')]=_['intersection'](_0x3c20dd[_0x7c73('0x4d')],_0x3c20dd[_0x7c73('0x4b')]);_0x505ec1['attributes']=_[_0x7c73('0x4e')](_0x3c20dd[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x558347[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x505ec1['attributes']=_0x505ec1['attributes']['length']?_0x505ec1[_0x7c73('0x50')]:_0x3c20dd[_0x7c73('0x4d')];if(!_0x558347['query'][_0x7c73('0x51')](_0x7c73('0x52'))){_0x505ec1[_0x7c73('0x53')]=qs[_0x7c73('0x53')](_0x558347['query'][_0x7c73('0x53')]);_0x505ec1[_0x7c73('0x20')]=qs[_0x7c73('0x20')](_0x558347[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x505ec1[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x558347['query'][_0x7c73('0x55')]);_0x505ec1[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x558347['query'],_0x3c20dd[_0x7c73('0x4c')]),_0x78a6bf);if(_0x558347[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x505ec1[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x505ec1[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x78a6bf,function(_0x52f0ed){if(_0x52f0ed[_0x7c73('0x4a')]!==_0x7c73('0x5a')){var _0x4f4991={};_0x4f4991[_0x52f0ed[_0x7c73('0x28')]]={'$like':'%'+_0x558347[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x4f4991;}})});}_0x505ec1=_[_0x7c73('0x59')]({},_0x505ec1,_0x558347['options']);var _0x942785={'where':_0x505ec1[_0x7c73('0x56')]};return db[_0x7c73('0x48')][_0x7c73('0x1f')](_0x942785)[_0x7c73('0x10')](function(_0x51d93d){_0x121b54[_0x7c73('0x1f')]=_0x51d93d;if(_0x558347[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x505ec1[_0x7c73('0x5c')]=[{'all':!![]}];}return db[_0x7c73('0x48')][_0x7c73('0x5d')](_0x505ec1);})[_0x7c73('0x10')](function(_0x12b825){_0x121b54['rows']=_0x12b825;return _0x121b54;})[_0x7c73('0x10')](respondWithFilteredResult(_0x127c51,_0x505ec1))[_0x7c73('0x5e')](handleError(_0x127c51,null));};exports[_0x7c73('0x5f')]=function(_0x403490,_0x330f44){var _0xb78b4b={'raw':![],'where':{'id':_0x403490['params']['id']},'include':[{'model':db[_0x7c73('0x43')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7c73('0x46')],'as':_0x7c73('0x60')}]},_0x409929={};_0x409929[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db['MailAccount'][_0x7c73('0x62')]);_0x409929[_0x7c73('0x4b')]=_[_0x7c73('0x61')](_0x403490[_0x7c73('0x4b')]);_0x409929[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x409929[_0x7c73('0x4d')],_0x409929[_0x7c73('0x4b')]);_0xb78b4b['attributes']=_[_0x7c73('0x4e')](_0x409929[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x403490[_0x7c73('0x4b')]['fields']));_0xb78b4b[_0x7c73('0x50')]=_0xb78b4b[_0x7c73('0x50')][_0x7c73('0x63')]?_0xb78b4b[_0x7c73('0x50')]:_0x409929[_0x7c73('0x4d')];if(_0x403490[_0x7c73('0x4b')]['includeAll']){_0xb78b4b[_0x7c73('0x5c')]=[{'all':!![]}];}_0xb78b4b=_[_0x7c73('0x59')]({},_0xb78b4b,_0x403490[_0x7c73('0x64')]);return db[_0x7c73('0x48')][_0x7c73('0x65')](_0xb78b4b)[_0x7c73('0x10')](handleEntityNotFound(_0x330f44,null))[_0x7c73('0x10')](respondWithResult(_0x330f44,null))[_0x7c73('0x5e')](handleError(_0x330f44,null));};exports[_0x7c73('0x23')]=function(_0x5688b7,_0x7b0c85){if(_0x5688b7[_0x7c73('0x66')]['id']){delete _0x5688b7[_0x7c73('0x66')]['id'];}var _0x4b8acf=_0x5688b7['body'][_0x7c73('0x67')]===_0x7c73('0x68')?null:_0x5688b7[_0x7c73('0x66')][_0x7c73('0x67')];var _0x412415=_0x5688b7[_0x7c73('0x66')][_0x7c73('0x41')]||{};var _0x57dadd=_0x5688b7['body'][_0x7c73('0x45')]||{};if(_0x4b8acf){_0x412415[_0x7c73('0x3d')]=getImapHost(_0x4b8acf);_0x412415['port']=0x3e1;_0x57dadd[_0x7c73('0x3d')]=getSmtpHost(_0x4b8acf);_0x57dadd['port']=0x24b;_0x57dadd[_0x7c73('0x3e')]=![];}if(_0x57dadd[_0x7c73('0x39')]){_0x57dadd[_0x7c73('0x3e')]=![];}else{_0x57dadd[_0x7c73('0x3a')]=null;}if(!_0x412415[_0x7c73('0x39')])_0x412415[_0x7c73('0x3a')]=null;_0x5688b7[_0x7c73('0x66')]['Imap']=_0x412415;_0x5688b7[_0x7c73('0x66')]['Smtp']=_0x57dadd;return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x5688b7['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x7c73('0x41')},{'model':db['MailServerOut'],'as':_0x7c73('0x45')},{'model':db['Pause'],'as':_0x7c73('0x60')}]})[_0x7c73('0x10')](handleEntityNotFound(_0x7b0c85,null))[_0x7c73('0x10')](function(_0x7b07b4){if(!_0x7b07b4)throw new Error(_0x7c73('0x69'));if(_0x7b07b4[_0x7c73('0x3f')])delete _0x5688b7[_0x7c73('0x66')][_0x7c73('0x41')];return _0x7b07b4;})['then'](saveUpdates(_0x5688b7[_0x7c73('0x66')],null))[_0x7c73('0x10')](function(_0x58ba17){if(!_0x5688b7['body'][_0x7c73('0x41')])return _0x58ba17;return db['MailServerIn'][_0x7c73('0x23')](_0x5688b7['body']['Imap'],{'where':{'MailAccountId':_0x58ba17['id']}})[_0x7c73('0x10')](function(){return _0x58ba17;});})[_0x7c73('0x10')](function(_0x37bc51){if(!_0x5688b7['body'][_0x7c73('0x45')])return _0x37bc51;return db[_0x7c73('0x44')]['update'](_0x5688b7[_0x7c73('0x66')]['Smtp'],{'where':{'MailAccountId':_0x37bc51['id']}})['then'](function(){return _0x37bc51;});})[_0x7c73('0x10')](respondWithResult(_0x7b0c85,null))[_0x7c73('0x5e')](handleError(_0x7b0c85,null));};exports[_0x7c73('0x6a')]=function(_0x102e0c,_0x18899a){return db[_0x7c73('0x48')][_0x7c73('0x6a')]()[_0x7c73('0x10')](respondWithResult(_0x18899a,null))[_0x7c73('0x5e')](handleError(_0x18899a,null));};exports['addDisposition']=function(_0x51a64f,_0x4c76f9){if(_0x51a64f[_0x7c73('0x66')]['id']){delete _0x51a64f[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x51a64f[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4c76f9,null))[_0x7c73('0x10')](function(_0x9d0a1b){if(_0x9d0a1b){_0x51a64f['body'][_0x7c73('0x6c')]=_0x9d0a1b['id'];return db[_0x7c73('0x6d')]['create'](_0x51a64f[_0x7c73('0x66')]);}})[_0x7c73('0x10')](respondWithResult(_0x4c76f9,null))['catch'](handleError(_0x4c76f9,null));};exports[_0x7c73('0x6e')]=function(_0x1b7665,_0x4f017c){var _0x11cad1={'raw':![],'where':{}};var _0x53dc78={};var _0x3b8bdf={'count':0x0,'rows':[]};return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x1b7665[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4f017c,null))[_0x7c73('0x10')](function(_0x413ea2){if(_0x413ea2){_0x53dc78[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db[_0x7c73('0x6d')][_0x7c73('0x62')]);_0x53dc78[_0x7c73('0x4b')]=_[_0x7c73('0x61')](_0x1b7665[_0x7c73('0x4b')]);_0x53dc78[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x53dc78[_0x7c73('0x4d')],_0x53dc78[_0x7c73('0x4b')]);_0x11cad1[_0x7c73('0x50')]=_['intersection'](_0x53dc78[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x1b7665[_0x7c73('0x4b')]['fields']));_0x11cad1[_0x7c73('0x50')]=_0x11cad1['attributes']['length']?_0x11cad1[_0x7c73('0x50')]:_0x53dc78[_0x7c73('0x4d')];if(!_0x1b7665['query'][_0x7c73('0x51')](_0x7c73('0x52'))){_0x11cad1[_0x7c73('0x53')]=qs[_0x7c73('0x53')](_0x1b7665['query'][_0x7c73('0x53')]);_0x11cad1['offset']=qs['offset'](_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x11cad1[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x11cad1[_0x7c73('0x56')]=qs['filters'](_[_0x7c73('0x57')](_0x1b7665['query'],_0x53dc78[_0x7c73('0x4c')]));_0x11cad1[_0x7c73('0x56')]['MailAccountId']=_0x413ea2['id'];if(_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x11cad1[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x11cad1[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x11cad1[_0x7c73('0x50')],function(_0x2dd900){var _0x511431={};_0x511431[_0x2dd900]={'$like':'%'+_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x511431;})});}_0x11cad1=_[_0x7c73('0x59')]({},_0x11cad1,_0x1b7665['options']);return db['Disposition'][_0x7c73('0x1f')]({'where':_0x11cad1[_0x7c73('0x56')]})['then'](function(_0x8516e7){_0x3b8bdf[_0x7c73('0x1f')]=_0x8516e7;if(_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x11cad1['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x11cad1);})[_0x7c73('0x10')](function(_0x51f531){_0x3b8bdf[_0x7c73('0x70')]=_0x51f531;return _0x3b8bdf;});}})[_0x7c73('0x10')](respondWithFilteredResult(_0x4f017c,_0x11cad1))[_0x7c73('0x5e')](handleError(_0x4f017c,null));};exports['removeDispositions']=function(_0x56b92b,_0x5b78e3){return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x56b92b[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x5b78e3,null))[_0x7c73('0x10')](function(_0x11e832){if(_0x11e832){return _0x11e832[_0x7c73('0x71')](_0x56b92b[_0x7c73('0x4b')][_0x7c73('0x72')]);}})[_0x7c73('0x10')](respondWithStatusCode(_0x5b78e3,null))[_0x7c73('0x5e')](handleError(_0x5b78e3,null));};exports['addAnswer']=function(_0x4054ee,_0x25403d){if(_0x4054ee['body']['id']){delete _0x4054ee[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x4054ee['params']['id']}})['then'](handleEntityNotFound(_0x25403d,null))[_0x7c73('0x10')](function(_0x58bc86){if(_0x58bc86){_0x4054ee['body']['MailAccountId']=_0x58bc86['id'];return db[_0x7c73('0x73')][_0x7c73('0x74')](_0x4054ee['body']);}})[_0x7c73('0x10')](respondWithResult(_0x25403d,null))['catch'](handleError(_0x25403d,null));};exports[_0x7c73('0x75')]=function(_0x3dabba,_0x59cfa3){var _0x2f4332={'raw':![],'where':{}};var _0x56b6e7={};var _0x365c1b={'count':0x0,'rows':[]};return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x3dabba[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0x59cfa3,null))[_0x7c73('0x10')](function(_0x3b93d4){if(_0x3b93d4){_0x56b6e7[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db[_0x7c73('0x73')][_0x7c73('0x62')]);_0x56b6e7[_0x7c73('0x4b')]=_['keys'](_0x3dabba[_0x7c73('0x4b')]);_0x56b6e7[_0x7c73('0x4c')]=_['intersection'](_0x56b6e7[_0x7c73('0x4d')],_0x56b6e7[_0x7c73('0x4b')]);_0x2f4332[_0x7c73('0x50')]=_[_0x7c73('0x4e')](_0x56b6e7[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x3dabba[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x2f4332[_0x7c73('0x50')]=_0x2f4332['attributes']['length']?_0x2f4332[_0x7c73('0x50')]:_0x56b6e7[_0x7c73('0x4d')];if(!_0x3dabba['query']['hasOwnProperty'](_0x7c73('0x52'))){_0x2f4332['limit']=qs['limit'](_0x3dabba['query'][_0x7c73('0x53')]);_0x2f4332['offset']=qs['offset'](_0x3dabba[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x2f4332[_0x7c73('0x54')]=qs['sort'](_0x3dabba[_0x7c73('0x4b')]['sort']);_0x2f4332[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x3dabba[_0x7c73('0x4b')],_0x56b6e7['filters']));_0x2f4332[_0x7c73('0x56')][_0x7c73('0x6c')]=_0x3b93d4['id'];if(_0x3dabba[_0x7c73('0x4b')]['filter']){_0x2f4332['where']=_[_0x7c73('0x59')](_0x2f4332[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x2f4332[_0x7c73('0x50')],function(_0x2536df){var _0x40d9f0={};_0x40d9f0[_0x2536df]={'$like':'%'+_0x3dabba['query']['filter']+'%'};return _0x40d9f0;})});}_0x2f4332=_[_0x7c73('0x59')]({},_0x2f4332,_0x3dabba['options']);return db[_0x7c73('0x73')][_0x7c73('0x1f')]({'where':_0x2f4332['where']})[_0x7c73('0x10')](function(_0x5eace5){_0x365c1b[_0x7c73('0x1f')]=_0x5eace5;if(_0x3dabba[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x2f4332[_0x7c73('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7c73('0x5d')](_0x2f4332);})[_0x7c73('0x10')](function(_0x3244d6){_0x365c1b[_0x7c73('0x70')]=_0x3244d6;return _0x365c1b;});}})['then'](respondWithFilteredResult(_0x59cfa3,_0x2f4332))['catch'](handleError(_0x59cfa3,null));};exports[_0x7c73('0x76')]=function(_0x4aa539,_0x365148){return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x4aa539[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x365148,null))[_0x7c73('0x10')](function(_0x5a4838){if(_0x5a4838){return _0x5a4838[_0x7c73('0x76')](_0x4aa539['query'][_0x7c73('0x72')]);}})[_0x7c73('0x10')](respondWithStatusCode(_0x365148,null))[_0x7c73('0x5e')](handleError(_0x365148,null));};exports[_0x7c73('0x74')]=function(_0x358f13,_0x17244d){var _0x5867bf={'name':_0x358f13[_0x7c73('0x66')][_0x7c73('0x28')],'key':_0x358f13[_0x7c73('0x66')][_0x7c73('0x77')],'provider':_0x358f13[_0x7c73('0x66')]['provider']==='custom'?null:_0x358f13[_0x7c73('0x66')]['provider'],'email':_0x358f13[_0x7c73('0x66')]['email'],'ListId':_0x358f13[_0x7c73('0x66')][_0x7c73('0x78')],'active':!_[_0x7c73('0x79')](_0x358f13[_0x7c73('0x66')][_0x7c73('0x7a')])?_0x358f13[_0x7c73('0x66')][_0x7c73('0x7a')]:!![],'description':_0x358f13[_0x7c73('0x66')]['description']||null};var _0x335497=getAuthenticationOptions(_0x5867bf['provider'],_0x358f13['body']);_0x5867bf['Imap']=_0x335497[_0x7c73('0x41')];_0x5867bf[_0x7c73('0x45')]=_0x335497[_0x7c73('0x45')];return db[_0x7c73('0x48')][_0x7c73('0x74')](_0x5867bf,{'include':[{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45')},{'model':db['MailServerIn'],'as':'Imap'}]})['then'](function(_0x133f0a){var _0x42febc=_0x358f13['user'][_0x7c73('0x7b')]({'plain':!![]});if(!_0x42febc)throw new Error(_0x7c73('0x7c'));if(_0x42febc[_0x7c73('0x7d')]==='user'){var _0x4ce750=_0x133f0a[_0x7c73('0x7b')]({'plain':!![]});return db[_0x7c73('0x7e')][_0x7c73('0x65')]({'where':{'name':_0x7c73('0x25'),'userProfileId':_0x42febc[_0x7c73('0x7f')]},'raw':!![]})['then'](function(_0x1e7744){if(_0x1e7744&&_0x1e7744[_0x7c73('0x80')]===0x0){return db[_0x7c73('0x26')][_0x7c73('0x74')]({'name':_0x4ce750[_0x7c73('0x28')],'resourceId':_0x4ce750['id'],'type':_0x1e7744[_0x7c73('0x28')],'sectionId':_0x1e7744['id']},{})[_0x7c73('0x10')](function(){return _0x133f0a;});}else{return _0x133f0a;}})[_0x7c73('0x5e')](function(_0x2a0008){logger[_0x7c73('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a0008);throw _0x2a0008;});}return _0x133f0a;})[_0x7c73('0x10')](respondWithResult(_0x17244d,0xc9))[_0x7c73('0x5e')](handleError(_0x17244d,null));};exports[_0x7c73('0x81')]=function(_0x18c297,_0x48a22f){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x18c297[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0x48a22f,null))[_0x7c73('0x10')](function(_0x4a7e51){if(_0x4a7e51){return _0x4a7e51[_0x7c73('0x81')]();}return null;})['then'](respondWithResult(_0x48a22f,null))[_0x7c73('0x5e')](handleError(_0x48a22f,null));};exports[_0x7c73('0x82')]=function(_0x490127,_0x379d7e){if(_0x490127[_0x7c73('0x66')]['id']){delete _0x490127[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x490127['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x379d7e,null))[_0x7c73('0x10')](function(_0x22566e){if(_0x22566e){_0x490127['body'][_0x7c73('0x6c')]=_0x22566e['id'];return db['MailServerIn'][_0x7c73('0x74')](_0x490127[_0x7c73('0x66')]);}})['then'](respondWithResult(_0x379d7e,null))[_0x7c73('0x5e')](handleError(_0x379d7e,null));};exports[_0x7c73('0x83')]=function(_0x3c2e97,_0x4001de){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x3c2e97[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4001de,null))[_0x7c73('0x10')](function(_0x291d2){if(_0x291d2){return _0x291d2[_0x7c73('0x84')](null);}return null;})[_0x7c73('0x10')](respondWithStatusCode(_0x4001de,null))[_0x7c73('0x5e')](handleError(_0x4001de,null));};exports[_0x7c73('0x85')]=function(_0x49d454,_0x46eeeb){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x49d454['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x46eeeb,null))[_0x7c73('0x10')](function(_0x3ade81){if(_0x3ade81){return _0x3ade81[_0x7c73('0x85')]();}return null;})['then'](respondWithResult(_0x46eeeb,null))[_0x7c73('0x5e')](handleError(_0x46eeeb,null));};exports['addSmtp']=function(_0x171e4b,_0x2414f3){if(_0x171e4b[_0x7c73('0x66')]['id']){delete _0x171e4b[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x171e4b[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0x2414f3,null))['then'](function(_0x3f4a20){if(_0x3f4a20){_0x171e4b['body'][_0x7c73('0x6c')]=_0x3f4a20['id'];return db[_0x7c73('0x44')]['create'](_0x171e4b[_0x7c73('0x66')]);}})['then'](respondWithResult(_0x2414f3,null))[_0x7c73('0x5e')](handleError(_0x2414f3,null));};exports[_0x7c73('0x86')]=function(_0x76cc74,_0x26e48c){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x76cc74[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x26e48c,null))[_0x7c73('0x10')](function(_0x3e9886){if(_0x3e9886){return _0x3e9886[_0x7c73('0x87')](null);}return null;})[_0x7c73('0x10')](respondWithStatusCode(_0x26e48c,null))[_0x7c73('0x5e')](handleError(_0x26e48c,null));};exports[_0x7c73('0x88')]=function(_0x213a05,_0x40a370){return db[_0x7c73('0x89')][_0x7c73('0x65')]({'where':{'id':_0x213a05['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x40a370,null))[_0x7c73('0x10')](function(_0x83f28e){if(_0x83f28e){return _0x83f28e[_0x7c73('0x88')](_0x213a05[_0x7c73('0x66')]['ids'],_['omit'](_0x213a05['body'],[_0x7c73('0x72'),'id'])||{});}})[_0x7c73('0x10')](respondWithResult(_0x40a370,null))['catch'](handleError(_0x40a370,null));};exports[_0x7c73('0x8a')]=function(_0x19a735,_0xf15e30){var _0x416475={'raw':![],'where':{}};var _0x281007={};var _0x3a955c={'count':0x0,'rows':[]};return db['MailAccount'][_0x7c73('0x6f')]({'where':{'id':_0x19a735[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0xf15e30,null))['then'](function(_0x47db26){if(_0x47db26){_0x281007['model']=_['keys'](db[_0x7c73('0x89')]['rawAttributes']);_0x281007['query']=_[_0x7c73('0x61')](_0x19a735[_0x7c73('0x4b')]);_0x281007[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x281007[_0x7c73('0x4d')],_0x281007[_0x7c73('0x4b')]);_0x416475[_0x7c73('0x50')]=_[_0x7c73('0x4e')](_0x281007[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x19a735['query'][_0x7c73('0x4f')]));_0x416475[_0x7c73('0x50')]=_0x416475[_0x7c73('0x50')][_0x7c73('0x63')]?_0x416475[_0x7c73('0x50')]:_0x281007[_0x7c73('0x4d')];if(!_0x19a735['query'][_0x7c73('0x51')]('nolimit')){_0x416475[_0x7c73('0x53')]=qs[_0x7c73('0x53')](_0x19a735[_0x7c73('0x4b')][_0x7c73('0x53')]);_0x416475['offset']=qs[_0x7c73('0x20')](_0x19a735[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x416475[_0x7c73('0x54')]=qs['sort'](_0x19a735[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x416475[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x19a735[_0x7c73('0x4b')],_0x281007[_0x7c73('0x4c')]));_0x416475['where'][_0x7c73('0x6c')]=_0x47db26['id'];if(_0x19a735['query'][_0x7c73('0x58')]){_0x416475[_0x7c73('0x56')]=_['merge'](_0x416475['where'],{'$or':_[_0x7c73('0x47')](_0x416475['attributes'],function(_0x28a95f){var _0x2482e4={};_0x2482e4[_0x28a95f]={'$like':'%'+_0x19a735[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x2482e4;})});}_0x416475=_['merge']({},_0x416475,_0x19a735[_0x7c73('0x64')]);return db['MailInteraction'][_0x7c73('0x1f')]({'where':_0x416475[_0x7c73('0x56')]})[_0x7c73('0x10')](function(_0x4c7e39){_0x3a955c[_0x7c73('0x1f')]=_0x4c7e39;if(_0x19a735[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x416475[_0x7c73('0x5c')]=[{'model':db[_0x7c73('0x8b')],'as':_0x7c73('0x8c'),'required':![]},{'model':db['User'],'as':_0x7c73('0x8d'),'attributes':[_0x7c73('0x28'),_0x7c73('0x8e'),_0x7c73('0x8f')],'required':![]},{'model':db[_0x7c73('0x90')],'as':'Tags','attributes':['id',_0x7c73('0x28'),_0x7c73('0x91')],'where':_0x19a735['query'][_0x7c73('0x92')]?{'id':_0x19a735[_0x7c73('0x4b')]['tag']}:undefined,'required':_0x19a735[_0x7c73('0x4b')]['tag']?!![]:![]}];}return db[_0x7c73('0x89')]['findAll'](_0x416475);})['then'](function(_0x490e79){_0x3a955c['rows']=_0x490e79;return _0x3a955c;});}})[_0x7c73('0x10')](respondWithFilteredResult(_0xf15e30,_0x416475))[_0x7c73('0x5e')](handleError(_0xf15e30,null));};exports[_0x7c73('0x93')]=function addApplications(_0x5c6207,_0x111663){var _0x4dd850=_0x5c6207[_0x7c73('0x6b')]['id'];var _0x34e001=_0x5c6207[_0x7c73('0x66')];var _0x1933e0=0xc8;var _0x400677=null;return db[_0x7c73('0x94')][_0x7c73('0x95')]({'isolationLevel':db[_0x7c73('0x94')][_0x7c73('0x96')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x52e515){return db['MailAccount'][_0x7c73('0x6f')]({'where':{'id':_0x4dd850},'transaction':_0x52e515})[_0x7c73('0x10')](function(_0xc489){if(_0xc489){return db[_0x7c73('0x97')][_0x7c73('0x24')]({'where':{'MailAccountId':_0x4dd850},'transaction':_0x52e515})[_0x7c73('0x10')](function(){var _0x5bdc95=_['map'](_0x34e001,function(_0x1ae3cb){_0x1ae3cb['MailAccountId']=_0x4dd850;return _0x1ae3cb;});return db['MailApplication']['bulkCreate'](_0x5bdc95,{'transaction':_0x52e515});});}else{_0x1933e0=0x194;_0x400677=[];}});})[_0x7c73('0x10')](function(){if(_0x1933e0!==0x194){return db[_0x7c73('0x97')][_0x7c73('0x98')]({'where':{'MailAccountId':_0x4dd850},'order':'priority'})['then'](function(_0x4c5926){_0x400677=_0x4c5926;});}})[_0x7c73('0x5e')](function(_0x5a1eae){_0x1933e0=0x1f4;logger[_0x7c73('0x17')](_0x5a1eae[_0x7c73('0x27')]);if(_0x5a1eae[_0x7c73('0x28')]){delete _0x5a1eae[_0x7c73('0x28')];}_0x400677=_0x5a1eae;})[_0x7c73('0x99')](function(){if(_0x400677===null){_0x111663['sendStatus'](_0x1933e0);}else{if(_0x1933e0===0x1f4){_0x111663[_0x7c73('0x1b')](_0x1933e0)['send'](_0x400677);}else{_0x111663[_0x7c73('0x1b')](_0x1933e0)[_0x7c73('0x1d')](_0x400677);}}});};exports[_0x7c73('0x9a')]=function(_0x315396,_0x4ad897){var _0x2d442e={};var _0x260fbc={};var _0x3fb609;var _0x5ed787;return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x315396['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4ad897,null))[_0x7c73('0x10')](function(_0x1532e0){if(_0x1532e0){_0x3fb609=_0x1532e0;_0x260fbc[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db[_0x7c73('0x97')][_0x7c73('0x62')]);_0x260fbc['query']=_[_0x7c73('0x61')](_0x315396[_0x7c73('0x4b')]);_0x260fbc[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x260fbc[_0x7c73('0x4d')],_0x260fbc['query']);_0x2d442e['attributes']=_[_0x7c73('0x4e')](_0x260fbc[_0x7c73('0x4d')],qs['fields'](_0x315396[_0x7c73('0x4b')]['fields']));_0x2d442e['attributes']=_0x2d442e[_0x7c73('0x50')][_0x7c73('0x63')]?_0x2d442e[_0x7c73('0x50')]:_0x260fbc[_0x7c73('0x4d')];_0x2d442e[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x315396[_0x7c73('0x4b')]['sort']);_0x2d442e[_0x7c73('0x56')]=qs['filters'](_['pick'](_0x315396[_0x7c73('0x4b')],_0x260fbc[_0x7c73('0x4c')]));if(_0x315396['query'][_0x7c73('0x58')]){_0x2d442e[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x2d442e['where'],{'$or':_['map'](_0x2d442e['attributes'],function(_0x1b5c23){var _0x436679={};_0x436679[_0x1b5c23]={'$like':'%'+_0x315396[_0x7c73('0x4b')]['filter']+'%'};return _0x436679;})});}_0x2d442e=_[_0x7c73('0x59')]({},_0x2d442e,_0x315396['options']);return _0x3fb609[_0x7c73('0x9a')](_0x2d442e);}})[_0x7c73('0x10')](function(_0x202737){if(_0x202737){_0x5ed787=_0x202737[_0x7c73('0x63')];if(!_0x315396[_0x7c73('0x4b')][_0x7c73('0x51')](_0x7c73('0x52'))){_0x2d442e[_0x7c73('0x53')]=qs['limit'](_0x315396['query'][_0x7c73('0x53')]);_0x2d442e[_0x7c73('0x20')]=qs[_0x7c73('0x20')](_0x315396[_0x7c73('0x4b')][_0x7c73('0x20')]);}return _0x3fb609[_0x7c73('0x9a')](_0x2d442e);}})[_0x7c73('0x10')](function(_0x484bc6){if(_0x484bc6){return _0x484bc6?{'count':_0x5ed787,'rows':_0x484bc6}:null;}})['then'](respondWithResult(_0x4ad897,null))[_0x7c73('0x5e')](handleError(_0x4ad897,null));};exports[_0x7c73('0x9b')]=function(_0x5e7bba,_0x243cb4){var _0x4b0551={'raw':!![],'where':{}};var _0x69dac2={};var _0x54748e={'count':0x0,'rows':[]};return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x5e7bba[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x243cb4,null))['then'](function(_0x33c69f){if(_0x33c69f){_0x69dac2[_0x7c73('0x4d')]=_['keys'](db['MailMessage']['rawAttributes']);_0x69dac2[_0x7c73('0x4b')]=_[_0x7c73('0x61')](_0x5e7bba[_0x7c73('0x4b')]);_0x69dac2[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x69dac2['model'],_0x69dac2[_0x7c73('0x4b')]);_0x4b0551[_0x7c73('0x50')]=_['intersection'](_0x69dac2[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x4b0551[_0x7c73('0x50')]=_0x4b0551[_0x7c73('0x50')]['length']?_0x4b0551[_0x7c73('0x50')]:_0x69dac2[_0x7c73('0x4d')];if(!_0x5e7bba['query'][_0x7c73('0x51')](_0x7c73('0x52'))){_0x4b0551[_0x7c73('0x53')]=qs['limit'](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x53')]);_0x4b0551[_0x7c73('0x20')]=qs[_0x7c73('0x20')](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x4b0551[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x4b0551[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x5e7bba[_0x7c73('0x4b')],_0x69dac2[_0x7c73('0x4c')]));_0x4b0551['where'][_0x7c73('0x6c')]=_0x33c69f['id'];if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x4b0551[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x4b0551[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x4b0551[_0x7c73('0x50')],function(_0x29525b){var _0x23a179={};_0x23a179[_0x29525b]={'$like':'%'+_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x23a179;})});}if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x9c')]){var _0x32bd10=_0x5e7bba['query'][_0x7c73('0x9c')][_0x7c73('0x9d')](',');var _0x20065c={};_0x20065c[_0x32bd10[0x0]]={'$gte':moment(_0x32bd10[0x1])[_0x7c73('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4b0551[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x4b0551['where'],_0x20065c);}_0x4b0551=_[_0x7c73('0x59')]({},_0x4b0551,_0x5e7bba['options']);return db[_0x7c73('0x9f')][_0x7c73('0x1f')]({'where':_0x4b0551[_0x7c73('0x56')]})[_0x7c73('0x10')](function(_0x36949c){_0x54748e[_0x7c73('0x1f')]=_0x36949c;if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x4b0551[_0x7c73('0x5c')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4b0551);})[_0x7c73('0x10')](function(_0x57df11){if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0xa0')]===_0x7c73('0xa1')){for(var _0x1db3f9=0x0;_0x1db3f9<_0x57df11[_0x7c73('0x63')];_0x1db3f9++){_0x57df11[_0x1db3f9][_0x7c73('0x66')]=juice(_0x57df11[_0x1db3f9][_0x7c73('0x66')]);}}_0x54748e['rows']=_0x57df11;return _0x54748e;});}})[_0x7c73('0x10')](respondWithFilteredResult(_0x243cb4,_0x4b0551))['catch'](handleError(_0x243cb4,null));};exports[_0x7c73('0x29')]=function(_0x3b5f95,_0x26aaf9){var _0x2fd537,_0x4b25c8={},_0x51188c;if(_0x3b5f95[_0x7c73('0x66')]['to']){_0x51188c=_0x3b5f95[_0x7c73('0x66')]['to'][_0x7c73('0x9d')](',')[0x0];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x3b5f95[_0x7c73('0x6b')]['id']},'include':[{'model':db[_0x7c73('0xa2')],'as':_0x7c73('0xa3'),'include':[{'model':db['CmContact'],'as':_0x7c73('0xa4'),'where':{'email':_0x51188c},'limit':0x1,'order':[[_0x7c73('0xa5'),_0x7c73('0xa6')]]}]},{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45'),'raw':!![],'include':[{'model':db[_0x7c73('0xa7')],'as':_0x7c73('0xa7'),'raw':!![]}]}]})[_0x7c73('0x10')](handleEntityNotFound(_0x26aaf9,null))[_0x7c73('0x10')](function(_0x2f177a){if(!_0x2f177a)return;_0x2fd537=_0x2f177a;if(!_0x2f177a['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x7c73('0x79')](_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xa8')])){_0x3b5f95[_0x7c73('0x66')]['from']=util[_0x7c73('0x9e')](_0x7c73('0xa9'),_0x2f177a[_0x7c73('0x28')],_0x2f177a[_0x7c73('0xaa')]||_0x2f177a[_0x7c73('0x45')]['user']);}if(_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xab')]&&_0x3b5f95['body'][_0x7c73('0xab')][_0x7c73('0x63')]){for(var _0x5b5694=0x0;_0x5b5694<_0x3b5f95['body'][_0x7c73('0xab')][_0x7c73('0x63')];_0x5b5694+=0x1){_0x3b5f95[_0x7c73('0x66')]['attachments'][_0x5b5694]={'filename':_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xab')][_0x5b5694]['name'],'path':path[_0x7c73('0xac')](config[_0x7c73('0xad')],_0x7c73('0xae'),_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xab')][_0x5b5694][_0x7c73('0xaf')])};}}var _0x39f691=_0x2f177a[_0x7c73('0xb0')]();return respondWithRpcPromise(_0x7c73('0xb1'),'sendMail',{'account':_0x39f691,'message':_0x3b5f95['body']});})['then'](function(_0x188196){if(!_0x188196)return;_0x4b25c8=_0x188196;if(!_0x2fd537['List'])throw new Error(_0x7c73('0xb2'));if(_0x2fd537[_0x7c73('0xa3')][_0x7c73('0xa4')][_0x7c73('0x63')])return _0x2fd537[_0x7c73('0xa3')][_0x7c73('0xa4')][0x0];return db['CmContact'][_0x7c73('0x74')](_['defaults'](_0x3b5f95[_0x7c73('0x66')],{'firstName':_0x3b5f95['body']['to'],'email':_0x3b5f95[_0x7c73('0x66')]['to'],'phone':_0x3b5f95[_0x7c73('0x66')]['to'],'ListId':_0x2fd537[_0x7c73('0x78')]}));})[_0x7c73('0x10')](function(_0x51eaa2){if(!_0x51eaa2)return;var _0x95672={'UserId':_0x3b5f95['user']['id'],'ContactId':_0x51eaa2['id'],'MailAccountId':_0x2fd537['id'],'inReplyTo':_0x4b25c8[_0x7c73('0xb3')],'to':_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xa8')],'cc':_0x3b5f95[_0x7c73('0x66')]['cc'],'subject':_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xb4')],'attach':_0x3b5f95['body']['attach'],'firstMsgDirection':_0x7c73('0xb5'),'lastMsgAt':moment()['format'](_0x7c73('0xb6')),'lastMsgDirection':_0x7c73('0xb5'),'Messages':[_[_0x7c73('0x59')](_0x3b5f95[_0x7c73('0x66')],{'messageId':_0x4b25c8[_0x7c73('0xb3')],'sentAt':moment()[_0x7c73('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2fd537['id'],'UserId':_0x3b5f95[_0x7c73('0x36')]['id'],'ContactId':_0x51eaa2['id']})]};if(_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xb7')]){_0x95672=_[_0x7c73('0x59')](_0x95672,_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xb7')]);}return db[_0x7c73('0x89')][_0x7c73('0x74')](_0x95672,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x7c73('0x10')](respondWithResult(_0x26aaf9,null))[_0x7c73('0x5e')](handleError(_0x26aaf9,null));};exports[_0x7c73('0xb8')]=function(_0x27c6ac,_0x4719d4){return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x27c6ac['params']['id']},'include':[{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x7c73('0x10')](handleEntityNotFound(_0x4719d4,null))['then'](function(_0x12375f){if(!_0x12375f[_0x7c73('0x45')])return;var _0x23dd64=_0x12375f[_0x7c73('0xb0')]();return respondWithRpcPromise('VerifySmtp',_0x7c73('0xb8'),{'account':_0x23dd64});})[_0x7c73('0x10')](respondWithResult(_0x4719d4,null))[_0x7c73('0x5e')](handleError(_0x4719d4,null));};exports[_0x7c73('0x24')]=function(_0x15be21,_0xa436a2){return db['MailAccount']['find']({'where':{'id':_0x15be21[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0xa436a2,null))['then'](function(_0x55a47c){if(_0x55a47c&&_0x55a47c['service']){throw new db[(_0x7c73('0xb9'))][(_0x7c73('0xba'))](_0x7c73('0xbb'));}return _0x55a47c;})[_0x7c73('0x10')](removeEntity(_0xa436a2,null))[_0x7c73('0x5e')](handleError(_0xa436a2,null));};exports['addAgents']=function(_0x4578e5,_0x539b61){return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x4578e5[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x539b61,null))[_0x7c73('0x10')](function(_0x3458c4){if(_0x3458c4){return _0x3458c4[_0x7c73('0xbc')](_0x4578e5[_0x7c73('0x66')][_0x7c73('0x72')],_['omit'](_0x4578e5['body'],[_0x7c73('0x72'),'id'])||{})[_0x7c73('0xbd')](function(_0x5c1f40){for(var _0x2a7fa5=0x0;_0x2a7fa5<_0x4578e5[_0x7c73('0x66')][_0x7c73('0x72')]['length'];_0x2a7fa5+=0x1){socket[_0x7c73('0xbe')](_0x7c73('0xbf'),{'UserId':Number(_0x4578e5[_0x7c73('0x66')][_0x7c73('0x72')][_0x2a7fa5]),'MailAccountId':Number(_0x4578e5[_0x7c73('0x6b')]['id'])});}return _0x5c1f40;});}})[_0x7c73('0x10')](respondWithResult(_0x539b61,null))[_0x7c73('0x5e')](handleError(_0x539b61,null));};exports[_0x7c73('0xc0')]=function(_0xb92681,_0x285558){return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0xb92681[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x285558,null))[_0x7c73('0x10')](function(_0x436a74){if(_0x436a74){return _0x436a74['removeAgents'](_0xb92681[_0x7c73('0x4b')][_0x7c73('0x72')])[_0x7c73('0x10')](function(){if(_['isArray'](_0xb92681[_0x7c73('0x4b')]['ids'])){for(var _0x32156a=0x0;_0x32156a<_0xb92681['query']['ids'][_0x7c73('0x63')];_0x32156a+=0x1){socket[_0x7c73('0xbe')]('userMailAccount:remove',{'UserId':Number(_0xb92681[_0x7c73('0x4b')]['ids'][_0x32156a]),'MailAccountId':Number(_0xb92681[_0x7c73('0x6b')]['id'])});}}else{socket['emit'](_0x7c73('0xc1'),{'UserId':Number(_0xb92681[_0x7c73('0x4b')][_0x7c73('0x72')]),'MailAccountId':Number(_0xb92681[_0x7c73('0x6b')]['id'])});}});}})[_0x7c73('0x10')](respondWithStatusCode(_0x285558,null))['catch'](handleError(_0x285558,null));};exports['getAgents']=function(_0x45c190,_0x3929b7){var _0x4c3231={};var _0x3af422={};var _0x21d0d0;var _0x3e5ce4;return db['MailAccount'][_0x7c73('0x6f')]({'where':{'id':_0x45c190[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x3929b7,null))[_0x7c73('0x10')](function(_0x54d70c){if(_0x54d70c){_0x21d0d0=_0x54d70c;_0x3af422['model']=_[_0x7c73('0x61')](db[_0x7c73('0xc2')][_0x7c73('0x62')]);_0x3af422['query']=_[_0x7c73('0x61')](_0x45c190[_0x7c73('0x4b')]);_0x3af422[_0x7c73('0x4c')]=_['intersection'](_0x3af422[_0x7c73('0x4d')],_0x3af422['query']);_0x4c3231['attributes']=_['intersection'](_0x3af422['model'],qs[_0x7c73('0x4f')](_0x45c190[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x4c3231['attributes']=_0x4c3231[_0x7c73('0x50')][_0x7c73('0x63')]?_0x4c3231['attributes']:_0x3af422[_0x7c73('0x4d')];_0x4c3231['order']=qs['sort'](_0x45c190[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x4c3231['where']=qs['filters'](_['pick'](_0x45c190[_0x7c73('0x4b')],_0x3af422[_0x7c73('0x4c')]));if(_0x45c190[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x4c3231['where']=_[_0x7c73('0x59')](_0x4c3231[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x4c3231[_0x7c73('0x50')],function(_0x4c0537){var _0x38a352={};_0x38a352[_0x4c0537]={'$like':'%'+_0x45c190[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x38a352;})});}_0x4c3231=_[_0x7c73('0x59')]({},_0x4c3231,_0x45c190['options']);return _0x21d0d0[_0x7c73('0xc3')](_0x4c3231);}})[_0x7c73('0x10')](function(_0x493807){if(_0x493807){_0x3e5ce4=_0x493807[_0x7c73('0x63')];if(!_0x45c190[_0x7c73('0x4b')][_0x7c73('0x51')](_0x7c73('0x52'))){_0x4c3231['limit']=qs[_0x7c73('0x53')](_0x45c190['query']['limit']);_0x4c3231[_0x7c73('0x20')]=qs['offset'](_0x45c190[_0x7c73('0x4b')]['offset']);}return _0x21d0d0[_0x7c73('0xc3')](_0x4c3231);}})['then'](function(_0x490b87){if(_0x490b87){return _0x490b87?{'count':_0x3e5ce4,'rows':_0x490b87}:null;}})[_0x7c73('0x10')](respondWithResult(_0x3929b7,null))[_0x7c73('0x5e')](handleError(_0x3929b7,null));}; \ No newline at end of file +var _0xfc01=['MailAccountId','ids','addAnswer','CannedAnswer','removeAnswers','email','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','addImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','ioredis','../../components/parsers/qs','api','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','Pause','fields','include','body','provider','custom','find','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','filters','hasOwnProperty','order'];(function(_0x3d897b,_0x1bec5f){var _0x4cad04=function(_0xd4461c){while(--_0xd4461c){_0x3d897b['push'](_0x3d897b['shift']());}};_0x4cad04(++_0x1bec5f);}(_0xfc01,0x110));var _0x1fc0=function(_0xa616d4,_0x27bba9){_0xa616d4=_0xa616d4-0x0;var _0x48c598=_0xfc01[_0xa616d4];return _0x48c598;};'use strict';var moment=require(_0x1fc0('0x0'));var BPromise=require(_0x1fc0('0x1'));var util=require(_0x1fc0('0x2'));var path=require('path');var _=require('lodash');var juice=require('juice');var Redis=require(_0x1fc0('0x3'));var qs=require(_0x1fc0('0x4'));var logger=require('../../config/logger')(_0x1fc0('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1fc0('0x6')]=_[_0x1fc0('0x7')](config[_0x1fc0('0x6')],{'host':_0x1fc0('0x8'),'port':0x18eb});var socket=require(_0x1fc0('0x9'))(new Redis(config[_0x1fc0('0x6')]));require(_0x1fc0('0xa'))[_0x1fc0('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1fc0('0xc')][_0x1fc0('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x413ab6,_0x492617,_0x3775c4,_0x4832bd){return new BPromise(function(_0xe0ddd1,_0x1e307b){var _0x145e28=_0x4832bd||client;return _0x145e28[_0x1fc0('0xe')](_0x413ab6,_0x3775c4)[_0x1fc0('0xf')](function(_0x2f5ea6){logger['info'](_0x1fc0('0x10'),_0x492617,_0x1fc0('0x11'));logger[_0x1fc0('0x12')](_0x1fc0('0x13'),_0x492617,_0x1fc0('0x11'),JSON['stringify'](_0x2f5ea6));if(_0x2f5ea6[_0x1fc0('0x14')]){if(_0x2f5ea6['error'][_0x1fc0('0x15')]===0x1f4){logger[_0x1fc0('0x14')]('MailAccount,\x20%s,\x20%s',_0x492617,_0x2f5ea6[_0x1fc0('0x14')][_0x1fc0('0x16')]);return _0x1e307b(_0x2f5ea6[_0x1fc0('0x14')][_0x1fc0('0x16')]);}logger[_0x1fc0('0x14')](_0x1fc0('0x10'),_0x492617,_0x2f5ea6[_0x1fc0('0x14')]['message']);return _0xe0ddd1(_0x2f5ea6[_0x1fc0('0x14')]['message']);}else{logger[_0x1fc0('0x17')]('MailAccount,\x20%s,\x20%s',_0x492617,_0x1fc0('0x11'));_0xe0ddd1(_0x2f5ea6[_0x1fc0('0x18')][_0x1fc0('0x16')]);}})[_0x1fc0('0x19')](function(_0x5acabd){logger['error'](_0x1fc0('0x10'),_0x492617,_0x5acabd);_0x1e307b(_0x5acabd);});});}function respondWithStatusCode(_0x5e0817,_0x490d87){_0x490d87=_0x490d87||0xcc;return function(_0x8c50f1){if(_0x8c50f1){return _0x5e0817[_0x1fc0('0x1a')](_0x490d87);}return _0x5e0817[_0x1fc0('0x1b')](_0x490d87)[_0x1fc0('0x1c')]();};}function respondWithResult(_0x9418ec,_0x10709d){_0x10709d=_0x10709d||0xc8;return function(_0x2dde93){if(_0x2dde93){return _0x9418ec[_0x1fc0('0x1b')](_0x10709d)[_0x1fc0('0x1d')](_0x2dde93);}};}function respondWithFilteredResult(_0x3ad215,_0x1398bb){return function(_0x4d95){if(_0x4d95){var _0x4774db=typeof _0x1398bb[_0x1fc0('0x1e')]===_0x1fc0('0x1f')&&typeof _0x1398bb[_0x1fc0('0x20')]===_0x1fc0('0x1f');var _0x241e06=_0x4d95[_0x1fc0('0x21')];var _0x2e8822=_0x4774db?0x0:_0x1398bb['offset'];var _0x33f747=_0x4774db?_0x4d95[_0x1fc0('0x21')]:_0x1398bb[_0x1fc0('0x1e')]+_0x1398bb[_0x1fc0('0x20')];var _0x34f0dc;if(_0x33f747>=_0x241e06){_0x33f747=_0x241e06;_0x34f0dc=0xc8;}else{_0x34f0dc=0xce;}_0x3ad215[_0x1fc0('0x1b')](_0x34f0dc);return _0x3ad215[_0x1fc0('0x22')](_0x1fc0('0x23'),_0x2e8822+'-'+_0x33f747+'/'+_0x241e06)['json'](_0x4d95);}return null;};}function saveUpdates(_0x41b70a){return function(_0x2930e0){if(_0x2930e0){return _0x2930e0[_0x1fc0('0x24')](_0x41b70a)[_0x1fc0('0xf')](function(_0x2de178){return _0x2de178;});}return null;};}function removeEntity(_0x2cb1b5){return function(_0x110e26){if(_0x110e26){return _0x110e26[_0x1fc0('0x25')]()['then'](function(){var _0x297748=_0x110e26[_0x1fc0('0x26')]({'plain':!![]});var _0x17c517=_0x1fc0('0x27');return db[_0x1fc0('0x28')][_0x1fc0('0x25')]({'where':{'type':_0x17c517,'resourceId':_0x297748['id']}})[_0x1fc0('0xf')](function(){return _0x110e26;});})['then'](function(){_0x2cb1b5[_0x1fc0('0x1b')](0xcc)[_0x1fc0('0x1c')]();});}};}function handleEntityNotFound(_0x3db23d){return function(_0x3e03f0){if(!_0x3e03f0){_0x3db23d[_0x1fc0('0x1a')](0x194);}return _0x3e03f0;};}function handleError(_0x1da1a5,_0x2d3477){_0x2d3477=_0x2d3477||0x1f4;return function(_0x530d58){logger[_0x1fc0('0x14')](_0x530d58['stack']);if(_0x530d58[_0x1fc0('0x29')]){delete _0x530d58[_0x1fc0('0x29')];}_0x1da1a5[_0x1fc0('0x1b')](_0x2d3477)[_0x1fc0('0x2a')](_0x530d58);};}function getImapHost(_0x3fc950){switch(_0x3fc950){case _0x1fc0('0x2b'):return _0x1fc0('0x2c');case _0x1fc0('0x2d'):return'imap.mail.yahoo.com';case _0x1fc0('0x2e'):return _0x1fc0('0x2f');case _0x1fc0('0x30'):return _0x1fc0('0x31');}throw new Error(_0x1fc0('0x32'),_0x3fc950);}function getSmtpHost(_0x69edc){switch(_0x69edc){case _0x1fc0('0x2b'):return _0x1fc0('0x33');case _0x1fc0('0x2d'):return _0x1fc0('0x34');case'hotmail':return _0x1fc0('0x35');case'outlook365':return'smtp.office365.com';}throw new Error(_0x1fc0('0x32'),_0x69edc);}function getAuthenticationOptions(_0x21c1fb,_0x2abf2b){var _0xa76ba5={};var _0x416314={};if(_0x21c1fb){_0xa76ba5[_0x1fc0('0x36')]=_0x416314['user']=_0x2abf2b[_0x1fc0('0x37')];_0xa76ba5[_0x1fc0('0x38')]=_0x416314[_0x1fc0('0x39')]=_0x2abf2b['password'];if(_0x2abf2b[_0x1fc0('0x3a')]){_0xa76ba5[_0x1fc0('0x3a')]=_0x416314[_0x1fc0('0x3a')]=!![];_0xa76ba5[_0x1fc0('0x3b')]=_0x416314[_0x1fc0('0x3b')]=_0x2abf2b['CloudProviderId'];_0xa76ba5[_0x1fc0('0x38')]=_0x416314[_0x1fc0('0x39')]=null;}else{_0xa76ba5['CloudProviderId']=_0x416314[_0x1fc0('0x3b')]=null;}_0xa76ba5[_0x1fc0('0x3c')]=getImapHost(_0x21c1fb);_0xa76ba5[_0x1fc0('0x3d')]=0x3e1;_0x416314[_0x1fc0('0x3c')]=getSmtpHost(_0x21c1fb);_0x416314[_0x1fc0('0x3d')]=0x24b;_0x416314[_0x1fc0('0x3e')]=![];_0xa76ba5[_0x1fc0('0x3f')]=_0x416314[_0x1fc0('0x3f')]=null;}else{if(_0x2abf2b[_0x1fc0('0x40')]){_0xa76ba5[_0x1fc0('0x36')]=_0x416314['user']=_0x2abf2b['username'];_0xa76ba5[_0x1fc0('0x38')]=_0x416314['pass']=_0x2abf2b['password'];}else{_0xa76ba5[_0x1fc0('0x40')]=_0x416314[_0x1fc0('0x40')]=![];_0xa76ba5[_0x1fc0('0x36')]=_0x416314[_0x1fc0('0x36')]=null;_0xa76ba5[_0x1fc0('0x38')]=_0x416314['pass']=null;}_0xa76ba5['host']=_0x2abf2b[_0x1fc0('0x41')][_0x1fc0('0x3c')];_0xa76ba5[_0x1fc0('0x3d')]=_0x2abf2b[_0x1fc0('0x41')][_0x1fc0('0x3d')];_0x416314['host']=_0x2abf2b[_0x1fc0('0x42')]['host'];_0x416314[_0x1fc0('0x3d')]=_0x2abf2b[_0x1fc0('0x42')][_0x1fc0('0x3d')];}return{'Imap':_0xa76ba5,'Smtp':_0x416314};}exports['index']=function(_0x5c5a3f,_0x3f883c){var _0xb41ebc={'include':[{'model':db[_0x1fc0('0x43')],'as':_0x1fc0('0x41')},{'model':db[_0x1fc0('0x44')],'as':_0x1fc0('0x42')},{'model':db['Pause'],'as':_0x1fc0('0x45')}]},_0x336c77={},_0x24bfeb={'count':0x0,'rows':[]};var _0x56be70=_[_0x1fc0('0x46')](db[_0x1fc0('0x47')][_0x1fc0('0x48')],function(_0x271113){return{'name':_0x271113[_0x1fc0('0x49')],'type':_0x271113[_0x1fc0('0x4a')][_0x1fc0('0x4b')]};});_0x336c77[_0x1fc0('0x4c')]=_[_0x1fc0('0x46')](_0x56be70,_0x1fc0('0x29'));_0x336c77[_0x1fc0('0x4d')]=_[_0x1fc0('0x4e')](_0x5c5a3f[_0x1fc0('0x4d')]);_0x336c77['filters']=_['intersection'](_0x336c77[_0x1fc0('0x4c')],_0x336c77['query']);_0xb41ebc['attributes']=_[_0x1fc0('0x4f')](_0x336c77[_0x1fc0('0x4c')],qs['fields'](_0x5c5a3f[_0x1fc0('0x4d')]['fields']));_0xb41ebc['attributes']=_0xb41ebc[_0x1fc0('0x50')][_0x1fc0('0x51')]?_0xb41ebc[_0x1fc0('0x50')]:_0x336c77[_0x1fc0('0x4c')];if(!_0x5c5a3f['query']['hasOwnProperty'](_0x1fc0('0x52'))){_0xb41ebc[_0x1fc0('0x20')]=qs['limit'](_0x5c5a3f[_0x1fc0('0x4d')]['limit']);_0xb41ebc['offset']=qs['offset'](_0x5c5a3f[_0x1fc0('0x4d')][_0x1fc0('0x1e')]);}_0xb41ebc['order']=qs[_0x1fc0('0x53')](_0x5c5a3f[_0x1fc0('0x4d')]['sort']);_0xb41ebc[_0x1fc0('0x54')]=qs['filters'](_[_0x1fc0('0x55')](_0x5c5a3f[_0x1fc0('0x4d')],_0x336c77['filters']),_0x56be70);if(_0x5c5a3f[_0x1fc0('0x4d')]['filter']){_0xb41ebc['where']=_[_0x1fc0('0x56')](_0xb41ebc[_0x1fc0('0x54')],{'$or':_[_0x1fc0('0x46')](_0x56be70,function(_0x2332eb){if(_0x2332eb[_0x1fc0('0x4a')]!==_0x1fc0('0x57')){var _0x117b12={};_0x117b12[_0x2332eb[_0x1fc0('0x29')]]={'$like':'%'+_0x5c5a3f[_0x1fc0('0x4d')][_0x1fc0('0x58')]+'%'};return _0x117b12;}})});}_0xb41ebc=_[_0x1fc0('0x56')]({},_0xb41ebc,_0x5c5a3f[_0x1fc0('0x59')]);var _0xe68392={'where':_0xb41ebc[_0x1fc0('0x54')]};return db[_0x1fc0('0x47')][_0x1fc0('0x21')](_0xe68392)[_0x1fc0('0xf')](function(_0x47e0ff){_0x24bfeb[_0x1fc0('0x21')]=_0x47e0ff;if(_0x5c5a3f[_0x1fc0('0x4d')][_0x1fc0('0x5a')]){_0xb41ebc['include']=[{'all':!![]}];}return db[_0x1fc0('0x47')][_0x1fc0('0x5b')](_0xb41ebc);})['then'](function(_0x3568c0){_0x24bfeb[_0x1fc0('0x5c')]=_0x3568c0;return _0x24bfeb;})[_0x1fc0('0xf')](respondWithFilteredResult(_0x3f883c,_0xb41ebc))[_0x1fc0('0x19')](handleError(_0x3f883c,null));};exports[_0x1fc0('0x5d')]=function(_0xb151d8,_0x46aacd){var _0x2319bf={'raw':![],'where':{'id':_0xb151d8['params']['id']},'include':[{'model':db[_0x1fc0('0x43')],'as':_0x1fc0('0x41')},{'model':db[_0x1fc0('0x44')],'as':_0x1fc0('0x42')},{'model':db[_0x1fc0('0x5e')],'as':_0x1fc0('0x45')}]},_0x4bed7b={};_0x4bed7b[_0x1fc0('0x4c')]=_[_0x1fc0('0x4e')](db[_0x1fc0('0x47')]['rawAttributes']);_0x4bed7b[_0x1fc0('0x4d')]=_['keys'](_0xb151d8[_0x1fc0('0x4d')]);_0x4bed7b['filters']=_[_0x1fc0('0x4f')](_0x4bed7b['model'],_0x4bed7b[_0x1fc0('0x4d')]);_0x2319bf[_0x1fc0('0x50')]=_[_0x1fc0('0x4f')](_0x4bed7b[_0x1fc0('0x4c')],qs[_0x1fc0('0x5f')](_0xb151d8[_0x1fc0('0x4d')][_0x1fc0('0x5f')]));_0x2319bf[_0x1fc0('0x50')]=_0x2319bf['attributes'][_0x1fc0('0x51')]?_0x2319bf['attributes']:_0x4bed7b[_0x1fc0('0x4c')];if(_0xb151d8[_0x1fc0('0x4d')]['includeAll']){_0x2319bf[_0x1fc0('0x60')]=[{'all':!![]}];}_0x2319bf=_[_0x1fc0('0x56')]({},_0x2319bf,_0xb151d8[_0x1fc0('0x59')]);return db['MailAccount']['find'](_0x2319bf)[_0x1fc0('0xf')](handleEntityNotFound(_0x46aacd,null))['then'](respondWithResult(_0x46aacd,null))[_0x1fc0('0x19')](handleError(_0x46aacd,null));};exports['update']=function(_0x5c3713,_0x5d10cd){if(_0x5c3713['body']['id']){delete _0x5c3713[_0x1fc0('0x61')]['id'];}var _0x12474b=_0x5c3713[_0x1fc0('0x61')][_0x1fc0('0x62')]===_0x1fc0('0x63')?null:_0x5c3713['body']['provider'];var _0x592b5d=_0x5c3713[_0x1fc0('0x61')]['Imap']||{};var _0x3a1167=_0x5c3713[_0x1fc0('0x61')][_0x1fc0('0x42')]||{};if(_0x12474b){_0x592b5d[_0x1fc0('0x3c')]=getImapHost(_0x12474b);_0x592b5d[_0x1fc0('0x3d')]=0x3e1;_0x3a1167['host']=getSmtpHost(_0x12474b);_0x3a1167['port']=0x24b;_0x3a1167[_0x1fc0('0x3e')]=![];}if(_0x3a1167[_0x1fc0('0x3a')]){_0x3a1167[_0x1fc0('0x3e')]=![];}else{_0x3a1167['CloudProviderId']=null;}if(!_0x592b5d[_0x1fc0('0x3a')])_0x592b5d[_0x1fc0('0x3b')]=null;_0x5c3713['body'][_0x1fc0('0x41')]=_0x592b5d;_0x5c3713[_0x1fc0('0x61')][_0x1fc0('0x42')]=_0x3a1167;return db[_0x1fc0('0x47')][_0x1fc0('0x64')]({'where':{'id':_0x5c3713[_0x1fc0('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x1fc0('0x41')},{'model':db[_0x1fc0('0x44')],'as':_0x1fc0('0x42')},{'model':db[_0x1fc0('0x5e')],'as':_0x1fc0('0x45')}]})[_0x1fc0('0xf')](handleEntityNotFound(_0x5d10cd,null))['then'](function(_0x3b7ce6){if(!_0x3b7ce6)throw new Error(_0x1fc0('0x66'));if(_0x3b7ce6[_0x1fc0('0x3f')])delete _0x5c3713['body'][_0x1fc0('0x41')];return _0x3b7ce6;})['then'](saveUpdates(_0x5c3713[_0x1fc0('0x61')],null))[_0x1fc0('0xf')](function(_0x19a8a2){if(!_0x5c3713[_0x1fc0('0x61')][_0x1fc0('0x41')])return _0x19a8a2;return db[_0x1fc0('0x43')]['update'](_0x5c3713['body'][_0x1fc0('0x41')],{'where':{'MailAccountId':_0x19a8a2['id']}})[_0x1fc0('0xf')](function(){return _0x19a8a2;});})[_0x1fc0('0xf')](function(_0x535d2a){if(!_0x5c3713[_0x1fc0('0x61')]['Smtp'])return _0x535d2a;return db[_0x1fc0('0x44')]['update'](_0x5c3713[_0x1fc0('0x61')]['Smtp'],{'where':{'MailAccountId':_0x535d2a['id']}})[_0x1fc0('0xf')](function(){return _0x535d2a;});})[_0x1fc0('0xf')](respondWithResult(_0x5d10cd,null))[_0x1fc0('0x19')](handleError(_0x5d10cd,null));};exports[_0x1fc0('0x67')]=function(_0x3b1420,_0xc6e0f0){return db[_0x1fc0('0x47')][_0x1fc0('0x67')]()[_0x1fc0('0xf')](respondWithResult(_0xc6e0f0,null))[_0x1fc0('0x19')](handleError(_0xc6e0f0,null));};exports[_0x1fc0('0x68')]=function(_0x1f1aae,_0x44f4dc){if(_0x1f1aae[_0x1fc0('0x61')]['id']){delete _0x1f1aae[_0x1fc0('0x61')]['id'];}return db[_0x1fc0('0x47')]['find']({'where':{'id':_0x1f1aae[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x44f4dc,null))['then'](function(_0x52657d){if(_0x52657d){_0x1f1aae[_0x1fc0('0x61')]['MailAccountId']=_0x52657d['id'];return db[_0x1fc0('0x69')][_0x1fc0('0x6a')](_0x1f1aae[_0x1fc0('0x61')]);}})[_0x1fc0('0xf')](respondWithResult(_0x44f4dc,null))[_0x1fc0('0x19')](handleError(_0x44f4dc,null));};exports[_0x1fc0('0x6b')]=function(_0x4a1113,_0x244e7f){var _0x20a1b5={'raw':![],'where':{}};var _0x5278a4={};var _0x511f62={'count':0x0,'rows':[]};return db['MailAccount'][_0x1fc0('0x6c')]({'where':{'id':_0x4a1113[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x244e7f,null))[_0x1fc0('0xf')](function(_0x131541){if(_0x131541){_0x5278a4[_0x1fc0('0x4c')]=_[_0x1fc0('0x4e')](db[_0x1fc0('0x69')][_0x1fc0('0x48')]);_0x5278a4[_0x1fc0('0x4d')]=_[_0x1fc0('0x4e')](_0x4a1113[_0x1fc0('0x4d')]);_0x5278a4[_0x1fc0('0x6d')]=_[_0x1fc0('0x4f')](_0x5278a4['model'],_0x5278a4[_0x1fc0('0x4d')]);_0x20a1b5['attributes']=_['intersection'](_0x5278a4[_0x1fc0('0x4c')],qs[_0x1fc0('0x5f')](_0x4a1113[_0x1fc0('0x4d')][_0x1fc0('0x5f')]));_0x20a1b5[_0x1fc0('0x50')]=_0x20a1b5['attributes']['length']?_0x20a1b5[_0x1fc0('0x50')]:_0x5278a4[_0x1fc0('0x4c')];if(!_0x4a1113[_0x1fc0('0x4d')][_0x1fc0('0x6e')](_0x1fc0('0x52'))){_0x20a1b5['limit']=qs[_0x1fc0('0x20')](_0x4a1113[_0x1fc0('0x4d')]['limit']);_0x20a1b5[_0x1fc0('0x1e')]=qs[_0x1fc0('0x1e')](_0x4a1113['query'][_0x1fc0('0x1e')]);}_0x20a1b5[_0x1fc0('0x6f')]=qs[_0x1fc0('0x53')](_0x4a1113[_0x1fc0('0x4d')][_0x1fc0('0x53')]);_0x20a1b5[_0x1fc0('0x54')]=qs[_0x1fc0('0x6d')](_[_0x1fc0('0x55')](_0x4a1113[_0x1fc0('0x4d')],_0x5278a4[_0x1fc0('0x6d')]));_0x20a1b5[_0x1fc0('0x54')][_0x1fc0('0x70')]=_0x131541['id'];if(_0x4a1113[_0x1fc0('0x4d')][_0x1fc0('0x58')]){_0x20a1b5[_0x1fc0('0x54')]=_[_0x1fc0('0x56')](_0x20a1b5[_0x1fc0('0x54')],{'$or':_[_0x1fc0('0x46')](_0x20a1b5[_0x1fc0('0x50')],function(_0x177b54){var _0x1c34f4={};_0x1c34f4[_0x177b54]={'$like':'%'+_0x4a1113[_0x1fc0('0x4d')]['filter']+'%'};return _0x1c34f4;})});}_0x20a1b5=_[_0x1fc0('0x56')]({},_0x20a1b5,_0x4a1113[_0x1fc0('0x59')]);return db[_0x1fc0('0x69')][_0x1fc0('0x21')]({'where':_0x20a1b5[_0x1fc0('0x54')]})[_0x1fc0('0xf')](function(_0x4805e5){_0x511f62['count']=_0x4805e5;if(_0x4a1113[_0x1fc0('0x4d')][_0x1fc0('0x5a')]){_0x20a1b5['include']=[{'all':!![]}];}return db[_0x1fc0('0x69')][_0x1fc0('0x5b')](_0x20a1b5);})[_0x1fc0('0xf')](function(_0x13e6d0){_0x511f62[_0x1fc0('0x5c')]=_0x13e6d0;return _0x511f62;});}})[_0x1fc0('0xf')](respondWithFilteredResult(_0x244e7f,_0x20a1b5))[_0x1fc0('0x19')](handleError(_0x244e7f,null));};exports['removeDispositions']=function(_0x2ca6a5,_0x54a8ac){return db[_0x1fc0('0x47')][_0x1fc0('0x64')]({'where':{'id':_0x2ca6a5[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x54a8ac,null))[_0x1fc0('0xf')](function(_0x2907c2){if(_0x2907c2){return _0x2907c2['removeDispositions'](_0x2ca6a5[_0x1fc0('0x4d')][_0x1fc0('0x71')]);}})[_0x1fc0('0xf')](respondWithStatusCode(_0x54a8ac,null))['catch'](handleError(_0x54a8ac,null));};exports[_0x1fc0('0x72')]=function(_0x4116a6,_0x2d44eb){if(_0x4116a6[_0x1fc0('0x61')]['id']){delete _0x4116a6[_0x1fc0('0x61')]['id'];}return db[_0x1fc0('0x47')][_0x1fc0('0x64')]({'where':{'id':_0x4116a6['params']['id']}})['then'](handleEntityNotFound(_0x2d44eb,null))[_0x1fc0('0xf')](function(_0x509cf3){if(_0x509cf3){_0x4116a6['body'][_0x1fc0('0x70')]=_0x509cf3['id'];return db['CannedAnswer'][_0x1fc0('0x6a')](_0x4116a6[_0x1fc0('0x61')]);}})[_0x1fc0('0xf')](respondWithResult(_0x2d44eb,null))['catch'](handleError(_0x2d44eb,null));};exports['getAnswers']=function(_0x1bbf73,_0x4ad181){var _0x3318f1={'raw':![],'where':{}};var _0x43ded9={};var _0x3e6046={'count':0x0,'rows':[]};return db['MailAccount'][_0x1fc0('0x6c')]({'where':{'id':_0x1bbf73[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x4ad181,null))[_0x1fc0('0xf')](function(_0x51ba26){if(_0x51ba26){_0x43ded9[_0x1fc0('0x4c')]=_['keys'](db[_0x1fc0('0x73')]['rawAttributes']);_0x43ded9[_0x1fc0('0x4d')]=_['keys'](_0x1bbf73['query']);_0x43ded9[_0x1fc0('0x6d')]=_[_0x1fc0('0x4f')](_0x43ded9[_0x1fc0('0x4c')],_0x43ded9[_0x1fc0('0x4d')]);_0x3318f1[_0x1fc0('0x50')]=_[_0x1fc0('0x4f')](_0x43ded9[_0x1fc0('0x4c')],qs[_0x1fc0('0x5f')](_0x1bbf73['query'][_0x1fc0('0x5f')]));_0x3318f1[_0x1fc0('0x50')]=_0x3318f1[_0x1fc0('0x50')][_0x1fc0('0x51')]?_0x3318f1['attributes']:_0x43ded9[_0x1fc0('0x4c')];if(!_0x1bbf73[_0x1fc0('0x4d')][_0x1fc0('0x6e')](_0x1fc0('0x52'))){_0x3318f1[_0x1fc0('0x20')]=qs[_0x1fc0('0x20')](_0x1bbf73['query']['limit']);_0x3318f1['offset']=qs[_0x1fc0('0x1e')](_0x1bbf73['query'][_0x1fc0('0x1e')]);}_0x3318f1[_0x1fc0('0x6f')]=qs[_0x1fc0('0x53')](_0x1bbf73[_0x1fc0('0x4d')][_0x1fc0('0x53')]);_0x3318f1[_0x1fc0('0x54')]=qs[_0x1fc0('0x6d')](_[_0x1fc0('0x55')](_0x1bbf73['query'],_0x43ded9[_0x1fc0('0x6d')]));_0x3318f1[_0x1fc0('0x54')][_0x1fc0('0x70')]=_0x51ba26['id'];if(_0x1bbf73['query'][_0x1fc0('0x58')]){_0x3318f1[_0x1fc0('0x54')]=_['merge'](_0x3318f1[_0x1fc0('0x54')],{'$or':_[_0x1fc0('0x46')](_0x3318f1[_0x1fc0('0x50')],function(_0x5840f4){var _0x13c85d={};_0x13c85d[_0x5840f4]={'$like':'%'+_0x1bbf73[_0x1fc0('0x4d')][_0x1fc0('0x58')]+'%'};return _0x13c85d;})});}_0x3318f1=_[_0x1fc0('0x56')]({},_0x3318f1,_0x1bbf73[_0x1fc0('0x59')]);return db['CannedAnswer'][_0x1fc0('0x21')]({'where':_0x3318f1[_0x1fc0('0x54')]})[_0x1fc0('0xf')](function(_0xd63cbc){_0x3e6046[_0x1fc0('0x21')]=_0xd63cbc;if(_0x1bbf73[_0x1fc0('0x4d')][_0x1fc0('0x5a')]){_0x3318f1['include']=[{'all':!![]}];}return db[_0x1fc0('0x73')]['findAll'](_0x3318f1);})[_0x1fc0('0xf')](function(_0x2495fb){_0x3e6046['rows']=_0x2495fb;return _0x3e6046;});}})[_0x1fc0('0xf')](respondWithFilteredResult(_0x4ad181,_0x3318f1))[_0x1fc0('0x19')](handleError(_0x4ad181,null));};exports[_0x1fc0('0x74')]=function(_0x5e9869,_0x3d5477){return db['MailAccount']['find']({'where':{'id':_0x5e9869['params']['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x3d5477,null))[_0x1fc0('0xf')](function(_0x2d9940){if(_0x2d9940){return _0x2d9940[_0x1fc0('0x74')](_0x5e9869[_0x1fc0('0x4d')][_0x1fc0('0x71')]);}})[_0x1fc0('0xf')](respondWithStatusCode(_0x3d5477,null))[_0x1fc0('0x19')](handleError(_0x3d5477,null));};exports['create']=function(_0x593043,_0x30196b){var _0x21560f={'name':_0x593043['body']['name'],'key':_0x593043[_0x1fc0('0x61')][_0x1fc0('0x4b')],'provider':_0x593043['body'][_0x1fc0('0x62')]===_0x1fc0('0x63')?null:_0x593043['body'][_0x1fc0('0x62')],'email':_0x593043[_0x1fc0('0x61')][_0x1fc0('0x75')],'ListId':_0x593043[_0x1fc0('0x61')]['ListId'],'active':!_[_0x1fc0('0x76')](_0x593043['body']['active'])?_0x593043[_0x1fc0('0x61')]['active']:!![],'description':_0x593043['body'][_0x1fc0('0x77')]||null};var _0x3e7675=getAuthenticationOptions(_0x21560f['provider'],_0x593043[_0x1fc0('0x61')]);_0x21560f[_0x1fc0('0x41')]=_0x3e7675[_0x1fc0('0x41')];_0x21560f[_0x1fc0('0x42')]=_0x3e7675[_0x1fc0('0x42')];return db[_0x1fc0('0x47')][_0x1fc0('0x6a')](_0x21560f,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x1fc0('0x43')],'as':'Imap'}]})[_0x1fc0('0xf')](function(_0x8d8f04){var _0x4cdf7a=_0x593043['user'][_0x1fc0('0x26')]({'plain':!![]});if(!_0x4cdf7a)throw new Error(_0x1fc0('0x78'));if(_0x4cdf7a[_0x1fc0('0x79')]==='user'){var _0x3c8fe0=_0x8d8f04[_0x1fc0('0x26')]({'plain':!![]});return db[_0x1fc0('0x7a')][_0x1fc0('0x64')]({'where':{'name':_0x1fc0('0x27'),'userProfileId':_0x4cdf7a[_0x1fc0('0x7b')]},'raw':!![]})['then'](function(_0x52ce4e){if(_0x52ce4e&&_0x52ce4e['autoAssociation']===0x0){return db[_0x1fc0('0x28')][_0x1fc0('0x6a')]({'name':_0x3c8fe0[_0x1fc0('0x29')],'resourceId':_0x3c8fe0['id'],'type':_0x52ce4e['name'],'sectionId':_0x52ce4e['id']},{})['then'](function(){return _0x8d8f04;});}else{return _0x8d8f04;}})['catch'](function(_0x32c192){logger[_0x1fc0('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32c192);throw _0x32c192;});}return _0x8d8f04;})[_0x1fc0('0xf')](respondWithResult(_0x30196b,0xc9))[_0x1fc0('0x19')](handleError(_0x30196b,null));};exports['getImap']=function(_0x4867a3,_0x518019){return db[_0x1fc0('0x47')][_0x1fc0('0x6c')]({'where':{'id':_0x4867a3[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x518019,null))[_0x1fc0('0xf')](function(_0x20b5b5){if(_0x20b5b5){return _0x20b5b5['getImap']();}return null;})[_0x1fc0('0xf')](respondWithResult(_0x518019,null))['catch'](handleError(_0x518019,null));};exports[_0x1fc0('0x7c')]=function(_0x12f201,_0x41ac97){if(_0x12f201['body']['id']){delete _0x12f201[_0x1fc0('0x61')]['id'];}return db[_0x1fc0('0x47')][_0x1fc0('0x64')]({'where':{'id':_0x12f201[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x41ac97,null))['then'](function(_0x57a535){if(_0x57a535){_0x12f201[_0x1fc0('0x61')][_0x1fc0('0x70')]=_0x57a535['id'];return db[_0x1fc0('0x43')]['create'](_0x12f201[_0x1fc0('0x61')]);}})[_0x1fc0('0xf')](respondWithResult(_0x41ac97,null))[_0x1fc0('0x19')](handleError(_0x41ac97,null));};exports['removeImap']=function(_0x5d70f9,_0x15755e){return db[_0x1fc0('0x47')]['findOne']({'where':{'id':_0x5d70f9[_0x1fc0('0x65')]['id']}})['then'](handleEntityNotFound(_0x15755e,null))[_0x1fc0('0xf')](function(_0x11389a){if(_0x11389a){return _0x11389a['setImap'](null);}return null;})[_0x1fc0('0xf')](respondWithStatusCode(_0x15755e,null))[_0x1fc0('0x19')](handleError(_0x15755e,null));};exports[_0x1fc0('0x7d')]=function(_0x2a6c41,_0x3d1338){return db[_0x1fc0('0x47')][_0x1fc0('0x6c')]({'where':{'id':_0x2a6c41[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x3d1338,null))[_0x1fc0('0xf')](function(_0x33fe3c){if(_0x33fe3c){return _0x33fe3c[_0x1fc0('0x7d')]();}return null;})[_0x1fc0('0xf')](respondWithResult(_0x3d1338,null))[_0x1fc0('0x19')](handleError(_0x3d1338,null));};exports[_0x1fc0('0x7e')]=function(_0x299b85,_0x17ba62){if(_0x299b85[_0x1fc0('0x61')]['id']){delete _0x299b85[_0x1fc0('0x61')]['id'];}return db[_0x1fc0('0x47')]['find']({'where':{'id':_0x299b85[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x17ba62,null))['then'](function(_0x15d010){if(_0x15d010){_0x299b85[_0x1fc0('0x61')][_0x1fc0('0x70')]=_0x15d010['id'];return db[_0x1fc0('0x44')][_0x1fc0('0x6a')](_0x299b85['body']);}})[_0x1fc0('0xf')](respondWithResult(_0x17ba62,null))[_0x1fc0('0x19')](handleError(_0x17ba62,null));};exports['removeSmtp']=function(_0x1d148e,_0x3a3727){return db[_0x1fc0('0x47')][_0x1fc0('0x6c')]({'where':{'id':_0x1d148e[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x3a3727,null))[_0x1fc0('0xf')](function(_0x361bef){if(_0x361bef){return _0x361bef[_0x1fc0('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x3a3727,null))[_0x1fc0('0x19')](handleError(_0x3a3727,null));};exports[_0x1fc0('0x80')]=function(_0x2c3d6f,_0x591b58){return db['MailInteraction'][_0x1fc0('0x64')]({'where':{'id':_0x2c3d6f[_0x1fc0('0x65')]['id']}})['then'](handleEntityNotFound(_0x591b58,null))[_0x1fc0('0xf')](function(_0xbcaa63){if(_0xbcaa63){return _0xbcaa63[_0x1fc0('0x80')](_0x2c3d6f['body'][_0x1fc0('0x71')],_[_0x1fc0('0x81')](_0x2c3d6f[_0x1fc0('0x61')],[_0x1fc0('0x71'),'id'])||{});}})[_0x1fc0('0xf')](respondWithResult(_0x591b58,null))['catch'](handleError(_0x591b58,null));};exports[_0x1fc0('0x82')]=function(_0x2a1850,_0x5cf483){var _0x4cea76={'raw':![],'where':{}};var _0x411b27={};var _0x5c4c26={'count':0x0,'rows':[]};return db[_0x1fc0('0x47')][_0x1fc0('0x6c')]({'where':{'id':_0x2a1850[_0x1fc0('0x65')]['id']}})['then'](handleEntityNotFound(_0x5cf483,null))[_0x1fc0('0xf')](function(_0x10c715){if(_0x10c715){_0x411b27[_0x1fc0('0x4c')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x411b27[_0x1fc0('0x4d')]=_[_0x1fc0('0x4e')](_0x2a1850[_0x1fc0('0x4d')]);_0x411b27[_0x1fc0('0x6d')]=_[_0x1fc0('0x4f')](_0x411b27[_0x1fc0('0x4c')],_0x411b27[_0x1fc0('0x4d')]);_0x4cea76[_0x1fc0('0x50')]=_[_0x1fc0('0x4f')](_0x411b27[_0x1fc0('0x4c')],qs['fields'](_0x2a1850[_0x1fc0('0x4d')][_0x1fc0('0x5f')]));_0x4cea76[_0x1fc0('0x50')]=_0x4cea76['attributes'][_0x1fc0('0x51')]?_0x4cea76[_0x1fc0('0x50')]:_0x411b27['model'];if(!_0x2a1850[_0x1fc0('0x4d')]['hasOwnProperty']('nolimit')){_0x4cea76[_0x1fc0('0x20')]=qs[_0x1fc0('0x20')](_0x2a1850[_0x1fc0('0x4d')]['limit']);_0x4cea76['offset']=qs[_0x1fc0('0x1e')](_0x2a1850[_0x1fc0('0x4d')][_0x1fc0('0x1e')]);}_0x4cea76[_0x1fc0('0x6f')]=qs[_0x1fc0('0x53')](_0x2a1850[_0x1fc0('0x4d')][_0x1fc0('0x53')]);_0x4cea76[_0x1fc0('0x54')]=qs[_0x1fc0('0x6d')](_['pick'](_0x2a1850[_0x1fc0('0x4d')],_0x411b27[_0x1fc0('0x6d')]));_0x4cea76[_0x1fc0('0x54')][_0x1fc0('0x70')]=_0x10c715['id'];if(_0x2a1850['query'][_0x1fc0('0x58')]){_0x4cea76[_0x1fc0('0x54')]=_['merge'](_0x4cea76[_0x1fc0('0x54')],{'$or':_['map'](_0x4cea76['attributes'],function(_0x4b2af5){var _0x3f478a={};_0x3f478a[_0x4b2af5]={'$like':'%'+_0x2a1850['query'][_0x1fc0('0x58')]+'%'};return _0x3f478a;})});}_0x4cea76=_['merge']({},_0x4cea76,_0x2a1850[_0x1fc0('0x59')]);return db[_0x1fc0('0x83')][_0x1fc0('0x21')]({'where':_0x4cea76[_0x1fc0('0x54')]})['then'](function(_0x3f2b43){_0x5c4c26[_0x1fc0('0x21')]=_0x3f2b43;if(_0x2a1850[_0x1fc0('0x4d')][_0x1fc0('0x5a')]){_0x4cea76[_0x1fc0('0x60')]=[{'model':db[_0x1fc0('0x84')],'as':_0x1fc0('0x85'),'required':![]},{'model':db[_0x1fc0('0x86')],'as':'Owner','attributes':['name','fullname',_0x1fc0('0x87')],'required':![]},{'model':db[_0x1fc0('0x88')],'as':_0x1fc0('0x89'),'attributes':['id','name',_0x1fc0('0x8a')],'where':_0x2a1850['query']['tag']?{'id':_0x2a1850[_0x1fc0('0x4d')][_0x1fc0('0x8b')]}:undefined,'required':_0x2a1850[_0x1fc0('0x4d')][_0x1fc0('0x8b')]?!![]:![]}];}return db['MailInteraction'][_0x1fc0('0x5b')](_0x4cea76);})['then'](function(_0x2ecf76){_0x5c4c26[_0x1fc0('0x5c')]=_0x2ecf76;return _0x5c4c26;});}})['then'](respondWithFilteredResult(_0x5cf483,_0x4cea76))[_0x1fc0('0x19')](handleError(_0x5cf483,null));};exports[_0x1fc0('0x8c')]=function addApplications(_0x31dbc7,_0x5ebb7c){var _0x5c3194=_0x31dbc7[_0x1fc0('0x65')]['id'];var _0x271b42=_0x31dbc7['body'];var _0x2cf738=0xc8;var _0x2b57bb=null;return db[_0x1fc0('0x8d')]['transaction']({'isolationLevel':db[_0x1fc0('0x8d')]['Transaction'][_0x1fc0('0x8e')][_0x1fc0('0x8f')]},function(_0x8be215){return db[_0x1fc0('0x47')][_0x1fc0('0x6c')]({'where':{'id':_0x5c3194},'transaction':_0x8be215})[_0x1fc0('0xf')](function(_0x273786){if(_0x273786){return db[_0x1fc0('0x90')][_0x1fc0('0x25')]({'where':{'MailAccountId':_0x5c3194},'transaction':_0x8be215})['then'](function(){var _0x377534=_['map'](_0x271b42,function(_0x504cbc){_0x504cbc[_0x1fc0('0x70')]=_0x5c3194;return _0x504cbc;});return db[_0x1fc0('0x90')][_0x1fc0('0x91')](_0x377534,{'transaction':_0x8be215});});}else{_0x2cf738=0x194;_0x2b57bb=[];}});})[_0x1fc0('0xf')](function(){if(_0x2cf738!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x5c3194},'order':_0x1fc0('0x92')})['then'](function(_0x527cda){_0x2b57bb=_0x527cda;});}})[_0x1fc0('0x19')](function(_0x2d20d1){_0x2cf738=0x1f4;logger[_0x1fc0('0x14')](_0x2d20d1[_0x1fc0('0x93')]);if(_0x2d20d1[_0x1fc0('0x29')]){delete _0x2d20d1[_0x1fc0('0x29')];}_0x2b57bb=_0x2d20d1;})[_0x1fc0('0x94')](function(){if(_0x2b57bb===null){_0x5ebb7c[_0x1fc0('0x1a')](_0x2cf738);}else{if(_0x2cf738===0x1f4){_0x5ebb7c[_0x1fc0('0x1b')](_0x2cf738)[_0x1fc0('0x2a')](_0x2b57bb);}else{_0x5ebb7c[_0x1fc0('0x1b')](_0x2cf738)[_0x1fc0('0x1d')](_0x2b57bb);}}});};exports['getApplications']=function(_0x158b2a,_0x3cb06e){var _0x4aca20={};var _0x39b50d={};var _0x5eb385;var _0x571865;return db[_0x1fc0('0x47')]['findOne']({'where':{'id':_0x158b2a[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x3cb06e,null))[_0x1fc0('0xf')](function(_0x3ceb46){if(_0x3ceb46){_0x5eb385=_0x3ceb46;_0x39b50d[_0x1fc0('0x4c')]=_['keys'](db['MailApplication'][_0x1fc0('0x48')]);_0x39b50d[_0x1fc0('0x4d')]=_[_0x1fc0('0x4e')](_0x158b2a[_0x1fc0('0x4d')]);_0x39b50d[_0x1fc0('0x6d')]=_[_0x1fc0('0x4f')](_0x39b50d[_0x1fc0('0x4c')],_0x39b50d['query']);_0x4aca20['attributes']=_[_0x1fc0('0x4f')](_0x39b50d[_0x1fc0('0x4c')],qs[_0x1fc0('0x5f')](_0x158b2a[_0x1fc0('0x4d')][_0x1fc0('0x5f')]));_0x4aca20['attributes']=_0x4aca20[_0x1fc0('0x50')][_0x1fc0('0x51')]?_0x4aca20[_0x1fc0('0x50')]:_0x39b50d[_0x1fc0('0x4c')];_0x4aca20[_0x1fc0('0x6f')]=qs['sort'](_0x158b2a['query'][_0x1fc0('0x53')]);_0x4aca20['where']=qs[_0x1fc0('0x6d')](_[_0x1fc0('0x55')](_0x158b2a[_0x1fc0('0x4d')],_0x39b50d[_0x1fc0('0x6d')]));if(_0x158b2a[_0x1fc0('0x4d')][_0x1fc0('0x58')]){_0x4aca20[_0x1fc0('0x54')]=_[_0x1fc0('0x56')](_0x4aca20[_0x1fc0('0x54')],{'$or':_[_0x1fc0('0x46')](_0x4aca20[_0x1fc0('0x50')],function(_0x4d0bd6){var _0x19134a={};_0x19134a[_0x4d0bd6]={'$like':'%'+_0x158b2a[_0x1fc0('0x4d')][_0x1fc0('0x58')]+'%'};return _0x19134a;})});}_0x4aca20=_[_0x1fc0('0x56')]({},_0x4aca20,_0x158b2a[_0x1fc0('0x59')]);return _0x5eb385[_0x1fc0('0x95')](_0x4aca20);}})[_0x1fc0('0xf')](function(_0x8272c9){if(_0x8272c9){_0x571865=_0x8272c9[_0x1fc0('0x51')];if(!_0x158b2a[_0x1fc0('0x4d')][_0x1fc0('0x6e')]('nolimit')){_0x4aca20['limit']=qs[_0x1fc0('0x20')](_0x158b2a['query'][_0x1fc0('0x20')]);_0x4aca20[_0x1fc0('0x1e')]=qs[_0x1fc0('0x1e')](_0x158b2a[_0x1fc0('0x4d')][_0x1fc0('0x1e')]);}return _0x5eb385[_0x1fc0('0x95')](_0x4aca20);}})[_0x1fc0('0xf')](function(_0x4c3575){if(_0x4c3575){return _0x4c3575?{'count':_0x571865,'rows':_0x4c3575}:null;}})[_0x1fc0('0xf')](respondWithResult(_0x3cb06e,null))[_0x1fc0('0x19')](handleError(_0x3cb06e,null));};exports[_0x1fc0('0x96')]=function(_0x442149,_0x5af95e){var _0x56c395={'raw':!![],'where':{}};var _0x10dce7={};var _0x616c97={'count':0x0,'rows':[]};return db[_0x1fc0('0x47')][_0x1fc0('0x6c')]({'where':{'id':_0x442149[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x5af95e,null))[_0x1fc0('0xf')](function(_0x2a0442){if(_0x2a0442){_0x10dce7['model']=_[_0x1fc0('0x4e')](db[_0x1fc0('0x97')]['rawAttributes']);_0x10dce7[_0x1fc0('0x4d')]=_['keys'](_0x442149['query']);_0x10dce7[_0x1fc0('0x6d')]=_[_0x1fc0('0x4f')](_0x10dce7['model'],_0x10dce7[_0x1fc0('0x4d')]);_0x56c395[_0x1fc0('0x50')]=_[_0x1fc0('0x4f')](_0x10dce7[_0x1fc0('0x4c')],qs[_0x1fc0('0x5f')](_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x5f')]));_0x56c395[_0x1fc0('0x50')]=_0x56c395[_0x1fc0('0x50')][_0x1fc0('0x51')]?_0x56c395[_0x1fc0('0x50')]:_0x10dce7['model'];if(!_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x6e')](_0x1fc0('0x52'))){_0x56c395['limit']=qs[_0x1fc0('0x20')](_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x20')]);_0x56c395['offset']=qs['offset'](_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x1e')]);}_0x56c395[_0x1fc0('0x6f')]=qs[_0x1fc0('0x53')](_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x53')]);_0x56c395[_0x1fc0('0x54')]=qs['filters'](_[_0x1fc0('0x55')](_0x442149[_0x1fc0('0x4d')],_0x10dce7[_0x1fc0('0x6d')]));_0x56c395[_0x1fc0('0x54')][_0x1fc0('0x70')]=_0x2a0442['id'];if(_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x58')]){_0x56c395[_0x1fc0('0x54')]=_[_0x1fc0('0x56')](_0x56c395['where'],{'$or':_[_0x1fc0('0x46')](_0x56c395[_0x1fc0('0x50')],function(_0x19b293){var _0x3ea4c7={};_0x3ea4c7[_0x19b293]={'$like':'%'+_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x58')]+'%'};return _0x3ea4c7;})});}if(_0x442149[_0x1fc0('0x4d')]['$gte']){var _0x3db7a3=_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x98')][_0x1fc0('0x99')](',');var _0x39081e={};_0x39081e[_0x3db7a3[0x0]]={'$gte':moment(_0x3db7a3[0x1])[_0x1fc0('0x9a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x56c395[_0x1fc0('0x54')]=_[_0x1fc0('0x56')](_0x56c395[_0x1fc0('0x54')],_0x39081e);}_0x56c395=_[_0x1fc0('0x56')]({},_0x56c395,_0x442149[_0x1fc0('0x59')]);return db[_0x1fc0('0x97')][_0x1fc0('0x21')]({'where':_0x56c395[_0x1fc0('0x54')]})[_0x1fc0('0xf')](function(_0x3467f5){_0x616c97[_0x1fc0('0x21')]=_0x3467f5;if(_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x5a')]){_0x56c395['include']=[{'all':!![]}];}return db[_0x1fc0('0x97')][_0x1fc0('0x5b')](_0x56c395);})['then'](function(_0x1d93e1){if(_0x442149[_0x1fc0('0x4d')][_0x1fc0('0x9b')]===_0x1fc0('0x9c')){for(var _0xd96f07=0x0;_0xd96f07<_0x1d93e1[_0x1fc0('0x51')];_0xd96f07++){_0x1d93e1[_0xd96f07][_0x1fc0('0x61')]=juice(_0x1d93e1[_0xd96f07][_0x1fc0('0x61')]);}}_0x616c97[_0x1fc0('0x5c')]=_0x1d93e1;return _0x616c97;});}})[_0x1fc0('0xf')](respondWithFilteredResult(_0x5af95e,_0x56c395))['catch'](handleError(_0x5af95e,null));};exports[_0x1fc0('0x2a')]=function(_0x428ce5,_0x435758){var _0x486c84,_0x416a33={},_0x1a7fc2;if(_0x428ce5[_0x1fc0('0x61')]['to']){_0x1a7fc2=_0x428ce5[_0x1fc0('0x61')]['to']['split'](',')[0x0];}return db[_0x1fc0('0x47')]['find']({'where':{'id':_0x428ce5[_0x1fc0('0x65')]['id']},'include':[{'model':db[_0x1fc0('0x9d')],'as':_0x1fc0('0x9e'),'include':[{'model':db[_0x1fc0('0x84')],'as':_0x1fc0('0x9f'),'where':{'email':_0x1a7fc2},'limit':0x1,'order':[[_0x1fc0('0xa0'),_0x1fc0('0xa1')]]}]},{'model':db[_0x1fc0('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1fc0('0xa2'),'raw':!![]}]}]})[_0x1fc0('0xf')](handleEntityNotFound(_0x435758,null))['then'](function(_0x2c3299){if(!_0x2c3299)return;_0x486c84=_0x2c3299;if(!_0x2c3299['Smtp'])throw new Error(_0x1fc0('0xa3'));if(_['isNil'](_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xa4')])){_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xa4')]=util[_0x1fc0('0x9a')]('%s\x20<%s>',_0x2c3299['name'],_0x2c3299[_0x1fc0('0x75')]||_0x2c3299['Smtp'][_0x1fc0('0x36')]);}if(_0x428ce5['body'][_0x1fc0('0xa5')]&&_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xa5')][_0x1fc0('0x51')]){for(var _0x13fc26=0x0;_0x13fc26<_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xa5')][_0x1fc0('0x51')];_0x13fc26+=0x1){_0x428ce5['body']['attachments'][_0x13fc26]={'filename':_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xa5')][_0x13fc26][_0x1fc0('0x29')],'path':path[_0x1fc0('0xa6')](config[_0x1fc0('0xa7')],_0x1fc0('0xa8'),_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xa5')][_0x13fc26]['basename'])};}}var _0x45e6ef=_0x2c3299[_0x1fc0('0xa9')]();return respondWithRpcPromise(_0x1fc0('0xaa'),'sendMail',{'account':_0x45e6ef,'message':_0x428ce5['body']});})[_0x1fc0('0xf')](function(_0x2a8dcb){if(!_0x2a8dcb)return;_0x416a33=_0x2a8dcb;if(!_0x486c84[_0x1fc0('0x9e')])throw new Error(_0x1fc0('0xab'));if(_0x486c84[_0x1fc0('0x9e')][_0x1fc0('0x9f')][_0x1fc0('0x51')])return _0x486c84[_0x1fc0('0x9e')][_0x1fc0('0x9f')][0x0];return db[_0x1fc0('0x84')]['create'](_['defaults'](_0x428ce5['body'],{'firstName':_0x428ce5[_0x1fc0('0x61')]['to'],'email':_0x428ce5[_0x1fc0('0x61')]['to'],'phone':_0x428ce5['body']['to'],'ListId':_0x486c84[_0x1fc0('0xac')]}));})[_0x1fc0('0xf')](function(_0x4dacad){if(!_0x4dacad)return;var _0xc051d0={'UserId':_0x428ce5['user']['id'],'ContactId':_0x4dacad['id'],'MailAccountId':_0x486c84['id'],'inReplyTo':_0x416a33[_0x1fc0('0xad')],'to':_0x428ce5[_0x1fc0('0x61')]['from'],'cc':_0x428ce5[_0x1fc0('0x61')]['cc'],'subject':_0x428ce5['body'][_0x1fc0('0xae')],'attach':_0x428ce5['body'][_0x1fc0('0xaf')],'firstMsgDirection':_0x1fc0('0xb0'),'lastMsgAt':moment()[_0x1fc0('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x1fc0('0xb0'),'Messages':[_['merge'](_0x428ce5[_0x1fc0('0x61')],{'messageId':_0x416a33[_0x1fc0('0xad')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x486c84['id'],'UserId':_0x428ce5[_0x1fc0('0x36')]['id'],'ContactId':_0x4dacad['id']})]};if(_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xb1')]){_0xc051d0=_[_0x1fc0('0x56')](_0xc051d0,_0x428ce5[_0x1fc0('0x61')][_0x1fc0('0xb1')]);}return db[_0x1fc0('0x83')][_0x1fc0('0x6a')](_0xc051d0,{'include':[{'model':db['MailMessage'],'as':_0x1fc0('0xb2')}]});})[_0x1fc0('0xf')](respondWithResult(_0x435758,null))['catch'](handleError(_0x435758,null));};exports['verifySmtp']=function(_0x37ef7a,_0x398d1d){return db['MailAccount'][_0x1fc0('0x64')]({'where':{'id':_0x37ef7a[_0x1fc0('0x65')]['id']},'include':[{'model':db[_0x1fc0('0x44')],'as':_0x1fc0('0x42'),'raw':!![],'include':[{'model':db[_0x1fc0('0xa2')],'as':'CloudProvider','raw':!![]}]}]})[_0x1fc0('0xf')](handleEntityNotFound(_0x398d1d,null))[_0x1fc0('0xf')](function(_0xa6d446){if(!_0xa6d446[_0x1fc0('0x42')])return;var _0x3f89ca=_0xa6d446['getSmtpOptions']();return respondWithRpcPromise(_0x1fc0('0xb3'),_0x1fc0('0xb4'),{'account':_0x3f89ca});})[_0x1fc0('0xf')](respondWithResult(_0x398d1d,null))['catch'](handleError(_0x398d1d,null));};exports[_0x1fc0('0x25')]=function(_0x16344a,_0x4b83c1){return db['MailAccount'][_0x1fc0('0x64')]({'where':{'id':_0x16344a[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x4b83c1,null))['then'](function(_0x151652){if(_0x151652&&_0x151652['service']){throw new db[(_0x1fc0('0xb5'))][(_0x1fc0('0xb6'))](_0x1fc0('0xb7'));}return _0x151652;})[_0x1fc0('0xf')](removeEntity(_0x4b83c1,null))[_0x1fc0('0x19')](handleError(_0x4b83c1,null));};exports[_0x1fc0('0xb8')]=function(_0x5eda57,_0x4f9da2){return db[_0x1fc0('0x47')][_0x1fc0('0x64')]({'where':{'id':_0x5eda57[_0x1fc0('0x65')]['id']}})['then'](handleEntityNotFound(_0x4f9da2,null))[_0x1fc0('0xf')](function(_0x4bbb46){if(_0x4bbb46){return _0x4bbb46[_0x1fc0('0xb8')](_0x5eda57[_0x1fc0('0x61')]['ids'],_['omit'](_0x5eda57['body'],[_0x1fc0('0x71'),'id'])||{})[_0x1fc0('0xb9')](function(_0x191218){for(var _0x3b216d=0x0;_0x3b216d<_0x5eda57['body'][_0x1fc0('0x71')][_0x1fc0('0x51')];_0x3b216d+=0x1){socket[_0x1fc0('0xba')](_0x1fc0('0xbb'),{'UserId':Number(_0x5eda57[_0x1fc0('0x61')][_0x1fc0('0x71')][_0x3b216d]),'MailAccountId':Number(_0x5eda57[_0x1fc0('0x65')]['id'])});}return _0x191218;});}})[_0x1fc0('0xf')](respondWithResult(_0x4f9da2,null))[_0x1fc0('0x19')](handleError(_0x4f9da2,null));};exports[_0x1fc0('0xbc')]=function(_0x2b95ff,_0x43cf97){return db[_0x1fc0('0x47')]['find']({'where':{'id':_0x2b95ff[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x43cf97,null))['then'](function(_0x530d13){if(_0x530d13){return _0x530d13[_0x1fc0('0xbc')](_0x2b95ff[_0x1fc0('0x4d')][_0x1fc0('0x71')])[_0x1fc0('0xf')](function(){if(_[_0x1fc0('0xbd')](_0x2b95ff[_0x1fc0('0x4d')][_0x1fc0('0x71')])){for(var _0x2fc2c6=0x0;_0x2fc2c6<_0x2b95ff['query'][_0x1fc0('0x71')][_0x1fc0('0x51')];_0x2fc2c6+=0x1){socket['emit'](_0x1fc0('0xbe'),{'UserId':Number(_0x2b95ff[_0x1fc0('0x4d')][_0x1fc0('0x71')][_0x2fc2c6]),'MailAccountId':Number(_0x2b95ff[_0x1fc0('0x65')]['id'])});}}else{socket[_0x1fc0('0xba')](_0x1fc0('0xbe'),{'UserId':Number(_0x2b95ff['query'][_0x1fc0('0x71')]),'MailAccountId':Number(_0x2b95ff[_0x1fc0('0x65')]['id'])});}});}})[_0x1fc0('0xf')](respondWithStatusCode(_0x43cf97,null))['catch'](handleError(_0x43cf97,null));};exports[_0x1fc0('0xbf')]=function(_0x3c987a,_0x34d91c){var _0x4d94ba={};var _0x1876e9={};var _0x3428dd;var _0x1c7244;return db[_0x1fc0('0x47')][_0x1fc0('0x6c')]({'where':{'id':_0x3c987a[_0x1fc0('0x65')]['id']}})[_0x1fc0('0xf')](handleEntityNotFound(_0x34d91c,null))[_0x1fc0('0xf')](function(_0x27ae12){if(_0x27ae12){_0x3428dd=_0x27ae12;_0x1876e9[_0x1fc0('0x4c')]=_['keys'](db[_0x1fc0('0x86')][_0x1fc0('0x48')]);_0x1876e9[_0x1fc0('0x4d')]=_[_0x1fc0('0x4e')](_0x3c987a[_0x1fc0('0x4d')]);_0x1876e9['filters']=_[_0x1fc0('0x4f')](_0x1876e9[_0x1fc0('0x4c')],_0x1876e9[_0x1fc0('0x4d')]);_0x4d94ba[_0x1fc0('0x50')]=_['intersection'](_0x1876e9['model'],qs[_0x1fc0('0x5f')](_0x3c987a['query']['fields']));_0x4d94ba[_0x1fc0('0x50')]=_0x4d94ba[_0x1fc0('0x50')][_0x1fc0('0x51')]?_0x4d94ba[_0x1fc0('0x50')]:_0x1876e9['model'];_0x4d94ba[_0x1fc0('0x6f')]=qs[_0x1fc0('0x53')](_0x3c987a[_0x1fc0('0x4d')][_0x1fc0('0x53')]);_0x4d94ba['where']=qs['filters'](_[_0x1fc0('0x55')](_0x3c987a[_0x1fc0('0x4d')],_0x1876e9[_0x1fc0('0x6d')]));if(_0x3c987a[_0x1fc0('0x4d')][_0x1fc0('0x58')]){_0x4d94ba[_0x1fc0('0x54')]=_[_0x1fc0('0x56')](_0x4d94ba[_0x1fc0('0x54')],{'$or':_[_0x1fc0('0x46')](_0x4d94ba[_0x1fc0('0x50')],function(_0x3e8675){var _0x4faf93={};_0x4faf93[_0x3e8675]={'$like':'%'+_0x3c987a['query'][_0x1fc0('0x58')]+'%'};return _0x4faf93;})});}_0x4d94ba=_[_0x1fc0('0x56')]({},_0x4d94ba,_0x3c987a[_0x1fc0('0x59')]);return _0x3428dd[_0x1fc0('0xbf')](_0x4d94ba);}})['then'](function(_0xd7a23e){if(_0xd7a23e){_0x1c7244=_0xd7a23e[_0x1fc0('0x51')];if(!_0x3c987a[_0x1fc0('0x4d')][_0x1fc0('0x6e')]('nolimit')){_0x4d94ba[_0x1fc0('0x20')]=qs[_0x1fc0('0x20')](_0x3c987a[_0x1fc0('0x4d')][_0x1fc0('0x20')]);_0x4d94ba[_0x1fc0('0x1e')]=qs['offset'](_0x3c987a[_0x1fc0('0x4d')][_0x1fc0('0x1e')]);}return _0x3428dd[_0x1fc0('0xbf')](_0x4d94ba);}})[_0x1fc0('0xf')](function(_0x3abc9d){if(_0x3abc9d){return _0x3abc9d?{'count':_0x1c7244,'rows':_0x3abc9d}:null;}})['then'](respondWithResult(_0x34d91c,null))[_0x1fc0('0x19')](handleError(_0x34d91c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index eec8a6d..266ca13 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 _0x8200=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x3fbc13,_0x56ed2c){var _0x5a9089=function(_0x1e94d8){while(--_0x1e94d8){_0x3fbc13['push'](_0x3fbc13['shift']());}};_0x5a9089(++_0x56ed2c);}(_0x8200,0x11f));var _0x0820=function(_0x5c5eff,_0x39ce44){_0x5c5eff=_0x5c5eff-0x0;var _0x1adfd8=_0x8200[_0x5c5eff];return _0x1adfd8;};'use strict';var EventEmitter=require(_0x0820('0x0'));var MailAccount=require(_0x0820('0x1'))['db'][_0x0820('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0820('0x3'),'afterUpdate':_0x0820('0x4'),'afterDestroy':_0x0820('0x5')};function emitEvent(_0x509e4c){return function(_0x163dd1,_0x48b5ea,_0x59cf3b){MailAccountEvents[_0x0820('0x6')](_0x509e4c+':'+_0x163dd1['id'],_0x163dd1);MailAccountEvents['emit'](_0x509e4c,_0x163dd1);_0x59cf3b(null);};}for(var e in events){if(events[_0x0820('0x7')](e)){var event=events[e];MailAccount[_0x0820('0x8')](e,emitEvent(event));}}module[_0x0820('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x8a21=['events','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x31adf9,_0x511868){var _0x4412b5=function(_0x192d84){while(--_0x192d84){_0x31adf9['push'](_0x31adf9['shift']());}};_0x4412b5(++_0x511868);}(_0x8a21,0x1d8));var _0x18a2=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0x8a21[_0x30dfa4];return _0x185b37;};'use strict';var EventEmitter=require(_0x18a2('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x18a2('0x1')](0x0);var events={'afterCreate':_0x18a2('0x2'),'afterUpdate':_0x18a2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5a8a45){return function(_0x42b942,_0x23e0d1,_0x2afe05){MailAccountEvents[_0x18a2('0x4')](_0x5a8a45+':'+_0x42b942['id'],_0x42b942);MailAccountEvents[_0x18a2('0x4')](_0x5a8a45,_0x42b942);_0x2afe05(null);};}for(var e in events){if(events[_0x18a2('0x5')](e)){var event=events[e];MailAccount[_0x18a2('0x6')](e,emitEvent(event));}}module[_0x18a2('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 e0dfc7b..6dc4a7e 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 _0x75c9=['CloudProvider','auth','user','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','host','Smtp','port','secure','authentication'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x75c9,0xd6));var _0x975c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x75c9[_0xbca1b1];return _0x4e1686;};'use strict';var attributes=require(_0x975c('0x0'));module['exports']=function(_0x3ca783){return _0x3ca783[_0x975c('0x1')](_0x975c('0x2'),attributes,{'tableName':_0x975c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x25c62f=this;var _0x2c103c={'id':_0x25c62f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x25c62f[_0x975c('0x4')]!==_0x975c('0x5')){_0x2c103c['service']=_0x25c62f[_0x975c('0x4')];}else{_0x2c103c[_0x975c('0x6')]=_0x25c62f[_0x975c('0x7')][_0x975c('0x6')];_0x2c103c[_0x975c('0x8')]=_0x25c62f[_0x975c('0x7')]['port'];_0x2c103c['secure']=_0x25c62f['Smtp'][_0x975c('0x9')];}if(_0x25c62f['Smtp'][_0x975c('0xa')]){if(_0x25c62f[_0x975c('0x7')]['modernAuthentication']){if(!_0x25c62f[_0x975c('0x7')][_0x975c('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2c103c[_0x975c('0xc')]={'type':'OAuth2','user':_0x25c62f['Smtp'][_0x975c('0xd')],'accessToken':_0x25c62f[_0x975c('0x7')][_0x975c('0xb')]['data5']};}else{_0x2c103c[_0x975c('0xc')]={'user':_0x25c62f[_0x975c('0x7')]['user'],'pass':_0x25c62f[_0x975c('0x7')][_0x975c('0xe')]};}}return _0x2c103c;}}});}; \ No newline at end of file +var _0xe804=['host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','user','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom'];(function(_0x2ef584,_0x457bf6){var _0x36a2a2=function(_0x714040){while(--_0x714040){_0x2ef584['push'](_0x2ef584['shift']());}};_0x36a2a2(++_0x457bf6);}(_0xe804,0xe9));var _0x4e80=function(_0x5222b5,_0x549c55){_0x5222b5=_0x5222b5-0x0;var _0x1d519b=_0xe804[_0x5222b5];return _0x1d519b;};'use strict';var attributes=require(_0x4e80('0x0'));module[_0x4e80('0x1')]=function(_0x48a5cf){return _0x48a5cf[_0x4e80('0x2')](_0x4e80('0x3'),attributes,{'tableName':_0x4e80('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x139778=this;var _0x458c10={'id':_0x139778['id'],'tls':{'rejectUnauthorized':![]}};if(_0x139778[_0x4e80('0x5')]!==_0x4e80('0x6')){_0x458c10['service']=_0x139778[_0x4e80('0x5')];}else{_0x458c10[_0x4e80('0x7')]=_0x139778['Smtp']['host'];_0x458c10[_0x4e80('0x8')]=_0x139778[_0x4e80('0x9')][_0x4e80('0x8')];_0x458c10[_0x4e80('0xa')]=_0x139778['Smtp']['secure'];}if(_0x139778['Smtp'][_0x4e80('0xb')]){if(_0x139778[_0x4e80('0x9')][_0x4e80('0xc')]){if(!_0x139778[_0x4e80('0x9')][_0x4e80('0xd')])throw new Error(_0x4e80('0xe'));_0x458c10['auth']={'type':'OAuth2','user':_0x139778[_0x4e80('0x9')][_0x4e80('0xf')],'accessToken':_0x139778['Smtp'][_0x4e80('0xd')]['data5']};}else{_0x458c10['auth']={'user':_0x139778[_0x4e80('0x9')]['user'],'pass':_0x139778[_0x4e80('0x9')]['pass']};}}return _0x458c10;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d25f049..bcd2b76 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 _0x524e=['ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','CloudProvider','get','Applications','applications','orderBy','priority','asc','autoclose','push','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','attachments','originTo','originCc','bcc'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x524e,0x15e));var _0xe524=function(_0x46b665,_0xfab071){_0x46b665=_0x46b665-0x0;var _0x29f1f5=_0x524e[_0x46b665];return _0x29f1f5;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xe524('0x0'));var rs=require(_0xe524('0x1'));var Redis=require(_0xe524('0x2'));var db=require(_0xe524('0x3'))['db'];var logger=require(_0xe524('0x4'))(_0xe524('0x5'));var config=require(_0xe524('0x6'));var jayson=require(_0xe524('0x7'));var client=jayson[_0xe524('0x8')][_0xe524('0x9')]({'port':0x232c});config['redis']=_[_0xe524('0xa')](config[_0xe524('0xb')],{'host':_0xe524('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe524('0xb')]));require(_0xe524('0xd'))[_0xe524('0xe')](socket);function respondWithRpcPromise(_0x1f36e5,_0x991924,_0x4082b1){return new BPromise(function(_0x1a08e2,_0xb3eb9f){return client[_0xe524('0xf')](_0x1f36e5,_0x4082b1)[_0xe524('0x10')](function(_0x1e4459){logger[_0xe524('0x11')](_0xe524('0x12'),_0x991924,_0xe524('0x13'));logger[_0xe524('0x14')](_0xe524('0x15'),_0x991924,'request\x20sent',JSON['stringify'](_0x1e4459));if(_0x1e4459[_0xe524('0x16')]){if(_0x1e4459[_0xe524('0x16')][_0xe524('0x17')]===0x1f4){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x1e4459['error'][_0xe524('0x18')]);return _0xb3eb9f(_0x1e4459['error'][_0xe524('0x18')]);}logger[_0xe524('0x16')]('MailAccount,\x20%s,\x20%s',_0x991924,_0x1e4459[_0xe524('0x16')]['message']);return _0x1a08e2(_0x1e4459[_0xe524('0x16')]['message']);}else{logger[_0xe524('0x11')]('MailAccount,\x20%s,\x20%s',_0x991924,'request\x20sent');_0x1a08e2(_0x1e4459['result'][_0xe524('0x18')]);}})['catch'](function(_0x11b2a1){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x11b2a1);_0xb3eb9f(_0x11b2a1);});});}exports[_0xe524('0x19')]=function(_0x5d7b17){var _0x1fd93a=this;return new Promise(function(_0x3ccb3f,_0x49d104){return db[_0xe524('0x1a')][_0xe524('0x1b')]({'raw':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17['options'][_0xe524('0x1f')]||null:null,'limit':_0x5d7b17['options']?_0x5d7b17['options'][_0xe524('0x20')]||null:null,'include':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x21')]?_['map'](_0x5d7b17[_0xe524('0x1c')]['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x22')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1f')],'include':_0x17e245[_0xe524('0x21')]?_[_0xe524('0x23')](_0x17e245[_0xe524('0x21')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes'],'include':_0x2141db[_0xe524('0x21')]?_[_0xe524('0x23')](_0x2141db[_0xe524('0x21')],function(_0x109a96){return{'model':db[_0x109a96[_0xe524('0x22')]],'as':_0x109a96['as'],'attributes':_0x109a96['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1ff){logger[_0xe524('0x11')](_0xe524('0x19'),_0x5d7b17);logger[_0xe524('0x14')](_0xe524('0x19'),_0x5d7b17,JSON['stringify'](_0x4b1ff));_0x3ccb3f(_0x4b1ff);})[_0xe524('0x24')](function(_0x9a7e98){logger['error']('GetMailAccount',_0x9a7e98[_0xe524('0x18')],_0x5d7b17);_0x49d104(_0x1fd93a[_0xe524('0x16')](0x1f4,_0x9a7e98['message']));});});};exports[_0xe524('0x25')]=function(_0x535354){var _0x3fec06=this;return new Promise(function(_0x54af2a,_0x315e56){return db[_0xe524('0x1a')][_0xe524('0x26')]({'raw':_0x535354['options']?_0x535354[_0xe524('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x535354[_0xe524('0x1c')]?_0x535354[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x1f')]||null:null,'include':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x21')]?_[_0xe524('0x23')](_0x535354[_0xe524('0x1c')]['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x22')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1f')],'include':_0x415450[_0xe524('0x21')]?_[_0xe524('0x23')](_0x415450[_0xe524('0x21')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x22')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes'],'include':_0x2741e8[_0xe524('0x21')]?_['map'](_0x2741e8[_0xe524('0x21')],function(_0x53eeee){return{'model':db[_0x53eeee['model']],'as':_0x53eeee['as'],'attributes':_0x53eeee[_0xe524('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c3aae){if(_0x535354[_0xe524('0x1c')][_0xe524('0x27')]===!![])_0x1c3aae[_0xe524('0x28')](_0xe524('0x29'),_0x1c3aae[_0xe524('0x2a')]());logger[_0xe524('0x11')](_0xe524('0x25'),_0x535354);logger['debug'](_0xe524('0x25'),_0x535354,JSON[_0xe524('0x2b')](_0x1c3aae));_0x54af2a(_0x1c3aae);})[_0xe524('0x24')](function(_0x3fd023){logger[_0xe524('0x16')](_0xe524('0x25'),_0x3fd023[_0xe524('0x18')],_0x535354);_0x315e56(_0x3fec06[_0xe524('0x16')](0x1f4,_0x3fd023['message']));});});};exports[_0xe524('0x2c')]=function(_0x849307){var _0x2e4a13=this;return new Promise(function(_0x59781b,_0x238673){var _0x5213ed={'body':_0x849307[_0xe524('0x2d')],'channel':_0xe524('0x2e')};var _0x43c314=_[_0xe524('0x2f')](_[_0xe524('0x30')](db[_0xe524('0x31')][_0xe524('0x32')]),['createdAt',_0xe524('0x33'),_0xe524('0x34'),_0xe524('0x35')]);var _0x376505=![];if(_0x849307[_0xe524('0x2d')]['id']){delete _0x849307[_0xe524('0x2d')]['id'];}if(_['isNil'](_0x849307[_0xe524('0x2d')][_0xe524('0x36')])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe524('0x37')](_0x849307['body']['body'])||_0x849307[_0xe524('0x2d')][_0xe524('0x2d')]===''){return _0x238673(_0x2e4a13['error'](0x1f4,_0xe524('0x38')));}if(_[_0xe524('0x37')](_0x849307[_0xe524('0x2d')][_0xe524('0x39')])){return _0x238673(_0x2e4a13['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}if(!_[_0xe524('0x3a')](_0x43c314,_0x849307[_0xe524('0x2d')]['mapKey'])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}var _0x472519={};_0x472519[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x1a')][_0xe524('0x26')]({'where':{'id':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db[_0xe524('0x3c')],'as':_0xe524('0x3d'),'include':[{'model':db[_0xe524('0x31')],'as':_0xe524('0x3e'),'where':_0x472519,'limit':0x1,'order':[[_0xe524('0x33'),_0xe524('0x3f')]]}]},{'model':db[_0xe524('0x40')],'as':'Applications'},{'model':db[_0xe524('0x41')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xe524('0x42')}]}]})['then'](function(_0x232cf0){if(_0x232cf0&&_0x232cf0[_0xe524('0x3d')]){var _0x561107=_0x232cf0[_0xe524('0x43')]({'plain':!![]});_0x5213ed['account']=_['omit'](_0x561107,[_0xe524('0x44'),_0xe524('0x3d')]);_0x5213ed[_0xe524('0x3b')]['smtpOptions']=_0x232cf0['getSmtpOptions']();_0x5213ed['applications']=_0x561107['Applications'];_0x5213ed['list']=_0x561107['List'];_0x5213ed[_0xe524('0x45')]=_[_0xe524('0x46')](_0x5213ed['applications'],[_0xe524('0x47')],[_0xe524('0x48')]);if(_0x5213ed[_0xe524('0x3b')]&&_0x5213ed[_0xe524('0x3b')][_0xe524('0x49')]){_0x5213ed['applications'][_0xe524('0x4a')]({'id':0x0,'priority':_0x5213ed[_0xe524('0x45')][_0xe524('0x4b')]+0x1,'app':'close','appdata':_0xe524('0x49'),'interval':'*,*,*,*'});}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x44')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x44')];}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')];}if(_0x561107[_0xe524('0x3d')][_0xe524('0x3e')][_0xe524('0x4b')]){return _0x561107[_0xe524('0x3d')]['Contacts'][0x0];}var _0x4dac0f=_['defaults'](_0x849307[_0xe524('0x2d')],{'firstName':_0x849307[_0xe524('0x2d')][_0xe524('0x36')],'ListId':_0x561107[_0xe524('0x35')]});_0x4dac0f[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x31')][_0xe524('0x4c')](_0x4dac0f);}else{throw new Error(_0xe524('0x4d'));}})['then'](function(_0x5012fc){_0x5213ed[_0xe524('0x4e')]=_0x5012fc;if(_0x5012fc){if(!_0x849307['body']['message']['messageId']){_0x849307['body'][_0xe524('0x18')][_0xe524('0x4f')]=rs[_0xe524('0x50')]()+'\x20'+_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x36')];}var _0x244f08={'ContactId':_0x5012fc['id'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'inReplyTo':_0x849307[_0xe524('0x2d')]['message']['messageId'],'to':_0x849307['body'][_0xe524('0x18')]['from'],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307['body']['message'][_0xe524('0x52')],'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'};return db[_0xe524('0x55')][_0xe524('0x26')]({'where':{'closed':![],'MailAccountId':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':_0xe524('0x56'),'attributes':[_0xe524('0x4f')],'where':{'messageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x57')]}}]})[_0xe524('0x10')](function(_0x3bd9f9){if(_0x3bd9f9){return[_0x3bd9f9,![]];}return db['MailInteraction']['create'](_0x244f08)[_0xe524('0x10')](function(_0x35cbe9){return[_0x35cbe9,!![]];});});}else{throw new Error(_0xe524('0x58'));}})[_0xe524('0x59')](function(_0x139a0a,_0x4c6869){if(_0x139a0a){_0x376505=_0x4c6869;if(!_0x4c6869){return _0x139a0a[_0xe524('0x5a')]({'inReplyTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x36')],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['subject'],'attach':_0x139a0a[_0xe524('0x52')]?_0x139a0a[_0xe524('0x52')]:_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x52')],'substatus':null,'substatusAt':moment()['format'](_0xe524('0x54')),'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'});}else{return _0x139a0a;}}})[_0xe524('0x10')](function(_0x387c4b){_0x5213ed[_0xe524('0x5b')]=_0x387c4b[_0xe524('0x43')]({'plain':!![]});_0x5213ed['interaction'][_0xe524('0x5c')]=_0x376505;return db[_0xe524('0x5d')][_0xe524('0x4c')]({'body':_0x849307[_0xe524('0x2d')]['body'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'MailInteractionId':_0x387c4b['id'],'direction':'in','ContactId':_0x5213ed['contact']['id'],'messageId':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'from':_0x849307['body'][_0xe524('0x18')][_0xe524('0x36')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['to'],'cc':_0x849307[_0xe524('0x2d')]['message']['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['attach'],'Attachments':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5e')],'originTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5f')],'originCc':_0x849307['body'][_0xe524('0x18')][_0xe524('0x60')],'bcc':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x61')],'ChatWebsiteId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x62')]||null,'originChannel':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x63')]||_0xe524('0x64'),'ChatOfflineMessageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x65')]||null},{'include':[{'model':db[_0xe524('0x66')],'as':_0xe524('0x67')}]});})[_0xe524('0x10')](function(_0x19b28a){_0x5213ed[_0xe524('0x18')]=_0x19b28a;if(_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]){return db[_0xe524('0x69')][_0xe524('0x26')]({'attributes':['id',_0xe524('0x6a')],'where':{'id':_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]}})[_0xe524('0x10')](function(_0x23425c){if(_0x23425c){_0x5213ed['applications'][_0xe524('0x6b')]({'id':0x0,'priority':0x0,'app':_0xe524('0x6c'),'appdata':_0x23425c[_0xe524('0x6a')]+','+(_0x5213ed['account'][_0xe524('0x6d')]||0xa),'interval':_0xe524('0x6e')});}return respondWithRpcPromise('Start','startRouting',_0x5213ed);});}return respondWithRpcPromise(_0xe524('0x6f'),'startRouting',_0x5213ed);})[_0xe524('0x10')](function(_0x5a6a07){_0x59781b(_0x5a6a07);})[_0xe524('0x24')](function(_0x1ed60b){_0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,_0x1ed60b[_0xe524('0x18')]));});});}; \ No newline at end of file +var _0xba34=['MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','find','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC'];(function(_0x2f58dc,_0x8f6ae2){var _0x3fd90d=function(_0x4426bf){while(--_0x4426bf){_0x2f58dc['push'](_0x2f58dc['shift']());}};_0x3fd90d(++_0x8f6ae2);}(_0xba34,0x119));var _0x4ba3=function(_0x246653,_0x55dd42){_0x246653=_0x246653-0x0;var _0x3a4875=_0xba34[_0x246653];return _0x3a4875;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var BPromise=require(_0x4ba3('0x2'));var rs=require(_0x4ba3('0x3'));var Redis=require(_0x4ba3('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x4ba3('0x5'));var jayson=require(_0x4ba3('0x6'));var client=jayson[_0x4ba3('0x7')][_0x4ba3('0x8')]({'port':0x232c});config[_0x4ba3('0x9')]=_[_0x4ba3('0xa')](config[_0x4ba3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ba3('0xb'))(new Redis(config[_0x4ba3('0x9')]));require(_0x4ba3('0xc'))[_0x4ba3('0xd')](socket);function respondWithRpcPromise(_0x380d60,_0xcf1ec3,_0x292f58){return new BPromise(function(_0x3f653c,_0x2ed106){return client[_0x4ba3('0xe')](_0x380d60,_0x292f58)[_0x4ba3('0xf')](function(_0x51edab){logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0xcf1ec3,'request\x20sent');logger[_0x4ba3('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'),JSON['stringify'](_0x51edab));if(_0x51edab[_0x4ba3('0x14')]){if(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x15')]===0x1f4){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x2ed106(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x3f653c(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}else{logger[_0x4ba3('0x10')]('MailAccount,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'));_0x3f653c(_0x51edab[_0x4ba3('0x17')][_0x4ba3('0x16')]);}})[_0x4ba3('0x18')](function(_0x556290){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x556290);_0x2ed106(_0x556290);});});}exports[_0x4ba3('0x19')]=function(_0x1e2ce5){var _0x184332=this;return new Promise(function(_0x125944,_0x4b2791){return db['MailAccount'][_0x4ba3('0x1a')]({'raw':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1e')]||null:null,'limit':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1f')]||null:null,'include':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')],'include':_0x252f37['include']?_[_0x4ba3('0x21')](_0x252f37[_0x4ba3('0x20')],function(_0x44d78c){return{'model':db[_0x44d78c['model']],'as':_0x44d78c['as'],'attributes':_0x44d78c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x34ecb4){logger[_0x4ba3('0x10')]('GetMailAccount',_0x1e2ce5);logger['debug'](_0x4ba3('0x19'),_0x1e2ce5,JSON[_0x4ba3('0x23')](_0x34ecb4));_0x125944(_0x34ecb4);})[_0x4ba3('0x18')](function(_0x19f039){logger[_0x4ba3('0x14')](_0x4ba3('0x19'),_0x19f039['message'],_0x1e2ce5);_0x4b2791(_0x184332[_0x4ba3('0x14')](0x1f4,_0x19f039[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x24')]=function(_0xbf95b3){var _0x2a6757=this;return new Promise(function(_0x1a7a2c,_0x457236){return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'raw':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf95b3['options']?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'include':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')],'include':_0x188f8c[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x188f8c[_0x4ba3('0x20')],function(_0xf892e1){return{'model':db[_0xf892e1[_0x4ba3('0x22')]],'as':_0xf892e1['as'],'attributes':_0xf892e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x3cf56c){if(_0xbf95b3[_0x4ba3('0x1b')]['smtp']===!![])_0x3cf56c[_0x4ba3('0x27')](_0x4ba3('0x28'),_0x3cf56c['getSmtpOptions']());logger[_0x4ba3('0x10')]('ShowMailAccount',_0xbf95b3);logger['debug'](_0x4ba3('0x24'),_0xbf95b3,JSON[_0x4ba3('0x23')](_0x3cf56c));_0x1a7a2c(_0x3cf56c);})[_0x4ba3('0x18')](function(_0x2b14e1){logger[_0x4ba3('0x14')]('ShowMailAccount',_0x2b14e1[_0x4ba3('0x16')],_0xbf95b3);_0x457236(_0x2a6757[_0x4ba3('0x14')](0x1f4,_0x2b14e1[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x29')]=function(_0xab7983){var _0x2acc92=this;return new Promise(function(_0x349af4,_0x2577be){var _0x553475={'body':_0xab7983[_0x4ba3('0x2a')],'channel':_0x4ba3('0x2b')};var _0x3cb07f=_[_0x4ba3('0x2c')](_[_0x4ba3('0x2d')](db[_0x4ba3('0x2e')][_0x4ba3('0x2f')]),[_0x4ba3('0x30'),_0x4ba3('0x31'),_0x4ba3('0x32'),_0x4ba3('0x33')]);var _0x1c58d2=![];if(_0xab7983[_0x4ba3('0x2a')]['id']){delete _0xab7983[_0x4ba3('0x2a')]['id'];}if(_['isNil'](_0xab7983['body']['from'])){return _0x2577be(_0x2acc92['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4ba3('0x34')](_0xab7983['body'][_0x4ba3('0x2a')])||_0xab7983['body'][_0x4ba3('0x2a')]===''){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x35')));}if(_[_0x4ba3('0x34')](_0xab7983[_0x4ba3('0x2a')]['mapKey'])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb07f));}if(!_[_0x4ba3('0x36')](_0x3cb07f,_0xab7983['body'][_0x4ba3('0x37')])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x38')+_0x3cb07f));}var _0x261a5e={};_0x261a5e[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')]['from'];return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'where':{'id':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x3a')],'as':_0x4ba3('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x261a5e,'limit':0x1,'order':[[_0x4ba3('0x31'),_0x4ba3('0x3c')]]}]},{'model':db[_0x4ba3('0x3d')],'as':'Applications'},{'model':db[_0x4ba3('0x3e')],'as':_0x4ba3('0x3f'),'include':[{'model':db[_0x4ba3('0x40')],'as':'CloudProvider'}]}]})['then'](function(_0x34dc04){if(_0x34dc04&&_0x34dc04['List']){var _0x439acf=_0x34dc04[_0x4ba3('0x41')]({'plain':!![]});_0x553475[_0x4ba3('0x39')]=_[_0x4ba3('0x42')](_0x439acf,[_0x4ba3('0x43'),_0x4ba3('0x3b')]);_0x553475['account'][_0x4ba3('0x28')]=_0x34dc04[_0x4ba3('0x44')]();_0x553475['applications']=_0x439acf[_0x4ba3('0x43')];_0x553475[_0x4ba3('0x45')]=_0x439acf[_0x4ba3('0x3b')];_0x553475[_0x4ba3('0x46')]=_[_0x4ba3('0x47')](_0x553475['applications'],[_0x4ba3('0x48')],[_0x4ba3('0x49')]);if(_0x553475['account']&&_0x553475[_0x4ba3('0x39')][_0x4ba3('0x4a')]){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4b')]({'id':0x0,'priority':_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4c')]+0x1,'app':_0x4ba3('0x4d'),'appdata':_0x4ba3('0x4a'),'interval':_0x4ba3('0x4e')});}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')]){delete _0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')];}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x3b')]){delete _0x553475['account']['List'];}if(_0x439acf['List'][_0x4ba3('0x4f')][_0x4ba3('0x4c')]){return _0x439acf[_0x4ba3('0x3b')][_0x4ba3('0x4f')][0x0];}var _0x40af1d=_['defaults'](_0xab7983[_0x4ba3('0x2a')],{'firstName':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')],'ListId':_0x439acf[_0x4ba3('0x33')]});_0x40af1d[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')];return db[_0x4ba3('0x2e')][_0x4ba3('0x51')](_0x40af1d);}else{throw new Error(_0x4ba3('0x52'));}})[_0x4ba3('0xf')](function(_0x317b9f){_0x553475[_0x4ba3('0x53')]=_0x317b9f;if(_0x317b9f){if(!_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x54')]){_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x54')]=rs[_0x4ba3('0x55')]()+'\x20'+_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['from'];}var _0x8ea419={'ContactId':_0x317b9f['id'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'inReplyTo':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'to':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'lastMsgAt':moment()[_0x4ba3('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x4ba3('0x59')][_0x4ba3('0x26')]({'where':{'closed':![],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x5a')],'as':_0x4ba3('0x5b'),'attributes':[_0x4ba3('0x54')],'where':{'messageId':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x5c')]}}]})[_0x4ba3('0xf')](function(_0x1afc5e){if(_0x1afc5e){return[_0x1afc5e,![]];}return db['MailInteraction'][_0x4ba3('0x51')](_0x8ea419)[_0x4ba3('0xf')](function(_0x55c03c){return[_0x55c03c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4ba3('0x5d')](function(_0x296bf6,_0x5c7c2f){if(_0x296bf6){_0x1c58d2=_0x5c7c2f;if(!_0x5c7c2f){return _0x296bf6[_0x4ba3('0x5e')]({'inReplyTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['messageId'],'to':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0x296bf6[_0x4ba3('0x57')]?_0x296bf6[_0x4ba3('0x57')]:_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x57')],'substatus':null,'substatusAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgDirection':'in'});}else{return _0x296bf6;}}})[_0x4ba3('0xf')](function(_0x424477){_0x553475['interaction']=_0x424477['get']({'plain':!![]});_0x553475[_0x4ba3('0x60')]['created']=_0x1c58d2;return db[_0x4ba3('0x5a')][_0x4ba3('0x51')]({'body':_0xab7983[_0x4ba3('0x2a')]['body'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'MailInteractionId':_0x424477['id'],'direction':'in','ContactId':_0x553475[_0x4ba3('0x53')]['id'],'messageId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'from':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'to':_0xab7983['body'][_0x4ba3('0x16')]['to'],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'Attachments':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x61')],'originTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x62')],'originCc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x63')],'bcc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x64')],'ChatWebsiteId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x65')]||null,'originChannel':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x66')]||_0x4ba3('0x67'),'ChatOfflineMessageId':_0xab7983['body']['message'][_0x4ba3('0x68')]||null},{'include':[{'model':db[_0x4ba3('0x69')],'as':_0x4ba3('0x6a')}]});})[_0x4ba3('0xf')](function(_0x37b966){_0x553475[_0x4ba3('0x16')]=_0x37b966;if(_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]){return db['User'][_0x4ba3('0x26')]({'attributes':['id','name'],'where':{'id':_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]}})[_0x4ba3('0xf')](function(_0x3c3638){if(_0x3c3638){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x6c')]({'id':0x0,'priority':0x0,'app':_0x4ba3('0x6d'),'appdata':_0x3c3638[_0x4ba3('0x6e')]+','+(_0x553475['account'][_0x4ba3('0x6f')]||0xa),'interval':_0x4ba3('0x4e')});}return respondWithRpcPromise(_0x4ba3('0x70'),'startRouting',_0x553475);});}return respondWithRpcPromise(_0x4ba3('0x70'),_0x4ba3('0x71'),_0x553475);})[_0x4ba3('0xf')](function(_0x39d428){_0x349af4(_0x39d428);})[_0x4ba3('0x18')](function(_0x2569bc){_0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x2569bc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index fc60831..26629d9 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 _0x6738=['length','./mailAccount.events','remove','update','emit','removeListener'];(function(_0x5964c3,_0x44169d){var _0x188e7d=function(_0x182fc8){while(--_0x182fc8){_0x5964c3['push'](_0x5964c3['shift']());}};_0x188e7d(++_0x44169d);}(_0x6738,0x16f));var _0x8673=function(_0x1a78db,_0x10512){_0x1a78db=_0x1a78db-0x0;var _0x5715c9=_0x6738[_0x1a78db];return _0x5715c9;};'use strict';var MailAccountEvents=require(_0x8673('0x0'));var events=['save',_0x8673('0x1'),_0x8673('0x2')];function createListener(_0xc6e6c9,_0x230bbe){return function(_0x1c26a8){_0x230bbe[_0x8673('0x3')](_0xc6e6c9,_0x1c26a8);};}function removeListener(_0x3396ea,_0x387de3){return function(){MailAccountEvents[_0x8673('0x4')](_0x3396ea,_0x387de3);};}exports['register']=function(_0x33b762){for(var _0x487a5e=0x0,_0x205205=events[_0x8673('0x5')];_0x487a5e<_0x205205;_0x487a5e++){var _0xb0dd89=events[_0x487a5e];var _0xa06381=createListener('mailAccount:'+_0xb0dd89,_0x33b762);MailAccountEvents['on'](_0xb0dd89,_0xa06381);}}; \ No newline at end of file +var _0xbfba=['emit','removeListener','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x418012,_0x2cb5db){var _0x26288c=function(_0x325b89){while(--_0x325b89){_0x418012['push'](_0x418012['shift']());}};_0x26288c(++_0x2cb5db);}(_0xbfba,0x1ac));var _0xabfb=function(_0x214087,_0x47a990){_0x214087=_0x214087-0x0;var _0x419723=_0xbfba[_0x214087];return _0x419723;};'use strict';var MailAccountEvents=require(_0xabfb('0x0'));var events=[_0xabfb('0x1'),_0xabfb('0x2'),_0xabfb('0x3')];function createListener(_0x2316b4,_0x1ffdec){return function(_0x4fa444){_0x1ffdec[_0xabfb('0x4')](_0x2316b4,_0x4fa444);};}function removeListener(_0x5340cc,_0x402233){return function(){MailAccountEvents[_0xabfb('0x5')](_0x5340cc,_0x402233);};}exports['register']=function(_0x5f20a2){for(var _0x525222=0x0,_0x5aed1e=events[_0xabfb('0x6')];_0x525222<_0x5aed1e;_0x525222++){var _0x3af781=events[_0x525222];var _0x1d5320=createListener(_0xabfb('0x7')+_0x3af781,_0x5f20a2);MailAccountEvents['on'](_0x3af781,_0x1d5320);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6467507..6b7876a 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 _0x5f7e=['get','isAuthenticated','show','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller'];(function(_0x4a2b30,_0xcf6333){var _0x3a787f=function(_0x5082ff){while(--_0x5082ff){_0x4a2b30['push'](_0x4a2b30['shift']());}};_0x3a787f(++_0xcf6333);}(_0x5f7e,0x87));var _0xe5f7=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x5f7e[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0xe5f7('0x0'));var util=require(_0xe5f7('0x1'));var path=require(_0xe5f7('0x2'));var timeout=require(_0xe5f7('0x3'));var express=require(_0xe5f7('0x4'));var router=express[_0xe5f7('0x5')]();var fs_extra=require(_0xe5f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe5f7('0x7'));var config=require('../../config/environment');var controller=require(_0xe5f7('0x8'));router[_0xe5f7('0x9')]('/:id',auth[_0xe5f7('0xa')](),controller[_0xe5f7('0xb')]);router[_0xe5f7('0xc')](_0xe5f7('0xd'),auth[_0xe5f7('0xa')](),controller['update']);router[_0xe5f7('0xe')](_0xe5f7('0xd'),auth[_0xe5f7('0xa')](),controller[_0xe5f7('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4c8c=['Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','show','put','update','delete','/:id','destroy','exports','multer','path','express'];(function(_0x2e216d,_0x488e18){var _0x1fbac5=function(_0x29b0a4){while(--_0x29b0a4){_0x2e216d['push'](_0x2e216d['shift']());}};_0x1fbac5(++_0x488e18);}(_0x4c8c,0x1cd));var _0xc4c8=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x4c8c[_0x158f01];return _0x5ef74e;};'use strict';var multer=require(_0xc4c8('0x0'));var util=require('util');var path=require(_0xc4c8('0x1'));var timeout=require('connect-timeout');var express=require(_0xc4c8('0x2'));var router=express[_0xc4c8('0x3')]();var fs_extra=require(_0xc4c8('0x4'));var auth=require(_0xc4c8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc4c8('0x6'));var controller=require(_0xc4c8('0x7'));router[_0xc4c8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc4c8('0x9')]);router[_0xc4c8('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc4c8('0xb')]);router[_0xc4c8('0xc')](_0xc4c8('0xd'),auth['isAuthenticated'](),controller[_0xc4c8('0xe')]);module[_0xc4c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0e021d2..fc3f431 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 _0x5489=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x6b888e,_0x420fed){var _0x17d0f6=function(_0x42675a){while(--_0x42675a){_0x6b888e['push'](_0x6b888e['shift']());}};_0x17d0f6(++_0x420fed);}(_0x5489,0xb3));var _0x9548=function(_0x5d70e1,_0x38239c){_0x5d70e1=_0x5d70e1-0x0;var _0x1fdd9a=_0x5489[_0x5d70e1];return _0x1fdd9a;};'use strict';var Sequelize=require('sequelize');module[_0x9548('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9548('0x1')],'allowNull':![],'defaultValue':_0x9548('0x2')},'appdata':{'type':Sequelize[_0x9548('0x3')]()},'description':{'type':Sequelize[_0x9548('0x1')]},'interval':{'type':Sequelize[_0x9548('0x1')],'defaultValue':_0x9548('0x4')}}; \ No newline at end of file +var _0xab84=['*,*,*,*','exports','STRING','TEXT'];(function(_0xf8b73e,_0x24aa5d){var _0x581b32=function(_0x4442eb){while(--_0x4442eb){_0xf8b73e['push'](_0xf8b73e['shift']());}};_0x581b32(++_0x24aa5d);}(_0xab84,0x145));var _0x4ab8=function(_0x3b64ef,_0x1671b5){_0x3b64ef=_0x3b64ef-0x0;var _0x1966c9=_0xab84[_0x3b64ef];return _0x1966c9;};'use strict';var Sequelize=require('sequelize');module[_0x4ab8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4ab8('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4ab8('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4ab8('0x1')],'defaultValue':_0x4ab8('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0aad8cd..85fd2d5 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x5cc7af,_0x9570d8){var _0x165552=function(_0x7b47a6){while(--_0x7b47a6){_0x5cc7af['push'](_0x5cc7af['shift']());}};_0x165552(++_0x9570d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x57ae35,_0x1f6b98){var _0x3f448c=function(_0x27ce3d){while(--_0x27ce3d){_0x57ae35['push'](_0x57ae35['shift']());}};_0x3f448c(++_0x1f6b98);}(_0xac4a,0x13f));var _0xaac4=function(_0x3b4c22,_0xb4921d){_0x3b4c22=_0x3b4c22-0x0;var _0x18fb24=_0xac4a[_0x3b4c22];return _0x18fb24;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1f4ca07..9b8b0f1 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 _0xe7a1=['request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7a1,0xa5));var _0x1e7a=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xe7a1[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e7a('0x0'))(_0x1e7a('0x1'));var moment=require(_0x1e7a('0x2'));var BPromise=require(_0x1e7a('0x3'));var rp=require(_0x1e7a('0x4'));var fs=require('fs');var path=require(_0x1e7a('0x5'));var rimraf=require(_0x1e7a('0x6'));var config=require(_0x1e7a('0x7'));var attributes=require(_0x1e7a('0x8'));module[_0x1e7a('0x9')]=function(_0x2c3d35,_0x49d258){return _0x2c3d35[_0x1e7a('0xa')](_0x1e7a('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1e7a('0xc')});}; \ No newline at end of file +var _0xb983=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','mail_applications','utf8mb4_unicode_ci','api','moment'];(function(_0x4e83c9,_0x403cec){var _0x5a7112=function(_0x20557a){while(--_0x20557a){_0x4e83c9['push'](_0x4e83c9['shift']());}};_0x5a7112(++_0x403cec);}(_0xb983,0x7c));var _0x3b98=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xb983[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3b98('0x0'));var moment=require(_0x3b98('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b98('0x2'));var rimraf=require(_0x3b98('0x3'));var config=require(_0x3b98('0x4'));var attributes=require(_0x3b98('0x5'));module[_0x3b98('0x6')]=function(_0x2027ca,_0x38a5b0){return _0x2027ca['define']('MailApplication',attributes,{'tableName':_0x3b98('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3b98('0x8')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c20a93d..e4039b2 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 _0x25d3=['stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','update','body','options','raw','where','limit'];(function(_0x2de621,_0x552e2b){var _0x56ad37=function(_0x31df1b){while(--_0x31df1b){_0x2de621['push'](_0x2de621['shift']());}};_0x56ad37(++_0x552e2b);}(_0x25d3,0xc5));var _0x325d=function(_0xfb9f45,_0x3d943b){_0xfb9f45=_0xfb9f45-0x0;var _0x1eca9d=_0x25d3[_0xfb9f45];return _0x1eca9d;};'use strict';var _=require(_0x325d('0x0'));var util=require('util');var moment=require(_0x325d('0x1'));var BPromise=require('bluebird');var rs=require(_0x325d('0x2'));var fs=require('fs');var Redis=require(_0x325d('0x3'));var db=require(_0x325d('0x4'))['db'];var utils=require(_0x325d('0x5'));var logger=require('../../config/logger')(_0x325d('0x6'));var config=require('../../config/environment');var jayson=require(_0x325d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5668,_0xf90a14,_0x21d9fb){return new BPromise(function(_0x191bd6,_0x319c93){return client[_0x325d('0x8')](_0x3a5668,_0x21d9fb)[_0x325d('0x9')](function(_0x14ec3f){logger[_0x325d('0xa')]('MailApplication,\x20%s,\x20%s',_0xf90a14,_0x325d('0xb'));logger[_0x325d('0xc')](_0x325d('0xd'),_0xf90a14,'request\x20sent',JSON['stringify'](_0x14ec3f));if(_0x14ec3f[_0x325d('0xe')]){if(_0x14ec3f[_0x325d('0xe')][_0x325d('0xf')]===0x1f4){logger['error'](_0x325d('0x10'),_0xf90a14,_0x14ec3f[_0x325d('0xe')][_0x325d('0x11')]);return _0x319c93(_0x14ec3f[_0x325d('0xe')]['message']);}logger[_0x325d('0xe')](_0x325d('0x10'),_0xf90a14,_0x14ec3f['error'][_0x325d('0x11')]);return _0x191bd6(_0x14ec3f[_0x325d('0xe')][_0x325d('0x11')]);}else{logger[_0x325d('0xa')](_0x325d('0x10'),_0xf90a14,_0x325d('0xb'));_0x191bd6(_0x14ec3f[_0x325d('0x12')][_0x325d('0x11')]);}})[_0x325d('0x13')](function(_0x31c412){logger[_0x325d('0xe')]('MailApplication,\x20%s,\x20%s',_0xf90a14,_0x31c412);_0x319c93(_0x31c412);});});}exports[_0x325d('0x14')]=function(_0xd81de3){var _0x4ca6c3=this;return new Promise(function(_0x44328a,_0x252ce0){return db['MailApplication'][_0x325d('0x15')](_0xd81de3[_0x325d('0x16')],{'raw':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')][_0x325d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')][_0x325d('0x19')]||null:null,'attributes':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')]['attributes']||null:null,'limit':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')][_0x325d('0x1a')]||null:null})['then'](function(_0x7437c4){logger[_0x325d('0xa')](_0x325d('0x14'),_0xd81de3);logger[_0x325d('0xc')](_0x325d('0x14'),_0xd81de3,JSON[_0x325d('0x1b')](_0x7437c4));_0x44328a(_0x7437c4);})['catch'](function(_0x1c2939){logger[_0x325d('0xe')](_0x325d('0x14'),_0x1c2939[_0x325d('0x11')],_0xd81de3);_0x252ce0(_0x4ca6c3[_0x325d('0xe')](0x1f4,_0x1c2939[_0x325d('0x11')]));});});}; \ No newline at end of file +var _0x4133=['result','catch','UpdateMailApplication','body','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x4133,0x10e));var _0x3413=function(_0x4b9c83,_0x3e6e05){_0x4b9c83=_0x4b9c83-0x0;var _0x2ee121=_0x4133[_0x4b9c83];return _0x2ee121;};'use strict';var _=require(_0x3413('0x0'));var util=require(_0x3413('0x1'));var moment=require(_0x3413('0x2'));var BPromise=require('bluebird');var rs=require(_0x3413('0x3'));var fs=require('fs');var Redis=require(_0x3413('0x4'));var db=require(_0x3413('0x5'))['db'];var utils=require(_0x3413('0x6'));var logger=require('../../config/logger')(_0x3413('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3413('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3183e4,_0x4b2d68,_0x4e5c0a){return new BPromise(function(_0x4c6190,_0x711520){return client[_0x3413('0x9')](_0x3183e4,_0x4e5c0a)[_0x3413('0xa')](function(_0xb1bca){logger[_0x3413('0xb')](_0x3413('0xc'),_0x4b2d68,_0x3413('0xd'));logger[_0x3413('0xe')](_0x3413('0xf'),_0x4b2d68,_0x3413('0xd'),JSON[_0x3413('0x10')](_0xb1bca));if(_0xb1bca['error']){if(_0xb1bca[_0x3413('0x11')][_0x3413('0x12')]===0x1f4){logger['error'](_0x3413('0xc'),_0x4b2d68,_0xb1bca[_0x3413('0x11')][_0x3413('0x13')]);return _0x711520(_0xb1bca['error'][_0x3413('0x13')]);}logger[_0x3413('0x11')](_0x3413('0xc'),_0x4b2d68,_0xb1bca['error'][_0x3413('0x13')]);return _0x4c6190(_0xb1bca[_0x3413('0x11')]['message']);}else{logger[_0x3413('0xb')](_0x3413('0xc'),_0x4b2d68,_0x3413('0xd'));_0x4c6190(_0xb1bca[_0x3413('0x14')][_0x3413('0x13')]);}})[_0x3413('0x15')](function(_0xa13e93){logger['error'](_0x3413('0xc'),_0x4b2d68,_0xa13e93);_0x711520(_0xa13e93);});});}exports[_0x3413('0x16')]=function(_0x476fca){var _0x59fcbf=this;return new Promise(function(_0x1a9e88,_0x3fd3ec){return db['MailApplication']['update'](_0x476fca[_0x3413('0x17')],{'raw':_0x476fca[_0x3413('0x18')]?_0x476fca[_0x3413('0x18')][_0x3413('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x476fca[_0x3413('0x18')]?_0x476fca[_0x3413('0x18')][_0x3413('0x1a')]||null:null,'attributes':_0x476fca[_0x3413('0x18')]?_0x476fca[_0x3413('0x18')][_0x3413('0x1b')]||null:null,'limit':_0x476fca[_0x3413('0x18')]?_0x476fca[_0x3413('0x18')][_0x3413('0x1c')]||null:null})[_0x3413('0xa')](function(_0xa5073a){logger['info']('UpdateMailApplication',_0x476fca);logger[_0x3413('0xe')](_0x3413('0x16'),_0x476fca,JSON[_0x3413('0x10')](_0xa5073a));_0x1a9e88(_0xa5073a);})[_0x3413('0x15')](function(_0xe869bd){logger[_0x3413('0x11')](_0x3413('0x16'),_0xe869bd['message'],_0x476fca);_0x3fd3ec(_0x59fcbf['error'](0x1f4,_0xe869bd[_0x3413('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9e3688c..83c0fd1 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 _0x8a28=['download','create','post','addMessage','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download'];(function(_0x3d5779,_0x54da57){var _0x15437c=function(_0x3317dc){while(--_0x3317dc){_0x3d5779['push'](_0x3d5779['shift']());}};_0x15437c(++_0x54da57);}(_0x8a28,0x7c));var _0x88a2=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8a28[_0x550d12];return _0x12103d;};'use strict';var express=require('express');var router=express[_0x88a2('0x0')]();var auth=require(_0x88a2('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x88a2('0x2'));router[_0x88a2('0x3')]('/',auth[_0x88a2('0x4')](),controller['index']);router[_0x88a2('0x3')](_0x88a2('0x5'),auth[_0x88a2('0x4')](),controller[_0x88a2('0x6')]);router[_0x88a2('0x3')]('/:id',auth[_0x88a2('0x4')](),controller[_0x88a2('0x7')]);router[_0x88a2('0x3')](_0x88a2('0x8'),auth['isAuthenticated'](),controller[_0x88a2('0x9')]);router['get'](_0x88a2('0xa'),auth['isAuthenticated'](),controller[_0x88a2('0xb')]);router['post']('/',auth[_0x88a2('0x4')](),controller[_0x88a2('0xc')]);router[_0x88a2('0xd')](_0x88a2('0x8'),auth[_0x88a2('0x4')](),controller[_0x88a2('0xe')]);router[_0x88a2('0xd')]('/:id/tags',auth[_0x88a2('0x4')](),interaction[_0x88a2('0xf')](_0x88a2('0x10'),'mailinteraction:addtags'),controller[_0x88a2('0x11')]);router[_0x88a2('0x12')](_0x88a2('0x13'),auth[_0x88a2('0x4')](),interaction['tracked']('mail',_0x88a2('0x14')),controller[_0x88a2('0x15')]);router[_0x88a2('0x16')](_0x88a2('0x13'),auth[_0x88a2('0x4')](),interaction['tracked'](_0x88a2('0x10'),_0x88a2('0x17')),controller[_0x88a2('0x18')]);router[_0x88a2('0x16')](_0x88a2('0x19'),auth[_0x88a2('0x4')](),controller[_0x88a2('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x8696=['../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','describe','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','Router'];(function(_0x57f36c,_0x59b1c0){var _0x1cda2e=function(_0xe5e9b0){while(--_0xe5e9b0){_0x57f36c['push'](_0x57f36c['shift']());}};_0x1cda2e(++_0x59b1c0);}(_0x8696,0x1d9));var _0x6869=function(_0xdba01a,_0x484678){_0xdba01a=_0xdba01a-0x0;var _0x45e8bd=_0x8696[_0xdba01a];return _0x45e8bd;};'use strict';var express=require(_0x6869('0x0'));var router=express[_0x6869('0x1')]();var auth=require(_0x6869('0x2'));var interaction=require(_0x6869('0x3'));var controller=require(_0x6869('0x4'));router['get']('/',auth[_0x6869('0x5')](),controller['index']);router[_0x6869('0x6')]('/describe',auth[_0x6869('0x5')](),controller[_0x6869('0x7')]);router[_0x6869('0x6')]('/:id',auth[_0x6869('0x5')](),controller['show']);router[_0x6869('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6869('0x8')]);router[_0x6869('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x6869('0x9')]('/',auth[_0x6869('0x5')](),controller[_0x6869('0xa')]);router[_0x6869('0x9')]('/:id/messages',auth[_0x6869('0x5')](),controller[_0x6869('0xb')]);router[_0x6869('0x9')](_0x6869('0xc'),auth['isAuthenticated'](),interaction[_0x6869('0xd')](_0x6869('0xe'),_0x6869('0xf')),controller[_0x6869('0x10')]);router[_0x6869('0x11')](_0x6869('0x12'),auth['isAuthenticated'](),interaction[_0x6869('0xd')]('mail',_0x6869('0x13')),controller[_0x6869('0x14')]);router[_0x6869('0x15')]('/:id',auth[_0x6869('0x5')](),interaction[_0x6869('0xd')]('mail',_0x6869('0x16')),controller[_0x6869('0x17')]);router[_0x6869('0x15')](_0x6869('0xc'),auth[_0x6869('0x5')](),controller[_0x6869('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 5806937..7b14f42 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 _0xb26c=['out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x306d49,_0x43ba77){var _0x1ab180=function(_0x48ee40){while(--_0x48ee40){_0x306d49['push'](_0x306d49['shift']());}};_0x1ab180(++_0x43ba77);}(_0xb26c,0x1ba));var _0xcb26=function(_0x2ce1c4,_0x2b3579){_0x2ce1c4=_0x2ce1c4-0x0;var _0x424785=_0xb26c[_0x2ce1c4];return _0x424785;};'use strict';var Sequelize=require(_0xcb26('0x0'));var iconv=require(_0xcb26('0x1'));module['exports']={'closed':{'type':Sequelize[_0xcb26('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb26('0x3')]},'disposition':{'type':Sequelize[_0xcb26('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcb26('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcb26('0x4')](0x1fe)},'to':{'type':Sequelize[_0xcb26('0x4')]},'cc':{'type':Sequelize[_0xcb26('0x5')](_0xcb26('0x6'))},'subject':{'type':Sequelize[_0xcb26('0x5')]()},'attach':{'type':Sequelize[_0xcb26('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcb26('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xcb26('0x7')]('in',_0xcb26('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcb26('0x7')]('in',_0xcb26('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7b21=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x7b21,0x10e));var _0x17b2=function(_0x453ec1,_0x283120){_0x453ec1=_0x453ec1-0x0;var _0x26beaa=_0x7b21[_0x453ec1];return _0x26beaa;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x17b2('0x0'));module[_0x17b2('0x1')]={'closed':{'type':Sequelize[_0x17b2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x17b2('0x3')]},'disposition':{'type':Sequelize[_0x17b2('0x4')]},'secondDisposition':{'type':Sequelize[_0x17b2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x17b2('0x4')]},'inReplyTo':{'type':Sequelize[_0x17b2('0x4')](0x1fe)},'to':{'type':Sequelize[_0x17b2('0x4')]},'cc':{'type':Sequelize[_0x17b2('0x5')](_0x17b2('0x6'))},'subject':{'type':Sequelize[_0x17b2('0x5')]()},'attach':{'type':Sequelize[_0x17b2('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x17b2('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x17b2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x17b2('0x7')]('in',_0x17b2('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x17b2('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x17b2('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 09c836d..ac3450c 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 _0xca9e=['status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','addMessage','MailMessage','findOne','hasOwnProperty','nolimit','sort','where','MailInteractionId','filter','merge','$gte','split','format','inlineCss','true','setTags','ids','omit','Tag','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','get','each','missing.recipient@your.company.com','subject','createdAt','headers','bcc','Bcc','basename','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','lodash','juice','../../components/interaction/service','../../config/logger','api','redis','defaults','localhost','register','sendStatus'];(function(_0x36e1cf,_0x4d54d7){var _0x3aec73=function(_0x218d84){while(--_0x218d84){_0x36e1cf['push'](_0x36e1cf['shift']());}};_0x3aec73(++_0x4d54d7);}(_0xca9e,0xcb));var _0xeca9=function(_0x59a167,_0x398d1c){_0x59a167=_0x59a167-0x0;var _0x3c5d52=_0xca9e[_0x59a167];return _0x3c5d52;};'use strict';var emlformat=require(_0xeca9('0x0'));var rimraf=require(_0xeca9('0x1'));var zipdir=require(_0xeca9('0x2'));var moment=require('moment');var BPromise=require(_0xeca9('0x3'));var util=require(_0xeca9('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xeca9('0x5'));var juice=require(_0xeca9('0x6'));var Redis=require('ioredis');var interaction=require(_0xeca9('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xeca9('0x8'))(_0xeca9('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xeca9('0xa')]=_[_0xeca9('0xb')](config[_0xeca9('0xa')],{'host':_0xeca9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeca9('0xa')]));require('./mailInteraction.socket')[_0xeca9('0xd')](socket);function respondWithStatusCode(_0x3d3e6d,_0x558c7c){_0x558c7c=_0x558c7c||0xcc;return function(_0x2891ae){if(_0x2891ae){return _0x3d3e6d[_0xeca9('0xe')](_0x558c7c);}return _0x3d3e6d[_0xeca9('0xf')](_0x558c7c)[_0xeca9('0x10')]();};}function respondWithResult(_0x235cc0,_0x2d943b){_0x2d943b=_0x2d943b||0xc8;return function(_0x39dae9){if(_0x39dae9){return _0x235cc0[_0xeca9('0xf')](_0x2d943b)[_0xeca9('0x11')](_0x39dae9);}};}function respondWithFilteredResult(_0x17f6ed,_0x358645){return function(_0x14485b){if(_0x14485b){var _0xb5dbb6=typeof _0x358645[_0xeca9('0x12')]===_0xeca9('0x13')&&typeof _0x358645[_0xeca9('0x14')]===_0xeca9('0x13');var _0x593cd1=_0x14485b[_0xeca9('0x15')];var _0x2550b1=_0xb5dbb6?0x0:_0x358645[_0xeca9('0x12')];var _0x5c26b8=_0xb5dbb6?_0x14485b[_0xeca9('0x15')]:_0x358645[_0xeca9('0x12')]+_0x358645[_0xeca9('0x14')];var _0x493b4d;if(_0x5c26b8>=_0x593cd1){_0x5c26b8=_0x593cd1;_0x493b4d=0xc8;}else{_0x493b4d=0xce;}_0x17f6ed[_0xeca9('0xf')](_0x493b4d);return _0x17f6ed[_0xeca9('0x16')](_0xeca9('0x17'),_0x2550b1+'-'+_0x5c26b8+'/'+_0x593cd1)[_0xeca9('0x11')](_0x14485b);}return null;};}function saveUpdates(_0x2b79eb){return function(_0x1dc3c6){if(_0x1dc3c6){return _0x1dc3c6[_0xeca9('0x18')](_0x2b79eb)[_0xeca9('0x19')](function(_0x4b0e12){return _0x4b0e12;});}return null;};}function removeEntity(_0x115827){return function(_0x1fc514){if(_0x1fc514){return _0x1fc514[_0xeca9('0x1a')]()['then'](function(){_0x115827[_0xeca9('0xf')](0xcc)[_0xeca9('0x10')]();});}};}function handleEntityNotFound(_0x551753){return function(_0x1c36fd){if(!_0x1c36fd){_0x551753[_0xeca9('0xe')](0x194);}return _0x1c36fd;};}function handleError(_0x39b664,_0x4216ee){_0x4216ee=_0x4216ee||0x1f4;return function(_0x387682){logger[_0xeca9('0x1b')](_0x387682[_0xeca9('0x1c')]);if(_0x387682[_0xeca9('0x1d')]){delete _0x387682[_0xeca9('0x1d')];}_0x39b664['status'](_0x4216ee)[_0xeca9('0x1e')](_0x387682);};}exports[_0xeca9('0x1f')]=function(_0x52e4a8,_0x209a08){var _0x18b148={};var _0xf997ad=_[_0xeca9('0x20')](db[_0xeca9('0x21')][_0xeca9('0x22')],function(_0x171473){return{'name':_0x171473['fieldName'],'type':_0x171473[_0xeca9('0x23')][_0xeca9('0x24')]};});_0x18b148=qs[_0xeca9('0x25')](_0xf997ad,_0x52e4a8);return interaction[_0xeca9('0x26')](_0xeca9('0x27'),_0x52e4a8[_0xeca9('0x28')],_0x52e4a8[_0xeca9('0x29')],_0x18b148,_0xf997ad)[_0xeca9('0x19')](respondWithFilteredResult(_0x209a08,_0x18b148))[_0xeca9('0x2a')](handleError(_0x209a08,null));};exports[_0xeca9('0x2b')]=function(_0x57589c,_0x29c4a7){var _0x3eb072={'raw':![],'where':{'id':_0x57589c[_0xeca9('0x2c')]['id']}},_0x555bc3={};_0x555bc3[_0xeca9('0x2d')]=_[_0xeca9('0x2e')](db[_0xeca9('0x21')]['rawAttributes']);_0x555bc3['query']=_['keys'](_0x57589c['query']);_0x555bc3[_0xeca9('0x2f')]=_[_0xeca9('0x30')](_0x555bc3[_0xeca9('0x2d')],_0x555bc3['query']);_0x3eb072[_0xeca9('0x31')]=_['intersection'](_0x555bc3[_0xeca9('0x2d')],qs[_0xeca9('0x32')](_0x57589c[_0xeca9('0x28')][_0xeca9('0x32')]));_0x3eb072[_0xeca9('0x31')]=_0x3eb072['attributes'][_0xeca9('0x33')]?_0x3eb072['attributes']:_0x555bc3['model'];if(_0x57589c[_0xeca9('0x28')][_0xeca9('0x34')]){_0x3eb072[_0xeca9('0x35')]=[{'all':!![]}];}_0x3eb072=_['merge']({},_0x3eb072,_0x57589c[_0xeca9('0x36')]);return db[_0xeca9('0x21')][_0xeca9('0x37')](_0x3eb072)['then'](handleEntityNotFound(_0x29c4a7,null))[_0xeca9('0x19')](respondWithResult(_0x29c4a7,null))['catch'](handleError(_0x29c4a7,null));};exports['create']=function(_0x49c2d8,_0x222f22){return db[_0xeca9('0x21')][_0xeca9('0x38')](_0x49c2d8[_0xeca9('0x39')],{})[_0xeca9('0x19')](respondWithResult(_0x222f22,0xc9))[_0xeca9('0x2a')](handleError(_0x222f22,null));};exports[_0xeca9('0x18')]=function(_0x5f23f8,_0x3da407){if(_0x5f23f8[_0xeca9('0x39')]['id']){delete _0x5f23f8['body']['id'];}return db[_0xeca9('0x21')][_0xeca9('0x37')]({'where':{'id':_0x5f23f8[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x3da407,null))['then'](saveUpdates(_0x5f23f8[_0xeca9('0x39')],null))[_0xeca9('0x19')](respondWithResult(_0x3da407,null))[_0xeca9('0x2a')](handleError(_0x3da407,null));};exports[_0xeca9('0x1a')]=function(_0x26e995,_0x1729a9){return db[_0xeca9('0x21')][_0xeca9('0x37')]({'where':{'id':_0x26e995[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x1729a9,null))[_0xeca9('0x19')](removeEntity(_0x1729a9,null))[_0xeca9('0x2a')](handleError(_0x1729a9,null));};exports[_0xeca9('0x3a')]=function(_0x28c848,_0x95baaa){return db[_0xeca9('0x21')][_0xeca9('0x3a')]()['then'](respondWithResult(_0x95baaa,null))[_0xeca9('0x2a')](handleError(_0x95baaa,null));};exports[_0xeca9('0x3b')]=function(_0x35d3ea,_0x5a985e){return db[_0xeca9('0x3c')][_0xeca9('0x37')]({'where':{'id':_0x35d3ea[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x5a985e,null))[_0xeca9('0x19')](function(_0x6bee14){if(_0x6bee14){return _0x6bee14[_0xeca9('0x3b')](_0x35d3ea[_0xeca9('0x39')]['ids'],_['omit'](_0x35d3ea[_0xeca9('0x39')],['ids','id'])||{});}})[_0xeca9('0x19')](respondWithResult(_0x5a985e,null))[_0xeca9('0x2a')](handleError(_0x5a985e,null));};exports['getMessages']=function(_0x4adb1f,_0x477dd2){var _0x63aa82={'raw':![],'where':{}};var _0x12c62c={};var _0x3e29b4={'count':0x0,'rows':[]};return db['MailInteraction'][_0xeca9('0x3d')]({'where':{'id':_0x4adb1f[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x477dd2,null))[_0xeca9('0x19')](function(_0x343ac3){if(_0x343ac3){_0x12c62c[_0xeca9('0x2d')]=_[_0xeca9('0x2e')](db[_0xeca9('0x3c')][_0xeca9('0x22')]);_0x12c62c[_0xeca9('0x28')]=_[_0xeca9('0x2e')](_0x4adb1f['query']);_0x12c62c[_0xeca9('0x2f')]=_[_0xeca9('0x30')](_0x12c62c[_0xeca9('0x2d')],_0x12c62c[_0xeca9('0x28')]);_0x63aa82['attributes']=_['intersection'](_0x12c62c['model'],qs[_0xeca9('0x32')](_0x4adb1f['query'][_0xeca9('0x32')]));_0x63aa82[_0xeca9('0x31')]=_0x63aa82['attributes']['length']?_0x63aa82[_0xeca9('0x31')]:_0x12c62c[_0xeca9('0x2d')];if(!_0x4adb1f['query'][_0xeca9('0x3e')](_0xeca9('0x3f'))){_0x63aa82[_0xeca9('0x14')]=qs['limit'](_0x4adb1f[_0xeca9('0x28')]['limit']);_0x63aa82[_0xeca9('0x12')]=qs[_0xeca9('0x12')](_0x4adb1f['query'][_0xeca9('0x12')]);}_0x63aa82['order']=qs['sort'](_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x40')]);_0x63aa82[_0xeca9('0x41')]=qs[_0xeca9('0x2f')](_['pick'](_0x4adb1f['query'],_0x12c62c[_0xeca9('0x2f')]));_0x63aa82['where'][_0xeca9('0x42')]=_0x343ac3['id'];if(_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x43')]){_0x63aa82[_0xeca9('0x41')]=_[_0xeca9('0x44')](_0x63aa82[_0xeca9('0x41')],{'$or':_[_0xeca9('0x20')](_0x63aa82['attributes'],function(_0xca6683){var _0x41ddac={};_0x41ddac[_0xca6683]={'$like':'%'+_0x4adb1f['query'][_0xeca9('0x43')]+'%'};return _0x41ddac;})});}if(_0x4adb1f[_0xeca9('0x28')]['$gte']){var _0x41a812=_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x45')][_0xeca9('0x46')](',');var _0x5ea78f={};_0x5ea78f[_0x41a812[0x0]]={'$gte':moment(_0x41a812[0x1])[_0xeca9('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x63aa82[_0xeca9('0x41')]=_['merge'](_0x63aa82[_0xeca9('0x41')],_0x5ea78f);}_0x63aa82=_['merge']({},_0x63aa82,_0x4adb1f['options']);return db[_0xeca9('0x3c')][_0xeca9('0x15')]({'where':_0x63aa82['where']})[_0xeca9('0x19')](function(_0x3614ec){_0x3e29b4[_0xeca9('0x15')]=_0x3614ec;if(_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x34')]){_0x63aa82[_0xeca9('0x35')]=[{'all':!![]}];}return db[_0xeca9('0x3c')][_0xeca9('0x26')](_0x63aa82);})[_0xeca9('0x19')](function(_0x442163){if(_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x48')]===_0xeca9('0x49')){for(var _0x487352=0x0;_0x487352<_0x442163[_0xeca9('0x33')];_0x487352++){_0x442163[_0x487352][_0xeca9('0x39')]=juice(_0x442163[_0x487352][_0xeca9('0x39')]);}}_0x3e29b4['rows']=_0x442163;return _0x3e29b4;});}})[_0xeca9('0x19')](respondWithFilteredResult(_0x477dd2,_0x63aa82))[_0xeca9('0x2a')](handleError(_0x477dd2,null));};exports['addTags']=function(_0x478288,_0x2486ad){return db['MailInteraction'][_0xeca9('0x37')]({'where':{'id':_0x478288[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x2486ad,null))[_0xeca9('0x19')](function(_0x5c031a){if(_0x5c031a){return _0x5c031a[_0xeca9('0x4a')](_0x478288[_0xeca9('0x39')][_0xeca9('0x4b')],_[_0xeca9('0x4c')](_0x478288[_0xeca9('0x39')],['ids','id'])||{})['spread'](function(){return db[_0xeca9('0x4d')][_0xeca9('0x26')]({'attributes':['id','name',_0xeca9('0x4e')],'where':{'id':_0x478288[_0xeca9('0x39')][_0xeca9('0x4b')]}});})[_0xeca9('0x19')](function(_0x57f653){socket[_0xeca9('0x4f')](_0xeca9('0x50'),{'id':Number(_0x478288[_0xeca9('0x2c')]['id']),'tags':_0x57f653||[]});return{'id':Number(_0x478288['params']['id']),'tags':_0x57f653||[]};});}})[_0xeca9('0x19')](respondWithResult(_0x2486ad,null))[_0xeca9('0x2a')](handleError(_0x2486ad,null));};exports[_0xeca9('0x51')]=function(_0xdec1f5,_0x6cc974){return db[_0xeca9('0x21')][_0xeca9('0x37')]({'where':{'id':_0xdec1f5[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x6cc974,null))[_0xeca9('0x19')](function(_0x350c2f){if(_0x350c2f){return _0x350c2f[_0xeca9('0x51')](_0xdec1f5['query'][_0xeca9('0x4b')]);}})[_0xeca9('0x19')](respondWithStatusCode(_0x6cc974,null))['catch'](handleError(_0x6cc974,null));};exports['download']=function(_0x563f84,_0x1f3e7e){var _0x5ef4a9=moment()[_0xeca9('0x52')]()['toString']();var _0x4ed77a=path[_0xeca9('0x53')](config[_0xeca9('0x54')],_0xeca9('0x55'),_0xeca9('0x56'),'tmp');var _0x552594=path['join'](config['root'],'server','files',_0xeca9('0x57'));var _0x3d82f2=path[_0xeca9('0x53')](_0x4ed77a,_0x5ef4a9);var _0x714dc9=util['format'](_0xeca9('0x58'),_0x563f84['params']['id'],_0x5ef4a9);var _0x420114=path[_0xeca9('0x53')](_0x4ed77a,_0x714dc9);var _0x4ddf6a=[];if(_0x563f84[_0xeca9('0x28')][_0xeca9('0x57')]){_0x4ddf6a[_0xeca9('0x59')]({'model':db[_0xeca9('0x5a')],'as':_0xeca9('0x5b'),'raw':!![]});}var _0x58ec76=[{'model':db[_0xeca9('0x3c')],'as':_0xeca9('0x5c'),'attributes':['id','body',_0xeca9('0x5d'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x4ddf6a}];return db[_0xeca9('0x21')]['find']({'where':{'id':_0x563f84[_0xeca9('0x2c')]['id']},'include':_0x58ec76})[_0xeca9('0x19')](handleEntityNotFound(_0x1f3e7e,null))['then'](function(_0x5ebddd){if(_0x5ebddd&&_0x5ebddd[_0xeca9('0x5c')]){var _0x2a6bd2=_0x5ebddd[_0xeca9('0x5e')]({'plain':!![]});fs['mkdirSync'](_0x3d82f2);return BPromise[_0xeca9('0x5f')](_0x2a6bd2[_0xeca9('0x5c')],function(_0x1af971,_0x5f3a83){var _0x16ed6c={'from':_0x1af971[_0xeca9('0x5d')],'to':_0x1af971['to']||_0xeca9('0x60'),'subject':_0x1af971[_0xeca9('0x61')],'html':htmlEntities['decode'](_0x1af971[_0xeca9('0x39')]),'headers':{'Date':moment(_0x1af971[_0xeca9('0x62')])[_0xeca9('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1af971['cc']){_0x16ed6c[_0xeca9('0x63')]['Cc']=_0x1af971['cc'];}if(_0x1af971[_0xeca9('0x64')]){_0x16ed6c[_0xeca9('0x63')][_0xeca9('0x65')]=_0x1af971[_0xeca9('0x64')];}return new BPromise(function(_0x44a4b9,_0x12eb75){if(_0x1af971[_0xeca9('0x5b')]){for(var _0x20f21d=0x0;_0x20f21d<_0x1af971[_0xeca9('0x5b')][_0xeca9('0x33')];_0x20f21d++){var _0x76bb6=_0x1af971[_0xeca9('0x5b')][_0x20f21d];var _0x58f5fa=path[_0xeca9('0x53')](_0x552594,_0x76bb6[_0xeca9('0x66')]);if(fs[_0xeca9('0x67')](_0x58f5fa)){_0x16ed6c[_0xeca9('0x57')][_0xeca9('0x59')]({'name':_0x76bb6[_0xeca9('0x1d')],'contentType':_0x76bb6['type'],'data':fs[_0xeca9('0x68')](_0x58f5fa)});}}}emlformat[_0xeca9('0x69')](_0x16ed6c,function(_0x501210,_0x3f40e6){if(_0x501210)return _0x12eb75(_0x501210);fs['writeFileSync'](path[_0xeca9('0x53')](_0x3d82f2,util[_0xeca9('0x47')](_0xeca9('0x6a'),_0x5f3a83)),_0x3f40e6);return _0x44a4b9(_0x3f40e6);});});})[_0xeca9('0x19')](function(){return new BPromise(function(_0x2de11b,_0xea341d){zipdir(_0x3d82f2,{'saveTo':_0x420114},function(_0x3c14c1,_0x438c72){if(_0x3c14c1)return _0xea341d(_0x3c14c1);return _0x2de11b(_0x438c72);});})[_0xeca9('0x19')](function(){return new BPromise(function(_0x18bbce,_0x5eed5b){rimraf(_0x3d82f2,function(_0x55e4c7){if(_0x55e4c7)_0x5eed5b(_0x55e4c7);return _0x18bbce();});});})['then'](function(){return _0x1f3e7e[_0xeca9('0x6b')](_0x420114,_0x714dc9,function(_0x23b52a){if(!_0x23b52a)fs[_0xeca9('0x6c')](_0x420114);});});});}else{return _0x1f3e7e['sendStatus'](0xc8);}})[_0xeca9('0x2a')](handleError(_0x1f3e7e,null));}; \ No newline at end of file +var _0x0541=['headers','Bcc','Attachments','type','readFileSync','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','mail','user','catch','params','model','keys','MailInteraction','query','intersection','fields','attributes','length','include','merge','options','find','create','body','describe','addMessage','MailMessage','omit','getMessages','findOne','hasOwnProperty','order','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','setTags','ids','color','emit','removeTags','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0x0541,0x1d5));var _0x1054=function(_0x2e8b77,_0x5d473c){_0x2e8b77=_0x2e8b77-0x0;var _0xe01d2b=_0x0541[_0x2e8b77];return _0xe01d2b;};'use strict';var emlformat=require(_0x1054('0x0'));var rimraf=require(_0x1054('0x1'));var zipdir=require(_0x1054('0x2'));var moment=require(_0x1054('0x3'));var BPromise=require(_0x1054('0x4'));var util=require(_0x1054('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x1054('0x6'));var juice=require('juice');var Redis=require(_0x1054('0x7'));var interaction=require(_0x1054('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x1054('0x9'))(_0x1054('0xa'));var config=require(_0x1054('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x1054('0xc'));config['redis']=_[_0x1054('0xd')](config[_0x1054('0xe')],{'host':_0x1054('0xf'),'port':0x18eb});var socket=require(_0x1054('0x10'))(new Redis(config[_0x1054('0xe')]));require(_0x1054('0x11'))[_0x1054('0x12')](socket);function respondWithStatusCode(_0x111651,_0xde8f96){_0xde8f96=_0xde8f96||0xcc;return function(_0x1ebf7a){if(_0x1ebf7a){return _0x111651[_0x1054('0x13')](_0xde8f96);}return _0x111651[_0x1054('0x14')](_0xde8f96)[_0x1054('0x15')]();};}function respondWithResult(_0x4d646a,_0x3fe3d8){_0x3fe3d8=_0x3fe3d8||0xc8;return function(_0x5c46cd){if(_0x5c46cd){return _0x4d646a[_0x1054('0x14')](_0x3fe3d8)[_0x1054('0x16')](_0x5c46cd);}};}function respondWithFilteredResult(_0x588008,_0x3499e6){return function(_0x4767c4){if(_0x4767c4){var _0x2f89c2=typeof _0x3499e6['offset']==='undefined'&&typeof _0x3499e6['limit']===_0x1054('0x17');var _0x5684e1=_0x4767c4[_0x1054('0x18')];var _0x305c92=_0x2f89c2?0x0:_0x3499e6[_0x1054('0x19')];var _0x54d3f6=_0x2f89c2?_0x4767c4[_0x1054('0x18')]:_0x3499e6['offset']+_0x3499e6[_0x1054('0x1a')];var _0x4aa4ff;if(_0x54d3f6>=_0x5684e1){_0x54d3f6=_0x5684e1;_0x4aa4ff=0xc8;}else{_0x4aa4ff=0xce;}_0x588008['status'](_0x4aa4ff);return _0x588008['set'](_0x1054('0x1b'),_0x305c92+'-'+_0x54d3f6+'/'+_0x5684e1)['json'](_0x4767c4);}return null;};}function saveUpdates(_0x4aa5c4){return function(_0x5946df){if(_0x5946df){return _0x5946df[_0x1054('0x1c')](_0x4aa5c4)['then'](function(_0xea0692){return _0xea0692;});}return null;};}function removeEntity(_0x5a3abe){return function(_0x38303e){if(_0x38303e){return _0x38303e[_0x1054('0x1d')]()[_0x1054('0x1e')](function(){_0x5a3abe[_0x1054('0x14')](0xcc)[_0x1054('0x15')]();});}};}function handleEntityNotFound(_0x33269c){return function(_0x4e48ac){if(!_0x4e48ac){_0x33269c['sendStatus'](0x194);}return _0x4e48ac;};}function handleError(_0x11e994,_0x481d7d){_0x481d7d=_0x481d7d||0x1f4;return function(_0x5e8fce){logger[_0x1054('0x1f')](_0x5e8fce[_0x1054('0x20')]);if(_0x5e8fce['name']){delete _0x5e8fce[_0x1054('0x21')];}_0x11e994[_0x1054('0x14')](_0x481d7d)[_0x1054('0x22')](_0x5e8fce);};}exports[_0x1054('0x23')]=function(_0x4e2020,_0x35374e){var _0x3759b9={};var _0x5b7bcd=_[_0x1054('0x24')](db['MailInteraction'][_0x1054('0x25')],function(_0x466e76){return{'name':_0x466e76[_0x1054('0x26')],'type':_0x466e76['type'][_0x1054('0x27')]};});_0x3759b9=qs[_0x1054('0x28')](_0x5b7bcd,_0x4e2020);return interaction['findAll'](_0x1054('0x29'),_0x4e2020['query'],_0x4e2020[_0x1054('0x2a')],_0x3759b9,_0x5b7bcd)['then'](respondWithFilteredResult(_0x35374e,_0x3759b9))[_0x1054('0x2b')](handleError(_0x35374e,null));};exports['show']=function(_0x2ab041,_0x4d74ad){var _0x50abd5={'raw':![],'where':{'id':_0x2ab041[_0x1054('0x2c')]['id']}},_0x14b2b3={};_0x14b2b3[_0x1054('0x2d')]=_[_0x1054('0x2e')](db[_0x1054('0x2f')][_0x1054('0x25')]);_0x14b2b3[_0x1054('0x30')]=_['keys'](_0x2ab041[_0x1054('0x30')]);_0x14b2b3['filters']=_['intersection'](_0x14b2b3[_0x1054('0x2d')],_0x14b2b3['query']);_0x50abd5['attributes']=_[_0x1054('0x31')](_0x14b2b3['model'],qs[_0x1054('0x32')](_0x2ab041[_0x1054('0x30')]['fields']));_0x50abd5['attributes']=_0x50abd5[_0x1054('0x33')][_0x1054('0x34')]?_0x50abd5[_0x1054('0x33')]:_0x14b2b3[_0x1054('0x2d')];if(_0x2ab041['query']['includeAll']){_0x50abd5[_0x1054('0x35')]=[{'all':!![]}];}_0x50abd5=_[_0x1054('0x36')]({},_0x50abd5,_0x2ab041[_0x1054('0x37')]);return db[_0x1054('0x2f')][_0x1054('0x38')](_0x50abd5)[_0x1054('0x1e')](handleEntityNotFound(_0x4d74ad,null))['then'](respondWithResult(_0x4d74ad,null))[_0x1054('0x2b')](handleError(_0x4d74ad,null));};exports[_0x1054('0x39')]=function(_0x34e094,_0xdb810d){return db[_0x1054('0x2f')]['create'](_0x34e094['body'],{})[_0x1054('0x1e')](respondWithResult(_0xdb810d,0xc9))['catch'](handleError(_0xdb810d,null));};exports['update']=function(_0x36b8a0,_0x3d8fdf){if(_0x36b8a0[_0x1054('0x3a')]['id']){delete _0x36b8a0[_0x1054('0x3a')]['id'];}return db[_0x1054('0x2f')][_0x1054('0x38')]({'where':{'id':_0x36b8a0[_0x1054('0x2c')]['id']}})[_0x1054('0x1e')](handleEntityNotFound(_0x3d8fdf,null))[_0x1054('0x1e')](saveUpdates(_0x36b8a0[_0x1054('0x3a')],null))[_0x1054('0x1e')](respondWithResult(_0x3d8fdf,null))[_0x1054('0x2b')](handleError(_0x3d8fdf,null));};exports[_0x1054('0x1d')]=function(_0x47a2a1,_0x3584da){return db[_0x1054('0x2f')][_0x1054('0x38')]({'where':{'id':_0x47a2a1[_0x1054('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3584da,null))[_0x1054('0x1e')](removeEntity(_0x3584da,null))[_0x1054('0x2b')](handleError(_0x3584da,null));};exports[_0x1054('0x3b')]=function(_0x5ea549,_0x1e775){return db[_0x1054('0x2f')][_0x1054('0x3b')]()[_0x1054('0x1e')](respondWithResult(_0x1e775,null))[_0x1054('0x2b')](handleError(_0x1e775,null));};exports[_0x1054('0x3c')]=function(_0x21db4f,_0x483527){return db[_0x1054('0x3d')][_0x1054('0x38')]({'where':{'id':_0x21db4f[_0x1054('0x2c')]['id']}})[_0x1054('0x1e')](handleEntityNotFound(_0x483527,null))['then'](function(_0x5d424a){if(_0x5d424a){return _0x5d424a['addMessage'](_0x21db4f['body']['ids'],_[_0x1054('0x3e')](_0x21db4f[_0x1054('0x3a')],['ids','id'])||{});}})[_0x1054('0x1e')](respondWithResult(_0x483527,null))[_0x1054('0x2b')](handleError(_0x483527,null));};exports[_0x1054('0x3f')]=function(_0x3f9c55,_0x357d15){var _0x28d4b5={'raw':![],'where':{}};var _0x1708e8={};var _0x453f7e={'count':0x0,'rows':[]};return db['MailInteraction'][_0x1054('0x40')]({'where':{'id':_0x3f9c55['params']['id']}})[_0x1054('0x1e')](handleEntityNotFound(_0x357d15,null))[_0x1054('0x1e')](function(_0x1762fe){if(_0x1762fe){_0x1708e8[_0x1054('0x2d')]=_['keys'](db[_0x1054('0x3d')][_0x1054('0x25')]);_0x1708e8[_0x1054('0x30')]=_[_0x1054('0x2e')](_0x3f9c55[_0x1054('0x30')]);_0x1708e8['filters']=_[_0x1054('0x31')](_0x1708e8['model'],_0x1708e8['query']);_0x28d4b5[_0x1054('0x33')]=_[_0x1054('0x31')](_0x1708e8[_0x1054('0x2d')],qs[_0x1054('0x32')](_0x3f9c55[_0x1054('0x30')][_0x1054('0x32')]));_0x28d4b5['attributes']=_0x28d4b5['attributes'][_0x1054('0x34')]?_0x28d4b5[_0x1054('0x33')]:_0x1708e8['model'];if(!_0x3f9c55['query'][_0x1054('0x41')]('nolimit')){_0x28d4b5[_0x1054('0x1a')]=qs[_0x1054('0x1a')](_0x3f9c55[_0x1054('0x30')][_0x1054('0x1a')]);_0x28d4b5['offset']=qs[_0x1054('0x19')](_0x3f9c55[_0x1054('0x30')][_0x1054('0x19')]);}_0x28d4b5[_0x1054('0x42')]=qs[_0x1054('0x43')](_0x3f9c55[_0x1054('0x30')][_0x1054('0x43')]);_0x28d4b5[_0x1054('0x44')]=qs[_0x1054('0x45')](_[_0x1054('0x46')](_0x3f9c55[_0x1054('0x30')],_0x1708e8['filters']));_0x28d4b5[_0x1054('0x44')]['MailInteractionId']=_0x1762fe['id'];if(_0x3f9c55[_0x1054('0x30')][_0x1054('0x47')]){_0x28d4b5[_0x1054('0x44')]=_[_0x1054('0x36')](_0x28d4b5['where'],{'$or':_[_0x1054('0x24')](_0x28d4b5[_0x1054('0x33')],function(_0x4f5aed){var _0x14f478={};_0x14f478[_0x4f5aed]={'$like':'%'+_0x3f9c55[_0x1054('0x30')]['filter']+'%'};return _0x14f478;})});}if(_0x3f9c55[_0x1054('0x30')][_0x1054('0x48')]){var _0x134503=_0x3f9c55[_0x1054('0x30')]['$gte'][_0x1054('0x49')](',');var _0x4c2c63={};_0x4c2c63[_0x134503[0x0]]={'$gte':moment(_0x134503[0x1])[_0x1054('0x4a')](_0x1054('0x4b'))};_0x28d4b5['where']=_[_0x1054('0x36')](_0x28d4b5[_0x1054('0x44')],_0x4c2c63);}_0x28d4b5=_[_0x1054('0x36')]({},_0x28d4b5,_0x3f9c55['options']);return db[_0x1054('0x3d')][_0x1054('0x18')]({'where':_0x28d4b5['where']})[_0x1054('0x1e')](function(_0x4051c4){_0x453f7e[_0x1054('0x18')]=_0x4051c4;if(_0x3f9c55[_0x1054('0x30')][_0x1054('0x4c')]){_0x28d4b5['include']=[{'all':!![]}];}return db['MailMessage'][_0x1054('0x4d')](_0x28d4b5);})[_0x1054('0x1e')](function(_0x43c99e){if(_0x3f9c55[_0x1054('0x30')][_0x1054('0x4e')]===_0x1054('0x4f')){for(var _0x355240=0x0;_0x355240<_0x43c99e['length'];_0x355240++){_0x43c99e[_0x355240]['body']=juice(_0x43c99e[_0x355240][_0x1054('0x3a')]);}}_0x453f7e['rows']=_0x43c99e;return _0x453f7e;});}})[_0x1054('0x1e')](respondWithFilteredResult(_0x357d15,_0x28d4b5))[_0x1054('0x2b')](handleError(_0x357d15,null));};exports[_0x1054('0x50')]=function(_0x54f091,_0x53488a){return db[_0x1054('0x2f')][_0x1054('0x38')]({'where':{'id':_0x54f091[_0x1054('0x2c')]['id']}})[_0x1054('0x1e')](handleEntityNotFound(_0x53488a,null))['then'](function(_0x2e69a1){if(_0x2e69a1){return _0x2e69a1[_0x1054('0x51')](_0x54f091[_0x1054('0x3a')][_0x1054('0x52')],_[_0x1054('0x3e')](_0x54f091['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x1054('0x4d')]({'attributes':['id',_0x1054('0x21'),_0x1054('0x53')],'where':{'id':_0x54f091[_0x1054('0x3a')][_0x1054('0x52')]}});})[_0x1054('0x1e')](function(_0x58834d){socket[_0x1054('0x54')]('mailInteractionTags:save',{'id':Number(_0x54f091['params']['id']),'tags':_0x58834d||[]});return{'id':Number(_0x54f091['params']['id']),'tags':_0x58834d||[]};});}})[_0x1054('0x1e')](respondWithResult(_0x53488a,null))[_0x1054('0x2b')](handleError(_0x53488a,null));};exports[_0x1054('0x55')]=function(_0x319af4,_0x5e75f3){return db['MailInteraction']['find']({'where':{'id':_0x319af4['params']['id']}})[_0x1054('0x1e')](handleEntityNotFound(_0x5e75f3,null))['then'](function(_0x3ae8b1){if(_0x3ae8b1){return _0x3ae8b1[_0x1054('0x55')](_0x319af4[_0x1054('0x30')][_0x1054('0x52')]);}})[_0x1054('0x1e')](respondWithStatusCode(_0x5e75f3,null))['catch'](handleError(_0x5e75f3,null));};exports['download']=function(_0xc2591f,_0x2adc77){var _0x28e74e=moment()['unix']()[_0x1054('0x56')]();var _0x518608=path[_0x1054('0x57')](config['root'],_0x1054('0x58'),_0x1054('0x59'),_0x1054('0x5a'));var _0x1e7968=path[_0x1054('0x57')](config[_0x1054('0x5b')],_0x1054('0x58'),'files',_0x1054('0x5c'));var _0x46160e=path[_0x1054('0x57')](_0x518608,_0x28e74e);var _0x16103e=util[_0x1054('0x4a')](_0x1054('0x5d'),_0xc2591f[_0x1054('0x2c')]['id'],_0x28e74e);var _0x102bf0=path[_0x1054('0x57')](_0x518608,_0x16103e);var _0x3b9ad7=[];if(_0xc2591f[_0x1054('0x30')][_0x1054('0x5c')]){_0x3b9ad7[_0x1054('0x5e')]({'model':db[_0x1054('0x5f')],'as':'Attachments','raw':!![]});}var _0x2f3499=[{'model':db[_0x1054('0x3d')],'as':_0x1054('0x60'),'attributes':['id',_0x1054('0x3a'),_0x1054('0x61'),'to','cc','bcc','subject',_0x1054('0x62')],'where':{'secret':![]},'order':qs[_0x1054('0x43')]('id'),'include':_0x3b9ad7}];return db['MailInteraction']['find']({'where':{'id':_0xc2591f['params']['id']},'include':_0x2f3499})[_0x1054('0x1e')](handleEntityNotFound(_0x2adc77,null))['then'](function(_0x3720d7){if(_0x3720d7&&_0x3720d7[_0x1054('0x60')]){var _0x174778=_0x3720d7[_0x1054('0x63')]({'plain':!![]});fs[_0x1054('0x64')](_0x46160e);return BPromise[_0x1054('0x65')](_0x174778[_0x1054('0x60')],function(_0x5ada37,_0x2119c1){var _0x140174={'from':_0x5ada37[_0x1054('0x61')],'to':_0x5ada37['to']||_0x1054('0x66'),'subject':_0x5ada37[_0x1054('0x67')],'html':htmlEntities['decode'](_0x5ada37['body']),'headers':{'Date':moment(_0x5ada37[_0x1054('0x62')])[_0x1054('0x4a')](_0x1054('0x68'))},'attachments':[]};if(_0x5ada37['cc']){_0x140174['headers']['Cc']=_0x5ada37['cc'];}if(_0x5ada37[_0x1054('0x69')]){_0x140174[_0x1054('0x6a')][_0x1054('0x6b')]=_0x5ada37[_0x1054('0x69')];}return new BPromise(function(_0x23e350,_0x22e670){if(_0x5ada37[_0x1054('0x6c')]){for(var _0x1fd40e=0x0;_0x1fd40e<_0x5ada37[_0x1054('0x6c')][_0x1054('0x34')];_0x1fd40e++){var _0x3a132d=_0x5ada37[_0x1054('0x6c')][_0x1fd40e];var _0x3a6807=path['join'](_0x1e7968,_0x3a132d['basename']);if(fs['existsSync'](_0x3a6807)){_0x140174[_0x1054('0x5c')]['push']({'name':_0x3a132d[_0x1054('0x21')],'contentType':_0x3a132d[_0x1054('0x6d')],'data':fs[_0x1054('0x6e')](_0x3a6807)});}}}emlformat['build'](_0x140174,function(_0x31ff6,_0x4b296b){if(_0x31ff6)return _0x22e670(_0x31ff6);fs[_0x1054('0x6f')](path[_0x1054('0x57')](_0x46160e,util[_0x1054('0x4a')](_0x1054('0x70'),_0x2119c1)),_0x4b296b);return _0x23e350(_0x4b296b);});});})[_0x1054('0x1e')](function(){return new BPromise(function(_0x12fd06,_0x2521b5){zipdir(_0x46160e,{'saveTo':_0x102bf0},function(_0x344efb,_0x15ef53){if(_0x344efb)return _0x2521b5(_0x344efb);return _0x12fd06(_0x15ef53);});})[_0x1054('0x1e')](function(){return new BPromise(function(_0x1d6083,_0x6f54f8){rimraf(_0x46160e,function(_0x45c3aa){if(_0x45c3aa)_0x6f54f8(_0x45c3aa);return _0x1d6083();});});})[_0x1054('0x1e')](function(){return _0x2adc77[_0x1054('0x71')](_0x102bf0,_0x16103e,function(_0x2394c8){if(!_0x2394c8)fs[_0x1054('0x72')](_0x102bf0);});});});}else{return _0x2adc77[_0x1054('0x13')](0xc8);}})['catch'](handleError(_0x2adc77,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 40f76de..5d08659 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 _0x1ea4=['update','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','setMaxListeners'];(function(_0x373726,_0x110d27){var _0x25396a=function(_0x209e00){while(--_0x209e00){_0x373726['push'](_0x373726['shift']());}};_0x25396a(++_0x110d27);}(_0x1ea4,0xcf));var _0x41ea=function(_0xebf5bc,_0xe37dba){_0xebf5bc=_0xebf5bc-0x0;var _0x401f09=_0x1ea4[_0xebf5bc];return _0x401f09;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x41ea('0x0'))['db'][_0x41ea('0x1')];var MailMessage=require(_0x41ea('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x41ea('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x41ea('0x3'),'afterDestroy':'remove'};function emitEvent(_0x95cd93){return function(_0x5dc6f6,_0x1b7358,_0x7ac795){_0x5dc6f6['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x450897){_0x5dc6f6['setDataValue']('Users',_0x450897[_0x41ea('0x4')](function(_0x390b34){return{'id':_0x390b34['id']};}));return MailMessage[_0x41ea('0x5')]({'where':{'MailInteractionId':_0x5dc6f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x41ea('0x6')](function(_0x3aec27){_0x5dc6f6[_0x41ea('0x7')](_0x41ea('0x8'),_0x3aec27[_0x41ea('0x9')]);MailInteractionEvents['emit'](_0x95cd93+':'+_0x5dc6f6['id'],_0x5dc6f6);MailInteractionEvents[_0x41ea('0xa')](_0x95cd93,_0x5dc6f6);_0x7ac795(null);})[_0x41ea('0xb')](_0x7ac795(null));};}for(var e in events){if(events[_0x41ea('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x41ea('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0x7785=['then','setDataValue','Users','findAll','length','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers'];(function(_0x4225cc,_0x3e2c6e){var _0x32d08a=function(_0x20a022){while(--_0x20a022){_0x4225cc['push'](_0x4225cc['shift']());}};_0x32d08a(++_0x3e2c6e);}(_0x7785,0xa8));var _0x5778=function(_0x338c58,_0x125310){_0x338c58=_0x338c58-0x0;var _0x2112d4=_0x7785[_0x338c58];return _0x2112d4;};'use strict';var EventEmitter=require(_0x5778('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x5778('0x1')];var MailMessage=require(_0x5778('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5778('0x3')](0x0);var events={'afterCreate':_0x5778('0x4'),'afterUpdate':_0x5778('0x5'),'afterDestroy':_0x5778('0x6')};function emitEvent(_0x35b8d6){return function(_0x50c516,_0x3c6e15,_0x419897){_0x50c516[_0x5778('0x7')]({'attributes':['id'],'raw':!![]})[_0x5778('0x8')](function(_0x167385){_0x50c516[_0x5778('0x9')](_0x5778('0xa'),_0x167385['map'](function(_0x1f4848){return{'id':_0x1f4848['id']};}));return MailMessage[_0x5778('0xb')]({'where':{'MailInteractionId':_0x50c516['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41820d){_0x50c516[_0x5778('0x9')]('unreadMessages',_0x41820d[_0x5778('0xc')]);MailInteractionEvents['emit'](_0x35b8d6+':'+_0x50c516['id'],_0x50c516);MailInteractionEvents['emit'](_0x35b8d6,_0x50c516);_0x419897(null);})['catch'](_0x419897(null));};}for(var e in events){if(events[_0x5778('0xd')](e)){var event=events[e];MailInteraction[_0x5778('0xe')](e,emitEvent(event));}}module[_0x5778('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 d26eba4..03bfb38 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 _0x4690=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT'];(function(_0x45c61e,_0x59694d){var _0x19033c=function(_0x19fc2b){while(--_0x19fc2b){_0x45c61e['push'](_0x45c61e['shift']());}};_0x19033c(++_0x59694d);}(_0x4690,0xf5));var _0x0469=function(_0x129376,_0x555cb0){_0x129376=_0x129376-0x0;var _0x28c136=_0x4690[_0x129376];return _0x28c136;};'use strict';var _=require(_0x0469('0x0'));var util=require(_0x0469('0x1'));var logger=require(_0x0469('0x2'))(_0x0469('0x3'));var moment=require(_0x0469('0x4'));var BPromise=require(_0x0469('0x5'));var rp=require(_0x0469('0x6'));var fs=require('fs');var path=require(_0x0469('0x7'));var rimraf=require(_0x0469('0x8'));var config=require('../../config/environment');var attributes=require(_0x0469('0x9'));module[_0x0469('0xa')]=function(_0x433451,_0x196ed8){return _0x433451[_0x0469('0xb')](_0x0469('0xc'),attributes,{'tableName':_0x0469('0xd'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x0469('0xe'),'to'],'type':_0x0469('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50fc62,_0x49d8b9,_0x13e088){if(_0x50fc62[_0x0469('0x10')]){_0x50fc62[_0x0469('0x11')]=moment()[_0x0469('0x12')](_0x0469('0x13'));}if(_0x50fc62[_0x0469('0x14')]){_0x50fc62['closedAt']=moment()[_0x0469('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x13e088(null,_0x49d8b9);},'beforeUpdate':function(_0x582b67,_0x4beeb2,_0x55692d){if(_0x582b67['changed'](_0x0469('0x10'))){_0x582b67[_0x0469('0x11')]=_0x582b67['substatus']?moment()[_0x0469('0x12')](_0x0469('0x13')):null;}if(_0x582b67[_0x0469('0x15')](_0x0469('0x14'))){_0x582b67[_0x0469('0x16')]=moment()['format'](_0x0469('0x13'));_0x582b67[_0x0469('0x10')]=null;_0x582b67[_0x0469('0x11')]=null;}_0x55692d(null,_0x582b67);},'afterUpdate':function(_0x4a9321,_0x593c,_0x289193){var _0x5d15ea=_0x433451['models'];var _0x3aa813=_0x4a9321[_0x0469('0x17')]({'plain':!![]});if(_0x3aa813['closed']){return _0x5d15ea[_0x0469('0x18')][_0x0469('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x3aa813['id']}})[_0x0469('0x1a')](function(){_0x289193();})['catch'](function(_0x296480){_0x289193(_0x296480);});}else{_0x289193();}}},'charset':_0x0469('0x1b'),'collate':_0x0469('0x1c')});}; \ No newline at end of file +var _0xc2b0=['path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','substatusAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise'];(function(_0x1bf857,_0x4f2e22){var _0x48d825=function(_0x1e3c93){while(--_0x1e3c93){_0x1bf857['push'](_0x1bf857['shift']());}};_0x48d825(++_0x4f2e22);}(_0xc2b0,0x1d8));var _0x0c2b=function(_0x2cf7dd,_0x26172a){_0x2cf7dd=_0x2cf7dd-0x0;var _0x20450a=_0xc2b0[_0x2cf7dd];return _0x20450a;};'use strict';var _=require(_0x0c2b('0x0'));var util=require(_0x0c2b('0x1'));var logger=require(_0x0c2b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0c2b('0x3'));var fs=require('fs');var path=require(_0x0c2b('0x4'));var rimraf=require(_0x0c2b('0x5'));var config=require(_0x0c2b('0x6'));var attributes=require(_0x0c2b('0x7'));module[_0x0c2b('0x8')]=function(_0x51837a,_0x25b5a1){return _0x51837a[_0x0c2b('0x9')]('MailInteraction',attributes,{'tableName':_0x0c2b('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x0c2b('0xb'),'to'],'type':_0x0c2b('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4af86a,_0x58dd24,_0x3c05e8){if(_0x4af86a[_0x0c2b('0xd')]){_0x4af86a['substatusAt']=moment()['format'](_0x0c2b('0xe'));}if(_0x4af86a[_0x0c2b('0xf')]){_0x4af86a[_0x0c2b('0x10')]=moment()['format'](_0x0c2b('0xe'));}_0x3c05e8(null,_0x58dd24);},'beforeUpdate':function(_0xaed13,_0x3001a2,_0x24361b){if(_0xaed13[_0x0c2b('0x11')](_0x0c2b('0xd'))){_0xaed13['substatusAt']=_0xaed13['substatus']?moment()[_0x0c2b('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xaed13[_0x0c2b('0x11')](_0x0c2b('0xf'))){_0xaed13['closedAt']=moment()[_0x0c2b('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0xaed13[_0x0c2b('0xd')]=null;_0xaed13[_0x0c2b('0x13')]=null;}_0x24361b(null,_0xaed13);},'afterUpdate':function(_0x262fee,_0x5988e6,_0x1bcbb2){var _0x9e7f4a=_0x51837a[_0x0c2b('0x14')];var _0x4b2c6b=_0x262fee[_0x0c2b('0x15')]({'plain':!![]});if(_0x4b2c6b['closed']){return _0x9e7f4a[_0x0c2b('0x16')][_0x0c2b('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x4b2c6b['id']}})[_0x0c2b('0x18')](function(){_0x1bcbb2();})[_0x0c2b('0x19')](function(_0x5e6e84){_0x1bcbb2(_0x5e6e84);});}else{_0x1bcbb2();}}},'charset':_0x0c2b('0x1a'),'collate':_0x0c2b('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3e536b3..4b3acda 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 _0x49ca=['redis','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','limit','AddTagsToMailInteraction','find','addTags','body','ids','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x4c2769,_0x42aadd){var _0x27bdf9=function(_0x4136a5){while(--_0x4136a5){_0x4c2769['push'](_0x4c2769['shift']());}};_0x27bdf9(++_0x42aadd);}(_0x49ca,0x129));var _0xa49c=function(_0x1d810b,_0xe84392){_0x1d810b=_0x1d810b-0x0;var _0x5b7387=_0x49ca[_0x1d810b];return _0x5b7387;};'use strict';var _=require(_0xa49c('0x0'));var util=require(_0xa49c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa49c('0x2'));var fs=require('fs');var Redis=require(_0xa49c('0x3'));var db=require(_0xa49c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa49c('0x5'));var config=require(_0xa49c('0x6'));var jayson=require(_0xa49c('0x7'));var client=jayson['client'][_0xa49c('0x8')]({'port':0x232a});config[_0xa49c('0x9')]=_['defaults'](config[_0xa49c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa49c('0x9')]));require('./mailInteraction.socket')[_0xa49c('0xa')](socket);function respondWithRpcPromise(_0x5d5715,_0x30adb1,_0x142ac0){return new BPromise(function(_0x945aed,_0x43152a){return client['request'](_0x5d5715,_0x142ac0)[_0xa49c('0xb')](function(_0x472d19){logger[_0xa49c('0xc')](_0xa49c('0xd'),_0x30adb1,_0xa49c('0xe'));logger[_0xa49c('0xf')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x30adb1,_0xa49c('0xe'),JSON[_0xa49c('0x10')](_0x472d19));if(_0x472d19[_0xa49c('0x11')]){if(_0x472d19[_0xa49c('0x11')][_0xa49c('0x12')]===0x1f4){logger[_0xa49c('0x11')](_0xa49c('0xd'),_0x30adb1,_0x472d19[_0xa49c('0x11')][_0xa49c('0x13')]);return _0x43152a(_0x472d19[_0xa49c('0x11')][_0xa49c('0x13')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x30adb1,_0x472d19[_0xa49c('0x11')][_0xa49c('0x13')]);return _0x945aed(_0x472d19['error']['message']);}else{logger[_0xa49c('0xc')]('MailInteraction,\x20%s,\x20%s',_0x30adb1,'request\x20sent');_0x945aed(_0x472d19['result'][_0xa49c('0x13')]);}})[_0xa49c('0x14')](function(_0x351b30){logger[_0xa49c('0x11')]('MailInteraction,\x20%s,\x20%s',_0x30adb1,_0x351b30);_0x43152a(_0x351b30);});});}exports[_0xa49c('0x15')]=function(_0x1e3766){var _0x57b760=this;return new Promise(function(_0xc753c0,_0x36d500){return db[_0xa49c('0x16')][_0xa49c('0x17')](_0x1e3766['body'],{'raw':_0x1e3766[_0xa49c('0x18')]?_0x1e3766['options'][_0xa49c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e3766[_0xa49c('0x18')]?_0x1e3766[_0xa49c('0x18')][_0xa49c('0x1a')]||null:null,'attributes':_0x1e3766['options']?_0x1e3766[_0xa49c('0x18')]['attributes']||null:null,'limit':_0x1e3766[_0xa49c('0x18')]?_0x1e3766[_0xa49c('0x18')][_0xa49c('0x1b')]||null:null})['then'](function(_0x4a757f){logger[_0xa49c('0xc')](_0xa49c('0x15'),_0x1e3766);logger[_0xa49c('0xf')](_0xa49c('0x15'),_0x1e3766,JSON['stringify'](_0x4a757f));_0xc753c0(_0x4a757f);})['catch'](function(_0x9e9065){logger[_0xa49c('0x11')]('UpdateMailInteraction',_0x9e9065[_0xa49c('0x13')],_0x1e3766);_0x36d500(_0x57b760[_0xa49c('0x11')](0x1f4,_0x9e9065['message']));});});};exports[_0xa49c('0x1c')]=function(_0x4d5eaf){return new Promise(function(_0x27d160,_0x2a81ac){return db[_0xa49c('0x16')][_0xa49c('0x1d')]({'where':_0x4d5eaf['options']?_0x4d5eaf[_0xa49c('0x18')][_0xa49c('0x1a')]||null:null})[_0xa49c('0xb')](function(_0x137e05){if(_0x137e05){return _0x137e05[_0xa49c('0x1e')](_0x4d5eaf[_0xa49c('0x1f')][_0xa49c('0x20')],_['omit'](_0x4d5eaf[_0xa49c('0x1f')],[_0xa49c('0x20'),'id'])||{});}})['spread'](function(_0x580432){logger[_0xa49c('0xc')]('AddTags',_0x4d5eaf);logger[_0xa49c('0xf')](_0xa49c('0x21'),_0x4d5eaf,JSON[_0xa49c('0x10')](_0x580432));_0x27d160(_0x580432);})[_0xa49c('0x14')](function(_0x1cec74){logger['error'](_0xa49c('0x21'),_0x1cec74[_0xa49c('0x13')],_0x4d5eaf);_0x2a81ac(_this[_0xa49c('0x11')](0x1f4,_0x1cec74[_0xa49c('0x13')]));});});}; \ No newline at end of file +var _0x8b43=['ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','AddTagsToMailInteraction','MailInteraction','find'];(function(_0x394702,_0x1a602d){var _0x5b8263=function(_0x3faba9){while(--_0x3faba9){_0x394702['push'](_0x394702['shift']());}};_0x5b8263(++_0x1a602d);}(_0x8b43,0x7e));var _0x38b4=function(_0x3e3468,_0x2f6314){_0x3e3468=_0x3e3468-0x0;var _0x410cf9=_0x8b43[_0x3e3468];return _0x410cf9;};'use strict';var _=require(_0x38b4('0x0'));var util=require(_0x38b4('0x1'));var moment=require(_0x38b4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38b4('0x3'));var db=require(_0x38b4('0x4'))['db'];var utils=require(_0x38b4('0x5'));var logger=require('../../config/logger')(_0x38b4('0x6'));var config=require(_0x38b4('0x7'));var jayson=require(_0x38b4('0x8'));var client=jayson[_0x38b4('0x9')][_0x38b4('0xa')]({'port':0x232a});config[_0x38b4('0xb')]=_[_0x38b4('0xc')](config['redis'],{'host':_0x38b4('0xd'),'port':0x18eb});var socket=require(_0x38b4('0xe'))(new Redis(config[_0x38b4('0xb')]));require(_0x38b4('0xf'))[_0x38b4('0x10')](socket);function respondWithRpcPromise(_0x13e304,_0x5827dd,_0x3f16dd){return new BPromise(function(_0x2d3fe4,_0x27bb11){return client['request'](_0x13e304,_0x3f16dd)[_0x38b4('0x11')](function(_0x256969){logger[_0x38b4('0x12')](_0x38b4('0x13'),_0x5827dd,'request\x20sent');logger[_0x38b4('0x14')](_0x38b4('0x15'),_0x5827dd,_0x38b4('0x16'),JSON[_0x38b4('0x17')](_0x256969));if(_0x256969[_0x38b4('0x18')]){if(_0x256969[_0x38b4('0x18')][_0x38b4('0x19')]===0x1f4){logger[_0x38b4('0x18')](_0x38b4('0x13'),_0x5827dd,_0x256969[_0x38b4('0x18')][_0x38b4('0x1a')]);return _0x27bb11(_0x256969['error'][_0x38b4('0x1a')]);}logger[_0x38b4('0x18')](_0x38b4('0x13'),_0x5827dd,_0x256969['error']['message']);return _0x2d3fe4(_0x256969[_0x38b4('0x18')][_0x38b4('0x1a')]);}else{logger['info'](_0x38b4('0x13'),_0x5827dd,_0x38b4('0x16'));_0x2d3fe4(_0x256969['result']['message']);}})[_0x38b4('0x1b')](function(_0x355362){logger[_0x38b4('0x18')](_0x38b4('0x13'),_0x5827dd,_0x355362);_0x27bb11(_0x355362);});});}exports[_0x38b4('0x1c')]=function(_0x2aa103){var _0x5e5514=this;return new Promise(function(_0x73a686,_0x59a99f){return db['MailInteraction'][_0x38b4('0x1d')](_0x2aa103[_0x38b4('0x1e')],{'raw':_0x2aa103[_0x38b4('0x1f')]?_0x2aa103[_0x38b4('0x1f')][_0x38b4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aa103[_0x38b4('0x1f')]?_0x2aa103[_0x38b4('0x1f')][_0x38b4('0x21')]||null:null,'attributes':_0x2aa103[_0x38b4('0x1f')]?_0x2aa103[_0x38b4('0x1f')][_0x38b4('0x22')]||null:null,'limit':_0x2aa103[_0x38b4('0x1f')]?_0x2aa103[_0x38b4('0x1f')]['limit']||null:null})[_0x38b4('0x11')](function(_0x236f24){logger[_0x38b4('0x12')](_0x38b4('0x1c'),_0x2aa103);logger['debug']('UpdateMailInteraction',_0x2aa103,JSON[_0x38b4('0x17')](_0x236f24));_0x73a686(_0x236f24);})['catch'](function(_0x2006c4){logger[_0x38b4('0x18')](_0x38b4('0x1c'),_0x2006c4[_0x38b4('0x1a')],_0x2aa103);_0x59a99f(_0x5e5514['error'](0x1f4,_0x2006c4[_0x38b4('0x1a')]));});});};exports[_0x38b4('0x23')]=function(_0x35b9c1){return new Promise(function(_0x5c77ae,_0x360e60){return db[_0x38b4('0x24')][_0x38b4('0x25')]({'where':_0x35b9c1[_0x38b4('0x1f')]?_0x35b9c1[_0x38b4('0x1f')]['where']||null:null})[_0x38b4('0x11')](function(_0x444840){if(_0x444840){return _0x444840['addTags'](_0x35b9c1[_0x38b4('0x1e')][_0x38b4('0x26')],_['omit'](_0x35b9c1['body'],[_0x38b4('0x26'),'id'])||{});}})[_0x38b4('0x27')](function(_0x3bb787){logger[_0x38b4('0x12')]('AddTags',_0x35b9c1);logger[_0x38b4('0x14')](_0x38b4('0x28'),_0x35b9c1,JSON[_0x38b4('0x17')](_0x3bb787));_0x5c77ae(_0x3bb787);})['catch'](function(_0x429b03){logger['error'](_0x38b4('0x28'),_0x429b03['message'],_0x35b9c1);_0x360e60(_this[_0x38b4('0x18')](0x1f4,_0x429b03['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 11cdcc8..fedb61b 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 _0x2dda=['removeListener','register','length','save','remove','emit'];(function(_0x2e1db2,_0x12c9fd){var _0x396f12=function(_0x3f6724){while(--_0x3f6724){_0x2e1db2['push'](_0x2e1db2['shift']());}};_0x396f12(++_0x12c9fd);}(_0x2dda,0x1e9));var _0xa2dd=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2dda[_0x2dafbe];return _0x58a45a;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa2dd('0x0'),_0xa2dd('0x1'),'update'];function createListener(_0x10fe46,_0x13da35){return function(_0x18cafb){_0x13da35[_0xa2dd('0x2')](_0x10fe46,_0x18cafb);};}function removeListener(_0x57bb11,_0x5b4508){return function(){MailInteractionEvents[_0xa2dd('0x3')](_0x57bb11,_0x5b4508);};}exports[_0xa2dd('0x4')]=function(_0x56cc6a){for(var _0x200595=0x0,_0x4c1c95=events[_0xa2dd('0x5')];_0x200595<_0x4c1c95;_0x200595++){var _0x52bd8c=events[_0x200595];var _0x4e202d=createListener('mailInteraction:'+_0x52bd8c,_0x56cc6a);MailInteractionEvents['on'](_0x52bd8c,_0x4e202d);}}; \ No newline at end of file +var _0x5791=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x4c8f98,_0x26ba4b){var _0x5d361a=function(_0x370621){while(--_0x370621){_0x4c8f98['push'](_0x4c8f98['shift']());}};_0x5d361a(++_0x26ba4b);}(_0x5791,0x12b));var _0x1579=function(_0x190725,_0x4c879f){_0x190725=_0x190725-0x0;var _0x4fe2de=_0x5791[_0x190725];return _0x4fe2de;};'use strict';var MailInteractionEvents=require(_0x1579('0x0'));var events=[_0x1579('0x1'),_0x1579('0x2'),_0x1579('0x3')];function createListener(_0x46e1e8,_0x5df88b){return function(_0x5317cf){_0x5df88b[_0x1579('0x4')](_0x46e1e8,_0x5317cf);};}function removeListener(_0x5d5179,_0x24f0e1){return function(){MailInteractionEvents['removeListener'](_0x5d5179,_0x24f0e1);};}exports[_0x1579('0x5')]=function(_0x4cf96d){for(var _0x57a86f=0x0,_0x565825=events[_0x1579('0x6')];_0x57a86f<_0x565825;_0x57a86f++){var _0x130085=events[_0x57a86f];var _0x15d146=createListener(_0x1579('0x7')+_0x130085,_0x4cf96d);MailInteractionEvents['on'](_0x130085,_0x15d146);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index af9ae6c..a567714 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 _0x20c6=['put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','show','/:id/download','download','post','mail','mailmessage:create','create','/:id','update'];(function(_0x5724a2,_0x2ed2e3){var _0x27a0f0=function(_0x4a6115){while(--_0x4a6115){_0x5724a2['push'](_0x5724a2['shift']());}};_0x27a0f0(++_0x2ed2e3);}(_0x20c6,0x1e8));var _0x620c=function(_0x338b15,_0x1b3a97){_0x338b15=_0x338b15-0x0;var _0x457c5e=_0x20c6[_0x338b15];return _0x457c5e;};'use strict';var multer=require(_0x620c('0x0'));var util=require(_0x620c('0x1'));var path=require(_0x620c('0x2'));var timeout=require(_0x620c('0x3'));var express=require(_0x620c('0x4'));var router=express[_0x620c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x620c('0x6'));var config=require(_0x620c('0x7'));var controller=require(_0x620c('0x8'));router['get']('/',auth[_0x620c('0x9')](),controller[_0x620c('0xa')]);router[_0x620c('0xb')](_0x620c('0xc'),auth[_0x620c('0x9')](),controller['describe']);router['get']('/:id',auth[_0x620c('0x9')](),controller[_0x620c('0xd')]);router[_0x620c('0xb')](_0x620c('0xe'),auth['isAuthenticated'](),controller[_0x620c('0xf')]);router[_0x620c('0x10')]('/',auth[_0x620c('0x9')](),interaction['tracked'](_0x620c('0x11'),_0x620c('0x12')),controller[_0x620c('0x13')]);router['put'](_0x620c('0x14'),auth[_0x620c('0x9')](),controller[_0x620c('0x15')]);router[_0x620c('0x16')](_0x620c('0x17'),auth[_0x620c('0x9')](),controller[_0x620c('0x18')]);router[_0x620c('0x16')](_0x620c('0x19'),auth[_0x620c('0x9')](),controller[_0x620c('0x1a')]);router[_0x620c('0x1b')](_0x620c('0x14'),auth[_0x620c('0x9')](),controller[_0x620c('0x1c')]);module[_0x620c('0x1d')]=router; \ No newline at end of file +var _0x4c71=['mailmessage:create','create','update','put','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x4c71,0x12b));var _0x14c7=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4c71[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0x14c7('0x0'));var util=require(_0x14c7('0x1'));var path=require('path');var timeout=require(_0x14c7('0x2'));var express=require(_0x14c7('0x3'));var router=express[_0x14c7('0x4')]();var fs_extra=require(_0x14c7('0x5'));var auth=require(_0x14c7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x14c7('0x7'));var controller=require(_0x14c7('0x8'));router[_0x14c7('0x9')]('/',auth[_0x14c7('0xa')](),controller[_0x14c7('0xb')]);router['get'](_0x14c7('0xc'),auth[_0x14c7('0xa')](),controller[_0x14c7('0xd')]);router[_0x14c7('0x9')](_0x14c7('0xe'),auth['isAuthenticated'](),controller[_0x14c7('0xf')]);router['get'](_0x14c7('0x10'),auth[_0x14c7('0xa')](),controller['download']);router[_0x14c7('0x11')]('/',auth[_0x14c7('0xa')](),interaction[_0x14c7('0x12')](_0x14c7('0x13'),_0x14c7('0x14')),controller[_0x14c7('0x15')]);router['put']('/:id',auth[_0x14c7('0xa')](),controller[_0x14c7('0x16')]);router[_0x14c7('0x17')](_0x14c7('0x18'),auth[_0x14c7('0xa')](),controller[_0x14c7('0x19')]);router['put']('/:id/reject',auth[_0x14c7('0xa')](),controller[_0x14c7('0x1a')]);router['delete'](_0x14c7('0xe'),auth[_0x14c7('0xa')](),controller[_0x14c7('0x1b')]);module[_0x14c7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1dfe3ae..2dae84b 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 _0x412b=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','Chat','Email','sequelize','lodash'];(function(_0x43645f,_0x656278){var _0x36f9ab=function(_0x20f6ec){while(--_0x20f6ec){_0x43645f['push'](_0x43645f['shift']());}};_0x36f9ab(++_0x656278);}(_0x412b,0x19e));var _0xb412=function(_0x5c9b67,_0x1e177f){_0x5c9b67=_0x5c9b67-0x0;var _0x4a7f75=_0x412b[_0x5c9b67];return _0x4a7f75;};'use strict';var Sequelize=require(_0xb412('0x0'));var _=require(_0xb412('0x1'));module[_0xb412('0x2')]={'body':{'type':Sequelize[_0xb412('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x4'))},'read':{'type':Sequelize[_0xb412('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb412('0x6')]('in','out'),'defaultValue':_0xb412('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb412('0x8')](0x1fe)},'from':{'type':Sequelize[_0xb412('0x8')]},'to':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x9'))},'cc':{'type':Sequelize[_0xb412('0x3')]('long')},'bcc':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x9'))},'subject':{'type':Sequelize[_0xb412('0x3')]},'sentAt':{'type':Sequelize[_0xb412('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb412('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb412('0xa')]},'originTo':{'type':Sequelize[_0xb412('0x3')]('long')},'originCc':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x9'))},'originChannel':{'type':Sequelize[_0xb412('0x6')]('Email',_0xb412('0xb')),'defaultValue':_0xb412('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xfec8=['lodash','TEXT','ENUM','out','STRING','long','DATE','BOOLEAN','Email','Chat','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfec8,0x107));var _0x8fec=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xfec8[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0x8fec('0x0'));var _=require(_0x8fec('0x1'));module['exports']={'body':{'type':Sequelize[_0x8fec('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8fec('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8fec('0x3')]('in',_0x8fec('0x4')),'defaultValue':_0x8fec('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x8fec('0x5')]},'to':{'type':Sequelize[_0x8fec('0x2')](_0x8fec('0x6'))},'cc':{'type':Sequelize[_0x8fec('0x2')](_0x8fec('0x6'))},'bcc':{'type':Sequelize[_0x8fec('0x2')](_0x8fec('0x6'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x8fec('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8fec('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8fec('0x7')]},'originTo':{'type':Sequelize[_0x8fec('0x2')](_0x8fec('0x6'))},'originCc':{'type':Sequelize[_0x8fec('0x2')](_0x8fec('0x6'))},'originChannel':{'type':Sequelize[_0x8fec('0x3')](_0x8fec('0x9'),_0x8fec('0xa')),'defaultValue':_0x8fec('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1e1b8b4..26a22f8 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 _0xc22b=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','offset','undefined','limit','set','json','destroy','end','sendStatus','name','send','index','map','MailMessage','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','show','params','rawAttributes','options','update','body','find','describe','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','create','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','mail','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','User','fullname','interface','fromString','unix','toString','server','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','jayson/promise','client','http','request','then'];(function(_0x5c68ed,_0x139fd3){var _0x5cb923=function(_0x4de5b6){while(--_0x4de5b6){_0x5c68ed['push'](_0x5c68ed['shift']());}};_0x5cb923(++_0x139fd3);}(_0xc22b,0x8a));var _0xbc22=function(_0x142acd,_0x2e71fe){_0x142acd=_0x142acd-0x0;var _0x497c02=_0xc22b[_0x142acd];return _0x497c02;};'use strict';var emlformat=require(_0xbc22('0x0'));var moment=require(_0xbc22('0x1'));var BPromise=require(_0xbc22('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xbc22('0x3'));var Redis=require(_0xbc22('0x4'));var htmlToText=require(_0xbc22('0x5'));var qs=require(_0xbc22('0x6'));var logger=require('../../config/logger')(_0xbc22('0x7'));var interaction_log=require(_0xbc22('0x8'))('mail-interactions');var config=require(_0xbc22('0x9'));var db=require(_0xbc22('0xa'))['db'];config['redis']=_[_0xbc22('0xb')](config['redis'],{'host':_0xbc22('0xc'),'port':0x18eb});var socket=require(_0xbc22('0xd'))(new Redis(config[_0xbc22('0xe')]));var htmlEntities=require('html-entities');require(_0xbc22('0xf'))[_0xbc22('0x10')](socket);var jayson=require(_0xbc22('0x11'));var client=jayson[_0xbc22('0x12')][_0xbc22('0x13')]({'port':0x232c});var client9003=jayson[_0xbc22('0x12')][_0xbc22('0x13')]({'port':0x232b});var client9002=jayson[_0xbc22('0x12')][_0xbc22('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x30d59f,_0x144f44,_0x403939,_0x1cfa48){return new BPromise(function(_0x15b1d2,_0x49a91b){var _0x3ac6dc=_0x1cfa48||client;return _0x3ac6dc[_0xbc22('0x14')](_0x30d59f,_0x403939)[_0xbc22('0x15')](function(_0x112adb){logger['info'](_0xbc22('0x16'),_0x144f44,_0xbc22('0x17'));logger[_0xbc22('0x18')](_0xbc22('0x19'),_0x144f44,'request\x20sent',JSON[_0xbc22('0x1a')](_0x112adb));if(_0x112adb[_0xbc22('0x1b')]){if(_0x112adb['error'][_0xbc22('0x1c')]===0x1f4){logger[_0xbc22('0x1b')](_0xbc22('0x16'),_0x144f44,_0x112adb['error'][_0xbc22('0x1d')]);return _0x49a91b(_0x112adb[_0xbc22('0x1b')][_0xbc22('0x1d')]);}logger[_0xbc22('0x1b')](_0xbc22('0x16'),_0x144f44,_0x112adb['error'][_0xbc22('0x1d')]);return _0x15b1d2(_0x112adb[_0xbc22('0x1b')][_0xbc22('0x1d')]);}else{logger[_0xbc22('0x1e')](_0xbc22('0x16'),_0x144f44,_0xbc22('0x17'));_0x15b1d2(_0x112adb[_0xbc22('0x1f')][_0xbc22('0x1d')]);}})[_0xbc22('0x20')](function(_0x25d4df){logger[_0xbc22('0x1b')](_0xbc22('0x16'),_0x144f44,_0x25d4df);_0x49a91b(_0x25d4df);});});}function respondWithResult(_0x314f89,_0xc32f31){_0xc32f31=_0xc32f31||0xc8;return function(_0x37e5a8){if(_0x37e5a8){return _0x314f89[_0xbc22('0x21')](_0xc32f31)['json'](_0x37e5a8);}};}function respondWithFilteredResult(_0x4c25d1,_0x3bca7e){return function(_0x40b2b0){if(_0x40b2b0){var _0x1cc44d=typeof _0x3bca7e[_0xbc22('0x22')]===_0xbc22('0x23')&&typeof _0x3bca7e[_0xbc22('0x24')]===_0xbc22('0x23');var _0x3888a0=_0x40b2b0['count'];var _0x4ac7b6=_0x1cc44d?0x0:_0x3bca7e[_0xbc22('0x22')];var _0x59b164=_0x1cc44d?_0x40b2b0['count']:_0x3bca7e['offset']+_0x3bca7e[_0xbc22('0x24')];var _0x47528e;if(_0x59b164>=_0x3888a0){_0x59b164=_0x3888a0;_0x47528e=0xc8;}else{_0x47528e=0xce;}_0x4c25d1[_0xbc22('0x21')](_0x47528e);return _0x4c25d1[_0xbc22('0x25')]('Content-Range',_0x4ac7b6+'-'+_0x59b164+'/'+_0x3888a0)[_0xbc22('0x26')](_0x40b2b0);}return null;};}function saveUpdates(_0x27be38){return function(_0x40c889){if(_0x40c889){return _0x40c889['update'](_0x27be38)[_0xbc22('0x15')](function(_0x20b374){return _0x20b374;});}return null;};}function removeEntity(_0x1d2ad6){return function(_0x19c2f4){if(_0x19c2f4){return _0x19c2f4[_0xbc22('0x27')]()[_0xbc22('0x15')](function(){_0x1d2ad6['status'](0xcc)[_0xbc22('0x28')]();});}};}function handleEntityNotFound(_0x5ad831){return function(_0x14a2b5){if(!_0x14a2b5){_0x5ad831[_0xbc22('0x29')](0x194);}return _0x14a2b5;};}function handleError(_0xa86dd,_0x11c27f){_0x11c27f=_0x11c27f||0x1f4;return function(_0xaa1713){logger[_0xbc22('0x1b')](_0xaa1713['stack']);if(_0xaa1713[_0xbc22('0x2a')]){delete _0xaa1713[_0xbc22('0x2a')];}_0xa86dd[_0xbc22('0x21')](_0x11c27f)[_0xbc22('0x2b')](_0xaa1713);};}exports[_0xbc22('0x2c')]=function(_0x4a7887,_0x50e81a){var _0x3480af={},_0x1a13c4={},_0x27f973={'count':0x0,'rows':[]};var _0x12131a=_[_0xbc22('0x2d')](db[_0xbc22('0x2e')]['rawAttributes'],function(_0x1ca2a8){return{'name':_0x1ca2a8['fieldName'],'type':_0x1ca2a8[_0xbc22('0x2f')]['key']};});_0x1a13c4['model']=_['map'](_0x12131a,_0xbc22('0x2a'));_0x1a13c4[_0xbc22('0x30')]=_[_0xbc22('0x31')](_0x4a7887[_0xbc22('0x30')]);_0x1a13c4[_0xbc22('0x32')]=_[_0xbc22('0x33')](_0x1a13c4[_0xbc22('0x34')],_0x1a13c4[_0xbc22('0x30')]);_0x3480af['attributes']=_[_0xbc22('0x33')](_0x1a13c4['model'],qs[_0xbc22('0x35')](_0x4a7887[_0xbc22('0x30')][_0xbc22('0x35')]));_0x3480af[_0xbc22('0x36')]=_0x3480af['attributes'][_0xbc22('0x37')]?_0x3480af[_0xbc22('0x36')]:_0x1a13c4['model'];if(!_0x4a7887[_0xbc22('0x30')][_0xbc22('0x38')](_0xbc22('0x39'))){_0x3480af[_0xbc22('0x24')]=qs['limit'](_0x4a7887[_0xbc22('0x30')][_0xbc22('0x24')]);_0x3480af[_0xbc22('0x22')]=qs['offset'](_0x4a7887[_0xbc22('0x30')]['offset']);}_0x3480af[_0xbc22('0x3a')]=qs['sort'](_0x4a7887['query'][_0xbc22('0x3b')]);_0x3480af[_0xbc22('0x3c')]=qs[_0xbc22('0x32')](_[_0xbc22('0x3d')](_0x4a7887[_0xbc22('0x30')],_0x1a13c4[_0xbc22('0x32')]),_0x12131a);if(_0x4a7887['query'][_0xbc22('0x3e')]){_0x3480af[_0xbc22('0x3c')]=_[_0xbc22('0x3f')](_0x3480af[_0xbc22('0x3c')],{'$or':_['map'](_0x12131a,function(_0x6208e8){if(_0x6208e8['type']!==_0xbc22('0x40')){var _0x2a707b={};_0x2a707b[_0x6208e8['name']]={'$like':'%'+_0x4a7887[_0xbc22('0x30')]['filter']+'%'};return _0x2a707b;}})});}_0x3480af=_[_0xbc22('0x3f')]({},_0x3480af,_0x4a7887['options']);var _0x400b15={'where':_0x3480af[_0xbc22('0x3c')]};return db[_0xbc22('0x2e')]['count'](_0x400b15)[_0xbc22('0x15')](function(_0x1df003){_0x27f973[_0xbc22('0x41')]=_0x1df003;if(_0x4a7887[_0xbc22('0x30')][_0xbc22('0x42')]){_0x3480af[_0xbc22('0x43')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x3480af);})[_0xbc22('0x15')](function(_0x4760f0){_0x27f973['rows']=_0x4760f0;return _0x27f973;})['then'](respondWithFilteredResult(_0x50e81a,_0x3480af))[_0xbc22('0x20')](handleError(_0x50e81a,null));};exports[_0xbc22('0x44')]=function(_0x56bc07,_0x220a32){var _0x44c3ee={'raw':!![],'where':{'id':_0x56bc07[_0xbc22('0x45')]['id']}},_0x214a95={};_0x214a95['model']=_[_0xbc22('0x31')](db['MailMessage'][_0xbc22('0x46')]);_0x214a95[_0xbc22('0x30')]=_[_0xbc22('0x31')](_0x56bc07['query']);_0x214a95[_0xbc22('0x32')]=_[_0xbc22('0x33')](_0x214a95[_0xbc22('0x34')],_0x214a95['query']);_0x44c3ee[_0xbc22('0x36')]=_[_0xbc22('0x33')](_0x214a95['model'],qs[_0xbc22('0x35')](_0x56bc07[_0xbc22('0x30')][_0xbc22('0x35')]));_0x44c3ee['attributes']=_0x44c3ee[_0xbc22('0x36')]['length']?_0x44c3ee['attributes']:_0x214a95[_0xbc22('0x34')];if(_0x56bc07[_0xbc22('0x30')][_0xbc22('0x42')]){_0x44c3ee['include']=[{'all':!![]}];}_0x44c3ee=_['merge']({},_0x44c3ee,_0x56bc07[_0xbc22('0x47')]);return db[_0xbc22('0x2e')]['find'](_0x44c3ee)['then'](handleEntityNotFound(_0x220a32,null))[_0xbc22('0x15')](respondWithResult(_0x220a32,null))[_0xbc22('0x20')](handleError(_0x220a32,null));};exports[_0xbc22('0x48')]=function(_0x3ddbe3,_0x100bd7){if(_0x3ddbe3['body']['id']){delete _0x3ddbe3['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x3ddbe3[_0xbc22('0x45')]['id']}})[_0xbc22('0x15')](handleEntityNotFound(_0x100bd7,null))['then'](saveUpdates(_0x3ddbe3[_0xbc22('0x49')],null))['then'](respondWithResult(_0x100bd7,null))[_0xbc22('0x20')](handleError(_0x100bd7,null));};exports[_0xbc22('0x27')]=function(_0x232207,_0x58a3ab){return db[_0xbc22('0x2e')][_0xbc22('0x4a')]({'where':{'id':_0x232207[_0xbc22('0x45')]['id']}})['then'](handleEntityNotFound(_0x58a3ab,null))[_0xbc22('0x15')](removeEntity(_0x58a3ab,null))[_0xbc22('0x20')](handleError(_0x58a3ab,null));};exports['describe']=function(_0x319896,_0x5ccfba){return db['MailMessage'][_0xbc22('0x4b')]()[_0xbc22('0x15')](respondWithResult(_0x5ccfba,null))['catch'](handleError(_0x5ccfba,null));};exports['create']=function(_0x1bb0c9,_0x2c591d){return db[_0xbc22('0x2e')]['create'](_0x1bb0c9['body'])[_0xbc22('0x15')](function(_0x30fc8c){if(_0x30fc8c){if(_0x30fc8c[_0xbc22('0x4c')]===_0xbc22('0x4d')&&!_0x30fc8c['secret']){var _0x4267bd,_0x12e4b8,_0x1e4e9e;if(_0x1bb0c9[_0xbc22('0x49')]['to']){_0x12e4b8=_0x1bb0c9['body']['to'][_0xbc22('0x4e')](',')[0x0];}return db[_0xbc22('0x4f')][_0xbc22('0x50')]({'where':{'id':_0x30fc8c[_0xbc22('0x51')]},'include':[{'model':db[_0xbc22('0x52')],'as':_0xbc22('0x53'),'include':[{'model':db[_0xbc22('0x54')],'as':_0xbc22('0x55'),'where':{'email':_0x12e4b8},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xbc22('0x56')],'as':_0xbc22('0x57'),'raw':!![],'include':[{'model':db[_0xbc22('0x58')],'as':_0xbc22('0x58'),'raw':!![]}]}]})[_0xbc22('0x15')](function(_0x4b4ac9){_0x4267bd=_0x4b4ac9;if(!_0x4267bd||!_0x4267bd[_0xbc22('0x57')])return;var _0x5df02f=_0x4267bd[_0xbc22('0x59')]();if(_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')]&&_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0xbc22('0x37')]){for(var _0x1b0799=0x0;_0x1b0799<_0x1bb0c9[_0xbc22('0x49')]['attachments'][_0xbc22('0x37')];_0x1b0799+=0x1){_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0x1b0799]={'filename':_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0x1b0799][_0xbc22('0x2a')],'path':path[_0xbc22('0x5b')](config[_0xbc22('0x5c')],_0xbc22('0x5d'),_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0x1b0799][_0xbc22('0x5e')])};}}_0x1e4e9e={'account':_0x5df02f,'message':_0x1bb0c9[_0xbc22('0x49')]};return;})[_0xbc22('0x15')](function(){if(_0x4267bd[_0xbc22('0x53')]){if(_0x4267bd[_0xbc22('0x53')][_0xbc22('0x55')]['length']){return _0x4267bd[_0xbc22('0x53')][_0xbc22('0x55')][0x0];}else{return db[_0xbc22('0x54')][_0xbc22('0x5f')](_[_0xbc22('0xb')](_0x1bb0c9[_0xbc22('0x49')],{'firstName':_0x1bb0c9[_0xbc22('0x49')]['to'],'email':_0x1bb0c9['body']['to'],'phone':_0x1bb0c9[_0xbc22('0x49')]['to'],'ListId':_0x4267bd['ListId']}));}}else{throw new Error(_0xbc22('0x60'));}})['then'](function(){if(_0x1e4e9e){return respondWithRpcPromise(_0xbc22('0x61'),_0xbc22('0x62'),_0x1e4e9e,client9003)['then'](function(_0xe85b80){return _0x30fc8c['update']({'read':!![],'messageId':_0xe85b80[_0xbc22('0x63')],'sentAt':moment()[_0xbc22('0x64')](_0xbc22('0x65'))});})[_0xbc22('0x20')](function(_0x52b90b){logger['error']('%s',JSON[_0xbc22('0x1a')](_0x52b90b));return _0x30fc8c;});}return _0x30fc8c;});}return _0x30fc8c;}})[_0xbc22('0x15')](respondWithResult(_0x2c591d,0xc9))[_0xbc22('0x20')](handleError(_0x2c591d,null));};exports[_0xbc22('0x66')]=function(_0x42673d,_0x21d37a){var _0x2f6ed2={'agent':{},'channel':'mail'};if(_0x42673d[_0xbc22('0x49')]['id']){delete _0x42673d[_0xbc22('0x49')]['id'];}_0x42673d[_0xbc22('0x49')][_0xbc22('0x67')]=!![];_0x42673d[_0xbc22('0x49')]['readAt']=moment()[_0xbc22('0x64')](_0xbc22('0x65'));_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')]=_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')]||_0x42673d[_0xbc22('0x69')]['id'];_0x2f6ed2[_0xbc22('0x6a')]['id']=_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')];return db['MailMessage']['find']({'where':{'id':_0x42673d[_0xbc22('0x45')]['id'],'UserId':null}})[_0xbc22('0x15')](handleEntityNotFound(_0x21d37a,null))[_0xbc22('0x15')](saveUpdates(_0x42673d['body'],null))['then'](function(_0x540b8e){if(_0x540b8e){_0x2f6ed2[_0xbc22('0x1d')]=_0x540b8e['get']({'plain':!![]});return db[_0xbc22('0x6b')][_0xbc22('0x4a')]({'where':{'id':_0x540b8e[_0xbc22('0x6c')]}});}return null;})[_0xbc22('0x15')](handleEntityNotFound(_0x21d37a,null))[_0xbc22('0x15')](function(_0xb2d678){if(_0xb2d678){return _0xb2d678[_0xbc22('0x48')]({'UserId':_0x42673d['body'][_0xbc22('0x68')],'read1stAt':_[_0xbc22('0x6d')](_0xb2d678['read1stAt'])?moment()[_0xbc22('0x64')](_0xbc22('0x65')):undefined});}return null;})[_0xbc22('0x15')](function(_0x1a361a){if(_0x1a361a){_0x2f6ed2[_0xbc22('0x6e')]=_0x1a361a['get']({'plain':!![]});interaction_log['info'](_0xbc22('0x6f'),_0x42673d['user']['id'],_0x42673d['user']['name'],_0x42673d[_0xbc22('0x69')]['role'],_0x2f6ed2['interaction']['id'],_0x42673d[_0xbc22('0x49')]?JSON['stringify'](_0x42673d[_0xbc22('0x49')]):_0xbc22('0x70'));return respondWithRpcPromise(_0xbc22('0x71'),'acceptMessage',_0x2f6ed2);}return null;})[_0xbc22('0x15')](function(_0x107123){var _0x5e6b66=_0xbc22('0x72')+_0x107123[_0xbc22('0x1d')]['ContactId'];return db['sequelize'][_0xbc22('0x30')](_0x5e6b66,{'type':db[_0xbc22('0x73')][_0xbc22('0x74')][_0xbc22('0x75')],'raw':!![]})[_0xbc22('0x15')](function(_0x19795e){return _0x19795e;});})[_0xbc22('0x15')](function(_0x2f1948){if(_0x2f1948){_0x2f6ed2['message'][_0xbc22('0x76')]=_0x2f1948[0x0];if(!_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')])return;return db['User'][_0xbc22('0x4a')]({'where':{'id':_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')],'role':'agent'},'attributes':['id','name','fullname',_0xbc22('0x77'),_0xbc22('0x78')],'raw':!![]});}return null;})[_0xbc22('0x15')](function(_0x12781c){if(!_0x12781c)return null;_0x2f6ed2['message'][_0xbc22('0x6a')]=_0x12781c;return _0x2f6ed2;})[_0xbc22('0x15')](function(_0x586baa){if(_0x586baa){if(_0x42673d[_0xbc22('0x49')][_0xbc22('0x79')]){_0x2f6ed2[_0xbc22('0x1d')]['interface']=util[_0xbc22('0x64')](_0xbc22('0x7a'),_0x42673d[_0xbc22('0x69')][_0xbc22('0x2a')]);_0x2f6ed2[_0xbc22('0x1d')][_0xbc22('0x7b')]=_0x2f6ed2['channel'];_0x2f6ed2['message'][_0xbc22('0x7c')]=_0x2f6ed2[_0xbc22('0x7b')];_0x2f6ed2[_0xbc22('0x1d')][_0xbc22('0x7d')]=_0xbc22('0x66');_0x2f6ed2[_0xbc22('0x1d')]['body']=htmlToText['fromString'](_0x2f6ed2['message'][_0xbc22('0x49')]);return respondWithRpcPromise(_0xbc22('0x7e'),'EventManager',{'event':_0xbc22('0x7f'),'message':_0x2f6ed2[_0xbc22('0x1d')]},client9002)[_0xbc22('0x15')](function(){return _0x2f6ed2;});}return _0x2f6ed2;}return null;})[_0xbc22('0x15')](respondWithResult(_0x21d37a,null))[_0xbc22('0x20')](handleError(_0x21d37a,null));};exports[_0xbc22('0x80')]=function(_0x29fa67,_0x337969){var _0x487b88={'agent':{},'channel':_0xbc22('0x81')};if(_0x29fa67['body']['id']){delete _0x29fa67['body']['id'];}_0x29fa67['body'][_0xbc22('0x68')]=_0x29fa67['body'][_0xbc22('0x68')]||_0x29fa67['user']['id'];_0x487b88[_0xbc22('0x6a')]['id']=_0x29fa67[_0xbc22('0x49')][_0xbc22('0x68')];return db[_0xbc22('0x2e')][_0xbc22('0x4a')]({'where':{'id':_0x29fa67[_0xbc22('0x45')]['id'],'UserId':null}})[_0xbc22('0x15')](handleEntityNotFound(_0x337969,null))[_0xbc22('0x15')](function(_0x2dbfe9){if(_0x2dbfe9){_0x487b88['message']=_0x2dbfe9[_0xbc22('0x82')]({'plain':!![]});return db[_0xbc22('0x6b')][_0xbc22('0x4a')]({'where':{'id':_0x2dbfe9[_0xbc22('0x6c')]}});}return null;})[_0xbc22('0x15')](handleEntityNotFound(_0x337969,null))[_0xbc22('0x15')](function(_0x35287f){if(_0x35287f){_0x487b88[_0xbc22('0x6e')]=_0x35287f['get']({'plain':!![]});interaction_log[_0xbc22('0x1e')](_0xbc22('0x83'),_0x29fa67['user']['id'],_0x29fa67[_0xbc22('0x69')][_0xbc22('0x2a')],_0x29fa67[_0xbc22('0x69')][_0xbc22('0x84')],_0x487b88['interaction']['id'],_0x29fa67[_0xbc22('0x49')]?JSON[_0xbc22('0x1a')](_0x29fa67['body']):_0xbc22('0x70'));return respondWithRpcPromise(_0xbc22('0x85'),_0xbc22('0x86'),_0x487b88);}return null;})[_0xbc22('0x15')](function(_0x52d0a2){var _0x4f2876='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52d0a2[_0xbc22('0x1d')][_0xbc22('0x87')];return db['sequelize'][_0xbc22('0x30')](_0x4f2876,{'type':db[_0xbc22('0x73')][_0xbc22('0x74')][_0xbc22('0x75')],'raw':!![]})['then'](function(_0x37e9a8){return _0x37e9a8;});})[_0xbc22('0x15')](function(_0x3ce214){if(_0x3ce214){_0x487b88[_0xbc22('0x1d')][_0xbc22('0x76')]=_0x3ce214[0x0];if(!_0x29fa67[_0xbc22('0x49')][_0xbc22('0x68')])return;return db[_0xbc22('0x88')][_0xbc22('0x4a')]({'where':{'id':_0x29fa67[_0xbc22('0x49')][_0xbc22('0x68')],'role':_0xbc22('0x6a')},'attributes':['id',_0xbc22('0x2a'),_0xbc22('0x89'),'email','internal'],'raw':!![]});}return null;})[_0xbc22('0x15')](function(_0x1536d7){if(!_0x1536d7)return null;_0x487b88[_0xbc22('0x1d')][_0xbc22('0x6a')]=_0x1536d7;return _0x487b88;})[_0xbc22('0x15')](function(_0x4a1af2){if(_0x4a1af2){_0x4a1af2['message'][_0xbc22('0x8a')]=util[_0xbc22('0x64')](_0xbc22('0x7a'),_0x29fa67[_0xbc22('0x69')][_0xbc22('0x2a')]);_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x7b')]=_0x487b88[_0xbc22('0x7b')];_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x7c')]=_0x487b88[_0xbc22('0x7b')];_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x7d')]=_0xbc22('0x80');_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x49')]=htmlToText[_0xbc22('0x8b')](_0x487b88[_0xbc22('0x1d')][_0xbc22('0x49')]);respondWithRpcPromise(_0xbc22('0x7e'),_0xbc22('0x7e'),{'event':'rejectmessage','message':_0x4a1af2['message']},client9002);return _0x487b88;}return null;})[_0xbc22('0x15')](respondWithResult(_0x337969,null))[_0xbc22('0x20')](handleError(_0x337969,null));};exports['download']=function(_0x5553ea,_0x312626){var _0x4d828e=moment()[_0xbc22('0x8c')]()[_0xbc22('0x8d')]();var _0x234f8b=path[_0xbc22('0x5b')](config[_0xbc22('0x5c')],_0xbc22('0x8e'),_0xbc22('0x8f'),'tmp');var _0x3be361=path[_0xbc22('0x5b')](config[_0xbc22('0x5c')],_0xbc22('0x8e'),'files',_0xbc22('0x5a'));var _0x42fcba=util[_0xbc22('0x64')](_0xbc22('0x90'),_0x4d828e);return db[_0xbc22('0x2e')]['find']({'where':{'id':_0x5553ea[_0xbc22('0x45')]['id']},'attributes':['id',_0xbc22('0x49'),_0xbc22('0x91'),'to','cc','bcc',_0xbc22('0x92'),_0xbc22('0x93')],'include':_0x5553ea[_0xbc22('0x30')][_0xbc22('0x5a')]?[{'model':db[_0xbc22('0x94')],'as':_0xbc22('0x95')}]:undefined})[_0xbc22('0x15')](handleEntityNotFound(_0x312626,null))['then'](function(_0x1b6d9b){if(_0x1b6d9b){var _0x7c3f98=_0x1b6d9b;var _0x48bb6b={'from':_0x7c3f98[_0xbc22('0x91')],'to':_0x7c3f98['to'],'subject':_0x7c3f98[_0xbc22('0x92')],'html':htmlEntities[_0xbc22('0x96')](_0x7c3f98['body']),'headers':{'Date':moment(_0x7c3f98[_0xbc22('0x93')])[_0xbc22('0x64')](_0xbc22('0x97'))},'attachments':[]};if(_0x1b6d9b['cc']){_0x48bb6b['headers']['Cc']=_0x1b6d9b['cc'];}if(_0x1b6d9b[_0xbc22('0x98')]){_0x48bb6b[_0xbc22('0x99')][_0xbc22('0x9a')]=_0x1b6d9b[_0xbc22('0x98')];}return new BPromise(function(_0x2b0f24,_0x194ad9){if(_0x1b6d9b['Attachments']){for(var _0xc2f631=0x0;_0xc2f631<_0x1b6d9b[_0xbc22('0x95')][_0xbc22('0x37')];_0xc2f631++){var _0x37fa00=_0x1b6d9b[_0xbc22('0x95')][_0xc2f631];var _0x484cc3=path['join'](_0x3be361,_0x37fa00[_0xbc22('0x5e')]);if(fs[_0xbc22('0x9b')](_0x484cc3)){_0x48bb6b[_0xbc22('0x5a')][_0xbc22('0x9c')]({'name':_0x37fa00[_0xbc22('0x2a')],'contentType':_0x37fa00[_0xbc22('0x2f')],'data':fs[_0xbc22('0x9d')](_0x484cc3)});}}}emlformat['build'](_0x48bb6b,function(_0x3a8428,_0x46e6fc){if(_0x3a8428)return _0x194ad9(_0x3a8428);fs[_0xbc22('0x9e')](path[_0xbc22('0x5b')](_0x234f8b,_0x42fcba),_0x46e6fc);return _0x2b0f24(_0x46e6fc);});});}})[_0xbc22('0x15')](function(_0x4c6798){if(_0x4c6798){return _0x312626['download'](path[_0xbc22('0x5b')](_0x234f8b,_0x42fcba),_0x42fcba,function(_0x4a0a10){if(!_0x4a0a10)fs[_0xbc22('0x9f')](path[_0xbc22('0x5b')](_0x234f8b,_0x42fcba));});}})[_0xbc22('0x20')](handleError(_0x312626,null));}; \ No newline at end of file +var _0xb3d6=['agent','UserId','get','MailInteraction','isNil','read1stAt','interaction','user','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','motionChannel','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','sendStatus','name','send','index','map','MailMessage','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','describe','create','direction','out','secret','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read'];(function(_0x44655c,_0x40af8a){var _0x147e5e=function(_0x8d555f){while(--_0x8d555f){_0x44655c['push'](_0x44655c['shift']());}};_0x147e5e(++_0x40af8a);}(_0xb3d6,0x171));var _0x6b3d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb3d6[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x6b3d('0x0'));var moment=require('moment');var BPromise=require(_0x6b3d('0x1'));var util=require('util');var path=require(_0x6b3d('0x2'));var fs=require('fs');var _=require(_0x6b3d('0x3'));var Redis=require(_0x6b3d('0x4'));var htmlToText=require(_0x6b3d('0x5'));var qs=require(_0x6b3d('0x6'));var logger=require(_0x6b3d('0x7'))(_0x6b3d('0x8'));var interaction_log=require(_0x6b3d('0x7'))('mail-interactions');var config=require(_0x6b3d('0x9'));var db=require('../../mysqldb')['db'];config[_0x6b3d('0xa')]=_[_0x6b3d('0xb')](config[_0x6b3d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b3d('0xc'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x6b3d('0xd'))['register'](socket);var jayson=require(_0x6b3d('0xe'));var client=jayson[_0x6b3d('0xf')][_0x6b3d('0x10')]({'port':0x232c});var client9003=jayson[_0x6b3d('0xf')]['http']({'port':0x232b});var client9002=jayson[_0x6b3d('0xf')][_0x6b3d('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x2abf63,_0x3edbfc,_0xe271cd,_0x1556e0){return new BPromise(function(_0xc383c2,_0x364d99){var _0x451a0d=_0x1556e0||client;return _0x451a0d['request'](_0x2abf63,_0xe271cd)[_0x6b3d('0x11')](function(_0x8a7c6e){logger[_0x6b3d('0x12')](_0x6b3d('0x13'),_0x3edbfc,'request\x20sent');logger[_0x6b3d('0x14')](_0x6b3d('0x15'),_0x3edbfc,'request\x20sent',JSON[_0x6b3d('0x16')](_0x8a7c6e));if(_0x8a7c6e[_0x6b3d('0x17')]){if(_0x8a7c6e[_0x6b3d('0x17')][_0x6b3d('0x18')]===0x1f4){logger[_0x6b3d('0x17')](_0x6b3d('0x13'),_0x3edbfc,_0x8a7c6e[_0x6b3d('0x17')][_0x6b3d('0x19')]);return _0x364d99(_0x8a7c6e['error']['message']);}logger[_0x6b3d('0x17')]('MailMessage,\x20%s,\x20%s',_0x3edbfc,_0x8a7c6e[_0x6b3d('0x17')][_0x6b3d('0x19')]);return _0xc383c2(_0x8a7c6e[_0x6b3d('0x17')][_0x6b3d('0x19')]);}else{logger['info'](_0x6b3d('0x13'),_0x3edbfc,_0x6b3d('0x1a'));_0xc383c2(_0x8a7c6e[_0x6b3d('0x1b')][_0x6b3d('0x19')]);}})['catch'](function(_0x65b4a4){logger['error'](_0x6b3d('0x13'),_0x3edbfc,_0x65b4a4);_0x364d99(_0x65b4a4);});});}function respondWithResult(_0x26bcb0,_0x555616){_0x555616=_0x555616||0xc8;return function(_0x8f3ee5){if(_0x8f3ee5){return _0x26bcb0[_0x6b3d('0x1c')](_0x555616)['json'](_0x8f3ee5);}};}function respondWithFilteredResult(_0x1397d4,_0x129e5d){return function(_0x5732eb){if(_0x5732eb){var _0x1c4686=typeof _0x129e5d[_0x6b3d('0x1d')]===_0x6b3d('0x1e')&&typeof _0x129e5d[_0x6b3d('0x1f')]===_0x6b3d('0x1e');var _0x55b5ee=_0x5732eb[_0x6b3d('0x20')];var _0x24a3ca=_0x1c4686?0x0:_0x129e5d[_0x6b3d('0x1d')];var _0x169b30=_0x1c4686?_0x5732eb[_0x6b3d('0x20')]:_0x129e5d[_0x6b3d('0x1d')]+_0x129e5d['limit'];var _0x4f5bee;if(_0x169b30>=_0x55b5ee){_0x169b30=_0x55b5ee;_0x4f5bee=0xc8;}else{_0x4f5bee=0xce;}_0x1397d4['status'](_0x4f5bee);return _0x1397d4[_0x6b3d('0x21')](_0x6b3d('0x22'),_0x24a3ca+'-'+_0x169b30+'/'+_0x55b5ee)[_0x6b3d('0x23')](_0x5732eb);}return null;};}function saveUpdates(_0x551e0a){return function(_0x1c856c){if(_0x1c856c){return _0x1c856c[_0x6b3d('0x24')](_0x551e0a)[_0x6b3d('0x11')](function(_0x4b1202){return _0x4b1202;});}return null;};}function removeEntity(_0x20de32){return function(_0x20d656){if(_0x20d656){return _0x20d656[_0x6b3d('0x25')]()[_0x6b3d('0x11')](function(){_0x20de32[_0x6b3d('0x1c')](0xcc)[_0x6b3d('0x26')]();});}};}function handleEntityNotFound(_0x317136){return function(_0x55f4f4){if(!_0x55f4f4){_0x317136[_0x6b3d('0x27')](0x194);}return _0x55f4f4;};}function handleError(_0x3c19ad,_0x1e77e6){_0x1e77e6=_0x1e77e6||0x1f4;return function(_0x508cc7){logger[_0x6b3d('0x17')](_0x508cc7['stack']);if(_0x508cc7[_0x6b3d('0x28')]){delete _0x508cc7[_0x6b3d('0x28')];}_0x3c19ad[_0x6b3d('0x1c')](_0x1e77e6)[_0x6b3d('0x29')](_0x508cc7);};}exports[_0x6b3d('0x2a')]=function(_0x563573,_0x34a530){var _0x221cf7={},_0x102443={},_0x2dcdc6={'count':0x0,'rows':[]};var _0x161582=_[_0x6b3d('0x2b')](db[_0x6b3d('0x2c')]['rawAttributes'],function(_0x180537){return{'name':_0x180537['fieldName'],'type':_0x180537['type'][_0x6b3d('0x2d')]};});_0x102443[_0x6b3d('0x2e')]=_[_0x6b3d('0x2b')](_0x161582,_0x6b3d('0x28'));_0x102443['query']=_[_0x6b3d('0x2f')](_0x563573[_0x6b3d('0x30')]);_0x102443[_0x6b3d('0x31')]=_[_0x6b3d('0x32')](_0x102443[_0x6b3d('0x2e')],_0x102443[_0x6b3d('0x30')]);_0x221cf7['attributes']=_[_0x6b3d('0x32')](_0x102443[_0x6b3d('0x2e')],qs[_0x6b3d('0x33')](_0x563573['query'][_0x6b3d('0x33')]));_0x221cf7[_0x6b3d('0x34')]=_0x221cf7[_0x6b3d('0x34')][_0x6b3d('0x35')]?_0x221cf7[_0x6b3d('0x34')]:_0x102443[_0x6b3d('0x2e')];if(!_0x563573[_0x6b3d('0x30')][_0x6b3d('0x36')](_0x6b3d('0x37'))){_0x221cf7[_0x6b3d('0x1f')]=qs[_0x6b3d('0x1f')](_0x563573[_0x6b3d('0x30')]['limit']);_0x221cf7['offset']=qs['offset'](_0x563573[_0x6b3d('0x30')][_0x6b3d('0x1d')]);}_0x221cf7[_0x6b3d('0x38')]=qs[_0x6b3d('0x39')](_0x563573['query'][_0x6b3d('0x39')]);_0x221cf7[_0x6b3d('0x3a')]=qs[_0x6b3d('0x31')](_[_0x6b3d('0x3b')](_0x563573[_0x6b3d('0x30')],_0x102443[_0x6b3d('0x31')]),_0x161582);if(_0x563573['query'][_0x6b3d('0x3c')]){_0x221cf7[_0x6b3d('0x3a')]=_[_0x6b3d('0x3d')](_0x221cf7[_0x6b3d('0x3a')],{'$or':_[_0x6b3d('0x2b')](_0x161582,function(_0x52022d){if(_0x52022d[_0x6b3d('0x3e')]!==_0x6b3d('0x3f')){var _0x16f3ed={};_0x16f3ed[_0x52022d[_0x6b3d('0x28')]]={'$like':'%'+_0x563573[_0x6b3d('0x30')]['filter']+'%'};return _0x16f3ed;}})});}_0x221cf7=_[_0x6b3d('0x3d')]({},_0x221cf7,_0x563573[_0x6b3d('0x40')]);var _0x49fb94={'where':_0x221cf7[_0x6b3d('0x3a')]};return db[_0x6b3d('0x2c')][_0x6b3d('0x20')](_0x49fb94)[_0x6b3d('0x11')](function(_0x43dc51){_0x2dcdc6[_0x6b3d('0x20')]=_0x43dc51;if(_0x563573[_0x6b3d('0x30')][_0x6b3d('0x41')]){_0x221cf7[_0x6b3d('0x42')]=[{'all':!![]}];}return db[_0x6b3d('0x2c')][_0x6b3d('0x43')](_0x221cf7);})['then'](function(_0x1fa2d5){_0x2dcdc6['rows']=_0x1fa2d5;return _0x2dcdc6;})[_0x6b3d('0x11')](respondWithFilteredResult(_0x34a530,_0x221cf7))[_0x6b3d('0x44')](handleError(_0x34a530,null));};exports[_0x6b3d('0x45')]=function(_0x4bcb5a,_0x46ca70){var _0x572b2d={'raw':!![],'where':{'id':_0x4bcb5a[_0x6b3d('0x46')]['id']}},_0x3451e5={};_0x3451e5[_0x6b3d('0x2e')]=_[_0x6b3d('0x2f')](db['MailMessage']['rawAttributes']);_0x3451e5[_0x6b3d('0x30')]=_['keys'](_0x4bcb5a[_0x6b3d('0x30')]);_0x3451e5[_0x6b3d('0x31')]=_[_0x6b3d('0x32')](_0x3451e5[_0x6b3d('0x2e')],_0x3451e5['query']);_0x572b2d[_0x6b3d('0x34')]=_[_0x6b3d('0x32')](_0x3451e5[_0x6b3d('0x2e')],qs[_0x6b3d('0x33')](_0x4bcb5a[_0x6b3d('0x30')][_0x6b3d('0x33')]));_0x572b2d['attributes']=_0x572b2d[_0x6b3d('0x34')][_0x6b3d('0x35')]?_0x572b2d[_0x6b3d('0x34')]:_0x3451e5[_0x6b3d('0x2e')];if(_0x4bcb5a[_0x6b3d('0x30')][_0x6b3d('0x41')]){_0x572b2d[_0x6b3d('0x42')]=[{'all':!![]}];}_0x572b2d=_[_0x6b3d('0x3d')]({},_0x572b2d,_0x4bcb5a[_0x6b3d('0x40')]);return db[_0x6b3d('0x2c')][_0x6b3d('0x47')](_0x572b2d)[_0x6b3d('0x11')](handleEntityNotFound(_0x46ca70,null))[_0x6b3d('0x11')](respondWithResult(_0x46ca70,null))[_0x6b3d('0x44')](handleError(_0x46ca70,null));};exports['update']=function(_0x30e763,_0x3c6c2a){if(_0x30e763['body']['id']){delete _0x30e763[_0x6b3d('0x48')]['id'];}return db[_0x6b3d('0x2c')]['find']({'where':{'id':_0x30e763[_0x6b3d('0x46')]['id']}})[_0x6b3d('0x11')](handleEntityNotFound(_0x3c6c2a,null))['then'](saveUpdates(_0x30e763['body'],null))['then'](respondWithResult(_0x3c6c2a,null))[_0x6b3d('0x44')](handleError(_0x3c6c2a,null));};exports['destroy']=function(_0x18c843,_0x9bf4f6){return db['MailMessage']['find']({'where':{'id':_0x18c843['params']['id']}})['then'](handleEntityNotFound(_0x9bf4f6,null))[_0x6b3d('0x11')](removeEntity(_0x9bf4f6,null))[_0x6b3d('0x44')](handleError(_0x9bf4f6,null));};exports[_0x6b3d('0x49')]=function(_0xd688c5,_0x482e2a){return db[_0x6b3d('0x2c')][_0x6b3d('0x49')]()[_0x6b3d('0x11')](respondWithResult(_0x482e2a,null))[_0x6b3d('0x44')](handleError(_0x482e2a,null));};exports[_0x6b3d('0x4a')]=function(_0x2182e0,_0x390257){return db[_0x6b3d('0x2c')][_0x6b3d('0x4a')](_0x2182e0[_0x6b3d('0x48')])[_0x6b3d('0x11')](function(_0x338b58){if(_0x338b58){if(_0x338b58[_0x6b3d('0x4b')]===_0x6b3d('0x4c')&&!_0x338b58[_0x6b3d('0x4d')]){var _0x3c6651,_0x31ff05,_0x39aaec;if(_0x2182e0[_0x6b3d('0x48')]['to']){_0x31ff05=_0x2182e0[_0x6b3d('0x48')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x338b58[_0x6b3d('0x4e')]},'include':[{'model':db['CmList'],'as':_0x6b3d('0x4f'),'include':[{'model':db[_0x6b3d('0x50')],'as':_0x6b3d('0x51'),'where':{'email':_0x31ff05},'limit':0x1,'order':[['updatedAt',_0x6b3d('0x52')]]}]},{'model':db[_0x6b3d('0x53')],'as':_0x6b3d('0x54'),'raw':!![],'include':[{'model':db[_0x6b3d('0x55')],'as':_0x6b3d('0x55'),'raw':!![]}]}]})[_0x6b3d('0x11')](function(_0x2ac883){_0x3c6651=_0x2ac883;if(!_0x3c6651||!_0x3c6651[_0x6b3d('0x54')])return;var _0x1e6fda=_0x3c6651[_0x6b3d('0x56')]();if(_0x2182e0[_0x6b3d('0x48')][_0x6b3d('0x57')]&&_0x2182e0[_0x6b3d('0x48')][_0x6b3d('0x57')][_0x6b3d('0x35')]){for(var _0x587cd9=0x0;_0x587cd9<_0x2182e0[_0x6b3d('0x48')][_0x6b3d('0x57')][_0x6b3d('0x35')];_0x587cd9+=0x1){_0x2182e0[_0x6b3d('0x48')][_0x6b3d('0x57')][_0x587cd9]={'filename':_0x2182e0[_0x6b3d('0x48')][_0x6b3d('0x57')][_0x587cd9]['name'],'path':path[_0x6b3d('0x58')](config[_0x6b3d('0x59')],_0x6b3d('0x5a'),_0x2182e0['body'][_0x6b3d('0x57')][_0x587cd9][_0x6b3d('0x5b')])};}}_0x39aaec={'account':_0x1e6fda,'message':_0x2182e0['body']};return;})['then'](function(){if(_0x3c6651[_0x6b3d('0x4f')]){if(_0x3c6651[_0x6b3d('0x4f')][_0x6b3d('0x51')][_0x6b3d('0x35')]){return _0x3c6651[_0x6b3d('0x4f')]['Contacts'][0x0];}else{return db[_0x6b3d('0x50')][_0x6b3d('0x4a')](_[_0x6b3d('0xb')](_0x2182e0['body'],{'firstName':_0x2182e0[_0x6b3d('0x48')]['to'],'email':_0x2182e0[_0x6b3d('0x48')]['to'],'phone':_0x2182e0[_0x6b3d('0x48')]['to'],'ListId':_0x3c6651[_0x6b3d('0x5c')]}));}}else{throw new Error(_0x6b3d('0x5d'));}})[_0x6b3d('0x11')](function(){if(_0x39aaec){return respondWithRpcPromise(_0x6b3d('0x5e'),_0x6b3d('0x5f'),_0x39aaec,client9003)[_0x6b3d('0x11')](function(_0x387d32){return _0x338b58[_0x6b3d('0x24')]({'read':!![],'messageId':_0x387d32[_0x6b3d('0x60')],'sentAt':moment()[_0x6b3d('0x61')](_0x6b3d('0x62'))});})[_0x6b3d('0x44')](function(_0x336159){logger[_0x6b3d('0x17')]('%s',JSON[_0x6b3d('0x16')](_0x336159));return _0x338b58;});}return _0x338b58;});}return _0x338b58;}})[_0x6b3d('0x11')](respondWithResult(_0x390257,0xc9))[_0x6b3d('0x44')](handleError(_0x390257,null));};exports[_0x6b3d('0x63')]=function(_0x44e2ff,_0x40232f){var _0x1bd39e={'agent':{},'channel':_0x6b3d('0x64')};if(_0x44e2ff['body']['id']){delete _0x44e2ff[_0x6b3d('0x48')]['id'];}_0x44e2ff[_0x6b3d('0x48')][_0x6b3d('0x65')]=!![];_0x44e2ff[_0x6b3d('0x48')]['readAt']=moment()[_0x6b3d('0x61')](_0x6b3d('0x62'));_0x44e2ff[_0x6b3d('0x48')]['UserId']=_0x44e2ff[_0x6b3d('0x48')]['UserId']||_0x44e2ff['user']['id'];_0x1bd39e[_0x6b3d('0x66')]['id']=_0x44e2ff[_0x6b3d('0x48')][_0x6b3d('0x67')];return db[_0x6b3d('0x2c')][_0x6b3d('0x47')]({'where':{'id':_0x44e2ff['params']['id'],'UserId':null}})[_0x6b3d('0x11')](handleEntityNotFound(_0x40232f,null))[_0x6b3d('0x11')](saveUpdates(_0x44e2ff[_0x6b3d('0x48')],null))[_0x6b3d('0x11')](function(_0x12a755){if(_0x12a755){_0x1bd39e[_0x6b3d('0x19')]=_0x12a755[_0x6b3d('0x68')]({'plain':!![]});return db[_0x6b3d('0x69')]['find']({'where':{'id':_0x12a755['MailInteractionId']}});}return null;})[_0x6b3d('0x11')](handleEntityNotFound(_0x40232f,null))[_0x6b3d('0x11')](function(_0x7e45e6){if(_0x7e45e6){return _0x7e45e6['update']({'UserId':_0x44e2ff[_0x6b3d('0x48')]['UserId'],'read1stAt':_[_0x6b3d('0x6a')](_0x7e45e6[_0x6b3d('0x6b')])?moment()[_0x6b3d('0x61')](_0x6b3d('0x62')):undefined});}return null;})[_0x6b3d('0x11')](function(_0x2a6ea4){if(_0x2a6ea4){_0x1bd39e[_0x6b3d('0x6c')]=_0x2a6ea4[_0x6b3d('0x68')]({'plain':!![]});interaction_log[_0x6b3d('0x12')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44e2ff[_0x6b3d('0x6d')]['id'],_0x44e2ff[_0x6b3d('0x6d')][_0x6b3d('0x28')],_0x44e2ff[_0x6b3d('0x6d')]['role'],_0x1bd39e[_0x6b3d('0x6c')]['id'],_0x44e2ff['body']?JSON['stringify'](_0x44e2ff['body']):_0x6b3d('0x6e'));return respondWithRpcPromise(_0x6b3d('0x6f'),'acceptMessage',_0x1bd39e);}return null;})[_0x6b3d('0x11')](function(_0x57b410){var _0x3f1aeb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x57b410[_0x6b3d('0x19')][_0x6b3d('0x70')];return db[_0x6b3d('0x71')]['query'](_0x3f1aeb,{'type':db[_0x6b3d('0x72')][_0x6b3d('0x73')][_0x6b3d('0x74')],'raw':!![]})[_0x6b3d('0x11')](function(_0x1aa797){return _0x1aa797;});})[_0x6b3d('0x11')](function(_0x34b91d){if(_0x34b91d){_0x1bd39e['message']['contact']=_0x34b91d[0x0];if(!_0x44e2ff[_0x6b3d('0x48')][_0x6b3d('0x67')])return;return db[_0x6b3d('0x75')][_0x6b3d('0x47')]({'where':{'id':_0x44e2ff[_0x6b3d('0x48')][_0x6b3d('0x67')],'role':_0x6b3d('0x66')},'attributes':['id',_0x6b3d('0x28'),_0x6b3d('0x76'),_0x6b3d('0x77'),_0x6b3d('0x78')],'raw':!![]});}return null;})[_0x6b3d('0x11')](function(_0x117ed6){if(!_0x117ed6)return null;_0x1bd39e['message'][_0x6b3d('0x66')]=_0x117ed6;return _0x1bd39e;})['then'](function(_0x5c025a){if(_0x5c025a){if(_0x44e2ff[_0x6b3d('0x48')][_0x6b3d('0x79')]){_0x1bd39e['message'][_0x6b3d('0x7a')]=util[_0x6b3d('0x61')](_0x6b3d('0x7b'),_0x44e2ff['user'][_0x6b3d('0x28')]);_0x1bd39e[_0x6b3d('0x19')][_0x6b3d('0x7c')]=_0x1bd39e['channel'];_0x1bd39e['message']['motionChannel']=_0x1bd39e[_0x6b3d('0x7c')];_0x1bd39e[_0x6b3d('0x19')]['event']=_0x6b3d('0x63');_0x1bd39e[_0x6b3d('0x19')]['body']=htmlToText[_0x6b3d('0x7d')](_0x1bd39e[_0x6b3d('0x19')]['body']);return respondWithRpcPromise('EventManager',_0x6b3d('0x7e'),{'event':_0x6b3d('0x7f'),'message':_0x1bd39e[_0x6b3d('0x19')]},client9002)['then'](function(){return _0x1bd39e;});}return _0x1bd39e;}return null;})['then'](respondWithResult(_0x40232f,null))[_0x6b3d('0x44')](handleError(_0x40232f,null));};exports[_0x6b3d('0x80')]=function(_0x34e85b,_0x4bfdfc){var _0x59d7ba={'agent':{},'channel':_0x6b3d('0x64')};if(_0x34e85b[_0x6b3d('0x48')]['id']){delete _0x34e85b[_0x6b3d('0x48')]['id'];}_0x34e85b[_0x6b3d('0x48')][_0x6b3d('0x67')]=_0x34e85b[_0x6b3d('0x48')][_0x6b3d('0x67')]||_0x34e85b[_0x6b3d('0x6d')]['id'];_0x59d7ba[_0x6b3d('0x66')]['id']=_0x34e85b['body'][_0x6b3d('0x67')];return db[_0x6b3d('0x2c')]['find']({'where':{'id':_0x34e85b['params']['id'],'UserId':null}})[_0x6b3d('0x11')](handleEntityNotFound(_0x4bfdfc,null))[_0x6b3d('0x11')](function(_0x150166){if(_0x150166){_0x59d7ba['message']=_0x150166['get']({'plain':!![]});return db[_0x6b3d('0x69')]['find']({'where':{'id':_0x150166[_0x6b3d('0x81')]}});}return null;})[_0x6b3d('0x11')](handleEntityNotFound(_0x4bfdfc,null))[_0x6b3d('0x11')](function(_0x9ddf8c){if(_0x9ddf8c){_0x59d7ba['interaction']=_0x9ddf8c['get']({'plain':!![]});interaction_log[_0x6b3d('0x12')](_0x6b3d('0x82'),_0x34e85b['user']['id'],_0x34e85b[_0x6b3d('0x6d')][_0x6b3d('0x28')],_0x34e85b['user']['role'],_0x59d7ba['interaction']['id'],_0x34e85b['body']?JSON[_0x6b3d('0x16')](_0x34e85b['body']):_0x6b3d('0x6e'));return respondWithRpcPromise(_0x6b3d('0x83'),_0x6b3d('0x84'),_0x59d7ba);}return null;})[_0x6b3d('0x11')](function(_0x32ea5f){var _0x2d0747=_0x6b3d('0x85')+_0x32ea5f[_0x6b3d('0x19')][_0x6b3d('0x70')];return db[_0x6b3d('0x71')][_0x6b3d('0x30')](_0x2d0747,{'type':db[_0x6b3d('0x72')]['QueryTypes'][_0x6b3d('0x74')],'raw':!![]})[_0x6b3d('0x11')](function(_0x48e457){return _0x48e457;});})[_0x6b3d('0x11')](function(_0x2fa264){if(_0x2fa264){_0x59d7ba[_0x6b3d('0x19')][_0x6b3d('0x86')]=_0x2fa264[0x0];if(!_0x34e85b['body'][_0x6b3d('0x67')])return;return db[_0x6b3d('0x75')]['find']({'where':{'id':_0x34e85b[_0x6b3d('0x48')][_0x6b3d('0x67')],'role':_0x6b3d('0x66')},'attributes':['id',_0x6b3d('0x28'),_0x6b3d('0x76'),_0x6b3d('0x77'),_0x6b3d('0x78')],'raw':!![]});}return null;})['then'](function(_0x388759){if(!_0x388759)return null;_0x59d7ba[_0x6b3d('0x19')][_0x6b3d('0x66')]=_0x388759;return _0x59d7ba;})['then'](function(_0x579082){if(_0x579082){_0x579082[_0x6b3d('0x19')][_0x6b3d('0x7a')]=util[_0x6b3d('0x61')]('SIP/%s',_0x34e85b[_0x6b3d('0x6d')]['name']);_0x579082[_0x6b3d('0x19')][_0x6b3d('0x7c')]=_0x59d7ba[_0x6b3d('0x7c')];_0x579082[_0x6b3d('0x19')][_0x6b3d('0x87')]=_0x59d7ba['channel'];_0x579082[_0x6b3d('0x19')]['event']=_0x6b3d('0x80');_0x579082[_0x6b3d('0x19')]['body']=htmlToText[_0x6b3d('0x7d')](_0x59d7ba[_0x6b3d('0x19')]['body']);respondWithRpcPromise(_0x6b3d('0x7e'),_0x6b3d('0x7e'),{'event':_0x6b3d('0x88'),'message':_0x579082[_0x6b3d('0x19')]},client9002);return _0x59d7ba;}return null;})[_0x6b3d('0x11')](respondWithResult(_0x4bfdfc,null))['catch'](handleError(_0x4bfdfc,null));};exports[_0x6b3d('0x89')]=function(_0x3f8e53,_0x3cccf6){var _0x13488a=moment()[_0x6b3d('0x8a')]()[_0x6b3d('0x8b')]();var _0x362f6e=path['join'](config[_0x6b3d('0x59')],_0x6b3d('0x8c'),_0x6b3d('0x8d'),_0x6b3d('0x8e'));var _0x5f439c=path['join'](config[_0x6b3d('0x59')],_0x6b3d('0x8c'),'files',_0x6b3d('0x57'));var _0x251cd6=util[_0x6b3d('0x61')](_0x6b3d('0x8f'),_0x13488a);return db[_0x6b3d('0x2c')]['find']({'where':{'id':_0x3f8e53[_0x6b3d('0x46')]['id']},'attributes':['id',_0x6b3d('0x48'),_0x6b3d('0x90'),'to','cc',_0x6b3d('0x91'),_0x6b3d('0x92'),_0x6b3d('0x93')],'include':_0x3f8e53[_0x6b3d('0x30')][_0x6b3d('0x57')]?[{'model':db[_0x6b3d('0x94')],'as':_0x6b3d('0x95')}]:undefined})['then'](handleEntityNotFound(_0x3cccf6,null))[_0x6b3d('0x11')](function(_0x2d9aba){if(_0x2d9aba){var _0x1e3228=_0x2d9aba;var _0x33e50c={'from':_0x1e3228[_0x6b3d('0x90')],'to':_0x1e3228['to'],'subject':_0x1e3228['subject'],'html':htmlEntities[_0x6b3d('0x96')](_0x1e3228[_0x6b3d('0x48')]),'headers':{'Date':moment(_0x1e3228[_0x6b3d('0x93')])[_0x6b3d('0x61')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2d9aba['cc']){_0x33e50c[_0x6b3d('0x97')]['Cc']=_0x2d9aba['cc'];}if(_0x2d9aba[_0x6b3d('0x91')]){_0x33e50c[_0x6b3d('0x97')]['Bcc']=_0x2d9aba[_0x6b3d('0x91')];}return new BPromise(function(_0x33e19,_0x166581){if(_0x2d9aba[_0x6b3d('0x95')]){for(var _0x4afc0c=0x0;_0x4afc0c<_0x2d9aba[_0x6b3d('0x95')][_0x6b3d('0x35')];_0x4afc0c++){var _0x43d0b9=_0x2d9aba['Attachments'][_0x4afc0c];var _0x221111=path[_0x6b3d('0x58')](_0x5f439c,_0x43d0b9[_0x6b3d('0x5b')]);if(fs[_0x6b3d('0x98')](_0x221111)){_0x33e50c[_0x6b3d('0x57')]['push']({'name':_0x43d0b9[_0x6b3d('0x28')],'contentType':_0x43d0b9[_0x6b3d('0x3e')],'data':fs[_0x6b3d('0x99')](_0x221111)});}}}emlformat[_0x6b3d('0x9a')](_0x33e50c,function(_0x1ba0d4,_0x4bf631){if(_0x1ba0d4)return _0x166581(_0x1ba0d4);fs[_0x6b3d('0x9b')](path['join'](_0x362f6e,_0x251cd6),_0x4bf631);return _0x33e19(_0x4bf631);});});}})[_0x6b3d('0x11')](function(_0x4daf88){if(_0x4daf88){return _0x3cccf6['download'](path[_0x6b3d('0x58')](_0x362f6e,_0x251cd6),_0x251cd6,function(_0x32ca0c){if(!_0x32ca0c)fs[_0x6b3d('0x9c')](path[_0x6b3d('0x58')](_0x362f6e,_0x251cd6));});}})[_0x6b3d('0x44')](handleError(_0x3cccf6,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8837ed4..922e013 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 _0x9819=['MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x408864,_0x3eb97b){var _0x4dc0cd=function(_0x11cabd){while(--_0x11cabd){_0x408864['push'](_0x408864['shift']());}};_0x4dc0cd(++_0x3eb97b);}(_0x9819,0xf8));var _0x9981=function(_0x525e60,_0x5f2c7b){_0x525e60=_0x525e60-0x0;var _0x47fd49=_0x9819[_0x525e60];return _0x47fd49;};'use strict';var EventEmitter=require(_0x9981('0x0'));var MailMessage=require(_0x9981('0x1'))['db'][_0x9981('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9981('0x3')](0x0);var events={'afterCreate':_0x9981('0x4'),'afterUpdate':_0x9981('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17e29b){return function(_0x34db4d,_0x583eec,_0x5441ba){MailMessageEvents['emit'](_0x17e29b+':'+_0x34db4d['id'],_0x34db4d);MailMessageEvents[_0x9981('0x6')](_0x17e29b,_0x34db4d);_0x5441ba(null);};}for(var e in events){if(events[_0x9981('0x7')](e)){var event=events[e];MailMessage[_0x9981('0x8')](e,emitEvent(event));}}module[_0x9981('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x9df3=['events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9df3,0xfc));var _0x39df=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x9df3[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0x39df('0x0'));var MailMessage=require(_0x39df('0x1'))['db'][_0x39df('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x39df('0x3'),'afterUpdate':_0x39df('0x4'),'afterDestroy':_0x39df('0x5')};function emitEvent(_0x480b6b){return function(_0x1fcc7c,_0xdfd841,_0x335c5b){MailMessageEvents[_0x39df('0x6')](_0x480b6b+':'+_0x1fcc7c['id'],_0x1fcc7c);MailMessageEvents[_0x39df('0x6')](_0x480b6b,_0x1fcc7c);_0x335c5b(null);};}for(var e in events){if(events[_0x39df('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x39df('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 228d49b..fd336db 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 _0x0d72=['isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4','../../config/logger','api','bluebird','html-to-text','path','rimraf','../../config/environment','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models','get','direction','toLowerCase','out','secret'];(function(_0xfd1fcd,_0x3182b7){var _0x1e0646=function(_0x4f4fa4){while(--_0x4f4fa4){_0xfd1fcd['push'](_0xfd1fcd['shift']());}};_0x1e0646(++_0x3182b7);}(_0x0d72,0x1e5));var _0x20d7=function(_0x4ba798,_0x76a8b2){_0x4ba798=_0x4ba798-0x0;var _0x1238a9=_0x0d72[_0x4ba798];return _0x1238a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20d7('0x0'))(_0x20d7('0x1'));var moment=require('moment');var BPromise=require(_0x20d7('0x2'));var rp=require('request-promise');var htmlToText=require(_0x20d7('0x3'));var fs=require('fs');var path=require(_0x20d7('0x4'));var rimraf=require(_0x20d7('0x5'));var config=require(_0x20d7('0x6'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x5252c9,_0x463b2e){return _0x5252c9['define']('MailMessage',attributes,{'tableName':_0x20d7('0x7'),'paranoid':![],'indexes':[{'name':_0x20d7('0x8'),'fields':['messageId']},{'name':_0x20d7('0x9'),'fields':[_0x20d7('0xa'),'subject'],'type':_0x20d7('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x375730,_0x246d6f,_0x31f1c3){if(_0x375730[_0x20d7('0xc')]){_0x375730['plainBody']=htmlToText['fromString'](_0x375730['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x31f1c3(null,_0x246d6f);},'afterCreate':function(_0x498fda,_0x1e2453,_0x51a0b1){var _0x4ad3ba=_0x5252c9[_0x20d7('0xd')];var _0x5bc46f=_0x498fda[_0x20d7('0xe')]({'plain':!![]});if(_0x5bc46f[_0x20d7('0xf')][_0x20d7('0x10')]()==='in'||_0x5bc46f['direction']['toLowerCase']()===_0x20d7('0x11')&&!_0x5bc46f[_0x20d7('0x12')]&&!_[_0x20d7('0x13')](_0x5bc46f[_0x20d7('0x14')])){_0x4ad3ba[_0x20d7('0x15')][_0x20d7('0x16')]({'where':{'id':_0x5bc46f[_0x20d7('0x17')]}})[_0x20d7('0x18')](function(_0x2161fc){if(_0x2161fc){_0x2161fc['update']({'lastMsgAt':_0x5bc46f[_0x20d7('0x19')],'lastMsgDirection':_0x5bc46f[_0x20d7('0xf')]['toLowerCase']()});}})['catch'](function(_0xa644d2){console[_0x20d7('0x1a')](_0xa644d2);});}_0x51a0b1();}},'charset':_0x20d7('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x95e3=['mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailMessage.attributes','exports'];(function(_0x3720d1,_0x968d8b){var _0x14a1e8=function(_0x454184){while(--_0x454184){_0x3720d1['push'](_0x3720d1['shift']());}};_0x14a1e8(++_0x968d8b);}(_0x95e3,0x18b));var _0x395e=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x95e3[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x395e('0x0'));var util=require('util');var logger=require(_0x395e('0x1'))(_0x395e('0x2'));var moment=require('moment');var BPromise=require(_0x395e('0x3'));var rp=require(_0x395e('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x395e('0x5'));var attributes=require(_0x395e('0x6'));module[_0x395e('0x7')]=function(_0x5603a0,_0x5c7693){return _0x5603a0['define']('MailMessage',attributes,{'tableName':_0x395e('0x8'),'paranoid':![],'indexes':[{'name':_0x395e('0x9'),'fields':[_0x395e('0x9')]},{'name':_0x395e('0xa'),'fields':[_0x395e('0xb'),_0x395e('0xc')],'type':_0x395e('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d854c,_0x1dc32f,_0x3fa536){if(_0x2d854c[_0x395e('0xe')]){_0x2d854c[_0x395e('0xb')]=htmlToText[_0x395e('0xf')](_0x2d854c[_0x395e('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3fa536(null,_0x1dc32f);},'afterCreate':function(_0x1774d2,_0x4bf613,_0x37cff3){var _0x52ec48=_0x5603a0[_0x395e('0x10')];var _0x5de841=_0x1774d2[_0x395e('0x11')]({'plain':!![]});if(_0x5de841[_0x395e('0x12')][_0x395e('0x13')]()==='in'||_0x5de841['direction'][_0x395e('0x13')]()===_0x395e('0x14')&&!_0x5de841[_0x395e('0x15')]&&!_[_0x395e('0x16')](_0x5de841[_0x395e('0x17')])){_0x52ec48['MailInteraction'][_0x395e('0x18')]({'where':{'id':_0x5de841[_0x395e('0x19')]}})[_0x395e('0x1a')](function(_0x26a839){if(_0x26a839){_0x26a839['update']({'lastMsgAt':_0x5de841[_0x395e('0x1b')],'lastMsgDirection':_0x5de841[_0x395e('0x12')][_0x395e('0x13')]()});}})['catch'](function(_0x45356b){console[_0x395e('0x1c')](_0x45356b);});}_0x37cff3();}},'charset':_0x395e('0x1d'),'collate':_0x395e('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bd26961..df3b760 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 _0x1a85=['info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x1a85,0x178));var _0x51a8=function(_0x77d76e,_0x106ed2){_0x77d76e=_0x77d76e-0x0;var _0x5620c8=_0x1a85[_0x77d76e];return _0x5620c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});}exports[_0x51a8('0x19')]=function(_0x2217ce){var _0x2f2681=this;return new Promise(function(_0x2a4c4c,_0x3bc044){return db[_0x51a8('0x1a')][_0x51a8('0x1b')](_0x2217ce['body'],{'raw':_0x2217ce[_0x51a8('0x1c')]?_0x2217ce['options'][_0x51a8('0x1d')]===undefined?!![]:![]:!![]})[_0x51a8('0xd')](function(_0x8bda40){logger[_0x51a8('0xe')]('CreateMailMessage',_0x2217ce);logger[_0x51a8('0x11')]('CreateMailMessage',_0x2217ce,JSON['stringify'](_0x8bda40));_0x2a4c4c(_0x8bda40);})[_0x51a8('0x18')](function(_0x52e503){logger[_0x51a8('0x14')](_0x51a8('0x19'),_0x52e503[_0x51a8('0x16')],_0x2217ce);_0x3bc044(_0x2f2681[_0x51a8('0x14')](0x1f4,_0x52e503[_0x51a8('0x16')]));});});}; \ No newline at end of file +var _0x7d25=['client','redis','defaults','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29f4b3,_0x233c08){var _0x3e1848=function(_0x1ebb01){while(--_0x1ebb01){_0x29f4b3['push'](_0x29f4b3['shift']());}};_0x3e1848(++_0x233c08);}(_0x7d25,0x8a));var _0x57d2=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x7d25[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./mailMessage.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('MailMessage,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});}exports[_0x57d2('0x17')]=function(_0x5b1b9d){var _0x1cbe4a=this;return new Promise(function(_0xcf924f,_0x55191e){return db['MailMessage'][_0x57d2('0x18')](_0x5b1b9d[_0x57d2('0x19')],{'raw':_0x5b1b9d[_0x57d2('0x1a')]?_0x5b1b9d[_0x57d2('0x1a')][_0x57d2('0x1b')]===undefined?!![]:![]:!![]})[_0x57d2('0xc')](function(_0x32c7c8){logger[_0x57d2('0xd')](_0x57d2('0x17'),_0x5b1b9d);logger[_0x57d2('0x10')](_0x57d2('0x17'),_0x5b1b9d,JSON[_0x57d2('0x12')](_0x32c7c8));_0xcf924f(_0x32c7c8);})[_0x57d2('0x1c')](function(_0x473df2){logger['error'](_0x57d2('0x17'),_0x473df2[_0x57d2('0x15')],_0x5b1b9d);_0x55191e(_0x1cbe4a[_0x57d2('0x13')](0x1f4,_0x473df2[_0x57d2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9cc9f1d..3ae9612 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 _0x25ad=['mailMessage:','./mailMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x504c84,_0xa6355){var _0x28bfdf=function(_0xfd14f){while(--_0xfd14f){_0x504c84['push'](_0x504c84['shift']());}};_0x28bfdf(++_0xa6355);}(_0x25ad,0x1b1));var _0xd25a=function(_0x465be6,_0x2668de){_0x465be6=_0x465be6-0x0;var _0x45f7b1=_0x25ad[_0x465be6];return _0x45f7b1;};'use strict';var MailMessageEvents=require(_0xd25a('0x0'));var events=['save',_0xd25a('0x1'),_0xd25a('0x2')];function createListener(_0x2acd3a,_0x538e36){return function(_0x26b892){_0x538e36[_0xd25a('0x3')](_0x2acd3a,_0x26b892);};}function removeListener(_0x1532c5,_0x6a6a0d){return function(){MailMessageEvents[_0xd25a('0x4')](_0x1532c5,_0x6a6a0d);};}exports[_0xd25a('0x5')]=function(_0x544053){for(var _0x4ca0db=0x0,_0x3694c6=events[_0xd25a('0x6')];_0x4ca0db<_0x3694c6;_0x4ca0db++){var _0x5cf769=events[_0x4ca0db];var _0x237c8b=createListener(_0xd25a('0x7')+_0x5cf769,_0x544053);MailMessageEvents['on'](_0x5cf769,_0x237c8b);}}; \ No newline at end of file +var _0x742c=['emit','register','length','mailMessage:','save','update'];(function(_0x22c90a,_0x88f294){var _0x25240c=function(_0x50ffe1){while(--_0x50ffe1){_0x22c90a['push'](_0x22c90a['shift']());}};_0x25240c(++_0x88f294);}(_0x742c,0x1c6));var _0xc742=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x742c[_0x45783c];return _0x1161da;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc742('0x0'),'remove',_0xc742('0x1')];function createListener(_0x29b636,_0x5b4f4d){return function(_0x3a01bf){_0x5b4f4d[_0xc742('0x2')](_0x29b636,_0x3a01bf);};}function removeListener(_0x48ba18,_0x321bca){return function(){MailMessageEvents['removeListener'](_0x48ba18,_0x321bca);};}exports[_0xc742('0x3')]=function(_0x290a88){for(var _0xd3f752=0x0,_0x47427b=events[_0xc742('0x4')];_0xd3f752<_0x47427b;_0xd3f752++){var _0x2b73eb=events[_0xd3f752];var _0x216136=createListener(_0xc742('0x5')+_0x2b73eb,_0x290a88);MailMessageEvents['on'](_0x2b73eb,_0x216136);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index bd95350..d38b7bd 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 _0xffa9=['update','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','create','addTeams','post','addAgents','put'];(function(_0x1a16b1,_0x292d9a){var _0x4c07b6=function(_0x3cb9d9){while(--_0x3cb9d9){_0x1a16b1['push'](_0x1a16b1['shift']());}};_0x4c07b6(++_0x292d9a);}(_0xffa9,0x13b));var _0x9ffa=function(_0x5a4b16,_0x294bb1){_0x5a4b16=_0x5a4b16-0x0;var _0x5236dc=_0xffa9[_0x5a4b16];return _0x5236dc;};'use strict';var multer=require(_0x9ffa('0x0'));var util=require('util');var path=require(_0x9ffa('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ffa('0x2'));var router=express[_0x9ffa('0x3')]();var fs_extra=require(_0x9ffa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ffa('0x5'));var config=require(_0x9ffa('0x6'));var controller=require('./mailQueue.controller');router[_0x9ffa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9ffa('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9ffa('0x8')]);router['get'](_0x9ffa('0x9'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0xb')]);router['get'](_0x9ffa('0xc'),auth[_0x9ffa('0xa')](),controller['getMembers']);router[_0x9ffa('0x7')](_0x9ffa('0xd'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0xe')]);router[_0x9ffa('0x7')](_0x9ffa('0xf'),auth[_0x9ffa('0xa')](),controller['getAgents']);router['post']('/',auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x10')]);router['post'](_0x9ffa('0xd'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x11')]);router[_0x9ffa('0x12')]('/:id/users',auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x13')]);router[_0x9ffa('0x14')](_0x9ffa('0x9'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x15')]);router['delete'](_0x9ffa('0x9'),auth[_0x9ffa('0xa')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x9ffa('0xf'),auth['isAuthenticated'](),controller[_0x9ffa('0x16')]);module[_0x9ffa('0x17')]=router; \ No newline at end of file +var _0xb08b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xb08b,0xc8));var _0xbb08=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0xb08b[_0x35d3a8];return _0x182378;};'use strict';var multer=require(_0xbb08('0x0'));var util=require('util');var path=require(_0xbb08('0x1'));var timeout=require(_0xbb08('0x2'));var express=require('express');var router=express[_0xbb08('0x3')]();var fs_extra=require(_0xbb08('0x4'));var auth=require(_0xbb08('0x5'));var interaction=require(_0xbb08('0x6'));var config=require(_0xbb08('0x7'));var controller=require(_0xbb08('0x8'));router[_0xbb08('0x9')]('/',auth[_0xbb08('0xa')](),controller['index']);router[_0xbb08('0x9')](_0xbb08('0xb'),auth[_0xbb08('0xa')](),controller[_0xbb08('0xc')]);router[_0xbb08('0x9')](_0xbb08('0xd'),auth[_0xbb08('0xa')](),controller[_0xbb08('0xe')]);router[_0xbb08('0x9')]('/:id/members',auth[_0xbb08('0xa')](),controller[_0xbb08('0xf')]);router['get'](_0xbb08('0x10'),auth[_0xbb08('0xa')](),controller[_0xbb08('0x11')]);router['get']('/:id/users',auth[_0xbb08('0xa')](),controller[_0xbb08('0x12')]);router[_0xbb08('0x13')]('/',auth[_0xbb08('0xa')](),controller[_0xbb08('0x14')]);router[_0xbb08('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbb08('0x15')]);router[_0xbb08('0x13')](_0xbb08('0x16'),auth[_0xbb08('0xa')](),controller['addAgents']);router[_0xbb08('0x17')](_0xbb08('0xd'),auth[_0xbb08('0xa')](),controller[_0xbb08('0x18')]);router[_0xbb08('0x19')]('/:id',auth[_0xbb08('0xa')](),controller[_0xbb08('0x1a')]);router[_0xbb08('0x19')](_0xbb08('0x10'),auth['isAuthenticated'](),controller[_0xbb08('0x1b')]);router[_0xbb08('0x19')](_0xbb08('0x16'),auth[_0xbb08('0xa')](),controller[_0xbb08('0x1c')]);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 bdf2b45..71c7f00 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 _0xd65c=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x54ba3f,_0x27c0ec){var _0x20dd75=function(_0x32d38b){while(--_0x32d38b){_0x54ba3f['push'](_0x54ba3f['shift']());}};_0x20dd75(++_0x27c0ec);}(_0xd65c,0xee));var _0xcd65=function(_0x273f3a,_0x3c3708){_0x273f3a=_0x273f3a-0x0;var _0x3272ab=_0xd65c[_0x273f3a];return _0x3272ab;};'use strict';var Sequelize=require(_0xcd65('0x0'));module[_0xcd65('0x1')]={'name':{'type':Sequelize[_0xcd65('0x2')],'unique':_0xcd65('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcd65('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd65('0x5')](_0xcd65('0x6'),_0xcd65('0x7'),_0xcd65('0x8'))}}; \ No newline at end of file +var _0xbb56=['ENUM','rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x5c110c,_0x58d08b){var _0x485822=function(_0xb98557){while(--_0xb98557){_0x5c110c['push'](_0x5c110c['shift']());}};_0x485822(++_0x58d08b);}(_0xbb56,0x18b));var _0x6bb5=function(_0x313e5f,_0x27c27f){_0x313e5f=_0x313e5f-0x0;var _0x3e76c6=_0xbb56[_0x313e5f];return _0x3e76c6;};'use strict';var Sequelize=require(_0x6bb5('0x0'));module[_0x6bb5('0x1')]={'name':{'type':Sequelize[_0x6bb5('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6bb5('0x2')]},'timeout':{'type':Sequelize[_0x6bb5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6bb5('0x4')](_0x6bb5('0x5'),_0x6bb5('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ea213b8..8ddf6b6 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 _0x500f=['findOne','UserMailQueue','hasOwnProperty','order','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','SIP','mailPause','getTeams','addTeams','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','compact','removeAgents','addAgents','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','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','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','get','then','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','intersection','include','options','find','create','body','user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers'];(function(_0x5edf79,_0x330111){var _0x5750cd=function(_0x3d4515){while(--_0x3d4515){_0x5edf79['push'](_0x5edf79['shift']());}};_0x5750cd(++_0x330111);}(_0x500f,0x1d5));var _0xf500=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x500f[_0x289a67];return _0x572b49;};'use strict';var emlformat=require(_0xf500('0x0'));var rimraf=require(_0xf500('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf500('0x2'));var rp=require(_0xf500('0x3'));var moment=require(_0xf500('0x4'));var BPromise=require(_0xf500('0x5'));var Mustache=require(_0xf500('0x6'));var util=require(_0xf500('0x7'));var path=require('path');var sox=require(_0xf500('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf500('0x9'));var _=require(_0xf500('0xa'));var squel=require(_0xf500('0xb'));var crypto=require(_0xf500('0xc'));var jsforce=require(_0xf500('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf500('0xe'));var Papa=require(_0xf500('0xf'));var Redis=require(_0xf500('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf500('0x11'));var as=require(_0xf500('0x12'));var hardwareService=require(_0xf500('0x13'));var logger=require(_0xf500('0x14'))(_0xf500('0x15'));var utils=require(_0xf500('0x16'));var config=require(_0xf500('0x17'));var licenseUtil=require(_0xf500('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf500('0x19')],{'host':_0xf500('0x1a'),'port':0x18eb});var socket=require(_0xf500('0x1b'))(new Redis(config[_0xf500('0x19')]));require(_0xf500('0x1c'))[_0xf500('0x1d')](socket);function respondWithStatusCode(_0x3a4467,_0xfe2e24){_0xfe2e24=_0xfe2e24||0xcc;return function(_0x4c99c8){if(_0x4c99c8){return _0x3a4467[_0xf500('0x1e')](_0xfe2e24);}return _0x3a4467[_0xf500('0x1f')](_0xfe2e24)[_0xf500('0x20')]();};}function respondWithResult(_0x788563,_0x5f1848){_0x5f1848=_0x5f1848||0xc8;return function(_0x455542){if(_0x455542){return _0x788563[_0xf500('0x1f')](_0x5f1848)[_0xf500('0x21')](_0x455542);}};}function respondWithFilteredResult(_0x55b2a4,_0x2ca4fb){return function(_0x32a187){if(_0x32a187){var _0x204cf3=typeof _0x2ca4fb['offset']===_0xf500('0x22')&&typeof _0x2ca4fb[_0xf500('0x23')]===_0xf500('0x22');var _0xb654=_0x32a187[_0xf500('0x24')];var _0x5dfe4f=_0x204cf3?0x0:_0x2ca4fb[_0xf500('0x25')];var _0x5bc84c=_0x204cf3?_0x32a187[_0xf500('0x24')]:_0x2ca4fb[_0xf500('0x25')]+_0x2ca4fb['limit'];var _0x3117cb;if(_0x5bc84c>=_0xb654){_0x5bc84c=_0xb654;_0x3117cb=0xc8;}else{_0x3117cb=0xce;}_0x55b2a4['status'](_0x3117cb);return _0x55b2a4[_0xf500('0x26')]('Content-Range',_0x5dfe4f+'-'+_0x5bc84c+'/'+_0xb654)['json'](_0x32a187);}return null;};}function patchUpdates(_0x437e96){return function(_0x3c6f78){try{jsonpatch[_0xf500('0x27')](_0x3c6f78,_0x437e96,!![]);}catch(_0x159f22){return BPromise[_0xf500('0x28')](_0x159f22);}return _0x3c6f78['save']();};}function saveUpdates(_0x45c8f5,_0x4728aa){return function(_0x13fafd){if(_0x13fafd){return _0x13fafd[_0xf500('0x29')](_0x45c8f5)['then'](function(_0x22f6ae){return _0x22f6ae;});}return null;};}function removeEntity(_0x3029be,_0x4627c4){return function(_0x1311dc){if(_0x1311dc){return _0x1311dc[_0xf500('0x2a')]()['then'](function(){var _0x5e4240=_0x1311dc[_0xf500('0x2b')]({'plain':!![]});var _0x489334='MailQueues';return db['UserProfileResource'][_0xf500('0x2a')]({'where':{'type':_0x489334,'resourceId':_0x5e4240['id']}})[_0xf500('0x2c')](function(){return _0x1311dc;});})[_0xf500('0x2c')](function(){_0x3029be[_0xf500('0x1f')](0xcc)[_0xf500('0x20')]();});}};}function handleEntityNotFound(_0x6139e8,_0xc5664f){return function(_0x2c9de7){if(!_0x2c9de7){_0x6139e8[_0xf500('0x1e')](0x194);}return _0x2c9de7;};}function handleError(_0x23b1f4,_0xd63943){_0xd63943=_0xd63943||0x1f4;return function(_0x37cb64){logger[_0xf500('0x2d')](_0x37cb64[_0xf500('0x2e')]);if(_0x37cb64[_0xf500('0x2f')]){delete _0x37cb64['name'];}_0x23b1f4[_0xf500('0x1f')](_0xd63943)[_0xf500('0x30')](_0x37cb64);};}exports[_0xf500('0x31')]=function(_0x50551f,_0x4608ef){var _0x6d750={},_0x1924d5={},_0xd4ae8b={'count':0x0,'rows':[]};var _0x2ce9c5=_[_0xf500('0x32')](db[_0xf500('0x33')][_0xf500('0x34')],function(_0x229476){return{'name':_0x229476[_0xf500('0x35')],'type':_0x229476[_0xf500('0x36')][_0xf500('0x37')]};});_0x1924d5[_0xf500('0x38')]=_[_0xf500('0x32')](_0x2ce9c5,_0xf500('0x2f'));_0x1924d5[_0xf500('0x39')]=_[_0xf500('0x3a')](_0x50551f[_0xf500('0x39')]);_0x1924d5['filters']=_['intersection'](_0x1924d5[_0xf500('0x38')],_0x1924d5[_0xf500('0x39')]);_0x6d750[_0xf500('0x3b')]=_['intersection'](_0x1924d5['model'],qs[_0xf500('0x3c')](_0x50551f[_0xf500('0x39')][_0xf500('0x3c')]));_0x6d750[_0xf500('0x3b')]=_0x6d750[_0xf500('0x3b')][_0xf500('0x3d')]?_0x6d750[_0xf500('0x3b')]:_0x1924d5['model'];if(!_0x50551f['query']['hasOwnProperty'](_0xf500('0x3e'))){_0x6d750['limit']=qs['limit'](_0x50551f[_0xf500('0x39')][_0xf500('0x23')]);_0x6d750[_0xf500('0x25')]=qs[_0xf500('0x25')](_0x50551f[_0xf500('0x39')][_0xf500('0x25')]);}_0x6d750['order']=qs[_0xf500('0x3f')](_0x50551f[_0xf500('0x39')][_0xf500('0x3f')]);_0x6d750[_0xf500('0x40')]=qs[_0xf500('0x41')](_[_0xf500('0x42')](_0x50551f['query'],_0x1924d5[_0xf500('0x41')]),_0x2ce9c5);if(_0x50551f[_0xf500('0x39')][_0xf500('0x43')]){_0x6d750[_0xf500('0x40')]=_[_0xf500('0x44')](_0x6d750[_0xf500('0x40')],{'$or':_['map'](_0x2ce9c5,function(_0x23aa75){if(_0x23aa75[_0xf500('0x36')]!==_0xf500('0x45')){var _0x3b91c3={};_0x3b91c3[_0x23aa75[_0xf500('0x2f')]]={'$like':'%'+_0x50551f['query'][_0xf500('0x43')]+'%'};return _0x3b91c3;}})});}_0x6d750=_['merge']({},_0x6d750,_0x50551f['options']);var _0x1cdb8b={'where':_0x6d750['where']};return db[_0xf500('0x33')][_0xf500('0x24')](_0x1cdb8b)[_0xf500('0x2c')](function(_0x1e0f37){_0xd4ae8b[_0xf500('0x24')]=_0x1e0f37;if(_0x50551f[_0xf500('0x39')][_0xf500('0x46')]){_0x6d750['include']=[{'all':!![]}];}return db[_0xf500('0x33')][_0xf500('0x47')](_0x6d750);})[_0xf500('0x2c')](function(_0x5e2019){_0xd4ae8b[_0xf500('0x48')]=_0x5e2019;return _0xd4ae8b;})[_0xf500('0x2c')](respondWithFilteredResult(_0x4608ef,_0x6d750))[_0xf500('0x49')](handleError(_0x4608ef,null));};exports['show']=function(_0x3525f1,_0x21885b){var _0x2e25c9={'raw':!![],'where':{'id':_0x3525f1['params']['id']}},_0x1d0734={};_0x1d0734[_0xf500('0x38')]=_['keys'](db[_0xf500('0x33')]['rawAttributes']);_0x1d0734['query']=_[_0xf500('0x3a')](_0x3525f1[_0xf500('0x39')]);_0x1d0734[_0xf500('0x41')]=_[_0xf500('0x4a')](_0x1d0734['model'],_0x1d0734[_0xf500('0x39')]);_0x2e25c9[_0xf500('0x3b')]=_[_0xf500('0x4a')](_0x1d0734[_0xf500('0x38')],qs[_0xf500('0x3c')](_0x3525f1[_0xf500('0x39')][_0xf500('0x3c')]));_0x2e25c9[_0xf500('0x3b')]=_0x2e25c9[_0xf500('0x3b')][_0xf500('0x3d')]?_0x2e25c9[_0xf500('0x3b')]:_0x1d0734[_0xf500('0x38')];if(_0x3525f1['query']['includeAll']){_0x2e25c9[_0xf500('0x4b')]=[{'all':!![]}];}_0x2e25c9=_[_0xf500('0x44')]({},_0x2e25c9,_0x3525f1[_0xf500('0x4c')]);return db[_0xf500('0x33')][_0xf500('0x4d')](_0x2e25c9)[_0xf500('0x2c')](handleEntityNotFound(_0x21885b,null))[_0xf500('0x2c')](respondWithResult(_0x21885b,null))['catch'](handleError(_0x21885b,null));};exports[_0xf500('0x4e')]=function(_0x5973c5,_0x9a7376){return db[_0xf500('0x33')][_0xf500('0x4e')](_0x5973c5[_0xf500('0x4f')],{})[_0xf500('0x2c')](function(_0x1106e0){var _0x4cca44=_0x5973c5[_0xf500('0x50')]['get']({'plain':!![]});if(!_0x4cca44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cca44[_0xf500('0x51')]===_0xf500('0x50')){var _0x1bd48d=_0x1106e0[_0xf500('0x2b')]({'plain':!![]});var _0x5b64b5=_0xf500('0x52');return db[_0xf500('0x53')]['find']({'where':{'name':_0x5b64b5,'userProfileId':_0x4cca44[_0xf500('0x54')]},'raw':!![]})[_0xf500('0x2c')](function(_0x39bf62){if(_0x39bf62&&_0x39bf62[_0xf500('0x55')]===0x0){return db[_0xf500('0x56')][_0xf500('0x4e')]({'name':_0x1bd48d[_0xf500('0x2f')],'resourceId':_0x1bd48d['id'],'type':_0x39bf62['name'],'sectionId':_0x39bf62['id']},{})[_0xf500('0x2c')](function(){return _0x1106e0;});}else{return _0x1106e0;}})['catch'](function(_0x21bfdd){logger[_0xf500('0x2d')](_0xf500('0x57'),_0x21bfdd);throw _0x21bfdd;});}return _0x1106e0;})['then'](respondWithResult(_0x9a7376,0xc9))['catch'](handleError(_0x9a7376,null));};exports[_0xf500('0x29')]=function(_0x9f628b,_0x51aea9){if(_0x9f628b[_0xf500('0x4f')]['id']){delete _0x9f628b[_0xf500('0x4f')]['id'];}return db[_0xf500('0x33')]['find']({'where':{'id':_0x9f628b[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x51aea9,null))[_0xf500('0x2c')](saveUpdates(_0x9f628b['body'],null))[_0xf500('0x2c')](respondWithResult(_0x51aea9,null))[_0xf500('0x49')](handleError(_0x51aea9,null));};exports[_0xf500('0x2a')]=function(_0x114825,_0x47eca6){return db['MailQueue'][_0xf500('0x4d')]({'where':{'id':_0x114825[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x47eca6,null))[_0xf500('0x2c')](removeEntity(_0x47eca6,null))[_0xf500('0x49')](handleError(_0x47eca6,null));};exports[_0xf500('0x59')]=function(_0x4693d4,_0x19367f){return db[_0xf500('0x33')][_0xf500('0x59')]()[_0xf500('0x2c')](respondWithResult(_0x19367f,null))[_0xf500('0x49')](handleError(_0x19367f,null));};exports[_0xf500('0x5a')]=function(_0x2a23f8,_0x482f27,_0x225810){var _0x1ccd65={'raw':!![],'where':{}},_0x370842={},_0xe53320;return db['MailQueue'][_0xf500('0x5b')]({'where':{'id':_0x2a23f8[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x482f27,null))['then'](function(_0x32c552){if(_0x32c552){_0xe53320=_0x32c552[_0xf500('0x2b')]({'plain':!![]});_0x370842[_0xf500('0x38')]=_['keys'](db[_0xf500('0x5c')][_0xf500('0x34')]);_0x370842['query']=_[_0xf500('0x3a')](_0x2a23f8[_0xf500('0x39')]);_0x370842[_0xf500('0x41')]=_['intersection'](_0x370842[_0xf500('0x38')],_0x370842['query']);_0x1ccd65['attributes']=_[_0xf500('0x4a')](_0x370842[_0xf500('0x38')],qs[_0xf500('0x3c')](_0x2a23f8['query'][_0xf500('0x3c')]));_0x1ccd65[_0xf500('0x3b')]=_0x1ccd65['attributes']['length']?_0x1ccd65[_0xf500('0x3b')]:_0x370842[_0xf500('0x38')];if(!_0x2a23f8[_0xf500('0x39')][_0xf500('0x5d')](_0xf500('0x3e'))){_0x1ccd65[_0xf500('0x23')]=qs[_0xf500('0x23')](_0x2a23f8[_0xf500('0x39')][_0xf500('0x23')]);_0x1ccd65[_0xf500('0x25')]=qs['offset'](_0x2a23f8['query'][_0xf500('0x25')]);}_0x1ccd65[_0xf500('0x5e')]=qs[_0xf500('0x3f')](_0x2a23f8[_0xf500('0x39')][_0xf500('0x3f')]);_0x1ccd65[_0xf500('0x40')]=qs[_0xf500('0x41')](_[_0xf500('0x42')](_0x2a23f8[_0xf500('0x39')],_0x370842[_0xf500('0x41')]));_0x1ccd65[_0xf500('0x40')][_0xf500('0x5f')]=_0x32c552['id'];if(_0x2a23f8[_0xf500('0x39')][_0xf500('0x43')]){_0x1ccd65[_0xf500('0x40')]=_[_0xf500('0x44')](_0x1ccd65[_0xf500('0x40')],{'$or':_[_0xf500('0x32')](_0x1ccd65[_0xf500('0x3b')],function(_0x478fd2){var _0x436497={};_0x436497[_0x478fd2]={'$like':'%'+_0x2a23f8[_0xf500('0x39')][_0xf500('0x43')]+'%'};return _0x436497;})});}_0x1ccd65=_['merge']({},_0x1ccd65,_0x2a23f8[_0xf500('0x4c')]);return db[_0xf500('0x5c')][_0xf500('0x47')](_0x1ccd65);}})[_0xf500('0x2c')](function(_0x50d8f7){if(_0x50d8f7){return db[_0xf500('0x60')][_0xf500('0x61')]({'where':{'id':_[_0xf500('0x32')](_0x50d8f7,_0xf500('0x62')),'role':_0xf500('0x63')},'attributes':['id',_0xf500('0x2f'),'mailPause',_0xf500('0x64'),_0xf500('0x65')]});}})[_0xf500('0x2c')](function(_0x30cf9a){if(_0x30cf9a){return{'count':_0x30cf9a['count'],'rows':_[_0xf500('0x32')](_0x30cf9a[_0xf500('0x48')],function(_0x3da3b7){return{'membername':_0x3da3b7[_0xf500('0x2f')],'UserId':_0x3da3b7['id'],'queue_name':_0xe53320[_0xf500('0x2f')],'MailQueueId':_0xe53320['id'],'interface':util['format']('%s/%s',_0xf500('0x66'),_0x3da3b7['name']),'penalty':0x0,'paused':_0x3da3b7[_0xf500('0x67')],'createdAt':_0x3da3b7['createdAt'],'updatedAt':_0x3da3b7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf500('0x2c')](respondWithFilteredResult(_0x482f27,_0x1ccd65))[_0xf500('0x49')](handleError(_0x482f27,null));};exports[_0xf500('0x68')]=function(_0x327f4c,_0x176c40,_0x4a8366){var _0x2d2a9e={};var _0x27a95e={};var _0x33e1f3;var _0x1a90bc;return db[_0xf500('0x33')]['findOne']({'where':{'id':_0x327f4c[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x176c40,null))[_0xf500('0x2c')](function(_0x32b6d8){if(_0x32b6d8){_0x33e1f3=_0x32b6d8;_0x27a95e['model']=_['keys'](db['Team'][_0xf500('0x34')]);_0x27a95e[_0xf500('0x39')]=_[_0xf500('0x3a')](_0x327f4c[_0xf500('0x39')]);_0x27a95e['filters']=_[_0xf500('0x4a')](_0x27a95e['model'],_0x27a95e[_0xf500('0x39')]);_0x2d2a9e[_0xf500('0x3b')]=_['intersection'](_0x27a95e[_0xf500('0x38')],qs[_0xf500('0x3c')](_0x327f4c[_0xf500('0x39')][_0xf500('0x3c')]));_0x2d2a9e[_0xf500('0x3b')]=_0x2d2a9e[_0xf500('0x3b')][_0xf500('0x3d')]?_0x2d2a9e[_0xf500('0x3b')]:_0x27a95e[_0xf500('0x38')];_0x2d2a9e[_0xf500('0x5e')]=qs[_0xf500('0x3f')](_0x327f4c['query'][_0xf500('0x3f')]);_0x2d2a9e['where']=qs[_0xf500('0x41')](_[_0xf500('0x42')](_0x327f4c[_0xf500('0x39')],_0x27a95e[_0xf500('0x41')]));if(_0x327f4c[_0xf500('0x39')]['filter']){_0x2d2a9e[_0xf500('0x40')]=_[_0xf500('0x44')](_0x2d2a9e['where'],{'$or':_[_0xf500('0x32')](_0x2d2a9e[_0xf500('0x3b')],function(_0x5afb5d){var _0x25deb7={};_0x25deb7[_0x5afb5d]={'$like':'%'+_0x327f4c[_0xf500('0x39')][_0xf500('0x43')]+'%'};return _0x25deb7;})});}_0x2d2a9e=_[_0xf500('0x44')]({},_0x2d2a9e,_0x327f4c[_0xf500('0x4c')]);return _0x33e1f3[_0xf500('0x68')](_0x2d2a9e);}})[_0xf500('0x2c')](function(_0xbe9890){if(_0xbe9890){_0x1a90bc=_0xbe9890[_0xf500('0x3d')];if(!_0x327f4c[_0xf500('0x39')][_0xf500('0x5d')](_0xf500('0x3e'))){_0x2d2a9e[_0xf500('0x23')]=qs[_0xf500('0x23')](_0x327f4c['query'][_0xf500('0x23')]);_0x2d2a9e['offset']=qs[_0xf500('0x25')](_0x327f4c[_0xf500('0x39')][_0xf500('0x25')]);}return _0x33e1f3[_0xf500('0x68')](_0x2d2a9e);}})[_0xf500('0x2c')](function(_0x1203cf){if(_0x1203cf){return _0x1203cf?{'count':_0x1a90bc,'rows':_0x1203cf}:null;}})[_0xf500('0x2c')](respondWithResult(_0x176c40,null))['catch'](handleError(_0x176c40,null));};exports[_0xf500('0x69')]=function(_0x595229,_0x4369c8,_0x437425){var _0x38bae3=_0x595229[_0xf500('0x4f')]['ids'];return db['Team'][_0xf500('0x47')]({'where':{'id':_0x38bae3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf500('0x2f'),'online',_0xf500('0x6a'),_0xf500('0x6b')],'raw':!![]}]})['then'](function(_0x3c409e){if(_0x3c409e){var _0x2f969f=_[_0xf500('0x6c')](_0x3c409e,function(_0x4674c4){var _0x1c5b37=_0x4674c4['get']({'plain':!![]});return _0x1c5b37['Agents'];});return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x595229[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](function(_0x225a63){return db[_0xf500('0x6d')][_0xf500('0x6e')](function(_0x5e72aa){return _0x225a63['addTeams'](_0x38bae3,{'transaction':_0x5e72aa})[_0xf500('0x2c')](function(){return BPromise[_0xf500('0x6f')](_0x2f969f,function(_0x4ca784){return db[_0xf500('0x5c')][_0xf500('0x70')]({'where':{'UserId':_0x4ca784['id'],'MailQueueId':_0x595229[_0xf500('0x58')]['id']},'transaction':_0x5e72aa});});})[_0xf500('0x2c')](function(){_0x2f969f[_0xf500('0x71')](function(_0x4655ae){socket[_0xf500('0x72')](_0xf500('0x73'),{'UserId':_0x4655ae['id'],'MailQueueId':_0x225a63['id']});});});});});}})['then'](respondWithStatusCode(_0x4369c8,null))['catch'](handleError(_0x4369c8,null));};exports[_0xf500('0x74')]=function(_0x553fdc,_0x49e455,_0x59da1e){return db['Team'][_0xf500('0x47')]({'where':{'id':_0x553fdc[_0xf500('0x39')][_0xf500('0x75')]},'attributes':['id'],'include':[{'model':db[_0xf500('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf500('0x2c')](handleEntityNotFound(_0x49e455,null))[_0xf500('0x2c')](function(_0x2acb08){var _0x4615f8=_['map'](_0x2acb08,'id');var _0x2ee33d=[];var _0x2459c4=[];var _0x2829f3=squel[_0xf500('0x76')]();_0x2829f3[_0xf500('0x77')]('tq.TeamId')['from'](_0xf500('0x78'),'tq')[_0xf500('0x79')](_0xf500('0x7a'),'ut',_0xf500('0x7b'))['where'](_0xf500('0x7c'),_0x553fdc[_0xf500('0x58')]['id']);for(var _0x12b100=0x0;_0x12b100<_0x2acb08[_0xf500('0x3d')];_0x12b100+=0x1){let _0x20ac5a=_0x2acb08[_0x12b100];for(var _0x2b2e71=0x0;_0x2b2e71<_0x20ac5a[_0xf500('0x7d')][_0xf500('0x3d')];_0x2b2e71+=0x1){let _0x1e3036=_0x20ac5a['Agents'][_0x2b2e71];var _0x1c0ee6=_0x2829f3[_0xf500('0x7e')]();_0x1c0ee6[_0xf500('0x40')](_0xf500('0x7f'),_0x1e3036['id']);_0x2459c4[_0xf500('0x80')](db[_0xf500('0x6d')][_0xf500('0x39')](_0x1c0ee6[_0xf500('0x81')](),{'type':db[_0xf500('0x6d')][_0xf500('0x82')][_0xf500('0x83')]})['then'](function(_0x271ce7){if(_0x271ce7[_0xf500('0x3d')]===0x1){return _0x1e3036['id'];}else{var _0x1afe3c=_[_0xf500('0x84')](_[_0xf500('0x32')](_0x271ce7,_0xf500('0x85')),function(_0x5abe80){return _['includes'](_0x4615f8,_0x5abe80);});if(_0x1afe3c){return _0x1e3036['id'];}}}));}}return BPromise['all'](_0x2459c4)['then'](function(_0x3f4a5b){_0x2ee33d=_(_0x2ee33d)['union'](_0x3f4a5b)[_0xf500('0x86')]()['value']();return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x553fdc[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](function(_0x20869c){return db[_0xf500('0x6d')][_0xf500('0x6e')](function(_0x2277b3){return _0x20869c[_0xf500('0x74')](_0x553fdc['query'][_0xf500('0x75')],{'transaction':_0x2277b3})[_0xf500('0x2c')](function(){if(!_['isEmpty'](_0x2ee33d)){return _0x20869c[_0xf500('0x87')](_0x2ee33d,{'transaction':_0x2277b3});}})[_0xf500('0x2c')](function(){_0x2ee33d[_0xf500('0x71')](function(_0x235c09){socket['emit']('userMailQueue:remove',{'UserId':_0x235c09,'MailQueueId':_0x20869c['id']});});});});});});})[_0xf500('0x2c')](respondWithStatusCode(_0x49e455,null))['catch'](handleError(_0x49e455,null));};exports[_0xf500('0x88')]=function(_0x2acb54,_0x4a9580,_0x570f1e){return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x2acb54[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x4a9580,null))[_0xf500('0x2c')](function(_0x762bbc){if(_0x762bbc){return _0x762bbc[_0xf500('0x88')](_0x2acb54[_0xf500('0x4f')][_0xf500('0x75')],_['omit'](_0x2acb54['body'],[_0xf500('0x75'),'id'])||{})['spread'](function(_0x2b1097){for(var _0x414bee=0x0;_0x414bee<_0x2acb54[_0xf500('0x4f')][_0xf500('0x75')][_0xf500('0x3d')];_0x414bee+=0x1){socket['emit'](_0xf500('0x73'),{'UserId':Number(_0x2acb54[_0xf500('0x4f')][_0xf500('0x75')][_0x414bee]),'MailQueueId':Number(_0x2acb54[_0xf500('0x58')]['id'])});}return _0x2b1097;});}})[_0xf500('0x2c')](respondWithResult(_0x4a9580,null))[_0xf500('0x49')](handleError(_0x4a9580,null));};exports['removeAgents']=function(_0x42be15,_0x1f4ca3,_0x15c330){return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x42be15[_0xf500('0x58')]['id']}})['then'](handleEntityNotFound(_0x1f4ca3,null))[_0xf500('0x2c')](function(_0x4947e5){if(_0x4947e5){return _0x4947e5['removeAgents'](_0x42be15[_0xf500('0x39')][_0xf500('0x75')])[_0xf500('0x2c')](function(){if(_[_0xf500('0x89')](_0x42be15[_0xf500('0x39')][_0xf500('0x75')])){for(var _0x9c2eea=0x0;_0x9c2eea<_0x42be15['query'][_0xf500('0x75')][_0xf500('0x3d')];_0x9c2eea+=0x1){socket[_0xf500('0x72')](_0xf500('0x8a'),{'UserId':Number(_0x42be15[_0xf500('0x39')][_0xf500('0x75')][_0x9c2eea]),'MailQueueId':Number(_0x42be15[_0xf500('0x58')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x42be15[_0xf500('0x39')][_0xf500('0x75')]),'MailQueueId':Number(_0x42be15['params']['id'])});}});}})[_0xf500('0x2c')](respondWithStatusCode(_0x1f4ca3,null))[_0xf500('0x49')](handleError(_0x1f4ca3,null));};exports[_0xf500('0x8b')]=function(_0x21f57a,_0x384939,_0x1c7e29){var _0x37b1e9={};var _0x4fe29a={};var _0x2ec5d9;var _0x457acf;return db[_0xf500('0x33')][_0xf500('0x5b')]({'where':{'id':_0x21f57a[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x384939,null))[_0xf500('0x2c')](function(_0x37a899){if(_0x37a899){_0x2ec5d9=_0x37a899;_0x4fe29a[_0xf500('0x38')]=_[_0xf500('0x3a')](db[_0xf500('0x60')]['rawAttributes']);_0x4fe29a[_0xf500('0x39')]=_[_0xf500('0x3a')](_0x21f57a[_0xf500('0x39')]);_0x4fe29a[_0xf500('0x41')]=_[_0xf500('0x4a')](_0x4fe29a['model'],_0x4fe29a[_0xf500('0x39')]);_0x37b1e9['attributes']=_['intersection'](_0x4fe29a['model'],qs[_0xf500('0x3c')](_0x21f57a[_0xf500('0x39')][_0xf500('0x3c')]));_0x37b1e9[_0xf500('0x3b')]=_0x37b1e9['attributes']['length']?_0x37b1e9[_0xf500('0x3b')]:_0x4fe29a[_0xf500('0x38')];_0x37b1e9[_0xf500('0x5e')]=qs[_0xf500('0x3f')](_0x21f57a[_0xf500('0x39')][_0xf500('0x3f')]);_0x37b1e9[_0xf500('0x40')]=qs['filters'](_[_0xf500('0x42')](_0x21f57a[_0xf500('0x39')],_0x4fe29a[_0xf500('0x41')]));if(_0x21f57a[_0xf500('0x39')][_0xf500('0x43')]){_0x37b1e9[_0xf500('0x40')]=_[_0xf500('0x44')](_0x37b1e9[_0xf500('0x40')],{'$or':_[_0xf500('0x32')](_0x37b1e9[_0xf500('0x3b')],function(_0x8b745a){var _0x564339={};_0x564339[_0x8b745a]={'$like':'%'+_0x21f57a[_0xf500('0x39')][_0xf500('0x43')]+'%'};return _0x564339;})});}_0x37b1e9=_['merge']({},_0x37b1e9,_0x21f57a[_0xf500('0x4c')]);return _0x2ec5d9[_0xf500('0x8b')](_0x37b1e9);}})[_0xf500('0x2c')](function(_0x264b36){if(_0x264b36){_0x457acf=_0x264b36[_0xf500('0x3d')];if(!_0x21f57a[_0xf500('0x39')][_0xf500('0x5d')]('nolimit')){_0x37b1e9[_0xf500('0x23')]=qs[_0xf500('0x23')](_0x21f57a['query'][_0xf500('0x23')]);_0x37b1e9[_0xf500('0x25')]=qs[_0xf500('0x25')](_0x21f57a['query']['offset']);}return _0x2ec5d9[_0xf500('0x8b')](_0x37b1e9);}})[_0xf500('0x2c')](function(_0x4316a2){if(_0x4316a2){return _0x4316a2?{'count':_0x457acf,'rows':_0x4316a2}:null;}})[_0xf500('0x2c')](respondWithResult(_0x384939,null))['catch'](handleError(_0x384939,null));}; \ No newline at end of file +var _0x04d0=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','then','get','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserMailQueue','User','UserId','mailPause','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','compact','value','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce','querystring'];(function(_0x1f9f76,_0x1ebf4c){var _0xcc8a65=function(_0x35dab2){while(--_0x35dab2){_0x1f9f76['push'](_0x1f9f76['shift']());}};_0xcc8a65(++_0x1ebf4c);}(_0x04d0,0x10a));var _0x004d=function(_0x4162cc,_0x26c2fb){_0x4162cc=_0x4162cc-0x0;var _0x557f6d=_0x04d0[_0x4162cc];return _0x557f6d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x004d('0x0'));var jsonpatch=require(_0x004d('0x1'));var rp=require(_0x004d('0x2'));var moment=require(_0x004d('0x3'));var BPromise=require(_0x004d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x004d('0x5'));var sox=require('sox');var csv=require(_0x004d('0x6'));var ejs=require(_0x004d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x004d('0x8'));var squel=require(_0x004d('0x9'));var crypto=require('crypto');var jsforce=require(_0x004d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x004d('0x6'));var querystring=require(_0x004d('0xb'));var Papa=require(_0x004d('0xc'));var Redis=require('ioredis');var authService=require(_0x004d('0xd'));var qs=require(_0x004d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x004d('0xf'));var logger=require('../../config/logger')(_0x004d('0x10'));var utils=require(_0x004d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x004d('0x12'));var db=require('../../mysqldb')['db'];config[_0x004d('0x13')]=_[_0x004d('0x14')](config[_0x004d('0x13')],{'host':_0x004d('0x15'),'port':0x18eb});var socket=require(_0x004d('0x16'))(new Redis(config[_0x004d('0x13')]));require(_0x004d('0x17'))[_0x004d('0x18')](socket);function respondWithStatusCode(_0x4f4785,_0x425dec){_0x425dec=_0x425dec||0xcc;return function(_0x3bd18c){if(_0x3bd18c){return _0x4f4785[_0x004d('0x19')](_0x425dec);}return _0x4f4785[_0x004d('0x1a')](_0x425dec)[_0x004d('0x1b')]();};}function respondWithResult(_0x402969,_0x1904a6){_0x1904a6=_0x1904a6||0xc8;return function(_0x365c20){if(_0x365c20){return _0x402969['status'](_0x1904a6)[_0x004d('0x1c')](_0x365c20);}};}function respondWithFilteredResult(_0x1f3482,_0x34e151){return function(_0x4b3912){if(_0x4b3912){var _0x1adf2a=typeof _0x34e151['offset']===_0x004d('0x1d')&&typeof _0x34e151[_0x004d('0x1e')]===_0x004d('0x1d');var _0x66dd7f=_0x4b3912['count'];var _0x1c184c=_0x1adf2a?0x0:_0x34e151[_0x004d('0x1f')];var _0x518ee8=_0x1adf2a?_0x4b3912[_0x004d('0x20')]:_0x34e151[_0x004d('0x1f')]+_0x34e151[_0x004d('0x1e')];var _0x3abed3;if(_0x518ee8>=_0x66dd7f){_0x518ee8=_0x66dd7f;_0x3abed3=0xc8;}else{_0x3abed3=0xce;}_0x1f3482['status'](_0x3abed3);return _0x1f3482[_0x004d('0x21')](_0x004d('0x22'),_0x1c184c+'-'+_0x518ee8+'/'+_0x66dd7f)[_0x004d('0x1c')](_0x4b3912);}return null;};}function patchUpdates(_0xb9eda8){return function(_0x32bde4){try{jsonpatch[_0x004d('0x23')](_0x32bde4,_0xb9eda8,!![]);}catch(_0x21bbda){return BPromise[_0x004d('0x24')](_0x21bbda);}return _0x32bde4[_0x004d('0x25')]();};}function saveUpdates(_0x1cfdaa,_0x421f33){return function(_0x83a2f0){if(_0x83a2f0){return _0x83a2f0['update'](_0x1cfdaa)['then'](function(_0x1263d8){return _0x1263d8;});}return null;};}function removeEntity(_0xb07ff9,_0x4a4fe1){return function(_0x27aac7){if(_0x27aac7){return _0x27aac7[_0x004d('0x26')]()[_0x004d('0x27')](function(){var _0xd13fff=_0x27aac7[_0x004d('0x28')]({'plain':!![]});var _0x1ccb0e=_0x004d('0x29');return db['UserProfileResource'][_0x004d('0x26')]({'where':{'type':_0x1ccb0e,'resourceId':_0xd13fff['id']}})['then'](function(){return _0x27aac7;});})['then'](function(){_0xb07ff9[_0x004d('0x1a')](0xcc)[_0x004d('0x1b')]();});}};}function handleEntityNotFound(_0xe17b2d,_0x1e13b1){return function(_0x58015b){if(!_0x58015b){_0xe17b2d[_0x004d('0x19')](0x194);}return _0x58015b;};}function handleError(_0x24caed,_0x146f0d){_0x146f0d=_0x146f0d||0x1f4;return function(_0xa3ac81){logger[_0x004d('0x2a')](_0xa3ac81[_0x004d('0x2b')]);if(_0xa3ac81['name']){delete _0xa3ac81[_0x004d('0x2c')];}_0x24caed[_0x004d('0x1a')](_0x146f0d)[_0x004d('0x2d')](_0xa3ac81);};}exports[_0x004d('0x2e')]=function(_0x5f2190,_0x492016){var _0x457385={},_0x4d06d8={},_0x3aa5f3={'count':0x0,'rows':[]};var _0xdfd119=_[_0x004d('0x2f')](db[_0x004d('0x30')][_0x004d('0x31')],function(_0x1ce8b4){return{'name':_0x1ce8b4[_0x004d('0x32')],'type':_0x1ce8b4[_0x004d('0x33')][_0x004d('0x34')]};});_0x4d06d8[_0x004d('0x35')]=_['map'](_0xdfd119,_0x004d('0x2c'));_0x4d06d8[_0x004d('0x36')]=_[_0x004d('0x37')](_0x5f2190[_0x004d('0x36')]);_0x4d06d8['filters']=_[_0x004d('0x38')](_0x4d06d8[_0x004d('0x35')],_0x4d06d8['query']);_0x457385[_0x004d('0x39')]=_[_0x004d('0x38')](_0x4d06d8[_0x004d('0x35')],qs[_0x004d('0x3a')](_0x5f2190[_0x004d('0x36')]['fields']));_0x457385[_0x004d('0x39')]=_0x457385[_0x004d('0x39')][_0x004d('0x3b')]?_0x457385[_0x004d('0x39')]:_0x4d06d8[_0x004d('0x35')];if(!_0x5f2190[_0x004d('0x36')][_0x004d('0x3c')](_0x004d('0x3d'))){_0x457385['limit']=qs[_0x004d('0x1e')](_0x5f2190['query'][_0x004d('0x1e')]);_0x457385[_0x004d('0x1f')]=qs[_0x004d('0x1f')](_0x5f2190['query'][_0x004d('0x1f')]);}_0x457385[_0x004d('0x3e')]=qs[_0x004d('0x3f')](_0x5f2190['query'][_0x004d('0x3f')]);_0x457385['where']=qs[_0x004d('0x40')](_[_0x004d('0x41')](_0x5f2190[_0x004d('0x36')],_0x4d06d8[_0x004d('0x40')]),_0xdfd119);if(_0x5f2190[_0x004d('0x36')]['filter']){_0x457385['where']=_['merge'](_0x457385[_0x004d('0x42')],{'$or':_['map'](_0xdfd119,function(_0x5f23b4){if(_0x5f23b4[_0x004d('0x33')]!=='VIRTUAL'){var _0x1ffede={};_0x1ffede[_0x5f23b4['name']]={'$like':'%'+_0x5f2190['query'][_0x004d('0x43')]+'%'};return _0x1ffede;}})});}_0x457385=_[_0x004d('0x44')]({},_0x457385,_0x5f2190[_0x004d('0x45')]);var _0x540def={'where':_0x457385['where']};return db[_0x004d('0x30')][_0x004d('0x20')](_0x540def)[_0x004d('0x27')](function(_0xaa1d11){_0x3aa5f3[_0x004d('0x20')]=_0xaa1d11;if(_0x5f2190[_0x004d('0x36')][_0x004d('0x46')]){_0x457385[_0x004d('0x47')]=[{'all':!![]}];}return db[_0x004d('0x30')][_0x004d('0x48')](_0x457385);})['then'](function(_0x2f6e68){_0x3aa5f3[_0x004d('0x49')]=_0x2f6e68;return _0x3aa5f3;})[_0x004d('0x27')](respondWithFilteredResult(_0x492016,_0x457385))[_0x004d('0x4a')](handleError(_0x492016,null));};exports[_0x004d('0x4b')]=function(_0x1e970b,_0x50fd03){var _0xe3c206={'raw':!![],'where':{'id':_0x1e970b[_0x004d('0x4c')]['id']}},_0x43828f={};_0x43828f[_0x004d('0x35')]=_[_0x004d('0x37')](db['MailQueue'][_0x004d('0x31')]);_0x43828f[_0x004d('0x36')]=_[_0x004d('0x37')](_0x1e970b['query']);_0x43828f[_0x004d('0x40')]=_[_0x004d('0x38')](_0x43828f[_0x004d('0x35')],_0x43828f[_0x004d('0x36')]);_0xe3c206['attributes']=_['intersection'](_0x43828f[_0x004d('0x35')],qs[_0x004d('0x3a')](_0x1e970b[_0x004d('0x36')][_0x004d('0x3a')]));_0xe3c206['attributes']=_0xe3c206[_0x004d('0x39')][_0x004d('0x3b')]?_0xe3c206[_0x004d('0x39')]:_0x43828f[_0x004d('0x35')];if(_0x1e970b['query']['includeAll']){_0xe3c206[_0x004d('0x47')]=[{'all':!![]}];}_0xe3c206=_[_0x004d('0x44')]({},_0xe3c206,_0x1e970b['options']);return db['MailQueue'][_0x004d('0x4d')](_0xe3c206)[_0x004d('0x27')](handleEntityNotFound(_0x50fd03,null))['then'](respondWithResult(_0x50fd03,null))['catch'](handleError(_0x50fd03,null));};exports['create']=function(_0x2ab3db,_0x5c5349){return db[_0x004d('0x30')][_0x004d('0x4e')](_0x2ab3db['body'],{})[_0x004d('0x27')](function(_0x5f3c6f){var _0x444834=_0x2ab3db['user'][_0x004d('0x28')]({'plain':!![]});if(!_0x444834)throw new Error(_0x004d('0x4f'));if(_0x444834[_0x004d('0x50')]==='user'){var _0x49ebfa=_0x5f3c6f[_0x004d('0x28')]({'plain':!![]});var _0x3458a1='MailQueues';return db[_0x004d('0x51')]['find']({'where':{'name':_0x3458a1,'userProfileId':_0x444834[_0x004d('0x52')]},'raw':!![]})[_0x004d('0x27')](function(_0x5d9b4f){if(_0x5d9b4f&&_0x5d9b4f[_0x004d('0x53')]===0x0){return db[_0x004d('0x54')][_0x004d('0x4e')]({'name':_0x49ebfa[_0x004d('0x2c')],'resourceId':_0x49ebfa['id'],'type':_0x5d9b4f['name'],'sectionId':_0x5d9b4f['id']},{})[_0x004d('0x27')](function(){return _0x5f3c6f;});}else{return _0x5f3c6f;}})[_0x004d('0x4a')](function(_0x2d5b2d){logger['error'](_0x004d('0x55'),_0x2d5b2d);throw _0x2d5b2d;});}return _0x5f3c6f;})[_0x004d('0x27')](respondWithResult(_0x5c5349,0xc9))[_0x004d('0x4a')](handleError(_0x5c5349,null));};exports[_0x004d('0x56')]=function(_0x3c6550,_0x45b717){if(_0x3c6550[_0x004d('0x57')]['id']){delete _0x3c6550[_0x004d('0x57')]['id'];}return db['MailQueue'][_0x004d('0x4d')]({'where':{'id':_0x3c6550[_0x004d('0x4c')]['id']}})[_0x004d('0x27')](handleEntityNotFound(_0x45b717,null))[_0x004d('0x27')](saveUpdates(_0x3c6550[_0x004d('0x57')],null))['then'](respondWithResult(_0x45b717,null))[_0x004d('0x4a')](handleError(_0x45b717,null));};exports['destroy']=function(_0x497b7d,_0x2cc772){return db[_0x004d('0x30')][_0x004d('0x4d')]({'where':{'id':_0x497b7d[_0x004d('0x4c')]['id']}})[_0x004d('0x27')](handleEntityNotFound(_0x2cc772,null))[_0x004d('0x27')](removeEntity(_0x2cc772,null))['catch'](handleError(_0x2cc772,null));};exports['describe']=function(_0x1e4875,_0x38d6bf){return db['MailQueue'][_0x004d('0x58')]()[_0x004d('0x27')](respondWithResult(_0x38d6bf,null))[_0x004d('0x4a')](handleError(_0x38d6bf,null));};exports[_0x004d('0x59')]=function(_0x22c0d8,_0x3d95c4,_0x2467aa){var _0x522d84={'raw':!![],'where':{}},_0x413ec5={},_0x5475dd;return db[_0x004d('0x30')]['findOne']({'where':{'id':_0x22c0d8['params']['id']}})[_0x004d('0x27')](handleEntityNotFound(_0x3d95c4,null))['then'](function(_0x1050f5){if(_0x1050f5){_0x5475dd=_0x1050f5[_0x004d('0x28')]({'plain':!![]});_0x413ec5[_0x004d('0x35')]=_[_0x004d('0x37')](db[_0x004d('0x5a')][_0x004d('0x31')]);_0x413ec5[_0x004d('0x36')]=_[_0x004d('0x37')](_0x22c0d8['query']);_0x413ec5[_0x004d('0x40')]=_[_0x004d('0x38')](_0x413ec5[_0x004d('0x35')],_0x413ec5['query']);_0x522d84[_0x004d('0x39')]=_[_0x004d('0x38')](_0x413ec5['model'],qs['fields'](_0x22c0d8[_0x004d('0x36')][_0x004d('0x3a')]));_0x522d84[_0x004d('0x39')]=_0x522d84[_0x004d('0x39')][_0x004d('0x3b')]?_0x522d84[_0x004d('0x39')]:_0x413ec5[_0x004d('0x35')];if(!_0x22c0d8[_0x004d('0x36')][_0x004d('0x3c')](_0x004d('0x3d'))){_0x522d84[_0x004d('0x1e')]=qs[_0x004d('0x1e')](_0x22c0d8['query'][_0x004d('0x1e')]);_0x522d84[_0x004d('0x1f')]=qs['offset'](_0x22c0d8[_0x004d('0x36')][_0x004d('0x1f')]);}_0x522d84[_0x004d('0x3e')]=qs[_0x004d('0x3f')](_0x22c0d8[_0x004d('0x36')][_0x004d('0x3f')]);_0x522d84[_0x004d('0x42')]=qs[_0x004d('0x40')](_[_0x004d('0x41')](_0x22c0d8['query'],_0x413ec5['filters']));_0x522d84[_0x004d('0x42')]['MailQueueId']=_0x1050f5['id'];if(_0x22c0d8[_0x004d('0x36')]['filter']){_0x522d84[_0x004d('0x42')]=_[_0x004d('0x44')](_0x522d84['where'],{'$or':_['map'](_0x522d84[_0x004d('0x39')],function(_0xf316ba){var _0x34cd57={};_0x34cd57[_0xf316ba]={'$like':'%'+_0x22c0d8[_0x004d('0x36')][_0x004d('0x43')]+'%'};return _0x34cd57;})});}_0x522d84=_['merge']({},_0x522d84,_0x22c0d8[_0x004d('0x45')]);return db['UserMailQueue'][_0x004d('0x48')](_0x522d84);}})[_0x004d('0x27')](function(_0x44158a){if(_0x44158a){return db[_0x004d('0x5b')]['findAndCountAll']({'where':{'id':_[_0x004d('0x2f')](_0x44158a,_0x004d('0x5c')),'role':'agent'},'attributes':['id',_0x004d('0x2c'),_0x004d('0x5d'),'updatedAt','createdAt']});}})['then'](function(_0x51e2ce){if(_0x51e2ce){return{'count':_0x51e2ce[_0x004d('0x20')],'rows':_[_0x004d('0x2f')](_0x51e2ce['rows'],function(_0x40e6ca){return{'membername':_0x40e6ca['name'],'UserId':_0x40e6ca['id'],'queue_name':_0x5475dd['name'],'MailQueueId':_0x5475dd['id'],'interface':util[_0x004d('0x5e')](_0x004d('0x5f'),_0x004d('0x60'),_0x40e6ca['name']),'penalty':0x0,'paused':_0x40e6ca[_0x004d('0x5d')],'createdAt':_0x40e6ca[_0x004d('0x61')],'updatedAt':_0x40e6ca['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x004d('0x27')](respondWithFilteredResult(_0x3d95c4,_0x522d84))[_0x004d('0x4a')](handleError(_0x3d95c4,null));};exports[_0x004d('0x62')]=function(_0x21ca51,_0x3a6b1c,_0x40df65){var _0xeedb92={};var _0x5ac755={};var _0x366815;var _0x40be6a;return db[_0x004d('0x30')][_0x004d('0x63')]({'where':{'id':_0x21ca51[_0x004d('0x4c')]['id']}})[_0x004d('0x27')](handleEntityNotFound(_0x3a6b1c,null))[_0x004d('0x27')](function(_0xa453fa){if(_0xa453fa){_0x366815=_0xa453fa;_0x5ac755[_0x004d('0x35')]=_[_0x004d('0x37')](db[_0x004d('0x64')][_0x004d('0x31')]);_0x5ac755['query']=_[_0x004d('0x37')](_0x21ca51[_0x004d('0x36')]);_0x5ac755[_0x004d('0x40')]=_[_0x004d('0x38')](_0x5ac755[_0x004d('0x35')],_0x5ac755[_0x004d('0x36')]);_0xeedb92['attributes']=_['intersection'](_0x5ac755[_0x004d('0x35')],qs[_0x004d('0x3a')](_0x21ca51[_0x004d('0x36')][_0x004d('0x3a')]));_0xeedb92[_0x004d('0x39')]=_0xeedb92[_0x004d('0x39')][_0x004d('0x3b')]?_0xeedb92[_0x004d('0x39')]:_0x5ac755['model'];_0xeedb92[_0x004d('0x3e')]=qs['sort'](_0x21ca51[_0x004d('0x36')]['sort']);_0xeedb92[_0x004d('0x42')]=qs[_0x004d('0x40')](_['pick'](_0x21ca51[_0x004d('0x36')],_0x5ac755['filters']));if(_0x21ca51[_0x004d('0x36')]['filter']){_0xeedb92[_0x004d('0x42')]=_[_0x004d('0x44')](_0xeedb92[_0x004d('0x42')],{'$or':_[_0x004d('0x2f')](_0xeedb92[_0x004d('0x39')],function(_0x5707c7){var _0x608746={};_0x608746[_0x5707c7]={'$like':'%'+_0x21ca51[_0x004d('0x36')]['filter']+'%'};return _0x608746;})});}_0xeedb92=_['merge']({},_0xeedb92,_0x21ca51['options']);return _0x366815[_0x004d('0x62')](_0xeedb92);}})[_0x004d('0x27')](function(_0x389b64){if(_0x389b64){_0x40be6a=_0x389b64[_0x004d('0x3b')];if(!_0x21ca51[_0x004d('0x36')]['hasOwnProperty'](_0x004d('0x3d'))){_0xeedb92[_0x004d('0x1e')]=qs[_0x004d('0x1e')](_0x21ca51[_0x004d('0x36')][_0x004d('0x1e')]);_0xeedb92[_0x004d('0x1f')]=qs[_0x004d('0x1f')](_0x21ca51[_0x004d('0x36')][_0x004d('0x1f')]);}return _0x366815['getTeams'](_0xeedb92);}})[_0x004d('0x27')](function(_0x1e0780){if(_0x1e0780){return _0x1e0780?{'count':_0x40be6a,'rows':_0x1e0780}:null;}})[_0x004d('0x27')](respondWithResult(_0x3a6b1c,null))[_0x004d('0x4a')](handleError(_0x3a6b1c,null));};exports[_0x004d('0x65')]=function(_0x5edc76,_0x366ae8,_0x54ae3b){var _0x3bcdc0=_0x5edc76[_0x004d('0x57')][_0x004d('0x66')];return db[_0x004d('0x64')][_0x004d('0x48')]({'where':{'id':_0x3bcdc0},'attributes':['id'],'include':[{'model':db[_0x004d('0x5b')],'as':_0x004d('0x67'),'attributes':['id',_0x004d('0x2c'),_0x004d('0x68'),_0x004d('0x69'),_0x004d('0x6a')],'raw':!![]}]})[_0x004d('0x27')](function(_0x29799e){if(_0x29799e){var _0x462755=_[_0x004d('0x6b')](_0x29799e,function(_0x28bc1e){var _0x538d64=_0x28bc1e[_0x004d('0x28')]({'plain':!![]});return _0x538d64[_0x004d('0x67')];});return db[_0x004d('0x30')][_0x004d('0x4d')]({'where':{'id':_0x5edc76['params']['id']}})[_0x004d('0x27')](function(_0x275dc2){return db[_0x004d('0x6c')]['transaction'](function(_0x5cf1e7){return _0x275dc2[_0x004d('0x65')](_0x3bcdc0,{'transaction':_0x5cf1e7})[_0x004d('0x27')](function(){return BPromise[_0x004d('0x6d')](_0x462755,function(_0x275c20){return db[_0x004d('0x5a')][_0x004d('0x6e')]({'where':{'UserId':_0x275c20['id'],'MailQueueId':_0x5edc76[_0x004d('0x4c')]['id']},'transaction':_0x5cf1e7});});})['then'](function(){_0x462755[_0x004d('0x6f')](function(_0x586955){socket[_0x004d('0x70')](_0x004d('0x71'),{'UserId':_0x586955['id'],'MailQueueId':_0x275dc2['id']});});});});});}})[_0x004d('0x27')](respondWithStatusCode(_0x366ae8,null))[_0x004d('0x4a')](handleError(_0x366ae8,null));};exports[_0x004d('0x72')]=function(_0x34217f,_0x3020dd,_0x2e52cb){return db[_0x004d('0x64')][_0x004d('0x48')]({'where':{'id':_0x34217f[_0x004d('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x004d('0x5b')],'as':_0x004d('0x67'),'attributes':['id'],'raw':!![]}]})[_0x004d('0x27')](handleEntityNotFound(_0x3020dd,null))[_0x004d('0x27')](function(_0x46b2e7){var _0x4a10b7=_['map'](_0x46b2e7,'id');var _0x410249=[];var _0x42eed0=[];var _0x5aee0e=squel[_0x004d('0x73')]();_0x5aee0e[_0x004d('0x74')](_0x004d('0x75'))[_0x004d('0x76')](_0x004d('0x77'),'tq')[_0x004d('0x78')](_0x004d('0x79'),'ut',_0x004d('0x7a'))[_0x004d('0x42')](_0x004d('0x7b'),_0x34217f[_0x004d('0x4c')]['id']);for(var _0x5a4f57=0x0;_0x5a4f57<_0x46b2e7[_0x004d('0x3b')];_0x5a4f57+=0x1){let _0x1626bf=_0x46b2e7[_0x5a4f57];for(var _0x171b3a=0x0;_0x171b3a<_0x1626bf[_0x004d('0x67')]['length'];_0x171b3a+=0x1){let _0xe7e9b8=_0x1626bf[_0x004d('0x67')][_0x171b3a];var _0x4200bf=_0x5aee0e[_0x004d('0x7c')]();_0x4200bf['where'](_0x004d('0x7d'),_0xe7e9b8['id']);_0x42eed0[_0x004d('0x7e')](db[_0x004d('0x6c')][_0x004d('0x36')](_0x4200bf[_0x004d('0x7f')](),{'type':db[_0x004d('0x6c')][_0x004d('0x80')]['SELECT']})[_0x004d('0x27')](function(_0x490557){if(_0x490557[_0x004d('0x3b')]===0x1){return _0xe7e9b8['id'];}else{var _0x29d1f1=_['every'](_[_0x004d('0x2f')](_0x490557,_0x004d('0x81')),function(_0x2a9972){return _[_0x004d('0x82')](_0x4a10b7,_0x2a9972);});if(_0x29d1f1){return _0xe7e9b8['id'];}}}));}}return BPromise[_0x004d('0x83')](_0x42eed0)['then'](function(_0x491859){_0x410249=_(_0x410249)['union'](_0x491859)[_0x004d('0x84')]()[_0x004d('0x85')]();return db[_0x004d('0x30')][_0x004d('0x4d')]({'where':{'id':_0x34217f[_0x004d('0x4c')]['id']}})['then'](function(_0x511598){return db[_0x004d('0x6c')]['transaction'](function(_0x33c81f){return _0x511598[_0x004d('0x72')](_0x34217f[_0x004d('0x36')]['ids'],{'transaction':_0x33c81f})[_0x004d('0x27')](function(){if(!_['isEmpty'](_0x410249)){return _0x511598[_0x004d('0x86')](_0x410249,{'transaction':_0x33c81f});}})[_0x004d('0x27')](function(){_0x410249[_0x004d('0x6f')](function(_0x34b811){socket[_0x004d('0x70')](_0x004d('0x87'),{'UserId':_0x34b811,'MailQueueId':_0x511598['id']});});});});});});})['then'](respondWithStatusCode(_0x3020dd,null))[_0x004d('0x4a')](handleError(_0x3020dd,null));};exports['addAgents']=function(_0x5b19af,_0x412179,_0x3672b3){return db[_0x004d('0x30')]['find']({'where':{'id':_0x5b19af[_0x004d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x412179,null))[_0x004d('0x27')](function(_0x3ae30b){if(_0x3ae30b){return _0x3ae30b[_0x004d('0x88')](_0x5b19af[_0x004d('0x57')][_0x004d('0x66')],_['omit'](_0x5b19af[_0x004d('0x57')],[_0x004d('0x66'),'id'])||{})['spread'](function(_0x40b1ef){for(var _0x49fd0e=0x0;_0x49fd0e<_0x5b19af[_0x004d('0x57')][_0x004d('0x66')][_0x004d('0x3b')];_0x49fd0e+=0x1){socket[_0x004d('0x70')](_0x004d('0x71'),{'UserId':Number(_0x5b19af[_0x004d('0x57')]['ids'][_0x49fd0e]),'MailQueueId':Number(_0x5b19af[_0x004d('0x4c')]['id'])});}return _0x40b1ef;});}})[_0x004d('0x27')](respondWithResult(_0x412179,null))[_0x004d('0x4a')](handleError(_0x412179,null));};exports['removeAgents']=function(_0x346ddf,_0x15c03d,_0x428628){return db['MailQueue'][_0x004d('0x4d')]({'where':{'id':_0x346ddf[_0x004d('0x4c')]['id']}})[_0x004d('0x27')](handleEntityNotFound(_0x15c03d,null))[_0x004d('0x27')](function(_0x5ec47d){if(_0x5ec47d){return _0x5ec47d[_0x004d('0x86')](_0x346ddf[_0x004d('0x36')][_0x004d('0x66')])[_0x004d('0x27')](function(){if(_[_0x004d('0x89')](_0x346ddf['query'][_0x004d('0x66')])){for(var _0x27aa9c=0x0;_0x27aa9c<_0x346ddf[_0x004d('0x36')][_0x004d('0x66')]['length'];_0x27aa9c+=0x1){socket['emit'](_0x004d('0x87'),{'UserId':Number(_0x346ddf[_0x004d('0x36')][_0x004d('0x66')][_0x27aa9c]),'MailQueueId':Number(_0x346ddf[_0x004d('0x4c')]['id'])});}}else{socket[_0x004d('0x70')](_0x004d('0x87'),{'UserId':Number(_0x346ddf['query']['ids']),'MailQueueId':Number(_0x346ddf[_0x004d('0x4c')]['id'])});}});}})[_0x004d('0x27')](respondWithStatusCode(_0x15c03d,null))['catch'](handleError(_0x15c03d,null));};exports['getAgents']=function(_0x5c827b,_0x2bc5a7,_0x472245){var _0x2bd617={};var _0x1dd1b7={};var _0x3986e3;var _0x4a40bd;return db['MailQueue'][_0x004d('0x63')]({'where':{'id':_0x5c827b['params']['id']}})['then'](handleEntityNotFound(_0x2bc5a7,null))[_0x004d('0x27')](function(_0x4b9cdb){if(_0x4b9cdb){_0x3986e3=_0x4b9cdb;_0x1dd1b7[_0x004d('0x35')]=_[_0x004d('0x37')](db[_0x004d('0x5b')]['rawAttributes']);_0x1dd1b7[_0x004d('0x36')]=_[_0x004d('0x37')](_0x5c827b[_0x004d('0x36')]);_0x1dd1b7[_0x004d('0x40')]=_[_0x004d('0x38')](_0x1dd1b7[_0x004d('0x35')],_0x1dd1b7[_0x004d('0x36')]);_0x2bd617[_0x004d('0x39')]=_[_0x004d('0x38')](_0x1dd1b7['model'],qs['fields'](_0x5c827b[_0x004d('0x36')][_0x004d('0x3a')]));_0x2bd617[_0x004d('0x39')]=_0x2bd617[_0x004d('0x39')][_0x004d('0x3b')]?_0x2bd617[_0x004d('0x39')]:_0x1dd1b7[_0x004d('0x35')];_0x2bd617[_0x004d('0x3e')]=qs[_0x004d('0x3f')](_0x5c827b[_0x004d('0x36')][_0x004d('0x3f')]);_0x2bd617['where']=qs[_0x004d('0x40')](_['pick'](_0x5c827b[_0x004d('0x36')],_0x1dd1b7[_0x004d('0x40')]));if(_0x5c827b[_0x004d('0x36')][_0x004d('0x43')]){_0x2bd617[_0x004d('0x42')]=_[_0x004d('0x44')](_0x2bd617[_0x004d('0x42')],{'$or':_[_0x004d('0x2f')](_0x2bd617[_0x004d('0x39')],function(_0xca82bb){var _0x490d70={};_0x490d70[_0xca82bb]={'$like':'%'+_0x5c827b['query'][_0x004d('0x43')]+'%'};return _0x490d70;})});}_0x2bd617=_[_0x004d('0x44')]({},_0x2bd617,_0x5c827b[_0x004d('0x45')]);return _0x3986e3[_0x004d('0x8a')](_0x2bd617);}})['then'](function(_0x1d9087){if(_0x1d9087){_0x4a40bd=_0x1d9087['length'];if(!_0x5c827b[_0x004d('0x36')][_0x004d('0x3c')](_0x004d('0x3d'))){_0x2bd617[_0x004d('0x1e')]=qs['limit'](_0x5c827b['query']['limit']);_0x2bd617[_0x004d('0x1f')]=qs[_0x004d('0x1f')](_0x5c827b[_0x004d('0x36')][_0x004d('0x1f')]);}return _0x3986e3[_0x004d('0x8a')](_0x2bd617);}})['then'](function(_0x1ff55e){if(_0x1ff55e){return _0x1ff55e?{'count':_0x4a40bd,'rows':_0x1ff55e}:null;}})[_0x004d('0x27')](respondWithResult(_0x2bc5a7,null))['catch'](handleError(_0x2bc5a7,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d3ef14b..7d1db3a 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 _0xd7f1=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x17788a,_0x150887){var _0x33f47c=function(_0x120fcb){while(--_0x120fcb){_0x17788a['push'](_0x17788a['shift']());}};_0x33f47c(++_0x150887);}(_0xd7f1,0x160));var _0x1d7f=function(_0x19d4ad,_0x2a7c03){_0x19d4ad=_0x19d4ad-0x0;var _0x11c5bc=_0xd7f1[_0x19d4ad];return _0x11c5bc;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x1d7f('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1d7f('0x1')](0x0);var events={'afterCreate':_0x1d7f('0x2'),'afterUpdate':'update','afterDestroy':_0x1d7f('0x3')};function emitEvent(_0x1508d2){return function(_0x4e99c,_0x5cab00,_0x5b851b){MailQueueEvents[_0x1d7f('0x4')](_0x1508d2+':'+_0x4e99c['id'],_0x4e99c);MailQueueEvents[_0x1d7f('0x4')](_0x1508d2,_0x4e99c);_0x5b851b(null);};}for(var e in events){if(events[_0x1d7f('0x5')](e)){var event=events[e];MailQueue[_0x1d7f('0x6')](e,emitEvent(event));}}module[_0x1d7f('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xfaa2=['remove','emit','hasOwnProperty','hook','../../mysqldb','save','update'];(function(_0x49d8bb,_0x26d098){var _0x1f8502=function(_0x87ac9b){while(--_0x87ac9b){_0x49d8bb['push'](_0x49d8bb['shift']());}};_0x1f8502(++_0x26d098);}(_0xfaa2,0x82));var _0x2faa=function(_0x5cf315,_0x2ba59f){_0x5cf315=_0x5cf315-0x0;var _0x3619d8=_0xfaa2[_0x5cf315];return _0x3619d8;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x2faa('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2faa('0x1'),'afterUpdate':_0x2faa('0x2'),'afterDestroy':_0x2faa('0x3')};function emitEvent(_0x30870e){return function(_0x214e85,_0x4d6911,_0x1d31fd){MailQueueEvents[_0x2faa('0x4')](_0x30870e+':'+_0x214e85['id'],_0x214e85);MailQueueEvents['emit'](_0x30870e,_0x214e85);_0x1d31fd(null);};}for(var e in events){if(events[_0x2faa('0x5')](e)){var event=events[e];MailQueue[_0x2faa('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 0c9d41a..814211a 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 _0x0a1b=['exports','define','MailQueue','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes'];(function(_0x210d9a,_0x2a1b7c){var _0x34a2ee=function(_0x3581e5){while(--_0x3581e5){_0x210d9a['push'](_0x210d9a['shift']());}};_0x34a2ee(++_0x2a1b7c);}(_0x0a1b,0x142));var _0xb0a1=function(_0x2c808c,_0x1b9845){_0x2c808c=_0x2c808c-0x0;var _0x2969ff=_0x0a1b[_0x2c808c];return _0x2969ff;};'use strict';var _=require('lodash');var util=require(_0xb0a1('0x0'));var logger=require(_0xb0a1('0x1'))('api');var moment=require(_0xb0a1('0x2'));var BPromise=require(_0xb0a1('0x3'));var rp=require(_0xb0a1('0x4'));var fs=require('fs');var path=require(_0xb0a1('0x5'));var rimraf=require('rimraf');var config=require(_0xb0a1('0x6'));var attributes=require(_0xb0a1('0x7'));module[_0xb0a1('0x8')]=function(_0x2910cc,_0x4f817d){return _0x2910cc[_0xb0a1('0x9')](_0xb0a1('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd76=['api','bluebird','request-promise','path','define','MailQueue','mail_queues','lodash','util'];(function(_0x260e29,_0x1d8d60){var _0x263384=function(_0x4b34ca){while(--_0x4b34ca){_0x260e29['push'](_0x260e29['shift']());}};_0x263384(++_0x1d8d60);}(_0xbd76,0x97));var _0x6bd7=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xbd76[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x6bd7('0x0'));var util=require(_0x6bd7('0x1'));var logger=require('../../config/logger')(_0x6bd7('0x2'));var moment=require('moment');var BPromise=require(_0x6bd7('0x3'));var rp=require(_0x6bd7('0x4'));var fs=require('fs');var path=require(_0x6bd7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x3e023e,_0x2b0dac){return _0x3e023e[_0x6bd7('0x6')](_0x6bd7('0x7'),attributes,{'tableName':_0x6bd7('0x8'),'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 fa72ffa..67340d2 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 _0x005d=['jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','options','where','attributes','limit','map','include','model','stringify','raw','ShowMailQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1accf6,_0x4a9854){var _0x24e446=function(_0x487f51){while(--_0x487f51){_0x1accf6['push'](_0x1accf6['shift']());}};_0x24e446(++_0x4a9854);}(_0x005d,0x64));var _0xd005=function(_0x1d7cd5,_0x554473){_0x1d7cd5=_0x1d7cd5-0x0;var _0x99c39e=_0x005d[_0x1d7cd5];return _0x99c39e;};'use strict';var _=require(_0xd005('0x0'));var util=require('util');var moment=require(_0xd005('0x1'));var BPromise=require(_0xd005('0x2'));var rs=require(_0xd005('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd005('0x4'));var logger=require(_0xd005('0x5'))(_0xd005('0x6'));var config=require(_0xd005('0x7'));var jayson=require(_0xd005('0x8'));var client=jayson[_0xd005('0x9')][_0xd005('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd005('0xb'),'port':0x18eb});var socket=require(_0xd005('0xc'))(new Redis(config[_0xd005('0xd')]));require('./mailQueue.socket')[_0xd005('0xe')](socket);function respondWithRpcPromise(_0x11e369,_0x1aad8d,_0x993a4e){return new BPromise(function(_0x34d4cf,_0x415a12){return client[_0xd005('0xf')](_0x11e369,_0x993a4e)[_0xd005('0x10')](function(_0x5a368d){logger[_0xd005('0x11')](_0xd005('0x12'),_0x1aad8d,_0xd005('0x13'));logger[_0xd005('0x14')](_0xd005('0x15'),_0x1aad8d,'request\x20sent',JSON['stringify'](_0x5a368d));if(_0x5a368d['error']){if(_0x5a368d[_0xd005('0x16')]['code']===0x1f4){logger[_0xd005('0x16')](_0xd005('0x12'),_0x1aad8d,_0x5a368d[_0xd005('0x16')]['message']);return _0x415a12(_0x5a368d[_0xd005('0x16')][_0xd005('0x17')]);}logger[_0xd005('0x16')](_0xd005('0x12'),_0x1aad8d,_0x5a368d['error']['message']);return _0x34d4cf(_0x5a368d[_0xd005('0x16')]['message']);}else{logger['info'](_0xd005('0x12'),_0x1aad8d,_0xd005('0x13'));_0x34d4cf(_0x5a368d[_0xd005('0x18')][_0xd005('0x17')]);}})[_0xd005('0x19')](function(_0x4defa7){logger[_0xd005('0x16')](_0xd005('0x12'),_0x1aad8d,_0x4defa7);_0x415a12(_0x4defa7);});});}exports['GetMailQueue']=function(_0x461dc3){var _0xe08666=this;return new Promise(function(_0x5e8cd8,_0x38fcd3){return db['MailQueue']['findAll']({'raw':_0x461dc3[_0xd005('0x1a')]?_0x461dc3[_0xd005('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x461dc3[_0xd005('0x1a')]?_0x461dc3['options'][_0xd005('0x1b')]||null:null,'attributes':_0x461dc3[_0xd005('0x1a')]?_0x461dc3['options'][_0xd005('0x1c')]||null:null,'limit':_0x461dc3['options']?_0x461dc3[_0xd005('0x1a')][_0xd005('0x1d')]||null:null,'include':_0x461dc3[_0xd005('0x1a')]?_0x461dc3[_0xd005('0x1a')]['include']?_[_0xd005('0x1e')](_0x461dc3[_0xd005('0x1a')][_0xd005('0x1f')],function(_0x2be2c3){return{'model':db[_0x2be2c3[_0xd005('0x20')]],'as':_0x2be2c3['as'],'attributes':_0x2be2c3[_0xd005('0x1c')],'include':_0x2be2c3[_0xd005('0x1f')]?_['map'](_0x2be2c3['include'],function(_0x6df192){return{'model':db[_0x6df192['model']],'as':_0x6df192['as'],'attributes':_0x6df192[_0xd005('0x1c')],'include':_0x6df192[_0xd005('0x1f')]?_[_0xd005('0x1e')](_0x6df192['include'],function(_0x40c52e){return{'model':db[_0x40c52e['model']],'as':_0x40c52e['as'],'attributes':_0x40c52e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd005('0x10')](function(_0x181b39){logger['info']('GetMailQueue',_0x461dc3);logger[_0xd005('0x14')]('GetMailQueue',_0x461dc3,JSON[_0xd005('0x21')](_0x181b39));_0x5e8cd8(_0x181b39);})[_0xd005('0x19')](function(_0x371a14){logger[_0xd005('0x16')]('GetMailQueue',_0x371a14[_0xd005('0x17')],_0x461dc3);_0x38fcd3(_0xe08666['error'](0x1f4,_0x371a14[_0xd005('0x17')]));});});};exports['ShowMailQueue']=function(_0x15a471){var _0x54aa26=this;return new Promise(function(_0x14b381,_0x5cae34){return db['MailQueue']['find']({'raw':_0x15a471[_0xd005('0x1a')]?_0x15a471[_0xd005('0x1a')][_0xd005('0x22')]===undefined?!![]:![]:!![],'where':_0x15a471['options']?_0x15a471[_0xd005('0x1a')][_0xd005('0x1b')]||null:null,'attributes':_0x15a471['options']?_0x15a471[_0xd005('0x1a')][_0xd005('0x1c')]||null:null,'include':_0x15a471[_0xd005('0x1a')]?_0x15a471[_0xd005('0x1a')][_0xd005('0x1f')]?_['map'](_0x15a471['options'][_0xd005('0x1f')],function(_0x3e0556){return{'model':db[_0x3e0556['model']],'as':_0x3e0556['as'],'attributes':_0x3e0556[_0xd005('0x1c')],'include':_0x3e0556[_0xd005('0x1f')]?_['map'](_0x3e0556[_0xd005('0x1f')],function(_0x1a83c8){return{'model':db[_0x1a83c8['model']],'as':_0x1a83c8['as'],'attributes':_0x1a83c8[_0xd005('0x1c')],'include':_0x1a83c8[_0xd005('0x1f')]?_[_0xd005('0x1e')](_0x1a83c8[_0xd005('0x1f')],function(_0x3428e9){return{'model':db[_0x3428e9['model']],'as':_0x3428e9['as'],'attributes':_0x3428e9[_0xd005('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12d5b9){logger[_0xd005('0x11')]('ShowMailQueue',_0x15a471);logger[_0xd005('0x14')](_0xd005('0x23'),_0x15a471,JSON['stringify'](_0x12d5b9));_0x14b381(_0x12d5b9);})[_0xd005('0x19')](function(_0x138603){logger[_0xd005('0x16')](_0xd005('0x23'),_0x138603[_0xd005('0x17')],_0x15a471);_0x5cae34(_0x54aa26[_0xd005('0x16')](0x1f4,_0x138603[_0xd005('0x17')]));});});}; \ No newline at end of file +var _0x1af8=['map','include','model','catch','ShowMailQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetMailQueue','raw','options','where','attributes','limit'];(function(_0x4ee00a,_0x23b8a5){var _0x369a18=function(_0x2b1938){while(--_0x2b1938){_0x4ee00a['push'](_0x4ee00a['shift']());}};_0x369a18(++_0x23b8a5);}(_0x1af8,0x99));var _0x81af=function(_0x26a511,_0x11d9e3){_0x26a511=_0x26a511-0x0;var _0x4cf0c4=_0x1af8[_0x26a511];return _0x4cf0c4;};'use strict';var _=require(_0x81af('0x0'));var util=require('util');var moment=require(_0x81af('0x1'));var BPromise=require(_0x81af('0x2'));var rs=require(_0x81af('0x3'));var fs=require('fs');var Redis=require(_0x81af('0x4'));var db=require(_0x81af('0x5'))['db'];var utils=require(_0x81af('0x6'));var logger=require(_0x81af('0x7'))(_0x81af('0x8'));var config=require('../../config/environment');var jayson=require(_0x81af('0x9'));var client=jayson[_0x81af('0xa')][_0x81af('0xb')]({'port':0x232a});config[_0x81af('0xc')]=_['defaults'](config[_0x81af('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x81af('0xd'))(new Redis(config['redis']));require(_0x81af('0xe'))[_0x81af('0xf')](socket);function respondWithRpcPromise(_0x38c940,_0x5dacd9,_0x3c8da5){return new BPromise(function(_0x326880,_0xf00347){return client[_0x81af('0x10')](_0x38c940,_0x3c8da5)[_0x81af('0x11')](function(_0x165305){logger[_0x81af('0x12')](_0x81af('0x13'),_0x5dacd9,_0x81af('0x14'));logger[_0x81af('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x5dacd9,_0x81af('0x14'),JSON[_0x81af('0x16')](_0x165305));if(_0x165305['error']){if(_0x165305[_0x81af('0x17')][_0x81af('0x18')]===0x1f4){logger[_0x81af('0x17')](_0x81af('0x13'),_0x5dacd9,_0x165305[_0x81af('0x17')][_0x81af('0x19')]);return _0xf00347(_0x165305['error']['message']);}logger[_0x81af('0x17')]('MailQueue,\x20%s,\x20%s',_0x5dacd9,_0x165305[_0x81af('0x17')][_0x81af('0x19')]);return _0x326880(_0x165305['error'][_0x81af('0x19')]);}else{logger[_0x81af('0x12')](_0x81af('0x13'),_0x5dacd9,_0x81af('0x14'));_0x326880(_0x165305['result'][_0x81af('0x19')]);}})['catch'](function(_0x30f66d){logger[_0x81af('0x17')]('MailQueue,\x20%s,\x20%s',_0x5dacd9,_0x30f66d);_0xf00347(_0x30f66d);});});}exports[_0x81af('0x1a')]=function(_0xfdffd7){var _0x2415c8=this;return new Promise(function(_0x160b87,_0x3392c8){return db['MailQueue']['findAll']({'raw':_0xfdffd7['options']?_0xfdffd7['options'][_0x81af('0x1b')]===undefined?!![]:![]:!![],'where':_0xfdffd7[_0x81af('0x1c')]?_0xfdffd7[_0x81af('0x1c')][_0x81af('0x1d')]||null:null,'attributes':_0xfdffd7[_0x81af('0x1c')]?_0xfdffd7['options'][_0x81af('0x1e')]||null:null,'limit':_0xfdffd7[_0x81af('0x1c')]?_0xfdffd7[_0x81af('0x1c')][_0x81af('0x1f')]||null:null,'include':_0xfdffd7['options']?_0xfdffd7[_0x81af('0x1c')]['include']?_[_0x81af('0x20')](_0xfdffd7[_0x81af('0x1c')][_0x81af('0x21')],function(_0x1737a4){return{'model':db[_0x1737a4[_0x81af('0x22')]],'as':_0x1737a4['as'],'attributes':_0x1737a4[_0x81af('0x1e')],'include':_0x1737a4[_0x81af('0x21')]?_['map'](_0x1737a4[_0x81af('0x21')],function(_0x425033){return{'model':db[_0x425033[_0x81af('0x22')]],'as':_0x425033['as'],'attributes':_0x425033[_0x81af('0x1e')],'include':_0x425033['include']?_[_0x81af('0x20')](_0x425033[_0x81af('0x21')],function(_0x55f0fd){return{'model':db[_0x55f0fd[_0x81af('0x22')]],'as':_0x55f0fd['as'],'attributes':_0x55f0fd[_0x81af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x81af('0x11')](function(_0x1f78aa){logger[_0x81af('0x12')](_0x81af('0x1a'),_0xfdffd7);logger['debug'](_0x81af('0x1a'),_0xfdffd7,JSON[_0x81af('0x16')](_0x1f78aa));_0x160b87(_0x1f78aa);})[_0x81af('0x23')](function(_0x21255f){logger[_0x81af('0x17')](_0x81af('0x1a'),_0x21255f[_0x81af('0x19')],_0xfdffd7);_0x3392c8(_0x2415c8[_0x81af('0x17')](0x1f4,_0x21255f[_0x81af('0x19')]));});});};exports[_0x81af('0x24')]=function(_0x4e2da1){var _0x6470a7=this;return new Promise(function(_0x242dcf,_0x48c0bd){return db['MailQueue']['find']({'raw':_0x4e2da1[_0x81af('0x1c')]?_0x4e2da1[_0x81af('0x1c')][_0x81af('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e2da1[_0x81af('0x1c')]?_0x4e2da1['options'][_0x81af('0x1d')]||null:null,'attributes':_0x4e2da1['options']?_0x4e2da1['options'][_0x81af('0x1e')]||null:null,'include':_0x4e2da1['options']?_0x4e2da1['options'][_0x81af('0x21')]?_['map'](_0x4e2da1['options']['include'],function(_0x10660b){return{'model':db[_0x10660b['model']],'as':_0x10660b['as'],'attributes':_0x10660b[_0x81af('0x1e')],'include':_0x10660b[_0x81af('0x21')]?_[_0x81af('0x20')](_0x10660b[_0x81af('0x21')],function(_0x3e1ca0){return{'model':db[_0x3e1ca0['model']],'as':_0x3e1ca0['as'],'attributes':_0x3e1ca0[_0x81af('0x1e')],'include':_0x3e1ca0[_0x81af('0x21')]?_[_0x81af('0x20')](_0x3e1ca0[_0x81af('0x21')],function(_0x34040c){return{'model':db[_0x34040c[_0x81af('0x22')]],'as':_0x34040c['as'],'attributes':_0x34040c[_0x81af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x81af('0x11')](function(_0xb24a43){logger[_0x81af('0x12')](_0x81af('0x24'),_0x4e2da1);logger[_0x81af('0x15')](_0x81af('0x24'),_0x4e2da1,JSON[_0x81af('0x16')](_0xb24a43));_0x242dcf(_0xb24a43);})['catch'](function(_0x3e34f4){logger['error']('ShowMailQueue',_0x3e34f4['message'],_0x4e2da1);_0x48c0bd(_0x6470a7[_0x81af('0x17')](0x1f4,_0x3e34f4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9ca170b..4bd341f 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 _0x7cdc=['save','remove','register','length'];(function(_0x190203,_0x1d48aa){var _0x1fa41b=function(_0x197a34){while(--_0x197a34){_0x190203['push'](_0x190203['shift']());}};_0x1fa41b(++_0x1d48aa);}(_0x7cdc,0x190));var _0xc7cd=function(_0x5b81df,_0x29ae06){_0x5b81df=_0x5b81df-0x0;var _0x530245=_0x7cdc[_0x5b81df];return _0x530245;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xc7cd('0x0'),_0xc7cd('0x1'),'update'];function createListener(_0x1e4571,_0x333626){return function(_0x2d9828){_0x333626['emit'](_0x1e4571,_0x2d9828);};}function removeListener(_0xfa4d29,_0x3800f5){return function(){MailQueueEvents['removeListener'](_0xfa4d29,_0x3800f5);};}exports[_0xc7cd('0x2')]=function(_0x26603f){for(var _0x18bb1b=0x0,_0x2c168c=events[_0xc7cd('0x3')];_0x18bb1b<_0x2c168c;_0x18bb1b++){var _0x30089e=events[_0x18bb1b];var _0x42a4b8=createListener('mailQueue:'+_0x30089e,_0x26603f);MailQueueEvents['on'](_0x30089e,_0x42a4b8);}}; \ No newline at end of file +var _0x7072=['removeListener','register','length','mailQueue:','save','remove','update'];(function(_0x4987ca,_0x521560){var _0x18dca4=function(_0x9a579f){while(--_0x9a579f){_0x4987ca['push'](_0x4987ca['shift']());}};_0x18dca4(++_0x521560);}(_0x7072,0x138));var _0x2707=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7072[_0x53ccf2];return _0x5a2964;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x2707('0x0'),_0x2707('0x1'),_0x2707('0x2')];function createListener(_0x1bbc92,_0x446529){return function(_0x5493b4){_0x446529['emit'](_0x1bbc92,_0x5493b4);};}function removeListener(_0xfdfa7a,_0x5f3c1c){return function(){MailQueueEvents[_0x2707('0x3')](_0xfdfa7a,_0x5f3c1c);};}exports[_0x2707('0x4')]=function(_0x1e86f2){for(var _0x194132=0x0,_0x2fd8ff=events[_0x2707('0x5')];_0x194132<_0x2fd8ff;_0x194132++){var _0x21b0a0=events[_0x194132];var _0x745cfd=createListener(_0x2707('0x6')+_0x21b0a0,_0x1e86f2);MailQueueEvents['on'](_0x21b0a0,_0x745cfd);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7d7c746..a357308 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 _0x77c5=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x77c5,0x18d));var _0x577c=function(_0x5f3acd,_0x17e943){_0x5f3acd=_0x5f3acd-0x0;var _0x5033ea=_0x77c5[_0x5f3acd];return _0x5033ea;};'use strict';var multer=require(_0x577c('0x0'));var util=require(_0x577c('0x1'));var path=require(_0x577c('0x2'));var timeout=require(_0x577c('0x3'));var express=require(_0x577c('0x4'));var router=express[_0x577c('0x5')]();var fs_extra=require(_0x577c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x577c('0x7'));var config=require(_0x577c('0x8'));var controller=require(_0x577c('0x9'));router[_0x577c('0xa')]('/',auth[_0x577c('0xb')](),controller[_0x577c('0xc')]);router[_0x577c('0xa')](_0x577c('0xd'),auth[_0x577c('0xb')](),controller[_0x577c('0xe')]);router[_0x577c('0xa')]('/:id',auth[_0x577c('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x577c('0xf')]);router[_0x577c('0x10')](_0x577c('0x11'),auth[_0x577c('0xb')](),controller[_0x577c('0x12')]);router[_0x577c('0x13')](_0x577c('0x11'),auth['isAuthenticated'](),controller[_0x577c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc19e=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','multer'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0xc19e,0x1c7));var _0xec19=function(_0x260f55,_0x2ad695){_0x260f55=_0x260f55-0x0;var _0x4cf365=_0xc19e[_0x260f55];return _0x4cf365;};'use strict';var multer=require(_0xec19('0x0'));var util=require(_0xec19('0x1'));var path=require('path');var timeout=require(_0xec19('0x2'));var express=require(_0xec19('0x3'));var router=express['Router']();var fs_extra=require(_0xec19('0x4'));var auth=require(_0xec19('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xec19('0x6'));var controller=require(_0xec19('0x7'));router[_0xec19('0x8')]('/',auth[_0xec19('0x9')](),controller[_0xec19('0xa')]);router[_0xec19('0x8')](_0xec19('0xb'),auth[_0xec19('0x9')](),controller[_0xec19('0xc')]);router[_0xec19('0x8')](_0xec19('0xd'),auth['isAuthenticated'](),controller[_0xec19('0xe')]);router['post']('/',auth[_0xec19('0x9')](),controller[_0xec19('0xf')]);router[_0xec19('0x10')](_0xec19('0xd'),auth[_0xec19('0x9')](),controller[_0xec19('0x11')]);router['delete']('/:id',auth[_0xec19('0x9')](),controller[_0xec19('0x12')]);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 e5798aa..d89f760 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 _0x9826=['DATE','moment','sequelize','exports','STRING'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x9826,0xa1));var _0x6982=function(_0x570134,_0x2dfc8d){_0x570134=_0x570134-0x0;var _0x5d849c=_0x9826[_0x570134];return _0x5d849c;};'use strict';var moment=require(_0x6982('0x0'));var Sequelize=require(_0x6982('0x1'));module[_0x6982('0x2')]={'uniqueid':{'type':Sequelize[_0x6982('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6982('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6982('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6982('0x4')]},'reason':{'type':Sequelize[_0x6982('0x3')]}}; \ No newline at end of file +var _0xc0c8=['STRING','sequelize','exports','DATE'];(function(_0xdf68ec,_0x50143a){var _0x74fa11=function(_0x118a07){while(--_0x118a07){_0xdf68ec['push'](_0xdf68ec['shift']());}};_0x74fa11(++_0x50143a);}(_0xc0c8,0x109));var _0x8c0c=function(_0xebfc42,_0x798c11){_0xebfc42=_0xebfc42-0x0;var _0xd9b6c1=_0xc0c8[_0xebfc42];return _0xd9b6c1;};'use strict';var moment=require('moment');var Sequelize=require(_0x8c0c('0x0'));module[_0x8c0c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8c0c('0x2')]},'acceptAt':{'type':Sequelize[_0x8c0c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c0c('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2e2b00e..1a9d279 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 _0x6d11=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','stack','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','fields','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6d11,0xbf));var _0x16d1=function(_0x13a0af,_0x480e4e){_0x13a0af=_0x13a0af-0x0;var _0x1649f3=_0x6d11[_0x13a0af];return _0x1649f3;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)[_0x16d1('0x1b')]();});}};}function handleEntityNotFound(_0x335c24,_0x4b2b5c){return function(_0x15203b){if(!_0x15203b){_0x335c24[_0x16d1('0x19')](0x194);}return _0x15203b;};}function handleError(_0x262f89,_0x346b69){_0x346b69=_0x346b69||0x1f4;return function(_0x2b8403){logger['error'](_0x2b8403[_0x16d1('0x24')]);if(_0x2b8403[_0x16d1('0x25')]){delete _0x2b8403[_0x16d1('0x25')];}_0x262f89['status'](_0x346b69)[_0x16d1('0x26')](_0x2b8403);};}exports[_0x16d1('0x27')]=function(_0x364bf7,_0x22e5b3){var _0x6396fc={},_0x462e5b={},_0x1dd574={'count':0x0,'rows':[]};var _0x562908=_[_0x16d1('0x28')](db[_0x16d1('0x29')][_0x16d1('0x2a')],function(_0x30cd8f){return{'name':_0x30cd8f['fieldName'],'type':_0x30cd8f['type'][_0x16d1('0x2b')]};});_0x462e5b[_0x16d1('0x2c')]=_[_0x16d1('0x28')](_0x562908,_0x16d1('0x25'));_0x462e5b[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x364bf7[_0x16d1('0x2d')]);_0x462e5b[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],_0x462e5b[_0x16d1('0x2d')]);_0x6396fc[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],qs['fields'](_0x364bf7[_0x16d1('0x2d')]['fields']));_0x6396fc[_0x16d1('0x31')]=_0x6396fc[_0x16d1('0x31')][_0x16d1('0x32')]?_0x6396fc[_0x16d1('0x31')]:_0x462e5b[_0x16d1('0x2c')];if(!_0x364bf7[_0x16d1('0x2d')]['hasOwnProperty']('nolimit')){_0x6396fc['limit']=qs[_0x16d1('0x1f')](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1f')]);_0x6396fc[_0x16d1('0x1d')]=qs['offset'](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1d')]);}_0x6396fc['order']=qs['sort'](_0x364bf7['query'][_0x16d1('0x33')]);_0x6396fc[_0x16d1('0x34')]=qs[_0x16d1('0x2f')](_['pick'](_0x364bf7[_0x16d1('0x2d')],_0x462e5b[_0x16d1('0x2f')]),_0x562908);if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]){_0x6396fc[_0x16d1('0x34')]=_[_0x16d1('0x36')](_0x6396fc[_0x16d1('0x34')],{'$or':_['map'](_0x562908,function(_0x50267b){if(_0x50267b['type']!==_0x16d1('0x37')){var _0x2306d3={};_0x2306d3[_0x50267b[_0x16d1('0x25')]]={'$like':'%'+_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]+'%'};return _0x2306d3;}})});}_0x6396fc=_[_0x16d1('0x36')]({},_0x6396fc,_0x364bf7[_0x16d1('0x38')]);var _0x369b1c={'where':_0x6396fc['where']};return db[_0x16d1('0x29')]['count'](_0x369b1c)['then'](function(_0x352c5b){_0x1dd574[_0x16d1('0x39')]=_0x352c5b;if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x6396fc[_0x16d1('0x3b')]=[{'all':!![]}];}return db[_0x16d1('0x29')]['findAll'](_0x6396fc);})[_0x16d1('0x22')](function(_0x525212){_0x1dd574['rows']=_0x525212;return _0x1dd574;})['then'](respondWithFilteredResult(_0x22e5b3,_0x6396fc))['catch'](handleError(_0x22e5b3,null));};exports[_0x16d1('0x3c')]=function(_0x168e14,_0x24038b){var _0x1eb761={'raw':!![],'where':{'id':_0x168e14[_0x16d1('0x3d')]['id']}},_0x53de06={};_0x53de06['model']=_[_0x16d1('0x2e')](db[_0x16d1('0x29')][_0x16d1('0x2a')]);_0x53de06[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x168e14[_0x16d1('0x2d')]);_0x53de06[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],_0x53de06[_0x16d1('0x2d')]);_0x1eb761[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],qs[_0x16d1('0x3e')](_0x168e14[_0x16d1('0x2d')]['fields']));_0x1eb761['attributes']=_0x1eb761[_0x16d1('0x31')][_0x16d1('0x32')]?_0x1eb761[_0x16d1('0x31')]:_0x53de06[_0x16d1('0x2c')];if(_0x168e14[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x1eb761['include']=[{'all':!![]}];}_0x1eb761=_[_0x16d1('0x36')]({},_0x1eb761,_0x168e14[_0x16d1('0x38')]);return db[_0x16d1('0x29')]['find'](_0x1eb761)['then'](handleEntityNotFound(_0x24038b,null))[_0x16d1('0x22')](respondWithResult(_0x24038b,null))[_0x16d1('0x3f')](handleError(_0x24038b,null));};exports['create']=function(_0x1cc137,_0x583151){return db[_0x16d1('0x29')][_0x16d1('0x40')](_0x1cc137[_0x16d1('0x41')],{})[_0x16d1('0x22')](respondWithResult(_0x583151,0xc9))['catch'](handleError(_0x583151,null));};exports['update']=function(_0x1d92cd,_0x8bb0c1){if(_0x1d92cd['body']['id']){delete _0x1d92cd[_0x16d1('0x41')]['id'];}return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x1d92cd[_0x16d1('0x3d')]['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x8bb0c1,null))['then'](saveUpdates(_0x1d92cd[_0x16d1('0x41')],null))['then'](respondWithResult(_0x8bb0c1,null))[_0x16d1('0x3f')](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x23')]=function(_0x5d384c,_0x413acd){return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x5d384c[_0x16d1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x413acd,null))['then'](removeEntity(_0x413acd,null))['catch'](handleError(_0x413acd,null));};exports[_0x16d1('0x43')]=function(_0xbf100f,_0x39fd41){return db[_0x16d1('0x29')]['describe']()[_0x16d1('0x22')](respondWithResult(_0x39fd41,null))[_0x16d1('0x3f')](handleError(_0x39fd41,null));}; \ No newline at end of file +var _0x77d4=['save','update','then','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x2c10fb,_0x380e1b){var _0x23e4c0=function(_0x4fdea5){while(--_0x4fdea5){_0x2c10fb['push'](_0x2c10fb['shift']());}};_0x23e4c0(++_0x380e1b);}(_0x77d4,0x108));var _0x477d=function(_0x5385f5,_0x554c1b){_0x5385f5=_0x5385f5-0x0;var _0x1eac01=_0x77d4[_0x5385f5];return _0x1eac01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x477d('0x1'));var rp=require('request-promise');var moment=require(_0x477d('0x2'));var BPromise=require(_0x477d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x477d('0x4'));var sox=require(_0x477d('0x5'));var csv=require(_0x477d('0x6'));var ejs=require(_0x477d('0x7'));var fs=require('fs');var fs_extra=require(_0x477d('0x8'));var _=require(_0x477d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x477d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477d('0xb'));var Papa=require(_0x477d('0xc'));var Redis=require(_0x477d('0xd'));var authService=require(_0x477d('0xe'));var qs=require(_0x477d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x477d('0x10'));var logger=require('../../config/logger')(_0x477d('0x11'));var utils=require(_0x477d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x477d('0x13'));var db=require(_0x477d('0x14'))['db'];function respondWithStatusCode(_0x5a190c,_0x5dd33c){_0x5dd33c=_0x5dd33c||0xcc;return function(_0x6ff724){if(_0x6ff724){return _0x5a190c[_0x477d('0x15')](_0x5dd33c);}return _0x5a190c['status'](_0x5dd33c)[_0x477d('0x16')]();};}function respondWithResult(_0x1d5699,_0x48c73a){_0x48c73a=_0x48c73a||0xc8;return function(_0x4b2021){if(_0x4b2021){return _0x1d5699[_0x477d('0x17')](_0x48c73a)['json'](_0x4b2021);}};}function respondWithFilteredResult(_0x30481f,_0x234b99){return function(_0x25fc02){if(_0x25fc02){var _0x5985b5=typeof _0x234b99[_0x477d('0x18')]===_0x477d('0x19')&&typeof _0x234b99[_0x477d('0x1a')]===_0x477d('0x19');var _0x57b38e=_0x25fc02[_0x477d('0x1b')];var _0x5d5553=_0x5985b5?0x0:_0x234b99[_0x477d('0x18')];var _0x1399d7=_0x5985b5?_0x25fc02[_0x477d('0x1b')]:_0x234b99[_0x477d('0x18')]+_0x234b99[_0x477d('0x1a')];var _0x2145ce;if(_0x1399d7>=_0x57b38e){_0x1399d7=_0x57b38e;_0x2145ce=0xc8;}else{_0x2145ce=0xce;}_0x30481f['status'](_0x2145ce);return _0x30481f[_0x477d('0x1c')]('Content-Range',_0x5d5553+'-'+_0x1399d7+'/'+_0x57b38e)[_0x477d('0x1d')](_0x25fc02);}return null;};}function patchUpdates(_0x24a6d5){return function(_0x40256e){try{jsonpatch[_0x477d('0x1e')](_0x40256e,_0x24a6d5,!![]);}catch(_0x27b3aa){return BPromise[_0x477d('0x1f')](_0x27b3aa);}return _0x40256e[_0x477d('0x20')]();};}function saveUpdates(_0x17154d,_0x45a8bd){return function(_0x5981a){if(_0x5981a){return _0x5981a[_0x477d('0x21')](_0x17154d)[_0x477d('0x22')](function(_0x43c845){return _0x43c845;});}return null;};}function removeEntity(_0x1f3868,_0x4e6a44){return function(_0x4481b0){if(_0x4481b0){return _0x4481b0['destroy']()[_0x477d('0x22')](function(){_0x1f3868[_0x477d('0x17')](0xcc)[_0x477d('0x16')]();});}};}function handleEntityNotFound(_0x2287b4,_0x4bb50e){return function(_0xd6dca5){if(!_0xd6dca5){_0x2287b4[_0x477d('0x15')](0x194);}return _0xd6dca5;};}function handleError(_0x1ca4fe,_0x48ee5e){_0x48ee5e=_0x48ee5e||0x1f4;return function(_0x585648){logger[_0x477d('0x23')](_0x585648[_0x477d('0x24')]);if(_0x585648[_0x477d('0x25')]){delete _0x585648['name'];}_0x1ca4fe[_0x477d('0x17')](_0x48ee5e)[_0x477d('0x26')](_0x585648);};}exports[_0x477d('0x27')]=function(_0xe4dd40,_0x37b332){var _0x537fc4={},_0x2fc959={},_0xeb02f5={'count':0x0,'rows':[]};var _0x17dd16=_[_0x477d('0x28')](db[_0x477d('0x29')][_0x477d('0x2a')],function(_0x180046){return{'name':_0x180046[_0x477d('0x2b')],'type':_0x180046[_0x477d('0x2c')][_0x477d('0x2d')]};});_0x2fc959[_0x477d('0x2e')]=_[_0x477d('0x28')](_0x17dd16,_0x477d('0x25'));_0x2fc959[_0x477d('0x2f')]=_[_0x477d('0x30')](_0xe4dd40[_0x477d('0x2f')]);_0x2fc959[_0x477d('0x31')]=_[_0x477d('0x32')](_0x2fc959[_0x477d('0x2e')],_0x2fc959[_0x477d('0x2f')]);_0x537fc4['attributes']=_[_0x477d('0x32')](_0x2fc959['model'],qs[_0x477d('0x33')](_0xe4dd40[_0x477d('0x2f')][_0x477d('0x33')]));_0x537fc4['attributes']=_0x537fc4[_0x477d('0x34')][_0x477d('0x35')]?_0x537fc4[_0x477d('0x34')]:_0x2fc959[_0x477d('0x2e')];if(!_0xe4dd40[_0x477d('0x2f')][_0x477d('0x36')](_0x477d('0x37'))){_0x537fc4[_0x477d('0x1a')]=qs[_0x477d('0x1a')](_0xe4dd40[_0x477d('0x2f')]['limit']);_0x537fc4[_0x477d('0x18')]=qs[_0x477d('0x18')](_0xe4dd40[_0x477d('0x2f')]['offset']);}_0x537fc4[_0x477d('0x38')]=qs[_0x477d('0x39')](_0xe4dd40[_0x477d('0x2f')]['sort']);_0x537fc4['where']=qs[_0x477d('0x31')](_[_0x477d('0x3a')](_0xe4dd40[_0x477d('0x2f')],_0x2fc959[_0x477d('0x31')]),_0x17dd16);if(_0xe4dd40[_0x477d('0x2f')]['filter']){_0x537fc4[_0x477d('0x3b')]=_['merge'](_0x537fc4[_0x477d('0x3b')],{'$or':_[_0x477d('0x28')](_0x17dd16,function(_0x356f41){if(_0x356f41['type']!=='VIRTUAL'){var _0x184d50={};_0x184d50[_0x356f41[_0x477d('0x25')]]={'$like':'%'+_0xe4dd40[_0x477d('0x2f')][_0x477d('0x3c')]+'%'};return _0x184d50;}})});}_0x537fc4=_['merge']({},_0x537fc4,_0xe4dd40[_0x477d('0x3d')]);var _0xc091e={'where':_0x537fc4[_0x477d('0x3b')]};return db[_0x477d('0x29')][_0x477d('0x1b')](_0xc091e)['then'](function(_0x472149){_0xeb02f5[_0x477d('0x1b')]=_0x472149;if(_0xe4dd40['query'][_0x477d('0x3e')]){_0x537fc4['include']=[{'all':!![]}];}return db[_0x477d('0x29')][_0x477d('0x3f')](_0x537fc4);})[_0x477d('0x22')](function(_0x335b2a){_0xeb02f5[_0x477d('0x40')]=_0x335b2a;return _0xeb02f5;})[_0x477d('0x22')](respondWithFilteredResult(_0x37b332,_0x537fc4))[_0x477d('0x41')](handleError(_0x37b332,null));};exports[_0x477d('0x42')]=function(_0x43ffd1,_0x4c22f5){var _0x5759f={'raw':!![],'where':{'id':_0x43ffd1[_0x477d('0x43')]['id']}},_0x31c9a1={};_0x31c9a1[_0x477d('0x2e')]=_['keys'](db['MailQueueReport'][_0x477d('0x2a')]);_0x31c9a1[_0x477d('0x2f')]=_['keys'](_0x43ffd1[_0x477d('0x2f')]);_0x31c9a1['filters']=_['intersection'](_0x31c9a1[_0x477d('0x2e')],_0x31c9a1[_0x477d('0x2f')]);_0x5759f[_0x477d('0x34')]=_[_0x477d('0x32')](_0x31c9a1[_0x477d('0x2e')],qs[_0x477d('0x33')](_0x43ffd1['query'][_0x477d('0x33')]));_0x5759f[_0x477d('0x34')]=_0x5759f[_0x477d('0x34')][_0x477d('0x35')]?_0x5759f[_0x477d('0x34')]:_0x31c9a1['model'];if(_0x43ffd1['query'][_0x477d('0x3e')]){_0x5759f[_0x477d('0x44')]=[{'all':!![]}];}_0x5759f=_[_0x477d('0x45')]({},_0x5759f,_0x43ffd1['options']);return db[_0x477d('0x29')][_0x477d('0x46')](_0x5759f)[_0x477d('0x22')](handleEntityNotFound(_0x4c22f5,null))[_0x477d('0x22')](respondWithResult(_0x4c22f5,null))[_0x477d('0x41')](handleError(_0x4c22f5,null));};exports[_0x477d('0x47')]=function(_0x13f606,_0x4d4e19){return db[_0x477d('0x29')][_0x477d('0x47')](_0x13f606[_0x477d('0x48')],{})[_0x477d('0x22')](respondWithResult(_0x4d4e19,0xc9))[_0x477d('0x41')](handleError(_0x4d4e19,null));};exports[_0x477d('0x21')]=function(_0x2aad84,_0x30e474){if(_0x2aad84[_0x477d('0x48')]['id']){delete _0x2aad84[_0x477d('0x48')]['id'];}return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x2aad84[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x30e474,null))[_0x477d('0x22')](saveUpdates(_0x2aad84['body'],null))[_0x477d('0x22')](respondWithResult(_0x30e474,null))[_0x477d('0x41')](handleError(_0x30e474,null));};exports['destroy']=function(_0x566ba0,_0x5cb3ca){return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x566ba0[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x5cb3ca,null))[_0x477d('0x22')](removeEntity(_0x5cb3ca,null))[_0x477d('0x41')](handleError(_0x5cb3ca,null));};exports[_0x477d('0x49')]=function(_0x342f18,_0x593faf){return db[_0x477d('0x29')][_0x477d('0x49')]()[_0x477d('0x22')](respondWithResult(_0x593faf,null))[_0x477d('0x41')](handleError(_0x593faf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d1a0aa3..e12d61f 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 _0x7e10=['bluebird','path','rimraf','../../config/environment','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x555e89,_0x116bce){var _0xdee237=function(_0x41a889){while(--_0x41a889){_0x555e89['push'](_0x555e89['shift']());}};_0xdee237(++_0x116bce);}(_0x7e10,0x1b8));var _0x07e1=function(_0x13511f,_0x2d8426){_0x13511f=_0x13511f-0x0;var _0x598d33=_0x7e10[_0x13511f];return _0x598d33;};'use strict';var _=require(_0x07e1('0x0'));var util=require(_0x07e1('0x1'));var logger=require(_0x07e1('0x2'))('api');var moment=require(_0x07e1('0x3'));var BPromise=require(_0x07e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07e1('0x5'));var rimraf=require(_0x07e1('0x6'));var config=require(_0x07e1('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x07e1('0x8')]=function(_0x232a42,_0x34ec6e){return _0x232a42[_0x07e1('0x9')](_0x07e1('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x07e1('0xb'),'fields':[_0x07e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6615=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes','define','report_mail_queue','uniqueid'];(function(_0x569694,_0xabbfe8){var _0x2d75eb=function(_0x3b9347){while(--_0x3b9347){_0x569694['push'](_0x569694['shift']());}};_0x2d75eb(++_0xabbfe8);}(_0x6615,0x8f));var _0x5661=function(_0x38eb22,_0x458a8c){_0x38eb22=_0x38eb22-0x0;var _0x49553e=_0x6615[_0x38eb22];return _0x49553e;};'use strict';var _=require(_0x5661('0x0'));var util=require(_0x5661('0x1'));var logger=require('../../config/logger')(_0x5661('0x2'));var moment=require(_0x5661('0x3'));var BPromise=require(_0x5661('0x4'));var rp=require(_0x5661('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5661('0x6'));var attributes=require(_0x5661('0x7'));module['exports']=function(_0x3bbfee,_0x2742ea){return _0x3bbfee[_0x5661('0x8')]('MailQueueReport',attributes,{'tableName':_0x5661('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5661('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 462a246..5f14c16 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(_0xe0525f,_0x2e1584){var _0x510ae1=function(_0x3da752){while(--_0x3da752){_0xe0525f['push'](_0xe0525f['shift']());}};_0x510ae1(++_0x2e1584);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1574eb,_0x5ccf5d){var _0xca5f1=function(_0x1b6e34){while(--_0x1b6e34){_0x1574eb['push'](_0x1574eb['shift']());}};_0xca5f1(++_0x5ccf5d);}(_0xadb5,0xad));var _0x5adb=function(_0x526604,_0x8e5926){_0x526604=_0x526604-0x0;var _0x156ad1=_0xadb5[_0x526604];return _0x156ad1;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4877b88..d540c7e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b3937,_0x5be3a0){var _0x248779=function(_0x3d6375){while(--_0x3d6375){_0x1b3937['push'](_0x1b3937['shift']());}};_0x248779(++_0x5be3a0);}(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x480a31,_0x46d28d){var _0x5ca372=function(_0x1103e7){while(--_0x1103e7){_0x480a31['push'](_0x480a31['shift']());}};_0x5ca372(++_0x46d28d);}(_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 101763e..f0fee3a 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 _0x7b92=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x1346a2,_0xc5f09a){var _0x5d13a5=function(_0x444e10){while(--_0x444e10){_0x1346a2['push'](_0x1346a2['shift']());}};_0x5d13a5(++_0xc5f09a);}(_0x7b92,0x1a2));var _0x27b9=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0x7b92[_0x4fa489];return _0x41d2ce;};'use strict';var Sequelize=require(_0x27b9('0x0'));module[_0x27b9('0x1')]={'description':{'type':Sequelize[_0x27b9('0x2')]},'host':{'type':Sequelize[_0x27b9('0x2')]},'authentication':{'type':Sequelize[_0x27b9('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x27b9('0x2')]},'password':{'type':Sequelize[_0x27b9('0x2')]},'port':{'type':Sequelize[_0x27b9('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x27b9('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x27b9('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x27b9('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa337=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa337,0x7f));var _0x7a33=function(_0xb82fa8,_0x57cf3c){_0xb82fa8=_0xb82fa8-0x0;var _0x43ab48=_0xa337[_0xb82fa8];return _0x43ab48;};'use strict';var Sequelize=require(_0x7a33('0x0'));module['exports']={'description':{'type':Sequelize[_0x7a33('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x7a33('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7a33('0x1')]},'port':{'type':Sequelize[_0x7a33('0x3')]},'tls':{'type':Sequelize[_0x7a33('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7a33('0x1')],'defaultValue':_0x7a33('0x4')},'connTimeout':{'type':Sequelize[_0x7a33('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7a33('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x7a33('0x1')]},'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 b721816..b12010c 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 _0x6162=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x453fc0,_0x10e8c0){var _0x124971=function(_0x229fbd){while(--_0x229fbd){_0x453fc0['push'](_0x453fc0['shift']());}};_0x124971(++_0x10e8c0);}(_0x6162,0x84));var _0x2616=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6162[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2616('0x0'));var util=require(_0x2616('0x1'));var logger=require(_0x2616('0x2'))('api');var moment=require(_0x2616('0x3'));var BPromise=require(_0x2616('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2616('0x5'));var rimraf=require(_0x2616('0x6'));var config=require('../../config/environment');var attributes=require(_0x2616('0x7'));module['exports']=function(_0x9131d1,_0xd4b93f){return _0x9131d1[_0x2616('0x8')](_0x2616('0x9'),attributes,{'tableName':_0x2616('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe975=['api','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','../../config/logger'];(function(_0xa99a38,_0x3212d2){var _0x2452fe=function(_0x12d791){while(--_0x12d791){_0xa99a38['push'](_0xa99a38['shift']());}};_0x2452fe(++_0x3212d2);}(_0xe975,0x172));var _0x5e97=function(_0xbd5e2,_0x1f46f2){_0xbd5e2=_0xbd5e2-0x0;var _0x3b3c52=_0xe975[_0xbd5e2];return _0x3b3c52;};'use strict';var _=require(_0x5e97('0x0'));var util=require('util');var logger=require(_0x5e97('0x1'))(_0x5e97('0x2'));var moment=require(_0x5e97('0x3'));var BPromise=require(_0x5e97('0x4'));var rp=require(_0x5e97('0x5'));var fs=require('fs');var path=require(_0x5e97('0x6'));var rimraf=require(_0x5e97('0x7'));var config=require('../../config/environment');var attributes=require(_0x5e97('0x8'));module[_0x5e97('0x9')]=function(_0x112730,_0x537d58){return _0x112730['define'](_0x5e97('0xa'),attributes,{'tableName':_0x5e97('0xb'),'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 ee3e755..766a82e 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 _0xad36=['where','attributes','include','model','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x16a5af,_0x234650){var _0xfa1bd4=function(_0x23792c){while(--_0x23792c){_0x16a5af['push'](_0x16a5af['shift']());}};_0xfa1bd4(++_0x234650);}(_0xad36,0x1c6));var _0x6ad3=function(_0x339702,_0x209fe8){_0x339702=_0x339702-0x0;var _0x492877=_0xad36[_0x339702];return _0x492877;};'use strict';var _=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var moment=require(_0x6ad3('0x2'));var BPromise=require(_0x6ad3('0x3'));var rs=require(_0x6ad3('0x4'));var fs=require('fs');var Redis=require(_0x6ad3('0x5'));var db=require(_0x6ad3('0x6'))['db'];var utils=require(_0x6ad3('0x7'));var logger=require(_0x6ad3('0x8'))(_0x6ad3('0x9'));var config=require('../../config/environment');var jayson=require(_0x6ad3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x118c7f,_0x4056ba,_0x904fc6){return new BPromise(function(_0x386e71,_0x36e256){return client['request'](_0x118c7f,_0x904fc6)['then'](function(_0x53cc18){logger[_0x6ad3('0xb')]('MailServerIn,\x20%s,\x20%s',_0x4056ba,'request\x20sent');logger[_0x6ad3('0xc')](_0x6ad3('0xd'),_0x4056ba,_0x6ad3('0xe'),JSON['stringify'](_0x53cc18));if(_0x53cc18['error']){if(_0x53cc18['error'][_0x6ad3('0xf')]===0x1f4){logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);return _0x36e256(_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);}logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x53cc18['error'][_0x6ad3('0x12')]);return _0x386e71(_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);}else{logger['info'](_0x6ad3('0x11'),_0x4056ba,_0x6ad3('0xe'));_0x386e71(_0x53cc18[_0x6ad3('0x13')][_0x6ad3('0x12')]);}})[_0x6ad3('0x14')](function(_0x88bd5f){logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x88bd5f);_0x36e256(_0x88bd5f);});});}exports[_0x6ad3('0x15')]=function(_0x3ecf8e){var _0x147649=this;return new Promise(function(_0x18d648,_0x16e55c){return db[_0x6ad3('0x16')][_0x6ad3('0x17')]({'raw':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x19')]===undefined?!![]:![]:!![],'where':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x1a')]||null:null,'attributes':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x1b')]||null:null,'limit':_0x3ecf8e['options']?_0x3ecf8e['options']['limit']||null:null,'include':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e['options']['include']?_['map'](_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x1c')],function(_0x4d5fa0){return{'model':db[_0x4d5fa0[_0x6ad3('0x1d')]],'as':_0x4d5fa0['as'],'attributes':_0x4d5fa0[_0x6ad3('0x1b')],'include':_0x4d5fa0[_0x6ad3('0x1c')]?_['map'](_0x4d5fa0[_0x6ad3('0x1c')],function(_0x1cc6d8){return{'model':db[_0x1cc6d8[_0x6ad3('0x1d')]],'as':_0x1cc6d8['as'],'attributes':_0x1cc6d8[_0x6ad3('0x1b')],'include':_0x1cc6d8[_0x6ad3('0x1c')]?_['map'](_0x1cc6d8[_0x6ad3('0x1c')],function(_0x56c0af){return{'model':db[_0x56c0af[_0x6ad3('0x1d')]],'as':_0x56c0af['as'],'attributes':_0x56c0af[_0x6ad3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ad3('0x1e')](function(_0x4ed478){logger['info'](_0x6ad3('0x15'),_0x3ecf8e);logger[_0x6ad3('0xc')](_0x6ad3('0x15'),_0x3ecf8e,JSON[_0x6ad3('0x1f')](_0x4ed478));_0x18d648(_0x4ed478);})['catch'](function(_0x595c90){logger[_0x6ad3('0x10')](_0x6ad3('0x15'),_0x595c90[_0x6ad3('0x12')],_0x3ecf8e);_0x16e55c(_0x147649[_0x6ad3('0x10')](0x1f4,_0x595c90[_0x6ad3('0x12')]));});});}; \ No newline at end of file +var _0x074f=['jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','GetMailServerIn','MailServerIn','options','raw','attributes','limit','include','map','model','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x408d83,_0x3f20a0){var _0x52cb03=function(_0x3c9fbe){while(--_0x3c9fbe){_0x408d83['push'](_0x408d83['shift']());}};_0x52cb03(++_0x3f20a0);}(_0x074f,0x97));var _0xf074=function(_0x4981da,_0x43c7a4){_0x4981da=_0x4981da-0x0;var _0x4aa51f=_0x074f[_0x4981da];return _0x4aa51f;};'use strict';var _=require(_0xf074('0x0'));var util=require(_0xf074('0x1'));var moment=require(_0xf074('0x2'));var BPromise=require(_0xf074('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf074('0x4'));var db=require(_0xf074('0x5'))['db'];var utils=require(_0xf074('0x6'));var logger=require('../../config/logger')(_0xf074('0x7'));var config=require(_0xf074('0x8'));var jayson=require(_0xf074('0x9'));var client=jayson[_0xf074('0xa')][_0xf074('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f8534,_0x1f48c8,_0x1bf247){return new BPromise(function(_0x383c50,_0x16567b){return client[_0xf074('0xc')](_0x2f8534,_0x1bf247)['then'](function(_0x240e58){logger[_0xf074('0xd')]('MailServerIn,\x20%s,\x20%s',_0x1f48c8,_0xf074('0xe'));logger[_0xf074('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1f48c8,_0xf074('0xe'),JSON[_0xf074('0x10')](_0x240e58));if(_0x240e58[_0xf074('0x11')]){if(_0x240e58['error'][_0xf074('0x12')]===0x1f4){logger[_0xf074('0x11')](_0xf074('0x13'),_0x1f48c8,_0x240e58[_0xf074('0x11')][_0xf074('0x14')]);return _0x16567b(_0x240e58['error'][_0xf074('0x14')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x1f48c8,_0x240e58['error']['message']);return _0x383c50(_0x240e58[_0xf074('0x11')]['message']);}else{logger[_0xf074('0xd')](_0xf074('0x13'),_0x1f48c8,_0xf074('0xe'));_0x383c50(_0x240e58['result'][_0xf074('0x14')]);}})['catch'](function(_0x25bc5){logger[_0xf074('0x11')](_0xf074('0x13'),_0x1f48c8,_0x25bc5);_0x16567b(_0x25bc5);});});}exports[_0xf074('0x15')]=function(_0x275d6b){var _0x269dd8=this;return new Promise(function(_0x220661,_0x5a845a){return db[_0xf074('0x16')]['findAll']({'raw':_0x275d6b['options']?_0x275d6b[_0xf074('0x17')][_0xf074('0x18')]===undefined?!![]:![]:!![],'where':_0x275d6b[_0xf074('0x17')]?_0x275d6b[_0xf074('0x17')]['where']||null:null,'attributes':_0x275d6b[_0xf074('0x17')]?_0x275d6b[_0xf074('0x17')][_0xf074('0x19')]||null:null,'limit':_0x275d6b['options']?_0x275d6b['options'][_0xf074('0x1a')]||null:null,'include':_0x275d6b[_0xf074('0x17')]?_0x275d6b[_0xf074('0x17')][_0xf074('0x1b')]?_[_0xf074('0x1c')](_0x275d6b['options'][_0xf074('0x1b')],function(_0x38bbde){return{'model':db[_0x38bbde[_0xf074('0x1d')]],'as':_0x38bbde['as'],'attributes':_0x38bbde[_0xf074('0x19')],'include':_0x38bbde[_0xf074('0x1b')]?_['map'](_0x38bbde[_0xf074('0x1b')],function(_0x4702bb){return{'model':db[_0x4702bb[_0xf074('0x1d')]],'as':_0x4702bb['as'],'attributes':_0x4702bb[_0xf074('0x19')],'include':_0x4702bb[_0xf074('0x1b')]?_['map'](_0x4702bb[_0xf074('0x1b')],function(_0x54a2d7){return{'model':db[_0x54a2d7[_0xf074('0x1d')]],'as':_0x54a2d7['as'],'attributes':_0x54a2d7[_0xf074('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf074('0x1e')](function(_0x1cf776){logger[_0xf074('0xd')](_0xf074('0x15'),_0x275d6b);logger[_0xf074('0xf')](_0xf074('0x15'),_0x275d6b,JSON['stringify'](_0x1cf776));_0x220661(_0x1cf776);})[_0xf074('0x1f')](function(_0xa11049){logger[_0xf074('0x11')](_0xf074('0x15'),_0xa11049[_0xf074('0x14')],_0x275d6b);_0x5a845a(_0x269dd8[_0xf074('0x11')](0x1f4,_0xa11049[_0xf074('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 844d726..812d091 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(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a54,0x106));var _0x47a5=function(_0x1a7ade,_0x124086){_0x1a7ade=_0x1a7ade-0x0;var _0x1373d0=_0x7a54[_0x1a7ade];return _0x1373d0;};'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 _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(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x23c75a,_0x3bf9b7){_0x23c75a=_0x23c75a-0x0;var _0x4640ed=_0x7a54[_0x23c75a];return _0x4640ed;};'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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 46bb1ef..c8892fb 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 _0x6b20=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x49b737,_0x40e7bc){var _0x2c4b06=function(_0x2e8ccf){while(--_0x2e8ccf){_0x49b737['push'](_0x49b737['shift']());}};_0x2c4b06(++_0x40e7bc);}(_0x6b20,0xd1));var _0x06b2=function(_0x1cc208,_0x3b076c){_0x1cc208=_0x1cc208-0x0;var _0x334cb5=_0x6b20[_0x1cc208];return _0x334cb5;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x06b2('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x06b2('0x2')]},'port':{'type':Sequelize[_0x06b2('0x3')]},'secure':{'type':Sequelize[_0x06b2('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x06b2('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x06b2('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa478=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x29b1a1,_0x1bcf0c){var _0x590ae6=function(_0x569146){while(--_0x569146){_0x29b1a1['push'](_0x29b1a1['shift']());}};_0x590ae6(++_0x1bcf0c);}(_0xa478,0x136));var _0x8a47=function(_0x5f584a,_0x47f064){_0x5f584a=_0x5f584a-0x0;var _0x3788d9=_0xa478[_0x5f584a];return _0x3788d9;};'use strict';var Sequelize=require(_0x8a47('0x0'));module[_0x8a47('0x1')]={'description':{'type':Sequelize[_0x8a47('0x2')]},'host':{'type':Sequelize[_0x8a47('0x2')]},'user':{'type':Sequelize[_0x8a47('0x2')]},'pass':{'type':Sequelize[_0x8a47('0x2')]},'port':{'type':Sequelize[_0x8a47('0x3')]},'secure':{'type':Sequelize[_0x8a47('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8a47('0x2')]},'authentication':{'type':Sequelize[_0x8a47('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x8a47('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 28de6aa..254d2b6 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 _0x213d=['stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x213d,0x70));var _0xd213=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x213d[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require(_0xd213('0x0'));var rimraf=require(_0xd213('0x1'));var zipdir=require(_0xd213('0x2'));var jsonpatch=require(_0xd213('0x3'));var rp=require(_0xd213('0x4'));var moment=require(_0xd213('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd213('0x6'));var util=require(_0xd213('0x7'));var path=require(_0xd213('0x8'));var sox=require(_0xd213('0x9'));var csv=require(_0xd213('0xa'));var ejs=require(_0xd213('0xb'));var fs=require('fs');var fs_extra=require(_0xd213('0xc'));var _=require(_0xd213('0xd'));var squel=require(_0xd213('0xe'));var crypto=require('crypto');var jsforce=require(_0xd213('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd213('0x10'));var Papa=require(_0xd213('0x11'));var Redis=require(_0xd213('0x12'));var authService=require(_0xd213('0x13'));var qs=require(_0xd213('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd213('0x15'))(_0xd213('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd213('0x17'));var db=require(_0xd213('0x18'))['db'];function respondWithStatusCode(_0x33fe1c,_0x2487e2){_0x2487e2=_0x2487e2||0xcc;return function(_0x101677){if(_0x101677){return _0x33fe1c['sendStatus'](_0x2487e2);}return _0x33fe1c[_0xd213('0x19')](_0x2487e2)['end']();};}function respondWithResult(_0x55c5fa,_0x4f40b8){_0x4f40b8=_0x4f40b8||0xc8;return function(_0x137d91){if(_0x137d91){return _0x55c5fa[_0xd213('0x19')](_0x4f40b8)[_0xd213('0x1a')](_0x137d91);}};}function respondWithFilteredResult(_0x2a996c,_0x1f9755){return function(_0x573df1){if(_0x573df1){var _0x7a1688=typeof _0x1f9755[_0xd213('0x1b')]===_0xd213('0x1c')&&typeof _0x1f9755[_0xd213('0x1d')]===_0xd213('0x1c');var _0x13e08f=_0x573df1[_0xd213('0x1e')];var _0x2220ff=_0x7a1688?0x0:_0x1f9755[_0xd213('0x1b')];var _0x526385=_0x7a1688?_0x573df1[_0xd213('0x1e')]:_0x1f9755[_0xd213('0x1b')]+_0x1f9755[_0xd213('0x1d')];var _0x25166d;if(_0x526385>=_0x13e08f){_0x526385=_0x13e08f;_0x25166d=0xc8;}else{_0x25166d=0xce;}_0x2a996c[_0xd213('0x19')](_0x25166d);return _0x2a996c['set'](_0xd213('0x1f'),_0x2220ff+'-'+_0x526385+'/'+_0x13e08f)[_0xd213('0x1a')](_0x573df1);}return null;};}function patchUpdates(_0x5798c9){return function(_0x401ba5){try{jsonpatch[_0xd213('0x20')](_0x401ba5,_0x5798c9,!![]);}catch(_0x8856d4){return BPromise[_0xd213('0x21')](_0x8856d4);}return _0x401ba5[_0xd213('0x22')]();};}function saveUpdates(_0x536168,_0x4fad10){return function(_0x1ced4b){if(_0x1ced4b){return _0x1ced4b['update'](_0x536168)['then'](function(_0x2d5abb){return _0x2d5abb;});}return null;};}function removeEntity(_0x3fcff0,_0x50fe53){return function(_0x188d49){if(_0x188d49){return _0x188d49[_0xd213('0x23')]()[_0xd213('0x24')](function(){_0x3fcff0['status'](0xcc)[_0xd213('0x25')]();});}};}function handleEntityNotFound(_0x31681c,_0x33f41c){return function(_0x4c5ee6){if(!_0x4c5ee6){_0x31681c[_0xd213('0x26')](0x194);}return _0x4c5ee6;};}function handleError(_0x1748c2,_0x1c0c75){_0x1c0c75=_0x1c0c75||0x1f4;return function(_0x350e0f){logger[_0xd213('0x27')](_0x350e0f[_0xd213('0x28')]);if(_0x350e0f['name']){delete _0x350e0f[_0xd213('0x29')];}_0x1748c2[_0xd213('0x19')](_0x1c0c75)[_0xd213('0x2a')](_0x350e0f);};}exports[_0xd213('0x2b')]=function(_0x366fd6,_0x3d2083){var _0x36a761={},_0xde5de6={},_0x176b4f={'count':0x0,'rows':[]};var _0x3c68be=_['map'](db[_0xd213('0x2c')][_0xd213('0x2d')],function(_0x4fa3cb){return{'name':_0x4fa3cb[_0xd213('0x2e')],'type':_0x4fa3cb[_0xd213('0x2f')][_0xd213('0x30')]};});_0xde5de6[_0xd213('0x31')]=_[_0xd213('0x32')](_0x3c68be,'name');_0xde5de6[_0xd213('0x33')]=_[_0xd213('0x34')](_0x366fd6['query']);_0xde5de6['filters']=_['intersection'](_0xde5de6[_0xd213('0x31')],_0xde5de6[_0xd213('0x33')]);_0x36a761[_0xd213('0x35')]=_[_0xd213('0x36')](_0xde5de6[_0xd213('0x31')],qs[_0xd213('0x37')](_0x366fd6['query']['fields']));_0x36a761[_0xd213('0x35')]=_0x36a761[_0xd213('0x35')][_0xd213('0x38')]?_0x36a761[_0xd213('0x35')]:_0xde5de6[_0xd213('0x31')];if(!_0x366fd6[_0xd213('0x33')][_0xd213('0x39')]('nolimit')){_0x36a761[_0xd213('0x1d')]=qs['limit'](_0x366fd6[_0xd213('0x33')]['limit']);_0x36a761[_0xd213('0x1b')]=qs[_0xd213('0x1b')](_0x366fd6['query']['offset']);}_0x36a761['order']=qs[_0xd213('0x3a')](_0x366fd6['query'][_0xd213('0x3a')]);_0x36a761[_0xd213('0x3b')]=qs[_0xd213('0x3c')](_[_0xd213('0x3d')](_0x366fd6['query'],_0xde5de6[_0xd213('0x3c')]),_0x3c68be);if(_0x366fd6['query'][_0xd213('0x3e')]){_0x36a761[_0xd213('0x3b')]=_[_0xd213('0x3f')](_0x36a761[_0xd213('0x3b')],{'$or':_['map'](_0x3c68be,function(_0x179d43){if(_0x179d43[_0xd213('0x2f')]!==_0xd213('0x40')){var _0x3e7a94={};_0x3e7a94[_0x179d43[_0xd213('0x29')]]={'$like':'%'+_0x366fd6[_0xd213('0x33')]['filter']+'%'};return _0x3e7a94;}})});}_0x36a761=_['merge']({},_0x36a761,_0x366fd6[_0xd213('0x41')]);var _0x3623d3={'where':_0x36a761[_0xd213('0x3b')]};return db[_0xd213('0x2c')][_0xd213('0x1e')](_0x3623d3)[_0xd213('0x24')](function(_0x3fe623){_0x176b4f[_0xd213('0x1e')]=_0x3fe623;if(_0x366fd6[_0xd213('0x33')]['includeAll']){_0x36a761[_0xd213('0x42')]=[{'all':!![]}];}return db[_0xd213('0x2c')][_0xd213('0x43')](_0x36a761);})[_0xd213('0x24')](function(_0x4d9b3c){_0x176b4f['rows']=_0x4d9b3c;return _0x176b4f;})['then'](respondWithFilteredResult(_0x3d2083,_0x36a761))[_0xd213('0x44')](handleError(_0x3d2083,null));};exports[_0xd213('0x45')]=function(_0x34156c,_0x4344ee){var _0x129739={'raw':!![],'where':{'id':_0x34156c['params']['id']}},_0x4180e5={};_0x4180e5[_0xd213('0x31')]=_[_0xd213('0x34')](db[_0xd213('0x2c')][_0xd213('0x2d')]);_0x4180e5[_0xd213('0x33')]=_[_0xd213('0x34')](_0x34156c['query']);_0x4180e5[_0xd213('0x3c')]=_[_0xd213('0x36')](_0x4180e5[_0xd213('0x31')],_0x4180e5[_0xd213('0x33')]);_0x129739[_0xd213('0x35')]=_[_0xd213('0x36')](_0x4180e5[_0xd213('0x31')],qs[_0xd213('0x37')](_0x34156c['query'][_0xd213('0x37')]));_0x129739[_0xd213('0x35')]=_0x129739[_0xd213('0x35')][_0xd213('0x38')]?_0x129739[_0xd213('0x35')]:_0x4180e5[_0xd213('0x31')];if(_0x34156c[_0xd213('0x33')][_0xd213('0x46')]){_0x129739[_0xd213('0x42')]=[{'all':!![]}];}_0x129739=_[_0xd213('0x3f')]({},_0x129739,_0x34156c[_0xd213('0x41')]);return db[_0xd213('0x2c')][_0xd213('0x47')](_0x129739)[_0xd213('0x24')](handleEntityNotFound(_0x4344ee,null))[_0xd213('0x24')](respondWithResult(_0x4344ee,null))[_0xd213('0x44')](handleError(_0x4344ee,null));};exports['create']=function(_0x195915,_0x3ce59d){return db[_0xd213('0x2c')][_0xd213('0x48')](_0x195915['body'],{})['then'](respondWithResult(_0x3ce59d,0xc9))['catch'](handleError(_0x3ce59d,null));};exports[_0xd213('0x49')]=function(_0x223673,_0x5ed1b6){if(_0x223673[_0xd213('0x4a')]['id']){delete _0x223673['body']['id'];}return db[_0xd213('0x2c')][_0xd213('0x47')]({'where':{'id':_0x223673[_0xd213('0x4b')]['id']}})[_0xd213('0x24')](handleEntityNotFound(_0x5ed1b6,null))['then'](saveUpdates(_0x223673[_0xd213('0x4a')],null))[_0xd213('0x24')](respondWithResult(_0x5ed1b6,null))[_0xd213('0x44')](handleError(_0x5ed1b6,null));};exports[_0xd213('0x23')]=function(_0x579c0a,_0x30ae1d){return db[_0xd213('0x2c')]['find']({'where':{'id':_0x579c0a['params']['id']}})[_0xd213('0x24')](handleEntityNotFound(_0x30ae1d,null))['then'](removeEntity(_0x30ae1d,null))['catch'](handleError(_0x30ae1d,null));}; \ No newline at end of file +var _0xe563=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','includeAll','include','create','body','params','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel'];(function(_0x3b2131,_0x168cdd){var _0x359183=function(_0x1a0bea){while(--_0x1a0bea){_0x3b2131['push'](_0x3b2131['shift']());}};_0x359183(++_0x168cdd);}(_0xe563,0x1b2));var _0x3e56=function(_0x39eb6f,_0x4ee203){_0x39eb6f=_0x39eb6f-0x0;var _0x3a49e7=_0xe563[_0x39eb6f];return _0x3a49e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e56('0x0'));var jsonpatch=require(_0x3e56('0x1'));var rp=require(_0x3e56('0x2'));var moment=require(_0x3e56('0x3'));var BPromise=require(_0x3e56('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e56('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e56('0x6'));var fs=require('fs');var fs_extra=require(_0x3e56('0x7'));var _=require(_0x3e56('0x8'));var squel=require(_0x3e56('0x9'));var crypto=require('crypto');var jsforce=require(_0x3e56('0xa'));var deskjs=require(_0x3e56('0xb'));var toCsv=require(_0x3e56('0xc'));var querystring=require(_0x3e56('0xd'));var Papa=require(_0x3e56('0xe'));var Redis=require(_0x3e56('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3e56('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e56('0x11'));var logger=require('../../config/logger')(_0x3e56('0x12'));var utils=require(_0x3e56('0x13'));var config=require(_0x3e56('0x14'));var licenseUtil=require(_0x3e56('0x15'));var db=require(_0x3e56('0x16'))['db'];function respondWithStatusCode(_0x542e34,_0x19b427){_0x19b427=_0x19b427||0xcc;return function(_0x4a2092){if(_0x4a2092){return _0x542e34[_0x3e56('0x17')](_0x19b427);}return _0x542e34['status'](_0x19b427)[_0x3e56('0x18')]();};}function respondWithResult(_0x41a2ec,_0xcf84a0){_0xcf84a0=_0xcf84a0||0xc8;return function(_0x57fa29){if(_0x57fa29){return _0x41a2ec[_0x3e56('0x19')](_0xcf84a0)[_0x3e56('0x1a')](_0x57fa29);}};}function respondWithFilteredResult(_0x5b2367,_0x305a63){return function(_0xb10786){if(_0xb10786){var _0x4cf213=typeof _0x305a63[_0x3e56('0x1b')]===_0x3e56('0x1c')&&typeof _0x305a63[_0x3e56('0x1d')]===_0x3e56('0x1c');var _0x348e1f=_0xb10786[_0x3e56('0x1e')];var _0x4db251=_0x4cf213?0x0:_0x305a63[_0x3e56('0x1b')];var _0x487c92=_0x4cf213?_0xb10786[_0x3e56('0x1e')]:_0x305a63[_0x3e56('0x1b')]+_0x305a63[_0x3e56('0x1d')];var _0x4b980a;if(_0x487c92>=_0x348e1f){_0x487c92=_0x348e1f;_0x4b980a=0xc8;}else{_0x4b980a=0xce;}_0x5b2367[_0x3e56('0x19')](_0x4b980a);return _0x5b2367[_0x3e56('0x1f')]('Content-Range',_0x4db251+'-'+_0x487c92+'/'+_0x348e1f)[_0x3e56('0x1a')](_0xb10786);}return null;};}function patchUpdates(_0x1e9b32){return function(_0x2a7b8f){try{jsonpatch[_0x3e56('0x20')](_0x2a7b8f,_0x1e9b32,!![]);}catch(_0x50a729){return BPromise[_0x3e56('0x21')](_0x50a729);}return _0x2a7b8f['save']();};}function saveUpdates(_0x5c4dfc,_0x2c885e){return function(_0x5471ac){if(_0x5471ac){return _0x5471ac[_0x3e56('0x22')](_0x5c4dfc)['then'](function(_0x67d02a){return _0x67d02a;});}return null;};}function removeEntity(_0x2ca488,_0x4fb593){return function(_0x404cd4){if(_0x404cd4){return _0x404cd4[_0x3e56('0x23')]()[_0x3e56('0x24')](function(){_0x2ca488[_0x3e56('0x19')](0xcc)[_0x3e56('0x18')]();});}};}function handleEntityNotFound(_0x4b26ea,_0x3a9cf6){return function(_0x26b418){if(!_0x26b418){_0x4b26ea[_0x3e56('0x17')](0x194);}return _0x26b418;};}function handleError(_0x8606d0,_0xbab7ea){_0xbab7ea=_0xbab7ea||0x1f4;return function(_0x1df7a1){logger[_0x3e56('0x25')](_0x1df7a1[_0x3e56('0x26')]);if(_0x1df7a1[_0x3e56('0x27')]){delete _0x1df7a1[_0x3e56('0x27')];}_0x8606d0[_0x3e56('0x19')](_0xbab7ea)[_0x3e56('0x28')](_0x1df7a1);};}exports[_0x3e56('0x29')]=function(_0x198c41,_0x2ee23c){var _0x55ef7c={},_0xfcaf96={},_0x55512c={'count':0x0,'rows':[]};var _0xcf0f83=_[_0x3e56('0x2a')](db[_0x3e56('0x2b')][_0x3e56('0x2c')],function(_0x3ced0f){return{'name':_0x3ced0f[_0x3e56('0x2d')],'type':_0x3ced0f[_0x3e56('0x2e')][_0x3e56('0x2f')]};});_0xfcaf96[_0x3e56('0x30')]=_[_0x3e56('0x2a')](_0xcf0f83,_0x3e56('0x27'));_0xfcaf96[_0x3e56('0x31')]=_[_0x3e56('0x32')](_0x198c41['query']);_0xfcaf96[_0x3e56('0x33')]=_[_0x3e56('0x34')](_0xfcaf96['model'],_0xfcaf96[_0x3e56('0x31')]);_0x55ef7c['attributes']=_[_0x3e56('0x34')](_0xfcaf96[_0x3e56('0x30')],qs[_0x3e56('0x35')](_0x198c41[_0x3e56('0x31')][_0x3e56('0x35')]));_0x55ef7c['attributes']=_0x55ef7c['attributes'][_0x3e56('0x36')]?_0x55ef7c[_0x3e56('0x37')]:_0xfcaf96[_0x3e56('0x30')];if(!_0x198c41[_0x3e56('0x31')][_0x3e56('0x38')](_0x3e56('0x39'))){_0x55ef7c[_0x3e56('0x1d')]=qs[_0x3e56('0x1d')](_0x198c41[_0x3e56('0x31')][_0x3e56('0x1d')]);_0x55ef7c[_0x3e56('0x1b')]=qs[_0x3e56('0x1b')](_0x198c41[_0x3e56('0x31')][_0x3e56('0x1b')]);}_0x55ef7c[_0x3e56('0x3a')]=qs[_0x3e56('0x3b')](_0x198c41[_0x3e56('0x31')]['sort']);_0x55ef7c[_0x3e56('0x3c')]=qs[_0x3e56('0x33')](_['pick'](_0x198c41[_0x3e56('0x31')],_0xfcaf96['filters']),_0xcf0f83);if(_0x198c41[_0x3e56('0x31')]['filter']){_0x55ef7c[_0x3e56('0x3c')]=_[_0x3e56('0x3d')](_0x55ef7c[_0x3e56('0x3c')],{'$or':_['map'](_0xcf0f83,function(_0x5efbc6){if(_0x5efbc6[_0x3e56('0x2e')]!==_0x3e56('0x3e')){var _0x2b0b8b={};_0x2b0b8b[_0x5efbc6[_0x3e56('0x27')]]={'$like':'%'+_0x198c41['query'][_0x3e56('0x3f')]+'%'};return _0x2b0b8b;}})});}_0x55ef7c=_['merge']({},_0x55ef7c,_0x198c41[_0x3e56('0x40')]);var _0x1a46e7={'where':_0x55ef7c[_0x3e56('0x3c')]};return db[_0x3e56('0x2b')][_0x3e56('0x1e')](_0x1a46e7)[_0x3e56('0x24')](function(_0x238886){_0x55512c[_0x3e56('0x1e')]=_0x238886;if(_0x198c41['query']['includeAll']){_0x55ef7c['include']=[{'all':!![]}];}return db[_0x3e56('0x2b')][_0x3e56('0x41')](_0x55ef7c);})[_0x3e56('0x24')](function(_0x5afd01){_0x55512c[_0x3e56('0x42')]=_0x5afd01;return _0x55512c;})[_0x3e56('0x24')](respondWithFilteredResult(_0x2ee23c,_0x55ef7c))[_0x3e56('0x43')](handleError(_0x2ee23c,null));};exports['show']=function(_0x54a0e3,_0x4a0e1c){var _0xbdbb2b={'raw':!![],'where':{'id':_0x54a0e3['params']['id']}},_0x59e9f2={};_0x59e9f2[_0x3e56('0x30')]=_['keys'](db['MailServerOut'][_0x3e56('0x2c')]);_0x59e9f2[_0x3e56('0x31')]=_['keys'](_0x54a0e3[_0x3e56('0x31')]);_0x59e9f2[_0x3e56('0x33')]=_[_0x3e56('0x34')](_0x59e9f2[_0x3e56('0x30')],_0x59e9f2[_0x3e56('0x31')]);_0xbdbb2b[_0x3e56('0x37')]=_[_0x3e56('0x34')](_0x59e9f2['model'],qs[_0x3e56('0x35')](_0x54a0e3[_0x3e56('0x31')][_0x3e56('0x35')]));_0xbdbb2b[_0x3e56('0x37')]=_0xbdbb2b[_0x3e56('0x37')][_0x3e56('0x36')]?_0xbdbb2b[_0x3e56('0x37')]:_0x59e9f2[_0x3e56('0x30')];if(_0x54a0e3['query'][_0x3e56('0x44')]){_0xbdbb2b[_0x3e56('0x45')]=[{'all':!![]}];}_0xbdbb2b=_[_0x3e56('0x3d')]({},_0xbdbb2b,_0x54a0e3['options']);return db[_0x3e56('0x2b')]['find'](_0xbdbb2b)[_0x3e56('0x24')](handleEntityNotFound(_0x4a0e1c,null))[_0x3e56('0x24')](respondWithResult(_0x4a0e1c,null))['catch'](handleError(_0x4a0e1c,null));};exports[_0x3e56('0x46')]=function(_0x4e09d4,_0x393568){return db[_0x3e56('0x2b')][_0x3e56('0x46')](_0x4e09d4[_0x3e56('0x47')],{})[_0x3e56('0x24')](respondWithResult(_0x393568,0xc9))['catch'](handleError(_0x393568,null));};exports[_0x3e56('0x22')]=function(_0x4a8bdd,_0x2e2587){if(_0x4a8bdd['body']['id']){delete _0x4a8bdd[_0x3e56('0x47')]['id'];}return db[_0x3e56('0x2b')]['find']({'where':{'id':_0x4a8bdd[_0x3e56('0x48')]['id']}})[_0x3e56('0x24')](handleEntityNotFound(_0x2e2587,null))['then'](saveUpdates(_0x4a8bdd[_0x3e56('0x47')],null))[_0x3e56('0x24')](respondWithResult(_0x2e2587,null))[_0x3e56('0x43')](handleError(_0x2e2587,null));};exports[_0x3e56('0x23')]=function(_0x148295,_0x32945b){return db[_0x3e56('0x2b')][_0x3e56('0x49')]({'where':{'id':_0x148295[_0x3e56('0x48')]['id']}})[_0x3e56('0x24')](handleEntityNotFound(_0x32945b,null))[_0x3e56('0x24')](removeEntity(_0x32945b,null))[_0x3e56('0x43')](handleError(_0x32945b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a2da7f4..336777c 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 _0xb841=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xb841,0x168));var _0x1b84=function(_0x54098f,_0x357703){_0x54098f=_0x54098f-0x0;var _0x549d40=_0xb841[_0x54098f];return _0x549d40;};'use strict';var _=require(_0x1b84('0x0'));var util=require(_0x1b84('0x1'));var logger=require(_0x1b84('0x2'))(_0x1b84('0x3'));var moment=require(_0x1b84('0x4'));var BPromise=require(_0x1b84('0x5'));var rp=require(_0x1b84('0x6'));var fs=require('fs');var path=require(_0x1b84('0x7'));var rimraf=require(_0x1b84('0x8'));var config=require(_0x1b84('0x9'));var attributes=require('./mailServerOut.attributes');module[_0x1b84('0xa')]=function(_0x1f1c71,_0x4ac748){return _0x1f1c71[_0x1b84('0xb')](_0x1b84('0xc'),attributes,{'tableName':_0x1b84('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbabf=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x1d4c8e,_0x4e9cdf){var _0x532356=function(_0x5452d1){while(--_0x5452d1){_0x1d4c8e['push'](_0x1d4c8e['shift']());}};_0x532356(++_0x4e9cdf);}(_0xbabf,0x1ee));var _0xfbab=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xbabf[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xfbab('0x0'));var util=require(_0xfbab('0x1'));var logger=require(_0xfbab('0x2'))('api');var moment=require(_0xfbab('0x3'));var BPromise=require(_0xfbab('0x4'));var rp=require(_0xfbab('0x5'));var fs=require('fs');var path=require(_0xfbab('0x6'));var rimraf=require(_0xfbab('0x7'));var config=require('../../config/environment');var attributes=require(_0xfbab('0x8'));module[_0xfbab('0x9')]=function(_0x49e7d3,_0x3558d3){return _0x49e7d3['define'](_0xfbab('0xa'),attributes,{'tableName':_0xfbab('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 ced5701..f869c7e 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0x9d0ca0,_0x534e5f){var _0x61f8bf=function(_0x1fabdc){while(--_0x1fabdc){_0x9d0ca0['push'](_0x9d0ca0['shift']());}};_0x61f8bf(++_0x534e5f);}(_0x1261,0x144));var _0x1126=function(_0x1f244d,_0x19e830){_0x1f244d=_0x1f244d-0x0;var _0x16003a=_0x1261[_0x1f244d];return _0x16003a;};'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')]('MailServerOut,\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 _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(_0x53f74c,_0xd71010){var _0x467bc0=function(_0x58ab34){while(--_0x58ab34){_0x53f74c['push'](_0x53f74c['shift']());}};_0x467bc0(++_0xd71010);}(_0xadb5,0xad));var _0x5adb=function(_0x4eff32,_0x3e41be){_0x4eff32=_0x4eff32-0x0;var _0x1f2412=_0xadb5[_0x4eff32];return _0x1f2412;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fb1ed8f..46a7ef4 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 _0x053d=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','describe','get','/:id','show','post','put','update','destroy'];(function(_0x45c60c,_0xda29da){var _0x24e87c=function(_0x44bf48){while(--_0x44bf48){_0x45c60c['push'](_0x45c60c['shift']());}};_0x24e87c(++_0xda29da);}(_0x053d,0x99));var _0xd053=function(_0x46d38a,_0x4002b2){_0x46d38a=_0x46d38a-0x0;var _0x569bc0=_0x053d[_0x46d38a];return _0x569bc0;};'use strict';var multer=require(_0xd053('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd053('0x1'));var express=require(_0xd053('0x2'));var router=express[_0xd053('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd053('0x4'));var interaction=require(_0xd053('0x5'));var config=require(_0xd053('0x6'));var controller=require(_0xd053('0x7'));router['get']('/',auth[_0xd053('0x8')](),controller['index']);router['get']('/describe',auth[_0xd053('0x8')](),controller[_0xd053('0x9')]);router[_0xd053('0xa')](_0xd053('0xb'),auth[_0xd053('0x8')](),controller[_0xd053('0xc')]);router[_0xd053('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd053('0xe')](_0xd053('0xb'),auth['isAuthenticated'](),controller[_0xd053('0xf')]);router['delete'](_0xd053('0xb'),auth[_0xd053('0x8')](),controller[_0xd053('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe11d=['describe','post','create','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x592d0f,_0x1fe726){var _0x2b015c=function(_0x5460ce){while(--_0x5460ce){_0x592d0f['push'](_0x592d0f['shift']());}};_0x2b015c(++_0x1fe726);}(_0xe11d,0x143));var _0xde11=function(_0x5e854b,_0x1dbd13){_0x5e854b=_0x5e854b-0x0;var _0xb0150e=_0xe11d[_0x5e854b];return _0xb0150e;};'use strict';var multer=require(_0xde11('0x0'));var util=require(_0xde11('0x1'));var path=require(_0xde11('0x2'));var timeout=require('connect-timeout');var express=require(_0xde11('0x3'));var router=express[_0xde11('0x4')]();var fs_extra=require(_0xde11('0x5'));var auth=require(_0xde11('0x6'));var interaction=require(_0xde11('0x7'));var config=require('../../config/environment');var controller=require(_0xde11('0x8'));router[_0xde11('0x9')]('/',auth[_0xde11('0xa')](),controller[_0xde11('0xb')]);router[_0xde11('0x9')](_0xde11('0xc'),auth[_0xde11('0xa')](),controller[_0xde11('0xd')]);router['get']('/:id',auth[_0xde11('0xa')](),controller['show']);router[_0xde11('0xe')]('/',auth['isAuthenticated'](),controller[_0xde11('0xf')]);router[_0xde11('0x10')](_0xde11('0x11'),auth[_0xde11('0xa')](),controller[_0xde11('0x12')]);router[_0xde11('0x13')](_0xde11('0x11'),auth[_0xde11('0xa')](),controller['destroy']);module[_0xde11('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 02e6874..9122511 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 _0x938d=['name','STRING','sequelize','exports'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd938('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd938('0x3')]}}; \ No newline at end of file +var _0xafdd=['STRING','name','sequelize','exports'];(function(_0x2ea851,_0x137198){var _0x25e704=function(_0x5349cc){while(--_0x5349cc){_0x2ea851['push'](_0x2ea851['shift']());}};_0x25e704(++_0x137198);}(_0xafdd,0x19a));var _0xdafd=function(_0x993da8,_0x4637f9){_0x993da8=_0x993da8-0x0;var _0x38f22b=_0xafdd[_0x993da8];return _0x38f22b;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'name':{'type':Sequelize[_0xdafd('0x2')],'unique':_0xdafd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdafd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 265ffba..8ccaab9 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 _0x1880=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','sort','where','pick','filter','merge','include','catch','show','params','options','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x258b8c,_0x432d66){var _0x551264=function(_0x53fd4e){while(--_0x53fd4e){_0x258b8c['push'](_0x258b8c['shift']());}};_0x551264(++_0x432d66);}(_0x1880,0x1d9));var _0x0188=function(_0x38231c,_0x1a5931){_0x38231c=_0x38231c-0x0;var _0x5be4e8=_0x1880[_0x38231c];return _0x5be4e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0188('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0188('0x1'));var rp=require(_0x0188('0x2'));var moment=require('moment');var BPromise=require(_0x0188('0x3'));var Mustache=require(_0x0188('0x4'));var util=require(_0x0188('0x5'));var path=require(_0x0188('0x6'));var sox=require(_0x0188('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0188('0x8'));var squel=require('squel');var crypto=require(_0x0188('0x9'));var jsforce=require(_0x0188('0xa'));var deskjs=require(_0x0188('0xb'));var toCsv=require(_0x0188('0xc'));var querystring=require(_0x0188('0xd'));var Papa=require('papaparse');var Redis=require(_0x0188('0xe'));var authService=require(_0x0188('0xf'));var qs=require(_0x0188('0x10'));var as=require(_0x0188('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0188('0x12'))('api');var utils=require(_0x0188('0x13'));var config=require(_0x0188('0x14'));var licenseUtil=require(_0x0188('0x15'));var db=require(_0x0188('0x16'))['db'];function respondWithStatusCode(_0x540183,_0x240d55){_0x240d55=_0x240d55||0xcc;return function(_0x2fd1a6){if(_0x2fd1a6){return _0x540183['sendStatus'](_0x240d55);}return _0x540183[_0x0188('0x17')](_0x240d55)[_0x0188('0x18')]();};}function respondWithResult(_0x277841,_0x14a4b2){_0x14a4b2=_0x14a4b2||0xc8;return function(_0x232d6a){if(_0x232d6a){return _0x277841[_0x0188('0x17')](_0x14a4b2)[_0x0188('0x19')](_0x232d6a);}};}function respondWithFilteredResult(_0x3a86e3,_0x286ca4){return function(_0x2c68fd){if(_0x2c68fd){var _0x498e5f=typeof _0x286ca4[_0x0188('0x1a')]===_0x0188('0x1b')&&typeof _0x286ca4[_0x0188('0x1c')]===_0x0188('0x1b');var _0x23ccb6=_0x2c68fd[_0x0188('0x1d')];var _0x3cf071=_0x498e5f?0x0:_0x286ca4['offset'];var _0x3dff3f=_0x498e5f?_0x2c68fd[_0x0188('0x1d')]:_0x286ca4[_0x0188('0x1a')]+_0x286ca4[_0x0188('0x1c')];var _0x575f2e;if(_0x3dff3f>=_0x23ccb6){_0x3dff3f=_0x23ccb6;_0x575f2e=0xc8;}else{_0x575f2e=0xce;}_0x3a86e3[_0x0188('0x17')](_0x575f2e);return _0x3a86e3[_0x0188('0x1e')](_0x0188('0x1f'),_0x3cf071+'-'+_0x3dff3f+'/'+_0x23ccb6)[_0x0188('0x19')](_0x2c68fd);}return null;};}function patchUpdates(_0x590d2c){return function(_0x9edb74){try{jsonpatch[_0x0188('0x20')](_0x9edb74,_0x590d2c,!![]);}catch(_0x3471da){return BPromise[_0x0188('0x21')](_0x3471da);}return _0x9edb74[_0x0188('0x22')]();};}function saveUpdates(_0x49c265,_0x202896){return function(_0x43b9b2){if(_0x43b9b2){return _0x43b9b2['update'](_0x49c265)[_0x0188('0x23')](function(_0x4824fa){return _0x4824fa;});}return null;};}function removeEntity(_0x67ace4,_0x8f00b4){return function(_0x256a64){if(_0x256a64){return _0x256a64[_0x0188('0x24')]()['then'](function(){_0x67ace4[_0x0188('0x17')](0xcc)[_0x0188('0x18')]();});}};}function handleEntityNotFound(_0x284828,_0x522fb3){return function(_0x3bc277){if(!_0x3bc277){_0x284828[_0x0188('0x25')](0x194);}return _0x3bc277;};}function handleError(_0x14f4e9,_0x15f0b8){_0x15f0b8=_0x15f0b8||0x1f4;return function(_0x55e8a3){logger[_0x0188('0x26')](_0x55e8a3[_0x0188('0x27')]);if(_0x55e8a3[_0x0188('0x28')]){delete _0x55e8a3[_0x0188('0x28')];}_0x14f4e9['status'](_0x15f0b8)[_0x0188('0x29')](_0x55e8a3);};}exports[_0x0188('0x2a')]=function(_0x324835,_0x1402e3){var _0x29d41b={},_0x519517={},_0x2eacf6={'count':0x0,'rows':[]};var _0x3633f7=_['map'](db[_0x0188('0x2b')][_0x0188('0x2c')],function(_0x1d118a){return{'name':_0x1d118a[_0x0188('0x2d')],'type':_0x1d118a[_0x0188('0x2e')][_0x0188('0x2f')]};});_0x519517['model']=_[_0x0188('0x30')](_0x3633f7,_0x0188('0x28'));_0x519517[_0x0188('0x31')]=_[_0x0188('0x32')](_0x324835[_0x0188('0x31')]);_0x519517[_0x0188('0x33')]=_[_0x0188('0x34')](_0x519517['model'],_0x519517[_0x0188('0x31')]);_0x29d41b['attributes']=_[_0x0188('0x34')](_0x519517[_0x0188('0x35')],qs['fields'](_0x324835[_0x0188('0x31')][_0x0188('0x36')]));_0x29d41b[_0x0188('0x37')]=_0x29d41b[_0x0188('0x37')][_0x0188('0x38')]?_0x29d41b[_0x0188('0x37')]:_0x519517[_0x0188('0x35')];if(!_0x324835[_0x0188('0x31')]['hasOwnProperty']('nolimit')){_0x29d41b[_0x0188('0x1c')]=qs['limit'](_0x324835['query'][_0x0188('0x1c')]);_0x29d41b['offset']=qs[_0x0188('0x1a')](_0x324835['query'][_0x0188('0x1a')]);}_0x29d41b['order']=qs[_0x0188('0x39')](_0x324835[_0x0188('0x31')]['sort']);_0x29d41b[_0x0188('0x3a')]=qs[_0x0188('0x33')](_[_0x0188('0x3b')](_0x324835[_0x0188('0x31')],_0x519517[_0x0188('0x33')]),_0x3633f7);if(_0x324835[_0x0188('0x31')][_0x0188('0x3c')]){_0x29d41b[_0x0188('0x3a')]=_[_0x0188('0x3d')](_0x29d41b[_0x0188('0x3a')],{'$or':_['map'](_0x3633f7,function(_0x3c18ad){if(_0x3c18ad[_0x0188('0x2e')]!=='VIRTUAL'){var _0x4722b7={};_0x4722b7[_0x3c18ad['name']]={'$like':'%'+_0x324835[_0x0188('0x31')][_0x0188('0x3c')]+'%'};return _0x4722b7;}})});}_0x29d41b=_['merge']({},_0x29d41b,_0x324835['options']);var _0x352258={'where':_0x29d41b[_0x0188('0x3a')]};return db[_0x0188('0x2b')][_0x0188('0x1d')](_0x352258)[_0x0188('0x23')](function(_0x1c1a5f){_0x2eacf6['count']=_0x1c1a5f;if(_0x324835['query']['includeAll']){_0x29d41b[_0x0188('0x3e')]=[{'all':!![]}];}return db[_0x0188('0x2b')]['findAll'](_0x29d41b);})[_0x0188('0x23')](function(_0x30f54b){_0x2eacf6['rows']=_0x30f54b;return _0x2eacf6;})[_0x0188('0x23')](respondWithFilteredResult(_0x1402e3,_0x29d41b))[_0x0188('0x3f')](handleError(_0x1402e3,null));};exports[_0x0188('0x40')]=function(_0x210b11,_0x15a400){var _0x3b93d1={'raw':!![],'where':{'id':_0x210b11[_0x0188('0x41')]['id']}},_0x3f95bf={};_0x3f95bf[_0x0188('0x35')]=_['keys'](db[_0x0188('0x2b')][_0x0188('0x2c')]);_0x3f95bf[_0x0188('0x31')]=_['keys'](_0x210b11['query']);_0x3f95bf[_0x0188('0x33')]=_[_0x0188('0x34')](_0x3f95bf[_0x0188('0x35')],_0x3f95bf[_0x0188('0x31')]);_0x3b93d1[_0x0188('0x37')]=_[_0x0188('0x34')](_0x3f95bf['model'],qs['fields'](_0x210b11[_0x0188('0x31')][_0x0188('0x36')]));_0x3b93d1['attributes']=_0x3b93d1[_0x0188('0x37')]['length']?_0x3b93d1[_0x0188('0x37')]:_0x3f95bf[_0x0188('0x35')];if(_0x210b11[_0x0188('0x31')]['includeAll']){_0x3b93d1[_0x0188('0x3e')]=[{'all':!![]}];}_0x3b93d1=_['merge']({},_0x3b93d1,_0x210b11[_0x0188('0x42')]);return db['MailSubstatus'][_0x0188('0x43')](_0x3b93d1)[_0x0188('0x23')](handleEntityNotFound(_0x15a400,null))['then'](respondWithResult(_0x15a400,null))[_0x0188('0x3f')](handleError(_0x15a400,null));};exports[_0x0188('0x44')]=function(_0x39b93b,_0x4914d8){return db['MailSubstatus']['create'](_0x39b93b[_0x0188('0x45')],{})[_0x0188('0x23')](respondWithResult(_0x4914d8,0xc9))['catch'](handleError(_0x4914d8,null));};exports[_0x0188('0x46')]=function(_0x1c8786,_0x699c6f){if(_0x1c8786[_0x0188('0x45')]['id']){delete _0x1c8786['body']['id'];}return db[_0x0188('0x2b')][_0x0188('0x43')]({'where':{'id':_0x1c8786[_0x0188('0x41')]['id']}})['then'](handleEntityNotFound(_0x699c6f,null))[_0x0188('0x23')](saveUpdates(_0x1c8786[_0x0188('0x45')],null))['then'](respondWithResult(_0x699c6f,null))[_0x0188('0x3f')](handleError(_0x699c6f,null));};exports[_0x0188('0x24')]=function(_0x525f01,_0x43973f){return db[_0x0188('0x2b')][_0x0188('0x43')]({'where':{'id':_0x525f01[_0x0188('0x41')]['id']}})[_0x0188('0x23')](handleEntityNotFound(_0x43973f,null))[_0x0188('0x23')](removeEntity(_0x43973f,null))[_0x0188('0x3f')](handleError(_0x43973f,null));};exports[_0x0188('0x47')]=function(_0x5f5b08,_0x39b52d){return db[_0x0188('0x2b')][_0x0188('0x47')]()[_0x0188('0x23')](respondWithResult(_0x39b52d,null))[_0x0188('0x3f')](handleError(_0x39b52d,null));}; \ No newline at end of file +var _0x0455=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','describe','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x13ecd6,_0x1d8f41){var _0x3b4a57=function(_0xd29830){while(--_0xd29830){_0x13ecd6['push'](_0x13ecd6['shift']());}};_0x3b4a57(++_0x1d8f41);}(_0x0455,0x86));var _0x5045=function(_0x17bb6d,_0x253364){_0x17bb6d=_0x17bb6d-0x0;var _0x5298b9=_0x0455[_0x17bb6d];return _0x5298b9;};'use strict';var emlformat=require(_0x5045('0x0'));var rimraf=require(_0x5045('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5045('0x2'));var rp=require('request-promise');var moment=require(_0x5045('0x3'));var BPromise=require(_0x5045('0x4'));var Mustache=require(_0x5045('0x5'));var util=require(_0x5045('0x6'));var path=require(_0x5045('0x7'));var sox=require(_0x5045('0x8'));var csv=require(_0x5045('0x9'));var ejs=require(_0x5045('0xa'));var fs=require('fs');var fs_extra=require(_0x5045('0xb'));var _=require(_0x5045('0xc'));var squel=require(_0x5045('0xd'));var crypto=require(_0x5045('0xe'));var jsforce=require(_0x5045('0xf'));var deskjs=require(_0x5045('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5045('0x11'));var Papa=require(_0x5045('0x12'));var Redis=require(_0x5045('0x13'));var authService=require(_0x5045('0x14'));var qs=require(_0x5045('0x15'));var as=require(_0x5045('0x16'));var hardwareService=require(_0x5045('0x17'));var logger=require(_0x5045('0x18'))('api');var utils=require(_0x5045('0x19'));var config=require(_0x5045('0x1a'));var licenseUtil=require(_0x5045('0x1b'));var db=require(_0x5045('0x1c'))['db'];function respondWithStatusCode(_0x28c066,_0x2cbfb7){_0x2cbfb7=_0x2cbfb7||0xcc;return function(_0x28a697){if(_0x28a697){return _0x28c066[_0x5045('0x1d')](_0x2cbfb7);}return _0x28c066[_0x5045('0x1e')](_0x2cbfb7)[_0x5045('0x1f')]();};}function respondWithResult(_0x5ed48b,_0x4f59ec){_0x4f59ec=_0x4f59ec||0xc8;return function(_0x11b975){if(_0x11b975){return _0x5ed48b['status'](_0x4f59ec)['json'](_0x11b975);}};}function respondWithFilteredResult(_0x3a1425,_0x4f4c65){return function(_0x3131cd){if(_0x3131cd){var _0x506b2c=typeof _0x4f4c65[_0x5045('0x20')]===_0x5045('0x21')&&typeof _0x4f4c65[_0x5045('0x22')]===_0x5045('0x21');var _0x469db2=_0x3131cd['count'];var _0x3b386c=_0x506b2c?0x0:_0x4f4c65[_0x5045('0x20')];var _0x4b4a89=_0x506b2c?_0x3131cd[_0x5045('0x23')]:_0x4f4c65[_0x5045('0x20')]+_0x4f4c65['limit'];var _0x5651e8;if(_0x4b4a89>=_0x469db2){_0x4b4a89=_0x469db2;_0x5651e8=0xc8;}else{_0x5651e8=0xce;}_0x3a1425[_0x5045('0x1e')](_0x5651e8);return _0x3a1425['set'](_0x5045('0x24'),_0x3b386c+'-'+_0x4b4a89+'/'+_0x469db2)[_0x5045('0x25')](_0x3131cd);}return null;};}function patchUpdates(_0x347916){return function(_0x5e4ab8){try{jsonpatch[_0x5045('0x26')](_0x5e4ab8,_0x347916,!![]);}catch(_0x40aa56){return BPromise[_0x5045('0x27')](_0x40aa56);}return _0x5e4ab8[_0x5045('0x28')]();};}function saveUpdates(_0x1d0917,_0x54b57f){return function(_0x230bfe){if(_0x230bfe){return _0x230bfe[_0x5045('0x29')](_0x1d0917)[_0x5045('0x2a')](function(_0x37bc52){return _0x37bc52;});}return null;};}function removeEntity(_0x425a30,_0x9dc649){return function(_0x1b7ab3){if(_0x1b7ab3){return _0x1b7ab3[_0x5045('0x2b')]()[_0x5045('0x2a')](function(){_0x425a30['status'](0xcc)[_0x5045('0x1f')]();});}};}function handleEntityNotFound(_0x33d086,_0x170616){return function(_0x410d7d){if(!_0x410d7d){_0x33d086[_0x5045('0x1d')](0x194);}return _0x410d7d;};}function handleError(_0x2908ad,_0x1d3ada){_0x1d3ada=_0x1d3ada||0x1f4;return function(_0x2a95f4){logger[_0x5045('0x2c')](_0x2a95f4[_0x5045('0x2d')]);if(_0x2a95f4['name']){delete _0x2a95f4[_0x5045('0x2e')];}_0x2908ad[_0x5045('0x1e')](_0x1d3ada)[_0x5045('0x2f')](_0x2a95f4);};}exports[_0x5045('0x30')]=function(_0x1efb7c,_0x37fac0){var _0x1b641c={},_0x2b5335={},_0x2a1608={'count':0x0,'rows':[]};var _0x367dc4=_[_0x5045('0x31')](db[_0x5045('0x32')][_0x5045('0x33')],function(_0x1711f7){return{'name':_0x1711f7[_0x5045('0x34')],'type':_0x1711f7[_0x5045('0x35')]['key']};});_0x2b5335[_0x5045('0x36')]=_['map'](_0x367dc4,_0x5045('0x2e'));_0x2b5335[_0x5045('0x37')]=_['keys'](_0x1efb7c[_0x5045('0x37')]);_0x2b5335[_0x5045('0x38')]=_[_0x5045('0x39')](_0x2b5335[_0x5045('0x36')],_0x2b5335[_0x5045('0x37')]);_0x1b641c[_0x5045('0x3a')]=_['intersection'](_0x2b5335['model'],qs[_0x5045('0x3b')](_0x1efb7c[_0x5045('0x37')][_0x5045('0x3b')]));_0x1b641c['attributes']=_0x1b641c[_0x5045('0x3a')][_0x5045('0x3c')]?_0x1b641c[_0x5045('0x3a')]:_0x2b5335[_0x5045('0x36')];if(!_0x1efb7c['query'][_0x5045('0x3d')](_0x5045('0x3e'))){_0x1b641c[_0x5045('0x22')]=qs['limit'](_0x1efb7c['query'][_0x5045('0x22')]);_0x1b641c[_0x5045('0x20')]=qs[_0x5045('0x20')](_0x1efb7c[_0x5045('0x37')]['offset']);}_0x1b641c['order']=qs['sort'](_0x1efb7c[_0x5045('0x37')][_0x5045('0x3f')]);_0x1b641c[_0x5045('0x40')]=qs[_0x5045('0x38')](_[_0x5045('0x41')](_0x1efb7c['query'],_0x2b5335[_0x5045('0x38')]),_0x367dc4);if(_0x1efb7c[_0x5045('0x37')][_0x5045('0x42')]){_0x1b641c[_0x5045('0x40')]=_[_0x5045('0x43')](_0x1b641c[_0x5045('0x40')],{'$or':_['map'](_0x367dc4,function(_0x1f7818){if(_0x1f7818[_0x5045('0x35')]!==_0x5045('0x44')){var _0x14547e={};_0x14547e[_0x1f7818[_0x5045('0x2e')]]={'$like':'%'+_0x1efb7c[_0x5045('0x37')][_0x5045('0x42')]+'%'};return _0x14547e;}})});}_0x1b641c=_[_0x5045('0x43')]({},_0x1b641c,_0x1efb7c[_0x5045('0x45')]);var _0x4f2016={'where':_0x1b641c[_0x5045('0x40')]};return db[_0x5045('0x32')]['count'](_0x4f2016)[_0x5045('0x2a')](function(_0x492bc3){_0x2a1608[_0x5045('0x23')]=_0x492bc3;if(_0x1efb7c[_0x5045('0x37')][_0x5045('0x46')]){_0x1b641c[_0x5045('0x47')]=[{'all':!![]}];}return db[_0x5045('0x32')][_0x5045('0x48')](_0x1b641c);})[_0x5045('0x2a')](function(_0x47228a){_0x2a1608['rows']=_0x47228a;return _0x2a1608;})[_0x5045('0x2a')](respondWithFilteredResult(_0x37fac0,_0x1b641c))[_0x5045('0x49')](handleError(_0x37fac0,null));};exports['show']=function(_0x478457,_0x25b67f){var _0x1cdf96={'raw':!![],'where':{'id':_0x478457[_0x5045('0x4a')]['id']}},_0x3cfb0d={};_0x3cfb0d[_0x5045('0x36')]=_[_0x5045('0x4b')](db[_0x5045('0x32')][_0x5045('0x33')]);_0x3cfb0d[_0x5045('0x37')]=_['keys'](_0x478457[_0x5045('0x37')]);_0x3cfb0d[_0x5045('0x38')]=_[_0x5045('0x39')](_0x3cfb0d[_0x5045('0x36')],_0x3cfb0d['query']);_0x1cdf96[_0x5045('0x3a')]=_['intersection'](_0x3cfb0d['model'],qs[_0x5045('0x3b')](_0x478457[_0x5045('0x37')][_0x5045('0x3b')]));_0x1cdf96['attributes']=_0x1cdf96[_0x5045('0x3a')][_0x5045('0x3c')]?_0x1cdf96[_0x5045('0x3a')]:_0x3cfb0d[_0x5045('0x36')];if(_0x478457[_0x5045('0x37')][_0x5045('0x46')]){_0x1cdf96[_0x5045('0x47')]=[{'all':!![]}];}_0x1cdf96=_['merge']({},_0x1cdf96,_0x478457[_0x5045('0x45')]);return db[_0x5045('0x32')][_0x5045('0x4c')](_0x1cdf96)[_0x5045('0x2a')](handleEntityNotFound(_0x25b67f,null))[_0x5045('0x2a')](respondWithResult(_0x25b67f,null))[_0x5045('0x49')](handleError(_0x25b67f,null));};exports[_0x5045('0x4d')]=function(_0x4fafc8,_0x258e5a){return db[_0x5045('0x32')][_0x5045('0x4d')](_0x4fafc8[_0x5045('0x4e')],{})['then'](respondWithResult(_0x258e5a,0xc9))['catch'](handleError(_0x258e5a,null));};exports[_0x5045('0x29')]=function(_0x3076ae,_0x22116b){if(_0x3076ae[_0x5045('0x4e')]['id']){delete _0x3076ae[_0x5045('0x4e')]['id'];}return db[_0x5045('0x32')][_0x5045('0x4c')]({'where':{'id':_0x3076ae[_0x5045('0x4a')]['id']}})[_0x5045('0x2a')](handleEntityNotFound(_0x22116b,null))[_0x5045('0x2a')](saveUpdates(_0x3076ae['body'],null))[_0x5045('0x2a')](respondWithResult(_0x22116b,null))['catch'](handleError(_0x22116b,null));};exports[_0x5045('0x2b')]=function(_0x1b7ec0,_0x37ec0f){return db['MailSubstatus'][_0x5045('0x4c')]({'where':{'id':_0x1b7ec0[_0x5045('0x4a')]['id']}})[_0x5045('0x2a')](handleEntityNotFound(_0x37ec0f,null))['then'](removeEntity(_0x37ec0f,null))['catch'](handleError(_0x37ec0f,null));};exports[_0x5045('0x4f')]=function(_0x30c0cb,_0x4d2bfe){return db[_0x5045('0x32')][_0x5045('0x4f')]()[_0x5045('0x2a')](respondWithResult(_0x4d2bfe,null))[_0x5045('0x49')](handleError(_0x4d2bfe,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 62cf599..89c5f2f 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 _0xa802=['exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2888a4,_0x1fc157){var _0x7f650c=function(_0x5e1880){while(--_0x5e1880){_0x2888a4['push'](_0x2888a4['shift']());}};_0x7f650c(++_0x1fc157);}(_0xa802,0xb0));var _0x2a80=function(_0xe10364,_0x4b5504){_0xe10364=_0xe10364-0x0;var _0xa04c9c=_0xa802[_0xe10364];return _0xa04c9c;};'use strict';var EventEmitter=require(_0x2a80('0x0'));var MailSubstatus=require(_0x2a80('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2a80('0x2')](0x0);var events={'afterUpdate':_0x2a80('0x3')};function emitEvent(_0x3b93ea){return function(_0x4b7531,_0x167d42,_0x57c4fb){MailSubstatusEvents['emit'](_0x3b93ea+':'+_0x4b7531['id'],_0x4b7531);MailSubstatusEvents[_0x2a80('0x4')](_0x3b93ea,_0x4b7531);_0x57c4fb(null);};}for(var e in events){if(events[_0x2a80('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x2a80('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x9e79=['emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','update'];(function(_0x526c9e,_0x4a4997){var _0x40cf31=function(_0x25e7d2){while(--_0x25e7d2){_0x526c9e['push'](_0x526c9e['shift']());}};_0x40cf31(++_0x4a4997);}(_0x9e79,0x1d8));var _0x99e7=function(_0x1dd577,_0x3f8604){_0x1dd577=_0x1dd577-0x0;var _0x4df4c4=_0x9e79[_0x1dd577];return _0x4df4c4;};'use strict';var EventEmitter=require(_0x99e7('0x0'));var MailSubstatus=require(_0x99e7('0x1'))['db'][_0x99e7('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x99e7('0x3')};function emitEvent(_0x234d14){return function(_0x3ed409,_0x4275b4,_0x4b8d06){MailSubstatusEvents[_0x99e7('0x4')](_0x234d14+':'+_0x3ed409['id'],_0x3ed409);MailSubstatusEvents[_0x99e7('0x4')](_0x234d14,_0x3ed409);_0x4b8d06(null);};}for(var e in events){if(events[_0x99e7('0x5')](e)){var event=events[e];MailSubstatus[_0x99e7('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 11cf072..18cef5f 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 _0xc8f8=['mail_substatuses','Condition','update','name','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define'];(function(_0x21f61a,_0x2bdcfc){var _0x413c32=function(_0x11a493){while(--_0x11a493){_0x21f61a['push'](_0x21f61a['shift']());}};_0x413c32(++_0x2bdcfc);}(_0xc8f8,0xf7));var _0x8c8f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xc8f8[_0x9cd4c3];return _0x4c9025;};'use strict';var attributes=require(_0x8c8f('0x0'));module['exports']=function(_0x22b8fe){var _0x528532=_0x22b8fe[_0x8c8f('0x1')];return _0x22b8fe[_0x8c8f('0x2')]('MailSubstatus',attributes,{'tableName':_0x8c8f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x424583,_0x459bee,_0x1907d3){return _0x528532[_0x8c8f('0x4')][_0x8c8f('0x5')]({'value':_0x424583[_0x8c8f('0x6')]},{'where':{'field':'mailSubstatus','value':_0x424583[_0x8c8f('0x7')][_0x8c8f('0x6')]}})[_0x8c8f('0x8')](function(){_0x1907d3();})[_0x8c8f('0x9')](function(_0x3f0186){_0x1907d3(_0x3f0186);});}}});}; \ No newline at end of file +var _0x414f=['define','MailSubstatus','mail_substatuses','Condition','name','_previousDataValues','then','./mailSubstatus.attributes'];(function(_0x52b3c9,_0x2bf3ae){var _0x36423d=function(_0x129862){while(--_0x129862){_0x52b3c9['push'](_0x52b3c9['shift']());}};_0x36423d(++_0x2bf3ae);}(_0x414f,0x13f));var _0xf414=function(_0x2a0c21,_0x51ad5e){_0x2a0c21=_0x2a0c21-0x0;var _0x28f2ff=_0x414f[_0x2a0c21];return _0x28f2ff;};'use strict';var attributes=require(_0xf414('0x0'));module['exports']=function(_0x1c0a15){var _0x4128e4=_0x1c0a15['models'];return _0x1c0a15[_0xf414('0x1')](_0xf414('0x2'),attributes,{'tableName':_0xf414('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x335d3e,_0x29b998,_0x22e5aa){return _0x4128e4[_0xf414('0x4')]['update']({'value':_0x335d3e[_0xf414('0x5')]},{'where':{'field':'mailSubstatus','value':_0x335d3e[_0xf414('0x6')][_0xf414('0x5')]}})[_0xf414('0x7')](function(){_0x22e5aa();})['catch'](function(_0x4e69bd){_0x22e5aa(_0x4e69bd);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 450af73..058d1b2 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 _0x7faa=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x285ce2,_0x4a05f4){var _0x1f9750=function(_0x2daf86){while(--_0x2daf86){_0x285ce2['push'](_0x285ce2['shift']());}};_0x1f9750(++_0x4a05f4);}(_0x7faa,0x156));var _0xa7fa=function(_0x392f1b,_0x164b99){_0x392f1b=_0x392f1b-0x0;var _0x4dfb58=_0x7faa[_0x392f1b];return _0x4dfb58;};'use strict';var _=require(_0xa7fa('0x0'));var util=require(_0xa7fa('0x1'));var moment=require(_0xa7fa('0x2'));var BPromise=require(_0xa7fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7fa('0x5'));var logger=require(_0xa7fa('0x6'))(_0xa7fa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5cf1,_0x4c3780,_0x3e24e8){return new BPromise(function(_0x166338,_0x262823){return client['request'](_0x1a5cf1,_0x3e24e8)[_0xa7fa('0x8')](function(_0x4fa044){logger[_0xa7fa('0x9')](_0xa7fa('0xa'),_0x4c3780,_0xa7fa('0xb'));logger[_0xa7fa('0xc')](_0xa7fa('0xd'),_0x4c3780,_0xa7fa('0xb'),JSON[_0xa7fa('0xe')](_0x4fa044));if(_0x4fa044[_0xa7fa('0xf')]){if(_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x10')]===0x1f4){logger[_0xa7fa('0xf')](_0xa7fa('0xa'),_0x4c3780,_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x11')]);return _0x262823(_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x11')]);}logger[_0xa7fa('0xf')](_0xa7fa('0xa'),_0x4c3780,_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x11')]);return _0x166338(_0x4fa044['error'][_0xa7fa('0x11')]);}else{logger[_0xa7fa('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x4c3780,_0xa7fa('0xb'));_0x166338(_0x4fa044[_0xa7fa('0x12')]['message']);}})[_0xa7fa('0x13')](function(_0x435200){logger[_0xa7fa('0xf')](_0xa7fa('0xa'),_0x4c3780,_0x435200);_0x262823(_0x435200);});});} \ No newline at end of file +var _0xf6af=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x14560c,_0x460e68){var _0x11bbd7=function(_0x123e40){while(--_0x123e40){_0x14560c['push'](_0x14560c['shift']());}};_0x11bbd7(++_0x460e68);}(_0xf6af,0xb0));var _0xff6a=function(_0x554940,_0x461456){_0x554940=_0x554940-0x0;var _0x3f03cf=_0xf6af[_0x554940];return _0x3f03cf;};'use strict';var _=require(_0xff6a('0x0'));var util=require('util');var moment=require(_0xff6a('0x1'));var BPromise=require(_0xff6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff6a('0x3'));var db=require(_0xff6a('0x4'))['db'];var utils=require(_0xff6a('0x5'));var logger=require(_0xff6a('0x6'))(_0xff6a('0x7'));var config=require(_0xff6a('0x8'));var jayson=require(_0xff6a('0x9'));var client=jayson[_0xff6a('0xa')][_0xff6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0374a,_0x4b933f,_0x2cbed0){return new BPromise(function(_0x401bf7,_0x2d3e7a){return client[_0xff6a('0xc')](_0xb0374a,_0x2cbed0)[_0xff6a('0xd')](function(_0x586bf9){logger[_0xff6a('0xe')](_0xff6a('0xf'),_0x4b933f,_0xff6a('0x10'));logger[_0xff6a('0x11')](_0xff6a('0x12'),_0x4b933f,'request\x20sent',JSON[_0xff6a('0x13')](_0x586bf9));if(_0x586bf9[_0xff6a('0x14')]){if(_0x586bf9['error'][_0xff6a('0x15')]===0x1f4){logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x586bf9[_0xff6a('0x14')]['message']);return _0x2d3e7a(_0x586bf9[_0xff6a('0x14')][_0xff6a('0x16')]);}logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x586bf9[_0xff6a('0x14')][_0xff6a('0x16')]);return _0x401bf7(_0x586bf9['error']['message']);}else{logger['info'](_0xff6a('0xf'),_0x4b933f,_0xff6a('0x10'));_0x401bf7(_0x586bf9[_0xff6a('0x17')][_0xff6a('0x16')]);}})[_0xff6a('0x18')](function(_0x4f77a9){logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x4f77a9);_0x2d3e7a(_0x4f77a9);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 36ed01f..5d72f61 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 _0xc155=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','path','express','Router'];(function(_0x234564,_0x2bb623){var _0x4af1ac=function(_0x1bba8a){while(--_0x1bba8a){_0x234564['push'](_0x234564['shift']());}};_0x4af1ac(++_0x2bb623);}(_0xc155,0xa4));var _0x5c15=function(_0x4bc20a,_0x5d3439){_0x4bc20a=_0x4bc20a-0x0;var _0x58ee79=_0xc155[_0x4bc20a];return _0x58ee79;};'use strict';var multer=require(_0x5c15('0x0'));var util=require('util');var path=require(_0x5c15('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c15('0x2'));var router=express[_0x5c15('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c15('0x4'));var interaction=require(_0x5c15('0x5'));var config=require(_0x5c15('0x6'));var controller=require(_0x5c15('0x7'));router[_0x5c15('0x8')]('/',auth[_0x5c15('0x9')](),controller[_0x5c15('0xa')]);router[_0x5c15('0x8')](_0x5c15('0xb'),auth[_0x5c15('0x9')](),controller[_0x5c15('0xc')]);router[_0x5c15('0x8')]('/:id',auth[_0x5c15('0x9')](),controller[_0x5c15('0xd')]);router[_0x5c15('0xe')]('/',auth[_0x5c15('0x9')](),controller[_0x5c15('0xf')]);router[_0x5c15('0x10')](_0x5c15('0x11'),auth[_0x5c15('0x9')](),controller[_0x5c15('0x12')]);router[_0x5c15('0x13')](_0x5c15('0x11'),auth[_0x5c15('0x9')](),controller['destroy']);module[_0x5c15('0x14')]=router; \ No newline at end of file +var _0x1ac7=['fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','get','/describe','describe','put','/:id','update','delete','exports','util','connect-timeout','Router'];(function(_0x357f96,_0xd87cae){var _0x7c1449=function(_0x4eae19){while(--_0x4eae19){_0x357f96['push'](_0x357f96['shift']());}};_0x7c1449(++_0xd87cae);}(_0x1ac7,0x9d));var _0x71ac=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x1ac7[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require('multer');var util=require(_0x71ac('0x0'));var path=require('path');var timeout=require(_0x71ac('0x1'));var express=require('express');var router=express[_0x71ac('0x2')]();var fs_extra=require(_0x71ac('0x3'));var auth=require(_0x71ac('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x71ac('0x5'));var controller=require(_0x71ac('0x6'));router['get']('/',auth[_0x71ac('0x7')](),controller['index']);router[_0x71ac('0x8')](_0x71ac('0x9'),auth['isAuthenticated'](),controller[_0x71ac('0xa')]);router[_0x71ac('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x71ac('0x7')](),controller['create']);router[_0x71ac('0xb')](_0x71ac('0xc'),auth[_0x71ac('0x7')](),controller[_0x71ac('0xd')]);router[_0x71ac('0xe')](_0x71ac('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x71ac('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index aa79cc0..f6b98e0 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x192028,_0x345ab3){_0x192028=_0x192028-0x0;var _0x56f85f=_0x9bde[_0x192028];return _0x56f85f;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xb43b,0x1b2));var _0xbb43=function(_0x430ad9,_0x49f145){_0x430ad9=_0x430ad9-0x0;var _0x5850ba=_0xb43b[_0x430ad9];return _0x5850ba;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index faf7356..f35072c 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 _0x91b4=['update','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','MailTransferReport','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject'];(function(_0x200d3f,_0x223401){var _0x581e51=function(_0x4e1816){while(--_0x4e1816){_0x200d3f['push'](_0x200d3f['shift']());}};_0x581e51(++_0x223401);}(_0x91b4,0x104));var _0x491b=function(_0x41d044,_0x39af7e){_0x41d044=_0x41d044-0x0;var _0x43da3=_0x91b4[_0x41d044];return _0x43da3;};'use strict';var emlformat=require(_0x491b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x491b('0x1'));var jsonpatch=require(_0x491b('0x2'));var rp=require(_0x491b('0x3'));var moment=require(_0x491b('0x4'));var BPromise=require(_0x491b('0x5'));var Mustache=require('mustache');var util=require(_0x491b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x491b('0x7'));var fs=require('fs');var fs_extra=require(_0x491b('0x8'));var _=require(_0x491b('0x9'));var squel=require('squel');var crypto=require(_0x491b('0xa'));var jsforce=require(_0x491b('0xb'));var deskjs=require(_0x491b('0xc'));var toCsv=require(_0x491b('0xd'));var querystring=require(_0x491b('0xe'));var Papa=require(_0x491b('0xf'));var Redis=require(_0x491b('0x10'));var authService=require(_0x491b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x491b('0x12'));var hardwareService=require(_0x491b('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x491b('0x14'));var db=require(_0x491b('0x15'))['db'];function respondWithStatusCode(_0x5e2595,_0xff415c){_0xff415c=_0xff415c||0xcc;return function(_0x2ed647){if(_0x2ed647){return _0x5e2595[_0x491b('0x16')](_0xff415c);}return _0x5e2595[_0x491b('0x17')](_0xff415c)[_0x491b('0x18')]();};}function respondWithResult(_0x34e91d,_0x2624de){_0x2624de=_0x2624de||0xc8;return function(_0x247316){if(_0x247316){return _0x34e91d['status'](_0x2624de)[_0x491b('0x19')](_0x247316);}};}function respondWithFilteredResult(_0x192b92,_0x8b5563){return function(_0x122b38){if(_0x122b38){var _0x233262=typeof _0x8b5563['offset']==='undefined'&&typeof _0x8b5563[_0x491b('0x1a')]===_0x491b('0x1b');var _0x417195=_0x122b38[_0x491b('0x1c')];var _0x3772b2=_0x233262?0x0:_0x8b5563['offset'];var _0x277f01=_0x233262?_0x122b38[_0x491b('0x1c')]:_0x8b5563[_0x491b('0x1d')]+_0x8b5563[_0x491b('0x1a')];var _0x4c0ace;if(_0x277f01>=_0x417195){_0x277f01=_0x417195;_0x4c0ace=0xc8;}else{_0x4c0ace=0xce;}_0x192b92[_0x491b('0x17')](_0x4c0ace);return _0x192b92[_0x491b('0x1e')]('Content-Range',_0x3772b2+'-'+_0x277f01+'/'+_0x417195)[_0x491b('0x19')](_0x122b38);}return null;};}function patchUpdates(_0x188aad){return function(_0x32d7a1){try{jsonpatch['apply'](_0x32d7a1,_0x188aad,!![]);}catch(_0x3d8338){return BPromise[_0x491b('0x1f')](_0x3d8338);}return _0x32d7a1['save']();};}function saveUpdates(_0x5212ef,_0xce31ee){return function(_0x1c4284){if(_0x1c4284){return _0x1c4284[_0x491b('0x20')](_0x5212ef)['then'](function(_0x8d1a05){return _0x8d1a05;});}return null;};}function removeEntity(_0x5ea92a,_0x1ca0b9){return function(_0x873aed){if(_0x873aed){return _0x873aed[_0x491b('0x21')]()[_0x491b('0x22')](function(){_0x5ea92a[_0x491b('0x17')](0xcc)[_0x491b('0x18')]();});}};}function handleEntityNotFound(_0x23ac9f,_0x194ba4){return function(_0x254616){if(!_0x254616){_0x23ac9f['sendStatus'](0x194);}return _0x254616;};}function handleError(_0x5bb1d0,_0x348690){_0x348690=_0x348690||0x1f4;return function(_0x5ba7db){logger[_0x491b('0x23')](_0x5ba7db[_0x491b('0x24')]);if(_0x5ba7db['name']){delete _0x5ba7db[_0x491b('0x25')];}_0x5bb1d0['status'](_0x348690)['send'](_0x5ba7db);};}exports[_0x491b('0x26')]=function(_0x2f9557,_0x111b72){var _0x1ca48b={},_0x49b32b={},_0x2b6cb5={'count':0x0,'rows':[]};var _0x4b2221=_['map'](db['MailTransferReport'][_0x491b('0x27')],function(_0x34722f){return{'name':_0x34722f[_0x491b('0x28')],'type':_0x34722f[_0x491b('0x29')][_0x491b('0x2a')]};});_0x49b32b['model']=_[_0x491b('0x2b')](_0x4b2221,_0x491b('0x25'));_0x49b32b[_0x491b('0x2c')]=_[_0x491b('0x2d')](_0x2f9557[_0x491b('0x2c')]);_0x49b32b[_0x491b('0x2e')]=_[_0x491b('0x2f')](_0x49b32b[_0x491b('0x30')],_0x49b32b[_0x491b('0x2c')]);_0x1ca48b[_0x491b('0x31')]=_[_0x491b('0x2f')](_0x49b32b['model'],qs[_0x491b('0x32')](_0x2f9557[_0x491b('0x2c')]['fields']));_0x1ca48b[_0x491b('0x31')]=_0x1ca48b[_0x491b('0x31')][_0x491b('0x33')]?_0x1ca48b[_0x491b('0x31')]:_0x49b32b[_0x491b('0x30')];if(!_0x2f9557[_0x491b('0x2c')]['hasOwnProperty'](_0x491b('0x34'))){_0x1ca48b[_0x491b('0x1a')]=qs[_0x491b('0x1a')](_0x2f9557[_0x491b('0x2c')]['limit']);_0x1ca48b[_0x491b('0x1d')]=qs[_0x491b('0x1d')](_0x2f9557[_0x491b('0x2c')]['offset']);}_0x1ca48b[_0x491b('0x35')]=qs['sort'](_0x2f9557['query'][_0x491b('0x36')]);_0x1ca48b['where']=qs[_0x491b('0x2e')](_[_0x491b('0x37')](_0x2f9557[_0x491b('0x2c')],_0x49b32b[_0x491b('0x2e')]),_0x4b2221);if(_0x2f9557['query'][_0x491b('0x38')]){_0x1ca48b[_0x491b('0x39')]=_[_0x491b('0x3a')](_0x1ca48b[_0x491b('0x39')],{'$or':_[_0x491b('0x2b')](_0x4b2221,function(_0x419063){if(_0x419063[_0x491b('0x29')]!==_0x491b('0x3b')){var _0x182aa9={};_0x182aa9[_0x419063[_0x491b('0x25')]]={'$like':'%'+_0x2f9557['query'][_0x491b('0x38')]+'%'};return _0x182aa9;}})});}_0x1ca48b=_[_0x491b('0x3a')]({},_0x1ca48b,_0x2f9557['options']);var _0x1e0b86={'where':_0x1ca48b[_0x491b('0x39')]};return db['MailTransferReport'][_0x491b('0x1c')](_0x1e0b86)[_0x491b('0x22')](function(_0x21c921){_0x2b6cb5['count']=_0x21c921;if(_0x2f9557[_0x491b('0x2c')][_0x491b('0x3c')]){_0x1ca48b[_0x491b('0x3d')]=[{'all':!![]}];}return db[_0x491b('0x3e')][_0x491b('0x3f')](_0x1ca48b);})[_0x491b('0x22')](function(_0x3bb7a7){_0x2b6cb5[_0x491b('0x40')]=_0x3bb7a7;return _0x2b6cb5;})[_0x491b('0x22')](respondWithFilteredResult(_0x111b72,_0x1ca48b))[_0x491b('0x41')](handleError(_0x111b72,null));};exports[_0x491b('0x42')]=function(_0x4c4914,_0x35d4b3){var _0x46ec9a={'raw':!![],'where':{'id':_0x4c4914['params']['id']}},_0xe765a1={};_0xe765a1[_0x491b('0x30')]=_[_0x491b('0x2d')](db[_0x491b('0x3e')][_0x491b('0x27')]);_0xe765a1[_0x491b('0x2c')]=_[_0x491b('0x2d')](_0x4c4914[_0x491b('0x2c')]);_0xe765a1['filters']=_['intersection'](_0xe765a1[_0x491b('0x30')],_0xe765a1[_0x491b('0x2c')]);_0x46ec9a[_0x491b('0x31')]=_[_0x491b('0x2f')](_0xe765a1[_0x491b('0x30')],qs[_0x491b('0x32')](_0x4c4914[_0x491b('0x2c')][_0x491b('0x32')]));_0x46ec9a['attributes']=_0x46ec9a['attributes'][_0x491b('0x33')]?_0x46ec9a['attributes']:_0xe765a1[_0x491b('0x30')];if(_0x4c4914[_0x491b('0x2c')][_0x491b('0x3c')]){_0x46ec9a[_0x491b('0x3d')]=[{'all':!![]}];}_0x46ec9a=_['merge']({},_0x46ec9a,_0x4c4914[_0x491b('0x43')]);return db['MailTransferReport'][_0x491b('0x44')](_0x46ec9a)[_0x491b('0x22')](handleEntityNotFound(_0x35d4b3,null))[_0x491b('0x22')](respondWithResult(_0x35d4b3,null))[_0x491b('0x41')](handleError(_0x35d4b3,null));};exports['create']=function(_0x554c16,_0x1a18d2){return db['MailTransferReport'][_0x491b('0x45')](_0x554c16[_0x491b('0x46')],{})[_0x491b('0x22')](respondWithResult(_0x1a18d2,0xc9))[_0x491b('0x41')](handleError(_0x1a18d2,null));};exports['update']=function(_0xb8d65,_0x3be0be){if(_0xb8d65['body']['id']){delete _0xb8d65['body']['id'];}return db[_0x491b('0x3e')][_0x491b('0x44')]({'where':{'id':_0xb8d65[_0x491b('0x47')]['id']}})[_0x491b('0x22')](handleEntityNotFound(_0x3be0be,null))[_0x491b('0x22')](saveUpdates(_0xb8d65[_0x491b('0x46')],null))[_0x491b('0x22')](respondWithResult(_0x3be0be,null))[_0x491b('0x41')](handleError(_0x3be0be,null));};exports[_0x491b('0x21')]=function(_0x183d39,_0x38ec72){return db[_0x491b('0x3e')][_0x491b('0x44')]({'where':{'id':_0x183d39[_0x491b('0x47')]['id']}})[_0x491b('0x22')](handleEntityNotFound(_0x38ec72,null))[_0x491b('0x22')](removeEntity(_0x38ec72,null))[_0x491b('0x41')](handleError(_0x38ec72,null));};exports[_0x491b('0x48')]=function(_0x32aaa1,_0x196fa0){return db['MailTransferReport'][_0x491b('0x48')]()[_0x491b('0x22')](respondWithResult(_0x196fa0,null))[_0x491b('0x41')](handleError(_0x196fa0,null));}; \ No newline at end of file +var _0xc5ef=['limit','count','set','json','apply','then','error','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x51ca76,_0x796be4){var _0x2cc7d5=function(_0x1c0faf){while(--_0x1c0faf){_0x51ca76['push'](_0x51ca76['shift']());}};_0x2cc7d5(++_0x796be4);}(_0xc5ef,0x75));var _0xfc5e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xc5ef[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc5e('0x0'));var zipdir=require(_0xfc5e('0x1'));var jsonpatch=require(_0xfc5e('0x2'));var rp=require('request-promise');var moment=require(_0xfc5e('0x3'));var BPromise=require(_0xfc5e('0x4'));var Mustache=require('mustache');var util=require(_0xfc5e('0x5'));var path=require(_0xfc5e('0x6'));var sox=require(_0xfc5e('0x7'));var csv=require(_0xfc5e('0x8'));var ejs=require(_0xfc5e('0x9'));var fs=require('fs');var fs_extra=require(_0xfc5e('0xa'));var _=require(_0xfc5e('0xb'));var squel=require(_0xfc5e('0xc'));var crypto=require(_0xfc5e('0xd'));var jsforce=require(_0xfc5e('0xe'));var deskjs=require(_0xfc5e('0xf'));var toCsv=require(_0xfc5e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfc5e('0x10'));var authService=require(_0xfc5e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc5e('0x12'))(_0xfc5e('0x13'));var utils=require(_0xfc5e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfc5e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x526e3f,_0x9bf93){_0x9bf93=_0x9bf93||0xcc;return function(_0xda46fe){if(_0xda46fe){return _0x526e3f[_0xfc5e('0x16')](_0x9bf93);}return _0x526e3f[_0xfc5e('0x17')](_0x9bf93)[_0xfc5e('0x18')]();};}function respondWithResult(_0x2a9ca2,_0x100d0b){_0x100d0b=_0x100d0b||0xc8;return function(_0x42804f){if(_0x42804f){return _0x2a9ca2[_0xfc5e('0x17')](_0x100d0b)['json'](_0x42804f);}};}function respondWithFilteredResult(_0x181cf1,_0x1b05b6){return function(_0x43dcdb){if(_0x43dcdb){var _0x5328c1=typeof _0x1b05b6[_0xfc5e('0x19')]===_0xfc5e('0x1a')&&typeof _0x1b05b6[_0xfc5e('0x1b')]===_0xfc5e('0x1a');var _0x37896e=_0x43dcdb[_0xfc5e('0x1c')];var _0x224bd5=_0x5328c1?0x0:_0x1b05b6[_0xfc5e('0x19')];var _0x26202d=_0x5328c1?_0x43dcdb['count']:_0x1b05b6[_0xfc5e('0x19')]+_0x1b05b6[_0xfc5e('0x1b')];var _0x2de8d2;if(_0x26202d>=_0x37896e){_0x26202d=_0x37896e;_0x2de8d2=0xc8;}else{_0x2de8d2=0xce;}_0x181cf1[_0xfc5e('0x17')](_0x2de8d2);return _0x181cf1[_0xfc5e('0x1d')]('Content-Range',_0x224bd5+'-'+_0x26202d+'/'+_0x37896e)[_0xfc5e('0x1e')](_0x43dcdb);}return null;};}function patchUpdates(_0x43e34c){return function(_0x3e2f31){try{jsonpatch[_0xfc5e('0x1f')](_0x3e2f31,_0x43e34c,!![]);}catch(_0x449eb6){return BPromise['reject'](_0x449eb6);}return _0x3e2f31['save']();};}function saveUpdates(_0x19a2b8,_0x20596f){return function(_0x4e97f6){if(_0x4e97f6){return _0x4e97f6['update'](_0x19a2b8)[_0xfc5e('0x20')](function(_0x3e3acf){return _0x3e3acf;});}return null;};}function removeEntity(_0x436cf1,_0xa5ee62){return function(_0x3dc703){if(_0x3dc703){return _0x3dc703['destroy']()['then'](function(){_0x436cf1['status'](0xcc)[_0xfc5e('0x18')]();});}};}function handleEntityNotFound(_0x1a5ef9,_0x534df5){return function(_0x1db3bb){if(!_0x1db3bb){_0x1a5ef9[_0xfc5e('0x16')](0x194);}return _0x1db3bb;};}function handleError(_0x52ad10,_0x53a9e4){_0x53a9e4=_0x53a9e4||0x1f4;return function(_0x57d3f0){logger[_0xfc5e('0x21')](_0x57d3f0['stack']);if(_0x57d3f0['name']){delete _0x57d3f0['name'];}_0x52ad10[_0xfc5e('0x17')](_0x53a9e4)[_0xfc5e('0x22')](_0x57d3f0);};}exports[_0xfc5e('0x23')]=function(_0x34dd16,_0x48e1a4){var _0x1aac69={},_0x2488f7={},_0x112b83={'count':0x0,'rows':[]};var _0x179b5a=_['map'](db[_0xfc5e('0x24')][_0xfc5e('0x25')],function(_0x34a1ca){return{'name':_0x34a1ca[_0xfc5e('0x26')],'type':_0x34a1ca[_0xfc5e('0x27')][_0xfc5e('0x28')]};});_0x2488f7[_0xfc5e('0x29')]=_[_0xfc5e('0x2a')](_0x179b5a,_0xfc5e('0x2b'));_0x2488f7[_0xfc5e('0x2c')]=_[_0xfc5e('0x2d')](_0x34dd16[_0xfc5e('0x2c')]);_0x2488f7['filters']=_[_0xfc5e('0x2e')](_0x2488f7[_0xfc5e('0x29')],_0x2488f7[_0xfc5e('0x2c')]);_0x1aac69[_0xfc5e('0x2f')]=_[_0xfc5e('0x2e')](_0x2488f7[_0xfc5e('0x29')],qs[_0xfc5e('0x30')](_0x34dd16[_0xfc5e('0x2c')][_0xfc5e('0x30')]));_0x1aac69['attributes']=_0x1aac69[_0xfc5e('0x2f')][_0xfc5e('0x31')]?_0x1aac69[_0xfc5e('0x2f')]:_0x2488f7[_0xfc5e('0x29')];if(!_0x34dd16[_0xfc5e('0x2c')]['hasOwnProperty'](_0xfc5e('0x32'))){_0x1aac69[_0xfc5e('0x1b')]=qs[_0xfc5e('0x1b')](_0x34dd16[_0xfc5e('0x2c')][_0xfc5e('0x1b')]);_0x1aac69['offset']=qs[_0xfc5e('0x19')](_0x34dd16[_0xfc5e('0x2c')][_0xfc5e('0x19')]);}_0x1aac69[_0xfc5e('0x33')]=qs[_0xfc5e('0x34')](_0x34dd16[_0xfc5e('0x2c')][_0xfc5e('0x34')]);_0x1aac69[_0xfc5e('0x35')]=qs[_0xfc5e('0x36')](_[_0xfc5e('0x37')](_0x34dd16['query'],_0x2488f7[_0xfc5e('0x36')]),_0x179b5a);if(_0x34dd16[_0xfc5e('0x2c')]['filter']){_0x1aac69['where']=_[_0xfc5e('0x38')](_0x1aac69[_0xfc5e('0x35')],{'$or':_['map'](_0x179b5a,function(_0x129757){if(_0x129757[_0xfc5e('0x27')]!==_0xfc5e('0x39')){var _0x63f2ab={};_0x63f2ab[_0x129757[_0xfc5e('0x2b')]]={'$like':'%'+_0x34dd16[_0xfc5e('0x2c')]['filter']+'%'};return _0x63f2ab;}})});}_0x1aac69=_[_0xfc5e('0x38')]({},_0x1aac69,_0x34dd16[_0xfc5e('0x3a')]);var _0x47051a={'where':_0x1aac69['where']};return db['MailTransferReport']['count'](_0x47051a)[_0xfc5e('0x20')](function(_0xdc6810){_0x112b83[_0xfc5e('0x1c')]=_0xdc6810;if(_0x34dd16[_0xfc5e('0x2c')]['includeAll']){_0x1aac69[_0xfc5e('0x3b')]=[{'all':!![]}];}return db[_0xfc5e('0x24')][_0xfc5e('0x3c')](_0x1aac69);})[_0xfc5e('0x20')](function(_0x238599){_0x112b83[_0xfc5e('0x3d')]=_0x238599;return _0x112b83;})[_0xfc5e('0x20')](respondWithFilteredResult(_0x48e1a4,_0x1aac69))[_0xfc5e('0x3e')](handleError(_0x48e1a4,null));};exports[_0xfc5e('0x3f')]=function(_0x596726,_0x533ebe){var _0x1927f1={'raw':!![],'where':{'id':_0x596726[_0xfc5e('0x40')]['id']}},_0x4a357a={};_0x4a357a[_0xfc5e('0x29')]=_[_0xfc5e('0x2d')](db['MailTransferReport'][_0xfc5e('0x25')]);_0x4a357a[_0xfc5e('0x2c')]=_[_0xfc5e('0x2d')](_0x596726[_0xfc5e('0x2c')]);_0x4a357a[_0xfc5e('0x36')]=_['intersection'](_0x4a357a[_0xfc5e('0x29')],_0x4a357a['query']);_0x1927f1['attributes']=_[_0xfc5e('0x2e')](_0x4a357a[_0xfc5e('0x29')],qs[_0xfc5e('0x30')](_0x596726[_0xfc5e('0x2c')][_0xfc5e('0x30')]));_0x1927f1[_0xfc5e('0x2f')]=_0x1927f1['attributes'][_0xfc5e('0x31')]?_0x1927f1[_0xfc5e('0x2f')]:_0x4a357a[_0xfc5e('0x29')];if(_0x596726[_0xfc5e('0x2c')][_0xfc5e('0x41')]){_0x1927f1[_0xfc5e('0x3b')]=[{'all':!![]}];}_0x1927f1=_[_0xfc5e('0x38')]({},_0x1927f1,_0x596726[_0xfc5e('0x3a')]);return db[_0xfc5e('0x24')][_0xfc5e('0x42')](_0x1927f1)['then'](handleEntityNotFound(_0x533ebe,null))[_0xfc5e('0x20')](respondWithResult(_0x533ebe,null))['catch'](handleError(_0x533ebe,null));};exports[_0xfc5e('0x43')]=function(_0x4690a4,_0x1dcbd2){return db[_0xfc5e('0x24')][_0xfc5e('0x43')](_0x4690a4['body'],{})[_0xfc5e('0x20')](respondWithResult(_0x1dcbd2,0xc9))[_0xfc5e('0x3e')](handleError(_0x1dcbd2,null));};exports[_0xfc5e('0x44')]=function(_0x2c904c,_0x54e6b5){if(_0x2c904c[_0xfc5e('0x45')]['id']){delete _0x2c904c[_0xfc5e('0x45')]['id'];}return db[_0xfc5e('0x24')][_0xfc5e('0x42')]({'where':{'id':_0x2c904c[_0xfc5e('0x40')]['id']}})['then'](handleEntityNotFound(_0x54e6b5,null))[_0xfc5e('0x20')](saveUpdates(_0x2c904c['body'],null))[_0xfc5e('0x20')](respondWithResult(_0x54e6b5,null))[_0xfc5e('0x3e')](handleError(_0x54e6b5,null));};exports[_0xfc5e('0x46')]=function(_0x3caa53,_0x2b6ed8){return db[_0xfc5e('0x24')][_0xfc5e('0x42')]({'where':{'id':_0x3caa53[_0xfc5e('0x40')]['id']}})[_0xfc5e('0x20')](handleEntityNotFound(_0x2b6ed8,null))[_0xfc5e('0x20')](removeEntity(_0x2b6ed8,null))['catch'](handleError(_0x2b6ed8,null));};exports['describe']=function(_0x54b461,_0x565f5e){return db['MailTransferReport'][_0xfc5e('0x47')]()[_0xfc5e('0x20')](respondWithResult(_0x565f5e,null))['catch'](handleError(_0x565f5e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e38fecd..8abc328 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 _0x10eb=['../../config/environment','define','MailTransferReport','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10eb,0x71));var _0xb10e=function(_0x5d3f8d,_0x2e5fef){_0x5d3f8d=_0x5d3f8d-0x0;var _0x3a3e38=_0x10eb[_0x5d3f8d];return _0x3a3e38;};'use strict';var _=require(_0xb10e('0x0'));var util=require('util');var logger=require(_0xb10e('0x1'))(_0xb10e('0x2'));var moment=require(_0xb10e('0x3'));var BPromise=require(_0xb10e('0x4'));var rp=require(_0xb10e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb10e('0x6'));var config=require(_0xb10e('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x2ffe69,_0x40decd){return _0x2ffe69[_0xb10e('0x8')](_0xb10e('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf483=['report_mail_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','MailTransferReport'];(function(_0x131bef,_0x5b262d){var _0x3d1f0d=function(_0x3e5fe2){while(--_0x3e5fe2){_0x131bef['push'](_0x131bef['shift']());}};_0x3d1f0d(++_0x5b262d);}(_0xf483,0xf2));var _0x3f48=function(_0x308408,_0x37d440){_0x308408=_0x308408-0x0;var _0x9dc073=_0xf483[_0x308408];return _0x9dc073;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var logger=require('../../config/logger')(_0x3f48('0x1'));var moment=require(_0x3f48('0x2'));var BPromise=require(_0x3f48('0x3'));var rp=require(_0x3f48('0x4'));var fs=require('fs');var path=require(_0x3f48('0x5'));var rimraf=require(_0x3f48('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1a3447,_0x16905e){return _0x1a3447['define'](_0x3f48('0x7'),attributes,{'tableName':_0x3f48('0x8'),'paranoid':![],'indexes':[{'name':_0x3f48('0x9'),'fields':[_0x3f48('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 193a951..cc7767f 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 _0x2a48=['stringify','error','result','message','catch','lodash','ioredis','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2aa3cf,_0x14f628){var _0x54f10c=function(_0x1de61e){while(--_0x1de61e){_0x2aa3cf['push'](_0x2aa3cf['shift']());}};_0x54f10c(++_0x14f628);}(_0x2a48,0x137));var _0x82a4=function(_0x3bc6da,_0x387879){_0x3bc6da=_0x3bc6da-0x0;var _0x1c9da=_0x2a48[_0x3bc6da];return _0x1c9da;};'use strict';var _=require(_0x82a4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82a4('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x82a4('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x82a4('0x3')][_0x82a4('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x1792a4,_0x3aa97b,_0x95f78e){return new BPromise(function(_0x232803,_0x4d7f7c){return client[_0x82a4('0x5')](_0x1792a4,_0x95f78e)[_0x82a4('0x6')](function(_0x55add8){logger[_0x82a4('0x7')](_0x82a4('0x8'),_0x3aa97b,_0x82a4('0x9'));logger[_0x82a4('0xa')](_0x82a4('0xb'),_0x3aa97b,_0x82a4('0x9'),JSON[_0x82a4('0xc')](_0x55add8));if(_0x55add8[_0x82a4('0xd')]){if(_0x55add8[_0x82a4('0xd')]['code']===0x1f4){logger[_0x82a4('0xd')](_0x82a4('0x8'),_0x3aa97b,_0x55add8['error']['message']);return _0x4d7f7c(_0x55add8['error']['message']);}logger[_0x82a4('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x3aa97b,_0x55add8[_0x82a4('0xd')]['message']);return _0x232803(_0x55add8['error']['message']);}else{logger[_0x82a4('0x7')](_0x82a4('0x8'),_0x3aa97b,'request\x20sent');_0x232803(_0x55add8[_0x82a4('0xe')][_0x82a4('0xf')]);}})[_0x82a4('0x10')](function(_0x1595e3){logger[_0x82a4('0xd')](_0x82a4('0x8'),_0x3aa97b,_0x1595e3);_0x4d7f7c(_0x1595e3);});});} \ No newline at end of file +var _0x7e85=['../../config/environment','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x7e85,0x166));var _0x57e8=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x7e85[_0x51ab83];return _0x14b6de;};'use strict';var _=require(_0x57e8('0x0'));var util=require(_0x57e8('0x1'));var moment=require(_0x57e8('0x2'));var BPromise=require(_0x57e8('0x3'));var rs=require(_0x57e8('0x4'));var fs=require('fs');var Redis=require(_0x57e8('0x5'));var db=require(_0x57e8('0x6'))['db'];var utils=require(_0x57e8('0x7'));var logger=require(_0x57e8('0x8'))(_0x57e8('0x9'));var config=require(_0x57e8('0xa'));var jayson=require(_0x57e8('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31923a,_0x492aac,_0x3b5af0){return new BPromise(function(_0x2942ad,_0x57286f){return client[_0x57e8('0xc')](_0x31923a,_0x3b5af0)[_0x57e8('0xd')](function(_0x49b112){logger[_0x57e8('0xe')](_0x57e8('0xf'),_0x492aac,'request\x20sent');logger[_0x57e8('0x10')](_0x57e8('0x11'),_0x492aac,'request\x20sent',JSON[_0x57e8('0x12')](_0x49b112));if(_0x49b112[_0x57e8('0x13')]){if(_0x49b112[_0x57e8('0x13')][_0x57e8('0x14')]===0x1f4){logger[_0x57e8('0x13')](_0x57e8('0xf'),_0x492aac,_0x49b112[_0x57e8('0x13')][_0x57e8('0x15')]);return _0x57286f(_0x49b112['error']['message']);}logger[_0x57e8('0x13')](_0x57e8('0xf'),_0x492aac,_0x49b112['error'][_0x57e8('0x15')]);return _0x2942ad(_0x49b112[_0x57e8('0x13')][_0x57e8('0x15')]);}else{logger['info'](_0x57e8('0xf'),_0x492aac,'request\x20sent');_0x2942ad(_0x49b112['result']['message']);}})[_0x57e8('0x16')](function(_0x3fbe37){logger['error'](_0x57e8('0xf'),_0x492aac,_0x3fbe37);_0x57286f(_0x3fbe37);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a44b5f1..7e96c0a 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 _0x8f0d=['isAuthenticated','/describe','/:id','show','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x8704c7,_0x4d78ac){var _0x19f81e=function(_0x18b63a){while(--_0x18b63a){_0x8704c7['push'](_0x8704c7['shift']());}};_0x19f81e(++_0x4d78ac);}(_0x8f0d,0x197));var _0xd8f0=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8f0d[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0xd8f0('0x0'));var util=require(_0xd8f0('0x1'));var path=require('path');var timeout=require(_0xd8f0('0x2'));var express=require(_0xd8f0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd8f0('0x4'));var interaction=require(_0xd8f0('0x5'));var config=require(_0xd8f0('0x6'));var controller=require(_0xd8f0('0x7'));router[_0xd8f0('0x8')]('/',auth[_0xd8f0('0x9')](),controller['index']);router[_0xd8f0('0x8')](_0xd8f0('0xa'),auth[_0xd8f0('0x9')](),controller['describe']);router[_0xd8f0('0x8')](_0xd8f0('0xb'),auth[_0xd8f0('0x9')](),controller[_0xd8f0('0xc')]);router['post']('/',auth[_0xd8f0('0x9')](),controller['create']);router[_0xd8f0('0xd')](_0xd8f0('0xb'),auth[_0xd8f0('0x9')](),controller['update']);router[_0xd8f0('0xe')](_0xd8f0('0xb'),auth[_0xd8f0('0x9')](),controller['destroy']);module[_0xd8f0('0xf')]=router; \ No newline at end of file +var _0x79f3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','describe','get','show','create','/:id','update','delete','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2f6968,_0x8e0db9){var _0x473ec8=function(_0x5df449){while(--_0x5df449){_0x2f6968['push'](_0x2f6968['shift']());}};_0x473ec8(++_0x8e0db9);}(_0x79f3,0x19c));var _0x379f=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x79f3[_0x26da89];return _0xc95b7b;};'use strict';var multer=require(_0x379f('0x0'));var util=require('util');var path=require(_0x379f('0x1'));var timeout=require(_0x379f('0x2'));var express=require(_0x379f('0x3'));var router=express[_0x379f('0x4')]();var fs_extra=require(_0x379f('0x5'));var auth=require(_0x379f('0x6'));var interaction=require(_0x379f('0x7'));var config=require(_0x379f('0x8'));var controller=require(_0x379f('0x9'));router['get']('/',auth[_0x379f('0xa')](),controller[_0x379f('0xb')]);router['get']('/describe',auth[_0x379f('0xa')](),controller[_0x379f('0xc')]);router[_0x379f('0xd')]('/:id',auth[_0x379f('0xa')](),controller[_0x379f('0xe')]);router['post']('/',auth[_0x379f('0xa')](),controller[_0x379f('0xf')]);router['put'](_0x379f('0x10'),auth['isAuthenticated'](),controller[_0x379f('0x11')]);router[_0x379f('0x12')](_0x379f('0x10'),auth[_0x379f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 58b313b..c1e3826 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 _0xeeb4=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','INTEGER','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeeb4,0x6d));var _0x4eeb=function(_0x3d11ed,_0x47a4b8){_0x3d11ed=_0x3d11ed-0x0;var _0xbbd56c=_0xeeb4[_0x3d11ed];return _0xbbd56c;};'use strict';var Sequelize=require(_0x4eeb('0x0'));var moment=require(_0x4eeb('0x1'));module['exports']={'channel':{'type':Sequelize[_0x4eeb('0x2')]},'membername':{'type':Sequelize[_0x4eeb('0x2')]},'interface':{'type':Sequelize[_0x4eeb('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x4eeb('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4eeb('0x4')],'set':function(_0x321164){var _0x34f7b4=moment(_0x321164);var _0x4f32bc=moment(this[_0x4eeb('0x5')]('enterAt'));var _0x39f17c=_0x34f7b4[_0x4eeb('0x6')](_0x4f32bc,_0x4eeb('0x7'));this[_0x4eeb('0x8')](_0x4eeb('0x9'),_0x321164);this[_0x4eeb('0x8')](_0x4eeb('0xa'),_0x39f17c>=0x0?_0x39f17c:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x4eeb('0xb')},'data2':{'type':Sequelize[_0x4eeb('0x2')],'comment':_0x4eeb('0xc')},'data3':{'type':Sequelize[_0x4eeb('0x2')],'comment':_0x4eeb('0xd')},'data4':{'type':Sequelize[_0x4eeb('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x4eeb('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x4eeb('0x2')]},'internal':{'type':Sequelize[_0x4eeb('0xe')]},'uniqueid':{'type':Sequelize[_0x4eeb('0x2')]}}; \ No newline at end of file +var _0xebaa=['exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','diff','seconds'];(function(_0x487815,_0x3b847b){var _0x4b8f7f=function(_0x17afa9){while(--_0x17afa9){_0x487815['push'](_0x487815['shift']());}};_0x4b8f7f(++_0x3b847b);}(_0xebaa,0x19b));var _0xaeba=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xebaa[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xaeba('0x0'));var moment=require(_0xaeba('0x1'));module['exports']={'channel':{'type':Sequelize[_0xaeba('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xaeba('0x2')]},'type':{'type':Sequelize[_0xaeba('0x2')],'defaultValue':_0xaeba('0x3'),'comment':_0xaeba('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xaeba('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x293c77){var _0x15e72d=moment(_0x293c77);var _0x1eeed0=moment(this['getDataValue'](_0xaeba('0x6')));var _0x2b9636=_0x15e72d[_0xaeba('0x7')](_0x1eeed0,_0xaeba('0x8'));this['setDataValue'](_0xaeba('0x9'),_0x293c77);this[_0xaeba('0xa')](_0xaeba('0xb'),_0x2b9636>=0x0?_0x2b9636:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xaeba('0xc')},'data2':{'type':Sequelize[_0xaeba('0x2')],'comment':_0xaeba('0xd')},'data3':{'type':Sequelize[_0xaeba('0x2')],'comment':_0xaeba('0xe')},'data4':{'type':Sequelize[_0xaeba('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xaeba('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xaeba('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xaeba('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 6d71826..c30de70 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 _0x34e8=['path','sox','to-csv','fs-extra','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/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x34e8,0x12c));var _0x834e=function(_0x197367,_0x2768a2){_0x197367=_0x197367-0x0;var _0x424ba2=_0x34e8[_0x197367];return _0x424ba2;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x5a2601,_0x3fd7d1){var _0x27ab50=function(_0x53f6ca){while(--_0x53f6ca){_0x5a2601['push'](_0x5a2601['shift']());}};_0x27ab50(++_0x3fd7d1);}(_0x008c,0x188));var _0xc008=function(_0x2271e5,_0x6ea709){_0x2271e5=_0x2271e5-0x0;var _0x5a054e=_0x008c[_0x2271e5];return _0x5a054e;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 0f4c923..ac82efa 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 _0xb288=['rimraf','../../config/environment','exports','define','report_member','membername','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x502329,_0x4bd4e2){var _0x16ef34=function(_0x138396){while(--_0x138396){_0x502329['push'](_0x502329['shift']());}};_0x16ef34(++_0x4bd4e2);}(_0xb288,0x1b3));var _0x8b28=function(_0x598e92,_0x544197){_0x598e92=_0x598e92-0x0;var _0x2b7ad4=_0xb288[_0x598e92];return _0x2b7ad4;};'use strict';var _=require(_0x8b28('0x0'));var util=require(_0x8b28('0x1'));var logger=require(_0x8b28('0x2'))('api');var moment=require(_0x8b28('0x3'));var BPromise=require(_0x8b28('0x4'));var rp=require(_0x8b28('0x5'));var fs=require('fs');var path=require(_0x8b28('0x6'));var rimraf=require(_0x8b28('0x7'));var config=require(_0x8b28('0x8'));var attributes=require('./memberReport.attributes');module[_0x8b28('0x9')]=function(_0x670c4e,_0x237d61){return _0x670c4e[_0x8b28('0xa')]('MemberReport',attributes,{'tableName':_0x8b28('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x8b28('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xde81=['exports','define','MemberReport','report_member','interface','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./memberReport.attributes'];(function(_0x4e369b,_0x2b126c){var _0x4af7d1=function(_0x127558){while(--_0x127558){_0x4e369b['push'](_0x4e369b['shift']());}};_0x4af7d1(++_0x2b126c);}(_0xde81,0x109));var _0x1de8=function(_0x53c586,_0x3e118e){_0x53c586=_0x53c586-0x0;var _0x485cbf=_0xde81[_0x53c586];return _0x485cbf;};'use strict';var _=require(_0x1de8('0x0'));var util=require(_0x1de8('0x1'));var logger=require(_0x1de8('0x2'))(_0x1de8('0x3'));var moment=require(_0x1de8('0x4'));var BPromise=require(_0x1de8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1de8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1de8('0x7'));module[_0x1de8('0x8')]=function(_0x42801a,_0x3ae723){return _0x42801a[_0x1de8('0x9')](_0x1de8('0xa'),attributes,{'tableName':_0x1de8('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x1de8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 74a380c..d1b9049 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 _0x8458=['where','attributes','limit','include','map','model','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetMemberReport','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8458,0x1a5));var _0x8845=function(_0x42dce1,_0x2402ec){_0x42dce1=_0x42dce1-0x0;var _0x9d8d5e=_0x8458[_0x42dce1];return _0x9d8d5e;};'use strict';var _=require(_0x8845('0x0'));var util=require('util');var moment=require(_0x8845('0x1'));var BPromise=require(_0x8845('0x2'));var rs=require(_0x8845('0x3'));var fs=require('fs');var Redis=require(_0x8845('0x4'));var db=require(_0x8845('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8845('0x6'))(_0x8845('0x7'));var config=require(_0x8845('0x8'));var jayson=require(_0x8845('0x9'));var client=jayson[_0x8845('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4099,_0x59d900,_0x2a91b4){return new BPromise(function(_0x3067d1,_0xd94398){return client['request'](_0x3c4099,_0x2a91b4)[_0x8845('0xb')](function(_0x33b0dc){logger['info'](_0x8845('0xc'),_0x59d900,_0x8845('0xd'));logger['debug'](_0x8845('0xe'),_0x59d900,_0x8845('0xd'),JSON[_0x8845('0xf')](_0x33b0dc));if(_0x33b0dc[_0x8845('0x10')]){if(_0x33b0dc[_0x8845('0x10')][_0x8845('0x11')]===0x1f4){logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x33b0dc[_0x8845('0x10')][_0x8845('0x12')]);return _0xd94398(_0x33b0dc[_0x8845('0x10')][_0x8845('0x12')]);}logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x33b0dc['error'][_0x8845('0x12')]);return _0x3067d1(_0x33b0dc[_0x8845('0x10')]['message']);}else{logger[_0x8845('0x13')](_0x8845('0xc'),_0x59d900,_0x8845('0xd'));_0x3067d1(_0x33b0dc['result']['message']);}})['catch'](function(_0x3c3864){logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x3c3864);_0xd94398(_0x3c3864);});});}exports[_0x8845('0x14')]=function(_0x10f1d5){var _0x27761f=this;return new Promise(function(_0x433170,_0x49c56a){return db['MemberReport']['findAll']({'raw':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5[_0x8845('0x15')][_0x8845('0x16')]===undefined?!![]:![]:!![],'where':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5['options'][_0x8845('0x17')]||null:null,'attributes':_0x10f1d5['options']?_0x10f1d5['options'][_0x8845('0x18')]||null:null,'limit':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5['options'][_0x8845('0x19')]||null:null,'include':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5['options'][_0x8845('0x1a')]?_[_0x8845('0x1b')](_0x10f1d5[_0x8845('0x15')][_0x8845('0x1a')],function(_0x4e48b1){return{'model':db[_0x4e48b1['model']],'as':_0x4e48b1['as'],'attributes':_0x4e48b1[_0x8845('0x18')],'include':_0x4e48b1[_0x8845('0x1a')]?_[_0x8845('0x1b')](_0x4e48b1[_0x8845('0x1a')],function(_0x3d2fca){return{'model':db[_0x3d2fca[_0x8845('0x1c')]],'as':_0x3d2fca['as'],'attributes':_0x3d2fca[_0x8845('0x18')],'include':_0x3d2fca[_0x8845('0x1a')]?_[_0x8845('0x1b')](_0x3d2fca[_0x8845('0x1a')],function(_0x3e1e6e){return{'model':db[_0x3e1e6e[_0x8845('0x1c')]],'as':_0x3e1e6e['as'],'attributes':_0x3e1e6e[_0x8845('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8845('0xb')](function(_0xe997a6){logger[_0x8845('0x13')](_0x8845('0x14'),_0x10f1d5);logger['debug']('GetMemberReport',_0x10f1d5,JSON[_0x8845('0xf')](_0xe997a6));_0x433170(_0xe997a6);})[_0x8845('0x1d')](function(_0x26cae2){logger[_0x8845('0x10')](_0x8845('0x14'),_0x26cae2[_0x8845('0x12')],_0x10f1d5);_0x49c56a(_0x27761f[_0x8845('0x10')](0x1f4,_0x26cae2['message']));});});};exports[_0x8845('0x1e')]=function(_0x3fa3f0){var _0x501362=this;return new Promise(function(_0x3e3fbe,_0x4de264){return db[_0x8845('0x1f')][_0x8845('0x20')](_0x3fa3f0[_0x8845('0x21')],{'raw':_0x3fa3f0[_0x8845('0x15')]?_0x3fa3f0[_0x8845('0x15')][_0x8845('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x519a35){logger[_0x8845('0x13')](_0x8845('0x1e'),_0x3fa3f0);logger['debug'](_0x8845('0x1e'),_0x3fa3f0,JSON[_0x8845('0xf')](_0x519a35));_0x3e3fbe(_0x519a35);})[_0x8845('0x1d')](function(_0x58a8c6){logger['error'](_0x8845('0x1e'),_0x58a8c6['message'],_0x3fa3f0);_0x4de264(_0x501362[_0x8845('0x10')](0x1f4,_0x58a8c6[_0x8845('0x12')]));});});};exports[_0x8845('0x22')]=function(_0x4a2ee0){var _0x367b8e=this;return new Promise(function(_0x28daab,_0x22a6e4){return db['MemberReport'][_0x8845('0x23')](_0x4a2ee0['body'],{'raw':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0[_0x8845('0x15')][_0x8845('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0[_0x8845('0x15')][_0x8845('0x17')]||null:null,'attributes':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0[_0x8845('0x15')]['attributes']||null:null,'limit':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0['options'][_0x8845('0x19')]||null:null})['then'](function(_0x146125){logger[_0x8845('0x13')]('UpdateMemberReport',_0x4a2ee0);logger[_0x8845('0x24')]('UpdateMemberReport',_0x4a2ee0,JSON[_0x8845('0xf')](_0x146125));_0x28daab(_0x146125);})[_0x8845('0x1d')](function(_0x24d5ce){logger[_0x8845('0x10')](_0x8845('0x22'),_0x24d5ce[_0x8845('0x12')],_0x4a2ee0);_0x22a6e4(_0x367b8e[_0x8845('0x10')](0x1f4,_0x24d5ce[_0x8845('0x12')]));});});}; \ No newline at end of file +var _0xb89c=['limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetMemberReport','findAll','options','where','attributes','include','map','model','then','catch','CreateMemberReport','create','body','raw','UpdateMemberReport','MemberReport','update'];(function(_0x594ee1,_0x119799){var _0x1b7c43=function(_0x5b0e22){while(--_0x5b0e22){_0x594ee1['push'](_0x594ee1['shift']());}};_0x1b7c43(++_0x119799);}(_0xb89c,0x198));var _0xcb89=function(_0x10ad3e,_0x38b5bc){_0x10ad3e=_0x10ad3e-0x0;var _0xbd1ad6=_0xb89c[_0x10ad3e];return _0xbd1ad6;};'use strict';var _=require(_0xcb89('0x0'));var util=require(_0xcb89('0x1'));var moment=require(_0xcb89('0x2'));var BPromise=require(_0xcb89('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb89('0x4'));var db=require(_0xcb89('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb89('0x6'))(_0xcb89('0x7'));var config=require(_0xcb89('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfde6d2,_0x32bbb7,_0x54e3cf){return new BPromise(function(_0xc7804d,_0x332699){return client['request'](_0xfde6d2,_0x54e3cf)['then'](function(_0x46aa90){logger['info'](_0xcb89('0xa'),_0x32bbb7,_0xcb89('0xb'));logger[_0xcb89('0xc')](_0xcb89('0xd'),_0x32bbb7,_0xcb89('0xb'),JSON[_0xcb89('0xe')](_0x46aa90));if(_0x46aa90['error']){if(_0x46aa90[_0xcb89('0xf')]['code']===0x1f4){logger[_0xcb89('0xf')](_0xcb89('0xa'),_0x32bbb7,_0x46aa90[_0xcb89('0xf')][_0xcb89('0x10')]);return _0x332699(_0x46aa90[_0xcb89('0xf')][_0xcb89('0x10')]);}logger[_0xcb89('0xf')]('MemberReport,\x20%s,\x20%s',_0x32bbb7,_0x46aa90[_0xcb89('0xf')][_0xcb89('0x10')]);return _0xc7804d(_0x46aa90['error'][_0xcb89('0x10')]);}else{logger[_0xcb89('0x11')](_0xcb89('0xa'),_0x32bbb7,'request\x20sent');_0xc7804d(_0x46aa90[_0xcb89('0x12')]['message']);}})['catch'](function(_0x356447){logger[_0xcb89('0xf')](_0xcb89('0xa'),_0x32bbb7,_0x356447);_0x332699(_0x356447);});});}exports[_0xcb89('0x13')]=function(_0x3ace69){var _0x37aece=this;return new Promise(function(_0x1d99bd,_0x12e608){return db['MemberReport'][_0xcb89('0x14')]({'raw':_0x3ace69[_0xcb89('0x15')]?_0x3ace69['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ace69[_0xcb89('0x15')]?_0x3ace69[_0xcb89('0x15')][_0xcb89('0x16')]||null:null,'attributes':_0x3ace69[_0xcb89('0x15')]?_0x3ace69[_0xcb89('0x15')][_0xcb89('0x17')]||null:null,'limit':_0x3ace69[_0xcb89('0x15')]?_0x3ace69[_0xcb89('0x15')]['limit']||null:null,'include':_0x3ace69[_0xcb89('0x15')]?_0x3ace69[_0xcb89('0x15')][_0xcb89('0x18')]?_[_0xcb89('0x19')](_0x3ace69['options'][_0xcb89('0x18')],function(_0x4e81e2){return{'model':db[_0x4e81e2[_0xcb89('0x1a')]],'as':_0x4e81e2['as'],'attributes':_0x4e81e2['attributes'],'include':_0x4e81e2[_0xcb89('0x18')]?_[_0xcb89('0x19')](_0x4e81e2[_0xcb89('0x18')],function(_0x52bed3){return{'model':db[_0x52bed3[_0xcb89('0x1a')]],'as':_0x52bed3['as'],'attributes':_0x52bed3[_0xcb89('0x17')],'include':_0x52bed3[_0xcb89('0x18')]?_[_0xcb89('0x19')](_0x52bed3[_0xcb89('0x18')],function(_0x8febfd){return{'model':db[_0x8febfd[_0xcb89('0x1a')]],'as':_0x8febfd['as'],'attributes':_0x8febfd[_0xcb89('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcb89('0x1b')](function(_0x52ec43){logger[_0xcb89('0x11')]('GetMemberReport',_0x3ace69);logger[_0xcb89('0xc')]('GetMemberReport',_0x3ace69,JSON['stringify'](_0x52ec43));_0x1d99bd(_0x52ec43);})[_0xcb89('0x1c')](function(_0x407daa){logger[_0xcb89('0xf')](_0xcb89('0x13'),_0x407daa[_0xcb89('0x10')],_0x3ace69);_0x12e608(_0x37aece[_0xcb89('0xf')](0x1f4,_0x407daa[_0xcb89('0x10')]));});});};exports[_0xcb89('0x1d')]=function(_0x1d545a){var _0x850eb1=this;return new Promise(function(_0x2b7808,_0x4e56f0){return db['MemberReport'][_0xcb89('0x1e')](_0x1d545a[_0xcb89('0x1f')],{'raw':_0x1d545a['options']?_0x1d545a[_0xcb89('0x15')][_0xcb89('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x29a087){logger[_0xcb89('0x11')](_0xcb89('0x1d'),_0x1d545a);logger['debug'](_0xcb89('0x1d'),_0x1d545a,JSON['stringify'](_0x29a087));_0x2b7808(_0x29a087);})['catch'](function(_0xd5790c){logger[_0xcb89('0xf')](_0xcb89('0x1d'),_0xd5790c['message'],_0x1d545a);_0x4e56f0(_0x850eb1[_0xcb89('0xf')](0x1f4,_0xd5790c[_0xcb89('0x10')]));});});};exports[_0xcb89('0x21')]=function(_0x55de7d){var _0x9108a8=this;return new Promise(function(_0xec5fd4,_0x4264d9){return db[_0xcb89('0x22')][_0xcb89('0x23')](_0x55de7d[_0xcb89('0x1f')],{'raw':_0x55de7d['options']?_0x55de7d[_0xcb89('0x15')][_0xcb89('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55de7d['options']?_0x55de7d[_0xcb89('0x15')][_0xcb89('0x16')]||null:null,'attributes':_0x55de7d[_0xcb89('0x15')]?_0x55de7d['options'][_0xcb89('0x17')]||null:null,'limit':_0x55de7d[_0xcb89('0x15')]?_0x55de7d[_0xcb89('0x15')][_0xcb89('0x24')]||null:null})[_0xcb89('0x1b')](function(_0x5b3162){logger['info'](_0xcb89('0x21'),_0x55de7d);logger[_0xcb89('0xc')](_0xcb89('0x21'),_0x55de7d,JSON[_0xcb89('0xe')](_0x5b3162));_0xec5fd4(_0x5b3162);})['catch'](function(_0x54128c){logger[_0xcb89('0xf')]('UpdateMemberReport',_0x54128c[_0xcb89('0x10')],_0x55de7d);_0x4264d9(_0x9108a8[_0xcb89('0xf')](0x1f4,_0x54128c[_0xcb89('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 07503ad..760c494 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 _0xe80e=['index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./migration.controller'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe80e,0x1d8));var _0xee80=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe80e[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xee80('0x0'));var util=require(_0xee80('0x1'));var path=require(_0xee80('0x2'));var timeout=require(_0xee80('0x3'));var express=require(_0xee80('0x4'));var router=express['Router']();var fs_extra=require(_0xee80('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee80('0x6'));var config=require('../../config/environment');var controller=require(_0xee80('0x7'));router['get']('/',controller[_0xee80('0x8')]);module[_0xee80('0x9')]=router; \ No newline at end of file +var _0x2dc3=['fs-extra','../../components/auth/service','../../components/interaction/service','get','exports','util','path','connect-timeout','express','Router'];(function(_0x3da849,_0x1eb712){var _0x119d63=function(_0x360e65){while(--_0x360e65){_0x3da849['push'](_0x3da849['shift']());}};_0x119d63(++_0x1eb712);}(_0x2dc3,0x127));var _0x32dc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2dc3[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x32dc('0x0'));var path=require(_0x32dc('0x1'));var timeout=require(_0x32dc('0x2'));var express=require(_0x32dc('0x3'));var router=express[_0x32dc('0x4')]();var fs_extra=require(_0x32dc('0x5'));var auth=require(_0x32dc('0x6'));var interaction=require(_0x32dc('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x32dc('0x8')]('/',controller['index']);module[_0x32dc('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0151079..afa62a5 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 _0x01a3=['STRING','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x01a3,0x1a1));var _0x301a=function(_0x274b16,_0x5d7ef1){_0x274b16=_0x274b16-0x0;var _0x32e340=_0x01a3[_0x274b16];return _0x32e340;};'use strict';var Sequelize=require('sequelize');module[_0x301a('0x0')]={'version':{'type':Sequelize[_0x301a('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x1f2f=['version','sequelize','STRING'];(function(_0x2179b0,_0x517dc4){var _0x2bdaea=function(_0xc1f85a){while(--_0xc1f85a){_0x2179b0['push'](_0x2179b0['shift']());}};_0x2bdaea(++_0x517dc4);}(_0x1f2f,0x97));var _0xf1f2=function(_0x3fa59c,_0x2302f9){_0x3fa59c=_0x3fa59c-0x0;var _0x239a2c=_0x1f2f[_0x3fa59c];return _0x239a2c;};'use strict';var Sequelize=require(_0xf1f2('0x0'));module['exports']={'version':{'type':Sequelize[_0xf1f2('0x1')],'unique':_0xf1f2('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2de875e..ca7058d 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 _0x34bf=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','Migration','rawAttributes','fieldName','type','key','keys','filters','model','attributes','intersection','fields','query','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x56a073,_0x4e18a0){var _0x5dbc06=function(_0x173091){while(--_0x173091){_0x56a073['push'](_0x56a073['shift']());}};_0x5dbc06(++_0x4e18a0);}(_0x34bf,0x188));var _0xf34b=function(_0xa861aa,_0x2895a4){_0xa861aa=_0xa861aa-0x0;var _0x1e34de=_0x34bf[_0xa861aa];return _0x1e34de;};'use strict';var emlformat=require(_0xf34b('0x0'));var rimraf=require(_0xf34b('0x1'));var zipdir=require(_0xf34b('0x2'));var jsonpatch=require(_0xf34b('0x3'));var rp=require(_0xf34b('0x4'));var moment=require(_0xf34b('0x5'));var BPromise=require(_0xf34b('0x6'));var Mustache=require(_0xf34b('0x7'));var util=require(_0xf34b('0x8'));var path=require(_0xf34b('0x9'));var sox=require(_0xf34b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf34b('0xb'));var _=require(_0xf34b('0xc'));var squel=require(_0xf34b('0xd'));var crypto=require(_0xf34b('0xe'));var jsforce=require(_0xf34b('0xf'));var deskjs=require(_0xf34b('0x10'));var toCsv=require(_0xf34b('0x11'));var querystring=require(_0xf34b('0x12'));var Papa=require('papaparse');var Redis=require(_0xf34b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf34b('0x14'));var logger=require(_0xf34b('0x15'))(_0xf34b('0x16'));var utils=require(_0xf34b('0x17'));var config=require(_0xf34b('0x18'));var licenseUtil=require(_0xf34b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36bbd8,_0x46d270){_0x46d270=_0x46d270||0xcc;return function(_0x44a0bf){if(_0x44a0bf){return _0x36bbd8[_0xf34b('0x1a')](_0x46d270);}return _0x36bbd8[_0xf34b('0x1b')](_0x46d270)['end']();};}function respondWithResult(_0x5a40bb,_0x148dde){_0x148dde=_0x148dde||0xc8;return function(_0x38657a){if(_0x38657a){return _0x5a40bb[_0xf34b('0x1b')](_0x148dde)[_0xf34b('0x1c')](_0x38657a);}};}function respondWithFilteredResult(_0x32a19a,_0x8d9694){return function(_0x3c28ce){if(_0x3c28ce){var _0x50511c=typeof _0x8d9694[_0xf34b('0x1d')]===_0xf34b('0x1e')&&typeof _0x8d9694[_0xf34b('0x1f')]===_0xf34b('0x1e');var _0x3bcbdf=_0x3c28ce[_0xf34b('0x20')];var _0x154674=_0x50511c?0x0:_0x8d9694[_0xf34b('0x1d')];var _0x5d6788=_0x50511c?_0x3c28ce[_0xf34b('0x20')]:_0x8d9694[_0xf34b('0x1d')]+_0x8d9694['limit'];var _0x252252;if(_0x5d6788>=_0x3bcbdf){_0x5d6788=_0x3bcbdf;_0x252252=0xc8;}else{_0x252252=0xce;}_0x32a19a[_0xf34b('0x1b')](_0x252252);return _0x32a19a[_0xf34b('0x21')](_0xf34b('0x22'),_0x154674+'-'+_0x5d6788+'/'+_0x3bcbdf)[_0xf34b('0x1c')](_0x3c28ce);}return null;};}function patchUpdates(_0x11bf80){return function(_0x193a2d){try{jsonpatch[_0xf34b('0x23')](_0x193a2d,_0x11bf80,!![]);}catch(_0x76d6da){return BPromise[_0xf34b('0x24')](_0x76d6da);}return _0x193a2d[_0xf34b('0x25')]();};}function saveUpdates(_0x4761d8,_0x97e92e){return function(_0x38d44d){if(_0x38d44d){return _0x38d44d[_0xf34b('0x26')](_0x4761d8)[_0xf34b('0x27')](function(_0x4e07db){return _0x4e07db;});}return null;};}function removeEntity(_0x4a937a,_0x31fa8d){return function(_0x41b8b1){if(_0x41b8b1){return _0x41b8b1[_0xf34b('0x28')]()[_0xf34b('0x27')](function(){_0x4a937a[_0xf34b('0x1b')](0xcc)[_0xf34b('0x29')]();});}};}function handleEntityNotFound(_0x5b9479,_0x3708ed){return function(_0x56a0f7){if(!_0x56a0f7){_0x5b9479[_0xf34b('0x1a')](0x194);}return _0x56a0f7;};}function handleError(_0x2cfd20,_0x1b7fc9){_0x1b7fc9=_0x1b7fc9||0x1f4;return function(_0x115f2a){logger[_0xf34b('0x2a')](_0x115f2a['stack']);if(_0x115f2a[_0xf34b('0x2b')]){delete _0x115f2a['name'];}_0x2cfd20[_0xf34b('0x1b')](_0x1b7fc9)[_0xf34b('0x2c')](_0x115f2a);};}exports['index']=function(_0x1e20da,_0x300b31){var _0x204700={},_0x58d925={},_0x1624f7={'count':0x0,'rows':[]};var _0x28084c=_[_0xf34b('0x2d')](db[_0xf34b('0x2e')][_0xf34b('0x2f')],function(_0x481149){return{'name':_0x481149[_0xf34b('0x30')],'type':_0x481149[_0xf34b('0x31')][_0xf34b('0x32')]};});_0x58d925['model']=_[_0xf34b('0x2d')](_0x28084c,_0xf34b('0x2b'));_0x58d925['query']=_[_0xf34b('0x33')](_0x1e20da['query']);_0x58d925[_0xf34b('0x34')]=_['intersection'](_0x58d925[_0xf34b('0x35')],_0x58d925['query']);_0x204700[_0xf34b('0x36')]=_[_0xf34b('0x37')](_0x58d925[_0xf34b('0x35')],qs[_0xf34b('0x38')](_0x1e20da[_0xf34b('0x39')][_0xf34b('0x38')]));_0x204700[_0xf34b('0x36')]=_0x204700[_0xf34b('0x36')][_0xf34b('0x3a')]?_0x204700['attributes']:_0x58d925[_0xf34b('0x35')];if(!_0x1e20da['query']['hasOwnProperty']('nolimit')){_0x204700[_0xf34b('0x1f')]=qs[_0xf34b('0x1f')](_0x1e20da[_0xf34b('0x39')]['limit']);_0x204700[_0xf34b('0x1d')]=qs[_0xf34b('0x1d')](_0x1e20da['query'][_0xf34b('0x1d')]);}_0x204700[_0xf34b('0x3b')]=qs[_0xf34b('0x3c')](_0x1e20da[_0xf34b('0x39')][_0xf34b('0x3c')]);_0x204700[_0xf34b('0x3d')]=qs[_0xf34b('0x34')](_[_0xf34b('0x3e')](_0x1e20da[_0xf34b('0x39')],_0x58d925[_0xf34b('0x34')]),_0x28084c);if(_0x1e20da[_0xf34b('0x39')][_0xf34b('0x3f')]){_0x204700[_0xf34b('0x3d')]=_[_0xf34b('0x40')](_0x204700['where'],{'$or':_[_0xf34b('0x2d')](_0x28084c,function(_0x1b5bc){if(_0x1b5bc['type']!=='VIRTUAL'){var _0x2bdf62={};_0x2bdf62[_0x1b5bc[_0xf34b('0x2b')]]={'$like':'%'+_0x1e20da['query'][_0xf34b('0x3f')]+'%'};return _0x2bdf62;}})});}_0x204700=_[_0xf34b('0x40')]({},_0x204700,_0x1e20da[_0xf34b('0x41')]);var _0x450b81={'where':_0x204700[_0xf34b('0x3d')]};return db[_0xf34b('0x2e')][_0xf34b('0x20')](_0x450b81)[_0xf34b('0x27')](function(_0x448f77){_0x1624f7[_0xf34b('0x20')]=_0x448f77;if(_0x1e20da[_0xf34b('0x39')][_0xf34b('0x42')]){_0x204700['include']=[{'all':!![]}];}return db[_0xf34b('0x2e')][_0xf34b('0x43')](_0x204700);})['then'](function(_0x5e777f){_0x1624f7[_0xf34b('0x44')]=_0x5e777f;return _0x1624f7;})[_0xf34b('0x27')](respondWithFilteredResult(_0x300b31,_0x204700))[_0xf34b('0x45')](handleError(_0x300b31,null));}; \ No newline at end of file +var _0x839e=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1a6513,_0x2a8ffe){var _0x3631fa=function(_0x4bdfba){while(--_0x4bdfba){_0x1a6513['push'](_0x1a6513['shift']());}};_0x3631fa(++_0x2a8ffe);}(_0x839e,0x143));var _0xe839=function(_0x46ee6b,_0x7f3e6c){_0x46ee6b=_0x46ee6b-0x0;var _0x97d54b=_0x839e[_0x46ee6b];return _0x97d54b;};'use strict';var emlformat=require(_0xe839('0x0'));var rimraf=require(_0xe839('0x1'));var zipdir=require(_0xe839('0x2'));var jsonpatch=require(_0xe839('0x3'));var rp=require(_0xe839('0x4'));var moment=require('moment');var BPromise=require(_0xe839('0x5'));var Mustache=require(_0xe839('0x6'));var util=require(_0xe839('0x7'));var path=require(_0xe839('0x8'));var sox=require(_0xe839('0x9'));var csv=require(_0xe839('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe839('0xb'));var squel=require(_0xe839('0xc'));var crypto=require(_0xe839('0xd'));var jsforce=require(_0xe839('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe839('0xa'));var querystring=require(_0xe839('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe839('0x10'));var qs=require(_0xe839('0x11'));var as=require(_0xe839('0x12'));var hardwareService=require(_0xe839('0x13'));var logger=require('../../config/logger')(_0xe839('0x14'));var utils=require(_0xe839('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe839('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13fd63,_0x2176c9){_0x2176c9=_0x2176c9||0xcc;return function(_0x13c38f){if(_0x13c38f){return _0x13fd63[_0xe839('0x17')](_0x2176c9);}return _0x13fd63['status'](_0x2176c9)[_0xe839('0x18')]();};}function respondWithResult(_0x28fa74,_0xb6e12){_0xb6e12=_0xb6e12||0xc8;return function(_0x5e0a2a){if(_0x5e0a2a){return _0x28fa74[_0xe839('0x19')](_0xb6e12)[_0xe839('0x1a')](_0x5e0a2a);}};}function respondWithFilteredResult(_0x1cf50d,_0x13e359){return function(_0x39ee55){if(_0x39ee55){var _0x60adc1=typeof _0x13e359['offset']===_0xe839('0x1b')&&typeof _0x13e359[_0xe839('0x1c')]===_0xe839('0x1b');var _0xc5470e=_0x39ee55[_0xe839('0x1d')];var _0x4834e9=_0x60adc1?0x0:_0x13e359[_0xe839('0x1e')];var _0x39066b=_0x60adc1?_0x39ee55[_0xe839('0x1d')]:_0x13e359[_0xe839('0x1e')]+_0x13e359[_0xe839('0x1c')];var _0x31b759;if(_0x39066b>=_0xc5470e){_0x39066b=_0xc5470e;_0x31b759=0xc8;}else{_0x31b759=0xce;}_0x1cf50d[_0xe839('0x19')](_0x31b759);return _0x1cf50d[_0xe839('0x1f')](_0xe839('0x20'),_0x4834e9+'-'+_0x39066b+'/'+_0xc5470e)[_0xe839('0x1a')](_0x39ee55);}return null;};}function patchUpdates(_0x20b7f6){return function(_0xeff736){try{jsonpatch[_0xe839('0x21')](_0xeff736,_0x20b7f6,!![]);}catch(_0x440e26){return BPromise[_0xe839('0x22')](_0x440e26);}return _0xeff736['save']();};}function saveUpdates(_0x4c04ba,_0xe8d0f0){return function(_0x41a5b5){if(_0x41a5b5){return _0x41a5b5[_0xe839('0x23')](_0x4c04ba)[_0xe839('0x24')](function(_0x5a9e2f){return _0x5a9e2f;});}return null;};}function removeEntity(_0x14ffb3,_0x189407){return function(_0x553338){if(_0x553338){return _0x553338[_0xe839('0x25')]()[_0xe839('0x24')](function(){_0x14ffb3['status'](0xcc)[_0xe839('0x18')]();});}};}function handleEntityNotFound(_0x393794,_0x31a7a6){return function(_0xe37558){if(!_0xe37558){_0x393794[_0xe839('0x17')](0x194);}return _0xe37558;};}function handleError(_0x37b50d,_0x313df9){_0x313df9=_0x313df9||0x1f4;return function(_0x1355f4){logger[_0xe839('0x26')](_0x1355f4['stack']);if(_0x1355f4[_0xe839('0x27')]){delete _0x1355f4[_0xe839('0x27')];}_0x37b50d[_0xe839('0x19')](_0x313df9)[_0xe839('0x28')](_0x1355f4);};}exports[_0xe839('0x29')]=function(_0x3403fc,_0x3312ab){var _0x4978cd={},_0x12fa60={},_0x320bec={'count':0x0,'rows':[]};var _0x1100de=_[_0xe839('0x2a')](db['Migration'][_0xe839('0x2b')],function(_0x25cbac){return{'name':_0x25cbac[_0xe839('0x2c')],'type':_0x25cbac[_0xe839('0x2d')][_0xe839('0x2e')]};});_0x12fa60[_0xe839('0x2f')]=_[_0xe839('0x2a')](_0x1100de,_0xe839('0x27'));_0x12fa60[_0xe839('0x30')]=_[_0xe839('0x31')](_0x3403fc[_0xe839('0x30')]);_0x12fa60['filters']=_[_0xe839('0x32')](_0x12fa60[_0xe839('0x2f')],_0x12fa60[_0xe839('0x30')]);_0x4978cd[_0xe839('0x33')]=_[_0xe839('0x32')](_0x12fa60['model'],qs[_0xe839('0x34')](_0x3403fc[_0xe839('0x30')][_0xe839('0x34')]));_0x4978cd[_0xe839('0x33')]=_0x4978cd['attributes'][_0xe839('0x35')]?_0x4978cd['attributes']:_0x12fa60[_0xe839('0x2f')];if(!_0x3403fc[_0xe839('0x30')][_0xe839('0x36')](_0xe839('0x37'))){_0x4978cd[_0xe839('0x1c')]=qs[_0xe839('0x1c')](_0x3403fc['query'][_0xe839('0x1c')]);_0x4978cd[_0xe839('0x1e')]=qs[_0xe839('0x1e')](_0x3403fc[_0xe839('0x30')]['offset']);}_0x4978cd[_0xe839('0x38')]=qs[_0xe839('0x39')](_0x3403fc[_0xe839('0x30')][_0xe839('0x39')]);_0x4978cd[_0xe839('0x3a')]=qs[_0xe839('0x3b')](_['pick'](_0x3403fc[_0xe839('0x30')],_0x12fa60['filters']),_0x1100de);if(_0x3403fc[_0xe839('0x30')][_0xe839('0x3c')]){_0x4978cd[_0xe839('0x3a')]=_[_0xe839('0x3d')](_0x4978cd[_0xe839('0x3a')],{'$or':_[_0xe839('0x2a')](_0x1100de,function(_0x2db84e){if(_0x2db84e[_0xe839('0x2d')]!==_0xe839('0x3e')){var _0x44c269={};_0x44c269[_0x2db84e[_0xe839('0x27')]]={'$like':'%'+_0x3403fc[_0xe839('0x30')][_0xe839('0x3c')]+'%'};return _0x44c269;}})});}_0x4978cd=_[_0xe839('0x3d')]({},_0x4978cd,_0x3403fc['options']);var _0x3f0afd={'where':_0x4978cd['where']};return db['Migration'][_0xe839('0x1d')](_0x3f0afd)['then'](function(_0x555ba4){_0x320bec[_0xe839('0x1d')]=_0x555ba4;if(_0x3403fc[_0xe839('0x30')][_0xe839('0x3f')]){_0x4978cd[_0xe839('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x4978cd);})[_0xe839('0x24')](function(_0x3a1570){_0x320bec[_0xe839('0x41')]=_0x3a1570;return _0x320bec;})[_0xe839('0x24')](respondWithFilteredResult(_0x3312ab,_0x4978cd))['catch'](handleError(_0x3312ab,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 157eef2..9a7c602 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 _0x6665=['Migration','migrations','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x782be4,_0x1d1934){var _0x44e515=function(_0x4a1823){while(--_0x4a1823){_0x782be4['push'](_0x782be4['shift']());}};_0x44e515(++_0x1d1934);}(_0x6665,0x120));var _0x5666=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x6665[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var util=require(_0x5666('0x0'));var logger=require(_0x5666('0x1'))(_0x5666('0x2'));var moment=require(_0x5666('0x3'));var BPromise=require('bluebird');var rp=require(_0x5666('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5666('0x5'));var config=require(_0x5666('0x6'));var attributes=require('./migration.attributes');module[_0x5666('0x7')]=function(_0x4bf177,_0x2d21b8){return _0x4bf177[_0x5666('0x8')](_0x5666('0x9'),attributes,{'tableName':_0x5666('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x043a=['api','bluebird','rimraf','../../config/environment','./migration.attributes','define','Migration','util'];(function(_0x1a1131,_0x404e25){var _0x2a73ee=function(_0x18690f){while(--_0x18690f){_0x1a1131['push'](_0x1a1131['shift']());}};_0x2a73ee(++_0x404e25);}(_0x043a,0x1c7));var _0xa043=function(_0x4a40d9,_0x5815f4){_0x4a40d9=_0x4a40d9-0x0;var _0x378369=_0x043a[_0x4a40d9];return _0x378369;};'use strict';var _=require('lodash');var util=require(_0xa043('0x0'));var logger=require('../../config/logger')(_0xa043('0x1'));var moment=require('moment');var BPromise=require(_0xa043('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa043('0x3'));var config=require(_0xa043('0x4'));var attributes=require(_0xa043('0x5'));module['exports']=function(_0x2eef31,_0x1d2b95){return _0x2eef31[_0xa043('0x6')](_0xa043('0x7'),attributes,{'tableName':'migrations','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 0d4ab7f..dc37c22 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 _0x2182=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x561528,_0x4dbb45){var _0x31456b=function(_0x35642e){while(--_0x35642e){_0x561528['push'](_0x561528['shift']());}};_0x31456b(++_0x4dbb45);}(_0x2182,0xea));var _0x2218=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2182[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var moment=require(_0x2218('0x2'));var BPromise=require(_0x2218('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2218('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2218('0x5'));var logger=require(_0x2218('0x6'))(_0x2218('0x7'));var config=require(_0x2218('0x8'));var jayson=require(_0x2218('0x9'));var client=jayson[_0x2218('0xa')][_0x2218('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22eab9,_0x142d1d,_0x29e762){return new BPromise(function(_0x4b3bd1,_0x1197d1){return client[_0x2218('0xc')](_0x22eab9,_0x29e762)[_0x2218('0xd')](function(_0x5bd041){logger['info'](_0x2218('0xe'),_0x142d1d,_0x2218('0xf'));logger[_0x2218('0x10')](_0x2218('0x11'),_0x142d1d,'request\x20sent',JSON[_0x2218('0x12')](_0x5bd041));if(_0x5bd041[_0x2218('0x13')]){if(_0x5bd041[_0x2218('0x13')][_0x2218('0x14')]===0x1f4){logger[_0x2218('0x13')]('Migration,\x20%s,\x20%s',_0x142d1d,_0x5bd041[_0x2218('0x13')]['message']);return _0x1197d1(_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);}logger[_0x2218('0x13')](_0x2218('0xe'),_0x142d1d,_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);return _0x4b3bd1(_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);}else{logger[_0x2218('0x16')](_0x2218('0xe'),_0x142d1d,_0x2218('0xf'));_0x4b3bd1(_0x5bd041[_0x2218('0x17')][_0x2218('0x15')]);}})[_0x2218('0x18')](function(_0x21a612){logger[_0x2218('0x13')](_0x2218('0xe'),_0x142d1d,_0x21a612);_0x1197d1(_0x21a612);});});} \ No newline at end of file +var _0x325b=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x214d1e,_0x5f5a4e){var _0x386124=function(_0x2696e1){while(--_0x2696e1){_0x214d1e['push'](_0x214d1e['shift']());}};_0x386124(++_0x5f5a4e);}(_0x325b,0x8b));var _0xb325=function(_0x29c3ad,_0x2decb3){_0x29c3ad=_0x29c3ad-0x0;var _0x22ea9d=_0x325b[_0x29c3ad];return _0x22ea9d;};'use strict';var _=require(_0xb325('0x0'));var util=require(_0xb325('0x1'));var moment=require(_0xb325('0x2'));var BPromise=require('bluebird');var rs=require(_0xb325('0x3'));var fs=require('fs');var Redis=require(_0xb325('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb325('0x5'))(_0xb325('0x6'));var config=require(_0xb325('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb325('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a241f,_0x22569c,_0x2fa16d){return new BPromise(function(_0xda4fa3,_0x170d60){return client[_0xb325('0x9')](_0x5a241f,_0x2fa16d)[_0xb325('0xa')](function(_0xb008cb){logger[_0xb325('0xb')](_0xb325('0xc'),_0x22569c,_0xb325('0xd'));logger[_0xb325('0xe')](_0xb325('0xf'),_0x22569c,_0xb325('0xd'),JSON[_0xb325('0x10')](_0xb008cb));if(_0xb008cb['error']){if(_0xb008cb[_0xb325('0x11')][_0xb325('0x12')]===0x1f4){logger[_0xb325('0x11')](_0xb325('0xc'),_0x22569c,_0xb008cb['error'][_0xb325('0x13')]);return _0x170d60(_0xb008cb[_0xb325('0x11')]['message']);}logger[_0xb325('0x11')](_0xb325('0xc'),_0x22569c,_0xb008cb[_0xb325('0x11')][_0xb325('0x13')]);return _0xda4fa3(_0xb008cb['error'][_0xb325('0x13')]);}else{logger[_0xb325('0xb')](_0xb325('0xc'),_0x22569c,_0xb325('0xd'));_0xda4fa3(_0xb008cb[_0xb325('0x14')][_0xb325('0x13')]);}})[_0xb325('0x15')](function(_0xa4e6c6){logger['error'](_0xb325('0xc'),_0x22569c,_0xa4e6c6);_0x170d60(_0xa4e6c6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index afc49af..1d391c8 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 _0xa49e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','put'];(function(_0x51ff81,_0x17b4ab){var _0x47dd46=function(_0x25537f){while(--_0x25537f){_0x51ff81['push'](_0x51ff81['shift']());}};_0x47dd46(++_0x17b4ab);}(_0xa49e,0x1de));var _0xea49=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xa49e[_0x44606e];return _0xe68388;};'use strict';var multer=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var path=require(_0xea49('0x2'));var timeout=require(_0xea49('0x3'));var express=require(_0xea49('0x4'));var router=express[_0xea49('0x5')]();var fs_extra=require(_0xea49('0x6'));var auth=require(_0xea49('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xea49('0x8'));var controller=require(_0xea49('0x9'));router[_0xea49('0xa')]('/',auth['isAuthenticated'](),controller[_0xea49('0xb')]);router[_0xea49('0xa')](_0xea49('0xc'),auth[_0xea49('0xd')](),controller[_0xea49('0xe')]);router['post']('/',auth[_0xea49('0xd')](),controller['create']);router[_0xea49('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xea49('0x10')](_0xea49('0xc'),auth[_0xea49('0xd')](),controller[_0xea49('0x11')]);module[_0xea49('0x12')]=router; \ No newline at end of file +var _0x13c5=['create','put','/:id','delete','exports','multer','../../components/auth/service','./network.controller','get','isAuthenticated','index','show','post'];(function(_0x45bc53,_0x537bb6){var _0x548fa6=function(_0x4d6615){while(--_0x4d6615){_0x45bc53['push'](_0x45bc53['shift']());}};_0x548fa6(++_0x537bb6);}(_0x13c5,0x7a));var _0x513c=function(_0x127e9f,_0x4aa7e6){_0x127e9f=_0x127e9f-0x0;var _0x25dc5f=_0x13c5[_0x127e9f];return _0x25dc5f;};'use strict';var multer=require(_0x513c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x513c('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x513c('0x2'));router[_0x513c('0x3')]('/',auth[_0x513c('0x4')](),controller[_0x513c('0x5')]);router['get']('/:id',auth[_0x513c('0x4')](),controller[_0x513c('0x6')]);router[_0x513c('0x7')]('/',auth[_0x513c('0x4')](),controller[_0x513c('0x8')]);router[_0x513c('0x9')](_0x513c('0xa'),auth[_0x513c('0x4')](),controller['update']);router[_0x513c('0xb')](_0x513c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x513c('0xc')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f00fa9b..9452464 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 _0x07dd=['localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x07dd,0x178));var _0xd07d=function(_0x319480,_0x17c055){_0x319480=_0x319480-0x0;var _0x51d66a=_0x07dd[_0x319480];return _0x51d66a;};'use strict';var Sequelize=require(_0xd07d('0x0'));module[_0xd07d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd07d('0x2'),_0xd07d('0x3'),_0xd07d('0x4'),_0xd07d('0x5'))},'value':{'type':Sequelize[_0xd07d('0x6')]},'username':{'type':Sequelize[_0xd07d('0x6')]},'password':{'type':Sequelize[_0xd07d('0x6')]}}; \ No newline at end of file +var _0xbed7=['turn','STRING','sequelize','exports','localnet','externip'];(function(_0x2f20f8,_0x54a3f2){var _0xfcb1b7=function(_0xfd0c0d){while(--_0xfd0c0d){_0x2f20f8['push'](_0x2f20f8['shift']());}};_0xfcb1b7(++_0x54a3f2);}(_0xbed7,0x158));var _0x7bed=function(_0x16bddc,_0x236fc2){_0x16bddc=_0x16bddc-0x0;var _0x7bee4b=_0xbed7[_0x16bddc];return _0x7bee4b;};'use strict';var Sequelize=require(_0x7bed('0x0'));module[_0x7bed('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7bed('0x2'),_0x7bed('0x3'),'stun',_0x7bed('0x4'))},'value':{'type':Sequelize[_0x7bed('0x5')]},'username':{'type':Sequelize[_0x7bed('0x5')]},'password':{'type':Sequelize[_0x7bed('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f229292..f1cca2a 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 _0x06f9=['result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','server/files/templates/stun_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','util','path','ejs','lodash','../../components/parsers/qs','api','jayson/promise','http','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x06f9,0xeb));var _0x906f=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x06f9[_0x1caf6a];return _0x1bf493;};'use strict';var util=require(_0x906f('0x0'));var path=require(_0x906f('0x1'));var ejs=require(_0x906f('0x2'));var fs=require('fs');var _=require(_0x906f('0x3'));var qs=require(_0x906f('0x4'));var logger=require('../../config/logger')(_0x906f('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x906f('0x6'));var client=jayson['client'][_0x906f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f4754,_0x1579ea,_0xdb6fc4,_0x4b5b7a){return new Promise(function(_0x20c138,_0x362200){var _0x5dc963=_0x4b5b7a||client;return _0x5dc963['request'](_0x4f4754,_0xdb6fc4)['then'](function(_0x10ba48){logger[_0x906f('0x8')](_0x906f('0x9'),_0x1579ea,_0x906f('0xa'));logger[_0x906f('0xb')](_0x906f('0xc'),_0x1579ea,_0x906f('0xa'),JSON[_0x906f('0xd')](_0x10ba48));if(_0x10ba48[_0x906f('0xe')]){if(_0x10ba48[_0x906f('0xe')][_0x906f('0xf')]===0x1f4){logger[_0x906f('0xe')](_0x906f('0x9'),_0x1579ea,_0x10ba48['error'][_0x906f('0x10')]);return _0x362200(_0x10ba48[_0x906f('0xe')]['message']);}logger[_0x906f('0xe')]('Network,\x20%s,\x20%s',_0x1579ea,_0x10ba48[_0x906f('0xe')][_0x906f('0x10')]);return _0x20c138(_0x10ba48[_0x906f('0xe')][_0x906f('0x10')]);}else{logger['info'](_0x906f('0x9'),_0x1579ea,_0x906f('0xa'));_0x20c138(_0x10ba48[_0x906f('0x11')]['message']);}})[_0x906f('0x12')](function(_0x3d97d9){logger[_0x906f('0xe')](_0x906f('0x9'),_0x1579ea,_0x3d97d9);_0x362200(_0x3d97d9);});});}function respondWithResult(_0x5ba5de,_0x1b6574){_0x1b6574=_0x1b6574||0xc8;return function(_0x37626e){if(_0x37626e){return _0x5ba5de['status'](_0x1b6574)[_0x906f('0x13')](_0x37626e);}};}function respondWithFilteredResult(_0x48f496,_0xdbe8e4){return function(_0x4d4bb2){if(_0x4d4bb2){var _0x459d15=typeof _0xdbe8e4[_0x906f('0x14')]===_0x906f('0x15')&&typeof _0xdbe8e4[_0x906f('0x16')]===_0x906f('0x15');var _0x359451=_0x4d4bb2[_0x906f('0x17')];var _0x108445=_0x459d15?0x0:_0xdbe8e4[_0x906f('0x14')];var _0x2f16ec=_0x459d15?_0x4d4bb2[_0x906f('0x17')]:_0xdbe8e4['offset']+_0xdbe8e4[_0x906f('0x16')];var _0x145133;if(_0x2f16ec>=_0x359451){_0x2f16ec=_0x359451;_0x145133=0xc8;}else{_0x145133=0xce;}_0x48f496[_0x906f('0x18')](_0x145133);return _0x48f496[_0x906f('0x19')](_0x906f('0x1a'),_0x108445+'-'+_0x2f16ec+'/'+_0x359451)['json'](_0x4d4bb2);}return null;};}function saveUpdates(_0x4e4d47){return function(_0x1902cd){if(_0x1902cd){return _0x1902cd[_0x906f('0x1b')](_0x4e4d47)['then'](function(_0x40ca97){return _0x40ca97;});}return null;};}function removeEntity(_0x160427){return function(_0x3dc458){if(_0x3dc458){return _0x3dc458[_0x906f('0x1c')]()[_0x906f('0x1d')](function(){_0x160427[_0x906f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154ef6){return function(_0x29c3eb){if(!_0x29c3eb){_0x154ef6[_0x906f('0x1e')](0x194);}return _0x29c3eb;};}function handleError(_0x9b580a,_0x5862ff){_0x5862ff=_0x5862ff||0x1f4;return function(_0x4ce871){logger[_0x906f('0xe')](_0x4ce871[_0x906f('0x1f')]);if(_0x4ce871[_0x906f('0x20')]){delete _0x4ce871['name'];}_0x9b580a['status'](_0x5862ff)[_0x906f('0x21')](_0x4ce871);};}exports[_0x906f('0x22')]=function(_0x4df8e1,_0x46ac65){var _0x2901ab={},_0x238ce2={},_0x44f3e6={'count':0x0,'rows':[]};var _0x4265aa=_[_0x906f('0x23')](db[_0x906f('0x24')][_0x906f('0x25')],function(_0x1a9632){return{'name':_0x1a9632['fieldName'],'type':_0x1a9632[_0x906f('0x26')][_0x906f('0x27')]};});_0x238ce2[_0x906f('0x28')]=_[_0x906f('0x23')](_0x4265aa,_0x906f('0x20'));_0x238ce2[_0x906f('0x29')]=_[_0x906f('0x2a')](_0x4df8e1[_0x906f('0x29')]);_0x238ce2[_0x906f('0x2b')]=_[_0x906f('0x2c')](_0x238ce2[_0x906f('0x28')],_0x238ce2['query']);_0x2901ab[_0x906f('0x2d')]=_[_0x906f('0x2c')](_0x238ce2[_0x906f('0x28')],qs[_0x906f('0x2e')](_0x4df8e1[_0x906f('0x29')][_0x906f('0x2e')]));_0x2901ab['attributes']=_0x2901ab[_0x906f('0x2d')][_0x906f('0x2f')]?_0x2901ab[_0x906f('0x2d')]:_0x238ce2[_0x906f('0x28')];if(!_0x4df8e1[_0x906f('0x29')][_0x906f('0x30')](_0x906f('0x31'))){_0x2901ab[_0x906f('0x16')]=qs[_0x906f('0x16')](_0x4df8e1[_0x906f('0x29')][_0x906f('0x16')]);_0x2901ab['offset']=qs[_0x906f('0x14')](_0x4df8e1[_0x906f('0x29')][_0x906f('0x14')]);}_0x2901ab['order']=qs['sort'](_0x4df8e1[_0x906f('0x29')]['sort']);_0x2901ab[_0x906f('0x32')]=qs[_0x906f('0x2b')](_[_0x906f('0x33')](_0x4df8e1['query'],_0x238ce2[_0x906f('0x2b')]),_0x4265aa);if(_0x4df8e1[_0x906f('0x29')]['filter']){_0x2901ab[_0x906f('0x32')]=_[_0x906f('0x34')](_0x2901ab[_0x906f('0x32')],{'$or':_['map'](_0x4265aa,function(_0x209a8b){if(_0x209a8b[_0x906f('0x26')]!=='VIRTUAL'){var _0x378fea={};_0x378fea[_0x209a8b[_0x906f('0x20')]]={'$like':'%'+_0x4df8e1['query'][_0x906f('0x35')]+'%'};return _0x378fea;}})});}_0x2901ab=_[_0x906f('0x34')]({},_0x2901ab,_0x4df8e1[_0x906f('0x36')]);var _0x527cb9={'where':_0x2901ab[_0x906f('0x32')]};return db[_0x906f('0x24')]['count'](_0x527cb9)[_0x906f('0x1d')](function(_0x2fa443){_0x44f3e6[_0x906f('0x17')]=_0x2fa443;if(_0x4df8e1[_0x906f('0x29')][_0x906f('0x37')]){_0x2901ab[_0x906f('0x38')]=[{'all':!![]}];}return db[_0x906f('0x24')][_0x906f('0x39')](_0x2901ab);})[_0x906f('0x1d')](function(_0x29ef38){_0x44f3e6[_0x906f('0x3a')]=_0x29ef38;return _0x44f3e6;})[_0x906f('0x1d')](respondWithFilteredResult(_0x46ac65,_0x2901ab))['catch'](handleError(_0x46ac65,null));};exports[_0x906f('0x3b')]=function(_0x4e03bc,_0x28f8e3){var _0x493907={'raw':!![],'where':{'id':_0x4e03bc[_0x906f('0x3c')]['id']}},_0x2aa718={};_0x2aa718[_0x906f('0x28')]=_[_0x906f('0x2a')](db[_0x906f('0x24')][_0x906f('0x25')]);_0x2aa718[_0x906f('0x29')]=_[_0x906f('0x2a')](_0x4e03bc[_0x906f('0x29')]);_0x2aa718[_0x906f('0x2b')]=_[_0x906f('0x2c')](_0x2aa718[_0x906f('0x28')],_0x2aa718[_0x906f('0x29')]);_0x493907[_0x906f('0x2d')]=_[_0x906f('0x2c')](_0x2aa718[_0x906f('0x28')],qs['fields'](_0x4e03bc[_0x906f('0x29')][_0x906f('0x2e')]));_0x493907[_0x906f('0x2d')]=_0x493907[_0x906f('0x2d')]['length']?_0x493907[_0x906f('0x2d')]:_0x2aa718[_0x906f('0x28')];if(_0x4e03bc['query'][_0x906f('0x37')]){_0x493907[_0x906f('0x38')]=[{'all':!![]}];}_0x493907=_[_0x906f('0x34')]({},_0x493907,_0x4e03bc[_0x906f('0x36')]);return db['Network']['find'](_0x493907)[_0x906f('0x1d')](handleEntityNotFound(_0x28f8e3,null))[_0x906f('0x1d')](respondWithResult(_0x28f8e3,null))[_0x906f('0x12')](handleError(_0x28f8e3,null));};exports[_0x906f('0x3d')]=function(_0x3d8faf,_0x5b0852){var _0x52e5f6;return db[_0x906f('0x24')][_0x906f('0x3d')](_0x3d8faf[_0x906f('0x3e')],{'raw':!![]})[_0x906f('0x1d')](function(_0x23c265){_0x52e5f6=_0x23c265;return db[_0x906f('0x24')]['findAll']({'where':{'type':_0x3d8faf[_0x906f('0x3e')][_0x906f('0x26')]},'raw':!![]});})[_0x906f('0x1d')](function(_0x5184c1){if(_0x52e5f6[_0x906f('0x26')][_0x906f('0x3f')]()==_0x906f('0x40')){var _0x4292bc=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],'server/files/templates/stun_multiple.ejs'),_0x906f('0x44'));var _0x1ff166=ejs['render'](_0x4292bc,{'networks':_0x5184c1||[]});fs[_0x906f('0x45')](_0x906f('0x46'),_0x1ff166);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x3d'),{'module':_0x906f('0x48')});}else if(_0x52e5f6['type'][_0x906f('0x3f')]()==_0x906f('0x49')){var _0x3ad1c3=fs['readFileSync'](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4a')),'utf8');var _0x1cb060=ejs[_0x906f('0x4b')](_0x3ad1c3,{'networks':_0x5184c1||[]});fs[_0x906f('0x45')](_0x906f('0x4c'),_0x1cb060);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x3d'),{'module':_0x906f('0x48')});}else{var _0x223b54=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4d')),'utf8');var _0x2d71dd=ejs[_0x906f('0x4b')](_0x223b54,{'networks':_0x5184c1||[]});fs[_0x906f('0x45')](util[_0x906f('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x3d8faf[_0x906f('0x3e')][_0x906f('0x26')]['toLowerCase']()),_0x2d71dd);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x3d'),{'module':'chan_sip.so'});}})[_0x906f('0x1d')](function(){return _0x52e5f6;})['then'](respondWithResult(_0x5b0852,0xc9))['catch'](handleError(_0x5b0852,null));};exports[_0x906f('0x1b')]=function(_0x34d3dd,_0x757eb5){var _0x561edc;return db['Network']['find']({'where':{'id':_0x34d3dd['params']['id']}})[_0x906f('0x1d')](handleEntityNotFound(_0x757eb5,null))[_0x906f('0x1d')](saveUpdates(_0x34d3dd[_0x906f('0x3e')],null))[_0x906f('0x1d')](function(_0x1ea984){if(_0x1ea984){_0x561edc=_0x1ea984;return db[_0x906f('0x24')][_0x906f('0x39')]({'where':{'type':_0x561edc[_0x906f('0x26')]},'raw':!![]});}return null;})[_0x906f('0x1d')](function(_0x27168f){if(_0x561edc[_0x906f('0x26')][_0x906f('0x3f')]()=='STUN'){var _0x591a6c=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4f')),_0x906f('0x44'));var _0x48d97b=ejs[_0x906f('0x4b')](_0x591a6c,{'networks':_0x27168f||[]});fs['writeFileSync'](_0x906f('0x46'),_0x48d97b);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x561edc['type'][_0x906f('0x3f')]()==_0x906f('0x49')){var _0x264f17=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4a')),_0x906f('0x44'));var _0x19a03a=ejs['render'](_0x264f17,{'networks':_0x27168f||[]});fs[_0x906f('0x45')]('/etc/asterisk/turn_xcally.conf',_0x19a03a);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x1b'),{'module':_0x906f('0x48')});}else{var _0x2b734e=fs['readFileSync'](path['join'](config[_0x906f('0x43')],_0x906f('0x4d')),_0x906f('0x44'));var _0x446dad=ejs[_0x906f('0x4b')](_0x2b734e,{'networks':_0x27168f||[]});fs[_0x906f('0x45')](util['format'](_0x906f('0x50'),_0x34d3dd[_0x906f('0x3e')]['type'][_0x906f('0x51')]()),_0x446dad);return respondWithRpcPromise(_0x906f('0x47'),'update',{'module':_0x906f('0x52')});}})[_0x906f('0x1d')](function(_0x40cfd6){if(_0x40cfd6){return _0x561edc;}return null;})[_0x906f('0x1d')](respondWithResult(_0x757eb5,null))[_0x906f('0x12')](handleError(_0x757eb5,null));};exports['destroy']=function(_0x3d85c6,_0x168f7a){var _0x5d1d2c;return db[_0x906f('0x24')][_0x906f('0x53')]({'where':{'id':_0x3d85c6[_0x906f('0x3c')]['id']}})['then'](function(_0x10856b){_0x5d1d2c=_0x10856b;return _0x10856b;})[_0x906f('0x1d')](handleEntityNotFound(_0x168f7a,null))[_0x906f('0x1d')](removeEntity(_0x168f7a,null))[_0x906f('0x1d')](function(){if(_0x5d1d2c){return db['Network']['findAll']({'where':{'type':_0x5d1d2c[_0x906f('0x26')]},'raw':!![]});}})[_0x906f('0x1d')](function(_0x1faf21){if(_0x5d1d2c['type'][_0x906f('0x3f')]()==_0x906f('0x40')){var _0x1881c9=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],'server/files/templates/stun_multiple.ejs'),_0x906f('0x44'));var _0x1d85cb=ejs['render'](_0x1881c9,{'networks':_0x1faf21||[]});fs[_0x906f('0x45')](_0x906f('0x46'),_0x1d85cb);return respondWithRpcPromise(_0x906f('0x47'),'destroy',{'module':_0x906f('0x48')});}else if(_0x5d1d2c['type'][_0x906f('0x3f')]()==_0x906f('0x49')){var _0x5a23f4=fs[_0x906f('0x41')](path[_0x906f('0x42')](config['root'],_0x906f('0x4a')),_0x906f('0x44'));var _0x50f1a3=ejs['render'](_0x5a23f4,{'networks':_0x1faf21||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x50f1a3);return respondWithRpcPromise(_0x906f('0x47'),'destroy',{'module':_0x906f('0x48')});}else{var _0x27be7e=fs[_0x906f('0x41')](path[_0x906f('0x42')](config['root'],_0x906f('0x4d')),_0x906f('0x44'));var _0x575ad3=ejs[_0x906f('0x4b')](_0x27be7e,{'networks':_0x1faf21||[]});fs[_0x906f('0x45')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x5d1d2c[_0x906f('0x26')][_0x906f('0x51')]()),_0x575ad3);return respondWithRpcPromise('Reload',_0x906f('0x1c'),{'module':'chan_sip.so'});}})[_0x906f('0x12')](handleError(_0x168f7a,null));}; \ No newline at end of file +var _0x152c=['create','body','findAll','toUpperCase','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','res_stun_monitor.so','readFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','util','path','ejs','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','show','params','include','find'];(function(_0x9b7e72,_0x11c503){var _0x238e3b=function(_0x59ec45){while(--_0x59ec45){_0x9b7e72['push'](_0x9b7e72['shift']());}};_0x238e3b(++_0x11c503);}(_0x152c,0x166));var _0xc152=function(_0x59c5a1,_0x239bfa){_0x59c5a1=_0x59c5a1-0x0;var _0x17170f=_0x152c[_0x59c5a1];return _0x17170f;};'use strict';var util=require(_0xc152('0x0'));var path=require(_0xc152('0x1'));var ejs=require(_0xc152('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xc152('0x3'));var logger=require(_0xc152('0x4'))('api');var config=require(_0xc152('0x5'));var db=require(_0xc152('0x6'))['db'];var jayson=require(_0xc152('0x7'));var client=jayson['client'][_0xc152('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3db208,_0x4f2d89,_0x2dab80,_0x4f237f){return new Promise(function(_0x2e9527,_0x4790ab){var _0x3dc36a=_0x4f237f||client;return _0x3dc36a[_0xc152('0x9')](_0x3db208,_0x2dab80)['then'](function(_0x5b64b5){logger[_0xc152('0xa')](_0xc152('0xb'),_0x4f2d89,_0xc152('0xc'));logger[_0xc152('0xd')](_0xc152('0xe'),_0x4f2d89,_0xc152('0xc'),JSON['stringify'](_0x5b64b5));if(_0x5b64b5['error']){if(_0x5b64b5[_0xc152('0xf')][_0xc152('0x10')]===0x1f4){logger[_0xc152('0xf')](_0xc152('0xb'),_0x4f2d89,_0x5b64b5['error'][_0xc152('0x11')]);return _0x4790ab(_0x5b64b5[_0xc152('0xf')][_0xc152('0x11')]);}logger['error']('Network,\x20%s,\x20%s',_0x4f2d89,_0x5b64b5['error'][_0xc152('0x11')]);return _0x2e9527(_0x5b64b5[_0xc152('0xf')][_0xc152('0x11')]);}else{logger[_0xc152('0xa')](_0xc152('0xb'),_0x4f2d89,'request\x20sent');_0x2e9527(_0x5b64b5[_0xc152('0x12')][_0xc152('0x11')]);}})['catch'](function(_0x380753){logger['error']('Network,\x20%s,\x20%s',_0x4f2d89,_0x380753);_0x4790ab(_0x380753);});});}function respondWithResult(_0x4f02c0,_0x3b8378){_0x3b8378=_0x3b8378||0xc8;return function(_0x3e3f89){if(_0x3e3f89){return _0x4f02c0[_0xc152('0x13')](_0x3b8378)[_0xc152('0x14')](_0x3e3f89);}};}function respondWithFilteredResult(_0x5cfd61,_0xd176ab){return function(_0x37cef3){if(_0x37cef3){var _0x5719cf=typeof _0xd176ab[_0xc152('0x15')]===_0xc152('0x16')&&typeof _0xd176ab[_0xc152('0x17')]===_0xc152('0x16');var _0x3dcd19=_0x37cef3[_0xc152('0x18')];var _0x5262a1=_0x5719cf?0x0:_0xd176ab['offset'];var _0x2f3180=_0x5719cf?_0x37cef3[_0xc152('0x18')]:_0xd176ab[_0xc152('0x15')]+_0xd176ab['limit'];var _0x295ac9;if(_0x2f3180>=_0x3dcd19){_0x2f3180=_0x3dcd19;_0x295ac9=0xc8;}else{_0x295ac9=0xce;}_0x5cfd61['status'](_0x295ac9);return _0x5cfd61['set'](_0xc152('0x19'),_0x5262a1+'-'+_0x2f3180+'/'+_0x3dcd19)[_0xc152('0x14')](_0x37cef3);}return null;};}function saveUpdates(_0x1ed119){return function(_0x58ed2a){if(_0x58ed2a){return _0x58ed2a[_0xc152('0x1a')](_0x1ed119)[_0xc152('0x1b')](function(_0x47ee68){return _0x47ee68;});}return null;};}function removeEntity(_0x3bb188){return function(_0xbe4297){if(_0xbe4297){return _0xbe4297[_0xc152('0x1c')]()[_0xc152('0x1b')](function(){_0x3bb188[_0xc152('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300727){return function(_0x42d72f){if(!_0x42d72f){_0x300727[_0xc152('0x1d')](0x194);}return _0x42d72f;};}function handleError(_0x3b0f81,_0x471f86){_0x471f86=_0x471f86||0x1f4;return function(_0x5a82be){logger[_0xc152('0xf')](_0x5a82be[_0xc152('0x1e')]);if(_0x5a82be[_0xc152('0x1f')]){delete _0x5a82be[_0xc152('0x1f')];}_0x3b0f81[_0xc152('0x13')](_0x471f86)['send'](_0x5a82be);};}exports[_0xc152('0x20')]=function(_0x14ac1,_0xb4d9b7){var _0x3d006b={},_0x2105f4={},_0x220c5a={'count':0x0,'rows':[]};var _0x52e119=_[_0xc152('0x21')](db[_0xc152('0x22')][_0xc152('0x23')],function(_0x4b3e98){return{'name':_0x4b3e98[_0xc152('0x24')],'type':_0x4b3e98[_0xc152('0x25')][_0xc152('0x26')]};});_0x2105f4[_0xc152('0x27')]=_[_0xc152('0x21')](_0x52e119,'name');_0x2105f4[_0xc152('0x28')]=_[_0xc152('0x29')](_0x14ac1['query']);_0x2105f4[_0xc152('0x2a')]=_[_0xc152('0x2b')](_0x2105f4[_0xc152('0x27')],_0x2105f4['query']);_0x3d006b['attributes']=_['intersection'](_0x2105f4[_0xc152('0x27')],qs[_0xc152('0x2c')](_0x14ac1[_0xc152('0x28')][_0xc152('0x2c')]));_0x3d006b['attributes']=_0x3d006b['attributes'][_0xc152('0x2d')]?_0x3d006b[_0xc152('0x2e')]:_0x2105f4['model'];if(!_0x14ac1[_0xc152('0x28')][_0xc152('0x2f')](_0xc152('0x30'))){_0x3d006b[_0xc152('0x17')]=qs[_0xc152('0x17')](_0x14ac1['query']['limit']);_0x3d006b[_0xc152('0x15')]=qs[_0xc152('0x15')](_0x14ac1[_0xc152('0x28')][_0xc152('0x15')]);}_0x3d006b[_0xc152('0x31')]=qs[_0xc152('0x32')](_0x14ac1['query'][_0xc152('0x32')]);_0x3d006b[_0xc152('0x33')]=qs[_0xc152('0x2a')](_[_0xc152('0x34')](_0x14ac1['query'],_0x2105f4[_0xc152('0x2a')]),_0x52e119);if(_0x14ac1[_0xc152('0x28')][_0xc152('0x35')]){_0x3d006b[_0xc152('0x33')]=_[_0xc152('0x36')](_0x3d006b[_0xc152('0x33')],{'$or':_[_0xc152('0x21')](_0x52e119,function(_0x25cb66){if(_0x25cb66[_0xc152('0x25')]!=='VIRTUAL'){var _0x27719a={};_0x27719a[_0x25cb66[_0xc152('0x1f')]]={'$like':'%'+_0x14ac1[_0xc152('0x28')]['filter']+'%'};return _0x27719a;}})});}_0x3d006b=_[_0xc152('0x36')]({},_0x3d006b,_0x14ac1[_0xc152('0x37')]);var _0x30c241={'where':_0x3d006b['where']};return db[_0xc152('0x22')][_0xc152('0x18')](_0x30c241)[_0xc152('0x1b')](function(_0x2295d4){_0x220c5a['count']=_0x2295d4;if(_0x14ac1[_0xc152('0x28')][_0xc152('0x38')]){_0x3d006b['include']=[{'all':!![]}];}return db[_0xc152('0x22')]['findAll'](_0x3d006b);})[_0xc152('0x1b')](function(_0x15e8d9){_0x220c5a['rows']=_0x15e8d9;return _0x220c5a;})[_0xc152('0x1b')](respondWithFilteredResult(_0xb4d9b7,_0x3d006b))[_0xc152('0x39')](handleError(_0xb4d9b7,null));};exports[_0xc152('0x3a')]=function(_0x20903c,_0x3778bc){var _0x4d5d2a={'raw':!![],'where':{'id':_0x20903c[_0xc152('0x3b')]['id']}},_0x55484a={};_0x55484a[_0xc152('0x27')]=_[_0xc152('0x29')](db[_0xc152('0x22')][_0xc152('0x23')]);_0x55484a[_0xc152('0x28')]=_[_0xc152('0x29')](_0x20903c[_0xc152('0x28')]);_0x55484a[_0xc152('0x2a')]=_[_0xc152('0x2b')](_0x55484a['model'],_0x55484a['query']);_0x4d5d2a['attributes']=_[_0xc152('0x2b')](_0x55484a[_0xc152('0x27')],qs['fields'](_0x20903c['query'][_0xc152('0x2c')]));_0x4d5d2a[_0xc152('0x2e')]=_0x4d5d2a[_0xc152('0x2e')][_0xc152('0x2d')]?_0x4d5d2a[_0xc152('0x2e')]:_0x55484a[_0xc152('0x27')];if(_0x20903c[_0xc152('0x28')][_0xc152('0x38')]){_0x4d5d2a[_0xc152('0x3c')]=[{'all':!![]}];}_0x4d5d2a=_[_0xc152('0x36')]({},_0x4d5d2a,_0x20903c[_0xc152('0x37')]);return db[_0xc152('0x22')][_0xc152('0x3d')](_0x4d5d2a)['then'](handleEntityNotFound(_0x3778bc,null))[_0xc152('0x1b')](respondWithResult(_0x3778bc,null))[_0xc152('0x39')](handleError(_0x3778bc,null));};exports['create']=function(_0x32f863,_0x112ff9){var _0x3e3ae0;return db[_0xc152('0x22')][_0xc152('0x3e')](_0x32f863[_0xc152('0x3f')],{'raw':!![]})[_0xc152('0x1b')](function(_0x23aae9){_0x3e3ae0=_0x23aae9;return db[_0xc152('0x22')][_0xc152('0x40')]({'where':{'type':_0x32f863[_0xc152('0x3f')][_0xc152('0x25')]},'raw':!![]});})[_0xc152('0x1b')](function(_0x319972){if(_0x3e3ae0[_0xc152('0x25')][_0xc152('0x41')]()==_0xc152('0x42')){var _0x6a05d5=fs['readFileSync'](path[_0xc152('0x43')](config[_0xc152('0x44')],'server/files/templates/stun_multiple.ejs'),_0xc152('0x45'));var _0x180b07=ejs[_0xc152('0x46')](_0x6a05d5,{'networks':_0x319972||[]});fs[_0xc152('0x47')](_0xc152('0x48'),_0x180b07);return respondWithRpcPromise(_0xc152('0x49'),'create',{'module':'res_stun_monitor.so'});}else if(_0x3e3ae0[_0xc152('0x25')][_0xc152('0x41')]()==_0xc152('0x4a')){var _0x31e05f=fs['readFileSync'](path[_0xc152('0x43')](config[_0xc152('0x44')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x505283=ejs[_0xc152('0x46')](_0x31e05f,{'networks':_0x319972||[]});fs[_0xc152('0x47')]('/etc/asterisk/turn_xcally.conf',_0x505283);return respondWithRpcPromise(_0xc152('0x49'),_0xc152('0x3e'),{'module':_0xc152('0x4b')});}else{var _0x32c53d=fs[_0xc152('0x4c')](path['join'](config[_0xc152('0x44')],'server/files/templates/network.ejs'),_0xc152('0x45'));var _0x5b8a83=ejs[_0xc152('0x46')](_0x32c53d,{'networks':_0x319972||[]});fs[_0xc152('0x47')](util[_0xc152('0x4d')](_0xc152('0x4e'),_0x32f863[_0xc152('0x3f')]['type'][_0xc152('0x4f')]()),_0x5b8a83);return respondWithRpcPromise(_0xc152('0x49'),_0xc152('0x3e'),{'module':_0xc152('0x50')});}})[_0xc152('0x1b')](function(){return _0x3e3ae0;})['then'](respondWithResult(_0x112ff9,0xc9))[_0xc152('0x39')](handleError(_0x112ff9,null));};exports['update']=function(_0x4de36d,_0x10887a){var _0x362167;return db[_0xc152('0x22')][_0xc152('0x3d')]({'where':{'id':_0x4de36d['params']['id']}})['then'](handleEntityNotFound(_0x10887a,null))[_0xc152('0x1b')](saveUpdates(_0x4de36d[_0xc152('0x3f')],null))[_0xc152('0x1b')](function(_0x36d47f){if(_0x36d47f){_0x362167=_0x36d47f;return db[_0xc152('0x22')][_0xc152('0x40')]({'where':{'type':_0x362167['type']},'raw':!![]});}return null;})[_0xc152('0x1b')](function(_0x222bfe){if(_0x362167['type'][_0xc152('0x41')]()==_0xc152('0x42')){var _0xc6999b=fs[_0xc152('0x4c')](path[_0xc152('0x43')](config[_0xc152('0x44')],_0xc152('0x51')),'utf8');var _0x330331=ejs[_0xc152('0x46')](_0xc6999b,{'networks':_0x222bfe||[]});fs[_0xc152('0x47')](_0xc152('0x48'),_0x330331);return respondWithRpcPromise(_0xc152('0x49'),_0xc152('0x1a'),{'module':_0xc152('0x4b')});}else if(_0x362167[_0xc152('0x25')][_0xc152('0x41')]()==_0xc152('0x4a')){var _0x3b0b0c=fs[_0xc152('0x4c')](path[_0xc152('0x43')](config[_0xc152('0x44')],_0xc152('0x52')),_0xc152('0x45'));var _0x58c8aa=ejs[_0xc152('0x46')](_0x3b0b0c,{'networks':_0x222bfe||[]});fs[_0xc152('0x47')]('/etc/asterisk/turn_xcally.conf',_0x58c8aa);return respondWithRpcPromise(_0xc152('0x49'),'update',{'module':_0xc152('0x4b')});}else{var _0x29e871=fs['readFileSync'](path[_0xc152('0x43')](config['root'],_0xc152('0x53')),'utf8');var _0x3a4880=ejs[_0xc152('0x46')](_0x29e871,{'networks':_0x222bfe||[]});fs[_0xc152('0x47')](util['format'](_0xc152('0x4e'),_0x4de36d[_0xc152('0x3f')][_0xc152('0x25')][_0xc152('0x4f')]()),_0x3a4880);return respondWithRpcPromise(_0xc152('0x49'),_0xc152('0x1a'),{'module':_0xc152('0x50')});}})[_0xc152('0x1b')](function(_0x4b9f66){if(_0x4b9f66){return _0x362167;}return null;})['then'](respondWithResult(_0x10887a,null))[_0xc152('0x39')](handleError(_0x10887a,null));};exports[_0xc152('0x1c')]=function(_0x335a36,_0x28f5b4){var _0x497d04;return db[_0xc152('0x22')][_0xc152('0x3d')]({'where':{'id':_0x335a36[_0xc152('0x3b')]['id']}})[_0xc152('0x1b')](function(_0x2cce17){_0x497d04=_0x2cce17;return _0x2cce17;})[_0xc152('0x1b')](handleEntityNotFound(_0x28f5b4,null))[_0xc152('0x1b')](removeEntity(_0x28f5b4,null))[_0xc152('0x1b')](function(){if(_0x497d04){return db[_0xc152('0x22')][_0xc152('0x40')]({'where':{'type':_0x497d04['type']},'raw':!![]});}})['then'](function(_0x280811){if(_0x497d04[_0xc152('0x25')]['toUpperCase']()=='STUN'){var _0x4b1e72=fs[_0xc152('0x4c')](path[_0xc152('0x43')](config[_0xc152('0x44')],_0xc152('0x51')),_0xc152('0x45'));var _0x589fa5=ejs[_0xc152('0x46')](_0x4b1e72,{'networks':_0x280811||[]});fs[_0xc152('0x47')](_0xc152('0x48'),_0x589fa5);return respondWithRpcPromise(_0xc152('0x49'),_0xc152('0x1c'),{'module':_0xc152('0x4b')});}else if(_0x497d04[_0xc152('0x25')][_0xc152('0x41')]()==_0xc152('0x4a')){var _0x2f8828=fs[_0xc152('0x4c')](path[_0xc152('0x43')](config[_0xc152('0x44')],_0xc152('0x52')),_0xc152('0x45'));var _0x345e61=ejs[_0xc152('0x46')](_0x2f8828,{'networks':_0x280811||[]});fs[_0xc152('0x47')]('/etc/asterisk/turn_xcally.conf',_0x345e61);return respondWithRpcPromise('Reload','destroy',{'module':_0xc152('0x4b')});}else{var _0x4fec59=fs[_0xc152('0x4c')](path[_0xc152('0x43')](config['root'],_0xc152('0x53')),_0xc152('0x45'));var _0x342464=ejs['render'](_0x4fec59,{'networks':_0x280811||[]});fs[_0xc152('0x47')](util[_0xc152('0x4d')](_0xc152('0x4e'),_0x497d04[_0xc152('0x25')][_0xc152('0x4f')]()),_0x342464);return respondWithRpcPromise('Reload',_0xc152('0x1c'),{'module':_0xc152('0x50')});}})[_0xc152('0x39')](handleError(_0x28f5b4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a291a66..6e951ea 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 _0x4058=['api','moment','bluebird','request-promise','path','rimraf','define','Network','network','lodash','util','../../config/logger'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x4058,0x129));var _0x8405=function(_0x23f98f,_0xcf4c1c){_0x23f98f=_0x23f98f-0x0;var _0x3b4758=_0x4058[_0x23f98f];return _0x3b4758;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var logger=require(_0x8405('0x2'))(_0x8405('0x3'));var moment=require(_0x8405('0x4'));var BPromise=require(_0x8405('0x5'));var rp=require(_0x8405('0x6'));var fs=require('fs');var path=require(_0x8405('0x7'));var rimraf=require(_0x8405('0x8'));var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x1db7ea,_0x257d43){return _0x1db7ea[_0x8405('0x9')](_0x8405('0xa'),attributes,{'tableName':_0x8405('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7af2=['../../config/environment','./network.attributes','exports','define','network','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4fcfcb,_0x531aaa){var _0x6a0df3=function(_0x499466){while(--_0x499466){_0x4fcfcb['push'](_0x4fcfcb['shift']());}};_0x6a0df3(++_0x531aaa);}(_0x7af2,0x119));var _0x27af=function(_0x3672bd,_0x45f5ba){_0x3672bd=_0x3672bd-0x0;var _0x35d08a=_0x7af2[_0x3672bd];return _0x35d08a;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var moment=require(_0x27af('0x3'));var BPromise=require('bluebird');var rp=require(_0x27af('0x4'));var fs=require('fs');var path=require(_0x27af('0x5'));var rimraf=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var attributes=require(_0x27af('0x8'));module[_0x27af('0x9')]=function(_0x350532,_0x184630){return _0x350532[_0x27af('0xa')]('Network',attributes,{'tableName':_0x27af('0xb'),'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 8b94848..d805baf 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f80ea,_0x5ba92b){var _0x304ef0=function(_0xbb24fa){while(--_0xbb24fa){_0x4f80ea['push'](_0x4f80ea['shift']());}};_0x304ef0(++_0x5ba92b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x372cc1,_0x14a0a1){_0x372cc1=_0x372cc1-0x0;var _0x492fd1=_0x7a54[_0x372cc1];return _0x492fd1;};'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 1f95d38..50e2494 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 _0xd821=['/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','index','get','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0xd821,0x1ab));var _0x1d82=function(_0x292c49,_0xca2005){_0x292c49=_0x292c49-0x0;var _0x3c2078=_0xd821[_0x292c49];return _0x3c2078;};'use strict';var multer=require('multer');var util=require(_0x1d82('0x0'));var path=require(_0x1d82('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d82('0x2'));var router=express[_0x1d82('0x3')]();var fs_extra=require(_0x1d82('0x4'));var auth=require(_0x1d82('0x5'));var interaction=require(_0x1d82('0x6'));var config=require('../../config/environment');var controller=require(_0x1d82('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d82('0x8')]);router[_0x1d82('0x9')](_0x1d82('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1d82('0x9')](_0x1d82('0xb'),auth[_0x1d82('0xc')](),controller[_0x1d82('0xd')]);router[_0x1d82('0x9')](_0x1d82('0xe'),auth[_0x1d82('0xc')](),controller[_0x1d82('0xf')]);router[_0x1d82('0x9')](_0x1d82('0x10'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x11')]);router['get'](_0x1d82('0x12'),auth['isAuthenticated'](),controller[_0x1d82('0x13')]);router['get']('/:id/interactions',auth[_0x1d82('0xc')](),controller[_0x1d82('0x14')]);router[_0x1d82('0x9')](_0x1d82('0x15'),auth[_0x1d82('0xc')](),controller['getAgents']);router[_0x1d82('0x16')]('/',auth[_0x1d82('0xc')](),controller[_0x1d82('0x17')]);router[_0x1d82('0x16')](_0x1d82('0xe'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x18')]);router[_0x1d82('0x16')](_0x1d82('0x10'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x19')]);router[_0x1d82('0x16')](_0x1d82('0x1a'),controller[_0x1d82('0x1b')]);router[_0x1d82('0x16')](_0x1d82('0x12'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x1c')]);router[_0x1d82('0x16')](_0x1d82('0x15'),auth[_0x1d82('0xc')](),controller['addAgents']);router[_0x1d82('0x16')](_0x1d82('0x1d'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x1e')]);router['put']('/:id',auth[_0x1d82('0xc')](),controller[_0x1d82('0x1f')]);router[_0x1d82('0x20')](_0x1d82('0xb'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x21')]);router['delete'](_0x1d82('0xe'),auth['isAuthenticated'](),controller[_0x1d82('0x22')]);router['delete'](_0x1d82('0x10'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x23')]);router[_0x1d82('0x20')](_0x1d82('0x15'),auth['isAuthenticated'](),controller[_0x1d82('0x24')]);module[_0x1d82('0x25')]=router; \ No newline at end of file +var _0x471f=['getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify','addAgents','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x39abc7,_0x2d6714){var _0x17027e=function(_0x393e5b){while(--_0x393e5b){_0x39abc7['push'](_0x39abc7['shift']());}};_0x17027e(++_0x2d6714);}(_0x471f,0x125));var _0xf471=function(_0x5e629a,_0x48e934){_0x5e629a=_0x5e629a-0x0;var _0x406422=_0x471f[_0x5e629a];return _0x406422;};'use strict';var multer=require('multer');var util=require(_0xf471('0x0'));var path=require(_0xf471('0x1'));var timeout=require(_0xf471('0x2'));var express=require(_0xf471('0x3'));var router=express[_0xf471('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf471('0x5'));var interaction=require(_0xf471('0x6'));var config=require(_0xf471('0x7'));var controller=require('./openchannelAccount.controller');router[_0xf471('0x8')]('/',auth[_0xf471('0x9')](),controller[_0xf471('0xa')]);router['get']('/describe',auth[_0xf471('0x9')](),controller[_0xf471('0xb')]);router['get'](_0xf471('0xc'),auth[_0xf471('0x9')](),controller[_0xf471('0xd')]);router[_0xf471('0x8')](_0xf471('0xe'),auth[_0xf471('0x9')](),controller[_0xf471('0xf')]);router[_0xf471('0x8')](_0xf471('0x10'),auth[_0xf471('0x9')](),controller[_0xf471('0x11')]);router[_0xf471('0x8')](_0xf471('0x12'),auth['isAuthenticated'](),controller[_0xf471('0x13')]);router[_0xf471('0x8')](_0xf471('0x14'),auth[_0xf471('0x9')](),controller[_0xf471('0x15')]);router['get'](_0xf471('0x16'),auth[_0xf471('0x9')](),controller[_0xf471('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf471('0x18')]);router[_0xf471('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf471('0x1a')]);router[_0xf471('0x19')](_0xf471('0x10'),auth[_0xf471('0x9')](),controller[_0xf471('0x1b')]);router[_0xf471('0x19')]('/:id/notify',controller[_0xf471('0x1c')]);router[_0xf471('0x19')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xf471('0x19')]('/:id/users',auth[_0xf471('0x9')](),controller[_0xf471('0x1d')]);router['post'](_0xf471('0x1e'),auth[_0xf471('0x9')](),controller[_0xf471('0x1f')]);router[_0xf471('0x20')]('/:id',auth[_0xf471('0x9')](),controller[_0xf471('0x21')]);router[_0xf471('0x22')]('/:id',auth[_0xf471('0x9')](),controller['destroy']);router[_0xf471('0x22')](_0xf471('0xe'),auth[_0xf471('0x9')](),controller[_0xf471('0x23')]);router[_0xf471('0x22')](_0xf471('0x10'),auth[_0xf471('0x9')](),controller[_0xf471('0x24')]);router['delete'](_0xf471('0x16'),auth[_0xf471('0x9')](),controller[_0xf471('0x25')]);module[_0xf471('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 5e25ade..18aaf17 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 _0x7e09=['exports','name','STRING','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x302ac5,_0x3a1bf1){var _0x4ab101=function(_0x1ae339){while(--_0x1ae339){_0x302ac5['push'](_0x302ac5['shift']());}};_0x4ab101(++_0x3a1bf1);}(_0x7e09,0x143));var _0x97e0=function(_0x17817d,_0x527bf8){_0x17817d=_0x17817d-0x0;var _0x219d9e=_0x7e09[_0x17817d];return _0x219d9e;};'use strict';var Sequelize=require(_0x97e0('0x0'));var rs=require(_0x97e0('0x1'));module[_0x97e0('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x97e0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x97e0('0x4')]},'token':{'type':Sequelize[_0x97e0('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x97e0('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x97e0('0x5')],'defaultValue':function(){return _0x97e0('0x6');}},'notificationSound':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x97e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x97e0('0x4')]},'queueTransfer':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x97e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x97e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x97e0('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x97e0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':![],'comment':_0x97e0('0xa'),'set':function(_0x39032c){if(!_0x39032c)this['setDataValue'](_0x97e0('0xb'),null);this['setDataValue'](_0x97e0('0xc'),_0x39032c);}}}; \ No newline at end of file +var _0x165b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x165b,0x64));var _0xb165=function(_0x422866,_0x331d73){_0x422866=_0x422866-0x0;var _0x5ebb05=_0x165b[_0x422866];return _0x5ebb05;};'use strict';var Sequelize=require(_0xb165('0x0'));var rs=require(_0xb165('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb165('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb165('0x3')]();}},'replyUri':{'type':Sequelize[_0xb165('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb165('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb165('0x4')],'defaultValue':function(){return _0xb165('0x5');}},'notificationSound':{'type':Sequelize[_0xb165('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb165('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb165('0x2')]},'queueTransfer':{'type':Sequelize[_0xb165('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb165('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb165('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb165('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb165('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb165('0x6')],'defaultValue':![],'comment':_0xb165('0x8'),'set':function(_0x125481){if(!_0x125481)this[_0xb165('0x9')](_0xb165('0xa'),null);this['setDataValue'](_0xb165('0xb'),_0x125481);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 8aadf15..e28c5db 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 _0xb19f=['sendStatus','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','query','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','params','fields','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','addApplications','sequelize','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','stack','getApplications','Owner','internal','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','jsforce','to-csv','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','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','end'];(function(_0x242a81,_0x5ad269){var _0x34dae1=function(_0x5c4554){while(--_0x5c4554){_0x242a81['push'](_0x242a81['shift']());}};_0x34dae1(++_0x5ad269);}(_0xb19f,0x7d));var _0xfb19=function(_0x550a61,_0x1c5d8c){_0x550a61=_0x550a61-0x0;var _0x248bfc=_0xb19f[_0x550a61];return _0x248bfc;};'use strict';var emlformat=require(_0xfb19('0x0'));var rimraf=require(_0xfb19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb19('0x2'));var moment=require(_0xfb19('0x3'));var BPromise=require(_0xfb19('0x4'));var Mustache=require('mustache');var util=require(_0xfb19('0x5'));var path=require('path');var sox=require(_0xfb19('0x6'));var csv=require('to-csv');var ejs=require(_0xfb19('0x7'));var fs=require('fs');var fs_extra=require(_0xfb19('0x8'));var _=require('lodash');var squel=require(_0xfb19('0x9'));var crypto=require('crypto');var jsforce=require(_0xfb19('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfb19('0xb'));var querystring=require('querystring');var Papa=require(_0xfb19('0xc'));var Redis=require('ioredis');var authService=require(_0xfb19('0xd'));var qs=require(_0xfb19('0xe'));var as=require(_0xfb19('0xf'));var hardwareService=require(_0xfb19('0x10'));var logger=require(_0xfb19('0x11'))(_0xfb19('0x12'));var utils=require(_0xfb19('0x13'));var config=require(_0xfb19('0x14'));var licenseUtil=require(_0xfb19('0x15'));var db=require(_0xfb19('0x16'))['db'];config[_0xfb19('0x17')]=_[_0xfb19('0x18')](config[_0xfb19('0x17')],{'host':_0xfb19('0x19'),'port':0x18eb});var socket=require(_0xfb19('0x1a'))(new Redis(config[_0xfb19('0x17')]));require(_0xfb19('0x1b'))['register'](socket);var jayson=require(_0xfb19('0x1c'));var client=jayson['client'][_0xfb19('0x1d')]({'port':0x232c});var client9002=jayson[_0xfb19('0x1e')][_0xfb19('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5de532,_0x4427e2,_0x379fda,_0x17c238){return new BPromise(function(_0x29fb85,_0x4d3192){var _0x15500a=_0x17c238||client;return _0x15500a[_0xfb19('0x1f')](_0x5de532,_0x379fda)[_0xfb19('0x20')](function(_0x2f8208){logger['info'](_0xfb19('0x21'),_0x4427e2,_0xfb19('0x22'));logger[_0xfb19('0x23')](_0xfb19('0x24'),_0x4427e2,'request\x20sent',JSON['stringify'](_0x2f8208));if(_0x2f8208[_0xfb19('0x25')]){if(_0x2f8208[_0xfb19('0x25')][_0xfb19('0x26')]===0x1f4){logger[_0xfb19('0x25')](_0xfb19('0x21'),_0x4427e2,_0x2f8208['error'][_0xfb19('0x27')]);return _0x4d3192(_0x2f8208['error'][_0xfb19('0x27')]);}logger[_0xfb19('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4427e2,_0x2f8208[_0xfb19('0x25')]['message']);return _0x29fb85(_0x2f8208[_0xfb19('0x25')][_0xfb19('0x27')]);}else{logger[_0xfb19('0x28')](_0xfb19('0x21'),_0x4427e2,_0xfb19('0x22'));_0x29fb85(_0x2f8208[_0xfb19('0x29')][_0xfb19('0x27')]);}})['catch'](function(_0x28ab71){logger['error'](_0xfb19('0x21'),_0x4427e2,_0x28ab71);_0x4d3192(_0x28ab71);});});}function respondWithStatusCode(_0x369a19,_0x3d9d69){_0x3d9d69=_0x3d9d69||0xcc;return function(_0x4561fa){if(_0x4561fa){return _0x369a19['sendStatus'](_0x3d9d69);}return _0x369a19[_0xfb19('0x2a')](_0x3d9d69)['end']();};}function respondWithResult(_0x5de22d,_0x2bd35a){_0x2bd35a=_0x2bd35a||0xc8;return function(_0x36b058){if(_0x36b058){return _0x5de22d[_0xfb19('0x2a')](_0x2bd35a)[_0xfb19('0x2b')](_0x36b058);}};}function respondWithFilteredResult(_0x58c3f4,_0x40038c){return function(_0xfd3168){if(_0xfd3168){var _0x6d79e5=typeof _0x40038c[_0xfb19('0x2c')]==='undefined'&&typeof _0x40038c[_0xfb19('0x2d')]===_0xfb19('0x2e');var _0x2a310f=_0xfd3168[_0xfb19('0x2f')];var _0x46384a=_0x6d79e5?0x0:_0x40038c[_0xfb19('0x2c')];var _0x222e68=_0x6d79e5?_0xfd3168[_0xfb19('0x2f')]:_0x40038c[_0xfb19('0x2c')]+_0x40038c[_0xfb19('0x2d')];var _0x1b4ac0;if(_0x222e68>=_0x2a310f){_0x222e68=_0x2a310f;_0x1b4ac0=0xc8;}else{_0x1b4ac0=0xce;}_0x58c3f4[_0xfb19('0x2a')](_0x1b4ac0);return _0x58c3f4[_0xfb19('0x30')](_0xfb19('0x31'),_0x46384a+'-'+_0x222e68+'/'+_0x2a310f)[_0xfb19('0x2b')](_0xfd3168);}return null;};}function patchUpdates(_0x697b6f){return function(_0x59db8f){try{jsonpatch[_0xfb19('0x32')](_0x59db8f,_0x697b6f,!![]);}catch(_0x389157){return BPromise[_0xfb19('0x33')](_0x389157);}return _0x59db8f[_0xfb19('0x34')]();};}function saveUpdates(_0xbac46b,_0x107394){return function(_0x4335d5){if(_0x4335d5){return _0x4335d5[_0xfb19('0x35')](_0xbac46b)[_0xfb19('0x20')](function(_0x233518){return _0x233518;});}return null;};}function removeEntity(_0xbd5d45,_0x5590f6){return function(_0x57af45){if(_0x57af45){return _0x57af45[_0xfb19('0x36')]()['then'](function(){var _0x3d1dbe=_0x57af45[_0xfb19('0x37')]({'plain':!![]});var _0x517164=_0xfb19('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x517164,'resourceId':_0x3d1dbe['id']}})[_0xfb19('0x20')](function(){return _0x57af45;});})[_0xfb19('0x20')](function(){_0xbd5d45[_0xfb19('0x2a')](0xcc)[_0xfb19('0x39')]();});}};}function handleEntityNotFound(_0x3f337e,_0x118e80){return function(_0x4d84c2){if(!_0x4d84c2){_0x3f337e[_0xfb19('0x3a')](0x194);}return _0x4d84c2;};}function handleError(_0x190078,_0x36cfb5){_0x36cfb5=_0x36cfb5||0x1f4;return function(_0x50cafe){logger[_0xfb19('0x25')](_0x50cafe['stack']);if(_0x50cafe['name']){delete _0x50cafe[_0xfb19('0x3b')];}_0x190078['status'](_0x36cfb5)[_0xfb19('0x3c')](_0x50cafe);};}exports['index']=function(_0x3620f5,_0x519f6f){var _0x5d1668={'include':[{'model':db[_0xfb19('0x3d')],'as':_0xfb19('0x3e')}]},_0x218f5a={},_0x5b65e3={'count':0x0,'rows':[]};var _0x597014=_[_0xfb19('0x3f')](db[_0xfb19('0x40')][_0xfb19('0x41')],function(_0x558321){return{'name':_0x558321['fieldName'],'type':_0x558321[_0xfb19('0x42')][_0xfb19('0x43')]};});_0x218f5a[_0xfb19('0x44')]=_[_0xfb19('0x3f')](_0x597014,_0xfb19('0x3b'));_0x218f5a['query']=_[_0xfb19('0x45')](_0x3620f5[_0xfb19('0x46')]);_0x218f5a['filters']=_[_0xfb19('0x47')](_0x218f5a['model'],_0x218f5a[_0xfb19('0x46')]);_0x5d1668[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x218f5a['model'],qs['fields'](_0x3620f5['query']['fields']));_0x5d1668[_0xfb19('0x48')]=_0x5d1668[_0xfb19('0x48')][_0xfb19('0x49')]?_0x5d1668[_0xfb19('0x48')]:_0x218f5a['model'];if(!_0x3620f5[_0xfb19('0x46')]['hasOwnProperty'](_0xfb19('0x4a'))){_0x5d1668[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x3620f5[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x5d1668[_0xfb19('0x2c')]=qs['offset'](_0x3620f5['query'][_0xfb19('0x2c')]);}_0x5d1668[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x3620f5['query'][_0xfb19('0x4c')]);_0x5d1668['where']=qs[_0xfb19('0x4d')](_[_0xfb19('0x4e')](_0x3620f5['query'],_0x218f5a[_0xfb19('0x4d')]),_0x597014);if(_0x3620f5[_0xfb19('0x46')][_0xfb19('0x4f')]){_0x5d1668[_0xfb19('0x50')]=_[_0xfb19('0x51')](_0x5d1668[_0xfb19('0x50')],{'$or':_[_0xfb19('0x3f')](_0x597014,function(_0x537ddd){if(_0x537ddd[_0xfb19('0x42')]!=='VIRTUAL'){var _0x36c022={};_0x36c022[_0x537ddd['name']]={'$like':'%'+_0x3620f5[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x36c022;}})});}_0x5d1668=_[_0xfb19('0x51')]({},_0x5d1668,_0x3620f5[_0xfb19('0x52')]);var _0x1d3a1f={'where':_0x5d1668['where']};return db[_0xfb19('0x40')][_0xfb19('0x2f')](_0x1d3a1f)[_0xfb19('0x20')](function(_0x52c7fd){_0x5b65e3['count']=_0x52c7fd;if(_0x3620f5[_0xfb19('0x46')][_0xfb19('0x53')]){_0x5d1668[_0xfb19('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x5d1668);})[_0xfb19('0x20')](function(_0x58f38c){_0x5b65e3[_0xfb19('0x55')]=_0x58f38c;return _0x5b65e3;})[_0xfb19('0x20')](respondWithFilteredResult(_0x519f6f,_0x5d1668))['catch'](handleError(_0x519f6f,null));};exports['show']=function(_0x9a64db,_0x447e88){var _0x27d48d={'raw':![],'where':{'id':_0x9a64db[_0xfb19('0x56')]['id']},'include':[{'model':db[_0xfb19('0x3d')],'as':_0xfb19('0x3e')}]},_0x36cac5={};_0x36cac5['model']=_[_0xfb19('0x45')](db[_0xfb19('0x40')]['rawAttributes']);_0x36cac5[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x9a64db[_0xfb19('0x46')]);_0x36cac5[_0xfb19('0x4d')]=_['intersection'](_0x36cac5['model'],_0x36cac5[_0xfb19('0x46')]);_0x27d48d[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x36cac5[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x9a64db[_0xfb19('0x46')]['fields']));_0x27d48d['attributes']=_0x27d48d[_0xfb19('0x48')][_0xfb19('0x49')]?_0x27d48d[_0xfb19('0x48')]:_0x36cac5[_0xfb19('0x44')];if(_0x9a64db[_0xfb19('0x46')][_0xfb19('0x53')]){_0x27d48d[_0xfb19('0x54')]=[{'all':!![]}];}_0x27d48d=_[_0xfb19('0x51')]({},_0x27d48d,_0x9a64db[_0xfb19('0x52')]);return db[_0xfb19('0x40')]['find'](_0x27d48d)[_0xfb19('0x20')](handleEntityNotFound(_0x447e88,null))['then'](respondWithResult(_0x447e88,null))[_0xfb19('0x58')](handleError(_0x447e88,null));};exports[_0xfb19('0x59')]=function(_0x16650b,_0x1593b7){return db['OpenchannelAccount'][_0xfb19('0x59')](_0x16650b[_0xfb19('0x5a')],{})['then'](function(_0x5849fb){var _0x5f012f=_0x16650b[_0xfb19('0x5b')][_0xfb19('0x37')]({'plain':!![]});if(!_0x5f012f)throw new Error(_0xfb19('0x5c'));if(_0x5f012f['role']===_0xfb19('0x5b')){var _0x33b698=_0x5849fb['get']({'plain':!![]});var _0x1c2b9f=_0xfb19('0x38');return db['UserProfileSection'][_0xfb19('0x5d')]({'where':{'name':_0x1c2b9f,'userProfileId':_0x5f012f['userProfileId']},'raw':!![]})[_0xfb19('0x20')](function(_0x1d90df){if(_0x1d90df&&_0x1d90df[_0xfb19('0x5e')]===0x0){return db[_0xfb19('0x5f')][_0xfb19('0x59')]({'name':_0x33b698[_0xfb19('0x3b')],'resourceId':_0x33b698['id'],'type':_0x1d90df[_0xfb19('0x3b')],'sectionId':_0x1d90df['id']},{})[_0xfb19('0x20')](function(){return _0x5849fb;});}else{return _0x5849fb;}})[_0xfb19('0x58')](function(_0xb0a923){logger['error'](_0xfb19('0x60'),_0xb0a923);throw _0xb0a923;});}return _0x5849fb;})['then'](respondWithResult(_0x1593b7,0xc9))['catch'](handleError(_0x1593b7,null));};exports[_0xfb19('0x35')]=function(_0x23bbf0,_0x278674){if(_0x23bbf0[_0xfb19('0x5a')]['id']){delete _0x23bbf0[_0xfb19('0x5a')]['id'];}return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x23bbf0[_0xfb19('0x56')]['id']},'include':[{'model':db[_0xfb19('0x3d')],'as':_0xfb19('0x3e')}]})[_0xfb19('0x20')](handleEntityNotFound(_0x278674,null))['then'](saveUpdates(_0x23bbf0[_0xfb19('0x5a')],null))[_0xfb19('0x20')](respondWithResult(_0x278674,null))[_0xfb19('0x58')](handleError(_0x278674,null));};exports[_0xfb19('0x36')]=function(_0x48f7e0,_0x53a4ee){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x48f7e0['params']['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x53a4ee,null))['then'](removeEntity(_0x53a4ee,null))['catch'](handleError(_0x53a4ee,null));};exports['describe']=function(_0x3878b3,_0x2ecb17){return db[_0xfb19('0x40')][_0xfb19('0x61')]()[_0xfb19('0x20')](respondWithResult(_0x2ecb17,null))[_0xfb19('0x58')](handleError(_0x2ecb17,null));};exports[_0xfb19('0x62')]=function(_0x56bd97,_0x4901ee,_0x5be39c){if(_0x56bd97[_0xfb19('0x5a')]['id']){delete _0x56bd97['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x56bd97[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x4901ee,null))['then'](function(_0x3d701c){if(_0x3d701c){_0x56bd97['body'][_0xfb19('0x63')]=_0x3d701c['id'];return db[_0xfb19('0x64')][_0xfb19('0x59')](_0x56bd97[_0xfb19('0x5a')]);}})[_0xfb19('0x20')](respondWithResult(_0x4901ee,null))['catch'](handleError(_0x4901ee,null));};exports['getDispositions']=function(_0x3e7449,_0x31840c,_0x1e9eb3){var _0x414e86={'raw':![],'where':{}};var _0x27cbbc={};var _0x212b2c={'count':0x0,'rows':[]};return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x3e7449['params']['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x31840c,null))[_0xfb19('0x20')](function(_0x4db66a){if(_0x4db66a){_0x27cbbc['model']=_[_0xfb19('0x45')](db[_0xfb19('0x64')][_0xfb19('0x41')]);_0x27cbbc[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x3e7449[_0xfb19('0x46')]);_0x27cbbc[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x27cbbc[_0xfb19('0x44')],_0x27cbbc[_0xfb19('0x46')]);_0x414e86[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x27cbbc[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x57')]));_0x414e86[_0xfb19('0x48')]=_0x414e86[_0xfb19('0x48')]['length']?_0x414e86[_0xfb19('0x48')]:_0x27cbbc[_0xfb19('0x44')];if(!_0x3e7449[_0xfb19('0x46')][_0xfb19('0x66')](_0xfb19('0x4a'))){_0x414e86[_0xfb19('0x2d')]=qs['limit'](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x414e86['offset']=qs[_0xfb19('0x2c')](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x2c')]);}_0x414e86[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x4c')]);_0x414e86['where']=qs['filters'](_[_0xfb19('0x4e')](_0x3e7449[_0xfb19('0x46')],_0x27cbbc[_0xfb19('0x4d')]));_0x414e86['where'][_0xfb19('0x63')]=_0x4db66a['id'];if(_0x3e7449[_0xfb19('0x46')][_0xfb19('0x4f')]){_0x414e86['where']=_['merge'](_0x414e86[_0xfb19('0x50')],{'$or':_['map'](_0x414e86[_0xfb19('0x48')],function(_0x466fe2){var _0x3da55b={};_0x3da55b[_0x466fe2]={'$like':'%'+_0x3e7449['query']['filter']+'%'};return _0x3da55b;})});}_0x414e86=_['merge']({},_0x414e86,_0x3e7449[_0xfb19('0x52')]);return db[_0xfb19('0x64')]['count']({'where':_0x414e86[_0xfb19('0x50')]})[_0xfb19('0x20')](function(_0x11762d){_0x212b2c[_0xfb19('0x2f')]=_0x11762d;if(_0x3e7449['query'][_0xfb19('0x53')]){_0x414e86[_0xfb19('0x54')]=[{'all':!![]}];}return db[_0xfb19('0x64')][_0xfb19('0x67')](_0x414e86);})[_0xfb19('0x20')](function(_0x4ded59){_0x212b2c[_0xfb19('0x55')]=_0x4ded59;return _0x212b2c;});}})[_0xfb19('0x20')](respondWithFilteredResult(_0x31840c,_0x414e86))['catch'](handleError(_0x31840c,null));};exports['removeDispositions']=function(_0x4c22a2,_0x1afcf8,_0x530468){return db['OpenchannelAccount'][_0xfb19('0x5d')]({'where':{'id':_0x4c22a2[_0xfb19('0x56')]['id']}})['then'](handleEntityNotFound(_0x1afcf8,null))[_0xfb19('0x20')](function(_0x545d16){if(_0x545d16){return _0x545d16[_0xfb19('0x68')](_0x4c22a2[_0xfb19('0x46')][_0xfb19('0x69')]);}})['then'](respondWithStatusCode(_0x1afcf8,null))['catch'](handleError(_0x1afcf8,null));};exports[_0xfb19('0x6a')]=function(_0x2db7ed,_0x32f69c,_0xd5e130){if(_0x2db7ed[_0xfb19('0x5a')]['id']){delete _0x2db7ed['body']['id'];}return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x2db7ed[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x32f69c,null))[_0xfb19('0x20')](function(_0x376c4a){if(_0x376c4a){_0x2db7ed[_0xfb19('0x5a')][_0xfb19('0x63')]=_0x376c4a['id'];return db[_0xfb19('0x6b')][_0xfb19('0x59')](_0x2db7ed['body']);}})['then'](respondWithResult(_0x32f69c,null))[_0xfb19('0x58')](handleError(_0x32f69c,null));};exports['getAnswers']=function(_0x21ad82,_0x180d06,_0xac294b){var _0x204e88={'raw':![],'where':{}};var _0x1291b0={};var _0xf2974a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfb19('0x65')]({'where':{'id':_0x21ad82[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x180d06,null))[_0xfb19('0x20')](function(_0x2aa611){if(_0x2aa611){_0x1291b0[_0xfb19('0x44')]=_[_0xfb19('0x45')](db[_0xfb19('0x6b')][_0xfb19('0x41')]);_0x1291b0[_0xfb19('0x46')]=_['keys'](_0x21ad82['query']);_0x1291b0['filters']=_['intersection'](_0x1291b0[_0xfb19('0x44')],_0x1291b0['query']);_0x204e88[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x1291b0['model'],qs[_0xfb19('0x57')](_0x21ad82[_0xfb19('0x46')][_0xfb19('0x57')]));_0x204e88[_0xfb19('0x48')]=_0x204e88['attributes'][_0xfb19('0x49')]?_0x204e88[_0xfb19('0x48')]:_0x1291b0[_0xfb19('0x44')];if(!_0x21ad82[_0xfb19('0x46')]['hasOwnProperty']('nolimit')){_0x204e88[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x21ad82[_0xfb19('0x46')]['limit']);_0x204e88[_0xfb19('0x2c')]=qs[_0xfb19('0x2c')](_0x21ad82[_0xfb19('0x46')][_0xfb19('0x2c')]);}_0x204e88[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x21ad82[_0xfb19('0x46')][_0xfb19('0x4c')]);_0x204e88['where']=qs[_0xfb19('0x4d')](_[_0xfb19('0x4e')](_0x21ad82['query'],_0x1291b0[_0xfb19('0x4d')]));_0x204e88[_0xfb19('0x50')][_0xfb19('0x63')]=_0x2aa611['id'];if(_0x21ad82[_0xfb19('0x46')]['filter']){_0x204e88[_0xfb19('0x50')]=_[_0xfb19('0x51')](_0x204e88[_0xfb19('0x50')],{'$or':_[_0xfb19('0x3f')](_0x204e88['attributes'],function(_0x5e54ac){var _0x36514d={};_0x36514d[_0x5e54ac]={'$like':'%'+_0x21ad82[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x36514d;})});}_0x204e88=_[_0xfb19('0x51')]({},_0x204e88,_0x21ad82[_0xfb19('0x52')]);return db[_0xfb19('0x6b')][_0xfb19('0x2f')]({'where':_0x204e88[_0xfb19('0x50')]})[_0xfb19('0x20')](function(_0xa9c551){_0xf2974a[_0xfb19('0x2f')]=_0xa9c551;if(_0x21ad82['query'][_0xfb19('0x53')]){_0x204e88[_0xfb19('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfb19('0x67')](_0x204e88);})[_0xfb19('0x20')](function(_0x2ffc59){_0xf2974a[_0xfb19('0x55')]=_0x2ffc59;return _0xf2974a;});}})[_0xfb19('0x20')](respondWithFilteredResult(_0x180d06,_0x204e88))[_0xfb19('0x58')](handleError(_0x180d06,null));};exports[_0xfb19('0x6c')]=function(_0x149b0d,_0x27d63f,_0x30b5be){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x149b0d[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x27d63f,null))[_0xfb19('0x20')](function(_0x21a9fa){if(_0x21a9fa){return _0x21a9fa[_0xfb19('0x6c')](_0x149b0d[_0xfb19('0x46')]['ids']);}})[_0xfb19('0x20')](respondWithStatusCode(_0x27d63f,null))[_0xfb19('0x58')](handleError(_0x27d63f,null));};exports[_0xfb19('0x6d')]=function(_0x3b5490,_0x38f8ae,_0x2e1746){var _0x445e3c={'body':_0x3b5490[_0xfb19('0x5a')],'channel':_0xfb19('0x6e')};var _0x10f3f1=[];var _0x2a0a6c=[];var _0x2933d6={};var _0x4e2ff6=![];return db[_0xfb19('0x6f')][_0xfb19('0x61')]()[_0xfb19('0x20')](function(_0x3c54be){if(!_0x3c54be){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x72'));}_0x10f3f1=_['difference'](_['keys'](_0x3c54be),[_0xfb19('0x73'),_0xfb19('0x74')]);_0x2a0a6c=_[_0xfb19('0x75')](_['keys'](_0x3c54be),['createdAt',_0xfb19('0x74'),_0xfb19('0x76'),_0xfb19('0x77')]);if(_0x3b5490[_0xfb19('0x5a')]['id']){delete _0x3b5490['body']['id'];}if(_[_0xfb19('0x78')](_0x3b5490['body'][_0xfb19('0x79')])){throw new db[(_0xfb19('0x70'))]['ValidationError'](_0xfb19('0x7a'));}if(_['isNil'](_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x5a')])||_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x5a')]===''){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x7b'));}if(_['isNil'](_0x3b5490['body']['mapKey'])){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x7c')+_0x2a0a6c);}if(!_[_0xfb19('0x7d')](_0x2a0a6c,_0x3b5490['body'][_0xfb19('0x7e')])){throw new db['Sequelize'][(_0xfb19('0x71'))](_0xfb19('0x7f')+_0x2a0a6c);}_0x2933d6[_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x7e')]]=_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x79')];})[_0xfb19('0x20')](function(){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x3b5490['params']['id']},'include':[{'model':db[_0xfb19('0x80')],'as':_0xfb19('0x81'),'include':[{'model':db['CmContact'],'as':_0xfb19('0x82'),'where':_0x2933d6,'limit':0x1,'order':[[_0xfb19('0x74'),_0xfb19('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0xfb19('0x84')}]});})[_0xfb19('0x20')](handleEntityNotFound(_0x38f8ae,null))['then'](function(_0x53eaee){if(_0x53eaee&&_0x53eaee['List']){_0x445e3c[_0xfb19('0x85')]=_0x53eaee;_0x445e3c[_0xfb19('0x86')]=_0x53eaee[_0xfb19('0x84')];_0x445e3c[_0xfb19('0x87')]=_0x53eaee['List'];_0x445e3c['applications']=_[_0xfb19('0x88')](_0x445e3c[_0xfb19('0x86')],[_0xfb19('0x89')],['asc']);if(_0x445e3c[_0xfb19('0x85')][_0xfb19('0x84')]){delete _0x445e3c[_0xfb19('0x85')]['Applications'];}if(_0x445e3c[_0xfb19('0x85')]['List']&&_0x445e3c[_0xfb19('0x85')][_0xfb19('0x81')][_0xfb19('0x82')][_0xfb19('0x49')]){return _0x445e3c[_0xfb19('0x85')]['List'][_0xfb19('0x82')][0x0];}var _0x50a13c=_[_0xfb19('0x18')](_0x3b5490['body'],{'firstName':_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x79')],'ListId':_0x53eaee[_0xfb19('0x77')]});_0x50a13c[_0x3b5490['body'][_0xfb19('0x7e')]]=_0x3b5490[_0xfb19('0x5a')]['from'];return db[_0xfb19('0x6f')][_0xfb19('0x59')](_0x50a13c,{'fields':_0x10f3f1,'raw':!![]});}})['then'](handleEntityNotFound(_0x38f8ae,null))['then'](function(_0x514208){_0x445e3c[_0xfb19('0x8a')]=_0x514208;if(_0x514208){var _0x27689f={'ContactId':_0x514208['id'],'OpenchannelAccountId':_0x3b5490[_0xfb19('0x56')]['id'],'from':(_0x514208[_0xfb19('0x8b')]||'')+'\x20'+(_0x514208['lastName']||'')};var _0x5d1b21={'OpenchannelAccountId':_0x3b5490[_0xfb19('0x56')]['id'],'closed':![]};if(_0x3b5490['body'][_0xfb19('0x8c')]){_0x5d1b21[_0xfb19('0x8c')]=_0x3b5490[_0xfb19('0x5a')]['threadId'];return db[_0xfb19('0x8d')][_0xfb19('0x5d')]({'where':_0x5d1b21})['then'](function(_0x7b3042){if(_0x7b3042){return[_0x7b3042,![]];}_0x27689f['threadId']=_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x8c')];_0x27689f[_0xfb19('0x8e')]=_0x3b5490['body'][_0xfb19('0x8e')];return db[_0xfb19('0x8d')][_0xfb19('0x59')](_0x27689f)[_0xfb19('0x20')](function(_0x311a21){return[_0x311a21,!![]];});});}else{_0x5d1b21[_0xfb19('0x8c')]=null;}_0x5d1b21[_0xfb19('0x8f')]=_0x514208['id'];return db['OpenchannelInteraction'][_0xfb19('0x5d')]({'where':_0x5d1b21})[_0xfb19('0x20')](function(_0x264308){if(_0x264308){return[_0x264308,![]];}return db['OpenchannelInteraction'][_0xfb19('0x59')](_0x27689f)[_0xfb19('0x20')](function(_0x4f1c27){return[_0x4f1c27,!![]];});});}})[_0xfb19('0x90')](function(_0x5c78c8,_0x714e06){if(_0x5c78c8){_0x4e2ff6=_0x714e06;if(!_0x714e06){var _0x110fbb={'from':(_0x445e3c[_0xfb19('0x8a')][_0xfb19('0x8b')]||'')+'\x20'+(_0x445e3c['contact']['lastName']||'')};if(_0x3b5490['body'][_0xfb19('0x8c')]&&_0x3b5490['body']['messageId']&&_0x3b5490['body']['threadId']!=_0x3b5490[_0xfb19('0x5a')]['messageId']){_0x110fbb[_0xfb19('0x8c')]=_0x3b5490['body'][_0xfb19('0x91')];}return _0x5c78c8[_0xfb19('0x35')](_0x110fbb);}else{return _0x5c78c8;}}})[_0xfb19('0x20')](function(_0x121ff4){_0x445e3c[_0xfb19('0x92')]=_0x121ff4[_0xfb19('0x37')]({'plain':!![]});_0x445e3c[_0xfb19('0x92')][_0xfb19('0x93')]=_0x4e2ff6;if(_0x445e3c[_0xfb19('0x92')][_0xfb19('0x93')]){if(_0x445e3c[_0xfb19('0x85')][_0xfb19('0x94')]){_0x445e3c[_0xfb19('0x86')][_0xfb19('0x95')]({'id':0x0,'priority':_0x445e3c['applications'][_0xfb19('0x49')]+0x1,'app':'close','appdata':_0xfb19('0x96'),'interval':_0xfb19('0x97')});}}return db[_0xfb19('0x98')]['create']({'body':_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x5a')],'OpenchannelAccountId':_0x3b5490[_0xfb19('0x56')]['id'],'OpenchannelInteractionId':_0x121ff4['id'],'direction':'in','ContactId':_0x445e3c['contact']['id'],'AttachmentId':_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x99')]});})['then'](function(_0x4d6f84){_0x445e3c[_0xfb19('0x27')]=_0x4d6f84;if(_0x445e3c['interaction'][_0xfb19('0x9a')]){return db[_0xfb19('0x9b')][_0xfb19('0x5d')]({'attributes':['id',_0xfb19('0x3b')],'where':{'id':_0x445e3c[_0xfb19('0x92')][_0xfb19('0x9a')]}})[_0xfb19('0x20')](function(_0x5c0507){if(_0x5c0507){_0x445e3c['applications'][_0xfb19('0x9c')]({'id':0x0,'priority':0x0,'app':_0xfb19('0x9d'),'appdata':_0x5c0507['name']+','+(_0x445e3c[_0xfb19('0x85')][_0xfb19('0x9e')]||0xa),'interval':_0xfb19('0x97')});_0x445e3c[_0xfb19('0x9f')]=![];}return respondWithRpcPromise(_0xfb19('0xa0'),_0xfb19('0xa1'),_0x445e3c);});}return respondWithRpcPromise(_0xfb19('0xa0'),_0xfb19('0xa1'),_0x445e3c);})['then'](function(_0x182272){respondWithRpcPromise('EventManager','EventManager',{'event':_0xfb19('0x6d'),'message':_0x182272},client9002);return _0x182272;})[_0xfb19('0x20')](respondWithResult(_0x38f8ae,null))['catch'](handleError(_0x38f8ae,null));};exports[_0xfb19('0xa2')]=function(_0x1f1cba,_0x108fc9){var _0x13d954=_0x1f1cba[_0xfb19('0x56')]['id'];var _0x30280b=_0x1f1cba['body'];var _0x29f7a5=0xc8;var _0x4f080e=null;return db[_0xfb19('0xa3')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xfb19('0xa4')]['READ_COMMITTED']},function(_0x573223){return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x13d954},'transaction':_0x573223})[_0xfb19('0x20')](function(_0x3e4a22){if(_0x3e4a22){return db[_0xfb19('0xa5')][_0xfb19('0x36')]({'where':{'OpenchannelAccountId':_0x13d954},'transaction':_0x573223})[_0xfb19('0x20')](function(){var _0x23ace6=_[_0xfb19('0x3f')](_0x30280b,function(_0x2f3670){_0x2f3670[_0xfb19('0x63')]=_0x13d954;return _0x2f3670;});return db['OpenchannelApplication'][_0xfb19('0xa6')](_0x23ace6,{'transaction':_0x573223});});}else{_0x29f7a5=0x194;_0x4f080e=[];}});})[_0xfb19('0x20')](function(){if(_0x29f7a5!==0x194){return db[_0xfb19('0xa5')][_0xfb19('0xa7')]({'where':{'OpenchannelAccountId':_0x13d954},'order':_0xfb19('0x89')})[_0xfb19('0x20')](function(_0x1f83fd){_0x4f080e=_0x1f83fd;});}})[_0xfb19('0x58')](function(_0x38896d){_0x29f7a5=0x1f4;logger[_0xfb19('0x25')](_0x38896d[_0xfb19('0xa8')]);if(_0x38896d[_0xfb19('0x3b')]){delete _0x38896d[_0xfb19('0x3b')];}_0x4f080e=_0x38896d;})['finally'](function(){if(_0x4f080e===null){_0x108fc9['sendStatus'](_0x29f7a5);}else{if(_0x29f7a5===0x1f4){_0x108fc9['status'](_0x29f7a5)[_0xfb19('0x3c')](_0x4f080e);}else{_0x108fc9[_0xfb19('0x2a')](_0x29f7a5)[_0xfb19('0x2b')](_0x4f080e);}}});};exports[_0xfb19('0xa9')]=function(_0x51991,_0x37368d,_0x36905e){var _0x393eba={};var _0x3bb708={};var _0x38943f;var _0x2ec7eb;return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x51991[_0xfb19('0x56')]['id']}})['then'](handleEntityNotFound(_0x37368d,null))[_0xfb19('0x20')](function(_0x17c392){if(_0x17c392){_0x38943f=_0x17c392;_0x3bb708[_0xfb19('0x44')]=_[_0xfb19('0x45')](db['OpenchannelApplication'][_0xfb19('0x41')]);_0x3bb708[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x51991[_0xfb19('0x46')]);_0x3bb708[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x3bb708[_0xfb19('0x44')],_0x3bb708[_0xfb19('0x46')]);_0x393eba[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x3bb708[_0xfb19('0x44')],qs['fields'](_0x51991[_0xfb19('0x46')]['fields']));_0x393eba[_0xfb19('0x48')]=_0x393eba[_0xfb19('0x48')][_0xfb19('0x49')]?_0x393eba[_0xfb19('0x48')]:_0x3bb708[_0xfb19('0x44')];_0x393eba[_0xfb19('0x4b')]=qs['sort'](_0x51991['query'][_0xfb19('0x4c')]);_0x393eba[_0xfb19('0x50')]=qs['filters'](_['pick'](_0x51991['query'],_0x3bb708['filters']));if(_0x51991['query'][_0xfb19('0x4f')]){_0x393eba['where']=_['merge'](_0x393eba['where'],{'$or':_[_0xfb19('0x3f')](_0x393eba[_0xfb19('0x48')],function(_0x221d97){var _0x44ebb8={};_0x44ebb8[_0x221d97]={'$like':'%'+_0x51991[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x44ebb8;})});}_0x393eba=_[_0xfb19('0x51')]({},_0x393eba,_0x51991['options']);return _0x38943f['getApplications'](_0x393eba);}})['then'](function(_0x4a8b4f){if(_0x4a8b4f){_0x2ec7eb=_0x4a8b4f['length'];if(!_0x51991[_0xfb19('0x46')][_0xfb19('0x66')](_0xfb19('0x4a'))){_0x393eba[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x51991[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x393eba[_0xfb19('0x2c')]=qs[_0xfb19('0x2c')](_0x51991[_0xfb19('0x46')][_0xfb19('0x2c')]);}return _0x38943f[_0xfb19('0xa9')](_0x393eba);}})['then'](function(_0x3a2a83){if(_0x3a2a83){return _0x3a2a83?{'count':_0x2ec7eb,'rows':_0x3a2a83}:null;}})[_0xfb19('0x20')](respondWithResult(_0x37368d,null))[_0xfb19('0x58')](handleError(_0x37368d,null));};exports['getInteractions']=function(_0x421c89,_0x3131bd,_0x1f889f){var _0x52be19={'raw':![],'where':{}};var _0x4bab23={};var _0x447fca={'count':0x0,'rows':[]};return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x421c89[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x3131bd,null))[_0xfb19('0x20')](function(_0x247ab1){if(_0x247ab1){_0x4bab23[_0xfb19('0x44')]=_[_0xfb19('0x45')](db[_0xfb19('0x8d')][_0xfb19('0x41')]);_0x4bab23[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x421c89[_0xfb19('0x46')]);_0x4bab23[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x4bab23[_0xfb19('0x44')],_0x4bab23[_0xfb19('0x46')]);_0x52be19[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x4bab23[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x421c89[_0xfb19('0x46')]['fields']));_0x52be19[_0xfb19('0x48')]=_0x52be19['attributes'][_0xfb19('0x49')]?_0x52be19['attributes']:_0x4bab23[_0xfb19('0x44')];if(!_0x421c89['query'][_0xfb19('0x66')](_0xfb19('0x4a'))){_0x52be19[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x421c89[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x52be19['offset']=qs[_0xfb19('0x2c')](_0x421c89[_0xfb19('0x46')]['offset']);}_0x52be19[_0xfb19('0x4b')]=qs['sort'](_0x421c89[_0xfb19('0x46')][_0xfb19('0x4c')]);_0x52be19['where']=qs['filters'](_[_0xfb19('0x4e')](_0x421c89[_0xfb19('0x46')],_0x4bab23[_0xfb19('0x4d')]));_0x52be19['where'][_0xfb19('0x63')]=_0x247ab1['id'];if(_0x421c89[_0xfb19('0x46')]['filter']){_0x52be19[_0xfb19('0x50')]=_['merge'](_0x52be19['where'],{'$or':_['map'](_0x52be19[_0xfb19('0x48')],function(_0x44fa92){var _0x55c614={};_0x55c614[_0x44fa92]={'$like':'%'+_0x421c89[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x55c614;})});}_0x52be19=_[_0xfb19('0x51')]({},_0x52be19,_0x421c89['options']);return db[_0xfb19('0x8d')][_0xfb19('0x2f')]({'where':_0x52be19['where']})['then'](function(_0x21cff2){_0x447fca[_0xfb19('0x2f')]=_0x21cff2;if(_0x421c89[_0xfb19('0x46')][_0xfb19('0x53')]){_0x52be19[_0xfb19('0x54')]=[{'model':db[_0xfb19('0x6f')],'as':'Contact','required':![]},{'model':db[_0xfb19('0x9b')],'as':_0xfb19('0xaa'),'attributes':[_0xfb19('0x3b'),'fullname',_0xfb19('0xab')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x421c89[_0xfb19('0x46')][_0xfb19('0xac')]?{'id':_0x421c89[_0xfb19('0x46')]['tag']}:undefined,'required':_0x421c89[_0xfb19('0x46')]['tag']?!![]:![]}];}return db[_0xfb19('0x8d')]['findAll'](_0x52be19);})['then'](function(_0x27fded){_0x447fca[_0xfb19('0x55')]=_0x27fded;return _0x447fca;});}})[_0xfb19('0x20')](respondWithFilteredResult(_0x3131bd,_0x52be19))[_0xfb19('0x58')](handleError(_0x3131bd,null));};exports[_0xfb19('0xad')]=function(_0x5df668,_0x27a04b,_0xa63c54){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x5df668[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x27a04b,null))[_0xfb19('0x20')](function(_0x4a1728){if(_0x4a1728){return _0x4a1728[_0xfb19('0xad')](_0x5df668[_0xfb19('0x5a')][_0xfb19('0x69')],_['omit'](_0x5df668[_0xfb19('0x5a')],[_0xfb19('0x69'),'id'])||{})['spread'](function(_0x5336e1){for(var _0x56aef5=0x0;_0x56aef5<_0x5df668[_0xfb19('0x5a')]['ids'][_0xfb19('0x49')];_0x56aef5+=0x1){socket[_0xfb19('0xae')](_0xfb19('0xaf'),{'UserId':Number(_0x5df668[_0xfb19('0x5a')][_0xfb19('0x69')][_0x56aef5]),'OpenchannelAccountId':Number(_0x5df668[_0xfb19('0x56')]['id'])});}return _0x5336e1;});}})[_0xfb19('0x20')](respondWithResult(_0x27a04b,null))[_0xfb19('0x58')](handleError(_0x27a04b,null));};exports[_0xfb19('0xb0')]=function(_0x35bdae,_0x1bc07f,_0xf884ff){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x35bdae[_0xfb19('0x56')]['id']}})['then'](handleEntityNotFound(_0x1bc07f,null))['then'](function(_0x2d73eb){if(_0x2d73eb){return _0x2d73eb[_0xfb19('0xb0')](_0x35bdae[_0xfb19('0x46')][_0xfb19('0x69')])[_0xfb19('0x20')](function(){if(_[_0xfb19('0xb1')](_0x35bdae[_0xfb19('0x46')][_0xfb19('0x69')])){for(var _0x4fba79=0x0;_0x4fba79<_0x35bdae['query'][_0xfb19('0x69')][_0xfb19('0x49')];_0x4fba79+=0x1){socket[_0xfb19('0xae')]('userOpenchannelAccount:remove',{'UserId':Number(_0x35bdae['query'][_0xfb19('0x69')][_0x4fba79]),'OpenchannelAccountId':Number(_0x35bdae[_0xfb19('0x56')]['id'])});}}else{socket[_0xfb19('0xae')](_0xfb19('0xb2'),{'UserId':Number(_0x35bdae[_0xfb19('0x46')][_0xfb19('0x69')]),'OpenchannelAccountId':Number(_0x35bdae['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1bc07f,null))[_0xfb19('0x58')](handleError(_0x1bc07f,null));};exports[_0xfb19('0xb3')]=function(_0x5a38d3,_0x58724f,_0x13d3e5){var _0xac7ed7={};var _0x9fb537={};var _0x1f1355;var _0x4b4cde;return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x5a38d3[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x58724f,null))[_0xfb19('0x20')](function(_0x592f53){if(_0x592f53){_0x1f1355=_0x592f53;_0x9fb537[_0xfb19('0x44')]=_[_0xfb19('0x45')](db[_0xfb19('0x9b')][_0xfb19('0x41')]);_0x9fb537[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x5a38d3[_0xfb19('0x46')]);_0x9fb537[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x9fb537['model'],_0x9fb537[_0xfb19('0x46')]);_0xac7ed7[_0xfb19('0x48')]=_['intersection'](_0x9fb537[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x57')]));_0xac7ed7[_0xfb19('0x48')]=_0xac7ed7[_0xfb19('0x48')]['length']?_0xac7ed7['attributes']:_0x9fb537[_0xfb19('0x44')];_0xac7ed7[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x4c')]);_0xac7ed7[_0xfb19('0x50')]=qs[_0xfb19('0x4d')](_[_0xfb19('0x4e')](_0x5a38d3['query'],_0x9fb537[_0xfb19('0x4d')]));if(_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x4f')]){_0xac7ed7[_0xfb19('0x50')]=_[_0xfb19('0x51')](_0xac7ed7['where'],{'$or':_['map'](_0xac7ed7['attributes'],function(_0x2ad1d5){var _0x4ce38f={};_0x4ce38f[_0x2ad1d5]={'$like':'%'+_0x5a38d3[_0xfb19('0x46')]['filter']+'%'};return _0x4ce38f;})});}_0xac7ed7=_[_0xfb19('0x51')]({},_0xac7ed7,_0x5a38d3['options']);return _0x1f1355[_0xfb19('0xb3')](_0xac7ed7);}})[_0xfb19('0x20')](function(_0x3ec321){if(_0x3ec321){_0x4b4cde=_0x3ec321[_0xfb19('0x49')];if(!_0x5a38d3[_0xfb19('0x46')]['hasOwnProperty'](_0xfb19('0x4a'))){_0xac7ed7[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x2d')]);_0xac7ed7[_0xfb19('0x2c')]=qs['offset'](_0x5a38d3['query'][_0xfb19('0x2c')]);}return _0x1f1355[_0xfb19('0xb3')](_0xac7ed7);}})['then'](function(_0x548d9f){if(_0x548d9f){return _0x548d9f?{'count':_0x4b4cde,'rows':_0x548d9f}:null;}})['then'](respondWithResult(_0x58724f,null))['catch'](handleError(_0x58724f,null));};exports['send']=function(_0x43a8c5,_0x208792,_0x4c7968){var _0x8054d6,_0x4efdbe,_0xf4f99f;if(_[_0xfb19('0x78')](_0x43a8c5[_0xfb19('0x5a')][_0xfb19('0x5a')])||_0x43a8c5[_0xfb19('0x5a')]['body']===''){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x7b'));}if(_[_0xfb19('0x78')](_0x43a8c5[_0xfb19('0x5a')]['to'])){}_0x8054d6=_0x43a8c5[_0xfb19('0x5a')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x43a8c5['params']['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x208792,null))['then'](function(_0x524d83){if(_0x524d83){return db['OpenchannelAccount'][_0xfb19('0x5d')]({'where':{'id':_0x524d83['id']},'include':[{'model':db[_0xfb19('0x80')],'as':_0xfb19('0x81'),'include':[{'model':db['CmContact'],'as':_0xfb19('0x82'),'where':{[_0x524d83[_0xfb19('0x7e')]]:_0x8054d6},'limit':0x1,'order':[[_0xfb19('0x74'),_0xfb19('0x83')]]}]}]})[_0xfb19('0x20')](handleEntityNotFound(_0x208792,null))[_0xfb19('0x20')](function(_0x16e983){if(_0x16e983&&_0x16e983[_0xfb19('0x81')]){_0x4efdbe=_0x16e983[_0xfb19('0x37')]({'plain':!![]});if(_0x4efdbe[_0xfb19('0x81')]&&_0x4efdbe['List'][_0xfb19('0x82')]['length']){return _0x4efdbe[_0xfb19('0x81')][_0xfb19('0x82')][0x0];}return db[_0xfb19('0x6f')][_0xfb19('0x59')](_['defaults'](_0x43a8c5[_0xfb19('0x5a')],{'firstName':_0x8054d6,[_0x16e983[_0xfb19('0x7e')]]:_0x8054d6,'phone':_0x8054d6,'ListId':_0x4efdbe[_0xfb19('0x77')]}));}})[_0xfb19('0x20')](handleEntityNotFound(_0x208792,null))['then'](function(_0x5d4f74){if(_0x5d4f74){_0xf4f99f=_0x5d4f74;return db[_0xfb19('0x8d')][_0xfb19('0x5d')]({'where':{'ContactId':_0xf4f99f['id'],'closed':![],'OpenchannelAccountId':_0x4efdbe['id']}})[_0xfb19('0x20')](function(_0x2abe28){if(_0x2abe28){return[_0x2abe28,![]];}return db[_0xfb19('0x8d')][_0xfb19('0x59')]({'UserId':_0x43a8c5[_0xfb19('0x5b')]['id'],'ContactId':_0xf4f99f['id'],'OpenchannelAccountId':_0x4efdbe['id'],'lastMsgDirection':'out','firstMsgDirection':_0xfb19('0xb4'),'Messages':[_['merge'](_0x43a8c5[_0xfb19('0x5a')],{'read':![],'body':_0x43a8c5[_0xfb19('0x5a')][_0xfb19('0x5a')],'OpenchannelAccountId':_0x4efdbe['id'],'UserId':_0x43a8c5['user']['id'],'ContactId':_0xf4f99f['id']})]},{'include':[{'model':db[_0xfb19('0x98')],'as':'Messages'}]})[_0xfb19('0x20')](function(_0x4c2b33){return[_0x4c2b33,!![]];});});}})[_0xfb19('0x90')](function(_0x3fe5ee,_0x9a1add){if(_0x9a1add){return _0x3fe5ee;}return db[_0xfb19('0x98')]['create'](_[_0xfb19('0x51')](_0x43a8c5[_0xfb19('0x5a')],{'read':![],'body':_0x43a8c5[_0xfb19('0x5a')][_0xfb19('0x5a')],'OpenchannelAccountId':_0x4efdbe['id'],'OpenchannelInteractionId':_0x3fe5ee['id'],'UserId':_0x43a8c5[_0xfb19('0x5b')]['id'],'ContactId':_0xf4f99f['id']}))[_0xfb19('0x20')](function(_0x17c607){_0x3fe5ee[_0xfb19('0xb5')]['Messages']=[];_0x3fe5ee[_0xfb19('0xb5')][_0xfb19('0xb6')][_0xfb19('0x95')](_0x17c607['dataValues']);return _0x3fe5ee;});});}})[_0xfb19('0x20')](respondWithResult(_0x208792,null))['catch'](handleError(_0x208792,null));}; \ No newline at end of file +var _0x98e1=['error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','OpenchannelAccounts','UserProfileResource','status','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','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','update','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','openchannel','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','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','List','Applications','account','applications','list','orderBy','asc','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1dc15f,_0xbd7f8f){var _0xd0a506=function(_0x569a7b){while(--_0x569a7b){_0x1dc15f['push'](_0x1dc15f['shift']());}};_0xd0a506(++_0xbd7f8f);}(_0x98e1,0x160));var _0x198e=function(_0x433b4a,_0x55aac9){_0x433b4a=_0x433b4a-0x0;var _0x148c46=_0x98e1[_0x433b4a];return _0x148c46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x198e('0x0'));var zipdir=require(_0x198e('0x1'));var jsonpatch=require(_0x198e('0x2'));var rp=require(_0x198e('0x3'));var moment=require('moment');var BPromise=require(_0x198e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x198e('0x5'));var sox=require(_0x198e('0x6'));var csv=require(_0x198e('0x7'));var ejs=require(_0x198e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x198e('0x9'));var crypto=require('crypto');var jsforce=require(_0x198e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x198e('0x7'));var querystring=require(_0x198e('0xb'));var Papa=require(_0x198e('0xc'));var Redis=require(_0x198e('0xd'));var authService=require(_0x198e('0xe'));var qs=require(_0x198e('0xf'));var as=require(_0x198e('0x10'));var hardwareService=require(_0x198e('0x11'));var logger=require(_0x198e('0x12'))('api');var utils=require(_0x198e('0x13'));var config=require(_0x198e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x198e('0x15'))['db'];config['redis']=_[_0x198e('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x198e('0x17'))[_0x198e('0x18')](socket);var jayson=require(_0x198e('0x19'));var client=jayson['client'][_0x198e('0x1a')]({'port':0x232c});var client9002=jayson[_0x198e('0x1b')][_0x198e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5035de,_0x53e4c1,_0x5bb7dc,_0x47de0c){return new BPromise(function(_0x57f15e,_0x227e0f){var _0x58de5f=_0x47de0c||client;return _0x58de5f['request'](_0x5035de,_0x5bb7dc)[_0x198e('0x1c')](function(_0x46c980){logger[_0x198e('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x53e4c1,_0x198e('0x1e'));logger[_0x198e('0x1f')](_0x198e('0x20'),_0x53e4c1,_0x198e('0x1e'),JSON[_0x198e('0x21')](_0x46c980));if(_0x46c980['error']){if(_0x46c980[_0x198e('0x22')][_0x198e('0x23')]===0x1f4){logger['error'](_0x198e('0x24'),_0x53e4c1,_0x46c980[_0x198e('0x22')][_0x198e('0x25')]);return _0x227e0f(_0x46c980[_0x198e('0x22')][_0x198e('0x25')]);}logger[_0x198e('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x53e4c1,_0x46c980[_0x198e('0x22')][_0x198e('0x25')]);return _0x57f15e(_0x46c980[_0x198e('0x22')][_0x198e('0x25')]);}else{logger[_0x198e('0x1d')](_0x198e('0x24'),_0x53e4c1,_0x198e('0x1e'));_0x57f15e(_0x46c980['result'][_0x198e('0x25')]);}})[_0x198e('0x26')](function(_0x1fceba){logger[_0x198e('0x22')](_0x198e('0x24'),_0x53e4c1,_0x1fceba);_0x227e0f(_0x1fceba);});});}function respondWithStatusCode(_0x2c27c0,_0x302771){_0x302771=_0x302771||0xcc;return function(_0x436992){if(_0x436992){return _0x2c27c0[_0x198e('0x27')](_0x302771);}return _0x2c27c0['status'](_0x302771)['end']();};}function respondWithResult(_0x10cf39,_0x1a249c){_0x1a249c=_0x1a249c||0xc8;return function(_0x5a5bf3){if(_0x5a5bf3){return _0x10cf39['status'](_0x1a249c)[_0x198e('0x28')](_0x5a5bf3);}};}function respondWithFilteredResult(_0x1962ea,_0x337c73){return function(_0x505dd8){if(_0x505dd8){var _0x5e657e=typeof _0x337c73[_0x198e('0x29')]===_0x198e('0x2a')&&typeof _0x337c73[_0x198e('0x2b')]===_0x198e('0x2a');var _0x19a288=_0x505dd8[_0x198e('0x2c')];var _0x3525d5=_0x5e657e?0x0:_0x337c73[_0x198e('0x29')];var _0x5d9df9=_0x5e657e?_0x505dd8[_0x198e('0x2c')]:_0x337c73[_0x198e('0x29')]+_0x337c73[_0x198e('0x2b')];var _0x4ff53f;if(_0x5d9df9>=_0x19a288){_0x5d9df9=_0x19a288;_0x4ff53f=0xc8;}else{_0x4ff53f=0xce;}_0x1962ea['status'](_0x4ff53f);return _0x1962ea[_0x198e('0x2d')](_0x198e('0x2e'),_0x3525d5+'-'+_0x5d9df9+'/'+_0x19a288)['json'](_0x505dd8);}return null;};}function patchUpdates(_0x254123){return function(_0x76acf9){try{jsonpatch[_0x198e('0x2f')](_0x76acf9,_0x254123,!![]);}catch(_0xddab7c){return BPromise[_0x198e('0x30')](_0xddab7c);}return _0x76acf9['save']();};}function saveUpdates(_0x50a681,_0x157983){return function(_0x58b4dd){if(_0x58b4dd){return _0x58b4dd['update'](_0x50a681)['then'](function(_0x122eb9){return _0x122eb9;});}return null;};}function removeEntity(_0xafc6ff,_0x5a6b20){return function(_0x404a83){if(_0x404a83){return _0x404a83[_0x198e('0x31')]()[_0x198e('0x1c')](function(){var _0x545dfb=_0x404a83[_0x198e('0x32')]({'plain':!![]});var _0x353ead=_0x198e('0x33');return db[_0x198e('0x34')][_0x198e('0x31')]({'where':{'type':_0x353ead,'resourceId':_0x545dfb['id']}})[_0x198e('0x1c')](function(){return _0x404a83;});})[_0x198e('0x1c')](function(){_0xafc6ff[_0x198e('0x35')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25a2cc,_0xb72b6b){return function(_0x39bcff){if(!_0x39bcff){_0x25a2cc[_0x198e('0x27')](0x194);}return _0x39bcff;};}function handleError(_0x296558,_0xcabceb){_0xcabceb=_0xcabceb||0x1f4;return function(_0x33f003){logger[_0x198e('0x22')](_0x33f003[_0x198e('0x36')]);if(_0x33f003[_0x198e('0x37')]){delete _0x33f003['name'];}_0x296558[_0x198e('0x35')](_0xcabceb)[_0x198e('0x38')](_0x33f003);};}exports[_0x198e('0x39')]=function(_0x31b8c3,_0x3a6910){var _0x1e5ea8={'include':[{'model':db[_0x198e('0x3a')],'as':_0x198e('0x3b')}]},_0x195c4b={},_0x58ffb6={'count':0x0,'rows':[]};var _0x4d927f=_[_0x198e('0x3c')](db[_0x198e('0x3d')][_0x198e('0x3e')],function(_0x30c779){return{'name':_0x30c779[_0x198e('0x3f')],'type':_0x30c779['type'][_0x198e('0x40')]};});_0x195c4b[_0x198e('0x41')]=_['map'](_0x4d927f,_0x198e('0x37'));_0x195c4b[_0x198e('0x42')]=_[_0x198e('0x43')](_0x31b8c3['query']);_0x195c4b['filters']=_[_0x198e('0x44')](_0x195c4b[_0x198e('0x41')],_0x195c4b[_0x198e('0x42')]);_0x1e5ea8[_0x198e('0x45')]=_['intersection'](_0x195c4b['model'],qs[_0x198e('0x46')](_0x31b8c3[_0x198e('0x42')][_0x198e('0x46')]));_0x1e5ea8['attributes']=_0x1e5ea8['attributes']['length']?_0x1e5ea8[_0x198e('0x45')]:_0x195c4b[_0x198e('0x41')];if(!_0x31b8c3[_0x198e('0x42')][_0x198e('0x47')](_0x198e('0x48'))){_0x1e5ea8[_0x198e('0x2b')]=qs[_0x198e('0x2b')](_0x31b8c3[_0x198e('0x42')][_0x198e('0x2b')]);_0x1e5ea8[_0x198e('0x29')]=qs[_0x198e('0x29')](_0x31b8c3[_0x198e('0x42')][_0x198e('0x29')]);}_0x1e5ea8[_0x198e('0x49')]=qs[_0x198e('0x4a')](_0x31b8c3['query'][_0x198e('0x4a')]);_0x1e5ea8['where']=qs[_0x198e('0x4b')](_[_0x198e('0x4c')](_0x31b8c3[_0x198e('0x42')],_0x195c4b['filters']),_0x4d927f);if(_0x31b8c3[_0x198e('0x42')]['filter']){_0x1e5ea8[_0x198e('0x4d')]=_[_0x198e('0x4e')](_0x1e5ea8[_0x198e('0x4d')],{'$or':_[_0x198e('0x3c')](_0x4d927f,function(_0x15b14a){if(_0x15b14a[_0x198e('0x4f')]!==_0x198e('0x50')){var _0x5db967={};_0x5db967[_0x15b14a[_0x198e('0x37')]]={'$like':'%'+_0x31b8c3[_0x198e('0x42')][_0x198e('0x51')]+'%'};return _0x5db967;}})});}_0x1e5ea8=_[_0x198e('0x4e')]({},_0x1e5ea8,_0x31b8c3[_0x198e('0x52')]);var _0x3528c1={'where':_0x1e5ea8[_0x198e('0x4d')]};return db[_0x198e('0x3d')][_0x198e('0x2c')](_0x3528c1)[_0x198e('0x1c')](function(_0x1f1029){_0x58ffb6[_0x198e('0x2c')]=_0x1f1029;if(_0x31b8c3['query'][_0x198e('0x53')]){_0x1e5ea8[_0x198e('0x54')]=[{'all':!![]}];}return db[_0x198e('0x3d')][_0x198e('0x55')](_0x1e5ea8);})[_0x198e('0x1c')](function(_0x462a62){_0x58ffb6[_0x198e('0x56')]=_0x462a62;return _0x58ffb6;})[_0x198e('0x1c')](respondWithFilteredResult(_0x3a6910,_0x1e5ea8))['catch'](handleError(_0x3a6910,null));};exports[_0x198e('0x57')]=function(_0x31ad8c,_0x5a7984){var _0x1136ba={'raw':![],'where':{'id':_0x31ad8c[_0x198e('0x58')]['id']},'include':[{'model':db[_0x198e('0x3a')],'as':_0x198e('0x3b')}]},_0x5a3d94={};_0x5a3d94[_0x198e('0x41')]=_['keys'](db['OpenchannelAccount'][_0x198e('0x3e')]);_0x5a3d94[_0x198e('0x42')]=_['keys'](_0x31ad8c[_0x198e('0x42')]);_0x5a3d94['filters']=_['intersection'](_0x5a3d94[_0x198e('0x41')],_0x5a3d94[_0x198e('0x42')]);_0x1136ba[_0x198e('0x45')]=_[_0x198e('0x44')](_0x5a3d94[_0x198e('0x41')],qs['fields'](_0x31ad8c['query'][_0x198e('0x46')]));_0x1136ba[_0x198e('0x45')]=_0x1136ba[_0x198e('0x45')][_0x198e('0x59')]?_0x1136ba[_0x198e('0x45')]:_0x5a3d94['model'];if(_0x31ad8c[_0x198e('0x42')][_0x198e('0x53')]){_0x1136ba[_0x198e('0x54')]=[{'all':!![]}];}_0x1136ba=_['merge']({},_0x1136ba,_0x31ad8c[_0x198e('0x52')]);return db[_0x198e('0x3d')][_0x198e('0x5a')](_0x1136ba)[_0x198e('0x1c')](handleEntityNotFound(_0x5a7984,null))['then'](respondWithResult(_0x5a7984,null))['catch'](handleError(_0x5a7984,null));};exports['create']=function(_0x3a53e8,_0x490d46){return db['OpenchannelAccount'][_0x198e('0x5b')](_0x3a53e8[_0x198e('0x5c')],{})[_0x198e('0x1c')](function(_0x491c62){var _0x51f022=_0x3a53e8[_0x198e('0x5d')]['get']({'plain':!![]});if(!_0x51f022)throw new Error(_0x198e('0x5e'));if(_0x51f022[_0x198e('0x5f')]==='user'){var _0x4d6128=_0x491c62['get']({'plain':!![]});var _0x5ad266=_0x198e('0x33');return db[_0x198e('0x60')][_0x198e('0x5a')]({'where':{'name':_0x5ad266,'userProfileId':_0x51f022[_0x198e('0x61')]},'raw':!![]})[_0x198e('0x1c')](function(_0x548e93){if(_0x548e93&&_0x548e93[_0x198e('0x62')]===0x0){return db[_0x198e('0x34')]['create']({'name':_0x4d6128[_0x198e('0x37')],'resourceId':_0x4d6128['id'],'type':_0x548e93['name'],'sectionId':_0x548e93['id']},{})[_0x198e('0x1c')](function(){return _0x491c62;});}else{return _0x491c62;}})[_0x198e('0x26')](function(_0x3f2324){logger[_0x198e('0x22')](_0x198e('0x63'),_0x3f2324);throw _0x3f2324;});}return _0x491c62;})[_0x198e('0x1c')](respondWithResult(_0x490d46,0xc9))['catch'](handleError(_0x490d46,null));};exports[_0x198e('0x64')]=function(_0x3584e1,_0x5444d0){if(_0x3584e1[_0x198e('0x5c')]['id']){delete _0x3584e1['body']['id'];}return db[_0x198e('0x3d')][_0x198e('0x5a')]({'where':{'id':_0x3584e1['params']['id']},'include':[{'model':db['Pause'],'as':_0x198e('0x3b')}]})[_0x198e('0x1c')](handleEntityNotFound(_0x5444d0,null))[_0x198e('0x1c')](saveUpdates(_0x3584e1[_0x198e('0x5c')],null))['then'](respondWithResult(_0x5444d0,null))[_0x198e('0x26')](handleError(_0x5444d0,null));};exports[_0x198e('0x31')]=function(_0x4e9ec2,_0x422250){return db[_0x198e('0x3d')][_0x198e('0x5a')]({'where':{'id':_0x4e9ec2[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x422250,null))[_0x198e('0x1c')](removeEntity(_0x422250,null))[_0x198e('0x26')](handleError(_0x422250,null));};exports[_0x198e('0x65')]=function(_0x262ec6,_0x288422){return db['OpenchannelAccount']['describe']()[_0x198e('0x1c')](respondWithResult(_0x288422,null))['catch'](handleError(_0x288422,null));};exports[_0x198e('0x66')]=function(_0x25957d,_0x854fce,_0x5cb22d){if(_0x25957d[_0x198e('0x5c')]['id']){delete _0x25957d[_0x198e('0x5c')]['id'];}return db[_0x198e('0x3d')][_0x198e('0x5a')]({'where':{'id':_0x25957d['params']['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x854fce,null))[_0x198e('0x1c')](function(_0x586201){if(_0x586201){_0x25957d['body'][_0x198e('0x67')]=_0x586201['id'];return db[_0x198e('0x68')][_0x198e('0x5b')](_0x25957d[_0x198e('0x5c')]);}})[_0x198e('0x1c')](respondWithResult(_0x854fce,null))[_0x198e('0x26')](handleError(_0x854fce,null));};exports['getDispositions']=function(_0xbaa0f4,_0x5ce2e7,_0x4bc871){var _0x93fa07={'raw':![],'where':{}};var _0x204d6c={};var _0x3f3872={'count':0x0,'rows':[]};return db[_0x198e('0x3d')][_0x198e('0x69')]({'where':{'id':_0xbaa0f4[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x5ce2e7,null))[_0x198e('0x1c')](function(_0x2997c6){if(_0x2997c6){_0x204d6c[_0x198e('0x41')]=_[_0x198e('0x43')](db['Disposition']['rawAttributes']);_0x204d6c[_0x198e('0x42')]=_[_0x198e('0x43')](_0xbaa0f4[_0x198e('0x42')]);_0x204d6c[_0x198e('0x4b')]=_[_0x198e('0x44')](_0x204d6c[_0x198e('0x41')],_0x204d6c[_0x198e('0x42')]);_0x93fa07[_0x198e('0x45')]=_[_0x198e('0x44')](_0x204d6c[_0x198e('0x41')],qs[_0x198e('0x46')](_0xbaa0f4[_0x198e('0x42')][_0x198e('0x46')]));_0x93fa07[_0x198e('0x45')]=_0x93fa07[_0x198e('0x45')][_0x198e('0x59')]?_0x93fa07[_0x198e('0x45')]:_0x204d6c[_0x198e('0x41')];if(!_0xbaa0f4[_0x198e('0x42')][_0x198e('0x47')](_0x198e('0x48'))){_0x93fa07[_0x198e('0x2b')]=qs['limit'](_0xbaa0f4[_0x198e('0x42')][_0x198e('0x2b')]);_0x93fa07[_0x198e('0x29')]=qs[_0x198e('0x29')](_0xbaa0f4[_0x198e('0x42')][_0x198e('0x29')]);}_0x93fa07['order']=qs['sort'](_0xbaa0f4[_0x198e('0x42')][_0x198e('0x4a')]);_0x93fa07[_0x198e('0x4d')]=qs[_0x198e('0x4b')](_[_0x198e('0x4c')](_0xbaa0f4['query'],_0x204d6c[_0x198e('0x4b')]));_0x93fa07[_0x198e('0x4d')][_0x198e('0x67')]=_0x2997c6['id'];if(_0xbaa0f4['query'][_0x198e('0x51')]){_0x93fa07[_0x198e('0x4d')]=_[_0x198e('0x4e')](_0x93fa07[_0x198e('0x4d')],{'$or':_[_0x198e('0x3c')](_0x93fa07['attributes'],function(_0x273f23){var _0x187ca6={};_0x187ca6[_0x273f23]={'$like':'%'+_0xbaa0f4[_0x198e('0x42')][_0x198e('0x51')]+'%'};return _0x187ca6;})});}_0x93fa07=_[_0x198e('0x4e')]({},_0x93fa07,_0xbaa0f4[_0x198e('0x52')]);return db[_0x198e('0x68')][_0x198e('0x2c')]({'where':_0x93fa07['where']})[_0x198e('0x1c')](function(_0x25cc34){_0x3f3872[_0x198e('0x2c')]=_0x25cc34;if(_0xbaa0f4[_0x198e('0x42')][_0x198e('0x53')]){_0x93fa07[_0x198e('0x54')]=[{'all':!![]}];}return db[_0x198e('0x68')][_0x198e('0x55')](_0x93fa07);})[_0x198e('0x1c')](function(_0x1c5c8b){_0x3f3872[_0x198e('0x56')]=_0x1c5c8b;return _0x3f3872;});}})[_0x198e('0x1c')](respondWithFilteredResult(_0x5ce2e7,_0x93fa07))[_0x198e('0x26')](handleError(_0x5ce2e7,null));};exports[_0x198e('0x6a')]=function(_0x17a26,_0x5e2757,_0x55db37){return db['OpenchannelAccount'][_0x198e('0x5a')]({'where':{'id':_0x17a26[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x5e2757,null))[_0x198e('0x1c')](function(_0x1f6702){if(_0x1f6702){return _0x1f6702['removeDispositions'](_0x17a26['query']['ids']);}})['then'](respondWithStatusCode(_0x5e2757,null))[_0x198e('0x26')](handleError(_0x5e2757,null));};exports[_0x198e('0x6b')]=function(_0x2bcb57,_0x59f8c9,_0x314014){if(_0x2bcb57[_0x198e('0x5c')]['id']){delete _0x2bcb57[_0x198e('0x5c')]['id'];}return db[_0x198e('0x3d')]['find']({'where':{'id':_0x2bcb57[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x59f8c9,null))[_0x198e('0x1c')](function(_0x2398f2){if(_0x2398f2){_0x2bcb57[_0x198e('0x5c')][_0x198e('0x67')]=_0x2398f2['id'];return db[_0x198e('0x6c')][_0x198e('0x5b')](_0x2bcb57['body']);}})['then'](respondWithResult(_0x59f8c9,null))[_0x198e('0x26')](handleError(_0x59f8c9,null));};exports[_0x198e('0x6d')]=function(_0x1b497d,_0xb73b5,_0x54063e){var _0x116556={'raw':![],'where':{}};var _0x380473={};var _0x48c3ea={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1b497d[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0xb73b5,null))[_0x198e('0x1c')](function(_0x5a663e){if(_0x5a663e){_0x380473[_0x198e('0x41')]=_[_0x198e('0x43')](db[_0x198e('0x6c')][_0x198e('0x3e')]);_0x380473['query']=_[_0x198e('0x43')](_0x1b497d[_0x198e('0x42')]);_0x380473[_0x198e('0x4b')]=_[_0x198e('0x44')](_0x380473[_0x198e('0x41')],_0x380473['query']);_0x116556['attributes']=_[_0x198e('0x44')](_0x380473[_0x198e('0x41')],qs[_0x198e('0x46')](_0x1b497d[_0x198e('0x42')][_0x198e('0x46')]));_0x116556[_0x198e('0x45')]=_0x116556['attributes'][_0x198e('0x59')]?_0x116556[_0x198e('0x45')]:_0x380473[_0x198e('0x41')];if(!_0x1b497d['query']['hasOwnProperty']('nolimit')){_0x116556[_0x198e('0x2b')]=qs[_0x198e('0x2b')](_0x1b497d[_0x198e('0x42')]['limit']);_0x116556[_0x198e('0x29')]=qs[_0x198e('0x29')](_0x1b497d[_0x198e('0x42')]['offset']);}_0x116556[_0x198e('0x49')]=qs[_0x198e('0x4a')](_0x1b497d['query'][_0x198e('0x4a')]);_0x116556['where']=qs[_0x198e('0x4b')](_[_0x198e('0x4c')](_0x1b497d['query'],_0x380473[_0x198e('0x4b')]));_0x116556[_0x198e('0x4d')]['OpenchannelAccountId']=_0x5a663e['id'];if(_0x1b497d[_0x198e('0x42')][_0x198e('0x51')]){_0x116556[_0x198e('0x4d')]=_['merge'](_0x116556[_0x198e('0x4d')],{'$or':_['map'](_0x116556[_0x198e('0x45')],function(_0x4ed315){var _0x363db4={};_0x363db4[_0x4ed315]={'$like':'%'+_0x1b497d['query']['filter']+'%'};return _0x363db4;})});}_0x116556=_[_0x198e('0x4e')]({},_0x116556,_0x1b497d['options']);return db[_0x198e('0x6c')][_0x198e('0x2c')]({'where':_0x116556[_0x198e('0x4d')]})['then'](function(_0x5453be){_0x48c3ea[_0x198e('0x2c')]=_0x5453be;if(_0x1b497d['query']['includeAll']){_0x116556[_0x198e('0x54')]=[{'all':!![]}];}return db[_0x198e('0x6c')]['findAll'](_0x116556);})[_0x198e('0x1c')](function(_0x4adccd){_0x48c3ea[_0x198e('0x56')]=_0x4adccd;return _0x48c3ea;});}})['then'](respondWithFilteredResult(_0xb73b5,_0x116556))[_0x198e('0x26')](handleError(_0xb73b5,null));};exports[_0x198e('0x6e')]=function(_0x56169d,_0x1147df,_0x48e68){return db[_0x198e('0x3d')]['find']({'where':{'id':_0x56169d['params']['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x1147df,null))[_0x198e('0x1c')](function(_0x234420){if(_0x234420){return _0x234420[_0x198e('0x6e')](_0x56169d['query'][_0x198e('0x6f')]);}})[_0x198e('0x1c')](respondWithStatusCode(_0x1147df,null))[_0x198e('0x26')](handleError(_0x1147df,null));};exports['notify']=function(_0x524ad5,_0x148574,_0x347803){var _0x126703={'body':_0x524ad5[_0x198e('0x5c')],'channel':_0x198e('0x70')};var _0x3b62c7=[];var _0x2dbffc=[];var _0xb33f08={};var _0x9ab2ca=![];return db[_0x198e('0x71')]['describe']()[_0x198e('0x1c')](function(_0x230c6a){if(!_0x230c6a){throw new db[(_0x198e('0x72'))][(_0x198e('0x73'))]('no\x20available\x20attributes');}_0x3b62c7=_['difference'](_[_0x198e('0x43')](_0x230c6a),[_0x198e('0x74'),_0x198e('0x75')]);_0x2dbffc=_[_0x198e('0x76')](_[_0x198e('0x43')](_0x230c6a),[_0x198e('0x74'),'updatedAt',_0x198e('0x77'),_0x198e('0x78')]);if(_0x524ad5[_0x198e('0x5c')]['id']){delete _0x524ad5[_0x198e('0x5c')]['id'];}if(_[_0x198e('0x79')](_0x524ad5[_0x198e('0x5c')][_0x198e('0x7a')])){throw new db['Sequelize'][(_0x198e('0x73'))](_0x198e('0x7b'));}if(_[_0x198e('0x79')](_0x524ad5[_0x198e('0x5c')][_0x198e('0x5c')])||_0x524ad5[_0x198e('0x5c')]['body']===''){throw new db[(_0x198e('0x72'))][(_0x198e('0x73'))](_0x198e('0x7c'));}if(_[_0x198e('0x79')](_0x524ad5['body'][_0x198e('0x7d')])){throw new db['Sequelize'][(_0x198e('0x73'))](_0x198e('0x7e')+_0x2dbffc);}if(!_['includes'](_0x2dbffc,_0x524ad5[_0x198e('0x5c')][_0x198e('0x7d')])){throw new db[(_0x198e('0x72'))][(_0x198e('0x73'))](_0x198e('0x7f')+_0x2dbffc);}_0xb33f08[_0x524ad5['body']['mapKey']]=_0x524ad5[_0x198e('0x5c')][_0x198e('0x7a')];})[_0x198e('0x1c')](function(){return db[_0x198e('0x3d')][_0x198e('0x5a')]({'where':{'id':_0x524ad5['params']['id']},'include':[{'model':db[_0x198e('0x80')],'as':_0x198e('0x81'),'include':[{'model':db[_0x198e('0x71')],'as':'Contacts','where':_0xb33f08,'limit':0x1,'order':[[_0x198e('0x75'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x198e('0x82')}]});})[_0x198e('0x1c')](handleEntityNotFound(_0x148574,null))['then'](function(_0x2d159e){if(_0x2d159e&&_0x2d159e[_0x198e('0x81')]){_0x126703[_0x198e('0x83')]=_0x2d159e;_0x126703[_0x198e('0x84')]=_0x2d159e[_0x198e('0x82')];_0x126703[_0x198e('0x85')]=_0x2d159e[_0x198e('0x81')];_0x126703['applications']=_[_0x198e('0x86')](_0x126703[_0x198e('0x84')],['priority'],[_0x198e('0x87')]);if(_0x126703[_0x198e('0x83')][_0x198e('0x82')]){delete _0x126703[_0x198e('0x83')][_0x198e('0x82')];}if(_0x126703[_0x198e('0x83')][_0x198e('0x81')]&&_0x126703[_0x198e('0x83')][_0x198e('0x81')]['Contacts'][_0x198e('0x59')]){return _0x126703['account']['List'][_0x198e('0x88')][0x0];}var _0x45c476=_[_0x198e('0x16')](_0x524ad5['body'],{'firstName':_0x524ad5[_0x198e('0x5c')]['from'],'ListId':_0x2d159e[_0x198e('0x78')]});_0x45c476[_0x524ad5[_0x198e('0x5c')][_0x198e('0x7d')]]=_0x524ad5['body']['from'];return db[_0x198e('0x71')][_0x198e('0x5b')](_0x45c476,{'fields':_0x3b62c7,'raw':!![]});}})[_0x198e('0x1c')](handleEntityNotFound(_0x148574,null))['then'](function(_0x332b8b){_0x126703[_0x198e('0x89')]=_0x332b8b;if(_0x332b8b){var _0x2486ea={'ContactId':_0x332b8b['id'],'OpenchannelAccountId':_0x524ad5[_0x198e('0x58')]['id'],'from':(_0x332b8b['firstName']||'')+'\x20'+(_0x332b8b[_0x198e('0x8a')]||'')};var _0x2ae6d0={'OpenchannelAccountId':_0x524ad5[_0x198e('0x58')]['id'],'closed':![]};if(_0x524ad5[_0x198e('0x5c')][_0x198e('0x8b')]){_0x2ae6d0[_0x198e('0x8b')]=_0x524ad5[_0x198e('0x5c')][_0x198e('0x8b')];return db[_0x198e('0x8c')]['find']({'where':_0x2ae6d0})[_0x198e('0x1c')](function(_0x5ce926){if(_0x5ce926){return[_0x5ce926,![]];}_0x2486ea[_0x198e('0x8b')]=_0x524ad5[_0x198e('0x5c')][_0x198e('0x8b')];_0x2486ea['externalUrl']=_0x524ad5[_0x198e('0x5c')][_0x198e('0x8d')];return db['OpenchannelInteraction'][_0x198e('0x5b')](_0x2486ea)[_0x198e('0x1c')](function(_0x5e8410){return[_0x5e8410,!![]];});});}else{_0x2ae6d0[_0x198e('0x8b')]=null;}_0x2ae6d0[_0x198e('0x8e')]=_0x332b8b['id'];return db['OpenchannelInteraction'][_0x198e('0x5a')]({'where':_0x2ae6d0})[_0x198e('0x1c')](function(_0x2a564e){if(_0x2a564e){return[_0x2a564e,![]];}return db[_0x198e('0x8c')][_0x198e('0x5b')](_0x2486ea)[_0x198e('0x1c')](function(_0x1adf5e){return[_0x1adf5e,!![]];});});}})['spread'](function(_0x1f260f,_0x1e781d){if(_0x1f260f){_0x9ab2ca=_0x1e781d;if(!_0x1e781d){var _0x13b8d2={'from':(_0x126703[_0x198e('0x89')][_0x198e('0x8f')]||'')+'\x20'+(_0x126703[_0x198e('0x89')]['lastName']||'')};if(_0x524ad5['body'][_0x198e('0x8b')]&&_0x524ad5['body'][_0x198e('0x90')]&&_0x524ad5[_0x198e('0x5c')][_0x198e('0x8b')]!=_0x524ad5[_0x198e('0x5c')][_0x198e('0x90')]){_0x13b8d2[_0x198e('0x8b')]=_0x524ad5[_0x198e('0x5c')][_0x198e('0x90')];}return _0x1f260f['update'](_0x13b8d2);}else{return _0x1f260f;}}})[_0x198e('0x1c')](function(_0x143cf1){_0x126703[_0x198e('0x91')]=_0x143cf1[_0x198e('0x32')]({'plain':!![]});_0x126703[_0x198e('0x91')][_0x198e('0x92')]=_0x9ab2ca;if(_0x126703[_0x198e('0x91')][_0x198e('0x92')]){if(_0x126703[_0x198e('0x83')][_0x198e('0x93')]){_0x126703[_0x198e('0x84')][_0x198e('0x94')]({'id':0x0,'priority':_0x126703['applications'][_0x198e('0x59')]+0x1,'app':_0x198e('0x95'),'appdata':_0x198e('0x96'),'interval':_0x198e('0x97')});}}return db[_0x198e('0x98')][_0x198e('0x5b')]({'body':_0x524ad5[_0x198e('0x5c')][_0x198e('0x5c')],'OpenchannelAccountId':_0x524ad5[_0x198e('0x58')]['id'],'OpenchannelInteractionId':_0x143cf1['id'],'direction':'in','ContactId':_0x126703['contact']['id'],'AttachmentId':_0x524ad5['body'][_0x198e('0x99')]});})[_0x198e('0x1c')](function(_0x1df40a){_0x126703[_0x198e('0x25')]=_0x1df40a;if(_0x126703[_0x198e('0x91')]['UserId']){return db[_0x198e('0x9a')][_0x198e('0x5a')]({'attributes':['id',_0x198e('0x37')],'where':{'id':_0x126703['interaction'][_0x198e('0x9b')]}})[_0x198e('0x1c')](function(_0x2edc57){if(_0x2edc57){_0x126703[_0x198e('0x84')][_0x198e('0x9c')]({'id':0x0,'priority':0x0,'app':_0x198e('0x9d'),'appdata':_0x2edc57[_0x198e('0x37')]+','+(_0x126703[_0x198e('0x83')][_0x198e('0x9e')]||0xa),'interval':'*,*,*,*'});_0x126703[_0x198e('0x9f')]=![];}return respondWithRpcPromise(_0x198e('0xa0'),'startRouting',_0x126703);});}return respondWithRpcPromise(_0x198e('0xa0'),_0x198e('0xa1'),_0x126703);})[_0x198e('0x1c')](function(_0x347948){respondWithRpcPromise(_0x198e('0xa2'),_0x198e('0xa2'),{'event':'notify','message':_0x347948},client9002);return _0x347948;})[_0x198e('0x1c')](respondWithResult(_0x148574,null))[_0x198e('0x26')](handleError(_0x148574,null));};exports[_0x198e('0xa3')]=function(_0x2d4fba,_0x3a6a5a){var _0xc3d671=_0x2d4fba[_0x198e('0x58')]['id'];var _0x4cce17=_0x2d4fba[_0x198e('0x5c')];var _0x3dcf7b=0xc8;var _0x52c06d=null;return db[_0x198e('0xa4')][_0x198e('0xa5')]({'isolationLevel':db[_0x198e('0xa4')][_0x198e('0xa6')][_0x198e('0xa7')][_0x198e('0xa8')]},function(_0x490eeb){return db[_0x198e('0x3d')][_0x198e('0x69')]({'where':{'id':_0xc3d671},'transaction':_0x490eeb})[_0x198e('0x1c')](function(_0x2020fa){if(_0x2020fa){return db['OpenchannelApplication'][_0x198e('0x31')]({'where':{'OpenchannelAccountId':_0xc3d671},'transaction':_0x490eeb})[_0x198e('0x1c')](function(){var _0x5e5653=_[_0x198e('0x3c')](_0x4cce17,function(_0x456927){_0x456927[_0x198e('0x67')]=_0xc3d671;return _0x456927;});return db[_0x198e('0xa9')][_0x198e('0xaa')](_0x5e5653,{'transaction':_0x490eeb});});}else{_0x3dcf7b=0x194;_0x52c06d=[];}});})[_0x198e('0x1c')](function(){if(_0x3dcf7b!==0x194){return db[_0x198e('0xa9')][_0x198e('0xab')]({'where':{'OpenchannelAccountId':_0xc3d671},'order':_0x198e('0xac')})[_0x198e('0x1c')](function(_0x593068){_0x52c06d=_0x593068;});}})[_0x198e('0x26')](function(_0x191db8){_0x3dcf7b=0x1f4;logger[_0x198e('0x22')](_0x191db8[_0x198e('0x36')]);if(_0x191db8[_0x198e('0x37')]){delete _0x191db8[_0x198e('0x37')];}_0x52c06d=_0x191db8;})[_0x198e('0xad')](function(){if(_0x52c06d===null){_0x3a6a5a[_0x198e('0x27')](_0x3dcf7b);}else{if(_0x3dcf7b===0x1f4){_0x3a6a5a[_0x198e('0x35')](_0x3dcf7b)[_0x198e('0x38')](_0x52c06d);}else{_0x3a6a5a['status'](_0x3dcf7b)['json'](_0x52c06d);}}});};exports['getApplications']=function(_0x3930d8,_0x24f981,_0x44dbd4){var _0x3bb885={};var _0x299857={};var _0x160db9;var _0x2ecab2;return db[_0x198e('0x3d')][_0x198e('0x69')]({'where':{'id':_0x3930d8[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x24f981,null))['then'](function(_0x20b97d){if(_0x20b97d){_0x160db9=_0x20b97d;_0x299857[_0x198e('0x41')]=_['keys'](db[_0x198e('0xa9')][_0x198e('0x3e')]);_0x299857[_0x198e('0x42')]=_['keys'](_0x3930d8[_0x198e('0x42')]);_0x299857['filters']=_['intersection'](_0x299857[_0x198e('0x41')],_0x299857['query']);_0x3bb885[_0x198e('0x45')]=_[_0x198e('0x44')](_0x299857['model'],qs['fields'](_0x3930d8[_0x198e('0x42')]['fields']));_0x3bb885[_0x198e('0x45')]=_0x3bb885[_0x198e('0x45')][_0x198e('0x59')]?_0x3bb885[_0x198e('0x45')]:_0x299857[_0x198e('0x41')];_0x3bb885[_0x198e('0x49')]=qs[_0x198e('0x4a')](_0x3930d8['query']['sort']);_0x3bb885[_0x198e('0x4d')]=qs[_0x198e('0x4b')](_[_0x198e('0x4c')](_0x3930d8[_0x198e('0x42')],_0x299857['filters']));if(_0x3930d8['query'][_0x198e('0x51')]){_0x3bb885[_0x198e('0x4d')]=_[_0x198e('0x4e')](_0x3bb885[_0x198e('0x4d')],{'$or':_[_0x198e('0x3c')](_0x3bb885[_0x198e('0x45')],function(_0x242ee6){var _0x533b87={};_0x533b87[_0x242ee6]={'$like':'%'+_0x3930d8[_0x198e('0x42')]['filter']+'%'};return _0x533b87;})});}_0x3bb885=_[_0x198e('0x4e')]({},_0x3bb885,_0x3930d8[_0x198e('0x52')]);return _0x160db9[_0x198e('0xae')](_0x3bb885);}})[_0x198e('0x1c')](function(_0x11c1b6){if(_0x11c1b6){_0x2ecab2=_0x11c1b6[_0x198e('0x59')];if(!_0x3930d8[_0x198e('0x42')]['hasOwnProperty'](_0x198e('0x48'))){_0x3bb885['limit']=qs[_0x198e('0x2b')](_0x3930d8[_0x198e('0x42')][_0x198e('0x2b')]);_0x3bb885[_0x198e('0x29')]=qs[_0x198e('0x29')](_0x3930d8['query'][_0x198e('0x29')]);}return _0x160db9[_0x198e('0xae')](_0x3bb885);}})['then'](function(_0x1c4e65){if(_0x1c4e65){return _0x1c4e65?{'count':_0x2ecab2,'rows':_0x1c4e65}:null;}})[_0x198e('0x1c')](respondWithResult(_0x24f981,null))[_0x198e('0x26')](handleError(_0x24f981,null));};exports['getInteractions']=function(_0x2a0b24,_0x41647d,_0x5e6cac){var _0x2886d8={'raw':![],'where':{}};var _0x38c7e8={};var _0x56208e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x198e('0x69')]({'where':{'id':_0x2a0b24[_0x198e('0x58')]['id']}})['then'](handleEntityNotFound(_0x41647d,null))[_0x198e('0x1c')](function(_0x4a496a){if(_0x4a496a){_0x38c7e8['model']=_[_0x198e('0x43')](db['OpenchannelInteraction'][_0x198e('0x3e')]);_0x38c7e8['query']=_['keys'](_0x2a0b24[_0x198e('0x42')]);_0x38c7e8[_0x198e('0x4b')]=_['intersection'](_0x38c7e8[_0x198e('0x41')],_0x38c7e8[_0x198e('0x42')]);_0x2886d8[_0x198e('0x45')]=_[_0x198e('0x44')](_0x38c7e8['model'],qs[_0x198e('0x46')](_0x2a0b24['query'][_0x198e('0x46')]));_0x2886d8[_0x198e('0x45')]=_0x2886d8[_0x198e('0x45')]['length']?_0x2886d8['attributes']:_0x38c7e8[_0x198e('0x41')];if(!_0x2a0b24['query']['hasOwnProperty'](_0x198e('0x48'))){_0x2886d8[_0x198e('0x2b')]=qs['limit'](_0x2a0b24[_0x198e('0x42')][_0x198e('0x2b')]);_0x2886d8[_0x198e('0x29')]=qs[_0x198e('0x29')](_0x2a0b24[_0x198e('0x42')]['offset']);}_0x2886d8[_0x198e('0x49')]=qs[_0x198e('0x4a')](_0x2a0b24[_0x198e('0x42')][_0x198e('0x4a')]);_0x2886d8[_0x198e('0x4d')]=qs[_0x198e('0x4b')](_[_0x198e('0x4c')](_0x2a0b24[_0x198e('0x42')],_0x38c7e8[_0x198e('0x4b')]));_0x2886d8[_0x198e('0x4d')][_0x198e('0x67')]=_0x4a496a['id'];if(_0x2a0b24[_0x198e('0x42')][_0x198e('0x51')]){_0x2886d8[_0x198e('0x4d')]=_[_0x198e('0x4e')](_0x2886d8[_0x198e('0x4d')],{'$or':_[_0x198e('0x3c')](_0x2886d8['attributes'],function(_0xcb4822){var _0x491faa={};_0x491faa[_0xcb4822]={'$like':'%'+_0x2a0b24[_0x198e('0x42')][_0x198e('0x51')]+'%'};return _0x491faa;})});}_0x2886d8=_[_0x198e('0x4e')]({},_0x2886d8,_0x2a0b24[_0x198e('0x52')]);return db[_0x198e('0x8c')][_0x198e('0x2c')]({'where':_0x2886d8[_0x198e('0x4d')]})[_0x198e('0x1c')](function(_0x4e9068){_0x56208e[_0x198e('0x2c')]=_0x4e9068;if(_0x2a0b24[_0x198e('0x42')][_0x198e('0x53')]){_0x2886d8[_0x198e('0x54')]=[{'model':db['CmContact'],'as':_0x198e('0xaf'),'required':![]},{'model':db[_0x198e('0x9a')],'as':_0x198e('0xb0'),'attributes':[_0x198e('0x37'),_0x198e('0xb1'),_0x198e('0xb2')],'required':![]},{'model':db[_0x198e('0xb3')],'as':_0x198e('0xb4'),'attributes':['id',_0x198e('0x37'),'color'],'where':_0x2a0b24['query'][_0x198e('0xb5')]?{'id':_0x2a0b24[_0x198e('0x42')]['tag']}:undefined,'required':_0x2a0b24[_0x198e('0x42')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x198e('0x55')](_0x2886d8);})[_0x198e('0x1c')](function(_0x45ae19){_0x56208e[_0x198e('0x56')]=_0x45ae19;return _0x56208e;});}})['then'](respondWithFilteredResult(_0x41647d,_0x2886d8))[_0x198e('0x26')](handleError(_0x41647d,null));};exports[_0x198e('0xb6')]=function(_0x4427b5,_0x5d1d5c,_0x54891a){return db[_0x198e('0x3d')][_0x198e('0x5a')]({'where':{'id':_0x4427b5[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x5d1d5c,null))[_0x198e('0x1c')](function(_0xa0988e){if(_0xa0988e){return _0xa0988e['addAgents'](_0x4427b5['body'][_0x198e('0x6f')],_[_0x198e('0xb7')](_0x4427b5[_0x198e('0x5c')],['ids','id'])||{})['spread'](function(_0x308246){for(var _0x2b41d8=0x0;_0x2b41d8<_0x4427b5[_0x198e('0x5c')]['ids'][_0x198e('0x59')];_0x2b41d8+=0x1){socket[_0x198e('0xb8')](_0x198e('0xb9'),{'UserId':Number(_0x4427b5['body']['ids'][_0x2b41d8]),'OpenchannelAccountId':Number(_0x4427b5['params']['id'])});}return _0x308246;});}})[_0x198e('0x1c')](respondWithResult(_0x5d1d5c,null))['catch'](handleError(_0x5d1d5c,null));};exports[_0x198e('0xba')]=function(_0x46a459,_0x17a241,_0x5621a9){return db[_0x198e('0x3d')][_0x198e('0x5a')]({'where':{'id':_0x46a459[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x17a241,null))['then'](function(_0x5f514a){if(_0x5f514a){return _0x5f514a[_0x198e('0xba')](_0x46a459[_0x198e('0x42')][_0x198e('0x6f')])[_0x198e('0x1c')](function(){if(_[_0x198e('0xbb')](_0x46a459[_0x198e('0x42')][_0x198e('0x6f')])){for(var _0x2e40de=0x0;_0x2e40de<_0x46a459['query']['ids'][_0x198e('0x59')];_0x2e40de+=0x1){socket[_0x198e('0xb8')](_0x198e('0xbc'),{'UserId':Number(_0x46a459[_0x198e('0x42')][_0x198e('0x6f')][_0x2e40de]),'OpenchannelAccountId':Number(_0x46a459[_0x198e('0x58')]['id'])});}}else{socket['emit'](_0x198e('0xbc'),{'UserId':Number(_0x46a459[_0x198e('0x42')][_0x198e('0x6f')]),'OpenchannelAccountId':Number(_0x46a459[_0x198e('0x58')]['id'])});}});}})[_0x198e('0x1c')](respondWithStatusCode(_0x17a241,null))[_0x198e('0x26')](handleError(_0x17a241,null));};exports[_0x198e('0xbd')]=function(_0x498d5e,_0x3e2e5f,_0x304be0){var _0x59dfb9={};var _0x3ccb16={};var _0x425302;var _0x22fb89;return db[_0x198e('0x3d')][_0x198e('0x69')]({'where':{'id':_0x498d5e[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x3e2e5f,null))[_0x198e('0x1c')](function(_0x37988f){if(_0x37988f){_0x425302=_0x37988f;_0x3ccb16[_0x198e('0x41')]=_[_0x198e('0x43')](db[_0x198e('0x9a')][_0x198e('0x3e')]);_0x3ccb16['query']=_[_0x198e('0x43')](_0x498d5e['query']);_0x3ccb16['filters']=_['intersection'](_0x3ccb16['model'],_0x3ccb16[_0x198e('0x42')]);_0x59dfb9[_0x198e('0x45')]=_[_0x198e('0x44')](_0x3ccb16['model'],qs[_0x198e('0x46')](_0x498d5e[_0x198e('0x42')][_0x198e('0x46')]));_0x59dfb9[_0x198e('0x45')]=_0x59dfb9[_0x198e('0x45')][_0x198e('0x59')]?_0x59dfb9[_0x198e('0x45')]:_0x3ccb16[_0x198e('0x41')];_0x59dfb9[_0x198e('0x49')]=qs[_0x198e('0x4a')](_0x498d5e[_0x198e('0x42')]['sort']);_0x59dfb9[_0x198e('0x4d')]=qs[_0x198e('0x4b')](_[_0x198e('0x4c')](_0x498d5e[_0x198e('0x42')],_0x3ccb16[_0x198e('0x4b')]));if(_0x498d5e['query']['filter']){_0x59dfb9[_0x198e('0x4d')]=_[_0x198e('0x4e')](_0x59dfb9[_0x198e('0x4d')],{'$or':_[_0x198e('0x3c')](_0x59dfb9[_0x198e('0x45')],function(_0x13f570){var _0xc37a6b={};_0xc37a6b[_0x13f570]={'$like':'%'+_0x498d5e[_0x198e('0x42')][_0x198e('0x51')]+'%'};return _0xc37a6b;})});}_0x59dfb9=_['merge']({},_0x59dfb9,_0x498d5e['options']);return _0x425302['getAgents'](_0x59dfb9);}})['then'](function(_0x4e68a4){if(_0x4e68a4){_0x22fb89=_0x4e68a4[_0x198e('0x59')];if(!_0x498d5e['query'][_0x198e('0x47')]('nolimit')){_0x59dfb9[_0x198e('0x2b')]=qs[_0x198e('0x2b')](_0x498d5e[_0x198e('0x42')][_0x198e('0x2b')]);_0x59dfb9[_0x198e('0x29')]=qs[_0x198e('0x29')](_0x498d5e[_0x198e('0x42')][_0x198e('0x29')]);}return _0x425302[_0x198e('0xbd')](_0x59dfb9);}})[_0x198e('0x1c')](function(_0x3b59e6){if(_0x3b59e6){return _0x3b59e6?{'count':_0x22fb89,'rows':_0x3b59e6}:null;}})[_0x198e('0x1c')](respondWithResult(_0x3e2e5f,null))[_0x198e('0x26')](handleError(_0x3e2e5f,null));};exports[_0x198e('0x38')]=function(_0x356d37,_0x100a5c,_0x51d3c0){var _0x9ba62c,_0x1fe89c,_0x3e6db3;if(_[_0x198e('0x79')](_0x356d37['body'][_0x198e('0x5c')])||_0x356d37[_0x198e('0x5c')][_0x198e('0x5c')]===''){throw new db[(_0x198e('0x72'))][(_0x198e('0x73'))](_0x198e('0x7c'));}if(_[_0x198e('0x79')](_0x356d37['body']['to'])){}_0x9ba62c=_0x356d37[_0x198e('0x5c')]['to'];return db[_0x198e('0x3d')][_0x198e('0x69')]({'where':{'id':_0x356d37[_0x198e('0x58')]['id']}})[_0x198e('0x1c')](handleEntityNotFound(_0x100a5c,null))[_0x198e('0x1c')](function(_0x25ab7e){if(_0x25ab7e){return db[_0x198e('0x3d')][_0x198e('0x5a')]({'where':{'id':_0x25ab7e['id']},'include':[{'model':db[_0x198e('0x80')],'as':_0x198e('0x81'),'include':[{'model':db[_0x198e('0x71')],'as':_0x198e('0x88'),'where':{[_0x25ab7e['mapKey']]:_0x9ba62c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x198e('0x1c')](handleEntityNotFound(_0x100a5c,null))[_0x198e('0x1c')](function(_0x5b2ae3){if(_0x5b2ae3&&_0x5b2ae3['List']){_0x1fe89c=_0x5b2ae3[_0x198e('0x32')]({'plain':!![]});if(_0x1fe89c['List']&&_0x1fe89c[_0x198e('0x81')][_0x198e('0x88')]['length']){return _0x1fe89c[_0x198e('0x81')][_0x198e('0x88')][0x0];}return db['CmContact']['create'](_[_0x198e('0x16')](_0x356d37['body'],{'firstName':_0x9ba62c,[_0x5b2ae3[_0x198e('0x7d')]]:_0x9ba62c,'phone':_0x9ba62c,'ListId':_0x1fe89c['ListId']}));}})[_0x198e('0x1c')](handleEntityNotFound(_0x100a5c,null))[_0x198e('0x1c')](function(_0x1242c2){if(_0x1242c2){_0x3e6db3=_0x1242c2;return db[_0x198e('0x8c')][_0x198e('0x5a')]({'where':{'ContactId':_0x3e6db3['id'],'closed':![],'OpenchannelAccountId':_0x1fe89c['id']}})[_0x198e('0x1c')](function(_0x5bb823){if(_0x5bb823){return[_0x5bb823,![]];}return db[_0x198e('0x8c')][_0x198e('0x5b')]({'UserId':_0x356d37[_0x198e('0x5d')]['id'],'ContactId':_0x3e6db3['id'],'OpenchannelAccountId':_0x1fe89c['id'],'lastMsgDirection':'out','firstMsgDirection':_0x198e('0xbe'),'Messages':[_[_0x198e('0x4e')](_0x356d37[_0x198e('0x5c')],{'read':![],'body':_0x356d37[_0x198e('0x5c')][_0x198e('0x5c')],'OpenchannelAccountId':_0x1fe89c['id'],'UserId':_0x356d37['user']['id'],'ContactId':_0x3e6db3['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x198e('0xbf')}]})[_0x198e('0x1c')](function(_0x51655a){return[_0x51655a,!![]];});});}})['spread'](function(_0x3f2710,_0x9f19ea){if(_0x9f19ea){return _0x3f2710;}return db['OpenchannelMessage'][_0x198e('0x5b')](_[_0x198e('0x4e')](_0x356d37['body'],{'read':![],'body':_0x356d37[_0x198e('0x5c')]['body'],'OpenchannelAccountId':_0x1fe89c['id'],'OpenchannelInteractionId':_0x3f2710['id'],'UserId':_0x356d37[_0x198e('0x5d')]['id'],'ContactId':_0x3e6db3['id']}))[_0x198e('0x1c')](function(_0x47633c){_0x3f2710['dataValues']['Messages']=[];_0x3f2710[_0x198e('0xc0')][_0x198e('0xbf')]['push'](_0x47633c[_0x198e('0xc0')]);return _0x3f2710;});});}})['then'](respondWithResult(_0x100a5c,null))[_0x198e('0x26')](handleError(_0x100a5c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e4efae8..1b3e734 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 _0x6e6c=['../../mysqldb','setMaxListeners','save','emit','hook','exports','events'];(function(_0x486536,_0x5116a4){var _0x2d1a0c=function(_0x4b188c){while(--_0x4b188c){_0x486536['push'](_0x486536['shift']());}};_0x2d1a0c(++_0x5116a4);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var OpenchannelAccount=require(_0xc6e6('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc6e6('0x2')](0x0);var events={'afterCreate':_0xc6e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e97f5){return function(_0x5a9e2b,_0x40b7e1,_0x4b13f0){OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5+':'+_0x5a9e2b['id'],_0x5a9e2b);OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5,_0x5a9e2b);_0x4b13f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc6e6('0x5')](e,emitEvent(event));}}module[_0xc6e6('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x53f165,_0x16c060){var _0x324864=function(_0x709188){while(--_0x709188){_0x53f165['push'](_0x53f165['shift']());}};_0x324864(++_0x16c060);}(_0xe706,0xa3));var _0x6e70=function(_0x1e24f8,_0x52070f){_0x1e24f8=_0x1e24f8-0x0;var _0x5c4446=_0xe706[_0x1e24f8];return _0x5c4446;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 051bf8b..a6da39e 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(_0x24d107,_0x3b09dd){var _0x308060=function(_0x51a111){while(--_0x51a111){_0x24d107['push'](_0x24d107['shift']());}};_0x308060(++_0x3b09dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x5a21a1,_0x13cd80){var _0x37940a=function(_0x2711d5){while(--_0x2711d5){_0x5a21a1['push'](_0x5a21a1['shift']());}};_0x37940a(++_0x13cd80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 eb72ecb..ccf5c15 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 _0x1b32=['http','redis','defaults','localhost','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x187df4,_0x114bef){var _0x29363d=function(_0x3d9bf2){while(--_0x3d9bf2){_0x187df4['push'](_0x187df4['shift']());}};_0x29363d(++_0x114bef);}(_0x1b32,0x85));var _0x21b3=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x1b32[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var moment=require(_0x21b3('0x1'));var BPromise=require(_0x21b3('0x2'));var rs=require(_0x21b3('0x3'));var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require(_0x21b3('0x9'));var jayson=require(_0x21b3('0xa'));var client=jayson[_0x21b3('0xb')][_0x21b3('0xc')]({'port':0x232a});config[_0x21b3('0xd')]=_[_0x21b3('0xe')](config['redis'],{'host':_0x21b3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x21b3('0x10')](socket);function respondWithRpcPromise(_0x36b2a1,_0x56009d,_0x4aa0d7){return new BPromise(function(_0x253f2b,_0x270969){return client[_0x21b3('0x11')](_0x36b2a1,_0x4aa0d7)['then'](function(_0x370338){logger[_0x21b3('0x12')](_0x21b3('0x13'),_0x56009d,_0x21b3('0x14'));logger[_0x21b3('0x15')](_0x21b3('0x16'),_0x56009d,_0x21b3('0x14'),JSON[_0x21b3('0x17')](_0x370338));if(_0x370338[_0x21b3('0x18')]){if(_0x370338['error'][_0x21b3('0x19')]===0x1f4){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x370338['error'][_0x21b3('0x1a')]);return _0x270969(_0x370338['error'][_0x21b3('0x1a')]);}logger['error'](_0x21b3('0x13'),_0x56009d,_0x370338[_0x21b3('0x18')][_0x21b3('0x1a')]);return _0x253f2b(_0x370338[_0x21b3('0x18')]['message']);}else{logger[_0x21b3('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x56009d,_0x21b3('0x14'));_0x253f2b(_0x370338[_0x21b3('0x1b')][_0x21b3('0x1a')]);}})[_0x21b3('0x1c')](function(_0x513c32){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x513c32);_0x270969(_0x513c32);});});} \ No newline at end of file +var _0x1d2d=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4f6b85,_0x168b20){var _0x1d26d0=function(_0x3ae6b4){while(--_0x3ae6b4){_0x4f6b85['push'](_0x4f6b85['shift']());}};_0x1d26d0(++_0x168b20);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x9e4d2e,_0x46932e){_0x9e4d2e=_0x9e4d2e-0x0;var _0xf2405a=_0x1d2d[_0x9e4d2e];return _0xf2405a;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});config[_0xd1d2('0xb')]=_['defaults'](config[_0xd1d2('0xb')],{'host':_0xd1d2('0xc'),'port':0x18eb});var socket=require(_0xd1d2('0xd'))(new Redis(config[_0xd1d2('0xb')]));require(_0xd1d2('0xe'))[_0xd1d2('0xf')](socket);function respondWithRpcPromise(_0x1dc683,_0x1a6ca4,_0x3ac8c4){return new BPromise(function(_0x353f9b,_0x900ec){return client[_0xd1d2('0x10')](_0x1dc683,_0x3ac8c4)[_0xd1d2('0x11')](function(_0x5b21f4){logger[_0xd1d2('0x12')](_0xd1d2('0x13'),_0x1a6ca4,_0xd1d2('0x14'));logger[_0xd1d2('0x15')](_0xd1d2('0x16'),_0x1a6ca4,_0xd1d2('0x14'),JSON[_0xd1d2('0x17')](_0x5b21f4));if(_0x5b21f4[_0xd1d2('0x18')]){if(_0x5b21f4[_0xd1d2('0x18')][_0xd1d2('0x19')]===0x1f4){logger['error'](_0xd1d2('0x13'),_0x1a6ca4,_0x5b21f4[_0xd1d2('0x18')][_0xd1d2('0x1a')]);return _0x900ec(_0x5b21f4['error'][_0xd1d2('0x1a')]);}logger[_0xd1d2('0x18')](_0xd1d2('0x13'),_0x1a6ca4,_0x5b21f4[_0xd1d2('0x18')][_0xd1d2('0x1a')]);return _0x353f9b(_0x5b21f4[_0xd1d2('0x18')][_0xd1d2('0x1a')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1a6ca4,_0xd1d2('0x14'));_0x353f9b(_0x5b21f4['result'][_0xd1d2('0x1a')]);}})[_0xd1d2('0x1b')](function(_0x3102c4){logger[_0xd1d2('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x1a6ca4,_0x3102c4);_0x900ec(_0x3102c4);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 023950d..b87b2eb 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 _0x9224=['update','removeListener','length','save','remove'];(function(_0x571852,_0x34ae1f){var _0x1ec365=function(_0x398fe5){while(--_0x398fe5){_0x571852['push'](_0x571852['shift']());}};_0x1ec365(++_0x34ae1f);}(_0x9224,0xa3));var _0x4922=function(_0x2061ce,_0x170c6d){_0x2061ce=_0x2061ce-0x0;var _0x58d748=_0x9224[_0x2061ce];return _0x58d748;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x4922('0x0'),_0x4922('0x1'),_0x4922('0x2')];function createListener(_0x472129,_0x3517a1){return function(_0x3c8757){_0x3517a1['emit'](_0x472129,_0x3c8757);};}function removeListener(_0x582640,_0x572f8f){return function(){OpenchannelAccountEvents[_0x4922('0x3')](_0x582640,_0x572f8f);};}exports['register']=function(_0x12601a){for(var _0x1b7fc7=0x0,_0x4216c0=events[_0x4922('0x4')];_0x1b7fc7<_0x4216c0;_0x1b7fc7++){var _0x7a8bd1=events[_0x1b7fc7];var _0x245562=createListener('openchannelAccount:'+_0x7a8bd1,_0x12601a);OpenchannelAccountEvents['on'](_0x7a8bd1,_0x245562);}}; \ No newline at end of file +var _0x9879=['update','emit','removeListener','register','length','save','remove'];(function(_0x1001c3,_0x825a9d){var _0x23778f=function(_0x1b94f4){while(--_0x1b94f4){_0x1001c3['push'](_0x1001c3['shift']());}};_0x23778f(++_0x825a9d);}(_0x9879,0x98));var _0x9987=function(_0x4918ba,_0x4aebc9){_0x4918ba=_0x4918ba-0x0;var _0x14d7d9=_0x9879[_0x4918ba];return _0x14d7d9;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x9987('0x0'),_0x9987('0x1'),_0x9987('0x2')];function createListener(_0x1df4b1,_0x15471b){return function(_0x25f8c9){_0x15471b[_0x9987('0x3')](_0x1df4b1,_0x25f8c9);};}function removeListener(_0x2ab2a8,_0x37ebe8){return function(){OpenchannelAccountEvents[_0x9987('0x4')](_0x2ab2a8,_0x37ebe8);};}exports[_0x9987('0x5')]=function(_0x473510){for(var _0x15193d=0x0,_0xce52bb=events[_0x9987('0x6')];_0x15193d<_0xce52bb;_0x15193d++){var _0x555bb0=events[_0x15193d];var _0x1cf155=createListener('openchannelAccount:'+_0x555bb0,_0x473510);OpenchannelAccountEvents['on'](_0x555bb0,_0x1cf155);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index da18cea..870e604 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 _0xe68c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','update','delete','destroy'];(function(_0x64bc5c,_0x559812){var _0x25e8fb=function(_0x124d39){while(--_0x124d39){_0x64bc5c['push'](_0x64bc5c['shift']());}};_0x25e8fb(++_0x559812);}(_0xe68c,0xd8));var _0xce68=function(_0x338391,_0x4d5e84){_0x338391=_0x338391-0x0;var _0x363e1c=_0xe68c[_0x338391];return _0x363e1c;};'use strict';var multer=require(_0xce68('0x0'));var util=require(_0xce68('0x1'));var path=require(_0xce68('0x2'));var timeout=require(_0xce68('0x3'));var express=require(_0xce68('0x4'));var router=express[_0xce68('0x5')]();var fs_extra=require(_0xce68('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xce68('0x7'));var config=require(_0xce68('0x8'));var controller=require('./openchannelApplication.controller');router[_0xce68('0x9')]('/',auth[_0xce68('0xa')](),controller[_0xce68('0xb')]);router['get']('/:id',auth[_0xce68('0xa')](),controller['show']);router['post']('/',auth[_0xce68('0xa')](),controller[_0xce68('0xc')]);router[_0xce68('0xd')](_0xce68('0xe'),auth[_0xce68('0xa')](),controller[_0xce68('0xf')]);router[_0xce68('0x10')](_0xce68('0xe'),auth[_0xce68('0xa')](),controller[_0xce68('0x11')]);module['exports']=router; \ No newline at end of file +var _0x08c5=['delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x08c5,0x135));var _0x508c=function(_0x2918f0,_0x32fbca){_0x2918f0=_0x2918f0-0x0;var _0x5c4e53=_0x08c5[_0x2918f0];return _0x5c4e53;};'use strict';var multer=require('multer');var util=require(_0x508c('0x0'));var path=require(_0x508c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x508c('0x2')]();var fs_extra=require(_0x508c('0x3'));var auth=require(_0x508c('0x4'));var interaction=require(_0x508c('0x5'));var config=require('../../config/environment');var controller=require(_0x508c('0x6'));router[_0x508c('0x7')]('/',auth[_0x508c('0x8')](),controller['index']);router[_0x508c('0x7')](_0x508c('0x9'),auth[_0x508c('0x8')](),controller[_0x508c('0xa')]);router[_0x508c('0xb')]('/',auth[_0x508c('0x8')](),controller['create']);router[_0x508c('0xc')]('/:id',auth[_0x508c('0x8')](),controller[_0x508c('0xd')]);router[_0x508c('0xe')](_0x508c('0x9'),auth[_0x508c('0x8')](),controller[_0x508c('0xf')]);module[_0x508c('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 33d53ee..4051cf6 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 _0xd0b9=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x18d209,_0x1a199e){var _0x278526=function(_0x3a5249){while(--_0x3a5249){_0x18d209['push'](_0x18d209['shift']());}};_0x278526(++_0x1a199e);}(_0xd0b9,0xe9));var _0x9d0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0b9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d0b('0x0'));module[_0x9d0b('0x1')]={'priority':{'type':Sequelize[_0x9d0b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9d0b('0x3')],'allowNull':![],'defaultValue':_0x9d0b('0x4')},'appdata':{'type':Sequelize[_0x9d0b('0x5')]()},'description':{'type':Sequelize[_0x9d0b('0x3')]},'interval':{'type':Sequelize[_0x9d0b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7250=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x7250,0x18f));var _0x0725=function(_0x329f7e,_0xcd20da){_0x329f7e=_0x329f7e-0x0;var _0x9243df=_0x7250[_0x329f7e];return _0x9243df;};'use strict';var Sequelize=require(_0x0725('0x0'));module[_0x0725('0x1')]={'priority':{'type':Sequelize[_0x0725('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0725('0x3')],'allowNull':![],'defaultValue':_0x0725('0x4')},'appdata':{'type':Sequelize[_0x0725('0x5')]()},'description':{'type':Sequelize[_0x0725('0x3')]},'interval':{'type':Sequelize[_0x0725('0x3')],'defaultValue':_0x0725('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 865612a..e8a44e0 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 _0x60ac=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','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','count','limit'];(function(_0x564242,_0x4159f7){var _0x2906fb=function(_0xed2acc){while(--_0xed2acc){_0x564242['push'](_0x564242['shift']());}};_0x2906fb(++_0x4159f7);}(_0x60ac,0x19c));var _0xc60a=function(_0x27cf7d,_0x377515){_0x27cf7d=_0x27cf7d-0x0;var _0x9b13ac=_0x60ac[_0x27cf7d];return _0x9b13ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc60a('0x0'));var zipdir=require(_0xc60a('0x1'));var jsonpatch=require(_0xc60a('0x2'));var rp=require(_0xc60a('0x3'));var moment=require('moment');var BPromise=require(_0xc60a('0x4'));var Mustache=require(_0xc60a('0x5'));var util=require('util');var path=require(_0xc60a('0x6'));var sox=require(_0xc60a('0x7'));var csv=require(_0xc60a('0x8'));var ejs=require(_0xc60a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc60a('0xa'));var crypto=require(_0xc60a('0xb'));var jsforce=require(_0xc60a('0xc'));var deskjs=require(_0xc60a('0xd'));var toCsv=require(_0xc60a('0x8'));var querystring=require(_0xc60a('0xe'));var Papa=require('papaparse');var Redis=require(_0xc60a('0xf'));var authService=require(_0xc60a('0x10'));var qs=require(_0xc60a('0x11'));var as=require(_0xc60a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc60a('0x13'))(_0xc60a('0x14'));var utils=require(_0xc60a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc60a('0x16'));var db=require(_0xc60a('0x17'))['db'];function respondWithStatusCode(_0x6a1057,_0x3fab60){_0x3fab60=_0x3fab60||0xcc;return function(_0x48514d){if(_0x48514d){return _0x6a1057[_0xc60a('0x18')](_0x3fab60);}return _0x6a1057[_0xc60a('0x19')](_0x3fab60)[_0xc60a('0x1a')]();};}function respondWithResult(_0x25f809,_0x4006a4){_0x4006a4=_0x4006a4||0xc8;return function(_0x15ec99){if(_0x15ec99){return _0x25f809[_0xc60a('0x19')](_0x4006a4)[_0xc60a('0x1b')](_0x15ec99);}};}function respondWithFilteredResult(_0x30acbc,_0x12ac25){return function(_0x276b37){if(_0x276b37){var _0x1e69fe=typeof _0x12ac25[_0xc60a('0x1c')]===_0xc60a('0x1d')&&typeof _0x12ac25['limit']==='undefined';var _0x5b5bfe=_0x276b37[_0xc60a('0x1e')];var _0x4c3537=_0x1e69fe?0x0:_0x12ac25[_0xc60a('0x1c')];var _0x91e37d=_0x1e69fe?_0x276b37['count']:_0x12ac25[_0xc60a('0x1c')]+_0x12ac25[_0xc60a('0x1f')];var _0xd6ee65;if(_0x91e37d>=_0x5b5bfe){_0x91e37d=_0x5b5bfe;_0xd6ee65=0xc8;}else{_0xd6ee65=0xce;}_0x30acbc[_0xc60a('0x19')](_0xd6ee65);return _0x30acbc[_0xc60a('0x20')](_0xc60a('0x21'),_0x4c3537+'-'+_0x91e37d+'/'+_0x5b5bfe)['json'](_0x276b37);}return null;};}function patchUpdates(_0x3eb5e1){return function(_0x335b5e){try{jsonpatch[_0xc60a('0x22')](_0x335b5e,_0x3eb5e1,!![]);}catch(_0x5da350){return BPromise['reject'](_0x5da350);}return _0x335b5e[_0xc60a('0x23')]();};}function saveUpdates(_0x2b1615,_0x1f05c9){return function(_0x297a69){if(_0x297a69){return _0x297a69[_0xc60a('0x24')](_0x2b1615)[_0xc60a('0x25')](function(_0xc1215b){return _0xc1215b;});}return null;};}function removeEntity(_0x2cabbd,_0xdbcddb){return function(_0x30a5f7){if(_0x30a5f7){return _0x30a5f7[_0xc60a('0x26')]()[_0xc60a('0x25')](function(){_0x2cabbd[_0xc60a('0x19')](0xcc)[_0xc60a('0x1a')]();});}};}function handleEntityNotFound(_0x35b4ec,_0x28734c){return function(_0x3fe233){if(!_0x3fe233){_0x35b4ec[_0xc60a('0x18')](0x194);}return _0x3fe233;};}function handleError(_0x2348e7,_0x2fa745){_0x2fa745=_0x2fa745||0x1f4;return function(_0x2152e0){logger[_0xc60a('0x27')](_0x2152e0[_0xc60a('0x28')]);if(_0x2152e0[_0xc60a('0x29')]){delete _0x2152e0[_0xc60a('0x29')];}_0x2348e7[_0xc60a('0x19')](_0x2fa745)[_0xc60a('0x2a')](_0x2152e0);};}exports['index']=function(_0x90db0a,_0x55d6b4){var _0x42ccd7={},_0x5db13b={},_0x2d2653={'count':0x0,'rows':[]};var _0x22591a=_[_0xc60a('0x2b')](db[_0xc60a('0x2c')]['rawAttributes'],function(_0x59b5a8){return{'name':_0x59b5a8[_0xc60a('0x2d')],'type':_0x59b5a8[_0xc60a('0x2e')][_0xc60a('0x2f')]};});_0x5db13b[_0xc60a('0x30')]=_[_0xc60a('0x2b')](_0x22591a,'name');_0x5db13b[_0xc60a('0x31')]=_[_0xc60a('0x32')](_0x90db0a[_0xc60a('0x31')]);_0x5db13b[_0xc60a('0x33')]=_['intersection'](_0x5db13b[_0xc60a('0x30')],_0x5db13b[_0xc60a('0x31')]);_0x42ccd7[_0xc60a('0x34')]=_[_0xc60a('0x35')](_0x5db13b[_0xc60a('0x30')],qs[_0xc60a('0x36')](_0x90db0a[_0xc60a('0x31')][_0xc60a('0x36')]));_0x42ccd7[_0xc60a('0x34')]=_0x42ccd7[_0xc60a('0x34')][_0xc60a('0x37')]?_0x42ccd7['attributes']:_0x5db13b[_0xc60a('0x30')];if(!_0x90db0a[_0xc60a('0x31')][_0xc60a('0x38')](_0xc60a('0x39'))){_0x42ccd7['limit']=qs[_0xc60a('0x1f')](_0x90db0a['query']['limit']);_0x42ccd7[_0xc60a('0x1c')]=qs['offset'](_0x90db0a[_0xc60a('0x31')][_0xc60a('0x1c')]);}_0x42ccd7[_0xc60a('0x3a')]=qs[_0xc60a('0x3b')](_0x90db0a[_0xc60a('0x31')][_0xc60a('0x3b')]);_0x42ccd7[_0xc60a('0x3c')]=qs[_0xc60a('0x33')](_['pick'](_0x90db0a['query'],_0x5db13b[_0xc60a('0x33')]),_0x22591a);if(_0x90db0a[_0xc60a('0x31')]['filter']){_0x42ccd7[_0xc60a('0x3c')]=_[_0xc60a('0x3d')](_0x42ccd7['where'],{'$or':_[_0xc60a('0x2b')](_0x22591a,function(_0x1bd356){if(_0x1bd356['type']!==_0xc60a('0x3e')){var _0x1d32af={};_0x1d32af[_0x1bd356['name']]={'$like':'%'+_0x90db0a[_0xc60a('0x31')][_0xc60a('0x3f')]+'%'};return _0x1d32af;}})});}_0x42ccd7=_[_0xc60a('0x3d')]({},_0x42ccd7,_0x90db0a[_0xc60a('0x40')]);var _0x2faddf={'where':_0x42ccd7['where']};return db[_0xc60a('0x2c')][_0xc60a('0x1e')](_0x2faddf)['then'](function(_0x35ced2){_0x2d2653['count']=_0x35ced2;if(_0x90db0a['query'][_0xc60a('0x41')]){_0x42ccd7['include']=[{'all':!![]}];}return db[_0xc60a('0x2c')]['findAll'](_0x42ccd7);})[_0xc60a('0x25')](function(_0x512316){_0x2d2653[_0xc60a('0x42')]=_0x512316;return _0x2d2653;})[_0xc60a('0x25')](respondWithFilteredResult(_0x55d6b4,_0x42ccd7))['catch'](handleError(_0x55d6b4,null));};exports[_0xc60a('0x43')]=function(_0x498e48,_0x386a01){var _0x44d172={'raw':!![],'where':{'id':_0x498e48[_0xc60a('0x44')]['id']}},_0x60e0d9={};_0x60e0d9[_0xc60a('0x30')]=_[_0xc60a('0x32')](db[_0xc60a('0x2c')]['rawAttributes']);_0x60e0d9[_0xc60a('0x31')]=_[_0xc60a('0x32')](_0x498e48[_0xc60a('0x31')]);_0x60e0d9['filters']=_[_0xc60a('0x35')](_0x60e0d9['model'],_0x60e0d9[_0xc60a('0x31')]);_0x44d172['attributes']=_[_0xc60a('0x35')](_0x60e0d9[_0xc60a('0x30')],qs['fields'](_0x498e48[_0xc60a('0x31')][_0xc60a('0x36')]));_0x44d172[_0xc60a('0x34')]=_0x44d172[_0xc60a('0x34')]['length']?_0x44d172[_0xc60a('0x34')]:_0x60e0d9[_0xc60a('0x30')];if(_0x498e48[_0xc60a('0x31')][_0xc60a('0x41')]){_0x44d172[_0xc60a('0x45')]=[{'all':!![]}];}_0x44d172=_[_0xc60a('0x3d')]({},_0x44d172,_0x498e48[_0xc60a('0x40')]);return db[_0xc60a('0x2c')][_0xc60a('0x46')](_0x44d172)['then'](handleEntityNotFound(_0x386a01,null))[_0xc60a('0x25')](respondWithResult(_0x386a01,null))[_0xc60a('0x47')](handleError(_0x386a01,null));};exports[_0xc60a('0x48')]=function(_0x33b10c,_0x52a9a7){return db[_0xc60a('0x2c')][_0xc60a('0x48')](_0x33b10c[_0xc60a('0x49')],{})['then'](respondWithResult(_0x52a9a7,0xc9))[_0xc60a('0x47')](handleError(_0x52a9a7,null));};exports['update']=function(_0x51b277,_0x13ba5c){if(_0x51b277[_0xc60a('0x49')]['id']){delete _0x51b277[_0xc60a('0x49')]['id'];}return db[_0xc60a('0x2c')][_0xc60a('0x46')]({'where':{'id':_0x51b277[_0xc60a('0x44')]['id']}})[_0xc60a('0x25')](handleEntityNotFound(_0x13ba5c,null))[_0xc60a('0x25')](saveUpdates(_0x51b277[_0xc60a('0x49')],null))[_0xc60a('0x25')](respondWithResult(_0x13ba5c,null))[_0xc60a('0x47')](handleError(_0x13ba5c,null));};exports[_0xc60a('0x26')]=function(_0x2d31ee,_0x3e5037){return db[_0xc60a('0x2c')]['find']({'where':{'id':_0x2d31ee['params']['id']}})[_0xc60a('0x25')](handleEntityNotFound(_0x3e5037,null))[_0xc60a('0x25')](removeEntity(_0x3e5037,null))[_0xc60a('0x47')](handleError(_0x3e5037,null));}; \ No newline at end of file +var _0x338f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','OpenchannelApplication','includeAll','findAll','catch','params','keys','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x338f,0x1b6));var _0xf338=function(_0x1bc42d,_0x1b8a92){_0x1bc42d=_0x1bc42d-0x0;var _0x2a4351=_0x338f[_0x1bc42d];return _0x2a4351;};'use strict';var emlformat=require(_0xf338('0x0'));var rimraf=require(_0xf338('0x1'));var zipdir=require(_0xf338('0x2'));var jsonpatch=require(_0xf338('0x3'));var rp=require('request-promise');var moment=require(_0xf338('0x4'));var BPromise=require(_0xf338('0x5'));var Mustache=require('mustache');var util=require(_0xf338('0x6'));var path=require(_0xf338('0x7'));var sox=require(_0xf338('0x8'));var csv=require(_0xf338('0x9'));var ejs=require(_0xf338('0xa'));var fs=require('fs');var fs_extra=require(_0xf338('0xb'));var _=require(_0xf338('0xc'));var squel=require(_0xf338('0xd'));var crypto=require(_0xf338('0xe'));var jsforce=require(_0xf338('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf338('0x9'));var querystring=require(_0xf338('0x10'));var Papa=require(_0xf338('0x11'));var Redis=require(_0xf338('0x12'));var authService=require(_0xf338('0x13'));var qs=require(_0xf338('0x14'));var as=require(_0xf338('0x15'));var hardwareService=require(_0xf338('0x16'));var logger=require(_0xf338('0x17'))(_0xf338('0x18'));var utils=require(_0xf338('0x19'));var config=require(_0xf338('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf338('0x1b'))['db'];function respondWithStatusCode(_0x295f84,_0x56cf2d){_0x56cf2d=_0x56cf2d||0xcc;return function(_0x3de0e2){if(_0x3de0e2){return _0x295f84[_0xf338('0x1c')](_0x56cf2d);}return _0x295f84[_0xf338('0x1d')](_0x56cf2d)[_0xf338('0x1e')]();};}function respondWithResult(_0x1fb158,_0x4c876f){_0x4c876f=_0x4c876f||0xc8;return function(_0x2743e2){if(_0x2743e2){return _0x1fb158[_0xf338('0x1d')](_0x4c876f)[_0xf338('0x1f')](_0x2743e2);}};}function respondWithFilteredResult(_0x4a6ea9,_0x251681){return function(_0x2388b3){if(_0x2388b3){var _0x22093e=typeof _0x251681[_0xf338('0x20')]==='undefined'&&typeof _0x251681[_0xf338('0x21')]==='undefined';var _0x48e187=_0x2388b3[_0xf338('0x22')];var _0xd3a271=_0x22093e?0x0:_0x251681[_0xf338('0x20')];var _0x4ca227=_0x22093e?_0x2388b3[_0xf338('0x22')]:_0x251681[_0xf338('0x20')]+_0x251681[_0xf338('0x21')];var _0x16b170;if(_0x4ca227>=_0x48e187){_0x4ca227=_0x48e187;_0x16b170=0xc8;}else{_0x16b170=0xce;}_0x4a6ea9[_0xf338('0x1d')](_0x16b170);return _0x4a6ea9[_0xf338('0x23')](_0xf338('0x24'),_0xd3a271+'-'+_0x4ca227+'/'+_0x48e187)[_0xf338('0x1f')](_0x2388b3);}return null;};}function patchUpdates(_0x1d19ab){return function(_0x2381dd){try{jsonpatch[_0xf338('0x25')](_0x2381dd,_0x1d19ab,!![]);}catch(_0x521249){return BPromise['reject'](_0x521249);}return _0x2381dd[_0xf338('0x26')]();};}function saveUpdates(_0x5877f8,_0x258aa0){return function(_0x282cca){if(_0x282cca){return _0x282cca[_0xf338('0x27')](_0x5877f8)[_0xf338('0x28')](function(_0x1768a6){return _0x1768a6;});}return null;};}function removeEntity(_0x1f7614,_0xaaf5c){return function(_0x1f3820){if(_0x1f3820){return _0x1f3820['destroy']()[_0xf338('0x28')](function(){_0x1f7614[_0xf338('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x467e8d,_0x52d607){return function(_0x5844a2){if(!_0x5844a2){_0x467e8d[_0xf338('0x1c')](0x194);}return _0x5844a2;};}function handleError(_0x4509c,_0x2fe813){_0x2fe813=_0x2fe813||0x1f4;return function(_0x353171){logger[_0xf338('0x29')](_0x353171[_0xf338('0x2a')]);if(_0x353171['name']){delete _0x353171[_0xf338('0x2b')];}_0x4509c[_0xf338('0x1d')](_0x2fe813)[_0xf338('0x2c')](_0x353171);};}exports[_0xf338('0x2d')]=function(_0x4e9676,_0x250523){var _0x134972={},_0x457e15={},_0x514743={'count':0x0,'rows':[]};var _0x535faa=_['map'](db['OpenchannelApplication'][_0xf338('0x2e')],function(_0x25ad09){return{'name':_0x25ad09[_0xf338('0x2f')],'type':_0x25ad09[_0xf338('0x30')][_0xf338('0x31')]};});_0x457e15[_0xf338('0x32')]=_[_0xf338('0x33')](_0x535faa,_0xf338('0x2b'));_0x457e15[_0xf338('0x34')]=_['keys'](_0x4e9676[_0xf338('0x34')]);_0x457e15[_0xf338('0x35')]=_[_0xf338('0x36')](_0x457e15['model'],_0x457e15[_0xf338('0x34')]);_0x134972['attributes']=_[_0xf338('0x36')](_0x457e15[_0xf338('0x32')],qs['fields'](_0x4e9676[_0xf338('0x34')][_0xf338('0x37')]));_0x134972[_0xf338('0x38')]=_0x134972[_0xf338('0x38')][_0xf338('0x39')]?_0x134972['attributes']:_0x457e15['model'];if(!_0x4e9676[_0xf338('0x34')]['hasOwnProperty'](_0xf338('0x3a'))){_0x134972['limit']=qs['limit'](_0x4e9676[_0xf338('0x34')][_0xf338('0x21')]);_0x134972[_0xf338('0x20')]=qs[_0xf338('0x20')](_0x4e9676[_0xf338('0x34')][_0xf338('0x20')]);}_0x134972[_0xf338('0x3b')]=qs[_0xf338('0x3c')](_0x4e9676[_0xf338('0x34')][_0xf338('0x3c')]);_0x134972[_0xf338('0x3d')]=qs[_0xf338('0x35')](_[_0xf338('0x3e')](_0x4e9676[_0xf338('0x34')],_0x457e15['filters']),_0x535faa);if(_0x4e9676['query'][_0xf338('0x3f')]){_0x134972[_0xf338('0x3d')]=_[_0xf338('0x40')](_0x134972['where'],{'$or':_[_0xf338('0x33')](_0x535faa,function(_0x4d16d5){if(_0x4d16d5[_0xf338('0x30')]!=='VIRTUAL'){var _0x106fd7={};_0x106fd7[_0x4d16d5[_0xf338('0x2b')]]={'$like':'%'+_0x4e9676[_0xf338('0x34')][_0xf338('0x3f')]+'%'};return _0x106fd7;}})});}_0x134972=_[_0xf338('0x40')]({},_0x134972,_0x4e9676['options']);var _0x21c65c={'where':_0x134972[_0xf338('0x3d')]};return db[_0xf338('0x41')][_0xf338('0x22')](_0x21c65c)[_0xf338('0x28')](function(_0x2b1382){_0x514743[_0xf338('0x22')]=_0x2b1382;if(_0x4e9676[_0xf338('0x34')][_0xf338('0x42')]){_0x134972['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf338('0x43')](_0x134972);})['then'](function(_0x9451f8){_0x514743['rows']=_0x9451f8;return _0x514743;})[_0xf338('0x28')](respondWithFilteredResult(_0x250523,_0x134972))[_0xf338('0x44')](handleError(_0x250523,null));};exports['show']=function(_0x128fd4,_0x360abf){var _0xa23207={'raw':!![],'where':{'id':_0x128fd4[_0xf338('0x45')]['id']}},_0x256bd4={};_0x256bd4[_0xf338('0x32')]=_[_0xf338('0x46')](db[_0xf338('0x41')][_0xf338('0x2e')]);_0x256bd4[_0xf338('0x34')]=_['keys'](_0x128fd4['query']);_0x256bd4[_0xf338('0x35')]=_[_0xf338('0x36')](_0x256bd4[_0xf338('0x32')],_0x256bd4[_0xf338('0x34')]);_0xa23207[_0xf338('0x38')]=_[_0xf338('0x36')](_0x256bd4['model'],qs[_0xf338('0x37')](_0x128fd4['query'][_0xf338('0x37')]));_0xa23207[_0xf338('0x38')]=_0xa23207[_0xf338('0x38')]['length']?_0xa23207['attributes']:_0x256bd4[_0xf338('0x32')];if(_0x128fd4[_0xf338('0x34')]['includeAll']){_0xa23207[_0xf338('0x47')]=[{'all':!![]}];}_0xa23207=_[_0xf338('0x40')]({},_0xa23207,_0x128fd4[_0xf338('0x48')]);return db['OpenchannelApplication'][_0xf338('0x49')](_0xa23207)['then'](handleEntityNotFound(_0x360abf,null))['then'](respondWithResult(_0x360abf,null))[_0xf338('0x44')](handleError(_0x360abf,null));};exports['create']=function(_0x34eb5f,_0x1da753){return db[_0xf338('0x41')][_0xf338('0x4a')](_0x34eb5f[_0xf338('0x4b')],{})['then'](respondWithResult(_0x1da753,0xc9))[_0xf338('0x44')](handleError(_0x1da753,null));};exports[_0xf338('0x27')]=function(_0x343d36,_0xc44e3f){if(_0x343d36[_0xf338('0x4b')]['id']){delete _0x343d36[_0xf338('0x4b')]['id'];}return db[_0xf338('0x41')][_0xf338('0x49')]({'where':{'id':_0x343d36[_0xf338('0x45')]['id']}})['then'](handleEntityNotFound(_0xc44e3f,null))[_0xf338('0x28')](saveUpdates(_0x343d36['body'],null))['then'](respondWithResult(_0xc44e3f,null))[_0xf338('0x44')](handleError(_0xc44e3f,null));};exports['destroy']=function(_0x45f02c,_0x5989e2){return db[_0xf338('0x41')]['find']({'where':{'id':_0x45f02c[_0xf338('0x45')]['id']}})['then'](handleEntityNotFound(_0x5989e2,null))[_0xf338('0x28')](removeEntity(_0x5989e2,null))[_0xf338('0x44')](handleError(_0x5989e2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1b33548..2f97af4 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 _0x7a48=['bluebird','request-promise','path','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x2bda2f,_0x56582f){var _0x585013=function(_0x22c9c8){while(--_0x22c9c8){_0x2bda2f['push'](_0x2bda2f['shift']());}};_0x585013(++_0x56582f);}(_0x7a48,0x80));var _0x87a4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7a48[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x87a4('0x0'));var util=require(_0x87a4('0x1'));var logger=require('../../config/logger')(_0x87a4('0x2'));var moment=require(_0x87a4('0x3'));var BPromise=require(_0x87a4('0x4'));var rp=require(_0x87a4('0x5'));var fs=require('fs');var path=require(_0x87a4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x87a4('0x7')]=function(_0x221e24,_0x1e30e5){return _0x221e24[_0x87a4('0x8')](_0x87a4('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87a4('0xa'),'collate':_0x87a4('0xb')});}; \ No newline at end of file +var _0x5f8c=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','utf8mb4'];(function(_0xc8b86c,_0x2ad921){var _0x469795=function(_0x18fd32){while(--_0x18fd32){_0xc8b86c['push'](_0xc8b86c['shift']());}};_0x469795(++_0x2ad921);}(_0x5f8c,0x8d));var _0xc5f8=function(_0x1e05d2,_0x253abc){_0x1e05d2=_0x1e05d2-0x0;var _0x1094af=_0x5f8c[_0x1e05d2];return _0x1094af;};'use strict';var _=require(_0xc5f8('0x0'));var util=require(_0xc5f8('0x1'));var logger=require('../../config/logger')(_0xc5f8('0x2'));var moment=require(_0xc5f8('0x3'));var BPromise=require(_0xc5f8('0x4'));var rp=require(_0xc5f8('0x5'));var fs=require('fs');var path=require(_0xc5f8('0x6'));var rimraf=require(_0xc5f8('0x7'));var config=require(_0xc5f8('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xc5f8('0x9')]=function(_0x4edd0c,_0x10c9dc){return _0x4edd0c[_0xc5f8('0xa')](_0xc5f8('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc5f8('0xc'),'collate':_0xc5f8('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index c6fcab2..98811c3 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 _0xd018=['body','raw','options','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0xd018,0x16e));var _0x8d01=function(_0x576099,_0xe7962e){_0x576099=_0x576099-0x0;var _0x461cf9=_0xd018[_0x576099];return _0x461cf9;};'use strict';var _=require(_0x8d01('0x0'));var util=require(_0x8d01('0x1'));var moment=require(_0x8d01('0x2'));var BPromise=require(_0x8d01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d01('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d01('0x5'));var logger=require(_0x8d01('0x6'))(_0x8d01('0x7'));var config=require(_0x8d01('0x8'));var jayson=require(_0x8d01('0x9'));var client=jayson[_0x8d01('0xa')][_0x8d01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52808c,_0x21c64c,_0x1a6a36){return new BPromise(function(_0x3c6f30,_0x21bc7b){return client['request'](_0x52808c,_0x1a6a36)[_0x8d01('0xc')](function(_0x42bb09){logger[_0x8d01('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x21c64c,_0x8d01('0xe'));logger[_0x8d01('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x21c64c,_0x8d01('0xe'),JSON[_0x8d01('0x10')](_0x42bb09));if(_0x42bb09['error']){if(_0x42bb09[_0x8d01('0x11')]['code']===0x1f4){logger[_0x8d01('0x11')](_0x8d01('0x12'),_0x21c64c,_0x42bb09[_0x8d01('0x11')][_0x8d01('0x13')]);return _0x21bc7b(_0x42bb09[_0x8d01('0x11')][_0x8d01('0x13')]);}logger[_0x8d01('0x11')](_0x8d01('0x12'),_0x21c64c,_0x42bb09[_0x8d01('0x11')]['message']);return _0x3c6f30(_0x42bb09[_0x8d01('0x11')][_0x8d01('0x13')]);}else{logger['info'](_0x8d01('0x12'),_0x21c64c,'request\x20sent');_0x3c6f30(_0x42bb09[_0x8d01('0x14')][_0x8d01('0x13')]);}})[_0x8d01('0x15')](function(_0x45cc01){logger['error'](_0x8d01('0x12'),_0x21c64c,_0x45cc01);_0x21bc7b(_0x45cc01);});});}exports[_0x8d01('0x16')]=function(_0x5d54eb){var _0x46ac43=this;return new Promise(function(_0x468058,_0x1d5366){return db[_0x8d01('0x17')]['update'](_0x5d54eb[_0x8d01('0x18')],{'raw':_0x5d54eb['options']?_0x5d54eb['options'][_0x8d01('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d54eb[_0x8d01('0x1a')]?_0x5d54eb[_0x8d01('0x1a')][_0x8d01('0x1b')]||null:null,'attributes':_0x5d54eb[_0x8d01('0x1a')]?_0x5d54eb[_0x8d01('0x1a')][_0x8d01('0x1c')]||null:null,'limit':_0x5d54eb[_0x8d01('0x1a')]?_0x5d54eb[_0x8d01('0x1a')][_0x8d01('0x1d')]||null:null})['then'](function(_0x37e409){logger[_0x8d01('0xd')](_0x8d01('0x16'),_0x5d54eb);logger[_0x8d01('0xf')](_0x8d01('0x16'),_0x5d54eb,JSON[_0x8d01('0x10')](_0x37e409));_0x468058(_0x37e409);})['catch'](function(_0x3613bb){logger[_0x8d01('0x11')](_0x8d01('0x16'),_0x3613bb['message'],_0x5d54eb);_0x1d5366(_0x46ac43['error'](0x1f4,_0x3613bb['message']));});});}; \ No newline at end of file +var _0x475a=['message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','limit','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x475a,0x95));var _0xa475=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x475a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa475('0x0'));var util=require(_0xa475('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa475('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa475('0x3'))['db'];var utils=require(_0xa475('0x4'));var logger=require(_0xa475('0x5'))(_0xa475('0x6'));var config=require(_0xa475('0x7'));var jayson=require(_0xa475('0x8'));var client=jayson[_0xa475('0x9')][_0xa475('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5894dc,_0x123631,_0x316b24){return new BPromise(function(_0x1c3548,_0x26b106){return client[_0xa475('0xb')](_0x5894dc,_0x316b24)[_0xa475('0xc')](function(_0xc6d0c){logger[_0xa475('0xd')](_0xa475('0xe'),_0x123631,_0xa475('0xf'));logger[_0xa475('0x10')](_0xa475('0x11'),_0x123631,_0xa475('0xf'),JSON['stringify'](_0xc6d0c));if(_0xc6d0c[_0xa475('0x12')]){if(_0xc6d0c[_0xa475('0x12')]['code']===0x1f4){logger[_0xa475('0x12')](_0xa475('0xe'),_0x123631,_0xc6d0c[_0xa475('0x12')][_0xa475('0x13')]);return _0x26b106(_0xc6d0c[_0xa475('0x12')]['message']);}logger['error'](_0xa475('0xe'),_0x123631,_0xc6d0c[_0xa475('0x12')][_0xa475('0x13')]);return _0x1c3548(_0xc6d0c[_0xa475('0x12')][_0xa475('0x13')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x123631,_0xa475('0xf'));_0x1c3548(_0xc6d0c['result'][_0xa475('0x13')]);}})[_0xa475('0x14')](function(_0x282a19){logger[_0xa475('0x12')](_0xa475('0xe'),_0x123631,_0x282a19);_0x26b106(_0x282a19);});});}exports[_0xa475('0x15')]=function(_0x1e3479){var _0xd17da2=this;return new Promise(function(_0x35bbe8,_0x480d5c){return db[_0xa475('0x16')][_0xa475('0x17')](_0x1e3479[_0xa475('0x18')],{'raw':_0x1e3479['options']?_0x1e3479[_0xa475('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e3479[_0xa475('0x19')]?_0x1e3479[_0xa475('0x19')]['where']||null:null,'attributes':_0x1e3479[_0xa475('0x19')]?_0x1e3479[_0xa475('0x19')]['attributes']||null:null,'limit':_0x1e3479[_0xa475('0x19')]?_0x1e3479['options'][_0xa475('0x1a')]||null:null})[_0xa475('0xc')](function(_0x5f39b4){logger['info'](_0xa475('0x15'),_0x1e3479);logger['debug']('UpdateOpenchannelApplication',_0x1e3479,JSON[_0xa475('0x1b')](_0x5f39b4));_0x35bbe8(_0x5f39b4);})[_0xa475('0x14')](function(_0x593efa){logger[_0xa475('0x12')](_0xa475('0x15'),_0x593efa[_0xa475('0x13')],_0x1e3479);_0x480d5c(_0xd17da2['error'](0x1f4,_0x593efa['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 59277aa..02c60cc 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 _0x33b5=['/:id/download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','getMessages'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x33b5,0xe9));var _0x533b=function(_0x4911bd,_0x496ddb){_0x4911bd=_0x4911bd-0x0;var _0x27af33=_0x33b5[_0x4911bd];return _0x27af33;};'use strict';var multer=require(_0x533b('0x0'));var util=require(_0x533b('0x1'));var path=require('path');var timeout=require(_0x533b('0x2'));var express=require(_0x533b('0x3'));var router=express[_0x533b('0x4')]();var fs_extra=require(_0x533b('0x5'));var auth=require(_0x533b('0x6'));var interaction=require(_0x533b('0x7'));var config=require(_0x533b('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x533b('0x9')]('/',auth[_0x533b('0xa')](),controller[_0x533b('0xb')]);router[_0x533b('0x9')](_0x533b('0xc'),auth[_0x533b('0xa')](),controller['describe']);router[_0x533b('0x9')]('/:id',auth[_0x533b('0xa')](),controller[_0x533b('0xd')]);router[_0x533b('0x9')]('/:id/messages',auth[_0x533b('0xa')](),controller[_0x533b('0xe')]);router[_0x533b('0x9')](_0x533b('0xf'),auth[_0x533b('0xa')](),controller['download']);router[_0x533b('0x10')]('/',auth[_0x533b('0xa')](),controller['create']);router['post']('/:id/messages',auth[_0x533b('0xa')](),controller[_0x533b('0x11')]);router[_0x533b('0x10')](_0x533b('0x12'),auth[_0x533b('0xa')](),interaction[_0x533b('0x13')](_0x533b('0x14'),_0x533b('0x15')),controller[_0x533b('0x16')]);router['put'](_0x533b('0x17'),auth[_0x533b('0xa')](),interaction[_0x533b('0x13')]('openchannel',_0x533b('0x18')),controller[_0x533b('0x19')]);router[_0x533b('0x1a')](_0x533b('0x17'),auth['isAuthenticated'](),interaction[_0x533b('0x13')](_0x533b('0x14'),_0x533b('0x1b')),controller[_0x533b('0x1c')]);router[_0x533b('0x1a')](_0x533b('0x12'),auth[_0x533b('0xa')](),controller[_0x533b('0x1d')]);module[_0x533b('0x1e')]=router; \ No newline at end of file +var _0x0359=['/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage'];(function(_0x53c823,_0x1b5c9e){var _0x4e6881=function(_0x3d4a92){while(--_0x3d4a92){_0x53c823['push'](_0x53c823['shift']());}};_0x4e6881(++_0x1b5c9e);}(_0x0359,0x1ae));var _0x9035=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0359[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require('multer');var util=require(_0x9035('0x0'));var path=require(_0x9035('0x1'));var timeout=require(_0x9035('0x2'));var express=require('express');var router=express[_0x9035('0x3')]();var fs_extra=require(_0x9035('0x4'));var auth=require(_0x9035('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9035('0x6'));router[_0x9035('0x7')]('/',auth[_0x9035('0x8')](),controller[_0x9035('0x9')]);router[_0x9035('0x7')](_0x9035('0xa'),auth[_0x9035('0x8')](),controller[_0x9035('0xb')]);router[_0x9035('0x7')](_0x9035('0xc'),auth[_0x9035('0x8')](),controller[_0x9035('0xd')]);router[_0x9035('0x7')]('/:id/messages',auth[_0x9035('0x8')](),controller[_0x9035('0xe')]);router['get'](_0x9035('0xf'),auth['isAuthenticated'](),controller[_0x9035('0x10')]);router['post']('/',auth[_0x9035('0x8')](),controller['create']);router[_0x9035('0x11')](_0x9035('0x12'),auth[_0x9035('0x8')](),controller[_0x9035('0x13')]);router[_0x9035('0x11')](_0x9035('0x14'),auth['isAuthenticated'](),interaction[_0x9035('0x15')](_0x9035('0x16'),_0x9035('0x17')),controller[_0x9035('0x18')]);router['put'](_0x9035('0xc'),auth[_0x9035('0x8')](),interaction[_0x9035('0x15')](_0x9035('0x16'),_0x9035('0x19')),controller[_0x9035('0x1a')]);router[_0x9035('0x1b')](_0x9035('0xc'),auth[_0x9035('0x8')](),interaction['tracked'](_0x9035('0x16'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x9035('0x1b')](_0x9035('0x14'),auth[_0x9035('0x8')](),controller[_0x9035('0x1c')]);module[_0x9035('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d2ef87b..f65b702 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 _0x43fd=['sequelize','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43fd,0x150));var _0xd43f=function(_0x26a8e4,_0x3e40d2){_0x26a8e4=_0x26a8e4-0x0;var _0xc072bf=_0x43fd[_0x26a8e4];return _0xc072bf;};'use strict';var Sequelize=require(_0xd43f('0x0'));module[_0xd43f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd43f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd43f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd43f('0x3')]},'note':{'type':Sequelize[_0xd43f('0x3')]},'read1stAt':{'type':Sequelize[_0xd43f('0x2')]},'threadId':{'type':Sequelize[_0xd43f('0x3')]},'externalUrl':{'type':Sequelize[_0xd43f('0x3')]},'lastMsgAt':{'type':Sequelize[_0xd43f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd43f('0x4')]('in',_0xd43f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd43f('0x4')]('in',_0xd43f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd43f('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd43f('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xb0d9=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x439fd2,_0x2c1ca2){_0x439fd2=_0x439fd2-0x0;var _0x175d12=_0xb0d9[_0x439fd2];return _0x175d12;};'use strict';var Sequelize=require(_0x9b0d('0x0'));module[_0x9b0d('0x1')]={'closed':{'type':Sequelize[_0x9b0d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9b0d('0x3')]},'disposition':{'type':Sequelize[_0x9b0d('0x4')]},'secondDisposition':{'type':Sequelize[_0x9b0d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9b0d('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x9b0d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9b0d('0x5')]('in',_0x9b0d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x9b0d('0x5')]('in',_0x9b0d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9b0d('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x9b0d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 4625995..186ae73 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 _0x5345=['from','params','OpenchannelInteraction','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','fieldName','type','findAll','user','catch','show','query'];(function(_0x58ddd1,_0x58c480){var _0x596924=function(_0x1f3138){while(--_0x1f3138){_0x58ddd1['push'](_0x58ddd1['shift']());}};_0x596924(++_0x58c480);}(_0x5345,0xdf));var _0x5534=function(_0x19db35,_0x935ad2){_0x19db35=_0x19db35-0x0;var _0x187b19=_0x5345[_0x19db35];return _0x187b19;};'use strict';var rimraf=require(_0x5534('0x0'));var zipdir=require('zip-dir');var moment=require(_0x5534('0x1'));var util=require(_0x5534('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5534('0x3'));var Redis=require(_0x5534('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x5534('0x5'));var pdf=require(_0x5534('0x6'));var logger=require(_0x5534('0x7'))('api');var config=require('../../config/environment');var db=require(_0x5534('0x8'))['db'];config[_0x5534('0x9')]=_['defaults'](config['redis'],{'host':_0x5534('0xa'),'port':0x18eb});var socket=require(_0x5534('0xb'))(new Redis(config[_0x5534('0x9')]));require(_0x5534('0xc'))[_0x5534('0xd')](socket);function respondWithStatusCode(_0x36049b,_0x2fed0d){_0x2fed0d=_0x2fed0d||0xcc;return function(_0x4b4ad9){if(_0x4b4ad9){return _0x36049b[_0x5534('0xe')](_0x2fed0d);}return _0x36049b[_0x5534('0xf')](_0x2fed0d)['end']();};}function respondWithResult(_0x16b2da,_0x3d03b2){_0x3d03b2=_0x3d03b2||0xc8;return function(_0x582352){if(_0x582352){return _0x16b2da['status'](_0x3d03b2)[_0x5534('0x10')](_0x582352);}};}function respondWithFilteredResult(_0x407ba8,_0x5b54e2){return function(_0x22cc08){if(_0x22cc08){var _0x569e86=typeof _0x5b54e2[_0x5534('0x11')]==='undefined'&&typeof _0x5b54e2[_0x5534('0x12')]===_0x5534('0x13');var _0x488674=_0x22cc08[_0x5534('0x14')];var _0x2bed1f=_0x569e86?0x0:_0x5b54e2[_0x5534('0x11')];var _0x2e5425=_0x569e86?_0x22cc08['count']:_0x5b54e2[_0x5534('0x11')]+_0x5b54e2['limit'];var _0x340b68;if(_0x2e5425>=_0x488674){_0x2e5425=_0x488674;_0x340b68=0xc8;}else{_0x340b68=0xce;}_0x407ba8[_0x5534('0xf')](_0x340b68);return _0x407ba8[_0x5534('0x15')](_0x5534('0x16'),_0x2bed1f+'-'+_0x2e5425+'/'+_0x488674)['json'](_0x22cc08);}return null;};}function saveUpdates(_0x3e7f00){return function(_0xa4f810){if(_0xa4f810){return _0xa4f810[_0x5534('0x17')](_0x3e7f00)[_0x5534('0x18')](function(_0x2854ec){return _0x2854ec;});}return null;};}function removeEntity(_0x452322){return function(_0x3b0f1e){if(_0x3b0f1e){return _0x3b0f1e[_0x5534('0x19')]()[_0x5534('0x18')](function(){_0x452322[_0x5534('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31841a){return function(_0x4b3d3a){if(!_0x4b3d3a){_0x31841a[_0x5534('0xe')](0x194);}return _0x4b3d3a;};}function handleError(_0x32f6b2,_0x37fd30){_0x37fd30=_0x37fd30||0x1f4;return function(_0x986ccf){logger[_0x5534('0x1a')](_0x986ccf[_0x5534('0x1b')]);if(_0x986ccf[_0x5534('0x1c')]){delete _0x986ccf[_0x5534('0x1c')];}_0x32f6b2['status'](_0x37fd30)[_0x5534('0x1d')](_0x986ccf);};}exports[_0x5534('0x1e')]=function(_0x473f01,_0x2d202d){var _0x38dc63={};var _0x28b023=_[_0x5534('0x1f')](db['OpenchannelInteraction']['rawAttributes'],function(_0x3b2ae5){return{'name':_0x3b2ae5[_0x5534('0x20')],'type':_0x3b2ae5[_0x5534('0x21')]['key']};});_0x38dc63=qs['getOptions'](_0x28b023,_0x473f01);return interaction[_0x5534('0x22')]('openchannel',_0x473f01['query'],_0x473f01[_0x5534('0x23')],_0x38dc63,_0x28b023)[_0x5534('0x18')](respondWithFilteredResult(_0x2d202d,_0x38dc63))[_0x5534('0x24')](handleError(_0x2d202d,null));};exports[_0x5534('0x25')]=function(_0x358f52,_0x5e37d5){var _0x1dbd18={};if(_0x358f52[_0x5534('0x26')]['type']&&_0x358f52[_0x5534('0x26')][_0x5534('0x21')]===_0x5534('0x27')){_0x1dbd18[_0x5534('0x27')]=_0x358f52[_0x5534('0x28')]['id'];}else{_0x1dbd18['id']=_0x358f52['params']['id'];}var _0x51cd78={'raw':![],'where':_0x1dbd18},_0x40fb97={};_0x40fb97['model']=_['keys'](db[_0x5534('0x29')]['rawAttributes']);_0x40fb97[_0x5534('0x26')]=_[_0x5534('0x2a')](_0x358f52[_0x5534('0x26')]);_0x40fb97[_0x5534('0x2b')]=_[_0x5534('0x2c')](_0x40fb97[_0x5534('0x2d')],_0x40fb97[_0x5534('0x26')]);_0x51cd78[_0x5534('0x2e')]=_[_0x5534('0x2c')](_0x40fb97[_0x5534('0x2d')],qs[_0x5534('0x2f')](_0x358f52[_0x5534('0x26')]['fields']));_0x51cd78[_0x5534('0x2e')]=_0x51cd78['attributes'][_0x5534('0x30')]?_0x51cd78[_0x5534('0x2e')]:_0x40fb97[_0x5534('0x2d')];if(_0x358f52['query'][_0x5534('0x31')]){_0x51cd78['include']=[{'all':!![]}];}_0x51cd78=_[_0x5534('0x32')]({},_0x51cd78,_0x358f52[_0x5534('0x33')]);return db['OpenchannelInteraction'][_0x5534('0x34')](_0x51cd78)[_0x5534('0x18')](handleEntityNotFound(_0x5e37d5,null))['then'](respondWithResult(_0x5e37d5,null))[_0x5534('0x24')](handleError(_0x5e37d5,null));};exports[_0x5534('0x35')]=function(_0x19513c,_0x5c5956){return db[_0x5534('0x29')][_0x5534('0x35')](_0x19513c[_0x5534('0x36')],{})['then'](respondWithResult(_0x5c5956,0xc9))[_0x5534('0x24')](handleError(_0x5c5956,null));};exports[_0x5534('0x17')]=function(_0x4a418c,_0x2bcc8e){if(_0x4a418c[_0x5534('0x36')]['id']){delete _0x4a418c['body']['id'];}return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x4a418c[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x2bcc8e,null))['then'](saveUpdates(_0x4a418c[_0x5534('0x36')],null))[_0x5534('0x18')](respondWithResult(_0x2bcc8e,null))[_0x5534('0x24')](handleError(_0x2bcc8e,null));};exports[_0x5534('0x19')]=function(_0x5cd14e,_0x5a1c30){return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x5cd14e[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x5a1c30,null))[_0x5534('0x18')](removeEntity(_0x5a1c30,null))[_0x5534('0x24')](handleError(_0x5a1c30,null));};exports['describe']=function(_0x3441f2,_0x274ad1){return db['OpenchannelInteraction'][_0x5534('0x37')]()[_0x5534('0x18')](respondWithResult(_0x274ad1,null))[_0x5534('0x24')](handleError(_0x274ad1,null));};exports[_0x5534('0x38')]=function(_0x289bca,_0x551bec){return db[_0x5534('0x39')]['find']({'where':{'id':_0x289bca[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x551bec,null))[_0x5534('0x18')](function(_0x4b612){if(_0x4b612){return _0x4b612['addMessage'](_0x289bca[_0x5534('0x36')][_0x5534('0x3a')],_[_0x5534('0x3b')](_0x289bca[_0x5534('0x36')],[_0x5534('0x3a'),'id'])||{});}})[_0x5534('0x18')](respondWithResult(_0x551bec,null))['catch'](handleError(_0x551bec,null));};exports['getMessages']=function(_0x373004,_0x5cbf0b){var _0x3aefea={'raw':![],'where':{}};var _0x165018={};var _0x42e736={'count':0x0,'rows':[]};return db[_0x5534('0x29')][_0x5534('0x3c')]({'where':{'id':_0x373004[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x5cbf0b,null))[_0x5534('0x18')](function(_0x1e3706){if(_0x1e3706){_0x165018[_0x5534('0x2d')]=_['keys'](db[_0x5534('0x39')][_0x5534('0x3d')]);_0x165018['query']=_[_0x5534('0x2a')](_0x373004[_0x5534('0x26')]);_0x165018['filters']=_['intersection'](_0x165018[_0x5534('0x2d')],_0x165018[_0x5534('0x26')]);_0x3aefea[_0x5534('0x2e')]=_[_0x5534('0x2c')](_0x165018['model'],qs[_0x5534('0x2f')](_0x373004['query'][_0x5534('0x2f')]));_0x3aefea[_0x5534('0x2e')]=_0x3aefea['attributes'][_0x5534('0x30')]?_0x3aefea['attributes']:_0x165018[_0x5534('0x2d')];if(!_0x373004[_0x5534('0x26')][_0x5534('0x3e')](_0x5534('0x3f'))){_0x3aefea[_0x5534('0x12')]=qs[_0x5534('0x12')](_0x373004[_0x5534('0x26')][_0x5534('0x12')]);_0x3aefea[_0x5534('0x11')]=qs[_0x5534('0x11')](_0x373004[_0x5534('0x26')][_0x5534('0x11')]);}_0x3aefea[_0x5534('0x40')]=qs[_0x5534('0x41')](_0x373004['query'][_0x5534('0x41')]);_0x3aefea[_0x5534('0x42')]=qs['filters'](_[_0x5534('0x43')](_0x373004[_0x5534('0x26')],_0x165018['filters']));_0x3aefea[_0x5534('0x42')][_0x5534('0x44')]=_0x1e3706['id'];if(_0x373004['query'][_0x5534('0x45')]){_0x3aefea[_0x5534('0x42')]=_['merge'](_0x3aefea[_0x5534('0x42')],{'$or':_[_0x5534('0x1f')](_0x3aefea[_0x5534('0x2e')],function(_0x2486a9){var _0x252080={};_0x252080[_0x2486a9]={'$like':'%'+_0x373004[_0x5534('0x26')]['filter']+'%'};return _0x252080;})});}if(_0x373004[_0x5534('0x26')]['$gte']){var _0x3cc599=_0x373004[_0x5534('0x26')]['$gte']['split'](',');var _0x1e8ea4={};_0x1e8ea4[_0x3cc599[0x0]]={'$gte':moment(_0x3cc599[0x1])[_0x5534('0x46')](_0x5534('0x47'))};_0x3aefea[_0x5534('0x42')]=_[_0x5534('0x32')](_0x3aefea[_0x5534('0x42')],_0x1e8ea4);}_0x3aefea=_[_0x5534('0x32')]({},_0x3aefea,_0x373004[_0x5534('0x33')]);return db[_0x5534('0x39')][_0x5534('0x14')]({'where':_0x3aefea[_0x5534('0x42')]})[_0x5534('0x18')](function(_0x5def09){_0x42e736[_0x5534('0x14')]=_0x5def09;if(_0x373004[_0x5534('0x26')][_0x5534('0x31')]){_0x3aefea[_0x5534('0x48')]=[{'all':!![]}];}return db[_0x5534('0x39')][_0x5534('0x22')](_0x3aefea);})[_0x5534('0x18')](function(_0x2f5f4c){_0x42e736[_0x5534('0x49')]=_0x2f5f4c;return _0x42e736;});}})['then'](respondWithFilteredResult(_0x5cbf0b,_0x3aefea))[_0x5534('0x24')](handleError(_0x5cbf0b,null));};exports['addTags']=function(_0x5ead98,_0x44daee){return db[_0x5534('0x29')]['find']({'where':{'id':_0x5ead98[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x44daee,null))['then'](function(_0x4aed57){if(_0x4aed57){return _0x4aed57[_0x5534('0x4a')](_0x5ead98[_0x5534('0x36')][_0x5534('0x3a')],_[_0x5534('0x3b')](_0x5ead98[_0x5534('0x36')],['ids','id'])||{})[_0x5534('0x4b')](function(){return db[_0x5534('0x4c')]['findAll']({'attributes':['id',_0x5534('0x1c'),_0x5534('0x4d')],'where':{'id':_0x5ead98[_0x5534('0x36')][_0x5534('0x3a')]}});})[_0x5534('0x18')](function(_0x5eb6da){socket[_0x5534('0x4e')](_0x5534('0x4f'),{'id':Number(_0x5ead98[_0x5534('0x28')]['id']),'tags':_0x5eb6da||[]});return{'id':Number(_0x5ead98[_0x5534('0x28')]['id']),'tags':_0x5eb6da||[]};});}})['then'](respondWithResult(_0x44daee,null))[_0x5534('0x24')](handleError(_0x44daee,null));};exports[_0x5534('0x50')]=function(_0x33cd53,_0x3d1ef3){return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x33cd53[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x3d1ef3,null))[_0x5534('0x18')](function(_0x2c22a1){if(_0x2c22a1){return _0x2c22a1['removeTags'](_0x33cd53[_0x5534('0x26')][_0x5534('0x3a')]);}})[_0x5534('0x18')](respondWithStatusCode(_0x3d1ef3,null))[_0x5534('0x24')](handleError(_0x3d1ef3,null));};exports[_0x5534('0x51')]=function(_0x2f40e1,_0x13f66b){var _0x23d4c1=moment()[_0x5534('0x52')]()[_0x5534('0x53')]();var _0x586de2=path[_0x5534('0x54')](config['root'],_0x5534('0x55'),_0x5534('0x56'),_0x5534('0x57'));var _0x24eea9=path[_0x5534('0x54')](config[_0x5534('0x58')],_0x5534('0x55'),'files',_0x5534('0x59'));var _0x30c1e7=path[_0x5534('0x54')](_0x586de2,_0x23d4c1);var _0x42e117=util[_0x5534('0x46')](_0x5534('0x5a'),_0x2f40e1[_0x5534('0x28')]['id'],_0x23d4c1);var _0x37242e=path[_0x5534('0x54')](_0x586de2,_0x42e117);var _0x172566=[];_0x172566['push']({'model':db['User'],'as':_0x5534('0x5b'),'attributes':['id',_0x5534('0x5c')],'raw':!![]});_0x172566[_0x5534('0x5d')]({'model':db[_0x5534('0x5e')],'as':_0x5534('0x5f'),'attributes':['id',_0x5534('0x60'),'lastName'],'raw':!![]});if(_0x2f40e1[_0x5534('0x26')][_0x5534('0x59')]){_0x172566[_0x5534('0x5d')]({'model':db[_0x5534('0x61')],'as':'Attachment','raw':!![]});}var _0x56c455=[{'model':db[_0x5534('0x39')],'as':_0x5534('0x62'),'attributes':['id',_0x5534('0x36'),_0x5534('0x63'),_0x5534('0x64'),_0x5534('0x65'),_0x5534('0x66')],'include':_0x172566}];_0x56c455['push']({'model':db[_0x5534('0x67')],'as':_0x5534('0x68'),'attributes':['id',_0x5534('0x1c')]});_0x56c455[_0x5534('0x5d')]({'model':db[_0x5534('0x5b')],'as':_0x5534('0x69'),'attributes':['id',_0x5534('0x5c')]});return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x2f40e1[_0x5534('0x28')]['id']},'include':_0x56c455})[_0x5534('0x18')](handleEntityNotFound(_0x13f66b,null))[_0x5534('0x18')](function(_0x31a446){if(_0x31a446){var _0x2eb7d9=_0x31a446[_0x5534('0x6a')]({'plain':!![]});fs[_0x5534('0x6b')](_0x30c1e7);var _0x22b031={'channel':_0x5534('0x6c'),'account':_0x2eb7d9['Account'][_0x5534('0x1c')],'agent':_0x2eb7d9[_0x5534('0x69')]?_0x2eb7d9[_0x5534('0x69')][_0x5534('0x5c')]:_0x5534('0x6d'),'createdAt':moment(_0x2eb7d9[_0x5534('0x63')])[_0x5534('0x46')](_0x5534('0x47'))[_0x5534('0x53')](),'closedAt':_0x2eb7d9[_0x5534('0x6e')]?moment(_0x2eb7d9[_0x5534('0x6f')])[_0x5534('0x46')](_0x5534('0x47'))[_0x5534('0x53')]():'','disposition':_0x2eb7d9[_0x5534('0x70')],'visibility':_0x2eb7d9[_0x5534('0x71')]?'Public':_0x5534('0x72'),'messages':_(_0x2eb7d9[_0x5534('0x62')])['filter']({'secret':![]})['map'](function(_0x2642ce){if(_0x2642ce['Attachment']){var _0x3af121=path[_0x5534('0x54')](_0x24eea9,_0x2642ce[_0x5534('0x61')][_0x5534('0x73')]);if(fs[_0x5534('0x74')](_0x3af121)){fs[_0x5534('0x75')](_0x3af121)[_0x5534('0x76')](fs[_0x5534('0x77')](path[_0x5534('0x54')](_0x30c1e7,_0x2642ce[_0x5534('0x61')][_0x5534('0x73')])));}}return{'date':moment(_0x2642ce[_0x5534('0x63')])[_0x5534('0x46')](_0x5534('0x47'))[_0x5534('0x53')](),'sender':_0x2642ce[_0x5534('0x64')]===_0x5534('0x78')?_0x2642ce['User']?_0x2642ce['User'][_0x5534('0x5c')]:_0x5534('0x79'):_0x2642ce['Contact'][_0x5534('0x60')]+(_0x2642ce[_0x5534('0x5f')]['lastName']?'\x20'+_0x2642ce[_0x5534('0x5f')][_0x5534('0x7a')]:''),'body':_0x2642ce['Attachment']?_0x2642ce[_0x5534('0x61')][_0x5534('0x73')]:_0x2642ce[_0x5534('0x36')],'direction':_0x2642ce[_0x5534('0x64')]===_0x5534('0x78')?'A':'C','secret':_0x2642ce[_0x5534('0x65')],'read':_0x2642ce['read'],'attachment':_0x2642ce[_0x5534('0x61')]};})[_0x5534('0x7b')]()};return ejs[_0x5534('0x7c')](path[_0x5534('0x54')](config[_0x5534('0x58')],_0x5534('0x55'),_0x5534('0x7d'),_0x5534('0x7e')),{'interaction':_0x22b031})[_0x5534('0x18')](function(_0x25e8b9){var _0x470030=path[_0x5534('0x54')](_0x30c1e7,_0x5534('0x7f')+_0x2eb7d9['id']+'-'+_0x23d4c1+_0x5534('0x80'));var _0x3e2831={'path':_0x470030,'channel':_0x5534('0x6c'),'interactionId':_0x2eb7d9['id']};return pdf[_0x5534('0x81')](_0x25e8b9,_0x3e2831);})[_0x5534('0x18')](function(){return new Promise(function(_0x27e9a5,_0x3af18e){zipdir(_0x30c1e7,{'saveTo':_0x37242e},function(_0x59d4c5,_0x2fe2b5){if(_0x59d4c5)return _0x3af18e(_0x59d4c5);return _0x27e9a5(_0x2fe2b5);});})['then'](function(){return new Promise(function(_0x5d1b46,_0x42cfba){rimraf(_0x30c1e7,function(_0x31bb90){if(_0x31bb90)_0x42cfba(_0x31bb90);return _0x5d1b46();});});})[_0x5534('0x18')](function(){return _0x13f66b['download'](_0x37242e,_0x42e117,function(_0x3a6e8c){if(_0x3a6e8c){logger[_0x5534('0x1a')](_0x5534('0x82'),_0x3a6e8c);}else{fs['unlinkSync'](_0x37242e);}});});});}else{return _0x13f66b[_0x5534('0xe')](0xc8);}})[_0x5534('0x24')](handleError(_0x13f66b,null));}; \ No newline at end of file +var _0xbc31=['findAll','openchannel','query','user','catch','show','from','params','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','options','create','body','find','describe','ids','OpenchannelMessage','length','hasOwnProperty','order','sort','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','where','rows','setTags','Tag','color','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','direction','out','System','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions'];(function(_0x188105,_0x1bd0d1){var _0x2c46bd=function(_0x43a6a7){while(--_0x43a6a7){_0x188105['push'](_0x188105['shift']());}};_0x2c46bd(++_0x1bd0d1);}(_0xbc31,0xdb));var _0x1bc3=function(_0xbc0367,_0x247477){_0xbc0367=_0xbc0367-0x0;var _0x2307bd=_0xbc31[_0xbc0367];return _0x2307bd;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1bc3('0x0'));var moment=require(_0x1bc3('0x1'));var util=require(_0x1bc3('0x2'));var path=require(_0x1bc3('0x3'));var ejs=require(_0x1bc3('0x4'));var fs=require('fs');var _=require(_0x1bc3('0x5'));var Redis=require(_0x1bc3('0x6'));var interaction=require(_0x1bc3('0x7'));var qs=require(_0x1bc3('0x8'));var pdf=require(_0x1bc3('0x9'));var logger=require(_0x1bc3('0xa'))(_0x1bc3('0xb'));var config=require(_0x1bc3('0xc'));var db=require(_0x1bc3('0xd'))['db'];config[_0x1bc3('0xe')]=_['defaults'](config[_0x1bc3('0xe')],{'host':_0x1bc3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1bc3('0xe')]));require(_0x1bc3('0x10'))[_0x1bc3('0x11')](socket);function respondWithStatusCode(_0x125323,_0x282db9){_0x282db9=_0x282db9||0xcc;return function(_0x475640){if(_0x475640){return _0x125323[_0x1bc3('0x12')](_0x282db9);}return _0x125323[_0x1bc3('0x13')](_0x282db9)[_0x1bc3('0x14')]();};}function respondWithResult(_0x4d9518,_0x475f4e){_0x475f4e=_0x475f4e||0xc8;return function(_0x33f058){if(_0x33f058){return _0x4d9518[_0x1bc3('0x13')](_0x475f4e)[_0x1bc3('0x15')](_0x33f058);}};}function respondWithFilteredResult(_0x536f5a,_0x9d64bb){return function(_0x276b7e){if(_0x276b7e){var _0x4c9ac6=typeof _0x9d64bb[_0x1bc3('0x16')]===_0x1bc3('0x17')&&typeof _0x9d64bb[_0x1bc3('0x18')]===_0x1bc3('0x17');var _0xc80006=_0x276b7e[_0x1bc3('0x19')];var _0x276608=_0x4c9ac6?0x0:_0x9d64bb[_0x1bc3('0x16')];var _0x2ee476=_0x4c9ac6?_0x276b7e[_0x1bc3('0x19')]:_0x9d64bb[_0x1bc3('0x16')]+_0x9d64bb[_0x1bc3('0x18')];var _0x393113;if(_0x2ee476>=_0xc80006){_0x2ee476=_0xc80006;_0x393113=0xc8;}else{_0x393113=0xce;}_0x536f5a['status'](_0x393113);return _0x536f5a['set'](_0x1bc3('0x1a'),_0x276608+'-'+_0x2ee476+'/'+_0xc80006)[_0x1bc3('0x15')](_0x276b7e);}return null;};}function saveUpdates(_0x25d869){return function(_0x7f1509){if(_0x7f1509){return _0x7f1509[_0x1bc3('0x1b')](_0x25d869)[_0x1bc3('0x1c')](function(_0x9cac32){return _0x9cac32;});}return null;};}function removeEntity(_0x63530){return function(_0x35c0c5){if(_0x35c0c5){return _0x35c0c5[_0x1bc3('0x1d')]()['then'](function(){_0x63530[_0x1bc3('0x13')](0xcc)[_0x1bc3('0x14')]();});}};}function handleEntityNotFound(_0x57795d){return function(_0x19a5ac){if(!_0x19a5ac){_0x57795d[_0x1bc3('0x12')](0x194);}return _0x19a5ac;};}function handleError(_0x308d7f,_0x1bbac3){_0x1bbac3=_0x1bbac3||0x1f4;return function(_0x431883){logger['error'](_0x431883[_0x1bc3('0x1e')]);if(_0x431883['name']){delete _0x431883[_0x1bc3('0x1f')];}_0x308d7f[_0x1bc3('0x13')](_0x1bbac3)[_0x1bc3('0x20')](_0x431883);};}exports[_0x1bc3('0x21')]=function(_0x13a71e,_0x4fd1db){var _0x2a2d48={};var _0x3a36dd=_[_0x1bc3('0x22')](db[_0x1bc3('0x23')][_0x1bc3('0x24')],function(_0x5de0f0){return{'name':_0x5de0f0[_0x1bc3('0x25')],'type':_0x5de0f0[_0x1bc3('0x26')][_0x1bc3('0x27')]};});_0x2a2d48=qs[_0x1bc3('0x28')](_0x3a36dd,_0x13a71e);return interaction[_0x1bc3('0x29')](_0x1bc3('0x2a'),_0x13a71e[_0x1bc3('0x2b')],_0x13a71e[_0x1bc3('0x2c')],_0x2a2d48,_0x3a36dd)[_0x1bc3('0x1c')](respondWithFilteredResult(_0x4fd1db,_0x2a2d48))[_0x1bc3('0x2d')](handleError(_0x4fd1db,null));};exports[_0x1bc3('0x2e')]=function(_0x5d514c,_0x5ad40f){var _0x3af04c={};if(_0x5d514c['query']['type']&&_0x5d514c['query']['type']===_0x1bc3('0x2f')){_0x3af04c[_0x1bc3('0x2f')]=_0x5d514c[_0x1bc3('0x30')]['id'];}else{_0x3af04c['id']=_0x5d514c[_0x1bc3('0x30')]['id'];}var _0x547c55={'raw':![],'where':_0x3af04c},_0x5391a5={};_0x5391a5['model']=_[_0x1bc3('0x31')](db['OpenchannelInteraction']['rawAttributes']);_0x5391a5['query']=_['keys'](_0x5d514c[_0x1bc3('0x2b')]);_0x5391a5[_0x1bc3('0x32')]=_[_0x1bc3('0x33')](_0x5391a5[_0x1bc3('0x34')],_0x5391a5[_0x1bc3('0x2b')]);_0x547c55[_0x1bc3('0x35')]=_[_0x1bc3('0x33')](_0x5391a5[_0x1bc3('0x34')],qs[_0x1bc3('0x36')](_0x5d514c[_0x1bc3('0x2b')][_0x1bc3('0x36')]));_0x547c55[_0x1bc3('0x35')]=_0x547c55[_0x1bc3('0x35')]['length']?_0x547c55[_0x1bc3('0x35')]:_0x5391a5[_0x1bc3('0x34')];if(_0x5d514c['query'][_0x1bc3('0x37')]){_0x547c55[_0x1bc3('0x38')]=[{'all':!![]}];}_0x547c55=_[_0x1bc3('0x39')]({},_0x547c55,_0x5d514c[_0x1bc3('0x3a')]);return db[_0x1bc3('0x23')]['find'](_0x547c55)[_0x1bc3('0x1c')](handleEntityNotFound(_0x5ad40f,null))[_0x1bc3('0x1c')](respondWithResult(_0x5ad40f,null))[_0x1bc3('0x2d')](handleError(_0x5ad40f,null));};exports[_0x1bc3('0x3b')]=function(_0x233598,_0x277b4c){return db[_0x1bc3('0x23')][_0x1bc3('0x3b')](_0x233598[_0x1bc3('0x3c')],{})['then'](respondWithResult(_0x277b4c,0xc9))['catch'](handleError(_0x277b4c,null));};exports[_0x1bc3('0x1b')]=function(_0x1dd473,_0x57d69b){if(_0x1dd473[_0x1bc3('0x3c')]['id']){delete _0x1dd473[_0x1bc3('0x3c')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x1dd473[_0x1bc3('0x30')]['id']}})[_0x1bc3('0x1c')](handleEntityNotFound(_0x57d69b,null))[_0x1bc3('0x1c')](saveUpdates(_0x1dd473[_0x1bc3('0x3c')],null))['then'](respondWithResult(_0x57d69b,null))[_0x1bc3('0x2d')](handleError(_0x57d69b,null));};exports[_0x1bc3('0x1d')]=function(_0x51b218,_0x32d470){return db['OpenchannelInteraction'][_0x1bc3('0x3d')]({'where':{'id':_0x51b218[_0x1bc3('0x30')]['id']}})['then'](handleEntityNotFound(_0x32d470,null))[_0x1bc3('0x1c')](removeEntity(_0x32d470,null))['catch'](handleError(_0x32d470,null));};exports['describe']=function(_0x1e5a70,_0x400c8b){return db[_0x1bc3('0x23')][_0x1bc3('0x3e')]()[_0x1bc3('0x1c')](respondWithResult(_0x400c8b,null))['catch'](handleError(_0x400c8b,null));};exports['addMessage']=function(_0x468d34,_0x215337){return db['OpenchannelMessage'][_0x1bc3('0x3d')]({'where':{'id':_0x468d34[_0x1bc3('0x30')]['id']}})[_0x1bc3('0x1c')](handleEntityNotFound(_0x215337,null))['then'](function(_0x5632b2){if(_0x5632b2){return _0x5632b2['addMessage'](_0x468d34['body'][_0x1bc3('0x3f')],_['omit'](_0x468d34[_0x1bc3('0x3c')],[_0x1bc3('0x3f'),'id'])||{});}})[_0x1bc3('0x1c')](respondWithResult(_0x215337,null))[_0x1bc3('0x2d')](handleError(_0x215337,null));};exports['getMessages']=function(_0x3edd9e,_0xeff93){var _0x55acc4={'raw':![],'where':{}};var _0x3e801a={};var _0x2a5dc6={'count':0x0,'rows':[]};return db[_0x1bc3('0x23')]['findOne']({'where':{'id':_0x3edd9e[_0x1bc3('0x30')]['id']}})['then'](handleEntityNotFound(_0xeff93,null))[_0x1bc3('0x1c')](function(_0x4197a9){if(_0x4197a9){_0x3e801a['model']=_[_0x1bc3('0x31')](db[_0x1bc3('0x40')][_0x1bc3('0x24')]);_0x3e801a[_0x1bc3('0x2b')]=_['keys'](_0x3edd9e[_0x1bc3('0x2b')]);_0x3e801a[_0x1bc3('0x32')]=_[_0x1bc3('0x33')](_0x3e801a[_0x1bc3('0x34')],_0x3e801a[_0x1bc3('0x2b')]);_0x55acc4[_0x1bc3('0x35')]=_['intersection'](_0x3e801a['model'],qs['fields'](_0x3edd9e[_0x1bc3('0x2b')][_0x1bc3('0x36')]));_0x55acc4['attributes']=_0x55acc4['attributes'][_0x1bc3('0x41')]?_0x55acc4[_0x1bc3('0x35')]:_0x3e801a[_0x1bc3('0x34')];if(!_0x3edd9e[_0x1bc3('0x2b')][_0x1bc3('0x42')]('nolimit')){_0x55acc4[_0x1bc3('0x18')]=qs[_0x1bc3('0x18')](_0x3edd9e[_0x1bc3('0x2b')][_0x1bc3('0x18')]);_0x55acc4[_0x1bc3('0x16')]=qs[_0x1bc3('0x16')](_0x3edd9e['query'][_0x1bc3('0x16')]);}_0x55acc4[_0x1bc3('0x43')]=qs[_0x1bc3('0x44')](_0x3edd9e[_0x1bc3('0x2b')][_0x1bc3('0x44')]);_0x55acc4['where']=qs[_0x1bc3('0x32')](_[_0x1bc3('0x45')](_0x3edd9e['query'],_0x3e801a['filters']));_0x55acc4['where'][_0x1bc3('0x46')]=_0x4197a9['id'];if(_0x3edd9e[_0x1bc3('0x2b')]['filter']){_0x55acc4['where']=_[_0x1bc3('0x39')](_0x55acc4['where'],{'$or':_[_0x1bc3('0x22')](_0x55acc4['attributes'],function(_0xbcab34){var _0x3f56b6={};_0x3f56b6[_0xbcab34]={'$like':'%'+_0x3edd9e[_0x1bc3('0x2b')][_0x1bc3('0x47')]+'%'};return _0x3f56b6;})});}if(_0x3edd9e[_0x1bc3('0x2b')][_0x1bc3('0x48')]){var _0x4ec833=_0x3edd9e[_0x1bc3('0x2b')][_0x1bc3('0x48')]['split'](',');var _0x1ae336={};_0x1ae336[_0x4ec833[0x0]]={'$gte':moment(_0x4ec833[0x1])[_0x1bc3('0x49')](_0x1bc3('0x4a'))};_0x55acc4['where']=_[_0x1bc3('0x39')](_0x55acc4[_0x1bc3('0x4b')],_0x1ae336);}_0x55acc4=_[_0x1bc3('0x39')]({},_0x55acc4,_0x3edd9e[_0x1bc3('0x3a')]);return db[_0x1bc3('0x40')][_0x1bc3('0x19')]({'where':_0x55acc4[_0x1bc3('0x4b')]})[_0x1bc3('0x1c')](function(_0x18e906){_0x2a5dc6[_0x1bc3('0x19')]=_0x18e906;if(_0x3edd9e[_0x1bc3('0x2b')]['includeAll']){_0x55acc4[_0x1bc3('0x38')]=[{'all':!![]}];}return db[_0x1bc3('0x40')]['findAll'](_0x55acc4);})[_0x1bc3('0x1c')](function(_0x31e845){_0x2a5dc6[_0x1bc3('0x4c')]=_0x31e845;return _0x2a5dc6;});}})[_0x1bc3('0x1c')](respondWithFilteredResult(_0xeff93,_0x55acc4))[_0x1bc3('0x2d')](handleError(_0xeff93,null));};exports['addTags']=function(_0x4844fe,_0x16c01d){return db[_0x1bc3('0x23')][_0x1bc3('0x3d')]({'where':{'id':_0x4844fe[_0x1bc3('0x30')]['id']}})[_0x1bc3('0x1c')](handleEntityNotFound(_0x16c01d,null))[_0x1bc3('0x1c')](function(_0x184e56){if(_0x184e56){return _0x184e56[_0x1bc3('0x4d')](_0x4844fe[_0x1bc3('0x3c')][_0x1bc3('0x3f')],_['omit'](_0x4844fe[_0x1bc3('0x3c')],[_0x1bc3('0x3f'),'id'])||{})['spread'](function(){return db[_0x1bc3('0x4e')][_0x1bc3('0x29')]({'attributes':['id','name',_0x1bc3('0x4f')],'where':{'id':_0x4844fe[_0x1bc3('0x3c')][_0x1bc3('0x3f')]}});})['then'](function(_0x4fa9bd){socket['emit'](_0x1bc3('0x50'),{'id':Number(_0x4844fe[_0x1bc3('0x30')]['id']),'tags':_0x4fa9bd||[]});return{'id':Number(_0x4844fe['params']['id']),'tags':_0x4fa9bd||[]};});}})[_0x1bc3('0x1c')](respondWithResult(_0x16c01d,null))['catch'](handleError(_0x16c01d,null));};exports[_0x1bc3('0x51')]=function(_0x12f375,_0x4dbd50){return db[_0x1bc3('0x23')]['find']({'where':{'id':_0x12f375['params']['id']}})[_0x1bc3('0x1c')](handleEntityNotFound(_0x4dbd50,null))[_0x1bc3('0x1c')](function(_0x3513bb){if(_0x3513bb){return _0x3513bb[_0x1bc3('0x51')](_0x12f375['query'][_0x1bc3('0x3f')]);}})[_0x1bc3('0x1c')](respondWithStatusCode(_0x4dbd50,null))[_0x1bc3('0x2d')](handleError(_0x4dbd50,null));};exports['download']=function(_0x191c53,_0x685335){var _0x57d9df=moment()[_0x1bc3('0x52')]()[_0x1bc3('0x53')]();var _0x550332=path[_0x1bc3('0x54')](config[_0x1bc3('0x55')],_0x1bc3('0x56'),'files','tmp');var _0x386075=path[_0x1bc3('0x54')](config['root'],_0x1bc3('0x56'),_0x1bc3('0x57'),_0x1bc3('0x58'));var _0x541605=path[_0x1bc3('0x54')](_0x550332,_0x57d9df);var _0x379273=util[_0x1bc3('0x49')](_0x1bc3('0x59'),_0x191c53['params']['id'],_0x57d9df);var _0x5b798b=path[_0x1bc3('0x54')](_0x550332,_0x379273);var _0x21b755=[];_0x21b755[_0x1bc3('0x5a')]({'model':db[_0x1bc3('0x5b')],'as':'User','attributes':['id',_0x1bc3('0x5c')],'raw':!![]});_0x21b755['push']({'model':db[_0x1bc3('0x5d')],'as':_0x1bc3('0x5e'),'attributes':['id',_0x1bc3('0x5f'),_0x1bc3('0x60')],'raw':!![]});if(_0x191c53[_0x1bc3('0x2b')][_0x1bc3('0x58')]){_0x21b755['push']({'model':db[_0x1bc3('0x61')],'as':'Attachment','raw':!![]});}var _0x5309f9=[{'model':db[_0x1bc3('0x40')],'as':_0x1bc3('0x62'),'attributes':['id',_0x1bc3('0x3c'),'createdAt','direction',_0x1bc3('0x63'),'read'],'include':_0x21b755}];_0x5309f9[_0x1bc3('0x5a')]({'model':db[_0x1bc3('0x64')],'as':_0x1bc3('0x65'),'attributes':['id','name']});_0x5309f9[_0x1bc3('0x5a')]({'model':db[_0x1bc3('0x5b')],'as':_0x1bc3('0x66'),'attributes':['id',_0x1bc3('0x5c')]});return db[_0x1bc3('0x23')][_0x1bc3('0x3d')]({'where':{'id':_0x191c53[_0x1bc3('0x30')]['id']},'include':_0x5309f9})['then'](handleEntityNotFound(_0x685335,null))[_0x1bc3('0x1c')](function(_0x277f0f){if(_0x277f0f){var _0x2dbdf5=_0x277f0f[_0x1bc3('0x67')]({'plain':!![]});fs[_0x1bc3('0x68')](_0x541605);var _0x4d459d={'channel':_0x1bc3('0x69'),'account':_0x2dbdf5['Account'][_0x1bc3('0x1f')],'agent':_0x2dbdf5[_0x1bc3('0x66')]?_0x2dbdf5[_0x1bc3('0x66')]['fullname']:_0x1bc3('0x6a'),'createdAt':moment(_0x2dbdf5['createdAt'])[_0x1bc3('0x49')](_0x1bc3('0x4a'))['toString'](),'closedAt':_0x2dbdf5[_0x1bc3('0x6b')]?moment(_0x2dbdf5[_0x1bc3('0x6c')])[_0x1bc3('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1bc3('0x53')]():'','disposition':_0x2dbdf5['disposition'],'visibility':_0x2dbdf5[_0x1bc3('0x6d')]?_0x1bc3('0x6e'):_0x1bc3('0x6f'),'messages':_(_0x2dbdf5['Messages'])[_0x1bc3('0x47')]({'secret':![]})[_0x1bc3('0x22')](function(_0x3aaeb8){if(_0x3aaeb8[_0x1bc3('0x61')]){var _0x5a5219=path[_0x1bc3('0x54')](_0x386075,_0x3aaeb8[_0x1bc3('0x61')][_0x1bc3('0x70')]);if(fs[_0x1bc3('0x71')](_0x5a5219)){fs[_0x1bc3('0x72')](_0x5a5219)[_0x1bc3('0x73')](fs[_0x1bc3('0x74')](path[_0x1bc3('0x54')](_0x541605,_0x3aaeb8[_0x1bc3('0x61')][_0x1bc3('0x70')])));}}return{'date':moment(_0x3aaeb8[_0x1bc3('0x75')])[_0x1bc3('0x49')](_0x1bc3('0x4a'))[_0x1bc3('0x53')](),'sender':_0x3aaeb8[_0x1bc3('0x76')]===_0x1bc3('0x77')?_0x3aaeb8[_0x1bc3('0x5b')]?_0x3aaeb8[_0x1bc3('0x5b')]['fullname']:_0x1bc3('0x78'):_0x3aaeb8[_0x1bc3('0x5e')][_0x1bc3('0x5f')]+(_0x3aaeb8['Contact'][_0x1bc3('0x60')]?'\x20'+_0x3aaeb8['Contact'][_0x1bc3('0x60')]:''),'body':_0x3aaeb8[_0x1bc3('0x61')]?_0x3aaeb8[_0x1bc3('0x61')][_0x1bc3('0x70')]:_0x3aaeb8['body'],'direction':_0x3aaeb8[_0x1bc3('0x76')]==='out'?'A':'C','secret':_0x3aaeb8[_0x1bc3('0x63')],'read':_0x3aaeb8['read'],'attachment':_0x3aaeb8['Attachment']};})[_0x1bc3('0x79')]()};return ejs['renderFile'](path[_0x1bc3('0x54')](config[_0x1bc3('0x55')],'server',_0x1bc3('0x7a'),_0x1bc3('0x7b')),{'interaction':_0x4d459d})[_0x1bc3('0x1c')](function(_0x24c787){var _0xc60565=path[_0x1bc3('0x54')](_0x541605,_0x1bc3('0x7c')+_0x2dbdf5['id']+'-'+_0x57d9df+'.pdf');var _0x42c63b={'path':_0xc60565,'channel':_0x1bc3('0x69'),'interactionId':_0x2dbdf5['id']};return pdf[_0x1bc3('0x7d')](_0x24c787,_0x42c63b);})['then'](function(){return new Promise(function(_0x18a28b,_0x1bad03){zipdir(_0x541605,{'saveTo':_0x5b798b},function(_0x4ae212,_0x651bff){if(_0x4ae212)return _0x1bad03(_0x4ae212);return _0x18a28b(_0x651bff);});})[_0x1bc3('0x1c')](function(){return new Promise(function(_0x331f4d,_0x374bb0){rimraf(_0x541605,function(_0x4b23ba){if(_0x4b23ba)_0x374bb0(_0x4b23ba);return _0x331f4d();});});})[_0x1bc3('0x1c')](function(){return _0x685335[_0x1bc3('0x7e')](_0x5b798b,_0x379273,function(_0x3b19aa){if(_0x3b19aa){logger[_0x1bc3('0x7f')](_0x1bc3('0x80'),_0x3b19aa);}else{fs[_0x1bc3('0x81')](_0x5b798b);}});});});}else{return _0x685335[_0x1bc3('0x12')](0xc8);}})[_0x1bc3('0x2d')](handleError(_0x685335,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index cdf5ba0..77cd2dd 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 _0x4529=['length','emit','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','setDataValue','Users','map','then','unreadMessages'];(function(_0x385dd3,_0xae08ac){var _0x3abc7e=function(_0xa33f7d){while(--_0xa33f7d){_0x385dd3['push'](_0x385dd3['shift']());}};_0x3abc7e(++_0xae08ac);}(_0x4529,0x199));var _0x9452=function(_0x8c358f,_0x442bc7){_0x8c358f=_0x8c358f-0x0;var _0x4ca01d=_0x4529[_0x8c358f];return _0x4ca01d;};'use strict';var EventEmitter=require(_0x9452('0x0'));var OpenchannelInteraction=require(_0x9452('0x1'))['db'][_0x9452('0x2')];var OpenchannelMessage=require(_0x9452('0x1'))['db'][_0x9452('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9452('0x4')](0x0);var events={'afterCreate':_0x9452('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x457b64){return function(_0x4f107f,_0x4595da,_0x2c5dbb){_0x4f107f['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2d0961){_0x4f107f[_0x9452('0x6')](_0x9452('0x7'),_0x2d0961[_0x9452('0x8')](function(_0x264010){return{'id':_0x264010['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4f107f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9452('0x9')](function(_0x40c704){_0x4f107f[_0x9452('0x6')](_0x9452('0xa'),_0x40c704[_0x9452('0xb')]);OpenchannelInteractionEvents[_0x9452('0xc')](_0x457b64+':'+_0x4f107f['id'],_0x4f107f);OpenchannelInteractionEvents['emit'](_0x457b64,_0x4f107f);_0x2c5dbb(null);})['catch'](_0x2c5dbb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x9452('0xd')](e,emitEvent(event));}}module[_0x9452('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x64b2=['update','getUsers','then','setDataValue','map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0xb263f3,_0x24c8c3){var _0x18a4f3=function(_0x164be2){while(--_0x164be2){_0xb263f3['push'](_0xb263f3['shift']());}};_0x18a4f3(++_0x24c8c3);}(_0x64b2,0x1b4));var _0x264b=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x64b2[_0x34843e];return _0x598f7f;};'use strict';var EventEmitter=require(_0x264b('0x0'));var OpenchannelInteraction=require(_0x264b('0x1'))['db'][_0x264b('0x2')];var OpenchannelMessage=require(_0x264b('0x1'))['db'][_0x264b('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x264b('0x4')](0x0);var events={'afterCreate':_0x264b('0x5'),'afterUpdate':_0x264b('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1e3f8e){return function(_0x1e2917,_0x5620b5,_0x619e70){_0x1e2917[_0x264b('0x7')]({'attributes':['id'],'raw':!![]})[_0x264b('0x8')](function(_0xc41089){_0x1e2917[_0x264b('0x9')]('Users',_0xc41089[_0x264b('0xa')](function(_0x8ef5a1){return{'id':_0x8ef5a1['id']};}));return OpenchannelMessage[_0x264b('0xb')]({'where':{'OpenchannelInteractionId':_0x1e2917['id'],'direction':'in','read':![]},'raw':!![]});})[_0x264b('0x8')](function(_0x1b4c0){_0x1e2917[_0x264b('0x9')]('unreadMessages',_0x1b4c0[_0x264b('0xc')]);OpenchannelInteractionEvents[_0x264b('0xd')](_0x1e3f8e+':'+_0x1e2917['id'],_0x1e2917);OpenchannelInteractionEvents[_0x264b('0xd')](_0x1e3f8e,_0x1e2917);_0x619e70(null);})['catch'](_0x619e70(null));};}for(var e in events){if(events[_0x264b('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x264b('0xf')](e,emitEvent(event));}}module[_0x264b('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 96a694b..cd9225a 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 _0x4a5a=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','util'];(function(_0x58075c,_0x3e786f){var _0x3b96b0=function(_0x4d73bb){while(--_0x4d73bb){_0x58075c['push'](_0x58075c['shift']());}};_0x3b96b0(++_0x3e786f);}(_0x4a5a,0xe0));var _0xa4a5=function(_0x22ba7c,_0x254e46){_0x22ba7c=_0x22ba7c-0x0;var _0x3047b5=_0x4a5a[_0x22ba7c];return _0x3047b5;};'use strict';var _=require('lodash');var util=require(_0xa4a5('0x0'));var logger=require(_0xa4a5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa4a5('0x2'));var rp=require(_0xa4a5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4a5('0x4'));var config=require(_0xa4a5('0x5'));var attributes=require(_0xa4a5('0x6'));module[_0xa4a5('0x7')]=function(_0x3d2837,_0x9670ce){return _0x3d2837['define']('OpenchannelInteraction',attributes,{'tableName':_0xa4a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4a5('0x9'),'collate':_0xa4a5('0xa'),'hooks':{'beforeUpdate':function(_0x5bd3d2,_0x5d39db,_0x5bc7fa){if(_0x5bd3d2[_0xa4a5('0xb')](_0xa4a5('0xc'))){_0x5bd3d2[_0xa4a5('0xd')]=moment()[_0xa4a5('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5bc7fa(null,_0x5bd3d2);}}});}; \ No newline at end of file +var _0x2a40=['moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','closedAt','format','lodash','util','../../config/logger','api'];(function(_0x4a3b6f,_0xe0c777){var _0x40df7d=function(_0x35592c){while(--_0x35592c){_0x4a3b6f['push'](_0x4a3b6f['shift']());}};_0x40df7d(++_0xe0c777);}(_0x2a40,0x17c));var _0x02a4=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x2a40[_0x3db122];return _0x325b67;};'use strict';var _=require(_0x02a4('0x0'));var util=require(_0x02a4('0x1'));var logger=require(_0x02a4('0x2'))(_0x02a4('0x3'));var moment=require(_0x02a4('0x4'));var BPromise=require(_0x02a4('0x5'));var rp=require(_0x02a4('0x6'));var fs=require('fs');var path=require(_0x02a4('0x7'));var rimraf=require(_0x02a4('0x8'));var config=require('../../config/environment');var attributes=require(_0x02a4('0x9'));module[_0x02a4('0xa')]=function(_0xf0c904,_0x2fd65e){return _0xf0c904[_0x02a4('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x02a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x02a4('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x10504d,_0x39320e,_0x1dc233){if(_0x10504d['changed']('closed')){_0x10504d[_0x02a4('0xe')]=moment()[_0x02a4('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1dc233(null,_0x10504d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 969a827..a347227 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 _0xaa8d=['ids','omit','spread','AddTags','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','register','request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','debug','AddTagsToOpenchannelInteraction','then','addTags'];(function(_0x2b25fe,_0x3bac50){var _0x3b82dd=function(_0x28df3b){while(--_0x28df3b){_0x2b25fe['push'](_0x2b25fe['shift']());}};_0x3b82dd(++_0x3bac50);}(_0xaa8d,0x116));var _0xdaa8=function(_0x552551,_0x2203d5){_0x552551=_0x552551-0x0;var _0x35b31c=_0xaa8d[_0x552551];return _0x35b31c;};'use strict';var _=require('lodash');var util=require(_0xdaa8('0x0'));var moment=require('moment');var BPromise=require(_0xdaa8('0x1'));var rs=require(_0xdaa8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaa8('0x3'))['db'];var utils=require(_0xdaa8('0x4'));var logger=require(_0xdaa8('0x5'))(_0xdaa8('0x6'));var config=require(_0xdaa8('0x7'));var jayson=require(_0xdaa8('0x8'));var client=jayson['client'][_0xdaa8('0x9')]({'port':0x232a});config[_0xdaa8('0xa')]=_['defaults'](config[_0xdaa8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xdaa8('0xb')](socket);function respondWithRpcPromise(_0x27ecf5,_0xce7260,_0x1aa76b){return new BPromise(function(_0x5c9eae,_0x8dffda){return client[_0xdaa8('0xc')](_0x27ecf5,_0x1aa76b)['then'](function(_0x467873){logger['info'](_0xdaa8('0xd'),_0xce7260,_0xdaa8('0xe'));logger['debug'](_0xdaa8('0xf'),_0xce7260,'request\x20sent',JSON[_0xdaa8('0x10')](_0x467873));if(_0x467873[_0xdaa8('0x11')]){if(_0x467873[_0xdaa8('0x11')][_0xdaa8('0x12')]===0x1f4){logger[_0xdaa8('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0xce7260,_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);return _0x8dffda(_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);}logger[_0xdaa8('0x11')](_0xdaa8('0xd'),_0xce7260,_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);return _0x5c9eae(_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);}else{logger[_0xdaa8('0x14')](_0xdaa8('0xd'),_0xce7260,_0xdaa8('0xe'));_0x5c9eae(_0x467873[_0xdaa8('0x15')]['message']);}})['catch'](function(_0x3d2fa1){logger[_0xdaa8('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0xce7260,_0x3d2fa1);_0x8dffda(_0x3d2fa1);});});}exports[_0xdaa8('0x16')]=function(_0x1e0b1f){var _0x12b453=this;return new Promise(function(_0x5600e5,_0x59cedf){return db[_0xdaa8('0x17')][_0xdaa8('0x18')](_0x1e0b1f[_0xdaa8('0x19')],{'raw':_0x1e0b1f[_0xdaa8('0x1a')]?_0x1e0b1f[_0xdaa8('0x1a')][_0xdaa8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0b1f['options']?_0x1e0b1f['options'][_0xdaa8('0x1c')]||null:null,'attributes':_0x1e0b1f[_0xdaa8('0x1a')]?_0x1e0b1f[_0xdaa8('0x1a')][_0xdaa8('0x1d')]||null:null,'limit':_0x1e0b1f[_0xdaa8('0x1a')]?_0x1e0b1f[_0xdaa8('0x1a')]['limit']||null:null})['then'](function(_0x50a5db){logger[_0xdaa8('0x14')]('UpdateOpenchannelInteraction',_0x1e0b1f);logger[_0xdaa8('0x1e')]('UpdateOpenchannelInteraction',_0x1e0b1f,JSON['stringify'](_0x50a5db));_0x5600e5(_0x50a5db);})['catch'](function(_0x5b340f){logger[_0xdaa8('0x11')](_0xdaa8('0x16'),_0x5b340f[_0xdaa8('0x13')],_0x1e0b1f);_0x59cedf(_0x12b453['error'](0x1f4,_0x5b340f[_0xdaa8('0x13')]));});});};exports[_0xdaa8('0x1f')]=function(_0x7b1ac9){return new Promise(function(_0x5744a6,_0xc2e655){return db[_0xdaa8('0x17')]['find']({'where':_0x7b1ac9[_0xdaa8('0x1a')]?_0x7b1ac9[_0xdaa8('0x1a')]['where']||null:null})[_0xdaa8('0x20')](function(_0x502f22){if(_0x502f22){return _0x502f22[_0xdaa8('0x21')](_0x7b1ac9[_0xdaa8('0x19')][_0xdaa8('0x22')],_[_0xdaa8('0x23')](_0x7b1ac9[_0xdaa8('0x19')],[_0xdaa8('0x22'),'id'])||{});}})[_0xdaa8('0x24')](function(_0x841fd0){logger[_0xdaa8('0x14')](_0xdaa8('0x25'),_0x7b1ac9);logger[_0xdaa8('0x1e')](_0xdaa8('0x25'),_0x7b1ac9,JSON['stringify'](_0x841fd0));_0x5744a6(_0x841fd0);})[_0xdaa8('0x26')](function(_0x232077){logger[_0xdaa8('0x11')](_0xdaa8('0x25'),_0x232077[_0xdaa8('0x13')],_0x7b1ac9);_0xc2e655(_this[_0xdaa8('0x11')](0x1f4,_0x232077[_0xdaa8('0x13')]));});});}; \ No newline at end of file +var _0x174d=['ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','OpenchannelInteraction','update','body','options','attributes','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find'];(function(_0x969c2d,_0x5d7faa){var _0x164b21=function(_0x242f78){while(--_0x242f78){_0x969c2d['push'](_0x969c2d['shift']());}};_0x164b21(++_0x5d7faa);}(_0x174d,0x18a));var _0xd174=function(_0x4788ca,_0x5cda70){_0x4788ca=_0x4788ca-0x0;var _0x28a6f5=_0x174d[_0x4788ca];return _0x28a6f5;};'use strict';var _=require(_0xd174('0x0'));var util=require('util');var moment=require(_0xd174('0x1'));var BPromise=require(_0xd174('0x2'));var rs=require(_0xd174('0x3'));var fs=require('fs');var Redis=require(_0xd174('0x4'));var db=require(_0xd174('0x5'))['db'];var utils=require(_0xd174('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd174('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd174('0x8')][_0xd174('0x9')]({'port':0x232a});config[_0xd174('0xa')]=_[_0xd174('0xb')](config[_0xd174('0xa')],{'host':_0xd174('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd174('0xa')]));require(_0xd174('0xd'))[_0xd174('0xe')](socket);function respondWithRpcPromise(_0x3a1bfb,_0x111a81,_0x3235af){return new BPromise(function(_0xff03f7,_0x594c0b){return client[_0xd174('0xf')](_0x3a1bfb,_0x3235af)[_0xd174('0x10')](function(_0x2fccc7){logger[_0xd174('0x11')](_0xd174('0x12'),_0x111a81,'request\x20sent');logger[_0xd174('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x111a81,_0xd174('0x14'),JSON[_0xd174('0x15')](_0x2fccc7));if(_0x2fccc7[_0xd174('0x16')]){if(_0x2fccc7[_0xd174('0x16')]['code']===0x1f4){logger[_0xd174('0x16')](_0xd174('0x12'),_0x111a81,_0x2fccc7[_0xd174('0x16')][_0xd174('0x17')]);return _0x594c0b(_0x2fccc7[_0xd174('0x16')][_0xd174('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x111a81,_0x2fccc7[_0xd174('0x16')][_0xd174('0x17')]);return _0xff03f7(_0x2fccc7[_0xd174('0x16')]['message']);}else{logger[_0xd174('0x11')](_0xd174('0x12'),_0x111a81,'request\x20sent');_0xff03f7(_0x2fccc7[_0xd174('0x18')]['message']);}})['catch'](function(_0x350af0){logger[_0xd174('0x16')](_0xd174('0x12'),_0x111a81,_0x350af0);_0x594c0b(_0x350af0);});});}exports['UpdateOpenchannelInteraction']=function(_0x430cc4){var _0x58f724=this;return new Promise(function(_0x1c2a65,_0x22d802){return db[_0xd174('0x19')][_0xd174('0x1a')](_0x430cc4[_0xd174('0x1b')],{'raw':_0x430cc4['options']?_0x430cc4[_0xd174('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x430cc4[_0xd174('0x1c')]?_0x430cc4['options']['where']||null:null,'attributes':_0x430cc4[_0xd174('0x1c')]?_0x430cc4['options'][_0xd174('0x1d')]||null:null,'limit':_0x430cc4['options']?_0x430cc4['options'][_0xd174('0x1e')]||null:null})[_0xd174('0x10')](function(_0x43d502){logger['info'](_0xd174('0x1f'),_0x430cc4);logger[_0xd174('0x13')](_0xd174('0x1f'),_0x430cc4,JSON[_0xd174('0x15')](_0x43d502));_0x1c2a65(_0x43d502);})[_0xd174('0x20')](function(_0x30f31f){logger[_0xd174('0x16')](_0xd174('0x1f'),_0x30f31f[_0xd174('0x17')],_0x430cc4);_0x22d802(_0x58f724['error'](0x1f4,_0x30f31f['message']));});});};exports[_0xd174('0x21')]=function(_0xf85d96){return new Promise(function(_0x1ec3ed,_0x314d43){return db['OpenchannelInteraction'][_0xd174('0x22')]({'where':_0xf85d96['options']?_0xf85d96[_0xd174('0x1c')]['where']||null:null})[_0xd174('0x10')](function(_0x22c166){if(_0x22c166){return _0x22c166['addTags'](_0xf85d96['body'][_0xd174('0x23')],_[_0xd174('0x24')](_0xf85d96['body'],[_0xd174('0x23'),'id'])||{});}})[_0xd174('0x25')](function(_0x17b68f){logger['info']('AddTags',_0xf85d96);logger[_0xd174('0x13')]('AddTags',_0xf85d96,JSON[_0xd174('0x15')](_0x17b68f));_0x1ec3ed(_0x17b68f);})['catch'](function(_0x3c685b){logger['error'](_0xd174('0x26'),_0x3c685b[_0xd174('0x17')],_0xf85d96);_0x314d43(_this[_0xd174('0x16')](0x1f4,_0x3c685b[_0xd174('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 199c597..a89ac8f 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 _0x9a41=['removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x3d7909,_0x2f0095){var _0x414ad3=function(_0x2d954a){while(--_0x2d954a){_0x3d7909['push'](_0x3d7909['shift']());}};_0x414ad3(++_0x2f0095);}(_0x9a41,0x8b));var _0x19a4=function(_0x594a57,_0x53bce6){_0x594a57=_0x594a57-0x0;var _0x149294=_0x9a41[_0x594a57];return _0x149294;};'use strict';var OpenchannelInteractionEvents=require(_0x19a4('0x0'));var events=[_0x19a4('0x1'),_0x19a4('0x2'),_0x19a4('0x3')];function createListener(_0x339139,_0x3d62c2){return function(_0x2156a3){_0x3d62c2[_0x19a4('0x4')](_0x339139,_0x2156a3);};}function removeListener(_0x4adbba,_0x569dbd){return function(){OpenchannelInteractionEvents[_0x19a4('0x5')](_0x4adbba,_0x569dbd);};}exports[_0x19a4('0x6')]=function(_0x3b52ff){for(var _0x2be36b=0x0,_0x22aae9=events['length'];_0x2be36b<_0x22aae9;_0x2be36b++){var _0x123a54=events[_0x2be36b];var _0x476ba6=createListener(_0x19a4('0x7')+_0x123a54,_0x3b52ff);OpenchannelInteractionEvents['on'](_0x123a54,_0x476ba6);}}; \ No newline at end of file +var _0x6513=['openchannelInteraction:','save','remove','removeListener','register','length'];(function(_0x1de7b0,_0x43fb84){var _0x18f8e0=function(_0x1e808c){while(--_0x1e808c){_0x1de7b0['push'](_0x1de7b0['shift']());}};_0x18f8e0(++_0x43fb84);}(_0x6513,0x19f));var _0x3651=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x6513[_0x47623f];return _0x282ce8;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x3651('0x0'),_0x3651('0x1'),'update'];function createListener(_0x3ea2d8,_0x99544e){return function(_0x26dee2){_0x99544e['emit'](_0x3ea2d8,_0x26dee2);};}function removeListener(_0x1add44,_0x1bc39){return function(){OpenchannelInteractionEvents[_0x3651('0x2')](_0x1add44,_0x1bc39);};}exports[_0x3651('0x3')]=function(_0x79e83e){for(var _0x44156b=0x0,_0x17d344=events[_0x3651('0x4')];_0x44156b<_0x17d344;_0x44156b++){var _0x53463b=events[_0x44156b];var _0x51fbed=createListener(_0x3651('0x5')+_0x53463b,_0x79e83e);OpenchannelInteractionEvents['on'](_0x53463b,_0x51fbed);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8735164..8d66fd0 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x1b27ff,_0x34070b){var _0x1ff114=function(_0xb5b137){while(--_0xb5b137){_0x1b27ff['push'](_0x1b27ff['shift']());}};_0x1ff114(++_0x34070b);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +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(_0x27dea2,_0x17eed9){var _0x4057d7=function(_0x4ee265){while(--_0x4ee265){_0x27dea2['push'](_0x27dea2['shift']());}};_0x4057d7(++_0x17eed9);}(_0xe706,0xa3));var _0x6e70=function(_0x1317ed,_0x57217d){_0x1317ed=_0x1317ed-0x0;var _0xbaeca=_0xe706[_0x1317ed];return _0xbaeca;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 965da59..a4f28d8 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 _0x9c02=['DATE','sequelize','exports','TEXT','out'];(function(_0x43d394,_0x33a215){var _0x57f4df=function(_0x6d6f20){while(--_0x6d6f20){_0x43d394['push'](_0x43d394['shift']());}};_0x57f4df(++_0x33a215);}(_0x9c02,0x196));var _0x29c0=function(_0x21e1f5,_0x2fe735){_0x21e1f5=_0x21e1f5-0x0;var _0x1fba90=_0x9c02[_0x21e1f5];return _0x1fba90;};'use strict';var Sequelize=require(_0x29c0('0x0'));module[_0x29c0('0x1')]={'body':{'type':Sequelize[_0x29c0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x29c0('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x29c0('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x29c0('0x2')]}}; \ No newline at end of file +var _0x84a0=['TEXT','medium','BOOLEAN','ENUM','DATE','STRING','sequelize','exports'];(function(_0x2fedff,_0x4d5fb2){var _0x1d1034=function(_0x153d47){while(--_0x153d47){_0x2fedff['push'](_0x2fedff['shift']());}};_0x1d1034(++_0x4d5fb2);}(_0x84a0,0x66));var _0x084a=function(_0x30306b,_0x1e4558){_0x30306b=_0x30306b-0x0;var _0x265447=_0x84a0[_0x30306b];return _0x265447;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'body':{'type':Sequelize[_0x084a('0x2')](_0x084a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x084a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x084a('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x084a('0x6')]},'providerName':{'type':Sequelize[_0x084a('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 20b491f..cee56bb 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 _0x709d=['EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','SIP/%s','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','update','params','describe','../../config/logger','accept','openchannel','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','manual','interface','format','channel','motionChannel','event'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x709d,0x116));var _0xd709=function(_0x321059,_0x29a023){_0x321059=_0x321059-0x0;var _0x8487b4=_0x709d[_0x321059];return _0x8487b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd709('0x0'));var jsonpatch=require(_0xd709('0x1'));var rp=require(_0xd709('0x2'));var moment=require(_0xd709('0x3'));var BPromise=require(_0xd709('0x4'));var Mustache=require(_0xd709('0x5'));var util=require(_0xd709('0x6'));var path=require(_0xd709('0x7'));var sox=require(_0xd709('0x8'));var csv=require(_0xd709('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd709('0xa'));var _=require(_0xd709('0xb'));var squel=require('squel');var crypto=require(_0xd709('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd709('0xd'));var toCsv=require(_0xd709('0x9'));var querystring=require(_0xd709('0xe'));var Papa=require(_0xd709('0xf'));var Redis=require(_0xd709('0x10'));var authService=require(_0xd709('0x11'));var qs=require(_0xd709('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd709('0x13'));var utils=require(_0xd709('0x14'));var config=require(_0xd709('0x15'));var licenseUtil=require(_0xd709('0x16'));var db=require(_0xd709('0x17'))['db'];config[_0xd709('0x18')]=_[_0xd709('0x19')](config[_0xd709('0x18')],{'host':_0xd709('0x1a'),'port':0x18eb});var socket=require(_0xd709('0x1b'))(new Redis(config['redis']));require(_0xd709('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd709('0x1d')]({'port':0x232c});var client9002=jayson[_0xd709('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47f3d2,_0x594a99,_0x346654,_0xfe6b0b){return new BPromise(function(_0x4fd735,_0x4ac9ae){var _0x674e08=_0xfe6b0b||client;return _0x674e08[_0xd709('0x1f')](_0x47f3d2,_0x346654)[_0xd709('0x20')](function(_0x4022cc){logger[_0xd709('0x21')](_0xd709('0x22'),_0x594a99,_0xd709('0x23'));logger[_0xd709('0x24')](_0xd709('0x25'),_0x594a99,_0xd709('0x23'),JSON['stringify'](_0x4022cc));if(_0x4022cc[_0xd709('0x26')]){if(_0x4022cc[_0xd709('0x26')][_0xd709('0x27')]===0x1f4){logger[_0xd709('0x26')](_0xd709('0x22'),_0x594a99,_0x4022cc[_0xd709('0x26')]['message']);return _0x4ac9ae(_0x4022cc[_0xd709('0x26')]['message']);}logger[_0xd709('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x594a99,_0x4022cc[_0xd709('0x26')][_0xd709('0x28')]);return _0x4fd735(_0x4022cc[_0xd709('0x26')][_0xd709('0x28')]);}else{logger[_0xd709('0x21')](_0xd709('0x22'),_0x594a99,_0xd709('0x23'));_0x4fd735(_0x4022cc[_0xd709('0x29')][_0xd709('0x28')]);}})[_0xd709('0x2a')](function(_0x45f54d){logger['error'](_0xd709('0x22'),_0x594a99,_0x45f54d);_0x4ac9ae(_0x45f54d);});});}function respondWithStatusCode(_0x599f6d,_0x3dace8){_0x3dace8=_0x3dace8||0xcc;return function(_0x162f0e){if(_0x162f0e){return _0x599f6d[_0xd709('0x2b')](_0x3dace8);}return _0x599f6d[_0xd709('0x2c')](_0x3dace8)['end']();};}function respondWithResult(_0x9e162e,_0x466d44){_0x466d44=_0x466d44||0xc8;return function(_0x599e96){if(_0x599e96){return _0x9e162e[_0xd709('0x2c')](_0x466d44)[_0xd709('0x2d')](_0x599e96);}};}function respondWithFilteredResult(_0x4432d9,_0x415148){return function(_0x2fca73){if(_0x2fca73){var _0x1dbb6c=typeof _0x415148[_0xd709('0x2e')]===_0xd709('0x2f')&&typeof _0x415148[_0xd709('0x30')]==='undefined';var _0x5d13cb=_0x2fca73[_0xd709('0x31')];var _0x31eaa3=_0x1dbb6c?0x0:_0x415148[_0xd709('0x2e')];var _0x1ea978=_0x1dbb6c?_0x2fca73[_0xd709('0x31')]:_0x415148[_0xd709('0x2e')]+_0x415148[_0xd709('0x30')];var _0x38b529;if(_0x1ea978>=_0x5d13cb){_0x1ea978=_0x5d13cb;_0x38b529=0xc8;}else{_0x38b529=0xce;}_0x4432d9['status'](_0x38b529);return _0x4432d9[_0xd709('0x32')]('Content-Range',_0x31eaa3+'-'+_0x1ea978+'/'+_0x5d13cb)[_0xd709('0x2d')](_0x2fca73);}return null;};}function patchUpdates(_0xf05b1c){return function(_0x40070b){try{jsonpatch[_0xd709('0x33')](_0x40070b,_0xf05b1c,!![]);}catch(_0x55f333){return BPromise[_0xd709('0x34')](_0x55f333);}return _0x40070b['save']();};}function saveUpdates(_0x320d25,_0x14c296){return function(_0x1737da){if(_0x1737da){return _0x1737da['update'](_0x320d25)[_0xd709('0x20')](function(_0x435fd4){return _0x435fd4;});}return null;};}function removeEntity(_0x566c21,_0x34a765){return function(_0x5f0152){if(_0x5f0152){return _0x5f0152[_0xd709('0x35')]()[_0xd709('0x20')](function(){_0x566c21[_0xd709('0x2c')](0xcc)[_0xd709('0x36')]();});}};}function handleEntityNotFound(_0x22ac28,_0x2e6b61){return function(_0x1cc7d7){if(!_0x1cc7d7){_0x22ac28[_0xd709('0x2b')](0x194);}return _0x1cc7d7;};}function handleError(_0x52415d,_0xd55913){_0xd55913=_0xd55913||0x1f4;return function(_0x3c536b){logger[_0xd709('0x26')](_0x3c536b[_0xd709('0x37')]);if(_0x3c536b['name']){delete _0x3c536b[_0xd709('0x38')];}_0x52415d[_0xd709('0x2c')](_0xd55913)[_0xd709('0x39')](_0x3c536b);};}exports[_0xd709('0x3a')]=function(_0x2f5be9,_0x4c5ae2){var _0x198dd7={},_0x48684d={},_0x3e1131={'count':0x0,'rows':[]};var _0x41bc4=_[_0xd709('0x3b')](db[_0xd709('0x3c')][_0xd709('0x3d')],function(_0x447ac1){return{'name':_0x447ac1[_0xd709('0x3e')],'type':_0x447ac1[_0xd709('0x3f')][_0xd709('0x40')]};});_0x48684d[_0xd709('0x41')]=_[_0xd709('0x3b')](_0x41bc4,_0xd709('0x38'));_0x48684d['query']=_[_0xd709('0x42')](_0x2f5be9[_0xd709('0x43')]);_0x48684d[_0xd709('0x44')]=_[_0xd709('0x45')](_0x48684d[_0xd709('0x41')],_0x48684d[_0xd709('0x43')]);_0x198dd7['attributes']=_[_0xd709('0x45')](_0x48684d['model'],qs[_0xd709('0x46')](_0x2f5be9[_0xd709('0x43')][_0xd709('0x46')]));_0x198dd7['attributes']=_0x198dd7['attributes'][_0xd709('0x47')]?_0x198dd7[_0xd709('0x48')]:_0x48684d['model'];if(!_0x2f5be9[_0xd709('0x43')]['hasOwnProperty'](_0xd709('0x49'))){_0x198dd7[_0xd709('0x30')]=qs[_0xd709('0x30')](_0x2f5be9[_0xd709('0x43')][_0xd709('0x30')]);_0x198dd7[_0xd709('0x2e')]=qs[_0xd709('0x2e')](_0x2f5be9[_0xd709('0x43')]['offset']);}_0x198dd7[_0xd709('0x4a')]=qs[_0xd709('0x4b')](_0x2f5be9['query'][_0xd709('0x4b')]);_0x198dd7[_0xd709('0x4c')]=qs[_0xd709('0x44')](_[_0xd709('0x4d')](_0x2f5be9[_0xd709('0x43')],_0x48684d[_0xd709('0x44')]),_0x41bc4);if(_0x2f5be9[_0xd709('0x43')][_0xd709('0x4e')]){_0x198dd7[_0xd709('0x4c')]=_[_0xd709('0x4f')](_0x198dd7[_0xd709('0x4c')],{'$or':_['map'](_0x41bc4,function(_0x61919){if(_0x61919[_0xd709('0x3f')]!==_0xd709('0x50')){var _0x306d14={};_0x306d14[_0x61919[_0xd709('0x38')]]={'$like':'%'+_0x2f5be9[_0xd709('0x43')][_0xd709('0x4e')]+'%'};return _0x306d14;}})});}_0x198dd7=_['merge']({},_0x198dd7,_0x2f5be9[_0xd709('0x51')]);var _0x69d8d2={'where':_0x198dd7['where']};return db[_0xd709('0x3c')]['count'](_0x69d8d2)[_0xd709('0x20')](function(_0x536c7a){_0x3e1131['count']=_0x536c7a;if(_0x2f5be9[_0xd709('0x43')][_0xd709('0x52')]){_0x198dd7[_0xd709('0x53')]=[{'all':!![]}];}return db[_0xd709('0x3c')][_0xd709('0x54')](_0x198dd7);})[_0xd709('0x20')](function(_0x427f58){_0x3e1131[_0xd709('0x55')]=_0x427f58;return _0x3e1131;})['then'](respondWithFilteredResult(_0x4c5ae2,_0x198dd7))[_0xd709('0x2a')](handleError(_0x4c5ae2,null));};exports[_0xd709('0x56')]=function(_0x527e1f,_0x373bb9){var _0x2a8a63={'raw':!![],'where':{'id':_0x527e1f['params']['id']}},_0x4a28b7={};_0x4a28b7[_0xd709('0x41')]=_[_0xd709('0x42')](db['OpenchannelMessage'][_0xd709('0x3d')]);_0x4a28b7[_0xd709('0x43')]=_[_0xd709('0x42')](_0x527e1f[_0xd709('0x43')]);_0x4a28b7[_0xd709('0x44')]=_[_0xd709('0x45')](_0x4a28b7[_0xd709('0x41')],_0x4a28b7[_0xd709('0x43')]);_0x2a8a63[_0xd709('0x48')]=_['intersection'](_0x4a28b7['model'],qs['fields'](_0x527e1f['query']['fields']));_0x2a8a63[_0xd709('0x48')]=_0x2a8a63[_0xd709('0x48')][_0xd709('0x47')]?_0x2a8a63[_0xd709('0x48')]:_0x4a28b7[_0xd709('0x41')];if(_0x527e1f[_0xd709('0x43')]['includeAll']){_0x2a8a63[_0xd709('0x53')]=[{'all':!![]}];}_0x2a8a63=_[_0xd709('0x4f')]({},_0x2a8a63,_0x527e1f[_0xd709('0x51')]);return db['OpenchannelMessage'][_0xd709('0x57')](_0x2a8a63)[_0xd709('0x20')](handleEntityNotFound(_0x373bb9,null))[_0xd709('0x20')](respondWithResult(_0x373bb9,null))[_0xd709('0x2a')](handleError(_0x373bb9,null));};exports[_0xd709('0x58')]=function(_0x1371de,_0x33e121){return db['OpenchannelMessage']['create'](_0x1371de[_0xd709('0x59')],{})['then'](respondWithResult(_0x33e121,0xc9))[_0xd709('0x2a')](handleError(_0x33e121,null));};exports[_0xd709('0x5a')]=function(_0x3f1a6f,_0x28fca2){if(_0x3f1a6f[_0xd709('0x59')]['id']){delete _0x3f1a6f[_0xd709('0x59')]['id'];}return db[_0xd709('0x3c')][_0xd709('0x57')]({'where':{'id':_0x3f1a6f[_0xd709('0x5b')]['id']}})['then'](handleEntityNotFound(_0x28fca2,null))[_0xd709('0x20')](saveUpdates(_0x3f1a6f[_0xd709('0x59')],null))['then'](respondWithResult(_0x28fca2,null))['catch'](handleError(_0x28fca2,null));};exports['destroy']=function(_0x55b2e8,_0x2510fc){return db[_0xd709('0x3c')][_0xd709('0x57')]({'where':{'id':_0x55b2e8[_0xd709('0x5b')]['id']}})[_0xd709('0x20')](handleEntityNotFound(_0x2510fc,null))[_0xd709('0x20')](removeEntity(_0x2510fc,null))[_0xd709('0x2a')](handleError(_0x2510fc,null));};exports[_0xd709('0x5c')]=function(_0x5556f4,_0x4e1027){return db['OpenchannelMessage'][_0xd709('0x5c')]()[_0xd709('0x20')](respondWithResult(_0x4e1027,null))['catch'](handleError(_0x4e1027,null));};var interaction_log=require(_0xd709('0x5d'))('openchannel-interactions');exports[_0xd709('0x5e')]=function(_0x37497a,_0x40f5e5,_0x4cd829){var _0x5a4440={'agent':{},'channel':_0xd709('0x5f')};if(_0x37497a[_0xd709('0x59')]['id']){delete _0x37497a['body']['id'];}_0x37497a[_0xd709('0x59')]['read']=!![];_0x37497a['body']['readAt']=moment()['format'](_0xd709('0x60'));_0x37497a[_0xd709('0x59')][_0xd709('0x61')]=_0x37497a[_0xd709('0x59')][_0xd709('0x61')]||_0x37497a[_0xd709('0x62')]['id'];_0x5a4440['agent']['id']=_0x37497a[_0xd709('0x59')][_0xd709('0x61')];return db[_0xd709('0x3c')]['find']({'where':{'id':_0x37497a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40f5e5,null))[_0xd709('0x20')](saveUpdates(_0x37497a[_0xd709('0x59')],null))[_0xd709('0x20')](function(_0xacf049){if(_0xacf049){_0x5a4440[_0xd709('0x28')]=_0xacf049[_0xd709('0x63')]({'plain':!![]});return db[_0xd709('0x64')][_0xd709('0x57')]({'where':{'id':_0xacf049[_0xd709('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x40f5e5,null))['then'](function(_0xb28374){if(_0xb28374){return _0xb28374['update']({'UserId':_0x37497a[_0xd709('0x59')][_0xd709('0x61')],'read1stAt':_[_0xd709('0x66')](_0xb28374[_0xd709('0x67')])?moment()['format'](_0xd709('0x60')):undefined});}return null;})[_0xd709('0x20')](function(_0x5a7d07){if(_0x5a7d07){_0x5a4440[_0xd709('0x68')]=_0x5a7d07['get']({'plain':!![]});interaction_log[_0xd709('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37497a['user']['id'],_0x37497a['user'][_0xd709('0x38')],_0x37497a[_0xd709('0x62')][_0xd709('0x69')],_0x5a4440['interaction']['id'],_0x37497a[_0xd709('0x59')]?JSON[_0xd709('0x6a')](_0x37497a[_0xd709('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0xd709('0x6b'),_0x5a4440);}return null;})[_0xd709('0x20')](function(_0x33aea3){var _0x8e8bc3=_0xd709('0x6c')+_0x33aea3[_0xd709('0x28')][_0xd709('0x6d')];return db[_0xd709('0x6e')]['query'](_0x8e8bc3,{'type':db[_0xd709('0x6f')][_0xd709('0x70')][_0xd709('0x71')],'raw':!![]})[_0xd709('0x20')](function(_0x464ef7){return _0x464ef7;});})[_0xd709('0x20')](function(_0x25b108){if(_0x25b108){_0x5a4440[_0xd709('0x28')][_0xd709('0x72')]=_0x25b108[0x0];if(!_0x37497a[_0xd709('0x59')]['UserId'])return;return db[_0xd709('0x73')][_0xd709('0x57')]({'where':{'id':_0x37497a[_0xd709('0x59')][_0xd709('0x61')],'role':_0xd709('0x74')},'attributes':['id',_0xd709('0x38'),'fullname','email',_0xd709('0x75')],'raw':!![]});}return null;})[_0xd709('0x20')](function(_0x12afd9){if(!_0x12afd9)return null;_0x5a4440[_0xd709('0x28')][_0xd709('0x74')]=_0x12afd9;return _0x5a4440;})[_0xd709('0x20')](function(_0x5d09f1){if(_0x5d09f1){if(_0x37497a[_0xd709('0x59')][_0xd709('0x76')]){_0x5a4440[_0xd709('0x28')][_0xd709('0x77')]=util[_0xd709('0x78')]('SIP/%s',_0x37497a['user']['name']);_0x5a4440[_0xd709('0x28')][_0xd709('0x79')]=_0x5a4440[_0xd709('0x79')];_0x5a4440[_0xd709('0x28')][_0xd709('0x7a')]=_0x5a4440[_0xd709('0x79')];_0x5a4440[_0xd709('0x28')][_0xd709('0x7b')]=_0xd709('0x5e');return respondWithRpcPromise(_0xd709('0x7c'),_0xd709('0x7c'),{'event':_0xd709('0x7d'),'message':_0x5a4440['message']},client9002)['then'](function(){return _0x5a4440;});}return _0x5a4440;}return null;})['then'](respondWithResult(_0x40f5e5,null))[_0xd709('0x2a')](handleError(_0x40f5e5,null));};var interaction_log=require(_0xd709('0x5d'))(_0xd709('0x7e'));exports[_0xd709('0x34')]=function(_0x59689a,_0x597290,_0x49144c){var _0x5f12db={'agent':{},'channel':_0xd709('0x5f')};if(_0x59689a[_0xd709('0x59')]['id']){delete _0x59689a[_0xd709('0x59')]['id'];}_0x59689a[_0xd709('0x59')][_0xd709('0x61')]=_0x59689a[_0xd709('0x59')]['UserId']||_0x59689a[_0xd709('0x62')]['id'];_0x5f12db['agent']['id']=_0x59689a[_0xd709('0x59')][_0xd709('0x61')];return db['OpenchannelMessage'][_0xd709('0x57')]({'where':{'id':_0x59689a[_0xd709('0x5b')]['id'],'UserId':null}})[_0xd709('0x20')](handleEntityNotFound(_0x597290,null))[_0xd709('0x20')](function(_0x594181){if(_0x594181){_0x5f12db['message']=_0x594181[_0xd709('0x63')]({'plain':!![]});return db[_0xd709('0x64')]['find']({'where':{'id':_0x594181[_0xd709('0x65')]}});}return null;})[_0xd709('0x20')](handleEntityNotFound(_0x597290,null))[_0xd709('0x20')](function(_0x49b4ca){if(_0x49b4ca){_0x5f12db[_0xd709('0x68')]=_0x49b4ca[_0xd709('0x63')]({'plain':!![]});interaction_log['info'](_0xd709('0x7f'),_0x59689a[_0xd709('0x62')]['id'],_0x59689a['user'][_0xd709('0x38')],_0x59689a['user']['role'],_0x5f12db[_0xd709('0x68')]['id'],_0x59689a[_0xd709('0x59')]?JSON['stringify'](_0x59689a['body']):'null');return respondWithRpcPromise(_0xd709('0x80'),_0xd709('0x81'),_0x5f12db);}return null;})['then'](function(_0x308558){var _0x5867cc=_0xd709('0x6c')+_0x308558[_0xd709('0x28')]['ContactId'];return db['sequelize']['query'](_0x5867cc,{'type':db['Sequelize'][_0xd709('0x70')][_0xd709('0x71')],'raw':!![]})[_0xd709('0x20')](function(_0x25a8b7){return _0x25a8b7;});})[_0xd709('0x20')](function(_0x47c076){if(_0x47c076){_0x5f12db[_0xd709('0x28')][_0xd709('0x72')]=_0x47c076[0x0];if(!_0x59689a['body'][_0xd709('0x61')])return;return db[_0xd709('0x73')][_0xd709('0x57')]({'where':{'id':_0x59689a[_0xd709('0x59')][_0xd709('0x61')],'role':_0xd709('0x74')},'attributes':['id','name',_0xd709('0x82'),_0xd709('0x83'),'internal'],'raw':!![]});}return null;})[_0xd709('0x20')](function(_0x54fc1b){if(!_0x54fc1b)return null;_0x5f12db[_0xd709('0x28')][_0xd709('0x74')]=_0x54fc1b;return _0x5f12db;})[_0xd709('0x20')](function(_0x349b5b){if(_0x349b5b){_0x349b5b[_0xd709('0x28')][_0xd709('0x77')]=util[_0xd709('0x78')](_0xd709('0x84'),_0x59689a['user']['name']);_0x349b5b[_0xd709('0x28')][_0xd709('0x79')]=_0x5f12db['channel'];_0x349b5b[_0xd709('0x28')][_0xd709('0x7a')]=_0x5f12db[_0xd709('0x79')];_0x349b5b[_0xd709('0x28')][_0xd709('0x7b')]=_0xd709('0x34');respondWithRpcPromise(_0xd709('0x7c'),_0xd709('0x7c'),{'event':_0xd709('0x85'),'message':_0x349b5b[_0xd709('0x28')]},client9002);return _0x5f12db;}return null;})[_0xd709('0x20')](respondWithResult(_0x597290,null))['catch'](handleError(_0x597290,null));}; \ No newline at end of file +var _0x40b7=['name','send','index','OpenchannelMessage','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','show','params','keys','find','create','body','openchannel-interactions','accept','openchannel','read','readAt','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE: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','Sequelize','QueryTypes','contact','fullname','email','manual','format','channel','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','interface','SIP/%s','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelMessage.socket','register','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','destroy','end'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x40b7,0x1e2));var _0x740b=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x40b7[_0x220f3f];return _0x1f170e;};'use strict';var emlformat=require(_0x740b('0x0'));var rimraf=require(_0x740b('0x1'));var zipdir=require(_0x740b('0x2'));var jsonpatch=require(_0x740b('0x3'));var rp=require(_0x740b('0x4'));var moment=require('moment');var BPromise=require(_0x740b('0x5'));var Mustache=require(_0x740b('0x6'));var util=require(_0x740b('0x7'));var path=require(_0x740b('0x8'));var sox=require(_0x740b('0x9'));var csv=require(_0x740b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x740b('0xb'));var _=require(_0x740b('0xc'));var squel=require(_0x740b('0xd'));var crypto=require(_0x740b('0xe'));var jsforce=require(_0x740b('0xf'));var deskjs=require(_0x740b('0x10'));var toCsv=require(_0x740b('0xa'));var querystring=require(_0x740b('0x11'));var Papa=require(_0x740b('0x12'));var Redis=require(_0x740b('0x13'));var authService=require(_0x740b('0x14'));var qs=require(_0x740b('0x15'));var as=require(_0x740b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x740b('0x17'))(_0x740b('0x18'));var utils=require(_0x740b('0x19'));var config=require(_0x740b('0x1a'));var licenseUtil=require(_0x740b('0x1b'));var db=require(_0x740b('0x1c'))['db'];config['redis']=_[_0x740b('0x1d')](config[_0x740b('0x1e')],{'host':_0x740b('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x740b('0x1e')]));require(_0x740b('0x20'))[_0x740b('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x740b('0x22')]({'port':0x232c});var client9002=jayson[_0x740b('0x23')][_0x740b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2be391,_0x16c2e4,_0x27e378,_0x5ddf98){return new BPromise(function(_0x5905b2,_0x359a33){var _0x1a8987=_0x5ddf98||client;return _0x1a8987[_0x740b('0x24')](_0x2be391,_0x27e378)[_0x740b('0x25')](function(_0x407efc){logger[_0x740b('0x26')](_0x740b('0x27'),_0x16c2e4,_0x740b('0x28'));logger[_0x740b('0x29')](_0x740b('0x2a'),_0x16c2e4,_0x740b('0x28'),JSON[_0x740b('0x2b')](_0x407efc));if(_0x407efc[_0x740b('0x2c')]){if(_0x407efc[_0x740b('0x2c')][_0x740b('0x2d')]===0x1f4){logger[_0x740b('0x2c')]('OpenchannelMessage,\x20%s,\x20%s',_0x16c2e4,_0x407efc[_0x740b('0x2c')]['message']);return _0x359a33(_0x407efc[_0x740b('0x2c')][_0x740b('0x2e')]);}logger[_0x740b('0x2c')](_0x740b('0x27'),_0x16c2e4,_0x407efc['error'][_0x740b('0x2e')]);return _0x5905b2(_0x407efc[_0x740b('0x2c')][_0x740b('0x2e')]);}else{logger[_0x740b('0x26')](_0x740b('0x27'),_0x16c2e4,_0x740b('0x28'));_0x5905b2(_0x407efc[_0x740b('0x2f')][_0x740b('0x2e')]);}})[_0x740b('0x30')](function(_0x43f4c2){logger[_0x740b('0x2c')](_0x740b('0x27'),_0x16c2e4,_0x43f4c2);_0x359a33(_0x43f4c2);});});}function respondWithStatusCode(_0x150771,_0x34c65e){_0x34c65e=_0x34c65e||0xcc;return function(_0x1ebdf3){if(_0x1ebdf3){return _0x150771[_0x740b('0x31')](_0x34c65e);}return _0x150771[_0x740b('0x32')](_0x34c65e)['end']();};}function respondWithResult(_0x2a8649,_0xee0922){_0xee0922=_0xee0922||0xc8;return function(_0x259cc3){if(_0x259cc3){return _0x2a8649[_0x740b('0x32')](_0xee0922)['json'](_0x259cc3);}};}function respondWithFilteredResult(_0x373502,_0x5d02ce){return function(_0x191dd5){if(_0x191dd5){var _0x4054d4=typeof _0x5d02ce['offset']===_0x740b('0x33')&&typeof _0x5d02ce[_0x740b('0x34')]===_0x740b('0x33');var _0x254a00=_0x191dd5[_0x740b('0x35')];var _0x28275e=_0x4054d4?0x0:_0x5d02ce[_0x740b('0x36')];var _0x5520ca=_0x4054d4?_0x191dd5[_0x740b('0x35')]:_0x5d02ce[_0x740b('0x36')]+_0x5d02ce[_0x740b('0x34')];var _0x55b0e7;if(_0x5520ca>=_0x254a00){_0x5520ca=_0x254a00;_0x55b0e7=0xc8;}else{_0x55b0e7=0xce;}_0x373502[_0x740b('0x32')](_0x55b0e7);return _0x373502[_0x740b('0x37')](_0x740b('0x38'),_0x28275e+'-'+_0x5520ca+'/'+_0x254a00)[_0x740b('0x39')](_0x191dd5);}return null;};}function patchUpdates(_0x19d254){return function(_0x18fd6d){try{jsonpatch[_0x740b('0x3a')](_0x18fd6d,_0x19d254,!![]);}catch(_0x426397){return BPromise['reject'](_0x426397);}return _0x18fd6d['save']();};}function saveUpdates(_0x3f9ee0,_0x5d6765){return function(_0x4455b0){if(_0x4455b0){return _0x4455b0[_0x740b('0x3b')](_0x3f9ee0)[_0x740b('0x25')](function(_0x205734){return _0x205734;});}return null;};}function removeEntity(_0x2d210e,_0x4c85de){return function(_0x530b50){if(_0x530b50){return _0x530b50[_0x740b('0x3c')]()[_0x740b('0x25')](function(){_0x2d210e[_0x740b('0x32')](0xcc)[_0x740b('0x3d')]();});}};}function handleEntityNotFound(_0x775da,_0x149403){return function(_0x52d73c){if(!_0x52d73c){_0x775da['sendStatus'](0x194);}return _0x52d73c;};}function handleError(_0x43578d,_0x2ac690){_0x2ac690=_0x2ac690||0x1f4;return function(_0x5d49f7){logger[_0x740b('0x2c')](_0x5d49f7['stack']);if(_0x5d49f7[_0x740b('0x3e')]){delete _0x5d49f7[_0x740b('0x3e')];}_0x43578d[_0x740b('0x32')](_0x2ac690)[_0x740b('0x3f')](_0x5d49f7);};}exports[_0x740b('0x40')]=function(_0x5b5efa,_0x355e24){var _0x47d0a1={},_0x39e5a7={},_0x1b33dd={'count':0x0,'rows':[]};var _0x28d526=_['map'](db[_0x740b('0x41')][_0x740b('0x42')],function(_0xd1ff38){return{'name':_0xd1ff38['fieldName'],'type':_0xd1ff38[_0x740b('0x43')][_0x740b('0x44')]};});_0x39e5a7[_0x740b('0x45')]=_['map'](_0x28d526,_0x740b('0x3e'));_0x39e5a7[_0x740b('0x46')]=_['keys'](_0x5b5efa[_0x740b('0x46')]);_0x39e5a7['filters']=_[_0x740b('0x47')](_0x39e5a7['model'],_0x39e5a7[_0x740b('0x46')]);_0x47d0a1[_0x740b('0x48')]=_[_0x740b('0x47')](_0x39e5a7[_0x740b('0x45')],qs[_0x740b('0x49')](_0x5b5efa[_0x740b('0x46')][_0x740b('0x49')]));_0x47d0a1[_0x740b('0x48')]=_0x47d0a1[_0x740b('0x48')][_0x740b('0x4a')]?_0x47d0a1[_0x740b('0x48')]:_0x39e5a7[_0x740b('0x45')];if(!_0x5b5efa[_0x740b('0x46')][_0x740b('0x4b')]('nolimit')){_0x47d0a1[_0x740b('0x34')]=qs[_0x740b('0x34')](_0x5b5efa[_0x740b('0x46')]['limit']);_0x47d0a1[_0x740b('0x36')]=qs[_0x740b('0x36')](_0x5b5efa['query'][_0x740b('0x36')]);}_0x47d0a1[_0x740b('0x4c')]=qs[_0x740b('0x4d')](_0x5b5efa[_0x740b('0x46')][_0x740b('0x4d')]);_0x47d0a1['where']=qs[_0x740b('0x4e')](_[_0x740b('0x4f')](_0x5b5efa[_0x740b('0x46')],_0x39e5a7[_0x740b('0x4e')]),_0x28d526);if(_0x5b5efa[_0x740b('0x46')][_0x740b('0x50')]){_0x47d0a1[_0x740b('0x51')]=_[_0x740b('0x52')](_0x47d0a1['where'],{'$or':_[_0x740b('0x53')](_0x28d526,function(_0x59c7e7){if(_0x59c7e7[_0x740b('0x43')]!==_0x740b('0x54')){var _0x3c6d34={};_0x3c6d34[_0x59c7e7[_0x740b('0x3e')]]={'$like':'%'+_0x5b5efa[_0x740b('0x46')][_0x740b('0x50')]+'%'};return _0x3c6d34;}})});}_0x47d0a1=_[_0x740b('0x52')]({},_0x47d0a1,_0x5b5efa[_0x740b('0x55')]);var _0x3b8280={'where':_0x47d0a1[_0x740b('0x51')]};return db[_0x740b('0x41')][_0x740b('0x35')](_0x3b8280)[_0x740b('0x25')](function(_0x46086b){_0x1b33dd['count']=_0x46086b;if(_0x5b5efa[_0x740b('0x46')][_0x740b('0x56')]){_0x47d0a1[_0x740b('0x57')]=[{'all':!![]}];}return db[_0x740b('0x41')]['findAll'](_0x47d0a1);})['then'](function(_0x2ba888){_0x1b33dd['rows']=_0x2ba888;return _0x1b33dd;})[_0x740b('0x25')](respondWithFilteredResult(_0x355e24,_0x47d0a1))[_0x740b('0x30')](handleError(_0x355e24,null));};exports[_0x740b('0x58')]=function(_0x1e3639,_0x494d32){var _0x27dcbd={'raw':!![],'where':{'id':_0x1e3639[_0x740b('0x59')]['id']}},_0x290f14={};_0x290f14[_0x740b('0x45')]=_[_0x740b('0x5a')](db[_0x740b('0x41')][_0x740b('0x42')]);_0x290f14['query']=_['keys'](_0x1e3639[_0x740b('0x46')]);_0x290f14[_0x740b('0x4e')]=_[_0x740b('0x47')](_0x290f14[_0x740b('0x45')],_0x290f14[_0x740b('0x46')]);_0x27dcbd[_0x740b('0x48')]=_['intersection'](_0x290f14[_0x740b('0x45')],qs[_0x740b('0x49')](_0x1e3639[_0x740b('0x46')][_0x740b('0x49')]));_0x27dcbd[_0x740b('0x48')]=_0x27dcbd[_0x740b('0x48')]['length']?_0x27dcbd[_0x740b('0x48')]:_0x290f14['model'];if(_0x1e3639[_0x740b('0x46')]['includeAll']){_0x27dcbd['include']=[{'all':!![]}];}_0x27dcbd=_[_0x740b('0x52')]({},_0x27dcbd,_0x1e3639[_0x740b('0x55')]);return db['OpenchannelMessage'][_0x740b('0x5b')](_0x27dcbd)[_0x740b('0x25')](handleEntityNotFound(_0x494d32,null))[_0x740b('0x25')](respondWithResult(_0x494d32,null))[_0x740b('0x30')](handleError(_0x494d32,null));};exports[_0x740b('0x5c')]=function(_0xf36907,_0x563a27){return db[_0x740b('0x41')][_0x740b('0x5c')](_0xf36907[_0x740b('0x5d')],{})[_0x740b('0x25')](respondWithResult(_0x563a27,0xc9))[_0x740b('0x30')](handleError(_0x563a27,null));};exports[_0x740b('0x3b')]=function(_0x481e9a,_0x235625){if(_0x481e9a[_0x740b('0x5d')]['id']){delete _0x481e9a['body']['id'];}return db[_0x740b('0x41')][_0x740b('0x5b')]({'where':{'id':_0x481e9a['params']['id']}})[_0x740b('0x25')](handleEntityNotFound(_0x235625,null))[_0x740b('0x25')](saveUpdates(_0x481e9a[_0x740b('0x5d')],null))[_0x740b('0x25')](respondWithResult(_0x235625,null))[_0x740b('0x30')](handleError(_0x235625,null));};exports[_0x740b('0x3c')]=function(_0x1f6f58,_0x248125){return db['OpenchannelMessage'][_0x740b('0x5b')]({'where':{'id':_0x1f6f58['params']['id']}})[_0x740b('0x25')](handleEntityNotFound(_0x248125,null))[_0x740b('0x25')](removeEntity(_0x248125,null))[_0x740b('0x30')](handleError(_0x248125,null));};exports['describe']=function(_0x3cc4b3,_0x2ebcbd){return db[_0x740b('0x41')]['describe']()[_0x740b('0x25')](respondWithResult(_0x2ebcbd,null))[_0x740b('0x30')](handleError(_0x2ebcbd,null));};var interaction_log=require('../../config/logger')(_0x740b('0x5e'));exports[_0x740b('0x5f')]=function(_0x29ac2f,_0x1614fd,_0x3673bf){var _0x3df031={'agent':{},'channel':_0x740b('0x60')};if(_0x29ac2f[_0x740b('0x5d')]['id']){delete _0x29ac2f[_0x740b('0x5d')]['id'];}_0x29ac2f[_0x740b('0x5d')][_0x740b('0x61')]=!![];_0x29ac2f[_0x740b('0x5d')][_0x740b('0x62')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x29ac2f[_0x740b('0x5d')]['UserId']=_0x29ac2f[_0x740b('0x5d')][_0x740b('0x63')]||_0x29ac2f[_0x740b('0x64')]['id'];_0x3df031[_0x740b('0x65')]['id']=_0x29ac2f[_0x740b('0x5d')][_0x740b('0x63')];return db[_0x740b('0x41')][_0x740b('0x5b')]({'where':{'id':_0x29ac2f[_0x740b('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1614fd,null))['then'](saveUpdates(_0x29ac2f['body'],null))[_0x740b('0x25')](function(_0x5b6e20){if(_0x5b6e20){_0x3df031[_0x740b('0x2e')]=_0x5b6e20[_0x740b('0x66')]({'plain':!![]});return db[_0x740b('0x67')][_0x740b('0x5b')]({'where':{'id':_0x5b6e20[_0x740b('0x68')]}});}return null;})[_0x740b('0x25')](handleEntityNotFound(_0x1614fd,null))['then'](function(_0x273998){if(_0x273998){return _0x273998[_0x740b('0x3b')]({'UserId':_0x29ac2f['body'][_0x740b('0x63')],'read1stAt':_[_0x740b('0x69')](_0x273998[_0x740b('0x6a')])?moment()['format'](_0x740b('0x6b')):undefined});}return null;})[_0x740b('0x25')](function(_0x4bebf2){if(_0x4bebf2){_0x3df031[_0x740b('0x6c')]=_0x4bebf2[_0x740b('0x66')]({'plain':!![]});interaction_log[_0x740b('0x26')](_0x740b('0x6d'),_0x29ac2f['user']['id'],_0x29ac2f[_0x740b('0x64')][_0x740b('0x3e')],_0x29ac2f[_0x740b('0x64')][_0x740b('0x6e')],_0x3df031[_0x740b('0x6c')]['id'],_0x29ac2f[_0x740b('0x5d')]?JSON['stringify'](_0x29ac2f[_0x740b('0x5d')]):_0x740b('0x6f'));return respondWithRpcPromise(_0x740b('0x70'),_0x740b('0x71'),_0x3df031);}return null;})[_0x740b('0x25')](function(_0x8ae95b){var _0x311244=_0x740b('0x72')+_0x8ae95b[_0x740b('0x2e')][_0x740b('0x73')];return db[_0x740b('0x74')]['query'](_0x311244,{'type':db[_0x740b('0x75')][_0x740b('0x76')]['SELECT'],'raw':!![]})[_0x740b('0x25')](function(_0x115319){return _0x115319;});})[_0x740b('0x25')](function(_0x26911e){if(_0x26911e){_0x3df031['message'][_0x740b('0x77')]=_0x26911e[0x0];if(!_0x29ac2f[_0x740b('0x5d')][_0x740b('0x63')])return;return db['User'][_0x740b('0x5b')]({'where':{'id':_0x29ac2f[_0x740b('0x5d')][_0x740b('0x63')],'role':'agent'},'attributes':['id','name',_0x740b('0x78'),_0x740b('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x532458){if(!_0x532458)return null;_0x3df031['message'][_0x740b('0x65')]=_0x532458;return _0x3df031;})['then'](function(_0x48f92c){if(_0x48f92c){if(_0x29ac2f[_0x740b('0x5d')][_0x740b('0x7a')]){_0x3df031[_0x740b('0x2e')]['interface']=util[_0x740b('0x7b')]('SIP/%s',_0x29ac2f[_0x740b('0x64')][_0x740b('0x3e')]);_0x3df031[_0x740b('0x2e')][_0x740b('0x7c')]=_0x3df031['channel'];_0x3df031[_0x740b('0x2e')]['motionChannel']=_0x3df031[_0x740b('0x7c')];_0x3df031['message']['event']=_0x740b('0x5f');return respondWithRpcPromise(_0x740b('0x7d'),_0x740b('0x7d'),{'event':_0x740b('0x7e'),'message':_0x3df031[_0x740b('0x2e')]},client9002)[_0x740b('0x25')](function(){return _0x3df031;});}return _0x3df031;}return null;})[_0x740b('0x25')](respondWithResult(_0x1614fd,null))[_0x740b('0x30')](handleError(_0x1614fd,null));};var interaction_log=require(_0x740b('0x17'))(_0x740b('0x5e'));exports[_0x740b('0x7f')]=function(_0x6bf6b7,_0x32de5a,_0x2862b4){var _0x52c071={'agent':{},'channel':_0x740b('0x60')};if(_0x6bf6b7['body']['id']){delete _0x6bf6b7[_0x740b('0x5d')]['id'];}_0x6bf6b7[_0x740b('0x5d')][_0x740b('0x63')]=_0x6bf6b7[_0x740b('0x5d')][_0x740b('0x63')]||_0x6bf6b7['user']['id'];_0x52c071['agent']['id']=_0x6bf6b7[_0x740b('0x5d')][_0x740b('0x63')];return db[_0x740b('0x41')]['find']({'where':{'id':_0x6bf6b7[_0x740b('0x59')]['id'],'UserId':null}})[_0x740b('0x25')](handleEntityNotFound(_0x32de5a,null))[_0x740b('0x25')](function(_0x4428b2){if(_0x4428b2){_0x52c071['message']=_0x4428b2[_0x740b('0x66')]({'plain':!![]});return db[_0x740b('0x67')]['find']({'where':{'id':_0x4428b2[_0x740b('0x68')]}});}return null;})[_0x740b('0x25')](handleEntityNotFound(_0x32de5a,null))[_0x740b('0x25')](function(_0x177fee){if(_0x177fee){_0x52c071[_0x740b('0x6c')]=_0x177fee[_0x740b('0x66')]({'plain':!![]});interaction_log[_0x740b('0x26')](_0x740b('0x80'),_0x6bf6b7['user']['id'],_0x6bf6b7[_0x740b('0x64')]['name'],_0x6bf6b7[_0x740b('0x64')][_0x740b('0x6e')],_0x52c071[_0x740b('0x6c')]['id'],_0x6bf6b7[_0x740b('0x5d')]?JSON[_0x740b('0x2b')](_0x6bf6b7['body']):_0x740b('0x6f'));return respondWithRpcPromise(_0x740b('0x81'),'rejectMessage',_0x52c071);}return null;})['then'](function(_0x565eed){var _0x427d8f=_0x740b('0x72')+_0x565eed[_0x740b('0x2e')][_0x740b('0x73')];return db[_0x740b('0x74')][_0x740b('0x46')](_0x427d8f,{'type':db[_0x740b('0x75')][_0x740b('0x76')][_0x740b('0x82')],'raw':!![]})['then'](function(_0x15fc5b){return _0x15fc5b;});})[_0x740b('0x25')](function(_0x1bef28){if(_0x1bef28){_0x52c071[_0x740b('0x2e')][_0x740b('0x77')]=_0x1bef28[0x0];if(!_0x6bf6b7[_0x740b('0x5d')]['UserId'])return;return db['User']['find']({'where':{'id':_0x6bf6b7[_0x740b('0x5d')][_0x740b('0x63')],'role':_0x740b('0x65')},'attributes':['id',_0x740b('0x3e'),_0x740b('0x78'),_0x740b('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x34a691){if(!_0x34a691)return null;_0x52c071[_0x740b('0x2e')][_0x740b('0x65')]=_0x34a691;return _0x52c071;})[_0x740b('0x25')](function(_0x4c76b8){if(_0x4c76b8){_0x4c76b8[_0x740b('0x2e')][_0x740b('0x83')]=util[_0x740b('0x7b')](_0x740b('0x84'),_0x6bf6b7[_0x740b('0x64')][_0x740b('0x3e')]);_0x4c76b8[_0x740b('0x2e')][_0x740b('0x7c')]=_0x52c071['channel'];_0x4c76b8['message'][_0x740b('0x85')]=_0x52c071[_0x740b('0x7c')];_0x4c76b8[_0x740b('0x2e')][_0x740b('0x86')]=_0x740b('0x7f');respondWithRpcPromise(_0x740b('0x7d'),_0x740b('0x7d'),{'event':_0x740b('0x87'),'message':_0x4c76b8[_0x740b('0x2e')]},client9002);return _0x52c071;}return null;})['then'](respondWithResult(_0x32de5a,null))[_0x740b('0x30')](handleError(_0x32de5a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index f8596a4..897d3fe 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 _0xa0df=['hook','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa0df,0x10b));var _0xfa0d=function(_0x3e6ad5,_0x4a90ae){_0x3e6ad5=_0x3e6ad5-0x0;var _0x17f73c=_0xa0df[_0x3e6ad5];return _0x17f73c;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfa0d('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfa0d('0x1')](0x0);var events={'afterCreate':_0xfa0d('0x2'),'afterUpdate':_0xfa0d('0x3'),'afterDestroy':'remove'};function emitEvent(_0xcbe45b){return function(_0x34eca4,_0x4f84c0,_0x50c444){OpenchannelMessageEvents[_0xfa0d('0x4')](_0xcbe45b+':'+_0x34eca4['id'],_0x34eca4);OpenchannelMessageEvents[_0xfa0d('0x4')](_0xcbe45b,_0x34eca4);_0x50c444(null);};}for(var e in events){if(events[_0xfa0d('0x5')](e)){var event=events[e];OpenchannelMessage[_0xfa0d('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x7e95=['remove','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x565de9,_0x114287){var _0x5f5dab=function(_0x264405){while(--_0x264405){_0x565de9['push'](_0x565de9['shift']());}};_0x5f5dab(++_0x114287);}(_0x7e95,0xe5));var _0x57e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e95[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x57e9('0x0'))['db'][_0x57e9('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x57e9('0x2')](0x0);var events={'afterCreate':_0x57e9('0x3'),'afterUpdate':_0x57e9('0x4'),'afterDestroy':_0x57e9('0x5')};function emitEvent(_0x3c01ba){return function(_0x3ed730,_0x47a968,_0x135b34){OpenchannelMessageEvents['emit'](_0x3c01ba+':'+_0x3ed730['id'],_0x3ed730);OpenchannelMessageEvents['emit'](_0x3c01ba,_0x3ed730);_0x135b34(null);};}for(var e in events){if(events[_0x57e9('0x6')](e)){var event=events[e];OpenchannelMessage[_0x57e9('0x7')](e,emitEvent(event));}}module[_0x57e9('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 50b8ae7..03985a4 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 _0x8e87=['then','catch','error','CmContact','OpenchannelAccount','find','Contact','keys','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','POST','method','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x8e87,0x1e6));var _0x78e8=function(_0x4677d0,_0x3236c6){_0x4677d0=_0x4677d0-0x0;var _0x183350=_0x8e87[_0x4677d0];return _0x183350;};'use strict';var _=require(_0x78e8('0x0'));var util=require(_0x78e8('0x1'));var logger=require(_0x78e8('0x2'))('api');var moment=require(_0x78e8('0x3'));var BPromise=require(_0x78e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x78e8('0x5'));var config=require(_0x78e8('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x1d7479,_0x2a2ef2){return _0x1d7479[_0x78e8('0x7')](_0x78e8('0x8'),attributes,{'tableName':_0x78e8('0x9'),'paranoid':![],'indexes':[{'name':_0x78e8('0xa'),'fields':[_0x78e8('0xb')],'type':_0x78e8('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fac12,_0x5ba002,_0x1b03b9){var _0x322d85=_0x1d7479[_0x78e8('0xd')];var _0x3fb5a6=_0x3fac12[_0x78e8('0xe')]({'plain':!![]});if(_0x3fb5a6[_0x78e8('0xf')][_0x78e8('0x10')]()==='in'||_0x3fb5a6['direction']['toLowerCase']()===_0x78e8('0x11')&&!_0x3fb5a6[_0x78e8('0x12')]&&!_[_0x78e8('0x13')](_0x3fb5a6[_0x78e8('0x14')])){_0x322d85[_0x78e8('0x15')][_0x78e8('0x16')]({'where':{'id':_0x3fb5a6[_0x78e8('0x17')]}})[_0x78e8('0x18')](function(_0x33ad51){if(_0x33ad51){_0x33ad51['update']({'lastMsgAt':_0x3fb5a6['createdAt'],'lastMsgDirection':_0x3fb5a6[_0x78e8('0xf')][_0x78e8('0x10')]()});}})[_0x78e8('0x19')](function(_0x1339f0){console[_0x78e8('0x1a')](_0x1339f0);});}if(_0x3fb5a6[_0x78e8('0xf')]===_0x78e8('0x11')&&!_0x3fb5a6['secret']){var _0x51fed0;_0x322d85[_0x78e8('0x1b')]['describe']()['then'](function(_0x5abc4e){return _0x322d85[_0x78e8('0x1c')][_0x78e8('0x1d')]({'where':{'id':_0x3fb5a6['OpenchannelAccountId']},'include':[{'model':_0x322d85[_0x78e8('0x15')],'as':'Interactions','where':{'id':_0x3fb5a6['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x322d85['CmContact'],'as':_0x78e8('0x1e'),'attributes':_[_0x78e8('0x1f')](_0x5abc4e)}]}]});})[_0x78e8('0x18')](function(_0x572266){_0x51fed0=_0x572266['get']({'plain':!![]});if(_0x51fed0&&_0x51fed0['replyUri']){logger[_0x78e8('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x78e8('0x21'),util[_0x78e8('0x22')](_0x78e8('0x23'),_0x3fb5a6['id'],_0x51fed0[_0x78e8('0x24')]));if(_0x51fed0[_0x78e8('0x25')]&&_0x51fed0[_0x78e8('0x25')][_0x78e8('0x26')]){_0x3fb5a6[_0x78e8('0x27')]=_[_0x78e8('0x28')](_0x51fed0['Interactions'][0x0],_0x78e8('0x1e'));_0x3fb5a6[_0x78e8('0x1e')]=_0x51fed0[_0x78e8('0x25')][0x0]['Contact'];}var _0x5ba002={'method':_0x78e8('0x29'),'uri':encodeURI(_0x51fed0['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5ba002[_0x78e8('0x2a')]){case'GET':_0x5ba002['qs']=_0x3fb5a6;break;case'POST':_0x5ba002[_0x78e8('0xb')]=_0x3fb5a6;break;}return rp(_0x5ba002)[_0x78e8('0x18')](function(_0x569940){logger[_0x78e8('0x20')](_0x78e8('0x2b'),'afterCreate',util[_0x78e8('0x22')](_0x78e8('0x2c'),_0x3fb5a6['id'],_0x51fed0[_0x78e8('0x24')]));if(_0x569940[_0x78e8('0xb')][_0x78e8('0x2d')]&&_0x569940[_0x78e8('0xb')][_0x78e8('0x2d')]!=_0x3fb5a6[_0x78e8('0x27')][_0x78e8('0x2d')]){return _0x322d85['OpenchannelInteraction']['update']({'threadId':_0x569940[_0x78e8('0xb')][_0x78e8('0x2d')]},{'where':{'id':_0x3fb5a6[_0x78e8('0x27')]['id']}});}else{return;}})['then'](function(){return _0x3fac12[_0x78e8('0x2e')]({'read':!![]});})[_0x78e8('0x19')](function(_0x4d73e9){logger[_0x78e8('0x1a')](_0x78e8('0x2b'),_0x78e8('0x21'),util[_0x78e8('0x2f')](_0x4d73e9,{'showHidden':![],'depth':null}));_0x1b03b9();});}else{_0x1b03b9();}})[_0x78e8('0x30')](function(){_0x1b03b9();});}else{_0x1b03b9();}}},'charset':_0x78e8('0x31'),'collate':_0x78e8('0x32')});}; \ No newline at end of file +var _0x1ad7=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','error','describe','OpenchannelAccount','find','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method'];(function(_0x31ac90,_0x1360f5){var _0x3b5e21=function(_0x2d2f19){while(--_0x2d2f19){_0x31ac90['push'](_0x31ac90['shift']());}};_0x3b5e21(++_0x1360f5);}(_0x1ad7,0x180));var _0x71ad=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x1ad7[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x71ad('0x0'));var util=require(_0x71ad('0x1'));var logger=require(_0x71ad('0x2'))(_0x71ad('0x3'));var moment=require(_0x71ad('0x4'));var BPromise=require('bluebird');var rp=require(_0x71ad('0x5'));var fs=require('fs');var path=require(_0x71ad('0x6'));var rimraf=require(_0x71ad('0x7'));var config=require(_0x71ad('0x8'));var attributes=require(_0x71ad('0x9'));module[_0x71ad('0xa')]=function(_0x386b71,_0x1ace59){return _0x386b71[_0x71ad('0xb')](_0x71ad('0xc'),attributes,{'tableName':_0x71ad('0xd'),'paranoid':![],'indexes':[{'name':_0x71ad('0xe'),'fields':[_0x71ad('0xf')],'type':_0x71ad('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xef047d,_0x26d49a,_0x2cd25d){var _0x3fe979=_0x386b71[_0x71ad('0x11')];var _0x432604=_0xef047d[_0x71ad('0x12')]({'plain':!![]});if(_0x432604[_0x71ad('0x13')]['toLowerCase']()==='in'||_0x432604[_0x71ad('0x13')]['toLowerCase']()===_0x71ad('0x14')&&!_0x432604[_0x71ad('0x15')]&&!_[_0x71ad('0x16')](_0x432604[_0x71ad('0x17')])){_0x3fe979['OpenchannelInteraction'][_0x71ad('0x18')]({'where':{'id':_0x432604[_0x71ad('0x19')]}})[_0x71ad('0x1a')](function(_0x5f47a7){if(_0x5f47a7){_0x5f47a7[_0x71ad('0x1b')]({'lastMsgAt':_0x432604[_0x71ad('0x1c')],'lastMsgDirection':_0x432604[_0x71ad('0x13')]['toLowerCase']()});}})['catch'](function(_0x205c04){console[_0x71ad('0x1d')](_0x205c04);});}if(_0x432604[_0x71ad('0x13')]===_0x71ad('0x14')&&!_0x432604[_0x71ad('0x15')]){var _0x116f9b;_0x3fe979['CmContact'][_0x71ad('0x1e')]()[_0x71ad('0x1a')](function(_0xcddb66){return _0x3fe979[_0x71ad('0x1f')][_0x71ad('0x20')]({'where':{'id':_0x432604['OpenchannelAccountId']},'include':[{'model':_0x3fe979[_0x71ad('0x21')],'as':_0x71ad('0x22'),'where':{'id':_0x432604[_0x71ad('0x19')]},'limit':0x1,'include':[{'model':_0x3fe979[_0x71ad('0x23')],'as':_0x71ad('0x24'),'attributes':_[_0x71ad('0x25')](_0xcddb66)}]}]});})['then'](function(_0x1349b6){_0x116f9b=_0x1349b6[_0x71ad('0x12')]({'plain':!![]});if(_0x116f9b&&_0x116f9b[_0x71ad('0x26')]){logger[_0x71ad('0x27')](_0x71ad('0x28'),_0x71ad('0x29'),util[_0x71ad('0x2a')](_0x71ad('0x2b'),_0x432604['id'],_0x116f9b[_0x71ad('0x26')]));if(_0x116f9b[_0x71ad('0x22')]&&_0x116f9b[_0x71ad('0x22')][_0x71ad('0x2c')]){_0x432604['Interaction']=_[_0x71ad('0x2d')](_0x116f9b['Interactions'][0x0],_0x71ad('0x24'));_0x432604[_0x71ad('0x24')]=_0x116f9b[_0x71ad('0x22')][0x0]['Contact'];}var _0x26d49a={'method':_0x71ad('0x2e'),'uri':encodeURI(_0x116f9b['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x26d49a[_0x71ad('0x2f')]){case'GET':_0x26d49a['qs']=_0x432604;break;case _0x71ad('0x2e'):_0x26d49a[_0x71ad('0xf')]=_0x432604;break;}return rp(_0x26d49a)[_0x71ad('0x1a')](function(_0x4ba578){logger[_0x71ad('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x71ad('0x29'),util[_0x71ad('0x2a')](_0x71ad('0x30'),_0x432604['id'],_0x116f9b[_0x71ad('0x26')]));if(_0x4ba578[_0x71ad('0xf')][_0x71ad('0x31')]&&_0x4ba578[_0x71ad('0xf')][_0x71ad('0x31')]!=_0x432604[_0x71ad('0x32')][_0x71ad('0x31')]){return _0x3fe979[_0x71ad('0x21')][_0x71ad('0x1b')]({'threadId':_0x4ba578['body']['threadId']},{'where':{'id':_0x432604[_0x71ad('0x32')]['id']}});}else{return;}})['then'](function(){return _0xef047d[_0x71ad('0x1b')]({'read':!![]});})['catch'](function(_0x404049){logger[_0x71ad('0x1d')](_0x71ad('0x28'),_0x71ad('0x29'),util[_0x71ad('0x33')](_0x404049,{'showHidden':![],'depth':null}));_0x2cd25d();});}else{_0x2cd25d();}})['finally'](function(){_0x2cd25d();});}else{_0x2cd25d();}}},'charset':_0x71ad('0x34'),'collate':_0x71ad('0x35')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1a2cc12..822749c 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 _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(_0x4c3280,_0x26a10e){var _0x3086a7=function(_0xf399d6){while(--_0xf399d6){_0x4c3280['push'](_0x4c3280['shift']());}};_0x3086a7(++_0x26a10e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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 +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(_0x19ae7b,_0x9e4712){var _0x4cff5e=function(_0x482bcb){while(--_0x482bcb){_0x19ae7b['push'](_0x19ae7b['shift']());}};_0x4cff5e(++_0x9e4712);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'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 b2e8ca2..334b03e 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 _0xb353=['emit','removeListener','register','length','./openchannelMessage.events','save','remove'];(function(_0x4c87c7,_0x4bb7a4){var _0x65a9d1=function(_0x4c5fda){while(--_0x4c5fda){_0x4c87c7['push'](_0x4c87c7['shift']());}};_0x65a9d1(++_0x4bb7a4);}(_0xb353,0xdd));var _0x3b35=function(_0x240e42,_0x48e094){_0x240e42=_0x240e42-0x0;var _0xfebf05=_0xb353[_0x240e42];return _0xfebf05;};'use strict';var OpenchannelMessageEvents=require(_0x3b35('0x0'));var events=[_0x3b35('0x1'),_0x3b35('0x2'),'update'];function createListener(_0x72e594,_0xf793dd){return function(_0x263555){_0xf793dd[_0x3b35('0x3')](_0x72e594,_0x263555);};}function removeListener(_0x22509f,_0x172980){return function(){OpenchannelMessageEvents[_0x3b35('0x4')](_0x22509f,_0x172980);};}exports[_0x3b35('0x5')]=function(_0x4e3bbe){for(var _0x28638f=0x0,_0x48611f=events[_0x3b35('0x6')];_0x28638f<_0x48611f;_0x28638f++){var _0x37d4c9=events[_0x28638f];var _0x16a7c9=createListener('openchannelMessage:'+_0x37d4c9,_0x4e3bbe);OpenchannelMessageEvents['on'](_0x37d4c9,_0x16a7c9);}}; \ No newline at end of file +var _0xcde1=['./openchannelMessage.events','save','remove','update','emit','register','openchannelMessage:'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xcde1,0x165));var _0x1cde=function(_0x157c7b,_0x199a92){_0x157c7b=_0x157c7b-0x0;var _0x37b43e=_0xcde1[_0x157c7b];return _0x37b43e;};'use strict';var OpenchannelMessageEvents=require(_0x1cde('0x0'));var events=[_0x1cde('0x1'),_0x1cde('0x2'),_0x1cde('0x3')];function createListener(_0x4fe73a,_0x1a4c21){return function(_0x19e708){_0x1a4c21[_0x1cde('0x4')](_0x4fe73a,_0x19e708);};}function removeListener(_0x5b9da5,_0x7d722e){return function(){OpenchannelMessageEvents['removeListener'](_0x5b9da5,_0x7d722e);};}exports[_0x1cde('0x5')]=function(_0x5605a7){for(var _0x2c3cc6=0x0,_0x4235ef=events['length'];_0x2c3cc6<_0x4235ef;_0x2c3cc6++){var _0x31258d=events[_0x2c3cc6];var _0x50f683=createListener(_0x1cde('0x6')+_0x31258d,_0x5605a7);OpenchannelMessageEvents['on'](_0x31258d,_0x50f683);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6af94d2..a087580 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 _0x2d2a=['create','/:id/teams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/users','getAgents','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d2a,0x19d));var _0xa2d2=function(_0x31d1ee,_0x2d0b85){_0x31d1ee=_0x31d1ee-0x0;var _0x410ecd=_0x2d2a[_0x31d1ee];return _0x410ecd;};'use strict';var multer=require(_0xa2d2('0x0'));var util=require(_0xa2d2('0x1'));var path=require(_0xa2d2('0x2'));var timeout=require(_0xa2d2('0x3'));var express=require('express');var router=express[_0xa2d2('0x4')]();var fs_extra=require(_0xa2d2('0x5'));var auth=require(_0xa2d2('0x6'));var interaction=require(_0xa2d2('0x7'));var config=require(_0xa2d2('0x8'));var controller=require(_0xa2d2('0x9'));router[_0xa2d2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa2d2('0xb')]);router['get'](_0xa2d2('0xc'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0xe')]);router['get']('/:id',auth[_0xa2d2('0xd')](),controller[_0xa2d2('0xf')]);router['get'](_0xa2d2('0x10'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x11')]);router[_0xa2d2('0xa')]('/:id/teams',auth[_0xa2d2('0xd')](),controller['getTeams']);router['get'](_0xa2d2('0x12'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x13')]);router[_0xa2d2('0x14')]('/',auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x15')]);router[_0xa2d2('0x14')](_0xa2d2('0x16'),auth[_0xa2d2('0xd')](),controller['addTeams']);router[_0xa2d2('0x14')](_0xa2d2('0x12'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x17')]);router[_0xa2d2('0x18')](_0xa2d2('0x19'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x1a')]);router[_0xa2d2('0x1b')](_0xa2d2('0x19'),auth['isAuthenticated'](),controller[_0xa2d2('0x1c')]);router[_0xa2d2('0x1b')](_0xa2d2('0x16'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa2d2('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xb214=['post','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','/:id','show','getTeams','/:id/users','getAgents'];(function(_0x4cfaf5,_0x2cd513){var _0x2bbc2f=function(_0x128003){while(--_0x128003){_0x4cfaf5['push'](_0x4cfaf5['shift']());}};_0x2bbc2f(++_0x2cd513);}(_0xb214,0x161));var _0x4b21=function(_0x4f8371,_0x46d69a){_0x4f8371=_0x4f8371-0x0;var _0x31fda1=_0xb214[_0x4f8371];return _0x31fda1;};'use strict';var multer=require(_0x4b21('0x0'));var util=require(_0x4b21('0x1'));var path=require(_0x4b21('0x2'));var timeout=require(_0x4b21('0x3'));var express=require('express');var router=express[_0x4b21('0x4')]();var fs_extra=require(_0x4b21('0x5'));var auth=require(_0x4b21('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x4b21('0x7')]('/',auth[_0x4b21('0x8')](),controller['index']);router[_0x4b21('0x7')](_0x4b21('0x9'),auth[_0x4b21('0x8')](),controller['describe']);router[_0x4b21('0x7')](_0x4b21('0xa'),auth['isAuthenticated'](),controller[_0x4b21('0xb')]);router['get']('/:id/members',auth[_0x4b21('0x8')](),controller['getMembers']);router[_0x4b21('0x7')]('/:id/teams',auth[_0x4b21('0x8')](),controller[_0x4b21('0xc')]);router[_0x4b21('0x7')](_0x4b21('0xd'),auth[_0x4b21('0x8')](),controller[_0x4b21('0xe')]);router[_0x4b21('0xf')]('/',auth[_0x4b21('0x8')](),controller['create']);router['post'](_0x4b21('0x10'),auth['isAuthenticated'](),controller[_0x4b21('0x11')]);router[_0x4b21('0xf')](_0x4b21('0xd'),auth[_0x4b21('0x8')](),controller['addAgents']);router[_0x4b21('0x12')](_0x4b21('0xa'),auth[_0x4b21('0x8')](),controller[_0x4b21('0x13')]);router[_0x4b21('0x14')]('/:id',auth[_0x4b21('0x8')](),controller[_0x4b21('0x15')]);router[_0x4b21('0x14')]('/:id/teams',auth[_0x4b21('0x8')](),controller['removeTeams']);router[_0x4b21('0x14')](_0x4b21('0xd'),auth['isAuthenticated'](),controller[_0x4b21('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 490b0cd..f50cb63 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 _0xf32e=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2f2898,_0x4b21c7){var _0x46a507=function(_0x3ebfdd){while(--_0x3ebfdd){_0x2f2898['push'](_0x2f2898['shift']());}};_0x46a507(++_0x4b21c7);}(_0xf32e,0x19c));var _0xef32=function(_0xd8eb50,_0x3db9a6){_0xd8eb50=_0xd8eb50-0x0;var _0x239bbd=_0xf32e[_0xd8eb50];return _0x239bbd;};'use strict';var Sequelize=require(_0xef32('0x0'));module[_0xef32('0x1')]={'name':{'type':Sequelize[_0xef32('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xef32('0x2')]},'timeout':{'type':Sequelize[_0xef32('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xef32('0x4')](_0xef32('0x5'),'beepall',_0xef32('0x6'))}}; \ No newline at end of file +var _0x3748=['sequelize','exports','STRING','name','ENUM','rrmemory','roundrobin'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3748,0xa8));var _0x8374=function(_0x34bd60,_0x235471){_0x34bd60=_0x34bd60-0x0;var _0x265ed1=_0x3748[_0x34bd60];return _0x265ed1;};'use strict';var Sequelize=require(_0x8374('0x0'));module[_0x8374('0x1')]={'name':{'type':Sequelize[_0x8374('0x2')],'unique':_0x8374('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8374('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8374('0x4')](_0x8374('0x5'),'beepall',_0x8374('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d818930..8590fa3 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 _0xfd74=['getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','order','OpenchannelQueueId','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','isEmpty','forEach','omit','spread','removeAgents','isArray'];(function(_0x5baec5,_0x1ef2e9){var _0x46db04=function(_0x2172c6){while(--_0x2172c6){_0x5baec5['push'](_0x5baec5['shift']());}};_0x46db04(++_0x1ef2e9);}(_0xfd74,0x91));var _0x4fd7=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xfd74[_0x1314d4];return _0x584ba5;};'use strict';var emlformat=require(_0x4fd7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fd7('0x1'));var jsonpatch=require(_0x4fd7('0x2'));var rp=require(_0x4fd7('0x3'));var moment=require(_0x4fd7('0x4'));var BPromise=require(_0x4fd7('0x5'));var Mustache=require(_0x4fd7('0x6'));var util=require(_0x4fd7('0x7'));var path=require(_0x4fd7('0x8'));var sox=require(_0x4fd7('0x9'));var csv=require(_0x4fd7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fd7('0xb'));var _=require(_0x4fd7('0xc'));var squel=require(_0x4fd7('0xd'));var crypto=require(_0x4fd7('0xe'));var jsforce=require(_0x4fd7('0xf'));var deskjs=require(_0x4fd7('0x10'));var toCsv=require(_0x4fd7('0xa'));var querystring=require(_0x4fd7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4fd7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4fd7('0x13'));var hardwareService=require(_0x4fd7('0x14'));var logger=require(_0x4fd7('0x15'))(_0x4fd7('0x16'));var utils=require(_0x4fd7('0x17'));var config=require(_0x4fd7('0x18'));var licenseUtil=require(_0x4fd7('0x19'));var db=require(_0x4fd7('0x1a'))['db'];config[_0x4fd7('0x1b')]=_[_0x4fd7('0x1c')](config[_0x4fd7('0x1b')],{'host':_0x4fd7('0x1d'),'port':0x18eb});var socket=require(_0x4fd7('0x1e'))(new Redis(config[_0x4fd7('0x1b')]));require(_0x4fd7('0x1f'))[_0x4fd7('0x20')](socket);function respondWithStatusCode(_0x4ee2b8,_0xcda06){_0xcda06=_0xcda06||0xcc;return function(_0x2648e1){if(_0x2648e1){return _0x4ee2b8['sendStatus'](_0xcda06);}return _0x4ee2b8[_0x4fd7('0x21')](_0xcda06)[_0x4fd7('0x22')]();};}function respondWithResult(_0x121d26,_0x32e2a8){_0x32e2a8=_0x32e2a8||0xc8;return function(_0x52ce3b){if(_0x52ce3b){return _0x121d26[_0x4fd7('0x21')](_0x32e2a8)[_0x4fd7('0x23')](_0x52ce3b);}};}function respondWithFilteredResult(_0x5b3302,_0x545fad){return function(_0x1f1ab0){if(_0x1f1ab0){var _0x2ddb2c=typeof _0x545fad[_0x4fd7('0x24')]===_0x4fd7('0x25')&&typeof _0x545fad[_0x4fd7('0x26')]===_0x4fd7('0x25');var _0x19a267=_0x1f1ab0[_0x4fd7('0x27')];var _0x1f51c9=_0x2ddb2c?0x0:_0x545fad['offset'];var _0x4280e3=_0x2ddb2c?_0x1f1ab0['count']:_0x545fad[_0x4fd7('0x24')]+_0x545fad['limit'];var _0x1f1ce5;if(_0x4280e3>=_0x19a267){_0x4280e3=_0x19a267;_0x1f1ce5=0xc8;}else{_0x1f1ce5=0xce;}_0x5b3302[_0x4fd7('0x21')](_0x1f1ce5);return _0x5b3302[_0x4fd7('0x28')](_0x4fd7('0x29'),_0x1f51c9+'-'+_0x4280e3+'/'+_0x19a267)[_0x4fd7('0x23')](_0x1f1ab0);}return null;};}function patchUpdates(_0x20ad93){return function(_0xaf44db){try{jsonpatch['apply'](_0xaf44db,_0x20ad93,!![]);}catch(_0x122fc7){return BPromise[_0x4fd7('0x2a')](_0x122fc7);}return _0xaf44db[_0x4fd7('0x2b')]();};}function saveUpdates(_0x46ca98,_0x3f8e81){return function(_0xfee644){if(_0xfee644){return _0xfee644['update'](_0x46ca98)['then'](function(_0x110857){return _0x110857;});}return null;};}function removeEntity(_0x1ce6ac,_0x2497d7){return function(_0x5d3ada){if(_0x5d3ada){return _0x5d3ada[_0x4fd7('0x2c')]()[_0x4fd7('0x2d')](function(){var _0x17e0af=_0x5d3ada['get']({'plain':!![]});var _0x374ad0=_0x4fd7('0x2e');return db[_0x4fd7('0x2f')][_0x4fd7('0x2c')]({'where':{'type':_0x374ad0,'resourceId':_0x17e0af['id']}})[_0x4fd7('0x2d')](function(){return _0x5d3ada;});})[_0x4fd7('0x2d')](function(){_0x1ce6ac[_0x4fd7('0x21')](0xcc)[_0x4fd7('0x22')]();});}};}function handleEntityNotFound(_0x2be61f,_0x13d10f){return function(_0x1ff3c3){if(!_0x1ff3c3){_0x2be61f[_0x4fd7('0x30')](0x194);}return _0x1ff3c3;};}function handleError(_0x2992da,_0x2459f9){_0x2459f9=_0x2459f9||0x1f4;return function(_0x1df7c1){logger[_0x4fd7('0x31')](_0x1df7c1[_0x4fd7('0x32')]);if(_0x1df7c1[_0x4fd7('0x33')]){delete _0x1df7c1[_0x4fd7('0x33')];}_0x2992da[_0x4fd7('0x21')](_0x2459f9)[_0x4fd7('0x34')](_0x1df7c1);};}exports[_0x4fd7('0x35')]=function(_0x2bebd9,_0x2a048a){var _0x2b422b={},_0xa82d0c={},_0x316fa2={'count':0x0,'rows':[]};var _0x3f5b83=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x274a60){return{'name':_0x274a60[_0x4fd7('0x36')],'type':_0x274a60['type']['key']};});_0xa82d0c[_0x4fd7('0x37')]=_[_0x4fd7('0x38')](_0x3f5b83,_0x4fd7('0x33'));_0xa82d0c[_0x4fd7('0x39')]=_[_0x4fd7('0x3a')](_0x2bebd9['query']);_0xa82d0c[_0x4fd7('0x3b')]=_[_0x4fd7('0x3c')](_0xa82d0c[_0x4fd7('0x37')],_0xa82d0c[_0x4fd7('0x39')]);_0x2b422b['attributes']=_[_0x4fd7('0x3c')](_0xa82d0c[_0x4fd7('0x37')],qs['fields'](_0x2bebd9[_0x4fd7('0x39')][_0x4fd7('0x3d')]));_0x2b422b[_0x4fd7('0x3e')]=_0x2b422b[_0x4fd7('0x3e')]['length']?_0x2b422b[_0x4fd7('0x3e')]:_0xa82d0c[_0x4fd7('0x37')];if(!_0x2bebd9[_0x4fd7('0x39')]['hasOwnProperty'](_0x4fd7('0x3f'))){_0x2b422b[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x2bebd9[_0x4fd7('0x39')][_0x4fd7('0x26')]);_0x2b422b['offset']=qs[_0x4fd7('0x24')](_0x2bebd9[_0x4fd7('0x39')][_0x4fd7('0x24')]);}_0x2b422b['order']=qs[_0x4fd7('0x40')](_0x2bebd9[_0x4fd7('0x39')]['sort']);_0x2b422b[_0x4fd7('0x41')]=qs['filters'](_[_0x4fd7('0x42')](_0x2bebd9['query'],_0xa82d0c[_0x4fd7('0x3b')]),_0x3f5b83);if(_0x2bebd9['query'][_0x4fd7('0x43')]){_0x2b422b['where']=_[_0x4fd7('0x44')](_0x2b422b[_0x4fd7('0x41')],{'$or':_['map'](_0x3f5b83,function(_0x2222b4){if(_0x2222b4['type']!==_0x4fd7('0x45')){var _0x2afa32={};_0x2afa32[_0x2222b4[_0x4fd7('0x33')]]={'$like':'%'+_0x2bebd9[_0x4fd7('0x39')]['filter']+'%'};return _0x2afa32;}})});}_0x2b422b=_[_0x4fd7('0x44')]({},_0x2b422b,_0x2bebd9[_0x4fd7('0x46')]);var _0x1aa2cb={'where':_0x2b422b[_0x4fd7('0x41')]};return db[_0x4fd7('0x47')][_0x4fd7('0x27')](_0x1aa2cb)[_0x4fd7('0x2d')](function(_0xaa01fa){_0x316fa2[_0x4fd7('0x27')]=_0xaa01fa;if(_0x2bebd9['query']['includeAll']){_0x2b422b[_0x4fd7('0x48')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x4fd7('0x49')](_0x2b422b);})[_0x4fd7('0x2d')](function(_0x38b204){_0x316fa2[_0x4fd7('0x4a')]=_0x38b204;return _0x316fa2;})[_0x4fd7('0x2d')](respondWithFilteredResult(_0x2a048a,_0x2b422b))[_0x4fd7('0x4b')](handleError(_0x2a048a,null));};exports[_0x4fd7('0x4c')]=function(_0x23a632,_0x5465e6){var _0x59e980={'raw':!![],'where':{'id':_0x23a632[_0x4fd7('0x4d')]['id']}},_0x582d1c={};_0x582d1c[_0x4fd7('0x37')]=_[_0x4fd7('0x3a')](db[_0x4fd7('0x47')][_0x4fd7('0x4e')]);_0x582d1c[_0x4fd7('0x39')]=_['keys'](_0x23a632['query']);_0x582d1c[_0x4fd7('0x3b')]=_['intersection'](_0x582d1c[_0x4fd7('0x37')],_0x582d1c[_0x4fd7('0x39')]);_0x59e980['attributes']=_[_0x4fd7('0x3c')](_0x582d1c[_0x4fd7('0x37')],qs['fields'](_0x23a632[_0x4fd7('0x39')]['fields']));_0x59e980[_0x4fd7('0x3e')]=_0x59e980['attributes'][_0x4fd7('0x4f')]?_0x59e980['attributes']:_0x582d1c['model'];if(_0x23a632[_0x4fd7('0x39')][_0x4fd7('0x50')]){_0x59e980[_0x4fd7('0x48')]=[{'all':!![]}];}_0x59e980=_[_0x4fd7('0x44')]({},_0x59e980,_0x23a632['options']);return db['OpenchannelQueue']['find'](_0x59e980)[_0x4fd7('0x2d')](handleEntityNotFound(_0x5465e6,null))[_0x4fd7('0x2d')](respondWithResult(_0x5465e6,null))['catch'](handleError(_0x5465e6,null));};exports[_0x4fd7('0x51')]=function(_0x21a462,_0x5b1544){return db[_0x4fd7('0x47')]['create'](_0x21a462[_0x4fd7('0x52')],{})[_0x4fd7('0x2d')](function(_0x2a1d9c){var _0x2a7764=_0x21a462[_0x4fd7('0x53')][_0x4fd7('0x54')]({'plain':!![]});if(!_0x2a7764)throw new Error(_0x4fd7('0x55'));if(_0x2a7764['role']===_0x4fd7('0x53')){var _0xaa14b6=_0x2a1d9c[_0x4fd7('0x54')]({'plain':!![]});var _0x22b1e7=_0x4fd7('0x2e');return db[_0x4fd7('0x56')][_0x4fd7('0x57')]({'where':{'name':_0x22b1e7,'userProfileId':_0x2a7764[_0x4fd7('0x58')]},'raw':!![]})['then'](function(_0x352ed1){if(_0x352ed1&&_0x352ed1[_0x4fd7('0x59')]===0x0){return db[_0x4fd7('0x2f')][_0x4fd7('0x51')]({'name':_0xaa14b6[_0x4fd7('0x33')],'resourceId':_0xaa14b6['id'],'type':_0x352ed1[_0x4fd7('0x33')],'sectionId':_0x352ed1['id']},{})['then'](function(){return _0x2a1d9c;});}else{return _0x2a1d9c;}})['catch'](function(_0x28f53c){logger[_0x4fd7('0x31')](_0x4fd7('0x5a'),_0x28f53c);throw _0x28f53c;});}return _0x2a1d9c;})[_0x4fd7('0x2d')](respondWithResult(_0x5b1544,0xc9))[_0x4fd7('0x4b')](handleError(_0x5b1544,null));};exports[_0x4fd7('0x5b')]=function(_0x57d3a5,_0x1e1b35){if(_0x57d3a5[_0x4fd7('0x52')]['id']){delete _0x57d3a5['body']['id'];}return db[_0x4fd7('0x47')]['find']({'where':{'id':_0x57d3a5[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x1e1b35,null))[_0x4fd7('0x2d')](saveUpdates(_0x57d3a5[_0x4fd7('0x52')],null))['then'](respondWithResult(_0x1e1b35,null))[_0x4fd7('0x4b')](handleError(_0x1e1b35,null));};exports[_0x4fd7('0x2c')]=function(_0x45a788,_0x13ca1d){return db[_0x4fd7('0x47')][_0x4fd7('0x57')]({'where':{'id':_0x45a788['params']['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x13ca1d,null))['then'](removeEntity(_0x13ca1d,null))['catch'](handleError(_0x13ca1d,null));};exports[_0x4fd7('0x5c')]=function(_0x3eac20,_0x3bd378){return db[_0x4fd7('0x47')][_0x4fd7('0x5c')]()['then'](respondWithResult(_0x3bd378,null))[_0x4fd7('0x4b')](handleError(_0x3bd378,null));};exports[_0x4fd7('0x5d')]=function(_0x161284,_0x48f033,_0x27fc7d){var _0x11f35b={'raw':!![],'where':{}},_0x2f159a={},_0x3de429;return db['OpenchannelQueue'][_0x4fd7('0x5e')]({'where':{'id':_0x161284[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x48f033,null))[_0x4fd7('0x2d')](function(_0x4b7a54){if(_0x4b7a54){_0x3de429=_0x4b7a54[_0x4fd7('0x54')]({'plain':!![]});_0x2f159a[_0x4fd7('0x37')]=_[_0x4fd7('0x3a')](db['UserOpenchannelQueue'][_0x4fd7('0x4e')]);_0x2f159a[_0x4fd7('0x39')]=_[_0x4fd7('0x3a')](_0x161284[_0x4fd7('0x39')]);_0x2f159a[_0x4fd7('0x3b')]=_[_0x4fd7('0x3c')](_0x2f159a['model'],_0x2f159a['query']);_0x11f35b[_0x4fd7('0x3e')]=_['intersection'](_0x2f159a[_0x4fd7('0x37')],qs[_0x4fd7('0x3d')](_0x161284[_0x4fd7('0x39')][_0x4fd7('0x3d')]));_0x11f35b['attributes']=_0x11f35b[_0x4fd7('0x3e')][_0x4fd7('0x4f')]?_0x11f35b[_0x4fd7('0x3e')]:_0x2f159a[_0x4fd7('0x37')];if(!_0x161284[_0x4fd7('0x39')][_0x4fd7('0x5f')](_0x4fd7('0x3f'))){_0x11f35b[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x161284['query'][_0x4fd7('0x26')]);_0x11f35b[_0x4fd7('0x24')]=qs['offset'](_0x161284[_0x4fd7('0x39')]['offset']);}_0x11f35b[_0x4fd7('0x60')]=qs[_0x4fd7('0x40')](_0x161284['query'][_0x4fd7('0x40')]);_0x11f35b[_0x4fd7('0x41')]=qs[_0x4fd7('0x3b')](_[_0x4fd7('0x42')](_0x161284['query'],_0x2f159a['filters']));_0x11f35b[_0x4fd7('0x41')][_0x4fd7('0x61')]=_0x4b7a54['id'];if(_0x161284[_0x4fd7('0x39')][_0x4fd7('0x43')]){_0x11f35b['where']=_[_0x4fd7('0x44')](_0x11f35b[_0x4fd7('0x41')],{'$or':_[_0x4fd7('0x38')](_0x11f35b[_0x4fd7('0x3e')],function(_0x2c6dae){var _0x388890={};_0x388890[_0x2c6dae]={'$like':'%'+_0x161284[_0x4fd7('0x39')][_0x4fd7('0x43')]+'%'};return _0x388890;})});}_0x11f35b=_[_0x4fd7('0x44')]({},_0x11f35b,_0x161284[_0x4fd7('0x46')]);return db[_0x4fd7('0x62')][_0x4fd7('0x49')](_0x11f35b);}})[_0x4fd7('0x2d')](function(_0x12e30d){if(_0x12e30d){return db[_0x4fd7('0x63')]['findAndCountAll']({'where':{'id':_[_0x4fd7('0x38')](_0x12e30d,_0x4fd7('0x64')),'role':_0x4fd7('0x65')},'attributes':['id',_0x4fd7('0x33'),_0x4fd7('0x66'),_0x4fd7('0x67'),_0x4fd7('0x68')]});}})[_0x4fd7('0x2d')](function(_0x711055){if(_0x711055){return{'count':_0x711055[_0x4fd7('0x27')],'rows':_['map'](_0x711055[_0x4fd7('0x4a')],function(_0x5cf75e){return{'membername':_0x5cf75e['name'],'UserId':_0x5cf75e['id'],'queue_name':_0x3de429[_0x4fd7('0x33')],'OpenchannelQueueId':_0x3de429['id'],'interface':util['format'](_0x4fd7('0x69'),'SIP',_0x5cf75e[_0x4fd7('0x33')]),'penalty':0x0,'paused':_0x5cf75e[_0x4fd7('0x66')],'createdAt':_0x5cf75e['createdAt'],'updatedAt':_0x5cf75e[_0x4fd7('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x48f033,_0x11f35b))[_0x4fd7('0x4b')](handleError(_0x48f033,null));};exports[_0x4fd7('0x6a')]=function(_0x263626,_0x3bb041,_0x5a27aa){var _0x11a462={};var _0x2e0eb3={};var _0x4c389f;var _0x5ca773;return db[_0x4fd7('0x47')]['findOne']({'where':{'id':_0x263626[_0x4fd7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bb041,null))[_0x4fd7('0x2d')](function(_0x470ae0){if(_0x470ae0){_0x4c389f=_0x470ae0;_0x2e0eb3[_0x4fd7('0x37')]=_['keys'](db[_0x4fd7('0x6b')][_0x4fd7('0x4e')]);_0x2e0eb3['query']=_['keys'](_0x263626[_0x4fd7('0x39')]);_0x2e0eb3[_0x4fd7('0x3b')]=_[_0x4fd7('0x3c')](_0x2e0eb3['model'],_0x2e0eb3[_0x4fd7('0x39')]);_0x11a462[_0x4fd7('0x3e')]=_[_0x4fd7('0x3c')](_0x2e0eb3[_0x4fd7('0x37')],qs[_0x4fd7('0x3d')](_0x263626[_0x4fd7('0x39')]['fields']));_0x11a462[_0x4fd7('0x3e')]=_0x11a462[_0x4fd7('0x3e')][_0x4fd7('0x4f')]?_0x11a462[_0x4fd7('0x3e')]:_0x2e0eb3[_0x4fd7('0x37')];_0x11a462['order']=qs['sort'](_0x263626['query'][_0x4fd7('0x40')]);_0x11a462[_0x4fd7('0x41')]=qs['filters'](_[_0x4fd7('0x42')](_0x263626['query'],_0x2e0eb3[_0x4fd7('0x3b')]));if(_0x263626[_0x4fd7('0x39')][_0x4fd7('0x43')]){_0x11a462[_0x4fd7('0x41')]=_[_0x4fd7('0x44')](_0x11a462[_0x4fd7('0x41')],{'$or':_[_0x4fd7('0x38')](_0x11a462[_0x4fd7('0x3e')],function(_0x5939bd){var _0x182516={};_0x182516[_0x5939bd]={'$like':'%'+_0x263626['query'][_0x4fd7('0x43')]+'%'};return _0x182516;})});}_0x11a462=_[_0x4fd7('0x44')]({},_0x11a462,_0x263626['options']);return _0x4c389f[_0x4fd7('0x6a')](_0x11a462);}})['then'](function(_0x4bf0b4){if(_0x4bf0b4){_0x5ca773=_0x4bf0b4[_0x4fd7('0x4f')];if(!_0x263626[_0x4fd7('0x39')][_0x4fd7('0x5f')](_0x4fd7('0x3f'))){_0x11a462[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x263626[_0x4fd7('0x39')][_0x4fd7('0x26')]);_0x11a462['offset']=qs[_0x4fd7('0x24')](_0x263626[_0x4fd7('0x39')][_0x4fd7('0x24')]);}return _0x4c389f['getTeams'](_0x11a462);}})[_0x4fd7('0x2d')](function(_0x2a0058){if(_0x2a0058){return _0x2a0058?{'count':_0x5ca773,'rows':_0x2a0058}:null;}})['then'](respondWithResult(_0x3bb041,null))[_0x4fd7('0x4b')](handleError(_0x3bb041,null));};exports[_0x4fd7('0x6c')]=function(_0x11e1d9,_0x59bb76,_0x5e10a1){var _0xfdeb2b=_0x11e1d9[_0x4fd7('0x52')][_0x4fd7('0x6d')];return db[_0x4fd7('0x6b')][_0x4fd7('0x49')]({'where':{'id':_0xfdeb2b},'attributes':['id'],'include':[{'model':db[_0x4fd7('0x63')],'as':_0x4fd7('0x6e'),'attributes':['id',_0x4fd7('0x33'),_0x4fd7('0x6f'),'voicePause',_0x4fd7('0x70')],'raw':!![]}]})[_0x4fd7('0x2d')](function(_0x565e85){if(_0x565e85){var _0x36f391=_['flatMap'](_0x565e85,function(_0x558638){var _0x4e56aa=_0x558638[_0x4fd7('0x54')]({'plain':!![]});return _0x4e56aa['Agents'];});return db[_0x4fd7('0x47')]['find']({'where':{'id':_0x11e1d9[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](function(_0x202de4){return db[_0x4fd7('0x71')][_0x4fd7('0x72')](function(_0x5dac5a){return _0x202de4[_0x4fd7('0x6c')](_0xfdeb2b,{'transaction':_0x5dac5a})[_0x4fd7('0x2d')](function(){return BPromise[_0x4fd7('0x73')](_0x36f391,function(_0x2391cf){return db[_0x4fd7('0x62')][_0x4fd7('0x74')]({'where':{'UserId':_0x2391cf['id'],'OpenchannelQueueId':_0x11e1d9[_0x4fd7('0x4d')]['id']},'transaction':_0x5dac5a});});})[_0x4fd7('0x2d')](function(){_0x36f391['forEach'](function(_0x49e702){socket[_0x4fd7('0x75')]('userOpenchannelQueue:save',{'UserId':_0x49e702['id'],'OpenchannelQueueId':_0x202de4['id']});});});});});}})['then'](respondWithStatusCode(_0x59bb76,null))[_0x4fd7('0x4b')](handleError(_0x59bb76,null));};exports[_0x4fd7('0x76')]=function(_0x2bce3a,_0x4469ff,_0x429b9c){return db[_0x4fd7('0x6b')][_0x4fd7('0x49')]({'where':{'id':_0x2bce3a[_0x4fd7('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4fd7('0x63')],'as':_0x4fd7('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x4fd7('0x2d')](handleEntityNotFound(_0x4469ff,null))[_0x4fd7('0x2d')](function(_0x1f79f3){var _0x51f929=_[_0x4fd7('0x38')](_0x1f79f3,'id');var _0x1e82e6=[];var _0x2d77e6=[];var _0x23c37e=squel[_0x4fd7('0x77')]();_0x23c37e[_0x4fd7('0x78')](_0x4fd7('0x79'))[_0x4fd7('0x7a')](_0x4fd7('0x7b'),'tq')[_0x4fd7('0x7c')](_0x4fd7('0x7d'),'ut',_0x4fd7('0x7e'))[_0x4fd7('0x41')](_0x4fd7('0x7f'),_0x2bce3a[_0x4fd7('0x4d')]['id']);for(var _0x26d034=0x0;_0x26d034<_0x1f79f3[_0x4fd7('0x4f')];_0x26d034+=0x1){let _0x13b1f9=_0x1f79f3[_0x26d034];for(var _0xbb3a8=0x0;_0xbb3a8<_0x13b1f9['Agents'][_0x4fd7('0x4f')];_0xbb3a8+=0x1){let _0x22c100=_0x13b1f9['Agents'][_0xbb3a8];var _0x20dcbf=_0x23c37e['clone']();_0x20dcbf['where'](_0x4fd7('0x80'),_0x22c100['id']);_0x2d77e6[_0x4fd7('0x81')](db[_0x4fd7('0x71')][_0x4fd7('0x39')](_0x20dcbf[_0x4fd7('0x82')](),{'type':db[_0x4fd7('0x71')][_0x4fd7('0x83')][_0x4fd7('0x84')]})[_0x4fd7('0x2d')](function(_0x1faef9){if(_0x1faef9[_0x4fd7('0x4f')]===0x1){return _0x22c100['id'];}else{var _0x2d7dca=_[_0x4fd7('0x85')](_[_0x4fd7('0x38')](_0x1faef9,'TeamId'),function(_0x3e2ef3){return _['includes'](_0x51f929,_0x3e2ef3);});if(_0x2d7dca){return _0x22c100['id'];}}}));}}return BPromise[_0x4fd7('0x86')](_0x2d77e6)[_0x4fd7('0x2d')](function(_0x38ae16){_0x1e82e6=_(_0x1e82e6)[_0x4fd7('0x87')](_0x38ae16)[_0x4fd7('0x88')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x2bce3a[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](function(_0x3d04f9){return db['sequelize'][_0x4fd7('0x72')](function(_0x4bdddf){return _0x3d04f9['removeTeams'](_0x2bce3a['query'][_0x4fd7('0x6d')],{'transaction':_0x4bdddf})[_0x4fd7('0x2d')](function(){if(!_[_0x4fd7('0x89')](_0x1e82e6)){return _0x3d04f9['removeAgents'](_0x1e82e6,{'transaction':_0x4bdddf});}})[_0x4fd7('0x2d')](function(){_0x1e82e6[_0x4fd7('0x8a')](function(_0x301431){socket[_0x4fd7('0x75')]('userOpenchannelQueue:remove',{'UserId':_0x301431,'OpenchannelQueueId':_0x3d04f9['id']});});});});});});})['then'](respondWithStatusCode(_0x4469ff,null))[_0x4fd7('0x4b')](handleError(_0x4469ff,null));};exports['addAgents']=function(_0x5ec3bc,_0x41b9fa,_0x544081){return db[_0x4fd7('0x47')][_0x4fd7('0x57')]({'where':{'id':_0x5ec3bc['params']['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x41b9fa,null))[_0x4fd7('0x2d')](function(_0x5cfe37){if(_0x5cfe37){return _0x5cfe37['addAgents'](_0x5ec3bc[_0x4fd7('0x52')]['ids'],_[_0x4fd7('0x8b')](_0x5ec3bc[_0x4fd7('0x52')],[_0x4fd7('0x6d'),'id'])||{})[_0x4fd7('0x8c')](function(_0x37a1e6){for(var _0x365cfa=0x0;_0x365cfa<_0x5ec3bc[_0x4fd7('0x52')]['ids']['length'];_0x365cfa+=0x1){socket[_0x4fd7('0x75')]('userOpenchannelQueue:save',{'UserId':Number(_0x5ec3bc[_0x4fd7('0x52')][_0x4fd7('0x6d')][_0x365cfa]),'OpenchannelQueueId':Number(_0x5ec3bc[_0x4fd7('0x4d')]['id'])});}return _0x37a1e6;});}})['then'](respondWithResult(_0x41b9fa,null))[_0x4fd7('0x4b')](handleError(_0x41b9fa,null));};exports[_0x4fd7('0x8d')]=function(_0x4a2899,_0x57625c,_0x15986c){return db[_0x4fd7('0x47')]['find']({'where':{'id':_0x4a2899[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x57625c,null))[_0x4fd7('0x2d')](function(_0x7e4453){if(_0x7e4453){return _0x7e4453[_0x4fd7('0x8d')](_0x4a2899['query'][_0x4fd7('0x6d')])['then'](function(){if(_[_0x4fd7('0x8e')](_0x4a2899[_0x4fd7('0x39')][_0x4fd7('0x6d')])){for(var _0x11b3da=0x0;_0x11b3da<_0x4a2899[_0x4fd7('0x39')]['ids'][_0x4fd7('0x4f')];_0x11b3da+=0x1){socket[_0x4fd7('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4a2899['query'][_0x4fd7('0x6d')][_0x11b3da]),'OpenchannelQueueId':Number(_0x4a2899[_0x4fd7('0x4d')]['id'])});}}else{socket[_0x4fd7('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4a2899[_0x4fd7('0x39')][_0x4fd7('0x6d')]),'OpenchannelQueueId':Number(_0x4a2899[_0x4fd7('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x57625c,null))[_0x4fd7('0x4b')](handleError(_0x57625c,null));};exports[_0x4fd7('0x8f')]=function(_0x354462,_0x4788e9,_0x230b35){var _0x409703={};var _0xc6fe3e={};var _0x3f97c4;var _0x2cabe1;return db[_0x4fd7('0x47')][_0x4fd7('0x5e')]({'where':{'id':_0x354462[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x4788e9,null))[_0x4fd7('0x2d')](function(_0x3bd5e1){if(_0x3bd5e1){_0x3f97c4=_0x3bd5e1;_0xc6fe3e[_0x4fd7('0x37')]=_[_0x4fd7('0x3a')](db['User'][_0x4fd7('0x4e')]);_0xc6fe3e[_0x4fd7('0x39')]=_[_0x4fd7('0x3a')](_0x354462[_0x4fd7('0x39')]);_0xc6fe3e['filters']=_[_0x4fd7('0x3c')](_0xc6fe3e[_0x4fd7('0x37')],_0xc6fe3e['query']);_0x409703[_0x4fd7('0x3e')]=_[_0x4fd7('0x3c')](_0xc6fe3e['model'],qs['fields'](_0x354462[_0x4fd7('0x39')][_0x4fd7('0x3d')]));_0x409703['attributes']=_0x409703['attributes'][_0x4fd7('0x4f')]?_0x409703['attributes']:_0xc6fe3e[_0x4fd7('0x37')];_0x409703['order']=qs['sort'](_0x354462[_0x4fd7('0x39')]['sort']);_0x409703['where']=qs[_0x4fd7('0x3b')](_['pick'](_0x354462[_0x4fd7('0x39')],_0xc6fe3e[_0x4fd7('0x3b')]));if(_0x354462[_0x4fd7('0x39')]['filter']){_0x409703[_0x4fd7('0x41')]=_[_0x4fd7('0x44')](_0x409703[_0x4fd7('0x41')],{'$or':_[_0x4fd7('0x38')](_0x409703[_0x4fd7('0x3e')],function(_0x367aa8){var _0x2c0270={};_0x2c0270[_0x367aa8]={'$like':'%'+_0x354462[_0x4fd7('0x39')][_0x4fd7('0x43')]+'%'};return _0x2c0270;})});}_0x409703=_[_0x4fd7('0x44')]({},_0x409703,_0x354462[_0x4fd7('0x46')]);return _0x3f97c4[_0x4fd7('0x8f')](_0x409703);}})[_0x4fd7('0x2d')](function(_0x105e45){if(_0x105e45){_0x2cabe1=_0x105e45['length'];if(!_0x354462['query'][_0x4fd7('0x5f')](_0x4fd7('0x3f'))){_0x409703[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x354462['query'][_0x4fd7('0x26')]);_0x409703[_0x4fd7('0x24')]=qs[_0x4fd7('0x24')](_0x354462[_0x4fd7('0x39')][_0x4fd7('0x24')]);}return _0x3f97c4[_0x4fd7('0x8f')](_0x409703);}})['then'](function(_0x1ae869){if(_0x1ae869){return _0x1ae869?{'count':_0x2cabe1,'rows':_0x1ae869}:null;}})[_0x4fd7('0x2d')](respondWithResult(_0x4788e9,null))[_0x4fd7('0x4b')](handleError(_0x4788e9,null));}; \ No newline at end of file +var _0xb719=['from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','OpenchannelQueues','UserProfileResource','stack','send','index','map','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','findOne','Team','pick','getTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0xb719,0x1ce));var _0x9b71=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xb719[_0x5d7227];return _0x15ac55;};'use strict';var emlformat=require(_0x9b71('0x0'));var rimraf=require(_0x9b71('0x1'));var zipdir=require(_0x9b71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b71('0x3'));var moment=require(_0x9b71('0x4'));var BPromise=require(_0x9b71('0x5'));var Mustache=require(_0x9b71('0x6'));var util=require(_0x9b71('0x7'));var path=require(_0x9b71('0x8'));var sox=require(_0x9b71('0x9'));var csv=require('to-csv');var ejs=require(_0x9b71('0xa'));var fs=require('fs');var fs_extra=require(_0x9b71('0xb'));var _=require(_0x9b71('0xc'));var squel=require(_0x9b71('0xd'));var crypto=require(_0x9b71('0xe'));var jsforce=require(_0x9b71('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9b71('0x10'));var querystring=require(_0x9b71('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9b71('0x12'));var qs=require(_0x9b71('0x13'));var as=require(_0x9b71('0x14'));var hardwareService=require(_0x9b71('0x15'));var logger=require(_0x9b71('0x16'))(_0x9b71('0x17'));var utils=require(_0x9b71('0x18'));var config=require(_0x9b71('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b71('0x1a'))['db'];config[_0x9b71('0x1b')]=_[_0x9b71('0x1c')](config[_0x9b71('0x1b')],{'host':_0x9b71('0x1d'),'port':0x18eb});var socket=require(_0x9b71('0x1e'))(new Redis(config[_0x9b71('0x1b')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x206f09,_0x30c2e5){_0x30c2e5=_0x30c2e5||0xcc;return function(_0x544b7f){if(_0x544b7f){return _0x206f09[_0x9b71('0x1f')](_0x30c2e5);}return _0x206f09[_0x9b71('0x20')](_0x30c2e5)[_0x9b71('0x21')]();};}function respondWithResult(_0x185ad9,_0xf0df4a){_0xf0df4a=_0xf0df4a||0xc8;return function(_0x40d27c){if(_0x40d27c){return _0x185ad9[_0x9b71('0x20')](_0xf0df4a)[_0x9b71('0x22')](_0x40d27c);}};}function respondWithFilteredResult(_0x3ad8ff,_0xf934){return function(_0x3ceeee){if(_0x3ceeee){var _0x39f376=typeof _0xf934[_0x9b71('0x23')]===_0x9b71('0x24')&&typeof _0xf934[_0x9b71('0x25')]===_0x9b71('0x24');var _0x4f14cc=_0x3ceeee['count'];var _0x554eb7=_0x39f376?0x0:_0xf934[_0x9b71('0x23')];var _0x317788=_0x39f376?_0x3ceeee[_0x9b71('0x26')]:_0xf934[_0x9b71('0x23')]+_0xf934['limit'];var _0x5d3b0a;if(_0x317788>=_0x4f14cc){_0x317788=_0x4f14cc;_0x5d3b0a=0xc8;}else{_0x5d3b0a=0xce;}_0x3ad8ff[_0x9b71('0x20')](_0x5d3b0a);return _0x3ad8ff[_0x9b71('0x27')](_0x9b71('0x28'),_0x554eb7+'-'+_0x317788+'/'+_0x4f14cc)[_0x9b71('0x22')](_0x3ceeee);}return null;};}function patchUpdates(_0x1d0524){return function(_0x4d1ba0){try{jsonpatch[_0x9b71('0x29')](_0x4d1ba0,_0x1d0524,!![]);}catch(_0x2060ce){return BPromise[_0x9b71('0x2a')](_0x2060ce);}return _0x4d1ba0[_0x9b71('0x2b')]();};}function saveUpdates(_0x2cb78a,_0x542871){return function(_0xbfc3b1){if(_0xbfc3b1){return _0xbfc3b1['update'](_0x2cb78a)['then'](function(_0x433ddc){return _0x433ddc;});}return null;};}function removeEntity(_0x2d1405,_0x1a1e34){return function(_0x421bce){if(_0x421bce){return _0x421bce[_0x9b71('0x2c')]()[_0x9b71('0x2d')](function(){var _0x45c7a9=_0x421bce[_0x9b71('0x2e')]({'plain':!![]});var _0x2dbbe2=_0x9b71('0x2f');return db[_0x9b71('0x30')][_0x9b71('0x2c')]({'where':{'type':_0x2dbbe2,'resourceId':_0x45c7a9['id']}})[_0x9b71('0x2d')](function(){return _0x421bce;});})[_0x9b71('0x2d')](function(){_0x2d1405[_0x9b71('0x20')](0xcc)[_0x9b71('0x21')]();});}};}function handleEntityNotFound(_0x127879,_0x427b74){return function(_0x50ea25){if(!_0x50ea25){_0x127879[_0x9b71('0x1f')](0x194);}return _0x50ea25;};}function handleError(_0x132544,_0xb95ca6){_0xb95ca6=_0xb95ca6||0x1f4;return function(_0xf079e0){logger['error'](_0xf079e0[_0x9b71('0x31')]);if(_0xf079e0['name']){delete _0xf079e0['name'];}_0x132544[_0x9b71('0x20')](_0xb95ca6)[_0x9b71('0x32')](_0xf079e0);};}exports[_0x9b71('0x33')]=function(_0x28458c,_0x1a0b58){var _0x16ddec={},_0x2efb44={},_0x3fcc46={'count':0x0,'rows':[]};var _0x60c045=_[_0x9b71('0x34')](db['OpenchannelQueue'][_0x9b71('0x35')],function(_0x327041){return{'name':_0x327041[_0x9b71('0x36')],'type':_0x327041['type']['key']};});_0x2efb44[_0x9b71('0x37')]=_[_0x9b71('0x34')](_0x60c045,_0x9b71('0x38'));_0x2efb44[_0x9b71('0x39')]=_[_0x9b71('0x3a')](_0x28458c['query']);_0x2efb44[_0x9b71('0x3b')]=_[_0x9b71('0x3c')](_0x2efb44['model'],_0x2efb44['query']);_0x16ddec[_0x9b71('0x3d')]=_[_0x9b71('0x3c')](_0x2efb44['model'],qs['fields'](_0x28458c['query'][_0x9b71('0x3e')]));_0x16ddec[_0x9b71('0x3d')]=_0x16ddec[_0x9b71('0x3d')]['length']?_0x16ddec[_0x9b71('0x3d')]:_0x2efb44[_0x9b71('0x37')];if(!_0x28458c[_0x9b71('0x39')]['hasOwnProperty'](_0x9b71('0x3f'))){_0x16ddec['limit']=qs[_0x9b71('0x25')](_0x28458c[_0x9b71('0x39')][_0x9b71('0x25')]);_0x16ddec['offset']=qs[_0x9b71('0x23')](_0x28458c[_0x9b71('0x39')][_0x9b71('0x23')]);}_0x16ddec[_0x9b71('0x40')]=qs[_0x9b71('0x41')](_0x28458c['query'][_0x9b71('0x41')]);_0x16ddec['where']=qs[_0x9b71('0x3b')](_['pick'](_0x28458c[_0x9b71('0x39')],_0x2efb44[_0x9b71('0x3b')]),_0x60c045);if(_0x28458c[_0x9b71('0x39')][_0x9b71('0x42')]){_0x16ddec['where']=_[_0x9b71('0x43')](_0x16ddec[_0x9b71('0x44')],{'$or':_['map'](_0x60c045,function(_0x113081){if(_0x113081[_0x9b71('0x45')]!==_0x9b71('0x46')){var _0x24a9b0={};_0x24a9b0[_0x113081[_0x9b71('0x38')]]={'$like':'%'+_0x28458c['query'][_0x9b71('0x42')]+'%'};return _0x24a9b0;}})});}_0x16ddec=_[_0x9b71('0x43')]({},_0x16ddec,_0x28458c[_0x9b71('0x47')]);var _0x1813b8={'where':_0x16ddec[_0x9b71('0x44')]};return db[_0x9b71('0x48')][_0x9b71('0x26')](_0x1813b8)[_0x9b71('0x2d')](function(_0x1d0a9a){_0x3fcc46[_0x9b71('0x26')]=_0x1d0a9a;if(_0x28458c[_0x9b71('0x39')][_0x9b71('0x49')]){_0x16ddec[_0x9b71('0x4a')]=[{'all':!![]}];}return db[_0x9b71('0x48')][_0x9b71('0x4b')](_0x16ddec);})[_0x9b71('0x2d')](function(_0x30c60e){_0x3fcc46[_0x9b71('0x4c')]=_0x30c60e;return _0x3fcc46;})[_0x9b71('0x2d')](respondWithFilteredResult(_0x1a0b58,_0x16ddec))[_0x9b71('0x4d')](handleError(_0x1a0b58,null));};exports[_0x9b71('0x4e')]=function(_0x2568b0,_0x46ba6c){var _0x32237e={'raw':!![],'where':{'id':_0x2568b0[_0x9b71('0x4f')]['id']}},_0x141ed5={};_0x141ed5[_0x9b71('0x37')]=_[_0x9b71('0x3a')](db['OpenchannelQueue'][_0x9b71('0x35')]);_0x141ed5[_0x9b71('0x39')]=_['keys'](_0x2568b0['query']);_0x141ed5['filters']=_['intersection'](_0x141ed5[_0x9b71('0x37')],_0x141ed5[_0x9b71('0x39')]);_0x32237e[_0x9b71('0x3d')]=_[_0x9b71('0x3c')](_0x141ed5[_0x9b71('0x37')],qs[_0x9b71('0x3e')](_0x2568b0['query'][_0x9b71('0x3e')]));_0x32237e[_0x9b71('0x3d')]=_0x32237e[_0x9b71('0x3d')][_0x9b71('0x50')]?_0x32237e[_0x9b71('0x3d')]:_0x141ed5[_0x9b71('0x37')];if(_0x2568b0['query'][_0x9b71('0x49')]){_0x32237e[_0x9b71('0x4a')]=[{'all':!![]}];}_0x32237e=_[_0x9b71('0x43')]({},_0x32237e,_0x2568b0['options']);return db[_0x9b71('0x48')][_0x9b71('0x51')](_0x32237e)['then'](handleEntityNotFound(_0x46ba6c,null))[_0x9b71('0x2d')](respondWithResult(_0x46ba6c,null))[_0x9b71('0x4d')](handleError(_0x46ba6c,null));};exports['create']=function(_0x442a17,_0x3a2e4b){return db[_0x9b71('0x48')][_0x9b71('0x52')](_0x442a17[_0x9b71('0x53')],{})[_0x9b71('0x2d')](function(_0x592b0d){var _0x596335=_0x442a17[_0x9b71('0x54')][_0x9b71('0x2e')]({'plain':!![]});if(!_0x596335)throw new Error(_0x9b71('0x55'));if(_0x596335['role']===_0x9b71('0x54')){var _0xd3d050=_0x592b0d['get']({'plain':!![]});var _0x52167c=_0x9b71('0x2f');return db['UserProfileSection'][_0x9b71('0x51')]({'where':{'name':_0x52167c,'userProfileId':_0x596335[_0x9b71('0x56')]},'raw':!![]})['then'](function(_0x35549f){if(_0x35549f&&_0x35549f[_0x9b71('0x57')]===0x0){return db[_0x9b71('0x30')]['create']({'name':_0xd3d050[_0x9b71('0x38')],'resourceId':_0xd3d050['id'],'type':_0x35549f[_0x9b71('0x38')],'sectionId':_0x35549f['id']},{})['then'](function(){return _0x592b0d;});}else{return _0x592b0d;}})[_0x9b71('0x4d')](function(_0x42edc3){logger['error'](_0x9b71('0x58'),_0x42edc3);throw _0x42edc3;});}return _0x592b0d;})[_0x9b71('0x2d')](respondWithResult(_0x3a2e4b,0xc9))[_0x9b71('0x4d')](handleError(_0x3a2e4b,null));};exports[_0x9b71('0x59')]=function(_0x2f11bf,_0xab8b59){if(_0x2f11bf['body']['id']){delete _0x2f11bf[_0x9b71('0x53')]['id'];}return db['OpenchannelQueue'][_0x9b71('0x51')]({'where':{'id':_0x2f11bf[_0x9b71('0x4f')]['id']}})[_0x9b71('0x2d')](handleEntityNotFound(_0xab8b59,null))['then'](saveUpdates(_0x2f11bf['body'],null))['then'](respondWithResult(_0xab8b59,null))[_0x9b71('0x4d')](handleError(_0xab8b59,null));};exports[_0x9b71('0x2c')]=function(_0x447497,_0xa20c9c){return db['OpenchannelQueue'][_0x9b71('0x51')]({'where':{'id':_0x447497[_0x9b71('0x4f')]['id']}})[_0x9b71('0x2d')](handleEntityNotFound(_0xa20c9c,null))[_0x9b71('0x2d')](removeEntity(_0xa20c9c,null))[_0x9b71('0x4d')](handleError(_0xa20c9c,null));};exports[_0x9b71('0x5a')]=function(_0xdf0e4d,_0x21af13){return db[_0x9b71('0x48')][_0x9b71('0x5a')]()['then'](respondWithResult(_0x21af13,null))['catch'](handleError(_0x21af13,null));};exports['getMembers']=function(_0x58c691,_0x3d6a10,_0x3ae477){var _0x3379f1={'raw':!![],'where':{}},_0x1fcb2f={},_0x14ea17;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x58c691[_0x9b71('0x4f')]['id']}})[_0x9b71('0x2d')](handleEntityNotFound(_0x3d6a10,null))['then'](function(_0x35dc9c){if(_0x35dc9c){_0x14ea17=_0x35dc9c[_0x9b71('0x2e')]({'plain':!![]});_0x1fcb2f[_0x9b71('0x37')]=_[_0x9b71('0x3a')](db[_0x9b71('0x5b')][_0x9b71('0x35')]);_0x1fcb2f['query']=_[_0x9b71('0x3a')](_0x58c691[_0x9b71('0x39')]);_0x1fcb2f[_0x9b71('0x3b')]=_[_0x9b71('0x3c')](_0x1fcb2f[_0x9b71('0x37')],_0x1fcb2f['query']);_0x3379f1[_0x9b71('0x3d')]=_[_0x9b71('0x3c')](_0x1fcb2f[_0x9b71('0x37')],qs[_0x9b71('0x3e')](_0x58c691[_0x9b71('0x39')][_0x9b71('0x3e')]));_0x3379f1['attributes']=_0x3379f1['attributes'][_0x9b71('0x50')]?_0x3379f1[_0x9b71('0x3d')]:_0x1fcb2f[_0x9b71('0x37')];if(!_0x58c691[_0x9b71('0x39')][_0x9b71('0x5c')](_0x9b71('0x3f'))){_0x3379f1['limit']=qs[_0x9b71('0x25')](_0x58c691['query'][_0x9b71('0x25')]);_0x3379f1[_0x9b71('0x23')]=qs[_0x9b71('0x23')](_0x58c691['query'][_0x9b71('0x23')]);}_0x3379f1[_0x9b71('0x40')]=qs[_0x9b71('0x41')](_0x58c691[_0x9b71('0x39')][_0x9b71('0x41')]);_0x3379f1[_0x9b71('0x44')]=qs[_0x9b71('0x3b')](_['pick'](_0x58c691[_0x9b71('0x39')],_0x1fcb2f[_0x9b71('0x3b')]));_0x3379f1[_0x9b71('0x44')][_0x9b71('0x5d')]=_0x35dc9c['id'];if(_0x58c691[_0x9b71('0x39')][_0x9b71('0x42')]){_0x3379f1[_0x9b71('0x44')]=_['merge'](_0x3379f1[_0x9b71('0x44')],{'$or':_[_0x9b71('0x34')](_0x3379f1[_0x9b71('0x3d')],function(_0x36c71c){var _0x24c8e9={};_0x24c8e9[_0x36c71c]={'$like':'%'+_0x58c691[_0x9b71('0x39')][_0x9b71('0x42')]+'%'};return _0x24c8e9;})});}_0x3379f1=_['merge']({},_0x3379f1,_0x58c691[_0x9b71('0x47')]);return db['UserOpenchannelQueue']['findAll'](_0x3379f1);}})[_0x9b71('0x2d')](function(_0x5b3f4c){if(_0x5b3f4c){return db[_0x9b71('0x5e')][_0x9b71('0x5f')]({'where':{'id':_[_0x9b71('0x34')](_0x5b3f4c,_0x9b71('0x60')),'role':_0x9b71('0x61')},'attributes':['id',_0x9b71('0x38'),_0x9b71('0x62'),_0x9b71('0x63'),_0x9b71('0x64')]});}})['then'](function(_0x19f769){if(_0x19f769){return{'count':_0x19f769[_0x9b71('0x26')],'rows':_[_0x9b71('0x34')](_0x19f769['rows'],function(_0x577237){return{'membername':_0x577237[_0x9b71('0x38')],'UserId':_0x577237['id'],'queue_name':_0x14ea17[_0x9b71('0x38')],'OpenchannelQueueId':_0x14ea17['id'],'interface':util[_0x9b71('0x65')]('%s/%s','SIP',_0x577237['name']),'penalty':0x0,'paused':_0x577237[_0x9b71('0x62')],'createdAt':_0x577237[_0x9b71('0x64')],'updatedAt':_0x577237[_0x9b71('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9b71('0x2d')](respondWithFilteredResult(_0x3d6a10,_0x3379f1))['catch'](handleError(_0x3d6a10,null));};exports['getTeams']=function(_0x482c80,_0x4789af,_0x9244){var _0x3138b4={};var _0x4e7670={};var _0x58f329;var _0x4ab413;return db[_0x9b71('0x48')][_0x9b71('0x66')]({'where':{'id':_0x482c80[_0x9b71('0x4f')]['id']}})[_0x9b71('0x2d')](handleEntityNotFound(_0x4789af,null))[_0x9b71('0x2d')](function(_0x4e216c){if(_0x4e216c){_0x58f329=_0x4e216c;_0x4e7670[_0x9b71('0x37')]=_[_0x9b71('0x3a')](db[_0x9b71('0x67')][_0x9b71('0x35')]);_0x4e7670[_0x9b71('0x39')]=_[_0x9b71('0x3a')](_0x482c80[_0x9b71('0x39')]);_0x4e7670[_0x9b71('0x3b')]=_[_0x9b71('0x3c')](_0x4e7670[_0x9b71('0x37')],_0x4e7670[_0x9b71('0x39')]);_0x3138b4[_0x9b71('0x3d')]=_[_0x9b71('0x3c')](_0x4e7670[_0x9b71('0x37')],qs['fields'](_0x482c80[_0x9b71('0x39')][_0x9b71('0x3e')]));_0x3138b4[_0x9b71('0x3d')]=_0x3138b4['attributes']['length']?_0x3138b4['attributes']:_0x4e7670['model'];_0x3138b4[_0x9b71('0x40')]=qs['sort'](_0x482c80[_0x9b71('0x39')]['sort']);_0x3138b4['where']=qs['filters'](_[_0x9b71('0x68')](_0x482c80['query'],_0x4e7670[_0x9b71('0x3b')]));if(_0x482c80[_0x9b71('0x39')][_0x9b71('0x42')]){_0x3138b4['where']=_[_0x9b71('0x43')](_0x3138b4[_0x9b71('0x44')],{'$or':_[_0x9b71('0x34')](_0x3138b4['attributes'],function(_0x190197){var _0x862bc4={};_0x862bc4[_0x190197]={'$like':'%'+_0x482c80['query'][_0x9b71('0x42')]+'%'};return _0x862bc4;})});}_0x3138b4=_[_0x9b71('0x43')]({},_0x3138b4,_0x482c80[_0x9b71('0x47')]);return _0x58f329[_0x9b71('0x69')](_0x3138b4);}})[_0x9b71('0x2d')](function(_0x1c72f2){if(_0x1c72f2){_0x4ab413=_0x1c72f2[_0x9b71('0x50')];if(!_0x482c80[_0x9b71('0x39')][_0x9b71('0x5c')](_0x9b71('0x3f'))){_0x3138b4[_0x9b71('0x25')]=qs[_0x9b71('0x25')](_0x482c80[_0x9b71('0x39')][_0x9b71('0x25')]);_0x3138b4['offset']=qs[_0x9b71('0x23')](_0x482c80[_0x9b71('0x39')][_0x9b71('0x23')]);}return _0x58f329[_0x9b71('0x69')](_0x3138b4);}})['then'](function(_0x5a5ccd){if(_0x5a5ccd){return _0x5a5ccd?{'count':_0x4ab413,'rows':_0x5a5ccd}:null;}})['then'](respondWithResult(_0x4789af,null))[_0x9b71('0x4d')](handleError(_0x4789af,null));};exports['addTeams']=function(_0x322547,_0x4dd33d,_0x157404){var _0x4323d4=_0x322547[_0x9b71('0x53')][_0x9b71('0x6a')];return db['Team'][_0x9b71('0x4b')]({'where':{'id':_0x4323d4},'attributes':['id'],'include':[{'model':db[_0x9b71('0x5e')],'as':_0x9b71('0x6b'),'attributes':['id',_0x9b71('0x38'),'online',_0x9b71('0x6c'),_0x9b71('0x6d')],'raw':!![]}]})[_0x9b71('0x2d')](function(_0x54b8ca){if(_0x54b8ca){var _0xe263b6=_[_0x9b71('0x6e')](_0x54b8ca,function(_0x1ec15a){var _0x33f155=_0x1ec15a[_0x9b71('0x2e')]({'plain':!![]});return _0x33f155[_0x9b71('0x6b')];});return db[_0x9b71('0x48')][_0x9b71('0x51')]({'where':{'id':_0x322547[_0x9b71('0x4f')]['id']}})[_0x9b71('0x2d')](function(_0x27c777){return db[_0x9b71('0x6f')][_0x9b71('0x70')](function(_0x17f35e){return _0x27c777['addTeams'](_0x4323d4,{'transaction':_0x17f35e})[_0x9b71('0x2d')](function(){return BPromise[_0x9b71('0x71')](_0xe263b6,function(_0x253cf5){return db[_0x9b71('0x5b')][_0x9b71('0x72')]({'where':{'UserId':_0x253cf5['id'],'OpenchannelQueueId':_0x322547[_0x9b71('0x4f')]['id']},'transaction':_0x17f35e});});})[_0x9b71('0x2d')](function(){_0xe263b6[_0x9b71('0x73')](function(_0x119849){socket[_0x9b71('0x74')](_0x9b71('0x75'),{'UserId':_0x119849['id'],'OpenchannelQueueId':_0x27c777['id']});});});});});}})['then'](respondWithStatusCode(_0x4dd33d,null))[_0x9b71('0x4d')](handleError(_0x4dd33d,null));};exports[_0x9b71('0x76')]=function(_0x5e23d0,_0x49cffa,_0x150e28){return db[_0x9b71('0x67')][_0x9b71('0x4b')]({'where':{'id':_0x5e23d0[_0x9b71('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9b71('0x5e')],'as':_0x9b71('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49cffa,null))[_0x9b71('0x2d')](function(_0x50bf95){var _0x14e24d=_['map'](_0x50bf95,'id');var _0x59b667=[];var _0x257810=[];var _0x5490fb=squel[_0x9b71('0x77')]();_0x5490fb[_0x9b71('0x78')](_0x9b71('0x79'))[_0x9b71('0x7a')](_0x9b71('0x7b'),'tq')['join'](_0x9b71('0x7c'),'ut',_0x9b71('0x7d'))['where'](_0x9b71('0x7e'),_0x5e23d0[_0x9b71('0x4f')]['id']);for(var _0xa62570=0x0;_0xa62570<_0x50bf95[_0x9b71('0x50')];_0xa62570+=0x1){let _0x5dc7a4=_0x50bf95[_0xa62570];for(var _0x5d63ce=0x0;_0x5d63ce<_0x5dc7a4[_0x9b71('0x6b')][_0x9b71('0x50')];_0x5d63ce+=0x1){let _0x53392e=_0x5dc7a4[_0x9b71('0x6b')][_0x5d63ce];var _0x4505bf=_0x5490fb[_0x9b71('0x7f')]();_0x4505bf[_0x9b71('0x44')](_0x9b71('0x80'),_0x53392e['id']);_0x257810['push'](db[_0x9b71('0x6f')][_0x9b71('0x39')](_0x4505bf[_0x9b71('0x81')](),{'type':db['sequelize'][_0x9b71('0x82')][_0x9b71('0x83')]})[_0x9b71('0x2d')](function(_0x3f4787){if(_0x3f4787[_0x9b71('0x50')]===0x1){return _0x53392e['id'];}else{var _0x3531ca=_[_0x9b71('0x84')](_['map'](_0x3f4787,_0x9b71('0x85')),function(_0xd64ad9){return _[_0x9b71('0x86')](_0x14e24d,_0xd64ad9);});if(_0x3531ca){return _0x53392e['id'];}}}));}}return BPromise[_0x9b71('0x87')](_0x257810)[_0x9b71('0x2d')](function(_0x21d889){_0x59b667=_(_0x59b667)[_0x9b71('0x88')](_0x21d889)[_0x9b71('0x89')]()['value']();return db['OpenchannelQueue'][_0x9b71('0x51')]({'where':{'id':_0x5e23d0[_0x9b71('0x4f')]['id']}})['then'](function(_0x539835){return db[_0x9b71('0x6f')]['transaction'](function(_0x837b20){return _0x539835['removeTeams'](_0x5e23d0[_0x9b71('0x39')][_0x9b71('0x6a')],{'transaction':_0x837b20})[_0x9b71('0x2d')](function(){if(!_[_0x9b71('0x8a')](_0x59b667)){return _0x539835[_0x9b71('0x8b')](_0x59b667,{'transaction':_0x837b20});}})[_0x9b71('0x2d')](function(){_0x59b667[_0x9b71('0x73')](function(_0x109ec9){socket[_0x9b71('0x74')](_0x9b71('0x8c'),{'UserId':_0x109ec9,'OpenchannelQueueId':_0x539835['id']});});});});});});})[_0x9b71('0x2d')](respondWithStatusCode(_0x49cffa,null))[_0x9b71('0x4d')](handleError(_0x49cffa,null));};exports[_0x9b71('0x8d')]=function(_0x40f2e1,_0x2315a6,_0x381cdc){return db['OpenchannelQueue']['find']({'where':{'id':_0x40f2e1[_0x9b71('0x4f')]['id']}})[_0x9b71('0x2d')](handleEntityNotFound(_0x2315a6,null))[_0x9b71('0x2d')](function(_0x27fd76){if(_0x27fd76){return _0x27fd76[_0x9b71('0x8d')](_0x40f2e1['body'][_0x9b71('0x6a')],_[_0x9b71('0x8e')](_0x40f2e1[_0x9b71('0x53')],['ids','id'])||{})[_0x9b71('0x8f')](function(_0x416566){for(var _0x1b3cc3=0x0;_0x1b3cc3<_0x40f2e1[_0x9b71('0x53')][_0x9b71('0x6a')][_0x9b71('0x50')];_0x1b3cc3+=0x1){socket[_0x9b71('0x74')](_0x9b71('0x75'),{'UserId':Number(_0x40f2e1[_0x9b71('0x53')][_0x9b71('0x6a')][_0x1b3cc3]),'OpenchannelQueueId':Number(_0x40f2e1['params']['id'])});}return _0x416566;});}})[_0x9b71('0x2d')](respondWithResult(_0x2315a6,null))['catch'](handleError(_0x2315a6,null));};exports['removeAgents']=function(_0x308d8e,_0x538198,_0xec71){return db[_0x9b71('0x48')][_0x9b71('0x51')]({'where':{'id':_0x308d8e[_0x9b71('0x4f')]['id']}})[_0x9b71('0x2d')](handleEntityNotFound(_0x538198,null))['then'](function(_0x2a03db){if(_0x2a03db){return _0x2a03db[_0x9b71('0x8b')](_0x308d8e[_0x9b71('0x39')][_0x9b71('0x6a')])[_0x9b71('0x2d')](function(){if(_[_0x9b71('0x90')](_0x308d8e['query'][_0x9b71('0x6a')])){for(var _0x178ea4=0x0;_0x178ea4<_0x308d8e['query'][_0x9b71('0x6a')][_0x9b71('0x50')];_0x178ea4+=0x1){socket[_0x9b71('0x74')](_0x9b71('0x8c'),{'UserId':Number(_0x308d8e[_0x9b71('0x39')][_0x9b71('0x6a')][_0x178ea4]),'OpenchannelQueueId':Number(_0x308d8e[_0x9b71('0x4f')]['id'])});}}else{socket[_0x9b71('0x74')](_0x9b71('0x8c'),{'UserId':Number(_0x308d8e['query']['ids']),'OpenchannelQueueId':Number(_0x308d8e[_0x9b71('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x538198,null))[_0x9b71('0x4d')](handleError(_0x538198,null));};exports['getAgents']=function(_0x56c236,_0x1a7e89,_0x3780cf){var _0x1e0ccb={};var _0x1c521f={};var _0x3da6eb;var _0x399ddf;return db['OpenchannelQueue'][_0x9b71('0x66')]({'where':{'id':_0x56c236['params']['id']}})[_0x9b71('0x2d')](handleEntityNotFound(_0x1a7e89,null))['then'](function(_0x585895){if(_0x585895){_0x3da6eb=_0x585895;_0x1c521f['model']=_['keys'](db[_0x9b71('0x5e')][_0x9b71('0x35')]);_0x1c521f[_0x9b71('0x39')]=_[_0x9b71('0x3a')](_0x56c236[_0x9b71('0x39')]);_0x1c521f['filters']=_[_0x9b71('0x3c')](_0x1c521f['model'],_0x1c521f[_0x9b71('0x39')]);_0x1e0ccb[_0x9b71('0x3d')]=_[_0x9b71('0x3c')](_0x1c521f[_0x9b71('0x37')],qs[_0x9b71('0x3e')](_0x56c236[_0x9b71('0x39')]['fields']));_0x1e0ccb[_0x9b71('0x3d')]=_0x1e0ccb[_0x9b71('0x3d')][_0x9b71('0x50')]?_0x1e0ccb['attributes']:_0x1c521f[_0x9b71('0x37')];_0x1e0ccb[_0x9b71('0x40')]=qs['sort'](_0x56c236[_0x9b71('0x39')][_0x9b71('0x41')]);_0x1e0ccb['where']=qs[_0x9b71('0x3b')](_[_0x9b71('0x68')](_0x56c236[_0x9b71('0x39')],_0x1c521f['filters']));if(_0x56c236['query'][_0x9b71('0x42')]){_0x1e0ccb['where']=_['merge'](_0x1e0ccb[_0x9b71('0x44')],{'$or':_['map'](_0x1e0ccb[_0x9b71('0x3d')],function(_0x40441f){var _0x1d8e36={};_0x1d8e36[_0x40441f]={'$like':'%'+_0x56c236[_0x9b71('0x39')][_0x9b71('0x42')]+'%'};return _0x1d8e36;})});}_0x1e0ccb=_['merge']({},_0x1e0ccb,_0x56c236[_0x9b71('0x47')]);return _0x3da6eb['getAgents'](_0x1e0ccb);}})['then'](function(_0xab8bb){if(_0xab8bb){_0x399ddf=_0xab8bb[_0x9b71('0x50')];if(!_0x56c236[_0x9b71('0x39')][_0x9b71('0x5c')](_0x9b71('0x3f'))){_0x1e0ccb[_0x9b71('0x25')]=qs[_0x9b71('0x25')](_0x56c236[_0x9b71('0x39')][_0x9b71('0x25')]);_0x1e0ccb[_0x9b71('0x23')]=qs['offset'](_0x56c236[_0x9b71('0x39')]['offset']);}return _0x3da6eb[_0x9b71('0x91')](_0x1e0ccb);}})[_0x9b71('0x2d')](function(_0x1b1869){if(_0x1b1869){return _0x1b1869?{'count':_0x399ddf,'rows':_0x1b1869}:null;}})[_0x9b71('0x2d')](respondWithResult(_0x1a7e89,null))['catch'](handleError(_0x1a7e89,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8c98527..73ea986 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 _0x12f3=['remove','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x38c28d,_0x184e8e){var _0x177400=function(_0x1a59f7){while(--_0x1a59f7){_0x38c28d['push'](_0x38c28d['shift']());}};_0x177400(++_0x184e8e);}(_0x12f3,0x1a2));var _0x312f=function(_0x4be46d,_0x48e9f1){_0x4be46d=_0x4be46d-0x0;var _0x269e43=_0x12f3[_0x4be46d];return _0x269e43;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x312f('0x0'))['db'][_0x312f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x312f('0x2')](0x0);var events={'afterCreate':_0x312f('0x3'),'afterUpdate':_0x312f('0x4'),'afterDestroy':_0x312f('0x5')};function emitEvent(_0x3418c7){return function(_0xc08e38,_0x398b0b,_0x4ca9b5){OpenchannelQueueEvents['emit'](_0x3418c7+':'+_0xc08e38['id'],_0xc08e38);OpenchannelQueueEvents['emit'](_0x3418c7,_0xc08e38);_0x4ca9b5(null);};}for(var e in events){if(events[_0x312f('0x6')](e)){var event=events[e];OpenchannelQueue[_0x312f('0x7')](e,emitEvent(event));}}module[_0x312f('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x80f1=['OpenchannelQueue','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x18b733,_0x306ddc){var _0x3d001d=function(_0x17c6e5){while(--_0x17c6e5){_0x18b733['push'](_0x18b733['shift']());}};_0x3d001d(++_0x306ddc);}(_0x80f1,0x180));var _0x180f=function(_0x18c4ae,_0x4fb86b){_0x18c4ae=_0x18c4ae-0x0;var _0x49cf02=_0x80f1[_0x18c4ae];return _0x49cf02;};'use strict';var EventEmitter=require(_0x180f('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x180f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x180f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x180f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4c6532){return function(_0xdeda9,_0x50654b,_0x525377){OpenchannelQueueEvents[_0x180f('0x4')](_0x4c6532+':'+_0xdeda9['id'],_0xdeda9);OpenchannelQueueEvents[_0x180f('0x4')](_0x4c6532,_0xdeda9);_0x525377(null);};}for(var e in events){if(events[_0x180f('0x5')](e)){var event=events[e];OpenchannelQueue[_0x180f('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 70115ee..63c37ac 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 _0x16c5=['path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x279841,_0x4e9e3b){var _0x4d3a9f=function(_0x261c2d){while(--_0x261c2d){_0x279841['push'](_0x279841['shift']());}};_0x4d3a9f(++_0x4e9e3b);}(_0x16c5,0x8a));var _0x516c=function(_0x2bbaac,_0x2c5b14){_0x2bbaac=_0x2bbaac-0x0;var _0x2dcdd8=_0x16c5[_0x2bbaac];return _0x2dcdd8;};'use strict';var _=require(_0x516c('0x0'));var util=require('util');var logger=require(_0x516c('0x1'))(_0x516c('0x2'));var moment=require(_0x516c('0x3'));var BPromise=require(_0x516c('0x4'));var rp=require(_0x516c('0x5'));var fs=require('fs');var path=require(_0x516c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x516c('0x7'));module[_0x516c('0x8')]=function(_0x3dae1e,_0x56f2aa){return _0x3dae1e[_0x516c('0x9')](_0x516c('0xa'),attributes,{'tableName':_0x516c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85ae=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x85ae,0xa2));var _0xe85a=function(_0x1944ae,_0x30c4df){_0x1944ae=_0x1944ae-0x0;var _0xe27600=_0x85ae[_0x1944ae];return _0xe27600;};'use strict';var _=require(_0xe85a('0x0'));var util=require(_0xe85a('0x1'));var logger=require(_0xe85a('0x2'))(_0xe85a('0x3'));var moment=require(_0xe85a('0x4'));var BPromise=require(_0xe85a('0x5'));var rp=require(_0xe85a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe85a('0x7'));var config=require(_0xe85a('0x8'));var attributes=require(_0xe85a('0x9'));module[_0xe85a('0xa')]=function(_0x241a3d,_0xf59cc8){return _0x241a3d[_0xe85a('0xb')](_0xe85a('0xc'),attributes,{'tableName':'openchannel_queues','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 9093ef4..913753e 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 _0x71ad=['socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','map','include','model','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x19bf9c,_0xa5ef2){var _0x2fd6a6=function(_0x1662fc){while(--_0x1662fc){_0x19bf9c['push'](_0x19bf9c['shift']());}};_0x2fd6a6(++_0xa5ef2);}(_0x71ad,0xf3));var _0xd71a=function(_0x5aceef,_0x4cc744){_0x5aceef=_0x5aceef-0x0;var _0x14c135=_0x71ad[_0x5aceef];return _0x14c135;};'use strict';var _=require(_0xd71a('0x0'));var util=require(_0xd71a('0x1'));var moment=require(_0xd71a('0x2'));var BPromise=require(_0xd71a('0x3'));var rs=require(_0xd71a('0x4'));var fs=require('fs');var Redis=require(_0xd71a('0x5'));var db=require(_0xd71a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd71a('0x7'))(_0xd71a('0x8'));var config=require(_0xd71a('0x9'));var jayson=require(_0xd71a('0xa'));var client=jayson[_0xd71a('0xb')][_0xd71a('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd71a('0xd')],{'host':_0xd71a('0xe'),'port':0x18eb});var socket=require(_0xd71a('0xf'))(new Redis(config[_0xd71a('0xd')]));require(_0xd71a('0x10'))[_0xd71a('0x11')](socket);function respondWithRpcPromise(_0x394c0b,_0x2f47c2,_0x38664b){return new BPromise(function(_0x4fb4aa,_0x56612e){return client[_0xd71a('0x12')](_0x394c0b,_0x38664b)[_0xd71a('0x13')](function(_0x56e974){logger['info'](_0xd71a('0x14'),_0x2f47c2,_0xd71a('0x15'));logger[_0xd71a('0x16')](_0xd71a('0x17'),_0x2f47c2,_0xd71a('0x15'),JSON[_0xd71a('0x18')](_0x56e974));if(_0x56e974[_0xd71a('0x19')]){if(_0x56e974[_0xd71a('0x19')][_0xd71a('0x1a')]===0x1f4){logger['error'](_0xd71a('0x14'),_0x2f47c2,_0x56e974[_0xd71a('0x19')][_0xd71a('0x1b')]);return _0x56612e(_0x56e974[_0xd71a('0x19')]['message']);}logger['error'](_0xd71a('0x14'),_0x2f47c2,_0x56e974[_0xd71a('0x19')][_0xd71a('0x1b')]);return _0x4fb4aa(_0x56e974[_0xd71a('0x19')][_0xd71a('0x1b')]);}else{logger[_0xd71a('0x1c')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f47c2,_0xd71a('0x15'));_0x4fb4aa(_0x56e974[_0xd71a('0x1d')][_0xd71a('0x1b')]);}})[_0xd71a('0x1e')](function(_0x1cc927){logger[_0xd71a('0x19')](_0xd71a('0x14'),_0x2f47c2,_0x1cc927);_0x56612e(_0x1cc927);});});}exports[_0xd71a('0x1f')]=function(_0x1c5d26){var _0x36543a=this;return new Promise(function(_0x3fc253,_0x500129){return db[_0xd71a('0x20')][_0xd71a('0x21')]({'raw':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26[_0xd71a('0x22')][_0xd71a('0x23')]===undefined?!![]:![]:!![],'where':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26['options'][_0xd71a('0x24')]||null:null,'attributes':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26[_0xd71a('0x22')][_0xd71a('0x25')]||null:null,'limit':_0x1c5d26['options']?_0x1c5d26[_0xd71a('0x22')]['limit']||null:null,'include':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26[_0xd71a('0x22')]['include']?_[_0xd71a('0x26')](_0x1c5d26[_0xd71a('0x22')][_0xd71a('0x27')],function(_0x3c7ec0){return{'model':db[_0x3c7ec0[_0xd71a('0x28')]],'as':_0x3c7ec0['as'],'attributes':_0x3c7ec0['attributes'],'include':_0x3c7ec0[_0xd71a('0x27')]?_[_0xd71a('0x26')](_0x3c7ec0[_0xd71a('0x27')],function(_0x5b3deb){return{'model':db[_0x5b3deb[_0xd71a('0x28')]],'as':_0x5b3deb['as'],'attributes':_0x5b3deb['attributes'],'include':_0x5b3deb[_0xd71a('0x27')]?_[_0xd71a('0x26')](_0x5b3deb[_0xd71a('0x27')],function(_0x51f436){return{'model':db[_0x51f436[_0xd71a('0x28')]],'as':_0x51f436['as'],'attributes':_0x51f436[_0xd71a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd71a('0x13')](function(_0x268689){logger[_0xd71a('0x1c')](_0xd71a('0x1f'),_0x1c5d26);logger['debug'](_0xd71a('0x1f'),_0x1c5d26,JSON['stringify'](_0x268689));_0x3fc253(_0x268689);})[_0xd71a('0x1e')](function(_0x397195){logger[_0xd71a('0x19')](_0xd71a('0x1f'),_0x397195[_0xd71a('0x1b')],_0x1c5d26);_0x500129(_0x36543a['error'](0x1f4,_0x397195[_0xd71a('0x1b')]));});});};exports[_0xd71a('0x29')]=function(_0xbce4c6){var _0x539b3e=this;return new Promise(function(_0x371bdd,_0x26dbda){return db[_0xd71a('0x20')][_0xd71a('0x2a')]({'raw':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6[_0xd71a('0x22')][_0xd71a('0x23')]===undefined?!![]:![]:!![],'where':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6['options']['where']||null:null,'attributes':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6['options'][_0xd71a('0x25')]||null:null,'include':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6['options'][_0xd71a('0x27')]?_[_0xd71a('0x26')](_0xbce4c6[_0xd71a('0x22')]['include'],function(_0x211862){return{'model':db[_0x211862[_0xd71a('0x28')]],'as':_0x211862['as'],'attributes':_0x211862[_0xd71a('0x25')],'include':_0x211862[_0xd71a('0x27')]?_['map'](_0x211862['include'],function(_0x376d81){return{'model':db[_0x376d81['model']],'as':_0x376d81['as'],'attributes':_0x376d81['attributes'],'include':_0x376d81['include']?_[_0xd71a('0x26')](_0x376d81['include'],function(_0x296858){return{'model':db[_0x296858[_0xd71a('0x28')]],'as':_0x296858['as'],'attributes':_0x296858[_0xd71a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd71a('0x13')](function(_0x3f9dab){logger[_0xd71a('0x1c')](_0xd71a('0x29'),_0xbce4c6);logger['debug'](_0xd71a('0x29'),_0xbce4c6,JSON[_0xd71a('0x18')](_0x3f9dab));_0x371bdd(_0x3f9dab);})[_0xd71a('0x1e')](function(_0x282f5f){logger[_0xd71a('0x19')](_0xd71a('0x29'),_0x282f5f[_0xd71a('0x1b')],_0xbce4c6);_0x26dbda(_0x539b3e[_0xd71a('0x19')](0x1f4,_0x282f5f[_0xd71a('0x1b')]));});});}; \ No newline at end of file +var _0x898b=['options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x1d1b93,_0x1e44c9){var _0x100cd1=function(_0x4c7b02){while(--_0x4c7b02){_0x1d1b93['push'](_0x1d1b93['shift']());}};_0x100cd1(++_0x1e44c9);}(_0x898b,0x172));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb898('0x0'));var util=require(_0xb898('0x1'));var moment=require(_0xb898('0x2'));var BPromise=require(_0xb898('0x3'));var rs=require(_0xb898('0x4'));var fs=require('fs');var Redis=require(_0xb898('0x5'));var db=require(_0xb898('0x6'))['db'];var utils=require(_0xb898('0x7'));var logger=require(_0xb898('0x8'))(_0xb898('0x9'));var config=require(_0xb898('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb898('0xb')][_0xb898('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb898('0xd')],{'host':_0xb898('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb898('0xf'))[_0xb898('0x10')](socket);function respondWithRpcPromise(_0x251cd9,_0xc3991e,_0x55a6a9){return new BPromise(function(_0x35d4dc,_0x554434){return client[_0xb898('0x11')](_0x251cd9,_0x55a6a9)[_0xb898('0x12')](function(_0x6ae70a){logger[_0xb898('0x13')](_0xb898('0x14'),_0xc3991e,_0xb898('0x15'));logger[_0xb898('0x16')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xc3991e,_0xb898('0x15'),JSON[_0xb898('0x17')](_0x6ae70a));if(_0x6ae70a[_0xb898('0x18')]){if(_0x6ae70a[_0xb898('0x18')][_0xb898('0x19')]===0x1f4){logger[_0xb898('0x18')](_0xb898('0x14'),_0xc3991e,_0x6ae70a[_0xb898('0x18')]['message']);return _0x554434(_0x6ae70a[_0xb898('0x18')]['message']);}logger[_0xb898('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0xc3991e,_0x6ae70a[_0xb898('0x18')][_0xb898('0x1a')]);return _0x35d4dc(_0x6ae70a[_0xb898('0x18')][_0xb898('0x1a')]);}else{logger['info'](_0xb898('0x14'),_0xc3991e,_0xb898('0x15'));_0x35d4dc(_0x6ae70a[_0xb898('0x1b')][_0xb898('0x1a')]);}})['catch'](function(_0x3cbed6){logger[_0xb898('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0xc3991e,_0x3cbed6);_0x554434(_0x3cbed6);});});}exports[_0xb898('0x1c')]=function(_0x401ec6){var _0x259b8f=this;return new Promise(function(_0x3b68d1,_0x8a3cf0){return db[_0xb898('0x1d')]['findAll']({'raw':_0x401ec6[_0xb898('0x1e')]?_0x401ec6[_0xb898('0x1e')][_0xb898('0x1f')]===undefined?!![]:![]:!![],'where':_0x401ec6['options']?_0x401ec6[_0xb898('0x1e')][_0xb898('0x20')]||null:null,'attributes':_0x401ec6[_0xb898('0x1e')]?_0x401ec6['options'][_0xb898('0x21')]||null:null,'limit':_0x401ec6[_0xb898('0x1e')]?_0x401ec6[_0xb898('0x1e')][_0xb898('0x22')]||null:null,'include':_0x401ec6[_0xb898('0x1e')]?_0x401ec6[_0xb898('0x1e')][_0xb898('0x23')]?_[_0xb898('0x24')](_0x401ec6[_0xb898('0x1e')][_0xb898('0x23')],function(_0x1a0eaa){return{'model':db[_0x1a0eaa[_0xb898('0x25')]],'as':_0x1a0eaa['as'],'attributes':_0x1a0eaa[_0xb898('0x21')],'include':_0x1a0eaa['include']?_[_0xb898('0x24')](_0x1a0eaa[_0xb898('0x23')],function(_0x208890){return{'model':db[_0x208890[_0xb898('0x25')]],'as':_0x208890['as'],'attributes':_0x208890[_0xb898('0x21')],'include':_0x208890['include']?_[_0xb898('0x24')](_0x208890[_0xb898('0x23')],function(_0xf9173){return{'model':db[_0xf9173[_0xb898('0x25')]],'as':_0xf9173['as'],'attributes':_0xf9173[_0xb898('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb898('0x12')](function(_0x1dd495){logger[_0xb898('0x13')](_0xb898('0x1c'),_0x401ec6);logger[_0xb898('0x16')](_0xb898('0x1c'),_0x401ec6,JSON[_0xb898('0x17')](_0x1dd495));_0x3b68d1(_0x1dd495);})['catch'](function(_0x23854e){logger[_0xb898('0x18')](_0xb898('0x1c'),_0x23854e[_0xb898('0x1a')],_0x401ec6);_0x8a3cf0(_0x259b8f[_0xb898('0x18')](0x1f4,_0x23854e[_0xb898('0x1a')]));});});};exports[_0xb898('0x26')]=function(_0x4f5deb){var _0x2bff2f=this;return new Promise(function(_0x2e3829,_0x17cef3){return db[_0xb898('0x1d')][_0xb898('0x27')]({'raw':_0x4f5deb[_0xb898('0x1e')]?_0x4f5deb['options'][_0xb898('0x1f')]===undefined?!![]:![]:!![],'where':_0x4f5deb['options']?_0x4f5deb['options'][_0xb898('0x20')]||null:null,'attributes':_0x4f5deb[_0xb898('0x1e')]?_0x4f5deb['options'][_0xb898('0x21')]||null:null,'include':_0x4f5deb[_0xb898('0x1e')]?_0x4f5deb['options'][_0xb898('0x23')]?_[_0xb898('0x24')](_0x4f5deb[_0xb898('0x1e')][_0xb898('0x23')],function(_0x287dc5){return{'model':db[_0x287dc5[_0xb898('0x25')]],'as':_0x287dc5['as'],'attributes':_0x287dc5['attributes'],'include':_0x287dc5[_0xb898('0x23')]?_[_0xb898('0x24')](_0x287dc5['include'],function(_0x4c8e5a){return{'model':db[_0x4c8e5a[_0xb898('0x25')]],'as':_0x4c8e5a['as'],'attributes':_0x4c8e5a[_0xb898('0x21')],'include':_0x4c8e5a[_0xb898('0x23')]?_['map'](_0x4c8e5a[_0xb898('0x23')],function(_0x523011){return{'model':db[_0x523011[_0xb898('0x25')]],'as':_0x523011['as'],'attributes':_0x523011[_0xb898('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x215220){logger[_0xb898('0x13')]('ShowOpenchannelQueue',_0x4f5deb);logger['debug'](_0xb898('0x26'),_0x4f5deb,JSON[_0xb898('0x17')](_0x215220));_0x2e3829(_0x215220);})['catch'](function(_0x1281f3){logger[_0xb898('0x18')](_0xb898('0x26'),_0x1281f3[_0xb898('0x1a')],_0x4f5deb);_0x17cef3(_0x2bff2f[_0xb898('0x18')](0x1f4,_0x1281f3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 27bd970..64082db 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 _0xa97f=['emit','removeListener','save','remove','update'];(function(_0x5d9afe,_0x5d7a53){var _0x461609=function(_0x28549e){while(--_0x28549e){_0x5d9afe['push'](_0x5d9afe['shift']());}};_0x461609(++_0x5d7a53);}(_0xa97f,0x1b5));var _0xfa97=function(_0x12b173,_0x32429a){_0x12b173=_0x12b173-0x0;var _0x1c7197=_0xa97f[_0x12b173];return _0x1c7197;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xfa97('0x0'),_0xfa97('0x1'),_0xfa97('0x2')];function createListener(_0x4d2262,_0x163b32){return function(_0x1a33f7){_0x163b32[_0xfa97('0x3')](_0x4d2262,_0x1a33f7);};}function removeListener(_0x441b00,_0x25bf80){return function(){OpenchannelQueueEvents[_0xfa97('0x4')](_0x441b00,_0x25bf80);};}exports['register']=function(_0x4fab53){for(var _0x37ebfa=0x0,_0x5b4ae5=events['length'];_0x37ebfa<_0x5b4ae5;_0x37ebfa++){var _0x1fca01=events[_0x37ebfa];var _0x56bcd1=createListener('openchannelQueue:'+_0x1fca01,_0x4fab53);OpenchannelQueueEvents['on'](_0x1fca01,_0x56bcd1);}}; \ No newline at end of file +var _0xc737=['./openchannelQueue.events','save','update','emit','removeListener','register','length'];(function(_0x434f80,_0x3354ff){var _0x502d44=function(_0x53d696){while(--_0x53d696){_0x434f80['push'](_0x434f80['shift']());}};_0x502d44(++_0x3354ff);}(_0xc737,0xb6));var _0x7c73=function(_0x433fb0,_0x324a5f){_0x433fb0=_0x433fb0-0x0;var _0xb166a1=_0xc737[_0x433fb0];return _0xb166a1;};'use strict';var OpenchannelQueueEvents=require(_0x7c73('0x0'));var events=[_0x7c73('0x1'),'remove',_0x7c73('0x2')];function createListener(_0x46498,_0x37c0dd){return function(_0x7b66ec){_0x37c0dd[_0x7c73('0x3')](_0x46498,_0x7b66ec);};}function removeListener(_0xc7eab6,_0x1d0cbd){return function(){OpenchannelQueueEvents[_0x7c73('0x4')](_0xc7eab6,_0x1d0cbd);};}exports[_0x7c73('0x5')]=function(_0x336e16){for(var _0x424701=0x0,_0x40ca6e=events[_0x7c73('0x6')];_0x424701<_0x40ca6e;_0x424701++){var _0x34cc13=events[_0x424701];var _0x13f074=createListener('openchannelQueue:'+_0x34cc13,_0x336e16);OpenchannelQueueEvents['on'](_0x34cc13,_0x13f074);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d219f10..5cd82fc 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 _0xef39=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xef39,0xec));var _0x9ef3=function(_0x336a0c,_0x5a5af8){_0x336a0c=_0x336a0c-0x0;var _0x5e09b0=_0xef39[_0x336a0c];return _0x5e09b0;};'use strict';var multer=require(_0x9ef3('0x0'));var util=require(_0x9ef3('0x1'));var path=require(_0x9ef3('0x2'));var timeout=require(_0x9ef3('0x3'));var express=require('express');var router=express[_0x9ef3('0x4')]();var fs_extra=require(_0x9ef3('0x5'));var auth=require(_0x9ef3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9ef3('0x7'));var controller=require(_0x9ef3('0x8'));router[_0x9ef3('0x9')]('/',auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xb')]);router['get'](_0x9ef3('0xc'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xd')]);router[_0x9ef3('0x9')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xf')]);router['post']('/',auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x10')]);router[_0x9ef3('0x11')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller['update']);router[_0x9ef3('0x12')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x13')]);module[_0x9ef3('0x14')]=router; \ No newline at end of file +var _0xf070=['put','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create'];(function(_0x2e9145,_0x177fa1){var _0x129471=function(_0x518e28){while(--_0x518e28){_0x2e9145['push'](_0x2e9145['shift']());}};_0x129471(++_0x177fa1);}(_0xf070,0x1a8));var _0x0f07=function(_0x37f6b9,_0x3b0c42){_0x37f6b9=_0x37f6b9-0x0;var _0x152977=_0xf070[_0x37f6b9];return _0x152977;};'use strict';var multer=require(_0x0f07('0x0'));var util=require('util');var path=require(_0x0f07('0x1'));var timeout=require(_0x0f07('0x2'));var express=require(_0x0f07('0x3'));var router=express[_0x0f07('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0f07('0x5'));var interaction=require(_0x0f07('0x6'));var config=require(_0x0f07('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x0f07('0x8')]('/',auth['isAuthenticated'](),controller[_0x0f07('0x9')]);router[_0x0f07('0x8')](_0x0f07('0xa'),auth[_0x0f07('0xb')](),controller[_0x0f07('0xc')]);router[_0x0f07('0x8')]('/:id',auth[_0x0f07('0xb')](),controller[_0x0f07('0xd')]);router[_0x0f07('0xe')]('/',auth[_0x0f07('0xb')](),controller[_0x0f07('0xf')]);router[_0x0f07('0x10')](_0x0f07('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x0f07('0x12')](_0x0f07('0x11'),auth[_0x0f07('0xb')](),controller[_0x0f07('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cf4d959..029160d 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 _0x467a=['sequelize','exports','STRING','DATE','moment'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x467a,0x117));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xa467('0x0'));var Sequelize=require(_0xa467('0x1'));module[_0xa467('0x2')]={'uniqueid':{'type':Sequelize[_0xa467('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa467('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa467('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa467('0x3')]}}; \ No newline at end of file +var _0x99e8=['DATE','sequelize','STRING'];(function(_0x3195c6,_0x21275e){var _0x3fb9c1=function(_0x1f21ef){while(--_0x1f21ef){_0x3195c6['push'](_0x3195c6['shift']());}};_0x3fb9c1(++_0x21275e);}(_0x99e8,0x148));var _0x899e=function(_0x5767b1,_0x424f0a){_0x5767b1=_0x5767b1-0x0;var _0x5b8b7f=_0x99e8[_0x5767b1];return _0x5b8b7f;};'use strict';var moment=require('moment');var Sequelize=require(_0x899e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x899e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x899e('0x1')]},'joinAt':{'type':Sequelize[_0x899e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x899e('0x2')]},'exitAt':{'type':Sequelize[_0x899e('0x2')]},'reason':{'type':Sequelize[_0x899e('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0a42cf1..bc1e689 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 _0x5553=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','OpenchannelQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy'];(function(_0x4742f1,_0x1edaca){var _0x13538f=function(_0x3e99de){while(--_0x3e99de){_0x4742f1['push'](_0x4742f1['shift']());}};_0x13538f(++_0x1edaca);}(_0x5553,0x191));var _0x3555=function(_0x7ca9c7,_0x51a58b){_0x7ca9c7=_0x7ca9c7-0x0;var _0x35f64f=_0x5553[_0x7ca9c7];return _0x35f64f;};'use strict';var emlformat=require(_0x3555('0x0'));var rimraf=require(_0x3555('0x1'));var zipdir=require(_0x3555('0x2'));var jsonpatch=require(_0x3555('0x3'));var rp=require(_0x3555('0x4'));var moment=require(_0x3555('0x5'));var BPromise=require(_0x3555('0x6'));var Mustache=require(_0x3555('0x7'));var util=require(_0x3555('0x8'));var path=require(_0x3555('0x9'));var sox=require(_0x3555('0xa'));var csv=require(_0x3555('0xb'));var ejs=require(_0x3555('0xc'));var fs=require('fs');var fs_extra=require(_0x3555('0xd'));var _=require(_0x3555('0xe'));var squel=require(_0x3555('0xf'));var crypto=require(_0x3555('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3555('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3555('0x12'));var Redis=require(_0x3555('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3555('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3555('0x15'));var logger=require('../../config/logger')(_0x3555('0x16'));var utils=require(_0x3555('0x17'));var config=require(_0x3555('0x18'));var licenseUtil=require(_0x3555('0x19'));var db=require(_0x3555('0x1a'))['db'];function respondWithStatusCode(_0x17c050,_0x2ec409){_0x2ec409=_0x2ec409||0xcc;return function(_0x485eb){if(_0x485eb){return _0x17c050[_0x3555('0x1b')](_0x2ec409);}return _0x17c050[_0x3555('0x1c')](_0x2ec409)[_0x3555('0x1d')]();};}function respondWithResult(_0x52c823,_0x29db1c){_0x29db1c=_0x29db1c||0xc8;return function(_0x524c1c){if(_0x524c1c){return _0x52c823[_0x3555('0x1c')](_0x29db1c)[_0x3555('0x1e')](_0x524c1c);}};}function respondWithFilteredResult(_0x36585f,_0x445b09){return function(_0x17a5ba){if(_0x17a5ba){var _0x47aa13=typeof _0x445b09[_0x3555('0x1f')]===_0x3555('0x20')&&typeof _0x445b09[_0x3555('0x21')]===_0x3555('0x20');var _0x141b72=_0x17a5ba[_0x3555('0x22')];var _0x2c1ce1=_0x47aa13?0x0:_0x445b09[_0x3555('0x1f')];var _0x3b462f=_0x47aa13?_0x17a5ba[_0x3555('0x22')]:_0x445b09['offset']+_0x445b09[_0x3555('0x21')];var _0x5292e3;if(_0x3b462f>=_0x141b72){_0x3b462f=_0x141b72;_0x5292e3=0xc8;}else{_0x5292e3=0xce;}_0x36585f[_0x3555('0x1c')](_0x5292e3);return _0x36585f[_0x3555('0x23')]('Content-Range',_0x2c1ce1+'-'+_0x3b462f+'/'+_0x141b72)[_0x3555('0x1e')](_0x17a5ba);}return null;};}function patchUpdates(_0x2ef4e9){return function(_0x259c5f){try{jsonpatch[_0x3555('0x24')](_0x259c5f,_0x2ef4e9,!![]);}catch(_0x2614d5){return BPromise['reject'](_0x2614d5);}return _0x259c5f[_0x3555('0x25')]();};}function saveUpdates(_0x3333aa,_0x5f4e70){return function(_0x25f687){if(_0x25f687){return _0x25f687[_0x3555('0x26')](_0x3333aa)[_0x3555('0x27')](function(_0x350171){return _0x350171;});}return null;};}function removeEntity(_0x5b79ee,_0xcd8595){return function(_0x3acfcb){if(_0x3acfcb){return _0x3acfcb['destroy']()[_0x3555('0x27')](function(){_0x5b79ee[_0x3555('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e00aa,_0x24e395){return function(_0x1ed378){if(!_0x1ed378){_0x1e00aa[_0x3555('0x1b')](0x194);}return _0x1ed378;};}function handleError(_0x493da0,_0x2e703c){_0x2e703c=_0x2e703c||0x1f4;return function(_0x3b8a3d){logger[_0x3555('0x28')](_0x3b8a3d[_0x3555('0x29')]);if(_0x3b8a3d[_0x3555('0x2a')]){delete _0x3b8a3d[_0x3555('0x2a')];}_0x493da0[_0x3555('0x1c')](_0x2e703c)[_0x3555('0x2b')](_0x3b8a3d);};}exports['index']=function(_0x441d04,_0x299634){var _0x25ffc2={},_0xee2ad3={},_0x375092={'count':0x0,'rows':[]};var _0x10ba46=_[_0x3555('0x2c')](db[_0x3555('0x2d')]['rawAttributes'],function(_0x476b7d){return{'name':_0x476b7d[_0x3555('0x2e')],'type':_0x476b7d[_0x3555('0x2f')][_0x3555('0x30')]};});_0xee2ad3[_0x3555('0x31')]=_['map'](_0x10ba46,'name');_0xee2ad3['query']=_[_0x3555('0x32')](_0x441d04[_0x3555('0x33')]);_0xee2ad3[_0x3555('0x34')]=_[_0x3555('0x35')](_0xee2ad3[_0x3555('0x31')],_0xee2ad3[_0x3555('0x33')]);_0x25ffc2[_0x3555('0x36')]=_[_0x3555('0x35')](_0xee2ad3[_0x3555('0x31')],qs[_0x3555('0x37')](_0x441d04[_0x3555('0x33')][_0x3555('0x37')]));_0x25ffc2[_0x3555('0x36')]=_0x25ffc2[_0x3555('0x36')][_0x3555('0x38')]?_0x25ffc2['attributes']:_0xee2ad3[_0x3555('0x31')];if(!_0x441d04['query'][_0x3555('0x39')](_0x3555('0x3a'))){_0x25ffc2['limit']=qs[_0x3555('0x21')](_0x441d04[_0x3555('0x33')][_0x3555('0x21')]);_0x25ffc2[_0x3555('0x1f')]=qs[_0x3555('0x1f')](_0x441d04[_0x3555('0x33')]['offset']);}_0x25ffc2[_0x3555('0x3b')]=qs[_0x3555('0x3c')](_0x441d04[_0x3555('0x33')][_0x3555('0x3c')]);_0x25ffc2['where']=qs[_0x3555('0x34')](_[_0x3555('0x3d')](_0x441d04[_0x3555('0x33')],_0xee2ad3['filters']),_0x10ba46);if(_0x441d04['query'][_0x3555('0x3e')]){_0x25ffc2[_0x3555('0x3f')]=_[_0x3555('0x40')](_0x25ffc2[_0x3555('0x3f')],{'$or':_[_0x3555('0x2c')](_0x10ba46,function(_0x26ad46){if(_0x26ad46[_0x3555('0x2f')]!==_0x3555('0x41')){var _0x40c5c5={};_0x40c5c5[_0x26ad46[_0x3555('0x2a')]]={'$like':'%'+_0x441d04[_0x3555('0x33')][_0x3555('0x3e')]+'%'};return _0x40c5c5;}})});}_0x25ffc2=_['merge']({},_0x25ffc2,_0x441d04[_0x3555('0x42')]);var _0x21c353={'where':_0x25ffc2['where']};return db['OpenchannelQueueReport'][_0x3555('0x22')](_0x21c353)[_0x3555('0x27')](function(_0x21c939){_0x375092[_0x3555('0x22')]=_0x21c939;if(_0x441d04[_0x3555('0x33')][_0x3555('0x43')]){_0x25ffc2[_0x3555('0x44')]=[{'all':!![]}];}return db[_0x3555('0x2d')][_0x3555('0x45')](_0x25ffc2);})[_0x3555('0x27')](function(_0x4461db){_0x375092[_0x3555('0x46')]=_0x4461db;return _0x375092;})[_0x3555('0x27')](respondWithFilteredResult(_0x299634,_0x25ffc2))[_0x3555('0x47')](handleError(_0x299634,null));};exports[_0x3555('0x48')]=function(_0xf65ecf,_0x809bf3){var _0x24df82={'raw':!![],'where':{'id':_0xf65ecf[_0x3555('0x49')]['id']}},_0x59f98c={};_0x59f98c['model']=_[_0x3555('0x32')](db[_0x3555('0x2d')][_0x3555('0x4a')]);_0x59f98c[_0x3555('0x33')]=_[_0x3555('0x32')](_0xf65ecf['query']);_0x59f98c[_0x3555('0x34')]=_[_0x3555('0x35')](_0x59f98c['model'],_0x59f98c[_0x3555('0x33')]);_0x24df82[_0x3555('0x36')]=_[_0x3555('0x35')](_0x59f98c[_0x3555('0x31')],qs[_0x3555('0x37')](_0xf65ecf[_0x3555('0x33')][_0x3555('0x37')]));_0x24df82[_0x3555('0x36')]=_0x24df82['attributes'][_0x3555('0x38')]?_0x24df82['attributes']:_0x59f98c[_0x3555('0x31')];if(_0xf65ecf[_0x3555('0x33')][_0x3555('0x43')]){_0x24df82[_0x3555('0x44')]=[{'all':!![]}];}_0x24df82=_[_0x3555('0x40')]({},_0x24df82,_0xf65ecf[_0x3555('0x42')]);return db['OpenchannelQueueReport']['find'](_0x24df82)['then'](handleEntityNotFound(_0x809bf3,null))['then'](respondWithResult(_0x809bf3,null))[_0x3555('0x47')](handleError(_0x809bf3,null));};exports[_0x3555('0x4b')]=function(_0x46248e,_0x2ace5e){return db[_0x3555('0x2d')]['create'](_0x46248e[_0x3555('0x4c')],{})[_0x3555('0x27')](respondWithResult(_0x2ace5e,0xc9))[_0x3555('0x47')](handleError(_0x2ace5e,null));};exports[_0x3555('0x26')]=function(_0x34a273,_0x5d7987){if(_0x34a273[_0x3555('0x4c')]['id']){delete _0x34a273[_0x3555('0x4c')]['id'];}return db[_0x3555('0x2d')][_0x3555('0x4d')]({'where':{'id':_0x34a273[_0x3555('0x49')]['id']}})[_0x3555('0x27')](handleEntityNotFound(_0x5d7987,null))[_0x3555('0x27')](saveUpdates(_0x34a273[_0x3555('0x4c')],null))[_0x3555('0x27')](respondWithResult(_0x5d7987,null))[_0x3555('0x47')](handleError(_0x5d7987,null));};exports[_0x3555('0x4e')]=function(_0x3cdac1,_0x127d2f){return db[_0x3555('0x2d')][_0x3555('0x4d')]({'where':{'id':_0x3cdac1['params']['id']}})[_0x3555('0x27')](handleEntityNotFound(_0x127d2f,null))[_0x3555('0x27')](removeEntity(_0x127d2f,null))[_0x3555('0x47')](handleError(_0x127d2f,null));};exports[_0x3555('0x4f')]=function(_0x325750,_0x1b0f0d){return db[_0x3555('0x2d')]['describe']()[_0x3555('0x27')](respondWithResult(_0x1b0f0d,null))[_0x3555('0x47')](handleError(_0x1b0f0d,null));}; \ No newline at end of file +var _0x59bf=['destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body'];(function(_0x4ced7d,_0x15f4b8){var _0x68d3a9=function(_0x344703){while(--_0x344703){_0x4ced7d['push'](_0x4ced7d['shift']());}};_0x68d3a9(++_0x15f4b8);}(_0x59bf,0xd7));var _0xf59b=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x59bf[_0x1eda20];return _0x31b953;};'use strict';var emlformat=require(_0xf59b('0x0'));var rimraf=require(_0xf59b('0x1'));var zipdir=require(_0xf59b('0x2'));var jsonpatch=require(_0xf59b('0x3'));var rp=require(_0xf59b('0x4'));var moment=require(_0xf59b('0x5'));var BPromise=require(_0xf59b('0x6'));var Mustache=require(_0xf59b('0x7'));var util=require(_0xf59b('0x8'));var path=require(_0xf59b('0x9'));var sox=require('sox');var csv=require(_0xf59b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf59b('0xb'));var squel=require('squel');var crypto=require(_0xf59b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf59b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf59b('0xe'));var Papa=require(_0xf59b('0xf'));var Redis=require(_0xf59b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf59b('0x11'));var as=require(_0xf59b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf59b('0x13'))(_0xf59b('0x14'));var utils=require(_0xf59b('0x15'));var config=require(_0xf59b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2defd7,_0x29ee04){_0x29ee04=_0x29ee04||0xcc;return function(_0x42efba){if(_0x42efba){return _0x2defd7[_0xf59b('0x17')](_0x29ee04);}return _0x2defd7[_0xf59b('0x18')](_0x29ee04)['end']();};}function respondWithResult(_0x23c0b9,_0x1892e8){_0x1892e8=_0x1892e8||0xc8;return function(_0x128f66){if(_0x128f66){return _0x23c0b9[_0xf59b('0x18')](_0x1892e8)['json'](_0x128f66);}};}function respondWithFilteredResult(_0x217466,_0x50a12a){return function(_0x18eb99){if(_0x18eb99){var _0x302110=typeof _0x50a12a[_0xf59b('0x19')]===_0xf59b('0x1a')&&typeof _0x50a12a[_0xf59b('0x1b')]===_0xf59b('0x1a');var _0x1b3863=_0x18eb99[_0xf59b('0x1c')];var _0x4d64f5=_0x302110?0x0:_0x50a12a[_0xf59b('0x19')];var _0x587396=_0x302110?_0x18eb99[_0xf59b('0x1c')]:_0x50a12a[_0xf59b('0x19')]+_0x50a12a['limit'];var _0x10e9e4;if(_0x587396>=_0x1b3863){_0x587396=_0x1b3863;_0x10e9e4=0xc8;}else{_0x10e9e4=0xce;}_0x217466[_0xf59b('0x18')](_0x10e9e4);return _0x217466['set']('Content-Range',_0x4d64f5+'-'+_0x587396+'/'+_0x1b3863)[_0xf59b('0x1d')](_0x18eb99);}return null;};}function patchUpdates(_0x588899){return function(_0x5bc48b){try{jsonpatch[_0xf59b('0x1e')](_0x5bc48b,_0x588899,!![]);}catch(_0x17884e){return BPromise[_0xf59b('0x1f')](_0x17884e);}return _0x5bc48b[_0xf59b('0x20')]();};}function saveUpdates(_0x2e247d,_0x5dafd5){return function(_0x38a360){if(_0x38a360){return _0x38a360[_0xf59b('0x21')](_0x2e247d)[_0xf59b('0x22')](function(_0x311b29){return _0x311b29;});}return null;};}function removeEntity(_0x35339e,_0xe255c0){return function(_0x1df5a3){if(_0x1df5a3){return _0x1df5a3['destroy']()[_0xf59b('0x22')](function(){_0x35339e[_0xf59b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573123,_0x1033a8){return function(_0x31aca6){if(!_0x31aca6){_0x573123['sendStatus'](0x194);}return _0x31aca6;};}function handleError(_0x2767f5,_0x4c0995){_0x4c0995=_0x4c0995||0x1f4;return function(_0x384995){logger['error'](_0x384995[_0xf59b('0x23')]);if(_0x384995['name']){delete _0x384995[_0xf59b('0x24')];}_0x2767f5[_0xf59b('0x18')](_0x4c0995)[_0xf59b('0x25')](_0x384995);};}exports[_0xf59b('0x26')]=function(_0x580c49,_0x2714d2){var _0x4991fd={},_0x28d19d={},_0x2d718d={'count':0x0,'rows':[]};var _0x49da4d=_[_0xf59b('0x27')](db[_0xf59b('0x28')][_0xf59b('0x29')],function(_0x221318){return{'name':_0x221318['fieldName'],'type':_0x221318[_0xf59b('0x2a')][_0xf59b('0x2b')]};});_0x28d19d[_0xf59b('0x2c')]=_[_0xf59b('0x27')](_0x49da4d,'name');_0x28d19d[_0xf59b('0x2d')]=_['keys'](_0x580c49[_0xf59b('0x2d')]);_0x28d19d[_0xf59b('0x2e')]=_[_0xf59b('0x2f')](_0x28d19d[_0xf59b('0x2c')],_0x28d19d[_0xf59b('0x2d')]);_0x4991fd['attributes']=_['intersection'](_0x28d19d[_0xf59b('0x2c')],qs[_0xf59b('0x30')](_0x580c49[_0xf59b('0x2d')]['fields']));_0x4991fd[_0xf59b('0x31')]=_0x4991fd['attributes'][_0xf59b('0x32')]?_0x4991fd['attributes']:_0x28d19d[_0xf59b('0x2c')];if(!_0x580c49[_0xf59b('0x2d')]['hasOwnProperty']('nolimit')){_0x4991fd[_0xf59b('0x1b')]=qs[_0xf59b('0x1b')](_0x580c49[_0xf59b('0x2d')][_0xf59b('0x1b')]);_0x4991fd[_0xf59b('0x19')]=qs['offset'](_0x580c49[_0xf59b('0x2d')][_0xf59b('0x19')]);}_0x4991fd[_0xf59b('0x33')]=qs[_0xf59b('0x34')](_0x580c49[_0xf59b('0x2d')][_0xf59b('0x34')]);_0x4991fd[_0xf59b('0x35')]=qs[_0xf59b('0x2e')](_[_0xf59b('0x36')](_0x580c49[_0xf59b('0x2d')],_0x28d19d['filters']),_0x49da4d);if(_0x580c49[_0xf59b('0x2d')][_0xf59b('0x37')]){_0x4991fd[_0xf59b('0x35')]=_[_0xf59b('0x38')](_0x4991fd['where'],{'$or':_[_0xf59b('0x27')](_0x49da4d,function(_0x45ecc4){if(_0x45ecc4[_0xf59b('0x2a')]!==_0xf59b('0x39')){var _0x2c26ba={};_0x2c26ba[_0x45ecc4[_0xf59b('0x24')]]={'$like':'%'+_0x580c49[_0xf59b('0x2d')][_0xf59b('0x37')]+'%'};return _0x2c26ba;}})});}_0x4991fd=_['merge']({},_0x4991fd,_0x580c49[_0xf59b('0x3a')]);var _0x1595bf={'where':_0x4991fd[_0xf59b('0x35')]};return db[_0xf59b('0x28')][_0xf59b('0x1c')](_0x1595bf)[_0xf59b('0x22')](function(_0x40fa3c){_0x2d718d['count']=_0x40fa3c;if(_0x580c49[_0xf59b('0x2d')][_0xf59b('0x3b')]){_0x4991fd['include']=[{'all':!![]}];}return db[_0xf59b('0x28')][_0xf59b('0x3c')](_0x4991fd);})[_0xf59b('0x22')](function(_0x27dddf){_0x2d718d[_0xf59b('0x3d')]=_0x27dddf;return _0x2d718d;})[_0xf59b('0x22')](respondWithFilteredResult(_0x2714d2,_0x4991fd))[_0xf59b('0x3e')](handleError(_0x2714d2,null));};exports['show']=function(_0x25fa88,_0x1cf4bb){var _0x4ef1bb={'raw':!![],'where':{'id':_0x25fa88[_0xf59b('0x3f')]['id']}},_0x577bfa={};_0x577bfa[_0xf59b('0x2c')]=_[_0xf59b('0x40')](db[_0xf59b('0x28')][_0xf59b('0x29')]);_0x577bfa[_0xf59b('0x2d')]=_['keys'](_0x25fa88[_0xf59b('0x2d')]);_0x577bfa[_0xf59b('0x2e')]=_[_0xf59b('0x2f')](_0x577bfa['model'],_0x577bfa[_0xf59b('0x2d')]);_0x4ef1bb[_0xf59b('0x31')]=_[_0xf59b('0x2f')](_0x577bfa[_0xf59b('0x2c')],qs[_0xf59b('0x30')](_0x25fa88[_0xf59b('0x2d')]['fields']));_0x4ef1bb['attributes']=_0x4ef1bb['attributes'][_0xf59b('0x32')]?_0x4ef1bb[_0xf59b('0x31')]:_0x577bfa['model'];if(_0x25fa88[_0xf59b('0x2d')][_0xf59b('0x3b')]){_0x4ef1bb[_0xf59b('0x41')]=[{'all':!![]}];}_0x4ef1bb=_[_0xf59b('0x38')]({},_0x4ef1bb,_0x25fa88[_0xf59b('0x3a')]);return db['OpenchannelQueueReport'][_0xf59b('0x42')](_0x4ef1bb)[_0xf59b('0x22')](handleEntityNotFound(_0x1cf4bb,null))[_0xf59b('0x22')](respondWithResult(_0x1cf4bb,null))['catch'](handleError(_0x1cf4bb,null));};exports[_0xf59b('0x43')]=function(_0x4b6f7e,_0x3b5946){return db[_0xf59b('0x28')][_0xf59b('0x43')](_0x4b6f7e[_0xf59b('0x44')],{})[_0xf59b('0x22')](respondWithResult(_0x3b5946,0xc9))[_0xf59b('0x3e')](handleError(_0x3b5946,null));};exports[_0xf59b('0x21')]=function(_0x1759cb,_0x398b58){if(_0x1759cb[_0xf59b('0x44')]['id']){delete _0x1759cb[_0xf59b('0x44')]['id'];}return db[_0xf59b('0x28')]['find']({'where':{'id':_0x1759cb[_0xf59b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x398b58,null))['then'](saveUpdates(_0x1759cb[_0xf59b('0x44')],null))[_0xf59b('0x22')](respondWithResult(_0x398b58,null))[_0xf59b('0x3e')](handleError(_0x398b58,null));};exports[_0xf59b('0x45')]=function(_0x9eec67,_0x345ea6){return db[_0xf59b('0x28')]['find']({'where':{'id':_0x9eec67[_0xf59b('0x3f')]['id']}})[_0xf59b('0x22')](handleEntityNotFound(_0x345ea6,null))[_0xf59b('0x22')](removeEntity(_0x345ea6,null))[_0xf59b('0x3e')](handleError(_0x345ea6,null));};exports['describe']=function(_0x20e407,_0x5b3292){return db[_0xf59b('0x28')][_0xf59b('0x46')]()[_0xf59b('0x22')](respondWithResult(_0x5b3292,null))['catch'](handleError(_0x5b3292,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 63e6122..9cf5579 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x2fc691,_0x2fc68c){var _0x3cdb8d=function(_0x2e56eb){while(--_0x2e56eb){_0x2fc691['push'](_0x2fc691['shift']());}};_0x3cdb8d(++_0x2fc68c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x5fc3[_0x4f431d];return _0x4f31e1;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x503080,_0x57dca3){var _0x172939=function(_0x3a535a){while(--_0x3a535a){_0x503080['push'](_0x503080['shift']());}};_0x172939(++_0x57dca3);}(_0x7a54,0x106));var _0x47a5=function(_0x4e061c,_0x55ca00){_0x4e061c=_0x4e061c-0x0;var _0x149baf=_0x7a54[_0x4e061c];return _0x149baf;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3f426f3..c38821e 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 _0xf4f4=['body','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','stringify','UpdateOpenchannelQueueReport','update'];(function(_0x2f8d4a,_0x456abd){var _0x4aa7e6=function(_0x9b1ea9){while(--_0x9b1ea9){_0x2f8d4a['push'](_0x2f8d4a['shift']());}};_0x4aa7e6(++_0x456abd);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x342465,_0x3aa51b){_0x342465=_0x342465-0x0;var _0x4a4da7=_0xf4f4[_0x342465];return _0x4a4da7;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});}exports[_0x4f4f('0x15')]=function(_0x1245c4){var _0x60ce2=this;return new Promise(function(_0x929a0b,_0x2f9397){return db[_0x4f4f('0x16')][_0x4f4f('0x17')](_0x1245c4['body'],{'raw':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x19')]===undefined?!![]:![]:!![]})[_0x4f4f('0xb')](function(_0x302a79){logger[_0x4f4f('0xc')](_0x4f4f('0x15'),_0x1245c4);logger[_0x4f4f('0xf')](_0x4f4f('0x15'),_0x1245c4,JSON[_0x4f4f('0x1a')](_0x302a79));_0x929a0b(_0x302a79);})[_0x4f4f('0x14')](function(_0x17832f){logger[_0x4f4f('0x11')](_0x4f4f('0x15'),_0x17832f['message'],_0x1245c4);_0x2f9397(_0x60ce2['error'](0x1f4,_0x17832f['message']));});});};exports[_0x4f4f('0x1b')]=function(_0x43e661){var _0x5186ac=this;return new Promise(function(_0x3960ae,_0x15859c){return db[_0x4f4f('0x16')][_0x4f4f('0x1c')](_0x43e661[_0x4f4f('0x1d')],{'raw':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')][_0x4f4f('0x1e')]||null:null,'attributes':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')]['attributes']||null:null,'limit':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')][_0x4f4f('0x1f')]||null:null})['then'](function(_0x534075){logger['info'](_0x4f4f('0x1b'),_0x43e661);logger['debug'](_0x4f4f('0x1b'),_0x43e661,JSON[_0x4f4f('0x1a')](_0x534075));_0x3960ae(_0x534075);})[_0x4f4f('0x14')](function(_0x5eb7c9){logger[_0x4f4f('0x11')](_0x4f4f('0x1b'),_0x5eb7c9['message'],_0x43e661);_0x15859c(_0x5186ac[_0x4f4f('0x11')](0x1f4,_0x5eb7c9[_0x4f4f('0x13')]));});});}; \ No newline at end of file +var _0xd5fc=['rpc','jayson/promise','http','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd5fc,0xae));var _0xcd5f=function(_0x5780cf,_0x2a3867){_0x5780cf=_0x5780cf-0x0;var _0x39669e=_0xd5fc[_0x5780cf];return _0x39669e;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateOpenchannelQueueReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['OpenchannelQueueReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateOpenchannelQueueReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x388290){var _0x41015c=this;return new Promise(function(_0x4dc7ab,_0xba8e2e){return db[_0xcd5f('0x17')][_0xcd5f('0x18')](_0x388290[_0xcd5f('0x14')],{'raw':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x1a')]||null:null,'attributes':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x1b')]||null:null,'limit':_0x388290[_0xcd5f('0x15')]?_0x388290['options'][_0xcd5f('0x1c')]||null:null})[_0xcd5f('0x9')](function(_0x561414){logger[_0xcd5f('0x10')]('UpdateOpenchannelQueueReport',_0x388290);logger[_0xcd5f('0xb')](_0xcd5f('0x1d'),_0x388290,JSON[_0xcd5f('0xd')](_0x561414));_0x4dc7ab(_0x561414);})[_0xcd5f('0x12')](function(_0xb56143){logger[_0xcd5f('0xe')]('UpdateOpenchannelQueueReport',_0xb56143['message'],_0x388290);_0xba8e2e(_0x41015c[_0xcd5f('0xe')](0x1f4,_0xb56143[_0xcd5f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index d9b20a8..03804d0 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 _0x7e16=['/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x1d3c4b,_0x3918c4){var _0x1acd5c=function(_0x4b8d90){while(--_0x4b8d90){_0x1d3c4b['push'](_0x1d3c4b['shift']());}};_0x1acd5c(++_0x3918c4);}(_0x7e16,0x13d));var _0x67e1=function(_0x5e3e62,_0x2319f4){_0x5e3e62=_0x5e3e62-0x0;var _0x4f2738=_0x7e16[_0x5e3e62];return _0x4f2738;};'use strict';var multer=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var path=require(_0x67e1('0x2'));var timeout=require(_0x67e1('0x3'));var express=require(_0x67e1('0x4'));var router=express[_0x67e1('0x5')]();var fs_extra=require(_0x67e1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x67e1('0x7'));var config=require(_0x67e1('0x8'));var controller=require(_0x67e1('0x9'));router[_0x67e1('0xa')]('/',auth[_0x67e1('0xb')](),controller[_0x67e1('0xc')]);router[_0x67e1('0xa')](_0x67e1('0xd'),auth[_0x67e1('0xb')](),controller['describe']);router[_0x67e1('0xa')](_0x67e1('0xe'),auth[_0x67e1('0xb')](),controller['show']);router[_0x67e1('0xf')]('/',auth[_0x67e1('0xb')](),controller[_0x67e1('0x10')]);router[_0x67e1('0x11')](_0x67e1('0xe'),auth['isAuthenticated'](),controller[_0x67e1('0x12')]);router[_0x67e1('0x13')](_0x67e1('0xe'),auth[_0x67e1('0xb')](),controller[_0x67e1('0x14')]);module[_0x67e1('0x15')]=router; \ No newline at end of file +var _0xf2d4=['/describe','describe','/:id','show','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xf2d4,0x1e2));var _0x4f2d=function(_0x4e1eef,_0x3fe6e9){_0x4e1eef=_0x4e1eef-0x0;var _0x437667=_0xf2d4[_0x4e1eef];return _0x437667;};'use strict';var multer=require(_0x4f2d('0x0'));var util=require(_0x4f2d('0x1'));var path=require(_0x4f2d('0x2'));var timeout=require(_0x4f2d('0x3'));var express=require(_0x4f2d('0x4'));var router=express[_0x4f2d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4f2d('0x6'));var config=require(_0x4f2d('0x7'));var controller=require(_0x4f2d('0x8'));router[_0x4f2d('0x9')]('/',auth[_0x4f2d('0xa')](),controller[_0x4f2d('0xb')]);router[_0x4f2d('0x9')](_0x4f2d('0xc'),auth[_0x4f2d('0xa')](),controller[_0x4f2d('0xd')]);router[_0x4f2d('0x9')](_0x4f2d('0xe'),auth[_0x4f2d('0xa')](),controller[_0x4f2d('0xf')]);router['post']('/',auth[_0x4f2d('0xa')](),controller[_0x4f2d('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4f2d('0x11')]);router[_0x4f2d('0x12')](_0x4f2d('0xe'),auth[_0x4f2d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d4e09a7..b92959b 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x283af2,_0x3adf1e){var _0x4c8c9f=function(_0xc6c110){while(--_0xc6c110){_0x283af2['push'](_0x283af2['shift']());}};_0x4c8c9f(++_0x3adf1e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x9bde,0xe1));var _0xe9bd=function(_0xb78ff3,_0x562178){_0xb78ff3=_0xb78ff3-0x0;var _0x563e4e=_0x9bde[_0xb78ff3];return _0x563e4e;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6b9d133..16af150 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 _0x9a86=['rawAttributes','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','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','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','reject','update','then','sendStatus','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x3af7b0,_0x5beae9){var _0x255154=function(_0xb5262c){while(--_0xb5262c){_0x3af7b0['push'](_0x3af7b0['shift']());}};_0x255154(++_0x5beae9);}(_0x9a86,0x1ce));var _0x69a8=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x9a86[_0x4bd06e];return _0x85ebb;};'use strict';var emlformat=require(_0x69a8('0x0'));var rimraf=require(_0x69a8('0x1'));var zipdir=require(_0x69a8('0x2'));var jsonpatch=require(_0x69a8('0x3'));var rp=require(_0x69a8('0x4'));var moment=require(_0x69a8('0x5'));var BPromise=require(_0x69a8('0x6'));var Mustache=require(_0x69a8('0x7'));var util=require(_0x69a8('0x8'));var path=require(_0x69a8('0x9'));var sox=require(_0x69a8('0xa'));var csv=require(_0x69a8('0xb'));var ejs=require(_0x69a8('0xc'));var fs=require('fs');var fs_extra=require(_0x69a8('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x69a8('0xe'));var deskjs=require(_0x69a8('0xf'));var toCsv=require(_0x69a8('0xb'));var querystring=require(_0x69a8('0x10'));var Papa=require(_0x69a8('0x11'));var Redis=require(_0x69a8('0x12'));var authService=require(_0x69a8('0x13'));var qs=require(_0x69a8('0x14'));var as=require(_0x69a8('0x15'));var hardwareService=require(_0x69a8('0x16'));var logger=require(_0x69a8('0x17'))('api');var utils=require(_0x69a8('0x18'));var config=require(_0x69a8('0x19'));var licenseUtil=require(_0x69a8('0x1a'));var db=require(_0x69a8('0x1b'))['db'];function respondWithStatusCode(_0x2a7d09,_0x4ef881){_0x4ef881=_0x4ef881||0xcc;return function(_0xfc61a8){if(_0xfc61a8){return _0x2a7d09['sendStatus'](_0x4ef881);}return _0x2a7d09[_0x69a8('0x1c')](_0x4ef881)[_0x69a8('0x1d')]();};}function respondWithResult(_0x3a347d,_0x24b715){_0x24b715=_0x24b715||0xc8;return function(_0x2afdea){if(_0x2afdea){return _0x3a347d[_0x69a8('0x1c')](_0x24b715)[_0x69a8('0x1e')](_0x2afdea);}};}function respondWithFilteredResult(_0x554612,_0x34bac4){return function(_0x5c8e0b){if(_0x5c8e0b){var _0x3c6725=typeof _0x34bac4[_0x69a8('0x1f')]==='undefined'&&typeof _0x34bac4['limit']==='undefined';var _0x4bd347=_0x5c8e0b[_0x69a8('0x20')];var _0xa8946e=_0x3c6725?0x0:_0x34bac4[_0x69a8('0x1f')];var _0xa7f9f9=_0x3c6725?_0x5c8e0b[_0x69a8('0x20')]:_0x34bac4[_0x69a8('0x1f')]+_0x34bac4[_0x69a8('0x21')];var _0x7c07c6;if(_0xa7f9f9>=_0x4bd347){_0xa7f9f9=_0x4bd347;_0x7c07c6=0xc8;}else{_0x7c07c6=0xce;}_0x554612[_0x69a8('0x1c')](_0x7c07c6);return _0x554612[_0x69a8('0x22')](_0x69a8('0x23'),_0xa8946e+'-'+_0xa7f9f9+'/'+_0x4bd347)['json'](_0x5c8e0b);}return null;};}function patchUpdates(_0x2c2324){return function(_0x51e85f){try{jsonpatch['apply'](_0x51e85f,_0x2c2324,!![]);}catch(_0x1262ca){return BPromise[_0x69a8('0x24')](_0x1262ca);}return _0x51e85f['save']();};}function saveUpdates(_0xe725e1,_0x69d599){return function(_0xce6ff0){if(_0xce6ff0){return _0xce6ff0[_0x69a8('0x25')](_0xe725e1)['then'](function(_0x1d9c90){return _0x1d9c90;});}return null;};}function removeEntity(_0x205a29,_0x3dadde){return function(_0x46089f){if(_0x46089f){return _0x46089f['destroy']()[_0x69a8('0x26')](function(){_0x205a29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fcd27,_0x3cbd85){return function(_0x2c6d03){if(!_0x2c6d03){_0x4fcd27[_0x69a8('0x27')](0x194);}return _0x2c6d03;};}function handleError(_0x561212,_0x5e19df){_0x5e19df=_0x5e19df||0x1f4;return function(_0x274cb3){logger['error'](_0x274cb3[_0x69a8('0x28')]);if(_0x274cb3[_0x69a8('0x29')]){delete _0x274cb3[_0x69a8('0x29')];}_0x561212['status'](_0x5e19df)[_0x69a8('0x2a')](_0x274cb3);};}exports[_0x69a8('0x2b')]=function(_0x450d9a,_0x528ce8){var _0xac3a23={},_0x2aae9c={},_0x5e95fd={'count':0x0,'rows':[]};var _0x39d3b3=_[_0x69a8('0x2c')](db[_0x69a8('0x2d')]['rawAttributes'],function(_0x16f995){return{'name':_0x16f995[_0x69a8('0x2e')],'type':_0x16f995[_0x69a8('0x2f')][_0x69a8('0x30')]};});_0x2aae9c[_0x69a8('0x31')]=_[_0x69a8('0x2c')](_0x39d3b3,'name');_0x2aae9c[_0x69a8('0x32')]=_[_0x69a8('0x33')](_0x450d9a['query']);_0x2aae9c[_0x69a8('0x34')]=_[_0x69a8('0x35')](_0x2aae9c[_0x69a8('0x31')],_0x2aae9c[_0x69a8('0x32')]);_0xac3a23[_0x69a8('0x36')]=_['intersection'](_0x2aae9c[_0x69a8('0x31')],qs[_0x69a8('0x37')](_0x450d9a['query'][_0x69a8('0x37')]));_0xac3a23[_0x69a8('0x36')]=_0xac3a23[_0x69a8('0x36')][_0x69a8('0x38')]?_0xac3a23['attributes']:_0x2aae9c[_0x69a8('0x31')];if(!_0x450d9a[_0x69a8('0x32')][_0x69a8('0x39')]('nolimit')){_0xac3a23['limit']=qs[_0x69a8('0x21')](_0x450d9a[_0x69a8('0x32')][_0x69a8('0x21')]);_0xac3a23[_0x69a8('0x1f')]=qs[_0x69a8('0x1f')](_0x450d9a[_0x69a8('0x32')]['offset']);}_0xac3a23[_0x69a8('0x3a')]=qs[_0x69a8('0x3b')](_0x450d9a[_0x69a8('0x32')][_0x69a8('0x3b')]);_0xac3a23[_0x69a8('0x3c')]=qs[_0x69a8('0x34')](_['pick'](_0x450d9a[_0x69a8('0x32')],_0x2aae9c[_0x69a8('0x34')]),_0x39d3b3);if(_0x450d9a[_0x69a8('0x32')][_0x69a8('0x3d')]){_0xac3a23[_0x69a8('0x3c')]=_[_0x69a8('0x3e')](_0xac3a23[_0x69a8('0x3c')],{'$or':_['map'](_0x39d3b3,function(_0x472808){if(_0x472808[_0x69a8('0x2f')]!=='VIRTUAL'){var _0xfd0c15={};_0xfd0c15[_0x472808[_0x69a8('0x29')]]={'$like':'%'+_0x450d9a['query'][_0x69a8('0x3d')]+'%'};return _0xfd0c15;}})});}_0xac3a23=_[_0x69a8('0x3e')]({},_0xac3a23,_0x450d9a[_0x69a8('0x3f')]);var _0x1a64f4={'where':_0xac3a23[_0x69a8('0x3c')]};return db['OpenchannelTransferReport'][_0x69a8('0x20')](_0x1a64f4)[_0x69a8('0x26')](function(_0x419ae3){_0x5e95fd[_0x69a8('0x20')]=_0x419ae3;if(_0x450d9a[_0x69a8('0x32')][_0x69a8('0x40')]){_0xac3a23[_0x69a8('0x41')]=[{'all':!![]}];}return db[_0x69a8('0x2d')]['findAll'](_0xac3a23);})[_0x69a8('0x26')](function(_0x21c583){_0x5e95fd[_0x69a8('0x42')]=_0x21c583;return _0x5e95fd;})[_0x69a8('0x26')](respondWithFilteredResult(_0x528ce8,_0xac3a23))[_0x69a8('0x43')](handleError(_0x528ce8,null));};exports[_0x69a8('0x44')]=function(_0x1a712e,_0x3c9f38){var _0x291f2a={'raw':!![],'where':{'id':_0x1a712e[_0x69a8('0x45')]['id']}},_0x58ce51={};_0x58ce51[_0x69a8('0x31')]=_['keys'](db[_0x69a8('0x2d')][_0x69a8('0x46')]);_0x58ce51[_0x69a8('0x32')]=_[_0x69a8('0x33')](_0x1a712e[_0x69a8('0x32')]);_0x58ce51[_0x69a8('0x34')]=_['intersection'](_0x58ce51[_0x69a8('0x31')],_0x58ce51[_0x69a8('0x32')]);_0x291f2a[_0x69a8('0x36')]=_['intersection'](_0x58ce51['model'],qs[_0x69a8('0x37')](_0x1a712e[_0x69a8('0x32')][_0x69a8('0x37')]));_0x291f2a[_0x69a8('0x36')]=_0x291f2a[_0x69a8('0x36')]['length']?_0x291f2a[_0x69a8('0x36')]:_0x58ce51[_0x69a8('0x31')];if(_0x1a712e['query'][_0x69a8('0x40')]){_0x291f2a['include']=[{'all':!![]}];}_0x291f2a=_['merge']({},_0x291f2a,_0x1a712e['options']);return db[_0x69a8('0x2d')][_0x69a8('0x47')](_0x291f2a)[_0x69a8('0x26')](handleEntityNotFound(_0x3c9f38,null))[_0x69a8('0x26')](respondWithResult(_0x3c9f38,null))[_0x69a8('0x43')](handleError(_0x3c9f38,null));};exports[_0x69a8('0x48')]=function(_0x598f93,_0x44783a){return db[_0x69a8('0x2d')][_0x69a8('0x48')](_0x598f93[_0x69a8('0x49')],{})[_0x69a8('0x26')](respondWithResult(_0x44783a,0xc9))[_0x69a8('0x43')](handleError(_0x44783a,null));};exports[_0x69a8('0x25')]=function(_0x505afe,_0x273618){if(_0x505afe[_0x69a8('0x49')]['id']){delete _0x505afe[_0x69a8('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x505afe['params']['id']}})[_0x69a8('0x26')](handleEntityNotFound(_0x273618,null))[_0x69a8('0x26')](saveUpdates(_0x505afe[_0x69a8('0x49')],null))['then'](respondWithResult(_0x273618,null))[_0x69a8('0x43')](handleError(_0x273618,null));};exports[_0x69a8('0x4a')]=function(_0x4f5356,_0x564215){return db[_0x69a8('0x2d')][_0x69a8('0x47')]({'where':{'id':_0x4f5356[_0x69a8('0x45')]['id']}})[_0x69a8('0x26')](handleEntityNotFound(_0x564215,null))['then'](removeEntity(_0x564215,null))[_0x69a8('0x43')](handleError(_0x564215,null));};exports[_0x69a8('0x4b')]=function(_0x2d83b0,_0x3d06ee){return db['OpenchannelTransferReport'][_0x69a8('0x4b')]()['then'](respondWithResult(_0x3d06ee,null))['catch'](handleError(_0x3d06ee,null));}; \ No newline at end of file +var _0x5665=['querystring','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','undefined','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','include','findAll','rows','catch','show','rawAttributes','merge','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x5665,0xd8));var _0x5566=function(_0x22db36,_0x3e8fc6){_0x22db36=_0x22db36-0x0;var _0x3d59e9=_0x5665[_0x22db36];return _0x3d59e9;};'use strict';var emlformat=require(_0x5566('0x0'));var rimraf=require(_0x5566('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5566('0x2'));var rp=require(_0x5566('0x3'));var moment=require(_0x5566('0x4'));var BPromise=require(_0x5566('0x5'));var Mustache=require('mustache');var util=require(_0x5566('0x6'));var path=require('path');var sox=require(_0x5566('0x7'));var csv=require('to-csv');var ejs=require(_0x5566('0x8'));var fs=require('fs');var fs_extra=require(_0x5566('0x9'));var _=require(_0x5566('0xa'));var squel=require(_0x5566('0xb'));var crypto=require('crypto');var jsforce=require(_0x5566('0xc'));var deskjs=require(_0x5566('0xd'));var toCsv=require(_0x5566('0xe'));var querystring=require(_0x5566('0xf'));var Papa=require(_0x5566('0x10'));var Redis=require(_0x5566('0x11'));var authService=require(_0x5566('0x12'));var qs=require(_0x5566('0x13'));var as=require(_0x5566('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5566('0x15'))(_0x5566('0x16'));var utils=require(_0x5566('0x17'));var config=require(_0x5566('0x18'));var licenseUtil=require(_0x5566('0x19'));var db=require(_0x5566('0x1a'))['db'];function respondWithStatusCode(_0x4e0ced,_0x8ec27e){_0x8ec27e=_0x8ec27e||0xcc;return function(_0x2d8932){if(_0x2d8932){return _0x4e0ced[_0x5566('0x1b')](_0x8ec27e);}return _0x4e0ced[_0x5566('0x1c')](_0x8ec27e)[_0x5566('0x1d')]();};}function respondWithResult(_0x4ec931,_0x4555e6){_0x4555e6=_0x4555e6||0xc8;return function(_0x1d0ce5){if(_0x1d0ce5){return _0x4ec931[_0x5566('0x1c')](_0x4555e6)[_0x5566('0x1e')](_0x1d0ce5);}};}function respondWithFilteredResult(_0x36748b,_0xb6e566){return function(_0x31f869){if(_0x31f869){var _0x1e6b5d=typeof _0xb6e566[_0x5566('0x1f')]===_0x5566('0x20')&&typeof _0xb6e566['limit']===_0x5566('0x20');var _0x4729c4=_0x31f869['count'];var _0x265614=_0x1e6b5d?0x0:_0xb6e566[_0x5566('0x1f')];var _0x5bbd47=_0x1e6b5d?_0x31f869['count']:_0xb6e566[_0x5566('0x1f')]+_0xb6e566['limit'];var _0x1e5d28;if(_0x5bbd47>=_0x4729c4){_0x5bbd47=_0x4729c4;_0x1e5d28=0xc8;}else{_0x1e5d28=0xce;}_0x36748b[_0x5566('0x1c')](_0x1e5d28);return _0x36748b[_0x5566('0x21')]('Content-Range',_0x265614+'-'+_0x5bbd47+'/'+_0x4729c4)[_0x5566('0x1e')](_0x31f869);}return null;};}function patchUpdates(_0x23a2ac){return function(_0x5174dd){try{jsonpatch[_0x5566('0x22')](_0x5174dd,_0x23a2ac,!![]);}catch(_0x1a45b7){return BPromise[_0x5566('0x23')](_0x1a45b7);}return _0x5174dd[_0x5566('0x24')]();};}function saveUpdates(_0x53a5ad,_0x43d55e){return function(_0x1d5e3f){if(_0x1d5e3f){return _0x1d5e3f['update'](_0x53a5ad)[_0x5566('0x25')](function(_0xc7b22d){return _0xc7b22d;});}return null;};}function removeEntity(_0x4885d3,_0x316b9e){return function(_0x5fe900){if(_0x5fe900){return _0x5fe900[_0x5566('0x26')]()[_0x5566('0x25')](function(){_0x4885d3[_0x5566('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20c167,_0x48314e){return function(_0x320889){if(!_0x320889){_0x20c167[_0x5566('0x1b')](0x194);}return _0x320889;};}function handleError(_0x4f866b,_0x441b3b){_0x441b3b=_0x441b3b||0x1f4;return function(_0x3eae11){logger[_0x5566('0x27')](_0x3eae11[_0x5566('0x28')]);if(_0x3eae11['name']){delete _0x3eae11[_0x5566('0x29')];}_0x4f866b[_0x5566('0x1c')](_0x441b3b)[_0x5566('0x2a')](_0x3eae11);};}exports[_0x5566('0x2b')]=function(_0x5b77aa,_0x131a25){var _0x9b3f2e={},_0x398fc6={},_0x58cbe4={'count':0x0,'rows':[]};var _0x11e169=_[_0x5566('0x2c')](db[_0x5566('0x2d')]['rawAttributes'],function(_0x5de71a){return{'name':_0x5de71a[_0x5566('0x2e')],'type':_0x5de71a[_0x5566('0x2f')]['key']};});_0x398fc6[_0x5566('0x30')]=_[_0x5566('0x2c')](_0x11e169,_0x5566('0x29'));_0x398fc6['query']=_[_0x5566('0x31')](_0x5b77aa[_0x5566('0x32')]);_0x398fc6[_0x5566('0x33')]=_[_0x5566('0x34')](_0x398fc6[_0x5566('0x30')],_0x398fc6[_0x5566('0x32')]);_0x9b3f2e['attributes']=_[_0x5566('0x34')](_0x398fc6[_0x5566('0x30')],qs[_0x5566('0x35')](_0x5b77aa['query'][_0x5566('0x35')]));_0x9b3f2e[_0x5566('0x36')]=_0x9b3f2e[_0x5566('0x36')][_0x5566('0x37')]?_0x9b3f2e['attributes']:_0x398fc6[_0x5566('0x30')];if(!_0x5b77aa[_0x5566('0x32')][_0x5566('0x38')](_0x5566('0x39'))){_0x9b3f2e['limit']=qs['limit'](_0x5b77aa[_0x5566('0x32')]['limit']);_0x9b3f2e[_0x5566('0x1f')]=qs[_0x5566('0x1f')](_0x5b77aa['query']['offset']);}_0x9b3f2e[_0x5566('0x3a')]=qs[_0x5566('0x3b')](_0x5b77aa[_0x5566('0x32')]['sort']);_0x9b3f2e[_0x5566('0x3c')]=qs['filters'](_[_0x5566('0x3d')](_0x5b77aa['query'],_0x398fc6[_0x5566('0x33')]),_0x11e169);if(_0x5b77aa['query'][_0x5566('0x3e')]){_0x9b3f2e['where']=_['merge'](_0x9b3f2e[_0x5566('0x3c')],{'$or':_[_0x5566('0x2c')](_0x11e169,function(_0x27ccc9){if(_0x27ccc9[_0x5566('0x2f')]!==_0x5566('0x3f')){var _0x2cdab6={};_0x2cdab6[_0x27ccc9[_0x5566('0x29')]]={'$like':'%'+_0x5b77aa['query'][_0x5566('0x3e')]+'%'};return _0x2cdab6;}})});}_0x9b3f2e=_['merge']({},_0x9b3f2e,_0x5b77aa[_0x5566('0x40')]);var _0x843540={'where':_0x9b3f2e[_0x5566('0x3c')]};return db[_0x5566('0x2d')][_0x5566('0x41')](_0x843540)['then'](function(_0x4c1bd7){_0x58cbe4[_0x5566('0x41')]=_0x4c1bd7;if(_0x5b77aa[_0x5566('0x32')]['includeAll']){_0x9b3f2e[_0x5566('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x5566('0x43')](_0x9b3f2e);})[_0x5566('0x25')](function(_0x365eb8){_0x58cbe4[_0x5566('0x44')]=_0x365eb8;return _0x58cbe4;})[_0x5566('0x25')](respondWithFilteredResult(_0x131a25,_0x9b3f2e))[_0x5566('0x45')](handleError(_0x131a25,null));};exports[_0x5566('0x46')]=function(_0x62560e,_0x17d2c7){var _0x3ae087={'raw':!![],'where':{'id':_0x62560e['params']['id']}},_0x2703bd={};_0x2703bd[_0x5566('0x30')]=_[_0x5566('0x31')](db['OpenchannelTransferReport'][_0x5566('0x47')]);_0x2703bd['query']=_['keys'](_0x62560e[_0x5566('0x32')]);_0x2703bd[_0x5566('0x33')]=_[_0x5566('0x34')](_0x2703bd[_0x5566('0x30')],_0x2703bd[_0x5566('0x32')]);_0x3ae087[_0x5566('0x36')]=_['intersection'](_0x2703bd[_0x5566('0x30')],qs['fields'](_0x62560e[_0x5566('0x32')][_0x5566('0x35')]));_0x3ae087[_0x5566('0x36')]=_0x3ae087[_0x5566('0x36')][_0x5566('0x37')]?_0x3ae087[_0x5566('0x36')]:_0x2703bd[_0x5566('0x30')];if(_0x62560e[_0x5566('0x32')]['includeAll']){_0x3ae087['include']=[{'all':!![]}];}_0x3ae087=_[_0x5566('0x48')]({},_0x3ae087,_0x62560e[_0x5566('0x40')]);return db['OpenchannelTransferReport'][_0x5566('0x49')](_0x3ae087)['then'](handleEntityNotFound(_0x17d2c7,null))['then'](respondWithResult(_0x17d2c7,null))[_0x5566('0x45')](handleError(_0x17d2c7,null));};exports[_0x5566('0x4a')]=function(_0x468588,_0x206d61){return db[_0x5566('0x2d')][_0x5566('0x4a')](_0x468588[_0x5566('0x4b')],{})['then'](respondWithResult(_0x206d61,0xc9))[_0x5566('0x45')](handleError(_0x206d61,null));};exports['update']=function(_0x240185,_0x3f6d6c){if(_0x240185[_0x5566('0x4b')]['id']){delete _0x240185['body']['id'];}return db['OpenchannelTransferReport'][_0x5566('0x49')]({'where':{'id':_0x240185['params']['id']}})['then'](handleEntityNotFound(_0x3f6d6c,null))['then'](saveUpdates(_0x240185['body'],null))[_0x5566('0x25')](respondWithResult(_0x3f6d6c,null))['catch'](handleError(_0x3f6d6c,null));};exports[_0x5566('0x26')]=function(_0x3bec37,_0x412407){return db['OpenchannelTransferReport'][_0x5566('0x49')]({'where':{'id':_0x3bec37[_0x5566('0x4c')]['id']}})[_0x5566('0x25')](handleEntityNotFound(_0x412407,null))['then'](removeEntity(_0x412407,null))[_0x5566('0x45')](handleError(_0x412407,null));};exports['describe']=function(_0x4d37a4,_0x56ee1d){return db[_0x5566('0x2d')]['describe']()[_0x5566('0x25')](respondWithResult(_0x56ee1d,null))['catch'](handleError(_0x56ee1d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f90c74b..c526849 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 _0x4d3f=['report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport'];(function(_0x19f80c,_0x3a283c){var _0x5bc5d9=function(_0x3381dd){while(--_0x3381dd){_0x19f80c['push'](_0x19f80c['shift']());}};_0x5bc5d9(++_0x3a283c);}(_0x4d3f,0xfe));var _0xf4d3=function(_0x51a4a6,_0x369184){_0x51a4a6=_0x51a4a6-0x0;var _0x4d16fb=_0x4d3f[_0x51a4a6];return _0x4d16fb;};'use strict';var _=require('lodash');var util=require(_0xf4d3('0x0'));var logger=require(_0xf4d3('0x1'))(_0xf4d3('0x2'));var moment=require(_0xf4d3('0x3'));var BPromise=require(_0xf4d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4d3('0x5'));var rimraf=require(_0xf4d3('0x6'));var config=require(_0xf4d3('0x7'));var attributes=require(_0xf4d3('0x8'));module['exports']=function(_0x52662d,_0x107833){return _0x52662d['define'](_0xf4d3('0x9'),attributes,{'tableName':_0xf4d3('0xa'),'paranoid':![],'indexes':[{'name':_0xf4d3('0xb'),'fields':[_0xf4d3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64ad=['report_openchannel_transfer','uniqueid','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x64ad,0xec));var _0xd64a=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x64ad[_0x4bfe08];return _0x1f9125;};'use strict';var _=require(_0xd64a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd64a('0x1'));var moment=require(_0xd64a('0x2'));var BPromise=require(_0xd64a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd64a('0x4'));var rimraf=require(_0xd64a('0x5'));var config=require(_0xd64a('0x6'));var attributes=require(_0xd64a('0x7'));module[_0xd64a('0x8')]=function(_0x103500,_0x37851c){return _0x103500[_0xd64a('0x9')](_0xd64a('0xa'),attributes,{'tableName':_0xd64a('0xb'),'paranoid':![],'indexes':[{'name':_0xd64a('0xc'),'fields':[_0xd64a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index b1f2605..b700522 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 _0x0958=['moment','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util'];(function(_0x1431ef,_0x865f44){var _0x110131=function(_0x1d47d2){while(--_0x1d47d2){_0x1431ef['push'](_0x1431ef['shift']());}};_0x110131(++_0x865f44);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var moment=require(_0x8095('0x2'));var BPromise=require('bluebird');var rs=require(_0x8095('0x3'));var fs=require('fs');var Redis=require(_0x8095('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8095('0x5'))(_0x8095('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8095('0x7')][_0x8095('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x439ecc,_0x1dac39,_0x1fac84){return new BPromise(function(_0x4d5ee3,_0x5a19ef){return client[_0x8095('0x9')](_0x439ecc,_0x1fac84)[_0x8095('0xa')](function(_0x4967a5){logger['info'](_0x8095('0xb'),_0x1dac39,'request\x20sent');logger[_0x8095('0xc')](_0x8095('0xd'),_0x1dac39,_0x8095('0xe'),JSON[_0x8095('0xf')](_0x4967a5));if(_0x4967a5[_0x8095('0x10')]){if(_0x4967a5['error'][_0x8095('0x11')]===0x1f4){logger['error'](_0x8095('0xb'),_0x1dac39,_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);return _0x5a19ef(_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);}logger[_0x8095('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1dac39,_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);return _0x4d5ee3(_0x4967a5[_0x8095('0x10')]['message']);}else{logger[_0x8095('0x13')](_0x8095('0xb'),_0x1dac39,_0x8095('0xe'));_0x4d5ee3(_0x4967a5[_0x8095('0x14')][_0x8095('0x12')]);}})['catch'](function(_0x1b1ca3){logger[_0x8095('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1dac39,_0x1b1ca3);_0x5a19ef(_0x1b1ca3);});});} \ No newline at end of file +var _0xdc59=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x209388,_0xe7a739){var _0x472957=function(_0x4b6338){while(--_0x4b6338){_0x209388['push'](_0x209388['shift']());}};_0x472957(++_0xe7a739);}(_0xdc59,0x12c));var _0x9dc5=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xdc59[_0x243217];return _0x478029;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var moment=require(_0x9dc5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc5('0x3'));var db=require(_0x9dc5('0x4'))['db'];var utils=require(_0x9dc5('0x5'));var logger=require(_0x9dc5('0x6'))(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var jayson=require(_0x9dc5('0x9'));var client=jayson[_0x9dc5('0xa')][_0x9dc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48beee,_0x42941b,_0x10b268){return new BPromise(function(_0x202a8a,_0x3729b6){return client[_0x9dc5('0xc')](_0x48beee,_0x10b268)[_0x9dc5('0xd')](function(_0x174835){logger[_0x9dc5('0xe')](_0x9dc5('0xf'),_0x42941b,_0x9dc5('0x10'));logger['debug'](_0x9dc5('0x11'),_0x42941b,_0x9dc5('0x10'),JSON[_0x9dc5('0x12')](_0x174835));if(_0x174835[_0x9dc5('0x13')]){if(_0x174835['error'][_0x9dc5('0x14')]===0x1f4){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835['error'][_0x9dc5('0x15')]);return _0x3729b6(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);return _0x202a8a(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}else{logger[_0x9dc5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42941b,_0x9dc5('0x10'));_0x202a8a(_0x174835['result'][_0x9dc5('0x15')]);}})[_0x9dc5('0x16')](function(_0x5a9ffb){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x5a9ffb);_0x3729b6(_0x5a9ffb);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1e41d54..4b05473 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 _0x1648=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x5f2e95,_0x3684bb){var _0x158621=function(_0x1929b7){while(--_0x1929b7){_0x5f2e95['push'](_0x5f2e95['shift']());}};_0x158621(++_0x3684bb);}(_0x1648,0xa7));var _0x8164=function(_0x346923,_0x460e97){_0x346923=_0x346923-0x0;var _0x3b0ca7=_0x1648[_0x346923];return _0x3b0ca7;};'use strict';var multer=require(_0x8164('0x0'));var util=require(_0x8164('0x1'));var path=require(_0x8164('0x2'));var timeout=require(_0x8164('0x3'));var express=require(_0x8164('0x4'));var router=express[_0x8164('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8164('0x6'));var interaction=require(_0x8164('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x8164('0x8')]('/',auth[_0x8164('0x9')](),controller[_0x8164('0xa')]);router[_0x8164('0x8')]('/:id',auth[_0x8164('0x9')](),controller[_0x8164('0xb')]);router[_0x8164('0xc')]('/',auth[_0x8164('0x9')](),controller[_0x8164('0xd')]);router[_0x8164('0xe')]('/:id',auth[_0x8164('0x9')](),controller[_0x8164('0xf')]);router[_0x8164('0x10')](_0x8164('0x11'),auth[_0x8164('0x9')](),controller[_0x8164('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x741334,_0x4dadd8){var _0x11f9e0=function(_0x96e2a5){while(--_0x96e2a5){_0x741334['push'](_0x741334['shift']());}};_0x11f9e0(++_0x4dadd8);}(_0xdb28,0x1ae));var _0x8db2=function(_0x2a05a8,_0x1b9cf3){_0x2a05a8=_0x2a05a8-0x0;var _0x3773af=_0xdb28[_0x2a05a8];return _0x3773af;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var controller=require(_0x8db2('0x8'));router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xb')]);router[_0x8db2('0x9')](_0x8db2('0xc'),auth['isAuthenticated'](),controller[_0x8db2('0xd')]);router[_0x8db2('0xe')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')](_0x8db2('0xc'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router[_0x8db2('0x12')](_0x8db2('0xc'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);module[_0x8db2('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8bc2a54..16ecbb6 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 _0x51c5=['STRING','name','sequelize','exports'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x51c5,0x16e));var _0x551c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x51c5[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0x551c('0x0'));module[_0x551c('0x1')]={'name':{'type':Sequelize[_0x551c('0x2')],'unique':_0x551c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x551c('0x2')]}}; \ No newline at end of file +var _0xa918=['STRING','name','sequelize'];(function(_0x389074,_0x1e87dc){var _0x30a1c9=function(_0x29755){while(--_0x29755){_0x389074['push'](_0x389074['shift']());}};_0x30a1c9(++_0x1e87dc);}(_0xa918,0xb3));var _0x8a91=function(_0x80ea0b,_0x2e87bd){_0x80ea0b=_0x80ea0b-0x0;var _0x5e7f72=_0xa918[_0x80ea0b];return _0x5e7f72;};'use strict';var Sequelize=require(_0x8a91('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a91('0x1')],'unique':_0x8a91('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8a91('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c7a368b..69671df 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 _0x247a=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','Pauses','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','catch','show','params','find','create','body','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x247a,0x123));var _0xa247=function(_0x3a8b2d,_0x4ea870){_0x3a8b2d=_0x3a8b2d-0x0;var _0x54f1be=_0x247a[_0x3a8b2d];return _0x54f1be;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa247('0x0'));var jsonpatch=require(_0xa247('0x1'));var rp=require(_0xa247('0x2'));var moment=require(_0xa247('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa247('0x4'));var util=require('util');var path=require(_0xa247('0x5'));var sox=require(_0xa247('0x6'));var csv=require(_0xa247('0x7'));var ejs=require(_0xa247('0x8'));var fs=require('fs');var fs_extra=require(_0xa247('0x9'));var _=require(_0xa247('0xa'));var squel=require('squel');var crypto=require(_0xa247('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa247('0x7'));var querystring=require(_0xa247('0xc'));var Papa=require(_0xa247('0xd'));var Redis=require(_0xa247('0xe'));var authService=require(_0xa247('0xf'));var qs=require(_0xa247('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa247('0x11'));var logger=require(_0xa247('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa247('0x13'));var licenseUtil=require(_0xa247('0x14'));var db=require(_0xa247('0x15'))['db'];function respondWithStatusCode(_0x4e6d97,_0x4efc2a){_0x4efc2a=_0x4efc2a||0xcc;return function(_0x3774b4){if(_0x3774b4){return _0x4e6d97[_0xa247('0x16')](_0x4efc2a);}return _0x4e6d97[_0xa247('0x17')](_0x4efc2a)['end']();};}function respondWithResult(_0x53dbb0,_0x596eed){_0x596eed=_0x596eed||0xc8;return function(_0x146560){if(_0x146560){return _0x53dbb0[_0xa247('0x17')](_0x596eed)['json'](_0x146560);}};}function respondWithFilteredResult(_0x53891c,_0x34d6d9){return function(_0x516786){if(_0x516786){var _0x3ad8de=typeof _0x34d6d9[_0xa247('0x18')]===_0xa247('0x19')&&typeof _0x34d6d9[_0xa247('0x1a')]===_0xa247('0x19');var _0x3c45db=_0x516786[_0xa247('0x1b')];var _0x103532=_0x3ad8de?0x0:_0x34d6d9['offset'];var _0x59f332=_0x3ad8de?_0x516786['count']:_0x34d6d9[_0xa247('0x18')]+_0x34d6d9[_0xa247('0x1a')];var _0x56517f;if(_0x59f332>=_0x3c45db){_0x59f332=_0x3c45db;_0x56517f=0xc8;}else{_0x56517f=0xce;}_0x53891c[_0xa247('0x17')](_0x56517f);return _0x53891c['set'](_0xa247('0x1c'),_0x103532+'-'+_0x59f332+'/'+_0x3c45db)[_0xa247('0x1d')](_0x516786);}return null;};}function patchUpdates(_0x3b4886){return function(_0x116540){try{jsonpatch['apply'](_0x116540,_0x3b4886,!![]);}catch(_0x28e0b7){return BPromise[_0xa247('0x1e')](_0x28e0b7);}return _0x116540[_0xa247('0x1f')]();};}function saveUpdates(_0x3d85a2,_0x31a031){return function(_0x274aad){if(_0x274aad){return _0x274aad[_0xa247('0x20')](_0x3d85a2)[_0xa247('0x21')](function(_0xcaf894){return _0xcaf894;});}return null;};}function removeEntity(_0x149e48,_0x12be85){return function(_0x3219dc){if(_0x3219dc){return _0x3219dc[_0xa247('0x22')]()[_0xa247('0x21')](function(){var _0x4d6784=_0x3219dc[_0xa247('0x23')]({'plain':!![]});var _0x2f0cc2=_0xa247('0x24');return db['UserProfileResource'][_0xa247('0x22')]({'where':{'type':_0x2f0cc2,'resourceId':_0x4d6784['id']}})[_0xa247('0x21')](function(){return _0x3219dc;});})[_0xa247('0x21')](function(){_0x149e48[_0xa247('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aee63,_0xe0ce9a){return function(_0x40d2dc){if(!_0x40d2dc){_0x5aee63[_0xa247('0x16')](0x194);}return _0x40d2dc;};}function handleError(_0x194ebd,_0x519325){_0x519325=_0x519325||0x1f4;return function(_0x5ed9aa){logger[_0xa247('0x25')](_0x5ed9aa['stack']);if(_0x5ed9aa['name']){delete _0x5ed9aa[_0xa247('0x26')];}_0x194ebd[_0xa247('0x17')](_0x519325)[_0xa247('0x27')](_0x5ed9aa);};}exports[_0xa247('0x28')]=function(_0x29bbba,_0x2bb8de){var _0x2cd02e={},_0x3b7b96={},_0x46016b={'count':0x0,'rows':[]};var _0x25c75e=_[_0xa247('0x29')](db['Pause'][_0xa247('0x2a')],function(_0x3b7158){return{'name':_0x3b7158[_0xa247('0x2b')],'type':_0x3b7158[_0xa247('0x2c')][_0xa247('0x2d')]};});_0x3b7b96[_0xa247('0x2e')]=_[_0xa247('0x29')](_0x25c75e,_0xa247('0x26'));_0x3b7b96[_0xa247('0x2f')]=_[_0xa247('0x30')](_0x29bbba['query']);_0x3b7b96[_0xa247('0x31')]=_[_0xa247('0x32')](_0x3b7b96[_0xa247('0x2e')],_0x3b7b96[_0xa247('0x2f')]);_0x2cd02e['attributes']=_[_0xa247('0x32')](_0x3b7b96['model'],qs[_0xa247('0x33')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x33')]));_0x2cd02e[_0xa247('0x34')]=_0x2cd02e['attributes'][_0xa247('0x35')]?_0x2cd02e['attributes']:_0x3b7b96[_0xa247('0x2e')];if(!_0x29bbba[_0xa247('0x2f')][_0xa247('0x36')]('nolimit')){_0x2cd02e[_0xa247('0x1a')]=qs[_0xa247('0x1a')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x1a')]);_0x2cd02e[_0xa247('0x18')]=qs[_0xa247('0x18')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x18')]);}_0x2cd02e[_0xa247('0x37')]=qs[_0xa247('0x38')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x38')]);_0x2cd02e[_0xa247('0x39')]=qs[_0xa247('0x31')](_[_0xa247('0x3a')](_0x29bbba['query'],_0x3b7b96[_0xa247('0x31')]),_0x25c75e);if(_0x29bbba['query'][_0xa247('0x3b')]){_0x2cd02e['where']=_[_0xa247('0x3c')](_0x2cd02e[_0xa247('0x39')],{'$or':_[_0xa247('0x29')](_0x25c75e,function(_0x51ebdc){if(_0x51ebdc[_0xa247('0x2c')]!==_0xa247('0x3d')){var _0x243897={};_0x243897[_0x51ebdc[_0xa247('0x26')]]={'$like':'%'+_0x29bbba[_0xa247('0x2f')][_0xa247('0x3b')]+'%'};return _0x243897;}})});}_0x2cd02e=_[_0xa247('0x3c')]({},_0x2cd02e,_0x29bbba[_0xa247('0x3e')]);var _0x6b7255={'where':_0x2cd02e[_0xa247('0x39')]};return db[_0xa247('0x3f')][_0xa247('0x1b')](_0x6b7255)[_0xa247('0x21')](function(_0x5a5401){_0x46016b['count']=_0x5a5401;if(_0x29bbba['query'][_0xa247('0x40')]){_0x2cd02e[_0xa247('0x41')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x2cd02e);})['then'](function(_0x2a8e81){_0x46016b['rows']=_0x2a8e81;return _0x46016b;})['then'](respondWithFilteredResult(_0x2bb8de,_0x2cd02e))[_0xa247('0x42')](handleError(_0x2bb8de,null));};exports[_0xa247('0x43')]=function(_0x1206a8,_0x231515){var _0x173b26={'raw':!![],'where':{'id':_0x1206a8[_0xa247('0x44')]['id']}},_0x1f541b={};_0x1f541b['model']=_[_0xa247('0x30')](db[_0xa247('0x3f')][_0xa247('0x2a')]);_0x1f541b[_0xa247('0x2f')]=_[_0xa247('0x30')](_0x1206a8['query']);_0x1f541b[_0xa247('0x31')]=_[_0xa247('0x32')](_0x1f541b['model'],_0x1f541b[_0xa247('0x2f')]);_0x173b26[_0xa247('0x34')]=_[_0xa247('0x32')](_0x1f541b['model'],qs[_0xa247('0x33')](_0x1206a8['query'][_0xa247('0x33')]));_0x173b26[_0xa247('0x34')]=_0x173b26[_0xa247('0x34')][_0xa247('0x35')]?_0x173b26[_0xa247('0x34')]:_0x1f541b[_0xa247('0x2e')];if(_0x1206a8[_0xa247('0x2f')][_0xa247('0x40')]){_0x173b26[_0xa247('0x41')]=[{'all':!![]}];}_0x173b26=_[_0xa247('0x3c')]({},_0x173b26,_0x1206a8[_0xa247('0x3e')]);return db[_0xa247('0x3f')][_0xa247('0x45')](_0x173b26)[_0xa247('0x21')](handleEntityNotFound(_0x231515,null))[_0xa247('0x21')](respondWithResult(_0x231515,null))[_0xa247('0x42')](handleError(_0x231515,null));};exports[_0xa247('0x46')]=function(_0x5d2b80,_0x169a0e){return db[_0xa247('0x3f')][_0xa247('0x46')](_0x5d2b80[_0xa247('0x47')],{})['then'](function(_0x20d309){var _0x3f2c08=_0x5d2b80['user']['get']({'plain':!![]});if(!_0x3f2c08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f2c08['role']===_0xa247('0x48')){var _0x322d16=_0x20d309[_0xa247('0x23')]({'plain':!![]});var _0x1fff95='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x1fff95,'userProfileId':_0x3f2c08[_0xa247('0x49')]},'raw':!![]})[_0xa247('0x21')](function(_0x39a5a6){if(_0x39a5a6&&_0x39a5a6[_0xa247('0x4a')]===0x0){return db[_0xa247('0x4b')]['create']({'name':_0x322d16[_0xa247('0x26')],'resourceId':_0x322d16['id'],'type':_0x39a5a6[_0xa247('0x26')],'sectionId':_0x39a5a6['id']},{})[_0xa247('0x21')](function(){return _0x20d309;});}else{return _0x20d309;}})['catch'](function(_0x59f76d){logger['error'](_0xa247('0x4c'),_0x59f76d);throw _0x59f76d;});}return _0x20d309;})[_0xa247('0x21')](respondWithResult(_0x169a0e,0xc9))['catch'](handleError(_0x169a0e,null));};exports[_0xa247('0x20')]=function(_0x1cee86,_0x403139){if(_0x1cee86[_0xa247('0x47')]['id']){delete _0x1cee86['body']['id'];}return db[_0xa247('0x3f')]['find']({'where':{'id':_0x1cee86[_0xa247('0x44')]['id']}})['then'](handleEntityNotFound(_0x403139,null))[_0xa247('0x21')](saveUpdates(_0x1cee86[_0xa247('0x47')],null))[_0xa247('0x21')](respondWithResult(_0x403139,null))['catch'](handleError(_0x403139,null));};exports['destroy']=function(_0x5cf0bb,_0x15cd34){return db['Pause'][_0xa247('0x45')]({'where':{'id':_0x5cf0bb[_0xa247('0x44')]['id']}})['then'](handleEntityNotFound(_0x15cd34,null))[_0xa247('0x21')](removeEntity(_0x15cd34,null))[_0xa247('0x42')](handleError(_0x15cd34,null));}; \ No newline at end of file +var _0x833f=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','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/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','Pauses','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','role','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x456a84,_0x46bc0b){var _0x1117d6=function(_0x20f9d1){while(--_0x20f9d1){_0x456a84['push'](_0x456a84['shift']());}};_0x1117d6(++_0x46bc0b);}(_0x833f,0x163));var _0xf833=function(_0x43d106,_0x96a475){_0x43d106=_0x43d106-0x0;var _0x2160bc=_0x833f[_0x43d106];return _0x2160bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf833('0x0'));var zipdir=require(_0xf833('0x1'));var jsonpatch=require(_0xf833('0x2'));var rp=require(_0xf833('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf833('0x4'));var util=require(_0xf833('0x5'));var path=require(_0xf833('0x6'));var sox=require('sox');var csv=require(_0xf833('0x7'));var ejs=require(_0xf833('0x8'));var fs=require('fs');var fs_extra=require(_0xf833('0x9'));var _=require(_0xf833('0xa'));var squel=require(_0xf833('0xb'));var crypto=require(_0xf833('0xc'));var jsforce=require(_0xf833('0xd'));var deskjs=require(_0xf833('0xe'));var toCsv=require(_0xf833('0x7'));var querystring=require(_0xf833('0xf'));var Papa=require(_0xf833('0x10'));var Redis=require(_0xf833('0x11'));var authService=require(_0xf833('0x12'));var qs=require(_0xf833('0x13'));var as=require(_0xf833('0x14'));var hardwareService=require(_0xf833('0x15'));var logger=require(_0xf833('0x16'))(_0xf833('0x17'));var utils=require(_0xf833('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf833('0x19'));var db=require(_0xf833('0x1a'))['db'];function respondWithStatusCode(_0x41f775,_0x45f747){_0x45f747=_0x45f747||0xcc;return function(_0x360ef8){if(_0x360ef8){return _0x41f775['sendStatus'](_0x45f747);}return _0x41f775[_0xf833('0x1b')](_0x45f747)[_0xf833('0x1c')]();};}function respondWithResult(_0x8aeefe,_0x602a02){_0x602a02=_0x602a02||0xc8;return function(_0x5db210){if(_0x5db210){return _0x8aeefe[_0xf833('0x1b')](_0x602a02)[_0xf833('0x1d')](_0x5db210);}};}function respondWithFilteredResult(_0x27c113,_0x425227){return function(_0xcb7581){if(_0xcb7581){var _0xb7affc=typeof _0x425227[_0xf833('0x1e')]===_0xf833('0x1f')&&typeof _0x425227[_0xf833('0x20')]===_0xf833('0x1f');var _0x1ecc03=_0xcb7581[_0xf833('0x21')];var _0x469b25=_0xb7affc?0x0:_0x425227['offset'];var _0x1ded33=_0xb7affc?_0xcb7581[_0xf833('0x21')]:_0x425227[_0xf833('0x1e')]+_0x425227['limit'];var _0x448a2a;if(_0x1ded33>=_0x1ecc03){_0x1ded33=_0x1ecc03;_0x448a2a=0xc8;}else{_0x448a2a=0xce;}_0x27c113['status'](_0x448a2a);return _0x27c113['set']('Content-Range',_0x469b25+'-'+_0x1ded33+'/'+_0x1ecc03)[_0xf833('0x1d')](_0xcb7581);}return null;};}function patchUpdates(_0x5f39e0){return function(_0x1c10d9){try{jsonpatch[_0xf833('0x22')](_0x1c10d9,_0x5f39e0,!![]);}catch(_0x3a8800){return BPromise[_0xf833('0x23')](_0x3a8800);}return _0x1c10d9[_0xf833('0x24')]();};}function saveUpdates(_0x21336e,_0x1cc6ee){return function(_0x11d2af){if(_0x11d2af){return _0x11d2af[_0xf833('0x25')](_0x21336e)[_0xf833('0x26')](function(_0x482c18){return _0x482c18;});}return null;};}function removeEntity(_0x4b267d,_0x1f3284){return function(_0x4ca446){if(_0x4ca446){return _0x4ca446[_0xf833('0x27')]()[_0xf833('0x26')](function(){var _0x200d8e=_0x4ca446[_0xf833('0x28')]({'plain':!![]});var _0x2bdda1=_0xf833('0x29');return db['UserProfileResource'][_0xf833('0x27')]({'where':{'type':_0x2bdda1,'resourceId':_0x200d8e['id']}})[_0xf833('0x26')](function(){return _0x4ca446;});})[_0xf833('0x26')](function(){_0x4b267d[_0xf833('0x1b')](0xcc)[_0xf833('0x1c')]();});}};}function handleEntityNotFound(_0x4a8f2a,_0x5da829){return function(_0x3353c3){if(!_0x3353c3){_0x4a8f2a[_0xf833('0x2a')](0x194);}return _0x3353c3;};}function handleError(_0x2bc16,_0x415c35){_0x415c35=_0x415c35||0x1f4;return function(_0x5b2063){logger[_0xf833('0x2b')](_0x5b2063[_0xf833('0x2c')]);if(_0x5b2063['name']){delete _0x5b2063[_0xf833('0x2d')];}_0x2bc16[_0xf833('0x1b')](_0x415c35)[_0xf833('0x2e')](_0x5b2063);};}exports[_0xf833('0x2f')]=function(_0x25350d,_0x5ebf54){var _0x50db6a={},_0x4f9231={},_0x30950d={'count':0x0,'rows':[]};var _0x4e434f=_[_0xf833('0x30')](db[_0xf833('0x31')][_0xf833('0x32')],function(_0x6d4da3){return{'name':_0x6d4da3[_0xf833('0x33')],'type':_0x6d4da3[_0xf833('0x34')][_0xf833('0x35')]};});_0x4f9231[_0xf833('0x36')]=_[_0xf833('0x30')](_0x4e434f,_0xf833('0x2d'));_0x4f9231['query']=_[_0xf833('0x37')](_0x25350d[_0xf833('0x38')]);_0x4f9231[_0xf833('0x39')]=_[_0xf833('0x3a')](_0x4f9231[_0xf833('0x36')],_0x4f9231[_0xf833('0x38')]);_0x50db6a[_0xf833('0x3b')]=_[_0xf833('0x3a')](_0x4f9231[_0xf833('0x36')],qs[_0xf833('0x3c')](_0x25350d[_0xf833('0x38')]['fields']));_0x50db6a['attributes']=_0x50db6a['attributes'][_0xf833('0x3d')]?_0x50db6a['attributes']:_0x4f9231[_0xf833('0x36')];if(!_0x25350d[_0xf833('0x38')][_0xf833('0x3e')](_0xf833('0x3f'))){_0x50db6a['limit']=qs[_0xf833('0x20')](_0x25350d[_0xf833('0x38')][_0xf833('0x20')]);_0x50db6a[_0xf833('0x1e')]=qs[_0xf833('0x1e')](_0x25350d[_0xf833('0x38')][_0xf833('0x1e')]);}_0x50db6a[_0xf833('0x40')]=qs['sort'](_0x25350d['query'][_0xf833('0x41')]);_0x50db6a['where']=qs[_0xf833('0x39')](_['pick'](_0x25350d[_0xf833('0x38')],_0x4f9231[_0xf833('0x39')]),_0x4e434f);if(_0x25350d[_0xf833('0x38')][_0xf833('0x42')]){_0x50db6a[_0xf833('0x43')]=_[_0xf833('0x44')](_0x50db6a[_0xf833('0x43')],{'$or':_['map'](_0x4e434f,function(_0x20ddcc){if(_0x20ddcc[_0xf833('0x34')]!==_0xf833('0x45')){var _0x76f0db={};_0x76f0db[_0x20ddcc[_0xf833('0x2d')]]={'$like':'%'+_0x25350d[_0xf833('0x38')][_0xf833('0x42')]+'%'};return _0x76f0db;}})});}_0x50db6a=_[_0xf833('0x44')]({},_0x50db6a,_0x25350d[_0xf833('0x46')]);var _0x460c2a={'where':_0x50db6a[_0xf833('0x43')]};return db[_0xf833('0x31')][_0xf833('0x21')](_0x460c2a)[_0xf833('0x26')](function(_0x6c1ade){_0x30950d[_0xf833('0x21')]=_0x6c1ade;if(_0x25350d[_0xf833('0x38')]['includeAll']){_0x50db6a[_0xf833('0x47')]=[{'all':!![]}];}return db['Pause'][_0xf833('0x48')](_0x50db6a);})[_0xf833('0x26')](function(_0x41f9ca){_0x30950d[_0xf833('0x49')]=_0x41f9ca;return _0x30950d;})['then'](respondWithFilteredResult(_0x5ebf54,_0x50db6a))[_0xf833('0x4a')](handleError(_0x5ebf54,null));};exports[_0xf833('0x4b')]=function(_0x2f22aa,_0xc0e2c0){var _0x130621={'raw':!![],'where':{'id':_0x2f22aa[_0xf833('0x4c')]['id']}},_0x251c65={};_0x251c65[_0xf833('0x36')]=_['keys'](db[_0xf833('0x31')][_0xf833('0x32')]);_0x251c65['query']=_[_0xf833('0x37')](_0x2f22aa[_0xf833('0x38')]);_0x251c65[_0xf833('0x39')]=_['intersection'](_0x251c65['model'],_0x251c65[_0xf833('0x38')]);_0x130621[_0xf833('0x3b')]=_[_0xf833('0x3a')](_0x251c65[_0xf833('0x36')],qs[_0xf833('0x3c')](_0x2f22aa[_0xf833('0x38')][_0xf833('0x3c')]));_0x130621[_0xf833('0x3b')]=_0x130621[_0xf833('0x3b')][_0xf833('0x3d')]?_0x130621[_0xf833('0x3b')]:_0x251c65['model'];if(_0x2f22aa[_0xf833('0x38')][_0xf833('0x4d')]){_0x130621[_0xf833('0x47')]=[{'all':!![]}];}_0x130621=_[_0xf833('0x44')]({},_0x130621,_0x2f22aa[_0xf833('0x46')]);return db['Pause'][_0xf833('0x4e')](_0x130621)[_0xf833('0x26')](handleEntityNotFound(_0xc0e2c0,null))[_0xf833('0x26')](respondWithResult(_0xc0e2c0,null))[_0xf833('0x4a')](handleError(_0xc0e2c0,null));};exports[_0xf833('0x4f')]=function(_0x10eb7a,_0x39ad3f){return db[_0xf833('0x31')][_0xf833('0x4f')](_0x10eb7a['body'],{})[_0xf833('0x26')](function(_0x536d07){var _0xf746a=_0x10eb7a['user']['get']({'plain':!![]});if(!_0xf746a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf746a[_0xf833('0x50')]===_0xf833('0x51')){var _0x11c12a=_0x536d07[_0xf833('0x28')]({'plain':!![]});var _0x59d05b=_0xf833('0x29');return db[_0xf833('0x52')][_0xf833('0x4e')]({'where':{'name':_0x59d05b,'userProfileId':_0xf746a[_0xf833('0x53')]},'raw':!![]})[_0xf833('0x26')](function(_0x1db692){if(_0x1db692&&_0x1db692[_0xf833('0x54')]===0x0){return db[_0xf833('0x55')]['create']({'name':_0x11c12a[_0xf833('0x2d')],'resourceId':_0x11c12a['id'],'type':_0x1db692[_0xf833('0x2d')],'sectionId':_0x1db692['id']},{})[_0xf833('0x26')](function(){return _0x536d07;});}else{return _0x536d07;}})[_0xf833('0x4a')](function(_0x1928a6){logger[_0xf833('0x2b')](_0xf833('0x56'),_0x1928a6);throw _0x1928a6;});}return _0x536d07;})[_0xf833('0x26')](respondWithResult(_0x39ad3f,0xc9))['catch'](handleError(_0x39ad3f,null));};exports['update']=function(_0x473072,_0x456a85){if(_0x473072[_0xf833('0x57')]['id']){delete _0x473072[_0xf833('0x57')]['id'];}return db[_0xf833('0x31')][_0xf833('0x4e')]({'where':{'id':_0x473072[_0xf833('0x4c')]['id']}})[_0xf833('0x26')](handleEntityNotFound(_0x456a85,null))[_0xf833('0x26')](saveUpdates(_0x473072[_0xf833('0x57')],null))[_0xf833('0x26')](respondWithResult(_0x456a85,null))[_0xf833('0x4a')](handleError(_0x456a85,null));};exports[_0xf833('0x27')]=function(_0x224876,_0x28694d){return db[_0xf833('0x31')][_0xf833('0x4e')]({'where':{'id':_0x224876['params']['id']}})[_0xf833('0x26')](handleEntityNotFound(_0x28694d,null))[_0xf833('0x26')](removeEntity(_0x28694d,null))[_0xf833('0x4a')](handleError(_0x28694d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a459a7f..d7fe3ec 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x52977d,_0x59726e){var _0x18cf88=function(_0x3d11be){while(--_0x3d11be){_0x52977d['push'](_0x52977d['shift']());}};_0x18cf88(++_0x59726e);}(_0xabce,0x103));var _0xeabc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xabce[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x3de2f0,_0x2ceac0){_0x3de2f0=_0x3de2f0-0x0;var _0x50a73a=_0x6aa7[_0x3de2f0];return _0x50a73a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 b554cfb..d6e805a 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(_0xa862e,_0xae16bc){var _0x276c3c=function(_0x11c606){while(--_0x11c606){_0xa862e['push'](_0xa862e['shift']());}};_0x276c3c(++_0xae16bc);}(_0xb10b,0x12a));var _0xbb10=function(_0x2335e6,_0x1bade8){_0x2335e6=_0x2335e6-0x0;var _0x370a50=_0xb10b[_0x2335e6];return _0x370a50;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x4b06c1,_0x3faaf1){var _0x30cfa7=function(_0x5b625a){while(--_0x5b625a){_0x4b06c1['push'](_0x4b06c1['shift']());}};_0x30cfa7(++_0x3faaf1);}(_0x7a54,0x106));var _0x47a5=function(_0x47eada,_0x47f84e){_0x47eada=_0x47eada-0x0;var _0x35f016=_0x7a54[_0x47eada];return _0x35f016;};'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')]('Pause,\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['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 52ea2c5..15e846a 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 _0xe107=['get','/webhook','webhookGet','show','isAuthenticated','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./plugin.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe107,0xb3));var _0x7e10=function(_0x4c9629,_0x4b5997){_0x4c9629=_0x4c9629-0x0;var _0x4aaf60=_0xe107[_0x4c9629];return _0x4aaf60;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),controller[_0x7e10('0x9')]);router[_0x7e10('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7e10('0xa')]);router['get']('/:id/download',auth[_0x7e10('0xb')](),controller[_0x7e10('0xc')]);var upload=multer({'storage':multer[_0x7e10('0xd')]({'destination':function(_0x2bd58a,_0x256cb1,_0x52ba74){_0x52ba74(null,path[_0x7e10('0xe')](config['root'],_0x7e10('0xf')));},'filename':function(_0x2ca84c,_0x2f4d72,_0x5434dd){_0x2f4d72[_0x7e10('0x10')]=_0x2f4d72[_0x7e10('0x10')][_0x7e10('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5434dd(null,util[_0x7e10('0x12')](_0x7e10('0x13'),path[_0x7e10('0x14')](_0x2f4d72[_0x7e10('0x10')],path[_0x7e10('0x15')](_0x2f4d72['originalname'])),Date[_0x7e10('0x16')](),path[_0x7e10('0x15')](_0x2f4d72['originalname'])));}})});router['post']('/',upload[_0x7e10('0x17')]('file'),controller[_0x7e10('0x18')]);router[_0x7e10('0x19')](_0x7e10('0x8'),controller[_0x7e10('0x1a')]);router['put'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1c')]);router['delete'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1d')]);module[_0x7e10('0x1e')]=router; \ No newline at end of file +var _0xb7c8=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','format','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete'];(function(_0x4b0bfd,_0x4900f0){var _0x2f33f5=function(_0x572f82){while(--_0x572f82){_0x4b0bfd['push'](_0x4b0bfd['shift']());}};_0x2f33f5(++_0x4900f0);}(_0xb7c8,0x119));var _0x8b7c=function(_0x33a0cc,_0x5f0eec){_0x33a0cc=_0x33a0cc-0x0;var _0x4aa746=_0xb7c8[_0x33a0cc];return _0x4aa746;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var fs_extra=require(_0x8b7c('0x5'));var auth=require(_0x8b7c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b7c('0x7'));var controller=require(_0x8b7c('0x8'));router[_0x8b7c('0x9')]('/',auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xb')]);router[_0x8b7c('0x9')](_0x8b7c('0xc'),controller[_0x8b7c('0xd')]);router[_0x8b7c('0x9')](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xf')]);router['get'](_0x8b7c('0x10'),auth['isAuthenticated'](),controller[_0x8b7c('0x11')]);var upload=multer({'storage':multer[_0x8b7c('0x12')]({'destination':function(_0x5868ec,_0x189a25,_0x452e83){_0x452e83(null,path[_0x8b7c('0x13')](config['root'],'server/files/plugins'));},'filename':function(_0x1c7471,_0x33c5aa,_0x297c39){_0x33c5aa[_0x8b7c('0x14')]=_0x33c5aa[_0x8b7c('0x14')][_0x8b7c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x297c39(null,util[_0x8b7c('0x16')]('%s-%s%s',path[_0x8b7c('0x17')](_0x33c5aa[_0x8b7c('0x14')],path[_0x8b7c('0x18')](_0x33c5aa['originalname'])),Date[_0x8b7c('0x19')](),path[_0x8b7c('0x18')](_0x33c5aa['originalname'])));}})});router[_0x8b7c('0x1a')]('/',upload[_0x8b7c('0x1b')](_0x8b7c('0x1c')),controller[_0x8b7c('0x1d')]);router[_0x8b7c('0x1a')]('/webhook',controller[_0x8b7c('0x1e')]);router[_0x8b7c('0x1f')](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0x20')]);router['delete'](_0x8b7c('0xe'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0x21')]);module[_0x8b7c('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5fd8e0c..72da779 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 _0x90d6=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','adminOnly','agentOnly','always'];(function(_0x2a870e,_0x2ab4eb){var _0x4d9f28=function(_0x3877bd){while(--_0x3877bd){_0x2a870e['push'](_0x2a870e['shift']());}};_0x4d9f28(++_0x2ab4eb);}(_0x90d6,0x6d));var _0x690d=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x90d6[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0x690d('0x0'));module[_0x690d('0x1')]={'name':{'type':Sequelize[_0x690d('0x2')]},'type':{'type':Sequelize[_0x690d('0x3')](_0x690d('0x4'),_0x690d('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x690d('0x6')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x690d('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x690d('0x3')](_0x690d('0x8'),_0x690d('0x9'),_0x690d('0xa'),'never'),'defaultValue':_0x690d('0xa'),'comment':_0x690d('0xb')},'icon':{'type':Sequelize[_0x690d('0x2')]},'adminUrl':{'type':Sequelize[_0x690d('0x2')]},'agentUrl':{'type':Sequelize[_0x690d('0x2')]},'scriptName':{'type':Sequelize[_0x690d('0x2')]},'scriptPath':{'type':Sequelize[_0x690d('0x2')]}}; \ No newline at end of file +var _0x43ba=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM'];(function(_0xa6c52c,_0x557913){var _0x3732d3=function(_0x173a66){while(--_0x173a66){_0xa6c52c['push'](_0xa6c52c['shift']());}};_0x3732d3(++_0x557913);}(_0x43ba,0x114));var _0xa43b=function(_0x269975,_0x1e6449){_0x269975=_0x269975-0x0;var _0x51c950=_0x43ba[_0x269975];return _0x51c950;};'use strict';var Sequelize=require(_0xa43b('0x0'));module[_0xa43b('0x1')]={'name':{'type':Sequelize[_0xa43b('0x2')]},'type':{'type':Sequelize[_0xa43b('0x3')](_0xa43b('0x4'),_0xa43b('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xa43b('0x6')]},'path':{'type':Sequelize[_0xa43b('0x2')],'comment':_0xa43b('0x7')},'active':{'type':Sequelize[_0xa43b('0x8')],'defaultValue':0x0,'comment':_0xa43b('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0xa43b('0xa'),_0xa43b('0xb'),'always',_0xa43b('0xc')),'defaultValue':'always','comment':_0xa43b('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xa43b('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xa43b('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dbf89f8..2dc5702 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 _0x234c=['then','destroy','get','Plugins','sendStatus','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','params','join','root','server/files/plugins','format','%s.zip','zip','warning','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','%s%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','extract-zip','rimraf','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','update'];(function(_0x15b1a1,_0x664b8f){var _0x391507=function(_0x3547d8){while(--_0x3547d8){_0x15b1a1['push'](_0x15b1a1['shift']());}};_0x391507(++_0x664b8f);}(_0x234c,0x1e1));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc234('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc234('0x1'));var jsonpatch=require(_0xc234('0x2'));var rp=require(_0xc234('0x3'));var moment=require('moment');var BPromise=require(_0xc234('0x4'));var Mustache=require(_0xc234('0x5'));var util=require(_0xc234('0x6'));var path=require(_0xc234('0x7'));var sox=require(_0xc234('0x8'));var csv=require(_0xc234('0x9'));var ejs=require(_0xc234('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc234('0xb'));var squel=require(_0xc234('0xc'));var crypto=require(_0xc234('0xd'));var jsforce=require(_0xc234('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc234('0x9'));var querystring=require('querystring');var Papa=require(_0xc234('0xf'));var extract=require(_0xc234('0x10'));var rimraf=require(_0xc234('0x11'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xc234('0x12'));var qs=require(_0xc234('0x13'));var as=require(_0xc234('0x14'));var hardwareService=require(_0xc234('0x15'));var logger=require(_0xc234('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc234('0x17'));var db=require(_0xc234('0x18'))['db'];config[_0xc234('0x19')]=_[_0xc234('0x1a')](config[_0xc234('0x19')],{'host':_0xc234('0x1b'),'port':0x18eb});var socket=require(_0xc234('0x1c'))(new Redis(config['redis']));require(_0xc234('0x1d'))[_0xc234('0x1e')](socket);function respondWithStatusCode(_0xb596c7,_0x43e863){_0x43e863=_0x43e863||0xcc;return function(_0x30f883){if(_0x30f883){return _0xb596c7['sendStatus'](_0x43e863);}return _0xb596c7['status'](_0x43e863)[_0xc234('0x1f')]();};}function respondWithResult(_0x3582da,_0x43b07f){_0x43b07f=_0x43b07f||0xc8;return function(_0x44782d){if(_0x44782d){return _0x3582da[_0xc234('0x20')](_0x43b07f)[_0xc234('0x21')](_0x44782d);}};}function respondWithFilteredResult(_0x4df2f3,_0x2bf0d7){return function(_0x2a5f39){if(_0x2a5f39){var _0x255d3c=typeof _0x2bf0d7['offset']===_0xc234('0x22')&&typeof _0x2bf0d7[_0xc234('0x23')]==='undefined';var _0x5f0f4d=_0x2a5f39[_0xc234('0x24')];var _0x1a62fb=_0x255d3c?0x0:_0x2bf0d7[_0xc234('0x25')];var _0x315a24=_0x255d3c?_0x2a5f39[_0xc234('0x24')]:_0x2bf0d7[_0xc234('0x25')]+_0x2bf0d7[_0xc234('0x23')];var _0x4c0529;if(_0x315a24>=_0x5f0f4d){_0x315a24=_0x5f0f4d;_0x4c0529=0xc8;}else{_0x4c0529=0xce;}_0x4df2f3[_0xc234('0x20')](_0x4c0529);return _0x4df2f3[_0xc234('0x26')](_0xc234('0x27'),_0x1a62fb+'-'+_0x315a24+'/'+_0x5f0f4d)[_0xc234('0x21')](_0x2a5f39);}return null;};}function patchUpdates(_0x3a886c){return function(_0x1ffe16){try{jsonpatch['apply'](_0x1ffe16,_0x3a886c,!![]);}catch(_0x4ccf6f){return BPromise['reject'](_0x4ccf6f);}return _0x1ffe16['save']();};}function saveUpdates(_0x4c64cf,_0x320ffe){return function(_0x2c9116){if(_0x2c9116){return _0x2c9116[_0xc234('0x28')](_0x4c64cf)[_0xc234('0x29')](function(_0x13df8e){return _0x13df8e;});}return null;};}function removeEntity(_0x50eb9a,_0x53aead){return function(_0x298f9e){if(_0x298f9e){return _0x298f9e[_0xc234('0x2a')]()[_0xc234('0x29')](function(){var _0x167537=_0x298f9e[_0xc234('0x2b')]({'plain':!![]});var _0x44ecf3=_0xc234('0x2c');return db['UserProfileResource'][_0xc234('0x2a')]({'where':{'type':_0x44ecf3,'resourceId':_0x167537['id']}})[_0xc234('0x29')](function(){return _0x298f9e;});})[_0xc234('0x29')](function(){_0x50eb9a[_0xc234('0x20')](0xcc)[_0xc234('0x1f')]();});}};}function handleEntityNotFound(_0x1bfdbc,_0x49910e){return function(_0x30a11e){if(!_0x30a11e){_0x1bfdbc[_0xc234('0x2d')](0x194);}return _0x30a11e;};}function handleError(_0x559b39,_0xcca1ad){_0xcca1ad=_0xcca1ad||0x1f4;return function(_0x251f73){logger['error'](_0x251f73[_0xc234('0x2e')]);if(_0x251f73[_0xc234('0x2f')]){delete _0x251f73[_0xc234('0x2f')];}_0x559b39['status'](_0xcca1ad)[_0xc234('0x30')](_0x251f73);};}exports[_0xc234('0x31')]=function(_0x42ec7e,_0x1ad4b4){var _0x4b6624={},_0x4c9757={},_0x4c0671={'count':0x0,'rows':[]};var _0x4f2df2=_[_0xc234('0x32')](db[_0xc234('0x33')]['rawAttributes'],function(_0x55ebe5){return{'name':_0x55ebe5[_0xc234('0x34')],'type':_0x55ebe5[_0xc234('0x35')][_0xc234('0x36')]};});_0x4c9757[_0xc234('0x37')]=_[_0xc234('0x32')](_0x4f2df2,_0xc234('0x2f'));_0x4c9757[_0xc234('0x38')]=_[_0xc234('0x39')](_0x42ec7e[_0xc234('0x38')]);_0x4c9757[_0xc234('0x3a')]=_[_0xc234('0x3b')](_0x4c9757['model'],_0x4c9757['query']);_0x4b6624['attributes']=_[_0xc234('0x3b')](_0x4c9757[_0xc234('0x37')],qs[_0xc234('0x3c')](_0x42ec7e[_0xc234('0x38')][_0xc234('0x3c')]));_0x4b6624[_0xc234('0x3d')]=_0x4b6624[_0xc234('0x3d')][_0xc234('0x3e')]?_0x4b6624[_0xc234('0x3d')]:_0x4c9757[_0xc234('0x37')];if(!_0x42ec7e[_0xc234('0x38')][_0xc234('0x3f')](_0xc234('0x40'))){_0x4b6624[_0xc234('0x23')]=qs['limit'](_0x42ec7e['query'][_0xc234('0x23')]);_0x4b6624[_0xc234('0x25')]=qs['offset'](_0x42ec7e[_0xc234('0x38')][_0xc234('0x25')]);}_0x4b6624[_0xc234('0x41')]=qs['sort'](_0x42ec7e[_0xc234('0x38')][_0xc234('0x42')]);_0x4b6624[_0xc234('0x43')]=qs[_0xc234('0x3a')](_[_0xc234('0x44')](_0x42ec7e[_0xc234('0x38')],_0x4c9757[_0xc234('0x3a')]),_0x4f2df2);if(_0x42ec7e[_0xc234('0x38')][_0xc234('0x45')]){_0x4b6624[_0xc234('0x43')]=_[_0xc234('0x46')](_0x4b6624[_0xc234('0x43')],{'$or':_[_0xc234('0x32')](_0x4f2df2,function(_0x187055){if(_0x187055[_0xc234('0x35')]!==_0xc234('0x47')){var _0x5b4e2b={};_0x5b4e2b[_0x187055[_0xc234('0x2f')]]={'$like':'%'+_0x42ec7e['query'][_0xc234('0x45')]+'%'};return _0x5b4e2b;}})});}_0x4b6624=_[_0xc234('0x46')]({},_0x4b6624,_0x42ec7e[_0xc234('0x48')]);var _0xb50c7b={'where':_0x4b6624['where']};return db[_0xc234('0x33')][_0xc234('0x24')](_0xb50c7b)[_0xc234('0x29')](function(_0x588113){_0x4c0671[_0xc234('0x24')]=_0x588113;if(_0x42ec7e[_0xc234('0x38')][_0xc234('0x49')]){_0x4b6624[_0xc234('0x4a')]=[{'all':!![]}];}return db[_0xc234('0x33')][_0xc234('0x4b')](_0x4b6624);})[_0xc234('0x29')](function(_0x2fadf3){_0x4c0671[_0xc234('0x4c')]=_0x2fadf3;return _0x4c0671;})[_0xc234('0x29')](respondWithFilteredResult(_0x1ad4b4,_0x4b6624))[_0xc234('0x4d')](handleError(_0x1ad4b4,null));};exports[_0xc234('0x4e')]=function(_0x5489f0,_0x39bdc4){var _0x269558={'raw':!![],'where':{'id':_0x5489f0['params']['id']}},_0x4ca303={};_0x4ca303['model']=_['keys'](db['Plugin'][_0xc234('0x4f')]);_0x4ca303['query']=_[_0xc234('0x39')](_0x5489f0[_0xc234('0x38')]);_0x4ca303[_0xc234('0x3a')]=_[_0xc234('0x3b')](_0x4ca303[_0xc234('0x37')],_0x4ca303[_0xc234('0x38')]);_0x269558[_0xc234('0x3d')]=_[_0xc234('0x3b')](_0x4ca303[_0xc234('0x37')],qs[_0xc234('0x3c')](_0x5489f0[_0xc234('0x38')]['fields']));_0x269558[_0xc234('0x3d')]=_0x269558['attributes']['length']?_0x269558[_0xc234('0x3d')]:_0x4ca303['model'];if(_0x5489f0['query'][_0xc234('0x49')]){_0x269558[_0xc234('0x4a')]=[{'all':!![]}];}_0x269558=_[_0xc234('0x46')]({},_0x269558,_0x5489f0[_0xc234('0x48')]);return db['Plugin'][_0xc234('0x50')](_0x269558)['then'](handleEntityNotFound(_0x39bdc4,null))[_0xc234('0x29')](respondWithResult(_0x39bdc4,null))['catch'](handleError(_0x39bdc4,null));};exports['download']=function(_0x310277,_0x41f54c,_0x405b05){return db[_0xc234('0x33')][_0xc234('0x50')]({'where':{'id':_0x310277[_0xc234('0x51')]['id']},'attributes':[_0xc234('0x2f'),'path'],'raw':!![]})[_0xc234('0x29')](handleEntityNotFound(_0x41f54c,null))['then'](function(_0x2c0049){if(_0x2c0049){var _0x9a66=path[_0xc234('0x52')](config[_0xc234('0x53')],_0xc234('0x54'),util[_0xc234('0x55')](_0xc234('0x56'),path['basename'](_0x2c0049[_0xc234('0x7')])));var _0x3c8811=fs['createWriteStream'](_0x9a66);var _0x30d465=archiver(_0xc234('0x57'),{'zlib':{'level':0x9}});_0x30d465['on'](_0xc234('0x58'),function(_0x42953b){if(_0x42953b['code']===_0xc234('0x59')){logger[_0xc234('0x5a')](_0x42953b);}else{throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x5d'));}});_0x30d465['on'](_0xc234('0x5a'),function(_0x1d1959){throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x5d'));});_0x30d465['pipe'](_0x3c8811);_0x30d465[_0xc234('0x5e')](_0xc234('0x5f'),{'cwd':path['join'](config['root'],_0xc234('0x54'),path['dirname'](_0x2c0049[_0xc234('0x7')])),'ignore':[path[_0xc234('0x52')](path['basename'](_0x2c0049['path']),_0xc234('0x60')),path['join'](path[_0xc234('0x61')](_0x2c0049[_0xc234('0x7')]),_0xc234('0x62'))],'nodir':!![]})[_0xc234('0x63')]();_0x3c8811['on'](_0xc234('0x64'),function(){if(!fs[_0xc234('0x65')](_0x9a66)){throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x66'));}return _0x41f54c[_0xc234('0x67')](_0x9a66,util[_0xc234('0x55')](_0xc234('0x56'),path[_0xc234('0x61')](_0x2c0049[_0xc234('0x7')])),function(_0xc4e484){if(_0xc4e484){throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x68'));}fs[_0xc234('0x69')](_0x9a66);logger[_0xc234('0x6a')](_0xc234('0x6b'));logger['info'](_0xc234('0x6c'));});});}return null;})[_0xc234('0x4d')](handleError(_0x41f54c,null));};exports[_0xc234('0x6d')]=function(_0x1b35be,_0x4ddf46,_0x14605c){var _0x51b9fa=path[_0xc234('0x61')](_0x1b35be[_0xc234('0x6e')][_0xc234('0x6f')],path[_0xc234('0x70')](_0x1b35be[_0xc234('0x6e')][_0xc234('0x6f')]));var _0x3a2f48=path[_0xc234('0x52')](config[_0xc234('0x53')],_0xc234('0x54'),_0x1b35be[_0xc234('0x6e')][_0xc234('0x6f')]);var _0x24097b=path[_0xc234('0x52')](config['root'],_0xc234('0x54'),_0x51b9fa);logger['info'](_0xc234('0x71'),_0x3a2f48);logger[_0xc234('0x6a')](_0xc234('0x72'),_0x24097b);try{fs[_0xc234('0x73')](_0x3a2f48,parseInt(_0xc234('0x74'),0x8));extract(_0x3a2f48,{'dir':_0x24097b},function(_0x3922d8){if(_0x3922d8){logger[_0xc234('0x5a')](_0x3922d8);handleError(_0x3922d8,!![]);};var _0x133f9b=fs['readdirSync'](_0x24097b);if(_0x133f9b[_0xc234('0x3e')]>0x1){removeReferences(_0x3a2f48,_0x24097b);logger['error'](_0xc234('0x75'));return _0x14605c(new Error(_0xc234('0x75')));}var _0x5daa7b=fs['lstatSync'](path[_0xc234('0x52')](_0x24097b,_0x133f9b[0x0]));if(_0x5daa7b[_0xc234('0x76')]()){removeReferences(_0x3a2f48,_0x24097b);logger[_0xc234('0x5a')]('Invalid\x20plugin\x20structure');return _0x14605c(new Error(_0xc234('0x75')));}if(_0x5daa7b[_0xc234('0x77')]()){var _0x238052=fs['readdirSync'](path[_0xc234('0x52')](_0x24097b,_0x133f9b[0x0]));if(_0x238052[_0xc234('0x3e')]===0x0){removeReferences(_0x3a2f48,_0x24097b);logger[_0xc234('0x5a')](_0xc234('0x75'));return _0x14605c(new Error(_0xc234('0x75')));}var _0x435052=_0x238052[_0xc234('0x78')](function(_0xe7a4d9){return _0xe7a4d9==='manifest.json';});if(!_0x435052){return _0x14605c(new Error(_0xc234('0x79')));}var _0x29bbf5=fs[_0xc234('0x7a')](path[_0xc234('0x52')](_0x24097b,_0x133f9b[0x0],_0xc234('0x7b')));var _0x37eeb0=JSON['parse'](_0x29bbf5);if(_0xc234('0x22')==typeof _0x37eeb0['name']){return _0x14605c(new Error(_0xc234('0x7c')));}if(_0xc234('0x22')==typeof _0x37eeb0['type']){return _0x14605c(new Error(_0xc234('0x7d')));}if(_0xc234('0x22')==typeof _0x37eeb0[_0xc234('0x7e')]){return _0x14605c(new Error(_0xc234('0x7f')));}if(_0xc234('0x22')==typeof _0x37eeb0['parameters']){return _0x14605c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x37eeb0[_0xc234('0x35')]===_0xc234('0x80')){if('undefined'==typeof _0x37eeb0[_0xc234('0x81')]['views']){return _0x14605c(new Error(_0xc234('0x82')));}if(_0xc234('0x22')==typeof _0x37eeb0['parameters'][_0xc234('0x83')]['admin']&&_0xc234('0x22')==typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x84')]){return _0x14605c(new Error(_0xc234('0x85')));}}else if(_0x37eeb0['type']===_0xc234('0x86')){if(_0xc234('0x22')==typeof _0x37eeb0['parameters'][_0xc234('0x87')]){return _0x14605c(new Error(_0xc234('0x88')));}if('undefined'==typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x89')]){return _0x14605c(new Error(_0xc234('0x8a')));}}else{return _0x14605c(new Error(_0xc234('0x8b')));}var _0x5e4449=_0x37eeb0[_0xc234('0x2f')];var _0x5bd1f5=_0x37eeb0[_0xc234('0x8c')];var _0x1da048=_0x37eeb0[_0xc234('0x35')];var _0x194773=_0x37eeb0[_0xc234('0x8d')]?_0x37eeb0[_0xc234('0x8d')]:'always';var _0x58472c=_0x37eeb0[_0xc234('0x8e')]?_0x37eeb0[_0xc234('0x8e')]:_0xc234('0x8f');var _0x469b8c='';var _0x5b3098='';var _0x41ebff='';var _0x127e2c='';var _0x2b716e=_0x37eeb0[_0xc234('0x7e')];if(_0x1da048===_0xc234('0x80')){if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x90')]){var _0x86a52e=_0x37eeb0[_0xc234('0x81')][_0xc234('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x86a52e)){_0x469b8c=path['join']('plugins',_0x51b9fa,_0x133f9b[0x0],_0x86a52e);}else{_0x469b8c=_0x86a52e;}}else{logger[_0xc234('0x6a')](_0xc234('0x92'));}if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x84')]){var _0x46427f=_0x37eeb0[_0xc234('0x81')][_0xc234('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x46427f)){_0x5b3098=path[_0xc234('0x52')](_0xc234('0x93'),_0x51b9fa,_0x133f9b[0x0],_0x46427f);}else{_0x5b3098=_0x46427f;}}else{logger[_0xc234('0x6a')](_0xc234('0x94'));}}else if(_0x1da048===_0xc234('0x86')){_0x41ebff=_0x37eeb0['parameters'][_0xc234('0x87')];_0x127e2c=_0x37eeb0[_0xc234('0x81')][_0xc234('0x89')];if('undefined'!=typeof _0x37eeb0[_0xc234('0x81')]['views']){if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')]['views'][_0xc234('0x90')]){var _0x86a52e=_0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x90')];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x86a52e)){_0x469b8c=path[_0xc234('0x52')](_0xc234('0x93'),_0x51b9fa,_0x133f9b[0x0],_0x86a52e);}else{_0x469b8c=_0x86a52e;}}if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x84')]){var _0x46427f=_0x37eeb0['parameters'][_0xc234('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x46427f)){_0x5b3098=path[_0xc234('0x52')]('plugins',_0x51b9fa,_0x133f9b[0x0],_0x46427f);}else{_0x5b3098=_0x46427f;}}}}var _0x20894a={'name':_0x5e4449,'description':_0x5bd1f5,'path':path[_0xc234('0x52')](_0x51b9fa,_0x133f9b[0x0]),'type':_0x1da048,'sidebar':_0x194773,'icon':_0x58472c,'adminUrl':_0x469b8c,'agentUrl':_0x5b3098,'scriptName':_0x41ebff,'scriptPath':_0x127e2c,'version':_0x2b716e};removeReferences(_0x3a2f48,null);return db[_0xc234('0x33')][_0xc234('0x95')](_0x20894a)[_0xc234('0x29')](function(_0x36fba9){var _0x539f08={'role':_0x1b35be[_0xc234('0x96')]['role'],'userProfileId':_0x1b35be['body']['userProfileId']};if(!_0x539f08)throw new Error(_0xc234('0x97'));if(_0x539f08['role']===_0xc234('0x98')){var _0x5e8725=_0x36fba9[_0xc234('0x2b')]({'plain':!![]});return db[_0xc234('0x99')]['find']({'where':{'name':_0xc234('0x2c'),'userProfileId':_0x539f08[_0xc234('0x9a')]},'raw':!![]})[_0xc234('0x29')](function(_0x3515cf){if(_0x3515cf&&_0x3515cf['autoAssociation']===0x0){return db['UserProfileResource'][_0xc234('0x95')]({'name':_0x5e8725[_0xc234('0x2f')],'resourceId':_0x5e8725['id'],'type':_0x3515cf[_0xc234('0x2f')],'sectionId':_0x3515cf['id']},{})[_0xc234('0x29')](function(){return _0x36fba9;});}else{return _0x36fba9;}})[_0xc234('0x4d')](function(_0x54fe93){logger['error'](_0xc234('0x9b'),_0x54fe93);throw _0x54fe93;});}return _0x36fba9;})[_0xc234('0x29')](respondWithResult(_0x4ddf46,null))[_0xc234('0x4d')](handleError(_0x4ddf46,null));}});}catch(_0x5ab97b){_0x4ddf46[_0xc234('0x20')](0x1f4)['send'](_0x5ab97b);}};function removeReferences(_0x1330f5,_0x4cc698){try{if(_0x1330f5){fs[_0xc234('0x69')](_0x1330f5);logger[_0xc234('0x6a')](_0xc234('0x9c'));}if(_0x4cc698){rimraf(_0x4cc698,function(){});logger[_0xc234('0x6a')](_0xc234('0x9d'));}}catch(_0x45f1f1){logger[_0xc234('0x5a')](_0x45f1f1);}}exports['update']=function(_0x47cd26,_0x2a7566,_0x397bc4){return db['Plugin'][_0xc234('0x50')]({'where':{'id':_0x47cd26[_0xc234('0x51')]['id']}})[_0xc234('0x29')](handleEntityNotFound(_0x2a7566,null))[_0xc234('0x29')](saveUpdates(_0x47cd26[_0xc234('0x96')],null))[_0xc234('0x29')](respondWithResult(_0x2a7566,null))[_0xc234('0x4d')](handleError(_0x2a7566,null));};exports['delete']=function(_0xa7074b,_0x415fd0,_0x13ba1f){return db[_0xc234('0x33')][_0xc234('0x50')]({'where':{'id':_0xa7074b[_0xc234('0x51')]['id']}})[_0xc234('0x29')](function(_0x47eec5){if(_0x47eec5){return _0x47eec5[_0xc234('0x2a')]();}})[_0xc234('0x29')](function(_0x39d8f4){rimraf(path[_0xc234('0x52')](config[_0xc234('0x53')],'server/files/plugins',path['dirname'](_0x39d8f4[_0xc234('0x7')])),function(){});return _0x39d8f4;})[_0xc234('0x29')](handleEntityNotFound(_0x415fd0,null))[_0xc234('0x29')](respondWithStatusCode(_0x415fd0,null))['catch'](handleError(_0x415fd0,null));};exports[_0xc234('0x9e')]=function(_0x2c7116,_0x57f22f,_0x14ef6c){return BPromise['resolve']()[_0xc234('0x29')](function(){if(!_0x2c7116[_0xc234('0x38')]['path']){throw new Error(_0xc234('0x9f'));}if(!_0x2c7116[_0xc234('0x38')][_0xc234('0xa0')]){throw new Error(_0xc234('0xa1'));}var _0x13714c=_0x2c7116[_0xc234('0x38')]['hostname']?_0x2c7116[_0xc234('0x38')][_0xc234('0xa2')]+':'+_0x2c7116['query'][_0xc234('0xa0')]:_0xc234('0xa3')+_0x2c7116[_0xc234('0x38')]['port'];var _0x42c90b=_0x2c7116['query'][_0xc234('0x21')]?_0x2c7116[_0xc234('0x38')][_0xc234('0x21')]:!![];var _0x132f04=_0x2c7116['query'][_0xc234('0xa4')]?_0x2c7116[_0xc234('0x38')]['encoding']:null;var _0x5757a5={'method':_0x2c7116[_0xc234('0xa5')],'uri':util['format']('%s%s',_0x13714c,_0x2c7116['query'][_0xc234('0x7')]),'json':_0x42c90b,'resolveWithFullResponse':!![],'encoding':_0x132f04,'qs':_0x2c7116['query']};if(_0x2c7116['headers']){_0x5757a5[_0xc234('0xa6')]=_0x2c7116['headers'];if(_0x5757a5[_0xc234('0xa6')]['content-length']){delete _0x5757a5[_0xc234('0xa6')][_0xc234('0xa7')];}}if(_0x5757a5['headers'][_0xc234('0xa8')]){delete _0x5757a5[_0xc234('0xa6')][_0xc234('0xa8')];}return rp(_0x5757a5);})['then'](function(_0x17a188){if(_0x17a188){_0x57f22f[_0xc234('0x26')](_0x17a188[_0xc234('0xa6')]);logger[_0xc234('0x6a')](_0x17a188[_0xc234('0x96')]);if(_[_0xc234('0xa9')](_0x2c7116[_0xc234('0x38')][_0xc234('0x7')],_0xc234('0x67'))&&_0x17a188['statusCode']==0x1f4){return _0x57f22f[_0xc234('0x2d')](_0x17a188[_0xc234('0xaa')]);}else{return _0x57f22f['status'](_0x17a188['statusCode'])['send'](_0x17a188['body']);}}else{return _0x57f22f['sendStatus'](0xc8);}})[_0xc234('0x4d')](handleError(_0x57f22f,null));};exports[_0xc234('0xab')]=function(_0x228342,_0x435534,_0x21b1cb){return BPromise[_0xc234('0xac')]()['then'](function(){if(!_0x228342['query'][_0xc234('0x7')]){throw new Error(_0xc234('0x9f'));}if(!_0x228342[_0xc234('0x38')]['port']){throw new Error(_0xc234('0xa1'));}var _0x165df1=_0x228342[_0xc234('0x38')][_0xc234('0xa2')]?_0x228342[_0xc234('0x38')]['hostname']+':'+_0x228342[_0xc234('0x38')][_0xc234('0xa0')]:_0xc234('0xa3')+_0x228342['query'][_0xc234('0xa0')];var _0x2b5728=_0x228342[_0xc234('0x38')][_0xc234('0x21')]?_0x228342[_0xc234('0x38')][_0xc234('0x21')]:!![];var _0x279f47=_0x228342[_0xc234('0x38')]['encoding']?_0x228342[_0xc234('0x38')][_0xc234('0xa4')]:null;var _0x4a3e8d={'method':_0x228342['method'],'uri':util[_0xc234('0x55')](_0xc234('0xad'),_0x165df1,_0x228342[_0xc234('0x38')][_0xc234('0x7')]),'json':_0x2b5728,'resolveWithFullResponse':!![],'encoding':_0x279f47,'body':_0x228342[_0xc234('0x96')]};if(_0x228342[_0xc234('0xa6')]){_0x4a3e8d[_0xc234('0xa6')]=_0x228342[_0xc234('0xa6')];if(_0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa7')]){delete _0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa7')];}}if(_0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa8')]){delete _0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa8')];}return rp(_0x4a3e8d);})[_0xc234('0x29')](function(_0x42f1ed){if(_0x42f1ed){_0x435534[_0xc234('0x26')](_0x42f1ed[_0xc234('0xa6')]);logger[_0xc234('0x6a')](_0x42f1ed[_0xc234('0x96')]);return _0x435534['status'](_0x42f1ed[_0xc234('0xaa')])[_0xc234('0x30')](_0x42f1ed['body']);}else{return _0x435534['sendStatus'](0xc8);}})[_0xc234('0x4d')](handleError(_0x435534,null));}; \ No newline at end of file +var _0x1f61=['path','sox','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','Plugins','error','stack','name','send','index','map','Plugin','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','merge','find','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','**/*','join','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','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\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','%s%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x4fdfaf,_0x581698){var _0x130d6e=function(_0x4d09b8){while(--_0x4d09b8){_0x4fdfaf['push'](_0x4fdfaf['shift']());}};_0x130d6e(++_0x581698);}(_0x1f61,0x9e));var _0x11f6=function(_0x41d6c7,_0xc0db02){_0x41d6c7=_0x41d6c7-0x0;var _0x36ed7d=_0x1f61[_0x41d6c7];return _0x36ed7d;};'use strict';var emlformat=require(_0x11f6('0x0'));var rimraf=require(_0x11f6('0x1'));var zipdir=require(_0x11f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11f6('0x3'));var moment=require(_0x11f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x11f6('0x5'));var util=require('util');var path=require(_0x11f6('0x6'));var sox=require(_0x11f6('0x7'));var csv=require(_0x11f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11f6('0x9'));var squel=require('squel');var crypto=require(_0x11f6('0xa'));var jsforce=require(_0x11f6('0xb'));var deskjs=require(_0x11f6('0xc'));var toCsv=require(_0x11f6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x11f6('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x11f6('0xd'));var qs=require(_0x11f6('0xe'));var as=require(_0x11f6('0xf'));var hardwareService=require(_0x11f6('0x10'));var logger=require(_0x11f6('0x11'))(_0x11f6('0x12'));var utils=require('../../config/utils');var config=require(_0x11f6('0x13'));var licenseUtil=require(_0x11f6('0x14'));var db=require('../../mysqldb')['db'];config[_0x11f6('0x15')]=_['defaults'](config[_0x11f6('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x11f6('0x16'))(new Redis(config[_0x11f6('0x15')]));require(_0x11f6('0x17'))[_0x11f6('0x18')](socket);function respondWithStatusCode(_0x19a6e9,_0x2dbada){_0x2dbada=_0x2dbada||0xcc;return function(_0x353c0f){if(_0x353c0f){return _0x19a6e9[_0x11f6('0x19')](_0x2dbada);}return _0x19a6e9['status'](_0x2dbada)[_0x11f6('0x1a')]();};}function respondWithResult(_0x4d166c,_0x29ee30){_0x29ee30=_0x29ee30||0xc8;return function(_0x3c7fe0){if(_0x3c7fe0){return _0x4d166c[_0x11f6('0x1b')](_0x29ee30)[_0x11f6('0x1c')](_0x3c7fe0);}};}function respondWithFilteredResult(_0x50d83d,_0x6a10df){return function(_0x54301f){if(_0x54301f){var _0x1d9407=typeof _0x6a10df['offset']===_0x11f6('0x1d')&&typeof _0x6a10df[_0x11f6('0x1e')]===_0x11f6('0x1d');var _0x39bfd8=_0x54301f['count'];var _0x1517c4=_0x1d9407?0x0:_0x6a10df[_0x11f6('0x1f')];var _0x312642=_0x1d9407?_0x54301f[_0x11f6('0x20')]:_0x6a10df[_0x11f6('0x1f')]+_0x6a10df[_0x11f6('0x1e')];var _0x4ce97c;if(_0x312642>=_0x39bfd8){_0x312642=_0x39bfd8;_0x4ce97c=0xc8;}else{_0x4ce97c=0xce;}_0x50d83d[_0x11f6('0x1b')](_0x4ce97c);return _0x50d83d[_0x11f6('0x21')]('Content-Range',_0x1517c4+'-'+_0x312642+'/'+_0x39bfd8)['json'](_0x54301f);}return null;};}function patchUpdates(_0x2367a4){return function(_0x2ec91e){try{jsonpatch[_0x11f6('0x22')](_0x2ec91e,_0x2367a4,!![]);}catch(_0xacbf6){return BPromise[_0x11f6('0x23')](_0xacbf6);}return _0x2ec91e[_0x11f6('0x24')]();};}function saveUpdates(_0x37f3c4,_0x1f55a8){return function(_0x48dffc){if(_0x48dffc){return _0x48dffc[_0x11f6('0x25')](_0x37f3c4)[_0x11f6('0x26')](function(_0x47c516){return _0x47c516;});}return null;};}function removeEntity(_0x300bbb,_0x26bc47){return function(_0x2ad2c1){if(_0x2ad2c1){return _0x2ad2c1[_0x11f6('0x27')]()[_0x11f6('0x26')](function(){var _0x1236f1=_0x2ad2c1['get']({'plain':!![]});var _0x2a62d9=_0x11f6('0x28');return db['UserProfileResource'][_0x11f6('0x27')]({'where':{'type':_0x2a62d9,'resourceId':_0x1236f1['id']}})[_0x11f6('0x26')](function(){return _0x2ad2c1;});})[_0x11f6('0x26')](function(){_0x300bbb[_0x11f6('0x1b')](0xcc)[_0x11f6('0x1a')]();});}};}function handleEntityNotFound(_0xa553f7,_0x4d7a17){return function(_0x1c6e07){if(!_0x1c6e07){_0xa553f7[_0x11f6('0x19')](0x194);}return _0x1c6e07;};}function handleError(_0x1cadb2,_0xf7639a){_0xf7639a=_0xf7639a||0x1f4;return function(_0x5428d1){logger[_0x11f6('0x29')](_0x5428d1[_0x11f6('0x2a')]);if(_0x5428d1[_0x11f6('0x2b')]){delete _0x5428d1['name'];}_0x1cadb2[_0x11f6('0x1b')](_0xf7639a)[_0x11f6('0x2c')](_0x5428d1);};}exports[_0x11f6('0x2d')]=function(_0x41ddc8,_0x4f2a9b){var _0x51dc38={},_0x3d5765={},_0x5b08a5={'count':0x0,'rows':[]};var _0x2a1ba8=_[_0x11f6('0x2e')](db[_0x11f6('0x2f')]['rawAttributes'],function(_0x2a0a31){return{'name':_0x2a0a31['fieldName'],'type':_0x2a0a31[_0x11f6('0x30')][_0x11f6('0x31')]};});_0x3d5765[_0x11f6('0x32')]=_[_0x11f6('0x2e')](_0x2a1ba8,_0x11f6('0x2b'));_0x3d5765[_0x11f6('0x33')]=_[_0x11f6('0x34')](_0x41ddc8[_0x11f6('0x33')]);_0x3d5765[_0x11f6('0x35')]=_[_0x11f6('0x36')](_0x3d5765['model'],_0x3d5765['query']);_0x51dc38[_0x11f6('0x37')]=_[_0x11f6('0x36')](_0x3d5765['model'],qs[_0x11f6('0x38')](_0x41ddc8[_0x11f6('0x33')][_0x11f6('0x38')]));_0x51dc38[_0x11f6('0x37')]=_0x51dc38[_0x11f6('0x37')][_0x11f6('0x39')]?_0x51dc38[_0x11f6('0x37')]:_0x3d5765[_0x11f6('0x32')];if(!_0x41ddc8[_0x11f6('0x33')][_0x11f6('0x3a')]('nolimit')){_0x51dc38['limit']=qs[_0x11f6('0x1e')](_0x41ddc8[_0x11f6('0x33')][_0x11f6('0x1e')]);_0x51dc38['offset']=qs['offset'](_0x41ddc8[_0x11f6('0x33')]['offset']);}_0x51dc38['order']=qs[_0x11f6('0x3b')](_0x41ddc8[_0x11f6('0x33')]['sort']);_0x51dc38['where']=qs['filters'](_[_0x11f6('0x3c')](_0x41ddc8[_0x11f6('0x33')],_0x3d5765['filters']),_0x2a1ba8);if(_0x41ddc8[_0x11f6('0x33')][_0x11f6('0x3d')]){_0x51dc38[_0x11f6('0x3e')]=_['merge'](_0x51dc38['where'],{'$or':_[_0x11f6('0x2e')](_0x2a1ba8,function(_0x5ede3c){if(_0x5ede3c['type']!==_0x11f6('0x3f')){var _0xd540cf={};_0xd540cf[_0x5ede3c[_0x11f6('0x2b')]]={'$like':'%'+_0x41ddc8[_0x11f6('0x33')][_0x11f6('0x3d')]+'%'};return _0xd540cf;}})});}_0x51dc38=_['merge']({},_0x51dc38,_0x41ddc8[_0x11f6('0x40')]);var _0x1c082d={'where':_0x51dc38['where']};return db[_0x11f6('0x2f')][_0x11f6('0x20')](_0x1c082d)[_0x11f6('0x26')](function(_0x1fe6be){_0x5b08a5[_0x11f6('0x20')]=_0x1fe6be;if(_0x41ddc8['query']['includeAll']){_0x51dc38[_0x11f6('0x41')]=[{'all':!![]}];}return db['Plugin'][_0x11f6('0x42')](_0x51dc38);})[_0x11f6('0x26')](function(_0x4adf49){_0x5b08a5[_0x11f6('0x43')]=_0x4adf49;return _0x5b08a5;})['then'](respondWithFilteredResult(_0x4f2a9b,_0x51dc38))[_0x11f6('0x44')](handleError(_0x4f2a9b,null));};exports['show']=function(_0x16e602,_0x2f1050){var _0x3982f2={'raw':!![],'where':{'id':_0x16e602[_0x11f6('0x45')]['id']}},_0x245c3b={};_0x245c3b[_0x11f6('0x32')]=_['keys'](db[_0x11f6('0x2f')][_0x11f6('0x46')]);_0x245c3b[_0x11f6('0x33')]=_[_0x11f6('0x34')](_0x16e602[_0x11f6('0x33')]);_0x245c3b['filters']=_[_0x11f6('0x36')](_0x245c3b['model'],_0x245c3b[_0x11f6('0x33')]);_0x3982f2[_0x11f6('0x37')]=_[_0x11f6('0x36')](_0x245c3b[_0x11f6('0x32')],qs['fields'](_0x16e602[_0x11f6('0x33')]['fields']));_0x3982f2['attributes']=_0x3982f2[_0x11f6('0x37')][_0x11f6('0x39')]?_0x3982f2[_0x11f6('0x37')]:_0x245c3b[_0x11f6('0x32')];if(_0x16e602[_0x11f6('0x33')][_0x11f6('0x47')]){_0x3982f2[_0x11f6('0x41')]=[{'all':!![]}];}_0x3982f2=_[_0x11f6('0x48')]({},_0x3982f2,_0x16e602[_0x11f6('0x40')]);return db['Plugin'][_0x11f6('0x49')](_0x3982f2)[_0x11f6('0x26')](handleEntityNotFound(_0x2f1050,null))[_0x11f6('0x26')](respondWithResult(_0x2f1050,null))[_0x11f6('0x44')](handleError(_0x2f1050,null));};exports[_0x11f6('0x4a')]=function(_0xf1fd58,_0x2d8144,_0x45f0dd){return db['Plugin'][_0x11f6('0x49')]({'where':{'id':_0xf1fd58[_0x11f6('0x45')]['id']},'attributes':[_0x11f6('0x2b'),_0x11f6('0x6')],'raw':!![]})[_0x11f6('0x26')](handleEntityNotFound(_0x2d8144,null))['then'](function(_0x52d5a1){if(_0x52d5a1){var _0x33241b=path['join'](config[_0x11f6('0x4b')],_0x11f6('0x4c'),util[_0x11f6('0x4d')](_0x11f6('0x4e'),path[_0x11f6('0x4f')](_0x52d5a1[_0x11f6('0x6')])));var _0xcd11ee=fs[_0x11f6('0x50')](_0x33241b);var _0x3700be=archiver('zip',{'zlib':{'level':0x9}});_0x3700be['on'](_0x11f6('0x51'),function(_0xfe3868){if(_0xfe3868[_0x11f6('0x52')]===_0x11f6('0x53')){logger[_0x11f6('0x29')](_0xfe3868);}else{throw new db['Sequelize'][(_0x11f6('0x54'))](_0x11f6('0x55'));}});_0x3700be['on'](_0x11f6('0x29'),function(_0x2c8021){throw new db[(_0x11f6('0x56'))]['Error'](_0x11f6('0x55'));});_0x3700be[_0x11f6('0x57')](_0xcd11ee);_0x3700be['glob'](_0x11f6('0x58'),{'cwd':path[_0x11f6('0x59')](config['root'],_0x11f6('0x4c'),path[_0x11f6('0x5a')](_0x52d5a1[_0x11f6('0x6')])),'ignore':[path['join'](path[_0x11f6('0x4f')](_0x52d5a1[_0x11f6('0x6')]),_0x11f6('0x5b')),path[_0x11f6('0x59')](path[_0x11f6('0x4f')](_0x52d5a1[_0x11f6('0x6')]),'attachments/**/*')],'nodir':!![]})[_0x11f6('0x5c')]();_0xcd11ee['on']('close',function(){if(!fs[_0x11f6('0x5d')](_0x33241b)){throw new db[(_0x11f6('0x56'))][(_0x11f6('0x54'))](_0x11f6('0x5e'));}return _0x2d8144['download'](_0x33241b,util[_0x11f6('0x4d')](_0x11f6('0x4e'),path[_0x11f6('0x4f')](_0x52d5a1[_0x11f6('0x6')])),function(_0x31e59e){if(_0x31e59e){throw new db[(_0x11f6('0x56'))][(_0x11f6('0x54'))](_0x11f6('0x5f'));}fs[_0x11f6('0x60')](_0x33241b);logger[_0x11f6('0x61')](_0x11f6('0x62'));logger[_0x11f6('0x61')](_0x11f6('0x63'));});});}return null;})[_0x11f6('0x44')](handleError(_0x2d8144,null));};exports[_0x11f6('0x64')]=function(_0x452a31,_0x172096,_0x46c5d8){var _0x51ba42=path[_0x11f6('0x4f')](_0x452a31[_0x11f6('0x65')][_0x11f6('0x66')],path[_0x11f6('0x67')](_0x452a31[_0x11f6('0x65')][_0x11f6('0x66')]));var _0x2114e1=path['join'](config[_0x11f6('0x4b')],_0x11f6('0x4c'),_0x452a31[_0x11f6('0x65')][_0x11f6('0x66')]);var _0x18a85b=path['join'](config[_0x11f6('0x4b')],'server/files/plugins',_0x51ba42);logger[_0x11f6('0x61')](_0x11f6('0x68'),_0x2114e1);logger['info'](_0x11f6('0x69'),_0x18a85b);try{fs[_0x11f6('0x6a')](_0x2114e1,parseInt(_0x11f6('0x6b'),0x8));extract(_0x2114e1,{'dir':_0x18a85b},function(_0x138537){if(_0x138537){logger[_0x11f6('0x29')](_0x138537);handleError(_0x138537,!![]);};var _0x1384ec=fs[_0x11f6('0x6c')](_0x18a85b);if(_0x1384ec[_0x11f6('0x39')]>0x1){removeReferences(_0x2114e1,_0x18a85b);logger[_0x11f6('0x29')]('Invalid\x20plugin\x20structure');return _0x46c5d8(new Error(_0x11f6('0x6d')));}var _0x5d44c4=fs[_0x11f6('0x6e')](path[_0x11f6('0x59')](_0x18a85b,_0x1384ec[0x0]));if(_0x5d44c4[_0x11f6('0x6f')]()){removeReferences(_0x2114e1,_0x18a85b);logger[_0x11f6('0x29')](_0x11f6('0x6d'));return _0x46c5d8(new Error(_0x11f6('0x6d')));}if(_0x5d44c4[_0x11f6('0x70')]()){var _0x7b16a=fs[_0x11f6('0x6c')](path[_0x11f6('0x59')](_0x18a85b,_0x1384ec[0x0]));if(_0x7b16a[_0x11f6('0x39')]===0x0){removeReferences(_0x2114e1,_0x18a85b);logger['error'](_0x11f6('0x6d'));return _0x46c5d8(new Error(_0x11f6('0x6d')));}var _0x408e67=_0x7b16a['some'](function(_0x5b063b){return _0x5b063b===_0x11f6('0x71');});if(!_0x408e67){return _0x46c5d8(new Error('Plugin\x20manifest\x20missing'));}var _0x463c53=fs[_0x11f6('0x72')](path[_0x11f6('0x59')](_0x18a85b,_0x1384ec[0x0],_0x11f6('0x71')));var _0x2e5510=JSON['parse'](_0x463c53);if('undefined'==typeof _0x2e5510['name']){return _0x46c5d8(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x11f6('0x1d')==typeof _0x2e5510[_0x11f6('0x30')]){return _0x46c5d8(new Error(_0x11f6('0x73')));}if(_0x11f6('0x1d')==typeof _0x2e5510[_0x11f6('0x74')]){return _0x46c5d8(new Error(_0x11f6('0x75')));}if(_0x11f6('0x1d')==typeof _0x2e5510[_0x11f6('0x76')]){return _0x46c5d8(new Error(_0x11f6('0x77')));}if(_0x2e5510[_0x11f6('0x30')]===_0x11f6('0x78')){if(_0x11f6('0x1d')==typeof _0x2e5510[_0x11f6('0x76')][_0x11f6('0x79')]){return _0x46c5d8(new Error(_0x11f6('0x7a')));}if(_0x11f6('0x1d')==typeof _0x2e5510[_0x11f6('0x76')][_0x11f6('0x79')][_0x11f6('0x7b')]&&_0x11f6('0x1d')==typeof _0x2e5510[_0x11f6('0x76')]['views'][_0x11f6('0x7c')]){return _0x46c5d8(new Error(_0x11f6('0x7d')));}}else if(_0x2e5510['type']===_0x11f6('0x7e')){if(_0x11f6('0x1d')==typeof _0x2e5510[_0x11f6('0x76')]['scriptName']){return _0x46c5d8(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x2e5510['parameters']['scriptPath']){return _0x46c5d8(new Error(_0x11f6('0x7f')));}}else{return _0x46c5d8(new Error(_0x11f6('0x80')));}var _0x488fde=_0x2e5510[_0x11f6('0x2b')];var _0x48d045=_0x2e5510[_0x11f6('0x81')];var _0x1c185d=_0x2e5510[_0x11f6('0x30')];var _0x24b3d9=_0x2e5510[_0x11f6('0x82')]?_0x2e5510['sidebar']:'always';var _0x1c4dae=_0x2e5510[_0x11f6('0x83')]?_0x2e5510[_0x11f6('0x83')]:_0x11f6('0x84');var _0x1268e1='';var _0x1faa36='';var _0x5ceed4='';var _0x2bc218='';var _0x35e87f=_0x2e5510[_0x11f6('0x74')];if(_0x1c185d===_0x11f6('0x78')){if(_0x11f6('0x1d')!=typeof _0x2e5510[_0x11f6('0x76')][_0x11f6('0x79')]['admin']){var _0x51df25=_0x2e5510[_0x11f6('0x76')][_0x11f6('0x79')][_0x11f6('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x11f6('0x85')](_0x51df25)){_0x1268e1=path[_0x11f6('0x59')](_0x11f6('0x86'),_0x51ba42,_0x1384ec[0x0],_0x51df25);}else{_0x1268e1=_0x51df25;}}else{logger[_0x11f6('0x61')](_0x11f6('0x87'));}if(_0x11f6('0x1d')!=typeof _0x2e5510[_0x11f6('0x76')]['views'][_0x11f6('0x7c')]){var _0x30d4db=_0x2e5510[_0x11f6('0x76')][_0x11f6('0x79')][_0x11f6('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x11f6('0x85')](_0x30d4db)){_0x1faa36=path[_0x11f6('0x59')](_0x11f6('0x86'),_0x51ba42,_0x1384ec[0x0],_0x30d4db);}else{_0x1faa36=_0x30d4db;}}else{logger[_0x11f6('0x61')](_0x11f6('0x88'));}}else if(_0x1c185d===_0x11f6('0x7e')){_0x5ceed4=_0x2e5510['parameters']['scriptName'];_0x2bc218=_0x2e5510[_0x11f6('0x76')][_0x11f6('0x89')];if(_0x11f6('0x1d')!=typeof _0x2e5510['parameters'][_0x11f6('0x79')]){if('undefined'!=typeof _0x2e5510['parameters'][_0x11f6('0x79')][_0x11f6('0x7b')]){var _0x51df25=_0x2e5510[_0x11f6('0x76')][_0x11f6('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x11f6('0x85')](_0x51df25)){_0x1268e1=path[_0x11f6('0x59')]('plugins',_0x51ba42,_0x1384ec[0x0],_0x51df25);}else{_0x1268e1=_0x51df25;}}if(_0x11f6('0x1d')!=typeof _0x2e5510[_0x11f6('0x76')][_0x11f6('0x79')]['agent']){var _0x30d4db=_0x2e5510[_0x11f6('0x76')]['views'][_0x11f6('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x11f6('0x85')](_0x30d4db)){_0x1faa36=path[_0x11f6('0x59')](_0x11f6('0x86'),_0x51ba42,_0x1384ec[0x0],_0x30d4db);}else{_0x1faa36=_0x30d4db;}}}}var _0x502f3b={'name':_0x488fde,'description':_0x48d045,'path':path[_0x11f6('0x59')](_0x51ba42,_0x1384ec[0x0]),'type':_0x1c185d,'sidebar':_0x24b3d9,'icon':_0x1c4dae,'adminUrl':_0x1268e1,'agentUrl':_0x1faa36,'scriptName':_0x5ceed4,'scriptPath':_0x2bc218,'version':_0x35e87f};removeReferences(_0x2114e1,null);return db[_0x11f6('0x2f')]['create'](_0x502f3b)[_0x11f6('0x26')](function(_0x207afe){var _0x12a12e={'role':_0x452a31[_0x11f6('0x8a')][_0x11f6('0x8b')],'userProfileId':_0x452a31[_0x11f6('0x8a')]['userProfileId']};if(!_0x12a12e)throw new Error(_0x11f6('0x8c'));if(_0x12a12e[_0x11f6('0x8b')]===_0x11f6('0x8d')){var _0x3bd741=_0x207afe[_0x11f6('0x8e')]({'plain':!![]});return db[_0x11f6('0x8f')][_0x11f6('0x49')]({'where':{'name':'Plugins','userProfileId':_0x12a12e[_0x11f6('0x90')]},'raw':!![]})[_0x11f6('0x26')](function(_0x2e66dd){if(_0x2e66dd&&_0x2e66dd[_0x11f6('0x91')]===0x0){return db[_0x11f6('0x92')]['create']({'name':_0x3bd741['name'],'resourceId':_0x3bd741['id'],'type':_0x2e66dd['name'],'sectionId':_0x2e66dd['id']},{})[_0x11f6('0x26')](function(){return _0x207afe;});}else{return _0x207afe;}})['catch'](function(_0x302bda){logger[_0x11f6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x302bda);throw _0x302bda;});}return _0x207afe;})['then'](respondWithResult(_0x172096,null))[_0x11f6('0x44')](handleError(_0x172096,null));}});}catch(_0x4af006){_0x172096[_0x11f6('0x1b')](0x1f4)[_0x11f6('0x2c')](_0x4af006);}};function removeReferences(_0x220a9a,_0x9a53b6){try{if(_0x220a9a){fs[_0x11f6('0x60')](_0x220a9a);logger[_0x11f6('0x61')]('Zip\x20archive\x20removed');}if(_0x9a53b6){rimraf(_0x9a53b6,function(){});logger[_0x11f6('0x61')]('Extracted\x20folder\x20removed');}}catch(_0x4cfb3d){logger['error'](_0x4cfb3d);}}exports[_0x11f6('0x25')]=function(_0x793063,_0x15eab7,_0xcd4eae){return db[_0x11f6('0x2f')][_0x11f6('0x49')]({'where':{'id':_0x793063[_0x11f6('0x45')]['id']}})[_0x11f6('0x26')](handleEntityNotFound(_0x15eab7,null))['then'](saveUpdates(_0x793063[_0x11f6('0x8a')],null))['then'](respondWithResult(_0x15eab7,null))[_0x11f6('0x44')](handleError(_0x15eab7,null));};exports[_0x11f6('0x93')]=function(_0x3f6504,_0x43fabc,_0x592e81){return db[_0x11f6('0x2f')][_0x11f6('0x49')]({'where':{'id':_0x3f6504[_0x11f6('0x45')]['id']}})[_0x11f6('0x26')](function(_0x45c7e4){if(_0x45c7e4){return _0x45c7e4['destroy']();}})[_0x11f6('0x26')](function(_0x1c6892){rimraf(path[_0x11f6('0x59')](config[_0x11f6('0x4b')],_0x11f6('0x4c'),path['dirname'](_0x1c6892[_0x11f6('0x6')])),function(){});return _0x1c6892;})['then'](handleEntityNotFound(_0x43fabc,null))['then'](respondWithStatusCode(_0x43fabc,null))['catch'](handleError(_0x43fabc,null));};exports[_0x11f6('0x94')]=function(_0x2b3772,_0x7cda4c,_0x1317c4){return BPromise['resolve']()[_0x11f6('0x26')](function(){if(!_0x2b3772[_0x11f6('0x33')][_0x11f6('0x6')]){throw new Error(_0x11f6('0x95'));}if(!_0x2b3772['query'][_0x11f6('0x96')]){throw new Error(_0x11f6('0x97'));}var _0x5d6e54=_0x2b3772[_0x11f6('0x33')]['hostname']?_0x2b3772[_0x11f6('0x33')][_0x11f6('0x98')]+':'+_0x2b3772[_0x11f6('0x33')][_0x11f6('0x96')]:_0x11f6('0x99')+_0x2b3772[_0x11f6('0x33')]['port'];var _0x4b73f=_0x2b3772[_0x11f6('0x33')][_0x11f6('0x1c')]?_0x2b3772[_0x11f6('0x33')][_0x11f6('0x1c')]:!![];var _0x1517ec=_0x2b3772[_0x11f6('0x33')]['encoding']?_0x2b3772[_0x11f6('0x33')][_0x11f6('0x9a')]:null;var _0x513159={'method':_0x2b3772[_0x11f6('0x9b')],'uri':util[_0x11f6('0x4d')]('%s%s',_0x5d6e54,_0x2b3772[_0x11f6('0x33')][_0x11f6('0x6')]),'json':_0x4b73f,'resolveWithFullResponse':!![],'encoding':_0x1517ec,'qs':_0x2b3772[_0x11f6('0x33')]};if(_0x2b3772[_0x11f6('0x9c')]){_0x513159[_0x11f6('0x9c')]=_0x2b3772[_0x11f6('0x9c')];if(_0x513159[_0x11f6('0x9c')]['content-length']){delete _0x513159['headers'][_0x11f6('0x9d')];}}if(_0x513159[_0x11f6('0x9c')][_0x11f6('0x9e')]){delete _0x513159['headers'][_0x11f6('0x9e')];}return rp(_0x513159);})[_0x11f6('0x26')](function(_0x5326fc){if(_0x5326fc){_0x7cda4c[_0x11f6('0x21')](_0x5326fc[_0x11f6('0x9c')]);logger[_0x11f6('0x61')](_0x5326fc[_0x11f6('0x8a')]);if(_[_0x11f6('0x9f')](_0x2b3772[_0x11f6('0x33')][_0x11f6('0x6')],_0x11f6('0x4a'))&&_0x5326fc[_0x11f6('0xa0')]==0x1f4){return _0x7cda4c[_0x11f6('0x19')](_0x5326fc['statusCode']);}else{return _0x7cda4c[_0x11f6('0x1b')](_0x5326fc[_0x11f6('0xa0')])[_0x11f6('0x2c')](_0x5326fc['body']);}}else{return _0x7cda4c['sendStatus'](0xc8);}})[_0x11f6('0x44')](handleError(_0x7cda4c,null));};exports[_0x11f6('0xa1')]=function(_0x149d03,_0x31a1a0,_0x466869){return BPromise[_0x11f6('0xa2')]()['then'](function(){if(!_0x149d03[_0x11f6('0x33')][_0x11f6('0x6')]){throw new Error(_0x11f6('0x95'));}if(!_0x149d03[_0x11f6('0x33')][_0x11f6('0x96')]){throw new Error(_0x11f6('0x97'));}var _0x2ea875=_0x149d03[_0x11f6('0x33')][_0x11f6('0x98')]?_0x149d03[_0x11f6('0x33')]['hostname']+':'+_0x149d03[_0x11f6('0x33')][_0x11f6('0x96')]:'http://localhost:'+_0x149d03['query'][_0x11f6('0x96')];var _0xe33941=_0x149d03[_0x11f6('0x33')][_0x11f6('0x1c')]?_0x149d03[_0x11f6('0x33')][_0x11f6('0x1c')]:!![];var _0x355349=_0x149d03[_0x11f6('0x33')]['encoding']?_0x149d03['query']['encoding']:null;var _0x368b18={'method':_0x149d03['method'],'uri':util['format'](_0x11f6('0xa3'),_0x2ea875,_0x149d03[_0x11f6('0x33')]['path']),'json':_0xe33941,'resolveWithFullResponse':!![],'encoding':_0x355349,'body':_0x149d03[_0x11f6('0x8a')]};if(_0x149d03[_0x11f6('0x9c')]){_0x368b18[_0x11f6('0x9c')]=_0x149d03[_0x11f6('0x9c')];if(_0x368b18[_0x11f6('0x9c')][_0x11f6('0x9d')]){delete _0x368b18[_0x11f6('0x9c')][_0x11f6('0x9d')];}}if(_0x368b18[_0x11f6('0x9c')]['content-type']){delete _0x368b18[_0x11f6('0x9c')][_0x11f6('0x9e')];}return rp(_0x368b18);})[_0x11f6('0x26')](function(_0x1124b3){if(_0x1124b3){_0x31a1a0[_0x11f6('0x21')](_0x1124b3[_0x11f6('0x9c')]);logger[_0x11f6('0x61')](_0x1124b3['body']);return _0x31a1a0[_0x11f6('0x1b')](_0x1124b3[_0x11f6('0xa0')])[_0x11f6('0x2c')](_0x1124b3[_0x11f6('0x8a')]);}else{return _0x31a1a0['sendStatus'](0xc8);}})[_0x11f6('0x44')](handleError(_0x31a1a0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1912aff..fcb8233 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 _0xed20=['../../mysqldb','Plugin','save','update','remove','emit','hook','exports','events'];(function(_0x2e9ded,_0x235e2b){var _0xc88a61=function(_0x1baa4b){while(--_0x1baa4b){_0x2e9ded['push'](_0x2e9ded['shift']());}};_0xc88a61(++_0x235e2b);}(_0xed20,0xce));var _0x0ed2=function(_0xe55d53,_0x4f4313){_0xe55d53=_0xe55d53-0x0;var _0x3e62f5=_0xed20[_0xe55d53];return _0x3e62f5;};'use strict';var EventEmitter=require(_0x0ed2('0x0'));var Plugin=require(_0x0ed2('0x1'))['db'][_0x0ed2('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ed2('0x3'),'afterUpdate':_0x0ed2('0x4'),'afterDestroy':_0x0ed2('0x5')};function emitEvent(_0x2a6405){return function(_0x395e2d,_0x20cac9,_0x5693ea){PluginEvents[_0x0ed2('0x6')](_0x2a6405+':'+_0x395e2d['id'],_0x395e2d);PluginEvents[_0x0ed2('0x6')](_0x2a6405,_0x395e2d);_0x5693ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x0ed2('0x7')](e,emitEvent(event));}}module[_0x0ed2('0x8')]=PluginEvents; \ No newline at end of file +var _0x87f1=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x4ee18e,_0x2bc37a){var _0x1e2024=function(_0x1ec82d){while(--_0x1ec82d){_0x4ee18e['push'](_0x4ee18e['shift']());}};_0x1e2024(++_0x2bc37a);}(_0x87f1,0x170));var _0x187f=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x87f1[_0x171fdc];return _0x3782ea;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x187f('0x0'))['db'][_0x187f('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x187f('0x2')](0x0);var events={'afterCreate':_0x187f('0x3'),'afterUpdate':_0x187f('0x4'),'afterDestroy':_0x187f('0x5')};function emitEvent(_0x233cda){return function(_0x5eafdc,_0x19e8fb,_0x4c6db8){PluginEvents[_0x187f('0x6')](_0x233cda+':'+_0x5eafdc['id'],_0x5eafdc);PluginEvents['emit'](_0x233cda,_0x5eafdc);_0x4c6db8(null);};}for(var e in events){if(events[_0x187f('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x187f('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f4177ca..a30cff5 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 _0x8ead=['plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','Plugin'];(function(_0x3bea39,_0x50c5d3){var _0x20535e=function(_0x6fd0e7){while(--_0x6fd0e7){_0x3bea39['push'](_0x3bea39['shift']());}};_0x20535e(++_0x50c5d3);}(_0x8ead,0xc4));var _0xd8ea=function(_0x2e82c2,_0x3ca803){_0x2e82c2=_0x2e82c2-0x0;var _0x9af733=_0x8ead[_0x2e82c2];return _0x9af733;};'use strict';var _=require(_0xd8ea('0x0'));var util=require(_0xd8ea('0x1'));var logger=require(_0xd8ea('0x2'))(_0xd8ea('0x3'));var moment=require(_0xd8ea('0x4'));var BPromise=require(_0xd8ea('0x5'));var rp=require(_0xd8ea('0x6'));var fs=require('fs');var path=require(_0xd8ea('0x7'));var rimraf=require(_0xd8ea('0x8'));var config=require(_0xd8ea('0x9'));var attributes=require(_0xd8ea('0xa'));module['exports']=function(_0x29d31b,_0x2f7e0b){return _0x29d31b['define'](_0xd8ea('0xb'),attributes,{'tableName':_0xd8ea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b5f=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x2bbac9,_0x1b5314){var _0x2dd16b=function(_0x4c7b10){while(--_0x4c7b10){_0x2bbac9['push'](_0x2bbac9['shift']());}};_0x2dd16b(++_0x1b5314);}(_0x3b5f,0x1bf));var _0xf3b5=function(_0x3d1b8f,_0x284060){_0x3d1b8f=_0x3d1b8f-0x0;var _0x10c741=_0x3b5f[_0x3d1b8f];return _0x10c741;};'use strict';var _=require(_0xf3b5('0x0'));var util=require(_0xf3b5('0x1'));var logger=require(_0xf3b5('0x2'))(_0xf3b5('0x3'));var moment=require(_0xf3b5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3b5('0x5'));var rimraf=require(_0xf3b5('0x6'));var config=require(_0xf3b5('0x7'));var attributes=require(_0xf3b5('0x8'));module[_0xf3b5('0x9')]=function(_0x777c6a,_0x5d424c){return _0x777c6a[_0xf3b5('0xa')](_0xf3b5('0xb'),attributes,{'tableName':_0xf3b5('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 c07cad5..16dc2a1 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 _0xd775=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','CreatePlugin','Plugin','create','body','options','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x1d292b,_0x514402){var _0x4c492e=function(_0x3af064){while(--_0x3af064){_0x1d292b['push'](_0x1d292b['shift']());}};_0x4c492e(++_0x514402);}(_0xd775,0xa2));var _0x5d77=function(_0x4a89f9,_0x49d3ba){_0x4a89f9=_0x4a89f9-0x0;var _0x19556c=_0xd775[_0x4a89f9];return _0x19556c;};'use strict';var _=require(_0x5d77('0x0'));var util=require('util');var moment=require(_0x5d77('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d77('0x2'));var fs=require('fs');var Redis=require(_0x5d77('0x3'));var db=require(_0x5d77('0x4'))['db'];var utils=require(_0x5d77('0x5'));var logger=require(_0x5d77('0x6'))(_0x5d77('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d77('0x8'));var client=jayson[_0x5d77('0x9')][_0x5d77('0xa')]({'port':0x232a});config['redis']=_[_0x5d77('0xb')](config[_0x5d77('0xc')],{'host':_0x5d77('0xd'),'port':0x18eb});var socket=require(_0x5d77('0xe'))(new Redis(config[_0x5d77('0xc')]));require('./plugin.socket')[_0x5d77('0xf')](socket);function respondWithRpcPromise(_0x519f0e,_0x352acc,_0x50057d){return new BPromise(function(_0x4fe26f,_0x1bd356){return client[_0x5d77('0x10')](_0x519f0e,_0x50057d)[_0x5d77('0x11')](function(_0xe9787c){logger[_0x5d77('0x12')](_0x5d77('0x13'),_0x352acc,_0x5d77('0x14'));logger[_0x5d77('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x352acc,_0x5d77('0x14'),JSON[_0x5d77('0x16')](_0xe9787c));if(_0xe9787c[_0x5d77('0x17')]){if(_0xe9787c[_0x5d77('0x17')]['code']===0x1f4){logger[_0x5d77('0x17')](_0x5d77('0x13'),_0x352acc,_0xe9787c[_0x5d77('0x17')][_0x5d77('0x18')]);return _0x1bd356(_0xe9787c[_0x5d77('0x17')]['message']);}logger[_0x5d77('0x17')]('Plugin,\x20%s,\x20%s',_0x352acc,_0xe9787c[_0x5d77('0x17')][_0x5d77('0x18')]);return _0x4fe26f(_0xe9787c['error'][_0x5d77('0x18')]);}else{logger[_0x5d77('0x12')](_0x5d77('0x13'),_0x352acc,'request\x20sent');_0x4fe26f(_0xe9787c['result']['message']);}})['catch'](function(_0x3aebba){logger[_0x5d77('0x17')]('Plugin,\x20%s,\x20%s',_0x352acc,_0x3aebba);_0x1bd356(_0x3aebba);});});}exports[_0x5d77('0x19')]=function(_0x2ed828){var _0x5a9b1f=this;return new Promise(function(_0x4b0369,_0x5bcdd3){return db[_0x5d77('0x1a')][_0x5d77('0x1b')](_0x2ed828[_0x5d77('0x1c')],{'raw':_0x2ed828[_0x5d77('0x1d')]?_0x2ed828[_0x5d77('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x5d77('0x11')](function(_0x2a8271){logger[_0x5d77('0x12')](_0x5d77('0x19'),_0x2ed828);logger[_0x5d77('0x15')](_0x5d77('0x19'),_0x2ed828,JSON[_0x5d77('0x16')](_0x2a8271));_0x4b0369(_0x2a8271);})['catch'](function(_0x5a4478){logger[_0x5d77('0x17')](_0x5d77('0x19'),_0x5a4478[_0x5d77('0x18')],_0x2ed828);_0x5bcdd3(_0x5a9b1f[_0x5d77('0x17')](0x1f4,_0x5a4478[_0x5d77('0x18')]));});});}; \ No newline at end of file +var _0x05a3=['debug','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','create','body','options','raw'];(function(_0x3b99ca,_0x397d51){var _0x437a5f=function(_0x19e328){while(--_0x19e328){_0x3b99ca['push'](_0x3b99ca['shift']());}};_0x437a5f(++_0x397d51);}(_0x05a3,0x1a6));var _0x305a=function(_0x5cbfa8,_0x4e22c1){_0x5cbfa8=_0x5cbfa8-0x0;var _0x8ce103=_0x05a3[_0x5cbfa8];return _0x8ce103;};'use strict';var _=require('lodash');var util=require(_0x305a('0x0'));var moment=require(_0x305a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x305a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x305a('0x3'));var logger=require(_0x305a('0x4'))(_0x305a('0x5'));var config=require(_0x305a('0x6'));var jayson=require(_0x305a('0x7'));var client=jayson[_0x305a('0x8')][_0x305a('0x9')]({'port':0x232a});config[_0x305a('0xa')]=_['defaults'](config[_0x305a('0xa')],{'host':_0x305a('0xb'),'port':0x18eb});var socket=require(_0x305a('0xc'))(new Redis(config[_0x305a('0xa')]));require('./plugin.socket')[_0x305a('0xd')](socket);function respondWithRpcPromise(_0x5ac091,_0x39832c,_0x1a9337){return new BPromise(function(_0x4ee868,_0x1f6775){return client[_0x305a('0xe')](_0x5ac091,_0x1a9337)[_0x305a('0xf')](function(_0x277d97){logger[_0x305a('0x10')]('Plugin,\x20%s,\x20%s',_0x39832c,_0x305a('0x11'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x39832c,_0x305a('0x11'),JSON['stringify'](_0x277d97));if(_0x277d97[_0x305a('0x12')]){if(_0x277d97[_0x305a('0x12')][_0x305a('0x13')]===0x1f4){logger[_0x305a('0x12')](_0x305a('0x14'),_0x39832c,_0x277d97['error'][_0x305a('0x15')]);return _0x1f6775(_0x277d97['error'][_0x305a('0x15')]);}logger[_0x305a('0x12')](_0x305a('0x14'),_0x39832c,_0x277d97[_0x305a('0x12')][_0x305a('0x15')]);return _0x4ee868(_0x277d97[_0x305a('0x12')][_0x305a('0x15')]);}else{logger[_0x305a('0x10')](_0x305a('0x14'),_0x39832c,_0x305a('0x11'));_0x4ee868(_0x277d97[_0x305a('0x16')]['message']);}})['catch'](function(_0x161109){logger[_0x305a('0x12')](_0x305a('0x14'),_0x39832c,_0x161109);_0x1f6775(_0x161109);});});}exports[_0x305a('0x17')]=function(_0x13cecd){var _0x5d91fe=this;return new Promise(function(_0x39c8fe,_0xd2168b){return db['Plugin'][_0x305a('0x18')](_0x13cecd[_0x305a('0x19')],{'raw':_0x13cecd[_0x305a('0x1a')]?_0x13cecd[_0x305a('0x1a')][_0x305a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1937ba){logger[_0x305a('0x10')](_0x305a('0x17'),_0x13cecd);logger[_0x305a('0x1c')](_0x305a('0x17'),_0x13cecd,JSON['stringify'](_0x1937ba));_0x39c8fe(_0x1937ba);})[_0x305a('0x1d')](function(_0x42a756){logger[_0x305a('0x12')](_0x305a('0x17'),_0x42a756['message'],_0x13cecd);_0xd2168b(_0x5d91fe[_0x305a('0x12')](0x1f4,_0x42a756['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9439ce6..3ad1e62 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 _0xed4a=['save','update','emit','removeListener','register','length','./plugin.events'];(function(_0x3af767,_0x120b51){var _0x3d269b=function(_0x507550){while(--_0x507550){_0x3af767['push'](_0x3af767['shift']());}};_0x3d269b(++_0x120b51);}(_0xed4a,0x14f));var _0xaed4=function(_0x19fb4e,_0x272daa){_0x19fb4e=_0x19fb4e-0x0;var _0x596d79=_0xed4a[_0x19fb4e];return _0x596d79;};'use strict';var PluginEvents=require(_0xaed4('0x0'));var events=[_0xaed4('0x1'),'remove',_0xaed4('0x2')];function createListener(_0x42731e,_0x3f6727){return function(_0x1ee4ed){_0x3f6727[_0xaed4('0x3')](_0x42731e,_0x1ee4ed);};}function removeListener(_0xa3742c,_0x161b21){return function(){PluginEvents[_0xaed4('0x4')](_0xa3742c,_0x161b21);};}exports[_0xaed4('0x5')]=function(_0x9bd725){for(var _0x254823=0x0,_0x31efcd=events[_0xaed4('0x6')];_0x254823<_0x31efcd;_0x254823++){var _0x323ab1=events[_0x254823];var _0x36b602=createListener('plugin:'+_0x323ab1,_0x9bd725);PluginEvents['on'](_0x323ab1,_0x36b602);}}; \ No newline at end of file +var _0xac4f=['./plugin.events','save','remove','emit','register','length','plugin:'];(function(_0x18d3d2,_0x48809e){var _0x582ee2=function(_0xf047f9){while(--_0xf047f9){_0x18d3d2['push'](_0x18d3d2['shift']());}};_0x582ee2(++_0x48809e);}(_0xac4f,0xcb));var _0xfac4=function(_0x34217a,_0x1f545a){_0x34217a=_0x34217a-0x0;var _0x23c2be=_0xac4f[_0x34217a];return _0x23c2be;};'use strict';var PluginEvents=require(_0xfac4('0x0'));var events=[_0xfac4('0x1'),_0xfac4('0x2'),'update'];function createListener(_0x4be7c4,_0x3eac85){return function(_0x33de54){_0x3eac85[_0xfac4('0x3')](_0x4be7c4,_0x33de54);};}function removeListener(_0x911c5,_0xffdef3){return function(){PluginEvents['removeListener'](_0x911c5,_0xffdef3);};}exports[_0xfac4('0x4')]=function(_0x1050ef){for(var _0x4a4f5f=0x0,_0x25730c=events[_0xfac4('0x5')];_0x4a4f5f<_0x25730c;_0x4a4f5f++){var _0xf0112e=events[_0x4a4f5f];var _0x3354d7=createListener(_0xfac4('0x6')+_0xf0112e,_0x1050ef);PluginEvents['on'](_0xf0112e,_0x3354d7);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8c496d0..566cd98 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(_0xd308f,_0x3d0a33){var _0x24595c=function(_0x3e51b9){while(--_0x3e51b9){_0xd308f['push'](_0xd308f['shift']());}};_0x24595c(++_0x3d0a33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x5b733a,_0x350238){var _0x2bf981=function(_0x350e4a){while(--_0x350e4a){_0x5b733a['push'](_0x5b733a['shift']());}};_0x2bf981(++_0x350238);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 fe14af5..d8da6c9 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 _0xb43b=['stack','name','send','npm\x20install','info','index','list','express','then','describe','catch','create','body','script','join','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x493dca,_0x2a50a4){_0x493dca=_0x493dca-0x0;var _0x28e711=_0xb43b[_0x493dca];return _0x28e711;};'use strict';var _=require(_0xbb43('0x0'));var pm2=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var path=require(_0xbb43('0x3'));var exec=require(_0xbb43('0x4'))['exec'];var BPromise=require(_0xbb43('0x5'));function handleEntityNotFound(_0x41aff6,_0x351254){return function(_0x16432a){if(!_0x16432a){_0x41aff6['sendStatus'](0x194);;}return _0x16432a;};}function respondWithResult(_0x491fb9,_0x378df5){_0x378df5=_0x378df5||0xc8;return function(_0x553520){if(_0x553520){return _0x491fb9[_0xbb43('0x6')](_0x378df5)[_0xbb43('0x7')](_0x553520);}return null;};}function handleError(_0x2a2f11,_0x29ae1a){_0x29ae1a=_0x29ae1a||0x1f4;return function(_0x364718){logger['error'](_0x364718[_0xbb43('0x8')]);if(_0x364718[_0xbb43('0x9')]){delete _0x364718['name'];}_0x2a2f11[_0xbb43('0x6')](_0x29ae1a)[_0xbb43('0xa')](_0x364718);};}function execChildProcess(){return new BPromise(function(_0xd37cdf,_0x5e3611){exec(_0xbb43('0xb'),function(_0x2bef86,_0x480cc2,_0x36a473){logger[_0xbb43('0xc')](_0x480cc2);logger['info'](_0x36a473);if(_0x2bef86){logger['error'](_0x2bef86);return _0x5e3611(_0x2bef86);}return _0xd37cdf(_0x480cc2);});});}exports[_0xbb43('0xd')]=function(_0x4a3714,_0x593d0b){return pm2[_0xbb43('0xe')]()['then'](function(_0x68d45d){if(_0x68d45d){var _0x43021d=_['reject'](_0x68d45d,function(_0x4a6e18){return _0x4a6e18['name']===_0xbb43('0xf')||_0x4a6e18[_0xbb43('0x9')]==='motion2';});return{'rows':_0x43021d,'count':_0x43021d['length']};}return null;})[_0xbb43('0x10')](respondWithResult(_0x593d0b,null))['catch'](handleError(_0x593d0b,null));};exports['show']=function(_0x2b0797,_0x8242ab){return pm2[_0xbb43('0x11')](_0x2b0797['params']['id'])[_0xbb43('0x10')](respondWithResult(_0x8242ab,null))['then'](handleEntityNotFound(_0x8242ab,null))[_0xbb43('0x12')](handleError(_0x8242ab,null));};exports[_0xbb43('0x13')]=function(_0x4dfc54,_0x5d765b){if(_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')]&&_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x15')]){var _0x5bcce7=path[_0xbb43('0x16')](__dirname,'../../files/plugins',_0x4dfc54[_0xbb43('0x14')]['script']);var _0x2f5e31=process['cwd']();process[_0xbb43('0x17')](path[_0xbb43('0x18')](_0x5bcce7));return execChildProcess()['then'](function(_0x1d0768){process['chdir'](_0x2f5e31);return pm2[_0xbb43('0x19')]({'name':_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')],'script':_0x5bcce7});})['then'](function(_0x53f0d5){pm2['dump']();return _0x53f0d5[0x0];})[_0xbb43('0x10')](respondWithResult(_0x5d765b,0xc9))[_0xbb43('0x12')](handleError(_0x5d765b,null));}else{return _0x5d765b['status'](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x1a')});}};exports[_0xbb43('0x1b')]=function(_0x3874fb,_0x4ed43f){if(_0x3874fb['body']['id']){delete _0x3874fb[_0xbb43('0x14')]['id'];}var _0x42800f={'online':_0xbb43('0x1c'),'stopped':_0xbb43('0x1d')};if(_0x42800f[_0xbb43('0x1e')](_0x3874fb[_0xbb43('0x14')][_0xbb43('0x6')])){return pm2[_0x42800f[_0x3874fb[_0xbb43('0x14')]['status']]](_0x3874fb[_0xbb43('0x1f')]['id'])['then'](respondWithResult(_0x4ed43f,0xc8))[_0xbb43('0x12')](handleError(_0x4ed43f,null));}else{return _0x4ed43f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x20')});}};exports['destroy']=function(_0x157d62,_0x547a6f){if(_0x157d62['body']['id']){delete _0x157d62['body']['id'];}if(_0x157d62[_0xbb43('0x1f')]['id']){return pm2['delete'](_0x157d62[_0xbb43('0x1f')]['id'])[_0xbb43('0x10')](function(_0xc577ac){pm2['dump']();return _0xc577ac[0x0];})[_0xbb43('0x10')](respondWithResult(_0x547a6f,null))[_0xbb43('0x12')](handleError(_0x547a6f,null));}else{return _0x547a6f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x21')});}}; \ No newline at end of file +var _0x91a7=['params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','length','show','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','catch','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0x91a7,0xe7));var _0x791a=function(_0x5866cb,_0xc2617a){_0x5866cb=_0x5866cb-0x0;var _0x3d5477=_0x91a7[_0x5866cb];return _0x3d5477;};'use strict';var _=require('lodash');var pm2=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var path=require('path');var exec=require(_0x791a('0x3'))['exec'];var BPromise=require(_0x791a('0x4'));function handleEntityNotFound(_0x535640,_0x50ab29){return function(_0x32fe2b){if(!_0x32fe2b){_0x535640[_0x791a('0x5')](0x194);;}return _0x32fe2b;};}function respondWithResult(_0x49a9b7,_0x361f53){_0x361f53=_0x361f53||0xc8;return function(_0x5db6db){if(_0x5db6db){return _0x49a9b7[_0x791a('0x6')](_0x361f53)[_0x791a('0x7')](_0x5db6db);}return null;};}function handleError(_0x5aa10a,_0x1a32b4){_0x1a32b4=_0x1a32b4||0x1f4;return function(_0x12884d){logger[_0x791a('0x8')](_0x12884d[_0x791a('0x9')]);if(_0x12884d[_0x791a('0xa')]){delete _0x12884d['name'];}_0x5aa10a[_0x791a('0x6')](_0x1a32b4)[_0x791a('0xb')](_0x12884d);};}function execChildProcess(){return new BPromise(function(_0x57e99c,_0x2bd26a){exec(_0x791a('0xc'),function(_0x167bc4,_0x17cf33,_0x2805c9){logger[_0x791a('0xd')](_0x17cf33);logger['info'](_0x2805c9);if(_0x167bc4){logger['error'](_0x167bc4);return _0x2bd26a(_0x167bc4);}return _0x57e99c(_0x17cf33);});});}exports[_0x791a('0xe')]=function(_0x2f2d8d,_0x4c56f0){return pm2[_0x791a('0xf')]()[_0x791a('0x10')](function(_0x5d5b11){if(_0x5d5b11){var _0x2887f0=_[_0x791a('0x11')](_0x5d5b11,function(_0x2ef5c5){return _0x2ef5c5[_0x791a('0xa')]==='express'||_0x2ef5c5[_0x791a('0xa')]==='motion2';});return{'rows':_0x2887f0,'count':_0x2887f0[_0x791a('0x12')]};}return null;})[_0x791a('0x10')](respondWithResult(_0x4c56f0,null))['catch'](handleError(_0x4c56f0,null));};exports[_0x791a('0x13')]=function(_0x5bea2e,_0x35fe48){return pm2['describe'](_0x5bea2e['params']['id'])['then'](respondWithResult(_0x35fe48,null))[_0x791a('0x10')](handleEntityNotFound(_0x35fe48,null))['catch'](handleError(_0x35fe48,null));};exports['create']=function(_0x39c60b,_0x5a702e){if(_0x39c60b[_0x791a('0x14')][_0x791a('0xa')]&&_0x39c60b['body'][_0x791a('0x15')]){var _0xcb5e66=path[_0x791a('0x16')](__dirname,_0x791a('0x17'),_0x39c60b['body'][_0x791a('0x15')]);var _0x2054c6=process[_0x791a('0x18')]();process[_0x791a('0x19')](path[_0x791a('0x1a')](_0xcb5e66));return execChildProcess()[_0x791a('0x10')](function(_0x2241a0){process[_0x791a('0x19')](_0x2054c6);return pm2[_0x791a('0x1b')]({'name':_0x39c60b[_0x791a('0x14')][_0x791a('0xa')],'script':_0xcb5e66});})['then'](function(_0x1102c9){pm2[_0x791a('0x1c')]();return _0x1102c9[0x0];})[_0x791a('0x10')](respondWithResult(_0x5a702e,0xc9))[_0x791a('0x1d')](handleError(_0x5a702e,null));}else{return _0x5a702e['status'](0x1f4)[_0x791a('0xb')]({'message':_0x791a('0x1e')});}};exports['update']=function(_0xdfa84f,_0x1785f5){if(_0xdfa84f[_0x791a('0x14')]['id']){delete _0xdfa84f['body']['id'];}var _0x29194d={'online':_0x791a('0x1f'),'stopped':_0x791a('0x20')};if(_0x29194d[_0x791a('0x21')](_0xdfa84f[_0x791a('0x14')][_0x791a('0x6')])){return pm2[_0x29194d[_0xdfa84f[_0x791a('0x14')][_0x791a('0x6')]]](_0xdfa84f['params']['id'])[_0x791a('0x10')](respondWithResult(_0x1785f5,0xc8))[_0x791a('0x1d')](handleError(_0x1785f5,null));}else{return _0x1785f5[_0x791a('0x6')](0x1f4)['send']({'message':_0x791a('0x22')});}};exports['destroy']=function(_0xc59f5e,_0x2e4ec8){if(_0xc59f5e[_0x791a('0x14')]['id']){delete _0xc59f5e[_0x791a('0x14')]['id'];}if(_0xc59f5e[_0x791a('0x23')]['id']){return pm2[_0x791a('0x24')](_0xc59f5e[_0x791a('0x23')]['id'])['then'](function(_0x3662c6){pm2[_0x791a('0x1c')]();return _0x3662c6[0x0];})[_0x791a('0x10')](respondWithResult(_0x2e4ec8,null))[_0x791a('0x1d')](handleError(_0x2e4ec8,null));}else{return _0x2e4ec8[_0x791a('0x6')](0x1f4)['send']({'message':_0x791a('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index ef1a734..6dfa77f 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 _0x4019=['/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x4019,0xc1));var _0x9401=function(_0x3ac8df,_0x148795){_0x3ac8df=_0x3ac8df-0x0;var _0x136a3f=_0x4019[_0x3ac8df];return _0x136a3f;};'use strict';var express=require(_0x9401('0x0'));var router=express[_0x9401('0x1')]();var auth=require(_0x9401('0x2'));var controller=require(_0x9401('0x3'));router[_0x9401('0x4')](_0x9401('0x5'),auth[_0x9401('0x6')](),controller[_0x9401('0x7')]);router['get'](_0x9401('0x8'),auth[_0x9401('0x6')](),controller[_0x9401('0x9')]);module[_0x9401('0xa')]=router; \ No newline at end of file +var _0xad36=['getAgents','/queues','exports','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x2b0595,_0x467b95){var _0x2bdea0=function(_0x201bb7){while(--_0x201bb7){_0x2b0595['push'](_0x2b0595['shift']());}};_0x2bdea0(++_0x467b95);}(_0xad36,0x153));var _0x6ad3=function(_0x396bbc,_0x3fe1a4){_0x396bbc=_0x396bbc-0x0;var _0x2b6225=_0xad36[_0x396bbc];return _0x2b6225;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x6ad3('0x0'));var controller=require(_0x6ad3('0x1'));router[_0x6ad3('0x2')](_0x6ad3('0x3'),auth[_0x6ad3('0x4')](),controller[_0x6ad3('0x5')]);router[_0x6ad3('0x2')](_0x6ad3('0x6'),auth['isAuthenticated'](),controller['getQueues']);module[_0x6ad3('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 32dd05b..62239ab 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 _0xb651=['isValidChannel','format','channel','toLowerCase','sort','validateSortParameter','getUpdatedSortOptions','fields','join','getRealtimeAgents','getSortedAgentsIdsByStatus','length','map','rawAttributes','fieldName','type','role','agent','online','getOptions','raw','push','sequelize','literal','FIELD(id,','order','forEach','merge','where','user','userProfileId','Agents','assign','UserProfile','getResources','User','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','globalStatus','includes','Pause','voice','voiceStatus','sortAgentsByStatus','split','pick','catch','key','name','outbound','dialMethod','QueueCampaigns','startCase','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','json','getChannels','query','globalQueueFilter','globalStatusFilter','pause','*pause','resolve','then'];(function(_0x226934,_0xe02df){var _0x4cef9b=function(_0x5cf11a){while(--_0x5cf11a){_0x226934['push'](_0x226934['shift']());}};_0x4cef9b(++_0xe02df);}(_0xb651,0x1ca));var _0x1b65=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb651[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1b65('0x0'));var util=require(_0x1b65('0x1'));var rta=require(_0x1b65('0x2'));var rtq=require(_0x1b65('0x3'));var qs=require(_0x1b65('0x4'));var utils=require(_0x1b65('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x1b65('0x6'))[_0x1b65('0x7')];var APIHandleError=require(_0x1b65('0x6'))['handleError'];function respondWithFilteredResult(_0x18c438,_0x181bb0){return function(_0x3cba53){if(_0x3cba53){var _0x226eaa=typeof _0x181bb0[_0x1b65('0x8')]===_0x1b65('0x9')&&typeof _0x181bb0[_0x1b65('0xa')]===_0x1b65('0x9');var _0x57c6d5=_0x3cba53[_0x1b65('0xb')];var _0xfb0ad0=_0x226eaa?0x0:_0x181bb0[_0x1b65('0x8')];var _0x305969=_0x226eaa?_0x3cba53[_0x1b65('0xb')]:_0x181bb0['offset']+_0x181bb0[_0x1b65('0xa')];var _0x11ba5d;if(_0x305969>=_0x57c6d5){_0x305969=_0x57c6d5;_0x11ba5d=0xc8;}else{_0x11ba5d=0xce;}_0x18c438[_0x1b65('0xc')](_0x11ba5d);return _0x18c438['set']('Content-Range',_0xfb0ad0+'-'+_0x305969+'/'+_0x57c6d5)[_0x1b65('0xd')](_0x3cba53);}return null;};}exports['getAgents']=function(_0x4c2aba,_0x225e43){var _0x2c101a={'count':0x0,'rows':[]};var _0x29c0ea={};var _0x52900d;var _0xccdb77=utils[_0x1b65('0xe')]();var _0x3a7d70;var _0x141a98;var _0x564658=_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x10')];var _0x3b5075=_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x11')];var _0x1cc2b7=_0x4c2aba['query']['pauseTypeFilter'];var _0x28edd7=_0x3b5075===_0x1b65('0x12')||_0x3b5075===_0x1b65('0x13')?!![]:![];var _0x51af4a=[];var _0x4efad7;var _0x4bf9b1;Promise[_0x1b65('0x14')]()[_0x1b65('0x15')](function(){if(_0x4c2aba['query']['channel']){if(!utils[_0x1b65('0x16')](_0x4c2aba[_0x1b65('0xf')]['channel'])){throw new APIBadRequestError(util[_0x1b65('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x18')]));}_0x52900d=_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x18')][_0x1b65('0x19')]();}if(!_0x4c2aba['query'][_0x1b65('0x1a')]||!_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1a')]['includes']('globalStatus')){_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1a')]=rta[_0x1b65('0x1b')](_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1a')]);return;}var _0x1ca83f=rta[_0x1b65('0x1c')](_0x4c2aba['query']['sort']);_0x4c2aba['query'][_0x1b65('0x1a')]=_0x1ca83f[_0x1b65('0x1d')][_0x1b65('0x1e')](',');_0x4efad7=_0x1ca83f['order'];})[_0x1b65('0x15')](function(){if(!_0x564658){return[];}return rta['getAgentIdsByQueues'](_0x564658,_0x52900d);})[_0x1b65('0x15')](function(_0x2ea12d){_0x51af4a=_0x2ea12d;return rta[_0x1b65('0x1f')]();})[_0x1b65('0x15')](function(_0x334f99){_0x141a98=_0x334f99['rows'];if((!_0x3b5075||_0x28edd7)&&!_0x4efad7){return _0x51af4a;}if(_0x4efad7&&!_0x3b5075){return rta[_0x1b65('0x20')](_0x141a98,_0x51af4a,_0x4efad7);}else{return rta['getAgentIdsByStatus'](_0x141a98,_0x51af4a,_0x3b5075);}})['then'](function(_0xf000){_0x51af4a=_0xf000;var _0x282f49=![];if(_0x51af4a[_0x1b65('0x21')]===0x0){if(_0x564658||_0x3b5075){_0x282f49=!![];}if(_0x28edd7){_0x282f49=![];}}if(_0x282f49){return _0x2c101a;}var _0x56cb17=_[_0x1b65('0x22')](db['User'][_0x1b65('0x23')],function(_0x3fc669){return{'name':_0x3fc669[_0x1b65('0x24')],'type':_0x3fc669[_0x1b65('0x25')]['key']};});_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x26')]=_0x1b65('0x27');_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x28')]=!![];_0x29c0ea=qs[_0x1b65('0x29')](_0x56cb17,_0x4c2aba);_0x29c0ea[_0x1b65('0x2a')]=!![];var _0x4e58ef=[];if(_0x51af4a['length']>0x0){_0x4e58ef[_0x1b65('0x2b')]({'id':{'$in':_0x51af4a}});if(_0x4efad7&&!_0x3b5075){_0x4bf9b1=[db[_0x1b65('0x2c')][_0x1b65('0x2d')](_0x1b65('0x2e')+_0x51af4a+')')];_0x29c0ea[_0x1b65('0x2f')]=_0x4bf9b1;}}if(_0x28edd7){_0xccdb77[_0x1b65('0x30')](function(_0x23e614){var _0x16cb0c=!![];if(_0x3b5075==='*pause'&&_0x52900d!==_0x23e614){_0x16cb0c=![];}_0x4e58ef[_0x1b65('0x2b')]({[_0x23e614+'Pause']:_0x16cb0c});});if(_0x1cc2b7){_0x4e58ef['push']({'pauseType':_0x1cc2b7});}}else if(_0x3b5075){_0xccdb77['forEach'](function(_0x402d09){_0x4e58ef[_0x1b65('0x2b')]({[_0x402d09+'Pause']:![]});});}_0x29c0ea['where']=_[_0x1b65('0x31')](_0x29c0ea[_0x1b65('0x32')],{'$and':_0x4e58ef});if(_0x4c2aba[_0x1b65('0x33')][_0x1b65('0x26')]==='user'){var _0x298876={'params':{'id':_0x4c2aba[_0x1b65('0x33')][_0x1b65('0x34')]},'query':{'section':_0x1b65('0x35'),'role':_0x1b65('0x27'),'online':!![],'raw':!![],'ids':_0x51af4a,'customSorting':_0x4bf9b1}};if(_0x28edd7){_0x298876[_0x1b65('0xf')]['extraQueryConditions']=_0x4e58ef;}_0x298876[_0x1b65('0xf')]=Object[_0x1b65('0x36')](_0x298876['query'],_0x4c2aba[_0x1b65('0xf')]);delete _0x298876[_0x1b65('0xf')]['id'];return db[_0x1b65('0x37')][_0x1b65('0x38')](_0x298876);}return db[_0x1b65('0x39')][_0x1b65('0x3a')](_0x29c0ea);})['then'](function(_0x5d02ba){_0x2c101a[_0x1b65('0xb')]=_0x5d02ba[_0x1b65('0xb')];_0x3a7d70=_0x5d02ba[_0x1b65('0x3b')];return _0x3a7d70['map'](function(_0xe9fca8){var _0x18d45e=_[_0x1b65('0x3c')](_0x141a98,['id',_0xe9fca8['id']]);if(_0x18d45e){var _0x3bcf9c=rta[_0x1b65('0x3d')](_0x18d45e);_[_0x1b65('0x31')](_0xe9fca8,_0x3bcf9c);}_0xe9fca8['globalStatus']=rta[_0x1b65('0x3e')](_0xe9fca8);if(_0xe9fca8[_0x1b65('0x3f')][_0x1b65('0x40')](_0x1b65('0x12'))){_0xccdb77[_0x1b65('0x30')](function(_0x10aa89){if(_0xe9fca8[_0x10aa89+_0x1b65('0x41')]){if(_0x10aa89===_0x1b65('0x42')){if(_0xe9fca8[_0x1b65('0x43')]!=='talking'){_0xe9fca8[_0x1b65('0x43')]=_0x1b65('0x12');}}else{_0xe9fca8[_0x10aa89+'Status']=_0x1b65('0x12');}}});}return _0xe9fca8;});})[_0x1b65('0x15')](function(_0x36f522){if(!_0x4efad7||_0x4bf9b1){return _0x36f522;}return rta[_0x1b65('0x44')](_0x36f522,_0x4efad7);})[_0x1b65('0x15')](function(_0x29e484){var _0x53aa3d=null;if(_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1d')]){var _0x51de35=_0x4c2aba[_0x1b65('0xf')]['fields'][_0x1b65('0x45')](',');_0x53aa3d=_0x29e484[_0x1b65('0x22')](function(_0x219f85){return _[_0x1b65('0x46')](_0x219f85,_0x51de35);});}_0x2c101a[_0x1b65('0x3b')]=_0x53aa3d||_0x29e484;return _0x2c101a;})[_0x1b65('0x15')](respondWithFilteredResult(_0x225e43,_0x29c0ea))[_0x1b65('0x47')](APIHandleError(_0x225e43));};exports['getQueues']=function(_0xc94861,_0x5326ad){var _0x2b2ae7={'count':0x0,'rows':[]};var _0x10f5fb={};var _0x281a58;var _0x524fe8;var _0x1fb2c8;Promise[_0x1b65('0x14')]()[_0x1b65('0x15')](function(){if(_0xc94861[_0x1b65('0xf')][_0x1b65('0x18')]){if(!utils['isValidChannel'](_0xc94861['query']['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0xc94861[_0x1b65('0xf')]['channel']));}_0x281a58=_0xc94861['query'][_0x1b65('0x18')][_0x1b65('0x19')]();}var _0x42e208=_['startCase'](_0x281a58)+'Queue';var _0x383294=_['map'](db[_0x42e208][_0x1b65('0x23')],function(_0x3111e4){return{'name':_0x3111e4[_0x1b65('0x24')],'type':_0x3111e4['type'][_0x1b65('0x48')]};});if(!_0xc94861[_0x1b65('0xf')][_0x1b65('0x1d')]){var _0x2f4947=['id',_0x1b65('0x49')];if(_0x281a58==='voice'){_0x2f4947[_0x1b65('0x2b')](_0x1b65('0x25'));if(_0xc94861[_0x1b65('0xf')][_0x1b65('0x25')]===_0x1b65('0x4a')){_0x2f4947['push'](['dialActive',_0x1b65('0x4b')]);}}_0xc94861[_0x1b65('0xf')][_0x1b65('0x1d')]=_0x2f4947[_0x1b65('0x1e')](',');}_0x10f5fb=qs['getOptions'](_0x383294,_0xc94861);if(_0xc94861[_0x1b65('0x33')][_0x1b65('0x26')]===_0x1b65('0x33')){var _0x5d144b={'params':{'id':_0xc94861[_0x1b65('0x33')][_0x1b65('0x34')]},'query':{'section':_0x281a58===_0x1b65('0x42')&&_0xc94861['query'][_0x1b65('0x25')]===_0x1b65('0x4a')?_0x1b65('0x4c'):_[_0x1b65('0x4d')](_0x281a58)+'Queues','type':_0xc94861[_0x1b65('0xf')]['type'],'nolimit':!![],'sort':_0x1b65('0x49'),'filter':_0xc94861['query']['filter']}};_0x5d144b[_0x1b65('0xf')]=Object[_0x1b65('0x36')](_0x5d144b[_0x1b65('0xf')],_0xc94861[_0x1b65('0xf')]);delete _0x5d144b[_0x1b65('0xf')]['id'];return db['UserProfile'][_0x1b65('0x38')](_0x5d144b);}return db[_0x42e208]['findAndCountAll'](_0x10f5fb);})[_0x1b65('0x15')](function(_0x2ca799){_0x2b2ae7[_0x1b65('0xb')]=_0x2ca799[_0x1b65('0xb')];_0x524fe8=_0x2ca799['rows'];return rtq[_0x1b65('0x4e')](_0xc94861,_0x281a58);})[_0x1b65('0x15')](function(_0x5346d4){_0x1fb2c8=_0x5346d4[_0x1b65('0x3b')];return rtq[_0x1b65('0x4f')](_0x524fe8,_0x1fb2c8,_0x281a58,_0xc94861[_0x1b65('0xf')]['type']);})[_0x1b65('0x15')](function(_0x322a1b){_0x2b2ae7['rows']=_0x322a1b;return _0x2b2ae7;})['then'](respondWithFilteredResult(_0x5326ad,_0x10f5fb))[_0x1b65('0x47')](APIHandleError(_0x5326ad));}; \ No newline at end of file +var _0x56e7=['length','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','Agents','agent','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','merge','globalStatus','Status','split','pick','getQueues','startCase','fieldName','key','name','outbound','dialActive','dialMethod','userProfileId','voice','QueueCampaigns','Queues','filter','getRealtimeQueues','catch','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','count','set','Content-Range','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','fields','join','order','getAgentIdsByQueues','then','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','type','role','online','getOptions','raw'];(function(_0x38e656,_0x21bcb0){var _0x411375=function(_0x1582c3){while(--_0x1582c3){_0x38e656['push'](_0x38e656['shift']());}};_0x411375(++_0x21bcb0);}(_0x56e7,0x7b));var _0x756e=function(_0x21335d,_0x3db864){_0x21335d=_0x21335d-0x0;var _0x4bd640=_0x56e7[_0x21335d];return _0x4bd640;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var rta=require(_0x756e('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x756e('0x2'));var utils=require(_0x756e('0x3'));var db=require(_0x756e('0x4'))['db'];var APIBadRequestError=require(_0x756e('0x5'))[_0x756e('0x6')];var APIHandleError=require(_0x756e('0x5'))[_0x756e('0x7')];function respondWithFilteredResult(_0x538050,_0x3b3b8f){return function(_0x404189){if(_0x404189){var _0x26519d=typeof _0x3b3b8f[_0x756e('0x8')]==='undefined'&&typeof _0x3b3b8f[_0x756e('0x9')]==='undefined';var _0x4460c7=_0x404189[_0x756e('0xa')];var _0x313d92=_0x26519d?0x0:_0x3b3b8f[_0x756e('0x8')];var _0x4adf8f=_0x26519d?_0x404189['count']:_0x3b3b8f[_0x756e('0x8')]+_0x3b3b8f[_0x756e('0x9')];var _0x13bea7;if(_0x4adf8f>=_0x4460c7){_0x4adf8f=_0x4460c7;_0x13bea7=0xc8;}else{_0x13bea7=0xce;}_0x538050['status'](_0x13bea7);return _0x538050[_0x756e('0xb')](_0x756e('0xc'),_0x313d92+'-'+_0x4adf8f+'/'+_0x4460c7)['json'](_0x404189);}return null;};}exports['getAgents']=function(_0x1b68ef,_0x569e8f){var _0x459237={'count':0x0,'rows':[]};var _0x21701a={};var _0x38d5e9;var _0x136052=utils[_0x756e('0xd')]();var _0x4ae32a;var _0x4b3660;var _0x36de2a=_0x1b68ef[_0x756e('0xe')][_0x756e('0xf')];var _0x59956f=_0x1b68ef['query'][_0x756e('0x10')];var _0x33dd9c=_0x1b68ef[_0x756e('0xe')][_0x756e('0x11')];var _0x42114e=_0x59956f===_0x756e('0x12')||_0x59956f===_0x756e('0x13')?!![]:![];var _0x1a8614=[];var _0xb17214;var _0x4da91f;Promise[_0x756e('0x14')]()['then'](function(){if(_0x1b68ef['query'][_0x756e('0x15')]){if(!utils[_0x756e('0x16')](_0x1b68ef[_0x756e('0xe')][_0x756e('0x15')])){throw new APIBadRequestError(util[_0x756e('0x17')](_0x756e('0x18'),_0x1b68ef[_0x756e('0xe')][_0x756e('0x15')]));}_0x38d5e9=_0x1b68ef[_0x756e('0xe')][_0x756e('0x15')][_0x756e('0x19')]();}if(!_0x1b68ef[_0x756e('0xe')][_0x756e('0x1a')]||!_0x1b68ef[_0x756e('0xe')][_0x756e('0x1a')][_0x756e('0x1b')]('globalStatus')){_0x1b68ef[_0x756e('0xe')]['sort']=rta[_0x756e('0x1c')](_0x1b68ef[_0x756e('0xe')][_0x756e('0x1a')]);return;}var _0x2722eb=rta['getUpdatedSortOptions'](_0x1b68ef[_0x756e('0xe')][_0x756e('0x1a')]);_0x1b68ef[_0x756e('0xe')]['sort']=_0x2722eb[_0x756e('0x1d')][_0x756e('0x1e')](',');_0xb17214=_0x2722eb[_0x756e('0x1f')];})['then'](function(){if(!_0x36de2a){return[];}return rta[_0x756e('0x20')](_0x36de2a,_0x38d5e9);})[_0x756e('0x21')](function(_0x5b4bf0){_0x1a8614=_0x5b4bf0;return rta[_0x756e('0x22')]();})[_0x756e('0x21')](function(_0x345162){_0x4b3660=_0x345162['rows'];if((!_0x59956f||_0x42114e)&&!_0xb17214){return _0x1a8614;}if(_0xb17214&&!_0x59956f){return rta[_0x756e('0x23')](_0x4b3660,_0x1a8614,_0xb17214);}else{return rta[_0x756e('0x24')](_0x4b3660,_0x1a8614,_0x59956f);}})['then'](function(_0x20543c){_0x1a8614=_0x20543c;var _0x2a7fdb=![];if(_0x1a8614['length']===0x0){if(_0x36de2a||_0x59956f){_0x2a7fdb=!![];}if(_0x42114e){_0x2a7fdb=![];}}if(_0x2a7fdb){return _0x459237;}var _0x23daea=_[_0x756e('0x25')](db[_0x756e('0x26')][_0x756e('0x27')],function(_0x3fb38d){return{'name':_0x3fb38d['fieldName'],'type':_0x3fb38d[_0x756e('0x28')]['key']};});_0x1b68ef['query'][_0x756e('0x29')]='agent';_0x1b68ef[_0x756e('0xe')][_0x756e('0x2a')]=!![];_0x21701a=qs[_0x756e('0x2b')](_0x23daea,_0x1b68ef);_0x21701a[_0x756e('0x2c')]=!![];var _0x4529aa=[];if(_0x1a8614[_0x756e('0x2d')]>0x0){_0x4529aa[_0x756e('0x2e')]({'id':{'$in':_0x1a8614}});if(_0xb17214&&!_0x59956f){_0x4da91f=[db[_0x756e('0x2f')][_0x756e('0x30')](_0x756e('0x31')+_0x1a8614+')')];_0x21701a[_0x756e('0x1f')]=_0x4da91f;}}if(_0x42114e){_0x136052[_0x756e('0x32')](function(_0x5355a7){var _0x523f09=!![];if(_0x59956f===_0x756e('0x13')&&_0x38d5e9!==_0x5355a7){_0x523f09=![];}_0x4529aa[_0x756e('0x2e')]({[_0x5355a7+_0x756e('0x33')]:_0x523f09});});if(_0x33dd9c){_0x4529aa[_0x756e('0x2e')]({'pauseType':_0x33dd9c});}}else if(_0x59956f){_0x136052[_0x756e('0x32')](function(_0x31a507){_0x4529aa[_0x756e('0x2e')]({[_0x31a507+'Pause']:![]});});}_0x21701a['where']=_['merge'](_0x21701a[_0x756e('0x34')],{'$and':_0x4529aa});if(_0x1b68ef[_0x756e('0x35')][_0x756e('0x29')]==='user'){var _0x32958b={'params':{'id':_0x1b68ef[_0x756e('0x35')]['userProfileId']},'query':{'section':_0x756e('0x36'),'role':_0x756e('0x37'),'online':!![],'raw':!![],'ids':_0x1a8614,'customSorting':_0x4da91f}};if(_0x42114e){_0x32958b[_0x756e('0xe')][_0x756e('0x38')]=_0x4529aa;}_0x32958b[_0x756e('0xe')]=Object[_0x756e('0x39')](_0x32958b[_0x756e('0xe')],_0x1b68ef[_0x756e('0xe')]);delete _0x32958b['query']['id'];return db[_0x756e('0x3a')][_0x756e('0x3b')](_0x32958b);}return db[_0x756e('0x26')][_0x756e('0x3c')](_0x21701a);})[_0x756e('0x21')](function(_0x3a66fe){_0x459237[_0x756e('0xa')]=_0x3a66fe[_0x756e('0xa')];_0x4ae32a=_0x3a66fe[_0x756e('0x3d')];return _0x4ae32a[_0x756e('0x25')](function(_0x5bb3bd){var _0x41a100=_[_0x756e('0x3e')](_0x4b3660,['id',_0x5bb3bd['id']]);if(_0x41a100){var _0x507804=rta[_0x756e('0x3f')](_0x41a100);_[_0x756e('0x40')](_0x5bb3bd,_0x507804);}_0x5bb3bd[_0x756e('0x41')]=rta['getAgentStatus'](_0x5bb3bd);if(_0x5bb3bd[_0x756e('0x41')][_0x756e('0x1b')](_0x756e('0x12'))){_0x136052['forEach'](function(_0x5a8dfb){if(_0x5bb3bd[_0x5a8dfb+_0x756e('0x33')]){_0x5bb3bd[_0x5a8dfb+_0x756e('0x42')]=_0x756e('0x12');}});}return _0x5bb3bd;});})[_0x756e('0x21')](function(_0x252757){if(!_0xb17214||_0x4da91f){return _0x252757;}return rta['sortAgentsByStatus'](_0x252757,_0xb17214);})[_0x756e('0x21')](function(_0x2b593d){var _0x5c471e=null;if(_0x1b68ef[_0x756e('0xe')][_0x756e('0x1d')]){var _0x29f6c2=_0x1b68ef[_0x756e('0xe')][_0x756e('0x1d')][_0x756e('0x43')](',');_0x5c471e=_0x2b593d[_0x756e('0x25')](function(_0x260096){return _[_0x756e('0x44')](_0x260096,_0x29f6c2);});}_0x459237['rows']=_0x5c471e||_0x2b593d;return _0x459237;})[_0x756e('0x21')](respondWithFilteredResult(_0x569e8f,_0x21701a))['catch'](APIHandleError(_0x569e8f));};exports[_0x756e('0x45')]=function(_0x366788,_0x46b5b0){var _0x54248c={'count':0x0,'rows':[]};var _0x3fc697={};var _0x184823;var _0xf68a24;var _0x527a62;Promise['resolve']()[_0x756e('0x21')](function(){if(_0x366788[_0x756e('0xe')]['channel']){if(!utils['isValidChannel'](_0x366788[_0x756e('0xe')][_0x756e('0x15')])){throw new APIBadRequestError(util[_0x756e('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x366788[_0x756e('0xe')]['channel']));}_0x184823=_0x366788[_0x756e('0xe')][_0x756e('0x15')][_0x756e('0x19')]();}var _0x4e415a=_[_0x756e('0x46')](_0x184823)+'Queue';var _0x5064a3=_[_0x756e('0x25')](db[_0x4e415a]['rawAttributes'],function(_0x46b370){return{'name':_0x46b370[_0x756e('0x47')],'type':_0x46b370[_0x756e('0x28')][_0x756e('0x48')]};});if(!_0x366788[_0x756e('0xe')][_0x756e('0x1d')]){var _0x50b86e=['id',_0x756e('0x49')];if(_0x184823==='voice'){_0x50b86e[_0x756e('0x2e')]('type');if(_0x366788[_0x756e('0xe')]['type']===_0x756e('0x4a')){_0x50b86e['push']([_0x756e('0x4b'),_0x756e('0x4c')]);}}_0x366788[_0x756e('0xe')]['fields']=_0x50b86e[_0x756e('0x1e')](',');}_0x3fc697=qs[_0x756e('0x2b')](_0x5064a3,_0x366788);if(_0x366788['user']['role']===_0x756e('0x35')){var _0x22b756={'params':{'id':_0x366788[_0x756e('0x35')][_0x756e('0x4d')]},'query':{'section':_0x184823===_0x756e('0x4e')&&_0x366788[_0x756e('0xe')][_0x756e('0x28')]===_0x756e('0x4a')?_0x756e('0x4f'):_['startCase'](_0x184823)+_0x756e('0x50'),'type':_0x366788[_0x756e('0xe')][_0x756e('0x28')],'nolimit':!![],'sort':_0x756e('0x49'),'filter':_0x366788[_0x756e('0xe')][_0x756e('0x51')]}};_0x22b756[_0x756e('0xe')]=Object[_0x756e('0x39')](_0x22b756['query'],_0x366788[_0x756e('0xe')]);delete _0x22b756[_0x756e('0xe')]['id'];return db['UserProfile'][_0x756e('0x3b')](_0x22b756);}return db[_0x4e415a]['findAndCountAll'](_0x3fc697);})[_0x756e('0x21')](function(_0xa5d6a3){_0x54248c[_0x756e('0xa')]=_0xa5d6a3['count'];_0xf68a24=_0xa5d6a3[_0x756e('0x3d')];return rtq[_0x756e('0x52')](_0x366788,_0x184823);})[_0x756e('0x21')](function(_0x571794){_0x527a62=_0x571794[_0x756e('0x3d')];return rtq['initializeQueues'](_0xf68a24,_0x527a62,_0x184823,_0x366788[_0x756e('0xe')][_0x756e('0x28')]);})[_0x756e('0x21')](function(_0x1e3d0b){_0x54248c[_0x756e('0x3d')]=_0x1e3d0b;return _0x54248c;})[_0x756e('0x21')](respondWithFilteredResult(_0x46b5b0,_0x3fc697))[_0x756e('0x53')](APIHandleError(_0x46b5b0));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 451b51c..68e36c2 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x16d3fe,_0xd75c0c){var _0x70c182=function(_0x5e6d18){while(--_0x5e6d18){_0x16d3fe['push'](_0x16d3fe['shift']());}};_0x70c182(++_0xd75c0c);}(_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 +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x25d8cb,_0x1ff827){var _0x3d60c4=function(_0x3d11ca){while(--_0x3d11ca){_0x25d8cb['push'](_0x25d8cb['shift']());}};_0x3d60c4(++_0x1ff827);}(_0xedd9,0xfc));var _0x9edd=function(_0x1ed711,_0x1043c2){_0x1ed711=_0x1ed711-0x0;var _0x27b8c4=_0xedd9[_0x1ed711];return _0x27b8c4;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 703213f..c1de093 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 _0x0024=['exports','STRING','INTEGER'];(function(_0x2b776d,_0x20b72a){var _0x170f1c=function(_0x39d08b){while(--_0x39d08b){_0x2b776d['push'](_0x2b776d['shift']());}};_0x170f1c(++_0x20b72a);}(_0x0024,0xa8));var _0x4002=function(_0xd09fa2,_0x152402){_0xd09fa2=_0xd09fa2-0x0;var _0xb1178c=_0x0024[_0xd09fa2];return _0xb1178c;};'use strict';var Sequelize=require('sequelize');module[_0x4002('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4002('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x4002('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4002('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4002('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c1a=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x5afdde,_0x33b9bc){var _0x52f0bc=function(_0x38625e){while(--_0x38625e){_0x5afdde['push'](_0x5afdde['shift']());}};_0x52f0bc(++_0x33b9bc);}(_0x7c1a,0x159));var _0xa7c1=function(_0x328729,_0x294a11){_0x328729=_0x328729-0x0;var _0x58f83a=_0x7c1a[_0x328729];return _0x58f83a;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'state':{'type':Sequelize[_0xa7c1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa7c1('0x3')]},'scheduledat':{'type':Sequelize[_0xa7c1('0x4')]},'uniqueid':{'type':Sequelize[_0xa7c1('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa7c1('0x4')]},'ringtime':{'type':Sequelize[_0xa7c1('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa7c1('0x3')]},'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 eefd500..a4c19ad 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 _0x6f0b=['api','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','../../config/logger'];(function(_0x36acb3,_0x204e94){var _0x13976c=function(_0x4371dd){while(--_0x4371dd){_0x36acb3['push'](_0x36acb3['shift']());}};_0x13976c(++_0x204e94);}(_0x6f0b,0x6d));var _0xb6f0=function(_0x5f0377,_0x310371){_0x5f0377=_0x5f0377-0x0;var _0x16c6cb=_0x6f0b[_0x5f0377];return _0x16c6cb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb6f0('0x0'))(_0xb6f0('0x1'));var moment=require('moment');var BPromise=require(_0xb6f0('0x2'));var rp=require(_0xb6f0('0x3'));var fs=require('fs');var path=require(_0xb6f0('0x4'));var rimraf=require(_0xb6f0('0x5'));var config=require(_0xb6f0('0x6'));var attributes=require(_0xb6f0('0x7'));module[_0xb6f0('0x8')]=function(_0x3e1720,_0x18952f){return _0x3e1720['define'](_0xb6f0('0x9'),attributes,{'tableName':_0xb6f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3829=['exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x16287e,_0x4f25ab){var _0x334123=function(_0x1f6141){while(--_0x1f6141){_0x16287e['push'](_0x16287e['shift']());}};_0x334123(++_0x4f25ab);}(_0x3829,0xee));var _0x9382=function(_0x2d2db1,_0x265569){_0x2d2db1=_0x2d2db1-0x0;var _0x56977c=_0x3829[_0x2d2db1];return _0x56977c;};'use strict';var _=require(_0x9382('0x0'));var util=require(_0x9382('0x1'));var logger=require(_0x9382('0x2'))(_0x9382('0x3'));var moment=require(_0x9382('0x4'));var BPromise=require(_0x9382('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9382('0x6'));var config=require(_0x9382('0x7'));var attributes=require(_0x9382('0x8'));module[_0x9382('0x9')]=function(_0x58f5a8,_0x29ec70){return _0x58f5a8[_0x9382('0xa')](_0x9382('0xb'),attributes,{'tableName':_0x9382('0xc'),'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 8a0a7a3..c768d40 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 _0x3e6e=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x531fb6,_0x197966){var _0x4387de=function(_0x52cda8){while(--_0x52cda8){_0x531fb6['push'](_0x531fb6['shift']());}};_0x4387de(++_0x197966);}(_0x3e6e,0x1dd));var _0xe3e6=function(_0x128057,_0xb42eb5){_0x128057=_0x128057-0x0;var _0x1a64d4=_0x3e6e[_0x128057];return _0x1a64d4;};'use strict';var _=require(_0xe3e6('0x0'));var util=require('util');var moment=require(_0xe3e6('0x1'));var BPromise=require(_0xe3e6('0x2'));var rs=require(_0xe3e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe3e6('0x4'));var logger=require(_0xe3e6('0x5'))('rpc');var config=require(_0xe3e6('0x6'));var jayson=require(_0xe3e6('0x7'));var client=jayson[_0xe3e6('0x8')][_0xe3e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x291a1a,_0x28bb31,_0xff633f){return new BPromise(function(_0x7953b2,_0x2bef6a){return client[_0xe3e6('0xa')](_0x291a1a,_0xff633f)[_0xe3e6('0xb')](function(_0x36b35e){logger[_0xe3e6('0xc')](_0xe3e6('0xd'),_0x28bb31,_0xe3e6('0xe'));logger[_0xe3e6('0xf')](_0xe3e6('0x10'),_0x28bb31,_0xe3e6('0xe'),JSON[_0xe3e6('0x11')](_0x36b35e));if(_0x36b35e[_0xe3e6('0x12')]){if(_0x36b35e[_0xe3e6('0x12')][_0xe3e6('0x13')]===0x1f4){logger[_0xe3e6('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x28bb31,_0x36b35e[_0xe3e6('0x12')][_0xe3e6('0x14')]);return _0x2bef6a(_0x36b35e['error']['message']);}logger['error'](_0xe3e6('0xd'),_0x28bb31,_0x36b35e['error'][_0xe3e6('0x14')]);return _0x7953b2(_0x36b35e[_0xe3e6('0x12')]['message']);}else{logger[_0xe3e6('0xc')](_0xe3e6('0xd'),_0x28bb31,_0xe3e6('0xe'));_0x7953b2(_0x36b35e[_0xe3e6('0x15')][_0xe3e6('0x14')]);}})['catch'](function(_0x44e11a){logger[_0xe3e6('0x12')](_0xe3e6('0xd'),_0x28bb31,_0x44e11a);_0x2bef6a(_0x44e11a);});});}exports[_0xe3e6('0x16')]=function(_0x2f5de0){var _0x4f0bd4=this;return new Promise(function(_0x12cfc4,_0x78a1fb){return db[_0xe3e6('0x17')][_0xe3e6('0x18')](_0x2f5de0[_0xe3e6('0x19')],{'raw':_0x2f5de0[_0xe3e6('0x1a')]?_0x2f5de0[_0xe3e6('0x1a')][_0xe3e6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x489eba){logger[_0xe3e6('0xc')](_0xe3e6('0x16'),_0x2f5de0);logger[_0xe3e6('0xf')](_0xe3e6('0x16'),_0x2f5de0,JSON['stringify'](_0x489eba));_0x12cfc4(_0x489eba);})[_0xe3e6('0x1c')](function(_0x1bc36e){logger[_0xe3e6('0x12')](_0xe3e6('0x16'),_0x1bc36e[_0xe3e6('0x14')],_0x2f5de0);_0x78a1fb(_0x4f0bd4[_0xe3e6('0x12')](0x1f4,_0x1bc36e['message']));});});}; \ No newline at end of file +var _0xf8d7=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0xf8d7,0x86));var _0x7f8d=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xf8d7[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0x7f8d('0x0'));var moment=require(_0x7f8d('0x1'));var BPromise=require(_0x7f8d('0x2'));var rs=require(_0x7f8d('0x3'));var fs=require('fs');var Redis=require(_0x7f8d('0x4'));var db=require(_0x7f8d('0x5'))['db'];var utils=require(_0x7f8d('0x6'));var logger=require(_0x7f8d('0x7'))(_0x7f8d('0x8'));var config=require('../../config/environment');var jayson=require(_0x7f8d('0x9'));var client=jayson[_0x7f8d('0xa')][_0x7f8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44b72e,_0x179e77,_0x5b4f4c){return new BPromise(function(_0x22adcb,_0x2e171a){return client['request'](_0x44b72e,_0x5b4f4c)[_0x7f8d('0xc')](function(_0xbc8a70){logger[_0x7f8d('0xd')](_0x7f8d('0xe'),_0x179e77,'request\x20sent');logger[_0x7f8d('0xf')](_0x7f8d('0x10'),_0x179e77,_0x7f8d('0x11'),JSON[_0x7f8d('0x12')](_0xbc8a70));if(_0xbc8a70[_0x7f8d('0x13')]){if(_0xbc8a70[_0x7f8d('0x13')][_0x7f8d('0x14')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x179e77,_0xbc8a70[_0x7f8d('0x13')][_0x7f8d('0x15')]);return _0x2e171a(_0xbc8a70['error'][_0x7f8d('0x15')]);}logger[_0x7f8d('0x13')](_0x7f8d('0xe'),_0x179e77,_0xbc8a70['error'][_0x7f8d('0x15')]);return _0x22adcb(_0xbc8a70[_0x7f8d('0x13')][_0x7f8d('0x15')]);}else{logger['info'](_0x7f8d('0xe'),_0x179e77,'request\x20sent');_0x22adcb(_0xbc8a70[_0x7f8d('0x16')]['message']);}})[_0x7f8d('0x17')](function(_0x5aeac9){logger[_0x7f8d('0x13')](_0x7f8d('0xe'),_0x179e77,_0x5aeac9);_0x2e171a(_0x5aeac9);});});}exports[_0x7f8d('0x18')]=function(_0x1e484a){var _0x2abaf1=this;return new Promise(function(_0x383231,_0x5c4cf9){return db[_0x7f8d('0x19')][_0x7f8d('0x1a')](_0x1e484a['body'],{'raw':_0x1e484a[_0x7f8d('0x1b')]?_0x1e484a[_0x7f8d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x7f8d('0xc')](function(_0x153921){logger[_0x7f8d('0xd')]('CreateReportAgentPreview',_0x1e484a);logger[_0x7f8d('0xf')]('CreateReportAgentPreview',_0x1e484a,JSON['stringify'](_0x153921));_0x383231(_0x153921);})[_0x7f8d('0x17')](function(_0x44eb3d){logger[_0x7f8d('0x13')]('CreateReportAgentPreview',_0x44eb3d['message'],_0x1e484a);_0x5c4cf9(_0x2abaf1[_0x7f8d('0x13')](0x1f4,_0x44eb3d['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0525c3f..d5e6ffe 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 _0x4893=['/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','outbound','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4893,0x118));var _0x3489=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x4893[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x3489('0x0'));var util=require(_0x3489('0x1'));var path=require('path');var express=require(_0x3489('0x2'));var router=express['Router']();var auth=require(_0x3489('0x3'));var controller=require(_0x3489('0x4'));router[_0x3489('0x5')]('/voice/channels',auth[_0x3489('0x6')](),controller[_0x3489('0x7')]);router[_0x3489('0x5')](_0x3489('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x3489('0x5')](_0x3489('0x9'),auth[_0x3489('0x6')](),controller[_0x3489('0xa')]);router[_0x3489('0x5')](_0x3489('0xb'),auth[_0x3489('0x6')](),controller[_0x3489('0xc')]);router[_0x3489('0x5')]('/chat/queues',auth[_0x3489('0x6')](),controller['chatQueues']);router[_0x3489('0x5')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x3489('0x5')](_0x3489('0xd'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x3489('0x5')](_0x3489('0xe'),auth[_0x3489('0x6')](),controller[_0x3489('0xf')]);router[_0x3489('0x5')](_0x3489('0x10'),auth[_0x3489('0x6')](),controller['smsQueues']);router[_0x3489('0x5')]('/whatsapp/queues',auth[_0x3489('0x6')](),controller[_0x3489('0x11')]);router['get'](_0x3489('0x12'),auth[_0x3489('0x6')](),controller[_0x3489('0x13')]);router['get']('/voice/queues/preview/:id',auth[_0x3489('0x6')](),controller['voiceQueuesPreview']);router[_0x3489('0x5')](_0x3489('0x14'),auth[_0x3489('0x6')](),controller[_0x3489('0x15')]);router[_0x3489('0x5')](_0x3489('0x16'),auth[_0x3489('0x6')](),controller[_0x3489('0x17')]);router[_0x3489('0x5')](_0x3489('0x18'),auth[_0x3489('0x6')](),controller[_0x3489('0x19')]);router[_0x3489('0x5')](_0x3489('0x1a'),auth[_0x3489('0x6')](),controller[_0x3489('0x1b')]);router[_0x3489('0x5')]('/voice/queues/:id',auth[_0x3489('0x6')](),controller[_0x3489('0x1c')]);router[_0x3489('0x1d')](_0x3489('0x1e'),auth['isAuthenticated'](),controller[_0x3489('0x1f')]);router[_0x3489('0x5')]('/outbound',auth['isAuthenticated'](),controller[_0x3489('0x20')]);router[_0x3489('0x5')]('/outbound/channels',auth[_0x3489('0x6')](),controller['outboundChannels']);router[_0x3489('0x5')](_0x3489('0x21'),auth[_0x3489('0x6')](),controller[_0x3489('0x22')]);router[_0x3489('0x1d')](_0x3489('0x23'),auth[_0x3489('0x6')](),controller[_0x3489('0x24')]);router[_0x3489('0x5')](_0x3489('0x25'),auth[_0x3489('0x6')](),controller[_0x3489('0x26')]);router[_0x3489('0x5')]('/trunks',auth['isAuthenticated'](),controller[_0x3489('0x27')]);router[_0x3489('0x5')]('/campaigns',auth[_0x3489('0x6')](),controller[_0x3489('0x28')]);router[_0x3489('0x5')](_0x3489('0x29'),auth[_0x3489('0x6')](),controller[_0x3489('0x2a')]);router[_0x3489('0x5')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3489('0x2b')]);router[_0x3489('0x5')](_0x3489('0x2c'),auth[_0x3489('0x6')](),controller[_0x3489('0x2d')]);router['get'](_0x3489('0x2e'),auth[_0x3489('0x6')](),controller[_0x3489('0x2f')]);router[_0x3489('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0x3489('0x6')](),controller[_0x3489('0x30')]);router['get'](_0x3489('0x31'),auth[_0x3489('0x6')](),controller[_0x3489('0x32')]);router['get'](_0x3489('0x33'),auth[_0x3489('0x6')](),controller[_0x3489('0x34')]);router[_0x3489('0x5')](_0x3489('0x35'),auth[_0x3489('0x6')](),controller[_0x3489('0x36')]);router[_0x3489('0x37')](_0x3489('0x38'),auth[_0x3489('0x6')](),controller[_0x3489('0x39')]('mail'));router[_0x3489('0x5')](_0x3489('0x3a'),auth[_0x3489('0x6')](),controller['showMailQueues']);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x3489('0x3b')));router['get']('/chat/queues/:id',auth[_0x3489('0x6')](),controller[_0x3489('0x3c')]);router[_0x3489('0x37')](_0x3489('0x3d'),auth[_0x3489('0x6')](),controller['queueNotify'](_0x3489('0x3e')));router[_0x3489('0x5')](_0x3489('0x3f'),auth[_0x3489('0x6')](),controller[_0x3489('0x40')]);router['post']('/openchannel/queues/:id/notify',auth[_0x3489('0x6')](),controller[_0x3489('0x39')]('openchannel'));router['get'](_0x3489('0x41'),auth[_0x3489('0x6')](),controller[_0x3489('0x42')]);router[_0x3489('0x37')](_0x3489('0x43'),auth[_0x3489('0x6')](),controller[_0x3489('0x39')](_0x3489('0x44')));router[_0x3489('0x37')](_0x3489('0x45'),auth['isAuthenticated'](),controller['queueNotify']('whatsapp'));router[_0x3489('0x5')](_0x3489('0x46'),auth[_0x3489('0x6')](),controller['showSmsQueues']);router[_0x3489('0x5')](_0x3489('0x47'),auth[_0x3489('0x6')](),controller[_0x3489('0x48')]);router[_0x3489('0x37')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x3489('0x49')]);module[_0x3489('0x4a')]=router; \ No newline at end of file +var _0xa9c1=['openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','path','express','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','/outbound','outbound','/outbound/channels','/agents','put','/agents/:id/capacity','agentCapacity','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify'];(function(_0x5de5fa,_0x136377){var _0x123d06=function(_0x290eeb){while(--_0x290eeb){_0x5de5fa['push'](_0x5de5fa['shift']());}};_0x123d06(++_0x136377);}(_0xa9c1,0x1e0));var _0x1a9c=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9c1[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x1a9c('0x0'));var util=require(_0x1a9c('0x1'));var path=require(_0x1a9c('0x2'));var express=require(_0x1a9c('0x3'));var router=express['Router']();var auth=require(_0x1a9c('0x4'));var controller=require('./rpc.controller');router[_0x1a9c('0x5')](_0x1a9c('0x6'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x8')]);router[_0x1a9c('0x5')](_0x1a9c('0x9'),auth[_0x1a9c('0x7')](),controller['voiceChannelMixMonitor']);router[_0x1a9c('0x5')](_0x1a9c('0xa'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0xb')]);router[_0x1a9c('0x5')](_0x1a9c('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x1a9c('0x5')]('/chat/queues',auth[_0x1a9c('0x7')](),controller[_0x1a9c('0xd')]);router[_0x1a9c('0x5')](_0x1a9c('0xe'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0xf')]);router[_0x1a9c('0x5')](_0x1a9c('0x10'),auth[_0x1a9c('0x7')](),controller['mailAccounts']);router[_0x1a9c('0x5')](_0x1a9c('0x11'),auth['isAuthenticated'](),controller['openchannelQueues']);router['get']('/sms/queues',auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x12')]);router[_0x1a9c('0x5')](_0x1a9c('0x13'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x14')]);router['get'](_0x1a9c('0x15'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x1a9c('0x5')](_0x1a9c('0x16'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x17')]);router[_0x1a9c('0x5')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x1a9c('0x18')]);router[_0x1a9c('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x1a9c('0x19')]);router[_0x1a9c('0x5')](_0x1a9c('0x1a'),auth[_0x1a9c('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x1a9c('0x5')](_0x1a9c('0x1b'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x1c')]);router[_0x1a9c('0x5')]('/voice/queues/:id',auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x1d')]);router['put'](_0x1a9c('0x1e'),auth[_0x1a9c('0x7')](),controller['updateVoiceQueue']);router[_0x1a9c('0x5')](_0x1a9c('0x1f'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x20')]);router['get'](_0x1a9c('0x21'),auth[_0x1a9c('0x7')](),controller['outboundChannels']);router[_0x1a9c('0x5')](_0x1a9c('0x22'),auth['isAuthenticated'](),controller['agents']);router[_0x1a9c('0x23')](_0x1a9c('0x24'),auth['isAuthenticated'](),controller[_0x1a9c('0x25')]);router['get']('/telephones',auth['isAuthenticated'](),controller['telephones']);router[_0x1a9c('0x5')](_0x1a9c('0x26'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x27')]);router[_0x1a9c('0x5')](_0x1a9c('0x28'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x29')]);router['get'](_0x1a9c('0x2a'),auth['isAuthenticated'](),controller[_0x1a9c('0x2b')]);router[_0x1a9c('0x5')]('/chat/queues/waitinginteractions',auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x2c')]);router[_0x1a9c('0x5')](_0x1a9c('0x2d'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x2e')]);router[_0x1a9c('0x5')](_0x1a9c('0x2f'),auth[_0x1a9c('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x1a9c('0x5')](_0x1a9c('0x30'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x31')]);router[_0x1a9c('0x5')]('/sms/queues/waitinginteractions',auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x32')]);router[_0x1a9c('0x5')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1a9c('0x33')]);router[_0x1a9c('0x5')]('/fax/queues/waitinginteractions',auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x34')]);router['post']('/mail/queues/:id/notify',auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x35')](_0x1a9c('0x36')));router[_0x1a9c('0x5')](_0x1a9c('0x37'),auth['isAuthenticated'](),controller[_0x1a9c('0x38')]);router[_0x1a9c('0x39')](_0x1a9c('0x3a'),auth[_0x1a9c('0x7')](),controller['queueNotify']('chat'));router[_0x1a9c('0x5')](_0x1a9c('0x3b'),auth['isAuthenticated'](),controller[_0x1a9c('0x3c')]);router[_0x1a9c('0x39')](_0x1a9c('0x3d'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x35')](_0x1a9c('0x3e')));router[_0x1a9c('0x5')](_0x1a9c('0x3f'),auth['isAuthenticated'](),controller[_0x1a9c('0x40')]);router[_0x1a9c('0x39')](_0x1a9c('0x41'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x35')](_0x1a9c('0x42')));router['get'](_0x1a9c('0x43'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x44')]);router[_0x1a9c('0x39')](_0x1a9c('0x45'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x35')](_0x1a9c('0x46')));router[_0x1a9c('0x39')](_0x1a9c('0x47'),auth[_0x1a9c('0x7')](),controller[_0x1a9c('0x35')](_0x1a9c('0x48')));router[_0x1a9c('0x5')](_0x1a9c('0x49'),auth['isAuthenticated'](),controller[_0x1a9c('0x4a')]);router[_0x1a9c('0x5')](_0x1a9c('0x4b'),auth['isAuthenticated'](),controller[_0x1a9c('0x4c')]);router[_0x1a9c('0x39')]('/agents/:id/notify',auth[_0x1a9c('0x7')](),controller['agentNotify']);module[_0x1a9c('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 68adcb9..ff34a49 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 _0xd5cc=['internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','Campaigns','ChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','queue_id','uniq','value','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','From','QueueId','Start','queue','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','create','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','message','catch','status','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','MemberReport','INTERACTION','length','format','updateAttributes','findOrCreate','interface','SIP/%s','agent'];(function(_0x1d750c,_0x2afe73){var _0x1ae4aa=function(_0x443046){while(--_0x443046){_0x1d750c['push'](_0x1d750c['shift']());}};_0x1ae4aa(++_0x2afe73);}(_0xd5cc,0x129));var _0xcd5c=function(_0x8e1d1c,_0x1fa580){_0x8e1d1c=_0x8e1d1c-0x0;var _0x73ece9=_0xd5cc[_0x8e1d1c];return _0x73ece9;};'use strict';var BPromise=require(_0xcd5c('0x0'));var moment=require(_0xcd5c('0x1'));var _=require(_0xcd5c('0x2'));var util=require(_0xcd5c('0x3'));var db=require(_0xcd5c('0x4'))['db'];var logger=require(_0xcd5c('0x5'))('api');var jayson=require(_0xcd5c('0x6'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xcd5c('0x7')][_0xcd5c('0x8')]({'port':0x232b});var routingClient=jayson[_0xcd5c('0x7')][_0xcd5c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x12d7a0,_0x46f26a,_0x3d170e){return new BPromise(function(_0x2dade4,_0x44ebe7){var _0x463ebf=_0x3d170e?_0x3d170e:amiClient;return _0x463ebf['request'](_0x12d7a0,_0x46f26a)[_0xcd5c('0x9')](function(_0x27aa9a){if(_0x27aa9a[_0xcd5c('0xa')]){if(_0x27aa9a[_0xcd5c('0xa')][_0xcd5c('0xb')]===0x1f4){return _0x44ebe7(_0x27aa9a[_0xcd5c('0xa')][_0xcd5c('0xc')]);}return _0x2dade4(_0x27aa9a[_0xcd5c('0xa')]['message']);}else{_0x2dade4(_0x27aa9a['result']);}})[_0xcd5c('0xd')](function(_0x225e86){_0x44ebe7(_0x225e86);});});}function respondWithResult(_0x5b8acb,_0x5e04c0){_0x5e04c0=_0x5e04c0||0xc8;return function(_0x5f5203){if(_0x5f5203){return _0x5b8acb[_0xcd5c('0xe')](_0x5e04c0)['json'](_0x5f5203);}return _0x5b8acb['sendStatus'](0x194);};}function handleError(_0x280cca,_0x4dec5c){_0x4dec5c=_0x4dec5c||0x1f4;return function(_0x5db5ce){logger[_0xcd5c('0xa')](_0x5db5ce['stack']);if(_0x5db5ce[_0xcd5c('0xf')]){delete _0x5db5ce['name'];}_0x280cca[_0xcd5c('0xe')](_0x4dec5c)[_0xcd5c('0x10')](_0x5db5ce);};}function findById(_0x4c882c){return function(_0x188d4f){if(!_[_0xcd5c('0x11')](_0x4c882c)&&!_[_0xcd5c('0x11')](_0x188d4f)&&!_[_0xcd5c('0x11')](_0x188d4f[_0xcd5c('0x12')])){return _[_0xcd5c('0x13')](_0x188d4f[_0xcd5c('0x12')],function(_0x7fe0f1){return _0x7fe0f1['id']==_0x4c882c;});}return null;};}exports[_0xcd5c('0x14')]=function(_0x24ad51,_0x53f8fd){return respondWithRpcPromise(_0xcd5c('0x15'),_0x24ad51[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x53f8fd,null))[_0xcd5c('0xd')](handleError(_0x53f8fd,null));};exports[_0xcd5c('0x17')]=function(_0xec0bac,_0x1281eb){return respondWithRpcPromise(_0xcd5c('0x18'),_[_0xcd5c('0x19')](_0xec0bac[_0xcd5c('0x16')],_0xec0bac[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x1281eb,null))[_0xcd5c('0xd')](handleError(_0x1281eb,null));};exports[_0xcd5c('0x1b')]=function(_0x71a395,_0x45ac1d){return respondWithRpcPromise(_0xcd5c('0x1c'),_[_0xcd5c('0x19')](_0x71a395[_0xcd5c('0x16')],_0x71a395[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x45ac1d,null))['catch'](handleError(_0x45ac1d,null));};exports[_0xcd5c('0x1d')]=function(_0x43dea7,_0x54a50e){return respondWithRpcPromise(_0xcd5c('0x1e'),_0x43dea7[_0xcd5c('0x16')])['then'](respondWithResult(_0x54a50e,null))[_0xcd5c('0xd')](handleError(_0x54a50e,null));};exports[_0xcd5c('0x1f')]=function(_0x1c1264,_0x274ca7){return respondWithRpcPromise('VoiceQueues',_0x1c1264['query'])[_0xcd5c('0x9')](findById(_0x1c1264[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x274ca7,null))['catch'](handleError(_0x274ca7,null));};exports['updateVoiceQueue']=function(_0x48bce7,_0x1c285a){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xcd5c('0x19')](_0x48bce7[_0xcd5c('0x20')],_0x48bce7[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x1c285a,null))[_0xcd5c('0xd')](handleError(_0x1c285a,null));};exports[_0xcd5c('0x21')]=function(_0x243488,_0x53529e){return respondWithRpcPromise(_0xcd5c('0x22'),_[_0xcd5c('0x19')](_0x243488[_0xcd5c('0x16')],_0x243488[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x53529e,null))[_0xcd5c('0xd')](handleError(_0x53529e,null));};exports[_0xcd5c('0x23')]=function(_0x896884,_0x96cafc){return respondWithRpcPromise(_0xcd5c('0x24'),_0x896884['query'])[_0xcd5c('0x9')](respondWithResult(_0x96cafc,null))[_0xcd5c('0xd')](handleError(_0x96cafc,null));};exports['voiceQueuesChannel']=function(_0x5c0a28,_0x4d9223){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xcd5c('0x19')](_0x5c0a28[_0xcd5c('0x16')],_0x5c0a28[_0xcd5c('0x1a')]))['then'](respondWithResult(_0x4d9223,null))['catch'](handleError(_0x4d9223,null));};exports[_0xcd5c('0x25')]=function(_0x3a43e9,_0x5c2ad7){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xcd5c('0x19')](_0x3a43e9[_0xcd5c('0x16')],_0x3a43e9[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x5c2ad7,null))[_0xcd5c('0xd')](handleError(_0x5c2ad7,null));};exports['voiceQueuesChannelRedirect']=function(_0x47ae94,_0x92ce85){return respondWithRpcPromise(_0xcd5c('0x26'),_['merge'](_0x47ae94['query'],_0x47ae94[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x92ce85,null))[_0xcd5c('0xd')](handleError(_0x92ce85,null));};exports[_0xcd5c('0x27')]=function(_0x101838,_0x280bb2){return respondWithRpcPromise(_0xcd5c('0x28'),_0x101838[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x280bb2,null))[_0xcd5c('0xd')](handleError(_0x280bb2,null));};exports[_0xcd5c('0x29')]=function(_0x1446d1,_0x308bb2){return respondWithRpcPromise(_0xcd5c('0x2a'),_0x1446d1[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x308bb2,null))[_0xcd5c('0xd')](handleError(_0x308bb2,null));};exports[_0xcd5c('0x2b')]=function(_0x3780a8,_0x182a85){var _0x1d4adf;return respondWithRpcPromise(_0xcd5c('0x2c'),_0x3780a8[_0xcd5c('0x16')])[_0xcd5c('0x9')](function(_0x22917b){_0x1d4adf=_0x22917b;return respondWithRpcPromise(_0xcd5c('0x2c'),_0x3780a8['query'],routingClient);})[_0xcd5c('0x9')](function(_0x465d82){return _[_0xcd5c('0x19')]({},_0x465d82,_0x1d4adf);})['then'](respondWithResult(_0x182a85,null))[_0xcd5c('0xd')](handleError(_0x182a85,null));};exports[_0xcd5c('0x2d')]=function(_0x14c9d4,_0x4f3567){if(_0x14c9d4[_0xcd5c('0x20')]&&_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')]&&_0x14c9d4[_0xcd5c('0x2f')]&&_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0xf')]){for(var _0x6e3eaa in _0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')]){if(_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')]['hasOwnProperty'](_0x6e3eaa)){db[_0xcd5c('0x30')]['findAll']({'where':{'channel':_0x6e3eaa,'membername':_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0xf')],'type':_0xcd5c('0x31'),'exitAt':null,'uniqueid':_0x14c9d4['body'][_0xcd5c('0x2e')][_0x6e3eaa]&&_0x14c9d4[_0xcd5c('0x20')]['interaction'][_0x6e3eaa][_0xcd5c('0x32')]?{'$notIn':_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')][_0x6e3eaa]}:{'$ne':null}}})[_0xcd5c('0x9')](function(_0x2b6f8a){var _0x2df68c=moment()[_0xcd5c('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x132ece=0x0,_0x25f429=_0x2b6f8a['length'];_0x132ece<_0x25f429;_0x132ece+=0x1){_0x2b6f8a[_0x132ece][_0xcd5c('0x34')]({'exitAt':_0x2df68c});}});for(var _0x5c76d4=0x0;_0x5c76d4<_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')][_0x6e3eaa]['length'];_0x5c76d4+=0x1){db[_0xcd5c('0x30')][_0xcd5c('0x35')]({'where':{'channel':_0x6e3eaa,'membername':_0x14c9d4['user'][_0xcd5c('0xf')],'type':_0xcd5c('0x31'),'uniqueid':_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')][_0x6e3eaa][_0x5c76d4],'exitAt':null},'defaults':{'channel':_0x6e3eaa,'membername':_0x14c9d4[_0xcd5c('0x2f')]['name'],'interface':_['isNil'](_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0x36')])?util[_0xcd5c('0x33')](_0xcd5c('0x37'),_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0xf')]):_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0x36')],'type':_0xcd5c('0x31'),'enterAt':moment()[_0xcd5c('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xcd5c('0x38'),'internal':_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0x39')],'uniqueid':_0x14c9d4[_0xcd5c('0x20')]['interaction'][_0x6e3eaa][_0x5c76d4]}});}}}}return respondWithRpcPromise(_0xcd5c('0x3a'),{'id':_0x14c9d4[_0xcd5c('0x1a')]['id'],'capacity':_0x14c9d4['body'][_0xcd5c('0x3b')]},routingClient)[_0xcd5c('0x9')](respondWithResult(_0x4f3567,null))['catch'](handleError(_0x4f3567,null));};exports['telephones']=function(_0x219e10,_0x58ed2c){return respondWithRpcPromise(_0xcd5c('0x3c'),_0x219e10[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x58ed2c,null))[_0xcd5c('0xd')](handleError(_0x58ed2c,null));};exports['trunks']=function(_0x576839,_0x50805d){return respondWithRpcPromise(_0xcd5c('0x3d'),_0x576839[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x50805d,null))[_0xcd5c('0xd')](handleError(_0x50805d,null));};exports[_0xcd5c('0x3e')]=function(_0x2ff2dc,_0x1d8260){return respondWithRpcPromise(_0xcd5c('0x3f'),_0x2ff2dc[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x1d8260,null))[_0xcd5c('0xd')](handleError(_0x1d8260,null));};exports['chatQueues']=function(_0x562bc4,_0x2491cf){return respondWithRpcPromise('ChatQueues',_0x562bc4[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x2491cf,null))[_0xcd5c('0xd')](handleError(_0x2491cf,null));};exports['showChatQueues']=function(_0x238c40,_0x52de5a){return respondWithRpcPromise(_0xcd5c('0x40'),_0x238c40['query'],routingClient)['then'](findById(_0x238c40['params']['id']))['then'](respondWithResult(_0x52de5a,null))[_0xcd5c('0xd')](handleError(_0x52de5a,null));};exports['mailQueues']=function(_0x44aace,_0x38fee8){return respondWithRpcPromise(_0xcd5c('0x41'),_0x44aace[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x38fee8,null))['catch'](handleError(_0x38fee8,null));};exports[_0xcd5c('0x42')]=function(_0x58d65f,_0x43d840){return respondWithRpcPromise(_0xcd5c('0x41'),_0x58d65f[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](findById(_0x58d65f[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x43d840,null))[_0xcd5c('0xd')](handleError(_0x43d840,null));};exports[_0xcd5c('0x43')]=function(_0x8091e7,_0x49db97){return respondWithRpcPromise(_0xcd5c('0x44'),_0x8091e7[_0xcd5c('0x16')],mailClient)['then'](respondWithResult(_0x49db97,null))[_0xcd5c('0xd')](handleError(_0x49db97,null));};exports[_0xcd5c('0x45')]=function(_0x2250ef,_0x59ec26){return respondWithRpcPromise(_0xcd5c('0x46'),_0x2250ef[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x59ec26,null))[_0xcd5c('0xd')](handleError(_0x59ec26,null));};exports[_0xcd5c('0x47')]=function(_0x1da557,_0x18a6e8){return respondWithRpcPromise(_0xcd5c('0x46'),_0x1da557[_0xcd5c('0x16')],routingClient)['then'](findById(_0x1da557[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x18a6e8,null))[_0xcd5c('0xd')](handleError(_0x18a6e8,null));};exports['smsQueues']=function(_0x3eb102,_0x2e4b2a){return respondWithRpcPromise(_0xcd5c('0x48'),_0x3eb102[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x2e4b2a,null))[_0xcd5c('0xd')](handleError(_0x2e4b2a,null));};exports[_0xcd5c('0x49')]=function(_0x57a64a,_0x28da0d){return respondWithRpcPromise('SmsQueues',_0x57a64a[_0xcd5c('0x16')],routingClient)['then'](findById(_0x57a64a[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x28da0d,null))['catch'](handleError(_0x28da0d,null));};exports[_0xcd5c('0x4a')]=function(_0x50ceba,_0x14883){return respondWithRpcPromise(_0xcd5c('0x4b'),_0x50ceba['query'],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x14883,null))[_0xcd5c('0xd')](handleError(_0x14883,null));};exports[_0xcd5c('0x4c')]=function(_0x50313f,_0x4638bb){return respondWithRpcPromise(_0xcd5c('0x4b'),_0x50313f[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](findById(_0x50313f['params']['id']))[_0xcd5c('0x9')](respondWithResult(_0x4638bb,null))[_0xcd5c('0xd')](handleError(_0x4638bb,null));};exports['faxQueues']=function(_0x151e40,_0x1cc453){return respondWithRpcPromise(_0xcd5c('0x4d'),_0x151e40['query'],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x1cc453,null))[_0xcd5c('0xd')](handleError(_0x1cc453,null));};exports[_0xcd5c('0x4e')]=function(_0xb48b68,_0x26895a){return respondWithRpcPromise(_0xcd5c('0x4d'),_0xb48b68['query'],routingClient)[_0xcd5c('0x9')](findById(_0xb48b68[_0xcd5c('0x1a')]['id']))['then'](respondWithResult(_0x26895a,null))['catch'](handleError(_0x26895a,null));};exports[_0xcd5c('0x4f')]=function(_0x57d8dc,_0x39152b){return respondWithRpcPromise(_0xcd5c('0x50'),_0x57d8dc[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x39152b,null))[_0xcd5c('0xd')](handleError(_0x39152b,null));};exports['chatQueuesWaitingInteractions']=function(_0x2f7e40,_0x46ff0d){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x2f7e40['query'],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x46ff0d,null))[_0xcd5c('0xd')](handleError(_0x46ff0d,null));};exports[_0xcd5c('0x51')]=function(_0x4611b2,_0x46c920){return respondWithRpcPromise(_0xcd5c('0x52'),_0x4611b2[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x46c920,null))[_0xcd5c('0xd')](handleError(_0x46c920,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xe2cbb0,_0x1651fb){return respondWithRpcPromise(_0xcd5c('0x53'),_0xe2cbb0[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x1651fb,null))[_0xcd5c('0xd')](handleError(_0x1651fb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x3d50a0,_0x6af6cb){return respondWithRpcPromise(_0xcd5c('0x53'),_0x3d50a0[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](function(_0x27c986){if(_0x3d50a0['query']['type']!==undefined){var _0x538509=_(_0x27c986[_0xcd5c('0x12')])[_0xcd5c('0x54')]([_0x3d50a0[_0xcd5c('0x16')][_0xcd5c('0x55')],_0x3d50a0['params']['id']])['map'](_0xcd5c('0x56'))[_0xcd5c('0x57')]()[_0xcd5c('0x58')]();return _0x27c986[_0xcd5c('0x12')][_0xcd5c('0x54')](function(_0x4233e1){return _0x538509[_0xcd5c('0x59')](_0x4233e1[_0xcd5c('0x56')])>-0x1;});}else{return _0x27c986[_0xcd5c('0x12')]['filter'](function(_0x304999){return _0x304999[_0xcd5c('0x56')]===parseInt(_0x3d50a0[_0xcd5c('0x1a')]['id']);});}})['then'](respondWithResult(_0x6af6cb,null))['catch'](handleError(_0x6af6cb,null));};exports['smsQueuesWaitingInteractions']=function(_0x50c441,_0x27bbb2){return respondWithRpcPromise(_0xcd5c('0x5a'),_0x50c441[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x27bbb2,null))[_0xcd5c('0xd')](handleError(_0x27bbb2,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3fd01b,_0x1cfa69){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3fd01b[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x1cfa69,null))['catch'](handleError(_0x1cfa69,null));};exports[_0xcd5c('0x5b')]=function(_0x4dd65d,_0x4e9269){return respondWithRpcPromise(_0xcd5c('0x5c'),_0x4dd65d[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x4e9269,null))[_0xcd5c('0xd')](handleError(_0x4e9269,null));};exports[_0xcd5c('0x5d')]=function(_0x52b8de){return function(_0x355f0c,_0x1869d2){var _0x53b986,_0x548425;var _0x5c191d=_[_0xcd5c('0x5e')](_0x52b8de);var _0x52f516=_0x52b8de===_0xcd5c('0x5f')?_0xcd5c('0x60'):_0xcd5c('0x61');return db[_0x5c191d+'Queue'][_0xcd5c('0x62')]({'raw':!![],'where':{'id':_0x355f0c['params']['id']}})['then'](function(_0x3ac6e3){if(_[_0xcd5c('0x11')](_0x3ac6e3)){throw new Error(_0x5c191d+_0xcd5c('0x63'));}_0x53b986=_0x3ac6e3;return db[_0x5c191d+_0xcd5c('0x64')][_0xcd5c('0x62')]({'where':{'id':_0x355f0c['body'][_0xcd5c('0x65')]},'include':[{'model':db[_0x5c191d+_0xcd5c('0x66')],'as':'Interaction'},{'model':db[_0x5c191d+_0x52f516],'as':_0xcd5c('0x61')}]});})[_0xcd5c('0x9')](function(_0x1eff07){if(_[_0xcd5c('0x11')](_0x1eff07)){throw new Error(_0x5c191d+_0xcd5c('0x67'));}_0x548425=_0x1eff07;return _0x1eff07[_0xcd5c('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3be0fb={'uniqueid':_0x52b8de+'.'+_0x548425['id']+'.'+_0x548425['Interaction']['id'],'FromUserId':_0x355f0c['user']['id'],'type':'queue'};_0x3be0fb[_0x5c191d+'MessageId']=_0x548425['id'];_0x3be0fb[_0x5c191d+_0xcd5c('0x69')]=_0x548425[_0xcd5c('0x66')]['id'];_0x3be0fb[_0xcd5c('0x6a')+_0x5c191d+_0x52f516+'Id']=_0x548425[_0xcd5c('0x61')]['id'];_0x3be0fb['To'+_0x5c191d+_0xcd5c('0x6b')]=_0x53b986['id'];return db[_0x5c191d+'TransferReport']['create'](_0x3be0fb);})['then'](function(){return respondWithRpcPromise(_0xcd5c('0x6c'),{'channel':_0x52b8de,'interaction':_0x548425[_0xcd5c('0x66')],'message':_0x548425,'account':_0x548425[_0xcd5c('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0xcd5c('0x6d'),'appdata':_0x53b986['name']+','+(_0x548425['Account']['queueTransferTimeout']||0x12c),'interval':_0xcd5c('0x6e')}]},routingClient);})['then'](respondWithResult(_0x1869d2,null))['catch'](handleError(_0x1869d2,null));};};exports[_0xcd5c('0x6f')]=function(_0x4a4012,_0x33799b){var _0x39b181,_0x1db64d;if(_[_0xcd5c('0x11')](_0x4a4012['body'][_0xcd5c('0x70')])){throw new Error(_0xcd5c('0x71'));}var _0x296a1d=_0x4a4012[_0xcd5c('0x20')]['channel'];var _0x28e30e=_[_0xcd5c('0x5e')](_0x296a1d);var _0x10c05d=_0x296a1d==='chat'?'Website':_0xcd5c('0x61');return db[_0xcd5c('0x72')][_0xcd5c('0x62')]({'raw':!![],'where':{'id':_0x4a4012['params']['id'],'role':'agent'}})[_0xcd5c('0x9')](function(_0x52f959){if(_[_0xcd5c('0x11')](_0x52f959)){throw new Error(_0xcd5c('0x73'));}_0x39b181=_0x52f959;return db[_0x28e30e+_0xcd5c('0x64')][_0xcd5c('0x62')]({'where':{'id':_0x4a4012[_0xcd5c('0x20')][_0xcd5c('0x65')]},'include':[{'model':db[_0x28e30e+'Interaction'],'as':_0xcd5c('0x66')},{'model':db[_0x28e30e+_0x10c05d],'as':_0xcd5c('0x61')}]});})[_0xcd5c('0x9')](function(_0x4a5e92){if(_[_0xcd5c('0x11')](_0x4a5e92)){throw new Error(_0x28e30e+_0xcd5c('0x67'));}_0x1db64d=_0x4a5e92;return _0x4a5e92[_0xcd5c('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0xcd5c('0x9')](function(){var _0x28b028={'uniqueid':_0x296a1d+'.'+_0x1db64d['id']+'.'+_0x1db64d['Interaction']['id'],'FromUserId':_0x4a4012[_0xcd5c('0x2f')]['id'],'type':_0xcd5c('0x38'),'ToUserId':_0x39b181['id']};_0x28b028[_0x28e30e+'MessageId']=_0x1db64d['id'];_0x28b028[_0x28e30e+_0xcd5c('0x69')]=_0x1db64d[_0xcd5c('0x66')]['id'];_0x28b028[_0xcd5c('0x6a')+_0x28e30e+_0x10c05d+'Id']=_0x1db64d['Account']['id'];return db[_0x28e30e+'TransferReport'][_0xcd5c('0x74')](_0x28b028);})[_0xcd5c('0x9')](function(){return respondWithRpcPromise(_0xcd5c('0x6c'),{'channel':_0x296a1d,'interaction':_0x1db64d[_0xcd5c('0x66')],'message':_0x1db64d,'account':_0x1db64d[_0xcd5c('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x39b181[_0xcd5c('0xf')]+','+(_0x1db64d[_0xcd5c('0x61')][_0xcd5c('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x33799b,null))[_0xcd5c('0xd')](handleError(_0x33799b,null));}; \ No newline at end of file +var _0xf241=['Interaction','\x20Message\x20not\x20found','update','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','messageId','MessageId','create','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','catch','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','Message'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xf241,0x98));var _0x1f24=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf241[_0x4a9fb1];return _0x348672;};'use strict';var BPromise=require(_0x1f24('0x0'));var moment=require(_0x1f24('0x1'));var _=require(_0x1f24('0x2'));var util=require(_0x1f24('0x3'));var db=require(_0x1f24('0x4'))['db'];var logger=require('../../config/logger')(_0x1f24('0x5'));var jayson=require(_0x1f24('0x6'));var amiClient=jayson[_0x1f24('0x7')][_0x1f24('0x8')]({'port':0x232a});var mailClient=jayson[_0x1f24('0x7')][_0x1f24('0x8')]({'port':0x232b});var routingClient=jayson[_0x1f24('0x7')][_0x1f24('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x254784,_0x15e63a,_0x32f95b){return new BPromise(function(_0x58b50f,_0x54d372){var _0x311a45=_0x32f95b?_0x32f95b:amiClient;return _0x311a45[_0x1f24('0x9')](_0x254784,_0x15e63a)[_0x1f24('0xa')](function(_0x19ac8d){if(_0x19ac8d['error']){if(_0x19ac8d[_0x1f24('0xb')][_0x1f24('0xc')]===0x1f4){return _0x54d372(_0x19ac8d[_0x1f24('0xb')][_0x1f24('0xd')]);}return _0x58b50f(_0x19ac8d[_0x1f24('0xb')][_0x1f24('0xd')]);}else{_0x58b50f(_0x19ac8d[_0x1f24('0xe')]);}})['catch'](function(_0x568903){_0x54d372(_0x568903);});});}function respondWithResult(_0x2130ff,_0x5ca7ab){_0x5ca7ab=_0x5ca7ab||0xc8;return function(_0x400be5){if(_0x400be5){return _0x2130ff[_0x1f24('0xf')](_0x5ca7ab)['json'](_0x400be5);}return _0x2130ff[_0x1f24('0x10')](0x194);};}function handleError(_0x3039f4,_0x2ed486){_0x2ed486=_0x2ed486||0x1f4;return function(_0x3bdb81){logger[_0x1f24('0xb')](_0x3bdb81[_0x1f24('0x11')]);if(_0x3bdb81['name']){delete _0x3bdb81[_0x1f24('0x12')];}_0x3039f4[_0x1f24('0xf')](_0x2ed486)[_0x1f24('0x13')](_0x3bdb81);};}function findById(_0x2df4c9){return function(_0x45c10a){if(!_[_0x1f24('0x14')](_0x2df4c9)&&!_[_0x1f24('0x14')](_0x45c10a)&&!_[_0x1f24('0x14')](_0x45c10a[_0x1f24('0x15')])){return _['find'](_0x45c10a[_0x1f24('0x15')],function(_0x295970){return _0x295970['id']==_0x2df4c9;});}return null;};}exports[_0x1f24('0x16')]=function(_0x57a7ad,_0x59ee8c){return respondWithRpcPromise(_0x1f24('0x17'),_0x57a7ad[_0x1f24('0x18')])[_0x1f24('0xa')](respondWithResult(_0x59ee8c,null))[_0x1f24('0x19')](handleError(_0x59ee8c,null));};exports['voiceChannelMixMonitor']=function(_0x3749c4,_0x575311){return respondWithRpcPromise(_0x1f24('0x1a'),_[_0x1f24('0x1b')](_0x3749c4['query'],_0x3749c4['params']))[_0x1f24('0xa')](respondWithResult(_0x575311,null))[_0x1f24('0x19')](handleError(_0x575311,null));};exports[_0x1f24('0x1c')]=function(_0x3beb0e,_0x4540f1){return respondWithRpcPromise(_0x1f24('0x1d'),_[_0x1f24('0x1b')](_0x3beb0e[_0x1f24('0x18')],_0x3beb0e[_0x1f24('0x1e')]))['then'](respondWithResult(_0x4540f1,null))['catch'](handleError(_0x4540f1,null));};exports[_0x1f24('0x1f')]=function(_0x88980f,_0x2b1282){return respondWithRpcPromise('VoiceQueues',_0x88980f[_0x1f24('0x18')])[_0x1f24('0xa')](respondWithResult(_0x2b1282,null))[_0x1f24('0x19')](handleError(_0x2b1282,null));};exports[_0x1f24('0x20')]=function(_0x43b091,_0x170a20){return respondWithRpcPromise(_0x1f24('0x21'),_0x43b091['query'])[_0x1f24('0xa')](findById(_0x43b091[_0x1f24('0x1e')]['id']))['then'](respondWithResult(_0x170a20,null))[_0x1f24('0x19')](handleError(_0x170a20,null));};exports[_0x1f24('0x22')]=function(_0x1c8f2e,_0x597736){return respondWithRpcPromise(_0x1f24('0x23'),_[_0x1f24('0x1b')](_0x1c8f2e[_0x1f24('0x24')],_0x1c8f2e[_0x1f24('0x1e')]))[_0x1f24('0xa')](respondWithResult(_0x597736,null))[_0x1f24('0x19')](handleError(_0x597736,null));};exports[_0x1f24('0x25')]=function(_0x168693,_0x4b0dcf){return respondWithRpcPromise(_0x1f24('0x26'),_[_0x1f24('0x1b')](_0x168693[_0x1f24('0x18')],_0x168693[_0x1f24('0x1e')]))['then'](respondWithResult(_0x4b0dcf,null))[_0x1f24('0x19')](handleError(_0x4b0dcf,null));};exports[_0x1f24('0x27')]=function(_0x31e0ab,_0x250770){return respondWithRpcPromise(_0x1f24('0x28'),_0x31e0ab[_0x1f24('0x18')])[_0x1f24('0xa')](respondWithResult(_0x250770,null))[_0x1f24('0x19')](handleError(_0x250770,null));};exports[_0x1f24('0x29')]=function(_0x5682a0,_0x37bd1b){return respondWithRpcPromise(_0x1f24('0x2a'),_[_0x1f24('0x1b')](_0x5682a0[_0x1f24('0x18')],_0x5682a0[_0x1f24('0x1e')]))['then'](respondWithResult(_0x37bd1b,null))[_0x1f24('0x19')](handleError(_0x37bd1b,null));};exports[_0x1f24('0x2b')]=function(_0x3a9d53,_0x148456){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x1f24('0x1b')](_0x3a9d53[_0x1f24('0x18')],_0x3a9d53['params']))[_0x1f24('0xa')](respondWithResult(_0x148456,null))[_0x1f24('0x19')](handleError(_0x148456,null));};exports[_0x1f24('0x2c')]=function(_0x5c7b40,_0xde1ac5){return respondWithRpcPromise(_0x1f24('0x2d'),_[_0x1f24('0x1b')](_0x5c7b40['query'],_0x5c7b40[_0x1f24('0x1e')]))[_0x1f24('0xa')](respondWithResult(_0xde1ac5,null))['catch'](handleError(_0xde1ac5,null));};exports['outbound']=function(_0x50ca68,_0x276e37){return respondWithRpcPromise(_0x1f24('0x2e'),_0x50ca68[_0x1f24('0x18')])[_0x1f24('0xa')](respondWithResult(_0x276e37,null))[_0x1f24('0x19')](handleError(_0x276e37,null));};exports[_0x1f24('0x2f')]=function(_0x3aadb5,_0x1d0d2e){return respondWithRpcPromise(_0x1f24('0x30'),_0x3aadb5[_0x1f24('0x18')])['then'](respondWithResult(_0x1d0d2e,null))[_0x1f24('0x19')](handleError(_0x1d0d2e,null));};exports[_0x1f24('0x31')]=function(_0xab0b0e,_0x417421){var _0x4b2da2;return respondWithRpcPromise(_0x1f24('0x32'),_0xab0b0e[_0x1f24('0x18')])[_0x1f24('0xa')](function(_0xed0fc){_0x4b2da2=_0xed0fc;return respondWithRpcPromise(_0x1f24('0x32'),_0xab0b0e['query'],routingClient);})[_0x1f24('0xa')](function(_0xd03523){return _['merge']({},_0xd03523,_0x4b2da2);})[_0x1f24('0xa')](respondWithResult(_0x417421,null))[_0x1f24('0x19')](handleError(_0x417421,null));};exports[_0x1f24('0x33')]=function(_0x2b23d2,_0x2e0b14){if(_0x2b23d2[_0x1f24('0x24')]&&_0x2b23d2[_0x1f24('0x24')][_0x1f24('0x34')]&&_0x2b23d2[_0x1f24('0x35')]&&_0x2b23d2[_0x1f24('0x35')][_0x1f24('0x12')]){for(var _0x1a4083 in _0x2b23d2[_0x1f24('0x24')]['interaction']){if(_0x2b23d2[_0x1f24('0x24')][_0x1f24('0x34')][_0x1f24('0x36')](_0x1a4083)){db[_0x1f24('0x37')][_0x1f24('0x38')]({'where':{'channel':_0x1a4083,'membername':_0x2b23d2['user'][_0x1f24('0x12')],'type':_0x1f24('0x39'),'exitAt':null,'uniqueid':_0x2b23d2[_0x1f24('0x24')]['interaction'][_0x1a4083]&&_0x2b23d2[_0x1f24('0x24')]['interaction'][_0x1a4083][_0x1f24('0x3a')]?{'$notIn':_0x2b23d2[_0x1f24('0x24')][_0x1f24('0x34')][_0x1a4083]}:{'$ne':null}}})[_0x1f24('0xa')](function(_0x3486d2){var _0x15a079=moment()[_0x1f24('0x3b')](_0x1f24('0x3c'));for(var _0x1b1ebb=0x0,_0x21828a=_0x3486d2['length'];_0x1b1ebb<_0x21828a;_0x1b1ebb+=0x1){_0x3486d2[_0x1b1ebb][_0x1f24('0x3d')]({'exitAt':_0x15a079});}});for(var _0x59cc44=0x0;_0x59cc44<_0x2b23d2[_0x1f24('0x24')][_0x1f24('0x34')][_0x1a4083][_0x1f24('0x3a')];_0x59cc44+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x1a4083,'membername':_0x2b23d2[_0x1f24('0x35')][_0x1f24('0x12')],'type':'INTERACTION','uniqueid':_0x2b23d2[_0x1f24('0x24')]['interaction'][_0x1a4083][_0x59cc44],'exitAt':null},'defaults':{'channel':_0x1a4083,'membername':_0x2b23d2['user'][_0x1f24('0x12')],'interface':_[_0x1f24('0x14')](_0x2b23d2[_0x1f24('0x35')]['interface'])?util[_0x1f24('0x3b')]('SIP/%s',_0x2b23d2[_0x1f24('0x35')][_0x1f24('0x12')]):_0x2b23d2[_0x1f24('0x35')]['interface'],'type':_0x1f24('0x39'),'enterAt':moment()[_0x1f24('0x3b')](_0x1f24('0x3c')),'role':'agent','internal':_0x2b23d2[_0x1f24('0x35')][_0x1f24('0x3e')],'uniqueid':_0x2b23d2['body'][_0x1f24('0x34')][_0x1a4083][_0x59cc44]}});}}}}return respondWithRpcPromise(_0x1f24('0x3f'),{'id':_0x2b23d2[_0x1f24('0x1e')]['id'],'capacity':_0x2b23d2[_0x1f24('0x24')][_0x1f24('0x40')]},routingClient)[_0x1f24('0xa')](respondWithResult(_0x2e0b14,null))[_0x1f24('0x19')](handleError(_0x2e0b14,null));};exports['telephones']=function(_0x4394fa,_0x1926b6){return respondWithRpcPromise(_0x1f24('0x41'),_0x4394fa['query'])[_0x1f24('0xa')](respondWithResult(_0x1926b6,null))[_0x1f24('0x19')](handleError(_0x1926b6,null));};exports[_0x1f24('0x42')]=function(_0x405ce8,_0x34495c){return respondWithRpcPromise(_0x1f24('0x43'),_0x405ce8[_0x1f24('0x18')])[_0x1f24('0xa')](respondWithResult(_0x34495c,null))[_0x1f24('0x19')](handleError(_0x34495c,null));};exports[_0x1f24('0x44')]=function(_0xeb89e0,_0x57b1a5){return respondWithRpcPromise(_0x1f24('0x45'),_0xeb89e0[_0x1f24('0x18')])['then'](respondWithResult(_0x57b1a5,null))['catch'](handleError(_0x57b1a5,null));};exports[_0x1f24('0x46')]=function(_0x518aea,_0x4ede94){return respondWithRpcPromise(_0x1f24('0x47'),_0x518aea[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x4ede94,null))[_0x1f24('0x19')](handleError(_0x4ede94,null));};exports[_0x1f24('0x48')]=function(_0xcaaf1,_0x1522d8){return respondWithRpcPromise(_0x1f24('0x47'),_0xcaaf1['query'],routingClient)[_0x1f24('0xa')](findById(_0xcaaf1['params']['id']))['then'](respondWithResult(_0x1522d8,null))[_0x1f24('0x19')](handleError(_0x1522d8,null));};exports[_0x1f24('0x49')]=function(_0x11e2a3,_0x14d434){return respondWithRpcPromise(_0x1f24('0x4a'),_0x11e2a3[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x14d434,null))[_0x1f24('0x19')](handleError(_0x14d434,null));};exports['showMailQueues']=function(_0x487c28,_0x506cb5){return respondWithRpcPromise('MailQueues',_0x487c28[_0x1f24('0x18')],routingClient)['then'](findById(_0x487c28[_0x1f24('0x1e')]['id']))['then'](respondWithResult(_0x506cb5,null))[_0x1f24('0x19')](handleError(_0x506cb5,null));};exports['mailAccounts']=function(_0x5f7cd6,_0x4d5b76){return respondWithRpcPromise(_0x1f24('0x4b'),_0x5f7cd6['query'],mailClient)[_0x1f24('0xa')](respondWithResult(_0x4d5b76,null))[_0x1f24('0x19')](handleError(_0x4d5b76,null));};exports[_0x1f24('0x4c')]=function(_0x4519dc,_0x13b765){return respondWithRpcPromise(_0x1f24('0x4d'),_0x4519dc['query'],routingClient)[_0x1f24('0xa')](respondWithResult(_0x13b765,null))[_0x1f24('0x19')](handleError(_0x13b765,null));};exports['showOpenchannelQueues']=function(_0x156d26,_0x291b85){return respondWithRpcPromise('OpenchannelQueues',_0x156d26[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](findById(_0x156d26[_0x1f24('0x1e')]['id']))['then'](respondWithResult(_0x291b85,null))[_0x1f24('0x19')](handleError(_0x291b85,null));};exports[_0x1f24('0x4e')]=function(_0x43a3b5,_0x4a75d9){return respondWithRpcPromise(_0x1f24('0x4f'),_0x43a3b5[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x4a75d9,null))[_0x1f24('0x19')](handleError(_0x4a75d9,null));};exports[_0x1f24('0x50')]=function(_0x1d7f0e,_0x1d10c9){return respondWithRpcPromise(_0x1f24('0x4f'),_0x1d7f0e['query'],routingClient)[_0x1f24('0xa')](findById(_0x1d7f0e[_0x1f24('0x1e')]['id']))[_0x1f24('0xa')](respondWithResult(_0x1d10c9,null))[_0x1f24('0x19')](handleError(_0x1d10c9,null));};exports[_0x1f24('0x51')]=function(_0x2c87fb,_0x269a72){return respondWithRpcPromise(_0x1f24('0x52'),_0x2c87fb[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x269a72,null))['catch'](handleError(_0x269a72,null));};exports[_0x1f24('0x53')]=function(_0x39323c,_0x3e2c3a){return respondWithRpcPromise(_0x1f24('0x52'),_0x39323c[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](findById(_0x39323c[_0x1f24('0x1e')]['id']))[_0x1f24('0xa')](respondWithResult(_0x3e2c3a,null))[_0x1f24('0x19')](handleError(_0x3e2c3a,null));};exports[_0x1f24('0x54')]=function(_0x3b187e,_0x32ac43){return respondWithRpcPromise('FaxQueues',_0x3b187e[_0x1f24('0x18')],routingClient)['then'](respondWithResult(_0x32ac43,null))[_0x1f24('0x19')](handleError(_0x32ac43,null));};exports[_0x1f24('0x55')]=function(_0x195782,_0x18222e){return respondWithRpcPromise(_0x1f24('0x56'),_0x195782[_0x1f24('0x18')],routingClient)['then'](findById(_0x195782[_0x1f24('0x1e')]['id']))[_0x1f24('0xa')](respondWithResult(_0x18222e,null))[_0x1f24('0x19')](handleError(_0x18222e,null));};exports[_0x1f24('0x57')]=function(_0x4a8b15,_0x20cb95){return respondWithRpcPromise(_0x1f24('0x58'),_0x4a8b15[_0x1f24('0x18')])[_0x1f24('0xa')](respondWithResult(_0x20cb95,null))['catch'](handleError(_0x20cb95,null));};exports[_0x1f24('0x59')]=function(_0x180022,_0x2c6d36){return respondWithRpcPromise(_0x1f24('0x5a'),_0x180022[_0x1f24('0x18')],routingClient)['then'](respondWithResult(_0x2c6d36,null))[_0x1f24('0x19')](handleError(_0x2c6d36,null));};exports[_0x1f24('0x5b')]=function(_0x57e192,_0x3bb6c5){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x57e192[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x3bb6c5,null))[_0x1f24('0x19')](handleError(_0x3bb6c5,null));};exports[_0x1f24('0x5c')]=function(_0x37909f,_0x24c644){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37909f[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x24c644,null))[_0x1f24('0x19')](handleError(_0x24c644,null));};exports[_0x1f24('0x5d')]=function(_0x2d4e85,_0x5a437e){return respondWithRpcPromise(_0x1f24('0x5e'),_0x2d4e85['query'],routingClient)[_0x1f24('0xa')](function(_0x18c150){if(_0x2d4e85['query'][_0x1f24('0x5f')]!==undefined){var _0x2e23db=_(_0x18c150[_0x1f24('0x15')])[_0x1f24('0x60')]([_0x2d4e85[_0x1f24('0x18')][_0x1f24('0x5f')],_0x2d4e85[_0x1f24('0x1e')]['id']])['map'](_0x1f24('0x61'))[_0x1f24('0x62')]()['value']();return _0x18c150[_0x1f24('0x15')]['filter'](function(_0x110196){return _0x2e23db[_0x1f24('0x63')](_0x110196[_0x1f24('0x61')])>-0x1;});}else{return _0x18c150[_0x1f24('0x15')]['filter'](function(_0x993e2b){return _0x993e2b['queue_id']===parseInt(_0x2d4e85[_0x1f24('0x1e')]['id']);});}})['then'](respondWithResult(_0x5a437e,null))[_0x1f24('0x19')](handleError(_0x5a437e,null));};exports[_0x1f24('0x64')]=function(_0x47aa4d,_0x55342d){return respondWithRpcPromise(_0x1f24('0x65'),_0x47aa4d[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x55342d,null))['catch'](handleError(_0x55342d,null));};exports[_0x1f24('0x66')]=function(_0x4891c6,_0x1509bd){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4891c6['query'],routingClient)[_0x1f24('0xa')](respondWithResult(_0x1509bd,null))[_0x1f24('0x19')](handleError(_0x1509bd,null));};exports[_0x1f24('0x67')]=function(_0x1a73d3,_0x4225d9){return respondWithRpcPromise(_0x1f24('0x68'),_0x1a73d3[_0x1f24('0x18')],routingClient)[_0x1f24('0xa')](respondWithResult(_0x4225d9,null))[_0x1f24('0x19')](handleError(_0x4225d9,null));};exports[_0x1f24('0x69')]=function(_0x532a3a){return function(_0x47bd5a,_0x135787){var _0x42d238,_0xe9b87a;var _0x51507b=_[_0x1f24('0x6a')](_0x532a3a);var _0x4b725b=_0x532a3a===_0x1f24('0x6b')?_0x1f24('0x6c'):_0x1f24('0x6d');return db[_0x51507b+'Queue'][_0x1f24('0x6e')]({'raw':!![],'where':{'id':_0x47bd5a[_0x1f24('0x1e')]['id']}})['then'](function(_0x20a6ff){if(_[_0x1f24('0x14')](_0x20a6ff)){throw new Error(_0x51507b+'\x20Queue\x20not\x20found');}_0x42d238=_0x20a6ff;return db[_0x51507b+_0x1f24('0x6f')][_0x1f24('0x6e')]({'where':{'id':_0x47bd5a['body']['messageId']},'include':[{'model':db[_0x51507b+_0x1f24('0x70')],'as':_0x1f24('0x70')},{'model':db[_0x51507b+_0x4b725b],'as':_0x1f24('0x6d')}]});})[_0x1f24('0xa')](function(_0x279a87){if(_['isNil'](_0x279a87)){throw new Error(_0x51507b+_0x1f24('0x71'));}_0xe9b87a=_0x279a87;return _0x279a87[_0x1f24('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4835b8={'uniqueid':_0x532a3a+'.'+_0xe9b87a['id']+'.'+_0xe9b87a[_0x1f24('0x70')]['id'],'FromUserId':_0x47bd5a[_0x1f24('0x35')]['id'],'type':'queue'};_0x4835b8[_0x51507b+'MessageId']=_0xe9b87a['id'];_0x4835b8[_0x51507b+_0x1f24('0x73')]=_0xe9b87a[_0x1f24('0x70')]['id'];_0x4835b8[_0x1f24('0x74')+_0x51507b+_0x4b725b+'Id']=_0xe9b87a[_0x1f24('0x6d')]['id'];_0x4835b8['To'+_0x51507b+_0x1f24('0x75')]=_0x42d238['id'];return db[_0x51507b+_0x1f24('0x76')]['create'](_0x4835b8);})['then'](function(){return respondWithRpcPromise(_0x1f24('0x77'),{'channel':_0x532a3a,'interaction':_0xe9b87a[_0x1f24('0x70')],'message':_0xe9b87a,'account':_0xe9b87a[_0x1f24('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1f24('0x78'),'appdata':_0x42d238[_0x1f24('0x12')]+','+(_0xe9b87a[_0x1f24('0x6d')][_0x1f24('0x79')]||0x12c),'interval':_0x1f24('0x7a')}]},routingClient);})['then'](respondWithResult(_0x135787,null))[_0x1f24('0x19')](handleError(_0x135787,null));};};exports['agentNotify']=function(_0xe2ffc3,_0x36ee35){var _0xda30b4,_0x1f9849;if(_['isNil'](_0xe2ffc3['body'][_0x1f24('0x7b')])){throw new Error(_0x1f24('0x7c'));}var _0x870f0e=_0xe2ffc3['body'][_0x1f24('0x7b')];var _0x52cbca=_['capitalize'](_0x870f0e);var _0x27658d=_0x870f0e===_0x1f24('0x6b')?'Website':_0x1f24('0x6d');return db[_0x1f24('0x7d')][_0x1f24('0x6e')]({'raw':!![],'where':{'id':_0xe2ffc3['params']['id'],'role':_0x1f24('0x7e')}})['then'](function(_0x130948){if(_['isNil'](_0x130948)){throw new Error(_0x1f24('0x7f'));}_0xda30b4=_0x130948;return db[_0x52cbca+'Message'][_0x1f24('0x6e')]({'where':{'id':_0xe2ffc3[_0x1f24('0x24')][_0x1f24('0x80')]},'include':[{'model':db[_0x52cbca+'Interaction'],'as':_0x1f24('0x70')},{'model':db[_0x52cbca+_0x27658d],'as':'Account'}]});})[_0x1f24('0xa')](function(_0x4f8bc6){if(_[_0x1f24('0x14')](_0x4f8bc6)){throw new Error(_0x52cbca+_0x1f24('0x71'));}_0x1f9849=_0x4f8bc6;return _0x4f8bc6[_0x1f24('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1f24('0xa')](function(){var _0x11261c={'uniqueid':_0x870f0e+'.'+_0x1f9849['id']+'.'+_0x1f9849[_0x1f24('0x70')]['id'],'FromUserId':_0xe2ffc3['user']['id'],'type':_0x1f24('0x7e'),'ToUserId':_0xda30b4['id']};_0x11261c[_0x52cbca+_0x1f24('0x81')]=_0x1f9849['id'];_0x11261c[_0x52cbca+_0x1f24('0x73')]=_0x1f9849['Interaction']['id'];_0x11261c[_0x1f24('0x74')+_0x52cbca+_0x27658d+'Id']=_0x1f9849[_0x1f24('0x6d')]['id'];return db[_0x52cbca+_0x1f24('0x76')][_0x1f24('0x82')](_0x11261c);})[_0x1f24('0xa')](function(){return respondWithRpcPromise(_0x1f24('0x77'),{'channel':_0x870f0e,'interaction':_0x1f9849[_0x1f24('0x70')],'message':_0x1f9849,'account':_0x1f9849['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1f24('0x7e'),'appdata':_0xda30b4['name']+','+(_0x1f9849[_0x1f24('0x6d')][_0x1f24('0x83')]||0x12c),'interval':_0x1f24('0x7a')}]},routingClient);})[_0x1f24('0xa')](respondWithResult(_0x36ee35,null))[_0x1f24('0x19')](handleError(_0x36ee35,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index fe8be39..071a3f1 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 _0x9ca3=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x5deea5,_0x230d81){var _0x3d1998=function(_0x39341d){while(--_0x39341d){_0x5deea5['push'](_0x5deea5['shift']());}};_0x3d1998(++_0x230d81);}(_0x9ca3,0xf1));var _0x39ca=function(_0x5c3a40,_0xe7f2a){_0x5c3a40=_0x5c3a40-0x0;var _0x5e11d2=_0x9ca3[_0x5c3a40];return _0x5e11d2;};'use strict';var multer=require(_0x39ca('0x0'));var util=require(_0x39ca('0x1'));var path=require(_0x39ca('0x2'));var timeout=require(_0x39ca('0x3'));var express=require(_0x39ca('0x4'));var router=express[_0x39ca('0x5')]();var fs_extra=require(_0x39ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x39ca('0x7')]('/',auth['isAuthenticated'](),controller[_0x39ca('0x8')]);router[_0x39ca('0x7')](_0x39ca('0x9'),auth[_0x39ca('0xa')](),controller[_0x39ca('0xb')]);router['get']('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x39ca('0xc')]('/',auth['isAuthenticated'](),controller[_0x39ca('0xd')]);router['put'](_0x39ca('0x9'),auth[_0x39ca('0xa')](),controller[_0x39ca('0xe')]);router['delete'](_0x39ca('0x9'),auth[_0x39ca('0xa')](),controller[_0x39ca('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2687=['destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/run','run','post','create','put','update'];(function(_0x326410,_0x45af15){var _0x1784d0=function(_0x5d8b87){while(--_0x5d8b87){_0x326410['push'](_0x326410['shift']());}};_0x1784d0(++_0x45af15);}(_0x2687,0x1aa));var _0x7268=function(_0xf911e5,_0x2909ee){_0xf911e5=_0xf911e5-0x0;var _0x26e8f4=_0x2687[_0xf911e5];return _0x26e8f4;};'use strict';var multer=require('multer');var util=require(_0x7268('0x0'));var path=require(_0x7268('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7268('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7268('0x3'));var interaction=require(_0x7268('0x4'));var config=require(_0x7268('0x5'));var controller=require('./schedule.controller');router[_0x7268('0x6')]('/',auth[_0x7268('0x7')](),controller[_0x7268('0x8')]);router[_0x7268('0x6')](_0x7268('0x9'),auth[_0x7268('0x7')](),controller['show']);router[_0x7268('0x6')](_0x7268('0xa'),auth[_0x7268('0x7')](),controller[_0x7268('0xb')]);router[_0x7268('0xc')]('/',auth[_0x7268('0x7')](),controller[_0x7268('0xd')]);router[_0x7268('0xe')](_0x7268('0x9'),auth[_0x7268('0x7')](),controller[_0x7268('0xf')]);router['delete']('/:id',auth[_0x7268('0x7')](),controller[_0x7268('0x10')]);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 1eec965..dd9e01b 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 _0x06ad=['years','quarters','months','days','hours','minutes','csv','pdf','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2ec3fe,_0x3b7fd8){var _0x380ba8=function(_0x40690f){while(--_0x40690f){_0x2ec3fe['push'](_0x2ec3fe['shift']());}};_0x380ba8(++_0x3b7fd8);}(_0x06ad,0x1bb));var _0xd06a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06ad[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd06a('0x0'));module[_0xd06a('0x1')]={'name':{'type':Sequelize[_0xd06a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd06a('0x2')],'allowNull':![],'defaultValue':_0xd06a('0x3')},'startAt':{'type':Sequelize[_0xd06a('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd06a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd06a('0x6')](_0xd06a('0x7'),_0xd06a('0x8'),_0xd06a('0x9'),'weeks',_0xd06a('0xa'),_0xd06a('0xb'),_0xd06a('0xc')),'allowNull':![],'defaultValue':_0xd06a('0xa')},'output':{'type':Sequelize[_0xd06a('0x6')](_0xd06a('0xd'),_0xd06a('0xe'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xd06a('0xf'),'default'),'allowNull':![],'defaultValue':_0xd06a('0xf')},'sendMail':{'type':Sequelize[_0xd06a('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xd06a('0x2')]},'cc':{'type':Sequelize[_0xd06a('0x11')]},'bcc':{'type':Sequelize[_0xd06a('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xd06a('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x61c7=['hours','minutes','days','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks'];(function(_0x429560,_0x3b19ec){var _0x108800=function(_0x56994b){while(--_0x56994b){_0x429560['push'](_0x429560['shift']());}};_0x108800(++_0x3b19ec);}(_0x61c7,0x1c1));var _0x761c=function(_0x316714,_0x3323d8){_0x316714=_0x316714-0x0;var _0x1461ec=_0x61c7[_0x316714];return _0x1461ec;};'use strict';var Sequelize=require(_0x761c('0x0'));module[_0x761c('0x1')]={'name':{'type':Sequelize[_0x761c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x761c('0x2')]},'active':{'type':Sequelize[_0x761c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x761c('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x761c('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x761c('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x761c('0x7')](_0x761c('0x8'),_0x761c('0x9'),'months',_0x761c('0xa'),'days',_0x761c('0xb'),_0x761c('0xc')),'allowNull':![],'defaultValue':_0x761c('0xd')},'output':{'type':Sequelize[_0x761c('0x7')]('csv',_0x761c('0xe'),_0x761c('0xf')),'allowNull':![],'defaultValue':_0x761c('0x10')},'type':{'type':Sequelize[_0x761c('0x7')](_0x761c('0x11'),_0x761c('0x12')),'allowNull':![],'defaultValue':_0x761c('0x11')},'sendMail':{'type':Sequelize[_0x761c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x761c('0x2')]},'cc':{'type':Sequelize[_0x761c('0x13')]},'bcc':{'type':Sequelize[_0x761c('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x761c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3f697d0..027fdcd 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 _0x6be8=['rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','json','save','update','destroy','get','Scheduler','UserProfileResource','then','error','stack','name','send','index','map','Schedule'];(function(_0x4fbe76,_0x1b7645){var _0x72a29b=function(_0x293702){while(--_0x293702){_0x4fbe76['push'](_0x4fbe76['shift']());}};_0x72a29b(++_0x1b7645);}(_0x6be8,0x1a5));var _0x86be=function(_0x141e5b,_0x44b460){_0x141e5b=_0x141e5b-0x0;var _0x1ce0ee=_0x6be8[_0x141e5b];return _0x1ce0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86be('0x0'));var zipdir=require(_0x86be('0x1'));var jsonpatch=require(_0x86be('0x2'));var rp=require('request-promise');var moment=require(_0x86be('0x3'));var BPromise=require(_0x86be('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86be('0x5'));var sox=require('sox');var csv=require(_0x86be('0x6'));var ejs=require(_0x86be('0x7'));var fs=require('fs');var fs_extra=require(_0x86be('0x8'));var _=require(_0x86be('0x9'));var squel=require(_0x86be('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86be('0xb'));var toCsv=require(_0x86be('0x6'));var querystring=require('querystring');var Papa=require(_0x86be('0xc'));var Redis=require('ioredis');var authService=require(_0x86be('0xd'));var qs=require(_0x86be('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86be('0xf'));var logger=require(_0x86be('0x10'))(_0x86be('0x11'));var utils=require(_0x86be('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x86be('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2df2e0,_0x468741){_0x468741=_0x468741||0xcc;return function(_0x295654){if(_0x295654){return _0x2df2e0['sendStatus'](_0x468741);}return _0x2df2e0[_0x86be('0x14')](_0x468741)[_0x86be('0x15')]();};}function respondWithResult(_0x5355bc,_0x8fbcbf){_0x8fbcbf=_0x8fbcbf||0xc8;return function(_0x294abd){if(_0x294abd){return _0x5355bc[_0x86be('0x14')](_0x8fbcbf)['json'](_0x294abd);}};}function respondWithFilteredResult(_0x2cca19,_0x3b772b){return function(_0x413121){if(_0x413121){var _0x2056d4=typeof _0x3b772b[_0x86be('0x16')]===_0x86be('0x17')&&typeof _0x3b772b[_0x86be('0x18')]===_0x86be('0x17');var _0x1bafc6=_0x413121['count'];var _0x4516f4=_0x2056d4?0x0:_0x3b772b['offset'];var _0x517546=_0x2056d4?_0x413121[_0x86be('0x19')]:_0x3b772b[_0x86be('0x16')]+_0x3b772b[_0x86be('0x18')];var _0x565198;if(_0x517546>=_0x1bafc6){_0x517546=_0x1bafc6;_0x565198=0xc8;}else{_0x565198=0xce;}_0x2cca19[_0x86be('0x14')](_0x565198);return _0x2cca19['set']('Content-Range',_0x4516f4+'-'+_0x517546+'/'+_0x1bafc6)[_0x86be('0x1a')](_0x413121);}return null;};}function patchUpdates(_0x1a8f62){return function(_0x1537c3){try{jsonpatch['apply'](_0x1537c3,_0x1a8f62,!![]);}catch(_0x267f0a){return BPromise['reject'](_0x267f0a);}return _0x1537c3[_0x86be('0x1b')]();};}function saveUpdates(_0x1731ed,_0x13cbaf){return function(_0x596624){if(_0x596624){return _0x596624[_0x86be('0x1c')](_0x1731ed)['then'](function(_0x3b7dd5){return _0x3b7dd5;});}return null;};}function removeEntity(_0x262f73,_0x160ca0){return function(_0x5dfb6a){if(_0x5dfb6a){return _0x5dfb6a[_0x86be('0x1d')]()['then'](function(){var _0x33ca65=_0x5dfb6a[_0x86be('0x1e')]({'plain':!![]});var _0x2983de=_0x86be('0x1f');return db[_0x86be('0x20')][_0x86be('0x1d')]({'where':{'type':_0x2983de,'resourceId':_0x33ca65['id']}})[_0x86be('0x21')](function(){return _0x5dfb6a;});})[_0x86be('0x21')](function(){_0x262f73[_0x86be('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfa8b,_0x365144){return function(_0x338327){if(!_0x338327){_0x2bfa8b['sendStatus'](0x194);}return _0x338327;};}function handleError(_0x27678c,_0x5b1a70){_0x5b1a70=_0x5b1a70||0x1f4;return function(_0x43c9e1){logger[_0x86be('0x22')](_0x43c9e1[_0x86be('0x23')]);if(_0x43c9e1['name']){delete _0x43c9e1[_0x86be('0x24')];}_0x27678c[_0x86be('0x14')](_0x5b1a70)[_0x86be('0x25')](_0x43c9e1);};}exports[_0x86be('0x26')]=function(_0x10b864,_0x5e5107){var _0x234444={},_0xb9d6c5={},_0x1c1ffa={'count':0x0,'rows':[]};var _0x5dd3c6=_[_0x86be('0x27')](db[_0x86be('0x28')][_0x86be('0x29')],function(_0x4057cd){return{'name':_0x4057cd[_0x86be('0x2a')],'type':_0x4057cd['type'][_0x86be('0x2b')]};});_0xb9d6c5[_0x86be('0x2c')]=_[_0x86be('0x27')](_0x5dd3c6,_0x86be('0x24'));_0xb9d6c5[_0x86be('0x2d')]=_[_0x86be('0x2e')](_0x10b864['query']);_0xb9d6c5['filters']=_[_0x86be('0x2f')](_0xb9d6c5['model'],_0xb9d6c5[_0x86be('0x2d')]);_0x234444[_0x86be('0x30')]=_[_0x86be('0x2f')](_0xb9d6c5['model'],qs['fields'](_0x10b864[_0x86be('0x2d')][_0x86be('0x31')]));_0x234444[_0x86be('0x30')]=_0x234444[_0x86be('0x30')][_0x86be('0x32')]?_0x234444['attributes']:_0xb9d6c5['model'];if(!_0x10b864[_0x86be('0x2d')][_0x86be('0x33')](_0x86be('0x34'))){_0x234444[_0x86be('0x18')]=qs[_0x86be('0x18')](_0x10b864[_0x86be('0x2d')][_0x86be('0x18')]);_0x234444[_0x86be('0x16')]=qs[_0x86be('0x16')](_0x10b864['query'][_0x86be('0x16')]);}_0x234444[_0x86be('0x35')]=qs[_0x86be('0x36')](_0x10b864[_0x86be('0x2d')][_0x86be('0x36')]);_0x234444[_0x86be('0x37')]=qs[_0x86be('0x38')](_[_0x86be('0x39')](_0x10b864[_0x86be('0x2d')],_0xb9d6c5[_0x86be('0x38')]),_0x5dd3c6);if(_0x10b864[_0x86be('0x2d')]['filter']){_0x234444[_0x86be('0x37')]=_[_0x86be('0x3a')](_0x234444[_0x86be('0x37')],{'$or':_['map'](_0x5dd3c6,function(_0x5b78dc){if(_0x5b78dc[_0x86be('0x3b')]!==_0x86be('0x3c')){var _0x15808b={};_0x15808b[_0x5b78dc['name']]={'$like':'%'+_0x10b864['query']['filter']+'%'};return _0x15808b;}})});}_0x234444=_[_0x86be('0x3a')]({},_0x234444,_0x10b864[_0x86be('0x3d')]);var _0x107aa0={'where':_0x234444[_0x86be('0x37')]};return db['Schedule'][_0x86be('0x19')](_0x107aa0)[_0x86be('0x21')](function(_0x506341){_0x1c1ffa['count']=_0x506341;if(_0x10b864[_0x86be('0x2d')][_0x86be('0x3e')]){_0x234444[_0x86be('0x3f')]=[{'all':!![]}];}return db[_0x86be('0x28')]['findAll'](_0x234444);})[_0x86be('0x21')](function(_0x5ee7de){_0x1c1ffa[_0x86be('0x40')]=_0x5ee7de;return _0x1c1ffa;})[_0x86be('0x21')](respondWithFilteredResult(_0x5e5107,_0x234444))[_0x86be('0x41')](handleError(_0x5e5107,null));};exports['show']=function(_0xf0379,_0x3cb8ce){var _0x1bda87={'raw':![],'where':{'id':_0xf0379[_0x86be('0x42')]['id']}},_0x5c27b8={};_0x5c27b8[_0x86be('0x2c')]=_[_0x86be('0x2e')](db[_0x86be('0x28')][_0x86be('0x29')]);_0x5c27b8[_0x86be('0x2d')]=_[_0x86be('0x2e')](_0xf0379[_0x86be('0x2d')]);_0x5c27b8[_0x86be('0x38')]=_[_0x86be('0x2f')](_0x5c27b8[_0x86be('0x2c')],_0x5c27b8[_0x86be('0x2d')]);_0x1bda87[_0x86be('0x30')]=_[_0x86be('0x2f')](_0x5c27b8['model'],qs[_0x86be('0x31')](_0xf0379['query'][_0x86be('0x31')]));_0x1bda87[_0x86be('0x30')]=_0x1bda87['attributes']['length']?_0x1bda87[_0x86be('0x30')]:_0x5c27b8[_0x86be('0x2c')];if(_0xf0379['query'][_0x86be('0x3e')]){_0x1bda87['include']=[{'all':!![]}];}_0x1bda87=_['merge']({},_0x1bda87,_0xf0379[_0x86be('0x3d')]);return db[_0x86be('0x28')][_0x86be('0x43')](_0x1bda87)['then'](handleEntityNotFound(_0x3cb8ce,null))['then'](respondWithResult(_0x3cb8ce,null))[_0x86be('0x41')](handleError(_0x3cb8ce,null));};exports['create']=function(_0x406bd1,_0x8148d7){return db[_0x86be('0x28')][_0x86be('0x44')](_0x406bd1['body'],{})[_0x86be('0x21')](function(_0x67ccce){var _0x2f68de=_0x406bd1[_0x86be('0x45')][_0x86be('0x1e')]({'plain':!![]});if(!_0x2f68de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f68de[_0x86be('0x46')]===_0x86be('0x45')){var _0xd51343=_0x67ccce[_0x86be('0x1e')]({'plain':!![]});var _0x30bef1=_0x86be('0x1f');return db[_0x86be('0x47')][_0x86be('0x43')]({'where':{'name':_0x30bef1,'userProfileId':_0x2f68de[_0x86be('0x48')]},'raw':!![]})['then'](function(_0x4ba84c){if(_0x4ba84c&&_0x4ba84c['autoAssociation']===0x0){return db[_0x86be('0x20')]['create']({'name':_0xd51343[_0x86be('0x24')],'resourceId':_0xd51343['id'],'type':_0x4ba84c[_0x86be('0x24')],'sectionId':_0x4ba84c['id']},{})['then'](function(){return _0x67ccce;});}else{return _0x67ccce;}})[_0x86be('0x41')](function(_0xb77117){logger[_0x86be('0x22')](_0x86be('0x49'),_0xb77117);throw _0xb77117;});}return _0x67ccce;})[_0x86be('0x21')](respondWithResult(_0x8148d7,0xc9))[_0x86be('0x41')](handleError(_0x8148d7,null));};exports[_0x86be('0x1c')]=function(_0x2b70c3,_0x3ad915){if(_0x2b70c3['body']['id']){delete _0x2b70c3['body']['id'];}return db[_0x86be('0x28')][_0x86be('0x43')]({'where':{'id':_0x2b70c3[_0x86be('0x42')]['id']}})[_0x86be('0x21')](handleEntityNotFound(_0x3ad915,null))[_0x86be('0x21')](saveUpdates(_0x2b70c3[_0x86be('0x4a')],null))['then'](respondWithResult(_0x3ad915,null))[_0x86be('0x41')](handleError(_0x3ad915,null));};exports[_0x86be('0x1d')]=function(_0x1b0538,_0x46574c){return db[_0x86be('0x28')][_0x86be('0x43')]({'where':{'id':_0x1b0538[_0x86be('0x42')]['id']}})[_0x86be('0x21')](handleEntityNotFound(_0x46574c,null))['then'](removeEntity(_0x46574c,null))[_0x86be('0x41')](handleError(_0x46574c,null));};exports[_0x86be('0x4b')]=function(_0x53aa82,_0x1ac074,_0x105973){var _0x4cb8ff=require(_0x86be('0x4c'));return db[_0x86be('0x28')][_0x86be('0x43')]({'where':{'id':_0x53aa82['params']['id']},'raw':!![]})[_0x86be('0x21')](handleEntityNotFound(_0x1ac074,null))[_0x86be('0x21')](function(){_0x4cb8ff[_0x86be('0x4b')](_0x53aa82['params']['id']);})['then'](respondWithStatusCode(_0x1ac074,null))[_0x86be('0x41')](handleError(_0x1ac074,null));}; \ No newline at end of file +var _0x89d9=['rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','include','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','params','../../config/schedule','run','rimraf','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','Schedule'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x89d9,0x1cf));var _0x989d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x89d9[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x989d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x989d('0x1'));var rp=require(_0x989d('0x2'));var moment=require('moment');var BPromise=require(_0x989d('0x3'));var Mustache=require('mustache');var util=require(_0x989d('0x4'));var path=require(_0x989d('0x5'));var sox=require(_0x989d('0x6'));var csv=require(_0x989d('0x7'));var ejs=require(_0x989d('0x8'));var fs=require('fs');var fs_extra=require(_0x989d('0x9'));var _=require(_0x989d('0xa'));var squel=require(_0x989d('0xb'));var crypto=require(_0x989d('0xc'));var jsforce=require(_0x989d('0xd'));var deskjs=require(_0x989d('0xe'));var toCsv=require(_0x989d('0x7'));var querystring=require(_0x989d('0xf'));var Papa=require(_0x989d('0x10'));var Redis=require(_0x989d('0x11'));var authService=require(_0x989d('0x12'));var qs=require(_0x989d('0x13'));var as=require(_0x989d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x989d('0x15'))(_0x989d('0x16'));var utils=require(_0x989d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x989d('0x18'));var db=require(_0x989d('0x19'))['db'];function respondWithStatusCode(_0x5ad532,_0x2af669){_0x2af669=_0x2af669||0xcc;return function(_0x191c09){if(_0x191c09){return _0x5ad532['sendStatus'](_0x2af669);}return _0x5ad532[_0x989d('0x1a')](_0x2af669)[_0x989d('0x1b')]();};}function respondWithResult(_0x562e26,_0x4634f6){_0x4634f6=_0x4634f6||0xc8;return function(_0x3d17cc){if(_0x3d17cc){return _0x562e26['status'](_0x4634f6)[_0x989d('0x1c')](_0x3d17cc);}};}function respondWithFilteredResult(_0x3a1b65,_0x129883){return function(_0x253048){if(_0x253048){var _0x367f4f=typeof _0x129883[_0x989d('0x1d')]===_0x989d('0x1e')&&typeof _0x129883[_0x989d('0x1f')]==='undefined';var _0x4391b7=_0x253048[_0x989d('0x20')];var _0x59652f=_0x367f4f?0x0:_0x129883[_0x989d('0x1d')];var _0x1b6c56=_0x367f4f?_0x253048[_0x989d('0x20')]:_0x129883[_0x989d('0x1d')]+_0x129883[_0x989d('0x1f')];var _0x4f94e4;if(_0x1b6c56>=_0x4391b7){_0x1b6c56=_0x4391b7;_0x4f94e4=0xc8;}else{_0x4f94e4=0xce;}_0x3a1b65[_0x989d('0x1a')](_0x4f94e4);return _0x3a1b65[_0x989d('0x21')](_0x989d('0x22'),_0x59652f+'-'+_0x1b6c56+'/'+_0x4391b7)[_0x989d('0x1c')](_0x253048);}return null;};}function patchUpdates(_0x2f20af){return function(_0x55098d){try{jsonpatch[_0x989d('0x23')](_0x55098d,_0x2f20af,!![]);}catch(_0x2c617c){return BPromise[_0x989d('0x24')](_0x2c617c);}return _0x55098d['save']();};}function saveUpdates(_0xc2dde3,_0x396546){return function(_0x479f49){if(_0x479f49){return _0x479f49[_0x989d('0x25')](_0xc2dde3)[_0x989d('0x26')](function(_0x1aa2d6){return _0x1aa2d6;});}return null;};}function removeEntity(_0x213750,_0x569507){return function(_0x250dbd){if(_0x250dbd){return _0x250dbd[_0x989d('0x27')]()[_0x989d('0x26')](function(){var _0x4739c0=_0x250dbd[_0x989d('0x28')]({'plain':!![]});var _0x33622c=_0x989d('0x29');return db[_0x989d('0x2a')][_0x989d('0x27')]({'where':{'type':_0x33622c,'resourceId':_0x4739c0['id']}})[_0x989d('0x26')](function(){return _0x250dbd;});})[_0x989d('0x26')](function(){_0x213750[_0x989d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7e02,_0x312853){return function(_0x156886){if(!_0x156886){_0x4a7e02['sendStatus'](0x194);}return _0x156886;};}function handleError(_0x732821,_0x4ed61a){_0x4ed61a=_0x4ed61a||0x1f4;return function(_0x342aa7){logger[_0x989d('0x2b')](_0x342aa7[_0x989d('0x2c')]);if(_0x342aa7['name']){delete _0x342aa7[_0x989d('0x2d')];}_0x732821[_0x989d('0x1a')](_0x4ed61a)['send'](_0x342aa7);};}exports['index']=function(_0xf9de3f,_0x4feef3){var _0x1c5fab={},_0x46e204={},_0x403610={'count':0x0,'rows':[]};var _0x3457dd=_['map'](db[_0x989d('0x2e')][_0x989d('0x2f')],function(_0x1d96ff){return{'name':_0x1d96ff[_0x989d('0x30')],'type':_0x1d96ff[_0x989d('0x31')][_0x989d('0x32')]};});_0x46e204[_0x989d('0x33')]=_[_0x989d('0x34')](_0x3457dd,_0x989d('0x2d'));_0x46e204['query']=_[_0x989d('0x35')](_0xf9de3f[_0x989d('0x36')]);_0x46e204[_0x989d('0x37')]=_[_0x989d('0x38')](_0x46e204[_0x989d('0x33')],_0x46e204[_0x989d('0x36')]);_0x1c5fab['attributes']=_[_0x989d('0x38')](_0x46e204[_0x989d('0x33')],qs[_0x989d('0x39')](_0xf9de3f[_0x989d('0x36')][_0x989d('0x39')]));_0x1c5fab['attributes']=_0x1c5fab[_0x989d('0x3a')][_0x989d('0x3b')]?_0x1c5fab['attributes']:_0x46e204['model'];if(!_0xf9de3f[_0x989d('0x36')]['hasOwnProperty'](_0x989d('0x3c'))){_0x1c5fab['limit']=qs[_0x989d('0x1f')](_0xf9de3f[_0x989d('0x36')][_0x989d('0x1f')]);_0x1c5fab[_0x989d('0x1d')]=qs[_0x989d('0x1d')](_0xf9de3f[_0x989d('0x36')]['offset']);}_0x1c5fab[_0x989d('0x3d')]=qs['sort'](_0xf9de3f[_0x989d('0x36')][_0x989d('0x3e')]);_0x1c5fab[_0x989d('0x3f')]=qs[_0x989d('0x37')](_[_0x989d('0x40')](_0xf9de3f['query'],_0x46e204[_0x989d('0x37')]),_0x3457dd);if(_0xf9de3f[_0x989d('0x36')][_0x989d('0x41')]){_0x1c5fab[_0x989d('0x3f')]=_[_0x989d('0x42')](_0x1c5fab['where'],{'$or':_[_0x989d('0x34')](_0x3457dd,function(_0x8c718a){if(_0x8c718a[_0x989d('0x31')]!=='VIRTUAL'){var _0x148397={};_0x148397[_0x8c718a['name']]={'$like':'%'+_0xf9de3f['query'][_0x989d('0x41')]+'%'};return _0x148397;}})});}_0x1c5fab=_[_0x989d('0x42')]({},_0x1c5fab,_0xf9de3f['options']);var _0x4ef1c1={'where':_0x1c5fab[_0x989d('0x3f')]};return db[_0x989d('0x2e')][_0x989d('0x20')](_0x4ef1c1)[_0x989d('0x26')](function(_0x3855ce){_0x403610['count']=_0x3855ce;if(_0xf9de3f[_0x989d('0x36')][_0x989d('0x43')]){_0x1c5fab['include']=[{'all':!![]}];}return db[_0x989d('0x2e')][_0x989d('0x44')](_0x1c5fab);})[_0x989d('0x26')](function(_0x478064){_0x403610[_0x989d('0x45')]=_0x478064;return _0x403610;})['then'](respondWithFilteredResult(_0x4feef3,_0x1c5fab))[_0x989d('0x46')](handleError(_0x4feef3,null));};exports[_0x989d('0x47')]=function(_0xb9fde7,_0x2aa81d){var _0x5462ae={'raw':![],'where':{'id':_0xb9fde7['params']['id']}},_0x188ea2={};_0x188ea2[_0x989d('0x33')]=_[_0x989d('0x35')](db['Schedule'][_0x989d('0x2f')]);_0x188ea2['query']=_['keys'](_0xb9fde7[_0x989d('0x36')]);_0x188ea2[_0x989d('0x37')]=_[_0x989d('0x38')](_0x188ea2[_0x989d('0x33')],_0x188ea2['query']);_0x5462ae['attributes']=_[_0x989d('0x38')](_0x188ea2[_0x989d('0x33')],qs[_0x989d('0x39')](_0xb9fde7[_0x989d('0x36')][_0x989d('0x39')]));_0x5462ae[_0x989d('0x3a')]=_0x5462ae['attributes'][_0x989d('0x3b')]?_0x5462ae[_0x989d('0x3a')]:_0x188ea2[_0x989d('0x33')];if(_0xb9fde7['query'][_0x989d('0x43')]){_0x5462ae[_0x989d('0x48')]=[{'all':!![]}];}_0x5462ae=_[_0x989d('0x42')]({},_0x5462ae,_0xb9fde7[_0x989d('0x49')]);return db['Schedule'][_0x989d('0x4a')](_0x5462ae)[_0x989d('0x26')](handleEntityNotFound(_0x2aa81d,null))[_0x989d('0x26')](respondWithResult(_0x2aa81d,null))[_0x989d('0x46')](handleError(_0x2aa81d,null));};exports['create']=function(_0x2c6a5b,_0x5976df){return db['Schedule']['create'](_0x2c6a5b[_0x989d('0x4b')],{})[_0x989d('0x26')](function(_0x563422){var _0x262e44=_0x2c6a5b[_0x989d('0x4c')][_0x989d('0x28')]({'plain':!![]});if(!_0x262e44)throw new Error(_0x989d('0x4d'));if(_0x262e44[_0x989d('0x4e')]===_0x989d('0x4c')){var _0xe818d8=_0x563422[_0x989d('0x28')]({'plain':!![]});var _0x4d34ad=_0x989d('0x29');return db['UserProfileSection'][_0x989d('0x4a')]({'where':{'name':_0x4d34ad,'userProfileId':_0x262e44[_0x989d('0x4f')]},'raw':!![]})['then'](function(_0x2eaf0e){if(_0x2eaf0e&&_0x2eaf0e[_0x989d('0x50')]===0x0){return db[_0x989d('0x2a')][_0x989d('0x51')]({'name':_0xe818d8[_0x989d('0x2d')],'resourceId':_0xe818d8['id'],'type':_0x2eaf0e[_0x989d('0x2d')],'sectionId':_0x2eaf0e['id']},{})[_0x989d('0x26')](function(){return _0x563422;});}else{return _0x563422;}})[_0x989d('0x46')](function(_0x441be4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x441be4);throw _0x441be4;});}return _0x563422;})[_0x989d('0x26')](respondWithResult(_0x5976df,0xc9))[_0x989d('0x46')](handleError(_0x5976df,null));};exports['update']=function(_0x68e8d4,_0x5a4227){if(_0x68e8d4[_0x989d('0x4b')]['id']){delete _0x68e8d4[_0x989d('0x4b')]['id'];}return db[_0x989d('0x2e')][_0x989d('0x4a')]({'where':{'id':_0x68e8d4['params']['id']}})[_0x989d('0x26')](handleEntityNotFound(_0x5a4227,null))[_0x989d('0x26')](saveUpdates(_0x68e8d4[_0x989d('0x4b')],null))[_0x989d('0x26')](respondWithResult(_0x5a4227,null))['catch'](handleError(_0x5a4227,null));};exports['destroy']=function(_0x4ba2e0,_0x8529f0){return db[_0x989d('0x2e')][_0x989d('0x4a')]({'where':{'id':_0x4ba2e0[_0x989d('0x52')]['id']}})[_0x989d('0x26')](handleEntityNotFound(_0x8529f0,null))[_0x989d('0x26')](removeEntity(_0x8529f0,null))[_0x989d('0x46')](handleError(_0x8529f0,null));};exports['run']=function(_0x2a52c3,_0x3c7341,_0x2761e6){var _0x3d8013=require(_0x989d('0x53'));return db['Schedule'][_0x989d('0x4a')]({'where':{'id':_0x2a52c3['params']['id']},'raw':!![]})[_0x989d('0x26')](handleEntityNotFound(_0x3c7341,null))[_0x989d('0x26')](function(){_0x3d8013[_0x989d('0x54')](_0x2a52c3[_0x989d('0x52')]['id']);})[_0x989d('0x26')](respondWithStatusCode(_0x3c7341,null))[_0x989d('0x46')](handleError(_0x3c7341,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8be5820..5c755f3 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 _0xe04e=['../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4d02ab,_0x59b910){var _0x373bb3=function(_0x37d240){while(--_0x37d240){_0x4d02ab['push'](_0x4d02ab['shift']());}};_0x373bb3(++_0x59b910);}(_0xe04e,0xa1));var _0xee04=function(_0x2dc780,_0x49f34d){_0x2dc780=_0x2dc780-0x0;var _0x562171=_0xe04e[_0x2dc780];return _0x562171;};'use strict';var _=require(_0xee04('0x0'));var util=require(_0xee04('0x1'));var logger=require(_0xee04('0x2'))(_0xee04('0x3'));var moment=require('moment');var BPromise=require(_0xee04('0x4'));var rp=require(_0xee04('0x5'));var fs=require('fs');var path=require(_0xee04('0x6'));var rimraf=require(_0xee04('0x7'));var config=require(_0xee04('0x8'));var attributes=require(_0xee04('0x9'));module[_0xee04('0xa')]=function(_0xd1f7fd,_0x2ffe5c){return _0xd1f7fd['define'](_0xee04('0xb'),attributes,{'tableName':_0xee04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97d5=['moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97d5,0xdb));var _0x597d=function(_0x3a9188,_0x39ad38){_0x3a9188=_0x3a9188-0x0;var _0x5c2937=_0x97d5[_0x3a9188];return _0x5c2937;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x597d('0x0'))('api');var moment=require(_0x597d('0x1'));var BPromise=require(_0x597d('0x2'));var rp=require(_0x597d('0x3'));var fs=require('fs');var path=require(_0x597d('0x4'));var rimraf=require(_0x597d('0x5'));var config=require('../../config/environment');var attributes=require(_0x597d('0x6'));module[_0x597d('0x7')]=function(_0x1e8653,_0xe8a90){return _0x1e8653[_0x597d('0x8')](_0x597d('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 05d4b58..2010f02 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 _0xbf19=['request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0xbf19,0x16d));var _0x9bf1=function(_0x48b0ff,_0x56819a){_0x48b0ff=_0x48b0ff-0x0;var _0x4b0e82=_0xbf19[_0x48b0ff];return _0x4b0e82;};'use strict';var _=require(_0x9bf1('0x0'));var util=require(_0x9bf1('0x1'));var moment=require('moment');var BPromise=require(_0x9bf1('0x2'));var rs=require(_0x9bf1('0x3'));var fs=require('fs');var Redis=require(_0x9bf1('0x4'));var db=require(_0x9bf1('0x5'))['db'];var utils=require(_0x9bf1('0x6'));var logger=require(_0x9bf1('0x7'))(_0x9bf1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bf1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f1c68,_0x3baf40,_0x5ad61e){return new BPromise(function(_0x2580ab,_0xf4f1ed){return client[_0x9bf1('0xa')](_0x1f1c68,_0x5ad61e)['then'](function(_0x350889){logger[_0x9bf1('0xb')](_0x9bf1('0xc'),_0x3baf40,'request\x20sent');logger[_0x9bf1('0xd')](_0x9bf1('0xe'),_0x3baf40,_0x9bf1('0xf'),JSON['stringify'](_0x350889));if(_0x350889['error']){if(_0x350889[_0x9bf1('0x10')][_0x9bf1('0x11')]===0x1f4){logger[_0x9bf1('0x10')](_0x9bf1('0xc'),_0x3baf40,_0x350889['error'][_0x9bf1('0x12')]);return _0xf4f1ed(_0x350889[_0x9bf1('0x10')][_0x9bf1('0x12')]);}logger[_0x9bf1('0x10')](_0x9bf1('0xc'),_0x3baf40,_0x350889[_0x9bf1('0x10')][_0x9bf1('0x12')]);return _0x2580ab(_0x350889[_0x9bf1('0x10')][_0x9bf1('0x12')]);}else{logger[_0x9bf1('0xb')]('Schedule,\x20%s,\x20%s',_0x3baf40,'request\x20sent');_0x2580ab(_0x350889[_0x9bf1('0x13')][_0x9bf1('0x12')]);}})['catch'](function(_0x4ea8bd){logger['error']('Schedule,\x20%s,\x20%s',_0x3baf40,_0x4ea8bd);_0xf4f1ed(_0x4ea8bd);});});} \ No newline at end of file +var _0x91ee=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x386cef,_0x112e10){var _0x2f866f=function(_0xcc8a40){while(--_0xcc8a40){_0x386cef['push'](_0x386cef['shift']());}};_0x2f866f(++_0x112e10);}(_0x91ee,0xa8));var _0xe91e=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x91ee[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xe91e('0x0'));var util=require(_0xe91e('0x1'));var moment=require(_0xe91e('0x2'));var BPromise=require(_0xe91e('0x3'));var rs=require(_0xe91e('0x4'));var fs=require('fs');var Redis=require(_0xe91e('0x5'));var db=require(_0xe91e('0x6'))['db'];var utils=require(_0xe91e('0x7'));var logger=require(_0xe91e('0x8'))(_0xe91e('0x9'));var config=require(_0xe91e('0xa'));var jayson=require(_0xe91e('0xb'));var client=jayson[_0xe91e('0xc')][_0xe91e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1425b4,_0x57c28f,_0x13abdc){return new BPromise(function(_0x2f4378,_0x3ca409){return client[_0xe91e('0xe')](_0x1425b4,_0x13abdc)[_0xe91e('0xf')](function(_0x311296){logger[_0xe91e('0x10')](_0xe91e('0x11'),_0x57c28f,_0xe91e('0x12'));logger[_0xe91e('0x13')](_0xe91e('0x14'),_0x57c28f,'request\x20sent',JSON[_0xe91e('0x15')](_0x311296));if(_0x311296[_0xe91e('0x16')]){if(_0x311296[_0xe91e('0x16')][_0xe91e('0x17')]===0x1f4){logger[_0xe91e('0x16')](_0xe91e('0x11'),_0x57c28f,_0x311296[_0xe91e('0x16')][_0xe91e('0x18')]);return _0x3ca409(_0x311296['error']['message']);}logger['error'](_0xe91e('0x11'),_0x57c28f,_0x311296[_0xe91e('0x16')][_0xe91e('0x18')]);return _0x2f4378(_0x311296[_0xe91e('0x16')][_0xe91e('0x18')]);}else{logger[_0xe91e('0x10')](_0xe91e('0x11'),_0x57c28f,_0xe91e('0x12'));_0x2f4378(_0x311296['result'][_0xe91e('0x18')]);}})['catch'](function(_0xd742a1){logger[_0xe91e('0x16')](_0xe91e('0x11'),_0x57c28f,_0xd742a1);_0x3ca409(_0xd742a1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fac9316..8aed385 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 _0xe15a=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./screenRecording.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe15a,0x12c));var _0xae15=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0xe15a[_0x183b97];return _0x629cf7;};'use strict';var multer=require(_0xae15('0x0'));var util=require(_0xae15('0x1'));var path=require('path');var timeout=require(_0xae15('0x2'));var express=require(_0xae15('0x3'));var router=express[_0xae15('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae15('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae15('0x6'));router['get']('/',auth[_0xae15('0x7')](),controller['index']);router[_0xae15('0x8')](_0xae15('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xae15('0xa'),auth['isAuthenticated'](),controller[_0xae15('0xb')]);router['get'](_0xae15('0xc'),auth[_0xae15('0x7')](),controller[_0xae15('0xd')]);router[_0xae15('0xe')]('/',auth[_0xae15('0x7')](),controller[_0xae15('0xf')]);router[_0xae15('0x10')](_0xae15('0xa'),auth['isAuthenticated'](),controller[_0xae15('0x11')]);router[_0xae15('0x12')](_0xae15('0xa'),auth[_0xae15('0x7')](),controller[_0xae15('0x13')]);module[_0xae15('0x14')]=router; \ No newline at end of file +var _0x351e=['index','get','/describe','/:id','show','/:id/download','download','post','create','put','delete','exports','multer','path','express','../../components/auth/service','../../config/environment','./screenRecording.controller','isAuthenticated'];(function(_0xf0ff12,_0x1bd5c9){var _0x50ac23=function(_0x3513f3){while(--_0x3513f3){_0xf0ff12['push'](_0xf0ff12['shift']());}};_0x50ac23(++_0x1bd5c9);}(_0x351e,0x1c1));var _0xe351=function(_0x28d6e1,_0x3bd067){_0x28d6e1=_0x28d6e1-0x0;var _0x529cf3=_0x351e[_0x28d6e1];return _0x529cf3;};'use strict';var multer=require(_0xe351('0x0'));var util=require('util');var path=require(_0xe351('0x1'));var timeout=require('connect-timeout');var express=require(_0xe351('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe351('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe351('0x4'));var controller=require(_0xe351('0x5'));router['get']('/',auth[_0xe351('0x6')](),controller[_0xe351('0x7')]);router[_0xe351('0x8')](_0xe351('0x9'),auth[_0xe351('0x6')](),controller['describe']);router[_0xe351('0x8')](_0xe351('0xa'),auth[_0xe351('0x6')](),controller[_0xe351('0xb')]);router[_0xe351('0x8')](_0xe351('0xc'),auth[_0xe351('0x6')](),controller[_0xe351('0xd')]);router[_0xe351('0xe')]('/',auth[_0xe351('0x6')](),controller[_0xe351('0xf')]);router[_0xe351('0x10')](_0xe351('0xa'),auth[_0xe351('0x6')](),controller['update']);router[_0xe351('0x11')](_0xe351('0xa'),auth[_0xe351('0x6')](),controller['destroy']);module[_0xe351('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c23de76..4f68cef 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 _0xdb7e=['startedAt','subtract','closedAt','duration','DATE','toString','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER'];(function(_0xebadef,_0x3c67e5){var _0x3f6015=function(_0x3044e5){while(--_0x3044e5){_0xebadef['push'](_0xebadef['shift']());}};_0x3f6015(++_0x3c67e5);}(_0xdb7e,0x11a));var _0xedb7=function(_0x5d7901,_0x336344){_0x5d7901=_0x5d7901-0x0;var _0x2a6afa=_0xdb7e[_0x5d7901];return _0x2a6afa;};'use strict';var Sequelize=require(_0xedb7('0x0'));var moment=require(_0xedb7('0x1'));var path=require(_0xedb7('0x2'));var config=require('../../config/environment');module[_0xedb7('0x3')]={'format':{'type':Sequelize[_0xedb7('0x4')],'get':function(){return this[_0xedb7('0x5')]('value')?path[_0xedb7('0x6')](this[_0xedb7('0x5')](_0xedb7('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xedb7('0x8')]},'channel':{'type':Sequelize[_0xedb7('0x8')]},'value':{'type':Sequelize[_0xedb7('0x8')],'set':function(_0x87bf4b){var _0x20a7c7=_0x87bf4b[_0xedb7('0x9')](/\\/g,'/');this[_0xedb7('0xa')]('value',_0x20a7c7);}},'rating':{'type':Sequelize[_0xedb7('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xedb7('0xb')],'set':function(_0x12c7ba){this[_0xedb7('0xa')](_0xedb7('0xc'),moment()[_0xedb7('0xd')](_0x12c7ba,'ms'));this[_0xedb7('0xa')](_0xedb7('0xe'),moment());this[_0xedb7('0xa')](_0xedb7('0xf'),_0x12c7ba);}},'startedAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this[_0xedb7('0x5')](_0xedb7('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xedb7('0x11')]();}},'closedAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this[_0xedb7('0x5')](_0xedb7('0xe')))[_0xedb7('0x12')](_0xedb7('0x13'))[_0xedb7('0x11')]();}},'createdAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this[_0xedb7('0x5')]('createdAt'))['format'](_0xedb7('0x13'))[_0xedb7('0x11')]();}},'updatedAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this['getDataValue'](_0xedb7('0x14')))[_0xedb7('0x12')](_0xedb7('0x13'))[_0xedb7('0x11')]();}}}; \ No newline at end of file +var _0x57b7=['VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','DATE','format','MM-DD-YYYY\x20HH:mm','closedAt','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x57b7,0x160));var _0x757b=function(_0x5aece0,_0x3af143){_0x5aece0=_0x5aece0-0x0;var _0x36f309=_0x57b7[_0x5aece0];return _0x36f309;};'use strict';var Sequelize=require(_0x757b('0x0'));var moment=require(_0x757b('0x1'));var path=require(_0x757b('0x2'));var config=require(_0x757b('0x3'));module[_0x757b('0x4')]={'format':{'type':Sequelize[_0x757b('0x5')],'get':function(){return this[_0x757b('0x6')]('value')?path[_0x757b('0x7')](this[_0x757b('0x6')](_0x757b('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x757b('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x757b('0x9')],'set':function(_0x8528c7){var _0x36c83c=_0x8528c7[_0x757b('0xa')](/\\/g,'/');this[_0x757b('0xb')](_0x757b('0x8'),_0x36c83c);}},'rating':{'type':Sequelize[_0x757b('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x757b('0xc')],'set':function(_0x53a1ce){this[_0x757b('0xb')](_0x757b('0xd'),moment()['subtract'](_0x53a1ce,'ms'));this[_0x757b('0xb')]('closedAt',moment());this[_0x757b('0xb')]('duration',_0x53a1ce);}},'startedAt':{'type':Sequelize[_0x757b('0xe')],'get':function(){return moment(this[_0x757b('0x6')]('startedAt'))[_0x757b('0xf')](_0x757b('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x757b('0xe')],'get':function(){return moment(this['getDataValue'](_0x757b('0x11')))[_0x757b('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x757b('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x757b('0x6')](_0x757b('0x13')))[_0x757b('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x757b('0x12')]();}},'updatedAt':{'type':Sequelize[_0x757b('0xe')],'get':function(){return moment(this['getDataValue'](_0x757b('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0x757b('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9b8330d..f627d68 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 _0xa630=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','createdAt','value','describe','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','ScreenRecording\x20not\x20found','filename','extname','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa630,0xbe));var _0x0a63=function(_0x28958d,_0xfa5f9f){_0x28958d=_0x28958d-0x0;var _0x439c72=_0xa630[_0x28958d];return _0x439c72;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['index']=function(_0x34239b,_0xcf409){var _0x1b7bdb={},_0x145090={},_0x32a52b={'count':0x0,'rows':[]};var _0x4577b6=_[_0x0a63('0x2a')](db[_0x0a63('0x2b')]['rawAttributes'],function(_0x58cc71){return{'name':_0x58cc71['fieldName'],'type':_0x58cc71[_0x0a63('0x2c')][_0x0a63('0x2d')]};});_0x145090[_0x0a63('0x2e')]=_[_0x0a63('0x2f')](_[_0x0a63('0x2a')](_0x4577b6,'name'),[_0x0a63('0x30')]);_0x145090[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x34239b[_0x0a63('0x31')]);_0x145090['filters']=_[_0x0a63('0x33')](_0x145090[_0x0a63('0x2e')],_0x145090['query']);_0x1b7bdb['attributes']=_[_0x0a63('0x33')](_0x145090['model'],qs['fields'](_0x34239b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x1b7bdb['attributes']=_0x1b7bdb[_0x0a63('0x35')][_0x0a63('0x36')]?_0x1b7bdb[_0x0a63('0x35')]:_0x145090[_0x0a63('0x2e')];if(!_0x34239b[_0x0a63('0x31')]['hasOwnProperty']('nolimit')){_0x1b7bdb[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x34239b[_0x0a63('0x31')][_0x0a63('0x1c')]);_0x1b7bdb[_0x0a63('0x1b')]=qs[_0x0a63('0x1b')](_0x34239b['query'][_0x0a63('0x1b')]);}_0x1b7bdb[_0x0a63('0x37')]=qs['sort'](_0x34239b[_0x0a63('0x31')]['sort']);_0x1b7bdb['where']=qs[_0x0a63('0x38')](_[_0x0a63('0x39')](_0x34239b[_0x0a63('0x31')],_0x145090['filters']),_0x4577b6);if(_0x34239b[_0x0a63('0x31')][_0x0a63('0x3a')]){_0x1b7bdb[_0x0a63('0x3b')]=_[_0x0a63('0x3c')](_0x1b7bdb[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x2a')](_0x4577b6,function(_0x604a45){if(_0x604a45['type']!==_0x0a63('0x3d')){var _0x1c7e67={};_0x1c7e67[_0x604a45[_0x0a63('0x28')]]={'$like':'%'+_0x34239b['query']['filter']+'%'};return _0x1c7e67;}})});}_0x1b7bdb=_[_0x0a63('0x3c')]({},_0x1b7bdb,_0x34239b['options']);var _0x1a01f4={'where':_0x1b7bdb[_0x0a63('0x3b')]};return db[_0x0a63('0x2b')]['count'](_0x1a01f4)[_0x0a63('0x24')](function(_0x14c737){_0x32a52b[_0x0a63('0x1e')]=_0x14c737;if(_0x34239b[_0x0a63('0x31')]['includeAll']){_0x1b7bdb[_0x0a63('0x3e')]=[{'all':!![]}];}return db[_0x0a63('0x2b')][_0x0a63('0x3f')](_0x1b7bdb);})[_0x0a63('0x24')](function(_0xf18ace){_0x32a52b[_0x0a63('0x40')]=_0xf18ace;return _0x32a52b;})['then'](respondWithFilteredResult(_0xcf409,_0x1b7bdb))[_0x0a63('0x41')](handleError(_0xcf409,null));};exports[_0x0a63('0x42')]=function(_0x347a0b,_0x793502){var _0x20fa0d={'raw':![],'where':{'id':_0x347a0b[_0x0a63('0x43')]['id']}},_0x2482ca={};_0x2482ca[_0x0a63('0x2e')]=_[_0x0a63('0x32')](db[_0x0a63('0x2b')][_0x0a63('0x44')]);_0x2482ca[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x347a0b[_0x0a63('0x31')]);_0x2482ca[_0x0a63('0x38')]=_[_0x0a63('0x33')](_0x2482ca[_0x0a63('0x2e')],_0x2482ca[_0x0a63('0x31')]);_0x20fa0d['attributes']=_[_0x0a63('0x33')](_0x2482ca['model'],qs['fields'](_0x347a0b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x20fa0d[_0x0a63('0x35')]=_0x20fa0d[_0x0a63('0x35')][_0x0a63('0x36')]?_0x20fa0d[_0x0a63('0x35')]:_0x2482ca[_0x0a63('0x2e')];if(_0x347a0b[_0x0a63('0x31')][_0x0a63('0x45')]){_0x20fa0d[_0x0a63('0x3e')]=[{'all':!![]}];}_0x20fa0d=_[_0x0a63('0x3c')]({},_0x20fa0d,_0x347a0b[_0x0a63('0x46')]);return db[_0x0a63('0x2b')][_0x0a63('0x47')](_0x20fa0d)[_0x0a63('0x24')](handleEntityNotFound(_0x793502,null))[_0x0a63('0x24')](respondWithResult(_0x793502,null))[_0x0a63('0x41')](handleError(_0x793502,null));};exports[_0x0a63('0x48')]=function(_0x366887,_0x148e0a){return db['ScreenRecording'][_0x0a63('0x48')](_0x366887[_0x0a63('0x49')],{})['then'](respondWithResult(_0x148e0a,0xc9))['catch'](handleError(_0x148e0a,null));};exports['update']=function(_0x485f20,_0x36d066){if(_0x485f20[_0x0a63('0x49')]['id']){delete _0x485f20['body']['id'];}delete _0x485f20[_0x0a63('0x49')]['duration'];delete _0x485f20[_0x0a63('0x49')][_0x0a63('0x4a')];delete _0x485f20['body']['closedAt'];delete _0x485f20['body'][_0x0a63('0x4b')];return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':{'id':_0x485f20[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x36d066,null))['then'](saveUpdates(_0x485f20[_0x0a63('0x49')],null))[_0x0a63('0x24')](respondWithResult(_0x36d066,null))[_0x0a63('0x41')](handleError(_0x36d066,null));};exports[_0x0a63('0x4c')]=function(_0x3575ae,_0x4a5b6e){return db[_0x0a63('0x2b')][_0x0a63('0x4c')]()[_0x0a63('0x24')](respondWithResult(_0x4a5b6e,null))[_0x0a63('0x41')](handleError(_0x4a5b6e,null));};exports['download']=function(_0x35b688,_0x3bd10c,_0x337bef){var _0x330550=require(_0x0a63('0x4d'));var _0x258ed3=![];var _0x4d4e20={};if(_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]&&_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]==='uniqueid'){_0x4d4e20['uniqueid']=_0x35b688[_0x0a63('0x43')]['id'];}else{_0x4d4e20['id']=_0x35b688[_0x0a63('0x43')]['id'];}return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':_0x4d4e20,'attributes':['id',_0x0a63('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3bd10c,null))['then'](function(_0x58b3a8){if(_0x58b3a8){var _0x42c1bb=path['join'](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x58b3a8[_0x0a63('0x4b')]);var _0x5d77e3=util['format'](_0x0a63('0x50'),_0x42c1bb);if(fs[_0x0a63('0x51')](_0x5d77e3)){_0x258ed3=!![];return _0x330550[_0x0a63('0x52')](_0x5d77e3,_0x42c1bb,config[_0x0a63('0x53')][_0x0a63('0x54')])[_0x0a63('0x24')](function(){return _0x58b3a8;});}return _0x58b3a8;}})[_0x0a63('0x24')](function(_0xc3415c){if(_0xc3415c){var _0xe454ef=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0xc3415c[_0x0a63('0x4b')]);if(!fs[_0x0a63('0x51')](_0xe454ef)){throw new db['Sequelize']['ValidationError'](_0x0a63('0x56'));}if(_0xc3415c[_0x0a63('0x57')]){return _0x3bd10c['download'](_0xe454ef,_0xc3415c[_0x0a63('0x57')]+path[_0x0a63('0x58')](_0xe454ef),function(){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}else{return _0x3bd10c[_0x0a63('0x59')](_0xe454ef,function(_0x3053e4){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}}})['catch'](function(_0x3b395a){if(_0x3b395a[_0x0a63('0x5a')]===_0x0a63('0x56')){_0x3bd10c['status'](0x194)[_0x0a63('0x29')](_0x0a63('0x5b'));}else{return handleError(_0x3bd10c,null);}});};exports[_0x0a63('0x25')]=function(_0x284dca,_0x15fc2e){return db['ScreenRecording'][_0x0a63('0x47')]({'where':{'id':_0x284dca[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](function(_0x1fa9cd){if(_[_0x0a63('0x5c')](_0x1fa9cd)){throw new ReferenceError(_0x0a63('0x5d'));}return _0x1fa9cd;})[_0x0a63('0x24')](function(_0x57313b){var _0x4571e7=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x57313b[_0x0a63('0x4b')]);logger[_0x0a63('0x5e')](_0x0a63('0x5f'),_0x4571e7);if(!_[_0x0a63('0x5c')](_0x57313b['value'])&&fs['existsSync'](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}_0x4571e7=_0x4571e7+_0x0a63('0x63');if(!_['isNil'](_0x57313b[_0x0a63('0x4b')])&&fs[_0x0a63('0x51')](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}return _0x57313b;})[_0x0a63('0x24')](function(_0xe52dfd){if(!_0xe52dfd)throw new InternalError();return _0xe52dfd[_0x0a63('0x25')]();})[_0x0a63('0x24')](function(){_0x15fc2e[_0x0a63('0x19')](0xcc)['end']();})[_0x0a63('0x41')](handleError(_0x15fc2e,null));}; \ No newline at end of file +var _0x7bae=['zip-dir','fast-json-patch','moment','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x3926ba,_0x237901){var _0x18756e=function(_0x5ca849){while(--_0x5ca849){_0x3926ba['push'](_0x3926ba['shift']());}};_0x18756e(++_0x237901);}(_0x7bae,0x13b));var _0xe7ba=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7bae[_0x24061a];return _0x82054e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a482217..e82f767 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 _0xa4a0=['../../config/logger','api','moment','request-promise','path','rimraf','./screenRecording.attributes','ScreenRecording','interactionid','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4a0,0xdb));var _0x0a4a=function(_0x424076,_0x5b4170){_0x424076=_0x424076-0x0;var _0xcbfb1d=_0xa4a0[_0x424076];return _0xcbfb1d;};'use strict';var _=require(_0x0a4a('0x0'));var util=require('util');var logger=require(_0x0a4a('0x1'))(_0x0a4a('0x2'));var moment=require(_0x0a4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a4a('0x4'));var fs=require('fs');var path=require(_0x0a4a('0x5'));var rimraf=require(_0x0a4a('0x6'));var config=require('../../config/environment');var attributes=require(_0x0a4a('0x7'));module['exports']=function(_0x1e0b83,_0x5ea940){return _0x1e0b83['define'](_0x0a4a('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x0a4a('0x9'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a6=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x47ed1a,_0x34e1d8){var _0x23b059=function(_0xed7fa4){while(--_0xed7fa4){_0x47ed1a['push'](_0x47ed1a['shift']());}};_0x23b059(++_0x34e1d8);}(_0xf2a6,0x188));var _0x6f2a=function(_0x1e7a7c,_0x5b834f){_0x1e7a7c=_0x1e7a7c-0x0;var _0x580b9b=_0xf2a6[_0x1e7a7c];return _0x580b9b;};'use strict';var _=require(_0x6f2a('0x0'));var util=require(_0x6f2a('0x1'));var logger=require(_0x6f2a('0x2'))(_0x6f2a('0x3'));var moment=require(_0x6f2a('0x4'));var BPromise=require(_0x6f2a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f2a('0x6'));var rimraf=require(_0x6f2a('0x7'));var config=require(_0x6f2a('0x8'));var attributes=require(_0x6f2a('0x9'));module[_0x6f2a('0xa')]=function(_0x4bb45d,_0x5076d2){return _0x4bb45d[_0x6f2a('0xb')](_0x6f2a('0xc'),attributes,{'tableName':_0x6f2a('0xd'),'paranoid':![],'indexes':[{'name':_0x6f2a('0xe'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 923792a..6c3b873 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 _0x3afd=['message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2be532,_0x232e63){var _0x193d9a=function(_0x166e6b){while(--_0x166e6b){_0x2be532['push'](_0x2be532['shift']());}};_0x193d9a(++_0x232e63);}(_0x3afd,0x90));var _0xd3af=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x3afd[_0x9b5bb2];return _0x2e1e92;};'use strict';var _=require(_0xd3af('0x0'));var util=require(_0xd3af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3af('0x2'));var fs=require('fs');var Redis=require(_0xd3af('0x3'));var db=require(_0xd3af('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3af('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3af('0x6')][_0xd3af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bc643,_0x4b1787,_0xd05a4b){return new BPromise(function(_0x4418b0,_0x3fa057){return client[_0xd3af('0x8')](_0x1bc643,_0xd05a4b)[_0xd3af('0x9')](function(_0x2e6624){logger[_0xd3af('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,_0xd3af('0xb'));logger[_0xd3af('0xc')](_0xd3af('0xd'),_0x4b1787,'request\x20sent',JSON['stringify'](_0x2e6624));if(_0x2e6624[_0xd3af('0xe')]){if(_0x2e6624[_0xd3af('0xe')][_0xd3af('0xf')]===0x1f4){logger[_0xd3af('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,_0x2e6624[_0xd3af('0xe')]['message']);return _0x3fa057(_0x2e6624[_0xd3af('0xe')][_0xd3af('0x10')]);}logger[_0xd3af('0xe')](_0xd3af('0x11'),_0x4b1787,_0x2e6624[_0xd3af('0xe')][_0xd3af('0x10')]);return _0x4418b0(_0x2e6624[_0xd3af('0xe')][_0xd3af('0x10')]);}else{logger[_0xd3af('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,'request\x20sent');_0x4418b0(_0x2e6624[_0xd3af('0x12')][_0xd3af('0x10')]);}})[_0xd3af('0x13')](function(_0x348c1c){logger[_0xd3af('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,_0x348c1c);_0x3fa057(_0x348c1c);});});} \ No newline at end of file +var _0xb789=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb789,0x1e0));var _0x9b78=function(_0x514c87,_0x1d39a3){_0x514c87=_0x514c87-0x0;var _0xbf0a73=_0xb789[_0x514c87];return _0xbf0a73;};'use strict';var _=require(_0x9b78('0x0'));var util=require(_0x9b78('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9b78('0x2'));var fs=require('fs');var Redis=require(_0x9b78('0x3'));var db=require(_0x9b78('0x4'))['db'];var utils=require(_0x9b78('0x5'));var logger=require(_0x9b78('0x6'))(_0x9b78('0x7'));var config=require(_0x9b78('0x8'));var jayson=require(_0x9b78('0x9'));var client=jayson[_0x9b78('0xa')][_0x9b78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e0fcc,_0x4e2720,_0x3ccc5a){return new BPromise(function(_0x131234,_0xf81fd2){return client[_0x9b78('0xc')](_0x4e0fcc,_0x3ccc5a)[_0x9b78('0xd')](function(_0x264766){logger[_0x9b78('0xe')](_0x9b78('0xf'),_0x4e2720,_0x9b78('0x10'));logger[_0x9b78('0x11')](_0x9b78('0x12'),_0x4e2720,_0x9b78('0x10'),JSON[_0x9b78('0x13')](_0x264766));if(_0x264766[_0x9b78('0x14')]){if(_0x264766[_0x9b78('0x14')]['code']===0x1f4){logger[_0x9b78('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x4e2720,_0x264766['error'][_0x9b78('0x15')]);return _0xf81fd2(_0x264766[_0x9b78('0x14')][_0x9b78('0x15')]);}logger[_0x9b78('0x14')](_0x9b78('0xf'),_0x4e2720,_0x264766[_0x9b78('0x14')][_0x9b78('0x15')]);return _0x131234(_0x264766[_0x9b78('0x14')][_0x9b78('0x15')]);}else{logger[_0x9b78('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4e2720,'request\x20sent');_0x131234(_0x264766[_0x9b78('0x16')][_0x9b78('0x15')]);}})['catch'](function(_0x229e6d){logger['error'](_0x9b78('0xf'),_0x4e2720,_0x229e6d);_0xf81fd2(_0x229e6d);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d2a1527..9022ee4 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 _0xcfa6=['file','addLogo','single','addLogoLogin','diskStorage','preferred','/:id/preferred','addPreferred','favicon','addFavicon','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post'];(function(_0x9a1f7b,_0x3e9bc4){var _0x5851f5=function(_0xb822a6){while(--_0xb822a6){_0x9a1f7b['push'](_0x9a1f7b['shift']());}};_0x5851f5(++_0x3e9bc4);}(_0xcfa6,0x1ec));var _0x6cfa=function(_0x45c8f1,_0x1d6a1b){_0x45c8f1=_0x45c8f1-0x0;var _0x3104bb=_0xcfa6[_0x45c8f1];return _0x3104bb;};'use strict';var multer=require(_0x6cfa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6cfa('0x1'));var express=require(_0x6cfa('0x2'));var router=express[_0x6cfa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6cfa('0x4'));var interaction=require(_0x6cfa('0x5'));var config=require(_0x6cfa('0x6'));var controller=require('./setting.controller');router[_0x6cfa('0x7')]('/',auth[_0x6cfa('0x8')](),controller[_0x6cfa('0x9')]);router[_0x6cfa('0x7')]('/now',controller['getDate']);router[_0x6cfa('0x7')](_0x6cfa('0xa'),controller['show']);router[_0x6cfa('0x7')](_0x6cfa('0xb'),controller[_0x6cfa('0xc')]);router['get'](_0x6cfa('0xd'),controller[_0x6cfa('0xe')]);router[_0x6cfa('0x7')]('/:id/gdpr',controller[_0x6cfa('0xf')]);router[_0x6cfa('0x7')]('/:id/preferred',controller[_0x6cfa('0x10')]);router[_0x6cfa('0x7')](_0x6cfa('0x11'),controller[_0x6cfa('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x529028,_0x14de46,_0x243eaa){_0x243eaa(null,path[_0x6cfa('0x13')](config[_0x6cfa('0x14')],_0x6cfa('0x15')));},'filename':function(_0x4ff020,_0x2ab821,_0x446dc4){_0x446dc4(null,util[_0x6cfa('0x16')](_0x6cfa('0x17'),_0x6cfa('0x18'),path[_0x6cfa('0x19')](_0x2ab821[_0x6cfa('0x1a')])));}})});router[_0x6cfa('0x1b')](_0x6cfa('0xb'),upload['single'](_0x6cfa('0x1c')),controller[_0x6cfa('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x6e77ac,_0x47bf1e,_0x4341bc){_0x4341bc(null,path[_0x6cfa('0x13')](config[_0x6cfa('0x14')],_0x6cfa('0x15')));},'filename':function(_0x62845b,_0x1c3974,_0xd2e5a3){_0xd2e5a3(null,util[_0x6cfa('0x16')](_0x6cfa('0x17'),'logologin',path[_0x6cfa('0x19')](_0x1c3974[_0x6cfa('0x1a')])));}})});router[_0x6cfa('0x1b')]('/:id/logo_login',upload[_0x6cfa('0x1e')](_0x6cfa('0x1c')),controller[_0x6cfa('0x1f')]);var upload=multer({'storage':multer[_0x6cfa('0x20')]({'destination':function(_0x407939,_0x1d2735,_0x27a649){_0x27a649(null,path[_0x6cfa('0x13')](config[_0x6cfa('0x14')],_0x6cfa('0x15')));},'filename':function(_0xa154e1,_0x1e7c68,_0x4ff1d0){_0x4ff1d0(null,util['format']('%s%s',_0x6cfa('0x21'),path[_0x6cfa('0x19')](_0x1e7c68[_0x6cfa('0x1a')])));}})});router['post'](_0x6cfa('0x22'),upload[_0x6cfa('0x1e')](_0x6cfa('0x1c')),controller[_0x6cfa('0x23')]);var upload=multer({'storage':multer[_0x6cfa('0x20')]({'destination':function(_0x3bc460,_0x5a9847,_0x1896bc){_0x1896bc(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x54ddbf,_0xf03dcb,_0x96862e){_0x96862e(null,util[_0x6cfa('0x16')]('%s%s',_0x6cfa('0x24'),path[_0x6cfa('0x19')](_0xf03dcb[_0x6cfa('0x1a')])));}})});router[_0x6cfa('0x1b')]('/:id/favicon',upload['single'](_0x6cfa('0x1c')),controller[_0x6cfa('0x25')]);router['put'](_0x6cfa('0xa'),auth[_0x6cfa('0x8')](),controller[_0x6cfa('0x26')]);module[_0x6cfa('0x27')]=router; \ No newline at end of file +var _0x972c=['favicon','addFavicon','put','exports','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','root','logologin','originalname','addLogoLogin','addPreferred'];(function(_0x43cdc3,_0x9ccb13){var _0x2936bd=function(_0x3a6b1b){while(--_0x3a6b1b){_0x43cdc3['push'](_0x43cdc3['shift']());}};_0x2936bd(++_0x9ccb13);}(_0x972c,0x12c));var _0xc972=function(_0x19f24a,_0x563a61){_0x19f24a=_0x19f24a-0x0;var _0x1ebc56=_0x972c[_0x19f24a];return _0x1ebc56;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc972('0x0'));var express=require('express');var router=express[_0xc972('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc972('0x2'));var controller=require('./setting.controller');router[_0xc972('0x3')]('/',auth[_0xc972('0x4')](),controller[_0xc972('0x5')]);router['get'](_0xc972('0x6'),controller[_0xc972('0x7')]);router['get'](_0xc972('0x8'),controller[_0xc972('0x9')]);router['get'](_0xc972('0xa'),controller['getLogo']);router['get'](_0xc972('0xb'),controller[_0xc972('0xc')]);router[_0xc972('0x3')](_0xc972('0xd'),controller['gdpr']);router['get'](_0xc972('0xe'),controller[_0xc972('0xf')]);router['get'](_0xc972('0x10'),controller[_0xc972('0x11')]);var upload=multer({'storage':multer[_0xc972('0x12')]({'destination':function(_0x33f43b,_0x562d9b,_0x1ab075){_0x1ab075(null,path[_0xc972('0x13')](config['root'],_0xc972('0x14')));},'filename':function(_0x174d79,_0x5ebb91,_0x174d07){_0x174d07(null,util[_0xc972('0x15')](_0xc972('0x16'),_0xc972('0x17'),path[_0xc972('0x18')](_0x5ebb91['originalname'])));}})});router[_0xc972('0x19')](_0xc972('0xa'),upload[_0xc972('0x1a')](_0xc972('0x1b')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5dc9bf,_0x31d010,_0x10c553){_0x10c553(null,path[_0xc972('0x13')](config[_0xc972('0x1c')],'server/files/images/logos/'));},'filename':function(_0x339216,_0x3fe624,_0x8f7bf3){_0x8f7bf3(null,util[_0xc972('0x15')](_0xc972('0x16'),_0xc972('0x1d'),path['extname'](_0x3fe624[_0xc972('0x1e')])));}})});router[_0xc972('0x19')](_0xc972('0xb'),upload[_0xc972('0x1a')](_0xc972('0x1b')),controller[_0xc972('0x1f')]);var upload=multer({'storage':multer[_0xc972('0x12')]({'destination':function(_0x2c06c6,_0xe7d870,_0x3b9013){_0x3b9013(null,path[_0xc972('0x13')](config[_0xc972('0x1c')],_0xc972('0x14')));},'filename':function(_0x3f0eca,_0x13b695,_0x45daf5){_0x45daf5(null,util[_0xc972('0x15')]('%s%s','preferred',path[_0xc972('0x18')](_0x13b695['originalname'])));}})});router['post']('/:id/preferred',upload['single'](_0xc972('0x1b')),controller[_0xc972('0x20')]);var upload=multer({'storage':multer[_0xc972('0x12')]({'destination':function(_0x43b413,_0x29274c,_0x564d9e){_0x564d9e(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x263e59,_0x4009c1,_0x3ff195){_0x3ff195(null,util[_0xc972('0x15')](_0xc972('0x16'),_0xc972('0x21'),path[_0xc972('0x18')](_0x4009c1[_0xc972('0x1e')])));}})});router['post'](_0xc972('0x10'),upload['single'](_0xc972('0x1b')),controller[_0xc972('0x22')]);router[_0xc972('0x23')](_0xc972('0x8'),auth[_0xc972('0x4')](),controller['update']);module[_0xc972('0x24')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a93b34d..3f7e180 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x57baed,_0x8d29b1){var _0x50cbb4=function(_0x5d9193){while(--_0x5d9193){_0x57baed['push'](_0x57baed['shift']());}};_0x50cbb4(++_0x8d29b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xcd675a,_0x18b1a1){var _0x510b8f=function(_0x3e7c7d){while(--_0x3e7c7d){_0xcd675a['push'](_0xcd675a['shift']());}};_0x510b8f(++_0x18b1a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index cef2dba..bba1a19 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 _0xb871=['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/environment','../../config/license/util','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','stack','name','index','map','Setting','fieldName','type','key','keys','query','filters','model','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','params','fields','find','body','file','filename','logo','getLogo','server/files/images/logos','getLicense','preferred','defaultFavicon','join','toLower','root','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','getLogoLogin','favicon','defaultLogo','defaultPreferred','loginLogo','existsSync','default_loginLogo.svg','default','\x20not\x20found','download','gdpr','securePassword','addPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0xb871,0x6b));var _0x1b87=function(_0xac53d2,_0x121075){_0xac53d2=_0xac53d2-0x0;var _0x2e5759=_0xb871[_0xac53d2];return _0x2e5759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b87('0x0'));var zipdir=require(_0x1b87('0x1'));var jsonpatch=require(_0x1b87('0x2'));var rp=require(_0x1b87('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b87('0x4'));var util=require(_0x1b87('0x5'));var path=require(_0x1b87('0x6'));var sox=require(_0x1b87('0x7'));var csv=require(_0x1b87('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b87('0x9'));var squel=require(_0x1b87('0xa'));var crypto=require(_0x1b87('0xb'));var jsforce=require(_0x1b87('0xc'));var deskjs=require(_0x1b87('0xd'));var toCsv=require(_0x1b87('0x8'));var querystring=require(_0x1b87('0xe'));var Papa=require(_0x1b87('0xf'));var Redis=require(_0x1b87('0x10'));var authService=require(_0x1b87('0x11'));var qs=require(_0x1b87('0x12'));var as=require(_0x1b87('0x13'));var hardwareService=require(_0x1b87('0x14'));var logger=require(_0x1b87('0x15'))(_0x1b87('0x16'));var utils=require(_0x1b87('0x17'));var config=require(_0x1b87('0x18'));var licenseUtil=require(_0x1b87('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1b87('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38c1b7,_0x1398e3,_0x3b0e74,_0x519833){return new BPromise(function(_0x27a538,_0x5eb657){var _0x33b428=_0x519833||client;return _0x33b428[_0x1b87('0x1b')](_0x38c1b7,_0x3b0e74)[_0x1b87('0x1c')](function(_0xd0d763){logger[_0x1b87('0x1d')](_0x1b87('0x1e'),_0x1398e3,_0x1b87('0x1f'));logger['debug'](_0x1b87('0x20'),_0x1398e3,'request\x20sent',JSON['stringify'](_0xd0d763));if(_0xd0d763[_0x1b87('0x21')]){if(_0xd0d763['error']['code']===0x1f4){logger[_0x1b87('0x21')]('Setting,\x20%s,\x20%s',_0x1398e3,_0xd0d763['error'][_0x1b87('0x22')]);return _0x5eb657(_0xd0d763[_0x1b87('0x21')][_0x1b87('0x22')]);}logger[_0x1b87('0x21')](_0x1b87('0x1e'),_0x1398e3,_0xd0d763[_0x1b87('0x21')][_0x1b87('0x22')]);return _0x27a538(_0xd0d763[_0x1b87('0x21')][_0x1b87('0x22')]);}else{logger[_0x1b87('0x1d')](_0x1b87('0x1e'),_0x1398e3,_0x1b87('0x1f'));_0x27a538(_0xd0d763[_0x1b87('0x23')][_0x1b87('0x22')]);}})[_0x1b87('0x24')](function(_0x52cefe){logger['error'](_0x1b87('0x1e'),_0x1398e3,_0x52cefe);_0x5eb657(_0x52cefe);});});}function respondWithStatusCode(_0x38c341,_0x400405){_0x400405=_0x400405||0xcc;return function(_0xb5959d){if(_0xb5959d){return _0x38c341[_0x1b87('0x25')](_0x400405);}return _0x38c341[_0x1b87('0x26')](_0x400405)[_0x1b87('0x27')]();};}function respondWithResult(_0x35cbbc,_0x4c732e){_0x4c732e=_0x4c732e||0xc8;return function(_0x23714f){if(_0x23714f){return _0x35cbbc[_0x1b87('0x26')](_0x4c732e)[_0x1b87('0x28')](_0x23714f);}};}function respondWithFilteredResult(_0x11388b,_0x4da1fd){return function(_0x145420){if(_0x145420){var _0x2d4317=typeof _0x4da1fd[_0x1b87('0x29')]==='undefined'&&typeof _0x4da1fd[_0x1b87('0x2a')]===_0x1b87('0x2b');var _0x28bb96=_0x145420[_0x1b87('0x2c')];var _0x395f79=_0x2d4317?0x0:_0x4da1fd[_0x1b87('0x29')];var _0x51cc00=_0x2d4317?_0x145420[_0x1b87('0x2c')]:_0x4da1fd[_0x1b87('0x29')]+_0x4da1fd['limit'];var _0x2cb299;if(_0x51cc00>=_0x28bb96){_0x51cc00=_0x28bb96;_0x2cb299=0xc8;}else{_0x2cb299=0xce;}_0x11388b[_0x1b87('0x26')](_0x2cb299);return _0x11388b[_0x1b87('0x2d')](_0x1b87('0x2e'),_0x395f79+'-'+_0x51cc00+'/'+_0x28bb96)[_0x1b87('0x28')](_0x145420);}return null;};}function patchUpdates(_0x2fb7b3){return function(_0x329b72){try{jsonpatch[_0x1b87('0x2f')](_0x329b72,_0x2fb7b3,!![]);}catch(_0x58e843){return BPromise[_0x1b87('0x30')](_0x58e843);}return _0x329b72['save']();};}function saveUpdates(_0x2fd156,_0x5880e5){return function(_0x102fb9){if(_0x102fb9){return _0x102fb9[_0x1b87('0x31')](_0x2fd156)['then'](function(_0x493465){return _0x493465;});}return null;};}function removeEntity(_0x21bf8e,_0x72fca6){return function(_0x37877e){if(_0x37877e){return _0x37877e['destroy']()['then'](function(){_0x21bf8e[_0x1b87('0x26')](0xcc)[_0x1b87('0x27')]();});}};}function handleEntityNotFound(_0x4eae9f,_0x4ee2fb){return function(_0x1efa6d){if(!_0x1efa6d){_0x4eae9f['sendStatus'](0x194);}return _0x1efa6d;};}function handleError(_0x1a2cb6,_0x253a2f){_0x253a2f=_0x253a2f||0x1f4;return function(_0x53a901){logger[_0x1b87('0x21')](_0x53a901[_0x1b87('0x32')]);if(_0x53a901['name']){delete _0x53a901[_0x1b87('0x33')];}_0x1a2cb6['status'](_0x253a2f)['send'](_0x53a901);};}exports[_0x1b87('0x34')]=function(_0x5afadd,_0x15257c){var _0x7e72a7={},_0x16bfd6={},_0x4f3aae={'count':0x0,'rows':[]};var _0x120f40=_[_0x1b87('0x35')](db[_0x1b87('0x36')]['rawAttributes'],function(_0x37ea04){return{'name':_0x37ea04[_0x1b87('0x37')],'type':_0x37ea04[_0x1b87('0x38')][_0x1b87('0x39')]};});_0x16bfd6['model']=_[_0x1b87('0x35')](_0x120f40,_0x1b87('0x33'));_0x16bfd6['query']=_[_0x1b87('0x3a')](_0x5afadd[_0x1b87('0x3b')]);_0x16bfd6[_0x1b87('0x3c')]=_['intersection'](_0x16bfd6[_0x1b87('0x3d')],_0x16bfd6[_0x1b87('0x3b')]);_0x7e72a7['attributes']=_[_0x1b87('0x3e')](_0x16bfd6[_0x1b87('0x3d')],qs['fields'](_0x5afadd[_0x1b87('0x3b')]['fields']));_0x7e72a7[_0x1b87('0x3f')]=_0x7e72a7[_0x1b87('0x3f')][_0x1b87('0x40')]?_0x7e72a7['attributes']:_0x16bfd6[_0x1b87('0x3d')];if(!_0x5afadd['query']['hasOwnProperty']('nolimit')){_0x7e72a7['limit']=qs['limit'](_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x2a')]);_0x7e72a7['offset']=qs[_0x1b87('0x29')](_0x5afadd['query'][_0x1b87('0x29')]);}_0x7e72a7[_0x1b87('0x41')]=qs['sort'](_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x42')]);_0x7e72a7[_0x1b87('0x43')]=qs[_0x1b87('0x3c')](_[_0x1b87('0x44')](_0x5afadd[_0x1b87('0x3b')],_0x16bfd6[_0x1b87('0x3c')]),_0x120f40);if(_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x45')]){_0x7e72a7['where']=_[_0x1b87('0x46')](_0x7e72a7['where'],{'$or':_[_0x1b87('0x35')](_0x120f40,function(_0x3b68d8){if(_0x3b68d8['type']!==_0x1b87('0x47')){var _0x1d3a22={};_0x1d3a22[_0x3b68d8[_0x1b87('0x33')]]={'$like':'%'+_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x45')]+'%'};return _0x1d3a22;}})});}_0x7e72a7=_[_0x1b87('0x46')]({},_0x7e72a7,_0x5afadd[_0x1b87('0x48')]);var _0x1700c9={'where':_0x7e72a7[_0x1b87('0x43')]};return db['Setting'][_0x1b87('0x2c')](_0x1700c9)['then'](function(_0x45a781){_0x4f3aae['count']=_0x45a781;if(_0x5afadd[_0x1b87('0x3b')]['includeAll']){_0x7e72a7['include']=[{'all':!![]}];}return db[_0x1b87('0x36')]['findAll'](_0x7e72a7);})[_0x1b87('0x1c')](function(_0x239c1a){_0x4f3aae[_0x1b87('0x49')]=_0x239c1a;return _0x4f3aae;})[_0x1b87('0x1c')](respondWithFilteredResult(_0x15257c,_0x7e72a7))[_0x1b87('0x24')](handleError(_0x15257c,null));};exports[_0x1b87('0x4a')]=function(_0xaa730d,_0x1da5f7){var _0x420c67={'raw':![],'where':{'id':_0xaa730d[_0x1b87('0x4b')]['id']}},_0x436624={};_0x436624[_0x1b87('0x3d')]=_['keys'](db['Setting']['rawAttributes']);_0x436624[_0x1b87('0x3b')]=_[_0x1b87('0x3a')](_0xaa730d['query']);_0x436624[_0x1b87('0x3c')]=_[_0x1b87('0x3e')](_0x436624[_0x1b87('0x3d')],_0x436624[_0x1b87('0x3b')]);_0x420c67[_0x1b87('0x3f')]=_['intersection'](_0x436624[_0x1b87('0x3d')],qs[_0x1b87('0x4c')](_0xaa730d['query'][_0x1b87('0x4c')]));_0x420c67[_0x1b87('0x3f')]=_0x420c67[_0x1b87('0x3f')][_0x1b87('0x40')]?_0x420c67[_0x1b87('0x3f')]:_0x436624[_0x1b87('0x3d')];if(_0xaa730d[_0x1b87('0x3b')]['includeAll']){_0x420c67['include']=[{'all':!![]}];}_0x420c67=_[_0x1b87('0x46')]({},_0x420c67,_0xaa730d[_0x1b87('0x48')]);return db[_0x1b87('0x36')][_0x1b87('0x4d')](_0x420c67)[_0x1b87('0x1c')](handleEntityNotFound(_0x1da5f7,null))[_0x1b87('0x1c')](respondWithResult(_0x1da5f7,null))['catch'](handleError(_0x1da5f7,null));};exports[_0x1b87('0x31')]=function(_0x44f7f0,_0x2d8d8c){if(_0x44f7f0['body']['id']){delete _0x44f7f0[_0x1b87('0x4e')]['id'];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x44f7f0[_0x1b87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d8d8c,null))[_0x1b87('0x1c')](saveUpdates(_0x44f7f0['body'],null))[_0x1b87('0x1c')](respondWithResult(_0x2d8d8c,null))[_0x1b87('0x24')](handleError(_0x2d8d8c,null));};exports['addLogo']=function(_0x11908e,_0x16cabc,_0x59f313){if(_0x11908e[_0x1b87('0x4f')]&&_0x11908e[_0x1b87('0x4f')][_0x1b87('0x50')]){_0x11908e[_0x1b87('0x4e')][_0x1b87('0x51')]=_0x11908e[_0x1b87('0x4f')][_0x1b87('0x50')];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x11908e[_0x1b87('0x4b')]['id']}})[_0x1b87('0x1c')](handleEntityNotFound(_0x16cabc,null))['then'](saveUpdates(_0x11908e['body'],null))[_0x1b87('0x1c')](respondWithResult(_0x16cabc,null))[_0x1b87('0x24')](handleError(_0x16cabc,null));};exports['addLogoLogin']=function(_0xc1e163,_0x9ed4ce,_0x2d2cc9){if(_0xc1e163[_0x1b87('0x4f')]&&_0xc1e163[_0x1b87('0x4f')]['filename']){_0xc1e163[_0x1b87('0x4e')]['loginLogo']=_0xc1e163[_0x1b87('0x4f')][_0x1b87('0x50')];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0xc1e163['params']['id']}})['then'](handleEntityNotFound(_0x9ed4ce,null))[_0x1b87('0x1c')](saveUpdates(_0xc1e163['body'],null))['then'](respondWithResult(_0x9ed4ce,null))[_0x1b87('0x24')](handleError(_0x9ed4ce,null));};var utilLicense=require(_0x1b87('0x19'));exports[_0x1b87('0x52')]=function(_0x1bf22a,_0x2a6c72,_0x442f52){var _0x68033e=_0x1b87('0x53');var _0x3e7901={'custom':![]};return utilLicense[_0x1b87('0x54')]()[_0x1b87('0x1c')](function(_0x218d90){if(_0x218d90){_0x3e7901=_0x218d90;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x1bf22a[_0x1b87('0x4b')]['id']},'attributes':[_0x1b87('0x51'),'loginLogo',_0x1b87('0x55'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred',_0x1b87('0x56')],'raw':!![]});})['then'](handleEntityNotFound(_0x2a6c72,null))[_0x1b87('0x1c')](function(_0x414721){if(_0x414721){var _0xcb4350=_0x414721['logo']&&fs['existsSync'](path[_0x1b87('0x57')](config['root'],_0x68033e,_[_0x1b87('0x58')](_0x414721[_0x1b87('0x51')])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x68033e,_[_0x1b87('0x58')](_0x414721[_0x1b87('0x51')])):path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x68033e,_['toLower'](_0x1b87('0x5a')));var _0x45450d='default'+_[_0x1b87('0x5b')]('logo');if(_0x414721[_0x45450d]||!_0x3e7901[_0x1b87('0x5c')]){_0xcb4350=path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x68033e,_[_0x1b87('0x58')](_0x1b87('0x5a')));}if(!fs['existsSync'](_0xcb4350)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_['upperFirst'](_0x1b87('0x51'))+'\x20not\x20found');}return _0x2a6c72['download'](_0xcb4350);}})['catch'](handleError(_0x2a6c72,null));};var utilLicense=require('../../config/license/util');exports[_0x1b87('0x5f')]=function(_0x55530c,_0x5a4090,_0x57b56a){var _0x46973d=_0x1b87('0x53');var _0x477d77={'custom':![]};return utilLicense['getLicense']()[_0x1b87('0x1c')](function(_0x5d7cd0){if(_0x5d7cd0){_0x477d77=_0x5d7cd0;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x55530c['params']['id']},'attributes':[_0x1b87('0x51'),'loginLogo',_0x1b87('0x55'),_0x1b87('0x60'),_0x1b87('0x61'),'defaultLoginLogo',_0x1b87('0x62'),_0x1b87('0x56')],'raw':!![]});})[_0x1b87('0x1c')](handleEntityNotFound(_0x5a4090,null))[_0x1b87('0x1c')](function(_0x549ecb){if(_0x549ecb){var _0x2b6a7b=_0x549ecb[_0x1b87('0x63')]&&fs[_0x1b87('0x64')](path[_0x1b87('0x57')](config['root'],_0x46973d,_[_0x1b87('0x58')](_0x549ecb[_0x1b87('0x63')])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x46973d,_['toLower'](_0x549ecb[_0x1b87('0x63')])):path['join'](config[_0x1b87('0x59')],_0x46973d,_[_0x1b87('0x58')](_0x1b87('0x65')));var _0x3cb430=_0x1b87('0x66')+_[_0x1b87('0x5b')](_0x1b87('0x63'));if(_0x549ecb[_0x3cb430]||!_0x477d77['custom']){_0x2b6a7b=path[_0x1b87('0x57')](config['root'],_0x46973d,_[_0x1b87('0x58')](_0x1b87('0x65')));}if(!fs['existsSync'](_0x2b6a7b)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_[_0x1b87('0x5b')](_0x1b87('0x63'))+_0x1b87('0x67'));}return _0x5a4090[_0x1b87('0x68')](_0x2b6a7b);}})[_0x1b87('0x24')](handleError(_0x5a4090,null));};exports[_0x1b87('0x69')]=function(_0x5e65c0,_0x3ac406){return db['Setting']['find']({'where':{'id':_0x5e65c0[_0x1b87('0x4b')]['id']},'attributes':[_0x1b87('0x6a')]})['then'](respondWithResult(_0x3ac406,null))[_0x1b87('0x24')](handleError(_0x3ac406,null));};exports[_0x1b87('0x6b')]=function(_0xeaa293,_0x85e949,_0xa8335f){if(_0xeaa293[_0x1b87('0x4f')]&&_0xeaa293[_0x1b87('0x4f')]['filename']){_0xeaa293['body'][_0x1b87('0x55')]=_0xeaa293[_0x1b87('0x4f')][_0x1b87('0x50')];}return db['Setting'][_0x1b87('0x4d')]({'where':{'id':_0xeaa293[_0x1b87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x85e949,null))[_0x1b87('0x1c')](saveUpdates(_0xeaa293[_0x1b87('0x4e')],null))[_0x1b87('0x1c')](respondWithResult(_0x85e949,null))['catch'](handleError(_0x85e949,null));};var utilLicense=require(_0x1b87('0x19'));exports['getPreferred']=function(_0x48bc01,_0x10264f,_0x2d1888){var _0x2d827a=_0x1b87('0x53');var _0x332752={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x309f83){if(_0x309f83){_0x332752=_0x309f83;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x48bc01['params']['id']},'attributes':[_0x1b87('0x51'),_0x1b87('0x63'),'preferred',_0x1b87('0x60'),'defaultLogo',_0x1b87('0x6c'),_0x1b87('0x62'),_0x1b87('0x56')],'raw':!![]});})[_0x1b87('0x1c')](handleEntityNotFound(_0x10264f,null))['then'](function(_0x332966){if(_0x332966){var _0x290580=_0x332966[_0x1b87('0x55')]&&fs[_0x1b87('0x64')](path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2d827a,_['toLower'](_0x332966['preferred'])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2d827a,_[_0x1b87('0x58')](_0x332966[_0x1b87('0x55')])):path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2d827a,_[_0x1b87('0x58')](_0x1b87('0x6d')));var _0x2c2019=_0x1b87('0x66')+_[_0x1b87('0x5b')](_0x1b87('0x55'));if(_0x332966[_0x2c2019]||!_0x332752[_0x1b87('0x5c')]||!_0x332752['preferred']){_0x290580=path['join'](config[_0x1b87('0x59')],_0x2d827a,_[_0x1b87('0x58')](_0x1b87('0x6d')));}if(!fs['existsSync'](_0x290580)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_[_0x1b87('0x5b')](_0x1b87('0x55'))+_0x1b87('0x67'));}return _0x10264f[_0x1b87('0x68')](_0x290580);}})['catch'](handleError(_0x10264f,null));};exports[_0x1b87('0x6e')]=function(_0x18725a,_0x4a1828,_0x22519b){if(_0x18725a[_0x1b87('0x4f')]&&_0x18725a[_0x1b87('0x4f')][_0x1b87('0x50')]){_0x18725a[_0x1b87('0x4e')]['favicon']=_0x18725a[_0x1b87('0x4f')][_0x1b87('0x50')];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x18725a[_0x1b87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a1828,null))[_0x1b87('0x1c')](saveUpdates(_0x18725a[_0x1b87('0x4e')],null))[_0x1b87('0x1c')](respondWithResult(_0x4a1828,null))[_0x1b87('0x24')](handleError(_0x4a1828,null));};var utilLicense=require(_0x1b87('0x19'));exports[_0x1b87('0x6f')]=function(_0x44b84a,_0x22ef4e,_0x4e13f4){var _0x2c823f='server/files/images/logos';var _0x17aeb0={'custom':![]};return utilLicense[_0x1b87('0x54')]()[_0x1b87('0x1c')](function(_0x27028a){if(_0x27028a){_0x17aeb0=_0x27028a;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x44b84a[_0x1b87('0x4b')]['id']},'attributes':['logo',_0x1b87('0x63'),_0x1b87('0x55'),'favicon','defaultLogo',_0x1b87('0x6c'),_0x1b87('0x62'),_0x1b87('0x56')],'raw':!![]});})[_0x1b87('0x1c')](handleEntityNotFound(_0x22ef4e,null))[_0x1b87('0x1c')](function(_0x1577e6){if(_0x1577e6){var _0x53422d=_0x1577e6[_0x1b87('0x60')]&&fs['existsSync'](path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_[_0x1b87('0x58')](_0x1577e6[_0x1b87('0x60')])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_[_0x1b87('0x58')](_0x1577e6[_0x1b87('0x60')])):path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_[_0x1b87('0x58')](_0x1b87('0x70')));var _0x4a97cd='default'+_[_0x1b87('0x5b')](_0x1b87('0x60'));if(_0x1577e6[_0x4a97cd]||!_0x17aeb0['custom']){_0x53422d=path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_['toLower'](_0x1b87('0x70')));}if(!fs[_0x1b87('0x64')](_0x53422d)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_[_0x1b87('0x5b')]('favicon')+_0x1b87('0x67'));}return _0x22ef4e[_0x1b87('0x68')](_0x53422d);}})[_0x1b87('0x24')](handleError(_0x22ef4e,null));};exports[_0x1b87('0x71')]=function(_0x124aa7,_0xf141ca){var _0x55652f={'offset':moment()['utcOffset']()};_0x55652f[_0x1b87('0x72')]=moment()[_0x1b87('0x73')](_0x55652f[_0x1b87('0x29')])[_0x1b87('0x74')](_0x1b87('0x75'));return _0xf141ca[_0x1b87('0x26')](0xc8)['send'](_0x55652f);}; \ No newline at end of file +var _0x0eec=['includeAll','include','findAll','rows','show','fields','length','find','body','file','filename','logo','params','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultPreferred','defaultFavicon','join','root','toLower','default','upperFirst','custom','default_logo.svg','existsSync','ValidationError','\x20not\x20found','defaultLoginLogo','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','defaultLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','stack','name','send','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','merge','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc0ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc0ee('0x1'));var rp=require(_0xc0ee('0x2'));var moment=require(_0xc0ee('0x3'));var BPromise=require(_0xc0ee('0x4'));var Mustache=require(_0xc0ee('0x5'));var util=require(_0xc0ee('0x6'));var path=require(_0xc0ee('0x7'));var sox=require('sox');var csv=require(_0xc0ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0ee('0x9'));var _=require(_0xc0ee('0xa'));var squel=require(_0xc0ee('0xb'));var crypto=require(_0xc0ee('0xc'));var jsforce=require(_0xc0ee('0xd'));var deskjs=require(_0xc0ee('0xe'));var toCsv=require(_0xc0ee('0x8'));var querystring=require('querystring');var Papa=require(_0xc0ee('0xf'));var Redis=require(_0xc0ee('0x10'));var authService=require(_0xc0ee('0x11'));var qs=require(_0xc0ee('0x12'));var as=require(_0xc0ee('0x13'));var hardwareService=require(_0xc0ee('0x14'));var logger=require(_0xc0ee('0x15'))('api');var utils=require(_0xc0ee('0x16'));var config=require(_0xc0ee('0x17'));var licenseUtil=require(_0xc0ee('0x18'));var db=require(_0xc0ee('0x19'))['db'];var jayson=require(_0xc0ee('0x1a'));var client=jayson[_0xc0ee('0x1b')][_0xc0ee('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2f3b49,_0x375134,_0x4bdd35,_0x51ae2e){return new BPromise(function(_0x1f3ad9,_0x325193){var _0x3743c3=_0x51ae2e||client;return _0x3743c3['request'](_0x2f3b49,_0x4bdd35)[_0xc0ee('0x1d')](function(_0x30c324){logger[_0xc0ee('0x1e')]('Setting,\x20%s,\x20%s',_0x375134,'request\x20sent');logger[_0xc0ee('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x375134,_0xc0ee('0x20'),JSON[_0xc0ee('0x21')](_0x30c324));if(_0x30c324[_0xc0ee('0x22')]){if(_0x30c324['error']['code']===0x1f4){logger[_0xc0ee('0x22')](_0xc0ee('0x23'),_0x375134,_0x30c324[_0xc0ee('0x22')]['message']);return _0x325193(_0x30c324[_0xc0ee('0x22')][_0xc0ee('0x24')]);}logger['error']('Setting,\x20%s,\x20%s',_0x375134,_0x30c324[_0xc0ee('0x22')][_0xc0ee('0x24')]);return _0x1f3ad9(_0x30c324['error'][_0xc0ee('0x24')]);}else{logger[_0xc0ee('0x1e')](_0xc0ee('0x23'),_0x375134,'request\x20sent');_0x1f3ad9(_0x30c324['result']['message']);}})[_0xc0ee('0x25')](function(_0x45d880){logger['error'](_0xc0ee('0x23'),_0x375134,_0x45d880);_0x325193(_0x45d880);});});}function respondWithStatusCode(_0x453490,_0x20b657){_0x20b657=_0x20b657||0xcc;return function(_0x11b6a4){if(_0x11b6a4){return _0x453490[_0xc0ee('0x26')](_0x20b657);}return _0x453490[_0xc0ee('0x27')](_0x20b657)[_0xc0ee('0x28')]();};}function respondWithResult(_0x35e833,_0x38abc9){_0x38abc9=_0x38abc9||0xc8;return function(_0x6d1087){if(_0x6d1087){return _0x35e833[_0xc0ee('0x27')](_0x38abc9)[_0xc0ee('0x29')](_0x6d1087);}};}function respondWithFilteredResult(_0x168ab5,_0x30582e){return function(_0x4288e1){if(_0x4288e1){var _0x4c6160=typeof _0x30582e[_0xc0ee('0x2a')]===_0xc0ee('0x2b')&&typeof _0x30582e['limit']===_0xc0ee('0x2b');var _0x4d913c=_0x4288e1[_0xc0ee('0x2c')];var _0x410fb2=_0x4c6160?0x0:_0x30582e[_0xc0ee('0x2a')];var _0x1d3594=_0x4c6160?_0x4288e1[_0xc0ee('0x2c')]:_0x30582e[_0xc0ee('0x2a')]+_0x30582e[_0xc0ee('0x2d')];var _0x2cffd8;if(_0x1d3594>=_0x4d913c){_0x1d3594=_0x4d913c;_0x2cffd8=0xc8;}else{_0x2cffd8=0xce;}_0x168ab5[_0xc0ee('0x27')](_0x2cffd8);return _0x168ab5[_0xc0ee('0x2e')](_0xc0ee('0x2f'),_0x410fb2+'-'+_0x1d3594+'/'+_0x4d913c)[_0xc0ee('0x29')](_0x4288e1);}return null;};}function patchUpdates(_0x31ea56){return function(_0x5cfe16){try{jsonpatch['apply'](_0x5cfe16,_0x31ea56,!![]);}catch(_0x5cd9bd){return BPromise[_0xc0ee('0x30')](_0x5cd9bd);}return _0x5cfe16[_0xc0ee('0x31')]();};}function saveUpdates(_0x252ce9,_0x4261ad){return function(_0x345ee5){if(_0x345ee5){return _0x345ee5[_0xc0ee('0x32')](_0x252ce9)[_0xc0ee('0x1d')](function(_0x295929){return _0x295929;});}return null;};}function removeEntity(_0x16a50f,_0x41d73a){return function(_0x2cf642){if(_0x2cf642){return _0x2cf642['destroy']()[_0xc0ee('0x1d')](function(){_0x16a50f[_0xc0ee('0x27')](0xcc)[_0xc0ee('0x28')]();});}};}function handleEntityNotFound(_0x31a4ee,_0x397f4e){return function(_0x5c9cab){if(!_0x5c9cab){_0x31a4ee[_0xc0ee('0x26')](0x194);}return _0x5c9cab;};}function handleError(_0x37d8bf,_0x3f6a85){_0x3f6a85=_0x3f6a85||0x1f4;return function(_0x5e5162){logger[_0xc0ee('0x22')](_0x5e5162[_0xc0ee('0x33')]);if(_0x5e5162[_0xc0ee('0x34')]){delete _0x5e5162[_0xc0ee('0x34')];}_0x37d8bf['status'](_0x3f6a85)[_0xc0ee('0x35')](_0x5e5162);};}exports['index']=function(_0x429956,_0x2489dd){var _0x175f24={},_0xc669e5={},_0x27febb={'count':0x0,'rows':[]};var _0x24057a=_[_0xc0ee('0x36')](db[_0xc0ee('0x37')][_0xc0ee('0x38')],function(_0x1e19de){return{'name':_0x1e19de[_0xc0ee('0x39')],'type':_0x1e19de['type'][_0xc0ee('0x3a')]};});_0xc669e5[_0xc0ee('0x3b')]=_[_0xc0ee('0x36')](_0x24057a,_0xc0ee('0x34'));_0xc669e5[_0xc0ee('0x3c')]=_[_0xc0ee('0x3d')](_0x429956[_0xc0ee('0x3c')]);_0xc669e5[_0xc0ee('0x3e')]=_['intersection'](_0xc669e5['model'],_0xc669e5[_0xc0ee('0x3c')]);_0x175f24['attributes']=_[_0xc0ee('0x3f')](_0xc669e5[_0xc0ee('0x3b')],qs['fields'](_0x429956[_0xc0ee('0x3c')]['fields']));_0x175f24[_0xc0ee('0x40')]=_0x175f24['attributes']['length']?_0x175f24['attributes']:_0xc669e5[_0xc0ee('0x3b')];if(!_0x429956[_0xc0ee('0x3c')][_0xc0ee('0x41')](_0xc0ee('0x42'))){_0x175f24['limit']=qs[_0xc0ee('0x2d')](_0x429956[_0xc0ee('0x3c')][_0xc0ee('0x2d')]);_0x175f24[_0xc0ee('0x2a')]=qs[_0xc0ee('0x2a')](_0x429956['query'][_0xc0ee('0x2a')]);}_0x175f24[_0xc0ee('0x43')]=qs['sort'](_0x429956[_0xc0ee('0x3c')]['sort']);_0x175f24[_0xc0ee('0x44')]=qs[_0xc0ee('0x3e')](_['pick'](_0x429956[_0xc0ee('0x3c')],_0xc669e5[_0xc0ee('0x3e')]),_0x24057a);if(_0x429956['query'][_0xc0ee('0x45')]){_0x175f24[_0xc0ee('0x44')]=_['merge'](_0x175f24[_0xc0ee('0x44')],{'$or':_[_0xc0ee('0x36')](_0x24057a,function(_0x408511){if(_0x408511[_0xc0ee('0x46')]!==_0xc0ee('0x47')){var _0x5af5a9={};_0x5af5a9[_0x408511['name']]={'$like':'%'+_0x429956[_0xc0ee('0x3c')][_0xc0ee('0x45')]+'%'};return _0x5af5a9;}})});}_0x175f24=_[_0xc0ee('0x48')]({},_0x175f24,_0x429956[_0xc0ee('0x49')]);var _0x494e24={'where':_0x175f24['where']};return db[_0xc0ee('0x37')][_0xc0ee('0x2c')](_0x494e24)[_0xc0ee('0x1d')](function(_0x4ca1e5){_0x27febb['count']=_0x4ca1e5;if(_0x429956[_0xc0ee('0x3c')][_0xc0ee('0x4a')]){_0x175f24[_0xc0ee('0x4b')]=[{'all':!![]}];}return db['Setting'][_0xc0ee('0x4c')](_0x175f24);})[_0xc0ee('0x1d')](function(_0x5e5f5e){_0x27febb[_0xc0ee('0x4d')]=_0x5e5f5e;return _0x27febb;})[_0xc0ee('0x1d')](respondWithFilteredResult(_0x2489dd,_0x175f24))[_0xc0ee('0x25')](handleError(_0x2489dd,null));};exports[_0xc0ee('0x4e')]=function(_0x4ef9c6,_0x59f46f){var _0x22c742={'raw':![],'where':{'id':_0x4ef9c6['params']['id']}},_0x5ca93b={};_0x5ca93b['model']=_[_0xc0ee('0x3d')](db['Setting'][_0xc0ee('0x38')]);_0x5ca93b[_0xc0ee('0x3c')]=_[_0xc0ee('0x3d')](_0x4ef9c6['query']);_0x5ca93b[_0xc0ee('0x3e')]=_['intersection'](_0x5ca93b[_0xc0ee('0x3b')],_0x5ca93b['query']);_0x22c742[_0xc0ee('0x40')]=_[_0xc0ee('0x3f')](_0x5ca93b[_0xc0ee('0x3b')],qs[_0xc0ee('0x4f')](_0x4ef9c6[_0xc0ee('0x3c')][_0xc0ee('0x4f')]));_0x22c742['attributes']=_0x22c742['attributes'][_0xc0ee('0x50')]?_0x22c742['attributes']:_0x5ca93b[_0xc0ee('0x3b')];if(_0x4ef9c6[_0xc0ee('0x3c')][_0xc0ee('0x4a')]){_0x22c742[_0xc0ee('0x4b')]=[{'all':!![]}];}_0x22c742=_[_0xc0ee('0x48')]({},_0x22c742,_0x4ef9c6[_0xc0ee('0x49')]);return db[_0xc0ee('0x37')][_0xc0ee('0x51')](_0x22c742)['then'](handleEntityNotFound(_0x59f46f,null))[_0xc0ee('0x1d')](respondWithResult(_0x59f46f,null))[_0xc0ee('0x25')](handleError(_0x59f46f,null));};exports['update']=function(_0x44f7d8,_0x2f92d8){if(_0x44f7d8[_0xc0ee('0x52')]['id']){delete _0x44f7d8[_0xc0ee('0x52')]['id'];}return db[_0xc0ee('0x37')][_0xc0ee('0x51')]({'where':{'id':_0x44f7d8['params']['id']}})[_0xc0ee('0x1d')](handleEntityNotFound(_0x2f92d8,null))[_0xc0ee('0x1d')](saveUpdates(_0x44f7d8['body'],null))['then'](respondWithResult(_0x2f92d8,null))[_0xc0ee('0x25')](handleError(_0x2f92d8,null));};exports['addLogo']=function(_0x26de4d,_0x2fe985,_0x3ddeb2){if(_0x26de4d[_0xc0ee('0x53')]&&_0x26de4d[_0xc0ee('0x53')][_0xc0ee('0x54')]){_0x26de4d[_0xc0ee('0x52')][_0xc0ee('0x55')]=_0x26de4d[_0xc0ee('0x53')][_0xc0ee('0x54')];}return db[_0xc0ee('0x37')][_0xc0ee('0x51')]({'where':{'id':_0x26de4d[_0xc0ee('0x56')]['id']}})['then'](handleEntityNotFound(_0x2fe985,null))[_0xc0ee('0x1d')](saveUpdates(_0x26de4d[_0xc0ee('0x52')],null))[_0xc0ee('0x1d')](respondWithResult(_0x2fe985,null))[_0xc0ee('0x25')](handleError(_0x2fe985,null));};exports[_0xc0ee('0x57')]=function(_0x592304,_0x618059,_0x5ee013){if(_0x592304[_0xc0ee('0x53')]&&_0x592304[_0xc0ee('0x53')][_0xc0ee('0x54')]){_0x592304[_0xc0ee('0x52')][_0xc0ee('0x58')]=_0x592304[_0xc0ee('0x53')]['filename'];}return db[_0xc0ee('0x37')]['find']({'where':{'id':_0x592304[_0xc0ee('0x56')]['id']}})[_0xc0ee('0x1d')](handleEntityNotFound(_0x618059,null))[_0xc0ee('0x1d')](saveUpdates(_0x592304[_0xc0ee('0x52')],null))[_0xc0ee('0x1d')](respondWithResult(_0x618059,null))[_0xc0ee('0x25')](handleError(_0x618059,null));};var utilLicense=require(_0xc0ee('0x18'));exports[_0xc0ee('0x59')]=function(_0x2c11a6,_0x2344f6,_0x4255f0){var _0x443a93=_0xc0ee('0x5a');var _0x2e9b81={'custom':![]};return utilLicense[_0xc0ee('0x5b')]()[_0xc0ee('0x1d')](function(_0x313865){if(_0x313865){_0x2e9b81=_0x313865;}return db['Setting']['find']({'where':{'id':_0x2c11a6[_0xc0ee('0x56')]['id']},'attributes':[_0xc0ee('0x55'),'loginLogo',_0xc0ee('0x5c'),_0xc0ee('0x5d'),'defaultLogo','defaultLoginLogo',_0xc0ee('0x5e'),_0xc0ee('0x5f')],'raw':!![]});})[_0xc0ee('0x1d')](handleEntityNotFound(_0x2344f6,null))['then'](function(_0x2878a0){if(_0x2878a0){var _0x1d9cec=_0x2878a0[_0xc0ee('0x55')]&&fs['existsSync'](path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x443a93,_[_0xc0ee('0x62')](_0x2878a0[_0xc0ee('0x55')])))?path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x443a93,_[_0xc0ee('0x62')](_0x2878a0['logo'])):path[_0xc0ee('0x60')](config['root'],_0x443a93,_[_0xc0ee('0x62')]('default_logo.svg'));var _0x236486=_0xc0ee('0x63')+_[_0xc0ee('0x64')](_0xc0ee('0x55'));if(_0x2878a0[_0x236486]||!_0x2e9b81[_0xc0ee('0x65')]){_0x1d9cec=path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x443a93,_[_0xc0ee('0x62')](_0xc0ee('0x66')));}if(!fs[_0xc0ee('0x67')](_0x1d9cec)){throw new db['Sequelize'][(_0xc0ee('0x68'))](_[_0xc0ee('0x64')](_0xc0ee('0x55'))+_0xc0ee('0x69'));}return _0x2344f6['download'](_0x1d9cec);}})[_0xc0ee('0x25')](handleError(_0x2344f6,null));};var utilLicense=require(_0xc0ee('0x18'));exports['getLogoLogin']=function(_0x5dd196,_0x29a07d,_0x4199b6){var _0x39e23e=_0xc0ee('0x5a');var _0x657ef5={'custom':![]};return utilLicense[_0xc0ee('0x5b')]()[_0xc0ee('0x1d')](function(_0x29dd28){if(_0x29dd28){_0x657ef5=_0x29dd28;}return db[_0xc0ee('0x37')][_0xc0ee('0x51')]({'where':{'id':_0x5dd196[_0xc0ee('0x56')]['id']},'attributes':['logo',_0xc0ee('0x58'),_0xc0ee('0x5c'),_0xc0ee('0x5d'),'defaultLogo',_0xc0ee('0x6a'),_0xc0ee('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xc0ee('0x1d')](handleEntityNotFound(_0x29a07d,null))[_0xc0ee('0x1d')](function(_0x79e629){if(_0x79e629){var _0x5a3fc1=_0x79e629[_0xc0ee('0x58')]&&fs[_0xc0ee('0x67')](path[_0xc0ee('0x60')](config['root'],_0x39e23e,_[_0xc0ee('0x62')](_0x79e629[_0xc0ee('0x58')])))?path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x39e23e,_[_0xc0ee('0x62')](_0x79e629[_0xc0ee('0x58')])):path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x39e23e,_[_0xc0ee('0x62')]('default_loginLogo.svg'));var _0x1d6bff=_0xc0ee('0x63')+_['upperFirst'](_0xc0ee('0x58'));if(_0x79e629[_0x1d6bff]||!_0x657ef5[_0xc0ee('0x65')]){_0x5a3fc1=path[_0xc0ee('0x60')](config['root'],_0x39e23e,_[_0xc0ee('0x62')](_0xc0ee('0x6b')));}if(!fs[_0xc0ee('0x67')](_0x5a3fc1)){throw new db[(_0xc0ee('0x6c'))][(_0xc0ee('0x68'))](_[_0xc0ee('0x64')](_0xc0ee('0x58'))+_0xc0ee('0x69'));}return _0x29a07d[_0xc0ee('0x6d')](_0x5a3fc1);}})['catch'](handleError(_0x29a07d,null));};exports[_0xc0ee('0x6e')]=function(_0x598fab,_0x49a700){return db[_0xc0ee('0x37')]['find']({'where':{'id':_0x598fab['params']['id']},'attributes':[_0xc0ee('0x6f')]})['then'](respondWithResult(_0x49a700,null))[_0xc0ee('0x25')](handleError(_0x49a700,null));};exports[_0xc0ee('0x70')]=function(_0x3beb39,_0xb71e9f,_0x31af1d){if(_0x3beb39[_0xc0ee('0x53')]&&_0x3beb39[_0xc0ee('0x53')]['filename']){_0x3beb39['body'][_0xc0ee('0x5c')]=_0x3beb39[_0xc0ee('0x53')][_0xc0ee('0x54')];}return db[_0xc0ee('0x37')][_0xc0ee('0x51')]({'where':{'id':_0x3beb39[_0xc0ee('0x56')]['id']}})[_0xc0ee('0x1d')](handleEntityNotFound(_0xb71e9f,null))[_0xc0ee('0x1d')](saveUpdates(_0x3beb39['body'],null))['then'](respondWithResult(_0xb71e9f,null))[_0xc0ee('0x25')](handleError(_0xb71e9f,null));};var utilLicense=require('../../config/license/util');exports[_0xc0ee('0x71')]=function(_0x18502f,_0x4a498d,_0x3d2e1b){var _0x2ee624='server/files/images/logos';var _0x46d0f2={'custom':![]};return utilLicense[_0xc0ee('0x5b')]()[_0xc0ee('0x1d')](function(_0x113635){if(_0x113635){_0x46d0f2=_0x113635;}return db[_0xc0ee('0x37')][_0xc0ee('0x51')]({'where':{'id':_0x18502f['params']['id']},'attributes':[_0xc0ee('0x55'),_0xc0ee('0x58'),'preferred',_0xc0ee('0x5d'),_0xc0ee('0x72'),_0xc0ee('0x6a'),_0xc0ee('0x5e'),_0xc0ee('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x4a498d,null))[_0xc0ee('0x1d')](function(_0x33cbaa){if(_0x33cbaa){var _0x112f74=_0x33cbaa[_0xc0ee('0x5c')]&&fs['existsSync'](path['join'](config['root'],_0x2ee624,_['toLower'](_0x33cbaa[_0xc0ee('0x5c')])))?path['join'](config[_0xc0ee('0x61')],_0x2ee624,_['toLower'](_0x33cbaa[_0xc0ee('0x5c')])):path['join'](config[_0xc0ee('0x61')],_0x2ee624,_[_0xc0ee('0x62')](_0xc0ee('0x73')));var _0x2eb60a='default'+_[_0xc0ee('0x64')](_0xc0ee('0x5c'));if(_0x33cbaa[_0x2eb60a]||!_0x46d0f2[_0xc0ee('0x65')]||!_0x46d0f2[_0xc0ee('0x5c')]){_0x112f74=path['join'](config[_0xc0ee('0x61')],_0x2ee624,_[_0xc0ee('0x62')](_0xc0ee('0x73')));}if(!fs[_0xc0ee('0x67')](_0x112f74)){throw new db[(_0xc0ee('0x6c'))][(_0xc0ee('0x68'))](_[_0xc0ee('0x64')](_0xc0ee('0x5c'))+_0xc0ee('0x69'));}return _0x4a498d[_0xc0ee('0x6d')](_0x112f74);}})[_0xc0ee('0x25')](handleError(_0x4a498d,null));};exports[_0xc0ee('0x74')]=function(_0x369018,_0x5ef6ce,_0x3c972e){if(_0x369018['file']&&_0x369018[_0xc0ee('0x53')][_0xc0ee('0x54')]){_0x369018[_0xc0ee('0x52')]['favicon']=_0x369018[_0xc0ee('0x53')][_0xc0ee('0x54')];}return db[_0xc0ee('0x37')][_0xc0ee('0x51')]({'where':{'id':_0x369018[_0xc0ee('0x56')]['id']}})['then'](handleEntityNotFound(_0x5ef6ce,null))[_0xc0ee('0x1d')](saveUpdates(_0x369018['body'],null))[_0xc0ee('0x1d')](respondWithResult(_0x5ef6ce,null))['catch'](handleError(_0x5ef6ce,null));};var utilLicense=require(_0xc0ee('0x18'));exports[_0xc0ee('0x75')]=function(_0x172974,_0x27b244,_0xc4130f){var _0x5e81af=_0xc0ee('0x5a');var _0x478c59={'custom':![]};return utilLicense[_0xc0ee('0x5b')]()['then'](function(_0x2560e3){if(_0x2560e3){_0x478c59=_0x2560e3;}return db[_0xc0ee('0x37')][_0xc0ee('0x51')]({'where':{'id':_0x172974[_0xc0ee('0x56')]['id']},'attributes':[_0xc0ee('0x55'),_0xc0ee('0x58'),_0xc0ee('0x5c'),_0xc0ee('0x5d'),'defaultLogo',_0xc0ee('0x6a'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xc0ee('0x1d')](handleEntityNotFound(_0x27b244,null))[_0xc0ee('0x1d')](function(_0x238c86){if(_0x238c86){var _0x89daec=_0x238c86[_0xc0ee('0x5d')]&&fs['existsSync'](path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x5e81af,_['toLower'](_0x238c86[_0xc0ee('0x5d')])))?path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x5e81af,_[_0xc0ee('0x62')](_0x238c86[_0xc0ee('0x5d')])):path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x5e81af,_[_0xc0ee('0x62')](_0xc0ee('0x76')));var _0x23065c=_0xc0ee('0x63')+_[_0xc0ee('0x64')](_0xc0ee('0x5d'));if(_0x238c86[_0x23065c]||!_0x478c59[_0xc0ee('0x65')]){_0x89daec=path[_0xc0ee('0x60')](config[_0xc0ee('0x61')],_0x5e81af,_[_0xc0ee('0x62')](_0xc0ee('0x76')));}if(!fs[_0xc0ee('0x67')](_0x89daec)){throw new db[(_0xc0ee('0x6c'))][(_0xc0ee('0x68'))](_[_0xc0ee('0x64')]('favicon')+_0xc0ee('0x69'));}return _0x27b244[_0xc0ee('0x6d')](_0x89daec);}})[_0xc0ee('0x25')](handleError(_0x27b244,null));};exports[_0xc0ee('0x77')]=function(_0x200fee,_0x4ec635){var _0x49c9ea={'offset':moment()[_0xc0ee('0x78')]()};_0x49c9ea[_0xc0ee('0x79')]=moment()[_0xc0ee('0x78')](_0x49c9ea[_0xc0ee('0x2a')])[_0xc0ee('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x4ec635[_0xc0ee('0x27')](0xc8)[_0xc0ee('0x35')](_0x49c9ea);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5b5d94a..38671cb 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0x55ca,0x126));var _0xa55c=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x55ca[_0x5f0501];return _0x3c2c45;};'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')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x7217,0x19e));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'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 c8579e1..07956fe 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 _0x4708=['find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting'];(function(_0x1dcc3b,_0x18bae2){var _0x26c155=function(_0x125b8b){while(--_0x125b8b){_0x1dcc3b['push'](_0x1dcc3b['shift']());}};_0x26c155(++_0x18bae2);}(_0x4708,0x120));var _0x8470=function(_0x35163f,_0x33d9ee){_0x35163f=_0x35163f-0x0;var _0x44bceb=_0x4708[_0x35163f];return _0x44bceb;};'use strict';var _=require(_0x8470('0x0'));var util=require(_0x8470('0x1'));var moment=require(_0x8470('0x2'));var BPromise=require(_0x8470('0x3'));var rs=require(_0x8470('0x4'));var fs=require('fs');var Redis=require(_0x8470('0x5'));var db=require(_0x8470('0x6'))['db'];var utils=require(_0x8470('0x7'));var logger=require(_0x8470('0x8'))(_0x8470('0x9'));var config=require(_0x8470('0xa'));var jayson=require(_0x8470('0xb'));var client=jayson[_0x8470('0xc')][_0x8470('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a5cb4,_0x56beb4,_0x3eef2d){return new BPromise(function(_0x3dfc43,_0x2c049a){return client['request'](_0x1a5cb4,_0x3eef2d)[_0x8470('0xe')](function(_0x429b55){logger[_0x8470('0xf')](_0x8470('0x10'),_0x56beb4,_0x8470('0x11'));logger[_0x8470('0x12')](_0x8470('0x13'),_0x56beb4,_0x8470('0x11'),JSON[_0x8470('0x14')](_0x429b55));if(_0x429b55['error']){if(_0x429b55[_0x8470('0x15')]['code']===0x1f4){logger[_0x8470('0x15')](_0x8470('0x10'),_0x56beb4,_0x429b55[_0x8470('0x15')][_0x8470('0x16')]);return _0x2c049a(_0x429b55[_0x8470('0x15')][_0x8470('0x16')]);}logger[_0x8470('0x15')](_0x8470('0x10'),_0x56beb4,_0x429b55[_0x8470('0x15')]['message']);return _0x3dfc43(_0x429b55[_0x8470('0x15')][_0x8470('0x16')]);}else{logger['info'](_0x8470('0x10'),_0x56beb4,_0x8470('0x11'));_0x3dfc43(_0x429b55[_0x8470('0x17')][_0x8470('0x16')]);}})[_0x8470('0x18')](function(_0xc9bf2e){logger[_0x8470('0x15')](_0x8470('0x10'),_0x56beb4,_0xc9bf2e);_0x2c049a(_0xc9bf2e);});});}exports[_0x8470('0x19')]=function(_0x48134d){var _0x1483b6=this;return new Promise(function(_0x2a5ff4,_0x6fa910){return db[_0x8470('0x1a')][_0x8470('0x1b')]({'raw':_0x48134d[_0x8470('0x1c')]?_0x48134d[_0x8470('0x1c')][_0x8470('0x1d')]===undefined?!![]:![]:!![],'where':_0x48134d[_0x8470('0x1c')]?_0x48134d['options'][_0x8470('0x1e')]||null:null,'attributes':_0x48134d[_0x8470('0x1c')]?_0x48134d[_0x8470('0x1c')]['attributes']||null:null,'include':_0x48134d['options']?_0x48134d[_0x8470('0x1c')][_0x8470('0x1f')]?_[_0x8470('0x20')](_0x48134d[_0x8470('0x1c')][_0x8470('0x1f')],function(_0x27f38e){return{'model':db[_0x27f38e[_0x8470('0x21')]],'as':_0x27f38e['as'],'attributes':_0x27f38e['attributes'],'include':_0x27f38e[_0x8470('0x1f')]?_[_0x8470('0x20')](_0x27f38e[_0x8470('0x1f')],function(_0x1dc9cb){return{'model':db[_0x1dc9cb[_0x8470('0x21')]],'as':_0x1dc9cb['as'],'attributes':_0x1dc9cb[_0x8470('0x22')],'include':_0x1dc9cb[_0x8470('0x1f')]?_[_0x8470('0x20')](_0x1dc9cb[_0x8470('0x1f')],function(_0x361a55){return{'model':db[_0x361a55[_0x8470('0x21')]],'as':_0x361a55['as'],'attributes':_0x361a55[_0x8470('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8470('0xe')](function(_0x2abbf4){logger['info']('ShowSetting',_0x48134d);logger[_0x8470('0x12')](_0x8470('0x19'),_0x48134d,JSON[_0x8470('0x14')](_0x2abbf4));_0x2a5ff4(_0x2abbf4);})[_0x8470('0x18')](function(_0x1320e3){logger[_0x8470('0x15')]('ShowSetting',_0x1320e3[_0x8470('0x16')],_0x48134d);_0x6fa910(_0x1483b6[_0x8470('0x15')](0x1f4,_0x1320e3[_0x8470('0x16')]));});});}; \ No newline at end of file +var _0xb71a=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','ShowSetting','Setting','find','options','raw','attributes','include','model','map','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','Setting,\x20%s,\x20%s','debug'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb71a,0xfa));var _0xab71=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb71a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xab71('0x0'));var moment=require(_0xab71('0x1'));var BPromise=require(_0xab71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab71('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xab71('0x4'));var logger=require(_0xab71('0x5'))(_0xab71('0x6'));var config=require(_0xab71('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab71('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5408de,_0x7fec27,_0x403ab5){return new BPromise(function(_0x2dbe94,_0x21af9b){return client['request'](_0x5408de,_0x403ab5)['then'](function(_0x2b1bf3){logger['info'](_0xab71('0x9'),_0x7fec27,'request\x20sent');logger[_0xab71('0xa')](_0xab71('0xb'),_0x7fec27,'request\x20sent',JSON[_0xab71('0xc')](_0x2b1bf3));if(_0x2b1bf3[_0xab71('0xd')]){if(_0x2b1bf3[_0xab71('0xd')]['code']===0x1f4){logger[_0xab71('0xd')]('Setting,\x20%s,\x20%s',_0x7fec27,_0x2b1bf3[_0xab71('0xd')][_0xab71('0xe')]);return _0x21af9b(_0x2b1bf3[_0xab71('0xd')][_0xab71('0xe')]);}logger['error'](_0xab71('0x9'),_0x7fec27,_0x2b1bf3[_0xab71('0xd')][_0xab71('0xe')]);return _0x2dbe94(_0x2b1bf3[_0xab71('0xd')]['message']);}else{logger[_0xab71('0xf')](_0xab71('0x9'),_0x7fec27,_0xab71('0x10'));_0x2dbe94(_0x2b1bf3[_0xab71('0x11')]['message']);}})[_0xab71('0x12')](function(_0x2d8b68){logger[_0xab71('0xd')]('Setting,\x20%s,\x20%s',_0x7fec27,_0x2d8b68);_0x21af9b(_0x2d8b68);});});}exports[_0xab71('0x13')]=function(_0x3c07b6){var _0x2547c0=this;return new Promise(function(_0x590b4e,_0x38d311){return db[_0xab71('0x14')][_0xab71('0x15')]({'raw':_0x3c07b6[_0xab71('0x16')]?_0x3c07b6[_0xab71('0x16')][_0xab71('0x17')]===undefined?!![]:![]:!![],'where':_0x3c07b6[_0xab71('0x16')]?_0x3c07b6[_0xab71('0x16')]['where']||null:null,'attributes':_0x3c07b6[_0xab71('0x16')]?_0x3c07b6[_0xab71('0x16')][_0xab71('0x18')]||null:null,'include':_0x3c07b6[_0xab71('0x16')]?_0x3c07b6[_0xab71('0x16')]['include']?_['map'](_0x3c07b6[_0xab71('0x16')][_0xab71('0x19')],function(_0xc5c651){return{'model':db[_0xc5c651[_0xab71('0x1a')]],'as':_0xc5c651['as'],'attributes':_0xc5c651['attributes'],'include':_0xc5c651[_0xab71('0x19')]?_['map'](_0xc5c651['include'],function(_0x2e83e6){return{'model':db[_0x2e83e6[_0xab71('0x1a')]],'as':_0x2e83e6['as'],'attributes':_0x2e83e6['attributes'],'include':_0x2e83e6[_0xab71('0x19')]?_[_0xab71('0x1b')](_0x2e83e6[_0xab71('0x19')],function(_0x59b4fb){return{'model':db[_0x59b4fb['model']],'as':_0x59b4fb['as'],'attributes':_0x59b4fb[_0xab71('0x18')]};}):[]};}):[]};}):[]:[]})[_0xab71('0x1c')](function(_0x495806){logger[_0xab71('0xf')](_0xab71('0x13'),_0x3c07b6);logger['debug'](_0xab71('0x13'),_0x3c07b6,JSON[_0xab71('0xc')](_0x495806));_0x590b4e(_0x495806);})[_0xab71('0x12')](function(_0x5e2a74){logger['error'](_0xab71('0x13'),_0x5e2a74[_0xab71('0xe')],_0x3c07b6);_0x38d311(_0x2547c0[_0xab71('0xd')](0x1f4,_0x5e2a74[_0xab71('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index aae6050..2091706 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 _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x284c4a,_0x314b94){var _0x1e94ce=function(_0x193744){while(--_0x193744){_0x284c4a['push'](_0x284c4a['shift']());}};_0x1e94ce(++_0x314b94);}(_0x5fab,0x177));var _0xb5fa=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x5fab[_0x4a7193];return _0xc33d94;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x559454,_0x128870){var _0x575679=function(_0x468268){while(--_0x468268){_0x559454['push'](_0x559454['shift']());}};_0x575679(++_0x128870);}(_0x5fc3,0xa8));var _0x35fc=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x5fc3[_0x374ada];return _0x449ed8;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 85f0854..c23a0ae 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 _0x3eb8=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','BOOLEAN'];(function(_0x21ccce,_0x8cf90d){var _0x1d2351=function(_0x18be00){while(--_0x18be00){_0x21ccce['push'](_0x21ccce['shift']());}};_0x1d2351(++_0x8cf90d);}(_0x3eb8,0x16a));var _0x83eb=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x3eb8[_0x172747];return _0x509692;};'use strict';var Sequelize=require(_0x83eb('0x0'));var rs=require(_0x83eb('0x1'));module[_0x83eb('0x2')]={'name':{'type':Sequelize[_0x83eb('0x3')],'unique':_0x83eb('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x83eb('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x83eb('0x5')]();}},'phone':{'type':Sequelize[_0x83eb('0x3')]},'type':{'type':Sequelize[_0x83eb('0x6')]('twilio','skebby',_0x83eb('0x7'),'clicksend',_0x83eb('0x8'),_0x83eb('0x9'),_0x83eb('0xa'),_0x83eb('0xb'),_0x83eb('0xc'),_0x83eb('0xd'))},'accountSid':{'type':Sequelize[_0x83eb('0x3')]},'authId':{'type':Sequelize[_0x83eb('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x83eb('0x3')]},'password':{'type':Sequelize[_0x83eb('0x3')]},'apiKey':{'type':Sequelize[_0x83eb('0x3')]},'applicationId':{'type':Sequelize[_0x83eb('0x3')]},'accountId':{'type':Sequelize[_0x83eb('0x3')]},'senderString':{'type':Sequelize[_0x83eb('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x83eb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x83eb('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x83eb('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x83eb('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![],'comment':_0x83eb('0x11'),'set':function(_0x20b47b){if(!_0x20b47b)this[_0x83eb('0x12')](_0x83eb('0x13'),null);this[_0x83eb('0x12')](_0x83eb('0x14'),_0x20b47b);}}}; \ No newline at end of file +var _0x7652=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer'];(function(_0x17f959,_0x2fe52a){var _0x48e714=function(_0x1034af){while(--_0x1034af){_0x17f959['push'](_0x17f959['shift']());}};_0x48e714(++_0x2fe52a);}(_0x7652,0x14a));var _0x2765=function(_0x20a761,_0x2ffd85){_0x20a761=_0x20a761-0x0;var _0x284a38=_0x7652[_0x20a761];return _0x284a38;};'use strict';var Sequelize=require(_0x2765('0x0'));var rs=require(_0x2765('0x1'));module['exports']={'name':{'type':Sequelize[_0x2765('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2765('0x3')]();}},'phone':{'type':Sequelize[_0x2765('0x2')]},'type':{'type':Sequelize[_0x2765('0x4')](_0x2765('0x5'),_0x2765('0x6'),_0x2765('0x7'),_0x2765('0x8'),_0x2765('0x9'),_0x2765('0xa'),_0x2765('0xb'),_0x2765('0xc'),_0x2765('0xd'),_0x2765('0xe'))},'accountSid':{'type':Sequelize[_0x2765('0x2')]},'authId':{'type':Sequelize[_0x2765('0x2')]},'authToken':{'type':Sequelize[_0x2765('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x2765('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2765('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x2765('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x2765('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x2765('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2765('0x10')],'defaultValue':function(){return _0x2765('0x11');}},'notificationSound':{'type':Sequelize[_0x2765('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2765('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2765('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2765('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2765('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2765('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2765('0x12')],'comment':_0x2765('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x2765('0xf')],'defaultValue':![],'comment':_0x2765('0x14'),'set':function(_0x264651){if(!_0x264651)this[_0x2765('0x15')]('mandatoryDispositionPauseId',null);this[_0x2765('0x15')](_0x2765('0x16'),_0x264651);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 777dc5b..8cd709a 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 _0xbcc6=['rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','ValidationError','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','text','MessageUUID','infobip','results','originatingAddress','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','interaction','created','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','SmsInteraction','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','message_id','status_code','groupName','redif','DELIVERED','update','error_code','DELIVERED_TO_GATEWAY','DELIVRD','csc','message-id','state','addAgents','spread','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','SmsAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition'];(function(_0x326492,_0x34425e){var _0x1175b6=function(_0x3c1ca6){while(--_0x3c1ca6){_0x326492['push'](_0x326492['shift']());}};_0x1175b6(++_0x34425e);}(_0xbcc6,0x75));var _0x6bcc=function(_0x39783a,_0x3d1895){_0x39783a=_0x39783a-0x0;var _0xaf7db5=_0xbcc6[_0x39783a];return _0xaf7db5;};'use strict';var emlformat=require(_0x6bcc('0x0'));var rimraf=require(_0x6bcc('0x1'));var zipdir=require(_0x6bcc('0x2'));var jsonpatch=require(_0x6bcc('0x3'));var rp=require(_0x6bcc('0x4'));var moment=require(_0x6bcc('0x5'));var BPromise=require(_0x6bcc('0x6'));var Mustache=require(_0x6bcc('0x7'));var util=require(_0x6bcc('0x8'));var path=require(_0x6bcc('0x9'));var sox=require(_0x6bcc('0xa'));var csv=require(_0x6bcc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bcc('0xc'));var _=require(_0x6bcc('0xd'));var squel=require(_0x6bcc('0xe'));var crypto=require('crypto');var jsforce=require(_0x6bcc('0xf'));var deskjs=require(_0x6bcc('0x10'));var toCsv=require(_0x6bcc('0xb'));var querystring=require(_0x6bcc('0x11'));var Papa=require(_0x6bcc('0x12'));var Redis=require(_0x6bcc('0x13'));var authService=require(_0x6bcc('0x14'));var qs=require(_0x6bcc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bcc('0x16'))('api');var utils=require(_0x6bcc('0x17'));var config=require(_0x6bcc('0x18'));var licenseUtil=require(_0x6bcc('0x19'));var db=require(_0x6bcc('0x1a'))['db'];config['redis']=_['defaults'](config[_0x6bcc('0x1b')],{'host':_0x6bcc('0x1c'),'port':0x18eb});var socket=require(_0x6bcc('0x1d'))(new Redis(config['redis']));require(_0x6bcc('0x1e'))[_0x6bcc('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6bcc('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1e8c76,_0x5b2734,_0x2f2b0c,_0x18125c){return new BPromise(function(_0x2adc51,_0xa95241){var _0x22e456=_0x18125c||client;return _0x22e456[_0x6bcc('0x21')](_0x1e8c76,_0x2f2b0c)[_0x6bcc('0x22')](function(_0x2441e9){logger['info'](_0x6bcc('0x23'),_0x5b2734,_0x6bcc('0x24'));logger[_0x6bcc('0x25')](_0x6bcc('0x26'),_0x5b2734,_0x6bcc('0x24'),JSON[_0x6bcc('0x27')](_0x2441e9));if(_0x2441e9[_0x6bcc('0x28')]){if(_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x29')]===0x1f4){logger['error'](_0x6bcc('0x23'),_0x5b2734,_0x2441e9[_0x6bcc('0x28')]['message']);return _0xa95241(_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x2a')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x5b2734,_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x2a')]);return _0x2adc51(_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x2a')]);}else{logger['info'](_0x6bcc('0x23'),_0x5b2734,_0x6bcc('0x24'));_0x2adc51(_0x2441e9[_0x6bcc('0x2b')]['message']);}})[_0x6bcc('0x2c')](function(_0x5661d4){logger[_0x6bcc('0x28')](_0x6bcc('0x23'),_0x5b2734,_0x5661d4);_0xa95241(_0x5661d4);});});}function respondWithStatusCode(_0x54310a,_0x5860dc){_0x5860dc=_0x5860dc||0xcc;return function(_0x244511){if(_0x244511){return _0x54310a[_0x6bcc('0x2d')](_0x5860dc);}return _0x54310a[_0x6bcc('0x2e')](_0x5860dc)['end']();};}function respondWithResult(_0x3ba518,_0x28c73a){_0x28c73a=_0x28c73a||0xc8;return function(_0x411bec){if(_0x411bec){return _0x3ba518[_0x6bcc('0x2e')](_0x28c73a)['json'](_0x411bec);}};}function respondWithFilteredResult(_0x23ea28,_0xd45ae5){return function(_0xdcb904){if(_0xdcb904){var _0x2566b4=typeof _0xd45ae5[_0x6bcc('0x2f')]==='undefined'&&typeof _0xd45ae5[_0x6bcc('0x30')]===_0x6bcc('0x31');var _0x287169=_0xdcb904[_0x6bcc('0x32')];var _0x413622=_0x2566b4?0x0:_0xd45ae5[_0x6bcc('0x2f')];var _0x1eb0cc=_0x2566b4?_0xdcb904[_0x6bcc('0x32')]:_0xd45ae5['offset']+_0xd45ae5[_0x6bcc('0x30')];var _0x26dcf4;if(_0x1eb0cc>=_0x287169){_0x1eb0cc=_0x287169;_0x26dcf4=0xc8;}else{_0x26dcf4=0xce;}_0x23ea28[_0x6bcc('0x2e')](_0x26dcf4);return _0x23ea28[_0x6bcc('0x33')](_0x6bcc('0x34'),_0x413622+'-'+_0x1eb0cc+'/'+_0x287169)[_0x6bcc('0x35')](_0xdcb904);}return null;};}function patchUpdates(_0x35be84){return function(_0x1a95bf){try{jsonpatch[_0x6bcc('0x36')](_0x1a95bf,_0x35be84,!![]);}catch(_0x57dea6){return BPromise[_0x6bcc('0x37')](_0x57dea6);}return _0x1a95bf[_0x6bcc('0x38')]();};}function saveUpdates(_0x53b0e7,_0x595081){return function(_0x3de2c0){if(_0x3de2c0){return _0x3de2c0['update'](_0x53b0e7)['then'](function(_0x2ba049){return _0x2ba049;});}return null;};}function removeEntity(_0xac8f87,_0x1d50c5){return function(_0x3730c7){if(_0x3730c7){return _0x3730c7['destroy']()['then'](function(){var _0x419c34=_0x3730c7['get']({'plain':!![]});var _0x40e693=_0x6bcc('0x39');return db[_0x6bcc('0x3a')][_0x6bcc('0x3b')]({'where':{'type':_0x40e693,'resourceId':_0x419c34['id']}})[_0x6bcc('0x22')](function(){return _0x3730c7;});})[_0x6bcc('0x22')](function(){_0xac8f87[_0x6bcc('0x2e')](0xcc)[_0x6bcc('0x3c')]();});}};}function handleEntityNotFound(_0x299c87,_0xb7b83b){return function(_0x867bb8){if(!_0x867bb8){_0x299c87[_0x6bcc('0x2d')](0x194);}return _0x867bb8;};}function handleError(_0x23ae11,_0x27a268){_0x27a268=_0x27a268||0x1f4;return function(_0x544e6f){logger[_0x6bcc('0x28')](_0x544e6f[_0x6bcc('0x3d')]);if(_0x544e6f[_0x6bcc('0x3e')]){delete _0x544e6f[_0x6bcc('0x3e')];}_0x23ae11['status'](_0x27a268)[_0x6bcc('0x3f')](_0x544e6f);};}exports[_0x6bcc('0x40')]=function(_0xc438cb,_0x1eccf9){var _0x286c35={'include':[{'model':db[_0x6bcc('0x41')],'as':_0x6bcc('0x42')}]},_0x50812c={},_0x53b42b={'count':0x0,'rows':[]};var _0x5c222f=_['map'](db[_0x6bcc('0x43')][_0x6bcc('0x44')],function(_0x596bb0){return{'name':_0x596bb0['fieldName'],'type':_0x596bb0['type'][_0x6bcc('0x45')]};});_0x50812c[_0x6bcc('0x46')]=_[_0x6bcc('0x47')](_0x5c222f,_0x6bcc('0x3e'));_0x50812c[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0xc438cb[_0x6bcc('0x48')]);_0x50812c[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x50812c[_0x6bcc('0x46')],_0x50812c[_0x6bcc('0x48')]);_0x286c35[_0x6bcc('0x4c')]=_['intersection'](_0x50812c[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x4d')]));_0x286c35[_0x6bcc('0x4c')]=_0x286c35[_0x6bcc('0x4c')][_0x6bcc('0x4e')]?_0x286c35[_0x6bcc('0x4c')]:_0x50812c['model'];if(!_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x4f')]('nolimit')){_0x286c35[_0x6bcc('0x30')]=qs[_0x6bcc('0x30')](_0xc438cb[_0x6bcc('0x48')]['limit']);_0x286c35['offset']=qs[_0x6bcc('0x2f')](_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x2f')]);}_0x286c35[_0x6bcc('0x50')]=qs[_0x6bcc('0x51')](_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x51')]);_0x286c35[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0xc438cb[_0x6bcc('0x48')],_0x50812c['filters']),_0x5c222f);if(_0xc438cb['query'][_0x6bcc('0x54')]){_0x286c35[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x286c35[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0x5c222f,function(_0x323e96){if(_0x323e96[_0x6bcc('0x56')]!=='VIRTUAL'){var _0x36feb9={};_0x36feb9[_0x323e96[_0x6bcc('0x3e')]]={'$like':'%'+_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x36feb9;}})});}_0x286c35=_['merge']({},_0x286c35,_0xc438cb[_0x6bcc('0x57')]);var _0x24d157={'where':_0x286c35[_0x6bcc('0x52')]};return db[_0x6bcc('0x43')][_0x6bcc('0x32')](_0x24d157)[_0x6bcc('0x22')](function(_0x6cab0e){_0x53b42b['count']=_0x6cab0e;if(_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x58')]){_0x286c35[_0x6bcc('0x59')]=[{'all':!![]}];}return db[_0x6bcc('0x43')][_0x6bcc('0x5a')](_0x286c35);})[_0x6bcc('0x22')](function(_0x3e237a){_0x53b42b['rows']=_0x3e237a;return _0x53b42b;})[_0x6bcc('0x22')](respondWithFilteredResult(_0x1eccf9,_0x286c35))[_0x6bcc('0x2c')](handleError(_0x1eccf9,null));};exports[_0x6bcc('0x5b')]=function(_0x310050,_0xf4f8e2){var _0x3c25f2={'raw':![],'where':{'id':_0x310050['params']['id']},'include':[{'model':db[_0x6bcc('0x41')],'as':_0x6bcc('0x42')}]},_0x447520={};_0x447520[_0x6bcc('0x46')]=_['keys'](db[_0x6bcc('0x43')][_0x6bcc('0x44')]);_0x447520[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x310050[_0x6bcc('0x48')]);_0x447520[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x447520['model'],_0x447520[_0x6bcc('0x48')]);_0x3c25f2[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x447520[_0x6bcc('0x46')],qs['fields'](_0x310050['query'][_0x6bcc('0x4d')]));_0x3c25f2[_0x6bcc('0x4c')]=_0x3c25f2[_0x6bcc('0x4c')]['length']?_0x3c25f2[_0x6bcc('0x4c')]:_0x447520[_0x6bcc('0x46')];if(_0x310050['query'][_0x6bcc('0x58')]){_0x3c25f2[_0x6bcc('0x59')]=[{'all':!![]}];}_0x3c25f2=_[_0x6bcc('0x55')]({},_0x3c25f2,_0x310050[_0x6bcc('0x57')]);return db[_0x6bcc('0x43')][_0x6bcc('0x5c')](_0x3c25f2)[_0x6bcc('0x22')](handleEntityNotFound(_0xf4f8e2,null))[_0x6bcc('0x22')](respondWithResult(_0xf4f8e2,null))['catch'](handleError(_0xf4f8e2,null));};exports['create']=function(_0x19ed6b,_0xe50d2a){return db['SmsAccount'][_0x6bcc('0x5d')](_0x19ed6b[_0x6bcc('0x5e')],{})[_0x6bcc('0x22')](function(_0x2520e7){var _0x594ab2=_0x19ed6b[_0x6bcc('0x5f')][_0x6bcc('0x60')]({'plain':!![]});if(!_0x594ab2)throw new Error(_0x6bcc('0x61'));if(_0x594ab2[_0x6bcc('0x62')]===_0x6bcc('0x5f')){var _0x1f81b8=_0x2520e7[_0x6bcc('0x60')]({'plain':!![]});var _0x1ed696=_0x6bcc('0x39');return db['UserProfileSection'][_0x6bcc('0x5c')]({'where':{'name':_0x1ed696,'userProfileId':_0x594ab2[_0x6bcc('0x63')]},'raw':!![]})[_0x6bcc('0x22')](function(_0x1f7341){if(_0x1f7341&&_0x1f7341[_0x6bcc('0x64')]===0x0){return db[_0x6bcc('0x3a')][_0x6bcc('0x5d')]({'name':_0x1f81b8[_0x6bcc('0x3e')],'resourceId':_0x1f81b8['id'],'type':_0x1f7341[_0x6bcc('0x3e')],'sectionId':_0x1f7341['id']},{})['then'](function(){return _0x2520e7;});}else{return _0x2520e7;}})[_0x6bcc('0x2c')](function(_0x2e7ebf){logger[_0x6bcc('0x28')](_0x6bcc('0x65'),_0x2e7ebf);throw _0x2e7ebf;});}return _0x2520e7;})[_0x6bcc('0x22')](respondWithResult(_0xe50d2a,0xc9))[_0x6bcc('0x2c')](handleError(_0xe50d2a,null));};exports['update']=function(_0x547bf0,_0x58c8fb){if(_0x547bf0['body']['id']){delete _0x547bf0[_0x6bcc('0x5e')]['id'];}return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x547bf0[_0x6bcc('0x66')]['id']},'include':[{'model':db['Pause'],'as':_0x6bcc('0x42')}]})[_0x6bcc('0x22')](handleEntityNotFound(_0x58c8fb,null))[_0x6bcc('0x22')](saveUpdates(_0x547bf0[_0x6bcc('0x5e')],null))[_0x6bcc('0x22')](respondWithResult(_0x58c8fb,null))[_0x6bcc('0x2c')](handleError(_0x58c8fb,null));};exports[_0x6bcc('0x3b')]=function(_0x4832b6,_0x4f6224){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x4832b6[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x4f6224,null))['then'](removeEntity(_0x4f6224,null))[_0x6bcc('0x2c')](handleError(_0x4f6224,null));};exports[_0x6bcc('0x67')]=function(_0x42b2c8,_0x50ebde){return db[_0x6bcc('0x43')][_0x6bcc('0x67')]()[_0x6bcc('0x22')](respondWithResult(_0x50ebde,null))[_0x6bcc('0x2c')](handleError(_0x50ebde,null));};exports[_0x6bcc('0x68')]=function(_0x327b0d,_0x184d1c,_0x3174c5){if(_0x327b0d['body']['id']){delete _0x327b0d['body']['id'];}return db['SmsAccount'][_0x6bcc('0x5c')]({'where':{'id':_0x327b0d[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x184d1c,null))['then'](function(_0x5487e2){if(_0x5487e2){_0x327b0d[_0x6bcc('0x5e')][_0x6bcc('0x69')]=_0x5487e2['id'];return db['Disposition'][_0x6bcc('0x5d')](_0x327b0d[_0x6bcc('0x5e')]);}})[_0x6bcc('0x22')](respondWithResult(_0x184d1c,null))[_0x6bcc('0x2c')](handleError(_0x184d1c,null));};exports[_0x6bcc('0x6a')]=function(_0x192f02,_0x32def8,_0x1ea97e){var _0x282f6c={'raw':![],'where':{}};var _0x2c6db4={};var _0x32cb88={'count':0x0,'rows':[]};return db[_0x6bcc('0x43')][_0x6bcc('0x6b')]({'where':{'id':_0x192f02['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x32def8,null))['then'](function(_0x4580ca){if(_0x4580ca){_0x2c6db4['model']=_['keys'](db[_0x6bcc('0x6c')][_0x6bcc('0x44')]);_0x2c6db4['query']=_[_0x6bcc('0x49')](_0x192f02[_0x6bcc('0x48')]);_0x2c6db4[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x2c6db4[_0x6bcc('0x46')],_0x2c6db4['query']);_0x282f6c[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x2c6db4['model'],qs[_0x6bcc('0x4d')](_0x192f02[_0x6bcc('0x48')]['fields']));_0x282f6c['attributes']=_0x282f6c[_0x6bcc('0x4c')]['length']?_0x282f6c[_0x6bcc('0x4c')]:_0x2c6db4[_0x6bcc('0x46')];if(!_0x192f02['query'][_0x6bcc('0x4f')]('nolimit')){_0x282f6c[_0x6bcc('0x30')]=qs['limit'](_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x282f6c[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x192f02[_0x6bcc('0x48')]['offset']);}_0x282f6c[_0x6bcc('0x50')]=qs[_0x6bcc('0x51')](_0x192f02['query'][_0x6bcc('0x51')]);_0x282f6c[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x192f02[_0x6bcc('0x48')],_0x2c6db4[_0x6bcc('0x4a')]));_0x282f6c[_0x6bcc('0x52')][_0x6bcc('0x69')]=_0x4580ca['id'];if(_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x282f6c[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x282f6c['where'],{'$or':_[_0x6bcc('0x47')](_0x282f6c['attributes'],function(_0x8049e8){var _0x26fa10={};_0x26fa10[_0x8049e8]={'$like':'%'+_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x26fa10;})});}_0x282f6c=_['merge']({},_0x282f6c,_0x192f02[_0x6bcc('0x57')]);return db[_0x6bcc('0x6c')][_0x6bcc('0x32')]({'where':_0x282f6c[_0x6bcc('0x52')]})[_0x6bcc('0x22')](function(_0x147867){_0x32cb88[_0x6bcc('0x32')]=_0x147867;if(_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x58')]){_0x282f6c['include']=[{'all':!![]}];}return db[_0x6bcc('0x6c')]['findAll'](_0x282f6c);})[_0x6bcc('0x22')](function(_0xac9098){_0x32cb88[_0x6bcc('0x6d')]=_0xac9098;return _0x32cb88;});}})[_0x6bcc('0x22')](respondWithFilteredResult(_0x32def8,_0x282f6c))[_0x6bcc('0x2c')](handleError(_0x32def8,null));};exports[_0x6bcc('0x6e')]=function(_0x65752e,_0x293c41,_0x3f8fa5){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x65752e['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x293c41,null))[_0x6bcc('0x22')](function(_0x5bb9a9){if(_0x5bb9a9){return _0x5bb9a9[_0x6bcc('0x6e')](_0x65752e[_0x6bcc('0x48')][_0x6bcc('0x6f')]);}})[_0x6bcc('0x22')](respondWithStatusCode(_0x293c41,null))[_0x6bcc('0x2c')](handleError(_0x293c41,null));};exports[_0x6bcc('0x70')]=function(_0x50baf5,_0x2d73fd,_0x348d19){if(_0x50baf5[_0x6bcc('0x5e')]['id']){delete _0x50baf5[_0x6bcc('0x5e')]['id'];}return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x50baf5['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x2d73fd,null))[_0x6bcc('0x22')](function(_0x30bd56){if(_0x30bd56){_0x50baf5[_0x6bcc('0x5e')][_0x6bcc('0x69')]=_0x30bd56['id'];return db['CannedAnswer']['create'](_0x50baf5[_0x6bcc('0x5e')]);}})[_0x6bcc('0x22')](respondWithResult(_0x2d73fd,null))[_0x6bcc('0x2c')](handleError(_0x2d73fd,null));};exports[_0x6bcc('0x71')]=function(_0x19c609,_0x2ee659,_0x5c1937){var _0x5252ca={'raw':![],'where':{}};var _0x4c1f8f={};var _0x4aa14a={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x19c609['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x2ee659,null))[_0x6bcc('0x22')](function(_0x170008){if(_0x170008){_0x4c1f8f[_0x6bcc('0x46')]=_[_0x6bcc('0x49')](db[_0x6bcc('0x72')][_0x6bcc('0x44')]);_0x4c1f8f[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x19c609[_0x6bcc('0x48')]);_0x4c1f8f[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x4c1f8f[_0x6bcc('0x46')],_0x4c1f8f[_0x6bcc('0x48')]);_0x5252ca[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x4c1f8f['model'],qs['fields'](_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x4d')]));_0x5252ca[_0x6bcc('0x4c')]=_0x5252ca[_0x6bcc('0x4c')]['length']?_0x5252ca[_0x6bcc('0x4c')]:_0x4c1f8f[_0x6bcc('0x46')];if(!_0x19c609['query']['hasOwnProperty'](_0x6bcc('0x73'))){_0x5252ca[_0x6bcc('0x30')]=qs[_0x6bcc('0x30')](_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x5252ca[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x19c609[_0x6bcc('0x48')]['offset']);}_0x5252ca[_0x6bcc('0x50')]=qs['sort'](_0x19c609['query'][_0x6bcc('0x51')]);_0x5252ca[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x19c609[_0x6bcc('0x48')],_0x4c1f8f[_0x6bcc('0x4a')]));_0x5252ca['where'][_0x6bcc('0x69')]=_0x170008['id'];if(_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x5252ca[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x5252ca[_0x6bcc('0x52')],{'$or':_['map'](_0x5252ca['attributes'],function(_0x584b48){var _0x34b399={};_0x34b399[_0x584b48]={'$like':'%'+_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x34b399;})});}_0x5252ca=_[_0x6bcc('0x55')]({},_0x5252ca,_0x19c609[_0x6bcc('0x57')]);return db[_0x6bcc('0x72')][_0x6bcc('0x32')]({'where':_0x5252ca[_0x6bcc('0x52')]})[_0x6bcc('0x22')](function(_0x189b65){_0x4aa14a[_0x6bcc('0x32')]=_0x189b65;if(_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x58')]){_0x5252ca[_0x6bcc('0x59')]=[{'all':!![]}];}return db[_0x6bcc('0x72')][_0x6bcc('0x5a')](_0x5252ca);})[_0x6bcc('0x22')](function(_0x28f62a){_0x4aa14a[_0x6bcc('0x6d')]=_0x28f62a;return _0x4aa14a;});}})['then'](respondWithFilteredResult(_0x2ee659,_0x5252ca))[_0x6bcc('0x2c')](handleError(_0x2ee659,null));};exports[_0x6bcc('0x74')]=function(_0x34746b,_0x8984c7,_0x1d31b1){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x34746b[_0x6bcc('0x66')]['id']}})['then'](handleEntityNotFound(_0x8984c7,null))['then'](function(_0x36b2ec){if(_0x36b2ec){return _0x36b2ec[_0x6bcc('0x74')](_0x34746b[_0x6bcc('0x48')][_0x6bcc('0x6f')]);}})[_0x6bcc('0x22')](respondWithStatusCode(_0x8984c7,null))[_0x6bcc('0x2c')](handleError(_0x8984c7,null));};exports[_0x6bcc('0x75')]=function(_0x30209a,_0x3a6007,_0x3d94dc){var _0x25c57f={'channel':_0x6bcc('0x76')};var _0x738865=[];var _0x33e2e8=[];var _0x2446c1={};return db['SmsAccount']['find']({'where':{'id':_0x30209a[_0x6bcc('0x66')]['id']},'include':[{'model':db[_0x6bcc('0x77')],'as':_0x6bcc('0x78')}]})[_0x6bcc('0x22')](handleEntityNotFound(_0x3a6007,null))[_0x6bcc('0x22')](function(_0x5def45){_0x25c57f[_0x6bcc('0x79')]=_0x5def45;_0x25c57f[_0x6bcc('0x7a')]=_['orderBy'](_0x5def45[_0x6bcc('0x78')],[_0x6bcc('0x7b')],['asc']);if(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x78')]){delete _0x25c57f['account'][_0x6bcc('0x78')];}return db[_0x6bcc('0x7c')][_0x6bcc('0x67')]();})['then'](function(_0x3bf184){if(!_0x3bf184){throw new db['Sequelize'][(_0x6bcc('0x7d'))]('no\x20available\x20attributes');}_0x738865=_['difference'](_['keys'](_0x3bf184),[_0x6bcc('0x7e'),_0x6bcc('0x7f')]);_0x33e2e8=_[_0x6bcc('0x80')](_[_0x6bcc('0x49')](_0x3bf184),[_0x6bcc('0x7e'),_0x6bcc('0x7f'),'CompanyId',_0x6bcc('0x81')]);_0x25c57f['body']={'mapKey':_0x6bcc('0x82')};if(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x56')]){switch(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x56')]){case _0x6bcc('0x83'):_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x85')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['Body'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x87')];break;case _0x6bcc('0x88'):_0x25c57f['body'][_0x6bcc('0x84')]='+'+_0x30209a['body'][_0x6bcc('0x89')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x8a')];break;case'connectel':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')]['from'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['message'];break;case'clicksend':_0x25c57f[_0x6bcc('0x5e')]['from']=_0x30209a['body'][_0x6bcc('0x84')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x5e')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')]['message_id'];break;case'plivo':_0x25c57f['body'][_0x6bcc('0x84')]=_0x30209a['body'][_0x6bcc('0x85')];_0x25c57f[_0x6bcc('0x5e')]['body']=_0x30209a[_0x6bcc('0x5e')]['Text'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a['body'][_0x6bcc('0x8b')];break;case _0x6bcc('0x8c'):_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]='+'+_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x8d')][0x0]['from'];_0x25c57f['body'][_0x6bcc('0x5e')]=_0x30209a['body'][_0x6bcc('0x8d')][0x0][_0x6bcc('0x8a')];_0x25c57f['body']['messageId']=_0x30209a[_0x6bcc('0x5e')]['results'][0x0]['messageId'];break;case'csc':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x8e')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['segmentedMessage']['message'];break;case _0x6bcc('0x8f'):_0x25c57f[_0x6bcc('0x5e')]['from']=_0x30209a[_0x6bcc('0x5e')]['fromNumber'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['text'];_0x25c57f['body'][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x90')];break;case _0x6bcc('0x91'):_0x25c57f['body'][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['id'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['from'];_0x25c57f['body'][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][0x0]['message']['text'];break;case _0x6bcc('0x92'):_0x25c57f['body']['from']=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x84')];_0x25c57f['body'][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x2a')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x93')];break;}}if(_0x25c57f['body']['id']){delete _0x25c57f['body']['id'];}if(_[_0x6bcc('0x94')](_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0x96'));}if(_[_0x6bcc('0x94')](_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')])||_0x25c57f[_0x6bcc('0x5e')]['body']===''){throw new db[(_0x6bcc('0x95'))]['ValidationError'](_0x6bcc('0x97'));}if(_['isNil'](_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33e2e8);}if(!_[_0x6bcc('0x99')](_0x33e2e8,_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0x9a')+_0x33e2e8);}_0x2446c1[_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')]]=_0x25c57f[_0x6bcc('0x5e')]['from'];return db[_0x6bcc('0x9b')]['find']({'where':{'id':_0x25c57f['account'][_0x6bcc('0x81')]},'include':[{'model':db[_0x6bcc('0x7c')],'as':_0x6bcc('0x9c'),'where':_0x2446c1,'limit':0x1,'order':[[_0x6bcc('0x7f'),_0x6bcc('0x9d')]]}]});})['then'](handleEntityNotFound(_0x3a6007,null))[_0x6bcc('0x22')](function(_0x3d8fb7){if(_0x3d8fb7){_0x25c57f[_0x6bcc('0x9e')]=_[_0x6bcc('0x9f')](_0x3d8fb7,[_0x6bcc('0x9c')]);if(_0x3d8fb7['Contacts'][_0x6bcc('0x4e')]){return _0x3d8fb7[_0x6bcc('0x9c')][0x0];}var _0x1bc914=_[_0x6bcc('0xa0')](_0x25c57f[_0x6bcc('0x5e')],{'firstName':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')],'ListId':_0x3d8fb7['id']});_0x1bc914[_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')]]=_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')];return db['CmContact'][_0x6bcc('0x5d')](_0x1bc914,{'fields':_0x738865,'raw':!![]});}})['then'](handleEntityNotFound(_0x3a6007,null))[_0x6bcc('0x22')](function(_0x53e625){if(_0x53e625){_0x25c57f[_0x6bcc('0xa1')]=_0x53e625;var _0x26b2eb={'ContactId':_0x53e625['id'],'phone':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')],'SmsAccountId':_0x30209a['params']['id']};var _0x41ab3d={'ContactId':_0x53e625['id'],'SmsAccountId':_0x30209a[_0x6bcc('0x66')]['id'],'closed':![]};return db['SmsInteraction'][_0x6bcc('0x5c')]({'where':_0x41ab3d})[_0x6bcc('0x22')](function(_0xdee287){if(_0xdee287){return[_0xdee287,![]];}return db['SmsInteraction'][_0x6bcc('0x5d')](_0x26b2eb)['then'](function(_0x59071a){return[_0x59071a,!![]];});});}})['spread'](function(_0x531ada,_0x3db38e){_0x25c57f[_0x6bcc('0xa2')]=_0x531ada['get']({'plain':!![]});_0x25c57f['interaction'][_0x6bcc('0xa3')]=![];if(_0x3db38e){if(_0x25c57f['account']['autoclose']){_0x25c57f[_0x6bcc('0x7a')]['push']({'id':0x0,'priority':_0x25c57f[_0x6bcc('0x7a')]['length']+0x1,'app':_0x6bcc('0xa4'),'appdata':'unmanaged','interval':_0x6bcc('0xa5')});}_0x25c57f['interaction'][_0x6bcc('0xa3')]=!![];}return db[_0x6bcc('0xa6')]['create']({'phone':_0x25c57f['body']['from'],'messageId':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')],'body':_0x25c57f['body']['body'],'SmsAccountId':_0x30209a[_0x6bcc('0x66')]['id'],'SmsInteractionId':_0x531ada['id'],'direction':'in','ContactId':_0x531ada[_0x6bcc('0xa7')],'AttachmentId':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0xa8')]});})[_0x6bcc('0x22')](function(_0x28dc0e){_0x25c57f['message']=_0x28dc0e;if(_0x25c57f[_0x6bcc('0xa2')]['UserId']){return db[_0x6bcc('0xa9')][_0x6bcc('0x5c')]({'attributes':['id',_0x6bcc('0x3e')],'where':{'id':_0x25c57f[_0x6bcc('0xa2')][_0x6bcc('0xaa')]}})[_0x6bcc('0x22')](function(_0xe04a77){if(_0xe04a77){_0x25c57f[_0x6bcc('0x7a')][_0x6bcc('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe04a77[_0x6bcc('0x3e')]+','+(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0xac')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6bcc('0xad'),_0x6bcc('0xae'),_0x25c57f);});}return respondWithRpcPromise(_0x6bcc('0xad'),_0x6bcc('0xae'),_0x25c57f);})[_0x6bcc('0x22')](function(_0x5d9205){if(_0x5d9205){var _0x5e6ecd=0xc8;var _0x2960a9=_0x6bcc('0xaf');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2960a9,_0x5e6ecd,_0x6bcc('0xb0'));logger[_0x6bcc('0x25')](_0x6bcc('0xb1'),_0x2960a9,_0x5e6ecd,_0x6bcc('0xb0'),JSON['stringify'](_0x5d9205));if(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x56')]==='twilio'){return _0x3a6007[_0x6bcc('0x2e')](_0x5e6ecd)[_0x6bcc('0x33')]('Content-Type','text/xml')['send'](_0x6bcc('0xb2'));}else{return _0x3a6007[_0x6bcc('0x2e')](_0x5e6ecd)[_0x6bcc('0x35')](_0x5d9205);}}})[_0x6bcc('0x2c')](handleError(_0x3a6007,null));};exports[_0x6bcc('0xb3')]=function(_0x5e1472,_0x1d4bc1){var _0x58ec0c=_0x5e1472[_0x6bcc('0x66')]['id'];var _0x2fd226=_0x5e1472[_0x6bcc('0x5e')];var _0x202ef1=0xc8;var _0x379fe2=null;return db[_0x6bcc('0xb4')]['transaction']({'isolationLevel':db[_0x6bcc('0xb4')][_0x6bcc('0xb5')]['ISOLATION_LEVELS'][_0x6bcc('0xb6')]},function(_0x59885b){return db[_0x6bcc('0x43')]['findOne']({'where':{'id':_0x58ec0c},'transaction':_0x59885b})[_0x6bcc('0x22')](function(_0x261cce){if(_0x261cce){return db[_0x6bcc('0x77')][_0x6bcc('0x3b')]({'where':{'SmsAccountId':_0x58ec0c},'transaction':_0x59885b})['then'](function(){var _0x8d907a=_[_0x6bcc('0x47')](_0x2fd226,function(_0x5b5aa8){_0x5b5aa8['SmsAccountId']=_0x58ec0c;return _0x5b5aa8;});return db[_0x6bcc('0x77')][_0x6bcc('0xb7')](_0x8d907a,{'transaction':_0x59885b});});}else{_0x202ef1=0x194;_0x379fe2=[];}});})[_0x6bcc('0x22')](function(){if(_0x202ef1!==0x194){return db[_0x6bcc('0x77')][_0x6bcc('0xb8')]({'where':{'SmsAccountId':_0x58ec0c},'order':_0x6bcc('0x7b')})['then'](function(_0x434921){_0x379fe2=_0x434921;});}})[_0x6bcc('0x2c')](function(_0x59f782){_0x202ef1=0x1f4;logger['error'](_0x59f782['stack']);if(_0x59f782[_0x6bcc('0x3e')]){delete _0x59f782[_0x6bcc('0x3e')];}_0x379fe2=_0x59f782;})[_0x6bcc('0xb9')](function(){if(_0x379fe2===null){_0x1d4bc1['sendStatus'](_0x202ef1);}else{if(_0x202ef1===0x1f4){_0x1d4bc1[_0x6bcc('0x2e')](_0x202ef1)[_0x6bcc('0x3f')](_0x379fe2);}else{_0x1d4bc1[_0x6bcc('0x2e')](_0x202ef1)[_0x6bcc('0x35')](_0x379fe2);}}});};exports[_0x6bcc('0xba')]=function(_0x18431b,_0x148359,_0x5d1073){var _0xfe9aa0={};var _0x2e60b1={};var _0x2db096;var _0x58c42a;return db['SmsAccount']['findOne']({'where':{'id':_0x18431b[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x148359,null))[_0x6bcc('0x22')](function(_0x239b28){if(_0x239b28){_0x2db096=_0x239b28;_0x2e60b1[_0x6bcc('0x46')]=_['keys'](db[_0x6bcc('0x77')]['rawAttributes']);_0x2e60b1[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x18431b[_0x6bcc('0x48')]);_0x2e60b1[_0x6bcc('0x4a')]=_['intersection'](_0x2e60b1[_0x6bcc('0x46')],_0x2e60b1[_0x6bcc('0x48')]);_0xfe9aa0['attributes']=_[_0x6bcc('0x4b')](_0x2e60b1[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0x18431b['query'][_0x6bcc('0x4d')]));_0xfe9aa0[_0x6bcc('0x4c')]=_0xfe9aa0[_0x6bcc('0x4c')][_0x6bcc('0x4e')]?_0xfe9aa0[_0x6bcc('0x4c')]:_0x2e60b1[_0x6bcc('0x46')];_0xfe9aa0[_0x6bcc('0x50')]=qs[_0x6bcc('0x51')](_0x18431b['query'][_0x6bcc('0x51')]);_0xfe9aa0['where']=qs[_0x6bcc('0x4a')](_['pick'](_0x18431b['query'],_0x2e60b1[_0x6bcc('0x4a')]));if(_0x18431b['query'][_0x6bcc('0x54')]){_0xfe9aa0[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0xfe9aa0[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0xfe9aa0[_0x6bcc('0x4c')],function(_0x228b75){var _0xc0cc49={};_0xc0cc49[_0x228b75]={'$like':'%'+_0x18431b[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0xc0cc49;})});}_0xfe9aa0=_[_0x6bcc('0x55')]({},_0xfe9aa0,_0x18431b['options']);return _0x2db096[_0x6bcc('0xba')](_0xfe9aa0);}})['then'](function(_0x29687a){if(_0x29687a){_0x58c42a=_0x29687a['length'];if(!_0x18431b['query'][_0x6bcc('0x4f')](_0x6bcc('0x73'))){_0xfe9aa0[_0x6bcc('0x30')]=qs['limit'](_0x18431b[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0xfe9aa0[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x18431b[_0x6bcc('0x48')]['offset']);}return _0x2db096['getApplications'](_0xfe9aa0);}})[_0x6bcc('0x22')](function(_0xe78fc2){if(_0xe78fc2){return _0xe78fc2?{'count':_0x58c42a,'rows':_0xe78fc2}:null;}})['then'](respondWithResult(_0x148359,null))[_0x6bcc('0x2c')](handleError(_0x148359,null));};exports[_0x6bcc('0xbb')]=function(_0x533cc9,_0x59ba0a,_0x587d85){var _0x4a8c2a={'raw':![],'where':{}};var _0x253344={};var _0x55f229={'count':0x0,'rows':[]};return db[_0x6bcc('0x43')][_0x6bcc('0x6b')]({'where':{'id':_0x533cc9[_0x6bcc('0x66')]['id']}})['then'](handleEntityNotFound(_0x59ba0a,null))[_0x6bcc('0x22')](function(_0x444349){if(_0x444349){_0x253344['model']=_['keys'](db[_0x6bcc('0xbc')][_0x6bcc('0x44')]);_0x253344[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x533cc9[_0x6bcc('0x48')]);_0x253344[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x253344[_0x6bcc('0x46')],_0x253344[_0x6bcc('0x48')]);_0x4a8c2a[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x253344[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0x533cc9['query'][_0x6bcc('0x4d')]));_0x4a8c2a[_0x6bcc('0x4c')]=_0x4a8c2a[_0x6bcc('0x4c')][_0x6bcc('0x4e')]?_0x4a8c2a[_0x6bcc('0x4c')]:_0x253344[_0x6bcc('0x46')];if(!_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x4f')](_0x6bcc('0x73'))){_0x4a8c2a[_0x6bcc('0x30')]=qs['limit'](_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x4a8c2a[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x533cc9[_0x6bcc('0x48')]['offset']);}_0x4a8c2a[_0x6bcc('0x50')]=qs['sort'](_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x51')]);_0x4a8c2a[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x533cc9['query'],_0x253344[_0x6bcc('0x4a')]));_0x4a8c2a[_0x6bcc('0x52')][_0x6bcc('0x69')]=_0x444349['id'];if(_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x4a8c2a[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x4a8c2a[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0x4a8c2a[_0x6bcc('0x4c')],function(_0x2e914d){var _0x365fe7={};_0x365fe7[_0x2e914d]={'$like':'%'+_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x365fe7;})});}_0x4a8c2a=_[_0x6bcc('0x55')]({},_0x4a8c2a,_0x533cc9[_0x6bcc('0x57')]);return db[_0x6bcc('0xbc')][_0x6bcc('0x32')]({'where':_0x4a8c2a[_0x6bcc('0x52')]})['then'](function(_0x25809e){_0x55f229[_0x6bcc('0x32')]=_0x25809e;if(_0x533cc9['query'][_0x6bcc('0x58')]){_0x4a8c2a[_0x6bcc('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x6bcc('0x3e'),_0x6bcc('0xbd'),'internal'],'required':![]},{'model':db[_0x6bcc('0xbe')],'as':_0x6bcc('0xbf'),'attributes':['id','name',_0x6bcc('0xc0')],'where':_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0xc1')]?{'id':_0x533cc9[_0x6bcc('0x48')]['tag']}:undefined,'required':_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0xc1')]?!![]:![]}];}return db['SmsInteraction'][_0x6bcc('0x5a')](_0x4a8c2a);})[_0x6bcc('0x22')](function(_0x4a8dd2){_0x55f229[_0x6bcc('0x6d')]=_0x4a8dd2;return _0x55f229;});}})[_0x6bcc('0x22')](respondWithFilteredResult(_0x59ba0a,_0x4a8c2a))['catch'](handleError(_0x59ba0a,null));};exports[_0x6bcc('0x3f')]=function(_0x4de6db,_0x2f8d85,_0x54e3b2){var _0x4c428e,_0x1409d4,_0x145289;if(_['isNil'](_0x4de6db['body'][_0x6bcc('0x5e')])||_0x4de6db[_0x6bcc('0x5e')][_0x6bcc('0x5e')]===''){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0x97'));}if(_[_0x6bcc('0x94')](_0x4de6db[_0x6bcc('0x5e')]['to'])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0xc2'));}_0x4c428e=_0x4de6db[_0x6bcc('0x5e')]['to'];return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x4de6db[_0x6bcc('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0x6bcc('0xc3'),'include':[{'model':db[_0x6bcc('0x7c')],'as':_0x6bcc('0x9c'),'where':{'mobile':_0x4c428e},'limit':0x1,'order':[[_0x6bcc('0x7f'),'DESC']]}]}]})[_0x6bcc('0x22')](handleEntityNotFound(_0x2f8d85,null))[_0x6bcc('0x22')](function(_0x1f8a24){if(_0x1f8a24&&_0x1f8a24[_0x6bcc('0xc3')]){_0x1409d4=_0x1f8a24['get']({'plain':!![]});if(_0x1409d4[_0x6bcc('0xc3')]&&_0x1409d4[_0x6bcc('0xc3')][_0x6bcc('0x9c')][_0x6bcc('0x4e')]){return _0x1409d4['List'][_0x6bcc('0x9c')][0x0];}return db[_0x6bcc('0x7c')][_0x6bcc('0x5d')](_[_0x6bcc('0xa0')](_0x4de6db[_0x6bcc('0x5e')],{'firstName':_0x4c428e,'mobile':_0x4c428e,'phone':_0x4c428e,'ListId':_0x1409d4[_0x6bcc('0x81')]}));}})[_0x6bcc('0x22')](handleEntityNotFound(_0x2f8d85,null))[_0x6bcc('0x22')](function(_0xae40e2){if(_0xae40e2){_0x145289=_0xae40e2;return db['SmsInteraction']['find']({'where':{'ContactId':_0x145289['id'],'closed':![],'SmsAccountId':_0x1409d4['id']}})['then'](function(_0x1b647a){if(_0x1b647a){return[_0x1b647a,![]];}return db[_0x6bcc('0xbc')]['create']({'UserId':_0x4de6db[_0x6bcc('0x5f')]['id'],'ContactId':_0x145289['id'],'SmsAccountId':_0x1409d4['id'],'phone':_0x4c428e,'firstMsgDirection':'out','Messages':[_[_0x6bcc('0x55')](_0x4de6db[_0x6bcc('0x5e')],{'read':![],'body':_0x4de6db[_0x6bcc('0x5e')]['body'],'phone':_0x4c428e,'SmsAccountId':_0x1409d4['id'],'UserId':_0x4de6db[_0x6bcc('0x5f')]['id'],'ContactId':_0x145289['id']})]},{'include':[{'model':db[_0x6bcc('0xa6')],'as':'Messages'}]})[_0x6bcc('0x22')](function(_0x6293bb){return[_0x6293bb,!![]];});});}})['spread'](function(_0x51482a,_0x22abc3){if(_0x22abc3){return _0x51482a;}return db[_0x6bcc('0xa6')][_0x6bcc('0x5d')](_[_0x6bcc('0x55')](_0x4de6db[_0x6bcc('0x5e')],{'read':![],'body':_0x4de6db[_0x6bcc('0x5e')][_0x6bcc('0x5e')],'phone':_0x4c428e,'SmsAccountId':_0x1409d4['id'],'SmsInteractionId':_0x51482a['id'],'UserId':_0x4de6db[_0x6bcc('0x5f')]['id'],'ContactId':_0x145289['id']}))[_0x6bcc('0x22')](function(_0x368ab9){_0x51482a[_0x6bcc('0xc4')][_0x6bcc('0xc5')]=[];_0x51482a[_0x6bcc('0xc4')][_0x6bcc('0xc5')][_0x6bcc('0xc6')](_0x368ab9[_0x6bcc('0xc4')]);return _0x51482a;});})[_0x6bcc('0x22')](respondWithResult(_0x2f8d85,null))['catch'](handleError(_0x2f8d85,null));};exports['status']=function(_0x5a12e8,_0xcf47df,_0xe3de8){if(_0x5a12e8[_0x6bcc('0x5e')]['id']){delete _0x5a12e8[_0x6bcc('0x5e')]['id'];}var _0x2dd022,_0x58e4dd,_0x562415;return db['SmsAccount'][_0x6bcc('0x5c')]({'where':{'id':_0x5a12e8[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0xcf47df,null))['then'](function(_0x723ca9){if(_0x723ca9){_0x562415=_0x723ca9;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6bcc('0xc7'),_0x723ca9['type'],util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));switch(_0x723ca9[_0x6bcc('0x56')]){case _0x6bcc('0x88'):if(_0x5a12e8['body']['skebby_dispatch_id']&&_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')]['status'];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xc9')]}});}break;case _0x6bcc('0xca'):if(_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xcb')]&&_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xcc')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xcc')];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8['body'][_0x6bcc('0xcb')]}});}break;case _0x6bcc('0xcd'):if(_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xce')]&&_0x5a12e8[_0x6bcc('0x5e')]['status_code']){_0x58e4dd=_0x5a12e8['body'][_0x6bcc('0xcf')];return db['SmsMessage'][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xce')]}});}break;case'infobip':var _0x3ec983=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x8d')][0x0];if(_0x3ec983[_0x6bcc('0x86')]&&_0x3ec983[_0x6bcc('0x2e')][_0x6bcc('0xd0')]==='DELIVERED'){_0x58e4dd=_0x3ec983[_0x6bcc('0x2e')]['groupName'];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x3ec983['messageId']}});}break;case'clickatell':if(_0x5a12e8[_0x6bcc('0x5e')]['messageId']&&_0x5a12e8['body'][_0x6bcc('0x2e')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8['body']['messageId']}});}break;case _0x6bcc('0x91'):if(_0x5a12e8[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['id']){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][0x0][_0x6bcc('0x56')];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['id']}});}break;case _0x6bcc('0x92'):if(_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xd1')]&&_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')];return db['SmsMessage'][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')]['redif']}});}break;}}})[_0x6bcc('0x22')](handleEntityNotFound(_0xcf47df,null))[_0x6bcc('0x22')](function(_0x38cf64){if(_0x38cf64){_0x2dd022=_0x38cf64;switch(_0x562415['type']){case _0x6bcc('0x88'):if(_0x58e4dd===_0x6bcc('0xd2')){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6bcc('0x2e'),_0x6bcc('0x88'),util['inspect'](_0x5a12e8['body'],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0xca'):if(_0x58e4dd==='1'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger['error'](_0x6bcc('0x26'),_0x6bcc('0x2e'),_0x6bcc('0x88'),util['inspect'](_0x5a12e8['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xd4')]&&_0x58e4dd>=0xc8&&_0x58e4dd<=0xce){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),_0x6bcc('0x2e'),_0x6bcc('0xcd'),util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0x8c'):var _0x4835d6=_0x5a12e8['body'][_0x6bcc('0x8d')][0x0];if(_0x4835d6[_0x6bcc('0x2e')][_0x6bcc('0xd0')]===_0x6bcc('0xd2')){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),'status',_0x6bcc('0x8c'),util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0x8f'):if(_0x58e4dd==_0x6bcc('0xd5')||_0x58e4dd=='RECEIVED_BY_RECIPIENT'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),_0x6bcc('0x2e'),_0x6bcc('0x8f'),util[_0x6bcc('0xc8')](_0x5a12e8['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x58e4dd=='message-delivered'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),'status',_0x6bcc('0x91'),util['inspect'](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0x92'):if(_0x58e4dd===_0x6bcc('0xd6')||_0x58e4dd==='ACCEPTD'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),'status',_0x6bcc('0x92'),util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2dd022;}})[_0x6bcc('0x22')](respondWithResult(_0xcf47df,null))['catch'](handleError(_0xcf47df,null));};exports['statusGet']=function(_0x1a6722,_0x37e9cb,_0x41e215){var _0x58f0c7,_0x5c3356,_0xe83707;return db[_0x6bcc('0x43')]['find']({'where':{'id':_0x1a6722['params']['id']}})['then'](handleEntityNotFound(_0x37e9cb,null))['then'](function(_0x5dd4b6){if(_0x5dd4b6){_0xe83707=_0x5dd4b6;logger[_0x6bcc('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6bcc('0x2e'),_0x6bcc('0xc7'),_0x5dd4b6[_0x6bcc('0x56')],util[_0x6bcc('0xc8')](_0x1a6722['query'],{'showHidden':![],'depth':null}));switch(_0x5dd4b6[_0x6bcc('0x56')]){case _0x6bcc('0xd7'):if(_0x1a6722[_0x6bcc('0x48')][_0x6bcc('0xd8')]&&_0x1a6722[_0x6bcc('0x48')][_0x6bcc('0xd9')]){_0x5c3356=_0x1a6722['query']['state'];return db[_0x6bcc('0xa6')]['find']({'where':{'messageId':_0x1a6722[_0x6bcc('0x48')]['message-id']}});}break;}}})[_0x6bcc('0x22')](handleEntityNotFound(_0x37e9cb,null))[_0x6bcc('0x22')](function(_0x5ea1e5){if(_0x5ea1e5){_0x58f0c7=_0x5ea1e5;switch(_0xe83707['type']){case _0x6bcc('0xd7'):if(_0x5c3356==='2'||_0x5c3356==='6'){return _0x58f0c7[_0x6bcc('0xd3')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6bcc('0x2e'),_0x6bcc('0xd7'),util[_0x6bcc('0xc8')](_0x1a6722[_0x6bcc('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x58f0c7;}})[_0x6bcc('0x22')](respondWithResult(_0x37e9cb,null))[_0x6bcc('0x2c')](handleError(_0x37e9cb,null));};exports[_0x6bcc('0xda')]=function(_0x2d0baf,_0x321b8b,_0x1e69f1){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x2d0baf[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x321b8b,null))[_0x6bcc('0x22')](function(_0x18951b){if(_0x18951b){return _0x18951b[_0x6bcc('0xda')](_0x2d0baf[_0x6bcc('0x5e')]['ids'],_[_0x6bcc('0x9f')](_0x2d0baf[_0x6bcc('0x5e')],[_0x6bcc('0x6f'),'id'])||{})[_0x6bcc('0xdb')](function(_0x47ac6e){for(var _0x468ca1=0x0;_0x468ca1<_0x2d0baf['body']['ids'][_0x6bcc('0x4e')];_0x468ca1+=0x1){socket[_0x6bcc('0xdc')](_0x6bcc('0xdd'),{'UserId':Number(_0x2d0baf[_0x6bcc('0x5e')][_0x6bcc('0x6f')][_0x468ca1]),'SmsAccountId':Number(_0x2d0baf[_0x6bcc('0x66')]['id'])});}return _0x47ac6e;});}})[_0x6bcc('0x22')](respondWithResult(_0x321b8b,null))['catch'](handleError(_0x321b8b,null));};exports[_0x6bcc('0xde')]=function(_0x990613,_0x386e5b,_0x39252d){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x990613['params']['id']}})['then'](handleEntityNotFound(_0x386e5b,null))[_0x6bcc('0x22')](function(_0x17c976){if(_0x17c976){return _0x17c976[_0x6bcc('0xde')](_0x990613['query'][_0x6bcc('0x6f')])[_0x6bcc('0x22')](function(){if(_[_0x6bcc('0xdf')](_0x990613['query'][_0x6bcc('0x6f')])){for(var _0x3c31e0=0x0;_0x3c31e0<_0x990613[_0x6bcc('0x48')][_0x6bcc('0x6f')][_0x6bcc('0x4e')];_0x3c31e0+=0x1){socket[_0x6bcc('0xdc')](_0x6bcc('0xe0'),{'UserId':Number(_0x990613['query'][_0x6bcc('0x6f')][_0x3c31e0]),'SmsAccountId':Number(_0x990613[_0x6bcc('0x66')]['id'])});}}else{socket[_0x6bcc('0xdc')](_0x6bcc('0xe0'),{'UserId':Number(_0x990613[_0x6bcc('0x48')][_0x6bcc('0x6f')]),'SmsAccountId':Number(_0x990613[_0x6bcc('0x66')]['id'])});}});}})[_0x6bcc('0x22')](respondWithStatusCode(_0x386e5b,null))['catch'](handleError(_0x386e5b,null));};exports[_0x6bcc('0xe1')]=function(_0x12a18f,_0x4a041b,_0x4d79f5){var _0x59fbf3={};var _0xd90962={};var _0x1d9c27;var _0x427c43;return db[_0x6bcc('0x43')][_0x6bcc('0x6b')]({'where':{'id':_0x12a18f[_0x6bcc('0x66')]['id']}})['then'](handleEntityNotFound(_0x4a041b,null))[_0x6bcc('0x22')](function(_0x2dccf9){if(_0x2dccf9){_0x1d9c27=_0x2dccf9;_0xd90962[_0x6bcc('0x46')]=_[_0x6bcc('0x49')](db['User'][_0x6bcc('0x44')]);_0xd90962[_0x6bcc('0x48')]=_['keys'](_0x12a18f[_0x6bcc('0x48')]);_0xd90962[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0xd90962[_0x6bcc('0x46')],_0xd90962['query']);_0x59fbf3[_0x6bcc('0x4c')]=_['intersection'](_0xd90962[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x4d')]));_0x59fbf3[_0x6bcc('0x4c')]=_0x59fbf3[_0x6bcc('0x4c')]['length']?_0x59fbf3[_0x6bcc('0x4c')]:_0xd90962[_0x6bcc('0x46')];_0x59fbf3[_0x6bcc('0x50')]=qs['sort'](_0x12a18f['query']['sort']);_0x59fbf3[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x12a18f[_0x6bcc('0x48')],_0xd90962[_0x6bcc('0x4a')]));if(_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x59fbf3['where']=_['merge'](_0x59fbf3[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0x59fbf3[_0x6bcc('0x4c')],function(_0x52e214){var _0x511c7a={};_0x511c7a[_0x52e214]={'$like':'%'+_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x511c7a;})});}_0x59fbf3=_[_0x6bcc('0x55')]({},_0x59fbf3,_0x12a18f[_0x6bcc('0x57')]);return _0x1d9c27[_0x6bcc('0xe1')](_0x59fbf3);}})[_0x6bcc('0x22')](function(_0x18bd4c){if(_0x18bd4c){_0x427c43=_0x18bd4c[_0x6bcc('0x4e')];if(!_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x4f')](_0x6bcc('0x73'))){_0x59fbf3['limit']=qs[_0x6bcc('0x30')](_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x59fbf3[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x2f')]);}return _0x1d9c27['getAgents'](_0x59fbf3);}})[_0x6bcc('0x22')](function(_0xf94047){if(_0xf94047){return _0xf94047?{'count':_0x427c43,'rows':_0xf94047}:null;}})[_0x6bcc('0x22')](respondWithResult(_0x4a041b,null))[_0x6bcc('0x2c')](handleError(_0x4a041b,null));}; \ No newline at end of file +var _0xe5dc=['reject','save','destroy','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','SmsAccountId','Disposition','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','From','Body','messageId','MessageSid','skebby','sender','text','from','clicksend','message_id','plivo','results','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','SmsInteraction','created','autoclose','applications','push','close','*,*,*,*','interaction','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','status_code','groupName','DELIVERED','bandwidth','redif','inspect','error_code','infobip','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','omit','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','set','Content-Range'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0xe5dc,0x196));var _0xce5d=function(_0x5de307,_0x2d30cc){_0x5de307=_0x5de307-0x0;var _0x1484d6=_0xe5dc[_0x5de307];return _0x1484d6;};'use strict';var emlformat=require(_0xce5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce5d('0x1'));var jsonpatch=require(_0xce5d('0x2'));var rp=require(_0xce5d('0x3'));var moment=require(_0xce5d('0x4'));var BPromise=require(_0xce5d('0x5'));var Mustache=require(_0xce5d('0x6'));var util=require(_0xce5d('0x7'));var path=require(_0xce5d('0x8'));var sox=require('sox');var csv=require(_0xce5d('0x9'));var ejs=require(_0xce5d('0xa'));var fs=require('fs');var fs_extra=require(_0xce5d('0xb'));var _=require('lodash');var squel=require(_0xce5d('0xc'));var crypto=require(_0xce5d('0xd'));var jsforce=require(_0xce5d('0xe'));var deskjs=require(_0xce5d('0xf'));var toCsv=require(_0xce5d('0x9'));var querystring=require(_0xce5d('0x10'));var Papa=require(_0xce5d('0x11'));var Redis=require(_0xce5d('0x12'));var authService=require(_0xce5d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xce5d('0x14'));var hardwareService=require(_0xce5d('0x15'));var logger=require(_0xce5d('0x16'))(_0xce5d('0x17'));var utils=require(_0xce5d('0x18'));var config=require(_0xce5d('0x19'));var licenseUtil=require(_0xce5d('0x1a'));var db=require(_0xce5d('0x1b'))['db'];config[_0xce5d('0x1c')]=_[_0xce5d('0x1d')](config[_0xce5d('0x1c')],{'host':_0xce5d('0x1e'),'port':0x18eb});var socket=require(_0xce5d('0x1f'))(new Redis(config[_0xce5d('0x1c')]));require('./smsAccount.socket')[_0xce5d('0x20')](socket);var jayson=require(_0xce5d('0x21'));var client=jayson['client'][_0xce5d('0x22')]({'port':0x232c});function respondWithRpcPromise(_0xf6f4d1,_0x32d049,_0x4fe957,_0x599d8f){return new BPromise(function(_0x117d92,_0xc98114){var _0x151d65=_0x599d8f||client;return _0x151d65[_0xce5d('0x23')](_0xf6f4d1,_0x4fe957)[_0xce5d('0x24')](function(_0x2cbbaf){logger[_0xce5d('0x25')](_0xce5d('0x26'),_0x32d049,_0xce5d('0x27'));logger[_0xce5d('0x28')](_0xce5d('0x29'),_0x32d049,_0xce5d('0x27'),JSON[_0xce5d('0x2a')](_0x2cbbaf));if(_0x2cbbaf[_0xce5d('0x2b')]){if(_0x2cbbaf['error'][_0xce5d('0x2c')]===0x1f4){logger[_0xce5d('0x2b')](_0xce5d('0x26'),_0x32d049,_0x2cbbaf['error'][_0xce5d('0x2d')]);return _0xc98114(_0x2cbbaf[_0xce5d('0x2b')][_0xce5d('0x2d')]);}logger['error'](_0xce5d('0x26'),_0x32d049,_0x2cbbaf[_0xce5d('0x2b')][_0xce5d('0x2d')]);return _0x117d92(_0x2cbbaf[_0xce5d('0x2b')][_0xce5d('0x2d')]);}else{logger['info'](_0xce5d('0x26'),_0x32d049,'request\x20sent');_0x117d92(_0x2cbbaf[_0xce5d('0x2e')][_0xce5d('0x2d')]);}})[_0xce5d('0x2f')](function(_0x561961){logger[_0xce5d('0x2b')](_0xce5d('0x26'),_0x32d049,_0x561961);_0xc98114(_0x561961);});});}function respondWithStatusCode(_0x129424,_0x309a49){_0x309a49=_0x309a49||0xcc;return function(_0x462cbf){if(_0x462cbf){return _0x129424[_0xce5d('0x30')](_0x309a49);}return _0x129424[_0xce5d('0x31')](_0x309a49)[_0xce5d('0x32')]();};}function respondWithResult(_0x4c0266,_0x55155e){_0x55155e=_0x55155e||0xc8;return function(_0x4de79d){if(_0x4de79d){return _0x4c0266[_0xce5d('0x31')](_0x55155e)[_0xce5d('0x33')](_0x4de79d);}};}function respondWithFilteredResult(_0x246ce9,_0x4efe46){return function(_0xf8987b){if(_0xf8987b){var _0x62e08c=typeof _0x4efe46[_0xce5d('0x34')]===_0xce5d('0x35')&&typeof _0x4efe46['limit']==='undefined';var _0xa47a7d=_0xf8987b['count'];var _0x180c8f=_0x62e08c?0x0:_0x4efe46[_0xce5d('0x34')];var _0x392ac5=_0x62e08c?_0xf8987b['count']:_0x4efe46['offset']+_0x4efe46['limit'];var _0x2dfae2;if(_0x392ac5>=_0xa47a7d){_0x392ac5=_0xa47a7d;_0x2dfae2=0xc8;}else{_0x2dfae2=0xce;}_0x246ce9[_0xce5d('0x31')](_0x2dfae2);return _0x246ce9[_0xce5d('0x36')](_0xce5d('0x37'),_0x180c8f+'-'+_0x392ac5+'/'+_0xa47a7d)[_0xce5d('0x33')](_0xf8987b);}return null;};}function patchUpdates(_0x411c2a){return function(_0x5804cb){try{jsonpatch['apply'](_0x5804cb,_0x411c2a,!![]);}catch(_0x483deb){return BPromise[_0xce5d('0x38')](_0x483deb);}return _0x5804cb[_0xce5d('0x39')]();};}function saveUpdates(_0x4aa7b9,_0x13bd6c){return function(_0x2e4d41){if(_0x2e4d41){return _0x2e4d41['update'](_0x4aa7b9)[_0xce5d('0x24')](function(_0x1cbde4){return _0x1cbde4;});}return null;};}function removeEntity(_0xda5e9d,_0x1d3da2){return function(_0x32f86e){if(_0x32f86e){return _0x32f86e['destroy']()[_0xce5d('0x24')](function(){var _0x146f1e=_0x32f86e['get']({'plain':!![]});var _0x5e82cd='SmsAccounts';return db['UserProfileResource'][_0xce5d('0x3a')]({'where':{'type':_0x5e82cd,'resourceId':_0x146f1e['id']}})[_0xce5d('0x24')](function(){return _0x32f86e;});})[_0xce5d('0x24')](function(){_0xda5e9d[_0xce5d('0x31')](0xcc)[_0xce5d('0x32')]();});}};}function handleEntityNotFound(_0xa66ca,_0x3639d9){return function(_0x1fb413){if(!_0x1fb413){_0xa66ca['sendStatus'](0x194);}return _0x1fb413;};}function handleError(_0x26834d,_0x5d1006){_0x5d1006=_0x5d1006||0x1f4;return function(_0x261f8d){logger[_0xce5d('0x2b')](_0x261f8d[_0xce5d('0x3b')]);if(_0x261f8d['name']){delete _0x261f8d[_0xce5d('0x3c')];}_0x26834d[_0xce5d('0x31')](_0x5d1006)[_0xce5d('0x3d')](_0x261f8d);};}exports['index']=function(_0x40ade8,_0x34c33a){var _0x1b2eb4={'include':[{'model':db[_0xce5d('0x3e')],'as':_0xce5d('0x3f')}]},_0xb09bd7={},_0x571e88={'count':0x0,'rows':[]};var _0x2cfc04=_['map'](db[_0xce5d('0x40')][_0xce5d('0x41')],function(_0x4985e4){return{'name':_0x4985e4[_0xce5d('0x42')],'type':_0x4985e4['type'][_0xce5d('0x43')]};});_0xb09bd7[_0xce5d('0x44')]=_['map'](_0x2cfc04,_0xce5d('0x3c'));_0xb09bd7[_0xce5d('0x45')]=_[_0xce5d('0x46')](_0x40ade8['query']);_0xb09bd7[_0xce5d('0x47')]=_[_0xce5d('0x48')](_0xb09bd7['model'],_0xb09bd7[_0xce5d('0x45')]);_0x1b2eb4['attributes']=_['intersection'](_0xb09bd7[_0xce5d('0x44')],qs[_0xce5d('0x49')](_0x40ade8['query']['fields']));_0x1b2eb4[_0xce5d('0x4a')]=_0x1b2eb4[_0xce5d('0x4a')][_0xce5d('0x4b')]?_0x1b2eb4['attributes']:_0xb09bd7[_0xce5d('0x44')];if(!_0x40ade8[_0xce5d('0x45')][_0xce5d('0x4c')](_0xce5d('0x4d'))){_0x1b2eb4[_0xce5d('0x4e')]=qs[_0xce5d('0x4e')](_0x40ade8[_0xce5d('0x45')][_0xce5d('0x4e')]);_0x1b2eb4[_0xce5d('0x34')]=qs[_0xce5d('0x34')](_0x40ade8[_0xce5d('0x45')][_0xce5d('0x34')]);}_0x1b2eb4[_0xce5d('0x4f')]=qs[_0xce5d('0x50')](_0x40ade8[_0xce5d('0x45')][_0xce5d('0x50')]);_0x1b2eb4['where']=qs[_0xce5d('0x47')](_['pick'](_0x40ade8[_0xce5d('0x45')],_0xb09bd7[_0xce5d('0x47')]),_0x2cfc04);if(_0x40ade8[_0xce5d('0x45')][_0xce5d('0x51')]){_0x1b2eb4[_0xce5d('0x52')]=_[_0xce5d('0x53')](_0x1b2eb4[_0xce5d('0x52')],{'$or':_[_0xce5d('0x54')](_0x2cfc04,function(_0x376535){if(_0x376535[_0xce5d('0x55')]!==_0xce5d('0x56')){var _0x133898={};_0x133898[_0x376535[_0xce5d('0x3c')]]={'$like':'%'+_0x40ade8[_0xce5d('0x45')][_0xce5d('0x51')]+'%'};return _0x133898;}})});}_0x1b2eb4=_['merge']({},_0x1b2eb4,_0x40ade8[_0xce5d('0x57')]);var _0x5dde00={'where':_0x1b2eb4[_0xce5d('0x52')]};return db[_0xce5d('0x40')]['count'](_0x5dde00)[_0xce5d('0x24')](function(_0x174324){_0x571e88[_0xce5d('0x58')]=_0x174324;if(_0x40ade8['query'][_0xce5d('0x59')]){_0x1b2eb4[_0xce5d('0x5a')]=[{'all':!![]}];}return db[_0xce5d('0x40')][_0xce5d('0x5b')](_0x1b2eb4);})['then'](function(_0x203271){_0x571e88[_0xce5d('0x5c')]=_0x203271;return _0x571e88;})['then'](respondWithFilteredResult(_0x34c33a,_0x1b2eb4))[_0xce5d('0x2f')](handleError(_0x34c33a,null));};exports[_0xce5d('0x5d')]=function(_0x3cb974,_0x1d626b){var _0xf89475={'raw':![],'where':{'id':_0x3cb974['params']['id']},'include':[{'model':db[_0xce5d('0x3e')],'as':'mandatoryDispositionPause'}]},_0x59224e={};_0x59224e[_0xce5d('0x44')]=_['keys'](db[_0xce5d('0x40')][_0xce5d('0x41')]);_0x59224e[_0xce5d('0x45')]=_[_0xce5d('0x46')](_0x3cb974['query']);_0x59224e[_0xce5d('0x47')]=_[_0xce5d('0x48')](_0x59224e['model'],_0x59224e[_0xce5d('0x45')]);_0xf89475[_0xce5d('0x4a')]=_[_0xce5d('0x48')](_0x59224e[_0xce5d('0x44')],qs['fields'](_0x3cb974[_0xce5d('0x45')]['fields']));_0xf89475[_0xce5d('0x4a')]=_0xf89475[_0xce5d('0x4a')]['length']?_0xf89475[_0xce5d('0x4a')]:_0x59224e[_0xce5d('0x44')];if(_0x3cb974['query'][_0xce5d('0x59')]){_0xf89475['include']=[{'all':!![]}];}_0xf89475=_[_0xce5d('0x53')]({},_0xf89475,_0x3cb974[_0xce5d('0x57')]);return db[_0xce5d('0x40')][_0xce5d('0x5e')](_0xf89475)[_0xce5d('0x24')](handleEntityNotFound(_0x1d626b,null))['then'](respondWithResult(_0x1d626b,null))[_0xce5d('0x2f')](handleError(_0x1d626b,null));};exports[_0xce5d('0x5f')]=function(_0x5aa505,_0x19f44e){return db[_0xce5d('0x40')]['create'](_0x5aa505[_0xce5d('0x60')],{})[_0xce5d('0x24')](function(_0x350a29){var _0x18924f=_0x5aa505['user'][_0xce5d('0x61')]({'plain':!![]});if(!_0x18924f)throw new Error(_0xce5d('0x62'));if(_0x18924f[_0xce5d('0x63')]===_0xce5d('0x64')){var _0x534726=_0x350a29[_0xce5d('0x61')]({'plain':!![]});var _0x51841c=_0xce5d('0x65');return db[_0xce5d('0x66')][_0xce5d('0x5e')]({'where':{'name':_0x51841c,'userProfileId':_0x18924f[_0xce5d('0x67')]},'raw':!![]})[_0xce5d('0x24')](function(_0x256d97){if(_0x256d97&&_0x256d97['autoAssociation']===0x0){return db[_0xce5d('0x68')][_0xce5d('0x5f')]({'name':_0x534726[_0xce5d('0x3c')],'resourceId':_0x534726['id'],'type':_0x256d97[_0xce5d('0x3c')],'sectionId':_0x256d97['id']},{})['then'](function(){return _0x350a29;});}else{return _0x350a29;}})['catch'](function(_0x5c46b7){logger['error'](_0xce5d('0x69'),_0x5c46b7);throw _0x5c46b7;});}return _0x350a29;})[_0xce5d('0x24')](respondWithResult(_0x19f44e,0xc9))[_0xce5d('0x2f')](handleError(_0x19f44e,null));};exports[_0xce5d('0x6a')]=function(_0xf8e3dc,_0x2cb12c){if(_0xf8e3dc[_0xce5d('0x60')]['id']){delete _0xf8e3dc[_0xce5d('0x60')]['id'];}return db[_0xce5d('0x40')][_0xce5d('0x5e')]({'where':{'id':_0xf8e3dc[_0xce5d('0x6b')]['id']},'include':[{'model':db[_0xce5d('0x3e')],'as':_0xce5d('0x3f')}]})[_0xce5d('0x24')](handleEntityNotFound(_0x2cb12c,null))[_0xce5d('0x24')](saveUpdates(_0xf8e3dc[_0xce5d('0x60')],null))[_0xce5d('0x24')](respondWithResult(_0x2cb12c,null))[_0xce5d('0x2f')](handleError(_0x2cb12c,null));};exports[_0xce5d('0x3a')]=function(_0x30e691,_0x3b55ba){return db[_0xce5d('0x40')]['find']({'where':{'id':_0x30e691[_0xce5d('0x6b')]['id']}})['then'](handleEntityNotFound(_0x3b55ba,null))['then'](removeEntity(_0x3b55ba,null))[_0xce5d('0x2f')](handleError(_0x3b55ba,null));};exports[_0xce5d('0x6c')]=function(_0x295e73,_0x145fb){return db[_0xce5d('0x40')]['describe']()['then'](respondWithResult(_0x145fb,null))['catch'](handleError(_0x145fb,null));};exports[_0xce5d('0x6d')]=function(_0x136add,_0x2aff7b,_0x13692b){if(_0x136add['body']['id']){delete _0x136add[_0xce5d('0x60')]['id'];}return db[_0xce5d('0x40')]['find']({'where':{'id':_0x136add[_0xce5d('0x6b')]['id']}})['then'](handleEntityNotFound(_0x2aff7b,null))[_0xce5d('0x24')](function(_0x5dc893){if(_0x5dc893){_0x136add[_0xce5d('0x60')][_0xce5d('0x6e')]=_0x5dc893['id'];return db[_0xce5d('0x6f')][_0xce5d('0x5f')](_0x136add[_0xce5d('0x60')]);}})['then'](respondWithResult(_0x2aff7b,null))[_0xce5d('0x2f')](handleError(_0x2aff7b,null));};exports['getDispositions']=function(_0x4f560f,_0x9cf901,_0x46e27b){var _0x5911cd={'raw':![],'where':{}};var _0x49a002={};var _0x236125={'count':0x0,'rows':[]};return db[_0xce5d('0x40')][_0xce5d('0x70')]({'where':{'id':_0x4f560f[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x9cf901,null))[_0xce5d('0x24')](function(_0x55c94f){if(_0x55c94f){_0x49a002[_0xce5d('0x44')]=_['keys'](db['Disposition']['rawAttributes']);_0x49a002['query']=_[_0xce5d('0x46')](_0x4f560f[_0xce5d('0x45')]);_0x49a002['filters']=_['intersection'](_0x49a002[_0xce5d('0x44')],_0x49a002[_0xce5d('0x45')]);_0x5911cd[_0xce5d('0x4a')]=_['intersection'](_0x49a002[_0xce5d('0x44')],qs[_0xce5d('0x49')](_0x4f560f[_0xce5d('0x45')][_0xce5d('0x49')]));_0x5911cd[_0xce5d('0x4a')]=_0x5911cd[_0xce5d('0x4a')][_0xce5d('0x4b')]?_0x5911cd[_0xce5d('0x4a')]:_0x49a002[_0xce5d('0x44')];if(!_0x4f560f[_0xce5d('0x45')][_0xce5d('0x4c')](_0xce5d('0x4d'))){_0x5911cd[_0xce5d('0x4e')]=qs['limit'](_0x4f560f['query'][_0xce5d('0x4e')]);_0x5911cd[_0xce5d('0x34')]=qs[_0xce5d('0x34')](_0x4f560f[_0xce5d('0x45')][_0xce5d('0x34')]);}_0x5911cd[_0xce5d('0x4f')]=qs[_0xce5d('0x50')](_0x4f560f['query'][_0xce5d('0x50')]);_0x5911cd[_0xce5d('0x52')]=qs['filters'](_[_0xce5d('0x71')](_0x4f560f[_0xce5d('0x45')],_0x49a002[_0xce5d('0x47')]));_0x5911cd['where'][_0xce5d('0x6e')]=_0x55c94f['id'];if(_0x4f560f['query']['filter']){_0x5911cd[_0xce5d('0x52')]=_[_0xce5d('0x53')](_0x5911cd[_0xce5d('0x52')],{'$or':_[_0xce5d('0x54')](_0x5911cd[_0xce5d('0x4a')],function(_0x384ecb){var _0xa5dcc2={};_0xa5dcc2[_0x384ecb]={'$like':'%'+_0x4f560f[_0xce5d('0x45')][_0xce5d('0x51')]+'%'};return _0xa5dcc2;})});}_0x5911cd=_['merge']({},_0x5911cd,_0x4f560f[_0xce5d('0x57')]);return db[_0xce5d('0x6f')][_0xce5d('0x58')]({'where':_0x5911cd['where']})[_0xce5d('0x24')](function(_0x550841){_0x236125[_0xce5d('0x58')]=_0x550841;if(_0x4f560f[_0xce5d('0x45')]['includeAll']){_0x5911cd[_0xce5d('0x5a')]=[{'all':!![]}];}return db[_0xce5d('0x6f')][_0xce5d('0x5b')](_0x5911cd);})['then'](function(_0x3ebea9){_0x236125[_0xce5d('0x5c')]=_0x3ebea9;return _0x236125;});}})[_0xce5d('0x24')](respondWithFilteredResult(_0x9cf901,_0x5911cd))[_0xce5d('0x2f')](handleError(_0x9cf901,null));};exports['removeDispositions']=function(_0x4cd5a,_0x1248b8,_0xbe7e1b){return db[_0xce5d('0x40')][_0xce5d('0x5e')]({'where':{'id':_0x4cd5a['params']['id']}})['then'](handleEntityNotFound(_0x1248b8,null))['then'](function(_0x4b2b19){if(_0x4b2b19){return _0x4b2b19[_0xce5d('0x72')](_0x4cd5a[_0xce5d('0x45')][_0xce5d('0x73')]);}})['then'](respondWithStatusCode(_0x1248b8,null))[_0xce5d('0x2f')](handleError(_0x1248b8,null));};exports[_0xce5d('0x74')]=function(_0x28819c,_0x39342a,_0x2db385){if(_0x28819c[_0xce5d('0x60')]['id']){delete _0x28819c[_0xce5d('0x60')]['id'];}return db['SmsAccount'][_0xce5d('0x5e')]({'where':{'id':_0x28819c[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x39342a,null))[_0xce5d('0x24')](function(_0x495cb5){if(_0x495cb5){_0x28819c[_0xce5d('0x60')][_0xce5d('0x6e')]=_0x495cb5['id'];return db[_0xce5d('0x75')][_0xce5d('0x5f')](_0x28819c['body']);}})[_0xce5d('0x24')](respondWithResult(_0x39342a,null))['catch'](handleError(_0x39342a,null));};exports[_0xce5d('0x76')]=function(_0x129ebe,_0x8b5ba1,_0x2e9a39){var _0xd3cfbf={'raw':![],'where':{}};var _0x4ee0fc={};var _0x651d66={'count':0x0,'rows':[]};return db['SmsAccount'][_0xce5d('0x70')]({'where':{'id':_0x129ebe[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x8b5ba1,null))['then'](function(_0x378124){if(_0x378124){_0x4ee0fc[_0xce5d('0x44')]=_['keys'](db[_0xce5d('0x75')][_0xce5d('0x41')]);_0x4ee0fc[_0xce5d('0x45')]=_[_0xce5d('0x46')](_0x129ebe[_0xce5d('0x45')]);_0x4ee0fc[_0xce5d('0x47')]=_[_0xce5d('0x48')](_0x4ee0fc[_0xce5d('0x44')],_0x4ee0fc[_0xce5d('0x45')]);_0xd3cfbf[_0xce5d('0x4a')]=_[_0xce5d('0x48')](_0x4ee0fc[_0xce5d('0x44')],qs[_0xce5d('0x49')](_0x129ebe[_0xce5d('0x45')][_0xce5d('0x49')]));_0xd3cfbf['attributes']=_0xd3cfbf[_0xce5d('0x4a')][_0xce5d('0x4b')]?_0xd3cfbf[_0xce5d('0x4a')]:_0x4ee0fc[_0xce5d('0x44')];if(!_0x129ebe[_0xce5d('0x45')][_0xce5d('0x4c')](_0xce5d('0x4d'))){_0xd3cfbf[_0xce5d('0x4e')]=qs[_0xce5d('0x4e')](_0x129ebe[_0xce5d('0x45')][_0xce5d('0x4e')]);_0xd3cfbf[_0xce5d('0x34')]=qs['offset'](_0x129ebe[_0xce5d('0x45')][_0xce5d('0x34')]);}_0xd3cfbf[_0xce5d('0x4f')]=qs[_0xce5d('0x50')](_0x129ebe[_0xce5d('0x45')]['sort']);_0xd3cfbf['where']=qs[_0xce5d('0x47')](_['pick'](_0x129ebe[_0xce5d('0x45')],_0x4ee0fc[_0xce5d('0x47')]));_0xd3cfbf[_0xce5d('0x52')][_0xce5d('0x6e')]=_0x378124['id'];if(_0x129ebe[_0xce5d('0x45')]['filter']){_0xd3cfbf[_0xce5d('0x52')]=_[_0xce5d('0x53')](_0xd3cfbf[_0xce5d('0x52')],{'$or':_[_0xce5d('0x54')](_0xd3cfbf[_0xce5d('0x4a')],function(_0xce4ffe){var _0x1cf6f3={};_0x1cf6f3[_0xce4ffe]={'$like':'%'+_0x129ebe['query'][_0xce5d('0x51')]+'%'};return _0x1cf6f3;})});}_0xd3cfbf=_[_0xce5d('0x53')]({},_0xd3cfbf,_0x129ebe[_0xce5d('0x57')]);return db['CannedAnswer'][_0xce5d('0x58')]({'where':_0xd3cfbf[_0xce5d('0x52')]})['then'](function(_0x2bacf0){_0x651d66[_0xce5d('0x58')]=_0x2bacf0;if(_0x129ebe[_0xce5d('0x45')]['includeAll']){_0xd3cfbf[_0xce5d('0x5a')]=[{'all':!![]}];}return db[_0xce5d('0x75')][_0xce5d('0x5b')](_0xd3cfbf);})[_0xce5d('0x24')](function(_0x3fe0dc){_0x651d66[_0xce5d('0x5c')]=_0x3fe0dc;return _0x651d66;});}})[_0xce5d('0x24')](respondWithFilteredResult(_0x8b5ba1,_0xd3cfbf))[_0xce5d('0x2f')](handleError(_0x8b5ba1,null));};exports[_0xce5d('0x77')]=function(_0x7b7ce3,_0x58a0ad,_0x65965d){return db[_0xce5d('0x40')][_0xce5d('0x5e')]({'where':{'id':_0x7b7ce3[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x58a0ad,null))['then'](function(_0x556c60){if(_0x556c60){return _0x556c60['removeAnswers'](_0x7b7ce3[_0xce5d('0x45')]['ids']);}})[_0xce5d('0x24')](respondWithStatusCode(_0x58a0ad,null))['catch'](handleError(_0x58a0ad,null));};exports[_0xce5d('0x78')]=function(_0xfebfaa,_0x1d7a79,_0x237d48){var _0x33ac16={'channel':'sms'};var _0x4dec04=[];var _0x4bde2c=[];var _0x3eda90={};return db[_0xce5d('0x40')][_0xce5d('0x5e')]({'where':{'id':_0xfebfaa['params']['id']},'include':[{'model':db[_0xce5d('0x79')],'as':_0xce5d('0x7a')}]})[_0xce5d('0x24')](handleEntityNotFound(_0x1d7a79,null))[_0xce5d('0x24')](function(_0x35b1b3){_0x33ac16[_0xce5d('0x7b')]=_0x35b1b3;_0x33ac16['applications']=_['orderBy'](_0x35b1b3['Applications'],[_0xce5d('0x7c')],['asc']);if(_0x33ac16[_0xce5d('0x7b')][_0xce5d('0x7a')]){delete _0x33ac16['account']['Applications'];}return db[_0xce5d('0x7d')]['describe']();})[_0xce5d('0x24')](function(_0x4e1d0f){if(!_0x4e1d0f){throw new db['Sequelize'][(_0xce5d('0x7e'))](_0xce5d('0x7f'));}_0x4dec04=_[_0xce5d('0x80')](_[_0xce5d('0x46')](_0x4e1d0f),[_0xce5d('0x81'),_0xce5d('0x82')]);_0x4bde2c=_[_0xce5d('0x80')](_[_0xce5d('0x46')](_0x4e1d0f),[_0xce5d('0x81'),_0xce5d('0x82'),'CompanyId',_0xce5d('0x83')]);_0x33ac16[_0xce5d('0x60')]={'mapKey':'mobile'};if(_0x33ac16[_0xce5d('0x7b')]['type']){switch(_0x33ac16[_0xce5d('0x7b')][_0xce5d('0x55')]){case _0xce5d('0x84'):_0x33ac16[_0xce5d('0x60')]['from']=_0xfebfaa['body'][_0xce5d('0x85')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]=_0xfebfaa['body'][_0xce5d('0x86')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x87')]=_0xfebfaa['body'][_0xce5d('0x88')];break;case _0xce5d('0x89'):_0x33ac16['body']['from']='+'+_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x8a')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x8b')];break;case'connectel':_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x8c')];_0x33ac16['body'][_0xce5d('0x60')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x2d')];break;case _0xce5d('0x8d'):_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x8c')];_0x33ac16['body'][_0xce5d('0x60')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x60')];_0x33ac16['body'][_0xce5d('0x87')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x8e')];break;case _0xce5d('0x8f'):_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x85')];_0x33ac16['body'][_0xce5d('0x60')]=_0xfebfaa['body']['Text'];_0x33ac16[_0xce5d('0x60')]['messageId']=_0xfebfaa[_0xce5d('0x60')]['MessageUUID'];break;case'infobip':_0x33ac16[_0xce5d('0x60')]['from']='+'+_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x90')][0x0][_0xce5d('0x8c')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]=_0xfebfaa['body'][_0xce5d('0x90')][0x0][_0xce5d('0x8b')];_0x33ac16['body'][_0xce5d('0x87')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x90')][0x0][_0xce5d('0x87')];break;case'csc':_0x33ac16['body'][_0xce5d('0x8c')]=_0xfebfaa['body'][_0xce5d('0x91')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x92')][_0xce5d('0x2d')];break;case _0xce5d('0x93'):_0x33ac16['body'][_0xce5d('0x8c')]=_0xfebfaa['body']['fromNumber'];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x8b')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x87')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x94')];break;case'bandwidth':_0x33ac16[_0xce5d('0x60')][_0xce5d('0x87')]=_0xfebfaa[_0xce5d('0x60')][0x0]['message']['id'];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')]=_0xfebfaa['body'][0x0][_0xce5d('0x2d')][_0xce5d('0x8c')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]=_0xfebfaa['body'][0x0][_0xce5d('0x2d')][_0xce5d('0x8b')];break;case _0xce5d('0x95'):_0x33ac16['body'][_0xce5d('0x8c')]=_0xfebfaa['body'][_0xce5d('0x8c')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]=_0xfebfaa['body'][_0xce5d('0x2d')];_0x33ac16[_0xce5d('0x60')][_0xce5d('0x87')]=_0xfebfaa[_0xce5d('0x60')][_0xce5d('0x96')];break;}}if(_0x33ac16[_0xce5d('0x60')]['id']){delete _0x33ac16[_0xce5d('0x60')]['id'];}if(_[_0xce5d('0x97')](_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')])){throw new db['Sequelize'][(_0xce5d('0x7e'))](_0xce5d('0x98'));}if(_['isNil'](_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')])||_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')]===''){throw new db['Sequelize'][(_0xce5d('0x7e'))](_0xce5d('0x99'));}if(_[_0xce5d('0x97')](_0x33ac16['body'][_0xce5d('0x9a')])){throw new db[(_0xce5d('0x9b'))]['ValidationError'](_0xce5d('0x9c')+_0x4bde2c);}if(!_[_0xce5d('0x9d')](_0x4bde2c,_0x33ac16[_0xce5d('0x60')][_0xce5d('0x9a')])){throw new db[(_0xce5d('0x9b'))][(_0xce5d('0x7e'))](_0xce5d('0x9e')+_0x4bde2c);}_0x3eda90[_0x33ac16[_0xce5d('0x60')]['mapKey']]=_0x33ac16['body'][_0xce5d('0x8c')];return db[_0xce5d('0x9f')][_0xce5d('0x5e')]({'where':{'id':_0x33ac16['account'][_0xce5d('0x83')]},'include':[{'model':db[_0xce5d('0x7d')],'as':_0xce5d('0xa0'),'where':_0x3eda90,'limit':0x1,'order':[[_0xce5d('0x82'),_0xce5d('0xa1')]]}]});})[_0xce5d('0x24')](handleEntityNotFound(_0x1d7a79,null))[_0xce5d('0x24')](function(_0x4d167f){if(_0x4d167f){_0x33ac16['list']=_['omit'](_0x4d167f,[_0xce5d('0xa0')]);if(_0x4d167f[_0xce5d('0xa0')]['length']){return _0x4d167f[_0xce5d('0xa0')][0x0];}var _0x134a81=_[_0xce5d('0x1d')](_0x33ac16['body'],{'firstName':_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')],'ListId':_0x4d167f['id']});_0x134a81[_0x33ac16[_0xce5d('0x60')][_0xce5d('0x9a')]]=_0x33ac16['body'][_0xce5d('0x8c')];return db[_0xce5d('0x7d')][_0xce5d('0x5f')](_0x134a81,{'fields':_0x4dec04,'raw':!![]});}})[_0xce5d('0x24')](handleEntityNotFound(_0x1d7a79,null))[_0xce5d('0x24')](function(_0x52ae70){if(_0x52ae70){_0x33ac16['contact']=_0x52ae70;var _0x80153c={'ContactId':_0x52ae70['id'],'phone':_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')],'SmsAccountId':_0xfebfaa['params']['id']};var _0x590e08={'ContactId':_0x52ae70['id'],'SmsAccountId':_0xfebfaa['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x590e08})[_0xce5d('0x24')](function(_0xb959ff){if(_0xb959ff){return[_0xb959ff,![]];}return db[_0xce5d('0xa2')][_0xce5d('0x5f')](_0x80153c)['then'](function(_0x1db8f9){return[_0x1db8f9,!![]];});});}})['spread'](function(_0x5bd857,_0x562a78){_0x33ac16['interaction']=_0x5bd857[_0xce5d('0x61')]({'plain':!![]});_0x33ac16['interaction'][_0xce5d('0xa3')]=![];if(_0x562a78){if(_0x33ac16['account'][_0xce5d('0xa4')]){_0x33ac16[_0xce5d('0xa5')][_0xce5d('0xa6')]({'id':0x0,'priority':_0x33ac16[_0xce5d('0xa5')][_0xce5d('0x4b')]+0x1,'app':_0xce5d('0xa7'),'appdata':'unmanaged','interval':_0xce5d('0xa8')});}_0x33ac16[_0xce5d('0xa9')]['created']=!![];}return db[_0xce5d('0xaa')][_0xce5d('0x5f')]({'phone':_0x33ac16[_0xce5d('0x60')][_0xce5d('0x8c')],'messageId':_0x33ac16[_0xce5d('0x60')][_0xce5d('0x87')],'body':_0x33ac16[_0xce5d('0x60')][_0xce5d('0x60')],'SmsAccountId':_0xfebfaa['params']['id'],'SmsInteractionId':_0x5bd857['id'],'direction':'in','ContactId':_0x5bd857[_0xce5d('0xab')],'AttachmentId':_0x33ac16[_0xce5d('0x60')][_0xce5d('0xac')]});})[_0xce5d('0x24')](function(_0x2791ad){_0x33ac16[_0xce5d('0x2d')]=_0x2791ad;if(_0x33ac16['interaction'][_0xce5d('0xad')]){return db['User'][_0xce5d('0x5e')]({'attributes':['id',_0xce5d('0x3c')],'where':{'id':_0x33ac16[_0xce5d('0xa9')][_0xce5d('0xad')]}})[_0xce5d('0x24')](function(_0x54cbf0){if(_0x54cbf0){_0x33ac16[_0xce5d('0xa5')]['unshift']({'id':0x0,'priority':0x0,'app':_0xce5d('0xae'),'appdata':_0x54cbf0[_0xce5d('0x3c')]+','+(_0x33ac16['account'][_0xce5d('0xaf')]||0xa),'interval':_0xce5d('0xa8')});}return respondWithRpcPromise('Start',_0xce5d('0xb0'),_0x33ac16);});}return respondWithRpcPromise(_0xce5d('0xb1'),_0xce5d('0xb0'),_0x33ac16);})[_0xce5d('0x24')](function(_0x37dad1){if(_0x37dad1){var _0x35348b=0xc8;var _0x256adc=_0xce5d('0xb2');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x256adc,_0x35348b,_0xce5d('0xb3'));logger['debug'](_0xce5d('0xb4'),_0x256adc,_0x35348b,_0xce5d('0xb3'),JSON['stringify'](_0x37dad1));if(_0x33ac16['account'][_0xce5d('0x55')]===_0xce5d('0x84')){return _0x1d7a79[_0xce5d('0x31')](_0x35348b)['set'](_0xce5d('0xb5'),'text/xml')[_0xce5d('0x3d')]('\x0a');}else{return _0x1d7a79[_0xce5d('0x31')](_0x35348b)[_0xce5d('0x33')](_0x37dad1);}}})[_0xce5d('0x2f')](handleError(_0x1d7a79,null));};exports[_0xce5d('0xb6')]=function(_0x347574,_0x1c2e95){var _0x5080b3=_0x347574[_0xce5d('0x6b')]['id'];var _0x1c98c6=_0x347574[_0xce5d('0x60')];var _0x30572b=0xc8;var _0xdf5887=null;return db[_0xce5d('0xb7')][_0xce5d('0xb8')]({'isolationLevel':db[_0xce5d('0xb7')][_0xce5d('0xb9')][_0xce5d('0xba')]['READ_COMMITTED']},function(_0x388a52){return db[_0xce5d('0x40')][_0xce5d('0x70')]({'where':{'id':_0x5080b3},'transaction':_0x388a52})[_0xce5d('0x24')](function(_0x1c9f8b){if(_0x1c9f8b){return db[_0xce5d('0x79')][_0xce5d('0x3a')]({'where':{'SmsAccountId':_0x5080b3},'transaction':_0x388a52})[_0xce5d('0x24')](function(){var _0x31c10a=_['map'](_0x1c98c6,function(_0x579102){_0x579102[_0xce5d('0x6e')]=_0x5080b3;return _0x579102;});return db[_0xce5d('0x79')]['bulkCreate'](_0x31c10a,{'transaction':_0x388a52});});}else{_0x30572b=0x194;_0xdf5887=[];}});})[_0xce5d('0x24')](function(){if(_0x30572b!==0x194){return db[_0xce5d('0x79')][_0xce5d('0xbb')]({'where':{'SmsAccountId':_0x5080b3},'order':_0xce5d('0x7c')})[_0xce5d('0x24')](function(_0x5e00b4){_0xdf5887=_0x5e00b4;});}})[_0xce5d('0x2f')](function(_0x44ca11){_0x30572b=0x1f4;logger[_0xce5d('0x2b')](_0x44ca11[_0xce5d('0x3b')]);if(_0x44ca11[_0xce5d('0x3c')]){delete _0x44ca11[_0xce5d('0x3c')];}_0xdf5887=_0x44ca11;})[_0xce5d('0xbc')](function(){if(_0xdf5887===null){_0x1c2e95[_0xce5d('0x30')](_0x30572b);}else{if(_0x30572b===0x1f4){_0x1c2e95[_0xce5d('0x31')](_0x30572b)['send'](_0xdf5887);}else{_0x1c2e95['status'](_0x30572b)[_0xce5d('0x33')](_0xdf5887);}}});};exports[_0xce5d('0xbd')]=function(_0x1b7fc9,_0x7a1a68,_0x398c1b){var _0x58ed09={};var _0x4f1f67={};var _0x553c82;var _0x350491;return db['SmsAccount']['findOne']({'where':{'id':_0x1b7fc9['params']['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x7a1a68,null))[_0xce5d('0x24')](function(_0x2aa27d){if(_0x2aa27d){_0x553c82=_0x2aa27d;_0x4f1f67['model']=_[_0xce5d('0x46')](db[_0xce5d('0x79')][_0xce5d('0x41')]);_0x4f1f67['query']=_[_0xce5d('0x46')](_0x1b7fc9[_0xce5d('0x45')]);_0x4f1f67['filters']=_[_0xce5d('0x48')](_0x4f1f67[_0xce5d('0x44')],_0x4f1f67[_0xce5d('0x45')]);_0x58ed09[_0xce5d('0x4a')]=_[_0xce5d('0x48')](_0x4f1f67[_0xce5d('0x44')],qs['fields'](_0x1b7fc9[_0xce5d('0x45')]['fields']));_0x58ed09[_0xce5d('0x4a')]=_0x58ed09[_0xce5d('0x4a')][_0xce5d('0x4b')]?_0x58ed09[_0xce5d('0x4a')]:_0x4f1f67[_0xce5d('0x44')];_0x58ed09[_0xce5d('0x4f')]=qs[_0xce5d('0x50')](_0x1b7fc9[_0xce5d('0x45')][_0xce5d('0x50')]);_0x58ed09['where']=qs['filters'](_[_0xce5d('0x71')](_0x1b7fc9['query'],_0x4f1f67[_0xce5d('0x47')]));if(_0x1b7fc9[_0xce5d('0x45')][_0xce5d('0x51')]){_0x58ed09['where']=_[_0xce5d('0x53')](_0x58ed09[_0xce5d('0x52')],{'$or':_[_0xce5d('0x54')](_0x58ed09[_0xce5d('0x4a')],function(_0x4c682b){var _0x556ac7={};_0x556ac7[_0x4c682b]={'$like':'%'+_0x1b7fc9[_0xce5d('0x45')][_0xce5d('0x51')]+'%'};return _0x556ac7;})});}_0x58ed09=_[_0xce5d('0x53')]({},_0x58ed09,_0x1b7fc9[_0xce5d('0x57')]);return _0x553c82[_0xce5d('0xbd')](_0x58ed09);}})[_0xce5d('0x24')](function(_0x5c116b){if(_0x5c116b){_0x350491=_0x5c116b[_0xce5d('0x4b')];if(!_0x1b7fc9['query'][_0xce5d('0x4c')](_0xce5d('0x4d'))){_0x58ed09[_0xce5d('0x4e')]=qs[_0xce5d('0x4e')](_0x1b7fc9[_0xce5d('0x45')][_0xce5d('0x4e')]);_0x58ed09[_0xce5d('0x34')]=qs[_0xce5d('0x34')](_0x1b7fc9[_0xce5d('0x45')][_0xce5d('0x34')]);}return _0x553c82[_0xce5d('0xbd')](_0x58ed09);}})['then'](function(_0x30e060){if(_0x30e060){return _0x30e060?{'count':_0x350491,'rows':_0x30e060}:null;}})[_0xce5d('0x24')](respondWithResult(_0x7a1a68,null))[_0xce5d('0x2f')](handleError(_0x7a1a68,null));};exports[_0xce5d('0xbe')]=function(_0x4d7fea,_0x513dac,_0x4495e9){var _0x2bc663={'raw':![],'where':{}};var _0xb4bef5={};var _0x18917a={'count':0x0,'rows':[]};return db[_0xce5d('0x40')]['findOne']({'where':{'id':_0x4d7fea[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x513dac,null))['then'](function(_0x53875a){if(_0x53875a){_0xb4bef5[_0xce5d('0x44')]=_[_0xce5d('0x46')](db[_0xce5d('0xa2')][_0xce5d('0x41')]);_0xb4bef5[_0xce5d('0x45')]=_[_0xce5d('0x46')](_0x4d7fea[_0xce5d('0x45')]);_0xb4bef5[_0xce5d('0x47')]=_[_0xce5d('0x48')](_0xb4bef5[_0xce5d('0x44')],_0xb4bef5[_0xce5d('0x45')]);_0x2bc663['attributes']=_[_0xce5d('0x48')](_0xb4bef5[_0xce5d('0x44')],qs[_0xce5d('0x49')](_0x4d7fea[_0xce5d('0x45')][_0xce5d('0x49')]));_0x2bc663[_0xce5d('0x4a')]=_0x2bc663[_0xce5d('0x4a')][_0xce5d('0x4b')]?_0x2bc663[_0xce5d('0x4a')]:_0xb4bef5[_0xce5d('0x44')];if(!_0x4d7fea[_0xce5d('0x45')][_0xce5d('0x4c')]('nolimit')){_0x2bc663['limit']=qs['limit'](_0x4d7fea[_0xce5d('0x45')][_0xce5d('0x4e')]);_0x2bc663[_0xce5d('0x34')]=qs[_0xce5d('0x34')](_0x4d7fea[_0xce5d('0x45')][_0xce5d('0x34')]);}_0x2bc663[_0xce5d('0x4f')]=qs[_0xce5d('0x50')](_0x4d7fea[_0xce5d('0x45')]['sort']);_0x2bc663[_0xce5d('0x52')]=qs[_0xce5d('0x47')](_[_0xce5d('0x71')](_0x4d7fea[_0xce5d('0x45')],_0xb4bef5['filters']));_0x2bc663[_0xce5d('0x52')][_0xce5d('0x6e')]=_0x53875a['id'];if(_0x4d7fea[_0xce5d('0x45')][_0xce5d('0x51')]){_0x2bc663['where']=_[_0xce5d('0x53')](_0x2bc663['where'],{'$or':_[_0xce5d('0x54')](_0x2bc663[_0xce5d('0x4a')],function(_0x40d446){var _0x2a8b06={};_0x2a8b06[_0x40d446]={'$like':'%'+_0x4d7fea['query'][_0xce5d('0x51')]+'%'};return _0x2a8b06;})});}_0x2bc663=_[_0xce5d('0x53')]({},_0x2bc663,_0x4d7fea[_0xce5d('0x57')]);return db[_0xce5d('0xa2')]['count']({'where':_0x2bc663[_0xce5d('0x52')]})[_0xce5d('0x24')](function(_0x3036f7){_0x18917a[_0xce5d('0x58')]=_0x3036f7;if(_0x4d7fea[_0xce5d('0x45')][_0xce5d('0x59')]){_0x2bc663[_0xce5d('0x5a')]=[{'model':db[_0xce5d('0x7d')],'as':_0xce5d('0xbf'),'required':![]},{'model':db[_0xce5d('0xc0')],'as':_0xce5d('0xc1'),'attributes':[_0xce5d('0x3c'),_0xce5d('0xc2'),_0xce5d('0xc3')],'required':![]},{'model':db[_0xce5d('0xc4')],'as':'Tags','attributes':['id',_0xce5d('0x3c'),_0xce5d('0xc5')],'where':_0x4d7fea['query'][_0xce5d('0xc6')]?{'id':_0x4d7fea[_0xce5d('0x45')][_0xce5d('0xc6')]}:undefined,'required':_0x4d7fea[_0xce5d('0x45')][_0xce5d('0xc6')]?!![]:![]}];}return db[_0xce5d('0xa2')][_0xce5d('0x5b')](_0x2bc663);})['then'](function(_0x22c6c4){_0x18917a[_0xce5d('0x5c')]=_0x22c6c4;return _0x18917a;});}})[_0xce5d('0x24')](respondWithFilteredResult(_0x513dac,_0x2bc663))[_0xce5d('0x2f')](handleError(_0x513dac,null));};exports[_0xce5d('0x3d')]=function(_0x297e44,_0x57f15c,_0x4937ef){var _0x4391ef,_0x1d0846,_0x290788;if(_[_0xce5d('0x97')](_0x297e44[_0xce5d('0x60')][_0xce5d('0x60')])||_0x297e44[_0xce5d('0x60')][_0xce5d('0x60')]===''){throw new db[(_0xce5d('0x9b'))][(_0xce5d('0x7e'))](_0xce5d('0x99'));}if(_['isNil'](_0x297e44['body']['to'])){throw new db[(_0xce5d('0x9b'))][(_0xce5d('0x7e'))](_0xce5d('0xc7'));}_0x4391ef=_0x297e44[_0xce5d('0x60')]['to'];return db[_0xce5d('0x40')][_0xce5d('0x5e')]({'where':{'id':_0x297e44[_0xce5d('0x6b')]['id']},'include':[{'model':db[_0xce5d('0x9f')],'as':_0xce5d('0xc8'),'include':[{'model':db['CmContact'],'as':_0xce5d('0xa0'),'where':{'mobile':_0x4391ef},'limit':0x1,'order':[[_0xce5d('0x82'),'DESC']]}]}]})[_0xce5d('0x24')](handleEntityNotFound(_0x57f15c,null))[_0xce5d('0x24')](function(_0x4db803){if(_0x4db803&&_0x4db803['List']){_0x1d0846=_0x4db803['get']({'plain':!![]});if(_0x1d0846[_0xce5d('0xc8')]&&_0x1d0846[_0xce5d('0xc8')][_0xce5d('0xa0')]['length']){return _0x1d0846['List']['Contacts'][0x0];}return db[_0xce5d('0x7d')][_0xce5d('0x5f')](_['defaults'](_0x297e44[_0xce5d('0x60')],{'firstName':_0x4391ef,'mobile':_0x4391ef,'phone':_0x4391ef,'ListId':_0x1d0846[_0xce5d('0x83')]}));}})['then'](handleEntityNotFound(_0x57f15c,null))[_0xce5d('0x24')](function(_0x3d0fc4){if(_0x3d0fc4){_0x290788=_0x3d0fc4;return db[_0xce5d('0xa2')][_0xce5d('0x5e')]({'where':{'ContactId':_0x290788['id'],'closed':![],'SmsAccountId':_0x1d0846['id']}})[_0xce5d('0x24')](function(_0x3e75ab){if(_0x3e75ab){return[_0x3e75ab,![]];}return db[_0xce5d('0xa2')][_0xce5d('0x5f')]({'UserId':_0x297e44['user']['id'],'ContactId':_0x290788['id'],'SmsAccountId':_0x1d0846['id'],'phone':_0x4391ef,'firstMsgDirection':'out','Messages':[_['merge'](_0x297e44[_0xce5d('0x60')],{'read':![],'body':_0x297e44[_0xce5d('0x60')]['body'],'phone':_0x4391ef,'SmsAccountId':_0x1d0846['id'],'UserId':_0x297e44[_0xce5d('0x64')]['id'],'ContactId':_0x290788['id']})]},{'include':[{'model':db[_0xce5d('0xaa')],'as':_0xce5d('0xc9')}]})['then'](function(_0x2e4bce){return[_0x2e4bce,!![]];});});}})[_0xce5d('0xca')](function(_0x1c6b7e,_0x5a971f){if(_0x5a971f){return _0x1c6b7e;}return db[_0xce5d('0xaa')][_0xce5d('0x5f')](_['merge'](_0x297e44[_0xce5d('0x60')],{'read':![],'body':_0x297e44[_0xce5d('0x60')][_0xce5d('0x60')],'phone':_0x4391ef,'SmsAccountId':_0x1d0846['id'],'SmsInteractionId':_0x1c6b7e['id'],'UserId':_0x297e44[_0xce5d('0x64')]['id'],'ContactId':_0x290788['id']}))['then'](function(_0x2a1a55){_0x1c6b7e[_0xce5d('0xcb')][_0xce5d('0xc9')]=[];_0x1c6b7e[_0xce5d('0xcb')][_0xce5d('0xc9')][_0xce5d('0xa6')](_0x2a1a55[_0xce5d('0xcb')]);return _0x1c6b7e;});})[_0xce5d('0x24')](respondWithResult(_0x57f15c,null))[_0xce5d('0x2f')](handleError(_0x57f15c,null));};exports[_0xce5d('0x31')]=function(_0x5b2ee8,_0x539dc0,_0xd8f2f3){if(_0x5b2ee8[_0xce5d('0x60')]['id']){delete _0x5b2ee8[_0xce5d('0x60')]['id'];}var _0x4f3f1f,_0x2670a7,_0x2ab67;return db['SmsAccount'][_0xce5d('0x5e')]({'where':{'id':_0x5b2ee8[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x539dc0,null))[_0xce5d('0x24')](function(_0x5397de){if(_0x5397de){_0x2ab67=_0x5397de;logger[_0xce5d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xce5d('0x31'),_0xce5d('0xcc'),_0x5397de[_0xce5d('0x55')],util['inspect'](_0x5b2ee8[_0xce5d('0x60')],{'showHidden':![],'depth':null}));switch(_0x5397de[_0xce5d('0x55')]){case _0xce5d('0x89'):if(_0x5b2ee8['body'][_0xce5d('0xcd')]&&_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0x31')]){_0x2670a7=_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0x31')];return db['SmsMessage'][_0xce5d('0x5e')]({'where':{'messageId':_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0xcd')]}});}break;case _0xce5d('0xce'):if(_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0xcf')]&&_0x5b2ee8[_0xce5d('0x60')]['statusInt']){_0x2670a7=_0x5b2ee8[_0xce5d('0x60')]['statusInt'];return db[_0xce5d('0xaa')]['find']({'where':{'messageId':_0x5b2ee8[_0xce5d('0x60')]['requestid']}});}break;case _0xce5d('0x8d'):if(_0x5b2ee8[_0xce5d('0x60')]['message_id']&&_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0xd0')]){_0x2670a7=_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0xd0')];return db['SmsMessage'][_0xce5d('0x5e')]({'where':{'messageId':_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0x8e')]}});}break;case'infobip':var _0x17a64c=_0x5b2ee8['body'][_0xce5d('0x90')][0x0];if(_0x17a64c[_0xce5d('0x87')]&&_0x17a64c[_0xce5d('0x31')][_0xce5d('0xd1')]===_0xce5d('0xd2')){_0x2670a7=_0x17a64c['status'][_0xce5d('0xd1')];return db[_0xce5d('0xaa')][_0xce5d('0x5e')]({'where':{'messageId':_0x17a64c[_0xce5d('0x87')]}});}break;case _0xce5d('0x93'):if(_0x5b2ee8['body'][_0xce5d('0x87')]&&_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0x31')]){_0x2670a7=_0x5b2ee8['body']['status'];return db[_0xce5d('0xaa')][_0xce5d('0x5e')]({'where':{'messageId':_0x5b2ee8[_0xce5d('0x60')]['messageId']}});}break;case _0xce5d('0xd3'):if(_0x5b2ee8['body'][0x0][_0xce5d('0x2d')]['id']){_0x2670a7=_0x5b2ee8[_0xce5d('0x60')][0x0][_0xce5d('0x55')];return db[_0xce5d('0xaa')]['find']({'where':{'messageId':_0x5b2ee8[_0xce5d('0x60')][0x0][_0xce5d('0x2d')]['id']}});}break;case _0xce5d('0x95'):if(_0x5b2ee8[_0xce5d('0x60')]['redif']&&_0x5b2ee8[_0xce5d('0x60')]['status']){_0x2670a7=_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0x31')];return db[_0xce5d('0xaa')][_0xce5d('0x5e')]({'where':{'messageId':_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0xd4')]}});}break;}}})[_0xce5d('0x24')](handleEntityNotFound(_0x539dc0,null))[_0xce5d('0x24')](function(_0x551cc2){if(_0x551cc2){_0x4f3f1f=_0x551cc2;switch(_0x2ab67['type']){case'skebby':if(_0x2670a7===_0xce5d('0xd2')){return _0x4f3f1f[_0xce5d('0x6a')]({'read':!![]});}else{logger['error'](_0xce5d('0x29'),_0xce5d('0x31'),_0xce5d('0x89'),util[_0xce5d('0xd5')](_0x5b2ee8[_0xce5d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xce5d('0xce'):if(_0x2670a7==='1'){return _0x4f3f1f[_0xce5d('0x6a')]({'read':!![]});}else{logger['error'](_0xce5d('0x29'),'status',_0xce5d('0x89'),util[_0xce5d('0xd5')](_0x5b2ee8['body'],{'showHidden':![],'depth':null}));}break;case _0xce5d('0x8d'):if(!_0x5b2ee8[_0xce5d('0x60')][_0xce5d('0xd6')]&&_0x2670a7>=0xc8&&_0x2670a7<=0xce){return _0x4f3f1f[_0xce5d('0x6a')]({'read':!![]});}else{logger[_0xce5d('0x2b')](_0xce5d('0x29'),_0xce5d('0x31'),'clicksend',util[_0xce5d('0xd5')](_0x5b2ee8['body'],{'showHidden':![],'depth':null}));}break;case _0xce5d('0xd7'):var _0x272781=_0x5b2ee8['body'][_0xce5d('0x90')][0x0];if(_0x272781['status'][_0xce5d('0xd1')]==='DELIVERED'){return _0x4f3f1f['update']({'read':!![]});}else{logger['error'](_0xce5d('0x29'),_0xce5d('0x31'),_0xce5d('0xd7'),util[_0xce5d('0xd5')](_0x5b2ee8[_0xce5d('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2670a7=='DELIVERED_TO_GATEWAY'||_0x2670a7==_0xce5d('0xd8')){return _0x4f3f1f['update']({'read':!![]});}else{logger[_0xce5d('0x2b')](_0xce5d('0x29'),_0xce5d('0x31'),_0xce5d('0x93'),util['inspect'](_0x5b2ee8[_0xce5d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xce5d('0xd3'):if(_0x2670a7==_0xce5d('0xd9')){return _0x4f3f1f[_0xce5d('0x6a')]({'read':!![]});}else{logger[_0xce5d('0x2b')](_0xce5d('0x29'),_0xce5d('0x31'),'bandwidth',util[_0xce5d('0xd5')](_0x5b2ee8[_0xce5d('0x60')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x2670a7===_0xce5d('0xda')||_0x2670a7===_0xce5d('0xdb')){return _0x4f3f1f[_0xce5d('0x6a')]({'read':!![]});}else{logger['error'](_0xce5d('0x29'),_0xce5d('0x31'),_0xce5d('0x95'),util[_0xce5d('0xd5')](_0x5b2ee8['body'],{'showHidden':![],'depth':null}));}break;}return _0x4f3f1f;}})[_0xce5d('0x24')](respondWithResult(_0x539dc0,null))[_0xce5d('0x2f')](handleError(_0x539dc0,null));};exports[_0xce5d('0xdc')]=function(_0x476fa1,_0x31800a,_0xee4bbc){var _0x234155,_0x4236f7,_0xe0eeda;return db[_0xce5d('0x40')][_0xce5d('0x5e')]({'where':{'id':_0x476fa1['params']['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x31800a,null))[_0xce5d('0x24')](function(_0x23b0a1){if(_0x23b0a1){_0xe0eeda=_0x23b0a1;logger[_0xce5d('0x28')](_0xce5d('0x29'),_0xce5d('0x31'),'received\x20delivery\x20report\x20from',_0x23b0a1[_0xce5d('0x55')],util[_0xce5d('0xd5')](_0x476fa1[_0xce5d('0x45')],{'showHidden':![],'depth':null}));switch(_0x23b0a1['type']){case _0xce5d('0xdd'):if(_0x476fa1[_0xce5d('0x45')][_0xce5d('0xde')]&&_0x476fa1[_0xce5d('0x45')][_0xce5d('0xdf')]){_0x4236f7=_0x476fa1[_0xce5d('0x45')]['state'];return db[_0xce5d('0xaa')][_0xce5d('0x5e')]({'where':{'messageId':_0x476fa1[_0xce5d('0x45')][_0xce5d('0xde')]}});}break;}}})[_0xce5d('0x24')](handleEntityNotFound(_0x31800a,null))[_0xce5d('0x24')](function(_0x1fb6fc){if(_0x1fb6fc){_0x234155=_0x1fb6fc;switch(_0xe0eeda[_0xce5d('0x55')]){case _0xce5d('0xdd'):if(_0x4236f7==='2'||_0x4236f7==='6'){return _0x234155[_0xce5d('0x6a')]({'read':!![]});}else{logger[_0xce5d('0x2b')](_0xce5d('0x29'),_0xce5d('0x31'),_0xce5d('0xdd'),util['inspect'](_0x476fa1[_0xce5d('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x234155;}})[_0xce5d('0x24')](respondWithResult(_0x31800a,null))[_0xce5d('0x2f')](handleError(_0x31800a,null));};exports[_0xce5d('0xe0')]=function(_0x341e48,_0x1597ea,_0x446b6a){return db[_0xce5d('0x40')][_0xce5d('0x5e')]({'where':{'id':_0x341e48[_0xce5d('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1597ea,null))['then'](function(_0x330734){if(_0x330734){return _0x330734['addAgents'](_0x341e48[_0xce5d('0x60')][_0xce5d('0x73')],_[_0xce5d('0xe1')](_0x341e48['body'],[_0xce5d('0x73'),'id'])||{})[_0xce5d('0xca')](function(_0x543009){for(var _0x59fdae=0x0;_0x59fdae<_0x341e48[_0xce5d('0x60')][_0xce5d('0x73')][_0xce5d('0x4b')];_0x59fdae+=0x1){socket[_0xce5d('0xe2')]('userSmsAccount:save',{'UserId':Number(_0x341e48['body'][_0xce5d('0x73')][_0x59fdae]),'SmsAccountId':Number(_0x341e48['params']['id'])});}return _0x543009;});}})['then'](respondWithResult(_0x1597ea,null))['catch'](handleError(_0x1597ea,null));};exports[_0xce5d('0xe3')]=function(_0x4ca83d,_0x2483ee,_0xb0984){return db['SmsAccount']['find']({'where':{'id':_0x4ca83d[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x2483ee,null))[_0xce5d('0x24')](function(_0x227da4){if(_0x227da4){return _0x227da4[_0xce5d('0xe3')](_0x4ca83d[_0xce5d('0x45')][_0xce5d('0x73')])[_0xce5d('0x24')](function(){if(_[_0xce5d('0xe4')](_0x4ca83d[_0xce5d('0x45')][_0xce5d('0x73')])){for(var _0x463243=0x0;_0x463243<_0x4ca83d[_0xce5d('0x45')][_0xce5d('0x73')][_0xce5d('0x4b')];_0x463243+=0x1){socket[_0xce5d('0xe2')](_0xce5d('0xe5'),{'UserId':Number(_0x4ca83d[_0xce5d('0x45')][_0xce5d('0x73')][_0x463243]),'SmsAccountId':Number(_0x4ca83d[_0xce5d('0x6b')]['id'])});}}else{socket[_0xce5d('0xe2')](_0xce5d('0xe5'),{'UserId':Number(_0x4ca83d[_0xce5d('0x45')][_0xce5d('0x73')]),'SmsAccountId':Number(_0x4ca83d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2483ee,null))[_0xce5d('0x2f')](handleError(_0x2483ee,null));};exports[_0xce5d('0xe6')]=function(_0x137236,_0x1c431a,_0x5d854b){var _0xd53686={};var _0x52243e={};var _0x53e009;var _0x2757ef;return db[_0xce5d('0x40')]['findOne']({'where':{'id':_0x137236[_0xce5d('0x6b')]['id']}})[_0xce5d('0x24')](handleEntityNotFound(_0x1c431a,null))[_0xce5d('0x24')](function(_0xdc850b){if(_0xdc850b){_0x53e009=_0xdc850b;_0x52243e[_0xce5d('0x44')]=_[_0xce5d('0x46')](db[_0xce5d('0xc0')][_0xce5d('0x41')]);_0x52243e[_0xce5d('0x45')]=_[_0xce5d('0x46')](_0x137236['query']);_0x52243e[_0xce5d('0x47')]=_[_0xce5d('0x48')](_0x52243e[_0xce5d('0x44')],_0x52243e[_0xce5d('0x45')]);_0xd53686[_0xce5d('0x4a')]=_['intersection'](_0x52243e[_0xce5d('0x44')],qs[_0xce5d('0x49')](_0x137236[_0xce5d('0x45')]['fields']));_0xd53686[_0xce5d('0x4a')]=_0xd53686['attributes'][_0xce5d('0x4b')]?_0xd53686[_0xce5d('0x4a')]:_0x52243e[_0xce5d('0x44')];_0xd53686[_0xce5d('0x4f')]=qs['sort'](_0x137236[_0xce5d('0x45')][_0xce5d('0x50')]);_0xd53686[_0xce5d('0x52')]=qs[_0xce5d('0x47')](_[_0xce5d('0x71')](_0x137236[_0xce5d('0x45')],_0x52243e['filters']));if(_0x137236[_0xce5d('0x45')][_0xce5d('0x51')]){_0xd53686['where']=_[_0xce5d('0x53')](_0xd53686['where'],{'$or':_['map'](_0xd53686[_0xce5d('0x4a')],function(_0x32db02){var _0x43bbe5={};_0x43bbe5[_0x32db02]={'$like':'%'+_0x137236[_0xce5d('0x45')][_0xce5d('0x51')]+'%'};return _0x43bbe5;})});}_0xd53686=_['merge']({},_0xd53686,_0x137236[_0xce5d('0x57')]);return _0x53e009['getAgents'](_0xd53686);}})[_0xce5d('0x24')](function(_0x490d6d){if(_0x490d6d){_0x2757ef=_0x490d6d['length'];if(!_0x137236[_0xce5d('0x45')][_0xce5d('0x4c')](_0xce5d('0x4d'))){_0xd53686[_0xce5d('0x4e')]=qs['limit'](_0x137236[_0xce5d('0x45')][_0xce5d('0x4e')]);_0xd53686[_0xce5d('0x34')]=qs[_0xce5d('0x34')](_0x137236[_0xce5d('0x45')][_0xce5d('0x34')]);}return _0x53e009[_0xce5d('0xe6')](_0xd53686);}})[_0xce5d('0x24')](function(_0x3d6004){if(_0x3d6004){return _0x3d6004?{'count':_0x2757ef,'rows':_0x3d6004}:null;}})[_0xce5d('0x24')](respondWithResult(_0x1c431a,null))[_0xce5d('0x2f')](handleError(_0x1c431a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 824b9a1..864a4a7 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 _0xd16e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d8d4d,_0x20cb34){var _0x23ec42=function(_0x3876b7){while(--_0x3876b7){_0x4d8d4d['push'](_0x4d8d4d['shift']());}};_0x23ec42(++_0x20cb34);}(_0xd16e,0xd7));var _0xed16=function(_0x2c0397,_0x3bcfd9){_0x2c0397=_0x2c0397-0x0;var _0x2002eb=_0xd16e[_0x2c0397];return _0x2002eb;};'use strict';var EventEmitter=require(_0xed16('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xed16('0x1')](0x0);var events={'afterCreate':_0xed16('0x2'),'afterUpdate':_0xed16('0x3'),'afterDestroy':_0xed16('0x4')};function emitEvent(_0x15a8ef){return function(_0x32cb83,_0x2941d5,_0x2ad134){SmsAccountEvents[_0xed16('0x5')](_0x15a8ef+':'+_0x32cb83['id'],_0x32cb83);SmsAccountEvents['emit'](_0x15a8ef,_0x32cb83);_0x2ad134(null);};}for(var e in events){if(events[_0xed16('0x6')](e)){var event=events[e];SmsAccount[_0xed16('0x7')](e,emitEvent(event));}}module[_0xed16('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x715e=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x44a5b3,_0x453778){var _0x482e09=function(_0x2bd6f6){while(--_0x2bd6f6){_0x44a5b3['push'](_0x44a5b3['shift']());}};_0x482e09(++_0x453778);}(_0x715e,0xf9));var _0xe715=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x715e[_0x377a6e];return _0x37f751;};'use strict';var EventEmitter=require(_0xe715('0x0'));var SmsAccount=require(_0xe715('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe715('0x2'),'afterDestroy':_0xe715('0x3')};function emitEvent(_0x41f788){return function(_0x348e19,_0x2ccdd5,_0x2febac){SmsAccountEvents['emit'](_0x41f788+':'+_0x348e19['id'],_0x348e19);SmsAccountEvents[_0xe715('0x4')](_0x41f788,_0x348e19);_0x2febac(null);};}for(var e in events){if(events[_0xe715('0x5')](e)){var event=events[e];SmsAccount[_0xe715('0x6')](e,emitEvent(event));}}module[_0xe715('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index bc41749..812826b 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 _0x7ef9=['sms_accounts','lodash','util','../../config/logger','moment','bluebird','rimraf','exports','SmsAccount'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7ef9,0x9a));var _0x97ef=function(_0x20b260,_0x5e028e){_0x20b260=_0x20b260-0x0;var _0x41aec8=_0x7ef9[_0x20b260];return _0x41aec8;};'use strict';var _=require(_0x97ef('0x0'));var util=require(_0x97ef('0x1'));var logger=require(_0x97ef('0x2'))('api');var moment=require(_0x97ef('0x3'));var BPromise=require(_0x97ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x97ef('0x5'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x97ef('0x6')]=function(_0x3f5c22,_0x3a82b0){return _0x3f5c22['define'](_0x97ef('0x7'),attributes,{'tableName':_0x97ef('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23e8=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x15ed2c,_0x3bd32b){var _0x5d79bd=function(_0x5aab44){while(--_0x5aab44){_0x15ed2c['push'](_0x15ed2c['shift']());}};_0x5d79bd(++_0x3bd32b);}(_0x23e8,0x118));var _0x823e=function(_0x25706f,_0x1180d4){_0x25706f=_0x25706f-0x0;var _0x33a258=_0x23e8[_0x25706f];return _0x33a258;};'use strict';var _=require(_0x823e('0x0'));var util=require(_0x823e('0x1'));var logger=require('../../config/logger')(_0x823e('0x2'));var moment=require(_0x823e('0x3'));var BPromise=require(_0x823e('0x4'));var rp=require(_0x823e('0x5'));var fs=require('fs');var path=require(_0x823e('0x6'));var rimraf=require(_0x823e('0x7'));var config=require(_0x823e('0x8'));var attributes=require(_0x823e('0x9'));module[_0x823e('0xa')]=function(_0x55d7d0,_0x1fb954){return _0x55d7d0[_0x823e('0xb')]('SmsAccount',attributes,{'tableName':_0x823e('0xc'),'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 42c981e..5cce795 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 _0x0922=['options','raw','attributes','map','model','include','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSmsAccount','SmsAccount','find'];(function(_0x157e8a,_0x4836a9){var _0x6c7475=function(_0x4fbfd2){while(--_0x4fbfd2){_0x157e8a['push'](_0x157e8a['shift']());}};_0x6c7475(++_0x4836a9);}(_0x0922,0xab));var _0x2092=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0922[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x2092('0x0'));var util=require(_0x2092('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2092('0x2'));var fs=require('fs');var Redis=require(_0x2092('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2092('0x4'));var logger=require(_0x2092('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2092('0x6'));var client=jayson[_0x2092('0x7')]['http']({'port':0x232a});config[_0x2092('0x8')]=_[_0x2092('0x9')](config['redis'],{'host':_0x2092('0xa'),'port':0x18eb});var socket=require(_0x2092('0xb'))(new Redis(config['redis']));require(_0x2092('0xc'))['register'](socket);function respondWithRpcPromise(_0x23de5a,_0x5d85f6,_0x388e78){return new BPromise(function(_0x3e329e,_0x5ba95b){return client[_0x2092('0xd')](_0x23de5a,_0x388e78)[_0x2092('0xe')](function(_0x18a548){logger[_0x2092('0xf')](_0x2092('0x10'),_0x5d85f6,_0x2092('0x11'));logger[_0x2092('0x12')](_0x2092('0x13'),_0x5d85f6,'request\x20sent',JSON['stringify'](_0x18a548));if(_0x18a548[_0x2092('0x14')]){if(_0x18a548[_0x2092('0x14')][_0x2092('0x15')]===0x1f4){logger['error'](_0x2092('0x10'),_0x5d85f6,_0x18a548['error'][_0x2092('0x16')]);return _0x5ba95b(_0x18a548[_0x2092('0x14')][_0x2092('0x16')]);}logger[_0x2092('0x14')](_0x2092('0x10'),_0x5d85f6,_0x18a548['error']['message']);return _0x3e329e(_0x18a548[_0x2092('0x14')]['message']);}else{logger[_0x2092('0xf')](_0x2092('0x10'),_0x5d85f6,_0x2092('0x11'));_0x3e329e(_0x18a548['result'][_0x2092('0x16')]);}})[_0x2092('0x17')](function(_0x201ead){logger[_0x2092('0x14')](_0x2092('0x10'),_0x5d85f6,_0x201ead);_0x5ba95b(_0x201ead);});});}exports[_0x2092('0x18')]=function(_0x1bd41d){var _0x8a806c=this;return new Promise(function(_0x2f434d,_0x95cb83){return db[_0x2092('0x19')][_0x2092('0x1a')]({'raw':_0x1bd41d[_0x2092('0x1b')]?_0x1bd41d[_0x2092('0x1b')][_0x2092('0x1c')]===undefined?!![]:![]:!![],'where':_0x1bd41d[_0x2092('0x1b')]?_0x1bd41d['options']['where']||null:null,'attributes':_0x1bd41d['options']?_0x1bd41d['options'][_0x2092('0x1d')]||null:null,'include':_0x1bd41d['options']?_0x1bd41d['options']['include']?_[_0x2092('0x1e')](_0x1bd41d[_0x2092('0x1b')]['include'],function(_0x5a5536){return{'model':db[_0x5a5536[_0x2092('0x1f')]],'as':_0x5a5536['as'],'attributes':_0x5a5536[_0x2092('0x1d')],'include':_0x5a5536[_0x2092('0x20')]?_['map'](_0x5a5536[_0x2092('0x20')],function(_0x15e90d){return{'model':db[_0x15e90d[_0x2092('0x1f')]],'as':_0x15e90d['as'],'attributes':_0x15e90d[_0x2092('0x1d')],'include':_0x15e90d['include']?_[_0x2092('0x1e')](_0x15e90d[_0x2092('0x20')],function(_0x5c9e46){return{'model':db[_0x5c9e46['model']],'as':_0x5c9e46['as'],'attributes':_0x5c9e46[_0x2092('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fd5b7){logger[_0x2092('0xf')](_0x2092('0x18'),_0x1bd41d);logger[_0x2092('0x12')](_0x2092('0x18'),_0x1bd41d,JSON['stringify'](_0x2fd5b7));_0x2f434d(_0x2fd5b7);})['catch'](function(_0x90251f){logger[_0x2092('0x14')](_0x2092('0x18'),_0x90251f['message'],_0x1bd41d);_0x95cb83(_0x8a806c['error'](0x1f4,_0x90251f[_0x2092('0x16')]));});});}; \ No newline at end of file +var _0x4317=['defaults','redis','localhost','socket.io-emitter','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39a5a7,_0x299298){var _0x1c8150=function(_0xefdff3){while(--_0xefdff3){_0x39a5a7['push'](_0x39a5a7['shift']());}};_0x1c8150(++_0x299298);}(_0x4317,0xfe));var _0x7431=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4317[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7431('0x0'));var util=require(_0x7431('0x1'));var moment=require(_0x7431('0x2'));var BPromise=require(_0x7431('0x3'));var rs=require(_0x7431('0x4'));var fs=require('fs');var Redis=require(_0x7431('0x5'));var db=require(_0x7431('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7431('0x7'));var config=require(_0x7431('0x8'));var jayson=require(_0x7431('0x9'));var client=jayson[_0x7431('0xa')][_0x7431('0xb')]({'port':0x232a});config['redis']=_[_0x7431('0xc')](config[_0x7431('0xd')],{'host':_0x7431('0xe'),'port':0x18eb});var socket=require(_0x7431('0xf'))(new Redis(config[_0x7431('0xd')]));require('./smsAccount.socket')[_0x7431('0x10')](socket);function respondWithRpcPromise(_0x19fa9d,_0x3d4a2c,_0xe0d752){return new BPromise(function(_0x14c03c,_0x558ad6){return client[_0x7431('0x11')](_0x19fa9d,_0xe0d752)[_0x7431('0x12')](function(_0x2259b7){logger['info'](_0x7431('0x13'),_0x3d4a2c,_0x7431('0x14'));logger[_0x7431('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d4a2c,_0x7431('0x14'),JSON[_0x7431('0x16')](_0x2259b7));if(_0x2259b7[_0x7431('0x17')]){if(_0x2259b7[_0x7431('0x17')][_0x7431('0x18')]===0x1f4){logger[_0x7431('0x17')](_0x7431('0x13'),_0x3d4a2c,_0x2259b7['error'][_0x7431('0x19')]);return _0x558ad6(_0x2259b7[_0x7431('0x17')][_0x7431('0x19')]);}logger[_0x7431('0x17')]('SmsAccount,\x20%s,\x20%s',_0x3d4a2c,_0x2259b7[_0x7431('0x17')]['message']);return _0x14c03c(_0x2259b7[_0x7431('0x17')][_0x7431('0x19')]);}else{logger[_0x7431('0x1a')](_0x7431('0x13'),_0x3d4a2c,'request\x20sent');_0x14c03c(_0x2259b7[_0x7431('0x1b')][_0x7431('0x19')]);}})[_0x7431('0x1c')](function(_0x1a1463){logger[_0x7431('0x17')](_0x7431('0x13'),_0x3d4a2c,_0x1a1463);_0x558ad6(_0x1a1463);});});}exports[_0x7431('0x1d')]=function(_0x52c252){var _0x11c805=this;return new Promise(function(_0x5796b9,_0x40c5cb){return db[_0x7431('0x1e')][_0x7431('0x1f')]({'raw':_0x52c252['options']?_0x52c252['options'][_0x7431('0x20')]===undefined?!![]:![]:!![],'where':_0x52c252[_0x7431('0x21')]?_0x52c252[_0x7431('0x21')]['where']||null:null,'attributes':_0x52c252[_0x7431('0x21')]?_0x52c252[_0x7431('0x21')]['attributes']||null:null,'include':_0x52c252['options']?_0x52c252['options'][_0x7431('0x22')]?_[_0x7431('0x23')](_0x52c252[_0x7431('0x21')][_0x7431('0x22')],function(_0x3c3258){return{'model':db[_0x3c3258[_0x7431('0x24')]],'as':_0x3c3258['as'],'attributes':_0x3c3258['attributes'],'include':_0x3c3258[_0x7431('0x22')]?_[_0x7431('0x23')](_0x3c3258[_0x7431('0x22')],function(_0x150779){return{'model':db[_0x150779[_0x7431('0x24')]],'as':_0x150779['as'],'attributes':_0x150779[_0x7431('0x25')],'include':_0x150779[_0x7431('0x22')]?_[_0x7431('0x23')](_0x150779['include'],function(_0x4200e8){return{'model':db[_0x4200e8[_0x7431('0x24')]],'as':_0x4200e8['as'],'attributes':_0x4200e8['attributes']};}):[]};}):[]};}):[]:[]})[_0x7431('0x12')](function(_0x307c16){logger[_0x7431('0x1a')]('ShowSmsAccount',_0x52c252);logger[_0x7431('0x15')]('ShowSmsAccount',_0x52c252,JSON['stringify'](_0x307c16));_0x5796b9(_0x307c16);})[_0x7431('0x1c')](function(_0x6ee2e8){logger['error'](_0x7431('0x1d'),_0x6ee2e8['message'],_0x52c252);_0x40c5cb(_0x11c805[_0x7431('0x17')](0x1f4,_0x6ee2e8[_0x7431('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 5a2752b..7a20db4 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 12482db..f4bcd38 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x2537bf,_0x5db4ed){var _0x4cd7ab=function(_0x43b314){while(--_0x43b314){_0x2537bf['push'](_0x2537bf['shift']());}};_0x4cd7ab(++_0x5db4ed);}(_0x008c,0x188));var _0xc008=function(_0x54abae,_0x154d8f){_0x54abae=_0x54abae-0x0;var _0x297e50=_0x008c[_0x54abae];return _0x297e50;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x314219,_0x4105c0){var _0x31470c=function(_0x4302de){while(--_0x4302de){_0x314219['push'](_0x314219['shift']());}};_0x31470c(++_0x4105c0);}(_0xedd9,0xfc));var _0x9edd=function(_0x454118,_0x2a44b4){_0x454118=_0x454118-0x0;var _0xfa413a=_0xedd9[_0x454118];return _0xfa413a;};'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');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ed49c17..9cf8b78 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 _0x67c5=['STRING','noop','TEXT','INTEGER'];(function(_0x5cd10f,_0x4d2a70){var _0x29f1b4=function(_0x2686a6){while(--_0x2686a6){_0x5cd10f['push'](_0x5cd10f['shift']());}};_0x29f1b4(++_0x4d2a70);}(_0x67c5,0x9f));var _0x567c=function(_0x1fa853,_0xa3d5a5){_0x1fa853=_0x1fa853-0x0;var _0x4791cd=_0x67c5[_0x1fa853];return _0x4791cd;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x567c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x567c('0x1')],'allowNull':![],'defaultValue':_0x567c('0x2')},'appdata':{'type':Sequelize[_0x567c('0x3')]()},'description':{'type':Sequelize[_0x567c('0x1')]},'interval':{'type':Sequelize[_0x567c('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x67ea=['INTEGER','TEXT','*,*,*,*','sequelize','exports'];(function(_0x375877,_0x143cde){var _0x24aa34=function(_0x4a3348){while(--_0x4a3348){_0x375877['push'](_0x375877['shift']());}};_0x24aa34(++_0x143cde);}(_0x67ea,0x1e8));var _0xa67e=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0x67ea[_0x54e6f5];return _0x5e8794;};'use strict';var Sequelize=require(_0xa67e('0x0'));module[_0xa67e('0x1')]={'priority':{'type':Sequelize[_0xa67e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa67e('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa67e('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1dae43f..49e2949 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 _0xe8b7=['SmsApplication','includeAll','rows','catch','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','where','merge'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xe8b7,0x92));var _0x7e8b=function(_0x55d22f,_0x2296db){_0x55d22f=_0x55d22f-0x0;var _0x45fb5e=_0xe8b7[_0x55d22f];return _0x45fb5e;};'use strict';var emlformat=require(_0x7e8b('0x0'));var rimraf=require(_0x7e8b('0x1'));var zipdir=require(_0x7e8b('0x2'));var jsonpatch=require(_0x7e8b('0x3'));var rp=require(_0x7e8b('0x4'));var moment=require(_0x7e8b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e8b('0x6'));var path=require(_0x7e8b('0x7'));var sox=require(_0x7e8b('0x8'));var csv=require('to-csv');var ejs=require(_0x7e8b('0x9'));var fs=require('fs');var fs_extra=require(_0x7e8b('0xa'));var _=require(_0x7e8b('0xb'));var squel=require(_0x7e8b('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e8b('0xd'));var deskjs=require(_0x7e8b('0xe'));var toCsv=require(_0x7e8b('0xf'));var querystring=require(_0x7e8b('0x10'));var Papa=require(_0x7e8b('0x11'));var Redis=require(_0x7e8b('0x12'));var authService=require(_0x7e8b('0x13'));var qs=require(_0x7e8b('0x14'));var as=require(_0x7e8b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e8b('0x16'))('api');var utils=require(_0x7e8b('0x17'));var config=require(_0x7e8b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1083ca,_0x3adbc4){_0x3adbc4=_0x3adbc4||0xcc;return function(_0x476c1f){if(_0x476c1f){return _0x1083ca[_0x7e8b('0x19')](_0x3adbc4);}return _0x1083ca[_0x7e8b('0x1a')](_0x3adbc4)[_0x7e8b('0x1b')]();};}function respondWithResult(_0x5b295c,_0x2bd232){_0x2bd232=_0x2bd232||0xc8;return function(_0x2c05c7){if(_0x2c05c7){return _0x5b295c[_0x7e8b('0x1a')](_0x2bd232)[_0x7e8b('0x1c')](_0x2c05c7);}};}function respondWithFilteredResult(_0x780de,_0x2f5e49){return function(_0x59aa74){if(_0x59aa74){var _0x4eaa7e=typeof _0x2f5e49[_0x7e8b('0x1d')]===_0x7e8b('0x1e')&&typeof _0x2f5e49[_0x7e8b('0x1f')]==='undefined';var _0x377e23=_0x59aa74['count'];var _0x155b79=_0x4eaa7e?0x0:_0x2f5e49[_0x7e8b('0x1d')];var _0x2beb79=_0x4eaa7e?_0x59aa74[_0x7e8b('0x20')]:_0x2f5e49[_0x7e8b('0x1d')]+_0x2f5e49[_0x7e8b('0x1f')];var _0x5d7523;if(_0x2beb79>=_0x377e23){_0x2beb79=_0x377e23;_0x5d7523=0xc8;}else{_0x5d7523=0xce;}_0x780de['status'](_0x5d7523);return _0x780de['set']('Content-Range',_0x155b79+'-'+_0x2beb79+'/'+_0x377e23)[_0x7e8b('0x1c')](_0x59aa74);}return null;};}function patchUpdates(_0xdc97ad){return function(_0x10cd0a){try{jsonpatch[_0x7e8b('0x21')](_0x10cd0a,_0xdc97ad,!![]);}catch(_0xa74bbe){return BPromise['reject'](_0xa74bbe);}return _0x10cd0a[_0x7e8b('0x22')]();};}function saveUpdates(_0x203702,_0x5e8173){return function(_0x1986df){if(_0x1986df){return _0x1986df[_0x7e8b('0x23')](_0x203702)[_0x7e8b('0x24')](function(_0x1d3106){return _0x1d3106;});}return null;};}function removeEntity(_0x544357,_0x3625e8){return function(_0x19d824){if(_0x19d824){return _0x19d824[_0x7e8b('0x25')]()[_0x7e8b('0x24')](function(){_0x544357[_0x7e8b('0x1a')](0xcc)[_0x7e8b('0x1b')]();});}};}function handleEntityNotFound(_0x8219f1,_0xf3dd45){return function(_0x52bfdf){if(!_0x52bfdf){_0x8219f1[_0x7e8b('0x19')](0x194);}return _0x52bfdf;};}function handleError(_0x2ece3d,_0x54906e){_0x54906e=_0x54906e||0x1f4;return function(_0x6f7d9d){logger['error'](_0x6f7d9d[_0x7e8b('0x26')]);if(_0x6f7d9d[_0x7e8b('0x27')]){delete _0x6f7d9d[_0x7e8b('0x27')];}_0x2ece3d['status'](_0x54906e)[_0x7e8b('0x28')](_0x6f7d9d);};}exports['index']=function(_0x49ac86,_0x14e4ae){var _0x1252f0={},_0x58c15d={},_0x42d2b2={'count':0x0,'rows':[]};var _0x4a3389=_[_0x7e8b('0x29')](db['SmsApplication'][_0x7e8b('0x2a')],function(_0x3c707c){return{'name':_0x3c707c['fieldName'],'type':_0x3c707c[_0x7e8b('0x2b')][_0x7e8b('0x2c')]};});_0x58c15d[_0x7e8b('0x2d')]=_[_0x7e8b('0x29')](_0x4a3389,_0x7e8b('0x27'));_0x58c15d[_0x7e8b('0x2e')]=_[_0x7e8b('0x2f')](_0x49ac86['query']);_0x58c15d[_0x7e8b('0x30')]=_[_0x7e8b('0x31')](_0x58c15d['model'],_0x58c15d[_0x7e8b('0x2e')]);_0x1252f0['attributes']=_['intersection'](_0x58c15d[_0x7e8b('0x2d')],qs[_0x7e8b('0x32')](_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x32')]));_0x1252f0[_0x7e8b('0x33')]=_0x1252f0[_0x7e8b('0x33')][_0x7e8b('0x34')]?_0x1252f0[_0x7e8b('0x33')]:_0x58c15d[_0x7e8b('0x2d')];if(!_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x35')]('nolimit')){_0x1252f0['limit']=qs[_0x7e8b('0x1f')](_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x1f')]);_0x1252f0[_0x7e8b('0x1d')]=qs[_0x7e8b('0x1d')](_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x1d')]);}_0x1252f0[_0x7e8b('0x36')]=qs['sort'](_0x49ac86[_0x7e8b('0x2e')]['sort']);_0x1252f0['where']=qs['filters'](_[_0x7e8b('0x37')](_0x49ac86['query'],_0x58c15d[_0x7e8b('0x30')]),_0x4a3389);if(_0x49ac86['query']['filter']){_0x1252f0['where']=_['merge'](_0x1252f0[_0x7e8b('0x38')],{'$or':_[_0x7e8b('0x29')](_0x4a3389,function(_0x445526){if(_0x445526[_0x7e8b('0x2b')]!=='VIRTUAL'){var _0x59ec3e={};_0x59ec3e[_0x445526['name']]={'$like':'%'+_0x49ac86[_0x7e8b('0x2e')]['filter']+'%'};return _0x59ec3e;}})});}_0x1252f0=_[_0x7e8b('0x39')]({},_0x1252f0,_0x49ac86['options']);var _0x4c930f={'where':_0x1252f0[_0x7e8b('0x38')]};return db[_0x7e8b('0x3a')][_0x7e8b('0x20')](_0x4c930f)[_0x7e8b('0x24')](function(_0x486119){_0x42d2b2['count']=_0x486119;if(_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x3b')]){_0x1252f0['include']=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x1252f0);})['then'](function(_0x649584){_0x42d2b2[_0x7e8b('0x3c')]=_0x649584;return _0x42d2b2;})['then'](respondWithFilteredResult(_0x14e4ae,_0x1252f0))[_0x7e8b('0x3d')](handleError(_0x14e4ae,null));};exports['show']=function(_0x20d078,_0x543f9a){var _0x3c0445={'raw':!![],'where':{'id':_0x20d078[_0x7e8b('0x3e')]['id']}},_0x201a48={};_0x201a48[_0x7e8b('0x2d')]=_['keys'](db[_0x7e8b('0x3a')][_0x7e8b('0x2a')]);_0x201a48[_0x7e8b('0x2e')]=_[_0x7e8b('0x2f')](_0x20d078[_0x7e8b('0x2e')]);_0x201a48['filters']=_[_0x7e8b('0x31')](_0x201a48['model'],_0x201a48[_0x7e8b('0x2e')]);_0x3c0445[_0x7e8b('0x33')]=_['intersection'](_0x201a48[_0x7e8b('0x2d')],qs[_0x7e8b('0x32')](_0x20d078[_0x7e8b('0x2e')]['fields']));_0x3c0445[_0x7e8b('0x33')]=_0x3c0445[_0x7e8b('0x33')]['length']?_0x3c0445[_0x7e8b('0x33')]:_0x201a48[_0x7e8b('0x2d')];if(_0x20d078[_0x7e8b('0x2e')][_0x7e8b('0x3b')]){_0x3c0445[_0x7e8b('0x3f')]=[{'all':!![]}];}_0x3c0445=_[_0x7e8b('0x39')]({},_0x3c0445,_0x20d078[_0x7e8b('0x40')]);return db[_0x7e8b('0x3a')][_0x7e8b('0x41')](_0x3c0445)[_0x7e8b('0x24')](handleEntityNotFound(_0x543f9a,null))[_0x7e8b('0x24')](respondWithResult(_0x543f9a,null))['catch'](handleError(_0x543f9a,null));};exports[_0x7e8b('0x42')]=function(_0x2d72e0,_0x32f81c){return db[_0x7e8b('0x3a')][_0x7e8b('0x42')](_0x2d72e0[_0x7e8b('0x43')],{})['then'](respondWithResult(_0x32f81c,0xc9))[_0x7e8b('0x3d')](handleError(_0x32f81c,null));};exports[_0x7e8b('0x23')]=function(_0x364da6,_0x3b5c6f){if(_0x364da6['body']['id']){delete _0x364da6[_0x7e8b('0x43')]['id'];}return db[_0x7e8b('0x3a')][_0x7e8b('0x41')]({'where':{'id':_0x364da6['params']['id']}})[_0x7e8b('0x24')](handleEntityNotFound(_0x3b5c6f,null))[_0x7e8b('0x24')](saveUpdates(_0x364da6['body'],null))['then'](respondWithResult(_0x3b5c6f,null))['catch'](handleError(_0x3b5c6f,null));};exports[_0x7e8b('0x25')]=function(_0x1ab8da,_0x111d77){return db[_0x7e8b('0x3a')][_0x7e8b('0x41')]({'where':{'id':_0x1ab8da[_0x7e8b('0x3e')]['id']}})[_0x7e8b('0x24')](handleEntityNotFound(_0x111d77,null))[_0x7e8b('0x24')](removeEntity(_0x111d77,null))[_0x7e8b('0x3d')](handleError(_0x111d77,null));}; \ No newline at end of file +var _0xc760=['attributes','nolimit','order','pick','filter','where','VIRTUAL','options','SmsApplication','includeAll','findAll','rows','catch','show','params','length','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xc760,0x1b8));var _0x0c76=function(_0x2dc9cb,_0x336a0c){_0x2dc9cb=_0x2dc9cb-0x0;var _0x5126cc=_0xc760[_0x2dc9cb];return _0x5126cc;};'use strict';var emlformat=require(_0x0c76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c76('0x1'));var jsonpatch=require(_0x0c76('0x2'));var rp=require(_0x0c76('0x3'));var moment=require(_0x0c76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c76('0x5'));var util=require(_0x0c76('0x6'));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('fs-extra');var _=require(_0x0c76('0x7'));var squel=require(_0x0c76('0x8'));var crypto=require(_0x0c76('0x9'));var jsforce=require(_0x0c76('0xa'));var deskjs=require(_0x0c76('0xb'));var toCsv=require(_0x0c76('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0c76('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0c76('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c76('0xf'))('api');var utils=require(_0x0c76('0x10'));var config=require(_0x0c76('0x11'));var licenseUtil=require(_0x0c76('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29bd3b,_0x6b4bc0){_0x6b4bc0=_0x6b4bc0||0xcc;return function(_0x5cd51f){if(_0x5cd51f){return _0x29bd3b[_0x0c76('0x13')](_0x6b4bc0);}return _0x29bd3b[_0x0c76('0x14')](_0x6b4bc0)['end']();};}function respondWithResult(_0x1b7a04,_0x5440f4){_0x5440f4=_0x5440f4||0xc8;return function(_0x52f85a){if(_0x52f85a){return _0x1b7a04[_0x0c76('0x14')](_0x5440f4)[_0x0c76('0x15')](_0x52f85a);}};}function respondWithFilteredResult(_0x425ea9,_0x1eb69a){return function(_0x6f57d8){if(_0x6f57d8){var _0x2d9c98=typeof _0x1eb69a['offset']===_0x0c76('0x16')&&typeof _0x1eb69a[_0x0c76('0x17')]===_0x0c76('0x16');var _0x268cef=_0x6f57d8['count'];var _0x21f5a3=_0x2d9c98?0x0:_0x1eb69a[_0x0c76('0x18')];var _0x4f998f=_0x2d9c98?_0x6f57d8[_0x0c76('0x19')]:_0x1eb69a[_0x0c76('0x18')]+_0x1eb69a[_0x0c76('0x17')];var _0x536bf7;if(_0x4f998f>=_0x268cef){_0x4f998f=_0x268cef;_0x536bf7=0xc8;}else{_0x536bf7=0xce;}_0x425ea9[_0x0c76('0x14')](_0x536bf7);return _0x425ea9[_0x0c76('0x1a')](_0x0c76('0x1b'),_0x21f5a3+'-'+_0x4f998f+'/'+_0x268cef)['json'](_0x6f57d8);}return null;};}function patchUpdates(_0x3c1a53){return function(_0x4c4c87){try{jsonpatch[_0x0c76('0x1c')](_0x4c4c87,_0x3c1a53,!![]);}catch(_0x24f458){return BPromise[_0x0c76('0x1d')](_0x24f458);}return _0x4c4c87[_0x0c76('0x1e')]();};}function saveUpdates(_0x2e9785,_0x23f4e5){return function(_0x26c6e5){if(_0x26c6e5){return _0x26c6e5[_0x0c76('0x1f')](_0x2e9785)[_0x0c76('0x20')](function(_0x589f25){return _0x589f25;});}return null;};}function removeEntity(_0xc6ed9c,_0x11bbe4){return function(_0xba1736){if(_0xba1736){return _0xba1736[_0x0c76('0x21')]()['then'](function(){_0xc6ed9c[_0x0c76('0x14')](0xcc)[_0x0c76('0x22')]();});}};}function handleEntityNotFound(_0x269a49,_0x426f7b){return function(_0x4316a5){if(!_0x4316a5){_0x269a49[_0x0c76('0x13')](0x194);}return _0x4316a5;};}function handleError(_0x28035a,_0x1b713d){_0x1b713d=_0x1b713d||0x1f4;return function(_0x1d098a){logger[_0x0c76('0x23')](_0x1d098a['stack']);if(_0x1d098a[_0x0c76('0x24')]){delete _0x1d098a[_0x0c76('0x24')];}_0x28035a['status'](_0x1b713d)[_0x0c76('0x25')](_0x1d098a);};}exports[_0x0c76('0x26')]=function(_0x10c75c,_0x2e457b){var _0x404676={},_0x2d7570={},_0x356aef={'count':0x0,'rows':[]};var _0xa3a3d6=_['map'](db['SmsApplication'][_0x0c76('0x27')],function(_0xd0ee8f){return{'name':_0xd0ee8f[_0x0c76('0x28')],'type':_0xd0ee8f[_0x0c76('0x29')][_0x0c76('0x2a')]};});_0x2d7570[_0x0c76('0x2b')]=_[_0x0c76('0x2c')](_0xa3a3d6,_0x0c76('0x24'));_0x2d7570[_0x0c76('0x2d')]=_[_0x0c76('0x2e')](_0x10c75c[_0x0c76('0x2d')]);_0x2d7570[_0x0c76('0x2f')]=_[_0x0c76('0x30')](_0x2d7570[_0x0c76('0x2b')],_0x2d7570[_0x0c76('0x2d')]);_0x404676['attributes']=_[_0x0c76('0x30')](_0x2d7570[_0x0c76('0x2b')],qs[_0x0c76('0x31')](_0x10c75c[_0x0c76('0x2d')][_0x0c76('0x31')]));_0x404676[_0x0c76('0x32')]=_0x404676['attributes']['length']?_0x404676[_0x0c76('0x32')]:_0x2d7570[_0x0c76('0x2b')];if(!_0x10c75c[_0x0c76('0x2d')]['hasOwnProperty'](_0x0c76('0x33'))){_0x404676[_0x0c76('0x17')]=qs['limit'](_0x10c75c['query'][_0x0c76('0x17')]);_0x404676[_0x0c76('0x18')]=qs[_0x0c76('0x18')](_0x10c75c[_0x0c76('0x2d')][_0x0c76('0x18')]);}_0x404676[_0x0c76('0x34')]=qs['sort'](_0x10c75c[_0x0c76('0x2d')]['sort']);_0x404676['where']=qs[_0x0c76('0x2f')](_[_0x0c76('0x35')](_0x10c75c[_0x0c76('0x2d')],_0x2d7570[_0x0c76('0x2f')]),_0xa3a3d6);if(_0x10c75c['query'][_0x0c76('0x36')]){_0x404676[_0x0c76('0x37')]=_['merge'](_0x404676[_0x0c76('0x37')],{'$or':_['map'](_0xa3a3d6,function(_0x5199dd){if(_0x5199dd['type']!==_0x0c76('0x38')){var _0x1f70d9={};_0x1f70d9[_0x5199dd[_0x0c76('0x24')]]={'$like':'%'+_0x10c75c[_0x0c76('0x2d')][_0x0c76('0x36')]+'%'};return _0x1f70d9;}})});}_0x404676=_['merge']({},_0x404676,_0x10c75c[_0x0c76('0x39')]);var _0x14fdcc={'where':_0x404676[_0x0c76('0x37')]};return db[_0x0c76('0x3a')]['count'](_0x14fdcc)['then'](function(_0x378944){_0x356aef[_0x0c76('0x19')]=_0x378944;if(_0x10c75c[_0x0c76('0x2d')][_0x0c76('0x3b')]){_0x404676['include']=[{'all':!![]}];}return db[_0x0c76('0x3a')][_0x0c76('0x3c')](_0x404676);})[_0x0c76('0x20')](function(_0x1d26f0){_0x356aef[_0x0c76('0x3d')]=_0x1d26f0;return _0x356aef;})[_0x0c76('0x20')](respondWithFilteredResult(_0x2e457b,_0x404676))[_0x0c76('0x3e')](handleError(_0x2e457b,null));};exports[_0x0c76('0x3f')]=function(_0x2610f1,_0x1fce10){var _0x4f2d43={'raw':!![],'where':{'id':_0x2610f1[_0x0c76('0x40')]['id']}},_0x448d0a={};_0x448d0a[_0x0c76('0x2b')]=_[_0x0c76('0x2e')](db['SmsApplication']['rawAttributes']);_0x448d0a[_0x0c76('0x2d')]=_[_0x0c76('0x2e')](_0x2610f1[_0x0c76('0x2d')]);_0x448d0a[_0x0c76('0x2f')]=_[_0x0c76('0x30')](_0x448d0a[_0x0c76('0x2b')],_0x448d0a['query']);_0x4f2d43[_0x0c76('0x32')]=_[_0x0c76('0x30')](_0x448d0a[_0x0c76('0x2b')],qs[_0x0c76('0x31')](_0x2610f1[_0x0c76('0x2d')][_0x0c76('0x31')]));_0x4f2d43[_0x0c76('0x32')]=_0x4f2d43['attributes'][_0x0c76('0x41')]?_0x4f2d43[_0x0c76('0x32')]:_0x448d0a[_0x0c76('0x2b')];if(_0x2610f1[_0x0c76('0x2d')]['includeAll']){_0x4f2d43['include']=[{'all':!![]}];}_0x4f2d43=_[_0x0c76('0x42')]({},_0x4f2d43,_0x2610f1[_0x0c76('0x39')]);return db['SmsApplication'][_0x0c76('0x43')](_0x4f2d43)[_0x0c76('0x20')](handleEntityNotFound(_0x1fce10,null))[_0x0c76('0x20')](respondWithResult(_0x1fce10,null))[_0x0c76('0x3e')](handleError(_0x1fce10,null));};exports[_0x0c76('0x44')]=function(_0x2fa14a,_0x588f2c){return db[_0x0c76('0x3a')][_0x0c76('0x44')](_0x2fa14a['body'],{})[_0x0c76('0x20')](respondWithResult(_0x588f2c,0xc9))['catch'](handleError(_0x588f2c,null));};exports[_0x0c76('0x1f')]=function(_0x337983,_0x3cb98c){if(_0x337983[_0x0c76('0x45')]['id']){delete _0x337983[_0x0c76('0x45')]['id'];}return db['SmsApplication'][_0x0c76('0x43')]({'where':{'id':_0x337983['params']['id']}})['then'](handleEntityNotFound(_0x3cb98c,null))[_0x0c76('0x20')](saveUpdates(_0x337983[_0x0c76('0x45')],null))[_0x0c76('0x20')](respondWithResult(_0x3cb98c,null))[_0x0c76('0x3e')](handleError(_0x3cb98c,null));};exports['destroy']=function(_0x5141fc,_0x429d47){return db[_0x0c76('0x3a')][_0x0c76('0x43')]({'where':{'id':_0x5141fc['params']['id']}})[_0x0c76('0x20')](handleEntityNotFound(_0x429d47,null))[_0x0c76('0x20')](removeEntity(_0x429d47,null))['catch'](handleError(_0x429d47,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e2cbe1a..e2e5665 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 _0xd0ee=['lodash','util','../../config/logger','moment','request-promise','path','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5c1df6,_0x5d1e5d){var _0x16c8a4=function(_0xf4deca){while(--_0xf4deca){_0x5c1df6['push'](_0x5c1df6['shift']());}};_0x16c8a4(++_0x5d1e5d);}(_0xd0ee,0x18c));var _0xed0e=function(_0x21371c,_0xe442f6){_0x21371c=_0x21371c-0x0;var _0x237894=_0xd0ee[_0x21371c];return _0x237894;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var logger=require(_0xed0e('0x2'))('api');var moment=require(_0xed0e('0x3'));var BPromise=require('bluebird');var rp=require(_0xed0e('0x4'));var fs=require('fs');var path=require(_0xed0e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed0e('0x6'));module['exports']=function(_0x110f38,_0x2d4bf7){return _0x110f38[_0xed0e('0x7')](_0xed0e('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed0e('0x9'),'collate':_0xed0e('0xa')});}; \ No newline at end of file +var _0x7204=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7204,0x19e));var _0x4720=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7204[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x4720('0x0'));var util=require(_0x4720('0x1'));var logger=require(_0x4720('0x2'))(_0x4720('0x3'));var moment=require('moment');var BPromise=require(_0x4720('0x4'));var rp=require(_0x4720('0x5'));var fs=require('fs');var path=require(_0x4720('0x6'));var rimraf=require(_0x4720('0x7'));var config=require(_0x4720('0x8'));var attributes=require(_0x4720('0x9'));module[_0x4720('0xa')]=function(_0xd15cd,_0x57d147){return _0xd15cd[_0x4720('0xb')]('SmsApplication',attributes,{'tableName':_0x4720('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4720('0xd'),'collate':_0x4720('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 08e28e2..f16b010 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 _0x431b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x431b,0x18d));var _0xb431=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0x431b[_0x2338fa];return _0x42df9b;};'use strict';var _=require(_0xb431('0x0'));var util=require(_0xb431('0x1'));var moment=require(_0xb431('0x2'));var BPromise=require('bluebird');var rs=require(_0xb431('0x3'));var fs=require('fs');var Redis=require(_0xb431('0x4'));var db=require(_0xb431('0x5'))['db'];var utils=require(_0xb431('0x6'));var logger=require(_0xb431('0x7'))(_0xb431('0x8'));var config=require(_0xb431('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb431('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fefc5,_0x58eb22,_0x5151a2){return new BPromise(function(_0x45adf2,_0x4a21dd){return client['request'](_0x2fefc5,_0x5151a2)[_0xb431('0xb')](function(_0x34cdb1){logger[_0xb431('0xc')](_0xb431('0xd'),_0x58eb22,_0xb431('0xe'));logger[_0xb431('0xf')](_0xb431('0x10'),_0x58eb22,'request\x20sent',JSON[_0xb431('0x11')](_0x34cdb1));if(_0x34cdb1[_0xb431('0x12')]){if(_0x34cdb1[_0xb431('0x12')]['code']===0x1f4){logger[_0xb431('0x12')](_0xb431('0xd'),_0x58eb22,_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);return _0x4a21dd(_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);}logger['error'](_0xb431('0xd'),_0x58eb22,_0x34cdb1['error'][_0xb431('0x13')]);return _0x45adf2(_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);}else{logger[_0xb431('0xc')](_0xb431('0xd'),_0x58eb22,_0xb431('0xe'));_0x45adf2(_0x34cdb1['result'][_0xb431('0x13')]);}})['catch'](function(_0xc73c8a){logger[_0xb431('0x12')](_0xb431('0xd'),_0x58eb22,_0xc73c8a);_0x4a21dd(_0xc73c8a);});});} \ No newline at end of file +var _0x0a93=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x3bc9c9,_0x44713e){var _0x46cd28=function(_0x3098d9){while(--_0x3098d9){_0x3bc9c9['push'](_0x3bc9c9['shift']());}};_0x46cd28(++_0x44713e);}(_0x0a93,0x6a));var _0x30a9=function(_0x51ea42,_0x230cd0){_0x51ea42=_0x51ea42-0x0;var _0x3ebfb3=_0x0a93[_0x51ea42];return _0x3ebfb3;};'use strict';var _=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var moment=require(_0x30a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x30a9('0x3'));var fs=require('fs');var Redis=require(_0x30a9('0x4'));var db=require(_0x30a9('0x5'))['db'];var utils=require(_0x30a9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x30a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c46fb,_0x5ae289,_0x5ed9b4){return new BPromise(function(_0x312a90,_0x3a3f7e){return client[_0x30a9('0x8')](_0x1c46fb,_0x5ed9b4)['then'](function(_0x146fae){logger[_0x30a9('0x9')](_0x30a9('0xa'),_0x5ae289,_0x30a9('0xb'));logger[_0x30a9('0xc')](_0x30a9('0xd'),_0x5ae289,_0x30a9('0xb'),JSON[_0x30a9('0xe')](_0x146fae));if(_0x146fae[_0x30a9('0xf')]){if(_0x146fae['error'][_0x30a9('0x10')]===0x1f4){logger[_0x30a9('0xf')](_0x30a9('0xa'),_0x5ae289,_0x146fae[_0x30a9('0xf')]['message']);return _0x3a3f7e(_0x146fae[_0x30a9('0xf')]['message']);}logger[_0x30a9('0xf')](_0x30a9('0xa'),_0x5ae289,_0x146fae['error']['message']);return _0x312a90(_0x146fae[_0x30a9('0xf')][_0x30a9('0x11')]);}else{logger['info'](_0x30a9('0xa'),_0x5ae289,_0x30a9('0xb'));_0x312a90(_0x146fae[_0x30a9('0x12')][_0x30a9('0x11')]);}})[_0x30a9('0x13')](function(_0x1e7927){logger['error'](_0x30a9('0xa'),_0x5ae289,_0x1e7927);_0x3a3f7e(_0x1e7927);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index b7fe985..820724f 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 _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x2886e2,_0x95fe23){var _0x267ec6=function(_0x539da4){while(--_0x539da4){_0x2886e2['push'](_0x2886e2['shift']());}};_0x267ec6(++_0x95fe23);}(_0x087b,0x11a));var _0xb087=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x087b[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('0x21')]=router; \ No newline at end of file +var _0xd4a2=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','sms','addTags','put','update','tracked','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x5092b8,_0x4e6578){var _0x2a5f04=function(_0x44efe4){while(--_0x44efe4){_0x5092b8['push'](_0x5092b8['shift']());}};_0x2a5f04(++_0x4e6578);}(_0xd4a2,0x173));var _0x2d4a=function(_0x48a469,_0x417794){_0x48a469=_0x48a469-0x0;var _0x2578a5=_0xd4a2[_0x48a469];return _0x2578a5;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['post']('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x10')]);router[_0x2d4a('0x11')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x12')]);router[_0x2d4a('0x11')](_0x2d4a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:addtags'),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x16')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:update'),controller[_0x2d4a('0x17')]);router['delete'](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction[_0x2d4a('0x18')](_0x2d4a('0x14'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0x2d4a('0x13'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x19')]);module[_0x2d4a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 93ae953..f1d2b74 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 _0x2171=['out','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x2171,0x143));var _0x1217=function(_0x4396f7,_0x4b098c){_0x4396f7=_0x4396f7-0x0;var _0x3160cb=_0x2171[_0x4396f7];return _0x3160cb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1217('0x0'));module[_0x1217('0x1')]={'closed':{'type':Sequelize[_0x1217('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1217('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1217('0x3')]},'phone':{'type':Sequelize[_0x1217('0x3')]},'read1stAt':{'type':Sequelize[_0x1217('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1217('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in',_0x1217('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0dd6=['DATE','STRING','out','ENUM','exports','BOOLEAN'];(function(_0x2268bb,_0x5be780){var _0x2b570c=function(_0x58b59f){while(--_0x58b59f){_0x2268bb['push'](_0x2268bb['shift']());}};_0x2b570c(++_0x5be780);}(_0x0dd6,0xca));var _0x60dd=function(_0xc444f0,_0x2add26){_0xc444f0=_0xc444f0-0x0;var _0x2260c8=_0x0dd6[_0xc444f0];return _0x2260c8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x60dd('0x0')]={'closed':{'type':Sequelize[_0x60dd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x60dd('0x2')]},'disposition':{'type':Sequelize[_0x60dd('0x3')]},'secondDisposition':{'type':Sequelize[_0x60dd('0x3')]},'thirdDisposition':{'type':Sequelize[_0x60dd('0x3')]},'note':{'type':Sequelize[_0x60dd('0x3')]},'phone':{'type':Sequelize[_0x60dd('0x3')]},'read1stAt':{'type':Sequelize[_0x60dd('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x60dd('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x60dd('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x60dd('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7e06528..fcd99c9 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 _0x4aeb=['fields','includeAll','include','merge','options','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','length','nolimit','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','color','smsInteractionTags:save','removeTags','unix','toString','join','files','tmp','push','User','fullname','lastName','Messages','secret','read','SmsAccount','Owner','mkdirSync','Sms','Account','N.A.','closed','closedAt','disposition','createdAt','direction','out','System','Contact','firstName','value','renderFile','root','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','../../components/interaction/service','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','limit','count','offset','set','update','then','destroy','error','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','catch','show','params','model','keys','intersection','attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4aeb,0x131));var _0xb4ae=function(_0x41b49d,_0x2379c4){_0x41b49d=_0x41b49d-0x0;var _0x158c70=_0x4aeb[_0x41b49d];return _0x158c70;};'use strict';var rimraf=require(_0xb4ae('0x0'));var zipdir=require(_0xb4ae('0x1'));var moment=require(_0xb4ae('0x2'));var BPromise=require(_0xb4ae('0x3'));var util=require('util');var path=require(_0xb4ae('0x4'));var ejs=require(_0xb4ae('0x5'));var fs=require('fs');var _=require(_0xb4ae('0x6'));var Redis=require('ioredis');var interaction=require(_0xb4ae('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require(_0xb4ae('0x8'));var db=require(_0xb4ae('0x9'))['db'];config['redis']=_[_0xb4ae('0xa')](config[_0xb4ae('0xb')],{'host':_0xb4ae('0xc'),'port':0x18eb});var socket=require(_0xb4ae('0xd'))(new Redis(config[_0xb4ae('0xb')]));require(_0xb4ae('0xe'))[_0xb4ae('0xf')](socket);function respondWithStatusCode(_0x88e036,_0x25b46d){_0x25b46d=_0x25b46d||0xcc;return function(_0x401087){if(_0x401087){return _0x88e036[_0xb4ae('0x10')](_0x25b46d);}return _0x88e036[_0xb4ae('0x11')](_0x25b46d)[_0xb4ae('0x12')]();};}function respondWithResult(_0x2084c1,_0x5eadd5){_0x5eadd5=_0x5eadd5||0xc8;return function(_0x520399){if(_0x520399){return _0x2084c1[_0xb4ae('0x11')](_0x5eadd5)[_0xb4ae('0x13')](_0x520399);}};}function respondWithFilteredResult(_0x545b5b,_0x109779){return function(_0x492253){if(_0x492253){var _0x6ce4fc=typeof _0x109779['offset']==='undefined'&&typeof _0x109779[_0xb4ae('0x14')]==='undefined';var _0x230ea6=_0x492253[_0xb4ae('0x15')];var _0x171e44=_0x6ce4fc?0x0:_0x109779[_0xb4ae('0x16')];var _0x33f028=_0x6ce4fc?_0x492253[_0xb4ae('0x15')]:_0x109779['offset']+_0x109779[_0xb4ae('0x14')];var _0x1d6207;if(_0x33f028>=_0x230ea6){_0x33f028=_0x230ea6;_0x1d6207=0xc8;}else{_0x1d6207=0xce;}_0x545b5b[_0xb4ae('0x11')](_0x1d6207);return _0x545b5b[_0xb4ae('0x17')]('Content-Range',_0x171e44+'-'+_0x33f028+'/'+_0x230ea6)['json'](_0x492253);}return null;};}function saveUpdates(_0x52d8a6){return function(_0x5288a5){if(_0x5288a5){return _0x5288a5[_0xb4ae('0x18')](_0x52d8a6)[_0xb4ae('0x19')](function(_0x25d486){return _0x25d486;});}return null;};}function removeEntity(_0x31cdac){return function(_0x1c2adf){if(_0x1c2adf){return _0x1c2adf[_0xb4ae('0x1a')]()[_0xb4ae('0x19')](function(){_0x31cdac[_0xb4ae('0x11')](0xcc)[_0xb4ae('0x12')]();});}};}function handleEntityNotFound(_0x21f49e){return function(_0x51ea32){if(!_0x51ea32){_0x21f49e[_0xb4ae('0x10')](0x194);}return _0x51ea32;};}function handleError(_0x5e5985,_0x3533ce){_0x3533ce=_0x3533ce||0x1f4;return function(_0x487cd5){logger[_0xb4ae('0x1b')](_0x487cd5['stack']);if(_0x487cd5['name']){delete _0x487cd5[_0xb4ae('0x1c')];}_0x5e5985[_0xb4ae('0x11')](_0x3533ce)[_0xb4ae('0x1d')](_0x487cd5);};}exports[_0xb4ae('0x1e')]=function(_0xf74443,_0x128a7d){var _0x3b9931={};var _0x3eb670=_[_0xb4ae('0x1f')](db[_0xb4ae('0x20')][_0xb4ae('0x21')],function(_0x343437){return{'name':_0x343437[_0xb4ae('0x22')],'type':_0x343437[_0xb4ae('0x23')]['key']};});_0x3b9931=qs[_0xb4ae('0x24')](_0x3eb670,_0xf74443);return interaction[_0xb4ae('0x25')]('sms',_0xf74443[_0xb4ae('0x26')],_0xf74443['user'],_0x3b9931,_0x3eb670)[_0xb4ae('0x19')](respondWithFilteredResult(_0x128a7d,_0x3b9931))[_0xb4ae('0x27')](handleError(_0x128a7d,null));};exports[_0xb4ae('0x28')]=function(_0xfbf65c,_0x76efd8){var _0x3f76c3={'raw':![],'where':{'id':_0xfbf65c[_0xb4ae('0x29')]['id']}},_0x4c5d18={};_0x4c5d18[_0xb4ae('0x2a')]=_['keys'](db[_0xb4ae('0x20')][_0xb4ae('0x21')]);_0x4c5d18[_0xb4ae('0x26')]=_[_0xb4ae('0x2b')](_0xfbf65c['query']);_0x4c5d18['filters']=_[_0xb4ae('0x2c')](_0x4c5d18[_0xb4ae('0x2a')],_0x4c5d18[_0xb4ae('0x26')]);_0x3f76c3[_0xb4ae('0x2d')]=_[_0xb4ae('0x2c')](_0x4c5d18[_0xb4ae('0x2a')],qs[_0xb4ae('0x2e')](_0xfbf65c['query']['fields']));_0x3f76c3[_0xb4ae('0x2d')]=_0x3f76c3['attributes']['length']?_0x3f76c3[_0xb4ae('0x2d')]:_0x4c5d18['model'];if(_0xfbf65c['query'][_0xb4ae('0x2f')]){_0x3f76c3[_0xb4ae('0x30')]=[{'all':!![]}];}_0x3f76c3=_[_0xb4ae('0x31')]({},_0x3f76c3,_0xfbf65c[_0xb4ae('0x32')]);return db[_0xb4ae('0x20')]['find'](_0x3f76c3)[_0xb4ae('0x19')](handleEntityNotFound(_0x76efd8,null))['then'](respondWithResult(_0x76efd8,null))[_0xb4ae('0x27')](handleError(_0x76efd8,null));};exports['create']=function(_0xc1ce5,_0x3d4d6c){return db['SmsInteraction']['create'](_0xc1ce5['body'],{})['then'](respondWithResult(_0x3d4d6c,0xc9))[_0xb4ae('0x27')](handleError(_0x3d4d6c,null));};exports['update']=function(_0x51a664,_0x5831bd){if(_0x51a664['body']['id']){delete _0x51a664[_0xb4ae('0x33')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x51a664[_0xb4ae('0x29')]['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x5831bd,null))[_0xb4ae('0x19')](saveUpdates(_0x51a664[_0xb4ae('0x33')],null))['then'](respondWithResult(_0x5831bd,null))['catch'](handleError(_0x5831bd,null));};exports[_0xb4ae('0x1a')]=function(_0x5667e7,_0x4974e5){return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x5667e7['params']['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x4974e5,null))[_0xb4ae('0x19')](removeEntity(_0x4974e5,null))['catch'](handleError(_0x4974e5,null));};exports[_0xb4ae('0x35')]=function(_0xf2dc14,_0x7d13b1){return db['SmsInteraction'][_0xb4ae('0x35')]()['then'](respondWithResult(_0x7d13b1,null))[_0xb4ae('0x27')](handleError(_0x7d13b1,null));};exports[_0xb4ae('0x36')]=function(_0x4d685d,_0x3d1cbd){return db[_0xb4ae('0x37')][_0xb4ae('0x34')]({'where':{'id':_0x4d685d[_0xb4ae('0x29')]['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x3d1cbd,null))['then'](function(_0xd359da){if(_0xd359da){return _0xd359da['addMessage'](_0x4d685d[_0xb4ae('0x33')][_0xb4ae('0x38')],_[_0xb4ae('0x39')](_0x4d685d['body'],[_0xb4ae('0x38'),'id'])||{});}})[_0xb4ae('0x19')](respondWithResult(_0x3d1cbd,null))[_0xb4ae('0x27')](handleError(_0x3d1cbd,null));};exports[_0xb4ae('0x3a')]=function(_0x544952,_0x1e8e3f){var _0x1e7cc4={'raw':![],'where':{}};var _0x687eb4={};var _0x51b301={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb4ae('0x3b')]({'where':{'id':_0x544952[_0xb4ae('0x29')]['id']}})['then'](handleEntityNotFound(_0x1e8e3f,null))[_0xb4ae('0x19')](function(_0x10c28a){if(_0x10c28a){_0x687eb4[_0xb4ae('0x2a')]=_['keys'](db[_0xb4ae('0x37')]['rawAttributes']);_0x687eb4['query']=_['keys'](_0x544952[_0xb4ae('0x26')]);_0x687eb4[_0xb4ae('0x3c')]=_[_0xb4ae('0x2c')](_0x687eb4[_0xb4ae('0x2a')],_0x687eb4[_0xb4ae('0x26')]);_0x1e7cc4['attributes']=_[_0xb4ae('0x2c')](_0x687eb4[_0xb4ae('0x2a')],qs[_0xb4ae('0x2e')](_0x544952[_0xb4ae('0x26')][_0xb4ae('0x2e')]));_0x1e7cc4['attributes']=_0x1e7cc4[_0xb4ae('0x2d')][_0xb4ae('0x3d')]?_0x1e7cc4[_0xb4ae('0x2d')]:_0x687eb4[_0xb4ae('0x2a')];if(!_0x544952[_0xb4ae('0x26')]['hasOwnProperty'](_0xb4ae('0x3e'))){_0x1e7cc4['limit']=qs[_0xb4ae('0x14')](_0x544952[_0xb4ae('0x26')][_0xb4ae('0x14')]);_0x1e7cc4[_0xb4ae('0x16')]=qs[_0xb4ae('0x16')](_0x544952['query'][_0xb4ae('0x16')]);}_0x1e7cc4['order']=qs['sort'](_0x544952[_0xb4ae('0x26')][_0xb4ae('0x3f')]);_0x1e7cc4[_0xb4ae('0x40')]=qs[_0xb4ae('0x3c')](_[_0xb4ae('0x41')](_0x544952[_0xb4ae('0x26')],_0x687eb4[_0xb4ae('0x3c')]));_0x1e7cc4['where']['SmsInteractionId']=_0x10c28a['id'];if(_0x544952[_0xb4ae('0x26')][_0xb4ae('0x42')]){_0x1e7cc4[_0xb4ae('0x40')]=_[_0xb4ae('0x31')](_0x1e7cc4['where'],{'$or':_[_0xb4ae('0x1f')](_0x1e7cc4[_0xb4ae('0x2d')],function(_0x456f6d){var _0x65e7ed={};_0x65e7ed[_0x456f6d]={'$like':'%'+_0x544952[_0xb4ae('0x26')]['filter']+'%'};return _0x65e7ed;})});}if(_0x544952[_0xb4ae('0x26')][_0xb4ae('0x43')]){var _0x59b9f5=_0x544952[_0xb4ae('0x26')][_0xb4ae('0x43')][_0xb4ae('0x44')](',');var _0x4d7bc4={};_0x4d7bc4[_0x59b9f5[0x0]]={'$gte':moment(_0x59b9f5[0x1])[_0xb4ae('0x45')](_0xb4ae('0x46'))};_0x1e7cc4[_0xb4ae('0x40')]=_['merge'](_0x1e7cc4[_0xb4ae('0x40')],_0x4d7bc4);}_0x1e7cc4=_[_0xb4ae('0x31')]({},_0x1e7cc4,_0x544952[_0xb4ae('0x32')]);return db[_0xb4ae('0x37')][_0xb4ae('0x15')]({'where':_0x1e7cc4['where']})[_0xb4ae('0x19')](function(_0x7e2a47){_0x51b301['count']=_0x7e2a47;if(_0x544952[_0xb4ae('0x26')][_0xb4ae('0x2f')]){_0x1e7cc4['include']=[{'all':!![]}];}return db[_0xb4ae('0x37')][_0xb4ae('0x25')](_0x1e7cc4);})[_0xb4ae('0x19')](function(_0x1dd16c){_0x51b301[_0xb4ae('0x47')]=_0x1dd16c;return _0x51b301;});}})[_0xb4ae('0x19')](respondWithFilteredResult(_0x1e8e3f,_0x1e7cc4))[_0xb4ae('0x27')](handleError(_0x1e8e3f,null));};exports['addTags']=function(_0x19946c,_0x2f8c5e){return db['SmsInteraction'][_0xb4ae('0x34')]({'where':{'id':_0x19946c['params']['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x2f8c5e,null))[_0xb4ae('0x19')](function(_0x47323e){if(_0x47323e){return _0x47323e[_0xb4ae('0x48')](_0x19946c[_0xb4ae('0x33')][_0xb4ae('0x38')],_['omit'](_0x19946c[_0xb4ae('0x33')],[_0xb4ae('0x38'),'id'])||{})[_0xb4ae('0x49')](function(){return db['Tag'][_0xb4ae('0x25')]({'attributes':['id',_0xb4ae('0x1c'),_0xb4ae('0x4a')],'where':{'id':_0x19946c[_0xb4ae('0x33')][_0xb4ae('0x38')]}});})[_0xb4ae('0x19')](function(_0x4ed103){socket['emit'](_0xb4ae('0x4b'),{'id':Number(_0x19946c[_0xb4ae('0x29')]['id']),'tags':_0x4ed103||[]});return{'id':Number(_0x19946c[_0xb4ae('0x29')]['id']),'tags':_0x4ed103||[]};});}})[_0xb4ae('0x19')](respondWithResult(_0x2f8c5e,null))[_0xb4ae('0x27')](handleError(_0x2f8c5e,null));};exports['removeTags']=function(_0x15727b,_0x56f0a4){return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x15727b[_0xb4ae('0x29')]['id']}})['then'](handleEntityNotFound(_0x56f0a4,null))[_0xb4ae('0x19')](function(_0x3f6f52){if(_0x3f6f52){return _0x3f6f52[_0xb4ae('0x4c')](_0x15727b[_0xb4ae('0x26')]['ids']);}})[_0xb4ae('0x19')](respondWithStatusCode(_0x56f0a4,null))[_0xb4ae('0x27')](handleError(_0x56f0a4,null));};exports['download']=function(_0x219b4d,_0x4deff9){var _0x4446da=moment()[_0xb4ae('0x4d')]()[_0xb4ae('0x4e')]();var _0x1ff7ad=path[_0xb4ae('0x4f')](config['root'],'server',_0xb4ae('0x50'),_0xb4ae('0x51'));var _0x4801ba=path[_0xb4ae('0x4f')](_0x1ff7ad,_0x4446da);var _0x3cbb94=util[_0xb4ae('0x45')]('transcript-%d-%s.zip',_0x219b4d['params']['id'],_0x4446da);var _0xfb988c=path['join'](_0x1ff7ad,_0x3cbb94);var _0x1058fd=[];_0x1058fd[_0xb4ae('0x52')]({'model':db[_0xb4ae('0x53')],'as':'User','attributes':['id',_0xb4ae('0x54')],'raw':!![]});_0x1058fd[_0xb4ae('0x52')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xb4ae('0x55')],'raw':!![]});var _0x1b4116=[{'model':db[_0xb4ae('0x37')],'as':_0xb4ae('0x56'),'attributes':['id','body','createdAt','direction',_0xb4ae('0x57'),_0xb4ae('0x58')],'include':_0x1058fd}];_0x1b4116[_0xb4ae('0x52')]({'model':db[_0xb4ae('0x59')],'as':'Account','attributes':['id',_0xb4ae('0x1c')]});_0x1b4116[_0xb4ae('0x52')]({'model':db[_0xb4ae('0x53')],'as':_0xb4ae('0x5a'),'attributes':['id',_0xb4ae('0x54')]});return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x219b4d['params']['id']},'include':_0x1b4116})['then'](handleEntityNotFound(_0x4deff9,null))[_0xb4ae('0x19')](function(_0x27ff27){if(_0x27ff27){var _0x32a798=_0x27ff27['get']({'plain':!![]});fs[_0xb4ae('0x5b')](_0x4801ba);var _0x3621ad={'channel':_0xb4ae('0x5c'),'account':_0x32a798[_0xb4ae('0x5d')]['name'],'agent':_0x32a798[_0xb4ae('0x5a')]?_0x32a798[_0xb4ae('0x5a')]['fullname']:_0xb4ae('0x5e'),'createdAt':moment(_0x32a798['createdAt'])['format'](_0xb4ae('0x46'))[_0xb4ae('0x4e')](),'closedAt':_0x32a798[_0xb4ae('0x5f')]?moment(_0x32a798[_0xb4ae('0x60')])[_0xb4ae('0x45')](_0xb4ae('0x46'))[_0xb4ae('0x4e')]():'','disposition':_0x32a798[_0xb4ae('0x61')],'messages':_(_0x32a798[_0xb4ae('0x56')])['filter']({'secret':![]})[_0xb4ae('0x1f')](function(_0x112554){return{'date':moment(_0x112554[_0xb4ae('0x62')])[_0xb4ae('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb4ae('0x4e')](),'sender':_0x112554[_0xb4ae('0x63')]===_0xb4ae('0x64')?_0x112554[_0xb4ae('0x53')]?_0x112554['User']['fullname']:_0xb4ae('0x65'):_0x112554[_0xb4ae('0x66')][_0xb4ae('0x67')]+(_0x112554[_0xb4ae('0x66')][_0xb4ae('0x55')]?'\x20'+_0x112554[_0xb4ae('0x66')][_0xb4ae('0x55')]:''),'body':_0x112554[_0xb4ae('0x33')],'direction':_0x112554[_0xb4ae('0x63')]===_0xb4ae('0x64')?'A':'C','secret':_0x112554[_0xb4ae('0x57')],'read':_0x112554[_0xb4ae('0x58')]};})[_0xb4ae('0x68')]()};return ejs[_0xb4ae('0x69')](path[_0xb4ae('0x4f')](config[_0xb4ae('0x6a')],_0xb4ae('0x6b'),_0xb4ae('0x6c'),_0xb4ae('0x6d')),{'interaction':_0x3621ad})[_0xb4ae('0x19')](function(_0x3f7faa){var _0x2713a6=path[_0xb4ae('0x4f')](_0x4801ba,_0xb4ae('0x6e')+_0x32a798['id']+'-'+_0x4446da+_0xb4ae('0x6f'));var _0x195a59={'path':_0x2713a6,'channel':_0xb4ae('0x5c'),'interactionId':_0x32a798['id']};return pdf[_0xb4ae('0x70')](_0x3f7faa,_0x195a59);})[_0xb4ae('0x19')](function(){return new BPromise(function(_0x44a712,_0x310ce9){zipdir(_0x4801ba,{'saveTo':_0xfb988c},function(_0x38701c,_0x503b3e){if(_0x38701c)return _0x310ce9(_0x38701c);return _0x44a712(_0x503b3e);});})[_0xb4ae('0x19')](function(){return new BPromise(function(_0x36e627,_0x4ff474){rimraf(_0x4801ba,function(_0x384532){if(_0x384532)_0x4ff474(_0x384532);return _0x36e627();});});})['then'](function(){return _0x4deff9[_0xb4ae('0x71')](_0xfb988c,_0x3cbb94,function(_0x280d32){if(_0x280d32){console[_0xb4ae('0x72')](_0xb4ae('0x73'),_0x280d32);}else{fs[_0xb4ae('0x74')](_0xfb988c);}});});});}else{return _0x4deff9[_0xb4ae('0x10')](0xc8);}})['catch'](handleError(_0x4deff9,null));}; \ No newline at end of file +var _0x564b=['lastName','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Sms','format','toString','closed','closedAt','disposition','out','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','zip-dir','moment','bluebird','path','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','then','destroy','error','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','user','catch','show','params','model','keys','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','update','describe','addMessage','SmsMessage','ids','getMessages','findOne','filters','length','nolimit','order','sort','pick','SmsInteractionId','filter','where','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','omit','spread','Tag','color','emit','unix','join','root','server','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName'];(function(_0x4e0560,_0x2841c4){var _0x1b34df=function(_0x241842){while(--_0x241842){_0x4e0560['push'](_0x4e0560['shift']());}};_0x1b34df(++_0x2841c4);}(_0x564b,0x8c));var _0xb564=function(_0x4af3fa,_0x19a0d8){_0x4af3fa=_0x4af3fa-0x0;var _0x4961af=_0x564b[_0x4af3fa];return _0x4961af;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb564('0x0'));var moment=require(_0xb564('0x1'));var BPromise=require(_0xb564('0x2'));var util=require('util');var path=require(_0xb564('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xb564('0x4'));var logger=require(_0xb564('0x5'))(_0xb564('0x6'));var config=require(_0xb564('0x7'));var db=require(_0xb564('0x8'))['db'];config[_0xb564('0x9')]=_[_0xb564('0xa')](config[_0xb564('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb564('0xb'))(new Redis(config['redis']));require(_0xb564('0xc'))[_0xb564('0xd')](socket);function respondWithStatusCode(_0x46a86a,_0x17e8b1){_0x17e8b1=_0x17e8b1||0xcc;return function(_0x454d09){if(_0x454d09){return _0x46a86a[_0xb564('0xe')](_0x17e8b1);}return _0x46a86a[_0xb564('0xf')](_0x17e8b1)[_0xb564('0x10')]();};}function respondWithResult(_0x29ca56,_0x3ca5ad){_0x3ca5ad=_0x3ca5ad||0xc8;return function(_0xd7243f){if(_0xd7243f){return _0x29ca56[_0xb564('0xf')](_0x3ca5ad)['json'](_0xd7243f);}};}function respondWithFilteredResult(_0x40a77c,_0x27e9cd){return function(_0x311657){if(_0x311657){var _0x344c42=typeof _0x27e9cd[_0xb564('0x11')]===_0xb564('0x12')&&typeof _0x27e9cd['limit']==='undefined';var _0x29f740=_0x311657[_0xb564('0x13')];var _0x3ee8e9=_0x344c42?0x0:_0x27e9cd[_0xb564('0x11')];var _0x5c1258=_0x344c42?_0x311657['count']:_0x27e9cd[_0xb564('0x11')]+_0x27e9cd[_0xb564('0x14')];var _0x38d605;if(_0x5c1258>=_0x29f740){_0x5c1258=_0x29f740;_0x38d605=0xc8;}else{_0x38d605=0xce;}_0x40a77c['status'](_0x38d605);return _0x40a77c['set'](_0xb564('0x15'),_0x3ee8e9+'-'+_0x5c1258+'/'+_0x29f740)['json'](_0x311657);}return null;};}function saveUpdates(_0x4cf6eb){return function(_0x38316c){if(_0x38316c){return _0x38316c['update'](_0x4cf6eb)[_0xb564('0x16')](function(_0x3aa8de){return _0x3aa8de;});}return null;};}function removeEntity(_0x307602){return function(_0x498431){if(_0x498431){return _0x498431[_0xb564('0x17')]()[_0xb564('0x16')](function(){_0x307602[_0xb564('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcfedab){return function(_0x13d24e){if(!_0x13d24e){_0xcfedab['sendStatus'](0x194);}return _0x13d24e;};}function handleError(_0x41ab05,_0x334541){_0x334541=_0x334541||0x1f4;return function(_0x4dede4){logger[_0xb564('0x18')](_0x4dede4['stack']);if(_0x4dede4['name']){delete _0x4dede4[_0xb564('0x19')];}_0x41ab05[_0xb564('0xf')](_0x334541)[_0xb564('0x1a')](_0x4dede4);};}exports[_0xb564('0x1b')]=function(_0xafce67,_0x1542e1){var _0xf82307={};var _0xc872e4=_[_0xb564('0x1c')](db[_0xb564('0x1d')][_0xb564('0x1e')],function(_0x597898){return{'name':_0x597898[_0xb564('0x1f')],'type':_0x597898[_0xb564('0x20')]['key']};});_0xf82307=qs[_0xb564('0x21')](_0xc872e4,_0xafce67);return interaction[_0xb564('0x22')](_0xb564('0x23'),_0xafce67[_0xb564('0x24')],_0xafce67[_0xb564('0x25')],_0xf82307,_0xc872e4)[_0xb564('0x16')](respondWithFilteredResult(_0x1542e1,_0xf82307))[_0xb564('0x26')](handleError(_0x1542e1,null));};exports[_0xb564('0x27')]=function(_0x3fd704,_0x27bb51){var _0x18027d={'raw':![],'where':{'id':_0x3fd704[_0xb564('0x28')]['id']}},_0x297e18={};_0x297e18[_0xb564('0x29')]=_[_0xb564('0x2a')](db[_0xb564('0x1d')]['rawAttributes']);_0x297e18[_0xb564('0x24')]=_[_0xb564('0x2a')](_0x3fd704[_0xb564('0x24')]);_0x297e18['filters']=_[_0xb564('0x2b')](_0x297e18[_0xb564('0x29')],_0x297e18[_0xb564('0x24')]);_0x18027d[_0xb564('0x2c')]=_[_0xb564('0x2b')](_0x297e18[_0xb564('0x29')],qs[_0xb564('0x2d')](_0x3fd704[_0xb564('0x24')]['fields']));_0x18027d[_0xb564('0x2c')]=_0x18027d['attributes']['length']?_0x18027d['attributes']:_0x297e18[_0xb564('0x29')];if(_0x3fd704[_0xb564('0x24')][_0xb564('0x2e')]){_0x18027d[_0xb564('0x2f')]=[{'all':!![]}];}_0x18027d=_[_0xb564('0x30')]({},_0x18027d,_0x3fd704[_0xb564('0x31')]);return db[_0xb564('0x1d')][_0xb564('0x32')](_0x18027d)['then'](handleEntityNotFound(_0x27bb51,null))[_0xb564('0x16')](respondWithResult(_0x27bb51,null))[_0xb564('0x26')](handleError(_0x27bb51,null));};exports[_0xb564('0x33')]=function(_0x4efeda,_0x2849cd){return db[_0xb564('0x1d')][_0xb564('0x33')](_0x4efeda[_0xb564('0x34')],{})['then'](respondWithResult(_0x2849cd,0xc9))['catch'](handleError(_0x2849cd,null));};exports[_0xb564('0x35')]=function(_0x40cf46,_0x5e2e91){if(_0x40cf46[_0xb564('0x34')]['id']){delete _0x40cf46[_0xb564('0x34')]['id'];}return db[_0xb564('0x1d')][_0xb564('0x32')]({'where':{'id':_0x40cf46[_0xb564('0x28')]['id']}})[_0xb564('0x16')](handleEntityNotFound(_0x5e2e91,null))[_0xb564('0x16')](saveUpdates(_0x40cf46['body'],null))[_0xb564('0x16')](respondWithResult(_0x5e2e91,null))[_0xb564('0x26')](handleError(_0x5e2e91,null));};exports[_0xb564('0x17')]=function(_0x2166a6,_0x564b95){return db[_0xb564('0x1d')]['find']({'where':{'id':_0x2166a6[_0xb564('0x28')]['id']}})[_0xb564('0x16')](handleEntityNotFound(_0x564b95,null))[_0xb564('0x16')](removeEntity(_0x564b95,null))[_0xb564('0x26')](handleError(_0x564b95,null));};exports[_0xb564('0x36')]=function(_0x83d62d,_0x384172){return db[_0xb564('0x1d')][_0xb564('0x36')]()['then'](respondWithResult(_0x384172,null))[_0xb564('0x26')](handleError(_0x384172,null));};exports[_0xb564('0x37')]=function(_0x34137c,_0x23571e){return db[_0xb564('0x38')][_0xb564('0x32')]({'where':{'id':_0x34137c[_0xb564('0x28')]['id']}})[_0xb564('0x16')](handleEntityNotFound(_0x23571e,null))[_0xb564('0x16')](function(_0x3c47be){if(_0x3c47be){return _0x3c47be[_0xb564('0x37')](_0x34137c['body'][_0xb564('0x39')],_['omit'](_0x34137c[_0xb564('0x34')],['ids','id'])||{});}})[_0xb564('0x16')](respondWithResult(_0x23571e,null))[_0xb564('0x26')](handleError(_0x23571e,null));};exports[_0xb564('0x3a')]=function(_0x4efd55,_0x3857de){var _0x5d3a49={'raw':![],'where':{}};var _0x1e0ee4={};var _0x488d52={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb564('0x3b')]({'where':{'id':_0x4efd55[_0xb564('0x28')]['id']}})[_0xb564('0x16')](handleEntityNotFound(_0x3857de,null))[_0xb564('0x16')](function(_0xd0555f){if(_0xd0555f){_0x1e0ee4[_0xb564('0x29')]=_[_0xb564('0x2a')](db[_0xb564('0x38')][_0xb564('0x1e')]);_0x1e0ee4[_0xb564('0x24')]=_[_0xb564('0x2a')](_0x4efd55[_0xb564('0x24')]);_0x1e0ee4[_0xb564('0x3c')]=_['intersection'](_0x1e0ee4[_0xb564('0x29')],_0x1e0ee4[_0xb564('0x24')]);_0x5d3a49[_0xb564('0x2c')]=_['intersection'](_0x1e0ee4[_0xb564('0x29')],qs[_0xb564('0x2d')](_0x4efd55[_0xb564('0x24')][_0xb564('0x2d')]));_0x5d3a49[_0xb564('0x2c')]=_0x5d3a49['attributes'][_0xb564('0x3d')]?_0x5d3a49[_0xb564('0x2c')]:_0x1e0ee4[_0xb564('0x29')];if(!_0x4efd55[_0xb564('0x24')]['hasOwnProperty'](_0xb564('0x3e'))){_0x5d3a49[_0xb564('0x14')]=qs[_0xb564('0x14')](_0x4efd55[_0xb564('0x24')][_0xb564('0x14')]);_0x5d3a49['offset']=qs['offset'](_0x4efd55[_0xb564('0x24')][_0xb564('0x11')]);}_0x5d3a49[_0xb564('0x3f')]=qs[_0xb564('0x40')](_0x4efd55[_0xb564('0x24')]['sort']);_0x5d3a49['where']=qs[_0xb564('0x3c')](_[_0xb564('0x41')](_0x4efd55['query'],_0x1e0ee4[_0xb564('0x3c')]));_0x5d3a49['where'][_0xb564('0x42')]=_0xd0555f['id'];if(_0x4efd55[_0xb564('0x24')][_0xb564('0x43')]){_0x5d3a49[_0xb564('0x44')]=_[_0xb564('0x30')](_0x5d3a49[_0xb564('0x44')],{'$or':_[_0xb564('0x1c')](_0x5d3a49['attributes'],function(_0x39612e){var _0x42d404={};_0x42d404[_0x39612e]={'$like':'%'+_0x4efd55[_0xb564('0x24')][_0xb564('0x43')]+'%'};return _0x42d404;})});}if(_0x4efd55[_0xb564('0x24')][_0xb564('0x45')]){var _0x151d7a=_0x4efd55[_0xb564('0x24')]['$gte'][_0xb564('0x46')](',');var _0x24adb1={};_0x24adb1[_0x151d7a[0x0]]={'$gte':moment(_0x151d7a[0x1])['format'](_0xb564('0x47'))};_0x5d3a49[_0xb564('0x44')]=_['merge'](_0x5d3a49[_0xb564('0x44')],_0x24adb1);}_0x5d3a49=_[_0xb564('0x30')]({},_0x5d3a49,_0x4efd55['options']);return db[_0xb564('0x38')]['count']({'where':_0x5d3a49[_0xb564('0x44')]})[_0xb564('0x16')](function(_0x5f0765){_0x488d52[_0xb564('0x13')]=_0x5f0765;if(_0x4efd55['query']['includeAll']){_0x5d3a49[_0xb564('0x2f')]=[{'all':!![]}];}return db['SmsMessage'][_0xb564('0x22')](_0x5d3a49);})['then'](function(_0x3d4009){_0x488d52[_0xb564('0x48')]=_0x3d4009;return _0x488d52;});}})['then'](respondWithFilteredResult(_0x3857de,_0x5d3a49))['catch'](handleError(_0x3857de,null));};exports['addTags']=function(_0x2bee13,_0x483201){return db[_0xb564('0x1d')][_0xb564('0x32')]({'where':{'id':_0x2bee13['params']['id']}})['then'](handleEntityNotFound(_0x483201,null))['then'](function(_0x2ba49){if(_0x2ba49){return _0x2ba49[_0xb564('0x49')](_0x2bee13[_0xb564('0x34')]['ids'],_[_0xb564('0x4a')](_0x2bee13[_0xb564('0x34')],[_0xb564('0x39'),'id'])||{})[_0xb564('0x4b')](function(){return db[_0xb564('0x4c')]['findAll']({'attributes':['id',_0xb564('0x19'),_0xb564('0x4d')],'where':{'id':_0x2bee13[_0xb564('0x34')][_0xb564('0x39')]}});})[_0xb564('0x16')](function(_0x5c8fde){socket[_0xb564('0x4e')]('smsInteractionTags:save',{'id':Number(_0x2bee13[_0xb564('0x28')]['id']),'tags':_0x5c8fde||[]});return{'id':Number(_0x2bee13['params']['id']),'tags':_0x5c8fde||[]};});}})[_0xb564('0x16')](respondWithResult(_0x483201,null))[_0xb564('0x26')](handleError(_0x483201,null));};exports['removeTags']=function(_0x55ebbb,_0x1d1a98){return db[_0xb564('0x1d')][_0xb564('0x32')]({'where':{'id':_0x55ebbb[_0xb564('0x28')]['id']}})['then'](handleEntityNotFound(_0x1d1a98,null))[_0xb564('0x16')](function(_0x381fde){if(_0x381fde){return _0x381fde['removeTags'](_0x55ebbb[_0xb564('0x24')][_0xb564('0x39')]);}})[_0xb564('0x16')](respondWithStatusCode(_0x1d1a98,null))[_0xb564('0x26')](handleError(_0x1d1a98,null));};exports['download']=function(_0x25f590,_0x4a8c59){var _0x1968fa=moment()[_0xb564('0x4f')]()['toString']();var _0x272db7=path[_0xb564('0x50')](config[_0xb564('0x51')],_0xb564('0x52'),'files','tmp');var _0x13772c=path[_0xb564('0x50')](_0x272db7,_0x1968fa);var _0x2b6ca8=util['format'](_0xb564('0x53'),_0x25f590[_0xb564('0x28')]['id'],_0x1968fa);var _0x5624d3=path[_0xb564('0x50')](_0x272db7,_0x2b6ca8);var _0x1cca86=[];_0x1cca86[_0xb564('0x54')]({'model':db[_0xb564('0x55')],'as':'User','attributes':['id',_0xb564('0x56')],'raw':!![]});_0x1cca86[_0xb564('0x54')]({'model':db[_0xb564('0x57')],'as':_0xb564('0x58'),'attributes':['id',_0xb564('0x59'),_0xb564('0x5a')],'raw':!![]});var _0x508e1b=[{'model':db['SmsMessage'],'as':_0xb564('0x5b'),'attributes':['id',_0xb564('0x34'),_0xb564('0x5c'),_0xb564('0x5d'),_0xb564('0x5e'),_0xb564('0x5f')],'include':_0x1cca86}];_0x508e1b[_0xb564('0x54')]({'model':db['SmsAccount'],'as':_0xb564('0x60'),'attributes':['id',_0xb564('0x19')]});_0x508e1b[_0xb564('0x54')]({'model':db[_0xb564('0x55')],'as':_0xb564('0x61'),'attributes':['id','fullname']});return db[_0xb564('0x1d')]['find']({'where':{'id':_0x25f590[_0xb564('0x28')]['id']},'include':_0x508e1b})[_0xb564('0x16')](handleEntityNotFound(_0x4a8c59,null))[_0xb564('0x16')](function(_0x181e03){if(_0x181e03){var _0x682615=_0x181e03[_0xb564('0x62')]({'plain':!![]});fs[_0xb564('0x63')](_0x13772c);var _0xf0c067={'channel':_0xb564('0x64'),'account':_0x682615['Account'][_0xb564('0x19')],'agent':_0x682615[_0xb564('0x61')]?_0x682615['Owner'][_0xb564('0x56')]:'N.A.','createdAt':moment(_0x682615[_0xb564('0x5c')])[_0xb564('0x65')](_0xb564('0x47'))[_0xb564('0x66')](),'closedAt':_0x682615[_0xb564('0x67')]?moment(_0x682615[_0xb564('0x68')])['format'](_0xb564('0x47'))[_0xb564('0x66')]():'','disposition':_0x682615[_0xb564('0x69')],'messages':_(_0x682615['Messages'])[_0xb564('0x43')]({'secret':![]})[_0xb564('0x1c')](function(_0x3bb0bd){return{'date':moment(_0x3bb0bd['createdAt'])[_0xb564('0x65')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb564('0x66')](),'sender':_0x3bb0bd['direction']==='out'?_0x3bb0bd[_0xb564('0x55')]?_0x3bb0bd['User'][_0xb564('0x56')]:'System':_0x3bb0bd[_0xb564('0x58')]['firstName']+(_0x3bb0bd['Contact']['lastName']?'\x20'+_0x3bb0bd['Contact']['lastName']:''),'body':_0x3bb0bd['body'],'direction':_0x3bb0bd[_0xb564('0x5d')]===_0xb564('0x6a')?'A':'C','secret':_0x3bb0bd['secret'],'read':_0x3bb0bd[_0xb564('0x5f')]};})['value']()};return ejs['renderFile'](path[_0xb564('0x50')](config[_0xb564('0x51')],_0xb564('0x52'),_0xb564('0x6b'),_0xb564('0x6c')),{'interaction':_0xf0c067})['then'](function(_0x3983cf){var _0x1bbc2e=path[_0xb564('0x50')](_0x13772c,_0xb564('0x6d')+_0x682615['id']+'-'+_0x1968fa+_0xb564('0x6e'));var _0x59f0b6={'path':_0x1bbc2e,'channel':'Sms','interactionId':_0x682615['id']};return pdf[_0xb564('0x6f')](_0x3983cf,_0x59f0b6);})[_0xb564('0x16')](function(){return new BPromise(function(_0x294330,_0x2e9140){zipdir(_0x13772c,{'saveTo':_0x5624d3},function(_0x4cbda0,_0x2734b4){if(_0x4cbda0)return _0x2e9140(_0x4cbda0);return _0x294330(_0x2734b4);});})[_0xb564('0x16')](function(){return new BPromise(function(_0x3d6566,_0x1c288f){rimraf(_0x13772c,function(_0x147ea7){if(_0x147ea7)_0x1c288f(_0x147ea7);return _0x3d6566();});});})['then'](function(){return _0x4a8c59[_0xb564('0x70')](_0x5624d3,_0x2b6ca8,function(_0x497ed9){if(_0x497ed9){console['log'](_0xb564('0x71'),_0x497ed9);}else{fs[_0xb564('0x72')](_0x5624d3);}});});});}else{return _0x4a8c59[_0xb564('0xe')](0xc8);}})['catch'](handleError(_0x4a8c59,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e39ada9..cddfa37 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 _0xb03e=['SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction'];(function(_0x18847a,_0xd6898e){var _0x5b68ca=function(_0xf333b){while(--_0xf333b){_0x18847a['push'](_0x18847a['shift']());}};_0x5b68ca(++_0xd6898e);}(_0xb03e,0x1eb));var _0xeb03=function(_0x95b1e8,_0x46c4b7){_0x95b1e8=_0x95b1e8-0x0;var _0x5f27a4=_0xb03e[_0x95b1e8];return _0x5f27a4;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xeb03('0x0'))['db'][_0xeb03('0x1')];var SmsMessage=require(_0xeb03('0x0'))['db'][_0xeb03('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeb03('0x3')](0x0);var events={'afterCreate':_0xeb03('0x4'),'afterUpdate':_0xeb03('0x5'),'afterDestroy':_0xeb03('0x6')};function emitEvent(_0x474450){return function(_0x3ba4b0,_0x88925b,_0xee2291){_0x3ba4b0['getUsers']({'attributes':['id'],'raw':!![]})[_0xeb03('0x7')](function(_0x3d3322){_0x3ba4b0[_0xeb03('0x8')](_0xeb03('0x9'),_0x3d3322[_0xeb03('0xa')](function(_0x28c772){return{'id':_0x28c772['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3ba4b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb03('0x7')](function(_0x99f4e2){_0x3ba4b0[_0xeb03('0x8')]('unreadMessages',_0x99f4e2[_0xeb03('0xb')]);SmsInteractionEvents['emit'](_0x474450+':'+_0x3ba4b0['id'],_0x3ba4b0);SmsInteractionEvents[_0xeb03('0xc')](_0x474450,_0x3ba4b0);_0xee2291(null);})[_0xeb03('0xd')](_0xee2291(null));};}for(var e in events){if(events[_0xeb03('0xe')](e)){var event=events[e];SmsInteraction[_0xeb03('0xf')](e,emitEvent(event));}}module[_0xeb03('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x1c7c=['../../mysqldb','SmsInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x37194e,_0x5911e9){var _0x2c512a=function(_0x136378){while(--_0x136378){_0x37194e['push'](_0x37194e['shift']());}};_0x2c512a(++_0x5911e9);}(_0x1c7c,0x164));var _0xc1c7=function(_0x3aa784,_0x10d7e5){_0x3aa784=_0x3aa784-0x0;var _0x1590b5=_0x1c7c[_0x3aa784];return _0x1590b5;};'use strict';var EventEmitter=require(_0xc1c7('0x0'));var SmsInteraction=require(_0xc1c7('0x1'))['db'][_0xc1c7('0x2')];var SmsMessage=require(_0xc1c7('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc1c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1c7('0x4'),'afterDestroy':_0xc1c7('0x5')};function emitEvent(_0xbb9da0){return function(_0x2a0383,_0x42e930,_0x364dde){_0x2a0383[_0xc1c7('0x6')]({'attributes':['id'],'raw':!![]})[_0xc1c7('0x7')](function(_0xce5bcd){_0x2a0383[_0xc1c7('0x8')](_0xc1c7('0x9'),_0xce5bcd[_0xc1c7('0xa')](function(_0x92e892){return{'id':_0x92e892['id']};}));return SmsMessage[_0xc1c7('0xb')]({'where':{'SmsInteractionId':_0x2a0383['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1c7('0x7')](function(_0x301abf){_0x2a0383[_0xc1c7('0x8')]('unreadMessages',_0x301abf[_0xc1c7('0xc')]);SmsInteractionEvents[_0xc1c7('0xd')](_0xbb9da0+':'+_0x2a0383['id'],_0x2a0383);SmsInteractionEvents['emit'](_0xbb9da0,_0x2a0383);_0x364dde(null);})[_0xc1c7('0xe')](_0x364dde(null));};}for(var e in events){if(events[_0xc1c7('0xf')](e)){var event=events[e];SmsInteraction[_0xc1c7('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ccbf3a1..3853c90 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 _0xf78f=['path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','request-promise'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xf78f,0xa1));var _0xff78=function(_0x1b279d,_0x572947){_0x1b279d=_0x1b279d-0x0;var _0x483ef8=_0xf78f[_0x1b279d];return _0x483ef8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff78('0x0'))(_0xff78('0x1'));var moment=require('moment');var BPromise=require(_0xff78('0x2'));var rp=require(_0xff78('0x3'));var fs=require('fs');var path=require(_0xff78('0x4'));var rimraf=require(_0xff78('0x5'));var config=require(_0xff78('0x6'));var attributes=require(_0xff78('0x7'));module[_0xff78('0x8')]=function(_0xc622ef,_0x2a8217){return _0xc622ef[_0xff78('0x9')](_0xff78('0xa'),attributes,{'tableName':_0xff78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e6aaf,_0x26af83,_0x4058aa){if(_0x1e6aaf['changed']('closed')){_0x1e6aaf[_0xff78('0xc')]=moment()[_0xff78('0xd')](_0xff78('0xe'));}_0x4058aa(null,_0x1e6aaf);}}});}; \ No newline at end of file +var _0x30fc=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3f9eb0,_0x6bd185){var _0x21a31b=function(_0x569e30){while(--_0x569e30){_0x3f9eb0['push'](_0x3f9eb0['shift']());}};_0x21a31b(++_0x6bd185);}(_0x30fc,0x186));var _0xc30f=function(_0x44357a,_0x5732e7){_0x44357a=_0x44357a-0x0;var _0x2bd627=_0x30fc[_0x44357a];return _0x2bd627;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var logger=require(_0xc30f('0x2'))('api');var moment=require(_0xc30f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc30f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc30f('0x5'));var config=require(_0xc30f('0x6'));var attributes=require(_0xc30f('0x7'));module[_0xc30f('0x8')]=function(_0x2aa8d2,_0x472f87){return _0x2aa8d2[_0xc30f('0x9')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5871a4,_0x1b069b,_0x2d6131){if(_0x5871a4[_0xc30f('0xa')]('closed')){_0x5871a4[_0xc30f('0xb')]=moment()['format'](_0xc30f('0xc'));}_0x2d6131(null,_0x5871a4);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 21d04d3..e8617c6 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 _0x799c=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','catch','SmsInteraction','update','body','options','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','./smsInteraction.socket','register','request'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x799c,0x8e));var _0xc799=function(_0x5457c4,_0x35417d){_0x5457c4=_0x5457c4-0x0;var _0x305d0f=_0x799c[_0x5457c4];return _0x305d0f;};'use strict';var _=require(_0xc799('0x0'));var util=require('util');var moment=require(_0xc799('0x1'));var BPromise=require(_0xc799('0x2'));var rs=require(_0xc799('0x3'));var fs=require('fs');var Redis=require(_0xc799('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc799('0x5'));var logger=require(_0xc799('0x6'))(_0xc799('0x7'));var config=require(_0xc799('0x8'));var jayson=require(_0xc799('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc799('0xa')]=_['defaults'](config[_0xc799('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc799('0xa')]));require(_0xc799('0xb'))[_0xc799('0xc')](socket);function respondWithRpcPromise(_0x1edbfd,_0x4e897b,_0xcbf012){return new BPromise(function(_0x9b3f3,_0x106058){return client[_0xc799('0xd')](_0x1edbfd,_0xcbf012)['then'](function(_0x2d01a2){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4e897b,_0xc799('0xe'));logger[_0xc799('0xf')](_0xc799('0x10'),_0x4e897b,_0xc799('0xe'),JSON[_0xc799('0x11')](_0x2d01a2));if(_0x2d01a2[_0xc799('0x12')]){if(_0x2d01a2['error'][_0xc799('0x13')]===0x1f4){logger[_0xc799('0x12')](_0xc799('0x14'),_0x4e897b,_0x2d01a2[_0xc799('0x12')][_0xc799('0x15')]);return _0x106058(_0x2d01a2[_0xc799('0x12')][_0xc799('0x15')]);}logger[_0xc799('0x12')](_0xc799('0x14'),_0x4e897b,_0x2d01a2[_0xc799('0x12')][_0xc799('0x15')]);return _0x9b3f3(_0x2d01a2['error']['message']);}else{logger[_0xc799('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4e897b,_0xc799('0xe'));_0x9b3f3(_0x2d01a2['result'][_0xc799('0x15')]);}})[_0xc799('0x17')](function(_0x247d09){logger['error'](_0xc799('0x14'),_0x4e897b,_0x247d09);_0x106058(_0x247d09);});});}exports['UpdateSmsInteraction']=function(_0x4cb8d0){var _0x1d6264=this;return new Promise(function(_0x2a10bb,_0xb3dbb7){return db[_0xc799('0x18')][_0xc799('0x19')](_0x4cb8d0[_0xc799('0x1a')],{'raw':_0x4cb8d0['options']?_0x4cb8d0[_0xc799('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cb8d0[_0xc799('0x1b')]?_0x4cb8d0['options']['where']||null:null,'attributes':_0x4cb8d0[_0xc799('0x1b')]?_0x4cb8d0[_0xc799('0x1b')][_0xc799('0x1c')]||null:null,'limit':_0x4cb8d0['options']?_0x4cb8d0[_0xc799('0x1b')][_0xc799('0x1d')]||null:null})[_0xc799('0x1e')](function(_0x411285){logger[_0xc799('0x16')]('UpdateSmsInteraction',_0x4cb8d0);logger[_0xc799('0xf')](_0xc799('0x1f'),_0x4cb8d0,JSON[_0xc799('0x11')](_0x411285));_0x2a10bb(_0x411285);})['catch'](function(_0x25c259){logger[_0xc799('0x12')]('UpdateSmsInteraction',_0x25c259[_0xc799('0x15')],_0x4cb8d0);_0xb3dbb7(_0x1d6264['error'](0x1f4,_0x25c259[_0xc799('0x15')]));});});};exports[_0xc799('0x20')]=function(_0x4be317){return new Promise(function(_0x4aeeda,_0x3fecf2){return db[_0xc799('0x18')][_0xc799('0x21')]({'where':_0x4be317[_0xc799('0x1b')]?_0x4be317['options'][_0xc799('0x22')]||null:null})[_0xc799('0x1e')](function(_0x1a47a5){if(_0x1a47a5){return _0x1a47a5[_0xc799('0x23')](_0x4be317[_0xc799('0x1a')]['ids'],_[_0xc799('0x24')](_0x4be317[_0xc799('0x1a')],['ids','id'])||{});}})[_0xc799('0x25')](function(_0x8cf70c){logger[_0xc799('0x16')](_0xc799('0x26'),_0x4be317);logger[_0xc799('0xf')](_0xc799('0x26'),_0x4be317,JSON[_0xc799('0x11')](_0x8cf70c));_0x4aeeda(_0x8cf70c);})['catch'](function(_0x26e4e0){logger[_0xc799('0x12')](_0xc799('0x26'),_0x26e4e0[_0xc799('0x15')],_0x4be317);_0x3fecf2(_this[_0xc799('0x12')](0x1f4,_0x26e4e0[_0xc799('0x15')]));});});}; \ No newline at end of file +var _0x87a4=['rpc','jayson/promise','http','redis','socket.io-emitter','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','attributes','limit','find','where','ids','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x48a912,_0x13cd07){var _0x4c3ca0=function(_0x24bbcf){while(--_0x24bbcf){_0x48a912['push'](_0x48a912['shift']());}};_0x4c3ca0(++_0x13cd07);}(_0x87a4,0x1d6));var _0x487a=function(_0xbdd032,_0x27760b){_0xbdd032=_0xbdd032-0x0;var _0x444939=_0x87a4[_0xbdd032];return _0x444939;};'use strict';var _=require('lodash');var util=require(_0x487a('0x0'));var moment=require(_0x487a('0x1'));var BPromise=require(_0x487a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x487a('0x3'));var db=require(_0x487a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x487a('0x5'))(_0x487a('0x6'));var config=require('../../config/environment');var jayson=require(_0x487a('0x7'));var client=jayson['client'][_0x487a('0x8')]({'port':0x232a});config[_0x487a('0x9')]=_['defaults'](config[_0x487a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x487a('0xa'))(new Redis(config[_0x487a('0x9')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x384739,_0x5656fa,_0x4ccbc1){return new BPromise(function(_0x161f8b,_0x29c5ca){return client[_0x487a('0xb')](_0x384739,_0x4ccbc1)[_0x487a('0xc')](function(_0x287808){logger[_0x487a('0xd')]('SmsInteraction,\x20%s,\x20%s',_0x5656fa,_0x487a('0xe'));logger[_0x487a('0xf')](_0x487a('0x10'),_0x5656fa,'request\x20sent',JSON[_0x487a('0x11')](_0x287808));if(_0x287808[_0x487a('0x12')]){if(_0x287808['error'][_0x487a('0x13')]===0x1f4){logger[_0x487a('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x5656fa,_0x287808[_0x487a('0x12')][_0x487a('0x14')]);return _0x29c5ca(_0x287808[_0x487a('0x12')][_0x487a('0x14')]);}logger['error'](_0x487a('0x15'),_0x5656fa,_0x287808[_0x487a('0x12')][_0x487a('0x14')]);return _0x161f8b(_0x287808['error'][_0x487a('0x14')]);}else{logger[_0x487a('0xd')](_0x487a('0x15'),_0x5656fa,_0x487a('0xe'));_0x161f8b(_0x287808['result'][_0x487a('0x14')]);}})[_0x487a('0x16')](function(_0x1224d3){logger[_0x487a('0x12')](_0x487a('0x15'),_0x5656fa,_0x1224d3);_0x29c5ca(_0x1224d3);});});}exports[_0x487a('0x17')]=function(_0x3e7b53){var _0x3f9bee=this;return new Promise(function(_0x2b4b15,_0x2ab201){return db[_0x487a('0x18')][_0x487a('0x19')](_0x3e7b53[_0x487a('0x1a')],{'raw':_0x3e7b53[_0x487a('0x1b')]?_0x3e7b53['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e7b53[_0x487a('0x1b')]?_0x3e7b53['options']['where']||null:null,'attributes':_0x3e7b53[_0x487a('0x1b')]?_0x3e7b53['options'][_0x487a('0x1c')]||null:null,'limit':_0x3e7b53[_0x487a('0x1b')]?_0x3e7b53['options'][_0x487a('0x1d')]||null:null})[_0x487a('0xc')](function(_0x221a3a){logger['info'](_0x487a('0x17'),_0x3e7b53);logger[_0x487a('0xf')](_0x487a('0x17'),_0x3e7b53,JSON['stringify'](_0x221a3a));_0x2b4b15(_0x221a3a);})['catch'](function(_0xbffa15){logger[_0x487a('0x12')](_0x487a('0x17'),_0xbffa15['message'],_0x3e7b53);_0x2ab201(_0x3f9bee[_0x487a('0x12')](0x1f4,_0xbffa15[_0x487a('0x14')]));});});};exports['AddTagsToSmsInteraction']=function(_0x56a8e7){return new Promise(function(_0x21f5fe,_0x4f9d54){return db[_0x487a('0x18')][_0x487a('0x1e')]({'where':_0x56a8e7[_0x487a('0x1b')]?_0x56a8e7[_0x487a('0x1b')][_0x487a('0x1f')]||null:null})[_0x487a('0xc')](function(_0x9e4303){if(_0x9e4303){return _0x9e4303['addTags'](_0x56a8e7[_0x487a('0x1a')][_0x487a('0x20')],_['omit'](_0x56a8e7[_0x487a('0x1a')],[_0x487a('0x20'),'id'])||{});}})['spread'](function(_0x18a874){logger['info'](_0x487a('0x21'),_0x56a8e7);logger[_0x487a('0xf')](_0x487a('0x21'),_0x56a8e7,JSON['stringify'](_0x18a874));_0x21f5fe(_0x18a874);})[_0x487a('0x16')](function(_0x48f074){logger[_0x487a('0x12')](_0x487a('0x21'),_0x48f074[_0x487a('0x14')],_0x56a8e7);_0x4f9d54(_this[_0x487a('0x12')](0x1f4,_0x48f074['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 805ebe4..b21ed2f 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 _0x13ba=['removeListener','length','smsInteraction:','./smsInteraction.events','update'];(function(_0x42d12a,_0x29d7fd){var _0x297edf=function(_0x225e98){while(--_0x225e98){_0x42d12a['push'](_0x42d12a['shift']());}};_0x297edf(++_0x29d7fd);}(_0x13ba,0x184));var _0xa13b=function(_0x455abf,_0x4ae86d){_0x455abf=_0x455abf-0x0;var _0x3ab136=_0x13ba[_0x455abf];return _0x3ab136;};'use strict';var SmsInteractionEvents=require(_0xa13b('0x0'));var events=['save','remove',_0xa13b('0x1')];function createListener(_0x4b9c63,_0x13bebc){return function(_0x3248b4){_0x13bebc['emit'](_0x4b9c63,_0x3248b4);};}function removeListener(_0x316daa,_0x3fbf84){return function(){SmsInteractionEvents[_0xa13b('0x2')](_0x316daa,_0x3fbf84);};}exports['register']=function(_0x355f85){for(var _0x563364=0x0,_0x89a7b7=events[_0xa13b('0x3')];_0x563364<_0x89a7b7;_0x563364++){var _0xda072b=events[_0x563364];var _0x23b633=createListener(_0xa13b('0x4')+_0xda072b,_0x355f85);SmsInteractionEvents['on'](_0xda072b,_0x23b633);}}; \ No newline at end of file +var _0x6da6=['smsInteraction:','save','remove','update','emit','removeListener','register'];(function(_0xf460c3,_0x129179){var _0x542a70=function(_0x45b43c){while(--_0x45b43c){_0xf460c3['push'](_0xf460c3['shift']());}};_0x542a70(++_0x129179);}(_0x6da6,0x1a5));var _0x66da=function(_0x3ceb6c,_0x554602){_0x3ceb6c=_0x3ceb6c-0x0;var _0x256814=_0x6da6[_0x3ceb6c];return _0x256814;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x66da('0x0'),_0x66da('0x1'),_0x66da('0x2')];function createListener(_0x212295,_0x4efd9d){return function(_0x1e2ecb){_0x4efd9d[_0x66da('0x3')](_0x212295,_0x1e2ecb);};}function removeListener(_0x2f60f7,_0x475bec){return function(){SmsInteractionEvents[_0x66da('0x4')](_0x2f60f7,_0x475bec);};}exports[_0x66da('0x5')]=function(_0x1431e9){for(var _0x1b7fa7=0x0,_0x4757ab=events['length'];_0x1b7fa7<_0x4757ab;_0x1b7fa7++){var _0x764101=events[_0x1b7fa7];var _0x3271a1=createListener(_0x66da('0x6')+_0x764101,_0x1431e9);SmsInteractionEvents['on'](_0x764101,_0x3271a1);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1304879..6f77618 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 _0x96be=['/:id/status','put','/:id','update','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','post','tracked','sms','smsmessage:create','create'];(function(_0x2d13db,_0x59a64d){var _0x37ba6f=function(_0x353ec7){while(--_0x353ec7){_0x2d13db['push'](_0x2d13db['shift']());}};_0x37ba6f(++_0x59a64d);}(_0x96be,0x1c9));var _0xe96b=function(_0x13c994,_0x8c94eb){_0x13c994=_0x13c994-0x0;var _0x374872=_0x96be[_0x13c994];return _0x374872;};'use strict';var multer=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var path=require(_0xe96b('0x2'));var timeout=require(_0xe96b('0x3'));var express=require(_0xe96b('0x4'));var router=express[_0xe96b('0x5')]();var fs_extra=require(_0xe96b('0x6'));var auth=require(_0xe96b('0x7'));var interaction=require(_0xe96b('0x8'));var config=require(_0xe96b('0x9'));var controller=require(_0xe96b('0xa'));router[_0xe96b('0xb')]('/',auth[_0xe96b('0xc')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe96b('0xd')]);router[_0xe96b('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe96b('0xe')]('/',auth[_0xe96b('0xc')](),interaction[_0xe96b('0xf')](_0xe96b('0x10'),_0xe96b('0x11')),controller[_0xe96b('0x12')]);router[_0xe96b('0xe')](_0xe96b('0x13'),controller['status']);router[_0xe96b('0x14')](_0xe96b('0x15'),auth[_0xe96b('0xc')](),controller[_0xe96b('0x16')]);router[_0xe96b('0x14')]('/:id/accept',auth[_0xe96b('0xc')](),controller[_0xe96b('0x17')]);router['put'](_0xe96b('0x18'),auth[_0xe96b('0xc')](),controller[_0xe96b('0x19')]);router[_0xe96b('0x1a')](_0xe96b('0x15'),auth[_0xe96b('0xc')](),controller['destroy']);module[_0xe96b('0x1b')]=router; \ No newline at end of file +var _0x13ea=['isAuthenticated','describe','show','post','tracked','smsmessage:create','create','/:id/status','put','/:id','update','accept','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','./smsMessage.controller','get'];(function(_0x71bd09,_0x1f1ff7){var _0x46186d=function(_0x1486d9){while(--_0x1486d9){_0x71bd09['push'](_0x71bd09['shift']());}};_0x46186d(++_0x1f1ff7);}(_0x13ea,0xa9));var _0xa13e=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x13ea[_0x15b399];return _0x199f2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa13e('0x0'));var timeout=require(_0xa13e('0x1'));var express=require(_0xa13e('0x2'));var router=express['Router']();var fs_extra=require(_0xa13e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa13e('0x4'));var config=require('../../config/environment');var controller=require(_0xa13e('0x5'));router[_0xa13e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xa13e('0x7')](),controller[_0xa13e('0x8')]);router[_0xa13e('0x6')]('/:id',auth[_0xa13e('0x7')](),controller[_0xa13e('0x9')]);router[_0xa13e('0xa')]('/',auth[_0xa13e('0x7')](),interaction[_0xa13e('0xb')]('sms',_0xa13e('0xc')),controller[_0xa13e('0xd')]);router[_0xa13e('0xa')](_0xa13e('0xe'),controller['status']);router[_0xa13e('0xf')](_0xa13e('0x10'),auth[_0xa13e('0x7')](),controller[_0xa13e('0x11')]);router[_0xa13e('0xf')]('/:id/accept',auth[_0xa13e('0x7')](),controller[_0xa13e('0x12')]);router['put']('/:id/reject',auth[_0xa13e('0x7')](),controller['reject']);router[_0xa13e('0x13')]('/:id',auth[_0xa13e('0x7')](),controller[_0xa13e('0x14')]);module[_0xa13e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e20d46c..a3cdb40 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 _0xa58e=['STRING','DATE','sequelize','exports','out'];(function(_0x5776af,_0xda8dd6){var _0x3b03f8=function(_0x407d88){while(--_0x407d88){_0x5776af['push'](_0x5776af['shift']());}};_0x3b03f8(++_0xda8dd6);}(_0xa58e,0x1d3));var _0xea58=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa58e[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0xea58('0x0'));module[_0xea58('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xea58('0x2')),'defaultValue':_0xea58('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xea58('0x3')](0xbe)},'phone':{'type':Sequelize[_0xea58('0x3')]},'readAt':{'type':Sequelize[_0xea58('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xea58('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x88df=['DATE','BOOLEAN','sequelize','exports','TEXT','out','STRING'];(function(_0x594ac5,_0x56f811){var _0x4ba691=function(_0x267e67){while(--_0x267e67){_0x594ac5['push'](_0x594ac5['shift']());}};_0x4ba691(++_0x56f811);}(_0x88df,0x10c));var _0xf88d=function(_0x4b3093,_0x964787){_0x4b3093=_0x4b3093-0x0;var _0x51a97f=_0x88df[_0x4b3093];return _0x51a97f;};'use strict';var Sequelize=require(_0xf88d('0x0'));module[_0xf88d('0x1')]={'body':{'type':Sequelize[_0xf88d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf88d('0x3')),'defaultValue':_0xf88d('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf88d('0x4')](0xbe)},'phone':{'type':Sequelize[_0xf88d('0x4')]},'readAt':{'type':Sequelize[_0xf88d('0x5')]},'secret':{'type':Sequelize[_0xf88d('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf88d('0x4')]},'providerResponse':{'type':Sequelize[_0xf88d('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3abb3eb..dbe4237 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 _0x7add=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','SmsMessage','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','intersection','find','create','body','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','User','fullname','email','interface','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7add,0x72));var _0xd7ad=function(_0x5a2267,_0xdd61e1){_0x5a2267=_0x5a2267-0x0;var _0x57c221=_0x7add[_0x5a2267];return _0x57c221;};'use strict';var emlformat=require(_0xd7ad('0x0'));var rimraf=require(_0xd7ad('0x1'));var zipdir=require(_0xd7ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7ad('0x3'));var moment=require(_0xd7ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd7ad('0x5'));var util=require('util');var path=require(_0xd7ad('0x6'));var sox=require(_0xd7ad('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd7ad('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd7ad('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd7ad('0xa'));var toCsv=require(_0xd7ad('0xb'));var querystring=require(_0xd7ad('0xc'));var Papa=require('papaparse');var Redis=require(_0xd7ad('0xd'));var authService=require(_0xd7ad('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd7ad('0xf'));var hardwareService=require(_0xd7ad('0x10'));var logger=require('../../config/logger')(_0xd7ad('0x11'));var utils=require(_0xd7ad('0x12'));var config=require(_0xd7ad('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd7ad('0x14')]=_[_0xd7ad('0x15')](config['redis'],{'host':_0xd7ad('0x16'),'port':0x18eb});var socket=require(_0xd7ad('0x17'))(new Redis(config[_0xd7ad('0x14')]));require(_0xd7ad('0x18'))[_0xd7ad('0x19')](socket);var jayson=require(_0xd7ad('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0c28,_0x3c5240,_0x73742,_0x385af4){return new BPromise(function(_0x44872e,_0xf2fcbd){var _0x3ab531=_0x385af4||client;return _0x3ab531[_0xd7ad('0x1b')](_0x3a0c28,_0x73742)['then'](function(_0x41f9a7){logger[_0xd7ad('0x1c')](_0xd7ad('0x1d'),_0x3c5240,_0xd7ad('0x1e'));logger[_0xd7ad('0x1f')](_0xd7ad('0x20'),_0x3c5240,_0xd7ad('0x1e'),JSON[_0xd7ad('0x21')](_0x41f9a7));if(_0x41f9a7['error']){if(_0x41f9a7['error'][_0xd7ad('0x22')]===0x1f4){logger[_0xd7ad('0x23')](_0xd7ad('0x1d'),_0x3c5240,_0x41f9a7[_0xd7ad('0x23')]['message']);return _0xf2fcbd(_0x41f9a7['error'][_0xd7ad('0x24')]);}logger[_0xd7ad('0x23')]('SmsMessage,\x20%s,\x20%s',_0x3c5240,_0x41f9a7[_0xd7ad('0x23')][_0xd7ad('0x24')]);return _0x44872e(_0x41f9a7['error'][_0xd7ad('0x24')]);}else{logger[_0xd7ad('0x1c')](_0xd7ad('0x1d'),_0x3c5240,_0xd7ad('0x1e'));_0x44872e(_0x41f9a7[_0xd7ad('0x25')]['message']);}})[_0xd7ad('0x26')](function(_0x4e8a31){logger[_0xd7ad('0x23')]('SmsMessage,\x20%s,\x20%s',_0x3c5240,_0x4e8a31);_0xf2fcbd(_0x4e8a31);});});}function respondWithStatusCode(_0x4cd9a3,_0x10caf2){_0x10caf2=_0x10caf2||0xcc;return function(_0x70be59){if(_0x70be59){return _0x4cd9a3[_0xd7ad('0x27')](_0x10caf2);}return _0x4cd9a3[_0xd7ad('0x28')](_0x10caf2)[_0xd7ad('0x29')]();};}function respondWithResult(_0x26a7f6,_0x1afd13){_0x1afd13=_0x1afd13||0xc8;return function(_0x417d2e){if(_0x417d2e){return _0x26a7f6['status'](_0x1afd13)[_0xd7ad('0x2a')](_0x417d2e);}};}function respondWithFilteredResult(_0x1fde2a,_0x38b9ba){return function(_0x30ec1e){if(_0x30ec1e){var _0x40e436=typeof _0x38b9ba['offset']==='undefined'&&typeof _0x38b9ba[_0xd7ad('0x2b')]===_0xd7ad('0x2c');var _0x13920c=_0x30ec1e[_0xd7ad('0x2d')];var _0x454f1e=_0x40e436?0x0:_0x38b9ba[_0xd7ad('0x2e')];var _0x3be2a2=_0x40e436?_0x30ec1e[_0xd7ad('0x2d')]:_0x38b9ba[_0xd7ad('0x2e')]+_0x38b9ba['limit'];var _0x8680a4;if(_0x3be2a2>=_0x13920c){_0x3be2a2=_0x13920c;_0x8680a4=0xc8;}else{_0x8680a4=0xce;}_0x1fde2a[_0xd7ad('0x28')](_0x8680a4);return _0x1fde2a[_0xd7ad('0x2f')](_0xd7ad('0x30'),_0x454f1e+'-'+_0x3be2a2+'/'+_0x13920c)[_0xd7ad('0x2a')](_0x30ec1e);}return null;};}function patchUpdates(_0x30192f){return function(_0x2671b3){try{jsonpatch[_0xd7ad('0x31')](_0x2671b3,_0x30192f,!![]);}catch(_0xcf754c){return BPromise[_0xd7ad('0x32')](_0xcf754c);}return _0x2671b3[_0xd7ad('0x33')]();};}function saveUpdates(_0x6cb67e,_0x3f20bc){return function(_0x24ed99){if(_0x24ed99){return _0x24ed99[_0xd7ad('0x34')](_0x6cb67e)[_0xd7ad('0x35')](function(_0x3e00f2){return _0x3e00f2;});}return null;};}function removeEntity(_0x38550e,_0x3bed9b){return function(_0x80f13){if(_0x80f13){return _0x80f13[_0xd7ad('0x36')]()[_0xd7ad('0x35')](function(){_0x38550e[_0xd7ad('0x28')](0xcc)[_0xd7ad('0x29')]();});}};}function handleEntityNotFound(_0x10b845,_0x3d8be8){return function(_0x5e4da9){if(!_0x5e4da9){_0x10b845[_0xd7ad('0x27')](0x194);}return _0x5e4da9;};}function handleError(_0x443deb,_0x2ede8b){_0x2ede8b=_0x2ede8b||0x1f4;return function(_0x2cd7e){logger['error'](_0x2cd7e[_0xd7ad('0x37')]);if(_0x2cd7e[_0xd7ad('0x38')]){delete _0x2cd7e[_0xd7ad('0x38')];}_0x443deb[_0xd7ad('0x28')](_0x2ede8b)[_0xd7ad('0x39')](_0x2cd7e);};}exports['index']=function(_0x17e5ec,_0xbf430a){var _0x516773={},_0x1e397c={},_0x31a0ff={'count':0x0,'rows':[]};var _0xe3fc12=_['map'](db[_0xd7ad('0x3a')][_0xd7ad('0x3b')],function(_0x1ad1c3){return{'name':_0x1ad1c3['fieldName'],'type':_0x1ad1c3[_0xd7ad('0x3c')][_0xd7ad('0x3d')]};});_0x1e397c[_0xd7ad('0x3e')]=_[_0xd7ad('0x3f')](_0xe3fc12,_0xd7ad('0x38'));_0x1e397c[_0xd7ad('0x40')]=_[_0xd7ad('0x41')](_0x17e5ec[_0xd7ad('0x40')]);_0x1e397c[_0xd7ad('0x42')]=_['intersection'](_0x1e397c[_0xd7ad('0x3e')],_0x1e397c[_0xd7ad('0x40')]);_0x516773[_0xd7ad('0x43')]=_['intersection'](_0x1e397c['model'],qs[_0xd7ad('0x44')](_0x17e5ec[_0xd7ad('0x40')][_0xd7ad('0x44')]));_0x516773[_0xd7ad('0x43')]=_0x516773['attributes'][_0xd7ad('0x45')]?_0x516773[_0xd7ad('0x43')]:_0x1e397c[_0xd7ad('0x3e')];if(!_0x17e5ec['query']['hasOwnProperty'](_0xd7ad('0x46'))){_0x516773[_0xd7ad('0x2b')]=qs[_0xd7ad('0x2b')](_0x17e5ec[_0xd7ad('0x40')][_0xd7ad('0x2b')]);_0x516773[_0xd7ad('0x2e')]=qs['offset'](_0x17e5ec['query'][_0xd7ad('0x2e')]);}_0x516773[_0xd7ad('0x47')]=qs[_0xd7ad('0x48')](_0x17e5ec[_0xd7ad('0x40')][_0xd7ad('0x48')]);_0x516773[_0xd7ad('0x49')]=qs[_0xd7ad('0x42')](_[_0xd7ad('0x4a')](_0x17e5ec[_0xd7ad('0x40')],_0x1e397c[_0xd7ad('0x42')]),_0xe3fc12);if(_0x17e5ec['query']['filter']){_0x516773[_0xd7ad('0x49')]=_[_0xd7ad('0x4b')](_0x516773[_0xd7ad('0x49')],{'$or':_['map'](_0xe3fc12,function(_0x123382){if(_0x123382[_0xd7ad('0x3c')]!==_0xd7ad('0x4c')){var _0x4deccd={};_0x4deccd[_0x123382[_0xd7ad('0x38')]]={'$like':'%'+_0x17e5ec['query'][_0xd7ad('0x4d')]+'%'};return _0x4deccd;}})});}_0x516773=_[_0xd7ad('0x4b')]({},_0x516773,_0x17e5ec['options']);var _0x55c99e={'where':_0x516773['where']};return db[_0xd7ad('0x3a')]['count'](_0x55c99e)['then'](function(_0x508874){_0x31a0ff['count']=_0x508874;if(_0x17e5ec['query'][_0xd7ad('0x4e')]){_0x516773[_0xd7ad('0x4f')]=[{'all':!![]}];}return db[_0xd7ad('0x3a')][_0xd7ad('0x50')](_0x516773);})[_0xd7ad('0x35')](function(_0x4b81e5){_0x31a0ff[_0xd7ad('0x51')]=_0x4b81e5;return _0x31a0ff;})[_0xd7ad('0x35')](respondWithFilteredResult(_0xbf430a,_0x516773))['catch'](handleError(_0xbf430a,null));};exports[_0xd7ad('0x52')]=function(_0xba297c,_0x3109c4){var _0x5ac1c5={'raw':!![],'where':{'id':_0xba297c[_0xd7ad('0x53')]['id']}},_0x40a4dd={};_0x40a4dd[_0xd7ad('0x3e')]=_[_0xd7ad('0x41')](db[_0xd7ad('0x3a')][_0xd7ad('0x3b')]);_0x40a4dd[_0xd7ad('0x40')]=_[_0xd7ad('0x41')](_0xba297c[_0xd7ad('0x40')]);_0x40a4dd['filters']=_[_0xd7ad('0x54')](_0x40a4dd[_0xd7ad('0x3e')],_0x40a4dd[_0xd7ad('0x40')]);_0x5ac1c5['attributes']=_[_0xd7ad('0x54')](_0x40a4dd['model'],qs['fields'](_0xba297c[_0xd7ad('0x40')][_0xd7ad('0x44')]));_0x5ac1c5['attributes']=_0x5ac1c5['attributes'][_0xd7ad('0x45')]?_0x5ac1c5['attributes']:_0x40a4dd['model'];if(_0xba297c['query'][_0xd7ad('0x4e')]){_0x5ac1c5[_0xd7ad('0x4f')]=[{'all':!![]}];}_0x5ac1c5=_[_0xd7ad('0x4b')]({},_0x5ac1c5,_0xba297c['options']);return db[_0xd7ad('0x3a')][_0xd7ad('0x55')](_0x5ac1c5)[_0xd7ad('0x35')](handleEntityNotFound(_0x3109c4,null))[_0xd7ad('0x35')](respondWithResult(_0x3109c4,null))['catch'](handleError(_0x3109c4,null));};exports[_0xd7ad('0x56')]=function(_0x3bd786,_0x597a02){return db['SmsMessage']['create'](_0x3bd786['body'],{})[_0xd7ad('0x35')](respondWithResult(_0x597a02,0xc9))[_0xd7ad('0x26')](handleError(_0x597a02,null));};exports[_0xd7ad('0x34')]=function(_0xc2b847,_0x22d604){if(_0xc2b847['body']['id']){delete _0xc2b847[_0xd7ad('0x57')]['id'];}return db['SmsMessage'][_0xd7ad('0x55')]({'where':{'id':_0xc2b847['params']['id']}})[_0xd7ad('0x35')](handleEntityNotFound(_0x22d604,null))[_0xd7ad('0x35')](saveUpdates(_0xc2b847['body'],null))['then'](respondWithResult(_0x22d604,null))[_0xd7ad('0x26')](handleError(_0x22d604,null));};exports['destroy']=function(_0x195d90,_0x42d990){return db[_0xd7ad('0x3a')][_0xd7ad('0x55')]({'where':{'id':_0x195d90[_0xd7ad('0x53')]['id']}})[_0xd7ad('0x35')](handleEntityNotFound(_0x42d990,null))['then'](removeEntity(_0x42d990,null))['catch'](handleError(_0x42d990,null));};exports['describe']=function(_0x34214a,_0x51c1d8){return db[_0xd7ad('0x3a')]['describe']()[_0xd7ad('0x35')](respondWithResult(_0x51c1d8,null))[_0xd7ad('0x26')](handleError(_0x51c1d8,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['accept']=function(_0x3f1e4b,_0x463f4b,_0x312162){var _0x3f655a={'agent':{},'channel':_0xd7ad('0x58')};if(_0x3f1e4b[_0xd7ad('0x57')]['id']){delete _0x3f1e4b[_0xd7ad('0x57')]['id'];}_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x59')]=!![];_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5a')]=moment()[_0xd7ad('0x5b')](_0xd7ad('0x5c'));_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5d')]=_0x3f1e4b['body']['UserId']||_0x3f1e4b['user']['id'];_0x3f655a[_0xd7ad('0x5e')]['id']=_0x3f1e4b[_0xd7ad('0x57')]['UserId'];return db[_0xd7ad('0x3a')]['find']({'where':{'id':_0x3f1e4b[_0xd7ad('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x463f4b,null))['then'](saveUpdates(_0x3f1e4b[_0xd7ad('0x57')],null))[_0xd7ad('0x35')](function(_0x21bf37){if(_0x21bf37){_0x3f655a[_0xd7ad('0x24')]=_0x21bf37[_0xd7ad('0x5f')]({'plain':!![]});return db[_0xd7ad('0x60')][_0xd7ad('0x55')]({'where':{'id':_0x21bf37[_0xd7ad('0x61')]}});}return null;})[_0xd7ad('0x35')](handleEntityNotFound(_0x463f4b,null))[_0xd7ad('0x35')](function(_0x53397f){if(_0x53397f){return _0x53397f['update']({'UserId':_0x3f1e4b[_0xd7ad('0x57')]['UserId'],'read1stAt':_[_0xd7ad('0x62')](_0x53397f[_0xd7ad('0x63')])?moment()[_0xd7ad('0x5b')](_0xd7ad('0x5c')):undefined});}return null;})['then'](function(_0x4973e2){if(_0x4973e2){_0x3f655a[_0xd7ad('0x64')]=_0x4973e2['get']({'plain':!![]});interaction_log[_0xd7ad('0x1c')](_0xd7ad('0x65'),_0x3f1e4b[_0xd7ad('0x66')]['id'],_0x3f1e4b[_0xd7ad('0x66')]['name'],_0x3f1e4b['user'][_0xd7ad('0x67')],_0x3f655a[_0xd7ad('0x64')]['id'],_0x3f1e4b[_0xd7ad('0x57')]?JSON[_0xd7ad('0x21')](_0x3f1e4b[_0xd7ad('0x57')]):_0xd7ad('0x68'));return respondWithRpcPromise(_0xd7ad('0x69'),'acceptMessage',_0x3f655a);}return null;})[_0xd7ad('0x35')](function(_0x5176b1){var _0x5d3ab9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5176b1[_0xd7ad('0x24')][_0xd7ad('0x6a')];return db['sequelize'][_0xd7ad('0x40')](_0x5d3ab9,{'type':db[_0xd7ad('0x6b')][_0xd7ad('0x6c')][_0xd7ad('0x6d')],'raw':!![]})[_0xd7ad('0x35')](function(_0x2259ea){return _0x2259ea;});})['then'](function(_0x538bae){if(_0x538bae){_0x3f655a[_0xd7ad('0x24')][_0xd7ad('0x6e')]=_0x538bae[0x0];if(!_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5d')])return;return db['User'][_0xd7ad('0x55')]({'where':{'id':_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5d')],'role':_0xd7ad('0x5e')},'attributes':['id',_0xd7ad('0x38'),'fullname','email',_0xd7ad('0x6f')],'raw':!![]});}return null;})['then'](function(_0x3ad169){if(!_0x3ad169)return null;_0x3f655a[_0xd7ad('0x24')][_0xd7ad('0x5e')]=_0x3ad169;return _0x3f655a;})[_0xd7ad('0x35')](function(_0x3b01de){if(_0x3b01de){if(_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x70')]){_0x3f655a[_0xd7ad('0x24')]['interface']=util[_0xd7ad('0x5b')](_0xd7ad('0x71'),_0x3f1e4b[_0xd7ad('0x66')]['name']);_0x3f655a[_0xd7ad('0x24')][_0xd7ad('0x72')]=_0x3f655a['channel'];_0x3f655a['message'][_0xd7ad('0x73')]=_0x3f655a[_0xd7ad('0x72')];_0x3f655a['message'][_0xd7ad('0x74')]='accept';return respondWithRpcPromise(_0xd7ad('0x75'),_0xd7ad('0x75'),{'event':_0xd7ad('0x76'),'message':_0x3f655a[_0xd7ad('0x24')]},client9002)[_0xd7ad('0x35')](function(){return _0x3f655a;});}return _0x3f655a;}return null;})['then'](respondWithResult(_0x463f4b,null))[_0xd7ad('0x26')](handleError(_0x463f4b,null));};var interaction_log=require(_0xd7ad('0x77'))(_0xd7ad('0x78'));exports[_0xd7ad('0x32')]=function(_0xbd2a1d,_0x43271f,_0x49cb48){var _0x44e30b={'agent':{},'channel':'sms'};if(_0xbd2a1d[_0xd7ad('0x57')]['id']){delete _0xbd2a1d['body']['id'];}_0xbd2a1d[_0xd7ad('0x57')][_0xd7ad('0x5d')]=_0xbd2a1d[_0xd7ad('0x57')][_0xd7ad('0x5d')]||_0xbd2a1d['user']['id'];_0x44e30b['agent']['id']=_0xbd2a1d['body'][_0xd7ad('0x5d')];return db[_0xd7ad('0x3a')][_0xd7ad('0x55')]({'where':{'id':_0xbd2a1d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x43271f,null))[_0xd7ad('0x35')](function(_0x2565dd){if(_0x2565dd){_0x44e30b[_0xd7ad('0x24')]=_0x2565dd[_0xd7ad('0x5f')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2565dd[_0xd7ad('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x43271f,null))['then'](function(_0x119c62){if(_0x119c62){_0x44e30b[_0xd7ad('0x64')]=_0x119c62['get']({'plain':!![]});interaction_log[_0xd7ad('0x1c')](_0xd7ad('0x79'),_0xbd2a1d[_0xd7ad('0x66')]['id'],_0xbd2a1d[_0xd7ad('0x66')][_0xd7ad('0x38')],_0xbd2a1d[_0xd7ad('0x66')]['role'],_0x44e30b[_0xd7ad('0x64')]['id'],_0xbd2a1d[_0xd7ad('0x57')]?JSON[_0xd7ad('0x21')](_0xbd2a1d[_0xd7ad('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0xd7ad('0x7a'),_0x44e30b);}return null;})['then'](function(_0xc00f48){var _0x3998f8=_0xd7ad('0x7b')+_0xc00f48[_0xd7ad('0x24')][_0xd7ad('0x6a')];return db[_0xd7ad('0x7c')]['query'](_0x3998f8,{'type':db[_0xd7ad('0x6b')][_0xd7ad('0x6c')][_0xd7ad('0x6d')],'raw':!![]})['then'](function(_0x32c196){return _0x32c196;});})[_0xd7ad('0x35')](function(_0x36f9ce){if(_0x36f9ce){_0x44e30b[_0xd7ad('0x24')]['contact']=_0x36f9ce[0x0];if(!_0xbd2a1d[_0xd7ad('0x57')][_0xd7ad('0x5d')])return;return db[_0xd7ad('0x7d')][_0xd7ad('0x55')]({'where':{'id':_0xbd2a1d[_0xd7ad('0x57')]['UserId'],'role':_0xd7ad('0x5e')},'attributes':['id',_0xd7ad('0x38'),_0xd7ad('0x7e'),_0xd7ad('0x7f'),_0xd7ad('0x6f')],'raw':!![]});}return null;})[_0xd7ad('0x35')](function(_0x2e7aff){if(!_0x2e7aff)return null;_0x44e30b[_0xd7ad('0x24')][_0xd7ad('0x5e')]=_0x2e7aff;return _0x44e30b;})[_0xd7ad('0x35')](function(_0x6ee6a){if(_0x6ee6a){_0x6ee6a['message'][_0xd7ad('0x80')]=util[_0xd7ad('0x5b')]('SIP/%s',_0xbd2a1d[_0xd7ad('0x66')]['name']);_0x6ee6a[_0xd7ad('0x24')]['channel']=_0x44e30b[_0xd7ad('0x72')];_0x6ee6a['message'][_0xd7ad('0x73')]=_0x44e30b[_0xd7ad('0x72')];_0x6ee6a[_0xd7ad('0x24')][_0xd7ad('0x74')]='reject';respondWithRpcPromise(_0xd7ad('0x75'),_0xd7ad('0x75'),{'event':_0xd7ad('0x81'),'message':_0x6ee6a[_0xd7ad('0x24')]},client9002);return _0x44e30b;}return null;})[_0xd7ad('0x35')](respondWithResult(_0x43271f,null))['catch'](handleError(_0x43271f,null));};exports['status']=function(_0xa6cd4c,_0x158d06,_0x19c5f8){if(_0xa6cd4c[_0xd7ad('0x57')]['id']){delete _0xa6cd4c['body']['id'];}var _0x562847;return db[_0xd7ad('0x3a')]['find']({'where':{'id':_0xa6cd4c[_0xd7ad('0x53')]['id']}})[_0xd7ad('0x35')](handleEntityNotFound(_0x158d06,null))[_0xd7ad('0x35')](function(_0x479ea1){if(_0x479ea1){_0x562847=_0x479ea1;return db[_0xd7ad('0x82')][_0xd7ad('0x55')]({'where':{'id':_0x479ea1['SmsAccountId']}});}})[_0xd7ad('0x35')](handleEntityNotFound(_0x158d06,null))[_0xd7ad('0x35')](function(_0x55db32){if(_0x55db32){logger[_0xd7ad('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xd7ad('0x83'),_0x55db32[_0xd7ad('0x3c')],util[_0xd7ad('0x84')](_0xa6cd4c[_0xd7ad('0x57')],{'showHidden':![],'depth':null}));switch(_0x55db32[_0xd7ad('0x3c')]){case _0xd7ad('0x85'):if(_0xa6cd4c[_0xd7ad('0x57')][_0xd7ad('0x86')]&&_0xa6cd4c[_0xd7ad('0x57')]['MessageSid']===_0x562847[_0xd7ad('0x87')]){return _0x562847[_0xd7ad('0x34')]({'read':!![]});}else{logger[_0xd7ad('0x23')](_0xd7ad('0x88'),_0xd7ad('0x28'),'twilio',util[_0xd7ad('0x84')](_0xa6cd4c['body'],{'showHidden':![],'depth':null}));}break;case _0xd7ad('0x89'):if(_0xa6cd4c['body'][_0xd7ad('0x8a')]&&_0xa6cd4c[_0xd7ad('0x57')]['MessageUUID']===_0x562847[_0xd7ad('0x87')]&&_[_0xd7ad('0x8b')](['sent','delivered'],_0xa6cd4c[_0xd7ad('0x57')][_0xd7ad('0x8c')])>=0x0){return _0x562847[_0xd7ad('0x34')]({'read':!![]});}else{logger[_0xd7ad('0x23')](_0xd7ad('0x88'),_0xd7ad('0x28'),_0xd7ad('0x8d'),util[_0xd7ad('0x84')](_0xa6cd4c[_0xd7ad('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd7ad('0x8e'):var _0x25cf92=_0xa6cd4c['body'][_0xd7ad('0x8f')][0x0];if(_0x25cf92[_0xd7ad('0x28')][_0xd7ad('0x90')]==='DELIVERED'){return _0x562847[_0xd7ad('0x34')]({'read':!![]});}else{logger[_0xd7ad('0x23')](_0xd7ad('0x88'),_0xd7ad('0x28'),_0xd7ad('0x8e'),util['inspect'](_0xa6cd4c[_0xd7ad('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x562847;}})[_0xd7ad('0x35')](respondWithResult(_0x158d06,null))[_0xd7ad('0x26')](handleError(_0x158d06,null));}; \ No newline at end of file +var _0xe34f=['[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','QueryTypes','SELECT','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','show','params','length','create','body','update','describe','../../config/logger','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe34f,0xbc));var _0xfe34=function(_0x14009b,_0x390d65){_0x14009b=_0x14009b-0x0;var _0x13fcd2=_0xe34f[_0x14009b];return _0x13fcd2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfe34('0x0'));var moment=require(_0xfe34('0x1'));var BPromise=require(_0xfe34('0x2'));var Mustache=require(_0xfe34('0x3'));var util=require(_0xfe34('0x4'));var path=require(_0xfe34('0x5'));var sox=require(_0xfe34('0x6'));var csv=require('to-csv');var ejs=require(_0xfe34('0x7'));var fs=require('fs');var fs_extra=require(_0xfe34('0x8'));var _=require(_0xfe34('0x9'));var squel=require(_0xfe34('0xa'));var crypto=require(_0xfe34('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe34('0xc'));var querystring=require(_0xfe34('0xd'));var Papa=require(_0xfe34('0xe'));var Redis=require(_0xfe34('0xf'));var authService=require(_0xfe34('0x10'));var qs=require(_0xfe34('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfe34('0x12'));var config=require(_0xfe34('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe34('0x14'))['db'];config[_0xfe34('0x15')]=_[_0xfe34('0x16')](config[_0xfe34('0x15')],{'host':_0xfe34('0x17'),'port':0x18eb});var socket=require(_0xfe34('0x18'))(new Redis(config['redis']));require(_0xfe34('0x19'))[_0xfe34('0x1a')](socket);var jayson=require(_0xfe34('0x1b'));var client=jayson[_0xfe34('0x1c')][_0xfe34('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xfe34('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3acbda,_0x2cdaa5,_0x40927b,_0x53099b){return new BPromise(function(_0x53b469,_0x543d77){var _0x2ce838=_0x53099b||client;return _0x2ce838['request'](_0x3acbda,_0x40927b)['then'](function(_0x495b48){logger[_0xfe34('0x1e')](_0xfe34('0x1f'),_0x2cdaa5,_0xfe34('0x20'));logger[_0xfe34('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2cdaa5,_0xfe34('0x20'),JSON[_0xfe34('0x22')](_0x495b48));if(_0x495b48[_0xfe34('0x23')]){if(_0x495b48[_0xfe34('0x23')][_0xfe34('0x24')]===0x1f4){logger[_0xfe34('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2cdaa5,_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);return _0x543d77(_0x495b48[_0xfe34('0x23')]['message']);}logger[_0xfe34('0x23')](_0xfe34('0x1f'),_0x2cdaa5,_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);return _0x53b469(_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);}else{logger[_0xfe34('0x1e')](_0xfe34('0x1f'),_0x2cdaa5,_0xfe34('0x20'));_0x53b469(_0x495b48[_0xfe34('0x26')]['message']);}})[_0xfe34('0x27')](function(_0x257c3c){logger['error'](_0xfe34('0x1f'),_0x2cdaa5,_0x257c3c);_0x543d77(_0x257c3c);});});}function respondWithStatusCode(_0x524b55,_0x5a0db6){_0x5a0db6=_0x5a0db6||0xcc;return function(_0xdec4c7){if(_0xdec4c7){return _0x524b55['sendStatus'](_0x5a0db6);}return _0x524b55['status'](_0x5a0db6)[_0xfe34('0x28')]();};}function respondWithResult(_0x27c895,_0x48a886){_0x48a886=_0x48a886||0xc8;return function(_0x372886){if(_0x372886){return _0x27c895[_0xfe34('0x29')](_0x48a886)[_0xfe34('0x2a')](_0x372886);}};}function respondWithFilteredResult(_0x3ab3e5,_0x58eba7){return function(_0x4d153b){if(_0x4d153b){var _0x59e06b=typeof _0x58eba7[_0xfe34('0x2b')]===_0xfe34('0x2c')&&typeof _0x58eba7[_0xfe34('0x2d')]===_0xfe34('0x2c');var _0x550e44=_0x4d153b[_0xfe34('0x2e')];var _0x44adf0=_0x59e06b?0x0:_0x58eba7['offset'];var _0x345c00=_0x59e06b?_0x4d153b[_0xfe34('0x2e')]:_0x58eba7[_0xfe34('0x2b')]+_0x58eba7['limit'];var _0x435670;if(_0x345c00>=_0x550e44){_0x345c00=_0x550e44;_0x435670=0xc8;}else{_0x435670=0xce;}_0x3ab3e5[_0xfe34('0x29')](_0x435670);return _0x3ab3e5[_0xfe34('0x2f')](_0xfe34('0x30'),_0x44adf0+'-'+_0x345c00+'/'+_0x550e44)['json'](_0x4d153b);}return null;};}function patchUpdates(_0x3694ab){return function(_0xd2f3df){try{jsonpatch['apply'](_0xd2f3df,_0x3694ab,!![]);}catch(_0x187cf0){return BPromise[_0xfe34('0x31')](_0x187cf0);}return _0xd2f3df[_0xfe34('0x32')]();};}function saveUpdates(_0x1f09e4,_0x38ffc6){return function(_0x54bc7a){if(_0x54bc7a){return _0x54bc7a['update'](_0x1f09e4)[_0xfe34('0x33')](function(_0x486339){return _0x486339;});}return null;};}function removeEntity(_0x2b3e1e,_0x3ae5aa){return function(_0x1a3b9c){if(_0x1a3b9c){return _0x1a3b9c[_0xfe34('0x34')]()[_0xfe34('0x33')](function(){_0x2b3e1e[_0xfe34('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5039,_0x275a81){return function(_0xa7d1d4){if(!_0xa7d1d4){_0x2f5039[_0xfe34('0x35')](0x194);}return _0xa7d1d4;};}function handleError(_0x147870,_0x28ee1b){_0x28ee1b=_0x28ee1b||0x1f4;return function(_0x34b812){logger[_0xfe34('0x23')](_0x34b812[_0xfe34('0x36')]);if(_0x34b812[_0xfe34('0x37')]){delete _0x34b812[_0xfe34('0x37')];}_0x147870[_0xfe34('0x29')](_0x28ee1b)[_0xfe34('0x38')](_0x34b812);};}exports[_0xfe34('0x39')]=function(_0x1589f9,_0x46c857){var _0x16d7ea={},_0x1f463a={},_0xefb472={'count':0x0,'rows':[]};var _0x4c1c71=_[_0xfe34('0x3a')](db['SmsMessage'][_0xfe34('0x3b')],function(_0x5900a3){return{'name':_0x5900a3[_0xfe34('0x3c')],'type':_0x5900a3[_0xfe34('0x3d')][_0xfe34('0x3e')]};});_0x1f463a[_0xfe34('0x3f')]=_['map'](_0x4c1c71,'name');_0x1f463a['query']=_[_0xfe34('0x40')](_0x1589f9['query']);_0x1f463a[_0xfe34('0x41')]=_[_0xfe34('0x42')](_0x1f463a[_0xfe34('0x3f')],_0x1f463a[_0xfe34('0x43')]);_0x16d7ea[_0xfe34('0x44')]=_[_0xfe34('0x42')](_0x1f463a[_0xfe34('0x3f')],qs[_0xfe34('0x45')](_0x1589f9[_0xfe34('0x43')][_0xfe34('0x45')]));_0x16d7ea[_0xfe34('0x44')]=_0x16d7ea[_0xfe34('0x44')]['length']?_0x16d7ea[_0xfe34('0x44')]:_0x1f463a[_0xfe34('0x3f')];if(!_0x1589f9[_0xfe34('0x43')][_0xfe34('0x46')]('nolimit')){_0x16d7ea[_0xfe34('0x2d')]=qs[_0xfe34('0x2d')](_0x1589f9['query'][_0xfe34('0x2d')]);_0x16d7ea['offset']=qs[_0xfe34('0x2b')](_0x1589f9['query'][_0xfe34('0x2b')]);}_0x16d7ea['order']=qs[_0xfe34('0x47')](_0x1589f9[_0xfe34('0x43')][_0xfe34('0x47')]);_0x16d7ea[_0xfe34('0x48')]=qs[_0xfe34('0x41')](_[_0xfe34('0x49')](_0x1589f9[_0xfe34('0x43')],_0x1f463a['filters']),_0x4c1c71);if(_0x1589f9[_0xfe34('0x43')][_0xfe34('0x4a')]){_0x16d7ea['where']=_[_0xfe34('0x4b')](_0x16d7ea['where'],{'$or':_[_0xfe34('0x3a')](_0x4c1c71,function(_0x7762c7){if(_0x7762c7[_0xfe34('0x3d')]!==_0xfe34('0x4c')){var _0x455563={};_0x455563[_0x7762c7[_0xfe34('0x37')]]={'$like':'%'+_0x1589f9[_0xfe34('0x43')][_0xfe34('0x4a')]+'%'};return _0x455563;}})});}_0x16d7ea=_[_0xfe34('0x4b')]({},_0x16d7ea,_0x1589f9[_0xfe34('0x4d')]);var _0x345985={'where':_0x16d7ea[_0xfe34('0x48')]};return db[_0xfe34('0x4e')][_0xfe34('0x2e')](_0x345985)[_0xfe34('0x33')](function(_0x4dc971){_0xefb472[_0xfe34('0x2e')]=_0x4dc971;if(_0x1589f9['query'][_0xfe34('0x4f')]){_0x16d7ea[_0xfe34('0x50')]=[{'all':!![]}];}return db[_0xfe34('0x4e')]['findAll'](_0x16d7ea);})['then'](function(_0x4707d4){_0xefb472['rows']=_0x4707d4;return _0xefb472;})['then'](respondWithFilteredResult(_0x46c857,_0x16d7ea))[_0xfe34('0x27')](handleError(_0x46c857,null));};exports[_0xfe34('0x51')]=function(_0x1ed876,_0x408390){var _0x510db3={'raw':!![],'where':{'id':_0x1ed876[_0xfe34('0x52')]['id']}},_0x232622={};_0x232622[_0xfe34('0x3f')]=_[_0xfe34('0x40')](db[_0xfe34('0x4e')][_0xfe34('0x3b')]);_0x232622[_0xfe34('0x43')]=_[_0xfe34('0x40')](_0x1ed876['query']);_0x232622[_0xfe34('0x41')]=_[_0xfe34('0x42')](_0x232622[_0xfe34('0x3f')],_0x232622[_0xfe34('0x43')]);_0x510db3['attributes']=_[_0xfe34('0x42')](_0x232622[_0xfe34('0x3f')],qs[_0xfe34('0x45')](_0x1ed876['query']['fields']));_0x510db3['attributes']=_0x510db3[_0xfe34('0x44')][_0xfe34('0x53')]?_0x510db3['attributes']:_0x232622[_0xfe34('0x3f')];if(_0x1ed876['query'][_0xfe34('0x4f')]){_0x510db3[_0xfe34('0x50')]=[{'all':!![]}];}_0x510db3=_[_0xfe34('0x4b')]({},_0x510db3,_0x1ed876[_0xfe34('0x4d')]);return db[_0xfe34('0x4e')]['find'](_0x510db3)[_0xfe34('0x33')](handleEntityNotFound(_0x408390,null))[_0xfe34('0x33')](respondWithResult(_0x408390,null))[_0xfe34('0x27')](handleError(_0x408390,null));};exports[_0xfe34('0x54')]=function(_0x5f3232,_0x56a6dc){return db[_0xfe34('0x4e')][_0xfe34('0x54')](_0x5f3232[_0xfe34('0x55')],{})[_0xfe34('0x33')](respondWithResult(_0x56a6dc,0xc9))['catch'](handleError(_0x56a6dc,null));};exports[_0xfe34('0x56')]=function(_0x450ebe,_0x1ef0eb){if(_0x450ebe[_0xfe34('0x55')]['id']){delete _0x450ebe['body']['id'];}return db[_0xfe34('0x4e')]['find']({'where':{'id':_0x450ebe[_0xfe34('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ef0eb,null))[_0xfe34('0x33')](saveUpdates(_0x450ebe[_0xfe34('0x55')],null))[_0xfe34('0x33')](respondWithResult(_0x1ef0eb,null))[_0xfe34('0x27')](handleError(_0x1ef0eb,null));};exports[_0xfe34('0x34')]=function(_0x249e9a,_0x1cc5bb){return db[_0xfe34('0x4e')]['find']({'where':{'id':_0x249e9a[_0xfe34('0x52')]['id']}})[_0xfe34('0x33')](handleEntityNotFound(_0x1cc5bb,null))[_0xfe34('0x33')](removeEntity(_0x1cc5bb,null))['catch'](handleError(_0x1cc5bb,null));};exports[_0xfe34('0x57')]=function(_0x12e354,_0x4daf0f){return db[_0xfe34('0x4e')]['describe']()['then'](respondWithResult(_0x4daf0f,null))[_0xfe34('0x27')](handleError(_0x4daf0f,null));};var interaction_log=require(_0xfe34('0x58'))(_0xfe34('0x59'));exports[_0xfe34('0x5a')]=function(_0x4042d6,_0x26fe36,_0x3f56b3){var _0x3bc3e8={'agent':{},'channel':_0xfe34('0x5b')};if(_0x4042d6['body']['id']){delete _0x4042d6[_0xfe34('0x55')]['id'];}_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5c')]=!![];_0x4042d6[_0xfe34('0x55')]['readAt']=moment()[_0xfe34('0x5d')](_0xfe34('0x5e'));_0x4042d6['body'][_0xfe34('0x5f')]=_0x4042d6[_0xfe34('0x55')]['UserId']||_0x4042d6[_0xfe34('0x60')]['id'];_0x3bc3e8['agent']['id']=_0x4042d6['body']['UserId'];return db[_0xfe34('0x4e')][_0xfe34('0x61')]({'where':{'id':_0x4042d6[_0xfe34('0x52')]['id'],'UserId':null}})[_0xfe34('0x33')](handleEntityNotFound(_0x26fe36,null))[_0xfe34('0x33')](saveUpdates(_0x4042d6['body'],null))[_0xfe34('0x33')](function(_0x50c798){if(_0x50c798){_0x3bc3e8[_0xfe34('0x25')]=_0x50c798[_0xfe34('0x62')]({'plain':!![]});return db[_0xfe34('0x63')][_0xfe34('0x61')]({'where':{'id':_0x50c798[_0xfe34('0x64')]}});}return null;})[_0xfe34('0x33')](handleEntityNotFound(_0x26fe36,null))[_0xfe34('0x33')](function(_0x428c85){if(_0x428c85){return _0x428c85['update']({'UserId':_0x4042d6['body'][_0xfe34('0x5f')],'read1stAt':_[_0xfe34('0x65')](_0x428c85[_0xfe34('0x66')])?moment()[_0xfe34('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfe34('0x33')](function(_0x2b05dd){if(_0x2b05dd){_0x3bc3e8[_0xfe34('0x67')]=_0x2b05dd[_0xfe34('0x62')]({'plain':!![]});interaction_log[_0xfe34('0x1e')](_0xfe34('0x68'),_0x4042d6[_0xfe34('0x60')]['id'],_0x4042d6[_0xfe34('0x60')]['name'],_0x4042d6[_0xfe34('0x60')]['role'],_0x3bc3e8[_0xfe34('0x67')]['id'],_0x4042d6[_0xfe34('0x55')]?JSON['stringify'](_0x4042d6[_0xfe34('0x55')]):'null');return respondWithRpcPromise(_0xfe34('0x69'),_0xfe34('0x6a'),_0x3bc3e8);}return null;})[_0xfe34('0x33')](function(_0xd55b0a){var _0x2a7724=_0xfe34('0x6b')+_0xd55b0a[_0xfe34('0x25')]['ContactId'];return db[_0xfe34('0x6c')]['query'](_0x2a7724,{'type':db[_0xfe34('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xfe34('0x33')](function(_0x33ee25){return _0x33ee25;});})[_0xfe34('0x33')](function(_0x10385f){if(_0x10385f){_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x6e')]=_0x10385f[0x0];if(!_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5f')])return;return db[_0xfe34('0x6f')][_0xfe34('0x61')]({'where':{'id':_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5f')],'role':_0xfe34('0x70')},'attributes':['id','name',_0xfe34('0x71'),_0xfe34('0x72'),_0xfe34('0x73')],'raw':!![]});}return null;})[_0xfe34('0x33')](function(_0x7b7a1){if(!_0x7b7a1)return null;_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x70')]=_0x7b7a1;return _0x3bc3e8;})[_0xfe34('0x33')](function(_0x543228){if(_0x543228){if(_0x4042d6[_0xfe34('0x55')][_0xfe34('0x74')]){_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x75')]=util[_0xfe34('0x5d')](_0xfe34('0x76'),_0x4042d6['user'][_0xfe34('0x37')]);_0x3bc3e8[_0xfe34('0x25')]['channel']=_0x3bc3e8[_0xfe34('0x77')];_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x78')]=_0x3bc3e8[_0xfe34('0x77')];_0x3bc3e8['message'][_0xfe34('0x79')]=_0xfe34('0x5a');return respondWithRpcPromise(_0xfe34('0x7a'),_0xfe34('0x7a'),{'event':'acceptmessage','message':_0x3bc3e8['message']},client9002)[_0xfe34('0x33')](function(){return _0x3bc3e8;});}return _0x3bc3e8;}return null;})[_0xfe34('0x33')](respondWithResult(_0x26fe36,null))[_0xfe34('0x27')](handleError(_0x26fe36,null));};var interaction_log=require('../../config/logger')(_0xfe34('0x59'));exports[_0xfe34('0x31')]=function(_0x5b51a6,_0x5d5f83,_0x3c9acc){var _0x31d35e={'agent':{},'channel':_0xfe34('0x5b')};if(_0x5b51a6[_0xfe34('0x55')]['id']){delete _0x5b51a6[_0xfe34('0x55')]['id'];}_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')]=_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')]||_0x5b51a6['user']['id'];_0x31d35e[_0xfe34('0x70')]['id']=_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')];return db[_0xfe34('0x4e')][_0xfe34('0x61')]({'where':{'id':_0x5b51a6['params']['id'],'UserId':null}})[_0xfe34('0x33')](handleEntityNotFound(_0x5d5f83,null))[_0xfe34('0x33')](function(_0x2edaf3){if(_0x2edaf3){_0x31d35e[_0xfe34('0x25')]=_0x2edaf3[_0xfe34('0x62')]({'plain':!![]});return db['SmsInteraction'][_0xfe34('0x61')]({'where':{'id':_0x2edaf3[_0xfe34('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x5d5f83,null))['then'](function(_0x33cf98){if(_0x33cf98){_0x31d35e[_0xfe34('0x67')]=_0x33cf98[_0xfe34('0x62')]({'plain':!![]});interaction_log[_0xfe34('0x1e')](_0xfe34('0x7b'),_0x5b51a6[_0xfe34('0x60')]['id'],_0x5b51a6['user']['name'],_0x5b51a6[_0xfe34('0x60')][_0xfe34('0x7c')],_0x31d35e[_0xfe34('0x67')]['id'],_0x5b51a6[_0xfe34('0x55')]?JSON[_0xfe34('0x22')](_0x5b51a6['body']):_0xfe34('0x7d'));return respondWithRpcPromise(_0xfe34('0x7e'),_0xfe34('0x7f'),_0x31d35e);}return null;})['then'](function(_0x176539){var _0x1ff46f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x176539[_0xfe34('0x25')][_0xfe34('0x80')];return db[_0xfe34('0x6c')]['query'](_0x1ff46f,{'type':db[_0xfe34('0x6d')][_0xfe34('0x81')][_0xfe34('0x82')],'raw':!![]})['then'](function(_0x55a509){return _0x55a509;});})['then'](function(_0x48e922){if(_0x48e922){_0x31d35e[_0xfe34('0x25')]['contact']=_0x48e922[0x0];if(!_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')])return;return db[_0xfe34('0x6f')]['find']({'where':{'id':_0x5b51a6['body'][_0xfe34('0x5f')],'role':_0xfe34('0x70')},'attributes':['id',_0xfe34('0x37'),_0xfe34('0x71'),_0xfe34('0x72'),_0xfe34('0x73')],'raw':!![]});}return null;})[_0xfe34('0x33')](function(_0x2188a1){if(!_0x2188a1)return null;_0x31d35e['message'][_0xfe34('0x70')]=_0x2188a1;return _0x31d35e;})[_0xfe34('0x33')](function(_0xc857da){if(_0xc857da){_0xc857da[_0xfe34('0x25')][_0xfe34('0x75')]=util[_0xfe34('0x5d')](_0xfe34('0x76'),_0x5b51a6[_0xfe34('0x60')][_0xfe34('0x37')]);_0xc857da[_0xfe34('0x25')]['channel']=_0x31d35e['channel'];_0xc857da[_0xfe34('0x25')][_0xfe34('0x78')]=_0x31d35e['channel'];_0xc857da[_0xfe34('0x25')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xfe34('0x83'),'message':_0xc857da['message']},client9002);return _0x31d35e;}return null;})[_0xfe34('0x33')](respondWithResult(_0x5d5f83,null))[_0xfe34('0x27')](handleError(_0x5d5f83,null));};exports[_0xfe34('0x29')]=function(_0x36f3d8,_0x31cd81,_0x1fd630){if(_0x36f3d8[_0xfe34('0x55')]['id']){delete _0x36f3d8['body']['id'];}var _0x39dc30;return db['SmsMessage']['find']({'where':{'id':_0x36f3d8[_0xfe34('0x52')]['id']}})[_0xfe34('0x33')](handleEntityNotFound(_0x31cd81,null))[_0xfe34('0x33')](function(_0x1ea241){if(_0x1ea241){_0x39dc30=_0x1ea241;return db['SmsAccount'][_0xfe34('0x61')]({'where':{'id':_0x1ea241[_0xfe34('0x84')]}});}})[_0xfe34('0x33')](handleEntityNotFound(_0x31cd81,null))['then'](function(_0x46980f){if(_0x46980f){logger[_0xfe34('0x21')](_0xfe34('0x85'),_0xfe34('0x29'),'received\x20delivery\x20report\x20from',_0x46980f[_0xfe34('0x3d')],util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));switch(_0x46980f[_0xfe34('0x3d')]){case _0xfe34('0x87'):if(_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x88')]&&_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x88')]===_0x39dc30['messageId']){return _0x39dc30[_0xfe34('0x56')]({'read':!![]});}else{logger[_0xfe34('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe34('0x29'),'twilio',util['inspect'](_0x36f3d8['body'],{'showHidden':![],'depth':null}));}break;case _0xfe34('0x89'):if(_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x8a')]&&_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x8a')]===_0x39dc30[_0xfe34('0x8b')]&&_['indexOf'](['sent',_0xfe34('0x8c')],_0x36f3d8['body'][_0xfe34('0x8d')])>=0x0){return _0x39dc30[_0xfe34('0x56')]({'read':!![]});}else{logger[_0xfe34('0x23')](_0xfe34('0x8e'),_0xfe34('0x29'),_0xfe34('0x8f'),util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3556a0=_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x90')][0x0];if(_0x3556a0['status'][_0xfe34('0x91')]==='DELIVERED'){return _0x39dc30['update']({'read':!![]});}else{logger[_0xfe34('0x23')](_0xfe34('0x8e'),_0xfe34('0x29'),'infobip',util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x39dc30;}})['then'](respondWithResult(_0x31cd81,null))[_0xfe34('0x27')](handleError(_0x31cd81,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c60fbdc..dfec4bb 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 _0x932d=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x23353d,_0x2e6d2a){var _0x24e1d7=function(_0x1186c7){while(--_0x1186c7){_0x23353d['push'](_0x23353d['shift']());}};_0x24e1d7(++_0x2e6d2a);}(_0x932d,0xab));var _0xd932=function(_0x2a9340,_0x4fb2da){_0x2a9340=_0x2a9340-0x0;var _0x3cdf4c=_0x932d[_0x2a9340];return _0x3cdf4c;};'use strict';var EventEmitter=require(_0xd932('0x0'));var SmsMessage=require(_0xd932('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd932('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd932('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37a834){return function(_0xfc4dad,_0x8b08be,_0x4a586a){SmsMessageEvents[_0xd932('0x4')](_0x37a834+':'+_0xfc4dad['id'],_0xfc4dad);SmsMessageEvents[_0xd932('0x4')](_0x37a834,_0xfc4dad);_0x4a586a(null);};}for(var e in events){if(events[_0xd932('0x5')](e)){var event=events[e];SmsMessage[_0xd932('0x6')](e,emitEvent(event));}}module[_0xd932('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x8f45=['save','update','remove','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0xfc6c19,_0x5c87e5){var _0xc20bea=function(_0x834cd5){while(--_0x834cd5){_0xfc6c19['push'](_0xfc6c19['shift']());}};_0xc20bea(++_0x5c87e5);}(_0x8f45,0x114));var _0x58f4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8f45[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require(_0x58f4('0x0'));var SmsMessage=require(_0x58f4('0x1'))['db'][_0x58f4('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x58f4('0x3')](0x0);var events={'afterCreate':_0x58f4('0x4'),'afterUpdate':_0x58f4('0x5'),'afterDestroy':_0x58f4('0x6')};function emitEvent(_0x2d868a){return function(_0x178ea7,_0x2f463d,_0x417f5d){SmsMessageEvents[_0x58f4('0x7')](_0x2d868a+':'+_0x178ea7['id'],_0x178ea7);SmsMessageEvents[_0x58f4('0x7')](_0x2d868a,_0x178ea7);_0x417f5d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x58f4('0x8')](e,emitEvent(event));}}module[_0x58f4('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 b01d7bf..b2b80d5 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 _0x108d=['message','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','sms_messages','messageId','body','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','error','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/status?token=','token','sid','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','session_key','total_sent','internal_order_id','read','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','login','text','timestamp','keys','createHash','md5','digest','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr'];(function(_0x302f55,_0x31872f){var _0x55ca94=function(_0x477ac3){while(--_0x477ac3){_0x302f55['push'](_0x302f55['shift']());}};_0x55ca94(++_0x31872f);}(_0x108d,0x7b));var _0xd108=function(_0x2c847c,_0x1087b7){_0x2c847c=_0x2c847c-0x0;var _0x4483bb=_0x108d[_0x2c847c];return _0x4483bb;};'use strict';var _=require('lodash');var util=require(_0xd108('0x0'));var logger=require(_0xd108('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd108('0x2'));var rp=require(_0xd108('0x3'));var fs=require('fs');var path=require(_0xd108('0x4'));var rimraf=require(_0xd108('0x5'));var config=require(_0xd108('0x6'));var attributes=require(_0xd108('0x7'));module[_0xd108('0x8')]=function(_0x4f2431,_0x13afd0){return _0x4f2431['define']('SmsMessage',attributes,{'tableName':_0xd108('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd108('0xa')]},{'name':'fti_sms_messages','fields':[_0xd108('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28a12d,_0x23299e,_0x17ff51){var _0x216d1e=_0x4f2431['models'];var _0x4b3dc2=_0x28a12d[_0xd108('0xc')]({'plain':!![]});if(_0x4b3dc2[_0xd108('0xd')][_0xd108('0xe')]()==='in'||_0x4b3dc2[_0xd108('0xd')]['toLowerCase']()===_0xd108('0xf')&&!_0x4b3dc2[_0xd108('0x10')]&&!_[_0xd108('0x11')](_0x4b3dc2[_0xd108('0x12')])&&!_[_0xd108('0x11')](_0x4b3dc2[_0xd108('0x13')])){_0x216d1e['SmsInteraction'][_0xd108('0x14')]({'where':{'id':_0x4b3dc2['SmsInteractionId']}})[_0xd108('0x15')](function(_0x4fde24){if(_0x4fde24){_0x4fde24[_0xd108('0x16')]({'lastMsgAt':_0x4b3dc2[_0xd108('0x17')],'lastMsgDirection':_0x4b3dc2['direction'][_0xd108('0xe')]()});}})['catch'](function(_0x4aec0d){console[_0xd108('0x18')](_0x4aec0d);});}if(_0x4b3dc2['direction']===_0xd108('0xf')&&!_0x4b3dc2[_0xd108('0x10')]){var _0xcdb26d;_0x216d1e['SmsAccount']['find']({'where':{'id':_0x4b3dc2[_0xd108('0x19')]},'raw':!![]})[_0xd108('0x15')](function(_0xc9b229){_0xcdb26d=_0xc9b229;if(_0xcdb26d&&_0xcdb26d['type']){switch(_0xcdb26d[_0xd108('0x1a')]){case _0xd108('0x1b'):var _0x284d37=require(_0xd108('0x1b'));if(_0xcdb26d[_0xd108('0x1c')]&&_0xcdb26d[_0xd108('0x1d')]&&_0xcdb26d[_0xd108('0x1e')]){var _0x286b60=new _0x284d37(_0xcdb26d['accountSid'],_0xcdb26d[_0xd108('0x1d')]);_0x286b60[_0xd108('0x1f')]['create']({'body':_0x4b3dc2[_0xd108('0xb')],'to':_0x4b3dc2[_0xd108('0x1e')],'from':_0xcdb26d[_0xd108('0x1e')],'statusCallback':_0xcdb26d[_0xd108('0x20')]+'/api/sms/messages/'+_0x4b3dc2['id']+_0xd108('0x21')+_0xcdb26d[_0xd108('0x22')]})['then'](function(_0x3f98dc){if(_0x3f98dc[_0xd108('0x23')]){return _0x28a12d[_0xd108('0x16')]({'messageId':_0x3f98dc[_0xd108('0x23')]});}})[_0xd108('0x24')](function(_0x1957bb){logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x1b'),util[_0xd108('0x26')](_0x1957bb,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x1b'),_0xd108('0x28'));}break;case'skebby':var _0x208b8f=_0xd108('0x29');if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d[_0xd108('0x2b')]){var _0x4752dd={'recipient':[_0x4b3dc2[_0xd108('0x1e')]],'message':_0x4b3dc2[_0xd108('0xb')],'message_type':_0xcdb26d[_0xd108('0x2c')]};if(_0xcdb26d['smsMethod']&&_0xcdb26d['smsMethod']!=='SI'){_0x4752dd[_0xd108('0x2d')]=_0xcdb26d[_0xd108('0x1e')];}var _0x522ac1={'url':_0x208b8f+_0xd108('0x2e')+_0xcdb26d[_0xd108('0x2a')]+'&password='+_0xcdb26d[_0xd108('0x2b')],'method':_0xd108('0x2f')};rp(_0x522ac1)[_0xd108('0x15')](function(_0x5bef30){var _0x1bb08f=_0x5bef30[_0xd108('0x30')](';');var _0x18e490={'user_key':_0x1bb08f[0x0],'session_key':_0x1bb08f[0x1]};_0x522ac1={'url':_0x208b8f+_0xd108('0x31'),'method':_0xd108('0x32'),'headers':{'user_key':_0x18e490['user_key'],'Session_key':_0x18e490[_0xd108('0x33')]},'json':!![],'body':_0x4752dd};return rp(_0x522ac1);})[_0xd108('0x15')](function(_0x1f1246){if(_0x1f1246[_0xd108('0x34')]>=0x1){var _0x2e0306={'messageId':_0x1f1246[_0xd108('0x35')]};if(_0xcdb26d['smsMethod']!=='GP'||!_0xcdb26d['deliveryReport']){_0x2e0306[_0xd108('0x36')]=!![];}return _0x28a12d[_0xd108('0x16')](_0x2e0306);}else{return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x37'),util[_0xd108('0x26')](_0x1f1246,{'showHidden':![],'depth':null}));}})['catch'](function(_0x519ccb){return logger[_0xd108('0x18')](_0xd108('0x27'),'afterCreate',_0xd108('0x37'),util[_0xd108('0x26')](_0x519ccb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd108('0x27'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xd108('0x38'):if(_0xcdb26d[_0xd108('0x1d')]){var _0x315382={'recipient':_0x4b3dc2[_0xd108('0x1e')],'message':_0x4b3dc2[_0xd108('0xb')],'sender':_0xcdb26d[_0xd108('0x39')]||_0xcdb26d['phone'],'authorization':_0xcdb26d[_0xd108('0x1d')]};var _0x23299e={'method':_0xd108('0x32'),'uri':_0xd108('0x3a'),'body':_0x315382,'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x253ef9){var _0xbe5bfa={'messageId':_0x253ef9[_0xd108('0x3b')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0xbe5bfa[_0xd108('0x36')]=!![];}return _0x28a12d['update'](_0xbe5bfa);})[_0xd108('0x24')](function(_0x4e9dd3){logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x38'),util['inspect'](_0x4e9dd3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x38'),_0xd108('0x3d'));}break;case _0xd108('0x3e'):if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d['password']){var _0x315382={'messages':[{'source':'xCALLY\x20Motion','to':_0x4b3dc2[_0xd108('0x1e')],'body':_0x4b3dc2[_0xd108('0xb')],'from':_0xcdb26d[_0xd108('0x39')]||_0xcdb26d['phone']}]};var _0x4f868e=util[_0xd108('0x3f')](_0xd108('0x40'),_0xcdb26d[_0xd108('0x2a')],_0xcdb26d[_0xd108('0x2b')]);var _0x23299e={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x315382,'headers':{'Authorization':util[_0xd108('0x3f')](_0xd108('0x41'),new Buffer(_0x4f868e)[_0xd108('0x42')](_0xd108('0x43')))},'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x239d37){if(_0x239d37[_0xd108('0x44')]>=0xc8&&_0x239d37['http_code']<=0xce){if(_0x239d37[_0xd108('0x45')]&&_0x239d37[_0xd108('0x45')][_0xd108('0x46')]>0x0){var _0x28696a=_['head'](_0x239d37['data'][_0xd108('0x1f')]);var _0x341bfb={'messageId':_0x28696a[_0xd108('0x47')]};if(!_0xcdb26d['deliveryReport']){_0x341bfb['read']=!![];}return _0x28a12d[_0xd108('0x16')](_0x341bfb);}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x48'),util[_0xd108('0x26')](_0x239d37,{'showHidden':![],'depth':null}));}}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x48'),util['inspect'](_0x239d37,{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x34d44c){logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x48'),util[_0xd108('0x26')](_0x34d44c,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd108('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd108('0x49'):if(_0xcdb26d[_0xd108('0x4a')]&&_0xcdb26d['authToken']){var _0x315382={'dst':_0x4b3dc2[_0xd108('0x1e')],'text':_0x4b3dc2[_0xd108('0xb')],'src':_0xcdb26d[_0xd108('0x39')]||_0xcdb26d[_0xd108('0x1e')],'url':_0xcdb26d['remote']+_0xd108('0x4b')+_0x4b3dc2['id']+_0xd108('0x21')+_0xcdb26d[_0xd108('0x22')]};var _0x4f868e=util[_0xd108('0x3f')](_0xd108('0x40'),_0xcdb26d[_0xd108('0x4a')],_0xcdb26d[_0xd108('0x1d')]);var _0x23299e={'method':_0xd108('0x32'),'uri':util[_0xd108('0x3f')](_0xd108('0x4c'),_0xcdb26d['authId']),'body':_0x315382,'headers':{'Authorization':util[_0xd108('0x3f')](_0xd108('0x41'),new Buffer(_0x4f868e)[_0xd108('0x42')](_0xd108('0x43')))},'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x3dcd72){var _0x1b5a30={'messageId':_0x3dcd72[_0xd108('0x4d')][0x0]};return _0x28a12d['update'](_0x1b5a30);})[_0xd108('0x24')](function(_0x4bc4c6){logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x49'),util[_0xd108('0x26')](_0x4bc4c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x49'),_0xd108('0x4e'));}break;case'infobip':if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d['password']){if(_0xcdb26d['baseUrl']){var _0x2bdca8={'method':_0xd108('0x32'),'uri':_0xcdb26d[_0xd108('0x4f')]+_0xd108('0x50'),'body':{'username':_0xcdb26d[_0xd108('0x2a')],'password':_0xcdb26d[_0xd108('0x2b')]},'json':!![]};return rp(_0x2bdca8)[_0xd108('0x15')](function(_0x355363){var _0x394f13={'method':_0xd108('0x32'),'uri':_0xcdb26d[_0xd108('0x4f')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0xcdb26d[_0xd108('0x1e')],'destinations':[{'to':_0x4b3dc2[_0xd108('0x1e')]}],'text':_0x4b3dc2[_0xd108('0xb')],'notifyUrl':_0xcdb26d[_0xd108('0x20')]+_0xd108('0x4b')+_0x4b3dc2['id']+_0xd108('0x21')+_0xcdb26d[_0xd108('0x22')],'notifyContentType':'application/json','callbackData':_0xcdb26d[_0xd108('0x1e')]+';'+_0x4b3dc2[_0xd108('0xb')]}]},'headers':{'Authorization':_0xd108('0x51')+_0x355363[_0xd108('0x22')]},'json':!![]};return rp(_0x394f13)[_0xd108('0x15')](function(_0x565133){if(_0x565133[_0xd108('0x1f')]){var _0x241231={'messageId':_0x565133[_0xd108('0x1f')][0x0][_0xd108('0xa')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0x241231[_0xd108('0x36')]=!![];}return _0x28a12d['update'](_0x241231);}else{return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x52'),util[_0xd108('0x26')](_0x565133,{'showHidden':![],'depth':null}));}});})[_0xd108('0x24')](function(_0x43588d){return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x52'),util[_0xd108('0x26')](_0x43588d,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),'infobip',_0xd108('0x53'));}}else{logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x52'),_0xd108('0x54'));}break;case _0xd108('0x55'):var _0x38b23d=require(_0xd108('0x56'));if(_0xcdb26d['apiKey']){var _0x10f37c={};_0x10f37c[_0xd108('0x57')]=_0xcdb26d[_0xd108('0x2a')];_0x10f37c[_0xd108('0x1e')]=_0x4b3dc2[_0xd108('0x1e')];_0x10f37c[_0xd108('0x2d')]=_0xcdb26d[_0xd108('0x1e')];_0x10f37c[_0xd108('0x58')]=_0x4b3dc2[_0xd108('0xb')];_0x10f37c[_0xd108('0x59')]=+new Date();var _0x599b77='';var _0x5b8024='';var _0x599b41=Object[_0xd108('0x5a')](_0x10f37c);_0x599b41['sort']();for(var _0x1145f0=0x0;_0x1145f0<_0x599b41['length'];_0x1145f0++){if(_0x599b77!=''){_0x599b77+='&';}_0x599b77+=_0x599b41[_0x1145f0]+'='+encodeURIComponent(_0x10f37c[_0x599b41[_0x1145f0]]);_0x5b8024+=_0x10f37c[_0x599b41[_0x1145f0]];}_0x5b8024+=_0xcdb26d['apiKey'];_0x5b8024=_0x38b23d[_0xd108('0x5b')](_0xd108('0x5c'))[_0xd108('0x16')](_0x5b8024)[_0xd108('0x5d')]('hex');if(_0x599b77!==''){_0x599b77+='&';}_0x599b77+=_0xd108('0x5e')+_0x5b8024;var _0x522ac1={'method':_0xd108('0x2f'),'uri':_0xcdb26d['baseUrl']+'/external/get/send.php?'+_0x599b77,'json':!![]};return rp(_0x522ac1)['then'](function(_0x121fc7){var _0x5dcc21=Object[_0xd108('0x5a')](_0x121fc7);if(_0x121fc7[_0x5dcc21[0x0]][_0xd108('0x18')]&&parseInt(_0x121fc7[_0x5dcc21[0x0]][_0xd108('0x18')])===0x0){var _0xb8bce9={'messageId':_0x121fc7[_0x5dcc21[0x0]][_0xd108('0x5f')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0xb8bce9[_0xd108('0x36')]=!![];}return _0x28a12d[_0xd108('0x16')](_0xb8bce9);}else{return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),'csc',util['inspect'](_0x121fc7[_0xd108('0x18')],{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x54117d){return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x55'),util[_0xd108('0x26')](_0x54117d,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x55'),_0xd108('0x60'));}break;case _0xd108('0x61'):if(_0xcdb26d[_0xd108('0x62')]){var _0x203399={'method':_0xd108('0x32'),'uri':_0xd108('0x63'),'headers':{'Authorization':_0xcdb26d[_0xd108('0x62')]},'body':{'content':_0x4b3dc2[_0xd108('0xb')],'to':[_0x4b3dc2[_0xd108('0x1e')]],'from':_0xcdb26d[_0xd108('0x1e')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x203399)[_0xd108('0x15')](function(_0x3f02a8){if(!_0x3f02a8[_0xd108('0x18')]){var _0x3a3e23={'messageId':_0x3f02a8['messages'][0x0][_0xd108('0x64')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0x3a3e23[_0xd108('0x36')]=!![];}return _0x28a12d['update'](_0x3a3e23);}else{return logger['error'](_0xd108('0x27'),'afterCreate',_0xd108('0x61'),util['inspect'](_0x3f02a8[_0xd108('0x18')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2d65cd){return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),'clickatell',util[_0xd108('0x26')](_0x2d65cd,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')](_0xd108('0x27'),'afterCreate',_0xd108('0x61'),_0xd108('0x60'));}break;case _0xd108('0x65'):if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d['password']){var _0x4f868e=util[_0xd108('0x3f')](_0xd108('0x40'),_0xcdb26d['username'],_0xcdb26d[_0xd108('0x2b')]);var _0x23299e={'method':_0xd108('0x32'),'uri':_0xd108('0x66')+_0xcdb26d[_0xd108('0x67')]+'/messages','body':{'to':[_0x4b3dc2[_0xd108('0x1e')]],'text':_0x4b3dc2[_0xd108('0xb')],'from':_0xcdb26d[_0xd108('0x1e')],'applicationId':_0xcdb26d[_0xd108('0x68')]},'headers':{'Authorization':util[_0xd108('0x3f')]('Basic\x20%s',new Buffer(_0x4f868e)[_0xd108('0x42')](_0xd108('0x43')))},'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x1eeeb0){if(_0x1eeeb0['id']){var _0x7fdc73={'messageId':_0x1eeeb0['id']};return _0x28a12d[_0xd108('0x16')](_0x7fdc73);}else{logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x65'),util[_0xd108('0x26')](_0x1eeeb0,{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x4b35ef){logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x65'),util[_0xd108('0x26')](_0x4b35ef,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x65'),_0xd108('0x54'));}break;case _0xd108('0x69'):if(_0xcdb26d[_0xd108('0x62')]){var _0x15861d={};var _0x522ac1={'method':_0xd108('0x32'),'uri':_0xd108('0x6a'),'headers':{'Authorization':_0xd108('0x6b')+_0xcdb26d[_0xd108('0x62')],'Content-Type':_0xd108('0x6c')},'body':{'from':_0xcdb26d[_0xd108('0x1e')],'to':_0x4b3dc2[_0xd108('0x1e')],'text':_0x4b3dc2['body']},'json':!![]};return rp(_0x522ac1)[_0xd108('0x15')](function(_0x2f8619){if(_0x2f8619[_0xd108('0x6d')]==0xca){_0x15861d['message']=_0x2f8619;var _0x51fc88={'method':_0xd108('0x32'),'uri':_0xd108('0x6e'),'headers':{'Authorization':_0xd108('0x6b')+_0xcdb26d[_0xd108('0x62')],'Content-Type':_0xd108('0x6c')},'body':{'refid':_0x15861d[_0xd108('0x6f')]['refid']},'json':!![]};return rp(_0x51fc88)[_0xd108('0x15')](function(_0x135600){_0x15861d[_0xd108('0x70')]=_0x135600;var _0x472bc9={'messageId':_0x15861d[_0xd108('0x6f')]['refid'],'read':!![]};return _0x28a12d[_0xd108('0x16')](_0x472bc9);});}else{return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x69'),util[_0xd108('0x26')](_0x2f8619,{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x5f001e){return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x69'),util['inspect'](_0x5f001e,{'showHidden':![],'depth':null}));});}else{return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x69'),_0xd108('0x71'));}break;}}})[_0xd108('0x72')](function(){_0x17ff51();});}else{_0x17ff51();}}},'charset':_0xd108('0x73'),'collate':_0xd108('0x74')});}; \ No newline at end of file +var _0x3fec=['error','out','SmsAccount','find','SmsAccountId','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','update','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','sms','POST','session_key','total_sent','deliveryReport','read','inspect','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','toString','base64','message_uuid','plivo','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','keys','sort','length','createHash','md5','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch'];(function(_0x4213f8,_0x3572a4){var _0x2e690e=function(_0x142fc1){while(--_0x142fc1){_0x4213f8['push'](_0x4213f8['shift']());}};_0x2e690e(++_0x3572a4);}(_0x3fec,0x153));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require('util');var logger=require(_0xc3fe('0x1'))(_0xc3fe('0x2'));var moment=require(_0xc3fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3fe('0x4'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xc3fe('0x5')]=function(_0x18d2dd,_0x2e78b3){return _0x18d2dd[_0xc3fe('0x6')](_0xc3fe('0x7'),attributes,{'tableName':_0xc3fe('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc3fe('0x9')]},{'name':_0xc3fe('0xa'),'fields':[_0xc3fe('0xb')],'type':_0xc3fe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xee5c23,_0x234d13,_0x1a6a49){var _0x56502a=_0x18d2dd[_0xc3fe('0xd')];var _0x30183b=_0xee5c23[_0xc3fe('0xe')]({'plain':!![]});if(_0x30183b[_0xc3fe('0xf')]['toLowerCase']()==='in'||_0x30183b['direction'][_0xc3fe('0x10')]()==='out'&&!_0x30183b[_0xc3fe('0x11')]&&!_['isNil'](_0x30183b['UserId'])&&!_['isNil'](_0x30183b[_0xc3fe('0x12')])){_0x56502a[_0xc3fe('0x13')][_0xc3fe('0x14')]({'where':{'id':_0x30183b['SmsInteractionId']}})[_0xc3fe('0x15')](function(_0x842841){if(_0x842841){_0x842841['update']({'lastMsgAt':_0x30183b[_0xc3fe('0x16')],'lastMsgDirection':_0x30183b[_0xc3fe('0xf')][_0xc3fe('0x10')]()});}})[_0xc3fe('0x17')](function(_0xdbfe71){console[_0xc3fe('0x18')](_0xdbfe71);});}if(_0x30183b['direction']===_0xc3fe('0x19')&&!_0x30183b['secret']){var _0xad1629;_0x56502a[_0xc3fe('0x1a')][_0xc3fe('0x1b')]({'where':{'id':_0x30183b[_0xc3fe('0x1c')]},'raw':!![]})[_0xc3fe('0x15')](function(_0x14e2d2){_0xad1629=_0x14e2d2;if(_0xad1629&&_0xad1629['type']){switch(_0xad1629['type']){case _0xc3fe('0x1d'):var _0x5edd32=require(_0xc3fe('0x1d'));if(_0xad1629[_0xc3fe('0x1e')]&&_0xad1629[_0xc3fe('0x1f')]&&_0xad1629[_0xc3fe('0x20')]){var _0x309dbe=new _0x5edd32(_0xad1629['accountSid'],_0xad1629[_0xc3fe('0x1f')]);_0x309dbe[_0xc3fe('0x21')][_0xc3fe('0x22')]({'body':_0x30183b['body'],'to':_0x30183b['phone'],'from':_0xad1629[_0xc3fe('0x20')],'statusCallback':_0xad1629[_0xc3fe('0x23')]+_0xc3fe('0x24')+_0x30183b['id']+_0xc3fe('0x25')+_0xad1629[_0xc3fe('0x26')]})[_0xc3fe('0x15')](function(_0x509311){if(_0x509311['sid']){return _0xee5c23[_0xc3fe('0x27')]({'messageId':_0x509311[_0xc3fe('0x28')]});}})['catch'](function(_0x57203d){logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x1d'),util['inspect'](_0x57203d,{'showHidden':![],'depth':null}));});}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),'twilio',_0xc3fe('0x2b'));}break;case _0xc3fe('0x2c'):var _0x5a5bd8=_0xc3fe('0x2d');if(_0xad1629[_0xc3fe('0x2e')]&&_0xad1629[_0xc3fe('0x2f')]){var _0x2e5638={'recipient':[_0x30183b['phone']],'message':_0x30183b[_0xc3fe('0xb')],'message_type':_0xad1629[_0xc3fe('0x30')]};if(_0xad1629[_0xc3fe('0x30')]&&_0xad1629['smsMethod']!=='SI'){_0x2e5638['sender']=_0xad1629[_0xc3fe('0x20')];}var _0x2bfe10={'url':_0x5a5bd8+_0xc3fe('0x31')+_0xad1629[_0xc3fe('0x2e')]+_0xc3fe('0x32')+_0xad1629['password'],'method':_0xc3fe('0x33')};rp(_0x2bfe10)[_0xc3fe('0x15')](function(_0x384c93){var _0x3e7cb0=_0x384c93['split'](';');var _0x1a7efd={'user_key':_0x3e7cb0[0x0],'session_key':_0x3e7cb0[0x1]};_0x2bfe10={'url':_0x5a5bd8+_0xc3fe('0x34'),'method':_0xc3fe('0x35'),'headers':{'user_key':_0x1a7efd['user_key'],'Session_key':_0x1a7efd[_0xc3fe('0x36')]},'json':!![],'body':_0x2e5638};return rp(_0x2bfe10);})[_0xc3fe('0x15')](function(_0x55861a){if(_0x55861a[_0xc3fe('0x37')]>=0x1){var _0x225b80={'messageId':_0x55861a['internal_order_id']};if(_0xad1629['smsMethod']!=='GP'||!_0xad1629[_0xc3fe('0x38')]){_0x225b80[_0xc3fe('0x39')]=!![];}return _0xee5c23[_0xc3fe('0x27')](_0x225b80);}else{return logger['error'](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x2c'),util[_0xc3fe('0x3a')](_0x55861a,{'showHidden':![],'depth':null}));}})[_0xc3fe('0x17')](function(_0x4348e2){return logger['error'](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x2c'),util[_0xc3fe('0x3a')](_0x4348e2,{'showHidden':![],'depth':null}));});}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),'afterCreate',_0xc3fe('0x2c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xc3fe('0x3b'):if(_0xad1629[_0xc3fe('0x1f')]){var _0x8d99da={'recipient':_0x30183b['phone'],'message':_0x30183b[_0xc3fe('0xb')],'sender':_0xad1629['senderString']||_0xad1629[_0xc3fe('0x20')],'authorization':_0xad1629[_0xc3fe('0x1f')]};var _0x234d13={'method':_0xc3fe('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x8d99da,'json':!![]};rp(_0x234d13)[_0xc3fe('0x15')](function(_0x1c1720){var _0x5c8a47={'messageId':_0x1c1720['requestid']};if(!_0xad1629['deliveryReport']){_0x5c8a47[_0xc3fe('0x39')]=!![];}return _0xee5c23[_0xc3fe('0x27')](_0x5c8a47);})[_0xc3fe('0x17')](function(_0x280a16){logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x3b'),util[_0xc3fe('0x3a')](_0x280a16,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc3fe('0x29'),_0xc3fe('0x2a'),'connectel',_0xc3fe('0x3c'));}break;case _0xc3fe('0x3d'):if(_0xad1629['username']&&_0xad1629[_0xc3fe('0x2f')]){var _0x8d99da={'messages':[{'source':_0xc3fe('0x3e'),'to':_0x30183b[_0xc3fe('0x20')],'body':_0x30183b[_0xc3fe('0xb')],'from':_0xad1629[_0xc3fe('0x3f')]||_0xad1629[_0xc3fe('0x20')]}]};var _0x1a773f=util[_0xc3fe('0x40')](_0xc3fe('0x41'),_0xad1629[_0xc3fe('0x2e')],_0xad1629[_0xc3fe('0x2f')]);var _0x234d13={'method':_0xc3fe('0x35'),'uri':_0xc3fe('0x42'),'body':_0x8d99da,'headers':{'Authorization':util[_0xc3fe('0x40')](_0xc3fe('0x43'),new Buffer(_0x1a773f)['toString']('base64'))},'json':!![]};rp(_0x234d13)['then'](function(_0x11fb0d){if(_0x11fb0d['http_code']>=0xc8&&_0x11fb0d[_0xc3fe('0x44')]<=0xce){if(_0x11fb0d[_0xc3fe('0x45')]&&_0x11fb0d[_0xc3fe('0x45')]['queued_count']>0x0){var _0x3f3dd3=_[_0xc3fe('0x46')](_0x11fb0d[_0xc3fe('0x45')][_0xc3fe('0x21')]);var _0x401756={'messageId':_0x3f3dd3[_0xc3fe('0x47')]};if(!_0xad1629['deliveryReport']){_0x401756[_0xc3fe('0x39')]=!![];}return _0xee5c23[_0xc3fe('0x27')](_0x401756);}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x48'),util[_0xc3fe('0x3a')](_0x11fb0d,{'showHidden':![],'depth':null}));}}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x48'),util[_0xc3fe('0x3a')](_0x11fb0d,{'showHidden':![],'depth':null}));}})[_0xc3fe('0x17')](function(_0x484665){logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x48'),util['inspect'](_0x484665,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc3fe('0x29'),'afterCreate',_0xc3fe('0x48'),_0xc3fe('0x49'));}break;case'plivo':if(_0xad1629[_0xc3fe('0x4a')]&&_0xad1629[_0xc3fe('0x1f')]){var _0x8d99da={'dst':_0x30183b[_0xc3fe('0x20')],'text':_0x30183b[_0xc3fe('0xb')],'src':_0xad1629['senderString']||_0xad1629[_0xc3fe('0x20')],'url':_0xad1629[_0xc3fe('0x23')]+_0xc3fe('0x24')+_0x30183b['id']+_0xc3fe('0x25')+_0xad1629[_0xc3fe('0x26')]};var _0x1a773f=util[_0xc3fe('0x40')](_0xc3fe('0x41'),_0xad1629['authId'],_0xad1629[_0xc3fe('0x1f')]);var _0x234d13={'method':_0xc3fe('0x35'),'uri':util[_0xc3fe('0x40')]('https://api.plivo.com/v1/Account/%s/Message/',_0xad1629['authId']),'body':_0x8d99da,'headers':{'Authorization':util[_0xc3fe('0x40')](_0xc3fe('0x43'),new Buffer(_0x1a773f)[_0xc3fe('0x4b')](_0xc3fe('0x4c')))},'json':!![]};rp(_0x234d13)[_0xc3fe('0x15')](function(_0x448041){var _0x29a224={'messageId':_0x448041[_0xc3fe('0x4d')][0x0]};return _0xee5c23[_0xc3fe('0x27')](_0x29a224);})[_0xc3fe('0x17')](function(_0x38a948){logger[_0xc3fe('0x18')](_0xc3fe('0x29'),'afterCreate',_0xc3fe('0x4e'),util[_0xc3fe('0x3a')](_0x38a948,{'showHidden':![],'depth':null}));});}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),'plivo',_0xc3fe('0x4f'));}break;case _0xc3fe('0x50'):if(_0xad1629['username']&&_0xad1629[_0xc3fe('0x2f')]){if(_0xad1629[_0xc3fe('0x51')]){var _0x3816ad={'method':_0xc3fe('0x35'),'uri':_0xad1629[_0xc3fe('0x51')]+_0xc3fe('0x52'),'body':{'username':_0xad1629['username'],'password':_0xad1629[_0xc3fe('0x2f')]},'json':!![]};return rp(_0x3816ad)[_0xc3fe('0x15')](function(_0x43b12e){var _0x13eab8={'method':_0xc3fe('0x35'),'uri':_0xad1629[_0xc3fe('0x51')]+_0xc3fe('0x53'),'body':{'messages':[{'from':_0xad1629[_0xc3fe('0x20')],'destinations':[{'to':_0x30183b['phone']}],'text':_0x30183b[_0xc3fe('0xb')],'notifyUrl':_0xad1629['remote']+_0xc3fe('0x24')+_0x30183b['id']+'/status?token='+_0xad1629['token'],'notifyContentType':_0xc3fe('0x54'),'callbackData':_0xad1629[_0xc3fe('0x20')]+';'+_0x30183b[_0xc3fe('0xb')]}]},'headers':{'Authorization':_0xc3fe('0x55')+_0x43b12e[_0xc3fe('0x26')]},'json':!![]};return rp(_0x13eab8)[_0xc3fe('0x15')](function(_0x101478){if(_0x101478[_0xc3fe('0x21')]){var _0x20b273={'messageId':_0x101478[_0xc3fe('0x21')][0x0]['messageId']};if(!_0xad1629['deliveryReport']){_0x20b273[_0xc3fe('0x39')]=!![];}return _0xee5c23['update'](_0x20b273);}else{return logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x50'),util['inspect'](_0x101478,{'showHidden':![],'depth':null}));}});})[_0xc3fe('0x17')](function(_0x525da9){return logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x50'),util[_0xc3fe('0x3a')](_0x525da9,{'showHidden':![],'depth':null}));});}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),'afterCreate',_0xc3fe('0x50'),_0xc3fe('0x56'));}}else{logger[_0xc3fe('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3fe('0x2a'),_0xc3fe('0x50'),_0xc3fe('0x49'));}break;case _0xc3fe('0x57'):var _0x112fd5=require(_0xc3fe('0x58'));if(_0xad1629[_0xc3fe('0x59')]){var _0x448e4c={};_0x448e4c[_0xc3fe('0x5a')]=_0xad1629[_0xc3fe('0x2e')];_0x448e4c[_0xc3fe('0x20')]=_0x30183b[_0xc3fe('0x20')];_0x448e4c['sender']=_0xad1629[_0xc3fe('0x20')];_0x448e4c[_0xc3fe('0x5b')]=_0x30183b['body'];_0x448e4c[_0xc3fe('0x5c')]=+new Date();var _0x24e844='';var _0x398341='';var _0x2d7606=Object[_0xc3fe('0x5d')](_0x448e4c);_0x2d7606[_0xc3fe('0x5e')]();for(var _0x17eab3=0x0;_0x17eab3<_0x2d7606[_0xc3fe('0x5f')];_0x17eab3++){if(_0x24e844!=''){_0x24e844+='&';}_0x24e844+=_0x2d7606[_0x17eab3]+'='+encodeURIComponent(_0x448e4c[_0x2d7606[_0x17eab3]]);_0x398341+=_0x448e4c[_0x2d7606[_0x17eab3]];}_0x398341+=_0xad1629['apiKey'];_0x398341=_0x112fd5[_0xc3fe('0x60')](_0xc3fe('0x61'))['update'](_0x398341)['digest']('hex');if(_0x24e844!==''){_0x24e844+='&';}_0x24e844+=_0xc3fe('0x62')+_0x398341;var _0x2bfe10={'method':_0xc3fe('0x33'),'uri':_0xad1629[_0xc3fe('0x51')]+_0xc3fe('0x63')+_0x24e844,'json':!![]};return rp(_0x2bfe10)[_0xc3fe('0x15')](function(_0x4f8a40){var _0x2a1ed2=Object[_0xc3fe('0x5d')](_0x4f8a40);if(_0x4f8a40[_0x2a1ed2[0x0]]['error']&&parseInt(_0x4f8a40[_0x2a1ed2[0x0]][_0xc3fe('0x18')])===0x0){var _0x1cbb58={'messageId':_0x4f8a40[_0x2a1ed2[0x0]][_0xc3fe('0x64')]};if(!_0xad1629['deliveryReport']){_0x1cbb58[_0xc3fe('0x39')]=!![];}return _0xee5c23['update'](_0x1cbb58);}else{return logger['error'](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x57'),util[_0xc3fe('0x3a')](_0x4f8a40[_0xc3fe('0x18')],{'showHidden':![],'depth':null}));}})[_0xc3fe('0x17')](function(_0x390d87){return logger[_0xc3fe('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3fe('0x2a'),_0xc3fe('0x57'),util[_0xc3fe('0x3a')](_0x390d87,{'showHidden':![],'depth':null}));});}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x57'),'Missing\x20parameters:\x20apiKey');}break;case _0xc3fe('0x65'):if(_0xad1629[_0xc3fe('0x59')]){var _0x2332b6={'method':_0xc3fe('0x35'),'uri':_0xc3fe('0x66'),'headers':{'Authorization':_0xad1629[_0xc3fe('0x59')]},'body':{'content':_0x30183b['body'],'to':[_0x30183b[_0xc3fe('0x20')]],'from':_0xad1629[_0xc3fe('0x20')],'binary':![],'clientMessageId':_0xc3fe('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x2332b6)[_0xc3fe('0x15')](function(_0x46a677){if(!_0x46a677['error']){var _0x4790ce={'messageId':_0x46a677['messages'][0x0][_0xc3fe('0x68')]};if(!_0xad1629[_0xc3fe('0x38')]){_0x4790ce[_0xc3fe('0x39')]=!![];}return _0xee5c23['update'](_0x4790ce);}else{return logger[_0xc3fe('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3fe('0x2a'),_0xc3fe('0x65'),util[_0xc3fe('0x3a')](_0x46a677[_0xc3fe('0x18')],{'showHidden':![],'depth':null}));}})[_0xc3fe('0x17')](function(_0x8a38a7){return logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x65'),util[_0xc3fe('0x3a')](_0x8a38a7,{'showHidden':![],'depth':null}));});}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x65'),_0xc3fe('0x69'));}break;case _0xc3fe('0x6a'):if(_0xad1629[_0xc3fe('0x2e')]&&_0xad1629[_0xc3fe('0x2f')]){var _0x1a773f=util[_0xc3fe('0x40')](_0xc3fe('0x41'),_0xad1629[_0xc3fe('0x2e')],_0xad1629['password']);var _0x234d13={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xad1629[_0xc3fe('0x6b')]+_0xc3fe('0x6c'),'body':{'to':[_0x30183b['phone']],'text':_0x30183b[_0xc3fe('0xb')],'from':_0xad1629[_0xc3fe('0x20')],'applicationId':_0xad1629[_0xc3fe('0x6d')]},'headers':{'Authorization':util[_0xc3fe('0x40')](_0xc3fe('0x43'),new Buffer(_0x1a773f)['toString'](_0xc3fe('0x4c')))},'json':!![]};rp(_0x234d13)[_0xc3fe('0x15')](function(_0x43d880){if(_0x43d880['id']){var _0xec2b53={'messageId':_0x43d880['id']};return _0xee5c23[_0xc3fe('0x27')](_0xec2b53);}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x6a'),util[_0xc3fe('0x3a')](_0x43d880,{'showHidden':![],'depth':null}));}})[_0xc3fe('0x17')](function(_0x156dbf){logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x6a'),util['inspect'](_0x156dbf,{'showHidden':![],'depth':null}));});}else{logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x6a'),_0xc3fe('0x49'));}break;case _0xc3fe('0x6e'):if(_0xad1629[_0xc3fe('0x59')]){var _0x5554d3={};var _0x2bfe10={'method':_0xc3fe('0x35'),'uri':_0xc3fe('0x6f'),'headers':{'Authorization':_0xc3fe('0x70')+_0xad1629['apiKey'],'Content-Type':_0xc3fe('0x54')},'body':{'from':_0xad1629[_0xc3fe('0x20')],'to':_0x30183b[_0xc3fe('0x20')],'text':_0x30183b[_0xc3fe('0xb')]},'json':!![]};return rp(_0x2bfe10)[_0xc3fe('0x15')](function(_0x13ab4f){if(_0x13ab4f[_0xc3fe('0x71')]==0xca){_0x5554d3[_0xc3fe('0x72')]=_0x13ab4f;var _0x3b1d9b={'method':_0xc3fe('0x35'),'uri':_0xc3fe('0x73'),'headers':{'Authorization':'Bearer\x20'+_0xad1629[_0xc3fe('0x59')],'Content-Type':_0xc3fe('0x54')},'body':{'refid':_0x5554d3[_0xc3fe('0x72')][_0xc3fe('0x74')]},'json':!![]};return rp(_0x3b1d9b)['then'](function(_0x4e0540){_0x5554d3[_0xc3fe('0x75')]=_0x4e0540;var _0x5d7498={'messageId':_0x5554d3[_0xc3fe('0x72')][_0xc3fe('0x74')],'read':!![]};return _0xee5c23[_0xc3fe('0x27')](_0x5d7498);});}else{return logger[_0xc3fe('0x18')](_0xc3fe('0x29'),_0xc3fe('0x2a'),_0xc3fe('0x6e'),util['inspect'](_0x13ab4f,{'showHidden':![],'depth':null}));}})[_0xc3fe('0x17')](function(_0x2c8d14){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc3fe('0x6e'),util[_0xc3fe('0x3a')](_0x2c8d14,{'showHidden':![],'depth':null}));});}else{return logger[_0xc3fe('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3fe('0x2a'),_0xc3fe('0x6e'),_0xc3fe('0x76'));}break;}}})[_0xc3fe('0x77')](function(){_0x1a6a49();});}else{_0x1a6a49();}}},'charset':'utf8mb4','collate':_0xc3fe('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7de6459..02f9118 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 _0x1096=['error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x11db94,_0x3c15d6){var _0x34a03e=function(_0x1c16d8){while(--_0x1c16d8){_0x11db94['push'](_0x11db94['shift']());}};_0x34a03e(++_0x3c15d6);}(_0x1096,0x1ab));var _0x6109=function(_0x28a59c,_0x37bd9f){_0x28a59c=_0x28a59c-0x0;var _0x14cbba=_0x1096[_0x28a59c];return _0x14cbba;};'use strict';var _=require('lodash');var util=require(_0x6109('0x0'));var moment=require(_0x6109('0x1'));var BPromise=require(_0x6109('0x2'));var rs=require(_0x6109('0x3'));var fs=require('fs');var Redis=require(_0x6109('0x4'));var db=require(_0x6109('0x5'))['db'];var utils=require(_0x6109('0x6'));var logger=require(_0x6109('0x7'))(_0x6109('0x8'));var config=require(_0x6109('0x9'));var jayson=require(_0x6109('0xa'));var client=jayson[_0x6109('0xb')]['http']({'port':0x232a});config[_0x6109('0xc')]=_['defaults'](config['redis'],{'host':_0x6109('0xd'),'port':0x18eb});var socket=require(_0x6109('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3366ed,_0xbd81fc,_0x14a92b){return new BPromise(function(_0x5cd438,_0x5c4969){return client['request'](_0x3366ed,_0x14a92b)[_0x6109('0xf')](function(_0x326078){logger[_0x6109('0x10')](_0x6109('0x11'),_0xbd81fc,_0x6109('0x12'));logger[_0x6109('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbd81fc,_0x6109('0x12'),JSON[_0x6109('0x14')](_0x326078));if(_0x326078[_0x6109('0x15')]){if(_0x326078[_0x6109('0x15')][_0x6109('0x16')]===0x1f4){logger[_0x6109('0x15')](_0x6109('0x11'),_0xbd81fc,_0x326078['error'][_0x6109('0x17')]);return _0x5c4969(_0x326078[_0x6109('0x15')]['message']);}logger[_0x6109('0x15')](_0x6109('0x11'),_0xbd81fc,_0x326078[_0x6109('0x15')]['message']);return _0x5cd438(_0x326078['error'][_0x6109('0x17')]);}else{logger[_0x6109('0x10')](_0x6109('0x11'),_0xbd81fc,'request\x20sent');_0x5cd438(_0x326078[_0x6109('0x18')][_0x6109('0x17')]);}})[_0x6109('0x19')](function(_0x5072f8){logger['error'](_0x6109('0x11'),_0xbd81fc,_0x5072f8);_0x5c4969(_0x5072f8);});});}exports['CreateSmsMessage']=function(_0x195385){var _0x57fb8b=this;return new Promise(function(_0x3f5eb9,_0x3a9f9c){return db[_0x6109('0x1a')][_0x6109('0x1b')](_0x195385[_0x6109('0x1c')],{'raw':_0x195385[_0x6109('0x1d')]?_0x195385[_0x6109('0x1d')][_0x6109('0x1e')]===undefined?!![]:![]:!![]})[_0x6109('0xf')](function(_0x240b78){logger[_0x6109('0x10')](_0x6109('0x1f'),_0x195385);logger[_0x6109('0x13')](_0x6109('0x1f'),_0x195385,JSON[_0x6109('0x14')](_0x240b78));_0x3f5eb9(_0x240b78);})['catch'](function(_0x1f96b5){logger[_0x6109('0x15')](_0x6109('0x1f'),_0x1f96b5[_0x6109('0x17')],_0x195385);_0x3a9f9c(_0x57fb8b[_0x6109('0x15')](0x1f4,_0x1f96b5['message']));});});}; \ No newline at end of file +var _0x7998=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','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','options','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x7998,0x94));var _0x8799=function(_0x4f8886,_0x9be826){_0x4f8886=_0x4f8886-0x0;var _0x3c49e4=_0x7998[_0x4f8886];return _0x3c49e4;};'use strict';var _=require('lodash');var util=require(_0x8799('0x0'));var moment=require(_0x8799('0x1'));var BPromise=require('bluebird');var rs=require(_0x8799('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8799('0x3'))['db'];var utils=require(_0x8799('0x4'));var logger=require(_0x8799('0x5'))(_0x8799('0x6'));var config=require('../../config/environment');var jayson=require(_0x8799('0x7'));var client=jayson[_0x8799('0x8')][_0x8799('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8799('0xa')],{'host':_0x8799('0xb'),'port':0x18eb});var socket=require(_0x8799('0xc'))(new Redis(config[_0x8799('0xa')]));require(_0x8799('0xd'))['register'](socket);function respondWithRpcPromise(_0x1e31d7,_0x20f9ab,_0x30d3ee){return new BPromise(function(_0x18329a,_0x55cb02){return client[_0x8799('0xe')](_0x1e31d7,_0x30d3ee)[_0x8799('0xf')](function(_0x3c1077){logger[_0x8799('0x10')](_0x8799('0x11'),_0x20f9ab,_0x8799('0x12'));logger[_0x8799('0x13')](_0x8799('0x14'),_0x20f9ab,_0x8799('0x12'),JSON[_0x8799('0x15')](_0x3c1077));if(_0x3c1077['error']){if(_0x3c1077[_0x8799('0x16')][_0x8799('0x17')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x20f9ab,_0x3c1077[_0x8799('0x16')][_0x8799('0x18')]);return _0x55cb02(_0x3c1077[_0x8799('0x16')][_0x8799('0x18')]);}logger[_0x8799('0x16')](_0x8799('0x11'),_0x20f9ab,_0x3c1077[_0x8799('0x16')][_0x8799('0x18')]);return _0x18329a(_0x3c1077[_0x8799('0x16')][_0x8799('0x18')]);}else{logger[_0x8799('0x10')]('SmsMessage,\x20%s,\x20%s',_0x20f9ab,_0x8799('0x12'));_0x18329a(_0x3c1077[_0x8799('0x19')][_0x8799('0x18')]);}})[_0x8799('0x1a')](function(_0x24af7c){logger['error'](_0x8799('0x11'),_0x20f9ab,_0x24af7c);_0x55cb02(_0x24af7c);});});}exports[_0x8799('0x1b')]=function(_0x5dbb83){var _0x28a302=this;return new Promise(function(_0xa71953,_0x514931){return db[_0x8799('0x1c')][_0x8799('0x1d')](_0x5dbb83['body'],{'raw':_0x5dbb83['options']?_0x5dbb83[_0x8799('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1daefc){logger[_0x8799('0x10')](_0x8799('0x1b'),_0x5dbb83);logger[_0x8799('0x13')](_0x8799('0x1b'),_0x5dbb83,JSON['stringify'](_0x1daefc));_0xa71953(_0x1daefc);})['catch'](function(_0x1f787e){logger[_0x8799('0x16')](_0x8799('0x1b'),_0x1f787e[_0x8799('0x18')],_0x5dbb83);_0x514931(_0x28a302[_0x8799('0x16')](0x1f4,_0x1f787e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7299ebe..858a2dd 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 _0xc7b7=['register','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x3d8e64,_0x19f06a){var _0x29c501=function(_0x5e7978){while(--_0x5e7978){_0x3d8e64['push'](_0x3d8e64['shift']());}};_0x29c501(++_0x19f06a);}(_0xc7b7,0x1e6));var _0x7c7b=function(_0x1c0c7c,_0x2ede87){_0x1c0c7c=_0x1c0c7c-0x0;var _0x1eeae0=_0xc7b7[_0x1c0c7c];return _0x1eeae0;};'use strict';var SmsMessageEvents=require(_0x7c7b('0x0'));var events=[_0x7c7b('0x1'),_0x7c7b('0x2'),'update'];function createListener(_0xd822e3,_0x52a9e1){return function(_0x22e423){_0x52a9e1[_0x7c7b('0x3')](_0xd822e3,_0x22e423);};}function removeListener(_0x541c01,_0x3e1e35){return function(){SmsMessageEvents['removeListener'](_0x541c01,_0x3e1e35);};}exports[_0x7c7b('0x4')]=function(_0x4578a7){for(var _0x2e6e25=0x0,_0x5a748f=events[_0x7c7b('0x5')];_0x2e6e25<_0x5a748f;_0x2e6e25++){var _0x44a151=events[_0x2e6e25];var _0xc34fa4=createListener(_0x7c7b('0x6')+_0x44a151,_0x4578a7);SmsMessageEvents['on'](_0x44a151,_0xc34fa4);}}; \ No newline at end of file +var _0x6171=['remove','update','emit','removeListener','register','length','smsMessage:','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6171,0xaf));var _0x1617=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x6171[_0x50a0c2];return _0x5ebadd;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x1617('0x0'),_0x1617('0x1'),_0x1617('0x2')];function createListener(_0x329040,_0x36a156){return function(_0x2d9d2b){_0x36a156[_0x1617('0x3')](_0x329040,_0x2d9d2b);};}function removeListener(_0x211b0a,_0x21cad7){return function(){SmsMessageEvents[_0x1617('0x4')](_0x211b0a,_0x21cad7);};}exports[_0x1617('0x5')]=function(_0x534eac){for(var _0x17e2d4=0x0,_0x1ea46e=events[_0x1617('0x6')];_0x17e2d4<_0x1ea46e;_0x17e2d4++){var _0x49e46a=events[_0x17e2d4];var _0x53875a=createListener(_0x1617('0x7')+_0x49e46a,_0x534eac);SmsMessageEvents['on'](_0x49e46a,_0x53875a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b344851..999468f 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 _0xe2f6=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0xe2f6,0x164));var _0x6e2f=function(_0x32fe6b,_0x42b856){_0x32fe6b=_0x32fe6b-0x0;var _0x9f032a=_0xe2f6[_0x32fe6b];return _0x9f032a;};'use strict';var multer=require(_0x6e2f('0x0'));var util=require(_0x6e2f('0x1'));var path=require('path');var timeout=require(_0x6e2f('0x2'));var express=require(_0x6e2f('0x3'));var router=express[_0x6e2f('0x4')]();var fs_extra=require(_0x6e2f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e2f('0x6'));var config=require(_0x6e2f('0x7'));var controller=require(_0x6e2f('0x8'));router[_0x6e2f('0x9')]('/',auth[_0x6e2f('0xa')](),controller[_0x6e2f('0xb')]);router['get'](_0x6e2f('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6e2f('0x9')](_0x6e2f('0xd'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0xe')]);router['get'](_0x6e2f('0xf'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x10')]);router[_0x6e2f('0x9')](_0x6e2f('0x11'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x12')]);router[_0x6e2f('0x9')]('/:id/users',auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x13')]);router['post']('/',auth[_0x6e2f('0xa')](),controller['create']);router[_0x6e2f('0x14')](_0x6e2f('0x11'),auth['isAuthenticated'](),controller[_0x6e2f('0x15')]);router[_0x6e2f('0x14')](_0x6e2f('0x16'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x17')]);router['put'](_0x6e2f('0xd'),auth['isAuthenticated'](),controller[_0x6e2f('0x18')]);router[_0x6e2f('0x19')](_0x6e2f('0xd'),auth['isAuthenticated'](),controller[_0x6e2f('0x1a')]);router[_0x6e2f('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6e2f('0x1b')]);router[_0x6e2f('0x19')](_0x6e2f('0x16'),auth['isAuthenticated'](),controller[_0x6e2f('0x1c')]);module[_0x6e2f('0x1d')]=router; \ No newline at end of file +var _0x022c=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','describe','isAuthenticated','show','/:id/members'];(function(_0x4d973c,_0x36153f){var _0x33d408=function(_0x4e1fc3){while(--_0x4e1fc3){_0x4d973c['push'](_0x4d973c['shift']());}};_0x33d408(++_0x36153f);}(_0x022c,0x183));var _0xc022=function(_0x4e6f65,_0x1602b7){_0x4e6f65=_0x4e6f65-0x0;var _0x35a653=_0x022c[_0x4e6f65];return _0x35a653;};'use strict';var multer=require(_0xc022('0x0'));var util=require(_0xc022('0x1'));var path=require(_0xc022('0x2'));var timeout=require(_0xc022('0x3'));var express=require(_0xc022('0x4'));var router=express['Router']();var fs_extra=require(_0xc022('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc022('0x6'));var config=require(_0xc022('0x7'));var controller=require(_0xc022('0x8'));router[_0xc022('0x9')]('/',auth['isAuthenticated'](),controller[_0xc022('0xa')]);router[_0xc022('0x9')](_0xc022('0xb'),auth['isAuthenticated'](),controller[_0xc022('0xc')]);router[_0xc022('0x9')]('/:id',auth[_0xc022('0xd')](),controller[_0xc022('0xe')]);router[_0xc022('0x9')](_0xc022('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0xc022('0x9')](_0xc022('0x10'),auth[_0xc022('0xd')](),controller[_0xc022('0x11')]);router[_0xc022('0x9')](_0xc022('0x12'),auth[_0xc022('0xd')](),controller[_0xc022('0x13')]);router[_0xc022('0x14')]('/',auth[_0xc022('0xd')](),controller[_0xc022('0x15')]);router[_0xc022('0x14')](_0xc022('0x10'),auth['isAuthenticated'](),controller[_0xc022('0x16')]);router[_0xc022('0x14')](_0xc022('0x12'),auth[_0xc022('0xd')](),controller[_0xc022('0x17')]);router['put'](_0xc022('0x18'),auth[_0xc022('0xd')](),controller[_0xc022('0x19')]);router[_0xc022('0x1a')](_0xc022('0x18'),auth[_0xc022('0xd')](),controller[_0xc022('0x1b')]);router['delete'](_0xc022('0x10'),auth[_0xc022('0xd')](),controller[_0xc022('0x1c')]);router[_0xc022('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xc022('0x1d')]);module[_0xc022('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7bf188a..6708ebd 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 _0x45e1=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x541e38,_0x5e5392){var _0x544a34=function(_0x7a9af1){while(--_0x7a9af1){_0x541e38['push'](_0x541e38['shift']());}};_0x544a34(++_0x5e5392);}(_0x45e1,0xe4));var _0x145e=function(_0x430b22,_0x36200b){_0x430b22=_0x430b22-0x0;var _0x50d4e1=_0x45e1[_0x430b22];return _0x50d4e1;};'use strict';var Sequelize=require(_0x145e('0x0'));module[_0x145e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x145e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x145e('0x3')]},'timeout':{'type':Sequelize[_0x145e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x145e('0x5')](_0x145e('0x6'),_0x145e('0x7'),_0x145e('0x8'))}}; \ No newline at end of file +var _0xbb4c=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x55d257,_0x5e98fc){var _0x1af4fb=function(_0x29f251){while(--_0x29f251){_0x55d257['push'](_0x55d257['shift']());}};_0x1af4fb(++_0x5e98fc);}(_0xbb4c,0x1b3));var _0xcbb4=function(_0x583ba8,_0x40bb0d){_0x583ba8=_0x583ba8-0x0;var _0x515683=_0xbb4c[_0x583ba8];return _0x515683;};'use strict';var Sequelize=require(_0xcbb4('0x0'));module[_0xcbb4('0x1')]={'name':{'type':Sequelize[_0xcbb4('0x2')],'unique':_0xcbb4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcbb4('0x2')]},'timeout':{'type':Sequelize[_0xcbb4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcbb4('0x5')](_0xcbb4('0x6'),_0xcbb4('0x7'),_0xcbb4('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 1031621..418d231 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 _0xd1c9=['get','SmsQueues','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','params','UserSmsQueue','length','filter','options','User','UserId','updatedAt','createdAt','%s/%s','SIP','smsPause','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','sequelize','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then'];(function(_0x4461de,_0x9f2aa6){var _0x2d4a50=function(_0x27058f){while(--_0x27058f){_0x4461de['push'](_0x4461de['shift']());}};_0x2d4a50(++_0x9f2aa6);}(_0xd1c9,0xeb));var _0x9d1c=function(_0x2b36f5,_0x5732dc){_0x2b36f5=_0x2b36f5-0x0;var _0x5f06b6=_0xd1c9[_0x2b36f5];return _0x5f06b6;};'use strict';var emlformat=require(_0x9d1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d1c('0x2'));var BPromise=require(_0x9d1c('0x3'));var Mustache=require(_0x9d1c('0x4'));var util=require(_0x9d1c('0x5'));var path=require(_0x9d1c('0x6'));var sox=require(_0x9d1c('0x7'));var csv=require(_0x9d1c('0x8'));var ejs=require(_0x9d1c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d1c('0xa'));var squel=require(_0x9d1c('0xb'));var crypto=require(_0x9d1c('0xc'));var jsforce=require(_0x9d1c('0xd'));var deskjs=require(_0x9d1c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9d1c('0xf'));var Papa=require(_0x9d1c('0x10'));var Redis=require(_0x9d1c('0x11'));var authService=require(_0x9d1c('0x12'));var qs=require(_0x9d1c('0x13'));var as=require(_0x9d1c('0x14'));var hardwareService=require(_0x9d1c('0x15'));var logger=require(_0x9d1c('0x16'))(_0x9d1c('0x17'));var utils=require(_0x9d1c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9d1c('0x19'));var db=require(_0x9d1c('0x1a'))['db'];config[_0x9d1c('0x1b')]=_['defaults'](config['redis'],{'host':_0x9d1c('0x1c'),'port':0x18eb});var socket=require(_0x9d1c('0x1d'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x9d1c('0x1e')](socket);function respondWithStatusCode(_0x522700,_0x19b2ed){_0x19b2ed=_0x19b2ed||0xcc;return function(_0x291107){if(_0x291107){return _0x522700[_0x9d1c('0x1f')](_0x19b2ed);}return _0x522700[_0x9d1c('0x20')](_0x19b2ed)[_0x9d1c('0x21')]();};}function respondWithResult(_0x1a9350,_0x595b25){_0x595b25=_0x595b25||0xc8;return function(_0xcbf48d){if(_0xcbf48d){return _0x1a9350[_0x9d1c('0x20')](_0x595b25)[_0x9d1c('0x22')](_0xcbf48d);}};}function respondWithFilteredResult(_0x3da96a,_0x31b2a3){return function(_0x34d738){if(_0x34d738){var _0x5f0f05=typeof _0x31b2a3[_0x9d1c('0x23')]===_0x9d1c('0x24')&&typeof _0x31b2a3['limit']==='undefined';var _0x370818=_0x34d738['count'];var _0x1eef73=_0x5f0f05?0x0:_0x31b2a3[_0x9d1c('0x23')];var _0x47b045=_0x5f0f05?_0x34d738[_0x9d1c('0x25')]:_0x31b2a3[_0x9d1c('0x23')]+_0x31b2a3[_0x9d1c('0x26')];var _0xe14203;if(_0x47b045>=_0x370818){_0x47b045=_0x370818;_0xe14203=0xc8;}else{_0xe14203=0xce;}_0x3da96a[_0x9d1c('0x20')](_0xe14203);return _0x3da96a[_0x9d1c('0x27')](_0x9d1c('0x28'),_0x1eef73+'-'+_0x47b045+'/'+_0x370818)[_0x9d1c('0x22')](_0x34d738);}return null;};}function patchUpdates(_0x1af0db){return function(_0x302610){try{jsonpatch[_0x9d1c('0x29')](_0x302610,_0x1af0db,!![]);}catch(_0x409eee){return BPromise['reject'](_0x409eee);}return _0x302610[_0x9d1c('0x2a')]();};}function saveUpdates(_0xbada54,_0x1c2574){return function(_0x50d551){if(_0x50d551){return _0x50d551[_0x9d1c('0x2b')](_0xbada54)[_0x9d1c('0x2c')](function(_0x129534){return _0x129534;});}return null;};}function removeEntity(_0x52a393,_0x3814fb){return function(_0x4ed2f0){if(_0x4ed2f0){return _0x4ed2f0['destroy']()['then'](function(){var _0x376aae=_0x4ed2f0[_0x9d1c('0x2d')]({'plain':!![]});var _0x18d371=_0x9d1c('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x18d371,'resourceId':_0x376aae['id']}})['then'](function(){return _0x4ed2f0;});})[_0x9d1c('0x2c')](function(){_0x52a393['status'](0xcc)[_0x9d1c('0x21')]();});}};}function handleEntityNotFound(_0x1741fc,_0x40c06a){return function(_0x10c4e4){if(!_0x10c4e4){_0x1741fc[_0x9d1c('0x1f')](0x194);}return _0x10c4e4;};}function handleError(_0x78861b,_0x5aee22){_0x5aee22=_0x5aee22||0x1f4;return function(_0x31bcd6){logger[_0x9d1c('0x2f')](_0x31bcd6[_0x9d1c('0x30')]);if(_0x31bcd6[_0x9d1c('0x31')]){delete _0x31bcd6['name'];}_0x78861b[_0x9d1c('0x20')](_0x5aee22)[_0x9d1c('0x32')](_0x31bcd6);};}exports[_0x9d1c('0x33')]=function(_0x1093ee,_0x1b77e4){var _0x35ac25={},_0x372a31={},_0x48748b={'count':0x0,'rows':[]};var _0x187f84=_[_0x9d1c('0x34')](db[_0x9d1c('0x35')][_0x9d1c('0x36')],function(_0x647851){return{'name':_0x647851[_0x9d1c('0x37')],'type':_0x647851['type'][_0x9d1c('0x38')]};});_0x372a31[_0x9d1c('0x39')]=_[_0x9d1c('0x34')](_0x187f84,_0x9d1c('0x31'));_0x372a31[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0x1093ee[_0x9d1c('0x3a')]);_0x372a31[_0x9d1c('0x3c')]=_['intersection'](_0x372a31[_0x9d1c('0x39')],_0x372a31['query']);_0x35ac25[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x372a31[_0x9d1c('0x39')],qs[_0x9d1c('0x3f')](_0x1093ee[_0x9d1c('0x3a')]['fields']));_0x35ac25[_0x9d1c('0x3d')]=_0x35ac25[_0x9d1c('0x3d')]['length']?_0x35ac25[_0x9d1c('0x3d')]:_0x372a31[_0x9d1c('0x39')];if(!_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x40')](_0x9d1c('0x41'))){_0x35ac25['limit']=qs[_0x9d1c('0x26')](_0x1093ee['query'][_0x9d1c('0x26')]);_0x35ac25[_0x9d1c('0x23')]=qs[_0x9d1c('0x23')](_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x23')]);}_0x35ac25[_0x9d1c('0x42')]=qs[_0x9d1c('0x43')](_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x43')]);_0x35ac25[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_[_0x9d1c('0x45')](_0x1093ee[_0x9d1c('0x3a')],_0x372a31['filters']),_0x187f84);if(_0x1093ee['query']['filter']){_0x35ac25['where']=_['merge'](_0x35ac25[_0x9d1c('0x44')],{'$or':_['map'](_0x187f84,function(_0x5469fe){if(_0x5469fe[_0x9d1c('0x46')]!==_0x9d1c('0x47')){var _0x3d5138={};_0x3d5138[_0x5469fe[_0x9d1c('0x31')]]={'$like':'%'+_0x1093ee[_0x9d1c('0x3a')]['filter']+'%'};return _0x3d5138;}})});}_0x35ac25=_[_0x9d1c('0x48')]({},_0x35ac25,_0x1093ee['options']);var _0x130384={'where':_0x35ac25['where']};return db[_0x9d1c('0x35')][_0x9d1c('0x25')](_0x130384)['then'](function(_0x1be8a0){_0x48748b[_0x9d1c('0x25')]=_0x1be8a0;if(_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x49')]){_0x35ac25[_0x9d1c('0x4a')]=[{'all':!![]}];}return db[_0x9d1c('0x35')][_0x9d1c('0x4b')](_0x35ac25);})[_0x9d1c('0x2c')](function(_0x595746){_0x48748b[_0x9d1c('0x4c')]=_0x595746;return _0x48748b;})[_0x9d1c('0x2c')](respondWithFilteredResult(_0x1b77e4,_0x35ac25))[_0x9d1c('0x4d')](handleError(_0x1b77e4,null));};exports[_0x9d1c('0x4e')]=function(_0x16b33a,_0x1491e3){var _0x1a4254={'raw':!![],'where':{'id':_0x16b33a['params']['id']}},_0x51f6c7={};_0x51f6c7[_0x9d1c('0x39')]=_[_0x9d1c('0x3b')](db[_0x9d1c('0x35')][_0x9d1c('0x36')]);_0x51f6c7[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0x16b33a[_0x9d1c('0x3a')]);_0x51f6c7[_0x9d1c('0x3c')]=_[_0x9d1c('0x3e')](_0x51f6c7[_0x9d1c('0x39')],_0x51f6c7[_0x9d1c('0x3a')]);_0x1a4254[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x51f6c7[_0x9d1c('0x39')],qs['fields'](_0x16b33a[_0x9d1c('0x3a')]['fields']));_0x1a4254[_0x9d1c('0x3d')]=_0x1a4254[_0x9d1c('0x3d')]['length']?_0x1a4254[_0x9d1c('0x3d')]:_0x51f6c7['model'];if(_0x16b33a[_0x9d1c('0x3a')][_0x9d1c('0x49')]){_0x1a4254[_0x9d1c('0x4a')]=[{'all':!![]}];}_0x1a4254=_[_0x9d1c('0x48')]({},_0x1a4254,_0x16b33a['options']);return db[_0x9d1c('0x35')][_0x9d1c('0x4f')](_0x1a4254)['then'](handleEntityNotFound(_0x1491e3,null))[_0x9d1c('0x2c')](respondWithResult(_0x1491e3,null))[_0x9d1c('0x4d')](handleError(_0x1491e3,null));};exports[_0x9d1c('0x50')]=function(_0xd09e2d,_0x292825){return db[_0x9d1c('0x35')][_0x9d1c('0x50')](_0xd09e2d['body'],{})['then'](function(_0x5a60a5){var _0x58da46=_0xd09e2d[_0x9d1c('0x51')][_0x9d1c('0x2d')]({'plain':!![]});if(!_0x58da46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58da46[_0x9d1c('0x52')]===_0x9d1c('0x51')){var _0x1c4002=_0x5a60a5['get']({'plain':!![]});var _0x6c4d42=_0x9d1c('0x2e');return db[_0x9d1c('0x53')]['find']({'where':{'name':_0x6c4d42,'userProfileId':_0x58da46[_0x9d1c('0x54')]},'raw':!![]})['then'](function(_0x134677){if(_0x134677&&_0x134677[_0x9d1c('0x55')]===0x0){return db[_0x9d1c('0x56')][_0x9d1c('0x50')]({'name':_0x1c4002[_0x9d1c('0x31')],'resourceId':_0x1c4002['id'],'type':_0x134677[_0x9d1c('0x31')],'sectionId':_0x134677['id']},{})[_0x9d1c('0x2c')](function(){return _0x5a60a5;});}else{return _0x5a60a5;}})[_0x9d1c('0x4d')](function(_0x5332f7){logger[_0x9d1c('0x2f')](_0x9d1c('0x57'),_0x5332f7);throw _0x5332f7;});}return _0x5a60a5;})[_0x9d1c('0x2c')](respondWithResult(_0x292825,0xc9))['catch'](handleError(_0x292825,null));};exports[_0x9d1c('0x2b')]=function(_0xa5557d,_0x5cab82){if(_0xa5557d[_0x9d1c('0x58')]['id']){delete _0xa5557d[_0x9d1c('0x58')]['id'];}return db[_0x9d1c('0x35')]['find']({'where':{'id':_0xa5557d['params']['id']}})['then'](handleEntityNotFound(_0x5cab82,null))[_0x9d1c('0x2c')](saveUpdates(_0xa5557d[_0x9d1c('0x58')],null))[_0x9d1c('0x2c')](respondWithResult(_0x5cab82,null))[_0x9d1c('0x4d')](handleError(_0x5cab82,null));};exports['destroy']=function(_0x23ccfb,_0x5bf165){return db[_0x9d1c('0x35')][_0x9d1c('0x4f')]({'where':{'id':_0x23ccfb['params']['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x5bf165,null))[_0x9d1c('0x2c')](removeEntity(_0x5bf165,null))['catch'](handleError(_0x5bf165,null));};exports[_0x9d1c('0x59')]=function(_0x566b3d,_0x2a4f65){return db['SmsQueue'][_0x9d1c('0x59')]()['then'](respondWithResult(_0x2a4f65,null))['catch'](handleError(_0x2a4f65,null));};exports[_0x9d1c('0x5a')]=function(_0xdcc01a,_0xf351db,_0x49ef91){var _0xe5a504={'raw':!![],'where':{}},_0x1945f4={},_0x53d847;return db[_0x9d1c('0x35')][_0x9d1c('0x5b')]({'where':{'id':_0xdcc01a[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0xf351db,null))[_0x9d1c('0x2c')](function(_0x3d9c6d){if(_0x3d9c6d){_0x53d847=_0x3d9c6d[_0x9d1c('0x2d')]({'plain':!![]});_0x1945f4[_0x9d1c('0x39')]=_['keys'](db[_0x9d1c('0x5d')][_0x9d1c('0x36')]);_0x1945f4[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0xdcc01a['query']);_0x1945f4['filters']=_[_0x9d1c('0x3e')](_0x1945f4[_0x9d1c('0x39')],_0x1945f4['query']);_0xe5a504[_0x9d1c('0x3d')]=_['intersection'](_0x1945f4[_0x9d1c('0x39')],qs[_0x9d1c('0x3f')](_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x3f')]));_0xe5a504[_0x9d1c('0x3d')]=_0xe5a504[_0x9d1c('0x3d')][_0x9d1c('0x5e')]?_0xe5a504[_0x9d1c('0x3d')]:_0x1945f4['model'];if(!_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x40')]('nolimit')){_0xe5a504[_0x9d1c('0x26')]=qs['limit'](_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x26')]);_0xe5a504[_0x9d1c('0x23')]=qs[_0x9d1c('0x23')](_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x23')]);}_0xe5a504[_0x9d1c('0x42')]=qs[_0x9d1c('0x43')](_0xdcc01a[_0x9d1c('0x3a')]['sort']);_0xe5a504[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_['pick'](_0xdcc01a[_0x9d1c('0x3a')],_0x1945f4[_0x9d1c('0x3c')]));_0xe5a504['where']['SmsQueueId']=_0x3d9c6d['id'];if(_0xdcc01a[_0x9d1c('0x3a')]['filter']){_0xe5a504[_0x9d1c('0x44')]=_['merge'](_0xe5a504[_0x9d1c('0x44')],{'$or':_[_0x9d1c('0x34')](_0xe5a504['attributes'],function(_0x3c7ac2){var _0x26f982={};_0x26f982[_0x3c7ac2]={'$like':'%'+_0xdcc01a['query'][_0x9d1c('0x5f')]+'%'};return _0x26f982;})});}_0xe5a504=_['merge']({},_0xe5a504,_0xdcc01a[_0x9d1c('0x60')]);return db['UserSmsQueue'][_0x9d1c('0x4b')](_0xe5a504);}})[_0x9d1c('0x2c')](function(_0x2bd2eb){if(_0x2bd2eb){return db[_0x9d1c('0x61')]['findAndCountAll']({'where':{'id':_[_0x9d1c('0x34')](_0x2bd2eb,_0x9d1c('0x62')),'role':'agent'},'attributes':['id','name','smsPause',_0x9d1c('0x63'),_0x9d1c('0x64')]});}})[_0x9d1c('0x2c')](function(_0x340cec){if(_0x340cec){return{'count':_0x340cec[_0x9d1c('0x25')],'rows':_[_0x9d1c('0x34')](_0x340cec['rows'],function(_0x36f28d){return{'membername':_0x36f28d[_0x9d1c('0x31')],'UserId':_0x36f28d['id'],'queue_name':_0x53d847[_0x9d1c('0x31')],'SmsQueueId':_0x53d847['id'],'interface':util['format'](_0x9d1c('0x65'),_0x9d1c('0x66'),_0x36f28d['name']),'penalty':0x0,'paused':_0x36f28d[_0x9d1c('0x67')],'createdAt':_0x36f28d['createdAt'],'updatedAt':_0x36f28d[_0x9d1c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9d1c('0x2c')](respondWithFilteredResult(_0xf351db,_0xe5a504))[_0x9d1c('0x4d')](handleError(_0xf351db,null));};exports[_0x9d1c('0x68')]=function(_0x3ae98c,_0x48351a,_0x146de5){var _0x379576={};var _0x566815={};var _0x29204f;var _0x45de15;return db['SmsQueue']['findOne']({'where':{'id':_0x3ae98c['params']['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x48351a,null))[_0x9d1c('0x2c')](function(_0x109d9e){if(_0x109d9e){_0x29204f=_0x109d9e;_0x566815[_0x9d1c('0x39')]=_[_0x9d1c('0x3b')](db['Team'][_0x9d1c('0x36')]);_0x566815['query']=_['keys'](_0x3ae98c['query']);_0x566815[_0x9d1c('0x3c')]=_['intersection'](_0x566815[_0x9d1c('0x39')],_0x566815['query']);_0x379576[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x566815[_0x9d1c('0x39')],qs['fields'](_0x3ae98c[_0x9d1c('0x3a')][_0x9d1c('0x3f')]));_0x379576[_0x9d1c('0x3d')]=_0x379576[_0x9d1c('0x3d')]['length']?_0x379576[_0x9d1c('0x3d')]:_0x566815[_0x9d1c('0x39')];_0x379576[_0x9d1c('0x42')]=qs['sort'](_0x3ae98c[_0x9d1c('0x3a')]['sort']);_0x379576[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_['pick'](_0x3ae98c[_0x9d1c('0x3a')],_0x566815[_0x9d1c('0x3c')]));if(_0x3ae98c[_0x9d1c('0x3a')][_0x9d1c('0x5f')]){_0x379576[_0x9d1c('0x44')]=_['merge'](_0x379576['where'],{'$or':_[_0x9d1c('0x34')](_0x379576[_0x9d1c('0x3d')],function(_0x7f0d3d){var _0x47adbb={};_0x47adbb[_0x7f0d3d]={'$like':'%'+_0x3ae98c['query']['filter']+'%'};return _0x47adbb;})});}_0x379576=_[_0x9d1c('0x48')]({},_0x379576,_0x3ae98c['options']);return _0x29204f[_0x9d1c('0x68')](_0x379576);}})[_0x9d1c('0x2c')](function(_0x20af03){if(_0x20af03){_0x45de15=_0x20af03[_0x9d1c('0x5e')];if(!_0x3ae98c[_0x9d1c('0x3a')]['hasOwnProperty'](_0x9d1c('0x41'))){_0x379576[_0x9d1c('0x26')]=qs[_0x9d1c('0x26')](_0x3ae98c[_0x9d1c('0x3a')][_0x9d1c('0x26')]);_0x379576[_0x9d1c('0x23')]=qs['offset'](_0x3ae98c['query']['offset']);}return _0x29204f[_0x9d1c('0x68')](_0x379576);}})[_0x9d1c('0x2c')](function(_0x3cf190){if(_0x3cf190){return _0x3cf190?{'count':_0x45de15,'rows':_0x3cf190}:null;}})['then'](respondWithResult(_0x48351a,null))[_0x9d1c('0x4d')](handleError(_0x48351a,null));};exports[_0x9d1c('0x69')]=function(_0x95ed87,_0x459277,_0x54297e){var _0x555c94=_0x95ed87[_0x9d1c('0x58')][_0x9d1c('0x6a')];return db[_0x9d1c('0x6b')][_0x9d1c('0x4b')]({'where':{'id':_0x555c94},'attributes':['id'],'include':[{'model':db[_0x9d1c('0x61')],'as':_0x9d1c('0x6c'),'attributes':['id',_0x9d1c('0x31'),_0x9d1c('0x6d'),_0x9d1c('0x6e'),'interface'],'raw':!![]}]})[_0x9d1c('0x2c')](function(_0x4877ca){if(_0x4877ca){var _0x1b119e=_[_0x9d1c('0x6f')](_0x4877ca,function(_0x59839d){var _0x1e753d=_0x59839d[_0x9d1c('0x2d')]({'plain':!![]});return _0x1e753d[_0x9d1c('0x6c')];});return db[_0x9d1c('0x35')][_0x9d1c('0x4f')]({'where':{'id':_0x95ed87[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](function(_0x9e3079){return db['sequelize'][_0x9d1c('0x70')](function(_0x3ef65b){return _0x9e3079['addTeams'](_0x555c94,{'transaction':_0x3ef65b})[_0x9d1c('0x2c')](function(){return BPromise[_0x9d1c('0x71')](_0x1b119e,function(_0x5cea88){return db[_0x9d1c('0x5d')][_0x9d1c('0x72')]({'where':{'UserId':_0x5cea88['id'],'SmsQueueId':_0x95ed87[_0x9d1c('0x5c')]['id']},'transaction':_0x3ef65b});});})[_0x9d1c('0x2c')](function(){_0x1b119e[_0x9d1c('0x73')](function(_0x21dc48){socket[_0x9d1c('0x74')](_0x9d1c('0x75'),{'UserId':_0x21dc48['id'],'SmsQueueId':_0x9e3079['id']});});});});});}})[_0x9d1c('0x2c')](respondWithStatusCode(_0x459277,null))['catch'](handleError(_0x459277,null));};exports[_0x9d1c('0x76')]=function(_0x4f38cf,_0x3c640b,_0x54a44f){return db['Team'][_0x9d1c('0x4b')]({'where':{'id':_0x4f38cf[_0x9d1c('0x3a')][_0x9d1c('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x9d1c('0x61')],'as':_0x9d1c('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x9d1c('0x2c')](handleEntityNotFound(_0x3c640b,null))[_0x9d1c('0x2c')](function(_0x1c0082){var _0x4998ed=_[_0x9d1c('0x34')](_0x1c0082,'id');var _0x14e980=[];var _0x3584c8=[];var _0xd53d18=squel[_0x9d1c('0x77')]();_0xd53d18['field']('tq.TeamId')['from']('team_has_sms_queues','tq')[_0x9d1c('0x78')]('user_has_teams','ut',_0x9d1c('0x79'))[_0x9d1c('0x44')](_0x9d1c('0x7a'),_0x4f38cf[_0x9d1c('0x5c')]['id']);for(var _0x503526=0x0;_0x503526<_0x1c0082[_0x9d1c('0x5e')];_0x503526+=0x1){let _0x551077=_0x1c0082[_0x503526];for(var _0x1e87a4=0x0;_0x1e87a4<_0x551077['Agents']['length'];_0x1e87a4+=0x1){let _0x19e3c5=_0x551077[_0x9d1c('0x6c')][_0x1e87a4];var _0x1b692c=_0xd53d18[_0x9d1c('0x7b')]();_0x1b692c[_0x9d1c('0x44')]('ut.UserId\x20=\x20?',_0x19e3c5['id']);_0x3584c8['push'](db[_0x9d1c('0x7c')][_0x9d1c('0x3a')](_0x1b692c['toString'](),{'type':db[_0x9d1c('0x7c')][_0x9d1c('0x7d')]['SELECT']})[_0x9d1c('0x2c')](function(_0x59e2eb){if(_0x59e2eb[_0x9d1c('0x5e')]===0x1){return _0x19e3c5['id'];}else{var _0x1f9763=_['every'](_['map'](_0x59e2eb,_0x9d1c('0x7e')),function(_0x2ee39a){return _[_0x9d1c('0x7f')](_0x4998ed,_0x2ee39a);});if(_0x1f9763){return _0x19e3c5['id'];}}}));}}return BPromise[_0x9d1c('0x80')](_0x3584c8)[_0x9d1c('0x2c')](function(_0x567124){_0x14e980=_(_0x14e980)[_0x9d1c('0x81')](_0x567124)[_0x9d1c('0x82')]()[_0x9d1c('0x83')]();return db[_0x9d1c('0x35')][_0x9d1c('0x4f')]({'where':{'id':_0x4f38cf[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](function(_0x416c30){return db[_0x9d1c('0x7c')][_0x9d1c('0x70')](function(_0x335e0d){return _0x416c30['removeTeams'](_0x4f38cf[_0x9d1c('0x3a')][_0x9d1c('0x6a')],{'transaction':_0x335e0d})[_0x9d1c('0x2c')](function(){if(!_[_0x9d1c('0x84')](_0x14e980)){return _0x416c30[_0x9d1c('0x85')](_0x14e980,{'transaction':_0x335e0d});}})[_0x9d1c('0x2c')](function(){_0x14e980[_0x9d1c('0x73')](function(_0x2da73d){socket[_0x9d1c('0x74')](_0x9d1c('0x86'),{'UserId':_0x2da73d,'SmsQueueId':_0x416c30['id']});});});});});});})['then'](respondWithStatusCode(_0x3c640b,null))[_0x9d1c('0x4d')](handleError(_0x3c640b,null));};exports[_0x9d1c('0x87')]=function(_0x116aba,_0x2dcaba,_0xcdf598){return db[_0x9d1c('0x35')]['find']({'where':{'id':_0x116aba[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x2dcaba,null))[_0x9d1c('0x2c')](function(_0x21b27e){if(_0x21b27e){return _0x21b27e['addAgents'](_0x116aba['body'][_0x9d1c('0x6a')],_[_0x9d1c('0x88')](_0x116aba[_0x9d1c('0x58')],[_0x9d1c('0x6a'),'id'])||{})[_0x9d1c('0x89')](function(_0x5b1851){for(var _0x1ed479=0x0;_0x1ed479<_0x116aba[_0x9d1c('0x58')][_0x9d1c('0x6a')]['length'];_0x1ed479+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x116aba[_0x9d1c('0x58')][_0x9d1c('0x6a')][_0x1ed479]),'SmsQueueId':Number(_0x116aba[_0x9d1c('0x5c')]['id'])});}return _0x5b1851;});}})['then'](respondWithResult(_0x2dcaba,null))['catch'](handleError(_0x2dcaba,null));};exports[_0x9d1c('0x85')]=function(_0x3d7643,_0x5449ef,_0x1bd0b8){return db['SmsQueue']['find']({'where':{'id':_0x3d7643['params']['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x5449ef,null))['then'](function(_0x235580){if(_0x235580){return _0x235580[_0x9d1c('0x85')](_0x3d7643[_0x9d1c('0x3a')][_0x9d1c('0x6a')])[_0x9d1c('0x2c')](function(){if(_[_0x9d1c('0x8a')](_0x3d7643['query']['ids'])){for(var _0x381108=0x0;_0x381108<_0x3d7643['query'][_0x9d1c('0x6a')]['length'];_0x381108+=0x1){socket['emit'](_0x9d1c('0x86'),{'UserId':Number(_0x3d7643[_0x9d1c('0x3a')][_0x9d1c('0x6a')][_0x381108]),'SmsQueueId':Number(_0x3d7643['params']['id'])});}}else{socket[_0x9d1c('0x74')](_0x9d1c('0x86'),{'UserId':Number(_0x3d7643['query'][_0x9d1c('0x6a')]),'SmsQueueId':Number(_0x3d7643[_0x9d1c('0x5c')]['id'])});}});}})[_0x9d1c('0x2c')](respondWithStatusCode(_0x5449ef,null))[_0x9d1c('0x4d')](handleError(_0x5449ef,null));};exports[_0x9d1c('0x8b')]=function(_0x31b87c,_0x32cdf1,_0x478f75){var _0x55e0b0={};var _0x526016={};var _0x376f79;var _0x9ac30a;return db[_0x9d1c('0x35')][_0x9d1c('0x5b')]({'where':{'id':_0x31b87c[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x32cdf1,null))['then'](function(_0x3445ce){if(_0x3445ce){_0x376f79=_0x3445ce;_0x526016['model']=_['keys'](db[_0x9d1c('0x61')]['rawAttributes']);_0x526016[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0x31b87c[_0x9d1c('0x3a')]);_0x526016[_0x9d1c('0x3c')]=_[_0x9d1c('0x3e')](_0x526016[_0x9d1c('0x39')],_0x526016[_0x9d1c('0x3a')]);_0x55e0b0[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x526016[_0x9d1c('0x39')],qs['fields'](_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x3f')]));_0x55e0b0['attributes']=_0x55e0b0['attributes'][_0x9d1c('0x5e')]?_0x55e0b0[_0x9d1c('0x3d')]:_0x526016[_0x9d1c('0x39')];_0x55e0b0['order']=qs['sort'](_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x43')]);_0x55e0b0[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_[_0x9d1c('0x45')](_0x31b87c[_0x9d1c('0x3a')],_0x526016['filters']));if(_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x5f')]){_0x55e0b0[_0x9d1c('0x44')]=_[_0x9d1c('0x48')](_0x55e0b0[_0x9d1c('0x44')],{'$or':_[_0x9d1c('0x34')](_0x55e0b0[_0x9d1c('0x3d')],function(_0x29f148){var _0x48a7c2={};_0x48a7c2[_0x29f148]={'$like':'%'+_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x5f')]+'%'};return _0x48a7c2;})});}_0x55e0b0=_[_0x9d1c('0x48')]({},_0x55e0b0,_0x31b87c[_0x9d1c('0x60')]);return _0x376f79[_0x9d1c('0x8b')](_0x55e0b0);}})[_0x9d1c('0x2c')](function(_0x1adb97){if(_0x1adb97){_0x9ac30a=_0x1adb97[_0x9d1c('0x5e')];if(!_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x40')](_0x9d1c('0x41'))){_0x55e0b0[_0x9d1c('0x26')]=qs['limit'](_0x31b87c['query'][_0x9d1c('0x26')]);_0x55e0b0[_0x9d1c('0x23')]=qs[_0x9d1c('0x23')](_0x31b87c['query']['offset']);}return _0x376f79[_0x9d1c('0x8b')](_0x55e0b0);}})[_0x9d1c('0x2c')](function(_0xa839db){if(_0xa839db){return _0xa839db?{'count':_0x9ac30a,'rows':_0xa839db}:null;}})[_0x9d1c('0x2c')](respondWithResult(_0x32cdf1,null))['catch'](handleError(_0x32cdf1,null));}; \ No newline at end of file +var _0x0bf7=['pick','SmsQueueId','User','UserId','smsPause','createdAt','SIP','updatedAt','getTeams','Team','nolimit','addTeams','ids','findAll','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','includeAll','include','rows','catch','params','keys','options','find','body','user','UserProfileSection','autoAssociation','create','describe','getMembers','findOne','UserSmsQueue'];(function(_0x41d2d4,_0x12bcf4){var _0x225e0f=function(_0x8464f5){while(--_0x8464f5){_0x41d2d4['push'](_0x41d2d4['shift']());}};_0x225e0f(++_0x12bcf4);}(_0x0bf7,0x14a));var _0x70bf=function(_0x17b446,_0x3271a5){_0x17b446=_0x17b446-0x0;var _0x4f650e=_0x0bf7[_0x17b446];return _0x4f650e;};'use strict';var emlformat=require(_0x70bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70bf('0x1'));var jsonpatch=require(_0x70bf('0x2'));var rp=require(_0x70bf('0x3'));var moment=require(_0x70bf('0x4'));var BPromise=require(_0x70bf('0x5'));var Mustache=require(_0x70bf('0x6'));var util=require('util');var path=require(_0x70bf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70bf('0x8'));var _=require(_0x70bf('0x9'));var squel=require(_0x70bf('0xa'));var crypto=require(_0x70bf('0xb'));var jsforce=require(_0x70bf('0xc'));var deskjs=require(_0x70bf('0xd'));var toCsv=require(_0x70bf('0xe'));var querystring=require(_0x70bf('0xf'));var Papa=require(_0x70bf('0x10'));var Redis=require(_0x70bf('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x70bf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70bf('0x13'))(_0x70bf('0x14'));var utils=require(_0x70bf('0x15'));var config=require(_0x70bf('0x16'));var licenseUtil=require(_0x70bf('0x17'));var db=require('../../mysqldb')['db'];config[_0x70bf('0x18')]=_[_0x70bf('0x19')](config[_0x70bf('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x70bf('0x1a'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x70bf('0x1b')](socket);function respondWithStatusCode(_0x15379f,_0x58a8fa){_0x58a8fa=_0x58a8fa||0xcc;return function(_0x267e1e){if(_0x267e1e){return _0x15379f['sendStatus'](_0x58a8fa);}return _0x15379f[_0x70bf('0x1c')](_0x58a8fa)['end']();};}function respondWithResult(_0x5cc8b1,_0x38d6aa){_0x38d6aa=_0x38d6aa||0xc8;return function(_0x428d22){if(_0x428d22){return _0x5cc8b1[_0x70bf('0x1c')](_0x38d6aa)[_0x70bf('0x1d')](_0x428d22);}};}function respondWithFilteredResult(_0x1ffacf,_0x2cafc4){return function(_0x4ecd00){if(_0x4ecd00){var _0x2bcf03=typeof _0x2cafc4[_0x70bf('0x1e')]===_0x70bf('0x1f')&&typeof _0x2cafc4['limit']===_0x70bf('0x1f');var _0x5378f3=_0x4ecd00[_0x70bf('0x20')];var _0x2c11d6=_0x2bcf03?0x0:_0x2cafc4['offset'];var _0x2ca24a=_0x2bcf03?_0x4ecd00[_0x70bf('0x20')]:_0x2cafc4['offset']+_0x2cafc4[_0x70bf('0x21')];var _0x5424a6;if(_0x2ca24a>=_0x5378f3){_0x2ca24a=_0x5378f3;_0x5424a6=0xc8;}else{_0x5424a6=0xce;}_0x1ffacf[_0x70bf('0x1c')](_0x5424a6);return _0x1ffacf['set'](_0x70bf('0x22'),_0x2c11d6+'-'+_0x2ca24a+'/'+_0x5378f3)[_0x70bf('0x1d')](_0x4ecd00);}return null;};}function patchUpdates(_0x25ac2d){return function(_0x1dee19){try{jsonpatch[_0x70bf('0x23')](_0x1dee19,_0x25ac2d,!![]);}catch(_0x4dfe63){return BPromise[_0x70bf('0x24')](_0x4dfe63);}return _0x1dee19[_0x70bf('0x25')]();};}function saveUpdates(_0x412716,_0x5eb4c8){return function(_0x266065){if(_0x266065){return _0x266065[_0x70bf('0x26')](_0x412716)[_0x70bf('0x27')](function(_0x54ffd6){return _0x54ffd6;});}return null;};}function removeEntity(_0x1fa144,_0x4c028f){return function(_0x5ca4a9){if(_0x5ca4a9){return _0x5ca4a9[_0x70bf('0x28')]()[_0x70bf('0x27')](function(){var _0x1d9896=_0x5ca4a9[_0x70bf('0x29')]({'plain':!![]});var _0x62b2a4=_0x70bf('0x2a');return db[_0x70bf('0x2b')][_0x70bf('0x28')]({'where':{'type':_0x62b2a4,'resourceId':_0x1d9896['id']}})['then'](function(){return _0x5ca4a9;});})[_0x70bf('0x27')](function(){_0x1fa144[_0x70bf('0x1c')](0xcc)[_0x70bf('0x2c')]();});}};}function handleEntityNotFound(_0x270775,_0xe9bbaf){return function(_0x13348b){if(!_0x13348b){_0x270775[_0x70bf('0x2d')](0x194);}return _0x13348b;};}function handleError(_0x834fe3,_0x356db2){_0x356db2=_0x356db2||0x1f4;return function(_0x103fdb){logger[_0x70bf('0x2e')](_0x103fdb[_0x70bf('0x2f')]);if(_0x103fdb[_0x70bf('0x30')]){delete _0x103fdb[_0x70bf('0x30')];}_0x834fe3[_0x70bf('0x1c')](_0x356db2)[_0x70bf('0x31')](_0x103fdb);};}exports[_0x70bf('0x32')]=function(_0x2d9636,_0x24d1d8){var _0x1055ed={},_0x13750b={},_0x5ce45b={'count':0x0,'rows':[]};var _0x20ce4b=_[_0x70bf('0x33')](db[_0x70bf('0x34')][_0x70bf('0x35')],function(_0x1d2a74){return{'name':_0x1d2a74[_0x70bf('0x36')],'type':_0x1d2a74[_0x70bf('0x37')][_0x70bf('0x38')]};});_0x13750b[_0x70bf('0x39')]=_['map'](_0x20ce4b,_0x70bf('0x30'));_0x13750b[_0x70bf('0x3a')]=_['keys'](_0x2d9636[_0x70bf('0x3a')]);_0x13750b[_0x70bf('0x3b')]=_['intersection'](_0x13750b['model'],_0x13750b['query']);_0x1055ed[_0x70bf('0x3c')]=_[_0x70bf('0x3d')](_0x13750b[_0x70bf('0x39')],qs[_0x70bf('0x3e')](_0x2d9636[_0x70bf('0x3a')][_0x70bf('0x3e')]));_0x1055ed[_0x70bf('0x3c')]=_0x1055ed[_0x70bf('0x3c')][_0x70bf('0x3f')]?_0x1055ed[_0x70bf('0x3c')]:_0x13750b[_0x70bf('0x39')];if(!_0x2d9636[_0x70bf('0x3a')][_0x70bf('0x40')]('nolimit')){_0x1055ed[_0x70bf('0x21')]=qs['limit'](_0x2d9636[_0x70bf('0x3a')][_0x70bf('0x21')]);_0x1055ed[_0x70bf('0x1e')]=qs[_0x70bf('0x1e')](_0x2d9636['query'][_0x70bf('0x1e')]);}_0x1055ed[_0x70bf('0x41')]=qs['sort'](_0x2d9636[_0x70bf('0x3a')][_0x70bf('0x42')]);_0x1055ed['where']=qs[_0x70bf('0x3b')](_['pick'](_0x2d9636['query'],_0x13750b[_0x70bf('0x3b')]),_0x20ce4b);if(_0x2d9636[_0x70bf('0x3a')][_0x70bf('0x43')]){_0x1055ed[_0x70bf('0x44')]=_[_0x70bf('0x45')](_0x1055ed[_0x70bf('0x44')],{'$or':_[_0x70bf('0x33')](_0x20ce4b,function(_0x349ab6){if(_0x349ab6['type']!=='VIRTUAL'){var _0x1d819e={};_0x1d819e[_0x349ab6[_0x70bf('0x30')]]={'$like':'%'+_0x2d9636['query'][_0x70bf('0x43')]+'%'};return _0x1d819e;}})});}_0x1055ed=_[_0x70bf('0x45')]({},_0x1055ed,_0x2d9636['options']);var _0x10dad0={'where':_0x1055ed[_0x70bf('0x44')]};return db[_0x70bf('0x34')][_0x70bf('0x20')](_0x10dad0)[_0x70bf('0x27')](function(_0x2b442e){_0x5ce45b['count']=_0x2b442e;if(_0x2d9636[_0x70bf('0x3a')][_0x70bf('0x46')]){_0x1055ed[_0x70bf('0x47')]=[{'all':!![]}];}return db[_0x70bf('0x34')]['findAll'](_0x1055ed);})['then'](function(_0x5dc43a){_0x5ce45b[_0x70bf('0x48')]=_0x5dc43a;return _0x5ce45b;})[_0x70bf('0x27')](respondWithFilteredResult(_0x24d1d8,_0x1055ed))[_0x70bf('0x49')](handleError(_0x24d1d8,null));};exports['show']=function(_0x2dbc4a,_0x226605){var _0x2fb97f={'raw':!![],'where':{'id':_0x2dbc4a[_0x70bf('0x4a')]['id']}},_0x1158a0={};_0x1158a0['model']=_[_0x70bf('0x4b')](db[_0x70bf('0x34')][_0x70bf('0x35')]);_0x1158a0[_0x70bf('0x3a')]=_[_0x70bf('0x4b')](_0x2dbc4a[_0x70bf('0x3a')]);_0x1158a0['filters']=_['intersection'](_0x1158a0['model'],_0x1158a0[_0x70bf('0x3a')]);_0x2fb97f[_0x70bf('0x3c')]=_[_0x70bf('0x3d')](_0x1158a0[_0x70bf('0x39')],qs[_0x70bf('0x3e')](_0x2dbc4a[_0x70bf('0x3a')]['fields']));_0x2fb97f[_0x70bf('0x3c')]=_0x2fb97f[_0x70bf('0x3c')][_0x70bf('0x3f')]?_0x2fb97f['attributes']:_0x1158a0[_0x70bf('0x39')];if(_0x2dbc4a[_0x70bf('0x3a')][_0x70bf('0x46')]){_0x2fb97f[_0x70bf('0x47')]=[{'all':!![]}];}_0x2fb97f=_['merge']({},_0x2fb97f,_0x2dbc4a[_0x70bf('0x4c')]);return db[_0x70bf('0x34')][_0x70bf('0x4d')](_0x2fb97f)[_0x70bf('0x27')](handleEntityNotFound(_0x226605,null))[_0x70bf('0x27')](respondWithResult(_0x226605,null))[_0x70bf('0x49')](handleError(_0x226605,null));};exports['create']=function(_0x2afcc4,_0x26ff3c){return db['SmsQueue']['create'](_0x2afcc4[_0x70bf('0x4e')],{})[_0x70bf('0x27')](function(_0x19849c){var _0x22ff6a=_0x2afcc4[_0x70bf('0x4f')][_0x70bf('0x29')]({'plain':!![]});if(!_0x22ff6a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22ff6a['role']==='user'){var _0x12a060=_0x19849c[_0x70bf('0x29')]({'plain':!![]});var _0x1bce42=_0x70bf('0x2a');return db[_0x70bf('0x50')][_0x70bf('0x4d')]({'where':{'name':_0x1bce42,'userProfileId':_0x22ff6a['userProfileId']},'raw':!![]})[_0x70bf('0x27')](function(_0x11b98e){if(_0x11b98e&&_0x11b98e[_0x70bf('0x51')]===0x0){return db[_0x70bf('0x2b')][_0x70bf('0x52')]({'name':_0x12a060[_0x70bf('0x30')],'resourceId':_0x12a060['id'],'type':_0x11b98e[_0x70bf('0x30')],'sectionId':_0x11b98e['id']},{})['then'](function(){return _0x19849c;});}else{return _0x19849c;}})['catch'](function(_0x1f6fd4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f6fd4);throw _0x1f6fd4;});}return _0x19849c;})[_0x70bf('0x27')](respondWithResult(_0x26ff3c,0xc9))[_0x70bf('0x49')](handleError(_0x26ff3c,null));};exports['update']=function(_0x1d08af,_0x3abbc3){if(_0x1d08af[_0x70bf('0x4e')]['id']){delete _0x1d08af['body']['id'];}return db['SmsQueue'][_0x70bf('0x4d')]({'where':{'id':_0x1d08af[_0x70bf('0x4a')]['id']}})[_0x70bf('0x27')](handleEntityNotFound(_0x3abbc3,null))[_0x70bf('0x27')](saveUpdates(_0x1d08af['body'],null))['then'](respondWithResult(_0x3abbc3,null))[_0x70bf('0x49')](handleError(_0x3abbc3,null));};exports[_0x70bf('0x28')]=function(_0x106707,_0x56906b){return db[_0x70bf('0x34')][_0x70bf('0x4d')]({'where':{'id':_0x106707[_0x70bf('0x4a')]['id']}})[_0x70bf('0x27')](handleEntityNotFound(_0x56906b,null))[_0x70bf('0x27')](removeEntity(_0x56906b,null))[_0x70bf('0x49')](handleError(_0x56906b,null));};exports[_0x70bf('0x53')]=function(_0x1892f5,_0x14e6ec){return db['SmsQueue']['describe']()[_0x70bf('0x27')](respondWithResult(_0x14e6ec,null))['catch'](handleError(_0x14e6ec,null));};exports[_0x70bf('0x54')]=function(_0x3dfe01,_0x1ab7a3,_0x557e8a){var _0x3d03ab={'raw':!![],'where':{}},_0x41db5c={},_0x13f01b;return db['SmsQueue'][_0x70bf('0x55')]({'where':{'id':_0x3dfe01[_0x70bf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ab7a3,null))[_0x70bf('0x27')](function(_0x69af4c){if(_0x69af4c){_0x13f01b=_0x69af4c[_0x70bf('0x29')]({'plain':!![]});_0x41db5c['model']=_['keys'](db[_0x70bf('0x56')][_0x70bf('0x35')]);_0x41db5c['query']=_[_0x70bf('0x4b')](_0x3dfe01['query']);_0x41db5c['filters']=_['intersection'](_0x41db5c[_0x70bf('0x39')],_0x41db5c[_0x70bf('0x3a')]);_0x3d03ab[_0x70bf('0x3c')]=_[_0x70bf('0x3d')](_0x41db5c['model'],qs['fields'](_0x3dfe01[_0x70bf('0x3a')][_0x70bf('0x3e')]));_0x3d03ab['attributes']=_0x3d03ab[_0x70bf('0x3c')]['length']?_0x3d03ab[_0x70bf('0x3c')]:_0x41db5c[_0x70bf('0x39')];if(!_0x3dfe01[_0x70bf('0x3a')][_0x70bf('0x40')]('nolimit')){_0x3d03ab[_0x70bf('0x21')]=qs[_0x70bf('0x21')](_0x3dfe01[_0x70bf('0x3a')][_0x70bf('0x21')]);_0x3d03ab['offset']=qs['offset'](_0x3dfe01['query']['offset']);}_0x3d03ab[_0x70bf('0x41')]=qs[_0x70bf('0x42')](_0x3dfe01[_0x70bf('0x3a')][_0x70bf('0x42')]);_0x3d03ab[_0x70bf('0x44')]=qs[_0x70bf('0x3b')](_[_0x70bf('0x57')](_0x3dfe01[_0x70bf('0x3a')],_0x41db5c[_0x70bf('0x3b')]));_0x3d03ab[_0x70bf('0x44')][_0x70bf('0x58')]=_0x69af4c['id'];if(_0x3dfe01[_0x70bf('0x3a')][_0x70bf('0x43')]){_0x3d03ab[_0x70bf('0x44')]=_[_0x70bf('0x45')](_0x3d03ab[_0x70bf('0x44')],{'$or':_['map'](_0x3d03ab[_0x70bf('0x3c')],function(_0x303253){var _0x2c511c={};_0x2c511c[_0x303253]={'$like':'%'+_0x3dfe01[_0x70bf('0x3a')][_0x70bf('0x43')]+'%'};return _0x2c511c;})});}_0x3d03ab=_[_0x70bf('0x45')]({},_0x3d03ab,_0x3dfe01[_0x70bf('0x4c')]);return db[_0x70bf('0x56')]['findAll'](_0x3d03ab);}})[_0x70bf('0x27')](function(_0x5aec4e){if(_0x5aec4e){return db[_0x70bf('0x59')]['findAndCountAll']({'where':{'id':_[_0x70bf('0x33')](_0x5aec4e,_0x70bf('0x5a')),'role':'agent'},'attributes':['id',_0x70bf('0x30'),_0x70bf('0x5b'),'updatedAt',_0x70bf('0x5c')]});}})['then'](function(_0x272120){if(_0x272120){return{'count':_0x272120[_0x70bf('0x20')],'rows':_[_0x70bf('0x33')](_0x272120[_0x70bf('0x48')],function(_0x5b4996){return{'membername':_0x5b4996[_0x70bf('0x30')],'UserId':_0x5b4996['id'],'queue_name':_0x13f01b[_0x70bf('0x30')],'SmsQueueId':_0x13f01b['id'],'interface':util['format']('%s/%s',_0x70bf('0x5d'),_0x5b4996[_0x70bf('0x30')]),'penalty':0x0,'paused':_0x5b4996[_0x70bf('0x5b')],'createdAt':_0x5b4996[_0x70bf('0x5c')],'updatedAt':_0x5b4996[_0x70bf('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x70bf('0x27')](respondWithFilteredResult(_0x1ab7a3,_0x3d03ab))[_0x70bf('0x49')](handleError(_0x1ab7a3,null));};exports[_0x70bf('0x5f')]=function(_0x28a8ea,_0x36cafb,_0xb221f6){var _0x480deb={};var _0x31da53={};var _0x407577;var _0x809869;return db[_0x70bf('0x34')]['findOne']({'where':{'id':_0x28a8ea[_0x70bf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x36cafb,null))[_0x70bf('0x27')](function(_0x1d8661){if(_0x1d8661){_0x407577=_0x1d8661;_0x31da53[_0x70bf('0x39')]=_[_0x70bf('0x4b')](db[_0x70bf('0x60')][_0x70bf('0x35')]);_0x31da53[_0x70bf('0x3a')]=_[_0x70bf('0x4b')](_0x28a8ea['query']);_0x31da53[_0x70bf('0x3b')]=_[_0x70bf('0x3d')](_0x31da53['model'],_0x31da53[_0x70bf('0x3a')]);_0x480deb[_0x70bf('0x3c')]=_[_0x70bf('0x3d')](_0x31da53[_0x70bf('0x39')],qs[_0x70bf('0x3e')](_0x28a8ea[_0x70bf('0x3a')][_0x70bf('0x3e')]));_0x480deb['attributes']=_0x480deb[_0x70bf('0x3c')]['length']?_0x480deb[_0x70bf('0x3c')]:_0x31da53[_0x70bf('0x39')];_0x480deb['order']=qs[_0x70bf('0x42')](_0x28a8ea['query'][_0x70bf('0x42')]);_0x480deb[_0x70bf('0x44')]=qs[_0x70bf('0x3b')](_[_0x70bf('0x57')](_0x28a8ea['query'],_0x31da53['filters']));if(_0x28a8ea[_0x70bf('0x3a')][_0x70bf('0x43')]){_0x480deb['where']=_[_0x70bf('0x45')](_0x480deb[_0x70bf('0x44')],{'$or':_[_0x70bf('0x33')](_0x480deb[_0x70bf('0x3c')],function(_0x47aff8){var _0x82c9d2={};_0x82c9d2[_0x47aff8]={'$like':'%'+_0x28a8ea['query'][_0x70bf('0x43')]+'%'};return _0x82c9d2;})});}_0x480deb=_[_0x70bf('0x45')]({},_0x480deb,_0x28a8ea['options']);return _0x407577['getTeams'](_0x480deb);}})['then'](function(_0x23ffb){if(_0x23ffb){_0x809869=_0x23ffb[_0x70bf('0x3f')];if(!_0x28a8ea['query']['hasOwnProperty'](_0x70bf('0x61'))){_0x480deb[_0x70bf('0x21')]=qs[_0x70bf('0x21')](_0x28a8ea[_0x70bf('0x3a')][_0x70bf('0x21')]);_0x480deb[_0x70bf('0x1e')]=qs[_0x70bf('0x1e')](_0x28a8ea[_0x70bf('0x3a')][_0x70bf('0x1e')]);}return _0x407577[_0x70bf('0x5f')](_0x480deb);}})['then'](function(_0x250402){if(_0x250402){return _0x250402?{'count':_0x809869,'rows':_0x250402}:null;}})[_0x70bf('0x27')](respondWithResult(_0x36cafb,null))[_0x70bf('0x49')](handleError(_0x36cafb,null));};exports[_0x70bf('0x62')]=function(_0x113470,_0x3d0453,_0x396c52){var _0x1987c6=_0x113470[_0x70bf('0x4e')][_0x70bf('0x63')];return db[_0x70bf('0x60')][_0x70bf('0x64')]({'where':{'id':_0x1987c6},'attributes':['id'],'include':[{'model':db[_0x70bf('0x59')],'as':_0x70bf('0x65'),'attributes':['id',_0x70bf('0x30'),_0x70bf('0x66'),_0x70bf('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x1b09de){if(_0x1b09de){var _0x566e9c=_[_0x70bf('0x68')](_0x1b09de,function(_0x2e0dc7){var _0x1c8dab=_0x2e0dc7[_0x70bf('0x29')]({'plain':!![]});return _0x1c8dab[_0x70bf('0x65')];});return db['SmsQueue'][_0x70bf('0x4d')]({'where':{'id':_0x113470[_0x70bf('0x4a')]['id']}})[_0x70bf('0x27')](function(_0x1638b1){return db[_0x70bf('0x69')][_0x70bf('0x6a')](function(_0x48924f){return _0x1638b1['addTeams'](_0x1987c6,{'transaction':_0x48924f})[_0x70bf('0x27')](function(){return BPromise[_0x70bf('0x6b')](_0x566e9c,function(_0x1cfdfd){return db[_0x70bf('0x56')][_0x70bf('0x6c')]({'where':{'UserId':_0x1cfdfd['id'],'SmsQueueId':_0x113470[_0x70bf('0x4a')]['id']},'transaction':_0x48924f});});})['then'](function(){_0x566e9c[_0x70bf('0x6d')](function(_0x4b7fa4){socket[_0x70bf('0x6e')](_0x70bf('0x6f'),{'UserId':_0x4b7fa4['id'],'SmsQueueId':_0x1638b1['id']});});});});});}})[_0x70bf('0x27')](respondWithStatusCode(_0x3d0453,null))[_0x70bf('0x49')](handleError(_0x3d0453,null));};exports[_0x70bf('0x70')]=function(_0x38ef62,_0xe62135,_0x35af13){return db[_0x70bf('0x60')][_0x70bf('0x64')]({'where':{'id':_0x38ef62[_0x70bf('0x3a')][_0x70bf('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x70bf('0x65'),'attributes':['id'],'raw':!![]}]})[_0x70bf('0x27')](handleEntityNotFound(_0xe62135,null))['then'](function(_0x41a9d4){var _0x1b00b3=_[_0x70bf('0x33')](_0x41a9d4,'id');var _0x41ff4d=[];var _0x413452=[];var _0x2acbda=squel[_0x70bf('0x71')]();_0x2acbda['field'](_0x70bf('0x72'))[_0x70bf('0x73')]('team_has_sms_queues','tq')[_0x70bf('0x74')](_0x70bf('0x75'),'ut',_0x70bf('0x76'))[_0x70bf('0x44')](_0x70bf('0x77'),_0x38ef62[_0x70bf('0x4a')]['id']);for(var _0x3c9ef2=0x0;_0x3c9ef2<_0x41a9d4[_0x70bf('0x3f')];_0x3c9ef2+=0x1){let _0x14b4b5=_0x41a9d4[_0x3c9ef2];for(var _0x420859=0x0;_0x420859<_0x14b4b5[_0x70bf('0x65')][_0x70bf('0x3f')];_0x420859+=0x1){let _0x36dc1a=_0x14b4b5[_0x70bf('0x65')][_0x420859];var _0x2d8e0f=_0x2acbda[_0x70bf('0x78')]();_0x2d8e0f[_0x70bf('0x44')]('ut.UserId\x20=\x20?',_0x36dc1a['id']);_0x413452[_0x70bf('0x79')](db[_0x70bf('0x69')][_0x70bf('0x3a')](_0x2d8e0f[_0x70bf('0x7a')](),{'type':db[_0x70bf('0x69')][_0x70bf('0x7b')][_0x70bf('0x7c')]})['then'](function(_0x1a672b){if(_0x1a672b[_0x70bf('0x3f')]===0x1){return _0x36dc1a['id'];}else{var _0x2d6858=_[_0x70bf('0x7d')](_[_0x70bf('0x33')](_0x1a672b,_0x70bf('0x7e')),function(_0x4f4f08){return _[_0x70bf('0x7f')](_0x1b00b3,_0x4f4f08);});if(_0x2d6858){return _0x36dc1a['id'];}}}));}}return BPromise[_0x70bf('0x80')](_0x413452)['then'](function(_0x57b39f){_0x41ff4d=_(_0x41ff4d)['union'](_0x57b39f)[_0x70bf('0x81')]()[_0x70bf('0x82')]();return db['SmsQueue'][_0x70bf('0x4d')]({'where':{'id':_0x38ef62['params']['id']}})[_0x70bf('0x27')](function(_0x5c1caa){return db['sequelize'][_0x70bf('0x6a')](function(_0x242366){return _0x5c1caa[_0x70bf('0x70')](_0x38ef62[_0x70bf('0x3a')]['ids'],{'transaction':_0x242366})[_0x70bf('0x27')](function(){if(!_[_0x70bf('0x83')](_0x41ff4d)){return _0x5c1caa['removeAgents'](_0x41ff4d,{'transaction':_0x242366});}})['then'](function(){_0x41ff4d[_0x70bf('0x6d')](function(_0x546e10){socket['emit'](_0x70bf('0x84'),{'UserId':_0x546e10,'SmsQueueId':_0x5c1caa['id']});});});});});});})[_0x70bf('0x27')](respondWithStatusCode(_0xe62135,null))[_0x70bf('0x49')](handleError(_0xe62135,null));};exports[_0x70bf('0x85')]=function(_0x318a3b,_0x505239,_0x279e6f){return db[_0x70bf('0x34')][_0x70bf('0x4d')]({'where':{'id':_0x318a3b[_0x70bf('0x4a')]['id']}})[_0x70bf('0x27')](handleEntityNotFound(_0x505239,null))['then'](function(_0x5e7e5d){if(_0x5e7e5d){return _0x5e7e5d[_0x70bf('0x85')](_0x318a3b[_0x70bf('0x4e')][_0x70bf('0x63')],_[_0x70bf('0x86')](_0x318a3b[_0x70bf('0x4e')],['ids','id'])||{})[_0x70bf('0x87')](function(_0x291287){for(var _0xd22365=0x0;_0xd22365<_0x318a3b[_0x70bf('0x4e')][_0x70bf('0x63')]['length'];_0xd22365+=0x1){socket['emit'](_0x70bf('0x6f'),{'UserId':Number(_0x318a3b['body'][_0x70bf('0x63')][_0xd22365]),'SmsQueueId':Number(_0x318a3b['params']['id'])});}return _0x291287;});}})[_0x70bf('0x27')](respondWithResult(_0x505239,null))[_0x70bf('0x49')](handleError(_0x505239,null));};exports[_0x70bf('0x88')]=function(_0x24f4d2,_0x3944b6,_0x537ac4){return db[_0x70bf('0x34')][_0x70bf('0x4d')]({'where':{'id':_0x24f4d2[_0x70bf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3944b6,null))[_0x70bf('0x27')](function(_0x43fa7f){if(_0x43fa7f){return _0x43fa7f[_0x70bf('0x88')](_0x24f4d2[_0x70bf('0x3a')][_0x70bf('0x63')])[_0x70bf('0x27')](function(){if(_[_0x70bf('0x89')](_0x24f4d2[_0x70bf('0x3a')][_0x70bf('0x63')])){for(var _0x3ea319=0x0;_0x3ea319<_0x24f4d2[_0x70bf('0x3a')]['ids']['length'];_0x3ea319+=0x1){socket[_0x70bf('0x6e')](_0x70bf('0x84'),{'UserId':Number(_0x24f4d2[_0x70bf('0x3a')][_0x70bf('0x63')][_0x3ea319]),'SmsQueueId':Number(_0x24f4d2['params']['id'])});}}else{socket[_0x70bf('0x6e')](_0x70bf('0x84'),{'UserId':Number(_0x24f4d2[_0x70bf('0x3a')]['ids']),'SmsQueueId':Number(_0x24f4d2[_0x70bf('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3944b6,null))['catch'](handleError(_0x3944b6,null));};exports[_0x70bf('0x8a')]=function(_0xcebc9d,_0x181d8e,_0xbca3cf){var _0x290784={};var _0x441391={};var _0x16e0f6;var _0x30dab8;return db[_0x70bf('0x34')][_0x70bf('0x55')]({'where':{'id':_0xcebc9d['params']['id']}})['then'](handleEntityNotFound(_0x181d8e,null))[_0x70bf('0x27')](function(_0x3d6567){if(_0x3d6567){_0x16e0f6=_0x3d6567;_0x441391[_0x70bf('0x39')]=_[_0x70bf('0x4b')](db['User']['rawAttributes']);_0x441391['query']=_[_0x70bf('0x4b')](_0xcebc9d[_0x70bf('0x3a')]);_0x441391[_0x70bf('0x3b')]=_['intersection'](_0x441391[_0x70bf('0x39')],_0x441391[_0x70bf('0x3a')]);_0x290784['attributes']=_[_0x70bf('0x3d')](_0x441391[_0x70bf('0x39')],qs[_0x70bf('0x3e')](_0xcebc9d[_0x70bf('0x3a')][_0x70bf('0x3e')]));_0x290784[_0x70bf('0x3c')]=_0x290784[_0x70bf('0x3c')][_0x70bf('0x3f')]?_0x290784[_0x70bf('0x3c')]:_0x441391[_0x70bf('0x39')];_0x290784[_0x70bf('0x41')]=qs[_0x70bf('0x42')](_0xcebc9d[_0x70bf('0x3a')]['sort']);_0x290784[_0x70bf('0x44')]=qs[_0x70bf('0x3b')](_[_0x70bf('0x57')](_0xcebc9d[_0x70bf('0x3a')],_0x441391[_0x70bf('0x3b')]));if(_0xcebc9d['query'][_0x70bf('0x43')]){_0x290784[_0x70bf('0x44')]=_[_0x70bf('0x45')](_0x290784['where'],{'$or':_[_0x70bf('0x33')](_0x290784[_0x70bf('0x3c')],function(_0x234922){var _0x1c42c9={};_0x1c42c9[_0x234922]={'$like':'%'+_0xcebc9d[_0x70bf('0x3a')]['filter']+'%'};return _0x1c42c9;})});}_0x290784=_[_0x70bf('0x45')]({},_0x290784,_0xcebc9d[_0x70bf('0x4c')]);return _0x16e0f6[_0x70bf('0x8a')](_0x290784);}})[_0x70bf('0x27')](function(_0x12139a){if(_0x12139a){_0x30dab8=_0x12139a[_0x70bf('0x3f')];if(!_0xcebc9d[_0x70bf('0x3a')][_0x70bf('0x40')](_0x70bf('0x61'))){_0x290784[_0x70bf('0x21')]=qs[_0x70bf('0x21')](_0xcebc9d[_0x70bf('0x3a')][_0x70bf('0x21')]);_0x290784[_0x70bf('0x1e')]=qs[_0x70bf('0x1e')](_0xcebc9d['query'][_0x70bf('0x1e')]);}return _0x16e0f6[_0x70bf('0x8a')](_0x290784);}})[_0x70bf('0x27')](function(_0x13267f){if(_0x13267f){return _0x13267f?{'count':_0x30dab8,'rows':_0x13267f}:null;}})[_0x70bf('0x27')](respondWithResult(_0x181d8e,null))[_0x70bf('0x49')](handleError(_0x181d8e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2946b76..11d5254 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 _0x26bc=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','update','remove'];(function(_0x75c507,_0x43e3bc){var _0x3054f7=function(_0x12f75c){while(--_0x12f75c){_0x75c507['push'](_0x75c507['shift']());}};_0x3054f7(++_0x43e3bc);}(_0x26bc,0x1ea));var _0xc26b=function(_0x2bd693,_0x3fd337){_0x2bd693=_0x2bd693-0x0;var _0x481d3a=_0x26bc[_0x2bd693];return _0x481d3a;};'use strict';var EventEmitter=require(_0xc26b('0x0'));var SmsQueue=require(_0xc26b('0x1'))['db'][_0xc26b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc26b('0x3'),'afterDestroy':_0xc26b('0x4')};function emitEvent(_0x2ad9af){return function(_0x517e8d,_0x5a54ef,_0x3a97b0){SmsQueueEvents[_0xc26b('0x5')](_0x2ad9af+':'+_0x517e8d['id'],_0x517e8d);SmsQueueEvents[_0xc26b('0x5')](_0x2ad9af,_0x517e8d);_0x3a97b0(null);};}for(var e in events){if(events[_0xc26b('0x6')](e)){var event=events[e];SmsQueue[_0xc26b('0x7')](e,emitEvent(event));}}module[_0xc26b('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xb857=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3698e1,_0x36852b){var _0x25a394=function(_0x221f9c){while(--_0x221f9c){_0x3698e1['push'](_0x3698e1['shift']());}};_0x25a394(++_0x36852b);}(_0xb857,0x140));var _0x7b85=function(_0x447506,_0x50bd5f){_0x447506=_0x447506-0x0;var _0x14b478=_0xb857[_0x447506];return _0x14b478;};'use strict';var EventEmitter=require(_0x7b85('0x0'));var SmsQueue=require(_0x7b85('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7b85('0x2')](0x0);var events={'afterCreate':_0x7b85('0x3'),'afterUpdate':_0x7b85('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c4e59){return function(_0x49f09c,_0x590f10,_0x48790d){SmsQueueEvents[_0x7b85('0x5')](_0x3c4e59+':'+_0x49f09c['id'],_0x49f09c);SmsQueueEvents[_0x7b85('0x5')](_0x3c4e59,_0x49f09c);_0x48790d(null);};}for(var e in events){if(events[_0x7b85('0x6')](e)){var event=events[e];SmsQueue[_0x7b85('0x7')](e,emitEvent(event));}}module[_0x7b85('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 77f06f9..71b8c0f 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 _0x39b0=['moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','../../config/logger','api'];(function(_0x1370bd,_0x3f36ca){var _0x1b3e89=function(_0x21d83d){while(--_0x21d83d){_0x1370bd['push'](_0x1370bd['shift']());}};_0x1b3e89(++_0x3f36ca);}(_0x39b0,0xf0));var _0x039b=function(_0x39f54d,_0x2da2c1){_0x39f54d=_0x39f54d-0x0;var _0x15471d=_0x39b0[_0x39f54d];return _0x15471d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x039b('0x0'))(_0x039b('0x1'));var moment=require(_0x039b('0x2'));var BPromise=require(_0x039b('0x3'));var rp=require(_0x039b('0x4'));var fs=require('fs');var path=require(_0x039b('0x5'));var rimraf=require('rimraf');var config=require(_0x039b('0x6'));var attributes=require(_0x039b('0x7'));module[_0x039b('0x8')]=function(_0x423d87,_0x2999d9){return _0x423d87['define'](_0x039b('0x9'),attributes,{'tableName':_0x039b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ddf=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2ddf,0xa8));var _0xf2dd=function(_0x503566,_0x394643){_0x503566=_0x503566-0x0;var _0x24bd7d=_0x2ddf[_0x503566];return _0x24bd7d;};'use strict';var _=require(_0xf2dd('0x0'));var util=require(_0xf2dd('0x1'));var logger=require('../../config/logger')(_0xf2dd('0x2'));var moment=require(_0xf2dd('0x3'));var BPromise=require(_0xf2dd('0x4'));var rp=require(_0xf2dd('0x5'));var fs=require('fs');var path=require(_0xf2dd('0x6'));var rimraf=require(_0xf2dd('0x7'));var config=require(_0xf2dd('0x8'));var attributes=require(_0xf2dd('0x9'));module[_0xf2dd('0xa')]=function(_0x44c7b5,_0x44184e){return _0x44c7b5[_0xf2dd('0xb')](_0xf2dd('0xc'),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 52c28b2..d07c466 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 _0xd01b=['register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowSmsQueue','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xd01b,0x6c));var _0xbd01=function(_0x1b0250,_0x350260){_0x1b0250=_0x1b0250-0x0;var _0x1cec7b=_0xd01b[_0x1b0250];return _0x1cec7b;};'use strict';var _=require('lodash');var util=require(_0xbd01('0x0'));var moment=require(_0xbd01('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd01('0x2'));var fs=require('fs');var Redis=require(_0xbd01('0x3'));var db=require(_0xbd01('0x4'))['db'];var utils=require(_0xbd01('0x5'));var logger=require(_0xbd01('0x6'))(_0xbd01('0x7'));var config=require(_0xbd01('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd01('0x9')][_0xbd01('0xa')]({'port':0x232a});config[_0xbd01('0xb')]=_['defaults'](config[_0xbd01('0xb')],{'host':_0xbd01('0xc'),'port':0x18eb});var socket=require(_0xbd01('0xd'))(new Redis(config[_0xbd01('0xb')]));require(_0xbd01('0xe'))[_0xbd01('0xf')](socket);function respondWithRpcPromise(_0x2268d3,_0x5963b6,_0x12f0cc){return new BPromise(function(_0xe833ce,_0x3f344e){return client[_0xbd01('0x10')](_0x2268d3,_0x12f0cc)[_0xbd01('0x11')](function(_0x337ef2){logger[_0xbd01('0x12')]('SmsQueue,\x20%s,\x20%s',_0x5963b6,_0xbd01('0x13'));logger[_0xbd01('0x14')](_0xbd01('0x15'),_0x5963b6,_0xbd01('0x13'),JSON[_0xbd01('0x16')](_0x337ef2));if(_0x337ef2[_0xbd01('0x17')]){if(_0x337ef2[_0xbd01('0x17')]['code']===0x1f4){logger[_0xbd01('0x17')](_0xbd01('0x18'),_0x5963b6,_0x337ef2[_0xbd01('0x17')]['message']);return _0x3f344e(_0x337ef2[_0xbd01('0x17')][_0xbd01('0x19')]);}logger[_0xbd01('0x17')](_0xbd01('0x18'),_0x5963b6,_0x337ef2['error']['message']);return _0xe833ce(_0x337ef2[_0xbd01('0x17')][_0xbd01('0x19')]);}else{logger['info'](_0xbd01('0x18'),_0x5963b6,'request\x20sent');_0xe833ce(_0x337ef2[_0xbd01('0x1a')][_0xbd01('0x19')]);}})['catch'](function(_0x466330){logger[_0xbd01('0x17')]('SmsQueue,\x20%s,\x20%s',_0x5963b6,_0x466330);_0x3f344e(_0x466330);});});}exports[_0xbd01('0x1b')]=function(_0x731e5e){var _0x3f0c3b=this;return new Promise(function(_0xdc97bc,_0x40eb8d){return db[_0xbd01('0x1c')][_0xbd01('0x1d')]({'raw':_0x731e5e['options']?_0x731e5e[_0xbd01('0x1e')][_0xbd01('0x1f')]===undefined?!![]:![]:!![],'where':_0x731e5e['options']?_0x731e5e['options']['where']||null:null,'attributes':_0x731e5e['options']?_0x731e5e[_0xbd01('0x1e')][_0xbd01('0x20')]||null:null,'limit':_0x731e5e[_0xbd01('0x1e')]?_0x731e5e[_0xbd01('0x1e')][_0xbd01('0x21')]||null:null,'include':_0x731e5e[_0xbd01('0x1e')]?_0x731e5e['options'][_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x731e5e['options'][_0xbd01('0x22')],function(_0x4b37b4){return{'model':db[_0x4b37b4['model']],'as':_0x4b37b4['as'],'attributes':_0x4b37b4['attributes'],'include':_0x4b37b4[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x4b37b4[_0xbd01('0x22')],function(_0x30e52f){return{'model':db[_0x30e52f[_0xbd01('0x24')]],'as':_0x30e52f['as'],'attributes':_0x30e52f[_0xbd01('0x20')],'include':_0x30e52f[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x30e52f[_0xbd01('0x22')],function(_0x3cdc18){return{'model':db[_0x3cdc18[_0xbd01('0x24')]],'as':_0x3cdc18['as'],'attributes':_0x3cdc18['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd01('0x11')](function(_0x3c0b50){logger[_0xbd01('0x12')](_0xbd01('0x1b'),_0x731e5e);logger['debug'](_0xbd01('0x1b'),_0x731e5e,JSON['stringify'](_0x3c0b50));_0xdc97bc(_0x3c0b50);})[_0xbd01('0x25')](function(_0x51f1c1){logger[_0xbd01('0x17')](_0xbd01('0x1b'),_0x51f1c1[_0xbd01('0x19')],_0x731e5e);_0x40eb8d(_0x3f0c3b[_0xbd01('0x17')](0x1f4,_0x51f1c1[_0xbd01('0x19')]));});});};exports[_0xbd01('0x26')]=function(_0x432dd8){var _0x55960e=this;return new Promise(function(_0x4b5daa,_0x36205c){return db[_0xbd01('0x1c')][_0xbd01('0x27')]({'raw':_0x432dd8[_0xbd01('0x1e')]?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x1f')]===undefined?!![]:![]:!![],'where':_0x432dd8['options']?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x28')]||null:null,'attributes':_0x432dd8[_0xbd01('0x1e')]?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x20')]||null:null,'include':_0x432dd8[_0xbd01('0x1e')]?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x432dd8['options']['include'],function(_0x26746e){return{'model':db[_0x26746e['model']],'as':_0x26746e['as'],'attributes':_0x26746e[_0xbd01('0x20')],'include':_0x26746e[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x26746e[_0xbd01('0x22')],function(_0x1e50ed){return{'model':db[_0x1e50ed[_0xbd01('0x24')]],'as':_0x1e50ed['as'],'attributes':_0x1e50ed[_0xbd01('0x20')],'include':_0x1e50ed[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x1e50ed['include'],function(_0x731b9c){return{'model':db[_0x731b9c[_0xbd01('0x24')]],'as':_0x731b9c['as'],'attributes':_0x731b9c[_0xbd01('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd01('0x11')](function(_0x690271){logger['info'](_0xbd01('0x26'),_0x432dd8);logger[_0xbd01('0x14')](_0xbd01('0x26'),_0x432dd8,JSON['stringify'](_0x690271));_0x4b5daa(_0x690271);})['catch'](function(_0x20348){logger['error'](_0xbd01('0x26'),_0x20348[_0xbd01('0x19')],_0x432dd8);_0x36205c(_0x55960e[_0xbd01('0x17')](0x1f4,_0x20348[_0xbd01('0x19')]));});});}; \ No newline at end of file +var _0x440d=['error','code','message','result','catch','GetSmsQueue','findAll','options','raw','include','model','attributes','map','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x18307e,_0x1898e8){var _0x24186b=function(_0x5ee12b){while(--_0x5ee12b){_0x18307e['push'](_0x18307e['shift']());}};_0x24186b(++_0x1898e8);}(_0x440d,0x1d3));var _0xd440=function(_0x1fcbb7,_0x21ff69){_0x1fcbb7=_0x1fcbb7-0x0;var _0x1a5046=_0x440d[_0x1fcbb7];return _0x1a5046;};'use strict';var _=require(_0xd440('0x0'));var util=require(_0xd440('0x1'));var moment=require(_0xd440('0x2'));var BPromise=require(_0xd440('0x3'));var rs=require(_0xd440('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd440('0x5'))['db'];var utils=require(_0xd440('0x6'));var logger=require(_0xd440('0x7'))('rpc');var config=require(_0xd440('0x8'));var jayson=require(_0xd440('0x9'));var client=jayson['client'][_0xd440('0xa')]({'port':0x232a});config[_0xd440('0xb')]=_[_0xd440('0xc')](config[_0xd440('0xb')],{'host':_0xd440('0xd'),'port':0x18eb});var socket=require(_0xd440('0xe'))(new Redis(config['redis']));require(_0xd440('0xf'))[_0xd440('0x10')](socket);function respondWithRpcPromise(_0x588e84,_0x54ba5c,_0x55c8fc){return new BPromise(function(_0x5807bc,_0x504e11){return client[_0xd440('0x11')](_0x588e84,_0x55c8fc)[_0xd440('0x12')](function(_0x4df730){logger[_0xd440('0x13')](_0xd440('0x14'),_0x54ba5c,_0xd440('0x15'));logger[_0xd440('0x16')](_0xd440('0x17'),_0x54ba5c,'request\x20sent',JSON[_0xd440('0x18')](_0x4df730));if(_0x4df730[_0xd440('0x19')]){if(_0x4df730[_0xd440('0x19')][_0xd440('0x1a')]===0x1f4){logger[_0xd440('0x19')]('SmsQueue,\x20%s,\x20%s',_0x54ba5c,_0x4df730['error']['message']);return _0x504e11(_0x4df730[_0xd440('0x19')][_0xd440('0x1b')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x54ba5c,_0x4df730[_0xd440('0x19')][_0xd440('0x1b')]);return _0x5807bc(_0x4df730[_0xd440('0x19')][_0xd440('0x1b')]);}else{logger[_0xd440('0x13')](_0xd440('0x14'),_0x54ba5c,_0xd440('0x15'));_0x5807bc(_0x4df730[_0xd440('0x1c')]['message']);}})[_0xd440('0x1d')](function(_0x1c58c8){logger['error'](_0xd440('0x14'),_0x54ba5c,_0x1c58c8);_0x504e11(_0x1c58c8);});});}exports[_0xd440('0x1e')]=function(_0x1a77e3){var _0x4b3e99=this;return new Promise(function(_0x19666b,_0x5cbe36){return db['SmsQueue'][_0xd440('0x1f')]({'raw':_0x1a77e3[_0xd440('0x20')]?_0x1a77e3[_0xd440('0x20')][_0xd440('0x21')]===undefined?!![]:![]:!![],'where':_0x1a77e3[_0xd440('0x20')]?_0x1a77e3[_0xd440('0x20')]['where']||null:null,'attributes':_0x1a77e3[_0xd440('0x20')]?_0x1a77e3[_0xd440('0x20')]['attributes']||null:null,'limit':_0x1a77e3['options']?_0x1a77e3[_0xd440('0x20')]['limit']||null:null,'include':_0x1a77e3[_0xd440('0x20')]?_0x1a77e3[_0xd440('0x20')][_0xd440('0x22')]?_['map'](_0x1a77e3[_0xd440('0x20')][_0xd440('0x22')],function(_0x587608){return{'model':db[_0x587608[_0xd440('0x23')]],'as':_0x587608['as'],'attributes':_0x587608[_0xd440('0x24')],'include':_0x587608['include']?_[_0xd440('0x25')](_0x587608[_0xd440('0x22')],function(_0x29fb53){return{'model':db[_0x29fb53['model']],'as':_0x29fb53['as'],'attributes':_0x29fb53[_0xd440('0x24')],'include':_0x29fb53['include']?_[_0xd440('0x25')](_0x29fb53['include'],function(_0x327fd1){return{'model':db[_0x327fd1[_0xd440('0x23')]],'as':_0x327fd1['as'],'attributes':_0x327fd1[_0xd440('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd440('0x12')](function(_0x1d981a){logger['info'](_0xd440('0x1e'),_0x1a77e3);logger[_0xd440('0x16')](_0xd440('0x1e'),_0x1a77e3,JSON[_0xd440('0x18')](_0x1d981a));_0x19666b(_0x1d981a);})[_0xd440('0x1d')](function(_0x164303){logger[_0xd440('0x19')](_0xd440('0x1e'),_0x164303['message'],_0x1a77e3);_0x5cbe36(_0x4b3e99[_0xd440('0x19')](0x1f4,_0x164303[_0xd440('0x1b')]));});});};exports[_0xd440('0x26')]=function(_0x5b22f0){var _0x115db8=this;return new Promise(function(_0x57f6a4,_0x2e6fd8){return db[_0xd440('0x27')][_0xd440('0x28')]({'raw':_0x5b22f0[_0xd440('0x20')]?_0x5b22f0['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b22f0['options']?_0x5b22f0['options']['where']||null:null,'attributes':_0x5b22f0[_0xd440('0x20')]?_0x5b22f0[_0xd440('0x20')][_0xd440('0x24')]||null:null,'include':_0x5b22f0[_0xd440('0x20')]?_0x5b22f0['options']['include']?_[_0xd440('0x25')](_0x5b22f0[_0xd440('0x20')][_0xd440('0x22')],function(_0x166f12){return{'model':db[_0x166f12[_0xd440('0x23')]],'as':_0x166f12['as'],'attributes':_0x166f12[_0xd440('0x24')],'include':_0x166f12['include']?_[_0xd440('0x25')](_0x166f12[_0xd440('0x22')],function(_0x3f6008){return{'model':db[_0x3f6008[_0xd440('0x23')]],'as':_0x3f6008['as'],'attributes':_0x3f6008['attributes'],'include':_0x3f6008[_0xd440('0x22')]?_['map'](_0x3f6008[_0xd440('0x22')],function(_0x4a6cbd){return{'model':db[_0x4a6cbd[_0xd440('0x23')]],'as':_0x4a6cbd['as'],'attributes':_0x4a6cbd['attributes']};}):[]};}):[]};}):[]:[]})[_0xd440('0x12')](function(_0x434910){logger[_0xd440('0x13')](_0xd440('0x26'),_0x5b22f0);logger[_0xd440('0x16')]('ShowSmsQueue',_0x5b22f0,JSON[_0xd440('0x18')](_0x434910));_0x57f6a4(_0x434910);})['catch'](function(_0x2d2b4c){logger['error'](_0xd440('0x26'),_0x2d2b4c[_0xd440('0x1b')],_0x5b22f0);_0x2e6fd8(_0x115db8[_0xd440('0x19')](0x1f4,_0x2d2b4c[_0xd440('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2e4680a..89e1dfe 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 _0xcabf=['./smsQueue.events','update','removeListener','register','length','smsQueue:'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xcabf,0x1ec));var _0xfcab=function(_0xa9077e,_0x4c0c18){_0xa9077e=_0xa9077e-0x0;var _0x5ef44a=_0xcabf[_0xa9077e];return _0x5ef44a;};'use strict';var SmsQueueEvents=require(_0xfcab('0x0'));var events=['save','remove',_0xfcab('0x1')];function createListener(_0x52404a,_0x4812ba){return function(_0x3ea54d){_0x4812ba['emit'](_0x52404a,_0x3ea54d);};}function removeListener(_0x5054ff,_0x43776b){return function(){SmsQueueEvents[_0xfcab('0x2')](_0x5054ff,_0x43776b);};}exports[_0xfcab('0x3')]=function(_0x381336){for(var _0x217390=0x0,_0x1dd8be=events[_0xfcab('0x4')];_0x217390<_0x1dd8be;_0x217390++){var _0x262881=events[_0x217390];var _0x41410d=createListener(_0xfcab('0x5')+_0x262881,_0x381336);SmsQueueEvents['on'](_0x262881,_0x41410d);}}; \ No newline at end of file +var _0x9d3c=['save','update','emit','removeListener','length','./smsQueue.events'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x9d3c,0x15b));var _0xc9d3=function(_0x204b4e,_0xe95bd6){_0x204b4e=_0x204b4e-0x0;var _0x4dd6a6=_0x9d3c[_0x204b4e];return _0x4dd6a6;};'use strict';var SmsQueueEvents=require(_0xc9d3('0x0'));var events=[_0xc9d3('0x1'),'remove',_0xc9d3('0x2')];function createListener(_0x5581c8,_0x1cefcd){return function(_0x23faae){_0x1cefcd[_0xc9d3('0x3')](_0x5581c8,_0x23faae);};}function removeListener(_0x2c15e6,_0x576cf4){return function(){SmsQueueEvents[_0xc9d3('0x4')](_0x2c15e6,_0x576cf4);};}exports['register']=function(_0x322d8c){for(var _0x451de4=0x0,_0x394f35=events[_0xc9d3('0x5')];_0x451de4<_0x394f35;_0x451de4++){var _0x4e2a74=events[_0x451de4];var _0x4a0dc9=createListener('smsQueue:'+_0x4e2a74,_0x322d8c);SmsQueueEvents['on'](_0x4e2a74,_0x4a0dc9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 58802d4..2e198a7 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 _0x4da5=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','update','delete','/:id','destroy','exports','util','path'];(function(_0x2f83ac,_0x3afd86){var _0x4e5a99=function(_0x925a7){while(--_0x925a7){_0x2f83ac['push'](_0x2f83ac['shift']());}};_0x4e5a99(++_0x3afd86);}(_0x4da5,0x1b7));var _0x54da=function(_0x2c967d,_0x33bd4b){_0x2c967d=_0x2c967d-0x0;var _0x15c3c2=_0x4da5[_0x2c967d];return _0x15c3c2;};'use strict';var multer=require('multer');var util=require(_0x54da('0x0'));var path=require(_0x54da('0x1'));var timeout=require(_0x54da('0x2'));var express=require('express');var router=express[_0x54da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x54da('0x4'));var interaction=require(_0x54da('0x5'));var config=require(_0x54da('0x6'));var controller=require(_0x54da('0x7'));router['get']('/',auth[_0x54da('0x8')](),controller[_0x54da('0x9')]);router[_0x54da('0xa')](_0x54da('0xb'),auth[_0x54da('0x8')](),controller[_0x54da('0xc')]);router[_0x54da('0xa')]('/:id',auth[_0x54da('0x8')](),controller[_0x54da('0xd')]);router[_0x54da('0xe')]('/',auth['isAuthenticated'](),controller[_0x54da('0xf')]);router['put']('/:id',auth[_0x54da('0x8')](),controller[_0x54da('0x10')]);router[_0x54da('0x11')](_0x54da('0x12'),auth[_0x54da('0x8')](),controller[_0x54da('0x13')]);module[_0x54da('0x14')]=router; \ No newline at end of file +var _0xf61e=['isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x54ddc1,_0x24ffc3){var _0x5c736f=function(_0x48bdfb){while(--_0x48bdfb){_0x54ddc1['push'](_0x54ddc1['shift']());}};_0x5c736f(++_0x24ffc3);}(_0xf61e,0x82));var _0xef61=function(_0x1b6016,_0x3aac69){_0x1b6016=_0x1b6016-0x0;var _0x4a5db9=_0xf61e[_0x1b6016];return _0x4a5db9;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef61('0x3')]();var fs_extra=require(_0xef61('0x4'));var auth=require(_0xef61('0x5'));var interaction=require(_0xef61('0x6'));var config=require(_0xef61('0x7'));var controller=require(_0xef61('0x8'));router[_0xef61('0x9')]('/',auth[_0xef61('0xa')](),controller[_0xef61('0xb')]);router['get'](_0xef61('0xc'),auth['isAuthenticated'](),controller[_0xef61('0xd')]);router[_0xef61('0x9')](_0xef61('0xe'),auth[_0xef61('0xa')](),controller[_0xef61('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xef61('0x10')](_0xef61('0xe'),auth[_0xef61('0xa')](),controller['update']);router[_0xef61('0x11')]('/:id',auth[_0xef61('0xa')](),controller[_0xef61('0x12')]);module[_0xef61('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 085c049..f3b82f7 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 _0x680b=['STRING','DATE','sequelize'];(function(_0x5f4b6e,_0x2a5a1c){var _0x29cdb3=function(_0x24bbc4){while(--_0x24bbc4){_0x5f4b6e['push'](_0x5f4b6e['shift']());}};_0x29cdb3(++_0x2a5a1c);}(_0x680b,0x140));var _0xb680=function(_0x111dfa,_0x270b82){_0x111dfa=_0x111dfa-0x0;var _0x1c6c16=_0x680b[_0x111dfa];return _0x1c6c16;};'use strict';var moment=require('moment');var Sequelize=require(_0xb680('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb680('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb680('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb680('0x2')]},'acceptAt':{'type':Sequelize[_0xb680('0x2')]},'exitAt':{'type':Sequelize[_0xb680('0x2')]},'reason':{'type':Sequelize[_0xb680('0x1')]}}; \ No newline at end of file +var _0xf21c=['exports','STRING','DATE','moment','sequelize'];(function(_0x34530b,_0x1a0886){var _0x4b0995=function(_0x2e6ed0){while(--_0x2e6ed0){_0x34530b['push'](_0x34530b['shift']());}};_0x4b0995(++_0x1a0886);}(_0xf21c,0x1b6));var _0xcf21=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xf21c[_0x5416db];return _0x243e35;};'use strict';var moment=require(_0xcf21('0x0'));var Sequelize=require(_0xcf21('0x1'));module[_0xcf21('0x2')]={'uniqueid':{'type':Sequelize[_0xcf21('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcf21('0x3')]},'joinAt':{'type':Sequelize[_0xcf21('0x4')]},'leaveAt':{'type':Sequelize[_0xcf21('0x4')]},'acceptAt':{'type':Sequelize[_0xcf21('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcf21('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 421728f..b19655a 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 _0xac19=['catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','then','name','send','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','SmsQueueReport','count','findAll','rows','params','keys','intersection','length','includeAll','options','find'];(function(_0x52164e,_0x10dfc1){var _0x5820c5=function(_0x478e7f){while(--_0x478e7f){_0x52164e['push'](_0x52164e['shift']());}};_0x5820c5(++_0x10dfc1);}(_0xac19,0x8a));var _0x9ac1=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xac19[_0x2a67fe];return _0x57e726;};'use strict';var emlformat=require(_0x9ac1('0x0'));var rimraf=require(_0x9ac1('0x1'));var zipdir=require(_0x9ac1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ac1('0x3'));var moment=require(_0x9ac1('0x4'));var BPromise=require(_0x9ac1('0x5'));var Mustache=require(_0x9ac1('0x6'));var util=require('util');var path=require(_0x9ac1('0x7'));var sox=require('sox');var csv=require(_0x9ac1('0x8'));var ejs=require(_0x9ac1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ac1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ac1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ac1('0xc'));var Papa=require(_0x9ac1('0xd'));var Redis=require('ioredis');var authService=require(_0x9ac1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9ac1('0xf'));var hardwareService=require(_0x9ac1('0x10'));var logger=require(_0x9ac1('0x11'))(_0x9ac1('0x12'));var utils=require(_0x9ac1('0x13'));var config=require(_0x9ac1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ac1('0x15'))['db'];function respondWithStatusCode(_0x5305c9,_0x79dc8){_0x79dc8=_0x79dc8||0xcc;return function(_0x5c1dc6){if(_0x5c1dc6){return _0x5305c9[_0x9ac1('0x16')](_0x79dc8);}return _0x5305c9[_0x9ac1('0x17')](_0x79dc8)[_0x9ac1('0x18')]();};}function respondWithResult(_0x1f808d,_0x427ee5){_0x427ee5=_0x427ee5||0xc8;return function(_0xb97d60){if(_0xb97d60){return _0x1f808d[_0x9ac1('0x17')](_0x427ee5)[_0x9ac1('0x19')](_0xb97d60);}};}function respondWithFilteredResult(_0x1162ea,_0x364d2b){return function(_0x59cd58){if(_0x59cd58){var _0x167577=typeof _0x364d2b[_0x9ac1('0x1a')]===_0x9ac1('0x1b')&&typeof _0x364d2b[_0x9ac1('0x1c')]===_0x9ac1('0x1b');var _0x34dfa3=_0x59cd58['count'];var _0x456b9f=_0x167577?0x0:_0x364d2b['offset'];var _0x1d77ae=_0x167577?_0x59cd58['count']:_0x364d2b[_0x9ac1('0x1a')]+_0x364d2b[_0x9ac1('0x1c')];var _0x330045;if(_0x1d77ae>=_0x34dfa3){_0x1d77ae=_0x34dfa3;_0x330045=0xc8;}else{_0x330045=0xce;}_0x1162ea[_0x9ac1('0x17')](_0x330045);return _0x1162ea[_0x9ac1('0x1d')]('Content-Range',_0x456b9f+'-'+_0x1d77ae+'/'+_0x34dfa3)['json'](_0x59cd58);}return null;};}function patchUpdates(_0x1dbb1a){return function(_0x23decd){try{jsonpatch[_0x9ac1('0x1e')](_0x23decd,_0x1dbb1a,!![]);}catch(_0x1e35ec){return BPromise['reject'](_0x1e35ec);}return _0x23decd[_0x9ac1('0x1f')]();};}function saveUpdates(_0x4cd3b8,_0x207c66){return function(_0x3f04ab){if(_0x3f04ab){return _0x3f04ab[_0x9ac1('0x20')](_0x4cd3b8)[_0x9ac1('0x21')](function(_0x3a8196){return _0x3a8196;});}return null;};}function removeEntity(_0x21141c,_0x46173a){return function(_0x2a3bf4){if(_0x2a3bf4){return _0x2a3bf4['destroy']()[_0x9ac1('0x21')](function(){_0x21141c[_0x9ac1('0x17')](0xcc)[_0x9ac1('0x18')]();});}};}function handleEntityNotFound(_0x5702b5,_0x4fd751){return function(_0x113175){if(!_0x113175){_0x5702b5[_0x9ac1('0x16')](0x194);}return _0x113175;};}function handleError(_0x3a276a,_0x490edb){_0x490edb=_0x490edb||0x1f4;return function(_0x386776){logger['error'](_0x386776['stack']);if(_0x386776[_0x9ac1('0x22')]){delete _0x386776[_0x9ac1('0x22')];}_0x3a276a[_0x9ac1('0x17')](_0x490edb)[_0x9ac1('0x23')](_0x386776);};}exports['index']=function(_0x1b917a,_0x1ef229){var _0x5e7007={},_0x56d251={},_0x19f0e8={'count':0x0,'rows':[]};var _0x27d2e8=_[_0x9ac1('0x24')](db['SmsQueueReport'][_0x9ac1('0x25')],function(_0x1dbed9){return{'name':_0x1dbed9[_0x9ac1('0x26')],'type':_0x1dbed9['type'][_0x9ac1('0x27')]};});_0x56d251[_0x9ac1('0x28')]=_[_0x9ac1('0x24')](_0x27d2e8,'name');_0x56d251[_0x9ac1('0x29')]=_['keys'](_0x1b917a[_0x9ac1('0x29')]);_0x56d251[_0x9ac1('0x2a')]=_['intersection'](_0x56d251['model'],_0x56d251[_0x9ac1('0x29')]);_0x5e7007[_0x9ac1('0x2b')]=_['intersection'](_0x56d251[_0x9ac1('0x28')],qs[_0x9ac1('0x2c')](_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x2c')]));_0x5e7007['attributes']=_0x5e7007[_0x9ac1('0x2b')]['length']?_0x5e7007[_0x9ac1('0x2b')]:_0x56d251[_0x9ac1('0x28')];if(!_0x1b917a['query'][_0x9ac1('0x2d')](_0x9ac1('0x2e'))){_0x5e7007[_0x9ac1('0x1c')]=qs['limit'](_0x1b917a['query'][_0x9ac1('0x1c')]);_0x5e7007['offset']=qs['offset'](_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x1a')]);}_0x5e7007['order']=qs['sort'](_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x2f')]);_0x5e7007[_0x9ac1('0x30')]=qs['filters'](_['pick'](_0x1b917a[_0x9ac1('0x29')],_0x56d251['filters']),_0x27d2e8);if(_0x1b917a['query'][_0x9ac1('0x31')]){_0x5e7007[_0x9ac1('0x30')]=_[_0x9ac1('0x32')](_0x5e7007[_0x9ac1('0x30')],{'$or':_[_0x9ac1('0x24')](_0x27d2e8,function(_0x648fe2){if(_0x648fe2[_0x9ac1('0x33')]!=='VIRTUAL'){var _0x38b960={};_0x38b960[_0x648fe2['name']]={'$like':'%'+_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x31')]+'%'};return _0x38b960;}})});}_0x5e7007=_[_0x9ac1('0x32')]({},_0x5e7007,_0x1b917a['options']);var _0x28d03d={'where':_0x5e7007[_0x9ac1('0x30')]};return db[_0x9ac1('0x34')][_0x9ac1('0x35')](_0x28d03d)[_0x9ac1('0x21')](function(_0x1bfa95){_0x19f0e8[_0x9ac1('0x35')]=_0x1bfa95;if(_0x1b917a[_0x9ac1('0x29')]['includeAll']){_0x5e7007['include']=[{'all':!![]}];}return db[_0x9ac1('0x34')][_0x9ac1('0x36')](_0x5e7007);})[_0x9ac1('0x21')](function(_0x3495b3){_0x19f0e8[_0x9ac1('0x37')]=_0x3495b3;return _0x19f0e8;})['then'](respondWithFilteredResult(_0x1ef229,_0x5e7007))['catch'](handleError(_0x1ef229,null));};exports['show']=function(_0x119687,_0xfadb0c){var _0x35d826={'raw':!![],'where':{'id':_0x119687[_0x9ac1('0x38')]['id']}},_0x56ace={};_0x56ace['model']=_[_0x9ac1('0x39')](db['SmsQueueReport']['rawAttributes']);_0x56ace[_0x9ac1('0x29')]=_['keys'](_0x119687[_0x9ac1('0x29')]);_0x56ace[_0x9ac1('0x2a')]=_[_0x9ac1('0x3a')](_0x56ace['model'],_0x56ace['query']);_0x35d826['attributes']=_['intersection'](_0x56ace[_0x9ac1('0x28')],qs[_0x9ac1('0x2c')](_0x119687['query'][_0x9ac1('0x2c')]));_0x35d826['attributes']=_0x35d826[_0x9ac1('0x2b')][_0x9ac1('0x3b')]?_0x35d826[_0x9ac1('0x2b')]:_0x56ace[_0x9ac1('0x28')];if(_0x119687[_0x9ac1('0x29')][_0x9ac1('0x3c')]){_0x35d826['include']=[{'all':!![]}];}_0x35d826=_[_0x9ac1('0x32')]({},_0x35d826,_0x119687[_0x9ac1('0x3d')]);return db[_0x9ac1('0x34')][_0x9ac1('0x3e')](_0x35d826)[_0x9ac1('0x21')](handleEntityNotFound(_0xfadb0c,null))[_0x9ac1('0x21')](respondWithResult(_0xfadb0c,null))[_0x9ac1('0x3f')](handleError(_0xfadb0c,null));};exports[_0x9ac1('0x40')]=function(_0x14c38c,_0x5003f4){return db[_0x9ac1('0x34')]['create'](_0x14c38c[_0x9ac1('0x41')],{})[_0x9ac1('0x21')](respondWithResult(_0x5003f4,0xc9))['catch'](handleError(_0x5003f4,null));};exports['update']=function(_0x132cff,_0x4e655b){if(_0x132cff[_0x9ac1('0x41')]['id']){delete _0x132cff[_0x9ac1('0x41')]['id'];}return db[_0x9ac1('0x34')]['find']({'where':{'id':_0x132cff['params']['id']}})[_0x9ac1('0x21')](handleEntityNotFound(_0x4e655b,null))[_0x9ac1('0x21')](saveUpdates(_0x132cff['body'],null))[_0x9ac1('0x21')](respondWithResult(_0x4e655b,null))[_0x9ac1('0x3f')](handleError(_0x4e655b,null));};exports['destroy']=function(_0x1dcf42,_0x3cd9db){return db[_0x9ac1('0x34')][_0x9ac1('0x3e')]({'where':{'id':_0x1dcf42[_0x9ac1('0x38')]['id']}})['then'](handleEntityNotFound(_0x3cd9db,null))[_0x9ac1('0x21')](removeEntity(_0x3cd9db,null))[_0x9ac1('0x3f')](handleError(_0x3cd9db,null));};exports[_0x9ac1('0x42')]=function(_0x2b2367,_0x19598f){return db[_0x9ac1('0x34')][_0x9ac1('0x42')]()['then'](respondWithResult(_0x19598f,null))[_0x9ac1('0x3f')](handleError(_0x19598f,null));}; \ No newline at end of file +var _0x10cf=['SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','save','destroy','then','error','stack','name','index','map'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x10cf,0x1c7));var _0xf10c=function(_0x59ec03,_0x26e7cc){_0x59ec03=_0x59ec03-0x0;var _0x3212f8=_0x10cf[_0x59ec03];return _0x3212f8;};'use strict';var emlformat=require(_0xf10c('0x0'));var rimraf=require(_0xf10c('0x1'));var zipdir=require(_0xf10c('0x2'));var jsonpatch=require(_0xf10c('0x3'));var rp=require(_0xf10c('0x4'));var moment=require(_0xf10c('0x5'));var BPromise=require(_0xf10c('0x6'));var Mustache=require(_0xf10c('0x7'));var util=require(_0xf10c('0x8'));var path=require(_0xf10c('0x9'));var sox=require(_0xf10c('0xa'));var csv=require(_0xf10c('0xb'));var ejs=require(_0xf10c('0xc'));var fs=require('fs');var fs_extra=require(_0xf10c('0xd'));var _=require('lodash');var squel=require(_0xf10c('0xe'));var crypto=require('crypto');var jsforce=require(_0xf10c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf10c('0x10'));var Papa=require(_0xf10c('0x11'));var Redis=require(_0xf10c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf10c('0x13'));var hardwareService=require(_0xf10c('0x14'));var logger=require(_0xf10c('0x15'))('api');var utils=require(_0xf10c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf10c('0x17'))['db'];function respondWithStatusCode(_0x18f78b,_0x134e40){_0x134e40=_0x134e40||0xcc;return function(_0x2969b7){if(_0x2969b7){return _0x18f78b[_0xf10c('0x18')](_0x134e40);}return _0x18f78b[_0xf10c('0x19')](_0x134e40)[_0xf10c('0x1a')]();};}function respondWithResult(_0x22168e,_0x389868){_0x389868=_0x389868||0xc8;return function(_0x544f6f){if(_0x544f6f){return _0x22168e[_0xf10c('0x19')](_0x389868)[_0xf10c('0x1b')](_0x544f6f);}};}function respondWithFilteredResult(_0x1a172c,_0x3b22d6){return function(_0x230d3e){if(_0x230d3e){var _0x3f688d=typeof _0x3b22d6['offset']===_0xf10c('0x1c')&&typeof _0x3b22d6[_0xf10c('0x1d')]===_0xf10c('0x1c');var _0x179ba7=_0x230d3e['count'];var _0x528db1=_0x3f688d?0x0:_0x3b22d6[_0xf10c('0x1e')];var _0x14145d=_0x3f688d?_0x230d3e[_0xf10c('0x1f')]:_0x3b22d6['offset']+_0x3b22d6['limit'];var _0x66a1ea;if(_0x14145d>=_0x179ba7){_0x14145d=_0x179ba7;_0x66a1ea=0xc8;}else{_0x66a1ea=0xce;}_0x1a172c[_0xf10c('0x19')](_0x66a1ea);return _0x1a172c['set']('Content-Range',_0x528db1+'-'+_0x14145d+'/'+_0x179ba7)[_0xf10c('0x1b')](_0x230d3e);}return null;};}function patchUpdates(_0xde3ae0){return function(_0x2b69ce){try{jsonpatch[_0xf10c('0x20')](_0x2b69ce,_0xde3ae0,!![]);}catch(_0xffe0b2){return BPromise[_0xf10c('0x21')](_0xffe0b2);}return _0x2b69ce[_0xf10c('0x22')]();};}function saveUpdates(_0x27790e,_0x2062a3){return function(_0x27ce8f){if(_0x27ce8f){return _0x27ce8f['update'](_0x27790e)['then'](function(_0x52a645){return _0x52a645;});}return null;};}function removeEntity(_0x55ab28,_0x383927){return function(_0x535b40){if(_0x535b40){return _0x535b40[_0xf10c('0x23')]()[_0xf10c('0x24')](function(){_0x55ab28[_0xf10c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5d7db,_0x20f07d){return function(_0x3d9825){if(!_0x3d9825){_0xe5d7db[_0xf10c('0x18')](0x194);}return _0x3d9825;};}function handleError(_0x3af88d,_0x59c42f){_0x59c42f=_0x59c42f||0x1f4;return function(_0x597ec9){logger[_0xf10c('0x25')](_0x597ec9[_0xf10c('0x26')]);if(_0x597ec9[_0xf10c('0x27')]){delete _0x597ec9[_0xf10c('0x27')];}_0x3af88d[_0xf10c('0x19')](_0x59c42f)['send'](_0x597ec9);};}exports[_0xf10c('0x28')]=function(_0x3af4b9,_0x1c9af8){var _0xf02951={},_0x2c5055={},_0x11e030={'count':0x0,'rows':[]};var _0x34e444=_[_0xf10c('0x29')](db[_0xf10c('0x2a')][_0xf10c('0x2b')],function(_0x353db8){return{'name':_0x353db8[_0xf10c('0x2c')],'type':_0x353db8[_0xf10c('0x2d')][_0xf10c('0x2e')]};});_0x2c5055[_0xf10c('0x2f')]=_[_0xf10c('0x29')](_0x34e444,_0xf10c('0x27'));_0x2c5055[_0xf10c('0x30')]=_[_0xf10c('0x31')](_0x3af4b9[_0xf10c('0x30')]);_0x2c5055[_0xf10c('0x32')]=_['intersection'](_0x2c5055[_0xf10c('0x2f')],_0x2c5055['query']);_0xf02951[_0xf10c('0x33')]=_[_0xf10c('0x34')](_0x2c5055[_0xf10c('0x2f')],qs[_0xf10c('0x35')](_0x3af4b9['query'][_0xf10c('0x35')]));_0xf02951['attributes']=_0xf02951[_0xf10c('0x33')][_0xf10c('0x36')]?_0xf02951[_0xf10c('0x33')]:_0x2c5055['model'];if(!_0x3af4b9[_0xf10c('0x30')][_0xf10c('0x37')]('nolimit')){_0xf02951[_0xf10c('0x1d')]=qs['limit'](_0x3af4b9[_0xf10c('0x30')][_0xf10c('0x1d')]);_0xf02951[_0xf10c('0x1e')]=qs['offset'](_0x3af4b9['query']['offset']);}_0xf02951['order']=qs[_0xf10c('0x38')](_0x3af4b9[_0xf10c('0x30')][_0xf10c('0x38')]);_0xf02951[_0xf10c('0x39')]=qs[_0xf10c('0x32')](_['pick'](_0x3af4b9[_0xf10c('0x30')],_0x2c5055[_0xf10c('0x32')]),_0x34e444);if(_0x3af4b9[_0xf10c('0x30')][_0xf10c('0x3a')]){_0xf02951['where']=_['merge'](_0xf02951[_0xf10c('0x39')],{'$or':_[_0xf10c('0x29')](_0x34e444,function(_0x36af5f){if(_0x36af5f[_0xf10c('0x2d')]!==_0xf10c('0x3b')){var _0x5819a6={};_0x5819a6[_0x36af5f['name']]={'$like':'%'+_0x3af4b9[_0xf10c('0x30')][_0xf10c('0x3a')]+'%'};return _0x5819a6;}})});}_0xf02951=_[_0xf10c('0x3c')]({},_0xf02951,_0x3af4b9[_0xf10c('0x3d')]);var _0x582b36={'where':_0xf02951[_0xf10c('0x39')]};return db[_0xf10c('0x2a')][_0xf10c('0x1f')](_0x582b36)[_0xf10c('0x24')](function(_0x9e705){_0x11e030[_0xf10c('0x1f')]=_0x9e705;if(_0x3af4b9['query'][_0xf10c('0x3e')]){_0xf02951[_0xf10c('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0xf02951);})[_0xf10c('0x24')](function(_0xace5c2){_0x11e030[_0xf10c('0x40')]=_0xace5c2;return _0x11e030;})[_0xf10c('0x24')](respondWithFilteredResult(_0x1c9af8,_0xf02951))[_0xf10c('0x41')](handleError(_0x1c9af8,null));};exports[_0xf10c('0x42')]=function(_0x34c32a,_0x58e0c2){var _0x5687d8={'raw':!![],'where':{'id':_0x34c32a['params']['id']}},_0xfa2e3f={};_0xfa2e3f[_0xf10c('0x2f')]=_[_0xf10c('0x31')](db[_0xf10c('0x2a')]['rawAttributes']);_0xfa2e3f['query']=_[_0xf10c('0x31')](_0x34c32a[_0xf10c('0x30')]);_0xfa2e3f['filters']=_[_0xf10c('0x34')](_0xfa2e3f[_0xf10c('0x2f')],_0xfa2e3f['query']);_0x5687d8[_0xf10c('0x33')]=_[_0xf10c('0x34')](_0xfa2e3f[_0xf10c('0x2f')],qs[_0xf10c('0x35')](_0x34c32a[_0xf10c('0x30')]['fields']));_0x5687d8[_0xf10c('0x33')]=_0x5687d8[_0xf10c('0x33')][_0xf10c('0x36')]?_0x5687d8[_0xf10c('0x33')]:_0xfa2e3f[_0xf10c('0x2f')];if(_0x34c32a['query']['includeAll']){_0x5687d8[_0xf10c('0x3f')]=[{'all':!![]}];}_0x5687d8=_[_0xf10c('0x3c')]({},_0x5687d8,_0x34c32a[_0xf10c('0x3d')]);return db[_0xf10c('0x2a')][_0xf10c('0x43')](_0x5687d8)['then'](handleEntityNotFound(_0x58e0c2,null))[_0xf10c('0x24')](respondWithResult(_0x58e0c2,null))[_0xf10c('0x41')](handleError(_0x58e0c2,null));};exports[_0xf10c('0x44')]=function(_0xb02fa6,_0x20f135){return db[_0xf10c('0x2a')]['create'](_0xb02fa6[_0xf10c('0x45')],{})[_0xf10c('0x24')](respondWithResult(_0x20f135,0xc9))[_0xf10c('0x41')](handleError(_0x20f135,null));};exports['update']=function(_0x390ff4,_0x26f4d9){if(_0x390ff4[_0xf10c('0x45')]['id']){delete _0x390ff4[_0xf10c('0x45')]['id'];}return db[_0xf10c('0x2a')][_0xf10c('0x43')]({'where':{'id':_0x390ff4['params']['id']}})[_0xf10c('0x24')](handleEntityNotFound(_0x26f4d9,null))[_0xf10c('0x24')](saveUpdates(_0x390ff4[_0xf10c('0x45')],null))[_0xf10c('0x24')](respondWithResult(_0x26f4d9,null))[_0xf10c('0x41')](handleError(_0x26f4d9,null));};exports[_0xf10c('0x23')]=function(_0x1d0081,_0x251c1e){return db[_0xf10c('0x2a')][_0xf10c('0x43')]({'where':{'id':_0x1d0081['params']['id']}})[_0xf10c('0x24')](handleEntityNotFound(_0x251c1e,null))[_0xf10c('0x24')](removeEntity(_0x251c1e,null))[_0xf10c('0x41')](handleError(_0x251c1e,null));};exports[_0xf10c('0x46')]=function(_0x38b3eb,_0xf2d9d2){return db[_0xf10c('0x2a')][_0xf10c('0x46')]()[_0xf10c('0x24')](respondWithResult(_0xf2d9d2,null))[_0xf10c('0x41')](handleError(_0xf2d9d2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 46da780..bffb8c0 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5e7467,_0x33457e){var _0x2e3752=function(_0x3de01e){while(--_0x3de01e){_0x5e7467['push'](_0x5e7467['shift']());}};_0x2e3752(++_0x33457e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xcb91[_0x23be51];return _0x47a26d;};'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')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index df7f594..7942788 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 _0x7c6f=['request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','CreateSmsQueueReport','create','body','options','raw','debug','catch','where','attributes','then','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1d4cac,_0x2145a5){var _0x26ecdb=function(_0x3b32b3){while(--_0x3b32b3){_0x1d4cac['push'](_0x1d4cac['shift']());}};_0x26ecdb(++_0x2145a5);}(_0x7c6f,0x1b5));var _0xf7c6=function(_0x3b837c,_0x1bd1e7){_0x3b837c=_0x3b837c-0x0;var _0x3a0fb8=_0x7c6f[_0x3b837c];return _0x3a0fb8;};'use strict';var _=require(_0xf7c6('0x0'));var util=require(_0xf7c6('0x1'));var moment=require(_0xf7c6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7c6('0x3'));var db=require(_0xf7c6('0x4'))['db'];var utils=require(_0xf7c6('0x5'));var logger=require(_0xf7c6('0x6'))(_0xf7c6('0x7'));var config=require('../../config/environment');var jayson=require(_0xf7c6('0x8'));var client=jayson[_0xf7c6('0x9')][_0xf7c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba6e0,_0x5cc8a6,_0x11da64){return new BPromise(function(_0x598fc6,_0x3c7c30){return client[_0xf7c6('0xb')](_0x2ba6e0,_0x11da64)['then'](function(_0x431191){logger[_0xf7c6('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x5cc8a6,'request\x20sent');logger['debug'](_0xf7c6('0xd'),_0x5cc8a6,_0xf7c6('0xe'),JSON[_0xf7c6('0xf')](_0x431191));if(_0x431191[_0xf7c6('0x10')]){if(_0x431191['error'][_0xf7c6('0x11')]===0x1f4){logger[_0xf7c6('0x10')](_0xf7c6('0x12'),_0x5cc8a6,_0x431191[_0xf7c6('0x10')]['message']);return _0x3c7c30(_0x431191[_0xf7c6('0x10')][_0xf7c6('0x13')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5cc8a6,_0x431191[_0xf7c6('0x10')][_0xf7c6('0x13')]);return _0x598fc6(_0x431191['error'][_0xf7c6('0x13')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5cc8a6,_0xf7c6('0xe'));_0x598fc6(_0x431191[_0xf7c6('0x14')][_0xf7c6('0x13')]);}})['catch'](function(_0x2ad20c){logger[_0xf7c6('0x10')](_0xf7c6('0x12'),_0x5cc8a6,_0x2ad20c);_0x3c7c30(_0x2ad20c);});});}exports[_0xf7c6('0x15')]=function(_0x234647){var _0x34ba32=this;return new Promise(function(_0x4a8f84,_0x38b425){return db['SmsQueueReport'][_0xf7c6('0x16')](_0x234647[_0xf7c6('0x17')],{'raw':_0x234647[_0xf7c6('0x18')]?_0x234647[_0xf7c6('0x18')][_0xf7c6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x101797){logger[_0xf7c6('0xc')](_0xf7c6('0x15'),_0x234647);logger[_0xf7c6('0x1a')](_0xf7c6('0x15'),_0x234647,JSON[_0xf7c6('0xf')](_0x101797));_0x4a8f84(_0x101797);})[_0xf7c6('0x1b')](function(_0x1e8033){logger[_0xf7c6('0x10')](_0xf7c6('0x15'),_0x1e8033['message'],_0x234647);_0x38b425(_0x34ba32[_0xf7c6('0x10')](0x1f4,_0x1e8033['message']));});});};exports['UpdateSmsQueueReport']=function(_0x5621c7){var _0x59676e=this;return new Promise(function(_0x530487,_0x56489f){return db['SmsQueueReport']['update'](_0x5621c7[_0xf7c6('0x17')],{'raw':_0x5621c7[_0xf7c6('0x18')]?_0x5621c7[_0xf7c6('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5621c7[_0xf7c6('0x18')]?_0x5621c7[_0xf7c6('0x18')][_0xf7c6('0x1c')]||null:null,'attributes':_0x5621c7[_0xf7c6('0x18')]?_0x5621c7[_0xf7c6('0x18')][_0xf7c6('0x1d')]||null:null,'limit':_0x5621c7['options']?_0x5621c7[_0xf7c6('0x18')]['limit']||null:null})[_0xf7c6('0x1e')](function(_0x1ec70e){logger[_0xf7c6('0xc')](_0xf7c6('0x1f'),_0x5621c7);logger['debug'](_0xf7c6('0x1f'),_0x5621c7,JSON[_0xf7c6('0xf')](_0x1ec70e));_0x530487(_0x1ec70e);})['catch'](function(_0x2c4916){logger[_0xf7c6('0x10')]('UpdateSmsQueueReport',_0x2c4916['message'],_0x5621c7);_0x56489f(_0x59676e['error'](0x1f4,_0x2c4916['message']));});});}; \ No newline at end of file +var _0xb090=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsQueueReport','options','raw','info','debug','UpdateSmsQueueReport','SmsQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird'];(function(_0x540e3c,_0xd1c0e5){var _0x3c4741=function(_0x8c8997){while(--_0x8c8997){_0x540e3c['push'](_0x540e3c['shift']());}};_0x3c4741(++_0xd1c0e5);}(_0xb090,0xf4));var _0x0b09=function(_0x510e91,_0x5bf2d9){_0x510e91=_0x510e91-0x0;var _0x369221=_0xb090[_0x510e91];return _0x369221;};'use strict';var _=require(_0x0b09('0x0'));var util=require(_0x0b09('0x1'));var moment=require(_0x0b09('0x2'));var BPromise=require(_0x0b09('0x3'));var rs=require(_0x0b09('0x4'));var fs=require('fs');var Redis=require(_0x0b09('0x5'));var db=require(_0x0b09('0x6'))['db'];var utils=require(_0x0b09('0x7'));var logger=require(_0x0b09('0x8'))(_0x0b09('0x9'));var config=require(_0x0b09('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0b09('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x160289,_0x289762,_0xa962fc){return new BPromise(function(_0x312a3d,_0x191769){return client['request'](_0x160289,_0xa962fc)[_0x0b09('0xc')](function(_0x26e6fa){logger['info'](_0x0b09('0xd'),_0x289762,_0x0b09('0xe'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x289762,_0x0b09('0xe'),JSON[_0x0b09('0xf')](_0x26e6fa));if(_0x26e6fa['error']){if(_0x26e6fa[_0x0b09('0x10')][_0x0b09('0x11')]===0x1f4){logger['error'](_0x0b09('0xd'),_0x289762,_0x26e6fa[_0x0b09('0x10')]['message']);return _0x191769(_0x26e6fa[_0x0b09('0x10')][_0x0b09('0x12')]);}logger['error'](_0x0b09('0xd'),_0x289762,_0x26e6fa[_0x0b09('0x10')][_0x0b09('0x12')]);return _0x312a3d(_0x26e6fa[_0x0b09('0x10')]['message']);}else{logger['info'](_0x0b09('0xd'),_0x289762,'request\x20sent');_0x312a3d(_0x26e6fa['result'][_0x0b09('0x12')]);}})[_0x0b09('0x13')](function(_0x37f6b1){logger[_0x0b09('0x10')](_0x0b09('0xd'),_0x289762,_0x37f6b1);_0x191769(_0x37f6b1);});});}exports[_0x0b09('0x14')]=function(_0x4df85c){var _0x2685a5=this;return new Promise(function(_0x2f36c8,_0x10cfba){return db['SmsQueueReport']['create'](_0x4df85c['body'],{'raw':_0x4df85c['options']?_0x4df85c[_0x0b09('0x15')][_0x0b09('0x16')]===undefined?!![]:![]:!![]})[_0x0b09('0xc')](function(_0x157e05){logger[_0x0b09('0x17')](_0x0b09('0x14'),_0x4df85c);logger[_0x0b09('0x18')](_0x0b09('0x14'),_0x4df85c,JSON[_0x0b09('0xf')](_0x157e05));_0x2f36c8(_0x157e05);})[_0x0b09('0x13')](function(_0x2c3ae7){logger[_0x0b09('0x10')](_0x0b09('0x14'),_0x2c3ae7[_0x0b09('0x12')],_0x4df85c);_0x10cfba(_0x2685a5[_0x0b09('0x10')](0x1f4,_0x2c3ae7[_0x0b09('0x12')]));});});};exports[_0x0b09('0x19')]=function(_0x45287e){var _0x3c75c9=this;return new Promise(function(_0x4da8b4,_0x33780e){return db[_0x0b09('0x1a')][_0x0b09('0x1b')](_0x45287e[_0x0b09('0x1c')],{'raw':_0x45287e[_0x0b09('0x15')]?_0x45287e[_0x0b09('0x15')][_0x0b09('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45287e['options']?_0x45287e[_0x0b09('0x15')]['where']||null:null,'attributes':_0x45287e[_0x0b09('0x15')]?_0x45287e[_0x0b09('0x15')][_0x0b09('0x1d')]||null:null,'limit':_0x45287e['options']?_0x45287e['options'][_0x0b09('0x1e')]||null:null})[_0x0b09('0xc')](function(_0x207ddd){logger['info']('UpdateSmsQueueReport',_0x45287e);logger[_0x0b09('0x18')](_0x0b09('0x19'),_0x45287e,JSON[_0x0b09('0xf')](_0x207ddd));_0x4da8b4(_0x207ddd);})['catch'](function(_0x1d34bb){logger[_0x0b09('0x10')]('UpdateSmsQueueReport',_0x1d34bb[_0x0b09('0x12')],_0x45287e);_0x33780e(_0x3c75c9['error'](0x1f4,_0x1d34bb['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a5e5ab2..b98a4f7 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 _0x7118=['post','update','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2ea753,_0x3e9487){var _0x1d3676=function(_0x23f53d){while(--_0x23f53d){_0x2ea753['push'](_0x2ea753['shift']());}};_0x1d3676(++_0x3e9487);}(_0x7118,0x159));var _0x8711=function(_0x3816d4,_0x118648){_0x3816d4=_0x3816d4-0x0;var _0x154e01=_0x7118[_0x3816d4];return _0x154e01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var fs_extra=require(_0x8711('0x3'));var auth=require(_0x8711('0x4'));var interaction=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var controller=require(_0x8711('0x7'));router[_0x8711('0x8')]('/',auth['isAuthenticated'](),controller[_0x8711('0x9')]);router[_0x8711('0x8')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0xc')]);router[_0x8711('0x8')](_0x8711('0xd'),auth[_0x8711('0xb')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')]('/',auth[_0x8711('0xb')](),controller['create']);router['put'](_0x8711('0xd'),auth[_0x8711('0xb')](),controller[_0x8711('0x10')]);router['delete']('/:id',auth[_0x8711('0xb')](),controller[_0x8711('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7579=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x179931,_0x49c5ff){var _0x5a8cf7=function(_0x59fa9d){while(--_0x59fa9d){_0x179931['push'](_0x179931['shift']());}};_0x5a8cf7(++_0x49c5ff);}(_0x7579,0x1e2));var _0x9757=function(_0x396521,_0x46d98c){_0x396521=_0x396521-0x0;var _0x5bc1aa=_0x7579[_0x396521];return _0x5bc1aa;};'use strict';var multer=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var path=require(_0x9757('0x2'));var timeout=require(_0x9757('0x3'));var express=require(_0x9757('0x4'));var router=express[_0x9757('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9757('0x6'));var interaction=require(_0x9757('0x7'));var config=require(_0x9757('0x8'));var controller=require(_0x9757('0x9'));router['get']('/',auth[_0x9757('0xa')](),controller[_0x9757('0xb')]);router[_0x9757('0xc')]('/describe',auth[_0x9757('0xa')](),controller['describe']);router[_0x9757('0xc')](_0x9757('0xd'),auth[_0x9757('0xa')](),controller['show']);router[_0x9757('0xe')]('/',auth[_0x9757('0xa')](),controller[_0x9757('0xf')]);router[_0x9757('0x10')](_0x9757('0xd'),auth[_0x9757('0xa')](),controller[_0x9757('0x11')]);router[_0x9757('0x12')](_0x9757('0xd'),auth[_0x9757('0xa')](),controller[_0x9757('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 746ce4b..2c560b2 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2ef542,_0x194c8e){var _0x2c242e=function(_0xab89d3){while(--_0xab89d3){_0x2ef542['push'](_0x2ef542['shift']());}};_0x2c242e(++_0x194c8e);}(_0x70e0,0x17b));var _0x070e=function(_0x229c1c,_0x64e084){_0x229c1c=_0x229c1c-0x0;var _0x10f2cc=_0x70e0[_0x229c1c];return _0x10f2cc;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x28552e,_0x429578){var _0x2c4943=function(_0x3682ea){while(--_0x3682ea){_0x28552e['push'](_0x28552e['shift']());}};_0x2c4943(++_0x429578);}(_0x70e0,0x17b));var _0x070e=function(_0x1cbb2a,_0x4c3039){_0x1cbb2a=_0x1cbb2a-0x0;var _0x3f2090=_0x70e0[_0x1cbb2a];return _0x3f2090;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a998c82..41de690 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 _0x0112=['status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4e536b,_0x4719dc){var _0x15d06e=function(_0x578b61){while(--_0x578b61){_0x4e536b['push'](_0x4e536b['shift']());}};_0x15d06e(++_0x4719dc);}(_0x0112,0x1e4));var _0x2011=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0112[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x2011('0x0'));var rimraf=require(_0x2011('0x1'));var zipdir=require(_0x2011('0x2'));var jsonpatch=require(_0x2011('0x3'));var rp=require(_0x2011('0x4'));var moment=require(_0x2011('0x5'));var BPromise=require(_0x2011('0x6'));var Mustache=require(_0x2011('0x7'));var util=require(_0x2011('0x8'));var path=require(_0x2011('0x9'));var sox=require(_0x2011('0xa'));var csv=require(_0x2011('0xb'));var ejs=require(_0x2011('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2011('0xd'));var squel=require(_0x2011('0xe'));var crypto=require(_0x2011('0xf'));var jsforce=require(_0x2011('0x10'));var deskjs=require(_0x2011('0x11'));var toCsv=require(_0x2011('0xb'));var querystring=require('querystring');var Papa=require(_0x2011('0x12'));var Redis=require(_0x2011('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2011('0x14'));var hardwareService=require(_0x2011('0x15'));var logger=require(_0x2011('0x16'))(_0x2011('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2011('0x18'));var db=require(_0x2011('0x19'))['db'];function respondWithStatusCode(_0x2ce445,_0x325cac){_0x325cac=_0x325cac||0xcc;return function(_0x3e1a35){if(_0x3e1a35){return _0x2ce445[_0x2011('0x1a')](_0x325cac);}return _0x2ce445[_0x2011('0x1b')](_0x325cac)['end']();};}function respondWithResult(_0x369a60,_0x3c27f5){_0x3c27f5=_0x3c27f5||0xc8;return function(_0x49c8fb){if(_0x49c8fb){return _0x369a60[_0x2011('0x1b')](_0x3c27f5)[_0x2011('0x1c')](_0x49c8fb);}};}function respondWithFilteredResult(_0x7b44d3,_0x181901){return function(_0x11a4f8){if(_0x11a4f8){var _0x234503=typeof _0x181901['offset']===_0x2011('0x1d')&&typeof _0x181901[_0x2011('0x1e')]===_0x2011('0x1d');var _0x52cf6b=_0x11a4f8[_0x2011('0x1f')];var _0x7ecad1=_0x234503?0x0:_0x181901['offset'];var _0x303e7a=_0x234503?_0x11a4f8[_0x2011('0x1f')]:_0x181901[_0x2011('0x20')]+_0x181901[_0x2011('0x1e')];var _0x461fa4;if(_0x303e7a>=_0x52cf6b){_0x303e7a=_0x52cf6b;_0x461fa4=0xc8;}else{_0x461fa4=0xce;}_0x7b44d3[_0x2011('0x1b')](_0x461fa4);return _0x7b44d3['set'](_0x2011('0x21'),_0x7ecad1+'-'+_0x303e7a+'/'+_0x52cf6b)[_0x2011('0x1c')](_0x11a4f8);}return null;};}function patchUpdates(_0x25123c){return function(_0x372eb3){try{jsonpatch[_0x2011('0x22')](_0x372eb3,_0x25123c,!![]);}catch(_0x294dee){return BPromise[_0x2011('0x23')](_0x294dee);}return _0x372eb3[_0x2011('0x24')]();};}function saveUpdates(_0x393033,_0x56d191){return function(_0x3ba077){if(_0x3ba077){return _0x3ba077[_0x2011('0x25')](_0x393033)[_0x2011('0x26')](function(_0x5a3056){return _0x5a3056;});}return null;};}function removeEntity(_0x5ae801,_0x121b99){return function(_0x58faf9){if(_0x58faf9){return _0x58faf9[_0x2011('0x27')]()[_0x2011('0x26')](function(){_0x5ae801[_0x2011('0x1b')](0xcc)[_0x2011('0x28')]();});}};}function handleEntityNotFound(_0x281157,_0x3435a0){return function(_0x3c3843){if(!_0x3c3843){_0x281157['sendStatus'](0x194);}return _0x3c3843;};}function handleError(_0x252b3d,_0x40819b){_0x40819b=_0x40819b||0x1f4;return function(_0x554563){logger[_0x2011('0x29')](_0x554563[_0x2011('0x2a')]);if(_0x554563['name']){delete _0x554563['name'];}_0x252b3d[_0x2011('0x1b')](_0x40819b)[_0x2011('0x2b')](_0x554563);};}exports['index']=function(_0x5a6d47,_0x474560){var _0x47a9ce={},_0x4c3872={},_0x12b128={'count':0x0,'rows':[]};var _0x5eb693=_[_0x2011('0x2c')](db[_0x2011('0x2d')][_0x2011('0x2e')],function(_0x3b1086){return{'name':_0x3b1086[_0x2011('0x2f')],'type':_0x3b1086[_0x2011('0x30')]['key']};});_0x4c3872['model']=_[_0x2011('0x2c')](_0x5eb693,'name');_0x4c3872[_0x2011('0x31')]=_[_0x2011('0x32')](_0x5a6d47[_0x2011('0x31')]);_0x4c3872[_0x2011('0x33')]=_['intersection'](_0x4c3872[_0x2011('0x34')],_0x4c3872['query']);_0x47a9ce['attributes']=_['intersection'](_0x4c3872['model'],qs[_0x2011('0x35')](_0x5a6d47[_0x2011('0x31')][_0x2011('0x35')]));_0x47a9ce['attributes']=_0x47a9ce[_0x2011('0x36')][_0x2011('0x37')]?_0x47a9ce[_0x2011('0x36')]:_0x4c3872[_0x2011('0x34')];if(!_0x5a6d47['query']['hasOwnProperty'](_0x2011('0x38'))){_0x47a9ce[_0x2011('0x1e')]=qs[_0x2011('0x1e')](_0x5a6d47[_0x2011('0x31')][_0x2011('0x1e')]);_0x47a9ce['offset']=qs[_0x2011('0x20')](_0x5a6d47[_0x2011('0x31')][_0x2011('0x20')]);}_0x47a9ce[_0x2011('0x39')]=qs['sort'](_0x5a6d47[_0x2011('0x31')][_0x2011('0x3a')]);_0x47a9ce[_0x2011('0x3b')]=qs[_0x2011('0x33')](_['pick'](_0x5a6d47[_0x2011('0x31')],_0x4c3872[_0x2011('0x33')]),_0x5eb693);if(_0x5a6d47[_0x2011('0x31')][_0x2011('0x3c')]){_0x47a9ce[_0x2011('0x3b')]=_['merge'](_0x47a9ce[_0x2011('0x3b')],{'$or':_[_0x2011('0x2c')](_0x5eb693,function(_0xb5042b){if(_0xb5042b[_0x2011('0x30')]!==_0x2011('0x3d')){var _0x117048={};_0x117048[_0xb5042b['name']]={'$like':'%'+_0x5a6d47[_0x2011('0x31')][_0x2011('0x3c')]+'%'};return _0x117048;}})});}_0x47a9ce=_[_0x2011('0x3e')]({},_0x47a9ce,_0x5a6d47[_0x2011('0x3f')]);var _0x23894e={'where':_0x47a9ce['where']};return db[_0x2011('0x2d')][_0x2011('0x1f')](_0x23894e)[_0x2011('0x26')](function(_0x1ab544){_0x12b128['count']=_0x1ab544;if(_0x5a6d47[_0x2011('0x31')][_0x2011('0x40')]){_0x47a9ce[_0x2011('0x41')]=[{'all':!![]}];}return db[_0x2011('0x2d')]['findAll'](_0x47a9ce);})[_0x2011('0x26')](function(_0x370667){_0x12b128['rows']=_0x370667;return _0x12b128;})['then'](respondWithFilteredResult(_0x474560,_0x47a9ce))[_0x2011('0x42')](handleError(_0x474560,null));};exports['show']=function(_0x415516,_0x24029d){var _0x4a90d5={'raw':!![],'where':{'id':_0x415516[_0x2011('0x43')]['id']}},_0x52d3b5={};_0x52d3b5[_0x2011('0x34')]=_[_0x2011('0x32')](db[_0x2011('0x2d')][_0x2011('0x2e')]);_0x52d3b5[_0x2011('0x31')]=_[_0x2011('0x32')](_0x415516[_0x2011('0x31')]);_0x52d3b5[_0x2011('0x33')]=_[_0x2011('0x44')](_0x52d3b5[_0x2011('0x34')],_0x52d3b5[_0x2011('0x31')]);_0x4a90d5['attributes']=_['intersection'](_0x52d3b5[_0x2011('0x34')],qs[_0x2011('0x35')](_0x415516[_0x2011('0x31')]['fields']));_0x4a90d5['attributes']=_0x4a90d5['attributes']['length']?_0x4a90d5[_0x2011('0x36')]:_0x52d3b5[_0x2011('0x34')];if(_0x415516[_0x2011('0x31')][_0x2011('0x40')]){_0x4a90d5[_0x2011('0x41')]=[{'all':!![]}];}_0x4a90d5=_[_0x2011('0x3e')]({},_0x4a90d5,_0x415516[_0x2011('0x3f')]);return db[_0x2011('0x2d')][_0x2011('0x45')](_0x4a90d5)['then'](handleEntityNotFound(_0x24029d,null))[_0x2011('0x26')](respondWithResult(_0x24029d,null))['catch'](handleError(_0x24029d,null));};exports['create']=function(_0x44bdcb,_0x45bcb1){return db[_0x2011('0x2d')][_0x2011('0x46')](_0x44bdcb[_0x2011('0x47')],{})[_0x2011('0x26')](respondWithResult(_0x45bcb1,0xc9))[_0x2011('0x42')](handleError(_0x45bcb1,null));};exports[_0x2011('0x25')]=function(_0x2e672c,_0x4f829d){if(_0x2e672c[_0x2011('0x47')]['id']){delete _0x2e672c[_0x2011('0x47')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x2e672c[_0x2011('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f829d,null))[_0x2011('0x26')](saveUpdates(_0x2e672c[_0x2011('0x47')],null))[_0x2011('0x26')](respondWithResult(_0x4f829d,null))['catch'](handleError(_0x4f829d,null));};exports[_0x2011('0x27')]=function(_0x224688,_0x14219e){return db['SmsTransferReport']['find']({'where':{'id':_0x224688[_0x2011('0x43')]['id']}})[_0x2011('0x26')](handleEntityNotFound(_0x14219e,null))[_0x2011('0x26')](removeEntity(_0x14219e,null))[_0x2011('0x42')](handleError(_0x14219e,null));};exports[_0x2011('0x48')]=function(_0x356b2a,_0x111a06){return db[_0x2011('0x2d')][_0x2011('0x48')]()[_0x2011('0x26')](respondWithResult(_0x111a06,null))[_0x2011('0x42')](handleError(_0x111a06,null));}; \ No newline at end of file +var _0x9cf7=['limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined'];(function(_0x5f0a04,_0x329135){var _0x4c5bfa=function(_0x5123ed){while(--_0x5123ed){_0x5f0a04['push'](_0x5f0a04['shift']());}};_0x4c5bfa(++_0x329135);}(_0x9cf7,0x163));var _0x79cf=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9cf7[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x79cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79cf('0x1'));var jsonpatch=require(_0x79cf('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79cf('0x3'));var Mustache=require(_0x79cf('0x4'));var util=require(_0x79cf('0x5'));var path=require(_0x79cf('0x6'));var sox=require(_0x79cf('0x7'));var csv=require('to-csv');var ejs=require(_0x79cf('0x8'));var fs=require('fs');var fs_extra=require(_0x79cf('0x9'));var _=require(_0x79cf('0xa'));var squel=require(_0x79cf('0xb'));var crypto=require(_0x79cf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x79cf('0xd'));var toCsv=require(_0x79cf('0xe'));var querystring=require('querystring');var Papa=require(_0x79cf('0xf'));var Redis=require(_0x79cf('0x10'));var authService=require(_0x79cf('0x11'));var qs=require(_0x79cf('0x12'));var as=require(_0x79cf('0x13'));var hardwareService=require(_0x79cf('0x14'));var logger=require(_0x79cf('0x15'))(_0x79cf('0x16'));var utils=require(_0x79cf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x79cf('0x18'));var db=require(_0x79cf('0x19'))['db'];function respondWithStatusCode(_0x32c261,_0x26be68){_0x26be68=_0x26be68||0xcc;return function(_0x31d064){if(_0x31d064){return _0x32c261[_0x79cf('0x1a')](_0x26be68);}return _0x32c261['status'](_0x26be68)[_0x79cf('0x1b')]();};}function respondWithResult(_0x268b3d,_0x4d33ec){_0x4d33ec=_0x4d33ec||0xc8;return function(_0xc8898c){if(_0xc8898c){return _0x268b3d[_0x79cf('0x1c')](_0x4d33ec)['json'](_0xc8898c);}};}function respondWithFilteredResult(_0x21b7e8,_0x1d70ba){return function(_0xa8f1d5){if(_0xa8f1d5){var _0x73960b=typeof _0x1d70ba['offset']===_0x79cf('0x1d')&&typeof _0x1d70ba[_0x79cf('0x1e')]===_0x79cf('0x1d');var _0x550fb5=_0xa8f1d5[_0x79cf('0x1f')];var _0x27c4a5=_0x73960b?0x0:_0x1d70ba[_0x79cf('0x20')];var _0x497e98=_0x73960b?_0xa8f1d5['count']:_0x1d70ba['offset']+_0x1d70ba[_0x79cf('0x1e')];var _0x42d104;if(_0x497e98>=_0x550fb5){_0x497e98=_0x550fb5;_0x42d104=0xc8;}else{_0x42d104=0xce;}_0x21b7e8[_0x79cf('0x1c')](_0x42d104);return _0x21b7e8[_0x79cf('0x21')](_0x79cf('0x22'),_0x27c4a5+'-'+_0x497e98+'/'+_0x550fb5)['json'](_0xa8f1d5);}return null;};}function patchUpdates(_0x5a121a){return function(_0x431d90){try{jsonpatch[_0x79cf('0x23')](_0x431d90,_0x5a121a,!![]);}catch(_0x49a1fb){return BPromise['reject'](_0x49a1fb);}return _0x431d90['save']();};}function saveUpdates(_0x1c87ee,_0x518179){return function(_0x44cf21){if(_0x44cf21){return _0x44cf21[_0x79cf('0x24')](_0x1c87ee)[_0x79cf('0x25')](function(_0x486c53){return _0x486c53;});}return null;};}function removeEntity(_0x2f9933,_0x2f2847){return function(_0xce764b){if(_0xce764b){return _0xce764b[_0x79cf('0x26')]()[_0x79cf('0x25')](function(){_0x2f9933['status'](0xcc)[_0x79cf('0x1b')]();});}};}function handleEntityNotFound(_0x218190,_0x3fda5f){return function(_0x50b6bf){if(!_0x50b6bf){_0x218190[_0x79cf('0x1a')](0x194);}return _0x50b6bf;};}function handleError(_0x21a327,_0x2b13c0){_0x2b13c0=_0x2b13c0||0x1f4;return function(_0x25ec96){logger[_0x79cf('0x27')](_0x25ec96[_0x79cf('0x28')]);if(_0x25ec96[_0x79cf('0x29')]){delete _0x25ec96[_0x79cf('0x29')];}_0x21a327[_0x79cf('0x1c')](_0x2b13c0)[_0x79cf('0x2a')](_0x25ec96);};}exports[_0x79cf('0x2b')]=function(_0x444038,_0xd5a7f5){var _0x2c3526={},_0x90f96c={},_0x2dd3f2={'count':0x0,'rows':[]};var _0x307cff=_[_0x79cf('0x2c')](db[_0x79cf('0x2d')]['rawAttributes'],function(_0x53e988){return{'name':_0x53e988[_0x79cf('0x2e')],'type':_0x53e988[_0x79cf('0x2f')][_0x79cf('0x30')]};});_0x90f96c[_0x79cf('0x31')]=_[_0x79cf('0x2c')](_0x307cff,_0x79cf('0x29'));_0x90f96c[_0x79cf('0x32')]=_[_0x79cf('0x33')](_0x444038[_0x79cf('0x32')]);_0x90f96c[_0x79cf('0x34')]=_[_0x79cf('0x35')](_0x90f96c[_0x79cf('0x31')],_0x90f96c[_0x79cf('0x32')]);_0x2c3526[_0x79cf('0x36')]=_['intersection'](_0x90f96c['model'],qs[_0x79cf('0x37')](_0x444038[_0x79cf('0x32')][_0x79cf('0x37')]));_0x2c3526['attributes']=_0x2c3526[_0x79cf('0x36')][_0x79cf('0x38')]?_0x2c3526[_0x79cf('0x36')]:_0x90f96c['model'];if(!_0x444038[_0x79cf('0x32')][_0x79cf('0x39')](_0x79cf('0x3a'))){_0x2c3526[_0x79cf('0x1e')]=qs['limit'](_0x444038[_0x79cf('0x32')][_0x79cf('0x1e')]);_0x2c3526[_0x79cf('0x20')]=qs[_0x79cf('0x20')](_0x444038[_0x79cf('0x32')][_0x79cf('0x20')]);}_0x2c3526['order']=qs[_0x79cf('0x3b')](_0x444038[_0x79cf('0x32')][_0x79cf('0x3b')]);_0x2c3526[_0x79cf('0x3c')]=qs[_0x79cf('0x34')](_[_0x79cf('0x3d')](_0x444038['query'],_0x90f96c[_0x79cf('0x34')]),_0x307cff);if(_0x444038['query'][_0x79cf('0x3e')]){_0x2c3526[_0x79cf('0x3c')]=_[_0x79cf('0x3f')](_0x2c3526[_0x79cf('0x3c')],{'$or':_[_0x79cf('0x2c')](_0x307cff,function(_0x3d4c4b){if(_0x3d4c4b['type']!==_0x79cf('0x40')){var _0x246ee3={};_0x246ee3[_0x3d4c4b['name']]={'$like':'%'+_0x444038[_0x79cf('0x32')]['filter']+'%'};return _0x246ee3;}})});}_0x2c3526=_[_0x79cf('0x3f')]({},_0x2c3526,_0x444038[_0x79cf('0x41')]);var _0x4cccbf={'where':_0x2c3526[_0x79cf('0x3c')]};return db[_0x79cf('0x2d')]['count'](_0x4cccbf)[_0x79cf('0x25')](function(_0x3905d8){_0x2dd3f2[_0x79cf('0x1f')]=_0x3905d8;if(_0x444038[_0x79cf('0x32')][_0x79cf('0x42')]){_0x2c3526[_0x79cf('0x43')]=[{'all':!![]}];}return db[_0x79cf('0x2d')]['findAll'](_0x2c3526);})[_0x79cf('0x25')](function(_0x13ecf0){_0x2dd3f2[_0x79cf('0x44')]=_0x13ecf0;return _0x2dd3f2;})[_0x79cf('0x25')](respondWithFilteredResult(_0xd5a7f5,_0x2c3526))[_0x79cf('0x45')](handleError(_0xd5a7f5,null));};exports[_0x79cf('0x46')]=function(_0x3e407e,_0x5c257f){var _0x28d70f={'raw':!![],'where':{'id':_0x3e407e['params']['id']}},_0x35714e={};_0x35714e['model']=_[_0x79cf('0x33')](db[_0x79cf('0x2d')][_0x79cf('0x47')]);_0x35714e[_0x79cf('0x32')]=_[_0x79cf('0x33')](_0x3e407e[_0x79cf('0x32')]);_0x35714e[_0x79cf('0x34')]=_[_0x79cf('0x35')](_0x35714e['model'],_0x35714e[_0x79cf('0x32')]);_0x28d70f[_0x79cf('0x36')]=_[_0x79cf('0x35')](_0x35714e['model'],qs[_0x79cf('0x37')](_0x3e407e[_0x79cf('0x32')][_0x79cf('0x37')]));_0x28d70f[_0x79cf('0x36')]=_0x28d70f[_0x79cf('0x36')][_0x79cf('0x38')]?_0x28d70f[_0x79cf('0x36')]:_0x35714e[_0x79cf('0x31')];if(_0x3e407e[_0x79cf('0x32')]['includeAll']){_0x28d70f['include']=[{'all':!![]}];}_0x28d70f=_[_0x79cf('0x3f')]({},_0x28d70f,_0x3e407e[_0x79cf('0x41')]);return db[_0x79cf('0x2d')][_0x79cf('0x48')](_0x28d70f)[_0x79cf('0x25')](handleEntityNotFound(_0x5c257f,null))[_0x79cf('0x25')](respondWithResult(_0x5c257f,null))[_0x79cf('0x45')](handleError(_0x5c257f,null));};exports[_0x79cf('0x49')]=function(_0x30990b,_0x248aa5){return db[_0x79cf('0x2d')][_0x79cf('0x49')](_0x30990b[_0x79cf('0x4a')],{})['then'](respondWithResult(_0x248aa5,0xc9))[_0x79cf('0x45')](handleError(_0x248aa5,null));};exports[_0x79cf('0x24')]=function(_0x281a61,_0x4246e9){if(_0x281a61[_0x79cf('0x4a')]['id']){delete _0x281a61['body']['id'];}return db[_0x79cf('0x2d')][_0x79cf('0x48')]({'where':{'id':_0x281a61[_0x79cf('0x4b')]['id']}})[_0x79cf('0x25')](handleEntityNotFound(_0x4246e9,null))[_0x79cf('0x25')](saveUpdates(_0x281a61['body'],null))['then'](respondWithResult(_0x4246e9,null))[_0x79cf('0x45')](handleError(_0x4246e9,null));};exports[_0x79cf('0x26')]=function(_0x59d9fe,_0x2e1883){return db[_0x79cf('0x2d')]['find']({'where':{'id':_0x59d9fe[_0x79cf('0x4b')]['id']}})[_0x79cf('0x25')](handleEntityNotFound(_0x2e1883,null))[_0x79cf('0x25')](removeEntity(_0x2e1883,null))[_0x79cf('0x45')](handleError(_0x2e1883,null));};exports[_0x79cf('0x4c')]=function(_0x55dcdc,_0x46eb0e){return db[_0x79cf('0x2d')][_0x79cf('0x4c')]()[_0x79cf('0x25')](respondWithResult(_0x46eb0e,null))[_0x79cf('0x45')](handleError(_0x46eb0e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 2e69bf5..cfe6622 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 _0xa6e7=['rimraf','../../config/environment','./smsTransferReport.attributes','define','uniqueid','lodash','../../config/logger','api','path'];(function(_0x3e725a,_0x5bdf0e){var _0x38f869=function(_0x39f45c){while(--_0x39f45c){_0x3e725a['push'](_0x3e725a['shift']());}};_0x38f869(++_0x5bdf0e);}(_0xa6e7,0xb0));var _0x7a6e=function(_0xbe31d1,_0x126345){_0xbe31d1=_0xbe31d1-0x0;var _0x7bd03=_0xa6e7[_0xbe31d1];return _0x7bd03;};'use strict';var _=require(_0x7a6e('0x0'));var util=require('util');var logger=require(_0x7a6e('0x1'))(_0x7a6e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a6e('0x3'));var rimraf=require(_0x7a6e('0x4'));var config=require(_0x7a6e('0x5'));var attributes=require(_0x7a6e('0x6'));module['exports']=function(_0x2e32bd,_0x2911ec){return _0x2e32bd[_0x7a6e('0x7')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7a6e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1429=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54e205,_0x296463){var _0xbb70af=function(_0x1e0f0e){while(--_0x1e0f0e){_0x54e205['push'](_0x54e205['shift']());}};_0xbb70af(++_0x296463);}(_0x1429,0x1d9));var _0x9142=function(_0x4dea1f,_0x95cad6){_0x4dea1f=_0x4dea1f-0x0;var _0x6b267b=_0x1429[_0x4dea1f];return _0x6b267b;};'use strict';var _=require(_0x9142('0x0'));var util=require(_0x9142('0x1'));var logger=require(_0x9142('0x2'))(_0x9142('0x3'));var moment=require(_0x9142('0x4'));var BPromise=require(_0x9142('0x5'));var rp=require(_0x9142('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9142('0x7'));var config=require(_0x9142('0x8'));var attributes=require(_0x9142('0x9'));module[_0x9142('0xa')]=function(_0x324675,_0x370c18){return _0x324675[_0x9142('0xb')](_0x9142('0xc'),attributes,{'tableName':_0x9142('0xd'),'paranoid':![],'indexes':[{'name':_0x9142('0xe'),'fields':[_0x9142('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8b1c4cf..d49098b 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 _0xa7dc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x3799dc,_0x4c3aa1){var _0x462026=function(_0x5113b9){while(--_0x5113b9){_0x3799dc['push'](_0x3799dc['shift']());}};_0x462026(++_0x4c3aa1);}(_0xa7dc,0x11d));var _0xca7d=function(_0x3887c1,_0x15b4be){_0x3887c1=_0x3887c1-0x0;var _0x485673=_0xa7dc[_0x3887c1];return _0x485673;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var moment=require(_0xca7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xca7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca7d('0x4'))['db'];var utils=require(_0xca7d('0x5'));var logger=require(_0xca7d('0x6'))(_0xca7d('0x7'));var config=require(_0xca7d('0x8'));var jayson=require(_0xca7d('0x9'));var client=jayson[_0xca7d('0xa')][_0xca7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5073dd,_0x22223d,_0x820afa){return new BPromise(function(_0x4d5bc7,_0x2920bd){return client[_0xca7d('0xc')](_0x5073dd,_0x820afa)[_0xca7d('0xd')](function(_0x5236ce){logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));logger[_0xca7d('0x11')](_0xca7d('0x12'),_0x22223d,'request\x20sent',JSON[_0xca7d('0x13')](_0x5236ce));if(_0x5236ce['error']){if(_0x5236ce[_0xca7d('0x14')]['code']===0x1f4){logger[_0xca7d('0x14')](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x2920bd(_0x5236ce['error']['message']);}logger['error'](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x4d5bc7(_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);}else{logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));_0x4d5bc7(_0x5236ce[_0xca7d('0x16')][_0xca7d('0x15')]);}})[_0xca7d('0x17')](function(_0x245c7c){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x22223d,_0x245c7c);_0x2920bd(_0x245c7c);});});} \ No newline at end of file +var _0x9879=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2fed84,_0x5aba15){var _0x5bf15e=function(_0x1769b4){while(--_0x1769b4){_0x2fed84['push'](_0x2fed84['shift']());}};_0x5bf15e(++_0x5aba15);}(_0x9879,0x98));var _0x9987=function(_0x27302b,_0xf9fe45){_0x27302b=_0x27302b-0x0;var _0x23c84f=_0x9879[_0x27302b];return _0x23c84f;};'use strict';var _=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var moment=require(_0x9987('0x2'));var BPromise=require('bluebird');var rs=require(_0x9987('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9987('0x4'))['db'];var utils=require(_0x9987('0x5'));var logger=require(_0x9987('0x6'))(_0x9987('0x7'));var config=require(_0x9987('0x8'));var jayson=require(_0x9987('0x9'));var client=jayson[_0x9987('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34d2fd,_0x5afd59,_0x6cb988){return new BPromise(function(_0x3e5538,_0x364d75){return client[_0x9987('0xb')](_0x34d2fd,_0x6cb988)[_0x9987('0xc')](function(_0x450f82){logger[_0x9987('0xd')](_0x9987('0xe'),_0x5afd59,_0x9987('0xf'));logger[_0x9987('0x10')](_0x9987('0x11'),_0x5afd59,_0x9987('0xf'),JSON[_0x9987('0x12')](_0x450f82));if(_0x450f82[_0x9987('0x13')]){if(_0x450f82[_0x9987('0x13')][_0x9987('0x14')]===0x1f4){logger[_0x9987('0x13')](_0x9987('0xe'),_0x5afd59,_0x450f82['error'][_0x9987('0x15')]);return _0x364d75(_0x450f82[_0x9987('0x13')][_0x9987('0x15')]);}logger[_0x9987('0x13')](_0x9987('0xe'),_0x5afd59,_0x450f82['error'][_0x9987('0x15')]);return _0x3e5538(_0x450f82['error'][_0x9987('0x15')]);}else{logger[_0x9987('0xd')](_0x9987('0xe'),_0x5afd59,_0x9987('0xf'));_0x3e5538(_0x450f82[_0x9987('0x16')][_0x9987('0x15')]);}})[_0x9987('0x17')](function(_0x3eefd0){logger[_0x9987('0x13')](_0x9987('0xe'),_0x5afd59,_0x3eefd0);_0x364d75(_0x3eefd0);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 818a4ff..0c586c7 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 _0xab2e=['diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname','now','post','create','put','update','delete','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0xab2e,0x90));var _0xeab2=function(_0x2a0ab3,_0x2b527c){_0x2a0ab3=_0x2a0ab3-0x0;var _0x5413ba=_0xab2e[_0x2a0ab3];return _0x5413ba;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeab2('0x0'));var router=express[_0xeab2('0x1')]();var fs_extra=require(_0xeab2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xeab2('0x3'));var config=require(_0xeab2('0x4'));var controller=require(_0xeab2('0x5'));router[_0xeab2('0x6')]('/',auth[_0xeab2('0x7')](),controller['index']);router['get'](_0xeab2('0x8'),auth[_0xeab2('0x7')](),controller[_0xeab2('0x9')]);router[_0xeab2('0x6')](_0xeab2('0xa'),auth[_0xeab2('0x7')](),controller[_0xeab2('0xb')]);var upload=multer({'storage':multer[_0xeab2('0xc')]({'destination':function(_0x4e5286,_0x2bc192,_0x1568f5){_0x1568f5(null,path[_0xeab2('0xd')](config[_0xeab2('0xe')],_0xeab2('0xf')));},'filename':function(_0x4fec33,_0x5cabca,_0x48cc2c){_0x5cabca[_0xeab2('0x10')]=_0x5cabca[_0xeab2('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x48cc2c(null,util[_0xeab2('0x11')](_0xeab2('0x12'),path['basename'](_0x5cabca[_0xeab2('0x10')],path[_0xeab2('0x13')](_0x5cabca[_0xeab2('0x10')])),Date[_0xeab2('0x14')](),path[_0xeab2('0x13')](_0x5cabca[_0xeab2('0x10')])));}})});router[_0xeab2('0x15')]('/',upload['single']('file'),controller[_0xeab2('0x16')]);router[_0xeab2('0x17')](_0xeab2('0x8'),auth['isAuthenticated'](),controller[_0xeab2('0x18')]);router[_0xeab2('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xeab2('0x19')]);module['exports']=router; \ No newline at end of file +var _0xf01f=['now','post','single','file','create','put','/:id','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0xf01f,0x1a9));var _0xff01=function(_0x101d9e,_0x118eb2){_0x101d9e=_0x101d9e-0x0;var _0x40592f=_0xf01f[_0x101d9e];return _0x40592f;};'use strict';var multer=require(_0xff01('0x0'));var util=require(_0xff01('0x1'));var path=require('path');var timeout=require(_0xff01('0x2'));var express=require(_0xff01('0x3'));var router=express[_0xff01('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff01('0x5'));var interaction=require(_0xff01('0x6'));var config=require(_0xff01('0x7'));var controller=require(_0xff01('0x8'));router[_0xff01('0x9')]('/',auth[_0xff01('0xa')](),controller[_0xff01('0xb')]);router[_0xff01('0x9')]('/:id',auth[_0xff01('0xa')](),controller[_0xff01('0xc')]);router[_0xff01('0x9')](_0xff01('0xd'),auth[_0xff01('0xa')](),controller[_0xff01('0xe')]);var upload=multer({'storage':multer[_0xff01('0xf')]({'destination':function(_0xdb31b7,_0xb48157,_0x4d42f0){_0x4d42f0(null,path[_0xff01('0x10')](config[_0xff01('0x11')],_0xff01('0x12')));},'filename':function(_0x47cf36,_0xebeba0,_0x20a4f1){_0xebeba0['originalname']=_0xebeba0[_0xff01('0x13')][_0xff01('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20a4f1(null,util['format'](_0xff01('0x15'),path['basename'](_0xebeba0[_0xff01('0x13')],path[_0xff01('0x16')](_0xebeba0['originalname'])),Date[_0xff01('0x17')](),path[_0xff01('0x16')](_0xebeba0[_0xff01('0x13')])));}})});router[_0xff01('0x18')]('/',upload[_0xff01('0x19')](_0xff01('0x1a')),controller[_0xff01('0x1b')]);router[_0xff01('0x1c')]('/:id',auth[_0xff01('0xa')](),controller['update']);router['delete'](_0xff01('0x1d'),auth['isAuthenticated'](),controller[_0xff01('0x1e')]);module[_0xff01('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 7780e65..0ad1419 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 _0x99be=['INTEGER','FLOAT','sequelize','STRING','name','BIGINT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x99be,0x104));var _0xe99b=function(_0x3f58bb,_0x1560e1){_0x3f58bb=_0x3f58bb-0x0;var _0x23ddc5=_0x99be[_0x3f58bb];return _0x23ddc5;};'use strict';var Sequelize=require(_0xe99b('0x0'));module['exports']={'name':{'type':Sequelize[_0xe99b('0x1')],'unique':_0xe99b('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe99b('0x1')]},'display_name':{'type':Sequelize[_0xe99b('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xe99b('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xe99b('0x3')]},'original_channelCount':{'type':Sequelize[_0xe99b('0x4')]},'original_bitRate':{'type':Sequelize[_0xe99b('0x3')]},'original_sampleRate':{'type':Sequelize[_0xe99b('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe99b('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xe99b('0x3')]},'converted_channelCount':{'type':Sequelize[_0xe99b('0x4')]},'converted_bitRate':{'type':Sequelize[_0xe99b('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xe99b('0x4')]}}; \ No newline at end of file +var _0xb7f2=['BIGINT','sequelize','STRING','FLOAT','INTEGER'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xb7f2,0x15a));var _0x2b7f=function(_0x524444,_0x48d6b5){_0x524444=_0x524444-0x0;var _0x1d3228=_0xb7f2[_0x524444];return _0x1d3228;};'use strict';var Sequelize=require(_0x2b7f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2b7f('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x2b7f('0x1')]},'display_name':{'type':Sequelize[_0x2b7f('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x2b7f('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x2b7f('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x2b7f('0x3')]},'original_bitRate':{'type':Sequelize[_0x2b7f('0x4')]},'original_sampleRate':{'type':Sequelize[_0x2b7f('0x3')]},'converted_format':{'type':Sequelize[_0x2b7f('0x1')]},'converted_duration':{'type':Sequelize[_0x2b7f('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x2b7f('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2b7f('0x3')]},'converted_bitRate':{'type':Sequelize[_0x2b7f('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x2b7f('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 04d123b..8132ba8 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 _0xbd8e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','stack','send','map','Sound','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','format','%s.%s','basename','originalname','extname','file','filename','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','unlinkSync','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3f784e,_0x175406){var _0x14fe30=function(_0x539143){while(--_0x539143){_0x3f784e['push'](_0x3f784e['shift']());}};_0x14fe30(++_0x175406);}(_0xbd8e,0x1d9));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xebd8('0x0'));var rimraf=require(_0xebd8('0x1'));var zipdir=require(_0xebd8('0x2'));var jsonpatch=require(_0xebd8('0x3'));var rp=require(_0xebd8('0x4'));var moment=require('moment');var BPromise=require(_0xebd8('0x5'));var Mustache=require('mustache');var util=require(_0xebd8('0x6'));var path=require('path');var sox=require(_0xebd8('0x7'));var csv=require('to-csv');var ejs=require(_0xebd8('0x8'));var fs=require('fs');var fs_extra=require(_0xebd8('0x9'));var _=require(_0xebd8('0xa'));var squel=require(_0xebd8('0xb'));var crypto=require(_0xebd8('0xc'));var jsforce=require(_0xebd8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebd8('0xe'));var Papa=require(_0xebd8('0xf'));var Redis=require(_0xebd8('0x10'));var authService=require(_0xebd8('0x11'));var qs=require(_0xebd8('0x12'));var as=require(_0xebd8('0x13'));var hardwareService=require(_0xebd8('0x14'));var logger=require(_0xebd8('0x15'))(_0xebd8('0x16'));var utils=require('../../config/utils');var config=require(_0xebd8('0x17'));var licenseUtil=require(_0xebd8('0x18'));var db=require(_0xebd8('0x19'))['db'];function respondWithStatusCode(_0x47d466,_0x42034f){_0x42034f=_0x42034f||0xcc;return function(_0x42db6b){if(_0x42db6b){return _0x47d466[_0xebd8('0x1a')](_0x42034f);}return _0x47d466[_0xebd8('0x1b')](_0x42034f)['end']();};}function respondWithResult(_0x354250,_0x3d5abf){_0x3d5abf=_0x3d5abf||0xc8;return function(_0x2aa11d){if(_0x2aa11d){return _0x354250[_0xebd8('0x1b')](_0x3d5abf)['json'](_0x2aa11d);}};}function respondWithFilteredResult(_0x1594c0,_0x352f09){return function(_0x12bcc9){if(_0x12bcc9){var _0x42fd67=typeof _0x352f09[_0xebd8('0x1c')]==='undefined'&&typeof _0x352f09[_0xebd8('0x1d')]==='undefined';var _0x42627e=_0x12bcc9[_0xebd8('0x1e')];var _0x37b723=_0x42fd67?0x0:_0x352f09[_0xebd8('0x1c')];var _0x4f5d00=_0x42fd67?_0x12bcc9[_0xebd8('0x1e')]:_0x352f09['offset']+_0x352f09['limit'];var _0x3e41df;if(_0x4f5d00>=_0x42627e){_0x4f5d00=_0x42627e;_0x3e41df=0xc8;}else{_0x3e41df=0xce;}_0x1594c0[_0xebd8('0x1b')](_0x3e41df);return _0x1594c0[_0xebd8('0x1f')](_0xebd8('0x20'),_0x37b723+'-'+_0x4f5d00+'/'+_0x42627e)[_0xebd8('0x21')](_0x12bcc9);}return null;};}function patchUpdates(_0x1e4411){return function(_0xd1cf06){try{jsonpatch[_0xebd8('0x22')](_0xd1cf06,_0x1e4411,!![]);}catch(_0x481133){return BPromise[_0xebd8('0x23')](_0x481133);}return _0xd1cf06[_0xebd8('0x24')]();};}function saveUpdates(_0x206382,_0xf7dedb){return function(_0x2e3b9d){if(_0x2e3b9d){return _0x2e3b9d[_0xebd8('0x25')](_0x206382)[_0xebd8('0x26')](function(_0x41538d){return _0x41538d;});}return null;};}function removeEntity(_0x424558,_0x2331d9){return function(_0x18545b){if(_0x18545b){return _0x18545b[_0xebd8('0x27')]()[_0xebd8('0x26')](function(){var _0x3ba174=_0x18545b[_0xebd8('0x28')]({'plain':!![]});var _0x41e241=_0xebd8('0x29');return db[_0xebd8('0x2a')][_0xebd8('0x27')]({'where':{'type':_0x41e241,'resourceId':_0x3ba174['id']}})[_0xebd8('0x26')](function(){return _0x18545b;});})['then'](function(){_0x424558['status'](0xcc)[_0xebd8('0x2b')]();});}};}function handleEntityNotFound(_0x350eff,_0x1ab1bd){return function(_0x80cac4){if(!_0x80cac4){_0x350eff[_0xebd8('0x1a')](0x194);}return _0x80cac4;};}function handleError(_0x1704c0,_0x59aec8){_0x59aec8=_0x59aec8||0x1f4;return function(_0x2f6bb5){logger['error'](_0x2f6bb5[_0xebd8('0x2c')]);if(_0x2f6bb5['name']){delete _0x2f6bb5['name'];}_0x1704c0[_0xebd8('0x1b')](_0x59aec8)[_0xebd8('0x2d')](_0x2f6bb5);};}exports['index']=function(_0x1c9de6,_0x20a6b5){var _0x4ca6cb={},_0x2f2b7b={},_0x5e345e={'count':0x0,'rows':[]};var _0x2b4795=_[_0xebd8('0x2e')](db[_0xebd8('0x2f')]['rawAttributes'],function(_0x57bfd1){return{'name':_0x57bfd1[_0xebd8('0x30')],'type':_0x57bfd1[_0xebd8('0x31')][_0xebd8('0x32')]};});_0x2f2b7b[_0xebd8('0x33')]=_['map'](_0x2b4795,_0xebd8('0x34'));_0x2f2b7b[_0xebd8('0x35')]=_['keys'](_0x1c9de6[_0xebd8('0x35')]);_0x2f2b7b[_0xebd8('0x36')]=_[_0xebd8('0x37')](_0x2f2b7b['model'],_0x2f2b7b[_0xebd8('0x35')]);_0x4ca6cb[_0xebd8('0x38')]=_[_0xebd8('0x37')](_0x2f2b7b['model'],qs[_0xebd8('0x39')](_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x39')]));_0x4ca6cb[_0xebd8('0x38')]=_0x4ca6cb['attributes']['length']?_0x4ca6cb['attributes']:_0x2f2b7b['model'];if(!_0x1c9de6[_0xebd8('0x35')]['hasOwnProperty'](_0xebd8('0x3a'))){_0x4ca6cb[_0xebd8('0x1d')]=qs[_0xebd8('0x1d')](_0x1c9de6['query']['limit']);_0x4ca6cb[_0xebd8('0x1c')]=qs['offset'](_0x1c9de6['query']['offset']);}_0x4ca6cb['order']=qs['sort'](_0x1c9de6['query'][_0xebd8('0x3b')]);_0x4ca6cb[_0xebd8('0x3c')]=qs[_0xebd8('0x36')](_[_0xebd8('0x3d')](_0x1c9de6[_0xebd8('0x35')],_0x2f2b7b[_0xebd8('0x36')]),_0x2b4795);if(_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x3e')]){_0x4ca6cb['where']=_[_0xebd8('0x3f')](_0x4ca6cb[_0xebd8('0x3c')],{'$or':_['map'](_0x2b4795,function(_0x721711){if(_0x721711[_0xebd8('0x31')]!==_0xebd8('0x40')){var _0x5cec6f={};_0x5cec6f[_0x721711['name']]={'$like':'%'+_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x3e')]+'%'};return _0x5cec6f;}})});}_0x4ca6cb=_[_0xebd8('0x3f')]({},_0x4ca6cb,_0x1c9de6[_0xebd8('0x41')]);var _0x50d0c0={'where':_0x4ca6cb[_0xebd8('0x3c')]};return db[_0xebd8('0x2f')][_0xebd8('0x1e')](_0x50d0c0)[_0xebd8('0x26')](function(_0x524e48){_0x5e345e[_0xebd8('0x1e')]=_0x524e48;if(_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x42')]){_0x4ca6cb[_0xebd8('0x43')]=[{'all':!![]}];}return db[_0xebd8('0x2f')][_0xebd8('0x44')](_0x4ca6cb);})[_0xebd8('0x26')](function(_0x21f90d){_0x5e345e[_0xebd8('0x45')]=_0x21f90d;return _0x5e345e;})['then'](respondWithFilteredResult(_0x20a6b5,_0x4ca6cb))[_0xebd8('0x46')](handleError(_0x20a6b5,null));};exports[_0xebd8('0x47')]=function(_0x397cd5,_0x3a3962){var _0x157b57={'raw':!![],'where':{'id':_0x397cd5[_0xebd8('0x48')]['id']}},_0xe7b14a={};_0xe7b14a[_0xebd8('0x33')]=_[_0xebd8('0x49')](db[_0xebd8('0x2f')][_0xebd8('0x4a')]);_0xe7b14a[_0xebd8('0x35')]=_['keys'](_0x397cd5[_0xebd8('0x35')]);_0xe7b14a['filters']=_[_0xebd8('0x37')](_0xe7b14a[_0xebd8('0x33')],_0xe7b14a['query']);_0x157b57['attributes']=_[_0xebd8('0x37')](_0xe7b14a['model'],qs[_0xebd8('0x39')](_0x397cd5[_0xebd8('0x35')][_0xebd8('0x39')]));_0x157b57[_0xebd8('0x38')]=_0x157b57[_0xebd8('0x38')][_0xebd8('0x4b')]?_0x157b57['attributes']:_0xe7b14a['model'];if(_0x397cd5[_0xebd8('0x35')]['includeAll']){_0x157b57[_0xebd8('0x43')]=[{'all':!![]}];}_0x157b57=_[_0xebd8('0x3f')]({},_0x157b57,_0x397cd5[_0xebd8('0x41')]);return db[_0xebd8('0x2f')][_0xebd8('0x4c')](_0x157b57)['then'](handleEntityNotFound(_0x3a3962,null))[_0xebd8('0x26')](respondWithResult(_0x3a3962,null))['catch'](handleError(_0x3a3962,null));};exports['download']=function(_0x2e571d,_0x159acc,_0x5399ad){return db[_0xebd8('0x2f')][_0xebd8('0x4c')]({'where':{'id':_0x2e571d[_0xebd8('0x48')]['id']},'attributes':[_0xebd8('0x34'),_0xebd8('0x4d'),_0xebd8('0x4e')],'raw':!![]})[_0xebd8('0x26')](handleEntityNotFound(_0x159acc,null))['then'](function(_0x350092){if(_0x350092){if(!fs[_0xebd8('0x4f')](path[_0xebd8('0x50')](config['root'],_0xebd8('0x51'),_0x350092[_0xebd8('0x4d')]+'.'+_0x350092[_0xebd8('0x4e')]))){throw new db[(_0xebd8('0x52'))]['ValidationError'](_0xebd8('0x53'));}return _0x159acc[_0xebd8('0x54')](path['join'](config['root'],'server/files/sounds/converted',util[_0xebd8('0x55')](_0xebd8('0x56'),_0x350092[_0xebd8('0x4d')],_0x350092['converted_format'])),util[_0xebd8('0x55')](_0xebd8('0x56'),_0x350092[_0xebd8('0x34')],_0x350092[_0xebd8('0x4e')]));}return null;})[_0xebd8('0x46')](handleError(_0x159acc,null));};exports['create']=function(_0x575aef,_0x1a3b55,_0x21222a){var _0x423337={'name':path[_0xebd8('0x57')](_0x575aef['file'][_0xebd8('0x58')],path[_0xebd8('0x59')](_0x575aef['file'][_0xebd8('0x58')])),'save_name':path['basename'](_0x575aef[_0xebd8('0x5a')][_0xebd8('0x5b')],path[_0xebd8('0x59')](_0x575aef['file'][_0xebd8('0x5b')])),'original_format':path['extname'](_0x575aef[_0xebd8('0x5a')]['originalname'])['substring'](0x1),'converted_format':_0xebd8('0x5c')};var _0x248df9=path['join'](config[_0xebd8('0x5d')],_0xebd8('0x5e'),_0x575aef[_0xebd8('0x5a')][_0xebd8('0x5b')]);var _0xf70fa2=path['join'](config[_0xebd8('0x5d')],_0xebd8('0x51'),util[_0xebd8('0x55')](_0xebd8('0x56'),path[_0xebd8('0x57')](_0x575aef['file'][_0xebd8('0x5b')],path[_0xebd8('0x59')](_0x575aef[_0xebd8('0x5a')]['filename'])),_0x423337['converted_format']));logger[_0xebd8('0x5f')](_0xebd8('0x60'),_0x248df9);logger['info'](_0xebd8('0x61'),_0xf70fa2);try{fs[_0xebd8('0x62')](_0x248df9,parseInt(_0xebd8('0x63'),0x8));var _0x4b94f6=sox['transcode'](_0x248df9,_0xf70fa2,{'sampleRate':0x1f40,'format':_0xebd8('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b94f6['on'](_0xebd8('0x64'),function(_0x2ddaa4){fs[_0xebd8('0x65')](_0x248df9);_0x1a3b55[_0xebd8('0x1b')](0x1f4)[_0xebd8('0x2d')](_0x2ddaa4);});_0x4b94f6['on'](_0xebd8('0x66'),function(_0x2d764c){_0x423337['original_duration']=isNaN(_0x2d764c[_0xebd8('0x67')])?null:_0x2d764c[_0xebd8('0x67')]*0x3e8;_0x423337[_0xebd8('0x68')]=isNaN(_0x2d764c['sampleCount'])?null:_0x2d764c[_0xebd8('0x69')];_0x423337['original_channelCount']=isNaN(_0x2d764c[_0xebd8('0x6a')])?null:_0x2d764c['channelCount'];_0x423337[_0xebd8('0x6b')]=isNaN(_0x2d764c['bitRate'])?null:_0x2d764c['bitRate'];_0x423337[_0xebd8('0x6c')]=isNaN(_0x2d764c['sampleRate'])?null:_0x2d764c[_0xebd8('0x6d')];});_0x4b94f6['on'](_0xebd8('0x6e'),function(_0x2a65e2){_0x423337['converted_duration']=isNaN(_0x2a65e2['duration'])?null:_0x2a65e2[_0xebd8('0x67')]*0x3e8;_0x423337[_0xebd8('0x6f')]=isNaN(_0x2a65e2['sampleCount'])?null:_0x2a65e2[_0xebd8('0x69')];_0x423337[_0xebd8('0x70')]=isNaN(_0x2a65e2[_0xebd8('0x6a')])?null:_0x2a65e2[_0xebd8('0x6a')];_0x423337['converted_bitRate']=isNaN(_0x2a65e2[_0xebd8('0x71')])?null:_0x2a65e2[_0xebd8('0x71')];_0x423337[_0xebd8('0x72')]=isNaN(_0x2a65e2[_0xebd8('0x6d')])?null:_0x2a65e2[_0xebd8('0x6d')];});_0x4b94f6['on'](_0xebd8('0x2b'),function(){fs[_0xebd8('0x62')](_0xf70fa2,parseInt('0777',0x8));return db[_0xebd8('0x2f')]['create'](_0x423337)[_0xebd8('0x26')](function(_0x14bfd0){var _0xbaa603={'role':_0x575aef[_0xebd8('0x73')]['role'],'userProfileId':_0x575aef['body'][_0xebd8('0x74')]};if(!_0xbaa603)throw new Error(_0xebd8('0x75'));if(_0xbaa603[_0xebd8('0x76')]==='user'){var _0x2fc60a=_0x14bfd0['get']({'plain':!![]});return db[_0xebd8('0x77')][_0xebd8('0x4c')]({'where':{'name':_0xebd8('0x29'),'userProfileId':_0xbaa603[_0xebd8('0x74')]},'raw':!![]})[_0xebd8('0x26')](function(_0x273702){if(_0x273702&&_0x273702[_0xebd8('0x78')]===0x0){return db[_0xebd8('0x2a')][_0xebd8('0x79')]({'name':_0x2fc60a['name'],'resourceId':_0x2fc60a['id'],'type':_0x273702['name'],'sectionId':_0x273702['id']},{})[_0xebd8('0x26')](function(){return _0x14bfd0;});}else{return _0x14bfd0;}})[_0xebd8('0x46')](function(_0x15483e){logger['error'](_0xebd8('0x7a'),_0x15483e);throw _0x15483e;});}return _0x14bfd0;})['then'](respondWithResult(_0x1a3b55,null))[_0xebd8('0x46')](handleError(_0x1a3b55,null));});_0x4b94f6['start']();}catch(_0x50c521){_0x1a3b55[_0xebd8('0x1b')](0x1f4)[_0xebd8('0x2d')](_0x50c521);}};exports[_0xebd8('0x25')]=function(_0x37304f,_0x575588,_0xa2b556){return db[_0xebd8('0x2f')][_0xebd8('0x4c')]({'where':{'id':_0x37304f['params']['id']}})['then'](handleEntityNotFound(_0x575588,null))[_0xebd8('0x26')](saveUpdates(_[_0xebd8('0x3d')](_0x37304f[_0xebd8('0x73')],[_0xebd8('0x34'),'description']),null))[_0xebd8('0x26')](respondWithResult(_0x575588,null))[_0xebd8('0x46')](handleError(_0x575588,null));};exports[_0xebd8('0x7b')]=function(_0x383da4,_0xccbf4b,_0x5188e7){return db[_0xebd8('0x2f')]['find']({'where':{'id':_0x383da4['params']['id']}})[_0xebd8('0x26')](function(_0x1f53e){if(_0x1f53e){return _0x1f53e['destroy']();}})[_0xebd8('0x26')](function(_0x53e97b){var _0x227724=path[_0xebd8('0x50')](config[_0xebd8('0x5d')],_0xebd8('0x5e'),util[_0xebd8('0x55')](_0xebd8('0x56'),_0x53e97b[_0xebd8('0x4d')],_0x53e97b['original_format']));var _0x27250c=path[_0xebd8('0x50')](config[_0xebd8('0x5d')],_0xebd8('0x51'),util[_0xebd8('0x55')]('%s.%s',_0x53e97b['save_name'],_0x53e97b[_0xebd8('0x4e')]));fs[_0xebd8('0x65')](_0x227724);fs[_0xebd8('0x65')](_0x27250c);return _0x53e97b;})[_0xebd8('0x26')](function(_0x358336){if(_0x358336){return _0xccbf4b[_0xebd8('0x1b')](0xcc)['end']();}})['then'](handleEntityNotFound(_0xccbf4b,null))[_0xebd8('0x46')](handleError(_0xccbf4b,null));}; \ No newline at end of file +var _0xff73=['count','limit','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','find','download','save_name','existsSync','join','root','Sequelize','ValidationError','%s.%s','format','converted_format','create','basename','file','extname','originalname','filename','substring','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','sendStatus','status','end','json','offset','undefined'];(function(_0x25fe53,_0x46d7de){var _0x3aa81d=function(_0x1daa4c){while(--_0x1daa4c){_0x25fe53['push'](_0x25fe53['shift']());}};_0x3aa81d(++_0x46d7de);}(_0xff73,0x1d0));var _0x3ff7=function(_0x4a0fca,_0xba7712){_0x4a0fca=_0x4a0fca-0x0;var _0x332687=_0xff73[_0x4a0fca];return _0x332687;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ff7('0x0'));var zipdir=require(_0x3ff7('0x1'));var jsonpatch=require(_0x3ff7('0x2'));var rp=require(_0x3ff7('0x3'));var moment=require(_0x3ff7('0x4'));var BPromise=require(_0x3ff7('0x5'));var Mustache=require('mustache');var util=require(_0x3ff7('0x6'));var path=require('path');var sox=require(_0x3ff7('0x7'));var csv=require(_0x3ff7('0x8'));var ejs=require(_0x3ff7('0x9'));var fs=require('fs');var fs_extra=require(_0x3ff7('0xa'));var _=require(_0x3ff7('0xb'));var squel=require('squel');var crypto=require(_0x3ff7('0xc'));var jsforce=require(_0x3ff7('0xd'));var deskjs=require(_0x3ff7('0xe'));var toCsv=require(_0x3ff7('0x8'));var querystring=require('querystring');var Papa=require(_0x3ff7('0xf'));var Redis=require(_0x3ff7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3ff7('0x11'));var as=require(_0x3ff7('0x12'));var hardwareService=require(_0x3ff7('0x13'));var logger=require(_0x3ff7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3ff7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x439e30,_0x58faf7){_0x58faf7=_0x58faf7||0xcc;return function(_0x47f7cb){if(_0x47f7cb){return _0x439e30[_0x3ff7('0x16')](_0x58faf7);}return _0x439e30[_0x3ff7('0x17')](_0x58faf7)[_0x3ff7('0x18')]();};}function respondWithResult(_0x439d4f,_0x265137){_0x265137=_0x265137||0xc8;return function(_0x4e4965){if(_0x4e4965){return _0x439d4f[_0x3ff7('0x17')](_0x265137)[_0x3ff7('0x19')](_0x4e4965);}};}function respondWithFilteredResult(_0x4383b6,_0x25a521){return function(_0x51927f){if(_0x51927f){var _0x39708e=typeof _0x25a521[_0x3ff7('0x1a')]===_0x3ff7('0x1b')&&typeof _0x25a521['limit']===_0x3ff7('0x1b');var _0x21f1de=_0x51927f[_0x3ff7('0x1c')];var _0x24c604=_0x39708e?0x0:_0x25a521[_0x3ff7('0x1a')];var _0x53488c=_0x39708e?_0x51927f[_0x3ff7('0x1c')]:_0x25a521[_0x3ff7('0x1a')]+_0x25a521[_0x3ff7('0x1d')];var _0xd6aeff;if(_0x53488c>=_0x21f1de){_0x53488c=_0x21f1de;_0xd6aeff=0xc8;}else{_0xd6aeff=0xce;}_0x4383b6[_0x3ff7('0x17')](_0xd6aeff);return _0x4383b6['set'](_0x3ff7('0x1e'),_0x24c604+'-'+_0x53488c+'/'+_0x21f1de)[_0x3ff7('0x19')](_0x51927f);}return null;};}function patchUpdates(_0x32e1a8){return function(_0x930136){try{jsonpatch[_0x3ff7('0x1f')](_0x930136,_0x32e1a8,!![]);}catch(_0x602851){return BPromise[_0x3ff7('0x20')](_0x602851);}return _0x930136[_0x3ff7('0x21')]();};}function saveUpdates(_0x2def66,_0x15f3a3){return function(_0x14d1a9){if(_0x14d1a9){return _0x14d1a9[_0x3ff7('0x22')](_0x2def66)[_0x3ff7('0x23')](function(_0x44a553){return _0x44a553;});}return null;};}function removeEntity(_0x53f4f0,_0x4258ec){return function(_0x3cd800){if(_0x3cd800){return _0x3cd800[_0x3ff7('0x24')]()['then'](function(){var _0x3d919b=_0x3cd800['get']({'plain':!![]});var _0xdb084a=_0x3ff7('0x25');return db[_0x3ff7('0x26')][_0x3ff7('0x24')]({'where':{'type':_0xdb084a,'resourceId':_0x3d919b['id']}})[_0x3ff7('0x23')](function(){return _0x3cd800;});})[_0x3ff7('0x23')](function(){_0x53f4f0['status'](0xcc)[_0x3ff7('0x18')]();});}};}function handleEntityNotFound(_0x349e04,_0x2ce648){return function(_0x1fdbe8){if(!_0x1fdbe8){_0x349e04['sendStatus'](0x194);}return _0x1fdbe8;};}function handleError(_0x2a6364,_0x717232){_0x717232=_0x717232||0x1f4;return function(_0x34a782){logger['error'](_0x34a782[_0x3ff7('0x27')]);if(_0x34a782['name']){delete _0x34a782[_0x3ff7('0x28')];}_0x2a6364[_0x3ff7('0x17')](_0x717232)[_0x3ff7('0x29')](_0x34a782);};}exports[_0x3ff7('0x2a')]=function(_0x1a0580,_0x2cebf5){var _0x53afd4={},_0x59d767={},_0x3afed9={'count':0x0,'rows':[]};var _0x180bdd=_['map'](db[_0x3ff7('0x2b')][_0x3ff7('0x2c')],function(_0x2b9070){return{'name':_0x2b9070[_0x3ff7('0x2d')],'type':_0x2b9070[_0x3ff7('0x2e')][_0x3ff7('0x2f')]};});_0x59d767[_0x3ff7('0x30')]=_['map'](_0x180bdd,'name');_0x59d767[_0x3ff7('0x31')]=_[_0x3ff7('0x32')](_0x1a0580['query']);_0x59d767['filters']=_[_0x3ff7('0x33')](_0x59d767[_0x3ff7('0x30')],_0x59d767[_0x3ff7('0x31')]);_0x53afd4[_0x3ff7('0x34')]=_[_0x3ff7('0x33')](_0x59d767[_0x3ff7('0x30')],qs[_0x3ff7('0x35')](_0x1a0580[_0x3ff7('0x31')][_0x3ff7('0x35')]));_0x53afd4['attributes']=_0x53afd4['attributes'][_0x3ff7('0x36')]?_0x53afd4['attributes']:_0x59d767[_0x3ff7('0x30')];if(!_0x1a0580[_0x3ff7('0x31')][_0x3ff7('0x37')](_0x3ff7('0x38'))){_0x53afd4['limit']=qs[_0x3ff7('0x1d')](_0x1a0580[_0x3ff7('0x31')][_0x3ff7('0x1d')]);_0x53afd4[_0x3ff7('0x1a')]=qs[_0x3ff7('0x1a')](_0x1a0580['query']['offset']);}_0x53afd4[_0x3ff7('0x39')]=qs['sort'](_0x1a0580[_0x3ff7('0x31')][_0x3ff7('0x3a')]);_0x53afd4[_0x3ff7('0x3b')]=qs[_0x3ff7('0x3c')](_[_0x3ff7('0x3d')](_0x1a0580['query'],_0x59d767[_0x3ff7('0x3c')]),_0x180bdd);if(_0x1a0580[_0x3ff7('0x31')][_0x3ff7('0x3e')]){_0x53afd4['where']=_['merge'](_0x53afd4[_0x3ff7('0x3b')],{'$or':_['map'](_0x180bdd,function(_0xc900d2){if(_0xc900d2[_0x3ff7('0x2e')]!==_0x3ff7('0x3f')){var _0x2e358e={};_0x2e358e[_0xc900d2[_0x3ff7('0x28')]]={'$like':'%'+_0x1a0580[_0x3ff7('0x31')][_0x3ff7('0x3e')]+'%'};return _0x2e358e;}})});}_0x53afd4=_[_0x3ff7('0x40')]({},_0x53afd4,_0x1a0580['options']);var _0x1864b9={'where':_0x53afd4[_0x3ff7('0x3b')]};return db[_0x3ff7('0x2b')][_0x3ff7('0x1c')](_0x1864b9)[_0x3ff7('0x23')](function(_0x3968a9){_0x3afed9[_0x3ff7('0x1c')]=_0x3968a9;if(_0x1a0580[_0x3ff7('0x31')]['includeAll']){_0x53afd4[_0x3ff7('0x41')]=[{'all':!![]}];}return db[_0x3ff7('0x2b')][_0x3ff7('0x42')](_0x53afd4);})[_0x3ff7('0x23')](function(_0x3ff2f3){_0x3afed9['rows']=_0x3ff2f3;return _0x3afed9;})[_0x3ff7('0x23')](respondWithFilteredResult(_0x2cebf5,_0x53afd4))[_0x3ff7('0x43')](handleError(_0x2cebf5,null));};exports[_0x3ff7('0x44')]=function(_0x32d85b,_0x27ea3f){var _0x26f3c1={'raw':!![],'where':{'id':_0x32d85b[_0x3ff7('0x45')]['id']}},_0xfd5d2={};_0xfd5d2[_0x3ff7('0x30')]=_[_0x3ff7('0x32')](db[_0x3ff7('0x2b')]['rawAttributes']);_0xfd5d2['query']=_[_0x3ff7('0x32')](_0x32d85b['query']);_0xfd5d2[_0x3ff7('0x3c')]=_[_0x3ff7('0x33')](_0xfd5d2[_0x3ff7('0x30')],_0xfd5d2[_0x3ff7('0x31')]);_0x26f3c1[_0x3ff7('0x34')]=_['intersection'](_0xfd5d2[_0x3ff7('0x30')],qs[_0x3ff7('0x35')](_0x32d85b[_0x3ff7('0x31')][_0x3ff7('0x35')]));_0x26f3c1['attributes']=_0x26f3c1[_0x3ff7('0x34')][_0x3ff7('0x36')]?_0x26f3c1[_0x3ff7('0x34')]:_0xfd5d2[_0x3ff7('0x30')];if(_0x32d85b[_0x3ff7('0x31')][_0x3ff7('0x46')]){_0x26f3c1[_0x3ff7('0x41')]=[{'all':!![]}];}_0x26f3c1=_[_0x3ff7('0x40')]({},_0x26f3c1,_0x32d85b['options']);return db[_0x3ff7('0x2b')][_0x3ff7('0x47')](_0x26f3c1)[_0x3ff7('0x23')](handleEntityNotFound(_0x27ea3f,null))[_0x3ff7('0x23')](respondWithResult(_0x27ea3f,null))[_0x3ff7('0x43')](handleError(_0x27ea3f,null));};exports[_0x3ff7('0x48')]=function(_0x230bfb,_0x5d2a53,_0x5b63a6){return db[_0x3ff7('0x2b')][_0x3ff7('0x47')]({'where':{'id':_0x230bfb[_0x3ff7('0x45')]['id']},'attributes':[_0x3ff7('0x28'),_0x3ff7('0x49'),'converted_format'],'raw':!![]})[_0x3ff7('0x23')](handleEntityNotFound(_0x5d2a53,null))[_0x3ff7('0x23')](function(_0x28ded9){if(_0x28ded9){if(!fs[_0x3ff7('0x4a')](path[_0x3ff7('0x4b')](config[_0x3ff7('0x4c')],'server/files/sounds/converted',_0x28ded9['save_name']+'.'+_0x28ded9['converted_format']))){throw new db[(_0x3ff7('0x4d'))][(_0x3ff7('0x4e'))]('Sound\x20not\x20found');}return _0x5d2a53[_0x3ff7('0x48')](path['join'](config[_0x3ff7('0x4c')],'server/files/sounds/converted',util['format'](_0x3ff7('0x4f'),_0x28ded9[_0x3ff7('0x49')],_0x28ded9['converted_format'])),util[_0x3ff7('0x50')](_0x3ff7('0x4f'),_0x28ded9[_0x3ff7('0x28')],_0x28ded9[_0x3ff7('0x51')]));}return null;})[_0x3ff7('0x43')](handleError(_0x5d2a53,null));};exports[_0x3ff7('0x52')]=function(_0x45f9ba,_0x504b98,_0x4f0f93){var _0x1a294c={'name':path[_0x3ff7('0x53')](_0x45f9ba[_0x3ff7('0x54')]['originalname'],path[_0x3ff7('0x55')](_0x45f9ba[_0x3ff7('0x54')][_0x3ff7('0x56')])),'save_name':path[_0x3ff7('0x53')](_0x45f9ba[_0x3ff7('0x54')][_0x3ff7('0x57')],path[_0x3ff7('0x55')](_0x45f9ba['file'][_0x3ff7('0x57')])),'original_format':path[_0x3ff7('0x55')](_0x45f9ba['file'][_0x3ff7('0x56')])[_0x3ff7('0x58')](0x1),'converted_format':'wav'};var _0x4a34cc=path[_0x3ff7('0x4b')](config[_0x3ff7('0x4c')],_0x3ff7('0x59'),_0x45f9ba['file'][_0x3ff7('0x57')]);var _0x4e0eba=path[_0x3ff7('0x4b')](config[_0x3ff7('0x4c')],_0x3ff7('0x5a'),util[_0x3ff7('0x50')](_0x3ff7('0x4f'),path[_0x3ff7('0x53')](_0x45f9ba[_0x3ff7('0x54')]['filename'],path[_0x3ff7('0x55')](_0x45f9ba[_0x3ff7('0x54')][_0x3ff7('0x57')])),_0x1a294c[_0x3ff7('0x51')]));logger[_0x3ff7('0x5b')](_0x3ff7('0x5c'),_0x4a34cc);logger[_0x3ff7('0x5b')](_0x3ff7('0x5d'),_0x4e0eba);try{fs['chmodSync'](_0x4a34cc,parseInt(_0x3ff7('0x5e'),0x8));var _0xebeee5=sox[_0x3ff7('0x5f')](_0x4a34cc,_0x4e0eba,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xebeee5['on'](_0x3ff7('0x60'),function(_0x2eddba){fs['unlinkSync'](_0x4a34cc);_0x504b98[_0x3ff7('0x17')](0x1f4)[_0x3ff7('0x29')](_0x2eddba);});_0xebeee5['on'](_0x3ff7('0x61'),function(_0x26f48f){_0x1a294c[_0x3ff7('0x62')]=isNaN(_0x26f48f['duration'])?null:_0x26f48f[_0x3ff7('0x63')]*0x3e8;_0x1a294c['original_sampleCount']=isNaN(_0x26f48f[_0x3ff7('0x64')])?null:_0x26f48f['sampleCount'];_0x1a294c[_0x3ff7('0x65')]=isNaN(_0x26f48f[_0x3ff7('0x66')])?null:_0x26f48f[_0x3ff7('0x66')];_0x1a294c[_0x3ff7('0x67')]=isNaN(_0x26f48f[_0x3ff7('0x68')])?null:_0x26f48f[_0x3ff7('0x68')];_0x1a294c['original_sampleRate']=isNaN(_0x26f48f[_0x3ff7('0x69')])?null:_0x26f48f[_0x3ff7('0x69')];});_0xebeee5['on'](_0x3ff7('0x6a'),function(_0x45fe49){_0x1a294c[_0x3ff7('0x6b')]=isNaN(_0x45fe49['duration'])?null:_0x45fe49['duration']*0x3e8;_0x1a294c['converted_sampleCount']=isNaN(_0x45fe49['sampleCount'])?null:_0x45fe49[_0x3ff7('0x64')];_0x1a294c[_0x3ff7('0x6c')]=isNaN(_0x45fe49[_0x3ff7('0x66')])?null:_0x45fe49[_0x3ff7('0x66')];_0x1a294c[_0x3ff7('0x6d')]=isNaN(_0x45fe49[_0x3ff7('0x68')])?null:_0x45fe49[_0x3ff7('0x68')];_0x1a294c['converted_sampleRate']=isNaN(_0x45fe49[_0x3ff7('0x69')])?null:_0x45fe49[_0x3ff7('0x69')];});_0xebeee5['on'](_0x3ff7('0x18'),function(){fs[_0x3ff7('0x6e')](_0x4e0eba,parseInt(_0x3ff7('0x5e'),0x8));return db[_0x3ff7('0x2b')][_0x3ff7('0x52')](_0x1a294c)[_0x3ff7('0x23')](function(_0x1642f2){var _0x4cdb45={'role':_0x45f9ba[_0x3ff7('0x6f')]['role'],'userProfileId':_0x45f9ba[_0x3ff7('0x6f')][_0x3ff7('0x70')]};if(!_0x4cdb45)throw new Error(_0x3ff7('0x71'));if(_0x4cdb45[_0x3ff7('0x72')]===_0x3ff7('0x73')){var _0x26cfbf=_0x1642f2[_0x3ff7('0x74')]({'plain':!![]});return db['UserProfileSection'][_0x3ff7('0x47')]({'where':{'name':_0x3ff7('0x25'),'userProfileId':_0x4cdb45['userProfileId']},'raw':!![]})[_0x3ff7('0x23')](function(_0x5d0c74){if(_0x5d0c74&&_0x5d0c74[_0x3ff7('0x75')]===0x0){return db[_0x3ff7('0x26')][_0x3ff7('0x52')]({'name':_0x26cfbf[_0x3ff7('0x28')],'resourceId':_0x26cfbf['id'],'type':_0x5d0c74[_0x3ff7('0x28')],'sectionId':_0x5d0c74['id']},{})[_0x3ff7('0x23')](function(){return _0x1642f2;});}else{return _0x1642f2;}})[_0x3ff7('0x43')](function(_0x4bf941){logger[_0x3ff7('0x60')](_0x3ff7('0x76'),_0x4bf941);throw _0x4bf941;});}return _0x1642f2;})[_0x3ff7('0x23')](respondWithResult(_0x504b98,null))['catch'](handleError(_0x504b98,null));});_0xebeee5[_0x3ff7('0x77')]();}catch(_0x1e7d07){_0x504b98[_0x3ff7('0x17')](0x1f4)[_0x3ff7('0x29')](_0x1e7d07);}};exports[_0x3ff7('0x22')]=function(_0x5f19f6,_0x301274,_0x19278f){return db[_0x3ff7('0x2b')][_0x3ff7('0x47')]({'where':{'id':_0x5f19f6[_0x3ff7('0x45')]['id']}})[_0x3ff7('0x23')](handleEntityNotFound(_0x301274,null))[_0x3ff7('0x23')](saveUpdates(_['pick'](_0x5f19f6['body'],[_0x3ff7('0x28'),_0x3ff7('0x78')]),null))[_0x3ff7('0x23')](respondWithResult(_0x301274,null))['catch'](handleError(_0x301274,null));};exports[_0x3ff7('0x79')]=function(_0xa386cb,_0xdbf0cb,_0x398511){return db[_0x3ff7('0x2b')][_0x3ff7('0x47')]({'where':{'id':_0xa386cb[_0x3ff7('0x45')]['id']}})['then'](function(_0x5d818d){if(_0x5d818d){return _0x5d818d[_0x3ff7('0x24')]();}})['then'](function(_0x19e931){var _0x1bf26c=path[_0x3ff7('0x4b')](config[_0x3ff7('0x4c')],_0x3ff7('0x59'),util['format'](_0x3ff7('0x4f'),_0x19e931[_0x3ff7('0x49')],_0x19e931['original_format']));var _0x2953d5=path[_0x3ff7('0x4b')](config[_0x3ff7('0x4c')],'server/files/sounds/converted',util[_0x3ff7('0x50')](_0x3ff7('0x4f'),_0x19e931['save_name'],_0x19e931[_0x3ff7('0x51')]));fs[_0x3ff7('0x7a')](_0x1bf26c);fs[_0x3ff7('0x7a')](_0x2953d5);return _0x19e931;})[_0x3ff7('0x23')](function(_0x58c111){if(_0x58c111){return _0xdbf0cb[_0x3ff7('0x17')](0xcc)[_0x3ff7('0x18')]();}})['then'](handleEntityNotFound(_0xdbf0cb,null))['catch'](handleError(_0xdbf0cb,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 80d9d5c..a44ca26 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 _0xe1ca=['exports','Sound','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe1ca,0x183));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xae1c('0x0'));var util=require(_0xae1c('0x1'));var logger=require(_0xae1c('0x2'))(_0xae1c('0x3'));var moment=require('moment');var BPromise=require(_0xae1c('0x4'));var rp=require(_0xae1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae1c('0x6'));var config=require(_0xae1c('0x7'));var attributes=require(_0xae1c('0x8'));module[_0xae1c('0x9')]=function(_0x2d2753,_0x486066){return _0x2d2753['define'](_0xae1c('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab93=['rimraf','../../config/environment','./sound.attributes','exports','Sound','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x81eb80,_0x2743d7){var _0x290cce=function(_0xdb94f8){while(--_0xdb94f8){_0x81eb80['push'](_0x81eb80['shift']());}};_0x290cce(++_0x2743d7);}(_0xab93,0x68));var _0x3ab9=function(_0x3d06c4,_0xf5013){_0x3d06c4=_0x3d06c4-0x0;var _0x41ec46=_0xab93[_0x3d06c4];return _0x41ec46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ab9('0x0'))(_0x3ab9('0x1'));var moment=require(_0x3ab9('0x2'));var BPromise=require(_0x3ab9('0x3'));var rp=require(_0x3ab9('0x4'));var fs=require('fs');var path=require(_0x3ab9('0x5'));var rimraf=require(_0x3ab9('0x6'));var config=require(_0x3ab9('0x7'));var attributes=require(_0x3ab9('0x8'));module[_0x3ab9('0x9')]=function(_0x5b0e1d,_0xa56085){return _0x5b0e1d['define'](_0x3ab9('0xa'),attributes,{'tableName':'tools_sounds','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 9f97a41..8cec4d5 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 _0xb5bb=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','Sound','find','options','raw','where','include','model','attributes','map','lodash','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x429406,_0x1c946a){var _0x48b6e9=function(_0x6a50bc){while(--_0x6a50bc){_0x429406['push'](_0x429406['shift']());}};_0x48b6e9(++_0x1c946a);}(_0xb5bb,0x1ee));var _0xbb5b=function(_0x573751,_0x2f7311){_0x573751=_0x573751-0x0;var _0x49cb9b=_0xb5bb[_0x573751];return _0x49cb9b;};'use strict';var _=require(_0xbb5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb5b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbb5b('0x2'))(_0xbb5b('0x3'));var config=require(_0xbb5b('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb5b('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3b1c6e,_0xcbf9d0,_0x462763){return new BPromise(function(_0x497115,_0x2e695b){return client[_0xbb5b('0x6')](_0x3b1c6e,_0x462763)[_0xbb5b('0x7')](function(_0x3942ba){logger[_0xbb5b('0x8')](_0xbb5b('0x9'),_0xcbf9d0,_0xbb5b('0xa'));logger[_0xbb5b('0xb')](_0xbb5b('0xc'),_0xcbf9d0,_0xbb5b('0xa'),JSON[_0xbb5b('0xd')](_0x3942ba));if(_0x3942ba[_0xbb5b('0xe')]){if(_0x3942ba[_0xbb5b('0xe')]['code']===0x1f4){logger[_0xbb5b('0xe')](_0xbb5b('0x9'),_0xcbf9d0,_0x3942ba[_0xbb5b('0xe')]['message']);return _0x2e695b(_0x3942ba[_0xbb5b('0xe')][_0xbb5b('0xf')]);}logger['error']('Sound,\x20%s,\x20%s',_0xcbf9d0,_0x3942ba[_0xbb5b('0xe')]['message']);return _0x497115(_0x3942ba[_0xbb5b('0xe')][_0xbb5b('0xf')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0xcbf9d0,_0xbb5b('0xa'));_0x497115(_0x3942ba[_0xbb5b('0x10')][_0xbb5b('0xf')]);}})[_0xbb5b('0x11')](function(_0x2da7e9){logger[_0xbb5b('0xe')](_0xbb5b('0x9'),_0xcbf9d0,_0x2da7e9);_0x2e695b(_0x2da7e9);});});}exports[_0xbb5b('0x12')]=function(_0x5ee722){var _0x5eafcb=this;return new Promise(function(_0x5c4c3a,_0x3e232e){return db[_0xbb5b('0x13')][_0xbb5b('0x14')]({'raw':_0x5ee722['options']?_0x5ee722[_0xbb5b('0x15')][_0xbb5b('0x16')]===undefined?!![]:![]:!![],'where':_0x5ee722['options']?_0x5ee722[_0xbb5b('0x15')][_0xbb5b('0x17')]||null:null,'attributes':_0x5ee722[_0xbb5b('0x15')]?_0x5ee722[_0xbb5b('0x15')]['attributes']||null:null,'include':_0x5ee722['options']?_0x5ee722[_0xbb5b('0x15')]['include']?_['map'](_0x5ee722['options'][_0xbb5b('0x18')],function(_0x35f179){return{'model':db[_0x35f179[_0xbb5b('0x19')]],'as':_0x35f179['as'],'attributes':_0x35f179[_0xbb5b('0x1a')],'include':_0x35f179[_0xbb5b('0x18')]?_[_0xbb5b('0x1b')](_0x35f179[_0xbb5b('0x18')],function(_0x4667d8){return{'model':db[_0x4667d8['model']],'as':_0x4667d8['as'],'attributes':_0x4667d8[_0xbb5b('0x1a')],'include':_0x4667d8[_0xbb5b('0x18')]?_[_0xbb5b('0x1b')](_0x4667d8[_0xbb5b('0x18')],function(_0x544ffe){return{'model':db[_0x544ffe[_0xbb5b('0x19')]],'as':_0x544ffe['as'],'attributes':_0x544ffe[_0xbb5b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x226482){logger[_0xbb5b('0x8')](_0xbb5b('0x12'),_0x5ee722);logger[_0xbb5b('0xb')](_0xbb5b('0x12'),_0x5ee722,JSON[_0xbb5b('0xd')](_0x226482));_0x5c4c3a(_0x226482);})['catch'](function(_0x4dfb3b){logger[_0xbb5b('0xe')](_0xbb5b('0x12'),_0x4dfb3b[_0xbb5b('0xf')],_0x5ee722);_0x3e232e(_0x5eafcb['error'](0x1f4,_0x4dfb3b['message']));});});}; \ No newline at end of file +var _0x065e=['ShowSound','Sound','find','options','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x065e,0x91));var _0xe065=function(_0x595cfc,_0x22ea3b){_0x595cfc=_0x595cfc-0x0;var _0x1213fd=_0x065e[_0x595cfc];return _0x1213fd;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require(_0xe065('0x1'));var BPromise=require('bluebird');var rs=require(_0xe065('0x2'));var fs=require('fs');var Redis=require(_0xe065('0x3'));var db=require(_0xe065('0x4'))['db'];var utils=require(_0xe065('0x5'));var logger=require(_0xe065('0x6'))(_0xe065('0x7'));var config=require(_0xe065('0x8'));var jayson=require(_0xe065('0x9'));var client=jayson[_0xe065('0xa')][_0xe065('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e78a2,_0x48b2cf,_0x10bfe7){return new BPromise(function(_0x1d4a01,_0x477062){return client[_0xe065('0xc')](_0x5e78a2,_0x10bfe7)[_0xe065('0xd')](function(_0xbe5c73){logger[_0xe065('0xe')](_0xe065('0xf'),_0x48b2cf,'request\x20sent');logger[_0xe065('0x10')](_0xe065('0x11'),_0x48b2cf,_0xe065('0x12'),JSON[_0xe065('0x13')](_0xbe5c73));if(_0xbe5c73[_0xe065('0x14')]){if(_0xbe5c73[_0xe065('0x14')][_0xe065('0x15')]===0x1f4){logger[_0xe065('0x14')](_0xe065('0xf'),_0x48b2cf,_0xbe5c73[_0xe065('0x14')][_0xe065('0x16')]);return _0x477062(_0xbe5c73[_0xe065('0x14')][_0xe065('0x16')]);}logger['error'](_0xe065('0xf'),_0x48b2cf,_0xbe5c73[_0xe065('0x14')][_0xe065('0x16')]);return _0x1d4a01(_0xbe5c73[_0xe065('0x14')][_0xe065('0x16')]);}else{logger[_0xe065('0xe')]('Sound,\x20%s,\x20%s',_0x48b2cf,'request\x20sent');_0x1d4a01(_0xbe5c73[_0xe065('0x17')][_0xe065('0x16')]);}})[_0xe065('0x18')](function(_0x24db86){logger[_0xe065('0x14')](_0xe065('0xf'),_0x48b2cf,_0x24db86);_0x477062(_0x24db86);});});}exports[_0xe065('0x19')]=function(_0x4848a9){var _0x365476=this;return new Promise(function(_0x300d3d,_0x18a512){return db[_0xe065('0x1a')][_0xe065('0x1b')]({'raw':_0x4848a9[_0xe065('0x1c')]?_0x4848a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x4848a9[_0xe065('0x1c')]?_0x4848a9[_0xe065('0x1c')][_0xe065('0x1d')]||null:null,'attributes':_0x4848a9[_0xe065('0x1c')]?_0x4848a9[_0xe065('0x1c')][_0xe065('0x1e')]||null:null,'include':_0x4848a9['options']?_0x4848a9['options'][_0xe065('0x1f')]?_[_0xe065('0x20')](_0x4848a9[_0xe065('0x1c')][_0xe065('0x1f')],function(_0x2b0596){return{'model':db[_0x2b0596['model']],'as':_0x2b0596['as'],'attributes':_0x2b0596['attributes'],'include':_0x2b0596[_0xe065('0x1f')]?_['map'](_0x2b0596['include'],function(_0xc49806){return{'model':db[_0xc49806['model']],'as':_0xc49806['as'],'attributes':_0xc49806[_0xe065('0x1e')],'include':_0xc49806['include']?_[_0xe065('0x20')](_0xc49806[_0xe065('0x1f')],function(_0x1b1c66){return{'model':db[_0x1b1c66[_0xe065('0x21')]],'as':_0x1b1c66['as'],'attributes':_0x1b1c66[_0xe065('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe065('0xd')](function(_0x45316d){logger[_0xe065('0xe')](_0xe065('0x19'),_0x4848a9);logger[_0xe065('0x10')](_0xe065('0x19'),_0x4848a9,JSON['stringify'](_0x45316d));_0x300d3d(_0x45316d);})[_0xe065('0x18')](function(_0x7815ae){logger[_0xe065('0x14')](_0xe065('0x19'),_0x7815ae[_0xe065('0x16')],_0x4848a9);_0x18a512(_0x365476[_0xe065('0x14')](0x1f4,_0x7815ae['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index bbdcc85..f099b42 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0xea4f3a,_0x46d2e6){var _0x88e3dd=function(_0x3470de){while(--_0x3470de){_0xea4f3a['push'](_0xea4f3a['shift']());}};_0x88e3dd(++_0x46d2e6);}(_0x2032,0xd9));var _0x2203=function(_0x26d8fd,_0x5793a4){_0x26d8fd=_0x26d8fd-0x0;var _0x30bed3=_0x2032[_0x26d8fd];return _0x30bed3;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x25139c,_0x9c998){var _0x25a9ae=function(_0xfc2356){while(--_0xfc2356){_0x25139c['push'](_0x25139c['shift']());}};_0x25a9ae(++_0x9c998);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 476440b..ebc62fb 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 _0xf5df=['STRING','TEXT','ENUM','out','sequelize','exports'];(function(_0x2730cc,_0x457ebd){var _0x28b23b=function(_0x360ffa){while(--_0x360ffa){_0x2730cc['push'](_0x2730cc['shift']());}};_0x28b23b(++_0x457ebd);}(_0xf5df,0x70));var _0xff5d=function(_0x47b32d,_0x3f56da){_0x47b32d=_0x47b32d-0x0;var _0x3daf85=_0xf5df[_0x47b32d];return _0x3daf85;};'use strict';var Sequelize=require(_0xff5d('0x0'));module[_0xff5d('0x1')]={'uniqueid':{'type':Sequelize[_0xff5d('0x2')]},'body':{'type':Sequelize[_0xff5d('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xff5d('0x4')]('in',_0xff5d('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xff5d('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x91e2=['medium','out','sequelize','exports','STRING','TEXT'];(function(_0x23e68d,_0x36c99e){var _0xf9b40c=function(_0x52c530){while(--_0x52c530){_0x23e68d['push'](_0x23e68d['shift']());}};_0xf9b40c(++_0x36c99e);}(_0x91e2,0x11c));var _0x291e=function(_0x125703,_0x12dd6e){_0x125703=_0x125703-0x0;var _0x43cb71=_0x91e2[_0x125703];return _0x43cb71;};'use strict';var Sequelize=require(_0x291e('0x0'));module[_0x291e('0x1')]={'uniqueid':{'type':Sequelize[_0x291e('0x2')]},'body':{'type':Sequelize[_0x291e('0x3')](_0x291e('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x291e('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x291e('0x2')]},'providerResponse':{'type':Sequelize[_0x291e('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1f8ccfa..a5d42b6 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 _0x829e=['offset','set','apply','reject','save','destroy','then','end','error','stack','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','where','filter','merge','includeAll','include','findAll','show','params','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x291cb2,_0x45ec6e){var _0x568eee=function(_0x2202cf){while(--_0x2202cf){_0x291cb2['push'](_0x291cb2['shift']());}};_0x568eee(++_0x45ec6e);}(_0x829e,0xaa));var _0xe829=function(_0x4a7b0d,_0x349a5e){_0x4a7b0d=_0x4a7b0d-0x0;var _0x4586a2=_0x829e[_0x4a7b0d];return _0x4586a2;};'use strict';var emlformat=require(_0xe829('0x0'));var rimraf=require(_0xe829('0x1'));var zipdir=require(_0xe829('0x2'));var jsonpatch=require(_0xe829('0x3'));var rp=require(_0xe829('0x4'));var moment=require('moment');var BPromise=require(_0xe829('0x5'));var Mustache=require('mustache');var util=require(_0xe829('0x6'));var path=require(_0xe829('0x7'));var sox=require(_0xe829('0x8'));var csv=require('to-csv');var ejs=require(_0xe829('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe829('0xa'));var crypto=require('crypto');var jsforce=require(_0xe829('0xb'));var deskjs=require(_0xe829('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe829('0xd'));var Redis=require('ioredis');var authService=require(_0xe829('0xe'));var qs=require(_0xe829('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe829('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe829('0x11'));var db=require(_0xe829('0x12'))['db'];function respondWithStatusCode(_0x594afa,_0x226ae7){_0x226ae7=_0x226ae7||0xcc;return function(_0x35b3ac){if(_0x35b3ac){return _0x594afa[_0xe829('0x13')](_0x226ae7);}return _0x594afa[_0xe829('0x14')](_0x226ae7)['end']();};}function respondWithResult(_0x420e3d,_0x42cf79){_0x42cf79=_0x42cf79||0xc8;return function(_0x568ed7){if(_0x568ed7){return _0x420e3d[_0xe829('0x14')](_0x42cf79)[_0xe829('0x15')](_0x568ed7);}};}function respondWithFilteredResult(_0xcfcd3,_0x1a9507){return function(_0x4e40be){if(_0x4e40be){var _0x533aac=typeof _0x1a9507['offset']===_0xe829('0x16')&&typeof _0x1a9507[_0xe829('0x17')]===_0xe829('0x16');var _0x4e7f36=_0x4e40be[_0xe829('0x18')];var _0xa130f9=_0x533aac?0x0:_0x1a9507[_0xe829('0x19')];var _0x117efc=_0x533aac?_0x4e40be[_0xe829('0x18')]:_0x1a9507[_0xe829('0x19')]+_0x1a9507[_0xe829('0x17')];var _0x5c7f69;if(_0x117efc>=_0x4e7f36){_0x117efc=_0x4e7f36;_0x5c7f69=0xc8;}else{_0x5c7f69=0xce;}_0xcfcd3[_0xe829('0x14')](_0x5c7f69);return _0xcfcd3[_0xe829('0x1a')]('Content-Range',_0xa130f9+'-'+_0x117efc+'/'+_0x4e7f36)[_0xe829('0x15')](_0x4e40be);}return null;};}function patchUpdates(_0x27a582){return function(_0x5e5a01){try{jsonpatch[_0xe829('0x1b')](_0x5e5a01,_0x27a582,!![]);}catch(_0x445c18){return BPromise[_0xe829('0x1c')](_0x445c18);}return _0x5e5a01[_0xe829('0x1d')]();};}function saveUpdates(_0x100162,_0x563bdc){return function(_0x1fbd95){if(_0x1fbd95){return _0x1fbd95['update'](_0x100162)['then'](function(_0x109e82){return _0x109e82;});}return null;};}function removeEntity(_0x36b192,_0x48ed79){return function(_0x56a4c5){if(_0x56a4c5){return _0x56a4c5[_0xe829('0x1e')]()[_0xe829('0x1f')](function(){_0x36b192[_0xe829('0x14')](0xcc)[_0xe829('0x20')]();});}};}function handleEntityNotFound(_0x492b96,_0x116d5a){return function(_0x3133f4){if(!_0x3133f4){_0x492b96[_0xe829('0x13')](0x194);}return _0x3133f4;};}function handleError(_0x2bb0ac,_0x27c5fb){_0x27c5fb=_0x27c5fb||0x1f4;return function(_0x45f563){logger[_0xe829('0x21')](_0x45f563[_0xe829('0x22')]);if(_0x45f563['name']){delete _0x45f563['name'];}_0x2bb0ac[_0xe829('0x14')](_0x27c5fb)[_0xe829('0x23')](_0x45f563);};}exports['index']=function(_0xb41b80,_0x36fb2a){var _0x3aa86b={},_0x107412={},_0x1ee6eb={'count':0x0,'rows':[]};var _0x526fa1=_[_0xe829('0x24')](db[_0xe829('0x25')][_0xe829('0x26')],function(_0x2fb560){return{'name':_0x2fb560[_0xe829('0x27')],'type':_0x2fb560[_0xe829('0x28')][_0xe829('0x29')]};});_0x107412[_0xe829('0x2a')]=_['map'](_0x526fa1,_0xe829('0x2b'));_0x107412[_0xe829('0x2c')]=_[_0xe829('0x2d')](_0xb41b80[_0xe829('0x2c')]);_0x107412[_0xe829('0x2e')]=_['intersection'](_0x107412[_0xe829('0x2a')],_0x107412[_0xe829('0x2c')]);_0x3aa86b[_0xe829('0x2f')]=_[_0xe829('0x30')](_0x107412[_0xe829('0x2a')],qs[_0xe829('0x31')](_0xb41b80['query'][_0xe829('0x31')]));_0x3aa86b[_0xe829('0x2f')]=_0x3aa86b['attributes']['length']?_0x3aa86b[_0xe829('0x2f')]:_0x107412[_0xe829('0x2a')];if(!_0xb41b80['query'][_0xe829('0x32')]('nolimit')){_0x3aa86b[_0xe829('0x17')]=qs['limit'](_0xb41b80[_0xe829('0x2c')][_0xe829('0x17')]);_0x3aa86b[_0xe829('0x19')]=qs['offset'](_0xb41b80[_0xe829('0x2c')][_0xe829('0x19')]);}_0x3aa86b['order']=qs['sort'](_0xb41b80[_0xe829('0x2c')]['sort']);_0x3aa86b[_0xe829('0x33')]=qs[_0xe829('0x2e')](_['pick'](_0xb41b80[_0xe829('0x2c')],_0x107412[_0xe829('0x2e')]),_0x526fa1);if(_0xb41b80['query'][_0xe829('0x34')]){_0x3aa86b[_0xe829('0x33')]=_[_0xe829('0x35')](_0x3aa86b[_0xe829('0x33')],{'$or':_[_0xe829('0x24')](_0x526fa1,function(_0x18c342){if(_0x18c342[_0xe829('0x28')]!=='VIRTUAL'){var _0x3e4c83={};_0x3e4c83[_0x18c342['name']]={'$like':'%'+_0xb41b80[_0xe829('0x2c')][_0xe829('0x34')]+'%'};return _0x3e4c83;}})});}_0x3aa86b=_[_0xe829('0x35')]({},_0x3aa86b,_0xb41b80['options']);var _0x4068ba={'where':_0x3aa86b[_0xe829('0x33')]};return db[_0xe829('0x25')][_0xe829('0x18')](_0x4068ba)[_0xe829('0x1f')](function(_0x526ff7){_0x1ee6eb[_0xe829('0x18')]=_0x526ff7;if(_0xb41b80[_0xe829('0x2c')][_0xe829('0x36')]){_0x3aa86b[_0xe829('0x37')]=[{'all':!![]}];}return db[_0xe829('0x25')][_0xe829('0x38')](_0x3aa86b);})[_0xe829('0x1f')](function(_0x111731){_0x1ee6eb['rows']=_0x111731;return _0x1ee6eb;})[_0xe829('0x1f')](respondWithFilteredResult(_0x36fb2a,_0x3aa86b))['catch'](handleError(_0x36fb2a,null));};exports[_0xe829('0x39')]=function(_0x424acb,_0x352354){var _0x1f4235={'raw':!![],'where':{'id':_0x424acb[_0xe829('0x3a')]['id']}},_0x47a637={};_0x47a637['model']=_[_0xe829('0x2d')](db[_0xe829('0x25')][_0xe829('0x26')]);_0x47a637['query']=_['keys'](_0x424acb[_0xe829('0x2c')]);_0x47a637[_0xe829('0x2e')]=_[_0xe829('0x30')](_0x47a637[_0xe829('0x2a')],_0x47a637['query']);_0x1f4235[_0xe829('0x2f')]=_[_0xe829('0x30')](_0x47a637['model'],qs[_0xe829('0x31')](_0x424acb['query'][_0xe829('0x31')]));_0x1f4235[_0xe829('0x2f')]=_0x1f4235[_0xe829('0x2f')][_0xe829('0x3b')]?_0x1f4235[_0xe829('0x2f')]:_0x47a637['model'];if(_0x424acb['query']['includeAll']){_0x1f4235[_0xe829('0x37')]=[{'all':!![]}];}_0x1f4235=_[_0xe829('0x35')]({},_0x1f4235,_0x424acb[_0xe829('0x3c')]);return db[_0xe829('0x25')][_0xe829('0x3d')](_0x1f4235)[_0xe829('0x1f')](handleEntityNotFound(_0x352354,null))[_0xe829('0x1f')](respondWithResult(_0x352354,null))[_0xe829('0x3e')](handleError(_0x352354,null));};exports[_0xe829('0x3f')]=function(_0x450944,_0x50b57e){return db[_0xe829('0x25')][_0xe829('0x3f')](_0x450944[_0xe829('0x40')],{})[_0xe829('0x1f')](respondWithResult(_0x50b57e,0xc9))[_0xe829('0x3e')](handleError(_0x50b57e,null));};exports['update']=function(_0x2828da,_0xf577e0){if(_0x2828da[_0xe829('0x40')]['id']){delete _0x2828da[_0xe829('0x40')]['id'];}return db[_0xe829('0x25')][_0xe829('0x3d')]({'where':{'id':_0x2828da[_0xe829('0x3a')]['id']}})['then'](handleEntityNotFound(_0xf577e0,null))[_0xe829('0x1f')](saveUpdates(_0x2828da[_0xe829('0x40')],null))[_0xe829('0x1f')](respondWithResult(_0xf577e0,null))[_0xe829('0x3e')](handleError(_0xf577e0,null));};exports['destroy']=function(_0x43416a,_0x144c7e){return db[_0xe829('0x25')][_0xe829('0x3d')]({'where':{'id':_0x43416a['params']['id']}})[_0xe829('0x1f')](handleEntityNotFound(_0x144c7e,null))['then'](removeEntity(_0x144c7e,null))[_0xe829('0x3e')](handleError(_0x144c7e,null));}; \ No newline at end of file +var _0x33b4=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SquareMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','rimraf','fast-json-patch','request-promise','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','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x3b7889,_0x1f8a42){var _0x371266=function(_0x27278b){while(--_0x27278b){_0x3b7889['push'](_0x3b7889['shift']());}};_0x371266(++_0x1f8a42);}(_0x33b4,0x160));var _0x433b=function(_0x1a6475,_0x31fd7e){_0x1a6475=_0x1a6475-0x0;var _0x4fabc4=_0x33b4[_0x1a6475];return _0x4fabc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x433b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x433b('0x1'));var rp=require(_0x433b('0x2'));var moment=require(_0x433b('0x3'));var BPromise=require(_0x433b('0x4'));var Mustache=require(_0x433b('0x5'));var util=require(_0x433b('0x6'));var path=require(_0x433b('0x7'));var sox=require(_0x433b('0x8'));var csv=require(_0x433b('0x9'));var ejs=require(_0x433b('0xa'));var fs=require('fs');var fs_extra=require(_0x433b('0xb'));var _=require(_0x433b('0xc'));var squel=require('squel');var crypto=require(_0x433b('0xd'));var jsforce=require(_0x433b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x433b('0x9'));var querystring=require('querystring');var Papa=require(_0x433b('0xf'));var Redis=require(_0x433b('0x10'));var authService=require(_0x433b('0x11'));var qs=require(_0x433b('0x12'));var as=require(_0x433b('0x13'));var hardwareService=require(_0x433b('0x14'));var logger=require(_0x433b('0x15'))(_0x433b('0x16'));var utils=require(_0x433b('0x17'));var config=require(_0x433b('0x18'));var licenseUtil=require(_0x433b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21ef19,_0x1f74ed){_0x1f74ed=_0x1f74ed||0xcc;return function(_0x5766dd){if(_0x5766dd){return _0x21ef19[_0x433b('0x1a')](_0x1f74ed);}return _0x21ef19[_0x433b('0x1b')](_0x1f74ed)[_0x433b('0x1c')]();};}function respondWithResult(_0x29acd4,_0x2fcbab){_0x2fcbab=_0x2fcbab||0xc8;return function(_0x37035a){if(_0x37035a){return _0x29acd4[_0x433b('0x1b')](_0x2fcbab)[_0x433b('0x1d')](_0x37035a);}};}function respondWithFilteredResult(_0x459af6,_0x4db564){return function(_0x14cbfd){if(_0x14cbfd){var _0xb5e593=typeof _0x4db564[_0x433b('0x1e')]==='undefined'&&typeof _0x4db564[_0x433b('0x1f')]===_0x433b('0x20');var _0xfba8d5=_0x14cbfd[_0x433b('0x21')];var _0x261ad7=_0xb5e593?0x0:_0x4db564[_0x433b('0x1e')];var _0x2e31ae=_0xb5e593?_0x14cbfd['count']:_0x4db564[_0x433b('0x1e')]+_0x4db564[_0x433b('0x1f')];var _0x7cc748;if(_0x2e31ae>=_0xfba8d5){_0x2e31ae=_0xfba8d5;_0x7cc748=0xc8;}else{_0x7cc748=0xce;}_0x459af6[_0x433b('0x1b')](_0x7cc748);return _0x459af6[_0x433b('0x22')](_0x433b('0x23'),_0x261ad7+'-'+_0x2e31ae+'/'+_0xfba8d5)[_0x433b('0x1d')](_0x14cbfd);}return null;};}function patchUpdates(_0x1e0b87){return function(_0xb4a8a7){try{jsonpatch[_0x433b('0x24')](_0xb4a8a7,_0x1e0b87,!![]);}catch(_0x1bcc6b){return BPromise[_0x433b('0x25')](_0x1bcc6b);}return _0xb4a8a7[_0x433b('0x26')]();};}function saveUpdates(_0x141123,_0x32ee97){return function(_0x448456){if(_0x448456){return _0x448456[_0x433b('0x27')](_0x141123)[_0x433b('0x28')](function(_0x3b6a93){return _0x3b6a93;});}return null;};}function removeEntity(_0x511922,_0x926289){return function(_0x22ec9e){if(_0x22ec9e){return _0x22ec9e[_0x433b('0x29')]()[_0x433b('0x28')](function(){_0x511922[_0x433b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d50cf,_0x3f61d3){return function(_0x3c6f56){if(!_0x3c6f56){_0x3d50cf[_0x433b('0x1a')](0x194);}return _0x3c6f56;};}function handleError(_0x107ea1,_0x1a108b){_0x1a108b=_0x1a108b||0x1f4;return function(_0x555a51){logger[_0x433b('0x2a')](_0x555a51[_0x433b('0x2b')]);if(_0x555a51[_0x433b('0x2c')]){delete _0x555a51['name'];}_0x107ea1[_0x433b('0x1b')](_0x1a108b)['send'](_0x555a51);};}exports[_0x433b('0x2d')]=function(_0x4162be,_0x10efc3){var _0x4fdab4={},_0x50cc8b={},_0x2da3ca={'count':0x0,'rows':[]};var _0x271d75=_['map'](db[_0x433b('0x2e')]['rawAttributes'],function(_0x2d706d){return{'name':_0x2d706d[_0x433b('0x2f')],'type':_0x2d706d[_0x433b('0x30')]['key']};});_0x50cc8b[_0x433b('0x31')]=_[_0x433b('0x32')](_0x271d75,_0x433b('0x2c'));_0x50cc8b[_0x433b('0x33')]=_['keys'](_0x4162be['query']);_0x50cc8b[_0x433b('0x34')]=_[_0x433b('0x35')](_0x50cc8b[_0x433b('0x31')],_0x50cc8b[_0x433b('0x33')]);_0x4fdab4[_0x433b('0x36')]=_[_0x433b('0x35')](_0x50cc8b[_0x433b('0x31')],qs[_0x433b('0x37')](_0x4162be[_0x433b('0x33')]['fields']));_0x4fdab4[_0x433b('0x36')]=_0x4fdab4[_0x433b('0x36')]['length']?_0x4fdab4[_0x433b('0x36')]:_0x50cc8b[_0x433b('0x31')];if(!_0x4162be[_0x433b('0x33')][_0x433b('0x38')](_0x433b('0x39'))){_0x4fdab4[_0x433b('0x1f')]=qs['limit'](_0x4162be[_0x433b('0x33')][_0x433b('0x1f')]);_0x4fdab4[_0x433b('0x1e')]=qs[_0x433b('0x1e')](_0x4162be[_0x433b('0x33')][_0x433b('0x1e')]);}_0x4fdab4['order']=qs[_0x433b('0x3a')](_0x4162be[_0x433b('0x33')][_0x433b('0x3a')]);_0x4fdab4[_0x433b('0x3b')]=qs[_0x433b('0x34')](_[_0x433b('0x3c')](_0x4162be[_0x433b('0x33')],_0x50cc8b[_0x433b('0x34')]),_0x271d75);if(_0x4162be['query'][_0x433b('0x3d')]){_0x4fdab4[_0x433b('0x3b')]=_[_0x433b('0x3e')](_0x4fdab4[_0x433b('0x3b')],{'$or':_[_0x433b('0x32')](_0x271d75,function(_0x3b0d3c){if(_0x3b0d3c[_0x433b('0x30')]!=='VIRTUAL'){var _0x5c2dda={};_0x5c2dda[_0x3b0d3c[_0x433b('0x2c')]]={'$like':'%'+_0x4162be[_0x433b('0x33')]['filter']+'%'};return _0x5c2dda;}})});}_0x4fdab4=_[_0x433b('0x3e')]({},_0x4fdab4,_0x4162be['options']);var _0x3aeb20={'where':_0x4fdab4[_0x433b('0x3b')]};return db[_0x433b('0x2e')][_0x433b('0x21')](_0x3aeb20)['then'](function(_0x15d96b){_0x2da3ca[_0x433b('0x21')]=_0x15d96b;if(_0x4162be['query'][_0x433b('0x3f')]){_0x4fdab4[_0x433b('0x40')]=[{'all':!![]}];}return db[_0x433b('0x2e')][_0x433b('0x41')](_0x4fdab4);})[_0x433b('0x28')](function(_0xa9b412){_0x2da3ca[_0x433b('0x42')]=_0xa9b412;return _0x2da3ca;})[_0x433b('0x28')](respondWithFilteredResult(_0x10efc3,_0x4fdab4))[_0x433b('0x43')](handleError(_0x10efc3,null));};exports[_0x433b('0x44')]=function(_0x56afb4,_0x16f02f){var _0xa3ddc4={'raw':!![],'where':{'id':_0x56afb4[_0x433b('0x45')]['id']}},_0x1e323f={};_0x1e323f['model']=_[_0x433b('0x46')](db[_0x433b('0x2e')]['rawAttributes']);_0x1e323f[_0x433b('0x33')]=_[_0x433b('0x46')](_0x56afb4[_0x433b('0x33')]);_0x1e323f[_0x433b('0x34')]=_['intersection'](_0x1e323f['model'],_0x1e323f[_0x433b('0x33')]);_0xa3ddc4['attributes']=_['intersection'](_0x1e323f[_0x433b('0x31')],qs['fields'](_0x56afb4[_0x433b('0x33')][_0x433b('0x37')]));_0xa3ddc4[_0x433b('0x36')]=_0xa3ddc4['attributes'][_0x433b('0x47')]?_0xa3ddc4[_0x433b('0x36')]:_0x1e323f['model'];if(_0x56afb4['query'][_0x433b('0x3f')]){_0xa3ddc4[_0x433b('0x40')]=[{'all':!![]}];}_0xa3ddc4=_['merge']({},_0xa3ddc4,_0x56afb4[_0x433b('0x48')]);return db['SquareMessage'][_0x433b('0x49')](_0xa3ddc4)['then'](handleEntityNotFound(_0x16f02f,null))[_0x433b('0x28')](respondWithResult(_0x16f02f,null))['catch'](handleError(_0x16f02f,null));};exports[_0x433b('0x4a')]=function(_0x4a2148,_0x10eca8){return db['SquareMessage']['create'](_0x4a2148[_0x433b('0x4b')],{})[_0x433b('0x28')](respondWithResult(_0x10eca8,0xc9))[_0x433b('0x43')](handleError(_0x10eca8,null));};exports[_0x433b('0x27')]=function(_0x2b0b0e,_0x3d0ba0){if(_0x2b0b0e[_0x433b('0x4b')]['id']){delete _0x2b0b0e[_0x433b('0x4b')]['id'];}return db[_0x433b('0x2e')][_0x433b('0x49')]({'where':{'id':_0x2b0b0e[_0x433b('0x45')]['id']}})[_0x433b('0x28')](handleEntityNotFound(_0x3d0ba0,null))[_0x433b('0x28')](saveUpdates(_0x2b0b0e[_0x433b('0x4b')],null))[_0x433b('0x28')](respondWithResult(_0x3d0ba0,null))[_0x433b('0x43')](handleError(_0x3d0ba0,null));};exports[_0x433b('0x29')]=function(_0x4b140d,_0x182bd3){return db[_0x433b('0x2e')][_0x433b('0x49')]({'where':{'id':_0x4b140d[_0x433b('0x45')]['id']}})[_0x433b('0x28')](handleEntityNotFound(_0x182bd3,null))[_0x433b('0x28')](removeEntity(_0x182bd3,null))[_0x433b('0x43')](handleError(_0x182bd3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c1e9888..90d4e29 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 _0x4055=['../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2d01df,_0x429d33){var _0x56e944=function(_0x538aad){while(--_0x538aad){_0x2d01df['push'](_0x2d01df['shift']());}};_0x56e944(++_0x429d33);}(_0x4055,0x1e8));var _0x5405=function(_0x292891,_0x426567){_0x292891=_0x292891-0x0;var _0x5913aa=_0x4055[_0x292891];return _0x5913aa;};'use strict';var _=require(_0x5405('0x0'));var util=require(_0x5405('0x1'));var logger=require(_0x5405('0x2'))(_0x5405('0x3'));var moment=require(_0x5405('0x4'));var BPromise=require(_0x5405('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5405('0x6'));var config=require(_0x5405('0x7'));var attributes=require(_0x5405('0x8'));module[_0x5405('0x9')]=function(_0x1a8771,_0x2dbcb3){return _0x1a8771[_0x5405('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe942=['rimraf','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x593f03,_0x4af84a){var _0x178299=function(_0x284500){while(--_0x284500){_0x593f03['push'](_0x593f03['shift']());}};_0x178299(++_0x4af84a);}(_0xe942,0x130));var _0x2e94=function(_0x524fa1,_0xc1c497){_0x524fa1=_0x524fa1-0x0;var _0x198901=_0xe942[_0x524fa1];return _0x198901;};'use strict';var _=require(_0x2e94('0x0'));var util=require(_0x2e94('0x1'));var logger=require(_0x2e94('0x2'))(_0x2e94('0x3'));var moment=require(_0x2e94('0x4'));var BPromise=require(_0x2e94('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e94('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module['exports']=function(_0x5e7119,_0x3f2b31){return _0x5e7119[_0x2e94('0x7')](_0x2e94('0x8'),attributes,{'tableName':_0x2e94('0x9'),'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 1e37b9b..c261cda 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 _0x3f57=['request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','CreateSquareMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4ae9d0,_0xcd7641){var _0x590870=function(_0x263f99){while(--_0x263f99){_0x4ae9d0['push'](_0x4ae9d0['shift']());}};_0x590870(++_0xcd7641);}(_0x3f57,0xf0));var _0x73f5=function(_0x416446,_0x2a85bb){_0x416446=_0x416446-0x0;var _0x1fe97e=_0x3f57[_0x416446];return _0x1fe97e;};'use strict';var _=require(_0x73f5('0x0'));var util=require(_0x73f5('0x1'));var moment=require(_0x73f5('0x2'));var BPromise=require(_0x73f5('0x3'));var rs=require(_0x73f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f5('0x5'))['db'];var utils=require(_0x73f5('0x6'));var logger=require(_0x73f5('0x7'))('rpc');var config=require(_0x73f5('0x8'));var jayson=require(_0x73f5('0x9'));var client=jayson[_0x73f5('0xa')][_0x73f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417a68,_0x19fc33,_0x578963){return new BPromise(function(_0x518d45,_0x573c64){return client[_0x73f5('0xc')](_0x417a68,_0x578963)[_0x73f5('0xd')](function(_0x28209a){logger[_0x73f5('0xe')]('SquareMessage,\x20%s,\x20%s',_0x19fc33,_0x73f5('0xf'));logger[_0x73f5('0x10')](_0x73f5('0x11'),_0x19fc33,'request\x20sent',JSON[_0x73f5('0x12')](_0x28209a));if(_0x28209a[_0x73f5('0x13')]){if(_0x28209a[_0x73f5('0x13')][_0x73f5('0x14')]===0x1f4){logger[_0x73f5('0x13')]('SquareMessage,\x20%s,\x20%s',_0x19fc33,_0x28209a['error'][_0x73f5('0x15')]);return _0x573c64(_0x28209a['error'][_0x73f5('0x15')]);}logger[_0x73f5('0x13')](_0x73f5('0x16'),_0x19fc33,_0x28209a[_0x73f5('0x13')][_0x73f5('0x15')]);return _0x518d45(_0x28209a[_0x73f5('0x13')][_0x73f5('0x15')]);}else{logger['info'](_0x73f5('0x16'),_0x19fc33,'request\x20sent');_0x518d45(_0x28209a[_0x73f5('0x17')]['message']);}})['catch'](function(_0x1d11ac){logger[_0x73f5('0x13')](_0x73f5('0x16'),_0x19fc33,_0x1d11ac);_0x573c64(_0x1d11ac);});});}exports[_0x73f5('0x18')]=function(_0x41d73e){var _0x2df084=this;return new Promise(function(_0x3e5b36,_0x213bbc){return db['SquareMessage'][_0x73f5('0x19')](_0x41d73e['body'],{'raw':_0x41d73e[_0x73f5('0x1a')]?_0x41d73e[_0x73f5('0x1a')][_0x73f5('0x1b')]===undefined?!![]:![]:!![]})[_0x73f5('0xd')](function(_0x383302){logger[_0x73f5('0xe')](_0x73f5('0x18'),_0x41d73e);logger[_0x73f5('0x10')](_0x73f5('0x18'),_0x41d73e,JSON[_0x73f5('0x12')](_0x383302));_0x3e5b36(_0x383302);})['catch'](function(_0x42a8b9){logger[_0x73f5('0x13')]('CreateSquareMessage',_0x42a8b9[_0x73f5('0x15')],_0x41d73e);_0x213bbc(_0x2df084[_0x73f5('0x13')](0x1f4,_0x42a8b9[_0x73f5('0x15')]));});});}; \ No newline at end of file +var _0x57c2=['create','options','raw','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','request\x20sent','result','CreateSquareMessage','SquareMessage'];(function(_0x56e250,_0x196ce3){var _0x3081b1=function(_0x5ded8b){while(--_0x5ded8b){_0x56e250['push'](_0x56e250['shift']());}};_0x3081b1(++_0x196ce3);}(_0x57c2,0x1f1));var _0x257c=function(_0x605b74,_0x2c8c20){_0x605b74=_0x605b74-0x0;var _0x5a1d84=_0x57c2[_0x605b74];return _0x5a1d84;};'use strict';var _=require(_0x257c('0x0'));var util=require(_0x257c('0x1'));var moment=require(_0x257c('0x2'));var BPromise=require('bluebird');var rs=require(_0x257c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x257c('0x4'))['db'];var utils=require(_0x257c('0x5'));var logger=require(_0x257c('0x6'))(_0x257c('0x7'));var config=require(_0x257c('0x8'));var jayson=require(_0x257c('0x9'));var client=jayson[_0x257c('0xa')][_0x257c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a9abf,_0x3fa723,_0x403474){return new BPromise(function(_0x11ad12,_0x32124b){return client['request'](_0x3a9abf,_0x403474)[_0x257c('0xc')](function(_0xd3016a){logger[_0x257c('0xd')]('SquareMessage,\x20%s,\x20%s',_0x3fa723,'request\x20sent');logger[_0x257c('0xe')](_0x257c('0xf'),_0x3fa723,'request\x20sent',JSON[_0x257c('0x10')](_0xd3016a));if(_0xd3016a['error']){if(_0xd3016a[_0x257c('0x11')][_0x257c('0x12')]===0x1f4){logger[_0x257c('0x11')](_0x257c('0x13'),_0x3fa723,_0xd3016a[_0x257c('0x11')][_0x257c('0x14')]);return _0x32124b(_0xd3016a['error'][_0x257c('0x14')]);}logger[_0x257c('0x11')](_0x257c('0x13'),_0x3fa723,_0xd3016a['error'][_0x257c('0x14')]);return _0x11ad12(_0xd3016a['error'][_0x257c('0x14')]);}else{logger['info'](_0x257c('0x13'),_0x3fa723,_0x257c('0x15'));_0x11ad12(_0xd3016a[_0x257c('0x16')][_0x257c('0x14')]);}})['catch'](function(_0xaca2ca){logger[_0x257c('0x11')](_0x257c('0x13'),_0x3fa723,_0xaca2ca);_0x32124b(_0xaca2ca);});});}exports[_0x257c('0x17')]=function(_0x2aeeec){var _0x5df6a1=this;return new Promise(function(_0x38253a,_0x1fbe93){return db[_0x257c('0x18')][_0x257c('0x19')](_0x2aeeec['body'],{'raw':_0x2aeeec[_0x257c('0x1a')]?_0x2aeeec[_0x257c('0x1a')][_0x257c('0x1b')]===undefined?!![]:![]:!![]})[_0x257c('0xc')](function(_0x3252f6){logger[_0x257c('0xd')](_0x257c('0x17'),_0x2aeeec);logger[_0x257c('0xe')](_0x257c('0x17'),_0x2aeeec,JSON[_0x257c('0x10')](_0x3252f6));_0x38253a(_0x3252f6);})[_0x257c('0x1c')](function(_0x5d14a3){logger[_0x257c('0x11')](_0x257c('0x17'),_0x5d14a3[_0x257c('0x14')],_0x2aeeec);_0x1fbe93(_0x5df6a1[_0x257c('0x11')](0x1f4,_0x5d14a3[_0x257c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6fd6a36..e655e52 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 _0xc7f7=['/:id/test','test','post','create','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','isAuthenticated','show'];(function(_0x169ca0,_0x48d215){var _0x2ce4df=function(_0x2721ca){while(--_0x2721ca){_0x169ca0['push'](_0x169ca0['shift']());}};_0x2ce4df(++_0x48d215);}(_0xc7f7,0x153));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7c7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7c7f('0x1'));var express=require(_0x7c7f('0x2'));var router=express[_0x7c7f('0x3')]();var fs_extra=require(_0x7c7f('0x4'));var auth=require(_0x7c7f('0x5'));var interaction=require(_0x7c7f('0x6'));var config=require(_0x7c7f('0x7'));var controller=require(_0x7c7f('0x8'));router[_0x7c7f('0x9')]('/',auth['isAuthenticated'](),controller[_0x7c7f('0xa')]);router[_0x7c7f('0x9')]('/:id',auth[_0x7c7f('0xb')](),controller[_0x7c7f('0xc')]);router['get'](_0x7c7f('0xd'),auth[_0x7c7f('0xb')](),timeout('15s'),controller[_0x7c7f('0xe')]);router[_0x7c7f('0xf')]('/',auth[_0x7c7f('0xb')](),controller[_0x7c7f('0x10')]);router[_0x7c7f('0x11')]('/:id',auth[_0x7c7f('0xb')](),controller['update']);router[_0x7c7f('0x12')](_0x7c7f('0x13'),auth['isAuthenticated'](),controller[_0x7c7f('0x14')]);module[_0x7c7f('0x15')]=router; \ No newline at end of file +var _0x15c5=['show','/:id/test','15s','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0x2acdc,_0x42cb5e){var _0x4a94aa=function(_0x341cf8){while(--_0x341cf8){_0x2acdc['push'](_0x2acdc['shift']());}};_0x4a94aa(++_0x42cb5e);}(_0x15c5,0x14a));var _0x515c=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x15c5[_0x1fb1c1];return _0x1622df;};'use strict';var multer=require(_0x515c('0x0'));var util=require(_0x515c('0x1'));var path=require(_0x515c('0x2'));var timeout=require(_0x515c('0x3'));var express=require(_0x515c('0x4'));var router=express[_0x515c('0x5')]();var fs_extra=require(_0x515c('0x6'));var auth=require(_0x515c('0x7'));var interaction=require(_0x515c('0x8'));var config=require(_0x515c('0x9'));var controller=require(_0x515c('0xa'));router[_0x515c('0xb')]('/',auth[_0x515c('0xc')](),controller[_0x515c('0xd')]);router[_0x515c('0xb')](_0x515c('0xe'),auth[_0x515c('0xc')](),controller[_0x515c('0xf')]);router[_0x515c('0xb')](_0x515c('0x10'),auth['isAuthenticated'](),timeout(_0x515c('0x11')),controller['test']);router[_0x515c('0x12')]('/',auth[_0x515c('0xc')](),controller[_0x515c('0x13')]);router[_0x515c('0x14')](_0x515c('0xe'),auth[_0x515c('0xc')](),controller['update']);router[_0x515c('0x15')]('/:id',auth[_0x515c('0xc')](),controller[_0x515c('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index bc2d68b..754972f 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 _0xa4ff=['STRING','sequelize','exports','name'];(function(_0xd40135,_0x4d8539){var _0x41a721=function(_0xe996f3){while(--_0xe996f3){_0xd40135['push'](_0xd40135['shift']());}};_0x41a721(++_0x4d8539);}(_0xa4ff,0xb5));var _0xfa4f=function(_0x2a8bbd,_0x2d998b){_0x2a8bbd=_0x2a8bbd-0x0;var _0x276e9c=_0xa4ff[_0x2a8bbd];return _0x276e9c;};'use strict';var Sequelize=require(_0xfa4f('0x0'));module[_0xfa4f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfa4f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfa4f('0x3')]}}; \ No newline at end of file +var _0xd64d=['STRING','name','sequelize'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0xd64d,0x146));var _0xdd64=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd64d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xdd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd64('0x1')],'unique':_0xdd64('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xdd64('0x1')]},'description':{'type':Sequelize[_0xdd64('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8b987d7..2a44a66 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 _0x36c4=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','where','VIRTUAL','filter','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','dsn','openSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection'];(function(_0x195c1f,_0x384a6c){var _0x240233=function(_0x385cdc){while(--_0x385cdc){_0x195c1f['push'](_0x195c1f['shift']());}};_0x240233(++_0x384a6c);}(_0x36c4,0x73));var _0x436c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x436c('0x0'));var jsonpatch=require(_0x436c('0x1'));var rp=require(_0x436c('0x2'));var moment=require('moment');var BPromise=require(_0x436c('0x3'));var Mustache=require(_0x436c('0x4'));var util=require(_0x436c('0x5'));var path=require(_0x436c('0x6'));var sox=require('sox');var csv=require(_0x436c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x436c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x436c('0x9'));var toCsv=require('to-csv');var querystring=require(_0x436c('0xa'));var Papa=require(_0x436c('0xb'));var Redis=require(_0x436c('0xc'));var authService=require(_0x436c('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x436c('0xe'));var logger=require('../../config/logger')(_0x436c('0xf'));var utils=require(_0x436c('0x10'));var config=require(_0x436c('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x436c('0x12'))['db'];function respondWithStatusCode(_0x3ee4ac,_0x2c2e82){_0x2c2e82=_0x2c2e82||0xcc;return function(_0x1c3cbb){if(_0x1c3cbb){return _0x3ee4ac[_0x436c('0x13')](_0x2c2e82);}return _0x3ee4ac[_0x436c('0x14')](_0x2c2e82)[_0x436c('0x15')]();};}function respondWithResult(_0x3e851c,_0x41a9b4){_0x41a9b4=_0x41a9b4||0xc8;return function(_0x5301e7){if(_0x5301e7){return _0x3e851c[_0x436c('0x14')](_0x41a9b4)['json'](_0x5301e7);}};}function respondWithFilteredResult(_0x1d7476,_0x18d050){return function(_0x5b9d3f){if(_0x5b9d3f){var _0x5c948c=typeof _0x18d050[_0x436c('0x16')]===_0x436c('0x17')&&typeof _0x18d050[_0x436c('0x18')]==='undefined';var _0x2c23bd=_0x5b9d3f['count'];var _0x1b121a=_0x5c948c?0x0:_0x18d050[_0x436c('0x16')];var _0x44a3e8=_0x5c948c?_0x5b9d3f[_0x436c('0x19')]:_0x18d050[_0x436c('0x16')]+_0x18d050[_0x436c('0x18')];var _0x2e75cb;if(_0x44a3e8>=_0x2c23bd){_0x44a3e8=_0x2c23bd;_0x2e75cb=0xc8;}else{_0x2e75cb=0xce;}_0x1d7476['status'](_0x2e75cb);return _0x1d7476[_0x436c('0x1a')](_0x436c('0x1b'),_0x1b121a+'-'+_0x44a3e8+'/'+_0x2c23bd)[_0x436c('0x1c')](_0x5b9d3f);}return null;};}function patchUpdates(_0x18c48f){return function(_0x1af220){try{jsonpatch[_0x436c('0x1d')](_0x1af220,_0x18c48f,!![]);}catch(_0x3ea1c3){return BPromise[_0x436c('0x1e')](_0x3ea1c3);}return _0x1af220['save']();};}function saveUpdates(_0x43641e,_0x484167){return function(_0x58b196){if(_0x58b196){return _0x58b196['update'](_0x43641e)['then'](function(_0x197b3a){return _0x197b3a;});}return null;};}function removeEntity(_0x406ae1,_0x29f3a5){return function(_0x57c982){if(_0x57c982){return _0x57c982[_0x436c('0x1f')]()[_0x436c('0x20')](function(){var _0x25d354=_0x57c982[_0x436c('0x21')]({'plain':!![]});var _0x247070=_0x436c('0x22');return db[_0x436c('0x23')][_0x436c('0x1f')]({'where':{'type':_0x247070,'resourceId':_0x25d354['id']}})[_0x436c('0x20')](function(){return _0x57c982;});})[_0x436c('0x20')](function(){_0x406ae1[_0x436c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b4f08,_0x51c6c3){return function(_0x259111){if(!_0x259111){_0x5b4f08[_0x436c('0x13')](0x194);}return _0x259111;};}function handleError(_0x3b0b21,_0x314ee5){_0x314ee5=_0x314ee5||0x1f4;return function(_0x4e9d11){logger[_0x436c('0x24')](_0x4e9d11[_0x436c('0x25')]);if(_0x4e9d11[_0x436c('0x26')]){delete _0x4e9d11['name'];}_0x3b0b21['status'](_0x314ee5)[_0x436c('0x27')](_0x4e9d11);};}exports[_0x436c('0x28')]=function(_0x3b0e74,_0x2dd054){var _0x49f7d8={},_0x22f358={},_0x5c0533={'count':0x0,'rows':[]};var _0x4b65ef=_[_0x436c('0x29')](db['SquareOdbc'][_0x436c('0x2a')],function(_0x53a95f){return{'name':_0x53a95f['fieldName'],'type':_0x53a95f[_0x436c('0x2b')][_0x436c('0x2c')]};});_0x22f358[_0x436c('0x2d')]=_[_0x436c('0x29')](_0x4b65ef,_0x436c('0x26'));_0x22f358[_0x436c('0x2e')]=_[_0x436c('0x2f')](_0x3b0e74[_0x436c('0x2e')]);_0x22f358['filters']=_[_0x436c('0x30')](_0x22f358['model'],_0x22f358[_0x436c('0x2e')]);_0x49f7d8[_0x436c('0x31')]=_['intersection'](_0x22f358[_0x436c('0x2d')],qs[_0x436c('0x32')](_0x3b0e74[_0x436c('0x2e')][_0x436c('0x32')]));_0x49f7d8[_0x436c('0x31')]=_0x49f7d8[_0x436c('0x31')][_0x436c('0x33')]?_0x49f7d8[_0x436c('0x31')]:_0x22f358[_0x436c('0x2d')];if(!_0x3b0e74['query'][_0x436c('0x34')](_0x436c('0x35'))){_0x49f7d8[_0x436c('0x18')]=qs[_0x436c('0x18')](_0x3b0e74[_0x436c('0x2e')]['limit']);_0x49f7d8[_0x436c('0x16')]=qs['offset'](_0x3b0e74['query']['offset']);}_0x49f7d8[_0x436c('0x36')]=qs[_0x436c('0x37')](_0x3b0e74[_0x436c('0x2e')][_0x436c('0x37')]);_0x49f7d8['where']=qs[_0x436c('0x38')](_['pick'](_0x3b0e74[_0x436c('0x2e')],_0x22f358[_0x436c('0x38')]),_0x4b65ef);if(_0x3b0e74[_0x436c('0x2e')]['filter']){_0x49f7d8['where']=_[_0x436c('0x39')](_0x49f7d8[_0x436c('0x3a')],{'$or':_[_0x436c('0x29')](_0x4b65ef,function(_0x2ae11d){if(_0x2ae11d[_0x436c('0x2b')]!==_0x436c('0x3b')){var _0x4e477b={};_0x4e477b[_0x2ae11d['name']]={'$like':'%'+_0x3b0e74[_0x436c('0x2e')][_0x436c('0x3c')]+'%'};return _0x4e477b;}})});}_0x49f7d8=_['merge']({},_0x49f7d8,_0x3b0e74[_0x436c('0x3d')]);var _0x1468ff={'where':_0x49f7d8[_0x436c('0x3a')]};return db[_0x436c('0x3e')][_0x436c('0x19')](_0x1468ff)[_0x436c('0x20')](function(_0x306b7e){_0x5c0533[_0x436c('0x19')]=_0x306b7e;if(_0x3b0e74[_0x436c('0x2e')][_0x436c('0x3f')]){_0x49f7d8[_0x436c('0x40')]=[{'all':!![]}];}return db[_0x436c('0x3e')][_0x436c('0x41')](_0x49f7d8);})[_0x436c('0x20')](function(_0x1929dd){_0x5c0533[_0x436c('0x42')]=_0x1929dd;return _0x5c0533;})[_0x436c('0x20')](respondWithFilteredResult(_0x2dd054,_0x49f7d8))[_0x436c('0x43')](handleError(_0x2dd054,null));};exports[_0x436c('0x44')]=function(_0x35754e,_0x4645ce){var _0x4f722c={'raw':!![],'where':{'id':_0x35754e['params']['id']}},_0x593c8f={};_0x593c8f[_0x436c('0x2d')]=_[_0x436c('0x2f')](db[_0x436c('0x3e')]['rawAttributes']);_0x593c8f['query']=_[_0x436c('0x2f')](_0x35754e[_0x436c('0x2e')]);_0x593c8f[_0x436c('0x38')]=_['intersection'](_0x593c8f[_0x436c('0x2d')],_0x593c8f['query']);_0x4f722c[_0x436c('0x31')]=_[_0x436c('0x30')](_0x593c8f['model'],qs[_0x436c('0x32')](_0x35754e[_0x436c('0x2e')][_0x436c('0x32')]));_0x4f722c[_0x436c('0x31')]=_0x4f722c[_0x436c('0x31')]['length']?_0x4f722c['attributes']:_0x593c8f[_0x436c('0x2d')];if(_0x35754e[_0x436c('0x2e')][_0x436c('0x3f')]){_0x4f722c['include']=[{'all':!![]}];}_0x4f722c=_['merge']({},_0x4f722c,_0x35754e[_0x436c('0x3d')]);return db[_0x436c('0x3e')][_0x436c('0x45')](_0x4f722c)[_0x436c('0x20')](handleEntityNotFound(_0x4645ce,null))[_0x436c('0x20')](respondWithResult(_0x4645ce,null))[_0x436c('0x43')](handleError(_0x4645ce,null));};exports[_0x436c('0x46')]=function(_0x4faba2,_0x51d3e1){return db[_0x436c('0x3e')][_0x436c('0x46')](_0x4faba2['body'],{})[_0x436c('0x20')](function(_0x3461fd){var _0x4bdb35=_0x4faba2[_0x436c('0x47')][_0x436c('0x21')]({'plain':!![]});if(!_0x4bdb35)throw new Error(_0x436c('0x48'));if(_0x4bdb35['role']===_0x436c('0x47')){var _0x13832f=_0x3461fd[_0x436c('0x21')]({'plain':!![]});var _0x364f53='ODBC';return db[_0x436c('0x49')][_0x436c('0x45')]({'where':{'name':_0x364f53,'userProfileId':_0x4bdb35[_0x436c('0x4a')]},'raw':!![]})['then'](function(_0x26bc63){if(_0x26bc63&&_0x26bc63[_0x436c('0x4b')]===0x0){return db[_0x436c('0x23')]['create']({'name':_0x13832f[_0x436c('0x26')],'resourceId':_0x13832f['id'],'type':_0x26bc63[_0x436c('0x26')],'sectionId':_0x26bc63['id']},{})['then'](function(){return _0x3461fd;});}else{return _0x3461fd;}})[_0x436c('0x43')](function(_0x3ffc28){logger[_0x436c('0x24')](_0x436c('0x4c'),_0x3ffc28);throw _0x3ffc28;});}return _0x3461fd;})[_0x436c('0x20')](respondWithResult(_0x51d3e1,0xc9))['catch'](handleError(_0x51d3e1,null));};exports[_0x436c('0x4d')]=function(_0x465316,_0x4b96ad){if(_0x465316[_0x436c('0x4e')]['id']){delete _0x465316['body']['id'];}return db[_0x436c('0x3e')]['find']({'where':{'id':_0x465316[_0x436c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b96ad,null))['then'](saveUpdates(_0x465316['body'],null))[_0x436c('0x20')](respondWithResult(_0x4b96ad,null))['catch'](handleError(_0x4b96ad,null));};exports[_0x436c('0x1f')]=function(_0xc150c6,_0x2b1e40){return db[_0x436c('0x3e')][_0x436c('0x45')]({'where':{'id':_0xc150c6['params']['id']}})[_0x436c('0x20')](handleEntityNotFound(_0x2b1e40,null))[_0x436c('0x20')](removeEntity(_0x2b1e40,null))[_0x436c('0x43')](handleError(_0x2b1e40,null));};exports['test']=function(_0x7d4cf,_0x12c1fc,_0x25b6f6){var _0x204d46;return db['SquareOdbc'][_0x436c('0x45')]({'where':{'id':_0x7d4cf[_0x436c('0x4f')]['id']},'attributes':['id',_0x436c('0x50')]})[_0x436c('0x20')](handleEntityNotFound(_0x12c1fc,null))[_0x436c('0x20')](function(_0x515699){if(_0x515699){var _0x741e63=require('odbc')();_0x741e63[_0x436c('0x51')](_0x515699[_0x436c('0x50')]);_0x741e63['closeSync']();return _0x515699;}})[_0x436c('0x20')](respondWithResult(_0x12c1fc,null))[_0x436c('0x43')](handleError(_0x12c1fc,null));}; \ No newline at end of file +var _0x52d1=['UserProfileSection','userProfileId','autoAssociation','update','params','test','dsn','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','limit','count','set','Content-Range','json','apply','save','destroy','get','UserProfileResource','then','stack','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','catch','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC'];(function(_0x19d3b2,_0x2f4605){var _0x15c88c=function(_0x2ae707){while(--_0x2ae707){_0x19d3b2['push'](_0x19d3b2['shift']());}};_0x15c88c(++_0x2f4605);}(_0x52d1,0x160));var _0x152d=function(_0x16eb8e,_0x544776){_0x16eb8e=_0x16eb8e-0x0;var _0x588db9=_0x52d1[_0x16eb8e];return _0x588db9;};'use strict';var emlformat=require(_0x152d('0x0'));var rimraf=require(_0x152d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x152d('0x2'));var rp=require(_0x152d('0x3'));var moment=require(_0x152d('0x4'));var BPromise=require(_0x152d('0x5'));var Mustache=require('mustache');var util=require(_0x152d('0x6'));var path=require('path');var sox=require(_0x152d('0x7'));var csv=require(_0x152d('0x8'));var ejs=require(_0x152d('0x9'));var fs=require('fs');var fs_extra=require(_0x152d('0xa'));var _=require('lodash');var squel=require(_0x152d('0xb'));var crypto=require(_0x152d('0xc'));var jsforce=require(_0x152d('0xd'));var deskjs=require(_0x152d('0xe'));var toCsv=require(_0x152d('0x8'));var querystring=require(_0x152d('0xf'));var Papa=require(_0x152d('0x10'));var Redis=require('ioredis');var authService=require(_0x152d('0x11'));var qs=require(_0x152d('0x12'));var as=require(_0x152d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x152d('0x14'))(_0x152d('0x15'));var utils=require(_0x152d('0x16'));var config=require(_0x152d('0x17'));var licenseUtil=require(_0x152d('0x18'));var db=require(_0x152d('0x19'))['db'];function respondWithStatusCode(_0x5e3de0,_0x5c4490){_0x5c4490=_0x5c4490||0xcc;return function(_0x536285){if(_0x536285){return _0x5e3de0[_0x152d('0x1a')](_0x5c4490);}return _0x5e3de0[_0x152d('0x1b')](_0x5c4490)[_0x152d('0x1c')]();};}function respondWithResult(_0x3d8224,_0x20452e){_0x20452e=_0x20452e||0xc8;return function(_0x141699){if(_0x141699){return _0x3d8224['status'](_0x20452e)['json'](_0x141699);}};}function respondWithFilteredResult(_0x22973d,_0x1e1c29){return function(_0x2609d6){if(_0x2609d6){var _0x7aa80e=typeof _0x1e1c29[_0x152d('0x1d')]===_0x152d('0x1e')&&typeof _0x1e1c29[_0x152d('0x1f')]===_0x152d('0x1e');var _0x11cdac=_0x2609d6[_0x152d('0x20')];var _0x278df1=_0x7aa80e?0x0:_0x1e1c29[_0x152d('0x1d')];var _0x35b1d2=_0x7aa80e?_0x2609d6[_0x152d('0x20')]:_0x1e1c29[_0x152d('0x1d')]+_0x1e1c29[_0x152d('0x1f')];var _0x458824;if(_0x35b1d2>=_0x11cdac){_0x35b1d2=_0x11cdac;_0x458824=0xc8;}else{_0x458824=0xce;}_0x22973d[_0x152d('0x1b')](_0x458824);return _0x22973d[_0x152d('0x21')](_0x152d('0x22'),_0x278df1+'-'+_0x35b1d2+'/'+_0x11cdac)[_0x152d('0x23')](_0x2609d6);}return null;};}function patchUpdates(_0x2f6290){return function(_0x531c52){try{jsonpatch[_0x152d('0x24')](_0x531c52,_0x2f6290,!![]);}catch(_0xc8878d){return BPromise['reject'](_0xc8878d);}return _0x531c52[_0x152d('0x25')]();};}function saveUpdates(_0x59a413,_0x4b87df){return function(_0x1fe358){if(_0x1fe358){return _0x1fe358['update'](_0x59a413)['then'](function(_0x19015d){return _0x19015d;});}return null;};}function removeEntity(_0x160a5b,_0xad7a69){return function(_0x4d34c1){if(_0x4d34c1){return _0x4d34c1[_0x152d('0x26')]()['then'](function(){var _0x399856=_0x4d34c1[_0x152d('0x27')]({'plain':!![]});var _0x4f9e94='ODBC';return db[_0x152d('0x28')][_0x152d('0x26')]({'where':{'type':_0x4f9e94,'resourceId':_0x399856['id']}})[_0x152d('0x29')](function(){return _0x4d34c1;});})[_0x152d('0x29')](function(){_0x160a5b[_0x152d('0x1b')](0xcc)[_0x152d('0x1c')]();});}};}function handleEntityNotFound(_0xbe4f0b,_0x308718){return function(_0x318ec1){if(!_0x318ec1){_0xbe4f0b[_0x152d('0x1a')](0x194);}return _0x318ec1;};}function handleError(_0x3a2ca3,_0x16e44b){_0x16e44b=_0x16e44b||0x1f4;return function(_0x3536cf){logger['error'](_0x3536cf[_0x152d('0x2a')]);if(_0x3536cf['name']){delete _0x3536cf['name'];}_0x3a2ca3[_0x152d('0x1b')](_0x16e44b)[_0x152d('0x2b')](_0x3536cf);};}exports['index']=function(_0x21d62f,_0xb9b9d){var _0x30c7dd={},_0x4fe060={},_0x1bc395={'count':0x0,'rows':[]};var _0x311fbc=_[_0x152d('0x2c')](db[_0x152d('0x2d')][_0x152d('0x2e')],function(_0x47e202){return{'name':_0x47e202[_0x152d('0x2f')],'type':_0x47e202[_0x152d('0x30')][_0x152d('0x31')]};});_0x4fe060[_0x152d('0x32')]=_[_0x152d('0x2c')](_0x311fbc,'name');_0x4fe060['query']=_[_0x152d('0x33')](_0x21d62f[_0x152d('0x34')]);_0x4fe060[_0x152d('0x35')]=_['intersection'](_0x4fe060[_0x152d('0x32')],_0x4fe060[_0x152d('0x34')]);_0x30c7dd[_0x152d('0x36')]=_[_0x152d('0x37')](_0x4fe060[_0x152d('0x32')],qs[_0x152d('0x38')](_0x21d62f[_0x152d('0x34')][_0x152d('0x38')]));_0x30c7dd[_0x152d('0x36')]=_0x30c7dd['attributes'][_0x152d('0x39')]?_0x30c7dd[_0x152d('0x36')]:_0x4fe060[_0x152d('0x32')];if(!_0x21d62f[_0x152d('0x34')][_0x152d('0x3a')](_0x152d('0x3b'))){_0x30c7dd[_0x152d('0x1f')]=qs[_0x152d('0x1f')](_0x21d62f[_0x152d('0x34')]['limit']);_0x30c7dd['offset']=qs[_0x152d('0x1d')](_0x21d62f[_0x152d('0x34')][_0x152d('0x1d')]);}_0x30c7dd['order']=qs[_0x152d('0x3c')](_0x21d62f[_0x152d('0x34')][_0x152d('0x3c')]);_0x30c7dd[_0x152d('0x3d')]=qs[_0x152d('0x35')](_[_0x152d('0x3e')](_0x21d62f[_0x152d('0x34')],_0x4fe060[_0x152d('0x35')]),_0x311fbc);if(_0x21d62f[_0x152d('0x34')][_0x152d('0x3f')]){_0x30c7dd[_0x152d('0x3d')]=_[_0x152d('0x40')](_0x30c7dd[_0x152d('0x3d')],{'$or':_[_0x152d('0x2c')](_0x311fbc,function(_0x38dbfd){if(_0x38dbfd['type']!==_0x152d('0x41')){var _0x250cd4={};_0x250cd4[_0x38dbfd[_0x152d('0x42')]]={'$like':'%'+_0x21d62f[_0x152d('0x34')][_0x152d('0x3f')]+'%'};return _0x250cd4;}})});}_0x30c7dd=_[_0x152d('0x40')]({},_0x30c7dd,_0x21d62f[_0x152d('0x43')]);var _0x2dd45f={'where':_0x30c7dd['where']};return db[_0x152d('0x2d')]['count'](_0x2dd45f)[_0x152d('0x29')](function(_0x1d7dbc){_0x1bc395[_0x152d('0x20')]=_0x1d7dbc;if(_0x21d62f[_0x152d('0x34')]['includeAll']){_0x30c7dd['include']=[{'all':!![]}];}return db[_0x152d('0x2d')]['findAll'](_0x30c7dd);})[_0x152d('0x29')](function(_0x27ca2f){_0x1bc395['rows']=_0x27ca2f;return _0x1bc395;})['then'](respondWithFilteredResult(_0xb9b9d,_0x30c7dd))[_0x152d('0x44')](handleError(_0xb9b9d,null));};exports[_0x152d('0x45')]=function(_0x19fa9f,_0x21aa66){var _0x1d538f={'raw':!![],'where':{'id':_0x19fa9f['params']['id']}},_0x580910={};_0x580910[_0x152d('0x32')]=_[_0x152d('0x33')](db[_0x152d('0x2d')]['rawAttributes']);_0x580910[_0x152d('0x34')]=_[_0x152d('0x33')](_0x19fa9f[_0x152d('0x34')]);_0x580910[_0x152d('0x35')]=_[_0x152d('0x37')](_0x580910[_0x152d('0x32')],_0x580910['query']);_0x1d538f[_0x152d('0x36')]=_[_0x152d('0x37')](_0x580910['model'],qs[_0x152d('0x38')](_0x19fa9f[_0x152d('0x34')]['fields']));_0x1d538f[_0x152d('0x36')]=_0x1d538f[_0x152d('0x36')]['length']?_0x1d538f[_0x152d('0x36')]:_0x580910[_0x152d('0x32')];if(_0x19fa9f[_0x152d('0x34')][_0x152d('0x46')]){_0x1d538f[_0x152d('0x47')]=[{'all':!![]}];}_0x1d538f=_[_0x152d('0x40')]({},_0x1d538f,_0x19fa9f[_0x152d('0x43')]);return db[_0x152d('0x2d')][_0x152d('0x48')](_0x1d538f)['then'](handleEntityNotFound(_0x21aa66,null))[_0x152d('0x29')](respondWithResult(_0x21aa66,null))[_0x152d('0x44')](handleError(_0x21aa66,null));};exports[_0x152d('0x49')]=function(_0xa87607,_0x2d2e68){return db[_0x152d('0x2d')][_0x152d('0x49')](_0xa87607[_0x152d('0x4a')],{})['then'](function(_0x2ba000){var _0x4c0222=_0xa87607[_0x152d('0x4b')]['get']({'plain':!![]});if(!_0x4c0222)throw new Error(_0x152d('0x4c'));if(_0x4c0222['role']==='user'){var _0x11893a=_0x2ba000[_0x152d('0x27')]({'plain':!![]});var _0x11dbae=_0x152d('0x4d');return db[_0x152d('0x4e')][_0x152d('0x48')]({'where':{'name':_0x11dbae,'userProfileId':_0x4c0222[_0x152d('0x4f')]},'raw':!![]})['then'](function(_0x4512f9){if(_0x4512f9&&_0x4512f9[_0x152d('0x50')]===0x0){return db[_0x152d('0x28')][_0x152d('0x49')]({'name':_0x11893a[_0x152d('0x42')],'resourceId':_0x11893a['id'],'type':_0x4512f9[_0x152d('0x42')],'sectionId':_0x4512f9['id']},{})[_0x152d('0x29')](function(){return _0x2ba000;});}else{return _0x2ba000;}})[_0x152d('0x44')](function(_0x5eb9cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5eb9cd);throw _0x5eb9cd;});}return _0x2ba000;})['then'](respondWithResult(_0x2d2e68,0xc9))[_0x152d('0x44')](handleError(_0x2d2e68,null));};exports[_0x152d('0x51')]=function(_0x3da177,_0x121985){if(_0x3da177['body']['id']){delete _0x3da177[_0x152d('0x4a')]['id'];}return db['SquareOdbc'][_0x152d('0x48')]({'where':{'id':_0x3da177['params']['id']}})['then'](handleEntityNotFound(_0x121985,null))[_0x152d('0x29')](saveUpdates(_0x3da177['body'],null))[_0x152d('0x29')](respondWithResult(_0x121985,null))['catch'](handleError(_0x121985,null));};exports[_0x152d('0x26')]=function(_0x42b696,_0x4cc487){return db[_0x152d('0x2d')][_0x152d('0x48')]({'where':{'id':_0x42b696[_0x152d('0x52')]['id']}})['then'](handleEntityNotFound(_0x4cc487,null))[_0x152d('0x29')](removeEntity(_0x4cc487,null))[_0x152d('0x44')](handleError(_0x4cc487,null));};exports[_0x152d('0x53')]=function(_0x6d6375,_0x159dc1,_0x450c0d){var _0x951ec7;return db['SquareOdbc']['find']({'where':{'id':_0x6d6375['params']['id']},'attributes':['id',_0x152d('0x54')]})[_0x152d('0x29')](handleEntityNotFound(_0x159dc1,null))['then'](function(_0x4325b0){if(_0x4325b0){var _0x262dc8=require('odbc')();_0x262dc8['openSync'](_0x4325b0[_0x152d('0x54')]);_0x262dc8[_0x152d('0x55')]();return _0x4325b0;}})[_0x152d('0x29')](respondWithResult(_0x159dc1,null))[_0x152d('0x44')](handleError(_0x159dc1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3ca235f..b5c081a 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 _0xfb51=['./squareOdbc.attributes','define','square_odbc','util','../../config/logger','api','path','rimraf'];(function(_0xc631b,_0x200733){var _0x2cab97=function(_0x4e704d){while(--_0x4e704d){_0xc631b['push'](_0xc631b['shift']());}};_0x2cab97(++_0x200733);}(_0xfb51,0xc3));var _0x1fb5=function(_0x13f5d1,_0x12e3f7){_0x13f5d1=_0x13f5d1-0x0;var _0x5621f3=_0xfb51[_0x13f5d1];return _0x5621f3;};'use strict';var _=require('lodash');var util=require(_0x1fb5('0x0'));var logger=require(_0x1fb5('0x1'))(_0x1fb5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb5('0x3'));var rimraf=require(_0x1fb5('0x4'));var config=require('../../config/environment');var attributes=require(_0x1fb5('0x5'));module['exports']=function(_0x3b6061,_0x39aca7){return _0x3b6061[_0x1fb5('0x6')]('SquareOdbc',attributes,{'tableName':_0x1fb5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcd4=['rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x127ed7,_0x18c2c5){var _0x17c7bb=function(_0x212045){while(--_0x212045){_0x127ed7['push'](_0x127ed7['shift']());}};_0x17c7bb(++_0x18c2c5);}(_0xdcd4,0x1b3));var _0x4dcd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcd4[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4dcd('0x0'));var util=require(_0x4dcd('0x1'));var logger=require(_0x4dcd('0x2'))(_0x4dcd('0x3'));var moment=require(_0x4dcd('0x4'));var BPromise=require('bluebird');var rp=require(_0x4dcd('0x5'));var fs=require('fs');var path=require(_0x4dcd('0x6'));var rimraf=require(_0x4dcd('0x7'));var config=require(_0x4dcd('0x8'));var attributes=require(_0x4dcd('0x9'));module['exports']=function(_0x28f8f5,_0x23c772){return _0x28f8f5[_0x4dcd('0xa')](_0x4dcd('0xb'),attributes,{'tableName':_0x4dcd('0xc'),'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 0f2438b..06e42d5 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 _0x7073=['request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SquareOdbc','options','where','attributes','include','model','map','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x580ee0,_0x467385){var _0x29ff29=function(_0x3660eb){while(--_0x3660eb){_0x580ee0['push'](_0x580ee0['shift']());}};_0x29ff29(++_0x467385);}(_0x7073,0x194));var _0x3707=function(_0x86f1f,_0x486f2a){_0x86f1f=_0x86f1f-0x0;var _0x53809f=_0x7073[_0x86f1f];return _0x53809f;};'use strict';var _=require(_0x3707('0x0'));var util=require(_0x3707('0x1'));var moment=require(_0x3707('0x2'));var BPromise=require(_0x3707('0x3'));var rs=require(_0x3707('0x4'));var fs=require('fs');var Redis=require(_0x3707('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3707('0x6'));var logger=require(_0x3707('0x7'))('rpc');var config=require(_0x3707('0x8'));var jayson=require(_0x3707('0x9'));var client=jayson[_0x3707('0xa')][_0x3707('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x202947,_0x305da7,_0x5612d4){return new BPromise(function(_0x4a9194,_0x4928bf){return client[_0x3707('0xc')](_0x202947,_0x5612d4)[_0x3707('0xd')](function(_0x34d97b){logger['info'](_0x3707('0xe'),_0x305da7,_0x3707('0xf'));logger[_0x3707('0x10')](_0x3707('0x11'),_0x305da7,_0x3707('0xf'),JSON[_0x3707('0x12')](_0x34d97b));if(_0x34d97b[_0x3707('0x13')]){if(_0x34d97b[_0x3707('0x13')][_0x3707('0x14')]===0x1f4){logger[_0x3707('0x13')](_0x3707('0xe'),_0x305da7,_0x34d97b[_0x3707('0x13')][_0x3707('0x15')]);return _0x4928bf(_0x34d97b[_0x3707('0x13')][_0x3707('0x15')]);}logger[_0x3707('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x305da7,_0x34d97b['error']['message']);return _0x4a9194(_0x34d97b['error'][_0x3707('0x15')]);}else{logger[_0x3707('0x16')](_0x3707('0xe'),_0x305da7,_0x3707('0xf'));_0x4a9194(_0x34d97b['result'][_0x3707('0x15')]);}})[_0x3707('0x17')](function(_0x50eaee){logger[_0x3707('0x13')](_0x3707('0xe'),_0x305da7,_0x50eaee);_0x4928bf(_0x50eaee);});});}exports['ShowSquareOdbc']=function(_0xba4da1){var _0x139e2c=this;return new Promise(function(_0xffd845,_0x36c88b){return db[_0x3707('0x18')]['find']({'raw':_0xba4da1[_0x3707('0x19')]?_0xba4da1[_0x3707('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xba4da1[_0x3707('0x19')]?_0xba4da1['options'][_0x3707('0x1a')]||null:null,'attributes':_0xba4da1[_0x3707('0x19')]?_0xba4da1[_0x3707('0x19')][_0x3707('0x1b')]||null:null,'include':_0xba4da1[_0x3707('0x19')]?_0xba4da1['options'][_0x3707('0x1c')]?_['map'](_0xba4da1[_0x3707('0x19')][_0x3707('0x1c')],function(_0x37c73e){return{'model':db[_0x37c73e[_0x3707('0x1d')]],'as':_0x37c73e['as'],'attributes':_0x37c73e[_0x3707('0x1b')],'include':_0x37c73e[_0x3707('0x1c')]?_[_0x3707('0x1e')](_0x37c73e[_0x3707('0x1c')],function(_0x5304fd){return{'model':db[_0x5304fd[_0x3707('0x1d')]],'as':_0x5304fd['as'],'attributes':_0x5304fd[_0x3707('0x1b')],'include':_0x5304fd[_0x3707('0x1c')]?_[_0x3707('0x1e')](_0x5304fd['include'],function(_0x1ce5b1){return{'model':db[_0x1ce5b1['model']],'as':_0x1ce5b1['as'],'attributes':_0x1ce5b1[_0x3707('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3707('0xd')](function(_0x27f611){logger[_0x3707('0x16')](_0x3707('0x1f'),_0xba4da1);logger[_0x3707('0x10')](_0x3707('0x1f'),_0xba4da1,JSON['stringify'](_0x27f611));_0xffd845(_0x27f611);})['catch'](function(_0x805da7){logger['error'](_0x3707('0x1f'),_0x805da7[_0x3707('0x15')],_0xba4da1);_0x36c88b(_0x139e2c[_0x3707('0x13')](0x1f4,_0x805da7['message']));});});}; \ No newline at end of file +var _0x3d1c=['map','include','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw'];(function(_0x107b26,_0x3560b9){var _0x880238=function(_0x39d358){while(--_0x39d358){_0x107b26['push'](_0x107b26['shift']());}};_0x880238(++_0x3560b9);}(_0x3d1c,0x10d));var _0xc3d1=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x3d1c[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0xc3d1('0x0'));var util=require(_0xc3d1('0x1'));var moment=require(_0xc3d1('0x2'));var BPromise=require(_0xc3d1('0x3'));var rs=require(_0xc3d1('0x4'));var fs=require('fs');var Redis=require(_0xc3d1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc3d1('0x6'));var logger=require(_0xc3d1('0x7'))(_0xc3d1('0x8'));var config=require(_0xc3d1('0x9'));var jayson=require(_0xc3d1('0xa'));var client=jayson['client'][_0xc3d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56c742,_0x44f7a0,_0x566f0e){return new BPromise(function(_0x577bea,_0xcdd3c0){return client[_0xc3d1('0xc')](_0x56c742,_0x566f0e)['then'](function(_0x375832){logger[_0xc3d1('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x44f7a0,_0xc3d1('0xe'));logger[_0xc3d1('0xf')](_0xc3d1('0x10'),_0x44f7a0,'request\x20sent',JSON[_0xc3d1('0x11')](_0x375832));if(_0x375832[_0xc3d1('0x12')]){if(_0x375832[_0xc3d1('0x12')][_0xc3d1('0x13')]===0x1f4){logger[_0xc3d1('0x12')](_0xc3d1('0x14'),_0x44f7a0,_0x375832[_0xc3d1('0x12')][_0xc3d1('0x15')]);return _0xcdd3c0(_0x375832[_0xc3d1('0x12')][_0xc3d1('0x15')]);}logger[_0xc3d1('0x12')](_0xc3d1('0x14'),_0x44f7a0,_0x375832['error']['message']);return _0x577bea(_0x375832['error'][_0xc3d1('0x15')]);}else{logger['info'](_0xc3d1('0x14'),_0x44f7a0,_0xc3d1('0xe'));_0x577bea(_0x375832[_0xc3d1('0x16')][_0xc3d1('0x15')]);}})[_0xc3d1('0x17')](function(_0x296eb0){logger[_0xc3d1('0x12')](_0xc3d1('0x14'),_0x44f7a0,_0x296eb0);_0xcdd3c0(_0x296eb0);});});}exports[_0xc3d1('0x18')]=function(_0x13608b){var _0x42842b=this;return new Promise(function(_0x4e5988,_0x28a9dc){return db[_0xc3d1('0x19')]['find']({'raw':_0x13608b[_0xc3d1('0x1a')]?_0x13608b[_0xc3d1('0x1a')][_0xc3d1('0x1b')]===undefined?!![]:![]:!![],'where':_0x13608b[_0xc3d1('0x1a')]?_0x13608b[_0xc3d1('0x1a')]['where']||null:null,'attributes':_0x13608b['options']?_0x13608b[_0xc3d1('0x1a')]['attributes']||null:null,'include':_0x13608b[_0xc3d1('0x1a')]?_0x13608b['options']['include']?_[_0xc3d1('0x1c')](_0x13608b['options'][_0xc3d1('0x1d')],function(_0x5969b2){return{'model':db[_0x5969b2[_0xc3d1('0x1e')]],'as':_0x5969b2['as'],'attributes':_0x5969b2['attributes'],'include':_0x5969b2[_0xc3d1('0x1d')]?_[_0xc3d1('0x1c')](_0x5969b2[_0xc3d1('0x1d')],function(_0x2d16ac){return{'model':db[_0x2d16ac[_0xc3d1('0x1e')]],'as':_0x2d16ac['as'],'attributes':_0x2d16ac['attributes'],'include':_0x2d16ac[_0xc3d1('0x1d')]?_[_0xc3d1('0x1c')](_0x2d16ac[_0xc3d1('0x1d')],function(_0x3951f5){return{'model':db[_0x3951f5[_0xc3d1('0x1e')]],'as':_0x3951f5['as'],'attributes':_0x3951f5[_0xc3d1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc3d1('0x20')](function(_0x23a665){logger[_0xc3d1('0xd')](_0xc3d1('0x18'),_0x13608b);logger['debug'](_0xc3d1('0x18'),_0x13608b,JSON['stringify'](_0x23a665));_0x4e5988(_0x23a665);})['catch'](function(_0x4de8db){logger[_0xc3d1('0x12')]('ShowSquareOdbc',_0x4de8db[_0xc3d1('0x15')],_0x13608b);_0x28a9dc(_0x42842b['error'](0x1f4,_0x4de8db[_0xc3d1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3902e3b..626d5c5 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 _0xe14b=['isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0xe14b,0x14c));var _0xbe14=function(_0x2edcfc,_0x5f465a){_0x2edcfc=_0x2edcfc-0x0;var _0xfd5dc3=_0xe14b[_0x2edcfc];return _0xfd5dc3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbe14('0x1'));var express=require(_0xbe14('0x2'));var router=express['Router']();var fs_extra=require(_0xbe14('0x3'));var auth=require(_0xbe14('0x4'));var interaction=require(_0xbe14('0x5'));var config=require(_0xbe14('0x6'));var controller=require('./squareProject.controller');router[_0xbe14('0x7')]('/',auth[_0xbe14('0x8')](),controller[_0xbe14('0x9')]);router[_0xbe14('0x7')](_0xbe14('0xa'),auth['isAuthenticated'](),controller[_0xbe14('0xb')]);router['post']('/',auth[_0xbe14('0x8')](),controller[_0xbe14('0xc')]);router['put'](_0xbe14('0xa'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0xe')](_0xbe14('0xa'),auth['isAuthenticated'](),controller[_0xbe14('0xf')]);module[_0xbe14('0x10')]=router; \ No newline at end of file +var _0x2b30=['isAuthenticated','index','show','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareProject.controller','get'];(function(_0x72d62f,_0x5951a6){var _0x1b6d3c=function(_0x2586f5){while(--_0x2586f5){_0x72d62f['push'](_0x72d62f['shift']());}};_0x1b6d3c(++_0x5951a6);}(_0x2b30,0x1d1));var _0x02b3=function(_0x46e251,_0x328b55){_0x46e251=_0x46e251-0x0;var _0x350647=_0x2b30[_0x46e251];return _0x350647;};'use strict';var multer=require(_0x02b3('0x0'));var util=require(_0x02b3('0x1'));var path=require(_0x02b3('0x2'));var timeout=require(_0x02b3('0x3'));var express=require(_0x02b3('0x4'));var router=express[_0x02b3('0x5')]();var fs_extra=require(_0x02b3('0x6'));var auth=require(_0x02b3('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x02b3('0x8'));router[_0x02b3('0x9')]('/',auth[_0x02b3('0xa')](),controller[_0x02b3('0xb')]);router[_0x02b3('0x9')]('/:id',auth[_0x02b3('0xa')](),controller[_0x02b3('0xc')]);router['post']('/',auth[_0x02b3('0xa')](),controller[_0x02b3('0xd')]);router[_0x02b3('0xe')](_0x02b3('0xf'),auth[_0x02b3('0xa')](),controller[_0x02b3('0x10')]);router['delete'](_0x02b3('0xf'),auth[_0x02b3('0xa')](),controller[_0x02b3('0x11')]);module[_0x02b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index af904b6..b65b0ef 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 _0xb606=['DATE','exports','STRING','TEXT','BLOB','long','preproduction','getDataValue','production','utf8'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb606,0xfb));var _0x6b60=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0xb606[_0x541260];return _0x1dd2b5;};'use strict';var Sequelize=require('sequelize');module[_0x6b60('0x0')]={'name':{'type':Sequelize[_0x6b60('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6b60('0x1')]},'notes':{'type':Sequelize[_0x6b60('0x2')]},'preproduction':{'type':Sequelize[_0x6b60('0x3')](_0x6b60('0x4')),'get':function(){if(this['getDataValue'](_0x6b60('0x5'))){return this[_0x6b60('0x6')](_0x6b60('0x5'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x6b60('0x3')](_0x6b60('0x4')),'get':function(){if(this[_0x6b60('0x6')](_0x6b60('0x7'))){return this[_0x6b60('0x6')](_0x6b60('0x7'))['toString'](_0x6b60('0x8'));}}},'savedAt':{'type':Sequelize[_0x6b60('0x9')]},'publishedAt':{'type':Sequelize[_0x6b60('0x9')]}}; \ No newline at end of file +var _0x1544=['STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','name'];(function(_0x51085c,_0x50f414){var _0x38528d=function(_0x4293fd){while(--_0x4293fd){_0x51085c['push'](_0x51085c['shift']());}};_0x38528d(++_0x50f414);}(_0x1544,0x6a));var _0x4154=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x1544[_0x324496];return _0x899545;};'use strict';var Sequelize=require(_0x4154('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4154('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x4154('0x2')]},'notes':{'type':Sequelize[_0x4154('0x3')]},'preproduction':{'type':Sequelize[_0x4154('0x4')](_0x4154('0x5')),'get':function(){if(this[_0x4154('0x6')](_0x4154('0x7'))){return this['getDataValue'](_0x4154('0x7'))[_0x4154('0x8')](_0x4154('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x4154('0x5')),'get':function(){if(this[_0x4154('0x6')](_0x4154('0xa'))){return this['getDataValue'](_0x4154('0xa'))[_0x4154('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x4154('0xb')]},'publishedAt':{'type':Sequelize[_0x4154('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2a39edc..60f0c68 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 _0x104a=['keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','rows','include','merge','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','agi','production','lodash','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','UserProfileResource','publish','stringify','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','key','model','map','query'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x104a,0x130));var _0xa104=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x104a[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0xa104('0x0'));var Redis=require('ioredis');var qs=require(_0xa104('0x1'));var logger=require('../../config/logger')(_0xa104('0x2'));var config=require(_0xa104('0x3'));var db=require('../../mysqldb')['db'];config[_0xa104('0x4')]=_[_0xa104('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa104('0x6'))(new Redis(config['redis']));require(_0xa104('0x7'))[_0xa104('0x8')](socket);function respondWithResult(_0x2732bf,_0x523829){_0x523829=_0x523829||0xc8;return function(_0x2b872d){if(_0x2b872d){return _0x2732bf[_0xa104('0x9')](_0x523829)[_0xa104('0xa')](_0x2b872d);}};}function respondWithFilteredResult(_0x144b18,_0x156167){return function(_0x414c0f){if(_0x414c0f){var _0x2b7a74=typeof _0x156167[_0xa104('0xb')]==='undefined'&&typeof _0x156167[_0xa104('0xc')]===_0xa104('0xd');var _0x3eff9d=_0x414c0f['count'];var _0x1fd5f7=_0x2b7a74?0x0:_0x156167[_0xa104('0xb')];var _0x19018e=_0x2b7a74?_0x414c0f[_0xa104('0xe')]:_0x156167[_0xa104('0xb')]+_0x156167['limit'];var _0x25f2ab;if(_0x19018e>=_0x3eff9d){_0x19018e=_0x3eff9d;_0x25f2ab=0xc8;}else{_0x25f2ab=0xce;}_0x144b18[_0xa104('0x9')](_0x25f2ab);return _0x144b18[_0xa104('0xf')](_0xa104('0x10'),_0x1fd5f7+'-'+_0x19018e+'/'+_0x3eff9d)[_0xa104('0xa')](_0x414c0f);}return null;};}function saveUpdates(_0x283386){return function(_0x2b807b){if(_0x2b807b){return _0x2b807b['update'](_0x283386)['then'](function(_0x5369d3){return _0x5369d3;});}return null;};}function removeEntity(_0x3ba6ee){return function(_0x2f4c6c){if(_0x2f4c6c){return _0x2f4c6c[_0xa104('0x11')]()[_0xa104('0x12')](function(){var _0x343cf4=_0x2f4c6c[_0xa104('0x13')]({'plain':!![]});var _0x597b60='SquareProjects';return db[_0xa104('0x14')][_0xa104('0x11')]({'where':{'type':_0x597b60,'resourceId':_0x343cf4['id']}})[_0xa104('0x12')](function(){return _0x2f4c6c;});})[_0xa104('0x12')](function(){var _0x6ded8d=new Redis(config['redis']);_0x6ded8d[_0xa104('0x15')]('agi',JSON[_0xa104('0x16')]({'id':_0x2f4c6c['id'],'deleted':!![]}));})['then'](function(){_0x3ba6ee[_0xa104('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd94920){return function(_0xc0105a){if(!_0xc0105a){_0xd94920[_0xa104('0x17')](0x194);}return _0xc0105a;};}function handleError(_0x5c566c,_0x1298f0){_0x1298f0=_0x1298f0||0x1f4;return function(_0x423886){logger[_0xa104('0x18')](_0x423886[_0xa104('0x19')]);if(_0x423886[_0xa104('0x1a')]){delete _0x423886[_0xa104('0x1a')];}_0x5c566c['status'](_0x1298f0)[_0xa104('0x1b')](_0x423886);};}exports[_0xa104('0x1c')]=function(_0x3e74dc,_0x566fc9){var _0x110683={},_0x3f68ae={},_0x163450={'count':0x0,'rows':[]};var _0x3cc203=_['map'](db[_0xa104('0x1d')][_0xa104('0x1e')],function(_0x19c7b6){return{'name':_0x19c7b6[_0xa104('0x1f')],'type':_0x19c7b6['type'][_0xa104('0x20')]};});_0x3f68ae[_0xa104('0x21')]=_[_0xa104('0x22')](_0x3cc203,_0xa104('0x1a'));_0x3f68ae[_0xa104('0x23')]=_[_0xa104('0x24')](_0x3e74dc[_0xa104('0x23')]);_0x3f68ae['filters']=_[_0xa104('0x25')](_0x3f68ae[_0xa104('0x21')],_0x3f68ae[_0xa104('0x23')]);_0x110683[_0xa104('0x26')]=_[_0xa104('0x25')](_0x3f68ae[_0xa104('0x21')],qs[_0xa104('0x27')](_0x3e74dc[_0xa104('0x23')][_0xa104('0x27')]));_0x110683[_0xa104('0x26')]=_0x110683[_0xa104('0x26')][_0xa104('0x28')]?_0x110683['attributes']:_0x3f68ae[_0xa104('0x21')];if(!_0x3e74dc['query']['hasOwnProperty'](_0xa104('0x29'))){_0x110683[_0xa104('0xc')]=qs['limit'](_0x3e74dc['query'][_0xa104('0xc')]);_0x110683[_0xa104('0xb')]=qs[_0xa104('0xb')](_0x3e74dc[_0xa104('0x23')][_0xa104('0xb')]);}_0x110683[_0xa104('0x2a')]=qs[_0xa104('0x2b')](_0x3e74dc[_0xa104('0x23')][_0xa104('0x2b')]);_0x110683['where']=qs[_0xa104('0x2c')](_[_0xa104('0x2d')](_0x3e74dc['query'],_0x3f68ae[_0xa104('0x2c')]),_0x3cc203);if(_0x3e74dc[_0xa104('0x23')][_0xa104('0x2e')]){_0x110683[_0xa104('0x2f')]=_['merge'](_0x110683[_0xa104('0x2f')],{'$or':_['map'](_0x3cc203,function(_0x44d9de){if(_0x44d9de[_0xa104('0x30')]!==_0xa104('0x31')){var _0x5eb7cb={};_0x5eb7cb[_0x44d9de['name']]={'$like':'%'+_0x3e74dc[_0xa104('0x23')]['filter']+'%'};return _0x5eb7cb;}})});}_0x110683=_['merge']({},_0x110683,_0x3e74dc[_0xa104('0x32')]);var _0x448920={'where':_0x110683[_0xa104('0x2f')]};return db['SquareProject'][_0xa104('0xe')](_0x448920)[_0xa104('0x12')](function(_0xd464b1){_0x163450[_0xa104('0xe')]=_0xd464b1;if(_0x3e74dc[_0xa104('0x23')][_0xa104('0x33')]){_0x110683['include']=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x110683);})[_0xa104('0x12')](function(_0x7a7b92){_0x163450[_0xa104('0x34')]=_0x7a7b92;return _0x163450;})[_0xa104('0x12')](respondWithFilteredResult(_0x566fc9,_0x110683))['catch'](handleError(_0x566fc9,null));};exports['show']=function(_0x2aa408,_0x407105){var _0x1cf6fb={'raw':![],'where':{'id':_0x2aa408['params']['id']}},_0x350fa2={};_0x350fa2[_0xa104('0x21')]=_[_0xa104('0x24')](db[_0xa104('0x1d')][_0xa104('0x1e')]);_0x350fa2[_0xa104('0x23')]=_['keys'](_0x2aa408['query']);_0x350fa2['filters']=_['intersection'](_0x350fa2[_0xa104('0x21')],_0x350fa2[_0xa104('0x23')]);_0x1cf6fb[_0xa104('0x26')]=_[_0xa104('0x25')](_0x350fa2[_0xa104('0x21')],qs[_0xa104('0x27')](_0x2aa408['query'][_0xa104('0x27')]));_0x1cf6fb[_0xa104('0x26')]=_0x1cf6fb[_0xa104('0x26')][_0xa104('0x28')]?_0x1cf6fb['attributes']:_0x350fa2[_0xa104('0x21')];if(_0x2aa408[_0xa104('0x23')]['includeAll']){_0x1cf6fb[_0xa104('0x35')]=[{'all':!![]}];}_0x1cf6fb=_[_0xa104('0x36')]({},_0x1cf6fb,_0x2aa408[_0xa104('0x32')]);return db['SquareProject'][_0xa104('0x37')](_0x1cf6fb)['then'](handleEntityNotFound(_0x407105,null))['then'](respondWithResult(_0x407105,null))[_0xa104('0x38')](handleError(_0x407105,null));};exports[_0xa104('0x39')]=function(_0x4c78e6,_0x3618b5){return db[_0xa104('0x1d')][_0xa104('0x39')](_0x4c78e6[_0xa104('0x3a')],{})[_0xa104('0x12')](function(_0x177c3f){var _0x219ab9=_0x4c78e6[_0xa104('0x3b')][_0xa104('0x13')]({'plain':!![]});if(!_0x219ab9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219ab9[_0xa104('0x3c')]===_0xa104('0x3b')){var _0x36adec=_0x177c3f[_0xa104('0x13')]({'plain':!![]});var _0x2057a9='SquareProjects';return db[_0xa104('0x3d')]['find']({'where':{'name':_0x2057a9,'userProfileId':_0x219ab9[_0xa104('0x3e')]},'raw':!![]})[_0xa104('0x12')](function(_0x7ea273){if(_0x7ea273&&_0x7ea273[_0xa104('0x3f')]===0x0){return db[_0xa104('0x14')][_0xa104('0x39')]({'name':_0x36adec['name'],'resourceId':_0x36adec['id'],'type':_0x7ea273[_0xa104('0x1a')],'sectionId':_0x7ea273['id']},{})[_0xa104('0x12')](function(){return _0x177c3f;});}else{return _0x177c3f;}})['catch'](function(_0xd15c67){logger['error'](_0xa104('0x40'),_0xd15c67);throw _0xd15c67;});}return _0x177c3f;})[_0xa104('0x12')](respondWithResult(_0x3618b5,0xc9))[_0xa104('0x38')](handleError(_0x3618b5,null));};exports['update']=function(_0x42718a,_0x334871){if(_0x42718a['body']['id']){delete _0x42718a[_0xa104('0x3a')]['id'];}return db['SquareProject'][_0xa104('0x37')]({'where':{'id':_0x42718a[_0xa104('0x41')]['id']}})[_0xa104('0x12')](handleEntityNotFound(_0x334871,null))[_0xa104('0x12')](saveUpdates(_0x42718a[_0xa104('0x3a')],null))['then'](function(_0x5dc524){if(!_0x5dc524)return;var _0x47cd1d=_0x5dc524[_0xa104('0x13')]({'plain':!![]});return _0x47cd1d;})[_0xa104('0x12')](function(_0x4e4cb7){var _0x5d5ea6=new Redis(config[_0xa104('0x4')]);_0x5d5ea6[_0xa104('0x15')](_0xa104('0x42'),JSON[_0xa104('0x16')](_[_0xa104('0x2d')](_0x4e4cb7,['id',_0xa104('0x1a'),_0xa104('0x43')])));return _0x4e4cb7;})['then'](respondWithResult(_0x334871,null))[_0xa104('0x38')](handleError(_0x334871,null));};exports[_0xa104('0x11')]=function(_0x219084,_0x3f68c6){return db[_0xa104('0x1d')][_0xa104('0x37')]({'where':{'id':_0x219084[_0xa104('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f68c6,null))[_0xa104('0x12')](removeEntity(_0x3f68c6,null))['catch'](handleError(_0x3f68c6,null));}; \ No newline at end of file +var _0x2725=['pick','merge','filter','SquareProject','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','options','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','SquareProjects','UserProfileResource','then','agi','stringify','end','sendStatus','error','name','status','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x2725,0xa1));var _0x5272=function(_0x10e840,_0x5b3935){_0x10e840=_0x10e840-0x0;var _0x405caa=_0x2725[_0x10e840];return _0x405caa;};'use strict';var _=require(_0x5272('0x0'));var Redis=require(_0x5272('0x1'));var qs=require(_0x5272('0x2'));var logger=require(_0x5272('0x3'))(_0x5272('0x4'));var config=require(_0x5272('0x5'));var db=require('../../mysqldb')['db'];config[_0x5272('0x6')]=_[_0x5272('0x7')](config['redis'],{'host':_0x5272('0x8'),'port':0x18eb});var socket=require(_0x5272('0x9'))(new Redis(config['redis']));require(_0x5272('0xa'))[_0x5272('0xb')](socket);function respondWithResult(_0x5c1b33,_0x4ba392){_0x4ba392=_0x4ba392||0xc8;return function(_0x4c129a){if(_0x4c129a){return _0x5c1b33['status'](_0x4ba392)[_0x5272('0xc')](_0x4c129a);}};}function respondWithFilteredResult(_0x3d3811,_0x41a63d){return function(_0x4dbe77){if(_0x4dbe77){var _0x2b2124=typeof _0x41a63d[_0x5272('0xd')]===_0x5272('0xe')&&typeof _0x41a63d[_0x5272('0xf')]===_0x5272('0xe');var _0x5c8cfe=_0x4dbe77[_0x5272('0x10')];var _0x2be845=_0x2b2124?0x0:_0x41a63d[_0x5272('0xd')];var _0x1ed294=_0x2b2124?_0x4dbe77['count']:_0x41a63d[_0x5272('0xd')]+_0x41a63d[_0x5272('0xf')];var _0x580651;if(_0x1ed294>=_0x5c8cfe){_0x1ed294=_0x5c8cfe;_0x580651=0xc8;}else{_0x580651=0xce;}_0x3d3811['status'](_0x580651);return _0x3d3811[_0x5272('0x11')](_0x5272('0x12'),_0x2be845+'-'+_0x1ed294+'/'+_0x5c8cfe)[_0x5272('0xc')](_0x4dbe77);}return null;};}function saveUpdates(_0x2efc60){return function(_0x13034d){if(_0x13034d){return _0x13034d[_0x5272('0x13')](_0x2efc60)['then'](function(_0x456b2d){return _0x456b2d;});}return null;};}function removeEntity(_0x3397ad){return function(_0x2b3e5f){if(_0x2b3e5f){return _0x2b3e5f[_0x5272('0x14')]()['then'](function(){var _0x5dcc27=_0x2b3e5f[_0x5272('0x15')]({'plain':!![]});var _0x4f2b56=_0x5272('0x16');return db[_0x5272('0x17')]['destroy']({'where':{'type':_0x4f2b56,'resourceId':_0x5dcc27['id']}})[_0x5272('0x18')](function(){return _0x2b3e5f;});})['then'](function(){var _0x5026ab=new Redis(config[_0x5272('0x6')]);_0x5026ab['publish'](_0x5272('0x19'),JSON[_0x5272('0x1a')]({'id':_0x2b3e5f['id'],'deleted':!![]}));})[_0x5272('0x18')](function(){_0x3397ad['status'](0xcc)[_0x5272('0x1b')]();});}};}function handleEntityNotFound(_0x47feac){return function(_0x199e4a){if(!_0x199e4a){_0x47feac[_0x5272('0x1c')](0x194);}return _0x199e4a;};}function handleError(_0xf9eec7,_0x2a50d5){_0x2a50d5=_0x2a50d5||0x1f4;return function(_0x4815c6){logger[_0x5272('0x1d')](_0x4815c6['stack']);if(_0x4815c6[_0x5272('0x1e')]){delete _0x4815c6[_0x5272('0x1e')];}_0xf9eec7[_0x5272('0x1f')](_0x2a50d5)['send'](_0x4815c6);};}exports[_0x5272('0x20')]=function(_0x5dcbc5,_0x524f37){var _0x1b649d={},_0x3c59aa={},_0x3c0a10={'count':0x0,'rows':[]};var _0x42a31a=_[_0x5272('0x21')](db['SquareProject']['rawAttributes'],function(_0x3c3561){return{'name':_0x3c3561[_0x5272('0x22')],'type':_0x3c3561[_0x5272('0x23')][_0x5272('0x24')]};});_0x3c59aa[_0x5272('0x25')]=_[_0x5272('0x21')](_0x42a31a,_0x5272('0x1e'));_0x3c59aa[_0x5272('0x26')]=_['keys'](_0x5dcbc5['query']);_0x3c59aa[_0x5272('0x27')]=_[_0x5272('0x28')](_0x3c59aa['model'],_0x3c59aa[_0x5272('0x26')]);_0x1b649d[_0x5272('0x29')]=_[_0x5272('0x28')](_0x3c59aa[_0x5272('0x25')],qs['fields'](_0x5dcbc5[_0x5272('0x26')][_0x5272('0x2a')]));_0x1b649d['attributes']=_0x1b649d[_0x5272('0x29')]['length']?_0x1b649d[_0x5272('0x29')]:_0x3c59aa[_0x5272('0x25')];if(!_0x5dcbc5[_0x5272('0x26')]['hasOwnProperty'](_0x5272('0x2b'))){_0x1b649d[_0x5272('0xf')]=qs[_0x5272('0xf')](_0x5dcbc5['query'][_0x5272('0xf')]);_0x1b649d[_0x5272('0xd')]=qs[_0x5272('0xd')](_0x5dcbc5[_0x5272('0x26')][_0x5272('0xd')]);}_0x1b649d['order']=qs[_0x5272('0x2c')](_0x5dcbc5[_0x5272('0x26')][_0x5272('0x2c')]);_0x1b649d[_0x5272('0x2d')]=qs[_0x5272('0x27')](_[_0x5272('0x2e')](_0x5dcbc5['query'],_0x3c59aa[_0x5272('0x27')]),_0x42a31a);if(_0x5dcbc5['query']['filter']){_0x1b649d[_0x5272('0x2d')]=_[_0x5272('0x2f')](_0x1b649d[_0x5272('0x2d')],{'$or':_[_0x5272('0x21')](_0x42a31a,function(_0x5c0af4){if(_0x5c0af4[_0x5272('0x23')]!=='VIRTUAL'){var _0x346338={};_0x346338[_0x5c0af4[_0x5272('0x1e')]]={'$like':'%'+_0x5dcbc5[_0x5272('0x26')][_0x5272('0x30')]+'%'};return _0x346338;}})});}_0x1b649d=_[_0x5272('0x2f')]({},_0x1b649d,_0x5dcbc5['options']);var _0x3f1cef={'where':_0x1b649d['where']};return db[_0x5272('0x31')][_0x5272('0x10')](_0x3f1cef)[_0x5272('0x18')](function(_0x22c157){_0x3c0a10[_0x5272('0x10')]=_0x22c157;if(_0x5dcbc5[_0x5272('0x26')][_0x5272('0x32')]){_0x1b649d[_0x5272('0x33')]=[{'all':!![]}];}return db[_0x5272('0x31')][_0x5272('0x34')](_0x1b649d);})[_0x5272('0x18')](function(_0x26654e){_0x3c0a10[_0x5272('0x35')]=_0x26654e;return _0x3c0a10;})['then'](respondWithFilteredResult(_0x524f37,_0x1b649d))[_0x5272('0x36')](handleError(_0x524f37,null));};exports[_0x5272('0x37')]=function(_0x195b44,_0x1f14f3){var _0x469ffd={'raw':![],'where':{'id':_0x195b44[_0x5272('0x38')]['id']}},_0x4262b1={};_0x4262b1['model']=_['keys'](db['SquareProject'][_0x5272('0x39')]);_0x4262b1[_0x5272('0x26')]=_[_0x5272('0x3a')](_0x195b44[_0x5272('0x26')]);_0x4262b1[_0x5272('0x27')]=_['intersection'](_0x4262b1[_0x5272('0x25')],_0x4262b1[_0x5272('0x26')]);_0x469ffd[_0x5272('0x29')]=_[_0x5272('0x28')](_0x4262b1[_0x5272('0x25')],qs[_0x5272('0x2a')](_0x195b44[_0x5272('0x26')][_0x5272('0x2a')]));_0x469ffd[_0x5272('0x29')]=_0x469ffd[_0x5272('0x29')][_0x5272('0x3b')]?_0x469ffd['attributes']:_0x4262b1[_0x5272('0x25')];if(_0x195b44['query'][_0x5272('0x32')]){_0x469ffd[_0x5272('0x33')]=[{'all':!![]}];}_0x469ffd=_[_0x5272('0x2f')]({},_0x469ffd,_0x195b44[_0x5272('0x3c')]);return db[_0x5272('0x31')][_0x5272('0x3d')](_0x469ffd)[_0x5272('0x18')](handleEntityNotFound(_0x1f14f3,null))[_0x5272('0x18')](respondWithResult(_0x1f14f3,null))[_0x5272('0x36')](handleError(_0x1f14f3,null));};exports[_0x5272('0x3e')]=function(_0x5b53b7,_0x1d24f3){return db[_0x5272('0x31')][_0x5272('0x3e')](_0x5b53b7[_0x5272('0x3f')],{})[_0x5272('0x18')](function(_0x4c834d){var _0x150a50=_0x5b53b7[_0x5272('0x40')][_0x5272('0x15')]({'plain':!![]});if(!_0x150a50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x150a50[_0x5272('0x41')]===_0x5272('0x40')){var _0x35b6b9=_0x4c834d['get']({'plain':!![]});var _0x30566a=_0x5272('0x16');return db['UserProfileSection'][_0x5272('0x3d')]({'where':{'name':_0x30566a,'userProfileId':_0x150a50[_0x5272('0x42')]},'raw':!![]})['then'](function(_0x4a74d1){if(_0x4a74d1&&_0x4a74d1['autoAssociation']===0x0){return db[_0x5272('0x17')][_0x5272('0x3e')]({'name':_0x35b6b9[_0x5272('0x1e')],'resourceId':_0x35b6b9['id'],'type':_0x4a74d1[_0x5272('0x1e')],'sectionId':_0x4a74d1['id']},{})[_0x5272('0x18')](function(){return _0x4c834d;});}else{return _0x4c834d;}})['catch'](function(_0x43c3a1){logger[_0x5272('0x1d')](_0x5272('0x43'),_0x43c3a1);throw _0x43c3a1;});}return _0x4c834d;})[_0x5272('0x18')](respondWithResult(_0x1d24f3,0xc9))[_0x5272('0x36')](handleError(_0x1d24f3,null));};exports['update']=function(_0x391673,_0x19d9e8){if(_0x391673['body']['id']){delete _0x391673[_0x5272('0x3f')]['id'];}return db[_0x5272('0x31')][_0x5272('0x3d')]({'where':{'id':_0x391673[_0x5272('0x38')]['id']}})[_0x5272('0x18')](handleEntityNotFound(_0x19d9e8,null))[_0x5272('0x18')](saveUpdates(_0x391673[_0x5272('0x3f')],null))['then'](function(_0xa45d4f){if(!_0xa45d4f)return;var _0x513bfd=_0xa45d4f[_0x5272('0x15')]({'plain':!![]});return _0x513bfd;})[_0x5272('0x18')](function(_0xf4babc){var _0x3a3d2d=new Redis(config['redis']);_0x3a3d2d[_0x5272('0x44')]('agi',JSON[_0x5272('0x1a')](_[_0x5272('0x2e')](_0xf4babc,['id','name','production'])));return _0xf4babc;})[_0x5272('0x18')](respondWithResult(_0x19d9e8,null))[_0x5272('0x36')](handleError(_0x19d9e8,null));};exports['destroy']=function(_0xdf52a,_0x1528f9){return db[_0x5272('0x31')][_0x5272('0x3d')]({'where':{'id':_0xdf52a[_0x5272('0x38')]['id']}})[_0x5272('0x18')](handleEntityNotFound(_0x1528f9,null))['then'](removeEntity(_0x1528f9,null))[_0x5272('0x36')](handleError(_0x1528f9,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 222a8ab..4607b65 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 _0x6431=['hook','exports','events','SquareProject','setMaxListeners','save','update','emit'];(function(_0x4c8dd1,_0x12b118){var _0x23f5a0=function(_0x2187b8){while(--_0x2187b8){_0x4c8dd1['push'](_0x4c8dd1['shift']());}};_0x23f5a0(++_0x12b118);}(_0x6431,0x12a));var _0x1643=function(_0x2e4434,_0x3d027a){_0x2e4434=_0x2e4434-0x0;var _0x37fdf3=_0x6431[_0x2e4434];return _0x37fdf3;};'use strict';var EventEmitter=require(_0x1643('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x1643('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1643('0x2')](0x0);var events={'afterCreate':_0x1643('0x3'),'afterUpdate':_0x1643('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c0d65){return function(_0x7989d0,_0x40ab06,_0x49a6f7){SquareProjectEvents[_0x1643('0x5')](_0x2c0d65+':'+_0x7989d0['id'],_0x7989d0);SquareProjectEvents['emit'](_0x2c0d65,_0x7989d0);_0x49a6f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x1643('0x6')](e,emitEvent(event));}}module[_0x1643('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x81b8=['emit','hasOwnProperty','hook','events','SquareProject','setMaxListeners','save','update'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x81b8,0xcb));var _0x881b=function(_0x3c3da1,_0x4ea92b){_0x3c3da1=_0x3c3da1-0x0;var _0x2dab44=_0x81b8[_0x3c3da1];return _0x2dab44;};'use strict';var EventEmitter=require(_0x881b('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x881b('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x881b('0x2')](0x0);var events={'afterCreate':_0x881b('0x3'),'afterUpdate':_0x881b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x551fc0){return function(_0x37d52f,_0x2169b6,_0x585049){SquareProjectEvents[_0x881b('0x5')](_0x551fc0+':'+_0x37d52f['id'],_0x37d52f);SquareProjectEvents[_0x881b('0x5')](_0x551fc0,_0x37d52f);_0x585049(null);};}for(var e in events){if(events[_0x881b('0x6')](e)){var event=events[e];SquareProject[_0x881b('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index cf84fa0..d717964 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 _0xf9c9=['define','changed','savedAt','format','production','publishedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x2187de,_0x5399c1){var _0x57f95c=function(_0x3d4d2b){while(--_0x3d4d2b){_0x2187de['push'](_0x2187de['shift']());}};_0x57f95c(++_0x5399c1);}(_0xf9c9,0x18d));var _0x9f9c=function(_0x25bbd6,_0x18f6d3){_0x25bbd6=_0x25bbd6-0x0;var _0x3a4c78=_0xf9c9[_0x25bbd6];return _0x3a4c78;};'use strict';var _=require('lodash');var util=require(_0x9f9c('0x0'));var logger=require(_0x9f9c('0x1'))(_0x9f9c('0x2'));var moment=require(_0x9f9c('0x3'));var BPromise=require(_0x9f9c('0x4'));var rp=require(_0x9f9c('0x5'));var fs=require('fs');var path=require(_0x9f9c('0x6'));var rimraf=require(_0x9f9c('0x7'));var config=require(_0x9f9c('0x8'));var attributes=require(_0x9f9c('0x9'));module[_0x9f9c('0xa')]=function(_0x47149e,_0x253da7){return _0x47149e[_0x9f9c('0xb')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1504ec,_0x4bd7b9,_0xaf15c9){if(_0x1504ec[_0x9f9c('0xc')]('preproduction')){_0x1504ec[_0x9f9c('0xd')]=moment()[_0x9f9c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1504ec['changed'](_0x9f9c('0xf'))){_0x1504ec[_0x9f9c('0x10')]=moment()[_0x9f9c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xaf15c9(null,_0x1504ec);}}});}; \ No newline at end of file +var _0x3a45=['../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','api','request-promise','path','rimraf'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x3a45,0x127));var _0x53a4=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x3a45[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x53a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x53a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x53a4('0x2'));var fs=require('fs');var path=require(_0x53a4('0x3'));var rimraf=require(_0x53a4('0x4'));var config=require(_0x53a4('0x5'));var attributes=require('./squareProject.attributes');module[_0x53a4('0x6')]=function(_0x5b3bed,_0x5b42aa){return _0x5b3bed[_0x53a4('0x7')](_0x53a4('0x8'),attributes,{'tableName':_0x53a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ab213,_0x10892d,_0x5c4c0d){if(_0x2ab213[_0x53a4('0xa')](_0x53a4('0xb'))){_0x2ab213['savedAt']=moment()[_0x53a4('0xc')](_0x53a4('0xd'));}if(_0x2ab213[_0x53a4('0xa')]('production')){_0x2ab213[_0x53a4('0xe')]=moment()[_0x53a4('0xc')](_0x53a4('0xd'));}_0x5c4c0d(null,_0x2ab213);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 5d1efdd..c02531a 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 _0x72c6=['stringify','error','message','ShowSquareProject','find','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','GetSquareProjects','SquareProject','findAll','options','where','include','map','model','attributes','then','info','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72c6,0x92));var _0x672c=function(_0x7a263c,_0x1716a3){_0x7a263c=_0x7a263c-0x0;var _0x4712e4=_0x72c6[_0x7a263c];return _0x4712e4;};'use strict';var _=require(_0x672c('0x0'));var Redis=require(_0x672c('0x1'));var db=require(_0x672c('0x2'))['db'];var logger=require(_0x672c('0x3'))(_0x672c('0x4'));var config=require(_0x672c('0x5'));config['redis']=_[_0x672c('0x6')](config[_0x672c('0x7')],{'host':_0x672c('0x8'),'port':0x18eb});var socket=require(_0x672c('0x9'))(new Redis(config[_0x672c('0x7')]));require('./squareProject.socket')['register'](socket);exports[_0x672c('0xa')]=function(_0x1ce4fe){var _0x3c7c0e=this;return new Promise(function(_0x3ea065,_0x4329dc){return db[_0x672c('0xb')][_0x672c('0xc')]({'raw':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe[_0x672c('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe[_0x672c('0xd')][_0x672c('0xe')]||null:null,'attributes':_0x1ce4fe['options']?_0x1ce4fe[_0x672c('0xd')]['attributes']||null:null,'limit':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe[_0x672c('0xd')]['limit']||null:null,'include':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe['options'][_0x672c('0xf')]?_[_0x672c('0x10')](_0x1ce4fe['options'][_0x672c('0xf')],function(_0x5f1eb7){return{'model':db[_0x5f1eb7[_0x672c('0x11')]],'as':_0x5f1eb7['as'],'attributes':_0x5f1eb7[_0x672c('0x12')],'include':_0x5f1eb7['include']?_[_0x672c('0x10')](_0x5f1eb7[_0x672c('0xf')],function(_0x219d50){return{'model':db[_0x219d50[_0x672c('0x11')]],'as':_0x219d50['as'],'attributes':_0x219d50[_0x672c('0x12')],'include':_0x219d50[_0x672c('0xf')]?_[_0x672c('0x10')](_0x219d50[_0x672c('0xf')],function(_0x4f9c6f){return{'model':db[_0x4f9c6f[_0x672c('0x11')]],'as':_0x4f9c6f['as'],'attributes':_0x4f9c6f[_0x672c('0x12')]};}):[]};}):[]};}):[]:[]})[_0x672c('0x13')](function(_0x573691){logger[_0x672c('0x14')](_0x672c('0xa'),_0x1ce4fe);logger[_0x672c('0x15')](_0x672c('0xa'),_0x1ce4fe,JSON[_0x672c('0x16')](_0x573691));_0x3ea065(_0x573691);})['catch'](function(_0xaeadb1){logger[_0x672c('0x17')](_0x672c('0xa'),_0xaeadb1['message'],_0x1ce4fe);_0x4329dc(_0x3c7c0e[_0x672c('0x17')](0x1f4,_0xaeadb1[_0x672c('0x18')]));});});};exports[_0x672c('0x19')]=function(_0x3c0f28){var _0x143c54=this;return new Promise(function(_0x13a484,_0x4b22d6){return db[_0x672c('0xb')][_0x672c('0x1a')]({'raw':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28[_0x672c('0xd')][_0x672c('0xe')]||null:null,'attributes':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28['options'][_0x672c('0x12')]||null:null,'include':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28[_0x672c('0xd')]['include']?_[_0x672c('0x10')](_0x3c0f28['options'][_0x672c('0xf')],function(_0x1675a9){return{'model':db[_0x1675a9['model']],'as':_0x1675a9['as'],'attributes':_0x1675a9[_0x672c('0x12')],'include':_0x1675a9[_0x672c('0xf')]?_[_0x672c('0x10')](_0x1675a9[_0x672c('0xf')],function(_0x5aafed){return{'model':db[_0x5aafed[_0x672c('0x11')]],'as':_0x5aafed['as'],'attributes':_0x5aafed[_0x672c('0x12')],'include':_0x5aafed['include']?_[_0x672c('0x10')](_0x5aafed[_0x672c('0xf')],function(_0x1bf65d){return{'model':db[_0x1bf65d['model']],'as':_0x1bf65d['as'],'attributes':_0x1bf65d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x219d8e){logger['info']('ShowSquareProject',_0x3c0f28);logger[_0x672c('0x15')](_0x672c('0x19'),_0x3c0f28,JSON[_0x672c('0x16')](_0x219d8e));_0x13a484(_0x219d8e);})[_0x672c('0x1b')](function(_0x37ea89){logger[_0x672c('0x17')](_0x672c('0x19'),_0x37ea89['message'],_0x3c0f28);_0x4b22d6(_0x143c54[_0x672c('0x17')](0x1f4,_0x37ea89['message']));});});}; \ No newline at end of file +var _0xb092=['where','attributes','limit','include','map','model','debug','stringify','catch','message','error','find','info','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects','options','raw'];(function(_0x5f3066,_0x193b7e){var _0x17a27d=function(_0x346b9a){while(--_0x346b9a){_0x5f3066['push'](_0x5f3066['shift']());}};_0x17a27d(++_0x193b7e);}(_0xb092,0x7e));var _0x2b09=function(_0x3c0d5a,_0x6974d5){_0x3c0d5a=_0x3c0d5a-0x0;var _0x29ae10=_0xb092[_0x3c0d5a];return _0x29ae10;};'use strict';var _=require(_0x2b09('0x0'));var Redis=require(_0x2b09('0x1'));var db=require(_0x2b09('0x2'))['db'];var logger=require(_0x2b09('0x3'))(_0x2b09('0x4'));var config=require(_0x2b09('0x5'));config[_0x2b09('0x6')]=_[_0x2b09('0x7')](config[_0x2b09('0x6')],{'host':_0x2b09('0x8'),'port':0x18eb});var socket=require(_0x2b09('0x9'))(new Redis(config[_0x2b09('0x6')]));require('./squareProject.socket')[_0x2b09('0xa')](socket);exports[_0x2b09('0xb')]=function(_0x32dfb3){var _0x55d2bc=this;return new Promise(function(_0x33dcda,_0xf943f8){return db['SquareProject']['findAll']({'raw':_0x32dfb3[_0x2b09('0xc')]?_0x32dfb3[_0x2b09('0xc')][_0x2b09('0xd')]===undefined?!![]:![]:!![],'where':_0x32dfb3[_0x2b09('0xc')]?_0x32dfb3[_0x2b09('0xc')][_0x2b09('0xe')]||null:null,'attributes':_0x32dfb3['options']?_0x32dfb3[_0x2b09('0xc')][_0x2b09('0xf')]||null:null,'limit':_0x32dfb3[_0x2b09('0xc')]?_0x32dfb3[_0x2b09('0xc')][_0x2b09('0x10')]||null:null,'include':_0x32dfb3['options']?_0x32dfb3[_0x2b09('0xc')][_0x2b09('0x11')]?_[_0x2b09('0x12')](_0x32dfb3['options'][_0x2b09('0x11')],function(_0x21a77a){return{'model':db[_0x21a77a['model']],'as':_0x21a77a['as'],'attributes':_0x21a77a[_0x2b09('0xf')],'include':_0x21a77a['include']?_['map'](_0x21a77a[_0x2b09('0x11')],function(_0x35981d){return{'model':db[_0x35981d[_0x2b09('0x13')]],'as':_0x35981d['as'],'attributes':_0x35981d[_0x2b09('0xf')],'include':_0x35981d['include']?_[_0x2b09('0x12')](_0x35981d['include'],function(_0x478b1a){return{'model':db[_0x478b1a[_0x2b09('0x13')]],'as':_0x478b1a['as'],'attributes':_0x478b1a[_0x2b09('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e7bad){logger['info'](_0x2b09('0xb'),_0x32dfb3);logger[_0x2b09('0x14')]('GetSquareProjects',_0x32dfb3,JSON[_0x2b09('0x15')](_0x5e7bad));_0x33dcda(_0x5e7bad);})[_0x2b09('0x16')](function(_0x5e5434){logger['error']('GetSquareProjects',_0x5e5434[_0x2b09('0x17')],_0x32dfb3);_0xf943f8(_0x55d2bc[_0x2b09('0x18')](0x1f4,_0x5e5434[_0x2b09('0x17')]));});});};exports['ShowSquareProject']=function(_0x14656f){var _0x1addc9=this;return new Promise(function(_0x50fa1d,_0x545b18){return db['SquareProject'][_0x2b09('0x19')]({'raw':_0x14656f[_0x2b09('0xc')]?_0x14656f['options']['raw']===undefined?!![]:![]:!![],'where':_0x14656f['options']?_0x14656f['options'][_0x2b09('0xe')]||null:null,'attributes':_0x14656f[_0x2b09('0xc')]?_0x14656f[_0x2b09('0xc')][_0x2b09('0xf')]||null:null,'include':_0x14656f[_0x2b09('0xc')]?_0x14656f[_0x2b09('0xc')][_0x2b09('0x11')]?_[_0x2b09('0x12')](_0x14656f[_0x2b09('0xc')][_0x2b09('0x11')],function(_0x3c4315){return{'model':db[_0x3c4315[_0x2b09('0x13')]],'as':_0x3c4315['as'],'attributes':_0x3c4315[_0x2b09('0xf')],'include':_0x3c4315[_0x2b09('0x11')]?_[_0x2b09('0x12')](_0x3c4315['include'],function(_0x370cb5){return{'model':db[_0x370cb5[_0x2b09('0x13')]],'as':_0x370cb5['as'],'attributes':_0x370cb5['attributes'],'include':_0x370cb5[_0x2b09('0x11')]?_['map'](_0x370cb5[_0x2b09('0x11')],function(_0xa7934b){return{'model':db[_0xa7934b[_0x2b09('0x13')]],'as':_0xa7934b['as'],'attributes':_0xa7934b[_0x2b09('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c2950){logger[_0x2b09('0x1a')](_0x2b09('0x1b'),_0x14656f);logger[_0x2b09('0x14')](_0x2b09('0x1b'),_0x14656f,JSON[_0x2b09('0x15')](_0x1c2950));_0x50fa1d(_0x1c2950);})[_0x2b09('0x16')](function(_0x37a286){logger[_0x2b09('0x18')](_0x2b09('0x1b'),_0x37a286['message'],_0x14656f);_0x545b18(_0x1addc9['error'](0x1f4,_0x37a286['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f698be8..cb548e9 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 _0x14f3=['remove','emit','removeListener','length','./squareProject.events','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x14f3,0xa0));var _0x314f=function(_0x11df5d,_0x331839){_0x11df5d=_0x11df5d-0x0;var _0x49f45b=_0x14f3[_0x11df5d];return _0x49f45b;};'use strict';var SquareProjectEvents=require(_0x314f('0x0'));var events=[_0x314f('0x1'),_0x314f('0x2'),'update'];function createListener(_0x4f1c67,_0x278e63){return function(_0x46e9fd){_0x278e63[_0x314f('0x3')](_0x4f1c67,_0x46e9fd);};}function removeListener(_0x546fdf,_0xd3cbf){return function(){SquareProjectEvents[_0x314f('0x4')](_0x546fdf,_0xd3cbf);};}exports['register']=function(_0x3fb700){for(var _0x3fe25c=0x0,_0x2971f3=events[_0x314f('0x5')];_0x3fe25c<_0x2971f3;_0x3fe25c++){var _0xb2af8f=events[_0x3fe25c];var _0x27d922=createListener('squareProject:'+_0xb2af8f,_0x3fb700);SquareProjectEvents['on'](_0xb2af8f,_0x27d922);}}; \ No newline at end of file +var _0xe1d3=['./squareProject.events','save','remove','update','emit'];(function(_0x53142d,_0x228487){var _0x5b76ee=function(_0x37fc6d){while(--_0x37fc6d){_0x53142d['push'](_0x53142d['shift']());}};_0x5b76ee(++_0x228487);}(_0xe1d3,0x190));var _0x3e1d=function(_0x319556,_0x23dfa1){_0x319556=_0x319556-0x0;var _0x11491b=_0xe1d3[_0x319556];return _0x11491b;};'use strict';var SquareProjectEvents=require(_0x3e1d('0x0'));var events=[_0x3e1d('0x1'),_0x3e1d('0x2'),_0x3e1d('0x3')];function createListener(_0x4636ac,_0x3631d7){return function(_0x3e35d0){_0x3631d7[_0x3e1d('0x4')](_0x4636ac,_0x3e35d0);};}function removeListener(_0x3c863e,_0x458639){return function(){SquareProjectEvents['removeListener'](_0x3c863e,_0x458639);};}exports['register']=function(_0x3ceff5){for(var _0x2a7a92=0x0,_0x3e7838=events['length'];_0x2a7a92<_0x3e7838;_0x2a7a92++){var _0x3fbe8d=events[_0x2a7a92];var _0x4920c2=createListener('squareProject:'+_0x3fbe8d,_0x3ceff5);SquareProjectEvents['on'](_0x3fbe8d,_0x4920c2);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 38b4894..d92e75d 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(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x326f,0xd1));var _0xf326=function(_0x3a6349,_0x3426cc){_0x3a6349=_0x3a6349-0x0;var _0xb38b8a=_0x326f[_0x3a6349];return _0xb38b8a;};'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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x50b83c,_0x1832e9){var _0x3b2688=function(_0x4cf2c4){while(--_0x4cf2c4){_0x50b83c['push'](_0x50b83c['shift']());}};_0x3b2688(++_0x1832e9);}(_0x1261,0x144));var _0x1126=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0x1261[_0x403115];return _0x596ef3;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 98f7b77..4c892c3 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 _0xd8fb=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x3c276b,_0x1e5946){var _0x4e09f5=function(_0x2d01aa){while(--_0x2d01aa){_0x3c276b['push'](_0x3c276b['shift']());}};_0x4e09f5(++_0x1e5946);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3fee3e,_0x3a85b2){_0x3fee3e=_0x3fee3e-0x0;var _0x28e284=_0xd8fb[_0x3fee3e];return _0x28e284;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'callerid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbd8f('0x2')]},'saveName':{'type':Sequelize[_0xbd8f('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xbd8f('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xf503c4='';var _0x578499=this[_0xbd8f('0x3')](_0xbd8f('0x4'));if(_0x578499){_0xf503c4=_0x578499['substring'](_0x578499['lastIndexOf']('.'));}return _0xf503c4;}}}; \ No newline at end of file +var _0xa41a=['exports','STRING','getDataValue','substring','lastIndexOf','sequelize'];(function(_0x1c4558,_0x4abc8e){var _0x715b9b=function(_0x2645df){while(--_0x2645df){_0x1c4558['push'](_0x1c4558['shift']());}};_0x715b9b(++_0x4abc8e);}(_0xa41a,0x6b));var _0xaa41=function(_0x3f8913,_0x4bfb2d){_0x3f8913=_0x3f8913-0x0;var _0x22d5b9=_0xa41a[_0x3f8913];return _0x22d5b9;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'context':{'type':Sequelize[_0xaa41('0x2')]},'extension':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize[_0xaa41('0x2')]},'dnid':{'type':Sequelize[_0xaa41('0x2')]},'projectName':{'type':Sequelize[_0xaa41('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xaa41('0x2')]},'savePath':{'type':Sequelize[_0xaa41('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5b1fff='';var _0x179545=this[_0xaa41('0x3')]('savePath');if(_0x179545){_0x5b1fff=_0x179545[_0xaa41('0x4')](_0x179545[_0xaa41('0x5')]('.'));}return _0x5b1fff;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 29ef4e1..0d23f7c 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 _0xf67f=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','SquareRecording','rawAttributes','type','name','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','length','create','body','download','../../components/encryptor','uniqueid','params','find','savePath','filename','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','extname','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x27209b,_0x13f886){var _0x219e6a=function(_0x217acc){while(--_0x217acc){_0x27209b['push'](_0x27209b['shift']());}};_0x219e6a(++_0x13f886);}(_0xf67f,0x1b9));var _0xff67=function(_0x67c7e2,_0x5f02ee){_0x67c7e2=_0x67c7e2-0x0;var _0x52b665=_0xf67f[_0x67c7e2];return _0x52b665;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff67('0x0'));var zipdir=require(_0xff67('0x1'));var jsonpatch=require(_0xff67('0x2'));var rp=require('request-promise');var moment=require(_0xff67('0x3'));var BPromise=require(_0xff67('0x4'));var Mustache=require(_0xff67('0x5'));var util=require(_0xff67('0x6'));var path=require('path');var sox=require(_0xff67('0x7'));var csv=require(_0xff67('0x8'));var ejs=require(_0xff67('0x9'));var fs=require('fs');var fs_extra=require(_0xff67('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xff67('0xb'));var jsforce=require(_0xff67('0xc'));var deskjs=require(_0xff67('0xd'));var toCsv=require(_0xff67('0x8'));var querystring=require(_0xff67('0xe'));var Papa=require('papaparse');var Redis=require(_0xff67('0xf'));var authService=require(_0xff67('0x10'));var qs=require(_0xff67('0x11'));var as=require(_0xff67('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff67('0x13'))(_0xff67('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff67('0x15'))['db'];function respondWithStatusCode(_0x4148a1,_0x2a309a){_0x2a309a=_0x2a309a||0xcc;return function(_0x5e8b34){if(_0x5e8b34){return _0x4148a1[_0xff67('0x16')](_0x2a309a);}return _0x4148a1[_0xff67('0x17')](_0x2a309a)['end']();};}function respondWithResult(_0x3eda98,_0x236649){_0x236649=_0x236649||0xc8;return function(_0x52d46d){if(_0x52d46d){return _0x3eda98[_0xff67('0x17')](_0x236649)['json'](_0x52d46d);}};}function respondWithFilteredResult(_0x42fc78,_0x4f39c5){return function(_0x13093c){if(_0x13093c){var _0x1a869f=typeof _0x4f39c5['offset']===_0xff67('0x18')&&typeof _0x4f39c5[_0xff67('0x19')]===_0xff67('0x18');var _0x1f9051=_0x13093c[_0xff67('0x1a')];var _0x114618=_0x1a869f?0x0:_0x4f39c5[_0xff67('0x1b')];var _0xd886ca=_0x1a869f?_0x13093c[_0xff67('0x1a')]:_0x4f39c5[_0xff67('0x1b')]+_0x4f39c5[_0xff67('0x19')];var _0xb9f3fc;if(_0xd886ca>=_0x1f9051){_0xd886ca=_0x1f9051;_0xb9f3fc=0xc8;}else{_0xb9f3fc=0xce;}_0x42fc78[_0xff67('0x17')](_0xb9f3fc);return _0x42fc78[_0xff67('0x1c')](_0xff67('0x1d'),_0x114618+'-'+_0xd886ca+'/'+_0x1f9051)['json'](_0x13093c);}return null;};}function patchUpdates(_0x310d95){return function(_0x2dbf65){try{jsonpatch[_0xff67('0x1e')](_0x2dbf65,_0x310d95,!![]);}catch(_0x5889d2){return BPromise[_0xff67('0x1f')](_0x5889d2);}return _0x2dbf65[_0xff67('0x20')]();};}function saveUpdates(_0x3f9cc7,_0x8f2166){return function(_0xbc3482){if(_0xbc3482){return _0xbc3482[_0xff67('0x21')](_0x3f9cc7)[_0xff67('0x22')](function(_0x34f6b1){return _0x34f6b1;});}return null;};}function removeEntity(_0x306355,_0x47ab3f){return function(_0x57d089){if(_0x57d089){return _0x57d089[_0xff67('0x23')]()[_0xff67('0x22')](function(){_0x306355['status'](0xcc)[_0xff67('0x24')]();});}};}function handleEntityNotFound(_0x4956b1,_0x2e4632){return function(_0x545fd3){if(!_0x545fd3){_0x4956b1['sendStatus'](0x194);}return _0x545fd3;};}function handleError(_0xeb97f6,_0xadcb6a){_0xadcb6a=_0xadcb6a||0x1f4;return function(_0x77d812){logger[_0xff67('0x25')](_0x77d812[_0xff67('0x26')]);if(_0x77d812['name']){delete _0x77d812['name'];}_0xeb97f6['status'](_0xadcb6a)[_0xff67('0x27')](_0x77d812);};}exports[_0xff67('0x28')]=function(_0x21f114,_0x270ad3){var _0x953ebc={},_0x5e57df={},_0x33ada4={'count':0x0,'rows':[]};var _0x4cabf0=_[_0xff67('0x29')](db[_0xff67('0x2a')][_0xff67('0x2b')],function(_0x555eb6){return{'name':_0x555eb6['fieldName'],'type':_0x555eb6[_0xff67('0x2c')]['key']};});_0x5e57df['model']=_['map'](_0x4cabf0,_0xff67('0x2d'));_0x5e57df[_0xff67('0x2e')]=_[_0xff67('0x2f')](_0x21f114['query']);_0x5e57df[_0xff67('0x30')]=_['intersection'](_0x5e57df['model'],_0x5e57df[_0xff67('0x2e')]);_0x953ebc[_0xff67('0x31')]=_[_0xff67('0x32')](_0x5e57df[_0xff67('0x33')],qs[_0xff67('0x34')](_0x21f114[_0xff67('0x2e')][_0xff67('0x34')]));_0x953ebc['attributes']=_0x953ebc[_0xff67('0x31')]['length']?_0x953ebc[_0xff67('0x31')]:_0x5e57df[_0xff67('0x33')];if(!_0x21f114[_0xff67('0x2e')][_0xff67('0x35')](_0xff67('0x36'))){_0x953ebc[_0xff67('0x19')]=qs['limit'](_0x21f114[_0xff67('0x2e')][_0xff67('0x19')]);_0x953ebc[_0xff67('0x1b')]=qs[_0xff67('0x1b')](_0x21f114[_0xff67('0x2e')]['offset']);}_0x953ebc[_0xff67('0x37')]=qs[_0xff67('0x38')](_0x21f114[_0xff67('0x2e')][_0xff67('0x38')]);_0x953ebc['where']=qs['filters'](_[_0xff67('0x39')](_0x21f114[_0xff67('0x2e')],_0x5e57df[_0xff67('0x30')]),_0x4cabf0);if(_0x21f114[_0xff67('0x2e')]['filter']){_0x953ebc[_0xff67('0x3a')]=_[_0xff67('0x3b')](_0x953ebc[_0xff67('0x3a')],{'$or':_['map'](_0x4cabf0,function(_0xe6b1a0){if(_0xe6b1a0[_0xff67('0x2c')]!==_0xff67('0x3c')){var _0x26fbf8={};_0x26fbf8[_0xe6b1a0['name']]={'$like':'%'+_0x21f114[_0xff67('0x2e')][_0xff67('0x3d')]+'%'};return _0x26fbf8;}})});}_0x953ebc=_[_0xff67('0x3b')]({},_0x953ebc,_0x21f114['options']);var _0x58be43={'where':_0x953ebc[_0xff67('0x3a')]};return db[_0xff67('0x2a')][_0xff67('0x1a')](_0x58be43)[_0xff67('0x22')](function(_0x2a8ca8){_0x33ada4[_0xff67('0x1a')]=_0x2a8ca8;if(_0x21f114['query'][_0xff67('0x3e')]){_0x953ebc[_0xff67('0x3f')]=[{'all':!![]}];}return db[_0xff67('0x2a')][_0xff67('0x40')](_0x953ebc);})['then'](function(_0x223c47){_0x33ada4['rows']=_0x223c47;return _0x33ada4;})['then'](respondWithFilteredResult(_0x270ad3,_0x953ebc))[_0xff67('0x41')](handleError(_0x270ad3,null));};exports['show']=function(_0x11e8ab,_0x22e4bc){var _0x13d396={'raw':!![],'where':{'id':_0x11e8ab['params']['id']}},_0x5eaa50={};_0x5eaa50[_0xff67('0x33')]=_['keys'](db[_0xff67('0x2a')][_0xff67('0x2b')]);_0x5eaa50[_0xff67('0x2e')]=_['keys'](_0x11e8ab[_0xff67('0x2e')]);_0x5eaa50['filters']=_[_0xff67('0x32')](_0x5eaa50[_0xff67('0x33')],_0x5eaa50[_0xff67('0x2e')]);_0x13d396[_0xff67('0x31')]=_['intersection'](_0x5eaa50[_0xff67('0x33')],qs[_0xff67('0x34')](_0x11e8ab['query'][_0xff67('0x34')]));_0x13d396[_0xff67('0x31')]=_0x13d396['attributes'][_0xff67('0x42')]?_0x13d396[_0xff67('0x31')]:_0x5eaa50['model'];if(_0x11e8ab['query'][_0xff67('0x3e')]){_0x13d396['include']=[{'all':!![]}];}_0x13d396=_['merge']({},_0x13d396,_0x11e8ab['options']);return db[_0xff67('0x2a')]['find'](_0x13d396)[_0xff67('0x22')](handleEntityNotFound(_0x22e4bc,null))[_0xff67('0x22')](respondWithResult(_0x22e4bc,null))['catch'](handleError(_0x22e4bc,null));};exports[_0xff67('0x43')]=function(_0x4a73e9,_0x111f1f){return db[_0xff67('0x2a')]['create'](_0x4a73e9[_0xff67('0x44')],{})[_0xff67('0x22')](respondWithResult(_0x111f1f,0xc9))[_0xff67('0x41')](handleError(_0x111f1f,null));};exports[_0xff67('0x21')]=function(_0x4894e7,_0x3dc320){if(_0x4894e7[_0xff67('0x44')]['id']){delete _0x4894e7[_0xff67('0x44')]['id'];}return db[_0xff67('0x2a')]['find']({'where':{'id':_0x4894e7['params']['id']}})[_0xff67('0x22')](handleEntityNotFound(_0x3dc320,null))[_0xff67('0x22')](saveUpdates(_0x4894e7[_0xff67('0x44')],null))['then'](respondWithResult(_0x3dc320,null))[_0xff67('0x41')](handleError(_0x3dc320,null));};exports[_0xff67('0x45')]=function(_0x496b57,_0x25347c,_0x15dd58){var _0x28923e=require(_0xff67('0x46'));var _0x338afa=![];var _0xf22429={};if(_0x496b57['query'][_0xff67('0x2c')]&&_0x496b57[_0xff67('0x2e')][_0xff67('0x2c')]===_0xff67('0x47')){_0xf22429[_0xff67('0x47')]=_0x496b57[_0xff67('0x48')]['id'];}else{_0xf22429['id']=_0x496b57['params']['id'];}return db['SquareRecording'][_0xff67('0x49')]({'where':_0xf22429,'attributes':['id',_0xff67('0x4a'),_0xff67('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x25347c,null))[_0xff67('0x22')](function(_0x190467){if(_0x190467){var _0x1fbbaa=_0x190467[_0xff67('0x4a')];var _0x414401=util['format']('%s.cypher',_0x1fbbaa);if(fs['existsSync'](_0x414401)){_0x338afa=!![];return _0x28923e[_0xff67('0x4c')](_0x414401,_0x1fbbaa,config[_0xff67('0x4d')][_0xff67('0x4e')])['then'](function(){return _0x190467;});}return _0x190467;}})[_0xff67('0x22')](function(_0x181b6e){if(_0x181b6e){var _0x186805=_0x181b6e['savePath'];if(!fs[_0xff67('0x4f')](_0x186805)){throw new db[(_0xff67('0x50'))][(_0xff67('0x51'))]('SquareRecording\x20not\x20found');}if(_0x181b6e[_0xff67('0x4b')]){return _0x25347c[_0xff67('0x45')](_0x186805,_0x181b6e[_0xff67('0x4b')]+path[_0xff67('0x52')](_0x186805),function(){if(_0x338afa){fs['unlink'](_0x186805);}});}else{return _0x25347c[_0xff67('0x45')](_0x186805,function(_0x46e357){if(_0x338afa){fs['unlink'](_0x186805);}});}}})['catch'](function(_0xc883a8){if(_0xc883a8[_0xff67('0x53')]===_0xff67('0x54')){_0x25347c['status'](0x194)['send'](_0xff67('0x55'));}else{return handleError(_0x25347c,null);}});};exports[_0xff67('0x23')]=function(_0x22abdd,_0x2e835c){return db['SquareRecording'][_0xff67('0x49')]({'where':{'id':_0x22abdd[_0xff67('0x48')]['id']}})['then'](function(_0x2106e2){if(_['isNil'](_0x2106e2)){throw new ReferenceError(_0xff67('0x56'));}return _0x2106e2;})[_0xff67('0x22')](function(_0x3fb516){var _0x4b8315=_0x3fb516[_0xff67('0x4a')];logger[_0xff67('0x57')](_0xff67('0x58'),_0x4b8315);if(!_[_0xff67('0x59')](_0x3fb516[_0xff67('0x4a')])&&fs[_0xff67('0x4f')](_0x4b8315)){logger['info'](_0xff67('0x5a')+_0x4b8315+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xff67('0x5b')](_0x4b8315);}_0x4b8315=_0x4b8315+'.cypher';if(!_[_0xff67('0x59')](_0x3fb516[_0xff67('0x4a')])&&fs[_0xff67('0x4f')](_0x4b8315)){logger[_0xff67('0x57')](_0xff67('0x5a')+_0x4b8315+_0xff67('0x5c'));fs['unlinkSync'](_0x4b8315);}return _0x3fb516;})[_0xff67('0x22')](function(_0x1cd17f){if(!_0x1cd17f)throw new InternalError();return _0x1cd17f[_0xff67('0x23')]();})['then'](function(){_0x2e835c[_0xff67('0x17')](0xcc)[_0xff67('0x24')]();})[_0xff67('0x41')](handleError(_0x2e835c,null));}; \ No newline at end of file +var _0x092b=['include','rows','catch','show','params','rawAttributes','fields','create','body','find','download','../../components/encryptor','uniqueid','filename','savePath','existsSync','decryptFile','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','end','eml-format','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','map','SquareRecording','fieldName','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x092b,0x18d));var _0xb092=function(_0x373d63,_0x1c4329){_0x373d63=_0x373d63-0x0;var _0x13db7c=_0x092b[_0x373d63];return _0x13db7c;};'use strict';var emlformat=require(_0xb092('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb092('0x1'));var moment=require('moment');var BPromise=require(_0xb092('0x2'));var Mustache=require('mustache');var util=require(_0xb092('0x3'));var path=require('path');var sox=require(_0xb092('0x4'));var csv=require('to-csv');var ejs=require(_0xb092('0x5'));var fs=require('fs');var fs_extra=require(_0xb092('0x6'));var _=require(_0xb092('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb092('0x8'));var deskjs=require(_0xb092('0x9'));var toCsv=require(_0xb092('0xa'));var querystring=require(_0xb092('0xb'));var Papa=require(_0xb092('0xc'));var Redis=require(_0xb092('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb092('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb092('0xf'));var utils=require(_0xb092('0x10'));var config=require(_0xb092('0x11'));var licenseUtil=require(_0xb092('0x12'));var db=require(_0xb092('0x13'))['db'];function respondWithStatusCode(_0x4c2113,_0x4f4c02){_0x4f4c02=_0x4f4c02||0xcc;return function(_0x48b6ed){if(_0x48b6ed){return _0x4c2113['sendStatus'](_0x4f4c02);}return _0x4c2113['status'](_0x4f4c02)['end']();};}function respondWithResult(_0x13c81f,_0x314c21){_0x314c21=_0x314c21||0xc8;return function(_0x48b268){if(_0x48b268){return _0x13c81f[_0xb092('0x14')](_0x314c21)[_0xb092('0x15')](_0x48b268);}};}function respondWithFilteredResult(_0xb0e4d7,_0x298b66){return function(_0x3618f5){if(_0x3618f5){var _0x18591c=typeof _0x298b66[_0xb092('0x16')]===_0xb092('0x17')&&typeof _0x298b66[_0xb092('0x18')]==='undefined';var _0x1ff4d5=_0x3618f5[_0xb092('0x19')];var _0x511119=_0x18591c?0x0:_0x298b66[_0xb092('0x16')];var _0x611443=_0x18591c?_0x3618f5['count']:_0x298b66[_0xb092('0x16')]+_0x298b66[_0xb092('0x18')];var _0x1ca3cf;if(_0x611443>=_0x1ff4d5){_0x611443=_0x1ff4d5;_0x1ca3cf=0xc8;}else{_0x1ca3cf=0xce;}_0xb0e4d7[_0xb092('0x14')](_0x1ca3cf);return _0xb0e4d7['set'](_0xb092('0x1a'),_0x511119+'-'+_0x611443+'/'+_0x1ff4d5)[_0xb092('0x15')](_0x3618f5);}return null;};}function patchUpdates(_0x49c8dc){return function(_0x47a416){try{jsonpatch['apply'](_0x47a416,_0x49c8dc,!![]);}catch(_0x1766f7){return BPromise[_0xb092('0x1b')](_0x1766f7);}return _0x47a416[_0xb092('0x1c')]();};}function saveUpdates(_0x9bad77,_0x2d0ece){return function(_0x2b7be8){if(_0x2b7be8){return _0x2b7be8[_0xb092('0x1d')](_0x9bad77)[_0xb092('0x1e')](function(_0x105fca){return _0x105fca;});}return null;};}function removeEntity(_0x361907,_0x304dfe){return function(_0x50cc63){if(_0x50cc63){return _0x50cc63[_0xb092('0x1f')]()[_0xb092('0x1e')](function(){_0x361907[_0xb092('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d53d,_0x4ebec6){return function(_0x29b355){if(!_0x29b355){_0x24d53d[_0xb092('0x20')](0x194);}return _0x29b355;};}function handleError(_0x200721,_0x30d4c2){_0x30d4c2=_0x30d4c2||0x1f4;return function(_0x11ae86){logger[_0xb092('0x21')](_0x11ae86['stack']);if(_0x11ae86['name']){delete _0x11ae86['name'];}_0x200721['status'](_0x30d4c2)['send'](_0x11ae86);};}exports['index']=function(_0x3bcbec,_0x384a9e){var _0x13f7fc={},_0x53b706={},_0xc4ff25={'count':0x0,'rows':[]};var _0x970a1d=_[_0xb092('0x22')](db[_0xb092('0x23')]['rawAttributes'],function(_0x2c82aa){return{'name':_0x2c82aa[_0xb092('0x24')],'type':_0x2c82aa[_0xb092('0x25')][_0xb092('0x26')]};});_0x53b706[_0xb092('0x27')]=_[_0xb092('0x22')](_0x970a1d,_0xb092('0x28'));_0x53b706[_0xb092('0x29')]=_[_0xb092('0x2a')](_0x3bcbec[_0xb092('0x29')]);_0x53b706['filters']=_['intersection'](_0x53b706[_0xb092('0x27')],_0x53b706['query']);_0x13f7fc['attributes']=_[_0xb092('0x2b')](_0x53b706[_0xb092('0x27')],qs['fields'](_0x3bcbec[_0xb092('0x29')]['fields']));_0x13f7fc[_0xb092('0x2c')]=_0x13f7fc[_0xb092('0x2c')][_0xb092('0x2d')]?_0x13f7fc['attributes']:_0x53b706[_0xb092('0x27')];if(!_0x3bcbec['query'][_0xb092('0x2e')](_0xb092('0x2f'))){_0x13f7fc[_0xb092('0x18')]=qs[_0xb092('0x18')](_0x3bcbec[_0xb092('0x29')][_0xb092('0x18')]);_0x13f7fc[_0xb092('0x16')]=qs[_0xb092('0x16')](_0x3bcbec['query'][_0xb092('0x16')]);}_0x13f7fc[_0xb092('0x30')]=qs[_0xb092('0x31')](_0x3bcbec['query'][_0xb092('0x31')]);_0x13f7fc[_0xb092('0x32')]=qs[_0xb092('0x33')](_[_0xb092('0x34')](_0x3bcbec[_0xb092('0x29')],_0x53b706['filters']),_0x970a1d);if(_0x3bcbec['query'][_0xb092('0x35')]){_0x13f7fc[_0xb092('0x32')]=_[_0xb092('0x36')](_0x13f7fc[_0xb092('0x32')],{'$or':_[_0xb092('0x22')](_0x970a1d,function(_0x5aeb6d){if(_0x5aeb6d[_0xb092('0x25')]!==_0xb092('0x37')){var _0x1158d2={};_0x1158d2[_0x5aeb6d[_0xb092('0x28')]]={'$like':'%'+_0x3bcbec[_0xb092('0x29')]['filter']+'%'};return _0x1158d2;}})});}_0x13f7fc=_[_0xb092('0x36')]({},_0x13f7fc,_0x3bcbec[_0xb092('0x38')]);var _0x1ed231={'where':_0x13f7fc['where']};return db[_0xb092('0x23')][_0xb092('0x19')](_0x1ed231)[_0xb092('0x1e')](function(_0x5612fb){_0xc4ff25[_0xb092('0x19')]=_0x5612fb;if(_0x3bcbec[_0xb092('0x29')][_0xb092('0x39')]){_0x13f7fc[_0xb092('0x3a')]=[{'all':!![]}];}return db[_0xb092('0x23')]['findAll'](_0x13f7fc);})[_0xb092('0x1e')](function(_0x17685a){_0xc4ff25[_0xb092('0x3b')]=_0x17685a;return _0xc4ff25;})[_0xb092('0x1e')](respondWithFilteredResult(_0x384a9e,_0x13f7fc))[_0xb092('0x3c')](handleError(_0x384a9e,null));};exports[_0xb092('0x3d')]=function(_0x5c035d,_0x12eab2){var _0x16a50a={'raw':!![],'where':{'id':_0x5c035d[_0xb092('0x3e')]['id']}},_0x443a1b={};_0x443a1b['model']=_[_0xb092('0x2a')](db[_0xb092('0x23')][_0xb092('0x3f')]);_0x443a1b['query']=_['keys'](_0x5c035d[_0xb092('0x29')]);_0x443a1b[_0xb092('0x33')]=_['intersection'](_0x443a1b[_0xb092('0x27')],_0x443a1b[_0xb092('0x29')]);_0x16a50a['attributes']=_[_0xb092('0x2b')](_0x443a1b[_0xb092('0x27')],qs[_0xb092('0x40')](_0x5c035d['query'][_0xb092('0x40')]));_0x16a50a[_0xb092('0x2c')]=_0x16a50a['attributes'][_0xb092('0x2d')]?_0x16a50a['attributes']:_0x443a1b[_0xb092('0x27')];if(_0x5c035d[_0xb092('0x29')][_0xb092('0x39')]){_0x16a50a[_0xb092('0x3a')]=[{'all':!![]}];}_0x16a50a=_['merge']({},_0x16a50a,_0x5c035d[_0xb092('0x38')]);return db[_0xb092('0x23')]['find'](_0x16a50a)[_0xb092('0x1e')](handleEntityNotFound(_0x12eab2,null))[_0xb092('0x1e')](respondWithResult(_0x12eab2,null))[_0xb092('0x3c')](handleError(_0x12eab2,null));};exports['create']=function(_0x51308c,_0x48bbb0){return db[_0xb092('0x23')][_0xb092('0x41')](_0x51308c[_0xb092('0x42')],{})[_0xb092('0x1e')](respondWithResult(_0x48bbb0,0xc9))[_0xb092('0x3c')](handleError(_0x48bbb0,null));};exports['update']=function(_0x5b9dc9,_0x197ddb){if(_0x5b9dc9['body']['id']){delete _0x5b9dc9[_0xb092('0x42')]['id'];}return db['SquareRecording'][_0xb092('0x43')]({'where':{'id':_0x5b9dc9[_0xb092('0x3e')]['id']}})['then'](handleEntityNotFound(_0x197ddb,null))[_0xb092('0x1e')](saveUpdates(_0x5b9dc9[_0xb092('0x42')],null))['then'](respondWithResult(_0x197ddb,null))[_0xb092('0x3c')](handleError(_0x197ddb,null));};exports[_0xb092('0x44')]=function(_0x41811d,_0x5a5120,_0xfacf97){var _0xe0786=require(_0xb092('0x45'));var _0x4fda82=![];var _0x349be8={};if(_0x41811d[_0xb092('0x29')][_0xb092('0x25')]&&_0x41811d[_0xb092('0x29')][_0xb092('0x25')]===_0xb092('0x46')){_0x349be8[_0xb092('0x46')]=_0x41811d[_0xb092('0x3e')]['id'];}else{_0x349be8['id']=_0x41811d[_0xb092('0x3e')]['id'];}return db[_0xb092('0x23')][_0xb092('0x43')]({'where':_0x349be8,'attributes':['id','savePath',_0xb092('0x47')],'raw':!![]})[_0xb092('0x1e')](handleEntityNotFound(_0x5a5120,null))['then'](function(_0x284b21){if(_0x284b21){var _0x18d8ec=_0x284b21[_0xb092('0x48')];var _0x1cc49d=util['format']('%s.cypher',_0x18d8ec);if(fs[_0xb092('0x49')](_0x1cc49d)){_0x4fda82=!![];return _0xe0786[_0xb092('0x4a')](_0x1cc49d,_0x18d8ec,config['secrets']['recording'])[_0xb092('0x1e')](function(){return _0x284b21;});}return _0x284b21;}})[_0xb092('0x1e')](function(_0x51563c){if(_0x51563c){var _0x30fab6=_0x51563c[_0xb092('0x48')];if(!fs[_0xb092('0x49')](_0x30fab6)){throw new db['Sequelize'][(_0xb092('0x4b'))](_0xb092('0x4c'));}if(_0x51563c['filename']){return _0x5a5120[_0xb092('0x44')](_0x30fab6,_0x51563c['filename']+path[_0xb092('0x4d')](_0x30fab6),function(){if(_0x4fda82){fs['unlink'](_0x30fab6);}});}else{return _0x5a5120[_0xb092('0x44')](_0x30fab6,function(_0x35eb32){if(_0x4fda82){fs[_0xb092('0x4e')](_0x30fab6);}});}}})[_0xb092('0x3c')](function(_0x198265){if(_0x198265[_0xb092('0x4f')]===_0xb092('0x4c')){_0x5a5120['status'](0x194)[_0xb092('0x50')](_0xb092('0x51'));}else{return handleError(_0x5a5120,null);}});};exports['destroy']=function(_0x5c6a32,_0xb9fbf7){return db['SquareRecording'][_0xb092('0x43')]({'where':{'id':_0x5c6a32[_0xb092('0x3e')]['id']}})[_0xb092('0x1e')](function(_0x451d03){if(_[_0xb092('0x52')](_0x451d03)){throw new ReferenceError(_0xb092('0x53'));}return _0x451d03;})[_0xb092('0x1e')](function(_0x23e9bb){var _0x34f8ca=_0x23e9bb[_0xb092('0x48')];logger[_0xb092('0x54')](_0xb092('0x55'),_0x34f8ca);if(!_[_0xb092('0x52')](_0x23e9bb['savePath'])&&fs[_0xb092('0x49')](_0x34f8ca)){logger[_0xb092('0x54')](_0xb092('0x56')+_0x34f8ca+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb092('0x57')](_0x34f8ca);}_0x34f8ca=_0x34f8ca+_0xb092('0x58');if(!_[_0xb092('0x52')](_0x23e9bb['savePath'])&&fs[_0xb092('0x49')](_0x34f8ca)){logger[_0xb092('0x54')](_0xb092('0x56')+_0x34f8ca+_0xb092('0x59'));fs[_0xb092('0x57')](_0x34f8ca);}return _0x23e9bb;})['then'](function(_0x595daa){if(!_0x595daa)throw new InternalError();return _0x595daa['destroy']();})['then'](function(){_0xb9fbf7['status'](0xcc)[_0xb092('0x5a')]();})[_0xb092('0x3c')](handleError(_0xb9fbf7,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1ae84e9..722623e 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 _0x3914=['path','rimraf','./squareRecording.attributes','exports','SquareRecording','lodash','util','api','moment','request-promise'];(function(_0x1e3077,_0x9b9b52){var _0x378418=function(_0x19ea91){while(--_0x19ea91){_0x1e3077['push'](_0x1e3077['shift']());}};_0x378418(++_0x9b9b52);}(_0x3914,0xeb));var _0x4391=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x3914[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var logger=require('../../config/logger')(_0x4391('0x2'));var moment=require(_0x4391('0x3'));var BPromise=require('bluebird');var rp=require(_0x4391('0x4'));var fs=require('fs');var path=require(_0x4391('0x5'));var rimraf=require(_0x4391('0x6'));var config=require('../../config/environment');var attributes=require(_0x4391('0x7'));module[_0x4391('0x8')]=function(_0x540b62,_0x3717d5){return _0x540b62['define'](_0x4391('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd10=['SquareRecording','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xbd10,0x85));var _0x0bd1=function(_0x206cbc,_0x3c2d78){_0x206cbc=_0x206cbc-0x0;var _0x2200bf=_0xbd10[_0x206cbc];return _0x2200bf;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var logger=require(_0x0bd1('0x2'))('api');var moment=require(_0x0bd1('0x3'));var BPromise=require(_0x0bd1('0x4'));var rp=require(_0x0bd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var attributes=require(_0x0bd1('0x8'));module[_0x0bd1('0x9')]=function(_0x453508,_0x46c432){return _0x453508['define'](_0x0bd1('0xa'),attributes,{'tableName':'square_recordings','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 6cc21f1..0e7f27a 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 _0x8f8a=['error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x52bcb8,_0x5e7536){var _0x1e26f2=function(_0x2eab38){while(--_0x2eab38){_0x52bcb8['push'](_0x52bcb8['shift']());}};_0x1e26f2(++_0x5e7536);}(_0x8f8a,0x1e4));var _0xa8f8=function(_0x90c911,_0x1df1c1){_0x90c911=_0x90c911-0x0;var _0x830ac6=_0x8f8a[_0x90c911];return _0x830ac6;};'use strict';var _=require(_0xa8f8('0x0'));var util=require(_0xa8f8('0x1'));var moment=require(_0xa8f8('0x2'));var BPromise=require(_0xa8f8('0x3'));var rs=require(_0xa8f8('0x4'));var fs=require('fs');var Redis=require(_0xa8f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f8('0x6'));var logger=require(_0xa8f8('0x7'))(_0xa8f8('0x8'));var config=require(_0xa8f8('0x9'));var jayson=require(_0xa8f8('0xa'));var client=jayson[_0xa8f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7aac4d,_0x304e2a,_0x5822d6){return new BPromise(function(_0x5df5d4,_0x83ade4){return client[_0xa8f8('0xc')](_0x7aac4d,_0x5822d6)[_0xa8f8('0xd')](function(_0x31e6c5){logger[_0xa8f8('0xe')](_0xa8f8('0xf'),_0x304e2a,'request\x20sent');logger[_0xa8f8('0x10')](_0xa8f8('0x11'),_0x304e2a,_0xa8f8('0x12'),JSON[_0xa8f8('0x13')](_0x31e6c5));if(_0x31e6c5['error']){if(_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x15')]===0x1f4){logger[_0xa8f8('0x14')](_0xa8f8('0xf'),_0x304e2a,_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x16')]);return _0x83ade4(_0x31e6c5['error'][_0xa8f8('0x16')]);}logger[_0xa8f8('0x14')](_0xa8f8('0xf'),_0x304e2a,_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x16')]);return _0x5df5d4(_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x16')]);}else{logger[_0xa8f8('0xe')]('SquareRecording,\x20%s,\x20%s',_0x304e2a,_0xa8f8('0x12'));_0x5df5d4(_0x31e6c5['result']['message']);}})[_0xa8f8('0x17')](function(_0x2415a5){logger[_0xa8f8('0x14')](_0xa8f8('0xf'),_0x304e2a,_0x2415a5);_0x83ade4(_0x2415a5);});});}exports[_0xa8f8('0x18')]=function(_0x2499eb){var _0x23aec3=this;return new Promise(function(_0x4a2c1c,_0x4bcb4e){return db[_0xa8f8('0x19')]['create'](_0x2499eb[_0xa8f8('0x1a')],{'raw':_0x2499eb[_0xa8f8('0x1b')]?_0x2499eb[_0xa8f8('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x43e62a){logger[_0xa8f8('0xe')](_0xa8f8('0x18'),_0x2499eb);logger['debug']('CreateSquareRecording',_0x2499eb,JSON[_0xa8f8('0x13')](_0x43e62a));_0x4a2c1c(_0x43e62a);})[_0xa8f8('0x17')](function(_0x5bad94){logger['error'](_0xa8f8('0x18'),_0x5bad94['message'],_0x2499eb);_0x4bcb4e(_0x23aec3['error'](0x1f4,_0x5bad94['message']));});});}; \ No newline at end of file +var _0x553b=['http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','SquareRecording','body','options','CreateSquareRecording','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1aa289,_0x47d758){var _0xb7f13f=function(_0x8a8db3){while(--_0x8a8db3){_0x1aa289['push'](_0x1aa289['shift']());}};_0xb7f13f(++_0x47d758);}(_0x553b,0x104));var _0xb553=function(_0x555b72,_0x10f3fb){_0x555b72=_0x555b72-0x0;var _0x5c7793=_0x553b[_0x555b72];return _0x5c7793;};'use strict';var _=require(_0xb553('0x0'));var util=require(_0xb553('0x1'));var moment=require(_0xb553('0x2'));var BPromise=require(_0xb553('0x3'));var rs=require(_0xb553('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb553('0x5'))['db'];var utils=require(_0xb553('0x6'));var logger=require('../../config/logger')(_0xb553('0x7'));var config=require(_0xb553('0x8'));var jayson=require(_0xb553('0x9'));var client=jayson['client'][_0xb553('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x106aa4,_0x27d7be,_0x4f3070){return new BPromise(function(_0x27a310,_0xae5d6){return client[_0xb553('0xb')](_0x106aa4,_0x4f3070)[_0xb553('0xc')](function(_0x208540){logger[_0xb553('0xd')]('SquareRecording,\x20%s,\x20%s',_0x27d7be,_0xb553('0xe'));logger[_0xb553('0xf')](_0xb553('0x10'),_0x27d7be,_0xb553('0xe'),JSON[_0xb553('0x11')](_0x208540));if(_0x208540['error']){if(_0x208540[_0xb553('0x12')][_0xb553('0x13')]===0x1f4){logger[_0xb553('0x12')](_0xb553('0x14'),_0x27d7be,_0x208540[_0xb553('0x12')][_0xb553('0x15')]);return _0xae5d6(_0x208540[_0xb553('0x12')][_0xb553('0x15')]);}logger['error'](_0xb553('0x14'),_0x27d7be,_0x208540[_0xb553('0x12')][_0xb553('0x15')]);return _0x27a310(_0x208540['error'][_0xb553('0x15')]);}else{logger[_0xb553('0xd')](_0xb553('0x14'),_0x27d7be,_0xb553('0xe'));_0x27a310(_0x208540['result'][_0xb553('0x15')]);}})['catch'](function(_0x5f3cb7){logger[_0xb553('0x12')](_0xb553('0x14'),_0x27d7be,_0x5f3cb7);_0xae5d6(_0x5f3cb7);});});}exports['CreateSquareRecording']=function(_0x472a0a){var _0x271f2a=this;return new Promise(function(_0x4d93b4,_0x513d77){return db[_0xb553('0x16')]['create'](_0x472a0a[_0xb553('0x17')],{'raw':_0x472a0a[_0xb553('0x18')]?_0x472a0a[_0xb553('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb553('0xc')](function(_0x127d18){logger[_0xb553('0xd')](_0xb553('0x19'),_0x472a0a);logger[_0xb553('0xf')](_0xb553('0x19'),_0x472a0a,JSON[_0xb553('0x11')](_0x127d18));_0x4d93b4(_0x127d18);})[_0xb553('0x1a')](function(_0x5e7aa7){logger[_0xb553('0x12')](_0xb553('0x19'),_0x5e7aa7['message'],_0x472a0a);_0x513d77(_0x271f2a[_0xb553('0x12')](0x1f4,_0x5e7aa7[_0xb553('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 482cee0..9c267ea 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 _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(_0x3feb63,_0xf830eb){var _0x16be45=function(_0xd9fd89){while(--_0xd9fd89){_0x3feb63['push'](_0x3feb63['shift']());}};_0x16be45(++_0xf830eb);}(_0xe706,0xa3));var _0x6e70=function(_0x29af39,_0x343c56){_0x29af39=_0x29af39-0x0;var _0x3ab715=_0xe706[_0x29af39];return _0x3ab715;};'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 +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x2ebc99,_0x459785){var _0x1f8e05=function(_0x304451){while(--_0x304451){_0x2ebc99['push'](_0x2ebc99['shift']());}};_0x1f8e05(++_0x459785);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index b1cd5b0..ff881a8 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 _0x6e91=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x3bea96,_0x3c740f){var _0x40f13f=function(_0xbd7ecb){while(--_0xbd7ecb){_0x3bea96['push'](_0x3bea96['shift']());}};_0x40f13f(++_0x3c740f);}(_0x6e91,0x15e));var _0x16e9=function(_0x1e8074,_0x363645){_0x1e8074=_0x1e8074-0x0;var _0x3f7da2=_0x6e91[_0x1e8074];return _0x3f7da2;};'use strict';var Sequelize=require(_0x16e9('0x0'));module[_0x16e9('0x1')]={'network':{'type':Sequelize[_0x16e9('0x2')]},'network_script':{'type':Sequelize[_0x16e9('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x16e9('0x2')]},'type':{'type':Sequelize[_0x16e9('0x2')]},'uniqueid':{'type':Sequelize[_0x16e9('0x2')]},'version':{'type':Sequelize[_0x16e9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x16e9('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x16e9('0x2')]},'callington':{'type':Sequelize[_0x16e9('0x2')]},'callingtns':{'type':Sequelize[_0x16e9('0x2')]},'dnid':{'type':Sequelize[_0x16e9('0x2')]},'rdnis':{'type':Sequelize[_0x16e9('0x2')]},'context':{'type':Sequelize[_0x16e9('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x16e9('0x2')]},'enhanced':{'type':Sequelize[_0x16e9('0x2')]},'accountcode':{'type':Sequelize[_0x16e9('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x16e9('0x3')]},'leaveAt':{'type':Sequelize[_0x16e9('0x3')]},'bot':{'type':Sequelize[_0x16e9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1bee=['exports','STRING','DATE','BOOLEAN'];(function(_0x46ce98,_0x52d764){var _0x172f46=function(_0x10ccee){while(--_0x10ccee){_0x46ce98['push'](_0x46ce98['shift']());}};_0x172f46(++_0x52d764);}(_0x1bee,0xac));var _0xe1be=function(_0x371f0d,_0x5cfcc2){_0x371f0d=_0x371f0d-0x0;var _0x1728a4=_0x1bee[_0x371f0d];return _0x1728a4;};'use strict';var Sequelize=require('sequelize');module[_0xe1be('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe1be('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe1be('0x1')]},'language':{'type':Sequelize[_0xe1be('0x1')]},'type':{'type':Sequelize[_0xe1be('0x1')]},'uniqueid':{'type':Sequelize[_0xe1be('0x1')]},'version':{'type':Sequelize[_0xe1be('0x1')]},'callerid':{'type':Sequelize[_0xe1be('0x1')]},'calleridname':{'type':Sequelize[_0xe1be('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xe1be('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xe1be('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe1be('0x1')]},'extension':{'type':Sequelize[_0xe1be('0x1')]},'priority':{'type':Sequelize[_0xe1be('0x1')]},'enhanced':{'type':Sequelize[_0xe1be('0x1')]},'accountcode':{'type':Sequelize[_0xe1be('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xe1be('0x1')]},'joinAt':{'type':Sequelize[_0xe1be('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xe1be('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 2842186..62d7b28 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 _0xf98d=['save','then','error','stack','name','send','index','map','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','type','filter','merge','options','includeAll','rows','show','keys','include','catch','create','SquareReport','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x5b129f,_0x26183f){var _0x43b93d=function(_0x56d68d){while(--_0x56d68d){_0x5b129f['push'](_0x5b129f['shift']());}};_0x43b93d(++_0x26183f);}(_0xf98d,0x1dc));var _0xdf98=function(_0x229c10,_0xf06473){_0x229c10=_0x229c10-0x0;var _0xee5e8b=_0xf98d[_0x229c10];return _0xee5e8b;};'use strict';var emlformat=require(_0xdf98('0x0'));var rimraf=require(_0xdf98('0x1'));var zipdir=require(_0xdf98('0x2'));var jsonpatch=require(_0xdf98('0x3'));var rp=require(_0xdf98('0x4'));var moment=require(_0xdf98('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf98('0x6'));var util=require(_0xdf98('0x7'));var path=require(_0xdf98('0x8'));var sox=require(_0xdf98('0x9'));var csv=require(_0xdf98('0xa'));var ejs=require(_0xdf98('0xb'));var fs=require('fs');var fs_extra=require(_0xdf98('0xc'));var _=require(_0xdf98('0xd'));var squel=require(_0xdf98('0xe'));var crypto=require('crypto');var jsforce=require(_0xdf98('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdf98('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdf98('0x10'));var authService=require(_0xdf98('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdf98('0x12'));var hardwareService=require(_0xdf98('0x13'));var logger=require(_0xdf98('0x14'))(_0xdf98('0x15'));var utils=require(_0xdf98('0x16'));var config=require(_0xdf98('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf98('0x18'))['db'];function respondWithStatusCode(_0x16e8e6,_0xeacc78){_0xeacc78=_0xeacc78||0xcc;return function(_0x3c4c52){if(_0x3c4c52){return _0x16e8e6[_0xdf98('0x19')](_0xeacc78);}return _0x16e8e6['status'](_0xeacc78)[_0xdf98('0x1a')]();};}function respondWithResult(_0x5a7c37,_0x55dc10){_0x55dc10=_0x55dc10||0xc8;return function(_0x598720){if(_0x598720){return _0x5a7c37['status'](_0x55dc10)[_0xdf98('0x1b')](_0x598720);}};}function respondWithFilteredResult(_0x3ae05b,_0x19e089){return function(_0x3f6b5a){if(_0x3f6b5a){var _0x2dbb80=typeof _0x19e089[_0xdf98('0x1c')]===_0xdf98('0x1d')&&typeof _0x19e089[_0xdf98('0x1e')]===_0xdf98('0x1d');var _0x3331a6=_0x3f6b5a[_0xdf98('0x1f')];var _0x15960c=_0x2dbb80?0x0:_0x19e089[_0xdf98('0x1c')];var _0x539e5b=_0x2dbb80?_0x3f6b5a[_0xdf98('0x1f')]:_0x19e089[_0xdf98('0x1c')]+_0x19e089[_0xdf98('0x1e')];var _0x2d9046;if(_0x539e5b>=_0x3331a6){_0x539e5b=_0x3331a6;_0x2d9046=0xc8;}else{_0x2d9046=0xce;}_0x3ae05b[_0xdf98('0x20')](_0x2d9046);return _0x3ae05b[_0xdf98('0x21')](_0xdf98('0x22'),_0x15960c+'-'+_0x539e5b+'/'+_0x3331a6)[_0xdf98('0x1b')](_0x3f6b5a);}return null;};}function patchUpdates(_0x551fdb){return function(_0x2cb21a){try{jsonpatch['apply'](_0x2cb21a,_0x551fdb,!![]);}catch(_0x4b81e9){return BPromise['reject'](_0x4b81e9);}return _0x2cb21a[_0xdf98('0x23')]();};}function saveUpdates(_0x5b6c9d,_0x2151e7){return function(_0x587511){if(_0x587511){return _0x587511['update'](_0x5b6c9d)[_0xdf98('0x24')](function(_0x4346af){return _0x4346af;});}return null;};}function removeEntity(_0xa3158f,_0x4ea3b5){return function(_0x53f750){if(_0x53f750){return _0x53f750['destroy']()[_0xdf98('0x24')](function(){_0xa3158f[_0xdf98('0x20')](0xcc)[_0xdf98('0x1a')]();});}};}function handleEntityNotFound(_0x52ffee,_0xcea17){return function(_0xf875bb){if(!_0xf875bb){_0x52ffee[_0xdf98('0x19')](0x194);}return _0xf875bb;};}function handleError(_0x3485aa,_0x4e85d1){_0x4e85d1=_0x4e85d1||0x1f4;return function(_0x523c2f){logger[_0xdf98('0x25')](_0x523c2f[_0xdf98('0x26')]);if(_0x523c2f[_0xdf98('0x27')]){delete _0x523c2f[_0xdf98('0x27')];}_0x3485aa['status'](_0x4e85d1)[_0xdf98('0x28')](_0x523c2f);};}exports[_0xdf98('0x29')]=function(_0x23982d,_0x377720){var _0xe23750={},_0x10edff={},_0x28d870={'count':0x0,'rows':[]};var _0xa00357=_[_0xdf98('0x2a')](db['SquareReport']['rawAttributes'],function(_0x146d96){return{'name':_0x146d96[_0xdf98('0x2b')],'type':_0x146d96['type'][_0xdf98('0x2c')]};});_0x10edff[_0xdf98('0x2d')]=_[_0xdf98('0x2a')](_0xa00357,_0xdf98('0x27'));_0x10edff[_0xdf98('0x2e')]=_['keys'](_0x23982d[_0xdf98('0x2e')]);_0x10edff['filters']=_[_0xdf98('0x2f')](_0x10edff['model'],_0x10edff[_0xdf98('0x2e')]);_0xe23750[_0xdf98('0x30')]=_[_0xdf98('0x2f')](_0x10edff['model'],qs['fields'](_0x23982d[_0xdf98('0x2e')][_0xdf98('0x31')]));_0xe23750[_0xdf98('0x30')]=_0xe23750[_0xdf98('0x30')][_0xdf98('0x32')]?_0xe23750['attributes']:_0x10edff['model'];if(!_0x23982d[_0xdf98('0x2e')]['hasOwnProperty'](_0xdf98('0x33'))){_0xe23750['limit']=qs['limit'](_0x23982d[_0xdf98('0x2e')][_0xdf98('0x1e')]);_0xe23750[_0xdf98('0x1c')]=qs[_0xdf98('0x1c')](_0x23982d[_0xdf98('0x2e')][_0xdf98('0x1c')]);}_0xe23750['order']=qs[_0xdf98('0x34')](_0x23982d['query'][_0xdf98('0x34')]);_0xe23750[_0xdf98('0x35')]=qs[_0xdf98('0x36')](_[_0xdf98('0x37')](_0x23982d[_0xdf98('0x2e')],_0x10edff['filters']),_0xa00357);if(_0x23982d[_0xdf98('0x2e')]['filter']){_0xe23750[_0xdf98('0x35')]=_['merge'](_0xe23750['where'],{'$or':_['map'](_0xa00357,function(_0x80f829){if(_0x80f829[_0xdf98('0x38')]!=='VIRTUAL'){var _0x559738={};_0x559738[_0x80f829['name']]={'$like':'%'+_0x23982d[_0xdf98('0x2e')][_0xdf98('0x39')]+'%'};return _0x559738;}})});}_0xe23750=_[_0xdf98('0x3a')]({},_0xe23750,_0x23982d[_0xdf98('0x3b')]);var _0x562d71={'where':_0xe23750['where']};return db['SquareReport']['count'](_0x562d71)[_0xdf98('0x24')](function(_0x4ed56c){_0x28d870[_0xdf98('0x1f')]=_0x4ed56c;if(_0x23982d[_0xdf98('0x2e')][_0xdf98('0x3c')]){_0xe23750['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0xe23750);})[_0xdf98('0x24')](function(_0x1bbb94){_0x28d870[_0xdf98('0x3d')]=_0x1bbb94;return _0x28d870;})[_0xdf98('0x24')](respondWithFilteredResult(_0x377720,_0xe23750))['catch'](handleError(_0x377720,null));};exports[_0xdf98('0x3e')]=function(_0x151e95,_0x2360f6){var _0x6ba96f={'raw':!![],'where':{'id':_0x151e95['params']['id']}},_0x3bc219={};_0x3bc219['model']=_[_0xdf98('0x3f')](db['SquareReport']['rawAttributes']);_0x3bc219[_0xdf98('0x2e')]=_[_0xdf98('0x3f')](_0x151e95[_0xdf98('0x2e')]);_0x3bc219['filters']=_['intersection'](_0x3bc219[_0xdf98('0x2d')],_0x3bc219[_0xdf98('0x2e')]);_0x6ba96f[_0xdf98('0x30')]=_[_0xdf98('0x2f')](_0x3bc219[_0xdf98('0x2d')],qs[_0xdf98('0x31')](_0x151e95['query'][_0xdf98('0x31')]));_0x6ba96f[_0xdf98('0x30')]=_0x6ba96f['attributes'][_0xdf98('0x32')]?_0x6ba96f[_0xdf98('0x30')]:_0x3bc219['model'];if(_0x151e95[_0xdf98('0x2e')]['includeAll']){_0x6ba96f[_0xdf98('0x40')]=[{'all':!![]}];}_0x6ba96f=_[_0xdf98('0x3a')]({},_0x6ba96f,_0x151e95[_0xdf98('0x3b')]);return db['SquareReport']['find'](_0x6ba96f)[_0xdf98('0x24')](handleEntityNotFound(_0x2360f6,null))[_0xdf98('0x24')](respondWithResult(_0x2360f6,null))[_0xdf98('0x41')](handleError(_0x2360f6,null));};exports[_0xdf98('0x42')]=function(_0x2ce9c5,_0x577b53){return db[_0xdf98('0x43')][_0xdf98('0x42')](_0x2ce9c5[_0xdf98('0x44')],{})[_0xdf98('0x24')](respondWithResult(_0x577b53,0xc9))[_0xdf98('0x41')](handleError(_0x577b53,null));};exports[_0xdf98('0x45')]=function(_0x309b97,_0x189365){if(_0x309b97[_0xdf98('0x44')]['id']){delete _0x309b97[_0xdf98('0x44')]['id'];}return db[_0xdf98('0x43')][_0xdf98('0x46')]({'where':{'id':_0x309b97[_0xdf98('0x47')]['id']}})[_0xdf98('0x24')](handleEntityNotFound(_0x189365,null))[_0xdf98('0x24')](saveUpdates(_0x309b97[_0xdf98('0x44')],null))[_0xdf98('0x24')](respondWithResult(_0x189365,null))['catch'](handleError(_0x189365,null));};exports['destroy']=function(_0x31e90e,_0x335fc9){return db[_0xdf98('0x43')][_0xdf98('0x46')]({'where':{'id':_0x31e90e[_0xdf98('0x47')]['id']}})['then'](handleEntityNotFound(_0x335fc9,null))['then'](removeEntity(_0x335fc9,null))[_0xdf98('0x41')](handleError(_0x335fc9,null));};exports[_0xdf98('0x48')]=function(_0xabeab,_0x179aad){return db[_0xdf98('0x43')][_0xdf98('0x48')]()[_0xdf98('0x24')](respondWithResult(_0x179aad,null))[_0xdf98('0x41')](handleError(_0x179aad,null));}; \ No newline at end of file +var _0xe896=['ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','merge','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x502c1b,_0x4c0673){var _0x1a6456=function(_0x3a3a88){while(--_0x3a3a88){_0x502c1b['push'](_0x502c1b['shift']());}};_0x1a6456(++_0x4c0673);}(_0xe896,0xcf));var _0x6e89=function(_0x34b3b0,_0x1f3ee9){_0x34b3b0=_0x34b3b0-0x0;var _0x175f91=_0xe896[_0x34b3b0];return _0x175f91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e89('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e89('0x1'));var rp=require(_0x6e89('0x2'));var moment=require(_0x6e89('0x3'));var BPromise=require(_0x6e89('0x4'));var Mustache=require('mustache');var util=require(_0x6e89('0x5'));var path=require(_0x6e89('0x6'));var sox=require(_0x6e89('0x7'));var csv=require(_0x6e89('0x8'));var ejs=require(_0x6e89('0x9'));var fs=require('fs');var fs_extra=require(_0x6e89('0xa'));var _=require('lodash');var squel=require(_0x6e89('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e89('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6e89('0xd'));var Papa=require(_0x6e89('0xe'));var Redis=require(_0x6e89('0xf'));var authService=require(_0x6e89('0x10'));var qs=require(_0x6e89('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e89('0x12'));var utils=require('../../config/utils');var config=require(_0x6e89('0x13'));var licenseUtil=require(_0x6e89('0x14'));var db=require(_0x6e89('0x15'))['db'];function respondWithStatusCode(_0x5780ae,_0x5f4dbf){_0x5f4dbf=_0x5f4dbf||0xcc;return function(_0x449f43){if(_0x449f43){return _0x5780ae[_0x6e89('0x16')](_0x5f4dbf);}return _0x5780ae[_0x6e89('0x17')](_0x5f4dbf)[_0x6e89('0x18')]();};}function respondWithResult(_0x450cd6,_0x361ba6){_0x361ba6=_0x361ba6||0xc8;return function(_0x13b102){if(_0x13b102){return _0x450cd6[_0x6e89('0x17')](_0x361ba6)[_0x6e89('0x19')](_0x13b102);}};}function respondWithFilteredResult(_0x438f59,_0x55147c){return function(_0x4d62f3){if(_0x4d62f3){var _0x5000a2=typeof _0x55147c[_0x6e89('0x1a')]===_0x6e89('0x1b')&&typeof _0x55147c[_0x6e89('0x1c')]===_0x6e89('0x1b');var _0x53404c=_0x4d62f3['count'];var _0x186deb=_0x5000a2?0x0:_0x55147c['offset'];var _0x30a48a=_0x5000a2?_0x4d62f3[_0x6e89('0x1d')]:_0x55147c[_0x6e89('0x1a')]+_0x55147c['limit'];var _0x40fd66;if(_0x30a48a>=_0x53404c){_0x30a48a=_0x53404c;_0x40fd66=0xc8;}else{_0x40fd66=0xce;}_0x438f59[_0x6e89('0x17')](_0x40fd66);return _0x438f59[_0x6e89('0x1e')]('Content-Range',_0x186deb+'-'+_0x30a48a+'/'+_0x53404c)[_0x6e89('0x19')](_0x4d62f3);}return null;};}function patchUpdates(_0x1f9b12){return function(_0x476206){try{jsonpatch[_0x6e89('0x1f')](_0x476206,_0x1f9b12,!![]);}catch(_0x36e4d0){return BPromise[_0x6e89('0x20')](_0x36e4d0);}return _0x476206[_0x6e89('0x21')]();};}function saveUpdates(_0x5f32ac,_0x284241){return function(_0x1c9803){if(_0x1c9803){return _0x1c9803[_0x6e89('0x22')](_0x5f32ac)['then'](function(_0x40ee19){return _0x40ee19;});}return null;};}function removeEntity(_0x3066d0,_0x5c1e35){return function(_0x21c214){if(_0x21c214){return _0x21c214['destroy']()[_0x6e89('0x23')](function(){_0x3066d0['status'](0xcc)[_0x6e89('0x18')]();});}};}function handleEntityNotFound(_0x125e2b,_0x1e5e7a){return function(_0x2b72f0){if(!_0x2b72f0){_0x125e2b[_0x6e89('0x16')](0x194);}return _0x2b72f0;};}function handleError(_0x363565,_0x1fcc04){_0x1fcc04=_0x1fcc04||0x1f4;return function(_0x13eaf8){logger['error'](_0x13eaf8[_0x6e89('0x24')]);if(_0x13eaf8[_0x6e89('0x25')]){delete _0x13eaf8[_0x6e89('0x25')];}_0x363565['status'](_0x1fcc04)[_0x6e89('0x26')](_0x13eaf8);};}exports[_0x6e89('0x27')]=function(_0x5cb5d0,_0x18a11a){var _0x26ba23={},_0x4d3440={},_0x4f19b2={'count':0x0,'rows':[]};var _0xc1c025=_[_0x6e89('0x28')](db[_0x6e89('0x29')][_0x6e89('0x2a')],function(_0x51b62a){return{'name':_0x51b62a[_0x6e89('0x2b')],'type':_0x51b62a['type']['key']};});_0x4d3440[_0x6e89('0x2c')]=_[_0x6e89('0x28')](_0xc1c025,'name');_0x4d3440[_0x6e89('0x2d')]=_[_0x6e89('0x2e')](_0x5cb5d0[_0x6e89('0x2d')]);_0x4d3440[_0x6e89('0x2f')]=_[_0x6e89('0x30')](_0x4d3440['model'],_0x4d3440[_0x6e89('0x2d')]);_0x26ba23[_0x6e89('0x31')]=_[_0x6e89('0x30')](_0x4d3440[_0x6e89('0x2c')],qs['fields'](_0x5cb5d0['query']['fields']));_0x26ba23[_0x6e89('0x31')]=_0x26ba23[_0x6e89('0x31')][_0x6e89('0x32')]?_0x26ba23[_0x6e89('0x31')]:_0x4d3440[_0x6e89('0x2c')];if(!_0x5cb5d0[_0x6e89('0x2d')][_0x6e89('0x33')](_0x6e89('0x34'))){_0x26ba23['limit']=qs[_0x6e89('0x1c')](_0x5cb5d0[_0x6e89('0x2d')][_0x6e89('0x1c')]);_0x26ba23[_0x6e89('0x1a')]=qs[_0x6e89('0x1a')](_0x5cb5d0[_0x6e89('0x2d')][_0x6e89('0x1a')]);}_0x26ba23['order']=qs[_0x6e89('0x35')](_0x5cb5d0[_0x6e89('0x2d')]['sort']);_0x26ba23[_0x6e89('0x36')]=qs[_0x6e89('0x2f')](_[_0x6e89('0x37')](_0x5cb5d0[_0x6e89('0x2d')],_0x4d3440[_0x6e89('0x2f')]),_0xc1c025);if(_0x5cb5d0[_0x6e89('0x2d')]['filter']){_0x26ba23[_0x6e89('0x36')]=_['merge'](_0x26ba23[_0x6e89('0x36')],{'$or':_[_0x6e89('0x28')](_0xc1c025,function(_0x3adfa1){if(_0x3adfa1['type']!==_0x6e89('0x38')){var _0x2423ed={};_0x2423ed[_0x3adfa1['name']]={'$like':'%'+_0x5cb5d0[_0x6e89('0x2d')]['filter']+'%'};return _0x2423ed;}})});}_0x26ba23=_['merge']({},_0x26ba23,_0x5cb5d0[_0x6e89('0x39')]);var _0x224374={'where':_0x26ba23[_0x6e89('0x36')]};return db[_0x6e89('0x29')][_0x6e89('0x1d')](_0x224374)[_0x6e89('0x23')](function(_0x58c7ea){_0x4f19b2['count']=_0x58c7ea;if(_0x5cb5d0[_0x6e89('0x2d')][_0x6e89('0x3a')]){_0x26ba23[_0x6e89('0x3b')]=[{'all':!![]}];}return db['SquareReport'][_0x6e89('0x3c')](_0x26ba23);})[_0x6e89('0x23')](function(_0x346761){_0x4f19b2[_0x6e89('0x3d')]=_0x346761;return _0x4f19b2;})['then'](respondWithFilteredResult(_0x18a11a,_0x26ba23))[_0x6e89('0x3e')](handleError(_0x18a11a,null));};exports[_0x6e89('0x3f')]=function(_0x1ac6b6,_0x293d85){var _0x501dfb={'raw':!![],'where':{'id':_0x1ac6b6[_0x6e89('0x40')]['id']}},_0xba5422={};_0xba5422['model']=_[_0x6e89('0x2e')](db[_0x6e89('0x29')][_0x6e89('0x2a')]);_0xba5422['query']=_[_0x6e89('0x2e')](_0x1ac6b6[_0x6e89('0x2d')]);_0xba5422[_0x6e89('0x2f')]=_[_0x6e89('0x30')](_0xba5422[_0x6e89('0x2c')],_0xba5422[_0x6e89('0x2d')]);_0x501dfb[_0x6e89('0x31')]=_['intersection'](_0xba5422[_0x6e89('0x2c')],qs['fields'](_0x1ac6b6[_0x6e89('0x2d')][_0x6e89('0x41')]));_0x501dfb[_0x6e89('0x31')]=_0x501dfb[_0x6e89('0x31')][_0x6e89('0x32')]?_0x501dfb['attributes']:_0xba5422['model'];if(_0x1ac6b6[_0x6e89('0x2d')][_0x6e89('0x3a')]){_0x501dfb[_0x6e89('0x3b')]=[{'all':!![]}];}_0x501dfb=_[_0x6e89('0x42')]({},_0x501dfb,_0x1ac6b6[_0x6e89('0x39')]);return db[_0x6e89('0x29')][_0x6e89('0x43')](_0x501dfb)[_0x6e89('0x23')](handleEntityNotFound(_0x293d85,null))['then'](respondWithResult(_0x293d85,null))[_0x6e89('0x3e')](handleError(_0x293d85,null));};exports['create']=function(_0x46a24f,_0x30f81b){return db[_0x6e89('0x29')][_0x6e89('0x44')](_0x46a24f[_0x6e89('0x45')],{})[_0x6e89('0x23')](respondWithResult(_0x30f81b,0xc9))['catch'](handleError(_0x30f81b,null));};exports[_0x6e89('0x22')]=function(_0x38db2e,_0x9d5e4f){if(_0x38db2e['body']['id']){delete _0x38db2e[_0x6e89('0x45')]['id'];}return db[_0x6e89('0x29')][_0x6e89('0x43')]({'where':{'id':_0x38db2e[_0x6e89('0x40')]['id']}})[_0x6e89('0x23')](handleEntityNotFound(_0x9d5e4f,null))[_0x6e89('0x23')](saveUpdates(_0x38db2e[_0x6e89('0x45')],null))[_0x6e89('0x23')](respondWithResult(_0x9d5e4f,null))[_0x6e89('0x3e')](handleError(_0x9d5e4f,null));};exports[_0x6e89('0x46')]=function(_0xc12d20,_0x1a4b50){return db[_0x6e89('0x29')][_0x6e89('0x43')]({'where':{'id':_0xc12d20[_0x6e89('0x40')]['id']}})[_0x6e89('0x23')](handleEntityNotFound(_0x1a4b50,null))[_0x6e89('0x23')](removeEntity(_0x1a4b50,null))[_0x6e89('0x3e')](handleError(_0x1a4b50,null));};exports[_0x6e89('0x47')]=function(_0x4c4f01,_0x1ceac6){return db[_0x6e89('0x29')]['describe']()['then'](respondWithResult(_0x1ceac6,null))[_0x6e89('0x3e')](handleError(_0x1ceac6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7e58610..e29c338 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 _0xe194=['rimraf','../../config/environment','define','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x16286a,_0x11e9cf){var _0x5b6524=function(_0x5b6b9a){while(--_0x5b6b9a){_0x16286a['push'](_0x16286a['shift']());}};_0x5b6524(++_0x11e9cf);}(_0xe194,0xe6));var _0x4e19=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0xe194[_0x2dc343];return _0x51eac5;};'use strict';var _=require(_0x4e19('0x0'));var util=require(_0x4e19('0x1'));var logger=require(_0x4e19('0x2'))(_0x4e19('0x3'));var moment=require(_0x4e19('0x4'));var BPromise=require(_0x4e19('0x5'));var rp=require(_0x4e19('0x6'));var fs=require('fs');var path=require(_0x4e19('0x7'));var rimraf=require(_0x4e19('0x8'));var config=require(_0x4e19('0x9'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x1fe936,_0x3fd8ab){return _0x1fe936[_0x4e19('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x4e19('0xb'),'fields':[_0x4e19('0xc'),'project_name']},{'name':_0x4e19('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb52f=['path','../../config/environment','./squareReport.attributes','exports','report_square','uid_pname','uniqueid','project_name','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3975cc,_0x2d4619){var _0x24f0ba=function(_0x49f59c){while(--_0x49f59c){_0x3975cc['push'](_0x3975cc['shift']());}};_0x24f0ba(++_0x2d4619);}(_0xb52f,0x134));var _0xfb52=function(_0x2a2370,_0x375a9b){_0x2a2370=_0x2a2370-0x0;var _0x1c94c1=_0xb52f[_0x2a2370];return _0x1c94c1;};'use strict';var _=require(_0xfb52('0x0'));var util=require(_0xfb52('0x1'));var logger=require(_0xfb52('0x2'))(_0xfb52('0x3'));var moment=require(_0xfb52('0x4'));var BPromise=require(_0xfb52('0x5'));var rp=require(_0xfb52('0x6'));var fs=require('fs');var path=require(_0xfb52('0x7'));var rimraf=require('rimraf');var config=require(_0xfb52('0x8'));var attributes=require(_0xfb52('0x9'));module[_0xfb52('0xa')]=function(_0x548234,_0x40a488){return _0x548234['define']('SquareReport',attributes,{'tableName':_0xfb52('0xb'),'paranoid':![],'indexes':[{'name':_0xfb52('0xc'),'fields':[_0xfb52('0xd'),_0xfb52('0xe')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4e3f13a..9528b8f 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 _0x18ec=['error','code','message','catch','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport','update','where','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x18ec,0x1c1));var _0xc18e=function(_0x56a502,_0x32dade){_0x56a502=_0x56a502-0x0;var _0xa94418=_0x18ec[_0x56a502];return _0xa94418;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc18e('0x0'));var BPromise=require('bluebird');var rs=require(_0xc18e('0x1'));var fs=require('fs');var Redis=require(_0xc18e('0x2'));var db=require(_0xc18e('0x3'))['db'];var utils=require(_0xc18e('0x4'));var logger=require(_0xc18e('0x5'))(_0xc18e('0x6'));var config=require('../../config/environment');var jayson=require(_0xc18e('0x7'));var client=jayson[_0xc18e('0x8')][_0xc18e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb60b81,_0x4d47e9,_0x18b80e){return new BPromise(function(_0x43f44f,_0x3f165a){return client['request'](_0xb60b81,_0x18b80e)[_0xc18e('0xa')](function(_0x5ecdef){logger[_0xc18e('0xb')](_0xc18e('0xc'),_0x4d47e9,_0xc18e('0xd'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4d47e9,'request\x20sent',JSON[_0xc18e('0xe')](_0x5ecdef));if(_0x5ecdef[_0xc18e('0xf')]){if(_0x5ecdef[_0xc18e('0xf')][_0xc18e('0x10')]===0x1f4){logger['error'](_0xc18e('0xc'),_0x4d47e9,_0x5ecdef['error'][_0xc18e('0x11')]);return _0x3f165a(_0x5ecdef[_0xc18e('0xf')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x4d47e9,_0x5ecdef[_0xc18e('0xf')]['message']);return _0x43f44f(_0x5ecdef[_0xc18e('0xf')][_0xc18e('0x11')]);}else{logger['info'](_0xc18e('0xc'),_0x4d47e9,'request\x20sent');_0x43f44f(_0x5ecdef['result'][_0xc18e('0x11')]);}})[_0xc18e('0x12')](function(_0x16f9f){logger['error'](_0xc18e('0xc'),_0x4d47e9,_0x16f9f);_0x3f165a(_0x16f9f);});});}exports[_0xc18e('0x13')]=function(_0x458f0e){var _0x3ef827=this;return new Promise(function(_0x46a9c5,_0x744c90){return db[_0xc18e('0x14')]['create'](_0x458f0e[_0xc18e('0x15')],{'raw':_0x458f0e[_0xc18e('0x16')]?_0x458f0e[_0xc18e('0x16')][_0xc18e('0x17')]===undefined?!![]:![]:!![]})[_0xc18e('0xa')](function(_0x4743bc){logger['info'](_0xc18e('0x13'),_0x458f0e);logger[_0xc18e('0x18')](_0xc18e('0x13'),_0x458f0e,JSON['stringify'](_0x4743bc));_0x46a9c5(_0x4743bc);})[_0xc18e('0x12')](function(_0x54e6ab){logger[_0xc18e('0xf')](_0xc18e('0x13'),_0x54e6ab[_0xc18e('0x11')],_0x458f0e);_0x744c90(_0x3ef827['error'](0x1f4,_0x54e6ab[_0xc18e('0x11')]));});});};exports[_0xc18e('0x19')]=function(_0x24722b){var _0x374567=this;return new Promise(function(_0x55ae37,_0x2ec4db){return db['SquareReport'][_0xc18e('0x1a')](_0x24722b['body'],{'raw':_0x24722b[_0xc18e('0x16')]?_0x24722b[_0xc18e('0x16')][_0xc18e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24722b[_0xc18e('0x16')]?_0x24722b[_0xc18e('0x16')][_0xc18e('0x1b')]||null:null,'attributes':_0x24722b['options']?_0x24722b[_0xc18e('0x16')]['attributes']||null:null,'limit':_0x24722b['options']?_0x24722b[_0xc18e('0x16')][_0xc18e('0x1c')]||null:null})['then'](function(_0x55a383){logger[_0xc18e('0xb')](_0xc18e('0x19'),_0x24722b);logger[_0xc18e('0x18')](_0xc18e('0x19'),_0x24722b,JSON['stringify'](_0x55a383));_0x55ae37(_0x55a383);})[_0xc18e('0x12')](function(_0x46b9e4){logger['error'](_0xc18e('0x19'),_0x46b9e4['message'],_0x24722b);_0x2ec4db(_0x374567[_0xc18e('0xf')](0x1f4,_0x46b9e4[_0xc18e('0x11')]));});});}; \ No newline at end of file +var _0x48b4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','body','options','debug','CreateSquareReport','UpdateSquareReport','update','raw','limit','then','lodash','util','moment','bluebird','randomstring'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x48b4,0x64));var _0x448b=function(_0x2b1076,_0x3cafca){_0x2b1076=_0x2b1076-0x0;var _0x5e9860=_0x48b4[_0x2b1076];return _0x5e9860;};'use strict';var _=require(_0x448b('0x0'));var util=require(_0x448b('0x1'));var moment=require(_0x448b('0x2'));var BPromise=require(_0x448b('0x3'));var rs=require(_0x448b('0x4'));var fs=require('fs');var Redis=require(_0x448b('0x5'));var db=require(_0x448b('0x6'))['db'];var utils=require(_0x448b('0x7'));var logger=require(_0x448b('0x8'))(_0x448b('0x9'));var config=require(_0x448b('0xa'));var jayson=require(_0x448b('0xb'));var client=jayson[_0x448b('0xc')][_0x448b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x69595f,_0x318e28,_0x19e302){return new BPromise(function(_0x53ac5b,_0x49eef2){return client[_0x448b('0xe')](_0x69595f,_0x19e302)['then'](function(_0x4dda9a){logger[_0x448b('0xf')](_0x448b('0x10'),_0x318e28,_0x448b('0x11'));logger['debug'](_0x448b('0x12'),_0x318e28,'request\x20sent',JSON[_0x448b('0x13')](_0x4dda9a));if(_0x4dda9a['error']){if(_0x4dda9a[_0x448b('0x14')][_0x448b('0x15')]===0x1f4){logger[_0x448b('0x14')](_0x448b('0x10'),_0x318e28,_0x4dda9a['error'][_0x448b('0x16')]);return _0x49eef2(_0x4dda9a[_0x448b('0x14')][_0x448b('0x16')]);}logger[_0x448b('0x14')](_0x448b('0x10'),_0x318e28,_0x4dda9a[_0x448b('0x14')][_0x448b('0x16')]);return _0x53ac5b(_0x4dda9a[_0x448b('0x14')]['message']);}else{logger[_0x448b('0xf')](_0x448b('0x10'),_0x318e28,_0x448b('0x11'));_0x53ac5b(_0x4dda9a[_0x448b('0x17')][_0x448b('0x16')]);}})[_0x448b('0x18')](function(_0x5b4880){logger[_0x448b('0x14')](_0x448b('0x10'),_0x318e28,_0x5b4880);_0x49eef2(_0x5b4880);});});}exports['CreateSquareReport']=function(_0x2169c8){var _0x4dd9f5=this;return new Promise(function(_0x254cf4,_0x364538){return db[_0x448b('0x19')]['create'](_0x2169c8[_0x448b('0x1a')],{'raw':_0x2169c8[_0x448b('0x1b')]?_0x2169c8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x8083ab){logger[_0x448b('0xf')]('CreateSquareReport',_0x2169c8);logger[_0x448b('0x1c')]('CreateSquareReport',_0x2169c8,JSON[_0x448b('0x13')](_0x8083ab));_0x254cf4(_0x8083ab);})[_0x448b('0x18')](function(_0x3dc277){logger[_0x448b('0x14')](_0x448b('0x1d'),_0x3dc277[_0x448b('0x16')],_0x2169c8);_0x364538(_0x4dd9f5[_0x448b('0x14')](0x1f4,_0x3dc277[_0x448b('0x16')]));});});};exports[_0x448b('0x1e')]=function(_0xce9da7){var _0xc62a67=this;return new Promise(function(_0x59eb62,_0x1593bd){return db['SquareReport'][_0x448b('0x1f')](_0xce9da7['body'],{'raw':_0xce9da7[_0x448b('0x1b')]?_0xce9da7['options'][_0x448b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce9da7[_0x448b('0x1b')]?_0xce9da7[_0x448b('0x1b')]['where']||null:null,'attributes':_0xce9da7['options']?_0xce9da7[_0x448b('0x1b')]['attributes']||null:null,'limit':_0xce9da7[_0x448b('0x1b')]?_0xce9da7[_0x448b('0x1b')][_0x448b('0x21')]||null:null})[_0x448b('0x22')](function(_0x3941df){logger[_0x448b('0xf')](_0x448b('0x1e'),_0xce9da7);logger[_0x448b('0x1c')](_0x448b('0x1e'),_0xce9da7,JSON['stringify'](_0x3941df));_0x59eb62(_0x3941df);})['catch'](function(_0x2ba9a9){logger[_0x448b('0x14')](_0x448b('0x1e'),_0x2ba9a9[_0x448b('0x16')],_0xce9da7);_0x1593bd(_0xc62a67[_0x448b('0x14')](0x1f4,_0x2ba9a9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index aca36cc..c492521 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 _0x4601=['post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','describe'];(function(_0x310c2a,_0x207c56){var _0x1c0d7e=function(_0x27783f){while(--_0x27783f){_0x310c2a['push'](_0x310c2a['shift']());}};_0x1c0d7e(++_0x207c56);}(_0x4601,0x170));var _0x1460=function(_0x14ddea,_0x538aa1){_0x14ddea=_0x14ddea-0x0;var _0x7e77fd=_0x4601[_0x14ddea];return _0x7e77fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1460('0x0'));var timeout=require(_0x1460('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1460('0x2'));var auth=require(_0x1460('0x3'));var interaction=require(_0x1460('0x4'));var config=require(_0x1460('0x5'));var controller=require(_0x1460('0x6'));router['get']('/',auth[_0x1460('0x7')](),controller['index']);router[_0x1460('0x8')]('/describe',auth[_0x1460('0x7')](),controller[_0x1460('0x9')]);router[_0x1460('0x8')]('/:id',auth[_0x1460('0x7')](),controller['show']);router[_0x1460('0xa')]('/',auth['isAuthenticated'](),controller[_0x1460('0xb')]);router[_0x1460('0xc')](_0x1460('0xd'),auth[_0x1460('0x7')](),controller[_0x1460('0xe')]);router[_0x1460('0xf')](_0x1460('0xd'),auth[_0x1460('0x7')](),controller[_0x1460('0x10')]);module[_0x1460('0x11')]=router; \ No newline at end of file +var _0x3b02=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x3b02,0x1ca));var _0x23b0=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x3b02[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x23b0('0x0'));var util=require(_0x23b0('0x1'));var path=require(_0x23b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x23b0('0x3'));var router=express[_0x23b0('0x4')]();var fs_extra=require(_0x23b0('0x5'));var auth=require(_0x23b0('0x6'));var interaction=require(_0x23b0('0x7'));var config=require('../../config/environment');var controller=require(_0x23b0('0x8'));router['get']('/',auth[_0x23b0('0x9')](),controller[_0x23b0('0xa')]);router[_0x23b0('0xb')](_0x23b0('0xc'),auth[_0x23b0('0x9')](),controller[_0x23b0('0xd')]);router[_0x23b0('0xb')](_0x23b0('0xe'),auth[_0x23b0('0x9')](),controller[_0x23b0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x23b0('0x10')]);router[_0x23b0('0x11')](_0x23b0('0xe'),auth['isAuthenticated'](),controller[_0x23b0('0x12')]);router[_0x23b0('0x13')](_0x23b0('0xe'),auth[_0x23b0('0x9')](),controller[_0x23b0('0x14')]);module[_0x23b0('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 35e5c1c..38b3d93 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 _0xcabc=['STRING','sequelize','exports'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0xcabc,0x85));var _0xccab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcabc[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xccab('0x0'));module[_0xccab('0x1')]={'uniqueid':{'type':Sequelize[_0xccab('0x2')]},'node':{'type':Sequelize[_0xccab('0x2')]},'application':{'type':Sequelize[_0xccab('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xccab('0x2')]},'callerid':{'type':Sequelize[_0xccab('0x2')]}}; \ No newline at end of file +var _0xf590=['STRING','TEXT','sequelize','exports'];(function(_0x58ee67,_0x84e358){var _0x155bde=function(_0x37707b){while(--_0x37707b){_0x58ee67['push'](_0x58ee67['shift']());}};_0x155bde(++_0x84e358);}(_0xf590,0x7a));var _0x0f59=function(_0x15b042,_0x23fd98){_0x15b042=_0x15b042-0x0;var _0x440fb0=_0xf590[_0x15b042];return _0x440fb0;};'use strict';var Sequelize=require(_0x0f59('0x0'));module[_0x0f59('0x1')]={'uniqueid':{'type':Sequelize[_0x0f59('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0f59('0x2')]},'data':{'type':Sequelize[_0x0f59('0x3')]},'project_name':{'type':Sequelize[_0x0f59('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 234bae5..18f2682 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 _0xda3f=['count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','request-promise','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','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','status','end','json','offset','undefined','limit'];(function(_0x2b5c90,_0xe47c1e){var _0x11a3e3=function(_0x39577e){while(--_0x39577e){_0x2b5c90['push'](_0x2b5c90['shift']());}};_0x11a3e3(++_0xe47c1e);}(_0xda3f,0x18b));var _0xfda3=function(_0x15fd6d,_0x2ed5da){_0x15fd6d=_0x15fd6d-0x0;var _0x57f253=_0xda3f[_0x15fd6d];return _0x57f253;};'use strict';var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfda3('0x2'));var moment=require(_0xfda3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require(_0xfda3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfda3('0x8'));var squel=require('squel');var crypto=require(_0xfda3('0x9'));var jsforce=require(_0xfda3('0xa'));var deskjs=require(_0xfda3('0xb'));var toCsv=require(_0xfda3('0x6'));var querystring=require('querystring');var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require(_0xfda3('0x12'))(_0xfda3('0x13'));var utils=require(_0xfda3('0x14'));var config=require(_0xfda3('0x15'));var licenseUtil=require(_0xfda3('0x16'));var db=require(_0xfda3('0x17'))['db'];function respondWithStatusCode(_0x404641,_0x75d245){_0x75d245=_0x75d245||0xcc;return function(_0x9d6d8d){if(_0x9d6d8d){return _0x404641[_0xfda3('0x18')](_0x75d245);}return _0x404641[_0xfda3('0x19')](_0x75d245)[_0xfda3('0x1a')]();};}function respondWithResult(_0xc7e77b,_0x562390){_0x562390=_0x562390||0xc8;return function(_0x431bb5){if(_0x431bb5){return _0xc7e77b[_0xfda3('0x19')](_0x562390)[_0xfda3('0x1b')](_0x431bb5);}};}function respondWithFilteredResult(_0xf50151,_0x23f393){return function(_0x3cfc84){if(_0x3cfc84){var _0x1867f5=typeof _0x23f393[_0xfda3('0x1c')]===_0xfda3('0x1d')&&typeof _0x23f393[_0xfda3('0x1e')]===_0xfda3('0x1d');var _0x2f2756=_0x3cfc84[_0xfda3('0x1f')];var _0x237d50=_0x1867f5?0x0:_0x23f393[_0xfda3('0x1c')];var _0x602673=_0x1867f5?_0x3cfc84[_0xfda3('0x1f')]:_0x23f393[_0xfda3('0x1c')]+_0x23f393[_0xfda3('0x1e')];var _0xab9d61;if(_0x602673>=_0x2f2756){_0x602673=_0x2f2756;_0xab9d61=0xc8;}else{_0xab9d61=0xce;}_0xf50151[_0xfda3('0x19')](_0xab9d61);return _0xf50151['set'](_0xfda3('0x20'),_0x237d50+'-'+_0x602673+'/'+_0x2f2756)[_0xfda3('0x1b')](_0x3cfc84);}return null;};}function patchUpdates(_0x25cbc4){return function(_0x5788fb){try{jsonpatch[_0xfda3('0x21')](_0x5788fb,_0x25cbc4,!![]);}catch(_0x5b1606){return BPromise['reject'](_0x5b1606);}return _0x5788fb[_0xfda3('0x22')]();};}function saveUpdates(_0x5652b2,_0x35c073){return function(_0x17a6c2){if(_0x17a6c2){return _0x17a6c2[_0xfda3('0x23')](_0x5652b2)[_0xfda3('0x24')](function(_0x5735e7){return _0x5735e7;});}return null;};}function removeEntity(_0x34bcd8,_0x57d8fe){return function(_0x157e11){if(_0x157e11){return _0x157e11[_0xfda3('0x25')]()[_0xfda3('0x24')](function(){_0x34bcd8[_0xfda3('0x19')](0xcc)[_0xfda3('0x1a')]();});}};}function handleEntityNotFound(_0x2f9b64,_0x20c31e){return function(_0x107ce0){if(!_0x107ce0){_0x2f9b64[_0xfda3('0x18')](0x194);}return _0x107ce0;};}function handleError(_0x3df316,_0x1d3d43){_0x1d3d43=_0x1d3d43||0x1f4;return function(_0x51f324){logger[_0xfda3('0x26')](_0x51f324[_0xfda3('0x27')]);if(_0x51f324[_0xfda3('0x28')]){delete _0x51f324[_0xfda3('0x28')];}_0x3df316[_0xfda3('0x19')](_0x1d3d43)[_0xfda3('0x29')](_0x51f324);};}exports['index']=function(_0x55ca72,_0x3b0537){var _0x33deec={},_0x3e3cc2={},_0x18ace4={'count':0x0,'rows':[]};var _0x3df53e=_[_0xfda3('0x2a')](db[_0xfda3('0x2b')]['rawAttributes'],function(_0xa19f77){return{'name':_0xa19f77['fieldName'],'type':_0xa19f77[_0xfda3('0x2c')]['key']};});_0x3e3cc2[_0xfda3('0x2d')]=_['map'](_0x3df53e,_0xfda3('0x28'));_0x3e3cc2['query']=_[_0xfda3('0x2e')](_0x55ca72[_0xfda3('0x2f')]);_0x3e3cc2[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x3e3cc2[_0xfda3('0x2d')],_0x3e3cc2['query']);_0x33deec[_0xfda3('0x32')]=_[_0xfda3('0x31')](_0x3e3cc2[_0xfda3('0x2d')],qs['fields'](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x33')]));_0x33deec[_0xfda3('0x32')]=_0x33deec['attributes'][_0xfda3('0x34')]?_0x33deec[_0xfda3('0x32')]:_0x3e3cc2[_0xfda3('0x2d')];if(!_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x35')](_0xfda3('0x36'))){_0x33deec[_0xfda3('0x1e')]=qs['limit'](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x1e')]);_0x33deec[_0xfda3('0x1c')]=qs[_0xfda3('0x1c')](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x1c')]);}_0x33deec[_0xfda3('0x37')]=qs[_0xfda3('0x38')](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x38')]);_0x33deec[_0xfda3('0x39')]=qs[_0xfda3('0x30')](_['pick'](_0x55ca72[_0xfda3('0x2f')],_0x3e3cc2[_0xfda3('0x30')]),_0x3df53e);if(_0x55ca72[_0xfda3('0x2f')]['filter']){_0x33deec[_0xfda3('0x39')]=_['merge'](_0x33deec[_0xfda3('0x39')],{'$or':_[_0xfda3('0x2a')](_0x3df53e,function(_0x1e293b){if(_0x1e293b['type']!==_0xfda3('0x3a')){var _0xd079b4={};_0xd079b4[_0x1e293b[_0xfda3('0x28')]]={'$like':'%'+_0x55ca72[_0xfda3('0x2f')]['filter']+'%'};return _0xd079b4;}})});}_0x33deec=_['merge']({},_0x33deec,_0x55ca72['options']);var _0x470e68={'where':_0x33deec[_0xfda3('0x39')]};return db[_0xfda3('0x2b')][_0xfda3('0x1f')](_0x470e68)[_0xfda3('0x24')](function(_0x4c1f6c){_0x18ace4[_0xfda3('0x1f')]=_0x4c1f6c;if(_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x3b')]){_0x33deec[_0xfda3('0x3c')]=[{'all':!![]}];}return db[_0xfda3('0x2b')][_0xfda3('0x3d')](_0x33deec);})[_0xfda3('0x24')](function(_0x1cb60e){_0x18ace4[_0xfda3('0x3e')]=_0x1cb60e;return _0x18ace4;})[_0xfda3('0x24')](respondWithFilteredResult(_0x3b0537,_0x33deec))[_0xfda3('0x3f')](handleError(_0x3b0537,null));};exports[_0xfda3('0x40')]=function(_0x5c1360,_0x387810){var _0x3793a7={'raw':!![],'where':{'id':_0x5c1360[_0xfda3('0x41')]['id']}},_0x297abf={};_0x297abf[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](db[_0xfda3('0x2b')]['rawAttributes']);_0x297abf['query']=_[_0xfda3('0x2e')](_0x5c1360[_0xfda3('0x2f')]);_0x297abf['filters']=_[_0xfda3('0x31')](_0x297abf[_0xfda3('0x2d')],_0x297abf['query']);_0x3793a7['attributes']=_['intersection'](_0x297abf['model'],qs['fields'](_0x5c1360[_0xfda3('0x2f')][_0xfda3('0x33')]));_0x3793a7[_0xfda3('0x32')]=_0x3793a7['attributes'][_0xfda3('0x34')]?_0x3793a7[_0xfda3('0x32')]:_0x297abf[_0xfda3('0x2d')];if(_0x5c1360[_0xfda3('0x2f')]['includeAll']){_0x3793a7[_0xfda3('0x3c')]=[{'all':!![]}];}_0x3793a7=_[_0xfda3('0x42')]({},_0x3793a7,_0x5c1360['options']);return db[_0xfda3('0x2b')][_0xfda3('0x43')](_0x3793a7)[_0xfda3('0x24')](handleEntityNotFound(_0x387810,null))[_0xfda3('0x24')](respondWithResult(_0x387810,null))[_0xfda3('0x3f')](handleError(_0x387810,null));};exports[_0xfda3('0x44')]=function(_0x367f6a,_0x37d76a){return db[_0xfda3('0x2b')]['create'](_0x367f6a[_0xfda3('0x45')],{})[_0xfda3('0x24')](respondWithResult(_0x37d76a,0xc9))[_0xfda3('0x3f')](handleError(_0x37d76a,null));};exports[_0xfda3('0x23')]=function(_0x5064a8,_0x3f6698){if(_0x5064a8[_0xfda3('0x45')]['id']){delete _0x5064a8[_0xfda3('0x45')]['id'];}return db[_0xfda3('0x2b')]['find']({'where':{'id':_0x5064a8[_0xfda3('0x41')]['id']}})[_0xfda3('0x24')](handleEntityNotFound(_0x3f6698,null))[_0xfda3('0x24')](saveUpdates(_0x5064a8[_0xfda3('0x45')],null))[_0xfda3('0x24')](respondWithResult(_0x3f6698,null))[_0xfda3('0x3f')](handleError(_0x3f6698,null));};exports[_0xfda3('0x25')]=function(_0x253110,_0x5c2aa9){return db[_0xfda3('0x2b')][_0xfda3('0x43')]({'where':{'id':_0x253110[_0xfda3('0x41')]['id']}})[_0xfda3('0x24')](handleEntityNotFound(_0x5c2aa9,null))[_0xfda3('0x24')](removeEntity(_0x5c2aa9,null))[_0xfda3('0x3f')](handleError(_0x5c2aa9,null));};exports[_0xfda3('0x46')]=function(_0x5d3f8c,_0x513e07){return db[_0xfda3('0x2b')][_0xfda3('0x46')]()[_0xfda3('0x24')](respondWithResult(_0x513e07,null))[_0xfda3('0x3f')](handleError(_0x513e07,null));}; \ No newline at end of file +var _0x34a6=['request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../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','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','order','sort','pick','filter','merge','VIRTUAL','where','count','includeAll','include','rows','params','intersection','options','find','create','body','catch','update','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x564af5,_0x3a0e84){var _0x13d195=function(_0xdbb749){while(--_0xdbb749){_0x564af5['push'](_0x564af5['shift']());}};_0x13d195(++_0x3a0e84);}(_0x34a6,0x94));var _0x634a=function(_0x4b5b57,_0x3ac00b){_0x4b5b57=_0x4b5b57-0x0;var _0x147273=_0x34a6[_0x4b5b57];return _0x147273;};'use strict';var emlformat=require(_0x634a('0x0'));var rimraf=require(_0x634a('0x1'));var zipdir=require(_0x634a('0x2'));var jsonpatch=require(_0x634a('0x3'));var rp=require(_0x634a('0x4'));var moment=require(_0x634a('0x5'));var BPromise=require(_0x634a('0x6'));var Mustache=require(_0x634a('0x7'));var util=require(_0x634a('0x8'));var path=require('path');var sox=require(_0x634a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x634a('0xa'));var _=require(_0x634a('0xb'));var squel=require(_0x634a('0xc'));var crypto=require('crypto');var jsforce=require(_0x634a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x634a('0xe'));var querystring=require(_0x634a('0xf'));var Papa=require('papaparse');var Redis=require(_0x634a('0x10'));var authService=require(_0x634a('0x11'));var qs=require(_0x634a('0x12'));var as=require(_0x634a('0x13'));var hardwareService=require(_0x634a('0x14'));var logger=require(_0x634a('0x15'))(_0x634a('0x16'));var utils=require('../../config/utils');var config=require(_0x634a('0x17'));var licenseUtil=require(_0x634a('0x18'));var db=require(_0x634a('0x19'))['db'];function respondWithStatusCode(_0x306bd5,_0x3db679){_0x3db679=_0x3db679||0xcc;return function(_0x56ef04){if(_0x56ef04){return _0x306bd5[_0x634a('0x1a')](_0x3db679);}return _0x306bd5[_0x634a('0x1b')](_0x3db679)[_0x634a('0x1c')]();};}function respondWithResult(_0x394023,_0x86aeda){_0x86aeda=_0x86aeda||0xc8;return function(_0x1ffd7b){if(_0x1ffd7b){return _0x394023[_0x634a('0x1b')](_0x86aeda)[_0x634a('0x1d')](_0x1ffd7b);}};}function respondWithFilteredResult(_0x23473c,_0x6c8dcf){return function(_0x51a538){if(_0x51a538){var _0x252aec=typeof _0x6c8dcf[_0x634a('0x1e')]===_0x634a('0x1f')&&typeof _0x6c8dcf[_0x634a('0x20')]===_0x634a('0x1f');var _0x27d114=_0x51a538['count'];var _0x4e4540=_0x252aec?0x0:_0x6c8dcf[_0x634a('0x1e')];var _0x523122=_0x252aec?_0x51a538['count']:_0x6c8dcf['offset']+_0x6c8dcf[_0x634a('0x20')];var _0x386206;if(_0x523122>=_0x27d114){_0x523122=_0x27d114;_0x386206=0xc8;}else{_0x386206=0xce;}_0x23473c[_0x634a('0x1b')](_0x386206);return _0x23473c[_0x634a('0x21')](_0x634a('0x22'),_0x4e4540+'-'+_0x523122+'/'+_0x27d114)[_0x634a('0x1d')](_0x51a538);}return null;};}function patchUpdates(_0x2663a1){return function(_0x43c4c4){try{jsonpatch[_0x634a('0x23')](_0x43c4c4,_0x2663a1,!![]);}catch(_0x1b0932){return BPromise[_0x634a('0x24')](_0x1b0932);}return _0x43c4c4[_0x634a('0x25')]();};}function saveUpdates(_0x333b0e,_0x4e33a9){return function(_0x1cdc7a){if(_0x1cdc7a){return _0x1cdc7a['update'](_0x333b0e)['then'](function(_0xbf6608){return _0xbf6608;});}return null;};}function removeEntity(_0x2fa070,_0x3bb5c8){return function(_0x3d26f0){if(_0x3d26f0){return _0x3d26f0[_0x634a('0x26')]()[_0x634a('0x27')](function(){_0x2fa070[_0x634a('0x1b')](0xcc)[_0x634a('0x1c')]();});}};}function handleEntityNotFound(_0x584d14,_0x252c5c){return function(_0x199b31){if(!_0x199b31){_0x584d14[_0x634a('0x1a')](0x194);}return _0x199b31;};}function handleError(_0x3a39fb,_0x5d885d){_0x5d885d=_0x5d885d||0x1f4;return function(_0x230a94){logger[_0x634a('0x28')](_0x230a94[_0x634a('0x29')]);if(_0x230a94[_0x634a('0x2a')]){delete _0x230a94[_0x634a('0x2a')];}_0x3a39fb[_0x634a('0x1b')](_0x5d885d)['send'](_0x230a94);};}exports['index']=function(_0x57b379,_0x1b819f){var _0x1c30b6={},_0x515846={},_0x58ea15={'count':0x0,'rows':[]};var _0x29f4db=_['map'](db[_0x634a('0x2b')][_0x634a('0x2c')],function(_0x5a63d1){return{'name':_0x5a63d1[_0x634a('0x2d')],'type':_0x5a63d1[_0x634a('0x2e')][_0x634a('0x2f')]};});_0x515846[_0x634a('0x30')]=_[_0x634a('0x31')](_0x29f4db,'name');_0x515846[_0x634a('0x32')]=_[_0x634a('0x33')](_0x57b379[_0x634a('0x32')]);_0x515846[_0x634a('0x34')]=_['intersection'](_0x515846[_0x634a('0x30')],_0x515846[_0x634a('0x32')]);_0x1c30b6[_0x634a('0x35')]=_['intersection'](_0x515846[_0x634a('0x30')],qs[_0x634a('0x36')](_0x57b379['query'][_0x634a('0x36')]));_0x1c30b6[_0x634a('0x35')]=_0x1c30b6['attributes'][_0x634a('0x37')]?_0x1c30b6[_0x634a('0x35')]:_0x515846[_0x634a('0x30')];if(!_0x57b379[_0x634a('0x32')]['hasOwnProperty']('nolimit')){_0x1c30b6[_0x634a('0x20')]=qs[_0x634a('0x20')](_0x57b379['query'][_0x634a('0x20')]);_0x1c30b6[_0x634a('0x1e')]=qs[_0x634a('0x1e')](_0x57b379[_0x634a('0x32')][_0x634a('0x1e')]);}_0x1c30b6[_0x634a('0x38')]=qs['sort'](_0x57b379[_0x634a('0x32')][_0x634a('0x39')]);_0x1c30b6['where']=qs[_0x634a('0x34')](_[_0x634a('0x3a')](_0x57b379[_0x634a('0x32')],_0x515846[_0x634a('0x34')]),_0x29f4db);if(_0x57b379[_0x634a('0x32')][_0x634a('0x3b')]){_0x1c30b6['where']=_[_0x634a('0x3c')](_0x1c30b6['where'],{'$or':_['map'](_0x29f4db,function(_0x5a7aa4){if(_0x5a7aa4[_0x634a('0x2e')]!==_0x634a('0x3d')){var _0x276130={};_0x276130[_0x5a7aa4[_0x634a('0x2a')]]={'$like':'%'+_0x57b379[_0x634a('0x32')]['filter']+'%'};return _0x276130;}})});}_0x1c30b6=_[_0x634a('0x3c')]({},_0x1c30b6,_0x57b379['options']);var _0x4b2e62={'where':_0x1c30b6[_0x634a('0x3e')]};return db[_0x634a('0x2b')]['count'](_0x4b2e62)[_0x634a('0x27')](function(_0x3a60fe){_0x58ea15[_0x634a('0x3f')]=_0x3a60fe;if(_0x57b379[_0x634a('0x32')][_0x634a('0x40')]){_0x1c30b6[_0x634a('0x41')]=[{'all':!![]}];}return db[_0x634a('0x2b')]['findAll'](_0x1c30b6);})[_0x634a('0x27')](function(_0x2105ba){_0x58ea15[_0x634a('0x42')]=_0x2105ba;return _0x58ea15;})[_0x634a('0x27')](respondWithFilteredResult(_0x1b819f,_0x1c30b6))['catch'](handleError(_0x1b819f,null));};exports['show']=function(_0x44a0f8,_0x5b2e35){var _0x4647dd={'raw':!![],'where':{'id':_0x44a0f8[_0x634a('0x43')]['id']}},_0xb42058={};_0xb42058['model']=_[_0x634a('0x33')](db[_0x634a('0x2b')]['rawAttributes']);_0xb42058[_0x634a('0x32')]=_[_0x634a('0x33')](_0x44a0f8[_0x634a('0x32')]);_0xb42058['filters']=_[_0x634a('0x44')](_0xb42058[_0x634a('0x30')],_0xb42058[_0x634a('0x32')]);_0x4647dd[_0x634a('0x35')]=_[_0x634a('0x44')](_0xb42058[_0x634a('0x30')],qs['fields'](_0x44a0f8['query'][_0x634a('0x36')]));_0x4647dd[_0x634a('0x35')]=_0x4647dd[_0x634a('0x35')]['length']?_0x4647dd[_0x634a('0x35')]:_0xb42058[_0x634a('0x30')];if(_0x44a0f8[_0x634a('0x32')][_0x634a('0x40')]){_0x4647dd[_0x634a('0x41')]=[{'all':!![]}];}_0x4647dd=_[_0x634a('0x3c')]({},_0x4647dd,_0x44a0f8[_0x634a('0x45')]);return db[_0x634a('0x2b')][_0x634a('0x46')](_0x4647dd)[_0x634a('0x27')](handleEntityNotFound(_0x5b2e35,null))[_0x634a('0x27')](respondWithResult(_0x5b2e35,null))['catch'](handleError(_0x5b2e35,null));};exports['create']=function(_0x5b4af7,_0x5adbb5){return db[_0x634a('0x2b')][_0x634a('0x47')](_0x5b4af7[_0x634a('0x48')],{})[_0x634a('0x27')](respondWithResult(_0x5adbb5,0xc9))[_0x634a('0x49')](handleError(_0x5adbb5,null));};exports[_0x634a('0x4a')]=function(_0x33a6af,_0x7a011){if(_0x33a6af[_0x634a('0x48')]['id']){delete _0x33a6af[_0x634a('0x48')]['id'];}return db[_0x634a('0x2b')]['find']({'where':{'id':_0x33a6af[_0x634a('0x43')]['id']}})[_0x634a('0x27')](handleEntityNotFound(_0x7a011,null))[_0x634a('0x27')](saveUpdates(_0x33a6af[_0x634a('0x48')],null))[_0x634a('0x27')](respondWithResult(_0x7a011,null))[_0x634a('0x49')](handleError(_0x7a011,null));};exports[_0x634a('0x26')]=function(_0x42c0d5,_0x313448){return db[_0x634a('0x2b')][_0x634a('0x46')]({'where':{'id':_0x42c0d5[_0x634a('0x43')]['id']}})[_0x634a('0x27')](handleEntityNotFound(_0x313448,null))['then'](removeEntity(_0x313448,null))['catch'](handleError(_0x313448,null));};exports['describe']=function(_0x49b39e,_0x4608b8){return db[_0x634a('0x2b')][_0x634a('0x4b')]()['then'](respondWithResult(_0x4608b8,null))[_0x634a('0x49')](handleError(_0x4608b8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c7e4c6c..e7c6096 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 _0xb984=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger'];(function(_0x291f17,_0x38a815){var _0xf91269=function(_0x5d016b){while(--_0x5d016b){_0x291f17['push'](_0x291f17['shift']());}};_0xf91269(++_0x38a815);}(_0xb984,0x1b8));var _0x4b98=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb984[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x4b98('0x0'));var logger=require(_0x4b98('0x1'))(_0x4b98('0x2'));var moment=require(_0x4b98('0x3'));var BPromise=require(_0x4b98('0x4'));var rp=require(_0x4b98('0x5'));var fs=require('fs');var path=require(_0x4b98('0x6'));var rimraf=require(_0x4b98('0x7'));var config=require(_0x4b98('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x4b98('0x9')]=function(_0x18706b,_0x5b831a){return _0x18706b[_0x4b98('0xa')](_0x4b98('0xb'),attributes,{'tableName':_0x4b98('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c2c=['../../config/logger','api','bluebird','rimraf','../../config/environment','./squareReportDetail.attributes','define','lodash','util'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x6c2c,0x10c));var _0xc6c2=function(_0x3305cb,_0x25e7b9){_0x3305cb=_0x3305cb-0x0;var _0x3615d6=_0x6c2c[_0x3305cb];return _0x3615d6;};'use strict';var _=require(_0xc6c2('0x0'));var util=require(_0xc6c2('0x1'));var logger=require(_0xc6c2('0x2'))(_0xc6c2('0x3'));var moment=require('moment');var BPromise=require(_0xc6c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc6c2('0x5'));var config=require(_0xc6c2('0x6'));var attributes=require(_0xc6c2('0x7'));module['exports']=function(_0x13b2bd,_0x44b6e4){return _0x13b2bd[_0xc6c2('0x8')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','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 be9d08a..d7fcb33 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 _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util'];(function(_0x2862fd,_0x409ded){var _0x2ce33b=function(_0x5a5c18){while(--_0x5a5c18){_0x2862fd['push'](_0x2862fd['shift']());}};_0x2ce33b(++_0x409ded);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateSquareDetailsReport',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateSquareDetailsReport',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});}; \ No newline at end of file +var _0xaebd=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareDetailsReport,\x20%s,\x20%s','catch','CreateSquareDetailsReport','create','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x129514,_0x554582){var _0x5c15af=function(_0xa2580b){while(--_0xa2580b){_0x129514['push'](_0x129514['shift']());}};_0x5c15af(++_0x554582);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x387bf1,_0x51fddf){_0x387bf1=_0x387bf1-0x0;var _0x2c3ee7=_0xaebd[_0x387bf1];return _0x2c3ee7;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['SquareDetailsReport'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e97e0){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x19')](_0xdaeb('0x15'),_0x1b5243,JSON[_0xdaeb('0x10')](_0x4e97e0));_0x2d8f11(_0x4e97e0);})['catch'](function(_0x597bb7){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x597bb7[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x597bb7[_0xdaeb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 0bdfd56..176cce0 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 _0x78b0=['Router','get','isAuthenticated','killProcess','exports'];(function(_0x5d0365,_0x1bde60){var _0x580e71=function(_0x4fed4a){while(--_0x4fed4a){_0x5d0365['push'](_0x5d0365['shift']());}};_0x580e71(++_0x1bde60);}(_0x78b0,0x136));var _0x078b=function(_0x5da875,_0x475a8b){_0x5da875=_0x5da875-0x0;var _0x25d687=_0x78b0[_0x5da875];return _0x25d687;};'use strict';var express=require('express');var router=express[_0x078b('0x0')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x078b('0x1')]('/',auth[_0x078b('0x2')](),controller['index']);router[_0x078b('0x1')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x078b('0x3')]);module[_0x078b('0x4')]=router; \ No newline at end of file +var _0x6b09=['/process/:pid/kill','express','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x6b09,0xe1));var _0x96b0=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0x6b09[_0x537c37];return _0x241f84;};'use strict';var express=require(_0x96b0('0x0'));var router=express['Router']();var auth=require(_0x96b0('0x1'));var controller=require(_0x96b0('0x2'));router['get']('/',auth[_0x96b0('0x3')](),controller[_0x96b0('0x4')]);router[_0x96b0('0x5')](_0x96b0('0x6'),auth[_0x96b0('0x3')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 2040e2b..62da6d5 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 _0x3494=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','catch','killProcess','components/import/cm','format','pid'];(function(_0x3a26dd,_0x6f1232){var _0x12b0c5=function(_0x53289f){while(--_0x53289f){_0x3a26dd['push'](_0x3a26dd['shift']());}};_0x12b0c5(++_0x6f1232);}(_0x3494,0x69));var _0x4349=function(_0x136c2,_0x2e896d){_0x136c2=_0x136c2-0x0;var _0x4bb87b=_0x3494[_0x136c2];return _0x4bb87b;};'use strict';var info=require(_0x4349('0x0'));var exec=require(_0x4349('0x1'))[_0x4349('0x2')];var logger=require(_0x4349('0x3'))(_0x4349('0x4'));var util=require('util');var BPromise=require(_0x4349('0x5'));var _=require('lodash');function handleError(_0x2f07ff,_0x508144,_0x455e30){_0x508144=_0x508144||0x1f4;return function(_0xa7afbe){logger[_0x4349('0x6')](_0x4349('0x7'),_0x455e30,_0x508144,util[_0x4349('0x8')](_0xa7afbe,{'showHidden':![],'depth':null}));delete _0xa7afbe[_0x4349('0x9')];_0x2f07ff[_0x4349('0xa')](_0x508144)[_0x4349('0xb')](_0xa7afbe);};}exports[_0x4349('0xc')]=function(_0x4552d1,_0x56cb1f){return info['getAllData']()[_0x4349('0xd')](function(_0x56cc6a){return _0x56cb1f[_0x4349('0xa')](0xc8)[_0x4349('0xe')](_0x56cc6a);})[_0x4349('0xf')](function(_0x20dabc){return _0x56cb1f[_0x4349('0xa')](0x1f4)[_0x4349('0xe')](_0x20dabc);});};exports[_0x4349('0x10')]=function(_0x1daded,_0x2f98bb){var _0x38ad68=[_0x4349('0x11')];return new BPromise(function(_0x9c77ec,_0x1fd6d7){return exec(util[_0x4349('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1daded['params'][_0x4349('0x13')]),function(_0xf788e9,_0x465e8c,_0x2fcdca){if(_0xf788e9){return _0x1fd6d7(_0xf788e9);}return _0x9c77ec(_0x465e8c);});})[_0x4349('0xd')](function(_0x123da0){var _0x412f55=![];var _0x539af3=_0x123da0['split'](/\n/);for(var _0x269313=0x0,_0x485b69=_0x38ad68['length'];_0x269313<_0x485b69,_0x412f55===![];_0x269313+=0x1){if(_0x123da0[_0x4349('0x14')](_0x38ad68[_0x269313])>=0x0){_0x412f55=!![];}}if(!_0x412f55){throw new Error(util[_0x4349('0x12')](_0x4349('0x15'),_0x1daded[_0x4349('0x16')]['pid']));}process['kill'](_0x1daded[_0x4349('0x16')][_0x4349('0x13')],_0x4349('0x17'));return _0x2f98bb[_0x4349('0xa')](0xc8)['json']({'message':util[_0x4349('0x12')](_0x4349('0x18'),_0x1daded[_0x4349('0x16')][_0x4349('0x13')])});})[_0x4349('0xf')](handleError(_0x2f98bb,null,_0x4349('0x10')));}; \ No newline at end of file +var _0xa285=['../../config/logger','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec'];(function(_0x5c015e,_0x4aa5f1){var _0x5ae308=function(_0x5dd098){while(--_0x5dd098){_0x5c015e['push'](_0x5c015e['shift']());}};_0x5ae308(++_0x4aa5f1);}(_0xa285,0x106));var _0x5a28=function(_0x14ea70,_0xb97bbd){_0x14ea70=_0x14ea70-0x0;var _0x1dbaff=_0xa285[_0x14ea70];return _0x1dbaff;};'use strict';var info=require(_0x5a28('0x0'));var exec=require('child_process')[_0x5a28('0x1')];var logger=require(_0x5a28('0x2'))('api');var util=require(_0x5a28('0x3'));var BPromise=require(_0x5a28('0x4'));var _=require('lodash');function handleError(_0x4fa077,_0x544ee5,_0x3c5727){_0x544ee5=_0x544ee5||0x1f4;return function(_0x1f882c){logger['error'](_0x5a28('0x5'),_0x3c5727,_0x544ee5,util['inspect'](_0x1f882c,{'showHidden':![],'depth':null}));delete _0x1f882c['name'];_0x4fa077[_0x5a28('0x6')](_0x544ee5)[_0x5a28('0x7')](_0x1f882c);};}exports['index']=function(_0x259658,_0x24de98){return info[_0x5a28('0x8')]()['then'](function(_0x378a4f){return _0x24de98[_0x5a28('0x6')](0xc8)[_0x5a28('0x9')](_0x378a4f);})[_0x5a28('0xa')](function(_0x535228){return _0x24de98[_0x5a28('0x6')](0x1f4)[_0x5a28('0x9')](_0x535228);});};exports[_0x5a28('0xb')]=function(_0x4af098,_0xe96b65){var _0x421f56=[_0x5a28('0xc')];return new BPromise(function(_0x180c7e,_0x5cdb6a){return exec(util[_0x5a28('0xd')](_0x5a28('0xe'),_0x4af098[_0x5a28('0xf')][_0x5a28('0x10')]),function(_0x42d987,_0x309203,_0x12cfae){if(_0x42d987){return _0x5cdb6a(_0x42d987);}return _0x180c7e(_0x309203);});})[_0x5a28('0x11')](function(_0x70c47f){var _0xa6d843=![];var _0x2e9bd5=_0x70c47f[_0x5a28('0x12')](/\n/);for(var _0x25ef3b=0x0,_0x45bffc=_0x421f56[_0x5a28('0x13')];_0x25ef3b<_0x45bffc,_0xa6d843===![];_0x25ef3b+=0x1){if(_0x70c47f['indexOf'](_0x421f56[_0x25ef3b])>=0x0){_0xa6d843=!![];}}if(!_0xa6d843){throw new Error(util['format'](_0x5a28('0x14'),_0x4af098[_0x5a28('0xf')][_0x5a28('0x10')]));}process[_0x5a28('0x15')](_0x4af098[_0x5a28('0xf')][_0x5a28('0x10')],_0x5a28('0x16'));return _0xe96b65[_0x5a28('0x6')](0xc8)[_0x5a28('0x9')]({'message':util[_0x5a28('0xd')](_0x5a28('0x17'),_0x4af098['params'][_0x5a28('0x10')])});})[_0x5a28('0xa')](handleError(_0xe96b65,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 17f1d24..56b3a8a 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 _0x77e6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','get','show','post','create','/:id','update','delete'];(function(_0x1345e7,_0x4995b1){var _0x517ee4=function(_0x109587){while(--_0x109587){_0x1345e7['push'](_0x1345e7['shift']());}};_0x517ee4(++_0x4995b1);}(_0x77e6,0x1a6));var _0x677e=function(_0x4274fa,_0x4c947b){_0x4274fa=_0x4274fa-0x0;var _0x44d379=_0x77e6[_0x4274fa];return _0x44d379;};'use strict';var multer=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var path=require(_0x677e('0x2'));var timeout=require(_0x677e('0x3'));var express=require(_0x677e('0x4'));var router=express[_0x677e('0x5')]();var fs_extra=require(_0x677e('0x6'));var auth=require(_0x677e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x677e('0x8'));var controller=require(_0x677e('0x9'));router['get']('/',auth[_0x677e('0xa')](),controller['index']);router[_0x677e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x677e('0xc')]);router[_0x677e('0xd')]('/',auth[_0x677e('0xa')](),controller[_0x677e('0xe')]);router['put'](_0x677e('0xf'),auth['isAuthenticated'](),controller[_0x677e('0x10')]);router[_0x677e('0x11')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x12')]);module[_0x677e('0x13')]=router; \ No newline at end of file +var _0x7b5f=['isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','show','post'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x7b5f,0x1ac));var _0xf7b5=function(_0x27da56,_0x349d47){_0x27da56=_0x27da56-0x0;var _0x4b2c79=_0x7b5f[_0x27da56];return _0x4b2c79;};'use strict';var multer=require(_0xf7b5('0x0'));var util=require(_0xf7b5('0x1'));var path=require(_0xf7b5('0x2'));var timeout=require(_0xf7b5('0x3'));var express=require('express');var router=express[_0xf7b5('0x4')]();var fs_extra=require(_0xf7b5('0x5'));var auth=require(_0xf7b5('0x6'));var interaction=require(_0xf7b5('0x7'));var config=require(_0xf7b5('0x8'));var controller=require(_0xf7b5('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf7b5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xf7b5('0xb')]);router[_0xf7b5('0xc')]('/',auth[_0xf7b5('0xd')](),controller[_0xf7b5('0xe')]);router[_0xf7b5('0xf')](_0xf7b5('0x10'),auth[_0xf7b5('0xd')](),controller[_0xf7b5('0x11')]);router[_0xf7b5('0x12')](_0xf7b5('0x10'),auth[_0xf7b5('0xd')](),controller[_0xf7b5('0x13')]);module[_0xf7b5('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f0274b5..1b554f4 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 _0xd48a=['name','#0091EA','sequelize','STRING'];(function(_0x15fe21,_0x2a4dbe){var _0x2e5271=function(_0x40d41e){while(--_0x40d41e){_0x15fe21['push'](_0x15fe21['shift']());}};_0x2e5271(++_0x2a4dbe);}(_0xd48a,0x96));var _0xad48=function(_0x21c1b3,_0x554f2f){_0x21c1b3=_0x21c1b3-0x0;var _0x4f1df2=_0xd48a[_0x21c1b3];return _0x4f1df2;};'use strict';var Sequelize=require(_0xad48('0x0'));module['exports']={'name':{'type':Sequelize[_0xad48('0x1')],'unique':_0xad48('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xad48('0x1')],'defaultValue':_0xad48('0x3')},'description':{'type':Sequelize[_0xad48('0x1')]}}; \ No newline at end of file +var _0x85cf=['name','#0091EA','exports','STRING'];(function(_0x109559,_0x12f5bc){var _0x1b6802=function(_0x2f5eaa){while(--_0x2f5eaa){_0x109559['push'](_0x109559['shift']());}};_0x1b6802(++_0x12f5bc);}(_0x85cf,0x76));var _0xf85c=function(_0x2ff385,_0x1b4fd1){_0x2ff385=_0x2ff385-0x0;var _0xb7f492=_0x85cf[_0x2ff385];return _0xb7f492;};'use strict';var Sequelize=require('sequelize');module[_0xf85c('0x0')]={'name':{'type':Sequelize[_0xf85c('0x1')],'unique':_0xf85c('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf85c('0x1')],'defaultValue':_0xf85c('0x3')},'description':{'type':Sequelize[_0xf85c('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9dcc2fd..9031466 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 _0x91a7=['moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','rimraf','zip-dir','fast-json-patch'];(function(_0x216f9d,_0x203068){var _0x15674b=function(_0x41746e){while(--_0x41746e){_0x216f9d['push'](_0x216f9d['shift']());}};_0x15674b(++_0x203068);}(_0x91a7,0xe7));var _0x791a=function(_0x5c0108,_0x580023){_0x5c0108=_0x5c0108-0x0;var _0x5ba34a=_0x91a7[_0x5c0108];return _0x5ba34a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':!![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['Tag'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));}; \ No newline at end of file +var _0x6f0d=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','show','params','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys'];(function(_0x7a7cab,_0x203843){var _0x27f6ea=function(_0x2c1343){while(--_0x2c1343){_0x7a7cab['push'](_0x7a7cab['shift']());}};_0x27f6ea(++_0x203843);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x14f62f,_0x4b5fcb){_0x14f62f=_0x14f62f-0x0;var _0x264ade=_0x6f0d[_0x14f62f];return _0x264ade;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];function respondWithStatusCode(_0x306aad,_0x45973d){_0x45973d=_0x45973d||0xcc;return function(_0x109655){if(_0x109655){return _0x306aad[_0xd6f0('0x19')](_0x45973d);}return _0x306aad[_0xd6f0('0x1a')](_0x45973d)[_0xd6f0('0x1b')]();};}function respondWithResult(_0x246dad,_0x4ab979){_0x4ab979=_0x4ab979||0xc8;return function(_0x2b3f32){if(_0x2b3f32){return _0x246dad[_0xd6f0('0x1a')](_0x4ab979)['json'](_0x2b3f32);}};}function respondWithFilteredResult(_0x419b7e,_0x593abe){return function(_0x3f4851){if(_0x3f4851){var _0x154e3e=typeof _0x593abe[_0xd6f0('0x1c')]===_0xd6f0('0x1d')&&typeof _0x593abe[_0xd6f0('0x1e')]===_0xd6f0('0x1d');var _0x25da0c=_0x3f4851[_0xd6f0('0x1f')];var _0x2e71bd=_0x154e3e?0x0:_0x593abe[_0xd6f0('0x1c')];var _0x23ab6c=_0x154e3e?_0x3f4851[_0xd6f0('0x1f')]:_0x593abe[_0xd6f0('0x1c')]+_0x593abe[_0xd6f0('0x1e')];var _0x1f43d7;if(_0x23ab6c>=_0x25da0c){_0x23ab6c=_0x25da0c;_0x1f43d7=0xc8;}else{_0x1f43d7=0xce;}_0x419b7e[_0xd6f0('0x1a')](_0x1f43d7);return _0x419b7e['set']('Content-Range',_0x2e71bd+'-'+_0x23ab6c+'/'+_0x25da0c)[_0xd6f0('0x20')](_0x3f4851);}return null;};}function patchUpdates(_0x264104){return function(_0x1158dc){try{jsonpatch['apply'](_0x1158dc,_0x264104,!![]);}catch(_0x67afa7){return BPromise[_0xd6f0('0x21')](_0x67afa7);}return _0x1158dc['save']();};}function saveUpdates(_0x86dde0,_0x515687){return function(_0x1ee584){if(_0x1ee584){return _0x1ee584[_0xd6f0('0x22')](_0x86dde0)['then'](function(_0xb9e820){return _0xb9e820;});}return null;};}function removeEntity(_0x45e99c,_0x5ea2dd){return function(_0x3dbdc3){if(_0x3dbdc3){return _0x3dbdc3[_0xd6f0('0x23')]()[_0xd6f0('0x24')](function(){var _0x5b1a62=_0x3dbdc3[_0xd6f0('0x25')]({'plain':!![]});var _0x3dc166='Tags';return db[_0xd6f0('0x26')]['destroy']({'where':{'type':_0x3dc166,'resourceId':_0x5b1a62['id']}})[_0xd6f0('0x24')](function(){return _0x3dbdc3;});})[_0xd6f0('0x24')](function(){_0x45e99c[_0xd6f0('0x1a')](0xcc)[_0xd6f0('0x1b')]();});}};}function handleEntityNotFound(_0x4101bd,_0x715aab){return function(_0x12d6ec){if(!_0x12d6ec){_0x4101bd[_0xd6f0('0x19')](0x194);}return _0x12d6ec;};}function handleError(_0x48975d,_0x1ea941){_0x1ea941=_0x1ea941||0x1f4;return function(_0x1982d3){logger['error'](_0x1982d3[_0xd6f0('0x27')]);if(_0x1982d3[_0xd6f0('0x28')]){delete _0x1982d3[_0xd6f0('0x28')];}_0x48975d[_0xd6f0('0x1a')](_0x1ea941)[_0xd6f0('0x29')](_0x1982d3);};}exports[_0xd6f0('0x2a')]=function(_0x351fda,_0x3151f8){var _0x465cf9={},_0x43f72f={},_0x1dff9b={'count':0x0,'rows':[]};var _0x3e913a=_[_0xd6f0('0x2b')](db[_0xd6f0('0x2c')][_0xd6f0('0x2d')],function(_0x2d7c90){return{'name':_0x2d7c90[_0xd6f0('0x2e')],'type':_0x2d7c90[_0xd6f0('0x2f')][_0xd6f0('0x30')]};});_0x43f72f[_0xd6f0('0x31')]=_[_0xd6f0('0x2b')](_0x3e913a,_0xd6f0('0x28'));_0x43f72f['query']=_[_0xd6f0('0x32')](_0x351fda['query']);_0x43f72f['filters']=_[_0xd6f0('0x33')](_0x43f72f[_0xd6f0('0x31')],_0x43f72f[_0xd6f0('0x34')]);_0x465cf9[_0xd6f0('0x35')]=_[_0xd6f0('0x33')](_0x43f72f['model'],qs[_0xd6f0('0x36')](_0x351fda['query'][_0xd6f0('0x36')]));_0x465cf9[_0xd6f0('0x35')]=_0x465cf9[_0xd6f0('0x35')][_0xd6f0('0x37')]?_0x465cf9[_0xd6f0('0x35')]:_0x43f72f['model'];if(!_0x351fda['query'][_0xd6f0('0x38')](_0xd6f0('0x39'))){_0x465cf9['limit']=qs[_0xd6f0('0x1e')](_0x351fda['query'][_0xd6f0('0x1e')]);_0x465cf9[_0xd6f0('0x1c')]=qs[_0xd6f0('0x1c')](_0x351fda[_0xd6f0('0x34')][_0xd6f0('0x1c')]);}_0x465cf9[_0xd6f0('0x3a')]=qs[_0xd6f0('0x3b')](_0x351fda['query']['sort']);_0x465cf9[_0xd6f0('0x3c')]=qs[_0xd6f0('0x3d')](_[_0xd6f0('0x3e')](_0x351fda['query'],_0x43f72f['filters']),_0x3e913a);if(_0x351fda[_0xd6f0('0x34')][_0xd6f0('0x3f')]){_0x465cf9[_0xd6f0('0x3c')]=_[_0xd6f0('0x40')](_0x465cf9[_0xd6f0('0x3c')],{'$or':_[_0xd6f0('0x2b')](_0x3e913a,function(_0x2e9043){if(_0x2e9043[_0xd6f0('0x2f')]!=='VIRTUAL'){var _0x1af620={};_0x1af620[_0x2e9043[_0xd6f0('0x28')]]={'$like':'%'+_0x351fda[_0xd6f0('0x34')][_0xd6f0('0x3f')]+'%'};return _0x1af620;}})});}_0x465cf9=_['merge']({},_0x465cf9,_0x351fda[_0xd6f0('0x41')]);var _0x94ec6d={'where':_0x465cf9[_0xd6f0('0x3c')]};return db[_0xd6f0('0x2c')][_0xd6f0('0x1f')](_0x94ec6d)['then'](function(_0x332809){_0x1dff9b[_0xd6f0('0x1f')]=_0x332809;if(_0x351fda[_0xd6f0('0x34')]['includeAll']){_0x465cf9[_0xd6f0('0x42')]=[{'all':!![]}];}return db[_0xd6f0('0x2c')]['findAll'](_0x465cf9);})['then'](function(_0x9cffd4){_0x1dff9b[_0xd6f0('0x43')]=_0x9cffd4;return _0x1dff9b;})[_0xd6f0('0x24')](respondWithFilteredResult(_0x3151f8,_0x465cf9))['catch'](handleError(_0x3151f8,null));};exports[_0xd6f0('0x44')]=function(_0x2d32f0,_0x57c2b6){var _0x362509={'raw':!![],'where':{'id':_0x2d32f0[_0xd6f0('0x45')]['id']}},_0x3080eb={};_0x3080eb[_0xd6f0('0x31')]=_['keys'](db[_0xd6f0('0x2c')][_0xd6f0('0x2d')]);_0x3080eb[_0xd6f0('0x34')]=_[_0xd6f0('0x32')](_0x2d32f0[_0xd6f0('0x34')]);_0x3080eb[_0xd6f0('0x3d')]=_[_0xd6f0('0x33')](_0x3080eb[_0xd6f0('0x31')],_0x3080eb['query']);_0x362509[_0xd6f0('0x35')]=_[_0xd6f0('0x33')](_0x3080eb['model'],qs[_0xd6f0('0x36')](_0x2d32f0[_0xd6f0('0x34')][_0xd6f0('0x36')]));_0x362509[_0xd6f0('0x35')]=_0x362509['attributes'][_0xd6f0('0x37')]?_0x362509[_0xd6f0('0x35')]:_0x3080eb['model'];if(_0x2d32f0['query'][_0xd6f0('0x46')]){_0x362509['include']=[{'all':!![]}];}_0x362509=_[_0xd6f0('0x40')]({},_0x362509,_0x2d32f0[_0xd6f0('0x41')]);return db[_0xd6f0('0x2c')]['find'](_0x362509)[_0xd6f0('0x24')](handleEntityNotFound(_0x57c2b6,null))[_0xd6f0('0x24')](respondWithResult(_0x57c2b6,null))[_0xd6f0('0x47')](handleError(_0x57c2b6,null));};exports[_0xd6f0('0x48')]=function(_0xc4147e,_0x4c42ce){return db[_0xd6f0('0x2c')]['create'](_0xc4147e[_0xd6f0('0x49')],{})[_0xd6f0('0x24')](function(_0x2eb338){var _0x1dc320=_0xc4147e['user']['get']({'plain':!![]});if(!_0x1dc320)throw new Error(_0xd6f0('0x4a'));if(_0x1dc320[_0xd6f0('0x4b')]==='user'){var _0xa68b18=_0x2eb338['get']({'plain':!![]});var _0xb5fc29=_0xd6f0('0x4c');return db[_0xd6f0('0x4d')][_0xd6f0('0x4e')]({'where':{'name':_0xb5fc29,'userProfileId':_0x1dc320[_0xd6f0('0x4f')]},'raw':!![]})['then'](function(_0x232757){if(_0x232757&&_0x232757[_0xd6f0('0x50')]===0x0){return db[_0xd6f0('0x26')][_0xd6f0('0x48')]({'name':_0xa68b18[_0xd6f0('0x28')],'resourceId':_0xa68b18['id'],'type':_0x232757[_0xd6f0('0x28')],'sectionId':_0x232757['id']},{})[_0xd6f0('0x24')](function(){return _0x2eb338;});}else{return _0x2eb338;}})[_0xd6f0('0x47')](function(_0x5eb262){logger[_0xd6f0('0x51')](_0xd6f0('0x52'),_0x5eb262);throw _0x5eb262;});}return _0x2eb338;})[_0xd6f0('0x24')](respondWithResult(_0x4c42ce,0xc9))[_0xd6f0('0x47')](handleError(_0x4c42ce,null));};exports[_0xd6f0('0x22')]=function(_0x3c8861,_0x43563d){if(_0x3c8861[_0xd6f0('0x49')]['id']){delete _0x3c8861[_0xd6f0('0x49')]['id'];}return db['Tag'][_0xd6f0('0x4e')]({'where':{'id':_0x3c8861['params']['id']}})['then'](handleEntityNotFound(_0x43563d,null))[_0xd6f0('0x24')](saveUpdates(_0x3c8861['body'],null))['then'](respondWithResult(_0x43563d,null))[_0xd6f0('0x47')](handleError(_0x43563d,null));};exports[_0xd6f0('0x23')]=function(_0x8c6f9c,_0x47a159){return db[_0xd6f0('0x2c')][_0xd6f0('0x4e')]({'where':{'id':_0x8c6f9c[_0xd6f0('0x45')]['id']}})['then'](handleEntityNotFound(_0x47a159,null))[_0xd6f0('0x24')](removeEntity(_0x47a159,null))[_0xd6f0('0x47')](handleError(_0x47a159,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8c50a97..c6dc05c 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 _0x0605=['util','api','moment','bluebird','request-promise','path','../../config/environment','./tag.attributes','exports','Tag','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0605,0x1c2));var _0x5060=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x0605[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x5060('0x0'));var util=require(_0x5060('0x1'));var logger=require('../../config/logger')(_0x5060('0x2'));var moment=require(_0x5060('0x3'));var BPromise=require(_0x5060('0x4'));var rp=require(_0x5060('0x5'));var fs=require('fs');var path=require(_0x5060('0x6'));var rimraf=require('rimraf');var config=require(_0x5060('0x7'));var attributes=require(_0x5060('0x8'));module[_0x5060('0x9')]=function(_0x594867,_0x27aae3){return _0x594867['define'](_0x5060('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50aa=['Tag','tools_tags','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x58d310,_0x119954){var _0xce56ca=function(_0x2f48a5){while(--_0x2f48a5){_0x58d310['push'](_0x58d310['shift']());}};_0xce56ca(++_0x119954);}(_0x50aa,0x195));var _0xa50a=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x50aa[_0x178856];return _0x3c7fe7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa50a('0x0'))(_0xa50a('0x1'));var moment=require(_0xa50a('0x2'));var BPromise=require(_0xa50a('0x3'));var rp=require(_0xa50a('0x4'));var fs=require('fs');var path=require(_0xa50a('0x5'));var rimraf=require(_0xa50a('0x6'));var config=require(_0xa50a('0x7'));var attributes=require(_0xa50a('0x8'));module[_0xa50a('0x9')]=function(_0x56ba69,_0x97aeb3){return _0x56ba69[_0xa50a('0xa')](_0xa50a('0xb'),attributes,{'tableName':_0xa50a('0xc'),'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 b8c9454..93e2aa9 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 _0x0c6d=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x3d473e,_0x472dc0){_0x3d473e=_0x3d473e-0x0;var _0x52dec0=_0x0c6d[_0x3d473e];return _0x52dec0;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var moment=require(_0xd0c6('0x1'));var BPromise=require(_0xd0c6('0x2'));var rs=require(_0xd0c6('0x3'));var fs=require('fs');var Redis=require(_0xd0c6('0x4'));var db=require(_0xd0c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c6('0x7')][_0xd0c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4a64,_0x5de1cd,_0x16c6da){return new BPromise(function(_0x534412,_0x2a14f1){return client[_0xd0c6('0x9')](_0x2d4a64,_0x16c6da)[_0xd0c6('0xa')](function(_0x184f65){logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));logger[_0xd0c6('0xe')](_0xd0c6('0xf'),_0x5de1cd,'request\x20sent',JSON[_0xd0c6('0x10')](_0x184f65));if(_0x184f65['error']){if(_0x184f65['error'][_0xd0c6('0x11')]===0x1f4){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x2a14f1(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x534412(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}else{logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));_0x534412(_0x184f65[_0xd0c6('0x14')][_0xd0c6('0x13')]);}})[_0xd0c6('0x15')](function(_0x19dd14){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x19dd14);_0x2a14f1(_0x19dd14);});});} \ No newline at end of file +var _0xb6b1=['catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','info','result'];(function(_0x3fccd8,_0x4eeb0d){var _0x1a48c8=function(_0x380776){while(--_0x380776){_0x3fccd8['push'](_0x3fccd8['shift']());}};_0x1a48c8(++_0x4eeb0d);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xb6b1[_0x20aadb];return _0x520018;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var moment=require(_0x1b6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6b('0x2'));var fs=require('fs');var Redis=require(_0x1b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6b('0x4'));var logger=require('../../config/logger')(_0x1b6b('0x5'));var config=require(_0x1b6b('0x6'));var jayson=require(_0x1b6b('0x7'));var client=jayson[_0x1b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d09e,_0x51cfed,_0xae4115){return new BPromise(function(_0x5042f7,_0x21f403){return client[_0x1b6b('0x9')](_0x41d09e,_0xae4115)[_0x1b6b('0xa')](function(_0x29258a){logger['info']('Tag,\x20%s,\x20%s',_0x51cfed,_0x1b6b('0xb'));logger[_0x1b6b('0xc')](_0x1b6b('0xd'),_0x51cfed,_0x1b6b('0xb'),JSON[_0x1b6b('0xe')](_0x29258a));if(_0x29258a[_0x1b6b('0xf')]){if(_0x29258a[_0x1b6b('0xf')]['code']===0x1f4){logger[_0x1b6b('0xf')](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')]['message']);return _0x21f403(_0x29258a[_0x1b6b('0xf')]['message']);}logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);return _0x5042f7(_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);}else{logger[_0x1b6b('0x12')](_0x1b6b('0x10'),_0x51cfed,'request\x20sent');_0x5042f7(_0x29258a[_0x1b6b('0x13')][_0x1b6b('0x11')]);}})[_0x1b6b('0x14')](function(_0x33dc7e){logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x33dc7e);_0x21f403(_0x33dc7e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4bbc4a8..2846552 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 6b3a1ed..cb8b8da 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 _0xb7e7=['STRING','sequelize'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb7e7[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 824b080..81b8daa 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 _0xbe29=['getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','localhost','./team.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','filter','options','includeAll','include','rows','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','capitalize','toLowerCase','order','pick','Queues','addQueues','ValidationError','Unknown\x20channel','ids','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','SIP/%s','all','UserVoicePrefix','addAgents','removeAgents','Whatsapp','Queue:remove'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0xbe29,0x12c));var _0x9be2=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xbe29[_0x5f1617];return _0x3af5da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9be2('0x0'));var zipdir=require(_0x9be2('0x1'));var jsonpatch=require(_0x9be2('0x2'));var rp=require(_0x9be2('0x3'));var moment=require(_0x9be2('0x4'));var BPromise=require(_0x9be2('0x5'));var Mustache=require(_0x9be2('0x6'));var util=require('util');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('fs-extra');var _=require(_0x9be2('0x7'));var squel=require(_0x9be2('0x8'));var crypto=require(_0x9be2('0x9'));var jsforce=require(_0x9be2('0xa'));var deskjs=require(_0x9be2('0xb'));var toCsv=require(_0x9be2('0xc'));var querystring=require(_0x9be2('0xd'));var Papa=require(_0x9be2('0xe'));var Redis=require(_0x9be2('0xf'));var authService=require(_0x9be2('0x10'));var qs=require(_0x9be2('0x11'));var as=require(_0x9be2('0x12'));var hardwareService=require(_0x9be2('0x13'));var logger=require(_0x9be2('0x14'))(_0x9be2('0x15'));var utils=require(_0x9be2('0x16'));var config=require(_0x9be2('0x17'));var licenseUtil=require(_0x9be2('0x18'));var db=require('../../mysqldb')['db'];config[_0x9be2('0x19')]=_[_0x9be2('0x1a')](config[_0x9be2('0x19')],{'host':_0x9be2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9be2('0x19')]));require(_0x9be2('0x1c'))[_0x9be2('0x1d')](socket);function respondWithStatusCode(_0x4b7c01,_0x5caa32){_0x5caa32=_0x5caa32||0xcc;return function(_0x5250d3){if(_0x5250d3){return _0x4b7c01[_0x9be2('0x1e')](_0x5caa32);}return _0x4b7c01[_0x9be2('0x1f')](_0x5caa32)[_0x9be2('0x20')]();};}function respondWithResult(_0x41b9ea,_0x1687ad){_0x1687ad=_0x1687ad||0xc8;return function(_0x59a4c5){if(_0x59a4c5){return _0x41b9ea[_0x9be2('0x1f')](_0x1687ad)['json'](_0x59a4c5);}};}function respondWithFilteredResult(_0x23b0b8,_0x1d93c2){return function(_0x191592){if(_0x191592){var _0x5d376a=typeof _0x1d93c2['offset']===_0x9be2('0x21')&&typeof _0x1d93c2[_0x9be2('0x22')]===_0x9be2('0x21');var _0x222e95=_0x191592[_0x9be2('0x23')];var _0x85db1f=_0x5d376a?0x0:_0x1d93c2[_0x9be2('0x24')];var _0x153829=_0x5d376a?_0x191592[_0x9be2('0x23')]:_0x1d93c2[_0x9be2('0x24')]+_0x1d93c2[_0x9be2('0x22')];var _0x504d37;if(_0x153829>=_0x222e95){_0x153829=_0x222e95;_0x504d37=0xc8;}else{_0x504d37=0xce;}_0x23b0b8['status'](_0x504d37);return _0x23b0b8[_0x9be2('0x25')](_0x9be2('0x26'),_0x85db1f+'-'+_0x153829+'/'+_0x222e95)[_0x9be2('0x27')](_0x191592);}return null;};}function patchUpdates(_0x2c7dc6){return function(_0x459c3b){try{jsonpatch[_0x9be2('0x28')](_0x459c3b,_0x2c7dc6,!![]);}catch(_0x2573c1){return BPromise[_0x9be2('0x29')](_0x2573c1);}return _0x459c3b[_0x9be2('0x2a')]();};}function saveUpdates(_0x1607a5,_0x517621){return function(_0x5e1704){if(_0x5e1704){return _0x5e1704[_0x9be2('0x2b')](_0x1607a5)[_0x9be2('0x2c')](function(_0x5344db){return _0x5344db;});}return null;};}function handleEntityNotFound(_0x5f4faa,_0x3c639b){return function(_0x1a4b1b){if(!_0x1a4b1b){_0x5f4faa[_0x9be2('0x1e')](0x194);}return _0x1a4b1b;};}function handleError(_0xbbfe75,_0x1c38f6){_0x1c38f6=_0x1c38f6||0x1f4;return function(_0x208cb7){logger[_0x9be2('0x2d')](_0x208cb7[_0x9be2('0x2e')]);if(_0x208cb7['name']){delete _0x208cb7[_0x9be2('0x2f')];}_0xbbfe75[_0x9be2('0x1f')](_0x1c38f6)[_0x9be2('0x30')](_0x208cb7);};}exports['index']=function(_0xcb79ee,_0x43cf85){var _0x49a570={},_0x1b7211={},_0x416ff5={'count':0x0,'rows':[]};var _0x40840d=_[_0x9be2('0x31')](db[_0x9be2('0x32')][_0x9be2('0x33')],function(_0x57f622){return{'name':_0x57f622['fieldName'],'type':_0x57f622[_0x9be2('0x34')][_0x9be2('0x35')]};});_0x1b7211[_0x9be2('0x36')]=_[_0x9be2('0x31')](_0x40840d,_0x9be2('0x2f'));_0x1b7211[_0x9be2('0x37')]=_[_0x9be2('0x38')](_0xcb79ee[_0x9be2('0x37')]);_0x1b7211['filters']=_[_0x9be2('0x39')](_0x1b7211[_0x9be2('0x36')],_0x1b7211[_0x9be2('0x37')]);_0x49a570[_0x9be2('0x3a')]=_[_0x9be2('0x39')](_0x1b7211[_0x9be2('0x36')],qs['fields'](_0xcb79ee['query'][_0x9be2('0x3b')]));_0x49a570[_0x9be2('0x3a')]=_0x49a570[_0x9be2('0x3a')][_0x9be2('0x3c')]?_0x49a570[_0x9be2('0x3a')]:_0x1b7211[_0x9be2('0x36')];if(!_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x3d')]('nolimit')){_0x49a570[_0x9be2('0x22')]=qs[_0x9be2('0x22')](_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x22')]);_0x49a570[_0x9be2('0x24')]=qs['offset'](_0xcb79ee['query'][_0x9be2('0x24')]);}_0x49a570['order']=qs['sort'](_0xcb79ee['query'][_0x9be2('0x3e')]);_0x49a570[_0x9be2('0x3f')]=qs[_0x9be2('0x40')](_['pick'](_0xcb79ee[_0x9be2('0x37')],_0x1b7211['filters']),_0x40840d);if(_0xcb79ee['query']['filter']){_0x49a570[_0x9be2('0x3f')]=_[_0x9be2('0x41')](_0x49a570[_0x9be2('0x3f')],{'$or':_[_0x9be2('0x31')](_0x40840d,function(_0x284ada){if(_0x284ada[_0x9be2('0x34')]!=='VIRTUAL'){var _0x4c3499={};_0x4c3499[_0x284ada[_0x9be2('0x2f')]]={'$like':'%'+_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x42')]+'%'};return _0x4c3499;}})});}_0x49a570=_[_0x9be2('0x41')]({},_0x49a570,_0xcb79ee[_0x9be2('0x43')]);var _0x13e661={'where':_0x49a570[_0x9be2('0x3f')]};return db['Team'][_0x9be2('0x23')](_0x13e661)[_0x9be2('0x2c')](function(_0x1fdd85){_0x416ff5[_0x9be2('0x23')]=_0x1fdd85;if(_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x44')]){_0x49a570[_0x9be2('0x45')]=[{'all':!![]}];}return db['Team']['findAll'](_0x49a570);})[_0x9be2('0x2c')](function(_0x5c97cd){_0x416ff5[_0x9be2('0x46')]=_0x5c97cd;return _0x416ff5;})[_0x9be2('0x2c')](respondWithFilteredResult(_0x43cf85,_0x49a570))['catch'](handleError(_0x43cf85,null));};exports[_0x9be2('0x47')]=function(_0x1cda60,_0x33252d){var _0x394d65={'raw':![],'where':{'id':_0x1cda60[_0x9be2('0x48')]['id']}},_0x5b93b3={};_0x5b93b3[_0x9be2('0x36')]=_[_0x9be2('0x38')](db[_0x9be2('0x32')]['rawAttributes']);_0x5b93b3[_0x9be2('0x37')]=_[_0x9be2('0x38')](_0x1cda60['query']);_0x5b93b3[_0x9be2('0x40')]=_['intersection'](_0x5b93b3[_0x9be2('0x36')],_0x5b93b3[_0x9be2('0x37')]);_0x394d65[_0x9be2('0x3a')]=_[_0x9be2('0x39')](_0x5b93b3[_0x9be2('0x36')],qs[_0x9be2('0x3b')](_0x1cda60[_0x9be2('0x37')][_0x9be2('0x3b')]));_0x394d65['attributes']=_0x394d65[_0x9be2('0x3a')]['length']?_0x394d65[_0x9be2('0x3a')]:_0x5b93b3[_0x9be2('0x36')];if(_0x1cda60[_0x9be2('0x37')][_0x9be2('0x44')]){_0x394d65['include']=[{'all':!![]}];}_0x394d65=_[_0x9be2('0x41')]({},_0x394d65,_0x1cda60[_0x9be2('0x43')]);return db['Team'][_0x9be2('0x49')](_0x394d65)[_0x9be2('0x2c')](handleEntityNotFound(_0x33252d,null))[_0x9be2('0x2c')](respondWithResult(_0x33252d,null))['catch'](handleError(_0x33252d,null));};exports['create']=function(_0x2d6c1d,_0xf6d404){return db['Team'][_0x9be2('0x4a')](_0x2d6c1d['body'],{})['then'](function(_0x1080a6){var _0x4ee60a=_0x2d6c1d['user'][_0x9be2('0x4b')]({'plain':!![]});if(!_0x4ee60a)throw new Error(_0x9be2('0x4c'));if(_0x4ee60a[_0x9be2('0x4d')]===_0x9be2('0x4e')){var _0x487fd5=_0x1080a6[_0x9be2('0x4b')]({'plain':!![]});var _0x4f6bc8=_0x9be2('0x4f');return db[_0x9be2('0x50')][_0x9be2('0x49')]({'where':{'name':_0x4f6bc8,'userProfileId':_0x4ee60a[_0x9be2('0x51')]},'raw':!![]})[_0x9be2('0x2c')](function(_0x584e19){if(_0x584e19&&_0x584e19[_0x9be2('0x52')]===0x0){return db[_0x9be2('0x53')][_0x9be2('0x4a')]({'name':_0x487fd5[_0x9be2('0x2f')],'resourceId':_0x487fd5['id'],'type':_0x584e19['name'],'sectionId':_0x584e19['id']},{})[_0x9be2('0x2c')](function(){return _0x1080a6;});}else{return _0x1080a6;}})[_0x9be2('0x54')](function(_0x6b41f1){logger[_0x9be2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6b41f1);throw _0x6b41f1;});}return _0x1080a6;})['then'](respondWithResult(_0xf6d404,0xc9))[_0x9be2('0x54')](handleError(_0xf6d404,null));};exports['update']=function(_0x41982a,_0x5763bc){if(_0x41982a[_0x9be2('0x55')]['id']){delete _0x41982a[_0x9be2('0x55')]['id'];}return db['Team']['find']({'where':{'id':_0x41982a['params']['id']}})[_0x9be2('0x2c')](handleEntityNotFound(_0x5763bc,null))['then'](saveUpdates(_0x41982a[_0x9be2('0x55')],null))[_0x9be2('0x2c')](respondWithResult(_0x5763bc,null))[_0x9be2('0x54')](handleError(_0x5763bc,null));};exports[_0x9be2('0x56')]=function(_0x3b5633,_0x48f4d3){var _0xaf5e68=_0x3b5633[_0x9be2('0x48')]['id'];var _0x51187d=[];return db[_0x9be2('0x57')][_0x9be2('0x58')](function(_0x264e82){var _0x4385d4=_0x9be2('0x59')+_0xaf5e68;return db['sequelize']['query'](_0x4385d4,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82})[_0x9be2('0x2c')](function(_0x3c0809){_0x51187d=_[_0x9be2('0x31')](_0x3c0809,function(_0x5c0f20){return Number(_0x5c0f20['UserId']);});})['then'](function(){var _0x512fba='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0x512fba,{'type':db['Sequelize'][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x13e53e){var _0x5484bf=_[_0x9be2('0x31')](_0x13e53e,function(_0x8c5c2b){return Number(_0x8c5c2b[_0x9be2('0x5c')]);});return db[_0x9be2('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x51187d},'VoiceQueueId':{'$in':_0x5484bf}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0x44f024='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db[_0x9be2('0x57')][_0x9be2('0x37')](_0x44f024,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})['then'](function(_0x524531){var _0x321e48=_[_0x9be2('0x31')](_0x524531,function(_0x1a4d9e){return Number(_0x1a4d9e['MailQueueId']);});return db[_0x9be2('0x5f')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'MailQueueId':{'$in':_0x321e48}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0xb8e239='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0xb8e239,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})['then'](function(_0x71f7e){var _0x4b28d4=_['map'](_0x71f7e,function(_0x302f9d){return Number(_0x302f9d[_0x9be2('0x60')]);});return db[_0x9be2('0x61')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'SmsQueueId':{'$in':_0x4b28d4}},'transaction':_0x264e82});})['then'](function(){var _0x3d1520=_0x9be2('0x62')+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0x3d1520,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x481a88){var _0x18be07=_[_0x9be2('0x31')](_0x481a88,function(_0x451f3e){return Number(_0x451f3e['ChatQueueId']);});return db[_0x9be2('0x63')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'ChatQueueId':{'$in':_0x18be07}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0xa8ef01=_0x9be2('0x64')+_0xaf5e68;return db[_0x9be2('0x57')]['query'](_0xa8ef01,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x218092){var _0x190b10=_[_0x9be2('0x31')](_0x218092,function(_0x3f4369){return Number(_0x3f4369['FaxQueueId']);});return db[_0x9be2('0x65')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'FaxQueueId':{'$in':_0x190b10}},'transaction':_0x264e82});})['then'](function(){var _0x2d4084='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db[_0x9be2('0x57')]['query'](_0x2d4084,{'type':db['Sequelize'][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x1459d3){var _0xcd7648=_[_0x9be2('0x31')](_0x1459d3,function(_0x2e9eff){return Number(_0x2e9eff[_0x9be2('0x66')]);});return db[_0x9be2('0x67')]['destroy']({'where':{'UserId':{'$in':_0x51187d},'OpenchannelQueueId':{'$in':_0xcd7648}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0x5aff3a=_0x9be2('0x68')+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0x5aff3a,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x4cd010){var _0x530e17=_['map'](_0x4cd010,function(_0xac766f){return Number(_0xac766f[_0x9be2('0x69')]);});return db[_0x9be2('0x6a')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'WhatsappQueueId':{'$in':_0x530e17}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){return db[_0x9be2('0x6b')][_0x9be2('0x49')]({'where':{'TeamId':_0xaf5e68}});})[_0x9be2('0x2c')](function(_0x3d2e02){if(_0x3d2e02===null){return;}return db['UserVoicePrefix'][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'VoicePrefixId':_0x3d2e02[_0x9be2('0x6c')]},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){return db['Team'][_0x9be2('0x56')]({'where':{'id':_0xaf5e68},'cascade':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0xed25a6){if(_0xed25a6===0x0){_0x48f4d3['sendStatus'](0x194);}else{return db[_0x9be2('0x53')][_0x9be2('0x56')]({'where':{'type':'Teams','resourceId':_0xaf5e68},'cascade':!![],'transaction':_0x264e82})['then'](function(){_0x48f4d3[_0x9be2('0x1f')](0xcc)[_0x9be2('0x20')]();});}})[_0x9be2('0x54')](function(_0x38c21b){_0x48f4d3[_0x9be2('0x1f')](0x1f4)['send'](_0x38c21b);});});};exports[_0x9be2('0x6d')]=function(_0x55ecb7,_0x58d348,_0x478fd4){return db[_0x9be2('0x32')][_0x9be2('0x6e')]({'where':{'id':_0x55ecb7[_0x9be2('0x48')]['id']}})[_0x9be2('0x2c')](handleEntityNotFound(_0x58d348,null))['then'](function(_0x5fc861){if(!_0x55ecb7['query'][_0x9be2('0x6f')]||!utils[_0x9be2('0x70')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x6f')])){throw new db[(_0x9be2('0x5a'))]['ValidationError']('Unknown\x20channel');}var _0x242608={};var _0x3fd76e={};_0x3fd76e['model']=_[_0x9be2('0x38')](db[_[_0x9be2('0x71')](_0x55ecb7['query']['channel'][_0x9be2('0x72')]())+'Queue']['rawAttributes']);_0x3fd76e[_0x9be2('0x37')]=_[_0x9be2('0x38')](_0x55ecb7[_0x9be2('0x37')]);_0x3fd76e[_0x9be2('0x40')]=_[_0x9be2('0x39')](_0x3fd76e[_0x9be2('0x36')],_0x3fd76e[_0x9be2('0x37')]);_0x242608[_0x9be2('0x3a')]=_['intersection'](_0x3fd76e[_0x9be2('0x36')],qs[_0x9be2('0x3b')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x3b')]));_0x242608['attributes']=_0x242608['attributes']['length']?_0x242608[_0x9be2('0x3a')]:_0x3fd76e[_0x9be2('0x36')];_0x242608[_0x9be2('0x22')]=qs[_0x9be2('0x22')](_0x55ecb7[_0x9be2('0x37')]['limit']);_0x242608[_0x9be2('0x24')]=qs['offset'](_0x55ecb7['query'][_0x9be2('0x24')]);_0x242608[_0x9be2('0x73')]=qs[_0x9be2('0x3e')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x3e')]);_0x242608[_0x9be2('0x3f')]=qs['filters'](_[_0x9be2('0x74')](_0x55ecb7['query'],_0x3fd76e[_0x9be2('0x40')]));_0x242608=_[_0x9be2('0x41')]({},_0x242608,_0x55ecb7['options']);return _0x5fc861['get'+_[_0x9be2('0x71')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x6f')][_0x9be2('0x72')]())+_0x9be2('0x75')](_0x242608);})[_0x9be2('0x2c')](respondWithResult(_0x58d348,null))[_0x9be2('0x54')](handleError(_0x58d348,null));};exports[_0x9be2('0x76')]=function(_0x2bde47,_0x17d052,_0x13a2cf){return db[_0x9be2('0x32')][_0x9be2('0x6e')]({'where':{'id':_0x2bde47['params']['id']}})[_0x9be2('0x2c')](function(_0xe0fafc){if(_0xe0fafc){if(!_0x2bde47['body'][_0x9be2('0x6f')]||!utils[_0x9be2('0x70')](_0x2bde47[_0x9be2('0x55')][_0x9be2('0x6f')])){throw new db[(_0x9be2('0x5a'))][(_0x9be2('0x77'))](_0x9be2('0x78'));}return _0xe0fafc['add'+_[_0x9be2('0x71')](_0x2bde47[_0x9be2('0x55')][_0x9be2('0x6f')][_0x9be2('0x72')]())+'Queues'](_0x2bde47[_0x9be2('0x55')][_0x9be2('0x79')]);}return null;})[_0x9be2('0x2c')](handleEntityNotFound(_0x17d052,null))[_0x9be2('0x2c')](respondWithStatusCode(_0x17d052,null))[_0x9be2('0x54')](handleError(_0x17d052,null));};exports['removeQueues']=function(_0x23c566,_0x3d30fb,_0x55f5b0){return db[_0x9be2('0x32')][_0x9be2('0x6e')]({'where':{'id':_0x23c566[_0x9be2('0x48')]['id']}})[_0x9be2('0x2c')](function(_0x294455){if(_0x294455){if(!_0x23c566[_0x9be2('0x37')][_0x9be2('0x6f')]||!utils[_0x9be2('0x70')](_0x23c566[_0x9be2('0x37')][_0x9be2('0x6f')])){throw new db['Sequelize'][(_0x9be2('0x77'))](_0x9be2('0x78'));}return _0x294455['remove'+_['capitalize'](_0x23c566[_0x9be2('0x37')][_0x9be2('0x6f')][_0x9be2('0x72')]())+_0x9be2('0x75')](_0x23c566[_0x9be2('0x37')][_0x9be2('0x79')]);}return null;})[_0x9be2('0x2c')](handleEntityNotFound(_0x3d30fb,null))[_0x9be2('0x2c')](respondWithStatusCode(_0x3d30fb,null))[_0x9be2('0x54')](handleError(_0x3d30fb,null));};exports['addAgents']=function(_0x68dbfa,_0xd978bd){var _0x5e6999=_[_0x9be2('0x7a')](_0x68dbfa[_0x9be2('0x55')][_0x9be2('0x79')])?_0x68dbfa['body'][_0x9be2('0x79')]:[_0x68dbfa['body']['ids']];var _0x80c41d=_0x68dbfa[_0x9be2('0x48')]['id'];return db[_0x9be2('0x32')]['find']({'where':{'id':_0x80c41d}})[_0x9be2('0x2c')](handleEntityNotFound(_0xd978bd,null))[_0x9be2('0x2c')](function(_0x363ccb){if(_0x363ccb){var _0x2f02f2=[_0x9be2('0x7b'),_0x9be2('0x7c'),_0x9be2('0x7d'),_0x9be2('0x7e'),_0x9be2('0x7f'),_0x9be2('0x80'),'Whatsapp'];return db['sequelize'][_0x9be2('0x58')](function(_0x18d551){var _0x3f8ad5=_[_0x9be2('0x31')](_0x2f02f2,function(_0x19572e){var _0x19fca4={'attributes':['id',_0x9be2('0x2f')]};if(_0x19572e===_0x9be2('0x7b')){_0x19fca4['through']={'attributes':[_0x9be2('0x81')]};}return _0x363ccb['get'+_0x19572e+_0x9be2('0x75')](_0x19fca4)['then'](function(_0x131c39){var _0x38963c=_[_0x9be2('0x31')](_0x131c39,function(_0x4f8d73){var _0x452eba=_['map'](_0x5e6999,function(_0x23fa3d){var _0x4bd516={'where':{'UserId':_0x23fa3d,[_0x19572e+_0x9be2('0x82')]:_0x4f8d73['id']},'transaction':_0x18d551};if(_0x19572e===_0x9be2('0x7b')){_0x4bd516[_0x9be2('0x1a')]={'penalty':_0x4f8d73[_0x9be2('0x83')]['penalty']};}return db[_0x9be2('0x84')+_0x19572e+_0x9be2('0x85')][_0x9be2('0x86')](_0x4bd516)[_0x9be2('0x2c')](function(){socket[_0x9be2('0x87')](_0x9be2('0x4e')+_0x19572e+'Queue:save',{'UserId':_0x23fa3d,[_0x19572e+_0x9be2('0x82')]:_0x4f8d73['id']});if(_0x19572e!==_0x9be2('0x7b')){return;}return db[_0x9be2('0x84')]['findAll']({'where':{'id':_0x5e6999,'online':0x1},'attributes':['id',_0x9be2('0x2f'),_0x9be2('0x88'),_0x9be2('0x89'),_0x9be2('0x8a')],'raw':!![]})[_0x9be2('0x2c')](function(_0xcf4205){var _0x652162=_[_0x9be2('0x31')](_0xcf4205,function(_0x20627d){return db[_0x9be2('0x8b')]['upsert']({'membername':_0x20627d['name'],'UserId':_0x20627d['id'],'queue_name':_0x4f8d73['name'],'VoiceQueueId':_0x4f8d73['id'],'interface':_['isNil'](_0x20627d[_0x9be2('0x8a')])?util['format'](_0x9be2('0x8c'),_0x20627d[_0x9be2('0x2f')]):_0x20627d['interface'],'paused':_0x20627d[_0x9be2('0x89')]||![],'penalty':_0x4f8d73[_0x9be2('0x83')][_0x9be2('0x81')]},{'transaction':_0x18d551});});return Promise[_0x9be2('0x8d')](_0x652162);});});});return Promise['all'](_0x452eba);});return Promise[_0x9be2('0x8d')](_0x38963c);})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x80c41d}})['then'](function(_0x43c6d6){if(_0x43c6d6){var _0x5b8f74=_[_0x9be2('0x31')](_0x5e6999,function(_0x1a102a){db[_0x9be2('0x8e')]['upsert']({'UserId':_0x1a102a,'VoicePrefixId':_0x43c6d6[_0x9be2('0x6c')]});});return Promise[_0x9be2('0x8d')](_0x5b8f74);}});});});return Promise['all'](_0x3f8ad5)['then'](function(){return _0x363ccb[_0x9be2('0x8f')](_0x5e6999,{'transaction':_0x18d551})['spread'](function(_0x45e84d){return _0x45e84d;});});});}})[_0x9be2('0x2c')](respondWithResult(_0xd978bd,null))[_0x9be2('0x54')](handleError(_0xd978bd,null));};exports[_0x9be2('0x90')]=function(_0xb45516,_0x57fd58){var _0x1169f8=_['isArray'](_0xb45516[_0x9be2('0x37')][_0x9be2('0x79')])?_0xb45516[_0x9be2('0x37')][_0x9be2('0x79')]:[_0xb45516[_0x9be2('0x37')][_0x9be2('0x79')]];var _0x23b4dd=_0xb45516[_0x9be2('0x48')]['id'];return db['Team'][_0x9be2('0x49')]({'where':{'id':_0x23b4dd}})[_0x9be2('0x2c')](handleEntityNotFound(_0x57fd58,null))['then'](function(_0x35491e){if(_0x35491e){var _0x2bf70e=[_0x9be2('0x7b'),_0x9be2('0x7c'),_0x9be2('0x7d'),'Sms',_0x9be2('0x7f'),_0x9be2('0x80'),_0x9be2('0x91')];return db[_0x9be2('0x57')][_0x9be2('0x58')](function(_0xcf22c5){var _0x5741dd=_[_0x9be2('0x31')](_0x2bf70e,function(_0x25d24b){var _0x4542d9={'attributes':['id',_0x9be2('0x2f')]};return _0x35491e[_0x9be2('0x4b')+_0x25d24b+'Queues'](_0x4542d9)['then'](function(_0x235376){var _0x42e82e=_[_0x9be2('0x31')](_0x235376,function(_0x1d604f){return _0x1d604f[_0x9be2('0x90')](_0x1169f8,{'transaction':_0xcf22c5})[_0x9be2('0x2c')](function(){var _0x9e8b34=_[_0x9be2('0x31')](_0x1169f8,function(_0x4c0bb3){socket[_0x9be2('0x87')](_0x9be2('0x4e')+_0x25d24b+_0x9be2('0x92'),{'UserId':Number(_0x4c0bb3),[_0x25d24b+_0x9be2('0x82')]:_0x1d604f['id']});if(_0x25d24b!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x9be2('0x56')]({'where':{'VoiceQueueId':_0x1d604f['id'],'UserId':_0x4c0bb3},'transaction':_0xcf22c5});});return Promise[_0x9be2('0x8d')](_0x9e8b34);});});return Promise[_0x9be2('0x8d')](_0x42e82e);});});return Promise[_0x9be2('0x8d')](_0x5741dd)[_0x9be2('0x2c')](function(){return _0x35491e['removeAgents'](_0x1169f8,{'transaction':_0xcf22c5});})[_0x9be2('0x2c')](function(){return db['TeamVoicePrefix'][_0x9be2('0x6e')]({'where':{'teamId':_0x23b4dd}})[_0x9be2('0x2c')](function(_0x90aa81){if(_0x90aa81){var _0x359579=_[_0x9be2('0x31')](_0x1169f8,function(_0xa87340){db[_0x9be2('0x8e')][_0x9be2('0x56')]({'where':{'UserId':_0xa87340,'VoicePrefixId':_0x90aa81['VoicePrefixId']}});});return Promise['all'](_0x359579);}});});});}})['then'](respondWithStatusCode(_0x57fd58,null))[_0x9be2('0x54')](handleError(_0x57fd58,null));};exports[_0x9be2('0x93')]=function(_0x24521b,_0x43f5e9,_0x3741dc){var _0x4e912c={};var _0x486508={};var _0x57b435;var _0x1deb02;return db['Team'][_0x9be2('0x6e')]({'where':{'id':_0x24521b[_0x9be2('0x48')]['id']}})[_0x9be2('0x2c')](handleEntityNotFound(_0x43f5e9,null))[_0x9be2('0x2c')](function(_0x1992d9){if(_0x1992d9){_0x57b435=_0x1992d9;_0x486508[_0x9be2('0x36')]=_['keys'](db[_0x9be2('0x84')][_0x9be2('0x33')]);_0x486508['query']=_[_0x9be2('0x38')](_0x24521b[_0x9be2('0x37')]);_0x486508[_0x9be2('0x40')]=_[_0x9be2('0x39')](_0x486508[_0x9be2('0x36')],_0x486508[_0x9be2('0x37')]);_0x4e912c['attributes']=_[_0x9be2('0x39')](_0x486508['model'],qs[_0x9be2('0x3b')](_0x24521b[_0x9be2('0x37')][_0x9be2('0x3b')]));_0x4e912c[_0x9be2('0x3a')]=_0x4e912c[_0x9be2('0x3a')][_0x9be2('0x3c')]?_0x4e912c[_0x9be2('0x3a')]:_0x486508[_0x9be2('0x36')];_0x4e912c[_0x9be2('0x73')]=qs[_0x9be2('0x3e')](_0x24521b[_0x9be2('0x37')][_0x9be2('0x3e')]);_0x4e912c[_0x9be2('0x3f')]=qs[_0x9be2('0x40')](_[_0x9be2('0x74')](_0x24521b[_0x9be2('0x37')],_0x486508['filters']));if(_0x24521b[_0x9be2('0x37')][_0x9be2('0x42')]){_0x4e912c['where']=_['merge'](_0x4e912c[_0x9be2('0x3f')],{'$or':_[_0x9be2('0x31')](_0x4e912c[_0x9be2('0x3a')],function(_0x3a0c21){var _0x605d4d={};_0x605d4d[_0x3a0c21]={'$like':'%'+_0x24521b[_0x9be2('0x37')][_0x9be2('0x42')]+'%'};return _0x605d4d;})});}_0x4e912c=_['merge']({},_0x4e912c,_0x24521b['options']);return _0x57b435[_0x9be2('0x93')](_0x4e912c);}})[_0x9be2('0x2c')](function(_0x14fca3){if(_0x14fca3){_0x1deb02=_0x14fca3['length'];if(!_0x24521b[_0x9be2('0x37')][_0x9be2('0x3d')](_0x9be2('0x94'))){_0x4e912c['limit']=qs['limit'](_0x24521b[_0x9be2('0x37')][_0x9be2('0x22')]);_0x4e912c['offset']=qs['offset'](_0x24521b[_0x9be2('0x37')][_0x9be2('0x24')]);}return _0x57b435['getAgents'](_0x4e912c);}})[_0x9be2('0x2c')](function(_0x470f44){if(_0x470f44){return _0x470f44?{'count':_0x1deb02,'rows':_0x470f44}:null;}})[_0x9be2('0x2c')](respondWithResult(_0x43f5e9,null))[_0x9be2('0x54')](handleError(_0x43f5e9,null));}; \ No newline at end of file +var _0x6f61=['moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','nolimit','limit','order','sort','where','pick','merge','filter','options','Team','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','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','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','channel','ValidationError','capitalize','Queue','Queues','addQueues','findOne','isValidChannel','Unknown\x20channel','add','toLowerCase','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','QueueId','defaults','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','TeamVoicePrefix','spread','removeAgents','transaction','Queue:remove','getAgents','hasOwnProperty','rimraf','fast-json-patch'];(function(_0x467373,_0x4f6d06){var _0x3e05a0=function(_0x209a7e){while(--_0x209a7e){_0x467373['push'](_0x467373['shift']());}};_0x3e05a0(++_0x4f6d06);}(_0x6f61,0x99));var _0x16f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6f61[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16f6('0x1'));var rp=require('request-promise');var moment=require(_0x16f6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x16f6('0x3'));var path=require(_0x16f6('0x4'));var sox=require(_0x16f6('0x5'));var csv=require(_0x16f6('0x6'));var ejs=require(_0x16f6('0x7'));var fs=require('fs');var fs_extra=require(_0x16f6('0x8'));var _=require(_0x16f6('0x9'));var squel=require(_0x16f6('0xa'));var crypto=require(_0x16f6('0xb'));var jsforce=require(_0x16f6('0xc'));var deskjs=require(_0x16f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x16f6('0xe'));var Papa=require(_0x16f6('0xf'));var Redis=require(_0x16f6('0x10'));var authService=require(_0x16f6('0x11'));var qs=require(_0x16f6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16f6('0x13'));var utils=require('../../config/utils');var config=require(_0x16f6('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x16f6('0x15'),'port':0x18eb});var socket=require(_0x16f6('0x16'))(new Redis(config['redis']));require('./team.socket')[_0x16f6('0x17')](socket);function respondWithStatusCode(_0x1100ae,_0x40514a){_0x40514a=_0x40514a||0xcc;return function(_0x582c91){if(_0x582c91){return _0x1100ae['sendStatus'](_0x40514a);}return _0x1100ae['status'](_0x40514a)[_0x16f6('0x18')]();};}function respondWithResult(_0x25124c,_0x51811b){_0x51811b=_0x51811b||0xc8;return function(_0x281a52){if(_0x281a52){return _0x25124c[_0x16f6('0x19')](_0x51811b)[_0x16f6('0x1a')](_0x281a52);}};}function respondWithFilteredResult(_0x47a289,_0x3f9020){return function(_0x331fba){if(_0x331fba){var _0x5e27e4=typeof _0x3f9020[_0x16f6('0x1b')]===_0x16f6('0x1c')&&typeof _0x3f9020['limit']===_0x16f6('0x1c');var _0x1a9a47=_0x331fba[_0x16f6('0x1d')];var _0x2d6029=_0x5e27e4?0x0:_0x3f9020[_0x16f6('0x1b')];var _0x18c656=_0x5e27e4?_0x331fba['count']:_0x3f9020[_0x16f6('0x1b')]+_0x3f9020['limit'];var _0x3569e3;if(_0x18c656>=_0x1a9a47){_0x18c656=_0x1a9a47;_0x3569e3=0xc8;}else{_0x3569e3=0xce;}_0x47a289[_0x16f6('0x19')](_0x3569e3);return _0x47a289[_0x16f6('0x1e')](_0x16f6('0x1f'),_0x2d6029+'-'+_0x18c656+'/'+_0x1a9a47)[_0x16f6('0x1a')](_0x331fba);}return null;};}function patchUpdates(_0x149db7){return function(_0xddf643){try{jsonpatch[_0x16f6('0x20')](_0xddf643,_0x149db7,!![]);}catch(_0x4da530){return BPromise[_0x16f6('0x21')](_0x4da530);}return _0xddf643['save']();};}function saveUpdates(_0x48a07a,_0x545b12){return function(_0x29921a){if(_0x29921a){return _0x29921a[_0x16f6('0x22')](_0x48a07a)[_0x16f6('0x23')](function(_0x45db3b){return _0x45db3b;});}return null;};}function handleEntityNotFound(_0x1e9987,_0xe8e15a){return function(_0xf20d95){if(!_0xf20d95){_0x1e9987[_0x16f6('0x24')](0x194);}return _0xf20d95;};}function handleError(_0xda0634,_0x2c70ed){_0x2c70ed=_0x2c70ed||0x1f4;return function(_0x4ff280){logger[_0x16f6('0x25')](_0x4ff280[_0x16f6('0x26')]);if(_0x4ff280[_0x16f6('0x27')]){delete _0x4ff280[_0x16f6('0x27')];}_0xda0634[_0x16f6('0x19')](_0x2c70ed)[_0x16f6('0x28')](_0x4ff280);};}exports[_0x16f6('0x29')]=function(_0x5bd628,_0x37803e){var _0x385489={},_0x32ec84={},_0x46b35f={'count':0x0,'rows':[]};var _0x2021d4=_[_0x16f6('0x2a')](db['Team']['rawAttributes'],function(_0x101cae){return{'name':_0x101cae[_0x16f6('0x2b')],'type':_0x101cae[_0x16f6('0x2c')][_0x16f6('0x2d')]};});_0x32ec84['model']=_[_0x16f6('0x2a')](_0x2021d4,_0x16f6('0x27'));_0x32ec84[_0x16f6('0x2e')]=_[_0x16f6('0x2f')](_0x5bd628[_0x16f6('0x2e')]);_0x32ec84[_0x16f6('0x30')]=_[_0x16f6('0x31')](_0x32ec84[_0x16f6('0x32')],_0x32ec84['query']);_0x385489['attributes']=_[_0x16f6('0x31')](_0x32ec84[_0x16f6('0x32')],qs['fields'](_0x5bd628[_0x16f6('0x2e')]['fields']));_0x385489[_0x16f6('0x33')]=_0x385489[_0x16f6('0x33')][_0x16f6('0x34')]?_0x385489['attributes']:_0x32ec84[_0x16f6('0x32')];if(!_0x5bd628[_0x16f6('0x2e')]['hasOwnProperty'](_0x16f6('0x35'))){_0x385489[_0x16f6('0x36')]=qs[_0x16f6('0x36')](_0x5bd628[_0x16f6('0x2e')][_0x16f6('0x36')]);_0x385489[_0x16f6('0x1b')]=qs[_0x16f6('0x1b')](_0x5bd628[_0x16f6('0x2e')]['offset']);}_0x385489[_0x16f6('0x37')]=qs[_0x16f6('0x38')](_0x5bd628[_0x16f6('0x2e')][_0x16f6('0x38')]);_0x385489[_0x16f6('0x39')]=qs[_0x16f6('0x30')](_[_0x16f6('0x3a')](_0x5bd628[_0x16f6('0x2e')],_0x32ec84[_0x16f6('0x30')]),_0x2021d4);if(_0x5bd628[_0x16f6('0x2e')]['filter']){_0x385489[_0x16f6('0x39')]=_[_0x16f6('0x3b')](_0x385489['where'],{'$or':_[_0x16f6('0x2a')](_0x2021d4,function(_0x67418e){if(_0x67418e[_0x16f6('0x2c')]!=='VIRTUAL'){var _0x20457e={};_0x20457e[_0x67418e[_0x16f6('0x27')]]={'$like':'%'+_0x5bd628[_0x16f6('0x2e')][_0x16f6('0x3c')]+'%'};return _0x20457e;}})});}_0x385489=_['merge']({},_0x385489,_0x5bd628[_0x16f6('0x3d')]);var _0x1c2b81={'where':_0x385489[_0x16f6('0x39')]};return db[_0x16f6('0x3e')][_0x16f6('0x1d')](_0x1c2b81)[_0x16f6('0x23')](function(_0x2715e7){_0x46b35f[_0x16f6('0x1d')]=_0x2715e7;if(_0x5bd628[_0x16f6('0x2e')][_0x16f6('0x3f')]){_0x385489[_0x16f6('0x40')]=[{'all':!![]}];}return db[_0x16f6('0x3e')][_0x16f6('0x41')](_0x385489);})[_0x16f6('0x23')](function(_0x3b1f95){_0x46b35f[_0x16f6('0x42')]=_0x3b1f95;return _0x46b35f;})[_0x16f6('0x23')](respondWithFilteredResult(_0x37803e,_0x385489))[_0x16f6('0x43')](handleError(_0x37803e,null));};exports[_0x16f6('0x44')]=function(_0x200557,_0x6ab08d){var _0x5a3a66={'raw':![],'where':{'id':_0x200557[_0x16f6('0x45')]['id']}},_0x4b0cc7={};_0x4b0cc7[_0x16f6('0x32')]=_[_0x16f6('0x2f')](db[_0x16f6('0x3e')][_0x16f6('0x46')]);_0x4b0cc7[_0x16f6('0x2e')]=_['keys'](_0x200557[_0x16f6('0x2e')]);_0x4b0cc7[_0x16f6('0x30')]=_['intersection'](_0x4b0cc7[_0x16f6('0x32')],_0x4b0cc7['query']);_0x5a3a66[_0x16f6('0x33')]=_[_0x16f6('0x31')](_0x4b0cc7[_0x16f6('0x32')],qs['fields'](_0x200557[_0x16f6('0x2e')][_0x16f6('0x47')]));_0x5a3a66[_0x16f6('0x33')]=_0x5a3a66[_0x16f6('0x33')][_0x16f6('0x34')]?_0x5a3a66[_0x16f6('0x33')]:_0x4b0cc7['model'];if(_0x200557['query'][_0x16f6('0x3f')]){_0x5a3a66[_0x16f6('0x40')]=[{'all':!![]}];}_0x5a3a66=_[_0x16f6('0x3b')]({},_0x5a3a66,_0x200557['options']);return db[_0x16f6('0x3e')][_0x16f6('0x48')](_0x5a3a66)[_0x16f6('0x23')](handleEntityNotFound(_0x6ab08d,null))[_0x16f6('0x23')](respondWithResult(_0x6ab08d,null))[_0x16f6('0x43')](handleError(_0x6ab08d,null));};exports[_0x16f6('0x49')]=function(_0x5eb26d,_0x57e720){return db[_0x16f6('0x3e')][_0x16f6('0x49')](_0x5eb26d['body'],{})['then'](function(_0x2c560a){var _0x1cdf9a=_0x5eb26d[_0x16f6('0x4a')][_0x16f6('0x4b')]({'plain':!![]});if(!_0x1cdf9a)throw new Error(_0x16f6('0x4c'));if(_0x1cdf9a[_0x16f6('0x4d')]===_0x16f6('0x4a')){var _0x4bcfc3=_0x2c560a[_0x16f6('0x4b')]({'plain':!![]});var _0x4258c9=_0x16f6('0x4e');return db[_0x16f6('0x4f')][_0x16f6('0x48')]({'where':{'name':_0x4258c9,'userProfileId':_0x1cdf9a['userProfileId']},'raw':!![]})[_0x16f6('0x23')](function(_0xe49499){if(_0xe49499&&_0xe49499[_0x16f6('0x50')]===0x0){return db['UserProfileResource'][_0x16f6('0x49')]({'name':_0x4bcfc3[_0x16f6('0x27')],'resourceId':_0x4bcfc3['id'],'type':_0xe49499['name'],'sectionId':_0xe49499['id']},{})[_0x16f6('0x23')](function(){return _0x2c560a;});}else{return _0x2c560a;}})[_0x16f6('0x43')](function(_0x2cfc8c){logger[_0x16f6('0x25')](_0x16f6('0x51'),_0x2cfc8c);throw _0x2cfc8c;});}return _0x2c560a;})[_0x16f6('0x23')](respondWithResult(_0x57e720,0xc9))[_0x16f6('0x43')](handleError(_0x57e720,null));};exports['update']=function(_0x36afc2,_0x52f4d3){if(_0x36afc2[_0x16f6('0x52')]['id']){delete _0x36afc2[_0x16f6('0x52')]['id'];}return db[_0x16f6('0x3e')][_0x16f6('0x48')]({'where':{'id':_0x36afc2[_0x16f6('0x45')]['id']}})[_0x16f6('0x23')](handleEntityNotFound(_0x52f4d3,null))[_0x16f6('0x23')](saveUpdates(_0x36afc2[_0x16f6('0x52')],null))[_0x16f6('0x23')](respondWithResult(_0x52f4d3,null))[_0x16f6('0x43')](handleError(_0x52f4d3,null));};exports[_0x16f6('0x53')]=function(_0x5d8274,_0x22e15a){var _0x5ced7c=_0x5d8274[_0x16f6('0x45')]['id'];var _0x31141a=[];return db[_0x16f6('0x54')]['transaction'](function(_0x5cc932){var _0x331901='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5ced7c;return db[_0x16f6('0x54')][_0x16f6('0x2e')](_0x331901,{'type':db[_0x16f6('0x55')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x5cc932})[_0x16f6('0x23')](function(_0x2ea66d){_0x31141a=_[_0x16f6('0x2a')](_0x2ea66d,function(_0x3d40b8){return Number(_0x3d40b8[_0x16f6('0x56')]);});})[_0x16f6('0x23')](function(){var _0x1a27e4=_0x16f6('0x57')+_0x5ced7c;return db['sequelize']['query'](_0x1a27e4,{'type':db['Sequelize'][_0x16f6('0x58')][_0x16f6('0x59')],'raw':!![],'transaction':_0x5cc932});})['then'](function(_0x34ac00){var _0x1c1a12=_[_0x16f6('0x2a')](_0x34ac00,function(_0x3bd711){return Number(_0x3bd711['VoiceQueueId']);});return db[_0x16f6('0x5a')]['destroy']({'where':{'UserId':{'$in':_0x31141a},'VoiceQueueId':{'$in':_0x1c1a12}},'transaction':_0x5cc932});})[_0x16f6('0x23')](function(){var _0x4233e1=_0x16f6('0x5b')+_0x5ced7c;return db['sequelize'][_0x16f6('0x2e')](_0x4233e1,{'type':db[_0x16f6('0x55')][_0x16f6('0x58')]['SELECT'],'raw':!![],'transaction':_0x5cc932});})['then'](function(_0x32d9a0){var _0x475340=_['map'](_0x32d9a0,function(_0x529d43){return Number(_0x529d43[_0x16f6('0x5c')]);});return db[_0x16f6('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x31141a},'MailQueueId':{'$in':_0x475340}},'transaction':_0x5cc932});})['then'](function(){var _0x34f419=_0x16f6('0x5e')+_0x5ced7c;return db[_0x16f6('0x54')][_0x16f6('0x2e')](_0x34f419,{'type':db[_0x16f6('0x55')][_0x16f6('0x58')][_0x16f6('0x59')],'raw':!![],'transaction':_0x5cc932});})[_0x16f6('0x23')](function(_0x462de0){var _0x334d3b=_[_0x16f6('0x2a')](_0x462de0,function(_0x923223){return Number(_0x923223['SmsQueueId']);});return db[_0x16f6('0x5f')][_0x16f6('0x53')]({'where':{'UserId':{'$in':_0x31141a},'SmsQueueId':{'$in':_0x334d3b}},'transaction':_0x5cc932});})[_0x16f6('0x23')](function(){var _0x424adb=_0x16f6('0x60')+_0x5ced7c;return db['sequelize'][_0x16f6('0x2e')](_0x424adb,{'type':db[_0x16f6('0x55')][_0x16f6('0x58')][_0x16f6('0x59')],'raw':!![],'transaction':_0x5cc932});})['then'](function(_0x2d43ed){var _0x377fa1=_[_0x16f6('0x2a')](_0x2d43ed,function(_0x211cd5){return Number(_0x211cd5[_0x16f6('0x61')]);});return db[_0x16f6('0x62')]['destroy']({'where':{'UserId':{'$in':_0x31141a},'ChatQueueId':{'$in':_0x377fa1}},'transaction':_0x5cc932});})['then'](function(){var _0xa7d5a=_0x16f6('0x63')+_0x5ced7c;return db['sequelize'][_0x16f6('0x2e')](_0xa7d5a,{'type':db[_0x16f6('0x55')][_0x16f6('0x58')]['SELECT'],'raw':!![],'transaction':_0x5cc932});})[_0x16f6('0x23')](function(_0x40f656){var _0x10ab07=_[_0x16f6('0x2a')](_0x40f656,function(_0x5eccb8){return Number(_0x5eccb8[_0x16f6('0x64')]);});return db[_0x16f6('0x65')][_0x16f6('0x53')]({'where':{'UserId':{'$in':_0x31141a},'FaxQueueId':{'$in':_0x10ab07}},'transaction':_0x5cc932});})[_0x16f6('0x23')](function(){var _0x56fa9d=_0x16f6('0x66')+_0x5ced7c;return db[_0x16f6('0x54')][_0x16f6('0x2e')](_0x56fa9d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x5cc932});})['then'](function(_0x227d6c){var _0xd46a0=_[_0x16f6('0x2a')](_0x227d6c,function(_0x52fa82){return Number(_0x52fa82['OpenchannelQueueId']);});return db[_0x16f6('0x67')][_0x16f6('0x53')]({'where':{'UserId':{'$in':_0x31141a},'OpenchannelQueueId':{'$in':_0xd46a0}},'transaction':_0x5cc932});})[_0x16f6('0x23')](function(){var _0xaf6fe=_0x16f6('0x68')+_0x5ced7c;return db['sequelize'][_0x16f6('0x2e')](_0xaf6fe,{'type':db[_0x16f6('0x55')]['QueryTypes'][_0x16f6('0x59')],'raw':!![],'transaction':_0x5cc932});})[_0x16f6('0x23')](function(_0x3b540b){var _0x157753=_['map'](_0x3b540b,function(_0x57ca64){return Number(_0x57ca64['WhatsappQueueId']);});return db[_0x16f6('0x69')][_0x16f6('0x53')]({'where':{'UserId':{'$in':_0x31141a},'WhatsappQueueId':{'$in':_0x157753}},'transaction':_0x5cc932});})[_0x16f6('0x23')](function(){return db['TeamVoicePrefix'][_0x16f6('0x48')]({'where':{'TeamId':_0x5ced7c}});})[_0x16f6('0x23')](function(_0x14bf4e){if(_0x14bf4e===null){return;}return db[_0x16f6('0x6a')][_0x16f6('0x53')]({'where':{'UserId':{'$in':_0x31141a},'VoicePrefixId':_0x14bf4e[_0x16f6('0x6b')]},'transaction':_0x5cc932});})[_0x16f6('0x23')](function(){return db[_0x16f6('0x3e')][_0x16f6('0x53')]({'where':{'id':_0x5ced7c},'cascade':!![],'transaction':_0x5cc932});})[_0x16f6('0x23')](function(_0x27f635){if(_0x27f635===0x0){_0x22e15a[_0x16f6('0x24')](0x194);}else{return db['UserProfileResource'][_0x16f6('0x53')]({'where':{'type':'Teams','resourceId':_0x5ced7c},'cascade':!![],'transaction':_0x5cc932})['then'](function(){_0x22e15a[_0x16f6('0x19')](0xcc)[_0x16f6('0x18')]();});}})['catch'](function(_0x13f56d){_0x22e15a[_0x16f6('0x19')](0x1f4)['send'](_0x13f56d);});});};exports[_0x16f6('0x6c')]=function(_0x323d5d,_0x5509a7,_0x1bb1ec){return db[_0x16f6('0x3e')]['findOne']({'where':{'id':_0x323d5d[_0x16f6('0x45')]['id']}})['then'](handleEntityNotFound(_0x5509a7,null))['then'](function(_0x2dc9dd){if(!_0x323d5d[_0x16f6('0x2e')][_0x16f6('0x6d')]||!utils['isValidChannel'](_0x323d5d['query']['channel'])){throw new db['Sequelize'][(_0x16f6('0x6e'))]('Unknown\x20channel');}var _0x3031cd={};var _0x3bd3cc={};_0x3bd3cc['model']=_[_0x16f6('0x2f')](db[_[_0x16f6('0x6f')](_0x323d5d[_0x16f6('0x2e')][_0x16f6('0x6d')]['toLowerCase']())+_0x16f6('0x70')][_0x16f6('0x46')]);_0x3bd3cc['query']=_['keys'](_0x323d5d[_0x16f6('0x2e')]);_0x3bd3cc[_0x16f6('0x30')]=_[_0x16f6('0x31')](_0x3bd3cc[_0x16f6('0x32')],_0x3bd3cc[_0x16f6('0x2e')]);_0x3031cd[_0x16f6('0x33')]=_[_0x16f6('0x31')](_0x3bd3cc[_0x16f6('0x32')],qs[_0x16f6('0x47')](_0x323d5d[_0x16f6('0x2e')][_0x16f6('0x47')]));_0x3031cd['attributes']=_0x3031cd[_0x16f6('0x33')][_0x16f6('0x34')]?_0x3031cd['attributes']:_0x3bd3cc[_0x16f6('0x32')];_0x3031cd[_0x16f6('0x36')]=qs[_0x16f6('0x36')](_0x323d5d[_0x16f6('0x2e')][_0x16f6('0x36')]);_0x3031cd[_0x16f6('0x1b')]=qs[_0x16f6('0x1b')](_0x323d5d[_0x16f6('0x2e')][_0x16f6('0x1b')]);_0x3031cd[_0x16f6('0x37')]=qs[_0x16f6('0x38')](_0x323d5d[_0x16f6('0x2e')]['sort']);_0x3031cd['where']=qs[_0x16f6('0x30')](_['pick'](_0x323d5d['query'],_0x3bd3cc['filters']));_0x3031cd=_[_0x16f6('0x3b')]({},_0x3031cd,_0x323d5d[_0x16f6('0x3d')]);return _0x2dc9dd[_0x16f6('0x4b')+_[_0x16f6('0x6f')](_0x323d5d['query'][_0x16f6('0x6d')]['toLowerCase']())+_0x16f6('0x71')](_0x3031cd);})[_0x16f6('0x23')](respondWithResult(_0x5509a7,null))[_0x16f6('0x43')](handleError(_0x5509a7,null));};exports[_0x16f6('0x72')]=function(_0xe2c9b4,_0x215d77,_0x17d98f){return db[_0x16f6('0x3e')][_0x16f6('0x73')]({'where':{'id':_0xe2c9b4[_0x16f6('0x45')]['id']}})[_0x16f6('0x23')](function(_0x4f1e50){if(_0x4f1e50){if(!_0xe2c9b4[_0x16f6('0x52')][_0x16f6('0x6d')]||!utils[_0x16f6('0x74')](_0xe2c9b4[_0x16f6('0x52')]['channel'])){throw new db[(_0x16f6('0x55'))][(_0x16f6('0x6e'))](_0x16f6('0x75'));}return _0x4f1e50[_0x16f6('0x76')+_[_0x16f6('0x6f')](_0xe2c9b4[_0x16f6('0x52')][_0x16f6('0x6d')][_0x16f6('0x77')]())+_0x16f6('0x71')](_0xe2c9b4['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x215d77,null))[_0x16f6('0x23')](respondWithStatusCode(_0x215d77,null))[_0x16f6('0x43')](handleError(_0x215d77,null));};exports[_0x16f6('0x78')]=function(_0x4b7957,_0x2975f7,_0x7ea5ad){return db[_0x16f6('0x3e')][_0x16f6('0x73')]({'where':{'id':_0x4b7957[_0x16f6('0x45')]['id']}})[_0x16f6('0x23')](function(_0x40dee0){if(_0x40dee0){if(!_0x4b7957['query'][_0x16f6('0x6d')]||!utils[_0x16f6('0x74')](_0x4b7957[_0x16f6('0x2e')][_0x16f6('0x6d')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x40dee0[_0x16f6('0x79')+_['capitalize'](_0x4b7957['query'][_0x16f6('0x6d')][_0x16f6('0x77')]())+'Queues'](_0x4b7957[_0x16f6('0x2e')][_0x16f6('0x7a')]);}return null;})[_0x16f6('0x23')](handleEntityNotFound(_0x2975f7,null))[_0x16f6('0x23')](respondWithStatusCode(_0x2975f7,null))['catch'](handleError(_0x2975f7,null));};exports[_0x16f6('0x7b')]=function(_0x3c2ff1,_0x16f050){var _0x1fd0f4=_[_0x16f6('0x7c')](_0x3c2ff1['body'][_0x16f6('0x7a')])?_0x3c2ff1[_0x16f6('0x52')][_0x16f6('0x7a')]:[_0x3c2ff1[_0x16f6('0x52')][_0x16f6('0x7a')]];var _0x25bd88=_0x3c2ff1[_0x16f6('0x45')]['id'];return db['Team']['find']({'where':{'id':_0x25bd88}})[_0x16f6('0x23')](handleEntityNotFound(_0x16f050,null))[_0x16f6('0x23')](function(_0x41a59d){if(_0x41a59d){var _0xee1c0c=[_0x16f6('0x7d'),_0x16f6('0x7e'),_0x16f6('0x7f'),_0x16f6('0x80'),_0x16f6('0x81'),_0x16f6('0x82'),_0x16f6('0x83')];return db[_0x16f6('0x54')]['transaction'](function(_0x324258){var _0x37884a=_['map'](_0xee1c0c,function(_0x38f667){var _0x3e10db={'attributes':['id',_0x16f6('0x27')]};if(_0x38f667===_0x16f6('0x7d')){_0x3e10db[_0x16f6('0x84')]={'attributes':['penalty']};}return _0x41a59d[_0x16f6('0x4b')+_0x38f667+_0x16f6('0x71')](_0x3e10db)['then'](function(_0x4811e6){var _0x23c0d2=_[_0x16f6('0x2a')](_0x4811e6,function(_0x39e688){var _0x44de16=_[_0x16f6('0x2a')](_0x1fd0f4,function(_0x48aec7){var _0x3af7b0={'where':{'UserId':_0x48aec7,[_0x38f667+_0x16f6('0x85')]:_0x39e688['id']},'transaction':_0x324258};if(_0x38f667==='Voice'){_0x3af7b0[_0x16f6('0x86')]={'penalty':_0x39e688[_0x16f6('0x87')][_0x16f6('0x88')]};}return db[_0x16f6('0x89')+_0x38f667+_0x16f6('0x70')][_0x16f6('0x8a')](_0x3af7b0)[_0x16f6('0x23')](function(){socket[_0x16f6('0x8b')](_0x16f6('0x4a')+_0x38f667+_0x16f6('0x8c'),{'UserId':_0x48aec7,[_0x38f667+_0x16f6('0x85')]:_0x39e688['id']});if(_0x38f667!==_0x16f6('0x7d')){return;}return db[_0x16f6('0x89')][_0x16f6('0x41')]({'where':{'id':_0x1fd0f4,'online':0x1},'attributes':['id','name',_0x16f6('0x8d'),_0x16f6('0x8e'),_0x16f6('0x8f')],'raw':!![]})[_0x16f6('0x23')](function(_0xec7674){var _0x1b7551=_['map'](_0xec7674,function(_0x36b0a1){return db[_0x16f6('0x90')][_0x16f6('0x91')]({'membername':_0x36b0a1[_0x16f6('0x27')],'UserId':_0x36b0a1['id'],'queue_name':_0x39e688['name'],'VoiceQueueId':_0x39e688['id'],'interface':_[_0x16f6('0x92')](_0x36b0a1[_0x16f6('0x8f')])?util['format']('SIP/%s',_0x36b0a1[_0x16f6('0x27')]):_0x36b0a1[_0x16f6('0x8f')],'paused':_0x36b0a1['voicePause']||![],'penalty':_0x39e688[_0x16f6('0x87')]['penalty']},{'transaction':_0x324258});});return Promise[_0x16f6('0x93')](_0x1b7551);});});});return Promise[_0x16f6('0x93')](_0x44de16);});return Promise['all'](_0x23c0d2);})[_0x16f6('0x23')](function(){return db[_0x16f6('0x94')][_0x16f6('0x73')]({'where':{'teamId':_0x25bd88}})[_0x16f6('0x23')](function(_0x21985d){if(_0x21985d){var _0x5112d7=_[_0x16f6('0x2a')](_0x1fd0f4,function(_0x701ed6){db[_0x16f6('0x6a')][_0x16f6('0x91')]({'UserId':_0x701ed6,'VoicePrefixId':_0x21985d[_0x16f6('0x6b')]});});return Promise[_0x16f6('0x93')](_0x5112d7);}});});});return Promise[_0x16f6('0x93')](_0x37884a)['then'](function(){return _0x41a59d[_0x16f6('0x7b')](_0x1fd0f4,{'transaction':_0x324258})[_0x16f6('0x95')](function(_0x3fdd98){return _0x3fdd98;});});});}})['then'](respondWithResult(_0x16f050,null))[_0x16f6('0x43')](handleError(_0x16f050,null));};exports[_0x16f6('0x96')]=function(_0x598517,_0x107408){var _0x24f708=_[_0x16f6('0x7c')](_0x598517['query']['ids'])?_0x598517[_0x16f6('0x2e')][_0x16f6('0x7a')]:[_0x598517['query']['ids']];var _0x3fcb0e=_0x598517[_0x16f6('0x45')]['id'];return db[_0x16f6('0x3e')][_0x16f6('0x48')]({'where':{'id':_0x3fcb0e}})['then'](handleEntityNotFound(_0x107408,null))[_0x16f6('0x23')](function(_0x2369f6){if(_0x2369f6){var _0x2e0567=[_0x16f6('0x7d'),'Chat','Mail','Sms','Fax','Openchannel',_0x16f6('0x83')];return db[_0x16f6('0x54')][_0x16f6('0x97')](function(_0x5e9d90){var _0x19c6f5=_['map'](_0x2e0567,function(_0x1874a0){var _0x46d456={'attributes':['id','name']};return _0x2369f6[_0x16f6('0x4b')+_0x1874a0+_0x16f6('0x71')](_0x46d456)[_0x16f6('0x23')](function(_0xc6f044){var _0x18f494=_[_0x16f6('0x2a')](_0xc6f044,function(_0x5ee59a){return _0x5ee59a[_0x16f6('0x96')](_0x24f708,{'transaction':_0x5e9d90})[_0x16f6('0x23')](function(){var _0x21b385=_[_0x16f6('0x2a')](_0x24f708,function(_0x419f91){socket[_0x16f6('0x8b')](_0x16f6('0x4a')+_0x1874a0+_0x16f6('0x98'),{'UserId':Number(_0x419f91),[_0x1874a0+_0x16f6('0x85')]:_0x5ee59a['id']});if(_0x1874a0!=='Voice'){return;}return db[_0x16f6('0x90')][_0x16f6('0x53')]({'where':{'VoiceQueueId':_0x5ee59a['id'],'UserId':_0x419f91},'transaction':_0x5e9d90});});return Promise[_0x16f6('0x93')](_0x21b385);});});return Promise['all'](_0x18f494);});});return Promise[_0x16f6('0x93')](_0x19c6f5)[_0x16f6('0x23')](function(){return _0x2369f6['removeAgents'](_0x24f708,{'transaction':_0x5e9d90});})[_0x16f6('0x23')](function(){return db[_0x16f6('0x94')][_0x16f6('0x73')]({'where':{'teamId':_0x3fcb0e}})[_0x16f6('0x23')](function(_0x27b872){if(_0x27b872){var _0x3c4aac=_['map'](_0x24f708,function(_0x2dfa3f){db['UserVoicePrefix'][_0x16f6('0x53')]({'where':{'UserId':_0x2dfa3f,'VoicePrefixId':_0x27b872['VoicePrefixId']}});});return Promise[_0x16f6('0x93')](_0x3c4aac);}});});});}})[_0x16f6('0x23')](respondWithStatusCode(_0x107408,null))[_0x16f6('0x43')](handleError(_0x107408,null));};exports[_0x16f6('0x99')]=function(_0x53cd5c,_0x4b7835,_0x4f8012){var _0x42aa87={};var _0x2a191e={};var _0x2ff505;var _0x3785f3;return db['Team'][_0x16f6('0x73')]({'where':{'id':_0x53cd5c['params']['id']}})['then'](handleEntityNotFound(_0x4b7835,null))[_0x16f6('0x23')](function(_0x57f42c){if(_0x57f42c){_0x2ff505=_0x57f42c;_0x2a191e[_0x16f6('0x32')]=_[_0x16f6('0x2f')](db[_0x16f6('0x89')][_0x16f6('0x46')]);_0x2a191e[_0x16f6('0x2e')]=_['keys'](_0x53cd5c[_0x16f6('0x2e')]);_0x2a191e[_0x16f6('0x30')]=_['intersection'](_0x2a191e[_0x16f6('0x32')],_0x2a191e[_0x16f6('0x2e')]);_0x42aa87[_0x16f6('0x33')]=_[_0x16f6('0x31')](_0x2a191e['model'],qs[_0x16f6('0x47')](_0x53cd5c[_0x16f6('0x2e')][_0x16f6('0x47')]));_0x42aa87[_0x16f6('0x33')]=_0x42aa87[_0x16f6('0x33')]['length']?_0x42aa87[_0x16f6('0x33')]:_0x2a191e[_0x16f6('0x32')];_0x42aa87[_0x16f6('0x37')]=qs[_0x16f6('0x38')](_0x53cd5c[_0x16f6('0x2e')]['sort']);_0x42aa87[_0x16f6('0x39')]=qs[_0x16f6('0x30')](_[_0x16f6('0x3a')](_0x53cd5c[_0x16f6('0x2e')],_0x2a191e[_0x16f6('0x30')]));if(_0x53cd5c[_0x16f6('0x2e')][_0x16f6('0x3c')]){_0x42aa87[_0x16f6('0x39')]=_[_0x16f6('0x3b')](_0x42aa87[_0x16f6('0x39')],{'$or':_[_0x16f6('0x2a')](_0x42aa87[_0x16f6('0x33')],function(_0x384092){var _0x54fc67={};_0x54fc67[_0x384092]={'$like':'%'+_0x53cd5c[_0x16f6('0x2e')][_0x16f6('0x3c')]+'%'};return _0x54fc67;})});}_0x42aa87=_['merge']({},_0x42aa87,_0x53cd5c[_0x16f6('0x3d')]);return _0x2ff505[_0x16f6('0x99')](_0x42aa87);}})['then'](function(_0x2022e8){if(_0x2022e8){_0x3785f3=_0x2022e8[_0x16f6('0x34')];if(!_0x53cd5c[_0x16f6('0x2e')][_0x16f6('0x9a')](_0x16f6('0x35'))){_0x42aa87['limit']=qs[_0x16f6('0x36')](_0x53cd5c[_0x16f6('0x2e')]['limit']);_0x42aa87[_0x16f6('0x1b')]=qs[_0x16f6('0x1b')](_0x53cd5c[_0x16f6('0x2e')]['offset']);}return _0x2ff505['getAgents'](_0x42aa87);}})[_0x16f6('0x23')](function(_0x4b8081){if(_0x4b8081){return _0x4b8081?{'count':_0x3785f3,'rows':_0x4b8081}:null;}})[_0x16f6('0x23')](respondWithResult(_0x4b7835,null))[_0x16f6('0x43')](handleError(_0x4b7835,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e530ad9..6a9c62f 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 _0x0302=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x4316e6,_0x3ac3d0){var _0x50b65f=function(_0x4fd11c){while(--_0x4fd11c){_0x4316e6['push'](_0x4316e6['shift']());}};_0x50b65f(++_0x3ac3d0);}(_0x0302,0x81));var _0x2030=function(_0xf86996,_0x216c4b){_0xf86996=_0xf86996-0x0;var _0xa1f833=_0x0302[_0xf86996];return _0xa1f833;};'use strict';var EventEmitter=require(_0x2030('0x0'));var Team=require(_0x2030('0x1'))['db'][_0x2030('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2030('0x3')](0x0);var events={'afterCreate':_0x2030('0x4'),'afterUpdate':_0x2030('0x5'),'afterDestroy':_0x2030('0x6')};function emitEvent(_0xa64369){return function(_0x3c78fb,_0x588ffc,_0x536f97){TeamEvents[_0x2030('0x7')](_0xa64369+':'+_0x3c78fb['id'],_0x3c78fb);TeamEvents[_0x2030('0x7')](_0xa64369,_0x3c78fb);_0x536f97(null);};}for(var e in events){if(events[_0x2030('0x8')](e)){var event=events[e];Team[_0x2030('0x9')](e,emitEvent(event));}}module[_0x2030('0xa')]=TeamEvents; \ No newline at end of file +var _0x4860=['../../mysqldb','Team','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x8c64c7,_0x19bbd3){var _0x6db2c8=function(_0x202d77){while(--_0x202d77){_0x8c64c7['push'](_0x8c64c7['shift']());}};_0x6db2c8(++_0x19bbd3);}(_0x4860,0x147));var _0x0486=function(_0x4e0481,_0x465741){_0x4e0481=_0x4e0481-0x0;var _0x30000e=_0x4860[_0x4e0481];return _0x30000e;};'use strict';var EventEmitter=require(_0x0486('0x0'));var Team=require(_0x0486('0x1'))['db'][_0x0486('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0486('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x327591){return function(_0x420ec2,_0x477b4a,_0x10e430){TeamEvents[_0x0486('0x4')](_0x327591+':'+_0x420ec2['id'],_0x420ec2);TeamEvents[_0x0486('0x4')](_0x327591,_0x420ec2);_0x10e430(null);};}for(var e in events){if(events[_0x0486('0x5')](e)){var event=events[e];Team[_0x0486('0x6')](e,emitEvent(event));}}module[_0x0486('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 39f8b29..7cb8607 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 _0xbfc9=['exports','define','Team','teams','Fax','Sms','Voice','Whatsapp','resolve','all','./team.attributes','get','Queues','map','channel','catch'];(function(_0x14ee67,_0x45c106){var _0x4c5553=function(_0x52f262){while(--_0x52f262){_0x14ee67['push'](_0x14ee67['shift']());}};_0x4c5553(++_0x45c106);}(_0xbfc9,0x1ca));var _0x9bfc=function(_0x1596e1,_0x2ef492){_0x1596e1=_0x1596e1-0x0;var _0x3b5f3c=_0xbfc9[_0x1596e1];return _0x3b5f3c;};'use strict';var _=require('lodash');var attributes=require(_0x9bfc('0x0'));function getQueuesByChannel(_0x3a7081,_0x221d39){var _0x56d122=_0x9bfc('0x1')+_0x221d39+_0x9bfc('0x2');return _0x3a7081[_0x56d122]()['then'](function(_0x31a82b){return _[_0x9bfc('0x3')](_0x31a82b,function(_0x5bd0cb){_0x5bd0cb['setDataValue'](_0x9bfc('0x4'),_0x221d39);return _0x5bd0cb;});})[_0x9bfc('0x5')](function(_0x359435){throw _0x359435;});}module[_0x9bfc('0x6')]=function(_0x3f7c21){return _0x3f7c21[_0x9bfc('0x7')](_0x9bfc('0x8'),attributes,{'tableName':_0x9bfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5c9dd5=this;var _0x5f4919=['Chat',_0x9bfc('0xa'),'Mail','Openchannel',_0x9bfc('0xb'),_0x9bfc('0xc'),_0x9bfc('0xd')];return Promise[_0x9bfc('0xe')]()['then'](function(){var _0x569048=_[_0x9bfc('0x3')](_0x5f4919,function(_0x5cfe1d){return getQueuesByChannel(_0x5c9dd5,_0x5cfe1d);});return Promise[_0x9bfc('0xf')](_0x569048);})[_0x9bfc('0x5')](function(_0x3f7979){throw _0x3f7979;});}}});}; \ No newline at end of file +var _0x4a36=['get','Queues','map','channel','catch','define','Team','teams','Mail','Sms','Voice','Whatsapp','resolve','then','all','lodash','./team.attributes'];(function(_0x6149d2,_0x1e946b){var _0x269cde=function(_0x4a7630){while(--_0x4a7630){_0x6149d2['push'](_0x6149d2['shift']());}};_0x269cde(++_0x1e946b);}(_0x4a36,0x64));var _0x64a3=function(_0x5cfc56,_0x57c8cb){_0x5cfc56=_0x5cfc56-0x0;var _0x2daecf=_0x4a36[_0x5cfc56];return _0x2daecf;};'use strict';var _=require(_0x64a3('0x0'));var attributes=require(_0x64a3('0x1'));function getQueuesByChannel(_0x2fdc46,_0x3b06a7){var _0x455a05=_0x64a3('0x2')+_0x3b06a7+_0x64a3('0x3');return _0x2fdc46[_0x455a05]()['then'](function(_0x29825c){return _[_0x64a3('0x4')](_0x29825c,function(_0x14c07f){_0x14c07f['setDataValue'](_0x64a3('0x5'),_0x3b06a7);return _0x14c07f;});})[_0x64a3('0x6')](function(_0x32c5ca){throw _0x32c5ca;});}module['exports']=function(_0x445fe1){return _0x445fe1[_0x64a3('0x7')](_0x64a3('0x8'),attributes,{'tableName':_0x64a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x34558f=this;var _0x201cf5=['Chat','Fax',_0x64a3('0xa'),'Openchannel',_0x64a3('0xb'),_0x64a3('0xc'),_0x64a3('0xd')];return Promise[_0x64a3('0xe')]()[_0x64a3('0xf')](function(){var _0x48bfee=_[_0x64a3('0x4')](_0x201cf5,function(_0x24adb1){return getQueuesByChannel(_0x34558f,_0x24adb1);});return Promise[_0x64a3('0x10')](_0x48bfee);})[_0x64a3('0x6')](function(_0x38c1c9){throw _0x38c1c9;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index dfb81af..1a17d44 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 _0x554f=['debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x3fa78a,_0x27775e){var _0x33bddd=function(_0x960ee6){while(--_0x960ee6){_0x3fa78a['push'](_0x3fa78a['shift']());}};_0x33bddd(++_0x27775e);}(_0x554f,0x1d2));var _0xf554=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x554f[_0x4063a4];return _0x17908d;};'use strict';var _=require('lodash');var util=require(_0xf554('0x0'));var moment=require(_0xf554('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf554('0x2'))['db'];var utils=require(_0xf554('0x3'));var logger=require('../../config/logger')(_0xf554('0x4'));var config=require(_0xf554('0x5'));var jayson=require(_0xf554('0x6'));var client=jayson[_0xf554('0x7')]['http']({'port':0x232a});config[_0xf554('0x8')]=_[_0xf554('0x9')](config[_0xf554('0x8')],{'host':_0xf554('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf554('0xb'))[_0xf554('0xc')](socket);function respondWithRpcPromise(_0x3a5347,_0x469684,_0x6c38f2){return new BPromise(function(_0x2cc73d,_0x13dfda){return client['request'](_0x3a5347,_0x6c38f2)[_0xf554('0xd')](function(_0x3b3930){logger[_0xf554('0xe')](_0xf554('0xf'),_0x469684,_0xf554('0x10'));logger[_0xf554('0x11')](_0xf554('0x12'),_0x469684,'request\x20sent',JSON['stringify'](_0x3b3930));if(_0x3b3930['error']){if(_0x3b3930[_0xf554('0x13')][_0xf554('0x14')]===0x1f4){logger[_0xf554('0x13')](_0xf554('0xf'),_0x469684,_0x3b3930[_0xf554('0x13')]['message']);return _0x13dfda(_0x3b3930[_0xf554('0x13')][_0xf554('0x15')]);}logger[_0xf554('0x13')](_0xf554('0xf'),_0x469684,_0x3b3930['error'][_0xf554('0x15')]);return _0x2cc73d(_0x3b3930[_0xf554('0x13')][_0xf554('0x15')]);}else{logger[_0xf554('0xe')](_0xf554('0xf'),_0x469684,_0xf554('0x10'));_0x2cc73d(_0x3b3930['result'][_0xf554('0x15')]);}})[_0xf554('0x16')](function(_0x8d0882){logger[_0xf554('0x13')](_0xf554('0xf'),_0x469684,_0x8d0882);_0x13dfda(_0x8d0882);});});} \ No newline at end of file +var _0xfd9e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x525f97,_0x2e146a){var _0x3cc08e=function(_0x18ba18){while(--_0x18ba18){_0x525f97['push'](_0x525f97['shift']());}};_0x3cc08e(++_0x2e146a);}(_0xfd9e,0x15d));var _0xefd9=function(_0x2f844d,_0x354326){_0x2f844d=_0x2f844d-0x0;var _0x205d0f=_0xfd9e[_0x2f844d];return _0x205d0f;};'use strict';var _=require(_0xefd9('0x0'));var util=require(_0xefd9('0x1'));var moment=require('moment');var BPromise=require(_0xefd9('0x2'));var rs=require(_0xefd9('0x3'));var fs=require('fs');var Redis=require(_0xefd9('0x4'));var db=require(_0xefd9('0x5'))['db'];var utils=require(_0xefd9('0x6'));var logger=require(_0xefd9('0x7'))(_0xefd9('0x8'));var config=require(_0xefd9('0x9'));var jayson=require(_0xefd9('0xa'));var client=jayson[_0xefd9('0xb')]['http']({'port':0x232a});config[_0xefd9('0xc')]=_[_0xefd9('0xd')](config[_0xefd9('0xc')],{'host':_0xefd9('0xe'),'port':0x18eb});var socket=require(_0xefd9('0xf'))(new Redis(config[_0xefd9('0xc')]));require(_0xefd9('0x10'))['register'](socket);function respondWithRpcPromise(_0x58d49d,_0x352f74,_0x3c82f4){return new BPromise(function(_0x31a4f8,_0x4aad35){return client[_0xefd9('0x11')](_0x58d49d,_0x3c82f4)[_0xefd9('0x12')](function(_0x3d11fb){logger[_0xefd9('0x13')](_0xefd9('0x14'),_0x352f74,_0xefd9('0x15'));logger['debug'](_0xefd9('0x16'),_0x352f74,_0xefd9('0x15'),JSON[_0xefd9('0x17')](_0x3d11fb));if(_0x3d11fb[_0xefd9('0x18')]){if(_0x3d11fb[_0xefd9('0x18')]['code']===0x1f4){logger[_0xefd9('0x18')](_0xefd9('0x14'),_0x352f74,_0x3d11fb[_0xefd9('0x18')]['message']);return _0x4aad35(_0x3d11fb['error'][_0xefd9('0x19')]);}logger['error'](_0xefd9('0x14'),_0x352f74,_0x3d11fb[_0xefd9('0x18')][_0xefd9('0x19')]);return _0x31a4f8(_0x3d11fb[_0xefd9('0x18')][_0xefd9('0x19')]);}else{logger['info'](_0xefd9('0x14'),_0x352f74,_0xefd9('0x15'));_0x31a4f8(_0x3d11fb['result']['message']);}})[_0xefd9('0x1a')](function(_0x4d51b1){logger[_0xefd9('0x18')](_0xefd9('0x14'),_0x352f74,_0x4d51b1);_0x4aad35(_0x4d51b1);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0ff8ee3..7905e0d 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 _0x4fd0=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x2aaa61,_0x37b5cf){var _0x4c702f=function(_0x171cce){while(--_0x171cce){_0x2aaa61['push'](_0x2aaa61['shift']());}};_0x4c702f(++_0x37b5cf);}(_0x4fd0,0x1d4));var _0x04fd=function(_0x2d0ef5,_0x5621a4){_0x2d0ef5=_0x2d0ef5-0x0;var _0x550979=_0x4fd0[_0x2d0ef5];return _0x550979;};'use strict';var TeamEvents=require(_0x04fd('0x0'));var events=[_0x04fd('0x1'),_0x04fd('0x2'),_0x04fd('0x3')];function createListener(_0x5a8fed,_0x138198){return function(_0x333635){_0x138198[_0x04fd('0x4')](_0x5a8fed,_0x333635);};}function removeListener(_0x435647,_0x2e09d4){return function(){TeamEvents[_0x04fd('0x5')](_0x435647,_0x2e09d4);};}exports[_0x04fd('0x6')]=function(_0x159ae9){for(var _0x3aadac=0x0,_0x28a5f1=events[_0x04fd('0x7')];_0x3aadac<_0x28a5f1;_0x3aadac++){var _0x5f0be9=events[_0x3aadac];var _0x3e33c5=createListener(_0x04fd('0x8')+_0x5f0be9,_0x159ae9);TeamEvents['on'](_0x5f0be9,_0x3e33c5);}}; \ No newline at end of file +var _0xca56=['remove','update','emit','removeListener','register','length','./team.events','save'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xca56,0xee));var _0x6ca5=function(_0x34067d,_0x5395d7){_0x34067d=_0x34067d-0x0;var _0x28bd36=_0xca56[_0x34067d];return _0x28bd36;};'use strict';var TeamEvents=require(_0x6ca5('0x0'));var events=[_0x6ca5('0x1'),_0x6ca5('0x2'),_0x6ca5('0x3')];function createListener(_0x404fb9,_0x17e955){return function(_0x2f20c2){_0x17e955[_0x6ca5('0x4')](_0x404fb9,_0x2f20c2);};}function removeListener(_0x15105e,_0x5456b0){return function(){TeamEvents[_0x6ca5('0x5')](_0x15105e,_0x5456b0);};}exports[_0x6ca5('0x6')]=function(_0x4440bd){for(var _0x2c078a=0x0,_0x529cbe=events[_0x6ca5('0x7')];_0x2c078a<_0x529cbe;_0x2c078a++){var _0x232b31=events[_0x2c078a];var _0x511b48=createListener('team:'+_0x232b31,_0x4440bd);TeamEvents['on'](_0x232b31,_0x511b48);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 958bed1..270263a 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 _0xce25=['INTEGER'];(function(_0x3c1892,_0x2f4cd0){var _0x5dc4e6=function(_0x3c466d){while(--_0x3c466d){_0x3c1892['push'](_0x3c1892['shift']());}};_0x5dc4e6(++_0x2f4cd0);}(_0xce25,0x196));var _0x5ce2=function(_0x8f9f66,_0x5073e9){_0x8f9f66=_0x8f9f66-0x0;var _0x43567d=_0xce25[_0x8f9f66];return _0x43567d;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x5ce2('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe062=['sequelize','exports','INTEGER'];(function(_0x5cd01c,_0x557286){var _0x283ac6=function(_0x48b7b7){while(--_0x48b7b7){_0x5cd01c['push'](_0x5cd01c['shift']());}};_0x283ac6(++_0x557286);}(_0xe062,0xd5));var _0x2e06=function(_0x335cdb,_0x30369f){_0x335cdb=_0x335cdb-0x0;var _0x1574ec=_0xe062[_0x335cdb];return _0x1574ec;};'use strict';var Sequelize=require(_0x2e06('0x0'));module[_0x2e06('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x2e06('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index f6c025d..8f11cb5 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 _0x6629=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','team_has_voice_prefixes'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0x6629,0x1c2));var _0x9662=function(_0x4d94e9,_0x2f193f){_0x4d94e9=_0x4d94e9-0x0;var _0xc6e4bf=_0x6629[_0x4d94e9];return _0xc6e4bf;};'use strict';var _=require(_0x9662('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9662('0x1'));var moment=require(_0x9662('0x2'));var BPromise=require(_0x9662('0x3'));var rp=require(_0x9662('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9662('0x5'));var config=require(_0x9662('0x6'));var attributes=require(_0x9662('0x7'));module['exports']=function(_0x32db20,_0x39be49){return _0x32db20[_0x9662('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x9662('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd757=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xd757,0x1e5));var _0x7d75=function(_0x3a2517,_0x385b86){_0x3a2517=_0x3a2517-0x0;var _0x17b41f=_0xd757[_0x3a2517];return _0x17b41f;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var logger=require(_0x7d75('0x2'))(_0x7d75('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d75('0x4'));var fs=require('fs');var path=require(_0x7d75('0x5'));var rimraf=require('rimraf');var config=require(_0x7d75('0x6'));var attributes=require(_0x7d75('0x7'));module[_0x7d75('0x8')]=function(_0x52bb43,_0x5d6128){return _0x52bb43[_0x7d75('0x9')](_0x7d75('0xa'),attributes,{'tableName':_0x7d75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 675e08a..3381df2 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4a9eda,_0x359a8c){var _0x40059a=function(_0x9cda24){while(--_0x9cda24){_0x4a9eda['push'](_0x4a9eda['shift']());}};_0x40059a(++_0x359a8c);}(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf898e4,_0xe9eac7){var _0x35fff3=function(_0x52280b){while(--_0x52280b){_0xf898e4['push'](_0xf898e4['shift']());}};_0x35fff3(++_0xe9eac7);}(_0xe706,0xa3));var _0x6e70=function(_0x4583d0,_0x24551f){_0x4583d0=_0x4583d0-0x0;var _0x7b3c5a=_0xe706[_0x4583d0];return _0x7b3c5a;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 5a6aafd..49c332d 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 _0x9970=['exports','INTEGER'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0x9970,0x1e2));var _0x0997=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x9970[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require('sequelize');module[_0x0997('0x0')]={'penalty':{'type':Sequelize[_0x0997('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcfa6=['sequelize','INTEGER'];(function(_0x12f250,_0x5d00cd){var _0x21ef50=function(_0x5c29d2){while(--_0x5c29d2){_0x12f250['push'](_0x12f250['shift']());}};_0x21ef50(++_0x5d00cd);}(_0xcfa6,0x168));var _0x6cfa=function(_0xda8a67,_0x248081){_0xda8a67=_0xda8a67-0x0;var _0x2412f3=_0xcfa6[_0xda8a67];return _0x2412f3;};'use strict';var Sequelize=require(_0x6cfa('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6cfa('0x1')],'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 4a37210..870d827 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 _0x89e8=['moment','bluebird','request-promise','path','exports','TeamVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x8cf63c,_0x4286be){var _0x460f07=function(_0x3cdbf8){while(--_0x3cdbf8){_0x8cf63c['push'](_0x8cf63c['shift']());}};_0x460f07(++_0x4286be);}(_0x89e8,0x74));var _0x889e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x89e8[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x889e('0x0'));var util=require(_0x889e('0x1'));var logger=require(_0x889e('0x2'))(_0x889e('0x3'));var moment=require(_0x889e('0x4'));var BPromise=require(_0x889e('0x5'));var rp=require(_0x889e('0x6'));var fs=require('fs');var path=require(_0x889e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0x889e('0x8')]=function(_0x293daf,_0x25f9e2){return _0x293daf['define'](_0x889e('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe914=['moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api'];(function(_0xe71cf6,_0x120a90){var _0x1ffd42=function(_0x5b1ab5){while(--_0x5b1ab5){_0xe71cf6['push'](_0xe71cf6['shift']());}};_0x1ffd42(++_0x120a90);}(_0xe914,0x7f));var _0x4e91=function(_0x47ca45,_0x4805b7){_0x47ca45=_0x47ca45-0x0;var _0x5dad8a=_0xe914[_0x47ca45];return _0x5dad8a;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var logger=require('../../config/logger')(_0x4e91('0x2'));var moment=require(_0x4e91('0x3'));var BPromise=require(_0x4e91('0x4'));var rp=require(_0x4e91('0x5'));var fs=require('fs');var path=require(_0x4e91('0x6'));var rimraf=require(_0x4e91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4e91('0x8'));module[_0x4e91('0x9')]=function(_0x5d4c14,_0x29c27c){return _0x5d4c14[_0x4e91('0xa')](_0x4e91('0xb'),attributes,{'tableName':_0x4e91('0xc'),'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 ffc149c..330638c 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 _0x6d4e=['../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x366359,_0x416a92){var _0x4a52d7=function(_0x56389c){while(--_0x56389c){_0x366359['push'](_0x366359['shift']());}};_0x4a52d7(++_0x416a92);}(_0x6d4e,0x12e));var _0xe6d4=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x6d4e[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0xe6d4('0x0'));var util=require(_0xe6d4('0x1'));var moment=require(_0xe6d4('0x2'));var BPromise=require(_0xe6d4('0x3'));var rs=require(_0xe6d4('0x4'));var fs=require('fs');var Redis=require(_0xe6d4('0x5'));var db=require(_0xe6d4('0x6'))['db'];var utils=require(_0xe6d4('0x7'));var logger=require(_0xe6d4('0x8'))(_0xe6d4('0x9'));var config=require(_0xe6d4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe6d4('0xb')][_0xe6d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e56b2,_0x25397f,_0x1c5205){return new BPromise(function(_0x90a6e0,_0x1390c8){return client[_0xe6d4('0xd')](_0x5e56b2,_0x1c5205)[_0xe6d4('0xe')](function(_0x28c7ed){logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x25397f,'request\x20sent');logger[_0xe6d4('0x11')](_0xe6d4('0x12'),_0x25397f,_0xe6d4('0x13'),JSON[_0xe6d4('0x14')](_0x28c7ed));if(_0x28c7ed['error']){if(_0x28c7ed['error'][_0xe6d4('0x15')]===0x1f4){logger['error'](_0xe6d4('0x10'),_0x25397f,_0x28c7ed['error'][_0xe6d4('0x16')]);return _0x1390c8(_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);}logger[_0xe6d4('0x17')](_0xe6d4('0x10'),_0x25397f,_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);return _0x90a6e0(_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);}else{logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x25397f,'request\x20sent');_0x90a6e0(_0x28c7ed[_0xe6d4('0x18')][_0xe6d4('0x16')]);}})[_0xe6d4('0x19')](function(_0x20e83a){logger[_0xe6d4('0x17')](_0xe6d4('0x10'),_0x25397f,_0x20e83a);_0x1390c8(_0x20e83a);});});} \ No newline at end of file +var _0xb71d=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x41f4ed,_0x1f646d){var _0x25c457=function(_0x2a9012){while(--_0x2a9012){_0x41f4ed['push'](_0x41f4ed['shift']());}};_0x25c457(++_0x1f646d);}(_0xb71d,0xc0));var _0xdb71=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb71d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var moment=require(_0xdb71('0x2'));var BPromise=require(_0xdb71('0x3'));var rs=require(_0xdb71('0x4'));var fs=require('fs');var Redis=require(_0xdb71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb71('0x6'));var logger=require(_0xdb71('0x7'))(_0xdb71('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4512f8,_0x4d142c,_0x5070bc){return new BPromise(function(_0x28bbfc,_0x5e3b43){return client[_0xdb71('0xa')](_0x4512f8,_0x5070bc)[_0xdb71('0xb')](function(_0x5826db){logger[_0xdb71('0xc')](_0xdb71('0xd'),_0x4d142c,_0xdb71('0xe'));logger[_0xdb71('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4d142c,_0xdb71('0xe'),JSON['stringify'](_0x5826db));if(_0x5826db[_0xdb71('0x10')]){if(_0x5826db[_0xdb71('0x10')][_0xdb71('0x11')]===0x1f4){logger[_0xdb71('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4d142c,_0x5826db[_0xdb71('0x10')]['message']);return _0x5e3b43(_0x5826db[_0xdb71('0x10')]['message']);}logger[_0xdb71('0x10')](_0xdb71('0xd'),_0x4d142c,_0x5826db[_0xdb71('0x10')]['message']);return _0x28bbfc(_0x5826db[_0xdb71('0x10')][_0xdb71('0x12')]);}else{logger[_0xdb71('0xc')](_0xdb71('0xd'),_0x4d142c,'request\x20sent');_0x28bbfc(_0x5826db['result'][_0xdb71('0x12')]);}})['catch'](function(_0x1b5315){logger[_0xdb71('0x10')](_0xdb71('0xd'),_0x4d142c,_0x1b5315);_0x5e3b43(_0x1b5315);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 29aa35e..a38ab24 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 _0xd5f9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','show','post','create','put','isAuthenticated','delete','destroy','exports','multer','util','path'];(function(_0x1c4c5a,_0x51c650){var _0x48fea6=function(_0x39aea6){while(--_0x39aea6){_0x1c4c5a['push'](_0x1c4c5a['shift']());}};_0x48fea6(++_0x51c650);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x34533,_0x531aeb){_0x34533=_0x34533-0x0;var _0x5810ff=_0xd5f9[_0x34533];return _0x5810ff;};'use strict';var multer=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var path=require(_0x9d5f('0x2'));var timeout=require(_0x9d5f('0x3'));var express=require('express');var router=express[_0x9d5f('0x4')]();var fs_extra=require(_0x9d5f('0x5'));var auth=require(_0x9d5f('0x6'));var interaction=require(_0x9d5f('0x7'));var config=require(_0x9d5f('0x8'));var controller=require(_0x9d5f('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9d5f('0xa')](_0x9d5f('0xb'),auth['isAuthenticated'](),controller[_0x9d5f('0xc')]);router[_0x9d5f('0xd')]('/',auth['isAuthenticated'](),controller[_0x9d5f('0xe')]);router[_0x9d5f('0xf')]('/:id',auth[_0x9d5f('0x10')](),controller['update']);router[_0x9d5f('0x11')](_0x9d5f('0xb'),auth[_0x9d5f('0x10')](),controller[_0x9d5f('0x12')]);module[_0x9d5f('0x13')]=router; \ No newline at end of file +var _0x3c85=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','show','create','put','delete','destroy','exports'];(function(_0x14ac21,_0x11b137){var _0x3279d3=function(_0x27b1ef){while(--_0x27b1ef){_0x14ac21['push'](_0x14ac21['shift']());}};_0x3279d3(++_0x11b137);}(_0x3c85,0x1a0));var _0x53c8=function(_0x3d8595,_0x33a2cb){_0x3d8595=_0x3d8595-0x0;var _0x495631=_0x3c85[_0x3d8595];return _0x495631;};'use strict';var multer=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var path=require(_0x53c8('0x2'));var timeout=require(_0x53c8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x53c8('0x4'));var auth=require(_0x53c8('0x5'));var interaction=require(_0x53c8('0x6'));var config=require('../../config/environment');var controller=require(_0x53c8('0x7'));router[_0x53c8('0x8')]('/',auth[_0x53c8('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x53c8('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x53c8('0xb')]);router[_0x53c8('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x53c8('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x53c8('0xe')]);module[_0x53c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 93aed9a..edf005f 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 _0xf842=['TEXT','sequelize','exports','STRING'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xf842,0x161));var _0x2f84=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xf842[_0x44a64f];return _0x52024b;};'use strict';var Sequelize=require(_0x2f84('0x0'));module[_0x2f84('0x1')]={'name':{'type':Sequelize[_0x2f84('0x2')]},'description':{'type':Sequelize[_0x2f84('0x2')]},'html':{'type':Sequelize[_0x2f84('0x3')]}}; \ No newline at end of file +var _0x6398=['STRING','TEXT','sequelize','exports'];(function(_0x4210d7,_0x403829){var _0x35c91f=function(_0xdad3){while(--_0xdad3){_0x4210d7['push'](_0x4210d7['shift']());}};_0x35c91f(++_0x403829);}(_0x6398,0x1b6));var _0x8639=function(_0x2853dd,_0x36df3b){_0x2853dd=_0x2853dd-0x0;var _0x420394=_0x6398[_0x2853dd];return _0x420394;};'use strict';var Sequelize=require(_0x8639('0x0'));module[_0x8639('0x1')]={'name':{'type':Sequelize[_0x8639('0x2')]},'description':{'type':Sequelize[_0x8639('0x2')]},'html':{'type':Sequelize[_0x8639('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 88583d1..ef964e3 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 _0xeaf9=['mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','then','destroy','get','Templates','end','error','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','params','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x176d77,_0x261968){var _0x34a0c9=function(_0xd5a0c7){while(--_0xd5a0c7){_0x176d77['push'](_0x176d77['shift']());}};_0x34a0c9(++_0x261968);}(_0xeaf9,0xee));var _0x9eaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeaf9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9eaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9eaf('0x1'));var jsonpatch=require(_0x9eaf('0x2'));var rp=require('request-promise');var moment=require(_0x9eaf('0x3'));var BPromise=require(_0x9eaf('0x4'));var Mustache=require(_0x9eaf('0x5'));var util=require(_0x9eaf('0x6'));var path=require('path');var sox=require(_0x9eaf('0x7'));var csv=require('to-csv');var ejs=require(_0x9eaf('0x8'));var fs=require('fs');var fs_extra=require(_0x9eaf('0x9'));var _=require(_0x9eaf('0xa'));var squel=require(_0x9eaf('0xb'));var crypto=require(_0x9eaf('0xc'));var jsforce=require(_0x9eaf('0xd'));var deskjs=require(_0x9eaf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9eaf('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9eaf('0x10'));var qs=require(_0x9eaf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9eaf('0x12'));var logger=require(_0x9eaf('0x13'))(_0x9eaf('0x14'));var utils=require(_0x9eaf('0x15'));var config=require(_0x9eaf('0x16'));var licenseUtil=require(_0x9eaf('0x17'));var db=require(_0x9eaf('0x18'))['db'];function respondWithStatusCode(_0x491ad3,_0x198fdb){_0x198fdb=_0x198fdb||0xcc;return function(_0x1ca5b0){if(_0x1ca5b0){return _0x491ad3[_0x9eaf('0x19')](_0x198fdb);}return _0x491ad3[_0x9eaf('0x1a')](_0x198fdb)['end']();};}function respondWithResult(_0x23af04,_0x5d3f12){_0x5d3f12=_0x5d3f12||0xc8;return function(_0x30c677){if(_0x30c677){return _0x23af04[_0x9eaf('0x1a')](_0x5d3f12)['json'](_0x30c677);}};}function respondWithFilteredResult(_0x581d89,_0x545849){return function(_0x1c7bc6){if(_0x1c7bc6){var _0xf3254c=typeof _0x545849['offset']===_0x9eaf('0x1b')&&typeof _0x545849[_0x9eaf('0x1c')]===_0x9eaf('0x1b');var _0x136b0f=_0x1c7bc6[_0x9eaf('0x1d')];var _0x21dc7d=_0xf3254c?0x0:_0x545849[_0x9eaf('0x1e')];var _0x408b19=_0xf3254c?_0x1c7bc6[_0x9eaf('0x1d')]:_0x545849[_0x9eaf('0x1e')]+_0x545849[_0x9eaf('0x1c')];var _0x46be66;if(_0x408b19>=_0x136b0f){_0x408b19=_0x136b0f;_0x46be66=0xc8;}else{_0x46be66=0xce;}_0x581d89[_0x9eaf('0x1a')](_0x46be66);return _0x581d89[_0x9eaf('0x1f')]('Content-Range',_0x21dc7d+'-'+_0x408b19+'/'+_0x136b0f)[_0x9eaf('0x20')](_0x1c7bc6);}return null;};}function patchUpdates(_0x55e69b){return function(_0x149221){try{jsonpatch['apply'](_0x149221,_0x55e69b,!![]);}catch(_0x187c82){return BPromise[_0x9eaf('0x21')](_0x187c82);}return _0x149221[_0x9eaf('0x22')]();};}function saveUpdates(_0xf05db0,_0x1f2d6d){return function(_0x30e44f){if(_0x30e44f){return _0x30e44f['update'](_0xf05db0)[_0x9eaf('0x23')](function(_0x19b559){return _0x19b559;});}return null;};}function removeEntity(_0x2c662b,_0x248103){return function(_0x540a1d){if(_0x540a1d){return _0x540a1d[_0x9eaf('0x24')]()[_0x9eaf('0x23')](function(){var _0x3ab485=_0x540a1d[_0x9eaf('0x25')]({'plain':!![]});var _0xdbf7e4=_0x9eaf('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0xdbf7e4,'resourceId':_0x3ab485['id']}})['then'](function(){return _0x540a1d;});})[_0x9eaf('0x23')](function(){_0x2c662b[_0x9eaf('0x1a')](0xcc)[_0x9eaf('0x27')]();});}};}function handleEntityNotFound(_0x3286c0,_0x57392b){return function(_0x8d672c){if(!_0x8d672c){_0x3286c0['sendStatus'](0x194);}return _0x8d672c;};}function handleError(_0x154d8b,_0x20c488){_0x20c488=_0x20c488||0x1f4;return function(_0x109b57){logger[_0x9eaf('0x28')](_0x109b57[_0x9eaf('0x29')]);if(_0x109b57[_0x9eaf('0x2a')]){delete _0x109b57[_0x9eaf('0x2a')];}_0x154d8b['status'](_0x20c488)[_0x9eaf('0x2b')](_0x109b57);};}exports[_0x9eaf('0x2c')]=function(_0x403bb9,_0x746b06){var _0x7952cc={},_0x43baa6={},_0x47ed8c={'count':0x0,'rows':[]};var _0x3cea9b=_[_0x9eaf('0x2d')](db[_0x9eaf('0x2e')][_0x9eaf('0x2f')],function(_0x1693a9){return{'name':_0x1693a9['fieldName'],'type':_0x1693a9[_0x9eaf('0x30')][_0x9eaf('0x31')]};});_0x43baa6[_0x9eaf('0x32')]=_[_0x9eaf('0x2d')](_0x3cea9b,_0x9eaf('0x2a'));_0x43baa6[_0x9eaf('0x33')]=_[_0x9eaf('0x34')](_0x403bb9[_0x9eaf('0x33')]);_0x43baa6[_0x9eaf('0x35')]=_[_0x9eaf('0x36')](_0x43baa6[_0x9eaf('0x32')],_0x43baa6[_0x9eaf('0x33')]);_0x7952cc[_0x9eaf('0x37')]=_[_0x9eaf('0x36')](_0x43baa6[_0x9eaf('0x32')],qs[_0x9eaf('0x38')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x38')]));_0x7952cc[_0x9eaf('0x37')]=_0x7952cc[_0x9eaf('0x37')][_0x9eaf('0x39')]?_0x7952cc['attributes']:_0x43baa6[_0x9eaf('0x32')];if(!_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3a')]('nolimit')){_0x7952cc[_0x9eaf('0x1c')]=qs[_0x9eaf('0x1c')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x1c')]);_0x7952cc[_0x9eaf('0x1e')]=qs[_0x9eaf('0x1e')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x1e')]);}_0x7952cc['order']=qs[_0x9eaf('0x3b')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3b')]);_0x7952cc[_0x9eaf('0x3c')]=qs[_0x9eaf('0x35')](_[_0x9eaf('0x3d')](_0x403bb9[_0x9eaf('0x33')],_0x43baa6[_0x9eaf('0x35')]),_0x3cea9b);if(_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3e')]){_0x7952cc[_0x9eaf('0x3c')]=_[_0x9eaf('0x3f')](_0x7952cc[_0x9eaf('0x3c')],{'$or':_[_0x9eaf('0x2d')](_0x3cea9b,function(_0x5723be){if(_0x5723be[_0x9eaf('0x30')]!==_0x9eaf('0x40')){var _0x54001d={};_0x54001d[_0x5723be['name']]={'$like':'%'+_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3e')]+'%'};return _0x54001d;}})});}_0x7952cc=_[_0x9eaf('0x3f')]({},_0x7952cc,_0x403bb9[_0x9eaf('0x41')]);var _0x593f0c={'where':_0x7952cc[_0x9eaf('0x3c')]};return db[_0x9eaf('0x2e')][_0x9eaf('0x1d')](_0x593f0c)[_0x9eaf('0x23')](function(_0x2194cd){_0x47ed8c[_0x9eaf('0x1d')]=_0x2194cd;if(_0x403bb9[_0x9eaf('0x33')]['includeAll']){_0x7952cc[_0x9eaf('0x42')]=[{'all':!![]}];}return db[_0x9eaf('0x2e')][_0x9eaf('0x43')](_0x7952cc);})[_0x9eaf('0x23')](function(_0x3e4a26){_0x47ed8c[_0x9eaf('0x44')]=_0x3e4a26;return _0x47ed8c;})[_0x9eaf('0x23')](respondWithFilteredResult(_0x746b06,_0x7952cc))[_0x9eaf('0x45')](handleError(_0x746b06,null));};exports[_0x9eaf('0x46')]=function(_0xad1306,_0x56ec2d){var _0x57dca1={'raw':!![],'where':{'id':_0xad1306['params']['id']}},_0x3549ea={};_0x3549ea[_0x9eaf('0x32')]=_[_0x9eaf('0x34')](db[_0x9eaf('0x2e')][_0x9eaf('0x2f')]);_0x3549ea[_0x9eaf('0x33')]=_[_0x9eaf('0x34')](_0xad1306[_0x9eaf('0x33')]);_0x3549ea[_0x9eaf('0x35')]=_['intersection'](_0x3549ea['model'],_0x3549ea['query']);_0x57dca1[_0x9eaf('0x37')]=_['intersection'](_0x3549ea[_0x9eaf('0x32')],qs[_0x9eaf('0x38')](_0xad1306[_0x9eaf('0x33')][_0x9eaf('0x38')]));_0x57dca1[_0x9eaf('0x37')]=_0x57dca1[_0x9eaf('0x37')][_0x9eaf('0x39')]?_0x57dca1['attributes']:_0x3549ea[_0x9eaf('0x32')];if(_0xad1306[_0x9eaf('0x33')][_0x9eaf('0x47')]){_0x57dca1[_0x9eaf('0x42')]=[{'all':!![]}];}_0x57dca1=_['merge']({},_0x57dca1,_0xad1306[_0x9eaf('0x41')]);return db[_0x9eaf('0x2e')][_0x9eaf('0x48')](_0x57dca1)[_0x9eaf('0x23')](handleEntityNotFound(_0x56ec2d,null))[_0x9eaf('0x23')](respondWithResult(_0x56ec2d,null))[_0x9eaf('0x45')](handleError(_0x56ec2d,null));};exports[_0x9eaf('0x49')]=function(_0x2d7423,_0x23781b){return db[_0x9eaf('0x2e')]['create'](_0x2d7423[_0x9eaf('0x4a')],{})[_0x9eaf('0x23')](function(_0x437eab){var _0x221cef=_0x2d7423[_0x9eaf('0x4b')][_0x9eaf('0x25')]({'plain':!![]});if(!_0x221cef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x221cef[_0x9eaf('0x4c')]===_0x9eaf('0x4b')){var _0x17811f=_0x437eab['get']({'plain':!![]});var _0x500f0c=_0x9eaf('0x26');return db[_0x9eaf('0x4d')][_0x9eaf('0x48')]({'where':{'name':_0x500f0c,'userProfileId':_0x221cef['userProfileId']},'raw':!![]})[_0x9eaf('0x23')](function(_0x13804a){if(_0x13804a&&_0x13804a[_0x9eaf('0x4e')]===0x0){return db[_0x9eaf('0x4f')][_0x9eaf('0x49')]({'name':_0x17811f['name'],'resourceId':_0x17811f['id'],'type':_0x13804a[_0x9eaf('0x2a')],'sectionId':_0x13804a['id']},{})['then'](function(){return _0x437eab;});}else{return _0x437eab;}})['catch'](function(_0x31bda6){logger[_0x9eaf('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31bda6);throw _0x31bda6;});}return _0x437eab;})[_0x9eaf('0x23')](respondWithResult(_0x23781b,0xc9))[_0x9eaf('0x45')](handleError(_0x23781b,null));};exports['update']=function(_0x4b3f28,_0x3ae5c2){if(_0x4b3f28[_0x9eaf('0x4a')]['id']){delete _0x4b3f28['body']['id'];}return db[_0x9eaf('0x2e')][_0x9eaf('0x48')]({'where':{'id':_0x4b3f28[_0x9eaf('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ae5c2,null))[_0x9eaf('0x23')](saveUpdates(_0x4b3f28[_0x9eaf('0x4a')],null))[_0x9eaf('0x23')](respondWithResult(_0x3ae5c2,null))['catch'](handleError(_0x3ae5c2,null));};exports[_0x9eaf('0x24')]=function(_0x25e456,_0x1fc878){return db[_0x9eaf('0x2e')][_0x9eaf('0x48')]({'where':{'id':_0x25e456[_0x9eaf('0x50')]['id']}})['then'](handleEntityNotFound(_0x1fc878,null))[_0x9eaf('0x23')](removeEntity(_0x1fc878,null))['catch'](handleError(_0x1fc878,null));}; \ No newline at end of file +var _0x0f2d=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Template','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','includeAll','findAll','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x8a217e,_0x450bfc){var _0x3fc350=function(_0x55ed99){while(--_0x55ed99){_0x8a217e['push'](_0x8a217e['shift']());}};_0x3fc350(++_0x450bfc);}(_0x0f2d,0x138));var _0xd0f2=function(_0x220666,_0x238058){_0x220666=_0x220666-0x0;var _0x4bd92d=_0x0f2d[_0x220666];return _0x4bd92d;};'use strict';var emlformat=require(_0xd0f2('0x0'));var rimraf=require(_0xd0f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f2('0x2'));var rp=require(_0xd0f2('0x3'));var moment=require('moment');var BPromise=require(_0xd0f2('0x4'));var Mustache=require(_0xd0f2('0x5'));var util=require(_0xd0f2('0x6'));var path=require(_0xd0f2('0x7'));var sox=require(_0xd0f2('0x8'));var csv=require(_0xd0f2('0x9'));var ejs=require(_0xd0f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0f2('0xb'));var squel=require(_0xd0f2('0xc'));var crypto=require(_0xd0f2('0xd'));var jsforce=require(_0xd0f2('0xe'));var deskjs=require(_0xd0f2('0xf'));var toCsv=require(_0xd0f2('0x9'));var querystring=require(_0xd0f2('0x10'));var Papa=require(_0xd0f2('0x11'));var Redis=require(_0xd0f2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd0f2('0x13'));var as=require(_0xd0f2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0f2('0x15'))('api');var utils=require(_0xd0f2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd0f2('0x17'))['db'];function respondWithStatusCode(_0x402a65,_0x599172){_0x599172=_0x599172||0xcc;return function(_0x220bff){if(_0x220bff){return _0x402a65[_0xd0f2('0x18')](_0x599172);}return _0x402a65[_0xd0f2('0x19')](_0x599172)[_0xd0f2('0x1a')]();};}function respondWithResult(_0x2eb73f,_0x125e53){_0x125e53=_0x125e53||0xc8;return function(_0x19c3a7){if(_0x19c3a7){return _0x2eb73f[_0xd0f2('0x19')](_0x125e53)[_0xd0f2('0x1b')](_0x19c3a7);}};}function respondWithFilteredResult(_0x41a226,_0xf223c9){return function(_0x2b81b6){if(_0x2b81b6){var _0x398c46=typeof _0xf223c9[_0xd0f2('0x1c')]===_0xd0f2('0x1d')&&typeof _0xf223c9[_0xd0f2('0x1e')]===_0xd0f2('0x1d');var _0x1ac075=_0x2b81b6[_0xd0f2('0x1f')];var _0x2a9e8e=_0x398c46?0x0:_0xf223c9[_0xd0f2('0x1c')];var _0x34af6b=_0x398c46?_0x2b81b6['count']:_0xf223c9[_0xd0f2('0x1c')]+_0xf223c9['limit'];var _0x25dad3;if(_0x34af6b>=_0x1ac075){_0x34af6b=_0x1ac075;_0x25dad3=0xc8;}else{_0x25dad3=0xce;}_0x41a226[_0xd0f2('0x19')](_0x25dad3);return _0x41a226[_0xd0f2('0x20')]('Content-Range',_0x2a9e8e+'-'+_0x34af6b+'/'+_0x1ac075)[_0xd0f2('0x1b')](_0x2b81b6);}return null;};}function patchUpdates(_0x113e50){return function(_0x1c6753){try{jsonpatch['apply'](_0x1c6753,_0x113e50,!![]);}catch(_0x500133){return BPromise[_0xd0f2('0x21')](_0x500133);}return _0x1c6753['save']();};}function saveUpdates(_0x4d28bf,_0x21bf58){return function(_0x3d90a8){if(_0x3d90a8){return _0x3d90a8[_0xd0f2('0x22')](_0x4d28bf)[_0xd0f2('0x23')](function(_0x1c178e){return _0x1c178e;});}return null;};}function removeEntity(_0x554dac,_0xff8ec6){return function(_0x865351){if(_0x865351){return _0x865351[_0xd0f2('0x24')]()['then'](function(){var _0x427c2d=_0x865351[_0xd0f2('0x25')]({'plain':!![]});var _0x1f2f70='Templates';return db[_0xd0f2('0x26')][_0xd0f2('0x24')]({'where':{'type':_0x1f2f70,'resourceId':_0x427c2d['id']}})[_0xd0f2('0x23')](function(){return _0x865351;});})[_0xd0f2('0x23')](function(){_0x554dac[_0xd0f2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f324a,_0x34d2d4){return function(_0x1e72db){if(!_0x1e72db){_0x2f324a['sendStatus'](0x194);}return _0x1e72db;};}function handleError(_0x3edaad,_0x46431b){_0x46431b=_0x46431b||0x1f4;return function(_0x3d8b18){logger[_0xd0f2('0x27')](_0x3d8b18[_0xd0f2('0x28')]);if(_0x3d8b18[_0xd0f2('0x29')]){delete _0x3d8b18['name'];}_0x3edaad[_0xd0f2('0x19')](_0x46431b)[_0xd0f2('0x2a')](_0x3d8b18);};}exports[_0xd0f2('0x2b')]=function(_0x28a922,_0x384a9d){var _0x459f9f={},_0x2ae454={},_0xac8e6a={'count':0x0,'rows':[]};var _0x25aa32=_['map'](db[_0xd0f2('0x2c')]['rawAttributes'],function(_0xab4e1d){return{'name':_0xab4e1d['fieldName'],'type':_0xab4e1d[_0xd0f2('0x2d')][_0xd0f2('0x2e')]};});_0x2ae454[_0xd0f2('0x2f')]=_[_0xd0f2('0x30')](_0x25aa32,_0xd0f2('0x29'));_0x2ae454[_0xd0f2('0x31')]=_[_0xd0f2('0x32')](_0x28a922['query']);_0x2ae454['filters']=_[_0xd0f2('0x33')](_0x2ae454[_0xd0f2('0x2f')],_0x2ae454[_0xd0f2('0x31')]);_0x459f9f[_0xd0f2('0x34')]=_['intersection'](_0x2ae454[_0xd0f2('0x2f')],qs[_0xd0f2('0x35')](_0x28a922[_0xd0f2('0x31')][_0xd0f2('0x35')]));_0x459f9f[_0xd0f2('0x34')]=_0x459f9f[_0xd0f2('0x34')]['length']?_0x459f9f[_0xd0f2('0x34')]:_0x2ae454[_0xd0f2('0x2f')];if(!_0x28a922[_0xd0f2('0x31')][_0xd0f2('0x36')](_0xd0f2('0x37'))){_0x459f9f[_0xd0f2('0x1e')]=qs[_0xd0f2('0x1e')](_0x28a922[_0xd0f2('0x31')][_0xd0f2('0x1e')]);_0x459f9f[_0xd0f2('0x1c')]=qs[_0xd0f2('0x1c')](_0x28a922[_0xd0f2('0x31')][_0xd0f2('0x1c')]);}_0x459f9f[_0xd0f2('0x38')]=qs[_0xd0f2('0x39')](_0x28a922['query'][_0xd0f2('0x39')]);_0x459f9f['where']=qs[_0xd0f2('0x3a')](_['pick'](_0x28a922[_0xd0f2('0x31')],_0x2ae454[_0xd0f2('0x3a')]),_0x25aa32);if(_0x28a922['query'][_0xd0f2('0x3b')]){_0x459f9f['where']=_[_0xd0f2('0x3c')](_0x459f9f[_0xd0f2('0x3d')],{'$or':_[_0xd0f2('0x30')](_0x25aa32,function(_0x2c6b9){if(_0x2c6b9['type']!=='VIRTUAL'){var _0x4ac3ab={};_0x4ac3ab[_0x2c6b9[_0xd0f2('0x29')]]={'$like':'%'+_0x28a922[_0xd0f2('0x31')][_0xd0f2('0x3b')]+'%'};return _0x4ac3ab;}})});}_0x459f9f=_[_0xd0f2('0x3c')]({},_0x459f9f,_0x28a922[_0xd0f2('0x3e')]);var _0x89055c={'where':_0x459f9f['where']};return db['Template'][_0xd0f2('0x1f')](_0x89055c)['then'](function(_0x3e06e9){_0xac8e6a[_0xd0f2('0x1f')]=_0x3e06e9;if(_0x28a922[_0xd0f2('0x31')][_0xd0f2('0x3f')]){_0x459f9f['include']=[{'all':!![]}];}return db['Template'][_0xd0f2('0x40')](_0x459f9f);})[_0xd0f2('0x23')](function(_0x33c440){_0xac8e6a['rows']=_0x33c440;return _0xac8e6a;})['then'](respondWithFilteredResult(_0x384a9d,_0x459f9f))['catch'](handleError(_0x384a9d,null));};exports['show']=function(_0x1b98a1,_0x501209){var _0x863dc4={'raw':!![],'where':{'id':_0x1b98a1['params']['id']}},_0x770094={};_0x770094[_0xd0f2('0x2f')]=_[_0xd0f2('0x32')](db['Template'][_0xd0f2('0x41')]);_0x770094['query']=_['keys'](_0x1b98a1[_0xd0f2('0x31')]);_0x770094[_0xd0f2('0x3a')]=_[_0xd0f2('0x33')](_0x770094[_0xd0f2('0x2f')],_0x770094[_0xd0f2('0x31')]);_0x863dc4['attributes']=_[_0xd0f2('0x33')](_0x770094[_0xd0f2('0x2f')],qs[_0xd0f2('0x35')](_0x1b98a1[_0xd0f2('0x31')]['fields']));_0x863dc4[_0xd0f2('0x34')]=_0x863dc4['attributes'][_0xd0f2('0x42')]?_0x863dc4[_0xd0f2('0x34')]:_0x770094[_0xd0f2('0x2f')];if(_0x1b98a1[_0xd0f2('0x31')][_0xd0f2('0x3f')]){_0x863dc4[_0xd0f2('0x43')]=[{'all':!![]}];}_0x863dc4=_['merge']({},_0x863dc4,_0x1b98a1[_0xd0f2('0x3e')]);return db[_0xd0f2('0x2c')][_0xd0f2('0x44')](_0x863dc4)['then'](handleEntityNotFound(_0x501209,null))[_0xd0f2('0x23')](respondWithResult(_0x501209,null))[_0xd0f2('0x45')](handleError(_0x501209,null));};exports[_0xd0f2('0x46')]=function(_0x3fab58,_0xf70477){return db[_0xd0f2('0x2c')][_0xd0f2('0x46')](_0x3fab58[_0xd0f2('0x47')],{})[_0xd0f2('0x23')](function(_0x9ae5ef){var _0x26ce0d=_0x3fab58[_0xd0f2('0x48')][_0xd0f2('0x25')]({'plain':!![]});if(!_0x26ce0d)throw new Error(_0xd0f2('0x49'));if(_0x26ce0d[_0xd0f2('0x4a')]===_0xd0f2('0x48')){var _0x9b1385=_0x9ae5ef[_0xd0f2('0x25')]({'plain':!![]});var _0x2f5cbd=_0xd0f2('0x4b');return db[_0xd0f2('0x4c')][_0xd0f2('0x44')]({'where':{'name':_0x2f5cbd,'userProfileId':_0x26ce0d[_0xd0f2('0x4d')]},'raw':!![]})[_0xd0f2('0x23')](function(_0x16bc75){if(_0x16bc75&&_0x16bc75[_0xd0f2('0x4e')]===0x0){return db[_0xd0f2('0x26')]['create']({'name':_0x9b1385[_0xd0f2('0x29')],'resourceId':_0x9b1385['id'],'type':_0x16bc75['name'],'sectionId':_0x16bc75['id']},{})[_0xd0f2('0x23')](function(){return _0x9ae5ef;});}else{return _0x9ae5ef;}})[_0xd0f2('0x45')](function(_0x4a9792){logger['error'](_0xd0f2('0x4f'),_0x4a9792);throw _0x4a9792;});}return _0x9ae5ef;})[_0xd0f2('0x23')](respondWithResult(_0xf70477,0xc9))[_0xd0f2('0x45')](handleError(_0xf70477,null));};exports['update']=function(_0x26eb48,_0x450f65){if(_0x26eb48[_0xd0f2('0x47')]['id']){delete _0x26eb48['body']['id'];}return db[_0xd0f2('0x2c')][_0xd0f2('0x44')]({'where':{'id':_0x26eb48[_0xd0f2('0x50')]['id']}})[_0xd0f2('0x23')](handleEntityNotFound(_0x450f65,null))[_0xd0f2('0x23')](saveUpdates(_0x26eb48[_0xd0f2('0x47')],null))[_0xd0f2('0x23')](respondWithResult(_0x450f65,null))['catch'](handleError(_0x450f65,null));};exports['destroy']=function(_0x3c5c94,_0x1c6536){return db[_0xd0f2('0x2c')][_0xd0f2('0x44')]({'where':{'id':_0x3c5c94[_0xd0f2('0x50')]['id']}})[_0xd0f2('0x23')](handleEntityNotFound(_0x1c6536,null))[_0xd0f2('0x23')](removeEntity(_0x1c6536,null))[_0xd0f2('0x45')](handleError(_0x1c6536,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a251fb2..029fc03 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 _0x79d2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','tools_templates','lodash','../../config/logger','api'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x79d2,0xe1));var _0x279d=function(_0x573ea2,_0x1517e4){_0x573ea2=_0x573ea2-0x0;var _0x2dc6ab=_0x79d2[_0x573ea2];return _0x2dc6ab;};'use strict';var _=require(_0x279d('0x0'));var util=require('util');var logger=require(_0x279d('0x1'))(_0x279d('0x2'));var moment=require(_0x279d('0x3'));var BPromise=require(_0x279d('0x4'));var rp=require(_0x279d('0x5'));var fs=require('fs');var path=require(_0x279d('0x6'));var rimraf=require(_0x279d('0x7'));var config=require(_0x279d('0x8'));var attributes=require(_0x279d('0x9'));module[_0x279d('0xa')]=function(_0x33bd1d,_0x52db93){return _0x33bd1d['define']('Template',attributes,{'tableName':_0x279d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddba=['rimraf','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3eb01f,_0x5c1dee){var _0x312cd4=function(_0x2d637f){while(--_0x2d637f){_0x3eb01f['push'](_0x3eb01f['shift']());}};_0x312cd4(++_0x5c1dee);}(_0xddba,0x171));var _0xaddb=function(_0xd69684,_0x1b80fb){_0xd69684=_0xd69684-0x0;var _0x42340d=_0xddba[_0xd69684];return _0x42340d;};'use strict';var _=require(_0xaddb('0x0'));var util=require(_0xaddb('0x1'));var logger=require(_0xaddb('0x2'))(_0xaddb('0x3'));var moment=require(_0xaddb('0x4'));var BPromise=require(_0xaddb('0x5'));var rp=require(_0xaddb('0x6'));var fs=require('fs');var path=require(_0xaddb('0x7'));var rimraf=require(_0xaddb('0x8'));var config=require('../../config/environment');var attributes=require(_0xaddb('0x9'));module[_0xaddb('0xa')]=function(_0x14ebae,_0x1eaa14){return _0x14ebae[_0xaddb('0xb')]('Template',attributes,{'tableName':_0xaddb('0xc'),'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 d747131..5e2ffda 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 _0xa0d9=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','stringify','catch','lodash'];(function(_0x25f3e3,_0x207891){var _0xa89b6d=function(_0xa51f2){while(--_0xa51f2){_0x25f3e3['push'](_0x25f3e3['shift']());}};_0xa89b6d(++_0x207891);}(_0xa0d9,0x19f));var _0x9a0d=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xa0d9[_0x33ebf5];return _0x66957b;};'use strict';var _=require(_0x9a0d('0x0'));var util=require(_0x9a0d('0x1'));var moment=require(_0x9a0d('0x2'));var BPromise=require(_0x9a0d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a0d('0x5'));var logger=require('../../config/logger')(_0x9a0d('0x6'));var config=require(_0x9a0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9a0d('0x8')][_0x9a0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc4ce8f,_0x37dfb8,_0x435b0f){return new BPromise(function(_0xfdbdf,_0x5804ba){return client['request'](_0xc4ce8f,_0x435b0f)[_0x9a0d('0xa')](function(_0x577212){logger['info'](_0x9a0d('0xb'),_0x37dfb8,_0x9a0d('0xc'));logger[_0x9a0d('0xd')](_0x9a0d('0xe'),_0x37dfb8,_0x9a0d('0xc'),JSON['stringify'](_0x577212));if(_0x577212[_0x9a0d('0xf')]){if(_0x577212['error'][_0x9a0d('0x10')]===0x1f4){logger[_0x9a0d('0xf')](_0x9a0d('0xb'),_0x37dfb8,_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);return _0x5804ba(_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);}logger[_0x9a0d('0xf')](_0x9a0d('0xb'),_0x37dfb8,_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);return _0xfdbdf(_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);}else{logger[_0x9a0d('0x12')]('Template,\x20%s,\x20%s',_0x37dfb8,'request\x20sent');_0xfdbdf(_0x577212[_0x9a0d('0x13')][_0x9a0d('0x11')]);}})['catch'](function(_0x190b0f){logger[_0x9a0d('0xf')]('Template,\x20%s,\x20%s',_0x37dfb8,_0x190b0f);_0x5804ba(_0x190b0f);});});}exports['GetTemplate']=function(_0x4a157d){var _0x5d5770=this;return new Promise(function(_0x231731,_0x27409b){return db['Template'][_0x9a0d('0x14')]({'raw':_0x4a157d['options']?_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x16')]===undefined?!![]:![]:!![],'where':_0x4a157d[_0x9a0d('0x15')]?_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x17')]||null:null,'attributes':_0x4a157d['options']?_0x4a157d['options'][_0x9a0d('0x18')]||null:null,'limit':_0x4a157d['options']?_0x4a157d['options'][_0x9a0d('0x19')]||null:null,'include':_0x4a157d[_0x9a0d('0x15')]?_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x1a')]?_[_0x9a0d('0x1b')](_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x1a')],function(_0x406c48){return{'model':db[_0x406c48[_0x9a0d('0x1c')]],'as':_0x406c48['as'],'attributes':_0x406c48['attributes'],'include':_0x406c48['include']?_[_0x9a0d('0x1b')](_0x406c48[_0x9a0d('0x1a')],function(_0x2e2cdd){return{'model':db[_0x2e2cdd[_0x9a0d('0x1c')]],'as':_0x2e2cdd['as'],'attributes':_0x2e2cdd['attributes'],'include':_0x2e2cdd[_0x9a0d('0x1a')]?_['map'](_0x2e2cdd[_0x9a0d('0x1a')],function(_0x2b3f44){return{'model':db[_0x2b3f44[_0x9a0d('0x1c')]],'as':_0x2b3f44['as'],'attributes':_0x2b3f44[_0x9a0d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3aa22f){logger[_0x9a0d('0x12')](_0x9a0d('0x1d'),_0x4a157d);logger['debug'](_0x9a0d('0x1d'),_0x4a157d,JSON[_0x9a0d('0x1e')](_0x3aa22f));_0x231731(_0x3aa22f);})[_0x9a0d('0x1f')](function(_0x5dc307){logger[_0x9a0d('0xf')](_0x9a0d('0x1d'),_0x5dc307[_0x9a0d('0x11')],_0x4a157d);_0x27409b(_0x5d5770[_0x9a0d('0xf')](0x1f4,_0x5dc307[_0x9a0d('0x11')]));});});}; \ No newline at end of file +var _0x877b=['request','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetTemplate','Template','findAll','options','raw','where','limit','map','include','model','attributes','then','catch','util','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x877b,0x1f1));var _0xb877=function(_0x1ffdbf,_0x4eeeb1){_0x1ffdbf=_0x1ffdbf-0x0;var _0x59cfa5=_0x877b[_0x1ffdbf];return _0x59cfa5;};'use strict';var _=require('lodash');var util=require(_0xb877('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb877('0x1'));var db=require(_0xb877('0x2'))['db'];var utils=require(_0xb877('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb877('0x4'));var client=jayson[_0xb877('0x5')][_0xb877('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c8c78,_0x38a097,_0x2e92b2){return new BPromise(function(_0x3cac94,_0x25eaa4){return client[_0xb877('0x7')](_0x1c8c78,_0x2e92b2)['then'](function(_0x10d09e){logger['info'](_0xb877('0x8'),_0x38a097,_0xb877('0x9'));logger['debug'](_0xb877('0xa'),_0x38a097,_0xb877('0x9'),JSON[_0xb877('0xb')](_0x10d09e));if(_0x10d09e[_0xb877('0xc')]){if(_0x10d09e[_0xb877('0xc')]['code']===0x1f4){logger[_0xb877('0xc')](_0xb877('0x8'),_0x38a097,_0x10d09e['error'][_0xb877('0xd')]);return _0x25eaa4(_0x10d09e[_0xb877('0xc')][_0xb877('0xd')]);}logger[_0xb877('0xc')](_0xb877('0x8'),_0x38a097,_0x10d09e[_0xb877('0xc')][_0xb877('0xd')]);return _0x3cac94(_0x10d09e[_0xb877('0xc')][_0xb877('0xd')]);}else{logger[_0xb877('0xe')](_0xb877('0x8'),_0x38a097,_0xb877('0x9'));_0x3cac94(_0x10d09e['result'][_0xb877('0xd')]);}})['catch'](function(_0x4d9e0f){logger['error']('Template,\x20%s,\x20%s',_0x38a097,_0x4d9e0f);_0x25eaa4(_0x4d9e0f);});});}exports[_0xb877('0xf')]=function(_0x52f0f2){var _0x4c2703=this;return new Promise(function(_0x40dc5d,_0x2b2ba6){return db[_0xb877('0x10')][_0xb877('0x11')]({'raw':_0x52f0f2[_0xb877('0x12')]?_0x52f0f2['options'][_0xb877('0x13')]===undefined?!![]:![]:!![],'where':_0x52f0f2[_0xb877('0x12')]?_0x52f0f2[_0xb877('0x12')][_0xb877('0x14')]||null:null,'attributes':_0x52f0f2[_0xb877('0x12')]?_0x52f0f2[_0xb877('0x12')]['attributes']||null:null,'limit':_0x52f0f2[_0xb877('0x12')]?_0x52f0f2[_0xb877('0x12')][_0xb877('0x15')]||null:null,'include':_0x52f0f2['options']?_0x52f0f2[_0xb877('0x12')]['include']?_[_0xb877('0x16')](_0x52f0f2['options'][_0xb877('0x17')],function(_0x5a1f61){return{'model':db[_0x5a1f61[_0xb877('0x18')]],'as':_0x5a1f61['as'],'attributes':_0x5a1f61[_0xb877('0x19')],'include':_0x5a1f61[_0xb877('0x17')]?_['map'](_0x5a1f61['include'],function(_0x30334f){return{'model':db[_0x30334f[_0xb877('0x18')]],'as':_0x30334f['as'],'attributes':_0x30334f[_0xb877('0x19')],'include':_0x30334f['include']?_[_0xb877('0x16')](_0x30334f[_0xb877('0x17')],function(_0x3ce917){return{'model':db[_0x3ce917[_0xb877('0x18')]],'as':_0x3ce917['as'],'attributes':_0x3ce917['attributes']};}):[]};}):[]};}):[]:[]})[_0xb877('0x1a')](function(_0x25e82c){logger['info'](_0xb877('0xf'),_0x52f0f2);logger['debug'](_0xb877('0xf'),_0x52f0f2,JSON[_0xb877('0xb')](_0x25e82c));_0x40dc5d(_0x25e82c);})[_0xb877('0x1b')](function(_0x59a995){logger['error'](_0xb877('0xf'),_0x59a995[_0xb877('0xd')],_0x52f0f2);_0x2b2ba6(_0x4c2703['error'](0x1f4,_0x59a995[_0xb877('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4a1bcc7..0086fba 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 _0x2fee=['./trigger.controller','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x110d3f,_0x9750b6){var _0x56fc95=function(_0x2a27a1){while(--_0x2a27a1){_0x110d3f['push'](_0x110d3f['shift']());}};_0x56fc95(++_0x9750b6);}(_0x2fee,0x11a));var _0xe2fe=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x2fee[_0x3f88bc];return _0x4df1c4;};'use strict';var multer=require(_0xe2fe('0x0'));var util=require('util');var path=require(_0xe2fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2fe('0x2'));var router=express['Router']();var fs_extra=require(_0xe2fe('0x3'));var auth=require(_0xe2fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe2fe('0x5'));var controller=require(_0xe2fe('0x6'));router[_0xe2fe('0x7')]('/',auth['isAuthenticated'](),controller[_0xe2fe('0x8')]);router[_0xe2fe('0x7')](_0xe2fe('0x9'),auth[_0xe2fe('0xa')](),controller[_0xe2fe('0xb')]);router[_0xe2fe('0x7')]('/:id/all_conditions',auth[_0xe2fe('0xa')](),controller[_0xe2fe('0xc')]);router['get'](_0xe2fe('0xd'),auth[_0xe2fe('0xa')](),controller[_0xe2fe('0xe')]);router[_0xe2fe('0x7')](_0xe2fe('0xf'),auth[_0xe2fe('0xa')](),controller[_0xe2fe('0x10')]);router[_0xe2fe('0x11')]('/',auth[_0xe2fe('0xa')](),controller[_0xe2fe('0x12')]);router[_0xe2fe('0x11')]('/:id/all_conditions',auth[_0xe2fe('0xa')](),controller['addAllCondition']);router[_0xe2fe('0x11')]('/:id/any_conditions',auth[_0xe2fe('0xa')](),controller[_0xe2fe('0x13')]);router[_0xe2fe('0x11')](_0xe2fe('0xf'),auth['isAuthenticated'](),controller[_0xe2fe('0x14')]);router[_0xe2fe('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe2fe('0x16')]);router['delete']('/:id',auth[_0xe2fe('0xa')](),controller['destroy']);module[_0xe2fe('0x17')]=router; \ No newline at end of file +var _0x9233=['getActions','post','create','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9233,0x1a0));var _0x3923=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x9233[_0x8c1005];return _0x175354;};'use strict';var multer=require(_0x3923('0x0'));var util=require(_0x3923('0x1'));var path=require(_0x3923('0x2'));var timeout=require(_0x3923('0x3'));var express=require('express');var router=express[_0x3923('0x4')]();var fs_extra=require(_0x3923('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3923('0x6'));var config=require(_0x3923('0x7'));var controller=require('./trigger.controller');router[_0x3923('0x8')]('/',auth[_0x3923('0x9')](),controller[_0x3923('0xa')]);router[_0x3923('0x8')](_0x3923('0xb'),auth[_0x3923('0x9')](),controller[_0x3923('0xc')]);router[_0x3923('0x8')](_0x3923('0xd'),auth[_0x3923('0x9')](),controller[_0x3923('0xe')]);router['get'](_0x3923('0xf'),auth[_0x3923('0x9')](),controller['getAnyConditions']);router[_0x3923('0x8')]('/:id/actions',auth[_0x3923('0x9')](),controller[_0x3923('0x10')]);router[_0x3923('0x11')]('/',auth['isAuthenticated'](),controller[_0x3923('0x12')]);router[_0x3923('0x11')](_0x3923('0xd'),auth[_0x3923('0x9')](),controller['addAllCondition']);router[_0x3923('0x11')]('/:id/any_conditions',auth[_0x3923('0x9')](),controller[_0x3923('0x13')]);router['post'](_0x3923('0x14'),auth['isAuthenticated'](),controller[_0x3923('0x15')]);router[_0x3923('0x16')](_0x3923('0xb'),auth['isAuthenticated'](),controller[_0x3923('0x17')]);router[_0x3923('0x18')](_0x3923('0xb'),auth['isAuthenticated'](),controller[_0x3923('0x19')]);module[_0x3923('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index c5e0e6b..6fc68a8 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 _0xa6d1=['STRING','BOOLEAN','sequelize','exports'];(function(_0x56c15f,_0x1fa5e2){var _0x371744=function(_0x2903e5){while(--_0x2903e5){_0x56c15f['push'](_0x56c15f['shift']());}};_0x371744(++_0x1fa5e2);}(_0xa6d1,0x1ae));var _0x1a6d=function(_0x141c05,_0x319076){_0x141c05=_0x141c05-0x0;var _0x25fa28=_0xa6d1[_0x141c05];return _0x25fa28;};'use strict';var Sequelize=require(_0x1a6d('0x0'));module[_0x1a6d('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1a6d('0x2')]},'description':{'type':Sequelize[_0x1a6d('0x2')]},'status':{'type':Sequelize[_0x1a6d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4328=['STRING','BOOLEAN','sequelize','exports'];(function(_0x146d26,_0x339c83){var _0x5cac8f=function(_0x497f31){while(--_0x497f31){_0x146d26['push'](_0x146d26['shift']());}};_0x5cac8f(++_0x339c83);}(_0x4328,0x1c6));var _0x8432=function(_0x5ddce2,_0x1daccb){_0x5ddce2=_0x5ddce2-0x0;var _0x58bc1c=_0x4328[_0x5ddce2];return _0x58bc1c;};'use strict';var Sequelize=require(_0x8432('0x0'));module[_0x8432('0x1')]={'name':{'type':Sequelize[_0x8432('0x2')]},'channel':{'type':Sequelize[_0x8432('0x2')]},'description':{'type':Sequelize[_0x8432('0x2')]},'status':{'type':Sequelize[_0x8432('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 25f03e1..f5385e9 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 _0xdb6a=['show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','catch','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','getAllConditions','hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','Trigger','findAll','rows'];(function(_0x39adb2,_0x540b96){var _0x1df693=function(_0x13fb10){while(--_0x13fb10){_0x39adb2['push'](_0x39adb2['shift']());}};_0x1df693(++_0x540b96);}(_0xdb6a,0x129));var _0xadb6=function(_0x2cefe2,_0x4d6972){_0x2cefe2=_0x2cefe2-0x0;var _0x385352=_0xdb6a[_0x2cefe2];return _0x385352;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xadb6('0x0'));var jsonpatch=require(_0xadb6('0x1'));var rp=require(_0xadb6('0x2'));var moment=require(_0xadb6('0x3'));var BPromise=require(_0xadb6('0x4'));var Mustache=require(_0xadb6('0x5'));var util=require('util');var path=require('path');var sox=require(_0xadb6('0x6'));var csv=require('to-csv');var ejs=require(_0xadb6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadb6('0x8'));var squel=require(_0xadb6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xadb6('0xa'));var querystring=require(_0xadb6('0xb'));var Papa=require(_0xadb6('0xc'));var Redis=require(_0xadb6('0xd'));var authService=require(_0xadb6('0xe'));var qs=require(_0xadb6('0xf'));var as=require(_0xadb6('0x10'));var hardwareService=require(_0xadb6('0x11'));var logger=require(_0xadb6('0x12'))(_0xadb6('0x13'));var utils=require('../../config/utils');var config=require(_0xadb6('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25a3de,_0x55b746){_0x55b746=_0x55b746||0xcc;return function(_0x2ce1f1){if(_0x2ce1f1){return _0x25a3de[_0xadb6('0x15')](_0x55b746);}return _0x25a3de[_0xadb6('0x16')](_0x55b746)[_0xadb6('0x17')]();};}function respondWithResult(_0x4d0af6,_0x445a7f){_0x445a7f=_0x445a7f||0xc8;return function(_0x509529){if(_0x509529){return _0x4d0af6['status'](_0x445a7f)[_0xadb6('0x18')](_0x509529);}};}function respondWithFilteredResult(_0x4873e6,_0x2736e2){return function(_0x2e044c){if(_0x2e044c){var _0x114b01=typeof _0x2736e2[_0xadb6('0x19')]===_0xadb6('0x1a')&&typeof _0x2736e2['limit']===_0xadb6('0x1a');var _0x285b8e=_0x2e044c['count'];var _0x3083c7=_0x114b01?0x0:_0x2736e2[_0xadb6('0x19')];var _0x2e4fa7=_0x114b01?_0x2e044c[_0xadb6('0x1b')]:_0x2736e2[_0xadb6('0x19')]+_0x2736e2[_0xadb6('0x1c')];var _0x8860e3;if(_0x2e4fa7>=_0x285b8e){_0x2e4fa7=_0x285b8e;_0x8860e3=0xc8;}else{_0x8860e3=0xce;}_0x4873e6[_0xadb6('0x16')](_0x8860e3);return _0x4873e6[_0xadb6('0x1d')](_0xadb6('0x1e'),_0x3083c7+'-'+_0x2e4fa7+'/'+_0x285b8e)[_0xadb6('0x18')](_0x2e044c);}return null;};}function patchUpdates(_0x1892c3){return function(_0x6ce9e0){try{jsonpatch[_0xadb6('0x1f')](_0x6ce9e0,_0x1892c3,!![]);}catch(_0x3d9a9b){return BPromise['reject'](_0x3d9a9b);}return _0x6ce9e0[_0xadb6('0x20')]();};}function saveUpdates(_0x19f34d,_0x450f12){return function(_0x1ac9e8){if(_0x1ac9e8){return _0x1ac9e8[_0xadb6('0x21')](_0x19f34d)['then'](function(_0xf175a0){return _0xf175a0;});}return null;};}function removeEntity(_0x40191f,_0x394f87){return function(_0x347bfc){if(_0x347bfc){return _0x347bfc[_0xadb6('0x22')]()[_0xadb6('0x23')](function(){var _0x2490f=_0x347bfc['get']({'plain':!![]});var _0x155ed6='Triggers';return db[_0xadb6('0x24')]['destroy']({'where':{'type':_0x155ed6,'resourceId':_0x2490f['id']}})[_0xadb6('0x23')](function(){return _0x347bfc;});})[_0xadb6('0x23')](function(){_0x40191f[_0xadb6('0x16')](0xcc)[_0xadb6('0x17')]();});}};}function handleEntityNotFound(_0x238a46,_0x117b09){return function(_0x50daaf){if(!_0x50daaf){_0x238a46['sendStatus'](0x194);}return _0x50daaf;};}function handleError(_0x3766a1,_0x1c73e9){_0x1c73e9=_0x1c73e9||0x1f4;return function(_0x55a226){logger[_0xadb6('0x25')](_0x55a226[_0xadb6('0x26')]);if(_0x55a226['name']){delete _0x55a226[_0xadb6('0x27')];}_0x3766a1['status'](_0x1c73e9)[_0xadb6('0x28')](_0x55a226);};}exports['index']=function(_0x3db378,_0x22b233){var _0x27c7ff={},_0x1836a5={},_0x260094={'count':0x0,'rows':[]};var _0x5158e5=_[_0xadb6('0x29')](db['Trigger'][_0xadb6('0x2a')],function(_0x57a00c){return{'name':_0x57a00c[_0xadb6('0x2b')],'type':_0x57a00c[_0xadb6('0x2c')][_0xadb6('0x2d')]};});_0x1836a5['model']=_[_0xadb6('0x29')](_0x5158e5,_0xadb6('0x27'));_0x1836a5[_0xadb6('0x2e')]=_[_0xadb6('0x2f')](_0x3db378[_0xadb6('0x2e')]);_0x1836a5['filters']=_[_0xadb6('0x30')](_0x1836a5[_0xadb6('0x31')],_0x1836a5['query']);_0x27c7ff[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x1836a5[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x3db378[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x27c7ff[_0xadb6('0x32')]=_0x27c7ff[_0xadb6('0x32')][_0xadb6('0x34')]?_0x27c7ff[_0xadb6('0x32')]:_0x1836a5[_0xadb6('0x31')];if(!_0x3db378[_0xadb6('0x2e')]['hasOwnProperty'](_0xadb6('0x35'))){_0x27c7ff[_0xadb6('0x1c')]=qs[_0xadb6('0x1c')](_0x3db378['query']['limit']);_0x27c7ff[_0xadb6('0x19')]=qs[_0xadb6('0x19')](_0x3db378[_0xadb6('0x2e')]['offset']);}_0x27c7ff[_0xadb6('0x36')]=qs[_0xadb6('0x37')](_0x3db378[_0xadb6('0x2e')][_0xadb6('0x37')]);_0x27c7ff[_0xadb6('0x38')]=qs[_0xadb6('0x39')](_[_0xadb6('0x3a')](_0x3db378[_0xadb6('0x2e')],_0x1836a5[_0xadb6('0x39')]),_0x5158e5);if(_0x3db378[_0xadb6('0x2e')][_0xadb6('0x3b')]){_0x27c7ff['where']=_[_0xadb6('0x3c')](_0x27c7ff[_0xadb6('0x38')],{'$or':_[_0xadb6('0x29')](_0x5158e5,function(_0x5e6c6b){if(_0x5e6c6b[_0xadb6('0x2c')]!==_0xadb6('0x3d')){var _0x18510f={};_0x18510f[_0x5e6c6b[_0xadb6('0x27')]]={'$like':'%'+_0x3db378['query'][_0xadb6('0x3b')]+'%'};return _0x18510f;}})});}_0x27c7ff=_[_0xadb6('0x3c')]({},_0x27c7ff,_0x3db378[_0xadb6('0x3e')]);var _0x5e2195={'where':_0x27c7ff['where']};return db['Trigger'][_0xadb6('0x1b')](_0x5e2195)[_0xadb6('0x23')](function(_0x29d27f){_0x260094['count']=_0x29d27f;if(_0x3db378['query'][_0xadb6('0x3f')]){_0x27c7ff['include']=[{'all':!![]}];}return db[_0xadb6('0x40')][_0xadb6('0x41')](_0x27c7ff);})[_0xadb6('0x23')](function(_0x248c90){_0x260094[_0xadb6('0x42')]=_0x248c90;return _0x260094;})[_0xadb6('0x23')](respondWithFilteredResult(_0x22b233,_0x27c7ff))['catch'](handleError(_0x22b233,null));};exports[_0xadb6('0x43')]=function(_0x35dff3,_0x3a9fc2){var _0x3629b6={'raw':![],'where':{'id':_0x35dff3[_0xadb6('0x44')]['id']}},_0x4f7caa={};_0x4f7caa[_0xadb6('0x31')]=_['keys'](db[_0xadb6('0x40')][_0xadb6('0x2a')]);_0x4f7caa[_0xadb6('0x2e')]=_[_0xadb6('0x2f')](_0x35dff3[_0xadb6('0x2e')]);_0x4f7caa[_0xadb6('0x39')]=_[_0xadb6('0x30')](_0x4f7caa['model'],_0x4f7caa['query']);_0x3629b6[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x4f7caa[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x35dff3[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x3629b6[_0xadb6('0x32')]=_0x3629b6[_0xadb6('0x32')][_0xadb6('0x34')]?_0x3629b6[_0xadb6('0x32')]:_0x4f7caa[_0xadb6('0x31')];if(_0x35dff3['query']['includeAll']){_0x3629b6[_0xadb6('0x45')]=[{'all':!![]}];}_0x3629b6=_[_0xadb6('0x3c')]({},_0x3629b6,_0x35dff3[_0xadb6('0x3e')]);return db[_0xadb6('0x40')][_0xadb6('0x46')](_0x3629b6)[_0xadb6('0x23')](handleEntityNotFound(_0x3a9fc2,null))[_0xadb6('0x23')](respondWithResult(_0x3a9fc2,null))['catch'](handleError(_0x3a9fc2,null));};exports[_0xadb6('0x47')]=function(_0x3d63d0,_0x349a26){return db[_0xadb6('0x40')][_0xadb6('0x47')](_0x3d63d0[_0xadb6('0x48')],{})[_0xadb6('0x23')](function(_0x81f0c0){var _0x16b7a4=_0x3d63d0[_0xadb6('0x49')][_0xadb6('0x4a')]({'plain':!![]});if(!_0x16b7a4)throw new Error(_0xadb6('0x4b'));if(_0x16b7a4[_0xadb6('0x4c')]===_0xadb6('0x49')){var _0xc608be=_0x81f0c0[_0xadb6('0x4a')]({'plain':!![]});var _0x4c9ad5='Triggers';return db[_0xadb6('0x4d')][_0xadb6('0x46')]({'where':{'name':_0x4c9ad5,'userProfileId':_0x16b7a4['userProfileId']},'raw':!![]})[_0xadb6('0x23')](function(_0x393d05){if(_0x393d05&&_0x393d05['autoAssociation']===0x0){return db[_0xadb6('0x24')]['create']({'name':_0xc608be[_0xadb6('0x27')],'resourceId':_0xc608be['id'],'type':_0x393d05[_0xadb6('0x27')],'sectionId':_0x393d05['id']},{})[_0xadb6('0x23')](function(){return _0x81f0c0;});}else{return _0x81f0c0;}})[_0xadb6('0x4e')](function(_0x5b35cd){logger[_0xadb6('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b35cd);throw _0x5b35cd;});}return _0x81f0c0;})[_0xadb6('0x23')](respondWithResult(_0x349a26,0xc9))['catch'](handleError(_0x349a26,null));};exports['update']=function(_0x4949e1,_0x2c3d12){if(_0x4949e1[_0xadb6('0x48')]['id']){delete _0x4949e1[_0xadb6('0x48')]['id'];}return db[_0xadb6('0x40')][_0xadb6('0x46')]({'where':{'id':_0x4949e1[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c3d12,null))[_0xadb6('0x23')](saveUpdates(_0x4949e1['body'],null))['then'](respondWithResult(_0x2c3d12,null))['catch'](handleError(_0x2c3d12,null));};exports[_0xadb6('0x22')]=function(_0x2a74e1,_0xdf0434){return db[_0xadb6('0x40')]['find']({'where':{'id':_0x2a74e1[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0xdf0434,null))[_0xadb6('0x23')](removeEntity(_0xdf0434,null))[_0xadb6('0x4e')](handleError(_0xdf0434,null));};exports[_0xadb6('0x4f')]=function(_0x294527,_0x1caad3,_0x3d6eef){if(_0x294527[_0xadb6('0x48')]['id']){delete _0x294527[_0xadb6('0x48')]['id'];}return db[_0xadb6('0x40')][_0xadb6('0x46')]({'where':{'id':_0x294527[_0xadb6('0x44')]['id']}})[_0xadb6('0x23')](handleEntityNotFound(_0x1caad3,null))[_0xadb6('0x23')](function(_0x186d00){if(_0x186d00){_0x294527['body'][_0xadb6('0x50')]=_0x186d00['id'];return db['Condition'][_0xadb6('0x47')](_0x294527[_0xadb6('0x48')]);}})[_0xadb6('0x23')](respondWithResult(_0x1caad3,null))[_0xadb6('0x4e')](handleError(_0x1caad3,null));};exports[_0xadb6('0x51')]=function(_0x7a635c,_0x445300,_0x24ae8b){if(_0x7a635c[_0xadb6('0x48')]['id']){delete _0x7a635c['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x7a635c[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x445300,null))[_0xadb6('0x23')](function(_0x58a2af){if(_0x58a2af){_0x7a635c[_0xadb6('0x48')][_0xadb6('0x52')]=_0x58a2af['id'];return db[_0xadb6('0x53')][_0xadb6('0x47')](_0x7a635c[_0xadb6('0x48')]);}})['then'](respondWithResult(_0x445300,null))[_0xadb6('0x4e')](handleError(_0x445300,null));};exports['getAllConditions']=function(_0x464326,_0x4cfc7d,_0x502941){var _0x6fa5f3={};var _0x113116={};var _0xf74a37;var _0x3cc5e3;return db[_0xadb6('0x40')][_0xadb6('0x54')]({'where':{'id':_0x464326[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cfc7d,null))[_0xadb6('0x23')](function(_0x4fe97c){if(_0x4fe97c){_0xf74a37=_0x4fe97c;_0x113116[_0xadb6('0x31')]=_[_0xadb6('0x2f')](db[_0xadb6('0x53')][_0xadb6('0x2a')]);_0x113116[_0xadb6('0x2e')]=_[_0xadb6('0x2f')](_0x464326[_0xadb6('0x2e')]);_0x113116[_0xadb6('0x39')]=_['intersection'](_0x113116[_0xadb6('0x31')],_0x113116['query']);_0x6fa5f3[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x113116[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x464326[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x6fa5f3[_0xadb6('0x32')]=_0x6fa5f3[_0xadb6('0x32')][_0xadb6('0x34')]?_0x6fa5f3['attributes']:_0x113116[_0xadb6('0x31')];_0x6fa5f3[_0xadb6('0x36')]=qs[_0xadb6('0x37')](_0x464326[_0xadb6('0x2e')][_0xadb6('0x37')]);_0x6fa5f3['where']=qs[_0xadb6('0x39')](_[_0xadb6('0x3a')](_0x464326['query'],_0x113116[_0xadb6('0x39')]));if(_0x464326[_0xadb6('0x2e')][_0xadb6('0x3b')]){_0x6fa5f3[_0xadb6('0x38')]=_[_0xadb6('0x3c')](_0x6fa5f3['where'],{'$or':_[_0xadb6('0x29')](_0x6fa5f3['attributes'],function(_0x2beec3){var _0x19b346={};_0x19b346[_0x2beec3]={'$like':'%'+_0x464326['query'][_0xadb6('0x3b')]+'%'};return _0x19b346;})});}_0x6fa5f3=_[_0xadb6('0x3c')]({},_0x6fa5f3,_0x464326[_0xadb6('0x3e')]);return _0xf74a37[_0xadb6('0x55')](_0x6fa5f3);}})['then'](function(_0x53e3bd){if(_0x53e3bd){_0x3cc5e3=_0x53e3bd[_0xadb6('0x34')];if(!_0x464326[_0xadb6('0x2e')][_0xadb6('0x56')](_0xadb6('0x35'))){_0x6fa5f3[_0xadb6('0x1c')]=qs['limit'](_0x464326[_0xadb6('0x2e')][_0xadb6('0x1c')]);_0x6fa5f3[_0xadb6('0x19')]=qs[_0xadb6('0x19')](_0x464326[_0xadb6('0x2e')]['offset']);}return _0xf74a37['getAllConditions'](_0x6fa5f3);}})[_0xadb6('0x23')](function(_0x318523){if(_0x318523){return _0x318523?{'count':_0x3cc5e3,'rows':_0x318523}:null;}})[_0xadb6('0x23')](respondWithResult(_0x4cfc7d,null))[_0xadb6('0x4e')](handleError(_0x4cfc7d,null));};exports[_0xadb6('0x57')]=function(_0x121428,_0x68f6ba,_0x1ccdae){var _0x2fdda8={};var _0x1a3149={};var _0x2eb511;var _0x5e272a;return db[_0xadb6('0x40')][_0xadb6('0x54')]({'where':{'id':_0x121428[_0xadb6('0x44')]['id']}})[_0xadb6('0x23')](handleEntityNotFound(_0x68f6ba,null))[_0xadb6('0x23')](function(_0x6d0ed3){if(_0x6d0ed3){_0x2eb511=_0x6d0ed3;_0x1a3149['model']=_[_0xadb6('0x2f')](db[_0xadb6('0x53')]['rawAttributes']);_0x1a3149['query']=_[_0xadb6('0x2f')](_0x121428['query']);_0x1a3149[_0xadb6('0x39')]=_[_0xadb6('0x30')](_0x1a3149[_0xadb6('0x31')],_0x1a3149[_0xadb6('0x2e')]);_0x2fdda8[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x1a3149[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x121428[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x2fdda8[_0xadb6('0x32')]=_0x2fdda8[_0xadb6('0x32')][_0xadb6('0x34')]?_0x2fdda8['attributes']:_0x1a3149[_0xadb6('0x31')];_0x2fdda8[_0xadb6('0x36')]=qs['sort'](_0x121428[_0xadb6('0x2e')]['sort']);_0x2fdda8[_0xadb6('0x38')]=qs[_0xadb6('0x39')](_[_0xadb6('0x3a')](_0x121428[_0xadb6('0x2e')],_0x1a3149[_0xadb6('0x39')]));if(_0x121428[_0xadb6('0x2e')][_0xadb6('0x3b')]){_0x2fdda8[_0xadb6('0x38')]=_[_0xadb6('0x3c')](_0x2fdda8[_0xadb6('0x38')],{'$or':_[_0xadb6('0x29')](_0x2fdda8[_0xadb6('0x32')],function(_0x1f295b){var _0x1c32f7={};_0x1c32f7[_0x1f295b]={'$like':'%'+_0x121428[_0xadb6('0x2e')][_0xadb6('0x3b')]+'%'};return _0x1c32f7;})});}_0x2fdda8=_['merge']({},_0x2fdda8,_0x121428[_0xadb6('0x3e')]);return _0x2eb511[_0xadb6('0x57')](_0x2fdda8);}})[_0xadb6('0x23')](function(_0x3880e4){if(_0x3880e4){_0x5e272a=_0x3880e4[_0xadb6('0x34')];if(!_0x121428['query'][_0xadb6('0x56')](_0xadb6('0x35'))){_0x2fdda8[_0xadb6('0x1c')]=qs[_0xadb6('0x1c')](_0x121428[_0xadb6('0x2e')]['limit']);_0x2fdda8['offset']=qs[_0xadb6('0x19')](_0x121428[_0xadb6('0x2e')][_0xadb6('0x19')]);}return _0x2eb511[_0xadb6('0x57')](_0x2fdda8);}})[_0xadb6('0x23')](function(_0x379cf3){if(_0x379cf3){return _0x379cf3?{'count':_0x5e272a,'rows':_0x379cf3}:null;}})[_0xadb6('0x23')](respondWithResult(_0x68f6ba,null))[_0xadb6('0x4e')](handleError(_0x68f6ba,null));};exports['addAction']=function(_0x34a862,_0x2ca6e7,_0x31e5e9){if(_0x34a862[_0xadb6('0x48')]['id']){delete _0x34a862['body']['id'];}return db[_0xadb6('0x40')]['find']({'where':{'id':_0x34a862[_0xadb6('0x44')]['id']}})[_0xadb6('0x23')](handleEntityNotFound(_0x2ca6e7,null))['then'](function(_0x31504e){if(_0x31504e){_0x34a862[_0xadb6('0x48')][_0xadb6('0x58')]=_0x31504e['id'];return db[_0xadb6('0x59')][_0xadb6('0x47')](_0x34a862[_0xadb6('0x48')]);}})['then'](respondWithResult(_0x2ca6e7,null))['catch'](handleError(_0x2ca6e7,null));};exports[_0xadb6('0x5a')]=function(_0x3ed51e,_0x548d38,_0x597b1f){var _0x1bc9d7={};var _0x3abcbb={};var _0x206196;var _0x485495;return db[_0xadb6('0x40')][_0xadb6('0x54')]({'where':{'id':_0x3ed51e['params']['id']}})['then'](handleEntityNotFound(_0x548d38,null))[_0xadb6('0x23')](function(_0x498040){if(_0x498040){_0x206196=_0x498040;_0x3abcbb[_0xadb6('0x31')]=_[_0xadb6('0x2f')](db['Action'][_0xadb6('0x2a')]);_0x3abcbb[_0xadb6('0x2e')]=_['keys'](_0x3ed51e[_0xadb6('0x2e')]);_0x3abcbb[_0xadb6('0x39')]=_[_0xadb6('0x30')](_0x3abcbb[_0xadb6('0x31')],_0x3abcbb[_0xadb6('0x2e')]);_0x1bc9d7[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x3abcbb[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x3ed51e[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x1bc9d7['attributes']=_0x1bc9d7['attributes']['length']?_0x1bc9d7[_0xadb6('0x32')]:_0x3abcbb[_0xadb6('0x31')];_0x1bc9d7['order']=qs[_0xadb6('0x37')](_0x3ed51e[_0xadb6('0x2e')]['sort']);_0x1bc9d7[_0xadb6('0x38')]=qs['filters'](_[_0xadb6('0x3a')](_0x3ed51e[_0xadb6('0x2e')],_0x3abcbb[_0xadb6('0x39')]));if(_0x3ed51e['query'][_0xadb6('0x3b')]){_0x1bc9d7[_0xadb6('0x38')]=_[_0xadb6('0x3c')](_0x1bc9d7['where'],{'$or':_['map'](_0x1bc9d7['attributes'],function(_0x11ed18){var _0x19c577={};_0x19c577[_0x11ed18]={'$like':'%'+_0x3ed51e[_0xadb6('0x2e')][_0xadb6('0x3b')]+'%'};return _0x19c577;})});}_0x1bc9d7=_[_0xadb6('0x3c')]({},_0x1bc9d7,_0x3ed51e[_0xadb6('0x3e')]);return _0x206196['getActions'](_0x1bc9d7);}})[_0xadb6('0x23')](function(_0x2b8946){if(_0x2b8946){_0x485495=_0x2b8946[_0xadb6('0x34')];if(!_0x3ed51e[_0xadb6('0x2e')]['hasOwnProperty'](_0xadb6('0x35'))){_0x1bc9d7[_0xadb6('0x1c')]=qs[_0xadb6('0x1c')](_0x3ed51e[_0xadb6('0x2e')][_0xadb6('0x1c')]);_0x1bc9d7[_0xadb6('0x19')]=qs[_0xadb6('0x19')](_0x3ed51e[_0xadb6('0x2e')]['offset']);}return _0x206196[_0xadb6('0x5a')](_0x1bc9d7);}})['then'](function(_0x3affcd){if(_0x3affcd){return _0x3affcd?{'count':_0x485495,'rows':_0x3affcd}:null;}})[_0xadb6('0x23')](respondWithResult(_0x548d38,null))['catch'](handleError(_0x548d38,null));}; \ No newline at end of file +var _0x5ed0=['limit','count','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','length','getAnyConditions','Action','getActions','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x431daf,_0x16f93b){var _0x2f929c=function(_0x3e3747){while(--_0x3e3747){_0x431daf['push'](_0x431daf['shift']());}};_0x2f929c(++_0x16f93b);}(_0x5ed0,0x99));var _0x05ed=function(_0x398aa5,_0x29279f){_0x398aa5=_0x398aa5-0x0;var _0xe64753=_0x5ed0[_0x398aa5];return _0xe64753;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05ed('0x0'));var zipdir=require(_0x05ed('0x1'));var jsonpatch=require(_0x05ed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x05ed('0x3'));var Mustache=require('mustache');var util=require(_0x05ed('0x4'));var path=require(_0x05ed('0x5'));var sox=require(_0x05ed('0x6'));var csv=require(_0x05ed('0x7'));var ejs=require(_0x05ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x05ed('0x9'));var crypto=require(_0x05ed('0xa'));var jsforce=require(_0x05ed('0xb'));var deskjs=require(_0x05ed('0xc'));var toCsv=require(_0x05ed('0x7'));var querystring=require(_0x05ed('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x05ed('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x05ed('0xf'));var hardwareService=require(_0x05ed('0x10'));var logger=require(_0x05ed('0x11'))(_0x05ed('0x12'));var utils=require(_0x05ed('0x13'));var config=require(_0x05ed('0x14'));var licenseUtil=require(_0x05ed('0x15'));var db=require(_0x05ed('0x16'))['db'];function respondWithStatusCode(_0x3fd766,_0x3a10f1){_0x3a10f1=_0x3a10f1||0xcc;return function(_0x16ab88){if(_0x16ab88){return _0x3fd766[_0x05ed('0x17')](_0x3a10f1);}return _0x3fd766[_0x05ed('0x18')](_0x3a10f1)[_0x05ed('0x19')]();};}function respondWithResult(_0x13419f,_0x19433c){_0x19433c=_0x19433c||0xc8;return function(_0x581b80){if(_0x581b80){return _0x13419f[_0x05ed('0x18')](_0x19433c)[_0x05ed('0x1a')](_0x581b80);}};}function respondWithFilteredResult(_0x2ca1d5,_0x4f1624){return function(_0x24b854){if(_0x24b854){var _0x2cdccd=typeof _0x4f1624[_0x05ed('0x1b')]===_0x05ed('0x1c')&&typeof _0x4f1624[_0x05ed('0x1d')]===_0x05ed('0x1c');var _0x4ecffb=_0x24b854[_0x05ed('0x1e')];var _0x1895ea=_0x2cdccd?0x0:_0x4f1624['offset'];var _0x12b611=_0x2cdccd?_0x24b854[_0x05ed('0x1e')]:_0x4f1624['offset']+_0x4f1624['limit'];var _0x499922;if(_0x12b611>=_0x4ecffb){_0x12b611=_0x4ecffb;_0x499922=0xc8;}else{_0x499922=0xce;}_0x2ca1d5[_0x05ed('0x18')](_0x499922);return _0x2ca1d5['set'](_0x05ed('0x1f'),_0x1895ea+'-'+_0x12b611+'/'+_0x4ecffb)['json'](_0x24b854);}return null;};}function patchUpdates(_0xef5c7c){return function(_0x3c8736){try{jsonpatch['apply'](_0x3c8736,_0xef5c7c,!![]);}catch(_0x534a00){return BPromise[_0x05ed('0x20')](_0x534a00);}return _0x3c8736['save']();};}function saveUpdates(_0x2fa363,_0x49389b){return function(_0x5f1819){if(_0x5f1819){return _0x5f1819[_0x05ed('0x21')](_0x2fa363)[_0x05ed('0x22')](function(_0x91db21){return _0x91db21;});}return null;};}function removeEntity(_0x515bfa,_0x4ba242){return function(_0x163f3f){if(_0x163f3f){return _0x163f3f[_0x05ed('0x23')]()['then'](function(){var _0x44f210=_0x163f3f[_0x05ed('0x24')]({'plain':!![]});var _0x2ea7cd='Triggers';return db[_0x05ed('0x25')][_0x05ed('0x23')]({'where':{'type':_0x2ea7cd,'resourceId':_0x44f210['id']}})[_0x05ed('0x22')](function(){return _0x163f3f;});})[_0x05ed('0x22')](function(){_0x515bfa[_0x05ed('0x18')](0xcc)[_0x05ed('0x19')]();});}};}function handleEntityNotFound(_0x5587b3,_0x560f57){return function(_0x20a7be){if(!_0x20a7be){_0x5587b3[_0x05ed('0x17')](0x194);}return _0x20a7be;};}function handleError(_0x13c077,_0x59cd15){_0x59cd15=_0x59cd15||0x1f4;return function(_0x5ea253){logger[_0x05ed('0x26')](_0x5ea253[_0x05ed('0x27')]);if(_0x5ea253[_0x05ed('0x28')]){delete _0x5ea253[_0x05ed('0x28')];}_0x13c077['status'](_0x59cd15)[_0x05ed('0x29')](_0x5ea253);};}exports[_0x05ed('0x2a')]=function(_0x11e4a3,_0x4da10b){var _0x5ee3a9={},_0x3e60a9={},_0x16cf19={'count':0x0,'rows':[]};var _0x222ef1=_[_0x05ed('0x2b')](db[_0x05ed('0x2c')]['rawAttributes'],function(_0x6f8187){return{'name':_0x6f8187[_0x05ed('0x2d')],'type':_0x6f8187[_0x05ed('0x2e')][_0x05ed('0x2f')]};});_0x3e60a9[_0x05ed('0x30')]=_['map'](_0x222ef1,_0x05ed('0x28'));_0x3e60a9[_0x05ed('0x31')]=_[_0x05ed('0x32')](_0x11e4a3['query']);_0x3e60a9['filters']=_[_0x05ed('0x33')](_0x3e60a9[_0x05ed('0x30')],_0x3e60a9[_0x05ed('0x31')]);_0x5ee3a9['attributes']=_[_0x05ed('0x33')](_0x3e60a9[_0x05ed('0x30')],qs[_0x05ed('0x34')](_0x11e4a3['query'][_0x05ed('0x34')]));_0x5ee3a9[_0x05ed('0x35')]=_0x5ee3a9['attributes']['length']?_0x5ee3a9['attributes']:_0x3e60a9[_0x05ed('0x30')];if(!_0x11e4a3['query'][_0x05ed('0x36')](_0x05ed('0x37'))){_0x5ee3a9['limit']=qs[_0x05ed('0x1d')](_0x11e4a3[_0x05ed('0x31')]['limit']);_0x5ee3a9['offset']=qs[_0x05ed('0x1b')](_0x11e4a3[_0x05ed('0x31')]['offset']);}_0x5ee3a9['order']=qs['sort'](_0x11e4a3['query'][_0x05ed('0x38')]);_0x5ee3a9[_0x05ed('0x39')]=qs[_0x05ed('0x3a')](_[_0x05ed('0x3b')](_0x11e4a3[_0x05ed('0x31')],_0x3e60a9[_0x05ed('0x3a')]),_0x222ef1);if(_0x11e4a3[_0x05ed('0x31')][_0x05ed('0x3c')]){_0x5ee3a9[_0x05ed('0x39')]=_['merge'](_0x5ee3a9[_0x05ed('0x39')],{'$or':_[_0x05ed('0x2b')](_0x222ef1,function(_0x58d0f2){if(_0x58d0f2[_0x05ed('0x2e')]!==_0x05ed('0x3d')){var _0x1715fe={};_0x1715fe[_0x58d0f2[_0x05ed('0x28')]]={'$like':'%'+_0x11e4a3[_0x05ed('0x31')][_0x05ed('0x3c')]+'%'};return _0x1715fe;}})});}_0x5ee3a9=_[_0x05ed('0x3e')]({},_0x5ee3a9,_0x11e4a3['options']);var _0x1d26b7={'where':_0x5ee3a9['where']};return db['Trigger'][_0x05ed('0x1e')](_0x1d26b7)[_0x05ed('0x22')](function(_0x95b50a){_0x16cf19[_0x05ed('0x1e')]=_0x95b50a;if(_0x11e4a3[_0x05ed('0x31')][_0x05ed('0x3f')]){_0x5ee3a9[_0x05ed('0x40')]=[{'all':!![]}];}return db[_0x05ed('0x2c')][_0x05ed('0x41')](_0x5ee3a9);})[_0x05ed('0x22')](function(_0x37bec4){_0x16cf19[_0x05ed('0x42')]=_0x37bec4;return _0x16cf19;})[_0x05ed('0x22')](respondWithFilteredResult(_0x4da10b,_0x5ee3a9))[_0x05ed('0x43')](handleError(_0x4da10b,null));};exports[_0x05ed('0x44')]=function(_0x38483c,_0x4b80ba){var _0x58badd={'raw':![],'where':{'id':_0x38483c[_0x05ed('0x45')]['id']}},_0x128df6={};_0x128df6['model']=_['keys'](db[_0x05ed('0x2c')][_0x05ed('0x46')]);_0x128df6[_0x05ed('0x31')]=_['keys'](_0x38483c['query']);_0x128df6[_0x05ed('0x3a')]=_[_0x05ed('0x33')](_0x128df6['model'],_0x128df6[_0x05ed('0x31')]);_0x58badd[_0x05ed('0x35')]=_[_0x05ed('0x33')](_0x128df6[_0x05ed('0x30')],qs[_0x05ed('0x34')](_0x38483c[_0x05ed('0x31')][_0x05ed('0x34')]));_0x58badd[_0x05ed('0x35')]=_0x58badd[_0x05ed('0x35')]['length']?_0x58badd['attributes']:_0x128df6[_0x05ed('0x30')];if(_0x38483c[_0x05ed('0x31')]['includeAll']){_0x58badd[_0x05ed('0x40')]=[{'all':!![]}];}_0x58badd=_[_0x05ed('0x3e')]({},_0x58badd,_0x38483c[_0x05ed('0x47')]);return db[_0x05ed('0x2c')][_0x05ed('0x48')](_0x58badd)['then'](handleEntityNotFound(_0x4b80ba,null))[_0x05ed('0x22')](respondWithResult(_0x4b80ba,null))[_0x05ed('0x43')](handleError(_0x4b80ba,null));};exports['create']=function(_0x31f587,_0x2b7b86){return db[_0x05ed('0x2c')][_0x05ed('0x49')](_0x31f587[_0x05ed('0x4a')],{})['then'](function(_0x3d66dc){var _0x23634f=_0x31f587[_0x05ed('0x4b')][_0x05ed('0x24')]({'plain':!![]});if(!_0x23634f)throw new Error(_0x05ed('0x4c'));if(_0x23634f[_0x05ed('0x4d')]===_0x05ed('0x4b')){var _0x3fd7b2=_0x3d66dc['get']({'plain':!![]});var _0x14a27d='Triggers';return db['UserProfileSection'][_0x05ed('0x48')]({'where':{'name':_0x14a27d,'userProfileId':_0x23634f[_0x05ed('0x4e')]},'raw':!![]})[_0x05ed('0x22')](function(_0x388a67){if(_0x388a67&&_0x388a67[_0x05ed('0x4f')]===0x0){return db[_0x05ed('0x25')][_0x05ed('0x49')]({'name':_0x3fd7b2[_0x05ed('0x28')],'resourceId':_0x3fd7b2['id'],'type':_0x388a67[_0x05ed('0x28')],'sectionId':_0x388a67['id']},{})['then'](function(){return _0x3d66dc;});}else{return _0x3d66dc;}})[_0x05ed('0x43')](function(_0x3b7d2c){logger[_0x05ed('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b7d2c);throw _0x3b7d2c;});}return _0x3d66dc;})['then'](respondWithResult(_0x2b7b86,0xc9))[_0x05ed('0x43')](handleError(_0x2b7b86,null));};exports['update']=function(_0x19fc66,_0x621059){if(_0x19fc66[_0x05ed('0x4a')]['id']){delete _0x19fc66[_0x05ed('0x4a')]['id'];}return db[_0x05ed('0x2c')][_0x05ed('0x48')]({'where':{'id':_0x19fc66[_0x05ed('0x45')]['id']}})[_0x05ed('0x22')](handleEntityNotFound(_0x621059,null))['then'](saveUpdates(_0x19fc66[_0x05ed('0x4a')],null))['then'](respondWithResult(_0x621059,null))[_0x05ed('0x43')](handleError(_0x621059,null));};exports[_0x05ed('0x23')]=function(_0x4a19e4,_0x3a1f0c){return db['Trigger'][_0x05ed('0x48')]({'where':{'id':_0x4a19e4[_0x05ed('0x45')]['id']}})[_0x05ed('0x22')](handleEntityNotFound(_0x3a1f0c,null))['then'](removeEntity(_0x3a1f0c,null))[_0x05ed('0x43')](handleError(_0x3a1f0c,null));};exports[_0x05ed('0x50')]=function(_0x4a4167,_0x7cd5f8,_0x49e5b4){if(_0x4a4167[_0x05ed('0x4a')]['id']){delete _0x4a4167[_0x05ed('0x4a')]['id'];}return db[_0x05ed('0x2c')][_0x05ed('0x48')]({'where':{'id':_0x4a4167[_0x05ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x7cd5f8,null))[_0x05ed('0x22')](function(_0x143417){if(_0x143417){_0x4a4167[_0x05ed('0x4a')]['TriggerAllId']=_0x143417['id'];return db[_0x05ed('0x51')]['create'](_0x4a4167['body']);}})['then'](respondWithResult(_0x7cd5f8,null))[_0x05ed('0x43')](handleError(_0x7cd5f8,null));};exports[_0x05ed('0x52')]=function(_0x3b6cd1,_0xa8128e,_0x18812c){if(_0x3b6cd1[_0x05ed('0x4a')]['id']){delete _0x3b6cd1['body']['id'];}return db[_0x05ed('0x2c')][_0x05ed('0x48')]({'where':{'id':_0x3b6cd1[_0x05ed('0x45')]['id']}})['then'](handleEntityNotFound(_0xa8128e,null))[_0x05ed('0x22')](function(_0x32d31e){if(_0x32d31e){_0x3b6cd1[_0x05ed('0x4a')][_0x05ed('0x53')]=_0x32d31e['id'];return db[_0x05ed('0x51')]['create'](_0x3b6cd1[_0x05ed('0x4a')]);}})[_0x05ed('0x22')](respondWithResult(_0xa8128e,null))[_0x05ed('0x43')](handleError(_0xa8128e,null));};exports[_0x05ed('0x54')]=function(_0x2d1122,_0x2e97f3,_0x232f4e){var _0x4f9bb2={};var _0x8ca3fb={};var _0x27bb1c;var _0x47a45b;return db[_0x05ed('0x2c')][_0x05ed('0x55')]({'where':{'id':_0x2d1122[_0x05ed('0x45')]['id']}})[_0x05ed('0x22')](handleEntityNotFound(_0x2e97f3,null))[_0x05ed('0x22')](function(_0x4bfc7e){if(_0x4bfc7e){_0x27bb1c=_0x4bfc7e;_0x8ca3fb['model']=_['keys'](db['Condition'][_0x05ed('0x46')]);_0x8ca3fb[_0x05ed('0x31')]=_[_0x05ed('0x32')](_0x2d1122[_0x05ed('0x31')]);_0x8ca3fb[_0x05ed('0x3a')]=_[_0x05ed('0x33')](_0x8ca3fb[_0x05ed('0x30')],_0x8ca3fb[_0x05ed('0x31')]);_0x4f9bb2['attributes']=_[_0x05ed('0x33')](_0x8ca3fb['model'],qs['fields'](_0x2d1122['query']['fields']));_0x4f9bb2[_0x05ed('0x35')]=_0x4f9bb2['attributes']['length']?_0x4f9bb2[_0x05ed('0x35')]:_0x8ca3fb[_0x05ed('0x30')];_0x4f9bb2[_0x05ed('0x56')]=qs[_0x05ed('0x38')](_0x2d1122[_0x05ed('0x31')][_0x05ed('0x38')]);_0x4f9bb2[_0x05ed('0x39')]=qs[_0x05ed('0x3a')](_['pick'](_0x2d1122[_0x05ed('0x31')],_0x8ca3fb[_0x05ed('0x3a')]));if(_0x2d1122[_0x05ed('0x31')]['filter']){_0x4f9bb2[_0x05ed('0x39')]=_[_0x05ed('0x3e')](_0x4f9bb2['where'],{'$or':_[_0x05ed('0x2b')](_0x4f9bb2['attributes'],function(_0x578306){var _0xc20086={};_0xc20086[_0x578306]={'$like':'%'+_0x2d1122[_0x05ed('0x31')][_0x05ed('0x3c')]+'%'};return _0xc20086;})});}_0x4f9bb2=_['merge']({},_0x4f9bb2,_0x2d1122[_0x05ed('0x47')]);return _0x27bb1c[_0x05ed('0x54')](_0x4f9bb2);}})['then'](function(_0x35156a){if(_0x35156a){_0x47a45b=_0x35156a['length'];if(!_0x2d1122[_0x05ed('0x31')][_0x05ed('0x36')](_0x05ed('0x37'))){_0x4f9bb2[_0x05ed('0x1d')]=qs[_0x05ed('0x1d')](_0x2d1122[_0x05ed('0x31')]['limit']);_0x4f9bb2[_0x05ed('0x1b')]=qs[_0x05ed('0x1b')](_0x2d1122[_0x05ed('0x31')][_0x05ed('0x1b')]);}return _0x27bb1c[_0x05ed('0x54')](_0x4f9bb2);}})[_0x05ed('0x22')](function(_0x37aee9){if(_0x37aee9){return _0x37aee9?{'count':_0x47a45b,'rows':_0x37aee9}:null;}})['then'](respondWithResult(_0x2e97f3,null))[_0x05ed('0x43')](handleError(_0x2e97f3,null));};exports['getAnyConditions']=function(_0x320a95,_0x342bf1,_0x3e3ac4){var _0x1a5724={};var _0x4407a2={};var _0x435f7e;var _0x21acd8;return db[_0x05ed('0x2c')][_0x05ed('0x55')]({'where':{'id':_0x320a95[_0x05ed('0x45')]['id']}})[_0x05ed('0x22')](handleEntityNotFound(_0x342bf1,null))[_0x05ed('0x22')](function(_0x25ee88){if(_0x25ee88){_0x435f7e=_0x25ee88;_0x4407a2[_0x05ed('0x30')]=_['keys'](db[_0x05ed('0x51')][_0x05ed('0x46')]);_0x4407a2[_0x05ed('0x31')]=_[_0x05ed('0x32')](_0x320a95[_0x05ed('0x31')]);_0x4407a2['filters']=_[_0x05ed('0x33')](_0x4407a2[_0x05ed('0x30')],_0x4407a2[_0x05ed('0x31')]);_0x1a5724[_0x05ed('0x35')]=_[_0x05ed('0x33')](_0x4407a2['model'],qs[_0x05ed('0x34')](_0x320a95[_0x05ed('0x31')][_0x05ed('0x34')]));_0x1a5724['attributes']=_0x1a5724[_0x05ed('0x35')][_0x05ed('0x57')]?_0x1a5724[_0x05ed('0x35')]:_0x4407a2[_0x05ed('0x30')];_0x1a5724['order']=qs[_0x05ed('0x38')](_0x320a95['query']['sort']);_0x1a5724[_0x05ed('0x39')]=qs[_0x05ed('0x3a')](_[_0x05ed('0x3b')](_0x320a95['query'],_0x4407a2[_0x05ed('0x3a')]));if(_0x320a95[_0x05ed('0x31')][_0x05ed('0x3c')]){_0x1a5724[_0x05ed('0x39')]=_[_0x05ed('0x3e')](_0x1a5724[_0x05ed('0x39')],{'$or':_[_0x05ed('0x2b')](_0x1a5724[_0x05ed('0x35')],function(_0x3e2aab){var _0x11abf0={};_0x11abf0[_0x3e2aab]={'$like':'%'+_0x320a95[_0x05ed('0x31')][_0x05ed('0x3c')]+'%'};return _0x11abf0;})});}_0x1a5724=_[_0x05ed('0x3e')]({},_0x1a5724,_0x320a95['options']);return _0x435f7e[_0x05ed('0x58')](_0x1a5724);}})['then'](function(_0x33a117){if(_0x33a117){_0x21acd8=_0x33a117[_0x05ed('0x57')];if(!_0x320a95[_0x05ed('0x31')][_0x05ed('0x36')]('nolimit')){_0x1a5724[_0x05ed('0x1d')]=qs[_0x05ed('0x1d')](_0x320a95[_0x05ed('0x31')][_0x05ed('0x1d')]);_0x1a5724[_0x05ed('0x1b')]=qs['offset'](_0x320a95[_0x05ed('0x31')]['offset']);}return _0x435f7e[_0x05ed('0x58')](_0x1a5724);}})[_0x05ed('0x22')](function(_0x162e90){if(_0x162e90){return _0x162e90?{'count':_0x21acd8,'rows':_0x162e90}:null;}})['then'](respondWithResult(_0x342bf1,null))['catch'](handleError(_0x342bf1,null));};exports['addAction']=function(_0x20891d,_0x175467,_0x3c8a80){if(_0x20891d['body']['id']){delete _0x20891d[_0x05ed('0x4a')]['id'];}return db['Trigger'][_0x05ed('0x48')]({'where':{'id':_0x20891d['params']['id']}})[_0x05ed('0x22')](handleEntityNotFound(_0x175467,null))['then'](function(_0x474f79){if(_0x474f79){_0x20891d[_0x05ed('0x4a')]['TriggerId']=_0x474f79['id'];return db[_0x05ed('0x59')][_0x05ed('0x49')](_0x20891d['body']);}})[_0x05ed('0x22')](respondWithResult(_0x175467,null))[_0x05ed('0x43')](handleError(_0x175467,null));};exports[_0x05ed('0x5a')]=function(_0x36b514,_0x205de9,_0xa50d19){var _0x4d567e={};var _0x513432={};var _0x5d6528;var _0x48495c;return db[_0x05ed('0x2c')][_0x05ed('0x55')]({'where':{'id':_0x36b514[_0x05ed('0x45')]['id']}})[_0x05ed('0x22')](handleEntityNotFound(_0x205de9,null))[_0x05ed('0x22')](function(_0x133e9a){if(_0x133e9a){_0x5d6528=_0x133e9a;_0x513432[_0x05ed('0x30')]=_['keys'](db[_0x05ed('0x59')][_0x05ed('0x46')]);_0x513432[_0x05ed('0x31')]=_[_0x05ed('0x32')](_0x36b514[_0x05ed('0x31')]);_0x513432['filters']=_['intersection'](_0x513432[_0x05ed('0x30')],_0x513432[_0x05ed('0x31')]);_0x4d567e[_0x05ed('0x35')]=_['intersection'](_0x513432[_0x05ed('0x30')],qs[_0x05ed('0x34')](_0x36b514[_0x05ed('0x31')][_0x05ed('0x34')]));_0x4d567e['attributes']=_0x4d567e[_0x05ed('0x35')][_0x05ed('0x57')]?_0x4d567e[_0x05ed('0x35')]:_0x513432[_0x05ed('0x30')];_0x4d567e[_0x05ed('0x56')]=qs[_0x05ed('0x38')](_0x36b514[_0x05ed('0x31')][_0x05ed('0x38')]);_0x4d567e[_0x05ed('0x39')]=qs[_0x05ed('0x3a')](_[_0x05ed('0x3b')](_0x36b514[_0x05ed('0x31')],_0x513432[_0x05ed('0x3a')]));if(_0x36b514[_0x05ed('0x31')]['filter']){_0x4d567e[_0x05ed('0x39')]=_[_0x05ed('0x3e')](_0x4d567e[_0x05ed('0x39')],{'$or':_[_0x05ed('0x2b')](_0x4d567e[_0x05ed('0x35')],function(_0x1a80f1){var _0x3d6793={};_0x3d6793[_0x1a80f1]={'$like':'%'+_0x36b514[_0x05ed('0x31')][_0x05ed('0x3c')]+'%'};return _0x3d6793;})});}_0x4d567e=_[_0x05ed('0x3e')]({},_0x4d567e,_0x36b514[_0x05ed('0x47')]);return _0x5d6528['getActions'](_0x4d567e);}})['then'](function(_0x813d38){if(_0x813d38){_0x48495c=_0x813d38[_0x05ed('0x57')];if(!_0x36b514[_0x05ed('0x31')][_0x05ed('0x36')]('nolimit')){_0x4d567e['limit']=qs[_0x05ed('0x1d')](_0x36b514[_0x05ed('0x31')]['limit']);_0x4d567e[_0x05ed('0x1b')]=qs[_0x05ed('0x1b')](_0x36b514[_0x05ed('0x31')][_0x05ed('0x1b')]);}return _0x5d6528[_0x05ed('0x5a')](_0x4d567e);}})['then'](function(_0x1d0537){if(_0x1d0537){return _0x1d0537?{'count':_0x48495c,'rows':_0x1d0537}:null;}})[_0x05ed('0x22')](respondWithResult(_0x205de9,null))[_0x05ed('0x43')](handleError(_0x205de9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6e08da8..0d95233 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 _0xb7c8=['request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb7c8,0x119));var _0x8b7c=function(_0x134569,_0x4fc102){_0x134569=_0x134569-0x0;var _0x3566d1=_0xb7c8[_0x134569];return _0x3566d1;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3a8=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2b86cf,_0x12c218){var _0x417ed3=function(_0x325baa){while(--_0x325baa){_0x2b86cf['push'](_0x2b86cf['shift']());}};_0x417ed3(++_0x12c218);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xc3a8[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0x8c3a('0x0'));var util=require(_0x8c3a('0x1'));var logger=require(_0x8c3a('0x2'))('api');var moment=require(_0x8c3a('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c3a('0x4'));var fs=require('fs');var path=require(_0x8c3a('0x5'));var rimraf=require(_0x8c3a('0x6'));var config=require(_0x8c3a('0x7'));var attributes=require('./trigger.attributes');module[_0x8c3a('0x8')]=function(_0x2477f9,_0x18a92a){return _0x2477f9[_0x8c3a('0x9')](_0x8c3a('0xa'),attributes,{'tableName':_0x8c3a('0xb'),'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 6a9a9ed..ecb7f04 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 _0x1203=['client','http','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrigger','Trigger','options','raw','attributes','limit','include','model','map','then','catch','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xacc118,_0x3aa0d1){var _0x51c83d=function(_0x2a9e9f){while(--_0x2a9e9f){_0xacc118['push'](_0xacc118['shift']());}};_0x51c83d(++_0x3aa0d1);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ac620,_0x1f1c97,_0x5e9785){return new BPromise(function(_0x1fa4b8,_0x513da6){return client['request'](_0x2ac620,_0x5e9785)['then'](function(_0x580f86){logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,'request\x20sent');logger[_0x3120('0x10')](_0x3120('0x11'),_0x1f1c97,_0x3120('0x12'),JSON[_0x3120('0x13')](_0x580f86));if(_0x580f86['error']){if(_0x580f86[_0x3120('0x14')][_0x3120('0x15')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x1f1c97,_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);return _0x513da6(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}logger[_0x3120('0x14')](_0x3120('0xf'),_0x1f1c97,_0x580f86[_0x3120('0x14')]['message']);return _0x1fa4b8(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}else{logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,_0x3120('0x12'));_0x1fa4b8(_0x580f86[_0x3120('0x17')][_0x3120('0x16')]);}})['catch'](function(_0x308873){logger['error'](_0x3120('0xf'),_0x1f1c97,_0x308873);_0x513da6(_0x308873);});});}exports[_0x3120('0x18')]=function(_0x2bbdb7){var _0x1a513c=this;return new Promise(function(_0x3c8c9b,_0x3af913){return db[_0x3120('0x19')]['findAll']({'raw':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')]['where']||null:null,'attributes':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1c')]||null:null,'limit':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1d')]||null:null,'include':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')][_0x3120('0x1e')]?_['map'](_0x2bbdb7[_0x3120('0x1a')]['include'],function(_0x444b3b){return{'model':db[_0x444b3b[_0x3120('0x1f')]],'as':_0x444b3b['as'],'attributes':_0x444b3b[_0x3120('0x1c')],'include':_0x444b3b['include']?_['map'](_0x444b3b[_0x3120('0x1e')],function(_0x7d0b5f){return{'model':db[_0x7d0b5f['model']],'as':_0x7d0b5f['as'],'attributes':_0x7d0b5f[_0x3120('0x1c')],'include':_0x7d0b5f[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x7d0b5f['include'],function(_0x2636b5){return{'model':db[_0x2636b5[_0x3120('0x1f')]],'as':_0x2636b5['as'],'attributes':_0x2636b5[_0x3120('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3120('0x21')](function(_0x4b343b){logger['info']('GetTrigger',_0x2bbdb7);logger[_0x3120('0x10')]('GetTrigger',_0x2bbdb7,JSON[_0x3120('0x13')](_0x4b343b));_0x3c8c9b(_0x4b343b);})[_0x3120('0x22')](function(_0x3de290){logger[_0x3120('0x14')](_0x3120('0x18'),_0x3de290[_0x3120('0x16')],_0x2bbdb7);_0x3af913(_0x1a513c['error'](0x1f4,_0x3de290[_0x3120('0x16')]));});});};exports[_0x3120('0x23')]=function(_0x1471de){var _0x1ee7bc=this;return new Promise(function(_0x6ba5,_0x35e69f){return db[_0x3120('0x19')][_0x3120('0x24')]({'raw':_0x1471de['options']?_0x1471de['options'][_0x3120('0x1b')]===undefined?!![]:![]:!![],'where':_0x1471de[_0x3120('0x1a')]?_0x1471de[_0x3120('0x1a')][_0x3120('0x25')]||null:null,'attributes':_0x1471de[_0x3120('0x1a')]?_0x1471de[_0x3120('0x1a')]['attributes']||null:null,'include':_0x1471de[_0x3120('0x1a')]?_0x1471de[_0x3120('0x1a')][_0x3120('0x1e')]?_[_0x3120('0x20')](_0x1471de[_0x3120('0x1a')][_0x3120('0x1e')],function(_0x25f9cc){return{'model':db[_0x25f9cc['model']],'as':_0x25f9cc['as'],'attributes':_0x25f9cc[_0x3120('0x1c')],'include':_0x25f9cc[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x25f9cc[_0x3120('0x1e')],function(_0x3067ca){return{'model':db[_0x3067ca[_0x3120('0x1f')]],'as':_0x3067ca['as'],'attributes':_0x3067ca[_0x3120('0x1c')],'include':_0x3067ca[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x3067ca[_0x3120('0x1e')],function(_0x2fb199){return{'model':db[_0x2fb199[_0x3120('0x1f')]],'as':_0x2fb199['as'],'attributes':_0x2fb199[_0x3120('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x496364){logger[_0x3120('0xe')](_0x3120('0x23'),_0x1471de);logger[_0x3120('0x10')]('ShowTrigger',_0x1471de,JSON[_0x3120('0x13')](_0x496364));_0x6ba5(_0x496364);})[_0x3120('0x22')](function(_0x90f45){logger['error'](_0x3120('0x23'),_0x90f45[_0x3120('0x16')],_0x1471de);_0x35e69f(_0x1ee7bc[_0x3120('0x14')](0x1f4,_0x90f45[_0x3120('0x16')]));});});}; \ No newline at end of file +var _0xf241=['message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowTrigger','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1879a6,_0x2cb4df){var _0x3ca317=function(_0x2c15d2){while(--_0x2c15d2){_0x1879a6['push'](_0x1879a6['shift']());}};_0x3ca317(++_0x2cb4df);}(_0xf241,0x14b));var _0x1f24=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf241[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1f24('0x0'));var util=require(_0x1f24('0x1'));var moment=require(_0x1f24('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f24('0x3'));var fs=require('fs');var Redis=require(_0x1f24('0x4'));var db=require(_0x1f24('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f24('0x6'))('rpc');var config=require(_0x1f24('0x7'));var jayson=require(_0x1f24('0x8'));var client=jayson[_0x1f24('0x9')][_0x1f24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e440,_0x15e124,_0x59e8b3){return new BPromise(function(_0x4a100c,_0x3c9aa1){return client['request'](_0x19e440,_0x59e8b3)[_0x1f24('0xb')](function(_0x461909){logger['info'](_0x1f24('0xc'),_0x15e124,_0x1f24('0xd'));logger[_0x1f24('0xe')](_0x1f24('0xf'),_0x15e124,_0x1f24('0xd'),JSON[_0x1f24('0x10')](_0x461909));if(_0x461909[_0x1f24('0x11')]){if(_0x461909['error'][_0x1f24('0x12')]===0x1f4){logger[_0x1f24('0x11')](_0x1f24('0xc'),_0x15e124,_0x461909[_0x1f24('0x11')]['message']);return _0x3c9aa1(_0x461909[_0x1f24('0x11')][_0x1f24('0x13')]);}logger[_0x1f24('0x11')](_0x1f24('0xc'),_0x15e124,_0x461909[_0x1f24('0x11')][_0x1f24('0x13')]);return _0x4a100c(_0x461909[_0x1f24('0x11')][_0x1f24('0x13')]);}else{logger['info'](_0x1f24('0xc'),_0x15e124,_0x1f24('0xd'));_0x4a100c(_0x461909[_0x1f24('0x14')][_0x1f24('0x13')]);}})[_0x1f24('0x15')](function(_0x387172){logger[_0x1f24('0x11')](_0x1f24('0xc'),_0x15e124,_0x387172);_0x3c9aa1(_0x387172);});});}exports[_0x1f24('0x16')]=function(_0x1dd04a){var _0x2d4f80=this;return new Promise(function(_0x5b2c3b,_0x473373){return db[_0x1f24('0x17')][_0x1f24('0x18')]({'raw':_0x1dd04a[_0x1f24('0x19')]?_0x1dd04a[_0x1f24('0x19')][_0x1f24('0x1a')]===undefined?!![]:![]:!![],'where':_0x1dd04a[_0x1f24('0x19')]?_0x1dd04a[_0x1f24('0x19')][_0x1f24('0x1b')]||null:null,'attributes':_0x1dd04a[_0x1f24('0x19')]?_0x1dd04a['options'][_0x1f24('0x1c')]||null:null,'limit':_0x1dd04a[_0x1f24('0x19')]?_0x1dd04a[_0x1f24('0x19')][_0x1f24('0x1d')]||null:null,'include':_0x1dd04a[_0x1f24('0x19')]?_0x1dd04a[_0x1f24('0x19')][_0x1f24('0x1e')]?_[_0x1f24('0x1f')](_0x1dd04a[_0x1f24('0x19')][_0x1f24('0x1e')],function(_0x5f3c4a){return{'model':db[_0x5f3c4a[_0x1f24('0x20')]],'as':_0x5f3c4a['as'],'attributes':_0x5f3c4a[_0x1f24('0x1c')],'include':_0x5f3c4a[_0x1f24('0x1e')]?_[_0x1f24('0x1f')](_0x5f3c4a[_0x1f24('0x1e')],function(_0x2d9919){return{'model':db[_0x2d9919[_0x1f24('0x20')]],'as':_0x2d9919['as'],'attributes':_0x2d9919[_0x1f24('0x1c')],'include':_0x2d9919['include']?_[_0x1f24('0x1f')](_0x2d9919[_0x1f24('0x1e')],function(_0x53ad54){return{'model':db[_0x53ad54[_0x1f24('0x20')]],'as':_0x53ad54['as'],'attributes':_0x53ad54[_0x1f24('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1f24('0xb')](function(_0x23377a){logger[_0x1f24('0x21')](_0x1f24('0x16'),_0x1dd04a);logger[_0x1f24('0xe')]('GetTrigger',_0x1dd04a,JSON[_0x1f24('0x10')](_0x23377a));_0x5b2c3b(_0x23377a);})[_0x1f24('0x15')](function(_0x548615){logger[_0x1f24('0x11')](_0x1f24('0x16'),_0x548615[_0x1f24('0x13')],_0x1dd04a);_0x473373(_0x2d4f80[_0x1f24('0x11')](0x1f4,_0x548615[_0x1f24('0x13')]));});});};exports[_0x1f24('0x22')]=function(_0x32effe){var _0x2f7497=this;return new Promise(function(_0x2c85f8,_0x2856d7){return db[_0x1f24('0x17')]['find']({'raw':_0x32effe[_0x1f24('0x19')]?_0x32effe[_0x1f24('0x19')][_0x1f24('0x1a')]===undefined?!![]:![]:!![],'where':_0x32effe[_0x1f24('0x19')]?_0x32effe[_0x1f24('0x19')][_0x1f24('0x1b')]||null:null,'attributes':_0x32effe[_0x1f24('0x19')]?_0x32effe[_0x1f24('0x19')][_0x1f24('0x1c')]||null:null,'include':_0x32effe[_0x1f24('0x19')]?_0x32effe[_0x1f24('0x19')]['include']?_[_0x1f24('0x1f')](_0x32effe[_0x1f24('0x19')]['include'],function(_0x5da868){return{'model':db[_0x5da868[_0x1f24('0x20')]],'as':_0x5da868['as'],'attributes':_0x5da868[_0x1f24('0x1c')],'include':_0x5da868[_0x1f24('0x1e')]?_[_0x1f24('0x1f')](_0x5da868['include'],function(_0x3ce4f5){return{'model':db[_0x3ce4f5['model']],'as':_0x3ce4f5['as'],'attributes':_0x3ce4f5[_0x1f24('0x1c')],'include':_0x3ce4f5[_0x1f24('0x1e')]?_[_0x1f24('0x1f')](_0x3ce4f5[_0x1f24('0x1e')],function(_0x18e9e0){return{'model':db[_0x18e9e0[_0x1f24('0x20')]],'as':_0x18e9e0['as'],'attributes':_0x18e9e0[_0x1f24('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1f24('0xb')](function(_0x3a5422){logger['info'](_0x1f24('0x22'),_0x32effe);logger['debug'](_0x1f24('0x22'),_0x32effe,JSON[_0x1f24('0x10')](_0x3a5422));_0x2c85f8(_0x3a5422);})[_0x1f24('0x15')](function(_0xd7423a){logger['error'](_0x1f24('0x22'),_0xd7423a['message'],_0x32effe);_0x2856d7(_0x2f7497[_0x1f24('0x11')](0x1f4,_0xd7423a[_0x1f24('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 2c596e8..57552bf 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 _0x0533=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','/:id/clone','clone','create','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x464aae,_0x3098d3){var _0x29fc2d=function(_0x1374d3){while(--_0x1374d3){_0x464aae['push'](_0x464aae['shift']());}};_0x29fc2d(++_0x3098d3);}(_0x0533,0xd0));var _0x3053=function(_0x6d0c32,_0x39a2e8){_0x6d0c32=_0x6d0c32-0x0;var _0x3f14d2=_0x0533[_0x6d0c32];return _0x3f14d2;};'use strict';var multer=require(_0x3053('0x0'));var util=require(_0x3053('0x1'));var path=require(_0x3053('0x2'));var timeout=require(_0x3053('0x3'));var express=require(_0x3053('0x4'));var router=express[_0x3053('0x5')]();var fs_extra=require(_0x3053('0x6'));var auth=require(_0x3053('0x7'));var interaction=require(_0x3053('0x8'));var config=require(_0x3053('0x9'));var controller=require(_0x3053('0xa'));router[_0x3053('0xb')]('/',auth[_0x3053('0xc')](),controller['index']);router['get']('/:id',auth[_0x3053('0xc')](),controller[_0x3053('0xd')]);router['post'](_0x3053('0xe'),auth['isAuthenticated'](),controller[_0x3053('0xf')]);router['post']('/',auth[_0x3053('0xc')](),controller[_0x3053('0x10')]);router['put'](_0x3053('0x11'),auth[_0x3053('0xc')](),controller['update']);router['delete']('/:id',auth[_0x3053('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4a31=['put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','/:id','isAuthenticated','show','post','clone','create'];(function(_0x4ed8bd,_0x53cc1f){var _0x40cb2b=function(_0x27c201){while(--_0x27c201){_0x4ed8bd['push'](_0x4ed8bd['shift']());}};_0x40cb2b(++_0x53cc1f);}(_0x4a31,0x87));var _0x14a3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a31[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x14a3('0x0'));var util=require(_0x14a3('0x1'));var path=require(_0x14a3('0x2'));var timeout=require(_0x14a3('0x3'));var express=require(_0x14a3('0x4'));var router=express[_0x14a3('0x5')]();var fs_extra=require(_0x14a3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x14a3('0x7'));var config=require(_0x14a3('0x8'));var controller=require(_0x14a3('0x9'));router[_0x14a3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14a3('0xa')](_0x14a3('0xb'),auth[_0x14a3('0xc')](),controller[_0x14a3('0xd')]);router[_0x14a3('0xe')]('/:id/clone',auth[_0x14a3('0xc')](),controller[_0x14a3('0xf')]);router[_0x14a3('0xe')]('/',auth['isAuthenticated'](),controller[_0x14a3('0x10')]);router[_0x14a3('0x11')](_0x14a3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x14a3('0x12')](_0x14a3('0xb'),auth[_0x14a3('0xc')](),controller['destroy']);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 d5668e7..c906caf 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 _0x1833=['from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','setDataValue','getDataValue','split','rfc2833','inband','auto','yes','nonat','update','outgoing','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','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','pai','certificate','passive','BOOLEAN','exports','STRING','ENUM','friend','peer'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1833,0x175));var _0x3183=function(_0x314ea9,_0x3c6626){_0x314ea9=_0x314ea9-0x0;var _0xa52b7b=_0x1833[_0x314ea9];return _0xa52b7b;};'use strict';var Sequelize=require('sequelize');module[_0x3183('0x0')]={'name':{'type':Sequelize[_0x3183('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x3'),'user',_0x3183('0x4')),'allowNull':![],'defaultValue':_0x3183('0x3')},'context':{'type':Sequelize[_0x3183('0x1')],'allowNull':![],'defaultValue':_0x3183('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x3183('0x6'),_0x3183('0x7'),_0x3183('0x8'),_0x3183('0x9'),_0x3183('0xa'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x3183('0xb'))},'deny':{'type':Sequelize[_0x3183('0x1')]},'permit':{'type':Sequelize[_0x3183('0x1')]},'secret':{'type':Sequelize[_0x3183('0x1')]},'md5secret':{'type':Sequelize[_0x3183('0x1')]},'remotesecret':{'type':Sequelize[_0x3183('0x1')]},'transport':{'type':Sequelize[_0x3183('0x1')],'defaultValue':_0x3183('0xc'),'set':function(_0xb680c9){this[_0x3183('0xd')]('transport',_0xb680c9?_0xb680c9['join'](','):null);},'get':function(){return this[_0x3183('0xe')]('transport')?this['getDataValue']('transport')[_0x3183('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x10'),'info','shortinfo',_0x3183('0x11'),_0x3183('0x12')),'defaultValue':_0x3183('0x10')},'directmedia':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no',_0x3183('0x14'),_0x3183('0x15'),_0x3183('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3183('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3183('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x120b25){this[_0x3183('0xd')]('nat',_0x120b25?_0x120b25['join'](','):null);},'get':function(){return this[_0x3183('0xe')]('nat')?this[_0x3183('0xe')](_0x3183('0x17'))[_0x3183('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3183('0x1')]},'namedcallgroup':{'type':Sequelize[_0x3183('0x1')]},'pickupgroup':{'type':Sequelize[_0x3183('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x3183('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3183('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3183('0x1')],'defaultValue':_0x3183('0x18')},'allow':{'type':Sequelize[_0x3183('0x1')],'allowNull':![],'defaultValue':_0x3183('0x19'),'set':function(_0x42c7b9){this[_0x3183('0xd')](_0x3183('0x1a'),_0x42c7b9?_0x42c7b9['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x3183('0x1a'))?this[_0x3183('0xe')](_0x3183('0x1a'))[_0x3183('0xf')](';'):null;},'comment':_0x3183('0x1b')},'autoframing':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'insecure':{'type':Sequelize[_0x3183('0x1')],'defaultValue':_0x3183('0x1c'),'set':function(_0xd4f540){this[_0x3183('0xd')](_0x3183('0x1d'),_0xd4f540?_0xd4f540['join'](','):null);},'get':function(){return this[_0x3183('0xe')](_0x3183('0x1d'))?this[_0x3183('0xe')](_0x3183('0x1d'))[_0x3183('0xf')](','):null;},'comment':_0x3183('0x1e')},'trustrpid':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3183('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3183('0x2')]('yes','no',_0x3183('0x1f'))},'promiscredir':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x3183('0x20')](0xb)},'setvar':{'type':Sequelize[_0x3183('0x1')]},'callerid':{'type':Sequelize[_0x3183('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x3183('0x1')]},'callcounter':{'type':Sequelize[_0x3183('0x2')]('yes','no'),'defaultValue':_0x3183('0x13')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x3183('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3183('0x2')]('yes','no',_0x3183('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'mailbox':{'type':Sequelize[_0x3183('0x1')]},'session_timers':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x22'),_0x3183('0x23'),_0x3183('0x24'))},'session_expires':{'type':Sequelize[_0x3183('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x3183('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x25'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3183('0x1')]},'regexten':{'type':Sequelize[_0x3183('0x1')]},'fromdomain':{'type':Sequelize[_0x3183('0x1')]},'fromuser':{'type':Sequelize[_0x3183('0x1')]},'port':{'type':Sequelize[_0x3183('0x20')](0x5)},'qualify':{'type':Sequelize[_0x3183('0x2')]('yes','no'),'defaultValue':_0x3183('0x13')},'keepalive':{'type':Sequelize[_0x3183('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x3183('0x1')]},'defaultuser':{'type':Sequelize[_0x3183('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3183('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x3183('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x3183('0x1')]},'timert1':{'type':Sequelize[_0x3183('0x20')](0xb)},'timerb':{'type':Sequelize[_0x3183('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3183('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0x3183('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x3183('0x1')]},'use_q850_reason':{'type':Sequelize[_0x3183('0x1')]},'maxforwards':{'type':Sequelize[_0x3183('0x20')](0xb)},'encryption':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'icesupport':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no','fingerprint',_0x3183('0x27'))},'dtlsrekey':{'type':Sequelize[_0x3183('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3183('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x3183('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x3183('0x1')]},'dtlscapath':{'type':Sequelize[_0x3183('0x1')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x3183('0x28'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3183('0x1')]},'usereqphone':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3183('0x1')]},'recordofffeature':{'type':Sequelize[_0x3183('0x1')]},'call_limit':{'type':Sequelize[_0x3183('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'subscribemwi':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'vmexten':{'type':Sequelize[_0x3183('0x1')]},'mohinterpret':{'type':Sequelize[_0x3183('0x1')]},'mohsuggest':{'type':Sequelize[_0x3183('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3183('0x1')]},'host':{'type':Sequelize[_0x3183('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no',_0x3183('0x14'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x3183('0x1')]},'active':{'type':Sequelize[_0x3183('0x29')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3183('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc81b=['yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','INTEGER','refuse','originate','pai','fingerprint','active','passive','dynamic','update,nonat','sequelize','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto'];(function(_0xf98337,_0x4c063d){var _0x8e539d=function(_0x49d319){while(--_0x49d319){_0xf98337['push'](_0xf98337['shift']());}};_0x8e539d(++_0x4c063d);}(_0xc81b,0x1cc));var _0xbc81=function(_0x192b5b,_0x30de0e){_0x192b5b=_0x192b5b-0x0;var _0x10ee46=_0xc81b[_0x192b5b];return _0x10ee46;};'use strict';var Sequelize=require(_0xbc81('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc81('0x1')],'allowNull':![],'unique':_0xbc81('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xbc81('0x3'),_0xbc81('0x4'),_0xbc81('0x5')),'allowNull':![],'defaultValue':_0xbc81('0x3')},'context':{'type':Sequelize[_0xbc81('0x1')],'allowNull':![],'defaultValue':_0xbc81('0x6')},'callingpres':{'type':Sequelize[_0xbc81('0x7')]('ALLOWED_NOT_SCREENED',_0xbc81('0x8'),_0xbc81('0x9'),_0xbc81('0xa'),_0xbc81('0xb'),'PROHIB_PASSED_SCREEN',_0xbc81('0xc'),_0xbc81('0xd'))},'deny':{'type':Sequelize[_0xbc81('0x1')]},'permit':{'type':Sequelize[_0xbc81('0x1')]},'secret':{'type':Sequelize[_0xbc81('0x1')]},'md5secret':{'type':Sequelize[_0xbc81('0x1')]},'remotesecret':{'type':Sequelize[_0xbc81('0x1')]},'transport':{'type':Sequelize[_0xbc81('0x1')],'defaultValue':_0xbc81('0xe'),'set':function(_0x4a6cfa){this['setDataValue'](_0xbc81('0xf'),_0x4a6cfa?_0x4a6cfa[_0xbc81('0x10')](','):null);},'get':function(){return this[_0xbc81('0x11')]('transport')?this['getDataValue'](_0xbc81('0xf'))[_0xbc81('0x12')](','):null;},'comment':_0xbc81('0x13')},'dtmfmode':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x14'),'info',_0xbc81('0x15'),_0xbc81('0x16'),_0xbc81('0x17')),'defaultValue':_0xbc81('0x14')},'directmedia':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no',_0xbc81('0x19'),_0xbc81('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xbc81('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xbc81('0x1b'),'set':function(_0x5610f2){this['setDataValue'](_0xbc81('0x1c'),_0x5610f2?_0x5610f2[_0xbc81('0x10')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xbc81('0x11')](_0xbc81('0x1c'))[_0xbc81('0x12')](','):null;},'comment':_0xbc81('0x1d')},'callgroup':{'type':Sequelize[_0xbc81('0x1')]},'namedcallgroup':{'type':Sequelize[_0xbc81('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xbc81('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbc81('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbc81('0x1')],'defaultValue':_0xbc81('0x1e')},'allow':{'type':Sequelize[_0xbc81('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x241d5c){this[_0xbc81('0x1f')]('allow',_0x241d5c?_0x241d5c[_0xbc81('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xbc81('0x11')](_0xbc81('0x20'))?this['getDataValue'](_0xbc81('0x20'))[_0xbc81('0x12')](';'):null;},'comment':_0xbc81('0x21')},'autoframing':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no')},'insecure':{'type':Sequelize[_0xbc81('0x1')],'defaultValue':'port,invite','set':function(_0x1d80ab){this[_0xbc81('0x1f')](_0xbc81('0x22'),_0x1d80ab?_0x1d80ab[_0xbc81('0x10')](','):null);},'get':function(){return this[_0xbc81('0x11')](_0xbc81('0x22'))?this[_0xbc81('0x11')](_0xbc81('0x22'))[_0xbc81('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no')},'accountcode':{'type':Sequelize[_0xbc81('0x23')](0xb)},'setvar':{'type':Sequelize[_0xbc81('0x1')]},'callerid':{'type':Sequelize[_0xbc81('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no'),'defaultValue':_0xbc81('0x18')},'busylevel':{'type':Sequelize[_0xbc81('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xbc81('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xbc81('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xbc81('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xbc81('0x1')]},'template':{'type':Sequelize[_0xbc81('0x1')]},'videosupport':{'type':Sequelize[_0xbc81('0x7')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xbc81('0x18'),'no')},'mailbox':{'type':Sequelize[_0xbc81('0x1')]},'session_timers':{'type':Sequelize[_0xbc81('0x7')]('accept',_0xbc81('0x24'),_0xbc81('0x25'))},'session_expires':{'type':Sequelize[_0xbc81('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xbc81('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xbc81('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbc81('0x23')](0x5)},'qualify':{'type':Sequelize[_0xbc81('0x7')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xbc81('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbc81('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xbc81('0x18'),'no',_0xbc81('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbc81('0x1')]},'callbackextension':{'type':Sequelize[_0xbc81('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xbc81('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xbc81('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xbc81('0x1')]},'contactacl':{'type':Sequelize[_0xbc81('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xbc81('0x1')]},'use_q850_reason':{'type':Sequelize[_0xbc81('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xbc81('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbc81('0x7')]('yes','no')},'force_avp':{'type':Sequelize[_0xbc81('0x7')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xbc81('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xbc81('0x18'),'no',_0xbc81('0x27'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xbc81('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbc81('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xbc81('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xbc81('0x1')]},'dtlscapath':{'type':Sequelize[_0xbc81('0x1')]},'dtlssetup':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x28'),_0xbc81('0x29'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbc81('0x1')]},'usereqphone':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xbc81('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xbc81('0x7')](_0xbc81('0x18'),'no')},'vmexten':{'type':Sequelize[_0xbc81('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xbc81('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbc81('0x1')]},'host':{'type':Sequelize[_0xbc81('0x1')],'defaultValue':_0xbc81('0x2a')},'canreinvite':{'type':Sequelize['ENUM'](_0xbc81('0x18'),'no',_0xbc81('0x19'),_0xbc81('0x1a'),_0xbc81('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xbc81('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbc81('0x1')],'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 6f4b958..d071762 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 _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(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x81bd,0x7c));var _0xd81b=function(_0x5ba35a,_0x5e5113){_0x5ba35a=_0x5ba35a-0x0;var _0x5900dc=_0x81bd[_0x5ba35a];return _0x5900dc;};'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 +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x2816aa,_0x46d3be){var _0x181335=function(_0x5db92a){while(--_0x5db92a){_0x2816aa['push'](_0x2816aa['shift']());}};_0x181335(++_0x46d3be);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x00bb[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index f66b59c..a2fc6b9 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 _0xdbb8=['Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0xdbb8,0x1e2));var _0x8dbb=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xdbb8[_0x18aaaf];return _0x52d892;};'use strict';var _=require(_0x8dbb('0x0'));var util=require(_0x8dbb('0x1'));var logger=require(_0x8dbb('0x2'))(_0x8dbb('0x3'));var moment=require(_0x8dbb('0x4'));var BPromise=require(_0x8dbb('0x5'));var rp=require(_0x8dbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8dbb('0x7'));var config=require(_0x8dbb('0x8'));var attributes=require(_0x8dbb('0x9'));module[_0x8dbb('0xa')]=function(_0x510d31,_0x29ea12){return _0x510d31[_0x8dbb('0xb')](_0x8dbb('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x467c=['bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','api','moment'];(function(_0x4c67b9,_0x3ef0a7){var _0x4817cf=function(_0x29fa3f){while(--_0x29fa3f){_0x4c67b9['push'](_0x4c67b9['shift']());}};_0x4817cf(++_0x3ef0a7);}(_0x467c,0x1ea));var _0xc467=function(_0x3657de,_0x45442b){_0x3657de=_0x3657de-0x0;var _0x48d96a=_0x467c[_0x3657de];return _0x48d96a;};'use strict';var _=require(_0xc467('0x0'));var util=require(_0xc467('0x1'));var logger=require('../../config/logger')(_0xc467('0x2'));var moment=require(_0xc467('0x3'));var BPromise=require(_0xc467('0x4'));var rp=require(_0xc467('0x5'));var fs=require('fs');var path=require(_0xc467('0x6'));var rimraf=require(_0xc467('0x7'));var config=require(_0xc467('0x8'));var attributes=require(_0xc467('0x9'));module['exports']=function(_0x3aef2f,_0x3ea5af){return _0x3aef2f[_0xc467('0xa')](_0xc467('0xb'),attributes,{'tableName':_0xc467('0xc'),'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 aa0565b..b91eb5d 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 _0xc7ea=['GetTrunk','find','ShowTrunk','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trunk','findAll','options','where','attributes','limit','include','map','model'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0xc7ea,0xe3));var _0xac7e=function(_0x353d70,_0x139687){_0x353d70=_0x353d70-0x0;var _0x3ac2cd=_0xc7ea[_0x353d70];return _0x3ac2cd;};'use strict';var _=require(_0xac7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xac7e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac7e('0x2'));var db=require(_0xac7e('0x3'))['db'];var utils=require(_0xac7e('0x4'));var logger=require('../../config/logger')(_0xac7e('0x5'));var config=require(_0xac7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x923382,_0x24381e,_0x3ebb4e){return new BPromise(function(_0x4fe793,_0x5d8e4c){return client[_0xac7e('0x7')](_0x923382,_0x3ebb4e)[_0xac7e('0x8')](function(_0x4bd801){logger[_0xac7e('0x9')](_0xac7e('0xa'),_0x24381e,_0xac7e('0xb'));logger[_0xac7e('0xc')](_0xac7e('0xd'),_0x24381e,_0xac7e('0xb'),JSON[_0xac7e('0xe')](_0x4bd801));if(_0x4bd801[_0xac7e('0xf')]){if(_0x4bd801[_0xac7e('0xf')][_0xac7e('0x10')]===0x1f4){logger['error'](_0xac7e('0xa'),_0x24381e,_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);return _0x5d8e4c(_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);}logger[_0xac7e('0xf')](_0xac7e('0xa'),_0x24381e,_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);return _0x4fe793(_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);}else{logger[_0xac7e('0x9')](_0xac7e('0xa'),_0x24381e,_0xac7e('0xb'));_0x4fe793(_0x4bd801[_0xac7e('0x12')]['message']);}})[_0xac7e('0x13')](function(_0x32a3b5){logger['error']('Trunk,\x20%s,\x20%s',_0x24381e,_0x32a3b5);_0x5d8e4c(_0x32a3b5);});});}exports['GetTrunk']=function(_0x316429){var _0x599a89=this;return new Promise(function(_0x3add80,_0x2552de){return db[_0xac7e('0x14')][_0xac7e('0x15')]({'raw':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x17')]||null:null,'attributes':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x18')]||null:null,'limit':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x19')]||null:null,'include':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x316429[_0xac7e('0x16')][_0xac7e('0x1a')],function(_0x41390c){return{'model':db[_0x41390c['model']],'as':_0x41390c['as'],'attributes':_0x41390c[_0xac7e('0x18')],'include':_0x41390c[_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x41390c[_0xac7e('0x1a')],function(_0x367d7b){return{'model':db[_0x367d7b[_0xac7e('0x1c')]],'as':_0x367d7b['as'],'attributes':_0x367d7b['attributes'],'include':_0x367d7b[_0xac7e('0x1a')]?_['map'](_0x367d7b['include'],function(_0x497458){return{'model':db[_0x497458[_0xac7e('0x1c')]],'as':_0x497458['as'],'attributes':_0x497458[_0xac7e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x489bc3){logger[_0xac7e('0x9')](_0xac7e('0x1d'),_0x316429);logger['debug'](_0xac7e('0x1d'),_0x316429,JSON['stringify'](_0x489bc3));_0x3add80(_0x489bc3);})[_0xac7e('0x13')](function(_0x3383eb){logger['error'](_0xac7e('0x1d'),_0x3383eb[_0xac7e('0x11')],_0x316429);_0x2552de(_0x599a89[_0xac7e('0xf')](0x1f4,_0x3383eb[_0xac7e('0x11')]));});});};exports['ShowTrunk']=function(_0x5a145f){var _0x3bd547=this;return new Promise(function(_0x382b53,_0x3e0e84){return db[_0xac7e('0x14')][_0xac7e('0x1e')]({'raw':_0x5a145f[_0xac7e('0x16')]?_0x5a145f[_0xac7e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5a145f[_0xac7e('0x16')]?_0x5a145f[_0xac7e('0x16')][_0xac7e('0x17')]||null:null,'attributes':_0x5a145f['options']?_0x5a145f['options']['attributes']||null:null,'include':_0x5a145f[_0xac7e('0x16')]?_0x5a145f['options'][_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x5a145f['options'][_0xac7e('0x1a')],function(_0x5ca20d){return{'model':db[_0x5ca20d[_0xac7e('0x1c')]],'as':_0x5ca20d['as'],'attributes':_0x5ca20d['attributes'],'include':_0x5ca20d['include']?_[_0xac7e('0x1b')](_0x5ca20d[_0xac7e('0x1a')],function(_0x364823){return{'model':db[_0x364823[_0xac7e('0x1c')]],'as':_0x364823['as'],'attributes':_0x364823[_0xac7e('0x18')],'include':_0x364823[_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x364823[_0xac7e('0x1a')],function(_0x158488){return{'model':db[_0x158488['model']],'as':_0x158488['as'],'attributes':_0x158488[_0xac7e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xac7e('0x8')](function(_0x3a6339){logger[_0xac7e('0x9')](_0xac7e('0x1f'),_0x5a145f);logger[_0xac7e('0xc')](_0xac7e('0x1f'),_0x5a145f,JSON[_0xac7e('0xe')](_0x3a6339));_0x382b53(_0x3a6339);})[_0xac7e('0x13')](function(_0x1823e1){logger[_0xac7e('0xf')](_0xac7e('0x1f'),_0x1823e1[_0xac7e('0x11')],_0x5a145f);_0x3e0e84(_0x3bd547[_0xac7e('0xf')](0x1f4,_0x1823e1[_0xac7e('0x11')]));});});}; \ No newline at end of file +var _0xa9b3=['then','info','Trunk,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','map','include','model','debug','stringify','ShowTrunk','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4320d5,_0x282f00){var _0x59cf06=function(_0x9c45c4){while(--_0x9c45c4){_0x4320d5['push'](_0x4320d5['shift']());}};_0x59cf06(++_0x282f00);}(_0xa9b3,0xcb));var _0x3a9b=function(_0x101d5b,_0x40cfd){_0x101d5b=_0x101d5b-0x0;var _0x382a50=_0xa9b3[_0x101d5b];return _0x382a50;};'use strict';var _=require(_0x3a9b('0x0'));var util=require(_0x3a9b('0x1'));var moment=require(_0x3a9b('0x2'));var BPromise=require(_0x3a9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a9b('0x4'));var db=require(_0x3a9b('0x5'))['db'];var utils=require(_0x3a9b('0x6'));var logger=require(_0x3a9b('0x7'))(_0x3a9b('0x8'));var config=require(_0x3a9b('0x9'));var jayson=require(_0x3a9b('0xa'));var client=jayson[_0x3a9b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c8b2d,_0x102485,_0x521795){return new BPromise(function(_0x2aafbe,_0x5c574e){return client[_0x3a9b('0xc')](_0x6c8b2d,_0x521795)[_0x3a9b('0xd')](function(_0x4d9e40){logger[_0x3a9b('0xe')](_0x3a9b('0xf'),_0x102485,_0x3a9b('0x10'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x102485,_0x3a9b('0x10'),JSON['stringify'](_0x4d9e40));if(_0x4d9e40[_0x3a9b('0x11')]){if(_0x4d9e40['error'][_0x3a9b('0x12')]===0x1f4){logger[_0x3a9b('0x11')](_0x3a9b('0xf'),_0x102485,_0x4d9e40['error'][_0x3a9b('0x13')]);return _0x5c574e(_0x4d9e40['error']['message']);}logger['error'](_0x3a9b('0xf'),_0x102485,_0x4d9e40[_0x3a9b('0x11')][_0x3a9b('0x13')]);return _0x2aafbe(_0x4d9e40[_0x3a9b('0x11')]['message']);}else{logger[_0x3a9b('0xe')]('Trunk,\x20%s,\x20%s',_0x102485,'request\x20sent');_0x2aafbe(_0x4d9e40['result'][_0x3a9b('0x13')]);}})[_0x3a9b('0x14')](function(_0x20b273){logger['error']('Trunk,\x20%s,\x20%s',_0x102485,_0x20b273);_0x5c574e(_0x20b273);});});}exports[_0x3a9b('0x15')]=function(_0xbdcbff){var _0x430d9d=this;return new Promise(function(_0xa864ad,_0x186d91){return db[_0x3a9b('0x16')][_0x3a9b('0x17')]({'raw':_0xbdcbff['options']?_0xbdcbff['options']['raw']===undefined?!![]:![]:!![],'where':_0xbdcbff[_0x3a9b('0x18')]?_0xbdcbff[_0x3a9b('0x18')][_0x3a9b('0x19')]||null:null,'attributes':_0xbdcbff[_0x3a9b('0x18')]?_0xbdcbff[_0x3a9b('0x18')][_0x3a9b('0x1a')]||null:null,'limit':_0xbdcbff[_0x3a9b('0x18')]?_0xbdcbff[_0x3a9b('0x18')][_0x3a9b('0x1b')]||null:null,'include':_0xbdcbff[_0x3a9b('0x18')]?_0xbdcbff[_0x3a9b('0x18')]['include']?_[_0x3a9b('0x1c')](_0xbdcbff[_0x3a9b('0x18')][_0x3a9b('0x1d')],function(_0x2b62ad){return{'model':db[_0x2b62ad['model']],'as':_0x2b62ad['as'],'attributes':_0x2b62ad['attributes'],'include':_0x2b62ad[_0x3a9b('0x1d')]?_[_0x3a9b('0x1c')](_0x2b62ad['include'],function(_0x28bd4f){return{'model':db[_0x28bd4f[_0x3a9b('0x1e')]],'as':_0x28bd4f['as'],'attributes':_0x28bd4f[_0x3a9b('0x1a')],'include':_0x28bd4f[_0x3a9b('0x1d')]?_[_0x3a9b('0x1c')](_0x28bd4f['include'],function(_0x1e0826){return{'model':db[_0x1e0826[_0x3a9b('0x1e')]],'as':_0x1e0826['as'],'attributes':_0x1e0826[_0x3a9b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dda46){logger[_0x3a9b('0xe')](_0x3a9b('0x15'),_0xbdcbff);logger[_0x3a9b('0x1f')](_0x3a9b('0x15'),_0xbdcbff,JSON[_0x3a9b('0x20')](_0x2dda46));_0xa864ad(_0x2dda46);})['catch'](function(_0xf17e3c){logger['error'](_0x3a9b('0x15'),_0xf17e3c['message'],_0xbdcbff);_0x186d91(_0x430d9d[_0x3a9b('0x11')](0x1f4,_0xf17e3c['message']));});});};exports[_0x3a9b('0x21')]=function(_0x14eddb){var _0x22c1b8=this;return new Promise(function(_0x31be96,_0x11ba5b){return db['Trunk'][_0x3a9b('0x22')]({'raw':_0x14eddb[_0x3a9b('0x18')]?_0x14eddb['options'][_0x3a9b('0x23')]===undefined?!![]:![]:!![],'where':_0x14eddb[_0x3a9b('0x18')]?_0x14eddb[_0x3a9b('0x18')][_0x3a9b('0x19')]||null:null,'attributes':_0x14eddb[_0x3a9b('0x18')]?_0x14eddb[_0x3a9b('0x18')][_0x3a9b('0x1a')]||null:null,'include':_0x14eddb[_0x3a9b('0x18')]?_0x14eddb['options'][_0x3a9b('0x1d')]?_[_0x3a9b('0x1c')](_0x14eddb['options']['include'],function(_0x3b6e57){return{'model':db[_0x3b6e57['model']],'as':_0x3b6e57['as'],'attributes':_0x3b6e57['attributes'],'include':_0x3b6e57[_0x3a9b('0x1d')]?_[_0x3a9b('0x1c')](_0x3b6e57['include'],function(_0x23ff2e){return{'model':db[_0x23ff2e[_0x3a9b('0x1e')]],'as':_0x23ff2e['as'],'attributes':_0x23ff2e['attributes'],'include':_0x23ff2e[_0x3a9b('0x1d')]?_[_0x3a9b('0x1c')](_0x23ff2e[_0x3a9b('0x1d')],function(_0x5c76e7){return{'model':db[_0x5c76e7['model']],'as':_0x5c76e7['as'],'attributes':_0x5c76e7[_0x3a9b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4584a7){logger[_0x3a9b('0xe')]('ShowTrunk',_0x14eddb);logger[_0x3a9b('0x1f')]('ShowTrunk',_0x14eddb,JSON[_0x3a9b('0x20')](_0x4584a7));_0x31be96(_0x4584a7);})[_0x3a9b('0x14')](function(_0x9130bf){logger[_0x3a9b('0x11')]('ShowTrunk',_0x9130bf[_0x3a9b('0x13')],_0x14eddb);_0x11ba5b(_0x22c1b8[_0x3a9b('0x11')](0x1f4,_0x9130bf[_0x3a9b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b6377e6..2ed0fc9 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 _0x6efc=['isAuthenticated','exports','Router','../../components/auth/service','/:id'];(function(_0x3d064a,_0x12cf18){var _0x5b2a83=function(_0x241866){while(--_0x241866){_0x3d064a['push'](_0x3d064a['shift']());}};_0x5b2a83(++_0x12cf18);}(_0x6efc,0x124));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var express=require('express');var router=express[_0xc6ef('0x0')]();var auth=require(_0xc6ef('0x1'));var controller=require('./user-setting.controller');router['put'](_0xc6ef('0x2'),auth[_0xc6ef('0x3')](),controller['update']);module[_0xc6ef('0x4')]=router; \ No newline at end of file +var _0x11ae=['update','exports','Router','./user-setting.controller','/:id','isAuthenticated'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x11ae,0x158));var _0xe11a=function(_0x46e995,_0x60b36e){_0x46e995=_0x46e995-0x0;var _0x17384b=_0x11ae[_0x46e995];return _0x17384b;};'use strict';var express=require('express');var router=express[_0xe11a('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe11a('0x1'));router['put'](_0xe11a('0x2'),auth[_0xe11a('0x3')](),controller[_0xe11a('0x4')]);module[_0xe11a('0x5')]=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 3871acd..e45cc43 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 _0xb6a2=['TEXT','INTEGER','sequelize','warning','debug','exports','ENUM','BOOLEAN'];(function(_0x17c405,_0x419688){var _0x58bd24=function(_0x569ba0){while(--_0x569ba0){_0x17c405['push'](_0x17c405['shift']());}};_0x58bd24(++_0x419688);}(_0xb6a2,0x12a));var _0x2b6a=function(_0x4a7a7d,_0x197435){_0x4a7a7d=_0x4a7a7d-0x0;var _0x17cc37=_0xb6a2[_0x4a7a7d];return _0x17cc37;};'use strict';var Sequelize=require(_0x2b6a('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x2b6a('0x1'),'info',_0x2b6a('0x2')];module[_0x2b6a('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2b6a('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2b6a('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2b6a('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2b6a('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0x079d=['ENUM','error','TEXT','DATE','INTEGER','UserId','sequelize','warning','info','debug','exports'];(function(_0x443253,_0x3a29bc){var _0x154191=function(_0x446d20){while(--_0x446d20){_0x443253['push'](_0x443253['shift']());}};_0x154191(++_0x3a29bc);}(_0x079d,0x1df));var _0xd079=function(_0x122cc0,_0x3db5f6){_0x122cc0=_0x122cc0-0x0;var _0x4657e2=_0x079d[_0x122cc0];return _0x4657e2;};'use strict';var Sequelize=require(_0xd079('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xd079('0x1'),_0xd079('0x2'),_0xd079('0x3')];module[_0xd079('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xd079('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd079('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd079('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd079('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd079('0x9')],'unique':_0xd079('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 2ca59b2..b40d88c 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 _0x5127=['status','send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','body','catch','lodash','ioredis','../../config/logger','api','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','json','update','then','sendStatus','error','stack','name'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x5127,0x18f));var _0x7512=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x5127[_0x1e7701];return _0x3ab707;};'use strict';var _=require(_0x7512('0x0'));var Redis=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x7512('0x4'))(new Redis(config['redis']));require(_0x7512('0x5'))[_0x7512('0x6')](socket);config[_0x7512('0x7')]=_[_0x7512('0x8')](config[_0x7512('0x7')],{'host':_0x7512('0x9'),'port':0x18eb});function respondWithResult(_0x4e6779,_0x4d0765){_0x4d0765=_0x4d0765||0xc8;return function(_0x2d2e88){if(_0x2d2e88){return _0x4e6779['status'](_0x4d0765)[_0x7512('0xa')](_0x2d2e88);}};}function saveUpdates(_0x49b608){return function(_0x7328d7){if(_0x7328d7){return _0x7328d7[_0x7512('0xb')](_0x49b608)[_0x7512('0xc')](function(_0x3db733){return _0x3db733;});}return null;};}function handleEntityNotFound(_0x255ab9){return function(_0x7c0280){if(!_0x7c0280){_0x255ab9[_0x7512('0xd')](0x194);}return _0x7c0280;};}function handleError(_0x3c3efc,_0x202032){_0x202032=_0x202032||0x1f4;return function(_0x885024){logger[_0x7512('0xe')](_0x885024[_0x7512('0xf')]);if(_0x885024[_0x7512('0x10')]){delete _0x885024[_0x7512('0x10')];}_0x3c3efc[_0x7512('0x11')](_0x202032)[_0x7512('0x12')](_0x885024);};}exports[_0x7512('0xb')]=function(_0x527d96,_0x463c6){if(_0x527d96['user'][_0x7512('0x13')]!==_0x7512('0x14'))throw new Error(_0x7512('0x15'));if(isNaN(Number(_0x527d96[_0x7512('0x16')]['id'])))throw new Error(_0x7512('0x17'));return db['UserSetting']['find']({'where':{'id':_0x527d96[_0x7512('0x16')]['id']}})[_0x7512('0xc')](handleEntityNotFound(_0x463c6,null))[_0x7512('0xc')](saveUpdates(_0x527d96[_0x7512('0x18')],null))['then'](respondWithResult(_0x463c6,null))[_0x7512('0x19')](handleError(_0x463c6,null));}; \ No newline at end of file +var _0x919e=['sendStatus','name','status','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','../../config/environment','redis','./user-setting.socket','register','defaults','localhost','json','update','then'];(function(_0x53b9d9,_0x42273b){var _0xbf16f0=function(_0x486131){while(--_0x486131){_0x53b9d9['push'](_0x53b9d9['shift']());}};_0xbf16f0(++_0x42273b);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var Redis=require(_0xe919('0x1'));var logger=require(_0xe919('0x2'))('api');var config=require(_0xe919('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xe919('0x4')]));require(_0xe919('0x5'))[_0xe919('0x6')](socket);config[_0xe919('0x4')]=_[_0xe919('0x7')](config[_0xe919('0x4')],{'host':_0xe919('0x8'),'port':0x18eb});function respondWithResult(_0x493b47,_0x7c1fa4){_0x7c1fa4=_0x7c1fa4||0xc8;return function(_0x2ceb41){if(_0x2ceb41){return _0x493b47['status'](_0x7c1fa4)[_0xe919('0x9')](_0x2ceb41);}};}function saveUpdates(_0x5c4129){return function(_0x1715db){if(_0x1715db){return _0x1715db[_0xe919('0xa')](_0x5c4129)[_0xe919('0xb')](function(_0x58a7a7){return _0x58a7a7;});}return null;};}function handleEntityNotFound(_0x83759d){return function(_0x34e59e){if(!_0x34e59e){_0x83759d[_0xe919('0xc')](0x194);}return _0x34e59e;};}function handleError(_0x53ab97,_0x12098d){_0x12098d=_0x12098d||0x1f4;return function(_0x50c6ff){logger['error'](_0x50c6ff['stack']);if(_0x50c6ff[_0xe919('0xd')]){delete _0x50c6ff[_0xe919('0xd')];}_0x53ab97[_0xe919('0xe')](_0x12098d)['send'](_0x50c6ff);};}exports['update']=function(_0x203b79,_0x26fc06){if(_0x203b79['user'][_0xe919('0xf')]!==_0xe919('0x10'))throw new Error(_0xe919('0x11'));if(isNaN(Number(_0x203b79[_0xe919('0x12')]['id'])))throw new Error(_0xe919('0x13'));return db[_0xe919('0x14')][_0xe919('0x15')]({'where':{'id':_0x203b79['params']['id']}})[_0xe919('0xb')](handleEntityNotFound(_0x26fc06,null))['then'](saveUpdates(_0x203b79['body'],null))[_0xe919('0xb')](respondWithResult(_0x26fc06,null))[_0xe919('0x16')](handleError(_0x26fc06,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 8f3c147..06e74fe 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 _0x7086=['hasOwnProperty','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','remove','emit'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x7086,0x17c));var _0x6708=function(_0x37edc4,_0x15ade8){_0x37edc4=_0x37edc4-0x0;var _0x376467=_0x7086[_0x37edc4];return _0x376467;};'use strict';var EventEmitter=require(_0x6708('0x0'));var UserSetting=require(_0x6708('0x1'))['db'][_0x6708('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6708('0x3')](0x0);var events={'afterCreate':_0x6708('0x4'),'afterUpdate':'update','afterDestroy':_0x6708('0x5')};function emitEvent(_0x2b5f13){return function(_0x1e265e,_0x136bd0,_0x2a1c98){UserSettingEvents[_0x6708('0x6')](_0x2b5f13+':'+_0x1e265e['id'],_0x1e265e);UserSettingEvents[_0x6708('0x6')](_0x2b5f13,_0x1e265e);_0x2a1c98(null);};}for(var e in events){if(events[_0x6708('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x6708('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xbeda=['exports','events','../../mysqldb','UserSetting','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x5b813e,_0x45afd7){var _0x60a05b=function(_0x3496c5){while(--_0x3496c5){_0x5b813e['push'](_0x5b813e['shift']());}};_0x60a05b(++_0x45afd7);}(_0xbeda,0x109));var _0xabed=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xbeda[_0x292f93];return _0x5a94b1;};'use strict';var EventEmitter=require(_0xabed('0x0'));var UserSetting=require(_0xabed('0x1'))['db'][_0xabed('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xabed('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xabed('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2505f3){return function(_0x4f69e3,_0x435289,_0x465651){UserSettingEvents[_0xabed('0x5')](_0x2505f3+':'+_0x4f69e3['id'],_0x4f69e3);UserSettingEvents[_0xabed('0x5')](_0x2505f3,_0x4f69e3);_0x465651(null);};}for(var e in events){if(events[_0xabed('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xabed('0x7')]=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 bf79c5d..aed0662 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 _0x235a=['./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x183fc5,_0x41bd77){var _0x9322fd=function(_0x5706a9){while(--_0x5706a9){_0x183fc5['push'](_0x183fc5['shift']());}};_0x9322fd(++_0x41bd77);}(_0x235a,0x1ef));var _0xa235=function(_0x56fb9b,_0x1209e9){_0x56fb9b=_0x56fb9b-0x0;var _0xcccee0=_0x235a[_0x56fb9b];return _0xcccee0;};'use strict';var attributes=require(_0xa235('0x0'));module[_0xa235('0x1')]=function(_0x95e7f5){return _0x95e7f5['define'](_0xa235('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ae786){if(!_0x3ae786[_0xa235('0x3')])_0x3ae786[_0xa235('0x4')]=null;else if(_0x3ae786[_0xa235('0x4')]===null)_0x3ae786[_0xa235('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xcecc=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','user_settings'];(function(_0x392cd1,_0x2d4c3c){var _0x22da51=function(_0x9b1353){while(--_0x9b1353){_0x392cd1['push'](_0x392cd1['shift']());}};_0x22da51(++_0x2d4c3c);}(_0xcecc,0x186));var _0xccec=function(_0x52a17f,_0x59b7b1){_0x52a17f=_0x52a17f-0x0;var _0x1a7e5e=_0xcecc[_0x52a17f];return _0x1a7e5e;};'use strict';var attributes=require(_0xccec('0x0'));module['exports']=function(_0x2463b6){return _0x2463b6['define']('UserSetting',attributes,{'tableName':_0xccec('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38cf71){if(!_0x38cf71[_0xccec('0x2')])_0x38cf71[_0xccec('0x3')]=null;else if(_0x38cf71['clientSideLoggingEnabledSince']===null)_0x38cf71['clientSideLoggingEnabledSince']=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 47a8b5d..1b938bd 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 _0xfbd2=['save','remove','emit','UserId','register','length','./user-setting.events'];(function(_0x2a00c9,_0x361b7b){var _0x4276c1=function(_0xe21e7a){while(--_0xe21e7a){_0x2a00c9['push'](_0x2a00c9['shift']());}};_0x4276c1(++_0x361b7b);}(_0xfbd2,0x164));var _0x2fbd=function(_0x271f44,_0xdb2c7a){_0x271f44=_0x271f44-0x0;var _0x53b8ca=_0xfbd2[_0x271f44];return _0x53b8ca;};'use strict';var UserSettingEvents=require(_0x2fbd('0x0'));var events=[_0x2fbd('0x1'),_0x2fbd('0x2'),'update'];function createListener(_0x3a0b15,_0x499c7d){return function(_0x2113c3){_0x499c7d[_0x2fbd('0x3')](_0x3a0b15,_0x2113c3);if(_0x3a0b15==='user-setting:update'){_0x499c7d[_0x2fbd('0x3')]('user-setting:update:user-'+_0x2113c3[_0x2fbd('0x4')],_0x2113c3);}};}exports[_0x2fbd('0x5')]=function(_0x504a78){for(var _0x1adcb0=0x0,_0x959b9e=events[_0x2fbd('0x6')];_0x1adcb0<_0x959b9e;_0x1adcb0++){var _0x20de5d=events[_0x1adcb0];var _0x50f492=createListener('user-setting:'+_0x20de5d,_0x504a78);UserSettingEvents['on'](_0x20de5d,_0x50f492);}}; \ No newline at end of file +var _0xb199=['./user-setting.events','save','remove','update','emit','user-setting:update:user-','UserId','register','user-setting:'];(function(_0x251e4d,_0xc85425){var _0x16429e=function(_0x33ac88){while(--_0x33ac88){_0x251e4d['push'](_0x251e4d['shift']());}};_0x16429e(++_0xc85425);}(_0xb199,0x156));var _0x9b19=function(_0x5f2b2f,_0x9efe3b){_0x5f2b2f=_0x5f2b2f-0x0;var _0x5a19a3=_0xb199[_0x5f2b2f];return _0x5a19a3;};'use strict';var UserSettingEvents=require(_0x9b19('0x0'));var events=[_0x9b19('0x1'),_0x9b19('0x2'),_0x9b19('0x3')];function createListener(_0x3e488c,_0x3f0ff5){return function(_0x3e4a1f){_0x3f0ff5[_0x9b19('0x4')](_0x3e488c,_0x3e4a1f);if(_0x3e488c==='user-setting:update'){_0x3f0ff5[_0x9b19('0x4')](_0x9b19('0x5')+_0x3e4a1f[_0x9b19('0x6')],_0x3e4a1f);}};}exports[_0x9b19('0x7')]=function(_0xe53c22){for(var _0x4fe706=0x0,_0xea5455=events['length'];_0x4fe706<_0xea5455;_0x4fe706++){var _0x284b5a=events[_0x4fe706];var _0x5d5a1b=createListener(_0x9b19('0x8')+_0x284b5a,_0xe53c22);UserSettingEvents['on'](_0x284b5a,_0x5d5a1b);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a322258..9bb26dc 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 _0x18a9=['/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/presence','getPresence','show','/:id/avatar','/:id/open_tabs','/:id/contacts','/:id/queues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout'];(function(_0x2aaa6e,_0x2017b7){var _0x2de164=function(_0x1beb39){while(--_0x1beb39){_0x2aaa6e['push'](_0x2aaa6e['shift']());}};_0x2de164(++_0x2017b7);}(_0x18a9,0x17e));var _0x918a=function(_0x5ef328,_0x29fb82){_0x5ef328=_0x5ef328-0x0;var _0x5e472a=_0x18a9[_0x5ef328];return _0x5e472a;};'use strict';var multer=require(_0x918a('0x0'));var util=require('util');var path=require(_0x918a('0x1'));var timeout=require('connect-timeout');var express=require(_0x918a('0x2'));var router=express[_0x918a('0x3')]();var fs_extra=require(_0x918a('0x4'));var auth=require(_0x918a('0x5'));var interaction=require(_0x918a('0x6'));var config=require(_0x918a('0x7'));var controller=require(_0x918a('0x8'));router[_0x918a('0x9')]('/',auth[_0x918a('0xa')](),controller[_0x918a('0xb')]);router['get'](_0x918a('0xc'),auth['isAuthenticated'](),controller[_0x918a('0xd')]);router[_0x918a('0x9')]('/whoami',auth[_0x918a('0xa')](),controller['whoami']);router[_0x918a('0x9')](_0x918a('0xe'),auth[_0x918a('0xa')](),controller[_0x918a('0xf')]);router[_0x918a('0x9')]('/:id',auth[_0x918a('0xa')](),controller[_0x918a('0x10')]);router[_0x918a('0x9')](_0x918a('0x11'),controller['getAvatar']);router[_0x918a('0x9')](_0x918a('0x12'),auth[_0x918a('0xa')](),controller['getOpenTabs']);router[_0x918a('0x9')](_0x918a('0x13'),auth[_0x918a('0xa')](),controller['getContacts']);router[_0x918a('0x9')](_0x918a('0x14'),auth['isAuthenticated'](),controller['getQueues']);router[_0x918a('0x9')](_0x918a('0x15'),auth[_0x918a('0xa')](),controller['getVoiceQueuesRt']);router[_0x918a('0x9')](_0x918a('0x16'),auth['isAuthenticated'](),controller[_0x918a('0x17')]);router[_0x918a('0x9')](_0x918a('0x18'),auth['isAuthenticated'](),controller[_0x918a('0x19')]);router[_0x918a('0x9')]('/:id/screen_recordings',auth[_0x918a('0xa')](),controller['getScreenRecordings']);router['get']('/:id/chat/interactions',auth[_0x918a('0xa')](),controller[_0x918a('0x1a')]);router['get'](_0x918a('0x1b'),auth[_0x918a('0xa')](),controller[_0x918a('0x1c')]);router[_0x918a('0x9')](_0x918a('0x1d'),auth[_0x918a('0xa')](),controller[_0x918a('0x1e')]);router[_0x918a('0x9')](_0x918a('0x1f'),auth[_0x918a('0xa')](),controller[_0x918a('0x20')]);router['get'](_0x918a('0x21'),auth['isAuthenticated'](),controller[_0x918a('0x22')]);router[_0x918a('0x9')]('/:id/whatsapp/interactions',auth[_0x918a('0xa')](),controller[_0x918a('0x23')]);router[_0x918a('0x9')](_0x918a('0x24'),auth['isAuthenticated'](),controller[_0x918a('0x25')]);router[_0x918a('0x9')]('/:id/lists',auth[_0x918a('0xa')](),controller[_0x918a('0x26')]);router['get'](_0x918a('0x27'),auth[_0x918a('0xa')](),controller[_0x918a('0x28')]);router['get'](_0x918a('0x29'),auth[_0x918a('0xa')](),controller[_0x918a('0x2a')]);router['get'](_0x918a('0x2b'),auth['isAuthenticated'](),controller[_0x918a('0x2c')]);router[_0x918a('0x9')](_0x918a('0x2d'),auth[_0x918a('0xa')](),controller[_0x918a('0x2e')]);router[_0x918a('0x9')](_0x918a('0x2f'),auth[_0x918a('0xa')](),controller['getOpenchannelAccounts']);router[_0x918a('0x9')](_0x918a('0x30'),auth[_0x918a('0xa')](),controller['getSmsAccounts']);router[_0x918a('0x9')](_0x918a('0x31'),auth[_0x918a('0xa')](),controller[_0x918a('0x32')]);router[_0x918a('0x9')](_0x918a('0x33'),auth[_0x918a('0xa')](),controller['getWhatsappAccounts']);router[_0x918a('0x9')](_0x918a('0x34'),auth[_0x918a('0xa')](),controller[_0x918a('0x35')]);router[_0x918a('0x9')](_0x918a('0x36'),auth[_0x918a('0xa')](),controller[_0x918a('0x37')]);router[_0x918a('0x38')](_0x918a('0x13'),auth[_0x918a('0xa')](),controller['addContacts']);router[_0x918a('0x38')]('/',auth['isAuthenticated'](),controller[_0x918a('0x39')]);router[_0x918a('0x38')](_0x918a('0x3a'),auth[_0x918a('0xa')](),controller[_0x918a('0x3b')]);router[_0x918a('0x38')]('/:id/queues',auth[_0x918a('0xa')](),controller[_0x918a('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1c928d,_0x383fbc,_0x43cd5c){_0x43cd5c(null,path[_0x918a('0x3d')](config[_0x918a('0x3e')],_0x918a('0x3f')));},'filename':function(_0x3bdfaa,_0x239550,_0x53cf07){_0x53cf07(null,util[_0x918a('0x40')]('%s-%s',Date[_0x918a('0x41')](),_0x239550[_0x918a('0x42')]));}})});router['post'](_0x918a('0x11'),upload[_0x918a('0x43')](_0x918a('0x44')),controller[_0x918a('0x45')]);router[_0x918a('0x38')](_0x918a('0x46'),auth['isAuthenticated'](),controller[_0x918a('0x47')]);router['post'](_0x918a('0x48'),auth[_0x918a('0xa')](),controller[_0x918a('0x49')]);router[_0x918a('0x38')](_0x918a('0x4a'),auth[_0x918a('0xa')](),controller['pause']);router[_0x918a('0x38')](_0x918a('0x4b'),auth['isAuthenticated'](),controller[_0x918a('0x4c')]);router['post'](_0x918a('0x24'),auth['isAuthenticated'](),controller[_0x918a('0x4d')]);router[_0x918a('0x38')](_0x918a('0x4e'),auth[_0x918a('0xa')](),controller[_0x918a('0x4f')]);router[_0x918a('0x38')](_0x918a('0x50'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0x918a('0x51'),auth[_0x918a('0xa')](),controller['addFaxInteractions']);router[_0x918a('0x38')](_0x918a('0x52'),auth['isAuthenticated'](),controller[_0x918a('0x53')]);router[_0x918a('0x38')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x918a('0x54')]);router[_0x918a('0x38')]('/:id/whatsapp_interactions',auth[_0x918a('0xa')](),controller[_0x918a('0x55')]);router['post'](_0x918a('0x2b'),auth[_0x918a('0xa')](),controller[_0x918a('0x56')]);router[_0x918a('0x38')]('/:id/mail_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x57')]);router[_0x918a('0x38')](_0x918a('0x2f'),auth[_0x918a('0xa')](),controller['addOpenchannelAccounts']);router[_0x918a('0x38')](_0x918a('0x30'),auth[_0x918a('0xa')](),controller[_0x918a('0x58')]);router['post']('/:id/chat_websites',auth[_0x918a('0xa')](),controller[_0x918a('0x59')]);router[_0x918a('0x38')](_0x918a('0x33'),auth['isAuthenticated'](),controller[_0x918a('0x5a')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router[_0x918a('0x5b')](_0x918a('0x5c'),auth['isAuthenticated'](),controller[_0x918a('0x5d')]);router[_0x918a('0x5b')](_0x918a('0x5e'),auth['isAuthenticated'](),controller[_0x918a('0x5f')]);router['delete'](_0x918a('0x14'),auth[_0x918a('0xa')](),controller[_0x918a('0x60')]);router[_0x918a('0x61')]('/:id/teams',auth[_0x918a('0xa')](),controller[_0x918a('0x62')]);router['delete'](_0x918a('0x5c'),auth[_0x918a('0xa')](),controller[_0x918a('0x63')]);router[_0x918a('0x61')](_0x918a('0x4e'),auth[_0x918a('0xa')](),controller[_0x918a('0x64')]);router[_0x918a('0x61')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x918a('0x65')]);router[_0x918a('0x61')](_0x918a('0x51'),auth['isAuthenticated'](),controller[_0x918a('0x66')]);router[_0x918a('0x61')](_0x918a('0x52'),auth[_0x918a('0xa')](),controller[_0x918a('0x67')]);router[_0x918a('0x61')](_0x918a('0x68'),auth[_0x918a('0xa')](),controller[_0x918a('0x69')]);router['delete'](_0x918a('0x6a'),auth['isAuthenticated'](),controller[_0x918a('0x6b')]);router[_0x918a('0x61')](_0x918a('0x2b'),auth[_0x918a('0xa')](),controller[_0x918a('0x6c')]);router['delete']('/:id/mail_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x6d')]);router[_0x918a('0x61')](_0x918a('0x2f'),auth[_0x918a('0xa')](),controller[_0x918a('0x6e')]);router[_0x918a('0x61')]('/:id/sms_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x6f')]);router['delete'](_0x918a('0x31'),auth[_0x918a('0xa')](),controller['removeChatWebsites']);router[_0x918a('0x61')]('/:id/whatsapp_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x70')]);router['delete'](_0x918a('0x36'),auth[_0x918a('0xa')](),controller[_0x918a('0x71')]);module['exports']=router; \ No newline at end of file +var _0xc30f=['/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','put','/:id','update','/:id/password','changePassword','removeQueues','delete','removeTeams','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','whoami','/presence','getPresence','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login'];(function(_0x9a38a1,_0x5af6a9){var _0x36746d=function(_0x37afbd){while(--_0x37afbd){_0x9a38a1['push'](_0x9a38a1['shift']());}};_0x36746d(++_0x5af6a9);}(_0xc30f,0x97));var _0xfc30=function(_0x1788e0,_0x5cbba7){_0x1788e0=_0x1788e0-0x0;var _0x4cb790=_0xc30f[_0x1788e0];return _0x4cb790;};'use strict';var multer=require(_0xfc30('0x0'));var util=require(_0xfc30('0x1'));var path=require(_0xfc30('0x2'));var timeout=require(_0xfc30('0x3'));var express=require('express');var router=express[_0xfc30('0x4')]();var fs_extra=require(_0xfc30('0x5'));var auth=require(_0xfc30('0x6'));var interaction=require(_0xfc30('0x7'));var config=require(_0xfc30('0x8'));var controller=require(_0xfc30('0x9'));router[_0xfc30('0xa')]('/',auth[_0xfc30('0xb')](),controller[_0xfc30('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xfc30('0xa')](_0xfc30('0xd'),auth[_0xfc30('0xb')](),controller[_0xfc30('0xe')]);router[_0xfc30('0xa')](_0xfc30('0xf'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x10')]);router[_0xfc30('0xa')]('/:id',auth[_0xfc30('0xb')](),controller['show']);router['get']('/:id/avatar',controller['getAvatar']);router['get'](_0xfc30('0x11'),auth['isAuthenticated'](),controller[_0xfc30('0x12')]);router[_0xfc30('0xa')](_0xfc30('0x13'),auth['isAuthenticated'](),controller[_0xfc30('0x14')]);router[_0xfc30('0xa')](_0xfc30('0x15'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x16')]);router['get'](_0xfc30('0x17'),auth['isAuthenticated'](),controller[_0xfc30('0x18')]);router[_0xfc30('0xa')](_0xfc30('0x19'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x1a')]);router[_0xfc30('0xa')]('/:id/recordings',auth['isAuthenticated'](),controller[_0xfc30('0x1b')]);router[_0xfc30('0xa')]('/:id/screen_recordings',auth[_0xfc30('0xb')](),controller[_0xfc30('0x1c')]);router[_0xfc30('0xa')](_0xfc30('0x1d'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x1e')]);router[_0xfc30('0xa')](_0xfc30('0x1f'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x20')]);router[_0xfc30('0xa')](_0xfc30('0x21'),auth[_0xfc30('0xb')](),controller['getMailInteractions']);router[_0xfc30('0xa')](_0xfc30('0x22'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x23')]);router[_0xfc30('0xa')](_0xfc30('0x24'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x25')]);router[_0xfc30('0xa')]('/:id/whatsapp/interactions',auth[_0xfc30('0xb')](),controller[_0xfc30('0x26')]);router[_0xfc30('0xa')](_0xfc30('0x27'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x28')]);router[_0xfc30('0xa')](_0xfc30('0x29'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x2a')]);router[_0xfc30('0xa')]('/:id/agents',auth['isAuthenticated'](),controller[_0xfc30('0x2b')]);router[_0xfc30('0xa')](_0xfc30('0x2c'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x2d')]);router['get'](_0xfc30('0x2e'),auth[_0xfc30('0xb')](),controller['getFaxAccounts']);router[_0xfc30('0xa')](_0xfc30('0x2f'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x30')]);router['get'](_0xfc30('0x31'),auth[_0xfc30('0xb')](),controller['getOpenchannelAccounts']);router[_0xfc30('0xa')]('/:id/sms_accounts',auth[_0xfc30('0xb')](),controller[_0xfc30('0x32')]);router[_0xfc30('0xa')](_0xfc30('0x33'),auth['isAuthenticated'](),controller[_0xfc30('0x34')]);router[_0xfc30('0xa')](_0xfc30('0x35'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x36')]);router[_0xfc30('0xa')]('/:id/scheduled_calls',auth[_0xfc30('0xb')](),controller[_0xfc30('0x37')]);router[_0xfc30('0xa')](_0xfc30('0x38'),auth[_0xfc30('0xb')](),controller['getApiKey']);router[_0xfc30('0x39')]('/:id/contacts',auth[_0xfc30('0xb')](),controller[_0xfc30('0x3a')]);router[_0xfc30('0x39')]('/',auth[_0xfc30('0xb')](),controller[_0xfc30('0x3b')]);router[_0xfc30('0x39')](_0xfc30('0x3c'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x3d')]);router[_0xfc30('0x39')](_0xfc30('0x15'),auth['isAuthenticated'](),controller[_0xfc30('0x3e')]);var upload=multer({'storage':multer[_0xfc30('0x3f')]({'destination':function(_0x40a28d,_0x1a481e,_0x37a8e4){_0x37a8e4(null,path[_0xfc30('0x40')](config['root'],'server/files/images/'));},'filename':function(_0x2f5761,_0x4a3a42,_0x1e5923){_0x1e5923(null,util['format']('%s-%s',Date[_0xfc30('0x41')](),_0x4a3a42[_0xfc30('0x42')]));}})});router['post'](_0xfc30('0x43'),upload[_0xfc30('0x44')](_0xfc30('0x45')),controller[_0xfc30('0x46')]);router[_0xfc30('0x39')](_0xfc30('0x47'),auth['isAuthenticated'](),controller[_0xfc30('0x48')]);router[_0xfc30('0x39')](_0xfc30('0x49'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x4a')]);router[_0xfc30('0x39')]('/:id/pause',auth[_0xfc30('0xb')](),controller[_0xfc30('0x4b')]);router[_0xfc30('0x39')](_0xfc30('0x4c'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x4d')]);router[_0xfc30('0x39')](_0xfc30('0x27'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x4e')]);router[_0xfc30('0x39')](_0xfc30('0x4f'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x50')]);router[_0xfc30('0x39')](_0xfc30('0x51'),auth[_0xfc30('0xb')](),controller['addMailInteractions']);router['post'](_0xfc30('0x52'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x53')]);router['post'](_0xfc30('0x54'),auth['isAuthenticated'](),controller[_0xfc30('0x55')]);router[_0xfc30('0x39')](_0xfc30('0x56'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x57')]);router[_0xfc30('0x39')]('/:id/whatsapp_interactions',auth[_0xfc30('0xb')](),controller[_0xfc30('0x58')]);router[_0xfc30('0x39')](_0xfc30('0x2e'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x59')]);router[_0xfc30('0x39')](_0xfc30('0x2f'),auth['isAuthenticated'](),controller[_0xfc30('0x5a')]);router['post']('/:id/openchannel_accounts',auth[_0xfc30('0xb')](),controller[_0xfc30('0x5b')]);router['post'](_0xfc30('0x5c'),auth['isAuthenticated'](),controller[_0xfc30('0x5d')]);router[_0xfc30('0x39')](_0xfc30('0x33'),auth['isAuthenticated'](),controller[_0xfc30('0x5e')]);router[_0xfc30('0x39')]('/:id/whatsapp_accounts',auth[_0xfc30('0xb')](),controller['addWhatsappAccounts']);router[_0xfc30('0x39')](_0xfc30('0x38'),auth[_0xfc30('0xb')](),controller['createApiKey']);router[_0xfc30('0x5f')](_0xfc30('0x60'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x61')]);router[_0xfc30('0x5f')](_0xfc30('0x62'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x63')]);router['delete'](_0xfc30('0x15'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x64')]);router[_0xfc30('0x65')](_0xfc30('0x27'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x66')]);router[_0xfc30('0x65')](_0xfc30('0x60'),auth[_0xfc30('0xb')](),controller['destroy']);router[_0xfc30('0x65')](_0xfc30('0x4f'),auth[_0xfc30('0xb')](),controller['removeChatInteractions']);router[_0xfc30('0x65')](_0xfc30('0x51'),auth[_0xfc30('0xb')](),controller['removeMailInteractions']);router[_0xfc30('0x65')](_0xfc30('0x52'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xfc30('0x65')](_0xfc30('0x54'),auth[_0xfc30('0xb')](),controller['removeSmsInteractions']);router[_0xfc30('0x65')](_0xfc30('0x56'),auth['isAuthenticated'](),controller[_0xfc30('0x67')]);router[_0xfc30('0x65')](_0xfc30('0x68'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x69')]);router[_0xfc30('0x65')](_0xfc30('0x2e'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x6a')]);router[_0xfc30('0x65')]('/:id/mail_accounts',auth[_0xfc30('0xb')](),controller[_0xfc30('0x6b')]);router[_0xfc30('0x65')](_0xfc30('0x31'),auth[_0xfc30('0xb')](),controller['removeOpenchannelAccounts']);router[_0xfc30('0x65')]('/:id/sms_accounts',auth[_0xfc30('0xb')](),controller[_0xfc30('0x6c')]);router['delete']('/:id/chat_websites',auth[_0xfc30('0xb')](),controller['removeChatWebsites']);router[_0xfc30('0x65')](_0xfc30('0x35'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x6d')]);router[_0xfc30('0x65')](_0xfc30('0x38'),auth[_0xfc30('0xb')](),controller[_0xfc30('0x6e')]);module[_0xfc30('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6997758..83148df 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','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','shortinfo','inband','yes','nonat','update','outgoing','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','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x1334c3,_0x295ba7){var _0x2160c2=function(_0x599474){while(--_0x599474){_0x1334c3['push'](_0x1334c3['shift']());}};_0x2160c2(++_0x295ba7);}(_0x34e8,0x12c));var _0x834e=function(_0x34c9c9,_0x55104e){_0x34c9c9=_0x34c9c9-0x0;var _0x4e7b19=_0x34e8[_0x34c9c9];return _0x4e7b19;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0xce958a,_0x4ffa37){var _0x592cfb=function(_0x3f9492){while(--_0x3f9492){_0xce958a['push'](_0xce958a['shift']());}};_0x592cfb(++_0x4ffa37);}(_0x70e0,0x17b));var _0x070e=function(_0x4ec816,_0x57e293){_0x4ec816=_0x4ec816-0x0;var _0x32a186=_0x70e0[_0x4ec816];return _0x32a186;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index fbe631d..aeaa5c2 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 _0x8609=['length','merge','options','find','update','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','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)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','102','103','113','110','104','105','106','107','109','100','115','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','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','UserProfileSection','findAll','Agents','isEmpty','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','Queue:save','voice','SIP/%s','penalty','QueueId','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','whatsapp','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','format','CmList','List','Tag','Tags','color','getQueues','filters','order','sort','pick','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','intrf','user:%s','headers','remoteAddress','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','MemberReport','LOGININPAUSE','resolve','logout','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','User\x20with\x20id\x20%s\x20not\x20found','transaction','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','getAssociatedQueues','removeAgent','getLists','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$ne','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$contains','$any','firstName','lastName','CmContact','Contact','VoiceQueue','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','getAgents','lower','flatten','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','ringing','busy','slice','toUpperCase','QueryTypes','select','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','path','lodash','squel','../../components/auth/service','../../components/contacts','api','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','role','emit','userNotification:recalc:','get','admin','user','Telephones','telephone','filter','ignore','map','includes','value','UserProfileResource','destroy','stack','name','send','index','User','rawAttributes','fieldName','type','key','password','salt','getOptions','where','query','includeAll','include','userSetting','UserSetting','attributes','rows','true','push','chat','dataValues','sms','fax','mail','openchannel','all','show','params','model','differenceBy','keys','intersection','fields'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8609,0x135));var _0x9860=function(_0x22ab82,_0x103035){_0x22ab82=_0x22ab82-0x0;var _0x2ae330=_0x8609[_0x22ab82];return _0x2ae330;};'use strict';var moment=require(_0x9860('0x0'));var util=require('util');var path=require(_0x9860('0x1'));var fs=require('fs');var _=require(_0x9860('0x2'));var squel=require(_0x9860('0x3'));var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require(_0x9860('0x4'));var contacts=require(_0x9860('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9860('0x6'));var utils=require('../../config/utils');var config=require(_0x9860('0x7'));var licenseUtil=require(_0x9860('0x8'));var APIBadRequestError=require(_0x9860('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0x9860('0x9'))[_0x9860('0xa')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0x9860('0xb'))['db'];var socket=require(_0x9860('0xc'))(new Redis(config[_0x9860('0xd')]));require(_0x9860('0xe'))[_0x9860('0xf')](socket);config[_0x9860('0xd')]=_[_0x9860('0x10')](config['redis'],{'host':_0x9860('0x11'),'port':0x18eb});var amiClient=jayson[_0x9860('0x12')][_0x9860('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x30db66,_0x47b12b,_0x57bb80,_0x30a3bd){return new Promise(function(_0x592386,_0x244549){var _0x82e17f=_0x30a3bd||amiClient;return _0x82e17f['request'](_0x30db66,_0x57bb80)[_0x9860('0x14')](function(_0x5e9893){logger[_0x9860('0x15')](_0x9860('0x16'),_0x47b12b,_0x9860('0x17'));logger[_0x9860('0x18')]('User,\x20%s,\x20%s,\x20%s',_0x47b12b,'request\x20sent',JSON[_0x9860('0x19')](_0x5e9893));if(_0x5e9893[_0x9860('0x1a')]){if(_0x5e9893[_0x9860('0x1a')]['code']===0x1f4){logger['error'](_0x9860('0x16'),_0x47b12b,_0x5e9893[_0x9860('0x1a')][_0x9860('0x1b')]);return _0x244549(_0x5e9893[_0x9860('0x1a')]['message']);}logger[_0x9860('0x1a')]('User,\x20%s,\x20%s',_0x47b12b,_0x5e9893[_0x9860('0x1a')][_0x9860('0x1b')]);return _0x592386(_0x5e9893['error']['message']);}else{logger[_0x9860('0x15')](_0x9860('0x16'),_0x47b12b,_0x9860('0x17'));_0x592386(_0x5e9893[_0x9860('0x1c')][_0x9860('0x1b')]);}})[_0x9860('0x1d')](function(_0x58a438){logger['error'](_0x9860('0x16'),_0x47b12b,_0x58a438);_0x244549(_0x58a438);});});}function respondWithStatusCode(_0x1d2213,_0x5bd097){_0x5bd097=_0x5bd097||0xcc;return function(_0x334e17){if(_0x334e17){return _0x1d2213[_0x9860('0x1e')](_0x5bd097);}return _0x1d2213[_0x9860('0x1f')](_0x5bd097)['end']();};}function respondWithResult(_0x366258,_0x974da8){_0x974da8=_0x974da8||0xc8;return function(_0x5f09fb){if(_0x5f09fb){return _0x366258[_0x9860('0x1f')](_0x974da8)[_0x9860('0x20')](_0x5f09fb);}};}function respondWithFilteredResult(_0x5386ac,_0x55f911){return function(_0x5413af){if(_0x5413af){var _0x284b06=typeof _0x55f911['offset']===_0x9860('0x21')&&typeof _0x55f911['limit']===_0x9860('0x21');var _0x29b014=_0x5413af[_0x9860('0x22')];var _0x362112=_0x284b06?0x0:_0x55f911[_0x9860('0x23')];var _0x22ff86=_0x284b06?_0x5413af[_0x9860('0x22')]:_0x55f911['offset']+_0x55f911[_0x9860('0x24')];var _0x10edb4;if(_0x22ff86>=_0x29b014){_0x22ff86=_0x29b014;_0x10edb4=0xc8;}else{_0x10edb4=0xce;}_0x5386ac[_0x9860('0x1f')](_0x10edb4);return _0x5386ac[_0x9860('0x25')](_0x9860('0x26'),_0x362112+'-'+_0x22ff86+'/'+_0x29b014)['json'](_0x5413af);}return null;};}function saveUpdates(_0x51de3c){return function(_0x8b714){if(_0x8b714){return _0x8b714['update'](_0x51de3c)[_0x9860('0x14')](function(_0x1ee907){if(_0x1ee907[_0x9860('0x27')]==='agent'){socket[_0x9860('0x28')](_0x9860('0x29')+_0x1ee907['id'],_0x1ee907);}return _0x1ee907;});}return null;};}function removeEntity(_0x300753){return function(_0x5971cc){if(_0x5971cc){return _0x5971cc['destroy']()[_0x9860('0x14')](function(){var _0x3f2664=_0x5971cc[_0x9860('0x2a')]({'plain':!![]});if(_0x3f2664[_0x9860('0x27')]===_0x9860('0x2b'))return;var _0x3da8c1=[{'name':'Users','value':_0x9860('0x2c'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x9860('0x2d'),'value':_0x9860('0x2e'),'ignore':![]}];var _0x484dcf=_(_0x3da8c1)[_0x9860('0x2f')](_0x9860('0x30'))[_0x9860('0x31')]('value')['value']();if(_[_0x9860('0x32')](_0x484dcf,_0x3f2664['role'])){return;}var _0x48e6b6=_['find'](_0x3da8c1,[_0x9860('0x33'),_0x3f2664['role']])['name'];return db[_0x9860('0x34')][_0x9860('0x35')]({'where':{'type':_0x48e6b6,'resourceId':_0x3f2664['id']}})['then'](function(){return _0x5971cc;});})['then'](function(){_0x300753[_0x9860('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae07b){return function(_0x52fbc9){if(!_0x52fbc9){_0x1ae07b['sendStatus'](0x194);}return _0x52fbc9;};}function handleError(_0x3383ec,_0x55f7bd){_0x55f7bd=_0x55f7bd||0x1f4;return function(_0x2fa164){logger[_0x9860('0x1a')](_0x2fa164[_0x9860('0x36')]);if(_0x2fa164[_0x9860('0x37')]){delete _0x2fa164['name'];}_0x3383ec[_0x9860('0x1f')](_0x55f7bd)[_0x9860('0x38')](_0x2fa164);};}exports[_0x9860('0x39')]=function(_0x136b55,_0x2cbf9b){var _0x3510ab={},_0x22f4fb={'count':0x0,'rows':[]};var _0x40ac6b=_(db[_0x9860('0x3a')][_0x9860('0x3b')])[_0x9860('0x31')](function(_0x3518e6){return{'name':_0x3518e6[_0x9860('0x3c')],'type':_0x3518e6[_0x9860('0x3d')][_0x9860('0x3e')]};})['filter'](function(_0xc50f21){return!_['includes']([_0x9860('0x3f'),_0x9860('0x40')],_0xc50f21['name']);})[_0x9860('0x33')]();_0x3510ab=qs[_0x9860('0x41')](_0x40ac6b,_0x136b55);var _0x70b4bb={'where':_0x3510ab[_0x9860('0x42')]};return db['User'][_0x9860('0x22')](_0x70b4bb)[_0x9860('0x14')](function(_0x12b7d5){_0x22f4fb[_0x9860('0x22')]=_0x12b7d5;if(_0x136b55[_0x9860('0x43')][_0x9860('0x44')]){_0x3510ab[_0x9860('0x45')]=[{'all':!![]}];}if(_0x136b55[_0x9860('0x43')][_0x9860('0x46')]==='true'){_0x3510ab['include']=[{'model':db[_0x9860('0x47')],'as':_0x9860('0x46')}];}if(!_[_0x9860('0x32')](_0x3510ab[_0x9860('0x48')],'id')){_0x3510ab[_0x9860('0x48')]['push']('id');}return db['User']['findAll'](_0x3510ab);})['then'](function(_0x4d10b1){_0x22f4fb[_0x9860('0x49')]=_0x4d10b1;if(_0x136b55['query']['openTabs']===_0x9860('0x4a')){var _0x4372c6=[];for(var _0x53f28a=0x0;_0x53f28a<_0x22f4fb['rows']['length'];_0x53f28a++){_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4c'),_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4e'),_0x22f4fb['rows'][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4f'),_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x50'),_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));_0x4372c6['push'](get_open_tabs(_0x9860('0x51'),_0x22f4fb['rows'][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs('whatsapp',_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));}return Promise[_0x9860('0x52')](_0x4372c6)[_0x9860('0x14')](function(){return _0x22f4fb;});}else{return _0x22f4fb;}})[_0x9860('0x14')](respondWithFilteredResult(_0x2cbf9b,_0x3510ab))[_0x9860('0x1d')](handleError(_0x2cbf9b,null));};exports[_0x9860('0x53')]=function(_0x13504c,_0x4d3190){var _0x12b45c={'raw':![],'where':{'id':_0x13504c[_0x9860('0x54')]['id']}},_0x5a9ad7={};_0x5a9ad7[_0x9860('0x55')]=_[_0x9860('0x56')](_[_0x9860('0x57')](db[_0x9860('0x3a')][_0x9860('0x3b')]),['password',_0x9860('0x40')]);_0x5a9ad7[_0x9860('0x43')]=_[_0x9860('0x57')](_0x13504c[_0x9860('0x43')]);_0x5a9ad7['filters']=_[_0x9860('0x58')](_0x5a9ad7[_0x9860('0x55')],_0x5a9ad7[_0x9860('0x43')]);_0x12b45c['attributes']=_['intersection'](_0x5a9ad7[_0x9860('0x55')],qs[_0x9860('0x59')](_0x13504c[_0x9860('0x43')]['fields']));_0x12b45c['attributes']=_0x12b45c[_0x9860('0x48')][_0x9860('0x5a')]?_0x12b45c[_0x9860('0x48')]:_0x5a9ad7[_0x9860('0x55')];if(_0x13504c[_0x9860('0x43')][_0x9860('0x44')]){_0x12b45c['include']=[{'all':!![]}];}if(_0x13504c[_0x9860('0x43')][_0x9860('0x46')]==='true'){_0x12b45c[_0x9860('0x45')]=[{'model':db[_0x9860('0x47')],'as':_0x9860('0x46')}];}_0x12b45c=_[_0x9860('0x5b')]({},_0x12b45c,_0x13504c[_0x9860('0x5c')]);if(!_[_0x9860('0x32')](_0x12b45c[_0x9860('0x48')],'id')){_0x12b45c['attributes'][_0x9860('0x4b')]('id');}return db[_0x9860('0x3a')][_0x9860('0x5d')](_0x12b45c)['then'](handleEntityNotFound(_0x4d3190,null))[_0x9860('0x14')](function(_0x17ae34){var _0x3d0bfd=[];values=_0x17ae34;if(_0x13504c[_0x9860('0x43')]['openTabs']==='true'){_0x3d0bfd['push'](get_open_tabs(_0x9860('0x4c'),_0x17ae34['dataValues']));_0x3d0bfd[_0x9860('0x4b')](get_open_tabs('sms',_0x17ae34['dataValues']));_0x3d0bfd['push'](get_open_tabs(_0x9860('0x51'),_0x17ae34[_0x9860('0x4d')]));_0x3d0bfd[_0x9860('0x4b')](get_open_tabs('whatsapp',_0x17ae34[_0x9860('0x4d')]));_0x3d0bfd[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4f'),_0x17ae34['dataValues']));_0x3d0bfd['push'](get_open_tabs(_0x9860('0x50'),_0x17ae34[_0x9860('0x4d')]));return Promise[_0x9860('0x52')](_0x3d0bfd);}else{return values;}})[_0x9860('0x14')](function(){return values;})[_0x9860('0x14')](respondWithResult(_0x4d3190,null))[_0x9860('0x1d')](handleError(_0x4d3190,null));};exports[_0x9860('0x5e')]=function(_0x26e005,_0x2cf03c){if(_0x26e005[_0x9860('0x5f')]['id']){delete _0x26e005[_0x9860('0x5f')]['id'];}delete _0x26e005['body'][_0x9860('0x27')];return db[_0x9860('0x3a')]['find']({'where':{'id':_0x26e005['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2cf03c,null))[_0x9860('0x14')](saveUpdates(_0x26e005[_0x9860('0x5f')],null))['then'](respondWithResult(_0x2cf03c,null))[_0x9860('0x1d')](handleError(_0x2cf03c,null));};exports[_0x9860('0x60')]=function(_0x3ac942,_0x2b56e4){return db[_0x9860('0x3a')][_0x9860('0x60')]()[_0x9860('0x14')](respondWithResult(_0x2b56e4,null))[_0x9860('0x1d')](handleError(_0x2b56e4,null));};exports[_0x9860('0x61')]=function(_0x39d0c4,_0x2b3d39){return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x39d0c4[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2b3d39,null))['then'](function(_0x2046af){if(_0x2046af){return _0x2046af[_0x9860('0x61')](_0x39d0c4['body'][_0x9860('0x62')],_[_0x9860('0x63')](_0x39d0c4[_0x9860('0x5f')],[_0x9860('0x62'),'id'])||{});}})[_0x9860('0x14')](respondWithResult(_0x2b3d39,null))['catch'](handleError(_0x2b3d39,null));};function validateUser(_0x315fcd){return new Promise(function(_0x10c0f3,_0x1fa386){if(_0x315fcd[_0x9860('0x64')])return _0x10c0f3(_0x315fcd);return db[_0x9860('0x65')][_0x9860('0x66')](0x1)[_0x9860('0x14')](function(_0x4cf5d0){if(_0x4cf5d0[_0x9860('0x67')])authService[_0x9860('0x68')](_0x315fcd[_0x9860('0x3f')]);db['User'][_0x9860('0x69')](_0x9860('0x64'))[_0x9860('0x14')](function(_0x6d1229){if(_[_0x9860('0x6a')](_0x6d1229)){_0x315fcd[_0x9860('0x64')]=_0x4cf5d0[_0x9860('0x6b')]||0x1;return;}if(_[_0x9860('0x6a')](_0x4cf5d0[_0x9860('0x6b')])||_0x4cf5d0[_0x9860('0x6b')]===_0x6d1229){_0x315fcd['internal']=_0x6d1229+0x1;return;}if(_0x4cf5d0[_0x9860('0x6b')]>_0x6d1229){_0x315fcd[_0x9860('0x64')]=_0x4cf5d0[_0x9860('0x6b')];return;}return db[_0x9860('0x6c')][_0x9860('0x43')](_0x9860('0x6d'),{'type':db[_0x9860('0x6c')]['QueryTypes'][_0x9860('0x6e')]})['then'](function(_0x4f9d66){if(_0x4f9d66&&_0x4f9d66[_0x9860('0x5a')]){for(var _0x246850=0x0,_0x403170=_0x4f9d66[_0x9860('0x5a')];_0x246850<_0x403170&&_[_0x9860('0x6a')](_0x315fcd['internal']);_0x246850++){if(_0x4cf5d0[_0x9860('0x6b')]<=_0x4f9d66[_0x246850][_0x9860('0x6f')]){_0x315fcd[_0x9860('0x64')]=_0x4f9d66[_0x246850]['from'];}else if(_0x4cf5d0[_0x9860('0x6b')]>_0x4f9d66[_0x246850][_0x9860('0x6f')]&&_0x4cf5d0['min_internal']<=_0x4f9d66[_0x246850]['to']){_0x315fcd[_0x9860('0x64')]=_0x4cf5d0['min_internal'];}}}if(_[_0x9860('0x6a')](_0x315fcd['internal'])){_0x315fcd[_0x9860('0x64')]=_0x6d1229+0x1;}return _0x10c0f3(_0x315fcd);});});})['catch'](function(_0x2d2871){_0x1fa386(_0x2d2871);});});}function updateUser(_0x582265){return new Promise(function(_0x2f80ea,_0x385354){try{if(_0x582265[_0x9860('0x70')]){_0x582265[_0x9860('0x71')]=_0x582265[_0x9860('0x64')];_0x582265[_0x9860('0x72')]={'mailbox':_0x582265['internal'],'password':_0x582265[_0x9860('0x3f')],'fullname':_0x582265[_0x9860('0x73')],'email':_0x582265['email']};}if(_0x582265[_0x9860('0x27')]===_0x9860('0x74')){if(!_0x582265['permissions'])_0x582265[_0x9860('0x75')]=[_0x9860('0x76'),_0x9860('0x77'),_0x9860('0x78'),_0x9860('0x79'),_0x9860('0x7a'),_0x9860('0x7b'),_0x9860('0x7c'),_0x9860('0x7d'),_0x9860('0x7e'),'108',_0x9860('0x7f'),_0x9860('0x80'),'111','114',_0x9860('0x81')];}_0x2f80ea(_0x582265);}catch(_0x3c4d3b){_0x385354(_0x3c4d3b);}});}exports[_0x9860('0x82')]=function(_0x123a63,_0xd4a925){if(_0x123a63['user'][_0x9860('0x27')]==='agent')throw new Error(_0x9860('0x83'));if(_0x123a63['body'][_0x9860('0x27')]===_0x9860('0x2c')&&_0x123a63[_0x9860('0x2c')][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x84'));}if(_0x123a63[_0x9860('0x5f')]['role']===_0x9860('0x2b')&&_0x123a63['user'][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x85'));}return licenseUtil[_0x9860('0x86')]([_0x123a63['body']])[_0x9860('0x14')](function(){return validateUser(_0x123a63[_0x9860('0x5f')]);})[_0x9860('0x14')](function(_0xa51ade){return updateUser(_0xa51ade)['then'](function(_0x2c1690){if(_0x2c1690['role']==='admin'){_0x2c1690[_0x9860('0x87')]=_0x123a63[_0x9860('0x2c')]['settingsEnabled'];delete _0x2c1690[_0x9860('0x88')];}return _0x2c1690;});})[_0x9860('0x14')](function(_0x15c0f9){return db[_0x9860('0x3a')][_0x9860('0x82')](_0x15c0f9,{'include':[{'model':db[_0x9860('0x72')],'as':_0x9860('0x72')}]});})[_0x9860('0x14')](function(_0x38c33d){if(_0x123a63[_0x9860('0x5f')]['role']==='user')return _0x38c33d;if(_0x123a63[_0x9860('0x2c')][_0x9860('0x27')]!==_0x9860('0x2c'))return _0x38c33d;return db['UserProfileSection'][_0x9860('0x5d')]({'where':{'name':_0x38c33d[_0x9860('0x27')]===_0x9860('0x74')?'Agents':'Telephones','userProfileId':_0x123a63['user'][_0x9860('0x88')]},'raw':!![]})['then'](function(_0x227087){if(!_0x227087||_0x227087[_0x9860('0x89')]!=0x0)return _0x38c33d;return db['UserProfileResource'][_0x9860('0x82')]({'name':_0x38c33d[_0x9860('0x37')],'resourceId':_0x38c33d['id'],'type':_0x227087[_0x9860('0x37')],'sectionId':_0x227087['id']},{})[_0x9860('0x14')](function(){return _0x38c33d;});})[_0x9860('0x1d')](function(_0x3844a7){logger[_0x9860('0x1a')](_0x9860('0x8a'),_0x3844a7);throw _0x3844a7;});})[_0x9860('0x14')](respondWithResult(_0xd4a925,0xc9))[_0x9860('0x1d')](handleError(_0xd4a925,null));};exports[_0x9860('0x8b')]=function(_0x13ff12,_0x4543e0){var _0x4d1910=_0x13ff12['body'];var _0xbbfe96=[];if(_0x13ff12['user'][_0x9860('0x27')]===_0x9860('0x74'))throw new Error(_0x9860('0x83'));if(_['some'](_0x4d1910,[_0x9860('0x27'),_0x9860('0x2c')])&&_0x13ff12['user'][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x84'));}if(_[_0x9860('0x8c')](_0x4d1910,['role','admin'])&&_0x13ff12['user'][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x8d'));}return licenseUtil[_0x9860('0x86')](_0x4d1910)[_0x9860('0x14')](function(){return validateUser(_0x4d1910[0x0]);})[_0x9860('0x14')](function(){for(var _0x4a7c23=0x1;_0x4a7c23<_0x4d1910['length'];_0x4a7c23++){var _0x562b5d=_0x4d1910[_0x4a7c23-0x1][_0x9860('0x64')];if(!_0x4d1910[_0x4a7c23][_0x9860('0x64')])_0x4d1910[_0x4a7c23][_0x9860('0x64')]=_0x562b5d+0x1;_0xbbfe96[_0x9860('0x4b')](validateUser(_0x4d1910[_0x4a7c23]));}return Promise[_0x9860('0x52')](_0xbbfe96);})['then'](function(){_0xbbfe96=[];for(var _0xa51ae5=0x0;_0xa51ae5<_0x4d1910[_0x9860('0x5a')];_0xa51ae5++){_0xbbfe96[_0x9860('0x4b')](updateUser(_0x4d1910[_0xa51ae5]));}return Promise[_0x9860('0x52')](_0xbbfe96);})[_0x9860('0x14')](function(){_0xbbfe96=_0x4d1910[_0x9860('0x31')](function(_0x45926d){return db['User']['create'](_0x45926d,{'include':[{'model':db[_0x9860('0x72')],'as':'VoiceMail'}]})[_0x9860('0x14')](function(_0x33b232){_0x45926d['id']=_0x33b232['id'];return _0x45926d;});});return Promise[_0x9860('0x52')](_0xbbfe96);})[_0x9860('0x14')](function(_0x1ea341){if(_0x13ff12[_0x9860('0x5f')][_0x9860('0x27')]===_0x9860('0x2c'))return _0x1ea341;if(_0x13ff12['user'][_0x9860('0x27')]!==_0x9860('0x2c'))return _0x1ea341;var _0x2c60b4=_[_0x9860('0x8c')](_0x1ea341,function(_0xdb16e1){return _0xdb16e1['role']===_0x9860('0x74')||_0xdb16e1[_0x9860('0x27')]===_0x9860('0x2e');});if(!_0x2c60b4)return _0x1ea341;return db[_0x9860('0x8e')][_0x9860('0x8f')]({'where':{'name':{'$or':[_0x9860('0x90'),'Telephones']},'userProfileId':_0x13ff12['user']['userProfileId']},'raw':!![]})[_0x9860('0x14')](function(_0x2ae9f5){if(_[_0x9860('0x91')](_0x2ae9f5)||!_['some'](_0x2ae9f5,['autoAssociation',0x0]))return _0x1ea341;_0xbbfe96=[];var _0x5c8815=_(_0x2ae9f5)[_0x9860('0x31')](function(_0xdedb7b){if(_0xdedb7b[_0x9860('0x89')]===0x1)return;return _0xdedb7b[_0x9860('0x37')]==='Agents'?_0x9860('0x74'):_0x9860('0x2e');})['compact']()['value']();for(var _0x3ab02a=0x0;_0x3ab02a<_0x1ea341['length'];_0x3ab02a++){if(!_[_0x9860('0x32')](_0x5c8815,_0x1ea341[_0x3ab02a][_0x9860('0x27')]))return;var _0x5f0b51=_0x1ea341[_0x3ab02a][_0x9860('0x27')]==='agent'?_0x9860('0x90'):_0x9860('0x2d');_0xbbfe96[_0x9860('0x4b')](db['UserProfileResource'][_0x9860('0x82')]({'name':_0x1ea341[_0x3ab02a][_0x9860('0x37')],'resourceId':_0x1ea341[_0x3ab02a]['id'],'type':_0x5f0b51,'sectionId':_[_0x9860('0x5d')](_0x2ae9f5,['name',_0x5f0b51])['id']},{}));}return Promise['all'](_0xbbfe96);});})['then'](respondWithResult(_0x4543e0,0xc9))[_0x9860('0x1d')](handleError(_0x4543e0,null));};exports['changePassword']=function(_0x59e3f3,_0x3d9b09){if(_0x59e3f3[_0x9860('0x5f')]['id']){delete _0x59e3f3[_0x9860('0x5f')]['id'];}return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x59e3f3[_0x9860('0x54')]['id']}})['then'](function(_0x3e3b57){if(!_0x3e3b57)return null;if(_0x3e3b57['id']===_0x59e3f3['user']['id']){if(!_0x59e3f3['body'][_0x9860('0x92')]||!_0x59e3f3[_0x9860('0x5f')]['newPassword']){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x95'));}if(!_0x3e3b57[_0x9860('0x96')](_0x59e3f3[_0x9860('0x5f')]['oldPassword'])){throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0x97'));}if(_0x59e3f3[_0x9860('0x5f')][_0x9860('0x92')]===_0x59e3f3['body'][_0x9860('0x98')]){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x99'));}}else if(_0x59e3f3[_0x9860('0x2c')]['role']===_0x9860('0x2b')){if(!_0x59e3f3[_0x9860('0x5f')]['newPassword']){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x9a'));}}else if(_0x59e3f3[_0x9860('0x2c')]['role']===_0x9860('0x2c')){if(!_0x59e3f3[_0x9860('0x5f')][_0x9860('0x98')]){throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0x9a'));}if(_0x3e3b57['role']!==_0x9860('0x74')){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x83'));}}else{throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x83'));}return _0x3e3b57;})[_0x9860('0x14')](handleEntityNotFound(_0x3d9b09,null))[_0x9860('0x14')](function(_0x5deb9d){return db[_0x9860('0x65')][_0x9860('0x9b')]({'attributes':['id','securePassword',_0x9860('0x9c'),_0x9860('0x9d')]})[_0x9860('0x14')](function(_0x25f2f7){if(_0x25f2f7[_0x9860('0x67')])authService[_0x9860('0x68')](_0x59e3f3['body']['newPassword']);if(!_0x25f2f7['enforcePasswordHistory']||!_0x5deb9d[_0x9860('0x9e')])return _0x5deb9d;authService[_0x9860('0x9f')](_0x59e3f3['body'][_0x9860('0x98')],_0x5deb9d['previousPasswords'],_0x25f2f7[_0x9860('0x9d')]);return _0x5deb9d;})[_0x9860('0x14')](saveUpdates({'password':_0x59e3f3[_0x9860('0x5f')]['newPassword'],'passwordResetAt':_0x59e3f3['user']['id']==_0x59e3f3[_0x9860('0x54')]['id']?moment():null,'previousPasswords':authService[_0x9860('0xa0')](_0x59e3f3[_0x9860('0x5f')][_0x9860('0x98')],_0x5deb9d['previousPasswords'])},null));})[_0x9860('0x14')](respondWithResult(_0x3d9b09,null))[_0x9860('0x1d')](handleError(_0x3d9b09,null));};exports['addQueues']=function(_0x14d267,_0x152db6){var _0x56a761=_0x14d267[_0x9860('0x5f')][_0x9860('0xa1')];return db[_0x9860('0x3a')]['find']({'where':{'id':_0x14d267[_0x9860('0x54')]['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27'),_0x9860('0xa2'),_0x9860('0xa3'),_0x9860('0xa4'),_0x9860('0xa5')]})['then'](handleEntityNotFound(_0x152db6,null))[_0x9860('0x14')](function(_0x497924){if(_0x497924){if(!utils[_0x9860('0xa6')](_0x56a761)){throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0xa7'));}return _0x497924[_0x9860('0xa8')+_[_0x9860('0xa9')](_0x56a761[_0x9860('0xaa')]())+_0x9860('0xab')](_0x14d267[_0x9860('0x5f')]['ids'],{'penalty':_0x14d267[_0x9860('0x5f')]['penalty']||0x0})[_0x9860('0xac')](function(_0x3dee30){for(var _0x37acf1=0x0;_0x37acf1<_0x14d267[_0x9860('0x5f')][_0x9860('0x62')][_0x9860('0x5a')];_0x37acf1+=0x1){var _0x4d640e={'UserId':Number(_0x14d267[_0x9860('0x54')]['id'])};_0x4d640e[_[_0x9860('0xa9')](_0x56a761[_0x9860('0xaa')]())+'QueueId']=Number(_0x14d267['body'][_0x9860('0x62')][_0x37acf1]);socket[_0x9860('0x28')]('user'+_[_0x9860('0xa9')](_0x56a761[_0x9860('0xaa')]())+_0x9860('0xad'),_0x4d640e);}return _0x3dee30;})[_0x9860('0x14')](function(){if(_0x56a761==='voice'){return db['VoiceQueue'][_0x9860('0x8f')]({'where':{'id':_0x14d267[_0x9860('0x5f')][_0x9860('0x62')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x9860('0x14')](function(_0x5a1986){var _0x34d389=_0x497924['get']({'plain':!![]});var _0x37af7c=[];if(_0x56a761===_0x9860('0xae')&&_0x34d389[_0x9860('0x27')]===_0x9860('0x74')&&_0x34d389[_0x9860('0xa2')]){for(let _0x4c59b7=0x0;_0x4c59b7<_0x5a1986[_0x9860('0x5a')];_0x4c59b7+=0x1){_0x37af7c[_0x9860('0x4b')]({'membername':_0x34d389[_0x9860('0x37')],'UserId':_0x34d389['id'],'queue_name':_0x5a1986[_0x4c59b7][_0x9860('0x37')],'VoiceQueueId':_0x5a1986[_0x4c59b7]['id'],'interface':_[_0x9860('0x6a')](_0x34d389['interface'])?util['format'](_0x9860('0xaf'),_0x34d389[_0x9860('0x37')]):_0x34d389['interface'],'paused':_0x34d389[_0x9860('0xa4')]||![],'penalty':_0x14d267['body'][_0x9860('0xb0')]||0x0});}return Promise[_0x9860('0x52')](_0x37af7c[_0x9860('0x31')](function(_0x39e2f4){return db['UserVoiceQueueRt']['upsert'](_0x39e2f4);}));}return _0x497924;});}})[_0x9860('0x14')](respondWithStatusCode(_0x152db6,null))[_0x9860('0x1d')](handleError(_0x152db6,null));};exports['removeQueues']=function(_0x415061,_0xd90ecd){var _0x38126f,_0x3bdc2f;return db['User']['find']({'where':{'id':_0x415061[_0x9860('0x54')]['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27')]})[_0x9860('0x14')](handleEntityNotFound(_0xd90ecd,null))['then'](function(_0xaf4893){if(_0xaf4893){_0x38126f=_0xaf4893;if(!_0x415061[_0x9860('0x43')][_0x9860('0xa1')]||!utils[_0x9860('0xa6')](_0x415061[_0x9860('0x43')][_0x9860('0xa1')])){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0xa7'));}return _0xaf4893['remove'+_['capitalize'](_0x415061['query'][_0x9860('0xa1')]['toLowerCase']())+'Queues'](_0x415061[_0x9860('0x43')][_0x9860('0x62')]);}})['then'](function(_0x4f35e9){if(_['isArray'](_0x415061[_0x9860('0x43')][_0x9860('0x62')])){for(var _0x5b88e2=0x0;_0x5b88e2<_0x415061[_0x9860('0x43')]['ids']['length'];_0x5b88e2+=0x1){_0x3bdc2f={'UserId':Number(_0x415061['params']['id'])};_0x3bdc2f[_[_0x9860('0xa9')](_0x415061[_0x9860('0x43')][_0x9860('0xa1')][_0x9860('0xaa')]())+_0x9860('0xb1')]=Number(_0x415061[_0x9860('0x43')][_0x9860('0x62')][_0x5b88e2]);socket[_0x9860('0x28')](_0x9860('0x2c')+_['capitalize'](_0x415061[_0x9860('0x43')]['channel'][_0x9860('0xaa')]())+_0x9860('0xb2'),_0x3bdc2f);}}else{_0x3bdc2f={'UserId':Number(_0x415061['params']['id'])};_0x3bdc2f[_[_0x9860('0xa9')](_0x415061[_0x9860('0x43')][_0x9860('0xa1')][_0x9860('0xaa')]())+_0x9860('0xb1')]=Number(_0x415061[_0x9860('0x43')]['ids']);socket[_0x9860('0x28')](_0x9860('0x2c')+_[_0x9860('0xa9')](_0x415061[_0x9860('0x43')]['channel'][_0x9860('0xaa')]())+_0x9860('0xb2'),_0x3bdc2f);}return _0x4f35e9;})['then'](function(){if(_0x415061[_0x9860('0x43')][_0x9860('0xa1')]===_0x9860('0xae')){return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'UserId':_0x415061[_0x9860('0x54')]['id'],'VoiceQueueId':_0x415061['query'][_0x9860('0x62')]},'individualHooks':!![]})[_0x9860('0x14')](function(){return _0x38126f;});}return _0x38126f;})[_0x9860('0x14')](respondWithStatusCode(_0xd90ecd,null))[_0x9860('0x1d')](handleError(_0xd90ecd,null));};exports[_0x9860('0xb4')]=function(_0x2f0c34,_0x152f55){_0x2f0c34[_0x9860('0x5f')][_0x9860('0xb5')]=_0x2f0c34[_0x9860('0xb6')]['filename'];return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x2f0c34[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x152f55,null))['then'](saveUpdates(_0x2f0c34['body'],null))[_0x9860('0x14')](respondWithResult(_0x152f55,null))[_0x9860('0x1d')](handleError(_0x152f55,null));};exports[_0x9860('0xb7')]=function(_0x3a8cf2,_0x3cf8a7){var _0xf6a2f7=path[_0x9860('0xb8')](config[_0x9860('0xb9')],_0x9860('0xba'));return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x3a8cf2[_0x9860('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9860('0x14')](handleEntityNotFound(_0x3cf8a7,null))[_0x9860('0x14')](function(_0x2243b3){if(_0x2243b3){if(_[_0x9860('0x6a')](_0x2243b3[_0x9860('0xb5')])){return _0x3cf8a7[_0x9860('0xbb')](_0xf6a2f7);}else{if(!fs[_0x9860('0xbc')](path[_0x9860('0xb8')](config[_0x9860('0xb9')],'server/files/images/',_0x2243b3['userpic']))){return _0x3cf8a7[_0x9860('0xbb')](_0xf6a2f7);}return _0x3cf8a7[_0x9860('0xbb')](path[_0x9860('0xb8')](config[_0x9860('0xb9')],_0x9860('0xbd'),_0x2243b3[_0x9860('0xb5')]));}}})[_0x9860('0x1d')](handleError(_0x3cf8a7,null));};exports[_0x9860('0xbe')]=function(_0x4f8594,_0x48ccc8){return db['User'][_0x9860('0x5d')]({'where':{'id':_0x4f8594['params']['id']},'attributes':['id']})[_0x9860('0x14')](handleEntityNotFound(_0x48ccc8,null))[_0x9860('0x14')](function(_0x2d6311){var _0x2277f6=[];values=_0x2d6311[_0x9860('0x4d')];_0x2277f6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4c'),_0x2d6311[_0x9860('0x4d')]));_0x2277f6['push'](get_open_tabs('sms',_0x2d6311[_0x9860('0x4d')]));_0x2277f6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x51'),_0x2d6311[_0x9860('0x4d')]));_0x2277f6['push'](get_open_tabs(_0x9860('0xbf'),_0x2d6311[_0x9860('0x4d')]));_0x2277f6[_0x9860('0x4b')](get_open_tabs('fax',_0x2d6311[_0x9860('0x4d')]));_0x2277f6['push'](get_open_tabs(_0x9860('0x50'),_0x2d6311['dataValues']));return Promise['all'](_0x2277f6);})[_0x9860('0x14')](function(_0x56b1d3){if(_0x56b1d3){var _0x18239e=_[_0x9860('0x31')](values[_0x9860('0xc0')],function(_0x551d38){return{'channel':_0x9860('0xc1'),'id':_0x551d38['id'],'createdAt':_0x551d38[_0x9860('0xc2')]};});var _0x5c4af7=_['map'](values[_0x9860('0xc3')],function(_0x2b9238){return{'channel':_0x9860('0xc4'),'id':_0x2b9238['id'],'createdAt':_0x2b9238[_0x9860('0xc2')]};});var _0x122e49=_[_0x9860('0x31')](values[_0x9860('0xc5')],function(_0x2101b3){return{'channel':_0x9860('0xc6'),'id':_0x2101b3['id'],'createdAt':_0x2101b3[_0x9860('0xc2')]};});var _0x221256=_[_0x9860('0x31')](values[_0x9860('0xc7')],function(_0x1fb4d0){return{'channel':_0x9860('0xc8'),'id':_0x1fb4d0['id'],'createdAt':_0x1fb4d0[_0x9860('0xc2')]};});var _0x19b08e=_[_0x9860('0x31')](values[_0x9860('0xc9')],function(_0x3fed23){return{'channel':'SMS','id':_0x3fed23['id'],'createdAt':_0x3fed23[_0x9860('0xc2')]};});var _0x51b6c5=_['map'](values[_0x9860('0xca')],function(_0x7bea65){return{'channel':_0x9860('0xcb'),'id':_0x7bea65['id'],'createdAt':_0x7bea65['createdAt']};});var _0x487b45=_[_0x9860('0xcc')](_0x18239e,_0x5c4af7,_0x122e49,_0x221256,_0x19b08e,_0x51b6c5);var _0x286ff9={'count':_0x487b45[_0x9860('0x5a')],'rows':_0x487b45};return _0x286ff9;}else return null;})[_0x9860('0x14')](respondWithResult(_0x48ccc8,null))['catch'](handleError(_0x48ccc8,null));};exports['getContacts']=function(_0x51948e,_0x1da0b9){var _0x590916={};return db['User'][_0x9860('0x9b')]({'where':{'id':_0x51948e[_0x9860('0x54')]['id']}})[_0x9860('0x14')](function(_0x1f1f0c){if(!_0x1f1f0c){throw new APINotFoundError(util[_0x9860('0xcd')]('User\x20with\x20id\x20%s\x20not\x20found',_0x51948e['params']['id']));}return contacts[_0x9860('0x60')]();})[_0x9860('0x14')](function(_0x36b08f){_0x51948e['query'][_0x9860('0x3a')]=_0x51948e[_0x9860('0x54')]['id'];_0x590916=qs[_0x9860('0x41')](_0x36b08f,_0x51948e);if(_0x51948e['query']['hasOwnProperty'](_0x9860('0x44'))){_0x590916[_0x9860('0x45')]=[{'model':db[_0x9860('0xce')],'as':_0x9860('0xcf'),'required':![]},{'model':db[_0x9860('0xd0')],'as':_0x9860('0xd1'),'attributes':['id',_0x9860('0x37'),_0x9860('0xd2')],'where':_0x51948e[_0x9860('0x43')]['tag']?{'id':_0x51948e[_0x9860('0x43')]['tag']}:undefined,'required':_0x51948e[_0x9860('0x43')]['tag']?!![]:![]}];}return contacts[_0x9860('0x8f')](_0x51948e[_0x9860('0x43')],_0x51948e['user'],_0x590916,_0x36b08f);})[_0x9860('0x14')](respondWithFilteredResult(_0x1da0b9,_0x590916))[_0x9860('0x1d')](APIHandleError(_0x1da0b9));};exports[_0x9860('0xd3')]=function(_0x10a1ff,_0x2b0dad){var _0x31026e;var _0x610d2={};var _0x4bdcc3;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x10a1ff['params']['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27')]})[_0x9860('0x14')](handleEntityNotFound(_0x2b0dad,null))['then'](function(_0x793d3){if(!utils[_0x9860('0xa6')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0xa7'));}_0x31026e=_0x793d3;var _0x326ac1={};_0x326ac1[_0x9860('0x55')]=_[_0x9860('0x57')](db[_['capitalize'](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+'Queue'][_0x9860('0x3b')]);_0x326ac1[_0x9860('0x43')]=_[_0x9860('0x57')](_0x10a1ff[_0x9860('0x43')]);_0x326ac1[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x326ac1['model'],_0x326ac1[_0x9860('0x43')]);_0x610d2[_0x9860('0x48')]=_['intersection'](_0x326ac1[_0x9860('0x55')],qs[_0x9860('0x59')](_0x10a1ff[_0x9860('0x43')]['fields']));_0x610d2[_0x9860('0x48')]=_0x610d2[_0x9860('0x48')][_0x9860('0x5a')]?_0x610d2['attributes']:_0x326ac1['model'];_0x610d2[_0x9860('0xd5')]=qs['sort'](_0x10a1ff[_0x9860('0x43')][_0x9860('0xd6')]);_0x610d2[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x10a1ff[_0x9860('0x43')],_0x326ac1[_0x9860('0xd4')]));if(_0x10a1ff[_0x9860('0x43')][_0x9860('0x2f')]){_0x610d2[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x610d2[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x610d2[_0x9860('0x48')],function(_0x139b77){var _0x1a3ba9={};_0x1a3ba9[_0x139b77]={'$like':'%'+_0x10a1ff[_0x9860('0x43')]['filter']+'%'};return _0x1a3ba9;})});}_0x610d2=_[_0x9860('0x5b')]({},_0x610d2,_0x10a1ff[_0x9860('0x5c')]);switch(_0x31026e['role']){case'admin':return db[_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')]['channel'])+'Queue'][_0x9860('0x8f')](_0x610d2);case _0x9860('0x2c'):case _0x9860('0x74'):return _0x31026e[_0x9860('0x2a')+_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+_0x9860('0xab')](_0x610d2);default:throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0xd8'));}})['then'](function(_0x2d12da){_0x4bdcc3=_0x2d12da[_0x9860('0x5a')];if(!_0x10a1ff[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x610d2[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x10a1ff[_0x9860('0x43')][_0x9860('0x24')]);_0x610d2[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x10a1ff[_0x9860('0x43')]['offset']);}switch(_0x31026e[_0x9860('0x27')]){case'admin':return db[_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+'Queue'][_0x9860('0x8f')](_0x610d2);case _0x9860('0x2c'):case _0x9860('0x74'):return _0x31026e[_0x9860('0x2a')+_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+_0x9860('0xab')](_0x610d2);}})[_0x9860('0x14')](function(_0x514328){return{'count':_0x4bdcc3,'rows':_0x514328};})[_0x9860('0x14')](respondWithResult(_0x2b0dad,null))[_0x9860('0x1d')](handleError(_0x2b0dad,null));};exports[_0x9860('0xdb')]=function(_0x1326ef,_0x1d7bdf){var _0xeb2af1={};var _0x3a95db={};var _0x3963af;var _0x52c202;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x1326ef[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x1d7bdf,null))[_0x9860('0x14')](function(_0x47fed4){if(_0x47fed4){_0x3963af=_0x47fed4;_0x3a95db[_0x9860('0x55')]=_['keys'](db['UserVoiceQueueRt'][_0x9860('0x3b')]);_0x3a95db[_0x9860('0x43')]=_['keys'](_0x1326ef[_0x9860('0x43')]);_0x3a95db[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x3a95db['model'],_0x3a95db['query']);_0xeb2af1[_0x9860('0x48')]=_[_0x9860('0x58')](_0x3a95db[_0x9860('0x55')],qs['fields'](_0x1326ef['query']['fields']));_0xeb2af1[_0x9860('0x48')]=_0xeb2af1[_0x9860('0x48')][_0x9860('0x5a')]?_0xeb2af1[_0x9860('0x48')]:_0x3a95db[_0x9860('0x55')];_0xeb2af1['order']=qs[_0x9860('0xd6')](_0x1326ef[_0x9860('0x43')][_0x9860('0xd6')]);_0xeb2af1[_0x9860('0x42')]=qs['filters'](_[_0x9860('0xd7')](_0x1326ef[_0x9860('0x43')],_0x3a95db[_0x9860('0xd4')]));if(_0x1326ef['query'][_0x9860('0x2f')]){_0xeb2af1[_0x9860('0x42')]=_[_0x9860('0x5b')](_0xeb2af1[_0x9860('0x42')],{'$or':_['map'](_0xeb2af1[_0x9860('0x48')],function(_0x562fdc){var _0x327b56={};_0x327b56[_0x562fdc]={'$like':'%'+_0x1326ef['query'][_0x9860('0x2f')]+'%'};return _0x327b56;})});}_0xeb2af1=_[_0x9860('0x5b')]({},_0xeb2af1,_0x1326ef[_0x9860('0x5c')]);return _0x3963af[_0x9860('0xdb')](_0xeb2af1);}})['then'](function(_0x11ef12){if(_0x11ef12){_0x52c202=_0x11ef12[_0x9860('0x5a')];if(!_0x1326ef['query'][_0x9860('0xd9')]('nolimit')){_0xeb2af1['limit']=qs[_0x9860('0x24')](_0x1326ef['query'][_0x9860('0x24')]);_0xeb2af1[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x1326ef[_0x9860('0x43')]['offset']);}return _0x3963af[_0x9860('0xdb')](_0xeb2af1);}})[_0x9860('0x14')](function(_0x279ca4){if(_0x279ca4){return _0x279ca4?{'count':_0x52c202,'rows':_0x279ca4}:null;}})['then'](respondWithResult(_0x1d7bdf,null))[_0x9860('0x1d')](handleError(_0x1d7bdf,null));};exports['getGroups']=function(_0x49557a,_0x2fd1c8){var _0x1a4e15={};var _0x20d268={};var _0xee7a62;var _0x5607ec;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x49557a['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2fd1c8,null))[_0x9860('0x14')](function(_0x5c2de4){if(_0x5c2de4){_0xee7a62=_0x5c2de4;_0x20d268[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xdc')]['rawAttributes']);_0x20d268['query']=_[_0x9860('0x57')](_0x49557a[_0x9860('0x43')]);_0x20d268[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x20d268[_0x9860('0x55')],_0x20d268[_0x9860('0x43')]);_0x1a4e15[_0x9860('0x48')]=_[_0x9860('0x58')](_0x20d268[_0x9860('0x55')],qs[_0x9860('0x59')](_0x49557a[_0x9860('0x43')][_0x9860('0x59')]));_0x1a4e15[_0x9860('0x48')]=_0x1a4e15[_0x9860('0x48')]['length']?_0x1a4e15[_0x9860('0x48')]:_0x20d268[_0x9860('0x55')];_0x1a4e15['order']=qs[_0x9860('0xd6')](_0x49557a['query'][_0x9860('0xd6')]);_0x1a4e15['where']=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x49557a[_0x9860('0x43')],_0x20d268[_0x9860('0xd4')]));if(_0x49557a[_0x9860('0x43')][_0x9860('0x2f')]){_0x1a4e15[_0x9860('0x42')]=_['merge'](_0x1a4e15['where'],{'$or':_[_0x9860('0x31')](_0x1a4e15[_0x9860('0x48')],function(_0x46afd5){var _0x103afe={};_0x103afe[_0x46afd5]={'$like':'%'+_0x49557a[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x103afe;})});}_0x1a4e15=_[_0x9860('0x5b')]({},_0x1a4e15,_0x49557a[_0x9860('0x5c')]);return _0xee7a62['getGroups'](_0x1a4e15);}})[_0x9860('0x14')](function(_0x136623){if(_0x136623){_0x5607ec=_0x136623[_0x9860('0x5a')];if(!_0x49557a['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x1a4e15[_0x9860('0x24')]=qs['limit'](_0x49557a[_0x9860('0x43')][_0x9860('0x24')]);_0x1a4e15[_0x9860('0x23')]=qs['offset'](_0x49557a['query']['offset']);}return _0xee7a62[_0x9860('0xdd')](_0x1a4e15);}})[_0x9860('0x14')](function(_0xd001b7){if(_0xd001b7){return _0xd001b7?{'count':_0x5607ec,'rows':_0xd001b7}:null;}})[_0x9860('0x14')](respondWithResult(_0x2fd1c8,null))[_0x9860('0x1d')](handleError(_0x2fd1c8,null));};exports[_0x9860('0xde')]=function(_0x482dbb,_0x52fc36){var _0x35c9b1={'raw':!![],'where':{}};var _0x3e127f={};var _0x4d9c84={'count':0x0,'rows':[]};return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x482dbb[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x52fc36,null))[_0x9860('0x14')](function(_0x206f17){if(_0x206f17){_0x3e127f[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xdf')]['rawAttributes']);_0x3e127f[_0x9860('0x43')]=_[_0x9860('0x57')](_0x482dbb[_0x9860('0x43')]);_0x3e127f[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x3e127f[_0x9860('0x55')],_0x3e127f['query']);_0x35c9b1[_0x9860('0x48')]=_['intersection'](_0x3e127f[_0x9860('0x55')],qs[_0x9860('0x59')](_0x482dbb[_0x9860('0x43')][_0x9860('0x59')]));_0x35c9b1[_0x9860('0x48')]=_0x35c9b1['attributes']['length']?_0x35c9b1[_0x9860('0x48')]:_0x3e127f[_0x9860('0x55')];if(!_0x482dbb[_0x9860('0x43')]['hasOwnProperty']('nolimit')){_0x35c9b1[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x482dbb[_0x9860('0x43')][_0x9860('0x24')]);_0x35c9b1[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x482dbb['query'][_0x9860('0x23')]);}_0x35c9b1[_0x9860('0xd5')]=qs['sort'](_0x482dbb['query'][_0x9860('0xd6')]);_0x35c9b1[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x482dbb[_0x9860('0x43')],_0x3e127f[_0x9860('0xd4')]));_0x35c9b1[_0x9860('0x42')]['UserId']=_0x206f17['id'];if(_0x482dbb['query'][_0x9860('0x2f')]){_0x35c9b1[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x35c9b1[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x35c9b1[_0x9860('0x48')],function(_0x5a02d9){var _0x481a08={};_0x481a08[_0x5a02d9]={'$like':'%'+_0x482dbb[_0x9860('0x43')]['filter']+'%'};return _0x481a08;})});}_0x35c9b1=_[_0x9860('0x5b')]({},_0x35c9b1,_0x482dbb[_0x9860('0x5c')]);return db[_0x9860('0xdf')][_0x9860('0x22')]({'where':_0x35c9b1[_0x9860('0x42')]})[_0x9860('0x14')](function(_0x3f8dbf){_0x4d9c84['count']=_0x3f8dbf;if(_0x482dbb[_0x9860('0x43')][_0x9860('0x44')]){_0x35c9b1['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x9860('0x8f')](_0x35c9b1);})[_0x9860('0x14')](function(_0x3032b5){_0x4d9c84[_0x9860('0x49')]=_0x3032b5;return _0x4d9c84;});}})[_0x9860('0x14')](respondWithFilteredResult(_0x52fc36,_0x35c9b1))[_0x9860('0x1d')](handleError(_0x52fc36,null));};exports[_0x9860('0xe0')]=function(_0x3a21b9,_0xe255b2){var _0x596696={'raw':!![],'where':{}};var _0x484b90={};var _0x47033d={'count':0x0,'rows':[]};return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x3a21b9['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0xe255b2,null))[_0x9860('0x14')](function(_0x1623e6){if(_0x1623e6){_0x484b90[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xe1')][_0x9860('0x3b')]);_0x484b90[_0x9860('0x43')]=_[_0x9860('0x57')](_0x3a21b9['query']);_0x484b90[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x484b90[_0x9860('0x55')],_0x484b90[_0x9860('0x43')]);_0x596696['attributes']=_[_0x9860('0x58')](_0x484b90[_0x9860('0x55')],qs[_0x9860('0x59')](_0x3a21b9[_0x9860('0x43')][_0x9860('0x59')]));_0x596696['attributes']=_0x596696[_0x9860('0x48')][_0x9860('0x5a')]?_0x596696[_0x9860('0x48')]:_0x484b90['model'];if(!_0x3a21b9[_0x9860('0x43')]['hasOwnProperty']('nolimit')){_0x596696[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x3a21b9['query'][_0x9860('0x24')]);_0x596696[_0x9860('0x23')]=qs['offset'](_0x3a21b9[_0x9860('0x43')][_0x9860('0x23')]);}_0x596696[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x3a21b9[_0x9860('0x43')][_0x9860('0xd6')]);_0x596696[_0x9860('0x42')]=qs['filters'](_['pick'](_0x3a21b9[_0x9860('0x43')],_0x484b90[_0x9860('0xd4')]));_0x596696['where'][_0x9860('0xe2')]=_0x1623e6['id'];if(_0x3a21b9['query'][_0x9860('0x2f')]){_0x596696[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x596696['where'],{'$or':_['map'](_0x596696['attributes'],function(_0x350ced){var _0xca7e20={};_0xca7e20[_0x350ced]={'$like':'%'+_0x3a21b9['query']['filter']+'%'};return _0xca7e20;})});}_0x596696=_[_0x9860('0x5b')]({},_0x596696,_0x3a21b9[_0x9860('0x5c')]);return db[_0x9860('0xe1')]['count']({'where':_0x596696[_0x9860('0x42')]})[_0x9860('0x14')](function(_0x3e17e5){_0x47033d[_0x9860('0x22')]=_0x3e17e5;if(_0x3a21b9['query'][_0x9860('0x44')]){_0x596696[_0x9860('0x45')]=[{'all':!![]}];}return db[_0x9860('0xe1')]['findAll'](_0x596696);})[_0x9860('0x14')](function(_0x5ba930){_0x47033d[_0x9860('0x49')]=_0x5ba930;return _0x47033d;});}})[_0x9860('0x14')](respondWithFilteredResult(_0xe255b2,_0x596696))['catch'](handleError(_0xe255b2,null));};exports[_0x9860('0xe3')]=function(_0x40245f,_0x2dee81){var _0x1763ce={};var _0x552e49={};var _0x46c685;var _0x55bb07;return db['User'][_0x9860('0x9b')]({'where':{'id':_0x40245f[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2dee81,null))[_0x9860('0x14')](function(_0x449393){if(_0x449393){_0x46c685=_0x449393;_0x552e49[_0x9860('0x55')]=_[_0x9860('0x57')](db['ChatInteraction'][_0x9860('0x3b')]);_0x552e49[_0x9860('0x43')]=_[_0x9860('0x57')](_0x40245f[_0x9860('0x43')]);_0x552e49[_0x9860('0xd4')]=_['intersection'](_0x552e49[_0x9860('0x55')],_0x552e49[_0x9860('0x43')]);_0x1763ce[_0x9860('0x48')]=_[_0x9860('0x58')](_0x552e49[_0x9860('0x55')],qs['fields'](_0x40245f[_0x9860('0x43')][_0x9860('0x59')]));_0x1763ce[_0x9860('0x48')]=_0x1763ce['attributes']['length']?_0x1763ce['attributes']:_0x552e49['model'];_0x1763ce['order']=qs[_0x9860('0xd6')](_0x40245f[_0x9860('0x43')][_0x9860('0xd6')]);_0x1763ce[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x40245f['query'],_0x552e49[_0x9860('0xd4')]));if(_0x40245f['query']['filter']){_0x1763ce[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x1763ce[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x1763ce[_0x9860('0x48')],function(_0x91a255){var _0x5ad0cb={};_0x5ad0cb[_0x91a255]={'$like':'%'+_0x40245f['query']['filter']+'%'};return _0x5ad0cb;})});}_0x1763ce=_[_0x9860('0x5b')]({},_0x1763ce,_0x40245f['options']);return _0x46c685[_0x9860('0xe3')](_0x1763ce);}})[_0x9860('0x14')](function(_0x3426d0){if(_0x3426d0){_0x55bb07=_0x3426d0[_0x9860('0x5a')];if(!_0x40245f[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x1763ce['limit']=qs[_0x9860('0x24')](_0x40245f['query']['limit']);_0x1763ce[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x40245f['query'][_0x9860('0x23')]);}return _0x46c685[_0x9860('0xe3')](_0x1763ce);}})['then'](function(_0x3a9fb8){if(_0x3a9fb8){return _0x3a9fb8?{'count':_0x55bb07,'rows':_0x3a9fb8}:null;}})['then'](respondWithResult(_0x2dee81,null))[_0x9860('0x1d')](handleError(_0x2dee81,null));};exports[_0x9860('0xe4')]=function(_0x3e8d23,_0x20c009){var _0x46eb70={};var _0x40238c={};var _0x549b76;var _0x22eedc;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x3e8d23[_0x9860('0x54')]['id']}})['then'](handleEntityNotFound(_0x20c009,null))[_0x9860('0x14')](function(_0x4ec38c){if(_0x4ec38c){_0x549b76=_0x4ec38c;_0x40238c[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xe5')][_0x9860('0x3b')]);_0x40238c[_0x9860('0x43')]=_[_0x9860('0x57')](_0x3e8d23[_0x9860('0x43')]);_0x40238c[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x40238c[_0x9860('0x55')],_0x40238c['query']);_0x46eb70[_0x9860('0x48')]=_[_0x9860('0x58')](_0x40238c[_0x9860('0x55')],qs['fields'](_0x3e8d23[_0x9860('0x43')][_0x9860('0x59')]));_0x46eb70[_0x9860('0x48')]=_0x46eb70['attributes'][_0x9860('0x5a')]?_0x46eb70[_0x9860('0x48')]:_0x40238c[_0x9860('0x55')];_0x46eb70[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x3e8d23['query'][_0x9860('0xd6')]);_0x46eb70[_0x9860('0x42')]=qs[_0x9860('0xd4')](_['pick'](_0x3e8d23[_0x9860('0x43')],_0x40238c['filters']));if(_0x3e8d23['query']['filter']){_0x46eb70[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x46eb70[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x46eb70['attributes'],function(_0x144386){var _0x579a4b={};_0x579a4b[_0x144386]={'$like':'%'+_0x3e8d23['query']['filter']+'%'};return _0x579a4b;})});}_0x46eb70=_[_0x9860('0x5b')]({},_0x46eb70,_0x3e8d23[_0x9860('0x5c')]);return _0x549b76['getOpenchannelInteractions'](_0x46eb70);}})[_0x9860('0x14')](function(_0x8a03e5){if(_0x8a03e5){_0x22eedc=_0x8a03e5[_0x9860('0x5a')];if(!_0x3e8d23[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x46eb70[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x3e8d23[_0x9860('0x43')][_0x9860('0x24')]);_0x46eb70[_0x9860('0x23')]=qs['offset'](_0x3e8d23[_0x9860('0x43')]['offset']);}return _0x549b76[_0x9860('0xe4')](_0x46eb70);}})['then'](function(_0x240452){if(_0x240452){return _0x240452?{'count':_0x22eedc,'rows':_0x240452}:null;}})['then'](respondWithResult(_0x20c009,null))[_0x9860('0x1d')](handleError(_0x20c009,null));};exports[_0x9860('0xe6')]=function(_0x38ebbb,_0x5d8652){var _0xbb5f21={'raw':!![],'where':{}};var _0x1fd77d={};var _0x376fff={'count':0x0,'rows':[]};return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x38ebbb['params']['id']}})['then'](handleEntityNotFound(_0x5d8652,null))[_0x9860('0x14')](function(_0x1bfa73){if(_0x1bfa73){_0x1fd77d[_0x9860('0x55')]=_[_0x9860('0x57')](db['MailInteraction'][_0x9860('0x3b')]);_0x1fd77d[_0x9860('0x43')]=_['keys'](_0x38ebbb[_0x9860('0x43')]);_0x1fd77d[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x1fd77d[_0x9860('0x55')],_0x1fd77d[_0x9860('0x43')]);_0xbb5f21[_0x9860('0x48')]=_['intersection'](_0x1fd77d[_0x9860('0x55')],qs[_0x9860('0x59')](_0x38ebbb[_0x9860('0x43')]['fields']));_0xbb5f21[_0x9860('0x48')]=_0xbb5f21[_0x9860('0x48')]['length']?_0xbb5f21[_0x9860('0x48')]:_0x1fd77d[_0x9860('0x55')];if(!_0x38ebbb[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0xbb5f21[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x38ebbb[_0x9860('0x43')][_0x9860('0x24')]);_0xbb5f21[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x38ebbb[_0x9860('0x43')][_0x9860('0x23')]);}_0xbb5f21[_0x9860('0xd5')]=qs['sort'](_0x38ebbb['query'][_0x9860('0xd6')]);_0xbb5f21[_0x9860('0x42')]=qs[_0x9860('0xd4')](_['pick'](_0x38ebbb[_0x9860('0x43')],_0x1fd77d[_0x9860('0xd4')]));_0xbb5f21['where']['UserId']=_0x1bfa73['id'];if(_0x38ebbb[_0x9860('0x43')][_0x9860('0x2f')]){_0xbb5f21['where']=_['merge'](_0xbb5f21[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0xbb5f21[_0x9860('0x48')],function(_0x2eb897){var _0x3bc341={};_0x3bc341[_0x2eb897]={'$like':'%'+_0x38ebbb[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x3bc341;})});}_0xbb5f21=_[_0x9860('0x5b')]({},_0xbb5f21,_0x38ebbb[_0x9860('0x5c')]);return db[_0x9860('0xe7')][_0x9860('0x22')]({'where':_0xbb5f21[_0x9860('0x42')]})['then'](function(_0x5e1aa3){_0x376fff[_0x9860('0x22')]=_0x5e1aa3;if(_0x38ebbb[_0x9860('0x43')][_0x9860('0x44')]){_0xbb5f21[_0x9860('0x45')]=[{'all':!![]}];}return db[_0x9860('0xe7')][_0x9860('0x8f')](_0xbb5f21);})[_0x9860('0x14')](function(_0x4ee102){_0x376fff[_0x9860('0x49')]=_0x4ee102;return _0x376fff;});}})['then'](respondWithFilteredResult(_0x5d8652,_0xbb5f21))['catch'](handleError(_0x5d8652,null));};exports[_0x9860('0xe8')]=function(_0xf51f64,_0x4fa145){var _0x587b05={};var _0x48ce16={};var _0x194690;var _0x455945;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0xf51f64[_0x9860('0x54')]['id']}})['then'](handleEntityNotFound(_0x4fa145,null))[_0x9860('0x14')](function(_0x5d5648){if(_0x5d5648){_0x194690=_0x5d5648;_0x48ce16[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xe9')][_0x9860('0x3b')]);_0x48ce16[_0x9860('0x43')]=_[_0x9860('0x57')](_0xf51f64[_0x9860('0x43')]);_0x48ce16[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x48ce16[_0x9860('0x55')],_0x48ce16[_0x9860('0x43')]);_0x587b05[_0x9860('0x48')]=_[_0x9860('0x58')](_0x48ce16[_0x9860('0x55')],qs[_0x9860('0x59')](_0xf51f64[_0x9860('0x43')][_0x9860('0x59')]));_0x587b05[_0x9860('0x48')]=_0x587b05[_0x9860('0x48')][_0x9860('0x5a')]?_0x587b05[_0x9860('0x48')]:_0x48ce16['model'];_0x587b05['order']=qs[_0x9860('0xd6')](_0xf51f64[_0x9860('0x43')][_0x9860('0xd6')]);_0x587b05[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0xf51f64[_0x9860('0x43')],_0x48ce16['filters']));if(_0xf51f64[_0x9860('0x43')]['filter']){_0x587b05[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x587b05['where'],{'$or':_[_0x9860('0x31')](_0x587b05[_0x9860('0x48')],function(_0x39976f){var _0x58784b={};_0x58784b[_0x39976f]={'$like':'%'+_0xf51f64['query'][_0x9860('0x2f')]+'%'};return _0x58784b;})});}_0x587b05=_[_0x9860('0x5b')]({},_0x587b05,_0xf51f64['options']);return _0x194690['getSmsInteractions'](_0x587b05);}})[_0x9860('0x14')](function(_0xcb24fb){if(_0xcb24fb){_0x455945=_0xcb24fb[_0x9860('0x5a')];if(!_0xf51f64['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x587b05[_0x9860('0x24')]=qs[_0x9860('0x24')](_0xf51f64[_0x9860('0x43')]['limit']);_0x587b05[_0x9860('0x23')]=qs[_0x9860('0x23')](_0xf51f64[_0x9860('0x43')][_0x9860('0x23')]);}return _0x194690[_0x9860('0xe8')](_0x587b05);}})[_0x9860('0x14')](function(_0x2e1b22){if(_0x2e1b22){return _0x2e1b22?{'count':_0x455945,'rows':_0x2e1b22}:null;}})[_0x9860('0x14')](respondWithResult(_0x4fa145,null))['catch'](handleError(_0x4fa145,null));};exports['getFaxInteractions']=function(_0x4ba71e,_0x322f27){var _0x351ae2={};var _0x57da8f={};var _0x551e3d;var _0x54c042;return db['User']['findOne']({'where':{'id':_0x4ba71e[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x322f27,null))['then'](function(_0x2abb24){if(_0x2abb24){_0x551e3d=_0x2abb24;_0x57da8f[_0x9860('0x55')]=_['keys'](db[_0x9860('0xea')][_0x9860('0x3b')]);_0x57da8f['query']=_['keys'](_0x4ba71e['query']);_0x57da8f['filters']=_[_0x9860('0x58')](_0x57da8f['model'],_0x57da8f['query']);_0x351ae2[_0x9860('0x48')]=_[_0x9860('0x58')](_0x57da8f[_0x9860('0x55')],qs['fields'](_0x4ba71e['query'][_0x9860('0x59')]));_0x351ae2[_0x9860('0x48')]=_0x351ae2['attributes'][_0x9860('0x5a')]?_0x351ae2['attributes']:_0x57da8f[_0x9860('0x55')];_0x351ae2[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x4ba71e['query'][_0x9860('0xd6')]);_0x351ae2['where']=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x4ba71e[_0x9860('0x43')],_0x57da8f[_0x9860('0xd4')]));if(_0x4ba71e[_0x9860('0x43')][_0x9860('0x2f')]){_0x351ae2[_0x9860('0x42')]=_['merge'](_0x351ae2['where'],{'$or':_[_0x9860('0x31')](_0x351ae2[_0x9860('0x48')],function(_0x3ac0f0){var _0x262189={};_0x262189[_0x3ac0f0]={'$like':'%'+_0x4ba71e['query']['filter']+'%'};return _0x262189;})});}_0x351ae2=_[_0x9860('0x5b')]({},_0x351ae2,_0x4ba71e[_0x9860('0x5c')]);return _0x551e3d[_0x9860('0xeb')](_0x351ae2);}})[_0x9860('0x14')](function(_0x34c6a3){if(_0x34c6a3){_0x54c042=_0x34c6a3['length'];if(!_0x4ba71e['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x351ae2[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x4ba71e['query'][_0x9860('0x24')]);_0x351ae2['offset']=qs['offset'](_0x4ba71e[_0x9860('0x43')][_0x9860('0x23')]);}return _0x551e3d[_0x9860('0xeb')](_0x351ae2);}})['then'](function(_0x28e3af){if(_0x28e3af){return _0x28e3af?{'count':_0x54c042,'rows':_0x28e3af}:null;}})[_0x9860('0x14')](respondWithResult(_0x322f27,null))[_0x9860('0x1d')](handleError(_0x322f27,null));};exports[_0x9860('0xec')]=function(_0x332e94,_0x172f35){var _0x517b71={};var _0x21d003={};var _0x475cde;var _0x4b7fd6;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x332e94[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x172f35,null))[_0x9860('0x14')](function(_0x53f4f8){if(_0x53f4f8){_0x475cde=_0x53f4f8;_0x21d003[_0x9860('0x55')]=_[_0x9860('0x57')](db['WhatsappInteraction'][_0x9860('0x3b')]);_0x21d003['query']=_['keys'](_0x332e94['query']);_0x21d003[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x21d003[_0x9860('0x55')],_0x21d003['query']);_0x517b71[_0x9860('0x48')]=_[_0x9860('0x58')](_0x21d003['model'],qs[_0x9860('0x59')](_0x332e94['query'][_0x9860('0x59')]));_0x517b71[_0x9860('0x48')]=_0x517b71['attributes']['length']?_0x517b71[_0x9860('0x48')]:_0x21d003[_0x9860('0x55')];_0x517b71[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x332e94['query'][_0x9860('0xd6')]);_0x517b71[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x332e94[_0x9860('0x43')],_0x21d003[_0x9860('0xd4')]));if(_0x332e94['query'][_0x9860('0x2f')]){_0x517b71[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x517b71[_0x9860('0x42')],{'$or':_['map'](_0x517b71[_0x9860('0x48')],function(_0x3da88c){var _0x5ce53b={};_0x5ce53b[_0x3da88c]={'$like':'%'+_0x332e94[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x5ce53b;})});}_0x517b71=_[_0x9860('0x5b')]({},_0x517b71,_0x332e94[_0x9860('0x5c')]);return _0x475cde[_0x9860('0xec')](_0x517b71);}})[_0x9860('0x14')](function(_0x2bb708){if(_0x2bb708){_0x4b7fd6=_0x2bb708[_0x9860('0x5a')];if(!_0x332e94['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x517b71['limit']=qs[_0x9860('0x24')](_0x332e94[_0x9860('0x43')]['limit']);_0x517b71[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x332e94[_0x9860('0x43')][_0x9860('0x23')]);}return _0x475cde[_0x9860('0xec')](_0x517b71);}})[_0x9860('0x14')](function(_0x595706){if(_0x595706){return _0x595706?{'count':_0x4b7fd6,'rows':_0x595706}:null;}})['then'](respondWithResult(_0x172f35,null))[_0x9860('0x1d')](handleError(_0x172f35,null));};exports[_0x9860('0xed')]=function(_0x467616,_0x56ebd8,_0xbd23db){var _0x331251;var _0x320085;var _0x212222;var _0x2f0071=!_[_0x9860('0x6a')](_0x467616[_0x9860('0x54')]['id'])?_0x467616[_0x9860('0x54')]['id']:!_['isNil'](_0x467616[_0x9860('0x2c')]['id'])?_0x467616[_0x9860('0x2c')]['id']:null;return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x2f0071,'role':{'$or':[_0x9860('0x2b'),_0x9860('0x2c'),_0x9860('0x74')]}},'attributes':['id',_0x9860('0x37'),_0x9860('0xee'),_0x9860('0xef'),_0x9860('0x27'),_0x9860('0x64'),_0x9860('0xa3')]})['then'](function(_0x28c96d){if(_0x28c96d){if(_0x28c96d[_0x9860('0x27')]==='agent'){_0x331251=_0x28c96d;if(_0x467616['body'][_0x9860('0xa5')]){_0x212222=util[_0x9860('0xcd')]('LOCAL/%s@from-sip/n',_0x331251[_0x467616[_0x9860('0x5f')][_0x9860('0xa5')]]);}else if(_0x467616[_0x9860('0x5f')]['intrf']){_0x212222=util[_0x9860('0xcd')](_0x9860('0xaf'),_0x467616[_0x9860('0x5f')][_0x9860('0xf0')]);}else{_0x212222=util[_0x9860('0xcd')]('SIP/%s',_0x331251[_0x9860('0x37')]);}socket['to'](util[_0x9860('0xcd')](_0x9860('0xf1'),_0x331251[_0x9860('0x37')]))[_0x9860('0x28')]('user:forcelogout',{'user':{'id':_0x331251['id'],'name':_0x331251[_0x9860('0x37')]},'ip':_0x467616[_0x9860('0xf2')]['x-forwarded-for']||_0x467616['connection'][_0x9860('0xf3')]||_0x467616['socket'][_0x9860('0xf3')]||_0x467616[_0x9860('0xf4')][_0x9860('0xf5')][_0x9860('0xf3')]});return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'membername':_0x331251[_0x9860('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0xf6'));}})['then'](function(){if(_0x331251){return _0x331251[_0x9860('0xf7')]({'raw':!![]});}})[_0x9860('0x14')](function(_0xdd1adc){if(_0x331251){if(_0xdd1adc){_0x320085=_0xdd1adc;if(_0x320085[_0x9860('0x5a')]){var _0x37e37f=_0x320085[_0x9860('0x31')](function(_0x3f8871){var _0x1a42b4={'membername':_0x331251[_0x9860('0x37')],'UserId':_0x331251['id'],'queue_name':_0x3f8871[_0x9860('0x37')],'VoiceQueueId':_0x3f8871['id'],'interface':_0x212222,'paused':_0x331251[_0x9860('0xa3')]||![],'penalty':_0x3f8871[_0x9860('0xf8')]||0x0};return db[_0x9860('0xb3')][_0x9860('0xf9')](_0x1a42b4);});return Promise[_0x9860('0x52')](_0x37e37f);}}}})[_0x9860('0x14')](function(){if(_0x331251){return db['MemberReport'][_0x9860('0x8f')]({'where':{'membername':_0x331251[_0x9860('0x37')],'exitAt':null}});}})[_0x9860('0x14')](function(_0xe83257){if(_0x331251){var _0x3c1c1f=[];_0xe83257[_0x9860('0xfa')](function(_0x196d4e){_0x3c1c1f[_0x9860('0x4b')](_0x196d4e[_0x9860('0x5e')]({'exitAt':moment()['format'](_0x9860('0xfb'))}));});return Promise[_0x9860('0x52')](_0x3c1c1f);}})[_0x9860('0x14')](function(){if(_0x331251){var _0x2b8500=[];var _0xcdeb38=[];var _0x5f3348=utils['getChannels']();var _0x39fc04={'membername':_0x331251[_0x9860('0x37')],'interface':_0x212222,'enterAt':moment()[_0x9860('0xcd')](_0x9860('0xfb')),'role':_0x331251['role'],'internal':_0x331251['internal']};_0x5f3348['forEach'](function(_0x1279a5){_0x2b8500['push'](_[_0x9860('0x5b')]({'channel':_0x1279a5,'type':_0x9860('0xfc'),'data1':_0x467616[_0x9860('0x5f')][_0x9860('0xfd')],'data2':_0x212222},_0x39fc04));if(_0x331251[_0x9860('0xa3')]){_0xcdeb38[_0x9860('0x4b')](_[_0x9860('0x5b')]({'channel':_0x1279a5,'type':_0x9860('0xfe'),'data1':'LOGININPAUSE'},_0x39fc04));}});return db[_0x9860('0xff')]['bulkCreate'](_0x2b8500[_0x9860('0xcc')](_0xcdeb38),{'individualHooks':!![]});}})[_0x9860('0x14')](function(){if(_0x331251){return _0x331251[_0x9860('0x5e')]({'online':!![],'lastLoginAt':moment()[_0x9860('0xcd')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x331251['loginInPause']||![],'mailPause':_0x331251[_0x9860('0xa3')]||![],'chatPause':_0x331251[_0x9860('0xa3')]||![],'faxPause':_0x331251[_0x9860('0xa3')]||![],'smsPause':_0x331251[_0x9860('0xa3')]||![],'openchannelPause':_0x331251[_0x9860('0xa3')]||![],'whatsappPause':_0x331251['loginInPause']||![],'pauseType':_0x331251['loginInPause']?_0x9860('0x100'):null,'interface':_0x212222,'lastPauseAt':moment()[_0x9860('0xcd')](_0x9860('0xfb'))});}})[_0x9860('0x14')](function(_0x1a3294){if(_0x467616['isMiddleware']){return _0xbd23db();}else{return Promise[_0x9860('0x101')](_0x1a3294)[_0x9860('0x14')](respondWithResult(_0x56ebd8,null));}})['catch'](handleError(_0x56ebd8,null));};exports[_0x9860('0x102')]=function(_0x25d553,_0x1bfc66){var _0x5950b1;return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x25d553[_0x9860('0x54')]['id'],'role':_0x9860('0x74')},'attributes':['id',_0x9860('0x37'),_0x9860('0x27')]})[_0x9860('0x14')](handleEntityNotFound(_0x1bfc66,null))[_0x9860('0x14')](function(_0x36a1b6){if(_0x36a1b6){_0x5950b1=_0x36a1b6;return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'membername':_0x5950b1[_0x9860('0x37')]},'individualHooks':!![]});}})[_0x9860('0x14')](function(){return db[_0x9860('0xff')][_0x9860('0x8f')]({'where':{'membername':_0x5950b1[_0x9860('0x37')],'exitAt':null}});})[_0x9860('0x14')](function(_0x29cf62){var _0x3faf08=[];_0x29cf62[_0x9860('0xfa')](function(_0xbeff25){_0x3faf08[_0x9860('0x4b')](_0xbeff25['update']({'exitAt':moment()[_0x9860('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x9860('0x52')](_0x3faf08);})[_0x9860('0x14')](function(){return _0x5950b1[_0x9860('0x5e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9860('0x14')](respondWithResult(_0x1bfc66,null))['catch'](handleError(_0x1bfc66,null));};exports[_0x9860('0x103')]=function(_0x50d171,_0x1fb645){var _0x1babb2;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x50d171['params']['id']},'individualHooks':!![]})[_0x9860('0x14')](function(){return db['User'][_0x9860('0x5d')]({'where':{'id':_0x50d171[_0x9860('0x54')]['id'],'role':'agent'},'attributes':['id',_0x9860('0x37'),'role',_0x9860('0x64'),_0x9860('0xa5'),_0x9860('0xa2')]});})['then'](handleEntityNotFound(_0x1fb645,null))[_0x9860('0x14')](function(_0x544803){if(_0x544803){_0x1babb2=_0x544803;return respondWithRpcPromise(_0x9860('0x104'),_0x9860('0x103'),{'id':_0x1babb2['id'],'name':_0x1babb2[_0x9860('0x37')],'pause':!![]});}})['then'](function(){if(_0x1babb2){return db[_0x9860('0xff')][_0x9860('0x8f')]({'where':{'membername':_0x1babb2[_0x9860('0x37')],'type':_0x9860('0xfe'),'exitAt':null}});}})['then'](function(_0x333566){if(_0x333566[_0x9860('0x5a')]){var _0x2ecd2b=moment()[_0x9860('0xcd')](_0x9860('0xfb'));for(var _0x265791=0x0,_0x53f040=_0x333566[_0x9860('0x5a')];_0x265791<_0x53f040;_0x265791++){_0x333566[_0x265791][_0x9860('0x105')]({'exitAt':_0x2ecd2b});}}})[_0x9860('0x14')](function(){var _0x9caab=[];var _0x4ea078=utils[_0x9860('0x106')]();_0x4ea078[_0x9860('0xfa')](function(_0x324675){_0x9caab['push']({'channel':_0x324675,'membername':_0x1babb2['name'],'interface':_['isNil'](_0x1babb2[_0x9860('0xa5')])?util[_0x9860('0xcd')]('SIP/%s',_0x1babb2[_0x9860('0x37')]):_0x1babb2[_0x9860('0xa5')],'type':'PAUSE','enterAt':moment()[_0x9860('0xcd')](_0x9860('0xfb')),'data1':_0x50d171[_0x9860('0x5f')][_0x9860('0x3d')]||_0x9860('0x107'),'role':_0x1babb2[_0x9860('0x27')],'internal':_0x1babb2['internal']});});return db[_0x9860('0xff')][_0x9860('0x8b')](_0x9caab,{'individualHooks':!![]});})[_0x9860('0x14')](function(){return _0x1babb2[_0x9860('0x5e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x50d171[_0x9860('0x5f')][_0x9860('0x3d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x9860('0xfb'))});})['then'](respondWithResult(_0x1fb645,null))['catch'](handleError(_0x1fb645,null));};exports[_0x9860('0x108')]=function(_0x3e8e82,_0x368226){if(_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')]&&!utils['isValidChannel'](_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')])){throw new APIBadRequestError(util[_0x9860('0xcd')](_0x9860('0x109'),_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')]));}return db[_0x9860('0x3a')]['find']({'where':{'id':_0x3e8e82[_0x9860('0x54')]['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27'),_0x9860('0x64'),'interface',_0x9860('0xa2'),'voicePause','mailPause',_0x9860('0x10a'),_0x9860('0x10b'),_0x9860('0x10c'),_0x9860('0x10d'),_0x9860('0x10e'),_0x9860('0x10f'),_0x9860('0x110')]})[_0x9860('0x14')](function(_0x1462bf){if(!_0x1462bf){throw new APINotFoundError(util[_0x9860('0xcd')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3e8e82[_0x9860('0x54')]['id']));}return _0x1462bf[_0x9860('0x108')](_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')]);})[_0x9860('0x14')](respondWithResult(_0x368226,null))[_0x9860('0x1d')](APIHandleError(_0x368226));};exports[_0x9860('0x111')]=function(_0x51160c,_0x3305ee){var _0x50daed={};var _0x4c241d={};var _0x5a8220;var _0x1d5067;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x51160c['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x3305ee,null))[_0x9860('0x14')](function(_0x2a2198){if(_0x2a2198){_0x5a8220=_0x2a2198;_0x4c241d[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0x112')]['rawAttributes']);_0x4c241d['query']=_['keys'](_0x51160c[_0x9860('0x43')]);_0x4c241d['filters']=_['intersection'](_0x4c241d[_0x9860('0x55')],_0x4c241d[_0x9860('0x43')]);_0x50daed[_0x9860('0x48')]=_[_0x9860('0x58')](_0x4c241d[_0x9860('0x55')],qs['fields'](_0x51160c[_0x9860('0x43')][_0x9860('0x59')]));_0x50daed['attributes']=_0x50daed[_0x9860('0x48')]['length']?_0x50daed[_0x9860('0x48')]:_0x4c241d[_0x9860('0x55')];_0x50daed[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x51160c[_0x9860('0x43')][_0x9860('0xd6')]);_0x50daed['where']=qs['filters'](_[_0x9860('0xd7')](_0x51160c['query'],_0x4c241d['filters']));if(_0x51160c[_0x9860('0x43')][_0x9860('0x2f')]){_0x50daed[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x50daed[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x50daed[_0x9860('0x48')],function(_0x1af20d){var _0x1f7531={};_0x1f7531[_0x1af20d]={'$like':'%'+_0x51160c[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x1f7531;})});}_0x50daed=_[_0x9860('0x5b')]({},_0x50daed,_0x51160c[_0x9860('0x5c')]);return _0x5a8220['getTeams'](_0x50daed);}})[_0x9860('0x14')](function(_0x332be3){if(_0x332be3){_0x1d5067=_0x332be3['length'];if(!_0x51160c[_0x9860('0x43')]['hasOwnProperty'](_0x9860('0xda'))){_0x50daed['limit']=qs['limit'](_0x51160c[_0x9860('0x43')][_0x9860('0x24')]);_0x50daed['offset']=qs[_0x9860('0x23')](_0x51160c[_0x9860('0x43')][_0x9860('0x23')]);}return _0x5a8220['getTeams'](_0x50daed);}})['then'](function(_0x5ee515){if(_0x5ee515){return _0x5ee515?{'count':_0x1d5067,'rows':_0x5ee515}:null;}})[_0x9860('0x14')](respondWithResult(_0x3305ee,null))[_0x9860('0x1d')](handleError(_0x3305ee,null));};exports[_0x9860('0x113')]=function(_0x6d5cb6,_0xcc3895){var _0x29016a=_0x6d5cb6[_0x9860('0x54')]['id'];var _0x4c7929=_0x6d5cb6['body']?_0x6d5cb6[_0x9860('0x5f')]['ids']:null;var _0x45c691=[];return Promise[_0x9860('0x101')]()[_0x9860('0x14')](function(){if(!_0x4c7929)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x9860('0x14')](function(){return db['User'][_0x9860('0x9b')]({'where':{'id':_0x29016a}});})[_0x9860('0x14')](function(_0x25a30a){if(!_0x25a30a)throw new APINotFoundError(util['format'](_0x9860('0x114'),_0x6d5cb6[_0x9860('0x54')]['id']));return db['sequelize'][_0x9860('0x115')](function(_0x59cf87){return _0x25a30a[_0x9860('0x113')](_0x4c7929,{'transaction':_0x59cf87})[_0x9860('0x14')](function(){return db['Team'][_0x9860('0x8f')]({'where':{'id':{'$in':_0x4c7929}}});})[_0x9860('0x14')](function(_0x430847){var _0x1b3e58=_[_0x9860('0x31')](_0x430847,function(_0x25ce83){return _0x25ce83['getAssociatedQueues']();});return Promise[_0x9860('0x52')](_0x1b3e58);})[_0x9860('0x14')](function(_0x2ab8ca){_0x45c691=_[_0x9860('0x116')](_0x2ab8ca);var _0xa335e5=_[_0x9860('0x31')](_0x45c691,function(_0x120a66){return _0x120a66[_0x9860('0x117')](_0x25a30a['id'],{'transaction':_0x59cf87});});return Promise[_0x9860('0x52')](_0xa335e5);})['then'](function(){if(!_0x25a30a['online'])return;var _0x576f9c=_[_0x9860('0x2f')](_0x45c691,function(_0x206ede){return _0x206ede[_0x9860('0x118')](_0x9860('0xa1'))===_0x9860('0x119');});var _0x7fe600=_[_0x9860('0x31')](_0x576f9c,function(_0x150c79){return db['UserVoiceQueueRt'][_0x9860('0xf9')]({'membername':_0x25a30a['name'],'UserId':_0x25a30a['id'],'queue_name':_0x150c79[_0x9860('0x37')],'VoiceQueueId':_0x150c79['id'],'interface':_[_0x9860('0x6a')](_0x25a30a[_0x9860('0xa5')])?util[_0x9860('0xcd')](_0x9860('0xaf'),_0x25a30a[_0x9860('0x37')]):_0x25a30a[_0x9860('0xa5')],'paused':_0x25a30a['voicePause']||![],'penalty':_0x25a30a[_0x9860('0xb0')]},{'transaction':_0x59cf87});});return Promise[_0x9860('0x52')](_0x7fe600);})[_0x9860('0x14')](function(){return db[_0x9860('0x11a')][_0x9860('0x8f')]({'where':{'teamId':{'$in':_0x4c7929}}});})[_0x9860('0x14')](function(_0x126aa9){var _0x58c503=_[_0x9860('0x31')](_0x126aa9,function(_0xfeafe9){return db[_0x9860('0x11b')][_0x9860('0x82')]({'UserId':_0x25a30a['id'],'VoicePrefixId':_0xfeafe9[_0x9860('0x11c')]},{'transaction':_0x59cf87});});return Promise[_0x9860('0x52')](_0x58c503);});});})[_0x9860('0x14')](function(){for(var _0x3e7777=0x0;_0x3e7777<_0x45c691[_0x9860('0x5a')];_0x3e7777++){var _0x897ad4=_0x45c691[_0x3e7777][_0x9860('0x118')]('channel');var _0x2eac9a=_0x897ad4+_0x9860('0xb1');socket[_0x9860('0x28')](_0x9860('0x2c')+_0x897ad4+_0x9860('0xad'),{'UserId':_0x29016a,['queueField']:_0x45c691[_0x3e7777]['id']});}})[_0x9860('0x14')](respondWithStatusCode(_0xcc3895,null))[_0x9860('0x1d')](APIHandleError(_0xcc3895));};exports[_0x9860('0x11d')]=function(_0x5ec06c,_0x1f1e6f){var _0x57cdf0=_0x5ec06c[_0x9860('0x54')]['id'];var _0x29f932=null;if(_0x5ec06c['query'][_0x9860('0x62')]){_0x29f932=_[_0x9860('0x11e')](_0x5ec06c[_0x9860('0x43')]['ids'])?_0x5ec06c[_0x9860('0x43')][_0x9860('0x62')]:[_0x5ec06c[_0x9860('0x43')]['ids']];}var _0x51a870=[];return Promise['resolve']()['then'](function(){if(!_0x29f932)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x9860('0x14')](function(){return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x57cdf0}});})[_0x9860('0x14')](function(_0x44a6cb){if(!_0x44a6cb)throw new APINotFoundError(util[_0x9860('0xcd')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5ec06c[_0x9860('0x54')]['id']));return db[_0x9860('0x6c')][_0x9860('0x115')](function(_0x1c8e9b){return _0x44a6cb[_0x9860('0x11d')](_0x29f932,{'transaction':_0x1c8e9b})[_0x9860('0x14')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x29f932}}});})['then'](function(_0x54b92b){var _0x47dac7=_[_0x9860('0x31')](_0x54b92b,function(_0x5dda75){return _0x5dda75[_0x9860('0x11f')]();});return Promise[_0x9860('0x52')](_0x47dac7);})[_0x9860('0x14')](function(_0x38a931){_0x51a870=_[_0x9860('0x116')](_0x38a931);var _0x4e0cd8=_['map'](_0x51a870,function(_0x1b16c3){return _0x1b16c3[_0x9860('0x120')](_0x44a6cb['id'],{'transaction':_0x1c8e9b});});return Promise[_0x9860('0x52')](_0x4e0cd8);})[_0x9860('0x14')](function(){if(!_0x44a6cb[_0x9860('0xa2')])return;var _0x307e0c=_['filter'](_0x51a870,function(_0x1118ec){return _0x1118ec[_0x9860('0x118')](_0x9860('0xa1'))===_0x9860('0x119');});var _0x12a8bf=_[_0x9860('0x31')](_0x307e0c,function(_0xf9b057){return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'VoiceQueueId':_0xf9b057['id'],'UserId':_0x44a6cb['id']},'transaction':_0x1c8e9b});});return Promise[_0x9860('0x52')](_0x12a8bf);})[_0x9860('0x14')](function(){return db[_0x9860('0x11a')][_0x9860('0x8f')]({'where':{'teamId':{'$in':_0x29f932}}});})[_0x9860('0x14')](function(_0x224739){var _0x161bb6=_[_0x9860('0x31')](_0x224739,function(_0x26ea54){return db[_0x9860('0x11b')][_0x9860('0x35')]({'where':{'UserId':_0x44a6cb['id'],'VoicePrefixId':_0x26ea54['VoicePrefixId']}},{'transaction':_0x1c8e9b});});return Promise[_0x9860('0x52')](_0x161bb6);});});})[_0x9860('0x14')](function(){for(var _0x49cf7c=0x0;_0x49cf7c<_0x51a870[_0x9860('0x5a')];_0x49cf7c++){var _0x885daf=_0x51a870[_0x49cf7c][_0x9860('0x118')](_0x9860('0xa1'));var _0x5650c5=_0x885daf+_0x9860('0xb1');socket['emit'](_0x9860('0x2c')+_0x885daf+'Queue:remove',{'UserId':_0x57cdf0,['queueField']:_0x51a870[_0x49cf7c]['id']});}})[_0x9860('0x14')](respondWithStatusCode(_0x1f1e6f,null))[_0x9860('0x1d')](APIHandleError(_0x1f1e6f));};exports['getLists']=function(_0x34f89f,_0x160029){var _0x110e7f={};var _0x5905af={};var _0x550c22;var _0x1f6b20;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x34f89f[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x160029,null))[_0x9860('0x14')](function(_0x42d2c1){if(_0x42d2c1){_0x550c22=_0x42d2c1;_0x5905af[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xce')]['rawAttributes']);_0x5905af[_0x9860('0x43')]=_['keys'](_0x34f89f[_0x9860('0x43')]);_0x5905af[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x5905af['model'],_0x5905af[_0x9860('0x43')]);_0x110e7f['attributes']=_[_0x9860('0x58')](_0x5905af[_0x9860('0x55')],qs[_0x9860('0x59')](_0x34f89f[_0x9860('0x43')]['fields']));_0x110e7f[_0x9860('0x48')]=_0x110e7f['attributes'][_0x9860('0x5a')]?_0x110e7f[_0x9860('0x48')]:_0x5905af[_0x9860('0x55')];_0x110e7f['order']=qs['sort'](_0x34f89f[_0x9860('0x43')]['sort']);_0x110e7f[_0x9860('0x42')]=qs['filters'](_[_0x9860('0xd7')](_0x34f89f[_0x9860('0x43')],_0x5905af[_0x9860('0xd4')]));if(_0x34f89f[_0x9860('0x43')][_0x9860('0x2f')]){_0x110e7f[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x110e7f[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x110e7f[_0x9860('0x48')],function(_0xa4c21e){var _0x26153d={};_0x26153d[_0xa4c21e]={'$like':'%'+_0x34f89f['query'][_0x9860('0x2f')]+'%'};return _0x26153d;})});}_0x110e7f=_['merge']({},_0x110e7f,_0x34f89f['options']);return _0x550c22[_0x9860('0x121')](_0x110e7f);}})[_0x9860('0x14')](function(_0x48afc5){if(_0x48afc5){_0x1f6b20=_0x48afc5['length'];if(!_0x34f89f[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x110e7f[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x34f89f[_0x9860('0x43')][_0x9860('0x24')]);_0x110e7f[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x34f89f[_0x9860('0x43')][_0x9860('0x23')]);}return _0x550c22[_0x9860('0x121')](_0x110e7f);}})['then'](function(_0x2e4bae){if(_0x2e4bae){return _0x2e4bae?{'count':_0x1f6b20,'rows':_0x2e4bae}:null;}})[_0x9860('0x14')](respondWithResult(_0x160029,null))['catch'](handleError(_0x160029,null));};exports['getAgents']=function(_0x2958fe,_0x314bbe){var _0x10a6df={};var _0x30c024={};var _0x116826;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x2958fe[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x314bbe,null))[_0x9860('0x14')](function(_0x4bbdef){if(_0x4bbdef){_0x116826=_0x4bbdef;_0x30c024['model']=_[_0x9860('0x57')](db[_0x9860('0x3a')][_0x9860('0x3b')]);_0x30c024[_0x9860('0x43')]=_[_0x9860('0x57')](_0x2958fe[_0x9860('0x43')]);_0x30c024[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x30c024[_0x9860('0x55')],_0x30c024[_0x9860('0x43')]);_0x10a6df[_0x9860('0x48')]=_['intersection'](_0x30c024[_0x9860('0x55')],qs[_0x9860('0x59')](_0x2958fe[_0x9860('0x43')]['fields']));_0x10a6df[_0x9860('0x48')]=_0x10a6df[_0x9860('0x48')][_0x9860('0x5a')]?_0x10a6df[_0x9860('0x48')]:_0x30c024['model'];_0x10a6df[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x2958fe[_0x9860('0x43')][_0x9860('0xd6')]);_0x10a6df[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x2958fe[_0x9860('0x43')],_0x30c024[_0x9860('0xd4')]));if(_0x2958fe[_0x9860('0x43')]['filter']){_0x10a6df[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x10a6df[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x10a6df['attributes'],function(_0x5491d8){var _0x2c47f4={};_0x2c47f4[_0x5491d8]={'$like':'%'+_0x2958fe[_0x9860('0x43')]['filter']+'%'};return _0x2c47f4;})});}_0x10a6df['model']=db[_0x9860('0x3a')];_0x10a6df['as']='Agents';_0x10a6df=_[_0x9860('0x5b')]({},_0x10a6df,_0x2958fe[_0x9860('0x5c')]);return _0x116826['getVoiceQueues']({'include':[_0x10a6df]});}})[_0x9860('0x14')](function(_0xa99a3){if(_0xa99a3){var _0x549037={},_0x3b529f=[];for(var _0x5e525f=0x0;_0x5e525f<_0xa99a3[_0x9860('0x5a')];_0x5e525f+=0x1){for(var _0x111640=0x0,_0xd42099;_0x111640<_0xa99a3[_0x5e525f][_0x9860('0x90')]['length'];_0x111640+=0x1){_0xd42099=_0xa99a3[_0x5e525f][_0x9860('0x90')][_0x111640][_0x9860('0x2a')]({'plain':!![]});_0x549037[_0xd42099['id']]=_0xd42099;}}_0x549037=_['values'](_0x549037);for(var _0x279cb7=qs[_0x9860('0x23')](_0x2958fe[_0x9860('0x43')][_0x9860('0x23')]);_0x279cb7<_0x549037[_0x9860('0x5a')]&&_0x3b529f['length']=_0x198af9){_0x1b7c4a=_0x198af9;_0x243219=0xc8;}else{_0x243219=0xce;}_0x19a545[_0x07e6('0x25')](_0x243219);return _0x19a545['set'](_0x07e6('0x26'),_0xd07dce+'-'+_0x1b7c4a+'/'+_0x198af9)[_0x07e6('0x20')](_0x58f501);}return null;};}function saveUpdates(_0x1dc693){return function(_0x5e079b){if(_0x5e079b){return _0x5e079b[_0x07e6('0x27')](_0x1dc693)[_0x07e6('0x14')](function(_0xaf6de0){if(_0xaf6de0['role']===_0x07e6('0x28')){socket[_0x07e6('0x29')](_0x07e6('0x2a')+_0xaf6de0['id'],_0xaf6de0);}return _0xaf6de0;});}return null;};}function removeEntity(_0x54b450){return function(_0x28f4fa){if(_0x28f4fa){return _0x28f4fa['destroy']()['then'](function(){var _0x376c9b=_0x28f4fa[_0x07e6('0x2b')]({'plain':!![]});if(_0x376c9b[_0x07e6('0x2c')]===_0x07e6('0x2d'))return;var _0x3b0d68=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x07e6('0x2e'),'value':_0x07e6('0x28'),'ignore':![]},{'name':_0x07e6('0x2f'),'value':'telephone','ignore':![]}];var _0x1425ab=_(_0x3b0d68)[_0x07e6('0x30')](_0x07e6('0x31'))[_0x07e6('0x32')](_0x07e6('0x33'))['value']();if(_[_0x07e6('0x34')](_0x1425ab,_0x376c9b['role'])){return;}var _0x17b9dc=_[_0x07e6('0x35')](_0x3b0d68,[_0x07e6('0x33'),_0x376c9b[_0x07e6('0x2c')]])[_0x07e6('0x36')];return db[_0x07e6('0x37')][_0x07e6('0x38')]({'where':{'type':_0x17b9dc,'resourceId':_0x376c9b['id']}})[_0x07e6('0x14')](function(){return _0x28f4fa;});})[_0x07e6('0x14')](function(){_0x54b450[_0x07e6('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8230){return function(_0x3b2bf2){if(!_0x3b2bf2){_0x4f8230[_0x07e6('0x1e')](0x194);}return _0x3b2bf2;};}function handleError(_0x40168e,_0x182b99){_0x182b99=_0x182b99||0x1f4;return function(_0x208569){logger[_0x07e6('0x18')](_0x208569[_0x07e6('0x39')]);if(_0x208569[_0x07e6('0x36')]){delete _0x208569[_0x07e6('0x36')];}_0x40168e[_0x07e6('0x25')](_0x182b99)[_0x07e6('0x3a')](_0x208569);};}exports['index']=function(_0x28bb5c,_0x235e3b){var _0x2ae63e={},_0x1519a3={'count':0x0,'rows':[]};var _0x1dbff4=_(db[_0x07e6('0x3b')][_0x07e6('0x3c')])[_0x07e6('0x32')](function(_0x2f0089){return{'name':_0x2f0089['fieldName'],'type':_0x2f0089[_0x07e6('0x3d')][_0x07e6('0x3e')]};})[_0x07e6('0x30')](function(_0x50c452){return!_[_0x07e6('0x34')]([_0x07e6('0x3f'),_0x07e6('0x40')],_0x50c452[_0x07e6('0x36')]);})[_0x07e6('0x33')]();_0x2ae63e=qs[_0x07e6('0x41')](_0x1dbff4,_0x28bb5c);var _0x455248={'where':_0x2ae63e[_0x07e6('0x42')]};return db[_0x07e6('0x3b')]['count'](_0x455248)['then'](function(_0x39cc50){_0x1519a3[_0x07e6('0x24')]=_0x39cc50;if(_0x28bb5c[_0x07e6('0x43')]['includeAll']){_0x2ae63e['include']=[{'all':!![]}];}if(_0x28bb5c[_0x07e6('0x43')][_0x07e6('0x44')]==='true'){_0x2ae63e['include']=[{'model':db[_0x07e6('0x45')],'as':_0x07e6('0x44')}];}if(!_[_0x07e6('0x34')](_0x2ae63e[_0x07e6('0x46')],'id')){_0x2ae63e[_0x07e6('0x46')]['push']('id');}return db[_0x07e6('0x3b')][_0x07e6('0x47')](_0x2ae63e);})['then'](function(_0x351f5f){_0x1519a3[_0x07e6('0x48')]=_0x351f5f;if(_0x28bb5c['query'][_0x07e6('0x49')]==='true'){var _0x2b2f1f=[];for(var _0x32bacb=0x0;_0x32bacb<_0x1519a3[_0x07e6('0x48')][_0x07e6('0x4a')];_0x32bacb++){_0x2b2f1f[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x4c'),_0x1519a3[_0x07e6('0x48')][_0x32bacb][_0x07e6('0x4d')]));_0x2b2f1f[_0x07e6('0x4b')](get_open_tabs('sms',_0x1519a3[_0x07e6('0x48')][_0x32bacb][_0x07e6('0x4d')]));_0x2b2f1f[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x4e'),_0x1519a3['rows'][_0x32bacb][_0x07e6('0x4d')]));_0x2b2f1f['push'](get_open_tabs(_0x07e6('0x4f'),_0x1519a3[_0x07e6('0x48')][_0x32bacb][_0x07e6('0x4d')]));_0x2b2f1f[_0x07e6('0x4b')](get_open_tabs('openchannel',_0x1519a3[_0x07e6('0x48')][_0x32bacb][_0x07e6('0x4d')]));_0x2b2f1f[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x50'),_0x1519a3[_0x07e6('0x48')][_0x32bacb][_0x07e6('0x4d')]));}return Promise['all'](_0x2b2f1f)[_0x07e6('0x14')](function(){return _0x1519a3;});}else{return _0x1519a3;}})[_0x07e6('0x14')](respondWithFilteredResult(_0x235e3b,_0x2ae63e))[_0x07e6('0x1d')](handleError(_0x235e3b,null));};exports['show']=function(_0x300cd1,_0xe960bf){var _0x4b445a={'raw':![],'where':{'id':_0x300cd1[_0x07e6('0x51')]['id']}},_0x2c585b={};_0x2c585b['model']=_[_0x07e6('0x52')](_[_0x07e6('0x53')](db[_0x07e6('0x3b')][_0x07e6('0x3c')]),[_0x07e6('0x3f'),'salt']);_0x2c585b[_0x07e6('0x43')]=_['keys'](_0x300cd1['query']);_0x2c585b[_0x07e6('0x54')]=_[_0x07e6('0x55')](_0x2c585b[_0x07e6('0x56')],_0x2c585b[_0x07e6('0x43')]);_0x4b445a['attributes']=_['intersection'](_0x2c585b[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0x300cd1[_0x07e6('0x43')][_0x07e6('0x57')]));_0x4b445a[_0x07e6('0x46')]=_0x4b445a[_0x07e6('0x46')][_0x07e6('0x4a')]?_0x4b445a[_0x07e6('0x46')]:_0x2c585b[_0x07e6('0x56')];if(_0x300cd1[_0x07e6('0x43')][_0x07e6('0x58')]){_0x4b445a['include']=[{'all':!![]}];}if(_0x300cd1[_0x07e6('0x43')][_0x07e6('0x44')]===_0x07e6('0x59')){_0x4b445a[_0x07e6('0x5a')]=[{'model':db[_0x07e6('0x45')],'as':_0x07e6('0x44')}];}_0x4b445a=_[_0x07e6('0x5b')]({},_0x4b445a,_0x300cd1[_0x07e6('0x5c')]);if(!_[_0x07e6('0x34')](_0x4b445a[_0x07e6('0x46')],'id')){_0x4b445a[_0x07e6('0x46')][_0x07e6('0x4b')]('id');}return db[_0x07e6('0x3b')][_0x07e6('0x35')](_0x4b445a)['then'](handleEntityNotFound(_0xe960bf,null))[_0x07e6('0x14')](function(_0x101deb){var _0xa17647=[];values=_0x101deb;if(_0x300cd1[_0x07e6('0x43')][_0x07e6('0x49')]==='true'){_0xa17647[_0x07e6('0x4b')](get_open_tabs('chat',_0x101deb[_0x07e6('0x4d')]));_0xa17647[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x5d'),_0x101deb[_0x07e6('0x4d')]));_0xa17647[_0x07e6('0x4b')](get_open_tabs('openchannel',_0x101deb[_0x07e6('0x4d')]));_0xa17647[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x50'),_0x101deb['dataValues']));_0xa17647[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x4e'),_0x101deb['dataValues']));_0xa17647[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x4f'),_0x101deb[_0x07e6('0x4d')]));return Promise[_0x07e6('0x5e')](_0xa17647);}else{return values;}})[_0x07e6('0x14')](function(){return values;})[_0x07e6('0x14')](respondWithResult(_0xe960bf,null))[_0x07e6('0x1d')](handleError(_0xe960bf,null));};exports[_0x07e6('0x27')]=function(_0x5c7eaf,_0x581bba){if(_0x5c7eaf[_0x07e6('0x5f')]['id']){delete _0x5c7eaf[_0x07e6('0x5f')]['id'];}delete _0x5c7eaf[_0x07e6('0x5f')]['role'];return db[_0x07e6('0x3b')]['find']({'where':{'id':_0x5c7eaf['params']['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x581bba,null))[_0x07e6('0x14')](saveUpdates(_0x5c7eaf[_0x07e6('0x5f')],null))[_0x07e6('0x14')](respondWithResult(_0x581bba,null))[_0x07e6('0x1d')](handleError(_0x581bba,null));};exports['describe']=function(_0xcd51c4,_0x5863c8){return db['User'][_0x07e6('0x60')]()[_0x07e6('0x14')](respondWithResult(_0x5863c8,null))['catch'](handleError(_0x5863c8,null));};exports[_0x07e6('0x61')]=function(_0x1aa39a,_0xd770ee){return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0x1aa39a[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0xd770ee,null))[_0x07e6('0x14')](function(_0x30d3a1){if(_0x30d3a1){return _0x30d3a1[_0x07e6('0x61')](_0x1aa39a[_0x07e6('0x5f')][_0x07e6('0x62')],_['omit'](_0x1aa39a[_0x07e6('0x5f')],[_0x07e6('0x62'),'id'])||{});}})[_0x07e6('0x14')](respondWithResult(_0xd770ee,null))[_0x07e6('0x1d')](handleError(_0xd770ee,null));};function validateUser(_0xde0bbe){return new Promise(function(_0x140386,_0x29e2f7){if(_0xde0bbe['internal'])return _0x140386(_0xde0bbe);return db[_0x07e6('0x63')][_0x07e6('0x64')](0x1)[_0x07e6('0x14')](function(_0x3a41f8){if(_0x3a41f8[_0x07e6('0x65')])authService[_0x07e6('0x66')](_0xde0bbe[_0x07e6('0x3f')]);db[_0x07e6('0x3b')][_0x07e6('0x67')]('internal')['then'](function(_0xc277cc){if(_['isNil'](_0xc277cc)){_0xde0bbe['internal']=_0x3a41f8[_0x07e6('0x68')]||0x1;return;}if(_['isNil'](_0x3a41f8[_0x07e6('0x68')])||_0x3a41f8['min_internal']===_0xc277cc){_0xde0bbe[_0x07e6('0x69')]=_0xc277cc+0x1;return;}if(_0x3a41f8['min_internal']>_0xc277cc){_0xde0bbe['internal']=_0x3a41f8[_0x07e6('0x68')];return;}return db[_0x07e6('0x6a')][_0x07e6('0x43')](_0x07e6('0x6b'),{'type':db[_0x07e6('0x6a')]['QueryTypes'][_0x07e6('0x6c')]})[_0x07e6('0x14')](function(_0x2e4342){if(_0x2e4342&&_0x2e4342[_0x07e6('0x4a')]){for(var _0x142f30=0x0,_0x43b847=_0x2e4342['length'];_0x142f30<_0x43b847&&_['isNil'](_0xde0bbe[_0x07e6('0x69')]);_0x142f30++){if(_0x3a41f8['min_internal']<=_0x2e4342[_0x142f30][_0x07e6('0x6d')]){_0xde0bbe[_0x07e6('0x69')]=_0x2e4342[_0x142f30][_0x07e6('0x6d')];}else if(_0x3a41f8[_0x07e6('0x68')]>_0x2e4342[_0x142f30][_0x07e6('0x6d')]&&_0x3a41f8[_0x07e6('0x68')]<=_0x2e4342[_0x142f30]['to']){_0xde0bbe['internal']=_0x3a41f8[_0x07e6('0x68')];}}}if(_[_0x07e6('0x6e')](_0xde0bbe[_0x07e6('0x69')])){_0xde0bbe['internal']=_0xc277cc+0x1;}return _0x140386(_0xde0bbe);});});})[_0x07e6('0x1d')](function(_0x3fec9a){_0x29e2f7(_0x3fec9a);});});}function updateUser(_0x149037){return new Promise(function(_0x3c2507,_0x3df408){try{if(_0x149037['voicemail']){_0x149037['mailbox']=_0x149037[_0x07e6('0x69')];_0x149037[_0x07e6('0x6f')]={'mailbox':_0x149037[_0x07e6('0x69')],'password':_0x149037[_0x07e6('0x3f')],'fullname':_0x149037[_0x07e6('0x70')],'email':_0x149037['email']};}if(_0x149037[_0x07e6('0x2c')]==='agent'){if(!_0x149037[_0x07e6('0x71')])_0x149037[_0x07e6('0x71')]=[_0x07e6('0x72'),_0x07e6('0x73'),_0x07e6('0x74'),_0x07e6('0x75'),_0x07e6('0x76'),_0x07e6('0x77'),_0x07e6('0x78'),'106',_0x07e6('0x79'),_0x07e6('0x7a'),'109',_0x07e6('0x7b'),_0x07e6('0x7c'),_0x07e6('0x7d'),_0x07e6('0x7e')];}_0x3c2507(_0x149037);}catch(_0xabf16d){_0x3df408(_0xabf16d);}});}exports['create']=function(_0x32011e,_0x272dca){if(_0x32011e[_0x07e6('0x7f')]['role']===_0x07e6('0x28'))throw new Error(_0x07e6('0x80'));if(_0x32011e['body'][_0x07e6('0x2c')]===_0x07e6('0x7f')&&_0x32011e[_0x07e6('0x7f')][_0x07e6('0x2c')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x32011e[_0x07e6('0x5f')][_0x07e6('0x2c')]===_0x07e6('0x2d')&&_0x32011e['user']['role']!==_0x07e6('0x2d')){throw new Error(_0x07e6('0x81'));}return licenseUtil[_0x07e6('0x82')]([_0x32011e[_0x07e6('0x5f')]])['then'](function(){return validateUser(_0x32011e[_0x07e6('0x5f')]);})['then'](function(_0x111aa5){return updateUser(_0x111aa5)[_0x07e6('0x14')](function(_0x2ec504){if(_0x2ec504[_0x07e6('0x2c')]==='admin'){_0x2ec504['settingsEnabled']=_0x32011e[_0x07e6('0x7f')][_0x07e6('0x83')];delete _0x2ec504['userProfileId'];}return _0x2ec504;});})['then'](function(_0x5eae07){return db[_0x07e6('0x3b')][_0x07e6('0x84')](_0x5eae07,{'include':[{'model':db[_0x07e6('0x6f')],'as':_0x07e6('0x6f')}]});})[_0x07e6('0x14')](function(_0x435ea9){if(_0x32011e[_0x07e6('0x5f')][_0x07e6('0x2c')]===_0x07e6('0x7f'))return _0x435ea9;if(_0x32011e[_0x07e6('0x7f')][_0x07e6('0x2c')]!==_0x07e6('0x7f'))return _0x435ea9;return db['UserProfileSection'][_0x07e6('0x35')]({'where':{'name':_0x435ea9['role']===_0x07e6('0x28')?'Agents':_0x07e6('0x2f'),'userProfileId':_0x32011e[_0x07e6('0x7f')]['userProfileId']},'raw':!![]})[_0x07e6('0x14')](function(_0x2b819b){if(!_0x2b819b||_0x2b819b[_0x07e6('0x85')]!=0x0)return _0x435ea9;return db[_0x07e6('0x37')]['create']({'name':_0x435ea9[_0x07e6('0x36')],'resourceId':_0x435ea9['id'],'type':_0x2b819b['name'],'sectionId':_0x2b819b['id']},{})[_0x07e6('0x14')](function(){return _0x435ea9;});})['catch'](function(_0x13b747){logger[_0x07e6('0x18')](_0x07e6('0x86'),_0x13b747);throw _0x13b747;});})['then'](respondWithResult(_0x272dca,0xc9))[_0x07e6('0x1d')](handleError(_0x272dca,null));};exports[_0x07e6('0x87')]=function(_0x100f73,_0x4666dd){var _0x167e90=_0x100f73[_0x07e6('0x5f')];var _0x5cce46=[];if(_0x100f73[_0x07e6('0x7f')][_0x07e6('0x2c')]===_0x07e6('0x28'))throw new Error(_0x07e6('0x80'));if(_[_0x07e6('0x88')](_0x167e90,[_0x07e6('0x2c'),'user'])&&_0x100f73[_0x07e6('0x7f')][_0x07e6('0x2c')]!==_0x07e6('0x2d')){throw new Error(_0x07e6('0x89'));}if(_[_0x07e6('0x88')](_0x167e90,['role',_0x07e6('0x2d')])&&_0x100f73[_0x07e6('0x7f')][_0x07e6('0x2c')]!==_0x07e6('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x07e6('0x82')](_0x167e90)[_0x07e6('0x14')](function(){return validateUser(_0x167e90[0x0]);})[_0x07e6('0x14')](function(){for(var _0x308c99=0x1;_0x308c99<_0x167e90[_0x07e6('0x4a')];_0x308c99++){var _0x3e5961=_0x167e90[_0x308c99-0x1][_0x07e6('0x69')];if(!_0x167e90[_0x308c99]['internal'])_0x167e90[_0x308c99][_0x07e6('0x69')]=_0x3e5961+0x1;_0x5cce46[_0x07e6('0x4b')](validateUser(_0x167e90[_0x308c99]));}return Promise[_0x07e6('0x5e')](_0x5cce46);})['then'](function(){_0x5cce46=[];for(var _0x4b9991=0x0;_0x4b9991<_0x167e90['length'];_0x4b9991++){_0x5cce46[_0x07e6('0x4b')](updateUser(_0x167e90[_0x4b9991]));}return Promise[_0x07e6('0x5e')](_0x5cce46);})[_0x07e6('0x14')](function(){_0x5cce46=_0x167e90[_0x07e6('0x32')](function(_0x197611){return db[_0x07e6('0x3b')]['create'](_0x197611,{'include':[{'model':db[_0x07e6('0x6f')],'as':_0x07e6('0x6f')}]})[_0x07e6('0x14')](function(_0x3848d6){_0x197611['id']=_0x3848d6['id'];return _0x197611;});});return Promise['all'](_0x5cce46);})['then'](function(_0x11f087){if(_0x100f73[_0x07e6('0x5f')][_0x07e6('0x2c')]===_0x07e6('0x7f'))return _0x11f087;if(_0x100f73[_0x07e6('0x7f')][_0x07e6('0x2c')]!==_0x07e6('0x7f'))return _0x11f087;var _0x7e8a80=_[_0x07e6('0x88')](_0x11f087,function(_0xd12f88){return _0xd12f88[_0x07e6('0x2c')]===_0x07e6('0x28')||_0xd12f88[_0x07e6('0x2c')]===_0x07e6('0x8a');});if(!_0x7e8a80)return _0x11f087;return db[_0x07e6('0x8b')][_0x07e6('0x47')]({'where':{'name':{'$or':['Agents',_0x07e6('0x2f')]},'userProfileId':_0x100f73['user'][_0x07e6('0x8c')]},'raw':!![]})[_0x07e6('0x14')](function(_0x4831d7){if(_[_0x07e6('0x8d')](_0x4831d7)||!_[_0x07e6('0x88')](_0x4831d7,['autoAssociation',0x0]))return _0x11f087;_0x5cce46=[];var _0x419676=_(_0x4831d7)['map'](function(_0x35a3aa){if(_0x35a3aa[_0x07e6('0x85')]===0x1)return;return _0x35a3aa['name']===_0x07e6('0x2e')?'agent':_0x07e6('0x8a');})['compact']()['value']();for(var _0x49c41f=0x0;_0x49c41f<_0x11f087['length'];_0x49c41f++){if(!_[_0x07e6('0x34')](_0x419676,_0x11f087[_0x49c41f][_0x07e6('0x2c')]))return;var _0x140b10=_0x11f087[_0x49c41f][_0x07e6('0x2c')]===_0x07e6('0x28')?'Agents':'Telephones';_0x5cce46[_0x07e6('0x4b')](db[_0x07e6('0x37')][_0x07e6('0x84')]({'name':_0x11f087[_0x49c41f]['name'],'resourceId':_0x11f087[_0x49c41f]['id'],'type':_0x140b10,'sectionId':_[_0x07e6('0x35')](_0x4831d7,['name',_0x140b10])['id']},{}));}return Promise[_0x07e6('0x5e')](_0x5cce46);});})[_0x07e6('0x14')](respondWithResult(_0x4666dd,0xc9))[_0x07e6('0x1d')](handleError(_0x4666dd,null));};exports[_0x07e6('0x8e')]=function(_0xaa320e,_0x127ac){if(_0xaa320e[_0x07e6('0x5f')]['id']){delete _0xaa320e[_0x07e6('0x5f')]['id'];}return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0xaa320e[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](function(_0x50d9d2){if(!_0x50d9d2)return null;if(_0x50d9d2['id']===_0xaa320e['user']['id']){if(!_0xaa320e[_0x07e6('0x5f')][_0x07e6('0x8f')]||!_0xaa320e[_0x07e6('0x5f')][_0x07e6('0x90')]){throw new db[(_0x07e6('0x91'))]['ValidationError'](_0x07e6('0x92'));}if(!_0x50d9d2[_0x07e6('0x93')](_0xaa320e[_0x07e6('0x5f')][_0x07e6('0x8f')])){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))]('Wrong\x20credentials');}if(_0xaa320e[_0x07e6('0x5f')][_0x07e6('0x8f')]===_0xaa320e[_0x07e6('0x5f')]['newPassword']){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xaa320e[_0x07e6('0x7f')][_0x07e6('0x2c')]===_0x07e6('0x2d')){if(!_0xaa320e[_0x07e6('0x5f')][_0x07e6('0x90')]){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))](_0x07e6('0x95'));}}else if(_0xaa320e[_0x07e6('0x7f')][_0x07e6('0x2c')]===_0x07e6('0x7f')){if(!_0xaa320e[_0x07e6('0x5f')][_0x07e6('0x90')]){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x50d9d2[_0x07e6('0x2c')]!=='agent'){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))]('Unauthorized');}}else{throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))](_0x07e6('0x80'));}return _0x50d9d2;})[_0x07e6('0x14')](handleEntityNotFound(_0x127ac,null))[_0x07e6('0x14')](function(_0x4fcd4f){return db[_0x07e6('0x63')]['findOne']({'attributes':['id',_0x07e6('0x65'),_0x07e6('0x96'),_0x07e6('0x97')]})[_0x07e6('0x14')](function(_0x1b7821){if(_0x1b7821['securePassword'])authService['validatePasswordPattern'](_0xaa320e[_0x07e6('0x5f')]['newPassword']);if(!_0x1b7821[_0x07e6('0x96')]||!_0x4fcd4f['previousPasswords'])return _0x4fcd4f;authService[_0x07e6('0x98')](_0xaa320e['body']['newPassword'],_0x4fcd4f['previousPasswords'],_0x1b7821[_0x07e6('0x97')]);return _0x4fcd4f;})[_0x07e6('0x14')](saveUpdates({'password':_0xaa320e['body'][_0x07e6('0x90')],'passwordResetAt':_0xaa320e['user']['id']==_0xaa320e[_0x07e6('0x51')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xaa320e[_0x07e6('0x5f')][_0x07e6('0x90')],_0x4fcd4f[_0x07e6('0x99')])},null));})[_0x07e6('0x14')](respondWithResult(_0x127ac,null))[_0x07e6('0x1d')](handleError(_0x127ac,null));};exports[_0x07e6('0x9a')]=function(_0x4ad3af,_0x4d41d5){var _0x2acaf1=_0x4ad3af[_0x07e6('0x5f')][_0x07e6('0x9b')];return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0x4ad3af[_0x07e6('0x51')]['id']},'attributes':['id','name',_0x07e6('0x2c'),_0x07e6('0x9c'),_0x07e6('0x9d'),'voicePause','interface']})['then'](handleEntityNotFound(_0x4d41d5,null))[_0x07e6('0x14')](function(_0x272179){if(_0x272179){if(!utils[_0x07e6('0x9e')](_0x2acaf1)){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))](_0x07e6('0x9f'));}return _0x272179[_0x07e6('0xa0')+_['capitalize'](_0x2acaf1['toLowerCase']())+_0x07e6('0xa1')](_0x4ad3af[_0x07e6('0x5f')][_0x07e6('0x62')],{'penalty':_0x4ad3af[_0x07e6('0x5f')][_0x07e6('0xa2')]||0x0})[_0x07e6('0xa3')](function(_0x15a208){for(var _0x3b7269=0x0;_0x3b7269<_0x4ad3af['body'][_0x07e6('0x62')][_0x07e6('0x4a')];_0x3b7269+=0x1){var _0x359a69={'UserId':Number(_0x4ad3af[_0x07e6('0x51')]['id'])};_0x359a69[_[_0x07e6('0xa4')](_0x2acaf1[_0x07e6('0xa5')]())+_0x07e6('0xa6')]=Number(_0x4ad3af[_0x07e6('0x5f')][_0x07e6('0x62')][_0x3b7269]);socket[_0x07e6('0x29')](_0x07e6('0x7f')+_[_0x07e6('0xa4')](_0x2acaf1[_0x07e6('0xa5')]())+_0x07e6('0xa7'),_0x359a69);}return _0x15a208;})[_0x07e6('0x14')](function(){if(_0x2acaf1===_0x07e6('0xa8')){return db[_0x07e6('0xa9')]['findAll']({'where':{'id':_0x4ad3af[_0x07e6('0x5f')]['ids']||[]},'raw':!![],'attributes':['id',_0x07e6('0x36')]});}})[_0x07e6('0x14')](function(_0x5a0b51){var _0x6f99bd=_0x272179[_0x07e6('0x2b')]({'plain':!![]});var _0x2bc5ad=[];if(_0x2acaf1==='voice'&&_0x6f99bd['role']===_0x07e6('0x28')&&_0x6f99bd[_0x07e6('0x9c')]){for(let _0x1feaab=0x0;_0x1feaab<_0x5a0b51[_0x07e6('0x4a')];_0x1feaab+=0x1){_0x2bc5ad[_0x07e6('0x4b')]({'membername':_0x6f99bd[_0x07e6('0x36')],'UserId':_0x6f99bd['id'],'queue_name':_0x5a0b51[_0x1feaab]['name'],'VoiceQueueId':_0x5a0b51[_0x1feaab]['id'],'interface':_['isNil'](_0x6f99bd[_0x07e6('0xaa')])?util['format'](_0x07e6('0xab'),_0x6f99bd['name']):_0x6f99bd[_0x07e6('0xaa')],'paused':_0x6f99bd[_0x07e6('0xac')]||![],'penalty':_0x4ad3af['body']['penalty']||0x0});}return Promise['all'](_0x2bc5ad[_0x07e6('0x32')](function(_0x4cff58){return db['UserVoiceQueueRt']['upsert'](_0x4cff58);}));}return _0x272179;});}})[_0x07e6('0x14')](respondWithStatusCode(_0x4d41d5,null))[_0x07e6('0x1d')](handleError(_0x4d41d5,null));};exports[_0x07e6('0xad')]=function(_0xea54b0,_0x41386f){var _0x2c6734,_0x1e9cd5;return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0xea54b0[_0x07e6('0x51')]['id']},'attributes':['id','name',_0x07e6('0x2c')]})[_0x07e6('0x14')](handleEntityNotFound(_0x41386f,null))[_0x07e6('0x14')](function(_0x28f3eb){if(_0x28f3eb){_0x2c6734=_0x28f3eb;if(!_0xea54b0[_0x07e6('0x43')][_0x07e6('0x9b')]||!utils['isValidChannel'](_0xea54b0[_0x07e6('0x43')]['channel'])){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))](_0x07e6('0x9f'));}return _0x28f3eb[_0x07e6('0xae')+_[_0x07e6('0xa4')](_0xea54b0[_0x07e6('0x43')]['channel'][_0x07e6('0xa5')]())+_0x07e6('0xa1')](_0xea54b0[_0x07e6('0x43')]['ids']);}})[_0x07e6('0x14')](function(_0x133f86){if(_[_0x07e6('0xaf')](_0xea54b0[_0x07e6('0x43')][_0x07e6('0x62')])){for(var _0x56be8f=0x0;_0x56be8f<_0xea54b0[_0x07e6('0x43')][_0x07e6('0x62')][_0x07e6('0x4a')];_0x56be8f+=0x1){_0x1e9cd5={'UserId':Number(_0xea54b0[_0x07e6('0x51')]['id'])};_0x1e9cd5[_[_0x07e6('0xa4')](_0xea54b0[_0x07e6('0x43')][_0x07e6('0x9b')][_0x07e6('0xa5')]())+_0x07e6('0xa6')]=Number(_0xea54b0[_0x07e6('0x43')][_0x07e6('0x62')][_0x56be8f]);socket[_0x07e6('0x29')](_0x07e6('0x7f')+_[_0x07e6('0xa4')](_0xea54b0[_0x07e6('0x43')][_0x07e6('0x9b')][_0x07e6('0xa5')]())+_0x07e6('0xb0'),_0x1e9cd5);}}else{_0x1e9cd5={'UserId':Number(_0xea54b0[_0x07e6('0x51')]['id'])};_0x1e9cd5[_[_0x07e6('0xa4')](_0xea54b0[_0x07e6('0x43')][_0x07e6('0x9b')]['toLowerCase']())+'QueueId']=Number(_0xea54b0[_0x07e6('0x43')][_0x07e6('0x62')]);socket[_0x07e6('0x29')]('user'+_[_0x07e6('0xa4')](_0xea54b0['query'][_0x07e6('0x9b')]['toLowerCase']())+_0x07e6('0xb0'),_0x1e9cd5);}return _0x133f86;})[_0x07e6('0x14')](function(){if(_0xea54b0[_0x07e6('0x43')][_0x07e6('0x9b')]===_0x07e6('0xa8')){return db[_0x07e6('0xb1')]['destroy']({'where':{'UserId':_0xea54b0[_0x07e6('0x51')]['id'],'VoiceQueueId':_0xea54b0[_0x07e6('0x43')][_0x07e6('0x62')]},'individualHooks':!![]})[_0x07e6('0x14')](function(){return _0x2c6734;});}return _0x2c6734;})[_0x07e6('0x14')](respondWithStatusCode(_0x41386f,null))[_0x07e6('0x1d')](handleError(_0x41386f,null));};exports['addAvatar']=function(_0x402d13,_0x49cb2b){_0x402d13[_0x07e6('0x5f')][_0x07e6('0xb2')]=_0x402d13[_0x07e6('0xb3')][_0x07e6('0xb4')];return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0x402d13[_0x07e6('0x51')]['id']}})['then'](handleEntityNotFound(_0x49cb2b,null))[_0x07e6('0x14')](saveUpdates(_0x402d13[_0x07e6('0x5f')],null))[_0x07e6('0x14')](respondWithResult(_0x49cb2b,null))[_0x07e6('0x1d')](handleError(_0x49cb2b,null));};exports[_0x07e6('0xb5')]=function(_0x2cbee0,_0x5ef73e){var _0x52a4d8=path['join'](config[_0x07e6('0xb6')],_0x07e6('0xb7'));return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0x2cbee0['params']['id']},'attributes':['id',_0x07e6('0xb2')],'raw':!![]})['then'](handleEntityNotFound(_0x5ef73e,null))[_0x07e6('0x14')](function(_0x231966){if(_0x231966){if(_['isNil'](_0x231966[_0x07e6('0xb2')])){return _0x5ef73e[_0x07e6('0xb8')](_0x52a4d8);}else{if(!fs[_0x07e6('0xb9')](path['join'](config['root'],_0x07e6('0xba'),_0x231966[_0x07e6('0xb2')]))){return _0x5ef73e[_0x07e6('0xb8')](_0x52a4d8);}return _0x5ef73e['download'](path[_0x07e6('0xbb')](config[_0x07e6('0xb6')],_0x07e6('0xba'),_0x231966[_0x07e6('0xb2')]));}}})['catch'](handleError(_0x5ef73e,null));};exports[_0x07e6('0xbc')]=function(_0x5117a2,_0x1c886f){return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0x5117a2[_0x07e6('0x51')]['id']},'attributes':['id']})[_0x07e6('0x14')](handleEntityNotFound(_0x1c886f,null))[_0x07e6('0x14')](function(_0xc4e7bd){var _0x2c325f=[];values=_0xc4e7bd['dataValues'];_0x2c325f['push'](get_open_tabs(_0x07e6('0x4c'),_0xc4e7bd['dataValues']));_0x2c325f[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x5d'),_0xc4e7bd[_0x07e6('0x4d')]));_0x2c325f['push'](get_open_tabs(_0x07e6('0xbd'),_0xc4e7bd[_0x07e6('0x4d')]));_0x2c325f['push'](get_open_tabs('whatsapp',_0xc4e7bd[_0x07e6('0x4d')]));_0x2c325f['push'](get_open_tabs(_0x07e6('0x4e'),_0xc4e7bd[_0x07e6('0x4d')]));_0x2c325f[_0x07e6('0x4b')](get_open_tabs(_0x07e6('0x4f'),_0xc4e7bd['dataValues']));return Promise[_0x07e6('0x5e')](_0x2c325f);})[_0x07e6('0x14')](function(_0x2f7c55){if(_0x2f7c55){var _0x36a865=_[_0x07e6('0x32')](values[_0x07e6('0xbe')],function(_0x6a6491){return{'channel':_0x07e6('0xbf'),'id':_0x6a6491['id'],'createdAt':_0x6a6491[_0x07e6('0xc0')]};});var _0x3794ec=_[_0x07e6('0x32')](values[_0x07e6('0xc1')],function(_0x46c9ed){return{'channel':_0x07e6('0xc2'),'id':_0x46c9ed['id'],'createdAt':_0x46c9ed['createdAt']};});var _0x401141=_[_0x07e6('0x32')](values[_0x07e6('0xc3')],function(_0x51284c){return{'channel':'OPENCHANNEL','id':_0x51284c['id'],'createdAt':_0x51284c[_0x07e6('0xc0')]};});var _0x19e80b=_['map'](values[_0x07e6('0xc4')],function(_0x59aff){return{'channel':'MAIL','id':_0x59aff['id'],'createdAt':_0x59aff[_0x07e6('0xc0')]};});var _0x12268d=_[_0x07e6('0x32')](values['SmsOpenTabs'],function(_0x55b3ff){return{'channel':_0x07e6('0xc5'),'id':_0x55b3ff['id'],'createdAt':_0x55b3ff[_0x07e6('0xc0')]};});var _0x5e7819=_[_0x07e6('0x32')](values[_0x07e6('0xc6')],function(_0x5d84e7){return{'channel':_0x07e6('0xc7'),'id':_0x5d84e7['id'],'createdAt':_0x5d84e7['createdAt']};});var _0x520e80=_[_0x07e6('0xc8')](_0x36a865,_0x3794ec,_0x401141,_0x19e80b,_0x12268d,_0x5e7819);var _0x4b996={'count':_0x520e80[_0x07e6('0x4a')],'rows':_0x520e80};return _0x4b996;}else return null;})[_0x07e6('0x14')](respondWithResult(_0x1c886f,null))['catch'](handleError(_0x1c886f,null));};exports[_0x07e6('0xc9')]=function(_0x1e5be2,_0x4d687b){var _0x713bee={};return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x1e5be2[_0x07e6('0x51')]['id']}})['then'](function(_0x154a58){if(!_0x154a58){throw new APINotFoundError(util[_0x07e6('0xcb')](_0x07e6('0xcc'),_0x1e5be2[_0x07e6('0x51')]['id']));}return contacts[_0x07e6('0x60')]();})[_0x07e6('0x14')](function(_0x3138dd){_0x1e5be2[_0x07e6('0x43')][_0x07e6('0x3b')]=_0x1e5be2['params']['id'];_0x713bee=qs[_0x07e6('0x41')](_0x3138dd,_0x1e5be2);if(_0x1e5be2[_0x07e6('0x43')][_0x07e6('0xcd')](_0x07e6('0x58'))){_0x713bee[_0x07e6('0x5a')]=[{'model':db[_0x07e6('0xce')],'as':_0x07e6('0xcf'),'required':![]},{'model':db[_0x07e6('0xd0')],'as':_0x07e6('0xd1'),'attributes':['id','name',_0x07e6('0xd2')],'where':_0x1e5be2[_0x07e6('0x43')][_0x07e6('0xd3')]?{'id':_0x1e5be2[_0x07e6('0x43')][_0x07e6('0xd3')]}:undefined,'required':_0x1e5be2[_0x07e6('0x43')][_0x07e6('0xd3')]?!![]:![]}];}return contacts[_0x07e6('0x47')](_0x1e5be2[_0x07e6('0x43')],_0x1e5be2[_0x07e6('0x7f')],_0x713bee,_0x3138dd);})['then'](respondWithFilteredResult(_0x4d687b,_0x713bee))[_0x07e6('0x1d')](APIHandleError(_0x4d687b));};exports[_0x07e6('0xd4')]=function(_0xe69aca,_0x48d32b){var _0x4f8811;var _0x259a76={};var _0x44d195;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0xe69aca['params']['id']},'attributes':['id','name',_0x07e6('0x2c')]})['then'](handleEntityNotFound(_0x48d32b,null))['then'](function(_0x11990b){if(!utils[_0x07e6('0x9e')](_0xe69aca[_0x07e6('0x43')][_0x07e6('0x9b')])){throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))]('Unknown\x20channel');}_0x4f8811=_0x11990b;var _0x8e0345={};_0x8e0345['model']=_[_0x07e6('0x53')](db[_['capitalize'](_0xe69aca[_0x07e6('0x43')]['channel'])+'Queue'][_0x07e6('0x3c')]);_0x8e0345[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0xe69aca[_0x07e6('0x43')]);_0x8e0345[_0x07e6('0x54')]=_[_0x07e6('0x55')](_0x8e0345['model'],_0x8e0345[_0x07e6('0x43')]);_0x259a76[_0x07e6('0x46')]=_[_0x07e6('0x55')](_0x8e0345[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0xe69aca[_0x07e6('0x43')][_0x07e6('0x57')]));_0x259a76['attributes']=_0x259a76[_0x07e6('0x46')]['length']?_0x259a76['attributes']:_0x8e0345[_0x07e6('0x56')];_0x259a76[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0xe69aca[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x259a76['where']=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0xe69aca['query'],_0x8e0345['filters']));if(_0xe69aca['query']['filter']){_0x259a76[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x259a76[_0x07e6('0x42')],{'$or':_['map'](_0x259a76[_0x07e6('0x46')],function(_0x34b1a9){var _0x231aea={};_0x231aea[_0x34b1a9]={'$like':'%'+_0xe69aca['query'][_0x07e6('0x30')]+'%'};return _0x231aea;})});}_0x259a76=_[_0x07e6('0x5b')]({},_0x259a76,_0xe69aca[_0x07e6('0x5c')]);switch(_0x4f8811[_0x07e6('0x2c')]){case'admin':return db[_[_0x07e6('0xa4')](_0xe69aca[_0x07e6('0x43')]['channel'])+_0x07e6('0xd8')][_0x07e6('0x47')](_0x259a76);case _0x07e6('0x7f'):case'agent':return _0x4f8811['get'+_['capitalize'](_0xe69aca['query'][_0x07e6('0x9b')])+_0x07e6('0xa1')](_0x259a76);default:throw new db['Sequelize'][(_0x07e6('0x94'))](_0x07e6('0xd9'));}})['then'](function(_0x4292d6){_0x44d195=_0x4292d6[_0x07e6('0x4a')];if(!_0xe69aca[_0x07e6('0x43')][_0x07e6('0xcd')]('nolimit')){_0x259a76[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0xe69aca[_0x07e6('0x43')]['limit']);_0x259a76[_0x07e6('0x21')]=qs['offset'](_0xe69aca['query'][_0x07e6('0x21')]);}switch(_0x4f8811[_0x07e6('0x2c')]){case _0x07e6('0x2d'):return db[_[_0x07e6('0xa4')](_0xe69aca[_0x07e6('0x43')][_0x07e6('0x9b')])+_0x07e6('0xd8')][_0x07e6('0x47')](_0x259a76);case'user':case _0x07e6('0x28'):return _0x4f8811['get'+_[_0x07e6('0xa4')](_0xe69aca['query'][_0x07e6('0x9b')])+'Queues'](_0x259a76);}})['then'](function(_0x26ef8b){return{'count':_0x44d195,'rows':_0x26ef8b};})[_0x07e6('0x14')](respondWithResult(_0x48d32b,null))['catch'](handleError(_0x48d32b,null));};exports[_0x07e6('0xda')]=function(_0x357327,_0x437dd8){var _0x32d62a={};var _0x24498b={};var _0x5a1189;var _0x50b5b5;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x357327[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x437dd8,null))[_0x07e6('0x14')](function(_0x494e06){if(_0x494e06){_0x5a1189=_0x494e06;_0x24498b['model']=_[_0x07e6('0x53')](db['UserVoiceQueueRt'][_0x07e6('0x3c')]);_0x24498b['query']=_[_0x07e6('0x53')](_0x357327[_0x07e6('0x43')]);_0x24498b['filters']=_[_0x07e6('0x55')](_0x24498b['model'],_0x24498b[_0x07e6('0x43')]);_0x32d62a[_0x07e6('0x46')]=_['intersection'](_0x24498b[_0x07e6('0x56')],qs['fields'](_0x357327[_0x07e6('0x43')]['fields']));_0x32d62a['attributes']=_0x32d62a['attributes'][_0x07e6('0x4a')]?_0x32d62a[_0x07e6('0x46')]:_0x24498b[_0x07e6('0x56')];_0x32d62a[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x357327[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x32d62a[_0x07e6('0x42')]=qs['filters'](_[_0x07e6('0xd7')](_0x357327[_0x07e6('0x43')],_0x24498b[_0x07e6('0x54')]));if(_0x357327[_0x07e6('0x43')][_0x07e6('0x30')]){_0x32d62a[_0x07e6('0x42')]=_['merge'](_0x32d62a[_0x07e6('0x42')],{'$or':_['map'](_0x32d62a[_0x07e6('0x46')],function(_0x5b12a3){var _0x32af96={};_0x32af96[_0x5b12a3]={'$like':'%'+_0x357327[_0x07e6('0x43')][_0x07e6('0x30')]+'%'};return _0x32af96;})});}_0x32d62a=_[_0x07e6('0x5b')]({},_0x32d62a,_0x357327[_0x07e6('0x5c')]);return _0x5a1189[_0x07e6('0xda')](_0x32d62a);}})[_0x07e6('0x14')](function(_0x10bef4){if(_0x10bef4){_0x50b5b5=_0x10bef4[_0x07e6('0x4a')];if(!_0x357327[_0x07e6('0x43')][_0x07e6('0xcd')](_0x07e6('0xdb'))){_0x32d62a['limit']=qs['limit'](_0x357327[_0x07e6('0x43')]['limit']);_0x32d62a[_0x07e6('0x21')]=qs[_0x07e6('0x21')](_0x357327[_0x07e6('0x43')][_0x07e6('0x21')]);}return _0x5a1189[_0x07e6('0xda')](_0x32d62a);}})[_0x07e6('0x14')](function(_0x2ac9eb){if(_0x2ac9eb){return _0x2ac9eb?{'count':_0x50b5b5,'rows':_0x2ac9eb}:null;}})[_0x07e6('0x14')](respondWithResult(_0x437dd8,null))[_0x07e6('0x1d')](handleError(_0x437dd8,null));};exports[_0x07e6('0xdc')]=function(_0x354bc,_0x393ed4){var _0x2e44b8={};var _0x4cd95b={};var _0x19869b;var _0x5e659a;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x354bc[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x393ed4,null))[_0x07e6('0x14')](function(_0x12f087){if(_0x12f087){_0x19869b=_0x12f087;_0x4cd95b[_0x07e6('0x56')]=_['keys'](db[_0x07e6('0xdd')]['rawAttributes']);_0x4cd95b[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x354bc['query']);_0x4cd95b['filters']=_[_0x07e6('0x55')](_0x4cd95b['model'],_0x4cd95b['query']);_0x2e44b8[_0x07e6('0x46')]=_['intersection'](_0x4cd95b[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0x354bc[_0x07e6('0x43')][_0x07e6('0x57')]));_0x2e44b8[_0x07e6('0x46')]=_0x2e44b8[_0x07e6('0x46')][_0x07e6('0x4a')]?_0x2e44b8[_0x07e6('0x46')]:_0x4cd95b[_0x07e6('0x56')];_0x2e44b8[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x354bc[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x2e44b8[_0x07e6('0x42')]=qs['filters'](_[_0x07e6('0xd7')](_0x354bc['query'],_0x4cd95b[_0x07e6('0x54')]));if(_0x354bc['query'][_0x07e6('0x30')]){_0x2e44b8[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x2e44b8[_0x07e6('0x42')],{'$or':_['map'](_0x2e44b8['attributes'],function(_0x27b368){var _0x414d3c={};_0x414d3c[_0x27b368]={'$like':'%'+_0x354bc['query'][_0x07e6('0x30')]+'%'};return _0x414d3c;})});}_0x2e44b8=_['merge']({},_0x2e44b8,_0x354bc[_0x07e6('0x5c')]);return _0x19869b[_0x07e6('0xdc')](_0x2e44b8);}})[_0x07e6('0x14')](function(_0x244771){if(_0x244771){_0x5e659a=_0x244771[_0x07e6('0x4a')];if(!_0x354bc[_0x07e6('0x43')][_0x07e6('0xcd')](_0x07e6('0xdb'))){_0x2e44b8['limit']=qs[_0x07e6('0x22')](_0x354bc[_0x07e6('0x43')][_0x07e6('0x22')]);_0x2e44b8[_0x07e6('0x21')]=qs[_0x07e6('0x21')](_0x354bc[_0x07e6('0x43')][_0x07e6('0x21')]);}return _0x19869b[_0x07e6('0xdc')](_0x2e44b8);}})[_0x07e6('0x14')](function(_0x277125){if(_0x277125){return _0x277125?{'count':_0x5e659a,'rows':_0x277125}:null;}})[_0x07e6('0x14')](respondWithResult(_0x393ed4,null))[_0x07e6('0x1d')](handleError(_0x393ed4,null));};exports[_0x07e6('0xde')]=function(_0x408668,_0x555905){var _0xd2384a={'raw':!![],'where':{}};var _0x1770c6={};var _0x4b4608={'count':0x0,'rows':[]};return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x408668['params']['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x555905,null))['then'](function(_0x226b1c){if(_0x226b1c){_0x1770c6[_0x07e6('0x56')]=_['keys'](db[_0x07e6('0xdf')]['rawAttributes']);_0x1770c6[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x408668['query']);_0x1770c6['filters']=_[_0x07e6('0x55')](_0x1770c6[_0x07e6('0x56')],_0x1770c6[_0x07e6('0x43')]);_0xd2384a[_0x07e6('0x46')]=_[_0x07e6('0x55')](_0x1770c6[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0x408668[_0x07e6('0x43')][_0x07e6('0x57')]));_0xd2384a[_0x07e6('0x46')]=_0xd2384a[_0x07e6('0x46')][_0x07e6('0x4a')]?_0xd2384a[_0x07e6('0x46')]:_0x1770c6[_0x07e6('0x56')];if(!_0x408668[_0x07e6('0x43')][_0x07e6('0xcd')](_0x07e6('0xdb'))){_0xd2384a[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0x408668[_0x07e6('0x43')][_0x07e6('0x22')]);_0xd2384a[_0x07e6('0x21')]=qs[_0x07e6('0x21')](_0x408668['query'][_0x07e6('0x21')]);}_0xd2384a[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x408668['query'][_0x07e6('0xd6')]);_0xd2384a['where']=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0x408668[_0x07e6('0x43')],_0x1770c6[_0x07e6('0x54')]));_0xd2384a['where'][_0x07e6('0xe0')]=_0x226b1c['id'];if(_0x408668[_0x07e6('0x43')][_0x07e6('0x30')]){_0xd2384a[_0x07e6('0x42')]=_['merge'](_0xd2384a[_0x07e6('0x42')],{'$or':_[_0x07e6('0x32')](_0xd2384a[_0x07e6('0x46')],function(_0x484d0f){var _0x2efbdd={};_0x2efbdd[_0x484d0f]={'$like':'%'+_0x408668[_0x07e6('0x43')][_0x07e6('0x30')]+'%'};return _0x2efbdd;})});}_0xd2384a=_['merge']({},_0xd2384a,_0x408668['options']);return db[_0x07e6('0xdf')]['count']({'where':_0xd2384a[_0x07e6('0x42')]})['then'](function(_0xdad497){_0x4b4608[_0x07e6('0x24')]=_0xdad497;if(_0x408668[_0x07e6('0x43')][_0x07e6('0x58')]){_0xd2384a[_0x07e6('0x5a')]=[{'all':!![]}];}return db[_0x07e6('0xdf')][_0x07e6('0x47')](_0xd2384a);})[_0x07e6('0x14')](function(_0xc8e0f6){_0x4b4608[_0x07e6('0x48')]=_0xc8e0f6;return _0x4b4608;});}})[_0x07e6('0x14')](respondWithFilteredResult(_0x555905,_0xd2384a))[_0x07e6('0x1d')](handleError(_0x555905,null));};exports[_0x07e6('0xe1')]=function(_0x33e155,_0x30169c){var _0x13a92f={'raw':!![],'where':{}};var _0x50208c={};var _0x115864={'count':0x0,'rows':[]};return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x33e155[_0x07e6('0x51')]['id']}})['then'](handleEntityNotFound(_0x30169c,null))[_0x07e6('0x14')](function(_0x4c46f9){if(_0x4c46f9){_0x50208c[_0x07e6('0x56')]=_[_0x07e6('0x53')](db[_0x07e6('0xe2')][_0x07e6('0x3c')]);_0x50208c[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x33e155[_0x07e6('0x43')]);_0x50208c[_0x07e6('0x54')]=_['intersection'](_0x50208c[_0x07e6('0x56')],_0x50208c[_0x07e6('0x43')]);_0x13a92f[_0x07e6('0x46')]=_['intersection'](_0x50208c[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0x33e155[_0x07e6('0x43')][_0x07e6('0x57')]));_0x13a92f[_0x07e6('0x46')]=_0x13a92f['attributes'][_0x07e6('0x4a')]?_0x13a92f[_0x07e6('0x46')]:_0x50208c[_0x07e6('0x56')];if(!_0x33e155[_0x07e6('0x43')]['hasOwnProperty']('nolimit')){_0x13a92f[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0x33e155[_0x07e6('0x43')][_0x07e6('0x22')]);_0x13a92f[_0x07e6('0x21')]=qs[_0x07e6('0x21')](_0x33e155[_0x07e6('0x43')][_0x07e6('0x21')]);}_0x13a92f[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x33e155[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x13a92f[_0x07e6('0x42')]=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0x33e155[_0x07e6('0x43')],_0x50208c[_0x07e6('0x54')]));_0x13a92f[_0x07e6('0x42')]['UserId']=_0x4c46f9['id'];if(_0x33e155[_0x07e6('0x43')][_0x07e6('0x30')]){_0x13a92f[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x13a92f['where'],{'$or':_['map'](_0x13a92f[_0x07e6('0x46')],function(_0x4bc3c4){var _0x39536f={};_0x39536f[_0x4bc3c4]={'$like':'%'+_0x33e155['query'][_0x07e6('0x30')]+'%'};return _0x39536f;})});}_0x13a92f=_['merge']({},_0x13a92f,_0x33e155[_0x07e6('0x5c')]);return db['ScreenRecording'][_0x07e6('0x24')]({'where':_0x13a92f['where']})['then'](function(_0x10e9bd){_0x115864[_0x07e6('0x24')]=_0x10e9bd;if(_0x33e155['query'][_0x07e6('0x58')]){_0x13a92f['include']=[{'all':!![]}];}return db[_0x07e6('0xe2')]['findAll'](_0x13a92f);})[_0x07e6('0x14')](function(_0x5ac7cf){_0x115864['rows']=_0x5ac7cf;return _0x115864;});}})[_0x07e6('0x14')](respondWithFilteredResult(_0x30169c,_0x13a92f))[_0x07e6('0x1d')](handleError(_0x30169c,null));};exports['getChatInteractions']=function(_0x5b5923,_0x16b02b){var _0x3aa18d={};var _0x82d87d={};var _0x2ee396;var _0x2ed445;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x5b5923[_0x07e6('0x51')]['id']}})['then'](handleEntityNotFound(_0x16b02b,null))['then'](function(_0x3bebbc){if(_0x3bebbc){_0x2ee396=_0x3bebbc;_0x82d87d[_0x07e6('0x56')]=_['keys'](db[_0x07e6('0xe3')][_0x07e6('0x3c')]);_0x82d87d[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x5b5923[_0x07e6('0x43')]);_0x82d87d[_0x07e6('0x54')]=_['intersection'](_0x82d87d[_0x07e6('0x56')],_0x82d87d[_0x07e6('0x43')]);_0x3aa18d[_0x07e6('0x46')]=_['intersection'](_0x82d87d['model'],qs[_0x07e6('0x57')](_0x5b5923[_0x07e6('0x43')]['fields']));_0x3aa18d[_0x07e6('0x46')]=_0x3aa18d[_0x07e6('0x46')][_0x07e6('0x4a')]?_0x3aa18d[_0x07e6('0x46')]:_0x82d87d[_0x07e6('0x56')];_0x3aa18d[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x5b5923[_0x07e6('0x43')]['sort']);_0x3aa18d['where']=qs[_0x07e6('0x54')](_['pick'](_0x5b5923[_0x07e6('0x43')],_0x82d87d[_0x07e6('0x54')]));if(_0x5b5923[_0x07e6('0x43')][_0x07e6('0x30')]){_0x3aa18d[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x3aa18d[_0x07e6('0x42')],{'$or':_[_0x07e6('0x32')](_0x3aa18d[_0x07e6('0x46')],function(_0x3dbb83){var _0x2ba652={};_0x2ba652[_0x3dbb83]={'$like':'%'+_0x5b5923['query'][_0x07e6('0x30')]+'%'};return _0x2ba652;})});}_0x3aa18d=_['merge']({},_0x3aa18d,_0x5b5923[_0x07e6('0x5c')]);return _0x2ee396[_0x07e6('0xe4')](_0x3aa18d);}})['then'](function(_0x33325c){if(_0x33325c){_0x2ed445=_0x33325c[_0x07e6('0x4a')];if(!_0x5b5923[_0x07e6('0x43')]['hasOwnProperty'](_0x07e6('0xdb'))){_0x3aa18d[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0x5b5923[_0x07e6('0x43')]['limit']);_0x3aa18d[_0x07e6('0x21')]=qs[_0x07e6('0x21')](_0x5b5923['query'][_0x07e6('0x21')]);}return _0x2ee396[_0x07e6('0xe4')](_0x3aa18d);}})[_0x07e6('0x14')](function(_0x3afbd2){if(_0x3afbd2){return _0x3afbd2?{'count':_0x2ed445,'rows':_0x3afbd2}:null;}})[_0x07e6('0x14')](respondWithResult(_0x16b02b,null))[_0x07e6('0x1d')](handleError(_0x16b02b,null));};exports[_0x07e6('0xe5')]=function(_0x26a0d7,_0x50082d){var _0x45a569={};var _0x430928={};var _0x6f7906;var _0x2e1531;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x26a0d7[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x50082d,null))[_0x07e6('0x14')](function(_0x5dbbe9){if(_0x5dbbe9){_0x6f7906=_0x5dbbe9;_0x430928[_0x07e6('0x56')]=_[_0x07e6('0x53')](db[_0x07e6('0xe6')][_0x07e6('0x3c')]);_0x430928[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x26a0d7['query']);_0x430928[_0x07e6('0x54')]=_[_0x07e6('0x55')](_0x430928['model'],_0x430928[_0x07e6('0x43')]);_0x45a569['attributes']=_[_0x07e6('0x55')](_0x430928[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0x26a0d7[_0x07e6('0x43')]['fields']));_0x45a569[_0x07e6('0x46')]=_0x45a569[_0x07e6('0x46')]['length']?_0x45a569[_0x07e6('0x46')]:_0x430928[_0x07e6('0x56')];_0x45a569[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x26a0d7[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x45a569[_0x07e6('0x42')]=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0x26a0d7[_0x07e6('0x43')],_0x430928[_0x07e6('0x54')]));if(_0x26a0d7[_0x07e6('0x43')][_0x07e6('0x30')]){_0x45a569[_0x07e6('0x42')]=_['merge'](_0x45a569[_0x07e6('0x42')],{'$or':_[_0x07e6('0x32')](_0x45a569[_0x07e6('0x46')],function(_0x162983){var _0x1e4789={};_0x1e4789[_0x162983]={'$like':'%'+_0x26a0d7[_0x07e6('0x43')][_0x07e6('0x30')]+'%'};return _0x1e4789;})});}_0x45a569=_[_0x07e6('0x5b')]({},_0x45a569,_0x26a0d7['options']);return _0x6f7906[_0x07e6('0xe5')](_0x45a569);}})[_0x07e6('0x14')](function(_0x497516){if(_0x497516){_0x2e1531=_0x497516[_0x07e6('0x4a')];if(!_0x26a0d7[_0x07e6('0x43')]['hasOwnProperty'](_0x07e6('0xdb'))){_0x45a569[_0x07e6('0x22')]=qs['limit'](_0x26a0d7[_0x07e6('0x43')][_0x07e6('0x22')]);_0x45a569[_0x07e6('0x21')]=qs['offset'](_0x26a0d7['query'][_0x07e6('0x21')]);}return _0x6f7906[_0x07e6('0xe5')](_0x45a569);}})[_0x07e6('0x14')](function(_0x295cdd){if(_0x295cdd){return _0x295cdd?{'count':_0x2e1531,'rows':_0x295cdd}:null;}})[_0x07e6('0x14')](respondWithResult(_0x50082d,null))[_0x07e6('0x1d')](handleError(_0x50082d,null));};exports['getMailInteractions']=function(_0x44d1a9,_0x53e097){var _0x24d219={'raw':!![],'where':{}};var _0x14160b={};var _0xc5756c={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x44d1a9[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x53e097,null))['then'](function(_0x4bd746){if(_0x4bd746){_0x14160b[_0x07e6('0x56')]=_['keys'](db[_0x07e6('0xe7')][_0x07e6('0x3c')]);_0x14160b[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x44d1a9['query']);_0x14160b['filters']=_[_0x07e6('0x55')](_0x14160b[_0x07e6('0x56')],_0x14160b[_0x07e6('0x43')]);_0x24d219[_0x07e6('0x46')]=_[_0x07e6('0x55')](_0x14160b['model'],qs[_0x07e6('0x57')](_0x44d1a9['query'][_0x07e6('0x57')]));_0x24d219['attributes']=_0x24d219[_0x07e6('0x46')][_0x07e6('0x4a')]?_0x24d219[_0x07e6('0x46')]:_0x14160b['model'];if(!_0x44d1a9[_0x07e6('0x43')]['hasOwnProperty'](_0x07e6('0xdb'))){_0x24d219[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0x44d1a9[_0x07e6('0x43')]['limit']);_0x24d219[_0x07e6('0x21')]=qs[_0x07e6('0x21')](_0x44d1a9[_0x07e6('0x43')][_0x07e6('0x21')]);}_0x24d219[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x44d1a9[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x24d219[_0x07e6('0x42')]=qs['filters'](_[_0x07e6('0xd7')](_0x44d1a9[_0x07e6('0x43')],_0x14160b[_0x07e6('0x54')]));_0x24d219[_0x07e6('0x42')][_0x07e6('0xe0')]=_0x4bd746['id'];if(_0x44d1a9['query'][_0x07e6('0x30')]){_0x24d219[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x24d219['where'],{'$or':_[_0x07e6('0x32')](_0x24d219['attributes'],function(_0x2eb92c){var _0x54d401={};_0x54d401[_0x2eb92c]={'$like':'%'+_0x44d1a9[_0x07e6('0x43')]['filter']+'%'};return _0x54d401;})});}_0x24d219=_[_0x07e6('0x5b')]({},_0x24d219,_0x44d1a9[_0x07e6('0x5c')]);return db[_0x07e6('0xe7')]['count']({'where':_0x24d219['where']})[_0x07e6('0x14')](function(_0x4c819b){_0xc5756c[_0x07e6('0x24')]=_0x4c819b;if(_0x44d1a9[_0x07e6('0x43')][_0x07e6('0x58')]){_0x24d219['include']=[{'all':!![]}];}return db[_0x07e6('0xe7')]['findAll'](_0x24d219);})[_0x07e6('0x14')](function(_0x1a0cd1){_0xc5756c[_0x07e6('0x48')]=_0x1a0cd1;return _0xc5756c;});}})['then'](respondWithFilteredResult(_0x53e097,_0x24d219))[_0x07e6('0x1d')](handleError(_0x53e097,null));};exports[_0x07e6('0xe8')]=function(_0xfb0d05,_0x58482e){var _0x1e7e8b={};var _0x50bcfc={};var _0x4f3787;var _0x1e4611;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0xfb0d05[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x58482e,null))['then'](function(_0x55d2a8){if(_0x55d2a8){_0x4f3787=_0x55d2a8;_0x50bcfc['model']=_['keys'](db[_0x07e6('0xe9')][_0x07e6('0x3c')]);_0x50bcfc['query']=_[_0x07e6('0x53')](_0xfb0d05['query']);_0x50bcfc[_0x07e6('0x54')]=_[_0x07e6('0x55')](_0x50bcfc[_0x07e6('0x56')],_0x50bcfc[_0x07e6('0x43')]);_0x1e7e8b['attributes']=_['intersection'](_0x50bcfc['model'],qs[_0x07e6('0x57')](_0xfb0d05[_0x07e6('0x43')][_0x07e6('0x57')]));_0x1e7e8b['attributes']=_0x1e7e8b[_0x07e6('0x46')][_0x07e6('0x4a')]?_0x1e7e8b['attributes']:_0x50bcfc['model'];_0x1e7e8b[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0xfb0d05[_0x07e6('0x43')]['sort']);_0x1e7e8b[_0x07e6('0x42')]=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0xfb0d05[_0x07e6('0x43')],_0x50bcfc[_0x07e6('0x54')]));if(_0xfb0d05[_0x07e6('0x43')][_0x07e6('0x30')]){_0x1e7e8b[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x1e7e8b[_0x07e6('0x42')],{'$or':_[_0x07e6('0x32')](_0x1e7e8b[_0x07e6('0x46')],function(_0xe99e41){var _0x522531={};_0x522531[_0xe99e41]={'$like':'%'+_0xfb0d05[_0x07e6('0x43')][_0x07e6('0x30')]+'%'};return _0x522531;})});}_0x1e7e8b=_[_0x07e6('0x5b')]({},_0x1e7e8b,_0xfb0d05[_0x07e6('0x5c')]);return _0x4f3787[_0x07e6('0xe8')](_0x1e7e8b);}})[_0x07e6('0x14')](function(_0x583eb1){if(_0x583eb1){_0x1e4611=_0x583eb1[_0x07e6('0x4a')];if(!_0xfb0d05[_0x07e6('0x43')][_0x07e6('0xcd')]('nolimit')){_0x1e7e8b[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0xfb0d05[_0x07e6('0x43')][_0x07e6('0x22')]);_0x1e7e8b[_0x07e6('0x21')]=qs[_0x07e6('0x21')](_0xfb0d05['query']['offset']);}return _0x4f3787[_0x07e6('0xe8')](_0x1e7e8b);}})[_0x07e6('0x14')](function(_0x5caced){if(_0x5caced){return _0x5caced?{'count':_0x1e4611,'rows':_0x5caced}:null;}})[_0x07e6('0x14')](respondWithResult(_0x58482e,null))[_0x07e6('0x1d')](handleError(_0x58482e,null));};exports['getFaxInteractions']=function(_0x13e02a,_0x4be62a){var _0x4cf28b={};var _0x22b50c={};var _0x2a53cc;var _0x58abaa;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x13e02a[_0x07e6('0x51')]['id']}})['then'](handleEntityNotFound(_0x4be62a,null))[_0x07e6('0x14')](function(_0x56295f){if(_0x56295f){_0x2a53cc=_0x56295f;_0x22b50c[_0x07e6('0x56')]=_[_0x07e6('0x53')](db[_0x07e6('0xea')]['rawAttributes']);_0x22b50c[_0x07e6('0x43')]=_['keys'](_0x13e02a[_0x07e6('0x43')]);_0x22b50c[_0x07e6('0x54')]=_[_0x07e6('0x55')](_0x22b50c[_0x07e6('0x56')],_0x22b50c[_0x07e6('0x43')]);_0x4cf28b[_0x07e6('0x46')]=_[_0x07e6('0x55')](_0x22b50c[_0x07e6('0x56')],qs['fields'](_0x13e02a[_0x07e6('0x43')][_0x07e6('0x57')]));_0x4cf28b[_0x07e6('0x46')]=_0x4cf28b[_0x07e6('0x46')]['length']?_0x4cf28b[_0x07e6('0x46')]:_0x22b50c[_0x07e6('0x56')];_0x4cf28b[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x13e02a[_0x07e6('0x43')]['sort']);_0x4cf28b[_0x07e6('0x42')]=qs[_0x07e6('0x54')](_['pick'](_0x13e02a[_0x07e6('0x43')],_0x22b50c[_0x07e6('0x54')]));if(_0x13e02a[_0x07e6('0x43')][_0x07e6('0x30')]){_0x4cf28b[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x4cf28b[_0x07e6('0x42')],{'$or':_[_0x07e6('0x32')](_0x4cf28b[_0x07e6('0x46')],function(_0x4540b6){var _0x3d1949={};_0x3d1949[_0x4540b6]={'$like':'%'+_0x13e02a['query'][_0x07e6('0x30')]+'%'};return _0x3d1949;})});}_0x4cf28b=_[_0x07e6('0x5b')]({},_0x4cf28b,_0x13e02a[_0x07e6('0x5c')]);return _0x2a53cc[_0x07e6('0xeb')](_0x4cf28b);}})['then'](function(_0x47fcfb){if(_0x47fcfb){_0x58abaa=_0x47fcfb['length'];if(!_0x13e02a['query'][_0x07e6('0xcd')]('nolimit')){_0x4cf28b[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0x13e02a[_0x07e6('0x43')][_0x07e6('0x22')]);_0x4cf28b[_0x07e6('0x21')]=qs['offset'](_0x13e02a['query'][_0x07e6('0x21')]);}return _0x2a53cc[_0x07e6('0xeb')](_0x4cf28b);}})[_0x07e6('0x14')](function(_0x285149){if(_0x285149){return _0x285149?{'count':_0x58abaa,'rows':_0x285149}:null;}})[_0x07e6('0x14')](respondWithResult(_0x4be62a,null))[_0x07e6('0x1d')](handleError(_0x4be62a,null));};exports[_0x07e6('0xec')]=function(_0x559865,_0x203ba8){var _0x265cd1={};var _0x46ae71={};var _0x1bf4d3;var _0x355dfb;return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x559865[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x203ba8,null))[_0x07e6('0x14')](function(_0x3614c1){if(_0x3614c1){_0x1bf4d3=_0x3614c1;_0x46ae71['model']=_[_0x07e6('0x53')](db[_0x07e6('0xed')][_0x07e6('0x3c')]);_0x46ae71[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x559865[_0x07e6('0x43')]);_0x46ae71[_0x07e6('0x54')]=_[_0x07e6('0x55')](_0x46ae71[_0x07e6('0x56')],_0x46ae71[_0x07e6('0x43')]);_0x265cd1[_0x07e6('0x46')]=_[_0x07e6('0x55')](_0x46ae71['model'],qs[_0x07e6('0x57')](_0x559865[_0x07e6('0x43')][_0x07e6('0x57')]));_0x265cd1[_0x07e6('0x46')]=_0x265cd1[_0x07e6('0x46')][_0x07e6('0x4a')]?_0x265cd1[_0x07e6('0x46')]:_0x46ae71[_0x07e6('0x56')];_0x265cd1[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x559865[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x265cd1[_0x07e6('0x42')]=qs['filters'](_[_0x07e6('0xd7')](_0x559865[_0x07e6('0x43')],_0x46ae71[_0x07e6('0x54')]));if(_0x559865[_0x07e6('0x43')]['filter']){_0x265cd1['where']=_[_0x07e6('0x5b')](_0x265cd1[_0x07e6('0x42')],{'$or':_[_0x07e6('0x32')](_0x265cd1[_0x07e6('0x46')],function(_0x12713a){var _0x4a9c43={};_0x4a9c43[_0x12713a]={'$like':'%'+_0x559865[_0x07e6('0x43')][_0x07e6('0x30')]+'%'};return _0x4a9c43;})});}_0x265cd1=_[_0x07e6('0x5b')]({},_0x265cd1,_0x559865[_0x07e6('0x5c')]);return _0x1bf4d3[_0x07e6('0xec')](_0x265cd1);}})['then'](function(_0x186d5e){if(_0x186d5e){_0x355dfb=_0x186d5e[_0x07e6('0x4a')];if(!_0x559865['query'][_0x07e6('0xcd')](_0x07e6('0xdb'))){_0x265cd1[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0x559865['query'][_0x07e6('0x22')]);_0x265cd1['offset']=qs[_0x07e6('0x21')](_0x559865['query'][_0x07e6('0x21')]);}return _0x1bf4d3[_0x07e6('0xec')](_0x265cd1);}})['then'](function(_0x133b4b){if(_0x133b4b){return _0x133b4b?{'count':_0x355dfb,'rows':_0x133b4b}:null;}})[_0x07e6('0x14')](respondWithResult(_0x203ba8,null))['catch'](handleError(_0x203ba8,null));};exports[_0x07e6('0xee')]=function(_0x5f23cf,_0x52700d,_0x2d77f2){var _0x1ef4c8;var _0x206b54;var _0x367647;var _0x1c81a4=!_[_0x07e6('0x6e')](_0x5f23cf['params']['id'])?_0x5f23cf[_0x07e6('0x51')]['id']:!_[_0x07e6('0x6e')](_0x5f23cf['user']['id'])?_0x5f23cf[_0x07e6('0x7f')]['id']:null;return db[_0x07e6('0x3b')]['find']({'where':{'id':_0x1c81a4,'role':{'$or':[_0x07e6('0x2d'),_0x07e6('0x7f'),_0x07e6('0x28')]}},'attributes':['id',_0x07e6('0x36'),'phone',_0x07e6('0xef'),_0x07e6('0x2c'),_0x07e6('0x69'),_0x07e6('0x9d')]})['then'](function(_0x2daf54){if(_0x2daf54){if(_0x2daf54[_0x07e6('0x2c')]==='agent'){_0x1ef4c8=_0x2daf54;if(_0x5f23cf['body'][_0x07e6('0xaa')]){_0x367647=util[_0x07e6('0xcb')](_0x07e6('0xf0'),_0x1ef4c8[_0x5f23cf[_0x07e6('0x5f')]['interface']]);}else if(_0x5f23cf[_0x07e6('0x5f')][_0x07e6('0xf1')]){_0x367647=util[_0x07e6('0xcb')]('SIP/%s',_0x5f23cf[_0x07e6('0x5f')]['intrf']);}else{_0x367647=util[_0x07e6('0xcb')](_0x07e6('0xab'),_0x1ef4c8[_0x07e6('0x36')]);}socket['to'](util['format'](_0x07e6('0xf2'),_0x1ef4c8[_0x07e6('0x36')]))[_0x07e6('0x29')](_0x07e6('0xf3'),{'user':{'id':_0x1ef4c8['id'],'name':_0x1ef4c8[_0x07e6('0x36')]},'ip':_0x5f23cf['headers'][_0x07e6('0xf4')]||_0x5f23cf[_0x07e6('0xf5')][_0x07e6('0xf6')]||_0x5f23cf[_0x07e6('0xf7')][_0x07e6('0xf6')]||_0x5f23cf[_0x07e6('0xf5')][_0x07e6('0xf7')]['remoteAddress']});return db[_0x07e6('0xb1')][_0x07e6('0x38')]({'where':{'membername':_0x1ef4c8['name']},'individualHooks':!![]});}}else{throw new db[(_0x07e6('0x91'))][(_0x07e6('0x94'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x1ef4c8){return _0x1ef4c8[_0x07e6('0xf8')]({'raw':!![]});}})['then'](function(_0x99fcf3){if(_0x1ef4c8){if(_0x99fcf3){_0x206b54=_0x99fcf3;if(_0x206b54['length']){var _0x590dd4=_0x206b54[_0x07e6('0x32')](function(_0x3bd8d1){var _0x53a1c1={'membername':_0x1ef4c8[_0x07e6('0x36')],'UserId':_0x1ef4c8['id'],'queue_name':_0x3bd8d1[_0x07e6('0x36')],'VoiceQueueId':_0x3bd8d1['id'],'interface':_0x367647,'paused':_0x1ef4c8[_0x07e6('0x9d')]||![],'penalty':_0x3bd8d1[_0x07e6('0xf9')]||0x0};return db[_0x07e6('0xb1')][_0x07e6('0xfa')](_0x53a1c1);});return Promise[_0x07e6('0x5e')](_0x590dd4);}}}})[_0x07e6('0x14')](function(){if(_0x1ef4c8){return db['MemberReport'][_0x07e6('0x47')]({'where':{'membername':_0x1ef4c8[_0x07e6('0x36')],'exitAt':null}});}})['then'](function(_0x52e036){if(_0x1ef4c8){var _0x569f41=[];_0x52e036['forEach'](function(_0x339402){_0x569f41[_0x07e6('0x4b')](_0x339402[_0x07e6('0x27')]({'exitAt':moment()[_0x07e6('0xcb')](_0x07e6('0xfb'))}));});return Promise[_0x07e6('0x5e')](_0x569f41);}})[_0x07e6('0x14')](function(){if(_0x1ef4c8){var _0x17fad6=[];var _0x2a1c32=[];var _0x358f51=utils[_0x07e6('0xfc')]();var _0x4854b7={'membername':_0x1ef4c8['name'],'interface':_0x367647,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1ef4c8['role'],'internal':_0x1ef4c8[_0x07e6('0x69')]};_0x358f51['forEach'](function(_0x58312d){_0x17fad6[_0x07e6('0x4b')](_[_0x07e6('0x5b')]({'channel':_0x58312d,'type':_0x07e6('0xfd'),'data1':_0x5f23cf[_0x07e6('0x5f')][_0x07e6('0xfe')],'data2':_0x367647},_0x4854b7));if(_0x1ef4c8[_0x07e6('0x9d')]){_0x2a1c32[_0x07e6('0x4b')](_[_0x07e6('0x5b')]({'channel':_0x58312d,'type':_0x07e6('0xff'),'data1':_0x07e6('0x100')},_0x4854b7));}});return db['MemberReport'][_0x07e6('0x87')](_0x17fad6[_0x07e6('0xc8')](_0x2a1c32),{'individualHooks':!![]});}})[_0x07e6('0x14')](function(){if(_0x1ef4c8){return _0x1ef4c8['update']({'online':!![],'lastLoginAt':moment()[_0x07e6('0xcb')](_0x07e6('0xfb')),'voicePause':_0x1ef4c8[_0x07e6('0x9d')]||![],'mailPause':_0x1ef4c8[_0x07e6('0x9d')]||![],'chatPause':_0x1ef4c8[_0x07e6('0x9d')]||![],'faxPause':_0x1ef4c8[_0x07e6('0x9d')]||![],'smsPause':_0x1ef4c8[_0x07e6('0x9d')]||![],'openchannelPause':_0x1ef4c8[_0x07e6('0x9d')]||![],'whatsappPause':_0x1ef4c8[_0x07e6('0x9d')]||![],'pauseType':_0x1ef4c8[_0x07e6('0x9d')]?_0x07e6('0x100'):null,'interface':_0x367647,'lastPauseAt':moment()[_0x07e6('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x400b62){if(_0x5f23cf['isMiddleware']){return _0x2d77f2();}else{return Promise[_0x07e6('0x101')](_0x400b62)['then'](respondWithResult(_0x52700d,null));}})[_0x07e6('0x1d')](handleError(_0x52700d,null));};exports['logout']=function(_0x2e759d,_0x56f9a0){var _0x3b7a9b;return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0x2e759d['params']['id'],'role':_0x07e6('0x28')},'attributes':['id','name',_0x07e6('0x2c')]})['then'](handleEntityNotFound(_0x56f9a0,null))[_0x07e6('0x14')](function(_0x277645){if(_0x277645){_0x3b7a9b=_0x277645;return db[_0x07e6('0xb1')][_0x07e6('0x38')]({'where':{'membername':_0x3b7a9b['name']},'individualHooks':!![]});}})[_0x07e6('0x14')](function(){return db[_0x07e6('0x102')][_0x07e6('0x47')]({'where':{'membername':_0x3b7a9b[_0x07e6('0x36')],'exitAt':null}});})[_0x07e6('0x14')](function(_0xc71724){var _0x35b9c8=[];_0xc71724[_0x07e6('0x103')](function(_0x3cfa65){_0x35b9c8[_0x07e6('0x4b')](_0x3cfa65[_0x07e6('0x27')]({'exitAt':moment()[_0x07e6('0xcb')](_0x07e6('0xfb'))}));});return Promise[_0x07e6('0x5e')](_0x35b9c8);})[_0x07e6('0x14')](function(){return _0x3b7a9b[_0x07e6('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x07e6('0x14')](respondWithResult(_0x56f9a0,null))[_0x07e6('0x1d')](handleError(_0x56f9a0,null));};exports['pause']=function(_0x3c0067,_0x41d297){var _0x3b8f93;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x3c0067['params']['id']},'individualHooks':!![]})[_0x07e6('0x14')](function(){return db[_0x07e6('0x3b')][_0x07e6('0x35')]({'where':{'id':_0x3c0067[_0x07e6('0x51')]['id'],'role':'agent'},'attributes':['id',_0x07e6('0x36'),_0x07e6('0x2c'),'internal','interface','online']});})[_0x07e6('0x14')](handleEntityNotFound(_0x41d297,null))[_0x07e6('0x14')](function(_0x38d978){if(_0x38d978){_0x3b8f93=_0x38d978;return respondWithRpcPromise(_0x07e6('0x104'),'pause',{'id':_0x3b8f93['id'],'name':_0x3b8f93['name'],'pause':!![]});}})[_0x07e6('0x14')](function(){if(_0x3b8f93){return db[_0x07e6('0x102')]['findAll']({'where':{'membername':_0x3b8f93[_0x07e6('0x36')],'type':_0x07e6('0xff'),'exitAt':null}});}})[_0x07e6('0x14')](function(_0x5b9380){if(_0x5b9380['length']){var _0xf92162=moment()[_0x07e6('0xcb')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x426137=0x0,_0x3d5122=_0x5b9380['length'];_0x426137<_0x3d5122;_0x426137++){_0x5b9380[_0x426137][_0x07e6('0x105')]({'exitAt':_0xf92162});}}})['then'](function(){var _0x179c15=[];var _0x17ae78=utils[_0x07e6('0xfc')]();_0x17ae78['forEach'](function(_0x239536){_0x179c15[_0x07e6('0x4b')]({'channel':_0x239536,'membername':_0x3b8f93[_0x07e6('0x36')],'interface':_[_0x07e6('0x6e')](_0x3b8f93[_0x07e6('0xaa')])?util[_0x07e6('0xcb')]('SIP/%s',_0x3b8f93[_0x07e6('0x36')]):_0x3b8f93[_0x07e6('0xaa')],'type':'PAUSE','enterAt':moment()[_0x07e6('0xcb')](_0x07e6('0xfb')),'data1':_0x3c0067['body'][_0x07e6('0x3d')]||_0x07e6('0x106'),'role':_0x3b8f93[_0x07e6('0x2c')],'internal':_0x3b8f93[_0x07e6('0x69')]});});return db[_0x07e6('0x102')][_0x07e6('0x87')](_0x179c15,{'individualHooks':!![]});})[_0x07e6('0x14')](function(){return _0x3b8f93[_0x07e6('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3c0067[_0x07e6('0x5f')][_0x07e6('0x3d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x07e6('0xcb')](_0x07e6('0xfb'))});})[_0x07e6('0x14')](respondWithResult(_0x41d297,null))[_0x07e6('0x1d')](handleError(_0x41d297,null));};exports[_0x07e6('0x107')]=function(_0xd7ca0f,_0x1c8be5){if(_0xd7ca0f[_0x07e6('0x5f')][_0x07e6('0x9b')]&&!utils['isValidChannel'](_0xd7ca0f[_0x07e6('0x5f')][_0x07e6('0x9b')])){throw new APIBadRequestError(util[_0x07e6('0xcb')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0xd7ca0f[_0x07e6('0x5f')][_0x07e6('0x9b')]));}return db['User'][_0x07e6('0x35')]({'where':{'id':_0xd7ca0f[_0x07e6('0x51')]['id']},'attributes':['id',_0x07e6('0x36'),_0x07e6('0x2c'),'internal',_0x07e6('0xaa'),'online',_0x07e6('0xac'),_0x07e6('0x108'),_0x07e6('0x109'),_0x07e6('0x10a'),_0x07e6('0x10b'),'smsPause',_0x07e6('0x10c'),_0x07e6('0x10d'),'lastPauseAt']})['then'](function(_0x527928){if(!_0x527928){throw new APINotFoundError(util[_0x07e6('0xcb')](_0x07e6('0xcc'),_0xd7ca0f[_0x07e6('0x51')]['id']));}return _0x527928[_0x07e6('0x107')](_0xd7ca0f['body'][_0x07e6('0x9b')]);})[_0x07e6('0x14')](respondWithResult(_0x1c8be5,null))[_0x07e6('0x1d')](APIHandleError(_0x1c8be5));};exports[_0x07e6('0x10e')]=function(_0x1753d5,_0x1c0e1e){var _0x161e21={};var _0x127743={};var _0x420301;var _0x895f58;return db[_0x07e6('0x3b')]['findOne']({'where':{'id':_0x1753d5[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x1c0e1e,null))[_0x07e6('0x14')](function(_0x44fb74){if(_0x44fb74){_0x420301=_0x44fb74;_0x127743[_0x07e6('0x56')]=_[_0x07e6('0x53')](db['Team'][_0x07e6('0x3c')]);_0x127743[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x1753d5['query']);_0x127743['filters']=_[_0x07e6('0x55')](_0x127743[_0x07e6('0x56')],_0x127743[_0x07e6('0x43')]);_0x161e21[_0x07e6('0x46')]=_[_0x07e6('0x55')](_0x127743[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0x1753d5[_0x07e6('0x43')][_0x07e6('0x57')]));_0x161e21[_0x07e6('0x46')]=_0x161e21[_0x07e6('0x46')][_0x07e6('0x4a')]?_0x161e21[_0x07e6('0x46')]:_0x127743[_0x07e6('0x56')];_0x161e21[_0x07e6('0xd5')]=qs['sort'](_0x1753d5['query'][_0x07e6('0xd6')]);_0x161e21['where']=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0x1753d5[_0x07e6('0x43')],_0x127743['filters']));if(_0x1753d5[_0x07e6('0x43')][_0x07e6('0x30')]){_0x161e21[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x161e21[_0x07e6('0x42')],{'$or':_['map'](_0x161e21[_0x07e6('0x46')],function(_0x319e08){var _0x845d4b={};_0x845d4b[_0x319e08]={'$like':'%'+_0x1753d5[_0x07e6('0x43')][_0x07e6('0x30')]+'%'};return _0x845d4b;})});}_0x161e21=_[_0x07e6('0x5b')]({},_0x161e21,_0x1753d5['options']);return _0x420301['getTeams'](_0x161e21);}})[_0x07e6('0x14')](function(_0x47d7f8){if(_0x47d7f8){_0x895f58=_0x47d7f8[_0x07e6('0x4a')];if(!_0x1753d5[_0x07e6('0x43')]['hasOwnProperty'](_0x07e6('0xdb'))){_0x161e21[_0x07e6('0x22')]=qs[_0x07e6('0x22')](_0x1753d5['query'][_0x07e6('0x22')]);_0x161e21['offset']=qs[_0x07e6('0x21')](_0x1753d5['query']['offset']);}return _0x420301[_0x07e6('0x10e')](_0x161e21);}})[_0x07e6('0x14')](function(_0x444677){if(_0x444677){return _0x444677?{'count':_0x895f58,'rows':_0x444677}:null;}})[_0x07e6('0x14')](respondWithResult(_0x1c0e1e,null))[_0x07e6('0x1d')](handleError(_0x1c0e1e,null));};exports['addTeams']=function(_0x17be84,_0x36beb5){var _0x47585e=_0x17be84[_0x07e6('0x51')]['id'];var _0x446e3f=_0x17be84[_0x07e6('0x5f')]?_0x17be84[_0x07e6('0x5f')][_0x07e6('0x62')]:null;var _0x1cd525=[];return Promise['resolve']()[_0x07e6('0x14')](function(){if(!_0x446e3f)throw new APIBadRequestError(_0x07e6('0x10f'));})[_0x07e6('0x14')](function(){return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x47585e}});})[_0x07e6('0x14')](function(_0x4f4b3e){if(!_0x4f4b3e)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x17be84[_0x07e6('0x51')]['id']));return db['sequelize'][_0x07e6('0x110')](function(_0x5272b1){return _0x4f4b3e[_0x07e6('0x111')](_0x446e3f,{'transaction':_0x5272b1})[_0x07e6('0x14')](function(){return db[_0x07e6('0x112')][_0x07e6('0x47')]({'where':{'id':{'$in':_0x446e3f}}});})[_0x07e6('0x14')](function(_0x3fab1f){var _0x292902=_[_0x07e6('0x32')](_0x3fab1f,function(_0x30e9e8){return _0x30e9e8[_0x07e6('0x113')]();});return Promise[_0x07e6('0x5e')](_0x292902);})['then'](function(_0x4c0932){_0x1cd525=_['flattenDeep'](_0x4c0932);var _0x23ce79=_[_0x07e6('0x32')](_0x1cd525,function(_0x3b7c4c){return _0x3b7c4c['addAgent'](_0x4f4b3e['id'],{'transaction':_0x5272b1});});return Promise['all'](_0x23ce79);})['then'](function(){if(!_0x4f4b3e[_0x07e6('0x9c')])return;var _0x57d359=_['filter'](_0x1cd525,function(_0x4c65d7){return _0x4c65d7[_0x07e6('0x114')](_0x07e6('0x9b'))===_0x07e6('0x115');});var _0x7e3040=_[_0x07e6('0x32')](_0x57d359,function(_0x19944b){return db[_0x07e6('0xb1')][_0x07e6('0xfa')]({'membername':_0x4f4b3e[_0x07e6('0x36')],'UserId':_0x4f4b3e['id'],'queue_name':_0x19944b[_0x07e6('0x36')],'VoiceQueueId':_0x19944b['id'],'interface':_['isNil'](_0x4f4b3e['interface'])?util[_0x07e6('0xcb')](_0x07e6('0xab'),_0x4f4b3e['name']):_0x4f4b3e[_0x07e6('0xaa')],'paused':_0x4f4b3e[_0x07e6('0xac')]||![],'penalty':_0x4f4b3e[_0x07e6('0xa2')]},{'transaction':_0x5272b1});});return Promise[_0x07e6('0x5e')](_0x7e3040);})[_0x07e6('0x14')](function(){return db[_0x07e6('0x116')][_0x07e6('0x47')]({'where':{'teamId':{'$in':_0x446e3f}}});})[_0x07e6('0x14')](function(_0x5e1b1e){var _0x1b086a=_[_0x07e6('0x32')](_0x5e1b1e,function(_0x1d6b27){return db['UserVoicePrefix'][_0x07e6('0x84')]({'UserId':_0x4f4b3e['id'],'VoicePrefixId':_0x1d6b27[_0x07e6('0x117')]},{'transaction':_0x5272b1});});return Promise[_0x07e6('0x5e')](_0x1b086a);});});})[_0x07e6('0x14')](function(){for(var _0x319f82=0x0;_0x319f82<_0x1cd525[_0x07e6('0x4a')];_0x319f82++){var _0x15011d=_0x1cd525[_0x319f82][_0x07e6('0x114')](_0x07e6('0x9b'));var _0x320b8c=_0x15011d+_0x07e6('0xa6');socket[_0x07e6('0x29')]('user'+_0x15011d+'Queue:save',{'UserId':_0x47585e,['queueField']:_0x1cd525[_0x319f82]['id']});}})[_0x07e6('0x14')](respondWithStatusCode(_0x36beb5,null))[_0x07e6('0x1d')](APIHandleError(_0x36beb5));};exports[_0x07e6('0x118')]=function(_0x308bf6,_0x50e13b){var _0x53abb5=_0x308bf6['params']['id'];var _0x2d1df9=null;if(_0x308bf6[_0x07e6('0x43')][_0x07e6('0x62')]){_0x2d1df9=_[_0x07e6('0xaf')](_0x308bf6[_0x07e6('0x43')][_0x07e6('0x62')])?_0x308bf6[_0x07e6('0x43')][_0x07e6('0x62')]:[_0x308bf6[_0x07e6('0x43')][_0x07e6('0x62')]];}var _0xc8b023=[];return Promise[_0x07e6('0x101')]()[_0x07e6('0x14')](function(){if(!_0x2d1df9)throw new APIBadRequestError(_0x07e6('0x119'));})[_0x07e6('0x14')](function(){return db[_0x07e6('0x3b')][_0x07e6('0xca')]({'where':{'id':_0x53abb5}});})['then'](function(_0x1f6018){if(!_0x1f6018)throw new APINotFoundError(util[_0x07e6('0xcb')]('User\x20with\x20id\x20%s\x20not\x20found',_0x308bf6[_0x07e6('0x51')]['id']));return db['sequelize'][_0x07e6('0x110')](function(_0x23c601){return _0x1f6018[_0x07e6('0x118')](_0x2d1df9,{'transaction':_0x23c601})[_0x07e6('0x14')](function(){return db[_0x07e6('0x112')]['findAll']({'where':{'id':{'$in':_0x2d1df9}}});})[_0x07e6('0x14')](function(_0x239d24){var _0x409cd6=_[_0x07e6('0x32')](_0x239d24,function(_0x65d04f){return _0x65d04f[_0x07e6('0x113')]();});return Promise[_0x07e6('0x5e')](_0x409cd6);})['then'](function(_0x2021e4){_0xc8b023=_[_0x07e6('0x11a')](_0x2021e4);var _0x14b1e0=_[_0x07e6('0x32')](_0xc8b023,function(_0x5692da){return _0x5692da[_0x07e6('0x11b')](_0x1f6018['id'],{'transaction':_0x23c601});});return Promise[_0x07e6('0x5e')](_0x14b1e0);})['then'](function(){if(!_0x1f6018[_0x07e6('0x9c')])return;var _0xb1b2b6=_[_0x07e6('0x30')](_0xc8b023,function(_0x261d36){return _0x261d36['getDataValue'](_0x07e6('0x9b'))===_0x07e6('0x115');});var _0x3a9127=_['map'](_0xb1b2b6,function(_0x1f05e4){return db[_0x07e6('0xb1')][_0x07e6('0x38')]({'where':{'VoiceQueueId':_0x1f05e4['id'],'UserId':_0x1f6018['id']},'transaction':_0x23c601});});return Promise[_0x07e6('0x5e')](_0x3a9127);})['then'](function(){return db[_0x07e6('0x116')][_0x07e6('0x47')]({'where':{'teamId':{'$in':_0x2d1df9}}});})[_0x07e6('0x14')](function(_0x1c6037){var _0x423565=_[_0x07e6('0x32')](_0x1c6037,function(_0x50acc7){return db[_0x07e6('0x11c')][_0x07e6('0x38')]({'where':{'UserId':_0x1f6018['id'],'VoicePrefixId':_0x50acc7[_0x07e6('0x117')]}},{'transaction':_0x23c601});});return Promise[_0x07e6('0x5e')](_0x423565);});});})[_0x07e6('0x14')](function(){for(var _0x1f28bc=0x0;_0x1f28bc<_0xc8b023[_0x07e6('0x4a')];_0x1f28bc++){var _0x28c60e=_0xc8b023[_0x1f28bc][_0x07e6('0x114')](_0x07e6('0x9b'));var _0x5713ec=_0x28c60e+'QueueId';socket['emit'](_0x07e6('0x7f')+_0x28c60e+'Queue:remove',{'UserId':_0x53abb5,['queueField']:_0xc8b023[_0x1f28bc]['id']});}})[_0x07e6('0x14')](respondWithStatusCode(_0x50e13b,null))['catch'](APIHandleError(_0x50e13b));};exports[_0x07e6('0x11d')]=function(_0x19a0cd,_0x2e345b){var _0xdbff5c={};var _0x252489={};var _0x1ae0fe;var _0x66bc99;return db['User'][_0x07e6('0xca')]({'where':{'id':_0x19a0cd[_0x07e6('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e345b,null))['then'](function(_0x583ac8){if(_0x583ac8){_0x1ae0fe=_0x583ac8;_0x252489['model']=_['keys'](db[_0x07e6('0xce')][_0x07e6('0x3c')]);_0x252489[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x19a0cd[_0x07e6('0x43')]);_0x252489[_0x07e6('0x54')]=_['intersection'](_0x252489[_0x07e6('0x56')],_0x252489[_0x07e6('0x43')]);_0xdbff5c['attributes']=_[_0x07e6('0x55')](_0x252489['model'],qs[_0x07e6('0x57')](_0x19a0cd['query']['fields']));_0xdbff5c[_0x07e6('0x46')]=_0xdbff5c[_0x07e6('0x46')][_0x07e6('0x4a')]?_0xdbff5c[_0x07e6('0x46')]:_0x252489[_0x07e6('0x56')];_0xdbff5c[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x19a0cd['query']['sort']);_0xdbff5c[_0x07e6('0x42')]=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0x19a0cd[_0x07e6('0x43')],_0x252489['filters']));if(_0x19a0cd[_0x07e6('0x43')]['filter']){_0xdbff5c['where']=_['merge'](_0xdbff5c['where'],{'$or':_[_0x07e6('0x32')](_0xdbff5c[_0x07e6('0x46')],function(_0xbc8c14){var _0x3b90a7={};_0x3b90a7[_0xbc8c14]={'$like':'%'+_0x19a0cd['query'][_0x07e6('0x30')]+'%'};return _0x3b90a7;})});}_0xdbff5c=_[_0x07e6('0x5b')]({},_0xdbff5c,_0x19a0cd['options']);return _0x1ae0fe[_0x07e6('0x11d')](_0xdbff5c);}})['then'](function(_0x1256a2){if(_0x1256a2){_0x66bc99=_0x1256a2[_0x07e6('0x4a')];if(!_0x19a0cd[_0x07e6('0x43')][_0x07e6('0xcd')]('nolimit')){_0xdbff5c[_0x07e6('0x22')]=qs['limit'](_0x19a0cd[_0x07e6('0x43')][_0x07e6('0x22')]);_0xdbff5c[_0x07e6('0x21')]=qs['offset'](_0x19a0cd['query']['offset']);}return _0x1ae0fe['getLists'](_0xdbff5c);}})[_0x07e6('0x14')](function(_0x538120){if(_0x538120){return _0x538120?{'count':_0x66bc99,'rows':_0x538120}:null;}})[_0x07e6('0x14')](respondWithResult(_0x2e345b,null))[_0x07e6('0x1d')](handleError(_0x2e345b,null));};exports[_0x07e6('0x11e')]=function(_0x18fac7,_0x39cb08){var _0x267c23={};var _0x1cc568={};var _0x4abad0;return db['User'][_0x07e6('0xca')]({'where':{'id':_0x18fac7[_0x07e6('0x51')]['id']}})[_0x07e6('0x14')](handleEntityNotFound(_0x39cb08,null))[_0x07e6('0x14')](function(_0x7585b8){if(_0x7585b8){_0x4abad0=_0x7585b8;_0x1cc568['model']=_[_0x07e6('0x53')](db['User'][_0x07e6('0x3c')]);_0x1cc568[_0x07e6('0x43')]=_[_0x07e6('0x53')](_0x18fac7[_0x07e6('0x43')]);_0x1cc568['filters']=_[_0x07e6('0x55')](_0x1cc568[_0x07e6('0x56')],_0x1cc568['query']);_0x267c23['attributes']=_[_0x07e6('0x55')](_0x1cc568[_0x07e6('0x56')],qs[_0x07e6('0x57')](_0x18fac7['query'][_0x07e6('0x57')]));_0x267c23[_0x07e6('0x46')]=_0x267c23['attributes']['length']?_0x267c23[_0x07e6('0x46')]:_0x1cc568[_0x07e6('0x56')];_0x267c23[_0x07e6('0xd5')]=qs[_0x07e6('0xd6')](_0x18fac7[_0x07e6('0x43')][_0x07e6('0xd6')]);_0x267c23[_0x07e6('0x42')]=qs[_0x07e6('0x54')](_[_0x07e6('0xd7')](_0x18fac7[_0x07e6('0x43')],_0x1cc568[_0x07e6('0x54')]));if(_0x18fac7[_0x07e6('0x43')][_0x07e6('0x30')]){_0x267c23[_0x07e6('0x42')]=_[_0x07e6('0x5b')](_0x267c23['where'],{'$or':_[_0x07e6('0x32')](_0x267c23[_0x07e6('0x46')],function(_0x873766){var _0x5d854b={};_0x5d854b[_0x873766]={'$like':'%'+_0x18fac7[_0x07e6('0x43')][_0x07e6('0x30')]+'%'};return _0x5d854b;})});}_0x267c23[_0x07e6('0x56')]=db[_0x07e6('0x3b')];_0x267c23['as']=_0x07e6('0x2e');_0x267c23=_[_0x07e6('0x5b')]({},_0x267c23,_0x18fac7[_0x07e6('0x5c')]);return _0x4abad0['getVoiceQueues']({'include':[_0x267c23]});}})[_0x07e6('0x14')](function(_0x5627f5){if(_0x5627f5){var _0x562aa3={},_0x170ee0=[];for(var _0x491159=0x0;_0x491159<_0x5627f5[_0x07e6('0x4a')];_0x491159+=0x1){for(var _0x3f38d3=0x0,_0x5acebe;_0x3f38d3<_0x5627f5[_0x491159]['Agents'][_0x07e6('0x4a')];_0x3f38d3+=0x1){_0x5acebe=_0x5627f5[_0x491159]['Agents'][_0x3f38d3]['get']({'plain':!![]});_0x562aa3[_0x5acebe['id']]=_0x5acebe;}}_0x562aa3=_['values'](_0x562aa3);for(var _0x44cd62=qs['offset'](_0x18fac7['query'][_0x07e6('0x21')]);_0x44cd62<_0x562aa3['length']&&_0x170ee0['length']=_0x1f43bd[_0x0422('0x48')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0422('0x16')](function(){if(_0x2b5818){return db['UserVoiceQueueRt'][_0x0422('0x3f')]({'where':{'membername':_0x2b5818[_0x0422('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x2b5818){return _0x2b5818[_0x0422('0x49')]({'raw':!![]});}})[_0x0422('0x16')](function(_0x4c1634){if(_0x2b5818){if(_0x4c1634){var _0x54b97a=[];_0xa391b5=_0x4c1634;if(_0xa391b5[_0x0422('0x40')]){for(var _0x34c93d=0x0;_0x34c93d<_0xa391b5[_0x0422('0x40')];_0x34c93d++){_0x54b97a[_0x0422('0x2d')](db['UserVoiceQueueRt'][_0x0422('0x4a')]({'membername':_0x2b5818[_0x0422('0x27')],'UserId':_0x2b5818['id'],'queue_name':_0xa391b5[_0x34c93d][_0x0422('0x27')],'VoiceQueueId':_0xa391b5[_0x34c93d]['id'],'interface':_0x793a13,'paused':_0x2b5818[_0x0422('0x4b')]||![],'penalty':_0xa391b5[_0x34c93d][_0x0422('0x4c')]||0x0}));}return BPromise[_0x0422('0x4d')](_0x54b97a);}}}})[_0x0422('0x16')](function(){if(_0x2b5818){return db[_0x0422('0x32')][_0x0422('0xd')]({'where':{'membername':_0x2b5818[_0x0422('0x27')],'exitAt':null}});}})['then'](function(_0x265080){if(_0x2b5818){if(_0x265080&&_0x265080[_0x0422('0x40')]){var _0x5cacfc=[];_0x265080[_0x0422('0x4e')](function(_0x257e88){_0x5cacfc[_0x0422('0x2d')](_0x257e88[_0x0422('0x26')]({'exitAt':moment()[_0x0422('0x29')](_0x0422('0x2a'))}));});return BPromise[_0x0422('0x4d')](_0x5cacfc);}}})[_0x0422('0x16')](function(){if(_0x2b5818){var _0x1f1488=[];var _0xf4af9e=[];var _0x2d0223=utils[_0x0422('0x2c')]();var _0xeecef={'membername':_0x2b5818[_0x0422('0x27')],'interface':_0x793a13,'enterAt':moment()[_0x0422('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2b5818['role'],'internal':_0x2b5818[_0x0422('0x22')]};_0x2d0223[_0x0422('0x4e')](function(_0xc8e6b7){_0x1f1488[_0x0422('0x2d')](_[_0x0422('0x4f')]({'channel':_0xc8e6b7,'type':_0x0422('0x50'),'data1':_0x0422('0x51'),'data2':_0x793a13},_0xeecef));if(_0x2b5818[_0x0422('0x4b')]){_0xf4af9e[_0x0422('0x2d')](_[_0x0422('0x4f')]({'channel':_0xc8e6b7,'type':'PAUSE','data1':_0x0422('0x52')},_0xeecef));}});return db['MemberReport']['bulkCreate'](_0x1f1488[_0x0422('0x53')](_0xf4af9e),{'individualHooks':!![]});}})[_0x0422('0x16')](function(){if(_0x2b5818){return _0x2b5818['update']({'online':!![],'lastLoginAt':moment()[_0x0422('0x29')](_0x0422('0x2a')),'voicePause':_0x2b5818[_0x0422('0x4b')]||![],'mailPause':_0x2b5818[_0x0422('0x4b')]||![],'chatPause':_0x2b5818[_0x0422('0x4b')]||![],'faxPause':_0x2b5818[_0x0422('0x4b')]||![],'smsPause':_0x2b5818[_0x0422('0x4b')]||![],'openchannelPause':_0x2b5818[_0x0422('0x4b')]||![],'pauseType':_0x2b5818[_0x0422('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x0422('0x29')](_0x0422('0x2a')),'interface':_0x793a13});}})[_0x0422('0x16')](function(_0x112c5c){_0x361d58(_0x112c5c);})[_0x0422('0x1b')](function(_0xd4ca33){_0x517240(_0x26807d['error'](0x1f4,_0xd4ca33[_0x0422('0x1c')]));});});}; \ No newline at end of file +var _0x521a=['format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','name','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','role','uniqueid','MemberReport','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','openchannelPause','smsPause','lastPauseAt','unpause','system','LogoutUser','all','LoginUser','phone','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','loginInPause','PAUSE','LOGININPAUSE','util','moment','bluebird','../../config/utils','../../config/logger','rpc','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','User','findAll','raw','where','attributes','options','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowUser','find','PauseUser','internal'];(function(_0x48b850,_0x4b177a){var _0x19acdd=function(_0x5c5c65){while(--_0x5c5c65){_0x48b850['push'](_0x48b850['shift']());}};_0x19acdd(++_0x4b177a);}(_0x521a,0xde));var _0xa521=function(_0x39d9ec,_0x4ed6e5){_0x39d9ec=_0x39d9ec-0x0;var _0x499ff0=_0x521a[_0x39d9ec];return _0x499ff0;};'use strict';var _=require('lodash');var util=require(_0xa521('0x0'));var moment=require(_0xa521('0x1'));var BPromise=require(_0xa521('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa521('0x3'));var logger=require(_0xa521('0x4'))(_0xa521('0x5'));var config=require('../../config/environment');config[_0xa521('0x6')]=_[_0xa521('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa521('0x8'))(new Redis(config[_0xa521('0x6')]));require(_0xa521('0x9'))[_0xa521('0xa')](socket);exports[_0xa521('0xb')]=function(_0x3c0cdf){var _0x49b380=this;return new Promise(function(_0x402564,_0x3ce626){return db[_0xa521('0xc')][_0xa521('0xd')]({'raw':_0x3c0cdf['options']?_0x3c0cdf['options'][_0xa521('0xe')]===undefined?!![]:![]:!![],'where':_0x3c0cdf['options']?_0x3c0cdf['options'][_0xa521('0xf')]||null:null,'attributes':_0x3c0cdf['options']?_0x3c0cdf['options'][_0xa521('0x10')]||null:null,'limit':_0x3c0cdf[_0xa521('0x11')]?_0x3c0cdf[_0xa521('0x11')][_0xa521('0x12')]||null:null,'include':_0x3c0cdf[_0xa521('0x11')]?_0x3c0cdf[_0xa521('0x11')][_0xa521('0x13')]?_[_0xa521('0x14')](_0x3c0cdf[_0xa521('0x11')][_0xa521('0x13')],function(_0x242c18){return{'model':db[_0x242c18[_0xa521('0x15')]],'as':_0x242c18['as'],'attributes':_0x242c18[_0xa521('0x10')],'include':_0x242c18['include']?_[_0xa521('0x14')](_0x242c18[_0xa521('0x13')],function(_0x2d8c0d){return{'model':db[_0x2d8c0d[_0xa521('0x15')]],'as':_0x2d8c0d['as'],'attributes':_0x2d8c0d[_0xa521('0x10')],'include':_0x2d8c0d['include']?_[_0xa521('0x14')](_0x2d8c0d[_0xa521('0x13')],function(_0x31429c){return{'model':db[_0x31429c[_0xa521('0x15')]],'as':_0x31429c['as'],'attributes':_0x31429c[_0xa521('0x10')]};}):[]};}):[]};}):[]:[]})[_0xa521('0x16')](function(_0x1f8dfd){logger[_0xa521('0x17')]('GetUser',_0x3c0cdf);logger[_0xa521('0x18')]('GetUser',_0x3c0cdf,JSON[_0xa521('0x19')](_0x1f8dfd));_0x402564(_0x1f8dfd);})[_0xa521('0x1a')](function(_0x1e3f5e){logger['error']('GetUser',_0x1e3f5e[_0xa521('0x1b')],_0x3c0cdf);_0x3ce626(_0x49b380[_0xa521('0x1c')](0x1f4,_0x1e3f5e['message']));});});};exports[_0xa521('0x1d')]=function(_0x1d7e2d){var _0x539fc7=this;return new Promise(function(_0x3baa02,_0xf3332d){return db['User'][_0xa521('0x1e')]({'raw':_0x1d7e2d['options']?_0x1d7e2d[_0xa521('0x11')][_0xa521('0xe')]===undefined?!![]:![]:!![],'where':_0x1d7e2d[_0xa521('0x11')]?_0x1d7e2d[_0xa521('0x11')][_0xa521('0xf')]||null:null,'attributes':_0x1d7e2d[_0xa521('0x11')]?_0x1d7e2d[_0xa521('0x11')][_0xa521('0x10')]||null:null,'include':_0x1d7e2d[_0xa521('0x11')]?_0x1d7e2d['options'][_0xa521('0x13')]?_[_0xa521('0x14')](_0x1d7e2d[_0xa521('0x11')][_0xa521('0x13')],function(_0x135d3e){return{'model':db[_0x135d3e[_0xa521('0x15')]],'as':_0x135d3e['as'],'attributes':_0x135d3e[_0xa521('0x10')],'include':_0x135d3e['include']?_[_0xa521('0x14')](_0x135d3e[_0xa521('0x13')],function(_0x206f09){return{'model':db[_0x206f09[_0xa521('0x15')]],'as':_0x206f09['as'],'attributes':_0x206f09['attributes'],'include':_0x206f09['include']?_[_0xa521('0x14')](_0x206f09[_0xa521('0x13')],function(_0x21287d){return{'model':db[_0x21287d[_0xa521('0x15')]],'as':_0x21287d['as'],'attributes':_0x21287d[_0xa521('0x10')]};}):[]};}):[]};}):[]:[]})[_0xa521('0x16')](function(_0x86515b){logger[_0xa521('0x17')](_0xa521('0x1d'),_0x1d7e2d);logger[_0xa521('0x18')](_0xa521('0x1d'),_0x1d7e2d,JSON[_0xa521('0x19')](_0x86515b));_0x3baa02(_0x86515b);})['catch'](function(_0x4e7208){logger[_0xa521('0x1c')]('ShowUser',_0x4e7208[_0xa521('0x1b')],_0x1d7e2d);_0xf3332d(_0x539fc7[_0xa521('0x1c')](0x1f4,_0x4e7208['message']));});});};exports[_0xa521('0x1f')]=function(_0xe88308){var _0x33ebf0;return db[_0xa521('0xc')][_0xa521('0x1e')]({'where':_0xe88308[_0xa521('0x11')][_0xa521('0xf')]||{},'attributes':['id','name','role',_0xa521('0x20'),'interface']})[_0xa521('0x16')](function(_0x3bdfd4){if(!_0x3bdfd4){throw new Error(util[_0xa521('0x21')](_0xa521('0x22'),_0xe88308[_0xa521('0x23')]['id']));}_0x33ebf0=_0x3bdfd4;return db[_0xa521('0x24')][_0xa521('0x25')]({'paused':0x1},{'where':{'UserId':_0x33ebf0['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x33ebf0[_0xa521('0x26')],'type':'PAUSE','exitAt':null}});})[_0xa521('0x16')](function(_0x26bcde){if(_0x26bcde&&_0x26bcde[_0xa521('0x27')]){var _0x4afd9e=moment()[_0xa521('0x21')](_0xa521('0x28'));for(var _0x226fa6=0x0,_0x2d9c3d=_0x26bcde[_0xa521('0x27')];_0x226fa6<_0x2d9c3d;_0x226fa6++){_0x26bcde[_0x226fa6][_0xa521('0x29')]({'exitAt':_0x4afd9e});}}})[_0xa521('0x16')](function(){var _0x385609=[];var _0x3c8268=utils[_0xa521('0x2a')]();_0x3c8268[_0xa521('0x2b')](function(_0x5efc51){_0x385609[_0xa521('0x2c')]({'channel':_0x5efc51,'membername':_0x33ebf0[_0xa521('0x26')],'interface':_['isNil'](_0x33ebf0[_0xa521('0x2d')])?util['format'](_0xa521('0x2e'),_0x33ebf0['name']):_0x33ebf0['interface'],'type':'PAUSE','enterAt':moment()['format'](_0xa521('0x28')),'data1':_0xe88308[_0xa521('0x2f')][_0xa521('0x30')]||_0xa521('0x31'),'role':_0x33ebf0[_0xa521('0x32')],'internal':_0x33ebf0[_0xa521('0x20')],'uniqueid':_0xe88308[_0xa521('0x2f')][_0xa521('0x33')]||null});});return db[_0xa521('0x34')][_0xa521('0x35')](_0x385609,{'individualHooks':!![]});})[_0xa521('0x16')](function(){return _0x33ebf0[_0xa521('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xe88308['body']['type']||_0xa521('0x31'),'lastPauseAt':moment()[_0xa521('0x21')](_0xa521('0x28'))});})['catch'](function(_0x3e9ad2){throw _0x3e9ad2;});};exports[_0xa521('0x36')]=function(_0x1283e2){return Promise[_0xa521('0x37')]()[_0xa521('0x16')](function(){if(_0x1283e2[_0xa521('0x2f')][_0xa521('0x38')]&&!utils[_0xa521('0x39')](_0x1283e2[_0xa521('0x2f')][_0xa521('0x38')])){throw new Error(util['format'](_0xa521('0x3a'),_0x1283e2[_0xa521('0x2f')][_0xa521('0x38')]));}return db['User'][_0xa521('0x3b')]({'where':_0x1283e2['options'][_0xa521('0xf')]||{},'attributes':['id',_0xa521('0x26'),_0xa521('0x32'),_0xa521('0x20'),_0xa521('0x2d'),_0xa521('0x3c'),_0xa521('0x3d'),_0xa521('0x3e'),'chatPause','faxPause',_0xa521('0x3f'),_0xa521('0x40'),'whatsappPause','pauseType',_0xa521('0x41')]});})[_0xa521('0x16')](function(_0x259600){if(!_0x259600){throw new Error(util['format'](_0xa521('0x22'),_0x1283e2['params']['id']));}return _0x259600[_0xa521('0x42')](_0x1283e2['body'][_0xa521('0x38')],_0xa521('0x43'));})['catch'](function(_0x57b16b){throw _0x57b16b;});};exports[_0xa521('0x44')]=function(_0xe9dc57){var _0x3e850e=this;return new Promise(function(_0x3d190e,_0x5bd6b0){var _0x1d92ee;return db[_0xa521('0xc')]['findOne']({'where':_0xe9dc57[_0xa521('0x11')][_0xa521('0xf')]||{},'attributes':['id','name']})[_0xa521('0x16')](function(_0x477e32){if(_0x477e32){_0x1d92ee=_0x477e32;return db[_0xa521('0x24')]['destroy']({'where':{'membername':_0x1d92ee[_0xa521('0x26')]},'individualHooks':!![]});}})[_0xa521('0x16')](function(){if(_0x1d92ee){return db[_0xa521('0x34')]['findAll']({'where':{'membername':_0x1d92ee[_0xa521('0x26')],'exitAt':null}});}})[_0xa521('0x16')](function(_0x709ab0){if(_0x1d92ee){if(_0x709ab0&&_0x709ab0[_0xa521('0x27')]){var _0x4dfd4a=[];_0x709ab0['forEach'](function(_0x4eb3ce){_0x4dfd4a[_0xa521('0x2c')](_0x4eb3ce[_0xa521('0x25')]({'exitAt':moment()[_0xa521('0x21')](_0xa521('0x28'))}));});return BPromise[_0xa521('0x45')](_0x4dfd4a);}}})[_0xa521('0x16')](function(){if(_0x1d92ee){return _0x1d92ee[_0xa521('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa521('0x16')](function(_0x273557){_0x3d190e(_0x273557);})['catch'](function(_0x3d7578){_0x5bd6b0(_0x3e850e[_0xa521('0x1c')](0x1f4,_0x3d7578[_0xa521('0x1b')]));});});};exports[_0xa521('0x46')]=function(_0xb5c59){var _0x800bf=this;return new Promise(function(_0x1b458a,_0x59db1c){var _0x541284;var _0x58914a;var _0x56757b;var _0x17ffa4;return db['User']['findOne']({'where':_0xb5c59[_0xa521('0x11')][_0xa521('0xf')]||{},'attributes':['id','name',_0xa521('0x32'),'mobile',_0xa521('0x47'),_0xa521('0x20'),'loginInPause',_0xa521('0x2d')]})[_0xa521('0x16')](function(_0x35e284){if(_0x35e284){_0x541284=_0x35e284;_0x17ffa4=_0xb5c59[_0xa521('0x2f')][_0xa521('0x2d')]?_0xb5c59[_0xa521('0x2f')]['interface']:util[_0xa521('0x21')](_0xa521('0x2e'),_0x541284[_0xa521('0x26')]);return db[_0xa521('0xc')][_0xa521('0x48')]({'where':{'role':_0xa521('0x49'),'online':!![],'id':{'$ne':_0x541284['id']}}});}})[_0xa521('0x16')](function(_0x17eaa0){if(_0x17eaa0){_0x56757b=_0x17eaa0;return require('../../config/license/util')[_0xa521('0x4a')]();}})[_0xa521('0x16')](function(_0xeefb80){if(_0xeefb80&&_0xeefb80[_0xa521('0x4b')]&&_0x56757b>=_0xeefb80[_0xa521('0x4b')]){throw new Error(_0xa521('0x4c'));}})[_0xa521('0x16')](function(){if(_0x541284){return db[_0xa521('0x24')]['destroy']({'where':{'membername':_0x541284['name']},'individualHooks':!![]});}})[_0xa521('0x16')](function(){if(_0x541284){return _0x541284['getVoiceQueues']({'raw':!![]});}})[_0xa521('0x16')](function(_0x3fba05){if(_0x541284){if(_0x3fba05){var _0x5853cb=[];_0x58914a=_0x3fba05;if(_0x58914a[_0xa521('0x27')]){for(var _0x27155f=0x0;_0x27155f<_0x58914a[_0xa521('0x27')];_0x27155f++){_0x5853cb['push'](db['UserVoiceQueueRt'][_0xa521('0x4d')]({'membername':_0x541284[_0xa521('0x26')],'UserId':_0x541284['id'],'queue_name':_0x58914a[_0x27155f][_0xa521('0x26')],'VoiceQueueId':_0x58914a[_0x27155f]['id'],'interface':_0x17ffa4,'paused':_0x541284['loginInPause']||![],'penalty':_0x58914a[_0x27155f][_0xa521('0x4e')]||0x0}));}return BPromise[_0xa521('0x45')](_0x5853cb);}}}})[_0xa521('0x16')](function(){if(_0x541284){return db[_0xa521('0x34')]['findAll']({'where':{'membername':_0x541284[_0xa521('0x26')],'exitAt':null}});}})[_0xa521('0x16')](function(_0x35d917){if(_0x541284){if(_0x35d917&&_0x35d917[_0xa521('0x27')]){var _0x5f42bf=[];_0x35d917[_0xa521('0x2b')](function(_0x3e3fd8){_0x5f42bf['push'](_0x3e3fd8[_0xa521('0x25')]({'exitAt':moment()[_0xa521('0x21')](_0xa521('0x28'))}));});return BPromise[_0xa521('0x45')](_0x5f42bf);}}})['then'](function(){if(_0x541284){var _0x5c4944=[];var _0x423d18=[];var _0x34c195=utils['getChannels']();var _0x315779={'membername':_0x541284[_0xa521('0x26')],'interface':_0x17ffa4,'enterAt':moment()[_0xa521('0x21')](_0xa521('0x28')),'role':_0x541284[_0xa521('0x32')],'internal':_0x541284['internal']};_0x34c195[_0xa521('0x2b')](function(_0x238239){_0x5c4944[_0xa521('0x2c')](_[_0xa521('0x4f')]({'channel':_0x238239,'type':_0xa521('0x50'),'data1':_0xa521('0x51'),'data2':_0x17ffa4},_0x315779));if(_0x541284[_0xa521('0x52')]){_0x423d18['push'](_[_0xa521('0x4f')]({'channel':_0x238239,'type':_0xa521('0x53'),'data1':_0xa521('0x54')},_0x315779));}});return db['MemberReport'][_0xa521('0x35')](_0x5c4944['concat'](_0x423d18),{'individualHooks':!![]});}})[_0xa521('0x16')](function(){if(_0x541284){return _0x541284['update']({'online':!![],'lastLoginAt':moment()[_0xa521('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x541284[_0xa521('0x52')]||![],'mailPause':_0x541284[_0xa521('0x52')]||![],'chatPause':_0x541284[_0xa521('0x52')]||![],'faxPause':_0x541284[_0xa521('0x52')]||![],'smsPause':_0x541284[_0xa521('0x52')]||![],'openchannelPause':_0x541284['loginInPause']||![],'pauseType':_0x541284[_0xa521('0x52')]?_0xa521('0x54'):null,'lastPauseAt':moment()[_0xa521('0x21')](_0xa521('0x28')),'interface':_0x17ffa4});}})[_0xa521('0x16')](function(_0x1f9ed1){_0x1b458a(_0x1f9ed1);})['catch'](function(_0x4356de){_0x59db1c(_0x800bf[_0xa521('0x1c')](0x1f4,_0x4356de[_0xa521('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7412cfd..89b413a 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 _0x49be=['register','length','./user.events','save','remove','update','removeListener'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0x49be,0xbf));var _0xe49b=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x49be[_0x28aea5];return _0x6a55f9;};'use strict';var UserEvents=require(_0xe49b('0x0'));var events=[_0xe49b('0x1'),_0xe49b('0x2'),_0xe49b('0x3')];function createListener(_0x37d2c8,_0x4cb54c){return function(_0x420bec){_0x4cb54c['emit'](_0x37d2c8,_0x420bec);};}function removeListener(_0x329cd6,_0x248460){return function(){UserEvents[_0xe49b('0x4')](_0x329cd6,_0x248460);};}exports[_0xe49b('0x5')]=function(_0x2d6d9f){for(var _0x25bec7=0x0,_0x1008ce=events[_0xe49b('0x6')];_0x25bec7<_0x1008ce;_0x25bec7++){var _0x8f7455=events[_0x25bec7];var _0x240804=createListener('user:'+_0x8f7455,_0x2d6d9f);UserEvents['on'](_0x8f7455,_0x240804);}}; \ No newline at end of file +var _0x5581=['save','update','emit','removeListener','register','length'];(function(_0x128a79,_0x19f331){var _0x2ff426=function(_0x57ffc1){while(--_0x57ffc1){_0x128a79['push'](_0x128a79['shift']());}};_0x2ff426(++_0x19f331);}(_0x5581,0xa8));var _0x1558=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x5581[_0x403c20];return _0x2b271a;};'use strict';var UserEvents=require('./user.events');var events=[_0x1558('0x0'),'remove',_0x1558('0x1')];function createListener(_0x53f241,_0x2a05bb){return function(_0x2ef17a){_0x2a05bb[_0x1558('0x2')](_0x53f241,_0x2ef17a);};}function removeListener(_0x496d40,_0x5a7ad0){return function(){UserEvents[_0x1558('0x3')](_0x496d40,_0x5a7ad0);};}exports[_0x1558('0x4')]=function(_0x4bc50d){for(var _0x37705f=0x0,_0x541fdd=events[_0x1558('0x5')];_0x37705f<_0x541fdd;_0x37705f++){var _0x54f54d=events[_0x37705f];var _0x173d04=createListener('user:'+_0x54f54d,_0x4bc50d);UserEvents['on'](_0x54f54d,_0x173d04);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 8457aa9..6d8d2eb 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x283533,_0x3cfc01){var _0x3ade22=function(_0x4424ab){while(--_0x4424ab){_0x283533['push'](_0x283533['shift']());}};_0x3ade22(++_0x3cfc01);}(_0x70e0,0x17b));var _0x070e=function(_0x18e94b,_0x217fa2){_0x18e94b=_0x18e94b-0x0;var _0x213a9a=_0x70e0[_0x18e94b];return _0x213a9a;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xe470b2,_0x13d3be){var _0x373fd7=function(_0x5c782b){while(--_0x5c782b){_0xe470b2['push'](_0xe470b2['shift']());}};_0x373fd7(++_0x13d3be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 951b188..0e1deca 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 _0x624b=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x624b,0x1b0));var _0xb624=function(_0x4bd540,_0x3be25a){_0x4bd540=_0x4bd540-0x0;var _0x2f8c3a=_0x624b[_0x4bd540];return _0x2f8c3a;};'use strict';var Sequelize=require(_0xb624('0x0'));module[_0xb624('0x1')]={'penalty':{'type':Sequelize[_0xb624('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd05f=['sequelize','exports'];(function(_0x26ace4,_0x492571){var _0xa3775d=function(_0x3d7d8b){while(--_0x3d7d8b){_0x26ace4['push'](_0x26ace4['shift']());}};_0xa3775d(++_0x492571);}(_0xd05f,0x96));var _0xfd05=function(_0x356d0f,_0x37ace5){_0x356d0f=_0x356d0f-0x0;var _0xded3cb=_0xd05f[_0x356d0f];return _0xded3cb;};'use strict';var Sequelize=require(_0xfd05('0x0'));module[_0xfd05('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 e86b86c..f98108b 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 _0xe94b=['../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','util','api','moment','path'];(function(_0xb94a22,_0x18f90f){var _0x45370e=function(_0x377600){while(--_0x377600){_0xb94a22['push'](_0xb94a22['shift']());}};_0x45370e(++_0x18f90f);}(_0xe94b,0x17f));var _0xbe94=function(_0x47c8bb,_0x294561){_0x47c8bb=_0x47c8bb-0x0;var _0x1f8741=_0xe94b[_0x47c8bb];return _0x1f8741;};'use strict';var _=require('lodash');var util=require(_0xbe94('0x0'));var logger=require('../../config/logger')(_0xbe94('0x1'));var moment=require(_0xbe94('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe94('0x3'));var rimraf=require('rimraf');var config=require(_0xbe94('0x4'));var attributes=require(_0xbe94('0x5'));module[_0xbe94('0x6')]=function(_0x53dde8,_0x5d4ad3){return _0x53dde8[_0xbe94('0x7')]('UserChatQueue',attributes,{'tableName':_0xbe94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0747=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0747,0xdc));var _0x7074=function(_0x2f6307,_0xa6901d){_0x2f6307=_0x2f6307-0x0;var _0xdfc29c=_0x0747[_0x2f6307];return _0xdfc29c;};'use strict';var _=require(_0x7074('0x0'));var util=require(_0x7074('0x1'));var logger=require('../../config/logger')(_0x7074('0x2'));var moment=require('moment');var BPromise=require(_0x7074('0x3'));var rp=require(_0x7074('0x4'));var fs=require('fs');var path=require(_0x7074('0x5'));var rimraf=require(_0x7074('0x6'));var config=require(_0x7074('0x7'));var attributes=require(_0x7074('0x8'));module['exports']=function(_0x2c8a23,_0x549d2a){return _0x2c8a23['define'](_0x7074('0x9'),attributes,{'tableName':'user_has_chat_queues','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 c9cbe1f..8b11d9e 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 _0xb30e=['info','result','lodash','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1eb2ce,_0x57c0bd){var _0x138311=function(_0x489912){while(--_0x489912){_0x1eb2ce['push'](_0x1eb2ce['shift']());}};_0x138311(++_0x57c0bd);}(_0xb30e,0x6e));var _0xeb30=function(_0x35f9fd,_0x161f16){_0x35f9fd=_0x35f9fd-0x0;var _0x53a02d=_0xb30e[_0x35f9fd];return _0x53a02d;};'use strict';var _=require(_0xeb30('0x0'));var util=require('util');var moment=require(_0xeb30('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb30('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb30('0x3'))('rpc');var config=require(_0xeb30('0x4'));var jayson=require(_0xeb30('0x5'));var client=jayson[_0xeb30('0x6')][_0xeb30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5903ca,_0x38e16e,_0x43d949){return new BPromise(function(_0x53784c,_0x4480c5){return client[_0xeb30('0x8')](_0x5903ca,_0x43d949)['then'](function(_0x256ca5){logger['info'](_0xeb30('0x9'),_0x38e16e,_0xeb30('0xa'));logger[_0xeb30('0xb')](_0xeb30('0xc'),_0x38e16e,_0xeb30('0xa'),JSON['stringify'](_0x256ca5));if(_0x256ca5['error']){if(_0x256ca5[_0xeb30('0xd')][_0xeb30('0xe')]===0x1f4){logger['error'](_0xeb30('0x9'),_0x38e16e,_0x256ca5[_0xeb30('0xd')][_0xeb30('0xf')]);return _0x4480c5(_0x256ca5[_0xeb30('0xd')][_0xeb30('0xf')]);}logger[_0xeb30('0xd')](_0xeb30('0x9'),_0x38e16e,_0x256ca5[_0xeb30('0xd')]['message']);return _0x53784c(_0x256ca5['error'][_0xeb30('0xf')]);}else{logger[_0xeb30('0x10')](_0xeb30('0x9'),_0x38e16e,_0xeb30('0xa'));_0x53784c(_0x256ca5[_0xeb30('0x11')][_0xeb30('0xf')]);}})['catch'](function(_0x46a24b){logger[_0xeb30('0xd')](_0xeb30('0x9'),_0x38e16e,_0x46a24b);_0x4480c5(_0x46a24b);});});} \ No newline at end of file +var _0x5dc3=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x5dc3,0xff));var _0x35dc=function(_0x273e2c,_0x2acc61){_0x273e2c=_0x273e2c-0x0;var _0x11928d=_0x5dc3[_0x273e2c];return _0x11928d;};'use strict';var _=require('lodash');var util=require(_0x35dc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35dc('0x1'));var fs=require('fs');var Redis=require(_0x35dc('0x2'));var db=require(_0x35dc('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x35dc('0x4'));var config=require(_0x35dc('0x5'));var jayson=require(_0x35dc('0x6'));var client=jayson[_0x35dc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x205a0c,_0xec7e80,_0x5d506a){return new BPromise(function(_0x312cc4,_0x24bd16){return client[_0x35dc('0x8')](_0x205a0c,_0x5d506a)[_0x35dc('0x9')](function(_0xa2a4ed){logger[_0x35dc('0xa')](_0x35dc('0xb'),_0xec7e80,_0x35dc('0xc'));logger[_0x35dc('0xd')](_0x35dc('0xe'),_0xec7e80,'request\x20sent',JSON[_0x35dc('0xf')](_0xa2a4ed));if(_0xa2a4ed[_0x35dc('0x10')]){if(_0xa2a4ed[_0x35dc('0x10')][_0x35dc('0x11')]===0x1f4){logger[_0x35dc('0x10')]('UserChatQueue,\x20%s,\x20%s',_0xec7e80,_0xa2a4ed['error']['message']);return _0x24bd16(_0xa2a4ed[_0x35dc('0x10')][_0x35dc('0x12')]);}logger[_0x35dc('0x10')](_0x35dc('0xb'),_0xec7e80,_0xa2a4ed[_0x35dc('0x10')][_0x35dc('0x12')]);return _0x312cc4(_0xa2a4ed[_0x35dc('0x10')][_0x35dc('0x12')]);}else{logger[_0x35dc('0xa')]('UserChatQueue,\x20%s,\x20%s',_0xec7e80,'request\x20sent');_0x312cc4(_0xa2a4ed['result'][_0x35dc('0x12')]);}})['catch'](function(_0x59a2f1){logger[_0x35dc('0x10')](_0x35dc('0xb'),_0xec7e80,_0x59a2f1);_0x24bd16(_0x59a2f1);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index b00ad8b..836a247 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa56b53,_0x53dbb7){var _0x19849f=function(_0x503946){while(--_0x503946){_0xa56b53['push'](_0xa56b53['shift']());}};_0x19849f(++_0x53dbb7);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x58428c,_0x435751){var _0x4bebd4=function(_0x27627e){while(--_0x27627e){_0x58428c['push'](_0x58428c['shift']());}};_0x4bebd4(++_0x435751);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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 7b4744f..687b116 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 _0x7af7=['STRING','sequelize','INTEGER'];(function(_0x3b038e,_0x2b555c){var _0x223947=function(_0x24be95){while(--_0x24be95){_0x3b038e['push'](_0x3b038e['shift']());}};_0x223947(++_0x2b555c);}(_0x7af7,0xc4));var _0x77af=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x7af7[_0x55d58f];return _0x1ad6e6;};'use strict';var Sequelize=require(_0x77af('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x77af('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x77af('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x77af('0x2')]}}; \ No newline at end of file +var _0x5d45=['STRING','sequelize','exports','INTEGER'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x5d45,0xf1));var _0x55d4=function(_0xece208,_0x548ccd){_0xece208=_0xece208-0x0;var _0x3b9b44=_0x5d45[_0xece208];return _0x3b9b44;};'use strict';var Sequelize=require(_0x55d4('0x0'));module[_0x55d4('0x1')]={'penalty':{'type':Sequelize[_0x55d4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x55d4('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8028ed0..c0d470c 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 _0x115e=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue'];(function(_0x307f9c,_0x13fcb6){var _0x3cd355=function(_0x40e9dd){while(--_0x40e9dd){_0x307f9c['push'](_0x307f9c['shift']());}};_0x3cd355(++_0x13fcb6);}(_0x115e,0x16b));var _0xe115=function(_0x168466,_0x5f37e5){_0x168466=_0x168466-0x0;var _0xcf8a4=_0x115e[_0x168466];return _0xcf8a4;};'use strict';var _=require(_0xe115('0x0'));var util=require(_0xe115('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe115('0x2'));var BPromise=require(_0xe115('0x3'));var rp=require(_0xe115('0x4'));var fs=require('fs');var path=require(_0xe115('0x5'));var rimraf=require(_0xe115('0x6'));var config=require(_0xe115('0x7'));var attributes=require(_0xe115('0x8'));module['exports']=function(_0x2b2755,_0x1174ac){return _0x2b2755[_0xe115('0x9')](_0xe115('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdda0=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x54e720,_0x3c8b4a){var _0x484331=function(_0x1ff8f9){while(--_0x1ff8f9){_0x54e720['push'](_0x54e720['shift']());}};_0x484331(++_0x3c8b4a);}(_0xdda0,0xe5));var _0x0dda=function(_0x412a90,_0x4e30ea){_0x412a90=_0x412a90-0x0;var _0x212128=_0xdda0[_0x412a90];return _0x212128;};'use strict';var _=require('lodash');var util=require(_0x0dda('0x0'));var logger=require(_0x0dda('0x1'))(_0x0dda('0x2'));var moment=require(_0x0dda('0x3'));var BPromise=require(_0x0dda('0x4'));var rp=require(_0x0dda('0x5'));var fs=require('fs');var path=require(_0x0dda('0x6'));var rimraf=require(_0x0dda('0x7'));var config=require(_0x0dda('0x8'));var attributes=require(_0x0dda('0x9'));module[_0x0dda('0xa')]=function(_0x2791ab,_0x449d6d){return _0x2791ab[_0x0dda('0xb')](_0x0dda('0xc'),attributes,{'tableName':_0x0dda('0xd'),'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 c2935bd..b493baf 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 _0x493b=['util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x493b,0xbc));var _0xb493=function(_0x8cf806,_0x1c5273){_0x8cf806=_0x8cf806-0x0;var _0x34e46b=_0x493b[_0x8cf806];return _0x34e46b;};'use strict';var _=require(_0xb493('0x0'));var util=require(_0xb493('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb493('0x2'));var fs=require('fs');var Redis=require(_0xb493('0x3'));var db=require(_0xb493('0x4'))['db'];var utils=require(_0xb493('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb493('0x6'));var client=jayson[_0xb493('0x7')][_0xb493('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa449c9,_0x27a1ca,_0x1a91c8){return new BPromise(function(_0x2133f6,_0x1bd947){return client[_0xb493('0x9')](_0xa449c9,_0x1a91c8)[_0xb493('0xa')](function(_0x2896bd){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x27a1ca,_0xb493('0xb'));logger['debug'](_0xb493('0xc'),_0x27a1ca,'request\x20sent',JSON[_0xb493('0xd')](_0x2896bd));if(_0x2896bd[_0xb493('0xe')]){if(_0x2896bd[_0xb493('0xe')][_0xb493('0xf')]===0x1f4){logger[_0xb493('0xe')](_0xb493('0x10'),_0x27a1ca,_0x2896bd[_0xb493('0xe')][_0xb493('0x11')]);return _0x1bd947(_0x2896bd[_0xb493('0xe')]['message']);}logger[_0xb493('0xe')](_0xb493('0x10'),_0x27a1ca,_0x2896bd[_0xb493('0xe')][_0xb493('0x11')]);return _0x2133f6(_0x2896bd[_0xb493('0xe')][_0xb493('0x11')]);}else{logger[_0xb493('0x12')](_0xb493('0x10'),_0x27a1ca,_0xb493('0xb'));_0x2133f6(_0x2896bd[_0xb493('0x13')][_0xb493('0x11')]);}})[_0xb493('0x14')](function(_0x5bcbc5){logger['error'](_0xb493('0x10'),_0x27a1ca,_0x5bcbc5);_0x1bd947(_0x5bcbc5);});});} \ No newline at end of file +var _0xd023=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2b2f62,_0x14111d){var _0x3fd022=function(_0x32d060){while(--_0x32d060){_0x2b2f62['push'](_0x2b2f62['shift']());}};_0x3fd022(++_0x14111d);}(_0xd023,0xa3));var _0x3d02=function(_0x4c12c1,_0x41926c){_0x4c12c1=_0x4c12c1-0x0;var _0x40bc9d=_0xd023[_0x4c12c1];return _0x40bc9d;};'use strict';var _=require(_0x3d02('0x0'));var util=require(_0x3d02('0x1'));var moment=require(_0x3d02('0x2'));var BPromise=require(_0x3d02('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d02('0x4'));var db=require(_0x3d02('0x5'))['db'];var utils=require(_0x3d02('0x6'));var logger=require(_0x3d02('0x7'))(_0x3d02('0x8'));var config=require(_0x3d02('0x9'));var jayson=require(_0x3d02('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2984b3,_0x328df7,_0x25ea3d){return new BPromise(function(_0x2bacb5,_0x2da719){return client[_0x3d02('0xb')](_0x2984b3,_0x25ea3d)[_0x3d02('0xc')](function(_0x353d57){logger[_0x3d02('0xd')](_0x3d02('0xe'),_0x328df7,'request\x20sent');logger[_0x3d02('0xf')](_0x3d02('0x10'),_0x328df7,_0x3d02('0x11'),JSON[_0x3d02('0x12')](_0x353d57));if(_0x353d57[_0x3d02('0x13')]){if(_0x353d57['error'][_0x3d02('0x14')]===0x1f4){logger['error'](_0x3d02('0xe'),_0x328df7,_0x353d57[_0x3d02('0x13')][_0x3d02('0x15')]);return _0x2da719(_0x353d57[_0x3d02('0x13')][_0x3d02('0x15')]);}logger[_0x3d02('0x13')](_0x3d02('0xe'),_0x328df7,_0x353d57['error'][_0x3d02('0x15')]);return _0x2bacb5(_0x353d57[_0x3d02('0x13')][_0x3d02('0x15')]);}else{logger[_0x3d02('0xd')](_0x3d02('0xe'),_0x328df7,_0x3d02('0x11'));_0x2bacb5(_0x353d57[_0x3d02('0x16')][_0x3d02('0x15')]);}})[_0x3d02('0x17')](function(_0x4ff92f){logger[_0x3d02('0x13')](_0x3d02('0xe'),_0x328df7,_0x4ff92f);_0x2da719(_0x4ff92f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 89a49ed..120214d 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4c6eca,_0x357c0e){var _0x29fc3c=function(_0x257cc8){while(--_0x257cc8){_0x4c6eca['push'](_0x4c6eca['shift']());}};_0x29fc3c(++_0x357c0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0xcb91[_0x423097];return _0x3a73f1;};'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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4e457b,_0x31b37c){var _0x248e7b=function(_0x35d865){while(--_0x35d865){_0x4e457b['push'](_0x4e457b['shift']());}};_0x248e7b(++_0x31b37c);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 58b8c8f..141c189 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 _0x10f9=['sequelize','exports','INTEGER'];(function(_0x3073c5,_0x426ccc){var _0x35f385=function(_0x45b159){while(--_0x45b159){_0x3073c5['push'](_0x3073c5['shift']());}};_0x35f385(++_0x426ccc);}(_0x10f9,0x69));var _0x910f=function(_0x420169,_0x5021f7){_0x420169=_0x420169-0x0;var _0x25ec2a=_0x10f9[_0x420169];return _0x25ec2a;};'use strict';var Sequelize=require(_0x910f('0x0'));module[_0x910f('0x1')]={'penalty':{'type':Sequelize[_0x910f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0261=['INTEGER','sequelize','exports'];(function(_0x265a26,_0x1826cf){var _0x42994a=function(_0x190706){while(--_0x190706){_0x265a26['push'](_0x265a26['shift']());}};_0x42994a(++_0x1826cf);}(_0x0261,0x11b));var _0x1026=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x0261[_0x872b02];return _0x1a6b24;};'use strict';var Sequelize=require(_0x1026('0x0'));module[_0x1026('0x1')]={'penalty':{'type':Sequelize[_0x1026('0x2')],'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 19a6fd1..a4af6e3 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 _0xc46b=['rimraf','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc46b,0x1f3));var _0xbc46=function(_0x158984,_0x42c216){_0x158984=_0x158984-0x0;var _0x5a389f=_0xc46b[_0x158984];return _0x5a389f;};'use strict';var _=require(_0xbc46('0x0'));var util=require('util');var logger=require(_0xbc46('0x1'))(_0xbc46('0x2'));var moment=require(_0xbc46('0x3'));var BPromise=require(_0xbc46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc46('0x5'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x448f74,_0x1bf9a7){return _0x448f74['define'](_0xbc46('0x6'),attributes,{'tableName':_0xbc46('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46d7=['path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4d18c2,_0x9b85d0){var _0x1cadf9=function(_0xbb421c){while(--_0xbb421c){_0x4d18c2['push'](_0x4d18c2['shift']());}};_0x1cadf9(++_0x9b85d0);}(_0x46d7,0xf5));var _0x746d=function(_0x1c7936,_0x18b462){_0x1c7936=_0x1c7936-0x0;var _0x4d0202=_0x46d7[_0x1c7936];return _0x4d0202;};'use strict';var _=require(_0x746d('0x0'));var util=require(_0x746d('0x1'));var logger=require(_0x746d('0x2'))(_0x746d('0x3'));var moment=require(_0x746d('0x4'));var BPromise=require(_0x746d('0x5'));var rp=require(_0x746d('0x6'));var fs=require('fs');var path=require(_0x746d('0x7'));var rimraf=require(_0x746d('0x8'));var config=require(_0x746d('0x9'));var attributes=require('./userMailQueue.attributes');module[_0x746d('0xa')]=function(_0x171a4d,_0x3c4ab7){return _0x171a4d[_0x746d('0xb')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 b1b6de1..78953f4 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x140db9,_0x4ab213){var _0x211456=function(_0x2229f7){while(--_0x2229f7){_0x140db9['push'](_0x140db9['shift']());}};_0x211456(++_0x4ab213);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x5fc3[_0x1057a3];return _0x131cdb;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x25f409,_0x251e19){var _0x113456=function(_0x2c55d9){while(--_0x2c55d9){_0x25f409['push'](_0x25f409['shift']());}};_0x113456(++_0x251e19);}(_0xa41a,0x6b));var _0xaa41=function(_0x5d25a1,_0x8c9099){_0x5d25a1=_0x5d25a1-0x0;var _0x52cd3a=_0xa41a[_0x5d25a1];return _0x52cd3a;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a7781cd..ea78854 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 _0xe4e0=['express','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xe4e0,0x11d));var _0x0e4e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xe4e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require('multer');var util=require(_0x0e4e('0x0'));var path=require(_0x0e4e('0x1'));var timeout=require(_0x0e4e('0x2'));var express=require(_0x0e4e('0x3'));var router=express['Router']();var fs_extra=require(_0x0e4e('0x4'));var auth=require(_0x0e4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e4e('0x6'));var controller=require(_0x0e4e('0x7'));router[_0x0e4e('0x8')]('/',auth[_0x0e4e('0x9')](),controller[_0x0e4e('0xa')]);module[_0x0e4e('0xb')]=router; \ No newline at end of file +var _0x3004=['../../components/interaction/service','../../config/environment','sendUserNotification','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x57fcd6,_0x70b457){var _0x5b6c73=function(_0x366b6a){while(--_0x366b6a){_0x57fcd6['push'](_0x57fcd6['shift']());}};_0x5b6c73(++_0x70b457);}(_0x3004,0xa9));var _0x4300=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x3004[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require('multer');var util=require(_0x4300('0x0'));var path=require(_0x4300('0x1'));var timeout=require(_0x4300('0x2'));var express=require(_0x4300('0x3'));var router=express[_0x4300('0x4')]();var fs_extra=require(_0x4300('0x5'));var auth=require(_0x4300('0x6'));var interaction=require(_0x4300('0x7'));var config=require(_0x4300('0x8'));var controller=require('./userNotification.controller');router['post']('/',auth['isAuthenticated'](),controller[_0x4300('0x9')]);module[_0x4300('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b7369e2..05a9c4d 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 _0x1b90=['BOOLEAN','exports','TEXT','STRING'];(function(_0x28bccc,_0x436ada){var _0x5900d0=function(_0x1a2b5f){while(--_0x1a2b5f){_0x28bccc['push'](_0x28bccc['shift']());}};_0x5900d0(++_0x436ada);}(_0x1b90,0x7d));var _0x01b9=function(_0x390562,_0x514ec5){_0x390562=_0x390562-0x0;var _0x1ffe39=_0x1b90[_0x390562];return _0x1ffe39;};'use strict';var Sequelize=require('sequelize');module[_0x01b9('0x0')]={'body':{'type':Sequelize[_0x01b9('0x1')]},'senderName':{'type':Sequelize[_0x01b9('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x01b9('0x3')]}}; \ No newline at end of file +var _0x805d=['TEXT','BOOLEAN','exports'];(function(_0x304080,_0x227ad3){var _0x50adaf=function(_0x5f0150){while(--_0x5f0150){_0x304080['push'](_0x304080['shift']());}};_0x50adaf(++_0x227ad3);}(_0x805d,0x68));var _0xd805=function(_0x187291,_0x354c13){_0x187291=_0x187291-0x0;var _0x1da319=_0x805d[_0x187291];return _0x1da319;};'use strict';var Sequelize=require('sequelize');module[_0xd805('0x0')]={'body':{'type':Sequelize[_0xd805('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xd805('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xd805('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 91683fa..5fb7817 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 _0x9fc3=['send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','parse','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','emit','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','User','union','ids','queue','replace','all','getAgents','map','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','name'];(function(_0x6a8acd,_0x59e0f2){var _0x36fc71=function(_0x2ff6a5){while(--_0x2ff6a5){_0x6a8acd['push'](_0x6a8acd['shift']());}};_0x36fc71(++_0x59e0f2);}(_0x9fc3,0x1ed));var _0x39fc=function(_0x27e78a,_0x19a060){_0x27e78a=_0x27e78a-0x0;var _0x506cf8=_0x9fc3[_0x27e78a];return _0x506cf8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x39fc('0x0'));var rp=require(_0x39fc('0x1'));var moment=require(_0x39fc('0x2'));var BPromise=require(_0x39fc('0x3'));var Mustache=require(_0x39fc('0x4'));var util=require('util');var path=require(_0x39fc('0x5'));var sox=require(_0x39fc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39fc('0x7'));var _=require('lodash');var squel=require(_0x39fc('0x8'));var crypto=require('crypto');var jsforce=require(_0x39fc('0x9'));var deskjs=require(_0x39fc('0xa'));var toCsv=require(_0x39fc('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x39fc('0xc'));var authService=require(_0x39fc('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x39fc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39fc('0xf'))(_0x39fc('0x10'));var utils=require(_0x39fc('0x11'));var config=require(_0x39fc('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x39fc('0x13')]=_[_0x39fc('0x14')](config[_0x39fc('0x13')],{'host':_0x39fc('0x15'),'port':0x18eb});var socket=require(_0x39fc('0x16'))(new Redis(config['redis']));require(_0x39fc('0x17'))[_0x39fc('0x18')](socket);function respondWithStatusCode(_0x35f6bf,_0x5b57bf){_0x5b57bf=_0x5b57bf||0xcc;return function(_0x1b7b93){if(_0x1b7b93){return _0x35f6bf[_0x39fc('0x19')](_0x5b57bf);}return _0x35f6bf[_0x39fc('0x1a')](_0x5b57bf)[_0x39fc('0x1b')]();};}function respondWithResult(_0x1d3f31,_0x4e3ce3){_0x4e3ce3=_0x4e3ce3||0xc8;return function(_0x2c9e3b){if(_0x2c9e3b){return _0x1d3f31[_0x39fc('0x1a')](_0x4e3ce3)['json'](_0x2c9e3b);}};}function respondWithFilteredResult(_0x23eb48,_0x364ad3){return function(_0x48a0c7){if(_0x48a0c7){var _0x521206=typeof _0x364ad3[_0x39fc('0x1c')]==='undefined'&&typeof _0x364ad3[_0x39fc('0x1d')]===_0x39fc('0x1e');var _0x1bf524=_0x48a0c7[_0x39fc('0x1f')];var _0x328164=_0x521206?0x0:_0x364ad3[_0x39fc('0x1c')];var _0x16fd23=_0x521206?_0x48a0c7[_0x39fc('0x1f')]:_0x364ad3[_0x39fc('0x1c')]+_0x364ad3[_0x39fc('0x1d')];var _0x4a20eb;if(_0x16fd23>=_0x1bf524){_0x16fd23=_0x1bf524;_0x4a20eb=0xc8;}else{_0x4a20eb=0xce;}_0x23eb48[_0x39fc('0x1a')](_0x4a20eb);return _0x23eb48[_0x39fc('0x20')]('Content-Range',_0x328164+'-'+_0x16fd23+'/'+_0x1bf524)['json'](_0x48a0c7);}return null;};}function patchUpdates(_0x41eff5){return function(_0x1333c8){try{jsonpatch[_0x39fc('0x21')](_0x1333c8,_0x41eff5,!![]);}catch(_0x1cbe65){return BPromise[_0x39fc('0x22')](_0x1cbe65);}return _0x1333c8[_0x39fc('0x23')]();};}function saveUpdates(_0x3f5866,_0x2eeb93){return function(_0x7fe28d){if(_0x7fe28d){return _0x7fe28d['update'](_0x3f5866)['then'](function(_0xb27321){return _0xb27321;});}return null;};}function removeEntity(_0x3fc7ad,_0x44a1cc){return function(_0x54d7d1){if(_0x54d7d1){return _0x54d7d1[_0x39fc('0x24')]()[_0x39fc('0x25')](function(){_0x3fc7ad['status'](0xcc)[_0x39fc('0x1b')]();});}};}function handleEntityNotFound(_0x13657d,_0x4cfb29){return function(_0x5e9f27){if(!_0x5e9f27){_0x13657d[_0x39fc('0x19')](0x194);}return _0x5e9f27;};}function handleError(_0x23c5a9,_0x49d6ed){_0x49d6ed=_0x49d6ed||0x1f4;return function(_0x27a419){logger[_0x39fc('0x26')](_0x27a419[_0x39fc('0x27')]);if(_0x27a419[_0x39fc('0x28')]){delete _0x27a419[_0x39fc('0x28')];}_0x23c5a9['status'](_0x49d6ed)[_0x39fc('0x29')](_0x27a419);};}exports[_0x39fc('0x2a')]=function(_0x124634,_0x251944,_0xd3d0a9){if(!_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')]('text')&&!_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')](_0x39fc('0x2d'))){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x30'));}else{if(_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')]('TemplateId')&&!_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')](_0x39fc('0x31'))){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x32'));}if(!_0x124634['body']['hasOwnProperty']('recipients')){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3e3aac=JSON[_0x39fc('0x33')](_0x124634[_0x39fc('0x2b')]['recipients']);}catch(_0x4f8b6b){logger['error'](_0x4f8b6b);throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2c518c=[_0x39fc('0x34'),'faxqueue','mailqueue',_0x39fc('0x35'),_0x39fc('0x36'),_0x39fc('0x37'),_0x39fc('0x38'),'team',_0x39fc('0x39')];if(_[_0x39fc('0x3a')](_0x3e3aac,function(_0x5372bb){return!_[_0x39fc('0x3b')](_0x2c518c,_0x5372bb[_0x39fc('0x3c')][_0x39fc('0x3d')]());})){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x3e'));}}}var _0x4364c7={};_0x4364c7[_0x39fc('0x3f')]=_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')]('senderName')?_0x124634[_0x39fc('0x2b')]['senderName']:_0x124634[_0x39fc('0x39')]['fullname'];_0x4364c7[_0x39fc('0x40')]=_['isEmpty'](_0x124634['body'][_0x39fc('0x40')])?null:_0x124634[_0x39fc('0x2b')][_0x39fc('0x40')];_0x4364c7['beep']=_0x124634[_0x39fc('0x2b')][_0x39fc('0x41')]||![];_0x4364c7[_0x39fc('0x42')]=_0x124634[_0x39fc('0x39')]['id'];return getContent(_0x124634[_0x39fc('0x2b')])[_0x39fc('0x25')](function(_0x32c369){_0x4364c7[_0x39fc('0x2b')]=_0x32c369;return getRecipients(_0x3e3aac);})[_0x39fc('0x25')](function(_0x4ce90e){_0x4364c7['recipientsId']=_[_0x39fc('0x43')](_0x4ce90e)[_0x39fc('0x44')](',');return db[_0x39fc('0x45')][_0x39fc('0x46')](function(_0x199fdd){return db[_0x39fc('0x47')]['create'](_0x4364c7,{'raw':!![],'transaction':_0x199fdd})[_0x39fc('0x25')](function(_0x39cafe){var _0x55b204={'sender':_0x4364c7[_0x39fc('0x3f')],'description':_0x4364c7[_0x39fc('0x40')],'content':_0x4364c7[_0x39fc('0x2b')],'beep':_0x4364c7['beep']};_0x4ce90e['forEach'](function(_0x178116){_0x55b204['recipient']=_0x178116;socket[_0x39fc('0x48')]('userNotification:send',_0x55b204);});return _0x39cafe;});});})['then'](respondWithResult(_0x251944,0xc9))[_0x39fc('0x49')](handleError(_0x251944,null));};function getContent(_0x58df6b){return new BPromise(function(_0x4b941b,_0x366ff9){if(_0x58df6b[_0x39fc('0x4a')]){_0x4b941b(_0x58df6b[_0x39fc('0x4a')]);return;}return db[_0x39fc('0x4b')][_0x39fc('0x4c')]({'attributes':[_0x39fc('0x4d')],'where':{'id':_0x58df6b['TemplateId']},'raw':!![]})[_0x39fc('0x25')](function(_0x4ce514){if(!_0x4ce514)throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x4e'));var _0x736fa9=Mustache[_0x39fc('0x4f')](_0x4ce514['html'],_0x58df6b[_0x39fc('0x31')]);_0x4b941b(_0x736fa9);})[_0x39fc('0x49')](function(_0x3e6d68){_0x366ff9(_0x3e6d68);});});}function getRecipients(_0x396489){return new BPromise(function(_0x13e0c2,_0x434b21){var _0x1e58bd=[];var _0x4082f2=[];_0x396489[_0x39fc('0x50')](function(_0x3d09c4){var _0x20bfc2=_['startCase'](_0x3d09c4[_0x39fc('0x3c')]['toLowerCase']());if(_0x20bfc2===_0x39fc('0x51')){_0x1e58bd=_[_0x39fc('0x52')](_0x1e58bd,_0x3d09c4[_0x39fc('0x53')]);}else{if(_[_0x39fc('0x3b')](_0x20bfc2,_0x39fc('0x54')))_0x20bfc2=_0x20bfc2[_0x39fc('0x55')](_0x39fc('0x54'),'Queue');_0x3d09c4[_0x39fc('0x53')][_0x39fc('0x50')](function(_0x50b536){_0x4082f2['push'](getAgents(_0x20bfc2,_0x50b536));});}});return BPromise[_0x39fc('0x56')](_0x4082f2)[_0x39fc('0x25')](function(_0x5ee2ca){_0x1e58bd=_['union'](_0x1e58bd,_['flatten'](_0x5ee2ca));_0x13e0c2(_0x1e58bd);})['catch'](function(_0x1e127c){_0x434b21(_0x1e127c);});});}function getAgents(_0x183678,_0x39d611){return new BPromise(function(_0x151190,_0x1dd8b3){return db[_0x183678][_0x39fc('0x4c')]({'where':{'id':_0x39d611}})[_0x39fc('0x25')](function(_0x1817a9){return _0x1817a9[_0x39fc('0x57')]({'attributes':['id'],'raw':!![]})[_0x39fc('0x25')](function(_0x6e221a){var _0x5b9aea=_[_0x39fc('0x58')](_0x6e221a,'id');_0x151190(_0x5b9aea);});})['catch'](function(_0x1b31a5){_0x1dd8b3(_0x1b31a5);});});} \ No newline at end of file +var _0x2b5a=['ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','update','then','sendStatus','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','ValidationError','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','join','sequelize','UserNotification','create','forEach','recipient','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','catch','startCase','User','union','ids','includes','replace','queue','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv'];(function(_0x1e9e10,_0x45173b){var _0x292114=function(_0x35396a){while(--_0x35396a){_0x1e9e10['push'](_0x1e9e10['shift']());}};_0x292114(++_0x45173b);}(_0x2b5a,0xb8));var _0xa2b5=function(_0x12324f,_0x6b4cca){_0x12324f=_0x12324f-0x0;var _0x370814=_0x2b5a[_0x12324f];return _0x370814;};'use strict';var emlformat=require(_0xa2b5('0x0'));var rimraf=require(_0xa2b5('0x1'));var zipdir=require(_0xa2b5('0x2'));var jsonpatch=require(_0xa2b5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2b5('0x4'));var Mustache=require('mustache');var util=require(_0xa2b5('0x5'));var path=require('path');var sox=require(_0xa2b5('0x6'));var csv=require(_0xa2b5('0x7'));var ejs=require(_0xa2b5('0x8'));var fs=require('fs');var fs_extra=require(_0xa2b5('0x9'));var _=require(_0xa2b5('0xa'));var squel=require('squel');var crypto=require(_0xa2b5('0xb'));var jsforce=require(_0xa2b5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa2b5('0x7'));var querystring=require(_0xa2b5('0xd'));var Papa=require(_0xa2b5('0xe'));var Redis=require(_0xa2b5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa2b5('0x10'));var as=require(_0xa2b5('0x11'));var hardwareService=require(_0xa2b5('0x12'));var logger=require(_0xa2b5('0x13'))(_0xa2b5('0x14'));var utils=require('../../config/utils');var config=require(_0xa2b5('0x15'));var licenseUtil=require(_0xa2b5('0x16'));var db=require(_0xa2b5('0x17'))['db'];config[_0xa2b5('0x18')]=_[_0xa2b5('0x19')](config[_0xa2b5('0x18')],{'host':_0xa2b5('0x1a'),'port':0x18eb});var socket=require(_0xa2b5('0x1b'))(new Redis(config[_0xa2b5('0x18')]));require(_0xa2b5('0x1c'))['register'](socket);function respondWithStatusCode(_0x11e4da,_0x335cf9){_0x335cf9=_0x335cf9||0xcc;return function(_0xb6cead){if(_0xb6cead){return _0x11e4da['sendStatus'](_0x335cf9);}return _0x11e4da['status'](_0x335cf9)[_0xa2b5('0x1d')]();};}function respondWithResult(_0x30c4c6,_0x385e1f){_0x385e1f=_0x385e1f||0xc8;return function(_0x2174ec){if(_0x2174ec){return _0x30c4c6['status'](_0x385e1f)['json'](_0x2174ec);}};}function respondWithFilteredResult(_0x2b7cff,_0x2ed1ab){return function(_0x6a374){if(_0x6a374){var _0x312f1c=typeof _0x2ed1ab[_0xa2b5('0x1e')]==='undefined'&&typeof _0x2ed1ab['limit']===_0xa2b5('0x1f');var _0x2a1ecb=_0x6a374[_0xa2b5('0x20')];var _0x23b769=_0x312f1c?0x0:_0x2ed1ab['offset'];var _0x289e4b=_0x312f1c?_0x6a374[_0xa2b5('0x20')]:_0x2ed1ab[_0xa2b5('0x1e')]+_0x2ed1ab[_0xa2b5('0x21')];var _0x2c3ef5;if(_0x289e4b>=_0x2a1ecb){_0x289e4b=_0x2a1ecb;_0x2c3ef5=0xc8;}else{_0x2c3ef5=0xce;}_0x2b7cff[_0xa2b5('0x22')](_0x2c3ef5);return _0x2b7cff[_0xa2b5('0x23')](_0xa2b5('0x24'),_0x23b769+'-'+_0x289e4b+'/'+_0x2a1ecb)[_0xa2b5('0x25')](_0x6a374);}return null;};}function patchUpdates(_0x5b66bc){return function(_0x31c492){try{jsonpatch[_0xa2b5('0x26')](_0x31c492,_0x5b66bc,!![]);}catch(_0x296c08){return BPromise[_0xa2b5('0x27')](_0x296c08);}return _0x31c492['save']();};}function saveUpdates(_0x10d81d,_0x16b33a){return function(_0x441fbf){if(_0x441fbf){return _0x441fbf[_0xa2b5('0x28')](_0x10d81d)[_0xa2b5('0x29')](function(_0x534c0b){return _0x534c0b;});}return null;};}function removeEntity(_0x44a40e,_0x3c0f21){return function(_0x2e44f6){if(_0x2e44f6){return _0x2e44f6['destroy']()[_0xa2b5('0x29')](function(){_0x44a40e[_0xa2b5('0x22')](0xcc)[_0xa2b5('0x1d')]();});}};}function handleEntityNotFound(_0x110ce6,_0x25f79e){return function(_0x4bac92){if(!_0x4bac92){_0x110ce6[_0xa2b5('0x2a')](0x194);}return _0x4bac92;};}function handleError(_0x381fcf,_0x468991){_0x468991=_0x468991||0x1f4;return function(_0x15b27e){logger['error'](_0x15b27e[_0xa2b5('0x2b')]);if(_0x15b27e[_0xa2b5('0x2c')]){delete _0x15b27e[_0xa2b5('0x2c')];}_0x381fcf['status'](_0x468991)[_0xa2b5('0x2d')](_0x15b27e);};}exports[_0xa2b5('0x2e')]=function(_0x4c4909,_0x323cb1,_0x3b53d1){if(!_0x4c4909[_0xa2b5('0x2f')]['hasOwnProperty']('text')&&!_0x4c4909[_0xa2b5('0x2f')][_0xa2b5('0x30')](_0xa2b5('0x31'))){throw new db['Sequelize']['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4c4909[_0xa2b5('0x2f')]['hasOwnProperty']('TemplateId')&&!_0x4c4909[_0xa2b5('0x2f')][_0xa2b5('0x30')]('view')){throw new db['Sequelize']['ValidationError'](_0xa2b5('0x32'));}if(!_0x4c4909['body']['hasOwnProperty'](_0xa2b5('0x33'))){throw new db[(_0xa2b5('0x34'))][(_0xa2b5('0x35'))](_0xa2b5('0x36'));}else{try{var _0x543cfe=JSON['parse'](_0x4c4909['body'][_0xa2b5('0x33')]);}catch(_0x253d7f){logger['error'](_0x253d7f);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x4a9ee6=[_0xa2b5('0x37'),_0xa2b5('0x38'),'mailqueue',_0xa2b5('0x39'),_0xa2b5('0x3a'),_0xa2b5('0x3b'),_0xa2b5('0x3c'),_0xa2b5('0x3d'),'user'];if(_['some'](_0x543cfe,function(_0x2e836d){return!_['includes'](_0x4a9ee6,_0x2e836d[_0xa2b5('0x3e')][_0xa2b5('0x3f')]());})){throw new db[(_0xa2b5('0x34'))]['ValidationError'](_0xa2b5('0x40'));}}}var _0x410afd={};_0x410afd['senderName']=_0x4c4909['body']['hasOwnProperty']('senderName')?_0x4c4909[_0xa2b5('0x2f')][_0xa2b5('0x41')]:_0x4c4909[_0xa2b5('0x42')]['fullname'];_0x410afd[_0xa2b5('0x43')]=_[_0xa2b5('0x44')](_0x4c4909[_0xa2b5('0x2f')][_0xa2b5('0x43')])?null:_0x4c4909['body'][_0xa2b5('0x43')];_0x410afd[_0xa2b5('0x45')]=_0x4c4909[_0xa2b5('0x2f')][_0xa2b5('0x45')]||![];_0x410afd[_0xa2b5('0x46')]=_0x4c4909['user']['id'];return getContent(_0x4c4909[_0xa2b5('0x2f')])['then'](function(_0x5e7da9){_0x410afd['body']=_0x5e7da9;return getRecipients(_0x543cfe);})['then'](function(_0x50f24a){_0x410afd['recipientsId']=_['sortBy'](_0x50f24a)[_0xa2b5('0x47')](',');return db[_0xa2b5('0x48')]['transaction'](function(_0x116dd8){return db[_0xa2b5('0x49')][_0xa2b5('0x4a')](_0x410afd,{'raw':!![],'transaction':_0x116dd8})['then'](function(_0x573f91){var _0x86e4d6={'sender':_0x410afd['senderName'],'description':_0x410afd[_0xa2b5('0x43')],'content':_0x410afd[_0xa2b5('0x2f')],'beep':_0x410afd[_0xa2b5('0x45')]};_0x50f24a[_0xa2b5('0x4b')](function(_0x5790a8){_0x86e4d6[_0xa2b5('0x4c')]=_0x5790a8;socket['emit']('userNotification:send',_0x86e4d6);});return _0x573f91;});});})['then'](respondWithResult(_0x323cb1,0xc9))['catch'](handleError(_0x323cb1,null));};function getContent(_0x14be7b){return new BPromise(function(_0xb3ace0,_0x2313ca){if(_0x14be7b[_0xa2b5('0x4d')]){_0xb3ace0(_0x14be7b[_0xa2b5('0x4d')]);return;}return db['Template'][_0xa2b5('0x4e')]({'attributes':[_0xa2b5('0x4f')],'where':{'id':_0x14be7b[_0xa2b5('0x31')]},'raw':!![]})['then'](function(_0x4f3284){if(!_0x4f3284)throw new db[(_0xa2b5('0x34'))][(_0xa2b5('0x35'))](_0xa2b5('0x50'));var _0xdd69ec=Mustache['render'](_0x4f3284[_0xa2b5('0x4f')],_0x14be7b[_0xa2b5('0x51')]);_0xb3ace0(_0xdd69ec);})[_0xa2b5('0x52')](function(_0xc178bf){_0x2313ca(_0xc178bf);});});}function getRecipients(_0x19ac30){return new BPromise(function(_0x13beff,_0x59e02d){var _0x27c37d=[];var _0x141440=[];_0x19ac30['forEach'](function(_0x22a407){var _0x52c9eb=_[_0xa2b5('0x53')](_0x22a407['model'][_0xa2b5('0x3f')]());if(_0x52c9eb===_0xa2b5('0x54')){_0x27c37d=_[_0xa2b5('0x55')](_0x27c37d,_0x22a407[_0xa2b5('0x56')]);}else{if(_[_0xa2b5('0x57')](_0x52c9eb,'queue'))_0x52c9eb=_0x52c9eb[_0xa2b5('0x58')](_0xa2b5('0x59'),_0xa2b5('0x5a'));_0x22a407['ids']['forEach'](function(_0x3948f2){_0x141440[_0xa2b5('0x5b')](getAgents(_0x52c9eb,_0x3948f2));});}});return BPromise[_0xa2b5('0x5c')](_0x141440)['then'](function(_0x1bde34){_0x27c37d=_['union'](_0x27c37d,_[_0xa2b5('0x5d')](_0x1bde34));_0x13beff(_0x27c37d);})[_0xa2b5('0x52')](function(_0x12929f){_0x59e02d(_0x12929f);});});}function getAgents(_0x55f866,_0x4c8fb6){return new BPromise(function(_0x409683,_0x691772){return db[_0x55f866][_0xa2b5('0x4e')]({'where':{'id':_0x4c8fb6}})['then'](function(_0xb8d3ba){return _0xb8d3ba[_0xa2b5('0x5e')]({'attributes':['id'],'raw':!![]})[_0xa2b5('0x29')](function(_0x35a086){var _0x31e40b=_[_0xa2b5('0x5f')](_0x35a086,'id');_0x409683(_0x31e40b);});})[_0xa2b5('0x52')](function(_0x25c6ef){_0x691772(_0x25c6ef);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9b5e095..612990a 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 _0x6869=['emit','hasOwnProperty','hook','exports','UserNotification','save','update','remove'];(function(_0x7a0134,_0x33ee65){var _0x2bcfc1=function(_0x50c6cd){while(--_0x50c6cd){_0x7a0134['push'](_0x7a0134['shift']());}};_0x2bcfc1(++_0x33ee65);}(_0x6869,0x1bc));var _0x9686=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6869[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x9686('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9686('0x1'),'afterUpdate':_0x9686('0x2'),'afterDestroy':_0x9686('0x3')};function emitEvent(_0x3219a8){return function(_0x586d74,_0x1c6f53,_0x392b68){UserNotificationEvents[_0x9686('0x4')](_0x3219a8+':'+_0x586d74['id'],_0x586d74);UserNotificationEvents[_0x9686('0x4')](_0x3219a8,_0x586d74);_0x392b68(null);};}for(var e in events){if(events[_0x9686('0x5')](e)){var event=events[e];UserNotification[_0x9686('0x6')](e,emitEvent(event));}}module[_0x9686('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x9593=['save','update','remove','emit','exports','../../mysqldb'];(function(_0x413e48,_0x2bf197){var _0x22c817=function(_0x5e3293){while(--_0x5e3293){_0x413e48['push'](_0x413e48['shift']());}};_0x22c817(++_0x2bf197);}(_0x9593,0xfb));var _0x3959=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x9593[_0x19efbc];return _0x205c5e;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x3959('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3959('0x1'),'afterUpdate':_0x3959('0x2'),'afterDestroy':_0x3959('0x3')};function emitEvent(_0x4207f0){return function(_0x51424c,_0x40ea49,_0x4a06a0){UserNotificationEvents[_0x3959('0x4')](_0x4207f0+':'+_0x51424c['id'],_0x51424c);UserNotificationEvents[_0x3959('0x4')](_0x4207f0,_0x51424c);_0x4a06a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x3959('0x5')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 5739c34..7c11df3 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 _0xd4aa=['../../config/logger','moment','bluebird','path','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x9ea8e2,_0x20cc78){var _0x48aa73=function(_0x3a6196){while(--_0x3a6196){_0x9ea8e2['push'](_0x9ea8e2['shift']());}};_0x48aa73(++_0x20cc78);}(_0xd4aa,0x8d));var _0xad4a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xd4aa[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xad4a('0x0'));var util=require(_0xad4a('0x1'));var logger=require(_0xad4a('0x2'))('api');var moment=require(_0xad4a('0x3'));var BPromise=require(_0xad4a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad4a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad4a('0x6'));module[_0xad4a('0x7')]=function(_0x4b6715,_0x3e8f36){return _0x4b6715[_0xad4a('0x8')](_0xad4a('0x9'),attributes,{'tableName':_0xad4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad4a('0xb'),'collate':_0xad4a('0xc')});}; \ No newline at end of file +var _0x24a1=['moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x50fb98,_0x1a5117){var _0xe51db5=function(_0x2bde90){while(--_0x2bde90){_0x50fb98['push'](_0x50fb98['shift']());}};_0xe51db5(++_0x1a5117);}(_0x24a1,0x102));var _0x124a=function(_0x2e63db,_0xa9835b){_0x2e63db=_0x2e63db-0x0;var _0x2944f7=_0x24a1[_0x2e63db];return _0x2944f7;};'use strict';var _=require(_0x124a('0x0'));var util=require('util');var logger=require(_0x124a('0x1'))('api');var moment=require(_0x124a('0x2'));var BPromise=require(_0x124a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x124a('0x4'));var rimraf=require(_0x124a('0x5'));var config=require(_0x124a('0x6'));var attributes=require(_0x124a('0x7'));module[_0x124a('0x8')]=function(_0x567f8e,_0xcf6310){return _0x567f8e[_0x124a('0x9')]('UserNotification',attributes,{'tableName':_0x124a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x124a('0xb'),'collate':_0x124a('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d1f702b..725ca6b 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 _0x0aab=['UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x290b36,_0x2e6172){var _0x1fa11a=function(_0x116c79){while(--_0x116c79){_0x290b36['push'](_0x290b36['shift']());}};_0x1fa11a(++_0x2e6172);}(_0x0aab,0x1b2));var _0xb0aa=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x0aab[_0x13843f];return _0x1063ae;};'use strict';var _=require(_0xb0aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb0aa('0x1'));var rs=require(_0xb0aa('0x2'));var fs=require('fs');var Redis=require(_0xb0aa('0x3'));var db=require(_0xb0aa('0x4'))['db'];var utils=require(_0xb0aa('0x5'));var logger=require(_0xb0aa('0x6'))(_0xb0aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb0aa('0x8')][_0xb0aa('0x9')]({'port':0x232a});config[_0xb0aa('0xa')]=_['defaults'](config[_0xb0aa('0xa')],{'host':_0xb0aa('0xb'),'port':0x18eb});var socket=require(_0xb0aa('0xc'))(new Redis(config[_0xb0aa('0xa')]));require(_0xb0aa('0xd'))[_0xb0aa('0xe')](socket);function respondWithRpcPromise(_0x25d5a2,_0x3e99e0,_0x729cee){return new BPromise(function(_0x13172a,_0x8348b3){return client[_0xb0aa('0xf')](_0x25d5a2,_0x729cee)['then'](function(_0x1e4a65){logger['info'](_0xb0aa('0x10'),_0x3e99e0,_0xb0aa('0x11'));logger[_0xb0aa('0x12')](_0xb0aa('0x13'),_0x3e99e0,_0xb0aa('0x11'),JSON['stringify'](_0x1e4a65));if(_0x1e4a65[_0xb0aa('0x14')]){if(_0x1e4a65[_0xb0aa('0x14')]['code']===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x3e99e0,_0x1e4a65[_0xb0aa('0x14')]['message']);return _0x8348b3(_0x1e4a65['error'][_0xb0aa('0x15')]);}logger[_0xb0aa('0x14')](_0xb0aa('0x10'),_0x3e99e0,_0x1e4a65['error'][_0xb0aa('0x15')]);return _0x13172a(_0x1e4a65[_0xb0aa('0x14')][_0xb0aa('0x15')]);}else{logger[_0xb0aa('0x16')](_0xb0aa('0x10'),_0x3e99e0,'request\x20sent');_0x13172a(_0x1e4a65[_0xb0aa('0x17')][_0xb0aa('0x15')]);}})[_0xb0aa('0x18')](function(_0x1db089){logger['error'](_0xb0aa('0x10'),_0x3e99e0,_0x1db089);_0x8348b3(_0x1db089);});});} \ No newline at end of file +var _0x1b79=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1f01e8,_0x31f7ad){var _0xb0ce86=function(_0x46315a){while(--_0x46315a){_0x1f01e8['push'](_0x1f01e8['shift']());}};_0xb0ce86(++_0x31f7ad);}(_0x1b79,0xdc));var _0x91b7=function(_0x11c557,_0x1261f8){_0x11c557=_0x11c557-0x0;var _0x1486a3=_0x1b79[_0x11c557];return _0x1486a3;};'use strict';var _=require(_0x91b7('0x0'));var util=require(_0x91b7('0x1'));var moment=require(_0x91b7('0x2'));var BPromise=require(_0x91b7('0x3'));var rs=require(_0x91b7('0x4'));var fs=require('fs');var Redis=require(_0x91b7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91b7('0x6'));var logger=require(_0x91b7('0x7'))(_0x91b7('0x8'));var config=require(_0x91b7('0x9'));var jayson=require(_0x91b7('0xa'));var client=jayson[_0x91b7('0xb')][_0x91b7('0xc')]({'port':0x232a});config[_0x91b7('0xd')]=_[_0x91b7('0xe')](config[_0x91b7('0xd')],{'host':_0x91b7('0xf'),'port':0x18eb});var socket=require(_0x91b7('0x10'))(new Redis(config[_0x91b7('0xd')]));require(_0x91b7('0x11'))[_0x91b7('0x12')](socket);function respondWithRpcPromise(_0x10964c,_0x22c4dd,_0x4f4aed){return new BPromise(function(_0x2076f6,_0xdd9e5c){return client[_0x91b7('0x13')](_0x10964c,_0x4f4aed)[_0x91b7('0x14')](function(_0x88d706){logger['info'](_0x91b7('0x15'),_0x22c4dd,'request\x20sent');logger[_0x91b7('0x16')](_0x91b7('0x17'),_0x22c4dd,_0x91b7('0x18'),JSON['stringify'](_0x88d706));if(_0x88d706[_0x91b7('0x19')]){if(_0x88d706[_0x91b7('0x19')][_0x91b7('0x1a')]===0x1f4){logger[_0x91b7('0x19')]('UserNotification,\x20%s,\x20%s',_0x22c4dd,_0x88d706['error'][_0x91b7('0x1b')]);return _0xdd9e5c(_0x88d706[_0x91b7('0x19')][_0x91b7('0x1b')]);}logger[_0x91b7('0x19')](_0x91b7('0x15'),_0x22c4dd,_0x88d706[_0x91b7('0x19')]['message']);return _0x2076f6(_0x88d706[_0x91b7('0x19')][_0x91b7('0x1b')]);}else{logger[_0x91b7('0x1c')]('UserNotification,\x20%s,\x20%s',_0x22c4dd,_0x91b7('0x18'));_0x2076f6(_0x88d706[_0x91b7('0x1d')]['message']);}})[_0x91b7('0x1e')](function(_0x19b95a){logger[_0x91b7('0x19')](_0x91b7('0x15'),_0x22c4dd,_0x19b95a);_0xdd9e5c(_0x19b95a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 4de0f6e..c827595 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 _0x3a4c=['save','update','register','length','userNotification:'];(function(_0x4dc7d5,_0x4087e2){var _0x22aa45=function(_0x238b8b){while(--_0x238b8b){_0x4dc7d5['push'](_0x4dc7d5['shift']());}};_0x22aa45(++_0x4087e2);}(_0x3a4c,0x14f));var _0xc3a4=function(_0x216780,_0x521052){_0x216780=_0x216780-0x0;var _0x4ef487=_0x3a4c[_0x216780];return _0x4ef487;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xc3a4('0x0'),'remove',_0xc3a4('0x1')];function createListener(_0xfcaa74,_0x36fe50){return function(_0x1b0ad0){_0x36fe50['emit'](_0xfcaa74,_0x1b0ad0);};}function removeListener(_0x3dda84,_0x56b7e){return function(){UserNotificationEvents['removeListener'](_0x3dda84,_0x56b7e);};}exports[_0xc3a4('0x2')]=function(_0x3ff191){for(var _0x419932=0x0,_0x41cc9a=events[_0xc3a4('0x3')];_0x419932<_0x41cc9a;_0x419932++){var _0x14676a=events[_0x419932];var _0x48380c=createListener(_0xc3a4('0x4')+_0x14676a,_0x3ff191);UserNotificationEvents['on'](_0x14676a,_0x48380c);}}; \ No newline at end of file +var _0x99b1=['./userNotification.events','save','remove','update','emit','removeListener','length','userNotification:'];(function(_0xa3ce3a,_0x5673b8){var _0x251d1a=function(_0x2d0fc7){while(--_0x2d0fc7){_0xa3ce3a['push'](_0xa3ce3a['shift']());}};_0x251d1a(++_0x5673b8);}(_0x99b1,0x110));var _0x199b=function(_0xc742d8,_0x22d28e){_0xc742d8=_0xc742d8-0x0;var _0x531abb=_0x99b1[_0xc742d8];return _0x531abb;};'use strict';var UserNotificationEvents=require(_0x199b('0x0'));var events=[_0x199b('0x1'),_0x199b('0x2'),_0x199b('0x3')];function createListener(_0x15a0ef,_0x417474){return function(_0x2d8e40){_0x417474[_0x199b('0x4')](_0x15a0ef,_0x2d8e40);};}function removeListener(_0x2b69a8,_0x96f199){return function(){UserNotificationEvents[_0x199b('0x5')](_0x2b69a8,_0x96f199);};}exports['register']=function(_0x7892d5){for(var _0x263295=0x0,_0x111978=events[_0x199b('0x6')];_0x263295<_0x111978;_0x263295++){var _0x4511df=events[_0x263295];var _0x5f3aab=createListener(_0x199b('0x7')+_0x4511df,_0x7892d5);UserNotificationEvents['on'](_0x4511df,_0x5f3aab);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 782dcda..e8d8e99 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x558fd7,_0x28aa87){var _0x41a21d=function(_0x4b096f){while(--_0x4b096f){_0x558fd7['push'](_0x558fd7['shift']());}};_0x41a21d(++_0x28aa87);}(_0x70e0,0x17b));var _0x070e=function(_0x24e9f8,_0x5ad5b4){_0x24e9f8=_0x24e9f8-0x0;var _0x25ad74=_0x70e0[_0x24e9f8];return _0x25ad74;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x339966,_0x2236ec){var _0x4f3347=function(_0xbd93d3){while(--_0xbd93d3){_0x339966['push'](_0x339966['shift']());}};_0x4f3347(++_0x2236ec);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 5f04f9d..d7d94c3 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 _0xc03a=['sequelize','exports','INTEGER'];(function(_0x22bd06,_0x2322e4){var _0x3a02c6=function(_0x225727){while(--_0x225727){_0x22bd06['push'](_0x22bd06['shift']());}};_0x3a02c6(++_0x2322e4);}(_0xc03a,0x1e3));var _0xac03=function(_0x1eff8e,_0x3dc442){_0x1eff8e=_0x1eff8e-0x0;var _0x251652=_0xc03a[_0x1eff8e];return _0x251652;};'use strict';var Sequelize=require(_0xac03('0x0'));module[_0xac03('0x1')]={'penalty':{'type':Sequelize[_0xac03('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f12=['sequelize','exports'];(function(_0x5047f8,_0x38b9d6){var _0x5b9ae9=function(_0x451491){while(--_0x451491){_0x5047f8['push'](_0x5047f8['shift']());}};_0x5b9ae9(++_0x38b9d6);}(_0x5f12,0x1f0));var _0x25f1=function(_0x4d39e1,_0x44bbb9){_0x4d39e1=_0x4d39e1-0x0;var _0x24df7f=_0x5f12[_0x4d39e1];return _0x24df7f;};'use strict';var Sequelize=require(_0x25f1('0x0'));module[_0x25f1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 5c36e59..5acd4fe 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 _0x50a9=['../../config/logger','api','request-promise','path','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x50a9,0x13e));var _0x950a=function(_0x3e14c3,_0x214814){_0x3e14c3=_0x3e14c3-0x0;var _0x23e6bd=_0x50a9[_0x3e14c3];return _0x23e6bd;};'use strict';var _=require(_0x950a('0x0'));var util=require(_0x950a('0x1'));var logger=require(_0x950a('0x2'))(_0x950a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x950a('0x4'));var fs=require('fs');var path=require(_0x950a('0x5'));var rimraf=require('rimraf');var config=require(_0x950a('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x34f05a,_0x596507){return _0x34f05a[_0x950a('0x7')](_0x950a('0x8'),attributes,{'tableName':_0x950a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2df0=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x556aec,_0x15ac7f){var _0x5322f6=function(_0x170202){while(--_0x170202){_0x556aec['push'](_0x556aec['shift']());}};_0x5322f6(++_0x15ac7f);}(_0x2df0,0xfd));var _0x02df=function(_0x4bb3de,_0x230ba2){_0x4bb3de=_0x4bb3de-0x0;var _0xe27505=_0x2df0[_0x4bb3de];return _0xe27505;};'use strict';var _=require(_0x02df('0x0'));var util=require(_0x02df('0x1'));var logger=require(_0x02df('0x2'))(_0x02df('0x3'));var moment=require(_0x02df('0x4'));var BPromise=require('bluebird');var rp=require(_0x02df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02df('0x6'));var config=require(_0x02df('0x7'));var attributes=require(_0x02df('0x8'));module[_0x02df('0x9')]=function(_0x34a773,_0x1462e6){return _0x34a773[_0x02df('0xa')](_0x02df('0xb'),attributes,{'tableName':_0x02df('0xc'),'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 a5c2cc8..eb57e13 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 _0x5845=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x151718,_0x2be570){var _0x1e7bed=function(_0x29cc53){while(--_0x29cc53){_0x151718['push'](_0x151718['shift']());}};_0x1e7bed(++_0x2be570);}(_0x5845,0x1a1));var _0x5584=function(_0x375c8d,_0x4fb2df){_0x375c8d=_0x375c8d-0x0;var _0x1224b0=_0x5845[_0x375c8d];return _0x1224b0;};'use strict';var _=require(_0x5584('0x0'));var util=require(_0x5584('0x1'));var moment=require(_0x5584('0x2'));var BPromise=require(_0x5584('0x3'));var rs=require(_0x5584('0x4'));var fs=require('fs');var Redis=require(_0x5584('0x5'));var db=require(_0x5584('0x6'))['db'];var utils=require(_0x5584('0x7'));var logger=require(_0x5584('0x8'))('rpc');var config=require(_0x5584('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5584('0xa')][_0x5584('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12745d,_0x21d4dc,_0x573ca9){return new BPromise(function(_0x71442a,_0x3144ca){return client[_0x5584('0xc')](_0x12745d,_0x573ca9)[_0x5584('0xd')](function(_0x43d39b){logger[_0x5584('0xe')](_0x5584('0xf'),_0x21d4dc,_0x5584('0x10'));logger[_0x5584('0x11')](_0x5584('0x12'),_0x21d4dc,'request\x20sent',JSON['stringify'](_0x43d39b));if(_0x43d39b[_0x5584('0x13')]){if(_0x43d39b[_0x5584('0x13')][_0x5584('0x14')]===0x1f4){logger[_0x5584('0x13')](_0x5584('0xf'),_0x21d4dc,_0x43d39b[_0x5584('0x13')][_0x5584('0x15')]);return _0x3144ca(_0x43d39b[_0x5584('0x13')]['message']);}logger[_0x5584('0x13')](_0x5584('0xf'),_0x21d4dc,_0x43d39b[_0x5584('0x13')][_0x5584('0x15')]);return _0x71442a(_0x43d39b[_0x5584('0x13')][_0x5584('0x15')]);}else{logger[_0x5584('0xe')](_0x5584('0xf'),_0x21d4dc,_0x5584('0x10'));_0x71442a(_0x43d39b[_0x5584('0x16')][_0x5584('0x15')]);}})[_0x5584('0x17')](function(_0x414529){logger[_0x5584('0x13')](_0x5584('0xf'),_0x21d4dc,_0x414529);_0x3144ca(_0x414529);});});} \ No newline at end of file +var _0x3320=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5b0ce5,_0x5d38c3){var _0x5ab99a=function(_0x3f09e4){while(--_0x3f09e4){_0x5b0ce5['push'](_0x5b0ce5['shift']());}};_0x5ab99a(++_0x5d38c3);}(_0x3320,0x1b8));var _0x0332=function(_0x584f94,_0x21e755){_0x584f94=_0x584f94-0x0;var _0x9c3ce1=_0x3320[_0x584f94];return _0x9c3ce1;};'use strict';var _=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var moment=require(_0x0332('0x2'));var BPromise=require(_0x0332('0x3'));var rs=require(_0x0332('0x4'));var fs=require('fs');var Redis=require(_0x0332('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0332('0x6'));var logger=require(_0x0332('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0332('0x8'));var client=jayson[_0x0332('0x9')][_0x0332('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12cc03,_0x3ad150,_0x376da6){return new BPromise(function(_0x41ea9d,_0x3f6959){return client[_0x0332('0xb')](_0x12cc03,_0x376da6)[_0x0332('0xc')](function(_0x3cd64a){logger['info'](_0x0332('0xd'),_0x3ad150,'request\x20sent');logger[_0x0332('0xe')](_0x0332('0xf'),_0x3ad150,_0x0332('0x10'),JSON[_0x0332('0x11')](_0x3cd64a));if(_0x3cd64a['error']){if(_0x3cd64a[_0x0332('0x12')][_0x0332('0x13')]===0x1f4){logger[_0x0332('0x12')](_0x0332('0xd'),_0x3ad150,_0x3cd64a[_0x0332('0x12')]['message']);return _0x3f6959(_0x3cd64a['error'][_0x0332('0x14')]);}logger[_0x0332('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3ad150,_0x3cd64a['error'][_0x0332('0x14')]);return _0x41ea9d(_0x3cd64a[_0x0332('0x12')][_0x0332('0x14')]);}else{logger[_0x0332('0x15')](_0x0332('0xd'),_0x3ad150,_0x0332('0x10'));_0x41ea9d(_0x3cd64a['result'][_0x0332('0x14')]);}})[_0x0332('0x16')](function(_0x47e5d8){logger[_0x0332('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3ad150,_0x47e5d8);_0x3f6959(_0x47e5d8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b254d50..ee5d60e 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 _0x5ad6=['index','/describe','isAuthenticated','describe','get','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','put','update','delete','destroy','removeSections','removeResources','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5ad6,0xfd));var _0x65ad=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x5ad6[_0x4a3acd];return _0x3efdaa;};'use strict';var multer=require(_0x65ad('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x65ad('0x1'));var router=express[_0x65ad('0x2')]();var fs_extra=require(_0x65ad('0x3'));var auth=require(_0x65ad('0x4'));var interaction=require(_0x65ad('0x5'));var config=require(_0x65ad('0x6'));var controller=require(_0x65ad('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x65ad('0x8')]);router['get'](_0x65ad('0x9'),auth[_0x65ad('0xa')](),controller[_0x65ad('0xb')]);router[_0x65ad('0xc')](_0x65ad('0xd'),auth['isAuthenticated'](),controller[_0x65ad('0xe')]);router[_0x65ad('0xc')](_0x65ad('0xf'),auth['isAuthenticated'](),controller[_0x65ad('0x10')]);router['get'](_0x65ad('0x11'),auth[_0x65ad('0xa')](),controller[_0x65ad('0x12')]);router[_0x65ad('0x13')]('/',auth['isAuthenticated'](),controller[_0x65ad('0x14')]);router[_0x65ad('0x13')](_0x65ad('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0x65ad('0x13')](_0x65ad('0xf'),auth[_0x65ad('0xa')](),controller['addSections']);router[_0x65ad('0x13')](_0x65ad('0x11'),auth[_0x65ad('0xa')](),controller['addResources']);router[_0x65ad('0x16')](_0x65ad('0xd'),auth['isAuthenticated'](),controller[_0x65ad('0x17')]);router[_0x65ad('0x18')](_0x65ad('0xd'),auth['isAuthenticated'](),controller[_0x65ad('0x19')]);router[_0x65ad('0x18')](_0x65ad('0xf'),auth['isAuthenticated'](),controller[_0x65ad('0x1a')]);router[_0x65ad('0x18')](_0x65ad('0x11'),auth['isAuthenticated'](),controller[_0x65ad('0x1b')]);module[_0x65ad('0x1c')]=router; \ No newline at end of file +var _0xbca6=['exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./userProfile.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/sections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','delete','destroy','removeResources'];(function(_0x248afa,_0xc057df){var _0x26d2d2=function(_0x337547){while(--_0x337547){_0x248afa['push'](_0x248afa['shift']());}};_0x26d2d2(++_0xc057df);}(_0xbca6,0x153));var _0x6bca=function(_0x2d57c7,_0x4a9901){_0x2d57c7=_0x2d57c7-0x0;var _0x246261=_0xbca6[_0x2d57c7];return _0x246261;};'use strict';var multer=require(_0x6bca('0x0'));var util=require(_0x6bca('0x1'));var path=require('path');var timeout=require(_0x6bca('0x2'));var express=require(_0x6bca('0x3'));var router=express['Router']();var fs_extra=require(_0x6bca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6bca('0x5'));var config=require('../../config/environment');var controller=require(_0x6bca('0x6'));router[_0x6bca('0x7')]('/',auth['isAuthenticated'](),controller[_0x6bca('0x8')]);router[_0x6bca('0x7')](_0x6bca('0x9'),auth[_0x6bca('0xa')](),controller['describe']);router[_0x6bca('0x7')](_0x6bca('0xb'),auth[_0x6bca('0xa')](),controller[_0x6bca('0xc')]);router[_0x6bca('0x7')](_0x6bca('0xd'),auth['isAuthenticated'](),controller['getSections']);router[_0x6bca('0x7')](_0x6bca('0xe'),auth[_0x6bca('0xa')](),controller['getResources']);router[_0x6bca('0xf')]('/',auth[_0x6bca('0xa')](),controller[_0x6bca('0x10')]);router[_0x6bca('0xf')](_0x6bca('0x11'),auth[_0x6bca('0xa')](),controller[_0x6bca('0x12')]);router[_0x6bca('0xf')](_0x6bca('0xd'),auth['isAuthenticated'](),controller[_0x6bca('0x13')]);router[_0x6bca('0xf')]('/:id/resources',auth[_0x6bca('0xa')](),controller[_0x6bca('0x14')]);router[_0x6bca('0x15')](_0x6bca('0xb'),auth[_0x6bca('0xa')](),controller['update']);router[_0x6bca('0x16')](_0x6bca('0xb'),auth[_0x6bca('0xa')](),controller[_0x6bca('0x17')]);router[_0x6bca('0x16')](_0x6bca('0xd'),auth[_0x6bca('0xa')](),controller['removeSections']);router[_0x6bca('0x16')](_0x6bca('0xe'),auth[_0x6bca('0xa')](),controller[_0x6bca('0x18')]);module[_0x6bca('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6eb727d..e6babeb 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 _0x1d91=['name','crudPermissions','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x59079d,_0x4dd722){var _0x31df35=function(_0x3eb986){while(--_0x3eb986){_0x59079d['push'](_0x59079d['shift']());}};_0x31df35(++_0x4dd722);}(_0x1d91,0x89));var _0x11d9=function(_0x4f47ed,_0x4efe68){_0x4f47ed=_0x4f47ed-0x0;var _0x45f8ee=_0x1d91[_0x4f47ed];return _0x45f8ee;};'use strict';var Sequelize=require(_0x11d9('0x0'));module[_0x11d9('0x1')]={'name':{'type':Sequelize[_0x11d9('0x2')],'allowNull':![],'unique':_0x11d9('0x3')},'crudPermissions':{'type':Sequelize[_0x11d9('0x2')],'set':function(_0x266414){this['setDataValue'](_0x11d9('0x4'),_0x266414?_0x266414['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0x11d9('0x4'))[_0x11d9('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdf9c=['BOOLEAN','sequelize','exports','STRING','name','crudPermissions','getDataValue','split'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0xdf9c,0x71));var _0xcdf9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdf9c[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xcdf9('0x0'));module[_0xcdf9('0x1')]={'name':{'type':Sequelize[_0xcdf9('0x2')],'allowNull':![],'unique':_0xcdf9('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5d3bb1){this['setDataValue'](_0xcdf9('0x4'),_0x5d3bb1?_0x5d3bb1['join'](''):[]);},'get':function(){return this[_0xcdf9('0x5')](_0xcdf9('0x4'))?this[_0xcdf9('0x5')](_0xcdf9('0x4'))[_0xcdf9('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcdf9('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcdf9('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcdf9('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcdf9('0x7')],'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 c6a1b94..66c612f 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 _0xcc6d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','filters','include','find','create','body','length','omit','crudPermissions','createdAt','updatedAt','get','each','UserProfileResource','Resources','describe','addSections','sequelize','transaction','UserProfileSection','sectionId','userProfileId','removeSections','getSections','includes','subsections','enabled','concat','push','autoAssociation','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2966de,_0xc756d5){var _0x4e75a2=function(_0x15b554){while(--_0x15b554){_0x2966de['push'](_0x2966de['shift']());}};_0x4e75a2(++_0xc756d5);}(_0xcc6d,0xd0));var _0xdcc6=function(_0x361b8c,_0xe8d07c){_0x361b8c=_0x361b8c-0x0;var _0x530501=_0xcc6d[_0x361b8c];return _0x530501;};'use strict';var emlformat=require(_0xdcc6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcc6('0x1'));var jsonpatch=require(_0xdcc6('0x2'));var rp=require(_0xdcc6('0x3'));var moment=require(_0xdcc6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcc6('0x5'));var util=require('util');var path=require(_0xdcc6('0x6'));var sox=require(_0xdcc6('0x7'));var csv=require(_0xdcc6('0x8'));var ejs=require(_0xdcc6('0x9'));var fs=require('fs');var fs_extra=require(_0xdcc6('0xa'));var _=require(_0xdcc6('0xb'));var squel=require(_0xdcc6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdcc6('0x8'));var querystring=require(_0xdcc6('0xd'));var Papa=require(_0xdcc6('0xe'));var Redis=require('ioredis');var authService=require(_0xdcc6('0xf'));var qs=require(_0xdcc6('0x10'));var as=require(_0xdcc6('0x11'));var hardwareService=require(_0xdcc6('0x12'));var logger=require(_0xdcc6('0x13'))(_0xdcc6('0x14'));var utils=require(_0xdcc6('0x15'));var config=require(_0xdcc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcc6('0x17'))['db'];config[_0xdcc6('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcc6('0x18')]));require(_0xdcc6('0x19'))[_0xdcc6('0x1a')](socket);function respondWithStatusCode(_0x149d7e,_0x55f564){_0x55f564=_0x55f564||0xcc;return function(_0x2c3b26){if(_0x2c3b26){return _0x149d7e[_0xdcc6('0x1b')](_0x55f564);}return _0x149d7e['status'](_0x55f564)[_0xdcc6('0x1c')]();};}function respondWithResult(_0x30a303,_0x4834f8){_0x4834f8=_0x4834f8||0xc8;return function(_0x32e90a){if(_0x32e90a){return _0x30a303[_0xdcc6('0x1d')](_0x4834f8)[_0xdcc6('0x1e')](_0x32e90a);}};}function respondWithFilteredResult(_0x380166,_0x1f9951){return function(_0x15d992){if(_0x15d992){var _0x30ac1d=typeof _0x1f9951[_0xdcc6('0x1f')]===_0xdcc6('0x20')&&typeof _0x1f9951[_0xdcc6('0x21')]==='undefined';var _0x5b1bfd=_0x15d992['count'];var _0x178bcc=_0x30ac1d?0x0:_0x1f9951[_0xdcc6('0x1f')];var _0x2f28a9=_0x30ac1d?_0x15d992[_0xdcc6('0x22')]:_0x1f9951[_0xdcc6('0x1f')]+_0x1f9951['limit'];var _0x3cd5b0;if(_0x2f28a9>=_0x5b1bfd){_0x2f28a9=_0x5b1bfd;_0x3cd5b0=0xc8;}else{_0x3cd5b0=0xce;}_0x380166[_0xdcc6('0x1d')](_0x3cd5b0);return _0x380166[_0xdcc6('0x23')](_0xdcc6('0x24'),_0x178bcc+'-'+_0x2f28a9+'/'+_0x5b1bfd)[_0xdcc6('0x1e')](_0x15d992);}return null;};}function patchUpdates(_0xaa0cfd){return function(_0x450978){try{jsonpatch[_0xdcc6('0x25')](_0x450978,_0xaa0cfd,!![]);}catch(_0x21f977){return BPromise['reject'](_0x21f977);}return _0x450978[_0xdcc6('0x26')]();};}function saveUpdates(_0x91bb6f,_0x49cf60){return function(_0x18893b){if(_0x18893b){return _0x18893b[_0xdcc6('0x27')](_0x91bb6f)[_0xdcc6('0x28')](function(_0x59e518){return _0x59e518;});}return null;};}function removeEntity(_0x5e0220,_0x171950){return function(_0x315f9e){if(_0x315f9e){return _0x315f9e[_0xdcc6('0x29')]()[_0xdcc6('0x28')](function(){_0x5e0220[_0xdcc6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52659f,_0x3c6ef2){return function(_0xdc28a1){if(!_0xdc28a1){_0x52659f[_0xdcc6('0x1b')](0x194);}return _0xdc28a1;};}function handleError(_0x4be986,_0x5ddb8a){_0x5ddb8a=_0x5ddb8a||0x1f4;return function(_0x4aab30){logger[_0xdcc6('0x2a')](_0x4aab30['stack']);if(_0x4aab30[_0xdcc6('0x2b')]){delete _0x4aab30[_0xdcc6('0x2b')];}_0x4be986['status'](_0x5ddb8a)[_0xdcc6('0x2c')](_0x4aab30);};}exports[_0xdcc6('0x2d')]=function(_0x4a6e61,_0x1d2b2f){var _0x413f00={},_0x159779={},_0x16440e={'count':0x0,'rows':[]};var _0x530c86=_[_0xdcc6('0x2e')](db[_0xdcc6('0x2f')][_0xdcc6('0x30')],function(_0x2a7ca7){return{'name':_0x2a7ca7[_0xdcc6('0x31')],'type':_0x2a7ca7[_0xdcc6('0x32')][_0xdcc6('0x33')]};});_0x159779[_0xdcc6('0x34')]=_[_0xdcc6('0x2e')](_0x530c86,'name');_0x159779[_0xdcc6('0x35')]=_['keys'](_0x4a6e61[_0xdcc6('0x35')]);_0x159779['filters']=_[_0xdcc6('0x36')](_0x159779[_0xdcc6('0x34')],_0x159779['query']);_0x413f00[_0xdcc6('0x37')]=_[_0xdcc6('0x36')](_0x159779[_0xdcc6('0x34')],qs[_0xdcc6('0x38')](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x38')]));_0x413f00[_0xdcc6('0x37')]=_0x413f00[_0xdcc6('0x37')]['length']?_0x413f00[_0xdcc6('0x37')]:_0x159779['model'];if(!_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x39')](_0xdcc6('0x3a'))){_0x413f00[_0xdcc6('0x21')]=qs[_0xdcc6('0x21')](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x21')]);_0x413f00[_0xdcc6('0x1f')]=qs['offset'](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x1f')]);}_0x413f00[_0xdcc6('0x3b')]=qs['sort'](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x3c')]);_0x413f00[_0xdcc6('0x3d')]=qs['filters'](_[_0xdcc6('0x3e')](_0x4a6e61[_0xdcc6('0x35')],_0x159779['filters']),_0x530c86);if(_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x3f')]){_0x413f00[_0xdcc6('0x3d')]=_[_0xdcc6('0x40')](_0x413f00[_0xdcc6('0x3d')],{'$or':_['map'](_0x530c86,function(_0x5e54e4){if(_0x5e54e4[_0xdcc6('0x32')]!==_0xdcc6('0x41')){var _0x56f2a9={};_0x56f2a9[_0x5e54e4[_0xdcc6('0x2b')]]={'$like':'%'+_0x4a6e61['query'][_0xdcc6('0x3f')]+'%'};return _0x56f2a9;}})});}_0x413f00=_[_0xdcc6('0x40')]({},_0x413f00,_0x4a6e61[_0xdcc6('0x42')]);var _0x3cbb62={'where':_0x413f00[_0xdcc6('0x3d')]};return db[_0xdcc6('0x2f')]['count'](_0x3cbb62)['then'](function(_0x3d9ad1){_0x16440e[_0xdcc6('0x22')]=_0x3d9ad1;if(_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x43')]){_0x413f00['include']=[{'all':!![]}];}return db['UserProfile'][_0xdcc6('0x44')](_0x413f00);})[_0xdcc6('0x28')](function(_0x42044d){_0x16440e['rows']=_0x42044d;return _0x16440e;})[_0xdcc6('0x28')](respondWithFilteredResult(_0x1d2b2f,_0x413f00))[_0xdcc6('0x45')](handleError(_0x1d2b2f,null));};exports[_0xdcc6('0x46')]=function(_0x20f90e,_0x34f7cc){var _0x2f16c0={'raw':![],'where':{'id':_0x20f90e[_0xdcc6('0x47')]['id']}},_0x2a673e={};_0x2a673e['model']=_['keys'](db[_0xdcc6('0x2f')][_0xdcc6('0x30')]);_0x2a673e[_0xdcc6('0x35')]=_[_0xdcc6('0x48')](_0x20f90e[_0xdcc6('0x35')]);_0x2a673e[_0xdcc6('0x49')]=_[_0xdcc6('0x36')](_0x2a673e[_0xdcc6('0x34')],_0x2a673e[_0xdcc6('0x35')]);_0x2f16c0['attributes']=_[_0xdcc6('0x36')](_0x2a673e[_0xdcc6('0x34')],qs['fields'](_0x20f90e['query'][_0xdcc6('0x38')]));_0x2f16c0[_0xdcc6('0x37')]=_0x2f16c0[_0xdcc6('0x37')]['length']?_0x2f16c0[_0xdcc6('0x37')]:_0x2a673e[_0xdcc6('0x34')];if(_0x20f90e[_0xdcc6('0x35')]['includeAll']){_0x2f16c0[_0xdcc6('0x4a')]=[{'all':!![]}];}_0x2f16c0=_[_0xdcc6('0x40')]({},_0x2f16c0,_0x20f90e[_0xdcc6('0x42')]);return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')](_0x2f16c0)[_0xdcc6('0x28')](handleEntityNotFound(_0x34f7cc,null))[_0xdcc6('0x28')](respondWithResult(_0x34f7cc,null))['catch'](handleError(_0x34f7cc,null));};exports[_0xdcc6('0x4c')]=function(_0x4d8bb0,_0x483ee0){return db['UserProfile'][_0xdcc6('0x4c')](_0x4d8bb0[_0xdcc6('0x4d')],{})[_0xdcc6('0x28')](respondWithResult(_0x483ee0,0xc9))[_0xdcc6('0x45')](handleError(_0x483ee0,null));};exports['clone']=function(_0x3f0973,_0x37cd7f){var _0x41eafe={'where':{'id':_0x3f0973[_0xdcc6('0x47')]['id']}},_0x5b2547={};_0x5b2547[_0xdcc6('0x34')]=_[_0xdcc6('0x48')](db[_0xdcc6('0x2f')][_0xdcc6('0x30')]);_0x41eafe[_0xdcc6('0x37')]=_['intersection'](_0x5b2547[_0xdcc6('0x34')],qs['fields'](_0x3f0973[_0xdcc6('0x35')][_0xdcc6('0x38')]));_0x41eafe[_0xdcc6('0x37')]=_0x41eafe['attributes'][_0xdcc6('0x4e')]?_0x41eafe[_0xdcc6('0x37')]:_0x5b2547['model'];if(_0x3f0973['query'][_0xdcc6('0x43')]){_0x41eafe[_0xdcc6('0x4a')]=[{'all':!![]}];}_0x41eafe=_[_0xdcc6('0x40')]({},_0x41eafe,_0x3f0973[_0xdcc6('0x42')]);return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')](_0x41eafe)[_0xdcc6('0x28')](handleEntityNotFound(_0x37cd7f,null))[_0xdcc6('0x28')](function(_0x5a60b6){if(_0x5a60b6){var _0x41c566=_0x5a60b6['get']({'plain':!![]});_0x41c566=qs[_0xdcc6('0x4f')](_0x41c566,['id','createdAt','updatedAt',_0xdcc6('0x50')]);_0x3f0973['body']=_[_0xdcc6('0x4f')](_0x3f0973[_0xdcc6('0x4d')],['id',_0xdcc6('0x51'),_0xdcc6('0x52')]);return db['sequelize']['transaction'](function(_0x942c11){return db[_0xdcc6('0x2f')][_0xdcc6('0x4c')](_[_0xdcc6('0x40')](_0x41c566,_0x3f0973[_0xdcc6('0x4d')]),{'include':_0x3f0973['query'][_0xdcc6('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x942c11})['then'](function(_0x488b58){var _0x41bea1=_0x488b58[_0xdcc6('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xdcc6('0x44')]({'where':{'userProfileId':_0x3f0973[_0xdcc6('0x47')]['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x4c7bd7){if(_0x4c7bd7){return BPromise[_0xdcc6('0x54')](_0x4c7bd7,function(_0x3a49c3){return new BPromise(function(_0x426b33,_0x41ddfc){if(_0x3a49c3['autoAssociation']===null||_0x3a49c3['autoAssociation']===0x1)_0x426b33(null);return db[_0xdcc6('0x55')]['findAll']({'where':{'sectionId':_0x3a49c3['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x5c2cac){var _0x1b3efd=_['map'](_0x5c2cac,function(_0x1890fb){return qs[_0xdcc6('0x4f')](_0x1890fb,['id',_0xdcc6('0x51'),'updatedAt','sectionId']);});_0x426b33(_0x1b3efd);})[_0xdcc6('0x45')](function(_0x30edff){_0x41ddfc(_0x30edff);});})[_0xdcc6('0x28')](function(_0x828d3f){var _0x258512=qs[_0xdcc6('0x4f')](_0x3a49c3,['id',_0xdcc6('0x51'),_0xdcc6('0x52')]);_0x258512['userProfileId']=_0x41bea1['id'];if(_0x828d3f)_0x258512[_0xdcc6('0x56')]=_0x828d3f;return _0x258512;})[_0xdcc6('0x28')](function(_0xc0953a){return db['UserProfileSection'][_0xdcc6('0x4c')](_0xc0953a,{'include':[{'model':db[_0xdcc6('0x55')],'as':_0xdcc6('0x56')}],'raw':!![],'transaction':_0x942c11});});})[_0xdcc6('0x28')](function(){return _0x41bea1;});}});});});}})['then'](respondWithResult(_0x37cd7f,0xc9))[_0xdcc6('0x45')](handleError(_0x37cd7f,null));};exports['update']=function(_0x1e09a1,_0x2c9665){if(_0x1e09a1[_0xdcc6('0x4d')]['id']){delete _0x1e09a1['body']['id'];}return db['UserProfile'][_0xdcc6('0x4b')]({'where':{'id':_0x1e09a1[_0xdcc6('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c9665,null))[_0xdcc6('0x28')](saveUpdates(_0x1e09a1[_0xdcc6('0x4d')],null))[_0xdcc6('0x28')](respondWithResult(_0x2c9665,null))['catch'](handleError(_0x2c9665,null));};exports[_0xdcc6('0x29')]=function(_0x37bb16,_0x472cac){return db[_0xdcc6('0x2f')]['find']({'where':{'id':_0x37bb16[_0xdcc6('0x47')]['id']}})['then'](handleEntityNotFound(_0x472cac,null))[_0xdcc6('0x28')](removeEntity(_0x472cac,null))[_0xdcc6('0x45')](handleError(_0x472cac,null));};exports[_0xdcc6('0x57')]=function(_0x1093bf,_0xd36a0a){return db[_0xdcc6('0x2f')]['describe']()[_0xdcc6('0x28')](respondWithResult(_0xd36a0a,null))[_0xdcc6('0x45')](handleError(_0xd36a0a,null));};exports[_0xdcc6('0x58')]=function(_0xa723ca,_0x5b01fa){var _0xa86825=_0xa723ca['body'];return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')]({'where':{'id':_0xa723ca[_0xdcc6('0x47')]['id']}})[_0xdcc6('0x28')](handleEntityNotFound(_0x5b01fa,null))['then'](function(_0x48ae12){if(_0x48ae12){return db[_0xdcc6('0x59')][_0xdcc6('0x5a')](function(_0x408f10){return db[_0xdcc6('0x5b')]['destroy']({'where':{'userProfileId':_0xa723ca[_0xdcc6('0x47')]['id'],'sectionId':_[_0xdcc6('0x2e')](_0xa86825,function(_0x2bac43){return _0x2bac43[_0xdcc6('0x5c')];})},'transaction':_0x408f10})[_0xdcc6('0x28')](function(){var _0x49c566=_[_0xdcc6('0x2e')](_0xa86825,function(_0x2f7dde){_0x2f7dde[_0xdcc6('0x5d')]=_0xa723ca['params']['id'];return _0x2f7dde;});var _0xbebf64=[];return BPromise[_0xdcc6('0x54')](_0x49c566,function(_0x51c826){return db[_0xdcc6('0x5b')]['create'](_0x51c826,{'include':[{'model':db[_0xdcc6('0x55')],'as':_0xdcc6('0x56')}],'raw':!![],'transaction':_0x408f10})['then'](function(_0x18e06){_0xbebf64['push'](_0x18e06[_0xdcc6('0x53')]({'plain':!![]}));});})[_0xdcc6('0x28')](function(){return _0xbebf64;});});});}})[_0xdcc6('0x28')](function(_0x5cb63d){return _0x5cb63d;})[_0xdcc6('0x28')](respondWithResult(_0x5b01fa,null))[_0xdcc6('0x45')](handleError(_0x5b01fa,null));};exports[_0xdcc6('0x5e')]=function(_0x21ef0c,_0x970694){var _0x3a0fb0;return db['UserProfile'][_0xdcc6('0x4b')]({'where':{'id':_0x21ef0c[_0xdcc6('0x47')]['id']},'attributes':['id',_0xdcc6('0x2b')]})[_0xdcc6('0x28')](handleEntityNotFound(_0x970694,null))[_0xdcc6('0x28')](function(_0x5e599a){if(_0x5e599a){_0x3a0fb0=_0x5e599a;return db[_0xdcc6('0x5b')]['destroy']({'where':{'userProfileId':_0x21ef0c[_0xdcc6('0x47')]['id'],'sectionId':_0x21ef0c[_0xdcc6('0x35')]['ids']}});}})[_0xdcc6('0x28')](function(){return _0x3a0fb0;})[_0xdcc6('0x28')](respondWithStatusCode(_0x970694,null))[_0xdcc6('0x45')](handleError(_0x970694,null));};exports[_0xdcc6('0x5f')]=function(_0x21909e,_0x50e3f9){var _0x35f4a0=[];var _0x4853ea=[];return db[_0xdcc6('0x5b')][_0xdcc6('0x44')]({'where':{'userProfileId':_0x21909e[_0xdcc6('0x47')]['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x475421){_0x35f4a0=_[_0xdcc6('0x3f')](_0x475421,function(_0x245c45){return _0x245c45['enabled']===0x1||_[_0xdcc6('0x60')]([0x3eb,0x709],_0x245c45[_0xdcc6('0x5c')]);});if(!_['isEmpty'](_0x35f4a0)){return _['map'](_0x35f4a0,function(_0x152d2b){return _0x152d2b[_0xdcc6('0x5c')];});}else{return;}})[_0xdcc6('0x28')](function(_0x2263ab){if(_0x2263ab)_0x4853ea=_0x2263ab;if(_[_0xdcc6('0x60')](_0x4853ea,0x64)){var _0x16c4d4=_[_0xdcc6('0x4b')](_0x35f4a0,{'sectionId':0x64});return hasDefaultDashboard(_0x16c4d4)[_0xdcc6('0x28')](function(_0x3434c0){return _[_0xdcc6('0x2e')](_0x35f4a0,function(_0x220b27){if(_0x220b27[_0xdcc6('0x5c')]===0x64){_0x220b27[_0xdcc6('0x61')]=_0x3434c0;}return _0x220b27;});});}else{return;}})[_0xdcc6('0x28')](function(_0xba7095){if(_0xba7095)_0x35f4a0=_0xba7095;if(_['includes'](_0x4853ea,0x3eb)){var _0x7ebc29=_[_0xdcc6('0x4b')](_0x35f4a0,{'sectionId':0x3eb});return getCustomDashboards(_0x7ebc29)[_0xdcc6('0x28')](function(_0x2ebdd4){return _['map'](_0x35f4a0,function(_0x397d4d){if(_0x7ebc29[_0xdcc6('0x62')]){if(_0x397d4d[_0xdcc6('0x5c')]===0x3eb){_0x397d4d[_0xdcc6('0x61')]=_0x2ebdd4;}}else{if(_0x397d4d['sectionId']===0x64){if(!_0x397d4d[_0xdcc6('0x61')]){_0x397d4d[_0xdcc6('0x61')]=[];}_0x397d4d[_0xdcc6('0x61')]=_0x397d4d['subsections'][_0xdcc6('0x63')](_0x2ebdd4);}}return _0x397d4d;});});}else{return;}})[_0xdcc6('0x28')](function(_0x59fcc1){if(_0x59fcc1)_0x35f4a0=_0x59fcc1;if(_[_0xdcc6('0x60')](_0x4853ea,0x709)){var _0x1edfb6=_[_0xdcc6('0x4b')](_0x35f4a0,{'sectionId':0x709});return getPlugins(_0x1edfb6)['then'](function(_0x381d65){if(_0x1edfb6[_0xdcc6('0x62')]){return _['map'](_0x35f4a0,function(_0x5152c6){if(_0x5152c6[_0xdcc6('0x5c')]===0x709){_0x5152c6[_0xdcc6('0x61')]=_0x381d65;}return _0x5152c6;});}else{var _0x58932c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x381d65};var _0x532021=_[_0xdcc6('0x2e')](_0x35f4a0);_0x532021[_0xdcc6('0x64')](_0x58932c);return _0x532021;}});}else{return;}})['then'](function(_0x18e6db){if(_0x18e6db)_0x35f4a0=_0x18e6db;return _[_0xdcc6('0x3f')](_0x35f4a0,[_0xdcc6('0x62'),0x1]);})[_0xdcc6('0x28')](respondWithResult(_0x50e3f9,null))[_0xdcc6('0x45')](handleError(_0x50e3f9,null));};function hasDefaultDashboard(_0x3b9b8a){var _0x501976=[0x65];return new BPromise(function(_0x42695f,_0x5c1c0a){try{if(_0x3b9b8a[_0xdcc6('0x65')]){_0x42695f(_0x501976);}else{return db[_0xdcc6('0x55')][_0xdcc6('0x66')]({'where':{'sectionId':_0x3b9b8a['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x4f7dd1){_0x4f7dd1?_0x42695f(_0x501976):_0x42695f();});}}catch(_0x795b30){_0x5c1c0a(_0x795b30);}});}function getCustomDashboards(_0x258ce3){var _0x3a500d=[];return new BPromise(function(_0x5e220f,_0x3d1194){try{if(_0x258ce3[_0xdcc6('0x65')]){return db['Dashboard']['findAll']({'raw':!![]})[_0xdcc6('0x28')](function(_0x303d8f){_0x303d8f[_0xdcc6('0x67')](function(_0x5d6916){_0x3a500d[_0xdcc6('0x64')](_0x5d6916['id']+0x1869f);});_0x5e220f(_0x3a500d);});}else{return db['UserProfileResource'][_0xdcc6('0x44')]({'where':{'sectionId':_0x258ce3['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x1d5c05){_0x1d5c05[_0xdcc6('0x67')](function(_0x1ee490){_0x3a500d[_0xdcc6('0x64')](_0x1ee490[_0xdcc6('0x68')]+0x1869f);});_0x5e220f(_0x3a500d);});}}catch(_0x4ab986){_0x3d1194(_0x4ab986);}});}function getPlugins(_0x254d4e){var _0x2c35b7=[];return new BPromise(function(_0x548070,_0x263ba6){try{if(_0x254d4e['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})['then'](function(_0x5dfb30){_0x5dfb30[_0xdcc6('0x67')](function(_0x11055f){_0x2c35b7[_0xdcc6('0x64')](_0x11055f['id']+0x15b38);});_0x548070(_0x2c35b7);});}else{return db['UserProfileResource'][_0xdcc6('0x44')]({'where':{'sectionId':_0x254d4e['id']},'raw':!![]})['then'](function(_0x53b369){_0x53b369[_0xdcc6('0x67')](function(_0xb085bd){_0x2c35b7[_0xdcc6('0x64')](_0xb085bd['resourceId']+0x15b38);});_0x548070(_0x2c35b7);});}}catch(_0x52813c){_0x263ba6(_0x52813c);}});}exports[_0xdcc6('0x69')]=function(_0x177a89,_0x49456d){return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')]({'where':{'id':_0x177a89['params']['id']}})[_0xdcc6('0x28')](handleEntityNotFound(_0x49456d,null))[_0xdcc6('0x28')](function(_0x36bf93){if(_0x36bf93){return db[_0xdcc6('0x59')][_0xdcc6('0x5a')](function(_0x5656d3){return db[_0xdcc6('0x5b')][_0xdcc6('0x44')]({'where':{'userProfileId':_0x177a89[_0xdcc6('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xdcc6('0x28')](function(_0x665f8e){if(_0x665f8e){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x177a89['params']['id'],'id':_[_0xdcc6('0x2e')](_0x665f8e,function(_0x1d3390){return _0x1d3390['id'];})},'transaction':_0x5656d3});}})['then'](function(_0x439de1){var _0xaf8a7f=_[_0xdcc6('0x2e')](_0x177a89[_0xdcc6('0x4d')],function(_0x76ed9a){_0x76ed9a[_0xdcc6('0x5d')]=_0x177a89[_0xdcc6('0x47')]['id'];return _0x76ed9a;});return db[_0xdcc6('0x5b')][_0xdcc6('0x6a')](_0xaf8a7f,{'raw':!![],'transaction':_0x5656d3});})['then'](function(_0x2c2589){var _0x2d0f05=_[_0xdcc6('0x3f')](_[_0xdcc6('0x2e')](_0x2c2589,function(_0x34c103){return _0x34c103[_0xdcc6('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x2d0f05){return db[_0xdcc6('0x5b')][_0xdcc6('0x44')]({'where':{'userProfileId':_0x177a89[_0xdcc6('0x47')]['id'],'sectionId':_[_0xdcc6('0x2e')](_0x2d0f05,function(_0x2a7fa1){return _0x2a7fa1[_0xdcc6('0x5c')];})},'attributes':['id',_0xdcc6('0x5c')],'raw':!![]})[_0xdcc6('0x28')](function(_0x3ad34a){var _0x100a46=_['map'](_0x177a89['body'],function(_0x22f8e6){_0x22f8e6[_0xdcc6('0x5d')]=_0x177a89['params']['id'];return _0x22f8e6;});return db[_0xdcc6('0x55')][_0xdcc6('0x6a')](_0x100a46,{'raw':!![],'transaction':_0x5656d3});});}})['catch'](handleError(_0x49456d,null));});}})[_0xdcc6('0x28')](function(_0x3c3c7f){var _0x44ffcb=_['map'](_0x3c3c7f,function(_0x103145){return _0x103145[_0xdcc6('0x53')]({'plain':!![]});});})[_0xdcc6('0x28')](respondWithResult(_0x49456d,null))[_0xdcc6('0x45')](handleError(_0x49456d,null));};exports[_0xdcc6('0x6b')]=function(_0x801b70,_0x221ffd,_0x84719d){return db['UserProfile'][_0xdcc6('0x4b')]({'where':{'id':_0x801b70[_0xdcc6('0x47')]['id']}})[_0xdcc6('0x28')](handleEntityNotFound(_0x221ffd,null))[_0xdcc6('0x28')](function(_0x4166b5){if(_0x4166b5){return _0x4166b5[_0xdcc6('0x6b')](_0x801b70[_0xdcc6('0x35')][_0xdcc6('0x6c')]);}})[_0xdcc6('0x28')](respondWithStatusCode(_0x221ffd,null))[_0xdcc6('0x45')](handleError(_0x221ffd,null));};exports[_0xdcc6('0x6d')]=function(_0x4caafd,_0x2c7e02){var _0x516498={};if(!_0x4caafd['query'][_0xdcc6('0x6e')])throw new Error(_0xdcc6('0x6f'));if(!_0x4caafd['query'][_0xdcc6('0x39')]('nolimit')){_0x516498[_0xdcc6('0x21')]=qs['limit'](_0x4caafd['query']['limit']);_0x516498['offset']=qs['offset'](_0x4caafd['query'][_0xdcc6('0x1f')]);}return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')]({'where':{'id':_0x4caafd[_0xdcc6('0x47')]['id']}})[_0xdcc6('0x28')](function(_0x8d5e45){if(!_0x8d5e45)throw new Error(_0xdcc6('0x70')+_0x4caafd[_0xdcc6('0x47')]['id']);return db[_0xdcc6('0x2f')]['getResources'](_0x4caafd);})[_0xdcc6('0x28')](respondWithFilteredResult(_0x2c7e02,_0x516498))[_0xdcc6('0x45')](handleError(_0x2c7e02,null));}; \ No newline at end of file +var _0x66b5=['stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','body','length','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','removeSections','getSections','includes','enabled','subsections','concat','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','redis','defaults','localhost','socket.io-emitter','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x66b5,0x19c));var _0x566b=function(_0x14acd3,_0x38ca0f){_0x14acd3=_0x14acd3-0x0;var _0x46018b=_0x66b5[_0x14acd3];return _0x46018b;};'use strict';var emlformat=require(_0x566b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x566b('0x1'));var rp=require(_0x566b('0x2'));var moment=require(_0x566b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x566b('0x4'));var util=require(_0x566b('0x5'));var path=require(_0x566b('0x6'));var sox=require(_0x566b('0x7'));var csv=require(_0x566b('0x8'));var ejs=require(_0x566b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x566b('0xa'));var squel=require(_0x566b('0xb'));var crypto=require('crypto');var jsforce=require(_0x566b('0xc'));var deskjs=require(_0x566b('0xd'));var toCsv=require(_0x566b('0x8'));var querystring=require(_0x566b('0xe'));var Papa=require(_0x566b('0xf'));var Redis=require('ioredis');var authService=require(_0x566b('0x10'));var qs=require(_0x566b('0x11'));var as=require(_0x566b('0x12'));var hardwareService=require(_0x566b('0x13'));var logger=require(_0x566b('0x14'))(_0x566b('0x15'));var utils=require('../../config/utils');var config=require(_0x566b('0x16'));var licenseUtil=require(_0x566b('0x17'));var db=require(_0x566b('0x18'))['db'];config[_0x566b('0x19')]=_[_0x566b('0x1a')](config[_0x566b('0x19')],{'host':_0x566b('0x1b'),'port':0x18eb});var socket=require(_0x566b('0x1c'))(new Redis(config[_0x566b('0x19')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x93dde1,_0x47c455){_0x47c455=_0x47c455||0xcc;return function(_0x2e2e68){if(_0x2e2e68){return _0x93dde1['sendStatus'](_0x47c455);}return _0x93dde1['status'](_0x47c455)['end']();};}function respondWithResult(_0x4e2ee3,_0x5391bf){_0x5391bf=_0x5391bf||0xc8;return function(_0x5d78ee){if(_0x5d78ee){return _0x4e2ee3[_0x566b('0x1d')](_0x5391bf)[_0x566b('0x1e')](_0x5d78ee);}};}function respondWithFilteredResult(_0x48e63d,_0x19d330){return function(_0x53f35e){if(_0x53f35e){var _0x1b02cf=typeof _0x19d330[_0x566b('0x1f')]==='undefined'&&typeof _0x19d330[_0x566b('0x20')]===_0x566b('0x21');var _0x394be1=_0x53f35e[_0x566b('0x22')];var _0x45ded5=_0x1b02cf?0x0:_0x19d330[_0x566b('0x1f')];var _0x251548=_0x1b02cf?_0x53f35e['count']:_0x19d330[_0x566b('0x1f')]+_0x19d330[_0x566b('0x20')];var _0x4e81e2;if(_0x251548>=_0x394be1){_0x251548=_0x394be1;_0x4e81e2=0xc8;}else{_0x4e81e2=0xce;}_0x48e63d[_0x566b('0x1d')](_0x4e81e2);return _0x48e63d[_0x566b('0x23')](_0x566b('0x24'),_0x45ded5+'-'+_0x251548+'/'+_0x394be1)[_0x566b('0x1e')](_0x53f35e);}return null;};}function patchUpdates(_0x2c150a){return function(_0x2fd7c8){try{jsonpatch[_0x566b('0x25')](_0x2fd7c8,_0x2c150a,!![]);}catch(_0x3a5eb8){return BPromise['reject'](_0x3a5eb8);}return _0x2fd7c8[_0x566b('0x26')]();};}function saveUpdates(_0x2129fe,_0x28f974){return function(_0x3baa1b){if(_0x3baa1b){return _0x3baa1b[_0x566b('0x27')](_0x2129fe)[_0x566b('0x28')](function(_0x634401){return _0x634401;});}return null;};}function removeEntity(_0x40f771,_0x421f5c){return function(_0x128bfa){if(_0x128bfa){return _0x128bfa[_0x566b('0x29')]()[_0x566b('0x28')](function(){_0x40f771[_0x566b('0x1d')](0xcc)[_0x566b('0x2a')]();});}};}function handleEntityNotFound(_0x275305,_0x16a0db){return function(_0x44202a){if(!_0x44202a){_0x275305['sendStatus'](0x194);}return _0x44202a;};}function handleError(_0x5e11da,_0x2763dc){_0x2763dc=_0x2763dc||0x1f4;return function(_0x4ac237){logger[_0x566b('0x2b')](_0x4ac237[_0x566b('0x2c')]);if(_0x4ac237['name']){delete _0x4ac237[_0x566b('0x2d')];}_0x5e11da[_0x566b('0x1d')](_0x2763dc)[_0x566b('0x2e')](_0x4ac237);};}exports[_0x566b('0x2f')]=function(_0x3f8fe6,_0x357a11){var _0x292303={},_0x2e5c87={},_0x18e58a={'count':0x0,'rows':[]};var _0xbf6d44=_[_0x566b('0x30')](db[_0x566b('0x31')][_0x566b('0x32')],function(_0x46a640){return{'name':_0x46a640['fieldName'],'type':_0x46a640[_0x566b('0x33')][_0x566b('0x34')]};});_0x2e5c87[_0x566b('0x35')]=_[_0x566b('0x30')](_0xbf6d44,_0x566b('0x2d'));_0x2e5c87[_0x566b('0x36')]=_[_0x566b('0x37')](_0x3f8fe6[_0x566b('0x36')]);_0x2e5c87[_0x566b('0x38')]=_[_0x566b('0x39')](_0x2e5c87[_0x566b('0x35')],_0x2e5c87[_0x566b('0x36')]);_0x292303[_0x566b('0x3a')]=_[_0x566b('0x39')](_0x2e5c87[_0x566b('0x35')],qs[_0x566b('0x3b')](_0x3f8fe6['query']['fields']));_0x292303[_0x566b('0x3a')]=_0x292303['attributes']['length']?_0x292303['attributes']:_0x2e5c87[_0x566b('0x35')];if(!_0x3f8fe6[_0x566b('0x36')][_0x566b('0x3c')]('nolimit')){_0x292303[_0x566b('0x20')]=qs[_0x566b('0x20')](_0x3f8fe6[_0x566b('0x36')][_0x566b('0x20')]);_0x292303[_0x566b('0x1f')]=qs[_0x566b('0x1f')](_0x3f8fe6['query'][_0x566b('0x1f')]);}_0x292303['order']=qs['sort'](_0x3f8fe6[_0x566b('0x36')][_0x566b('0x3d')]);_0x292303['where']=qs[_0x566b('0x38')](_[_0x566b('0x3e')](_0x3f8fe6['query'],_0x2e5c87[_0x566b('0x38')]),_0xbf6d44);if(_0x3f8fe6['query'][_0x566b('0x3f')]){_0x292303[_0x566b('0x40')]=_[_0x566b('0x41')](_0x292303['where'],{'$or':_['map'](_0xbf6d44,function(_0x141852){if(_0x141852[_0x566b('0x33')]!==_0x566b('0x42')){var _0x398e4c={};_0x398e4c[_0x141852[_0x566b('0x2d')]]={'$like':'%'+_0x3f8fe6[_0x566b('0x36')][_0x566b('0x3f')]+'%'};return _0x398e4c;}})});}_0x292303=_[_0x566b('0x41')]({},_0x292303,_0x3f8fe6['options']);var _0x19de47={'where':_0x292303[_0x566b('0x40')]};return db['UserProfile']['count'](_0x19de47)['then'](function(_0x20522e){_0x18e58a[_0x566b('0x22')]=_0x20522e;if(_0x3f8fe6[_0x566b('0x36')][_0x566b('0x43')]){_0x292303[_0x566b('0x44')]=[{'all':!![]}];}return db[_0x566b('0x31')][_0x566b('0x45')](_0x292303);})[_0x566b('0x28')](function(_0x248fc8){_0x18e58a['rows']=_0x248fc8;return _0x18e58a;})[_0x566b('0x28')](respondWithFilteredResult(_0x357a11,_0x292303))['catch'](handleError(_0x357a11,null));};exports[_0x566b('0x46')]=function(_0x229f96,_0x2af479){var _0x74cadc={'raw':![],'where':{'id':_0x229f96[_0x566b('0x47')]['id']}},_0x633b03={};_0x633b03['model']=_[_0x566b('0x37')](db[_0x566b('0x31')][_0x566b('0x32')]);_0x633b03['query']=_[_0x566b('0x37')](_0x229f96[_0x566b('0x36')]);_0x633b03['filters']=_['intersection'](_0x633b03['model'],_0x633b03[_0x566b('0x36')]);_0x74cadc[_0x566b('0x3a')]=_[_0x566b('0x39')](_0x633b03[_0x566b('0x35')],qs[_0x566b('0x3b')](_0x229f96[_0x566b('0x36')]['fields']));_0x74cadc[_0x566b('0x3a')]=_0x74cadc[_0x566b('0x3a')]['length']?_0x74cadc[_0x566b('0x3a')]:_0x633b03['model'];if(_0x229f96[_0x566b('0x36')]['includeAll']){_0x74cadc[_0x566b('0x44')]=[{'all':!![]}];}_0x74cadc=_[_0x566b('0x41')]({},_0x74cadc,_0x229f96[_0x566b('0x48')]);return db[_0x566b('0x31')][_0x566b('0x49')](_0x74cadc)[_0x566b('0x28')](handleEntityNotFound(_0x2af479,null))[_0x566b('0x28')](respondWithResult(_0x2af479,null))[_0x566b('0x4a')](handleError(_0x2af479,null));};exports[_0x566b('0x4b')]=function(_0x4c0a86,_0x26ca52){return db[_0x566b('0x31')][_0x566b('0x4b')](_0x4c0a86[_0x566b('0x4c')],{})[_0x566b('0x28')](respondWithResult(_0x26ca52,0xc9))[_0x566b('0x4a')](handleError(_0x26ca52,null));};exports['clone']=function(_0x1e7639,_0x3e5113){var _0x85aa76={'where':{'id':_0x1e7639[_0x566b('0x47')]['id']}},_0x3f18d4={};_0x3f18d4[_0x566b('0x35')]=_[_0x566b('0x37')](db[_0x566b('0x31')][_0x566b('0x32')]);_0x85aa76[_0x566b('0x3a')]=_['intersection'](_0x3f18d4['model'],qs['fields'](_0x1e7639[_0x566b('0x36')][_0x566b('0x3b')]));_0x85aa76[_0x566b('0x3a')]=_0x85aa76[_0x566b('0x3a')][_0x566b('0x4d')]?_0x85aa76[_0x566b('0x3a')]:_0x3f18d4['model'];if(_0x1e7639['query'][_0x566b('0x43')]){_0x85aa76[_0x566b('0x44')]=[{'all':!![]}];}_0x85aa76=_['merge']({},_0x85aa76,_0x1e7639[_0x566b('0x48')]);return db[_0x566b('0x31')][_0x566b('0x49')](_0x85aa76)[_0x566b('0x28')](handleEntityNotFound(_0x3e5113,null))[_0x566b('0x28')](function(_0x28faf9){if(_0x28faf9){var _0x15ec0a=_0x28faf9[_0x566b('0x4e')]({'plain':!![]});_0x15ec0a=qs[_0x566b('0x4f')](_0x15ec0a,['id',_0x566b('0x50'),_0x566b('0x51'),_0x566b('0x52')]);_0x1e7639[_0x566b('0x4c')]=_[_0x566b('0x4f')](_0x1e7639[_0x566b('0x4c')],['id','createdAt',_0x566b('0x51')]);return db[_0x566b('0x53')][_0x566b('0x54')](function(_0x3b360e){return db[_0x566b('0x31')][_0x566b('0x4b')](_['merge'](_0x15ec0a,_0x1e7639[_0x566b('0x4c')]),{'include':_0x1e7639['query'][_0x566b('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x3b360e})[_0x566b('0x28')](function(_0x2cf87a){var _0x1c6a97=_0x2cf87a[_0x566b('0x4e')]({'plain':!![]});return db[_0x566b('0x55')]['findAll']({'where':{'userProfileId':_0x1e7639[_0x566b('0x47')]['id']},'raw':!![]})['then'](function(_0x12d870){if(_0x12d870){return BPromise[_0x566b('0x56')](_0x12d870,function(_0xa74558){return new BPromise(function(_0x51a3f2,_0x492567){if(_0xa74558[_0x566b('0x57')]===null||_0xa74558[_0x566b('0x57')]===0x1)_0x51a3f2(null);return db[_0x566b('0x58')]['findAll']({'where':{'sectionId':_0xa74558['id']},'raw':!![]})[_0x566b('0x28')](function(_0x5b876f){var _0x501880=_[_0x566b('0x30')](_0x5b876f,function(_0x282374){return qs['omit'](_0x282374,['id',_0x566b('0x50'),_0x566b('0x51'),_0x566b('0x59')]);});_0x51a3f2(_0x501880);})[_0x566b('0x4a')](function(_0x50f79b){_0x492567(_0x50f79b);});})['then'](function(_0x2c0756){var _0x143dfe=qs[_0x566b('0x4f')](_0xa74558,['id','createdAt',_0x566b('0x51')]);_0x143dfe[_0x566b('0x5a')]=_0x1c6a97['id'];if(_0x2c0756)_0x143dfe[_0x566b('0x5b')]=_0x2c0756;return _0x143dfe;})['then'](function(_0x506cf3){return db[_0x566b('0x55')]['create'](_0x506cf3,{'include':[{'model':db['UserProfileResource'],'as':_0x566b('0x5b')}],'raw':!![],'transaction':_0x3b360e});});})['then'](function(){return _0x1c6a97;});}});});});}})['then'](respondWithResult(_0x3e5113,0xc9))['catch'](handleError(_0x3e5113,null));};exports['update']=function(_0x280cee,_0x5c22be){if(_0x280cee[_0x566b('0x4c')]['id']){delete _0x280cee[_0x566b('0x4c')]['id'];}return db['UserProfile'][_0x566b('0x49')]({'where':{'id':_0x280cee['params']['id']}})[_0x566b('0x28')](handleEntityNotFound(_0x5c22be,null))[_0x566b('0x28')](saveUpdates(_0x280cee[_0x566b('0x4c')],null))[_0x566b('0x28')](respondWithResult(_0x5c22be,null))[_0x566b('0x4a')](handleError(_0x5c22be,null));};exports[_0x566b('0x29')]=function(_0x126509,_0xd0383a){return db[_0x566b('0x31')][_0x566b('0x49')]({'where':{'id':_0x126509['params']['id']}})[_0x566b('0x28')](handleEntityNotFound(_0xd0383a,null))[_0x566b('0x28')](removeEntity(_0xd0383a,null))[_0x566b('0x4a')](handleError(_0xd0383a,null));};exports[_0x566b('0x5c')]=function(_0x1e6782,_0x4be735){return db[_0x566b('0x31')][_0x566b('0x5c')]()[_0x566b('0x28')](respondWithResult(_0x4be735,null))[_0x566b('0x4a')](handleError(_0x4be735,null));};exports[_0x566b('0x5d')]=function(_0x3a0f07,_0x37994a){var _0x53ba22=_0x3a0f07[_0x566b('0x4c')];return db[_0x566b('0x31')][_0x566b('0x49')]({'where':{'id':_0x3a0f07[_0x566b('0x47')]['id']}})[_0x566b('0x28')](handleEntityNotFound(_0x37994a,null))['then'](function(_0x31455c){if(_0x31455c){return db[_0x566b('0x53')][_0x566b('0x54')](function(_0x3746d0){return db[_0x566b('0x55')]['destroy']({'where':{'userProfileId':_0x3a0f07[_0x566b('0x47')]['id'],'sectionId':_[_0x566b('0x30')](_0x53ba22,function(_0x56b95e){return _0x56b95e['sectionId'];})},'transaction':_0x3746d0})['then'](function(){var _0x4ca721=_[_0x566b('0x30')](_0x53ba22,function(_0x2b8144){_0x2b8144['userProfileId']=_0x3a0f07[_0x566b('0x47')]['id'];return _0x2b8144;});var _0x5f3f0a=[];return BPromise[_0x566b('0x56')](_0x4ca721,function(_0x1464f6){return db[_0x566b('0x55')][_0x566b('0x4b')](_0x1464f6,{'include':[{'model':db[_0x566b('0x58')],'as':_0x566b('0x5b')}],'raw':!![],'transaction':_0x3746d0})[_0x566b('0x28')](function(_0x43259f){_0x5f3f0a['push'](_0x43259f[_0x566b('0x4e')]({'plain':!![]}));});})[_0x566b('0x28')](function(){return _0x5f3f0a;});});});}})['then'](function(_0x298f92){return _0x298f92;})[_0x566b('0x28')](respondWithResult(_0x37994a,null))['catch'](handleError(_0x37994a,null));};exports[_0x566b('0x5e')]=function(_0x1f77ff,_0x17f0a5){var _0x34ad33;return db[_0x566b('0x31')]['find']({'where':{'id':_0x1f77ff[_0x566b('0x47')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x17f0a5,null))[_0x566b('0x28')](function(_0x5b3f1e){if(_0x5b3f1e){_0x34ad33=_0x5b3f1e;return db['UserProfileSection'][_0x566b('0x29')]({'where':{'userProfileId':_0x1f77ff[_0x566b('0x47')]['id'],'sectionId':_0x1f77ff[_0x566b('0x36')]['ids']}});}})[_0x566b('0x28')](function(){return _0x34ad33;})[_0x566b('0x28')](respondWithStatusCode(_0x17f0a5,null))[_0x566b('0x4a')](handleError(_0x17f0a5,null));};exports[_0x566b('0x5f')]=function(_0x1132d8,_0x454fc6){var _0x5b3120=[];var _0x496b96=[];return db[_0x566b('0x55')]['findAll']({'where':{'userProfileId':_0x1132d8[_0x566b('0x47')]['id']},'raw':!![]})[_0x566b('0x28')](function(_0x126a12){_0x5b3120=_[_0x566b('0x3f')](_0x126a12,function(_0x1c6bef){return _0x1c6bef['enabled']===0x1||_[_0x566b('0x60')]([0x3eb,0x709],_0x1c6bef[_0x566b('0x59')]);});if(!_['isEmpty'](_0x5b3120)){return _[_0x566b('0x30')](_0x5b3120,function(_0x20519d){return _0x20519d['sectionId'];});}else{return;}})[_0x566b('0x28')](function(_0x5a7304){if(_0x5a7304)_0x496b96=_0x5a7304;if(_['includes'](_0x496b96,0x64)){var _0x3bf7be=_['find'](_0x5b3120,{'sectionId':0x64});return hasDefaultDashboard(_0x3bf7be)[_0x566b('0x28')](function(_0x230ef2){return _['map'](_0x5b3120,function(_0x31b38b){if(_0x31b38b[_0x566b('0x59')]===0x64){_0x31b38b['subsections']=_0x230ef2;}return _0x31b38b;});});}else{return;}})[_0x566b('0x28')](function(_0x266a42){if(_0x266a42)_0x5b3120=_0x266a42;if(_[_0x566b('0x60')](_0x496b96,0x3eb)){var _0x4bc166=_['find'](_0x5b3120,{'sectionId':0x3eb});return getCustomDashboards(_0x4bc166)[_0x566b('0x28')](function(_0x254fe8){return _[_0x566b('0x30')](_0x5b3120,function(_0x44d9be){if(_0x4bc166[_0x566b('0x61')]){if(_0x44d9be[_0x566b('0x59')]===0x3eb){_0x44d9be[_0x566b('0x62')]=_0x254fe8;}}else{if(_0x44d9be[_0x566b('0x59')]===0x64){if(!_0x44d9be[_0x566b('0x62')]){_0x44d9be[_0x566b('0x62')]=[];}_0x44d9be[_0x566b('0x62')]=_0x44d9be[_0x566b('0x62')][_0x566b('0x63')](_0x254fe8);}}return _0x44d9be;});});}else{return;}})['then'](function(_0x43a758){if(_0x43a758)_0x5b3120=_0x43a758;if(_['includes'](_0x496b96,0x709)){var _0x3d3388=_[_0x566b('0x49')](_0x5b3120,{'sectionId':0x709});return getPlugins(_0x3d3388)['then'](function(_0x3a9020){if(_0x3d3388[_0x566b('0x61')]){return _['map'](_0x5b3120,function(_0x1c9781){if(_0x1c9781[_0x566b('0x59')]===0x709){_0x1c9781[_0x566b('0x62')]=_0x3a9020;}return _0x1c9781;});}else{var _0x2d81be={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3a9020};var _0x27136c=_[_0x566b('0x30')](_0x5b3120);_0x27136c[_0x566b('0x64')](_0x2d81be);return _0x27136c;}});}else{return;}})[_0x566b('0x28')](function(_0x1e3b58){if(_0x1e3b58)_0x5b3120=_0x1e3b58;return _[_0x566b('0x3f')](_0x5b3120,['enabled',0x1]);})[_0x566b('0x28')](respondWithResult(_0x454fc6,null))[_0x566b('0x4a')](handleError(_0x454fc6,null));};function hasDefaultDashboard(_0xea3e70){var _0x453b63=[0x65];return new BPromise(function(_0x1e282f,_0x53976d){try{if(_0xea3e70['autoAssociation']){_0x1e282f(_0x453b63);}else{return db[_0x566b('0x58')][_0x566b('0x65')]({'where':{'sectionId':_0xea3e70['id']},'raw':!![]})['then'](function(_0x1184bb){_0x1184bb?_0x1e282f(_0x453b63):_0x1e282f();});}}catch(_0xd5c963){_0x53976d(_0xd5c963);}});}function getCustomDashboards(_0x12e15b){var _0x26422c=[];return new BPromise(function(_0x2e02c2,_0x5dac5f){try{if(_0x12e15b[_0x566b('0x57')]){return db['Dashboard'][_0x566b('0x45')]({'raw':!![]})[_0x566b('0x28')](function(_0x51ebfa){_0x51ebfa[_0x566b('0x66')](function(_0x293a5a){_0x26422c[_0x566b('0x64')](_0x293a5a['id']+0x1869f);});_0x2e02c2(_0x26422c);});}else{return db[_0x566b('0x58')][_0x566b('0x45')]({'where':{'sectionId':_0x12e15b['id']},'raw':!![]})[_0x566b('0x28')](function(_0x506735){_0x506735['forEach'](function(_0x2b3614){_0x26422c[_0x566b('0x64')](_0x2b3614[_0x566b('0x67')]+0x1869f);});_0x2e02c2(_0x26422c);});}}catch(_0x24d990){_0x5dac5f(_0x24d990);}});}function getPlugins(_0x3369b0){var _0x3b49ba=[];return new BPromise(function(_0x2e2a5e,_0x14282b){try{if(_0x3369b0[_0x566b('0x57')]){return db[_0x566b('0x68')][_0x566b('0x45')]({'raw':!![]})[_0x566b('0x28')](function(_0x1e070b){_0x1e070b[_0x566b('0x66')](function(_0x3bb724){_0x3b49ba[_0x566b('0x64')](_0x3bb724['id']+0x15b38);});_0x2e2a5e(_0x3b49ba);});}else{return db[_0x566b('0x58')]['findAll']({'where':{'sectionId':_0x3369b0['id']},'raw':!![]})['then'](function(_0x207d14){_0x207d14[_0x566b('0x66')](function(_0x201184){_0x3b49ba[_0x566b('0x64')](_0x201184[_0x566b('0x67')]+0x15b38);});_0x2e2a5e(_0x3b49ba);});}}catch(_0x42131f){_0x14282b(_0x42131f);}});}exports[_0x566b('0x69')]=function(_0x163bd4,_0x48b089){return db[_0x566b('0x31')][_0x566b('0x49')]({'where':{'id':_0x163bd4[_0x566b('0x47')]['id']}})[_0x566b('0x28')](handleEntityNotFound(_0x48b089,null))[_0x566b('0x28')](function(_0xc19b84){if(_0xc19b84){return db[_0x566b('0x53')][_0x566b('0x54')](function(_0x18a05d){return db[_0x566b('0x55')]['findAll']({'where':{'userProfileId':_0x163bd4[_0x566b('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x1d5367){if(_0x1d5367){return db['UserProfileSection'][_0x566b('0x29')]({'where':{'userProfileId':_0x163bd4[_0x566b('0x47')]['id'],'id':_[_0x566b('0x30')](_0x1d5367,function(_0x3936b7){return _0x3936b7['id'];})},'transaction':_0x18a05d});}})[_0x566b('0x28')](function(_0x43d3a4){var _0x3a38f3=_['map'](_0x163bd4[_0x566b('0x4c')],function(_0x38a4a1){_0x38a4a1[_0x566b('0x5a')]=_0x163bd4[_0x566b('0x47')]['id'];return _0x38a4a1;});return db[_0x566b('0x55')]['bulkCreate'](_0x3a38f3,{'raw':!![],'transaction':_0x18a05d});})['then'](function(_0x298815){var _0x1a5da4=_[_0x566b('0x3f')](_[_0x566b('0x30')](_0x298815,function(_0x1df4a1){return _0x1df4a1[_0x566b('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x1a5da4){return db[_0x566b('0x55')]['findAll']({'where':{'userProfileId':_0x163bd4[_0x566b('0x47')]['id'],'sectionId':_[_0x566b('0x30')](_0x1a5da4,function(_0x1f49b5){return _0x1f49b5[_0x566b('0x59')];})},'attributes':['id',_0x566b('0x59')],'raw':!![]})[_0x566b('0x28')](function(_0x4bbc57){var _0x390a18=_[_0x566b('0x30')](_0x163bd4[_0x566b('0x4c')],function(_0x46d9d2){_0x46d9d2['userProfileId']=_0x163bd4[_0x566b('0x47')]['id'];return _0x46d9d2;});return db[_0x566b('0x58')][_0x566b('0x6a')](_0x390a18,{'raw':!![],'transaction':_0x18a05d});});}})[_0x566b('0x4a')](handleError(_0x48b089,null));});}})['then'](function(_0x16a139){var _0x55230c=_[_0x566b('0x30')](_0x16a139,function(_0x544f24){return _0x544f24[_0x566b('0x4e')]({'plain':!![]});});})[_0x566b('0x28')](respondWithResult(_0x48b089,null))[_0x566b('0x4a')](handleError(_0x48b089,null));};exports[_0x566b('0x6b')]=function(_0x508dd8,_0x175883,_0x25d6aa){return db['UserProfile']['find']({'where':{'id':_0x508dd8[_0x566b('0x47')]['id']}})[_0x566b('0x28')](handleEntityNotFound(_0x175883,null))[_0x566b('0x28')](function(_0x33e950){if(_0x33e950){return _0x33e950[_0x566b('0x6b')](_0x508dd8[_0x566b('0x36')][_0x566b('0x6c')]);}})[_0x566b('0x28')](respondWithStatusCode(_0x175883,null))[_0x566b('0x4a')](handleError(_0x175883,null));};exports[_0x566b('0x6d')]=function(_0x17d194,_0x43f7ab){var _0x2bc2fc={};if(!_0x17d194[_0x566b('0x36')][_0x566b('0x6e')])throw new Error(_0x566b('0x6f'));if(!_0x17d194[_0x566b('0x36')]['hasOwnProperty'](_0x566b('0x70'))){_0x2bc2fc[_0x566b('0x20')]=qs[_0x566b('0x20')](_0x17d194[_0x566b('0x36')][_0x566b('0x20')]);_0x2bc2fc[_0x566b('0x1f')]=qs[_0x566b('0x1f')](_0x17d194[_0x566b('0x36')][_0x566b('0x1f')]);}return db[_0x566b('0x31')][_0x566b('0x49')]({'where':{'id':_0x17d194[_0x566b('0x47')]['id']}})[_0x566b('0x28')](function(_0x5b52ca){if(!_0x5b52ca)throw new Error(_0x566b('0x71')+_0x17d194[_0x566b('0x47')]['id']);return db[_0x566b('0x31')][_0x566b('0x6d')](_0x17d194);})['then'](respondWithFilteredResult(_0x43f7ab,_0x2bc2fc))[_0x566b('0x4a')](handleError(_0x43f7ab,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 009c49a..5f72abe 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 _0x4815=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x4815,0xff));var _0x5481=function(_0x58bd6f,_0x4487bc){_0x58bd6f=_0x58bd6f-0x0;var _0x242bf0=_0x4815[_0x58bd6f];return _0x242bf0;};'use strict';var EventEmitter=require(_0x5481('0x0'));var UserProfile=require(_0x5481('0x1'))['db'][_0x5481('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5481('0x3')](0x0);var events={'afterCreate':_0x5481('0x4'),'afterUpdate':_0x5481('0x5'),'afterDestroy':_0x5481('0x6')};function emitEvent(_0x4797f0){return function(_0x4a7db7,_0x2e5eec,_0x433e2a){UserProfileEvents[_0x5481('0x7')](_0x4797f0+':'+_0x4a7db7['id'],_0x4a7db7);UserProfileEvents[_0x5481('0x7')](_0x4797f0,_0x4a7db7);_0x433e2a(null);};}for(var e in events){if(events[_0x5481('0x8')](e)){var event=events[e];UserProfile[_0x5481('0x9')](e,emitEvent(event));}}module[_0x5481('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x0adf=['UserProfile','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0xff2e95,_0x3b04ab){var _0x62024a=function(_0x4cb5e1){while(--_0x4cb5e1){_0xff2e95['push'](_0xff2e95['shift']());}};_0x62024a(++_0x3b04ab);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x18479b,_0x4351a0){_0x18479b=_0x18479b-0x0;var _0x3b37b0=_0x0adf[_0x18479b];return _0x3b37b0;};'use strict';var EventEmitter=require(_0xf0ad('0x0'));var UserProfile=require(_0xf0ad('0x1'))['db'][_0xf0ad('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0ad('0x3'),'afterUpdate':_0xf0ad('0x4'),'afterDestroy':_0xf0ad('0x5')};function emitEvent(_0x187aa4){return function(_0x27d666,_0x459e70,_0x719547){UserProfileEvents['emit'](_0x187aa4+':'+_0x27d666['id'],_0x27d666);UserProfileEvents[_0xf0ad('0x6')](_0x187aa4,_0x27d666);_0x719547(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf0ad('0x7')](e,emitEvent(event));}}module[_0xf0ad('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a6ca797..55535ad 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 _0x7763=['associatedResources','model','findAll','then','map','catch','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','Telephones','telephone','VoiceQueues','queue','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','VoiceQueue','QueueCampaigns','users','agents','telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','intervals','Interval','pauses','Schedule','sounds','tags','Template','triggers','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','params','all','ignore','union','find','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','sort','merge','VIRTUAL','foreignKey','forEach','isEmpty','autoAssociation','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','ids','customSorting','order','extraQueryConditions','CmContact','Tag','Tags','tag','ThroughTags','rows','openTabs','true','chat','sms','dataValues','openchannel','whatsapp','lodash','../../components/parsers/qs','exports','models','filter','field','value'];(function(_0x35268f,_0x5226e8){var _0x4787e7=function(_0x2bf4e1){while(--_0x2bf4e1){_0x35268f['push'](_0x35268f['shift']());}};_0x4787e7(++_0x5226e8);}(_0x7763,0x16d));var _0x3776=function(_0x164eb1,_0x198a7d){_0x164eb1=_0x164eb1-0x0;var _0x73311=_0x7763[_0x164eb1];return _0x73311;};'use strict';var _=require(_0x3776('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x3776('0x1'));var squel=require('squel');module[_0x3776('0x2')]=function(_0x12533c){var _0x3d3e11=_0x12533c[_0x3776('0x3')];function _0x2816ba(_0x1f6207,_0x275cfb){return new Promise(function(_0x2b9b5b,_0xe16e04){if(!_0x275cfb)return _0x2b9b5b(null);var _0x5c0cab=_0x275cfb[_0x3776('0x4')]?{[_0x275cfb[_0x3776('0x4')][_0x3776('0x5')]]:_0x275cfb[_0x3776('0x4')][_0x3776('0x6')]}:undefined;return _0x3d3e11[_0x1f6207]['findAll']({'where':_0x5c0cab,'raw':!![]})['then'](function(_0x5dcc24){_0x275cfb[_0x3776('0x7')]=_['map'](_0x5dcc24,'id');_0x2b9b5b(_0x275cfb);})['catch'](function(_0x5a42b7){_0xe16e04(_0x5a42b7);});});}function _0x213d1a(_0x1d2615,_0x2cabb){return new Promise(function(_0x372111,_0x5cfc07){var _0x20dd19=_0x1d2615['filter']?{[_0x1d2615[_0x3776('0x4')][_0x3776('0x5')]]:_0x1d2615[_0x3776('0x4')][_0x3776('0x6')]}:undefined;return _0x3d3e11[_0x1d2615[_0x3776('0x8')]][_0x3776('0x9')]({'where':_0x20dd19,'raw':!![]})[_0x3776('0xa')](function(_0x46ae32){_0x2cabb[_0x3776('0x7')]=_[_0x3776('0xb')](_0x46ae32,function(_0x34407e){return _0x34407e['name'];});_0x372111(_0x2cabb);})[_0x3776('0xc')](function(_0x19618f){_0x5cfc07(_0x19618f);});});}function _0x9073b8(_0x3465a6,_0x4d202c,_0x59e9c3){if(!_0x4d202c)return Promise['resolve'](null);return new Promise(function(_0x25e891,_0x151cf2){return _0x3d3e11['UserProfileResource'][_0x3776('0x9')]({'where':{'sectionId':_0x4d202c['id']},'raw':!![]})[_0x3776('0xa')](function(_0x51eef4){if(_0x3465a6['field']&&_0x3465a6['field']!=='id'){_0x4d202c[_0x3776('0x7')]=_['map'](_0x51eef4,function(_0x325253){return _0x325253[_0x3465a6['field']];});}else{if(_0x59e9c3===_0x3776('0xd')){_0x4d202c[_0x3776('0x7')]=_['map'](_0x51eef4,function(_0x102b78){return{'id':_0x102b78[_0x3776('0xe')],'type':_0x102b78[_0x3776('0xf')]};});}else{_0x4d202c[_0x3776('0x7')]=_[_0x3776('0xb')](_0x51eef4,function(_0x329d6d){return _0x329d6d[_0x3776('0xe')];});}}_0x25e891(_0x4d202c);})[_0x3776('0xc')](function(_0x2eb737){_0x151cf2(_0x2eb737);});});}function _0x3bbc3c(_0x3ad43d,_0x35e2e5){var _0x59fce0={'parentSections':[]};switch(_0x3ad43d['toLowerCase']()){case'squareprojects':_0x59fce0[_0x3776('0x10')]=_0x3776('0x11');break;case _0x3776('0x12'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x13');break;case _0x3776('0x14'):_0x59fce0[_0x3776('0x10')]='SquareRecording';_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x16'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x18')}];break;case _0x3776('0x19'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x1a');break;case _0x3776('0x1b'):_0x59fce0[_0x3776('0x10')]='CmContact';_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x1c'),'field':'id','foreignKey':_0x3776('0x1d')}];break;case _0x3776('0x1e'):_0x59fce0['childModel']=_0x3776('0x1f');break;case'companies':_0x59fce0[_0x3776('0x10')]=_0x3776('0x20');break;case _0x3776('0x21'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x22');break;case _0x3776('0x23'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x24');break;case _0x3776('0x25'):_0x59fce0['childModel']=_0x3776('0x26');break;case _0x3776('0x27'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x28');break;case _0x3776('0x29'):_0x59fce0['childModel']=_0x3776('0x2a');break;case _0x3776('0x2b'):case _0x3776('0x2c'):case _0x3776('0x2d'):_0x59fce0[_0x3776('0x10')]='VoiceExtension';break;case _0x3776('0x2e'):_0x59fce0[_0x3776('0x10')]='VoiceContext';break;case _0x3776('0x2f'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x30');break;case _0x3776('0x31'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x32');_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x33'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x34'),'model':_0x3776('0x35'),'filter':{'field':'role','value':['agent']}},{'name':_0x3776('0x36'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x34'),'model':_0x3776('0x35'),'filter':{'field':'role','value':[_0x3776('0x37')]}},{'name':_0x3776('0x38'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x39'),'model':'VoiceQueue','filter':{'field':_0x3776('0xf'),'value':[_0x3776('0x3a')]}},{'name':'QueueCampaigns','field':_0x3776('0x17'),'foreignKey':_0x3776('0x39'),'model':'VoiceQueue','filter':{'field':_0x3776('0xf'),'value':[_0x3776('0x3b')]}}];break;case _0x3776('0x3c'):_0x59fce0[_0x3776('0x10')]='VoiceMusicOnHold';break;case _0x3776('0x3d'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x3e');break;case'voiceprefixes':_0x59fce0[_0x3776('0x10')]=_0x3776('0x3f');break;case'ivrcampaigns':_0x59fce0[_0x3776('0x10')]=_0x3776('0x40');break;case _0x3776('0x41'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x42');break;case _0x3776('0x43'):_0x59fce0['childModel']='MailAccount';break;case'mailsubstatuses':_0x59fce0[_0x3776('0x10')]=_0x3776('0x44');break;case _0x3776('0x45'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x46');break;case _0x3776('0x47'):_0x59fce0['childModel']=_0x3776('0x48');break;case _0x3776('0x49'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x4a');break;case _0x3776('0x4b'):_0x59fce0['childModel']=_0x3776('0x4c');break;case _0x3776('0x4d'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x4e');break;case _0x3776('0x4f'):_0x59fce0['childModel']=_0x3776('0x50');break;case _0x3776('0x51'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x52');break;case'voicequeues':case'queuecampaigns':_0x59fce0[_0x3776('0x10')]=_0x3776('0x53');if(_0x35e2e5){_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x38')},{'name':_0x3776('0x54')}];}break;case _0x3776('0x55'):case _0x3776('0x56'):case _0x3776('0x57'):_0x59fce0['childModel']=_0x3776('0x35');if(_0x35e2e5){_0x59fce0[_0x3776('0x15')]=[{'name':'Users','filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':_0x3776('0x33')},{'name':_0x3776('0x36')}];}break;case _0x3776('0x58'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x59');break;case _0x3776('0x5a'):_0x59fce0['childModel']=_0x3776('0x5b');break;case'freshdeskaccounts':_0x59fce0[_0x3776('0x10')]='FreshdeskAccount';break;case _0x3776('0x5c'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x5d');break;case _0x3776('0x5e'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x5f');break;case'zohoaccounts':_0x59fce0[_0x3776('0x10')]=_0x3776('0x60');break;case'vtigeraccounts':_0x59fce0[_0x3776('0x10')]=_0x3776('0x35');break;case _0x3776('0x61'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x62');break;case _0x3776('0x63'):_0x59fce0[_0x3776('0x10')]='Disposition';break;case'customdashboards':_0x59fce0[_0x3776('0x10')]='Dashboard';break;case _0x3776('0x64'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x65');break;case _0x3776('0x66'):_0x59fce0[_0x3776('0x10')]='Pause';break;case'scheduler':_0x59fce0[_0x3776('0x10')]=_0x3776('0x67');break;case _0x3776('0x68'):_0x59fce0[_0x3776('0x10')]='Sound';break;case _0x3776('0x69'):_0x59fce0[_0x3776('0x10')]='Tag';break;case'templates':_0x59fce0[_0x3776('0x10')]=_0x3776('0x6a');break;case _0x3776('0x6b'):_0x59fce0[_0x3776('0x10')]='Trigger';break;case'trunks':_0x59fce0[_0x3776('0x10')]=_0x3776('0x6c');break;case _0x3776('0x6d'):_0x59fce0['childModel']=_0x3776('0x6e');break;case _0x3776('0x6f'):_0x59fce0['childModel']=_0x3776('0x70');break;case _0x3776('0x71'):_0x59fce0[_0x3776('0x10')]=_0x3776('0xd');_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x72'),'field':'id','foreignKey':_0x3776('0x73')}];break;case'metrics':_0x59fce0[_0x3776('0x10')]=_0x3776('0x74');break;}return _0x59fce0;}function _0x14fce1(_0x33ffe9,_0x5108b6){var _0x59f170=_0x33ffe9[_0x3776('0x75')](0x0)[_0x3776('0x76')]()+_0x33ffe9['slice'](0x1);var _0xa8a5b={'type':_0x3d3e11[_0x3776('0x77')][_0x3776('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0x12ed97,_0x5847cb){var _0x5bf055=squel[_0x3776('0x79')]()[_0x3776('0x5')]('ui.'+_0x59f170+_0x3776('0x7a'),'id')['field'](_0x3776('0x7b'))[_0x3776('0x7c')](_0x3776('0x7d')+_0x33ffe9+_0x3776('0x7e'),'ui')[_0x3776('0x7f')](_0x3776('0x80'),_0x5108b6['id']);return _0x3d3e11['sequelize'][_0x3776('0x81')](_0x5bf055[_0x3776('0x82')](),_0xa8a5b)[_0x3776('0xa')](function(_0x3a39b9){_0x5108b6[_0x59f170+_0x3776('0x83')]=_0x3a39b9;_0x12ed97(_0x3a39b9);})[_0x3776('0xc')](function(_0x540f37){_0x5847cb(_0x540f37);});});}return _0x12533c[_0x3776('0x84')](_0x3776('0x85'),attributes,{'tableName':_0x3776('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x27d459){var _0xc2bbce={'raw':_0x27d459['query'][_0x3776('0x87')],'where':{}};var _0x45f159={};var _0x522ae0={'count':0x0,'rows':[]};var _0x44c4c1=_0x27d459['query'][_0x3776('0x88')];var _0x140e00=_0x27d459['query'][_0x3776('0x89')]||![];var _0x2aa8a6=_0x3bbc3c(_0x44c4c1,_0x140e00);if(!_0x2aa8a6['childModel'])throw new Error(_0x3776('0x8a')+_0x44c4c1+'\x27');var _0x4fa89c=[{'name':_0x44c4c1}];if(!_['isEmpty'](_0x2aa8a6['parentSections']))_0x4fa89c=_0x2aa8a6[_0x3776('0x15')];var _0x181967=[];for(var _0x14c9c6=0x0;_0x14c9c6<_0x4fa89c[_0x3776('0x8b')];_0x14c9c6++){_0x181967[_0x3776('0x8c')](_0x3d3e11[_0x3776('0x8d')]['find']({'where':{'userProfileId':_0x27d459[_0x3776('0x8e')]['id'],'name':_0x4fa89c[_0x14c9c6][_0x3776('0x17')]},'raw':!![]}));}return Promise[_0x3776('0x8f')](_0x181967)[_0x3776('0xa')](function(_0x3a122d){var _0x2897a4=_['filter'](_0x3a122d,function(_0x408c40){return _0x408c40?_0x408c40:undefined;});var _0x1ff8d7=_['filter'](_0x4fa89c,[_0x3776('0x90'),!![]]);var _0x524af5=_['isEmpty'](_0x2897a4)&&_['isEmpty'](_0x1ff8d7)?null:_[_0x3776('0x91')](_0x1ff8d7,_0x2897a4);if(!_0x524af5)return null;var _0x9396b0=[];for(var _0x2fab81=0x0;_0x2fab81<_0x524af5[_0x3776('0x8b')];_0x2fab81++){var _0x5f052d=_[_0x3776('0x92')](_0x4fa89c,function(_0x1e227a){return _0x524af5[_0x2fab81]?_0x1e227a[_0x3776('0x17')]===_0x524af5[_0x2fab81][_0x3776('0x17')]:null;});if(_0x5f052d){if(_0x524af5[_0x2fab81][_0x3776('0x90')]){_0x9396b0['push'](_0x2816ba(_0x2aa8a6['childModel'],_0x524af5[_0x2fab81]));}else{if(!_0x524af5[_0x2fab81]['autoAssociation']){_0x9396b0['push'](_0x9073b8(_0x5f052d,_0x524af5[_0x2fab81],_0x2aa8a6['childModel']));}else{if(_0x5f052d[_0x3776('0x8')]){_0x9396b0[_0x3776('0x8c')](_0x213d1a(_0x5f052d,_0x524af5[_0x2fab81]));}}}}}return Promise[_0x3776('0x8f')](_0x9396b0);})['then'](function(_0x4eb862){var _0x5609b3=_0x4eb862;var _0x228fd0=null;if(_0x5609b3){_0x228fd0=_0x5609b3[_0x3776('0x8b')]===0x1?_0x5609b3[0x0]:null;}if(!_0x228fd0&&!_0x5609b3)return _0x522ae0;var _0x25d398=_0x3d3e11[_0x2aa8a6[_0x3776('0x10')]]['rawAttributes'];_0x45f159[_0x3776('0x8')]=_[_0x3776('0x93')](_0x25d398);_0x45f159[_0x3776('0x81')]=_[_0x3776('0x93')](_0x27d459['query']);_0x45f159[_0x3776('0x94')]=_[_0x3776('0x95')](_0x45f159[_0x3776('0x8')],_0x45f159[_0x3776('0x81')]);_0xc2bbce['attributes']=_[_0x3776('0x95')](_0x45f159['model'],qs['fields'](_0x27d459[_0x3776('0x81')][_0x3776('0x96')]));_0xc2bbce[_0x3776('0x97')]=_0xc2bbce[_0x3776('0x97')][_0x3776('0x8b')]?_0xc2bbce[_0x3776('0x97')]:_0x45f159[_0x3776('0x8')];if(!_0x27d459['query'][_0x3776('0x98')]('nolimit')){_0xc2bbce[_0x3776('0x99')]=qs[_0x3776('0x99')](_0x27d459[_0x3776('0x81')]['limit']);_0xc2bbce[_0x3776('0x9a')]=qs['offset'](_0x27d459['query']['offset']);}_0xc2bbce['order']=qs['sort'](_0x27d459[_0x3776('0x81')][_0x3776('0x9b')]);_0xc2bbce[_0x3776('0x7f')]=qs['filters'](_['pick'](_0x27d459[_0x3776('0x81')],_0x45f159[_0x3776('0x94')]));if(_0x27d459['query'][_0x3776('0x4')]){_0xc2bbce[_0x3776('0x7f')]=_[_0x3776('0x9c')](_0xc2bbce['where'],{'$or':_[_0x3776('0xb')](_0x25d398,function(_0x2fcaf4){if(_0x2fcaf4[_0x3776('0xf')]['key']!==_0x3776('0x9d')){var _0x5b60d8={};_0x5b60d8[_0x2fcaf4[_0x3776('0x5')]]={'$like':'%'+_0x27d459[_0x3776('0x81')][_0x3776('0x4')]+'%'};return _0x5b60d8;}})});}var _0x1aea64=[];var _0x202793=null;var _0x112c53={};if(_0x228fd0){_0x202793=_[_0x3776('0x92')](_0x4fa89c,[_0x3776('0x17'),_0x228fd0[_0x3776('0x17')]]);if(_0x202793[_0x3776('0x5')]){_0x112c53={};if(_0x2aa8a6[_0x3776('0x10')]===_0x3776('0xd')){_0x112c53[_0x202793[_0x3776('0x9e')]]=_['map'](_0x228fd0[_0x3776('0x7')],'id');}else{_0x112c53[_0x202793[_0x3776('0x9e')]]=_0x228fd0['associatedResources'];}_0x1aea64['push'](_0x112c53);}else{_0xc2bbce[_0x3776('0x7f')]['id']=_0x228fd0[_0x3776('0x7')];}}else{for(var _0x4d1563=0x0;_0x4d1563<_0x5609b3['length'];_0x4d1563++){_0x202793=_[_0x3776('0x92')](_0x4fa89c,[_0x3776('0x17'),_0x5609b3[_0x4d1563][_0x3776('0x17')]]);if(_0x202793['field']){_0x112c53={};_0x112c53[_0x202793[_0x3776('0x9e')]]=_0x5609b3[_0x4d1563][_0x3776('0x7')];_0x1aea64['push'](_0x112c53);}else{if(!_0xc2bbce[_0x3776('0x7f')]['id'])_0xc2bbce[_0x3776('0x7f')]['id']=[];_0x5609b3[_0x4d1563][_0x3776('0x7')][_0x3776('0x9f')](function(_0x26d976){_0xc2bbce[_0x3776('0x7f')]['id'][_0x3776('0x8c')](_0x26d976);});}}}if(!_[_0x3776('0xa0')](_0x1aea64)){_0xc2bbce[_0x3776('0x7f')]=_[_0x3776('0x9c')](_0xc2bbce[_0x3776('0x7f')],{'$and':{'$or':_0x1aea64}});}_0xc2bbce=_[_0x3776('0x9c')]({},_0xc2bbce,_0x27d459['options']);if(_0x228fd0&&!_0x228fd0[_0x3776('0xa1')]&&_0x2aa8a6[_0x3776('0x10')]===_0x3776('0xd')){if(_0x27d459[_0x3776('0x81')][_0x3776('0xa2')]){_0xc2bbce[_0x3776('0xa3')]=[{'all':!![]}];}return _0x3d3e11[_0x2aa8a6[_0x3776('0x10')]][_0x3776('0x9')](_0xc2bbce)[_0x3776('0xa')](function(_0xb5ee3a){var _0x566280=[];_0xb5ee3a['forEach'](function(_0x5589f8){var _0x52d116;switch(_0x5589f8[_0x3776('0xa4')]){case'default':_0x52d116=_[_0x3776('0x92')](_0x228fd0[_0x3776('0x7')],function(_0x538e59){return _0x538e59['id']===_0x5589f8[_0x3776('0x73')]&&_0x538e59[_0x3776('0xf')]===_0x3776('0xa5');});break;case _0x3776('0xa6'):_0x52d116=_['find'](_0x228fd0['associatedResources'],function(_0x39b5f1){return _0x39b5f1['id']===_0x5589f8[_0x3776('0x73')]&&_0x39b5f1['type']===_0x3776('0xa7');});break;}if(_0x52d116)_0x566280[_0x3776('0x8c')](_0x5589f8);});_0x522ae0[_0x3776('0xa8')]=_0x566280[_0x3776('0x8b')];_0x522ae0['rows']=_0x566280;return _0x522ae0;});}else{if(!_[_0x3776('0xa0')](_0x27d459[_0x3776('0x81')][_0x3776('0xa9')])){_0xc2bbce[_0x3776('0x7f')]['id']=_0xc2bbce[_0x3776('0x7f')]['id']?_[_0x3776('0x95')](_0xc2bbce['where']['id'],_0x27d459[_0x3776('0x81')][_0x3776('0xa9')]):_0x27d459[_0x3776('0x81')]['ids'];if(_0x27d459['query'][_0x3776('0xaa')]){_0xc2bbce[_0x3776('0xab')]=_0x27d459[_0x3776('0x81')][_0x3776('0xaa')];}}if(_0x27d459['query'][_0x3776('0xac')]){_0xc2bbce['where']=_['merge'](_0xc2bbce[_0x3776('0x7f')],{'$and':_0x27d459[_0x3776('0x81')]['extraQueryConditions']});}return _0x3d3e11[_0x2aa8a6[_0x3776('0x10')]][_0x3776('0xa8')]({'where':_0xc2bbce['where']})[_0x3776('0xa')](function(_0x56a968){_0x522ae0[_0x3776('0xa8')]=_0x56a968;if(_0x27d459['query'][_0x3776('0xa2')]){if(_0x2aa8a6[_0x3776('0x10')]===_0x3776('0xad')){_0xc2bbce[_0x3776('0xa3')]=[{'model':_0x3d3e11[_0x3776('0xae')],'as':_0x3776('0xaf'),'attributes':['id','name','color'],'required':_0x27d459['query'][_0x3776('0xb0')]?!![]:![]},{'model':_0x3d3e11[_0x3776('0xae')],'as':_0x3776('0xb1'),'attributes':['id','name','color'],'through':_0x27d459[_0x3776('0x81')][_0x3776('0xb0')]?{'attributes':[],'where':{'TagId':_0x27d459[_0x3776('0x81')]['tag']||undefined}}:{},'required':_0x27d459['query']['tag']?!![]:![]}];}else{_0xc2bbce[_0x3776('0xa3')]=[{'all':!![]}];}}return _0x3d3e11[_0x2aa8a6[_0x3776('0x10')]]['findAll'](_0xc2bbce);})['then'](function(_0x1e54ed){_0x522ae0[_0x3776('0xb2')]=_0x1e54ed;if(_0x44c4c1===_0x3776('0x33')&&_0x27d459['query'][_0x3776('0xb3')]===_0x3776('0xb4')){var _0x83d583=[];for(var _0x5e5be4=0x0;_0x5e5be4<_0x522ae0[_0x3776('0xb2')][_0x3776('0x8b')];_0x5e5be4++){_0x83d583['push'](_0x14fce1(_0x3776('0xb5'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4]['dataValues']));_0x83d583[_0x3776('0x8c')](_0x14fce1(_0x3776('0xb6'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4][_0x3776('0xb7')]));_0x83d583[_0x3776('0x8c')](_0x14fce1('fax',_0x522ae0[_0x3776('0xb2')][_0x5e5be4][_0x3776('0xb7')]));_0x83d583[_0x3776('0x8c')](_0x14fce1('mail',_0x522ae0[_0x3776('0xb2')][_0x5e5be4]['dataValues']));_0x83d583['push'](_0x14fce1(_0x3776('0xb8'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4][_0x3776('0xb7')]));_0x83d583[_0x3776('0x8c')](_0x14fce1(_0x3776('0xb9'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4]['dataValues']));}return Promise['all'](_0x83d583)[_0x3776('0xa')](function(){return _0x522ae0;});}return _0x522ae0;});}});}}});}; \ No newline at end of file +var _0xdad5=['WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','Sequelize','SELECT','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','foreignKey','merge','options','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','ThroughTags','color','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','name','UserProfileResource','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','ChatQueue','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceRecording','Agents','membername','role','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','type','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue'];(function(_0x255c02,_0xc3acd4){var _0x292112=function(_0x31ce0a){while(--_0x31ce0a){_0x255c02['push'](_0x255c02['shift']());}};_0x292112(++_0xc3acd4);}(_0xdad5,0x76));var _0x5dad=function(_0x55fd68,_0x4489b6){_0x55fd68=_0x55fd68-0x0;var _0x1d58cc=_0xdad5[_0x55fd68];return _0x1d58cc;};'use strict';var _=require(_0x5dad('0x0'));var attributes=require(_0x5dad('0x1'));var qs=require(_0x5dad('0x2'));var squel=require(_0x5dad('0x3'));module[_0x5dad('0x4')]=function(_0x37b718){var _0x930fb3=_0x37b718['models'];function _0x27b929(_0x3bb6eb,_0x42c006){return new Promise(function(_0x51190f,_0x5e92d7){if(!_0x42c006)return _0x51190f(null);var _0x4ce77a=_0x42c006[_0x5dad('0x5')]?{[_0x42c006[_0x5dad('0x5')][_0x5dad('0x6')]]:_0x42c006[_0x5dad('0x5')][_0x5dad('0x7')]}:undefined;return _0x930fb3[_0x3bb6eb][_0x5dad('0x8')]({'where':_0x4ce77a,'raw':!![]})[_0x5dad('0x9')](function(_0x560c03){_0x42c006[_0x5dad('0xa')]=_[_0x5dad('0xb')](_0x560c03,'id');_0x51190f(_0x42c006);})[_0x5dad('0xc')](function(_0x1b965b){_0x5e92d7(_0x1b965b);});});}function _0x100e97(_0x4df3f0,_0x2620f9){return new Promise(function(_0x5d906c,_0x273165){var _0x561656=_0x4df3f0['filter']?{[_0x4df3f0[_0x5dad('0x5')][_0x5dad('0x6')]]:_0x4df3f0[_0x5dad('0x5')][_0x5dad('0x7')]}:undefined;return _0x930fb3[_0x4df3f0[_0x5dad('0xd')]]['findAll']({'where':_0x561656,'raw':!![]})[_0x5dad('0x9')](function(_0x4aaffe){_0x2620f9[_0x5dad('0xa')]=_['map'](_0x4aaffe,function(_0x1973a7){return _0x1973a7[_0x5dad('0xe')];});_0x5d906c(_0x2620f9);})[_0x5dad('0xc')](function(_0x5db99f){_0x273165(_0x5db99f);});});}function _0x3a8eec(_0x3df2d8,_0x1107a4,_0x5be1a1){if(!_0x1107a4)return Promise['resolve'](null);return new Promise(function(_0x1c41c7,_0x596060){return _0x930fb3[_0x5dad('0xf')][_0x5dad('0x8')]({'where':{'sectionId':_0x1107a4['id']},'raw':!![]})['then'](function(_0x31d8f0){if(_0x3df2d8[_0x5dad('0x6')]&&_0x3df2d8[_0x5dad('0x6')]!=='id'){_0x1107a4[_0x5dad('0xa')]=_[_0x5dad('0xb')](_0x31d8f0,function(_0x29012d){return _0x29012d[_0x3df2d8[_0x5dad('0x6')]];});}else{if(_0x5be1a1==='AnalyticExtractedReport'){_0x1107a4['associatedResources']=_['map'](_0x31d8f0,function(_0x390f1f){return{'id':_0x390f1f['resourceId'],'type':_0x390f1f['type']};});}else{_0x1107a4['associatedResources']=_[_0x5dad('0xb')](_0x31d8f0,function(_0x5dd9f4){return _0x5dd9f4[_0x5dad('0x10')];});}}_0x1c41c7(_0x1107a4);})['catch'](function(_0x1fa74f){_0x596060(_0x1fa74f);});});}function _0x48541b(_0x51d0c1,_0x12896a){var _0x20b589={'parentSections':[]};switch(_0x51d0c1[_0x5dad('0x11')]()){case _0x5dad('0x12'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x14');break;case _0x5dad('0x15'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x16');break;case _0x5dad('0x17'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x18');_0x20b589[_0x5dad('0x19')]=[{'name':_0x5dad('0x1a'),'field':_0x5dad('0xe'),'foreignKey':'projectName'}];break;case _0x5dad('0x1b'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x1c');break;case _0x5dad('0x1d'):_0x20b589[_0x5dad('0x13')]='CmContact';_0x20b589[_0x5dad('0x19')]=[{'name':_0x5dad('0x1e'),'field':'id','foreignKey':_0x5dad('0x1f')}];break;case _0x5dad('0x20'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x21');break;case _0x5dad('0x22'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x23');break;case _0x5dad('0x24'):_0x20b589['childModel']='CmCustomField';break;case'chatqueues':_0x20b589[_0x5dad('0x13')]=_0x5dad('0x25');break;case'chatwebsites':_0x20b589[_0x5dad('0x13')]='ChatWebsite';break;case'faxqueues':_0x20b589['childModel']=_0x5dad('0x26');break;case _0x5dad('0x27'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x28');break;case _0x5dad('0x29'):case _0x5dad('0x2a'):case _0x5dad('0x2b'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x2c');break;case'contexts':_0x20b589[_0x5dad('0x13')]=_0x5dad('0x2d');break;case _0x5dad('0x2e'):_0x20b589[_0x5dad('0x13')]='VoiceMail';break;case'voicerecordings':_0x20b589[_0x5dad('0x13')]=_0x5dad('0x2f');_0x20b589[_0x5dad('0x19')]=[{'name':_0x5dad('0x30'),'field':_0x5dad('0xe'),'foreignKey':_0x5dad('0x31'),'model':'User','filter':{'field':_0x5dad('0x32'),'value':['agent']}},{'name':_0x5dad('0x33'),'field':'name','foreignKey':_0x5dad('0x31'),'model':_0x5dad('0x34'),'filter':{'field':_0x5dad('0x32'),'value':[_0x5dad('0x35')]}},{'name':_0x5dad('0x36'),'field':'name','foreignKey':_0x5dad('0x37'),'model':_0x5dad('0x38'),'filter':{'field':'type','value':[_0x5dad('0x39')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':_0x5dad('0x38'),'filter':{'field':_0x5dad('0x3a'),'value':[_0x5dad('0x3b')]}}];break;case'musiconholds':_0x20b589[_0x5dad('0x13')]=_0x5dad('0x3c');break;case _0x5dad('0x3d'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x3e');break;case _0x5dad('0x3f'):_0x20b589['childModel']=_0x5dad('0x40');break;case _0x5dad('0x41'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x42');break;case _0x5dad('0x43'):_0x20b589[_0x5dad('0x13')]='MailQueue';break;case _0x5dad('0x44'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x45');break;case'mailsubstatuses':_0x20b589['childModel']=_0x5dad('0x46');break;case _0x5dad('0x47'):_0x20b589['childModel']=_0x5dad('0x48');break;case _0x5dad('0x49'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x4a');break;case _0x5dad('0x4b'):_0x20b589['childModel']='SmsQueue';break;case'smsaccounts':_0x20b589[_0x5dad('0x13')]=_0x5dad('0x4c');break;case _0x5dad('0x4d'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x4e');break;case'whatsappaccounts':_0x20b589[_0x5dad('0x13')]=_0x5dad('0x4f');break;case _0x5dad('0x50'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x51');break;case _0x5dad('0x52'):case _0x5dad('0x53'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x38');if(_0x12896a){_0x20b589['parentSections']=[{'name':_0x5dad('0x36')},{'name':_0x5dad('0x54')}];}break;case _0x5dad('0x55'):case _0x5dad('0x56'):case _0x5dad('0x57'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x34');if(_0x12896a){_0x20b589[_0x5dad('0x19')]=[{'name':'Users','filter':{'field':'role','value':['admin',_0x5dad('0x58')]},'ignore':!![]},{'name':_0x5dad('0x30')},{'name':'Telephones'}];}break;case _0x5dad('0x59'):_0x20b589[_0x5dad('0x13')]='ZendeskAccount';break;case _0x5dad('0x5a'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x5b');break;case _0x5dad('0x5c'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x5d');break;case _0x5dad('0x5e'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x5f');break;case _0x5dad('0x60'):_0x20b589['childModel']='DeskAccount';break;case'zohoaccounts':_0x20b589[_0x5dad('0x13')]='ZohoAccount';break;case _0x5dad('0x61'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x34');break;case _0x5dad('0x62'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x63');break;case _0x5dad('0x64'):_0x20b589[_0x5dad('0x13')]='Disposition';break;case _0x5dad('0x65'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x66');break;case _0x5dad('0x67'):_0x20b589['childModel']=_0x5dad('0x68');break;case'pauses':_0x20b589[_0x5dad('0x13')]=_0x5dad('0x69');break;case _0x5dad('0x6a'):_0x20b589[_0x5dad('0x13')]='Schedule';break;case'sounds':_0x20b589['childModel']=_0x5dad('0x6b');break;case _0x5dad('0x6c'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x6d');break;case _0x5dad('0x6e'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x6f');break;case _0x5dad('0x70'):_0x20b589['childModel']=_0x5dad('0x71');break;case _0x5dad('0x72'):_0x20b589[_0x5dad('0x13')]='Trunk';break;case _0x5dad('0x73'):_0x20b589['childModel']=_0x5dad('0x74');break;case _0x5dad('0x75'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x76');break;case _0x5dad('0x77'):_0x20b589['childModel']=_0x5dad('0x78');_0x20b589[_0x5dad('0x19')]=[{'name':_0x5dad('0x79'),'field':'id','foreignKey':_0x5dad('0x7a')}];break;case _0x5dad('0x7b'):_0x20b589[_0x5dad('0x13')]=_0x5dad('0x7c');break;}return _0x20b589;}function _0x1ba09c(_0x1136e6,_0x424c94){var _0x567c58=_0x1136e6[_0x5dad('0x7d')](0x0)['toUpperCase']()+_0x1136e6['slice'](0x1);var _0x116696={'type':_0x930fb3[_0x5dad('0x7e')]['QueryTypes'][_0x5dad('0x7f')],'raw':!![]};return new Promise(function(_0x4a93a3,_0x278b67){var _0x5cb735=squel['select']()[_0x5dad('0x6')]('ui.'+_0x567c58+_0x5dad('0x80'),'id')[_0x5dad('0x6')](_0x5dad('0x81'))[_0x5dad('0x82')](_0x5dad('0x83')+_0x1136e6+_0x5dad('0x84'),'ui')[_0x5dad('0x85')](_0x5dad('0x86'),_0x424c94['id']);return _0x930fb3[_0x5dad('0x87')][_0x5dad('0x88')](_0x5cb735[_0x5dad('0x89')](),_0x116696)[_0x5dad('0x9')](function(_0x2c6ea9){_0x424c94[_0x567c58+_0x5dad('0x8a')]=_0x2c6ea9;_0x4a93a3(_0x2c6ea9);})[_0x5dad('0xc')](function(_0x2a2bdd){_0x278b67(_0x2a2bdd);});});}return _0x37b718[_0x5dad('0x8b')](_0x5dad('0x8c'),attributes,{'tableName':_0x5dad('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x631230){var _0x1c706b={'raw':_0x631230['query'][_0x5dad('0x8e')],'where':{}};var _0x50e695={};var _0x2d789e={'count':0x0,'rows':[]};var _0x5855ed=_0x631230[_0x5dad('0x88')]['section'];var _0x54512a=_0x631230[_0x5dad('0x88')][_0x5dad('0x8f')]||![];var _0x2b53bb=_0x48541b(_0x5855ed,_0x54512a);if(!_0x2b53bb[_0x5dad('0x13')])throw new Error(_0x5dad('0x90')+_0x5855ed+'\x27');var _0x402a1f=[{'name':_0x5855ed}];if(!_[_0x5dad('0x91')](_0x2b53bb['parentSections']))_0x402a1f=_0x2b53bb[_0x5dad('0x19')];var _0x27afdc=[];for(var _0x5d5c93=0x0;_0x5d5c93<_0x402a1f[_0x5dad('0x92')];_0x5d5c93++){_0x27afdc[_0x5dad('0x93')](_0x930fb3[_0x5dad('0x94')][_0x5dad('0x95')]({'where':{'userProfileId':_0x631230[_0x5dad('0x96')]['id'],'name':_0x402a1f[_0x5d5c93]['name']},'raw':!![]}));}return Promise[_0x5dad('0x97')](_0x27afdc)[_0x5dad('0x9')](function(_0x2a617c){var _0x451a47=_[_0x5dad('0x5')](_0x2a617c,function(_0x438a91){return _0x438a91?_0x438a91:undefined;});var _0x4c6367=_[_0x5dad('0x5')](_0x402a1f,[_0x5dad('0x98'),!![]]);var _0x266d78=_[_0x5dad('0x91')](_0x451a47)&&_['isEmpty'](_0x4c6367)?null:_[_0x5dad('0x99')](_0x4c6367,_0x451a47);if(!_0x266d78)return null;var _0x111d6d=[];for(var _0xc48710=0x0;_0xc48710<_0x266d78[_0x5dad('0x92')];_0xc48710++){var _0x3543d8=_[_0x5dad('0x95')](_0x402a1f,function(_0xb93c0f){return _0x266d78[_0xc48710]?_0xb93c0f[_0x5dad('0xe')]===_0x266d78[_0xc48710][_0x5dad('0xe')]:null;});if(_0x3543d8){if(_0x266d78[_0xc48710][_0x5dad('0x98')]){_0x111d6d['push'](_0x27b929(_0x2b53bb[_0x5dad('0x13')],_0x266d78[_0xc48710]));}else{if(!_0x266d78[_0xc48710][_0x5dad('0x9a')]){_0x111d6d[_0x5dad('0x93')](_0x3a8eec(_0x3543d8,_0x266d78[_0xc48710],_0x2b53bb['childModel']));}else{if(_0x3543d8[_0x5dad('0xd')]){_0x111d6d[_0x5dad('0x93')](_0x100e97(_0x3543d8,_0x266d78[_0xc48710]));}}}}}return Promise[_0x5dad('0x97')](_0x111d6d);})['then'](function(_0x87e827){var _0x4a0ba1=_0x87e827;var _0x14cb8b=null;if(_0x4a0ba1){_0x14cb8b=_0x4a0ba1[_0x5dad('0x92')]===0x1?_0x4a0ba1[0x0]:null;}if(!_0x14cb8b&&!_0x4a0ba1)return _0x2d789e;var _0x585805=_0x930fb3[_0x2b53bb[_0x5dad('0x13')]][_0x5dad('0x9b')];_0x50e695[_0x5dad('0xd')]=_[_0x5dad('0x9c')](_0x585805);_0x50e695[_0x5dad('0x88')]=_[_0x5dad('0x9c')](_0x631230[_0x5dad('0x88')]);_0x50e695[_0x5dad('0x9d')]=_[_0x5dad('0x9e')](_0x50e695[_0x5dad('0xd')],_0x50e695[_0x5dad('0x88')]);_0x1c706b['attributes']=_[_0x5dad('0x9e')](_0x50e695['model'],qs['fields'](_0x631230[_0x5dad('0x88')][_0x5dad('0x9f')]));_0x1c706b[_0x5dad('0xa0')]=_0x1c706b[_0x5dad('0xa0')][_0x5dad('0x92')]?_0x1c706b[_0x5dad('0xa0')]:_0x50e695[_0x5dad('0xd')];if(!_0x631230['query'][_0x5dad('0xa1')](_0x5dad('0xa2'))){_0x1c706b[_0x5dad('0xa3')]=qs[_0x5dad('0xa3')](_0x631230[_0x5dad('0x88')][_0x5dad('0xa3')]);_0x1c706b[_0x5dad('0xa4')]=qs[_0x5dad('0xa4')](_0x631230['query']['offset']);}_0x1c706b[_0x5dad('0xa5')]=qs[_0x5dad('0xa6')](_0x631230[_0x5dad('0x88')]['sort']);_0x1c706b['where']=qs['filters'](_[_0x5dad('0xa7')](_0x631230[_0x5dad('0x88')],_0x50e695[_0x5dad('0x9d')]));if(_0x631230[_0x5dad('0x88')]['filter']){_0x1c706b[_0x5dad('0x85')]=_['merge'](_0x1c706b[_0x5dad('0x85')],{'$or':_[_0x5dad('0xb')](_0x585805,function(_0xf07ce4){if(_0xf07ce4[_0x5dad('0x3a')]['key']!=='VIRTUAL'){var _0x12439b={};_0x12439b[_0xf07ce4[_0x5dad('0x6')]]={'$like':'%'+_0x631230[_0x5dad('0x88')]['filter']+'%'};return _0x12439b;}})});}var _0x3b5fca=[];var _0x36d48f=null;var _0x2a351c={};if(_0x14cb8b){_0x36d48f=_[_0x5dad('0x95')](_0x402a1f,['name',_0x14cb8b['name']]);if(_0x36d48f[_0x5dad('0x6')]){_0x2a351c={};if(_0x2b53bb['childModel']===_0x5dad('0x78')){_0x2a351c[_0x36d48f['foreignKey']]=_[_0x5dad('0xb')](_0x14cb8b[_0x5dad('0xa')],'id');}else{_0x2a351c[_0x36d48f[_0x5dad('0xa8')]]=_0x14cb8b[_0x5dad('0xa')];}_0x3b5fca[_0x5dad('0x93')](_0x2a351c);}else{_0x1c706b[_0x5dad('0x85')]['id']=_0x14cb8b['associatedResources'];}}else{for(var _0x3e4e38=0x0;_0x3e4e38<_0x4a0ba1[_0x5dad('0x92')];_0x3e4e38++){_0x36d48f=_[_0x5dad('0x95')](_0x402a1f,[_0x5dad('0xe'),_0x4a0ba1[_0x3e4e38][_0x5dad('0xe')]]);if(_0x36d48f[_0x5dad('0x6')]){_0x2a351c={};_0x2a351c[_0x36d48f['foreignKey']]=_0x4a0ba1[_0x3e4e38][_0x5dad('0xa')];_0x3b5fca['push'](_0x2a351c);}else{if(!_0x1c706b[_0x5dad('0x85')]['id'])_0x1c706b[_0x5dad('0x85')]['id']=[];_0x4a0ba1[_0x3e4e38][_0x5dad('0xa')]['forEach'](function(_0x26a528){_0x1c706b['where']['id'][_0x5dad('0x93')](_0x26a528);});}}}if(!_['isEmpty'](_0x3b5fca)){_0x1c706b[_0x5dad('0x85')]=_[_0x5dad('0xa9')](_0x1c706b[_0x5dad('0x85')],{'$and':{'$or':_0x3b5fca}});}_0x1c706b=_['merge']({},_0x1c706b,_0x631230[_0x5dad('0xaa')]);if(_0x14cb8b&&!_0x14cb8b[_0x5dad('0x9a')]&&_0x2b53bb[_0x5dad('0x13')]===_0x5dad('0x78')){if(_0x631230[_0x5dad('0x88')]['includeAll']){_0x1c706b[_0x5dad('0xab')]=[{'all':!![]}];}return _0x930fb3[_0x2b53bb[_0x5dad('0x13')]]['findAll'](_0x1c706b)[_0x5dad('0x9')](function(_0x248103){var _0x184f14=[];_0x248103[_0x5dad('0xac')](function(_0x3eddd2){var _0x50c168;switch(_0x3eddd2[_0x5dad('0xad')]){case _0x5dad('0xae'):_0x50c168=_[_0x5dad('0x95')](_0x14cb8b[_0x5dad('0xa')],function(_0x1213a4){return _0x1213a4['id']===_0x3eddd2[_0x5dad('0x7a')]&&_0x1213a4[_0x5dad('0x3a')]===_0x5dad('0xaf');});break;case _0x5dad('0xb0'):_0x50c168=_[_0x5dad('0x95')](_0x14cb8b[_0x5dad('0xa')],function(_0x50da2b){return _0x50da2b['id']===_0x3eddd2['reportId']&&_0x50da2b[_0x5dad('0x3a')]===_0x5dad('0xb1');});break;}if(_0x50c168)_0x184f14[_0x5dad('0x93')](_0x3eddd2);});_0x2d789e[_0x5dad('0xb2')]=_0x184f14[_0x5dad('0x92')];_0x2d789e[_0x5dad('0xb3')]=_0x184f14;return _0x2d789e;});}else{if(!_[_0x5dad('0x91')](_0x631230[_0x5dad('0x88')][_0x5dad('0xb4')])){_0x1c706b['where']['id']=_0x1c706b[_0x5dad('0x85')]['id']?_['intersection'](_0x1c706b[_0x5dad('0x85')]['id'],_0x631230[_0x5dad('0x88')][_0x5dad('0xb4')]):_0x631230[_0x5dad('0x88')][_0x5dad('0xb4')];if(_0x631230[_0x5dad('0x88')]['customSorting']){_0x1c706b[_0x5dad('0xa5')]=_0x631230[_0x5dad('0x88')][_0x5dad('0xb5')];}}if(_0x631230['query']['extraQueryConditions']){_0x1c706b['where']=_[_0x5dad('0xa9')](_0x1c706b['where'],{'$and':_0x631230[_0x5dad('0x88')][_0x5dad('0xb6')]});}return _0x930fb3[_0x2b53bb[_0x5dad('0x13')]][_0x5dad('0xb2')]({'where':_0x1c706b[_0x5dad('0x85')]})[_0x5dad('0x9')](function(_0x22e88e){_0x2d789e['count']=_0x22e88e;if(_0x631230[_0x5dad('0x88')][_0x5dad('0xb7')]){if(_0x2b53bb[_0x5dad('0x13')]===_0x5dad('0xb8')){_0x1c706b[_0x5dad('0xab')]=[{'model':_0x930fb3[_0x5dad('0x6d')],'as':'Tags','attributes':['id','name','color'],'required':_0x631230[_0x5dad('0x88')]['tag']?!![]:![]},{'model':_0x930fb3['Tag'],'as':_0x5dad('0xb9'),'attributes':['id','name',_0x5dad('0xba')],'through':_0x631230[_0x5dad('0x88')][_0x5dad('0xbb')]?{'attributes':[],'where':{'TagId':_0x631230[_0x5dad('0x88')][_0x5dad('0xbb')]||undefined}}:{},'required':_0x631230[_0x5dad('0x88')][_0x5dad('0xbb')]?!![]:![]}];}else{_0x1c706b[_0x5dad('0xab')]=[{'all':!![]}];}}return _0x930fb3[_0x2b53bb[_0x5dad('0x13')]][_0x5dad('0x8')](_0x1c706b);})[_0x5dad('0x9')](function(_0xfc91c0){_0x2d789e[_0x5dad('0xb3')]=_0xfc91c0;if(_0x5855ed===_0x5dad('0x30')&&_0x631230[_0x5dad('0x88')][_0x5dad('0xbc')]===_0x5dad('0xbd')){var _0xce480c=[];for(var _0x273039=0x0;_0x273039<_0x2d789e[_0x5dad('0xb3')][_0x5dad('0x92')];_0x273039++){_0xce480c[_0x5dad('0x93')](_0x1ba09c(_0x5dad('0xbe'),_0x2d789e['rows'][_0x273039][_0x5dad('0xbf')]));_0xce480c[_0x5dad('0x93')](_0x1ba09c(_0x5dad('0xc0'),_0x2d789e[_0x5dad('0xb3')][_0x273039][_0x5dad('0xbf')]));_0xce480c[_0x5dad('0x93')](_0x1ba09c(_0x5dad('0xc1'),_0x2d789e[_0x5dad('0xb3')][_0x273039][_0x5dad('0xbf')]));_0xce480c[_0x5dad('0x93')](_0x1ba09c(_0x5dad('0xc2'),_0x2d789e[_0x5dad('0xb3')][_0x273039][_0x5dad('0xbf')]));_0xce480c[_0x5dad('0x93')](_0x1ba09c(_0x5dad('0xc3'),_0x2d789e[_0x5dad('0xb3')][_0x273039][_0x5dad('0xbf')]));_0xce480c[_0x5dad('0x93')](_0x1ba09c(_0x5dad('0xc4'),_0x2d789e['rows'][_0x273039][_0x5dad('0xbf')]));}return Promise[_0x5dad('0x97')](_0xce480c)[_0x5dad('0x9')](function(){return _0x2d789e;});}return _0x2d789e;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 04bd5f8..02019a7 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 _0xbd0a=['http','redis','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1685a0,_0x325d05){var _0x30848b=function(_0xe67f50){while(--_0xe67f50){_0x1685a0['push'](_0x1685a0['shift']());}};_0x30848b(++_0x325d05);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x4c2c3b,_0x4a569a){_0x4c2c3b=_0x4c2c3b-0x0;var _0x46775f=_0xbd0a[_0x4c2c3b];return _0x46775f;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var moment=require(_0xabd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabd0('0x2'))['db'];var utils=require(_0xabd0('0x3'));var logger=require(_0xabd0('0x4'))(_0xabd0('0x5'));var config=require(_0xabd0('0x6'));var jayson=require(_0xabd0('0x7'));var client=jayson[_0xabd0('0x8')][_0xabd0('0x9')]({'port':0x232a});config[_0xabd0('0xa')]=_['defaults'](config[_0xabd0('0xa')],{'host':_0xabd0('0xb'),'port':0x18eb});var socket=require(_0xabd0('0xc'))(new Redis(config['redis']));require(_0xabd0('0xd'))['register'](socket);function respondWithRpcPromise(_0x151048,_0x23d4e4,_0x2c31c9){return new BPromise(function(_0x3dc0ab,_0x50fc2d){return client[_0xabd0('0xe')](_0x151048,_0x2c31c9)['then'](function(_0x1b78e2){logger[_0xabd0('0xf')](_0xabd0('0x10'),_0x23d4e4,_0xabd0('0x11'));logger[_0xabd0('0x12')](_0xabd0('0x13'),_0x23d4e4,'request\x20sent',JSON[_0xabd0('0x14')](_0x1b78e2));if(_0x1b78e2['error']){if(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x16')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0x1b78e2['error']['message']);return _0x50fc2d(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);return _0x3dc0ab(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}else{logger[_0xabd0('0xf')]('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0xabd0('0x11'));_0x3dc0ab(_0x1b78e2['result']['message']);}})[_0xabd0('0x18')](function(_0x391988){logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x391988);_0x50fc2d(_0x391988);});});} \ No newline at end of file +var _0xfa25=['../../config/logger','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11ae7f,_0x31cd0e){var _0x5c6007=function(_0x6e163f){while(--_0x6e163f){_0x11ae7f['push'](_0x11ae7f['shift']());}};_0x5c6007(++_0x31cd0e);}(_0xfa25,0xd1));var _0x5fa2=function(_0x16bd7f,_0x4929fb){_0x16bd7f=_0x16bd7f-0x0;var _0x5f34cf=_0xfa25[_0x16bd7f];return _0x5f34cf;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var moment=require(_0x5fa2('0x1'));var BPromise=require(_0x5fa2('0x2'));var rs=require(_0x5fa2('0x3'));var fs=require('fs');var Redis=require(_0x5fa2('0x4'));var db=require(_0x5fa2('0x5'))['db'];var utils=require(_0x5fa2('0x6'));var logger=require(_0x5fa2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fa2('0x8'));var client=jayson[_0x5fa2('0x9')]['http']({'port':0x232a});config['redis']=_[_0x5fa2('0xa')](config['redis'],{'host':_0x5fa2('0xb'),'port':0x18eb});var socket=require(_0x5fa2('0xc'))(new Redis(config[_0x5fa2('0xd')]));require('./userProfile.socket')[_0x5fa2('0xe')](socket);function respondWithRpcPromise(_0x3a2222,_0x174b84,_0x53a368){return new BPromise(function(_0x474efa,_0x4ab368){return client['request'](_0x3a2222,_0x53a368)[_0x5fa2('0xf')](function(_0x3a1df9){logger['info'](_0x5fa2('0x10'),_0x174b84,_0x5fa2('0x11'));logger[_0x5fa2('0x12')](_0x5fa2('0x13'),_0x174b84,_0x5fa2('0x11'),JSON[_0x5fa2('0x14')](_0x3a1df9));if(_0x3a1df9[_0x5fa2('0x15')]){if(_0x3a1df9[_0x5fa2('0x15')][_0x5fa2('0x16')]===0x1f4){logger[_0x5fa2('0x15')](_0x5fa2('0x10'),_0x174b84,_0x3a1df9[_0x5fa2('0x15')][_0x5fa2('0x17')]);return _0x4ab368(_0x3a1df9[_0x5fa2('0x15')]['message']);}logger[_0x5fa2('0x15')](_0x5fa2('0x10'),_0x174b84,_0x3a1df9[_0x5fa2('0x15')]['message']);return _0x474efa(_0x3a1df9['error'][_0x5fa2('0x17')]);}else{logger[_0x5fa2('0x18')](_0x5fa2('0x10'),_0x174b84,'request\x20sent');_0x474efa(_0x3a1df9[_0x5fa2('0x19')]['message']);}})[_0x5fa2('0x1a')](function(_0x4e0243){logger[_0x5fa2('0x15')](_0x5fa2('0x10'),_0x174b84,_0x4e0243);_0x4ab368(_0x4e0243);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 22d0912..844c1d6 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 _0xd233=['save','remove','update','register','userProfile:','./userProfile.events'];(function(_0x329849,_0x1bcd70){var _0x3ef89c=function(_0x401aca){while(--_0x401aca){_0x329849['push'](_0x329849['shift']());}};_0x3ef89c(++_0x1bcd70);}(_0xd233,0x12b));var _0x3d23=function(_0x546ce7,_0x135234){_0x546ce7=_0x546ce7-0x0;var _0x1e1530=_0xd233[_0x546ce7];return _0x1e1530;};'use strict';var UserProfileEvents=require(_0x3d23('0x0'));var events=[_0x3d23('0x1'),_0x3d23('0x2'),_0x3d23('0x3')];function createListener(_0xaae9ab,_0x4f8af5){return function(_0x4c1e3f){_0x4f8af5['emit'](_0xaae9ab,_0x4c1e3f);};}function removeListener(_0x48aa88,_0x514a95){return function(){UserProfileEvents['removeListener'](_0x48aa88,_0x514a95);};}exports[_0x3d23('0x4')]=function(_0x32a463){for(var _0x2915d0=0x0,_0x1f1b38=events['length'];_0x2915d0<_0x1f1b38;_0x2915d0++){var _0x3b8adb=events[_0x2915d0];var _0x3c1a1e=createListener(_0x3d23('0x5')+_0x3b8adb,_0x32a463);UserProfileEvents['on'](_0x3b8adb,_0x3c1a1e);}}; \ No newline at end of file +var _0xf29c=['update','removeListener','length','save','remove'];(function(_0x9f64ac,_0x18406d){var _0x1d047d=function(_0x52fd01){while(--_0x52fd01){_0x9f64ac['push'](_0x9f64ac['shift']());}};_0x1d047d(++_0x18406d);}(_0xf29c,0xc1));var _0xcf29=function(_0xd6a02d,_0x5f51ce){_0xd6a02d=_0xd6a02d-0x0;var _0x5596df=_0xf29c[_0xd6a02d];return _0x5596df;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xcf29('0x0'),_0xcf29('0x1'),_0xcf29('0x2')];function createListener(_0x55d011,_0x4bb973){return function(_0x39900a){_0x4bb973['emit'](_0x55d011,_0x39900a);};}function removeListener(_0xb3af69,_0x1f87db){return function(){UserProfileEvents[_0xcf29('0x3')](_0xb3af69,_0x1f87db);};}exports['register']=function(_0x420147){for(var _0x3b4564=0x0,_0x3ce9f8=events[_0xcf29('0x4')];_0x3b4564<_0x3ce9f8;_0x3b4564++){var _0x334f08=events[_0x3b4564];var _0x2b9e13=createListener('userProfile:'+_0x334f08,_0x420147);UserProfileEvents['on'](_0x334f08,_0x2b9e13);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d11ca95..702d624 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 _0x47d4=['post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3f5686,_0x271efb){var _0x293adf=function(_0x2e2282){while(--_0x2e2282){_0x3f5686['push'](_0x3f5686['shift']());}};_0x293adf(++_0x271efb);}(_0x47d4,0x1a7));var _0x447d=function(_0x207d3a,_0x5bb75e){_0x207d3a=_0x207d3a-0x0;var _0x31e506=_0x47d4[_0x207d3a];return _0x31e506;};'use strict';var multer=require(_0x447d('0x0'));var util=require(_0x447d('0x1'));var path=require('path');var timeout=require(_0x447d('0x2'));var express=require(_0x447d('0x3'));var router=express[_0x447d('0x4')]();var fs_extra=require(_0x447d('0x5'));var auth=require(_0x447d('0x6'));var interaction=require(_0x447d('0x7'));var config=require(_0x447d('0x8'));var controller=require(_0x447d('0x9'));router[_0x447d('0xa')]('/',auth[_0x447d('0xb')](),controller[_0x447d('0xc')]);router[_0x447d('0xa')](_0x447d('0xd'),auth['isAuthenticated'](),controller[_0x447d('0xe')]);router['get'](_0x447d('0xf'),auth[_0x447d('0xb')](),controller[_0x447d('0x10')]);router[_0x447d('0x11')]('/',auth[_0x447d('0xb')](),controller[_0x447d('0x12')]);router[_0x447d('0x13')]('/:id',auth[_0x447d('0xb')](),controller['update']);router[_0x447d('0x14')]('/:id',auth[_0x447d('0xb')](),controller['destroy']);module[_0x447d('0x15')]=router; \ No newline at end of file +var _0x3482=['delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x16dd96,_0x568018){var _0x53fbb1=function(_0x385c38){while(--_0x385c38){_0x16dd96['push'](_0x16dd96['shift']());}};_0x53fbb1(++_0x568018);}(_0x3482,0x1bc));var _0x2348=function(_0x4706c6,_0x23d052){_0x4706c6=_0x4706c6-0x0;var _0x2d7a25=_0x3482[_0x4706c6];return _0x2d7a25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2348('0x0'));var timeout=require(_0x2348('0x1'));var express=require('express');var router=express[_0x2348('0x2')]();var fs_extra=require(_0x2348('0x3'));var auth=require(_0x2348('0x4'));var interaction=require(_0x2348('0x5'));var config=require(_0x2348('0x6'));var controller=require(_0x2348('0x7'));router[_0x2348('0x8')]('/',auth[_0x2348('0x9')](),controller[_0x2348('0xa')]);router[_0x2348('0x8')](_0x2348('0xb'),auth[_0x2348('0x9')](),controller[_0x2348('0xc')]);router[_0x2348('0x8')](_0x2348('0xd'),auth[_0x2348('0x9')](),controller[_0x2348('0xe')]);router[_0x2348('0xf')]('/',auth[_0x2348('0x9')](),controller[_0x2348('0x10')]);router[_0x2348('0x11')]('/:id',auth[_0x2348('0x9')](),controller['update']);router[_0x2348('0x12')](_0x2348('0xd'),auth[_0x2348('0x9')](),controller[_0x2348('0x13')]);module[_0x2348('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index dae89b3..26536d7 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 _0x3915=['INTEGER','sequelize','STRING'];(function(_0x1738ce,_0x46fd56){var _0x2eade4=function(_0x1e07b6){while(--_0x1e07b6){_0x1738ce['push'](_0x1738ce['shift']());}};_0x2eade4(++_0x46fd56);}(_0x3915,0xca));var _0x5391=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x3915[_0x38aeea];return _0x5e8d2c;};'use strict';var Sequelize=require(_0x5391('0x0'));module['exports']={'name':{'type':Sequelize[_0x5391('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5391('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x180b=['sequelize','exports','INTEGER','STRING'];(function(_0x1f54d9,_0x5b9ca4){var _0x524c38=function(_0x3b6c09){while(--_0x3b6c09){_0x1f54d9['push'](_0x1f54d9['shift']());}};_0x524c38(++_0x5b9ca4);}(_0x180b,0xe0));var _0xb180=function(_0x2924aa,_0x171f34){_0x2924aa=_0x2924aa-0x0;var _0x124cc3=_0x180b[_0x2924aa];return _0x124cc3;};'use strict';var Sequelize=require(_0xb180('0x0'));module[_0xb180('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb180('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb180('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9778ce5..af2d39b 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 _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x245690,_0x3bf938){var _0x3fb9a4=function(_0x3354b3){while(--_0x3354b3){_0x245690['push'](_0x245690['shift']());}};_0x3fb9a4(++_0x3bf938);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['UserProfileResource'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file +var _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end','error','name','send','index','map','UserProfileResource','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x3b94fb,_0x1156f5){var _0x55b0e2=function(_0x2aeb66){while(--_0x2aeb66){_0x3b94fb['push'](_0x3b94fb['shift']());}};_0x55b0e2(++_0x1156f5);}(_0xb016,0x159));var _0x6b01=function(_0x4783ef,_0x2d23ba){_0x4783ef=_0x4783ef-0x0;var _0x7da015=_0xb016[_0x4783ef];return _0x7da015;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['UserProfileResource'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 47773e0..9c84bf3 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 _0x8704=['../../config/logger','api','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x2371ef,_0x4db24f){var _0x324f13=function(_0x294752){while(--_0x294752){_0x2371ef['push'](_0x2371ef['shift']());}};_0x324f13(++_0x4db24f);}(_0x8704,0x148));var _0x4870=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x8704[_0x166e96];return _0x553d73;};'use strict';var _=require(_0x4870('0x0'));var util=require(_0x4870('0x1'));var logger=require(_0x4870('0x2'))(_0x4870('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4870('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4870('0x5'));var config=require(_0x4870('0x6'));var attributes=require(_0x4870('0x7'));module[_0x4870('0x8')]=function(_0x72466,_0x2d19bb){return _0x72466[_0x4870('0x9')](_0x4870('0xa'),attributes,{'tableName':_0x4870('0xb'),'paranoid':![],'indexes':[{'name':_0x4870('0xc'),'fields':[_0x4870('0xd'),_0x4870('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x296f=['moment','bluebird','request-promise','path','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger'];(function(_0x24589d,_0x366fba){var _0x2430c9=function(_0x5e416b){while(--_0x5e416b){_0x24589d['push'](_0x24589d['shift']());}};_0x2430c9(++_0x366fba);}(_0x296f,0xc3));var _0xf296=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x296f[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var logger=require(_0xf296('0x2'))('api');var moment=require(_0xf296('0x3'));var BPromise=require(_0xf296('0x4'));var rp=require(_0xf296('0x5'));var fs=require('fs');var path=require(_0xf296('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x11dd25,_0x5ab30b){return _0x11dd25['define'](_0xf296('0x7'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xf296('0x8'),'fields':[_0xf296('0x9'),_0xf296('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b0f4aea..492fce0 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 _0xe287=['../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2a99ee,_0x2adb3d){var _0x4d2ae3=function(_0x5d5c10){while(--_0x5d5c10){_0x2a99ee['push'](_0x2a99ee['shift']());}};_0x4d2ae3(++_0x2adb3d);}(_0xe287,0x82));var _0x7e28=function(_0x1fd5e2,_0xb053fd){_0x1fd5e2=_0x1fd5e2-0x0;var _0x19c5e3=_0xe287[_0x1fd5e2];return _0x19c5e3;};'use strict';var _=require(_0x7e28('0x0'));var util=require(_0x7e28('0x1'));var moment=require(_0x7e28('0x2'));var BPromise=require(_0x7e28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e28('0x4'));var db=require(_0x7e28('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e28('0x6'))(_0x7e28('0x7'));var config=require(_0x7e28('0x8'));var jayson=require(_0x7e28('0x9'));var client=jayson[_0x7e28('0xa')][_0x7e28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ff5,_0x3c8e10,_0x3f1e2a){return new BPromise(function(_0xbe5a25,_0xa139b){return client['request'](_0x4a6ff5,_0x3f1e2a)[_0x7e28('0xc')](function(_0x106b98){logger[_0x7e28('0xd')](_0x7e28('0xe'),_0x3c8e10,_0x7e28('0xf'));logger[_0x7e28('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3c8e10,_0x7e28('0xf'),JSON[_0x7e28('0x11')](_0x106b98));if(_0x106b98[_0x7e28('0x12')]){if(_0x106b98['error'][_0x7e28('0x13')]===0x1f4){logger['error'](_0x7e28('0xe'),_0x3c8e10,_0x106b98[_0x7e28('0x12')][_0x7e28('0x14')]);return _0xa139b(_0x106b98[_0x7e28('0x12')]['message']);}logger[_0x7e28('0x12')](_0x7e28('0xe'),_0x3c8e10,_0x106b98['error'][_0x7e28('0x14')]);return _0xbe5a25(_0x106b98[_0x7e28('0x12')][_0x7e28('0x14')]);}else{logger['info'](_0x7e28('0xe'),_0x3c8e10,_0x7e28('0xf'));_0xbe5a25(_0x106b98[_0x7e28('0x15')]['message']);}})[_0x7e28('0x16')](function(_0x2afb73){logger[_0x7e28('0x12')](_0x7e28('0xe'),_0x3c8e10,_0x2afb73);_0xa139b(_0x2afb73);});});} \ No newline at end of file +var _0xca4a=['../../config/utils','../../config/environment','client','request','then','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','randomstring','ioredis','../../mysqldb'];(function(_0x2dac0a,_0x44cdca){var _0x49fb95=function(_0x5a8011){while(--_0x5a8011){_0x2dac0a['push'](_0x2dac0a['shift']());}};_0x49fb95(++_0x44cdca);}(_0xca4a,0xaa));var _0xaca4=function(_0x22c2eb,_0xb921e9){_0x22c2eb=_0x22c2eb-0x0;var _0x3b633b=_0xca4a[_0x22c2eb];return _0x3b633b;};'use strict';var _=require(_0xaca4('0x0'));var util=require(_0xaca4('0x1'));var moment=require(_0xaca4('0x2'));var BPromise=require('bluebird');var rs=require(_0xaca4('0x3'));var fs=require('fs');var Redis=require(_0xaca4('0x4'));var db=require(_0xaca4('0x5'))['db'];var utils=require(_0xaca4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xaca4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaca4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x563af7,_0x14cd75,_0x5a804f){return new BPromise(function(_0x1c328c,_0x191e9d){return client[_0xaca4('0x9')](_0x563af7,_0x5a804f)[_0xaca4('0xa')](function(_0x18f39d){logger[_0xaca4('0xb')](_0xaca4('0xc'),_0x14cd75,_0xaca4('0xd'));logger[_0xaca4('0xe')](_0xaca4('0xf'),_0x14cd75,_0xaca4('0xd'),JSON[_0xaca4('0x10')](_0x18f39d));if(_0x18f39d[_0xaca4('0x11')]){if(_0x18f39d[_0xaca4('0x11')][_0xaca4('0x12')]===0x1f4){logger[_0xaca4('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x14cd75,_0x18f39d[_0xaca4('0x11')]['message']);return _0x191e9d(_0x18f39d['error'][_0xaca4('0x13')]);}logger[_0xaca4('0x11')](_0xaca4('0xc'),_0x14cd75,_0x18f39d['error'][_0xaca4('0x13')]);return _0x1c328c(_0x18f39d['error'][_0xaca4('0x13')]);}else{logger[_0xaca4('0xb')](_0xaca4('0xc'),_0x14cd75,_0xaca4('0xd'));_0x1c328c(_0x18f39d[_0xaca4('0x14')][_0xaca4('0x13')]);}})[_0xaca4('0x15')](function(_0x320abe){logger[_0xaca4('0x11')](_0xaca4('0xc'),_0x14cd75,_0x320abe);_0x191e9d(_0x320abe);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0feef00..2388eb2 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 _0x76c3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','post','create','/:id','delete','destroy','multer','express'];(function(_0x23cc62,_0x23d374){var _0xf0521a=function(_0x458e4c){while(--_0x458e4c){_0x23cc62['push'](_0x23cc62['shift']());}};_0xf0521a(++_0x23d374);}(_0x76c3,0x64));var _0x376c=function(_0x35ec7a,_0x3c1115){_0x35ec7a=_0x35ec7a-0x0;var _0x4ba727=_0x76c3[_0x35ec7a];return _0x4ba727;};'use strict';var multer=require(_0x376c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x376c('0x1'));var router=express[_0x376c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x376c('0x3'));var interaction=require(_0x376c('0x4'));var config=require(_0x376c('0x5'));var controller=require(_0x376c('0x6'));router['get']('/',auth[_0x376c('0x7')](),controller[_0x376c('0x8')]);router[_0x376c('0x9')](_0x376c('0xa'),auth[_0x376c('0x7')](),controller[_0x376c('0xb')]);router['get']('/:id',auth[_0x376c('0x7')](),controller['show']);router[_0x376c('0xc')]('/',auth[_0x376c('0x7')](),controller[_0x376c('0xd')]);router['put'](_0x376c('0xe'),auth[_0x376c('0x7')](),controller['update']);router[_0x376c('0xf')](_0x376c('0xe'),auth[_0x376c('0x7')](),controller[_0x376c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x64d8=['post','create','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x64d8,0x1e0));var _0x864d=function(_0x48b2cb,_0x5da5e7){_0x48b2cb=_0x48b2cb-0x0;var _0x3ad90f=_0x64d8[_0x48b2cb];return _0x3ad90f;};'use strict';var multer=require(_0x864d('0x0'));var util=require(_0x864d('0x1'));var path=require(_0x864d('0x2'));var timeout=require('connect-timeout');var express=require(_0x864d('0x3'));var router=express['Router']();var fs_extra=require(_0x864d('0x4'));var auth=require(_0x864d('0x5'));var interaction=require(_0x864d('0x6'));var config=require(_0x864d('0x7'));var controller=require(_0x864d('0x8'));router[_0x864d('0x9')]('/',auth['isAuthenticated'](),controller[_0x864d('0xa')]);router['get'](_0x864d('0xb'),auth[_0x864d('0xc')](),controller['describe']);router[_0x864d('0x9')](_0x864d('0xd'),auth[_0x864d('0xc')](),controller['show']);router[_0x864d('0xe')]('/',auth[_0x864d('0xc')](),controller[_0x864d('0xf')]);router['put'](_0x864d('0xd'),auth['isAuthenticated'](),controller[_0x864d('0x10')]);router['delete']('/:id',auth[_0x864d('0xc')](),controller[_0x864d('0x11')]);module[_0x864d('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a3d7255..8be4b7e 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 _0xeb3b=['sequelize','exports','STRING','INTEGER','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x373d0e,_0x44ad60){var _0x34cb0f=function(_0x48f412){while(--_0x48f412){_0x373d0e['push'](_0x373d0e['shift']());}};_0x34cb0f(++_0x44ad60);}(_0xeb3b,0x19e));var _0xbeb3=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xeb3b[_0xd307d9];return _0x209bf8;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbeb3('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbeb3('0x2')],'set':function(_0x5b0e3b){this[_0xbeb3('0x4')]('crudPermissions',_0x5b0e3b?_0x5b0e3b[_0xbeb3('0x5')](''):[]);},'get':function(){return this[_0xbeb3('0x6')](_0xbeb3('0x7'))?this[_0xbeb3('0x6')](_0xbeb3('0x7'))[_0xbeb3('0x8')](''):[];}}}; \ No newline at end of file +var _0xa30a=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa30('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa30('0x2')],'set':function(_0x2a9b06){this[_0xaa30('0x5')](_0xaa30('0x6'),_0x2a9b06?_0x2a9b06['join'](''):[]);},'get':function(){return this[_0xaa30('0x7')]('crudPermissions')?this[_0xaa30('0x7')](_0xaa30('0x6'))[_0xaa30('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 21b7e89..4872c91 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 _0x9b13=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../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','Content-Range','reject','save','update','then','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x9b13,0x119));var _0x39b1=function(_0x33ffee,_0xa318de){_0x33ffee=_0x33ffee-0x0;var _0x27adc5=_0x9b13[_0x33ffee];return _0x27adc5;};'use strict';var emlformat=require(_0x39b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x39b1('0x1'));var jsonpatch=require(_0x39b1('0x2'));var rp=require(_0x39b1('0x3'));var moment=require(_0x39b1('0x4'));var BPromise=require(_0x39b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x39b1('0x6'));var sox=require('sox');var csv=require(_0x39b1('0x7'));var ejs=require(_0x39b1('0x8'));var fs=require('fs');var fs_extra=require(_0x39b1('0x9'));var _=require('lodash');var squel=require(_0x39b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x39b1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x39b1('0x7'));var querystring=require(_0x39b1('0xc'));var Papa=require(_0x39b1('0xd'));var Redis=require(_0x39b1('0xe'));var authService=require(_0x39b1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x39b1('0x10'));var hardwareService=require(_0x39b1('0x11'));var logger=require(_0x39b1('0x12'))(_0x39b1('0x13'));var utils=require(_0x39b1('0x14'));var config=require(_0x39b1('0x15'));var licenseUtil=require(_0x39b1('0x16'));var db=require(_0x39b1('0x17'))['db'];function respondWithStatusCode(_0x4bbe21,_0x398cbf){_0x398cbf=_0x398cbf||0xcc;return function(_0x59e158){if(_0x59e158){return _0x4bbe21[_0x39b1('0x18')](_0x398cbf);}return _0x4bbe21[_0x39b1('0x19')](_0x398cbf)[_0x39b1('0x1a')]();};}function respondWithResult(_0x49dd14,_0x411798){_0x411798=_0x411798||0xc8;return function(_0x3b1971){if(_0x3b1971){return _0x49dd14[_0x39b1('0x19')](_0x411798)[_0x39b1('0x1b')](_0x3b1971);}};}function respondWithFilteredResult(_0x31bbfd,_0x648f70){return function(_0x131ab1){if(_0x131ab1){var _0x37280d=typeof _0x648f70[_0x39b1('0x1c')]===_0x39b1('0x1d')&&typeof _0x648f70[_0x39b1('0x1e')]===_0x39b1('0x1d');var _0x82200d=_0x131ab1[_0x39b1('0x1f')];var _0x393f1a=_0x37280d?0x0:_0x648f70[_0x39b1('0x1c')];var _0x3c7fb2=_0x37280d?_0x131ab1['count']:_0x648f70[_0x39b1('0x1c')]+_0x648f70[_0x39b1('0x1e')];var _0x362741;if(_0x3c7fb2>=_0x82200d){_0x3c7fb2=_0x82200d;_0x362741=0xc8;}else{_0x362741=0xce;}_0x31bbfd[_0x39b1('0x19')](_0x362741);return _0x31bbfd['set'](_0x39b1('0x20'),_0x393f1a+'-'+_0x3c7fb2+'/'+_0x82200d)['json'](_0x131ab1);}return null;};}function patchUpdates(_0x30a810){return function(_0x2d97c2){try{jsonpatch['apply'](_0x2d97c2,_0x30a810,!![]);}catch(_0x7a75ca){return BPromise[_0x39b1('0x21')](_0x7a75ca);}return _0x2d97c2[_0x39b1('0x22')]();};}function saveUpdates(_0x581497,_0x3d534b){return function(_0x18ddde){if(_0x18ddde){return _0x18ddde[_0x39b1('0x23')](_0x581497)[_0x39b1('0x24')](function(_0xdd40ae){return _0xdd40ae;});}return null;};}function removeEntity(_0x3dfe47,_0x4d41ea){return function(_0x2b13f8){if(_0x2b13f8){return _0x2b13f8['destroy']()[_0x39b1('0x24')](function(){_0x3dfe47['status'](0xcc)[_0x39b1('0x1a')]();});}};}function handleEntityNotFound(_0x43171c,_0x5e569f){return function(_0x8651c2){if(!_0x8651c2){_0x43171c[_0x39b1('0x18')](0x194);}return _0x8651c2;};}function handleError(_0x1489d9,_0x4d195d){_0x4d195d=_0x4d195d||0x1f4;return function(_0x44fce3){logger['error'](_0x44fce3[_0x39b1('0x25')]);if(_0x44fce3[_0x39b1('0x26')]){delete _0x44fce3[_0x39b1('0x26')];}_0x1489d9['status'](_0x4d195d)['send'](_0x44fce3);};}exports[_0x39b1('0x27')]=function(_0x4a7fe5,_0xc6909b){var _0x658a10={},_0x28cebb={},_0x165242={'count':0x0,'rows':[]};var _0x530a59=_[_0x39b1('0x28')](db[_0x39b1('0x29')][_0x39b1('0x2a')],function(_0x16728c){return{'name':_0x16728c[_0x39b1('0x2b')],'type':_0x16728c[_0x39b1('0x2c')]['key']};});_0x28cebb[_0x39b1('0x2d')]=_[_0x39b1('0x28')](_0x530a59,_0x39b1('0x26'));_0x28cebb[_0x39b1('0x2e')]=_[_0x39b1('0x2f')](_0x4a7fe5['query']);_0x28cebb[_0x39b1('0x30')]=_['intersection'](_0x28cebb[_0x39b1('0x2d')],_0x28cebb[_0x39b1('0x2e')]);_0x658a10[_0x39b1('0x31')]=_[_0x39b1('0x32')](_0x28cebb[_0x39b1('0x2d')],qs[_0x39b1('0x33')](_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x33')]));_0x658a10['attributes']=_0x658a10[_0x39b1('0x31')][_0x39b1('0x34')]?_0x658a10[_0x39b1('0x31')]:_0x28cebb[_0x39b1('0x2d')];if(!_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x35')](_0x39b1('0x36'))){_0x658a10[_0x39b1('0x1e')]=qs[_0x39b1('0x1e')](_0x4a7fe5[_0x39b1('0x2e')]['limit']);_0x658a10[_0x39b1('0x1c')]=qs[_0x39b1('0x1c')](_0x4a7fe5['query'][_0x39b1('0x1c')]);}_0x658a10[_0x39b1('0x37')]=qs['sort'](_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x38')]);_0x658a10[_0x39b1('0x39')]=qs[_0x39b1('0x30')](_[_0x39b1('0x3a')](_0x4a7fe5[_0x39b1('0x2e')],_0x28cebb[_0x39b1('0x30')]),_0x530a59);if(_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x3b')]){_0x658a10['where']=_[_0x39b1('0x3c')](_0x658a10[_0x39b1('0x39')],{'$or':_[_0x39b1('0x28')](_0x530a59,function(_0x989709){if(_0x989709[_0x39b1('0x2c')]!==_0x39b1('0x3d')){var _0x481738={};_0x481738[_0x989709['name']]={'$like':'%'+_0x4a7fe5[_0x39b1('0x2e')]['filter']+'%'};return _0x481738;}})});}_0x658a10=_[_0x39b1('0x3c')]({},_0x658a10,_0x4a7fe5['options']);var _0x69083d={'where':_0x658a10[_0x39b1('0x39')]};return db[_0x39b1('0x29')]['count'](_0x69083d)[_0x39b1('0x24')](function(_0x3ee700){_0x165242[_0x39b1('0x1f')]=_0x3ee700;if(_0x4a7fe5['query']['includeAll']){_0x658a10[_0x39b1('0x3e')]=[{'all':!![]}];}return db[_0x39b1('0x29')][_0x39b1('0x3f')](_0x658a10);})['then'](function(_0x5dcdc0){_0x165242[_0x39b1('0x40')]=_0x5dcdc0;return _0x165242;})[_0x39b1('0x24')](respondWithFilteredResult(_0xc6909b,_0x658a10))[_0x39b1('0x41')](handleError(_0xc6909b,null));};exports[_0x39b1('0x42')]=function(_0x447ba0,_0x283bde){var _0x4b743f={'raw':![],'where':{'id':_0x447ba0['params']['id']}},_0x93d86={};_0x93d86['model']=_[_0x39b1('0x2f')](db[_0x39b1('0x29')][_0x39b1('0x2a')]);_0x93d86[_0x39b1('0x2e')]=_['keys'](_0x447ba0[_0x39b1('0x2e')]);_0x93d86['filters']=_[_0x39b1('0x32')](_0x93d86['model'],_0x93d86['query']);_0x4b743f[_0x39b1('0x31')]=_[_0x39b1('0x32')](_0x93d86[_0x39b1('0x2d')],qs[_0x39b1('0x33')](_0x447ba0[_0x39b1('0x2e')]['fields']));_0x4b743f['attributes']=_0x4b743f[_0x39b1('0x31')][_0x39b1('0x34')]?_0x4b743f['attributes']:_0x93d86[_0x39b1('0x2d')];if(_0x447ba0[_0x39b1('0x2e')][_0x39b1('0x43')]){_0x4b743f[_0x39b1('0x3e')]=[{'all':!![]}];}_0x4b743f=_[_0x39b1('0x3c')]({},_0x4b743f,_0x447ba0[_0x39b1('0x44')]);return db[_0x39b1('0x29')][_0x39b1('0x45')](_0x4b743f)[_0x39b1('0x24')](handleEntityNotFound(_0x283bde,null))[_0x39b1('0x24')](respondWithResult(_0x283bde,null))['catch'](handleError(_0x283bde,null));};exports['create']=function(_0x17ca9d,_0x223023){return db[_0x39b1('0x29')]['create'](_0x17ca9d[_0x39b1('0x46')],{})[_0x39b1('0x24')](respondWithResult(_0x223023,0xc9))[_0x39b1('0x41')](handleError(_0x223023,null));};exports[_0x39b1('0x23')]=function(_0x5e0f75,_0x2b1b68){if(_0x5e0f75[_0x39b1('0x46')]['id']){delete _0x5e0f75[_0x39b1('0x46')]['id'];}return db['UserProfileSection'][_0x39b1('0x45')]({'where':{'id':_0x5e0f75[_0x39b1('0x47')]['id']}})[_0x39b1('0x24')](handleEntityNotFound(_0x2b1b68,null))[_0x39b1('0x24')](saveUpdates(_0x5e0f75['body'],null))['then'](respondWithResult(_0x2b1b68,null))[_0x39b1('0x41')](handleError(_0x2b1b68,null));};exports['destroy']=function(_0x290f5c,_0x43dd90){return db[_0x39b1('0x29')][_0x39b1('0x45')]({'where':{'id':_0x290f5c['params']['id']}})[_0x39b1('0x24')](handleEntityNotFound(_0x43dd90,null))['then'](removeEntity(_0x43dd90,null))[_0x39b1('0x41')](handleError(_0x43dd90,null));};exports['describe']=function(_0x507a5c,_0x198367){return db[_0x39b1('0x29')][_0x39b1('0x48')]()[_0x39b1('0x24')](respondWithResult(_0x198367,null))[_0x39b1('0x41')](handleError(_0x198367,null));}; \ No newline at end of file +var _0x7b55=['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','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','show','params','keys','length','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x42de7d,_0x3d3b27){var _0x50e713=function(_0x55f313){while(--_0x55f313){_0x42de7d['push'](_0x42de7d['shift']());}};_0x50e713(++_0x3d3b27);}(_0x7b55,0x1a2));var _0x57b5=function(_0x3f4682,_0xed19d7){_0x3f4682=_0x3f4682-0x0;var _0x483d91=_0x7b55[_0x3f4682];return _0x483d91;};'use strict';var emlformat=require(_0x57b5('0x0'));var rimraf=require(_0x57b5('0x1'));var zipdir=require(_0x57b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57b5('0x3'));var moment=require(_0x57b5('0x4'));var BPromise=require(_0x57b5('0x5'));var Mustache=require(_0x57b5('0x6'));var util=require(_0x57b5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x57b5('0x8'));var ejs=require(_0x57b5('0x9'));var fs=require('fs');var fs_extra=require(_0x57b5('0xa'));var _=require(_0x57b5('0xb'));var squel=require(_0x57b5('0xc'));var crypto=require(_0x57b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x57b5('0xe'));var toCsv=require(_0x57b5('0x8'));var querystring=require(_0x57b5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x57b5('0x10'));var qs=require(_0x57b5('0x11'));var as=require(_0x57b5('0x12'));var hardwareService=require(_0x57b5('0x13'));var logger=require(_0x57b5('0x14'))(_0x57b5('0x15'));var utils=require(_0x57b5('0x16'));var config=require(_0x57b5('0x17'));var licenseUtil=require(_0x57b5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ca882,_0x1de881){_0x1de881=_0x1de881||0xcc;return function(_0x2b7ecb){if(_0x2b7ecb){return _0x4ca882['sendStatus'](_0x1de881);}return _0x4ca882[_0x57b5('0x19')](_0x1de881)['end']();};}function respondWithResult(_0x4209b8,_0x2793c2){_0x2793c2=_0x2793c2||0xc8;return function(_0x22c738){if(_0x22c738){return _0x4209b8[_0x57b5('0x19')](_0x2793c2)[_0x57b5('0x1a')](_0x22c738);}};}function respondWithFilteredResult(_0x45ef14,_0x8e928e){return function(_0x4b6ef6){if(_0x4b6ef6){var _0x136dd2=typeof _0x8e928e[_0x57b5('0x1b')]===_0x57b5('0x1c')&&typeof _0x8e928e['limit']==='undefined';var _0x4b997b=_0x4b6ef6[_0x57b5('0x1d')];var _0x2b1bcc=_0x136dd2?0x0:_0x8e928e['offset'];var _0x4eb033=_0x136dd2?_0x4b6ef6[_0x57b5('0x1d')]:_0x8e928e[_0x57b5('0x1b')]+_0x8e928e[_0x57b5('0x1e')];var _0x53da1a;if(_0x4eb033>=_0x4b997b){_0x4eb033=_0x4b997b;_0x53da1a=0xc8;}else{_0x53da1a=0xce;}_0x45ef14['status'](_0x53da1a);return _0x45ef14[_0x57b5('0x1f')](_0x57b5('0x20'),_0x2b1bcc+'-'+_0x4eb033+'/'+_0x4b997b)[_0x57b5('0x1a')](_0x4b6ef6);}return null;};}function patchUpdates(_0x567c3b){return function(_0x487824){try{jsonpatch['apply'](_0x487824,_0x567c3b,!![]);}catch(_0x3ba14b){return BPromise[_0x57b5('0x21')](_0x3ba14b);}return _0x487824[_0x57b5('0x22')]();};}function saveUpdates(_0x35eab2,_0x19cc18){return function(_0xa823d7){if(_0xa823d7){return _0xa823d7[_0x57b5('0x23')](_0x35eab2)['then'](function(_0x59d51a){return _0x59d51a;});}return null;};}function removeEntity(_0x1737c2,_0x12abb4){return function(_0x130373){if(_0x130373){return _0x130373[_0x57b5('0x24')]()[_0x57b5('0x25')](function(){_0x1737c2[_0x57b5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e235b,_0x1a30bf){return function(_0x3fc247){if(!_0x3fc247){_0x5e235b[_0x57b5('0x26')](0x194);}return _0x3fc247;};}function handleError(_0x361ff2,_0x5592cd){_0x5592cd=_0x5592cd||0x1f4;return function(_0x99d2cd){logger[_0x57b5('0x27')](_0x99d2cd['stack']);if(_0x99d2cd['name']){delete _0x99d2cd[_0x57b5('0x28')];}_0x361ff2[_0x57b5('0x19')](_0x5592cd)[_0x57b5('0x29')](_0x99d2cd);};}exports[_0x57b5('0x2a')]=function(_0x4299e6,_0x21eb58){var _0x1dc8f8={},_0x2ac37e={},_0x5b20e7={'count':0x0,'rows':[]};var _0x31f2db=_[_0x57b5('0x2b')](db[_0x57b5('0x2c')][_0x57b5('0x2d')],function(_0x48a555){return{'name':_0x48a555[_0x57b5('0x2e')],'type':_0x48a555[_0x57b5('0x2f')][_0x57b5('0x30')]};});_0x2ac37e['model']=_['map'](_0x31f2db,_0x57b5('0x28'));_0x2ac37e[_0x57b5('0x31')]=_['keys'](_0x4299e6['query']);_0x2ac37e[_0x57b5('0x32')]=_[_0x57b5('0x33')](_0x2ac37e[_0x57b5('0x34')],_0x2ac37e[_0x57b5('0x31')]);_0x1dc8f8['attributes']=_['intersection'](_0x2ac37e[_0x57b5('0x34')],qs['fields'](_0x4299e6[_0x57b5('0x31')][_0x57b5('0x35')]));_0x1dc8f8[_0x57b5('0x36')]=_0x1dc8f8['attributes']['length']?_0x1dc8f8[_0x57b5('0x36')]:_0x2ac37e[_0x57b5('0x34')];if(!_0x4299e6[_0x57b5('0x31')][_0x57b5('0x37')](_0x57b5('0x38'))){_0x1dc8f8[_0x57b5('0x1e')]=qs['limit'](_0x4299e6[_0x57b5('0x31')]['limit']);_0x1dc8f8[_0x57b5('0x1b')]=qs[_0x57b5('0x1b')](_0x4299e6[_0x57b5('0x31')]['offset']);}_0x1dc8f8['order']=qs[_0x57b5('0x39')](_0x4299e6[_0x57b5('0x31')]['sort']);_0x1dc8f8[_0x57b5('0x3a')]=qs['filters'](_[_0x57b5('0x3b')](_0x4299e6[_0x57b5('0x31')],_0x2ac37e[_0x57b5('0x32')]),_0x31f2db);if(_0x4299e6[_0x57b5('0x31')]['filter']){_0x1dc8f8['where']=_[_0x57b5('0x3c')](_0x1dc8f8[_0x57b5('0x3a')],{'$or':_[_0x57b5('0x2b')](_0x31f2db,function(_0xa24bef){if(_0xa24bef[_0x57b5('0x2f')]!=='VIRTUAL'){var _0x1f9d03={};_0x1f9d03[_0xa24bef[_0x57b5('0x28')]]={'$like':'%'+_0x4299e6[_0x57b5('0x31')]['filter']+'%'};return _0x1f9d03;}})});}_0x1dc8f8=_[_0x57b5('0x3c')]({},_0x1dc8f8,_0x4299e6['options']);var _0x2dacae={'where':_0x1dc8f8[_0x57b5('0x3a')]};return db[_0x57b5('0x2c')]['count'](_0x2dacae)[_0x57b5('0x25')](function(_0x65bde1){_0x5b20e7[_0x57b5('0x1d')]=_0x65bde1;if(_0x4299e6[_0x57b5('0x31')][_0x57b5('0x3d')]){_0x1dc8f8[_0x57b5('0x3e')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1dc8f8);})[_0x57b5('0x25')](function(_0x22d9f3){_0x5b20e7['rows']=_0x22d9f3;return _0x5b20e7;})[_0x57b5('0x25')](respondWithFilteredResult(_0x21eb58,_0x1dc8f8))['catch'](handleError(_0x21eb58,null));};exports[_0x57b5('0x3f')]=function(_0x3aac74,_0x6972cc){var _0x15e81c={'raw':![],'where':{'id':_0x3aac74[_0x57b5('0x40')]['id']}},_0x6ef986={};_0x6ef986[_0x57b5('0x34')]=_[_0x57b5('0x41')](db[_0x57b5('0x2c')][_0x57b5('0x2d')]);_0x6ef986[_0x57b5('0x31')]=_['keys'](_0x3aac74[_0x57b5('0x31')]);_0x6ef986['filters']=_[_0x57b5('0x33')](_0x6ef986[_0x57b5('0x34')],_0x6ef986[_0x57b5('0x31')]);_0x15e81c[_0x57b5('0x36')]=_[_0x57b5('0x33')](_0x6ef986[_0x57b5('0x34')],qs[_0x57b5('0x35')](_0x3aac74[_0x57b5('0x31')][_0x57b5('0x35')]));_0x15e81c['attributes']=_0x15e81c['attributes'][_0x57b5('0x42')]?_0x15e81c['attributes']:_0x6ef986[_0x57b5('0x34')];if(_0x3aac74[_0x57b5('0x31')]['includeAll']){_0x15e81c['include']=[{'all':!![]}];}_0x15e81c=_[_0x57b5('0x3c')]({},_0x15e81c,_0x3aac74[_0x57b5('0x43')]);return db[_0x57b5('0x2c')][_0x57b5('0x44')](_0x15e81c)[_0x57b5('0x25')](handleEntityNotFound(_0x6972cc,null))[_0x57b5('0x25')](respondWithResult(_0x6972cc,null))[_0x57b5('0x45')](handleError(_0x6972cc,null));};exports['create']=function(_0x42d4c3,_0x3dc7b9){return db[_0x57b5('0x2c')]['create'](_0x42d4c3['body'],{})[_0x57b5('0x25')](respondWithResult(_0x3dc7b9,0xc9))[_0x57b5('0x45')](handleError(_0x3dc7b9,null));};exports['update']=function(_0x8eda6d,_0x49439c){if(_0x8eda6d[_0x57b5('0x46')]['id']){delete _0x8eda6d[_0x57b5('0x46')]['id'];}return db['UserProfileSection'][_0x57b5('0x44')]({'where':{'id':_0x8eda6d[_0x57b5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49439c,null))[_0x57b5('0x25')](saveUpdates(_0x8eda6d[_0x57b5('0x46')],null))[_0x57b5('0x25')](respondWithResult(_0x49439c,null))[_0x57b5('0x45')](handleError(_0x49439c,null));};exports[_0x57b5('0x24')]=function(_0x529776,_0x2cbabc){return db['UserProfileSection'][_0x57b5('0x44')]({'where':{'id':_0x529776[_0x57b5('0x40')]['id']}})[_0x57b5('0x25')](handleEntityNotFound(_0x2cbabc,null))['then'](removeEntity(_0x2cbabc,null))[_0x57b5('0x45')](handleError(_0x2cbabc,null));};exports['describe']=function(_0x498e0d,_0x21678f){return db[_0x57b5('0x2c')]['describe']()[_0x57b5('0x25')](respondWithResult(_0x21678f,null))['catch'](handleError(_0x21678f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9d6849f..0f67e38 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 _0x552a=['../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5586d4,_0x14b6ee){var _0x5a184f=function(_0x4553ee){while(--_0x4553ee){_0x5586d4['push'](_0x5586d4['shift']());}};_0x5a184f(++_0x14b6ee);}(_0x552a,0x9e));var _0xa552=function(_0x1d6d70,_0x5c45d1){_0x1d6d70=_0x1d6d70-0x0;var _0x1b4d36=_0x552a[_0x1d6d70];return _0x1b4d36;};'use strict';var _=require(_0xa552('0x0'));var util=require(_0xa552('0x1'));var logger=require(_0xa552('0x2'))('api');var moment=require(_0xa552('0x3'));var BPromise=require(_0xa552('0x4'));var rp=require(_0xa552('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa552('0x6'));var config=require(_0xa552('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xa552('0x8')]=function(_0x39da3e,_0x46f739){return _0x39da3e[_0xa552('0x9')](_0xa552('0xa'),attributes,{'tableName':_0xa552('0xb'),'paranoid':![],'indexes':[{'name':_0xa552('0xc'),'fields':[_0xa552('0xd'),_0xa552('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb605=['api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','../../config/logger'];(function(_0x3f5efc,_0x41396d){var _0x40d345=function(_0x8d6c79){while(--_0x8d6c79){_0x3f5efc['push'](_0x3f5efc['shift']());}};_0x40d345(++_0x41396d);}(_0xb605,0x11b));var _0x5b60=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0xb605[_0x5b077b];return _0x16faf7;};'use strict';var _=require(_0x5b60('0x0'));var util=require('util');var logger=require(_0x5b60('0x1'))(_0x5b60('0x2'));var moment=require(_0x5b60('0x3'));var BPromise=require(_0x5b60('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b60('0x5'));var rimraf=require(_0x5b60('0x6'));var config=require(_0x5b60('0x7'));var attributes=require(_0x5b60('0x8'));module[_0x5b60('0x9')]=function(_0x4159f6,_0x2bade8){return _0x4159f6['define'](_0x5b60('0xa'),attributes,{'tableName':_0x5b60('0xb'),'paranoid':![],'indexes':[{'name':_0x5b60('0xc'),'fields':[_0x5b60('0xd'),_0x5b60('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3df3fe5..bf1bda1 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 _0x6dcd=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x6dcd,0x130));var _0xd6dc=function(_0x387645,_0x42d1ae){_0x387645=_0x387645-0x0;var _0x869a39=_0x6dcd[_0x387645];return _0x869a39;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6dc('0x0'));var BPromise=require(_0xd6dc('0x1'));var rs=require(_0xd6dc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd6dc('0x3'));var logger=require(_0xd6dc('0x4'))(_0xd6dc('0x5'));var config=require('../../config/environment');var jayson=require(_0xd6dc('0x6'));var client=jayson[_0xd6dc('0x7')][_0xd6dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x398978,_0x502952,_0x508f92){return new BPromise(function(_0x1b98d1,_0x4cc646){return client['request'](_0x398978,_0x508f92)['then'](function(_0x10a0a1){logger[_0xd6dc('0x9')](_0xd6dc('0xa'),_0x502952,_0xd6dc('0xb'));logger[_0xd6dc('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x502952,_0xd6dc('0xb'),JSON[_0xd6dc('0xd')](_0x10a0a1));if(_0x10a0a1[_0xd6dc('0xe')]){if(_0x10a0a1[_0xd6dc('0xe')][_0xd6dc('0xf')]===0x1f4){logger[_0xd6dc('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x502952,_0x10a0a1[_0xd6dc('0xe')]['message']);return _0x4cc646(_0x10a0a1['error'][_0xd6dc('0x10')]);}logger[_0xd6dc('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x502952,_0x10a0a1[_0xd6dc('0xe')][_0xd6dc('0x10')]);return _0x1b98d1(_0x10a0a1[_0xd6dc('0xe')]['message']);}else{logger['info'](_0xd6dc('0xa'),_0x502952,_0xd6dc('0xb'));_0x1b98d1(_0x10a0a1[_0xd6dc('0x11')]['message']);}})[_0xd6dc('0x12')](function(_0x21acac){logger['error'](_0xd6dc('0xa'),_0x502952,_0x21acac);_0x4cc646(_0x21acac);});});} \ No newline at end of file +var _0x33b1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x5e8ff8,_0x3e8081){var _0x258962=function(_0x4e5023){while(--_0x4e5023){_0x5e8ff8['push'](_0x5e8ff8['shift']());}};_0x258962(++_0x3e8081);}(_0x33b1,0x186));var _0x133b=function(_0x5e69c9,_0xa52c5){_0x5e69c9=_0x5e69c9-0x0;var _0x9e5b3a=_0x33b1[_0x5e69c9];return _0x9e5b3a;};'use strict';var _=require('lodash');var util=require(_0x133b('0x0'));var moment=require(_0x133b('0x1'));var BPromise=require(_0x133b('0x2'));var rs=require(_0x133b('0x3'));var fs=require('fs');var Redis=require(_0x133b('0x4'));var db=require(_0x133b('0x5'))['db'];var utils=require(_0x133b('0x6'));var logger=require(_0x133b('0x7'))(_0x133b('0x8'));var config=require('../../config/environment');var jayson=require(_0x133b('0x9'));var client=jayson[_0x133b('0xa')][_0x133b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d30ad,_0x20fa37,_0x4b11a2){return new BPromise(function(_0x6d9c63,_0x1fc9dc){return client['request'](_0x2d30ad,_0x4b11a2)[_0x133b('0xc')](function(_0x19cd55){logger[_0x133b('0xd')](_0x133b('0xe'),_0x20fa37,_0x133b('0xf'));logger['debug'](_0x133b('0x10'),_0x20fa37,_0x133b('0xf'),JSON[_0x133b('0x11')](_0x19cd55));if(_0x19cd55[_0x133b('0x12')]){if(_0x19cd55[_0x133b('0x12')][_0x133b('0x13')]===0x1f4){logger[_0x133b('0x12')](_0x133b('0xe'),_0x20fa37,_0x19cd55[_0x133b('0x12')][_0x133b('0x14')]);return _0x1fc9dc(_0x19cd55[_0x133b('0x12')][_0x133b('0x14')]);}logger[_0x133b('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x20fa37,_0x19cd55[_0x133b('0x12')][_0x133b('0x14')]);return _0x6d9c63(_0x19cd55[_0x133b('0x12')]['message']);}else{logger[_0x133b('0xd')](_0x133b('0xe'),_0x20fa37,_0x133b('0xf'));_0x6d9c63(_0x19cd55[_0x133b('0x15')]['message']);}})[_0x133b('0x16')](function(_0x18e23a){logger['error'](_0x133b('0xe'),_0x20fa37,_0x18e23a);_0x1fc9dc(_0x18e23a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 23a0d4d..49d042a 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(_0x42c383,_0x5b92b6){var _0x4aba3b=function(_0x2bfba3){while(--_0x2bfba3){_0x42c383['push'](_0x42c383['shift']());}};_0x4aba3b(++_0x5b92b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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(_0x232331,_0x5881c4){var _0x3eef9d=function(_0x31192e){while(--_0x31192e){_0x232331['push'](_0x232331['shift']());}};_0x3eef9d(++_0x5881c4);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 27de5ff..abd9ef4 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. * // * * // ************************************************************************* -var _0xa42b=['sequelize','exports','INTEGER'];(function(_0x210ce7,_0x4d9a73){var _0x5de04c=function(_0xf9da31){while(--_0xf9da31){_0x210ce7['push'](_0x210ce7['shift']());}};_0x5de04c(++_0x4d9a73);}(_0xa42b,0xcf));var _0xba42=function(_0x490f78,_0x3161c2){_0x490f78=_0x490f78-0x0;var _0x5de2d0=_0xa42b[_0x490f78];return _0x5de2d0;};'use strict';var Sequelize=require(_0xba42('0x0'));module[_0xba42('0x1')]={'penalty':{'type':Sequelize[_0xba42('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3187=['sequelize','exports'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0x3187,0xfa));var _0x7318=function(_0x3bc345,_0x515875){_0x3bc345=_0x3bc345-0x0;var _0x46b424=_0x3187[_0x3bc345];return _0x46b424;};'use strict';var Sequelize=require(_0x7318('0x0'));module[_0x7318('0x1')]={'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 2b893e2..a025cea 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 _0xc359=['user_has_sms_queues','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0xc359,0x1d9));var _0x9c35=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xc359[_0x2eb3db];return _0x358f33;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var logger=require('../../config/logger')(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c35('0x4'));var rimraf=require('rimraf');var config=require(_0x9c35('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x9c35('0x6')]=function(_0x5b3ada,_0x490409){return _0x5b3ada['define']('UserSmsQueue',attributes,{'tableName':_0x9c35('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d0=['./userSmsQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1a149f,_0x17bf7a){var _0x568fad=function(_0xa5f4f4){while(--_0xa5f4f4){_0x1a149f['push'](_0x1a149f['shift']());}};_0x568fad(++_0x17bf7a);}(_0x83d0,0xb7));var _0x083d=function(_0x428f5b,_0xdbb93d){_0x428f5b=_0x428f5b-0x0;var _0x5095ba=_0x83d0[_0x428f5b];return _0x5095ba;};'use strict';var _=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var logger=require(_0x083d('0x2'))(_0x083d('0x3'));var moment=require(_0x083d('0x4'));var BPromise=require(_0x083d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x083d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x083d('0x7'));module[_0x083d('0x8')]=function(_0x3c4b8c,_0x2e75e8){return _0x3c4b8c[_0x083d('0x9')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','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 678d6cb..8aeb80c 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 _0x178b=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xa24985,_0x1d2c15){var _0x2f7c36=function(_0x28219c){while(--_0x28219c){_0xa24985['push'](_0xa24985['shift']());}};_0x2f7c36(++_0x1d2c15);}(_0x178b,0x74));var _0xb178=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x178b[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0xb178('0x0'));var util=require(_0xb178('0x1'));var moment=require(_0xb178('0x2'));var BPromise=require(_0xb178('0x3'));var rs=require(_0xb178('0x4'));var fs=require('fs');var Redis=require(_0xb178('0x5'));var db=require(_0xb178('0x6'))['db'];var utils=require(_0xb178('0x7'));var logger=require(_0xb178('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb178('0x9'));var client=jayson[_0xb178('0xa')][_0xb178('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x836c8c,_0x59078e,_0x146ba3){return new BPromise(function(_0x499e04,_0x5496ea){return client[_0xb178('0xc')](_0x836c8c,_0x146ba3)[_0xb178('0xd')](function(_0x40eeda){logger[_0xb178('0xe')](_0xb178('0xf'),_0x59078e,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x59078e,_0xb178('0x10'),JSON[_0xb178('0x11')](_0x40eeda));if(_0x40eeda[_0xb178('0x12')]){if(_0x40eeda[_0xb178('0x12')][_0xb178('0x13')]===0x1f4){logger['error'](_0xb178('0xf'),_0x59078e,_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);return _0x5496ea(_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x59078e,_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);return _0x499e04(_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);}else{logger[_0xb178('0xe')](_0xb178('0xf'),_0x59078e,_0xb178('0x10'));_0x499e04(_0x40eeda['result']['message']);}})['catch'](function(_0x356ef3){logger[_0xb178('0x12')](_0xb178('0xf'),_0x59078e,_0x356ef3);_0x5496ea(_0x356ef3);});});} \ No newline at end of file +var _0xe6dd=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2b78e5,_0x3126f8){var _0xa8d52d=function(_0x51fd7f){while(--_0x51fd7f){_0x2b78e5['push'](_0x2b78e5['shift']());}};_0xa8d52d(++_0x3126f8);}(_0xe6dd,0x16d));var _0xde6d=function(_0x224d7c,_0x5badfe){_0x224d7c=_0x224d7c-0x0;var _0x3ffb61=_0xe6dd[_0x224d7c];return _0x3ffb61;};'use strict';var _=require('lodash');var util=require(_0xde6d('0x0'));var moment=require(_0xde6d('0x1'));var BPromise=require(_0xde6d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde6d('0x3'));var db=require(_0xde6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde6d('0x5'))('rpc');var config=require(_0xde6d('0x6'));var jayson=require(_0xde6d('0x7'));var client=jayson['client'][_0xde6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdab4ce,_0x4896d9,_0x2b31b3){return new BPromise(function(_0x54f147,_0x558818){return client[_0xde6d('0x9')](_0xdab4ce,_0x2b31b3)['then'](function(_0x3e0f34){logger[_0xde6d('0xa')](_0xde6d('0xb'),_0x4896d9,_0xde6d('0xc'));logger[_0xde6d('0xd')](_0xde6d('0xe'),_0x4896d9,'request\x20sent',JSON[_0xde6d('0xf')](_0x3e0f34));if(_0x3e0f34[_0xde6d('0x10')]){if(_0x3e0f34[_0xde6d('0x10')][_0xde6d('0x11')]===0x1f4){logger[_0xde6d('0x10')](_0xde6d('0xb'),_0x4896d9,_0x3e0f34[_0xde6d('0x10')][_0xde6d('0x12')]);return _0x558818(_0x3e0f34[_0xde6d('0x10')][_0xde6d('0x12')]);}logger[_0xde6d('0x10')](_0xde6d('0xb'),_0x4896d9,_0x3e0f34['error'][_0xde6d('0x12')]);return _0x54f147(_0x3e0f34[_0xde6d('0x10')][_0xde6d('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4896d9,'request\x20sent');_0x54f147(_0x3e0f34[_0xde6d('0x13')][_0xde6d('0x12')]);}})[_0xde6d('0x14')](function(_0x5b9058){logger[_0xde6d('0x10')](_0xde6d('0xb'),_0x4896d9,_0x5b9058);_0x558818(_0x5b9058);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 360e7dc..89f9782 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 _0x6fc4=['INTEGER','exports'];(function(_0x559958,_0x9f3a90){var _0x4bc85a=function(_0x5d5b7c){while(--_0x5d5b7c){_0x559958['push'](_0x559958['shift']());}};_0x4bc85a(++_0x9f3a90);}(_0x6fc4,0x139));var _0x46fc=function(_0x5de237,_0x2058e8){_0x5de237=_0x5de237-0x0;var _0x3b3d4d=_0x6fc4[_0x5de237];return _0x3b3d4d;};'use strict';var Sequelize=require('sequelize');module[_0x46fc('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x46fc('0x1')]}}; \ No newline at end of file +var _0x1f17=['sequelize','exports','INTEGER'];(function(_0x527002,_0x402013){var _0x484998=function(_0x1016a1){while(--_0x1016a1){_0x527002['push'](_0x527002['shift']());}};_0x484998(++_0x402013);}(_0x1f17,0x8d));var _0x71f1=function(_0x1c0f3d,_0x55a9e2){_0x1c0f3d=_0x1c0f3d-0x0;var _0x4d71a8=_0x1f17[_0x1c0f3d];return _0x4d71a8;};'use strict';var Sequelize=require(_0x71f1('0x0'));module[_0x71f1('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x71f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 0d9cc52..b9d1ed4 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(_0x5693b9,_0x24239a){var _0x407e06=function(_0x318078){while(--_0x318078){_0x5693b9['push'](_0x5693b9['shift']());}};_0x407e06(++_0x24239a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x4f6088,_0x928f3){var _0x3e9a06=function(_0x225077){while(--_0x225077){_0x4f6088['push'](_0x4f6088['shift']());}};_0x3e9a06(++_0x928f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 36cc32b..ab9f34b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x22626b,_0x154dda){var _0x2bae4c=function(_0x171362){while(--_0x171362){_0x22626b['push'](_0x22626b['shift']());}};_0x2bae4c(++_0x154dda);}(_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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x455abf,_0x4ae86d){var _0x3ab136=function(_0x2f6199){while(--_0x2f6199){_0x455abf['push'](_0x455abf['shift']());}};_0x3ab136(++_0x4ae86d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index cd36495..eab9cae 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 _0xb22e=['sequelize','exports'];(function(_0x4ea039,_0x12da7d){var _0xa477a6=function(_0x5bb7ca){while(--_0x5bb7ca){_0x4ea039['push'](_0x4ea039['shift']());}};_0xa477a6(++_0x12da7d);}(_0xb22e,0xba));var _0xeb22=function(_0x498bfc,_0x1ac9c1){_0x498bfc=_0x498bfc-0x0;var _0x4612ff=_0xb22e[_0x498bfc];return _0x4612ff;};'use strict';var Sequelize=require(_0xeb22('0x0'));module[_0xeb22('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x980f=['exports','INTEGER','sequelize'];(function(_0x5b0002,_0xf25593){var _0xd51172=function(_0x3d29ea){while(--_0x3d29ea){_0x5b0002['push'](_0x5b0002['shift']());}};_0xd51172(++_0xf25593);}(_0x980f,0x194));var _0xf980=function(_0x551b1c,_0x3584f9){_0x551b1c=_0x551b1c-0x0;var _0x131273=_0x980f[_0x551b1c];return _0x131273;};'use strict';var Sequelize=require(_0xf980('0x0'));module[_0xf980('0x1')]={'penalty':{'type':Sequelize[_0xf980('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 dab735d..36d81f5 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 _0x13cf=['UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0x112e82,_0x305813){var _0xc10fa3=function(_0x3194ca){while(--_0x3194ca){_0x112e82['push'](_0x112e82['shift']());}};_0xc10fa3(++_0x305813);}(_0x13cf,0x10a));var _0xf13c=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x13cf[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0xf13c('0x0'));var logger=require(_0xf13c('0x1'))(_0xf13c('0x2'));var moment=require(_0xf13c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf13c('0x4'));var fs=require('fs');var path=require(_0xf13c('0x5'));var rimraf=require(_0xf13c('0x6'));var config=require(_0xf13c('0x7'));var attributes=require(_0xf13c('0x8'));module['exports']=function(_0xd8c5c9,_0x14a535){return _0xd8c5c9[_0xf13c('0x9')](_0xf13c('0xa'),attributes,{'tableName':_0xf13c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48ac=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','../../config/logger'];(function(_0x362d6a,_0x253e0d){var _0x2af49e=function(_0x4a43f8){while(--_0x4a43f8){_0x362d6a['push'](_0x362d6a['shift']());}};_0x2af49e(++_0x253e0d);}(_0x48ac,0x1ad));var _0xc48a=function(_0x29bc33,_0x2425b5){_0x29bc33=_0x29bc33-0x0;var _0x50568d=_0x48ac[_0x29bc33];return _0x50568d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc48a('0x0'))(_0xc48a('0x1'));var moment=require(_0xc48a('0x2'));var BPromise=require('bluebird');var rp=require(_0xc48a('0x3'));var fs=require('fs');var path=require(_0xc48a('0x4'));var rimraf=require(_0xc48a('0x5'));var config=require(_0xc48a('0x6'));var attributes=require(_0xc48a('0x7'));module[_0xc48a('0x8')]=function(_0x5f38a9,_0x3feaef){return _0x5f38a9['define'](_0xc48a('0x9'),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 f72ffbc..f1586e6 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 _0x4202=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4202,0xb0));var _0x2420=function(_0x19a1bf,_0xd46be){_0x19a1bf=_0x19a1bf-0x0;var _0x4e8a3e=_0x4202[_0x19a1bf];return _0x4e8a3e;};'use strict';var _=require(_0x2420('0x0'));var util=require(_0x2420('0x1'));var moment=require(_0x2420('0x2'));var BPromise=require('bluebird');var rs=require(_0x2420('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2420('0x4'))['db'];var utils=require(_0x2420('0x5'));var logger=require('../../config/logger')(_0x2420('0x6'));var config=require(_0x2420('0x7'));var jayson=require(_0x2420('0x8'));var client=jayson[_0x2420('0x9')][_0x2420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff7e2,_0x4e1932,_0x4060ea){return new BPromise(function(_0x2ccb4f,_0x594a64){return client[_0x2420('0xb')](_0x1ff7e2,_0x4060ea)['then'](function(_0x473e5d){logger[_0x2420('0xc')](_0x2420('0xd'),_0x4e1932,_0x2420('0xe'));logger[_0x2420('0xf')](_0x2420('0x10'),_0x4e1932,_0x2420('0xe'),JSON[_0x2420('0x11')](_0x473e5d));if(_0x473e5d[_0x2420('0x12')]){if(_0x473e5d['error'][_0x2420('0x13')]===0x1f4){logger[_0x2420('0x12')](_0x2420('0xd'),_0x4e1932,_0x473e5d[_0x2420('0x12')][_0x2420('0x14')]);return _0x594a64(_0x473e5d[_0x2420('0x12')][_0x2420('0x14')]);}logger['error'](_0x2420('0xd'),_0x4e1932,_0x473e5d[_0x2420('0x12')][_0x2420('0x14')]);return _0x2ccb4f(_0x473e5d[_0x2420('0x12')]['message']);}else{logger[_0x2420('0xc')](_0x2420('0xd'),_0x4e1932,_0x2420('0xe'));_0x2ccb4f(_0x473e5d['result']['message']);}})['catch'](function(_0x5cfb4d){logger[_0x2420('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x4e1932,_0x5cfb4d);_0x594a64(_0x5cfb4d);});});} \ No newline at end of file +var _0x1322=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x1322,0x72));var _0x2132=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1322[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x2132('0x0'));var util=require('util');var moment=require(_0x2132('0x1'));var BPromise=require(_0x2132('0x2'));var rs=require(_0x2132('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2132('0x4'))['db'];var utils=require(_0x2132('0x5'));var logger=require(_0x2132('0x6'))(_0x2132('0x7'));var config=require('../../config/environment');var jayson=require(_0x2132('0x8'));var client=jayson['client'][_0x2132('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cae2e,_0x26d22d,_0x4b9e41){return new BPromise(function(_0x512ca1,_0x1e72e6){return client[_0x2132('0xa')](_0x2cae2e,_0x4b9e41)[_0x2132('0xb')](function(_0x381659){logger[_0x2132('0xc')](_0x2132('0xd'),_0x26d22d,_0x2132('0xe'));logger[_0x2132('0xf')](_0x2132('0x10'),_0x26d22d,_0x2132('0xe'),JSON['stringify'](_0x381659));if(_0x381659[_0x2132('0x11')]){if(_0x381659[_0x2132('0x11')][_0x2132('0x12')]===0x1f4){logger[_0x2132('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x26d22d,_0x381659['error'][_0x2132('0x13')]);return _0x1e72e6(_0x381659[_0x2132('0x11')][_0x2132('0x13')]);}logger[_0x2132('0x11')](_0x2132('0xd'),_0x26d22d,_0x381659[_0x2132('0x11')][_0x2132('0x13')]);return _0x512ca1(_0x381659[_0x2132('0x11')]['message']);}else{logger['info'](_0x2132('0xd'),_0x26d22d,_0x2132('0xe'));_0x512ca1(_0x381659[_0x2132('0x14')][_0x2132('0x13')]);}})['catch'](function(_0x40fff4){logger['error'](_0x2132('0xd'),_0x26d22d,_0x40fff4);_0x1e72e6(_0x40fff4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c99323b..9e49969 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x255145,_0x2ba97a){var _0x3882ce=function(_0x1a1a4f){while(--_0x1a1a4f){_0x255145['push'](_0x255145['shift']());}};_0x3882ce(++_0x2ba97a);}(_0xe706,0xa3));var _0x6e70=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0xe706[_0x3b9570];return _0x28acdd;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x49d8b3,_0xeac856){var _0x2c124e=function(_0x2b7545){while(--_0x2b7545){_0x49d8b3['push'](_0x49d8b3['shift']());}};_0x2c124e(++_0xeac856);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a3a9947..4fbc435 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 _0x3e51=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x43f50c,_0x21950e){var _0x44a32c=function(_0x5b3a49){while(--_0x5b3a49){_0x43f50c['push'](_0x43f50c['shift']());}};_0x44a32c(++_0x21950e);}(_0x3e51,0x74));var _0x13e5=function(_0x46cf7e,_0xe67477){_0x46cf7e=_0x46cf7e-0x0;var _0x241ad7=_0x3e51[_0x46cf7e];return _0x241ad7;};'use strict';var Sequelize=require(_0x13e5('0x0'));module[_0x13e5('0x1')]={'uniqueid':{'type':Sequelize[_0x13e5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x13e5('0x3')},'membername':{'type':Sequelize[_0x13e5('0x4')],'allowNull':![],'comment':_0x13e5('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x13e5('0x4')],'allowNull':![],'unique':_0x13e5('0x5'),'comment':_0x13e5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x13e5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x13e5('0x4')],'allowNull':![],'unique':_0x13e5('0x5'),'comment':_0x13e5('0x3')},'penalty':{'type':Sequelize[_0x13e5('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x13e5('0x2')](0xb),'defaultValue':0x0,'comment':_0x13e5('0x3')}}; \ No newline at end of file +var _0x4b3e=['exports','Required\x20by\x20Asterisk','INTEGER','STRING','queue_interface','sequelize'];(function(_0x131ccd,_0x3685f2){var _0x1f359d=function(_0x5adf34){while(--_0x5adf34){_0x131ccd['push'](_0x131ccd['shift']());}};_0x1f359d(++_0x3685f2);}(_0x4b3e,0x1f1));var _0xe4b3=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x4b3e[_0x55a89e];return _0x3aa2bd;};'use strict';var Sequelize=require(_0xe4b3('0x0'));module[_0xe4b3('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe4b3('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xe4b3('0x2')},'UserId':{'type':Sequelize[_0xe4b3('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe4b3('0x4')],'allowNull':![],'unique':_0xe4b3('0x5'),'comment':_0xe4b3('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xe4b3('0x4')],'allowNull':![],'unique':_0xe4b3('0x5'),'comment':_0xe4b3('0x2')},'penalty':{'type':Sequelize[_0xe4b3('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xe4b3('0x3')](0xb),'defaultValue':0x0,'comment':_0xe4b3('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5e61287..8a668c6 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 _0x739c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xc7e2d6,_0x5af8fd){var _0x193111=function(_0x1e0026){while(--_0x1e0026){_0xc7e2d6['push'](_0xc7e2d6['shift']());}};_0x193111(++_0x5af8fd);}(_0x739c,0x1b2));var _0xc739=function(_0x27e4e8,_0x42cd4e){_0x27e4e8=_0x27e4e8-0x0;var _0x35f212=_0x739c[_0x27e4e8];return _0x35f212;};'use strict';var EventEmitter=require(_0xc739('0x0'));var UserVoiceQueueRt=require(_0xc739('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc739('0x2')](0x0);var events={'afterCreate':_0xc739('0x3'),'afterUpdate':_0xc739('0x4'),'afterDestroy':_0xc739('0x5')};function emitEvent(_0x11e511){return function(_0x501993,_0x3dbf80,_0x16f097){UserVoiceQueueRtEvents['emit'](_0x11e511+':'+_0x501993['id'],_0x501993);UserVoiceQueueRtEvents[_0xc739('0x6')](_0x11e511,_0x501993);_0x16f097(null);};}for(var e in events){if(events[_0xc739('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xc739('0x8')](e,emitEvent(event));}}module[_0xc739('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe0a4=['emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','save','update','remove'];(function(_0x46a424,_0x3b2e83){var _0x1552a3=function(_0x302979){while(--_0x302979){_0x46a424['push'](_0x46a424['shift']());}};_0x1552a3(++_0x3b2e83);}(_0xe0a4,0x1a2));var _0x4e0a=function(_0x14d536,_0x1255aa){_0x14d536=_0x14d536-0x0;var _0x2cacdf=_0xe0a4[_0x14d536];return _0x2cacdf;};'use strict';var EventEmitter=require(_0x4e0a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x4e0a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e0a('0x2'),'afterUpdate':_0x4e0a('0x3'),'afterDestroy':_0x4e0a('0x4')};function emitEvent(_0x1fce4a){return function(_0x24e509,_0x33c38d,_0x1962ff){UserVoiceQueueRtEvents[_0x4e0a('0x5')](_0x1fce4a+':'+_0x24e509['id'],_0x24e509);UserVoiceQueueRtEvents['emit'](_0x1fce4a,_0x24e509);_0x1962ff(null);};}for(var e in events){if(events[_0x4e0a('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x4e0a('0x7')](e,emitEvent(event));}}module[_0x4e0a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 6b0064e..0451f70 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 _0x3c47=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x2ec026,_0xb190a8){var _0x4eb11f=function(_0xaea945){while(--_0xaea945){_0x2ec026['push'](_0x2ec026['shift']());}};_0x4eb11f(++_0xb190a8);}(_0x3c47,0x140));var _0x73c4=function(_0x5c4223,_0x38ba38){_0x5c4223=_0x5c4223-0x0;var _0x4a0c4e=_0x3c47[_0x5c4223];return _0x4a0c4e;};'use strict';var _=require(_0x73c4('0x0'));var util=require('util');var logger=require(_0x73c4('0x1'))(_0x73c4('0x2'));var moment=require(_0x73c4('0x3'));var BPromise=require(_0x73c4('0x4'));var rp=require(_0x73c4('0x5'));var fs=require('fs');var path=require(_0x73c4('0x6'));var rimraf=require(_0x73c4('0x7'));var config=require(_0x73c4('0x8'));var attributes=require(_0x73c4('0x9'));module[_0x73c4('0xa')]=function(_0x1014af,_0x31d2ee){return _0x1014af[_0x73c4('0xb')](_0x73c4('0xc'),attributes,{'tableName':_0x73c4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f5=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2e445b,_0x2dc9c6){var _0x4c6b3a=function(_0x314177){while(--_0x314177){_0x2e445b['push'](_0x2e445b['shift']());}};_0x4c6b3a(++_0x2dc9c6);}(_0xd2f5,0x10e));var _0x5d2f=function(_0x2ed893,_0x59096d){_0x2ed893=_0x2ed893-0x0;var _0x3cee3d=_0xd2f5[_0x2ed893];return _0x3cee3d;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var logger=require(_0x5d2f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d2f('0x4'));var rimraf=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x5d2f('0x7')]=function(_0x212774,_0xde059e){return _0x212774[_0x5d2f('0x8')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','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 0d9382f..3b2cfa3 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 _0x12e2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring'];(function(_0x1c29fd,_0x2366d8){var _0x52ff9d=function(_0x4d0921){while(--_0x4d0921){_0x1c29fd['push'](_0x1c29fd['shift']());}};_0x52ff9d(++_0x2366d8);}(_0x12e2,0xdb));var _0x212e=function(_0xfa14b5,_0x164434){_0xfa14b5=_0xfa14b5-0x0;var _0x57e471=_0x12e2[_0xfa14b5];return _0x57e471;};'use strict';var _=require('lodash');var util=require(_0x212e('0x0'));var moment=require('moment');var BPromise=require(_0x212e('0x1'));var rs=require(_0x212e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x212e('0x3'))['db'];var utils=require(_0x212e('0x4'));var logger=require(_0x212e('0x5'))(_0x212e('0x6'));var config=require(_0x212e('0x7'));var jayson=require(_0x212e('0x8'));var client=jayson[_0x212e('0x9')][_0x212e('0xa')]({'port':0x232a});config[_0x212e('0xb')]=_[_0x212e('0xc')](config[_0x212e('0xb')],{'host':_0x212e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x212e('0xe'))[_0x212e('0xf')](socket);function respondWithRpcPromise(_0x49f095,_0x191f2c,_0x20d1ba){return new BPromise(function(_0x16a70f,_0x342f8a){return client[_0x212e('0x10')](_0x49f095,_0x20d1ba)[_0x212e('0x11')](function(_0x1fc5f2){logger[_0x212e('0x12')](_0x212e('0x13'),_0x191f2c,'request\x20sent');logger[_0x212e('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x191f2c,_0x212e('0x15'),JSON[_0x212e('0x16')](_0x1fc5f2));if(_0x1fc5f2[_0x212e('0x17')]){if(_0x1fc5f2[_0x212e('0x17')]['code']===0x1f4){logger[_0x212e('0x17')](_0x212e('0x13'),_0x191f2c,_0x1fc5f2['error'][_0x212e('0x18')]);return _0x342f8a(_0x1fc5f2['error'][_0x212e('0x18')]);}logger[_0x212e('0x17')](_0x212e('0x13'),_0x191f2c,_0x1fc5f2[_0x212e('0x17')][_0x212e('0x18')]);return _0x16a70f(_0x1fc5f2[_0x212e('0x17')][_0x212e('0x18')]);}else{logger[_0x212e('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x191f2c,'request\x20sent');_0x16a70f(_0x1fc5f2['result']['message']);}})[_0x212e('0x19')](function(_0x4021f1){logger[_0x212e('0x17')](_0x212e('0x13'),_0x191f2c,_0x4021f1);_0x342f8a(_0x4021f1);});});}exports[_0x212e('0x1a')]=function(_0x5c6fe0){var _0x222502=this;return new Promise(function(_0xc4aa86,_0x472bcb){return db[_0x212e('0x1b')][_0x212e('0x1c')]({'raw':_0x5c6fe0[_0x212e('0x1d')]?_0x5c6fe0[_0x212e('0x1d')][_0x212e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c6fe0[_0x212e('0x1d')]?_0x5c6fe0[_0x212e('0x1d')][_0x212e('0x1f')]||null:null,'attributes':[[db[_0x212e('0x20')]['fn'](_0x212e('0x21'),db[_0x212e('0x20')]['fn']('IF',db[_0x212e('0x20')][_0x212e('0x22')](_0x212e('0x23')))),_0x212e('0x24')]]})[_0x212e('0x11')](function(_0x31d907){logger['info'](_0x212e('0x1a'),_0x5c6fe0);logger[_0x212e('0x14')](_0x212e('0x1a'),_0x5c6fe0,JSON[_0x212e('0x16')](_0x31d907));_0xc4aa86(_0x31d907);})[_0x212e('0x19')](function(_0x5350cd){logger[_0x212e('0x17')]('GetVoiceQueueRtPauses',_0x5350cd[_0x212e('0x18')],_0x5c6fe0);_0x472bcb(_0x222502[_0x212e('0x17')](0x1f4,_0x5350cd[_0x212e('0x18')]));});});}; \ No newline at end of file +var _0x84ff=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','sequelize'];(function(_0x5a21fc,_0x41f83a){var _0x53076d=function(_0x5d86d7){while(--_0x5d86d7){_0x5a21fc['push'](_0x5a21fc['shift']());}};_0x53076d(++_0x41f83a);}(_0x84ff,0x69));var _0xf84f=function(_0x4f2977,_0x139715){_0x4f2977=_0x4f2977-0x0;var _0x175daf=_0x84ff[_0x4f2977];return _0x175daf;};'use strict';var _=require(_0xf84f('0x0'));var util=require('util');var moment=require(_0xf84f('0x1'));var BPromise=require(_0xf84f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf84f('0x3'));var db=require(_0xf84f('0x4'))['db'];var utils=require(_0xf84f('0x5'));var logger=require(_0xf84f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf84f('0x7')][_0xf84f('0x8')]({'port':0x232a});config['redis']=_[_0xf84f('0x9')](config[_0xf84f('0xa')],{'host':_0xf84f('0xb'),'port':0x18eb});var socket=require(_0xf84f('0xc'))(new Redis(config[_0xf84f('0xa')]));require(_0xf84f('0xd'))[_0xf84f('0xe')](socket);function respondWithRpcPromise(_0x3e7b5c,_0x107b64,_0x533547){return new BPromise(function(_0x2becb8,_0x233f08){return client[_0xf84f('0xf')](_0x3e7b5c,_0x533547)[_0xf84f('0x10')](function(_0x2e6ded){logger[_0xf84f('0x11')](_0xf84f('0x12'),_0x107b64,_0xf84f('0x13'));logger[_0xf84f('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x107b64,_0xf84f('0x13'),JSON[_0xf84f('0x15')](_0x2e6ded));if(_0x2e6ded[_0xf84f('0x16')]){if(_0x2e6ded[_0xf84f('0x16')]['code']===0x1f4){logger[_0xf84f('0x16')](_0xf84f('0x12'),_0x107b64,_0x2e6ded[_0xf84f('0x16')][_0xf84f('0x17')]);return _0x233f08(_0x2e6ded[_0xf84f('0x16')][_0xf84f('0x17')]);}logger[_0xf84f('0x16')](_0xf84f('0x12'),_0x107b64,_0x2e6ded[_0xf84f('0x16')][_0xf84f('0x17')]);return _0x2becb8(_0x2e6ded[_0xf84f('0x16')][_0xf84f('0x17')]);}else{logger[_0xf84f('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x107b64,_0xf84f('0x13'));_0x2becb8(_0x2e6ded[_0xf84f('0x18')][_0xf84f('0x17')]);}})[_0xf84f('0x19')](function(_0x3ef3d1){logger['error'](_0xf84f('0x12'),_0x107b64,_0x3ef3d1);_0x233f08(_0x3ef3d1);});});}exports[_0xf84f('0x1a')]=function(_0x134534){var _0x39904a=this;return new Promise(function(_0x411d00,_0x2d514d){return db['UserVoiceQueueRt'][_0xf84f('0x1b')]({'raw':_0x134534['options']?_0x134534[_0xf84f('0x1c')][_0xf84f('0x1d')]===undefined?!![]:![]:!![],'where':_0x134534[_0xf84f('0x1c')]?_0x134534[_0xf84f('0x1c')]['where']||null:null,'attributes':[[db[_0xf84f('0x1e')]['fn'](_0xf84f('0x1f'),db[_0xf84f('0x1e')]['fn']('IF',db['sequelize'][_0xf84f('0x20')](_0xf84f('0x21')))),'outboundQueuePauses']]})['then'](function(_0x4e56df){logger[_0xf84f('0x11')](_0xf84f('0x1a'),_0x134534);logger[_0xf84f('0x14')](_0xf84f('0x1a'),_0x134534,JSON[_0xf84f('0x15')](_0x4e56df));_0x411d00(_0x4e56df);})[_0xf84f('0x19')](function(_0x5181de){logger[_0xf84f('0x16')](_0xf84f('0x1a'),_0x5181de[_0xf84f('0x17')],_0x134534);_0x2d514d(_0x39904a['error'](0x1f4,_0x5181de[_0xf84f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e424a8a..a7ebf76 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 _0x814b=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x814b,0x1a2));var _0xb814=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0x814b[_0x57fcc0];return _0x5270df;};'use strict';var UserVoiceQueueRtEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){UserVoiceQueueRtEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);UserVoiceQueueRtEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x308a=['remove','update','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x3acbf2,_0x55add5){var _0x3211b8=function(_0x1ff59f){while(--_0x1ff59f){_0x3acbf2['push'](_0x3acbf2['shift']());}};_0x3211b8(++_0x55add5);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var UserVoiceQueueRtEvents=require(_0xa308('0x0'));var events=['save',_0xa308('0x1'),_0xa308('0x2')];function createListener(_0x25cba2,_0x844924){return function(_0x599262){_0x844924['emit'](_0x25cba2,_0x599262);};}function removeListener(_0x3a294d,_0x99d71a){return function(){UserVoiceQueueRtEvents[_0xa308('0x3')](_0x3a294d,_0x99d71a);};}exports[_0xa308('0x4')]=function(_0x26d8a4){for(var _0x322331=0x0,_0xc30239=events['length'];_0x322331<_0xc30239;_0x322331++){var _0x5b8a23=events[_0x322331];var _0x2ca45e=createListener(_0xa308('0x5')+_0x5b8a23,_0x26d8a4);UserVoiceQueueRtEvents['on'](_0x5b8a23,_0x2ca45e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d9fd0a5..e34981a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xfb2489,_0x4a2ffe){var _0x1f9dda=function(_0x151fc9){while(--_0x151fc9){_0xfb2489['push'](_0xfb2489['shift']());}};_0x1f9dda(++_0x4a2ffe);}(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x32a28b,_0x36ab3d){var _0x2ead7e=function(_0x170399){while(--_0x170399){_0x32a28b['push'](_0x32a28b['shift']());}};_0x2ead7e(++_0x36ab3d);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 19227cb..8d459fe 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 _0x7ba5=['exports','INTEGER','sequelize'];(function(_0x47c5bd,_0x7605da){var _0x2447dc=function(_0x1d4bff){while(--_0x1d4bff){_0x47c5bd['push'](_0x47c5bd['shift']());}};_0x2447dc(++_0x7605da);}(_0x7ba5,0x185));var _0x57ba=function(_0x579d77,_0x2fcc91){_0x579d77=_0x579d77-0x0;var _0xf9b1b=_0x7ba5[_0x579d77];return _0xf9b1b;};'use strict';var Sequelize=require(_0x57ba('0x0'));module[_0x57ba('0x1')]={'penalty':{'type':Sequelize[_0x57ba('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0043=['exports','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x0043,0x1e5));var _0x3004=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x0043[_0x469a3c];return _0x968f4;};'use strict';var Sequelize=require(_0x3004('0x0'));module[_0x3004('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 8e386af..d971510 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 _0x0ba8=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x17f47a,_0x5c773a){var _0x3d9fc5=function(_0x22b885){while(--_0x22b885){_0x17f47a['push'](_0x17f47a['shift']());}};_0x3d9fc5(++_0x5c773a);}(_0x0ba8,0x159));var _0x80ba=function(_0x2a8319,_0x377fe2){_0x2a8319=_0x2a8319-0x0;var _0x185ae1=_0x0ba8[_0x2a8319];return _0x185ae1;};'use strict';var _=require(_0x80ba('0x0'));var util=require('util');var logger=require(_0x80ba('0x1'))('api');var moment=require(_0x80ba('0x2'));var BPromise=require(_0x80ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80ba('0x4'));var rimraf=require(_0x80ba('0x5'));var config=require(_0x80ba('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x80ba('0x7')]=function(_0x3ba256,_0x4d3555){return _0x3ba256[_0x80ba('0x8')](_0x80ba('0x9'),attributes,{'tableName':_0x80ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x018b=['./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3233e2,_0xc6472d){var _0x302615=function(_0x33106e){while(--_0x33106e){_0x3233e2['push'](_0x3233e2['shift']());}};_0x302615(++_0xc6472d);}(_0x018b,0x19b));var _0xb018=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x018b[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xb018('0x0'));var util=require(_0xb018('0x1'));var logger=require('../../config/logger')(_0xb018('0x2'));var moment=require(_0xb018('0x3'));var BPromise=require(_0xb018('0x4'));var rp=require(_0xb018('0x5'));var fs=require('fs');var path=require(_0xb018('0x6'));var rimraf=require(_0xb018('0x7'));var config=require(_0xb018('0x8'));var attributes=require(_0xb018('0x9'));module['exports']=function(_0x50bc78,_0x429d7a){return _0x50bc78['define'](_0xb018('0xa'),attributes,{'tableName':_0xb018('0xb'),'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 304d0a4..411807f 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 _0xeaa9=['then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x17c8a9,_0x531ca3){var _0x379aa6=function(_0x5ba780){while(--_0x5ba780){_0x17c8a9['push'](_0x17c8a9['shift']());}};_0x379aa6(++_0x531ca3);}(_0xeaa9,0xdd));var _0x9eaa=function(_0x206225,_0x528689){_0x206225=_0x206225-0x0;var _0x2a1c21=_0xeaa9[_0x206225];return _0x2a1c21;};'use strict';var _=require(_0x9eaa('0x0'));var util=require(_0x9eaa('0x1'));var moment=require(_0x9eaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9eaa('0x3'));var db=require(_0x9eaa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9eaa('0x5'))(_0x9eaa('0x6'));var config=require(_0x9eaa('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9eaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d7036,_0x39cc90,_0x461352){return new BPromise(function(_0x1f9929,_0x494dbf){return client[_0x9eaa('0x9')](_0x2d7036,_0x461352)[_0x9eaa('0xa')](function(_0x60ace9){logger[_0x9eaa('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x39cc90,_0x9eaa('0xc'));logger[_0x9eaa('0xd')](_0x9eaa('0xe'),_0x39cc90,_0x9eaa('0xc'),JSON['stringify'](_0x60ace9));if(_0x60ace9[_0x9eaa('0xf')]){if(_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x10')]===0x1f4){logger[_0x9eaa('0xf')](_0x9eaa('0x11'),_0x39cc90,_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x12')]);return _0x494dbf(_0x60ace9['error']['message']);}logger['error'](_0x9eaa('0x11'),_0x39cc90,_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x12')]);return _0x1f9929(_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x12')]);}else{logger[_0x9eaa('0xb')](_0x9eaa('0x11'),_0x39cc90,'request\x20sent');_0x1f9929(_0x60ace9[_0x9eaa('0x13')][_0x9eaa('0x12')]);}})[_0x9eaa('0x14')](function(_0x1c0a2b){logger[_0x9eaa('0xf')](_0x9eaa('0x11'),_0x39cc90,_0x1c0a2b);_0x494dbf(_0x1c0a2b);});});} \ No newline at end of file +var _0xd034=['then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x10840d,_0x95d8eb){var _0x3bc42c=function(_0x3ca01d){while(--_0x3ca01d){_0x10840d['push'](_0x10840d['shift']());}};_0x3bc42c(++_0x95d8eb);}(_0xd034,0xab));var _0x4d03=function(_0x56a37a,_0xffb054){_0x56a37a=_0x56a37a-0x0;var _0x3a57ff=_0xd034[_0x56a37a];return _0x3a57ff;};'use strict';var _=require(_0x4d03('0x0'));var util=require(_0x4d03('0x1'));var moment=require(_0x4d03('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d03('0x3'));var fs=require('fs');var Redis=require(_0x4d03('0x4'));var db=require(_0x4d03('0x5'))['db'];var utils=require(_0x4d03('0x6'));var logger=require(_0x4d03('0x7'))('rpc');var config=require(_0x4d03('0x8'));var jayson=require(_0x4d03('0x9'));var client=jayson[_0x4d03('0xa')][_0x4d03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6f4853,_0x5dd13e,_0x2bd744){return new BPromise(function(_0x58fb03,_0xf71ee4){return client[_0x4d03('0xc')](_0x6f4853,_0x2bd744)[_0x4d03('0xd')](function(_0x491200){logger['info'](_0x4d03('0xe'),_0x5dd13e,_0x4d03('0xf'));logger[_0x4d03('0x10')](_0x4d03('0x11'),_0x5dd13e,'request\x20sent',JSON[_0x4d03('0x12')](_0x491200));if(_0x491200['error']){if(_0x491200[_0x4d03('0x13')][_0x4d03('0x14')]===0x1f4){logger[_0x4d03('0x13')](_0x4d03('0xe'),_0x5dd13e,_0x491200[_0x4d03('0x13')]['message']);return _0xf71ee4(_0x491200['error']['message']);}logger['error'](_0x4d03('0xe'),_0x5dd13e,_0x491200['error']['message']);return _0x58fb03(_0x491200[_0x4d03('0x13')][_0x4d03('0x15')]);}else{logger['info'](_0x4d03('0xe'),_0x5dd13e,_0x4d03('0xf'));_0x58fb03(_0x491200['result']['message']);}})[_0x4d03('0x16')](function(_0x100b5b){logger['error'](_0x4d03('0xe'),_0x5dd13e,_0x100b5b);_0xf71ee4(_0x100b5b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f024412..082563e 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 _0xbed7=['isAuthenticated','index','show','create','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0xf29f71,_0x277924){var _0xf1825a=function(_0x2ef0e3){while(--_0x2ef0e3){_0xf29f71['push'](_0xf29f71['shift']());}};_0xf1825a(++_0x277924);}(_0xbed7,0x14b));var _0x7bed=function(_0x1229bd,_0x5cd775){_0x1229bd=_0x1229bd-0x0;var _0x3fd218=_0xbed7[_0x1229bd];return _0x3fd218;};'use strict';var multer=require(_0x7bed('0x0'));var util=require(_0x7bed('0x1'));var path=require(_0x7bed('0x2'));var timeout=require(_0x7bed('0x3'));var express=require(_0x7bed('0x4'));var router=express['Router']();var fs_extra=require(_0x7bed('0x5'));var auth=require(_0x7bed('0x6'));var interaction=require(_0x7bed('0x7'));var config=require(_0x7bed('0x8'));var controller=require(_0x7bed('0x9'));router[_0x7bed('0xa')]('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0xc')]);router[_0x7bed('0xa')]('/:id',auth[_0x7bed('0xb')](),controller[_0x7bed('0xd')]);router['post']('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0xe')]);router['put'](_0x7bed('0xf'),auth[_0x7bed('0xb')](),controller['update']);router[_0x7bed('0x10')](_0x7bed('0xf'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe13e=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','create','put','delete'];(function(_0x475fd2,_0x41e627){var _0xf8a770=function(_0x2086e2){while(--_0x2086e2){_0x475fd2['push'](_0x475fd2['shift']());}};_0xf8a770(++_0x41e627);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee13('0x0'));var timeout=require(_0xee13('0x1'));var express=require(_0xee13('0x2'));var router=express[_0xee13('0x3')]();var fs_extra=require(_0xee13('0x4'));var auth=require(_0xee13('0x5'));var interaction=require(_0xee13('0x6'));var config=require(_0xee13('0x7'));var controller=require(_0xee13('0x8'));router[_0xee13('0x9')]('/',auth[_0xee13('0xa')](),controller['index']);router[_0xee13('0x9')](_0xee13('0xb'),auth[_0xee13('0xa')](),controller[_0xee13('0xc')]);router['post']('/',auth[_0xee13('0xa')](),controller[_0xee13('0xd')]);router[_0xee13('0xe')](_0xee13('0xb'),auth[_0xee13('0xa')](),controller['update']);router[_0xee13('0xf')](_0xee13('0xb'),auth['isAuthenticated'](),controller[_0xee13('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3fa8c6a..903184f 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 _0xd011=['sequelize','STRING'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xd011,0x156));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1d01('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d01('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d01('0x1')]}}; \ No newline at end of file +var _0xe157=['sequelize','exports','STRING','name'];(function(_0x4c1046,_0x2309b8){var _0x347bb0=function(_0xafbd20){while(--_0xafbd20){_0x4c1046['push'](_0x4c1046['shift']());}};_0x347bb0(++_0x2309b8);}(_0xe157,0x13c));var _0x7e15=function(_0x563a4d,_0x414a7f){_0x563a4d=_0x563a4d-0x0;var _0x229b32=_0xe157[_0x563a4d];return _0x229b32;};'use strict';var Sequelize=require(_0x7e15('0x0'));module[_0x7e15('0x1')]={'name':{'type':Sequelize[_0x7e15('0x2')],'unique':_0x7e15('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 856c384..faf40ef 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 _0x3269=['error','name','send','index','map','Variable','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','keys','include','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','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0x3269,0x1c6));var _0x9326=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3269[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9326('0x0'));var rimraf=require(_0x9326('0x1'));var zipdir=require(_0x9326('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9326('0x3'));var moment=require(_0x9326('0x4'));var BPromise=require(_0x9326('0x5'));var Mustache=require(_0x9326('0x6'));var util=require(_0x9326('0x7'));var path=require(_0x9326('0x8'));var sox=require(_0x9326('0x9'));var csv=require(_0x9326('0xa'));var ejs=require(_0x9326('0xb'));var fs=require('fs');var fs_extra=require(_0x9326('0xc'));var _=require(_0x9326('0xd'));var squel=require('squel');var crypto=require(_0x9326('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9326('0xf'));var toCsv=require(_0x9326('0xa'));var querystring=require(_0x9326('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9326('0x11'));var qs=require(_0x9326('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9326('0x13'));var logger=require(_0x9326('0x14'))(_0x9326('0x15'));var utils=require('../../config/utils');var config=require(_0x9326('0x16'));var licenseUtil=require(_0x9326('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd5fe,_0x53a3eb){_0x53a3eb=_0x53a3eb||0xcc;return function(_0x129080){if(_0x129080){return _0x3fd5fe[_0x9326('0x18')](_0x53a3eb);}return _0x3fd5fe[_0x9326('0x19')](_0x53a3eb)['end']();};}function respondWithResult(_0x2230a5,_0x298134){_0x298134=_0x298134||0xc8;return function(_0xdfaac1){if(_0xdfaac1){return _0x2230a5['status'](_0x298134)[_0x9326('0x1a')](_0xdfaac1);}};}function respondWithFilteredResult(_0x53cb3b,_0x33e869){return function(_0x2da4ef){if(_0x2da4ef){var _0x5b6dbd=typeof _0x33e869[_0x9326('0x1b')]===_0x9326('0x1c')&&typeof _0x33e869[_0x9326('0x1d')]===_0x9326('0x1c');var _0xee2a8c=_0x2da4ef[_0x9326('0x1e')];var _0x341adc=_0x5b6dbd?0x0:_0x33e869[_0x9326('0x1b')];var _0x14b08f=_0x5b6dbd?_0x2da4ef[_0x9326('0x1e')]:_0x33e869[_0x9326('0x1b')]+_0x33e869[_0x9326('0x1d')];var _0x508982;if(_0x14b08f>=_0xee2a8c){_0x14b08f=_0xee2a8c;_0x508982=0xc8;}else{_0x508982=0xce;}_0x53cb3b[_0x9326('0x19')](_0x508982);return _0x53cb3b[_0x9326('0x1f')](_0x9326('0x20'),_0x341adc+'-'+_0x14b08f+'/'+_0xee2a8c)[_0x9326('0x1a')](_0x2da4ef);}return null;};}function patchUpdates(_0x122666){return function(_0x26fe14){try{jsonpatch['apply'](_0x26fe14,_0x122666,!![]);}catch(_0x42d785){return BPromise[_0x9326('0x21')](_0x42d785);}return _0x26fe14['save']();};}function saveUpdates(_0x421b45,_0x4c5ec5){return function(_0x17e82f){if(_0x17e82f){return _0x17e82f[_0x9326('0x22')](_0x421b45)[_0x9326('0x23')](function(_0x2e0746){return _0x2e0746;});}return null;};}function removeEntity(_0x2619fd,_0x628547){return function(_0x15e52d){if(_0x15e52d){return _0x15e52d['destroy']()[_0x9326('0x23')](function(){var _0x22c569=_0x15e52d['get']({'plain':!![]});var _0x7fd179='Variables';return db['UserProfileResource'][_0x9326('0x24')]({'where':{'type':_0x7fd179,'resourceId':_0x22c569['id']}})[_0x9326('0x23')](function(){return _0x15e52d;});})[_0x9326('0x23')](function(){_0x2619fd['status'](0xcc)[_0x9326('0x25')]();});}};}function handleEntityNotFound(_0x4f803a,_0x31ee23){return function(_0x3b9bab){if(!_0x3b9bab){_0x4f803a[_0x9326('0x18')](0x194);}return _0x3b9bab;};}function handleError(_0x4e0177,_0x1917d6){_0x1917d6=_0x1917d6||0x1f4;return function(_0x42c433){logger[_0x9326('0x26')](_0x42c433['stack']);if(_0x42c433[_0x9326('0x27')]){delete _0x42c433[_0x9326('0x27')];}_0x4e0177['status'](_0x1917d6)[_0x9326('0x28')](_0x42c433);};}exports[_0x9326('0x29')]=function(_0x283ea2,_0x38f0e0){var _0x52bfa9={},_0x599228={},_0x42810a={'count':0x0,'rows':[]};var _0x2b1118=_[_0x9326('0x2a')](db[_0x9326('0x2b')]['rawAttributes'],function(_0x52d386){return{'name':_0x52d386[_0x9326('0x2c')],'type':_0x52d386[_0x9326('0x2d')][_0x9326('0x2e')]};});_0x599228[_0x9326('0x2f')]=_[_0x9326('0x2a')](_0x2b1118,_0x9326('0x27'));_0x599228[_0x9326('0x30')]=_['keys'](_0x283ea2['query']);_0x599228[_0x9326('0x31')]=_[_0x9326('0x32')](_0x599228[_0x9326('0x2f')],_0x599228[_0x9326('0x30')]);_0x52bfa9[_0x9326('0x33')]=_['intersection'](_0x599228['model'],qs[_0x9326('0x34')](_0x283ea2[_0x9326('0x30')][_0x9326('0x34')]));_0x52bfa9[_0x9326('0x33')]=_0x52bfa9[_0x9326('0x33')]['length']?_0x52bfa9[_0x9326('0x33')]:_0x599228['model'];if(!_0x283ea2['query'][_0x9326('0x35')](_0x9326('0x36'))){_0x52bfa9[_0x9326('0x1d')]=qs[_0x9326('0x1d')](_0x283ea2[_0x9326('0x30')][_0x9326('0x1d')]);_0x52bfa9['offset']=qs['offset'](_0x283ea2[_0x9326('0x30')][_0x9326('0x1b')]);}_0x52bfa9[_0x9326('0x37')]=qs[_0x9326('0x38')](_0x283ea2[_0x9326('0x30')][_0x9326('0x38')]);_0x52bfa9[_0x9326('0x39')]=qs[_0x9326('0x31')](_[_0x9326('0x3a')](_0x283ea2[_0x9326('0x30')],_0x599228[_0x9326('0x31')]),_0x2b1118);if(_0x283ea2[_0x9326('0x30')][_0x9326('0x3b')]){_0x52bfa9[_0x9326('0x39')]=_[_0x9326('0x3c')](_0x52bfa9[_0x9326('0x39')],{'$or':_[_0x9326('0x2a')](_0x2b1118,function(_0x502c23){if(_0x502c23[_0x9326('0x2d')]!==_0x9326('0x3d')){var _0x5bd60d={};_0x5bd60d[_0x502c23['name']]={'$like':'%'+_0x283ea2[_0x9326('0x30')][_0x9326('0x3b')]+'%'};return _0x5bd60d;}})});}_0x52bfa9=_[_0x9326('0x3c')]({},_0x52bfa9,_0x283ea2[_0x9326('0x3e')]);var _0x5482a9={'where':_0x52bfa9[_0x9326('0x39')]};return db[_0x9326('0x2b')][_0x9326('0x1e')](_0x5482a9)[_0x9326('0x23')](function(_0x5c8dbf){_0x42810a[_0x9326('0x1e')]=_0x5c8dbf;if(_0x283ea2[_0x9326('0x30')]['includeAll']){_0x52bfa9['include']=[{'all':!![]}];}return db['Variable'][_0x9326('0x3f')](_0x52bfa9);})['then'](function(_0x14817a){_0x42810a[_0x9326('0x40')]=_0x14817a;return _0x42810a;})[_0x9326('0x23')](respondWithFilteredResult(_0x38f0e0,_0x52bfa9))[_0x9326('0x41')](handleError(_0x38f0e0,null));};exports[_0x9326('0x42')]=function(_0x2d58c0,_0xe2112d){var _0xface38={'raw':!![],'where':{'id':_0x2d58c0[_0x9326('0x43')]['id']}},_0x2562cf={};_0x2562cf[_0x9326('0x2f')]=_['keys'](db['Variable'][_0x9326('0x44')]);_0x2562cf[_0x9326('0x30')]=_[_0x9326('0x45')](_0x2d58c0[_0x9326('0x30')]);_0x2562cf[_0x9326('0x31')]=_[_0x9326('0x32')](_0x2562cf[_0x9326('0x2f')],_0x2562cf[_0x9326('0x30')]);_0xface38['attributes']=_[_0x9326('0x32')](_0x2562cf['model'],qs[_0x9326('0x34')](_0x2d58c0[_0x9326('0x30')][_0x9326('0x34')]));_0xface38['attributes']=_0xface38['attributes']['length']?_0xface38[_0x9326('0x33')]:_0x2562cf['model'];if(_0x2d58c0[_0x9326('0x30')]['includeAll']){_0xface38[_0x9326('0x46')]=[{'all':!![]}];}_0xface38=_[_0x9326('0x3c')]({},_0xface38,_0x2d58c0[_0x9326('0x3e')]);return db[_0x9326('0x2b')][_0x9326('0x47')](_0xface38)[_0x9326('0x23')](handleEntityNotFound(_0xe2112d,null))['then'](respondWithResult(_0xe2112d,null))[_0x9326('0x41')](handleError(_0xe2112d,null));};exports[_0x9326('0x48')]=function(_0x671c46,_0x2fc13d){return db[_0x9326('0x2b')][_0x9326('0x48')](_0x671c46[_0x9326('0x49')],{})[_0x9326('0x23')](function(_0x36f8a5){var _0x48cf77=_0x671c46[_0x9326('0x4a')][_0x9326('0x4b')]({'plain':!![]});if(!_0x48cf77)throw new Error(_0x9326('0x4c'));if(_0x48cf77[_0x9326('0x4d')]===_0x9326('0x4a')){var _0x1e4cd8=_0x36f8a5[_0x9326('0x4b')]({'plain':!![]});var _0x4a6200='Variables';return db[_0x9326('0x4e')]['find']({'where':{'name':_0x4a6200,'userProfileId':_0x48cf77[_0x9326('0x4f')]},'raw':!![]})[_0x9326('0x23')](function(_0x5e09a7){if(_0x5e09a7&&_0x5e09a7[_0x9326('0x50')]===0x0){return db['UserProfileResource'][_0x9326('0x48')]({'name':_0x1e4cd8[_0x9326('0x27')],'resourceId':_0x1e4cd8['id'],'type':_0x5e09a7[_0x9326('0x27')],'sectionId':_0x5e09a7['id']},{})['then'](function(){return _0x36f8a5;});}else{return _0x36f8a5;}})['catch'](function(_0x1c1659){logger[_0x9326('0x26')](_0x9326('0x51'),_0x1c1659);throw _0x1c1659;});}return _0x36f8a5;})[_0x9326('0x23')](respondWithResult(_0x2fc13d,0xc9))[_0x9326('0x41')](handleError(_0x2fc13d,null));};exports[_0x9326('0x22')]=function(_0x458e86,_0x75f900){if(_0x458e86['body']['id']){delete _0x458e86[_0x9326('0x49')]['id'];}return db[_0x9326('0x2b')][_0x9326('0x47')]({'where':{'id':_0x458e86[_0x9326('0x43')]['id']}})['then'](handleEntityNotFound(_0x75f900,null))[_0x9326('0x23')](saveUpdates(_0x458e86[_0x9326('0x49')],null))[_0x9326('0x23')](respondWithResult(_0x75f900,null))['catch'](handleError(_0x75f900,null));};exports[_0x9326('0x24')]=function(_0x1a22f7,_0x2514a8){return db[_0x9326('0x2b')][_0x9326('0x47')]({'where':{'id':_0x1a22f7['params']['id']}})['then'](handleEntityNotFound(_0x2514a8,null))[_0x9326('0x23')](removeEntity(_0x2514a8,null))[_0x9326('0x41')](handleError(_0x2514a8,null));}; \ No newline at end of file +var _0xb3f8=['zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','map','Variable','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf'];(function(_0x529938,_0x44675c){var _0x33edf6=function(_0x1c78bf){while(--_0x1c78bf){_0x529938['push'](_0x529938['shift']());}};_0x33edf6(++_0x44675c);}(_0xb3f8,0x1f1));var _0x8b3f=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb3f8[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b3f('0x0'));var zipdir=require(_0x8b3f('0x1'));var jsonpatch=require(_0x8b3f('0x2'));var rp=require('request-promise');var moment=require(_0x8b3f('0x3'));var BPromise=require(_0x8b3f('0x4'));var Mustache=require(_0x8b3f('0x5'));var util=require(_0x8b3f('0x6'));var path=require(_0x8b3f('0x7'));var sox=require(_0x8b3f('0x8'));var csv=require(_0x8b3f('0x9'));var ejs=require(_0x8b3f('0xa'));var fs=require('fs');var fs_extra=require(_0x8b3f('0xb'));var _=require(_0x8b3f('0xc'));var squel=require(_0x8b3f('0xd'));var crypto=require(_0x8b3f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8b3f('0xf'));var toCsv=require(_0x8b3f('0x9'));var querystring=require(_0x8b3f('0x10'));var Papa=require(_0x8b3f('0x11'));var Redis=require('ioredis');var authService=require(_0x8b3f('0x12'));var qs=require(_0x8b3f('0x13'));var as=require(_0x8b3f('0x14'));var hardwareService=require(_0x8b3f('0x15'));var logger=require(_0x8b3f('0x16'))(_0x8b3f('0x17'));var utils=require(_0x8b3f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8b3f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2983e,_0xb13514){_0xb13514=_0xb13514||0xcc;return function(_0x19a1f2){if(_0x19a1f2){return _0x2983e[_0x8b3f('0x1a')](_0xb13514);}return _0x2983e[_0x8b3f('0x1b')](_0xb13514)[_0x8b3f('0x1c')]();};}function respondWithResult(_0x473c8c,_0x2ea4ba){_0x2ea4ba=_0x2ea4ba||0xc8;return function(_0x1999ba){if(_0x1999ba){return _0x473c8c[_0x8b3f('0x1b')](_0x2ea4ba)[_0x8b3f('0x1d')](_0x1999ba);}};}function respondWithFilteredResult(_0x4d19e9,_0x8ea651){return function(_0x501b7b){if(_0x501b7b){var _0x2dfe32=typeof _0x8ea651[_0x8b3f('0x1e')]==='undefined'&&typeof _0x8ea651[_0x8b3f('0x1f')]===_0x8b3f('0x20');var _0x3b88de=_0x501b7b[_0x8b3f('0x21')];var _0x502a38=_0x2dfe32?0x0:_0x8ea651[_0x8b3f('0x1e')];var _0xfdd0e7=_0x2dfe32?_0x501b7b[_0x8b3f('0x21')]:_0x8ea651[_0x8b3f('0x1e')]+_0x8ea651[_0x8b3f('0x1f')];var _0x3d6acc;if(_0xfdd0e7>=_0x3b88de){_0xfdd0e7=_0x3b88de;_0x3d6acc=0xc8;}else{_0x3d6acc=0xce;}_0x4d19e9['status'](_0x3d6acc);return _0x4d19e9[_0x8b3f('0x22')]('Content-Range',_0x502a38+'-'+_0xfdd0e7+'/'+_0x3b88de)['json'](_0x501b7b);}return null;};}function patchUpdates(_0x221986){return function(_0x5b49b2){try{jsonpatch[_0x8b3f('0x23')](_0x5b49b2,_0x221986,!![]);}catch(_0x1eb713){return BPromise['reject'](_0x1eb713);}return _0x5b49b2['save']();};}function saveUpdates(_0x456880,_0x3731b3){return function(_0x1cf8fe){if(_0x1cf8fe){return _0x1cf8fe[_0x8b3f('0x24')](_0x456880)['then'](function(_0x4680d2){return _0x4680d2;});}return null;};}function removeEntity(_0x339385,_0x67184f){return function(_0x11116c){if(_0x11116c){return _0x11116c[_0x8b3f('0x25')]()[_0x8b3f('0x26')](function(){var _0x5c8006=_0x11116c[_0x8b3f('0x27')]({'plain':!![]});var _0x110fe2=_0x8b3f('0x28');return db[_0x8b3f('0x29')]['destroy']({'where':{'type':_0x110fe2,'resourceId':_0x5c8006['id']}})['then'](function(){return _0x11116c;});})[_0x8b3f('0x26')](function(){_0x339385[_0x8b3f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e0e8,_0x1f7c75){return function(_0x13cb9d){if(!_0x13cb9d){_0x13e0e8['sendStatus'](0x194);}return _0x13cb9d;};}function handleError(_0x588ed0,_0x5c05ef){_0x5c05ef=_0x5c05ef||0x1f4;return function(_0x3b8b40){logger[_0x8b3f('0x2a')](_0x3b8b40[_0x8b3f('0x2b')]);if(_0x3b8b40[_0x8b3f('0x2c')]){delete _0x3b8b40['name'];}_0x588ed0[_0x8b3f('0x1b')](_0x5c05ef)[_0x8b3f('0x2d')](_0x3b8b40);};}exports['index']=function(_0x55e99e,_0x12ff83){var _0x3eccb1={},_0x38a618={},_0xbd9851={'count':0x0,'rows':[]};var _0x4a0b8d=_[_0x8b3f('0x2e')](db[_0x8b3f('0x2f')][_0x8b3f('0x30')],function(_0x552ac4){return{'name':_0x552ac4[_0x8b3f('0x31')],'type':_0x552ac4[_0x8b3f('0x32')]['key']};});_0x38a618[_0x8b3f('0x33')]=_['map'](_0x4a0b8d,_0x8b3f('0x2c'));_0x38a618['query']=_[_0x8b3f('0x34')](_0x55e99e[_0x8b3f('0x35')]);_0x38a618['filters']=_[_0x8b3f('0x36')](_0x38a618[_0x8b3f('0x33')],_0x38a618[_0x8b3f('0x35')]);_0x3eccb1[_0x8b3f('0x37')]=_['intersection'](_0x38a618[_0x8b3f('0x33')],qs[_0x8b3f('0x38')](_0x55e99e['query'][_0x8b3f('0x38')]));_0x3eccb1['attributes']=_0x3eccb1[_0x8b3f('0x37')][_0x8b3f('0x39')]?_0x3eccb1[_0x8b3f('0x37')]:_0x38a618[_0x8b3f('0x33')];if(!_0x55e99e['query'][_0x8b3f('0x3a')]('nolimit')){_0x3eccb1[_0x8b3f('0x1f')]=qs['limit'](_0x55e99e[_0x8b3f('0x35')][_0x8b3f('0x1f')]);_0x3eccb1['offset']=qs[_0x8b3f('0x1e')](_0x55e99e[_0x8b3f('0x35')][_0x8b3f('0x1e')]);}_0x3eccb1[_0x8b3f('0x3b')]=qs[_0x8b3f('0x3c')](_0x55e99e[_0x8b3f('0x35')][_0x8b3f('0x3c')]);_0x3eccb1[_0x8b3f('0x3d')]=qs[_0x8b3f('0x3e')](_[_0x8b3f('0x3f')](_0x55e99e[_0x8b3f('0x35')],_0x38a618[_0x8b3f('0x3e')]),_0x4a0b8d);if(_0x55e99e[_0x8b3f('0x35')]['filter']){_0x3eccb1['where']=_['merge'](_0x3eccb1[_0x8b3f('0x3d')],{'$or':_[_0x8b3f('0x2e')](_0x4a0b8d,function(_0x5a70ca){if(_0x5a70ca[_0x8b3f('0x32')]!==_0x8b3f('0x40')){var _0x344c41={};_0x344c41[_0x5a70ca[_0x8b3f('0x2c')]]={'$like':'%'+_0x55e99e['query']['filter']+'%'};return _0x344c41;}})});}_0x3eccb1=_[_0x8b3f('0x41')]({},_0x3eccb1,_0x55e99e[_0x8b3f('0x42')]);var _0x530dc2={'where':_0x3eccb1[_0x8b3f('0x3d')]};return db[_0x8b3f('0x2f')][_0x8b3f('0x21')](_0x530dc2)['then'](function(_0x8cf1e2){_0xbd9851[_0x8b3f('0x21')]=_0x8cf1e2;if(_0x55e99e['query'][_0x8b3f('0x43')]){_0x3eccb1[_0x8b3f('0x44')]=[{'all':!![]}];}return db['Variable'][_0x8b3f('0x45')](_0x3eccb1);})[_0x8b3f('0x26')](function(_0x5c5131){_0xbd9851[_0x8b3f('0x46')]=_0x5c5131;return _0xbd9851;})[_0x8b3f('0x26')](respondWithFilteredResult(_0x12ff83,_0x3eccb1))['catch'](handleError(_0x12ff83,null));};exports[_0x8b3f('0x47')]=function(_0x1095af,_0x29ad17){var _0x5f494c={'raw':!![],'where':{'id':_0x1095af[_0x8b3f('0x48')]['id']}},_0x148599={};_0x148599[_0x8b3f('0x33')]=_[_0x8b3f('0x34')](db[_0x8b3f('0x2f')][_0x8b3f('0x30')]);_0x148599[_0x8b3f('0x35')]=_[_0x8b3f('0x34')](_0x1095af['query']);_0x148599[_0x8b3f('0x3e')]=_[_0x8b3f('0x36')](_0x148599[_0x8b3f('0x33')],_0x148599[_0x8b3f('0x35')]);_0x5f494c[_0x8b3f('0x37')]=_[_0x8b3f('0x36')](_0x148599[_0x8b3f('0x33')],qs[_0x8b3f('0x38')](_0x1095af[_0x8b3f('0x35')][_0x8b3f('0x38')]));_0x5f494c[_0x8b3f('0x37')]=_0x5f494c[_0x8b3f('0x37')][_0x8b3f('0x39')]?_0x5f494c[_0x8b3f('0x37')]:_0x148599[_0x8b3f('0x33')];if(_0x1095af[_0x8b3f('0x35')][_0x8b3f('0x43')]){_0x5f494c[_0x8b3f('0x44')]=[{'all':!![]}];}_0x5f494c=_[_0x8b3f('0x41')]({},_0x5f494c,_0x1095af[_0x8b3f('0x42')]);return db[_0x8b3f('0x2f')]['find'](_0x5f494c)[_0x8b3f('0x26')](handleEntityNotFound(_0x29ad17,null))[_0x8b3f('0x26')](respondWithResult(_0x29ad17,null))['catch'](handleError(_0x29ad17,null));};exports['create']=function(_0x192b80,_0x153b41){return db[_0x8b3f('0x2f')][_0x8b3f('0x49')](_0x192b80['body'],{})[_0x8b3f('0x26')](function(_0x45b52f){var _0xb5c43a=_0x192b80[_0x8b3f('0x4a')][_0x8b3f('0x27')]({'plain':!![]});if(!_0xb5c43a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb5c43a[_0x8b3f('0x4b')]===_0x8b3f('0x4a')){var _0x3d9b21=_0x45b52f[_0x8b3f('0x27')]({'plain':!![]});var _0x4cffa9=_0x8b3f('0x28');return db[_0x8b3f('0x4c')][_0x8b3f('0x4d')]({'where':{'name':_0x4cffa9,'userProfileId':_0xb5c43a[_0x8b3f('0x4e')]},'raw':!![]})[_0x8b3f('0x26')](function(_0x3c6695){if(_0x3c6695&&_0x3c6695[_0x8b3f('0x4f')]===0x0){return db[_0x8b3f('0x29')]['create']({'name':_0x3d9b21['name'],'resourceId':_0x3d9b21['id'],'type':_0x3c6695[_0x8b3f('0x2c')],'sectionId':_0x3c6695['id']},{})[_0x8b3f('0x26')](function(){return _0x45b52f;});}else{return _0x45b52f;}})[_0x8b3f('0x50')](function(_0x18f647){logger[_0x8b3f('0x2a')](_0x8b3f('0x51'),_0x18f647);throw _0x18f647;});}return _0x45b52f;})[_0x8b3f('0x26')](respondWithResult(_0x153b41,0xc9))[_0x8b3f('0x50')](handleError(_0x153b41,null));};exports[_0x8b3f('0x24')]=function(_0x61a1d0,_0x10609b){if(_0x61a1d0[_0x8b3f('0x52')]['id']){delete _0x61a1d0[_0x8b3f('0x52')]['id'];}return db[_0x8b3f('0x2f')][_0x8b3f('0x4d')]({'where':{'id':_0x61a1d0[_0x8b3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x10609b,null))[_0x8b3f('0x26')](saveUpdates(_0x61a1d0['body'],null))[_0x8b3f('0x26')](respondWithResult(_0x10609b,null))[_0x8b3f('0x50')](handleError(_0x10609b,null));};exports[_0x8b3f('0x25')]=function(_0x3eb0e3,_0x2cf4ef){return db['Variable'][_0x8b3f('0x4d')]({'where':{'id':_0x3eb0e3[_0x8b3f('0x48')]['id']}})[_0x8b3f('0x26')](handleEntityNotFound(_0x2cf4ef,null))[_0x8b3f('0x26')](removeEntity(_0x2cf4ef,null))[_0x8b3f('0x50')](handleError(_0x2cf4ef,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c281ea8..d24da54 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 _0x84af=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./variable.attributes','exports','define','tools_variables','lodash'];(function(_0x12f614,_0x3d7d91){var _0x3f449e=function(_0x54b58b){while(--_0x54b58b){_0x12f614['push'](_0x12f614['shift']());}};_0x3f449e(++_0x3d7d91);}(_0x84af,0x1e3));var _0xf84a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x84af[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xf84a('0x0'));var util=require(_0xf84a('0x1'));var logger=require(_0xf84a('0x2'))('api');var moment=require(_0xf84a('0x3'));var BPromise=require(_0xf84a('0x4'));var rp=require(_0xf84a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf84a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf84a('0x7'));module[_0xf84a('0x8')]=function(_0xea5994,_0x24ef4a){return _0xea5994[_0xf84a('0x9')]('Variable',attributes,{'tableName':_0xf84a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89c4=['../../config/environment','./variable.attributes','exports','define','tools_variables','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5b0945,_0x1cc164){var _0x228332=function(_0x5c3cd1){while(--_0x5c3cd1){_0x5b0945['push'](_0x5b0945['shift']());}};_0x228332(++_0x1cc164);}(_0x89c4,0xc3));var _0x489c=function(_0x8d1086,_0x3de6fe){_0x8d1086=_0x8d1086-0x0;var _0x74b82a=_0x89c4[_0x8d1086];return _0x74b82a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x489c('0x0'))('api');var moment=require(_0x489c('0x1'));var BPromise=require(_0x489c('0x2'));var rp=require(_0x489c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x489c('0x4'));var config=require(_0x489c('0x5'));var attributes=require(_0x489c('0x6'));module[_0x489c('0x7')]=function(_0x1e6f48,_0x7f58b5){return _0x1e6f48[_0x489c('0x8')]('Variable',attributes,{'tableName':_0x489c('0x9'),'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 70706aa..a9ea188 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x5f03f4,_0x71be0){var _0x3a4d47=function(_0x48830b){while(--_0x48830b){_0x5f03f4['push'](_0x5f03f4['shift']());}};_0x3a4d47(++_0x71be0);}(_0x6aa7,0x178));var _0x76aa=function(_0x1fe732,_0x2b1865){_0x1fe732=_0x1fe732-0x0;var _0xd7d13f=_0x6aa7[_0x1fe732];return _0xd7d13f;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x5efb3c,_0x852a5a){var _0x349be3=function(_0x44b9de){while(--_0x44b9de){_0x5efb3c['push'](_0x5efb3c['shift']());}};_0x349be3(++_0x852a5a);}(_0x3e74,0x175));var _0x43e7=function(_0x4ae963,_0x38ef3a){_0x4ae963=_0x4ae963-0x0;var _0x2dceb1=_0x3e74[_0x4ae963];return _0x2dceb1;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 01eedfa..7ce8715 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 _0xf065=['/reset','isAuthenticated','/pull','pull','restart','migrations','exports','express','../../components/auth/service','./version.controller','get','canUpdate','fetch'];(function(_0x54b1f7,_0x4d9d09){var _0x4b9391=function(_0x29518a){while(--_0x29518a){_0x54b1f7['push'](_0x54b1f7['shift']());}};_0x4b9391(++_0x4d9d09);}(_0xf065,0x18d));var _0x5f06=function(_0x48774f,_0x3fd771){_0x48774f=_0x48774f-0x0;var _0x4d5ef2=_0xf065[_0x48774f];return _0x4d5ef2;};'use strict';var express=require(_0x5f06('0x0'));var router=express['Router']();var auth=require(_0x5f06('0x1'));var controller=require(_0x5f06('0x2'));router[_0x5f06('0x3')]('/',controller['index']);router['get']('/fetch',auth['isAuthenticated'](),auth[_0x5f06('0x4')](),controller[_0x5f06('0x5')]);router['get'](_0x5f06('0x6'),auth[_0x5f06('0x7')](),auth[_0x5f06('0x4')](),controller['reset']);router['get'](_0x5f06('0x8'),auth[_0x5f06('0x7')](),auth[_0x5f06('0x4')](),controller[_0x5f06('0x9')]);router['get']('/restart',auth[_0x5f06('0x7')](),controller[_0x5f06('0xa')]);router[_0x5f06('0x3')]('/migrations',controller[_0x5f06('0xb')]);module[_0x5f06('0xc')]=router; \ No newline at end of file +var _0x6f05=['isAuthenticated','canUpdate','reset','/pull','pull','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x6f05,0x78));var _0x56f0=function(_0x45ba8a,_0x5ec992){_0x45ba8a=_0x45ba8a-0x0;var _0x2c7082=_0x6f05[_0x45ba8a];return _0x2c7082;};'use strict';var express=require('express');var router=express[_0x56f0('0x0')]();var auth=require(_0x56f0('0x1'));var controller=require(_0x56f0('0x2'));router[_0x56f0('0x3')]('/',controller[_0x56f0('0x4')]);router[_0x56f0('0x3')](_0x56f0('0x5'),auth[_0x56f0('0x6')](),auth[_0x56f0('0x7')](),controller['fetch']);router[_0x56f0('0x3')]('/reset',auth[_0x56f0('0x6')](),auth[_0x56f0('0x7')](),controller[_0x56f0('0x8')]);router[_0x56f0('0x3')](_0x56f0('0x9'),auth[_0x56f0('0x6')](),auth[_0x56f0('0x7')](),controller[_0x56f0('0xa')]);router['get']('/restart',auth[_0x56f0('0x6')](),controller['restart']);router[_0x56f0('0x3')](_0x56f0('0xb'),controller[_0x56f0('0xc')]);module[_0x56f0('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index d701d9d..24e622c 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 _0x0b99=['FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','sort','Migration','sequelize','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','version','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','fetch','tags','latest','2.0.0','status','json','error','info','git\x20fetch','reset','--hard'];(function(_0x2fc30a,_0x349fbd){var _0x5cad21=function(_0xbca2f7){while(--_0xbca2f7){_0x2fc30a['push'](_0x2fc30a['shift']());}};_0x5cad21(++_0x349fbd);}(_0x0b99,0xde));var _0x90b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b99[_0x14add3];return _0x4a174f;};'use strict';var Umzug=require(_0x90b9('0x0'));var path=require(_0x90b9('0x1'));var fs=require('fs');var _=require(_0x90b9('0x2'));var pkginfo=require('pkginfo')(module,_0x90b9('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x90b9('0x4'));var pm2=require(_0x90b9('0x5'));var logger=require(_0x90b9('0x6'))(_0x90b9('0x7'));var git=require(_0x90b9('0x8'))(config['root']);exports[_0x90b9('0x9')]=function(_0x1280c9,_0x308c33){var _0x12957d={'current':module[_0x90b9('0xa')][_0x90b9('0x3')],'phonebar':0x2};if(_0x1280c9[_0x90b9('0xb')]&&_0x1280c9[_0x90b9('0xb')]['latest']){return git[_0x90b9('0xc')]()[_0x90b9('0xd')](function(_0x2532a5,_0x1fc76c){_0x12957d['latest']=(_0x2532a5?module[_0x90b9('0xa')][_0x90b9('0x3')]:_0x1fc76c[_0x90b9('0xe')])||_0x90b9('0xf');return _0x308c33[_0x90b9('0x10')](0xc8)['json'](_0x12957d);});}else{return _0x308c33['status'](0xc8)[_0x90b9('0x11')](_0x12957d);}};exports[_0x90b9('0xc')]=function(_0x33edb6,_0x1fa0a4){return git[_0x90b9('0xc')](['origin','master'],function(_0xaca3a1){if(_0xaca3a1){logger[_0x90b9('0x12')](_0xaca3a1);return _0x1fa0a4[_0x90b9('0x10')](0x1f4)[_0x90b9('0x11')](_0xaca3a1);}logger[_0x90b9('0x13')](_0x90b9('0x14'));return _0x1fa0a4[_0x90b9('0x10')](0xc8)[_0x90b9('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x90b9('0x15')]=function(_0x54b39d,_0x396da0){return git['reset']([_0x90b9('0x16'),_0x90b9('0x17')],function(_0x168aea){if(_0x168aea){logger[_0x90b9('0x12')](_0x168aea);return _0x396da0['status'](0x1f4)['json'](_0x168aea);}logger[_0x90b9('0x13')](_0x90b9('0x18'));return _0x396da0['status'](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x19')});});};exports[_0x90b9('0x1a')]=function(_0xa771e7,_0x2107b9){exec(_0x90b9('0x1b'),function(_0x220998,_0x942903,_0x1c8f80){logger[_0x90b9('0x13')](_0x942903);logger[_0x90b9('0x13')](_0x1c8f80);if(_0x220998){logger[_0x90b9('0x12')](_0x220998);return _0x2107b9['status'](0x1f4)['json'](_0x220998);}return _0x2107b9[_0x90b9('0x10')](0xc8)['json']({'output':_0x942903});});};exports[_0x90b9('0x1c')]=function(_0x4a0ef6,_0x46f07a){return pm2['restart']('motion2')[_0x90b9('0x1d')](function(_0x1e45ff){logger['info'](_0x90b9('0x1e'),_0x1e45ff);return _0x46f07a[_0x90b9('0x10')](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x1f')});})[_0x90b9('0x20')](function(_0x299af4){logger[_0x90b9('0x12')](_0x299af4);return _0x46f07a[_0x90b9('0x10')](0x1f4)[_0x90b9('0x11')](_0x299af4);});};exports[_0x90b9('0x21')]=function(_0x149696,_0x33a733){var _0x184093=fs[_0x90b9('0x22')](path[_0x90b9('0x23')](config[_0x90b9('0x24')],_0x90b9('0x25'),_0x90b9('0x21')));var _0x304434=[];for(var _0x405033=0x0;_0x405033<_0x184093[_0x90b9('0x26')];_0x405033++){var _0x5250b5=_0x184093[_0x405033]['replace']('.js','');if(compareVersions(module[_0x90b9('0xa')][_0x90b9('0x3')],_0x5250b5)===-0x1){_0x304434['push'](_0x5250b5);}}if(_0x304434[_0x90b9('0x26')]){var _0x18e997=_0x304434[_0x90b9('0x27')](compareVersions);var _0x245e37=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x90b9('0x28')],'modelName':_0x90b9('0x28'),'columnName':_0x90b9('0x3')},'migrations':{'params':[db[_0x90b9('0x29')]['getQueryInterface'](),db['sequelize'][_0x90b9('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[_0x90b9('0x23')](config[_0x90b9('0x24')],_0x90b9('0x25'),_0x90b9('0x21')),'pattern':/\.js$/}});_0x245e37['up']({'migrations':_[_0x90b9('0x2b')](_0x18e997,function(_0x243569){return _0x243569+_0x90b9('0x2c');})})[_0x90b9('0x1d')](function(){return _0x33a733[_0x90b9('0x10')](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x2d')+module[_0x90b9('0xa')][_0x90b9('0x3')]+_0x90b9('0x2e')+_[_0x90b9('0x2f')](_0x18e997),'migrations':_[_0x90b9('0x23')](_0x18e997)});})[_0x90b9('0x20')](function(_0x1a4dda){if(_0x1a4dda instanceof db[_0x90b9('0x29')]['UniqueConstraintError']){return _0x33a733['status'](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x30')});}else{return _0x33a733['status'](0x1f4)[_0x90b9('0x11')](_0x1a4dda);}});}else{return _0x33a733['status'](0xc8)['json']({'output':_0x90b9('0x30')});}}; \ No newline at end of file +var _0x4d3e=['../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push','Migration','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions'];(function(_0x5c4c40,_0xc05330){var _0x17e997=function(_0x165d9d){while(--_0x165d9d){_0x5c4c40['push'](_0x5c4c40['shift']());}};_0x17e997(++_0xc05330);}(_0x4d3e,0x19a));var _0xe4d3=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4d3e[_0x278e3c];return _0x3e2d9b;};'use strict';var Umzug=require(_0xe4d3('0x0'));var path=require(_0xe4d3('0x1'));var fs=require('fs');var _=require(_0xe4d3('0x2'));var pkginfo=require(_0xe4d3('0x3'))(module,_0xe4d3('0x4'));var compareVersions=require(_0xe4d3('0x5'));var exec=require('child_process')['exec'];var db=require(_0xe4d3('0x6'))['db'];var config=require(_0xe4d3('0x7'));var pm2=require(_0xe4d3('0x8'));var logger=require(_0xe4d3('0x9'))('update');var git=require('simple-git')(config[_0xe4d3('0xa')]);exports[_0xe4d3('0xb')]=function(_0x18fe06,_0xe72e1a){var _0x40a06e={'current':module[_0xe4d3('0xc')][_0xe4d3('0x4')],'phonebar':0x2};if(_0x18fe06[_0xe4d3('0xd')]&&_0x18fe06[_0xe4d3('0xd')][_0xe4d3('0xe')]){return git[_0xe4d3('0xf')]()[_0xe4d3('0x10')](function(_0x399d86,_0x1d873c){_0x40a06e['latest']=(_0x399d86?module['exports']['version']:_0x1d873c[_0xe4d3('0xe')])||_0xe4d3('0x11');return _0xe72e1a[_0xe4d3('0x12')](0xc8)[_0xe4d3('0x13')](_0x40a06e);});}else{return _0xe72e1a[_0xe4d3('0x12')](0xc8)[_0xe4d3('0x13')](_0x40a06e);}};exports[_0xe4d3('0xf')]=function(_0x50e0a3,_0x21f852){return git[_0xe4d3('0xf')]([_0xe4d3('0x14'),'master'],function(_0x4258c4){if(_0x4258c4){logger[_0xe4d3('0x15')](_0x4258c4);return _0x21f852[_0xe4d3('0x12')](0x1f4)[_0xe4d3('0x13')](_0x4258c4);}logger['info'](_0xe4d3('0x16'));return _0x21f852[_0xe4d3('0x12')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xe4d3('0x17')]=function(_0x2a5a01,_0x1c6cef){return git[_0xe4d3('0x17')]([_0xe4d3('0x18'),_0xe4d3('0x19')],function(_0x124f16){if(_0x124f16){logger[_0xe4d3('0x15')](_0x124f16);return _0x1c6cef[_0xe4d3('0x12')](0x1f4)[_0xe4d3('0x13')](_0x124f16);}logger[_0xe4d3('0x1a')](_0xe4d3('0x1b'));return _0x1c6cef[_0xe4d3('0x12')](0xc8)['json']({'output':_0xe4d3('0x1c')});});};exports[_0xe4d3('0x1d')]=function(_0x55aa8e,_0x37270d){exec(_0xe4d3('0x1e'),function(_0x305500,_0xdb153f,_0x5488ba){logger[_0xe4d3('0x1a')](_0xdb153f);logger[_0xe4d3('0x1a')](_0x5488ba);if(_0x305500){logger[_0xe4d3('0x15')](_0x305500);return _0x37270d[_0xe4d3('0x12')](0x1f4)[_0xe4d3('0x13')](_0x305500);}return _0x37270d[_0xe4d3('0x12')](0xc8)[_0xe4d3('0x13')]({'output':_0xdb153f});});};exports['restart']=function(_0x4500f6,_0x2e6797){return pm2[_0xe4d3('0x1f')]('motion2')[_0xe4d3('0x20')](function(_0xd701e9){logger['info']('pm2\x20restart\x20motion\x20%s',_0xd701e9);return _0x2e6797[_0xe4d3('0x12')](0xc8)[_0xe4d3('0x13')]({'output':_0xe4d3('0x21')});})[_0xe4d3('0x22')](function(_0x10f36c){logger['error'](_0x10f36c);return _0x2e6797[_0xe4d3('0x12')](0x1f4)[_0xe4d3('0x13')](_0x10f36c);});};exports[_0xe4d3('0x23')]=function(_0x11d615,_0x1153a8){var _0x26d461=fs[_0xe4d3('0x24')](path[_0xe4d3('0x25')](config[_0xe4d3('0xa')],_0xe4d3('0x26'),_0xe4d3('0x23')));var _0x2c8fc3=[];for(var _0x42049c=0x0;_0x42049c<_0x26d461[_0xe4d3('0x27')];_0x42049c++){var _0x41cc24=_0x26d461[_0x42049c][_0xe4d3('0x28')](_0xe4d3('0x29'),'');if(compareVersions(module['exports'][_0xe4d3('0x4')],_0x41cc24)===-0x1){_0x2c8fc3[_0xe4d3('0x2a')](_0x41cc24);}}if(_0x2c8fc3[_0xe4d3('0x27')]){var _0xa78540=_0x2c8fc3['sort'](compareVersions);var _0x2a7faf=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xe4d3('0x2b'),'columnName':_0xe4d3('0x4')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xe4d3('0x2c')]['constructor'],function(){throw new Error(_0xe4d3('0x2d'));}],'path':path[_0xe4d3('0x25')](config[_0xe4d3('0xa')],_0xe4d3('0x26'),_0xe4d3('0x23')),'pattern':/\.js$/}});_0x2a7faf['up']({'migrations':_[_0xe4d3('0x2e')](_0xa78540,function(_0x5e8790){return _0x5e8790+_0xe4d3('0x29');})})['then'](function(){return _0x1153a8[_0xe4d3('0x12')](0xc8)['json']({'output':_0xe4d3('0x2f')+module[_0xe4d3('0xc')][_0xe4d3('0x4')]+_0xe4d3('0x30')+_[_0xe4d3('0x31')](_0xa78540),'migrations':_[_0xe4d3('0x25')](_0xa78540)});})[_0xe4d3('0x22')](function(_0x4e1c82){if(_0x4e1c82 instanceof db[_0xe4d3('0x2c')][_0xe4d3('0x32')]){return _0x1153a8['status'](0xc8)[_0xe4d3('0x13')]({'output':_0xe4d3('0x33')});}else{return _0x1153a8['status'](0x1f4)[_0xe4d3('0x13')](_0x4e1c82);}});}else{return _0x1153a8[_0xe4d3('0x12')](0xc8)['json']({'output':_0xe4d3('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7e8e065..63b9c88 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 _0xfdc9=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','update','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4afc5c,_0x584159){var _0x436888=function(_0x25e994){while(--_0x25e994){_0x4afc5c['push'](_0x4afc5c['shift']());}};_0x436888(++_0x584159);}(_0xfdc9,0xe9));var _0x9fdc=function(_0x25e8e2,_0x4fb8fd){_0x25e8e2=_0x25e8e2-0x0;var _0x22107d=_0xfdc9[_0x25e8e2];return _0x22107d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9fdc('0x0'));var timeout=require(_0x9fdc('0x1'));var express=require('express');var router=express[_0x9fdc('0x2')]();var fs_extra=require(_0x9fdc('0x3'));var auth=require(_0x9fdc('0x4'));var interaction=require(_0x9fdc('0x5'));var config=require(_0x9fdc('0x6'));var controller=require(_0x9fdc('0x7'));router[_0x9fdc('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fdc('0x9')]);router['get'](_0x9fdc('0xa'),auth[_0x9fdc('0xb')](),controller['describe']);router[_0x9fdc('0x8')](_0x9fdc('0xc'),auth[_0x9fdc('0xb')](),controller[_0x9fdc('0xd')]);router[_0x9fdc('0xe')]('/',auth[_0x9fdc('0xb')](),controller['create']);router['put'](_0x9fdc('0xc'),auth['isAuthenticated'](),controller[_0x9fdc('0xf')]);router['delete'](_0x9fdc('0xc'),auth[_0x9fdc('0xb')](),controller['destroy']);module[_0x9fdc('0x10')]=router; \ No newline at end of file +var _0xad6b=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x34ce3e,_0x1bda40){var _0x2c9ab2=function(_0x19d7f8){while(--_0x19d7f8){_0x34ce3e['push'](_0x34ce3e['shift']());}};_0x2c9ab2(++_0x1bda40);}(_0xad6b,0x159));var _0xbad6=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xad6b[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0xbad6('0x0'));var util=require(_0xbad6('0x1'));var path=require('path');var timeout=require(_0xbad6('0x2'));var express=require(_0xbad6('0x3'));var router=express[_0xbad6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbad6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbad6('0x6'));var controller=require(_0xbad6('0x7'));router[_0xbad6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbad6('0x8')](_0xbad6('0x9'),auth[_0xbad6('0xa')](),controller[_0xbad6('0xb')]);router[_0xbad6('0x8')]('/:id',auth[_0xbad6('0xa')](),controller[_0xbad6('0xc')]);router[_0xbad6('0xd')]('/',auth[_0xbad6('0xa')](),controller[_0xbad6('0xe')]);router[_0xbad6('0xf')](_0xbad6('0x10'),auth[_0xbad6('0xa')](),controller[_0xbad6('0x11')]);router[_0xbad6('0x12')]('/:id',auth[_0xbad6('0xa')](),controller[_0xbad6('0x13')]);module[_0xbad6('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 f8e7dad..79f2abc 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 _0xaa64=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaa64,0xf7));var _0x4aa6=function(_0x5b15bd,_0x57f86d){_0x5b15bd=_0x5b15bd-0x0;var _0x11e333=_0xaa64[_0x5b15bd];return _0x11e333;};'use strict';var Sequelize=require(_0x4aa6('0x0'));module[_0x4aa6('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4aa6('0x2')]},'queue':{'type':Sequelize[_0x4aa6('0x2')]},'interface':{'type':Sequelize[_0x4aa6('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4aa6('0x3')]},'holdtime':{'type':Sequelize[_0x4aa6('0x4')]},'agentcomplete':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4aa6('0x4')]},'agentacw':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4aa6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4aa6('0x2')]},'channelstate':{'type':Sequelize[_0x4aa6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4aa6('0x2')]},'accountcode':{'type':Sequelize[_0x4aa6('0x2')]},'context':{'type':Sequelize[_0x4aa6('0x2')]},'exten':{'type':Sequelize[_0x4aa6('0x2')]},'priority':{'type':Sequelize[_0x4aa6('0x2')]},'destchannel':{'type':Sequelize[_0x4aa6('0x2')]},'destchannelstate':{'type':Sequelize[_0x4aa6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridname':{'type':Sequelize[_0x4aa6('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4aa6('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4aa6('0x2')]},'destexten':{'type':Sequelize[_0x4aa6('0x2')]},'destpriority':{'type':Sequelize[_0x4aa6('0x2')]},'destuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4aa6('0x2')]},'transfer':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4aa6('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4aa6('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x4aa6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5a13=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0xdc07d0,_0xb59a9c){var _0x47cc70=function(_0x12181e){while(--_0x12181e){_0xdc07d0['push'](_0xdc07d0['shift']());}};_0x47cc70(++_0xb59a9c);}(_0x5a13,0x145));var _0x35a1=function(_0x5bf93b,_0x22380f){_0x5bf93b=_0x5bf93b-0x0;var _0x47b6ae=_0x5a13[_0x5bf93b];return _0x47b6ae;};'use strict';var Sequelize=require(_0x35a1('0x0'));module[_0x35a1('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x35a1('0x2')]},'calleridnum':{'type':Sequelize[_0x35a1('0x2')]},'calleridname':{'type':Sequelize[_0x35a1('0x2')]},'queue':{'type':Sequelize[_0x35a1('0x2')]},'interface':{'type':Sequelize[_0x35a1('0x2')]},'membername':{'type':Sequelize[_0x35a1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x35a1('0x3')]},'agentconnectAt':{'type':Sequelize[_0x35a1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x35a1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x35a1('0x3')]},'agentdumpAt':{'type':Sequelize[_0x35a1('0x3')]},'holdtime':{'type':Sequelize[_0x35a1('0x4')]},'agentcomplete':{'type':Sequelize[_0x35a1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x35a1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x35a1('0x4')]},'reason':{'type':Sequelize[_0x35a1('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x35a1('0x2')]},'channelstate':{'type':Sequelize[_0x35a1('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x35a1('0x2')]},'language':{'type':Sequelize[_0x35a1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x35a1('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x35a1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x35a1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x35a1('0x2')]},'destcalleridname':{'type':Sequelize[_0x35a1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x35a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x35a1('0x2')]},'destlanguage':{'type':Sequelize[_0x35a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x35a1('0x2')]},'destcontext':{'type':Sequelize[_0x35a1('0x2')]},'destexten':{'type':Sequelize[_0x35a1('0x2')]},'destpriority':{'type':Sequelize[_0x35a1('0x2')]},'destuniqueid':{'type':Sequelize[_0x35a1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x35a1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x35a1('0x2')]},'transfer':{'type':Sequelize[_0x35a1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x35a1('0x2')],'comment':_0x35a1('0x6')},'transferexten':{'type':Sequelize[_0x35a1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x35a1('0x2')]},'agententerreason':{'type':Sequelize[_0x35a1('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 9d6614c..ff5003e 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(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 4e64d01..849ddd8 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 _0x3248=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3248,0x1bc));var _0x8324=function(_0x48a66e,_0x22a358){_0x48a66e=_0x48a66e-0x0;var _0x276ff2=_0x3248[_0x48a66e];return _0x276ff2;};'use strict';var _=require('lodash');var util=require(_0x8324('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8324('0x1'));var BPromise=require(_0x8324('0x2'));var rp=require(_0x8324('0x3'));var fs=require('fs');var path=require(_0x8324('0x4'));var rimraf=require(_0x8324('0x5'));var config=require(_0x8324('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x8324('0x7')]=function(_0x1c5c2a,_0x5157f4){return _0x1c5c2a[_0x8324('0x8')](_0x8324('0x9'),attributes,{'tableName':_0x8324('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8324('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3be=['destuniqueid','lodash','util','../../config/logger','api','bluebird','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0xf3be,0x1e1));var _0xef3b=function(_0x147db9,_0x419b8d){_0x147db9=_0x147db9-0x0;var _0x2d1db7=_0xf3be[_0x147db9];return _0x2d1db7;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var logger=require(_0xef3b('0x2'))(_0xef3b('0x3'));var moment=require('moment');var BPromise=require(_0xef3b('0x4'));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(_0xef3b('0x5'));module[_0xef3b('0x6')]=function(_0x48f499,_0x3dfcc2){return _0x48f499[_0xef3b('0x7')](_0xef3b('0x8'),attributes,{'tableName':_0xef3b('0x9'),'paranoid':![],'indexes':[{'fields':[_0xef3b('0xa'),_0xef3b('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 1ade45d..30b2bb0 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 _0x391a=['limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','raw','where'];(function(_0x56fea2,_0x5501bd){var _0x362102=function(_0x1faa33){while(--_0x1faa33){_0x56fea2['push'](_0x56fea2['shift']());}};_0x362102(++_0x5501bd);}(_0x391a,0xa6));var _0xa391=function(_0x57fee7,_0x23f8d5){_0x57fee7=_0x57fee7-0x0;var _0x3f61be=_0x391a[_0x57fee7];return _0x3f61be;};'use strict';var _=require(_0xa391('0x0'));var util=require(_0xa391('0x1'));var moment=require('moment');var BPromise=require(_0xa391('0x2'));var rs=require(_0xa391('0x3'));var fs=require('fs');var Redis=require(_0xa391('0x4'));var db=require(_0xa391('0x5'))['db'];var utils=require(_0xa391('0x6'));var logger=require(_0xa391('0x7'))(_0xa391('0x8'));var config=require(_0xa391('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa391('0xa')][_0xa391('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f0ab,_0x4430f4,_0x4e14cf){return new BPromise(function(_0x136ae8,_0x3a95f8){return client['request'](_0x31f0ab,_0x4e14cf)[_0xa391('0xc')](function(_0x120c78){logger[_0xa391('0xd')](_0xa391('0xe'),_0x4430f4,_0xa391('0xf'));logger[_0xa391('0x10')](_0xa391('0x11'),_0x4430f4,_0xa391('0xf'),JSON[_0xa391('0x12')](_0x120c78));if(_0x120c78[_0xa391('0x13')]){if(_0x120c78[_0xa391('0x13')]['code']===0x1f4){logger[_0xa391('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4430f4,_0x120c78['error'][_0xa391('0x14')]);return _0x3a95f8(_0x120c78[_0xa391('0x13')][_0xa391('0x14')]);}logger[_0xa391('0x13')](_0xa391('0xe'),_0x4430f4,_0x120c78[_0xa391('0x13')][_0xa391('0x14')]);return _0x136ae8(_0x120c78[_0xa391('0x13')]['message']);}else{logger[_0xa391('0xd')](_0xa391('0xe'),_0x4430f4,_0xa391('0xf'));_0x136ae8(_0x120c78[_0xa391('0x15')]['message']);}})[_0xa391('0x16')](function(_0x433a15){logger[_0xa391('0x13')](_0xa391('0xe'),_0x4430f4,_0x433a15);_0x3a95f8(_0x433a15);});});}exports[_0xa391('0x17')]=function(_0x4507bd){var _0x569a92=this;return new Promise(function(_0xc74b5f,_0x529b56){return db[_0xa391('0x18')][_0xa391('0x19')](_0x4507bd[_0xa391('0x1a')],{'raw':_0x4507bd[_0xa391('0x1b')]?_0x4507bd[_0xa391('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa391('0xc')](function(_0x357a75){logger[_0xa391('0xd')]('CreateVoiceAgentReport',_0x4507bd);logger['debug']('CreateVoiceAgentReport',_0x4507bd,JSON[_0xa391('0x12')](_0x357a75));_0xc74b5f(_0x357a75);})['catch'](function(_0xad3b97){logger[_0xa391('0x13')]('CreateVoiceAgentReport',_0xad3b97['message'],_0x4507bd);_0x529b56(_0x569a92[_0xa391('0x13')](0x1f4,_0xad3b97[_0xa391('0x14')]));});});};exports[_0xa391('0x1c')]=function(_0x56c4bf){var _0x1aec57=this;return new Promise(function(_0x5a04b1,_0x590816){return db[_0xa391('0x18')][_0xa391('0x1d')](_0x56c4bf['body'],{'raw':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')][_0xa391('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')][_0xa391('0x1f')]||null:null,'attributes':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')]['attributes']||null:null,'limit':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')][_0xa391('0x20')]||null:null})[_0xa391('0xc')](function(_0xbcc784){logger['info'](_0xa391('0x1c'),_0x56c4bf);logger['debug'](_0xa391('0x1c'),_0x56c4bf,JSON[_0xa391('0x12')](_0xbcc784));_0x5a04b1(_0xbcc784);})[_0xa391('0x16')](function(_0x176e0e){logger[_0xa391('0x13')](_0xa391('0x1c'),_0x176e0e['message'],_0x56c4bf);_0x590816(_0x1aec57[_0xa391('0x13')](0x1f4,_0x176e0e[_0xa391('0x14')]));});});}; \ No newline at end of file +var _0xbe69=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x5c1409,_0x33c79b){var _0x357d2f=function(_0x558e88){while(--_0x558e88){_0x5c1409['push'](_0x5c1409['shift']());}};_0x357d2f(++_0x33c79b);}(_0xbe69,0x168));var _0x9be6=function(_0x27c5f3,_0x9d92f9){_0x27c5f3=_0x27c5f3-0x0;var _0x78836a=_0xbe69[_0x27c5f3];return _0x78836a;};'use strict';var _=require(_0x9be6('0x0'));var util=require(_0x9be6('0x1'));var moment=require(_0x9be6('0x2'));var BPromise=require(_0x9be6('0x3'));var rs=require(_0x9be6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9be6('0x5'));var logger=require(_0x9be6('0x6'))(_0x9be6('0x7'));var config=require('../../config/environment');var jayson=require(_0x9be6('0x8'));var client=jayson[_0x9be6('0x9')][_0x9be6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cbd11,_0x51826c,_0x3e171e){return new BPromise(function(_0x21491a,_0x59335d){return client[_0x9be6('0xb')](_0x5cbd11,_0x3e171e)[_0x9be6('0xc')](function(_0x2d7efc){logger[_0x9be6('0xd')](_0x9be6('0xe'),_0x51826c,_0x9be6('0xf'));logger[_0x9be6('0x10')](_0x9be6('0x11'),_0x51826c,_0x9be6('0xf'),JSON[_0x9be6('0x12')](_0x2d7efc));if(_0x2d7efc['error']){if(_0x2d7efc[_0x9be6('0x13')][_0x9be6('0x14')]===0x1f4){logger[_0x9be6('0x13')](_0x9be6('0xe'),_0x51826c,_0x2d7efc[_0x9be6('0x13')][_0x9be6('0x15')]);return _0x59335d(_0x2d7efc[_0x9be6('0x13')][_0x9be6('0x15')]);}logger[_0x9be6('0x13')](_0x9be6('0xe'),_0x51826c,_0x2d7efc[_0x9be6('0x13')][_0x9be6('0x15')]);return _0x21491a(_0x2d7efc['error']['message']);}else{logger[_0x9be6('0xd')](_0x9be6('0xe'),_0x51826c,'request\x20sent');_0x21491a(_0x2d7efc[_0x9be6('0x16')][_0x9be6('0x15')]);}})[_0x9be6('0x17')](function(_0x131276){logger['error'](_0x9be6('0xe'),_0x51826c,_0x131276);_0x59335d(_0x131276);});});}exports[_0x9be6('0x18')]=function(_0x43472a){var _0x594dcf=this;return new Promise(function(_0x675867,_0x200594){return db[_0x9be6('0x19')][_0x9be6('0x1a')](_0x43472a['body'],{'raw':_0x43472a[_0x9be6('0x1b')]?_0x43472a[_0x9be6('0x1b')][_0x9be6('0x1c')]===undefined?!![]:![]:!![]})[_0x9be6('0xc')](function(_0x5491f5){logger[_0x9be6('0xd')](_0x9be6('0x18'),_0x43472a);logger['debug'](_0x9be6('0x18'),_0x43472a,JSON[_0x9be6('0x12')](_0x5491f5));_0x675867(_0x5491f5);})[_0x9be6('0x17')](function(_0xe99d09){logger[_0x9be6('0x13')](_0x9be6('0x18'),_0xe99d09['message'],_0x43472a);_0x200594(_0x594dcf['error'](0x1f4,_0xe99d09['message']));});});};exports[_0x9be6('0x1d')]=function(_0xceb281){var _0x213282=this;return new Promise(function(_0x22d0a0,_0x6656eb){return db[_0x9be6('0x19')][_0x9be6('0x1e')](_0xceb281[_0x9be6('0x1f')],{'raw':_0xceb281[_0x9be6('0x1b')]?_0xceb281[_0x9be6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xceb281[_0x9be6('0x1b')]?_0xceb281[_0x9be6('0x1b')][_0x9be6('0x20')]||null:null,'attributes':_0xceb281[_0x9be6('0x1b')]?_0xceb281[_0x9be6('0x1b')][_0x9be6('0x21')]||null:null,'limit':_0xceb281['options']?_0xceb281[_0x9be6('0x1b')]['limit']||null:null})['then'](function(_0xcd43c5){logger[_0x9be6('0xd')](_0x9be6('0x1d'),_0xceb281);logger[_0x9be6('0x10')](_0x9be6('0x1d'),_0xceb281,JSON[_0x9be6('0x12')](_0xcd43c5));_0x22d0a0(_0xcd43c5);})[_0x9be6('0x17')](function(_0x4f0a5b){logger[_0x9be6('0x13')]('UpdateVoiceAgentReport',_0x4f0a5b[_0x9be6('0x15')],_0xceb281);_0x6656eb(_0x213282[_0x9be6('0x13')](0x1f4,_0x4f0a5b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a17708d..fc93f95 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 _0x7dfd=['isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x5f1c2e,_0x50cf54){var _0x2ecb25=function(_0x44e730){while(--_0x44e730){_0x5f1c2e['push'](_0x5f1c2e['shift']());}};_0x2ecb25(++_0x50cf54);}(_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')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['describe']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['post']('/',auth[_0xd7df('0xc')](),controller['create']);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x12')]);router[_0xd7df('0x13')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);module[_0xd7df('0x15')]=router; \ No newline at end of file +var _0x9b67=['../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x4beac1,_0x418383){var _0x1725d2=function(_0x18a444){while(--_0x18a444){_0x4beac1['push'](_0x4beac1['shift']());}};_0x1725d2(++_0x418383);}(_0x9b67,0xf6));var _0x79b6=function(_0x337105,_0x1c8774){_0x337105=_0x337105-0x0;var _0x581c70=_0x9b67[_0x337105];return _0x581c70;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['describe']);router[_0x79b6('0x8')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xe')]('/',auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller['update']);router['delete'](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c77c042..346afd5 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 _0xd763=['inbound','internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','ENUM'];(function(_0x227649,_0x2f99a9){var _0x263613=function(_0x6f0406){while(--_0x6f0406){_0x227649['push'](_0x227649['shift']());}};_0x263613(++_0x2f99a9);}(_0xd763,0xda));var _0x3d76=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd763[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x3d76('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3d76('0x1')](_0x3d76('0x2'),_0x3d76('0x3'),_0x3d76('0x4'),_0x3d76('0x5'),_0x3d76('0x6'),'dialer')},'tag':{'type':Sequelize[_0x3d76('0x7')]},'accountcode':{'type':Sequelize[_0x3d76('0x7')]},'source':{'type':Sequelize[_0x3d76('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x3d76('0x7')]},'callerid':{'type':Sequelize[_0x3d76('0x7')]},'channel':{'type':Sequelize[_0x3d76('0x7')]},'destinationchannel':{'type':Sequelize[_0x3d76('0x7')]},'lastapplication':{'type':Sequelize[_0x3d76('0x7')]},'lastdata':{'type':Sequelize[_0x3d76('0x8')]},'starttime':{'type':Sequelize[_0x3d76('0x9')]},'systemanswertime':{'type':Sequelize[_0x3d76('0x9')]},'answertime':{'type':Sequelize[_0x3d76('0x9')]},'endtime':{'type':Sequelize[_0x3d76('0x9')]},'duration':{'type':Sequelize[_0x3d76('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x3d76('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3d76('0x7')]},'amaflags':{'type':Sequelize[_0x3d76('0x7')]},'userfield':{'type':Sequelize[_0x3d76('0x7')]},'userDisposition':{'type':Sequelize[_0x3d76('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x3d76('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x3d76('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x3d76('0x7')]},'routeid':{'type':Sequelize[_0x3d76('0xa')]},'sipcallid':{'type':Sequelize[_0x3d76('0x7')]}}; \ No newline at end of file +var _0xc70a=['STRING','DATE','INTEGER','exports','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x481c62,_0x1a857f){var _0x45ffd4=function(_0x5d78a4){while(--_0x5d78a4){_0x481c62['push'](_0x481c62['shift']());}};_0x45ffd4(++_0x1a857f);}(_0xc70a,0x17d));var _0xac70=function(_0x4c2028,_0x1ca03e){_0x4c2028=_0x4c2028-0x0;var _0x4c78ad=_0xc70a[_0x4c2028];return _0x4c78ad;};'use strict';var Sequelize=require('sequelize');module[_0xac70('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('inbound',_0xac70('0x1'),_0xac70('0x2'),_0xac70('0x3'),_0xac70('0x4'),_0xac70('0x5'))},'tag':{'type':Sequelize[_0xac70('0x6')]},'accountcode':{'type':Sequelize[_0xac70('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xac70('0x6')]},'destinationcontext':{'type':Sequelize[_0xac70('0x6')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xac70('0x6')]},'destinationchannel':{'type':Sequelize[_0xac70('0x6')]},'lastapplication':{'type':Sequelize[_0xac70('0x6')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xac70('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xac70('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xac70('0x8')]},'mohtime':{'type':Sequelize[_0xac70('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xac70('0x6')]},'amaflags':{'type':Sequelize[_0xac70('0x6')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xac70('0x6')]},'userThirdDisposition':{'type':Sequelize[_0xac70('0x6')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xac70('0x6')]},'routeid':{'type':Sequelize[_0xac70('0x8')]},'sipcallid':{'type':Sequelize[_0xac70('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 85a79ab..f340034 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x4f49af,_0x47e992){var _0x28ef1a=function(_0x3b3081){while(--_0x3b3081){_0x4f49af['push'](_0x4f49af['shift']());}};_0x28ef1a(++_0x47e992);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x0b0e[_0x5fe69a];return _0x3f1aee;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b4a5807..efd342e 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 _0xe0f5=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1bdcb8,_0x3d29e4){var _0x56e7d3=function(_0x6b1e05){while(--_0x6b1e05){_0x1bdcb8['push'](_0x1bdcb8['shift']());}};_0x56e7d3(++_0x3d29e4);}(_0xe0f5,0xfd));var _0x5e0f=function(_0x59c683,_0x209444){_0x59c683=_0x59c683-0x0;var _0x47251b=_0xe0f5[_0x59c683];return _0x47251b;};'use strict';var _=require(_0x5e0f('0x0'));var util=require(_0x5e0f('0x1'));var logger=require(_0x5e0f('0x2'))(_0x5e0f('0x3'));var moment=require('moment');var BPromise=require(_0x5e0f('0x4'));var rp=require(_0x5e0f('0x5'));var fs=require('fs');var path=require(_0x5e0f('0x6'));var rimraf=require(_0x5e0f('0x7'));var config=require(_0x5e0f('0x8'));var attributes=require(_0x5e0f('0x9'));module[_0x5e0f('0xa')]=function(_0x46aaa3,_0x49959a){return _0x46aaa3['define'](_0x5e0f('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x5e0f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c1c=['path','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','../../config/logger','api','request-promise'];(function(_0x492a42,_0x240111){var _0x34f1e1=function(_0x54b1ae){while(--_0x54b1ae){_0x492a42['push'](_0x492a42['shift']());}};_0x34f1e1(++_0x240111);}(_0x3c1c,0xb1));var _0xc3c1=function(_0x1a635e,_0x241651){_0x1a635e=_0x1a635e-0x0;var _0x5b3345=_0x3c1c[_0x1a635e];return _0x5b3345;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3c1('0x0'))(_0xc3c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3c1('0x2'));var fs=require('fs');var path=require(_0xc3c1('0x3'));var rimraf=require('rimraf');var config=require(_0xc3c1('0x4'));var attributes=require(_0xc3c1('0x5'));module['exports']=function(_0x56eec6,_0x38b5ec){return _0x56eec6[_0xc3c1('0x6')](_0xc3c1('0x7'),attributes,{'tableName':_0xc3c1('0x8'),'paranoid':![],'indexes':[{'fields':[_0xc3c1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 30638b7..b0d3f15 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 _0x57d8=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','include','map','model','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','limit','util','moment','ioredis'];(function(_0x1c7684,_0x5eec48){var _0x139925=function(_0x4ad207){while(--_0x4ad207){_0x1c7684['push'](_0x1c7684['shift']());}};_0x139925(++_0x5eec48);}(_0x57d8,0x1ad));var _0x857d=function(_0x5a9dc6,_0x5e98af){_0x5a9dc6=_0x5a9dc6-0x0;var _0x285b86=_0x57d8[_0x5a9dc6];return _0x285b86;};'use strict';var _=require('lodash');var util=require(_0x857d('0x0'));var moment=require(_0x857d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x857d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x857d('0x3'));var logger=require(_0x857d('0x4'))(_0x857d('0x5'));var config=require('../../config/environment');var jayson=require(_0x857d('0x6'));var client=jayson[_0x857d('0x7')][_0x857d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x199490,_0x1520d2,_0x36be1b){return new BPromise(function(_0x5e409d,_0x1eea92){return client[_0x857d('0x9')](_0x199490,_0x36be1b)[_0x857d('0xa')](function(_0x12a60b){logger[_0x857d('0xb')](_0x857d('0xc'),_0x1520d2,_0x857d('0xd'));logger['debug'](_0x857d('0xe'),_0x1520d2,_0x857d('0xd'),JSON[_0x857d('0xf')](_0x12a60b));if(_0x12a60b[_0x857d('0x10')]){if(_0x12a60b[_0x857d('0x10')][_0x857d('0x11')]===0x1f4){logger['error'](_0x857d('0xc'),_0x1520d2,_0x12a60b[_0x857d('0x10')]['message']);return _0x1eea92(_0x12a60b[_0x857d('0x10')]['message']);}logger[_0x857d('0x10')](_0x857d('0xc'),_0x1520d2,_0x12a60b['error'][_0x857d('0x12')]);return _0x5e409d(_0x12a60b['error'][_0x857d('0x12')]);}else{logger['info'](_0x857d('0xc'),_0x1520d2,_0x857d('0xd'));_0x5e409d(_0x12a60b[_0x857d('0x13')][_0x857d('0x12')]);}})[_0x857d('0x14')](function(_0x522639){logger[_0x857d('0x10')](_0x857d('0xc'),_0x1520d2,_0x522639);_0x1eea92(_0x522639);});});}exports[_0x857d('0x15')]=function(_0x368f04){var _0x1ac0bc=this;return new Promise(function(_0x4fa515,_0x157efe){return db[_0x857d('0x16')][_0x857d('0x17')]({'raw':_0x368f04[_0x857d('0x18')]?_0x368f04['options'][_0x857d('0x19')]===undefined?!![]:![]:!![],'where':_0x368f04[_0x857d('0x18')]?_0x368f04[_0x857d('0x18')]['where']||null:null,'attributes':_0x368f04[_0x857d('0x18')]?_0x368f04['options'][_0x857d('0x1a')]||null:null,'limit':_0x368f04['options']?_0x368f04[_0x857d('0x18')]['limit']||null:null,'include':_0x368f04[_0x857d('0x18')]?_0x368f04[_0x857d('0x18')][_0x857d('0x1b')]?_[_0x857d('0x1c')](_0x368f04[_0x857d('0x18')][_0x857d('0x1b')],function(_0x16ae42){return{'model':db[_0x16ae42[_0x857d('0x1d')]],'as':_0x16ae42['as'],'attributes':_0x16ae42['attributes'],'include':_0x16ae42[_0x857d('0x1b')]?_[_0x857d('0x1c')](_0x16ae42[_0x857d('0x1b')],function(_0x3c77c1){return{'model':db[_0x3c77c1['model']],'as':_0x3c77c1['as'],'attributes':_0x3c77c1[_0x857d('0x1a')],'include':_0x3c77c1[_0x857d('0x1b')]?_['map'](_0x3c77c1[_0x857d('0x1b')],function(_0x1b3f6e){return{'model':db[_0x1b3f6e[_0x857d('0x1d')]],'as':_0x1b3f6e['as'],'attributes':_0x1b3f6e[_0x857d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x857d('0xa')](function(_0x1542db){logger[_0x857d('0xb')](_0x857d('0x15'),_0x368f04);logger[_0x857d('0x1e')](_0x857d('0x15'),_0x368f04,JSON[_0x857d('0xf')](_0x1542db));_0x4fa515(_0x1542db);})[_0x857d('0x14')](function(_0x3bd7bf){logger[_0x857d('0x10')]('GetVoiceCallReport',_0x3bd7bf[_0x857d('0x12')],_0x368f04);_0x157efe(_0x1ac0bc[_0x857d('0x10')](0x1f4,_0x3bd7bf[_0x857d('0x12')]));});});};exports[_0x857d('0x1f')]=function(_0x1bc1d1){var _0x3944e5=this;return new Promise(function(_0x2ebf7c,_0x236c96){return db[_0x857d('0x16')][_0x857d('0x20')](_0x1bc1d1[_0x857d('0x21')],{'raw':_0x1bc1d1[_0x857d('0x18')]?_0x1bc1d1['options']['raw']===undefined?!![]:![]:!![]})[_0x857d('0xa')](function(_0x42d4d5){logger[_0x857d('0xb')](_0x857d('0x1f'),_0x1bc1d1);logger[_0x857d('0x1e')]('CreateVoiceCallReport',_0x1bc1d1,JSON[_0x857d('0xf')](_0x42d4d5));_0x2ebf7c(_0x42d4d5);})[_0x857d('0x14')](function(_0x528d8e){logger[_0x857d('0x10')]('CreateVoiceCallReport',_0x528d8e[_0x857d('0x12')],_0x1bc1d1);_0x236c96(_0x3944e5[_0x857d('0x10')](0x1f4,_0x528d8e['message']));});});};exports[_0x857d('0x22')]=function(_0x16bf12){var _0x331f44=this;return new Promise(function(_0x45b648,_0x8646c2){return db['VoiceCallReport']['update'](_0x16bf12[_0x857d('0x21')],{'raw':_0x16bf12[_0x857d('0x18')]?_0x16bf12['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bf12[_0x857d('0x18')]?_0x16bf12['options']['where']||null:null,'attributes':_0x16bf12[_0x857d('0x18')]?_0x16bf12[_0x857d('0x18')]['attributes']||null:null,'limit':_0x16bf12[_0x857d('0x18')]?_0x16bf12[_0x857d('0x18')][_0x857d('0x23')]||null:null})[_0x857d('0xa')](function(_0x179ac6){logger[_0x857d('0xb')](_0x857d('0x22'),_0x16bf12);logger[_0x857d('0x1e')]('UpdateVoiceCallReport',_0x16bf12,JSON[_0x857d('0xf')](_0x179ac6));_0x45b648(_0x179ac6);})['catch'](function(_0x4131d6){logger[_0x857d('0x10')](_0x857d('0x22'),_0x4131d6['message'],_0x16bf12);_0x8646c2(_0x331f44[_0x857d('0x10')](0x1f4,_0x4131d6['message']));});});}; \ No newline at end of file +var _0x3162=['create','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x3162,0xb9));var _0x2316=function(_0x46df63,_0x5cbc34){_0x46df63=_0x46df63-0x0;var _0x236616=_0x3162[_0x46df63];return _0x236616;};'use strict';var _=require('lodash');var util=require(_0x2316('0x0'));var moment=require('moment');var BPromise=require(_0x2316('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2316('0x2'));var db=require(_0x2316('0x3'))['db'];var utils=require(_0x2316('0x4'));var logger=require(_0x2316('0x5'))(_0x2316('0x6'));var config=require(_0x2316('0x7'));var jayson=require(_0x2316('0x8'));var client=jayson[_0x2316('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ee0d3,_0x5a3269,_0x1a2d7e){return new BPromise(function(_0x5b09c6,_0x49c5f1){return client['request'](_0x3ee0d3,_0x1a2d7e)[_0x2316('0xa')](function(_0x28dee6){logger[_0x2316('0xb')](_0x2316('0xc'),_0x5a3269,_0x2316('0xd'));logger[_0x2316('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5a3269,'request\x20sent',JSON[_0x2316('0xf')](_0x28dee6));if(_0x28dee6[_0x2316('0x10')]){if(_0x28dee6[_0x2316('0x10')][_0x2316('0x11')]===0x1f4){logger[_0x2316('0x10')](_0x2316('0xc'),_0x5a3269,_0x28dee6[_0x2316('0x10')][_0x2316('0x12')]);return _0x49c5f1(_0x28dee6[_0x2316('0x10')]['message']);}logger[_0x2316('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5a3269,_0x28dee6[_0x2316('0x10')][_0x2316('0x12')]);return _0x5b09c6(_0x28dee6[_0x2316('0x10')]['message']);}else{logger[_0x2316('0xb')](_0x2316('0xc'),_0x5a3269,'request\x20sent');_0x5b09c6(_0x28dee6[_0x2316('0x13')][_0x2316('0x12')]);}})[_0x2316('0x14')](function(_0x1da8dd){logger[_0x2316('0x10')](_0x2316('0xc'),_0x5a3269,_0x1da8dd);_0x49c5f1(_0x1da8dd);});});}exports[_0x2316('0x15')]=function(_0x1aa6ee){var _0xd16442=this;return new Promise(function(_0x280405,_0x9913b2){return db['VoiceCallReport'][_0x2316('0x16')]({'raw':_0x1aa6ee[_0x2316('0x17')]?_0x1aa6ee['options'][_0x2316('0x18')]===undefined?!![]:![]:!![],'where':_0x1aa6ee[_0x2316('0x17')]?_0x1aa6ee['options'][_0x2316('0x19')]||null:null,'attributes':_0x1aa6ee[_0x2316('0x17')]?_0x1aa6ee[_0x2316('0x17')][_0x2316('0x1a')]||null:null,'limit':_0x1aa6ee[_0x2316('0x17')]?_0x1aa6ee[_0x2316('0x17')][_0x2316('0x1b')]||null:null,'include':_0x1aa6ee[_0x2316('0x17')]?_0x1aa6ee[_0x2316('0x17')][_0x2316('0x1c')]?_[_0x2316('0x1d')](_0x1aa6ee['options'][_0x2316('0x1c')],function(_0x1bb639){return{'model':db[_0x1bb639[_0x2316('0x1e')]],'as':_0x1bb639['as'],'attributes':_0x1bb639[_0x2316('0x1a')],'include':_0x1bb639[_0x2316('0x1c')]?_[_0x2316('0x1d')](_0x1bb639['include'],function(_0x2a3225){return{'model':db[_0x2a3225[_0x2316('0x1e')]],'as':_0x2a3225['as'],'attributes':_0x2a3225[_0x2316('0x1a')],'include':_0x2a3225[_0x2316('0x1c')]?_[_0x2316('0x1d')](_0x2a3225['include'],function(_0x324b8f){return{'model':db[_0x324b8f[_0x2316('0x1e')]],'as':_0x324b8f['as'],'attributes':_0x324b8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x2316('0xa')](function(_0x1b7d65){logger[_0x2316('0xb')](_0x2316('0x15'),_0x1aa6ee);logger[_0x2316('0xe')](_0x2316('0x15'),_0x1aa6ee,JSON['stringify'](_0x1b7d65));_0x280405(_0x1b7d65);})[_0x2316('0x14')](function(_0x30ba6f){logger[_0x2316('0x10')](_0x2316('0x15'),_0x30ba6f[_0x2316('0x12')],_0x1aa6ee);_0x9913b2(_0xd16442[_0x2316('0x10')](0x1f4,_0x30ba6f[_0x2316('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x419ed3){var _0x18be4f=this;return new Promise(function(_0x572be4,_0x30d0d3){return db['VoiceCallReport'][_0x2316('0x1f')](_0x419ed3[_0x2316('0x20')],{'raw':_0x419ed3['options']?_0x419ed3[_0x2316('0x17')][_0x2316('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1fecd4){logger[_0x2316('0xb')](_0x2316('0x21'),_0x419ed3);logger[_0x2316('0xe')](_0x2316('0x21'),_0x419ed3,JSON[_0x2316('0xf')](_0x1fecd4));_0x572be4(_0x1fecd4);})[_0x2316('0x14')](function(_0x141eda){logger[_0x2316('0x10')]('CreateVoiceCallReport',_0x141eda[_0x2316('0x12')],_0x419ed3);_0x30d0d3(_0x18be4f[_0x2316('0x10')](0x1f4,_0x141eda[_0x2316('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x613521){var _0x2aed70=this;return new Promise(function(_0x182d19,_0x2305a9){return db['VoiceCallReport'][_0x2316('0x22')](_0x613521[_0x2316('0x20')],{'raw':_0x613521[_0x2316('0x17')]?_0x613521[_0x2316('0x17')][_0x2316('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x613521[_0x2316('0x17')]?_0x613521[_0x2316('0x17')][_0x2316('0x19')]||null:null,'attributes':_0x613521[_0x2316('0x17')]?_0x613521[_0x2316('0x17')][_0x2316('0x1a')]||null:null,'limit':_0x613521[_0x2316('0x17')]?_0x613521[_0x2316('0x17')][_0x2316('0x1b')]||null:null})[_0x2316('0xa')](function(_0x146a42){logger[_0x2316('0xb')](_0x2316('0x23'),_0x613521);logger['debug'](_0x2316('0x23'),_0x613521,JSON[_0x2316('0xf')](_0x146a42));_0x182d19(_0x146a42);})['catch'](function(_0xc47692){logger[_0x2316('0x10')]('UpdateVoiceCallReport',_0xc47692[_0x2316('0x12')],_0x613521);_0x2305a9(_0x2aed70[_0x2316('0x10')](0x1f4,_0xc47692['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 3c42a2c..437ab20 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 _0x9ae5=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x428885,_0x4122de){var _0xbdc7d5=function(_0xbe39c5){while(--_0xbe39c5){_0x428885['push'](_0x428885['shift']());}};_0xbdc7d5(++_0x4122de);}(_0x9ae5,0x96));var _0x59ae=function(_0x5e5b83,_0x19baf0){_0x5e5b83=_0x5e5b83-0x0;var _0x5d20c4=_0x9ae5[_0x5e5b83];return _0x5d20c4;};'use strict';var multer=require('multer');var util=require(_0x59ae('0x0'));var path=require('path');var timeout=require(_0x59ae('0x1'));var express=require('express');var router=express[_0x59ae('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x59ae('0x3'));var interaction=require(_0x59ae('0x4'));var config=require(_0x59ae('0x5'));var controller=require('./voiceChanSpy.controller');router[_0x59ae('0x6')]('/',auth[_0x59ae('0x7')](),controller['index']);router['get'](_0x59ae('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x59ae('0x9')]('/',auth[_0x59ae('0x7')](),controller[_0x59ae('0xa')]);router['put'](_0x59ae('0x8'),auth[_0x59ae('0x7')](),controller[_0x59ae('0xb')]);router[_0x59ae('0xc')](_0x59ae('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x59ae('0xd')]=router; \ No newline at end of file +var _0x0b20=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a84a2,_0x241062){var _0x1bb61d=function(_0x26f5ac){while(--_0x26f5ac){_0x2a84a2['push'](_0x2a84a2['shift']());}};_0x1bb61d(++_0x241062);}(_0x0b20,0x7c));var _0x00b2=function(_0x4ea3cc,_0x4a6745){_0x4ea3cc=_0x4ea3cc-0x0;var _0x451c02=_0x0b20[_0x4ea3cc];return _0x451c02;};'use strict';var multer=require(_0x00b2('0x0'));var util=require('util');var path=require(_0x00b2('0x1'));var timeout=require(_0x00b2('0x2'));var express=require(_0x00b2('0x3'));var router=express[_0x00b2('0x4')]();var fs_extra=require(_0x00b2('0x5'));var auth=require(_0x00b2('0x6'));var interaction=require(_0x00b2('0x7'));var config=require(_0x00b2('0x8'));var controller=require(_0x00b2('0x9'));router[_0x00b2('0xa')]('/',auth[_0x00b2('0xb')](),controller[_0x00b2('0xc')]);router['get'](_0x00b2('0xd'),auth[_0x00b2('0xb')](),controller[_0x00b2('0xe')]);router[_0x00b2('0xf')]('/',auth[_0x00b2('0xb')](),controller[_0x00b2('0x10')]);router[_0x00b2('0x11')](_0x00b2('0xd'),auth['isAuthenticated'](),controller[_0x00b2('0x12')]);router[_0x00b2('0x13')]('/:id',auth[_0x00b2('0xb')](),controller[_0x00b2('0x14')]);module[_0x00b2('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c1fc250..3468a99 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 _0xffb6=['sequelize','exports','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xffb6,0x99));var _0x6ffb=function(_0x4fab3b,_0x2949f2){_0x4fab3b=_0x4fab3b-0x0;var _0x5e7826=_0xffb6[_0x4fab3b];return _0x5e7826;};'use strict';var Sequelize=require(_0x6ffb('0x0'));module[_0x6ffb('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6ffb('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1e66a2){this[_0x6ffb('0x3')](_0x6ffb('0x4'),_0x1e66a2?_0x1e66a2[_0x6ffb('0x5')](''):[]);},'get':function(){return this[_0x6ffb('0x6')](_0x6ffb('0x4'))?this[_0x6ffb('0x6')](_0x6ffb('0x4'))[_0x6ffb('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6ffb('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x6ffb('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ffb('0x2')]}}; \ No newline at end of file +var _0xdaf4=['name','options','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x317822,_0xba3222){var _0x59e915=function(_0x2176c8){while(--_0x2176c8){_0x317822['push'](_0x317822['shift']());}};_0x59e915(++_0xba3222);}(_0xdaf4,0xed));var _0x4daf=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xdaf4[_0x257b0e];return _0x27ac2a;};'use strict';var Sequelize=require(_0x4daf('0x0'));module[_0x4daf('0x1')]={'name':{'type':Sequelize[_0x4daf('0x2')]},'prefix':{'type':Sequelize[_0x4daf('0x2')],'unique':_0x4daf('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2e2b0c){this['setDataValue'](_0x4daf('0x4'),_0x2e2b0c?_0x2e2b0c[_0x4daf('0x5')](''):[]);},'get':function(){return this[_0x4daf('0x6')](_0x4daf('0x4'))?this[_0x4daf('0x6')]('options')[_0x4daf('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x4daf('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4daf('0x2')]},'description':{'type':Sequelize[_0x4daf('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index eca6271..1d73672 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 _0x7af2=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x197b4e,_0x229344){var _0x2d474b=function(_0x158f0d){while(--_0x158f0d){_0x197b4e['push'](_0x197b4e['shift']());}};_0x2d474b(++_0x229344);}(_0x7af2,0x119));var _0x27af=function(_0x3ad00e,_0x37f5f){_0x3ad00e=_0x3ad00e-0x0;var _0x3fe25d=_0x7af2[_0x3ad00e];return _0x3fe25d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['VoiceChanSpy'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='ChanSpies';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x22')]=function(_0x20c155,_0x31eaa9){if(_0x20c155['body']['id']){delete _0x20c155[_0x27af('0x52')]['id'];}return db['VoiceChanSpy'][_0x27af('0x49')]({'where':{'id':_0x20c155[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](saveUpdates(_0x20c155[_0x27af('0x52')],null))['then'](respondWithResult(_0x31eaa9,null))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x53')]=function(_0x4769ff,_0x5bf8b0){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x4769ff[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf8b0,null))[_0x27af('0x23')](removeEntity(_0x5bf8b0,null))[_0x27af('0x44')](handleError(_0x5bf8b0,null));}; \ No newline at end of file +var _0xc678=['type','key','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','VoiceChanSpy','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','sendStatus','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x220688,_0x3c9afc){var _0x12723f=function(_0x2d9184){while(--_0x2d9184){_0x220688['push'](_0x220688['shift']());}};_0x12723f(++_0x3c9afc);}(_0xc678,0x1b4));var _0x8c67=function(_0x2a954c,_0x1a1465){_0x2a954c=_0x2a954c-0x0;var _0x209fa2=_0xc678[_0x2a954c];return _0x209fa2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c67('0x0'));var jsonpatch=require(_0x8c67('0x1'));var rp=require(_0x8c67('0x2'));var moment=require('moment');var BPromise=require(_0x8c67('0x3'));var Mustache=require(_0x8c67('0x4'));var util=require(_0x8c67('0x5'));var path=require(_0x8c67('0x6'));var sox=require('sox');var csv=require(_0x8c67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c67('0x8'));var _=require(_0x8c67('0x9'));var squel=require('squel');var crypto=require(_0x8c67('0xa'));var jsforce=require(_0x8c67('0xb'));var deskjs=require(_0x8c67('0xc'));var toCsv=require(_0x8c67('0x7'));var querystring=require(_0x8c67('0xd'));var Papa=require('papaparse');var Redis=require(_0x8c67('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8c67('0xf'));var as=require(_0x8c67('0x10'));var hardwareService=require(_0x8c67('0x11'));var logger=require('../../config/logger')(_0x8c67('0x12'));var utils=require(_0x8c67('0x13'));var config=require(_0x8c67('0x14'));var licenseUtil=require(_0x8c67('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2feeb5,_0x5822b4){_0x5822b4=_0x5822b4||0xcc;return function(_0x4da441){if(_0x4da441){return _0x2feeb5['sendStatus'](_0x5822b4);}return _0x2feeb5['status'](_0x5822b4)[_0x8c67('0x16')]();};}function respondWithResult(_0x576614,_0x2fa385){_0x2fa385=_0x2fa385||0xc8;return function(_0x5a3bd1){if(_0x5a3bd1){return _0x576614[_0x8c67('0x17')](_0x2fa385)[_0x8c67('0x18')](_0x5a3bd1);}};}function respondWithFilteredResult(_0x28fbb0,_0x3b20df){return function(_0x5b990d){if(_0x5b990d){var _0x3be259=typeof _0x3b20df[_0x8c67('0x19')]===_0x8c67('0x1a')&&typeof _0x3b20df[_0x8c67('0x1b')]==='undefined';var _0x4dbd5c=_0x5b990d[_0x8c67('0x1c')];var _0x3e9ab8=_0x3be259?0x0:_0x3b20df[_0x8c67('0x19')];var _0x544717=_0x3be259?_0x5b990d[_0x8c67('0x1c')]:_0x3b20df[_0x8c67('0x19')]+_0x3b20df['limit'];var _0xf40d1a;if(_0x544717>=_0x4dbd5c){_0x544717=_0x4dbd5c;_0xf40d1a=0xc8;}else{_0xf40d1a=0xce;}_0x28fbb0['status'](_0xf40d1a);return _0x28fbb0[_0x8c67('0x1d')](_0x8c67('0x1e'),_0x3e9ab8+'-'+_0x544717+'/'+_0x4dbd5c)[_0x8c67('0x18')](_0x5b990d);}return null;};}function patchUpdates(_0x2bd6b3){return function(_0x40c1dd){try{jsonpatch['apply'](_0x40c1dd,_0x2bd6b3,!![]);}catch(_0x387a69){return BPromise[_0x8c67('0x1f')](_0x387a69);}return _0x40c1dd['save']();};}function saveUpdates(_0x3a2c3b,_0x5486e8){return function(_0x122304){if(_0x122304){return _0x122304[_0x8c67('0x20')](_0x3a2c3b)[_0x8c67('0x21')](function(_0x3cc3ae){return _0x3cc3ae;});}return null;};}function removeEntity(_0x381942,_0x5dc805){return function(_0x2658a1){if(_0x2658a1){return _0x2658a1[_0x8c67('0x22')]()[_0x8c67('0x21')](function(){var _0xbb787e=_0x2658a1[_0x8c67('0x23')]({'plain':!![]});var _0xf32c63='ChanSpies';return db['UserProfileResource'][_0x8c67('0x22')]({'where':{'type':_0xf32c63,'resourceId':_0xbb787e['id']}})['then'](function(){return _0x2658a1;});})['then'](function(){_0x381942[_0x8c67('0x17')](0xcc)[_0x8c67('0x16')]();});}};}function handleEntityNotFound(_0x2f72ed,_0x506a77){return function(_0x3716e1){if(!_0x3716e1){_0x2f72ed[_0x8c67('0x24')](0x194);}return _0x3716e1;};}function handleError(_0x2e6747,_0x1c8181){_0x1c8181=_0x1c8181||0x1f4;return function(_0x4e87db){logger[_0x8c67('0x25')](_0x4e87db[_0x8c67('0x26')]);if(_0x4e87db[_0x8c67('0x27')]){delete _0x4e87db[_0x8c67('0x27')];}_0x2e6747[_0x8c67('0x17')](_0x1c8181)[_0x8c67('0x28')](_0x4e87db);};}exports[_0x8c67('0x29')]=function(_0x4d095d,_0x16f214){var _0x33f29a={},_0x603d29={},_0x3e428c={'count':0x0,'rows':[]};var _0x1d9bef=_['map'](db['VoiceChanSpy'][_0x8c67('0x2a')],function(_0x1469a3){return{'name':_0x1469a3[_0x8c67('0x2b')],'type':_0x1469a3[_0x8c67('0x2c')][_0x8c67('0x2d')]};});_0x603d29['model']=_['map'](_0x1d9bef,_0x8c67('0x27'));_0x603d29[_0x8c67('0x2e')]=_[_0x8c67('0x2f')](_0x4d095d['query']);_0x603d29[_0x8c67('0x30')]=_[_0x8c67('0x31')](_0x603d29['model'],_0x603d29['query']);_0x33f29a[_0x8c67('0x32')]=_['intersection'](_0x603d29['model'],qs[_0x8c67('0x33')](_0x4d095d[_0x8c67('0x2e')][_0x8c67('0x33')]));_0x33f29a[_0x8c67('0x32')]=_0x33f29a[_0x8c67('0x32')][_0x8c67('0x34')]?_0x33f29a[_0x8c67('0x32')]:_0x603d29[_0x8c67('0x35')];if(!_0x4d095d['query']['hasOwnProperty'](_0x8c67('0x36'))){_0x33f29a['limit']=qs[_0x8c67('0x1b')](_0x4d095d['query'][_0x8c67('0x1b')]);_0x33f29a[_0x8c67('0x19')]=qs[_0x8c67('0x19')](_0x4d095d[_0x8c67('0x2e')]['offset']);}_0x33f29a[_0x8c67('0x37')]=qs[_0x8c67('0x38')](_0x4d095d['query'][_0x8c67('0x38')]);_0x33f29a[_0x8c67('0x39')]=qs[_0x8c67('0x30')](_['pick'](_0x4d095d['query'],_0x603d29[_0x8c67('0x30')]),_0x1d9bef);if(_0x4d095d[_0x8c67('0x2e')]['filter']){_0x33f29a[_0x8c67('0x39')]=_[_0x8c67('0x3a')](_0x33f29a[_0x8c67('0x39')],{'$or':_[_0x8c67('0x3b')](_0x1d9bef,function(_0x4ca856){if(_0x4ca856['type']!==_0x8c67('0x3c')){var _0x14afcc={};_0x14afcc[_0x4ca856['name']]={'$like':'%'+_0x4d095d['query'][_0x8c67('0x3d')]+'%'};return _0x14afcc;}})});}_0x33f29a=_[_0x8c67('0x3a')]({},_0x33f29a,_0x4d095d[_0x8c67('0x3e')]);var _0xd6dc2f={'where':_0x33f29a[_0x8c67('0x39')]};return db[_0x8c67('0x3f')][_0x8c67('0x1c')](_0xd6dc2f)[_0x8c67('0x21')](function(_0x3fa0ae){_0x3e428c[_0x8c67('0x1c')]=_0x3fa0ae;if(_0x4d095d['query'][_0x8c67('0x40')]){_0x33f29a['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x33f29a);})[_0x8c67('0x21')](function(_0x4915cf){_0x3e428c[_0x8c67('0x41')]=_0x4915cf;return _0x3e428c;})[_0x8c67('0x21')](respondWithFilteredResult(_0x16f214,_0x33f29a))[_0x8c67('0x42')](handleError(_0x16f214,null));};exports[_0x8c67('0x43')]=function(_0x956de0,_0x5f207b){var _0x29b2db={'raw':![],'where':{'id':_0x956de0[_0x8c67('0x44')]['id']}},_0x27d655={};_0x27d655[_0x8c67('0x35')]=_['keys'](db[_0x8c67('0x3f')][_0x8c67('0x2a')]);_0x27d655[_0x8c67('0x2e')]=_[_0x8c67('0x2f')](_0x956de0[_0x8c67('0x2e')]);_0x27d655['filters']=_[_0x8c67('0x31')](_0x27d655[_0x8c67('0x35')],_0x27d655[_0x8c67('0x2e')]);_0x29b2db[_0x8c67('0x32')]=_['intersection'](_0x27d655[_0x8c67('0x35')],qs[_0x8c67('0x33')](_0x956de0[_0x8c67('0x2e')][_0x8c67('0x33')]));_0x29b2db[_0x8c67('0x32')]=_0x29b2db[_0x8c67('0x32')]['length']?_0x29b2db[_0x8c67('0x32')]:_0x27d655[_0x8c67('0x35')];if(_0x956de0['query']['includeAll']){_0x29b2db[_0x8c67('0x45')]=[{'all':!![]}];}_0x29b2db=_['merge']({},_0x29b2db,_0x956de0[_0x8c67('0x3e')]);return db['VoiceChanSpy'][_0x8c67('0x46')](_0x29b2db)[_0x8c67('0x21')](handleEntityNotFound(_0x5f207b,null))[_0x8c67('0x21')](respondWithResult(_0x5f207b,null))[_0x8c67('0x42')](handleError(_0x5f207b,null));};exports['create']=function(_0xc74be9,_0x304a6d){return db[_0x8c67('0x3f')][_0x8c67('0x47')](_0xc74be9[_0x8c67('0x48')],{})[_0x8c67('0x21')](function(_0x45bf57){var _0x23800b=_0xc74be9[_0x8c67('0x49')][_0x8c67('0x23')]({'plain':!![]});if(!_0x23800b)throw new Error(_0x8c67('0x4a'));if(_0x23800b[_0x8c67('0x4b')]===_0x8c67('0x49')){var _0x5147cf=_0x45bf57[_0x8c67('0x23')]({'plain':!![]});var _0x180f62=_0x8c67('0x4c');return db[_0x8c67('0x4d')][_0x8c67('0x46')]({'where':{'name':_0x180f62,'userProfileId':_0x23800b['userProfileId']},'raw':!![]})[_0x8c67('0x21')](function(_0x54adae){if(_0x54adae&&_0x54adae['autoAssociation']===0x0){return db[_0x8c67('0x4e')][_0x8c67('0x47')]({'name':_0x5147cf[_0x8c67('0x27')],'resourceId':_0x5147cf['id'],'type':_0x54adae['name'],'sectionId':_0x54adae['id']},{})[_0x8c67('0x21')](function(){return _0x45bf57;});}else{return _0x45bf57;}})['catch'](function(_0x50fb02){logger[_0x8c67('0x25')](_0x8c67('0x4f'),_0x50fb02);throw _0x50fb02;});}return _0x45bf57;})[_0x8c67('0x21')](respondWithResult(_0x304a6d,0xc9))[_0x8c67('0x42')](handleError(_0x304a6d,null));};exports[_0x8c67('0x20')]=function(_0x485ced,_0xc9ff67){if(_0x485ced[_0x8c67('0x48')]['id']){delete _0x485ced['body']['id'];}return db[_0x8c67('0x3f')][_0x8c67('0x46')]({'where':{'id':_0x485ced[_0x8c67('0x44')]['id']}})[_0x8c67('0x21')](handleEntityNotFound(_0xc9ff67,null))[_0x8c67('0x21')](saveUpdates(_0x485ced['body'],null))[_0x8c67('0x21')](respondWithResult(_0xc9ff67,null))[_0x8c67('0x42')](handleError(_0xc9ff67,null));};exports[_0x8c67('0x22')]=function(_0x5f829e,_0x57da09){return db['VoiceChanSpy']['find']({'where':{'id':_0x5f829e[_0x8c67('0x44')]['id']}})[_0x8c67('0x21')](handleEntityNotFound(_0x57da09,null))[_0x8c67('0x21')](removeEntity(_0x57da09,null))[_0x8c67('0x42')](handleError(_0x57da09,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 2bafe4b..325ee24 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 _0xe4fb=['format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','agent','catch','exports','models','define','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','context','from-sip'];(function(_0x1bc9d3,_0x5dc4d5){var _0x24fe17=function(_0x435365){while(--_0x435365){_0x1bc9d3['push'](_0x1bc9d3['shift']());}};_0x24fe17(++_0x5dc4d5);}(_0xe4fb,0x149));var _0xbe4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe4fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbe4f('0x0'));var util=require(_0xbe4f('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x39e054,_0x4e6c2a,_0x40221f){var _0x17f5b0=0x1;var _0x363d68=[];var _0x4e7874={'context':_0x4e6c2a[_0xbe4f('0x2')]||_0xbe4f('0x3'),'exten':util[_0xbe4f('0x4')](_0xbe4f('0x5'),_0x39e054[_0xbe4f('0x6')],_0x40221f),'type':_0xbe4f('0x7'),'isApp':![],'ChanSpyId':_0x39e054['id'],'UserId':_0x4e6c2a['id']};_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0xa'),'appdata':util['format'](_0xbe4f('0xb'),'chanspy'),'priority':_0x17f5b0++},_0x4e7874));if(_0x39e054[_0xbe4f('0xc')]){_0x363d68['push'](_[_0xbe4f('0x9')]({'app':_0xbe4f('0xd'),'appdata':util[_0xbe4f('0x4')]('${UNIQUEID}.%s,a',_0x39e054[_0xbe4f('0xe')]),'priority':_0x17f5b0++},_0x4e7874));}if(_0x39e054[_0xbe4f('0xf')]){_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0x10'),'appdata':_0x39e054[_0xbe4f('0x11')],'priority':_0x17f5b0++},_0x4e7874));}_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0x12'),'appdata':util[_0xbe4f('0x4')](_0xbe4f('0x13'),_0x4e6c2a[_0xbe4f('0x14')],_0x39e054[_0xbe4f('0x15')]?_0x39e054['options'][_0xbe4f('0x16')](''):''),'priority':_0x17f5b0++},_0x4e7874));if(_0x39e054[_0xbe4f('0xc')]){_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0x17'),'priority':_0x17f5b0++},_0x4e7874));}return _0x363d68;};var getChanSpyApplications=function(_0x183614,_0x354724){var _0x3031c6=[];for(var _0x9fe442=0x0,_0x4b99bc=0x1;_0x9fe442<_0x354724[_0xbe4f('0x18')];_0x9fe442++,_0x4b99bc=0x1){_0x3031c6=_0x3031c6[_0xbe4f('0x19')](getUserApplications(_0x183614,_0x354724[_0x9fe442],_0x354724[_0x9fe442]['internal']));if(_0x354724[_0x9fe442][_0xbe4f('0x1a')]!=_0x354724[_0x9fe442][_0xbe4f('0x14')]){_0x3031c6=_0x3031c6['concat'](getUserApplications(_0x183614,_0x354724[_0x9fe442],_0x354724[_0x9fe442][_0xbe4f('0x14')]));}}return _0x3031c6;};var getChanSpyPromise=function(_0x33700b,_0x18a3ad){return new BPromise(function(_0x4e5839,_0x1050ee){return _0x33700b['User']['findAll']({'attributes':['id',_0xbe4f('0x14'),_0xbe4f('0x1a')],'where':{'role':_0xbe4f('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x122873){if(_0x122873){return _0x4e5839(getChanSpyApplications(_0x18a3ad,_0x122873));}return _0x4e5839([]);})[_0xbe4f('0x1c')](function(_0x4ce244){_0x1050ee(_0x4ce244);});});};module[_0xbe4f('0x1d')]=function(_0x4c313c,_0x154c42){var _0x435e1e=_0x4c313c[_0xbe4f('0x1e')];return _0x4c313c[_0xbe4f('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0xbe4f('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4003c6,_0x10fc2e,_0x2aeedc){return getChanSpyPromise(_0x435e1e,_0x4003c6)[_0xbe4f('0x21')](function(_0x2fc0b3){if(_0x2fc0b3&&_0x2fc0b3[_0xbe4f('0x18')]){return _0x435e1e[_0xbe4f('0x22')][_0xbe4f('0x23')](_0x2fc0b3);}})[_0xbe4f('0x21')](function(){_0x2aeedc();})[_0xbe4f('0x1c')](function(_0x164e9c){_0x2aeedc(_0x164e9c);});},'afterUpdate':function(_0x480078,_0x50fa49,_0x181249){return _0x435e1e[_0xbe4f('0x22')][_0xbe4f('0x24')]({'where':{'ChanSpyId':_0x480078['id']}})[_0xbe4f('0x21')](function(){return getChanSpyPromise(_0x435e1e,_0x480078);})[_0xbe4f('0x21')](function(_0x281359){if(_0x281359&&_0x281359[_0xbe4f('0x18')]){return _0x435e1e[_0xbe4f('0x22')][_0xbe4f('0x23')](_0x281359);}})['then'](function(){_0x181249();})[_0xbe4f('0x1c')](function(_0x2127eb){_0x181249(_0x2127eb);});},'afterDestroy':function(_0x4e2ec6,_0x43e067,_0x2512a0){return _0x435e1e['VoiceExtension'][_0xbe4f('0x24')]({'where':{'ChanSpyId':_0x4e2ec6['id']}})[_0xbe4f('0x21')](function(){_0x2512a0();})[_0xbe4f('0x1c')](function(_0x4bd64b){_0x2512a0(_0x4bd64b);});}}});}; \ No newline at end of file +var _0x848d=['./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','auth','Authenticate','password','ChanSpy','SIP/%s,%s','join','StopMixMonitor','concat','internal','name','User','findAll','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird'];(function(_0x297f09,_0x4c5111){var _0x6ed83a=function(_0x31b926){while(--_0x31b926){_0x297f09['push'](_0x297f09['shift']());}};_0x6ed83a(++_0x4c5111);}(_0x848d,0x6f));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd848('0x0'));var util=require(_0xd848('0x1'));var BPromise=require(_0xd848('0x2'));var attributes=require(_0xd848('0x3'));var getUserApplications=function(_0x3a18a0,_0x3aec00,_0x3d8b3c){var _0x554acc=0x1;var _0x449a3b=[];var _0x31297b={'context':_0x3aec00[_0xd848('0x4')]||_0xd848('0x5'),'exten':util[_0xd848('0x6')](_0xd848('0x7'),_0x3a18a0[_0xd848('0x8')],_0x3d8b3c),'type':'system','isApp':![],'ChanSpyId':_0x3a18a0['id'],'UserId':_0x3aec00['id']};_0x449a3b[_0xd848('0x9')](_[_0xd848('0xa')]({'app':_0xd848('0xb'),'appdata':util[_0xd848('0x6')](_0xd848('0xc'),_0xd848('0xd')),'priority':_0x554acc++},_0x31297b));if(_0x3a18a0[_0xd848('0xe')]){_0x449a3b['push'](_[_0xd848('0xa')]({'app':_0xd848('0xf'),'appdata':util[_0xd848('0x6')]('${UNIQUEID}.%s,a',_0x3a18a0['recordingFormat']),'priority':_0x554acc++},_0x31297b));}if(_0x3a18a0[_0xd848('0x10')]){_0x449a3b[_0xd848('0x9')](_[_0xd848('0xa')]({'app':_0xd848('0x11'),'appdata':_0x3a18a0[_0xd848('0x12')],'priority':_0x554acc++},_0x31297b));}_0x449a3b['push'](_[_0xd848('0xa')]({'app':_0xd848('0x13'),'appdata':util[_0xd848('0x6')](_0xd848('0x14'),_0x3aec00['name'],_0x3a18a0['options']?_0x3a18a0['options'][_0xd848('0x15')](''):''),'priority':_0x554acc++},_0x31297b));if(_0x3a18a0[_0xd848('0xe')]){_0x449a3b[_0xd848('0x9')](_['merge']({'app':_0xd848('0x16'),'priority':_0x554acc++},_0x31297b));}return _0x449a3b;};var getChanSpyApplications=function(_0xe2d4c7,_0x32d551){var _0x186c68=[];for(var _0x5cced3=0x0,_0x1383fb=0x1;_0x5cced3<_0x32d551['length'];_0x5cced3++,_0x1383fb=0x1){_0x186c68=_0x186c68[_0xd848('0x17')](getUserApplications(_0xe2d4c7,_0x32d551[_0x5cced3],_0x32d551[_0x5cced3][_0xd848('0x18')]));if(_0x32d551[_0x5cced3][_0xd848('0x18')]!=_0x32d551[_0x5cced3][_0xd848('0x19')]){_0x186c68=_0x186c68[_0xd848('0x17')](getUserApplications(_0xe2d4c7,_0x32d551[_0x5cced3],_0x32d551[_0x5cced3][_0xd848('0x19')]));}}return _0x186c68;};var getChanSpyPromise=function(_0x2decd8,_0x380cce){return new BPromise(function(_0x4dbff5,_0x46b062){return _0x2decd8[_0xd848('0x1a')][_0xd848('0x1b')]({'attributes':['id',_0xd848('0x19'),_0xd848('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xd848('0x1c')](function(_0x31e6a8){if(_0x31e6a8){return _0x4dbff5(getChanSpyApplications(_0x380cce,_0x31e6a8));}return _0x4dbff5([]);})[_0xd848('0x1d')](function(_0x1bd1c5){_0x46b062(_0x1bd1c5);});});};module[_0xd848('0x1e')]=function(_0x3bff10,_0x3182ac){var _0x26b36d=_0x3bff10[_0xd848('0x1f')];return _0x3bff10['define'](_0xd848('0x20'),attributes,{'tableName':_0xd848('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x198f5a,_0x62f010,_0xaa9948){return getChanSpyPromise(_0x26b36d,_0x198f5a)[_0xd848('0x1c')](function(_0x1bcb23){if(_0x1bcb23&&_0x1bcb23['length']){return _0x26b36d[_0xd848('0x22')][_0xd848('0x23')](_0x1bcb23);}})['then'](function(){_0xaa9948();})[_0xd848('0x1d')](function(_0x2db94e){_0xaa9948(_0x2db94e);});},'afterUpdate':function(_0x419b56,_0x5737f3,_0x15f44e){return _0x26b36d['VoiceExtension'][_0xd848('0x24')]({'where':{'ChanSpyId':_0x419b56['id']}})[_0xd848('0x1c')](function(){return getChanSpyPromise(_0x26b36d,_0x419b56);})[_0xd848('0x1c')](function(_0x3108b0){if(_0x3108b0&&_0x3108b0[_0xd848('0x25')]){return _0x26b36d[_0xd848('0x22')]['bulkCreate'](_0x3108b0);}})[_0xd848('0x1c')](function(){_0x15f44e();})['catch'](function(_0x730411){_0x15f44e(_0x730411);});},'afterDestroy':function(_0x1805f7,_0x15a1c5,_0x26255a){return _0x26b36d[_0xd848('0x22')][_0xd848('0x24')]({'where':{'ChanSpyId':_0x1805f7['id']}})[_0xd848('0x1c')](function(){_0x26255a();})[_0xd848('0x1d')](function(_0xa492ed){_0x26255a(_0xa492ed);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f7d4490..95f15ac 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 _0xf403=['error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf403,0x1d3));var _0x3f40=function(_0x52ebbd,_0x2ed044){_0x52ebbd=_0x52ebbd-0x0;var _0x54429f=_0xf403[_0x52ebbd];return _0x54429f;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var moment=require(_0x3f40('0x1'));var BPromise=require(_0x3f40('0x2'));var rs=require(_0x3f40('0x3'));var fs=require('fs');var Redis=require(_0x3f40('0x4'));var db=require(_0x3f40('0x5'))['db'];var utils=require(_0x3f40('0x6'));var logger=require(_0x3f40('0x7'))(_0x3f40('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f40('0x9')][_0x3f40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24fb9e,_0x1f21fa,_0x5878f9){return new BPromise(function(_0x1dffe8,_0x4c1694){return client['request'](_0x24fb9e,_0x5878f9)[_0x3f40('0xb')](function(_0xb4a314){logger[_0x3f40('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,'request\x20sent');logger[_0x3f40('0xd')](_0x3f40('0xe'),_0x1f21fa,_0x3f40('0xf'),JSON['stringify'](_0xb4a314));if(_0xb4a314[_0x3f40('0x10')]){if(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x11')]===0x1f4){logger['error'](_0x3f40('0x12'),_0x1f21fa,_0xb4a314['error'][_0x3f40('0x13')]);return _0x4c1694(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}logger[_0x3f40('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);return _0x1dffe8(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}else{logger[_0x3f40('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,_0x3f40('0xf'));_0x1dffe8(_0xb4a314[_0x3f40('0x14')]['message']);}})['catch'](function(_0x54f596){logger[_0x3f40('0x10')](_0x3f40('0x12'),_0x1f21fa,_0x54f596);_0x4c1694(_0x54f596);});});} \ No newline at end of file +var _0x8b29=['then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x5f10dc,_0x22b1eb){var _0xca8f0c=function(_0x3fca3b){while(--_0x3fca3b){_0x5f10dc['push'](_0x5f10dc['shift']());}};_0xca8f0c(++_0x22b1eb);}(_0x8b29,0xbe));var _0x98b2=function(_0x57d649,_0x447f6d){_0x57d649=_0x57d649-0x0;var _0x5b4748=_0x8b29[_0x57d649];return _0x5b4748;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var moment=require(_0x98b2('0x1'));var BPromise=require(_0x98b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98b2('0x3'))['db'];var utils=require(_0x98b2('0x4'));var logger=require('../../config/logger')(_0x98b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x98b2('0x6'));var client=jayson[_0x98b2('0x7')][_0x98b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7ef5,_0x221cee,_0x2cd0cb){return new BPromise(function(_0x417ca6,_0x388827){return client[_0x98b2('0x9')](_0x3e7ef5,_0x2cd0cb)[_0x98b2('0xa')](function(_0x501b51){logger['info'](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));logger[_0x98b2('0xd')](_0x98b2('0xe'),_0x221cee,_0x98b2('0xc'),JSON[_0x98b2('0xf')](_0x501b51));if(_0x501b51['error']){if(_0x501b51[_0x98b2('0x10')][_0x98b2('0x11')]===0x1f4){logger['error'](_0x98b2('0xb'),_0x221cee,_0x501b51[_0x98b2('0x10')][_0x98b2('0x12')]);return _0x388827(_0x501b51['error']['message']);}logger[_0x98b2('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x221cee,_0x501b51[_0x98b2('0x10')]['message']);return _0x417ca6(_0x501b51['error']['message']);}else{logger[_0x98b2('0x13')](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));_0x417ca6(_0x501b51['result']['message']);}})['catch'](function(_0x389d22){logger[_0x98b2('0x10')](_0x98b2('0xb'),_0x221cee,_0x389d22);_0x388827(_0x389d22);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e4e537c..43755e9 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 _0x89c3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x89c3,0x1f4));var _0x389c=function(_0x2c65f2,_0x2b8b6d){_0x2c65f2=_0x2c65f2-0x0;var _0xb0f8be=_0x89c3[_0x2c65f2];return _0xb0f8be;};'use strict';var multer=require(_0x389c('0x0'));var util=require('util');var path=require(_0x389c('0x1'));var timeout=require(_0x389c('0x2'));var express=require(_0x389c('0x3'));var router=express[_0x389c('0x4')]();var fs_extra=require(_0x389c('0x5'));var auth=require(_0x389c('0x6'));var interaction=require(_0x389c('0x7'));var config=require(_0x389c('0x8'));var controller=require(_0x389c('0x9'));router[_0x389c('0xa')]('/',auth['isAuthenticated'](),controller[_0x389c('0xb')]);router[_0x389c('0xa')]('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0xd')]);router[_0x389c('0xe')]('/',auth[_0x389c('0xc')](),controller[_0x389c('0xf')]);router['put'](_0x389c('0x10'),auth['isAuthenticated'](),controller[_0x389c('0x11')]);router[_0x389c('0x12')](_0x389c('0x10'),auth[_0x389c('0xc')](),controller[_0x389c('0x13')]);module[_0x389c('0x14')]=router; \ No newline at end of file +var _0x7ca6=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0xd7e690,_0x2c6d4f){var _0x587c9b=function(_0x42cb01){while(--_0x42cb01){_0xd7e690['push'](_0xd7e690['shift']());}};_0x587c9b(++_0x2c6d4f);}(_0x7ca6,0x143));var _0x67ca=function(_0xbc2760,_0x22f739){_0xbc2760=_0xbc2760-0x0;var _0x1515f6=_0x7ca6[_0xbc2760];return _0x1515f6;};'use strict';var multer=require('multer');var util=require(_0x67ca('0x0'));var path=require(_0x67ca('0x1'));var timeout=require('connect-timeout');var express=require(_0x67ca('0x2'));var router=express[_0x67ca('0x3')]();var fs_extra=require(_0x67ca('0x4'));var auth=require(_0x67ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x67ca('0x6'));var controller=require(_0x67ca('0x7'));router[_0x67ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x67ca('0x9')]);router['get'](_0x67ca('0xa'),auth[_0x67ca('0xb')](),controller[_0x67ca('0xc')]);router[_0x67ca('0xd')]('/',auth[_0x67ca('0xb')](),controller[_0x67ca('0xe')]);router[_0x67ca('0xf')]('/:id',auth[_0x67ca('0xb')](),controller[_0x67ca('0x10')]);router[_0x67ca('0x11')]('/:id',auth[_0x67ca('0xb')](),controller[_0x67ca('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e0eea10..6ed5439 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 _0xfba2=['STRING','name','BOOLEAN','exports'];(function(_0xb9bb51,_0x1e153a){var _0x18a29a=function(_0x187b83){while(--_0x187b83){_0xb9bb51['push'](_0xb9bb51['shift']());}};_0x18a29a(++_0x1e153a);}(_0xfba2,0x11b));var _0x2fba=function(_0x36d72c,_0x54aa83){_0x36d72c=_0x36d72c-0x0;var _0x75c5b2=_0xfba2[_0x36d72c];return _0x75c5b2;};'use strict';var Sequelize=require('sequelize');module[_0x2fba('0x0')]={'name':{'type':Sequelize[_0x2fba('0x1')],'unique':_0x2fba('0x2')},'description':{'type':Sequelize[_0x2fba('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2fba('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3017=['name','BOOLEAN','sequelize','STRING'];(function(_0x5d20a8,_0xc1d167){var _0x454b43=function(_0x4ee2cc){while(--_0x4ee2cc){_0x5d20a8['push'](_0x5d20a8['shift']());}};_0x454b43(++_0xc1d167);}(_0x3017,0x1ba));var _0x7301=function(_0x1da42f,_0x23dc53){_0x1da42f=_0x1da42f-0x0;var _0x458c83=_0x3017[_0x1da42f];return _0x458c83;};'use strict';var Sequelize=require(_0x7301('0x0'));module['exports']={'name':{'type':Sequelize[_0x7301('0x1')],'unique':_0x7301('0x2')},'description':{'type':Sequelize[_0x7301('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7301('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 e8f3e52..88358bc 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 _0x906d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','params','length','include','find','create','body','readFileSync','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','root','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1b8f6f,_0x3dacc0){var _0x15410d=function(_0x1071d1){while(--_0x1071d1){_0x1b8f6f['push'](_0x1b8f6f['shift']());}};_0x15410d(++_0x3dacc0);}(_0x906d,0x178));var _0xd906=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x906d[_0x5e238b];return _0x389bea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd906('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd906('0x1'));var rp=require(_0xd906('0x2'));var moment=require('moment');var BPromise=require(_0xd906('0x3'));var Mustache=require(_0xd906('0x4'));var util=require(_0xd906('0x5'));var path=require(_0xd906('0x6'));var sox=require(_0xd906('0x7'));var csv=require(_0xd906('0x8'));var ejs=require(_0xd906('0x9'));var fs=require('fs');var fs_extra=require(_0xd906('0xa'));var _=require(_0xd906('0xb'));var squel=require(_0xd906('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd906('0x8'));var querystring=require('querystring');var Papa=require(_0xd906('0xd'));var Redis=require('ioredis');var authService=require(_0xd906('0xe'));var qs=require(_0xd906('0xf'));var as=require(_0xd906('0x10'));var hardwareService=require(_0xd906('0x11'));var logger=require(_0xd906('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd906('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd906('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd906('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa50c6,_0xa7bb02,_0xc8e392,_0x1ccf4f){return new BPromise(function(_0x59e023,_0x2ef849){var _0x51653a=_0x1ccf4f||client;return _0x51653a[_0xd906('0x16')](_0xa50c6,_0xc8e392)[_0xd906('0x17')](function(_0x348266){logger[_0xd906('0x18')](_0xd906('0x19'),_0xa7bb02,_0xd906('0x1a'));logger[_0xd906('0x1b')](_0xd906('0x1c'),_0xa7bb02,'request\x20sent',JSON['stringify'](_0x348266));if(_0x348266[_0xd906('0x1d')]){if(_0x348266[_0xd906('0x1d')][_0xd906('0x1e')]===0x1f4){logger[_0xd906('0x1d')](_0xd906('0x19'),_0xa7bb02,_0x348266['error'][_0xd906('0x1f')]);return _0x2ef849(_0x348266[_0xd906('0x1d')][_0xd906('0x1f')]);}logger['error'](_0xd906('0x19'),_0xa7bb02,_0x348266[_0xd906('0x1d')][_0xd906('0x1f')]);return _0x59e023(_0x348266[_0xd906('0x1d')][_0xd906('0x1f')]);}else{logger['info'](_0xd906('0x19'),_0xa7bb02,_0xd906('0x1a'));_0x59e023(_0x348266['result'][_0xd906('0x1f')]);}})[_0xd906('0x20')](function(_0x498885){logger['error'](_0xd906('0x19'),_0xa7bb02,_0x498885);_0x2ef849(_0x498885);});});}function respondWithStatusCode(_0x20885f,_0x3419eb){_0x3419eb=_0x3419eb||0xcc;return function(_0x47c184){if(_0x47c184){return _0x20885f[_0xd906('0x21')](_0x3419eb);}return _0x20885f[_0xd906('0x22')](_0x3419eb)[_0xd906('0x23')]();};}function respondWithResult(_0x1de744,_0x29dee7){_0x29dee7=_0x29dee7||0xc8;return function(_0x98bd33){if(_0x98bd33){return _0x1de744[_0xd906('0x22')](_0x29dee7)[_0xd906('0x24')](_0x98bd33);}};}function respondWithFilteredResult(_0x4ec25c,_0x4a559d){return function(_0x1b5d19){if(_0x1b5d19){var _0x1e4aba=typeof _0x4a559d[_0xd906('0x25')]===_0xd906('0x26')&&typeof _0x4a559d[_0xd906('0x27')]===_0xd906('0x26');var _0x61202c=_0x1b5d19[_0xd906('0x28')];var _0x2c5852=_0x1e4aba?0x0:_0x4a559d[_0xd906('0x25')];var _0x416deb=_0x1e4aba?_0x1b5d19[_0xd906('0x28')]:_0x4a559d[_0xd906('0x25')]+_0x4a559d[_0xd906('0x27')];var _0x394c6b;if(_0x416deb>=_0x61202c){_0x416deb=_0x61202c;_0x394c6b=0xc8;}else{_0x394c6b=0xce;}_0x4ec25c['status'](_0x394c6b);return _0x4ec25c[_0xd906('0x29')](_0xd906('0x2a'),_0x2c5852+'-'+_0x416deb+'/'+_0x61202c)[_0xd906('0x24')](_0x1b5d19);}return null;};}function patchUpdates(_0x93af4a){return function(_0x1d2722){try{jsonpatch[_0xd906('0x2b')](_0x1d2722,_0x93af4a,!![]);}catch(_0x1faa29){return BPromise[_0xd906('0x2c')](_0x1faa29);}return _0x1d2722[_0xd906('0x2d')]();};}function saveUpdates(_0x3fd30c,_0x5dde71){return function(_0x141787){if(_0x141787){return _0x141787[_0xd906('0x2e')](_0x3fd30c)[_0xd906('0x17')](function(_0x3388e5){return _0x3388e5;});}return null;};}function removeEntity(_0x3e78a5,_0x3d1388){return function(_0xe624bf){if(_0xe624bf){return _0xe624bf['destroy']()[_0xd906('0x17')](function(){var _0x6562d8=_0xe624bf[_0xd906('0x2f')]({'plain':!![]});var _0x4b0f37=_0xd906('0x30');return db[_0xd906('0x31')][_0xd906('0x32')]({'where':{'type':_0x4b0f37,'resourceId':_0x6562d8['id']}})[_0xd906('0x17')](function(){return _0xe624bf;});})[_0xd906('0x17')](function(){_0x3e78a5[_0xd906('0x22')](0xcc)[_0xd906('0x23')]();});}};}function handleEntityNotFound(_0x216f5e,_0x1118d9){return function(_0x21f726){if(!_0x21f726){_0x216f5e[_0xd906('0x21')](0x194);}return _0x21f726;};}function handleError(_0x5dcfdb,_0x171f82){_0x171f82=_0x171f82||0x1f4;return function(_0x41224c){logger[_0xd906('0x1d')](_0x41224c[_0xd906('0x33')]);if(_0x41224c[_0xd906('0x34')]){delete _0x41224c[_0xd906('0x34')];}_0x5dcfdb[_0xd906('0x22')](_0x171f82)[_0xd906('0x35')](_0x41224c);};}exports['index']=function(_0x23fe10,_0xb3be12){var _0x43a332={},_0x362a45={},_0x272745={'count':0x0,'rows':[]};var _0x2abc87=_['map'](db[_0xd906('0x36')][_0xd906('0x37')],function(_0x40fb97){return{'name':_0x40fb97[_0xd906('0x38')],'type':_0x40fb97[_0xd906('0x39')][_0xd906('0x3a')]};});_0x362a45[_0xd906('0x3b')]=_[_0xd906('0x3c')](_0x2abc87,_0xd906('0x34'));_0x362a45['query']=_[_0xd906('0x3d')](_0x23fe10[_0xd906('0x3e')]);_0x362a45[_0xd906('0x3f')]=_[_0xd906('0x40')](_0x362a45[_0xd906('0x3b')],_0x362a45[_0xd906('0x3e')]);_0x43a332[_0xd906('0x41')]=_[_0xd906('0x40')](_0x362a45[_0xd906('0x3b')],qs[_0xd906('0x42')](_0x23fe10[_0xd906('0x3e')][_0xd906('0x42')]));_0x43a332[_0xd906('0x41')]=_0x43a332[_0xd906('0x41')]['length']?_0x43a332[_0xd906('0x41')]:_0x362a45[_0xd906('0x3b')];if(!_0x23fe10[_0xd906('0x3e')][_0xd906('0x43')]('nolimit')){_0x43a332[_0xd906('0x27')]=qs[_0xd906('0x27')](_0x23fe10[_0xd906('0x3e')]['limit']);_0x43a332[_0xd906('0x25')]=qs[_0xd906('0x25')](_0x23fe10[_0xd906('0x3e')][_0xd906('0x25')]);}_0x43a332['order']=qs['sort'](_0x23fe10[_0xd906('0x3e')][_0xd906('0x44')]);_0x43a332[_0xd906('0x45')]=qs['filters'](_[_0xd906('0x46')](_0x23fe10[_0xd906('0x3e')],_0x362a45[_0xd906('0x3f')]),_0x2abc87);if(_0x23fe10[_0xd906('0x3e')]['filter']){_0x43a332[_0xd906('0x45')]=_['merge'](_0x43a332[_0xd906('0x45')],{'$or':_['map'](_0x2abc87,function(_0x171a89){if(_0x171a89[_0xd906('0x39')]!==_0xd906('0x47')){var _0x2706b9={};_0x2706b9[_0x171a89['name']]={'$like':'%'+_0x23fe10[_0xd906('0x3e')][_0xd906('0x48')]+'%'};return _0x2706b9;}})});}_0x43a332=_[_0xd906('0x49')]({},_0x43a332,_0x23fe10['options']);var _0x949e43={'where':_0x43a332[_0xd906('0x45')]};return db['VoiceContext'][_0xd906('0x28')](_0x949e43)['then'](function(_0xebcea4){_0x272745[_0xd906('0x28')]=_0xebcea4;if(_0x23fe10['query'][_0xd906('0x4a')]){_0x43a332['include']=[{'all':!![]}];}return db['VoiceContext'][_0xd906('0x4b')](_0x43a332);})[_0xd906('0x17')](function(_0x3a343c){_0x272745[_0xd906('0x4c')]=_0x3a343c;return _0x272745;})[_0xd906('0x17')](respondWithFilteredResult(_0xb3be12,_0x43a332))[_0xd906('0x20')](handleError(_0xb3be12,null));};exports['show']=function(_0x5361ef,_0x4b9e54){var _0x256804={'raw':![],'where':{'id':_0x5361ef[_0xd906('0x4d')]['id']}},_0x45dfca={};_0x45dfca[_0xd906('0x3b')]=_[_0xd906('0x3d')](db['VoiceContext'][_0xd906('0x37')]);_0x45dfca[_0xd906('0x3e')]=_[_0xd906('0x3d')](_0x5361ef[_0xd906('0x3e')]);_0x45dfca['filters']=_['intersection'](_0x45dfca[_0xd906('0x3b')],_0x45dfca[_0xd906('0x3e')]);_0x256804[_0xd906('0x41')]=_[_0xd906('0x40')](_0x45dfca['model'],qs['fields'](_0x5361ef['query'][_0xd906('0x42')]));_0x256804['attributes']=_0x256804[_0xd906('0x41')][_0xd906('0x4e')]?_0x256804[_0xd906('0x41')]:_0x45dfca[_0xd906('0x3b')];if(_0x5361ef[_0xd906('0x3e')]['includeAll']){_0x256804[_0xd906('0x4f')]=[{'all':!![]}];}_0x256804=_[_0xd906('0x49')]({},_0x256804,_0x5361ef['options']);return db[_0xd906('0x36')][_0xd906('0x50')](_0x256804)[_0xd906('0x17')](handleEntityNotFound(_0x4b9e54,null))[_0xd906('0x17')](respondWithResult(_0x4b9e54,null))['catch'](handleError(_0x4b9e54,null));};exports[_0xd906('0x51')]=function(_0x5ab0a1,_0x4ca77c,_0x19f8da){var _0x51c50b;return db['VoiceContext'][_0xd906('0x51')](_0x5ab0a1[_0xd906('0x52')],{'raw':!![]})[_0xd906('0x17')](function(_0x4c71b6){_0x51c50b=_0x4c71b6;return db[_0xd906('0x36')][_0xd906('0x4b')]({'raw':!![]});})[_0xd906('0x17')](function(_0x11b8d4){var _0x33ee85=fs[_0xd906('0x53')](path[_0xd906('0x54')](config['root'],_0xd906('0x55')),'utf8');var _0x20cef3=ejs[_0xd906('0x56')](_0x33ee85,{'contexts':_0x11b8d4||[]});fs[_0xd906('0x57')](_0xd906('0x58'),_0x20cef3);})[_0xd906('0x17')](function(){return respondWithRpcPromise(_0xd906('0x59'),_0xd906('0x51'),{'module':_0xd906('0x5a')});})['then'](function(){var _0x5ab68f=_0x5ab0a1[_0xd906('0x5b')][_0xd906('0x2f')]({'plain':!![]});if(!_0x5ab68f)throw new Error(_0xd906('0x5c'));if(_0x5ab68f[_0xd906('0x5d')]===_0xd906('0x5b')){var _0x12e48d=_0x51c50b[_0xd906('0x2f')]({'plain':!![]});return db[_0xd906('0x5e')]['find']({'where':{'name':_0xd906('0x30'),'userProfileId':_0x5ab68f[_0xd906('0x5f')]},'raw':!![]})[_0xd906('0x17')](function(_0x2e1ac5){if(_0x2e1ac5&&_0x2e1ac5[_0xd906('0x60')]===0x0){return db['UserProfileResource'][_0xd906('0x51')]({'name':_0x12e48d[_0xd906('0x34')],'resourceId':_0x12e48d['id'],'type':_0x2e1ac5['name'],'sectionId':_0x2e1ac5['id']},{})[_0xd906('0x17')](function(){return _0x51c50b;});}else{return _0x51c50b;}})[_0xd906('0x20')](function(_0x41724d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41724d);throw _0x41724d;});}return _0x51c50b;})['then'](respondWithResult(_0x4ca77c,0xc9))[_0xd906('0x20')](handleError(_0x4ca77c,null));};exports['update']=function(_0xbf20ee,_0x1281dc,_0x39124a){var _0x1034a0;return db[_0xd906('0x36')][_0xd906('0x50')]({'where':{'id':_0xbf20ee[_0xd906('0x4d')]['id']}})[_0xd906('0x17')](handleEntityNotFound(_0x1281dc,null))[_0xd906('0x17')](saveUpdates(_0xbf20ee['body'],null))[_0xd906('0x17')](function(_0x1c7e7c){if(_0x1c7e7c){_0x1034a0=_0x1c7e7c;return db['VoiceContext'][_0xd906('0x4b')]({'raw':!![]});}})[_0xd906('0x17')](function(_0x10ec8b){var _0x5045b7=fs[_0xd906('0x53')](path[_0xd906('0x54')](config[_0xd906('0x61')],_0xd906('0x55')),'utf8');var _0x304a4a=ejs['render'](_0x5045b7,{'contexts':_0x10ec8b||[]});fs[_0xd906('0x57')](_0xd906('0x58'),_0x304a4a);})[_0xd906('0x17')](function(){return respondWithRpcPromise(_0xd906('0x59'),_0xd906('0x2e'),{'module':'chan_sip.so'});})[_0xd906('0x17')](function(){return _0x1034a0;})[_0xd906('0x17')](respondWithResult(_0x1281dc,null))[_0xd906('0x20')](handleError(_0x1281dc,null));};exports['destroy']=function(_0x472753,_0x43a782,_0x22f111){var _0x17876a;return db[_0xd906('0x36')][_0xd906('0x50')]({'where':{'id':_0x472753[_0xd906('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43a782,null))['then'](removeEntity(_0x43a782,null))[_0xd906('0x17')](function(){return db[_0xd906('0x36')]['findAll']({'raw':!![]});})[_0xd906('0x17')](function(_0x1a2007){var _0x4518ee=fs['readFileSync'](path['join'](config[_0xd906('0x61')],_0xd906('0x55')),'utf8');var _0x1349ea=ejs[_0xd906('0x56')](_0x4518ee,{'contexts':_0x1a2007});fs[_0xd906('0x57')](_0xd906('0x58'),_0x1349ea);return respondWithRpcPromise(_0xd906('0x59'),_0xd906('0x32'),{'module':_0xd906('0x5a')});})['catch'](handleError(_0x43a782,null));}; \ No newline at end of file +var _0x6183=['body','join','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','user','userProfileId','autoAssociation','readFileSync','root','render','chan_sip.so','rimraf','zip-dir','fast-json-patch','moment','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/license/util','jayson/promise','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','sendStatus','name','send','index','VoiceContext','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','fields','find'];(function(_0xeee73,_0x5c166b){var _0x342414=function(_0x10b3f2){while(--_0x10b3f2){_0xeee73['push'](_0xeee73['shift']());}};_0x342414(++_0x5c166b);}(_0x6183,0x19b));var _0x3618=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x6183[_0x305b20];return _0x26d64a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3618('0x0'));var zipdir=require(_0x3618('0x1'));var jsonpatch=require(_0x3618('0x2'));var rp=require('request-promise');var moment=require(_0x3618('0x3'));var BPromise=require(_0x3618('0x4'));var Mustache=require(_0x3618('0x5'));var util=require(_0x3618('0x6'));var path=require(_0x3618('0x7'));var sox=require(_0x3618('0x8'));var csv=require(_0x3618('0x9'));var ejs=require(_0x3618('0xa'));var fs=require('fs');var fs_extra=require(_0x3618('0xb'));var _=require(_0x3618('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3618('0xd'));var deskjs=require(_0x3618('0xe'));var toCsv=require(_0x3618('0x9'));var querystring=require(_0x3618('0xf'));var Papa=require(_0x3618('0x10'));var Redis=require(_0x3618('0x11'));var authService=require(_0x3618('0x12'));var qs=require(_0x3618('0x13'));var as=require(_0x3618('0x14'));var hardwareService=require(_0x3618('0x15'));var logger=require(_0x3618('0x16'))(_0x3618('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3618('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3618('0x19'));var client=jayson[_0x3618('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf30,_0x351a81,_0x638c87,_0x2943a6){return new BPromise(function(_0x35cc8b,_0x2ad09d){var _0x186a53=_0x2943a6||client;return _0x186a53[_0x3618('0x1b')](_0x32bf30,_0x638c87)['then'](function(_0x2a6034){logger['info'](_0x3618('0x1c'),_0x351a81,_0x3618('0x1d'));logger[_0x3618('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x351a81,'request\x20sent',JSON['stringify'](_0x2a6034));if(_0x2a6034[_0x3618('0x1f')]){if(_0x2a6034[_0x3618('0x1f')][_0x3618('0x20')]===0x1f4){logger[_0x3618('0x1f')](_0x3618('0x1c'),_0x351a81,_0x2a6034[_0x3618('0x1f')]['message']);return _0x2ad09d(_0x2a6034[_0x3618('0x1f')][_0x3618('0x21')]);}logger['error'](_0x3618('0x1c'),_0x351a81,_0x2a6034[_0x3618('0x1f')][_0x3618('0x21')]);return _0x35cc8b(_0x2a6034['error'][_0x3618('0x21')]);}else{logger[_0x3618('0x22')]('VoiceContext,\x20%s,\x20%s',_0x351a81,_0x3618('0x1d'));_0x35cc8b(_0x2a6034[_0x3618('0x23')][_0x3618('0x21')]);}})['catch'](function(_0x43b13f){logger[_0x3618('0x1f')](_0x3618('0x1c'),_0x351a81,_0x43b13f);_0x2ad09d(_0x43b13f);});});}function respondWithStatusCode(_0x3d6b4e,_0x150bbd){_0x150bbd=_0x150bbd||0xcc;return function(_0xbe0ce3){if(_0xbe0ce3){return _0x3d6b4e['sendStatus'](_0x150bbd);}return _0x3d6b4e['status'](_0x150bbd)[_0x3618('0x24')]();};}function respondWithResult(_0x1b8914,_0x333e9a){_0x333e9a=_0x333e9a||0xc8;return function(_0x4fd5cf){if(_0x4fd5cf){return _0x1b8914[_0x3618('0x25')](_0x333e9a)[_0x3618('0x26')](_0x4fd5cf);}};}function respondWithFilteredResult(_0x1e4238,_0x4a0f16){return function(_0x379dde){if(_0x379dde){var _0x2b520c=typeof _0x4a0f16[_0x3618('0x27')]===_0x3618('0x28')&&typeof _0x4a0f16[_0x3618('0x29')]===_0x3618('0x28');var _0x3906af=_0x379dde['count'];var _0x3f991a=_0x2b520c?0x0:_0x4a0f16[_0x3618('0x27')];var _0x24e2ac=_0x2b520c?_0x379dde[_0x3618('0x2a')]:_0x4a0f16[_0x3618('0x27')]+_0x4a0f16[_0x3618('0x29')];var _0x427c71;if(_0x24e2ac>=_0x3906af){_0x24e2ac=_0x3906af;_0x427c71=0xc8;}else{_0x427c71=0xce;}_0x1e4238[_0x3618('0x25')](_0x427c71);return _0x1e4238['set']('Content-Range',_0x3f991a+'-'+_0x24e2ac+'/'+_0x3906af)[_0x3618('0x26')](_0x379dde);}return null;};}function patchUpdates(_0x4f2e32){return function(_0x292694){try{jsonpatch[_0x3618('0x2b')](_0x292694,_0x4f2e32,!![]);}catch(_0x5241fc){return BPromise[_0x3618('0x2c')](_0x5241fc);}return _0x292694[_0x3618('0x2d')]();};}function saveUpdates(_0x10162e,_0x11aebc){return function(_0x342d44){if(_0x342d44){return _0x342d44[_0x3618('0x2e')](_0x10162e)[_0x3618('0x2f')](function(_0x5adfad){return _0x5adfad;});}return null;};}function removeEntity(_0x1a16c9,_0x396eb6){return function(_0x3c4257){if(_0x3c4257){return _0x3c4257[_0x3618('0x30')]()[_0x3618('0x2f')](function(){var _0x2fafac=_0x3c4257[_0x3618('0x31')]({'plain':!![]});var _0x1c4b4a=_0x3618('0x32');return db[_0x3618('0x33')][_0x3618('0x30')]({'where':{'type':_0x1c4b4a,'resourceId':_0x2fafac['id']}})['then'](function(){return _0x3c4257;});})[_0x3618('0x2f')](function(){_0x1a16c9[_0x3618('0x25')](0xcc)[_0x3618('0x24')]();});}};}function handleEntityNotFound(_0x96606e,_0x1814e0){return function(_0x2fe7f1){if(!_0x2fe7f1){_0x96606e[_0x3618('0x34')](0x194);}return _0x2fe7f1;};}function handleError(_0x18c57c,_0x44378a){_0x44378a=_0x44378a||0x1f4;return function(_0x42e908){logger[_0x3618('0x1f')](_0x42e908['stack']);if(_0x42e908[_0x3618('0x35')]){delete _0x42e908[_0x3618('0x35')];}_0x18c57c[_0x3618('0x25')](_0x44378a)[_0x3618('0x36')](_0x42e908);};}exports[_0x3618('0x37')]=function(_0x342049,_0x169a80){var _0x2b952f={},_0x4dc234={},_0x39bb9e={'count':0x0,'rows':[]};var _0x598e46=_['map'](db[_0x3618('0x38')][_0x3618('0x39')],function(_0x2f42eb){return{'name':_0x2f42eb[_0x3618('0x3a')],'type':_0x2f42eb[_0x3618('0x3b')]['key']};});_0x4dc234['model']=_['map'](_0x598e46,_0x3618('0x35'));_0x4dc234[_0x3618('0x3c')]=_[_0x3618('0x3d')](_0x342049[_0x3618('0x3c')]);_0x4dc234[_0x3618('0x3e')]=_[_0x3618('0x3f')](_0x4dc234[_0x3618('0x40')],_0x4dc234[_0x3618('0x3c')]);_0x2b952f[_0x3618('0x41')]=_['intersection'](_0x4dc234['model'],qs['fields'](_0x342049['query']['fields']));_0x2b952f[_0x3618('0x41')]=_0x2b952f['attributes'][_0x3618('0x42')]?_0x2b952f['attributes']:_0x4dc234['model'];if(!_0x342049['query']['hasOwnProperty'](_0x3618('0x43'))){_0x2b952f['limit']=qs[_0x3618('0x29')](_0x342049['query']['limit']);_0x2b952f[_0x3618('0x27')]=qs['offset'](_0x342049[_0x3618('0x3c')][_0x3618('0x27')]);}_0x2b952f['order']=qs[_0x3618('0x44')](_0x342049[_0x3618('0x3c')][_0x3618('0x44')]);_0x2b952f[_0x3618('0x45')]=qs[_0x3618('0x3e')](_[_0x3618('0x46')](_0x342049['query'],_0x4dc234[_0x3618('0x3e')]),_0x598e46);if(_0x342049[_0x3618('0x3c')][_0x3618('0x47')]){_0x2b952f['where']=_['merge'](_0x2b952f[_0x3618('0x45')],{'$or':_[_0x3618('0x48')](_0x598e46,function(_0x556109){if(_0x556109[_0x3618('0x3b')]!==_0x3618('0x49')){var _0x45e659={};_0x45e659[_0x556109[_0x3618('0x35')]]={'$like':'%'+_0x342049[_0x3618('0x3c')][_0x3618('0x47')]+'%'};return _0x45e659;}})});}_0x2b952f=_[_0x3618('0x4a')]({},_0x2b952f,_0x342049[_0x3618('0x4b')]);var _0x386e52={'where':_0x2b952f[_0x3618('0x45')]};return db[_0x3618('0x38')][_0x3618('0x2a')](_0x386e52)[_0x3618('0x2f')](function(_0x339740){_0x39bb9e[_0x3618('0x2a')]=_0x339740;if(_0x342049[_0x3618('0x3c')][_0x3618('0x4c')]){_0x2b952f[_0x3618('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x3618('0x4e')](_0x2b952f);})[_0x3618('0x2f')](function(_0xeaf980){_0x39bb9e[_0x3618('0x4f')]=_0xeaf980;return _0x39bb9e;})[_0x3618('0x2f')](respondWithFilteredResult(_0x169a80,_0x2b952f))[_0x3618('0x50')](handleError(_0x169a80,null));};exports['show']=function(_0x5e0724,_0x2ea501){var _0x14dd3b={'raw':![],'where':{'id':_0x5e0724[_0x3618('0x51')]['id']}},_0x4109bc={};_0x4109bc[_0x3618('0x40')]=_['keys'](db['VoiceContext'][_0x3618('0x39')]);_0x4109bc[_0x3618('0x3c')]=_['keys'](_0x5e0724[_0x3618('0x3c')]);_0x4109bc[_0x3618('0x3e')]=_[_0x3618('0x3f')](_0x4109bc[_0x3618('0x40')],_0x4109bc[_0x3618('0x3c')]);_0x14dd3b[_0x3618('0x41')]=_[_0x3618('0x3f')](_0x4109bc[_0x3618('0x40')],qs[_0x3618('0x52')](_0x5e0724['query'][_0x3618('0x52')]));_0x14dd3b['attributes']=_0x14dd3b['attributes'][_0x3618('0x42')]?_0x14dd3b[_0x3618('0x41')]:_0x4109bc[_0x3618('0x40')];if(_0x5e0724[_0x3618('0x3c')][_0x3618('0x4c')]){_0x14dd3b['include']=[{'all':!![]}];}_0x14dd3b=_[_0x3618('0x4a')]({},_0x14dd3b,_0x5e0724[_0x3618('0x4b')]);return db[_0x3618('0x38')][_0x3618('0x53')](_0x14dd3b)['then'](handleEntityNotFound(_0x2ea501,null))[_0x3618('0x2f')](respondWithResult(_0x2ea501,null))['catch'](handleError(_0x2ea501,null));};exports['create']=function(_0x58a115,_0x3e4d9b,_0x39244a){var _0x587a19;return db[_0x3618('0x38')]['create'](_0x58a115[_0x3618('0x54')],{'raw':!![]})[_0x3618('0x2f')](function(_0x5ec923){_0x587a19=_0x5ec923;return db[_0x3618('0x38')][_0x3618('0x4e')]({'raw':!![]});})['then'](function(_0x4483f5){var _0x283af6=fs['readFileSync'](path[_0x3618('0x55')](config['root'],_0x3618('0x56')),_0x3618('0x57'));var _0x545703=ejs['render'](_0x283af6,{'contexts':_0x4483f5||[]});fs[_0x3618('0x58')](_0x3618('0x59'),_0x545703);})['then'](function(){return respondWithRpcPromise(_0x3618('0x5a'),_0x3618('0x5b'),{'module':'chan_sip.so'});})[_0x3618('0x2f')](function(){var _0x154d5f=_0x58a115[_0x3618('0x5c')][_0x3618('0x31')]({'plain':!![]});if(!_0x154d5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154d5f['role']===_0x3618('0x5c')){var _0x3ce80f=_0x587a19[_0x3618('0x31')]({'plain':!![]});return db['UserProfileSection'][_0x3618('0x53')]({'where':{'name':_0x3618('0x32'),'userProfileId':_0x154d5f[_0x3618('0x5d')]},'raw':!![]})[_0x3618('0x2f')](function(_0x1e1803){if(_0x1e1803&&_0x1e1803[_0x3618('0x5e')]===0x0){return db[_0x3618('0x33')][_0x3618('0x5b')]({'name':_0x3ce80f[_0x3618('0x35')],'resourceId':_0x3ce80f['id'],'type':_0x1e1803[_0x3618('0x35')],'sectionId':_0x1e1803['id']},{})[_0x3618('0x2f')](function(){return _0x587a19;});}else{return _0x587a19;}})['catch'](function(_0x2ef6e2){logger[_0x3618('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef6e2);throw _0x2ef6e2;});}return _0x587a19;})[_0x3618('0x2f')](respondWithResult(_0x3e4d9b,0xc9))[_0x3618('0x50')](handleError(_0x3e4d9b,null));};exports[_0x3618('0x2e')]=function(_0x3e592e,_0x3a2dbd,_0x303b13){var _0x2664ad;return db[_0x3618('0x38')]['find']({'where':{'id':_0x3e592e[_0x3618('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a2dbd,null))[_0x3618('0x2f')](saveUpdates(_0x3e592e[_0x3618('0x54')],null))[_0x3618('0x2f')](function(_0x2ab1fe){if(_0x2ab1fe){_0x2664ad=_0x2ab1fe;return db[_0x3618('0x38')][_0x3618('0x4e')]({'raw':!![]});}})[_0x3618('0x2f')](function(_0x2d2bca){var _0x508853=fs[_0x3618('0x5f')](path[_0x3618('0x55')](config[_0x3618('0x60')],_0x3618('0x56')),_0x3618('0x57'));var _0x48bb34=ejs[_0x3618('0x61')](_0x508853,{'contexts':_0x2d2bca||[]});fs[_0x3618('0x58')](_0x3618('0x59'),_0x48bb34);})['then'](function(){return respondWithRpcPromise(_0x3618('0x5a'),'update',{'module':_0x3618('0x62')});})[_0x3618('0x2f')](function(){return _0x2664ad;})['then'](respondWithResult(_0x3a2dbd,null))[_0x3618('0x50')](handleError(_0x3a2dbd,null));};exports[_0x3618('0x30')]=function(_0x1e88f5,_0x339ded,_0x207b53){var _0x2c0008;return db[_0x3618('0x38')][_0x3618('0x53')]({'where':{'id':_0x1e88f5['params']['id']}})[_0x3618('0x2f')](handleEntityNotFound(_0x339ded,null))[_0x3618('0x2f')](removeEntity(_0x339ded,null))[_0x3618('0x2f')](function(){return db[_0x3618('0x38')]['findAll']({'raw':!![]});})[_0x3618('0x2f')](function(_0x1528f4){var _0x2a7288=fs[_0x3618('0x5f')](path[_0x3618('0x55')](config['root'],_0x3618('0x56')),_0x3618('0x57'));var _0x199c07=ejs[_0x3618('0x61')](_0x2a7288,{'contexts':_0x1528f4});fs[_0x3618('0x58')](_0x3618('0x59'),_0x199c07);return respondWithRpcPromise(_0x3618('0x5a'),_0x3618('0x30'),{'module':_0x3618('0x62')});})[_0x3618('0x50')](handleError(_0x339ded,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c800c83..271a14e 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 _0x29a1=['bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment'];(function(_0x2d874a,_0x894f2d){var _0xa7d42b=function(_0x4643a0){while(--_0x4643a0){_0x2d874a['push'](_0x2d874a['shift']());}};_0xa7d42b(++_0x894f2d);}(_0x29a1,0x98));var _0x129a=function(_0x17ab1f,_0x24b014){_0x17ab1f=_0x17ab1f-0x0;var _0x1ce539=_0x29a1[_0x17ab1f];return _0x1ce539;};'use strict';var _=require('lodash');var util=require(_0x129a('0x0'));var logger=require(_0x129a('0x1'))(_0x129a('0x2'));var moment=require(_0x129a('0x3'));var BPromise=require(_0x129a('0x4'));var rp=require(_0x129a('0x5'));var fs=require('fs');var path=require(_0x129a('0x6'));var rimraf=require(_0x129a('0x7'));var config=require('../../config/environment');var attributes=require(_0x129a('0x8'));module[_0x129a('0x9')]=function(_0x374cb2,_0x4853a2){return _0x374cb2[_0x129a('0xa')](_0x129a('0xb'),attributes,{'tableName':_0x129a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91a=['path','../../config/environment','VoiceContext','voice_contexts','util','../../config/logger','api','moment','request-promise'];(function(_0x3aa321,_0x5bcde5){var _0x2bc5a5=function(_0xabb066){while(--_0xabb066){_0x3aa321['push'](_0x3aa321['shift']());}};_0x2bc5a5(++_0x5bcde5);}(_0xb91a,0xe5));var _0xab91=function(_0x17c475,_0x3c2a47){_0x17c475=_0x17c475-0x0;var _0x3c1f91=_0xb91a[_0x17c475];return _0x3c1f91;};'use strict';var _=require('lodash');var util=require(_0xab91('0x0'));var logger=require(_0xab91('0x1'))(_0xab91('0x2'));var moment=require(_0xab91('0x3'));var BPromise=require('bluebird');var rp=require(_0xab91('0x4'));var fs=require('fs');var path=require(_0xab91('0x5'));var rimraf=require('rimraf');var config=require(_0xab91('0x6'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x1f99d4,_0x1cce1e){return _0x1f99d4['define'](_0xab91('0x7'),attributes,{'tableName':_0xab91('0x8'),'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 69c5772..787bc7e 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 _0x3609=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x55c158,_0x563b9d){var _0x154cc9=function(_0x1c2daf){while(--_0x1c2daf){_0x55c158['push'](_0x55c158['shift']());}};_0x154cc9(++_0x563b9d);}(_0x3609,0x101));var _0x9360=function(_0x13812f,_0x1084d4){_0x13812f=_0x13812f-0x0;var _0x2d8c25=_0x3609[_0x13812f];return _0x2d8c25;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require(_0x9360('0x4'));var fs=require('fs');var Redis=require(_0x9360('0x5'));var db=require(_0x9360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe15,_0xf4e840,_0x50e967){return new BPromise(function(_0x2a67be,_0x3a08e5){return client[_0x9360('0xa')](_0x11fe15,_0x50e967)[_0x9360('0xb')](function(_0x2d951e){logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,_0x9360('0xe'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0xf4e840,_0x9360('0xe'),JSON[_0x9360('0xf')](_0x2d951e));if(_0x2d951e[_0x9360('0x10')]){if(_0x2d951e['error'][_0x9360('0x11')]===0x1f4){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);return _0x3a08e5(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0xf4e840,_0x2d951e[_0x9360('0x10')]['message']);return _0x2a67be(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}else{logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,'request\x20sent');_0x2a67be(_0x2d951e[_0x9360('0x13')][_0x9360('0x12')]);}})[_0x9360('0x14')](function(_0x1e0316){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x1e0316);_0x3a08e5(_0x1e0316);});});} \ No newline at end of file +var _0x0c19=['message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x13834a,_0x4b6d38){var _0x20050c=function(_0x588874){while(--_0x588874){_0x13834a['push'](_0x13834a['shift']());}};_0x20050c(++_0x4b6d38);}(_0x0c19,0xf5));var _0x90c1=function(_0x4b0566,_0x407c4c){_0x4b0566=_0x4b0566-0x0;var _0x1df365=_0x0c19[_0x4b0566];return _0x1df365;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var moment=require(_0x90c1('0x2'));var BPromise=require(_0x90c1('0x3'));var rs=require(_0x90c1('0x4'));var fs=require('fs');var Redis=require(_0x90c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90c1('0x6'));var logger=require(_0x90c1('0x7'))(_0x90c1('0x8'));var config=require('../../config/environment');var jayson=require(_0x90c1('0x9'));var client=jayson[_0x90c1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440f7a,_0x954ac4,_0x37d247){return new BPromise(function(_0x2ed328,_0x351d07){return client[_0x90c1('0xb')](_0x440f7a,_0x37d247)[_0x90c1('0xc')](function(_0x4895b5){logger[_0x90c1('0xd')](_0x90c1('0xe'),_0x954ac4,'request\x20sent');logger[_0x90c1('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x954ac4,'request\x20sent',JSON[_0x90c1('0x10')](_0x4895b5));if(_0x4895b5['error']){if(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x12')]===0x1f4){logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x4895b5['error']['message']);return _0x351d07(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x13')]);}logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x4895b5['error'][_0x90c1('0x13')]);return _0x2ed328(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x13')]);}else{logger[_0x90c1('0xd')](_0x90c1('0xe'),_0x954ac4,_0x90c1('0x14'));_0x2ed328(_0x4895b5['result'][_0x90c1('0x13')]);}})[_0x90c1('0x15')](function(_0x45a64c){logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x45a64c);_0x351d07(_0x45a64c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 686ca28..6872359 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 _0xb922=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x4048e6,_0xc50002){var _0x2e04a8=function(_0x2a7906){while(--_0x2a7906){_0x4048e6['push'](_0x4048e6['shift']());}};_0x2e04a8(++_0xc50002);}(_0xb922,0x12d));var _0x2b92=function(_0x1da7b,_0x3ce5ec){_0x1da7b=_0x1da7b-0x0;var _0x4bf8e3=_0xb922[_0x1da7b];return _0x4bf8e3;};'use strict';var multer=require(_0x2b92('0x0'));var util=require(_0x2b92('0x1'));var path=require(_0x2b92('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b92('0x3')]();var fs_extra=require(_0x2b92('0x4'));var auth=require(_0x2b92('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2b92('0x6'));var controller=require(_0x2b92('0x7'));router[_0x2b92('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b92('0x8')](_0x2b92('0x9'),auth[_0x2b92('0xa')](),controller[_0x2b92('0xb')]);router[_0x2b92('0x8')](_0x2b92('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2b92('0xd')]('/',auth[_0x2b92('0xa')](),controller[_0x2b92('0xe')]);router[_0x2b92('0xf')](_0x2b92('0xc'),auth[_0x2b92('0xa')](),controller[_0x2b92('0x10')]);router[_0x2b92('0x11')](_0x2b92('0xc'),auth[_0x2b92('0xa')](),controller[_0x2b92('0x12')]);module['exports']=router; \ No newline at end of file +var _0x04aa=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x27e854,_0x42366){var _0x24765=function(_0x456ffd){while(--_0x456ffd){_0x27e854['push'](_0x27e854['shift']());}};_0x24765(++_0x42366);}(_0x04aa,0x130));var _0xa04a=function(_0x32dce6,_0x23f570){_0x32dce6=_0x32dce6-0x0;var _0x1191ba=_0x04aa[_0x32dce6];return _0x1191ba;};'use strict';var multer=require(_0xa04a('0x0'));var util=require(_0xa04a('0x1'));var path=require(_0xa04a('0x2'));var timeout=require(_0xa04a('0x3'));var express=require(_0xa04a('0x4'));var router=express[_0xa04a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa04a('0x6'));var interaction=require(_0xa04a('0x7'));var config=require(_0xa04a('0x8'));var controller=require('./voiceDialReport.controller');router[_0xa04a('0x9')]('/',auth[_0xa04a('0xa')](),controller[_0xa04a('0xb')]);router['get'](_0xa04a('0xc'),auth[_0xa04a('0xa')](),controller[_0xa04a('0xd')]);router[_0xa04a('0x9')](_0xa04a('0xe'),auth[_0xa04a('0xa')](),controller[_0xa04a('0xf')]);router[_0xa04a('0x10')]('/',auth[_0xa04a('0xa')](),controller[_0xa04a('0x11')]);router[_0xa04a('0x12')](_0xa04a('0xe'),auth['isAuthenticated'](),controller[_0xa04a('0x13')]);router['delete'](_0xa04a('0xe'),auth[_0xa04a('0xa')](),controller[_0xa04a('0x14')]);module[_0xa04a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e0c5f39..b7a83be 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 _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x9aad68,_0x45377){var _0x281340=function(_0x494ac1){while(--_0x494ac1){_0x9aad68['push'](_0x9aad68['shift']());}};_0x281340(++_0x45377);}(_0x84ab,0x12f));var _0xb84a=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x84ab[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x2ef789,_0x26a493){var _0xf29e80=function(_0x392fbe){while(--_0x392fbe){_0x2ef789['push'](_0x2ef789['shift']());}};_0xf29e80(++_0x26a493);}(_0x9a19,0x114));var _0x99a1=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x9a19[_0x23b655];return _0x364b32;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index bccb4d3..aa9bc64 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 _0x75a4=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','describe','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','then','destroy','end','error','stack','name','send','index','VoiceDialReport','type','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x75a4,0xa6));var _0x475a=function(_0x3c61e9,_0x413e93){_0x3c61e9=_0x3c61e9-0x0;var _0x43fb43=_0x75a4[_0x3c61e9];return _0x43fb43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x475a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x475a('0x1'));var moment=require('moment');var BPromise=require(_0x475a('0x2'));var Mustache=require(_0x475a('0x3'));var util=require(_0x475a('0x4'));var path=require(_0x475a('0x5'));var sox=require(_0x475a('0x6'));var csv=require(_0x475a('0x7'));var ejs=require(_0x475a('0x8'));var fs=require('fs');var fs_extra=require(_0x475a('0x9'));var _=require(_0x475a('0xa'));var squel=require(_0x475a('0xb'));var crypto=require(_0x475a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x475a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x475a('0xe'));var Papa=require(_0x475a('0xf'));var Redis=require(_0x475a('0x10'));var authService=require(_0x475a('0x11'));var qs=require(_0x475a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x475a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x475a('0x14'));var config=require(_0x475a('0x15'));var licenseUtil=require(_0x475a('0x16'));var db=require(_0x475a('0x17'))['db'];function respondWithStatusCode(_0x599785,_0x13222c){_0x13222c=_0x13222c||0xcc;return function(_0x1442a2){if(_0x1442a2){return _0x599785[_0x475a('0x18')](_0x13222c);}return _0x599785[_0x475a('0x19')](_0x13222c)['end']();};}function respondWithResult(_0x12b0ce,_0x38094a){_0x38094a=_0x38094a||0xc8;return function(_0x50b19e){if(_0x50b19e){return _0x12b0ce[_0x475a('0x19')](_0x38094a)[_0x475a('0x1a')](_0x50b19e);}};}function respondWithFilteredResult(_0x57e54c,_0x4475d6){return function(_0x12af54){if(_0x12af54){var _0x6b7b32=typeof _0x4475d6[_0x475a('0x1b')]==='undefined'&&typeof _0x4475d6['limit']===_0x475a('0x1c');var _0x498465=_0x12af54['count'];var _0x1046da=_0x6b7b32?0x0:_0x4475d6[_0x475a('0x1b')];var _0x810e26=_0x6b7b32?_0x12af54[_0x475a('0x1d')]:_0x4475d6[_0x475a('0x1b')]+_0x4475d6[_0x475a('0x1e')];var _0x3a84cb;if(_0x810e26>=_0x498465){_0x810e26=_0x498465;_0x3a84cb=0xc8;}else{_0x3a84cb=0xce;}_0x57e54c['status'](_0x3a84cb);return _0x57e54c[_0x475a('0x1f')]('Content-Range',_0x1046da+'-'+_0x810e26+'/'+_0x498465)[_0x475a('0x1a')](_0x12af54);}return null;};}function patchUpdates(_0x240cb5){return function(_0xc29e39){try{jsonpatch['apply'](_0xc29e39,_0x240cb5,!![]);}catch(_0x1bf67e){return BPromise[_0x475a('0x20')](_0x1bf67e);}return _0xc29e39[_0x475a('0x21')]();};}function saveUpdates(_0x47fca9,_0xec9f86){return function(_0x34511a){if(_0x34511a){return _0x34511a['update'](_0x47fca9)[_0x475a('0x22')](function(_0x178319){return _0x178319;});}return null;};}function removeEntity(_0x248c95,_0xa73519){return function(_0x14fee1){if(_0x14fee1){return _0x14fee1[_0x475a('0x23')]()[_0x475a('0x22')](function(){_0x248c95[_0x475a('0x19')](0xcc)[_0x475a('0x24')]();});}};}function handleEntityNotFound(_0x94883e,_0x4671ca){return function(_0x15d87f){if(!_0x15d87f){_0x94883e['sendStatus'](0x194);}return _0x15d87f;};}function handleError(_0x205402,_0x21ede9){_0x21ede9=_0x21ede9||0x1f4;return function(_0x35dc47){logger[_0x475a('0x25')](_0x35dc47[_0x475a('0x26')]);if(_0x35dc47['name']){delete _0x35dc47[_0x475a('0x27')];}_0x205402[_0x475a('0x19')](_0x21ede9)[_0x475a('0x28')](_0x35dc47);};}exports[_0x475a('0x29')]=function(_0x33c38b,_0x3c9551){var _0x317de8={},_0x26cdf8={},_0x15b539={'count':0x0,'rows':[]};var _0x5df9c1=_['map'](db[_0x475a('0x2a')]['rawAttributes'],function(_0x180013){return{'name':_0x180013['fieldName'],'type':_0x180013[_0x475a('0x2b')][_0x475a('0x2c')]};});_0x26cdf8['model']=_[_0x475a('0x2d')](_0x5df9c1,_0x475a('0x27'));_0x26cdf8[_0x475a('0x2e')]=_[_0x475a('0x2f')](_0x33c38b['query']);_0x26cdf8[_0x475a('0x30')]=_['intersection'](_0x26cdf8[_0x475a('0x31')],_0x26cdf8['query']);_0x317de8[_0x475a('0x32')]=_['intersection'](_0x26cdf8[_0x475a('0x31')],qs[_0x475a('0x33')](_0x33c38b[_0x475a('0x2e')][_0x475a('0x33')]));_0x317de8['attributes']=_0x317de8[_0x475a('0x32')][_0x475a('0x34')]?_0x317de8['attributes']:_0x26cdf8[_0x475a('0x31')];if(!_0x33c38b[_0x475a('0x2e')][_0x475a('0x35')](_0x475a('0x36'))){_0x317de8[_0x475a('0x1e')]=qs[_0x475a('0x1e')](_0x33c38b[_0x475a('0x2e')][_0x475a('0x1e')]);_0x317de8['offset']=qs[_0x475a('0x1b')](_0x33c38b[_0x475a('0x2e')]['offset']);}_0x317de8[_0x475a('0x37')]=qs['sort'](_0x33c38b[_0x475a('0x2e')]['sort']);_0x317de8['where']=qs[_0x475a('0x30')](_[_0x475a('0x38')](_0x33c38b[_0x475a('0x2e')],_0x26cdf8[_0x475a('0x30')]),_0x5df9c1);if(_0x33c38b[_0x475a('0x2e')][_0x475a('0x39')]){_0x317de8[_0x475a('0x3a')]=_[_0x475a('0x3b')](_0x317de8[_0x475a('0x3a')],{'$or':_[_0x475a('0x2d')](_0x5df9c1,function(_0x3c8bde){if(_0x3c8bde['type']!==_0x475a('0x3c')){var _0x4fcee1={};_0x4fcee1[_0x3c8bde[_0x475a('0x27')]]={'$like':'%'+_0x33c38b[_0x475a('0x2e')][_0x475a('0x39')]+'%'};return _0x4fcee1;}})});}_0x317de8=_[_0x475a('0x3b')]({},_0x317de8,_0x33c38b[_0x475a('0x3d')]);var _0x39f949={'where':_0x317de8[_0x475a('0x3a')]};return db['VoiceDialReport']['count'](_0x39f949)[_0x475a('0x22')](function(_0x115a9f){_0x15b539[_0x475a('0x1d')]=_0x115a9f;if(_0x33c38b[_0x475a('0x2e')][_0x475a('0x3e')]){_0x317de8[_0x475a('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x475a('0x40')](_0x317de8);})[_0x475a('0x22')](function(_0x5d815c){_0x15b539[_0x475a('0x41')]=_0x5d815c;return _0x15b539;})[_0x475a('0x22')](respondWithFilteredResult(_0x3c9551,_0x317de8))[_0x475a('0x42')](handleError(_0x3c9551,null));};exports['show']=function(_0x586619,_0x14af68){var _0x3d8eae={'raw':!![],'where':{'id':_0x586619[_0x475a('0x43')]['id']}},_0x1adb2c={};_0x1adb2c[_0x475a('0x31')]=_[_0x475a('0x2f')](db['VoiceDialReport'][_0x475a('0x44')]);_0x1adb2c['query']=_['keys'](_0x586619['query']);_0x1adb2c[_0x475a('0x30')]=_[_0x475a('0x45')](_0x1adb2c[_0x475a('0x31')],_0x1adb2c[_0x475a('0x2e')]);_0x3d8eae[_0x475a('0x32')]=_[_0x475a('0x45')](_0x1adb2c[_0x475a('0x31')],qs[_0x475a('0x33')](_0x586619[_0x475a('0x2e')]['fields']));_0x3d8eae[_0x475a('0x32')]=_0x3d8eae['attributes'][_0x475a('0x34')]?_0x3d8eae['attributes']:_0x1adb2c[_0x475a('0x31')];if(_0x586619[_0x475a('0x2e')][_0x475a('0x3e')]){_0x3d8eae[_0x475a('0x3f')]=[{'all':!![]}];}_0x3d8eae=_[_0x475a('0x3b')]({},_0x3d8eae,_0x586619[_0x475a('0x3d')]);return db['VoiceDialReport'][_0x475a('0x46')](_0x3d8eae)['then'](handleEntityNotFound(_0x14af68,null))[_0x475a('0x22')](respondWithResult(_0x14af68,null))[_0x475a('0x42')](handleError(_0x14af68,null));};exports[_0x475a('0x47')]=function(_0x106c06,_0x2f76aa){return db[_0x475a('0x2a')][_0x475a('0x47')](_0x106c06['body'],{})[_0x475a('0x22')](respondWithResult(_0x2f76aa,0xc9))[_0x475a('0x42')](handleError(_0x2f76aa,null));};exports['update']=function(_0x4c7c9a,_0x52ef60){if(_0x4c7c9a[_0x475a('0x48')]['id']){delete _0x4c7c9a[_0x475a('0x48')]['id'];}return db['VoiceDialReport'][_0x475a('0x46')]({'where':{'id':_0x4c7c9a[_0x475a('0x43')]['id']}})['then'](handleEntityNotFound(_0x52ef60,null))['then'](saveUpdates(_0x4c7c9a[_0x475a('0x48')],null))[_0x475a('0x22')](respondWithResult(_0x52ef60,null))[_0x475a('0x42')](handleError(_0x52ef60,null));};exports[_0x475a('0x23')]=function(_0x2dd923,_0x16e01f){return db[_0x475a('0x2a')][_0x475a('0x46')]({'where':{'id':_0x2dd923[_0x475a('0x43')]['id']}})['then'](handleEntityNotFound(_0x16e01f,null))[_0x475a('0x22')](removeEntity(_0x16e01f,null))['catch'](handleError(_0x16e01f,null));};exports[_0x475a('0x49')]=function(_0x126e99,_0xc337ef){return db[_0x475a('0x2a')][_0x475a('0x49')]()[_0x475a('0x22')](respondWithResult(_0xc337ef,null))[_0x475a('0x42')](handleError(_0xc337ef,null));}; \ No newline at end of file +var _0x7096=['includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','VoiceDialReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x7096,0xa8));var _0x6709=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x7096[_0x33032e];return _0x13316b;};'use strict';var emlformat=require(_0x6709('0x0'));var rimraf=require(_0x6709('0x1'));var zipdir=require(_0x6709('0x2'));var jsonpatch=require(_0x6709('0x3'));var rp=require(_0x6709('0x4'));var moment=require(_0x6709('0x5'));var BPromise=require(_0x6709('0x6'));var Mustache=require(_0x6709('0x7'));var util=require(_0x6709('0x8'));var path=require(_0x6709('0x9'));var sox=require(_0x6709('0xa'));var csv=require(_0x6709('0xb'));var ejs=require(_0x6709('0xc'));var fs=require('fs');var fs_extra=require(_0x6709('0xd'));var _=require(_0x6709('0xe'));var squel=require(_0x6709('0xf'));var crypto=require(_0x6709('0x10'));var jsforce=require(_0x6709('0x11'));var deskjs=require(_0x6709('0x12'));var toCsv=require(_0x6709('0xb'));var querystring=require(_0x6709('0x13'));var Papa=require(_0x6709('0x14'));var Redis=require('ioredis');var authService=require(_0x6709('0x15'));var qs=require(_0x6709('0x16'));var as=require(_0x6709('0x17'));var hardwareService=require(_0x6709('0x18'));var logger=require(_0x6709('0x19'))(_0x6709('0x1a'));var utils=require(_0x6709('0x1b'));var config=require(_0x6709('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf646c0,_0x29c465){_0x29c465=_0x29c465||0xcc;return function(_0xc77e){if(_0xc77e){return _0xf646c0[_0x6709('0x1d')](_0x29c465);}return _0xf646c0[_0x6709('0x1e')](_0x29c465)[_0x6709('0x1f')]();};}function respondWithResult(_0x5237fe,_0x187ef9){_0x187ef9=_0x187ef9||0xc8;return function(_0x325894){if(_0x325894){return _0x5237fe[_0x6709('0x1e')](_0x187ef9)[_0x6709('0x20')](_0x325894);}};}function respondWithFilteredResult(_0x1645ee,_0x2c0990){return function(_0x4e665e){if(_0x4e665e){var _0x203761=typeof _0x2c0990['offset']===_0x6709('0x21')&&typeof _0x2c0990[_0x6709('0x22')]===_0x6709('0x21');var _0x2ffadb=_0x4e665e['count'];var _0x5ef457=_0x203761?0x0:_0x2c0990[_0x6709('0x23')];var _0x575f04=_0x203761?_0x4e665e[_0x6709('0x24')]:_0x2c0990['offset']+_0x2c0990[_0x6709('0x22')];var _0x15fb28;if(_0x575f04>=_0x2ffadb){_0x575f04=_0x2ffadb;_0x15fb28=0xc8;}else{_0x15fb28=0xce;}_0x1645ee[_0x6709('0x1e')](_0x15fb28);return _0x1645ee['set'](_0x6709('0x25'),_0x5ef457+'-'+_0x575f04+'/'+_0x2ffadb)[_0x6709('0x20')](_0x4e665e);}return null;};}function patchUpdates(_0x1c4225){return function(_0x2822d0){try{jsonpatch[_0x6709('0x26')](_0x2822d0,_0x1c4225,!![]);}catch(_0x49bb2c){return BPromise[_0x6709('0x27')](_0x49bb2c);}return _0x2822d0['save']();};}function saveUpdates(_0x441a3e,_0x848a55){return function(_0x14ecdf){if(_0x14ecdf){return _0x14ecdf[_0x6709('0x28')](_0x441a3e)[_0x6709('0x29')](function(_0x591baa){return _0x591baa;});}return null;};}function removeEntity(_0x1fc729,_0x1beb5c){return function(_0x281d23){if(_0x281d23){return _0x281d23[_0x6709('0x2a')]()[_0x6709('0x29')](function(){_0x1fc729['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ae29,_0x396180){return function(_0x3547ef){if(!_0x3547ef){_0x24ae29['sendStatus'](0x194);}return _0x3547ef;};}function handleError(_0x416220,_0xd45d59){_0xd45d59=_0xd45d59||0x1f4;return function(_0x23fd4c){logger['error'](_0x23fd4c[_0x6709('0x2b')]);if(_0x23fd4c[_0x6709('0x2c')]){delete _0x23fd4c['name'];}_0x416220[_0x6709('0x1e')](_0xd45d59)[_0x6709('0x2d')](_0x23fd4c);};}exports['index']=function(_0x17b21c,_0x161f87){var _0x312cb4={},_0x4f7945={},_0xc1052e={'count':0x0,'rows':[]};var _0x122f82=_[_0x6709('0x2e')](db[_0x6709('0x2f')][_0x6709('0x30')],function(_0x50971f){return{'name':_0x50971f['fieldName'],'type':_0x50971f['type']['key']};});_0x4f7945[_0x6709('0x31')]=_[_0x6709('0x2e')](_0x122f82,_0x6709('0x2c'));_0x4f7945[_0x6709('0x32')]=_[_0x6709('0x33')](_0x17b21c['query']);_0x4f7945[_0x6709('0x34')]=_[_0x6709('0x35')](_0x4f7945['model'],_0x4f7945[_0x6709('0x32')]);_0x312cb4[_0x6709('0x36')]=_[_0x6709('0x35')](_0x4f7945['model'],qs[_0x6709('0x37')](_0x17b21c['query'][_0x6709('0x37')]));_0x312cb4[_0x6709('0x36')]=_0x312cb4[_0x6709('0x36')]['length']?_0x312cb4[_0x6709('0x36')]:_0x4f7945['model'];if(!_0x17b21c[_0x6709('0x32')][_0x6709('0x38')](_0x6709('0x39'))){_0x312cb4['limit']=qs[_0x6709('0x22')](_0x17b21c['query'][_0x6709('0x22')]);_0x312cb4[_0x6709('0x23')]=qs[_0x6709('0x23')](_0x17b21c[_0x6709('0x32')][_0x6709('0x23')]);}_0x312cb4[_0x6709('0x3a')]=qs[_0x6709('0x3b')](_0x17b21c[_0x6709('0x32')][_0x6709('0x3b')]);_0x312cb4[_0x6709('0x3c')]=qs[_0x6709('0x34')](_['pick'](_0x17b21c[_0x6709('0x32')],_0x4f7945[_0x6709('0x34')]),_0x122f82);if(_0x17b21c[_0x6709('0x32')][_0x6709('0x3d')]){_0x312cb4['where']=_[_0x6709('0x3e')](_0x312cb4[_0x6709('0x3c')],{'$or':_[_0x6709('0x2e')](_0x122f82,function(_0x381bda){if(_0x381bda[_0x6709('0x3f')]!==_0x6709('0x40')){var _0x16c9de={};_0x16c9de[_0x381bda[_0x6709('0x2c')]]={'$like':'%'+_0x17b21c[_0x6709('0x32')][_0x6709('0x3d')]+'%'};return _0x16c9de;}})});}_0x312cb4=_[_0x6709('0x3e')]({},_0x312cb4,_0x17b21c[_0x6709('0x41')]);var _0x481cbd={'where':_0x312cb4[_0x6709('0x3c')]};return db[_0x6709('0x2f')]['count'](_0x481cbd)[_0x6709('0x29')](function(_0x521e25){_0xc1052e[_0x6709('0x24')]=_0x521e25;if(_0x17b21c[_0x6709('0x32')][_0x6709('0x42')]){_0x312cb4[_0x6709('0x43')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x6709('0x44')](_0x312cb4);})[_0x6709('0x29')](function(_0x381500){_0xc1052e[_0x6709('0x45')]=_0x381500;return _0xc1052e;})[_0x6709('0x29')](respondWithFilteredResult(_0x161f87,_0x312cb4))[_0x6709('0x46')](handleError(_0x161f87,null));};exports[_0x6709('0x47')]=function(_0xbe7f28,_0x5ebbc6){var _0x4ebe83={'raw':!![],'where':{'id':_0xbe7f28[_0x6709('0x48')]['id']}},_0x2cd879={};_0x2cd879['model']=_[_0x6709('0x33')](db[_0x6709('0x2f')][_0x6709('0x30')]);_0x2cd879[_0x6709('0x32')]=_[_0x6709('0x33')](_0xbe7f28[_0x6709('0x32')]);_0x2cd879['filters']=_['intersection'](_0x2cd879[_0x6709('0x31')],_0x2cd879[_0x6709('0x32')]);_0x4ebe83[_0x6709('0x36')]=_['intersection'](_0x2cd879['model'],qs[_0x6709('0x37')](_0xbe7f28[_0x6709('0x32')][_0x6709('0x37')]));_0x4ebe83[_0x6709('0x36')]=_0x4ebe83['attributes'][_0x6709('0x49')]?_0x4ebe83[_0x6709('0x36')]:_0x2cd879[_0x6709('0x31')];if(_0xbe7f28[_0x6709('0x32')][_0x6709('0x42')]){_0x4ebe83[_0x6709('0x43')]=[{'all':!![]}];}_0x4ebe83=_[_0x6709('0x3e')]({},_0x4ebe83,_0xbe7f28[_0x6709('0x41')]);return db[_0x6709('0x2f')][_0x6709('0x4a')](_0x4ebe83)['then'](handleEntityNotFound(_0x5ebbc6,null))[_0x6709('0x29')](respondWithResult(_0x5ebbc6,null))[_0x6709('0x46')](handleError(_0x5ebbc6,null));};exports[_0x6709('0x4b')]=function(_0x4dd96b,_0x53913f){return db['VoiceDialReport'][_0x6709('0x4b')](_0x4dd96b[_0x6709('0x4c')],{})[_0x6709('0x29')](respondWithResult(_0x53913f,0xc9))['catch'](handleError(_0x53913f,null));};exports[_0x6709('0x28')]=function(_0x33f807,_0x2d81ed){if(_0x33f807[_0x6709('0x4c')]['id']){delete _0x33f807['body']['id'];}return db[_0x6709('0x2f')][_0x6709('0x4a')]({'where':{'id':_0x33f807[_0x6709('0x48')]['id']}})[_0x6709('0x29')](handleEntityNotFound(_0x2d81ed,null))['then'](saveUpdates(_0x33f807[_0x6709('0x4c')],null))[_0x6709('0x29')](respondWithResult(_0x2d81ed,null))[_0x6709('0x46')](handleError(_0x2d81ed,null));};exports['destroy']=function(_0x18a5da,_0x1dbd3f){return db[_0x6709('0x2f')][_0x6709('0x4a')]({'where':{'id':_0x18a5da[_0x6709('0x48')]['id']}})['then'](handleEntityNotFound(_0x1dbd3f,null))['then'](removeEntity(_0x1dbd3f,null))[_0x6709('0x46')](handleError(_0x1dbd3f,null));};exports['describe']=function(_0x19171d,_0x4a3267){return db[_0x6709('0x2f')][_0x6709('0x4d')]()[_0x6709('0x29')](respondWithResult(_0x4a3267,null))[_0x6709('0x46')](handleError(_0x4a3267,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d1f90c0..a8bc5ce 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 _0xe35e=['VoiceDialReport','uniqueid','util','../../config/logger','api','path','rimraf','./voiceDialReport.attributes','exports','define'];(function(_0x3b72d8,_0x1ed42e){var _0x59bee4=function(_0x251b69){while(--_0x251b69){_0x3b72d8['push'](_0x3b72d8['shift']());}};_0x59bee4(++_0x1ed42e);}(_0xe35e,0xfc));var _0xee35=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xe35e[_0x55ff3e];return _0x2709eb;};'use strict';var _=require('lodash');var util=require(_0xee35('0x0'));var logger=require(_0xee35('0x1'))(_0xee35('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee35('0x3'));var rimraf=require(_0xee35('0x4'));var config=require('../../config/environment');var attributes=require(_0xee35('0x5'));module[_0xee35('0x6')]=function(_0x57da7f,_0x4d7879){return _0x57da7f[_0xee35('0x7')](_0xee35('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xee35('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x177a=['lodash','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x4c54fa,_0x25ed7e){var _0x413f32=function(_0x502ec1){while(--_0x502ec1){_0x4c54fa['push'](_0x4c54fa['shift']());}};_0x413f32(++_0x25ed7e);}(_0x177a,0xdd));var _0xa177=function(_0x2584dd,_0xa71019){_0x2584dd=_0x2584dd-0x0;var _0x51278b=_0x177a[_0x2584dd];return _0x51278b;};'use strict';var _=require(_0xa177('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa177('0x1'));var moment=require(_0xa177('0x2'));var BPromise=require(_0xa177('0x3'));var rp=require(_0xa177('0x4'));var fs=require('fs');var path=require(_0xa177('0x5'));var rimraf=require(_0xa177('0x6'));var config=require('../../config/environment');var attributes=require(_0xa177('0x7'));module[_0xa177('0x8')]=function(_0x1f37b0,_0x455737){return _0x1f37b0[_0xa177('0x9')](_0xa177('0xa'),attributes,{'tableName':_0xa177('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa177('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index eca3bf7..99d6cb4 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 _0x9ddb=['error','code','message','request\x20sent','CreateVoiceDialReport','VoiceDialReport','body','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9ddb,0x1ef));var _0xb9dd=function(_0x3a74c9,_0x5edbc1){_0x3a74c9=_0x3a74c9-0x0;var _0x49b49e=_0x9ddb[_0x3a74c9];return _0x49b49e;};'use strict';var _=require(_0xb9dd('0x0'));var util=require(_0xb9dd('0x1'));var moment=require('moment');var BPromise=require(_0xb9dd('0x2'));var rs=require(_0xb9dd('0x3'));var fs=require('fs');var Redis=require(_0xb9dd('0x4'));var db=require(_0xb9dd('0x5'))['db'];var utils=require(_0xb9dd('0x6'));var logger=require('../../config/logger')(_0xb9dd('0x7'));var config=require(_0xb9dd('0x8'));var jayson=require(_0xb9dd('0x9'));var client=jayson[_0xb9dd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12dcfc,_0x3b51f7,_0x12331a){return new BPromise(function(_0x17278a,_0x58b350){return client['request'](_0x12dcfc,_0x12331a)[_0xb9dd('0xb')](function(_0x1640fa){logger[_0xb9dd('0xc')](_0xb9dd('0xd'),_0x3b51f7,'request\x20sent');logger[_0xb9dd('0xe')](_0xb9dd('0xf'),_0x3b51f7,'request\x20sent',JSON[_0xb9dd('0x10')](_0x1640fa));if(_0x1640fa[_0xb9dd('0x11')]){if(_0x1640fa[_0xb9dd('0x11')][_0xb9dd('0x12')]===0x1f4){logger[_0xb9dd('0x11')](_0xb9dd('0xd'),_0x3b51f7,_0x1640fa['error']['message']);return _0x58b350(_0x1640fa['error'][_0xb9dd('0x13')]);}logger[_0xb9dd('0x11')](_0xb9dd('0xd'),_0x3b51f7,_0x1640fa[_0xb9dd('0x11')][_0xb9dd('0x13')]);return _0x17278a(_0x1640fa['error']['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x3b51f7,_0xb9dd('0x14'));_0x17278a(_0x1640fa['result'][_0xb9dd('0x13')]);}})['catch'](function(_0x3f1360){logger[_0xb9dd('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3b51f7,_0x3f1360);_0x58b350(_0x3f1360);});});}exports[_0xb9dd('0x15')]=function(_0x1670de){var _0x1400dd=this;return new Promise(function(_0x11871a,_0x4e29e6){return db[_0xb9dd('0x16')]['create'](_0x1670de[_0xb9dd('0x17')],{'raw':_0x1670de[_0xb9dd('0x18')]?_0x1670de['options'][_0xb9dd('0x19')]===undefined?!![]:![]:!![]})[_0xb9dd('0xb')](function(_0x5bffcc){logger[_0xb9dd('0xc')](_0xb9dd('0x15'),_0x1670de);logger[_0xb9dd('0xe')]('CreateVoiceDialReport',_0x1670de,JSON[_0xb9dd('0x10')](_0x5bffcc));_0x11871a(_0x5bffcc);})[_0xb9dd('0x1a')](function(_0x2bad78){logger[_0xb9dd('0x11')](_0xb9dd('0x15'),_0x2bad78[_0xb9dd('0x13')],_0x1670de);_0x4e29e6(_0x1400dd[_0xb9dd('0x11')](0x1f4,_0x2bad78[_0xb9dd('0x13')]));});});};exports[_0xb9dd('0x1b')]=function(_0x5d44e4){var _0x16f659=this;return new Promise(function(_0x29d6f7,_0x3e1e7b){return db[_0xb9dd('0x16')][_0xb9dd('0x1c')](_0x5d44e4[_0xb9dd('0x17')],{'raw':_0x5d44e4[_0xb9dd('0x18')]?_0x5d44e4['options'][_0xb9dd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d44e4['options']?_0x5d44e4[_0xb9dd('0x18')][_0xb9dd('0x1d')]||null:null,'attributes':_0x5d44e4[_0xb9dd('0x18')]?_0x5d44e4[_0xb9dd('0x18')][_0xb9dd('0x1e')]||null:null,'limit':_0x5d44e4[_0xb9dd('0x18')]?_0x5d44e4['options'][_0xb9dd('0x1f')]||null:null})[_0xb9dd('0xb')](function(_0x4b618f){logger[_0xb9dd('0xc')]('UpdateVoiceDialReport',_0x5d44e4);logger[_0xb9dd('0xe')](_0xb9dd('0x1b'),_0x5d44e4,JSON[_0xb9dd('0x10')](_0x4b618f));_0x29d6f7(_0x4b618f);})[_0xb9dd('0x1a')](function(_0x3759a9){logger[_0xb9dd('0x11')]('UpdateVoiceDialReport',_0x3759a9[_0xb9dd('0x13')],_0x5d44e4);_0x3e1e7b(_0x16f659[_0xb9dd('0x11')](0x1f4,_0x3759a9['message']));});});}; \ No newline at end of file +var _0x6c11=['options','raw','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','body'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6c11,0x19f));var _0x16c1=function(_0x187f72,_0x32f589){_0x187f72=_0x187f72-0x0;var _0x5b6b49=_0x6c11[_0x187f72];return _0x5b6b49;};'use strict';var _=require(_0x16c1('0x0'));var util=require(_0x16c1('0x1'));var moment=require(_0x16c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16c1('0x3'));var fs=require('fs');var Redis=require(_0x16c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x16c1('0x5'));var logger=require(_0x16c1('0x6'))(_0x16c1('0x7'));var config=require(_0x16c1('0x8'));var jayson=require(_0x16c1('0x9'));var client=jayson[_0x16c1('0xa')][_0x16c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x252d96,_0x582dbe,_0x126439){return new BPromise(function(_0x5d3c56,_0x45dd3d){return client[_0x16c1('0xc')](_0x252d96,_0x126439)[_0x16c1('0xd')](function(_0x514cf0){logger[_0x16c1('0xe')](_0x16c1('0xf'),_0x582dbe,'request\x20sent');logger[_0x16c1('0x10')](_0x16c1('0x11'),_0x582dbe,_0x16c1('0x12'),JSON[_0x16c1('0x13')](_0x514cf0));if(_0x514cf0[_0x16c1('0x14')]){if(_0x514cf0[_0x16c1('0x14')][_0x16c1('0x15')]===0x1f4){logger[_0x16c1('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x582dbe,_0x514cf0['error']['message']);return _0x45dd3d(_0x514cf0[_0x16c1('0x14')][_0x16c1('0x16')]);}logger[_0x16c1('0x14')](_0x16c1('0xf'),_0x582dbe,_0x514cf0['error']['message']);return _0x5d3c56(_0x514cf0[_0x16c1('0x14')][_0x16c1('0x16')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x582dbe,_0x16c1('0x12'));_0x5d3c56(_0x514cf0['result']['message']);}})[_0x16c1('0x17')](function(_0xb82538){logger[_0x16c1('0x14')](_0x16c1('0xf'),_0x582dbe,_0xb82538);_0x45dd3d(_0xb82538);});});}exports[_0x16c1('0x18')]=function(_0x1c21ec){var _0x14555e=this;return new Promise(function(_0x53564a,_0x4713c2){return db[_0x16c1('0x19')]['create'](_0x1c21ec[_0x16c1('0x1a')],{'raw':_0x1c21ec[_0x16c1('0x1b')]?_0x1c21ec['options'][_0x16c1('0x1c')]===undefined?!![]:![]:!![]})[_0x16c1('0xd')](function(_0x5d851d){logger[_0x16c1('0xe')](_0x16c1('0x18'),_0x1c21ec);logger[_0x16c1('0x10')](_0x16c1('0x18'),_0x1c21ec,JSON[_0x16c1('0x13')](_0x5d851d));_0x53564a(_0x5d851d);})[_0x16c1('0x17')](function(_0x1b8f70){logger[_0x16c1('0x14')](_0x16c1('0x18'),_0x1b8f70[_0x16c1('0x16')],_0x1c21ec);_0x4713c2(_0x14555e[_0x16c1('0x14')](0x1f4,_0x1b8f70['message']));});});};exports[_0x16c1('0x1d')]=function(_0x466984){var _0x535133=this;return new Promise(function(_0x1001e5,_0x5bb0b6){return db[_0x16c1('0x19')][_0x16c1('0x1e')](_0x466984[_0x16c1('0x1a')],{'raw':_0x466984[_0x16c1('0x1b')]?_0x466984[_0x16c1('0x1b')][_0x16c1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466984[_0x16c1('0x1b')]?_0x466984['options'][_0x16c1('0x1f')]||null:null,'attributes':_0x466984[_0x16c1('0x1b')]?_0x466984['options'][_0x16c1('0x20')]||null:null,'limit':_0x466984[_0x16c1('0x1b')]?_0x466984['options'][_0x16c1('0x21')]||null:null})[_0x16c1('0xd')](function(_0x250370){logger[_0x16c1('0xe')]('UpdateVoiceDialReport',_0x466984);logger[_0x16c1('0x10')](_0x16c1('0x1d'),_0x466984,JSON[_0x16c1('0x13')](_0x250370));_0x1001e5(_0x250370);})[_0x16c1('0x17')](function(_0x23d3fc){logger[_0x16c1('0x14')](_0x16c1('0x1d'),_0x23d3fc['message'],_0x466984);_0x5bb0b6(_0x535133['error'](0x1f4,_0x23d3fc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ac46f79..1f1a334 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 _0x53c4=['isAuthenticated','index','get','/:id','create','post','addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x461cd7,_0x555589){var _0x58b3a9=function(_0x2497b5){while(--_0x2497b5){_0x461cd7['push'](_0x461cd7['shift']());}};_0x58b3a9(++_0x555589);}(_0x53c4,0xd1));var _0x453c=function(_0x1413d2,_0x179c6d){_0x1413d2=_0x1413d2-0x0;var _0x5b674d=_0x53c4[_0x1413d2];return _0x5b674d;};'use strict';var multer=require(_0x453c('0x0'));var util=require(_0x453c('0x1'));var path=require(_0x453c('0x2'));var timeout=require(_0x453c('0x3'));var express=require(_0x453c('0x4'));var router=express[_0x453c('0x5')]();var fs_extra=require(_0x453c('0x6'));var auth=require(_0x453c('0x7'));var interaction=require(_0x453c('0x8'));var config=require(_0x453c('0x9'));var controller=require(_0x453c('0xa'));router['get']('/',auth[_0x453c('0xb')](),controller[_0x453c('0xc')]);router[_0x453c('0xd')](_0x453c('0xe'),auth[_0x453c('0xb')](),controller['show']);router['post']('/',auth[_0x453c('0xb')](),controller[_0x453c('0xf')]);router[_0x453c('0x10')]('/:id/applications',auth[_0x453c('0xb')](),controller[_0x453c('0x11')]);router['put'](_0x453c('0xe'),auth[_0x453c('0xb')](),controller[_0x453c('0x12')]);router[_0x453c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x453c('0x14')]);module[_0x453c('0x15')]=router; \ No newline at end of file +var _0x45a2=['show','create','/:id/applications','addApplications','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','isAuthenticated'];(function(_0x28818a,_0x3213b5){var _0x31e115=function(_0x2f2bb7){while(--_0x2f2bb7){_0x28818a['push'](_0x28818a['shift']());}};_0x31e115(++_0x3213b5);}(_0x45a2,0x137));var _0x245a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x45a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x245a('0x0'));var util=require('util');var path=require(_0x245a('0x1'));var timeout=require(_0x245a('0x2'));var express=require(_0x245a('0x3'));var router=express[_0x245a('0x4')]();var fs_extra=require(_0x245a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x245a('0x6'));var config=require(_0x245a('0x7'));var controller=require(_0x245a('0x8'));router[_0x245a('0x9')]('/',auth['isAuthenticated'](),controller[_0x245a('0xa')]);router[_0x245a('0x9')]('/:id',auth[_0x245a('0xb')](),controller[_0x245a('0xc')]);router['post']('/',auth[_0x245a('0xb')](),controller[_0x245a('0xd')]);router['post'](_0x245a('0xe'),auth[_0x245a('0xb')](),controller[_0x245a('0xf')]);router['put'](_0x245a('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x245a('0x11')](_0x245a('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x245a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index da30308..fcea930 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 _0x01d0=['compositeIndex','inbound','internal','inbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','STRING'];(function(_0x4ae761,_0x2fbb0f){var _0x4c2da5=function(_0xa0615b){while(--_0xa0615b){_0x4ae761['push'](_0x4ae761['shift']());}};_0x4c2da5(++_0x2fbb0f);}(_0x01d0,0xc5));var _0x001d=function(_0x29e57e,_0x2d1f6c){_0x29e57e=_0x29e57e-0x0;var _0x5dd5a7=_0x01d0[_0x29e57e];return _0x5dd5a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'unique':_0x001d('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'unique':_0x001d('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x001d('0x1')},'tag':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x001d('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x001d('0x2'),'outbound',_0x001d('0x3'),_0x001d('0x4'),'outbound-fax','system',_0x001d('0x5')),'allowNull':![]},'description':{'type':Sequelize[_0x001d('0x0')]},'interval':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'defaultValue':_0x001d('0x6')},'IntervalId':{'type':Sequelize[_0x001d('0x7')]},'isApp':{'type':Sequelize[_0x001d('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x001d('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x001d('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0x001d('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x001d('0x7')]},'recordingFormat':{'type':Sequelize[_0x001d('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x001d('0x8')],'defaultValue':!![]},'name':{'type':Sequelize[_0x001d('0x9')],'get':function(_0x4576db){return this['getDataValue'](_0x001d('0xa'));}},'alias':{'type':Sequelize[_0x001d('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x73ab=['outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','inbound','outbound','inbound-fax'];(function(_0x3b46df,_0x2e9347){var _0x1f07d5=function(_0x42fc80){while(--_0x42fc80){_0x3b46df['push'](_0x3b46df['shift']());}};_0x1f07d5(++_0x2e9347);}(_0x73ab,0xa9));var _0xb73a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x73ab[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');module[_0xb73a('0x0')]={'context':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xb73a('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb73a('0x3')},'appdata':{'type':Sequelize[_0xb73a('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xb73a('0x4'),_0xb73a('0x5'),'internal',_0xb73a('0x6'),_0xb73a('0x7'),_0xb73a('0x8'),_0xb73a('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xb73a('0x1')]},'interval':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'defaultValue':_0xb73a('0xa')},'IntervalId':{'type':Sequelize[_0xb73a('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xb73a('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xb73a('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb73a('0xb')]},'recordingFormat':{'type':Sequelize[_0xb73a('0x1')],'defaultValue':_0xb73a('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xb73a('0xe')],'get':function(_0x27224f){return this['getDataValue'](_0xb73a('0xf'));}},'alias':{'type':Sequelize[_0xb73a('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ce74a43..11d25a1 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 _0x781a=['findAll','rows','catch','params','rawAttributes','create','startsWith','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status','end','json','undefined','limit','count','set','destroy','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','then','sendStatus','error','stack','send','VoiceExtension','fieldName','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','merge','options','includeAll','include'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x781a,0xe1));var _0xa781=function(_0x36e4d9,_0x395aaf){_0x36e4d9=_0x36e4d9-0x0;var _0xc87153=_0x781a[_0x36e4d9];return _0xc87153;};'use strict';var _=require(_0xa781('0x0'));var Redis=require(_0xa781('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa781('0x2'))(_0xa781('0x3'));var config=require(_0xa781('0x4'));var db=require('../../mysqldb')['db'];config[_0xa781('0x5')]=_[_0xa781('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa781('0x7'))(new Redis(config[_0xa781('0x5')]));require(_0xa781('0x8'))[_0xa781('0x9')](socket);function respondWithStatusCode(_0x5d3307,_0x1f0ca6){_0x1f0ca6=_0x1f0ca6||0xcc;return function(_0x2d143b){if(_0x2d143b){return _0x5d3307['sendStatus'](_0x1f0ca6);}return _0x5d3307[_0xa781('0xa')](_0x1f0ca6)[_0xa781('0xb')]();};}function respondWithResult(_0x193142,_0x4b0766){_0x4b0766=_0x4b0766||0xc8;return function(_0x549dd7){if(_0x549dd7){return _0x193142[_0xa781('0xa')](_0x4b0766)[_0xa781('0xc')](_0x549dd7);}};}function respondWithFilteredResult(_0x37634e,_0x295f98){return function(_0x3de63c){if(_0x3de63c){var _0x55fc00=typeof _0x295f98['offset']===_0xa781('0xd')&&typeof _0x295f98[_0xa781('0xe')]===_0xa781('0xd');var _0x49ce9a=_0x3de63c[_0xa781('0xf')];var _0x3dc6c9=_0x55fc00?0x0:_0x295f98['offset'];var _0x4f91f8=_0x55fc00?_0x3de63c[_0xa781('0xf')]:_0x295f98['offset']+_0x295f98[_0xa781('0xe')];var _0x1ba22d;if(_0x4f91f8>=_0x49ce9a){_0x4f91f8=_0x49ce9a;_0x1ba22d=0xc8;}else{_0x1ba22d=0xce;}_0x37634e[_0xa781('0xa')](_0x1ba22d);return _0x37634e[_0xa781('0x10')]('Content-Range',_0x3dc6c9+'-'+_0x4f91f8+'/'+_0x49ce9a)[_0xa781('0xc')](_0x3de63c);}return null;};}function removeEntity(_0x429d98){return function(_0xb01be5){if(_0xb01be5){return _0xb01be5[_0xa781('0x11')]()['then'](function(){var _0x335953=_0xb01be5['get']({'plain':!![]});var _0x554e0a=[{'name':_0xa781('0x12'),'value':_0xa781('0x13'),'ignore':![]},{'name':'OutboundRoutes','value':_0xa781('0x14'),'ignore':![]},{'name':_0xa781('0x15'),'value':_0xa781('0x16'),'ignore':![]}];var _0x3cea9c=_(_0x554e0a)[_0xa781('0x17')](_0xa781('0x18'))['map'](_0xa781('0x19'))[_0xa781('0x19')]();if(_[_0xa781('0x1a')](_0x3cea9c,_0x335953[_0xa781('0x1b')])){return;}var _0x5a30f2=_[_0xa781('0x1c')](_0x554e0a,[_0xa781('0x19'),_0x335953[_0xa781('0x1b')]])['name'];return db['UserProfileResource'][_0xa781('0x11')]({'where':{'type':_0x5a30f2,'resourceId':_0x335953['id']}})[_0xa781('0x1d')](function(){return _0xb01be5;});})[_0xa781('0x1d')](function(){_0x429d98[_0xa781('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e11b){return function(_0x73c964){if(!_0x73c964){_0x30e11b[_0xa781('0x1e')](0x194);}return _0x73c964;};}function handleError(_0x39e93f,_0x4afd6c){_0x4afd6c=_0x4afd6c||0x1f4;return function(_0x27bb27){logger[_0xa781('0x1f')](_0x27bb27[_0xa781('0x20')]);if(_0x27bb27['name']){delete _0x27bb27['name'];}_0x39e93f[_0xa781('0xa')](_0x4afd6c)[_0xa781('0x21')](_0x27bb27);};}exports['index']=function(_0x2955bf,_0x33b403){var _0x21a7f7={},_0x3d5cdf={},_0x356da6={'count':0x0,'rows':[]};var _0x424aef=_['map'](db[_0xa781('0x22')]['rawAttributes'],function(_0xc39b57){return{'name':_0xc39b57[_0xa781('0x23')],'type':_0xc39b57[_0xa781('0x1b')][_0xa781('0x24')]};});_0x3d5cdf[_0xa781('0x25')]=_[_0xa781('0x26')](_0x424aef,_0xa781('0x27'));_0x3d5cdf[_0xa781('0x28')]=_[_0xa781('0x29')](_0x2955bf[_0xa781('0x28')]);_0x3d5cdf[_0xa781('0x2a')]=_['intersection'](_0x3d5cdf[_0xa781('0x25')],_0x3d5cdf['query']);_0x21a7f7[_0xa781('0x2b')]=_[_0xa781('0x2c')](_0x3d5cdf[_0xa781('0x25')],qs[_0xa781('0x2d')](_0x2955bf[_0xa781('0x28')][_0xa781('0x2d')]));_0x21a7f7['attributes']=_0x21a7f7[_0xa781('0x2b')][_0xa781('0x2e')]?_0x21a7f7[_0xa781('0x2b')]:_0x3d5cdf[_0xa781('0x25')];if(!_0x2955bf['query'][_0xa781('0x2f')](_0xa781('0x30'))){_0x21a7f7[_0xa781('0xe')]=qs['limit'](_0x2955bf[_0xa781('0x28')][_0xa781('0xe')]);_0x21a7f7[_0xa781('0x31')]=qs[_0xa781('0x31')](_0x2955bf[_0xa781('0x28')][_0xa781('0x31')]);}_0x21a7f7[_0xa781('0x32')]=qs[_0xa781('0x33')](_0x2955bf[_0xa781('0x28')][_0xa781('0x33')]);_0x21a7f7[_0xa781('0x34')]=qs[_0xa781('0x2a')](_['pick'](_0x2955bf[_0xa781('0x28')],_0x3d5cdf[_0xa781('0x2a')]),_0x424aef);if(_0x2955bf[_0xa781('0x28')][_0xa781('0x17')]){_0x21a7f7[_0xa781('0x34')]=_[_0xa781('0x35')](_0x21a7f7[_0xa781('0x34')],{'$or':_[_0xa781('0x26')](_0x424aef,function(_0x159c69){if(_0x159c69[_0xa781('0x1b')]!=='VIRTUAL'){var _0x7e12d4={};_0x7e12d4[_0x159c69[_0xa781('0x27')]]={'$like':'%'+_0x2955bf[_0xa781('0x28')][_0xa781('0x17')]+'%'};return _0x7e12d4;}})});}_0x21a7f7=_[_0xa781('0x35')]({},_0x21a7f7,_0x2955bf[_0xa781('0x36')]);var _0x22554c={'where':_0x21a7f7[_0xa781('0x34')]};return db[_0xa781('0x22')][_0xa781('0xf')](_0x22554c)['then'](function(_0x347b17){_0x356da6[_0xa781('0xf')]=_0x347b17;if(_0x2955bf['query'][_0xa781('0x37')]){_0x21a7f7[_0xa781('0x38')]=[{'all':!![]}];}return db['VoiceExtension'][_0xa781('0x39')](_0x21a7f7);})['then'](function(_0xea11e3){_0x356da6[_0xa781('0x3a')]=_0xea11e3;return _0x356da6;})[_0xa781('0x1d')](respondWithFilteredResult(_0x33b403,_0x21a7f7))[_0xa781('0x3b')](handleError(_0x33b403,null));};exports['show']=function(_0x13021f,_0x6a2886){var _0x37ece9={'raw':![],'where':{'id':_0x13021f[_0xa781('0x3c')]['id']}},_0x440b00={};_0x440b00[_0xa781('0x25')]=_[_0xa781('0x29')](db[_0xa781('0x22')][_0xa781('0x3d')]);_0x440b00[_0xa781('0x28')]=_['keys'](_0x13021f[_0xa781('0x28')]);_0x440b00['filters']=_['intersection'](_0x440b00[_0xa781('0x25')],_0x440b00[_0xa781('0x28')]);_0x37ece9[_0xa781('0x2b')]=_[_0xa781('0x2c')](_0x440b00[_0xa781('0x25')],qs['fields'](_0x13021f[_0xa781('0x28')][_0xa781('0x2d')]));_0x37ece9[_0xa781('0x2b')]=_0x37ece9[_0xa781('0x2b')][_0xa781('0x2e')]?_0x37ece9[_0xa781('0x2b')]:_0x440b00[_0xa781('0x25')];if(_0x13021f[_0xa781('0x28')][_0xa781('0x37')]){_0x37ece9[_0xa781('0x38')]=[{'all':!![]}];}_0x37ece9=_[_0xa781('0x35')]({},_0x37ece9,_0x13021f[_0xa781('0x36')]);return db[_0xa781('0x22')][_0xa781('0x1c')](_0x37ece9)[_0xa781('0x1d')](handleEntityNotFound(_0x6a2886,null))[_0xa781('0x1d')](respondWithResult(_0x6a2886,null))[_0xa781('0x3b')](handleError(_0x6a2886,null));};exports[_0xa781('0x11')]=function(_0x49a6b9,_0xd6e47d){return db[_0xa781('0x22')][_0xa781('0x1c')]({'where':{'id':_0x49a6b9[_0xa781('0x3c')]['id']}})[_0xa781('0x1d')](handleEntityNotFound(_0xd6e47d,null))[_0xa781('0x1d')](removeEntity(_0xd6e47d,null))[_0xa781('0x3b')](handleError(_0xd6e47d,null));};exports[_0xa781('0x3e')]=function(_0x577829,_0x8c86bb){if(_0x577829['body'][_0xa781('0x1b')]==='outbound'&&!_[_0xa781('0x3f')](_0x577829[_0xa781('0x40')]['exten'],'_')){_0x577829[_0xa781('0x40')][_0xa781('0x41')]='_'[_0xa781('0x42')](_0x577829[_0xa781('0x40')][_0xa781('0x41')]);}return db[_0xa781('0x22')][_0xa781('0x3e')](_0x577829[_0xa781('0x40')],{'raw':![]})[_0xa781('0x1d')](function(_0x5e4820){var _0x1512b5=_0x577829[_0xa781('0x43')][_0xa781('0x44')]({'plain':!![]});if(!_0x1512b5)throw new Error(_0xa781('0x45'));if(_0x1512b5[_0xa781('0x46')]===_0xa781('0x43')){var _0x55626a=_0x5e4820[_0xa781('0x44')]({'plain':!![]});var _0x23d037=[{'name':'InboundRoutes','value':_0xa781('0x13')},{'name':'OutboundRoutes','value':_0xa781('0x14')},{'name':'InternalRoutes','value':_0xa781('0x16')}];var _0x4c3648=_[_0xa781('0x1c')](_0x23d037,[_0xa781('0x19'),_0x55626a[_0xa781('0x1b')]])[_0xa781('0x27')];return db[_0xa781('0x47')]['find']({'where':{'name':_0x4c3648,'userProfileId':_0x1512b5['userProfileId']},'raw':!![]})[_0xa781('0x1d')](function(_0x4a6518){if(_0x4a6518&&_0x4a6518[_0xa781('0x48')]===0x0){return db[_0xa781('0x49')][_0xa781('0x3e')]({'name':_0x55626a['name'],'resourceId':_0x55626a['id'],'type':_0x4a6518[_0xa781('0x27')],'sectionId':_0x4a6518['id']},{})[_0xa781('0x1d')](function(){return _0x5e4820;});}else{return _0x5e4820;}})[_0xa781('0x3b')](function(_0x100f68){logger['error'](_0xa781('0x4a'),_0x100f68);throw _0x100f68;});}return _0x5e4820;})['then'](respondWithResult(_0x8c86bb,0xc9))[_0xa781('0x3b')](handleError(_0x8c86bb,null));};exports[_0xa781('0x4b')]=function(_0x4545bb,_0x1a52b0){if(_0x4545bb[_0xa781('0x40')]['id']){delete _0x4545bb[_0xa781('0x40')]['id'];}return db[_0xa781('0x22')][_0xa781('0x1c')]({'where':{'id':_0x4545bb['params']['id']}})['then'](handleEntityNotFound(_0x1a52b0,null))[_0xa781('0x1d')](function(_0x24c120){if(_0x24c120){return db[_0xa781('0x22')][_0xa781('0x4b')](_[_0xa781('0x4c')](_0x4545bb[_0xa781('0x40')],['exten',_0xa781('0x4d'),'description',_0xa781('0x4e'),_0xa781('0x4f'),'mandatoryDisposition',_0xa781('0x50')]),{'where':{'context':_0x24c120[_0xa781('0x4d')],'exten':_0x24c120[_0xa781('0x41')]},'individualHooks':!![]})[_0xa781('0x1d')](function(_0x10b214){return _0x10b214;});}return null;})[_0xa781('0x1d')](respondWithStatusCode(_0x1a52b0,null))['catch'](handleError(_0x1a52b0,null));};exports[_0xa781('0x51')]=function(_0x3f8827,_0xe8d8ca){var _0xe54399=_0x3f8827[_0xa781('0x3c')]['id'];var _0x30c54f=_0x3f8827[_0xa781('0x40')];var _0x50b402=0xc8;var _0x4d5545=null;return db[_0xa781('0x52')][_0xa781('0x53')]({'isolationLevel':db['sequelize'][_0xa781('0x54')][_0xa781('0x55')][_0xa781('0x56')]},function(_0x305809){return db[_0xa781('0x22')][_0xa781('0x57')]({'where':{'id':_0xe54399},'transaction':_0x305809})[_0xa781('0x1d')](function(_0x256dbb){if(_0x256dbb){return db[_0xa781('0x22')]['destroy']({'where':{'VoiceExtensionId':_0xe54399},'transaction':_0x305809})[_0xa781('0x1d')](function(){var _0x58ec8e=_['map'](_0x30c54f,function(_0x21ccb6){_0x21ccb6[_0xa781('0x58')]=_0xe54399;_0x21ccb6['isApp']=!![];return _0x21ccb6;});return _0x256dbb[_0xa781('0x59')](_0x58ec8e);})[_0xa781('0x1d')](function(_0x3425c8){return db[_0xa781('0x22')][_0xa781('0x5a')](_0x3425c8,{'transaction':_0x305809});});}else{_0x50b402=0x194;_0x4d5545=[];}});})[_0xa781('0x1d')](function(){if(_0x50b402!==0x194){return db[_0xa781('0x22')][_0xa781('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xe54399},'order':_0xa781('0x5c')})[_0xa781('0x1d')](function(_0x2c5feb){_0x4d5545=_0x2c5feb;});}})[_0xa781('0x3b')](function(_0x2e5958){_0x50b402=0x1f4;logger[_0xa781('0x1f')](_0x2e5958[_0xa781('0x20')]);if(_0x2e5958['name']){delete _0x2e5958[_0xa781('0x27')];}_0x4d5545=_0x2e5958;})[_0xa781('0x5d')](function(){if(_0x4d5545===null){_0xe8d8ca['sendStatus'](_0x50b402);}else{if(_0x50b402===0x1f4){_0xe8d8ca['status'](_0x50b402)[_0xa781('0x21')](_0x4d5545);}else{_0xe8d8ca[_0xa781('0xa')](_0x50b402)[_0xa781('0xc')](_0x4d5545);}}});}; \ No newline at end of file +var _0x8576=['InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type','find','name','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','catch','params','includeAll','create','body','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','internal','UserProfileSection','error','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','destroy','then','get'];(function(_0xfaa342,_0x1cf01e){var _0x36f459=function(_0x1b3990){while(--_0x1b3990){_0xfaa342['push'](_0xfaa342['shift']());}};_0x36f459(++_0x1cf01e);}(_0x8576,0x148));var _0x6857=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x8576[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x6857('0x0'));var Redis=require(_0x6857('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x6857('0x2'))('api');var config=require('../../config/environment');var db=require(_0x6857('0x3'))['db'];config[_0x6857('0x4')]=_['defaults'](config['redis'],{'host':_0x6857('0x5'),'port':0x18eb});var socket=require(_0x6857('0x6'))(new Redis(config[_0x6857('0x4')]));require('./voiceExtension.socket')[_0x6857('0x7')](socket);function respondWithStatusCode(_0x1f4fd8,_0x2a4350){_0x2a4350=_0x2a4350||0xcc;return function(_0x24498f){if(_0x24498f){return _0x1f4fd8[_0x6857('0x8')](_0x2a4350);}return _0x1f4fd8[_0x6857('0x9')](_0x2a4350)[_0x6857('0xa')]();};}function respondWithResult(_0x57e32d,_0x7880d0){_0x7880d0=_0x7880d0||0xc8;return function(_0x2f0377){if(_0x2f0377){return _0x57e32d[_0x6857('0x9')](_0x7880d0)[_0x6857('0xb')](_0x2f0377);}};}function respondWithFilteredResult(_0x212da0,_0x55a3d4){return function(_0x4c517e){if(_0x4c517e){var _0x4bebb9=typeof _0x55a3d4['offset']===_0x6857('0xc')&&typeof _0x55a3d4[_0x6857('0xd')]===_0x6857('0xc');var _0x43bc03=_0x4c517e[_0x6857('0xe')];var _0x5d1066=_0x4bebb9?0x0:_0x55a3d4[_0x6857('0xf')];var _0x204c58=_0x4bebb9?_0x4c517e[_0x6857('0xe')]:_0x55a3d4[_0x6857('0xf')]+_0x55a3d4[_0x6857('0xd')];var _0x2fe6de;if(_0x204c58>=_0x43bc03){_0x204c58=_0x43bc03;_0x2fe6de=0xc8;}else{_0x2fe6de=0xce;}_0x212da0[_0x6857('0x9')](_0x2fe6de);return _0x212da0[_0x6857('0x10')]('Content-Range',_0x5d1066+'-'+_0x204c58+'/'+_0x43bc03)[_0x6857('0xb')](_0x4c517e);}return null;};}function removeEntity(_0x5d45cc){return function(_0xed6192){if(_0xed6192){return _0xed6192[_0x6857('0x11')]()[_0x6857('0x12')](function(){var _0x2401ba=_0xed6192[_0x6857('0x13')]({'plain':!![]});var _0x377a62=[{'name':_0x6857('0x14'),'value':_0x6857('0x15'),'ignore':![]},{'name':_0x6857('0x16'),'value':_0x6857('0x17'),'ignore':![]},{'name':_0x6857('0x18'),'value':'internal','ignore':![]}];var _0x3577b2=_(_0x377a62)[_0x6857('0x19')](_0x6857('0x1a'))[_0x6857('0x1b')](_0x6857('0x1c'))[_0x6857('0x1c')]();if(_['includes'](_0x3577b2,_0x2401ba[_0x6857('0x1d')])){return;}var _0x226828=_[_0x6857('0x1e')](_0x377a62,[_0x6857('0x1c'),_0x2401ba[_0x6857('0x1d')]])[_0x6857('0x1f')];return db[_0x6857('0x20')][_0x6857('0x11')]({'where':{'type':_0x226828,'resourceId':_0x2401ba['id']}})[_0x6857('0x12')](function(){return _0xed6192;});})['then'](function(){_0x5d45cc[_0x6857('0x9')](0xcc)[_0x6857('0xa')]();});}};}function handleEntityNotFound(_0x5a4a9b){return function(_0x22b3cf){if(!_0x22b3cf){_0x5a4a9b[_0x6857('0x8')](0x194);}return _0x22b3cf;};}function handleError(_0x33a0ca,_0x1f780d){_0x1f780d=_0x1f780d||0x1f4;return function(_0x49ff16){logger['error'](_0x49ff16['stack']);if(_0x49ff16[_0x6857('0x1f')]){delete _0x49ff16[_0x6857('0x1f')];}_0x33a0ca[_0x6857('0x9')](_0x1f780d)['send'](_0x49ff16);};}exports['index']=function(_0x3f4df4,_0x2fb0c0){var _0x3443c7={},_0x2ea91b={},_0x433f3a={'count':0x0,'rows':[]};var _0x3fe8a7=_[_0x6857('0x1b')](db['VoiceExtension'][_0x6857('0x21')],function(_0x280e48){return{'name':_0x280e48[_0x6857('0x22')],'type':_0x280e48[_0x6857('0x1d')][_0x6857('0x23')]};});_0x2ea91b[_0x6857('0x24')]=_[_0x6857('0x1b')](_0x3fe8a7,_0x6857('0x1f'));_0x2ea91b[_0x6857('0x25')]=_[_0x6857('0x26')](_0x3f4df4[_0x6857('0x25')]);_0x2ea91b['filters']=_['intersection'](_0x2ea91b[_0x6857('0x24')],_0x2ea91b[_0x6857('0x25')]);_0x3443c7[_0x6857('0x27')]=_[_0x6857('0x28')](_0x2ea91b[_0x6857('0x24')],qs[_0x6857('0x29')](_0x3f4df4['query'][_0x6857('0x29')]));_0x3443c7[_0x6857('0x27')]=_0x3443c7[_0x6857('0x27')][_0x6857('0x2a')]?_0x3443c7[_0x6857('0x27')]:_0x2ea91b[_0x6857('0x24')];if(!_0x3f4df4[_0x6857('0x25')]['hasOwnProperty'](_0x6857('0x2b'))){_0x3443c7['limit']=qs[_0x6857('0xd')](_0x3f4df4[_0x6857('0x25')][_0x6857('0xd')]);_0x3443c7[_0x6857('0xf')]=qs[_0x6857('0xf')](_0x3f4df4[_0x6857('0x25')]['offset']);}_0x3443c7['order']=qs[_0x6857('0x2c')](_0x3f4df4['query'][_0x6857('0x2c')]);_0x3443c7[_0x6857('0x2d')]=qs[_0x6857('0x2e')](_[_0x6857('0x2f')](_0x3f4df4[_0x6857('0x25')],_0x2ea91b[_0x6857('0x2e')]),_0x3fe8a7);if(_0x3f4df4[_0x6857('0x25')][_0x6857('0x19')]){_0x3443c7['where']=_[_0x6857('0x30')](_0x3443c7[_0x6857('0x2d')],{'$or':_[_0x6857('0x1b')](_0x3fe8a7,function(_0x3349c1){if(_0x3349c1['type']!==_0x6857('0x31')){var _0x54aa12={};_0x54aa12[_0x3349c1[_0x6857('0x1f')]]={'$like':'%'+_0x3f4df4[_0x6857('0x25')][_0x6857('0x19')]+'%'};return _0x54aa12;}})});}_0x3443c7=_['merge']({},_0x3443c7,_0x3f4df4[_0x6857('0x32')]);var _0x470646={'where':_0x3443c7[_0x6857('0x2d')]};return db[_0x6857('0x33')]['count'](_0x470646)[_0x6857('0x12')](function(_0xa20b4){_0x433f3a[_0x6857('0xe')]=_0xa20b4;if(_0x3f4df4[_0x6857('0x25')]['includeAll']){_0x3443c7[_0x6857('0x34')]=[{'all':!![]}];}return db['VoiceExtension'][_0x6857('0x35')](_0x3443c7);})['then'](function(_0x4cfa40){_0x433f3a[_0x6857('0x36')]=_0x4cfa40;return _0x433f3a;})[_0x6857('0x12')](respondWithFilteredResult(_0x2fb0c0,_0x3443c7))[_0x6857('0x37')](handleError(_0x2fb0c0,null));};exports['show']=function(_0x6ceb21,_0x584970){var _0x44e59a={'raw':![],'where':{'id':_0x6ceb21[_0x6857('0x38')]['id']}},_0x5b6609={};_0x5b6609[_0x6857('0x24')]=_[_0x6857('0x26')](db[_0x6857('0x33')][_0x6857('0x21')]);_0x5b6609[_0x6857('0x25')]=_[_0x6857('0x26')](_0x6ceb21[_0x6857('0x25')]);_0x5b6609[_0x6857('0x2e')]=_[_0x6857('0x28')](_0x5b6609[_0x6857('0x24')],_0x5b6609[_0x6857('0x25')]);_0x44e59a[_0x6857('0x27')]=_[_0x6857('0x28')](_0x5b6609[_0x6857('0x24')],qs[_0x6857('0x29')](_0x6ceb21[_0x6857('0x25')][_0x6857('0x29')]));_0x44e59a[_0x6857('0x27')]=_0x44e59a[_0x6857('0x27')][_0x6857('0x2a')]?_0x44e59a[_0x6857('0x27')]:_0x5b6609[_0x6857('0x24')];if(_0x6ceb21[_0x6857('0x25')][_0x6857('0x39')]){_0x44e59a[_0x6857('0x34')]=[{'all':!![]}];}_0x44e59a=_[_0x6857('0x30')]({},_0x44e59a,_0x6ceb21[_0x6857('0x32')]);return db['VoiceExtension']['find'](_0x44e59a)[_0x6857('0x12')](handleEntityNotFound(_0x584970,null))[_0x6857('0x12')](respondWithResult(_0x584970,null))['catch'](handleError(_0x584970,null));};exports[_0x6857('0x11')]=function(_0x3def3c,_0x566d3a){return db[_0x6857('0x33')][_0x6857('0x1e')]({'where':{'id':_0x3def3c[_0x6857('0x38')]['id']}})['then'](handleEntityNotFound(_0x566d3a,null))[_0x6857('0x12')](removeEntity(_0x566d3a,null))[_0x6857('0x37')](handleError(_0x566d3a,null));};exports[_0x6857('0x3a')]=function(_0x3a1b7d,_0xc32bfc){if(_0x3a1b7d['body'][_0x6857('0x1d')]===_0x6857('0x17')&&!_['startsWith'](_0x3a1b7d[_0x6857('0x3b')]['exten'],'_')){_0x3a1b7d[_0x6857('0x3b')]['exten']='_'[_0x6857('0x3c')](_0x3a1b7d['body'][_0x6857('0x3d')]);}return db[_0x6857('0x33')][_0x6857('0x3a')](_0x3a1b7d[_0x6857('0x3b')],{'raw':![]})[_0x6857('0x12')](function(_0x221534){var _0x5b422f=_0x3a1b7d[_0x6857('0x3e')]['get']({'plain':!![]});if(!_0x5b422f)throw new Error(_0x6857('0x3f'));if(_0x5b422f['role']===_0x6857('0x3e')){var _0x2ccaab=_0x221534['get']({'plain':!![]});var _0x4208fa=[{'name':_0x6857('0x14'),'value':_0x6857('0x15')},{'name':'OutboundRoutes','value':_0x6857('0x17')},{'name':_0x6857('0x18'),'value':_0x6857('0x40')}];var _0xa4f533=_[_0x6857('0x1e')](_0x4208fa,[_0x6857('0x1c'),_0x2ccaab[_0x6857('0x1d')]])[_0x6857('0x1f')];return db[_0x6857('0x41')][_0x6857('0x1e')]({'where':{'name':_0xa4f533,'userProfileId':_0x5b422f['userProfileId']},'raw':!![]})[_0x6857('0x12')](function(_0x147de4){if(_0x147de4&&_0x147de4['autoAssociation']===0x0){return db[_0x6857('0x20')]['create']({'name':_0x2ccaab[_0x6857('0x1f')],'resourceId':_0x2ccaab['id'],'type':_0x147de4[_0x6857('0x1f')],'sectionId':_0x147de4['id']},{})[_0x6857('0x12')](function(){return _0x221534;});}else{return _0x221534;}})[_0x6857('0x37')](function(_0x3dfec9){logger[_0x6857('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dfec9);throw _0x3dfec9;});}return _0x221534;})['then'](respondWithResult(_0xc32bfc,0xc9))['catch'](handleError(_0xc32bfc,null));};exports[_0x6857('0x43')]=function(_0x11e1b1,_0x3bf301){if(_0x11e1b1[_0x6857('0x3b')]['id']){delete _0x11e1b1['body']['id'];}return db[_0x6857('0x33')][_0x6857('0x1e')]({'where':{'id':_0x11e1b1[_0x6857('0x38')]['id']}})['then'](handleEntityNotFound(_0x3bf301,null))[_0x6857('0x12')](function(_0x20d7a3){if(_0x20d7a3){return db[_0x6857('0x33')][_0x6857('0x43')](_[_0x6857('0x2f')](_0x11e1b1[_0x6857('0x3b')],[_0x6857('0x3d'),_0x6857('0x44'),_0x6857('0x45'),_0x6857('0x46'),_0x6857('0x47'),_0x6857('0x48'),'alias']),{'where':{'context':_0x20d7a3[_0x6857('0x44')],'exten':_0x20d7a3['exten']},'individualHooks':!![]})[_0x6857('0x12')](function(_0x192302){return _0x192302;});}return null;})['then'](respondWithStatusCode(_0x3bf301,null))['catch'](handleError(_0x3bf301,null));};exports[_0x6857('0x49')]=function(_0x1201e0,_0x493d68){var _0x460c76=_0x1201e0['params']['id'];var _0x3fddc0=_0x1201e0['body'];var _0x1edc12=0xc8;var _0x1d58d2=null;return db['sequelize'][_0x6857('0x4a')]({'isolationLevel':db[_0x6857('0x4b')][_0x6857('0x4c')][_0x6857('0x4d')][_0x6857('0x4e')]},function(_0x202fd3){return db[_0x6857('0x33')][_0x6857('0x4f')]({'where':{'id':_0x460c76},'transaction':_0x202fd3})['then'](function(_0x746ff){if(_0x746ff){return db[_0x6857('0x33')][_0x6857('0x11')]({'where':{'VoiceExtensionId':_0x460c76},'transaction':_0x202fd3})[_0x6857('0x12')](function(){var _0x1ed187=_['map'](_0x3fddc0,function(_0x39cfd4){_0x39cfd4[_0x6857('0x50')]=_0x460c76;_0x39cfd4[_0x6857('0x51')]=!![];return _0x39cfd4;});return _0x746ff[_0x6857('0x52')](_0x1ed187);})[_0x6857('0x12')](function(_0x3f124d){return db['VoiceExtension'][_0x6857('0x53')](_0x3f124d,{'transaction':_0x202fd3});});}else{_0x1edc12=0x194;_0x1d58d2=[];}});})[_0x6857('0x12')](function(){if(_0x1edc12!==0x194){return db[_0x6857('0x33')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x460c76},'order':_0x6857('0x54')})['then'](function(_0x54d985){_0x1d58d2=_0x54d985;});}})['catch'](function(_0x364797){_0x1edc12=0x1f4;logger['error'](_0x364797[_0x6857('0x55')]);if(_0x364797[_0x6857('0x1f')]){delete _0x364797[_0x6857('0x1f')];}_0x1d58d2=_0x364797;})[_0x6857('0x56')](function(){if(_0x1d58d2===null){_0x493d68['sendStatus'](_0x1edc12);}else{if(_0x1edc12===0x1f4){_0x493d68[_0x6857('0x9')](_0x1edc12)['send'](_0x1d58d2);}else{_0x493d68[_0x6857('0x9')](_0x1edc12)[_0x6857('0xb')](_0x1d58d2);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e5595ea..67b82d9 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 _0x056d=['VoiceExtension','save','update','remove','emit','hook','events'];(function(_0x20f630,_0x387bf6){var _0x34a034=function(_0x12b7af){while(--_0x12b7af){_0x20f630['push'](_0x20f630['shift']());}};_0x34a034(++_0x387bf6);}(_0x056d,0x125));var _0xd056=function(_0x7e6848,_0x2c333a){_0x7e6848=_0x7e6848-0x0;var _0x110775=_0x056d[_0x7e6848];return _0x110775;};'use strict';var EventEmitter=require(_0xd056('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xd056('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd056('0x2'),'afterUpdate':_0xd056('0x3'),'afterDestroy':_0xd056('0x4')};function emitEvent(_0x25be8f){return function(_0x6613fd,_0x10f866,_0x4173e5){VoiceExtensionEvents[_0xd056('0x5')](_0x25be8f+':'+_0x6613fd['id'],_0x6613fd);VoiceExtensionEvents['emit'](_0x25be8f,_0x6613fd);_0x4173e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xd056('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x729b=['emit','hasOwnProperty','exports','../../mysqldb','VoiceExtension','save','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x729b,0xea));var _0xb729=function(_0x5ea505,_0x4d1f30){_0x5ea505=_0x5ea505-0x0;var _0x48a488=_0x729b[_0x5ea505];return _0x48a488;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xb729('0x0'))['db'][_0xb729('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb729('0x2'),'afterUpdate':_0xb729('0x3'),'afterDestroy':'remove'};function emitEvent(_0x169c48){return function(_0x3e6110,_0x60c7fc,_0x5df254){VoiceExtensionEvents[_0xb729('0x4')](_0x169c48+':'+_0x3e6110['id'],_0x3e6110);VoiceExtensionEvents['emit'](_0x169c48,_0x3e6110);_0x5df254(null);};}for(var e in events){if(events[_0xb729('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xb729('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 51b591e..0961807 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 _0x5d01=['outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','replace','U(xcally-mixmonitor-context)','Interval','IntervalId','then','interval','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','NoOp','CDR(routeAlias)=','alias','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x5d01,0xe5));var _0x15d0=function(_0x158f49,_0x3a3903){_0x158f49=_0x158f49-0x0;var _0x9fe32a=_0x5d01[_0x158f49];return _0x9fe32a;};'use strict';var _=require(_0x15d0('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x15d0('0x1')]=function(_0x451b82){var _0x580bc6=_0x451b82[_0x15d0('0x2')];function _0x665632(_0x5e76ab){var _0x53abcf=0x2;var _0x1a067d=[{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0x5')+_0x5e76ab[_0x15d0('0x3')],'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x5e76ab['alias']?_0x15d0('0x4'):_0x15d0('0x8'),'appdata':_0x5e76ab['alias']?_0x15d0('0x9')+_0x5e76ab[_0x15d0('0xa')]:'No\x20alias\x20set','context':_0x5e76ab['context'],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']}];if(_0x5e76ab[_0x15d0('0x3')]===_0x15d0('0xb')){_0x1a067d[_0x15d0('0xc')]({'type':_0x15d0('0xb'),'app':'Set','appdata':_0x15d0('0xd')+_0x5e76ab['id'],'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']});}_0x1a067d[_0x15d0('0xc')]({'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0xe'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0xf'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0x10'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']});return _0x1a067d;}function _0x50ae3a(_0x536f28){var _0x6831b6=0x2;var _0x1abfa8=[{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x12'),'context':_0x536f28['context'],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x536f28[_0x15d0('0xa')]?_0x15d0('0x4'):'NoOp','appdata':_0x536f28[_0x15d0('0xa')]?'CDR(routeAlias)='+_0x536f28['alias']:_0x15d0('0x13'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x15d0('0x14')+(_0x536f28[_0x15d0('0x15')]?_0x15d0('0x16')+_0x536f28[_0x15d0('0x15')]+'}':'${EXTEN}'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28['exten'],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':'CDR(routeid)='+_0x536f28['id'],'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x6831b6+0x2)+_0x15d0('0x18')+(_0x6831b6+0x1)+')','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28['exten'],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x536f28['cutdigits']?_0x15d0('0x19')+_0x536f28[_0x15d0('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x15d0('0xe'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0xf'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x10'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x1a')+_0x536f28['id'],'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']}];if(_0x536f28[_0x15d0('0x1b')](_0x15d0('0x1c'))&&_0x536f28[_0x15d0('0x1c')]!==_0x15d0('0x1d')){_0x1abfa8[_0x15d0('0xc')]({'type':'outbound','app':_0x15d0('0x4'),'appdata':_0x15d0('0x1e'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x536f28[_0x15d0('0x1c')]||'wav','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']});}return _0x1abfa8;}function _0x496c80(_0x35e1dc,_0x8e02a0){var _0x495d2a=[{'name':_0x15d0('0x1f'),'param':0x0},{'name':_0x15d0('0x20'),'param':0x1},{'name':_0x15d0('0x21'),'param':0x2},{'name':_0x15d0('0x22'),'param':0x3}];var _0x4a7d94={};var _0x54601c=_0x8e02a0[_0x15d0('0x23')](',');var _0x3a9b23=[];for(var _0xdd62e5=0x0;_0xdd62e5<_0x495d2a[_0x15d0('0x24')];_0xdd62e5++){switch(_0x495d2a[_0xdd62e5][_0x15d0('0x25')]){case _0x15d0('0x1f'):_0x4a7d94['trunk']=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]][_0x15d0('0x23')]('/')[0x1];_0x4a7d94[_0x15d0('0x27')]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]['split']('/')[0x2];_0x4a7d94[_0x15d0('0x28')]=_0x4a7d94[_0x15d0('0x27')]?_0x4a7d94[_0x15d0('0x27')]['split']('$')[0x0]:undefined;_0x4a7d94['phone']=_0x35e1dc[_0x15d0('0x15')]?(_0x4a7d94[_0x15d0('0x28')]||'')+_0x15d0('0x16')+_0x35e1dc[_0x15d0('0x15')]+'}':(_0x4a7d94[_0x15d0('0x28')]||'')+'${EXTEN}';_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=[_0x15d0('0x29'),_0x4a7d94[_0x15d0('0x1f')],_0x4a7d94[_0x15d0('0x27')]][_0x15d0('0x2a')]('/');break;case _0x15d0('0x21'):_0x4a7d94[_0x15d0('0x21')]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]];if(_0x35e1dc[_0x15d0('0x1c')]!==_0x15d0('0x1d')){if(_0x4a7d94[_0x15d0('0x21')][_0x15d0('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x4a7d94[_0x15d0('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x4a7d94[_0x15d0('0x21')]=_0x4a7d94[_0x15d0('0x21')][_0x15d0('0x2c')](_0x15d0('0x2d'),'');}_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=_0x4a7d94[_0x15d0('0x21')];break;default:_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]];}}return _0x3a9b23[_0x15d0('0x2a')](',');}function _0x622830(_0x5ba147,_0x2be6ca,_0x21c3bf){return new Promise(function(_0x230bb2,_0x1f1b3c){var _0x25eedb=[];if(_['isEmpty'](_0x2be6ca))return _0x230bb2(_0x25eedb);_0x580bc6[_0x15d0('0x2e')]['findAll']({'attributes':['id','interval',_0x15d0('0x2f')],'raw':!![]})[_0x15d0('0x30')](function(_0x367d58){for(var _0x11933f=0x0,_0x1c7c01=0x0;_0x11933f<_0x2be6ca['length'];_0x11933f++,_0x1c7c01=0x0){var _0xb4be9b=_0x2be6ca[_0x11933f];var _0x32de8d=[];var _0x1b38e7=[];delete _0xb4be9b['id'];if(_0xb4be9b[_0x15d0('0x31')]!==_0x15d0('0x32')){_0xb4be9b['intervals']=[_0xb4be9b[_0x15d0('0x31')]];}else{_0xb4be9b['intervals']=_0xb4be9b[_0x15d0('0x2f')]?_[_0x15d0('0x33')](_[_0x15d0('0x34')](_0x367d58,{'IntervalId':_0xb4be9b[_0x15d0('0x2f')]}),'interval'):[];}_0xb4be9b[_0x15d0('0x6')]=_0x5ba147[_0x15d0('0x6')];_0xb4be9b[_0x15d0('0x7')]=_0x5ba147[_0x15d0('0x7')];if(_0xb4be9b[_0x15d0('0x3')])_0xb4be9b[_0x15d0('0x3')]=_0xb4be9b['type'][_0x15d0('0x35')]();if(_0x5ba147[_0x15d0('0x3')]==='outbound'){if(_0xb4be9b[_0x15d0('0x1b')](_0x15d0('0x36'))&&_0xb4be9b[_0x15d0('0x36')]&&_0xb4be9b[_0x15d0('0x36')]!=='--'){_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x37')+_0xb4be9b[_0x15d0('0x36')],'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x39')+(_0xb4be9b[_0x15d0('0x3a')]?_0x15d0('0x3b')+_0xb4be9b[_0x15d0('0x3a')]+')':_0x15d0('0x3c')),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147['exten'],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}else{if(_0xb4be9b[_0x15d0('0x1b')]('answer')){if([_0x15d0('0x3d'),_0x15d0('0x3e')][_0x15d0('0x3f')](_0xb4be9b[_0x15d0('0x40')][_0x15d0('0x35')]())&&_0xb4be9b['appType']!==_0x15d0('0x41')){if(_0xb4be9b['answer']){_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x42'),'context':_0x5ba147['context'],'exten':_0x5ba147['exten'],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x43'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147['exten'],'priority':_0xb4be9b['intervals'][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}else{_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x44'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x45'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b['intervals'][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}}}}for(var _0x2eb7be=0x0;_0x2eb7be<_0xb4be9b['intervals'][_0x15d0('0x24')];_0x2eb7be++){var _0x507584=_0x21c3bf+_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')];var _0x5868bf=_0x2eb7be===_0xb4be9b['intervals'][_0x15d0('0x24')]-0x1?_0x21c3bf+_0x32de8d[_0x15d0('0x24')]+_0x1b38e7[_0x15d0('0x24')]+0x2:_0x21c3bf+_0x2eb7be+0x1;_0x32de8d[_0x15d0('0x46')](_0x2eb7be,0x0,{'type':_0x5ba147[_0x15d0('0x3')],'app':_0x15d0('0x47'),'appdata':_0xb4be9b[_0x15d0('0x38')][_0x2eb7be]+'?'+_0x5ba147[_0x15d0('0x6')]+',${EXTEN},'+_0x507584+':'+_0x5ba147['context']+_0x15d0('0x48')+_0x5868bf,'exten':_0x5ba147[_0x15d0('0x7')],'context':_0x5ba147[_0x15d0('0x6')],'priority':_0x21c3bf+_0x2eb7be,'VoiceExtensionId':_0x5ba147['id']});}if(_0xb4be9b[_0x15d0('0x49')]===_0x15d0('0x4a'))_0xb4be9b['appdata']=_0x496c80(_0x5ba147,_0xb4be9b[_0x15d0('0x4b')]);_0xb4be9b[_0x15d0('0x4c')]=_0x32de8d[_0x15d0('0x24')]?_[_0x15d0('0x4d')](_0x32de8d)[_0x15d0('0x4c')]+0x1:_0x21c3bf;_0x25eedb=_[_0x15d0('0x4e')](_0x25eedb,_0x32de8d,[_0xb4be9b],_0x1b38e7);_0x21c3bf=_[_0x15d0('0x4d')](_0x25eedb)[_0x15d0('0x4c')]+0x1;}return _0x230bb2(_0x25eedb);})[_0x15d0('0x4f')](function(_0x5b6be7){_0x1f1b3c(_0x5b6be7);});});}return _0x451b82[_0x15d0('0x50')](_0x15d0('0x51'),attributes,{'tableName':_0x15d0('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1415d1){var _0x425511=this[_0x15d0('0x53')]({'plain':!![]});var _0x55f4b9=_0x425511[_0x15d0('0x3')]===_0x15d0('0x11')?_0x50ae3a(_0x425511):_0x665632(_0x425511);return _0x622830(_0x425511,_0x1415d1,_['last'](_0x55f4b9)['priority']+0x1)[_0x15d0('0x30')](function(_0x506701){var _0x23bb40=_['concat'](_0x55f4b9,_0x506701);_0x23bb40[_0x15d0('0xc')]({'type':_0x425511[_0x15d0('0x3')],'app':_0x15d0('0x54'),'exten':_0x425511['exten'],'context':_0x425511[_0x15d0('0x6')],'priority':_['last'](_0x23bb40)[_0x15d0('0x4c')]+0x1,'VoiceExtensionId':_0x425511['id']});return _0x23bb40;});}}});}; \ No newline at end of file +var _0x6317=['length','name','param','phone','prefix','SIP','join','none','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','XCALLY-MOTION-ANSWER=0','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','split'];(function(_0x470615,_0x1c7aaa){var _0x189c81=function(_0x398e12){while(--_0x398e12){_0x470615['push'](_0x470615['shift']());}};_0x189c81(++_0x1c7aaa);}(_0x6317,0x11a));var _0x7631=function(_0x1a483b,_0x34577a){_0x1a483b=_0x1a483b-0x0;var _0x27c34c=_0x6317[_0x1a483b];return _0x27c34c;};'use strict';var _=require(_0x7631('0x0'));var attributes=require(_0x7631('0x1'));module[_0x7631('0x2')]=function(_0x3a5d90){var _0x1d402a=_0x3a5d90[_0x7631('0x3')];function _0x98964d(_0xcf44ef){var _0x410e60=0x2;var _0x3e7c43=[{'type':_0xcf44ef[_0x7631('0x4')],'app':_0x7631('0x5'),'appdata':'CDR(type)='+_0xcf44ef[_0x7631('0x4')],'context':_0xcf44ef[_0x7631('0x6')],'exten':_0xcf44ef[_0x7631('0x7')],'priority':_0x410e60++,'VoiceExtensionId':_0xcf44ef['id']},{'type':_0xcf44ef[_0x7631('0x4')],'app':_0xcf44ef[_0x7631('0x8')]?_0x7631('0x5'):_0x7631('0x9'),'appdata':_0xcf44ef[_0x7631('0x8')]?_0x7631('0xa')+_0xcf44ef[_0x7631('0x8')]:_0x7631('0xb'),'context':_0xcf44ef[_0x7631('0x6')],'exten':_0xcf44ef[_0x7631('0x7')],'priority':_0x410e60++,'VoiceExtensionId':_0xcf44ef['id']}];if(_0xcf44ef['type']==='inbound'){_0x3e7c43[_0x7631('0xc')]({'type':_0x7631('0xd'),'app':_0x7631('0x5'),'appdata':'CDR(routeid)='+_0xcf44ef['id'],'context':_0xcf44ef[_0x7631('0x6')],'exten':_0xcf44ef[_0x7631('0x7')],'priority':_0x410e60++,'VoiceExtensionId':_0xcf44ef['id']});}_0x3e7c43[_0x7631('0xc')]({'type':_0xcf44ef['type'],'app':_0x7631('0x5'),'appdata':_0x7631('0xe'),'context':_0xcf44ef[_0x7631('0x6')],'exten':_0xcf44ef['exten'],'priority':_0x410e60++,'VoiceExtensionId':_0xcf44ef['id']},{'type':_0xcf44ef[_0x7631('0x4')],'app':_0x7631('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xcf44ef[_0x7631('0x6')],'exten':_0xcf44ef['exten'],'priority':_0x410e60++,'VoiceExtensionId':_0xcf44ef['id']},{'type':_0xcf44ef['type'],'app':_0x7631('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0xcf44ef[_0x7631('0x6')],'exten':_0xcf44ef[_0x7631('0x7')],'priority':_0x410e60++,'VoiceExtensionId':_0xcf44ef['id']});return _0x3e7c43;}function _0x5d611a(_0xe91b2a){var _0x359bbe=0x2;var _0x7c885b=[{'type':'outbound','app':_0x7631('0x5'),'appdata':_0x7631('0xf'),'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a['exten'],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':_0xe91b2a[_0x7631('0x8')]?_0x7631('0x5'):_0x7631('0x9'),'appdata':_0xe91b2a['alias']?_0x7631('0xa')+_0xe91b2a[_0x7631('0x8')]:_0x7631('0xb'),'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':_0x7631('0x5'),'appdata':_0x7631('0x11')+(_0xe91b2a[_0x7631('0x12')]?_0x7631('0x13')+_0xe91b2a[_0x7631('0x12')]+'}':_0x7631('0x14')),'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':_0x7631('0x5'),'appdata':'CDR(routeid)='+_0xe91b2a['id'],'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x359bbe+0x2)+_0x7631('0x15')+(_0x359bbe+0x1)+')','context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a['exten'],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':_0x7631('0x5'),'appdata':_0xe91b2a['cutdigits']?_0x7631('0x16')+_0xe91b2a[_0x7631('0x12')]+'}':'CDR(prefix)=noprefix','context':_0xe91b2a['context'],'exten':_0xe91b2a['exten'],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':'outbound','app':'Set','appdata':_0x7631('0xe'),'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a['exten'],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':_0x7631('0x5'),'appdata':_0x7631('0x17'),'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':_0x7631('0x5'),'appdata':_0x7631('0x18'),'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':_0x7631('0x10'),'app':_0x7631('0x5'),'appdata':_0x7631('0x19')+_0xe91b2a['id'],'context':_0xe91b2a['context'],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']}];if(_0xe91b2a[_0x7631('0x1a')](_0x7631('0x1b'))&&_0xe91b2a[_0x7631('0x1b')]!=='none'){_0x7c885b['push']({'type':_0x7631('0x10'),'app':_0x7631('0x5'),'appdata':_0x7631('0x1c'),'context':_0xe91b2a[_0x7631('0x6')],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']},{'type':'outbound','app':_0x7631('0x5'),'appdata':_0x7631('0x1d')+_0xe91b2a[_0x7631('0x1b')]||'wav','context':_0xe91b2a['context'],'exten':_0xe91b2a[_0x7631('0x7')],'priority':_0x359bbe++,'VoiceExtensionId':_0xe91b2a['id']});}return _0x7c885b;}function _0x398bc5(_0x45da9e,_0x14c88f){var _0x2fed8a=[{'name':_0x7631('0x1e'),'param':0x0},{'name':_0x7631('0x1f'),'param':0x1},{'name':_0x7631('0x20'),'param':0x2},{'name':'url','param':0x3}];var _0x29cdde={};var _0x1833b0=_0x14c88f[_0x7631('0x21')](',');var _0x1a0869=[];for(var _0x90d3d7=0x0;_0x90d3d7<_0x2fed8a[_0x7631('0x22')];_0x90d3d7++){switch(_0x2fed8a[_0x90d3d7][_0x7631('0x23')]){case _0x7631('0x1e'):_0x29cdde[_0x7631('0x1e')]=_0x1833b0[_0x2fed8a[_0x90d3d7][_0x7631('0x24')]][_0x7631('0x21')]('/')[0x1];_0x29cdde[_0x7631('0x25')]=_0x1833b0[_0x2fed8a[_0x90d3d7]['param']][_0x7631('0x21')]('/')[0x2];_0x29cdde[_0x7631('0x26')]=_0x29cdde[_0x7631('0x25')]?_0x29cdde[_0x7631('0x25')]['split']('$')[0x0]:undefined;_0x29cdde['phone']=_0x45da9e[_0x7631('0x12')]?(_0x29cdde['prefix']||'')+_0x7631('0x13')+_0x45da9e[_0x7631('0x12')]+'}':(_0x29cdde[_0x7631('0x26')]||'')+_0x7631('0x14');_0x1a0869[_0x2fed8a[_0x90d3d7][_0x7631('0x24')]]=[_0x7631('0x27'),_0x29cdde[_0x7631('0x1e')],_0x29cdde[_0x7631('0x25')]][_0x7631('0x28')]('/');break;case _0x7631('0x20'):_0x29cdde['options']=_0x1833b0[_0x2fed8a[_0x90d3d7][_0x7631('0x24')]];if(_0x45da9e[_0x7631('0x1b')]!==_0x7631('0x29')){if(_0x29cdde[_0x7631('0x20')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x29cdde[_0x7631('0x20')]+='U(xcally-mixmonitor-context)';}}else{_0x29cdde[_0x7631('0x20')]=_0x29cdde['options']['replace'](_0x7631('0x2a'),'');}_0x1a0869[_0x2fed8a[_0x90d3d7][_0x7631('0x24')]]=_0x29cdde[_0x7631('0x20')];break;default:_0x1a0869[_0x2fed8a[_0x90d3d7][_0x7631('0x24')]]=_0x1833b0[_0x2fed8a[_0x90d3d7]['param']];}}return _0x1a0869[_0x7631('0x28')](',');}function _0x18df69(_0x115740,_0x53c09b,_0x41dff8){return new Promise(function(_0xf2a51,_0x29f041){var _0x462530=[];if(_['isEmpty'](_0x53c09b))return _0xf2a51(_0x462530);_0x1d402a[_0x7631('0x2b')][_0x7631('0x2c')]({'attributes':['id',_0x7631('0x2d'),_0x7631('0x2e')],'raw':!![]})[_0x7631('0x2f')](function(_0x27c789){for(var _0x15383e=0x0,_0x38e160=0x0;_0x15383e<_0x53c09b[_0x7631('0x22')];_0x15383e++,_0x38e160=0x0){var _0x4d171c=_0x53c09b[_0x15383e];var _0x152d04=[];var _0x44ebf0=[];delete _0x4d171c['id'];if(_0x4d171c[_0x7631('0x2d')]!==_0x7631('0x30')){_0x4d171c[_0x7631('0x31')]=[_0x4d171c[_0x7631('0x2d')]];}else{_0x4d171c[_0x7631('0x31')]=_0x4d171c[_0x7631('0x2e')]?_['map'](_[_0x7631('0x32')](_0x27c789,{'IntervalId':_0x4d171c[_0x7631('0x2e')]}),_0x7631('0x2d')):[];}_0x4d171c[_0x7631('0x6')]=_0x115740[_0x7631('0x6')];_0x4d171c[_0x7631('0x7')]=_0x115740[_0x7631('0x7')];if(_0x4d171c[_0x7631('0x4')])_0x4d171c[_0x7631('0x4')]=_0x4d171c[_0x7631('0x4')][_0x7631('0x33')]();if(_0x115740[_0x7631('0x4')]===_0x7631('0x10')){if(_0x4d171c['hasOwnProperty'](_0x7631('0x34'))&&_0x4d171c[_0x7631('0x34')]&&_0x4d171c[_0x7631('0x34')]!=='--'){_0x152d04['push']({'type':_0x4d171c['type'][_0x7631('0x33')](),'app':_0x7631('0x5'),'appdata':_0x7631('0x35')+_0x4d171c[_0x7631('0x34')],'context':_0x115740[_0x7631('0x6')],'exten':_0x115740[_0x7631('0x7')],'priority':_0x4d171c[_0x7631('0x31')]['length']+_0x41dff8+_0x38e160++,'VoiceExtensionId':_0x115740['id']});}_0x152d04[_0x7631('0xc')]({'type':_0x4d171c['type']['toLowerCase'](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4d171c[_0x7631('0x36')]?_0x7631('0x37')+_0x4d171c[_0x7631('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x115740[_0x7631('0x6')],'exten':_0x115740[_0x7631('0x7')],'priority':_0x4d171c[_0x7631('0x31')][_0x7631('0x22')]+_0x41dff8+_0x38e160++,'VoiceExtensionId':_0x115740['id']});}else{if(_0x4d171c[_0x7631('0x1a')](_0x7631('0x38'))){if([_0x7631('0x39'),_0x7631('0x3a')][_0x7631('0x3b')](_0x4d171c[_0x7631('0x3c')][_0x7631('0x33')]())&&_0x4d171c[_0x7631('0x3d')]!==_0x7631('0x3e')){if(_0x4d171c[_0x7631('0x38')]){_0x152d04['push']({'type':_0x4d171c[_0x7631('0x4')][_0x7631('0x33')](),'app':_0x7631('0x3f'),'appdata':_0x7631('0x40'),'context':_0x115740[_0x7631('0x6')],'exten':_0x115740['exten'],'priority':_0x4d171c['intervals']['length']+_0x41dff8+_0x38e160++,'VoiceExtensionId':_0x115740['id']});_0x152d04[_0x7631('0xc')]({'type':_0x4d171c[_0x7631('0x4')][_0x7631('0x33')](),'app':_0x7631('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x115740[_0x7631('0x6')],'exten':_0x115740[_0x7631('0x7')],'priority':_0x4d171c['intervals']['length']+_0x41dff8+_0x38e160++,'VoiceExtensionId':_0x115740['id']});}else{_0x152d04['push']({'type':_0x4d171c[_0x7631('0x4')][_0x7631('0x33')](),'app':_0x7631('0x3f'),'appdata':_0x7631('0x41'),'context':_0x115740['context'],'exten':_0x115740['exten'],'priority':_0x4d171c['intervals'][_0x7631('0x22')]+_0x41dff8+_0x38e160++,'VoiceExtensionId':_0x115740['id']});_0x152d04[_0x7631('0xc')]({'type':_0x4d171c['type'][_0x7631('0x33')](),'app':_0x7631('0x5'),'appdata':_0x7631('0x42'),'context':_0x115740[_0x7631('0x6')],'exten':_0x115740[_0x7631('0x7')],'priority':_0x4d171c[_0x7631('0x31')][_0x7631('0x22')]+_0x41dff8+_0x38e160++,'VoiceExtensionId':_0x115740['id']});}}}}for(var _0x4d9ecd=0x0;_0x4d9ecd<_0x4d171c[_0x7631('0x31')][_0x7631('0x22')];_0x4d9ecd++){var _0x2de319=_0x41dff8+_0x4d171c['intervals']['length'];var _0x2b8eae=_0x4d9ecd===_0x4d171c['intervals']['length']-0x1?_0x41dff8+_0x152d04['length']+_0x44ebf0[_0x7631('0x22')]+0x2:_0x41dff8+_0x4d9ecd+0x1;_0x152d04[_0x7631('0x43')](_0x4d9ecd,0x0,{'type':_0x115740[_0x7631('0x4')],'app':_0x7631('0x44'),'appdata':_0x4d171c[_0x7631('0x31')][_0x4d9ecd]+'?'+_0x115740[_0x7631('0x6')]+_0x7631('0x45')+_0x2de319+':'+_0x115740[_0x7631('0x6')]+',${EXTEN},'+_0x2b8eae,'exten':_0x115740['exten'],'context':_0x115740[_0x7631('0x6')],'priority':_0x41dff8+_0x4d9ecd,'VoiceExtensionId':_0x115740['id']});}if(_0x4d171c[_0x7631('0x3d')]===_0x7631('0x46'))_0x4d171c[_0x7631('0x47')]=_0x398bc5(_0x115740,_0x4d171c[_0x7631('0x47')]);_0x4d171c['priority']=_0x152d04[_0x7631('0x22')]?_[_0x7631('0x48')](_0x152d04)[_0x7631('0x49')]+0x1:_0x41dff8;_0x462530=_['concat'](_0x462530,_0x152d04,[_0x4d171c],_0x44ebf0);_0x41dff8=_[_0x7631('0x48')](_0x462530)[_0x7631('0x49')]+0x1;}return _0xf2a51(_0x462530);})[_0x7631('0x4a')](function(_0x3f7786){_0x29f041(_0x3f7786);});});}return _0x3a5d90[_0x7631('0x4b')]('VoiceExtension',attributes,{'tableName':_0x7631('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3cced7){var _0x3d530c=this[_0x7631('0x4d')]({'plain':!![]});var _0x2bba14=_0x3d530c['type']===_0x7631('0x10')?_0x5d611a(_0x3d530c):_0x98964d(_0x3d530c);return _0x18df69(_0x3d530c,_0x3cced7,_[_0x7631('0x48')](_0x2bba14)[_0x7631('0x49')]+0x1)[_0x7631('0x2f')](function(_0x45f5c4){var _0x3715e8=_['concat'](_0x2bba14,_0x45f5c4);_0x3715e8['push']({'type':_0x3d530c[_0x7631('0x4')],'app':_0x7631('0x4e'),'exten':_0x3d530c[_0x7631('0x7')],'context':_0x3d530c['context'],'priority':_['last'](_0x3715e8)['priority']+0x1,'VoiceExtensionId':_0x3d530c['id']});return _0x3715e8;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index fc8169e..0db592f 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 _0xcca7=['raw','attributes','limit','map','include','model','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0xcca7,0x1aa));var _0x7cca=function(_0x33eb80,_0x46570c){_0x33eb80=_0x33eb80-0x0;var _0x56c653=_0xcca7[_0x33eb80];return _0x56c653;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));var BPromise=require(_0x7cca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7cca('0x5'))(_0x7cca('0x6'));var config=require(_0x7cca('0x7'));var jayson=require(_0x7cca('0x8'));var client=jayson[_0x7cca('0x9')][_0x7cca('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7cca('0xb')],{'host':_0x7cca('0xc'),'port':0x18eb});var socket=require(_0x7cca('0xd'))(new Redis(config[_0x7cca('0xb')]));require(_0x7cca('0xe'))[_0x7cca('0xf')](socket);function respondWithRpcPromise(_0x20ffa9,_0x2b8b62,_0x27323a){return new BPromise(function(_0x1a773e,_0x53b5f6){return client[_0x7cca('0x10')](_0x20ffa9,_0x27323a)[_0x7cca('0x11')](function(_0x275ab2){logger[_0x7cca('0x12')](_0x7cca('0x13'),_0x2b8b62,'request\x20sent');logger[_0x7cca('0x14')](_0x7cca('0x15'),_0x2b8b62,_0x7cca('0x16'),JSON['stringify'](_0x275ab2));if(_0x275ab2['error']){if(_0x275ab2[_0x7cca('0x17')][_0x7cca('0x18')]===0x1f4){logger[_0x7cca('0x17')](_0x7cca('0x13'),_0x2b8b62,_0x275ab2[_0x7cca('0x17')][_0x7cca('0x19')]);return _0x53b5f6(_0x275ab2[_0x7cca('0x17')]['message']);}logger[_0x7cca('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x2b8b62,_0x275ab2['error']['message']);return _0x1a773e(_0x275ab2[_0x7cca('0x17')][_0x7cca('0x19')]);}else{logger[_0x7cca('0x12')](_0x7cca('0x13'),_0x2b8b62,_0x7cca('0x16'));_0x1a773e(_0x275ab2['result'][_0x7cca('0x19')]);}})['catch'](function(_0x5d47f8){logger['error'](_0x7cca('0x13'),_0x2b8b62,_0x5d47f8);_0x53b5f6(_0x5d47f8);});});}exports[_0x7cca('0x1a')]=function(_0x2beb6c){var _0x1a20be=this;return new Promise(function(_0x36ba41,_0x45db2f){return db[_0x7cca('0x1b')][_0x7cca('0x1c')]({'raw':_0x2beb6c['options']?_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x1e')]===undefined?!![]:![]:!![],'where':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')]['where']||null:null,'attributes':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x1f')]||null:null,'limit':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x20')]||null:null,'include':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')]['include']?_[_0x7cca('0x21')](_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x22')],function(_0xdaf07f){return{'model':db[_0xdaf07f[_0x7cca('0x23')]],'as':_0xdaf07f['as'],'attributes':_0xdaf07f[_0x7cca('0x1f')],'include':_0xdaf07f[_0x7cca('0x22')]?_[_0x7cca('0x21')](_0xdaf07f['include'],function(_0x2cafe1){return{'model':db[_0x2cafe1['model']],'as':_0x2cafe1['as'],'attributes':_0x2cafe1[_0x7cca('0x1f')],'include':_0x2cafe1[_0x7cca('0x22')]?_['map'](_0x2cafe1[_0x7cca('0x22')],function(_0x3d91b1){return{'model':db[_0x3d91b1['model']],'as':_0x3d91b1['as'],'attributes':_0x3d91b1[_0x7cca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7cca('0x11')](function(_0x100061){logger['info']('GetVoiceExtension',_0x2beb6c);logger[_0x7cca('0x14')](_0x7cca('0x1a'),_0x2beb6c,JSON[_0x7cca('0x24')](_0x100061));_0x36ba41(_0x100061);})[_0x7cca('0x25')](function(_0x34336c){logger[_0x7cca('0x17')](_0x7cca('0x1a'),_0x34336c['message'],_0x2beb6c);_0x45db2f(_0x1a20be['error'](0x1f4,_0x34336c[_0x7cca('0x19')]));});});}; \ No newline at end of file +var _0x1c23=['map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','attributes','limit','model','include'];(function(_0x2d3403,_0x4fda61){var _0x4db7fe=function(_0x2eced){while(--_0x2eced){_0x2d3403['push'](_0x2d3403['shift']());}};_0x4db7fe(++_0x4fda61);}(_0x1c23,0x1d5));var _0x31c2=function(_0x4e4650,_0x496ec2){_0x4e4650=_0x4e4650-0x0;var _0x4c02b3=_0x1c23[_0x4e4650];return _0x4c02b3;};'use strict';var _=require(_0x31c2('0x0'));var util=require(_0x31c2('0x1'));var moment=require(_0x31c2('0x2'));var BPromise=require(_0x31c2('0x3'));var rs=require(_0x31c2('0x4'));var fs=require('fs');var Redis=require(_0x31c2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x31c2('0x6'));var logger=require(_0x31c2('0x7'))('rpc');var config=require(_0x31c2('0x8'));var jayson=require(_0x31c2('0x9'));var client=jayson[_0x31c2('0xa')][_0x31c2('0xb')]({'port':0x232a});config[_0x31c2('0xc')]=_['defaults'](config[_0x31c2('0xc')],{'host':_0x31c2('0xd'),'port':0x18eb});var socket=require(_0x31c2('0xe'))(new Redis(config[_0x31c2('0xc')]));require(_0x31c2('0xf'))['register'](socket);function respondWithRpcPromise(_0x4821dd,_0x3794c4,_0x29f71f){return new BPromise(function(_0x22875b,_0x24443c){return client[_0x31c2('0x10')](_0x4821dd,_0x29f71f)[_0x31c2('0x11')](function(_0x5c1c28){logger[_0x31c2('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x3794c4,_0x31c2('0x13'));logger[_0x31c2('0x14')](_0x31c2('0x15'),_0x3794c4,'request\x20sent',JSON[_0x31c2('0x16')](_0x5c1c28));if(_0x5c1c28[_0x31c2('0x17')]){if(_0x5c1c28['error'][_0x31c2('0x18')]===0x1f4){logger[_0x31c2('0x17')](_0x31c2('0x19'),_0x3794c4,_0x5c1c28[_0x31c2('0x17')][_0x31c2('0x1a')]);return _0x24443c(_0x5c1c28[_0x31c2('0x17')][_0x31c2('0x1a')]);}logger[_0x31c2('0x17')](_0x31c2('0x19'),_0x3794c4,_0x5c1c28[_0x31c2('0x17')][_0x31c2('0x1a')]);return _0x22875b(_0x5c1c28['error']['message']);}else{logger[_0x31c2('0x12')](_0x31c2('0x19'),_0x3794c4,_0x31c2('0x13'));_0x22875b(_0x5c1c28['result']['message']);}})[_0x31c2('0x1b')](function(_0x4a52fa){logger[_0x31c2('0x17')](_0x31c2('0x19'),_0x3794c4,_0x4a52fa);_0x24443c(_0x4a52fa);});});}exports[_0x31c2('0x1c')]=function(_0xb4c4a5){var _0x55e997=this;return new Promise(function(_0xc29f8a,_0x4ae7ad){return db[_0x31c2('0x1d')][_0x31c2('0x1e')]({'raw':_0xb4c4a5['options']?_0xb4c4a5['options'][_0x31c2('0x1f')]===undefined?!![]:![]:!![],'where':_0xb4c4a5[_0x31c2('0x20')]?_0xb4c4a5['options'][_0x31c2('0x21')]||null:null,'attributes':_0xb4c4a5[_0x31c2('0x20')]?_0xb4c4a5[_0x31c2('0x20')][_0x31c2('0x22')]||null:null,'limit':_0xb4c4a5['options']?_0xb4c4a5[_0x31c2('0x20')][_0x31c2('0x23')]||null:null,'include':_0xb4c4a5['options']?_0xb4c4a5[_0x31c2('0x20')]['include']?_['map'](_0xb4c4a5[_0x31c2('0x20')]['include'],function(_0x37b749){return{'model':db[_0x37b749[_0x31c2('0x24')]],'as':_0x37b749['as'],'attributes':_0x37b749[_0x31c2('0x22')],'include':_0x37b749[_0x31c2('0x25')]?_[_0x31c2('0x26')](_0x37b749['include'],function(_0x344cd7){return{'model':db[_0x344cd7[_0x31c2('0x24')]],'as':_0x344cd7['as'],'attributes':_0x344cd7[_0x31c2('0x22')],'include':_0x344cd7['include']?_[_0x31c2('0x26')](_0x344cd7[_0x31c2('0x25')],function(_0xf8879a){return{'model':db[_0xf8879a[_0x31c2('0x24')]],'as':_0xf8879a['as'],'attributes':_0xf8879a[_0x31c2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x31c2('0x11')](function(_0x13c1ea){logger['info'](_0x31c2('0x1c'),_0xb4c4a5);logger[_0x31c2('0x14')](_0x31c2('0x1c'),_0xb4c4a5,JSON[_0x31c2('0x16')](_0x13c1ea));_0xc29f8a(_0x13c1ea);})[_0x31c2('0x1b')](function(_0x3e2eef){logger[_0x31c2('0x17')]('GetVoiceExtension',_0x3e2eef['message'],_0xb4c4a5);_0x4ae7ad(_0x55e997[_0x31c2('0x17')](0x1f4,_0x3e2eef['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 6546e35..a738ac6 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0xf61707,_0xb818ca){var _0x1d2ade=function(_0x59c97e){while(--_0x59c97e){_0xf61707['push'](_0xf61707['shift']());}};_0x1d2ade(++_0xb818ca);}(_0xe14b,0x93));var _0xbe14=function(_0x2130d5,_0x2503e3){_0x2130d5=_0x2130d5-0x0;var _0x2b4af0=_0xe14b[_0x2130d5];return _0x2b4af0;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x50c0db,_0x2e926b){var _0x2e947b=function(_0x40d09f){while(--_0x40d09f){_0x50c0db['push'](_0x50c0db['shift']());}};_0x2e947b(++_0x2e926b);}(_0x4975,0x86));var _0x5497=function(_0x557feb,_0x3062a5){_0x557feb=_0x557feb-0x0;var _0xb24d7c=_0x4975[_0x557feb];return _0xb24d7c;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index e47c31a..c174cbf 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 _0x1261=['isAuthenticated','show','/:id/messages','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x51809c,_0x4ecc8f){var _0x3d0c87=function(_0x2dca9f){while(--_0x2dca9f){_0x51809c['push'](_0x51809c['shift']());}};_0x3d0c87(++_0x4ecc8f);}(_0x1261,0x144));var _0x1126=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x1261[_0x1347f8];return _0x218368;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['getMessages']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x5496=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get','isAuthenticated','show','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x2d9dc7,_0x32b317){var _0x5767d0=function(_0x28d2ad){while(--_0x28d2ad){_0x2d9dc7['push'](_0x2d9dc7['shift']());}};_0x5767d0(++_0x32b317);}(_0x5496,0x175));var _0x6549=function(_0x87f8c2,_0x28a140){_0x87f8c2=_0x87f8c2-0x0;var _0x760354=_0x5496[_0x87f8c2];return _0x760354;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router[_0x6549('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6549('0x11')]);router[_0x6549('0x12')](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 265150c..ab12458 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 _0x8d7d=['STRING','from-voicemail','contest_mailbox','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox'];(function(_0x176d0b,_0x3b9172){var _0x12221c=function(_0x3af51a){while(--_0x3af51a){_0x176d0b['push'](_0x176d0b['shift']());}};_0x12221c(++_0x3b9172);}(_0x8d7d,0x96));var _0xd8d7=function(_0x24e2cb,_0x1cb6ee){_0x24e2cb=_0x24e2cb-0x0;var _0x51c53b=_0x8d7d[_0x24e2cb];return _0x51c53b;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd8d7('0x0')],'defaultValue':_0xd8d7('0x1'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd8d7('0x0')],'defaultValue':'','allowNull':![],'unique':_0xd8d7('0x2')},'password':{'type':Sequelize[_0xd8d7('0x0')]},'fullname':{'type':Sequelize[_0xd8d7('0x0')]},'email':{'type':Sequelize[_0xd8d7('0x0')],'validate':{'isEmail':!![]},'set':function(_0x54749a){this['setDataValue']('email',typeof _0x54749a===_0xd8d7('0x3')&&_0x54749a['trim']()?_0x54749a[_0xd8d7('0x4')]():null);}},'pager':{'type':Sequelize[_0xd8d7('0x0')]},'tz':{'type':Sequelize[_0xd8d7('0x0')],'defaultValue':_0xd8d7('0x5')},'attach':{'type':Sequelize['ENUM'](_0xd8d7('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':_0xd8d7('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd8d7('0x0')]},'callback':{'type':Sequelize[_0xd8d7('0x0')]},'review':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd8d7('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':_0xd8d7('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xd8d7('0x9')},'emailsubject':{'type':Sequelize[_0xd8d7('0x0')]},'emailbody':{'type':Sequelize[_0xd8d7('0x0')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd8d7('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd8d7('0xb')],'get':function(){return this[_0xd8d7('0xc')](_0xd8d7('0xd'))+'\x20-\x20'+this[_0xd8d7('0xc')](_0xd8d7('0xe'));}}}; \ No newline at end of file +var _0x1543=['INTEGER','VIRTUAL','getDataValue','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1543,0x183));var _0x3154=function(_0x47ad64,_0x35506d){_0x47ad64=_0x47ad64-0x0;var _0x322744=_0x1543[_0x47ad64];return _0x322744;};'use strict';var Sequelize=require(_0x3154('0x0'));module[_0x3154('0x1')]={'customer_id':{'type':Sequelize[_0x3154('0x2')]},'context':{'type':Sequelize[_0x3154('0x2')],'defaultValue':_0x3154('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x3154('0x4')},'password':{'type':Sequelize[_0x3154('0x2')]},'fullname':{'type':Sequelize[_0x3154('0x2')]},'email':{'type':Sequelize[_0x3154('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ec7e9){this[_0x3154('0x5')](_0x3154('0x6'),typeof _0x1ec7e9===_0x3154('0x7')&&_0x1ec7e9[_0x3154('0x8')]()?_0x1ec7e9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':_0x3154('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':_0x3154('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3154('0x2')]},'callback':{'type':Sequelize[_0x3154('0x2')]},'review':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x3154('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3154('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3154('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':_0x3154('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3154('0x9')](_0x3154('0xa'),'no'),'defaultValue':_0x3154('0xa'),'allowNull':![]},'stamp':{'type':_0x3154('0xc')},'emailsubject':{'type':Sequelize[_0x3154('0x2')]},'emailbody':{'type':Sequelize[_0x3154('0x2')]},'maxsecs':{'type':Sequelize[_0x3154('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3154('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3154('0xe')],'get':function(){return this[_0x3154('0xf')]('fullname')+'\x20-\x20'+this[_0x3154('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 edd3974..f85b84d 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 _0xf7b4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x532b98,_0xbf7c7d){var _0xd825b0=function(_0x5ade23){while(--_0x5ade23){_0x532b98['push'](_0x532b98['shift']());}};_0xd825b0(++_0xbf7c7d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x384182,_0x4b9b3d){_0x384182=_0x384182-0x0;var _0x5461c8=_0xf7b4[_0x384182];return _0x5461c8;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd9b349,_0x2e8dd9){_0x2e8dd9=_0x2e8dd9||0xcc;return function(_0x3c55e1){if(_0x3c55e1){return _0xd9b349[_0x4f7b('0x17')](_0x2e8dd9);}return _0xd9b349['status'](_0x2e8dd9)[_0x4f7b('0x18')]();};}function respondWithResult(_0x368091,_0x407cee){_0x407cee=_0x407cee||0xc8;return function(_0x43a51a){if(_0x43a51a){return _0x368091[_0x4f7b('0x19')](_0x407cee)[_0x4f7b('0x1a')](_0x43a51a);}};}function respondWithFilteredResult(_0x40ecb0,_0x2437cc){return function(_0x260667){if(_0x260667){var _0x29fdd5=typeof _0x2437cc[_0x4f7b('0x1b')]===_0x4f7b('0x1c')&&typeof _0x2437cc['limit']===_0x4f7b('0x1c');var _0x496322=_0x260667['count'];var _0x24e5cf=_0x29fdd5?0x0:_0x2437cc[_0x4f7b('0x1b')];var _0x519d90=_0x29fdd5?_0x260667[_0x4f7b('0x1d')]:_0x2437cc[_0x4f7b('0x1b')]+_0x2437cc[_0x4f7b('0x1e')];var _0xf2311f;if(_0x519d90>=_0x496322){_0x519d90=_0x496322;_0xf2311f=0xc8;}else{_0xf2311f=0xce;}_0x40ecb0['status'](_0xf2311f);return _0x40ecb0[_0x4f7b('0x1f')]('Content-Range',_0x24e5cf+'-'+_0x519d90+'/'+_0x496322)[_0x4f7b('0x1a')](_0x260667);}return null;};}function patchUpdates(_0x12374b){return function(_0xa2f54e){try{jsonpatch[_0x4f7b('0x20')](_0xa2f54e,_0x12374b,!![]);}catch(_0x27127b){return BPromise[_0x4f7b('0x21')](_0x27127b);}return _0xa2f54e[_0x4f7b('0x22')]();};}function saveUpdates(_0x1f545e,_0x2a8b50){return function(_0x5508bd){if(_0x5508bd){return _0x5508bd[_0x4f7b('0x23')](_0x1f545e)[_0x4f7b('0x24')](function(_0x2c9ea6){return _0x2c9ea6;});}return null;};}function removeEntity(_0x5bd43f,_0x150f57){return function(_0x4610a4){if(_0x4610a4){return _0x4610a4['destroy']()[_0x4f7b('0x24')](function(){var _0x59ec24=_0x4610a4[_0x4f7b('0x25')]({'plain':!![]});var _0x2429be=_0x4f7b('0x26');return db[_0x4f7b('0x27')][_0x4f7b('0x28')]({'where':{'type':_0x2429be,'resourceId':_0x59ec24['id']}})[_0x4f7b('0x24')](function(){return _0x4610a4;});})[_0x4f7b('0x24')](function(){_0x5bd43f[_0x4f7b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c9626,_0x14e2c2){return function(_0x311675){if(!_0x311675){_0x6c9626['sendStatus'](0x194);}return _0x311675;};}function handleError(_0x19da29,_0x336739){_0x336739=_0x336739||0x1f4;return function(_0x1db684){logger[_0x4f7b('0x29')](_0x1db684[_0x4f7b('0x2a')]);if(_0x1db684['name']){delete _0x1db684[_0x4f7b('0x2b')];}_0x19da29[_0x4f7b('0x19')](_0x336739)[_0x4f7b('0x2c')](_0x1db684);};}exports['index']=function(_0x7de561,_0x5d13a1){var _0x4e4828={},_0x1a2346={},_0x52a5b1={'count':0x0,'rows':[]};var _0x1aad4b=_[_0x4f7b('0x2d')](db[_0x4f7b('0x2e')][_0x4f7b('0x2f')],function(_0x105ffb){return{'name':_0x105ffb[_0x4f7b('0x30')],'type':_0x105ffb[_0x4f7b('0x31')][_0x4f7b('0x32')]};});_0x1a2346[_0x4f7b('0x33')]=_[_0x4f7b('0x2d')](_0x1aad4b,_0x4f7b('0x2b'));_0x1a2346[_0x4f7b('0x34')]=_[_0x4f7b('0x35')](_0x7de561[_0x4f7b('0x34')]);_0x1a2346[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x1a2346[_0x4f7b('0x33')],_0x1a2346[_0x4f7b('0x34')]);_0x4e4828[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x1a2346[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x7de561['query'][_0x4f7b('0x39')]));_0x4e4828['attributes']=_0x4e4828[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x4e4828['attributes']:_0x1a2346[_0x4f7b('0x33')];if(!_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x3b')]('nolimit')){_0x4e4828[_0x4f7b('0x1e')]=qs[_0x4f7b('0x1e')](_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x1e')]);_0x4e4828[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x7de561[_0x4f7b('0x34')]['offset']);}_0x4e4828[_0x4f7b('0x3c')]=qs['sort'](_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x3d')]);_0x4e4828[_0x4f7b('0x3e')]=qs['filters'](_[_0x4f7b('0x3f')](_0x7de561['query'],_0x1a2346[_0x4f7b('0x36')]),_0x1aad4b);if(_0x7de561[_0x4f7b('0x34')]['filter']){_0x4e4828['where']=_[_0x4f7b('0x40')](_0x4e4828['where'],{'$or':_[_0x4f7b('0x2d')](_0x1aad4b,function(_0x146268){if(_0x146268['type']!==_0x4f7b('0x41')){var _0x4e34cd={};_0x4e34cd[_0x146268['name']]={'$like':'%'+_0x7de561['query'][_0x4f7b('0x42')]+'%'};return _0x4e34cd;}})});}_0x4e4828=_[_0x4f7b('0x40')]({},_0x4e4828,_0x7de561[_0x4f7b('0x43')]);var _0x3c8745={'where':_0x4e4828['where']};return db[_0x4f7b('0x2e')]['count'](_0x3c8745)[_0x4f7b('0x24')](function(_0x586406){_0x52a5b1[_0x4f7b('0x1d')]=_0x586406;if(_0x7de561['query'][_0x4f7b('0x44')]){_0x4e4828[_0x4f7b('0x45')]=[{'all':!![]}];}return db[_0x4f7b('0x2e')][_0x4f7b('0x46')](_0x4e4828);})[_0x4f7b('0x24')](function(_0x325cd6){_0x52a5b1[_0x4f7b('0x47')]=_0x325cd6;return _0x52a5b1;})[_0x4f7b('0x24')](respondWithFilteredResult(_0x5d13a1,_0x4e4828))[_0x4f7b('0x48')](handleError(_0x5d13a1,null));};exports[_0x4f7b('0x49')]=function(_0x2d0be3,_0x3016d0){var _0x9c58fa={'raw':!![],'where':{'id':_0x2d0be3[_0x4f7b('0x4a')]['id']}},_0x508eaa={};_0x508eaa[_0x4f7b('0x33')]=_[_0x4f7b('0x35')](db[_0x4f7b('0x2e')]['rawAttributes']);_0x508eaa['query']=_[_0x4f7b('0x35')](_0x2d0be3[_0x4f7b('0x34')]);_0x508eaa[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x508eaa['model'],_0x508eaa['query']);_0x9c58fa[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x508eaa[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x2d0be3['query']['fields']));_0x9c58fa[_0x4f7b('0x38')]=_0x9c58fa[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x9c58fa[_0x4f7b('0x38')]:_0x508eaa[_0x4f7b('0x33')];if(_0x2d0be3['query'][_0x4f7b('0x44')]){_0x9c58fa[_0x4f7b('0x45')]=[{'all':!![]}];}_0x9c58fa=_[_0x4f7b('0x40')]({},_0x9c58fa,_0x2d0be3['options']);return db[_0x4f7b('0x2e')][_0x4f7b('0x4b')](_0x9c58fa)[_0x4f7b('0x24')](handleEntityNotFound(_0x3016d0,null))[_0x4f7b('0x24')](respondWithResult(_0x3016d0,null))[_0x4f7b('0x48')](handleError(_0x3016d0,null));};exports[_0x4f7b('0x4c')]=function(_0xee485,_0x2e563f){return db[_0x4f7b('0x2e')][_0x4f7b('0x4c')](_0xee485['body'],{})[_0x4f7b('0x24')](function(_0x45eebf){var _0x148da8=_0xee485['user'][_0x4f7b('0x25')]({'plain':!![]});if(!_0x148da8)throw new Error(_0x4f7b('0x4d'));if(_0x148da8[_0x4f7b('0x4e')]===_0x4f7b('0x4f')){var _0x145dd7=_0x45eebf[_0x4f7b('0x25')]({'plain':!![]});var _0x144ba1=_0x4f7b('0x26');return db[_0x4f7b('0x50')][_0x4f7b('0x4b')]({'where':{'name':_0x144ba1,'userProfileId':_0x148da8['userProfileId']},'raw':!![]})[_0x4f7b('0x24')](function(_0xfb6a3d){if(_0xfb6a3d&&_0xfb6a3d[_0x4f7b('0x51')]===0x0){return db['UserProfileResource'][_0x4f7b('0x4c')]({'name':_0x145dd7[_0x4f7b('0x2b')],'resourceId':_0x145dd7['id'],'type':_0xfb6a3d[_0x4f7b('0x2b')],'sectionId':_0xfb6a3d['id']},{})[_0x4f7b('0x24')](function(){return _0x45eebf;});}else{return _0x45eebf;}})[_0x4f7b('0x48')](function(_0x819fb3){logger['error'](_0x4f7b('0x52'),_0x819fb3);throw _0x819fb3;});}return _0x45eebf;})[_0x4f7b('0x24')](respondWithResult(_0x2e563f,0xc9))[_0x4f7b('0x48')](handleError(_0x2e563f,null));};exports['update']=function(_0x4017b5,_0x1906ad){if(_0x4017b5[_0x4f7b('0x53')]['id']){delete _0x4017b5[_0x4f7b('0x53')]['id'];}return db[_0x4f7b('0x2e')][_0x4f7b('0x4b')]({'where':{'id':_0x4017b5['params']['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x1906ad,null))['then'](saveUpdates(_0x4017b5['body'],null))['then'](respondWithResult(_0x1906ad,null))[_0x4f7b('0x48')](handleError(_0x1906ad,null));};exports[_0x4f7b('0x28')]=function(_0x27b2e1,_0x4eded2){return db['VoiceMail'][_0x4f7b('0x4b')]({'where':{'id':_0x27b2e1[_0x4f7b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4eded2,null))[_0x4f7b('0x24')](removeEntity(_0x4eded2,null))[_0x4f7b('0x48')](handleError(_0x4eded2,null));};exports[_0x4f7b('0x54')]=function(_0x1a7ee9,_0x567874,_0x38c89a){return db[_0x4f7b('0x2e')][_0x4f7b('0x55')]({'where':{'id':_0x1a7ee9[_0x4f7b('0x4a')]['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x567874,null))[_0x4f7b('0x24')](function(_0x311bd8){var _0x5cc48d;var _0x529821={},_0x507199={};_0x507199[_0x4f7b('0x33')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x507199['query']=_[_0x4f7b('0x35')](_0x1a7ee9[_0x4f7b('0x34')]);_0x507199[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x507199[_0x4f7b('0x33')],_0x507199[_0x4f7b('0x34')]);_0x529821[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x507199[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x39')]));_0x529821[_0x4f7b('0x38')]=_0x529821[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x529821[_0x4f7b('0x38')]:_0x507199[_0x4f7b('0x33')];if(!_0x1a7ee9[_0x4f7b('0x34')]['hasOwnProperty'](_0x4f7b('0x56'))){_0x529821[_0x4f7b('0x1e')]=qs[_0x4f7b('0x1e')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x1e')]);_0x529821['offset']=qs['offset'](_0x1a7ee9[_0x4f7b('0x34')]['offset']);}_0x529821[_0x4f7b('0x3c')]=qs[_0x4f7b('0x3d')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x3d')]);_0x529821['where']=qs[_0x4f7b('0x36')](_[_0x4f7b('0x3f')](_0x1a7ee9[_0x4f7b('0x34')],_0x507199['filters']));if(_0x1a7ee9['query']['filter']){_0x529821[_0x4f7b('0x3e')]=_['merge'](_0x529821['where'],{'$or':_['map'](_0x529821[_0x4f7b('0x38')],function(_0x1484c8){var _0x2b0043={};_0x2b0043[_0x1484c8]={'$like':'%'+_0x1a7ee9['query'][_0x4f7b('0x42')]+'%'};return _0x2b0043;})});}_0x529821[_0x4f7b('0x3e')]=_['merge'](_0x529821['where'],{'mailboxuser':_0x311bd8[_0x4f7b('0x57')]});_0x529821=_[_0x4f7b('0x40')]({},_0x529821,_0x1a7ee9[_0x4f7b('0x43')]);return db[_0x4f7b('0x58')]['findAndCountAll'](_0x529821)[_0x4f7b('0x24')](respondWithFilteredResult(_0x567874,_0x529821));})[_0x4f7b('0x48')](handleError(_0x567874,null));}; \ No newline at end of file +var _0x58a4=['catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x41d02e,_0x27014d){var _0x4eac55=function(_0x46fbbb){while(--_0x46fbbb){_0x41d02e['push'](_0x41d02e['shift']());}};_0x4eac55(++_0x27014d);}(_0x58a4,0xbf));var _0x458a=function(_0x1de2bd,_0x953fb){_0x1de2bd=_0x1de2bd-0x0;var _0x595960=_0x58a4[_0x1de2bd];return _0x595960;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':!![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='Voicemails';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['update']=function(_0xa51e28,_0x5b428c){if(_0xa51e28[_0x458a('0x4b')]['id']){delete _0xa51e28['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0xa51e28[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](saveUpdates(_0xa51e28[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x5b428c,null))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports['destroy']=function(_0x2c1230,_0x212de5){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x2c1230[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x212de5,null))['then'](removeEntity(_0x212de5,null))[_0x458a('0x46')](handleError(_0x212de5,null));};exports[_0x458a('0x51')]=function(_0x45325f,_0x39e5b5,_0x3ab86a){return db[_0x458a('0x30')][_0x458a('0x52')]({'where':{'id':_0x45325f[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39e5b5,null))[_0x458a('0x25')](function(_0x4abe93){var _0x1f93ad;var _0x2921ba={},_0x222aa4={};_0x222aa4[_0x458a('0x33')]=_['keys'](db['VoiceMailMessage'][_0x458a('0x48')]);_0x222aa4[_0x458a('0x34')]=_[_0x458a('0x35')](_0x45325f[_0x458a('0x34')]);_0x222aa4[_0x458a('0x36')]=_[_0x458a('0x37')](_0x222aa4['model'],_0x222aa4[_0x458a('0x34')]);_0x2921ba[_0x458a('0x38')]=_['intersection'](_0x222aa4[_0x458a('0x33')],qs['fields'](_0x45325f[_0x458a('0x34')][_0x458a('0x39')]));_0x2921ba[_0x458a('0x38')]=_0x2921ba[_0x458a('0x38')][_0x458a('0x3a')]?_0x2921ba[_0x458a('0x38')]:_0x222aa4[_0x458a('0x33')];if(!_0x45325f[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x2921ba[_0x458a('0x1e')]=qs['limit'](_0x45325f[_0x458a('0x34')][_0x458a('0x1e')]);_0x2921ba['offset']=qs[_0x458a('0x20')](_0x45325f[_0x458a('0x34')]['offset']);}_0x2921ba[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x45325f['query'][_0x458a('0x3d')]);_0x2921ba[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x53')](_0x45325f[_0x458a('0x34')],_0x222aa4[_0x458a('0x36')]));if(_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]){_0x2921ba['where']=_[_0x458a('0x40')](_0x2921ba[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x2921ba[_0x458a('0x38')],function(_0x250238){var _0x2930ae={};_0x2930ae[_0x250238]={'$like':'%'+_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x2930ae;})});}_0x2921ba[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x2921ba['where'],{'mailboxuser':_0x4abe93[_0x458a('0x54')]});_0x2921ba=_['merge']({},_0x2921ba,_0x45325f[_0x458a('0x42')]);return db[_0x458a('0x55')][_0x458a('0x56')](_0x2921ba)[_0x458a('0x25')](respondWithFilteredResult(_0x39e5b5,_0x2921ba));})[_0x458a('0x46')](handleError(_0x39e5b5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 43bc984..118c389 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 _0xa252=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x584b55,_0x56145a){var _0x371ec7=function(_0x2c3f95){while(--_0x2c3f95){_0x584b55['push'](_0x584b55['shift']());}};_0x371ec7(++_0x56145a);}(_0xa252,0x18c));var _0x2a25=function(_0x494d1c,_0x246f2d){_0x494d1c=_0x494d1c-0x0;var _0x343268=_0xa252[_0x494d1c];return _0x343268;};'use strict';var _=require(_0x2a25('0x0'));var util=require(_0x2a25('0x1'));var logger=require(_0x2a25('0x2'))(_0x2a25('0x3'));var moment=require(_0x2a25('0x4'));var BPromise=require(_0x2a25('0x5'));var rp=require(_0x2a25('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a25('0x7'));module[_0x2a25('0x8')]=function(_0x3c59de,_0x8dba89){return _0x3c59de[_0x2a25('0x9')](_0x2a25('0xa'),attributes,{'tableName':_0x2a25('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x2a25('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6e4=['context','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0xa73ed6,_0x27a517){var _0x4428dc=function(_0x239856){while(--_0x239856){_0xa73ed6['push'](_0xa73ed6['shift']());}};_0x4428dc(++_0x27a517);}(_0xc6e4,0x71));var _0x4c6e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc6e4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c6e('0x0'));var util=require(_0x4c6e('0x1'));var logger=require('../../config/logger')(_0x4c6e('0x2'));var moment=require(_0x4c6e('0x3'));var BPromise=require(_0x4c6e('0x4'));var rp=require(_0x4c6e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c6e('0x6'));var config=require(_0x4c6e('0x7'));var attributes=require(_0x4c6e('0x8'));module[_0x4c6e('0x9')]=function(_0x336f88,_0x404141){return _0x336f88[_0x4c6e('0xa')](_0x4c6e('0xb'),attributes,{'tableName':_0x4c6e('0xc'),'paranoid':![],'indexes':[{'name':_0x4c6e('0xd'),'fields':[_0x4c6e('0xe'),_0x4c6e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a721586..b849094 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 _0xa326=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b60e2,_0x2a082e){var _0x487f0e=function(_0x30e63c){while(--_0x30e63c){_0x1b60e2['push'](_0x1b60e2['shift']());}};_0x487f0e(++_0x2a082e);}(_0xa326,0x1e8));var _0x6a32=function(_0x48e866,_0xa7966b){_0x48e866=_0x48e866-0x0;var _0xf9cd84=_0xa326[_0x48e866];return _0xf9cd84;};'use strict';var _=require(_0x6a32('0x0'));var util=require('util');var moment=require(_0x6a32('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a32('0x2'));var fs=require('fs');var Redis=require(_0x6a32('0x3'));var db=require(_0x6a32('0x4'))['db'];var utils=require(_0x6a32('0x5'));var logger=require(_0x6a32('0x6'))(_0x6a32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a32('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51feac,_0x4c797b,_0x4a30bd){return new BPromise(function(_0xb0058a,_0x150b17){return client[_0x6a32('0x9')](_0x51feac,_0x4a30bd)['then'](function(_0x439a2e){logger[_0x6a32('0xa')](_0x6a32('0xb'),_0x4c797b,_0x6a32('0xc'));logger[_0x6a32('0xd')](_0x6a32('0xe'),_0x4c797b,'request\x20sent',JSON[_0x6a32('0xf')](_0x439a2e));if(_0x439a2e['error']){if(_0x439a2e[_0x6a32('0x10')][_0x6a32('0x11')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x4c797b,_0x439a2e['error'][_0x6a32('0x12')]);return _0x150b17(_0x439a2e[_0x6a32('0x10')][_0x6a32('0x12')]);}logger['error'](_0x6a32('0xb'),_0x4c797b,_0x439a2e['error'][_0x6a32('0x12')]);return _0xb0058a(_0x439a2e[_0x6a32('0x10')]['message']);}else{logger[_0x6a32('0xa')](_0x6a32('0xb'),_0x4c797b,'request\x20sent');_0xb0058a(_0x439a2e[_0x6a32('0x13')][_0x6a32('0x12')]);}})[_0x6a32('0x14')](function(_0x1fcc56){logger[_0x6a32('0x10')]('VoiceMail,\x20%s,\x20%s',_0x4c797b,_0x1fcc56);_0x150b17(_0x1fcc56);});});} \ No newline at end of file +var _0x95e8=['result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5d7789,_0x2d0a1b){var _0xb07524=function(_0x4f8044){while(--_0x4f8044){_0x5d7789['push'](_0x5d7789['shift']());}};_0xb07524(++_0x2d0a1b);}(_0x95e8,0x190));var _0x895e=function(_0x24e19c,_0x1eec14){_0x24e19c=_0x24e19c-0x0;var _0x188fac=_0x95e8[_0x24e19c];return _0x188fac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x895e('0x0'));var BPromise=require(_0x895e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x895e('0x2'));var db=require(_0x895e('0x3'))['db'];var utils=require(_0x895e('0x4'));var logger=require('../../config/logger')(_0x895e('0x5'));var config=require(_0x895e('0x6'));var jayson=require(_0x895e('0x7'));var client=jayson[_0x895e('0x8')][_0x895e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15253b,_0x52b701,_0x4c77c1){return new BPromise(function(_0x3df0af,_0x150644){return client[_0x895e('0xa')](_0x15253b,_0x4c77c1)[_0x895e('0xb')](function(_0x1f04c3){logger[_0x895e('0xc')](_0x895e('0xd'),_0x52b701,'request\x20sent');logger['debug'](_0x895e('0xe'),_0x52b701,_0x895e('0xf'),JSON[_0x895e('0x10')](_0x1f04c3));if(_0x1f04c3[_0x895e('0x11')]){if(_0x1f04c3['error'][_0x895e('0x12')]===0x1f4){logger[_0x895e('0x11')]('VoiceMail,\x20%s,\x20%s',_0x52b701,_0x1f04c3[_0x895e('0x11')]['message']);return _0x150644(_0x1f04c3[_0x895e('0x11')][_0x895e('0x13')]);}logger[_0x895e('0x11')](_0x895e('0xd'),_0x52b701,_0x1f04c3['error']['message']);return _0x3df0af(_0x1f04c3[_0x895e('0x11')][_0x895e('0x13')]);}else{logger[_0x895e('0xc')]('VoiceMail,\x20%s,\x20%s',_0x52b701,_0x895e('0xf'));_0x3df0af(_0x1f04c3[_0x895e('0x14')]['message']);}})['catch'](function(_0x321d04){logger['error'](_0x895e('0xd'),_0x52b701,_0x321d04);_0x150644(_0x321d04);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 561fdac..9b6af5a 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 _0x52ea=['Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','download','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x5433e9,_0xd98633){var _0x5dc376=function(_0x4d7802){while(--_0x4d7802){_0x5433e9['push'](_0x5433e9['shift']());}};_0x5dc376(++_0xd98633);}(_0x52ea,0xe0));var _0xa52e=function(_0xa03344,_0x581292){_0xa03344=_0xa03344-0x0;var _0x38acfd=_0x52ea[_0xa03344];return _0x38acfd;};'use strict';var multer=require(_0xa52e('0x0'));var util=require(_0xa52e('0x1'));var path=require('path');var timeout=require(_0xa52e('0x2'));var express=require(_0xa52e('0x3'));var router=express[_0xa52e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa52e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa52e('0x6'));var controller=require(_0xa52e('0x7'));router['get']('/',auth[_0xa52e('0x8')](),controller[_0xa52e('0x9')]);router[_0xa52e('0xa')](_0xa52e('0xb'),auth[_0xa52e('0x8')](),controller[_0xa52e('0xc')]);router['get']('/:id/download',auth[_0xa52e('0x8')](),controller[_0xa52e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa52e('0xe')]);router[_0xa52e('0xf')](_0xa52e('0xb'),auth[_0xa52e('0x8')](),controller[_0xa52e('0x10')]);router[_0xa52e('0x11')]('/:id',auth[_0xa52e('0x8')](),controller['destroy']);module[_0xa52e('0x12')]=router; \ No newline at end of file +var _0x21c7=['isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x145444,_0x496c84){var _0x630049=function(_0x3e3723){while(--_0x3e3723){_0x145444['push'](_0x145444['shift']());}};_0x630049(++_0x496c84);}(_0x21c7,0x138));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x721c('0x0'));var util=require(_0x721c('0x1'));var path=require('path');var timeout=require(_0x721c('0x2'));var express=require(_0x721c('0x3'));var router=express['Router']();var fs_extra=require(_0x721c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x721c('0x5'));var controller=require(_0x721c('0x6'));router[_0x721c('0x7')]('/',auth[_0x721c('0x8')](),controller[_0x721c('0x9')]);router['get'](_0x721c('0xa'),auth[_0x721c('0x8')](),controller[_0x721c('0xb')]);router[_0x721c('0x7')](_0x721c('0xc'),auth[_0x721c('0x8')](),controller[_0x721c('0xd')]);router[_0x721c('0xe')]('/',auth[_0x721c('0x8')](),controller[_0x721c('0xf')]);router[_0x721c('0x10')](_0x721c('0xa'),auth['isAuthenticated'](),controller[_0x721c('0x11')]);router[_0x721c('0x12')](_0x721c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x721c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 97c924c..f7de762 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 _0x0987=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING','long'];(function(_0x5bd247,_0x4399ad){var _0xccc94a=function(_0x2e2664){while(--_0x2e2664){_0x5bd247['push'](_0x5bd247['shift']());}};_0xccc94a(++_0x4399ad);}(_0x0987,0x163));var _0x7098=function(_0x550eaa,_0x1c7116){_0x550eaa=_0x550eaa-0x0;var _0x1f0248=_0x0987[_0x550eaa];return _0x1f0248;};'use strict';var Sequelize=require(_0x7098('0x0'));module['exports']={'name':{'type':Sequelize[_0x7098('0x1')],'get':function(_0x168e2c){return this[_0x7098('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x7098('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'stamp':{'type':_0x7098('0x5'),'defaultValue':Sequelize[_0x7098('0x6')](_0x7098('0x7'))}}; \ No newline at end of file +var _0x4536=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x3fc1cc,_0xcbed7f){var _0x417c81=function(_0x9bc787){while(--_0x9bc787){_0x3fc1cc['push'](_0x3fc1cc['shift']());}};_0x417c81(++_0xcbed7f);}(_0x4536,0x1bc));var _0x6453=function(_0x5b5d10,_0x3ec8fa){_0x5b5d10=_0x5b5d10-0x0;var _0x31f955=_0x4536[_0x5b5d10];return _0x31f955;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6453('0x0')],'get':function(_0x34b916){return this[_0x6453('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x6453('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x6453('0x4')](_0x6453('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x6453('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x6453('0x6'),'defaultValue':Sequelize[_0x6453('0x7')](_0x6453('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 1faf232..8e292c8 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 _0x9e4b=['save','update','then','error','stack','name','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','find','catch','create','body','params','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','send','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','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/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x2e7984,_0x773fbc){var _0x3b1bea=function(_0x4eacbe){while(--_0x4eacbe){_0x2e7984['push'](_0x2e7984['shift']());}};_0x3b1bea(++_0x773fbc);}(_0x9e4b,0x18f));var _0xb9e4=function(_0xc2299,_0x318d47){_0xc2299=_0xc2299-0x0;var _0x5e0f4e=_0x9e4b[_0xc2299];return _0x5e0f4e;};'use strict';var emlformat=require(_0xb9e4('0x0'));var rimraf=require(_0xb9e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9e4('0x2'));var moment=require(_0xb9e4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb9e4('0x4'));var util=require(_0xb9e4('0x5'));var path=require(_0xb9e4('0x6'));var sox=require(_0xb9e4('0x7'));var csv=require(_0xb9e4('0x8'));var ejs=require(_0xb9e4('0x9'));var fs=require('fs');var fs_extra=require(_0xb9e4('0xa'));var _=require(_0xb9e4('0xb'));var squel=require(_0xb9e4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9e4('0xd'));var deskjs=require(_0xb9e4('0xe'));var toCsv=require(_0xb9e4('0x8'));var querystring=require(_0xb9e4('0xf'));var Papa=require(_0xb9e4('0x10'));var Redis=require('ioredis');var authService=require(_0xb9e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb9e4('0x12'));var hardwareService=require(_0xb9e4('0x13'));var logger=require(_0xb9e4('0x14'))(_0xb9e4('0x15'));var utils=require(_0xb9e4('0x16'));var config=require(_0xb9e4('0x17'));var licenseUtil=require(_0xb9e4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599fc2,_0x1ddc2e){_0x1ddc2e=_0x1ddc2e||0xcc;return function(_0x170ef3){if(_0x170ef3){return _0x599fc2['sendStatus'](_0x1ddc2e);}return _0x599fc2[_0xb9e4('0x19')](_0x1ddc2e)[_0xb9e4('0x1a')]();};}function respondWithResult(_0x296718,_0x2762ee){_0x2762ee=_0x2762ee||0xc8;return function(_0x5415be){if(_0x5415be){return _0x296718[_0xb9e4('0x19')](_0x2762ee)[_0xb9e4('0x1b')](_0x5415be);}};}function respondWithFilteredResult(_0x5193a7,_0x2a5208){return function(_0xa1935a){if(_0xa1935a){var _0x642c99=typeof _0x2a5208['offset']==='undefined'&&typeof _0x2a5208[_0xb9e4('0x1c')]===_0xb9e4('0x1d');var _0x370ff8=_0xa1935a[_0xb9e4('0x1e')];var _0x9bf79d=_0x642c99?0x0:_0x2a5208[_0xb9e4('0x1f')];var _0x29fee7=_0x642c99?_0xa1935a[_0xb9e4('0x1e')]:_0x2a5208[_0xb9e4('0x1f')]+_0x2a5208['limit'];var _0x1da198;if(_0x29fee7>=_0x370ff8){_0x29fee7=_0x370ff8;_0x1da198=0xc8;}else{_0x1da198=0xce;}_0x5193a7[_0xb9e4('0x19')](_0x1da198);return _0x5193a7[_0xb9e4('0x20')](_0xb9e4('0x21'),_0x9bf79d+'-'+_0x29fee7+'/'+_0x370ff8)['json'](_0xa1935a);}return null;};}function patchUpdates(_0x591c6d){return function(_0x5804ee){try{jsonpatch[_0xb9e4('0x22')](_0x5804ee,_0x591c6d,!![]);}catch(_0x37e1cb){return BPromise[_0xb9e4('0x23')](_0x37e1cb);}return _0x5804ee[_0xb9e4('0x24')]();};}function saveUpdates(_0x184ab2,_0x1a305c){return function(_0x1c5d84){if(_0x1c5d84){return _0x1c5d84[_0xb9e4('0x25')](_0x184ab2)[_0xb9e4('0x26')](function(_0x3329b9){return _0x3329b9;});}return null;};}function removeEntity(_0x419064,_0x1e50da){return function(_0x18f2fc){if(_0x18f2fc){return _0x18f2fc['destroy']()[_0xb9e4('0x26')](function(){_0x419064[_0xb9e4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf925,_0x5d5b2c){return function(_0x4c5e8d){if(!_0x4c5e8d){_0x3cf925['sendStatus'](0x194);}return _0x4c5e8d;};}function handleError(_0xcd44b,_0x53de0e){_0x53de0e=_0x53de0e||0x1f4;return function(_0x967f6e){logger[_0xb9e4('0x27')](_0x967f6e[_0xb9e4('0x28')]);if(_0x967f6e[_0xb9e4('0x29')]){delete _0x967f6e[_0xb9e4('0x29')];}_0xcd44b['status'](_0x53de0e)['send'](_0x967f6e);};}exports[_0xb9e4('0x2a')]=function(_0x144657,_0x1c24a4){var _0x322b24={},_0x3f1fe5={},_0x38a18b={'count':0x0,'rows':[]};var _0x45823f=_['map'](db[_0xb9e4('0x2b')][_0xb9e4('0x2c')],function(_0x37daf0){return{'name':_0x37daf0[_0xb9e4('0x2d')],'type':_0x37daf0[_0xb9e4('0x2e')][_0xb9e4('0x2f')]};});_0x3f1fe5[_0xb9e4('0x30')]=_['differenceBy'](_[_0xb9e4('0x31')](_0x45823f,'name'),[_0xb9e4('0x29')]);_0x3f1fe5[_0xb9e4('0x32')]=_[_0xb9e4('0x33')](_0x144657[_0xb9e4('0x32')]);_0x3f1fe5[_0xb9e4('0x34')]=_[_0xb9e4('0x35')](_0x3f1fe5[_0xb9e4('0x30')],_0x3f1fe5[_0xb9e4('0x32')]);_0x322b24[_0xb9e4('0x36')]=_[_0xb9e4('0x35')](_0x3f1fe5[_0xb9e4('0x30')],qs[_0xb9e4('0x37')](_0x144657['query'][_0xb9e4('0x37')]));_0x322b24[_0xb9e4('0x36')]=_0x322b24['attributes'][_0xb9e4('0x38')]?_0x322b24['attributes']:_0x3f1fe5['model'];if(!_0x144657[_0xb9e4('0x32')][_0xb9e4('0x39')](_0xb9e4('0x3a'))){_0x322b24[_0xb9e4('0x1c')]=qs[_0xb9e4('0x1c')](_0x144657['query'][_0xb9e4('0x1c')]);_0x322b24[_0xb9e4('0x1f')]=qs[_0xb9e4('0x1f')](_0x144657[_0xb9e4('0x32')]['offset']);}_0x322b24[_0xb9e4('0x3b')]=qs[_0xb9e4('0x3c')](_0x144657[_0xb9e4('0x32')][_0xb9e4('0x3c')]);_0x322b24[_0xb9e4('0x3d')]=qs[_0xb9e4('0x34')](_[_0xb9e4('0x3e')](_0x144657[_0xb9e4('0x32')],_0x3f1fe5['filters']),_0x45823f);if(_0x144657[_0xb9e4('0x32')][_0xb9e4('0x3f')]){_0x322b24[_0xb9e4('0x3d')]=_[_0xb9e4('0x40')](_0x322b24[_0xb9e4('0x3d')],{'$or':_[_0xb9e4('0x31')](_0x45823f,function(_0x38f68c){if(_0x38f68c[_0xb9e4('0x2e')]!==_0xb9e4('0x41')){var _0x2f6470={};_0x2f6470[_0x38f68c[_0xb9e4('0x29')]]={'$like':'%'+_0x144657[_0xb9e4('0x32')]['filter']+'%'};return _0x2f6470;}})});}_0x322b24=_['merge']({},_0x322b24,_0x144657[_0xb9e4('0x42')]);var _0x4607eb={'where':_0x322b24[_0xb9e4('0x3d')]};return db[_0xb9e4('0x2b')][_0xb9e4('0x1e')](_0x4607eb)[_0xb9e4('0x26')](function(_0x224e1a){_0x38a18b['count']=_0x224e1a;if(_0x144657['query'][_0xb9e4('0x43')]){_0x322b24['include']=[{'all':!![]}];}return db[_0xb9e4('0x2b')][_0xb9e4('0x44')](_0x322b24);})[_0xb9e4('0x26')](function(_0x2e510e){_0x38a18b[_0xb9e4('0x45')]=_0x2e510e;return _0x38a18b;})[_0xb9e4('0x26')](respondWithFilteredResult(_0x1c24a4,_0x322b24))['catch'](handleError(_0x1c24a4,null));};exports['show']=function(_0x35aa6c,_0x445604){var _0x372cc0={'raw':!![],'where':{'id':_0x35aa6c['params']['id']}},_0x4861da={};_0x4861da[_0xb9e4('0x30')]=_['keys'](db[_0xb9e4('0x2b')][_0xb9e4('0x2c')]);_0x4861da[_0xb9e4('0x32')]=_[_0xb9e4('0x33')](_0x35aa6c[_0xb9e4('0x32')]);_0x4861da[_0xb9e4('0x34')]=_[_0xb9e4('0x35')](_0x4861da[_0xb9e4('0x30')],_0x4861da[_0xb9e4('0x32')]);_0x372cc0[_0xb9e4('0x36')]=_[_0xb9e4('0x35')](_0x4861da['model'],qs[_0xb9e4('0x37')](_0x35aa6c[_0xb9e4('0x32')][_0xb9e4('0x37')]));_0x372cc0['attributes']=_0x372cc0['attributes'][_0xb9e4('0x38')]?_0x372cc0[_0xb9e4('0x36')]:_0x4861da[_0xb9e4('0x30')];if(_0x35aa6c['query'][_0xb9e4('0x43')]){_0x372cc0['include']=[{'all':!![]}];}_0x372cc0=_[_0xb9e4('0x40')]({},_0x372cc0,_0x35aa6c[_0xb9e4('0x42')]);return db['VoiceMailMessage'][_0xb9e4('0x46')](_0x372cc0)[_0xb9e4('0x26')](handleEntityNotFound(_0x445604,null))[_0xb9e4('0x26')](respondWithResult(_0x445604,null))[_0xb9e4('0x47')](handleError(_0x445604,null));};exports[_0xb9e4('0x48')]=function(_0x308da7,_0x4d3936){return db[_0xb9e4('0x2b')][_0xb9e4('0x48')](_0x308da7[_0xb9e4('0x49')],{})[_0xb9e4('0x26')](respondWithResult(_0x4d3936,0xc9))[_0xb9e4('0x47')](handleError(_0x4d3936,null));};exports[_0xb9e4('0x25')]=function(_0x362293,_0x4e60b4){if(_0x362293[_0xb9e4('0x49')]['id']){delete _0x362293[_0xb9e4('0x49')]['id'];}return db[_0xb9e4('0x2b')][_0xb9e4('0x46')]({'where':{'id':_0x362293[_0xb9e4('0x4a')]['id']}})[_0xb9e4('0x26')](handleEntityNotFound(_0x4e60b4,null))[_0xb9e4('0x26')](saveUpdates(_0x362293[_0xb9e4('0x49')],null))[_0xb9e4('0x26')](respondWithResult(_0x4e60b4,null))[_0xb9e4('0x47')](handleError(_0x4e60b4,null));};exports[_0xb9e4('0x4b')]=function(_0x176d3e,_0x5395b0){return db[_0xb9e4('0x2b')]['find']({'where':{'id':_0x176d3e[_0xb9e4('0x4a')]['id']}})[_0xb9e4('0x26')](handleEntityNotFound(_0x5395b0,null))['then'](removeEntity(_0x5395b0,null))[_0xb9e4('0x47')](handleError(_0x5395b0,null));};exports[_0xb9e4('0x4c')]=function(_0x2eb897,_0x39f295,_0x1eab1c){return db[_0xb9e4('0x2b')][_0xb9e4('0x46')]({'where':{'id':_0x2eb897[_0xb9e4('0x4a')]['id']},'attributes':['id',_0xb9e4('0x4d'),_0xb9e4('0x4e')]})[_0xb9e4('0x26')](handleEntityNotFound(_0x39f295,null))['then'](function(_0x4d95f4){if(_0x4d95f4){if(!_0x4d95f4[_0xb9e4('0x4d')]){throw new db[(_0xb9e4('0x4f'))][(_0xb9e4('0x50'))](_0xb9e4('0x51'));}var _0x26a1bd={'Content-Type':_0xb9e4('0x52'),'Content-Disposition':_0xb9e4('0x53')};if(_0x4d95f4[_0xb9e4('0x4e')]){_0x26a1bd[_0xb9e4('0x54')]=_0xb9e4('0x55')+_0x4d95f4[_0xb9e4('0x4e')]+'.wav\x22';}_0x39f295[_0xb9e4('0x20')](_0x26a1bd);return _0x39f295[_0xb9e4('0x56')](new Buffer(_0x4d95f4['recording']));}})[_0xb9e4('0x47')](handleError(_0x39f295,null));}; \ No newline at end of file +var _0xbd56=['mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','end','error','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','update','body','find','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xbd56,0xb1));var _0x6bd5=function(_0x47f93f,_0x3de46e){_0x47f93f=_0x47f93f-0x0;var _0xb9c2d7=_0xbd56[_0x47f93f];return _0xb9c2d7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6bd5('0x0'));var jsonpatch=require(_0x6bd5('0x1'));var rp=require(_0x6bd5('0x2'));var moment=require(_0x6bd5('0x3'));var BPromise=require(_0x6bd5('0x4'));var Mustache=require(_0x6bd5('0x5'));var util=require(_0x6bd5('0x6'));var path=require(_0x6bd5('0x7'));var sox=require(_0x6bd5('0x8'));var csv=require(_0x6bd5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bd5('0xa'));var _=require(_0x6bd5('0xb'));var squel=require(_0x6bd5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6bd5('0xd'));var toCsv=require(_0x6bd5('0x9'));var querystring=require(_0x6bd5('0xe'));var Papa=require(_0x6bd5('0xf'));var Redis=require(_0x6bd5('0x10'));var authService=require(_0x6bd5('0x11'));var qs=require(_0x6bd5('0x12'));var as=require(_0x6bd5('0x13'));var hardwareService=require(_0x6bd5('0x14'));var logger=require(_0x6bd5('0x15'))(_0x6bd5('0x16'));var utils=require(_0x6bd5('0x17'));var config=require(_0x6bd5('0x18'));var licenseUtil=require(_0x6bd5('0x19'));var db=require(_0x6bd5('0x1a'))['db'];function respondWithStatusCode(_0xe99963,_0x1a37f7){_0x1a37f7=_0x1a37f7||0xcc;return function(_0xc59af5){if(_0xc59af5){return _0xe99963[_0x6bd5('0x1b')](_0x1a37f7);}return _0xe99963[_0x6bd5('0x1c')](_0x1a37f7)['end']();};}function respondWithResult(_0x5caaba,_0x679f5e){_0x679f5e=_0x679f5e||0xc8;return function(_0x39968e){if(_0x39968e){return _0x5caaba['status'](_0x679f5e)[_0x6bd5('0x1d')](_0x39968e);}};}function respondWithFilteredResult(_0x40de74,_0x2fb523){return function(_0x35ae61){if(_0x35ae61){var _0x180ac0=typeof _0x2fb523[_0x6bd5('0x1e')]==='undefined'&&typeof _0x2fb523[_0x6bd5('0x1f')]===_0x6bd5('0x20');var _0x1928ca=_0x35ae61[_0x6bd5('0x21')];var _0x5e81cc=_0x180ac0?0x0:_0x2fb523[_0x6bd5('0x1e')];var _0x3156f4=_0x180ac0?_0x35ae61['count']:_0x2fb523[_0x6bd5('0x1e')]+_0x2fb523[_0x6bd5('0x1f')];var _0x2573e1;if(_0x3156f4>=_0x1928ca){_0x3156f4=_0x1928ca;_0x2573e1=0xc8;}else{_0x2573e1=0xce;}_0x40de74[_0x6bd5('0x1c')](_0x2573e1);return _0x40de74[_0x6bd5('0x22')](_0x6bd5('0x23'),_0x5e81cc+'-'+_0x3156f4+'/'+_0x1928ca)[_0x6bd5('0x1d')](_0x35ae61);}return null;};}function patchUpdates(_0x5dfee8){return function(_0x3401d3){try{jsonpatch['apply'](_0x3401d3,_0x5dfee8,!![]);}catch(_0x34558d){return BPromise[_0x6bd5('0x24')](_0x34558d);}return _0x3401d3[_0x6bd5('0x25')]();};}function saveUpdates(_0x388cf5,_0x3186ec){return function(_0x2eae98){if(_0x2eae98){return _0x2eae98['update'](_0x388cf5)[_0x6bd5('0x26')](function(_0x2b63c8){return _0x2b63c8;});}return null;};}function removeEntity(_0x3d771c,_0x56ea5e){return function(_0x35e520){if(_0x35e520){return _0x35e520['destroy']()['then'](function(){_0x3d771c[_0x6bd5('0x1c')](0xcc)[_0x6bd5('0x27')]();});}};}function handleEntityNotFound(_0x3c31b5,_0x23d2b6){return function(_0x66e12){if(!_0x66e12){_0x3c31b5[_0x6bd5('0x1b')](0x194);}return _0x66e12;};}function handleError(_0x3a8438,_0x4bf91b){_0x4bf91b=_0x4bf91b||0x1f4;return function(_0x30eef0){logger[_0x6bd5('0x28')](_0x30eef0['stack']);if(_0x30eef0[_0x6bd5('0x29')]){delete _0x30eef0['name'];}_0x3a8438[_0x6bd5('0x1c')](_0x4bf91b)['send'](_0x30eef0);};}exports[_0x6bd5('0x2a')]=function(_0x40e18d,_0x14a398){var _0x384e4c={},_0x35dc77={},_0x3bdef4={'count':0x0,'rows':[]};var _0x3d195c=_[_0x6bd5('0x2b')](db[_0x6bd5('0x2c')][_0x6bd5('0x2d')],function(_0x3cddb2){return{'name':_0x3cddb2[_0x6bd5('0x2e')],'type':_0x3cddb2[_0x6bd5('0x2f')][_0x6bd5('0x30')]};});_0x35dc77[_0x6bd5('0x31')]=_[_0x6bd5('0x32')](_['map'](_0x3d195c,_0x6bd5('0x29')),['name']);_0x35dc77[_0x6bd5('0x33')]=_[_0x6bd5('0x34')](_0x40e18d[_0x6bd5('0x33')]);_0x35dc77['filters']=_[_0x6bd5('0x35')](_0x35dc77[_0x6bd5('0x31')],_0x35dc77['query']);_0x384e4c['attributes']=_[_0x6bd5('0x35')](_0x35dc77['model'],qs[_0x6bd5('0x36')](_0x40e18d[_0x6bd5('0x33')][_0x6bd5('0x36')]));_0x384e4c[_0x6bd5('0x37')]=_0x384e4c[_0x6bd5('0x37')][_0x6bd5('0x38')]?_0x384e4c['attributes']:_0x35dc77[_0x6bd5('0x31')];if(!_0x40e18d[_0x6bd5('0x33')][_0x6bd5('0x39')]('nolimit')){_0x384e4c[_0x6bd5('0x1f')]=qs[_0x6bd5('0x1f')](_0x40e18d[_0x6bd5('0x33')][_0x6bd5('0x1f')]);_0x384e4c[_0x6bd5('0x1e')]=qs[_0x6bd5('0x1e')](_0x40e18d[_0x6bd5('0x33')][_0x6bd5('0x1e')]);}_0x384e4c[_0x6bd5('0x3a')]=qs[_0x6bd5('0x3b')](_0x40e18d[_0x6bd5('0x33')]['sort']);_0x384e4c[_0x6bd5('0x3c')]=qs[_0x6bd5('0x3d')](_[_0x6bd5('0x3e')](_0x40e18d[_0x6bd5('0x33')],_0x35dc77[_0x6bd5('0x3d')]),_0x3d195c);if(_0x40e18d[_0x6bd5('0x33')][_0x6bd5('0x3f')]){_0x384e4c[_0x6bd5('0x3c')]=_[_0x6bd5('0x40')](_0x384e4c[_0x6bd5('0x3c')],{'$or':_[_0x6bd5('0x2b')](_0x3d195c,function(_0x4fa342){if(_0x4fa342[_0x6bd5('0x2f')]!==_0x6bd5('0x41')){var _0x48ea5f={};_0x48ea5f[_0x4fa342[_0x6bd5('0x29')]]={'$like':'%'+_0x40e18d[_0x6bd5('0x33')]['filter']+'%'};return _0x48ea5f;}})});}_0x384e4c=_[_0x6bd5('0x40')]({},_0x384e4c,_0x40e18d['options']);var _0x2f356a={'where':_0x384e4c[_0x6bd5('0x3c')]};return db[_0x6bd5('0x2c')]['count'](_0x2f356a)['then'](function(_0x2a4600){_0x3bdef4[_0x6bd5('0x21')]=_0x2a4600;if(_0x40e18d[_0x6bd5('0x33')][_0x6bd5('0x42')]){_0x384e4c['include']=[{'all':!![]}];}return db[_0x6bd5('0x2c')][_0x6bd5('0x43')](_0x384e4c);})[_0x6bd5('0x26')](function(_0x3691a6){_0x3bdef4[_0x6bd5('0x44')]=_0x3691a6;return _0x3bdef4;})[_0x6bd5('0x26')](respondWithFilteredResult(_0x14a398,_0x384e4c))[_0x6bd5('0x45')](handleError(_0x14a398,null));};exports[_0x6bd5('0x46')]=function(_0x24cdac,_0x54770e){var _0x49f81e={'raw':!![],'where':{'id':_0x24cdac[_0x6bd5('0x47')]['id']}},_0x284d7e={};_0x284d7e[_0x6bd5('0x31')]=_[_0x6bd5('0x34')](db[_0x6bd5('0x2c')][_0x6bd5('0x2d')]);_0x284d7e[_0x6bd5('0x33')]=_[_0x6bd5('0x34')](_0x24cdac[_0x6bd5('0x33')]);_0x284d7e['filters']=_[_0x6bd5('0x35')](_0x284d7e[_0x6bd5('0x31')],_0x284d7e[_0x6bd5('0x33')]);_0x49f81e[_0x6bd5('0x37')]=_[_0x6bd5('0x35')](_0x284d7e[_0x6bd5('0x31')],qs['fields'](_0x24cdac[_0x6bd5('0x33')][_0x6bd5('0x36')]));_0x49f81e[_0x6bd5('0x37')]=_0x49f81e[_0x6bd5('0x37')]['length']?_0x49f81e[_0x6bd5('0x37')]:_0x284d7e['model'];if(_0x24cdac['query'][_0x6bd5('0x42')]){_0x49f81e[_0x6bd5('0x48')]=[{'all':!![]}];}_0x49f81e=_[_0x6bd5('0x40')]({},_0x49f81e,_0x24cdac[_0x6bd5('0x49')]);return db[_0x6bd5('0x2c')]['find'](_0x49f81e)['then'](handleEntityNotFound(_0x54770e,null))[_0x6bd5('0x26')](respondWithResult(_0x54770e,null))[_0x6bd5('0x45')](handleError(_0x54770e,null));};exports[_0x6bd5('0x4a')]=function(_0x184fad,_0x3c9bed){return db['VoiceMailMessage']['create'](_0x184fad['body'],{})[_0x6bd5('0x26')](respondWithResult(_0x3c9bed,0xc9))['catch'](handleError(_0x3c9bed,null));};exports[_0x6bd5('0x4b')]=function(_0x5cf609,_0x30f988){if(_0x5cf609['body']['id']){delete _0x5cf609[_0x6bd5('0x4c')]['id'];}return db[_0x6bd5('0x2c')][_0x6bd5('0x4d')]({'where':{'id':_0x5cf609['params']['id']}})[_0x6bd5('0x26')](handleEntityNotFound(_0x30f988,null))[_0x6bd5('0x26')](saveUpdates(_0x5cf609['body'],null))[_0x6bd5('0x26')](respondWithResult(_0x30f988,null))['catch'](handleError(_0x30f988,null));};exports[_0x6bd5('0x4e')]=function(_0x56b544,_0x2af3a0){return db[_0x6bd5('0x2c')][_0x6bd5('0x4d')]({'where':{'id':_0x56b544['params']['id']}})[_0x6bd5('0x26')](handleEntityNotFound(_0x2af3a0,null))[_0x6bd5('0x26')](removeEntity(_0x2af3a0,null))[_0x6bd5('0x45')](handleError(_0x2af3a0,null));};exports[_0x6bd5('0x4f')]=function(_0x4a95b9,_0x8406e6,_0x814ac4){return db[_0x6bd5('0x2c')][_0x6bd5('0x4d')]({'where':{'id':_0x4a95b9['params']['id']},'attributes':['id',_0x6bd5('0x50'),_0x6bd5('0x51')]})[_0x6bd5('0x26')](handleEntityNotFound(_0x8406e6,null))[_0x6bd5('0x26')](function(_0x1bf5b3){if(_0x1bf5b3){if(!_0x1bf5b3[_0x6bd5('0x50')]){throw new db[(_0x6bd5('0x52'))][(_0x6bd5('0x53'))](_0x6bd5('0x54'));}var _0x56eaea={'Content-Type':_0x6bd5('0x55'),'Content-Disposition':_0x6bd5('0x56')};if(_0x1bf5b3[_0x6bd5('0x51')]){_0x56eaea[_0x6bd5('0x57')]=_0x6bd5('0x58')+_0x1bf5b3[_0x6bd5('0x51')]+_0x6bd5('0x59');}_0x8406e6[_0x6bd5('0x22')](_0x56eaea);return _0x8406e6[_0x6bd5('0x5a')](new Buffer(_0x1bf5b3[_0x6bd5('0x50')]));}})[_0x6bd5('0x45')](handleError(_0x8406e6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index d835930..7ce5b7a 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 _0x4264=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x4264,0x1ed));var _0x4426=function(_0x266c6b,_0x58d88e){_0x266c6b=_0x266c6b-0x0;var _0x3373b0=_0x4264[_0x266c6b];return _0x3373b0;};'use strict';var _=require(_0x4426('0x0'));var util=require(_0x4426('0x1'));var logger=require(_0x4426('0x2'))(_0x4426('0x3'));var moment=require(_0x4426('0x4'));var BPromise=require(_0x4426('0x5'));var rp=require(_0x4426('0x6'));var fs=require('fs');var path=require(_0x4426('0x7'));var rimraf=require(_0x4426('0x8'));var config=require(_0x4426('0x9'));var attributes=require(_0x4426('0xa'));module[_0x4426('0xb')]=function(_0x596b07,_0xfa06c4){return _0x596b07[_0x4426('0xc')](_0x4426('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x4426('0xe'),'fields':[_0x4426('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xcff9=['voice_voicemail_messages','lodash','util','../../config/logger','api','bluebird','request-promise','exports'];(function(_0x2e00b9,_0x2c0d24){var _0x452b9f=function(_0x10a573){while(--_0x10a573){_0x2e00b9['push'](_0x2e00b9['shift']());}};_0x452b9f(++_0x2c0d24);}(_0xcff9,0xa9));var _0x9cff=function(_0x140b05,_0x10b5aa){_0x140b05=_0x140b05-0x0;var _0x548e8a=_0xcff9[_0x140b05];return _0x548e8a;};'use strict';var _=require(_0x9cff('0x0'));var util=require(_0x9cff('0x1'));var logger=require(_0x9cff('0x2'))(_0x9cff('0x3'));var moment=require('moment');var BPromise=require(_0x9cff('0x4'));var rp=require(_0x9cff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x9cff('0x6')]=function(_0x5a1c97,_0x45f978){return _0x5a1c97['define']('VoiceMailMessage',attributes,{'tableName':_0x9cff('0x7'),'paranoid':![],'indexes':[{'name':'dir','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 f134fa3..bf430dd 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 _0xcca0=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','code','error','VoiceMailMessage,\x20%s,\x20%s','message'];(function(_0x54a02e,_0x57e5df){var _0x32e842=function(_0x4cd8ea){while(--_0x4cd8ea){_0x54a02e['push'](_0x54a02e['shift']());}};_0x32e842(++_0x57e5df);}(_0xcca0,0x1bb));var _0x0cca=function(_0x2b6fd6,_0x4e5a05){_0x2b6fd6=_0x2b6fd6-0x0;var _0xc0d50f=_0xcca0[_0x2b6fd6];return _0xc0d50f;};'use strict';var _=require(_0x0cca('0x0'));var util=require(_0x0cca('0x1'));var moment=require(_0x0cca('0x2'));var BPromise=require(_0x0cca('0x3'));var rs=require(_0x0cca('0x4'));var fs=require('fs');var Redis=require(_0x0cca('0x5'));var db=require(_0x0cca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cca('0x7'))(_0x0cca('0x8'));var config=require('../../config/environment');var jayson=require(_0x0cca('0x9'));var client=jayson[_0x0cca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d586f,_0x2eb296,_0x18b488){return new BPromise(function(_0x392107,_0x145c17){return client['request'](_0x1d586f,_0x18b488)[_0x0cca('0xb')](function(_0x49dde5){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x2eb296,_0x0cca('0xc'));logger[_0x0cca('0xd')](_0x0cca('0xe'),_0x2eb296,'request\x20sent',JSON['stringify'](_0x49dde5));if(_0x49dde5['error']){if(_0x49dde5['error'][_0x0cca('0xf')]===0x1f4){logger[_0x0cca('0x10')](_0x0cca('0x11'),_0x2eb296,_0x49dde5[_0x0cca('0x10')]['message']);return _0x145c17(_0x49dde5[_0x0cca('0x10')][_0x0cca('0x12')]);}logger['error'](_0x0cca('0x11'),_0x2eb296,_0x49dde5[_0x0cca('0x10')]['message']);return _0x392107(_0x49dde5[_0x0cca('0x10')][_0x0cca('0x12')]);}else{logger[_0x0cca('0x13')](_0x0cca('0x11'),_0x2eb296,_0x0cca('0xc'));_0x392107(_0x49dde5[_0x0cca('0x14')]['message']);}})[_0x0cca('0x15')](function(_0x1d4451){logger['error'](_0x0cca('0x11'),_0x2eb296,_0x1d4451);_0x145c17(_0x1d4451);});});} \ No newline at end of file +var _0x28f0=['request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info'];(function(_0x300dbb,_0xd7fd5b){var _0x1a4120=function(_0x10d5d0){while(--_0x10d5d0){_0x300dbb['push'](_0x300dbb['shift']());}};_0x1a4120(++_0xd7fd5b);}(_0x28f0,0xff));var _0x028f=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x28f0[_0x5b7788];return _0x573871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x028f('0x0'));var BPromise=require(_0x028f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x028f('0x2'));var db=require(_0x028f('0x3'))['db'];var utils=require(_0x028f('0x4'));var logger=require(_0x028f('0x5'))('rpc');var config=require(_0x028f('0x6'));var jayson=require(_0x028f('0x7'));var client=jayson[_0x028f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1452b1,_0x338be3,_0x133458){return new BPromise(function(_0x7e0902,_0x291bdc){return client['request'](_0x1452b1,_0x133458)[_0x028f('0x9')](function(_0x6b0ed9){logger[_0x028f('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x338be3,_0x028f('0xb'));logger['debug'](_0x028f('0xc'),_0x338be3,'request\x20sent',JSON[_0x028f('0xd')](_0x6b0ed9));if(_0x6b0ed9[_0x028f('0xe')]){if(_0x6b0ed9[_0x028f('0xe')]['code']===0x1f4){logger[_0x028f('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x338be3,_0x6b0ed9['error']['message']);return _0x291bdc(_0x6b0ed9[_0x028f('0xe')][_0x028f('0xf')]);}logger[_0x028f('0xe')](_0x028f('0x10'),_0x338be3,_0x6b0ed9[_0x028f('0xe')][_0x028f('0xf')]);return _0x7e0902(_0x6b0ed9[_0x028f('0xe')][_0x028f('0xf')]);}else{logger[_0x028f('0xa')](_0x028f('0x10'),_0x338be3,_0x028f('0xb'));_0x7e0902(_0x6b0ed9[_0x028f('0x11')][_0x028f('0xf')]);}})[_0x028f('0x12')](function(_0x1e3241){logger[_0x028f('0xe')](_0x028f('0x10'),_0x338be3,_0x1e3241);_0x291bdc(_0x1e3241);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 7cb19ff..e58a297 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 _0xe5bb=['index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','delete','removeSound','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4dabf3,_0x204886){var _0x30644f=function(_0x5c3519){while(--_0x5c3519){_0x4dabf3['push'](_0x4dabf3['shift']());}};_0x30644f(++_0x204886);}(_0xe5bb,0x14e));var _0xbe5b=function(_0x549e8b,_0x2a0acf){_0x549e8b=_0x549e8b-0x0;var _0x4f6954=_0xe5bb[_0x549e8b];return _0x4f6954;};'use strict';var multer=require(_0xbe5b('0x0'));var util=require(_0xbe5b('0x1'));var path=require(_0xbe5b('0x2'));var timeout=require(_0xbe5b('0x3'));var express=require(_0xbe5b('0x4'));var router=express['Router']();var fs_extra=require(_0xbe5b('0x5'));var auth=require(_0xbe5b('0x6'));var interaction=require(_0xbe5b('0x7'));var config=require(_0xbe5b('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0xbe5b('0x9')]('/',auth[_0xbe5b('0xa')](),controller[_0xbe5b('0xb')]);router[_0xbe5b('0x9')](_0xbe5b('0xc'),auth[_0xbe5b('0xa')](),controller[_0xbe5b('0xd')]);router[_0xbe5b('0x9')](_0xbe5b('0xe'),auth[_0xbe5b('0xa')](),controller[_0xbe5b('0xf')]);router[_0xbe5b('0x10')]('/',auth[_0xbe5b('0xa')](),controller['create']);router[_0xbe5b('0x10')]('/:id/sounds',auth[_0xbe5b('0xa')](),controller[_0xbe5b('0x11')]);router[_0xbe5b('0x12')](_0xbe5b('0xc'),auth[_0xbe5b('0xa')](),controller[_0xbe5b('0x13')]);router[_0xbe5b('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xbe5b('0x14')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xbe5b('0x15')]);module[_0xbe5b('0x16')]=router; \ No newline at end of file +var _0xced5=['put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','addSound'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xced5,0x10b));var _0x5ced=function(_0x436f4e,_0x183773){_0x436f4e=_0x436f4e-0x0;var _0x5d8395=_0xced5[_0x436f4e];return _0x5d8395;};'use strict';var multer=require('multer');var util=require(_0x5ced('0x0'));var path=require('path');var timeout=require(_0x5ced('0x1'));var express=require(_0x5ced('0x2'));var router=express['Router']();var fs_extra=require(_0x5ced('0x3'));var auth=require(_0x5ced('0x4'));var interaction=require(_0x5ced('0x5'));var config=require(_0x5ced('0x6'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x5ced('0x7')](),controller[_0x5ced('0x8')]);router[_0x5ced('0x9')](_0x5ced('0xa'),auth[_0x5ced('0x7')](),controller['show']);router[_0x5ced('0x9')]('/:id/sounds',auth[_0x5ced('0x7')](),controller['getSounds']);router[_0x5ced('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/sounds',auth[_0x5ced('0x7')](),controller[_0x5ced('0xc')]);router[_0x5ced('0xd')]('/:id',auth[_0x5ced('0x7')](),controller[_0x5ced('0xe')]);router['delete'](_0x5ced('0xa'),auth[_0x5ced('0x7')](),controller[_0x5ced('0xf')]);router[_0x5ced('0x10')](_0x5ced('0x11'),auth['isAuthenticated'](),controller[_0x5ced('0x12')]);module[_0x5ced('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d87488d..e3f0318 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 _0xb137=['mp3nb','quietmp3nb','quietmp3','TIMESTAMP','exports','STRING','name','ENUM','custom','files'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xb137,0xe0));var _0x7b13=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xb137[_0x301dab];return _0x2500a2;};'use strict';var Sequelize=require('sequelize');module[_0x7b13('0x0')]={'name':{'type':Sequelize[_0x7b13('0x1')],'allowNull':![],'unique':_0x7b13('0x2')},'mode':{'type':Sequelize[_0x7b13('0x3')](_0x7b13('0x4'),_0x7b13('0x5'),_0x7b13('0x6'),_0x7b13('0x7'),_0x7b13('0x8'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![]},'stamp':{'type':_0x7b13('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd9d2=['files','mp3nb','quietmp3','alpha','TIMESTAMP','STRING','name','ENUM','custom'];(function(_0x52956e,_0x2f8274){var _0x12afb1=function(_0x3d0df8){while(--_0x3d0df8){_0x52956e['push'](_0x52956e['shift']());}};_0x12afb1(++_0x2f8274);}(_0xd9d2,0x1d9));var _0x2d9d=function(_0x45870a,_0x5c6ff0){_0x45870a=_0x45870a-0x0;var _0x4ec553=_0xd9d2[_0x45870a];return _0x4ec553;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2d9d('0x0')],'allowNull':![],'unique':_0x2d9d('0x1')},'mode':{'type':Sequelize[_0x2d9d('0x2')](_0x2d9d('0x3'),_0x2d9d('0x4'),_0x2d9d('0x5'),'quietmp3nb',_0x2d9d('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x2d9d('0x4')},'directory':{'type':Sequelize[_0x2d9d('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0x2d9d('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2d9d('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0x2d9d('0x0')],'allowNull':!![],'defaultValue':_0x2d9d('0x7')},'format':{'type':Sequelize[_0x2d9d('0x0')],'allowNull':!![]},'stamp':{'type':_0x2d9d('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 2262d1e..1eae5be 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 _0x519c=['mode','files','directory','join','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','ValidationError','message','Sound','findOne','converted_format','createdAt','root','server/files/sounds/converted','%s.%s','basename','save_name','extname','format','removeSound','params','id2','Sequelize','pick','getSounds','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','options','find','body','create','transaction'];(function(_0x3f8f75,_0x2b066a){var _0x1104d3=function(_0x165246){while(--_0x165246){_0x3f8f75['push'](_0x3f8f75['shift']());}};_0x1104d3(++_0x2b066a);}(_0x519c,0x8f));var _0xc519=function(_0x19c339,_0xd98d2e){_0x19c339=_0x19c339-0x0;var _0x2b7bf3=_0x519c[_0x19c339];return _0x2b7bf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc519('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc519('0x1'));var rp=require(_0xc519('0x2'));var moment=require(_0xc519('0x3'));var BPromise=require(_0xc519('0x4'));var Mustache=require('mustache');var util=require(_0xc519('0x5'));var path=require(_0xc519('0x6'));var sox=require(_0xc519('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc519('0x8'));var _=require('lodash');var squel=require(_0xc519('0x9'));var crypto=require('crypto');var jsforce=require(_0xc519('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc519('0xb'));var querystring=require(_0xc519('0xc'));var Papa=require('papaparse');var Redis=require(_0xc519('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc519('0xe'));var as=require(_0xc519('0xf'));var hardwareService=require(_0xc519('0x10'));var logger=require('../../config/logger')(_0xc519('0x11'));var utils=require(_0xc519('0x12'));var config=require(_0xc519('0x13'));var licenseUtil=require(_0xc519('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x153c31,_0xd0e3cb){_0xd0e3cb=_0xd0e3cb||0xcc;return function(_0x59f2dd){if(_0x59f2dd){return _0x153c31[_0xc519('0x15')](_0xd0e3cb);}return _0x153c31['status'](_0xd0e3cb)[_0xc519('0x16')]();};}function respondWithResult(_0x54583d,_0x5df07f){_0x5df07f=_0x5df07f||0xc8;return function(_0x51c430){if(_0x51c430){return _0x54583d[_0xc519('0x17')](_0x5df07f)[_0xc519('0x18')](_0x51c430);}};}function respondWithFilteredResult(_0x57c5b9,_0x4ca33d){return function(_0x43a88d){if(_0x43a88d){var _0x12167b=typeof _0x4ca33d[_0xc519('0x19')]===_0xc519('0x1a')&&typeof _0x4ca33d[_0xc519('0x1b')]===_0xc519('0x1a');var _0x5593ac=_0x43a88d[_0xc519('0x1c')];var _0x2d57dd=_0x12167b?0x0:_0x4ca33d[_0xc519('0x19')];var _0x19ca38=_0x12167b?_0x43a88d[_0xc519('0x1c')]:_0x4ca33d['offset']+_0x4ca33d['limit'];var _0xb3ce97;if(_0x19ca38>=_0x5593ac){_0x19ca38=_0x5593ac;_0xb3ce97=0xc8;}else{_0xb3ce97=0xce;}_0x57c5b9[_0xc519('0x17')](_0xb3ce97);return _0x57c5b9[_0xc519('0x1d')](_0xc519('0x1e'),_0x2d57dd+'-'+_0x19ca38+'/'+_0x5593ac)[_0xc519('0x18')](_0x43a88d);}return null;};}function patchUpdates(_0x3b0fa7){return function(_0x1d14c7){try{jsonpatch[_0xc519('0x1f')](_0x1d14c7,_0x3b0fa7,!![]);}catch(_0x610a0a){return BPromise[_0xc519('0x20')](_0x610a0a);}return _0x1d14c7[_0xc519('0x21')]();};}function saveUpdates(_0x1a83ae,_0x3944d1){return function(_0x4aaf05){if(_0x4aaf05){return _0x4aaf05[_0xc519('0x22')](_0x1a83ae)[_0xc519('0x23')](function(_0x140e32){return _0x140e32;});}return null;};}function removeEntity(_0x14a6a6,_0x4fb316){return function(_0x58700d){if(_0x58700d){return _0x58700d[_0xc519('0x24')]()['then'](function(){var _0x190403=_0x58700d[_0xc519('0x25')]({'plain':!![]});var _0x426c2=_0xc519('0x26');return db['UserProfileResource'][_0xc519('0x24')]({'where':{'type':_0x426c2,'resourceId':_0x190403['id']}})[_0xc519('0x23')](function(){return _0x58700d;});})[_0xc519('0x23')](function(){_0x14a6a6[_0xc519('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f097b,_0x5964b5){return function(_0x24550d){if(!_0x24550d){_0x2f097b[_0xc519('0x15')](0x194);}return _0x24550d;};}function handleError(_0x4c0f35,_0x363137){_0x363137=_0x363137||0x1f4;return function(_0x3ec57a){logger[_0xc519('0x27')](_0x3ec57a[_0xc519('0x28')]);if(_0x3ec57a[_0xc519('0x29')]){delete _0x3ec57a[_0xc519('0x29')];}_0x4c0f35[_0xc519('0x17')](_0x363137)[_0xc519('0x2a')](_0x3ec57a);};}exports[_0xc519('0x2b')]=function(_0x4fe6c2,_0x3dc05f){var _0x1dfc61={},_0x261c8e={},_0x16429d={'count':0x0,'rows':[]};var _0x596f6a=_[_0xc519('0x2c')](db[_0xc519('0x2d')][_0xc519('0x2e')],function(_0x45c842){return{'name':_0x45c842[_0xc519('0x2f')],'type':_0x45c842[_0xc519('0x30')][_0xc519('0x31')]};});_0x261c8e[_0xc519('0x32')]=_['map'](_0x596f6a,_0xc519('0x29'));_0x261c8e[_0xc519('0x33')]=_[_0xc519('0x34')](_0x4fe6c2[_0xc519('0x33')]);_0x261c8e[_0xc519('0x35')]=_[_0xc519('0x36')](_0x261c8e['model'],_0x261c8e[_0xc519('0x33')]);_0x1dfc61['attributes']=_[_0xc519('0x36')](_0x261c8e[_0xc519('0x32')],qs[_0xc519('0x37')](_0x4fe6c2[_0xc519('0x33')][_0xc519('0x37')]));_0x1dfc61[_0xc519('0x38')]=_0x1dfc61[_0xc519('0x38')][_0xc519('0x39')]?_0x1dfc61[_0xc519('0x38')]:_0x261c8e[_0xc519('0x32')];if(!_0x4fe6c2[_0xc519('0x33')]['hasOwnProperty']('nolimit')){_0x1dfc61[_0xc519('0x1b')]=qs[_0xc519('0x1b')](_0x4fe6c2[_0xc519('0x33')]['limit']);_0x1dfc61[_0xc519('0x19')]=qs[_0xc519('0x19')](_0x4fe6c2[_0xc519('0x33')][_0xc519('0x19')]);}_0x1dfc61[_0xc519('0x3a')]=qs[_0xc519('0x3b')](_0x4fe6c2[_0xc519('0x33')][_0xc519('0x3b')]);delete _0x4fe6c2[_0xc519('0x33')][_0xc519('0x3b')];_0x1dfc61[_0xc519('0x3c')]=qs['filters'](_['pick'](_0x4fe6c2[_0xc519('0x33')],_0x261c8e[_0xc519('0x35')]),_0x596f6a);if(_0x4fe6c2[_0xc519('0x33')][_0xc519('0x3d')]){_0x1dfc61[_0xc519('0x3c')]=_[_0xc519('0x3e')](_0x1dfc61[_0xc519('0x3c')],{'$or':_[_0xc519('0x2c')](_0x596f6a,function(_0x1033dd){if(_0x1033dd[_0xc519('0x30')]!==_0xc519('0x3f')){var _0x67c128={};_0x67c128[_0x1033dd[_0xc519('0x29')]]={'$like':'%'+_0x4fe6c2[_0xc519('0x33')][_0xc519('0x3d')]+'%'};return _0x67c128;}})});}_0x1dfc61=_[_0xc519('0x3e')]({},_0x1dfc61,_0x4fe6c2['options']);var _0x224d7a={'where':_0x1dfc61[_0xc519('0x3c')]};return db[_0xc519('0x2d')][_0xc519('0x1c')](_0x224d7a)['then'](function(_0x48283c){_0x16429d[_0xc519('0x1c')]=_0x48283c;if(_0x4fe6c2['query'][_0xc519('0x40')]){_0x1dfc61[_0xc519('0x41')]=[{'all':!![]}];}return db[_0xc519('0x2d')]['findAll'](_0x1dfc61);})[_0xc519('0x23')](function(_0x5461c5){_0x16429d[_0xc519('0x42')]=_0x5461c5;return _0x16429d;})[_0xc519('0x23')](respondWithFilteredResult(_0x3dc05f,_0x1dfc61))[_0xc519('0x43')](handleError(_0x3dc05f,null));};exports['show']=function(_0xb9bf1a,_0x21ed8e){var _0x3b04aa={'raw':![],'where':{'id':_0xb9bf1a['params']['id']}},_0x33f45d={};_0x33f45d[_0xc519('0x32')]=_['keys'](db[_0xc519('0x2d')][_0xc519('0x2e')]);_0x33f45d[_0xc519('0x33')]=_[_0xc519('0x34')](_0xb9bf1a[_0xc519('0x33')]);_0x33f45d['filters']=_['intersection'](_0x33f45d[_0xc519('0x32')],_0x33f45d[_0xc519('0x33')]);_0x3b04aa[_0xc519('0x38')]=_['intersection'](_0x33f45d['model'],qs[_0xc519('0x37')](_0xb9bf1a[_0xc519('0x33')][_0xc519('0x37')]));_0x3b04aa[_0xc519('0x38')]=_0x3b04aa[_0xc519('0x38')][_0xc519('0x39')]?_0x3b04aa['attributes']:_0x33f45d[_0xc519('0x32')];if(_0xb9bf1a[_0xc519('0x33')][_0xc519('0x40')]){_0x3b04aa['include']=[{'all':!![]}];}_0x3b04aa=_[_0xc519('0x3e')]({},_0x3b04aa,_0xb9bf1a[_0xc519('0x44')]);return db[_0xc519('0x2d')][_0xc519('0x45')](_0x3b04aa)[_0xc519('0x23')](handleEntityNotFound(_0x21ed8e,null))[_0xc519('0x23')](respondWithResult(_0x21ed8e,null))['catch'](handleError(_0x21ed8e,null));};exports[_0xc519('0x22')]=function(_0x3c82d7,_0x5c5b6d){if(_0x3c82d7[_0xc519('0x46')]['id']){delete _0x3c82d7[_0xc519('0x46')]['id'];}return db['VoiceMusicOnHold'][_0xc519('0x45')]({'where':{'id':_0x3c82d7['params']['id']}})['then'](handleEntityNotFound(_0x5c5b6d,null))[_0xc519('0x23')](saveUpdates(_0x3c82d7[_0xc519('0x46')],null))['then'](respondWithResult(_0x5c5b6d,null))[_0xc519('0x43')](handleError(_0x5c5b6d,null));};exports[_0xc519('0x47')]=function(_0x3a1625,_0x10b5f3,_0x6c9612){return db['sequelize'][_0xc519('0x48')](function(_0x4bb10e){if(_0x3a1625['body'][_0xc519('0x49')]===_0xc519('0x4a')){_0x3a1625[_0xc519('0x46')][_0xc519('0x4b')]=path[_0xc519('0x4c')](config['root'],_0xc519('0x4d'),_0x3a1625['body'][_0xc519('0x29')]);}return db[_0xc519('0x2d')][_0xc519('0x47')](_0x3a1625[_0xc519('0x46')],{'transaction':_0x4bb10e})[_0xc519('0x23')](function(_0x43824b){if(_0x3a1625[_0xc519('0x46')][_0xc519('0x49')]==='files'){fs[_0xc519('0x4e')](_0x43824b['directory'],parseInt('0777',0x8));}var _0x5de6b8=_0x3a1625[_0xc519('0x4f')]['get']({'plain':!![]});if(!_0x5de6b8)throw new Error(_0xc519('0x50'));if(_0x5de6b8[_0xc519('0x51')]==='user'){var _0x29ff7d=_0x43824b[_0xc519('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xc519('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x5de6b8[_0xc519('0x52')]},'raw':!![]})['then'](function(_0x4d6708){if(_0x4d6708&&_0x4d6708['autoAssociation']===0x0){return db[_0xc519('0x53')]['create']({'name':_0x29ff7d[_0xc519('0x29')],'resourceId':_0x29ff7d['id'],'type':_0x4d6708[_0xc519('0x29')],'sectionId':_0x4d6708['id']},{})[_0xc519('0x23')](function(){return _0x43824b;});}else{return _0x43824b;}})[_0xc519('0x43')](function(_0x64c1f5){logger[_0xc519('0x27')](_0xc519('0x54'),_0x64c1f5);});}return _0x43824b;});})[_0xc519('0x23')](respondWithResult(_0x10b5f3,0xc9))[_0xc519('0x43')](handleError(_0x10b5f3,null));};exports['destroy']=function(_0x723607,_0x5e95de,_0x41e054){var _0x4eabc8;return db[_0xc519('0x2d')][_0xc519('0x45')]({'where':{'id':_0x723607['params']['id']}})['then'](function(_0x289eec){if(_0x289eec){return db[_0xc519('0x55')][_0xc519('0x48')](function(_0x386c75){return _0x289eec[_0xc519('0x24')]({'transaction':_0x386c75,'raw':!![]})[_0xc519('0x23')](function(_0x3e897a){if(_0x3e897a[_0xc519('0x4b')]){fs[_0xc519('0x56')](_0x3e897a[_0xc519('0x4b')])[_0xc519('0x57')](function(_0x1ab718){fs[_0xc519('0x58')](path['join'](_0x3e897a[_0xc519('0x4b')],_0x1ab718));});fs['rmdirSync'](_0x3e897a[_0xc519('0x4b')]);}return _0x3e897a;});})['catch'](function(_0x385ae5){throw new db['Sequelize'][(_0xc519('0x59'))](_0x385ae5[_0xc519('0x5a')]);});}})[_0xc519('0x23')](handleEntityNotFound(_0x5e95de,null))[_0xc519('0x23')](removeEntity(_0x5e95de,null))[_0xc519('0x43')](handleError(_0x5e95de,null));};exports['addSound']=function(_0x5c5c74,_0x5bd250,_0x15abbc){return db['sequelize']['transaction'](function(_0x30702d){var _0x3b4f69;return db['VoiceMusicOnHold'][_0xc519('0x45')]({'where':{'id':_0x5c5c74['params']['id']}})['then'](function(_0x190649){if(_0x190649){_0x3b4f69=_0x190649;return _0x190649['addSound'](_0x5c5c74[_0xc519('0x46')]['id'],{'transaction':_0x30702d});}})[_0xc519('0x23')](function(_0x32ea2f){if(_0x32ea2f){return db[_0xc519('0x5b')][_0xc519('0x5c')]({'where':{'id':_0x5c5c74[_0xc519('0x46')]['id']},'attributes':['id',_0xc519('0x29'),'save_name',_0xc519('0x5d'),_0xc519('0x5e')],'raw':!![]});}})['then'](function(_0xe98be8){if(_0xe98be8){var _0x1ee1dd=path[_0xc519('0x4c')](config[_0xc519('0x5f')],_0xc519('0x60'),util['format'](_0xc519('0x61'),path[_0xc519('0x62')](_0xe98be8[_0xc519('0x63')],path[_0xc519('0x64')](_0xe98be8[_0xc519('0x63')])),_0xe98be8['converted_format']));var _0x513989=path[_0xc519('0x4c')](config[_0xc519('0x5f')],'server/files/moh',_0x3b4f69['name'],util[_0xc519('0x65')](_0xc519('0x61'),_0xe98be8['name'],_0xe98be8[_0xc519('0x5d')]));fs['symlinkSync'](_0x1ee1dd,_0x513989);return _0xe98be8;}})[_0xc519('0x43')](function(_0x142e82){throw new db['Sequelize']['ValidationError'](_0x142e82[_0xc519('0x5a')]);});})['then'](handleEntityNotFound(_0x5bd250,null))[_0xc519('0x23')](respondWithResult(_0x5bd250,0xc9))['catch'](handleError(_0x5bd250,null));};exports[_0xc519('0x66')]=function(_0x1c0895,_0x1d0bca,_0x1a70f8){return db[_0xc519('0x55')][_0xc519('0x48')](function(_0xc8ff39){var _0xfbd1d9;return db[_0xc519('0x2d')][_0xc519('0x5c')]({'where':{'id':_0x1c0895[_0xc519('0x67')]['id']}})[_0xc519('0x23')](handleEntityNotFound(_0x1d0bca,null))[_0xc519('0x23')](function(_0x581046){if(_0x581046){_0xfbd1d9=_0x581046;return _0x581046['removeSound'](_0x1c0895[_0xc519('0x67')][_0xc519('0x68')]);}})[_0xc519('0x23')](function(_0x15bf5c){if(_0x15bf5c){return db['Sound'][_0xc519('0x5c')]({'where':{'id':_0x1c0895['params']['id2']},'attributes':['id','name',_0xc519('0x63'),_0xc519('0x5d'),_0xc519('0x5e')],'raw':!![]});}})[_0xc519('0x23')](function(_0x42c677){if(_0x42c677){fs['unlinkSync'](path['join'](_0xfbd1d9[_0xc519('0x4b')],util[_0xc519('0x65')]('%s.%s',_0x42c677[_0xc519('0x29')],_0x42c677['converted_format'])));return _0x42c677;}})[_0xc519('0x43')](function(_0x4b1e5a){throw new db[(_0xc519('0x69'))][(_0xc519('0x59'))](_0x4b1e5a[_0xc519('0x5a')]);});})[_0xc519('0x23')](handleEntityNotFound(_0x1d0bca,null))[_0xc519('0x23')](respondWithStatusCode(_0x1d0bca,0xcc))[_0xc519('0x43')](handleError(_0x1d0bca,null));};exports['getSounds']=function(_0x1ab615,_0x185787,_0x4134f9){var _0xe99e09={};var _0x232cd4={};var _0x14cb9d;var _0x3bd762;return db['VoiceMusicOnHold'][_0xc519('0x5c')]({'where':{'id':_0x1ab615[_0xc519('0x67')]['id']}})[_0xc519('0x23')](handleEntityNotFound(_0x185787,null))['then'](function(_0x1f85ce){if(_0x1f85ce){_0x14cb9d=_0x1f85ce;_0x232cd4['model']=_['keys'](db['Sound'][_0xc519('0x2e')]);_0x232cd4[_0xc519('0x33')]=_[_0xc519('0x34')](_0x1ab615[_0xc519('0x33')]);_0x232cd4[_0xc519('0x35')]=_[_0xc519('0x36')](_0x232cd4[_0xc519('0x32')],_0x232cd4[_0xc519('0x33')]);_0xe99e09['attributes']=_[_0xc519('0x36')](_0x232cd4['model'],qs['fields'](_0x1ab615[_0xc519('0x33')][_0xc519('0x37')]));_0xe99e09[_0xc519('0x38')]=_0xe99e09[_0xc519('0x38')][_0xc519('0x39')]?_0xe99e09[_0xc519('0x38')]:_0x232cd4[_0xc519('0x32')];_0xe99e09[_0xc519('0x3a')]=qs[_0xc519('0x3b')](_0x1ab615[_0xc519('0x33')][_0xc519('0x3b')]);_0xe99e09[_0xc519('0x3c')]=qs[_0xc519('0x35')](_[_0xc519('0x6a')](_0x1ab615[_0xc519('0x33')],_0x232cd4['filters']));if(_0x1ab615[_0xc519('0x33')][_0xc519('0x3d')]){_0xe99e09['where']=_['merge'](_0xe99e09['where'],{'$or':_[_0xc519('0x2c')](_0xe99e09[_0xc519('0x38')],function(_0x19eef7){var _0x1381b8={};_0x1381b8[_0x19eef7]={'$like':'%'+_0x1ab615[_0xc519('0x33')][_0xc519('0x3d')]+'%'};return _0x1381b8;})});}_0xe99e09=_[_0xc519('0x3e')]({},_0xe99e09,_0x1ab615[_0xc519('0x44')]);return _0x14cb9d[_0xc519('0x6b')](_0xe99e09);}})[_0xc519('0x23')](function(_0x1b5d95){if(_0x1b5d95){_0x3bd762=_0x1b5d95[_0xc519('0x39')];if(!_0x1ab615['query']['hasOwnProperty']('nolimit')){_0xe99e09[_0xc519('0x1b')]=qs[_0xc519('0x1b')](_0x1ab615[_0xc519('0x33')][_0xc519('0x1b')]);_0xe99e09['offset']=qs['offset'](_0x1ab615[_0xc519('0x33')][_0xc519('0x19')]);}return _0x14cb9d[_0xc519('0x6b')](_0xe99e09);}})['then'](function(_0x53d6d7){if(_0x53d6d7){return _0x53d6d7?{'count':_0x3bd762,'rows':_0x53d6d7}:null;}})['then'](respondWithResult(_0x185787,null))[_0xc519('0x43')](handleError(_0x185787,null));}; \ No newline at end of file +var _0xc848=['findAll','rows','catch','show','params','keys','find','body','directory','join','root','server/files/moh','mode','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','id2','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../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','Content-Range','json','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','index','map','VoiceMusicOnHold','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x176683,_0x168eb1){var _0x41ab61=function(_0x30b18e){while(--_0x30b18e){_0x176683['push'](_0x176683['shift']());}};_0x41ab61(++_0x168eb1);}(_0xc848,0x189));var _0x8c84=function(_0x22ee0a,_0x2dafe7){_0x22ee0a=_0x22ee0a-0x0;var _0x364ded=_0xc848[_0x22ee0a];return _0x364ded;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c84('0x0'));var zipdir=require(_0x8c84('0x1'));var jsonpatch=require(_0x8c84('0x2'));var rp=require(_0x8c84('0x3'));var moment=require(_0x8c84('0x4'));var BPromise=require(_0x8c84('0x5'));var Mustache=require(_0x8c84('0x6'));var util=require(_0x8c84('0x7'));var path=require(_0x8c84('0x8'));var sox=require(_0x8c84('0x9'));var csv=require(_0x8c84('0xa'));var ejs=require(_0x8c84('0xb'));var fs=require('fs');var fs_extra=require(_0x8c84('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8c84('0xd'));var jsforce=require(_0x8c84('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8c84('0xa'));var querystring=require(_0x8c84('0xf'));var Papa=require('papaparse');var Redis=require(_0x8c84('0x10'));var authService=require(_0x8c84('0x11'));var qs=require(_0x8c84('0x12'));var as=require(_0x8c84('0x13'));var hardwareService=require(_0x8c84('0x14'));var logger=require(_0x8c84('0x15'))(_0x8c84('0x16'));var utils=require('../../config/utils');var config=require(_0x8c84('0x17'));var licenseUtil=require(_0x8c84('0x18'));var db=require(_0x8c84('0x19'))['db'];function respondWithStatusCode(_0x4004d0,_0x401672){_0x401672=_0x401672||0xcc;return function(_0x335008){if(_0x335008){return _0x4004d0[_0x8c84('0x1a')](_0x401672);}return _0x4004d0[_0x8c84('0x1b')](_0x401672)[_0x8c84('0x1c')]();};}function respondWithResult(_0x44c9b7,_0x5a68c5){_0x5a68c5=_0x5a68c5||0xc8;return function(_0x182507){if(_0x182507){return _0x44c9b7[_0x8c84('0x1b')](_0x5a68c5)['json'](_0x182507);}};}function respondWithFilteredResult(_0x2bf2fa,_0x399d00){return function(_0x2c16e2){if(_0x2c16e2){var _0x400683=typeof _0x399d00[_0x8c84('0x1d')]===_0x8c84('0x1e')&&typeof _0x399d00['limit']===_0x8c84('0x1e');var _0x1213fb=_0x2c16e2[_0x8c84('0x1f')];var _0x4ad191=_0x400683?0x0:_0x399d00[_0x8c84('0x1d')];var _0x17f45b=_0x400683?_0x2c16e2[_0x8c84('0x1f')]:_0x399d00[_0x8c84('0x1d')]+_0x399d00[_0x8c84('0x20')];var _0x4c5f03;if(_0x17f45b>=_0x1213fb){_0x17f45b=_0x1213fb;_0x4c5f03=0xc8;}else{_0x4c5f03=0xce;}_0x2bf2fa[_0x8c84('0x1b')](_0x4c5f03);return _0x2bf2fa[_0x8c84('0x21')](_0x8c84('0x22'),_0x4ad191+'-'+_0x17f45b+'/'+_0x1213fb)[_0x8c84('0x23')](_0x2c16e2);}return null;};}function patchUpdates(_0x1644c5){return function(_0x51b693){try{jsonpatch[_0x8c84('0x24')](_0x51b693,_0x1644c5,!![]);}catch(_0x4d0350){return BPromise[_0x8c84('0x25')](_0x4d0350);}return _0x51b693['save']();};}function saveUpdates(_0x518267,_0x1f4dcc){return function(_0x42fc90){if(_0x42fc90){return _0x42fc90[_0x8c84('0x26')](_0x518267)[_0x8c84('0x27')](function(_0x12b349){return _0x12b349;});}return null;};}function removeEntity(_0x48c59e,_0x37995c){return function(_0x14c297){if(_0x14c297){return _0x14c297['destroy']()['then'](function(){var _0x3afa10=_0x14c297[_0x8c84('0x28')]({'plain':!![]});var _0x5edc60=_0x8c84('0x29');return db[_0x8c84('0x2a')][_0x8c84('0x2b')]({'where':{'type':_0x5edc60,'resourceId':_0x3afa10['id']}})[_0x8c84('0x27')](function(){return _0x14c297;});})['then'](function(){_0x48c59e[_0x8c84('0x1b')](0xcc)[_0x8c84('0x1c')]();});}};}function handleEntityNotFound(_0x4873d2,_0xc2f42a){return function(_0x561541){if(!_0x561541){_0x4873d2[_0x8c84('0x1a')](0x194);}return _0x561541;};}function handleError(_0x41b344,_0x2009b0){_0x2009b0=_0x2009b0||0x1f4;return function(_0x3e6045){logger['error'](_0x3e6045[_0x8c84('0x2c')]);if(_0x3e6045['name']){delete _0x3e6045[_0x8c84('0x2d')];}_0x41b344[_0x8c84('0x1b')](_0x2009b0)['send'](_0x3e6045);};}exports[_0x8c84('0x2e')]=function(_0x1af2e7,_0xc56672){var _0x13588f={},_0x1722c4={},_0x41dd37={'count':0x0,'rows':[]};var _0x23a9f8=_[_0x8c84('0x2f')](db[_0x8c84('0x30')][_0x8c84('0x31')],function(_0x5e5ac8){return{'name':_0x5e5ac8['fieldName'],'type':_0x5e5ac8[_0x8c84('0x32')][_0x8c84('0x33')]};});_0x1722c4['model']=_[_0x8c84('0x2f')](_0x23a9f8,_0x8c84('0x2d'));_0x1722c4[_0x8c84('0x34')]=_['keys'](_0x1af2e7[_0x8c84('0x34')]);_0x1722c4['filters']=_[_0x8c84('0x35')](_0x1722c4[_0x8c84('0x36')],_0x1722c4[_0x8c84('0x34')]);_0x13588f[_0x8c84('0x37')]=_[_0x8c84('0x35')](_0x1722c4['model'],qs['fields'](_0x1af2e7[_0x8c84('0x34')][_0x8c84('0x38')]));_0x13588f[_0x8c84('0x37')]=_0x13588f[_0x8c84('0x37')][_0x8c84('0x39')]?_0x13588f[_0x8c84('0x37')]:_0x1722c4[_0x8c84('0x36')];if(!_0x1af2e7[_0x8c84('0x34')][_0x8c84('0x3a')](_0x8c84('0x3b'))){_0x13588f[_0x8c84('0x20')]=qs[_0x8c84('0x20')](_0x1af2e7[_0x8c84('0x34')][_0x8c84('0x20')]);_0x13588f[_0x8c84('0x1d')]=qs['offset'](_0x1af2e7['query'][_0x8c84('0x1d')]);}_0x13588f[_0x8c84('0x3c')]=qs[_0x8c84('0x3d')](_0x1af2e7['query'][_0x8c84('0x3d')]);delete _0x1af2e7[_0x8c84('0x34')]['sort'];_0x13588f[_0x8c84('0x3e')]=qs[_0x8c84('0x3f')](_[_0x8c84('0x40')](_0x1af2e7[_0x8c84('0x34')],_0x1722c4['filters']),_0x23a9f8);if(_0x1af2e7[_0x8c84('0x34')][_0x8c84('0x41')]){_0x13588f['where']=_['merge'](_0x13588f[_0x8c84('0x3e')],{'$or':_[_0x8c84('0x2f')](_0x23a9f8,function(_0x5e58a8){if(_0x5e58a8[_0x8c84('0x32')]!==_0x8c84('0x42')){var _0x337fa2={};_0x337fa2[_0x5e58a8[_0x8c84('0x2d')]]={'$like':'%'+_0x1af2e7[_0x8c84('0x34')][_0x8c84('0x41')]+'%'};return _0x337fa2;}})});}_0x13588f=_[_0x8c84('0x43')]({},_0x13588f,_0x1af2e7[_0x8c84('0x44')]);var _0x4dedbc={'where':_0x13588f['where']};return db[_0x8c84('0x30')][_0x8c84('0x1f')](_0x4dedbc)[_0x8c84('0x27')](function(_0x462104){_0x41dd37[_0x8c84('0x1f')]=_0x462104;if(_0x1af2e7[_0x8c84('0x34')][_0x8c84('0x45')]){_0x13588f[_0x8c84('0x46')]=[{'all':!![]}];}return db[_0x8c84('0x30')][_0x8c84('0x47')](_0x13588f);})[_0x8c84('0x27')](function(_0x490051){_0x41dd37[_0x8c84('0x48')]=_0x490051;return _0x41dd37;})[_0x8c84('0x27')](respondWithFilteredResult(_0xc56672,_0x13588f))[_0x8c84('0x49')](handleError(_0xc56672,null));};exports[_0x8c84('0x4a')]=function(_0x4b9a7d,_0x42ec2f){var _0xad2538={'raw':![],'where':{'id':_0x4b9a7d[_0x8c84('0x4b')]['id']}},_0x16b7cc={};_0x16b7cc[_0x8c84('0x36')]=_['keys'](db[_0x8c84('0x30')][_0x8c84('0x31')]);_0x16b7cc[_0x8c84('0x34')]=_[_0x8c84('0x4c')](_0x4b9a7d['query']);_0x16b7cc[_0x8c84('0x3f')]=_[_0x8c84('0x35')](_0x16b7cc['model'],_0x16b7cc[_0x8c84('0x34')]);_0xad2538[_0x8c84('0x37')]=_[_0x8c84('0x35')](_0x16b7cc[_0x8c84('0x36')],qs[_0x8c84('0x38')](_0x4b9a7d['query']['fields']));_0xad2538['attributes']=_0xad2538[_0x8c84('0x37')][_0x8c84('0x39')]?_0xad2538[_0x8c84('0x37')]:_0x16b7cc[_0x8c84('0x36')];if(_0x4b9a7d[_0x8c84('0x34')][_0x8c84('0x45')]){_0xad2538[_0x8c84('0x46')]=[{'all':!![]}];}_0xad2538=_[_0x8c84('0x43')]({},_0xad2538,_0x4b9a7d['options']);return db['VoiceMusicOnHold'][_0x8c84('0x4d')](_0xad2538)['then'](handleEntityNotFound(_0x42ec2f,null))[_0x8c84('0x27')](respondWithResult(_0x42ec2f,null))[_0x8c84('0x49')](handleError(_0x42ec2f,null));};exports[_0x8c84('0x26')]=function(_0x2e1bc5,_0x3201e2){if(_0x2e1bc5[_0x8c84('0x4e')]['id']){delete _0x2e1bc5[_0x8c84('0x4e')]['id'];}return db[_0x8c84('0x30')][_0x8c84('0x4d')]({'where':{'id':_0x2e1bc5[_0x8c84('0x4b')]['id']}})[_0x8c84('0x27')](handleEntityNotFound(_0x3201e2,null))[_0x8c84('0x27')](saveUpdates(_0x2e1bc5[_0x8c84('0x4e')],null))[_0x8c84('0x27')](respondWithResult(_0x3201e2,null))[_0x8c84('0x49')](handleError(_0x3201e2,null));};exports['create']=function(_0x230125,_0x3dd8f9,_0x2ad7b0){return db['sequelize']['transaction'](function(_0x5bb487){if(_0x230125['body']['mode']==='files'){_0x230125[_0x8c84('0x4e')][_0x8c84('0x4f')]=path[_0x8c84('0x50')](config[_0x8c84('0x51')],_0x8c84('0x52'),_0x230125[_0x8c84('0x4e')][_0x8c84('0x2d')]);}return db[_0x8c84('0x30')]['create'](_0x230125['body'],{'transaction':_0x5bb487})[_0x8c84('0x27')](function(_0x3fc267){if(_0x230125[_0x8c84('0x4e')][_0x8c84('0x53')]===_0x8c84('0x54')){fs[_0x8c84('0x55')](_0x3fc267['directory'],parseInt(_0x8c84('0x56'),0x8));}var _0x13bb80=_0x230125[_0x8c84('0x57')][_0x8c84('0x28')]({'plain':!![]});if(!_0x13bb80)throw new Error(_0x8c84('0x58'));if(_0x13bb80[_0x8c84('0x59')]===_0x8c84('0x57')){var _0x451aa9=_0x3fc267[_0x8c84('0x28')]({'plain':!![]});return db[_0x8c84('0x5a')][_0x8c84('0x4d')]({'where':{'name':'MusicOnHolds','userProfileId':_0x13bb80[_0x8c84('0x5b')]},'raw':!![]})[_0x8c84('0x27')](function(_0x18c752){if(_0x18c752&&_0x18c752['autoAssociation']===0x0){return db['UserProfileResource'][_0x8c84('0x5c')]({'name':_0x451aa9[_0x8c84('0x2d')],'resourceId':_0x451aa9['id'],'type':_0x18c752['name'],'sectionId':_0x18c752['id']},{})[_0x8c84('0x27')](function(){return _0x3fc267;});}else{return _0x3fc267;}})[_0x8c84('0x49')](function(_0x54c304){logger[_0x8c84('0x5d')](_0x8c84('0x5e'),_0x54c304);});}return _0x3fc267;});})[_0x8c84('0x27')](respondWithResult(_0x3dd8f9,0xc9))[_0x8c84('0x49')](handleError(_0x3dd8f9,null));};exports[_0x8c84('0x2b')]=function(_0x5d5dc1,_0x4d7357,_0x21da83){var _0x145ab2;return db['VoiceMusicOnHold'][_0x8c84('0x4d')]({'where':{'id':_0x5d5dc1['params']['id']}})['then'](function(_0x42244b){if(_0x42244b){return db[_0x8c84('0x5f')][_0x8c84('0x60')](function(_0x390cbb){return _0x42244b[_0x8c84('0x2b')]({'transaction':_0x390cbb,'raw':!![]})[_0x8c84('0x27')](function(_0x3689b6){if(_0x3689b6[_0x8c84('0x4f')]){fs[_0x8c84('0x61')](_0x3689b6['directory'])[_0x8c84('0x62')](function(_0x3564aa){fs[_0x8c84('0x63')](path[_0x8c84('0x50')](_0x3689b6[_0x8c84('0x4f')],_0x3564aa));});fs[_0x8c84('0x64')](_0x3689b6[_0x8c84('0x4f')]);}return _0x3689b6;});})[_0x8c84('0x49')](function(_0x17291d){throw new db[(_0x8c84('0x65'))][(_0x8c84('0x66'))](_0x17291d['message']);});}})[_0x8c84('0x27')](handleEntityNotFound(_0x4d7357,null))['then'](removeEntity(_0x4d7357,null))[_0x8c84('0x49')](handleError(_0x4d7357,null));};exports[_0x8c84('0x67')]=function(_0x11075a,_0x30148e,_0x404cb1){return db[_0x8c84('0x5f')]['transaction'](function(_0x268c83){var _0x495da4;return db[_0x8c84('0x30')]['find']({'where':{'id':_0x11075a[_0x8c84('0x4b')]['id']}})[_0x8c84('0x27')](function(_0x173c10){if(_0x173c10){_0x495da4=_0x173c10;return _0x173c10[_0x8c84('0x67')](_0x11075a[_0x8c84('0x4e')]['id'],{'transaction':_0x268c83});}})[_0x8c84('0x27')](function(_0x10096c){if(_0x10096c){return db['Sound'][_0x8c84('0x68')]({'where':{'id':_0x11075a[_0x8c84('0x4e')]['id']},'attributes':['id',_0x8c84('0x2d'),'save_name',_0x8c84('0x69'),_0x8c84('0x6a')],'raw':!![]});}})[_0x8c84('0x27')](function(_0x5e8407){if(_0x5e8407){var _0xd5523b=path[_0x8c84('0x50')](config['root'],'server/files/sounds/converted',util[_0x8c84('0x6b')](_0x8c84('0x6c'),path[_0x8c84('0x6d')](_0x5e8407[_0x8c84('0x6e')],path[_0x8c84('0x6f')](_0x5e8407[_0x8c84('0x6e')])),_0x5e8407[_0x8c84('0x69')]));var _0x3afb92=path[_0x8c84('0x50')](config[_0x8c84('0x51')],_0x8c84('0x52'),_0x495da4['name'],util[_0x8c84('0x6b')](_0x8c84('0x6c'),_0x5e8407[_0x8c84('0x2d')],_0x5e8407['converted_format']));fs[_0x8c84('0x70')](_0xd5523b,_0x3afb92);return _0x5e8407;}})[_0x8c84('0x49')](function(_0x154431){throw new db[(_0x8c84('0x65'))]['ValidationError'](_0x154431['message']);});})[_0x8c84('0x27')](handleEntityNotFound(_0x30148e,null))[_0x8c84('0x27')](respondWithResult(_0x30148e,0xc9))['catch'](handleError(_0x30148e,null));};exports[_0x8c84('0x71')]=function(_0x4d47b2,_0x2e5b73,_0x31094b){return db[_0x8c84('0x5f')][_0x8c84('0x60')](function(_0x3aad1a){var _0x2093a1;return db[_0x8c84('0x30')][_0x8c84('0x68')]({'where':{'id':_0x4d47b2['params']['id']}})[_0x8c84('0x27')](handleEntityNotFound(_0x2e5b73,null))[_0x8c84('0x27')](function(_0x314671){if(_0x314671){_0x2093a1=_0x314671;return _0x314671[_0x8c84('0x71')](_0x4d47b2[_0x8c84('0x4b')]['id2']);}})[_0x8c84('0x27')](function(_0x3e5293){if(_0x3e5293){return db['Sound'][_0x8c84('0x68')]({'where':{'id':_0x4d47b2[_0x8c84('0x4b')][_0x8c84('0x72')]},'attributes':['id',_0x8c84('0x2d'),'save_name',_0x8c84('0x69'),_0x8c84('0x6a')],'raw':!![]});}})[_0x8c84('0x27')](function(_0x5689b9){if(_0x5689b9){fs[_0x8c84('0x63')](path[_0x8c84('0x50')](_0x2093a1[_0x8c84('0x4f')],util[_0x8c84('0x6b')](_0x8c84('0x6c'),_0x5689b9[_0x8c84('0x2d')],_0x5689b9[_0x8c84('0x69')])));return _0x5689b9;}})[_0x8c84('0x49')](function(_0x5272bd){throw new db['Sequelize'][(_0x8c84('0x66'))](_0x5272bd['message']);});})[_0x8c84('0x27')](handleEntityNotFound(_0x2e5b73,null))[_0x8c84('0x27')](respondWithStatusCode(_0x2e5b73,0xcc))[_0x8c84('0x49')](handleError(_0x2e5b73,null));};exports['getSounds']=function(_0x116355,_0x5f3c33,_0x35e439){var _0x43d888={};var _0x3d6c87={};var _0x25e1a2;var _0x4c67df;return db[_0x8c84('0x30')][_0x8c84('0x68')]({'where':{'id':_0x116355[_0x8c84('0x4b')]['id']}})[_0x8c84('0x27')](handleEntityNotFound(_0x5f3c33,null))[_0x8c84('0x27')](function(_0x2b0469){if(_0x2b0469){_0x25e1a2=_0x2b0469;_0x3d6c87[_0x8c84('0x36')]=_[_0x8c84('0x4c')](db['Sound'][_0x8c84('0x31')]);_0x3d6c87[_0x8c84('0x34')]=_[_0x8c84('0x4c')](_0x116355['query']);_0x3d6c87[_0x8c84('0x3f')]=_[_0x8c84('0x35')](_0x3d6c87[_0x8c84('0x36')],_0x3d6c87[_0x8c84('0x34')]);_0x43d888[_0x8c84('0x37')]=_['intersection'](_0x3d6c87['model'],qs[_0x8c84('0x38')](_0x116355[_0x8c84('0x34')][_0x8c84('0x38')]));_0x43d888[_0x8c84('0x37')]=_0x43d888[_0x8c84('0x37')][_0x8c84('0x39')]?_0x43d888[_0x8c84('0x37')]:_0x3d6c87[_0x8c84('0x36')];_0x43d888['order']=qs[_0x8c84('0x3d')](_0x116355[_0x8c84('0x34')][_0x8c84('0x3d')]);_0x43d888['where']=qs[_0x8c84('0x3f')](_[_0x8c84('0x40')](_0x116355['query'],_0x3d6c87[_0x8c84('0x3f')]));if(_0x116355['query'][_0x8c84('0x41')]){_0x43d888[_0x8c84('0x3e')]=_[_0x8c84('0x43')](_0x43d888[_0x8c84('0x3e')],{'$or':_['map'](_0x43d888['attributes'],function(_0xf6108f){var _0x138349={};_0x138349[_0xf6108f]={'$like':'%'+_0x116355[_0x8c84('0x34')][_0x8c84('0x41')]+'%'};return _0x138349;})});}_0x43d888=_[_0x8c84('0x43')]({},_0x43d888,_0x116355[_0x8c84('0x44')]);return _0x25e1a2[_0x8c84('0x73')](_0x43d888);}})[_0x8c84('0x27')](function(_0x59a2ad){if(_0x59a2ad){_0x4c67df=_0x59a2ad[_0x8c84('0x39')];if(!_0x116355[_0x8c84('0x34')][_0x8c84('0x3a')](_0x8c84('0x3b'))){_0x43d888[_0x8c84('0x20')]=qs[_0x8c84('0x20')](_0x116355['query'][_0x8c84('0x20')]);_0x43d888[_0x8c84('0x1d')]=qs[_0x8c84('0x1d')](_0x116355[_0x8c84('0x34')][_0x8c84('0x1d')]);}return _0x25e1a2[_0x8c84('0x73')](_0x43d888);}})[_0x8c84('0x27')](function(_0x2b30cd){if(_0x2b30cd){return _0x2b30cd?{'count':_0x4c67df,'rows':_0x2b30cd}:null;}})[_0x8c84('0x27')](respondWithResult(_0x5f3c33,null))[_0x8c84('0x49')](handleError(_0x5f3c33,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ab3a5da..e50146d 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 _0x583e=['api','moment','request-promise','path','../../config/environment','define','voice_musiconhold','lodash','../../config/logger'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x583e,0xdf));var _0xe583=function(_0x3f4328,_0x389f8f){_0x3f4328=_0x3f4328-0x0;var _0x2df80a=_0x583e[_0x3f4328];return _0x2df80a;};'use strict';var _=require(_0xe583('0x0'));var util=require('util');var logger=require(_0xe583('0x1'))(_0xe583('0x2'));var moment=require(_0xe583('0x3'));var BPromise=require('bluebird');var rp=require(_0xe583('0x4'));var fs=require('fs');var path=require(_0xe583('0x5'));var rimraf=require('rimraf');var config=require(_0xe583('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x53a148,_0x39e54f){return _0x53a148[_0xe583('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0xe583('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a5c=['api','moment','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','../../config/logger'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x1a5c,0x134));var _0xc1a5=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x1a5c[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0xc1a5('0x0'));var util=require('util');var logger=require(_0xc1a5('0x1'))(_0xc1a5('0x2'));var moment=require(_0xc1a5('0x3'));var BPromise=require(_0xc1a5('0x4'));var rp=require(_0xc1a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc1a5('0x6'));var attributes=require(_0xc1a5('0x7'));module['exports']=function(_0x3d04f8,_0x25575b){return _0x3d04f8[_0xc1a5('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xc1a5('0x9'),'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 a6ecaab..ff06e30 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x939736,_0x4c1710){var _0x2b140a=function(_0x436d2a){while(--_0x436d2a){_0x939736['push'](_0x939736['shift']());}};_0x2b140a(++_0x4c1710);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 _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(_0x450db6,_0x5926a6){var _0xd9c4f8=function(_0x54f7ef){while(--_0x54f7ef){_0x450db6['push'](_0x450db6['shift']());}};_0xd9c4f8(++_0x5926a6);}(_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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 85c6b51..673735b 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 _0x2029=['addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x23d957,_0x5d2176){var _0x568ff2=function(_0x6ad689){while(--_0x6ad689){_0x23d957['push'](_0x23d957['shift']());}};_0x568ff2(++_0x5d2176);}(_0x2029,0x171));var _0x9202=function(_0x57eef6,_0x5551ef){_0x57eef6=_0x57eef6-0x0;var _0x4bc946=_0x2029[_0x57eef6];return _0x4bc946;};'use strict';var multer=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var path=require('path');var timeout=require(_0x9202('0x2'));var express=require(_0x9202('0x3'));var router=express[_0x9202('0x4')]();var fs_extra=require(_0x9202('0x5'));var auth=require(_0x9202('0x6'));var interaction=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var controller=require(_0x9202('0x9'));router[_0x9202('0xa')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0xc')]);router[_0x9202('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9202('0xd')]);router['get'](_0x9202('0xe'),auth[_0x9202('0xb')](),controller['show']);router[_0x9202('0xa')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x10')]);router[_0x9202('0xa')](_0x9202('0x11'),auth[_0x9202('0xb')](),controller[_0x9202('0x12')]);router[_0x9202('0x13')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0x14')]);router[_0x9202('0x13')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x15')]);router[_0x9202('0x13')](_0x9202('0x11'),auth['isAuthenticated'](),controller[_0x9202('0x16')]);router[_0x9202('0x17')](_0x9202('0xe'),auth[_0x9202('0xb')](),controller[_0x9202('0x18')]);router[_0x9202('0x19')](_0x9202('0xe'),auth[_0x9202('0xb')](),controller[_0x9202('0x1a')]);router[_0x9202('0x19')]('/:id/users',auth[_0x9202('0xb')](),controller[_0x9202('0x1b')]);router[_0x9202('0x19')](_0x9202('0x11'),auth[_0x9202('0xb')](),controller[_0x9202('0x1c')]);module[_0x9202('0x1d')]=router; \ No newline at end of file +var _0x2f74=['/:id','show','/:id/teams','getTeams','post','/:id/users','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x2283fc,_0xa206f9){var _0x4e6f2c=function(_0x1a44d3){while(--_0x1a44d3){_0x2283fc['push'](_0x2283fc['shift']());}};_0x4e6f2c(++_0xa206f9);}(_0x2f74,0xb7));var _0x42f7=function(_0x47fa10,_0x39b01c){_0x47fa10=_0x47fa10-0x0;var _0x204f30=_0x2f74[_0x47fa10];return _0x204f30;};'use strict';var multer=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var path=require(_0x42f7('0x2'));var timeout=require(_0x42f7('0x3'));var express=require(_0x42f7('0x4'));var router=express['Router']();var fs_extra=require(_0x42f7('0x5'));var auth=require(_0x42f7('0x6'));var interaction=require(_0x42f7('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x42f7('0x8')]('/',auth[_0x42f7('0x9')](),controller[_0x42f7('0xa')]);router[_0x42f7('0x8')](_0x42f7('0xb'),auth['isAuthenticated'](),controller[_0x42f7('0xc')]);router[_0x42f7('0x8')](_0x42f7('0xd'),auth[_0x42f7('0x9')](),controller[_0x42f7('0xe')]);router[_0x42f7('0x8')]('/:id/users',auth[_0x42f7('0x9')](),controller['getAgents']);router[_0x42f7('0x8')](_0x42f7('0xf'),auth[_0x42f7('0x9')](),controller[_0x42f7('0x10')]);router[_0x42f7('0x11')]('/',auth[_0x42f7('0x9')](),controller['create']);router[_0x42f7('0x11')](_0x42f7('0x12'),auth[_0x42f7('0x9')](),controller[_0x42f7('0x13')]);router['post'](_0x42f7('0xf'),auth[_0x42f7('0x9')](),controller[_0x42f7('0x14')]);router[_0x42f7('0x15')](_0x42f7('0xd'),auth[_0x42f7('0x9')](),controller[_0x42f7('0x16')]);router[_0x42f7('0x17')](_0x42f7('0xd'),auth[_0x42f7('0x9')](),controller[_0x42f7('0x18')]);router[_0x42f7('0x17')](_0x42f7('0x12'),auth['isAuthenticated'](),controller[_0x42f7('0x19')]);router[_0x42f7('0x17')](_0x42f7('0xf'),auth[_0x42f7('0x9')](),controller[_0x42f7('0x1a')]);module[_0x42f7('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 168f4f7..c7c8d28 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 _0x7886=['exports','STRING','name','VIRTUAL','INTEGER'];(function(_0x2f4fbe,_0x238fc2){var _0x5f0a7e=function(_0x13b94a){while(--_0x13b94a){_0x2f4fbe['push'](_0x2f4fbe['shift']());}};_0x5f0a7e(++_0x238fc2);}(_0x7886,0x1a9));var _0x6788=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x7886[_0x5cc3d4];return _0x17ca31;};'use strict';var Sequelize=require('sequelize');module[_0x6788('0x0')]={'name':{'type':Sequelize[_0x6788('0x1')],'allowNull':![],'unique':_0x6788('0x2')},'prefix':{'type':Sequelize[_0x6788('0x3')],'get':function(_0x3cc2b4){return'system-'+this['getDataValue'](_0x6788('0x2'))+'-';}},'description':{'type':Sequelize[_0x6788('0x1')]},'callerIdAll':{'type':Sequelize[_0x6788('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x6788('0x4')]}}; \ No newline at end of file +var _0x5ab0=['exports','STRING','VIRTUAL','system-','getDataValue','name','INTEGER'];(function(_0x53874a,_0x283758){var _0x55cb64=function(_0x358d9a){while(--_0x358d9a){_0x53874a['push'](_0x53874a['shift']());}};_0x55cb64(++_0x283758);}(_0x5ab0,0xcb));var _0x05ab=function(_0x259abc,_0x4cbe72){_0x259abc=_0x259abc-0x0;var _0x41781a=_0x5ab0[_0x259abc];return _0x41781a;};'use strict';var Sequelize=require('sequelize');module[_0x05ab('0x0')]={'name':{'type':Sequelize[_0x05ab('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x05ab('0x2')],'get':function(_0x3072c9){return _0x05ab('0x3')+this[_0x05ab('0x4')](_0x05ab('0x5'))+'-';}},'description':{'type':Sequelize[_0x05ab('0x1')]},'callerIdAll':{'type':Sequelize[_0x05ab('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x05ab('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1f909c5..b6585e4 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 _0x1a85=['UserProfileSection','userProfileId','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','getTeams','Team','Agents','online','voicePause','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','forEach','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','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','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','describe','create','sequelize','transaction','body','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x476c06,_0x158a4f){var _0x54240a=function(_0x406665){while(--_0x406665){_0x476c06['push'](_0x476c06['shift']());}};_0x54240a(++_0x158a4f);}(_0x1a85,0x178));var _0x51a8=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0x1a85[_0x59145a];return _0xf04d7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=typeof _0x1c2f25[_0x51a8('0x20')]===_0x51a8('0x21')&&typeof _0x1c2f25[_0x51a8('0x22')]==='undefined';var _0x1df8c2=_0x45a433[_0x51a8('0x23')];var _0x2217ce=_0xd52230?0x0:_0x1c2f25[_0x51a8('0x20')];var _0x2a4c4c=_0xd52230?_0x45a433[_0x51a8('0x23')]:_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x22')];var _0x5ac1c0;if(_0x2a4c4c>=_0x1df8c2){_0x2a4c4c=_0x1df8c2;_0x5ac1c0=0xc8;}else{_0x5ac1c0=0xce;}_0x516abc[_0x51a8('0x1d')](_0x5ac1c0);return _0x516abc['set'](_0x51a8('0x24'),_0x2217ce+'-'+_0x2a4c4c+'/'+_0x1df8c2)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x8bda40){return function(_0x3759d6){try{jsonpatch['apply'](_0x3759d6,_0x8bda40,!![]);}catch(_0xae3588){return BPromise['reject'](_0xae3588);}return _0x3759d6['save']();};}function saveUpdates(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x25')](_0x23d26a)[_0x51a8('0x26')](function(_0x18e2f3){return _0x18e2f3;});}return null;};}function removeEntity(_0x157554,_0x2f2f05){return function(_0x291ed6){if(_0x291ed6){return _0x291ed6[_0x51a8('0x27')]()['then'](function(){var _0x273ce2=_0x291ed6[_0x51a8('0x28')]({'plain':!![]});var _0xca5746=_0x51a8('0x29');return db[_0x51a8('0x2a')][_0x51a8('0x27')]({'where':{'type':_0xca5746,'resourceId':_0x273ce2['id']}})[_0x51a8('0x26')](function(){return _0x291ed6;});})[_0x51a8('0x26')](function(){_0x157554[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x20c6b5,_0x347a02){return function(_0x4a1548){if(!_0x4a1548){_0x20c6b5[_0x51a8('0x2b')](0x194);}return _0x4a1548;};}function handleError(_0x58cba0,_0x276424){_0x276424=_0x276424||0x1f4;return function(_0x3bc19a){logger[_0x51a8('0x2c')](_0x3bc19a[_0x51a8('0x2d')]);if(_0x3bc19a[_0x51a8('0x2e')]){delete _0x3bc19a['name'];}_0x58cba0[_0x51a8('0x1d')](_0x276424)['send'](_0x3bc19a);};}exports[_0x51a8('0x2f')]=function(_0x24b39a,_0x253a59){var _0x4b19c8={},_0x2080a1={},_0x499a43={'count':0x0,'rows':[]};var _0x25a858=_[_0x51a8('0x30')](db[_0x51a8('0x31')][_0x51a8('0x32')],function(_0x193e0f){return{'name':_0x193e0f['fieldName'],'type':_0x193e0f[_0x51a8('0x33')]['key']};});_0x2080a1[_0x51a8('0x34')]=_[_0x51a8('0x30')](_0x25a858,_0x51a8('0x2e'));_0x2080a1['query']=_[_0x51a8('0x35')](_0x24b39a[_0x51a8('0x36')]);_0x2080a1[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x2080a1[_0x51a8('0x34')],_0x2080a1['query']);_0x4b19c8['attributes']=_['intersection'](_0x2080a1[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x24b39a['query'][_0x51a8('0x39')]));_0x4b19c8['attributes']=_0x4b19c8[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x4b19c8[_0x51a8('0x3a')]:_0x2080a1[_0x51a8('0x34')];if(!_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x4b19c8['limit']=qs[_0x51a8('0x22')](_0x24b39a['query']['limit']);_0x4b19c8['offset']=qs[_0x51a8('0x20')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x20')]);}_0x4b19c8['order']=qs[_0x51a8('0x3d')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x4b19c8[_0x51a8('0x3e')]=qs['filters'](_[_0x51a8('0x3f')](_0x24b39a[_0x51a8('0x36')],_0x2080a1[_0x51a8('0x37')]),_0x25a858);if(_0x24b39a['query'][_0x51a8('0x40')]){_0x4b19c8['where']=_[_0x51a8('0x41')](_0x4b19c8[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x25a858,function(_0x37d50b){if(_0x37d50b['type']!==_0x51a8('0x42')){var _0x3da2cf={};_0x3da2cf[_0x37d50b[_0x51a8('0x2e')]]={'$like':'%'+_0x24b39a[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x3da2cf;}})});}_0x4b19c8=_[_0x51a8('0x41')]({},_0x4b19c8,_0x24b39a[_0x51a8('0x43')]);var _0x1cdec6={'where':_0x4b19c8[_0x51a8('0x3e')]};return db['VoicePrefix'][_0x51a8('0x23')](_0x1cdec6)[_0x51a8('0x26')](function(_0x4c7c67){_0x499a43['count']=_0x4c7c67;if(_0x24b39a[_0x51a8('0x36')][_0x51a8('0x44')]){_0x4b19c8[_0x51a8('0x45')]=[{'all':!![]}];}return db[_0x51a8('0x31')][_0x51a8('0x46')](_0x4b19c8);})[_0x51a8('0x26')](function(_0x28f5b3){_0x499a43[_0x51a8('0x47')]=_0x28f5b3;return _0x499a43;})[_0x51a8('0x26')](respondWithFilteredResult(_0x253a59,_0x4b19c8))[_0x51a8('0x48')](handleError(_0x253a59,null));};exports['show']=function(_0x416988,_0x218ae0){var _0x190d52={'raw':![],'where':{'id':_0x416988[_0x51a8('0x49')]['id']}},_0x444b0b={};_0x444b0b[_0x51a8('0x34')]=_['keys'](db[_0x51a8('0x31')]['rawAttributes']);_0x444b0b[_0x51a8('0x36')]=_[_0x51a8('0x35')](_0x416988[_0x51a8('0x36')]);_0x444b0b[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x444b0b['model'],_0x444b0b['query']);_0x190d52[_0x51a8('0x3a')]=_[_0x51a8('0x38')](_0x444b0b[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x416988[_0x51a8('0x36')]['fields']));_0x190d52['attributes']=_0x190d52[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x190d52[_0x51a8('0x3a')]:_0x444b0b[_0x51a8('0x34')];if(_0x416988[_0x51a8('0x36')][_0x51a8('0x44')]){_0x190d52[_0x51a8('0x45')]=[{'all':!![]}];}_0x190d52=_[_0x51a8('0x41')]({},_0x190d52,_0x416988[_0x51a8('0x43')]);return db['VoicePrefix']['find'](_0x190d52)['then'](handleEntityNotFound(_0x218ae0,null))[_0x51a8('0x26')](respondWithResult(_0x218ae0,null))[_0x51a8('0x48')](handleError(_0x218ae0,null));};exports[_0x51a8('0x27')]=function(_0x5259f3,_0x3bd492){return db[_0x51a8('0x31')]['find']({'where':{'id':_0x5259f3[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bd492,null))['then'](removeEntity(_0x3bd492,null))[_0x51a8('0x48')](handleError(_0x3bd492,null));};exports[_0x51a8('0x4a')]=function(_0x41dd1f,_0x56d7f1){return db['VoicePrefix'][_0x51a8('0x4a')]()['then'](respondWithResult(_0x56d7f1,null))[_0x51a8('0x48')](handleError(_0x56d7f1,null));};exports[_0x51a8('0x4b')]=function(_0x3623d4,_0x1ace5b){var _0xee9bee;return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x406a87){return db[_0x51a8('0x31')]['create'](_0x3623d4[_0x51a8('0x4e')],{'transaction':_0x406a87})[_0x51a8('0x26')](function(_0x823d14){_0xee9bee=_0x823d14[_0x51a8('0x28')]({'plain':!![]});return db['VoiceExtension'][_0x51a8('0x4f')]({'where':{'id':_0xee9bee['VoiceExtensionId']},'raw':!![]})[_0x51a8('0x26')](function(_0x252c20){return createVoicePrefixExtensions(_0xee9bee,_0x252c20,_0x406a87);});});})['then'](function(){var _0x56dd7a=_0x3623d4[_0x51a8('0x50')][_0x51a8('0x28')]({'plain':!![]});if(!_0x56dd7a)throw new Error(_0x51a8('0x51'));if(_0x56dd7a[_0x51a8('0x52')]===_0x51a8('0x50')){var _0x52f60f=_0xee9bee;return db[_0x51a8('0x53')][_0x51a8('0x4f')]({'where':{'name':_0x51a8('0x29'),'userProfileId':_0x56dd7a[_0x51a8('0x54')]},'raw':!![]})[_0x51a8('0x26')](function(_0x5d44fe){if(_0x5d44fe&&_0x5d44fe[_0x51a8('0x55')]===0x0){return db[_0x51a8('0x2a')][_0x51a8('0x4b')]({'name':_0x52f60f[_0x51a8('0x2e')],'resourceId':_0x52f60f['id'],'type':_0x5d44fe[_0x51a8('0x2e')],'sectionId':_0x5d44fe['id']},{})[_0x51a8('0x26')](function(){return _0xee9bee;});}else{return _0xee9bee;}})['catch'](function(_0x4cef4e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cef4e);throw _0x4cef4e;});}return _0xee9bee;})[_0x51a8('0x26')](respondWithResult(_0x1ace5b,null))[_0x51a8('0x48')](handleError(_0x1ace5b,null));};function Extension(_0x51f9f7,_0x7ac0ae,_0x56d3d7,_0x41cc00){this['context']=_0x51a8('0x56');this[_0x51a8('0x57')]=_0x51f9f7;this['app']=_0x56d3d7;this['type']='system';this[_0x51a8('0x58')]=_0x51a8('0x59');this[_0x51a8('0x5a')]=_0x7ac0ae;this[_0x51a8('0x5b')]=_0x41cc00;}function createVoicePrefixExtensions(_0x149047,_0x21c8e0,_0x3fd347){return new BPromise(function(_0x259153,_0x494e11){var _0x43c2ad=new Extension(formatPrefixName(_0x149047[_0x51a8('0x5c')]),0x1,'NoOp',_0x51a8('0x5d'));_0x43c2ad[_0x51a8('0x5e')]=_0x149047['id'];return db[_0x51a8('0x5f')][_0x51a8('0x4b')](_0x43c2ad,{'transaction':_0x3fd347})[_0x51a8('0x26')](function(_0x2a5684){var _0x4f6d5f=_0x2a5684['get']({'plain':!![]});var _0x31a464=_['map'](addVoicePrefixExtensions(_0x149047,_0x21c8e0),function(_0x4ca01a){_0x4ca01a['VoiceExtensionId']=_0x4f6d5f['id'];_0x4ca01a['VoicePrefixId']=_0x149047['id'];return _0x4ca01a;});return db['VoiceExtension'][_0x51a8('0x60')](_0x31a464,{'transaction':_0x3fd347})['then'](function(_0x1477af){if(!_0x1477af){return _0x494e11(_0x51a8('0x61'));}else{return _0x259153(_0x1477af);}})[_0x51a8('0x48')](function(_0x2d3d37){return _0x494e11(_0x2d3d37);});});;});};function addVoicePrefixExtensions(_0xf05c1a,_0x2d8b9b){var _0x28c539=[];var _0xdafa01=formatPrefixName(_0xf05c1a[_0x51a8('0x5c')]);_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x2,'Set',_0x51a8('0x63')+_0xf05c1a[_0x51a8('0x2e')]));if(_0xf05c1a[_0x51a8('0x64')]){_0x28c539['push'](new Extension(_0xdafa01,0x3,'Set','PREFIX-CALLERIDALL='+_0xf05c1a[_0x51a8('0x64')]));}else{_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x3,_0x51a8('0x65'),_0x51a8('0x66')));}_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x4,_0x51a8('0x67'),_0x2d8b9b[_0x51a8('0x68')]+','+_0x51a8('0x69')+(0x8+_0xf05c1a[_0x51a8('0x2e')][_0x51a8('0x3b')])+'}'+','+0x1));return _0x28c539;}function formatPrefixName(_0x45aabc){var _0x3ba418='_';for(var _0x934ea9=0x0;_0x934ea9<_0x45aabc['length'];_0x934ea9++){if(_0x45aabc[_0x51a8('0x6a')](_0x934ea9)=='-'){_0x3ba418+=_0x45aabc[_0x51a8('0x6a')](_0x934ea9);}else{_0x3ba418+='['+_0x45aabc['charAt'](_0x934ea9)+']';}}_0x3ba418+='.';return _0x3ba418;}exports[_0x51a8('0x25')]=function(_0x5140b8,_0x4ac62e,_0x59c80f){var _0x2b4313=_0x5140b8[_0x51a8('0x4e')];_0x2b4313[_0x51a8('0x5c')]=_0x51a8('0x6b')+_0x2b4313[_0x51a8('0x2e')]+'-';return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x5a37c1){return db['VoicePrefix']['update'](_0x2b4313,{'where':{'id':_0x2b4313['id']},'transaction':_0x5a37c1})[_0x51a8('0x26')](function(){return db[_0x51a8('0x5f')][_0x51a8('0x27')]({'where':{'VoicePrefixId':_0x2b4313['id']},'transaction':_0x5a37c1})[_0x51a8('0x26')](function(){return db[_0x51a8('0x5f')][_0x51a8('0x4f')]({'where':{'id':_0x2b4313['VoiceExtensionId']},'raw':!![]})[_0x51a8('0x26')](function(_0x481030){return createVoicePrefixExtensions(_0x2b4313,_0x481030,_0x5a37c1);});});});})[_0x51a8('0x26')](function(){return db[_0x51a8('0x31')][_0x51a8('0x6c')](_0x2b4313['id']);})[_0x51a8('0x26')](respondWithResult(_0x4ac62e,null))[_0x51a8('0x48')](handleError(_0x4ac62e,null));};exports[_0x51a8('0x6d')]=function(_0x895b42,_0xc751c3,_0x3540cd){return db[_0x51a8('0x31')][_0x51a8('0x4f')]({'where':{'id':_0x895b42['params']['id']}})['then'](handleEntityNotFound(_0xc751c3,null))[_0x51a8('0x26')](function(_0xf0c644){if(_0xf0c644){return _0xf0c644[_0x51a8('0x6d')](_0x895b42[_0x51a8('0x4e')]['ids'],_[_0x51a8('0x6e')](_0x895b42['body'],[_0x51a8('0x6f'),'id'])||{})[_0x51a8('0x70')](function(_0xbee86f){for(var _0x24fcc3=0x0;_0x24fcc3<_0x895b42[_0x51a8('0x4e')][_0x51a8('0x6f')][_0x51a8('0x3b')];_0x24fcc3+=0x1){socket[_0x51a8('0x71')](_0x51a8('0x72'),{'UserId':Number(_0x895b42['body'][_0x51a8('0x6f')][_0x24fcc3]),'VoicePrefixId':Number(_0x895b42[_0x51a8('0x49')]['id'])});}return _0xbee86f;});}})[_0x51a8('0x26')](respondWithResult(_0xc751c3,null))[_0x51a8('0x48')](handleError(_0xc751c3,null));};exports['removeAgents']=function(_0x529062,_0x1c1d2f,_0x4b517d){return db['VoicePrefix']['find']({'where':{'id':_0x529062[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c1d2f,null))['then'](function(_0x1325ca){if(_0x1325ca){return _0x1325ca[_0x51a8('0x73')](_0x529062[_0x51a8('0x36')]['ids'])[_0x51a8('0x26')](function(){if(_[_0x51a8('0x74')](_0x529062[_0x51a8('0x36')]['ids'])){for(var _0x3ac9c8=0x0;_0x3ac9c8<_0x529062[_0x51a8('0x36')][_0x51a8('0x6f')][_0x51a8('0x3b')];_0x3ac9c8+=0x1){socket[_0x51a8('0x71')](_0x51a8('0x75'),{'UserId':Number(_0x529062[_0x51a8('0x36')][_0x51a8('0x6f')][_0x3ac9c8]),'VoicePrefixId':Number(_0x529062[_0x51a8('0x49')]['id'])});}}else{socket['emit'](_0x51a8('0x75'),{'UserId':Number(_0x529062[_0x51a8('0x36')]['ids']),'VoicePrefixId':Number(_0x529062[_0x51a8('0x49')]['id'])});}});}})[_0x51a8('0x26')](respondWithStatusCode(_0x1c1d2f,null))['catch'](handleError(_0x1c1d2f,null));};exports[_0x51a8('0x76')]=function(_0x132ce5,_0x3fbdf1,_0x17fd0a){var _0x398fb2={};var _0x53cca9={};var _0x160861;var _0x1e7f04;return db[_0x51a8('0x31')][_0x51a8('0x77')]({'where':{'id':_0x132ce5['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x3fbdf1,null))[_0x51a8('0x26')](function(_0x2a10ac){if(_0x2a10ac){_0x160861=_0x2a10ac;_0x53cca9[_0x51a8('0x34')]=_[_0x51a8('0x35')](db[_0x51a8('0x78')][_0x51a8('0x32')]);_0x53cca9[_0x51a8('0x36')]=_['keys'](_0x132ce5[_0x51a8('0x36')]);_0x53cca9[_0x51a8('0x37')]=_['intersection'](_0x53cca9[_0x51a8('0x34')],_0x53cca9[_0x51a8('0x36')]);_0x398fb2['attributes']=_[_0x51a8('0x38')](_0x53cca9['model'],qs['fields'](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x39')]));_0x398fb2[_0x51a8('0x3a')]=_0x398fb2['attributes']['length']?_0x398fb2[_0x51a8('0x3a')]:_0x53cca9['model'];_0x398fb2[_0x51a8('0x79')]=qs[_0x51a8('0x3d')](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x398fb2[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x132ce5[_0x51a8('0x36')],_0x53cca9[_0x51a8('0x37')]));if(_0x132ce5[_0x51a8('0x36')][_0x51a8('0x40')]){_0x398fb2[_0x51a8('0x3e')]=_[_0x51a8('0x41')](_0x398fb2[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x398fb2['attributes'],function(_0x48f746){var _0x31e7e3={};_0x31e7e3[_0x48f746]={'$like':'%'+_0x132ce5['query']['filter']+'%'};return _0x31e7e3;})});}_0x398fb2=_['merge']({},_0x398fb2,_0x132ce5[_0x51a8('0x43')]);return _0x160861[_0x51a8('0x76')](_0x398fb2);}})[_0x51a8('0x26')](function(_0x125a28){if(_0x125a28){_0x1e7f04=_0x125a28['length'];if(!_0x132ce5[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x398fb2[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x132ce5['query']['limit']);_0x398fb2[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x160861[_0x51a8('0x76')](_0x398fb2);}})[_0x51a8('0x26')](function(_0x4e566a){if(_0x4e566a){return _0x4e566a?{'count':_0x1e7f04,'rows':_0x4e566a}:null;}})[_0x51a8('0x26')](respondWithResult(_0x3fbdf1,null))[_0x51a8('0x48')](handleError(_0x3fbdf1,null));};exports[_0x51a8('0x7a')]=function(_0x566d62,_0x315802,_0x3f4649){var _0x1db1e0={};var _0x58a83c={};var _0x149fa4;var _0x1821a8;return db['VoicePrefix'][_0x51a8('0x77')]({'where':{'id':_0x566d62['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x315802,null))[_0x51a8('0x26')](function(_0xfb059){if(_0xfb059){_0x149fa4=_0xfb059;_0x58a83c[_0x51a8('0x34')]=_[_0x51a8('0x35')](db[_0x51a8('0x7b')][_0x51a8('0x32')]);_0x58a83c[_0x51a8('0x36')]=_['keys'](_0x566d62[_0x51a8('0x36')]);_0x58a83c[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x58a83c[_0x51a8('0x34')],_0x58a83c[_0x51a8('0x36')]);_0x1db1e0['attributes']=_['intersection'](_0x58a83c[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x566d62[_0x51a8('0x36')][_0x51a8('0x39')]));_0x1db1e0[_0x51a8('0x3a')]=_0x1db1e0['attributes'][_0x51a8('0x3b')]?_0x1db1e0['attributes']:_0x58a83c[_0x51a8('0x34')];_0x1db1e0[_0x51a8('0x79')]=qs['sort'](_0x566d62[_0x51a8('0x36')]['sort']);_0x1db1e0[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x566d62[_0x51a8('0x36')],_0x58a83c[_0x51a8('0x37')]));if(_0x566d62['query'][_0x51a8('0x40')]){_0x1db1e0[_0x51a8('0x3e')]=_['merge'](_0x1db1e0[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x1db1e0['attributes'],function(_0x49b0d2){var _0x24b2a9={};_0x24b2a9[_0x49b0d2]={'$like':'%'+_0x566d62[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x24b2a9;})});}_0x1db1e0=_['merge']({},_0x1db1e0,_0x566d62[_0x51a8('0x43')]);return _0x149fa4[_0x51a8('0x7a')](_0x1db1e0);}})[_0x51a8('0x26')](function(_0x11aab9){if(_0x11aab9){_0x1821a8=_0x11aab9[_0x51a8('0x3b')];if(!_0x566d62[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x1db1e0[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x566d62[_0x51a8('0x36')][_0x51a8('0x22')]);_0x1db1e0['offset']=qs['offset'](_0x566d62[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x149fa4['getTeams'](_0x1db1e0);}})['then'](function(_0x5b44ba){if(_0x5b44ba){return _0x5b44ba?{'count':_0x1821a8,'rows':_0x5b44ba}:null;}})[_0x51a8('0x26')](respondWithResult(_0x315802,null))['catch'](handleError(_0x315802,null));};exports['addTeams']=function(_0x517de1,_0x2164d7,_0x4b03f7){var _0x2cea3f=_0x517de1[_0x51a8('0x4e')]['ids'];var _0x5ab3c0;return db[_0x51a8('0x7b')]['findAll']({'where':{'id':_0x2cea3f},'attributes':['id'],'include':[{'model':db[_0x51a8('0x78')],'as':_0x51a8('0x7c'),'attributes':['id','name',_0x51a8('0x7d'),_0x51a8('0x7e'),'interface'],'raw':!![]}]})[_0x51a8('0x26')](function(_0x3bcc82){if(_0x3bcc82){_0x5ab3c0=_0x3bcc82;var _0x223bd7=_['flatMap'](_0x3bcc82,function(_0x2af315){var _0x2db8da=_0x2af315[_0x51a8('0x28')]({'plain':!![]});return _0x2db8da['Agents'];});return db['VoicePrefix'][_0x51a8('0x4f')]({'where':{'id':_0x517de1[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](function(_0xabdbd0){return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x35cd5d){return _0xabdbd0[_0x51a8('0x7f')](_0x2cea3f,{'transaction':_0x35cd5d})[_0x51a8('0x26')](function(){return BPromise[_0x51a8('0x80')](_0x5ab3c0,function(_0x2a8aa1){return db[_0x51a8('0x81')][_0x51a8('0x82')]({'TeamId':_0x2a8aa1['id'],'VoicePrefixId':_0x517de1['params']['id']},{'transaction':_0x35cd5d});});})['then'](function(){return BPromise[_0x51a8('0x80')](_0x223bd7,function(_0x318478){return db[_0x51a8('0x83')][_0x51a8('0x84')]({'where':{'UserId':_0x318478['id'],'VoicePrefixId':_0x517de1[_0x51a8('0x49')]['id']},'transaction':_0x35cd5d});});})['then'](function(){_0x223bd7['forEach'](function(_0x39e8e6){socket[_0x51a8('0x71')]('userVoicePrefix:save',{'UserId':_0x39e8e6['id'],'VoicePrefixId':_0xabdbd0['id']});});});});});}})[_0x51a8('0x26')](respondWithStatusCode(_0x2164d7,null))[_0x51a8('0x48')](handleError(_0x2164d7,null));};exports[_0x51a8('0x85')]=function(_0x19ffd8,_0x121944,_0x4ee800){return db['Team'][_0x51a8('0x46')]({'where':{'id':_0x19ffd8['query'][_0x51a8('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x51a8('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x51a8('0x26')](handleEntityNotFound(_0x121944,null))['then'](function(_0x2dc65c){var _0x1837cb=_[_0x51a8('0x30')](_0x2dc65c,'id');var _0x11bee7=[];var _0x5cacc1=[];var _0x57b718=squel[_0x51a8('0x86')]();_0x57b718[_0x51a8('0x87')](_0x51a8('0x88'))[_0x51a8('0x89')]('team_has_voice_prefixes','tq')[_0x51a8('0x8a')]('user_has_teams','ut',_0x51a8('0x8b'))['where'](_0x51a8('0x8c'),_0x19ffd8[_0x51a8('0x49')]['id']);for(var _0x1ae73c=0x0;_0x1ae73c<_0x2dc65c[_0x51a8('0x3b')];_0x1ae73c+=0x1){let _0x5e923f=_0x2dc65c[_0x1ae73c];for(var _0x432e6a=0x0;_0x432e6a<_0x5e923f['Agents'][_0x51a8('0x3b')];_0x432e6a+=0x1){let _0x1e99d0=_0x5e923f[_0x51a8('0x7c')][_0x432e6a];var _0x5e22f4=_0x57b718[_0x51a8('0x8d')]();_0x5e22f4[_0x51a8('0x3e')](_0x51a8('0x8e'),_0x1e99d0['id']);_0x5cacc1['push'](db['sequelize'][_0x51a8('0x36')](_0x5e22f4[_0x51a8('0x8f')](),{'type':db[_0x51a8('0x4c')][_0x51a8('0x90')]['SELECT']})['then'](function(_0x46c310){if(_0x46c310['length']===0x1){return _0x1e99d0['id'];}else{var _0x1b9cd4=_[_0x51a8('0x91')](_[_0x51a8('0x30')](_0x46c310,_0x51a8('0x92')),function(_0x399fa0){return _[_0x51a8('0x93')](_0x1837cb,_0x399fa0);});if(_0x1b9cd4){return _0x1e99d0['id'];}}}));}}return BPromise[_0x51a8('0x94')](_0x5cacc1)['then'](function(_0x593711){_0x11bee7=_(_0x11bee7)['union'](_0x593711)[_0x51a8('0x95')]()[_0x51a8('0x96')]();return db[_0x51a8('0x31')][_0x51a8('0x4f')]({'where':{'id':_0x19ffd8[_0x51a8('0x49')]['id']}})['then'](function(_0x193d27){return db['sequelize'][_0x51a8('0x4d')](function(_0x188991){return _0x193d27[_0x51a8('0x85')](_0x19ffd8[_0x51a8('0x36')]['ids'],{'transaction':_0x188991})['then'](function(){if(!_[_0x51a8('0x97')](_0x11bee7)){return _0x193d27['removeAgents'](_0x11bee7,{'transaction':_0x188991});}})[_0x51a8('0x26')](function(){_0x11bee7[_0x51a8('0x98')](function(_0x292f74){socket[_0x51a8('0x71')]('userVoicePrefix:remove',{'UserId':_0x292f74,'VoicePrefixId':_0x193d27['id']});});});});});});})[_0x51a8('0x26')](respondWithStatusCode(_0x121944,null))[_0x51a8('0x48')](handleError(_0x121944,null));}; \ No newline at end of file +var _0x1775=['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','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','User','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3bcb39,_0x375412){var _0x3f610f=function(_0x1e1563){while(--_0x1e1563){_0x3bcb39['push'](_0x3bcb39['shift']());}};_0x3f610f(++_0x375412);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'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'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){var _0x231d35=_0x577bf7[_0x5177('0x31')]({'plain':!![]});var _0x58846c=_0x5177('0x32');return db[_0x5177('0x33')][_0x5177('0x30')]({'where':{'type':_0x58846c,'resourceId':_0x231d35['id']}})[_0x5177('0x34')](function(){return _0x577bf7;});})[_0x5177('0x34')](function(){_0x19a0c2[_0x5177('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498fcd,_0x45cf20){return function(_0x1c660e){if(!_0x1c660e){_0x498fcd[_0x5177('0x22')](0x194);}return _0x1c660e;};}function handleError(_0x174f7a,_0x2e1985){_0x2e1985=_0x2e1985||0x1f4;return function(_0x8134f9){logger[_0x5177('0x35')](_0x8134f9[_0x5177('0x36')]);if(_0x8134f9['name']){delete _0x8134f9[_0x5177('0x37')];}_0x174f7a[_0x5177('0x23')](_0x2e1985)['send'](_0x8134f9);};}exports[_0x5177('0x38')]=function(_0x5e4c48,_0x172b36){var _0x1a2c46={},_0x1ba51c={},_0x5e2e5a={'count':0x0,'rows':[]};var _0x4f70df=_[_0x5177('0x39')](db[_0x5177('0x3a')][_0x5177('0x3b')],function(_0x3735e9){return{'name':_0x3735e9[_0x5177('0x3c')],'type':_0x3735e9[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x1ba51c[_0x5177('0x3f')]=_['map'](_0x4f70df,_0x5177('0x37'));_0x1ba51c[_0x5177('0x40')]=_['keys'](_0x5e4c48[_0x5177('0x40')]);_0x1ba51c[_0x5177('0x41')]=_[_0x5177('0x42')](_0x1ba51c[_0x5177('0x3f')],_0x1ba51c[_0x5177('0x40')]);_0x1a2c46[_0x5177('0x43')]=_['intersection'](_0x1ba51c[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x44')]));_0x1a2c46[_0x5177('0x43')]=_0x1a2c46[_0x5177('0x43')][_0x5177('0x45')]?_0x1a2c46['attributes']:_0x1ba51c[_0x5177('0x3f')];if(!_0x5e4c48[_0x5177('0x40')]['hasOwnProperty']('nolimit')){_0x1a2c46[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x28')]);_0x1a2c46[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x26')]);}_0x1a2c46[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x47')]);_0x1a2c46[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x5e4c48[_0x5177('0x40')],_0x1ba51c['filters']),_0x4f70df);if(_0x5e4c48[_0x5177('0x40')]['filter']){_0x1a2c46[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x1a2c46[_0x5177('0x48')],{'$or':_['map'](_0x4f70df,function(_0x56eba4){if(_0x56eba4[_0x5177('0x3d')]!==_0x5177('0x4b')){var _0x1a149b={};_0x1a149b[_0x56eba4[_0x5177('0x37')]]={'$like':'%'+_0x5e4c48[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x1a149b;}})});}_0x1a2c46=_[_0x5177('0x4a')]({},_0x1a2c46,_0x5e4c48[_0x5177('0x4d')]);var _0x4e287e={'where':_0x1a2c46[_0x5177('0x48')]};return db['VoicePrefix']['count'](_0x4e287e)[_0x5177('0x34')](function(_0x17dc98){_0x5e2e5a['count']=_0x17dc98;if(_0x5e4c48[_0x5177('0x40')]['includeAll']){_0x1a2c46['include']=[{'all':!![]}];}return db[_0x5177('0x3a')][_0x5177('0x4e')](_0x1a2c46);})[_0x5177('0x34')](function(_0x3776b8){_0x5e2e5a[_0x5177('0x4f')]=_0x3776b8;return _0x5e2e5a;})[_0x5177('0x34')](respondWithFilteredResult(_0x172b36,_0x1a2c46))[_0x5177('0x50')](handleError(_0x172b36,null));};exports['show']=function(_0x5396cc,_0x12b70){var _0x511dc0={'raw':![],'where':{'id':_0x5396cc[_0x5177('0x51')]['id']}},_0x23be2a={};_0x23be2a[_0x5177('0x3f')]=_[_0x5177('0x52')](db['VoicePrefix'][_0x5177('0x3b')]);_0x23be2a[_0x5177('0x40')]=_[_0x5177('0x52')](_0x5396cc[_0x5177('0x40')]);_0x23be2a[_0x5177('0x41')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],_0x23be2a[_0x5177('0x40')]);_0x511dc0[_0x5177('0x43')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],qs['fields'](_0x5396cc[_0x5177('0x40')]['fields']));_0x511dc0['attributes']=_0x511dc0['attributes'][_0x5177('0x45')]?_0x511dc0[_0x5177('0x43')]:_0x23be2a['model'];if(_0x5396cc[_0x5177('0x40')][_0x5177('0x53')]){_0x511dc0[_0x5177('0x54')]=[{'all':!![]}];}_0x511dc0=_['merge']({},_0x511dc0,_0x5396cc[_0x5177('0x4d')]);return db['VoicePrefix']['find'](_0x511dc0)['then'](handleEntityNotFound(_0x12b70,null))[_0x5177('0x34')](respondWithResult(_0x12b70,null))[_0x5177('0x50')](handleError(_0x12b70,null));};exports[_0x5177('0x30')]=function(_0x5a1f8b,_0x4e53e4){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x5a1f8b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x34')](removeEntity(_0x4e53e4,null))[_0x5177('0x50')](handleError(_0x4e53e4,null));};exports[_0x5177('0x55')]=function(_0xa0edd7,_0x26bac0){return db[_0x5177('0x3a')][_0x5177('0x55')]()[_0x5177('0x34')](respondWithResult(_0x26bac0,null))[_0x5177('0x50')](handleError(_0x26bac0,null));};exports[_0x5177('0x56')]=function(_0x422d6c,_0x4c2068){var _0x59376b;return db[_0x5177('0x57')]['transaction'](function(_0x649c6f){return db['VoicePrefix'][_0x5177('0x56')](_0x422d6c[_0x5177('0x58')],{'transaction':_0x649c6f})[_0x5177('0x34')](function(_0x55a0b6){_0x59376b=_0x55a0b6['get']({'plain':!![]});return db[_0x5177('0x59')][_0x5177('0x5a')]({'where':{'id':_0x59376b[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x4a4758){return createVoicePrefixExtensions(_0x59376b,_0x4a4758,_0x649c6f);});});})['then'](function(){var _0x3f0e89=_0x422d6c[_0x5177('0x5c')][_0x5177('0x31')]({'plain':!![]});if(!_0x3f0e89)throw new Error(_0x5177('0x5d'));if(_0x3f0e89['role']===_0x5177('0x5c')){var _0x143aff=_0x59376b;return db[_0x5177('0x5e')]['find']({'where':{'name':_0x5177('0x32'),'userProfileId':_0x3f0e89[_0x5177('0x5f')]},'raw':!![]})[_0x5177('0x34')](function(_0x49e3e3){if(_0x49e3e3&&_0x49e3e3[_0x5177('0x60')]===0x0){return db['UserProfileResource'][_0x5177('0x56')]({'name':_0x143aff[_0x5177('0x37')],'resourceId':_0x143aff['id'],'type':_0x49e3e3[_0x5177('0x37')],'sectionId':_0x49e3e3['id']},{})['then'](function(){return _0x59376b;});}else{return _0x59376b;}})[_0x5177('0x50')](function(_0x161e03){logger[_0x5177('0x35')](_0x5177('0x61'),_0x161e03);throw _0x161e03;});}return _0x59376b;})[_0x5177('0x34')](respondWithResult(_0x4c2068,null))[_0x5177('0x50')](handleError(_0x4c2068,null));};function Extension(_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){this['context']=_0x5177('0x62');this[_0x5177('0x63')]=_0x37380c;this[_0x5177('0x64')]=_0x5ceed2;this[_0x5177('0x3d')]=_0x5177('0x65');this[_0x5177('0x66')]='Voice\x20Prefix\x20Extension';this['priority']=_0x267599;this[_0x5177('0x67')]=_0x5d96ce;}function createVoicePrefixExtensions(_0x23eb6e,_0x1f294e,_0x336017){return new BPromise(function(_0x123d40,_0x1b1778){var _0x2d1745=new Extension(formatPrefixName(_0x23eb6e[_0x5177('0x68')]),0x1,_0x5177('0x69'),'Voice\x20Prefix');_0x2d1745[_0x5177('0x6a')]=_0x23eb6e['id'];return db[_0x5177('0x59')]['create'](_0x2d1745,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4481b6){var _0x4edebc=_0x4481b6[_0x5177('0x31')]({'plain':!![]});var _0x2f3344=_[_0x5177('0x39')](addVoicePrefixExtensions(_0x23eb6e,_0x1f294e),function(_0x4be4b2){_0x4be4b2[_0x5177('0x5b')]=_0x4edebc['id'];_0x4be4b2[_0x5177('0x6a')]=_0x23eb6e['id'];return _0x4be4b2;});return db['VoiceExtension']['bulkCreate'](_0x2f3344,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4f76d7){if(!_0x4f76d7){return _0x1b1778(_0x5177('0x6b'));}else{return _0x123d40(_0x4f76d7);}})['catch'](function(_0x2771fa){return _0x1b1778(_0x2771fa);});});;});};function addVoicePrefixExtensions(_0x16f17c,_0x5a8ada){var _0x2af938=[];var _0x3b090d=formatPrefixName(_0x16f17c[_0x5177('0x68')]);_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x2,_0x5177('0x6d'),_0x5177('0x6e')+_0x16f17c[_0x5177('0x37')]));if(_0x16f17c['callerIdAll']){_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'Set','PREFIX-CALLERIDALL='+_0x16f17c[_0x5177('0x6f')]));}else{_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'NoOp',_0x5177('0x70')));}_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x4,_0x5177('0x71'),_0x5a8ada[_0x5177('0x72')]+','+_0x5177('0x73')+(0x8+_0x16f17c[_0x5177('0x37')][_0x5177('0x45')])+'}'+','+0x1));return _0x2af938;}function formatPrefixName(_0x3b26f4){var _0x478d5e='_';for(var _0x54b28f=0x0;_0x54b28f<_0x3b26f4[_0x5177('0x45')];_0x54b28f++){if(_0x3b26f4[_0x5177('0x74')](_0x54b28f)=='-'){_0x478d5e+=_0x3b26f4[_0x5177('0x74')](_0x54b28f);}else{_0x478d5e+='['+_0x3b26f4[_0x5177('0x74')](_0x54b28f)+']';}}_0x478d5e+='.';return _0x478d5e;}exports[_0x5177('0x2f')]=function(_0x3dd58f,_0x4fc289,_0x3692b2){var _0x397b75=_0x3dd58f[_0x5177('0x58')];_0x397b75[_0x5177('0x68')]='system-'+_0x397b75[_0x5177('0x37')]+'-';return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x22da9d){return db[_0x5177('0x3a')]['update'](_0x397b75,{'where':{'id':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x30')]({'where':{'VoicePrefixId':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x5a')]({'where':{'id':_0x397b75[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x44ed82){return createVoicePrefixExtensions(_0x397b75,_0x44ed82,_0x22da9d);});});});})['then'](function(){return db[_0x5177('0x3a')][_0x5177('0x76')](_0x397b75['id']);})[_0x5177('0x34')](respondWithResult(_0x4fc289,null))[_0x5177('0x50')](handleError(_0x4fc289,null));};exports['addAgents']=function(_0x16b85b,_0x17456b,_0x3502dd){return db['VoicePrefix']['find']({'where':{'id':_0x16b85b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x17456b,null))[_0x5177('0x34')](function(_0x170e25){if(_0x170e25){return _0x170e25[_0x5177('0x77')](_0x16b85b[_0x5177('0x58')][_0x5177('0x78')],_[_0x5177('0x79')](_0x16b85b[_0x5177('0x58')],['ids','id'])||{})['spread'](function(_0x597a84){for(var _0x290315=0x0;_0x290315<_0x16b85b['body'][_0x5177('0x78')][_0x5177('0x45')];_0x290315+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':Number(_0x16b85b[_0x5177('0x58')]['ids'][_0x290315]),'VoicePrefixId':Number(_0x16b85b[_0x5177('0x51')]['id'])});}return _0x597a84;});}})[_0x5177('0x34')](respondWithResult(_0x17456b,null))[_0x5177('0x50')](handleError(_0x17456b,null));};exports['removeAgents']=function(_0x3d845e,_0x484762,_0x3d95df){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x3d845e[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x484762,null))['then'](function(_0x5f0141){if(_0x5f0141){return _0x5f0141[_0x5177('0x7c')](_0x3d845e['query'][_0x5177('0x78')])[_0x5177('0x34')](function(){if(_['isArray'](_0x3d845e[_0x5177('0x40')][_0x5177('0x78')])){for(var _0xcbbb73=0x0;_0xcbbb73<_0x3d845e[_0x5177('0x40')][_0x5177('0x78')][_0x5177('0x45')];_0xcbbb73+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e['query'][_0x5177('0x78')][_0xcbbb73]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}}else{socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e[_0x5177('0x40')][_0x5177('0x78')]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}});}})[_0x5177('0x34')](respondWithStatusCode(_0x484762,null))[_0x5177('0x50')](handleError(_0x484762,null));};exports['getAgents']=function(_0x17efe1,_0x30c2dc,_0x523012){var _0x33e1a6={};var _0x5f57bc={};var _0x3f1aad;var _0x558e04;return db['VoicePrefix']['findOne']({'where':{'id':_0x17efe1[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x30c2dc,null))[_0x5177('0x34')](function(_0x516d0b){if(_0x516d0b){_0x3f1aad=_0x516d0b;_0x5f57bc[_0x5177('0x3f')]=_[_0x5177('0x52')](db[_0x5177('0x7e')][_0x5177('0x3b')]);_0x5f57bc[_0x5177('0x40')]=_['keys'](_0x17efe1[_0x5177('0x40')]);_0x5f57bc[_0x5177('0x41')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],_0x5f57bc['query']);_0x33e1a6[_0x5177('0x43')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x17efe1[_0x5177('0x40')][_0x5177('0x44')]));_0x33e1a6[_0x5177('0x43')]=_0x33e1a6[_0x5177('0x43')]['length']?_0x33e1a6['attributes']:_0x5f57bc[_0x5177('0x3f')];_0x33e1a6[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x17efe1['query'][_0x5177('0x47')]);_0x33e1a6[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x17efe1['query'],_0x5f57bc[_0x5177('0x41')]));if(_0x17efe1[_0x5177('0x40')][_0x5177('0x4c')]){_0x33e1a6['where']=_[_0x5177('0x4a')](_0x33e1a6['where'],{'$or':_[_0x5177('0x39')](_0x33e1a6[_0x5177('0x43')],function(_0x5a40f1){var _0x5a8146={};_0x5a8146[_0x5a40f1]={'$like':'%'+_0x17efe1['query'][_0x5177('0x4c')]+'%'};return _0x5a8146;})});}_0x33e1a6=_['merge']({},_0x33e1a6,_0x17efe1[_0x5177('0x4d')]);return _0x3f1aad[_0x5177('0x7f')](_0x33e1a6);}})[_0x5177('0x34')](function(_0x57adf4){if(_0x57adf4){_0x558e04=_0x57adf4['length'];if(!_0x17efe1['query'][_0x5177('0x80')](_0x5177('0x81'))){_0x33e1a6[_0x5177('0x28')]=qs['limit'](_0x17efe1[_0x5177('0x40')][_0x5177('0x28')]);_0x33e1a6['offset']=qs[_0x5177('0x26')](_0x17efe1['query'][_0x5177('0x26')]);}return _0x3f1aad['getAgents'](_0x33e1a6);}})['then'](function(_0x5910a8){if(_0x5910a8){return _0x5910a8?{'count':_0x558e04,'rows':_0x5910a8}:null;}})[_0x5177('0x34')](respondWithResult(_0x30c2dc,null))['catch'](handleError(_0x30c2dc,null));};exports[_0x5177('0x82')]=function(_0x450c61,_0x1d351b,_0x1372ad){var _0x3b4cab={};var _0x197377={};var _0x580d34;var _0x1e76cf;return db[_0x5177('0x3a')]['findOne']({'where':{'id':_0x450c61[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x1d351b,null))[_0x5177('0x34')](function(_0x51f7ce){if(_0x51f7ce){_0x580d34=_0x51f7ce;_0x197377['model']=_['keys'](db[_0x5177('0x83')][_0x5177('0x3b')]);_0x197377[_0x5177('0x40')]=_[_0x5177('0x52')](_0x450c61[_0x5177('0x40')]);_0x197377[_0x5177('0x41')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],_0x197377[_0x5177('0x40')]);_0x3b4cab[_0x5177('0x43')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],qs['fields'](_0x450c61[_0x5177('0x40')]['fields']));_0x3b4cab[_0x5177('0x43')]=_0x3b4cab[_0x5177('0x43')][_0x5177('0x45')]?_0x3b4cab['attributes']:_0x197377[_0x5177('0x3f')];_0x3b4cab[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x450c61[_0x5177('0x40')][_0x5177('0x47')]);_0x3b4cab[_0x5177('0x48')]=qs[_0x5177('0x41')](_[_0x5177('0x49')](_0x450c61['query'],_0x197377['filters']));if(_0x450c61[_0x5177('0x40')]['filter']){_0x3b4cab[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x3b4cab['where'],{'$or':_[_0x5177('0x39')](_0x3b4cab[_0x5177('0x43')],function(_0x54efd0){var _0x3e8a29={};_0x3e8a29[_0x54efd0]={'$like':'%'+_0x450c61[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x3e8a29;})});}_0x3b4cab=_[_0x5177('0x4a')]({},_0x3b4cab,_0x450c61[_0x5177('0x4d')]);return _0x580d34[_0x5177('0x82')](_0x3b4cab);}})[_0x5177('0x34')](function(_0x7a67fb){if(_0x7a67fb){_0x1e76cf=_0x7a67fb[_0x5177('0x45')];if(!_0x450c61[_0x5177('0x40')][_0x5177('0x80')](_0x5177('0x81'))){_0x3b4cab[_0x5177('0x28')]=qs['limit'](_0x450c61[_0x5177('0x40')][_0x5177('0x28')]);_0x3b4cab[_0x5177('0x26')]=qs['offset'](_0x450c61[_0x5177('0x40')][_0x5177('0x26')]);}return _0x580d34['getTeams'](_0x3b4cab);}})[_0x5177('0x34')](function(_0x5cbc48){if(_0x5cbc48){return _0x5cbc48?{'count':_0x1e76cf,'rows':_0x5cbc48}:null;}})['then'](respondWithResult(_0x1d351b,null))[_0x5177('0x50')](handleError(_0x1d351b,null));};exports[_0x5177('0x84')]=function(_0xd8f8f3,_0x40ded0,_0x356874){var _0x219a7c=_0xd8f8f3['body'][_0x5177('0x78')];var _0xcb831c;return db['Team'][_0x5177('0x4e')]({'where':{'id':_0x219a7c},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id',_0x5177('0x37'),_0x5177('0x86'),_0x5177('0x87'),_0x5177('0x88')],'raw':!![]}]})[_0x5177('0x34')](function(_0x4e60b2){if(_0x4e60b2){_0xcb831c=_0x4e60b2;var _0x193dbf=_['flatMap'](_0x4e60b2,function(_0xecd419){var _0x4970b3=_0xecd419[_0x5177('0x31')]({'plain':!![]});return _0x4970b3[_0x5177('0x85')];});return db[_0x5177('0x3a')][_0x5177('0x5a')]({'where':{'id':_0xd8f8f3['params']['id']}})[_0x5177('0x34')](function(_0x1b7c52){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x4e8c0c){return _0x1b7c52['addTeams'](_0x219a7c,{'transaction':_0x4e8c0c})['then'](function(){return BPromise['each'](_0xcb831c,function(_0xaafc9f){return db['TeamVoicePrefix'][_0x5177('0x89')]({'TeamId':_0xaafc9f['id'],'VoicePrefixId':_0xd8f8f3['params']['id']},{'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){return BPromise['each'](_0x193dbf,function(_0x384af7){return db[_0x5177('0x8a')][_0x5177('0x8b')]({'where':{'UserId':_0x384af7['id'],'VoicePrefixId':_0xd8f8f3[_0x5177('0x51')]['id']},'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){_0x193dbf[_0x5177('0x8c')](function(_0x3a9c65){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':_0x3a9c65['id'],'VoicePrefixId':_0x1b7c52['id']});});});});});}})[_0x5177('0x34')](respondWithStatusCode(_0x40ded0,null))['catch'](handleError(_0x40ded0,null));};exports[_0x5177('0x8d')]=function(_0x13fa90,_0x3475c3,_0x5ed46a){return db[_0x5177('0x83')][_0x5177('0x4e')]({'where':{'id':_0x13fa90[_0x5177('0x40')][_0x5177('0x78')]},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id'],'raw':!![]}]})[_0x5177('0x34')](handleEntityNotFound(_0x3475c3,null))[_0x5177('0x34')](function(_0xb8f7de){var _0x1bc4cb=_[_0x5177('0x39')](_0xb8f7de,'id');var _0x4d29b7=[];var _0x1f8c26=[];var _0x365b68=squel[_0x5177('0x8e')]();_0x365b68['field'](_0x5177('0x8f'))[_0x5177('0x90')]('team_has_voice_prefixes','tq')[_0x5177('0x91')](_0x5177('0x92'),'ut',_0x5177('0x93'))['where'](_0x5177('0x94'),_0x13fa90[_0x5177('0x51')]['id']);for(var _0x3b8c79=0x0;_0x3b8c79<_0xb8f7de[_0x5177('0x45')];_0x3b8c79+=0x1){let _0x2a16ed=_0xb8f7de[_0x3b8c79];for(var _0x5d1909=0x0;_0x5d1909<_0x2a16ed['Agents'][_0x5177('0x45')];_0x5d1909+=0x1){let _0x61ead2=_0x2a16ed['Agents'][_0x5d1909];var _0x2ffb25=_0x365b68[_0x5177('0x95')]();_0x2ffb25['where'](_0x5177('0x96'),_0x61ead2['id']);_0x1f8c26[_0x5177('0x6c')](db['sequelize']['query'](_0x2ffb25[_0x5177('0x97')](),{'type':db['sequelize']['QueryTypes'][_0x5177('0x98')]})[_0x5177('0x34')](function(_0x58170f){if(_0x58170f[_0x5177('0x45')]===0x1){return _0x61ead2['id'];}else{var _0xdc5504=_[_0x5177('0x99')](_[_0x5177('0x39')](_0x58170f,_0x5177('0x9a')),function(_0x2fa026){return _['includes'](_0x1bc4cb,_0x2fa026);});if(_0xdc5504){return _0x61ead2['id'];}}}));}}return BPromise[_0x5177('0x9b')](_0x1f8c26)['then'](function(_0x55e914){_0x4d29b7=_(_0x4d29b7)[_0x5177('0x9c')](_0x55e914)[_0x5177('0x9d')]()[_0x5177('0x9e')]();return db['VoicePrefix'][_0x5177('0x5a')]({'where':{'id':_0x13fa90[_0x5177('0x51')]['id']}})[_0x5177('0x34')](function(_0x3873ca){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x10698d){return _0x3873ca[_0x5177('0x8d')](_0x13fa90[_0x5177('0x40')][_0x5177('0x78')],{'transaction':_0x10698d})[_0x5177('0x34')](function(){if(!_[_0x5177('0x9f')](_0x4d29b7)){return _0x3873ca['removeAgents'](_0x4d29b7,{'transaction':_0x10698d});}})[_0x5177('0x34')](function(){_0x4d29b7[_0x5177('0x8c')](function(_0x38f0f4){socket[_0x5177('0x7a')]('userVoicePrefix:remove',{'UserId':_0x38f0f4,'VoicePrefixId':_0x3873ca['id']});});});});});});})['then'](respondWithStatusCode(_0x3475c3,null))['catch'](handleError(_0x3475c3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 66735a0..b96b889 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 _0x52a4=['hook','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x5c7cd6,_0xa77e75){var _0x5820da=function(_0x2d499e){while(--_0x2d499e){_0x5c7cd6['push'](_0x5c7cd6['shift']());}};_0x5820da(++_0xa77e75);}(_0x52a4,0x151));var _0x452a=function(_0x540a17,_0x36509d){_0x540a17=_0x540a17-0x0;var _0x39b97e=_0x52a4[_0x540a17];return _0x39b97e;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x452a('0x0'))['db'][_0x452a('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x452a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x452a('0x3'),'afterDestroy':_0x452a('0x4')};function emitEvent(_0x45f8f5){return function(_0x15c667,_0x3a264f,_0xb57f4f){VoicePrefixEvents[_0x452a('0x5')](_0x45f8f5+':'+_0x15c667['id'],_0x15c667);VoicePrefixEvents[_0x452a('0x5')](_0x45f8f5,_0x15c667);_0xb57f4f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x452a('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xcc7d=['setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xcc7d,0x186));var _0xdcc7=function(_0x23dc21,_0xa07a67){_0x23dc21=_0x23dc21-0x0;var _0x1d128f=_0xcc7d[_0x23dc21];return _0x1d128f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdcc7('0x0')](0x0);var events={'afterCreate':_0xdcc7('0x1'),'afterUpdate':_0xdcc7('0x2'),'afterDestroy':'remove'};function emitEvent(_0x23e2f4){return function(_0x8deca8,_0x136d1e,_0x268202){VoicePrefixEvents[_0xdcc7('0x3')](_0x23e2f4+':'+_0x8deca8['id'],_0x8deca8);VoicePrefixEvents[_0xdcc7('0x3')](_0x23e2f4,_0x8deca8);_0x268202(null);};}for(var e in events){if(events[_0xdcc7('0x4')](e)){var event=events[e];VoicePrefix[_0xdcc7('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index f6d4899..ddccaf6 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 _0xf950=['util','../../config/logger','api','bluebird','request-promise','rimraf','./voicePrefix.attributes','exports','voice_prefixes','lodash'];(function(_0x1651eb,_0x5c81b4){var _0x2e65e6=function(_0x4ee6af){while(--_0x4ee6af){_0x1651eb['push'](_0x1651eb['shift']());}};_0x2e65e6(++_0x5c81b4);}(_0xf950,0x13f));var _0x0f95=function(_0x4cb51c,_0x48feba){_0x4cb51c=_0x4cb51c-0x0;var _0x52c77c=_0xf950[_0x4cb51c];return _0x52c77c;};'use strict';var _=require(_0x0f95('0x0'));var util=require(_0x0f95('0x1'));var logger=require(_0x0f95('0x2'))(_0x0f95('0x3'));var moment=require('moment');var BPromise=require(_0x0f95('0x4'));var rp=require(_0x0f95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f95('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f95('0x7'));module[_0x0f95('0x8')]=function(_0x6d1f68,_0x57727c){return _0x6d1f68['define']('VoicePrefix',attributes,{'tableName':_0x0f95('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dd6=['voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','VoicePrefix'];(function(_0x174aa3,_0x9f5356){var _0xa6642e=function(_0x1a9b9c){while(--_0x1a9b9c){_0x174aa3['push'](_0x174aa3['shift']());}};_0xa6642e(++_0x9f5356);}(_0x6dd6,0x16c));var _0x66dd=function(_0x35f7d1,_0x39d318){_0x35f7d1=_0x35f7d1-0x0;var _0x53ac5f=_0x6dd6[_0x35f7d1];return _0x53ac5f;};'use strict';var _=require(_0x66dd('0x0'));var util=require(_0x66dd('0x1'));var logger=require(_0x66dd('0x2'))(_0x66dd('0x3'));var moment=require('moment');var BPromise=require(_0x66dd('0x4'));var rp=require(_0x66dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66dd('0x6'));var config=require(_0x66dd('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x40dd71,_0x247572){return _0x40dd71[_0x66dd('0x8')](_0x66dd('0x9'),attributes,{'tableName':_0x66dd('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 00660bb..651fa34 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 _0xed5c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','lodash'];(function(_0x51411b,_0x2b96d7){var _0x114d97=function(_0x230121){while(--_0x230121){_0x51411b['push'](_0x51411b['shift']());}};_0x114d97(++_0x2b96d7);}(_0xed5c,0x81));var _0xced5=function(_0x29ceb4,_0x2c0bb0){_0x29ceb4=_0x29ceb4-0x0;var _0x4764a1=_0xed5c[_0x29ceb4];return _0x4764a1;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require(_0xced5('0x3'));var rs=require(_0xced5('0x4'));var fs=require('fs');var Redis=require(_0xced5('0x5'));var db=require(_0xced5('0x6'))['db'];var utils=require(_0xced5('0x7'));var logger=require(_0xced5('0x8'))(_0xced5('0x9'));var config=require('../../config/environment');var jayson=require(_0xced5('0xa'));var client=jayson[_0xced5('0xb')]['http']({'port':0x232a});config['redis']=_[_0xced5('0xc')](config[_0xced5('0xd')],{'host':_0xced5('0xe'),'port':0x18eb});var socket=require(_0xced5('0xf'))(new Redis(config[_0xced5('0xd')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x708a5a,_0x2f2606,_0x37d308){return new BPromise(function(_0x10fd53,_0x5b760e){return client[_0xced5('0x10')](_0x708a5a,_0x37d308)['then'](function(_0x3ba212){logger[_0xced5('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0xced5('0x12'));logger['debug'](_0xced5('0x13'),_0x2f2606,_0xced5('0x12'),JSON[_0xced5('0x14')](_0x3ba212));if(_0x3ba212[_0xced5('0x15')]){if(_0x3ba212[_0xced5('0x15')][_0xced5('0x16')]===0x1f4){logger[_0xced5('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0x3ba212['error'][_0xced5('0x17')]);return _0x5b760e(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);return _0x10fd53(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}else{logger[_0xced5('0x11')](_0xced5('0x18'),_0x2f2606,'request\x20sent');_0x10fd53(_0x3ba212[_0xced5('0x19')][_0xced5('0x17')]);}})['catch'](function(_0x33851d){logger[_0xced5('0x15')](_0xced5('0x18'),_0x2f2606,_0x33851d);_0x5b760e(_0x33851d);});});} \ No newline at end of file +var _0x9bb8=['register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x54104b,_0x1df496){var _0x1dc45b=function(_0x3dba58){while(--_0x3dba58){_0x54104b['push'](_0x54104b['shift']());}};_0x1dc45b(++_0x1df496);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89bb('0x0'));var util=require(_0x89bb('0x1'));var moment=require(_0x89bb('0x2'));var BPromise=require(_0x89bb('0x3'));var rs=require(_0x89bb('0x4'));var fs=require('fs');var Redis=require(_0x89bb('0x5'));var db=require(_0x89bb('0x6'))['db'];var utils=require(_0x89bb('0x7'));var logger=require(_0x89bb('0x8'))(_0x89bb('0x9'));var config=require(_0x89bb('0xa'));var jayson=require(_0x89bb('0xb'));var client=jayson['client'][_0x89bb('0xc')]({'port':0x232a});config[_0x89bb('0xd')]=_[_0x89bb('0xe')](config[_0x89bb('0xd')],{'host':_0x89bb('0xf'),'port':0x18eb});var socket=require(_0x89bb('0x10'))(new Redis(config['redis']));require(_0x89bb('0x11'))[_0x89bb('0x12')](socket);function respondWithRpcPromise(_0x4e48a0,_0x9da489,_0x59ce21){return new BPromise(function(_0x31e9e7,_0x56c08e){return client[_0x89bb('0x13')](_0x4e48a0,_0x59ce21)['then'](function(_0x33b1d7){logger[_0x89bb('0x14')](_0x89bb('0x15'),_0x9da489,_0x89bb('0x16'));logger['debug'](_0x89bb('0x17'),_0x9da489,_0x89bb('0x16'),JSON[_0x89bb('0x18')](_0x33b1d7));if(_0x33b1d7[_0x89bb('0x19')]){if(_0x33b1d7['error']['code']===0x1f4){logger[_0x89bb('0x19')](_0x89bb('0x15'),_0x9da489,_0x33b1d7[_0x89bb('0x19')][_0x89bb('0x1a')]);return _0x56c08e(_0x33b1d7[_0x89bb('0x19')][_0x89bb('0x1a')]);}logger['error'](_0x89bb('0x15'),_0x9da489,_0x33b1d7[_0x89bb('0x19')]['message']);return _0x31e9e7(_0x33b1d7[_0x89bb('0x19')][_0x89bb('0x1a')]);}else{logger[_0x89bb('0x14')](_0x89bb('0x15'),_0x9da489,_0x89bb('0x16'));_0x31e9e7(_0x33b1d7['result'][_0x89bb('0x1a')]);}})[_0x89bb('0x1b')](function(_0x28c837){logger[_0x89bb('0x19')](_0x89bb('0x15'),_0x9da489,_0x28c837);_0x56c08e(_0x28c837);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3de6471..f747b37 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 _0x1782=['update','voicePrefix:','./voicePrefix.events','remove'];(function(_0x470b4e,_0x3ea13a){var _0x42a5fa=function(_0x208ba7){while(--_0x208ba7){_0x470b4e['push'](_0x470b4e['shift']());}};_0x42a5fa(++_0x3ea13a);}(_0x1782,0x13e));var _0x2178=function(_0x10d671,_0x5d7431){_0x10d671=_0x10d671-0x0;var _0x2f17a1=_0x1782[_0x10d671];return _0x2f17a1;};'use strict';var VoicePrefixEvents=require(_0x2178('0x0'));var events=['save',_0x2178('0x1'),_0x2178('0x2')];function createListener(_0x1df52d,_0x1c92e6){return function(_0x17b0da){_0x1c92e6['emit'](_0x1df52d,_0x17b0da);};}function removeListener(_0x601378,_0x1659a1){return function(){VoicePrefixEvents['removeListener'](_0x601378,_0x1659a1);};}exports['register']=function(_0x3c4dd1){for(var _0x3b0f74=0x0,_0x50ad34=events['length'];_0x3b0f74<_0x50ad34;_0x3b0f74++){var _0x4cf22a=events[_0x3b0f74];var _0x3b4115=createListener(_0x2178('0x3')+_0x4cf22a,_0x3c4dd1);VoicePrefixEvents['on'](_0x4cf22a,_0x3b4115);}}; \ No newline at end of file +var _0xf972=['update','emit','removeListener','register','length','./voicePrefix.events','remove'];(function(_0x54300e,_0x420678){var _0x350e40=function(_0x345d07){while(--_0x345d07){_0x54300e['push'](_0x54300e['shift']());}};_0x350e40(++_0x420678);}(_0xf972,0x171));var _0x2f97=function(_0x2894f,_0x87e607){_0x2894f=_0x2894f-0x0;var _0x4b3c9c=_0xf972[_0x2894f];return _0x4b3c9c;};'use strict';var VoicePrefixEvents=require(_0x2f97('0x0'));var events=['save',_0x2f97('0x1'),_0x2f97('0x2')];function createListener(_0x111bed,_0x4cc503){return function(_0x37ea56){_0x4cc503[_0x2f97('0x3')](_0x111bed,_0x37ea56);};}function removeListener(_0x56fe1f,_0x35590e){return function(){VoicePrefixEvents[_0x2f97('0x4')](_0x56fe1f,_0x35590e);};}exports[_0x2f97('0x5')]=function(_0x14b139){for(var _0x37482e=0x0,_0x77824f=events[_0x2f97('0x6')];_0x37482e<_0x77824f;_0x37482e++){var _0x322e02=events[_0x37482e];var _0x11c897=createListener('voicePrefix:'+_0x322e02,_0x14b139);VoicePrefixEvents['on'](_0x322e02,_0x11c897);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 81cf08b..12b70db 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(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0xb10b,0x12a));var _0xbb10=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xb10b[_0x36bf88];return _0x332914;};'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(_0x48ceee,_0x7af31a){var _0x30d39c=function(_0x18f98a){while(--_0x18f98a){_0x48ceee['push'](_0x48ceee['shift']());}};_0x30d39c(++_0x7af31a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 12b92f3..f3b482f 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 _0xb65d=['mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','ringall','fewestcalls','random','rrmemory','linear','wrandom','strategy','type','getDataValue','dialMethod','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','power','progressive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#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,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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\x20(min:1,\x20max:999)','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'];(function(_0x38a97e,_0x2054b7){var _0x1e56ca=function(_0x287529){while(--_0x287529){_0x38a97e['push'](_0x38a97e['shift']());}};_0x1e56ca(++_0x2054b7);}(_0xb65d,0x18c));var _0xdb65=function(_0x2d643f,_0x1573a0){_0x2d643f=_0x2d643f-0x0;var _0x126aca=_0xb65d[_0x2d643f];return _0x126aca;};'use strict';var Sequelize=require(_0xdb65('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb65('0x1')],'allowNull':![],'unique':_0xdb65('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x4'),_0xdb65('0x5')),'allowNull':![],'defaultValue':_0xdb65('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xdb65('0x6'),'leastrecent',_0xdb65('0x7'),_0xdb65('0x8'),_0xdb65('0x9'),_0xdb65('0xa'),_0xdb65('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0xdb65('0x6'),'set':function(_0x32940c){this['setDataValue'](_0xdb65('0xc'),_0x32940c?_0x32940c:'rrmemory');},'get':function(){var _0x3665ae=this['getDataValue'](_0xdb65('0xd'));var _0x333cf7=this[_0xdb65('0xe')](_0xdb65('0xf'));var _0x355036=this[_0xdb65('0xe')](_0xdb65('0xc'));if(_0x3665ae===_0xdb65('0x5')){if(_0x333cf7===_0xdb65('0x10')){return null;}if(_0x333cf7===_0xdb65('0x11')&&![_0xdb65('0x9'),_0xdb65('0x12')][_0xdb65('0x13')](_0x355036)){this[_0xdb65('0x14')]('strategy',_0xdb65('0x9'));}}return _0x355036;}},'servicelevel':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdb65('0x15')](0xb)},'timeout':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdb65('0x1')]},'weight':{'type':Sequelize[_0xdb65('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no',_0xdb65('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdb65('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xdb65('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdb65('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdb65('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':_0xdb65('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xdb65('0x16'),'no',_0xdb65('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdb65('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xdb65('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdb65('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xdb65('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xdb65('0x1')]},'queue_less_than':{'type':Sequelize[_0xdb65('0x1')]},'periodic_announce':{'type':Sequelize[_0xdb65('0x19')],'set':function(_0x4f8320){this[_0xdb65('0x14')](_0xdb65('0x1a'),_0x4f8320?_0x4f8320[_0xdb65('0x1b')](','):[]);},'get':function(){return this[_0xdb65('0xe')](_0xdb65('0x1a'))?this[_0xdb65('0xe')]('periodic_announce')[_0xdb65('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x56f08c){this[_0xdb65('0x14')](_0xdb65('0x1d'),_0x56f08c?_0x56f08c[_0xdb65('0x1b')](','):undefined);},'get':function(){return this[_0xdb65('0xe')](_0xdb65('0x1d'))?this[_0xdb65('0xe')](_0xdb65('0x1d'))[_0xdb65('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4948b3){this[_0xdb65('0x14')](_0xdb65('0x1e'),_0x4948b3?_0x4948b3[_0xdb65('0x1b')](','):undefined);},'get':function(){return this[_0xdb65('0xe')](_0xdb65('0x1e'))?this[_0xdb65('0xe')](_0xdb65('0x1e'))[_0xdb65('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':0x0,'set':function(_0x4ace19){this[_0xdb65('0x14')](_0xdb65('0x20'),_0x4ace19);if(_0x4ace19){if(this[_0xdb65('0xe')](_0xdb65('0x21'))<0x2){this[_0xdb65('0x14')](_0xdb65('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xdb65('0x10'),'progressive',_0xdb65('0x22'),'predictive',_0xdb65('0x11')),'defaultValue':_0xdb65('0x23'),'comment':_0xdb65('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdb65('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xdb65('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xdb65('0x27')](0x2)[_0xdb65('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdb65('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x29'),_0xdb65('0x2a')),'defaultValue':_0xdb65('0x2a'),'comment':_0xdb65('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdb65('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xdb65('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xdb65('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdb65('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xdb65('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x2f')},'dialQueueProject':{'type':Sequelize[_0xdb65('0x1')],'comment':_0xdb65('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'comment':_0xdb65('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdb65('0x35')},'dialTimezone':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':_0xdb65('0x36')},'dialPrefix':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xdb65('0x37'),_0xdb65('0x38'),'onlyIfOpen'),'defaultValue':_0xdb65('0x37')},'dialAMDActive':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':0x0,'comment':_0xdb65('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdb65('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdb65('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdb65('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xdb65('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdb65('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdb65('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdb65('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdb65('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xdb65('0x3')]('DESC',_0xdb65('0x40')),'defaultValue':_0xdb65('0x41')},'dialQueueProject2':{'type':Sequelize[_0xdb65('0x1')],'comment':_0xdb65('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdb65('0x42')},'dialCutDigit':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdb65('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb65('0x15')],'allowNull':!![],'comment':_0xdb65('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':![],'comment':_0xdb65('0x4d'),'set':function(_0x49e5fb){if(!_0x49e5fb)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xdb65('0x14')](_0xdb65('0x4e'),_0x49e5fb);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xdb65('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xdb65('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaaec=['setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','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\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered'];(function(_0xf2f584,_0x263360){var _0x46a7a9=function(_0x45a89f){while(--_0x45a89f){_0xf2f584['push'](_0xf2f584['shift']());}};_0x46a7a9(++_0x263360);}(_0xaaec,0x9d));var _0xcaae=function(_0x8ba624,_0x42e30e){_0x8ba624=_0x8ba624-0x0;var _0x43940f=_0xaaec[_0x8ba624];return _0x43940f;};'use strict';var Sequelize=require(_0xcaae('0x0'));module[_0xcaae('0x1')]={'name':{'type':Sequelize[_0xcaae('0x2')],'allowNull':![],'unique':_0xcaae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcaae('0x4'),_0xcaae('0x5')),'allowNull':![],'defaultValue':_0xcaae('0x4')},'musiconhold':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':_0xcaae('0x6')},'announce':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xcaae('0x7')]('rr',_0xcaae('0x8'),'leastrecent',_0xcaae('0x9'),_0xcaae('0xa'),_0xcaae('0xb'),_0xcaae('0xc'),_0xcaae('0xd'),_0xcaae('0xe')),'allowNull':![],'defaultValue':_0xcaae('0x8'),'set':function(_0x27f111){this[_0xcaae('0xf')](_0xcaae('0x10'),_0x27f111?_0x27f111:_0xcaae('0xb'));},'get':function(){var _0x17f8fe=this[_0xcaae('0x11')](_0xcaae('0x12'));var _0x3ab826=this['getDataValue'](_0xcaae('0x13'));var _0xbdf902=this[_0xcaae('0x11')]('strategy');if(_0x17f8fe==='outbound'){if(_0x3ab826===_0xcaae('0x14')){return null;}if(_0x3ab826===_0xcaae('0x15')&&![_0xcaae('0xb'),_0xcaae('0x16')][_0xcaae('0x17')](_0xbdf902)){this['setDataValue']('strategy',_0xcaae('0xb'));}}return _0xbdf902;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xcaae('0x2')]},'weight':{'type':Sequelize[_0xcaae('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no'),'defaultValue':_0xcaae('0x19')},'autopause':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no',_0xcaae('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xcaae('0x18')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xcaae('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xcaae('0x7')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xcaae('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no'),'defaultValue':_0xcaae('0x19')},'announce_holdtime':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no',_0xcaae('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0xcaae('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xcaae('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xcaae('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xcaae('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xcaae('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xcaae('0x2')]},'queue_less_than':{'type':Sequelize[_0xcaae('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2e4c8d){this['setDataValue']('periodic_announce',_0x2e4c8d?_0x2e4c8d[_0xcaae('0x1c')](','):[]);},'get':function(){return this[_0xcaae('0x11')]('periodic_announce')?this[_0xcaae('0x11')](_0xcaae('0x1d'))[_0xcaae('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xcaae('0x19'),'set':function(_0x52df4d){this[_0xcaae('0xf')](_0xcaae('0x1f'),_0x52df4d?_0x52df4d[_0xcaae('0x1c')](','):undefined);},'get':function(){return this[_0xcaae('0x11')](_0xcaae('0x1f'))?this[_0xcaae('0x11')]('joinempty')[_0xcaae('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x396583){this['setDataValue'](_0xcaae('0x20'),_0x396583?_0x396583[_0xcaae('0x1c')](','):undefined);},'get':function(){return this[_0xcaae('0x11')](_0xcaae('0x20'))?this['getDataValue'](_0xcaae('0x20'))[_0xcaae('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xcaae('0x7')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xcaae('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':0x0,'set':function(_0xf78aff){this[_0xcaae('0xf')](_0xcaae('0x22'),_0xf78aff);if(_0xf78aff){if(this['getDataValue'](_0xcaae('0x23'))<0x2){this[_0xcaae('0xf')](_0xcaae('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xcaae('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':0x0,'comment':_0xcaae('0x24')},'dialMethod':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x14'),'progressive',_0xcaae('0x25'),'predictive',_0xcaae('0x15')),'defaultValue':_0xcaae('0x26'),'comment':_0xcaae('0x27')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xcaae('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xcaae('0x18')](0x4)[_0xcaae('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xcaae('0x29')},'dialPowerLevel':{'type':Sequelize[_0xcaae('0x2a')](0x2)[_0xcaae('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xcaae('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0xcaae('0x7')](_0xcaae('0x2c'),'dropRate'),'defaultValue':_0xcaae('0x2d'),'comment':_0xcaae('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xcaae('0x2a')](0x2)[_0xcaae('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xcaae('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0xcaae('0x18')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xcaae('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0xcaae('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xcaae('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaae('0x31')},'dialQueueOptions':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':_0xcaae('0x32'),'comment':_0xcaae('0x33')},'dialQueueTimeout':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xcaae('0x2')],'comment':_0xcaae('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xcaae('0x18')](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaae('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xcaae('0x18')](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaae('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcaae('0x28')],'defaultValue':0x3,'comment':_0xcaae('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xcaae('0x18')](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaae('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xcaae('0x39')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':_0xcaae('0x3a')},'dialPrefix':{'type':Sequelize[_0xcaae('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xcaae('0x3b'),_0xcaae('0x3c'),_0xcaae('0x3d')),'defaultValue':_0xcaae('0x3b')},'dialAMDActive':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':0x0,'comment':_0xcaae('0x3e')},'dialAMDInitialSilence':{'type':Sequelize[_0xcaae('0x18')](0x9)[_0xcaae('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xcaae('0x3f')},'dialAMDGreeting':{'type':Sequelize[_0xcaae('0x18')](0x9)[_0xcaae('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xcaae('0x40')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xcaae('0x18')](0x9)[_0xcaae('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xcaae('0x41')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcaae('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcaae('0x42')},'dialAMDMinWordLength':{'type':Sequelize[_0xcaae('0x18')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xcaae('0x43')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xcaae('0x18')](0x9)[_0xcaae('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xcaae('0x18')](0x9)[_0xcaae('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xcaae('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xcaae('0x44')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xcaae('0x18')](0x9)[_0xcaae('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcaae('0x45')},'dialRecallMeTimeout':{'type':Sequelize[_0xcaae('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':0x0,'comment':_0xcaae('0x46')},'dialOrderByScheduledAt':{'type':Sequelize[_0xcaae('0x7')]('DESC',_0xcaae('0x47')),'defaultValue':_0xcaae('0x48')},'dialQueueProject2':{'type':Sequelize[_0xcaae('0x2')],'comment':_0xcaae('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xcaae('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcaae('0x49')},'dialCutDigit':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcaae('0x4a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaae('0x4b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcaae('0x18')](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaae('0x4c')},'dialDropMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xcaae('0x18')](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaae('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaae('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcaae('0x18')](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaae('0x4f')},'dialMachineMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaae('0x50')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaae('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaae('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcaae('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcaae('0x18')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':![],'comment':_0xcaae('0x53'),'set':function(_0x56be10){if(!_0x56be10)this[_0xcaae('0xf')](_0xcaae('0x54'),null);this[_0xcaae('0xf')](_0xcaae('0x55'),_0x56be10);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xcaae('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xcaae('0x18')](0x3)[_0xcaae('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xcaae('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5f94b59..e127680 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 _0x4745=['autoAssociation','clone','params','omit','createdAt','updatedAt','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','User','online','voicePause','interface','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','destroy','userVoiceQueue:remove','addAgents','spread','push','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','from','cm_contacts','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','deletedAt\x20IS\x20NULL','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','filter','includes','type','find','UserProfileResource','end','error','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VoiceQueue','includeAll','include','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','value'];(function(_0xfca6a9,_0x563456){var _0x2723c4=function(_0x4af419){while(--_0x4af419){_0xfca6a9['push'](_0xfca6a9['shift']());}};_0x2723c4(++_0x563456);}(_0x4745,0x1e7));var _0x5474=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4745[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x5474('0x0'));var rimraf=require(_0x5474('0x1'));var zipdir=require(_0x5474('0x2'));var jsonpatch=require(_0x5474('0x3'));var rp=require(_0x5474('0x4'));var moment=require(_0x5474('0x5'));var BPromise=require(_0x5474('0x6'));var Mustache=require(_0x5474('0x7'));var util=require(_0x5474('0x8'));var path=require(_0x5474('0x9'));var sox=require(_0x5474('0xa'));var csv=require(_0x5474('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5474('0xc'));var _=require(_0x5474('0xd'));var squel=require('squel');var crypto=require(_0x5474('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5474('0xf'));var toCsv=require(_0x5474('0xb'));var querystring=require('querystring');var Papa=require(_0x5474('0x10'));var Redis=require(_0x5474('0x11'));var authService=require(_0x5474('0x12'));var qs=require(_0x5474('0x13'));var as=require(_0x5474('0x14'));var hardwareService=require(_0x5474('0x15'));var logger=require(_0x5474('0x16'))(_0x5474('0x17'));var utils=require('../../config/utils');var config=require(_0x5474('0x18'));var licenseUtil=require(_0x5474('0x19'));var db=require(_0x5474('0x1a'))['db'];config[_0x5474('0x1b')]=_[_0x5474('0x1c')](config[_0x5474('0x1b')],{'host':_0x5474('0x1d'),'port':0x18eb});var socket=require(_0x5474('0x1e'))(new Redis(config[_0x5474('0x1b')]));require('./voiceQueue.socket')[_0x5474('0x1f')](socket);function respondWithStatusCode(_0x17e424,_0x2ce218){_0x2ce218=_0x2ce218||0xcc;return function(_0x1790eb){if(_0x1790eb){return _0x17e424['sendStatus'](_0x2ce218);}return _0x17e424['status'](_0x2ce218)['end']();};}function respondWithResult(_0x50eb42,_0x32f0e4){_0x32f0e4=_0x32f0e4||0xc8;return function(_0x172bcb){if(_0x172bcb){return _0x50eb42[_0x5474('0x20')](_0x32f0e4)['json'](_0x172bcb);}};}function respondWithFilteredResult(_0x3da004,_0x2be746){return function(_0x56dbfa){if(_0x56dbfa){var _0x22b37d=typeof _0x2be746[_0x5474('0x21')]===_0x5474('0x22')&&typeof _0x2be746[_0x5474('0x23')]===_0x5474('0x22');var _0x4ab269=_0x56dbfa[_0x5474('0x24')];var _0x5f31a9=_0x22b37d?0x0:_0x2be746[_0x5474('0x21')];var _0x178e5c=_0x22b37d?_0x56dbfa['count']:_0x2be746['offset']+_0x2be746['limit'];var _0x1f81d6;if(_0x178e5c>=_0x4ab269){_0x178e5c=_0x4ab269;_0x1f81d6=0xc8;}else{_0x1f81d6=0xce;}_0x3da004[_0x5474('0x20')](_0x1f81d6);return _0x3da004[_0x5474('0x25')](_0x5474('0x26'),_0x5f31a9+'-'+_0x178e5c+'/'+_0x4ab269)[_0x5474('0x27')](_0x56dbfa);}return null;};}function patchUpdates(_0x24db35){return function(_0xe4850d){try{jsonpatch[_0x5474('0x28')](_0xe4850d,_0x24db35,!![]);}catch(_0x219be1){return BPromise[_0x5474('0x29')](_0x219be1);}return _0xe4850d['save']();};}function saveUpdates(_0x5f065d,_0x337c5b){return function(_0x266465){if(_0x266465){return _0x266465[_0x5474('0x2a')](_0x5f065d)['then'](function(_0x24997a){return _0x24997a;});}return null;};}function removeEntity(_0x49f691,_0xa95a2){return function(_0x23dbc5){if(_0x23dbc5){return _0x23dbc5['destroy']()[_0x5474('0x2b')](function(){var _0x5d4cd7=_0x23dbc5[_0x5474('0x2c')]({'plain':!![]});var _0x5efa8d=[{'name':_0x5474('0x2d'),'value':_0x5474('0x2e'),'ignore':![]},{'name':_0x5474('0x2f'),'value':'outbound','ignore':![]}];var _0x574ed6=_(_0x5efa8d)[_0x5474('0x30')]('ignore')['map']('value')['value']();if(_[_0x5474('0x31')](_0x574ed6,_0x5d4cd7[_0x5474('0x32')])){return;}var _0x54cd0c=_[_0x5474('0x33')](_0x5efa8d,['value',_0x5d4cd7[_0x5474('0x32')]])['name'];return db[_0x5474('0x34')]['destroy']({'where':{'type':_0x54cd0c,'resourceId':_0x5d4cd7['id']}})[_0x5474('0x2b')](function(){return _0x23dbc5;});})['then'](function(){_0x49f691[_0x5474('0x20')](0xcc)[_0x5474('0x35')]();});}};}function handleEntityNotFound(_0x3487ca,_0x45469c){return function(_0x5b85b8){if(!_0x5b85b8){_0x3487ca['sendStatus'](0x194);}return _0x5b85b8;};}function handleError(_0x44e089,_0x1167c0){_0x1167c0=_0x1167c0||0x1f4;return function(_0x42b931){logger[_0x5474('0x36')](_0x42b931['stack']);if(_0x42b931['name']){delete _0x42b931[_0x5474('0x37')];}_0x44e089[_0x5474('0x20')](_0x1167c0)['send'](_0x42b931);};}exports[_0x5474('0x38')]=function(_0x26d752,_0x391c7e){var _0xc5fb7={},_0x4d32ce={},_0xe655ac={'count':0x0,'rows':[]};var _0x409111=_[_0x5474('0x39')](db['VoiceQueue'][_0x5474('0x3a')],function(_0x2b8d66){return{'name':_0x2b8d66[_0x5474('0x3b')],'type':_0x2b8d66[_0x5474('0x32')]['key']};});_0x4d32ce['model']=_[_0x5474('0x39')](_0x409111,_0x5474('0x37'));_0x4d32ce[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x26d752['query']);_0x4d32ce[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x4d32ce[_0x5474('0x40')],_0x4d32ce[_0x5474('0x3c')]);_0xc5fb7['attributes']=_['intersection'](_0x4d32ce['model'],qs[_0x5474('0x41')](_0x26d752['query'][_0x5474('0x41')]));_0xc5fb7[_0x5474('0x42')]=_0xc5fb7[_0x5474('0x42')][_0x5474('0x43')]?_0xc5fb7[_0x5474('0x42')]:_0x4d32ce[_0x5474('0x40')];if(!_0x26d752[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0xc5fb7['limit']=qs[_0x5474('0x23')](_0x26d752[_0x5474('0x3c')][_0x5474('0x23')]);_0xc5fb7[_0x5474('0x21')]=qs['offset'](_0x26d752[_0x5474('0x3c')]['offset']);}_0xc5fb7[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x26d752['query'][_0x5474('0x47')]);_0xc5fb7[_0x5474('0x48')]=qs['filters'](_[_0x5474('0x49')](_0x26d752[_0x5474('0x3c')],_0x4d32ce['filters']),_0x409111);if(_0x26d752[_0x5474('0x3c')]['filter']){_0xc5fb7[_0x5474('0x48')]=_[_0x5474('0x4a')](_0xc5fb7['where'],{'$or':_[_0x5474('0x39')](_0x409111,function(_0xb8a084){if(_0xb8a084[_0x5474('0x32')]!=='VIRTUAL'){var _0x279e1f={};_0x279e1f[_0xb8a084[_0x5474('0x37')]]={'$like':'%'+_0x26d752[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x279e1f;}})});}_0xc5fb7=_['merge']({},_0xc5fb7,_0x26d752['options']);var _0x2544fc={'where':_0xc5fb7['where']};return db[_0x5474('0x4b')][_0x5474('0x24')](_0x2544fc)['then'](function(_0x8e611a){_0xe655ac[_0x5474('0x24')]=_0x8e611a;if(_0x26d752['query'][_0x5474('0x4c')]){_0xc5fb7[_0x5474('0x4d')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0xc5fb7);})[_0x5474('0x2b')](function(_0x355421){_0xe655ac['rows']=_0x355421;return _0xe655ac;})[_0x5474('0x2b')](respondWithFilteredResult(_0x391c7e,_0xc5fb7))[_0x5474('0x4e')](handleError(_0x391c7e,null));};exports[_0x5474('0x4f')]=function(_0x46bde7,_0x52863b){var _0x1b423c={'raw':![],'where':{'id':_0x46bde7['params']['id']}},_0xe884b6={};_0xe884b6[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x4b')][_0x5474('0x3a')]);_0xe884b6[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x46bde7[_0x5474('0x3c')]);_0xe884b6[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0xe884b6[_0x5474('0x40')],_0xe884b6[_0x5474('0x3c')]);_0x1b423c[_0x5474('0x42')]=_['intersection'](_0xe884b6[_0x5474('0x40')],qs[_0x5474('0x41')](_0x46bde7[_0x5474('0x3c')][_0x5474('0x41')]));_0x1b423c['attributes']=_0x1b423c[_0x5474('0x42')][_0x5474('0x43')]?_0x1b423c[_0x5474('0x42')]:_0xe884b6[_0x5474('0x40')];if(_0x46bde7[_0x5474('0x3c')][_0x5474('0x4c')]){_0x1b423c[_0x5474('0x4d')]=[{'all':!![]}];}_0x1b423c=_[_0x5474('0x4a')]({},_0x1b423c,_0x46bde7[_0x5474('0x50')]);return db[_0x5474('0x4b')][_0x5474('0x33')](_0x1b423c)[_0x5474('0x2b')](handleEntityNotFound(_0x52863b,null))[_0x5474('0x2b')](respondWithResult(_0x52863b,null))['catch'](handleError(_0x52863b,null));};exports['create']=function(_0x570e89,_0x615418){return db[_0x5474('0x4b')][_0x5474('0x51')](_0x570e89[_0x5474('0x52')],{})[_0x5474('0x2b')](function(_0x574b1e){var _0x32798f=_0x570e89[_0x5474('0x53')][_0x5474('0x2c')]({'plain':!![]});if(!_0x32798f)throw new Error(_0x5474('0x54'));if(_0x32798f['role']===_0x5474('0x53')){var _0xe63e02=_0x574b1e[_0x5474('0x2c')]({'plain':!![]});var _0x37e1bc=[{'name':_0x5474('0x2d'),'value':_0x5474('0x2e')},{'name':'QueueCampaigns','value':'outbound'}];var _0x27dd7f=_['find'](_0x37e1bc,[_0x5474('0x55'),_0xe63e02[_0x5474('0x32')]])[_0x5474('0x37')];return db['UserProfileSection'][_0x5474('0x33')]({'where':{'name':_0x27dd7f,'userProfileId':_0x32798f['userProfileId']},'raw':!![]})[_0x5474('0x2b')](function(_0x1a6201){if(_0x1a6201&&_0x1a6201[_0x5474('0x56')]===0x0){return db[_0x5474('0x34')][_0x5474('0x51')]({'name':_0xe63e02[_0x5474('0x37')],'resourceId':_0xe63e02['id'],'type':_0x1a6201[_0x5474('0x37')],'sectionId':_0x1a6201['id']},{})['then'](function(){return _0x574b1e;});}else{return _0x574b1e;}})['catch'](function(_0x34f95c){logger[_0x5474('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34f95c);throw _0x34f95c;});}return _0x574b1e;})[_0x5474('0x2b')](respondWithResult(_0x615418,0xc9))[_0x5474('0x4e')](handleError(_0x615418,null));};exports[_0x5474('0x57')]=function(_0x4ec2a3,_0x549184){var _0x27e27d={'where':{'id':_0x4ec2a3[_0x5474('0x58')]['id']}},_0x5a1551={};_0x5a1551['model']=_[_0x5474('0x3d')](db[_0x5474('0x4b')][_0x5474('0x3a')]);_0x27e27d['attributes']=_['intersection'](_0x5a1551[_0x5474('0x40')],qs[_0x5474('0x41')](_0x4ec2a3['query'][_0x5474('0x41')]));_0x27e27d[_0x5474('0x42')]=_0x27e27d[_0x5474('0x42')][_0x5474('0x43')]?_0x27e27d[_0x5474('0x42')]:_0x5a1551[_0x5474('0x40')];if(_0x4ec2a3['query'][_0x5474('0x4c')]){_0x27e27d[_0x5474('0x4d')]=[{'all':!![]}];}_0x27e27d=_['merge']({},_0x27e27d,_0x4ec2a3[_0x5474('0x50')]);return db[_0x5474('0x4b')]['find'](_0x27e27d)['then'](handleEntityNotFound(_0x549184,null))[_0x5474('0x2b')](function(_0x4f37d5){if(_0x4f37d5){var _0x298c0c=_0x4f37d5[_0x5474('0x2c')]({'plain':!![]});_0x298c0c=qs[_0x5474('0x59')](_0x298c0c,['id',_0x5474('0x5a'),_0x5474('0x5b')]);_0x4ec2a3[_0x5474('0x52')]=_['omit'](_0x4ec2a3['body'],['id',_0x5474('0x5a'),_0x5474('0x5b')]);return db[_0x5474('0x4b')][_0x5474('0x51')](_[_0x5474('0x4a')](_0x298c0c,_0x4ec2a3[_0x5474('0x52')]),{'include':_0x4ec2a3[_0x5474('0x3c')][_0x5474('0x4c')]?[{'all':!![]}]:undefined})[_0x5474('0x2b')](function(_0x1dac34){var _0x59e85e=_0x4ec2a3[_0x5474('0x53')]['get']({'plain':!![]});if(!_0x59e85e)throw new Error(_0x5474('0x54'));if(_0x59e85e[_0x5474('0x5c')]==='user'){var _0x1f7e38=_0x1dac34['get']({'plain':!![]});var _0x4e1bc7=[{'name':_0x5474('0x2d'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x5474('0x5d')}];var _0x18a99a=_[_0x5474('0x33')](_0x4e1bc7,[_0x5474('0x55'),_0x1f7e38['type']])[_0x5474('0x37')];return db[_0x5474('0x5e')][_0x5474('0x33')]({'where':{'name':_0x18a99a,'userProfileId':_0x59e85e[_0x5474('0x5f')]},'raw':!![]})[_0x5474('0x2b')](function(_0x1a5ac0){if(_0x1a5ac0&&_0x1a5ac0['autoAssociation']===0x0){return db[_0x5474('0x34')]['create']({'name':_0x1f7e38[_0x5474('0x37')],'resourceId':_0x1f7e38['id'],'type':_0x1a5ac0[_0x5474('0x37')],'sectionId':_0x1a5ac0['id']},{})['then'](function(){return _0x1dac34;});}else{return _0x1dac34;}})['catch'](function(_0x3679c4){logger[_0x5474('0x36')](_0x5474('0x60'),_0x3679c4);throw _0x3679c4;});}return _0x1dac34;});}})[_0x5474('0x2b')](respondWithResult(_0x549184,0xc9))[_0x5474('0x4e')](handleError(_0x549184,null));};exports[_0x5474('0x2a')]=function(_0x472c86,_0x5a5a94){if(_0x472c86['body']['id']){delete _0x472c86[_0x5474('0x52')]['id'];}return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0x472c86[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x5a5a94,null))[_0x5474('0x2b')](saveUpdates(_0x472c86[_0x5474('0x52')],null))[_0x5474('0x2b')](respondWithResult(_0x5a5a94,null))[_0x5474('0x4e')](handleError(_0x5a5a94,null));};exports['destroy']=function(_0x50e625,_0x55e5a3){return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x50e625['params']['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x55e5a3,null))[_0x5474('0x2b')](removeEntity(_0x55e5a3,null))[_0x5474('0x4e')](handleError(_0x55e5a3,null));};exports[_0x5474('0x61')]=function(_0x4493ec,_0xa0bf7,_0x53b5b2){var _0x455255={'raw':![],'where':{}};var _0x41288e={};var _0x35d950={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5474('0x62')]({'where':{'id':_0x4493ec[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0xa0bf7,null))['then'](function(_0xe604df){if(_0xe604df){_0x41288e[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x63')][_0x5474('0x3a')]);_0x41288e[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x4493ec['query']);_0x41288e[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x41288e[_0x5474('0x40')],_0x41288e[_0x5474('0x3c')]);_0x455255[_0x5474('0x42')]=_['intersection'](_0x41288e[_0x5474('0x40')],qs[_0x5474('0x41')](_0x4493ec[_0x5474('0x3c')][_0x5474('0x41')]));_0x455255[_0x5474('0x42')]=_0x455255['attributes'][_0x5474('0x43')]?_0x455255[_0x5474('0x42')]:_0x41288e[_0x5474('0x40')];if(!_0x4493ec[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0x455255[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x4493ec[_0x5474('0x3c')]['limit']);_0x455255['offset']=qs[_0x5474('0x21')](_0x4493ec[_0x5474('0x3c')][_0x5474('0x21')]);}_0x455255[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x4493ec[_0x5474('0x3c')]['sort']);_0x455255[_0x5474('0x48')]=qs['filters'](_[_0x5474('0x49')](_0x4493ec[_0x5474('0x3c')],_0x41288e[_0x5474('0x3e')]));_0x455255['where'][_0x5474('0x64')]=_0xe604df['id'];if(_0x4493ec[_0x5474('0x3c')][_0x5474('0x30')]){_0x455255['where']=_[_0x5474('0x4a')](_0x455255[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x455255['attributes'],function(_0x4952ea){var _0x53743a={};_0x53743a[_0x4952ea]={'$like':'%'+_0x4493ec[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x53743a;})});}_0x455255=_[_0x5474('0x4a')]({},_0x455255,_0x4493ec[_0x5474('0x50')]);return db[_0x5474('0x63')][_0x5474('0x24')]({'where':_0x455255[_0x5474('0x48')]})['then'](function(_0x42ed1e){_0x35d950[_0x5474('0x24')]=_0x42ed1e;if(_0x4493ec[_0x5474('0x3c')][_0x5474('0x4c')]){_0x455255[_0x5474('0x4d')]=[{'all':!![]}];}return db[_0x5474('0x63')][_0x5474('0x65')](_0x455255);})[_0x5474('0x2b')](function(_0x16adff){_0x35d950[_0x5474('0x66')]=_0x16adff;return _0x35d950;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0xa0bf7,_0x455255))[_0x5474('0x4e')](handleError(_0xa0bf7,null));};exports[_0x5474('0x67')]=function(_0x2c9fbe,_0x947657,_0x146e15){var _0x7cfabc={'raw':!![],'where':{}};var _0x19aa83={};var _0x1de17a={'count':0x0,'rows':[]};return db[_0x5474('0x4b')]['findOne']({'where':{'id':_0x2c9fbe[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x947657,null))[_0x5474('0x2b')](function(_0x569630){if(_0x569630){_0x19aa83['model']=_[_0x5474('0x3d')](db['CmHopperHistory'][_0x5474('0x3a')]);_0x19aa83[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x2c9fbe[_0x5474('0x3c')]);_0x19aa83[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x19aa83[_0x5474('0x40')],_0x19aa83[_0x5474('0x3c')]);_0x7cfabc[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x19aa83[_0x5474('0x40')],qs['fields'](_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x41')]));_0x7cfabc[_0x5474('0x42')]=_0x7cfabc[_0x5474('0x42')][_0x5474('0x43')]?_0x7cfabc[_0x5474('0x42')]:_0x19aa83['model'];if(!_0x2c9fbe[_0x5474('0x3c')]['hasOwnProperty'](_0x5474('0x45'))){_0x7cfabc['limit']=qs[_0x5474('0x23')](_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x23')]);_0x7cfabc[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x21')]);}_0x7cfabc[_0x5474('0x46')]=qs['sort'](_0x2c9fbe['query'][_0x5474('0x47')]);_0x7cfabc['where']=qs[_0x5474('0x3e')](_['pick'](_0x2c9fbe['query'],_0x19aa83[_0x5474('0x3e')]));_0x7cfabc[_0x5474('0x48')][_0x5474('0x64')]=_0x569630['id'];if(_0x2c9fbe[_0x5474('0x3c')]['filter']){_0x7cfabc[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x7cfabc['where'],{'$or':_[_0x5474('0x39')](_0x7cfabc[_0x5474('0x42')],function(_0xf9e715){var _0x1ec2ae={};_0x1ec2ae[_0xf9e715]={'$like':'%'+_0x2c9fbe['query'][_0x5474('0x30')]+'%'};return _0x1ec2ae;})});}_0x7cfabc=_[_0x5474('0x4a')]({},_0x7cfabc,_0x2c9fbe[_0x5474('0x50')]);return db['CmHopperHistory'][_0x5474('0x24')]({'where':_0x7cfabc['where']})['then'](function(_0x11b067){_0x1de17a[_0x5474('0x24')]=_0x11b067;if(_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x4c')]){_0x7cfabc[_0x5474('0x4d')]=[{'all':!![]}];}return db[_0x5474('0x68')][_0x5474('0x65')](_0x7cfabc);})[_0x5474('0x2b')](function(_0xbf4ac3){_0x1de17a[_0x5474('0x66')]=_0xbf4ac3;return _0x1de17a;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0x947657,_0x7cfabc))[_0x5474('0x4e')](handleError(_0x947657,null));};exports[_0x5474('0x69')]=function(_0x264981,_0x2c555a,_0x1057ab){var _0x2f32c6={'raw':!![],'where':{}};var _0x583292={};var _0x4dcbf0={'count':0x0,'rows':[]};return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x264981[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x2c555a,null))[_0x5474('0x2b')](function(_0xfa5749){if(_0xfa5749){_0x583292[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x6a')]['rawAttributes']);_0x583292[_0x5474('0x3c')]=_['keys'](_0x264981['query']);_0x583292[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x583292[_0x5474('0x40')],_0x583292[_0x5474('0x3c')]);_0x2f32c6[_0x5474('0x42')]=_['intersection'](_0x583292[_0x5474('0x40')],qs[_0x5474('0x41')](_0x264981[_0x5474('0x3c')]['fields']));_0x2f32c6[_0x5474('0x42')]=_0x2f32c6[_0x5474('0x42')][_0x5474('0x43')]?_0x2f32c6['attributes']:_0x583292[_0x5474('0x40')];if(!_0x264981[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0x2f32c6[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x264981[_0x5474('0x3c')][_0x5474('0x23')]);_0x2f32c6['offset']=qs[_0x5474('0x21')](_0x264981[_0x5474('0x3c')][_0x5474('0x21')]);}_0x2f32c6['order']=qs[_0x5474('0x47')](_0x264981[_0x5474('0x3c')][_0x5474('0x47')]);_0x2f32c6[_0x5474('0x48')]=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x264981[_0x5474('0x3c')],_0x583292[_0x5474('0x3e')]));_0x2f32c6['where'][_0x5474('0x64')]=_0xfa5749['id'];if(_0x264981['query']['filter']){_0x2f32c6[_0x5474('0x48')]=_['merge'](_0x2f32c6['where'],{'$or':_[_0x5474('0x39')](_0x2f32c6[_0x5474('0x42')],function(_0x22a7f3){var _0x32aef7={};_0x32aef7[_0x22a7f3]={'$like':'%'+_0x264981[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x32aef7;})});}_0x2f32c6=_['merge']({},_0x2f32c6,_0x264981['options']);return db[_0x5474('0x6a')][_0x5474('0x24')]({'where':_0x2f32c6[_0x5474('0x48')]})['then'](function(_0x5a3c9c){_0x4dcbf0[_0x5474('0x24')]=_0x5a3c9c;if(_0x264981[_0x5474('0x3c')][_0x5474('0x4c')]){_0x2f32c6[_0x5474('0x4d')]=[{'all':!![]}];}return db[_0x5474('0x6a')][_0x5474('0x65')](_0x2f32c6);})[_0x5474('0x2b')](function(_0x8b9bb2){_0x4dcbf0[_0x5474('0x66')]=_0x8b9bb2;return _0x4dcbf0;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0x2c555a,_0x2f32c6))[_0x5474('0x4e')](handleError(_0x2c555a,null));};exports[_0x5474('0x6b')]=function(_0x37ddd1,_0x57b277,_0xba6b85){var _0x4e0692={'raw':!![],'where':{}};var _0x2518b5={};var _0x4fdaa8={'count':0x0,'rows':[]};return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x37ddd1[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x57b277,null))[_0x5474('0x2b')](function(_0x33ebef){if(_0x33ebef){_0x2518b5[_0x5474('0x40')]=_[_0x5474('0x3d')](db['CmHopperBlack'][_0x5474('0x3a')]);_0x2518b5[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x37ddd1[_0x5474('0x3c')]);_0x2518b5[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x2518b5[_0x5474('0x40')],_0x2518b5[_0x5474('0x3c')]);_0x4e0692[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x2518b5[_0x5474('0x40')],qs[_0x5474('0x41')](_0x37ddd1[_0x5474('0x3c')]['fields']));_0x4e0692[_0x5474('0x42')]=_0x4e0692[_0x5474('0x42')][_0x5474('0x43')]?_0x4e0692[_0x5474('0x42')]:_0x2518b5[_0x5474('0x40')];if(!_0x37ddd1['query'][_0x5474('0x44')](_0x5474('0x45'))){_0x4e0692[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x37ddd1['query'][_0x5474('0x23')]);_0x4e0692[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x37ddd1[_0x5474('0x3c')]['offset']);}_0x4e0692[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x37ddd1['query']['sort']);_0x4e0692['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x37ddd1[_0x5474('0x3c')],_0x2518b5['filters']));_0x4e0692[_0x5474('0x48')][_0x5474('0x64')]=_0x33ebef['id'];if(_0x37ddd1[_0x5474('0x3c')][_0x5474('0x30')]){_0x4e0692[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x4e0692[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x4e0692[_0x5474('0x42')],function(_0x125664){var _0x4cbdc2={};_0x4cbdc2[_0x125664]={'$like':'%'+_0x37ddd1[_0x5474('0x3c')]['filter']+'%'};return _0x4cbdc2;})});}_0x4e0692=_[_0x5474('0x4a')]({},_0x4e0692,_0x37ddd1[_0x5474('0x50')]);return db[_0x5474('0x6c')][_0x5474('0x24')]({'where':_0x4e0692['where']})[_0x5474('0x2b')](function(_0x3773b6){_0x4fdaa8[_0x5474('0x24')]=_0x3773b6;if(_0x37ddd1[_0x5474('0x3c')][_0x5474('0x4c')]){_0x4e0692['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4e0692);})['then'](function(_0x425c7d){_0x4fdaa8['rows']=_0x425c7d;return _0x4fdaa8;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0x57b277,_0x4e0692))[_0x5474('0x4e')](handleError(_0x57b277,null));};exports['getTeams']=function(_0x29517a,_0x8fc2a1,_0x22860d){var _0x1e1760={};var _0x3d0e2d={};var _0x38bc81;var _0x125ae5;return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x29517a['params']['id']}})['then'](handleEntityNotFound(_0x8fc2a1,null))[_0x5474('0x2b')](function(_0x370519){if(_0x370519){_0x38bc81=_0x370519;_0x3d0e2d['model']=_[_0x5474('0x3d')](db[_0x5474('0x6d')]['rawAttributes']);_0x3d0e2d[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x29517a[_0x5474('0x3c')]);_0x3d0e2d[_0x5474('0x3e')]=_['intersection'](_0x3d0e2d[_0x5474('0x40')],_0x3d0e2d[_0x5474('0x3c')]);_0x1e1760[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x3d0e2d[_0x5474('0x40')],qs['fields'](_0x29517a['query']['fields']));_0x1e1760[_0x5474('0x42')]=_0x1e1760[_0x5474('0x42')][_0x5474('0x43')]?_0x1e1760[_0x5474('0x42')]:_0x3d0e2d[_0x5474('0x40')];_0x1e1760[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x29517a['query'][_0x5474('0x47')]);_0x1e1760[_0x5474('0x48')]=qs['filters'](_[_0x5474('0x49')](_0x29517a[_0x5474('0x3c')],_0x3d0e2d[_0x5474('0x3e')]));if(_0x29517a[_0x5474('0x3c')]['filter']){_0x1e1760['where']=_[_0x5474('0x4a')](_0x1e1760['where'],{'$or':_[_0x5474('0x39')](_0x1e1760[_0x5474('0x42')],function(_0xf88699){var _0x3a5503={};_0x3a5503[_0xf88699]={'$like':'%'+_0x29517a[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x3a5503;})});}_0x1e1760=_[_0x5474('0x4a')]({},_0x1e1760,_0x29517a[_0x5474('0x50')]);return _0x38bc81[_0x5474('0x6e')](_0x1e1760);}})[_0x5474('0x2b')](function(_0x34e972){if(_0x34e972){_0x125ae5=_0x34e972[_0x5474('0x43')];if(!_0x29517a[_0x5474('0x3c')][_0x5474('0x44')]('nolimit')){_0x1e1760[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x29517a[_0x5474('0x3c')][_0x5474('0x23')]);_0x1e1760[_0x5474('0x21')]=qs['offset'](_0x29517a['query'][_0x5474('0x21')]);}return _0x38bc81[_0x5474('0x6e')](_0x1e1760);}})[_0x5474('0x2b')](function(_0x20fbf8){if(_0x20fbf8){return _0x20fbf8?{'count':_0x125ae5,'rows':_0x20fbf8}:null;}})[_0x5474('0x2b')](respondWithResult(_0x8fc2a1,null))['catch'](handleError(_0x8fc2a1,null));};exports['addTeams']=function(_0x68babe,_0x150ade,_0x12e5ea){var _0x18d312=_0x68babe[_0x5474('0x52')]['teams'];var _0x1dd90d=_[_0x5474('0x39')](_0x18d312,'id');return db[_0x5474('0x6d')][_0x5474('0x65')]({'where':{'id':_0x1dd90d},'attributes':['id'],'include':[{'model':db[_0x5474('0x6f')],'as':'Agents','attributes':['id','name',_0x5474('0x70'),_0x5474('0x71'),_0x5474('0x72')],'raw':!![]}]})[_0x5474('0x2b')](function(_0x22f8c0){if(_0x22f8c0){var _0x5c2ca4=_['flatMap'](_0x22f8c0,function(_0x1f6b99){var _0x4e876e=_0x1f6b99[_0x5474('0x2c')]({'plain':!![]});_0x4e876e[_0x5474('0x73')]['forEach'](function(_0x1ce03c){_0x1ce03c[_0x5474('0x74')]=_[_0x5474('0x33')](_0x18d312,{'id':_0x4e876e['id']})['penalty'];});return _0x4e876e[_0x5474('0x73')];});return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x68babe[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](function(_0x28c6de){return db[_0x5474('0x75')][_0x5474('0x76')](function(_0x14fa88){return _0x28c6de['addTeams'](_0x1dd90d,{'transaction':_0x14fa88})[_0x5474('0x2b')](function(){return BPromise[_0x5474('0x77')](_0x18d312,function(_0x3e78fc){return db[_0x5474('0x78')][_0x5474('0x79')]({'TeamId':_0x3e78fc['id'],'VoiceQueueId':_0x68babe[_0x5474('0x58')]['id'],'penalty':_0x3e78fc[_0x5474('0x74')]},{'transaction':_0x14fa88});});})[_0x5474('0x2b')](function(){return BPromise[_0x5474('0x77')](_0x5c2ca4,function(_0x1b02a2){return db[_0x5474('0x7a')]['findOrCreate']({'where':{'UserId':_0x1b02a2['id'],'VoiceQueueId':_0x68babe[_0x5474('0x58')]['id']},'defaults':{'penalty':_0x1b02a2[_0x5474('0x74')]},'transaction':_0x14fa88});});})[_0x5474('0x2b')](function(){return BPromise['each'](_[_0x5474('0x30')](_0x5c2ca4,{'online':!![]}),function(_0x16cd00){return db[_0x5474('0x7b')][_0x5474('0x79')]({'membername':_0x16cd00[_0x5474('0x37')],'UserId':_0x16cd00['id'],'queue_name':_0x28c6de[_0x5474('0x37')],'VoiceQueueId':_0x28c6de['id'],'interface':_[_0x5474('0x7c')](_0x16cd00[_0x5474('0x72')])?util[_0x5474('0x7d')](_0x5474('0x7e'),_0x16cd00[_0x5474('0x37')]):_0x16cd00['interface'],'paused':_0x16cd00[_0x5474('0x71')]||![],'penalty':_0x16cd00[_0x5474('0x74')]},{'transaction':_0x14fa88});});})['then'](function(){_0x5c2ca4[_0x5474('0x7f')](function(_0x490a9b){socket[_0x5474('0x80')](_0x5474('0x81'),{'UserId':_0x490a9b['id'],'VoiceQueueId':_0x28c6de['id']});});});});});}})[_0x5474('0x2b')](respondWithStatusCode(_0x150ade,null))[_0x5474('0x4e')](handleError(_0x150ade,null));};exports[_0x5474('0x82')]=function(_0x1e7249,_0x2ea2ca,_0xe1925){return db[_0x5474('0x6d')][_0x5474('0x65')]({'where':{'id':_0x1e7249['query'][_0x5474('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ea2ca,null))[_0x5474('0x2b')](function(_0x230523){var _0x3fd78b=_[_0x5474('0x39')](_0x230523,'id');var _0x4376e2=[];var _0x282350=[];var _0x27a87b=squel[_0x5474('0x84')]();_0x27a87b[_0x5474('0x85')](_0x5474('0x86'))['from']('team_has_voice_queues','tq')[_0x5474('0x87')](_0x5474('0x88'),'ut',_0x5474('0x89'))['where']('VoiceQueueId\x20=\x20?',_0x1e7249[_0x5474('0x58')]['id']);for(var _0x4a01e9=0x0;_0x4a01e9<_0x230523['length'];_0x4a01e9+=0x1){let _0x333c80=_0x230523[_0x4a01e9];for(var _0x58c157=0x0;_0x58c157<_0x333c80[_0x5474('0x73')][_0x5474('0x43')];_0x58c157+=0x1){let _0x55e233=_0x333c80[_0x5474('0x73')][_0x58c157];var _0x4dc322=_0x27a87b[_0x5474('0x57')]();_0x4dc322[_0x5474('0x48')](_0x5474('0x8a'),_0x55e233['id']);_0x282350['push'](db[_0x5474('0x75')][_0x5474('0x3c')](_0x4dc322[_0x5474('0x8b')](),{'type':db[_0x5474('0x75')]['QueryTypes'][_0x5474('0x8c')]})[_0x5474('0x2b')](function(_0x25b8d9){if(_0x25b8d9['length']===0x1){return _0x55e233['id'];}else{var _0x3c0365=_[_0x5474('0x8d')](_[_0x5474('0x39')](_0x25b8d9,_0x5474('0x8e')),function(_0x109ef8){return _[_0x5474('0x31')](_0x3fd78b,_0x109ef8);});if(_0x3c0365){return _0x55e233['id'];}}}));}}return BPromise[_0x5474('0x8f')](_0x282350)[_0x5474('0x2b')](function(_0x613266){_0x4376e2=_(_0x4376e2)['union'](_0x613266)[_0x5474('0x90')]()[_0x5474('0x55')]();return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0x1e7249[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](function(_0x52a360){return db[_0x5474('0x75')][_0x5474('0x76')](function(_0x68d4e7){return _0x52a360['removeTeams'](_0x1e7249[_0x5474('0x3c')][_0x5474('0x83')],{'transaction':_0x68d4e7})[_0x5474('0x2b')](function(){if(!_[_0x5474('0x91')](_0x4376e2)){return _0x52a360[_0x5474('0x92')](_0x4376e2,{'transaction':_0x68d4e7})['then'](function(){return db['UserVoiceQueueRt'][_0x5474('0x93')]({'where':{'VoiceQueueId':_0x1e7249[_0x5474('0x58')]['id'],'UserId':_0x4376e2},'transaction':_0x68d4e7});});}})[_0x5474('0x2b')](function(){_0x4376e2['forEach'](function(_0x2c3d45){socket[_0x5474('0x80')](_0x5474('0x94'),{'UserId':_0x2c3d45,'VoiceQueueId':_0x52a360['id']});});});});});});})[_0x5474('0x2b')](respondWithStatusCode(_0x2ea2ca,null))[_0x5474('0x4e')](handleError(_0x2ea2ca,null));};exports[_0x5474('0x95')]=function(_0x41f3ae,_0x472dad,_0xfb48dc){var _0x4e8133,_0x2a4f82;return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x41f3ae[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x472dad,null))['then'](function(_0x575d65){if(_0x575d65){_0x2a4f82=_0x575d65;return _0x575d65['addAgents'](_0x41f3ae[_0x5474('0x52')][_0x5474('0x83')],_[_0x5474('0x59')](_0x41f3ae[_0x5474('0x52')],['ids','id'])||{})[_0x5474('0x96')](function(_0x1ebaa1){for(var _0x2eade0=0x0;_0x2eade0<_0x41f3ae[_0x5474('0x52')][_0x5474('0x83')][_0x5474('0x43')];_0x2eade0+=0x1){socket['emit'](_0x5474('0x81'),{'UserId':Number(_0x41f3ae[_0x5474('0x52')]['ids'][_0x2eade0]),'VoiceQueueId':Number(_0x41f3ae[_0x5474('0x58')]['id'])});}return _0x1ebaa1;});}})[_0x5474('0x2b')](function(_0x2ba69e){_0x4e8133=_0x2ba69e||[];if(_0x2a4f82){return db[_0x5474('0x6f')][_0x5474('0x65')]({'where':{'id':_0x41f3ae['body'][_0x5474('0x83')]},'attributes':['id','name','online',_0x5474('0x71'),_0x5474('0x72')],'raw':!![]});}})[_0x5474('0x2b')](function(_0x29e713){if(!_['isEmpty'](_0x29e713)){var _0x1662b0=[];for(var _0x332bcc=0x0;_0x332bcc<_0x29e713[_0x5474('0x43')];_0x332bcc++){if(_0x29e713[_0x332bcc]['online']){_0x1662b0[_0x5474('0x97')](db[_0x5474('0x7b')][_0x5474('0x79')]({'membername':_0x29e713[_0x332bcc][_0x5474('0x37')],'UserId':_0x29e713[_0x332bcc]['id'],'queue_name':_0x2a4f82[_0x5474('0x37')],'VoiceQueueId':_0x2a4f82['id'],'interface':_[_0x5474('0x7c')](_0x29e713[_0x332bcc][_0x5474('0x72')])?util[_0x5474('0x7d')](_0x5474('0x7e'),_0x29e713[_0x332bcc][_0x5474('0x37')]):_0x29e713[_0x332bcc][_0x5474('0x72')],'paused':_0x29e713[_0x332bcc][_0x5474('0x71')]||![],'penalty':_0x41f3ae['body'][_0x5474('0x74')]||0x0}));}}return BPromise[_0x5474('0x8f')](_0x1662b0);}})[_0x5474('0x2b')](function(){return _0x4e8133;})[_0x5474('0x2b')](respondWithResult(_0x472dad,null))[_0x5474('0x4e')](handleError(_0x472dad,null));};exports['removeAgents']=function(_0x1d1267,_0x3e3069,_0x27086c){return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x1d1267[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x3e3069,null))['then'](function(_0x18b022){if(_0x18b022){return _0x18b022['removeAgents'](_0x1d1267[_0x5474('0x3c')][_0x5474('0x83')])['then'](function(){if(_['isArray'](_0x1d1267[_0x5474('0x3c')]['ids'])){for(var _0x16b2cd=0x0;_0x16b2cd<_0x1d1267[_0x5474('0x3c')][_0x5474('0x83')][_0x5474('0x43')];_0x16b2cd+=0x1){socket[_0x5474('0x80')](_0x5474('0x94'),{'UserId':Number(_0x1d1267[_0x5474('0x3c')]['ids'][_0x16b2cd]),'VoiceQueueId':Number(_0x1d1267[_0x5474('0x58')]['id'])});}}else{socket[_0x5474('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x1d1267[_0x5474('0x3c')][_0x5474('0x83')]),'VoiceQueueId':Number(_0x1d1267[_0x5474('0x58')]['id'])});}});}})[_0x5474('0x2b')](function(_0x2b4fbc){return db[_0x5474('0x7b')][_0x5474('0x93')]({'where':{'VoiceQueueId':_0x1d1267[_0x5474('0x58')]['id'],'UserId':_0x1d1267['query'][_0x5474('0x83')]}})['then'](function(){return _0x2b4fbc;});})[_0x5474('0x2b')](respondWithStatusCode(_0x3e3069,null))[_0x5474('0x4e')](handleError(_0x3e3069,null));};exports[_0x5474('0x98')]=function(_0x3f2143,_0x4ac329,_0x58dedb){var _0xcc3e2f={};var _0x2c0649={};var _0x13b25d;var _0x57ea61;return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x3f2143[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x4ac329,null))[_0x5474('0x2b')](function(_0x278620){if(_0x278620){_0x13b25d=_0x278620;_0x2c0649[_0x5474('0x40')]=_['keys'](db['User'][_0x5474('0x3a')]);_0x2c0649[_0x5474('0x3c')]=_['keys'](_0x3f2143[_0x5474('0x3c')]);_0x2c0649[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x2c0649['model'],_0x2c0649[_0x5474('0x3c')]);_0xcc3e2f[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x2c0649[_0x5474('0x40')],qs[_0x5474('0x41')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x41')]));_0xcc3e2f[_0x5474('0x42')]=_0xcc3e2f['attributes'][_0x5474('0x43')]?_0xcc3e2f[_0x5474('0x42')]:_0x2c0649[_0x5474('0x40')];_0xcc3e2f[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x47')]);_0xcc3e2f['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x3f2143[_0x5474('0x3c')],_0x2c0649[_0x5474('0x3e')]));if(_0x3f2143[_0x5474('0x3c')]['filter']){_0xcc3e2f[_0x5474('0x48')]=_[_0x5474('0x4a')](_0xcc3e2f['where'],{'$or':_[_0x5474('0x39')](_0xcc3e2f[_0x5474('0x42')],function(_0x2b5f52){var _0x301239={};_0x301239[_0x2b5f52]={'$like':'%'+_0x3f2143[_0x5474('0x3c')]['filter']+'%'};return _0x301239;})});}_0xcc3e2f=_[_0x5474('0x4a')]({},_0xcc3e2f,_0x3f2143[_0x5474('0x50')]);return _0x13b25d[_0x5474('0x98')](_0xcc3e2f);}})[_0x5474('0x2b')](function(_0x2886bb){if(_0x2886bb){_0x57ea61=_0x2886bb[_0x5474('0x43')];if(!_0x3f2143[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0xcc3e2f[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x23')]);_0xcc3e2f[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x21')]);}return _0x13b25d['getAgents'](_0xcc3e2f);}})[_0x5474('0x2b')](function(_0x4fb68e){if(_0x4fb68e){return _0x4fb68e?{'count':_0x57ea61,'rows':_0x4fb68e}:null;}})['then'](respondWithResult(_0x4ac329,null))[_0x5474('0x4e')](handleError(_0x4ac329,null));};exports[_0x5474('0x99')]=function(_0x452be0,_0x11344e,_0x539bf3){var _0x21ab99={};var _0x1efa6d={};var _0x14f910;var _0x37c089;return db['VoiceQueue'][_0x5474('0x62')]({'where':{'id':_0x452be0[_0x5474('0x58')]['id']}})['then'](handleEntityNotFound(_0x11344e,null))[_0x5474('0x2b')](function(_0x49dc78){if(_0x49dc78){_0x14f910=_0x49dc78;_0x1efa6d[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x7b')][_0x5474('0x3a')]);_0x1efa6d[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x452be0[_0x5474('0x3c')]);_0x1efa6d['filters']=_[_0x5474('0x3f')](_0x1efa6d['model'],_0x1efa6d[_0x5474('0x3c')]);_0x21ab99[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x1efa6d[_0x5474('0x40')],qs[_0x5474('0x41')](_0x452be0[_0x5474('0x3c')]['fields']));_0x21ab99[_0x5474('0x42')]=_0x21ab99[_0x5474('0x42')]['length']?_0x21ab99[_0x5474('0x42')]:_0x1efa6d['model'];_0x21ab99[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x452be0[_0x5474('0x3c')][_0x5474('0x47')]);_0x21ab99['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x452be0['query'],_0x1efa6d[_0x5474('0x3e')]));if(_0x452be0['query'][_0x5474('0x30')]){_0x21ab99[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x21ab99[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x21ab99[_0x5474('0x42')],function(_0x31709e){var _0x5f586b={};_0x5f586b[_0x31709e]={'$like':'%'+_0x452be0[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x5f586b;})});}_0x21ab99=_[_0x5474('0x4a')]({},_0x21ab99,_0x452be0[_0x5474('0x50')]);return _0x14f910[_0x5474('0x99')](_0x21ab99);}})['then'](function(_0x2e8fd3){if(_0x2e8fd3){_0x37c089=_0x2e8fd3['length'];if(!_0x452be0[_0x5474('0x3c')]['hasOwnProperty']('nolimit')){_0x21ab99['limit']=qs['limit'](_0x452be0[_0x5474('0x3c')][_0x5474('0x23')]);_0x21ab99[_0x5474('0x21')]=qs['offset'](_0x452be0[_0x5474('0x3c')]['offset']);}return _0x14f910[_0x5474('0x99')](_0x21ab99);}})['then'](function(_0xa53047){return _0xa53047?{'count':_0x37c089,'rows':_0xa53047}:null;})[_0x5474('0x2b')](respondWithResult(_0x11344e,null))[_0x5474('0x4e')](handleError(_0x11344e,null));};exports[_0x5474('0x9a')]=function(_0x93862e,_0x306c90,_0xe3e398){var _0x270cc4={};var _0x52f949={};var _0x4abb72;var _0x43798e;return db[_0x5474('0x4b')]['findOne']({'where':{'id':_0x93862e['params']['id']}})['then'](handleEntityNotFound(_0x306c90,null))[_0x5474('0x2b')](function(_0x409413){if(_0x409413){_0x4abb72=_0x409413;_0x52f949['model']=_['keys'](db[_0x5474('0x9b')][_0x5474('0x3a')]);_0x52f949[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x93862e[_0x5474('0x3c')]);_0x52f949[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x52f949[_0x5474('0x40')],_0x52f949[_0x5474('0x3c')]);_0x270cc4[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x52f949[_0x5474('0x40')],qs[_0x5474('0x41')](_0x93862e[_0x5474('0x3c')][_0x5474('0x41')]));_0x270cc4['attributes']=_0x270cc4['attributes'][_0x5474('0x43')]?_0x270cc4[_0x5474('0x42')]:_0x52f949[_0x5474('0x40')];_0x270cc4[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x93862e[_0x5474('0x3c')][_0x5474('0x47')]);_0x270cc4['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x93862e[_0x5474('0x3c')],_0x52f949[_0x5474('0x3e')]));if(_0x93862e[_0x5474('0x3c')][_0x5474('0x30')]){_0x270cc4['where']=_[_0x5474('0x4a')](_0x270cc4[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x270cc4['attributes'],function(_0x5b31fc){var _0x4e50f3={};_0x4e50f3[_0x5b31fc]={'$like':'%'+_0x93862e[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x4e50f3;})});}_0x270cc4=_[_0x5474('0x4a')]({},_0x270cc4,_0x93862e[_0x5474('0x50')]);return _0x4abb72['getLists'](_0x270cc4);}})[_0x5474('0x2b')](function(_0x201a3d){if(_0x201a3d){_0x43798e=_0x201a3d['length'];if(!_0x93862e[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0x270cc4[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x93862e['query'][_0x5474('0x23')]);_0x270cc4['offset']=qs[_0x5474('0x21')](_0x93862e[_0x5474('0x3c')][_0x5474('0x21')]);}return _0x4abb72['getLists'](_0x270cc4);}})[_0x5474('0x2b')](function(_0x10a883){if(_0x10a883){return _0x10a883?{'count':_0x43798e,'rows':_0x10a883}:null;}})[_0x5474('0x2b')](respondWithResult(_0x306c90,null))['catch'](handleError(_0x306c90,null));};exports[_0x5474('0x9c')]=function(_0x6fd54,_0x473277,_0x554038){var _0xbe5e1=moment()[_0x5474('0x7d')](_0x5474('0x9d'));var _0x26ebbe,_0x2f9480;return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0x6fd54[_0x5474('0x58')]['id']}})['then'](handleEntityNotFound(_0x473277,null))[_0x5474('0x2b')](function(_0x139921){if(_0x139921){_0x2f9480=_0x139921;return _0x139921[_0x5474('0x9c')](_0x6fd54[_0x5474('0x52')][_0x5474('0x83')],_[_0x5474('0x59')](_0x6fd54['body'],[_0x5474('0x83'),'id'])||{});}return null;})[_0x5474('0x96')](function(_0x577ac6){var _0x6b7df3;_0x26ebbe=_0x577ac6||[];var _0x41969e=[];if(_0x577ac6){for(var _0x185919=0x0;_0x185919<_0x577ac6[_0x5474('0x43')];_0x185919+=0x1){var _0x1c48c6=_0x577ac6[_0x185919][_0x5474('0x2c')]({'plain':!![]});_0x2f9480[_0x5474('0x9e')]=_0x6fd54[_0x5474('0x52')]['dialCheckDuplicateType']?_0x6fd54['body'][_0x5474('0x9e')]:_0x2f9480['dialCheckDuplicateType'];switch(_0x2f9480['dialCheckDuplicateType']){case'always':_0x6b7df3=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xa1'))[_0x5474('0xa2')]([_0x5474('0xa3'),_0x5474('0xa4'),_0x5474('0xa5'),_0x5474('0xa6'),_0x5474('0x64'),_0x5474('0x5a'),_0x5474('0x5b')],squel['select']()['field']('phone','phone')['field']('\x27'+_0xbe5e1+'\x27',_0x5474('0xa4'))['field']('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x1c48c6[_0x5474('0xa7')][_0x5474('0x8b')](),'ListId')[_0x5474('0x85')](_0x6fd54[_0x5474('0x58')]['id'][_0x5474('0x8b')](),'VoiceQueueId')['field']('\x27'+_0xbe5e1+'\x27',_0x5474('0x5a'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5b'))[_0x5474('0xa8')](_0x5474('0xa9'))[_0x5474('0x48')]('deletedAt\x20IS\x20NULL')[_0x5474('0x48')](_0x5474('0xaa'),_0x1c48c6[_0x5474('0xa7')][_0x5474('0x8b')]())[_0x5474('0x48')](_0x5474('0xab'))[_0x5474('0x48')](_0x5474('0xac'),squel[_0x5474('0x84')]()['field'](_0x5474('0xad'))[_0x5474('0xa8')](_0x5474('0xae'))[_0x5474('0x48')](_0x5474('0xaf'),_0x6fd54[_0x5474('0x58')]['id']['toString']()))[_0x5474('0x48')](_0x5474('0xac'),squel[_0x5474('0x84')]()[_0x5474('0x85')](_0x5474('0xb0'))[_0x5474('0xa8')](_0x5474('0xa1'))[_0x5474('0x48')](_0x5474('0xaf'),_0x6fd54['params']['id']['toString']())))['toString']();break;case _0x5474('0xb1'):_0x6b7df3=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xa1'))[_0x5474('0xa2')](['phone','scheduledAt',_0x5474('0xa5'),'ListId','VoiceQueueId',_0x5474('0x5a'),_0x5474('0x5b')],squel[_0x5474('0x84')]()['field']('phone','phone')[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','scheduledAt')[_0x5474('0x85')]('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x1c48c6[_0x5474('0xa7')][_0x5474('0x8b')](),_0x5474('0xa6'))['field'](_0x6fd54[_0x5474('0x58')]['id']['toString'](),_0x5474('0x64'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5a'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','updatedAt')[_0x5474('0xa8')](_0x5474('0xa9'))[_0x5474('0x48')](_0x5474('0xb2'))[_0x5474('0x48')](_0x5474('0xaa'),_0x1c48c6[_0x5474('0xa7')]['toString']())[_0x5474('0x48')](_0x5474('0xab'))[_0x5474('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5474('0x84')]()[_0x5474('0x85')](_0x5474('0xb0'))[_0x5474('0xa8')](_0x5474('0xa1'))[_0x5474('0x48')](_0x5474('0xaf'),_0x6fd54[_0x5474('0x58')]['id'][_0x5474('0x8b')]())))[_0x5474('0x8b')]();break;default:_0x6b7df3=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xa1'))[_0x5474('0xa2')]([_0x5474('0xa3'),_0x5474('0xa4'),_0x5474('0xa5'),'ListId',_0x5474('0x64'),'createdAt',_0x5474('0x5b')],squel[_0x5474('0x84')]()['field'](_0x5474('0xa3'),'phone')[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','scheduledAt')[_0x5474('0x85')]('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x1c48c6[_0x5474('0xa7')]['toString'](),'ListId')['field'](_0x6fd54[_0x5474('0x58')]['id']['toString'](),_0x5474('0x64'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','createdAt')[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5b'))[_0x5474('0xa8')]('cm_contacts')[_0x5474('0x48')](_0x5474('0xb2'))['where'](_0x5474('0xaa'),_0x1c48c6[_0x5474('0xa7')]['toString']())[_0x5474('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x5474('0x8b')]();}_0x41969e[_0x5474('0x97')](db[_0x5474('0x75')][_0x5474('0x3c')](_0x6b7df3));}return BPromise[_0x5474('0x8f')](_0x41969e);}})[_0x5474('0x2b')](function(){var _0xd407db=[];var _0x3c872f=squel['insert']()['into']('cm_hopper_additional_phones')[_0x5474('0xa2')](['CmHopperId',_0x5474('0xa3'),_0x5474('0xb3'),_0x5474('0x5a'),'updatedAt'],squel[_0x5474('0x84')]()['field']('h.id')[_0x5474('0x85')](_0x5474('0xb4'))[_0x5474('0x85')](_0x5474('0xb5'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5a'))['field']('\x27'+_0xbe5e1+'\x27',_0x5474('0x5b'))[_0x5474('0xa8')](_0x5474('0xb6'),'ci')['join'](_0x5474('0xa1'),'h',_0x5474('0xb7'))[_0x5474('0x48')]('h.scheduledat=?',_0xbe5e1)[_0x5474('0x48')](_0x5474('0xb8'),'PHONE'))[_0x5474('0x8b')]();_0xd407db[_0x5474('0x97')](db[_0x5474('0x75')][_0x5474('0x3c')](_0x3c872f));return BPromise[_0x5474('0x8f')](_0xd407db);})[_0x5474('0x2b')](function(){return _0x26ebbe;})[_0x5474('0x2b')](respondWithResult(_0x473277,null))[_0x5474('0x4e')](handleError(_0x473277,null));};exports[_0x5474('0xb9')]=function(_0xd3bcee,_0x380a4f,_0xac8fd3){return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0xd3bcee['params']['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x380a4f,null))['then'](function(_0x2b9f7d){if(_0x2b9f7d){return _0x2b9f7d[_0x5474('0xb9')](_0xd3bcee[_0x5474('0x3c')][_0x5474('0x83')]);}})[_0x5474('0x2b')](function(_0xb0e675){if(_0xb0e675){return db['CmHopper']['destroy']({'where':{'ListId':_0xd3bcee[_0x5474('0x3c')]['ids'],'VoiceQueueId':_0xd3bcee[_0x5474('0x58')]['id']}})['then'](function(){return _0xb0e675;});}})[_0x5474('0x2b')](respondWithStatusCode(_0x380a4f,null))[_0x5474('0x4e')](handleError(_0x380a4f,null));};exports[_0x5474('0xba')]=function(_0x1c3a5d,_0x3df9cc,_0x1b845a){var _0x1c835c={};var _0x2cd88f={};var _0x2a16ef;var _0x3a9a8a;return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x1c3a5d[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x3df9cc,null))[_0x5474('0x2b')](function(_0x10fbcb){if(_0x10fbcb){_0x2a16ef=_0x10fbcb;_0x2cd88f[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x9b')]['rawAttributes']);_0x2cd88f[_0x5474('0x3c')]=_['keys'](_0x1c3a5d[_0x5474('0x3c')]);_0x2cd88f['filters']=_[_0x5474('0x3f')](_0x2cd88f[_0x5474('0x40')],_0x2cd88f['query']);_0x1c835c[_0x5474('0x42')]=_['intersection'](_0x2cd88f[_0x5474('0x40')],qs[_0x5474('0x41')](_0x1c3a5d['query'][_0x5474('0x41')]));_0x1c835c[_0x5474('0x42')]=_0x1c835c[_0x5474('0x42')]['length']?_0x1c835c['attributes']:_0x2cd88f[_0x5474('0x40')];_0x1c835c[_0x5474('0x46')]=qs['sort'](_0x1c3a5d[_0x5474('0x3c')][_0x5474('0x47')]);_0x1c835c[_0x5474('0x48')]=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x1c3a5d[_0x5474('0x3c')],_0x2cd88f['filters']));if(_0x1c3a5d['query'][_0x5474('0x30')]){_0x1c835c[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x1c835c['where'],{'$or':_[_0x5474('0x39')](_0x1c835c['attributes'],function(_0x571b12){var _0xecdb39={};_0xecdb39[_0x571b12]={'$like':'%'+_0x1c3a5d[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0xecdb39;})});}_0x1c835c=_[_0x5474('0x4a')]({},_0x1c835c,_0x1c3a5d[_0x5474('0x50')]);return _0x2a16ef['getBlackLists'](_0x1c835c);}})[_0x5474('0x2b')](function(_0x40f1e0){if(_0x40f1e0){_0x3a9a8a=_0x40f1e0[_0x5474('0x43')];if(!_0x1c3a5d['query'][_0x5474('0x44')]('nolimit')){_0x1c835c[_0x5474('0x23')]=qs['limit'](_0x1c3a5d[_0x5474('0x3c')][_0x5474('0x23')]);_0x1c835c['offset']=qs[_0x5474('0x21')](_0x1c3a5d['query']['offset']);}return _0x2a16ef[_0x5474('0xba')](_0x1c835c);}})[_0x5474('0x2b')](function(_0x3cb878){if(_0x3cb878){return _0x3cb878?{'count':_0x3a9a8a,'rows':_0x3cb878}:null;}})[_0x5474('0x2b')](respondWithResult(_0x3df9cc,null))[_0x5474('0x4e')](handleError(_0x3df9cc,null));};exports[_0x5474('0xbb')]=function(_0x25d3c9,_0x4e43bf,_0x206f02){var _0x2d1c49,_0x26465e;return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x25d3c9[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x4e43bf,null))['then'](function(_0x2ac329){if(_0x2ac329){_0x26465e=_0x2ac329;return _0x2ac329[_0x5474('0xbb')](_0x25d3c9[_0x5474('0x52')][_0x5474('0x83')],_[_0x5474('0x59')](_0x25d3c9[_0x5474('0x52')],[_0x5474('0x83'),'id'])||{});}return null;})[_0x5474('0x96')](function(_0x166bca){var _0x3fcb40;_0x2d1c49=_0x166bca||[];var _0x114af2=[];if(_0x166bca){for(var _0x271e86=0x0;_0x271e86<_0x166bca[_0x5474('0x43')];_0x271e86+=0x1){var _0x46e01b=_0x166bca[_0x271e86][_0x5474('0x2c')]({'plain':!![]});_0x3fcb40=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xbc'))[_0x5474('0xa2')]([_0x5474('0xa3'),_0x5474('0xa5'),_0x5474('0xa6'),'VoiceQueueId',_0x5474('0x5a'),_0x5474('0x5b')],squel[_0x5474('0x84')]()['field'](_0x5474('0xa3'),'phone')[_0x5474('0x85')]('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x46e01b['CmListId']['toString'](),'ListId')[_0x5474('0x85')](_0x25d3c9[_0x5474('0x58')]['id']['toString'](),_0x5474('0x64'))[_0x5474('0x85')]('NOW()',_0x5474('0x5a'))[_0x5474('0x85')](_0x5474('0xbd'),_0x5474('0x5b'))[_0x5474('0xa8')]('cm_contacts')[_0x5474('0x48')](_0x5474('0xb2'))[_0x5474('0x48')](_0x5474('0xaa'),_0x46e01b[_0x5474('0xa7')][_0x5474('0x8b')]())[_0x5474('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x5474('0x8b')]();_0x114af2[_0x5474('0x97')](db[_0x5474('0x75')][_0x5474('0x3c')](_0x3fcb40));}return BPromise[_0x5474('0x8f')](_0x114af2);}})[_0x5474('0x2b')](function(){return _0x2d1c49;})[_0x5474('0x2b')](respondWithResult(_0x4e43bf,null))[_0x5474('0x4e')](handleError(_0x4e43bf,null));};exports['removeBlackLists']=function(_0x4280a9,_0x490065,_0x5d1798){return db[_0x5474('0x4b')]['find']({'where':{'id':_0x4280a9['params']['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x490065,null))[_0x5474('0x2b')](function(_0x3ec66f){if(_0x3ec66f){return _0x3ec66f[_0x5474('0xbe')](_0x4280a9[_0x5474('0x3c')][_0x5474('0x83')]);}})[_0x5474('0x2b')](function(_0x1524a8){if(_0x1524a8){return db[_0x5474('0x6c')][_0x5474('0x93')]({'where':{'ListId':_0x4280a9[_0x5474('0x3c')]['ids'],'VoiceQueueId':_0x4280a9[_0x5474('0x58')]['id']}})['then'](function(){return _0x1524a8;});}})[_0x5474('0x2b')](respondWithStatusCode(_0x490065,null))[_0x5474('0x4e')](handleError(_0x490065,null));}; \ No newline at end of file +var _0xe9ef=['../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','map','value','includes','name','UserProfileResource','end','error','stack','send','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','VoiceQueue','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','upsert','UserVoiceQueueRt','format','interface','voicePause','forEach','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','union','ids','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','online','isNil','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','insert','cm_hopper_additional_phones','CmHopperId','h.id','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','push','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x40418e,_0xab003b){var _0x3f0796=function(_0x449b70){while(--_0x449b70){_0x40418e['push'](_0x40418e['shift']());}};_0x3f0796(++_0xab003b);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x20beae,_0x5eac6d){_0x20beae=_0x20beae-0x0;var _0xf5725=_0xe9ef[_0x20beae];return _0xf5725;};'use strict';var emlformat=require(_0xfe9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe9e('0x1'));var jsonpatch=require(_0xfe9e('0x2'));var rp=require('request-promise');var moment=require(_0xfe9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe9e('0x4'));var util=require(_0xfe9e('0x5'));var path=require(_0xfe9e('0x6'));var sox=require(_0xfe9e('0x7'));var csv=require('to-csv');var ejs=require(_0xfe9e('0x8'));var fs=require('fs');var fs_extra=require(_0xfe9e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe9e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfe9e('0xb'));var toCsv=require(_0xfe9e('0xc'));var querystring=require(_0xfe9e('0xd'));var Papa=require('papaparse');var Redis=require(_0xfe9e('0xe'));var authService=require(_0xfe9e('0xf'));var qs=require(_0xfe9e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe9e('0x11'));var logger=require('../../config/logger')(_0xfe9e('0x12'));var utils=require(_0xfe9e('0x13'));var config=require(_0xfe9e('0x14'));var licenseUtil=require(_0xfe9e('0x15'));var db=require(_0xfe9e('0x16'))['db'];config[_0xfe9e('0x17')]=_[_0xfe9e('0x18')](config[_0xfe9e('0x17')],{'host':_0xfe9e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe9e('0x17')]));require(_0xfe9e('0x1a'))['register'](socket);function respondWithStatusCode(_0x344a80,_0x11d24e){_0x11d24e=_0x11d24e||0xcc;return function(_0x1af00c){if(_0x1af00c){return _0x344a80[_0xfe9e('0x1b')](_0x11d24e);}return _0x344a80['status'](_0x11d24e)['end']();};}function respondWithResult(_0x44d746,_0x463125){_0x463125=_0x463125||0xc8;return function(_0x152d44){if(_0x152d44){return _0x44d746[_0xfe9e('0x1c')](_0x463125)['json'](_0x152d44);}};}function respondWithFilteredResult(_0x2efc88,_0x158cbf){return function(_0xdf0a3b){if(_0xdf0a3b){var _0x3e18bc=typeof _0x158cbf['offset']===_0xfe9e('0x1d')&&typeof _0x158cbf[_0xfe9e('0x1e')]===_0xfe9e('0x1d');var _0xec283a=_0xdf0a3b[_0xfe9e('0x1f')];var _0x583641=_0x3e18bc?0x0:_0x158cbf['offset'];var _0x255305=_0x3e18bc?_0xdf0a3b[_0xfe9e('0x1f')]:_0x158cbf[_0xfe9e('0x20')]+_0x158cbf[_0xfe9e('0x1e')];var _0x1ad37a;if(_0x255305>=_0xec283a){_0x255305=_0xec283a;_0x1ad37a=0xc8;}else{_0x1ad37a=0xce;}_0x2efc88[_0xfe9e('0x1c')](_0x1ad37a);return _0x2efc88[_0xfe9e('0x21')](_0xfe9e('0x22'),_0x583641+'-'+_0x255305+'/'+_0xec283a)[_0xfe9e('0x23')](_0xdf0a3b);}return null;};}function patchUpdates(_0xa7d9d8){return function(_0x1988ac){try{jsonpatch[_0xfe9e('0x24')](_0x1988ac,_0xa7d9d8,!![]);}catch(_0x5f0311){return BPromise[_0xfe9e('0x25')](_0x5f0311);}return _0x1988ac[_0xfe9e('0x26')]();};}function saveUpdates(_0x4e34cb,_0x40324c){return function(_0x57d473){if(_0x57d473){return _0x57d473[_0xfe9e('0x27')](_0x4e34cb)[_0xfe9e('0x28')](function(_0x56308e){return _0x56308e;});}return null;};}function removeEntity(_0x162ce2,_0x3b5aea){return function(_0x28d2cb){if(_0x28d2cb){return _0x28d2cb[_0xfe9e('0x29')]()[_0xfe9e('0x28')](function(){var _0x42f89d=_0x28d2cb[_0xfe9e('0x2a')]({'plain':!![]});var _0x150e42=[{'name':_0xfe9e('0x2b'),'value':_0xfe9e('0x2c'),'ignore':![]},{'name':_0xfe9e('0x2d'),'value':_0xfe9e('0x2e'),'ignore':![]}];var _0x1595a5=_(_0x150e42)['filter']('ignore')[_0xfe9e('0x2f')](_0xfe9e('0x30'))[_0xfe9e('0x30')]();if(_[_0xfe9e('0x31')](_0x1595a5,_0x42f89d['type'])){return;}var _0x16d40a=_['find'](_0x150e42,['value',_0x42f89d['type']])[_0xfe9e('0x32')];return db[_0xfe9e('0x33')][_0xfe9e('0x29')]({'where':{'type':_0x16d40a,'resourceId':_0x42f89d['id']}})['then'](function(){return _0x28d2cb;});})['then'](function(){_0x162ce2[_0xfe9e('0x1c')](0xcc)[_0xfe9e('0x34')]();});}};}function handleEntityNotFound(_0x3c8560,_0x3d8d36){return function(_0x44d2e0){if(!_0x44d2e0){_0x3c8560['sendStatus'](0x194);}return _0x44d2e0;};}function handleError(_0x54d44a,_0xfd6973){_0xfd6973=_0xfd6973||0x1f4;return function(_0x2f377f){logger[_0xfe9e('0x35')](_0x2f377f[_0xfe9e('0x36')]);if(_0x2f377f[_0xfe9e('0x32')]){delete _0x2f377f[_0xfe9e('0x32')];}_0x54d44a[_0xfe9e('0x1c')](_0xfd6973)[_0xfe9e('0x37')](_0x2f377f);};}exports['index']=function(_0x157def,_0x226a4a){var _0x2606a2={},_0x579619={},_0x2f52c7={'count':0x0,'rows':[]};var _0xfd3e47=_['map'](db['VoiceQueue'][_0xfe9e('0x38')],function(_0x382987){return{'name':_0x382987[_0xfe9e('0x39')],'type':_0x382987[_0xfe9e('0x3a')][_0xfe9e('0x3b')]};});_0x579619[_0xfe9e('0x3c')]=_[_0xfe9e('0x2f')](_0xfd3e47,'name');_0x579619['query']=_[_0xfe9e('0x3d')](_0x157def[_0xfe9e('0x3e')]);_0x579619[_0xfe9e('0x3f')]=_[_0xfe9e('0x40')](_0x579619[_0xfe9e('0x3c')],_0x579619[_0xfe9e('0x3e')]);_0x2606a2[_0xfe9e('0x41')]=_['intersection'](_0x579619[_0xfe9e('0x3c')],qs['fields'](_0x157def[_0xfe9e('0x3e')]['fields']));_0x2606a2[_0xfe9e('0x41')]=_0x2606a2['attributes'][_0xfe9e('0x42')]?_0x2606a2[_0xfe9e('0x41')]:_0x579619[_0xfe9e('0x3c')];if(!_0x157def[_0xfe9e('0x3e')][_0xfe9e('0x43')](_0xfe9e('0x44'))){_0x2606a2['limit']=qs['limit'](_0x157def[_0xfe9e('0x3e')]['limit']);_0x2606a2[_0xfe9e('0x20')]=qs[_0xfe9e('0x20')](_0x157def['query'][_0xfe9e('0x20')]);}_0x2606a2[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0x157def[_0xfe9e('0x3e')][_0xfe9e('0x46')]);_0x2606a2['where']=qs[_0xfe9e('0x3f')](_[_0xfe9e('0x47')](_0x157def[_0xfe9e('0x3e')],_0x579619[_0xfe9e('0x3f')]),_0xfd3e47);if(_0x157def[_0xfe9e('0x3e')][_0xfe9e('0x48')]){_0x2606a2[_0xfe9e('0x49')]=_[_0xfe9e('0x4a')](_0x2606a2[_0xfe9e('0x49')],{'$or':_['map'](_0xfd3e47,function(_0x564d72){if(_0x564d72[_0xfe9e('0x3a')]!==_0xfe9e('0x4b')){var _0x1b996a={};_0x1b996a[_0x564d72[_0xfe9e('0x32')]]={'$like':'%'+_0x157def['query'][_0xfe9e('0x48')]+'%'};return _0x1b996a;}})});}_0x2606a2=_[_0xfe9e('0x4a')]({},_0x2606a2,_0x157def[_0xfe9e('0x4c')]);var _0x38de89={'where':_0x2606a2[_0xfe9e('0x49')]};return db['VoiceQueue'][_0xfe9e('0x1f')](_0x38de89)[_0xfe9e('0x28')](function(_0x2082cb){_0x2f52c7[_0xfe9e('0x1f')]=_0x2082cb;if(_0x157def[_0xfe9e('0x3e')][_0xfe9e('0x4d')]){_0x2606a2['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xfe9e('0x4e')](_0x2606a2);})[_0xfe9e('0x28')](function(_0x13d61d){_0x2f52c7[_0xfe9e('0x4f')]=_0x13d61d;return _0x2f52c7;})[_0xfe9e('0x28')](respondWithFilteredResult(_0x226a4a,_0x2606a2))[_0xfe9e('0x50')](handleError(_0x226a4a,null));};exports['show']=function(_0x4db389,_0x3e7c73){var _0x27e57e={'raw':![],'where':{'id':_0x4db389['params']['id']}},_0x3a979a={};_0x3a979a[_0xfe9e('0x3c')]=_[_0xfe9e('0x3d')](db[_0xfe9e('0x51')][_0xfe9e('0x38')]);_0x3a979a['query']=_[_0xfe9e('0x3d')](_0x4db389[_0xfe9e('0x3e')]);_0x3a979a[_0xfe9e('0x3f')]=_[_0xfe9e('0x40')](_0x3a979a[_0xfe9e('0x3c')],_0x3a979a['query']);_0x27e57e[_0xfe9e('0x41')]=_[_0xfe9e('0x40')](_0x3a979a[_0xfe9e('0x3c')],qs[_0xfe9e('0x52')](_0x4db389['query']['fields']));_0x27e57e[_0xfe9e('0x41')]=_0x27e57e[_0xfe9e('0x41')][_0xfe9e('0x42')]?_0x27e57e[_0xfe9e('0x41')]:_0x3a979a[_0xfe9e('0x3c')];if(_0x4db389[_0xfe9e('0x3e')][_0xfe9e('0x4d')]){_0x27e57e[_0xfe9e('0x53')]=[{'all':!![]}];}_0x27e57e=_[_0xfe9e('0x4a')]({},_0x27e57e,_0x4db389[_0xfe9e('0x4c')]);return db[_0xfe9e('0x51')][_0xfe9e('0x54')](_0x27e57e)['then'](handleEntityNotFound(_0x3e7c73,null))['then'](respondWithResult(_0x3e7c73,null))[_0xfe9e('0x50')](handleError(_0x3e7c73,null));};exports['create']=function(_0x4ebf5c,_0x33d685){return db[_0xfe9e('0x51')][_0xfe9e('0x55')](_0x4ebf5c[_0xfe9e('0x56')],{})[_0xfe9e('0x28')](function(_0x21079d){var _0x556800=_0x4ebf5c['user'][_0xfe9e('0x2a')]({'plain':!![]});if(!_0x556800)throw new Error(_0xfe9e('0x57'));if(_0x556800[_0xfe9e('0x58')]===_0xfe9e('0x59')){var _0x182f24=_0x21079d[_0xfe9e('0x2a')]({'plain':!![]});var _0x20778b=[{'name':_0xfe9e('0x2b'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xfe9e('0x2e')}];var _0x3ad3c6=_[_0xfe9e('0x54')](_0x20778b,[_0xfe9e('0x30'),_0x182f24[_0xfe9e('0x3a')]])[_0xfe9e('0x32')];return db[_0xfe9e('0x5a')][_0xfe9e('0x54')]({'where':{'name':_0x3ad3c6,'userProfileId':_0x556800[_0xfe9e('0x5b')]},'raw':!![]})[_0xfe9e('0x28')](function(_0x3928c8){if(_0x3928c8&&_0x3928c8[_0xfe9e('0x5c')]===0x0){return db[_0xfe9e('0x33')][_0xfe9e('0x55')]({'name':_0x182f24[_0xfe9e('0x32')],'resourceId':_0x182f24['id'],'type':_0x3928c8[_0xfe9e('0x32')],'sectionId':_0x3928c8['id']},{})['then'](function(){return _0x21079d;});}else{return _0x21079d;}})[_0xfe9e('0x50')](function(_0x36f0af){logger['error'](_0xfe9e('0x5d'),_0x36f0af);throw _0x36f0af;});}return _0x21079d;})[_0xfe9e('0x28')](respondWithResult(_0x33d685,0xc9))[_0xfe9e('0x50')](handleError(_0x33d685,null));};exports[_0xfe9e('0x5e')]=function(_0x499cfa,_0x120d6b){var _0x4d2799={'where':{'id':_0x499cfa[_0xfe9e('0x5f')]['id']}},_0x4781a7={};_0x4781a7[_0xfe9e('0x3c')]=_[_0xfe9e('0x3d')](db[_0xfe9e('0x51')]['rawAttributes']);_0x4d2799['attributes']=_[_0xfe9e('0x40')](_0x4781a7['model'],qs[_0xfe9e('0x52')](_0x499cfa[_0xfe9e('0x3e')][_0xfe9e('0x52')]));_0x4d2799[_0xfe9e('0x41')]=_0x4d2799[_0xfe9e('0x41')][_0xfe9e('0x42')]?_0x4d2799[_0xfe9e('0x41')]:_0x4781a7[_0xfe9e('0x3c')];if(_0x499cfa[_0xfe9e('0x3e')]['includeAll']){_0x4d2799[_0xfe9e('0x53')]=[{'all':!![]}];}_0x4d2799=_['merge']({},_0x4d2799,_0x499cfa['options']);return db['VoiceQueue']['find'](_0x4d2799)[_0xfe9e('0x28')](handleEntityNotFound(_0x120d6b,null))['then'](function(_0x27bc20){if(_0x27bc20){var _0x5c2b7e=_0x27bc20['get']({'plain':!![]});_0x5c2b7e=qs[_0xfe9e('0x60')](_0x5c2b7e,['id',_0xfe9e('0x61'),_0xfe9e('0x62')]);_0x499cfa[_0xfe9e('0x56')]=_[_0xfe9e('0x60')](_0x499cfa[_0xfe9e('0x56')],['id',_0xfe9e('0x61'),_0xfe9e('0x62')]);return db[_0xfe9e('0x51')][_0xfe9e('0x55')](_[_0xfe9e('0x4a')](_0x5c2b7e,_0x499cfa[_0xfe9e('0x56')]),{'include':_0x499cfa[_0xfe9e('0x3e')][_0xfe9e('0x4d')]?[{'all':!![]}]:undefined})[_0xfe9e('0x28')](function(_0x1bbcf4){var _0x25462d=_0x499cfa[_0xfe9e('0x59')][_0xfe9e('0x2a')]({'plain':!![]});if(!_0x25462d)throw new Error(_0xfe9e('0x57'));if(_0x25462d[_0xfe9e('0x58')]===_0xfe9e('0x59')){var _0xadc36f=_0x1bbcf4[_0xfe9e('0x2a')]({'plain':!![]});var _0x2fc723=[{'name':_0xfe9e('0x2b'),'value':_0xfe9e('0x2c')},{'name':_0xfe9e('0x2d'),'value':'outbound'}];var _0x297533=_['find'](_0x2fc723,[_0xfe9e('0x30'),_0xadc36f['type']])[_0xfe9e('0x32')];return db[_0xfe9e('0x5a')][_0xfe9e('0x54')]({'where':{'name':_0x297533,'userProfileId':_0x25462d[_0xfe9e('0x5b')]},'raw':!![]})[_0xfe9e('0x28')](function(_0x3f234f){if(_0x3f234f&&_0x3f234f['autoAssociation']===0x0){return db[_0xfe9e('0x33')]['create']({'name':_0xadc36f[_0xfe9e('0x32')],'resourceId':_0xadc36f['id'],'type':_0x3f234f[_0xfe9e('0x32')],'sectionId':_0x3f234f['id']},{})[_0xfe9e('0x28')](function(){return _0x1bbcf4;});}else{return _0x1bbcf4;}})['catch'](function(_0x380d08){logger[_0xfe9e('0x35')](_0xfe9e('0x5d'),_0x380d08);throw _0x380d08;});}return _0x1bbcf4;});}})[_0xfe9e('0x28')](respondWithResult(_0x120d6b,0xc9))[_0xfe9e('0x50')](handleError(_0x120d6b,null));};exports[_0xfe9e('0x27')]=function(_0x1cb54a,_0x5b5d98){if(_0x1cb54a['body']['id']){delete _0x1cb54a[_0xfe9e('0x56')]['id'];}return db[_0xfe9e('0x51')]['find']({'where':{'id':_0x1cb54a['params']['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x5b5d98,null))[_0xfe9e('0x28')](saveUpdates(_0x1cb54a['body'],null))[_0xfe9e('0x28')](respondWithResult(_0x5b5d98,null))[_0xfe9e('0x50')](handleError(_0x5b5d98,null));};exports['destroy']=function(_0x57d381,_0x55e120){return db['VoiceQueue']['find']({'where':{'id':_0x57d381['params']['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x55e120,null))[_0xfe9e('0x28')](removeEntity(_0x55e120,null))[_0xfe9e('0x50')](handleError(_0x55e120,null));};exports[_0xfe9e('0x63')]=function(_0x49f500,_0x1660a9,_0x24e737){var _0x10ed02={'raw':![],'where':{}};var _0x2c26bc={};var _0x11d764={'count':0x0,'rows':[]};return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0x49f500[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x1660a9,null))[_0xfe9e('0x28')](function(_0x253e94){if(_0x253e94){_0x2c26bc[_0xfe9e('0x3c')]=_['keys'](db[_0xfe9e('0x65')][_0xfe9e('0x38')]);_0x2c26bc[_0xfe9e('0x3e')]=_[_0xfe9e('0x3d')](_0x49f500[_0xfe9e('0x3e')]);_0x2c26bc[_0xfe9e('0x3f')]=_[_0xfe9e('0x40')](_0x2c26bc[_0xfe9e('0x3c')],_0x2c26bc['query']);_0x10ed02['attributes']=_[_0xfe9e('0x40')](_0x2c26bc[_0xfe9e('0x3c')],qs[_0xfe9e('0x52')](_0x49f500[_0xfe9e('0x3e')]['fields']));_0x10ed02[_0xfe9e('0x41')]=_0x10ed02[_0xfe9e('0x41')][_0xfe9e('0x42')]?_0x10ed02[_0xfe9e('0x41')]:_0x2c26bc[_0xfe9e('0x3c')];if(!_0x49f500[_0xfe9e('0x3e')][_0xfe9e('0x43')](_0xfe9e('0x44'))){_0x10ed02['limit']=qs[_0xfe9e('0x1e')](_0x49f500[_0xfe9e('0x3e')][_0xfe9e('0x1e')]);_0x10ed02[_0xfe9e('0x20')]=qs['offset'](_0x49f500[_0xfe9e('0x3e')][_0xfe9e('0x20')]);}_0x10ed02[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0x49f500[_0xfe9e('0x3e')][_0xfe9e('0x46')]);_0x10ed02['where']=qs[_0xfe9e('0x3f')](_[_0xfe9e('0x47')](_0x49f500[_0xfe9e('0x3e')],_0x2c26bc[_0xfe9e('0x3f')]));_0x10ed02['where']['VoiceQueueId']=_0x253e94['id'];if(_0x49f500[_0xfe9e('0x3e')]['filter']){_0x10ed02['where']=_[_0xfe9e('0x4a')](_0x10ed02[_0xfe9e('0x49')],{'$or':_[_0xfe9e('0x2f')](_0x10ed02[_0xfe9e('0x41')],function(_0x3939b1){var _0x3d002e={};_0x3d002e[_0x3939b1]={'$like':'%'+_0x49f500[_0xfe9e('0x3e')][_0xfe9e('0x48')]+'%'};return _0x3d002e;})});}_0x10ed02=_[_0xfe9e('0x4a')]({},_0x10ed02,_0x49f500[_0xfe9e('0x4c')]);return db['CmHopper'][_0xfe9e('0x1f')]({'where':_0x10ed02[_0xfe9e('0x49')]})['then'](function(_0x4755d0){_0x11d764['count']=_0x4755d0;if(_0x49f500[_0xfe9e('0x3e')]['includeAll']){_0x10ed02['include']=[{'all':!![]}];}return db[_0xfe9e('0x65')]['findAll'](_0x10ed02);})[_0xfe9e('0x28')](function(_0x19196e){_0x11d764[_0xfe9e('0x4f')]=_0x19196e;return _0x11d764;});}})[_0xfe9e('0x28')](respondWithFilteredResult(_0x1660a9,_0x10ed02))[_0xfe9e('0x50')](handleError(_0x1660a9,null));};exports[_0xfe9e('0x66')]=function(_0x5102db,_0x2bfc28,_0x315c01){var _0x1ee5fd={'raw':!![],'where':{}};var _0x544dbf={};var _0x5279f1={'count':0x0,'rows':[]};return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0x5102db[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x2bfc28,null))[_0xfe9e('0x28')](function(_0x4dd567){if(_0x4dd567){_0x544dbf[_0xfe9e('0x3c')]=_[_0xfe9e('0x3d')](db[_0xfe9e('0x67')]['rawAttributes']);_0x544dbf[_0xfe9e('0x3e')]=_[_0xfe9e('0x3d')](_0x5102db['query']);_0x544dbf[_0xfe9e('0x3f')]=_[_0xfe9e('0x40')](_0x544dbf[_0xfe9e('0x3c')],_0x544dbf[_0xfe9e('0x3e')]);_0x1ee5fd[_0xfe9e('0x41')]=_[_0xfe9e('0x40')](_0x544dbf['model'],qs[_0xfe9e('0x52')](_0x5102db[_0xfe9e('0x3e')]['fields']));_0x1ee5fd[_0xfe9e('0x41')]=_0x1ee5fd[_0xfe9e('0x41')][_0xfe9e('0x42')]?_0x1ee5fd['attributes']:_0x544dbf[_0xfe9e('0x3c')];if(!_0x5102db[_0xfe9e('0x3e')]['hasOwnProperty'](_0xfe9e('0x44'))){_0x1ee5fd[_0xfe9e('0x1e')]=qs[_0xfe9e('0x1e')](_0x5102db['query'][_0xfe9e('0x1e')]);_0x1ee5fd[_0xfe9e('0x20')]=qs['offset'](_0x5102db['query']['offset']);}_0x1ee5fd['order']=qs['sort'](_0x5102db[_0xfe9e('0x3e')][_0xfe9e('0x46')]);_0x1ee5fd[_0xfe9e('0x49')]=qs[_0xfe9e('0x3f')](_[_0xfe9e('0x47')](_0x5102db[_0xfe9e('0x3e')],_0x544dbf['filters']));_0x1ee5fd[_0xfe9e('0x49')]['VoiceQueueId']=_0x4dd567['id'];if(_0x5102db[_0xfe9e('0x3e')][_0xfe9e('0x48')]){_0x1ee5fd[_0xfe9e('0x49')]=_[_0xfe9e('0x4a')](_0x1ee5fd[_0xfe9e('0x49')],{'$or':_['map'](_0x1ee5fd['attributes'],function(_0x40a9bb){var _0x18cdcc={};_0x18cdcc[_0x40a9bb]={'$like':'%'+_0x5102db['query'][_0xfe9e('0x48')]+'%'};return _0x18cdcc;})});}_0x1ee5fd=_['merge']({},_0x1ee5fd,_0x5102db[_0xfe9e('0x4c')]);return db['CmHopperHistory'][_0xfe9e('0x1f')]({'where':_0x1ee5fd['where']})[_0xfe9e('0x28')](function(_0x576c7b){_0x5279f1['count']=_0x576c7b;if(_0x5102db['query'][_0xfe9e('0x4d')]){_0x1ee5fd[_0xfe9e('0x53')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1ee5fd);})[_0xfe9e('0x28')](function(_0xb1cf03){_0x5279f1['rows']=_0xb1cf03;return _0x5279f1;});}})[_0xfe9e('0x28')](respondWithFilteredResult(_0x2bfc28,_0x1ee5fd))[_0xfe9e('0x50')](handleError(_0x2bfc28,null));};exports[_0xfe9e('0x68')]=function(_0x59cb74,_0x40a4fd,_0x2b6b4){var _0x7ee4b6={'raw':!![],'where':{}};var _0x5042d4={};var _0x1a38e0={'count':0x0,'rows':[]};return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0x59cb74[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x40a4fd,null))[_0xfe9e('0x28')](function(_0x5f2e42){if(_0x5f2e42){_0x5042d4[_0xfe9e('0x3c')]=_[_0xfe9e('0x3d')](db[_0xfe9e('0x69')][_0xfe9e('0x38')]);_0x5042d4[_0xfe9e('0x3e')]=_['keys'](_0x59cb74[_0xfe9e('0x3e')]);_0x5042d4[_0xfe9e('0x3f')]=_['intersection'](_0x5042d4['model'],_0x5042d4[_0xfe9e('0x3e')]);_0x7ee4b6[_0xfe9e('0x41')]=_[_0xfe9e('0x40')](_0x5042d4[_0xfe9e('0x3c')],qs['fields'](_0x59cb74[_0xfe9e('0x3e')][_0xfe9e('0x52')]));_0x7ee4b6[_0xfe9e('0x41')]=_0x7ee4b6[_0xfe9e('0x41')]['length']?_0x7ee4b6[_0xfe9e('0x41')]:_0x5042d4[_0xfe9e('0x3c')];if(!_0x59cb74[_0xfe9e('0x3e')][_0xfe9e('0x43')]('nolimit')){_0x7ee4b6['limit']=qs[_0xfe9e('0x1e')](_0x59cb74['query']['limit']);_0x7ee4b6['offset']=qs['offset'](_0x59cb74[_0xfe9e('0x3e')][_0xfe9e('0x20')]);}_0x7ee4b6[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0x59cb74[_0xfe9e('0x3e')][_0xfe9e('0x46')]);_0x7ee4b6[_0xfe9e('0x49')]=qs['filters'](_[_0xfe9e('0x47')](_0x59cb74[_0xfe9e('0x3e')],_0x5042d4[_0xfe9e('0x3f')]));_0x7ee4b6[_0xfe9e('0x49')][_0xfe9e('0x6a')]=_0x5f2e42['id'];if(_0x59cb74[_0xfe9e('0x3e')][_0xfe9e('0x48')]){_0x7ee4b6['where']=_[_0xfe9e('0x4a')](_0x7ee4b6['where'],{'$or':_[_0xfe9e('0x2f')](_0x7ee4b6[_0xfe9e('0x41')],function(_0x365147){var _0x57e85c={};_0x57e85c[_0x365147]={'$like':'%'+_0x59cb74[_0xfe9e('0x3e')][_0xfe9e('0x48')]+'%'};return _0x57e85c;})});}_0x7ee4b6=_[_0xfe9e('0x4a')]({},_0x7ee4b6,_0x59cb74[_0xfe9e('0x4c')]);return db[_0xfe9e('0x69')]['count']({'where':_0x7ee4b6[_0xfe9e('0x49')]})[_0xfe9e('0x28')](function(_0x3fdb52){_0x1a38e0[_0xfe9e('0x1f')]=_0x3fdb52;if(_0x59cb74[_0xfe9e('0x3e')][_0xfe9e('0x4d')]){_0x7ee4b6['include']=[{'all':!![]}];}return db[_0xfe9e('0x69')][_0xfe9e('0x4e')](_0x7ee4b6);})[_0xfe9e('0x28')](function(_0x1e8f23){_0x1a38e0[_0xfe9e('0x4f')]=_0x1e8f23;return _0x1a38e0;});}})['then'](respondWithFilteredResult(_0x40a4fd,_0x7ee4b6))[_0xfe9e('0x50')](handleError(_0x40a4fd,null));};exports[_0xfe9e('0x6b')]=function(_0xf57b35,_0xc1268e,_0x41316d){var _0x130819={'raw':!![],'where':{}};var _0x247fd1={};var _0x5ddd48={'count':0x0,'rows':[]};return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0xf57b35[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0xc1268e,null))['then'](function(_0x39ce4c){if(_0x39ce4c){_0x247fd1['model']=_['keys'](db[_0xfe9e('0x6c')][_0xfe9e('0x38')]);_0x247fd1['query']=_[_0xfe9e('0x3d')](_0xf57b35[_0xfe9e('0x3e')]);_0x247fd1[_0xfe9e('0x3f')]=_[_0xfe9e('0x40')](_0x247fd1['model'],_0x247fd1[_0xfe9e('0x3e')]);_0x130819[_0xfe9e('0x41')]=_[_0xfe9e('0x40')](_0x247fd1[_0xfe9e('0x3c')],qs[_0xfe9e('0x52')](_0xf57b35[_0xfe9e('0x3e')]['fields']));_0x130819[_0xfe9e('0x41')]=_0x130819['attributes']['length']?_0x130819['attributes']:_0x247fd1['model'];if(!_0xf57b35[_0xfe9e('0x3e')][_0xfe9e('0x43')](_0xfe9e('0x44'))){_0x130819[_0xfe9e('0x1e')]=qs['limit'](_0xf57b35[_0xfe9e('0x3e')]['limit']);_0x130819['offset']=qs[_0xfe9e('0x20')](_0xf57b35[_0xfe9e('0x3e')]['offset']);}_0x130819[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0xf57b35[_0xfe9e('0x3e')]['sort']);_0x130819[_0xfe9e('0x49')]=qs['filters'](_['pick'](_0xf57b35[_0xfe9e('0x3e')],_0x247fd1[_0xfe9e('0x3f')]));_0x130819[_0xfe9e('0x49')][_0xfe9e('0x6a')]=_0x39ce4c['id'];if(_0xf57b35[_0xfe9e('0x3e')][_0xfe9e('0x48')]){_0x130819[_0xfe9e('0x49')]=_[_0xfe9e('0x4a')](_0x130819[_0xfe9e('0x49')],{'$or':_[_0xfe9e('0x2f')](_0x130819[_0xfe9e('0x41')],function(_0x3fa037){var _0x1be241={};_0x1be241[_0x3fa037]={'$like':'%'+_0xf57b35['query'][_0xfe9e('0x48')]+'%'};return _0x1be241;})});}_0x130819=_[_0xfe9e('0x4a')]({},_0x130819,_0xf57b35[_0xfe9e('0x4c')]);return db[_0xfe9e('0x6c')][_0xfe9e('0x1f')]({'where':_0x130819[_0xfe9e('0x49')]})[_0xfe9e('0x28')](function(_0x37d468){_0x5ddd48[_0xfe9e('0x1f')]=_0x37d468;if(_0xf57b35['query'][_0xfe9e('0x4d')]){_0x130819[_0xfe9e('0x53')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x130819);})[_0xfe9e('0x28')](function(_0xf963dd){_0x5ddd48[_0xfe9e('0x4f')]=_0xf963dd;return _0x5ddd48;});}})['then'](respondWithFilteredResult(_0xc1268e,_0x130819))[_0xfe9e('0x50')](handleError(_0xc1268e,null));};exports[_0xfe9e('0x6d')]=function(_0x330462,_0x5e2038,_0x29f55c){var _0x428a16={};var _0x2f2071={};var _0x27a8e5;var _0x3ff645;return db['VoiceQueue'][_0xfe9e('0x64')]({'where':{'id':_0x330462[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x5e2038,null))['then'](function(_0x2eb0b7){if(_0x2eb0b7){_0x27a8e5=_0x2eb0b7;_0x2f2071[_0xfe9e('0x3c')]=_[_0xfe9e('0x3d')](db[_0xfe9e('0x6e')][_0xfe9e('0x38')]);_0x2f2071[_0xfe9e('0x3e')]=_['keys'](_0x330462['query']);_0x2f2071[_0xfe9e('0x3f')]=_['intersection'](_0x2f2071[_0xfe9e('0x3c')],_0x2f2071[_0xfe9e('0x3e')]);_0x428a16[_0xfe9e('0x41')]=_['intersection'](_0x2f2071[_0xfe9e('0x3c')],qs[_0xfe9e('0x52')](_0x330462[_0xfe9e('0x3e')][_0xfe9e('0x52')]));_0x428a16[_0xfe9e('0x41')]=_0x428a16[_0xfe9e('0x41')]['length']?_0x428a16[_0xfe9e('0x41')]:_0x2f2071['model'];_0x428a16[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0x330462[_0xfe9e('0x3e')][_0xfe9e('0x46')]);_0x428a16[_0xfe9e('0x49')]=qs['filters'](_[_0xfe9e('0x47')](_0x330462[_0xfe9e('0x3e')],_0x2f2071[_0xfe9e('0x3f')]));if(_0x330462[_0xfe9e('0x3e')]['filter']){_0x428a16['where']=_[_0xfe9e('0x4a')](_0x428a16[_0xfe9e('0x49')],{'$or':_[_0xfe9e('0x2f')](_0x428a16[_0xfe9e('0x41')],function(_0x529f25){var _0x18bbfc={};_0x18bbfc[_0x529f25]={'$like':'%'+_0x330462[_0xfe9e('0x3e')]['filter']+'%'};return _0x18bbfc;})});}_0x428a16=_[_0xfe9e('0x4a')]({},_0x428a16,_0x330462[_0xfe9e('0x4c')]);return _0x27a8e5[_0xfe9e('0x6d')](_0x428a16);}})[_0xfe9e('0x28')](function(_0x4724df){if(_0x4724df){_0x3ff645=_0x4724df[_0xfe9e('0x42')];if(!_0x330462[_0xfe9e('0x3e')][_0xfe9e('0x43')](_0xfe9e('0x44'))){_0x428a16[_0xfe9e('0x1e')]=qs['limit'](_0x330462[_0xfe9e('0x3e')][_0xfe9e('0x1e')]);_0x428a16[_0xfe9e('0x20')]=qs[_0xfe9e('0x20')](_0x330462[_0xfe9e('0x3e')][_0xfe9e('0x20')]);}return _0x27a8e5[_0xfe9e('0x6d')](_0x428a16);}})[_0xfe9e('0x28')](function(_0x578a5f){if(_0x578a5f){return _0x578a5f?{'count':_0x3ff645,'rows':_0x578a5f}:null;}})[_0xfe9e('0x28')](respondWithResult(_0x5e2038,null))['catch'](handleError(_0x5e2038,null));};exports[_0xfe9e('0x6f')]=function(_0x5bc539,_0xb42809,_0x56fa8d){var _0x37f219=_0x5bc539[_0xfe9e('0x56')][_0xfe9e('0x70')];var _0x46e77a=_[_0xfe9e('0x2f')](_0x37f219,'id');return db[_0xfe9e('0x6e')][_0xfe9e('0x4e')]({'where':{'id':_0x46e77a},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfe9e('0x71'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0xfe9e('0x28')](function(_0x2f2acb){if(_0x2f2acb){var _0x512a82=_[_0xfe9e('0x72')](_0x2f2acb,function(_0x105e31){var _0x21f59b=_0x105e31[_0xfe9e('0x2a')]({'plain':!![]});_0x21f59b[_0xfe9e('0x71')]['forEach'](function(_0x5b54b9){_0x5b54b9[_0xfe9e('0x73')]=_[_0xfe9e('0x54')](_0x37f219,{'id':_0x21f59b['id']})[_0xfe9e('0x73')];});return _0x21f59b[_0xfe9e('0x71')];});return db[_0xfe9e('0x51')][_0xfe9e('0x54')]({'where':{'id':_0x5bc539[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](function(_0x5f2d16){return db[_0xfe9e('0x74')][_0xfe9e('0x75')](function(_0x3f5f3b){return _0x5f2d16[_0xfe9e('0x6f')](_0x46e77a,{'transaction':_0x3f5f3b})[_0xfe9e('0x28')](function(){return BPromise['each'](_0x37f219,function(_0x4b59a6){return db[_0xfe9e('0x76')][_0xfe9e('0x77')]({'TeamId':_0x4b59a6['id'],'VoiceQueueId':_0x5bc539[_0xfe9e('0x5f')]['id'],'penalty':_0x4b59a6[_0xfe9e('0x73')]},{'transaction':_0x3f5f3b});});})['then'](function(){return BPromise['each'](_0x512a82,function(_0x37bc7a){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x37bc7a['id'],'VoiceQueueId':_0x5bc539['params']['id']},'defaults':{'penalty':_0x37bc7a[_0xfe9e('0x73')]},'transaction':_0x3f5f3b});});})['then'](function(){return BPromise['each'](_['filter'](_0x512a82,{'online':!![]}),function(_0x432233){return db[_0xfe9e('0x78')][_0xfe9e('0x77')]({'membername':_0x432233[_0xfe9e('0x32')],'UserId':_0x432233['id'],'queue_name':_0x5f2d16['name'],'VoiceQueueId':_0x5f2d16['id'],'interface':_['isNil'](_0x432233['interface'])?util[_0xfe9e('0x79')]('SIP/%s',_0x432233[_0xfe9e('0x32')]):_0x432233[_0xfe9e('0x7a')],'paused':_0x432233[_0xfe9e('0x7b')]||![],'penalty':_0x432233['penalty']},{'transaction':_0x3f5f3b});});})[_0xfe9e('0x28')](function(){_0x512a82[_0xfe9e('0x7c')](function(_0x134307){socket['emit']('userVoiceQueue:save',{'UserId':_0x134307['id'],'VoiceQueueId':_0x5f2d16['id']});});});});});}})[_0xfe9e('0x28')](respondWithStatusCode(_0xb42809,null))[_0xfe9e('0x50')](handleError(_0xb42809,null));};exports[_0xfe9e('0x7d')]=function(_0x5be48f,_0x447c17,_0x2abcfd){return db['Team'][_0xfe9e('0x4e')]({'where':{'id':_0x5be48f[_0xfe9e('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfe9e('0x28')](handleEntityNotFound(_0x447c17,null))[_0xfe9e('0x28')](function(_0x1f0b5f){var _0x3f177b=_[_0xfe9e('0x2f')](_0x1f0b5f,'id');var _0x5275d8=[];var _0x4f3cc5=[];var _0x582319=squel[_0xfe9e('0x7e')]();_0x582319[_0xfe9e('0x7f')](_0xfe9e('0x80'))[_0xfe9e('0x81')]('team_has_voice_queues','tq')[_0xfe9e('0x82')](_0xfe9e('0x83'),'ut',_0xfe9e('0x84'))['where'](_0xfe9e('0x85'),_0x5be48f['params']['id']);for(var _0x25eceb=0x0;_0x25eceb<_0x1f0b5f[_0xfe9e('0x42')];_0x25eceb+=0x1){let _0x28d74e=_0x1f0b5f[_0x25eceb];for(var _0x345440=0x0;_0x345440<_0x28d74e[_0xfe9e('0x71')][_0xfe9e('0x42')];_0x345440+=0x1){let _0x5f15e9=_0x28d74e[_0xfe9e('0x71')][_0x345440];var _0x155ed1=_0x582319[_0xfe9e('0x5e')]();_0x155ed1[_0xfe9e('0x49')](_0xfe9e('0x86'),_0x5f15e9['id']);_0x4f3cc5['push'](db[_0xfe9e('0x74')][_0xfe9e('0x3e')](_0x155ed1[_0xfe9e('0x87')](),{'type':db[_0xfe9e('0x74')][_0xfe9e('0x88')][_0xfe9e('0x89')]})[_0xfe9e('0x28')](function(_0x340e5e){if(_0x340e5e[_0xfe9e('0x42')]===0x1){return _0x5f15e9['id'];}else{var _0x55cbda=_['every'](_['map'](_0x340e5e,_0xfe9e('0x8a')),function(_0x447f0e){return _[_0xfe9e('0x31')](_0x3f177b,_0x447f0e);});if(_0x55cbda){return _0x5f15e9['id'];}}}));}}return BPromise[_0xfe9e('0x8b')](_0x4f3cc5)[_0xfe9e('0x28')](function(_0x449c36){_0x5275d8=_(_0x5275d8)[_0xfe9e('0x8c')](_0x449c36)['compact']()[_0xfe9e('0x30')]();return db[_0xfe9e('0x51')][_0xfe9e('0x54')]({'where':{'id':_0x5be48f['params']['id']}})['then'](function(_0x3a9ada){return db[_0xfe9e('0x74')]['transaction'](function(_0x29fcb7){return _0x3a9ada['removeTeams'](_0x5be48f['query'][_0xfe9e('0x8d')],{'transaction':_0x29fcb7})[_0xfe9e('0x28')](function(){if(!_[_0xfe9e('0x8e')](_0x5275d8)){return _0x3a9ada[_0xfe9e('0x8f')](_0x5275d8,{'transaction':_0x29fcb7})['then'](function(){return db['UserVoiceQueueRt'][_0xfe9e('0x29')]({'where':{'VoiceQueueId':_0x5be48f['params']['id'],'UserId':_0x5275d8},'transaction':_0x29fcb7});});}})[_0xfe9e('0x28')](function(){_0x5275d8[_0xfe9e('0x7c')](function(_0x5269bb){socket[_0xfe9e('0x90')](_0xfe9e('0x91'),{'UserId':_0x5269bb,'VoiceQueueId':_0x3a9ada['id']});});});});});});})[_0xfe9e('0x28')](respondWithStatusCode(_0x447c17,null))['catch'](handleError(_0x447c17,null));};exports[_0xfe9e('0x92')]=function(_0x23b8e6,_0x446372,_0x4790ad){var _0x4dcd63,_0x59697d;return db[_0xfe9e('0x51')][_0xfe9e('0x54')]({'where':{'id':_0x23b8e6[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x446372,null))[_0xfe9e('0x28')](function(_0x1fda55){if(_0x1fda55){_0x59697d=_0x1fda55;return _0x1fda55[_0xfe9e('0x92')](_0x23b8e6[_0xfe9e('0x56')]['ids'],_['omit'](_0x23b8e6['body'],[_0xfe9e('0x8d'),'id'])||{})[_0xfe9e('0x93')](function(_0x52d14d){for(var _0x1d6961=0x0;_0x1d6961<_0x23b8e6[_0xfe9e('0x56')][_0xfe9e('0x8d')][_0xfe9e('0x42')];_0x1d6961+=0x1){socket['emit'](_0xfe9e('0x94'),{'UserId':Number(_0x23b8e6[_0xfe9e('0x56')]['ids'][_0x1d6961]),'VoiceQueueId':Number(_0x23b8e6[_0xfe9e('0x5f')]['id'])});}return _0x52d14d;});}})[_0xfe9e('0x28')](function(_0x99780d){_0x4dcd63=_0x99780d||[];if(_0x59697d){return db[_0xfe9e('0x95')][_0xfe9e('0x4e')]({'where':{'id':_0x23b8e6['body'][_0xfe9e('0x8d')]},'attributes':['id',_0xfe9e('0x32'),_0xfe9e('0x96'),_0xfe9e('0x7b'),_0xfe9e('0x7a')],'raw':!![]});}})[_0xfe9e('0x28')](function(_0x17b60a){if(!_['isEmpty'](_0x17b60a)){var _0x57a1ae=[];for(var _0x18a5e6=0x0;_0x18a5e6<_0x17b60a[_0xfe9e('0x42')];_0x18a5e6++){if(_0x17b60a[_0x18a5e6][_0xfe9e('0x96')]){_0x57a1ae['push'](db[_0xfe9e('0x78')]['upsert']({'membername':_0x17b60a[_0x18a5e6]['name'],'UserId':_0x17b60a[_0x18a5e6]['id'],'queue_name':_0x59697d[_0xfe9e('0x32')],'VoiceQueueId':_0x59697d['id'],'interface':_[_0xfe9e('0x97')](_0x17b60a[_0x18a5e6]['interface'])?util['format'](_0xfe9e('0x98'),_0x17b60a[_0x18a5e6][_0xfe9e('0x32')]):_0x17b60a[_0x18a5e6][_0xfe9e('0x7a')],'paused':_0x17b60a[_0x18a5e6][_0xfe9e('0x7b')]||![],'penalty':_0x23b8e6[_0xfe9e('0x56')][_0xfe9e('0x73')]||0x0}));}}return BPromise['all'](_0x57a1ae);}})[_0xfe9e('0x28')](function(){return _0x4dcd63;})['then'](respondWithResult(_0x446372,null))[_0xfe9e('0x50')](handleError(_0x446372,null));};exports[_0xfe9e('0x8f')]=function(_0x540337,_0x53c03e,_0x49940b){return db[_0xfe9e('0x51')]['find']({'where':{'id':_0x540337[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x53c03e,null))[_0xfe9e('0x28')](function(_0x241114){if(_0x241114){return _0x241114[_0xfe9e('0x8f')](_0x540337['query'][_0xfe9e('0x8d')])[_0xfe9e('0x28')](function(){if(_[_0xfe9e('0x99')](_0x540337[_0xfe9e('0x3e')]['ids'])){for(var _0x4a4a0c=0x0;_0x4a4a0c<_0x540337[_0xfe9e('0x3e')][_0xfe9e('0x8d')]['length'];_0x4a4a0c+=0x1){socket[_0xfe9e('0x90')](_0xfe9e('0x91'),{'UserId':Number(_0x540337[_0xfe9e('0x3e')][_0xfe9e('0x8d')][_0x4a4a0c]),'VoiceQueueId':Number(_0x540337[_0xfe9e('0x5f')]['id'])});}}else{socket[_0xfe9e('0x90')]('userVoiceQueue:remove',{'UserId':Number(_0x540337[_0xfe9e('0x3e')][_0xfe9e('0x8d')]),'VoiceQueueId':Number(_0x540337[_0xfe9e('0x5f')]['id'])});}});}})[_0xfe9e('0x28')](function(_0x352ec3){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x540337[_0xfe9e('0x5f')]['id'],'UserId':_0x540337[_0xfe9e('0x3e')][_0xfe9e('0x8d')]}})[_0xfe9e('0x28')](function(){return _0x352ec3;});})[_0xfe9e('0x28')](respondWithStatusCode(_0x53c03e,null))['catch'](handleError(_0x53c03e,null));};exports[_0xfe9e('0x9a')]=function(_0x3d2d95,_0x3c3667,_0x45dd78){var _0x29f343={};var _0x24aeaf={};var _0x47ae07;var _0x27561b;return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0x3d2d95[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x3c3667,null))[_0xfe9e('0x28')](function(_0x19e0fe){if(_0x19e0fe){_0x47ae07=_0x19e0fe;_0x24aeaf[_0xfe9e('0x3c')]=_['keys'](db[_0xfe9e('0x95')][_0xfe9e('0x38')]);_0x24aeaf[_0xfe9e('0x3e')]=_[_0xfe9e('0x3d')](_0x3d2d95['query']);_0x24aeaf[_0xfe9e('0x3f')]=_[_0xfe9e('0x40')](_0x24aeaf[_0xfe9e('0x3c')],_0x24aeaf[_0xfe9e('0x3e')]);_0x29f343[_0xfe9e('0x41')]=_[_0xfe9e('0x40')](_0x24aeaf[_0xfe9e('0x3c')],qs['fields'](_0x3d2d95[_0xfe9e('0x3e')][_0xfe9e('0x52')]));_0x29f343[_0xfe9e('0x41')]=_0x29f343[_0xfe9e('0x41')]['length']?_0x29f343[_0xfe9e('0x41')]:_0x24aeaf[_0xfe9e('0x3c')];_0x29f343[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0x3d2d95[_0xfe9e('0x3e')]['sort']);_0x29f343[_0xfe9e('0x49')]=qs[_0xfe9e('0x3f')](_[_0xfe9e('0x47')](_0x3d2d95[_0xfe9e('0x3e')],_0x24aeaf[_0xfe9e('0x3f')]));if(_0x3d2d95['query'][_0xfe9e('0x48')]){_0x29f343[_0xfe9e('0x49')]=_[_0xfe9e('0x4a')](_0x29f343[_0xfe9e('0x49')],{'$or':_['map'](_0x29f343[_0xfe9e('0x41')],function(_0x2db398){var _0x507891={};_0x507891[_0x2db398]={'$like':'%'+_0x3d2d95[_0xfe9e('0x3e')][_0xfe9e('0x48')]+'%'};return _0x507891;})});}_0x29f343=_['merge']({},_0x29f343,_0x3d2d95[_0xfe9e('0x4c')]);return _0x47ae07['getAgents'](_0x29f343);}})[_0xfe9e('0x28')](function(_0x5b5752){if(_0x5b5752){_0x27561b=_0x5b5752[_0xfe9e('0x42')];if(!_0x3d2d95[_0xfe9e('0x3e')][_0xfe9e('0x43')](_0xfe9e('0x44'))){_0x29f343['limit']=qs[_0xfe9e('0x1e')](_0x3d2d95[_0xfe9e('0x3e')][_0xfe9e('0x1e')]);_0x29f343[_0xfe9e('0x20')]=qs[_0xfe9e('0x20')](_0x3d2d95[_0xfe9e('0x3e')][_0xfe9e('0x20')]);}return _0x47ae07[_0xfe9e('0x9a')](_0x29f343);}})['then'](function(_0x1230ca){if(_0x1230ca){return _0x1230ca?{'count':_0x27561b,'rows':_0x1230ca}:null;}})[_0xfe9e('0x28')](respondWithResult(_0x3c3667,null))[_0xfe9e('0x50')](handleError(_0x3c3667,null));};exports[_0xfe9e('0x9b')]=function(_0x50d8d4,_0x308337,_0x4d7a98){var _0x4ff662={};var _0x2a6e55={};var _0x32da61;var _0x526744;return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0x50d8d4[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x308337,null))[_0xfe9e('0x28')](function(_0x31e583){if(_0x31e583){_0x32da61=_0x31e583;_0x2a6e55['model']=_[_0xfe9e('0x3d')](db['UserVoiceQueueRt'][_0xfe9e('0x38')]);_0x2a6e55[_0xfe9e('0x3e')]=_[_0xfe9e('0x3d')](_0x50d8d4['query']);_0x2a6e55['filters']=_[_0xfe9e('0x40')](_0x2a6e55[_0xfe9e('0x3c')],_0x2a6e55[_0xfe9e('0x3e')]);_0x4ff662[_0xfe9e('0x41')]=_[_0xfe9e('0x40')](_0x2a6e55[_0xfe9e('0x3c')],qs[_0xfe9e('0x52')](_0x50d8d4[_0xfe9e('0x3e')][_0xfe9e('0x52')]));_0x4ff662['attributes']=_0x4ff662[_0xfe9e('0x41')][_0xfe9e('0x42')]?_0x4ff662['attributes']:_0x2a6e55[_0xfe9e('0x3c')];_0x4ff662[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0x50d8d4[_0xfe9e('0x3e')]['sort']);_0x4ff662[_0xfe9e('0x49')]=qs[_0xfe9e('0x3f')](_[_0xfe9e('0x47')](_0x50d8d4[_0xfe9e('0x3e')],_0x2a6e55[_0xfe9e('0x3f')]));if(_0x50d8d4[_0xfe9e('0x3e')][_0xfe9e('0x48')]){_0x4ff662[_0xfe9e('0x49')]=_[_0xfe9e('0x4a')](_0x4ff662['where'],{'$or':_[_0xfe9e('0x2f')](_0x4ff662[_0xfe9e('0x41')],function(_0x979058){var _0x5d9ae8={};_0x5d9ae8[_0x979058]={'$like':'%'+_0x50d8d4[_0xfe9e('0x3e')][_0xfe9e('0x48')]+'%'};return _0x5d9ae8;})});}_0x4ff662=_[_0xfe9e('0x4a')]({},_0x4ff662,_0x50d8d4[_0xfe9e('0x4c')]);return _0x32da61[_0xfe9e('0x9b')](_0x4ff662);}})[_0xfe9e('0x28')](function(_0x1330ad){if(_0x1330ad){_0x526744=_0x1330ad[_0xfe9e('0x42')];if(!_0x50d8d4[_0xfe9e('0x3e')][_0xfe9e('0x43')]('nolimit')){_0x4ff662['limit']=qs['limit'](_0x50d8d4[_0xfe9e('0x3e')]['limit']);_0x4ff662[_0xfe9e('0x20')]=qs['offset'](_0x50d8d4[_0xfe9e('0x3e')]['offset']);}return _0x32da61[_0xfe9e('0x9b')](_0x4ff662);}})['then'](function(_0x1854a9){return _0x1854a9?{'count':_0x526744,'rows':_0x1854a9}:null;})[_0xfe9e('0x28')](respondWithResult(_0x308337,null))[_0xfe9e('0x50')](handleError(_0x308337,null));};exports[_0xfe9e('0x9c')]=function(_0x21a222,_0xe61e12,_0x222873){var _0x3f9cc1={};var _0x4ac25f={};var _0x1c7701;var _0x3fe96a;return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0x21a222[_0xfe9e('0x5f')]['id']}})['then'](handleEntityNotFound(_0xe61e12,null))[_0xfe9e('0x28')](function(_0x5148d5){if(_0x5148d5){_0x1c7701=_0x5148d5;_0x4ac25f[_0xfe9e('0x3c')]=_[_0xfe9e('0x3d')](db[_0xfe9e('0x9d')][_0xfe9e('0x38')]);_0x4ac25f['query']=_['keys'](_0x21a222[_0xfe9e('0x3e')]);_0x4ac25f[_0xfe9e('0x3f')]=_['intersection'](_0x4ac25f[_0xfe9e('0x3c')],_0x4ac25f[_0xfe9e('0x3e')]);_0x3f9cc1[_0xfe9e('0x41')]=_[_0xfe9e('0x40')](_0x4ac25f[_0xfe9e('0x3c')],qs[_0xfe9e('0x52')](_0x21a222[_0xfe9e('0x3e')][_0xfe9e('0x52')]));_0x3f9cc1[_0xfe9e('0x41')]=_0x3f9cc1[_0xfe9e('0x41')][_0xfe9e('0x42')]?_0x3f9cc1['attributes']:_0x4ac25f[_0xfe9e('0x3c')];_0x3f9cc1['order']=qs[_0xfe9e('0x46')](_0x21a222[_0xfe9e('0x3e')][_0xfe9e('0x46')]);_0x3f9cc1['where']=qs[_0xfe9e('0x3f')](_['pick'](_0x21a222[_0xfe9e('0x3e')],_0x4ac25f['filters']));if(_0x21a222[_0xfe9e('0x3e')][_0xfe9e('0x48')]){_0x3f9cc1[_0xfe9e('0x49')]=_[_0xfe9e('0x4a')](_0x3f9cc1[_0xfe9e('0x49')],{'$or':_['map'](_0x3f9cc1[_0xfe9e('0x41')],function(_0x3e0cd2){var _0x39c040={};_0x39c040[_0x3e0cd2]={'$like':'%'+_0x21a222[_0xfe9e('0x3e')]['filter']+'%'};return _0x39c040;})});}_0x3f9cc1=_[_0xfe9e('0x4a')]({},_0x3f9cc1,_0x21a222[_0xfe9e('0x4c')]);return _0x1c7701[_0xfe9e('0x9c')](_0x3f9cc1);}})[_0xfe9e('0x28')](function(_0x21d7fd){if(_0x21d7fd){_0x3fe96a=_0x21d7fd[_0xfe9e('0x42')];if(!_0x21a222[_0xfe9e('0x3e')]['hasOwnProperty']('nolimit')){_0x3f9cc1[_0xfe9e('0x1e')]=qs['limit'](_0x21a222[_0xfe9e('0x3e')][_0xfe9e('0x1e')]);_0x3f9cc1[_0xfe9e('0x20')]=qs[_0xfe9e('0x20')](_0x21a222[_0xfe9e('0x3e')][_0xfe9e('0x20')]);}return _0x1c7701[_0xfe9e('0x9c')](_0x3f9cc1);}})[_0xfe9e('0x28')](function(_0x35a08e){if(_0x35a08e){return _0x35a08e?{'count':_0x3fe96a,'rows':_0x35a08e}:null;}})[_0xfe9e('0x28')](respondWithResult(_0xe61e12,null))[_0xfe9e('0x50')](handleError(_0xe61e12,null));};exports[_0xfe9e('0x9e')]=function(_0x1655a1,_0x5b0e47,_0x266f56){var _0x305822=moment()[_0xfe9e('0x79')](_0xfe9e('0x9f'));var _0x1a26f1,_0xf2fc3a;return db[_0xfe9e('0x51')][_0xfe9e('0x54')]({'where':{'id':_0x1655a1[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x5b0e47,null))[_0xfe9e('0x28')](function(_0x6f1145){if(_0x6f1145){_0xf2fc3a=_0x6f1145;return _0x6f1145[_0xfe9e('0x9e')](_0x1655a1['body'][_0xfe9e('0x8d')],_['omit'](_0x1655a1[_0xfe9e('0x56')],[_0xfe9e('0x8d'),'id'])||{});}return null;})[_0xfe9e('0x93')](function(_0x348a73){var _0x51ac0a;_0x1a26f1=_0x348a73||[];var _0x228b24=[];if(_0x348a73){for(var _0x86b762=0x0;_0x86b762<_0x348a73[_0xfe9e('0x42')];_0x86b762+=0x1){var _0x2807e7=_0x348a73[_0x86b762][_0xfe9e('0x2a')]({'plain':!![]});_0xf2fc3a[_0xfe9e('0xa0')]=_0x1655a1[_0xfe9e('0x56')][_0xfe9e('0xa0')]?_0x1655a1['body'][_0xfe9e('0xa0')]:_0xf2fc3a[_0xfe9e('0xa0')];switch(_0xf2fc3a[_0xfe9e('0xa0')]){case _0xfe9e('0xa1'):_0x51ac0a=squel['insert']()[_0xfe9e('0xa2')](_0xfe9e('0xa3'))['fromQuery']([_0xfe9e('0xa4'),_0xfe9e('0xa5'),_0xfe9e('0xa6'),_0xfe9e('0xa7'),_0xfe9e('0x6a'),_0xfe9e('0x61'),'updatedAt'],squel[_0xfe9e('0x7e')]()[_0xfe9e('0x7f')](_0xfe9e('0xa4'),'phone')[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27',_0xfe9e('0xa5'))[_0xfe9e('0x7f')]('id','ContactId')[_0xfe9e('0x7f')](_0x2807e7[_0xfe9e('0xa8')]['toString'](),_0xfe9e('0xa7'))['field'](_0x1655a1['params']['id'][_0xfe9e('0x87')](),_0xfe9e('0x6a'))[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27','createdAt')['field']('\x27'+_0x305822+'\x27','updatedAt')[_0xfe9e('0x81')]('cm_contacts')[_0xfe9e('0x49')](_0xfe9e('0xa9'))[_0xfe9e('0x49')](_0xfe9e('0xaa'),_0x2807e7[_0xfe9e('0xa8')][_0xfe9e('0x87')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xfe9e('0x49')](_0xfe9e('0xab'),squel[_0xfe9e('0x7e')]()[_0xfe9e('0x7f')](_0xfe9e('0xac'))[_0xfe9e('0x81')](_0xfe9e('0xad'))[_0xfe9e('0x49')](_0xfe9e('0x85'),_0x1655a1[_0xfe9e('0x5f')]['id']['toString']()))['where'](_0xfe9e('0xab'),squel[_0xfe9e('0x7e')]()['field']('COALESCE(phone,\x27\x27)')[_0xfe9e('0x81')](_0xfe9e('0xa3'))[_0xfe9e('0x49')](_0xfe9e('0x85'),_0x1655a1[_0xfe9e('0x5f')]['id'][_0xfe9e('0x87')]())))[_0xfe9e('0x87')]();break;case _0xfe9e('0xae'):_0x51ac0a=squel['insert']()[_0xfe9e('0xa2')](_0xfe9e('0xa3'))[_0xfe9e('0xaf')]([_0xfe9e('0xa4'),_0xfe9e('0xa5'),_0xfe9e('0xa6'),'ListId',_0xfe9e('0x6a'),'createdAt',_0xfe9e('0x62')],squel[_0xfe9e('0x7e')]()[_0xfe9e('0x7f')]('phone',_0xfe9e('0xa4'))[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27',_0xfe9e('0xa5'))[_0xfe9e('0x7f')]('id','ContactId')[_0xfe9e('0x7f')](_0x2807e7[_0xfe9e('0xa8')][_0xfe9e('0x87')](),_0xfe9e('0xa7'))['field'](_0x1655a1[_0xfe9e('0x5f')]['id'][_0xfe9e('0x87')](),'VoiceQueueId')[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27',_0xfe9e('0x61'))['field']('\x27'+_0x305822+'\x27','updatedAt')['from'](_0xfe9e('0xb0'))[_0xfe9e('0x49')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x2807e7['CmListId']['toString']())[_0xfe9e('0x49')](_0xfe9e('0xb1'))[_0xfe9e('0x49')](_0xfe9e('0xab'),squel[_0xfe9e('0x7e')]()[_0xfe9e('0x7f')]('COALESCE(phone,\x27\x27)')[_0xfe9e('0x81')]('cm_hopper')['where'](_0xfe9e('0x85'),_0x1655a1[_0xfe9e('0x5f')]['id'][_0xfe9e('0x87')]())))[_0xfe9e('0x87')]();break;default:_0x51ac0a=squel[_0xfe9e('0xb2')]()[_0xfe9e('0xa2')]('cm_hopper')[_0xfe9e('0xaf')]([_0xfe9e('0xa4'),_0xfe9e('0xa5'),_0xfe9e('0xa6'),_0xfe9e('0xa7'),'VoiceQueueId',_0xfe9e('0x61'),_0xfe9e('0x62')],squel[_0xfe9e('0x7e')]()[_0xfe9e('0x7f')]('phone',_0xfe9e('0xa4'))['field']('\x27'+_0x305822+'\x27',_0xfe9e('0xa5'))[_0xfe9e('0x7f')]('id',_0xfe9e('0xa6'))['field'](_0x2807e7['CmListId'][_0xfe9e('0x87')](),_0xfe9e('0xa7'))[_0xfe9e('0x7f')](_0x1655a1[_0xfe9e('0x5f')]['id'][_0xfe9e('0x87')](),'VoiceQueueId')[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27',_0xfe9e('0x61'))[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27',_0xfe9e('0x62'))['from']('cm_contacts')[_0xfe9e('0x49')](_0xfe9e('0xa9'))[_0xfe9e('0x49')](_0xfe9e('0xaa'),_0x2807e7[_0xfe9e('0xa8')]['toString']())[_0xfe9e('0x49')](_0xfe9e('0xb1')))[_0xfe9e('0x87')]();}_0x228b24['push'](db[_0xfe9e('0x74')][_0xfe9e('0x3e')](_0x51ac0a));}return BPromise[_0xfe9e('0x8b')](_0x228b24);}})[_0xfe9e('0x28')](function(){var _0x23b3f6=[];var _0xa271e9=squel[_0xfe9e('0xb2')]()[_0xfe9e('0xa2')](_0xfe9e('0xb3'))[_0xfe9e('0xaf')]([_0xfe9e('0xb4'),'phone','OrderBy',_0xfe9e('0x61'),_0xfe9e('0x62')],squel[_0xfe9e('0x7e')]()['field'](_0xfe9e('0xb5'))['field']('ci.item')[_0xfe9e('0x7f')](_0xfe9e('0xb6'))[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27','createdAt')[_0xfe9e('0x7f')]('\x27'+_0x305822+'\x27',_0xfe9e('0x62'))[_0xfe9e('0x81')](_0xfe9e('0xb7'),'ci')['join'](_0xfe9e('0xa3'),'h',_0xfe9e('0xb8'))[_0xfe9e('0x49')](_0xfe9e('0xb9'),_0x305822)[_0xfe9e('0x49')]('ci.ItemClass=?',_0xfe9e('0xba')))['toString']();_0x23b3f6[_0xfe9e('0xbb')](db[_0xfe9e('0x74')][_0xfe9e('0x3e')](_0xa271e9));return BPromise[_0xfe9e('0x8b')](_0x23b3f6);})[_0xfe9e('0x28')](function(){return _0x1a26f1;})[_0xfe9e('0x28')](respondWithResult(_0x5b0e47,null))['catch'](handleError(_0x5b0e47,null));};exports[_0xfe9e('0xbc')]=function(_0x4be935,_0x30e908,_0x5445cf){return db[_0xfe9e('0x51')][_0xfe9e('0x54')]({'where':{'id':_0x4be935[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x30e908,null))[_0xfe9e('0x28')](function(_0xedda38){if(_0xedda38){return _0xedda38[_0xfe9e('0xbc')](_0x4be935[_0xfe9e('0x3e')][_0xfe9e('0x8d')]);}})['then'](function(_0x3bec32){if(_0x3bec32){return db[_0xfe9e('0x65')][_0xfe9e('0x29')]({'where':{'ListId':_0x4be935[_0xfe9e('0x3e')][_0xfe9e('0x8d')],'VoiceQueueId':_0x4be935[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](function(){return _0x3bec32;});}})[_0xfe9e('0x28')](respondWithStatusCode(_0x30e908,null))['catch'](handleError(_0x30e908,null));};exports[_0xfe9e('0xbd')]=function(_0x1d9e62,_0x11ce30,_0x5e13e4){var _0x221d54={};var _0x9241f1={};var _0x2b3a7e;var _0x3aaa7b;return db[_0xfe9e('0x51')][_0xfe9e('0x64')]({'where':{'id':_0x1d9e62[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x11ce30,null))[_0xfe9e('0x28')](function(_0x2dfa2e){if(_0x2dfa2e){_0x2b3a7e=_0x2dfa2e;_0x9241f1['model']=_[_0xfe9e('0x3d')](db[_0xfe9e('0x9d')][_0xfe9e('0x38')]);_0x9241f1[_0xfe9e('0x3e')]=_[_0xfe9e('0x3d')](_0x1d9e62['query']);_0x9241f1[_0xfe9e('0x3f')]=_[_0xfe9e('0x40')](_0x9241f1['model'],_0x9241f1[_0xfe9e('0x3e')]);_0x221d54[_0xfe9e('0x41')]=_['intersection'](_0x9241f1['model'],qs[_0xfe9e('0x52')](_0x1d9e62[_0xfe9e('0x3e')]['fields']));_0x221d54[_0xfe9e('0x41')]=_0x221d54[_0xfe9e('0x41')][_0xfe9e('0x42')]?_0x221d54['attributes']:_0x9241f1[_0xfe9e('0x3c')];_0x221d54[_0xfe9e('0x45')]=qs[_0xfe9e('0x46')](_0x1d9e62[_0xfe9e('0x3e')]['sort']);_0x221d54['where']=qs[_0xfe9e('0x3f')](_['pick'](_0x1d9e62[_0xfe9e('0x3e')],_0x9241f1[_0xfe9e('0x3f')]));if(_0x1d9e62['query'][_0xfe9e('0x48')]){_0x221d54[_0xfe9e('0x49')]=_[_0xfe9e('0x4a')](_0x221d54[_0xfe9e('0x49')],{'$or':_[_0xfe9e('0x2f')](_0x221d54[_0xfe9e('0x41')],function(_0x1bf8ef){var _0x44a944={};_0x44a944[_0x1bf8ef]={'$like':'%'+_0x1d9e62[_0xfe9e('0x3e')][_0xfe9e('0x48')]+'%'};return _0x44a944;})});}_0x221d54=_[_0xfe9e('0x4a')]({},_0x221d54,_0x1d9e62[_0xfe9e('0x4c')]);return _0x2b3a7e[_0xfe9e('0xbd')](_0x221d54);}})[_0xfe9e('0x28')](function(_0x5905aa){if(_0x5905aa){_0x3aaa7b=_0x5905aa['length'];if(!_0x1d9e62['query'][_0xfe9e('0x43')](_0xfe9e('0x44'))){_0x221d54[_0xfe9e('0x1e')]=qs['limit'](_0x1d9e62[_0xfe9e('0x3e')][_0xfe9e('0x1e')]);_0x221d54[_0xfe9e('0x20')]=qs[_0xfe9e('0x20')](_0x1d9e62[_0xfe9e('0x3e')][_0xfe9e('0x20')]);}return _0x2b3a7e[_0xfe9e('0xbd')](_0x221d54);}})['then'](function(_0xe03c1){if(_0xe03c1){return _0xe03c1?{'count':_0x3aaa7b,'rows':_0xe03c1}:null;}})[_0xfe9e('0x28')](respondWithResult(_0x11ce30,null))[_0xfe9e('0x50')](handleError(_0x11ce30,null));};exports[_0xfe9e('0xbe')]=function(_0x3a8bb1,_0x184698,_0x4166b2){var _0x3d47c4,_0x12de82;return db[_0xfe9e('0x51')][_0xfe9e('0x54')]({'where':{'id':_0x3a8bb1[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x184698,null))[_0xfe9e('0x28')](function(_0x4c69fe){if(_0x4c69fe){_0x12de82=_0x4c69fe;return _0x4c69fe['addBlackLists'](_0x3a8bb1[_0xfe9e('0x56')][_0xfe9e('0x8d')],_[_0xfe9e('0x60')](_0x3a8bb1[_0xfe9e('0x56')],[_0xfe9e('0x8d'),'id'])||{});}return null;})[_0xfe9e('0x93')](function(_0x410852){var _0x16bea8;_0x3d47c4=_0x410852||[];var _0x3e214b=[];if(_0x410852){for(var _0x3e00c5=0x0;_0x3e00c5<_0x410852[_0xfe9e('0x42')];_0x3e00c5+=0x1){var _0x4b0b80=_0x410852[_0x3e00c5][_0xfe9e('0x2a')]({'plain':!![]});_0x16bea8=squel[_0xfe9e('0xb2')]()['into'](_0xfe9e('0xbf'))[_0xfe9e('0xaf')]([_0xfe9e('0xa4'),_0xfe9e('0xa6'),_0xfe9e('0xa7'),_0xfe9e('0x6a'),'createdAt',_0xfe9e('0x62')],squel[_0xfe9e('0x7e')]()[_0xfe9e('0x7f')](_0xfe9e('0xa4'),_0xfe9e('0xa4'))['field']('id',_0xfe9e('0xa6'))[_0xfe9e('0x7f')](_0x4b0b80[_0xfe9e('0xa8')][_0xfe9e('0x87')](),_0xfe9e('0xa7'))[_0xfe9e('0x7f')](_0x3a8bb1['params']['id'][_0xfe9e('0x87')](),_0xfe9e('0x6a'))[_0xfe9e('0x7f')](_0xfe9e('0xc0'),_0xfe9e('0x61'))[_0xfe9e('0x7f')](_0xfe9e('0xc0'),_0xfe9e('0x62'))[_0xfe9e('0x81')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xfe9e('0x49')](_0xfe9e('0xaa'),_0x4b0b80[_0xfe9e('0xa8')][_0xfe9e('0x87')]())['where'](_0xfe9e('0xb1')))['toString']();_0x3e214b['push'](db[_0xfe9e('0x74')][_0xfe9e('0x3e')](_0x16bea8));}return BPromise[_0xfe9e('0x8b')](_0x3e214b);}})[_0xfe9e('0x28')](function(){return _0x3d47c4;})[_0xfe9e('0x28')](respondWithResult(_0x184698,null))[_0xfe9e('0x50')](handleError(_0x184698,null));};exports[_0xfe9e('0xc1')]=function(_0x47b914,_0x2f3b37,_0x2699fa){return db[_0xfe9e('0x51')][_0xfe9e('0x54')]({'where':{'id':_0x47b914[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](handleEntityNotFound(_0x2f3b37,null))[_0xfe9e('0x28')](function(_0x500aa9){if(_0x500aa9){return _0x500aa9[_0xfe9e('0xc1')](_0x47b914['query'][_0xfe9e('0x8d')]);}})['then'](function(_0x1cf4fd){if(_0x1cf4fd){return db[_0xfe9e('0x6c')][_0xfe9e('0x29')]({'where':{'ListId':_0x47b914[_0xfe9e('0x3e')]['ids'],'VoiceQueueId':_0x47b914[_0xfe9e('0x5f')]['id']}})[_0xfe9e('0x28')](function(){return _0x1cf4fd;});}})['then'](respondWithStatusCode(_0x2f3b37,null))['catch'](handleError(_0x2f3b37,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 14f232f..1532ad5 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 _0x23fd=['exports','events','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x324d49,_0x54408e){var _0x1db6f0=function(_0x1cdf84){while(--_0x1cdf84){_0x324d49['push'](_0x324d49['shift']());}};_0x1db6f0(++_0x54408e);}(_0x23fd,0x141));var _0xd23f=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x23fd[_0x553502];return _0x246c37;};'use strict';var EventEmitter=require(_0xd23f('0x0'));var VoiceQueue=require(_0xd23f('0x1'))['db'][_0xd23f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd23f('0x3'),'afterUpdate':_0xd23f('0x4'),'afterDestroy':_0xd23f('0x5')};function emitEvent(_0x5bf551){return function(_0x3511a8,_0x42c5bf,_0x333368){VoiceQueueEvents[_0xd23f('0x6')](_0x5bf551+':'+_0x3511a8['id'],_0x3511a8);VoiceQueueEvents['emit'](_0x5bf551,_0x3511a8);_0x333368(null);};}for(var e in events){if(events[_0xd23f('0x7')](e)){var event=events[e];VoiceQueue[_0xd23f('0x8')](e,emitEvent(event));}}module[_0xd23f('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x150c=['exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x29dccf,_0x58336b){var _0x47f471=function(_0x40ec2e){while(--_0x40ec2e){_0x29dccf['push'](_0x29dccf['shift']());}};_0x47f471(++_0x58336b);}(_0x150c,0x17d));var _0xc150=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x150c[_0x330414];return _0x99dbff;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xc150('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc150('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc150('0x2')};function emitEvent(_0x3dbc01){return function(_0x2c8f47,_0x1a5d8d,_0x2f1fbe){VoiceQueueEvents['emit'](_0x3dbc01+':'+_0x2c8f47['id'],_0x2c8f47);VoiceQueueEvents[_0xc150('0x3')](_0x3dbc01,_0x2c8f47);_0x2f1fbe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xc150('0x4')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d309eef..0e5601d 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(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x55ca,0x126));var _0xa55c=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x55ca[_0x3e7804];return _0x56efda;};'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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x3e74,0x175));var _0x43e7=function(_0x334644,_0x5f42d6){_0x334644=_0x334644-0x0;var _0x442d46=_0x3e74[_0x334644];return _0x442d46;};'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/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index fcec7ae..34388d8 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 _0x1f34=['then','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','map','model','include','ShowVoiceQueue','find'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x1f34,0x129));var _0x41f3=function(_0x1b45ad,_0x3b7f8a){_0x1b45ad=_0x1b45ad-0x0;var _0x10f46d=_0x1f34[_0x1b45ad];return _0x10f46d;};'use strict';var _=require(_0x41f3('0x0'));var util=require('util');var moment=require(_0x41f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x41f3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41f3('0x3'))['db'];var utils=require(_0x41f3('0x4'));var logger=require(_0x41f3('0x5'))('rpc');var config=require(_0x41f3('0x6'));var jayson=require(_0x41f3('0x7'));var client=jayson[_0x41f3('0x8')][_0x41f3('0x9')]({'port':0x232a});config[_0x41f3('0xa')]=_[_0x41f3('0xb')](config[_0x41f3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x41f3('0xc'))(new Redis(config[_0x41f3('0xa')]));require(_0x41f3('0xd'))[_0x41f3('0xe')](socket);function respondWithRpcPromise(_0x3a0d56,_0x518b72,_0xf2f806){return new BPromise(function(_0x21dd69,_0x532349){return client['request'](_0x3a0d56,_0xf2f806)['then'](function(_0x5cfa38){logger['info'](_0x41f3('0xf'),_0x518b72,_0x41f3('0x10'));logger[_0x41f3('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x518b72,'request\x20sent',JSON[_0x41f3('0x12')](_0x5cfa38));if(_0x5cfa38[_0x41f3('0x13')]){if(_0x5cfa38[_0x41f3('0x13')][_0x41f3('0x14')]===0x1f4){logger[_0x41f3('0x13')](_0x41f3('0xf'),_0x518b72,_0x5cfa38[_0x41f3('0x13')][_0x41f3('0x15')]);return _0x532349(_0x5cfa38[_0x41f3('0x13')]['message']);}logger[_0x41f3('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x518b72,_0x5cfa38[_0x41f3('0x13')][_0x41f3('0x15')]);return _0x21dd69(_0x5cfa38['error'][_0x41f3('0x15')]);}else{logger[_0x41f3('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x518b72,_0x41f3('0x10'));_0x21dd69(_0x5cfa38['result'][_0x41f3('0x15')]);}})[_0x41f3('0x17')](function(_0x35460d){logger[_0x41f3('0x13')](_0x41f3('0xf'),_0x518b72,_0x35460d);_0x532349(_0x35460d);});});}exports[_0x41f3('0x18')]=function(_0x1475b9){var _0x15de03=this;return new Promise(function(_0x2f663b,_0x1c37e0){return db[_0x41f3('0x19')][_0x41f3('0x1a')]({'raw':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9[_0x41f3('0x1b')][_0x41f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9['options']['where']||null:null,'attributes':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9['options'][_0x41f3('0x1d')]||null:null,'limit':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9[_0x41f3('0x1b')][_0x41f3('0x1e')]||null:null,'include':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9[_0x41f3('0x1b')]['include']?_[_0x41f3('0x1f')](_0x1475b9['options']['include'],function(_0x3ac719){return{'model':db[_0x3ac719[_0x41f3('0x20')]],'as':_0x3ac719['as'],'attributes':_0x3ac719[_0x41f3('0x1d')],'include':_0x3ac719['include']?_['map'](_0x3ac719[_0x41f3('0x21')],function(_0x53d9da){return{'model':db[_0x53d9da['model']],'as':_0x53d9da['as'],'attributes':_0x53d9da[_0x41f3('0x1d')],'include':_0x53d9da[_0x41f3('0x21')]?_[_0x41f3('0x1f')](_0x53d9da[_0x41f3('0x21')],function(_0x132c72){return{'model':db[_0x132c72['model']],'as':_0x132c72['as'],'attributes':_0x132c72[_0x41f3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x365dfd){logger['info'](_0x41f3('0x18'),_0x1475b9);logger[_0x41f3('0x11')](_0x41f3('0x18'),_0x1475b9,JSON[_0x41f3('0x12')](_0x365dfd));_0x2f663b(_0x365dfd);})[_0x41f3('0x17')](function(_0x2c0c83){logger[_0x41f3('0x13')](_0x41f3('0x18'),_0x2c0c83['message'],_0x1475b9);_0x1c37e0(_0x15de03[_0x41f3('0x13')](0x1f4,_0x2c0c83[_0x41f3('0x15')]));});});};exports[_0x41f3('0x22')]=function(_0x436942){var _0x4f4ac2=this;return new Promise(function(_0x8deed7,_0xd4a586){return db[_0x41f3('0x19')][_0x41f3('0x23')]({'raw':_0x436942[_0x41f3('0x1b')]?_0x436942['options'][_0x41f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x436942['options']?_0x436942[_0x41f3('0x1b')]['where']||null:null,'attributes':_0x436942[_0x41f3('0x1b')]?_0x436942[_0x41f3('0x1b')][_0x41f3('0x1d')]||null:null,'include':_0x436942[_0x41f3('0x1b')]?_0x436942[_0x41f3('0x1b')][_0x41f3('0x21')]?_['map'](_0x436942[_0x41f3('0x1b')]['include'],function(_0x180644){return{'model':db[_0x180644[_0x41f3('0x20')]],'as':_0x180644['as'],'attributes':_0x180644[_0x41f3('0x1d')],'include':_0x180644[_0x41f3('0x21')]?_[_0x41f3('0x1f')](_0x180644[_0x41f3('0x21')],function(_0x2c4229){return{'model':db[_0x2c4229[_0x41f3('0x20')]],'as':_0x2c4229['as'],'attributes':_0x2c4229[_0x41f3('0x1d')],'include':_0x2c4229['include']?_[_0x41f3('0x1f')](_0x2c4229[_0x41f3('0x21')],function(_0x1a4774){return{'model':db[_0x1a4774['model']],'as':_0x1a4774['as'],'attributes':_0x1a4774[_0x41f3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x41f3('0x24')](function(_0x1b403e){logger[_0x41f3('0x16')]('ShowVoiceQueue',_0x436942);logger[_0x41f3('0x11')](_0x41f3('0x22'),_0x436942,JSON['stringify'](_0x1b403e));_0x8deed7(_0x1b403e);})[_0x41f3('0x17')](function(_0x552159){logger[_0x41f3('0x13')]('ShowVoiceQueue',_0x552159[_0x41f3('0x15')],_0x436942);_0xd4a586(_0x4f4ac2['error'](0x1f4,_0x552159[_0x41f3('0x15')]));});});}; \ No newline at end of file +var _0xe6eb=['socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','model','catch','find','map','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults'];(function(_0x17784a,_0x42fe44){var _0x41aded=function(_0x2e7319){while(--_0x2e7319){_0x17784a['push'](_0x17784a['shift']());}};_0x41aded(++_0x42fe44);}(_0xe6eb,0x1c8));var _0xbe6e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe6eb[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbe6e('0x0'));var util=require(_0xbe6e('0x1'));var moment=require('moment');var BPromise=require(_0xbe6e('0x2'));var rs=require(_0xbe6e('0x3'));var fs=require('fs');var Redis=require(_0xbe6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe6e('0x5'));var logger=require(_0xbe6e('0x6'))(_0xbe6e('0x7'));var config=require('../../config/environment');var jayson=require(_0xbe6e('0x8'));var client=jayson[_0xbe6e('0x9')][_0xbe6e('0xa')]({'port':0x232a});config['redis']=_[_0xbe6e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbe6e('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xbe6e('0xd')](socket);function respondWithRpcPromise(_0x160d56,_0x5c3942,_0x2a08b9){return new BPromise(function(_0x32da41,_0xdc22f7){return client[_0xbe6e('0xe')](_0x160d56,_0x2a08b9)[_0xbe6e('0xf')](function(_0x427a87){logger[_0xbe6e('0x10')](_0xbe6e('0x11'),_0x5c3942,_0xbe6e('0x12'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c3942,_0xbe6e('0x12'),JSON[_0xbe6e('0x13')](_0x427a87));if(_0x427a87[_0xbe6e('0x14')]){if(_0x427a87[_0xbe6e('0x14')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5c3942,_0x427a87[_0xbe6e('0x14')][_0xbe6e('0x15')]);return _0xdc22f7(_0x427a87[_0xbe6e('0x14')][_0xbe6e('0x15')]);}logger[_0xbe6e('0x14')](_0xbe6e('0x11'),_0x5c3942,_0x427a87[_0xbe6e('0x14')]['message']);return _0x32da41(_0x427a87[_0xbe6e('0x14')][_0xbe6e('0x15')]);}else{logger[_0xbe6e('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x5c3942,_0xbe6e('0x12'));_0x32da41(_0x427a87[_0xbe6e('0x16')][_0xbe6e('0x15')]);}})['catch'](function(_0x52ed9a){logger[_0xbe6e('0x14')](_0xbe6e('0x11'),_0x5c3942,_0x52ed9a);_0xdc22f7(_0x52ed9a);});});}exports[_0xbe6e('0x17')]=function(_0x26e5c7){var _0x16ffb4=this;return new Promise(function(_0x23adb9,_0x4cc84f){return db[_0xbe6e('0x18')][_0xbe6e('0x19')]({'raw':_0x26e5c7[_0xbe6e('0x1a')]?_0x26e5c7[_0xbe6e('0x1a')][_0xbe6e('0x1b')]===undefined?!![]:![]:!![],'where':_0x26e5c7[_0xbe6e('0x1a')]?_0x26e5c7['options'][_0xbe6e('0x1c')]||null:null,'attributes':_0x26e5c7[_0xbe6e('0x1a')]?_0x26e5c7[_0xbe6e('0x1a')][_0xbe6e('0x1d')]||null:null,'limit':_0x26e5c7[_0xbe6e('0x1a')]?_0x26e5c7[_0xbe6e('0x1a')]['limit']||null:null,'include':_0x26e5c7['options']?_0x26e5c7['options']['include']?_['map'](_0x26e5c7[_0xbe6e('0x1a')][_0xbe6e('0x1e')],function(_0x39f9d3){return{'model':db[_0x39f9d3[_0xbe6e('0x1f')]],'as':_0x39f9d3['as'],'attributes':_0x39f9d3[_0xbe6e('0x1d')],'include':_0x39f9d3[_0xbe6e('0x1e')]?_['map'](_0x39f9d3[_0xbe6e('0x1e')],function(_0x2f5e54){return{'model':db[_0x2f5e54['model']],'as':_0x2f5e54['as'],'attributes':_0x2f5e54[_0xbe6e('0x1d')],'include':_0x2f5e54[_0xbe6e('0x1e')]?_['map'](_0x2f5e54[_0xbe6e('0x1e')],function(_0x51d4eb){return{'model':db[_0x51d4eb['model']],'as':_0x51d4eb['as'],'attributes':_0x51d4eb[_0xbe6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbe6e('0xf')](function(_0x572c5b){logger[_0xbe6e('0x10')](_0xbe6e('0x17'),_0x26e5c7);logger['debug'](_0xbe6e('0x17'),_0x26e5c7,JSON[_0xbe6e('0x13')](_0x572c5b));_0x23adb9(_0x572c5b);})[_0xbe6e('0x20')](function(_0x57a5fb){logger['error'](_0xbe6e('0x17'),_0x57a5fb[_0xbe6e('0x15')],_0x26e5c7);_0x4cc84f(_0x16ffb4['error'](0x1f4,_0x57a5fb[_0xbe6e('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x429592){var _0x1c8a60=this;return new Promise(function(_0x1f6cfb,_0x1307c5){return db[_0xbe6e('0x18')][_0xbe6e('0x21')]({'raw':_0x429592[_0xbe6e('0x1a')]?_0x429592[_0xbe6e('0x1a')][_0xbe6e('0x1b')]===undefined?!![]:![]:!![],'where':_0x429592['options']?_0x429592['options'][_0xbe6e('0x1c')]||null:null,'attributes':_0x429592[_0xbe6e('0x1a')]?_0x429592['options'][_0xbe6e('0x1d')]||null:null,'include':_0x429592[_0xbe6e('0x1a')]?_0x429592[_0xbe6e('0x1a')][_0xbe6e('0x1e')]?_[_0xbe6e('0x22')](_0x429592[_0xbe6e('0x1a')][_0xbe6e('0x1e')],function(_0x412ba2){return{'model':db[_0x412ba2[_0xbe6e('0x1f')]],'as':_0x412ba2['as'],'attributes':_0x412ba2[_0xbe6e('0x1d')],'include':_0x412ba2[_0xbe6e('0x1e')]?_['map'](_0x412ba2[_0xbe6e('0x1e')],function(_0x296591){return{'model':db[_0x296591[_0xbe6e('0x1f')]],'as':_0x296591['as'],'attributes':_0x296591[_0xbe6e('0x1d')],'include':_0x296591[_0xbe6e('0x1e')]?_[_0xbe6e('0x22')](_0x296591[_0xbe6e('0x1e')],function(_0x126eab){return{'model':db[_0x126eab[_0xbe6e('0x1f')]],'as':_0x126eab['as'],'attributes':_0x126eab[_0xbe6e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34f516){logger[_0xbe6e('0x10')](_0xbe6e('0x23'),_0x429592);logger['debug']('ShowVoiceQueue',_0x429592,JSON[_0xbe6e('0x13')](_0x34f516));_0x1f6cfb(_0x34f516);})['catch'](function(_0x33f718){logger[_0xbe6e('0x14')](_0xbe6e('0x23'),_0x33f718['message'],_0x429592);_0x1307c5(_0x1c8a60[_0xbe6e('0x14')](0x1f4,_0x33f718[_0xbe6e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2e7fd0f..8df2106 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 _0x750a=['register','length','voiceQueue:','save','remove','update','emit','removeListener'];(function(_0x2bcb5f,_0x62a33e){var _0x4c10eb=function(_0x22715b){while(--_0x22715b){_0x2bcb5f['push'](_0x2bcb5f['shift']());}};_0x4c10eb(++_0x62a33e);}(_0x750a,0x9b));var _0xa750=function(_0x454d24,_0x749d57){_0x454d24=_0x454d24-0x0;var _0x311b2c=_0x750a[_0x454d24];return _0x311b2c;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa750('0x0'),_0xa750('0x1'),_0xa750('0x2')];function createListener(_0x569b2a,_0x287204){return function(_0x4da678){_0x287204[_0xa750('0x3')](_0x569b2a,_0x4da678);};}function removeListener(_0x57e050,_0x41dba9){return function(){VoiceQueueEvents[_0xa750('0x4')](_0x57e050,_0x41dba9);};}exports[_0xa750('0x5')]=function(_0x2040c9){for(var _0x16bf72=0x0,_0x278dab=events[_0xa750('0x6')];_0x16bf72<_0x278dab;_0x16bf72++){var _0x587e06=events[_0x16bf72];var _0x5a70f3=createListener(_0xa750('0x7')+_0x587e06,_0x2040c9);VoiceQueueEvents['on'](_0x587e06,_0x5a70f3);}}; \ No newline at end of file +var _0x90c3=['update','emit','register','voiceQueue:','./voiceQueue.events','save'];(function(_0x11e2b0,_0x386c82){var _0x1b9672=function(_0x51096d){while(--_0x51096d){_0x11e2b0['push'](_0x11e2b0['shift']());}};_0x1b9672(++_0x386c82);}(_0x90c3,0x1e4));var _0x390c=function(_0x1361b2,_0x1a685e){_0x1361b2=_0x1361b2-0x0;var _0x351270=_0x90c3[_0x1361b2];return _0x351270;};'use strict';var VoiceQueueEvents=require(_0x390c('0x0'));var events=[_0x390c('0x1'),'remove',_0x390c('0x2')];function createListener(_0x3b1ab4,_0x27f52e){return function(_0xe5d6a6){_0x27f52e[_0x390c('0x3')](_0x3b1ab4,_0xe5d6a6);};}function removeListener(_0x99ce59,_0xb3fc31){return function(){VoiceQueueEvents['removeListener'](_0x99ce59,_0xb3fc31);};}exports[_0x390c('0x4')]=function(_0x57804b){for(var _0x3a3b71=0x0,_0xfad240=events['length'];_0x3a3b71<_0xfad240;_0x3a3b71++){var _0x2ff162=events[_0x3a3b71];var _0x134da6=createListener(_0x390c('0x5')+_0x2ff162,_0x57804b);VoiceQueueEvents['on'](_0x2ff162,_0x134da6);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 317eaef..bc95617 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 _0x1871=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','show','create','put','delete','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x592a9d,_0x434abb){var _0x59d2b3=function(_0x4661dc){while(--_0x4661dc){_0x592a9d['push'](_0x592a9d['shift']());}};_0x59d2b3(++_0x434abb);}(_0x1871,0x19a));var _0x1187=function(_0x5e6103,_0x43a670){_0x5e6103=_0x5e6103-0x0;var _0x1b285a=_0x1871[_0x5e6103];return _0x1b285a;};'use strict';var multer=require(_0x1187('0x0'));var util=require(_0x1187('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1187('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1187('0x3'));var interaction=require(_0x1187('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x1187('0x5')]('/',auth[_0x1187('0x6')](),controller[_0x1187('0x7')]);router[_0x1187('0x5')](_0x1187('0x8'),auth[_0x1187('0x6')](),controller[_0x1187('0x9')]);router['get']('/index',auth['isAuthenticated'](),controller[_0x1187('0xa')]);router[_0x1187('0x5')](_0x1187('0xb'),auth[_0x1187('0x6')](),controller[_0x1187('0xc')]);router['post']('/',auth[_0x1187('0x6')](),controller[_0x1187('0xd')]);router[_0x1187('0xe')]('/:id',auth[_0x1187('0x6')](),controller['update']);router[_0x1187('0xf')](_0x1187('0xb'),auth[_0x1187('0x6')](),controller[_0x1187('0x10')]);module[_0x1187('0x11')]=router; \ No newline at end of file +var _0x4796=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','describe','/index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x520ce8,_0x445e56){var _0x64369e=function(_0x3861e4){while(--_0x3861e4){_0x520ce8['push'](_0x520ce8['shift']());}};_0x64369e(++_0x445e56);}(_0x4796,0x19f));var _0x6479=function(_0x522db0,_0x4128a6){_0x522db0=_0x522db0-0x0;var _0x100a5e=_0x4796[_0x522db0];return _0x100a5e;};'use strict';var multer=require(_0x6479('0x0'));var util=require(_0x6479('0x1'));var path=require('path');var timeout=require(_0x6479('0x2'));var express=require(_0x6479('0x3'));var router=express[_0x6479('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6479('0x5'));var interaction=require(_0x6479('0x6'));var config=require(_0x6479('0x7'));var controller=require(_0x6479('0x8'));router['get']('/',auth[_0x6479('0x9')](),controller[_0x6479('0xa')]);router[_0x6479('0xb')]('/describe',auth[_0x6479('0x9')](),controller[_0x6479('0xc')]);router['get'](_0x6479('0xd'),auth[_0x6479('0x9')](),controller['getVoiceQueuesReport']);router[_0x6479('0xb')](_0x6479('0xe'),auth['isAuthenticated'](),controller[_0x6479('0xf')]);router[_0x6479('0x10')]('/',auth[_0x6479('0x9')](),controller[_0x6479('0x11')]);router[_0x6479('0x12')](_0x6479('0xe'),auth[_0x6479('0x9')](),controller['update']);router[_0x6479('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6479('0x14')]);module[_0x6479('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 0233897..c9bd8b3 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 _0x8f25=['sequelize','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2410cc,_0xcf7386){var _0x515dfa=function(_0x233a22){while(--_0x233a22){_0x2410cc['push'](_0x2410cc['shift']());}};_0x515dfa(++_0xcf7386);}(_0x8f25,0xee));var _0x58f2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f25[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x58f2('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x58f2('0x1')]},'uniqueid':{'type':Sequelize[_0x58f2('0x1')]},'calleridnum':{'type':Sequelize[_0x58f2('0x1')]},'calleridname':{'type':Sequelize[_0x58f2('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x58f2('0x2')],'set':function(_0x27adc0){var _0x576ba2=moment(_0x27adc0);var _0x2bb7ad=moment(this['getDataValue'](_0x58f2('0x3')))[_0x58f2('0x4')](_0x58f2('0x5'));var _0x3e2234=_0x576ba2[_0x58f2('0x6')](_0x2bb7ad,_0x58f2('0x7'));this[_0x58f2('0x8')](_0x58f2('0x9'),_0x27adc0);this[_0x58f2('0x8')]('holdtime',_0x3e2234||null);}},'position':{'type':Sequelize[_0x58f2('0xa')]},'count':{'type':Sequelize[_0x58f2('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x58f2('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x58f2('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x58f2('0x1')],'comment':_0x58f2('0xc')},'originalposition':{'type':Sequelize[_0x58f2('0xa')]},'channel':{'type':Sequelize[_0x58f2('0x1')]},'connectedlinenum':{'type':Sequelize[_0x58f2('0x1')]},'connectedlinename':{'type':Sequelize[_0x58f2('0x1')]},'accountcode':{'type':Sequelize[_0x58f2('0x1')]},'context':{'type':Sequelize[_0x58f2('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x58f2('0x1')]},'holdtime':{'type':Sequelize[_0x58f2('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x58f2('0x1')]},'transfer':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x58f2('0x1')],'comment':_0x58f2('0xd')},'transferexten':{'type':Sequelize[_0x58f2('0x1')]},'transferuniqueid':{'type':Sequelize[_0x58f2('0x1')]},'disposition':{'type':Sequelize[_0x58f2('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x58f2('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x58f2('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x58f2('0x1')]}}; \ No newline at end of file +var _0x415d=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports'];(function(_0xf07a9c,_0x3014d1){var _0x1930a7=function(_0x200aee){while(--_0x200aee){_0xf07a9c['push'](_0xf07a9c['shift']());}};_0x1930a7(++_0x3014d1);}(_0x415d,0x157));var _0xd415=function(_0x3df8b1,_0x376cb7){_0x3df8b1=_0x3df8b1-0x0;var _0x1527cf=_0x415d[_0x3df8b1];return _0x1527cf;};'use strict';var Sequelize=require(_0xd415('0x0'));var moment=require('moment');module[_0xd415('0x1')]={'type':{'type':Sequelize[_0xd415('0x2')]},'uniqueid':{'type':Sequelize[_0xd415('0x2')]},'calleridnum':{'type':Sequelize[_0xd415('0x2')]},'calleridname':{'type':Sequelize[_0xd415('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xd415('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xd415('0x3')],'set':function(_0x952db3){var _0x471760=moment(_0x952db3);var _0x1856df=moment(this[_0xd415('0x4')](_0xd415('0x5')))[_0xd415('0x6')](_0xd415('0x7'));var _0x4780ae=_0x471760[_0xd415('0x8')](_0x1856df,_0xd415('0x9'));this[_0xd415('0xa')](_0xd415('0xb'),_0x952db3);this['setDataValue']('holdtime',_0x4780ae||null);}},'position':{'type':Sequelize[_0xd415('0xc')]},'count':{'type':Sequelize[_0xd415('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xd415('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xd415('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd415('0x3')]},'queuecallerexit':{'type':Sequelize[_0xd415('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xd415('0xe')},'originalposition':{'type':Sequelize[_0xd415('0xc')]},'channel':{'type':Sequelize[_0xd415('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd415('0x2')]},'connectedlinename':{'type':Sequelize[_0xd415('0x2')]},'accountcode':{'type':Sequelize[_0xd415('0x2')]},'context':{'type':Sequelize[_0xd415('0x2')]},'exten':{'type':Sequelize[_0xd415('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xd415('0xc')]},'mohtime':{'type':Sequelize[_0xd415('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd415('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd415('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd415('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd415('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd415('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xd415('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8700010..e1cc722 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 _0xfc1e=['includeAll','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','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','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','end','error','stack','name','index','VoiceQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','catch','find','create','body','params','describe','getVoiceQueuesReport','map'];(function(_0x188741,_0x243906){var _0x5e9290=function(_0x90f20a){while(--_0x90f20a){_0x188741['push'](_0x188741['shift']());}};_0x5e9290(++_0x243906);}(_0xfc1e,0xf3));var _0xefc1=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0xfc1e[_0xe5b349];return _0x26b0ad;};'use strict';var emlformat=require(_0xefc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefc1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefc1('0x2'));var moment=require(_0xefc1('0x3'));var BPromise=require(_0xefc1('0x4'));var Mustache=require(_0xefc1('0x5'));var util=require(_0xefc1('0x6'));var path=require(_0xefc1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefc1('0x8'));var fs=require('fs');var fs_extra=require(_0xefc1('0x9'));var _=require(_0xefc1('0xa'));var squel=require('squel');var crypto=require(_0xefc1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xefc1('0xc'));var toCsv=require(_0xefc1('0xd'));var querystring=require(_0xefc1('0xe'));var Papa=require('papaparse');var Redis=require(_0xefc1('0xf'));var authService=require(_0xefc1('0x10'));var qs=require(_0xefc1('0x11'));var as=require(_0xefc1('0x12'));var hardwareService=require(_0xefc1('0x13'));var logger=require(_0xefc1('0x14'))('api');var utils=require(_0xefc1('0x15'));var config=require(_0xefc1('0x16'));var licenseUtil=require(_0xefc1('0x17'));var db=require(_0xefc1('0x18'))['db'];config[_0xefc1('0x19')]=_[_0xefc1('0x1a')](config['redis'],{'host':_0xefc1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xefc1('0x19')]));require(_0xefc1('0x1c'))[_0xefc1('0x1d')](socket);function respondWithStatusCode(_0x36a6f4,_0x50ad2e){_0x50ad2e=_0x50ad2e||0xcc;return function(_0x4a7aa4){if(_0x4a7aa4){return _0x36a6f4[_0xefc1('0x1e')](_0x50ad2e);}return _0x36a6f4[_0xefc1('0x1f')](_0x50ad2e)['end']();};}function respondWithResult(_0x3801e6,_0xfb7f69){_0xfb7f69=_0xfb7f69||0xc8;return function(_0x245bc0){if(_0x245bc0){return _0x3801e6['status'](_0xfb7f69)['json'](_0x245bc0);}};}function respondWithFilteredResult(_0x142a41,_0x56e8d3){return function(_0x459864){if(_0x459864){var _0x16f269=typeof _0x56e8d3[_0xefc1('0x20')]===_0xefc1('0x21')&&typeof _0x56e8d3[_0xefc1('0x22')]==='undefined';var _0x5be5d9=_0x459864[_0xefc1('0x23')];var _0x37d165=_0x16f269?0x0:_0x56e8d3['offset'];var _0x2da854=_0x16f269?_0x459864[_0xefc1('0x23')]:_0x56e8d3[_0xefc1('0x20')]+_0x56e8d3[_0xefc1('0x22')];var _0x7b2d37;if(_0x2da854>=_0x5be5d9){_0x2da854=_0x5be5d9;_0x7b2d37=0xc8;}else{_0x7b2d37=0xce;}_0x142a41[_0xefc1('0x1f')](_0x7b2d37);return _0x142a41['set'](_0xefc1('0x24'),_0x37d165+'-'+_0x2da854+'/'+_0x5be5d9)[_0xefc1('0x25')](_0x459864);}return null;};}function patchUpdates(_0x33a1ff){return function(_0x59f290){try{jsonpatch[_0xefc1('0x26')](_0x59f290,_0x33a1ff,!![]);}catch(_0x5c3864){return BPromise['reject'](_0x5c3864);}return _0x59f290['save']();};}function saveUpdates(_0x18563a,_0x46d230){return function(_0x58d89c){if(_0x58d89c){return _0x58d89c[_0xefc1('0x27')](_0x18563a)[_0xefc1('0x28')](function(_0x56ef4a){return _0x56ef4a;});}return null;};}function removeEntity(_0xd33188,_0x50fa9c){return function(_0x4b117a){if(_0x4b117a){return _0x4b117a[_0xefc1('0x29')]()[_0xefc1('0x28')](function(){_0xd33188['status'](0xcc)[_0xefc1('0x2a')]();});}};}function handleEntityNotFound(_0x29e890,_0x266791){return function(_0x2031ed){if(!_0x2031ed){_0x29e890[_0xefc1('0x1e')](0x194);}return _0x2031ed;};}function handleError(_0x440dd9,_0x3460ca){_0x3460ca=_0x3460ca||0x1f4;return function(_0x16732f){logger[_0xefc1('0x2b')](_0x16732f[_0xefc1('0x2c')]);if(_0x16732f[_0xefc1('0x2d')]){delete _0x16732f[_0xefc1('0x2d')];}_0x440dd9['status'](_0x3460ca)['send'](_0x16732f);};}exports[_0xefc1('0x2e')]=function(_0x1d7bca,_0x246b40){var _0xe058bd={},_0x5f00aa={},_0x243788={'count':0x0,'rows':[]};var _0x4196d5=_['map'](db[_0xefc1('0x2f')][_0xefc1('0x30')],function(_0x376ff0){return{'name':_0x376ff0['fieldName'],'type':_0x376ff0[_0xefc1('0x31')][_0xefc1('0x32')]};});_0x5f00aa[_0xefc1('0x33')]=_['map'](_0x4196d5,_0xefc1('0x2d'));_0x5f00aa[_0xefc1('0x34')]=_[_0xefc1('0x35')](_0x1d7bca['query']);_0x5f00aa[_0xefc1('0x36')]=_[_0xefc1('0x37')](_0x5f00aa[_0xefc1('0x33')],_0x5f00aa[_0xefc1('0x34')]);_0xe058bd['attributes']=_['intersection'](_0x5f00aa['model'],qs['fields'](_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x38')]));_0xe058bd[_0xefc1('0x39')]=_0xe058bd['attributes'][_0xefc1('0x3a')]?_0xe058bd[_0xefc1('0x39')]:_0x5f00aa['model'];if(!_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x3b')](_0xefc1('0x3c'))){_0xe058bd[_0xefc1('0x22')]=qs['limit'](_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x22')]);_0xe058bd[_0xefc1('0x20')]=qs[_0xefc1('0x20')](_0x1d7bca[_0xefc1('0x34')]['offset']);}_0xe058bd[_0xefc1('0x3d')]=qs[_0xefc1('0x3e')](_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x3e')]);_0xe058bd[_0xefc1('0x3f')]=qs[_0xefc1('0x36')](_[_0xefc1('0x40')](_0x1d7bca['query'],_0x5f00aa[_0xefc1('0x36')]),_0x4196d5);if(_0x1d7bca['query'][_0xefc1('0x41')]){_0xe058bd[_0xefc1('0x3f')]=_[_0xefc1('0x42')](_0xe058bd[_0xefc1('0x3f')],{'$or':_['map'](_0x4196d5,function(_0x503bd3){if(_0x503bd3['type']!=='VIRTUAL'){var _0x100196={};_0x100196[_0x503bd3['name']]={'$like':'%'+_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x41')]+'%'};return _0x100196;}})});}_0xe058bd=_[_0xefc1('0x42')]({},_0xe058bd,_0x1d7bca[_0xefc1('0x43')]);var _0x43b3ae={'where':_0xe058bd['where']};return db['VoiceQueueReport'][_0xefc1('0x23')](_0x43b3ae)[_0xefc1('0x28')](function(_0x4db6b5){_0x243788[_0xefc1('0x23')]=_0x4db6b5;if(_0x1d7bca['query']['includeAll']){_0xe058bd[_0xefc1('0x44')]=[{'all':!![]}];}return db[_0xefc1('0x2f')]['findAll'](_0xe058bd);})[_0xefc1('0x28')](function(_0x2632a2){_0x243788['rows']=_0x2632a2;return _0x243788;})[_0xefc1('0x28')](respondWithFilteredResult(_0x246b40,_0xe058bd))[_0xefc1('0x45')](handleError(_0x246b40,null));};exports['show']=function(_0x7428a9,_0x214a96){var _0x2f5ea4={'raw':![],'where':{'id':_0x7428a9['params']['id']}},_0xf93da0={};_0xf93da0[_0xefc1('0x33')]=_[_0xefc1('0x35')](db[_0xefc1('0x2f')]['rawAttributes']);_0xf93da0[_0xefc1('0x34')]=_[_0xefc1('0x35')](_0x7428a9[_0xefc1('0x34')]);_0xf93da0[_0xefc1('0x36')]=_['intersection'](_0xf93da0['model'],_0xf93da0[_0xefc1('0x34')]);_0x2f5ea4[_0xefc1('0x39')]=_[_0xefc1('0x37')](_0xf93da0['model'],qs[_0xefc1('0x38')](_0x7428a9[_0xefc1('0x34')][_0xefc1('0x38')]));_0x2f5ea4['attributes']=_0x2f5ea4['attributes'][_0xefc1('0x3a')]?_0x2f5ea4[_0xefc1('0x39')]:_0xf93da0[_0xefc1('0x33')];if(_0x7428a9['query']['includeAll']){_0x2f5ea4[_0xefc1('0x44')]=[{'all':!![]}];}_0x2f5ea4=_['merge']({},_0x2f5ea4,_0x7428a9[_0xefc1('0x43')]);return db[_0xefc1('0x2f')][_0xefc1('0x46')](_0x2f5ea4)[_0xefc1('0x28')](handleEntityNotFound(_0x214a96,null))[_0xefc1('0x28')](respondWithResult(_0x214a96,null))[_0xefc1('0x45')](handleError(_0x214a96,null));};exports['create']=function(_0x545ee8,_0x2ca3b5){return db[_0xefc1('0x2f')][_0xefc1('0x47')](_0x545ee8[_0xefc1('0x48')],{})[_0xefc1('0x28')](respondWithResult(_0x2ca3b5,0xc9))[_0xefc1('0x45')](handleError(_0x2ca3b5,null));};exports['update']=function(_0x28dcd8,_0x14887f){if(_0x28dcd8[_0xefc1('0x48')]['id']){delete _0x28dcd8['body']['id'];}return db[_0xefc1('0x2f')][_0xefc1('0x46')]({'where':{'id':_0x28dcd8['params']['id']}})['then'](handleEntityNotFound(_0x14887f,null))['then'](saveUpdates(_0x28dcd8[_0xefc1('0x48')],null))[_0xefc1('0x28')](respondWithResult(_0x14887f,null))['catch'](handleError(_0x14887f,null));};exports[_0xefc1('0x29')]=function(_0x4f9c36,_0x41854d){return db[_0xefc1('0x2f')][_0xefc1('0x46')]({'where':{'id':_0x4f9c36[_0xefc1('0x49')]['id']}})[_0xefc1('0x28')](handleEntityNotFound(_0x41854d,null))[_0xefc1('0x28')](removeEntity(_0x41854d,null))[_0xefc1('0x45')](handleError(_0x41854d,null));};exports[_0xefc1('0x4a')]=function(_0x502ff3,_0x38f480){return db[_0xefc1('0x2f')][_0xefc1('0x4a')]()['then'](respondWithResult(_0x38f480,null))[_0xefc1('0x45')](handleError(_0x38f480,null));};exports[_0xefc1('0x4b')]=function(_0x5d8204,_0x4ee19a){var _0x3004eb={},_0x3cf0c1={},_0x14aa05={'count':0x0,'rows':[]};_0x3cf0c1[_0xefc1('0x33')]=_[_0xefc1('0x35')](db[_0xefc1('0x2f')][_0xefc1('0x30')]);_0x3cf0c1[_0xefc1('0x34')]=_[_0xefc1('0x35')](_0x5d8204[_0xefc1('0x34')]);_0x3cf0c1[_0xefc1('0x36')]=_[_0xefc1('0x37')](_0x3cf0c1['model'],_0x3cf0c1['query']);_0x3004eb[_0xefc1('0x39')]=_[_0xefc1('0x37')](_0x3cf0c1[_0xefc1('0x33')],qs[_0xefc1('0x38')](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x38')]));_0x3004eb[_0xefc1('0x39')]=_0x3004eb[_0xefc1('0x39')][_0xefc1('0x3a')]?_0x3004eb[_0xefc1('0x39')]:_0x3cf0c1['model'];if(!_0x5d8204['query'][_0xefc1('0x3b')](_0xefc1('0x3c'))){_0x3004eb['limit']=qs[_0xefc1('0x22')](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x22')]);_0x3004eb[_0xefc1('0x20')]=qs[_0xefc1('0x20')](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x20')]);}_0x3004eb[_0xefc1('0x3d')]=qs['sort'](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x3e')]);_0x3004eb['where']=qs['filters'](_[_0xefc1('0x40')](_0x5d8204[_0xefc1('0x34')],_0x3cf0c1['filters']));if(_0x5d8204['query'][_0xefc1('0x41')]){_0x3004eb[_0xefc1('0x3f')]=_[_0xefc1('0x42')](_0x3004eb[_0xefc1('0x3f')],{'$or':_[_0xefc1('0x4c')](_0x3004eb[_0xefc1('0x39')],function(_0x851d47){var _0x294269={};_0x294269[_0x851d47]={'$like':'%'+_0x5d8204[_0xefc1('0x34')][_0xefc1('0x41')]+'%'};return _0x294269;})});}_0x3004eb=_['merge']({},_0x3004eb,_0x5d8204[_0xefc1('0x43')]);var _0x392729={'where':_0x3004eb['where']};return db[_0xefc1('0x2f')][_0xefc1('0x23')](_0x392729)[_0xefc1('0x28')](function(_0x39f0db){_0x14aa05[_0xefc1('0x23')]=_0x39f0db;if(_0x5d8204[_0xefc1('0x34')][_0xefc1('0x4d')]){_0x3004eb['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xefc1('0x4e')](_0x3004eb);})['then'](function(_0x30bc39){_0x14aa05[_0xefc1('0x4f')]=_0x30bc39;return _0x14aa05;})[_0xefc1('0x28')](respondWithFilteredResult(_0x4ee19a,_0x3004eb,_0xefc1('0x4b')))['catch'](handleError(_0x4ee19a,null,_0xefc1('0x4b')));}; \ No newline at end of file +var _0xd03c=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x296af2,_0x32dbee){var _0x5b6ab6=function(_0x3bf7fe){while(--_0x3bf7fe){_0x296af2['push'](_0x296af2['shift']());}};_0x5b6ab6(++_0x32dbee);}(_0xd03c,0x1e5));var _0xcd03=function(_0x156e98,_0x17d973){_0x156e98=_0x156e98-0x0;var _0x1ed277=_0xd03c[_0x156e98];return _0x1ed277;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd03('0x0'));var zipdir=require(_0xcd03('0x1'));var jsonpatch=require(_0xcd03('0x2'));var rp=require(_0xcd03('0x3'));var moment=require(_0xcd03('0x4'));var BPromise=require(_0xcd03('0x5'));var Mustache=require(_0xcd03('0x6'));var util=require(_0xcd03('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd03('0x8'));var fs=require('fs');var fs_extra=require(_0xcd03('0x9'));var _=require(_0xcd03('0xa'));var squel=require(_0xcd03('0xb'));var crypto=require(_0xcd03('0xc'));var jsforce=require(_0xcd03('0xd'));var deskjs=require(_0xcd03('0xe'));var toCsv=require(_0xcd03('0xf'));var querystring=require(_0xcd03('0x10'));var Papa=require(_0xcd03('0x11'));var Redis=require(_0xcd03('0x12'));var authService=require(_0xcd03('0x13'));var qs=require(_0xcd03('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd03('0x15'));var logger=require('../../config/logger')(_0xcd03('0x16'));var utils=require(_0xcd03('0x17'));var config=require(_0xcd03('0x18'));var licenseUtil=require(_0xcd03('0x19'));var db=require(_0xcd03('0x1a'))['db'];config[_0xcd03('0x1b')]=_[_0xcd03('0x1c')](config['redis'],{'host':_0xcd03('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd03('0x1b')]));require('./voiceQueueReport.socket')[_0xcd03('0x1e')](socket);function respondWithStatusCode(_0x31d4e1,_0x51e451){_0x51e451=_0x51e451||0xcc;return function(_0x5404d9){if(_0x5404d9){return _0x31d4e1[_0xcd03('0x1f')](_0x51e451);}return _0x31d4e1['status'](_0x51e451)['end']();};}function respondWithResult(_0x95b800,_0x5a845a){_0x5a845a=_0x5a845a||0xc8;return function(_0x3d6b59){if(_0x3d6b59){return _0x95b800['status'](_0x5a845a)[_0xcd03('0x20')](_0x3d6b59);}};}function respondWithFilteredResult(_0x6f5f77,_0x4fb345){return function(_0x272ea1){if(_0x272ea1){var _0x39157f=typeof _0x4fb345[_0xcd03('0x21')]===_0xcd03('0x22')&&typeof _0x4fb345[_0xcd03('0x23')]===_0xcd03('0x22');var _0xe22d85=_0x272ea1[_0xcd03('0x24')];var _0x2db7d5=_0x39157f?0x0:_0x4fb345[_0xcd03('0x21')];var _0x2d5cd8=_0x39157f?_0x272ea1[_0xcd03('0x24')]:_0x4fb345['offset']+_0x4fb345[_0xcd03('0x23')];var _0x4e459e;if(_0x2d5cd8>=_0xe22d85){_0x2d5cd8=_0xe22d85;_0x4e459e=0xc8;}else{_0x4e459e=0xce;}_0x6f5f77[_0xcd03('0x25')](_0x4e459e);return _0x6f5f77[_0xcd03('0x26')](_0xcd03('0x27'),_0x2db7d5+'-'+_0x2d5cd8+'/'+_0xe22d85)[_0xcd03('0x20')](_0x272ea1);}return null;};}function patchUpdates(_0xb5978f){return function(_0x314947){try{jsonpatch['apply'](_0x314947,_0xb5978f,!![]);}catch(_0x33c8f3){return BPromise[_0xcd03('0x28')](_0x33c8f3);}return _0x314947[_0xcd03('0x29')]();};}function saveUpdates(_0x2f2393,_0x495293){return function(_0x4c318f){if(_0x4c318f){return _0x4c318f[_0xcd03('0x2a')](_0x2f2393)[_0xcd03('0x2b')](function(_0x448fe2){return _0x448fe2;});}return null;};}function removeEntity(_0xf39298,_0x2b5f79){return function(_0xba1b18){if(_0xba1b18){return _0xba1b18['destroy']()[_0xcd03('0x2b')](function(){_0xf39298['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56e64a,_0x49723b){return function(_0x4afbc7){if(!_0x4afbc7){_0x56e64a[_0xcd03('0x1f')](0x194);}return _0x4afbc7;};}function handleError(_0x5cc24d,_0x2cf2ec){_0x2cf2ec=_0x2cf2ec||0x1f4;return function(_0x101559){logger[_0xcd03('0x2c')](_0x101559['stack']);if(_0x101559[_0xcd03('0x2d')]){delete _0x101559['name'];}_0x5cc24d[_0xcd03('0x25')](_0x2cf2ec)[_0xcd03('0x2e')](_0x101559);};}exports['index']=function(_0x13d8d3,_0x14cb31){var _0x3c1079={},_0x2a5cf9={},_0x3ff01c={'count':0x0,'rows':[]};var _0x34f132=_[_0xcd03('0x2f')](db[_0xcd03('0x30')][_0xcd03('0x31')],function(_0x502d42){return{'name':_0x502d42[_0xcd03('0x32')],'type':_0x502d42['type'][_0xcd03('0x33')]};});_0x2a5cf9['model']=_[_0xcd03('0x2f')](_0x34f132,_0xcd03('0x2d'));_0x2a5cf9['query']=_[_0xcd03('0x34')](_0x13d8d3[_0xcd03('0x35')]);_0x2a5cf9['filters']=_[_0xcd03('0x36')](_0x2a5cf9[_0xcd03('0x37')],_0x2a5cf9[_0xcd03('0x35')]);_0x3c1079[_0xcd03('0x38')]=_[_0xcd03('0x36')](_0x2a5cf9[_0xcd03('0x37')],qs[_0xcd03('0x39')](_0x13d8d3[_0xcd03('0x35')][_0xcd03('0x39')]));_0x3c1079[_0xcd03('0x38')]=_0x3c1079['attributes']['length']?_0x3c1079['attributes']:_0x2a5cf9[_0xcd03('0x37')];if(!_0x13d8d3[_0xcd03('0x35')][_0xcd03('0x3a')](_0xcd03('0x3b'))){_0x3c1079[_0xcd03('0x23')]=qs[_0xcd03('0x23')](_0x13d8d3[_0xcd03('0x35')][_0xcd03('0x23')]);_0x3c1079[_0xcd03('0x21')]=qs[_0xcd03('0x21')](_0x13d8d3[_0xcd03('0x35')][_0xcd03('0x21')]);}_0x3c1079[_0xcd03('0x3c')]=qs[_0xcd03('0x3d')](_0x13d8d3[_0xcd03('0x35')][_0xcd03('0x3d')]);_0x3c1079[_0xcd03('0x3e')]=qs[_0xcd03('0x3f')](_[_0xcd03('0x40')](_0x13d8d3[_0xcd03('0x35')],_0x2a5cf9[_0xcd03('0x3f')]),_0x34f132);if(_0x13d8d3[_0xcd03('0x35')]['filter']){_0x3c1079[_0xcd03('0x3e')]=_['merge'](_0x3c1079['where'],{'$or':_['map'](_0x34f132,function(_0x479fe7){if(_0x479fe7[_0xcd03('0x41')]!==_0xcd03('0x42')){var _0x4bd55e={};_0x4bd55e[_0x479fe7['name']]={'$like':'%'+_0x13d8d3[_0xcd03('0x35')][_0xcd03('0x43')]+'%'};return _0x4bd55e;}})});}_0x3c1079=_[_0xcd03('0x44')]({},_0x3c1079,_0x13d8d3[_0xcd03('0x45')]);var _0x1bc716={'where':_0x3c1079[_0xcd03('0x3e')]};return db[_0xcd03('0x30')][_0xcd03('0x24')](_0x1bc716)[_0xcd03('0x2b')](function(_0x1fc943){_0x3ff01c['count']=_0x1fc943;if(_0x13d8d3['query'][_0xcd03('0x46')]){_0x3c1079[_0xcd03('0x47')]=[{'all':!![]}];}return db[_0xcd03('0x30')][_0xcd03('0x48')](_0x3c1079);})[_0xcd03('0x2b')](function(_0x2cdaeb){_0x3ff01c[_0xcd03('0x49')]=_0x2cdaeb;return _0x3ff01c;})[_0xcd03('0x2b')](respondWithFilteredResult(_0x14cb31,_0x3c1079))[_0xcd03('0x4a')](handleError(_0x14cb31,null));};exports[_0xcd03('0x4b')]=function(_0x5e164f,_0x3a8c91){var _0x15809a={'raw':![],'where':{'id':_0x5e164f[_0xcd03('0x4c')]['id']}},_0x2451d1={};_0x2451d1[_0xcd03('0x37')]=_[_0xcd03('0x34')](db[_0xcd03('0x30')][_0xcd03('0x31')]);_0x2451d1[_0xcd03('0x35')]=_[_0xcd03('0x34')](_0x5e164f['query']);_0x2451d1['filters']=_[_0xcd03('0x36')](_0x2451d1[_0xcd03('0x37')],_0x2451d1[_0xcd03('0x35')]);_0x15809a[_0xcd03('0x38')]=_[_0xcd03('0x36')](_0x2451d1[_0xcd03('0x37')],qs[_0xcd03('0x39')](_0x5e164f[_0xcd03('0x35')][_0xcd03('0x39')]));_0x15809a[_0xcd03('0x38')]=_0x15809a['attributes'][_0xcd03('0x4d')]?_0x15809a[_0xcd03('0x38')]:_0x2451d1[_0xcd03('0x37')];if(_0x5e164f[_0xcd03('0x35')][_0xcd03('0x46')]){_0x15809a[_0xcd03('0x47')]=[{'all':!![]}];}_0x15809a=_['merge']({},_0x15809a,_0x5e164f[_0xcd03('0x45')]);return db['VoiceQueueReport'][_0xcd03('0x4e')](_0x15809a)[_0xcd03('0x2b')](handleEntityNotFound(_0x3a8c91,null))['then'](respondWithResult(_0x3a8c91,null))[_0xcd03('0x4a')](handleError(_0x3a8c91,null));};exports[_0xcd03('0x4f')]=function(_0x3e777f,_0x24b541){return db[_0xcd03('0x30')][_0xcd03('0x4f')](_0x3e777f[_0xcd03('0x50')],{})[_0xcd03('0x2b')](respondWithResult(_0x24b541,0xc9))[_0xcd03('0x4a')](handleError(_0x24b541,null));};exports[_0xcd03('0x2a')]=function(_0x5712d8,_0x5e9698){if(_0x5712d8[_0xcd03('0x50')]['id']){delete _0x5712d8[_0xcd03('0x50')]['id'];}return db[_0xcd03('0x30')][_0xcd03('0x4e')]({'where':{'id':_0x5712d8[_0xcd03('0x4c')]['id']}})[_0xcd03('0x2b')](handleEntityNotFound(_0x5e9698,null))['then'](saveUpdates(_0x5712d8[_0xcd03('0x50')],null))['then'](respondWithResult(_0x5e9698,null))[_0xcd03('0x4a')](handleError(_0x5e9698,null));};exports[_0xcd03('0x51')]=function(_0xf66d88,_0x3d1bdf){return db[_0xcd03('0x30')][_0xcd03('0x4e')]({'where':{'id':_0xf66d88[_0xcd03('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d1bdf,null))[_0xcd03('0x2b')](removeEntity(_0x3d1bdf,null))[_0xcd03('0x4a')](handleError(_0x3d1bdf,null));};exports['describe']=function(_0x4a747e,_0x54c5b0){return db[_0xcd03('0x30')][_0xcd03('0x52')]()[_0xcd03('0x2b')](respondWithResult(_0x54c5b0,null))[_0xcd03('0x4a')](handleError(_0x54c5b0,null));};exports[_0xcd03('0x53')]=function(_0x5dbc4b,_0x10fc78){var _0x62e7f2={},_0x333513={},_0x2c88ed={'count':0x0,'rows':[]};_0x333513[_0xcd03('0x37')]=_['keys'](db['VoiceQueueReport'][_0xcd03('0x31')]);_0x333513[_0xcd03('0x35')]=_['keys'](_0x5dbc4b[_0xcd03('0x35')]);_0x333513[_0xcd03('0x3f')]=_[_0xcd03('0x36')](_0x333513['model'],_0x333513['query']);_0x62e7f2['attributes']=_[_0xcd03('0x36')](_0x333513['model'],qs[_0xcd03('0x39')](_0x5dbc4b['query'][_0xcd03('0x39')]));_0x62e7f2[_0xcd03('0x38')]=_0x62e7f2[_0xcd03('0x38')][_0xcd03('0x4d')]?_0x62e7f2['attributes']:_0x333513[_0xcd03('0x37')];if(!_0x5dbc4b[_0xcd03('0x35')][_0xcd03('0x3a')]('nolimit')){_0x62e7f2[_0xcd03('0x23')]=qs[_0xcd03('0x23')](_0x5dbc4b[_0xcd03('0x35')][_0xcd03('0x23')]);_0x62e7f2['offset']=qs[_0xcd03('0x21')](_0x5dbc4b[_0xcd03('0x35')]['offset']);}_0x62e7f2[_0xcd03('0x3c')]=qs[_0xcd03('0x3d')](_0x5dbc4b[_0xcd03('0x35')][_0xcd03('0x3d')]);_0x62e7f2['where']=qs[_0xcd03('0x3f')](_['pick'](_0x5dbc4b[_0xcd03('0x35')],_0x333513[_0xcd03('0x3f')]));if(_0x5dbc4b[_0xcd03('0x35')][_0xcd03('0x43')]){_0x62e7f2[_0xcd03('0x3e')]=_[_0xcd03('0x44')](_0x62e7f2[_0xcd03('0x3e')],{'$or':_[_0xcd03('0x2f')](_0x62e7f2[_0xcd03('0x38')],function(_0x2af9f8){var _0x3699d8={};_0x3699d8[_0x2af9f8]={'$like':'%'+_0x5dbc4b[_0xcd03('0x35')][_0xcd03('0x43')]+'%'};return _0x3699d8;})});}_0x62e7f2=_[_0xcd03('0x44')]({},_0x62e7f2,_0x5dbc4b[_0xcd03('0x45')]);var _0x19f4ee={'where':_0x62e7f2['where']};return db[_0xcd03('0x30')][_0xcd03('0x24')](_0x19f4ee)['then'](function(_0x17f5ae){_0x2c88ed[_0xcd03('0x24')]=_0x17f5ae;if(_0x5dbc4b['query'][_0xcd03('0x46')]){_0x62e7f2['include']=[{'all':!![]}];}return db[_0xcd03('0x30')][_0xcd03('0x48')](_0x62e7f2);})['then'](function(_0x397da2){_0x2c88ed['rows']=_0x397da2;return _0x2c88ed;})[_0xcd03('0x2b')](respondWithFilteredResult(_0x10fc78,_0x62e7f2,'getVoiceQueuesReport'))['catch'](handleError(_0x10fc78,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 4e62603..a9e539a 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 _0x9040=['events','../../mysqldb','VoiceQueueReport','update','emit','hasOwnProperty','hook','exports'];(function(_0x1f5f0a,_0x558472){var _0x4c47f6=function(_0x14a67a){while(--_0x14a67a){_0x1f5f0a['push'](_0x1f5f0a['shift']());}};_0x4c47f6(++_0x558472);}(_0x9040,0xd8));var _0x0904=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9040[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x0904('0x0'));var VoiceQueueReport=require(_0x0904('0x1'))['db'][_0x0904('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0904('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1ce2ba){return function(_0x55a758,_0x501b50,_0xa6f91f){VoiceQueueReportEvents[_0x0904('0x4')](_0x1ce2ba+':'+_0x55a758['id'],_0x55a758);VoiceQueueReportEvents['emit'](_0x1ce2ba,_0x55a758);_0xa6f91f(null);};}for(var e in events){if(events[_0x0904('0x5')](e)){var event=events[e];VoiceQueueReport[_0x0904('0x6')](e,emitEvent(event));}}module[_0x0904('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4026=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x4026,0x90));var _0x6402=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4026[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x6402('0x0'));var VoiceQueueReport=require(_0x6402('0x1'))['db'][_0x6402('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6402('0x3')](0x0);var events={'afterCreate':_0x6402('0x4'),'afterUpdate':_0x6402('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2d7c4e){return function(_0x50a9d4,_0x3d00de,_0x22933d){VoiceQueueReportEvents[_0x6402('0x6')](_0x2d7c4e+':'+_0x50a9d4['id'],_0x50a9d4);VoiceQueueReportEvents[_0x6402('0x6')](_0x2d7c4e,_0x50a9d4);_0x22933d(null);};}for(var e in events){if(events[_0x6402('0x7')](e)){var event=events[e];VoiceQueueReport[_0x6402('0x8')](e,emitEvent(event));}}module[_0x6402('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 97bf423..e6a760d 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 _0x858a=['report_queue','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','VoiceQueueReport'];(function(_0x162432,_0x457935){var _0x15df9f=function(_0x421383){while(--_0x421383){_0x162432['push'](_0x162432['shift']());}};_0x15df9f(++_0x457935);}(_0x858a,0x1a2));var _0xa858=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x858a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa858('0x0'));var util=require(_0xa858('0x1'));var logger=require(_0xa858('0x2'))(_0xa858('0x3'));var moment=require(_0xa858('0x4'));var BPromise=require(_0xa858('0x5'));var rp=require(_0xa858('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa858('0x7'));var config=require(_0xa858('0x8'));var attributes=require(_0xa858('0x9'));module['exports']=function(_0x4e07e9,_0x348ee9){return _0x4e07e9['define'](_0xa858('0xa'),attributes,{'tableName':_0xa858('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa858('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x98b3=['util','moment','bluebird','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum'];(function(_0x412515,_0x1d7614){var _0xe2e79f=function(_0x15f618){while(--_0x15f618){_0x412515['push'](_0x412515['shift']());}};_0xe2e79f(++_0x1d7614);}(_0x98b3,0x160));var _0x398b=function(_0x4721e9,_0x1b221f){_0x4721e9=_0x4721e9-0x0;var _0x2171e0=_0x98b3[_0x4721e9];return _0x2171e0;};'use strict';var _=require('lodash');var util=require(_0x398b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x398b('0x1'));var BPromise=require(_0x398b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x398b('0x3'));var rimraf=require(_0x398b('0x4'));var config=require(_0x398b('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0x398b('0x6')]=function(_0x35998a,_0x3ae108){return _0x35998a['define'](_0x398b('0x7'),attributes,{'tableName':_0x398b('0x8'),'paranoid':![],'indexes':[{'fields':[_0x398b('0x9')]},{'fields':[_0x398b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index f60fba4..fa2af5d 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 _0x1136=['socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis'];(function(_0x2510a4,_0x2427ec){var _0x21150a=function(_0x86b386){while(--_0x86b386){_0x2510a4['push'](_0x2510a4['shift']());}};_0x21150a(++_0x2427ec);}(_0x1136,0x1cb));var _0x6113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1136[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6113('0x0'));var util=require('util');var moment=require(_0x6113('0x1'));var BPromise=require(_0x6113('0x2'));var rs=require(_0x6113('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6113('0x4'))['db'];var utils=require(_0x6113('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6113('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6113('0x7')]['http']({'port':0x232a});config[_0x6113('0x8')]=_['defaults'](config[_0x6113('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6113('0x9'))(new Redis(config[_0x6113('0x8')]));require(_0x6113('0xa'))[_0x6113('0xb')](socket);function respondWithRpcPromise(_0x5d7bbc,_0x3cde11,_0xd7a510){return new BPromise(function(_0x96b9cd,_0x547946){return client[_0x6113('0xc')](_0x5d7bbc,_0xd7a510)[_0x6113('0xd')](function(_0x459a16){logger[_0x6113('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x3cde11,_0x6113('0xf'));logger[_0x6113('0x10')](_0x6113('0x11'),_0x3cde11,_0x6113('0xf'),JSON[_0x6113('0x12')](_0x459a16));if(_0x459a16[_0x6113('0x13')]){if(_0x459a16[_0x6113('0x13')][_0x6113('0x14')]===0x1f4){logger[_0x6113('0x13')](_0x6113('0x15'),_0x3cde11,_0x459a16[_0x6113('0x13')][_0x6113('0x16')]);return _0x547946(_0x459a16['error']['message']);}logger[_0x6113('0x13')](_0x6113('0x15'),_0x3cde11,_0x459a16[_0x6113('0x13')][_0x6113('0x16')]);return _0x96b9cd(_0x459a16[_0x6113('0x13')]['message']);}else{logger[_0x6113('0xe')](_0x6113('0x15'),_0x3cde11,_0x6113('0xf'));_0x96b9cd(_0x459a16['result'][_0x6113('0x16')]);}})[_0x6113('0x17')](function(_0x254c66){logger['error'](_0x6113('0x15'),_0x3cde11,_0x254c66);_0x547946(_0x254c66);});});}exports[_0x6113('0x18')]=function(_0x40afde){var _0x394b8c=this;return new Promise(function(_0x4476d2,_0x169045){return db[_0x6113('0x19')][_0x6113('0x1a')]({'raw':_0x40afde[_0x6113('0x1b')]?_0x40afde['options'][_0x6113('0x1c')]===undefined?!![]:![]:!![],'where':_0x40afde[_0x6113('0x1b')]?_0x40afde[_0x6113('0x1b')][_0x6113('0x1d')]||null:null,'attributes':_0x40afde[_0x6113('0x1b')]?_0x40afde[_0x6113('0x1b')][_0x6113('0x1e')]||null:null,'limit':_0x40afde[_0x6113('0x1b')]?_0x40afde[_0x6113('0x1b')]['limit']||null:null,'include':_0x40afde['options']?_0x40afde[_0x6113('0x1b')][_0x6113('0x1f')]?_[_0x6113('0x20')](_0x40afde[_0x6113('0x1b')][_0x6113('0x1f')],function(_0x5a574f){return{'model':db[_0x5a574f[_0x6113('0x21')]],'as':_0x5a574f['as'],'attributes':_0x5a574f[_0x6113('0x1e')],'include':_0x5a574f[_0x6113('0x1f')]?_['map'](_0x5a574f['include'],function(_0x36c772){return{'model':db[_0x36c772['model']],'as':_0x36c772['as'],'attributes':_0x36c772[_0x6113('0x1e')],'include':_0x36c772[_0x6113('0x1f')]?_[_0x6113('0x20')](_0x36c772[_0x6113('0x1f')],function(_0x38387c){return{'model':db[_0x38387c['model']],'as':_0x38387c['as'],'attributes':_0x38387c[_0x6113('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2152da){logger[_0x6113('0xe')](_0x6113('0x18'),_0x40afde);logger[_0x6113('0x10')]('GetVoiceQueueReport',_0x40afde,JSON[_0x6113('0x12')](_0x2152da));_0x4476d2(_0x2152da);})[_0x6113('0x17')](function(_0x120605){logger[_0x6113('0x13')](_0x6113('0x18'),_0x120605[_0x6113('0x16')],_0x40afde);_0x169045(_0x394b8c['error'](0x1f4,_0x120605[_0x6113('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x501b54){var _0x4ae2c9=this;return new Promise(function(_0xe8af99,_0x26d4e5){return db[_0x6113('0x19')]['create'](_0x501b54[_0x6113('0x22')],{'raw':_0x501b54[_0x6113('0x1b')]?_0x501b54[_0x6113('0x1b')][_0x6113('0x1c')]===undefined?!![]:![]:!![]})[_0x6113('0xd')](function(_0x1891fa){logger['info'](_0x6113('0x23'),_0x501b54);logger[_0x6113('0x10')](_0x6113('0x23'),_0x501b54,JSON[_0x6113('0x12')](_0x1891fa));_0xe8af99(_0x1891fa);})[_0x6113('0x17')](function(_0x20e6ae){logger[_0x6113('0x13')](_0x6113('0x23'),_0x20e6ae[_0x6113('0x16')],_0x501b54);_0x26d4e5(_0x4ae2c9[_0x6113('0x13')](0x1f4,_0x20e6ae[_0x6113('0x16')]));});});};exports[_0x6113('0x24')]=function(_0x327dff){var _0x5a8e37=this;return new Promise(function(_0x533b35,_0xe7e981){return db[_0x6113('0x19')][_0x6113('0x25')](_0x327dff[_0x6113('0x22')],{'raw':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x1d')]||null:null,'attributes':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x1e')]||null:null,'limit':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x26')]||null:null})['then'](function(_0x3407b4){logger[_0x6113('0xe')](_0x6113('0x24'),_0x327dff);logger[_0x6113('0x10')](_0x6113('0x24'),_0x327dff,JSON['stringify'](_0x3407b4));_0x533b35(_0x3407b4);})[_0x6113('0x17')](function(_0x5e361a){logger['error']('UpdateVoiceQueueReport',_0x5e361a[_0x6113('0x16')],_0x327dff);_0xe7e981(_0x5a8e37['error'](0x1f4,_0x5e361a[_0x6113('0x16')]));});});}; \ No newline at end of file +var _0x11c7=['error','message','VoiceQueueReport,\x20%s,\x20%s','info','result','catch','GetVoiceQueueReport','options','where','attributes','include','map','model','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./voiceQueueReport.socket','register','request','then','request\x20sent','debug','stringify'];(function(_0x505e09,_0xfbe6f9){var _0x1e857d=function(_0x29b0ad){while(--_0x29b0ad){_0x505e09['push'](_0x505e09['shift']());}};_0x1e857d(++_0xfbe6f9);}(_0x11c7,0x10b));var _0x711c=function(_0x1e20b1,_0x4b0110){_0x1e20b1=_0x1e20b1-0x0;var _0x4ee68c=_0x11c7[_0x1e20b1];return _0x4ee68c;};'use strict';var _=require('lodash');var util=require(_0x711c('0x0'));var moment=require(_0x711c('0x1'));var BPromise=require(_0x711c('0x2'));var rs=require(_0x711c('0x3'));var fs=require('fs');var Redis=require(_0x711c('0x4'));var db=require(_0x711c('0x5'))['db'];var utils=require(_0x711c('0x6'));var logger=require(_0x711c('0x7'))('rpc');var config=require(_0x711c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x711c('0x9')][_0x711c('0xa')]({'port':0x232a});config[_0x711c('0xb')]=_[_0x711c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x711c('0xd'))[_0x711c('0xe')](socket);function respondWithRpcPromise(_0x7e6dcf,_0x483771,_0x21e45b){return new BPromise(function(_0x39b29c,_0x2e294b){return client[_0x711c('0xf')](_0x7e6dcf,_0x21e45b)[_0x711c('0x10')](function(_0x29612c){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x483771,_0x711c('0x11'));logger[_0x711c('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x483771,'request\x20sent',JSON[_0x711c('0x13')](_0x29612c));if(_0x29612c[_0x711c('0x14')]){if(_0x29612c[_0x711c('0x14')]['code']===0x1f4){logger[_0x711c('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x483771,_0x29612c[_0x711c('0x14')][_0x711c('0x15')]);return _0x2e294b(_0x29612c[_0x711c('0x14')][_0x711c('0x15')]);}logger[_0x711c('0x14')](_0x711c('0x16'),_0x483771,_0x29612c[_0x711c('0x14')][_0x711c('0x15')]);return _0x39b29c(_0x29612c[_0x711c('0x14')][_0x711c('0x15')]);}else{logger[_0x711c('0x17')](_0x711c('0x16'),_0x483771,_0x711c('0x11'));_0x39b29c(_0x29612c[_0x711c('0x18')]['message']);}})[_0x711c('0x19')](function(_0x232963){logger[_0x711c('0x14')](_0x711c('0x16'),_0x483771,_0x232963);_0x2e294b(_0x232963);});});}exports[_0x711c('0x1a')]=function(_0x40dd6d){var _0x2741d6=this;return new Promise(function(_0x2bae28,_0x33d34b){return db['VoiceQueueReport']['findAll']({'raw':_0x40dd6d['options']?_0x40dd6d[_0x711c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x40dd6d[_0x711c('0x1b')]?_0x40dd6d['options'][_0x711c('0x1c')]||null:null,'attributes':_0x40dd6d[_0x711c('0x1b')]?_0x40dd6d[_0x711c('0x1b')][_0x711c('0x1d')]||null:null,'limit':_0x40dd6d[_0x711c('0x1b')]?_0x40dd6d[_0x711c('0x1b')]['limit']||null:null,'include':_0x40dd6d[_0x711c('0x1b')]?_0x40dd6d[_0x711c('0x1b')][_0x711c('0x1e')]?_[_0x711c('0x1f')](_0x40dd6d[_0x711c('0x1b')]['include'],function(_0x1623ba){return{'model':db[_0x1623ba['model']],'as':_0x1623ba['as'],'attributes':_0x1623ba[_0x711c('0x1d')],'include':_0x1623ba['include']?_[_0x711c('0x1f')](_0x1623ba['include'],function(_0x558ab8){return{'model':db[_0x558ab8[_0x711c('0x20')]],'as':_0x558ab8['as'],'attributes':_0x558ab8['attributes'],'include':_0x558ab8['include']?_[_0x711c('0x1f')](_0x558ab8['include'],function(_0x53d82f){return{'model':db[_0x53d82f[_0x711c('0x20')]],'as':_0x53d82f['as'],'attributes':_0x53d82f[_0x711c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x711c('0x10')](function(_0x4e9115){logger[_0x711c('0x17')](_0x711c('0x1a'),_0x40dd6d);logger[_0x711c('0x12')](_0x711c('0x1a'),_0x40dd6d,JSON[_0x711c('0x13')](_0x4e9115));_0x2bae28(_0x4e9115);})[_0x711c('0x19')](function(_0x591117){logger[_0x711c('0x14')](_0x711c('0x1a'),_0x591117['message'],_0x40dd6d);_0x33d34b(_0x2741d6[_0x711c('0x14')](0x1f4,_0x591117['message']));});});};exports[_0x711c('0x21')]=function(_0x337a20){var _0x270bf5=this;return new Promise(function(_0xfbb0c9,_0x283791){return db[_0x711c('0x22')][_0x711c('0x23')](_0x337a20[_0x711c('0x24')],{'raw':_0x337a20['options']?_0x337a20[_0x711c('0x1b')][_0x711c('0x25')]===undefined?!![]:![]:!![]})[_0x711c('0x10')](function(_0x4a0ec6){logger[_0x711c('0x17')](_0x711c('0x21'),_0x337a20);logger[_0x711c('0x12')](_0x711c('0x21'),_0x337a20,JSON[_0x711c('0x13')](_0x4a0ec6));_0xfbb0c9(_0x4a0ec6);})['catch'](function(_0x33f932){logger[_0x711c('0x14')](_0x711c('0x21'),_0x33f932['message'],_0x337a20);_0x283791(_0x270bf5['error'](0x1f4,_0x33f932[_0x711c('0x15')]));});});};exports[_0x711c('0x26')]=function(_0xa89cc6){var _0x2bd089=this;return new Promise(function(_0x498ba8,_0x872a8b){return db[_0x711c('0x22')][_0x711c('0x27')](_0xa89cc6[_0x711c('0x24')],{'raw':_0xa89cc6['options']?_0xa89cc6['options'][_0x711c('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa89cc6[_0x711c('0x1b')]?_0xa89cc6['options'][_0x711c('0x1c')]||null:null,'attributes':_0xa89cc6[_0x711c('0x1b')]?_0xa89cc6[_0x711c('0x1b')][_0x711c('0x1d')]||null:null,'limit':_0xa89cc6[_0x711c('0x1b')]?_0xa89cc6[_0x711c('0x1b')][_0x711c('0x28')]||null:null})[_0x711c('0x10')](function(_0x4709aa){logger[_0x711c('0x17')](_0x711c('0x26'),_0xa89cc6);logger[_0x711c('0x12')](_0x711c('0x26'),_0xa89cc6,JSON[_0x711c('0x13')](_0x4709aa));_0x498ba8(_0x4709aa);})['catch'](function(_0x6dcbb6){logger[_0x711c('0x14')](_0x711c('0x26'),_0x6dcbb6[_0x711c('0x15')],_0xa89cc6);_0x872a8b(_0x2bd089[_0x711c('0x14')](0x1f4,_0x6dcbb6[_0x711c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 02c2959..6400b0c 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 _0x897d=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x3a49ed,_0x5942c0){var _0xfc681=function(_0x11d26b){while(--_0x11d26b){_0x3a49ed['push'](_0x3a49ed['shift']());}};_0xfc681(++_0x5942c0);}(_0x897d,0x80));var _0xd897=function(_0x31a212,_0x45c30d){_0x31a212=_0x31a212-0x0;var _0x4fe251=_0x897d[_0x31a212];return _0x4fe251;};'use strict';var VoiceQueueReportEvents=require(_0xd897('0x0'));var events=[_0xd897('0x1'),_0xd897('0x2'),_0xd897('0x3')];function createListener(_0x2bd776,_0xcee3){return function(_0x8e4325){_0xcee3[_0xd897('0x4')](_0x2bd776,_0x8e4325);};}function removeListener(_0x407c5c,_0xf4d1dd){return function(){VoiceQueueReportEvents[_0xd897('0x5')](_0x407c5c,_0xf4d1dd);};}exports[_0xd897('0x6')]=function(_0x3e1cc5){for(var _0x386bc2=0x0,_0x317dac=events[_0xd897('0x7')];_0x386bc2<_0x317dac;_0x386bc2++){var _0x29caa5=events[_0x386bc2];var _0x28e011=createListener(_0xd897('0x8')+_0x29caa5,_0x3e1cc5);VoiceQueueReportEvents['on'](_0x29caa5,_0x28e011);}}; \ No newline at end of file +var _0x1a61=['register','length','voiceQueueReport:','./voiceQueueReport.events','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a61,0x1e6));var _0x11a6=function(_0x327289,_0x32babc){_0x327289=_0x327289-0x0;var _0x14f96f=_0x1a61[_0x327289];return _0x14f96f;};'use strict';var VoiceQueueReportEvents=require(_0x11a6('0x0'));var events=['save',_0x11a6('0x1'),'update'];function createListener(_0x5665d0,_0x359289){return function(_0x2e2dbd){_0x359289[_0x11a6('0x2')](_0x5665d0,_0x2e2dbd);};}function removeListener(_0x52c410,_0x5777a4){return function(){VoiceQueueReportEvents[_0x11a6('0x3')](_0x52c410,_0x5777a4);};}exports[_0x11a6('0x4')]=function(_0x5b72a1){for(var _0x41e03d=0x0,_0x1c4b31=events[_0x11a6('0x5')];_0x41e03d<_0x1c4b31;_0x41e03d++){var _0x333ec2=events[_0x41e03d];var _0x1c67ce=createListener(_0x11a6('0x6')+_0x333ec2,_0x5b72a1);VoiceQueueReportEvents['on'](_0x333ec2,_0x1c67ce);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 06ecf5f..2b61b38 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 _0x9122=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x2cf307,_0x1caed8){var _0x5eb76c=function(_0x2d7097){while(--_0x2d7097){_0x2cf307['push'](_0x2cf307['shift']());}};_0x5eb76c(++_0x1caed8);}(_0x9122,0xa5));var _0x2912=function(_0x17935e,_0x1256f5){_0x17935e=_0x17935e-0x0;var _0x14c9e9=_0x9122[_0x17935e];return _0x14c9e9;};'use strict';var multer=require(_0x2912('0x0'));var util=require(_0x2912('0x1'));var path=require(_0x2912('0x2'));var timeout=require(_0x2912('0x3'));var express=require(_0x2912('0x4'));var router=express[_0x2912('0x5')]();var fs_extra=require(_0x2912('0x6'));var auth=require(_0x2912('0x7'));var interaction=require(_0x2912('0x8'));var config=require(_0x2912('0x9'));var controller=require(_0x2912('0xa'));router[_0x2912('0xb')]('/',auth[_0x2912('0xc')](),controller[_0x2912('0xd')]);router[_0x2912('0xb')](_0x2912('0xe'),auth[_0x2912('0xc')](),controller[_0x2912('0xf')]);router[_0x2912('0x10')]('/',auth[_0x2912('0xc')](),controller[_0x2912('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2912('0x12')]);router[_0x2912('0x13')](_0x2912('0xe'),auth['isAuthenticated'](),controller[_0x2912('0x14')]);module[_0x2912('0x15')]=router; \ No newline at end of file +var _0x4385=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x4385,0x168));var _0x5438=function(_0x25d372,_0x2a55f5){_0x25d372=_0x25d372-0x0;var _0x1ee0c0=_0x4385[_0x25d372];return _0x1ee0c0;};'use strict';var multer=require(_0x5438('0x0'));var util=require(_0x5438('0x1'));var path=require(_0x5438('0x2'));var timeout=require(_0x5438('0x3'));var express=require('express');var router=express[_0x5438('0x4')]();var fs_extra=require(_0x5438('0x5'));var auth=require(_0x5438('0x6'));var interaction=require(_0x5438('0x7'));var config=require(_0x5438('0x8'));var controller=require(_0x5438('0x9'));router[_0x5438('0xa')]('/',auth[_0x5438('0xb')](),controller[_0x5438('0xc')]);router[_0x5438('0xa')](_0x5438('0xd'),auth[_0x5438('0xb')](),controller['show']);router[_0x5438('0xe')]('/',auth[_0x5438('0xb')](),controller[_0x5438('0xf')]);router[_0x5438('0x10')]('/:id',auth[_0x5438('0xb')](),controller['update']);router[_0x5438('0x11')](_0x5438('0xd'),auth[_0x5438('0xb')](),controller['destroy']);module[_0x5438('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index dafd7ad..8cdfb67 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 _0xd63c=['DATE','literal','moment','exports','STRING'];(function(_0x4ae9da,_0x23d7ac){var _0x50e578=function(_0x31a467){while(--_0x31a467){_0x4ae9da['push'](_0x4ae9da['shift']());}};_0x50e578(++_0x23d7ac);}(_0xd63c,0x8e));var _0xcd63=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd63c[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcd63('0x0'));module[_0xcd63('0x1')]={'time':{'type':Sequelize[_0xcd63('0x2')]},'callid':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xcd63('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xcd63('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xe337=['sequelize','moment','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x438d40,_0x54e013){var _0x5fe6fd=function(_0x17647b){while(--_0x17647b){_0x438d40['push'](_0x438d40['shift']());}};_0x5fe6fd(++_0x54e013);}(_0xe337,0xe6));var _0x7e33=function(_0x2e785e,_0x232c0a){_0x2e785e=_0x2e785e-0x0;var _0x230f26=_0xe337[_0x2e785e];return _0x230f26;};'use strict';var Sequelize=require(_0x7e33('0x0'));var moment=require(_0x7e33('0x1'));module['exports']={'time':{'type':Sequelize[_0x7e33('0x2')]},'callid':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7e33('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x7e33('0x3')](_0x7e33('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index cee0bbf..c1dc10a 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 _0x530b=['../../config/utils','../../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','index','map','VoiceQueuesLog','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','type','filter','options','where','includeAll','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4a81e8,_0x478cbf){var _0x570665=function(_0x2ecd60){while(--_0x2ecd60){_0x4a81e8['push'](_0x4a81e8['shift']());}};_0x570665(++_0x478cbf);}(_0x530b,0x1e3));var _0xb530=function(_0x5df033,_0x29458b){_0x5df033=_0x5df033-0x0;var _0x445829=_0x530b[_0x5df033];return _0x445829;};'use strict';var emlformat=require(_0xb530('0x0'));var rimraf=require(_0xb530('0x1'));var zipdir=require(_0xb530('0x2'));var jsonpatch=require(_0xb530('0x3'));var rp=require(_0xb530('0x4'));var moment=require('moment');var BPromise=require(_0xb530('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb530('0x6'));var sox=require(_0xb530('0x7'));var csv=require('to-csv');var ejs=require(_0xb530('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb530('0x9'));var squel=require(_0xb530('0xa'));var crypto=require(_0xb530('0xb'));var jsforce=require(_0xb530('0xc'));var deskjs=require(_0xb530('0xd'));var toCsv=require(_0xb530('0xe'));var querystring=require(_0xb530('0xf'));var Papa=require('papaparse');var Redis=require(_0xb530('0x10'));var authService=require(_0xb530('0x11'));var qs=require(_0xb530('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb530('0x13'));var logger=require(_0xb530('0x14'))('api');var utils=require(_0xb530('0x15'));var config=require(_0xb530('0x16'));var licenseUtil=require(_0xb530('0x17'));var db=require(_0xb530('0x18'))['db'];function respondWithStatusCode(_0x2f0a75,_0x309156){_0x309156=_0x309156||0xcc;return function(_0x458777){if(_0x458777){return _0x2f0a75[_0xb530('0x19')](_0x309156);}return _0x2f0a75[_0xb530('0x1a')](_0x309156)['end']();};}function respondWithResult(_0x4ece81,_0x5202d1){_0x5202d1=_0x5202d1||0xc8;return function(_0x576714){if(_0x576714){return _0x4ece81['status'](_0x5202d1)[_0xb530('0x1b')](_0x576714);}};}function respondWithFilteredResult(_0x44c997,_0x187590){return function(_0x63fd1){if(_0x63fd1){var _0x2bd548=typeof _0x187590[_0xb530('0x1c')]===_0xb530('0x1d')&&typeof _0x187590[_0xb530('0x1e')]===_0xb530('0x1d');var _0x4d55a7=_0x63fd1[_0xb530('0x1f')];var _0x5d8031=_0x2bd548?0x0:_0x187590[_0xb530('0x1c')];var _0x5f395c=_0x2bd548?_0x63fd1[_0xb530('0x1f')]:_0x187590[_0xb530('0x1c')]+_0x187590[_0xb530('0x1e')];var _0x20e476;if(_0x5f395c>=_0x4d55a7){_0x5f395c=_0x4d55a7;_0x20e476=0xc8;}else{_0x20e476=0xce;}_0x44c997[_0xb530('0x1a')](_0x20e476);return _0x44c997[_0xb530('0x20')](_0xb530('0x21'),_0x5d8031+'-'+_0x5f395c+'/'+_0x4d55a7)['json'](_0x63fd1);}return null;};}function patchUpdates(_0xca511d){return function(_0x3d109c){try{jsonpatch[_0xb530('0x22')](_0x3d109c,_0xca511d,!![]);}catch(_0x51691f){return BPromise[_0xb530('0x23')](_0x51691f);}return _0x3d109c[_0xb530('0x24')]();};}function saveUpdates(_0x3f18c1,_0x48b8e6){return function(_0x3f2453){if(_0x3f2453){return _0x3f2453[_0xb530('0x25')](_0x3f18c1)[_0xb530('0x26')](function(_0x2ecd53){return _0x2ecd53;});}return null;};}function removeEntity(_0xc02384,_0x10b9f0){return function(_0x2a7815){if(_0x2a7815){return _0x2a7815[_0xb530('0x27')]()[_0xb530('0x26')](function(){_0xc02384[_0xb530('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bcf5c,_0x2adb8e){return function(_0x5bbb6b){if(!_0x5bbb6b){_0x1bcf5c['sendStatus'](0x194);}return _0x5bbb6b;};}function handleError(_0x4d2672,_0x12d815){_0x12d815=_0x12d815||0x1f4;return function(_0x1d8de5){logger[_0xb530('0x28')](_0x1d8de5[_0xb530('0x29')]);if(_0x1d8de5[_0xb530('0x2a')]){delete _0x1d8de5['name'];}_0x4d2672[_0xb530('0x1a')](_0x12d815)['send'](_0x1d8de5);};}exports[_0xb530('0x2b')]=function(_0x3a579e,_0x4cf69c){var _0x49d8bf={},_0x1d0c60={},_0x48195d={'count':0x0,'rows':[]};var _0xc1e9ed=_[_0xb530('0x2c')](db[_0xb530('0x2d')]['rawAttributes'],function(_0x352abc){return{'name':_0x352abc['fieldName'],'type':_0x352abc['type'][_0xb530('0x2e')]};});_0x1d0c60[_0xb530('0x2f')]=_[_0xb530('0x2c')](_0xc1e9ed,_0xb530('0x2a'));_0x1d0c60[_0xb530('0x30')]=_[_0xb530('0x31')](_0x3a579e[_0xb530('0x30')]);_0x1d0c60[_0xb530('0x32')]=_[_0xb530('0x33')](_0x1d0c60[_0xb530('0x2f')],_0x1d0c60[_0xb530('0x30')]);_0x49d8bf[_0xb530('0x34')]=_[_0xb530('0x33')](_0x1d0c60[_0xb530('0x2f')],qs[_0xb530('0x35')](_0x3a579e[_0xb530('0x30')]['fields']));_0x49d8bf['attributes']=_0x49d8bf['attributes'][_0xb530('0x36')]?_0x49d8bf['attributes']:_0x1d0c60[_0xb530('0x2f')];if(!_0x3a579e['query']['hasOwnProperty'](_0xb530('0x37'))){_0x49d8bf[_0xb530('0x1e')]=qs[_0xb530('0x1e')](_0x3a579e[_0xb530('0x30')][_0xb530('0x1e')]);_0x49d8bf[_0xb530('0x1c')]=qs[_0xb530('0x1c')](_0x3a579e[_0xb530('0x30')][_0xb530('0x1c')]);}_0x49d8bf[_0xb530('0x38')]=qs['sort'](_0x3a579e[_0xb530('0x30')][_0xb530('0x39')]);_0x49d8bf['where']=qs[_0xb530('0x32')](_[_0xb530('0x3a')](_0x3a579e[_0xb530('0x30')],_0x1d0c60[_0xb530('0x32')]),_0xc1e9ed);if(_0x3a579e[_0xb530('0x30')]['filter']){_0x49d8bf['where']=_[_0xb530('0x3b')](_0x49d8bf['where'],{'$or':_[_0xb530('0x2c')](_0xc1e9ed,function(_0xc899f0){if(_0xc899f0[_0xb530('0x3c')]!=='VIRTUAL'){var _0x30df02={};_0x30df02[_0xc899f0['name']]={'$like':'%'+_0x3a579e[_0xb530('0x30')][_0xb530('0x3d')]+'%'};return _0x30df02;}})});}_0x49d8bf=_[_0xb530('0x3b')]({},_0x49d8bf,_0x3a579e[_0xb530('0x3e')]);var _0x24d695={'where':_0x49d8bf[_0xb530('0x3f')]};return db[_0xb530('0x2d')]['count'](_0x24d695)[_0xb530('0x26')](function(_0x2cf797){_0x48195d[_0xb530('0x1f')]=_0x2cf797;if(_0x3a579e[_0xb530('0x30')][_0xb530('0x40')]){_0x49d8bf['include']=[{'all':!![]}];}return db[_0xb530('0x2d')][_0xb530('0x41')](_0x49d8bf);})[_0xb530('0x26')](function(_0x1682da){_0x48195d[_0xb530('0x42')]=_0x1682da;return _0x48195d;})[_0xb530('0x26')](respondWithFilteredResult(_0x4cf69c,_0x49d8bf))[_0xb530('0x43')](handleError(_0x4cf69c,null));};exports['show']=function(_0x1e52c9,_0x1c82a4){var _0x29e70c={'raw':!![],'where':{'id':_0x1e52c9[_0xb530('0x44')]['id']}},_0x1d5611={};_0x1d5611['model']=_[_0xb530('0x31')](db[_0xb530('0x2d')]['rawAttributes']);_0x1d5611[_0xb530('0x30')]=_[_0xb530('0x31')](_0x1e52c9['query']);_0x1d5611[_0xb530('0x32')]=_[_0xb530('0x33')](_0x1d5611[_0xb530('0x2f')],_0x1d5611[_0xb530('0x30')]);_0x29e70c[_0xb530('0x34')]=_[_0xb530('0x33')](_0x1d5611[_0xb530('0x2f')],qs[_0xb530('0x35')](_0x1e52c9[_0xb530('0x30')][_0xb530('0x35')]));_0x29e70c[_0xb530('0x34')]=_0x29e70c[_0xb530('0x34')][_0xb530('0x36')]?_0x29e70c[_0xb530('0x34')]:_0x1d5611[_0xb530('0x2f')];if(_0x1e52c9['query'][_0xb530('0x40')]){_0x29e70c['include']=[{'all':!![]}];}_0x29e70c=_[_0xb530('0x3b')]({},_0x29e70c,_0x1e52c9[_0xb530('0x3e')]);return db[_0xb530('0x2d')][_0xb530('0x45')](_0x29e70c)[_0xb530('0x26')](handleEntityNotFound(_0x1c82a4,null))['then'](respondWithResult(_0x1c82a4,null))[_0xb530('0x43')](handleError(_0x1c82a4,null));};exports[_0xb530('0x46')]=function(_0x2619a9,_0x1d75e9){return db[_0xb530('0x2d')][_0xb530('0x46')](_0x2619a9[_0xb530('0x47')],{})['then'](respondWithResult(_0x1d75e9,0xc9))[_0xb530('0x43')](handleError(_0x1d75e9,null));};exports[_0xb530('0x25')]=function(_0x4e52b4,_0x54d8e4){if(_0x4e52b4[_0xb530('0x47')]['id']){delete _0x4e52b4[_0xb530('0x47')]['id'];}return db[_0xb530('0x2d')][_0xb530('0x45')]({'where':{'id':_0x4e52b4[_0xb530('0x44')]['id']}})[_0xb530('0x26')](handleEntityNotFound(_0x54d8e4,null))[_0xb530('0x26')](saveUpdates(_0x4e52b4[_0xb530('0x47')],null))['then'](respondWithResult(_0x54d8e4,null))[_0xb530('0x43')](handleError(_0x54d8e4,null));};exports[_0xb530('0x27')]=function(_0x39881c,_0xd6b8f2){return db[_0xb530('0x2d')][_0xb530('0x45')]({'where':{'id':_0x39881c[_0xb530('0x44')]['id']}})[_0xb530('0x26')](handleEntityNotFound(_0xd6b8f2,null))[_0xb530('0x26')](removeEntity(_0xd6b8f2,null))[_0xb530('0x43')](handleError(_0xd6b8f2,null));}; \ No newline at end of file +var _0x3010=['include','findAll','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','options','includeAll'];(function(_0x4c89cd,_0x2c57e2){var _0x1090d2=function(_0x1e9dda){while(--_0x1e9dda){_0x4c89cd['push'](_0x4c89cd['shift']());}};_0x1090d2(++_0x2c57e2);}(_0x3010,0x1dc));var _0x0301=function(_0x5b4ab6,_0x2328ab){_0x5b4ab6=_0x5b4ab6-0x0;var _0x5c766f=_0x3010[_0x5b4ab6];return _0x5c766f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0301('0x0'));var zipdir=require(_0x0301('0x1'));var jsonpatch=require(_0x0301('0x2'));var rp=require(_0x0301('0x3'));var moment=require('moment');var BPromise=require(_0x0301('0x4'));var Mustache=require(_0x0301('0x5'));var util=require(_0x0301('0x6'));var path=require(_0x0301('0x7'));var sox=require(_0x0301('0x8'));var csv=require(_0x0301('0x9'));var ejs=require(_0x0301('0xa'));var fs=require('fs');var fs_extra=require(_0x0301('0xb'));var _=require('lodash');var squel=require(_0x0301('0xc'));var crypto=require(_0x0301('0xd'));var jsforce=require(_0x0301('0xe'));var deskjs=require(_0x0301('0xf'));var toCsv=require(_0x0301('0x9'));var querystring=require(_0x0301('0x10'));var Papa=require(_0x0301('0x11'));var Redis=require(_0x0301('0x12'));var authService=require(_0x0301('0x13'));var qs=require(_0x0301('0x14'));var as=require(_0x0301('0x15'));var hardwareService=require(_0x0301('0x16'));var logger=require(_0x0301('0x17'))(_0x0301('0x18'));var utils=require(_0x0301('0x19'));var config=require(_0x0301('0x1a'));var licenseUtil=require(_0x0301('0x1b'));var db=require(_0x0301('0x1c'))['db'];function respondWithStatusCode(_0x141b4f,_0x1ef0d6){_0x1ef0d6=_0x1ef0d6||0xcc;return function(_0x7c4916){if(_0x7c4916){return _0x141b4f[_0x0301('0x1d')](_0x1ef0d6);}return _0x141b4f[_0x0301('0x1e')](_0x1ef0d6)[_0x0301('0x1f')]();};}function respondWithResult(_0x302cbe,_0x535d97){_0x535d97=_0x535d97||0xc8;return function(_0x379cff){if(_0x379cff){return _0x302cbe[_0x0301('0x1e')](_0x535d97)[_0x0301('0x20')](_0x379cff);}};}function respondWithFilteredResult(_0x2687c2,_0x514fab){return function(_0x58ffa7){if(_0x58ffa7){var _0x2c1876=typeof _0x514fab['offset']===_0x0301('0x21')&&typeof _0x514fab[_0x0301('0x22')]===_0x0301('0x21');var _0x31f3ab=_0x58ffa7[_0x0301('0x23')];var _0x296f8d=_0x2c1876?0x0:_0x514fab['offset'];var _0x3bbf4f=_0x2c1876?_0x58ffa7[_0x0301('0x23')]:_0x514fab['offset']+_0x514fab[_0x0301('0x22')];var _0x12f205;if(_0x3bbf4f>=_0x31f3ab){_0x3bbf4f=_0x31f3ab;_0x12f205=0xc8;}else{_0x12f205=0xce;}_0x2687c2[_0x0301('0x1e')](_0x12f205);return _0x2687c2[_0x0301('0x24')](_0x0301('0x25'),_0x296f8d+'-'+_0x3bbf4f+'/'+_0x31f3ab)['json'](_0x58ffa7);}return null;};}function patchUpdates(_0x5ca2dc){return function(_0x162a2d){try{jsonpatch[_0x0301('0x26')](_0x162a2d,_0x5ca2dc,!![]);}catch(_0x4d0189){return BPromise[_0x0301('0x27')](_0x4d0189);}return _0x162a2d['save']();};}function saveUpdates(_0x56ce40,_0x4a2042){return function(_0x3c0dd2){if(_0x3c0dd2){return _0x3c0dd2[_0x0301('0x28')](_0x56ce40)[_0x0301('0x29')](function(_0x2f9514){return _0x2f9514;});}return null;};}function removeEntity(_0x352609,_0x80851d){return function(_0x16e037){if(_0x16e037){return _0x16e037[_0x0301('0x2a')]()[_0x0301('0x29')](function(){_0x352609[_0x0301('0x1e')](0xcc)[_0x0301('0x1f')]();});}};}function handleEntityNotFound(_0x1c4047,_0x3952f7){return function(_0x4eed6f){if(!_0x4eed6f){_0x1c4047['sendStatus'](0x194);}return _0x4eed6f;};}function handleError(_0x3f519b,_0x351ebb){_0x351ebb=_0x351ebb||0x1f4;return function(_0x472935){logger['error'](_0x472935['stack']);if(_0x472935[_0x0301('0x2b')]){delete _0x472935['name'];}_0x3f519b[_0x0301('0x1e')](_0x351ebb)[_0x0301('0x2c')](_0x472935);};}exports[_0x0301('0x2d')]=function(_0x1ad678,_0x3f8d4b){var _0x21daff={},_0x2be15c={},_0x5939ba={'count':0x0,'rows':[]};var _0x26a83c=_[_0x0301('0x2e')](db[_0x0301('0x2f')][_0x0301('0x30')],function(_0x8ed87d){return{'name':_0x8ed87d[_0x0301('0x31')],'type':_0x8ed87d[_0x0301('0x32')][_0x0301('0x33')]};});_0x2be15c[_0x0301('0x34')]=_[_0x0301('0x2e')](_0x26a83c,_0x0301('0x2b'));_0x2be15c[_0x0301('0x35')]=_[_0x0301('0x36')](_0x1ad678[_0x0301('0x35')]);_0x2be15c[_0x0301('0x37')]=_[_0x0301('0x38')](_0x2be15c[_0x0301('0x34')],_0x2be15c[_0x0301('0x35')]);_0x21daff[_0x0301('0x39')]=_[_0x0301('0x38')](_0x2be15c[_0x0301('0x34')],qs[_0x0301('0x3a')](_0x1ad678['query'][_0x0301('0x3a')]));_0x21daff[_0x0301('0x39')]=_0x21daff['attributes'][_0x0301('0x3b')]?_0x21daff[_0x0301('0x39')]:_0x2be15c[_0x0301('0x34')];if(!_0x1ad678[_0x0301('0x35')][_0x0301('0x3c')](_0x0301('0x3d'))){_0x21daff[_0x0301('0x22')]=qs[_0x0301('0x22')](_0x1ad678['query']['limit']);_0x21daff[_0x0301('0x3e')]=qs['offset'](_0x1ad678[_0x0301('0x35')]['offset']);}_0x21daff[_0x0301('0x3f')]=qs[_0x0301('0x40')](_0x1ad678[_0x0301('0x35')]['sort']);_0x21daff[_0x0301('0x41')]=qs[_0x0301('0x37')](_['pick'](_0x1ad678[_0x0301('0x35')],_0x2be15c[_0x0301('0x37')]),_0x26a83c);if(_0x1ad678['query'][_0x0301('0x42')]){_0x21daff[_0x0301('0x41')]=_[_0x0301('0x43')](_0x21daff['where'],{'$or':_[_0x0301('0x2e')](_0x26a83c,function(_0x3bac05){if(_0x3bac05[_0x0301('0x32')]!=='VIRTUAL'){var _0x21114e={};_0x21114e[_0x3bac05['name']]={'$like':'%'+_0x1ad678[_0x0301('0x35')][_0x0301('0x42')]+'%'};return _0x21114e;}})});}_0x21daff=_['merge']({},_0x21daff,_0x1ad678[_0x0301('0x44')]);var _0x17e7d3={'where':_0x21daff[_0x0301('0x41')]};return db[_0x0301('0x2f')][_0x0301('0x23')](_0x17e7d3)['then'](function(_0x4df5c2){_0x5939ba[_0x0301('0x23')]=_0x4df5c2;if(_0x1ad678[_0x0301('0x35')][_0x0301('0x45')]){_0x21daff[_0x0301('0x46')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x0301('0x47')](_0x21daff);})[_0x0301('0x29')](function(_0x23b0da){_0x5939ba['rows']=_0x23b0da;return _0x5939ba;})['then'](respondWithFilteredResult(_0x3f8d4b,_0x21daff))[_0x0301('0x48')](handleError(_0x3f8d4b,null));};exports[_0x0301('0x49')]=function(_0x3054b9,_0x445a9b){var _0x16d09f={'raw':!![],'where':{'id':_0x3054b9[_0x0301('0x4a')]['id']}},_0x3d332a={};_0x3d332a['model']=_[_0x0301('0x36')](db[_0x0301('0x2f')][_0x0301('0x30')]);_0x3d332a['query']=_[_0x0301('0x36')](_0x3054b9[_0x0301('0x35')]);_0x3d332a['filters']=_['intersection'](_0x3d332a[_0x0301('0x34')],_0x3d332a[_0x0301('0x35')]);_0x16d09f[_0x0301('0x39')]=_[_0x0301('0x38')](_0x3d332a[_0x0301('0x34')],qs[_0x0301('0x3a')](_0x3054b9[_0x0301('0x35')][_0x0301('0x3a')]));_0x16d09f[_0x0301('0x39')]=_0x16d09f[_0x0301('0x39')][_0x0301('0x3b')]?_0x16d09f[_0x0301('0x39')]:_0x3d332a[_0x0301('0x34')];if(_0x3054b9['query'][_0x0301('0x45')]){_0x16d09f['include']=[{'all':!![]}];}_0x16d09f=_[_0x0301('0x43')]({},_0x16d09f,_0x3054b9['options']);return db[_0x0301('0x2f')][_0x0301('0x4b')](_0x16d09f)[_0x0301('0x29')](handleEntityNotFound(_0x445a9b,null))[_0x0301('0x29')](respondWithResult(_0x445a9b,null))['catch'](handleError(_0x445a9b,null));};exports['create']=function(_0x296544,_0x12d77c){return db['VoiceQueuesLog'][_0x0301('0x4c')](_0x296544['body'],{})[_0x0301('0x29')](respondWithResult(_0x12d77c,0xc9))[_0x0301('0x48')](handleError(_0x12d77c,null));};exports[_0x0301('0x28')]=function(_0x1257fb,_0x2ce5bb){if(_0x1257fb['body']['id']){delete _0x1257fb[_0x0301('0x4d')]['id'];}return db[_0x0301('0x2f')]['find']({'where':{'id':_0x1257fb[_0x0301('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ce5bb,null))[_0x0301('0x29')](saveUpdates(_0x1257fb['body'],null))[_0x0301('0x29')](respondWithResult(_0x2ce5bb,null))[_0x0301('0x48')](handleError(_0x2ce5bb,null));};exports[_0x0301('0x2a')]=function(_0x51dac7,_0x136572){return db[_0x0301('0x2f')][_0x0301('0x4b')]({'where':{'id':_0x51dac7[_0x0301('0x4a')]['id']}})[_0x0301('0x29')](handleEntityNotFound(_0x136572,null))['then'](removeEntity(_0x136572,null))['catch'](handleError(_0x136572,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9243ebc..80010d4 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 _0x8275=['bluebird','request-promise','path','../../config/environment','exports','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x233be2,_0xa819c9){var _0x3e0449=function(_0x2ef358){while(--_0x2ef358){_0x233be2['push'](_0x233be2['shift']());}};_0x3e0449(++_0xa819c9);}(_0x8275,0x87));var _0x5827=function(_0x47be0c,_0x44a438){_0x47be0c=_0x47be0c-0x0;var _0x40bf94=_0x8275[_0x47be0c];return _0x40bf94;};'use strict';var _=require(_0x5827('0x0'));var util=require(_0x5827('0x1'));var logger=require(_0x5827('0x2'))(_0x5827('0x3'));var moment=require(_0x5827('0x4'));var BPromise=require(_0x5827('0x5'));var rp=require(_0x5827('0x6'));var fs=require('fs');var path=require(_0x5827('0x7'));var rimraf=require('rimraf');var config=require(_0x5827('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x5827('0x9')]=function(_0x43777f,_0x8182ab){return _0x43777f['define'](_0x5827('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5827('0xb'),'fields':[_0x5827('0xc'),_0x5827('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc73e=['exports','define','voice_queues_log','event','dtm','lodash','util','api','moment','rimraf','../../config/environment'];(function(_0x7cda67,_0x8a9adc){var _0x3d5409=function(_0x3a043e){while(--_0x3a043e){_0x7cda67['push'](_0x7cda67['shift']());}};_0x3d5409(++_0x8a9adc);}(_0xc73e,0x1e9));var _0xec73=function(_0x5423c0,_0x4c0b8c){_0x5423c0=_0x5423c0-0x0;var _0x1e6f2f=_0xc73e[_0x5423c0];return _0x1e6f2f;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require('../../config/logger')(_0xec73('0x2'));var moment=require(_0xec73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0xec73('0x6')]=function(_0x26598a,_0x3bd154){return _0x26598a[_0xec73('0x7')]('VoiceQueuesLog',attributes,{'tableName':_0xec73('0x8'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xec73('0x9'),_0xec73('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 529df4e..0c5c250 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 _0x73bd=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x73bd,0x6b));var _0xd73b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x73bd[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xd73b('0x0'));var util=require('util');var moment=require(_0xd73b('0x1'));var BPromise=require(_0xd73b('0x2'));var rs=require(_0xd73b('0x3'));var fs=require('fs');var Redis=require(_0xd73b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd73b('0x5'));var logger=require(_0xd73b('0x6'))('rpc');var config=require(_0xd73b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd73b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f3a3d,_0x41a563,_0x397565){return new BPromise(function(_0x397b44,_0x6574b8){return client['request'](_0x3f3a3d,_0x397565)[_0xd73b('0x9')](function(_0x18b10c){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x41a563,_0xd73b('0xa'));logger[_0xd73b('0xb')](_0xd73b('0xc'),_0x41a563,_0xd73b('0xa'),JSON['stringify'](_0x18b10c));if(_0x18b10c[_0xd73b('0xd')]){if(_0x18b10c[_0xd73b('0xd')]['code']===0x1f4){logger[_0xd73b('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x41a563,_0x18b10c['error']['message']);return _0x6574b8(_0x18b10c[_0xd73b('0xd')][_0xd73b('0xe')]);}logger[_0xd73b('0xd')](_0xd73b('0xf'),_0x41a563,_0x18b10c[_0xd73b('0xd')][_0xd73b('0xe')]);return _0x397b44(_0x18b10c[_0xd73b('0xd')][_0xd73b('0xe')]);}else{logger['info'](_0xd73b('0xf'),_0x41a563,_0xd73b('0xa'));_0x397b44(_0x18b10c[_0xd73b('0x10')][_0xd73b('0xe')]);}})[_0xd73b('0x11')](function(_0x5b9558){logger[_0xd73b('0xd')](_0xd73b('0xf'),_0x41a563,_0x5b9558);_0x6574b8(_0x5b9558);});});} \ No newline at end of file +var _0x4a29=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a29,0x18b));var _0x94a2=function(_0x5d2ae2,_0x50235f){_0x5d2ae2=_0x5d2ae2-0x0;var _0x3a2fb3=_0x4a29[_0x5d2ae2];return _0x3a2fb3;};'use strict';var _=require(_0x94a2('0x0'));var util=require(_0x94a2('0x1'));var moment=require('moment');var BPromise=require(_0x94a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94a2('0x3'));var db=require(_0x94a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x94a2('0x5'))(_0x94a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x94a2('0x7'));var client=jayson[_0x94a2('0x8')][_0x94a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f6c7d,_0x18d65c,_0x28fac7){return new BPromise(function(_0x45297b,_0x1ae50a){return client[_0x94a2('0xa')](_0x4f6c7d,_0x28fac7)['then'](function(_0x135fda){logger['info'](_0x94a2('0xb'),_0x18d65c,_0x94a2('0xc'));logger['debug'](_0x94a2('0xd'),_0x18d65c,_0x94a2('0xc'),JSON[_0x94a2('0xe')](_0x135fda));if(_0x135fda[_0x94a2('0xf')]){if(_0x135fda['error'][_0x94a2('0x10')]===0x1f4){logger[_0x94a2('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18d65c,_0x135fda[_0x94a2('0xf')]['message']);return _0x1ae50a(_0x135fda[_0x94a2('0xf')][_0x94a2('0x11')]);}logger[_0x94a2('0xf')](_0x94a2('0xb'),_0x18d65c,_0x135fda[_0x94a2('0xf')][_0x94a2('0x11')]);return _0x45297b(_0x135fda[_0x94a2('0xf')][_0x94a2('0x11')]);}else{logger[_0x94a2('0x12')](_0x94a2('0xb'),_0x18d65c,'request\x20sent');_0x45297b(_0x135fda[_0x94a2('0x13')]['message']);}})[_0x94a2('0x14')](function(_0x3bdccd){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x18d65c,_0x3bdccd);_0x1ae50a(_0x3bdccd);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0a86572..ec25b9f 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 _0xde9d=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','get','/:id/download','download','/:id/downloads','downloads','create','post','put','update','util'];(function(_0x2c672f,_0x41bd03){var _0x2d0e7e=function(_0x3a210d){while(--_0x3a210d){_0x2c672f['push'](_0x2c672f['shift']());}};_0x2d0e7e(++_0x41bd03);}(_0xde9d,0xdb));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xdde9('0x0'));var path=require('path');var timeout=require(_0xdde9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdde9('0x2'));var auth=require(_0xdde9('0x3'));var interaction=require(_0xdde9('0x4'));var config=require(_0xdde9('0x5'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0xdde9('0x6')](),controller[_0xdde9('0x7')]);router['get'](_0xdde9('0x8'),auth[_0xdde9('0x6')](),controller['describe']);router['get'](_0xdde9('0x9'),auth[_0xdde9('0x6')](),controller[_0xdde9('0xa')]);router[_0xdde9('0xb')](_0xdde9('0xc'),auth[_0xdde9('0x6')](),controller[_0xdde9('0xd')]);router[_0xdde9('0xb')](_0xdde9('0xe'),controller[_0xdde9('0xf')]);router['get']('/:id/transcribe',auth[_0xdde9('0x6')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0xdde9('0x10')]);router[_0xdde9('0x11')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0xdde9('0x12')](_0xdde9('0x9'),auth[_0xdde9('0x6')](),controller[_0xdde9('0x13')]);router['delete'](_0xdde9('0x9'),auth[_0xdde9('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa036=['update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','/:id/downloads','downloads','create','post','/:id/transcribe','runTranscribe','put'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa036,0x1be));var _0x6a03=function(_0x33f49f,_0x18fa2d){_0x33f49f=_0x33f49f-0x0;var _0x5335a3=_0xa036[_0x33f49f];return _0x5335a3;};'use strict';var multer=require(_0x6a03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a03('0x1'));var express=require('express');var router=express[_0x6a03('0x2')]();var fs_extra=require(_0x6a03('0x3'));var auth=require(_0x6a03('0x4'));var interaction=require(_0x6a03('0x5'));var config=require(_0x6a03('0x6'));var controller=require(_0x6a03('0x7'));router[_0x6a03('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a03('0x9')]);router[_0x6a03('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6a03('0x8')](_0x6a03('0xa'),auth['isAuthenticated'](),controller[_0x6a03('0xb')]);router[_0x6a03('0x8')](_0x6a03('0xc'),auth[_0x6a03('0xd')](),controller[_0x6a03('0xe')]);router[_0x6a03('0x8')](_0x6a03('0xf'),controller[_0x6a03('0x10')]);router[_0x6a03('0x8')]('/:id/transcribe',auth[_0x6a03('0xd')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0x6a03('0x11')]);router[_0x6a03('0x12')](_0x6a03('0x13'),auth[_0x6a03('0xd')](),controller[_0x6a03('0x14')]);router[_0x6a03('0x15')](_0x6a03('0xa'),auth['isAuthenticated'](),controller[_0x6a03('0x16')]);router[_0x6a03('0x17')](_0x6a03('0xa'),auth['isAuthenticated'](),controller[_0x6a03('0x18')]);module[_0x6a03('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5edf822..f100a0f 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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 49c4ce6..9aafa74 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 _0xdebd=['body','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','../../components/encryptor','sequelize','MD5','col','push','$and','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeRegion','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','updateAttributes','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create'];(function(_0x23aab7,_0x3390e0){var _0x798e7f=function(_0x4fe258){while(--_0x4fe258){_0x23aab7['push'](_0x23aab7['shift']());}};_0x798e7f(++_0x3390e0);}(_0xdebd,0xd7));var _0xddeb=function(_0x13734d,_0x46ab7c){_0x13734d=_0x13734d-0x0;var _0xee397f=_0xdebd[_0x13734d];return _0xee397f;};'use strict';var emlformat=require(_0xddeb('0x0'));var rimraf=require(_0xddeb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddeb('0x2'));var rp=require(_0xddeb('0x3'));var moment=require('moment');var BPromise=require(_0xddeb('0x4'));var Mustache=require(_0xddeb('0x5'));var util=require(_0xddeb('0x6'));var path=require(_0xddeb('0x7'));var sox=require(_0xddeb('0x8'));var csv=require(_0xddeb('0x9'));var ejs=require(_0xddeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xddeb('0xb'));var crypto=require(_0xddeb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xddeb('0x9'));var querystring=require(_0xddeb('0xd'));var Papa=require(_0xddeb('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xddeb('0xf'));var Redis=require(_0xddeb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xddeb('0x11'));var hardwareService=require(_0xddeb('0x12'));var logger=require(_0xddeb('0x13'))(_0xddeb('0x14'));var utils=require(_0xddeb('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3be183,_0x2dc9e5){_0x2dc9e5=_0x2dc9e5||0xcc;return function(_0x208f6d){if(_0x208f6d){return _0x3be183[_0xddeb('0x16')](_0x2dc9e5);}return _0x3be183['status'](_0x2dc9e5)[_0xddeb('0x17')]();};}function respondWithResult(_0x46a6b8,_0x2ff1a2){_0x2ff1a2=_0x2ff1a2||0xc8;return function(_0x178d48){if(_0x178d48){return _0x46a6b8['status'](_0x2ff1a2)[_0xddeb('0x18')](_0x178d48);}};}function respondWithFilteredResult(_0x23463c,_0x4b1c3a){return function(_0x193a61){if(_0x193a61){var _0x181a18=typeof _0x4b1c3a[_0xddeb('0x19')]===_0xddeb('0x1a')&&typeof _0x4b1c3a['limit']===_0xddeb('0x1a');var _0x4cad23=_0x193a61[_0xddeb('0x1b')];var _0xe9f3ae=_0x181a18?0x0:_0x4b1c3a['offset'];var _0x379af8=_0x181a18?_0x193a61[_0xddeb('0x1b')]:_0x4b1c3a[_0xddeb('0x19')]+_0x4b1c3a[_0xddeb('0x1c')];var _0x52ccfe;if(_0x379af8>=_0x4cad23){_0x379af8=_0x4cad23;_0x52ccfe=0xc8;}else{_0x52ccfe=0xce;}_0x23463c[_0xddeb('0x1d')](_0x52ccfe);return _0x23463c[_0xddeb('0x1e')](_0xddeb('0x1f'),_0xe9f3ae+'-'+_0x379af8+'/'+_0x4cad23)[_0xddeb('0x18')](_0x193a61);}return null;};}function patchUpdates(_0x3d2b61){return function(_0x70f5f){try{jsonpatch[_0xddeb('0x20')](_0x70f5f,_0x3d2b61,!![]);}catch(_0x3d0f8c){return BPromise['reject'](_0x3d0f8c);}return _0x70f5f[_0xddeb('0x21')]();};}function saveUpdates(_0x5a7e51,_0xa6af31){return function(_0x1a455f){if(_0x1a455f){return _0x1a455f[_0xddeb('0x22')](_0x5a7e51)[_0xddeb('0x23')](function(_0x504631){return _0x504631;});}return null;};}function removeEntity(_0x143442,_0x12ed97){return function(_0x5bf7af){if(_0x5bf7af){return _0x5bf7af[_0xddeb('0x24')]()[_0xddeb('0x23')](function(){_0x143442['status'](0xcc)[_0xddeb('0x17')]();});}};}function handleEntityNotFound(_0x54ec76,_0x3c6b96){return function(_0x51d07c){if(!_0x51d07c){_0x54ec76[_0xddeb('0x16')](0x194);}return _0x51d07c;};}function handleError(_0x1271ef,_0x59b661){_0x59b661=_0x59b661||0x1f4;return function(_0x4b9774){logger['error'](_0x4b9774['stack']);if(_0x4b9774[_0xddeb('0x25')]){delete _0x4b9774[_0xddeb('0x25')];}_0x1271ef[_0xddeb('0x1d')](_0x59b661)[_0xddeb('0x26')](_0x4b9774);};}exports[_0xddeb('0x27')]=function(_0x20da84,_0x2ab70a){var _0xb55d9d={},_0x2a948f={},_0x35ab38={'count':0x0,'rows':[]};var _0x543122=_[_0xddeb('0x28')](db[_0xddeb('0x29')][_0xddeb('0x2a')],function(_0x22f145){return{'name':_0x22f145[_0xddeb('0x2b')],'type':_0x22f145[_0xddeb('0x2c')][_0xddeb('0x2d')]};});_0x2a948f[_0xddeb('0x2e')]=_[_0xddeb('0x2f')](_['map'](_0x543122,_0xddeb('0x25')),['format']);_0x2a948f[_0xddeb('0x30')]=_[_0xddeb('0x31')](_0x20da84[_0xddeb('0x30')]);_0x2a948f[_0xddeb('0x32')]=_[_0xddeb('0x33')](_0x2a948f[_0xddeb('0x2e')],_0x2a948f[_0xddeb('0x30')]);_0xb55d9d[_0xddeb('0x34')]=_['intersection'](_0x2a948f['model'],qs[_0xddeb('0x35')](_0x20da84[_0xddeb('0x30')][_0xddeb('0x35')]));_0xb55d9d[_0xddeb('0x34')]=_0xb55d9d[_0xddeb('0x34')]['length']?_0xb55d9d['attributes']:_0x2a948f[_0xddeb('0x2e')];if(!_0x20da84['query'][_0xddeb('0x36')]('nolimit')){_0xb55d9d[_0xddeb('0x1c')]=qs[_0xddeb('0x1c')](_0x20da84[_0xddeb('0x30')]['limit']);_0xb55d9d['offset']=qs[_0xddeb('0x19')](_0x20da84[_0xddeb('0x30')]['offset']);}_0xb55d9d[_0xddeb('0x37')]=qs[_0xddeb('0x38')](_0x20da84[_0xddeb('0x30')][_0xddeb('0x38')]);_0xb55d9d[_0xddeb('0x39')]=qs['filters'](_[_0xddeb('0x3a')](_0x20da84[_0xddeb('0x30')],_0x2a948f[_0xddeb('0x32')]),_0x543122);if(_0x20da84[_0xddeb('0x30')][_0xddeb('0x3b')]){_0xb55d9d[_0xddeb('0x39')]=_[_0xddeb('0x3c')](_0xb55d9d[_0xddeb('0x39')],{'$or':_[_0xddeb('0x28')](_0x543122,function(_0x1871ed){if(_0x1871ed[_0xddeb('0x2c')]!==_0xddeb('0x3d')){var _0x46fe09={};_0x46fe09[_0x1871ed[_0xddeb('0x25')]]={'$like':'%'+_0x20da84[_0xddeb('0x30')]['filter']+'%'};return _0x46fe09;}})});}_0xb55d9d=_['merge']({},_0xb55d9d,_0x20da84[_0xddeb('0x3e')]);var _0x53b421={'where':_0xb55d9d[_0xddeb('0x39')]};return db[_0xddeb('0x29')]['count'](_0x53b421)[_0xddeb('0x23')](function(_0x5b0076){_0x35ab38['count']=_0x5b0076;if(_0x20da84[_0xddeb('0x30')][_0xddeb('0x3f')]){_0xb55d9d['include']=[{'all':!![]}];}return db[_0xddeb('0x29')][_0xddeb('0x40')](_0xb55d9d);})[_0xddeb('0x23')](function(_0xb4217){_0x35ab38[_0xddeb('0x41')]=_0xb4217;return _0x35ab38;})[_0xddeb('0x23')](respondWithFilteredResult(_0x2ab70a,_0xb55d9d))[_0xddeb('0x42')](handleError(_0x2ab70a,null));};exports[_0xddeb('0x43')]=function(_0x4e8e57,_0x2c90d6){var _0x2f2999={'raw':![],'where':{'id':_0x4e8e57[_0xddeb('0x44')]['id']}},_0x525807={};_0x525807['model']=_[_0xddeb('0x31')](db[_0xddeb('0x29')][_0xddeb('0x2a')]);_0x525807['query']=_[_0xddeb('0x31')](_0x4e8e57['query']);_0x525807[_0xddeb('0x32')]=_[_0xddeb('0x33')](_0x525807['model'],_0x525807['query']);_0x2f2999[_0xddeb('0x34')]=_[_0xddeb('0x33')](_0x525807['model'],qs[_0xddeb('0x35')](_0x4e8e57[_0xddeb('0x30')][_0xddeb('0x35')]));_0x2f2999[_0xddeb('0x34')]=_0x2f2999[_0xddeb('0x34')][_0xddeb('0x45')]?_0x2f2999['attributes']:_0x525807[_0xddeb('0x2e')];if(_0x4e8e57[_0xddeb('0x30')][_0xddeb('0x3f')]){_0x2f2999[_0xddeb('0x46')]=[{'all':!![]}];}_0x2f2999=_[_0xddeb('0x3c')]({},_0x2f2999,_0x4e8e57['options']);return db[_0xddeb('0x29')][_0xddeb('0x47')](_0x2f2999)[_0xddeb('0x23')](handleEntityNotFound(_0x2c90d6,null))[_0xddeb('0x23')](respondWithResult(_0x2c90d6,null))[_0xddeb('0x42')](handleError(_0x2c90d6,null));};exports[_0xddeb('0x48')]=function(_0x52ca1e,_0x540db7){return db[_0xddeb('0x29')][_0xddeb('0x48')](_0x52ca1e[_0xddeb('0x49')],{})[_0xddeb('0x23')](respondWithResult(_0x540db7,0xc9))[_0xddeb('0x42')](handleError(_0x540db7,null));};exports['update']=function(_0x4d4ed5,_0x2f733d){if(_0x4d4ed5[_0xddeb('0x49')]['id']){delete _0x4d4ed5[_0xddeb('0x49')]['id'];}return db[_0xddeb('0x29')][_0xddeb('0x47')]({'where':{'id':_0x4d4ed5[_0xddeb('0x44')]['id']}})[_0xddeb('0x23')](handleEntityNotFound(_0x2f733d,null))['then'](saveUpdates(_0x4d4ed5[_0xddeb('0x49')],null))[_0xddeb('0x23')](respondWithResult(_0x2f733d,null))[_0xddeb('0x42')](handleError(_0x2f733d,null));};exports['describe']=function(_0x496efb,_0x5d0dcf){return db[_0xddeb('0x29')]['describe']()[_0xddeb('0x23')](respondWithResult(_0x5d0dcf,null))[_0xddeb('0x42')](handleError(_0x5d0dcf,null));};exports[_0xddeb('0x4a')]=function(_0x5d7b09,_0x339051,_0x1ca0a5){var _0x29e7c8=require('../../components/encryptor');var _0x5f1883=![];var _0x1fb130={};if(_0x5d7b09[_0xddeb('0x30')][_0xddeb('0x2c')]&&_0x5d7b09[_0xddeb('0x30')][_0xddeb('0x2c')]===_0xddeb('0x4b')){_0x1fb130[_0xddeb('0x4b')]=_0x5d7b09[_0xddeb('0x44')]['id'];}else{_0x1fb130['id']=_0x5d7b09['params']['id'];}return db[_0xddeb('0x29')][_0xddeb('0x47')]({'where':_0x1fb130,'attributes':['id',_0xddeb('0x4c')],'raw':!![]})[_0xddeb('0x23')](handleEntityNotFound(_0x339051,null))[_0xddeb('0x23')](function(_0x22995f){if(_0x22995f){var _0x3ce9a9=_0x22995f['value'];var _0x119dd6=util[_0xddeb('0x4d')](_0xddeb('0x4e'),_0x3ce9a9);if(fs[_0xddeb('0x4f')](_0x119dd6)){_0x5f1883=!![];return _0x29e7c8[_0xddeb('0x50')](_0x119dd6,_0x3ce9a9,config[_0xddeb('0x51')][_0xddeb('0x52')])['then'](function(){return _0x22995f;});}return _0x22995f;}})[_0xddeb('0x23')](function(_0x328059){if(_0x328059){var _0x49e33e=_0x328059['value'];if(!fs[_0xddeb('0x4f')](_0x49e33e)){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x55'));}if(_0x328059[_0xddeb('0x56')]){return _0x339051['download'](_0x49e33e,_0x328059[_0xddeb('0x56')]+path['extname'](_0x49e33e),function(){if(_0x5f1883){fs[_0xddeb('0x57')](_0x49e33e);}});}else{return _0x339051['download'](_0x49e33e,function(_0x55fc07){if(_0x5f1883){fs[_0xddeb('0x57')](_0x49e33e);}});}}})[_0xddeb('0x42')](function(_0x161cff){if(_0x161cff[_0xddeb('0x58')]===_0xddeb('0x55')){_0x339051[_0xddeb('0x1d')](0x194)[_0xddeb('0x26')]('Not\x20found');}else{return handleError(_0x339051,null);}});};exports['downloads']=function(_0x4be8a1,_0x4613ac,_0x599d4f){var _0x18239c=require(_0xddeb('0x59'));var _0x322bc3=![];var _0x55d44b={'$and':[db[_0xddeb('0x5a')][_0xddeb('0x39')](db['sequelize']['fn'](_0xddeb('0x5b'),db[_0xddeb('0x5a')][_0xddeb('0x5c')](_0xddeb('0x4b'))),_0x4be8a1[_0xddeb('0x30')]['token'])]};if(_0x4be8a1[_0xddeb('0x30')][_0xddeb('0x2c')]&&_0x4be8a1[_0xddeb('0x30')][_0xddeb('0x2c')]===_0xddeb('0x4b')){_0x55d44b['$and'][_0xddeb('0x5d')]({'uniqueid':_0x4be8a1[_0xddeb('0x44')]['id']});}else{_0x55d44b[_0xddeb('0x5e')][_0xddeb('0x5d')]({'id':_0x4be8a1[_0xddeb('0x44')]['id']});}return db[_0xddeb('0x29')][_0xddeb('0x47')]({'where':_0x55d44b,'attributes':['id',_0xddeb('0x4c')],'raw':!![]})[_0xddeb('0x23')](handleEntityNotFound(_0x4613ac,null))[_0xddeb('0x23')](function(_0xe870b5){if(_0xe870b5){var _0x200d57=util['format'](_0xddeb('0x4e'),_0xe870b5[_0xddeb('0x4c')]);if(fs[_0xddeb('0x4f')](_0x200d57)){_0x322bc3=!![];return _0x18239c['decryptFile'](_0x200d57,_0xe870b5['value'],config[_0xddeb('0x51')][_0xddeb('0x52')])['then'](function(){return _0xe870b5;});}return _0xe870b5;}})[_0xddeb('0x23')](function(_0x1c1afb){if(_0x1c1afb){if(!fs[_0xddeb('0x4f')](_0x1c1afb[_0xddeb('0x4c')])){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x55'));}if(_0x1c1afb[_0xddeb('0x56')]){return _0x4613ac[_0xddeb('0x4a')](_0x1c1afb[_0xddeb('0x4c')],_0x1c1afb['filename']+path[_0xddeb('0x5f')](_0x1c1afb[_0xddeb('0x4c')]),function(){if(_0x322bc3){fs[_0xddeb('0x57')](_0x1c1afb['value']);}});}else{return _0x4613ac['download'](_0x1c1afb[_0xddeb('0x4c')],function(_0x52723c){if(_0x322bc3){fs[_0xddeb('0x57')](_0x1c1afb['value']);}});}}})[_0xddeb('0x42')](handleError(_0x4613ac,null));};exports[_0xddeb('0x24')]=function(_0x398d46,_0xdb2c9){return db['VoiceRecording'][_0xddeb('0x47')]({'where':{'id':_0x398d46['params']['id']}})[_0xddeb('0x23')](function(_0x2b682b){if(_[_0xddeb('0x60')](_0x2b682b)){throw new ReferenceError(_0xddeb('0x61'));}return _0x2b682b;})[_0xddeb('0x23')](function(_0x46acaa){var _0x52ccd4=_0x46acaa[_0xddeb('0x4c')];logger[_0xddeb('0x62')](_0xddeb('0x63'),_0x52ccd4);if(!_[_0xddeb('0x60')](_0x46acaa[_0xddeb('0x4c')])&&fs['existsSync'](_0x52ccd4)){logger[_0xddeb('0x62')](_0xddeb('0x64')+_0x52ccd4+_0xddeb('0x65'));fs['unlinkSync'](_0x52ccd4);}_0x52ccd4=_0x52ccd4+_0xddeb('0x66');if(!_[_0xddeb('0x60')](_0x46acaa['value'])&&fs[_0xddeb('0x4f')](_0x52ccd4)){logger[_0xddeb('0x62')]('File:\x20\x22'+_0x52ccd4+_0xddeb('0x65'));fs['unlinkSync'](_0x52ccd4);}return _0x46acaa;})[_0xddeb('0x23')](function(_0x5b0e54){if(!_0x5b0e54)throw new InternalError();return _0x5b0e54[_0xddeb('0x24')]();})[_0xddeb('0x23')](function(){_0xdb2c9['status'](0xcc)[_0xddeb('0x17')]();})[_0xddeb('0x42')](handleError(_0xdb2c9,null));};function getBucketslist(_0x36d715,_0x31c406,_0x4a8038){return new Promise(function(_0x32901e,_0x442897){var _0x1558b1=new AWS['S3']({'accessKeyId':_0x31c406,'secretAccessKey':_0x36d715,'region':_0x4a8038});_0x1558b1['listBuckets']({},function(_0x4e7b4f,_0x2d12e6){if(_0x4e7b4f){return _0x442897(_0x4e7b4f);}else{return _0x32901e(_0x2d12e6);}});});}function createBucket(_0x484617,_0x1c1e21,_0x327d2f,_0x2693a0){return new Promise(function(_0x5e5bc0,_0x21ec71){var _0x3ee2f9=new AWS['S3']({'accessKeyId':_0x1c1e21,'secretAccessKey':_0x484617,'region':_0x327d2f});_0x3ee2f9[_0xddeb('0x67')]({'Bucket':_0x2693a0},function(_0x162d2f,_0x4db073){if(_0x162d2f){return _0x21ec71(_0x162d2f);}else{return _0x5e5bc0(_0x4db073);}});});}function uploadFile(_0x36bf3b,_0x29dc20,_0x2ea1b2,_0x5e7c88,_0x11aa04,_0x46de67){return new Promise(function(_0x398db3,_0x16749d){var _0x2e4d6f=new AWS['S3']({'accessKeyId':_0x29dc20,'secretAccessKey':_0x36bf3b,'region':_0x2ea1b2});_0x2e4d6f[_0xddeb('0x68')]({'Bucket':_0x5e7c88,'Key':_0x11aa04,'Body':_0x46de67},function(_0x91e57,_0x30f0d1){if(_0x91e57){return _0x16749d(_0x91e57);}else{return _0x398db3(_0x30f0d1);}});});}function startTranscribe(_0xe0f243,_0x43da06,_0x34e34c,_0x460a99,_0x5a7185,_0x3b6bce){return new Promise(function(_0x23c501,_0x4b1c30){var _0x225b3c=new AWS[(_0xddeb('0x69'))]({'accessKeyId':_0x43da06,'secretAccessKey':_0xe0f243,'region':_0x34e34c});_0x225b3c[_0xddeb('0x6a')]({'TranscriptionJobName':_0x460a99,'LanguageCode':_0x5a7185,'Media':{'MediaFileUri':_0x3b6bce}},function(_0x388a49,_0x34e604){if(_0x388a49){return _0x4b1c30(_0x388a49);}else{return _0x23c501(_0x34e604);}});});}function transcribe(_0x1026ef,_0x5ad056,_0x12245d,_0x10d178,_0x18c9cf,_0x5a81da,_0x2f3baa){return new Promise(function(_0x351e91,_0x21cfcd){var _0x420d5b={};logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x6b'),_0x1026ef,_0x18c9cf));return uploadFile(_0x5ad056,_0x12245d,_0x10d178,_0x18c9cf,path[_0xddeb('0x6c')](_0x5a81da),fs[_0xddeb('0x6d')](_0x5a81da))[_0xddeb('0x23')](function(_0x11c03a){logger[_0xddeb('0x62')](util[_0xddeb('0x4d')](_0xddeb('0x6e'),_0x1026ef,_0x18c9cf,_0x11c03a[_0xddeb('0x6f')]));_0x420d5b[_0xddeb('0x70')]=_0x11c03a['Bucket'];_0x420d5b[_0xddeb('0x71')]=_0x11c03a[_0xddeb('0x6f')];logger[_0xddeb('0x62')](util[_0xddeb('0x4d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1026ef));return startTranscribe(_0x5ad056,_0x12245d,_0x10d178,uuidv4(),_0x2f3baa,_0x11c03a[_0xddeb('0x6f')]);})[_0xddeb('0x23')](function(_0x4b783e){logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x72'),_0x1026ef,_0x4b783e[_0xddeb('0x73')][_0xddeb('0x74')]));_0x420d5b[_0xddeb('0x75')]=_0x4b783e[_0xddeb('0x73')]['TranscriptionJobName'];_0x420d5b['transcribeStatus']=_0x4b783e['TranscriptionJob'][_0xddeb('0x76')];return _0x351e91(_0x420d5b);})['catch'](function(_0x5862a2){return _0x21cfcd(_0x5862a2);});});}exports[_0xddeb('0x77')]=function(_0x4269fb,_0x3c713e,_0x1039a4){var _0x3b7a40;var _0x23eaa9;var _0x5e64ee;var _0x2fae66=require(_0xddeb('0x59'));return db[_0xddeb('0x29')][_0xddeb('0x78')]({'where':{'id':_0x4269fb[_0xddeb('0x44')]['id']}})[_0xddeb('0x23')](function(_0x565d6c){if(_0x565d6c){var _0x5c6e3f=util[_0xddeb('0x4d')](_0xddeb('0x4e'),_0x565d6c[_0xddeb('0x4c')]);if(fs['existsSync'](_0x5c6e3f)){cypher=!![];return _0x2fae66[_0xddeb('0x50')](_0x5c6e3f,_0x565d6c[_0xddeb('0x4c')],config[_0xddeb('0x51')][_0xddeb('0x52')])[_0xddeb('0x23')](function(){return _0x565d6c;});}return _0x565d6c;}})[_0xddeb('0x23')](function(_0x9a183b){if(!_0x9a183b){throw new db[(_0xddeb('0x53'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x23eaa9=_0x9a183b;return db[_0xddeb('0x79')][_0xddeb('0x78')]({'where':{'id':0x1}});})[_0xddeb('0x23')](handleEntityNotFound(_0x3c713e,null))[_0xddeb('0x23')](function(_0x98e701){if(_0x98e701){_0x3b7a40=_0x98e701;if(!_0x3b7a40[_0xddeb('0x7a')]||!_0x3b7a40['transcribeAccountId']||!_0x3b7a40[_0xddeb('0x7b')]||!_0x3b7a40['language']||!_0x3b7a40[_0xddeb('0x70')]){throw new db[(_0xddeb('0x53'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x4269fb[_0xddeb('0x49')][_0xddeb('0x7c')]&&(!_0x3b7a40[_0xddeb('0x7d')]||!_0x3b7a40[_0xddeb('0x7e')]||!_0x3b7a40[_0xddeb('0x7f')]||!_0x3b7a40[_0xddeb('0x80')]||!_0x3b7a40[_0xddeb('0x70')])){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xddeb('0x81')][_0xddeb('0x78')]({'where':{'id':_0x3b7a40['transcribeAccountId']}});}})[_0xddeb('0x23')](function(_0x297214){if(!_0x297214){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x297214[_0xddeb('0x82')]||!_0x297214['data2']){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x83'));}_0x5e64ee=_0x297214;return getBucketslist(_0x5e64ee['data1'],_0x5e64ee[_0xddeb('0x84')],_0x3b7a40[_0xddeb('0x7b')]);})[_0xddeb('0x23')](function(_0x4c5e97){if(_0x4c5e97&&_0x4c5e97[_0xddeb('0x85')]){var _0x106c75=_[_0xddeb('0x47')](_0x4c5e97[_0xddeb('0x85')],function(_0x2036bb){return _0x2036bb[_0xddeb('0x86')]===_0x3b7a40[_0xddeb('0x70')];});if(!_0x106c75){logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x87'),_0x4269fb['params']['id'],_0x3b7a40[_0xddeb('0x70')]));return createBucket(_0x5e64ee['data1'],_0x5e64ee['data2'],_0x3b7a40[_0xddeb('0x7b')],_0x3b7a40[_0xddeb('0x70')]);}logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x88'),_0x4269fb[_0xddeb('0x44')]['id'],_0x3b7a40['bucket']));return;}})['then'](function(_0x1fcae5){if(_0x23eaa9[_0xddeb('0x89')]===_0xddeb('0x8a')){return transcribe(_0x4269fb[_0xddeb('0x44')]['id'],_0x5e64ee[_0xddeb('0x82')],_0x5e64ee[_0xddeb('0x84')],_0x3b7a40[_0xddeb('0x7b')],_0x3b7a40['bucket'],_0x23eaa9[_0xddeb('0x4c')],_0x3b7a40[_0xddeb('0x80')]);}else{logger[_0xddeb('0x62')](util[_0xddeb('0x4d')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4269fb[_0xddeb('0x44')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x128990){if(_0x128990){_0x128990['tempSentiment']=_0x4269fb['body'][_0xddeb('0x7c')];return _0x23eaa9[_0xddeb('0x8b')](_0x128990);}})['then'](respondWithResult(_0x3c713e,null))[_0xddeb('0x42')](handleError(_0x3c713e,null));};function writeFile(_0x1c7a01,_0x4e85ea){return new Promise(function(_0x46d8f1,_0x1c6db3){fs['writeFile'](_0x4e85ea,_0x1c7a01,function(_0x45a9ac,_0x4af49e){if(_0x45a9ac){return _0x1c6db3(_0x45a9ac);}else{return _0x46d8f1(_0x4af49e);}});});}exports['downloadTranscribe']=function(_0x28dae8,_0x570d4a,_0x19ed5f){return db[_0xddeb('0x29')][_0xddeb('0x78')]({'where':{'id':_0x28dae8[_0xddeb('0x44')]['id']}})[_0xddeb('0x23')](handleEntityNotFound(_0x570d4a))[_0xddeb('0x23')](function(_0x4d3add){if(_0x4d3add&&_0x4d3add[_0xddeb('0x8c')]){var _0x3191fb=_0x4d3add[_0xddeb('0x8c')];var _0x17934c=config['root']+_0xddeb('0x8d')+_0x4d3add['id']+_0xddeb('0x8e');if(fs[_0xddeb('0x4f')](_0x17934c)){return _0x17934c;}return writeFile(_0x3191fb,_0x17934c)['then'](function(){return _0x17934c;});}else{throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x8f'));}})[_0xddeb('0x23')](function(_0xa7eb30){return _0x570d4a[_0xddeb('0x4a')](_0xa7eb30);})[_0xddeb('0x42')](handleError(_0x570d4a));}; \ No newline at end of file +var _0x41ba=['uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','download','filename','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','col','$and','push','VoiceRecording\x20not\x20found','extname','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','aws-sdk'];(function(_0x2a0c95,_0x4cb39a){var _0x37a612=function(_0x4b3f8a){while(--_0x4b3f8a){_0x2a0c95['push'](_0x2a0c95['shift']());}};_0x37a612(++_0x4cb39a);}(_0x41ba,0x118));var _0xa41b=function(_0x1775e0,_0x38a0fb){_0x1775e0=_0x1775e0-0x0;var _0x328245=_0x41ba[_0x1775e0];return _0x328245;};'use strict';var emlformat=require(_0xa41b('0x0'));var rimraf=require(_0xa41b('0x1'));var zipdir=require(_0xa41b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa41b('0x3'));var moment=require(_0xa41b('0x4'));var BPromise=require(_0xa41b('0x5'));var Mustache=require('mustache');var util=require(_0xa41b('0x6'));var path=require('path');var sox=require(_0xa41b('0x7'));var csv=require(_0xa41b('0x8'));var ejs=require(_0xa41b('0x9'));var fs=require('fs');var fs_extra=require(_0xa41b('0xa'));var _=require(_0xa41b('0xb'));var squel=require('squel');var crypto=require(_0xa41b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa41b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa41b('0xe'));var Papa=require('papaparse');var AWS=require(_0xa41b('0xf'));var uuidv4=require(_0xa41b('0x10'));var Redis=require(_0xa41b('0x11'));var authService=require(_0xa41b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa41b('0x13'));var hardwareService=require(_0xa41b('0x14'));var logger=require(_0xa41b('0x15'))(_0xa41b('0x16'));var utils=require(_0xa41b('0x17'));var config=require(_0xa41b('0x18'));var licenseUtil=require(_0xa41b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3de6ba,_0x5de1f8){_0x5de1f8=_0x5de1f8||0xcc;return function(_0x49261d){if(_0x49261d){return _0x3de6ba[_0xa41b('0x1a')](_0x5de1f8);}return _0x3de6ba['status'](_0x5de1f8)[_0xa41b('0x1b')]();};}function respondWithResult(_0x23e1e3,_0x228fa0){_0x228fa0=_0x228fa0||0xc8;return function(_0x18cc7b){if(_0x18cc7b){return _0x23e1e3[_0xa41b('0x1c')](_0x228fa0)[_0xa41b('0x1d')](_0x18cc7b);}};}function respondWithFilteredResult(_0x501f6d,_0x373d10){return function(_0x300945){if(_0x300945){var _0x3124b8=typeof _0x373d10[_0xa41b('0x1e')]===_0xa41b('0x1f')&&typeof _0x373d10[_0xa41b('0x20')]==='undefined';var _0x28d9ea=_0x300945[_0xa41b('0x21')];var _0x315665=_0x3124b8?0x0:_0x373d10[_0xa41b('0x1e')];var _0x5438bb=_0x3124b8?_0x300945[_0xa41b('0x21')]:_0x373d10['offset']+_0x373d10[_0xa41b('0x20')];var _0x2a1285;if(_0x5438bb>=_0x28d9ea){_0x5438bb=_0x28d9ea;_0x2a1285=0xc8;}else{_0x2a1285=0xce;}_0x501f6d['status'](_0x2a1285);return _0x501f6d[_0xa41b('0x22')](_0xa41b('0x23'),_0x315665+'-'+_0x5438bb+'/'+_0x28d9ea)[_0xa41b('0x1d')](_0x300945);}return null;};}function patchUpdates(_0x4325d3){return function(_0x57beb6){try{jsonpatch['apply'](_0x57beb6,_0x4325d3,!![]);}catch(_0x33a5e6){return BPromise[_0xa41b('0x24')](_0x33a5e6);}return _0x57beb6['save']();};}function saveUpdates(_0x53c23a,_0x170a84){return function(_0x21050a){if(_0x21050a){return _0x21050a[_0xa41b('0x25')](_0x53c23a)['then'](function(_0x318f01){return _0x318f01;});}return null;};}function removeEntity(_0x1e6d54,_0x2a3ee5){return function(_0x1cab81){if(_0x1cab81){return _0x1cab81[_0xa41b('0x26')]()[_0xa41b('0x27')](function(){_0x1e6d54[_0xa41b('0x1c')](0xcc)[_0xa41b('0x1b')]();});}};}function handleEntityNotFound(_0x5a05b8,_0x4d4e00){return function(_0x152254){if(!_0x152254){_0x5a05b8[_0xa41b('0x1a')](0x194);}return _0x152254;};}function handleError(_0xa8edbb,_0x2a2a86){_0x2a2a86=_0x2a2a86||0x1f4;return function(_0x4a1181){logger[_0xa41b('0x28')](_0x4a1181[_0xa41b('0x29')]);if(_0x4a1181[_0xa41b('0x2a')]){delete _0x4a1181['name'];}_0xa8edbb[_0xa41b('0x1c')](_0x2a2a86)[_0xa41b('0x2b')](_0x4a1181);};}exports['index']=function(_0x5702ed,_0x36465b){var _0x45fe4a={},_0x5cb197={},_0xec827f={'count':0x0,'rows':[]};var _0x46640a=_[_0xa41b('0x2c')](db[_0xa41b('0x2d')][_0xa41b('0x2e')],function(_0x3928f0){return{'name':_0x3928f0[_0xa41b('0x2f')],'type':_0x3928f0[_0xa41b('0x30')]['key']};});_0x5cb197[_0xa41b('0x31')]=_[_0xa41b('0x32')](_['map'](_0x46640a,_0xa41b('0x2a')),[_0xa41b('0x33')]);_0x5cb197[_0xa41b('0x34')]=_[_0xa41b('0x35')](_0x5702ed[_0xa41b('0x34')]);_0x5cb197[_0xa41b('0x36')]=_[_0xa41b('0x37')](_0x5cb197[_0xa41b('0x31')],_0x5cb197['query']);_0x45fe4a[_0xa41b('0x38')]=_[_0xa41b('0x37')](_0x5cb197[_0xa41b('0x31')],qs[_0xa41b('0x39')](_0x5702ed[_0xa41b('0x34')][_0xa41b('0x39')]));_0x45fe4a[_0xa41b('0x38')]=_0x45fe4a[_0xa41b('0x38')][_0xa41b('0x3a')]?_0x45fe4a[_0xa41b('0x38')]:_0x5cb197[_0xa41b('0x31')];if(!_0x5702ed[_0xa41b('0x34')][_0xa41b('0x3b')]('nolimit')){_0x45fe4a[_0xa41b('0x20')]=qs[_0xa41b('0x20')](_0x5702ed[_0xa41b('0x34')][_0xa41b('0x20')]);_0x45fe4a[_0xa41b('0x1e')]=qs['offset'](_0x5702ed[_0xa41b('0x34')][_0xa41b('0x1e')]);}_0x45fe4a[_0xa41b('0x3c')]=qs[_0xa41b('0x3d')](_0x5702ed[_0xa41b('0x34')]['sort']);_0x45fe4a[_0xa41b('0x3e')]=qs[_0xa41b('0x36')](_['pick'](_0x5702ed[_0xa41b('0x34')],_0x5cb197[_0xa41b('0x36')]),_0x46640a);if(_0x5702ed['query'][_0xa41b('0x3f')]){_0x45fe4a[_0xa41b('0x3e')]=_[_0xa41b('0x40')](_0x45fe4a['where'],{'$or':_['map'](_0x46640a,function(_0x116b11){if(_0x116b11['type']!=='VIRTUAL'){var _0x4b8d17={};_0x4b8d17[_0x116b11[_0xa41b('0x2a')]]={'$like':'%'+_0x5702ed[_0xa41b('0x34')][_0xa41b('0x3f')]+'%'};return _0x4b8d17;}})});}_0x45fe4a=_[_0xa41b('0x40')]({},_0x45fe4a,_0x5702ed[_0xa41b('0x41')]);var _0x24e7ad={'where':_0x45fe4a[_0xa41b('0x3e')]};return db[_0xa41b('0x2d')][_0xa41b('0x21')](_0x24e7ad)[_0xa41b('0x27')](function(_0x1c9164){_0xec827f[_0xa41b('0x21')]=_0x1c9164;if(_0x5702ed[_0xa41b('0x34')][_0xa41b('0x42')]){_0x45fe4a['include']=[{'all':!![]}];}return db[_0xa41b('0x2d')][_0xa41b('0x43')](_0x45fe4a);})[_0xa41b('0x27')](function(_0x33dbe4){_0xec827f[_0xa41b('0x44')]=_0x33dbe4;return _0xec827f;})[_0xa41b('0x27')](respondWithFilteredResult(_0x36465b,_0x45fe4a))[_0xa41b('0x45')](handleError(_0x36465b,null));};exports[_0xa41b('0x46')]=function(_0x2942e5,_0x2ed06b){var _0x5eeb2a={'raw':![],'where':{'id':_0x2942e5[_0xa41b('0x47')]['id']}},_0x1c2743={};_0x1c2743[_0xa41b('0x31')]=_[_0xa41b('0x35')](db[_0xa41b('0x2d')][_0xa41b('0x2e')]);_0x1c2743['query']=_[_0xa41b('0x35')](_0x2942e5[_0xa41b('0x34')]);_0x1c2743[_0xa41b('0x36')]=_['intersection'](_0x1c2743['model'],_0x1c2743['query']);_0x5eeb2a[_0xa41b('0x38')]=_[_0xa41b('0x37')](_0x1c2743[_0xa41b('0x31')],qs[_0xa41b('0x39')](_0x2942e5[_0xa41b('0x34')][_0xa41b('0x39')]));_0x5eeb2a[_0xa41b('0x38')]=_0x5eeb2a[_0xa41b('0x38')][_0xa41b('0x3a')]?_0x5eeb2a[_0xa41b('0x38')]:_0x1c2743[_0xa41b('0x31')];if(_0x2942e5[_0xa41b('0x34')][_0xa41b('0x42')]){_0x5eeb2a[_0xa41b('0x48')]=[{'all':!![]}];}_0x5eeb2a=_[_0xa41b('0x40')]({},_0x5eeb2a,_0x2942e5['options']);return db['VoiceRecording'][_0xa41b('0x49')](_0x5eeb2a)[_0xa41b('0x27')](handleEntityNotFound(_0x2ed06b,null))[_0xa41b('0x27')](respondWithResult(_0x2ed06b,null))[_0xa41b('0x45')](handleError(_0x2ed06b,null));};exports[_0xa41b('0x4a')]=function(_0x1ba4e5,_0x197f4d){return db[_0xa41b('0x2d')][_0xa41b('0x4a')](_0x1ba4e5['body'],{})[_0xa41b('0x27')](respondWithResult(_0x197f4d,0xc9))[_0xa41b('0x45')](handleError(_0x197f4d,null));};exports[_0xa41b('0x25')]=function(_0x30503f,_0x2f6abb){if(_0x30503f[_0xa41b('0x4b')]['id']){delete _0x30503f[_0xa41b('0x4b')]['id'];}return db['VoiceRecording'][_0xa41b('0x49')]({'where':{'id':_0x30503f[_0xa41b('0x47')]['id']}})[_0xa41b('0x27')](handleEntityNotFound(_0x2f6abb,null))[_0xa41b('0x27')](saveUpdates(_0x30503f[_0xa41b('0x4b')],null))[_0xa41b('0x27')](respondWithResult(_0x2f6abb,null))[_0xa41b('0x45')](handleError(_0x2f6abb,null));};exports[_0xa41b('0x4c')]=function(_0x4d6486,_0x11bb72){return db['VoiceRecording'][_0xa41b('0x4c')]()['then'](respondWithResult(_0x11bb72,null))[_0xa41b('0x45')](handleError(_0x11bb72,null));};exports['download']=function(_0x39eca2,_0x34217c,_0xc2042c){var _0x40b475=require('../../components/encryptor');var _0x3e932f=![];var _0x32133f={};if(_0x39eca2[_0xa41b('0x34')][_0xa41b('0x30')]&&_0x39eca2[_0xa41b('0x34')]['type']==='uniqueid'){_0x32133f[_0xa41b('0x4d')]=_0x39eca2[_0xa41b('0x47')]['id'];}else{_0x32133f['id']=_0x39eca2[_0xa41b('0x47')]['id'];}return db['VoiceRecording']['find']({'where':_0x32133f,'attributes':['id',_0xa41b('0x4e')],'raw':!![]})[_0xa41b('0x27')](handleEntityNotFound(_0x34217c,null))['then'](function(_0x58e218){if(_0x58e218){var _0x25e727=_0x58e218['value'];var _0x2f254e=util[_0xa41b('0x33')](_0xa41b('0x4f'),_0x25e727);if(fs[_0xa41b('0x50')](_0x2f254e)){_0x3e932f=!![];return _0x40b475[_0xa41b('0x51')](_0x2f254e,_0x25e727,config[_0xa41b('0x52')]['recording'])[_0xa41b('0x27')](function(){return _0x58e218;});}return _0x58e218;}})[_0xa41b('0x27')](function(_0x2d4b83){if(_0x2d4b83){var _0x3e1f7c=_0x2d4b83['value'];if(!fs[_0xa41b('0x50')](_0x3e1f7c)){throw new db[(_0xa41b('0x53'))][(_0xa41b('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x2d4b83['filename']){return _0x34217c[_0xa41b('0x55')](_0x3e1f7c,_0x2d4b83[_0xa41b('0x56')]+path['extname'](_0x3e1f7c),function(){if(_0x3e932f){fs[_0xa41b('0x57')](_0x3e1f7c);}});}else{return _0x34217c['download'](_0x3e1f7c,function(_0x46198d){if(_0x3e932f){fs[_0xa41b('0x57')](_0x3e1f7c);}});}}})[_0xa41b('0x45')](function(_0x42f57c){if(_0x42f57c[_0xa41b('0x58')]==='VoiceRecording\x20not\x20found'){_0x34217c[_0xa41b('0x1c')](0x194)[_0xa41b('0x2b')](_0xa41b('0x59'));}else{return handleError(_0x34217c,null);}});};exports[_0xa41b('0x5a')]=function(_0x2daffe,_0x500b54,_0x564e4a){var _0x1cfd05=require(_0xa41b('0x5b'));var _0x59b0c5=![];var _0x12eb97={'$and':[db[_0xa41b('0x5c')]['where'](db[_0xa41b('0x5c')]['fn']('MD5',db['sequelize'][_0xa41b('0x5d')]('uniqueid')),_0x2daffe['query']['token'])]};if(_0x2daffe[_0xa41b('0x34')][_0xa41b('0x30')]&&_0x2daffe[_0xa41b('0x34')][_0xa41b('0x30')]===_0xa41b('0x4d')){_0x12eb97[_0xa41b('0x5e')]['push']({'uniqueid':_0x2daffe['params']['id']});}else{_0x12eb97[_0xa41b('0x5e')][_0xa41b('0x5f')]({'id':_0x2daffe[_0xa41b('0x47')]['id']});}return db['VoiceRecording']['find']({'where':_0x12eb97,'attributes':['id',_0xa41b('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x500b54,null))['then'](function(_0x200c10){if(_0x200c10){var _0x498e50=util['format']('%s.cypher',_0x200c10['value']);if(fs['existsSync'](_0x498e50)){_0x59b0c5=!![];return _0x1cfd05[_0xa41b('0x51')](_0x498e50,_0x200c10[_0xa41b('0x4e')],config[_0xa41b('0x52')]['recording'])[_0xa41b('0x27')](function(){return _0x200c10;});}return _0x200c10;}})['then'](function(_0x660c0a){if(_0x660c0a){if(!fs['existsSync'](_0x660c0a[_0xa41b('0x4e')])){throw new db[(_0xa41b('0x53'))][(_0xa41b('0x54'))](_0xa41b('0x60'));}if(_0x660c0a[_0xa41b('0x56')]){return _0x500b54[_0xa41b('0x55')](_0x660c0a[_0xa41b('0x4e')],_0x660c0a[_0xa41b('0x56')]+path[_0xa41b('0x61')](_0x660c0a[_0xa41b('0x4e')]),function(){if(_0x59b0c5){fs[_0xa41b('0x57')](_0x660c0a['value']);}});}else{return _0x500b54[_0xa41b('0x55')](_0x660c0a[_0xa41b('0x4e')],function(_0x3fa7b4){if(_0x59b0c5){fs['unlink'](_0x660c0a[_0xa41b('0x4e')]);}});}}})['catch'](handleError(_0x500b54,null));};exports['destroy']=function(_0x46960e,_0x56e55c){return db['VoiceRecording'][_0xa41b('0x49')]({'where':{'id':_0x46960e[_0xa41b('0x47')]['id']}})[_0xa41b('0x27')](function(_0x2b385e){if(_[_0xa41b('0x62')](_0x2b385e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2b385e;})[_0xa41b('0x27')](function(_0x62899c){var _0x175e49=_0x62899c['value'];logger['info'](_0xa41b('0x63'),_0x175e49);if(!_[_0xa41b('0x62')](_0x62899c['value'])&&fs[_0xa41b('0x50')](_0x175e49)){logger[_0xa41b('0x64')](_0xa41b('0x65')+_0x175e49+_0xa41b('0x66'));fs['unlinkSync'](_0x175e49);}_0x175e49=_0x175e49+_0xa41b('0x67');if(!_[_0xa41b('0x62')](_0x62899c['value'])&&fs[_0xa41b('0x50')](_0x175e49)){logger[_0xa41b('0x64')](_0xa41b('0x65')+_0x175e49+_0xa41b('0x66'));fs['unlinkSync'](_0x175e49);}return _0x62899c;})['then'](function(_0x48c870){if(!_0x48c870)throw new InternalError();return _0x48c870['destroy']();})[_0xa41b('0x27')](function(){_0x56e55c[_0xa41b('0x1c')](0xcc)[_0xa41b('0x1b')]();})[_0xa41b('0x45')](handleError(_0x56e55c,null));};function getBucketslist(_0x2cbf73,_0x1444a7,_0x6e1820){return new Promise(function(_0x3b4e13,_0x474b3e){var _0x45e71e=new AWS['S3']({'accessKeyId':_0x1444a7,'secretAccessKey':_0x2cbf73,'region':_0x6e1820});_0x45e71e[_0xa41b('0x68')]({},function(_0x1357ef,_0x2302e8){if(_0x1357ef){return _0x474b3e(_0x1357ef);}else{return _0x3b4e13(_0x2302e8);}});});}function createBucket(_0x135c6e,_0x271031,_0x13627a,_0x2ddcce){return new Promise(function(_0x5dd069,_0x5c4c9a){var _0x53c9a7=new AWS['S3']({'accessKeyId':_0x271031,'secretAccessKey':_0x135c6e,'region':_0x13627a});_0x53c9a7['createBucket']({'Bucket':_0x2ddcce},function(_0x295fb4,_0x2a2233){if(_0x295fb4){return _0x5c4c9a(_0x295fb4);}else{return _0x5dd069(_0x2a2233);}});});}function uploadFile(_0x204143,_0x5f3e99,_0x2cc50d,_0x271308,_0x41faf2,_0x468931){return new Promise(function(_0x5af568,_0x469769){var _0x2af4d6=new AWS['S3']({'accessKeyId':_0x5f3e99,'secretAccessKey':_0x204143,'region':_0x2cc50d});_0x2af4d6[_0xa41b('0x69')]({'Bucket':_0x271308,'Key':_0x41faf2,'Body':_0x468931},function(_0x3be420,_0x24de79){if(_0x3be420){return _0x469769(_0x3be420);}else{return _0x5af568(_0x24de79);}});});}function startTranscribe(_0x467b15,_0x8b4ea4,_0x1ff0d1,_0x21b18a,_0x5c3faa,_0x2dbf65){return new Promise(function(_0x22dcde,_0x3e60a5){var _0x42a5e5=new AWS[(_0xa41b('0x6a'))]({'accessKeyId':_0x8b4ea4,'secretAccessKey':_0x467b15,'region':_0x1ff0d1});_0x42a5e5[_0xa41b('0x6b')]({'TranscriptionJobName':_0x21b18a,'LanguageCode':_0x5c3faa,'Media':{'MediaFileUri':_0x2dbf65}},function(_0x26ae46,_0x18be1b){if(_0x26ae46){return _0x3e60a5(_0x26ae46);}else{return _0x22dcde(_0x18be1b);}});});}function transcribe(_0x3945bb,_0x5bf4a7,_0x39bddb,_0x51d610,_0xe4dca6,_0x389558,_0x1449d8){return new Promise(function(_0x273b64,_0x2bf277){var _0xd2c65b={};logger[_0xa41b('0x64')](util[_0xa41b('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3945bb,_0xe4dca6));return uploadFile(_0x5bf4a7,_0x39bddb,_0x51d610,_0xe4dca6,path[_0xa41b('0x6c')](_0x389558),fs[_0xa41b('0x6d')](_0x389558))[_0xa41b('0x27')](function(_0x2c10a9){logger[_0xa41b('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x3945bb,_0xe4dca6,_0x2c10a9['Location']));_0xd2c65b[_0xa41b('0x6e')]=_0x2c10a9['Bucket'];_0xd2c65b[_0xa41b('0x6f')]=_0x2c10a9[_0xa41b('0x70')];logger[_0xa41b('0x64')](util[_0xa41b('0x33')](_0xa41b('0x71'),_0x3945bb));return startTranscribe(_0x5bf4a7,_0x39bddb,_0x51d610,uuidv4(),_0x1449d8,_0x2c10a9[_0xa41b('0x70')]);})[_0xa41b('0x27')](function(_0x2b9b4d){logger[_0xa41b('0x64')](util[_0xa41b('0x33')](_0xa41b('0x72'),_0x3945bb,_0x2b9b4d['TranscriptionJob'][_0xa41b('0x73')]));_0xd2c65b[_0xa41b('0x74')]=_0x2b9b4d[_0xa41b('0x75')][_0xa41b('0x73')];_0xd2c65b['transcribeStatus']=_0x2b9b4d[_0xa41b('0x75')]['TranscriptionJobStatus'];return _0x273b64(_0xd2c65b);})[_0xa41b('0x45')](function(_0x5b4bb6){return _0x2bf277(_0x5b4bb6);});});}exports[_0xa41b('0x76')]=function(_0x202838,_0x5e5865,_0x418a30){var _0x36244c;var _0x4a094e;var _0x510e7e;var _0x15a470=require(_0xa41b('0x5b'));return db[_0xa41b('0x2d')]['findOne']({'where':{'id':_0x202838[_0xa41b('0x47')]['id']}})[_0xa41b('0x27')](function(_0x5e5592){if(_0x5e5592){var _0x4c2ff4=util['format'](_0xa41b('0x4f'),_0x5e5592[_0xa41b('0x4e')]);if(fs[_0xa41b('0x50')](_0x4c2ff4)){cypher=!![];return _0x15a470[_0xa41b('0x51')](_0x4c2ff4,_0x5e5592[_0xa41b('0x4e')],config[_0xa41b('0x52')]['recording'])['then'](function(){return _0x5e5592;});}return _0x5e5592;}})[_0xa41b('0x27')](function(_0x4eb5d2){if(!_0x4eb5d2){throw new db[(_0xa41b('0x53'))][(_0xa41b('0x54'))](_0xa41b('0x77'));}_0x4a094e=_0x4eb5d2;return db[_0xa41b('0x78')]['findOne']({'where':{'id':0x1}});})[_0xa41b('0x27')](handleEntityNotFound(_0x5e5865,null))['then'](function(_0x382c41){if(_0x382c41){_0x36244c=_0x382c41;if(!_0x36244c['transcribe']||!_0x36244c[_0xa41b('0x79')]||!_0x36244c[_0xa41b('0x7a')]||!_0x36244c['language']||!_0x36244c[_0xa41b('0x6e')]){throw new db[(_0xa41b('0x53'))][(_0xa41b('0x54'))](_0xa41b('0x7b'));}if(_0x202838['body']['runSentiment']&&(!_0x36244c[_0xa41b('0x7c')]||!_0x36244c[_0xa41b('0x7d')]||!_0x36244c['sentimentRegion']||!_0x36244c[_0xa41b('0x7e')]||!_0x36244c[_0xa41b('0x6e')])){throw new db[(_0xa41b('0x53'))][(_0xa41b('0x54'))](_0xa41b('0x7f'));}return db['CloudProvider']['findOne']({'where':{'id':_0x36244c[_0xa41b('0x79')]}});}})[_0xa41b('0x27')](function(_0x116de3){if(!_0x116de3){throw new db[(_0xa41b('0x53'))]['ValidationError'](_0xa41b('0x80'));}if(!_0x116de3[_0xa41b('0x81')]||!_0x116de3['data2']){throw new db[(_0xa41b('0x53'))][(_0xa41b('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x510e7e=_0x116de3;return getBucketslist(_0x510e7e[_0xa41b('0x81')],_0x510e7e['data2'],_0x36244c['transcribeRegion']);})[_0xa41b('0x27')](function(_0x37a921){if(_0x37a921&&_0x37a921[_0xa41b('0x82')]){var _0x2875c8=_[_0xa41b('0x49')](_0x37a921[_0xa41b('0x82')],function(_0x21508a){return _0x21508a[_0xa41b('0x83')]===_0x36244c[_0xa41b('0x6e')];});if(!_0x2875c8){logger[_0xa41b('0x64')](util[_0xa41b('0x33')](_0xa41b('0x84'),_0x202838['params']['id'],_0x36244c[_0xa41b('0x6e')]));return createBucket(_0x510e7e['data1'],_0x510e7e[_0xa41b('0x85')],_0x36244c[_0xa41b('0x7a')],_0x36244c[_0xa41b('0x6e')]);}logger[_0xa41b('0x64')](util[_0xa41b('0x33')](_0xa41b('0x86'),_0x202838['params']['id'],_0x36244c[_0xa41b('0x6e')]));return;}})[_0xa41b('0x27')](function(_0x59fbab){if(_0x4a094e[_0xa41b('0x87')]==='NEW'){return transcribe(_0x202838['params']['id'],_0x510e7e['data1'],_0x510e7e[_0xa41b('0x85')],_0x36244c[_0xa41b('0x7a')],_0x36244c[_0xa41b('0x6e')],_0x4a094e['value'],_0x36244c[_0xa41b('0x7e')]);}else{logger[_0xa41b('0x64')](util[_0xa41b('0x33')](_0xa41b('0x88'),_0x202838['params']['id']));return{'transcribeStatus':_0xa41b('0x89')};}})['then'](function(_0x49e487){if(_0x49e487){_0x49e487[_0xa41b('0x8a')]=_0x202838[_0xa41b('0x4b')][_0xa41b('0x8b')];return _0x4a094e[_0xa41b('0x8c')](_0x49e487);}})[_0xa41b('0x27')](respondWithResult(_0x5e5865,null))[_0xa41b('0x45')](handleError(_0x5e5865,null));};function writeFile(_0x3c6cb4,_0x52f5f5){return new Promise(function(_0xb7ef26,_0x35df6b){fs[_0xa41b('0x8d')](_0x52f5f5,_0x3c6cb4,function(_0x50e38b,_0xa394c1){if(_0x50e38b){return _0x35df6b(_0x50e38b);}else{return _0xb7ef26(_0xa394c1);}});});}exports[_0xa41b('0x8e')]=function(_0x15f0f6,_0x5ecb17,_0x2699d3){return db[_0xa41b('0x2d')][_0xa41b('0x8f')]({'where':{'id':_0x15f0f6[_0xa41b('0x47')]['id']}})[_0xa41b('0x27')](handleEntityNotFound(_0x5ecb17))['then'](function(_0x2711bd){if(_0x2711bd&&_0x2711bd[_0xa41b('0x90')]){var _0x441bf9=_0x2711bd[_0xa41b('0x90')];var _0x529d77=config[_0xa41b('0x91')]+_0xa41b('0x92')+_0x2711bd['id']+'.txt';if(fs[_0xa41b('0x50')](_0x529d77)){return _0x529d77;}return writeFile(_0x441bf9,_0x529d77)[_0xa41b('0x27')](function(){return _0x529d77;});}else{throw new db['Sequelize'][(_0xa41b('0x54'))](_0xa41b('0x93'));}})['then'](function(_0x443f68){return _0x5ecb17['download'](_0x443f68);})[_0xa41b('0x45')](handleError(_0x5ecb17));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 26eae08..1dd2c2d 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 _0x97a2=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x1af655,_0x28b928){var _0x29da01=function(_0x508209){while(--_0x508209){_0x1af655['push'](_0x1af655['shift']());}};_0x29da01(++_0x28b928);}(_0x97a2,0x1b1));var _0x297a=function(_0x2e7de8,_0x277bf4){_0x2e7de8=_0x2e7de8-0x0;var _0x27b26f=_0x97a2[_0x2e7de8];return _0x27b26f;};'use strict';var attributes=require(_0x297a('0x0'));module['exports']=function(_0x46f976,_0x41ac57){return _0x46f976[_0x297a('0x1')](_0x297a('0x2'),attributes,{'tableName':_0x297a('0x3'),'paranoid':![],'indexes':[{'name':_0x297a('0x4'),'fields':[_0x297a('0x4')]},{'name':_0x297a('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd58c=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x9890b1,_0x36db4a){var _0x3574bb=function(_0x11cd4f){while(--_0x11cd4f){_0x9890b1['push'](_0x9890b1['shift']());}};_0x3574bb(++_0x36db4a);}(_0xd58c,0xb6));var _0xcd58=function(_0x5ebb6a,_0x4ff0e5){_0x5ebb6a=_0x5ebb6a-0x0;var _0x40e917=_0xd58c[_0x5ebb6a];return _0x40e917;};'use strict';var attributes=require(_0xcd58('0x0'));module[_0xcd58('0x1')]=function(_0x240323,_0x4dbe25){return _0x240323[_0xcd58('0x2')]('VoiceRecording',attributes,{'tableName':_0xcd58('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcd58('0x4')]},{'name':_0xcd58('0x5'),'fields':[_0xcd58('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 f75cb06..8bfa193 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 _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x0424,0x159));var _0x4042=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0x0424[_0x471448];return _0x38190b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});}; \ No newline at end of file +var _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x55555f,_0x505b88){var _0x208602=function(_0x1cbc63){while(--_0x1cbc63){_0x55555f['push'](_0x55555f['shift']());}};_0x208602(++_0x505b88);}(_0x0424,0x159));var _0x4042=function(_0x5db59c,_0x11cc79){_0x5db59c=_0x5db59c-0x0;var _0x2a1f41=_0x0424[_0x5db59c];return _0x2a1f41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c83bafd..7ad5d69 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 _0x685e=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x46c26f,_0x27eb55){var _0x35031e=function(_0x5877c1){while(--_0x5877c1){_0x46c26f['push'](_0x46c26f['shift']());}};_0x35031e(++_0x27eb55);}(_0x685e,0x101));var _0xe685=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x685e[_0x47a349];return _0x18ab75;};'use strict';var multer=require('multer');var util=require(_0xe685('0x0'));var path=require(_0xe685('0x1'));var timeout=require(_0xe685('0x2'));var express=require('express');var router=express[_0xe685('0x3')]();var fs_extra=require(_0xe685('0x4'));var auth=require(_0xe685('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe685('0x6'));var controller=require(_0xe685('0x7'));router[_0xe685('0x8')]('/',auth['isAuthenticated'](),controller[_0xe685('0x9')]);router[_0xe685('0x8')](_0xe685('0xa'),auth[_0xe685('0xb')](),controller[_0xe685('0xc')]);router['get'](_0xe685('0xd'),auth[_0xe685('0xb')](),controller[_0xe685('0xe')]);router[_0xe685('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe685('0x10')]('/:id',auth[_0xe685('0xb')](),controller[_0xe685('0x11')]);router[_0xe685('0x12')]('/:id',auth[_0xe685('0xb')](),controller[_0xe685('0x13')]);module[_0xe685('0x14')]=router; \ No newline at end of file +var _0xcc57=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','describe','post'];(function(_0x476d9d,_0x333228){var _0x44eede=function(_0x310f7c){while(--_0x310f7c){_0x476d9d['push'](_0x476d9d['shift']());}};_0x44eede(++_0x333228);}(_0xcc57,0xfc));var _0x7cc5=function(_0x10682c,_0x506229){_0x10682c=_0x10682c-0x0;var _0x4d42ad=_0xcc57[_0x10682c];return _0x4d42ad;};'use strict';var multer=require(_0x7cc5('0x0'));var util=require(_0x7cc5('0x1'));var path=require(_0x7cc5('0x2'));var timeout=require(_0x7cc5('0x3'));var express=require(_0x7cc5('0x4'));var router=express['Router']();var fs_extra=require(_0x7cc5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7cc5('0x6'));var config=require(_0x7cc5('0x7'));var controller=require(_0x7cc5('0x8'));router[_0x7cc5('0x9')]('/',auth['isAuthenticated'](),controller[_0x7cc5('0xa')]);router[_0x7cc5('0x9')]('/describe',auth[_0x7cc5('0xb')](),controller[_0x7cc5('0xc')]);router[_0x7cc5('0x9')]('/:id',auth[_0x7cc5('0xb')](),controller['show']);router[_0x7cc5('0xd')]('/',auth[_0x7cc5('0xb')](),controller['create']);router[_0x7cc5('0xe')](_0x7cc5('0xf'),auth[_0x7cc5('0xb')](),controller[_0x7cc5('0x10')]);router[_0x7cc5('0x11')](_0x7cc5('0xf'),auth['isAuthenticated'](),controller[_0x7cc5('0x12')]);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 4c52a83..18891bd 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 _0x1260=['moment','exports','blind','attended','STRING','ENUM','Yes','sequelize'];(function(_0x1e7517,_0x4b03c9){var _0x522f4c=function(_0x4b056b){while(--_0x4b056b){_0x1e7517['push'](_0x1e7517['shift']());}};_0x522f4c(++_0x4b03c9);}(_0x1260,0x77));var _0x0126=function(_0xb78399,_0x1a62c5){_0xb78399=_0xb78399-0x0;var _0x427483=_0x1260[_0xb78399];return _0x427483;};'use strict';var Sequelize=require(_0x0126('0x0'));var moment=require(_0x0126('0x1'));module[_0x0126('0x2')]={'type':{'type':Sequelize['ENUM'](_0x0126('0x3'),_0x0126('0x4'))},'result':{'type':Sequelize[_0x0126('0x5')]},'transfererchannel':{'type':Sequelize[_0x0126('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x0126('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x0126('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0126('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x0126('0x5')]},'transfereechannel':{'type':Sequelize[_0x0126('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x0126('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x0126('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0126('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0126('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x0126('0x5')]},'transfereecontext':{'type':Sequelize[_0x0126('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x0126('0x5')]},'isexternal':{'type':Sequelize[_0x0126('0x6')](_0x0126('0x7'),'No')},'context':{'type':Sequelize[_0x0126('0x5')]},'extension':{'type':Sequelize[_0x0126('0x5')]}}; \ No newline at end of file +var _0xe557=['ENUM','blind','STRING','Yes','moment','exports'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xe557,0x88));var _0x7e55=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe557[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7e55('0x0'));module[_0x7e55('0x1')]={'type':{'type':Sequelize[_0x7e55('0x2')](_0x7e55('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x7e55('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x7e55('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x7e55('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x7e55('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x7e55('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7e55('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x7e55('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x7e55('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7e55('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7e55('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x7e55('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7e55('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x7e55('0x4')]},'isexternal':{'type':Sequelize[_0x7e55('0x2')](_0x7e55('0x5'),'No')},'context':{'type':Sequelize[_0x7e55('0x4')]},'extension':{'type':Sequelize[_0x7e55('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b91abfd..882015a 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 _0x6bd6=['zip-dir','fast-json-patch','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','VoiceTransferReport','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf'];(function(_0x5d7886,_0x4b2d49){var _0xba0713=function(_0x23c57e){while(--_0x23c57e){_0x5d7886['push'](_0x5d7886['shift']());}};_0xba0713(++_0x4b2d49);}(_0x6bd6,0x96));var _0x66bd=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x6bd6[_0x54bac5];return _0xc15971;};'use strict';var emlformat=require(_0x66bd('0x0'));var rimraf=require(_0x66bd('0x1'));var zipdir=require(_0x66bd('0x2'));var jsonpatch=require(_0x66bd('0x3'));var rp=require('request-promise');var moment=require(_0x66bd('0x4'));var BPromise=require(_0x66bd('0x5'));var Mustache=require(_0x66bd('0x6'));var util=require(_0x66bd('0x7'));var path=require(_0x66bd('0x8'));var sox=require(_0x66bd('0x9'));var csv=require(_0x66bd('0xa'));var ejs=require(_0x66bd('0xb'));var fs=require('fs');var fs_extra=require(_0x66bd('0xc'));var _=require(_0x66bd('0xd'));var squel=require('squel');var crypto=require(_0x66bd('0xe'));var jsforce=require(_0x66bd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66bd('0x10'));var Papa=require(_0x66bd('0x11'));var Redis=require(_0x66bd('0x12'));var authService=require(_0x66bd('0x13'));var qs=require(_0x66bd('0x14'));var as=require(_0x66bd('0x15'));var hardwareService=require(_0x66bd('0x16'));var logger=require(_0x66bd('0x17'))('api');var utils=require(_0x66bd('0x18'));var config=require(_0x66bd('0x19'));var licenseUtil=require(_0x66bd('0x1a'));var db=require(_0x66bd('0x1b'))['db'];function respondWithStatusCode(_0x59b17f,_0xa9098e){_0xa9098e=_0xa9098e||0xcc;return function(_0x584836){if(_0x584836){return _0x59b17f[_0x66bd('0x1c')](_0xa9098e);}return _0x59b17f[_0x66bd('0x1d')](_0xa9098e)['end']();};}function respondWithResult(_0x2955a7,_0xdd2c9f){_0xdd2c9f=_0xdd2c9f||0xc8;return function(_0x1f29fa){if(_0x1f29fa){return _0x2955a7[_0x66bd('0x1d')](_0xdd2c9f)[_0x66bd('0x1e')](_0x1f29fa);}};}function respondWithFilteredResult(_0x3f4ad6,_0x14af3f){return function(_0x20e7cf){if(_0x20e7cf){var _0x2f52fb=typeof _0x14af3f[_0x66bd('0x1f')]===_0x66bd('0x20')&&typeof _0x14af3f['limit']==='undefined';var _0x520444=_0x20e7cf[_0x66bd('0x21')];var _0xc32d44=_0x2f52fb?0x0:_0x14af3f[_0x66bd('0x1f')];var _0x3efb75=_0x2f52fb?_0x20e7cf['count']:_0x14af3f['offset']+_0x14af3f[_0x66bd('0x22')];var _0x16de33;if(_0x3efb75>=_0x520444){_0x3efb75=_0x520444;_0x16de33=0xc8;}else{_0x16de33=0xce;}_0x3f4ad6[_0x66bd('0x1d')](_0x16de33);return _0x3f4ad6['set'](_0x66bd('0x23'),_0xc32d44+'-'+_0x3efb75+'/'+_0x520444)[_0x66bd('0x1e')](_0x20e7cf);}return null;};}function patchUpdates(_0x328b46){return function(_0x51b060){try{jsonpatch['apply'](_0x51b060,_0x328b46,!![]);}catch(_0xce57d5){return BPromise[_0x66bd('0x24')](_0xce57d5);}return _0x51b060['save']();};}function saveUpdates(_0x1955a8,_0x34b444){return function(_0xd9b36c){if(_0xd9b36c){return _0xd9b36c[_0x66bd('0x25')](_0x1955a8)['then'](function(_0x449be7){return _0x449be7;});}return null;};}function removeEntity(_0x2381d2,_0x2d44b4){return function(_0x15ec33){if(_0x15ec33){return _0x15ec33['destroy']()[_0x66bd('0x26')](function(){_0x2381d2[_0x66bd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c444a,_0x3aacdc){return function(_0x4c3f19){if(!_0x4c3f19){_0x5c444a[_0x66bd('0x1c')](0x194);}return _0x4c3f19;};}function handleError(_0x105612,_0x1a337d){_0x1a337d=_0x1a337d||0x1f4;return function(_0x6fc166){logger[_0x66bd('0x27')](_0x6fc166[_0x66bd('0x28')]);if(_0x6fc166['name']){delete _0x6fc166['name'];}_0x105612[_0x66bd('0x1d')](_0x1a337d)[_0x66bd('0x29')](_0x6fc166);};}exports[_0x66bd('0x2a')]=function(_0x4a98cc,_0x4f80d4){var _0x362a2b={},_0x18c2e7={},_0xc02de={'count':0x0,'rows':[]};var _0x5ea340=_[_0x66bd('0x2b')](db['VoiceTransferReport'][_0x66bd('0x2c')],function(_0x527bf1){return{'name':_0x527bf1[_0x66bd('0x2d')],'type':_0x527bf1[_0x66bd('0x2e')][_0x66bd('0x2f')]};});_0x18c2e7[_0x66bd('0x30')]=_['map'](_0x5ea340,'name');_0x18c2e7[_0x66bd('0x31')]=_[_0x66bd('0x32')](_0x4a98cc['query']);_0x18c2e7[_0x66bd('0x33')]=_[_0x66bd('0x34')](_0x18c2e7[_0x66bd('0x30')],_0x18c2e7['query']);_0x362a2b[_0x66bd('0x35')]=_['intersection'](_0x18c2e7['model'],qs[_0x66bd('0x36')](_0x4a98cc['query'][_0x66bd('0x36')]));_0x362a2b[_0x66bd('0x35')]=_0x362a2b[_0x66bd('0x35')][_0x66bd('0x37')]?_0x362a2b[_0x66bd('0x35')]:_0x18c2e7['model'];if(!_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x38')](_0x66bd('0x39'))){_0x362a2b[_0x66bd('0x22')]=qs['limit'](_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x22')]);_0x362a2b[_0x66bd('0x1f')]=qs['offset'](_0x4a98cc['query'][_0x66bd('0x1f')]);}_0x362a2b[_0x66bd('0x3a')]=qs['sort'](_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x3b')]);_0x362a2b[_0x66bd('0x3c')]=qs[_0x66bd('0x33')](_[_0x66bd('0x3d')](_0x4a98cc['query'],_0x18c2e7[_0x66bd('0x33')]),_0x5ea340);if(_0x4a98cc[_0x66bd('0x31')]['filter']){_0x362a2b[_0x66bd('0x3c')]=_[_0x66bd('0x3e')](_0x362a2b[_0x66bd('0x3c')],{'$or':_['map'](_0x5ea340,function(_0x10e898){if(_0x10e898[_0x66bd('0x2e')]!=='VIRTUAL'){var _0x1084b7={};_0x1084b7[_0x10e898['name']]={'$like':'%'+_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x3f')]+'%'};return _0x1084b7;}})});}_0x362a2b=_[_0x66bd('0x3e')]({},_0x362a2b,_0x4a98cc[_0x66bd('0x40')]);var _0x527f8f={'where':_0x362a2b[_0x66bd('0x3c')]};return db[_0x66bd('0x41')][_0x66bd('0x21')](_0x527f8f)['then'](function(_0x3dce57){_0xc02de[_0x66bd('0x21')]=_0x3dce57;if(_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x42')]){_0x362a2b[_0x66bd('0x43')]=[{'all':!![]}];}return db[_0x66bd('0x41')]['findAll'](_0x362a2b);})[_0x66bd('0x26')](function(_0x36cc97){_0xc02de[_0x66bd('0x44')]=_0x36cc97;return _0xc02de;})['then'](respondWithFilteredResult(_0x4f80d4,_0x362a2b))[_0x66bd('0x45')](handleError(_0x4f80d4,null));};exports[_0x66bd('0x46')]=function(_0x1fc538,_0x4542fa){var _0x4e6df0={'raw':!![],'where':{'id':_0x1fc538[_0x66bd('0x47')]['id']}},_0x8201fe={};_0x8201fe['model']=_[_0x66bd('0x32')](db[_0x66bd('0x41')][_0x66bd('0x2c')]);_0x8201fe[_0x66bd('0x31')]=_['keys'](_0x1fc538[_0x66bd('0x31')]);_0x8201fe[_0x66bd('0x33')]=_[_0x66bd('0x34')](_0x8201fe[_0x66bd('0x30')],_0x8201fe[_0x66bd('0x31')]);_0x4e6df0[_0x66bd('0x35')]=_[_0x66bd('0x34')](_0x8201fe[_0x66bd('0x30')],qs[_0x66bd('0x36')](_0x1fc538[_0x66bd('0x31')][_0x66bd('0x36')]));_0x4e6df0['attributes']=_0x4e6df0[_0x66bd('0x35')][_0x66bd('0x37')]?_0x4e6df0[_0x66bd('0x35')]:_0x8201fe[_0x66bd('0x30')];if(_0x1fc538[_0x66bd('0x31')][_0x66bd('0x42')]){_0x4e6df0[_0x66bd('0x43')]=[{'all':!![]}];}_0x4e6df0=_[_0x66bd('0x3e')]({},_0x4e6df0,_0x1fc538[_0x66bd('0x40')]);return db[_0x66bd('0x41')][_0x66bd('0x48')](_0x4e6df0)[_0x66bd('0x26')](handleEntityNotFound(_0x4542fa,null))[_0x66bd('0x26')](respondWithResult(_0x4542fa,null))[_0x66bd('0x45')](handleError(_0x4542fa,null));};exports[_0x66bd('0x49')]=function(_0x1d7fcd,_0x24f8e5){return db['VoiceTransferReport']['create'](_0x1d7fcd[_0x66bd('0x4a')],{})[_0x66bd('0x26')](respondWithResult(_0x24f8e5,0xc9))[_0x66bd('0x45')](handleError(_0x24f8e5,null));};exports[_0x66bd('0x25')]=function(_0x33bbdf,_0x4d069e){if(_0x33bbdf[_0x66bd('0x4a')]['id']){delete _0x33bbdf[_0x66bd('0x4a')]['id'];}return db[_0x66bd('0x41')][_0x66bd('0x48')]({'where':{'id':_0x33bbdf[_0x66bd('0x47')]['id']}})[_0x66bd('0x26')](handleEntityNotFound(_0x4d069e,null))['then'](saveUpdates(_0x33bbdf['body'],null))[_0x66bd('0x26')](respondWithResult(_0x4d069e,null))['catch'](handleError(_0x4d069e,null));};exports['destroy']=function(_0x4b2a3d,_0x12c629){return db[_0x66bd('0x41')][_0x66bd('0x48')]({'where':{'id':_0x4b2a3d[_0x66bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x12c629,null))[_0x66bd('0x26')](removeEntity(_0x12c629,null))[_0x66bd('0x45')](handleError(_0x12c629,null));};exports[_0x66bd('0x4b')]=function(_0x599c30,_0x45d826){return db[_0x66bd('0x41')][_0x66bd('0x4b')]()[_0x66bd('0x26')](respondWithResult(_0x45d826,null))[_0x66bd('0x45')](handleError(_0x45d826,null));}; \ No newline at end of file +var _0xc2bf=['fields','options','find','create','body','update','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','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','end','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','includeAll','include','findAll','catch','show','params'];(function(_0x20e667,_0x199109){var _0x14086d=function(_0x321b57){while(--_0x321b57){_0x20e667['push'](_0x20e667['shift']());}};_0x14086d(++_0x199109);}(_0xc2bf,0x154));var _0xfc2b=function(_0x586ebd,_0xd1da2f){_0x586ebd=_0x586ebd-0x0;var _0x5bf2ab=_0xc2bf[_0x586ebd];return _0x5bf2ab;};'use strict';var emlformat=require(_0xfc2b('0x0'));var rimraf=require(_0xfc2b('0x1'));var zipdir=require(_0xfc2b('0x2'));var jsonpatch=require(_0xfc2b('0x3'));var rp=require(_0xfc2b('0x4'));var moment=require(_0xfc2b('0x5'));var BPromise=require(_0xfc2b('0x6'));var Mustache=require(_0xfc2b('0x7'));var util=require(_0xfc2b('0x8'));var path=require(_0xfc2b('0x9'));var sox=require(_0xfc2b('0xa'));var csv=require(_0xfc2b('0xb'));var ejs=require(_0xfc2b('0xc'));var fs=require('fs');var fs_extra=require(_0xfc2b('0xd'));var _=require(_0xfc2b('0xe'));var squel=require(_0xfc2b('0xf'));var crypto=require(_0xfc2b('0x10'));var jsforce=require(_0xfc2b('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfc2b('0xb'));var querystring=require(_0xfc2b('0x12'));var Papa=require(_0xfc2b('0x13'));var Redis=require(_0xfc2b('0x14'));var authService=require(_0xfc2b('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc2b('0x16'))(_0xfc2b('0x17'));var utils=require(_0xfc2b('0x18'));var config=require(_0xfc2b('0x19'));var licenseUtil=require(_0xfc2b('0x1a'));var db=require(_0xfc2b('0x1b'))['db'];function respondWithStatusCode(_0x5c00cb,_0x2e1049){_0x2e1049=_0x2e1049||0xcc;return function(_0x1b62bf){if(_0x1b62bf){return _0x5c00cb[_0xfc2b('0x1c')](_0x2e1049);}return _0x5c00cb[_0xfc2b('0x1d')](_0x2e1049)['end']();};}function respondWithResult(_0x2efff8,_0x445021){_0x445021=_0x445021||0xc8;return function(_0x4d0d35){if(_0x4d0d35){return _0x2efff8[_0xfc2b('0x1d')](_0x445021)['json'](_0x4d0d35);}};}function respondWithFilteredResult(_0x4138e0,_0x5e2140){return function(_0x1bfecf){if(_0x1bfecf){var _0x4bd1b0=typeof _0x5e2140[_0xfc2b('0x1e')]===_0xfc2b('0x1f')&&typeof _0x5e2140['limit']===_0xfc2b('0x1f');var _0x5931b5=_0x1bfecf[_0xfc2b('0x20')];var _0x29e553=_0x4bd1b0?0x0:_0x5e2140[_0xfc2b('0x1e')];var _0x3385e6=_0x4bd1b0?_0x1bfecf[_0xfc2b('0x20')]:_0x5e2140[_0xfc2b('0x1e')]+_0x5e2140[_0xfc2b('0x21')];var _0x11f310;if(_0x3385e6>=_0x5931b5){_0x3385e6=_0x5931b5;_0x11f310=0xc8;}else{_0x11f310=0xce;}_0x4138e0[_0xfc2b('0x1d')](_0x11f310);return _0x4138e0[_0xfc2b('0x22')](_0xfc2b('0x23'),_0x29e553+'-'+_0x3385e6+'/'+_0x5931b5)[_0xfc2b('0x24')](_0x1bfecf);}return null;};}function patchUpdates(_0x56f191){return function(_0x460745){try{jsonpatch[_0xfc2b('0x25')](_0x460745,_0x56f191,!![]);}catch(_0xa9b33a){return BPromise[_0xfc2b('0x26')](_0xa9b33a);}return _0x460745[_0xfc2b('0x27')]();};}function saveUpdates(_0x517563,_0xe84c7f){return function(_0x280699){if(_0x280699){return _0x280699['update'](_0x517563)[_0xfc2b('0x28')](function(_0x1e80d4){return _0x1e80d4;});}return null;};}function removeEntity(_0x568f53,_0x34020c){return function(_0x594855){if(_0x594855){return _0x594855['destroy']()[_0xfc2b('0x28')](function(){_0x568f53['status'](0xcc)[_0xfc2b('0x29')]();});}};}function handleEntityNotFound(_0x48dea4,_0x6b441e){return function(_0x45a155){if(!_0x45a155){_0x48dea4['sendStatus'](0x194);}return _0x45a155;};}function handleError(_0x14c552,_0x41c146){_0x41c146=_0x41c146||0x1f4;return function(_0x176873){logger[_0xfc2b('0x2a')](_0x176873[_0xfc2b('0x2b')]);if(_0x176873[_0xfc2b('0x2c')]){delete _0x176873[_0xfc2b('0x2c')];}_0x14c552[_0xfc2b('0x1d')](_0x41c146)[_0xfc2b('0x2d')](_0x176873);};}exports[_0xfc2b('0x2e')]=function(_0x61436e,_0x8dc4f7){var _0x36fa93={},_0x4e87a7={},_0x4944d0={'count':0x0,'rows':[]};var _0x9ed437=_['map'](db[_0xfc2b('0x2f')][_0xfc2b('0x30')],function(_0x278cb5){return{'name':_0x278cb5[_0xfc2b('0x31')],'type':_0x278cb5[_0xfc2b('0x32')][_0xfc2b('0x33')]};});_0x4e87a7[_0xfc2b('0x34')]=_['map'](_0x9ed437,_0xfc2b('0x2c'));_0x4e87a7[_0xfc2b('0x35')]=_[_0xfc2b('0x36')](_0x61436e[_0xfc2b('0x35')]);_0x4e87a7[_0xfc2b('0x37')]=_[_0xfc2b('0x38')](_0x4e87a7[_0xfc2b('0x34')],_0x4e87a7[_0xfc2b('0x35')]);_0x36fa93[_0xfc2b('0x39')]=_[_0xfc2b('0x38')](_0x4e87a7[_0xfc2b('0x34')],qs['fields'](_0x61436e[_0xfc2b('0x35')]['fields']));_0x36fa93[_0xfc2b('0x39')]=_0x36fa93[_0xfc2b('0x39')][_0xfc2b('0x3a')]?_0x36fa93[_0xfc2b('0x39')]:_0x4e87a7[_0xfc2b('0x34')];if(!_0x61436e[_0xfc2b('0x35')][_0xfc2b('0x3b')](_0xfc2b('0x3c'))){_0x36fa93['limit']=qs[_0xfc2b('0x21')](_0x61436e[_0xfc2b('0x35')]['limit']);_0x36fa93[_0xfc2b('0x1e')]=qs[_0xfc2b('0x1e')](_0x61436e[_0xfc2b('0x35')][_0xfc2b('0x1e')]);}_0x36fa93[_0xfc2b('0x3d')]=qs[_0xfc2b('0x3e')](_0x61436e['query'][_0xfc2b('0x3e')]);_0x36fa93['where']=qs[_0xfc2b('0x37')](_[_0xfc2b('0x3f')](_0x61436e[_0xfc2b('0x35')],_0x4e87a7['filters']),_0x9ed437);if(_0x61436e[_0xfc2b('0x35')][_0xfc2b('0x40')]){_0x36fa93[_0xfc2b('0x41')]=_['merge'](_0x36fa93[_0xfc2b('0x41')],{'$or':_[_0xfc2b('0x42')](_0x9ed437,function(_0x1bf258){if(_0x1bf258[_0xfc2b('0x32')]!==_0xfc2b('0x43')){var _0x1dfd94={};_0x1dfd94[_0x1bf258[_0xfc2b('0x2c')]]={'$like':'%'+_0x61436e[_0xfc2b('0x35')]['filter']+'%'};return _0x1dfd94;}})});}_0x36fa93=_[_0xfc2b('0x44')]({},_0x36fa93,_0x61436e['options']);var _0x53a218={'where':_0x36fa93[_0xfc2b('0x41')]};return db['VoiceTransferReport'][_0xfc2b('0x20')](_0x53a218)[_0xfc2b('0x28')](function(_0x371c9b){_0x4944d0[_0xfc2b('0x20')]=_0x371c9b;if(_0x61436e[_0xfc2b('0x35')][_0xfc2b('0x45')]){_0x36fa93[_0xfc2b('0x46')]=[{'all':!![]}];}return db[_0xfc2b('0x2f')][_0xfc2b('0x47')](_0x36fa93);})['then'](function(_0x40008f){_0x4944d0['rows']=_0x40008f;return _0x4944d0;})['then'](respondWithFilteredResult(_0x8dc4f7,_0x36fa93))[_0xfc2b('0x48')](handleError(_0x8dc4f7,null));};exports[_0xfc2b('0x49')]=function(_0x47b599,_0x294bd3){var _0x1836af={'raw':!![],'where':{'id':_0x47b599[_0xfc2b('0x4a')]['id']}},_0x509c04={};_0x509c04['model']=_[_0xfc2b('0x36')](db[_0xfc2b('0x2f')][_0xfc2b('0x30')]);_0x509c04[_0xfc2b('0x35')]=_['keys'](_0x47b599[_0xfc2b('0x35')]);_0x509c04[_0xfc2b('0x37')]=_[_0xfc2b('0x38')](_0x509c04[_0xfc2b('0x34')],_0x509c04['query']);_0x1836af[_0xfc2b('0x39')]=_[_0xfc2b('0x38')](_0x509c04[_0xfc2b('0x34')],qs[_0xfc2b('0x4b')](_0x47b599[_0xfc2b('0x35')][_0xfc2b('0x4b')]));_0x1836af[_0xfc2b('0x39')]=_0x1836af['attributes'][_0xfc2b('0x3a')]?_0x1836af['attributes']:_0x509c04['model'];if(_0x47b599[_0xfc2b('0x35')][_0xfc2b('0x45')]){_0x1836af[_0xfc2b('0x46')]=[{'all':!![]}];}_0x1836af=_[_0xfc2b('0x44')]({},_0x1836af,_0x47b599[_0xfc2b('0x4c')]);return db[_0xfc2b('0x2f')][_0xfc2b('0x4d')](_0x1836af)[_0xfc2b('0x28')](handleEntityNotFound(_0x294bd3,null))[_0xfc2b('0x28')](respondWithResult(_0x294bd3,null))['catch'](handleError(_0x294bd3,null));};exports[_0xfc2b('0x4e')]=function(_0x323319,_0x2e5eea){return db[_0xfc2b('0x2f')][_0xfc2b('0x4e')](_0x323319[_0xfc2b('0x4f')],{})[_0xfc2b('0x28')](respondWithResult(_0x2e5eea,0xc9))['catch'](handleError(_0x2e5eea,null));};exports[_0xfc2b('0x50')]=function(_0x2e739e,_0x1832f1){if(_0x2e739e['body']['id']){delete _0x2e739e[_0xfc2b('0x4f')]['id'];}return db['VoiceTransferReport'][_0xfc2b('0x4d')]({'where':{'id':_0x2e739e[_0xfc2b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1832f1,null))[_0xfc2b('0x28')](saveUpdates(_0x2e739e[_0xfc2b('0x4f')],null))[_0xfc2b('0x28')](respondWithResult(_0x1832f1,null))[_0xfc2b('0x48')](handleError(_0x1832f1,null));};exports[_0xfc2b('0x51')]=function(_0x5575e5,_0x23f610){return db[_0xfc2b('0x2f')][_0xfc2b('0x4d')]({'where':{'id':_0x5575e5['params']['id']}})[_0xfc2b('0x28')](handleEntityNotFound(_0x23f610,null))[_0xfc2b('0x28')](removeEntity(_0x23f610,null))[_0xfc2b('0x48')](handleError(_0x23f610,null));};exports['describe']=function(_0x1a423a,_0x1e0288){return db['VoiceTransferReport'][_0xfc2b('0x52')]()['then'](respondWithResult(_0x1e0288,null))[_0xfc2b('0x48')](handleError(_0x1e0288,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f3819da..7f27f11 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 _0xf0ab=['api','moment','bluebird','request-promise','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util'];(function(_0x2d8ad6,_0x3a4c24){var _0x20c118=function(_0x37ea4b){while(--_0x37ea4b){_0x2d8ad6['push'](_0x2d8ad6['shift']());}};_0x20c118(++_0x3a4c24);}(_0xf0ab,0xd1));var _0xbf0a=function(_0x3482df,_0x400676){_0x3482df=_0x3482df-0x0;var _0x4ff418=_0xf0ab[_0x3482df];return _0x4ff418;};'use strict';var _=require('lodash');var util=require(_0xbf0a('0x0'));var logger=require('../../config/logger')(_0xbf0a('0x1'));var moment=require(_0xbf0a('0x2'));var BPromise=require(_0xbf0a('0x3'));var rp=require(_0xbf0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf0a('0x5'));module[_0xbf0a('0x6')]=function(_0x461a05,_0x21e702){return _0x461a05[_0xbf0a('0x7')](_0xbf0a('0x8'),attributes,{'tableName':_0xbf0a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8664=['exports','VoiceTransferReport','report_call_transfer','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13c38a,_0x522286){var _0x5c658a=function(_0x7ab113){while(--_0x7ab113){_0x13c38a['push'](_0x13c38a['shift']());}};_0x5c658a(++_0x522286);}(_0x8664,0x1f2));var _0x4866=function(_0x2ee852,_0x3581d6){_0x2ee852=_0x2ee852-0x0;var _0x2584d2=_0x8664[_0x2ee852];return _0x2584d2;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var logger=require('../../config/logger')(_0x4866('0x2'));var moment=require('moment');var BPromise=require(_0x4866('0x3'));var rp=require(_0x4866('0x4'));var fs=require('fs');var path=require(_0x4866('0x5'));var rimraf=require(_0x4866('0x6'));var config=require(_0x4866('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x4866('0x8')]=function(_0x4c4f8b,_0x37281d){return _0x4c4f8b['define'](_0x4866('0x9'),attributes,{'tableName':_0x4866('0xa'),'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 05ba963..3ede1c6 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 _0xcbef=['rpc','../../config/environment','jayson/promise','http','request','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','then','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x5c0923,_0x3385d9){var _0x5d71e3=function(_0x49b874){while(--_0x49b874){_0x5c0923['push'](_0x5c0923['shift']());}};_0x5d71e3(++_0x3385d9);}(_0xcbef,0x18c));var _0xfcbe=function(_0x213721,_0xc41653){_0x213721=_0x213721-0x0;var _0x6435ee=_0xcbef[_0x213721];return _0x6435ee;};'use strict';var _=require(_0xfcbe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfcbe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbe('0x2'));var db=require(_0xfcbe('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfcbe('0x4'));var config=require(_0xfcbe('0x5'));var jayson=require(_0xfcbe('0x6'));var client=jayson['client'][_0xfcbe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x174e14,_0x1f8a27,_0x1c7c00){return new BPromise(function(_0x4329c2,_0x22ab39){return client[_0xfcbe('0x8')](_0x174e14,_0x1c7c00)['then'](function(_0x1e2e26){logger[_0xfcbe('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0x1f8a27,'request\x20sent');logger[_0xfcbe('0xa')](_0xfcbe('0xb'),_0x1f8a27,'request\x20sent',JSON[_0xfcbe('0xc')](_0x1e2e26));if(_0x1e2e26[_0xfcbe('0xd')]){if(_0x1e2e26['error'][_0xfcbe('0xe')]===0x1f4){logger[_0xfcbe('0xd')](_0xfcbe('0xf'),_0x1f8a27,_0x1e2e26[_0xfcbe('0xd')][_0xfcbe('0x10')]);return _0x22ab39(_0x1e2e26[_0xfcbe('0xd')][_0xfcbe('0x10')]);}logger[_0xfcbe('0xd')](_0xfcbe('0xf'),_0x1f8a27,_0x1e2e26['error']['message']);return _0x4329c2(_0x1e2e26['error'][_0xfcbe('0x10')]);}else{logger[_0xfcbe('0x9')](_0xfcbe('0xf'),_0x1f8a27,_0xfcbe('0x11'));_0x4329c2(_0x1e2e26[_0xfcbe('0x12')][_0xfcbe('0x10')]);}})[_0xfcbe('0x13')](function(_0x22e341){logger[_0xfcbe('0xd')](_0xfcbe('0xf'),_0x1f8a27,_0x22e341);_0x22ab39(_0x22e341);});});}exports[_0xfcbe('0x14')]=function(_0x5ace0e){var _0x3c0438=this;return new Promise(function(_0xf44dc3,_0x28f5c7){return db[_0xfcbe('0x15')]['create'](_0x5ace0e[_0xfcbe('0x16')],{'raw':_0x5ace0e['options']?_0x5ace0e[_0xfcbe('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xfcbe('0x18')](function(_0x48333a){logger[_0xfcbe('0x9')](_0xfcbe('0x14'),_0x5ace0e);logger[_0xfcbe('0xa')](_0xfcbe('0x14'),_0x5ace0e,JSON[_0xfcbe('0xc')](_0x48333a));_0xf44dc3(_0x48333a);})['catch'](function(_0x4d472a){logger[_0xfcbe('0xd')]('CreateVoiceTransferReport',_0x4d472a[_0xfcbe('0x10')],_0x5ace0e);_0x28f5c7(_0x3c0438[_0xfcbe('0xd')](0x1f4,_0x4d472a[_0xfcbe('0x10')]));});});}; \ No newline at end of file +var _0x999a=['error','code','message','info','result','catch','VoiceTransferReport','body','options','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x33960c,_0x3187c1){var _0x1a49f1=function(_0x1e9155){while(--_0x1e9155){_0x33960c['push'](_0x33960c['shift']());}};_0x1a49f1(++_0x3187c1);}(_0x999a,0x1ae));var _0xa999=function(_0x434bf5,_0x582111){_0x434bf5=_0x434bf5-0x0;var _0x5c5d75=_0x999a[_0x434bf5];return _0x5c5d75;};'use strict';var _=require(_0xa999('0x0'));var util=require(_0xa999('0x1'));var moment=require(_0xa999('0x2'));var BPromise=require(_0xa999('0x3'));var rs=require(_0xa999('0x4'));var fs=require('fs');var Redis=require(_0xa999('0x5'));var db=require(_0xa999('0x6'))['db'];var utils=require(_0xa999('0x7'));var logger=require(_0xa999('0x8'))(_0xa999('0x9'));var config=require('../../config/environment');var jayson=require(_0xa999('0xa'));var client=jayson[_0xa999('0xb')][_0xa999('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x465bf3,_0x45d5f8,_0x1de1b4){return new BPromise(function(_0x5111d3,_0x218aee){return client[_0xa999('0xd')](_0x465bf3,_0x1de1b4)[_0xa999('0xe')](function(_0x7a96b1){logger['info'](_0xa999('0xf'),_0x45d5f8,_0xa999('0x10'));logger[_0xa999('0x11')](_0xa999('0x12'),_0x45d5f8,'request\x20sent',JSON[_0xa999('0x13')](_0x7a96b1));if(_0x7a96b1[_0xa999('0x14')]){if(_0x7a96b1[_0xa999('0x14')][_0xa999('0x15')]===0x1f4){logger['error'](_0xa999('0xf'),_0x45d5f8,_0x7a96b1['error'][_0xa999('0x16')]);return _0x218aee(_0x7a96b1[_0xa999('0x14')][_0xa999('0x16')]);}logger[_0xa999('0x14')](_0xa999('0xf'),_0x45d5f8,_0x7a96b1[_0xa999('0x14')][_0xa999('0x16')]);return _0x5111d3(_0x7a96b1['error'][_0xa999('0x16')]);}else{logger[_0xa999('0x17')](_0xa999('0xf'),_0x45d5f8,_0xa999('0x10'));_0x5111d3(_0x7a96b1[_0xa999('0x18')][_0xa999('0x16')]);}})[_0xa999('0x19')](function(_0x3c72b2){logger[_0xa999('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x45d5f8,_0x3c72b2);_0x218aee(_0x3c72b2);});});}exports['CreateVoiceTransferReport']=function(_0xbb02ba){var _0x122007=this;return new Promise(function(_0x38100a,_0x4eb6fc){return db[_0xa999('0x1a')]['create'](_0xbb02ba[_0xa999('0x1b')],{'raw':_0xbb02ba[_0xa999('0x1c')]?_0xbb02ba[_0xa999('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa999('0xe')](function(_0x4fef6c){logger[_0xa999('0x17')]('CreateVoiceTransferReport',_0xbb02ba);logger[_0xa999('0x11')](_0xa999('0x1d'),_0xbb02ba,JSON[_0xa999('0x13')](_0x4fef6c));_0x38100a(_0x4fef6c);})[_0xa999('0x19')](function(_0x289aec){logger[_0xa999('0x14')](_0xa999('0x1d'),_0x289aec[_0xa999('0x16')],_0xbb02ba);_0x4eb6fc(_0x122007[_0xa999('0x14')](0x1f4,_0x289aec[_0xa999('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 38f4f25..32b57d4 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 _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x4b9af1,_0x4f15ae){var _0x11911a=function(_0x4137a5){while(--_0x4137a5){_0x4b9af1['push'](_0x4b9af1['shift']());}};_0x11911a(++_0x4f15ae);}(_0x5b02,0xe9));var _0x25b0=function(_0x2aadae,_0x299e53){_0x2aadae=_0x2aadae-0x0;var _0x186462=_0x5b02[_0x2aadae];return _0x186462;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file +var _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x3cfddc,_0x5c17d6){var _0x189b30=function(_0x9b0215){while(--_0x9b0215){_0x3cfddc['push'](_0x3cfddc['shift']());}};_0x189b30(++_0x5c17d6);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xb4e6[_0x1ee351];return _0x245aaf;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2fa7151..c378ef3 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 _0x6b19=['originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','rows','UserId','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','jayson/promise','client','http','../../config/logger','webbarapi','redis','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','request','then','code','message','catch','User','all','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','validate','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6b19,0xe8));var _0x96b1=function(_0x16a1f1,_0x4b6f31){_0x16a1f1=_0x16a1f1-0x0;var _0x384567=_0x6b19[_0x16a1f1];return _0x384567;};'use strict';var path=require(_0x96b1('0x0'));var fs=require('fs');var _=require(_0x96b1('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x96b1('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x96b1('0x3'));var amiClient=jayson[_0x96b1('0x4')][_0x96b1('0x5')]({'port':0x232a});var logger=require(_0x96b1('0x6'))(_0x96b1('0x7'));var Redis=require('ioredis');config[_0x96b1('0x8')]=_['defaults'](config[_0x96b1('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x96b1('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x96b1('0xa'),'required':[!![],_0x96b1('0xb')]},'callerId':{'type':_0x96b1('0xa')},'callbackUrl':{'type':_0x96b1('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x96b1('0xa'),'required':[!![],_0x96b1('0xd')]},'transferNumber':{'type':_0x96b1('0xa'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]}});function emit(_0x2cd1f5,_0x43b7f5,_0x24fa0f){logger[_0x96b1('0xe')](_0x2cd1f5,_0x43b7f5,JSON[_0x96b1('0xf')](_0x24fa0f));io['to'](_0x2cd1f5)[_0x96b1('0x10')](_0x43b7f5,_0x24fa0f);}function handleError(_0x450099){return function(_0x38478c){console[_0x96b1('0x11')](_0x96b1('0x12'),_0x38478c,_0x38478c instanceof RangeError);logger[_0x96b1('0x13')](_0x38478c['stack']);if(_0x38478c instanceof RangeError){if(_0x38478c[_0x96b1('0x14')]){delete _0x38478c['name'];}_0x450099[_0x96b1('0x15')](0x194)[_0x96b1('0x16')](_0x38478c);}else{if(_0x38478c[_0x96b1('0x14')]){delete _0x38478c['name'];}_0x450099[_0x96b1('0x15')](0x1f4)[_0x96b1('0x16')](_0x38478c);}};}function checkError(){return function(_0x48786f){if(!_0x48786f){throw new RangeError('NotFound');}return _0x48786f;};}function respondWithRpcPromise(_0x2b7d4d,_0x3595b7){return new BPromise(function(_0x35db4a,_0x18594b){var _0x555185=amiClient;return _0x555185[_0x96b1('0x17')](_0x2b7d4d,_0x3595b7)[_0x96b1('0x18')](function(_0xde249b){if(_0xde249b['error']){if(_0xde249b[_0x96b1('0x13')][_0x96b1('0x19')]===0x1f4){return _0x18594b(_0xde249b[_0x96b1('0x13')][_0x96b1('0x1a')]);}return _0x35db4a(_0xde249b['error'][_0x96b1('0x1a')]);}else{_0x35db4a(_0xde249b['result']);}})[_0x96b1('0x1b')](function(_0x4ad19f){_0x18594b(_0x4ad19f);});});}function getAgent(_0x6509d2){return db[_0x96b1('0x1c')]['findOne']({'where':{'id':_0x6509d2,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x3f24bc,_0x2e4420){return new BPromise(function(_0x18e56a,_0x444b0b){var _0x2a9229=respondWithRpcPromise('VoiceChannels');var _0x21a63f=getAgent(_0x3f24bc);Promise[_0x96b1('0x1d')]([_0x2a9229,_0x21a63f])[_0x96b1('0x18')](function(_0x209ce8){var _0x51e2c1=_0x209ce8[0x0];var _0x30dd00=_0x209ce8[0x1];var _0x33f96b=_['filter'](_0x51e2c1['rows'],function(_0x3666f8){return _0x3666f8['UserId']==_0x30dd00['id']&&_0x3666f8[_0x96b1('0x1e')]==_0x2e4420;});if(_0x33f96b[_0x96b1('0x1f')]==0x1){_0x18e56a(_0x30dd00);}else{_0x444b0b(new RangeError('sessionId\x20'+_0x2e4420+_0x96b1('0x20')));}});});}exports[_0x96b1('0x21')]=function(_0x5cb283,_0x36e049){logger[_0x96b1('0xe')](_0x96b1('0x22'),_0x5cb283['body']);var _0x2ac0bf=originateValidation[_0x96b1('0x23')](_0x5cb283[_0x96b1('0x24')]);if(_0x2ac0bf[_0x96b1('0x1f')]>0x0){return _0x36e049[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x2ac0bf);}var _0x55c5ec=_0x5cb283[_0x96b1('0x24')][_0x96b1('0x26')];var _0x50edd9=_0x5cb283['body'][_0x96b1('0x27')];var _0x1b1497=_0x5cb283[_0x96b1('0x24')]['callerId'];var _0x4ba6eb=_0x5cb283[_0x96b1('0x24')][_0x96b1('0x28')];return getAgent(_0x55c5ec)[_0x96b1('0x18')](function(_0x1721a4){logger['info'](_0x96b1('0x29'),_0x1721a4['name']);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x1721a4[_0x96b1('0x14')]),'webbar:originate',{'callNumber':_0x50edd9,'callerId':_0x1b1497,'callbackUrl':_0x4ba6eb});return _0x36e049[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x2c')});})[_0x96b1('0x1b')](handleError(_0x36e049));};exports[_0x96b1('0x2d')]=function(_0x370d03,_0x560fb6){logger[_0x96b1('0xe')](_0x96b1('0x2e'),_0x370d03['body']);var _0x320d31=hangupValidation['validate'](_0x370d03[_0x96b1('0x24')]);if(_0x320d31[_0x96b1('0x1f')]>0x0){return _0x560fb6[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x320d31);}var _0x30be03=_0x370d03[_0x96b1('0x24')][_0x96b1('0x26')];var _0x220d08=_0x370d03[_0x96b1('0x24')]['sessionId'];return getAgent(_0x30be03)[_0x96b1('0x18')](function(_0x4d3c9f){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x4d3c9f[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x4d3c9f[_0x96b1('0x14')]),_0x96b1('0x2f'),{'sessionId':_0x220d08});return _0x560fb6[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x30')});})[_0x96b1('0x1b')](handleError(_0x560fb6));};exports[_0x96b1('0x31')]=function(_0x13529e,_0x49a73e){logger['info'](_0x96b1('0x32'),_0x13529e[_0x96b1('0x24')]);var _0x5282dd=answerValidation[_0x96b1('0x23')](_0x13529e[_0x96b1('0x24')]);if(_0x5282dd['length']>0x0){return _0x49a73e['status'](0x190)['json'](_0x5282dd);}var _0x3f8220=_0x13529e[_0x96b1('0x24')][_0x96b1('0x26')];var _0x458fd9=_0x13529e[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x3f8220)[_0x96b1('0x18')](function(_0x12fbb0){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x12fbb0['name']);emit(util[_0x96b1('0x2a')]('user:%s',_0x12fbb0[_0x96b1('0x14')]),'webbar:answer',{'sessionId':_0x458fd9});return _0x49a73e[_0x96b1('0x15')](0xc8)['json']({'error':![],'message':_0x96b1('0x33')});})[_0x96b1('0x1b')](handleError(_0x49a73e));};exports[_0x96b1('0x34')]=function(_0x266eaa,_0x1d2eb2){logger['info'](_0x96b1('0x35'),_0x266eaa[_0x96b1('0x24')]);var _0x1fdfe8=holdValidation['validate'](_0x266eaa[_0x96b1('0x24')]);if(_0x1fdfe8[_0x96b1('0x1f')]>0x0){return _0x1d2eb2[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x1fdfe8);}var _0x4919b2=_0x266eaa[_0x96b1('0x24')][_0x96b1('0x26')];var _0x4e6f7a=_0x266eaa[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x4919b2)[_0x96b1('0x18')](function(_0xc7b84b){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0xc7b84b['name']);emit(util[_0x96b1('0x2a')]('user:%s',_0xc7b84b[_0x96b1('0x14')]),_0x96b1('0x36'),{'sessionId':_0x4e6f7a});return _0x1d2eb2['status'](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x37')});})['catch'](handleError(_0x1d2eb2));};exports[_0x96b1('0x38')]=function(_0xa66f17,_0x2087ba){logger[_0x96b1('0xe')](_0x96b1('0x39'),_0xa66f17[_0x96b1('0x24')]);var _0x8cd80b=unholdValidation[_0x96b1('0x23')](_0xa66f17[_0x96b1('0x24')]);if(_0x8cd80b[_0x96b1('0x1f')]>0x0){return _0x2087ba['status'](0x190)[_0x96b1('0x25')](_0x8cd80b);}var _0x220551=_0xa66f17[_0x96b1('0x24')][_0x96b1('0x26')];var _0x471177=_0xa66f17[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x220551)[_0x96b1('0x18')](function(_0x4d055a){logger['info'](_0x96b1('0x29'),_0x4d055a[_0x96b1('0x14')]);emit(util['format'](_0x96b1('0x2b'),_0x4d055a[_0x96b1('0x14')]),_0x96b1('0x3a'),{'sessionId':_0x471177});return _0x2087ba['status'](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x3b')});})['catch'](handleError(_0x2087ba));};exports['calls']=function(_0x31c32d,_0x19cc23){logger[_0x96b1('0xe')](_0x96b1('0x3c'),_0x19cc23[_0x96b1('0x24')]);var _0x3dc040=callsValidation[_0x96b1('0x23')](_0x31c32d[_0x96b1('0x24')]);if(_0x3dc040[_0x96b1('0x1f')]>0x0){return _0x19cc23[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x3dc040);}var _0x16ce91=_0x31c32d['body'][_0x96b1('0x26')];var _0x1a5134=respondWithRpcPromise(_0x96b1('0x3d'));var _0x22da91=getAgent(_0x16ce91);return Promise[_0x96b1('0x1d')]([_0x1a5134,_0x22da91])[_0x96b1('0x18')](function(_0x227cc2){var _0x51b672=_0x227cc2[0x0];var _0x10d5b7=_0x227cc2[0x1];var _0x50f400=_['filter'](_0x51b672[_0x96b1('0x3e')],function(_0x2964e5){return _0x2964e5[_0x96b1('0x3f')]==_0x10d5b7['id'];});return _0x19cc23[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'count':_0x50f400[_0x96b1('0x1f')],'rows':_0x50f400});})[_0x96b1('0x1b')](handleError(_0x19cc23));};exports['conference']=function(_0x26a496,_0x54f45a){logger[_0x96b1('0xe')]('conference\x20fired:',_0x26a496[_0x96b1('0x24')]);var _0x405366=conferenceValidation['validate'](_0x26a496[_0x96b1('0x24')]);if(_0x405366[_0x96b1('0x1f')]>0x0){return _0x54f45a[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x405366);}var _0x4c8edf=_0x26a496['body'][_0x96b1('0x26')];return getAgent(_0x4c8edf)[_0x96b1('0x18')](function(_0x474bad){logger[_0x96b1('0xe')]('entityFound:',_0x474bad[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x474bad[_0x96b1('0x14')]),_0x96b1('0x40'));return _0x54f45a[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x41')});})[_0x96b1('0x1b')](handleError(_0x54f45a));};exports['transfer']=function(_0x4f62c1,_0x15f591){logger[_0x96b1('0xe')]('transfer\x20fired:',_0x4f62c1['body']);var _0x11bb4d=transferValidation[_0x96b1('0x23')](_0x4f62c1[_0x96b1('0x24')]);if(_0x11bb4d[_0x96b1('0x1f')]>0x0){return _0x15f591[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x11bb4d);}var _0x37b48d=_0x4f62c1['body']['userId'];var _0x316cfa=_0x4f62c1[_0x96b1('0x24')]['sessionId'];var _0x5edcee=_0x4f62c1[_0x96b1('0x24')][_0x96b1('0x42')];return getAgent(_0x37b48d)['then'](function(_0x1190d6){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x1190d6[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x1190d6['name']),_0x96b1('0x43'),{'sessionId':_0x316cfa,'transferNumber':_0x5edcee});return _0x15f591[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x44')});})['catch'](handleError(_0x15f591));}; \ No newline at end of file +var _0x4d9e=['length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','then','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','path','../../config/environment','bluebird','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','handleError:','stack','name','status','send','NotFound','request','error','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x21508f,_0x99b06e){_0x21508f=_0x21508f-0x0;var _0x339be6=_0x4d9e[_0x21508f];return _0x339be6;};'use strict';var path=require(_0xe4d9('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xe4d9('0x1'));var util=require('util');var BPromise=require(_0xe4d9('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0xe4d9('0x3')][_0xe4d9('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xe4d9('0x5'));var Redis=require(_0xe4d9('0x6'));config[_0xe4d9('0x7')]=_[_0xe4d9('0x8')](config[_0xe4d9('0x7')],{'host':_0xe4d9('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4d9('0x7')]));var Schema=require(_0xe4d9('0xa'));var originateValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'callNumber':{'type':_0xe4d9('0xd'),'required':[!![],_0xe4d9('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe4d9('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'sessionId':{'type':_0xe4d9('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'sessionId':{'type':_0xe4d9('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe4d9('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]}});function emit(_0x58d0cf,_0x331ef3,_0x35cbc2){logger[_0xe4d9('0xf')](_0x58d0cf,_0x331ef3,JSON['stringify'](_0x35cbc2));io['to'](_0x58d0cf)['emit'](_0x331ef3,_0x35cbc2);}function handleError(_0x7abb80){return function(_0x112315){console['log'](_0xe4d9('0x10'),_0x112315,_0x112315 instanceof RangeError);logger['error'](_0x112315[_0xe4d9('0x11')]);if(_0x112315 instanceof RangeError){if(_0x112315[_0xe4d9('0x12')]){delete _0x112315[_0xe4d9('0x12')];}_0x7abb80[_0xe4d9('0x13')](0x194)['send'](_0x112315);}else{if(_0x112315[_0xe4d9('0x12')]){delete _0x112315[_0xe4d9('0x12')];}_0x7abb80[_0xe4d9('0x13')](0x1f4)[_0xe4d9('0x14')](_0x112315);}};}function checkError(){return function(_0x2c6b89){if(!_0x2c6b89){throw new RangeError(_0xe4d9('0x15'));}return _0x2c6b89;};}function respondWithRpcPromise(_0x30d923,_0x29e0c9){return new BPromise(function(_0x562bab,_0x4fed7f){var _0x44f1aa=amiClient;return _0x44f1aa[_0xe4d9('0x16')](_0x30d923,_0x29e0c9)['then'](function(_0x189dad){if(_0x189dad['error']){if(_0x189dad[_0xe4d9('0x17')][_0xe4d9('0x18')]===0x1f4){return _0x4fed7f(_0x189dad['error'][_0xe4d9('0x19')]);}return _0x562bab(_0x189dad[_0xe4d9('0x17')]['message']);}else{_0x562bab(_0x189dad[_0xe4d9('0x1a')]);}})[_0xe4d9('0x1b')](function(_0x36444c){_0x4fed7f(_0x36444c);});});}function getAgent(_0x5bb43b){return db['User'][_0xe4d9('0x1c')]({'where':{'id':_0x5bb43b,'role':_0xe4d9('0x1d')}})['then'](checkError());}function getAgentCheckSession(_0x5dddd2,_0x4954b5){return new BPromise(function(_0x529e2b,_0x221a61){var _0x48d481=respondWithRpcPromise(_0xe4d9('0x1e'));var _0x1f3d90=getAgent(_0x5dddd2);Promise[_0xe4d9('0x1f')]([_0x48d481,_0x1f3d90])['then'](function(_0xec8d64){var _0x2a0d1f=_0xec8d64[0x0];var _0x250de5=_0xec8d64[0x1];var _0x45e8a3=_[_0xe4d9('0x20')](_0x2a0d1f[_0xe4d9('0x21')],function(_0x21b7a9){return _0x21b7a9[_0xe4d9('0x22')]==_0x250de5['id']&&_0x21b7a9[_0xe4d9('0x23')]==_0x4954b5;});if(_0x45e8a3[_0xe4d9('0x24')]==0x1){_0x529e2b(_0x250de5);}else{_0x221a61(new RangeError(_0xe4d9('0x25')+_0x4954b5+_0xe4d9('0x26')));}});});}exports['originate']=function(_0x22efd2,_0x349be3){logger[_0xe4d9('0xf')](_0xe4d9('0x27'),_0x22efd2[_0xe4d9('0x28')]);var _0x12e0ae=originateValidation['validate'](_0x22efd2['body']);if(_0x12e0ae['length']>0x0){return _0x349be3[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x12e0ae);}var _0x9f1acf=_0x22efd2['body']['userId'];var _0x5ad794=_0x22efd2['body'][_0xe4d9('0x2a')];var _0x16aaff=_0x22efd2['body'][_0xe4d9('0x2b')];var _0x24c084=_0x22efd2['body'][_0xe4d9('0x2c')];return getAgent(_0x9f1acf)[_0xe4d9('0x2d')](function(_0x945a80){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x945a80[_0xe4d9('0x12')]);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x945a80[_0xe4d9('0x12')]),_0xe4d9('0x31'),{'callNumber':_0x5ad794,'callerId':_0x16aaff,'callbackUrl':_0x24c084});return _0x349be3[_0xe4d9('0x13')](0xc8)[_0xe4d9('0x29')]({'error':![],'message':_0xe4d9('0x32')});})[_0xe4d9('0x1b')](handleError(_0x349be3));};exports['hangup']=function(_0x35b5f5,_0x20aef6){logger[_0xe4d9('0xf')](_0xe4d9('0x33'),_0x35b5f5[_0xe4d9('0x28')]);var _0x331161=hangupValidation[_0xe4d9('0xa')](_0x35b5f5[_0xe4d9('0x28')]);if(_0x331161[_0xe4d9('0x24')]>0x0){return _0x20aef6['status'](0x190)['json'](_0x331161);}var _0x5f5bc5=_0x35b5f5[_0xe4d9('0x28')][_0xe4d9('0x34')];var _0x32179b=_0x35b5f5[_0xe4d9('0x28')][_0xe4d9('0x23')];return getAgent(_0x5f5bc5)[_0xe4d9('0x2d')](function(_0x392cdd){logger['info']('entityFound:',_0x392cdd['name']);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x392cdd['name']),_0xe4d9('0x35'),{'sessionId':_0x32179b});return _0x20aef6[_0xe4d9('0x13')](0xc8)[_0xe4d9('0x29')]({'error':![],'message':_0xe4d9('0x36')});})['catch'](handleError(_0x20aef6));};exports[_0xe4d9('0x37')]=function(_0x348667,_0x2afa91){logger[_0xe4d9('0xf')](_0xe4d9('0x38'),_0x348667[_0xe4d9('0x28')]);var _0x25b1f0=answerValidation[_0xe4d9('0xa')](_0x348667[_0xe4d9('0x28')]);if(_0x25b1f0[_0xe4d9('0x24')]>0x0){return _0x2afa91[_0xe4d9('0x13')](0x190)['json'](_0x25b1f0);}var _0x429be=_0x348667[_0xe4d9('0x28')][_0xe4d9('0x34')];var _0x2b7e25=_0x348667[_0xe4d9('0x28')]['sessionId'];return getAgent(_0x429be)[_0xe4d9('0x2d')](function(_0x31db47){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x31db47[_0xe4d9('0x12')]);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x31db47[_0xe4d9('0x12')]),_0xe4d9('0x39'),{'sessionId':_0x2b7e25});return _0x2afa91[_0xe4d9('0x13')](0xc8)['json']({'error':![],'message':_0xe4d9('0x3a')});})[_0xe4d9('0x1b')](handleError(_0x2afa91));};exports[_0xe4d9('0x3b')]=function(_0x54bf07,_0x131e11){logger[_0xe4d9('0xf')](_0xe4d9('0x3c'),_0x54bf07[_0xe4d9('0x28')]);var _0x1e0b7b=holdValidation[_0xe4d9('0xa')](_0x54bf07[_0xe4d9('0x28')]);if(_0x1e0b7b['length']>0x0){return _0x131e11[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x1e0b7b);}var _0x38bc8f=_0x54bf07[_0xe4d9('0x28')][_0xe4d9('0x34')];var _0x423881=_0x54bf07['body'][_0xe4d9('0x23')];return getAgent(_0x38bc8f)[_0xe4d9('0x2d')](function(_0x87f230){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x87f230[_0xe4d9('0x12')]);emit(util['format'](_0xe4d9('0x30'),_0x87f230[_0xe4d9('0x12')]),'webbar:hold',{'sessionId':_0x423881});return _0x131e11[_0xe4d9('0x13')](0xc8)['json']({'error':![],'message':_0xe4d9('0x3d')});})[_0xe4d9('0x1b')](handleError(_0x131e11));};exports['unhold']=function(_0x657961,_0x5e5267){logger[_0xe4d9('0xf')](_0xe4d9('0x3e'),_0x657961[_0xe4d9('0x28')]);var _0x48b9fa=unholdValidation[_0xe4d9('0xa')](_0x657961[_0xe4d9('0x28')]);if(_0x48b9fa['length']>0x0){return _0x5e5267[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x48b9fa);}var _0x37af58=_0x657961[_0xe4d9('0x28')]['userId'];var _0x50f513=_0x657961[_0xe4d9('0x28')][_0xe4d9('0x23')];return getAgent(_0x37af58)[_0xe4d9('0x2d')](function(_0x19ebdc){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x19ebdc['name']);emit(util['format'](_0xe4d9('0x30'),_0x19ebdc[_0xe4d9('0x12')]),_0xe4d9('0x3f'),{'sessionId':_0x50f513});return _0x5e5267[_0xe4d9('0x13')](0xc8)[_0xe4d9('0x29')]({'error':![],'message':_0xe4d9('0x40')});})['catch'](handleError(_0x5e5267));};exports[_0xe4d9('0x41')]=function(_0x291d0c,_0x47596a){logger['info'](_0xe4d9('0x42'),_0x47596a[_0xe4d9('0x28')]);var _0x281fda=callsValidation['validate'](_0x291d0c[_0xe4d9('0x28')]);if(_0x281fda['length']>0x0){return _0x47596a[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x281fda);}var _0x175346=_0x291d0c['body']['userId'];var _0x5bd06b=respondWithRpcPromise(_0xe4d9('0x1e'));var _0x588bcb=getAgent(_0x175346);return Promise[_0xe4d9('0x1f')]([_0x5bd06b,_0x588bcb])['then'](function(_0x4d7e81){var _0x3c2196=_0x4d7e81[0x0];var _0x2a4428=_0x4d7e81[0x1];var _0x467c29=_[_0xe4d9('0x20')](_0x3c2196[_0xe4d9('0x21')],function(_0x580bb4){return _0x580bb4['UserId']==_0x2a4428['id'];});return _0x47596a['status'](0xc8)['json']({'count':_0x467c29[_0xe4d9('0x24')],'rows':_0x467c29});})[_0xe4d9('0x1b')](handleError(_0x47596a));};exports[_0xe4d9('0x43')]=function(_0x39e74a,_0x1d522e){logger[_0xe4d9('0xf')](_0xe4d9('0x44'),_0x39e74a['body']);var _0x524e8c=conferenceValidation[_0xe4d9('0xa')](_0x39e74a[_0xe4d9('0x28')]);if(_0x524e8c[_0xe4d9('0x24')]>0x0){return _0x1d522e[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x524e8c);}var _0xa7cbad=_0x39e74a[_0xe4d9('0x28')][_0xe4d9('0x34')];return getAgent(_0xa7cbad)[_0xe4d9('0x2d')](function(_0x394635){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x394635['name']);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x394635[_0xe4d9('0x12')]),_0xe4d9('0x45'));return _0x1d522e['status'](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xe4d9('0x1b')](handleError(_0x1d522e));};exports[_0xe4d9('0x46')]=function(_0x3ffe34,_0x43b750){logger['info']('transfer\x20fired:',_0x3ffe34[_0xe4d9('0x28')]);var _0xf41d89=transferValidation[_0xe4d9('0xa')](_0x3ffe34[_0xe4d9('0x28')]);if(_0xf41d89[_0xe4d9('0x24')]>0x0){return _0x43b750[_0xe4d9('0x13')](0x190)['json'](_0xf41d89);}var _0x348c8d=_0x3ffe34['body'][_0xe4d9('0x34')];var _0x3be5a4=_0x3ffe34['body'][_0xe4d9('0x23')];var _0xc31086=_0x3ffe34['body'][_0xe4d9('0x47')];return getAgent(_0x348c8d)[_0xe4d9('0x2d')](function(_0x46d795){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x46d795[_0xe4d9('0x12')]);emit(util['format']('user:%s',_0x46d795[_0xe4d9('0x12')]),'webbar:transfer',{'sessionId':_0x3be5a4,'transferNumber':_0xc31086});return _0x43b750[_0xe4d9('0x13')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xe4d9('0x1b')](handleError(_0x43b750));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index f6ad7e8..4c6b688 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 _0x01d9=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0xb4df7d,_0xd352df){var _0x43bdc0=function(_0x1acafc){while(--_0x1acafc){_0xb4df7d['push'](_0xb4df7d['shift']());}};_0x43bdc0(++_0xd352df);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['get'](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x18')]);router[_0x901d('0x19')]('/',auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router['post'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x1b')]);router[_0x901d('0x19')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x19')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1d')]);router[_0x901d('0x19')](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x19')](_0x901d('0x1f'),controller[_0x901d('0x20')]);router['post'](_0x901d('0x21'),auth[_0x901d('0xd')](),controller['send']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x901d('0x22')]);router[_0x901d('0x23')]('/:id',auth[_0x901d('0xd')](),controller[_0x901d('0x24')]);router['delete'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x25')]);router[_0x901d('0x23')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x26')]);router[_0x901d('0x23')]('/:id/users',auth[_0x901d('0xd')](),controller[_0x901d('0x27')]);module[_0x901d('0x28')]=router; \ No newline at end of file +var _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5952a3,_0x2f89f4){var _0x26f9c4=function(_0x267b15){while(--_0x267b15){_0x5952a3['push'](_0x5952a3['shift']());}};_0x26f9c4(++_0x2f89f4);}(_0x5c3c,0x132));var _0xc5c3=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x5c3c[_0x45f951];return _0x24756c;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2876bc2..919fc3f 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 _0x9733=['sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x57ca9b,_0x5cb367){var _0x35bf2f=function(_0x10a298){while(--_0x10a298){_0x57ca9b['push'](_0x57ca9b['shift']());}};_0x35bf2f(++_0x5cb367);}(_0x9733,0x177));var _0x3973=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9733[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3973('0x0'));var rs=require(_0x3973('0x1'));module[_0x3973('0x2')]={'name':{'type':Sequelize[_0x3973('0x3')],'unique':_0x3973('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3973('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3973('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3973('0x5')]();}},'phone':{'type':Sequelize[_0x3973('0x3')]},'type':{'type':Sequelize[_0x3973('0x6')](_0x3973('0x7'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3973('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3973('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3973('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3973('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3973('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3973('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3973('0x9')],'comment':_0x3973('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x3973('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x360f78){if(!_0x360f78){this[_0x3973('0xc')](_0x3973('0xd'),null);}this[_0x3973('0xc')](_0x3973('0xe'),_0x360f78);}},'description':{'type':Sequelize[_0x3973('0x3')]}}; \ No newline at end of file +var _0x2f9d=['name','STRING','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x427180,_0xeac7de){var _0x583042=function(_0x5e76a6){while(--_0x5e76a6){_0x427180['push'](_0x427180['shift']());}};_0x583042(++_0xeac7de);}(_0x2f9d,0x165));var _0xd2f9=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x2f9d[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0xd2f9('0x0'));var rs=require(_0xd2f9('0x1'));module[_0xd2f9('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xd2f9('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd2f9('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd2f9('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd2f9('0x4')]},'type':{'type':Sequelize[_0xd2f9('0x5')](_0xd2f9('0x6'),_0xd2f9('0x7'))},'accountSid':{'type':Sequelize[_0xd2f9('0x4')]},'baseUrl':{'type':Sequelize[_0xd2f9('0x4')]},'authToken':{'type':Sequelize[_0xd2f9('0x4')]},'notificationTemplate':{'type':Sequelize[_0xd2f9('0x8')],'defaultValue':function(){return _0xd2f9('0x9');}},'notificationSound':{'type':Sequelize[_0xd2f9('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd2f9('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd2f9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd2f9('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd2f9('0xb')],'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[_0xd2f9('0xb')],'comment':_0xd2f9('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xd2f9('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2edb29){if(!_0x2edb29){this['setDataValue'](_0xd2f9('0xd'),null);}this['setDataValue'](_0xd2f9('0xe'),_0x2edb29);}},'description':{'type':Sequelize[_0xd2f9('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8fd6805..6f0e3cf 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 _0xb9eb=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','update','params','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','state','WhatsappMessage','statuses','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','Body','messageId','MessageSid','sinch','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x21ce32,_0x2ccd1c){var _0xd6b087=function(_0x58e475){while(--_0x58e475){_0x21ce32['push'](_0x21ce32['shift']());}};_0xd6b087(++_0x2ccd1c);}(_0xb9eb,0x1ad));var _0xbb9e=function(_0x2def13,_0x1b781f){_0x2def13=_0x2def13-0x0;var _0x186312=_0xb9eb[_0x2def13];return _0x186312;};'use strict';var emlformat=require(_0xbb9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb9e('0x1'));var jsonpatch=require(_0xbb9e('0x2'));var rp=require(_0xbb9e('0x3'));var moment=require(_0xbb9e('0x4'));var BPromise=require(_0xbb9e('0x5'));var Mustache=require('mustache');var util=require(_0xbb9e('0x6'));var path=require(_0xbb9e('0x7'));var sox=require(_0xbb9e('0x8'));var csv=require('to-csv');var ejs=require(_0xbb9e('0x9'));var fs=require('fs');var fs_extra=require(_0xbb9e('0xa'));var _=require(_0xbb9e('0xb'));var squel=require('squel');var crypto=require(_0xbb9e('0xc'));var jsforce=require(_0xbb9e('0xd'));var deskjs=require(_0xbb9e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbb9e('0xf'));var Papa=require(_0xbb9e('0x10'));var Redis=require(_0xbb9e('0x11'));var authService=require(_0xbb9e('0x12'));var qs=require(_0xbb9e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb9e('0x14'));var logger=require('../../config/logger')(_0xbb9e('0x15'));var utils=require(_0xbb9e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb9e('0x17'));var db=require(_0xbb9e('0x18'))['db'];config[_0xbb9e('0x19')]=_[_0xbb9e('0x1a')](config[_0xbb9e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb9e('0x1b'))(new Redis(config[_0xbb9e('0x19')]));require(_0xbb9e('0x1c'))[_0xbb9e('0x1d')](socket);var jayson=require(_0xbb9e('0x1e'));var client=jayson[_0xbb9e('0x1f')][_0xbb9e('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5d632c,_0x1f9187,_0x52862c,_0x4e7c5c){return new BPromise(function(_0xf57aca,_0x840860){var _0x351d30=_0x4e7c5c||client;return _0x351d30[_0xbb9e('0x21')](_0x5d632c,_0x52862c)[_0xbb9e('0x22')](function(_0x52dbb4){logger['info'](_0xbb9e('0x23'),_0x1f9187,_0xbb9e('0x24'));logger['debug'](_0xbb9e('0x25'),_0x1f9187,_0xbb9e('0x24'),JSON[_0xbb9e('0x26')](_0x52dbb4));if(_0x52dbb4['error']){if(_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x28')]===0x1f4){logger[_0xbb9e('0x27')](_0xbb9e('0x23'),_0x1f9187,_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);return _0x840860(_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);}logger[_0xbb9e('0x27')](_0xbb9e('0x23'),_0x1f9187,_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);return _0xf57aca(_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);}else{logger[_0xbb9e('0x2a')](_0xbb9e('0x23'),_0x1f9187,_0xbb9e('0x24'));_0xf57aca(_0x52dbb4[_0xbb9e('0x2b')][_0xbb9e('0x29')]);}})['catch'](function(_0x4135f0){logger[_0xbb9e('0x27')](_0xbb9e('0x23'),_0x1f9187,_0x4135f0);_0x840860(_0x4135f0);});});}function respondWithStatusCode(_0x4f263c,_0x59192d){_0x59192d=_0x59192d||0xcc;return function(_0x1dfbed){if(_0x1dfbed){return _0x4f263c[_0xbb9e('0x2c')](_0x59192d);}return _0x4f263c[_0xbb9e('0x2d')](_0x59192d)[_0xbb9e('0x2e')]();};}function respondWithResult(_0x4b95e9,_0x3491d4){_0x3491d4=_0x3491d4||0xc8;return function(_0x144aab){if(_0x144aab){return _0x4b95e9[_0xbb9e('0x2d')](_0x3491d4)['json'](_0x144aab);}};}function respondWithFilteredResult(_0x26d789,_0x35d43c){return function(_0x2d58df){if(_0x2d58df){var _0x58f39f=typeof _0x35d43c['offset']===_0xbb9e('0x2f')&&typeof _0x35d43c[_0xbb9e('0x30')]===_0xbb9e('0x2f');var _0x1afac6=_0x2d58df[_0xbb9e('0x31')];var _0x3f4e33=_0x58f39f?0x0:_0x35d43c[_0xbb9e('0x32')];var _0x59d388=_0x58f39f?_0x2d58df[_0xbb9e('0x31')]:_0x35d43c[_0xbb9e('0x32')]+_0x35d43c[_0xbb9e('0x30')];var _0x46b0e8;if(_0x59d388>=_0x1afac6){_0x59d388=_0x1afac6;_0x46b0e8=0xc8;}else{_0x46b0e8=0xce;}_0x26d789['status'](_0x46b0e8);return _0x26d789['set'](_0xbb9e('0x33'),_0x3f4e33+'-'+_0x59d388+'/'+_0x1afac6)[_0xbb9e('0x34')](_0x2d58df);}return null;};}function patchUpdates(_0x14964d){return function(_0x12ae1f){try{jsonpatch[_0xbb9e('0x35')](_0x12ae1f,_0x14964d,!![]);}catch(_0x20d78d){return BPromise[_0xbb9e('0x36')](_0x20d78d);}return _0x12ae1f[_0xbb9e('0x37')]();};}function saveUpdates(_0x95665,_0x1af428){return function(_0x9d7036){if(_0x9d7036){return _0x9d7036['update'](_0x95665)[_0xbb9e('0x22')](function(_0x3ba933){return _0x3ba933;});}return null;};}function removeEntity(_0x14ffaf,_0x5258a2){return function(_0x29ac53){if(_0x29ac53){return _0x29ac53[_0xbb9e('0x38')]()['then'](function(){var _0xb22fb3=_0x29ac53['get']({'plain':!![]});var _0x52cf7f=_0xbb9e('0x39');return db[_0xbb9e('0x3a')][_0xbb9e('0x38')]({'where':{'type':_0x52cf7f,'resourceId':_0xb22fb3['id']}})[_0xbb9e('0x22')](function(){return _0x29ac53;});})[_0xbb9e('0x22')](function(){_0x14ffaf['status'](0xcc)[_0xbb9e('0x2e')]();});}};}function handleEntityNotFound(_0x50a27e,_0x2b377a){return function(_0xe46da6){if(!_0xe46da6){_0x50a27e[_0xbb9e('0x2c')](0x194);}return _0xe46da6;};}function handleError(_0x2b84df,_0x5abb42){_0x5abb42=_0x5abb42||0x1f4;return function(_0xd4ceea){logger[_0xbb9e('0x27')](_0xd4ceea[_0xbb9e('0x3b')]);if(_0xd4ceea['name']){delete _0xd4ceea[_0xbb9e('0x3c')];}_0x2b84df[_0xbb9e('0x2d')](_0x5abb42)[_0xbb9e('0x3d')](_0xd4ceea);};}exports[_0xbb9e('0x3e')]=function(_0x295715,_0x5aee7c){var _0x21123a={'include':[{'model':db[_0xbb9e('0x3f')],'as':_0xbb9e('0x40')}]},_0x545d63={},_0x48e5ae={'count':0x0,'rows':[]};var _0x2bbc19=_[_0xbb9e('0x41')](db[_0xbb9e('0x42')][_0xbb9e('0x43')],function(_0x26401f){return{'name':_0x26401f[_0xbb9e('0x44')],'type':_0x26401f[_0xbb9e('0x45')][_0xbb9e('0x46')]};});_0x545d63[_0xbb9e('0x47')]=_['map'](_0x2bbc19,_0xbb9e('0x3c'));_0x545d63[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x295715[_0xbb9e('0x48')]);_0x545d63[_0xbb9e('0x4a')]=_[_0xbb9e('0x4b')](_0x545d63[_0xbb9e('0x47')],_0x545d63[_0xbb9e('0x48')]);_0x21123a[_0xbb9e('0x4c')]=_[_0xbb9e('0x4b')](_0x545d63['model'],qs[_0xbb9e('0x4d')](_0x295715[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x21123a['attributes']=_0x21123a[_0xbb9e('0x4c')]['length']?_0x21123a[_0xbb9e('0x4c')]:_0x545d63[_0xbb9e('0x47')];if(!_0x295715[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x21123a[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x295715['query']['limit']);_0x21123a[_0xbb9e('0x32')]=qs['offset'](_0x295715[_0xbb9e('0x48')][_0xbb9e('0x32')]);}_0x21123a[_0xbb9e('0x50')]=qs[_0xbb9e('0x51')](_0x295715['query'][_0xbb9e('0x51')]);_0x21123a[_0xbb9e('0x52')]=qs['filters'](_[_0xbb9e('0x53')](_0x295715[_0xbb9e('0x48')],_0x545d63[_0xbb9e('0x4a')]),_0x2bbc19);if(_0x295715[_0xbb9e('0x48')][_0xbb9e('0x54')]){_0x21123a[_0xbb9e('0x52')]=_['merge'](_0x21123a[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x2bbc19,function(_0x4065cc){if(_0x4065cc[_0xbb9e('0x45')]!==_0xbb9e('0x55')){var _0x59dea3={};_0x59dea3[_0x4065cc[_0xbb9e('0x3c')]]={'$like':'%'+_0x295715['query'][_0xbb9e('0x54')]+'%'};return _0x59dea3;}})});}_0x21123a=_['merge']({},_0x21123a,_0x295715[_0xbb9e('0x56')]);var _0xfbaeae={'where':_0x21123a['where']};return db[_0xbb9e('0x42')][_0xbb9e('0x31')](_0xfbaeae)['then'](function(_0x730791){_0x48e5ae[_0xbb9e('0x31')]=_0x730791;if(_0x295715['query'][_0xbb9e('0x57')]){_0x21123a[_0xbb9e('0x58')]=[{'all':!![]}];}return db[_0xbb9e('0x42')][_0xbb9e('0x59')](_0x21123a);})['then'](function(_0x369327){_0x48e5ae[_0xbb9e('0x5a')]=_0x369327;return _0x48e5ae;})[_0xbb9e('0x22')](respondWithFilteredResult(_0x5aee7c,_0x21123a))[_0xbb9e('0x5b')](handleError(_0x5aee7c,null));};exports[_0xbb9e('0x5c')]=function(_0x41b578,_0x1073e7){var _0x336eb9={'raw':![],'where':{'id':_0x41b578['params']['id']},'include':[{'model':db[_0xbb9e('0x3f')],'as':_0xbb9e('0x40')}]},_0x128592={};_0x128592[_0xbb9e('0x47')]=_[_0xbb9e('0x49')](db[_0xbb9e('0x42')][_0xbb9e('0x43')]);_0x128592[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x41b578['query']);_0x128592['filters']=_['intersection'](_0x128592[_0xbb9e('0x47')],_0x128592[_0xbb9e('0x48')]);_0x336eb9[_0xbb9e('0x4c')]=_['intersection'](_0x128592['model'],qs[_0xbb9e('0x4d')](_0x41b578[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x336eb9[_0xbb9e('0x4c')]=_0x336eb9[_0xbb9e('0x4c')]['length']?_0x336eb9[_0xbb9e('0x4c')]:_0x128592['model'];if(_0x41b578[_0xbb9e('0x48')]['includeAll']){_0x336eb9[_0xbb9e('0x58')]=[{'all':!![]}];}_0x336eb9=_[_0xbb9e('0x5d')]({},_0x336eb9,_0x41b578[_0xbb9e('0x56')]);return db[_0xbb9e('0x42')][_0xbb9e('0x5e')](_0x336eb9)[_0xbb9e('0x22')](handleEntityNotFound(_0x1073e7,null))[_0xbb9e('0x22')](respondWithResult(_0x1073e7,null))[_0xbb9e('0x5b')](handleError(_0x1073e7,null));};exports[_0xbb9e('0x5f')]=function(_0x40edc7,_0x3ac370){return db['WhatsappAccount'][_0xbb9e('0x5f')](_0x40edc7[_0xbb9e('0x60')],{})['then'](function(_0x1d2caf){var _0x16e287=_0x40edc7['user'][_0xbb9e('0x61')]({'plain':!![]});if(!_0x16e287)throw new Error(_0xbb9e('0x62'));if(_0x16e287[_0xbb9e('0x63')]===_0xbb9e('0x64')){var _0x482a32=_0x1d2caf['get']({'plain':!![]});var _0x4151f1=_0xbb9e('0x39');return db['UserProfileSection'][_0xbb9e('0x5e')]({'where':{'name':_0x4151f1,'userProfileId':_0x16e287['userProfileId']},'raw':!![]})[_0xbb9e('0x22')](function(_0x57f8d5){if(_0x57f8d5&&_0x57f8d5[_0xbb9e('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x482a32[_0xbb9e('0x3c')],'resourceId':_0x482a32['id'],'type':_0x57f8d5[_0xbb9e('0x3c')],'sectionId':_0x57f8d5['id']},{})[_0xbb9e('0x22')](function(){return _0x1d2caf;});}else{return _0x1d2caf;}})[_0xbb9e('0x5b')](function(_0x25f258){logger[_0xbb9e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25f258);throw _0x25f258;});}return _0x1d2caf;})['then'](respondWithResult(_0x3ac370,0xc9))['catch'](handleError(_0x3ac370,null));};exports[_0xbb9e('0x66')]=function(_0x39deb0,_0x468e3d){if(_0x39deb0['body']['id']){delete _0x39deb0[_0xbb9e('0x60')]['id'];}return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x39deb0[_0xbb9e('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0xbb9e('0x40')}]})[_0xbb9e('0x22')](handleEntityNotFound(_0x468e3d,null))['then'](saveUpdates(_0x39deb0['body'],null))['then'](respondWithResult(_0x468e3d,null))[_0xbb9e('0x5b')](handleError(_0x468e3d,null));};exports[_0xbb9e('0x38')]=function(_0x114129,_0x19302f){return db['WhatsappAccount'][_0xbb9e('0x5e')]({'where':{'id':_0x114129[_0xbb9e('0x67')]['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0x19302f,null))['then'](removeEntity(_0x19302f,null))['catch'](handleError(_0x19302f,null));};exports[_0xbb9e('0x68')]=function(_0x4962ad,_0x3fd6e2){return db[_0xbb9e('0x42')][_0xbb9e('0x68')]()[_0xbb9e('0x22')](respondWithResult(_0x3fd6e2,null))[_0xbb9e('0x5b')](handleError(_0x3fd6e2,null));};exports[_0xbb9e('0x69')]=function(_0x3517a7,_0x5a0253,_0x2a1821){if(_0x3517a7[_0xbb9e('0x60')]['id']){delete _0x3517a7[_0xbb9e('0x60')]['id'];}return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x3517a7[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x5a0253,null))[_0xbb9e('0x22')](function(_0x32fb50){if(_0x32fb50){_0x3517a7[_0xbb9e('0x60')]['WhatsappAccountId']=_0x32fb50['id'];return db[_0xbb9e('0x6a')][_0xbb9e('0x5f')](_0x3517a7[_0xbb9e('0x60')]);}})[_0xbb9e('0x22')](respondWithResult(_0x5a0253,null))[_0xbb9e('0x5b')](handleError(_0x5a0253,null));};exports[_0xbb9e('0x6b')]=function(_0x5c674d,_0x5a9854,_0x10fa90){var _0x13d372={'raw':![],'where':{}};var _0x427c69={};var _0x3f0c6d={'count':0x0,'rows':[]};return db[_0xbb9e('0x42')][_0xbb9e('0x6c')]({'where':{'id':_0x5c674d['params']['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0x5a9854,null))[_0xbb9e('0x22')](function(_0x20025c){if(_0x20025c){_0x427c69[_0xbb9e('0x47')]=_[_0xbb9e('0x49')](db[_0xbb9e('0x6a')][_0xbb9e('0x43')]);_0x427c69[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x5c674d['query']);_0x427c69['filters']=_[_0xbb9e('0x4b')](_0x427c69[_0xbb9e('0x47')],_0x427c69[_0xbb9e('0x48')]);_0x13d372[_0xbb9e('0x4c')]=_[_0xbb9e('0x4b')](_0x427c69['model'],qs[_0xbb9e('0x4d')](_0x5c674d[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x13d372['attributes']=_0x13d372[_0xbb9e('0x4c')]['length']?_0x13d372['attributes']:_0x427c69[_0xbb9e('0x47')];if(!_0x5c674d['query'][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x13d372[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x5c674d['query'][_0xbb9e('0x30')]);_0x13d372[_0xbb9e('0x32')]=qs['offset'](_0x5c674d[_0xbb9e('0x48')]['offset']);}_0x13d372['order']=qs[_0xbb9e('0x51')](_0x5c674d[_0xbb9e('0x48')]['sort']);_0x13d372['where']=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x5c674d[_0xbb9e('0x48')],_0x427c69['filters']));_0x13d372['where'][_0xbb9e('0x6d')]=_0x20025c['id'];if(_0x5c674d[_0xbb9e('0x48')][_0xbb9e('0x54')]){_0x13d372[_0xbb9e('0x52')]=_[_0xbb9e('0x5d')](_0x13d372[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x13d372[_0xbb9e('0x4c')],function(_0x421cb0){var _0x4399fd={};_0x4399fd[_0x421cb0]={'$like':'%'+_0x5c674d[_0xbb9e('0x48')]['filter']+'%'};return _0x4399fd;})});}_0x13d372=_[_0xbb9e('0x5d')]({},_0x13d372,_0x5c674d[_0xbb9e('0x56')]);return db[_0xbb9e('0x6a')][_0xbb9e('0x31')]({'where':_0x13d372[_0xbb9e('0x52')]})[_0xbb9e('0x22')](function(_0x1013e1){_0x3f0c6d['count']=_0x1013e1;if(_0x5c674d[_0xbb9e('0x48')]['includeAll']){_0x13d372[_0xbb9e('0x58')]=[{'all':!![]}];}return db[_0xbb9e('0x6a')][_0xbb9e('0x59')](_0x13d372);})['then'](function(_0x31b6bf){_0x3f0c6d[_0xbb9e('0x5a')]=_0x31b6bf;return _0x3f0c6d;});}})[_0xbb9e('0x22')](respondWithFilteredResult(_0x5a9854,_0x13d372))[_0xbb9e('0x5b')](handleError(_0x5a9854,null));};exports[_0xbb9e('0x6e')]=function(_0xc9dbd8,_0x7b94,_0xdf99a7){return db['WhatsappAccount']['find']({'where':{'id':_0xc9dbd8[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x7b94,null))[_0xbb9e('0x22')](function(_0x28213b){if(_0x28213b){return _0x28213b[_0xbb9e('0x6e')](_0xc9dbd8[_0xbb9e('0x48')][_0xbb9e('0x6f')]);}})[_0xbb9e('0x22')](respondWithStatusCode(_0x7b94,null))[_0xbb9e('0x5b')](handleError(_0x7b94,null));};exports[_0xbb9e('0x70')]=function(_0xdda4ec,_0x410b59,_0x13884d){if(_0xdda4ec['body']['id']){delete _0xdda4ec[_0xbb9e('0x60')]['id'];}return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0xdda4ec[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x410b59,null))[_0xbb9e('0x22')](function(_0x5593e4){if(_0x5593e4){_0xdda4ec[_0xbb9e('0x60')]['WhatsappAccountId']=_0x5593e4['id'];return db[_0xbb9e('0x71')][_0xbb9e('0x5f')](_0xdda4ec[_0xbb9e('0x60')]);}})[_0xbb9e('0x22')](respondWithResult(_0x410b59,null))[_0xbb9e('0x5b')](handleError(_0x410b59,null));};exports[_0xbb9e('0x72')]=function(_0x16692a,_0x7390c,_0x501690){var _0x3fc9e4={'raw':![],'where':{}};var _0x3c68d7={};var _0x2bdd83={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x16692a['params']['id']}})['then'](handleEntityNotFound(_0x7390c,null))[_0xbb9e('0x22')](function(_0x164446){if(_0x164446){_0x3c68d7['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x3c68d7[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x16692a[_0xbb9e('0x48')]);_0x3c68d7[_0xbb9e('0x4a')]=_['intersection'](_0x3c68d7['model'],_0x3c68d7[_0xbb9e('0x48')]);_0x3fc9e4[_0xbb9e('0x4c')]=_[_0xbb9e('0x4b')](_0x3c68d7[_0xbb9e('0x47')],qs[_0xbb9e('0x4d')](_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x3fc9e4[_0xbb9e('0x4c')]=_0x3fc9e4[_0xbb9e('0x4c')][_0xbb9e('0x73')]?_0x3fc9e4[_0xbb9e('0x4c')]:_0x3c68d7['model'];if(!_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x3fc9e4[_0xbb9e('0x30')]=qs['limit'](_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x30')]);_0x3fc9e4[_0xbb9e('0x32')]=qs[_0xbb9e('0x32')](_0x16692a['query'][_0xbb9e('0x32')]);}_0x3fc9e4['order']=qs['sort'](_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x51')]);_0x3fc9e4['where']=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x16692a[_0xbb9e('0x48')],_0x3c68d7[_0xbb9e('0x4a')]));_0x3fc9e4[_0xbb9e('0x52')][_0xbb9e('0x6d')]=_0x164446['id'];if(_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x54')]){_0x3fc9e4['where']=_[_0xbb9e('0x5d')](_0x3fc9e4[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x3fc9e4[_0xbb9e('0x4c')],function(_0x10cd02){var _0x10d92c={};_0x10d92c[_0x10cd02]={'$like':'%'+_0x16692a[_0xbb9e('0x48')]['filter']+'%'};return _0x10d92c;})});}_0x3fc9e4=_[_0xbb9e('0x5d')]({},_0x3fc9e4,_0x16692a[_0xbb9e('0x56')]);return db[_0xbb9e('0x71')][_0xbb9e('0x31')]({'where':_0x3fc9e4[_0xbb9e('0x52')]})[_0xbb9e('0x22')](function(_0x587df0){_0x2bdd83[_0xbb9e('0x31')]=_0x587df0;if(_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x57')]){_0x3fc9e4[_0xbb9e('0x58')]=[{'all':!![]}];}return db[_0xbb9e('0x71')][_0xbb9e('0x59')](_0x3fc9e4);})['then'](function(_0x322f96){_0x2bdd83['rows']=_0x322f96;return _0x2bdd83;});}})[_0xbb9e('0x22')](respondWithFilteredResult(_0x7390c,_0x3fc9e4))[_0xbb9e('0x5b')](handleError(_0x7390c,null));};exports[_0xbb9e('0x74')]=function(_0x2e98e8,_0x213b5b,_0x18976a){return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x2e98e8['params']['id']}})['then'](handleEntityNotFound(_0x213b5b,null))[_0xbb9e('0x22')](function(_0x2f10aa){if(_0x2f10aa){return _0x2f10aa[_0xbb9e('0x74')](_0x2e98e8[_0xbb9e('0x48')][_0xbb9e('0x6f')]);}})[_0xbb9e('0x22')](respondWithStatusCode(_0x213b5b,null))[_0xbb9e('0x5b')](handleError(_0x213b5b,null));};exports['addAgents']=function(_0xfdb39d,_0x26e25f,_0x4e9a5b){return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0xfdb39d['params']['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0x26e25f,null))[_0xbb9e('0x22')](function(_0x1787f1){if(_0x1787f1){return _0x1787f1['addAgents'](_0xfdb39d[_0xbb9e('0x60')][_0xbb9e('0x6f')],_[_0xbb9e('0x75')](_0xfdb39d['body'],['ids','id'])||{})['spread'](function(_0x6a54ba){for(var _0x362503=0x0;_0x362503<_0xfdb39d[_0xbb9e('0x60')][_0xbb9e('0x6f')]['length'];_0x362503+=0x1){socket['emit'](_0xbb9e('0x76'),{'UserId':Number(_0xfdb39d['body']['ids'][_0x362503]),'WhatsappAccountId':Number(_0xfdb39d[_0xbb9e('0x67')]['id'])});}return _0x6a54ba;});}})[_0xbb9e('0x22')](respondWithResult(_0x26e25f,null))[_0xbb9e('0x5b')](handleError(_0x26e25f,null));};exports[_0xbb9e('0x77')]=function(_0x94373b,_0xd6ea67,_0x33472a){return db[_0xbb9e('0x42')]['find']({'where':{'id':_0x94373b[_0xbb9e('0x67')]['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0xd6ea67,null))[_0xbb9e('0x22')](function(_0x4a7df9){if(_0x4a7df9){return _0x4a7df9[_0xbb9e('0x77')](_0x94373b['query'][_0xbb9e('0x6f')])[_0xbb9e('0x22')](function(){if(_[_0xbb9e('0x78')](_0x94373b[_0xbb9e('0x48')][_0xbb9e('0x6f')])){for(var _0x3c9719=0x0;_0x3c9719<_0x94373b[_0xbb9e('0x48')]['ids'][_0xbb9e('0x73')];_0x3c9719+=0x1){socket[_0xbb9e('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x94373b['query'][_0xbb9e('0x6f')][_0x3c9719]),'WhatsappAccountId':Number(_0x94373b[_0xbb9e('0x67')]['id'])});}}else{socket[_0xbb9e('0x79')](_0xbb9e('0x7a'),{'UserId':Number(_0x94373b[_0xbb9e('0x48')][_0xbb9e('0x6f')]),'WhatsappAccountId':Number(_0x94373b[_0xbb9e('0x67')]['id'])});}});}})[_0xbb9e('0x22')](respondWithStatusCode(_0xd6ea67,null))[_0xbb9e('0x5b')](handleError(_0xd6ea67,null));};exports['getAgents']=function(_0x5b11b2,_0x3891fb,_0x2bb780){var _0x292d55={};var _0x2cd188={};var _0x10f02d;var _0x5bce79;return db[_0xbb9e('0x42')][_0xbb9e('0x6c')]({'where':{'id':_0x5b11b2[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x3891fb,null))['then'](function(_0x4bc436){if(_0x4bc436){_0x10f02d=_0x4bc436;_0x2cd188[_0xbb9e('0x47')]=_[_0xbb9e('0x49')](db[_0xbb9e('0x7b')][_0xbb9e('0x43')]);_0x2cd188[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x5b11b2[_0xbb9e('0x48')]);_0x2cd188[_0xbb9e('0x4a')]=_[_0xbb9e('0x4b')](_0x2cd188['model'],_0x2cd188[_0xbb9e('0x48')]);_0x292d55[_0xbb9e('0x4c')]=_['intersection'](_0x2cd188[_0xbb9e('0x47')],qs[_0xbb9e('0x4d')](_0x5b11b2[_0xbb9e('0x48')]['fields']));_0x292d55[_0xbb9e('0x4c')]=_0x292d55[_0xbb9e('0x4c')][_0xbb9e('0x73')]?_0x292d55[_0xbb9e('0x4c')]:_0x2cd188[_0xbb9e('0x47')];_0x292d55[_0xbb9e('0x50')]=qs[_0xbb9e('0x51')](_0x5b11b2[_0xbb9e('0x48')]['sort']);_0x292d55[_0xbb9e('0x52')]=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x5b11b2[_0xbb9e('0x48')],_0x2cd188[_0xbb9e('0x4a')]));if(_0x5b11b2[_0xbb9e('0x48')]['filter']){_0x292d55[_0xbb9e('0x52')]=_[_0xbb9e('0x5d')](_0x292d55[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x292d55[_0xbb9e('0x4c')],function(_0x5afc78){var _0x4d7ee5={};_0x4d7ee5[_0x5afc78]={'$like':'%'+_0x5b11b2[_0xbb9e('0x48')][_0xbb9e('0x54')]+'%'};return _0x4d7ee5;})});}_0x292d55=_[_0xbb9e('0x5d')]({},_0x292d55,_0x5b11b2[_0xbb9e('0x56')]);return _0x10f02d[_0xbb9e('0x7c')](_0x292d55);}})[_0xbb9e('0x22')](function(_0x4def48){if(_0x4def48){_0x5bce79=_0x4def48['length'];if(!_0x5b11b2[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x292d55[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x5b11b2[_0xbb9e('0x48')]['limit']);_0x292d55['offset']=qs['offset'](_0x5b11b2['query'][_0xbb9e('0x32')]);}return _0x10f02d['getAgents'](_0x292d55);}})[_0xbb9e('0x22')](function(_0x444d61){if(_0x444d61){return _0x444d61?{'count':_0x5bce79,'rows':_0x444d61}:null;}})['then'](respondWithResult(_0x3891fb,null))[_0xbb9e('0x5b')](handleError(_0x3891fb,null));};exports[_0xbb9e('0x7d')]=function(_0x13eb01,_0x16763d){var _0x4961bf=_0x13eb01[_0xbb9e('0x67')]['id'];var _0x5fb59d=_0x13eb01[_0xbb9e('0x60')];var _0x35de15=0xc8;var _0x29bad7=null;return db[_0xbb9e('0x7e')]['transaction']({'isolationLevel':db[_0xbb9e('0x7e')][_0xbb9e('0x7f')][_0xbb9e('0x80')][_0xbb9e('0x81')]},function(_0x57b522){return db[_0xbb9e('0x42')][_0xbb9e('0x6c')]({'where':{'id':_0x4961bf},'transaction':_0x57b522})[_0xbb9e('0x22')](function(_0x3207ae){if(_0x3207ae){return db[_0xbb9e('0x82')][_0xbb9e('0x38')]({'where':{'WhatsappAccountId':_0x4961bf},'transaction':_0x57b522})[_0xbb9e('0x22')](function(){var _0x41fd47=_['map'](_0x5fb59d,function(_0x5c1b1c){_0x5c1b1c[_0xbb9e('0x6d')]=_0x4961bf;return _0x5c1b1c;});return db['WhatsappApplication'][_0xbb9e('0x83')](_0x41fd47,{'transaction':_0x57b522});});}else{_0x35de15=0x194;_0x29bad7=[];}});})[_0xbb9e('0x22')](function(){if(_0x35de15!==0x194){return db['WhatsappApplication'][_0xbb9e('0x84')]({'where':{'WhatsappAccountId':_0x4961bf},'order':_0xbb9e('0x85')})[_0xbb9e('0x22')](function(_0x472177){_0x29bad7=_0x472177;});}})[_0xbb9e('0x5b')](function(_0x15edce){_0x35de15=0x1f4;logger['error'](_0x15edce[_0xbb9e('0x3b')]);if(_0x15edce['name']){delete _0x15edce['name'];}_0x29bad7=_0x15edce;})[_0xbb9e('0x86')](function(){if(_0x29bad7===null){_0x16763d[_0xbb9e('0x2c')](_0x35de15);}else{if(_0x35de15===0x1f4){_0x16763d['status'](_0x35de15)[_0xbb9e('0x3d')](_0x29bad7);}else{_0x16763d[_0xbb9e('0x2d')](_0x35de15)[_0xbb9e('0x34')](_0x29bad7);}}});};exports[_0xbb9e('0x87')]=function(_0x583f84,_0xb3a180,_0x13ca41){var _0x7a9f9d={};var _0x471da4={};var _0x5e8712;var _0xa111d6;return db['WhatsappAccount']['findOne']({'where':{'id':_0x583f84[_0xbb9e('0x67')]['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0xb3a180,null))['then'](function(_0x268a45){if(_0x268a45){_0x5e8712=_0x268a45;_0x471da4[_0xbb9e('0x47')]=_['keys'](db[_0xbb9e('0x82')][_0xbb9e('0x43')]);_0x471da4['query']=_['keys'](_0x583f84['query']);_0x471da4[_0xbb9e('0x4a')]=_['intersection'](_0x471da4[_0xbb9e('0x47')],_0x471da4['query']);_0x7a9f9d[_0xbb9e('0x4c')]=_['intersection'](_0x471da4[_0xbb9e('0x47')],qs['fields'](_0x583f84[_0xbb9e('0x48')]['fields']));_0x7a9f9d['attributes']=_0x7a9f9d[_0xbb9e('0x4c')][_0xbb9e('0x73')]?_0x7a9f9d[_0xbb9e('0x4c')]:_0x471da4[_0xbb9e('0x47')];_0x7a9f9d[_0xbb9e('0x50')]=qs[_0xbb9e('0x51')](_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x51')]);_0x7a9f9d['where']=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x583f84[_0xbb9e('0x48')],_0x471da4['filters']));if(_0x583f84[_0xbb9e('0x48')]['filter']){_0x7a9f9d[_0xbb9e('0x52')]=_['merge'](_0x7a9f9d['where'],{'$or':_['map'](_0x7a9f9d[_0xbb9e('0x4c')],function(_0x38403e){var _0x465350={};_0x465350[_0x38403e]={'$like':'%'+_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x54')]+'%'};return _0x465350;})});}_0x7a9f9d=_[_0xbb9e('0x5d')]({},_0x7a9f9d,_0x583f84['options']);return _0x5e8712['getApplications'](_0x7a9f9d);}})[_0xbb9e('0x22')](function(_0xbd8aa8){if(_0xbd8aa8){_0xa111d6=_0xbd8aa8[_0xbb9e('0x73')];if(!_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x7a9f9d[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x583f84[_0xbb9e('0x48')]['limit']);_0x7a9f9d[_0xbb9e('0x32')]=qs['offset'](_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x32')]);}return _0x5e8712['getApplications'](_0x7a9f9d);}})[_0xbb9e('0x22')](function(_0x309077){if(_0x309077){return _0x309077?{'count':_0xa111d6,'rows':_0x309077}:null;}})[_0xbb9e('0x22')](respondWithResult(_0xb3a180,null))['catch'](handleError(_0xb3a180,null));};exports[_0xbb9e('0x88')]=function(_0x459330,_0x553143,_0x16d4d0){var _0x405d61={'channel':_0xbb9e('0x89')};var _0x499abe=[];var _0x21b83a=[];var _0x1dc01b={};return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x459330[_0xbb9e('0x67')]['id']},'include':[{'model':db[_0xbb9e('0x82')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x553143,null))[_0xbb9e('0x22')](function(_0x43f1ed){_0x405d61[_0xbb9e('0x8a')]=_0x43f1ed;if(_0x405d61[_0xbb9e('0x8a')]&&_0x405d61[_0xbb9e('0x8a')]['type']==='sinch'&&_0x459330[_0xbb9e('0x60')]['statuses']){if(_0x459330['body']['statuses'][_0xbb9e('0x73')]===0x0)return;if(_0x459330[_0xbb9e('0x60')]['statuses'][0x0][_0xbb9e('0x8b')]!=='read')return;return db[_0xbb9e('0x8c')][_0xbb9e('0x66')]({'read':!![],'readAt':_0x459330[_0xbb9e('0x60')][_0xbb9e('0x8d')][0x0][_0xbb9e('0x8e')]},{'where':{'messageId':_0x459330['body'][_0xbb9e('0x8d')][0x0][_0xbb9e('0x8f')]},'individualHooks':!![]})['then'](function(_0x31809c){return _0x553143[_0xbb9e('0x2d')](0xc8)[_0xbb9e('0x34')](_0x31809c);});}_0x405d61[_0xbb9e('0x90')]=_['orderBy'](_0x43f1ed['Applications'],[_0xbb9e('0x85')],[_0xbb9e('0x91')]);if(_0x405d61[_0xbb9e('0x8a')]['Applications']){delete _0x405d61[_0xbb9e('0x8a')]['Applications'];}return db[_0xbb9e('0x92')][_0xbb9e('0x68')]()[_0xbb9e('0x22')](function(_0x4114ff){if(!_0x4114ff){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))]('no\x20available\x20attributes');}_0x499abe=_['difference'](_['keys'](_0x4114ff),[_0xbb9e('0x95'),_0xbb9e('0x96')]);_0x21b83a=_['difference'](_[_0xbb9e('0x49')](_0x4114ff),[_0xbb9e('0x95'),'updatedAt',_0xbb9e('0x97'),_0xbb9e('0x98')]);_0x405d61[_0xbb9e('0x60')]={'mapKey':_0xbb9e('0x99')};if(_0x405d61[_0xbb9e('0x8a')]&&_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x45')]===_0xbb9e('0x9a')){_0x405d61[_0xbb9e('0x60')]['from']=_0x459330[_0xbb9e('0x60')]['From']['replace']('whatsapp:','');_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x60')]=_0x459330['body'][_0xbb9e('0x9b')];_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9c')]=_0x459330[_0xbb9e('0x60')][_0xbb9e('0x9d')];}if(_0x405d61[_0xbb9e('0x8a')]&&_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x45')]===_0xbb9e('0x9e')){_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')]=_0x459330['body'][_0xbb9e('0xa0')][0x0][_0xbb9e('0x9f')];_0x405d61[_0xbb9e('0x60')]['body']=_0x459330['body'][_0xbb9e('0xa0')][0x0][_0xbb9e('0x29')]['body'];_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9c')]=_0x459330[_0xbb9e('0x60')][_0xbb9e('0xa0')][0x0][_0xbb9e('0x8f')];}if(_0x405d61[_0xbb9e('0x60')]['id']){delete _0x405d61['body']['id'];}if(_[_0xbb9e('0xa1')](_0x405d61['body'][_0xbb9e('0x9f')])){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))](_0xbb9e('0xa2'));}if(_[_0xbb9e('0xa1')](_0x405d61['body'][_0xbb9e('0x60')])||_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x60')]===''){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))](_0xbb9e('0xa3'));}if(_[_0xbb9e('0xa1')](_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xa4')])){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))](_0xbb9e('0xa5')+_0x21b83a);}if(!_[_0xbb9e('0xa6')](_0x21b83a,_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xa4')])){throw new db['Sequelize']['ValidationError'](_0xbb9e('0xa7')+_0x21b83a);}_0x1dc01b[_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xa4')]]=_0x405d61['body'][_0xbb9e('0x9f')];return db[_0xbb9e('0xa8')][_0xbb9e('0x5e')]({'where':{'id':_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x98')]},'include':[{'model':db['CmContact'],'as':_0xbb9e('0xa9'),'where':_0x1dc01b,'limit':0x1,'order':[[_0xbb9e('0x96'),_0xbb9e('0xaa')]]}]});})[_0xbb9e('0x22')](handleEntityNotFound(_0x553143,null))[_0xbb9e('0x22')](function(_0x4d91e7){if(_0x4d91e7){_0x405d61[_0xbb9e('0xab')]=_['omit'](_0x4d91e7,[_0xbb9e('0xa9')]);if(_0x4d91e7[_0xbb9e('0xa9')][_0xbb9e('0x73')]){return _0x4d91e7['Contacts'][0x0];}var _0x2d62ed=_[_0xbb9e('0x1a')](_0x405d61[_0xbb9e('0x60')],{'firstName':_0x405d61['body'][_0xbb9e('0x9f')],'ListId':_0x4d91e7['id']});_0x2d62ed[_0x405d61[_0xbb9e('0x60')]['mapKey']]=_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')];return db[_0xbb9e('0x92')][_0xbb9e('0x5f')](_0x2d62ed,{'fields':_0x499abe,'raw':!![]});}})[_0xbb9e('0x22')](handleEntityNotFound(_0x553143,null))['then'](function(_0x377c6a){if(_0x377c6a){_0x405d61[_0xbb9e('0xac')]=_0x377c6a;var _0x1d0064={'ContactId':_0x377c6a['id'],'phone':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')],'WhatsappAccountId':_0x459330[_0xbb9e('0x67')]['id']};var _0x261bf7={'ContactId':_0x377c6a['id'],'WhatsappAccountId':_0x459330['params']['id'],'closed':![]};return db[_0xbb9e('0xad')][_0xbb9e('0x5e')]({'where':_0x261bf7})[_0xbb9e('0x22')](function(_0x3e3c5f){if(_0x3e3c5f){return[_0x3e3c5f,![]];}return db[_0xbb9e('0xad')][_0xbb9e('0x5f')](_0x1d0064)[_0xbb9e('0x22')](function(_0x344269){return[_0x344269,!![]];});});}})[_0xbb9e('0xae')](function(_0x1f6893,_0x3ee656){_0x405d61[_0xbb9e('0xaf')]=_0x1f6893[_0xbb9e('0x61')]({'plain':!![]});_0x405d61[_0xbb9e('0xaf')][_0xbb9e('0xb0')]=![];if(_0x3ee656){if(_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0xb1')]){_0x405d61[_0xbb9e('0x90')][_0xbb9e('0xb2')]({'id':0x0,'priority':_0x405d61[_0xbb9e('0x90')][_0xbb9e('0x73')]+0x1,'app':_0xbb9e('0xb3'),'appdata':'unmanaged','interval':_0xbb9e('0xb4')});}_0x405d61[_0xbb9e('0xaf')]['created']=!![];}return db[_0xbb9e('0x8c')][_0xbb9e('0x5f')]({'phone':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')],'messageId':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9c')],'body':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x60')],'WhatsappAccountId':_0x459330[_0xbb9e('0x67')]['id'],'WhatsappInteractionId':_0x1f6893['id'],'direction':'in','ContactId':_0x1f6893['ContactId'],'AttachmentId':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xb5')]});})[_0xbb9e('0x22')](function(_0x2d2e1d){_0x405d61[_0xbb9e('0x29')]=_0x2d2e1d;if(_0x405d61[_0xbb9e('0xaf')][_0xbb9e('0xb6')]){return db[_0xbb9e('0x7b')][_0xbb9e('0x5e')]({'attributes':['id',_0xbb9e('0x3c')],'where':{'id':_0x405d61['interaction'][_0xbb9e('0xb6')]}})['then'](function(_0x1b6a49){if(_0x1b6a49){_0x405d61[_0xbb9e('0x90')][_0xbb9e('0xb7')]({'id':0x0,'priority':0x0,'app':_0xbb9e('0xb8'),'appdata':_0x1b6a49[_0xbb9e('0x3c')]+','+(_0x405d61['account'][_0xbb9e('0xb9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xbb9e('0xba'),_0x405d61);});}return respondWithRpcPromise(_0xbb9e('0xbb'),_0xbb9e('0xba'),_0x405d61);})[_0xbb9e('0x22')](function(_0x98d4e9){if(_0x98d4e9){var _0x5b31fb=0xc8;var _0x2e5dc4=_0xbb9e('0xbc');logger[_0xbb9e('0x2a')](_0xbb9e('0x25'),_0x2e5dc4,_0x5b31fb,_0xbb9e('0xbd'));logger[_0xbb9e('0xbe')](_0xbb9e('0xbf'),_0x2e5dc4,_0x5b31fb,_0xbb9e('0xbd'),JSON['stringify'](_0x98d4e9));if(_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x45')]===_0xbb9e('0x9a')){return _0x553143[_0xbb9e('0x2d')](_0x5b31fb)[_0xbb9e('0xc0')](_0xbb9e('0xc1'),'text/xml')[_0xbb9e('0x3d')]('\x0a');}else{return _0x553143[_0xbb9e('0x2d')](_0x5b31fb)[_0xbb9e('0x34')](_0x98d4e9);}}});})[_0xbb9e('0x5b')](handleError(_0x553143,null));};exports[_0xbb9e('0x3d')]=function(_0x1696b2,_0x20f5e1,_0x4aa074){var _0x21cbfd,_0x4829fe,_0x23d576;if(_[_0xbb9e('0xa1')](_0x1696b2[_0xbb9e('0x60')][_0xbb9e('0x60')])||_0x1696b2[_0xbb9e('0x60')]['body']===''){throw new db['Sequelize'][(_0xbb9e('0x94'))](_0xbb9e('0xa3'));}if(_['isNil'](_0x1696b2[_0xbb9e('0x60')]['to'])){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))]('to\x20is\x20mandatory');}_0x21cbfd=_0x1696b2[_0xbb9e('0x60')]['to'];return db[_0xbb9e('0x42')]['find']({'where':{'id':_0x1696b2[_0xbb9e('0x67')]['id']},'include':[{'model':db[_0xbb9e('0xa8')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x21cbfd},'limit':0x1,'order':[[_0xbb9e('0x96'),_0xbb9e('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x20f5e1,null))[_0xbb9e('0x22')](function(_0x1e609b){if(_0x1e609b&&_0x1e609b[_0xbb9e('0xc2')]){_0x4829fe=_0x1e609b[_0xbb9e('0x61')]({'plain':!![]});if(_0x4829fe['List']&&_0x4829fe['List'][_0xbb9e('0xa9')][_0xbb9e('0x73')]){return _0x4829fe[_0xbb9e('0xc2')]['Contacts'][0x0];}return db[_0xbb9e('0x92')][_0xbb9e('0x5f')](_[_0xbb9e('0x1a')](_0x1696b2['body'],{'firstName':_0x21cbfd,'mobile':_0x21cbfd,'phone':_0x21cbfd,'ListId':_0x4829fe[_0xbb9e('0x98')]}));}})[_0xbb9e('0x22')](handleEntityNotFound(_0x20f5e1,null))[_0xbb9e('0x22')](function(_0x245b38){if(_0x245b38){_0x23d576=_0x245b38;return db[_0xbb9e('0xad')][_0xbb9e('0x5e')]({'where':{'ContactId':_0x23d576['id'],'closed':![],'WhatsappAccountId':_0x4829fe['id']}})['then'](function(_0x1279ca){if(_0x1279ca){return[_0x1279ca,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x1696b2[_0xbb9e('0x64')]['id'],'ContactId':_0x23d576['id'],'WhatsappAccountId':_0x4829fe['id'],'phone':_0x21cbfd,'firstMsgDirection':_0xbb9e('0xc3'),'Messages':[_['merge'](_0x1696b2[_0xbb9e('0x60')],{'read':![],'body':_0x1696b2[_0xbb9e('0x60')][_0xbb9e('0x60')],'phone':_0x21cbfd,'WhatsappAccountId':_0x4829fe['id'],'UserId':_0x1696b2[_0xbb9e('0x64')]['id'],'ContactId':_0x23d576['id']})]},{'include':[{'model':db[_0xbb9e('0x8c')],'as':'Messages'}]})[_0xbb9e('0x22')](function(_0x1eb20c){return[_0x1eb20c,!![]];});});}})[_0xbb9e('0xae')](function(_0x5b06a7,_0xcbe338){if(_0xcbe338){return _0x5b06a7;}return db[_0xbb9e('0x8c')][_0xbb9e('0x5f')](_[_0xbb9e('0x5d')](_0x1696b2[_0xbb9e('0x60')],{'read':![],'body':_0x1696b2[_0xbb9e('0x60')][_0xbb9e('0x60')],'phone':_0x21cbfd,'WhatsappAccountId':_0x4829fe['id'],'WhatsappInteractionId':_0x5b06a7['id'],'UserId':_0x1696b2[_0xbb9e('0x64')]['id'],'ContactId':_0x23d576['id']}))[_0xbb9e('0x22')](function(_0x91fcb5){_0x5b06a7['dataValues'][_0xbb9e('0xc4')]=[];_0x5b06a7[_0xbb9e('0xc5')][_0xbb9e('0xc4')]['push'](_0x91fcb5[_0xbb9e('0xc5')]);return _0x5b06a7;});})[_0xbb9e('0x22')](respondWithResult(_0x20f5e1,null))[_0xbb9e('0x5b')](handleError(_0x20f5e1,null));}; \ No newline at end of file +var _0x5115=['getDispositions','findOne','order','removeDispositions','ids','CannedAnswer','nolimit','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','emit','getAgents','User','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','Body','messageId','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','interaction','autoclose','push','close','unmanaged','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','spread','dataValues','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','where','filter','options','includeAll','include','WhatsappAccount','findAll','rows','show','Pause','mandatoryDispositionPause','keys','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','WhatsappAccountId','Disposition'];(function(_0x4e5413,_0x3ebd90){var _0x27f6bc=function(_0x490eda){while(--_0x490eda){_0x4e5413['push'](_0x4e5413['shift']());}};_0x27f6bc(++_0x3ebd90);}(_0x5115,0x1cf));var _0x5511=function(_0x3cadbd,_0x12bc43){_0x3cadbd=_0x3cadbd-0x0;var _0x296da9=_0x5115[_0x3cadbd];return _0x296da9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5511('0x0'));var jsonpatch=require(_0x5511('0x1'));var rp=require('request-promise');var moment=require(_0x5511('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5511('0x3'));var sox=require('sox');var csv=require(_0x5511('0x4'));var ejs=require(_0x5511('0x5'));var fs=require('fs');var fs_extra=require(_0x5511('0x6'));var _=require(_0x5511('0x7'));var squel=require(_0x5511('0x8'));var crypto=require('crypto');var jsforce=require(_0x5511('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5511('0x4'));var querystring=require(_0x5511('0xa'));var Papa=require(_0x5511('0xb'));var Redis=require(_0x5511('0xc'));var authService=require(_0x5511('0xd'));var qs=require(_0x5511('0xe'));var as=require(_0x5511('0xf'));var hardwareService=require(_0x5511('0x10'));var logger=require(_0x5511('0x11'))(_0x5511('0x12'));var utils=require(_0x5511('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5511('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5511('0x15')](config[_0x5511('0x16')],{'host':_0x5511('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5511('0x16')]));require('./whatsappAccount.socket')[_0x5511('0x18')](socket);var jayson=require(_0x5511('0x19'));var client=jayson[_0x5511('0x1a')][_0x5511('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x5c9a22,_0x47d7dc,_0x2b04b6,_0x1435b3){return new BPromise(function(_0x49003e,_0x5f434f){var _0x2ddfb2=_0x1435b3||client;return _0x2ddfb2['request'](_0x5c9a22,_0x2b04b6)[_0x5511('0x1c')](function(_0x2cc5b5){logger[_0x5511('0x1d')](_0x5511('0x1e'),_0x47d7dc,_0x5511('0x1f'));logger[_0x5511('0x20')](_0x5511('0x21'),_0x47d7dc,'request\x20sent',JSON[_0x5511('0x22')](_0x2cc5b5));if(_0x2cc5b5[_0x5511('0x23')]){if(_0x2cc5b5['error'][_0x5511('0x24')]===0x1f4){logger[_0x5511('0x23')](_0x5511('0x1e'),_0x47d7dc,_0x2cc5b5[_0x5511('0x23')][_0x5511('0x25')]);return _0x5f434f(_0x2cc5b5[_0x5511('0x23')][_0x5511('0x25')]);}logger['error'](_0x5511('0x1e'),_0x47d7dc,_0x2cc5b5[_0x5511('0x23')]['message']);return _0x49003e(_0x2cc5b5[_0x5511('0x23')][_0x5511('0x25')]);}else{logger[_0x5511('0x1d')](_0x5511('0x1e'),_0x47d7dc,_0x5511('0x1f'));_0x49003e(_0x2cc5b5[_0x5511('0x26')][_0x5511('0x25')]);}})[_0x5511('0x27')](function(_0x181183){logger[_0x5511('0x23')](_0x5511('0x1e'),_0x47d7dc,_0x181183);_0x5f434f(_0x181183);});});}function respondWithStatusCode(_0x3be596,_0x33f149){_0x33f149=_0x33f149||0xcc;return function(_0x419f7c){if(_0x419f7c){return _0x3be596[_0x5511('0x28')](_0x33f149);}return _0x3be596['status'](_0x33f149)[_0x5511('0x29')]();};}function respondWithResult(_0x2cb4bf,_0x3c0f85){_0x3c0f85=_0x3c0f85||0xc8;return function(_0x2d70d3){if(_0x2d70d3){return _0x2cb4bf[_0x5511('0x2a')](_0x3c0f85)[_0x5511('0x2b')](_0x2d70d3);}};}function respondWithFilteredResult(_0x53adef,_0x3673c9){return function(_0x4fb849){if(_0x4fb849){var _0x56e8ff=typeof _0x3673c9[_0x5511('0x2c')]===_0x5511('0x2d')&&typeof _0x3673c9['limit']==='undefined';var _0x4ec0c2=_0x4fb849['count'];var _0x2a879e=_0x56e8ff?0x0:_0x3673c9['offset'];var _0x53183c=_0x56e8ff?_0x4fb849[_0x5511('0x2e')]:_0x3673c9['offset']+_0x3673c9['limit'];var _0x4ac1d6;if(_0x53183c>=_0x4ec0c2){_0x53183c=_0x4ec0c2;_0x4ac1d6=0xc8;}else{_0x4ac1d6=0xce;}_0x53adef[_0x5511('0x2a')](_0x4ac1d6);return _0x53adef[_0x5511('0x2f')](_0x5511('0x30'),_0x2a879e+'-'+_0x53183c+'/'+_0x4ec0c2)['json'](_0x4fb849);}return null;};}function patchUpdates(_0x5f17d0){return function(_0xb71895){try{jsonpatch[_0x5511('0x31')](_0xb71895,_0x5f17d0,!![]);}catch(_0x2c3345){return BPromise[_0x5511('0x32')](_0x2c3345);}return _0xb71895[_0x5511('0x33')]();};}function saveUpdates(_0x355794,_0xa5e7b0){return function(_0x50b8e8){if(_0x50b8e8){return _0x50b8e8['update'](_0x355794)['then'](function(_0x6a41fa){return _0x6a41fa;});}return null;};}function removeEntity(_0xfdffaf,_0x5c4faa){return function(_0x5f07bb){if(_0x5f07bb){return _0x5f07bb[_0x5511('0x34')]()[_0x5511('0x1c')](function(){var _0x2ad5de=_0x5f07bb[_0x5511('0x35')]({'plain':!![]});var _0x40aaaa=_0x5511('0x36');return db[_0x5511('0x37')][_0x5511('0x34')]({'where':{'type':_0x40aaaa,'resourceId':_0x2ad5de['id']}})[_0x5511('0x1c')](function(){return _0x5f07bb;});})[_0x5511('0x1c')](function(){_0xfdffaf[_0x5511('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9294,_0x5d3e62){return function(_0x381e2f){if(!_0x381e2f){_0x2d9294['sendStatus'](0x194);}return _0x381e2f;};}function handleError(_0x119e67,_0x3d87ed){_0x3d87ed=_0x3d87ed||0x1f4;return function(_0x1a83b1){logger[_0x5511('0x23')](_0x1a83b1[_0x5511('0x38')]);if(_0x1a83b1['name']){delete _0x1a83b1[_0x5511('0x39')];}_0x119e67[_0x5511('0x2a')](_0x3d87ed)['send'](_0x1a83b1);};}exports[_0x5511('0x3a')]=function(_0x2031d9,_0xe54089){var _0x280ac4={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x27f3b6={},_0x4777d0={'count':0x0,'rows':[]};var _0xc0838e=_[_0x5511('0x3b')](db['WhatsappAccount'][_0x5511('0x3c')],function(_0x53e4f5){return{'name':_0x53e4f5['fieldName'],'type':_0x53e4f5[_0x5511('0x3d')]['key']};});_0x27f3b6[_0x5511('0x3e')]=_[_0x5511('0x3b')](_0xc0838e,_0x5511('0x39'));_0x27f3b6[_0x5511('0x3f')]=_['keys'](_0x2031d9[_0x5511('0x3f')]);_0x27f3b6[_0x5511('0x40')]=_[_0x5511('0x41')](_0x27f3b6[_0x5511('0x3e')],_0x27f3b6[_0x5511('0x3f')]);_0x280ac4[_0x5511('0x42')]=_[_0x5511('0x41')](_0x27f3b6[_0x5511('0x3e')],qs[_0x5511('0x43')](_0x2031d9[_0x5511('0x3f')][_0x5511('0x43')]));_0x280ac4['attributes']=_0x280ac4[_0x5511('0x42')][_0x5511('0x44')]?_0x280ac4['attributes']:_0x27f3b6[_0x5511('0x3e')];if(!_0x2031d9[_0x5511('0x3f')][_0x5511('0x45')]('nolimit')){_0x280ac4[_0x5511('0x46')]=qs[_0x5511('0x46')](_0x2031d9['query'][_0x5511('0x46')]);_0x280ac4[_0x5511('0x2c')]=qs['offset'](_0x2031d9['query'][_0x5511('0x2c')]);}_0x280ac4['order']=qs[_0x5511('0x47')](_0x2031d9[_0x5511('0x3f')][_0x5511('0x47')]);_0x280ac4['where']=qs[_0x5511('0x40')](_[_0x5511('0x48')](_0x2031d9[_0x5511('0x3f')],_0x27f3b6['filters']),_0xc0838e);if(_0x2031d9[_0x5511('0x3f')]['filter']){_0x280ac4['where']=_['merge'](_0x280ac4[_0x5511('0x49')],{'$or':_[_0x5511('0x3b')](_0xc0838e,function(_0x40ff53){if(_0x40ff53[_0x5511('0x3d')]!=='VIRTUAL'){var _0xdcd429={};_0xdcd429[_0x40ff53['name']]={'$like':'%'+_0x2031d9['query'][_0x5511('0x4a')]+'%'};return _0xdcd429;}})});}_0x280ac4=_['merge']({},_0x280ac4,_0x2031d9[_0x5511('0x4b')]);var _0x3efc6b={'where':_0x280ac4['where']};return db['WhatsappAccount'][_0x5511('0x2e')](_0x3efc6b)[_0x5511('0x1c')](function(_0x3a5dd0){_0x4777d0['count']=_0x3a5dd0;if(_0x2031d9['query'][_0x5511('0x4c')]){_0x280ac4[_0x5511('0x4d')]=[{'all':!![]}];}return db[_0x5511('0x4e')][_0x5511('0x4f')](_0x280ac4);})[_0x5511('0x1c')](function(_0x318c7b){_0x4777d0[_0x5511('0x50')]=_0x318c7b;return _0x4777d0;})[_0x5511('0x1c')](respondWithFilteredResult(_0xe54089,_0x280ac4))['catch'](handleError(_0xe54089,null));};exports[_0x5511('0x51')]=function(_0x3db974,_0x53cc7b){var _0x5500d7={'raw':![],'where':{'id':_0x3db974['params']['id']},'include':[{'model':db[_0x5511('0x52')],'as':_0x5511('0x53')}]},_0x19e0ea={};_0x19e0ea['model']=_[_0x5511('0x54')](db[_0x5511('0x4e')][_0x5511('0x3c')]);_0x19e0ea[_0x5511('0x3f')]=_[_0x5511('0x54')](_0x3db974[_0x5511('0x3f')]);_0x19e0ea[_0x5511('0x40')]=_[_0x5511('0x41')](_0x19e0ea[_0x5511('0x3e')],_0x19e0ea[_0x5511('0x3f')]);_0x5500d7['attributes']=_[_0x5511('0x41')](_0x19e0ea[_0x5511('0x3e')],qs['fields'](_0x3db974[_0x5511('0x3f')][_0x5511('0x43')]));_0x5500d7[_0x5511('0x42')]=_0x5500d7[_0x5511('0x42')][_0x5511('0x44')]?_0x5500d7[_0x5511('0x42')]:_0x19e0ea[_0x5511('0x3e')];if(_0x3db974[_0x5511('0x3f')]['includeAll']){_0x5500d7[_0x5511('0x4d')]=[{'all':!![]}];}_0x5500d7=_[_0x5511('0x55')]({},_0x5500d7,_0x3db974[_0x5511('0x4b')]);return db[_0x5511('0x4e')][_0x5511('0x56')](_0x5500d7)[_0x5511('0x1c')](handleEntityNotFound(_0x53cc7b,null))[_0x5511('0x1c')](respondWithResult(_0x53cc7b,null))[_0x5511('0x27')](handleError(_0x53cc7b,null));};exports[_0x5511('0x57')]=function(_0x236ecf,_0x430345){return db[_0x5511('0x4e')][_0x5511('0x57')](_0x236ecf['body'],{})[_0x5511('0x1c')](function(_0x419671){var _0x59e300=_0x236ecf[_0x5511('0x58')][_0x5511('0x35')]({'plain':!![]});if(!_0x59e300)throw new Error(_0x5511('0x59'));if(_0x59e300[_0x5511('0x5a')]===_0x5511('0x58')){var _0x1174a7=_0x419671[_0x5511('0x35')]({'plain':!![]});var _0x4e02d0=_0x5511('0x36');return db['UserProfileSection'][_0x5511('0x56')]({'where':{'name':_0x4e02d0,'userProfileId':_0x59e300[_0x5511('0x5b')]},'raw':!![]})[_0x5511('0x1c')](function(_0x817191){if(_0x817191&&_0x817191[_0x5511('0x5c')]===0x0){return db[_0x5511('0x37')][_0x5511('0x57')]({'name':_0x1174a7[_0x5511('0x39')],'resourceId':_0x1174a7['id'],'type':_0x817191['name'],'sectionId':_0x817191['id']},{})[_0x5511('0x1c')](function(){return _0x419671;});}else{return _0x419671;}})[_0x5511('0x27')](function(_0x1e0d5d){logger[_0x5511('0x23')](_0x5511('0x5d'),_0x1e0d5d);throw _0x1e0d5d;});}return _0x419671;})[_0x5511('0x1c')](respondWithResult(_0x430345,0xc9))[_0x5511('0x27')](handleError(_0x430345,null));};exports[_0x5511('0x5e')]=function(_0x365aba,_0x3582cb){if(_0x365aba[_0x5511('0x5f')]['id']){delete _0x365aba[_0x5511('0x5f')]['id'];}return db[_0x5511('0x4e')][_0x5511('0x56')]({'where':{'id':_0x365aba[_0x5511('0x60')]['id']},'include':[{'model':db[_0x5511('0x52')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3582cb,null))[_0x5511('0x1c')](saveUpdates(_0x365aba[_0x5511('0x5f')],null))[_0x5511('0x1c')](respondWithResult(_0x3582cb,null))['catch'](handleError(_0x3582cb,null));};exports[_0x5511('0x34')]=function(_0x54700c,_0x2db2d4){return db[_0x5511('0x4e')]['find']({'where':{'id':_0x54700c[_0x5511('0x60')]['id']}})['then'](handleEntityNotFound(_0x2db2d4,null))['then'](removeEntity(_0x2db2d4,null))[_0x5511('0x27')](handleError(_0x2db2d4,null));};exports[_0x5511('0x61')]=function(_0x738c9a,_0x1dfdd1){return db[_0x5511('0x4e')][_0x5511('0x61')]()[_0x5511('0x1c')](respondWithResult(_0x1dfdd1,null))[_0x5511('0x27')](handleError(_0x1dfdd1,null));};exports[_0x5511('0x62')]=function(_0x558d64,_0x31c35d,_0x57cd71){if(_0x558d64[_0x5511('0x5f')]['id']){delete _0x558d64['body']['id'];}return db[_0x5511('0x4e')][_0x5511('0x56')]({'where':{'id':_0x558d64['params']['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x31c35d,null))[_0x5511('0x1c')](function(_0x3c2db7){if(_0x3c2db7){_0x558d64[_0x5511('0x5f')][_0x5511('0x63')]=_0x3c2db7['id'];return db[_0x5511('0x64')][_0x5511('0x57')](_0x558d64[_0x5511('0x5f')]);}})['then'](respondWithResult(_0x31c35d,null))[_0x5511('0x27')](handleError(_0x31c35d,null));};exports[_0x5511('0x65')]=function(_0x8ae269,_0x35eb95,_0x50c027){var _0x52c2a5={'raw':![],'where':{}};var _0x2bcef2={};var _0x34d6fb={'count':0x0,'rows':[]};return db[_0x5511('0x4e')][_0x5511('0x66')]({'where':{'id':_0x8ae269[_0x5511('0x60')]['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x35eb95,null))['then'](function(_0x3634f6){if(_0x3634f6){_0x2bcef2[_0x5511('0x3e')]=_[_0x5511('0x54')](db[_0x5511('0x64')][_0x5511('0x3c')]);_0x2bcef2[_0x5511('0x3f')]=_[_0x5511('0x54')](_0x8ae269[_0x5511('0x3f')]);_0x2bcef2[_0x5511('0x40')]=_[_0x5511('0x41')](_0x2bcef2[_0x5511('0x3e')],_0x2bcef2[_0x5511('0x3f')]);_0x52c2a5[_0x5511('0x42')]=_['intersection'](_0x2bcef2[_0x5511('0x3e')],qs[_0x5511('0x43')](_0x8ae269[_0x5511('0x3f')][_0x5511('0x43')]));_0x52c2a5[_0x5511('0x42')]=_0x52c2a5[_0x5511('0x42')][_0x5511('0x44')]?_0x52c2a5['attributes']:_0x2bcef2[_0x5511('0x3e')];if(!_0x8ae269[_0x5511('0x3f')][_0x5511('0x45')]('nolimit')){_0x52c2a5['limit']=qs[_0x5511('0x46')](_0x8ae269[_0x5511('0x3f')][_0x5511('0x46')]);_0x52c2a5[_0x5511('0x2c')]=qs[_0x5511('0x2c')](_0x8ae269[_0x5511('0x3f')]['offset']);}_0x52c2a5[_0x5511('0x67')]=qs[_0x5511('0x47')](_0x8ae269[_0x5511('0x3f')][_0x5511('0x47')]);_0x52c2a5[_0x5511('0x49')]=qs[_0x5511('0x40')](_['pick'](_0x8ae269[_0x5511('0x3f')],_0x2bcef2[_0x5511('0x40')]));_0x52c2a5['where']['WhatsappAccountId']=_0x3634f6['id'];if(_0x8ae269['query'][_0x5511('0x4a')]){_0x52c2a5[_0x5511('0x49')]=_[_0x5511('0x55')](_0x52c2a5['where'],{'$or':_[_0x5511('0x3b')](_0x52c2a5[_0x5511('0x42')],function(_0x538f06){var _0x386378={};_0x386378[_0x538f06]={'$like':'%'+_0x8ae269[_0x5511('0x3f')][_0x5511('0x4a')]+'%'};return _0x386378;})});}_0x52c2a5=_[_0x5511('0x55')]({},_0x52c2a5,_0x8ae269[_0x5511('0x4b')]);return db[_0x5511('0x64')][_0x5511('0x2e')]({'where':_0x52c2a5[_0x5511('0x49')]})[_0x5511('0x1c')](function(_0x322956){_0x34d6fb[_0x5511('0x2e')]=_0x322956;if(_0x8ae269['query'][_0x5511('0x4c')]){_0x52c2a5[_0x5511('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0x5511('0x4f')](_0x52c2a5);})[_0x5511('0x1c')](function(_0x10e06b){_0x34d6fb[_0x5511('0x50')]=_0x10e06b;return _0x34d6fb;});}})['then'](respondWithFilteredResult(_0x35eb95,_0x52c2a5))[_0x5511('0x27')](handleError(_0x35eb95,null));};exports[_0x5511('0x68')]=function(_0x11f3c6,_0x2c26b8,_0x432d27){return db['WhatsappAccount'][_0x5511('0x56')]({'where':{'id':_0x11f3c6['params']['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x2c26b8,null))[_0x5511('0x1c')](function(_0x23e575){if(_0x23e575){return _0x23e575['removeDispositions'](_0x11f3c6[_0x5511('0x3f')][_0x5511('0x69')]);}})[_0x5511('0x1c')](respondWithStatusCode(_0x2c26b8,null))[_0x5511('0x27')](handleError(_0x2c26b8,null));};exports['addAnswer']=function(_0x1e1882,_0xbac9ff,_0x495ca5){if(_0x1e1882[_0x5511('0x5f')]['id']){delete _0x1e1882[_0x5511('0x5f')]['id'];}return db[_0x5511('0x4e')][_0x5511('0x56')]({'where':{'id':_0x1e1882[_0x5511('0x60')]['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0xbac9ff,null))[_0x5511('0x1c')](function(_0x18a744){if(_0x18a744){_0x1e1882[_0x5511('0x5f')][_0x5511('0x63')]=_0x18a744['id'];return db[_0x5511('0x6a')][_0x5511('0x57')](_0x1e1882[_0x5511('0x5f')]);}})[_0x5511('0x1c')](respondWithResult(_0xbac9ff,null))[_0x5511('0x27')](handleError(_0xbac9ff,null));};exports['getAnswers']=function(_0x368663,_0x173752,_0x2d37fc){var _0x40f60f={'raw':![],'where':{}};var _0x1df03e={};var _0x5160a6={'count':0x0,'rows':[]};return db[_0x5511('0x4e')][_0x5511('0x66')]({'where':{'id':_0x368663['params']['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x173752,null))[_0x5511('0x1c')](function(_0x2faf49){if(_0x2faf49){_0x1df03e[_0x5511('0x3e')]=_[_0x5511('0x54')](db[_0x5511('0x6a')][_0x5511('0x3c')]);_0x1df03e[_0x5511('0x3f')]=_[_0x5511('0x54')](_0x368663[_0x5511('0x3f')]);_0x1df03e[_0x5511('0x40')]=_[_0x5511('0x41')](_0x1df03e['model'],_0x1df03e[_0x5511('0x3f')]);_0x40f60f[_0x5511('0x42')]=_[_0x5511('0x41')](_0x1df03e[_0x5511('0x3e')],qs[_0x5511('0x43')](_0x368663[_0x5511('0x3f')][_0x5511('0x43')]));_0x40f60f[_0x5511('0x42')]=_0x40f60f[_0x5511('0x42')][_0x5511('0x44')]?_0x40f60f[_0x5511('0x42')]:_0x1df03e[_0x5511('0x3e')];if(!_0x368663[_0x5511('0x3f')][_0x5511('0x45')](_0x5511('0x6b'))){_0x40f60f[_0x5511('0x46')]=qs['limit'](_0x368663['query'][_0x5511('0x46')]);_0x40f60f[_0x5511('0x2c')]=qs[_0x5511('0x2c')](_0x368663[_0x5511('0x3f')]['offset']);}_0x40f60f[_0x5511('0x67')]=qs[_0x5511('0x47')](_0x368663[_0x5511('0x3f')][_0x5511('0x47')]);_0x40f60f[_0x5511('0x49')]=qs['filters'](_['pick'](_0x368663[_0x5511('0x3f')],_0x1df03e[_0x5511('0x40')]));_0x40f60f['where']['WhatsappAccountId']=_0x2faf49['id'];if(_0x368663['query'][_0x5511('0x4a')]){_0x40f60f[_0x5511('0x49')]=_[_0x5511('0x55')](_0x40f60f[_0x5511('0x49')],{'$or':_['map'](_0x40f60f['attributes'],function(_0x33bb77){var _0x2fe591={};_0x2fe591[_0x33bb77]={'$like':'%'+_0x368663[_0x5511('0x3f')]['filter']+'%'};return _0x2fe591;})});}_0x40f60f=_[_0x5511('0x55')]({},_0x40f60f,_0x368663[_0x5511('0x4b')]);return db['CannedAnswer'][_0x5511('0x2e')]({'where':_0x40f60f[_0x5511('0x49')]})[_0x5511('0x1c')](function(_0x569725){_0x5160a6[_0x5511('0x2e')]=_0x569725;if(_0x368663[_0x5511('0x3f')]['includeAll']){_0x40f60f[_0x5511('0x4d')]=[{'all':!![]}];}return db[_0x5511('0x6a')][_0x5511('0x4f')](_0x40f60f);})[_0x5511('0x1c')](function(_0x36e997){_0x5160a6['rows']=_0x36e997;return _0x5160a6;});}})[_0x5511('0x1c')](respondWithFilteredResult(_0x173752,_0x40f60f))[_0x5511('0x27')](handleError(_0x173752,null));};exports[_0x5511('0x6c')]=function(_0x55b6ed,_0xaa045d,_0x4ccd6a){return db['WhatsappAccount'][_0x5511('0x56')]({'where':{'id':_0x55b6ed[_0x5511('0x60')]['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0xaa045d,null))[_0x5511('0x1c')](function(_0x2b4144){if(_0x2b4144){return _0x2b4144[_0x5511('0x6c')](_0x55b6ed[_0x5511('0x3f')][_0x5511('0x69')]);}})['then'](respondWithStatusCode(_0xaa045d,null))[_0x5511('0x27')](handleError(_0xaa045d,null));};exports[_0x5511('0x6d')]=function(_0x1fec8e,_0x2a48b9,_0x15cc36){return db[_0x5511('0x4e')][_0x5511('0x56')]({'where':{'id':_0x1fec8e[_0x5511('0x60')]['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x2a48b9,null))['then'](function(_0x441276){if(_0x441276){return _0x441276[_0x5511('0x6d')](_0x1fec8e[_0x5511('0x5f')][_0x5511('0x69')],_[_0x5511('0x6e')](_0x1fec8e['body'],[_0x5511('0x69'),'id'])||{})['spread'](function(_0x411a36){for(var _0x4e8ef9=0x0;_0x4e8ef9<_0x1fec8e['body'][_0x5511('0x69')][_0x5511('0x44')];_0x4e8ef9+=0x1){socket['emit'](_0x5511('0x6f'),{'UserId':Number(_0x1fec8e[_0x5511('0x5f')][_0x5511('0x69')][_0x4e8ef9]),'WhatsappAccountId':Number(_0x1fec8e[_0x5511('0x60')]['id'])});}return _0x411a36;});}})[_0x5511('0x1c')](respondWithResult(_0x2a48b9,null))[_0x5511('0x27')](handleError(_0x2a48b9,null));};exports['removeAgents']=function(_0x47b6b9,_0x53ed85,_0x55b0eb){return db[_0x5511('0x4e')][_0x5511('0x56')]({'where':{'id':_0x47b6b9[_0x5511('0x60')]['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x53ed85,null))[_0x5511('0x1c')](function(_0x447481){if(_0x447481){return _0x447481[_0x5511('0x70')](_0x47b6b9[_0x5511('0x3f')][_0x5511('0x69')])[_0x5511('0x1c')](function(){if(_['isArray'](_0x47b6b9[_0x5511('0x3f')][_0x5511('0x69')])){for(var _0x4327ca=0x0;_0x4327ca<_0x47b6b9[_0x5511('0x3f')]['ids'][_0x5511('0x44')];_0x4327ca+=0x1){socket['emit'](_0x5511('0x71'),{'UserId':Number(_0x47b6b9['query']['ids'][_0x4327ca]),'WhatsappAccountId':Number(_0x47b6b9[_0x5511('0x60')]['id'])});}}else{socket[_0x5511('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x47b6b9[_0x5511('0x3f')][_0x5511('0x69')]),'WhatsappAccountId':Number(_0x47b6b9[_0x5511('0x60')]['id'])});}});}})[_0x5511('0x1c')](respondWithStatusCode(_0x53ed85,null))[_0x5511('0x27')](handleError(_0x53ed85,null));};exports[_0x5511('0x73')]=function(_0x29d63d,_0x3724a0,_0x3386d4){var _0x110bf2={};var _0x4ed3f6={};var _0x4c54ca;var _0x59ac67;return db[_0x5511('0x4e')][_0x5511('0x66')]({'where':{'id':_0x29d63d['params']['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x3724a0,null))[_0x5511('0x1c')](function(_0x105950){if(_0x105950){_0x4c54ca=_0x105950;_0x4ed3f6['model']=_[_0x5511('0x54')](db[_0x5511('0x74')][_0x5511('0x3c')]);_0x4ed3f6['query']=_[_0x5511('0x54')](_0x29d63d[_0x5511('0x3f')]);_0x4ed3f6[_0x5511('0x40')]=_[_0x5511('0x41')](_0x4ed3f6[_0x5511('0x3e')],_0x4ed3f6['query']);_0x110bf2[_0x5511('0x42')]=_[_0x5511('0x41')](_0x4ed3f6['model'],qs['fields'](_0x29d63d[_0x5511('0x3f')][_0x5511('0x43')]));_0x110bf2['attributes']=_0x110bf2[_0x5511('0x42')][_0x5511('0x44')]?_0x110bf2[_0x5511('0x42')]:_0x4ed3f6['model'];_0x110bf2[_0x5511('0x67')]=qs[_0x5511('0x47')](_0x29d63d[_0x5511('0x3f')][_0x5511('0x47')]);_0x110bf2['where']=qs[_0x5511('0x40')](_['pick'](_0x29d63d['query'],_0x4ed3f6[_0x5511('0x40')]));if(_0x29d63d[_0x5511('0x3f')][_0x5511('0x4a')]){_0x110bf2[_0x5511('0x49')]=_['merge'](_0x110bf2[_0x5511('0x49')],{'$or':_['map'](_0x110bf2['attributes'],function(_0x4a2547){var _0xa54596={};_0xa54596[_0x4a2547]={'$like':'%'+_0x29d63d[_0x5511('0x3f')][_0x5511('0x4a')]+'%'};return _0xa54596;})});}_0x110bf2=_[_0x5511('0x55')]({},_0x110bf2,_0x29d63d['options']);return _0x4c54ca[_0x5511('0x73')](_0x110bf2);}})[_0x5511('0x1c')](function(_0x4df823){if(_0x4df823){_0x59ac67=_0x4df823[_0x5511('0x44')];if(!_0x29d63d['query'][_0x5511('0x45')](_0x5511('0x6b'))){_0x110bf2[_0x5511('0x46')]=qs['limit'](_0x29d63d[_0x5511('0x3f')][_0x5511('0x46')]);_0x110bf2['offset']=qs['offset'](_0x29d63d[_0x5511('0x3f')][_0x5511('0x2c')]);}return _0x4c54ca['getAgents'](_0x110bf2);}})['then'](function(_0x554df6){if(_0x554df6){return _0x554df6?{'count':_0x59ac67,'rows':_0x554df6}:null;}})[_0x5511('0x1c')](respondWithResult(_0x3724a0,null))[_0x5511('0x27')](handleError(_0x3724a0,null));};exports['addApplications']=function(_0x529f36,_0x181134){var _0x4b2ba7=_0x529f36[_0x5511('0x60')]['id'];var _0x5005d6=_0x529f36[_0x5511('0x5f')];var _0x4abe92=0xc8;var _0x572943=null;return db[_0x5511('0x75')][_0x5511('0x76')]({'isolationLevel':db[_0x5511('0x75')]['Transaction'][_0x5511('0x77')][_0x5511('0x78')]},function(_0x12cfe5){return db['WhatsappAccount']['findOne']({'where':{'id':_0x4b2ba7},'transaction':_0x12cfe5})[_0x5511('0x1c')](function(_0x2589b4){if(_0x2589b4){return db[_0x5511('0x79')][_0x5511('0x34')]({'where':{'WhatsappAccountId':_0x4b2ba7},'transaction':_0x12cfe5})[_0x5511('0x1c')](function(){var _0x3efde7=_[_0x5511('0x3b')](_0x5005d6,function(_0x42e93b){_0x42e93b[_0x5511('0x63')]=_0x4b2ba7;return _0x42e93b;});return db[_0x5511('0x79')][_0x5511('0x7a')](_0x3efde7,{'transaction':_0x12cfe5});});}else{_0x4abe92=0x194;_0x572943=[];}});})[_0x5511('0x1c')](function(){if(_0x4abe92!==0x194){return db[_0x5511('0x79')][_0x5511('0x7b')]({'where':{'WhatsappAccountId':_0x4b2ba7},'order':_0x5511('0x7c')})[_0x5511('0x1c')](function(_0x57eef7){_0x572943=_0x57eef7;});}})[_0x5511('0x27')](function(_0x14c88e){_0x4abe92=0x1f4;logger[_0x5511('0x23')](_0x14c88e['stack']);if(_0x14c88e[_0x5511('0x39')]){delete _0x14c88e['name'];}_0x572943=_0x14c88e;})[_0x5511('0x7d')](function(){if(_0x572943===null){_0x181134['sendStatus'](_0x4abe92);}else{if(_0x4abe92===0x1f4){_0x181134[_0x5511('0x2a')](_0x4abe92)[_0x5511('0x7e')](_0x572943);}else{_0x181134[_0x5511('0x2a')](_0x4abe92)[_0x5511('0x2b')](_0x572943);}}});};exports['getApplications']=function(_0x4009c5,_0x43ae13,_0x5cca47){var _0x503041={};var _0x50d64b={};var _0x215ae2;var _0x36aea6;return db[_0x5511('0x4e')][_0x5511('0x66')]({'where':{'id':_0x4009c5[_0x5511('0x60')]['id']}})[_0x5511('0x1c')](handleEntityNotFound(_0x43ae13,null))['then'](function(_0x49b7b0){if(_0x49b7b0){_0x215ae2=_0x49b7b0;_0x50d64b[_0x5511('0x3e')]=_[_0x5511('0x54')](db[_0x5511('0x79')][_0x5511('0x3c')]);_0x50d64b[_0x5511('0x3f')]=_['keys'](_0x4009c5[_0x5511('0x3f')]);_0x50d64b['filters']=_[_0x5511('0x41')](_0x50d64b[_0x5511('0x3e')],_0x50d64b[_0x5511('0x3f')]);_0x503041[_0x5511('0x42')]=_[_0x5511('0x41')](_0x50d64b[_0x5511('0x3e')],qs[_0x5511('0x43')](_0x4009c5[_0x5511('0x3f')][_0x5511('0x43')]));_0x503041['attributes']=_0x503041[_0x5511('0x42')][_0x5511('0x44')]?_0x503041[_0x5511('0x42')]:_0x50d64b[_0x5511('0x3e')];_0x503041[_0x5511('0x67')]=qs[_0x5511('0x47')](_0x4009c5['query'][_0x5511('0x47')]);_0x503041[_0x5511('0x49')]=qs['filters'](_[_0x5511('0x48')](_0x4009c5['query'],_0x50d64b[_0x5511('0x40')]));if(_0x4009c5[_0x5511('0x3f')]['filter']){_0x503041[_0x5511('0x49')]=_[_0x5511('0x55')](_0x503041[_0x5511('0x49')],{'$or':_['map'](_0x503041[_0x5511('0x42')],function(_0x33f27c){var _0x5b6b2b={};_0x5b6b2b[_0x33f27c]={'$like':'%'+_0x4009c5[_0x5511('0x3f')][_0x5511('0x4a')]+'%'};return _0x5b6b2b;})});}_0x503041=_['merge']({},_0x503041,_0x4009c5[_0x5511('0x4b')]);return _0x215ae2[_0x5511('0x7f')](_0x503041);}})[_0x5511('0x1c')](function(_0x20da2d){if(_0x20da2d){_0x36aea6=_0x20da2d[_0x5511('0x44')];if(!_0x4009c5[_0x5511('0x3f')][_0x5511('0x45')](_0x5511('0x6b'))){_0x503041[_0x5511('0x46')]=qs[_0x5511('0x46')](_0x4009c5[_0x5511('0x3f')][_0x5511('0x46')]);_0x503041['offset']=qs['offset'](_0x4009c5[_0x5511('0x3f')][_0x5511('0x2c')]);}return _0x215ae2['getApplications'](_0x503041);}})[_0x5511('0x1c')](function(_0x4378ce){if(_0x4378ce){return _0x4378ce?{'count':_0x36aea6,'rows':_0x4378ce}:null;}})[_0x5511('0x1c')](respondWithResult(_0x43ae13,null))[_0x5511('0x27')](handleError(_0x43ae13,null));};exports[_0x5511('0x80')]=function(_0x282621,_0x42f780,_0x484fac){var _0x325e57={'channel':_0x5511('0x81')};var _0x348951=[];var _0x4b3838=[];var _0x50b3a4={};return db[_0x5511('0x4e')][_0x5511('0x56')]({'where':{'id':_0x282621[_0x5511('0x60')]['id']},'include':[{'model':db[_0x5511('0x79')],'as':_0x5511('0x82')}]})['then'](handleEntityNotFound(_0x42f780,null))[_0x5511('0x1c')](function(_0x470199){_0x325e57[_0x5511('0x83')]=_0x470199;if(_0x325e57[_0x5511('0x83')]&&_0x325e57[_0x5511('0x83')]['type']===_0x5511('0x84')&&_0x282621[_0x5511('0x5f')][_0x5511('0x85')]){if(_0x282621[_0x5511('0x5f')]['statuses'][_0x5511('0x44')]===0x0)return;if(_0x282621[_0x5511('0x5f')][_0x5511('0x85')][0x0]['state']!==_0x5511('0x86'))return;return db['WhatsappMessage'][_0x5511('0x5e')]({'read':!![],'readAt':_0x282621['body'][_0x5511('0x85')][0x0][_0x5511('0x87')]},{'where':{'messageId':_0x282621[_0x5511('0x5f')]['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x16b7f9){return _0x42f780[_0x5511('0x2a')](0xc8)[_0x5511('0x2b')](_0x16b7f9);});}_0x325e57[_0x5511('0x88')]=_[_0x5511('0x89')](_0x470199[_0x5511('0x82')],[_0x5511('0x7c')],[_0x5511('0x8a')]);if(_0x325e57[_0x5511('0x83')][_0x5511('0x82')]){delete _0x325e57[_0x5511('0x83')][_0x5511('0x82')];}return db[_0x5511('0x8b')][_0x5511('0x61')]()[_0x5511('0x1c')](function(_0x5572a1){if(!_0x5572a1){throw new db[(_0x5511('0x8c'))][(_0x5511('0x8d'))](_0x5511('0x8e'));}_0x348951=_[_0x5511('0x8f')](_[_0x5511('0x54')](_0x5572a1),[_0x5511('0x90'),_0x5511('0x91')]);_0x4b3838=_[_0x5511('0x8f')](_[_0x5511('0x54')](_0x5572a1),['createdAt',_0x5511('0x91'),'CompanyId',_0x5511('0x92')]);_0x325e57[_0x5511('0x5f')]={'mapKey':_0x5511('0x93')};if(_0x325e57['account']&&_0x325e57[_0x5511('0x83')]['type']===_0x5511('0x94')){_0x325e57[_0x5511('0x5f')][_0x5511('0x95')]=_0x282621[_0x5511('0x5f')][_0x5511('0x96')][_0x5511('0x97')]('whatsapp:','');_0x325e57[_0x5511('0x5f')][_0x5511('0x5f')]=_0x282621[_0x5511('0x5f')][_0x5511('0x98')];_0x325e57[_0x5511('0x5f')][_0x5511('0x99')]=_0x282621['body']['MessageSid'];}if(_0x325e57[_0x5511('0x83')]&&_0x325e57[_0x5511('0x83')][_0x5511('0x3d')]===_0x5511('0x84')){_0x325e57['body'][_0x5511('0x95')]=_0x282621[_0x5511('0x5f')]['notifications'][0x0][_0x5511('0x95')];_0x325e57[_0x5511('0x5f')]['body']=_0x282621[_0x5511('0x5f')][_0x5511('0x9a')][0x0]['message'][_0x5511('0x5f')];_0x325e57[_0x5511('0x5f')][_0x5511('0x99')]=_0x282621[_0x5511('0x5f')]['notifications'][0x0][_0x5511('0x9b')];}if(_0x325e57['body']['id']){delete _0x325e57[_0x5511('0x5f')]['id'];}if(_[_0x5511('0x9c')](_0x325e57[_0x5511('0x5f')][_0x5511('0x95')])){throw new db[(_0x5511('0x8c'))][(_0x5511('0x8d'))](_0x5511('0x9d'));}if(_['isNil'](_0x325e57[_0x5511('0x5f')][_0x5511('0x5f')])||_0x325e57['body'][_0x5511('0x5f')]===''){throw new db['Sequelize'][(_0x5511('0x8d'))](_0x5511('0x9e'));}if(_[_0x5511('0x9c')](_0x325e57[_0x5511('0x5f')][_0x5511('0x9f')])){throw new db[(_0x5511('0x8c'))][(_0x5511('0x8d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b3838);}if(!_['includes'](_0x4b3838,_0x325e57[_0x5511('0x5f')][_0x5511('0x9f')])){throw new db['Sequelize'][(_0x5511('0x8d'))](_0x5511('0xa0')+_0x4b3838);}_0x50b3a4[_0x325e57[_0x5511('0x5f')][_0x5511('0x9f')]]=_0x325e57[_0x5511('0x5f')][_0x5511('0x95')];return db[_0x5511('0xa1')][_0x5511('0x56')]({'where':{'id':_0x325e57[_0x5511('0x83')][_0x5511('0x92')]},'include':[{'model':db[_0x5511('0x8b')],'as':'Contacts','where':_0x50b3a4,'limit':0x1,'order':[[_0x5511('0x91'),_0x5511('0xa2')]]}]});})['then'](handleEntityNotFound(_0x42f780,null))[_0x5511('0x1c')](function(_0xa58f55){if(_0xa58f55){_0x325e57['list']=_[_0x5511('0x6e')](_0xa58f55,['Contacts']);if(_0xa58f55[_0x5511('0xa3')][_0x5511('0x44')]){return _0xa58f55[_0x5511('0xa3')][0x0];}var _0x3d446c=_['defaults'](_0x325e57['body'],{'firstName':_0x325e57[_0x5511('0x5f')][_0x5511('0x95')],'ListId':_0xa58f55['id']});_0x3d446c[_0x325e57['body'][_0x5511('0x9f')]]=_0x325e57[_0x5511('0x5f')]['from'];return db[_0x5511('0x8b')][_0x5511('0x57')](_0x3d446c,{'fields':_0x348951,'raw':!![]});}})['then'](handleEntityNotFound(_0x42f780,null))['then'](function(_0x3702f5){if(_0x3702f5){_0x325e57['contact']=_0x3702f5;var _0x148767={'ContactId':_0x3702f5['id'],'phone':_0x325e57[_0x5511('0x5f')]['from'],'WhatsappAccountId':_0x282621[_0x5511('0x60')]['id']};var _0x19228e={'ContactId':_0x3702f5['id'],'WhatsappAccountId':_0x282621[_0x5511('0x60')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x5511('0x56')]({'where':_0x19228e})[_0x5511('0x1c')](function(_0x14e4f0){if(_0x14e4f0){return[_0x14e4f0,![]];}return db['WhatsappInteraction'][_0x5511('0x57')](_0x148767)['then'](function(_0x5f397b){return[_0x5f397b,!![]];});});}})['spread'](function(_0x62993e,_0x14eb41){_0x325e57[_0x5511('0xa4')]=_0x62993e['get']({'plain':!![]});_0x325e57[_0x5511('0xa4')]['created']=![];if(_0x14eb41){if(_0x325e57[_0x5511('0x83')][_0x5511('0xa5')]){_0x325e57[_0x5511('0x88')][_0x5511('0xa6')]({'id':0x0,'priority':_0x325e57[_0x5511('0x88')]['length']+0x1,'app':_0x5511('0xa7'),'appdata':_0x5511('0xa8'),'interval':'*,*,*,*'});}_0x325e57[_0x5511('0xa4')][_0x5511('0xa9')]=!![];}return db[_0x5511('0xaa')][_0x5511('0x57')]({'phone':_0x325e57['body']['from'],'messageId':_0x325e57[_0x5511('0x5f')]['messageId'],'body':_0x325e57[_0x5511('0x5f')][_0x5511('0x5f')],'WhatsappAccountId':_0x282621['params']['id'],'WhatsappInteractionId':_0x62993e['id'],'direction':'in','ContactId':_0x62993e[_0x5511('0xab')],'AttachmentId':_0x325e57[_0x5511('0x5f')][_0x5511('0xac')]});})[_0x5511('0x1c')](function(_0x168188){_0x325e57[_0x5511('0x25')]=_0x168188;if(_0x325e57[_0x5511('0xa4')][_0x5511('0xad')]){return db[_0x5511('0x74')][_0x5511('0x56')]({'attributes':['id','name'],'where':{'id':_0x325e57[_0x5511('0xa4')][_0x5511('0xad')]}})[_0x5511('0x1c')](function(_0x71de8a){if(_0x71de8a){_0x325e57[_0x5511('0x88')][_0x5511('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x71de8a[_0x5511('0x39')]+','+(_0x325e57['account'][_0x5511('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x325e57);});}return respondWithRpcPromise(_0x5511('0xb0'),_0x5511('0xb1'),_0x325e57);})['then'](function(_0x17a33d){if(_0x17a33d){var _0x4974c6=0xc8;var _0x446bd8='receiveMessage';logger[_0x5511('0x1d')](_0x5511('0x21'),_0x446bd8,_0x4974c6,_0x5511('0xb2'));logger[_0x5511('0x20')](_0x5511('0xb3'),_0x446bd8,_0x4974c6,_0x5511('0xb2'),JSON['stringify'](_0x17a33d));if(_0x325e57[_0x5511('0x83')]['type']===_0x5511('0x94')){return _0x42f780[_0x5511('0x2a')](_0x4974c6)['set']('Content-Type',_0x5511('0xb4'))[_0x5511('0x7e')]('\x0a');}else{return _0x42f780['status'](_0x4974c6)[_0x5511('0x2b')](_0x17a33d);}}});})[_0x5511('0x27')](handleError(_0x42f780,null));};exports[_0x5511('0x7e')]=function(_0x6ade35,_0x34426b,_0x14e033){var _0x90a287,_0x13cf4c,_0x246c36;if(_[_0x5511('0x9c')](_0x6ade35[_0x5511('0x5f')][_0x5511('0x5f')])||_0x6ade35[_0x5511('0x5f')][_0x5511('0x5f')]===''){throw new db[(_0x5511('0x8c'))][(_0x5511('0x8d'))](_0x5511('0x9e'));}if(_['isNil'](_0x6ade35['body']['to'])){throw new db[(_0x5511('0x8c'))][(_0x5511('0x8d'))](_0x5511('0xb5'));}_0x90a287=_0x6ade35[_0x5511('0x5f')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x6ade35['params']['id']},'include':[{'model':db[_0x5511('0xa1')],'as':'List','include':[{'model':db[_0x5511('0x8b')],'as':'Contacts','where':{'mobile':_0x90a287},'limit':0x1,'order':[[_0x5511('0x91'),'DESC']]}]}]})[_0x5511('0x1c')](handleEntityNotFound(_0x34426b,null))['then'](function(_0xe0faad){if(_0xe0faad&&_0xe0faad[_0x5511('0xb6')]){_0x13cf4c=_0xe0faad[_0x5511('0x35')]({'plain':!![]});if(_0x13cf4c['List']&&_0x13cf4c[_0x5511('0xb6')][_0x5511('0xa3')][_0x5511('0x44')]){return _0x13cf4c[_0x5511('0xb6')][_0x5511('0xa3')][0x0];}return db[_0x5511('0x8b')][_0x5511('0x57')](_['defaults'](_0x6ade35[_0x5511('0x5f')],{'firstName':_0x90a287,'mobile':_0x90a287,'phone':_0x90a287,'ListId':_0x13cf4c[_0x5511('0x92')]}));}})['then'](handleEntityNotFound(_0x34426b,null))[_0x5511('0x1c')](function(_0xae45c2){if(_0xae45c2){_0x246c36=_0xae45c2;return db[_0x5511('0xb7')][_0x5511('0x56')]({'where':{'ContactId':_0x246c36['id'],'closed':![],'WhatsappAccountId':_0x13cf4c['id']}})['then'](function(_0x34b3c8){if(_0x34b3c8){return[_0x34b3c8,![]];}return db['WhatsappInteraction'][_0x5511('0x57')]({'UserId':_0x6ade35[_0x5511('0x58')]['id'],'ContactId':_0x246c36['id'],'WhatsappAccountId':_0x13cf4c['id'],'phone':_0x90a287,'firstMsgDirection':_0x5511('0xb8'),'Messages':[_['merge'](_0x6ade35[_0x5511('0x5f')],{'read':![],'body':_0x6ade35[_0x5511('0x5f')][_0x5511('0x5f')],'phone':_0x90a287,'WhatsappAccountId':_0x13cf4c['id'],'UserId':_0x6ade35[_0x5511('0x58')]['id'],'ContactId':_0x246c36['id']})]},{'include':[{'model':db[_0x5511('0xaa')],'as':_0x5511('0xb9')}]})[_0x5511('0x1c')](function(_0x43922f){return[_0x43922f,!![]];});});}})[_0x5511('0xba')](function(_0x432a82,_0x206028){if(_0x206028){return _0x432a82;}return db['WhatsappMessage'][_0x5511('0x57')](_[_0x5511('0x55')](_0x6ade35[_0x5511('0x5f')],{'read':![],'body':_0x6ade35[_0x5511('0x5f')][_0x5511('0x5f')],'phone':_0x90a287,'WhatsappAccountId':_0x13cf4c['id'],'WhatsappInteractionId':_0x432a82['id'],'UserId':_0x6ade35[_0x5511('0x58')]['id'],'ContactId':_0x246c36['id']}))[_0x5511('0x1c')](function(_0x3d0d9f){_0x432a82['dataValues']['Messages']=[];_0x432a82[_0x5511('0xbb')][_0x5511('0xb9')]['push'](_0x3d0d9f[_0x5511('0xbb')]);return _0x432a82;});})['then'](respondWithResult(_0x34426b,null))['catch'](handleError(_0x34426b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ac52491..924c5a4 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 _0xccc3=['emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0x5738f7,_0x17df47){var _0x2e6d3c=function(_0x5c9b13){while(--_0x5c9b13){_0x5738f7['push'](_0x5738f7['shift']());}};_0x2e6d3c(++_0x17df47);}(_0xccc3,0xe5));var _0x3ccc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xccc3[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x3ccc('0x0'))['db'][_0x3ccc('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ccc('0x2'),'afterUpdate':_0x3ccc('0x3'),'afterDestroy':_0x3ccc('0x4')};function emitEvent(_0x52b8e9){return function(_0x6d1f15,_0x49822e,_0xf32799){WhatsappAccountEvents[_0x3ccc('0x5')](_0x52b8e9+':'+_0x6d1f15['id'],_0x6d1f15);WhatsappAccountEvents[_0x3ccc('0x5')](_0x52b8e9,_0x6d1f15);_0xf32799(null);};}for(var e in events){if(events[_0x3ccc('0x6')](e)){var event=events[e];WhatsappAccount[_0x3ccc('0x7')](e,emitEvent(event));}}module[_0x3ccc('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0070=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x10cb1a,_0x5230cd){var _0x9e78ec=function(_0xa66fe){while(--_0xa66fe){_0x10cb1a['push'](_0x10cb1a['shift']());}};_0x9e78ec(++_0x5230cd);}(_0x0070,0xf5));var _0x0007=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x0070[_0xdd0313];return _0x2bd7e8;};'use strict';var EventEmitter=require(_0x0007('0x0'));var WhatsappAccount=require(_0x0007('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0007('0x2'),'afterDestroy':_0x0007('0x3')};function emitEvent(_0x1fa54c){return function(_0x247323,_0x2a8f03,_0x3924a6){WhatsappAccountEvents[_0x0007('0x4')](_0x1fa54c+':'+_0x247323['id'],_0x247323);WhatsappAccountEvents['emit'](_0x1fa54c,_0x247323);_0x3924a6(null);};}for(var e in events){if(events[_0x0007('0x5')](e)){var event=events[e];WhatsappAccount[_0x0007('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a464b96..9b65174 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 _0xad8c=['exports','whatsapp_accounts','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x342edd,_0xf8cc8a){var _0x5d45ef=function(_0x1846a5){while(--_0x1846a5){_0x342edd['push'](_0x342edd['shift']());}};_0x5d45ef(++_0xf8cc8a);}(_0xad8c,0x160));var _0xcad8=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xad8c[_0x38c652];return _0x218a37;};'use strict';var _=require('lodash');var util=require(_0xcad8('0x0'));var logger=require('../../config/logger')(_0xcad8('0x1'));var moment=require(_0xcad8('0x2'));var BPromise=require(_0xcad8('0x3'));var rp=require(_0xcad8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcad8('0x5'));var config=require(_0xcad8('0x6'));var attributes=require(_0xcad8('0x7'));module[_0xcad8('0x8')]=function(_0x40de44,_0x435229){return _0x40de44['define']('WhatsappAccount',attributes,{'tableName':_0xcad8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb848=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0xb848,0x11d));var _0x8b84=function(_0x5de76d,_0x5aa6bf){_0x5de76d=_0x5de76d-0x0;var _0x1013f1=_0xb848[_0x5de76d];return _0x1013f1;};'use strict';var _=require(_0x8b84('0x0'));var util=require(_0x8b84('0x1'));var logger=require(_0x8b84('0x2'))(_0x8b84('0x3'));var moment=require(_0x8b84('0x4'));var BPromise=require(_0x8b84('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b84('0x6'));var config=require(_0x8b84('0x7'));var attributes=require(_0x8b84('0x8'));module[_0x8b84('0x9')]=function(_0x1cb289,_0x3a8904){return _0x1cb289[_0x8b84('0xa')](_0x8b84('0xb'),attributes,{'tableName':_0x8b84('0xc'),'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 6c5c3d8..5c5f86a 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 _0xea2e=['debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea2e,0xc5));var _0xeea2=function(_0x8ef481,_0x1cddc0){_0x8ef481=_0x8ef481-0x0;var _0x3989ea=_0xea2e[_0x8ef481];return _0x3989ea;};'use strict';var _=require('lodash');var util=require(_0xeea2('0x0'));var moment=require(_0xeea2('0x1'));var BPromise=require('bluebird');var rs=require(_0xeea2('0x2'));var fs=require('fs');var Redis=require(_0xeea2('0x3'));var db=require(_0xeea2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeea2('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeea2('0x6')][_0xeea2('0x7')]({'port':0x232a});config[_0xeea2('0x8')]=_[_0xeea2('0x9')](config[_0xeea2('0x8')],{'host':_0xeea2('0xa'),'port':0x18eb});var socket=require(_0xeea2('0xb'))(new Redis(config[_0xeea2('0x8')]));require(_0xeea2('0xc'))[_0xeea2('0xd')](socket);function respondWithRpcPromise(_0x4cbee6,_0x5f5867,_0x4e8617){return new BPromise(function(_0x6b3b0d,_0xf5de22){return client[_0xeea2('0xe')](_0x4cbee6,_0x4e8617)[_0xeea2('0xf')](function(_0x2cbe84){logger[_0xeea2('0x10')](_0xeea2('0x11'),_0x5f5867,_0xeea2('0x12'));logger[_0xeea2('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5f5867,_0xeea2('0x12'),JSON[_0xeea2('0x14')](_0x2cbe84));if(_0x2cbe84['error']){if(_0x2cbe84[_0xeea2('0x15')][_0xeea2('0x16')]===0x1f4){logger[_0xeea2('0x15')](_0xeea2('0x11'),_0x5f5867,_0x2cbe84[_0xeea2('0x15')][_0xeea2('0x17')]);return _0xf5de22(_0x2cbe84['error'][_0xeea2('0x17')]);}logger['error'](_0xeea2('0x11'),_0x5f5867,_0x2cbe84['error']['message']);return _0x6b3b0d(_0x2cbe84[_0xeea2('0x15')][_0xeea2('0x17')]);}else{logger[_0xeea2('0x10')](_0xeea2('0x11'),_0x5f5867,'request\x20sent');_0x6b3b0d(_0x2cbe84[_0xeea2('0x18')][_0xeea2('0x17')]);}})[_0xeea2('0x19')](function(_0x4e3e5e){logger[_0xeea2('0x15')](_0xeea2('0x11'),_0x5f5867,_0x4e3e5e);_0xf5de22(_0x4e3e5e);});});}exports[_0xeea2('0x1a')]=function(_0x10801b){var _0x2b3cde=this;return new Promise(function(_0x18d7df,_0x4a11a0){return db[_0xeea2('0x1b')][_0xeea2('0x1c')]({'raw':_0x10801b[_0xeea2('0x1d')]?_0x10801b['options'][_0xeea2('0x1e')]===undefined?!![]:![]:!![],'where':_0x10801b[_0xeea2('0x1d')]?_0x10801b[_0xeea2('0x1d')][_0xeea2('0x1f')]||null:null,'attributes':_0x10801b['options']?_0x10801b[_0xeea2('0x1d')][_0xeea2('0x20')]||null:null,'include':_0x10801b[_0xeea2('0x1d')]?_0x10801b['options'][_0xeea2('0x21')]?_[_0xeea2('0x22')](_0x10801b[_0xeea2('0x1d')][_0xeea2('0x21')],function(_0x20c0bb){return{'model':db[_0x20c0bb[_0xeea2('0x23')]],'as':_0x20c0bb['as'],'attributes':_0x20c0bb['attributes'],'include':_0x20c0bb[_0xeea2('0x21')]?_[_0xeea2('0x22')](_0x20c0bb[_0xeea2('0x21')],function(_0x2d4f8a){return{'model':db[_0x2d4f8a[_0xeea2('0x23')]],'as':_0x2d4f8a['as'],'attributes':_0x2d4f8a['attributes'],'include':_0x2d4f8a[_0xeea2('0x21')]?_[_0xeea2('0x22')](_0x2d4f8a[_0xeea2('0x21')],function(_0xa47181){return{'model':db[_0xa47181['model']],'as':_0xa47181['as'],'attributes':_0xa47181['attributes']};}):[]};}):[]};}):[]:[]})[_0xeea2('0xf')](function(_0x299251){logger['info'](_0xeea2('0x1a'),_0x10801b);logger[_0xeea2('0x13')](_0xeea2('0x1a'),_0x10801b,JSON[_0xeea2('0x14')](_0x299251));_0x18d7df(_0x299251);})[_0xeea2('0x19')](function(_0x27db1f){logger[_0xeea2('0x15')](_0xeea2('0x1a'),_0x27db1f[_0xeea2('0x17')],_0x10801b);_0x4a11a0(_0x2b3cde['error'](0x1f4,_0x27db1f[_0xeea2('0x17')]));});});}; \ No newline at end of file +var _0x0a3e=['code','WhatsappAccount,\x20%s,\x20%s','message','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','model','include','map','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e237c,_0xb2c850){var _0x2a847c=function(_0x4fd8c8){while(--_0x4fd8c8){_0x2e237c['push'](_0x2e237c['shift']());}};_0x2a847c(++_0xb2c850);}(_0x0a3e,0x79));var _0xe0a3=function(_0x4df996,_0x5b3057){_0x4df996=_0x4df996-0x0;var _0x910002=_0x0a3e[_0x4df996];return _0x910002;};'use strict';var _=require(_0xe0a3('0x0'));var util=require('util');var moment=require(_0xe0a3('0x1'));var BPromise=require(_0xe0a3('0x2'));var rs=require(_0xe0a3('0x3'));var fs=require('fs');var Redis=require(_0xe0a3('0x4'));var db=require(_0xe0a3('0x5'))['db'];var utils=require(_0xe0a3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe0a3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0a3('0x8')]['http']({'port':0x232a});config['redis']=_[_0xe0a3('0x9')](config[_0xe0a3('0xa')],{'host':_0xe0a3('0xb'),'port':0x18eb});var socket=require(_0xe0a3('0xc'))(new Redis(config['redis']));require(_0xe0a3('0xd'))[_0xe0a3('0xe')](socket);function respondWithRpcPromise(_0x12d1d9,_0x35bac7,_0x24d676){return new BPromise(function(_0x54c7c4,_0xa42da4){return client[_0xe0a3('0xf')](_0x12d1d9,_0x24d676)[_0xe0a3('0x10')](function(_0x187441){logger[_0xe0a3('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x35bac7,'request\x20sent');logger[_0xe0a3('0x12')](_0xe0a3('0x13'),_0x35bac7,_0xe0a3('0x14'),JSON[_0xe0a3('0x15')](_0x187441));if(_0x187441[_0xe0a3('0x16')]){if(_0x187441[_0xe0a3('0x16')][_0xe0a3('0x17')]===0x1f4){logger[_0xe0a3('0x16')](_0xe0a3('0x18'),_0x35bac7,_0x187441[_0xe0a3('0x16')][_0xe0a3('0x19')]);return _0xa42da4(_0x187441[_0xe0a3('0x16')]['message']);}logger[_0xe0a3('0x16')](_0xe0a3('0x18'),_0x35bac7,_0x187441[_0xe0a3('0x16')][_0xe0a3('0x19')]);return _0x54c7c4(_0x187441[_0xe0a3('0x16')]['message']);}else{logger[_0xe0a3('0x11')](_0xe0a3('0x18'),_0x35bac7,_0xe0a3('0x14'));_0x54c7c4(_0x187441['result'][_0xe0a3('0x19')]);}})['catch'](function(_0x46c431){logger['error'](_0xe0a3('0x18'),_0x35bac7,_0x46c431);_0xa42da4(_0x46c431);});});}exports[_0xe0a3('0x1a')]=function(_0x2d21d4){var _0x1ed9a5=this;return new Promise(function(_0x1b1288,_0xaf293){return db[_0xe0a3('0x1b')][_0xe0a3('0x1c')]({'raw':_0x2d21d4['options']?_0x2d21d4[_0xe0a3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2d21d4[_0xe0a3('0x1d')]?_0x2d21d4['options'][_0xe0a3('0x1e')]||null:null,'attributes':_0x2d21d4[_0xe0a3('0x1d')]?_0x2d21d4[_0xe0a3('0x1d')][_0xe0a3('0x1f')]||null:null,'include':_0x2d21d4[_0xe0a3('0x1d')]?_0x2d21d4[_0xe0a3('0x1d')]['include']?_['map'](_0x2d21d4[_0xe0a3('0x1d')]['include'],function(_0x17ea22){return{'model':db[_0x17ea22[_0xe0a3('0x20')]],'as':_0x17ea22['as'],'attributes':_0x17ea22[_0xe0a3('0x1f')],'include':_0x17ea22[_0xe0a3('0x21')]?_[_0xe0a3('0x22')](_0x17ea22['include'],function(_0x28b4a4){return{'model':db[_0x28b4a4[_0xe0a3('0x20')]],'as':_0x28b4a4['as'],'attributes':_0x28b4a4['attributes'],'include':_0x28b4a4['include']?_[_0xe0a3('0x22')](_0x28b4a4['include'],function(_0x37a5c2){return{'model':db[_0x37a5c2[_0xe0a3('0x20')]],'as':_0x37a5c2['as'],'attributes':_0x37a5c2[_0xe0a3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf6800d){logger[_0xe0a3('0x11')]('ShowWhatsappAccount',_0x2d21d4);logger[_0xe0a3('0x12')](_0xe0a3('0x1a'),_0x2d21d4,JSON[_0xe0a3('0x15')](_0xf6800d));_0x1b1288(_0xf6800d);})[_0xe0a3('0x23')](function(_0x5de233){logger[_0xe0a3('0x16')](_0xe0a3('0x1a'),_0x5de233['message'],_0x2d21d4);_0xaf293(_0x1ed9a5[_0xe0a3('0x16')](0x1f4,_0x5de233['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 996dd64..92f1521 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 _0x3f87=['remove','update','emit','removeListener','save'];(function(_0x25bafc,_0x3d7062){var _0x36b781=function(_0x139f33){while(--_0x139f33){_0x25bafc['push'](_0x25bafc['shift']());}};_0x36b781(++_0x3d7062);}(_0x3f87,0x6d));var _0x73f8=function(_0x33bba7,_0x137f1b){_0x33bba7=_0x33bba7-0x0;var _0x1df555=_0x3f87[_0x33bba7];return _0x1df555;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x73f8('0x0'),_0x73f8('0x1'),_0x73f8('0x2')];function createListener(_0x4ff780,_0x522e10){return function(_0x2c0534){_0x522e10[_0x73f8('0x3')](_0x4ff780,_0x2c0534);};}function removeListener(_0x352a1e,_0x700cc9){return function(){WhatsappAccountEvents[_0x73f8('0x4')](_0x352a1e,_0x700cc9);};}exports['register']=function(_0x551450){for(var _0x9a6f23=0x0,_0x3314b4=events['length'];_0x9a6f23<_0x3314b4;_0x9a6f23++){var _0x4f813e=events[_0x9a6f23];var _0x48c5c2=createListener('whatsappAccount:'+_0x4f813e,_0x551450);WhatsappAccountEvents['on'](_0x4f813e,_0x48c5c2);}}; \ No newline at end of file +var _0xef3c=['emit','register','whatsappAccount:','save','remove'];(function(_0x2ea562,_0x80467a){var _0x44c12f=function(_0x45faad){while(--_0x45faad){_0x2ea562['push'](_0x2ea562['shift']());}};_0x44c12f(++_0x80467a);}(_0xef3c,0xd0));var _0xcef3=function(_0x4db08e,_0x350b83){_0x4db08e=_0x4db08e-0x0;var _0x5a802e=_0xef3c[_0x4db08e];return _0x5a802e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xcef3('0x0'),_0xcef3('0x1'),'update'];function createListener(_0x477e93,_0x2c3e16){return function(_0x3af1b3){_0x2c3e16[_0xcef3('0x2')](_0x477e93,_0x3af1b3);};}function removeListener(_0x34ef06,_0x21e424){return function(){WhatsappAccountEvents['removeListener'](_0x34ef06,_0x21e424);};}exports[_0xcef3('0x3')]=function(_0x4efc0d){for(var _0x5156cc=0x0,_0x5003b0=events['length'];_0x5156cc<_0x5003b0;_0x5156cc++){var _0x56ea09=events[_0x5156cc];var _0x73de9d=createListener(_0xcef3('0x4')+_0x56ea09,_0x4efc0d);WhatsappAccountEvents['on'](_0x56ea09,_0x73de9d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0d29b14..edde851 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 _0x1a13=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x31a8db,_0x9151c8){var _0x740e5d=function(_0x47aa74){while(--_0x47aa74){_0x31a8db['push'](_0x31a8db['shift']());}};_0x740e5d(++_0x9151c8);}(_0x1a13,0x10e));var _0x31a1=function(_0x25e9df,_0x17a63a){_0x25e9df=_0x25e9df-0x0;var _0x3dea70=_0x1a13[_0x25e9df];return _0x3dea70;};'use strict';var multer=require(_0x31a1('0x0'));var util=require(_0x31a1('0x1'));var path=require(_0x31a1('0x2'));var timeout=require(_0x31a1('0x3'));var express=require(_0x31a1('0x4'));var router=express[_0x31a1('0x5')]();var fs_extra=require(_0x31a1('0x6'));var auth=require(_0x31a1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x31a1('0x8'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x31a1('0x9')](),controller[_0x31a1('0xa')]);router['get']('/:id',auth[_0x31a1('0x9')](),controller[_0x31a1('0xb')]);router[_0x31a1('0xc')]('/',auth[_0x31a1('0x9')](),controller[_0x31a1('0xd')]);router[_0x31a1('0xe')](_0x31a1('0xf'),auth[_0x31a1('0x9')](),controller[_0x31a1('0x10')]);router[_0x31a1('0x11')](_0x31a1('0xf'),auth['isAuthenticated'](),controller[_0x31a1('0x12')]);module[_0x31a1('0x13')]=router; \ No newline at end of file +var _0x4930=['../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x96680,_0x24069a){var _0x1bf62a=function(_0x59dda9){while(--_0x59dda9){_0x96680['push'](_0x96680['shift']());}};_0x1bf62a(++_0x24069a);}(_0x4930,0x92));var _0x0493=function(_0x1cadd5,_0x2b90fd){_0x1cadd5=_0x1cadd5-0x0;var _0x4c5aaa=_0x4930[_0x1cadd5];return _0x4c5aaa;};'use strict';var multer=require('multer');var util=require(_0x0493('0x0'));var path=require(_0x0493('0x1'));var timeout=require(_0x0493('0x2'));var express=require('express');var router=express[_0x0493('0x3')]();var fs_extra=require(_0x0493('0x4'));var auth=require(_0x0493('0x5'));var interaction=require(_0x0493('0x6'));var config=require('../../config/environment');var controller=require(_0x0493('0x7'));router['get']('/',auth[_0x0493('0x8')](),controller[_0x0493('0x9')]);router[_0x0493('0xa')]('/:id',auth[_0x0493('0x8')](),controller[_0x0493('0xb')]);router[_0x0493('0xc')]('/',auth[_0x0493('0x8')](),controller[_0x0493('0xd')]);router[_0x0493('0xe')](_0x0493('0xf'),auth[_0x0493('0x8')](),controller[_0x0493('0x10')]);router[_0x0493('0x11')](_0x0493('0xf'),auth[_0x0493('0x8')](),controller[_0x0493('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fb15853..ee1ced1 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 _0x13e5=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0xa4fe30,_0x2d80b4){var _0x2bd33b=function(_0x4639e0){while(--_0x4639e0){_0xa4fe30['push'](_0xa4fe30['shift']());}};_0x2bd33b(++_0x2d80b4);}(_0x13e5,0x86));var _0x513e=function(_0x5935bf,_0x5221d2){_0x5935bf=_0x5935bf-0x0;var _0x22b061=_0x13e5[_0x5935bf];return _0x22b061;};'use strict';var Sequelize=require('sequelize');module[_0x513e('0x0')]={'priority':{'type':Sequelize[_0x513e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x513e('0x2')],'allowNull':![],'defaultValue':_0x513e('0x3')},'appdata':{'type':Sequelize[_0x513e('0x4')]()},'description':{'type':Sequelize[_0x513e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x513e('0x5')}}; \ No newline at end of file +var _0x9476=['sequelize','exports','STRING','noop'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x9476,0x114));var _0x6947=function(_0x1e4ad6,_0x480deb){_0x1e4ad6=_0x1e4ad6-0x0;var _0x22f4a2=_0x9476[_0x1e4ad6];return _0x22f4a2;};'use strict';var Sequelize=require(_0x6947('0x0'));module[_0x6947('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6947('0x2')],'allowNull':![],'defaultValue':_0x6947('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6947('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index aff5f29..e2b192b 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 _0x50e5=['map','WhatsappApplication','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','error','stack','name','index'];(function(_0x21dbe5,_0x42c6d4){var _0x33cf9e=function(_0x267453){while(--_0x267453){_0x21dbe5['push'](_0x21dbe5['shift']());}};_0x33cf9e(++_0x42c6d4);}(_0x50e5,0xb7));var _0x550e=function(_0x5b1d31,_0x5268c8){_0x5b1d31=_0x5b1d31-0x0;var _0x1276e8=_0x50e5[_0x5b1d31];return _0x1276e8;};'use strict';var emlformat=require(_0x550e('0x0'));var rimraf=require(_0x550e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x550e('0x2'));var rp=require(_0x550e('0x3'));var moment=require(_0x550e('0x4'));var BPromise=require(_0x550e('0x5'));var Mustache=require(_0x550e('0x6'));var util=require(_0x550e('0x7'));var path=require(_0x550e('0x8'));var sox=require(_0x550e('0x9'));var csv=require(_0x550e('0xa'));var ejs=require(_0x550e('0xb'));var fs=require('fs');var fs_extra=require(_0x550e('0xc'));var _=require(_0x550e('0xd'));var squel=require('squel');var crypto=require(_0x550e('0xe'));var jsforce=require(_0x550e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x550e('0xa'));var querystring=require(_0x550e('0x10'));var Papa=require(_0x550e('0x11'));var Redis=require('ioredis');var authService=require(_0x550e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x550e('0x13'));var logger=require(_0x550e('0x14'))('api');var utils=require(_0x550e('0x15'));var config=require(_0x550e('0x16'));var licenseUtil=require(_0x550e('0x17'));var db=require(_0x550e('0x18'))['db'];function respondWithStatusCode(_0x518cad,_0x335cba){_0x335cba=_0x335cba||0xcc;return function(_0x57214a){if(_0x57214a){return _0x518cad[_0x550e('0x19')](_0x335cba);}return _0x518cad['status'](_0x335cba)[_0x550e('0x1a')]();};}function respondWithResult(_0x4c6070,_0x393055){_0x393055=_0x393055||0xc8;return function(_0x2d4b79){if(_0x2d4b79){return _0x4c6070[_0x550e('0x1b')](_0x393055)['json'](_0x2d4b79);}};}function respondWithFilteredResult(_0x302be0,_0x49787c){return function(_0xf28ba7){if(_0xf28ba7){var _0x49474f=typeof _0x49787c['offset']===_0x550e('0x1c')&&typeof _0x49787c[_0x550e('0x1d')]==='undefined';var _0x4e49bf=_0xf28ba7['count'];var _0x22c264=_0x49474f?0x0:_0x49787c['offset'];var _0x580c6f=_0x49474f?_0xf28ba7[_0x550e('0x1e')]:_0x49787c[_0x550e('0x1f')]+_0x49787c[_0x550e('0x1d')];var _0x846ad;if(_0x580c6f>=_0x4e49bf){_0x580c6f=_0x4e49bf;_0x846ad=0xc8;}else{_0x846ad=0xce;}_0x302be0[_0x550e('0x1b')](_0x846ad);return _0x302be0[_0x550e('0x20')](_0x550e('0x21'),_0x22c264+'-'+_0x580c6f+'/'+_0x4e49bf)[_0x550e('0x22')](_0xf28ba7);}return null;};}function patchUpdates(_0x1b9799){return function(_0x47e6e1){try{jsonpatch[_0x550e('0x23')](_0x47e6e1,_0x1b9799,!![]);}catch(_0x106c68){return BPromise['reject'](_0x106c68);}return _0x47e6e1['save']();};}function saveUpdates(_0x3e9822,_0x2663c7){return function(_0x5769bb){if(_0x5769bb){return _0x5769bb[_0x550e('0x24')](_0x3e9822)[_0x550e('0x25')](function(_0x1762c3){return _0x1762c3;});}return null;};}function removeEntity(_0x317249,_0x3aa1b8){return function(_0x3bbca3){if(_0x3bbca3){return _0x3bbca3['destroy']()[_0x550e('0x25')](function(){_0x317249[_0x550e('0x1b')](0xcc)[_0x550e('0x1a')]();});}};}function handleEntityNotFound(_0x2d10f3,_0x403391){return function(_0xc94de2){if(!_0xc94de2){_0x2d10f3[_0x550e('0x19')](0x194);}return _0xc94de2;};}function handleError(_0x111161,_0x13ca4e){_0x13ca4e=_0x13ca4e||0x1f4;return function(_0x136beb){logger[_0x550e('0x26')](_0x136beb[_0x550e('0x27')]);if(_0x136beb['name']){delete _0x136beb[_0x550e('0x28')];}_0x111161[_0x550e('0x1b')](_0x13ca4e)['send'](_0x136beb);};}exports[_0x550e('0x29')]=function(_0x78f04c,_0x7ae242){var _0x33bc32={},_0x1a4caa={},_0x403472={'count':0x0,'rows':[]};var _0x449da3=_[_0x550e('0x2a')](db[_0x550e('0x2b')][_0x550e('0x2c')],function(_0x25c40a){return{'name':_0x25c40a[_0x550e('0x2d')],'type':_0x25c40a[_0x550e('0x2e')][_0x550e('0x2f')]};});_0x1a4caa['model']=_[_0x550e('0x2a')](_0x449da3,_0x550e('0x28'));_0x1a4caa['query']=_[_0x550e('0x30')](_0x78f04c[_0x550e('0x31')]);_0x1a4caa['filters']=_[_0x550e('0x32')](_0x1a4caa[_0x550e('0x33')],_0x1a4caa[_0x550e('0x31')]);_0x33bc32[_0x550e('0x34')]=_[_0x550e('0x32')](_0x1a4caa[_0x550e('0x33')],qs[_0x550e('0x35')](_0x78f04c[_0x550e('0x31')]['fields']));_0x33bc32[_0x550e('0x34')]=_0x33bc32['attributes'][_0x550e('0x36')]?_0x33bc32[_0x550e('0x34')]:_0x1a4caa['model'];if(!_0x78f04c[_0x550e('0x31')][_0x550e('0x37')]('nolimit')){_0x33bc32['limit']=qs['limit'](_0x78f04c['query'][_0x550e('0x1d')]);_0x33bc32[_0x550e('0x1f')]=qs[_0x550e('0x1f')](_0x78f04c['query']['offset']);}_0x33bc32['order']=qs[_0x550e('0x38')](_0x78f04c[_0x550e('0x31')]['sort']);_0x33bc32['where']=qs['filters'](_[_0x550e('0x39')](_0x78f04c[_0x550e('0x31')],_0x1a4caa[_0x550e('0x3a')]),_0x449da3);if(_0x78f04c['query']['filter']){_0x33bc32[_0x550e('0x3b')]=_[_0x550e('0x3c')](_0x33bc32[_0x550e('0x3b')],{'$or':_[_0x550e('0x2a')](_0x449da3,function(_0x4f4671){if(_0x4f4671[_0x550e('0x2e')]!==_0x550e('0x3d')){var _0x4cfde4={};_0x4cfde4[_0x4f4671['name']]={'$like':'%'+_0x78f04c[_0x550e('0x31')][_0x550e('0x3e')]+'%'};return _0x4cfde4;}})});}_0x33bc32=_[_0x550e('0x3c')]({},_0x33bc32,_0x78f04c[_0x550e('0x3f')]);var _0x5badca={'where':_0x33bc32[_0x550e('0x3b')]};return db[_0x550e('0x2b')][_0x550e('0x1e')](_0x5badca)[_0x550e('0x25')](function(_0x4d7297){_0x403472[_0x550e('0x1e')]=_0x4d7297;if(_0x78f04c[_0x550e('0x31')][_0x550e('0x40')]){_0x33bc32[_0x550e('0x41')]=[{'all':!![]}];}return db[_0x550e('0x2b')][_0x550e('0x42')](_0x33bc32);})['then'](function(_0x2f8cf5){_0x403472[_0x550e('0x43')]=_0x2f8cf5;return _0x403472;})[_0x550e('0x25')](respondWithFilteredResult(_0x7ae242,_0x33bc32))[_0x550e('0x44')](handleError(_0x7ae242,null));};exports[_0x550e('0x45')]=function(_0x4af549,_0x10f18f){var _0x2db9c9={'raw':!![],'where':{'id':_0x4af549[_0x550e('0x46')]['id']}},_0x5ca5fc={};_0x5ca5fc[_0x550e('0x33')]=_[_0x550e('0x30')](db['WhatsappApplication']['rawAttributes']);_0x5ca5fc[_0x550e('0x31')]=_[_0x550e('0x30')](_0x4af549['query']);_0x5ca5fc[_0x550e('0x3a')]=_[_0x550e('0x32')](_0x5ca5fc['model'],_0x5ca5fc[_0x550e('0x31')]);_0x2db9c9[_0x550e('0x34')]=_[_0x550e('0x32')](_0x5ca5fc[_0x550e('0x33')],qs[_0x550e('0x35')](_0x4af549[_0x550e('0x31')]['fields']));_0x2db9c9[_0x550e('0x34')]=_0x2db9c9['attributes'][_0x550e('0x36')]?_0x2db9c9[_0x550e('0x34')]:_0x5ca5fc['model'];if(_0x4af549[_0x550e('0x31')][_0x550e('0x40')]){_0x2db9c9[_0x550e('0x41')]=[{'all':!![]}];}_0x2db9c9=_[_0x550e('0x3c')]({},_0x2db9c9,_0x4af549[_0x550e('0x3f')]);return db[_0x550e('0x2b')]['find'](_0x2db9c9)[_0x550e('0x25')](handleEntityNotFound(_0x10f18f,null))[_0x550e('0x25')](respondWithResult(_0x10f18f,null))[_0x550e('0x44')](handleError(_0x10f18f,null));};exports[_0x550e('0x47')]=function(_0x5a9ef5,_0xbfd031){return db[_0x550e('0x2b')][_0x550e('0x47')](_0x5a9ef5[_0x550e('0x48')],{})[_0x550e('0x25')](respondWithResult(_0xbfd031,0xc9))[_0x550e('0x44')](handleError(_0xbfd031,null));};exports[_0x550e('0x24')]=function(_0xfbad1e,_0x2d233b){if(_0xfbad1e[_0x550e('0x48')]['id']){delete _0xfbad1e[_0x550e('0x48')]['id'];}return db[_0x550e('0x2b')][_0x550e('0x49')]({'where':{'id':_0xfbad1e[_0x550e('0x46')]['id']}})[_0x550e('0x25')](handleEntityNotFound(_0x2d233b,null))[_0x550e('0x25')](saveUpdates(_0xfbad1e[_0x550e('0x48')],null))['then'](respondWithResult(_0x2d233b,null))[_0x550e('0x44')](handleError(_0x2d233b,null));};exports[_0x550e('0x4a')]=function(_0x22dc07,_0x264c4d){return db[_0x550e('0x2b')][_0x550e('0x49')]({'where':{'id':_0x22dc07[_0x550e('0x46')]['id']}})['then'](handleEntityNotFound(_0x264c4d,null))[_0x550e('0x25')](removeEntity(_0x264c4d,null))[_0x550e('0x44')](handleError(_0x264c4d,null));}; \ No newline at end of file +var _0x4c4a=['WhatsappApplication','include','findAll','rows','catch','show','length','includeAll','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x16ab6b,_0x45a73e){_0x16ab6b=_0x16ab6b-0x0;var _0x91b89=_0x4c4a[_0x16ab6b];return _0x91b89;};'use strict';var emlformat=require(_0xa4c4('0x0'));var rimraf=require(_0xa4c4('0x1'));var zipdir=require(_0xa4c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4c4('0x3'));var moment=require(_0xa4c4('0x4'));var BPromise=require(_0xa4c4('0x5'));var Mustache=require(_0xa4c4('0x6'));var util=require('util');var path=require(_0xa4c4('0x7'));var sox=require('sox');var csv=require(_0xa4c4('0x8'));var ejs=require(_0xa4c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa4c4('0xa'));var crypto=require('crypto');var jsforce=require(_0xa4c4('0xb'));var deskjs=require(_0xa4c4('0xc'));var toCsv=require(_0xa4c4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa4c4('0xd'));var authService=require(_0xa4c4('0xe'));var qs=require(_0xa4c4('0xf'));var as=require(_0xa4c4('0x10'));var hardwareService=require(_0xa4c4('0x11'));var logger=require('../../config/logger')(_0xa4c4('0x12'));var utils=require('../../config/utils');var config=require(_0xa4c4('0x13'));var licenseUtil=require(_0xa4c4('0x14'));var db=require(_0xa4c4('0x15'))['db'];function respondWithStatusCode(_0x2f6c71,_0x1d7750){_0x1d7750=_0x1d7750||0xcc;return function(_0x1f2051){if(_0x1f2051){return _0x2f6c71[_0xa4c4('0x16')](_0x1d7750);}return _0x2f6c71[_0xa4c4('0x17')](_0x1d7750)[_0xa4c4('0x18')]();};}function respondWithResult(_0x57ae15,_0x1abded){_0x1abded=_0x1abded||0xc8;return function(_0x35cc1f){if(_0x35cc1f){return _0x57ae15[_0xa4c4('0x17')](_0x1abded)[_0xa4c4('0x19')](_0x35cc1f);}};}function respondWithFilteredResult(_0x14a55c,_0x19033a){return function(_0x31cde0){if(_0x31cde0){var _0x5e8006=typeof _0x19033a[_0xa4c4('0x1a')]===_0xa4c4('0x1b')&&typeof _0x19033a['limit']===_0xa4c4('0x1b');var _0x451dfa=_0x31cde0[_0xa4c4('0x1c')];var _0x5f5ef=_0x5e8006?0x0:_0x19033a[_0xa4c4('0x1a')];var _0x40661e=_0x5e8006?_0x31cde0[_0xa4c4('0x1c')]:_0x19033a[_0xa4c4('0x1a')]+_0x19033a[_0xa4c4('0x1d')];var _0x157143;if(_0x40661e>=_0x451dfa){_0x40661e=_0x451dfa;_0x157143=0xc8;}else{_0x157143=0xce;}_0x14a55c[_0xa4c4('0x17')](_0x157143);return _0x14a55c[_0xa4c4('0x1e')](_0xa4c4('0x1f'),_0x5f5ef+'-'+_0x40661e+'/'+_0x451dfa)[_0xa4c4('0x19')](_0x31cde0);}return null;};}function patchUpdates(_0x19e17e){return function(_0x167502){try{jsonpatch[_0xa4c4('0x20')](_0x167502,_0x19e17e,!![]);}catch(_0x3cb3a7){return BPromise[_0xa4c4('0x21')](_0x3cb3a7);}return _0x167502['save']();};}function saveUpdates(_0x4e0249,_0x183bdf){return function(_0x3aa9a8){if(_0x3aa9a8){return _0x3aa9a8[_0xa4c4('0x22')](_0x4e0249)[_0xa4c4('0x23')](function(_0xd56b75){return _0xd56b75;});}return null;};}function removeEntity(_0x76b8f1,_0x5f1215){return function(_0x568b6a){if(_0x568b6a){return _0x568b6a['destroy']()[_0xa4c4('0x23')](function(){_0x76b8f1[_0xa4c4('0x17')](0xcc)[_0xa4c4('0x18')]();});}};}function handleEntityNotFound(_0x50bb08,_0x295c57){return function(_0x41f1ac){if(!_0x41f1ac){_0x50bb08[_0xa4c4('0x16')](0x194);}return _0x41f1ac;};}function handleError(_0x48a503,_0x40435d){_0x40435d=_0x40435d||0x1f4;return function(_0xfa33ec){logger[_0xa4c4('0x24')](_0xfa33ec[_0xa4c4('0x25')]);if(_0xfa33ec[_0xa4c4('0x26')]){delete _0xfa33ec['name'];}_0x48a503[_0xa4c4('0x17')](_0x40435d)[_0xa4c4('0x27')](_0xfa33ec);};}exports[_0xa4c4('0x28')]=function(_0x425fd8,_0x182335){var _0x5c3b3b={},_0x32af71={},_0x5688a6={'count':0x0,'rows':[]};var _0x4abddc=_['map'](db['WhatsappApplication'][_0xa4c4('0x29')],function(_0x1d852b){return{'name':_0x1d852b[_0xa4c4('0x2a')],'type':_0x1d852b[_0xa4c4('0x2b')][_0xa4c4('0x2c')]};});_0x32af71['model']=_['map'](_0x4abddc,'name');_0x32af71[_0xa4c4('0x2d')]=_[_0xa4c4('0x2e')](_0x425fd8['query']);_0x32af71[_0xa4c4('0x2f')]=_[_0xa4c4('0x30')](_0x32af71['model'],_0x32af71[_0xa4c4('0x2d')]);_0x5c3b3b[_0xa4c4('0x31')]=_['intersection'](_0x32af71[_0xa4c4('0x32')],qs[_0xa4c4('0x33')](_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x33')]));_0x5c3b3b[_0xa4c4('0x31')]=_0x5c3b3b[_0xa4c4('0x31')]['length']?_0x5c3b3b[_0xa4c4('0x31')]:_0x32af71[_0xa4c4('0x32')];if(!_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x34')](_0xa4c4('0x35'))){_0x5c3b3b[_0xa4c4('0x1d')]=qs[_0xa4c4('0x1d')](_0x425fd8[_0xa4c4('0x2d')]['limit']);_0x5c3b3b[_0xa4c4('0x1a')]=qs['offset'](_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x1a')]);}_0x5c3b3b['order']=qs[_0xa4c4('0x36')](_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x36')]);_0x5c3b3b[_0xa4c4('0x37')]=qs[_0xa4c4('0x2f')](_[_0xa4c4('0x38')](_0x425fd8['query'],_0x32af71[_0xa4c4('0x2f')]),_0x4abddc);if(_0x425fd8[_0xa4c4('0x2d')]['filter']){_0x5c3b3b[_0xa4c4('0x37')]=_[_0xa4c4('0x39')](_0x5c3b3b[_0xa4c4('0x37')],{'$or':_[_0xa4c4('0x3a')](_0x4abddc,function(_0x3193f8){if(_0x3193f8[_0xa4c4('0x2b')]!==_0xa4c4('0x3b')){var _0x2b9c17={};_0x2b9c17[_0x3193f8[_0xa4c4('0x26')]]={'$like':'%'+_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x3c')]+'%'};return _0x2b9c17;}})});}_0x5c3b3b=_[_0xa4c4('0x39')]({},_0x5c3b3b,_0x425fd8['options']);var _0x2b02e0={'where':_0x5c3b3b[_0xa4c4('0x37')]};return db[_0xa4c4('0x3d')][_0xa4c4('0x1c')](_0x2b02e0)['then'](function(_0x588777){_0x5688a6['count']=_0x588777;if(_0x425fd8[_0xa4c4('0x2d')]['includeAll']){_0x5c3b3b[_0xa4c4('0x3e')]=[{'all':!![]}];}return db[_0xa4c4('0x3d')][_0xa4c4('0x3f')](_0x5c3b3b);})[_0xa4c4('0x23')](function(_0x379b5a){_0x5688a6[_0xa4c4('0x40')]=_0x379b5a;return _0x5688a6;})[_0xa4c4('0x23')](respondWithFilteredResult(_0x182335,_0x5c3b3b))[_0xa4c4('0x41')](handleError(_0x182335,null));};exports[_0xa4c4('0x42')]=function(_0x2a6e06,_0x4b6136){var _0x1c00b6={'raw':!![],'where':{'id':_0x2a6e06['params']['id']}},_0x7fea70={};_0x7fea70[_0xa4c4('0x32')]=_[_0xa4c4('0x2e')](db[_0xa4c4('0x3d')][_0xa4c4('0x29')]);_0x7fea70[_0xa4c4('0x2d')]=_[_0xa4c4('0x2e')](_0x2a6e06[_0xa4c4('0x2d')]);_0x7fea70['filters']=_[_0xa4c4('0x30')](_0x7fea70[_0xa4c4('0x32')],_0x7fea70[_0xa4c4('0x2d')]);_0x1c00b6[_0xa4c4('0x31')]=_[_0xa4c4('0x30')](_0x7fea70[_0xa4c4('0x32')],qs[_0xa4c4('0x33')](_0x2a6e06[_0xa4c4('0x2d')][_0xa4c4('0x33')]));_0x1c00b6[_0xa4c4('0x31')]=_0x1c00b6['attributes'][_0xa4c4('0x43')]?_0x1c00b6['attributes']:_0x7fea70[_0xa4c4('0x32')];if(_0x2a6e06[_0xa4c4('0x2d')][_0xa4c4('0x44')]){_0x1c00b6['include']=[{'all':!![]}];}_0x1c00b6=_[_0xa4c4('0x39')]({},_0x1c00b6,_0x2a6e06[_0xa4c4('0x45')]);return db[_0xa4c4('0x3d')][_0xa4c4('0x46')](_0x1c00b6)[_0xa4c4('0x23')](handleEntityNotFound(_0x4b6136,null))[_0xa4c4('0x23')](respondWithResult(_0x4b6136,null))[_0xa4c4('0x41')](handleError(_0x4b6136,null));};exports[_0xa4c4('0x47')]=function(_0x1157ff,_0x381092){return db[_0xa4c4('0x3d')][_0xa4c4('0x47')](_0x1157ff[_0xa4c4('0x48')],{})[_0xa4c4('0x23')](respondWithResult(_0x381092,0xc9))[_0xa4c4('0x41')](handleError(_0x381092,null));};exports[_0xa4c4('0x22')]=function(_0x197e84,_0x835f73){if(_0x197e84[_0xa4c4('0x48')]['id']){delete _0x197e84[_0xa4c4('0x48')]['id'];}return db[_0xa4c4('0x3d')]['find']({'where':{'id':_0x197e84[_0xa4c4('0x49')]['id']}})[_0xa4c4('0x23')](handleEntityNotFound(_0x835f73,null))['then'](saveUpdates(_0x197e84[_0xa4c4('0x48')],null))['then'](respondWithResult(_0x835f73,null))['catch'](handleError(_0x835f73,null));};exports[_0xa4c4('0x4a')]=function(_0xb812e5,_0x187cc0){return db[_0xa4c4('0x3d')][_0xa4c4('0x46')]({'where':{'id':_0xb812e5[_0xa4c4('0x49')]['id']}})[_0xa4c4('0x23')](handleEntityNotFound(_0x187cc0,null))[_0xa4c4('0x23')](removeEntity(_0x187cc0,null))[_0xa4c4('0x41')](handleError(_0x187cc0,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c93cba2..54f42e1 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 _0x089f=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','utf8mb4','util'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0x089f,0x1c7));var _0xf089=function(_0x4157a7,_0x2fb62e){_0x4157a7=_0x4157a7-0x0;var _0x4ba2a2=_0x089f[_0x4157a7];return _0x4ba2a2;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var logger=require(_0xf089('0x1'))(_0xf089('0x2'));var moment=require(_0xf089('0x3'));var BPromise=require(_0xf089('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf089('0x5'));var rimraf=require(_0xf089('0x6'));var config=require(_0xf089('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xf089('0x8')]=function(_0x126d3d,_0x21bce2){return _0x126d3d['define'](_0xf089('0x9'),attributes,{'tableName':_0xf089('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf089('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x66fa=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','lodash','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66fa,0x168));var _0xa66f=function(_0x251814,_0x4bfd1d){_0x251814=_0x251814-0x0;var _0x32ca82=_0x66fa[_0x251814];return _0x32ca82;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require(_0xa66f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var fs=require('fs');var path=require(_0xa66f('0x5'));var rimraf=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var attributes=require(_0xa66f('0x8'));module[_0xa66f('0x9')]=function(_0x4532ee,_0x25a7a0){return _0x4532ee[_0xa66f('0xa')](_0xa66f('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa66f('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b0988d9..d4e8cd7 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 _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x14d027,_0x2903eb){var _0x56a1bb=function(_0x511f8f){while(--_0x511f8f){_0x14d027['push'](_0x14d027['shift']());}};_0x56a1bb(++_0x2903eb);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0xd0bb[_0x599d7f];return _0x3346d3;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file +var _0x4ea3=['WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e4d4bd5..7e2ee25 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 _0x4300=['removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','update','whatsappinteraction:destroy','destroy'];(function(_0x4bff69,_0x5b3bc8){var _0x490f4c=function(_0x1995b9){while(--_0x1995b9){_0x4bff69['push'](_0x4bff69['shift']());}};_0x490f4c(++_0x5b3bc8);}(_0x4300,0x1a6));var _0x0430=function(_0x56dddf,_0x470a16){_0x56dddf=_0x56dddf-0x0;var _0x16a959=_0x4300[_0x56dddf];return _0x16a959;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var fs_extra=require(_0x0430('0x2'));var auth=require(_0x0430('0x3'));var interaction=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x0430('0x6')]('/',auth['isAuthenticated'](),controller[_0x0430('0x7')]);router['get'](_0x0430('0x8'),auth[_0x0430('0x9')](),controller[_0x0430('0xa')]);router[_0x0430('0x6')](_0x0430('0xb'),auth[_0x0430('0x9')](),controller[_0x0430('0xc')]);router[_0x0430('0x6')](_0x0430('0xd'),auth['isAuthenticated'](),controller[_0x0430('0xe')]);router[_0x0430('0x6')](_0x0430('0xf'),auth[_0x0430('0x9')](),controller[_0x0430('0x10')]);router[_0x0430('0x11')]('/',auth[_0x0430('0x9')](),controller[_0x0430('0x12')]);router['post']('/:id/messages',auth[_0x0430('0x9')](),controller[_0x0430('0x13')]);router[_0x0430('0x11')](_0x0430('0x14'),auth[_0x0430('0x9')](),interaction[_0x0430('0x15')](_0x0430('0x16'),'whatsappinteraction:addtags'),controller[_0x0430('0x17')]);router[_0x0430('0x18')](_0x0430('0xb'),auth[_0x0430('0x9')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0x0430('0x19')]);router['delete']('/:id',auth[_0x0430('0x9')](),interaction[_0x0430('0x15')](_0x0430('0x16'),_0x0430('0x1a')),controller[_0x0430('0x1b')]);router['delete']('/:id/tags',auth[_0x0430('0x9')](),controller[_0x0430('0x1c')]);module[_0x0430('0x1d')]=router; \ No newline at end of file +var _0x126e=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x126e,0x108));var _0xe126=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x126e[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xe126('0x0'));var path=require(_0xe126('0x1'));var timeout=require(_0xe126('0x2'));var express=require(_0xe126('0x3'));var router=express[_0xe126('0x4')]();var fs_extra=require(_0xe126('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe126('0x6'));var config=require(_0xe126('0x7'));var controller=require(_0xe126('0x8'));router[_0xe126('0x9')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xb')]);router[_0xe126('0x9')]('/describe',auth[_0xe126('0xa')](),controller[_0xe126('0xc')]);router[_0xe126('0x9')](_0xe126('0xd'),auth[_0xe126('0xa')](),controller['show']);router[_0xe126('0x9')](_0xe126('0xe'),auth['isAuthenticated'](),controller[_0xe126('0xf')]);router[_0xe126('0x9')]('/:id/download',auth[_0xe126('0xa')](),controller['download']);router[_0xe126('0x10')]('/',auth['isAuthenticated'](),controller[_0xe126('0x11')]);router[_0xe126('0x10')](_0xe126('0xe'),auth[_0xe126('0xa')](),controller[_0xe126('0x12')]);router[_0xe126('0x10')](_0xe126('0x13'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),'whatsappinteraction:addtags'),controller[_0xe126('0x16')]);router[_0xe126('0x17')](_0xe126('0xd'),auth[_0xe126('0xa')](),interaction['tracked'](_0xe126('0x15'),_0xe126('0x18')),controller[_0xe126('0x19')]);router['delete'](_0xe126('0xd'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),_0xe126('0x1a')),controller[_0xe126('0x1b')]);router[_0xe126('0x1c')](_0xe126('0x13'),auth[_0xe126('0xa')](),controller[_0xe126('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 7cc18a4..a8b50b7 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 _0x3a5e=['DATE','STRING','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x3780e9,_0x30a2e9){_0x3780e9=_0x3780e9-0x0;var _0x1dc02c=_0x3a5e[_0x3780e9];return _0x1dc02c;};'use strict';var Sequelize=require(_0xe3a5('0x0'));var moment=require(_0xe3a5('0x1'));module[_0xe3a5('0x2')]={'closed':{'type':Sequelize[_0xe3a5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe3a5('0x4')]},'disposition':{'type':Sequelize[_0xe3a5('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe3a5('0x5')]},'note':{'type':Sequelize[_0xe3a5('0x5')]},'phone':{'type':Sequelize[_0xe3a5('0x5')]},'read1stAt':{'type':Sequelize[_0xe3a5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe3a5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe3a5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe3a5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4a25=['exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x4a25,0x1d4));var _0x54a2=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x4a25[_0x47cfa0];return _0x386b1d;};'use strict';var Sequelize=require(_0x54a2('0x0'));var moment=require('moment');module[_0x54a2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x54a2('0x2')]},'disposition':{'type':Sequelize[_0x54a2('0x3')]},'secondDisposition':{'type':Sequelize[_0x54a2('0x3')]},'thirdDisposition':{'type':Sequelize[_0x54a2('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x54a2('0x3')]},'read1stAt':{'type':Sequelize[_0x54a2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x54a2('0x4')]('in',_0x54a2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x54a2('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x54a2('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x54a2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 4304e19..251cdfc 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 _0x09d1=['omit','getMessages','intersection','nolimit','sort','where','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','firstName','lastName','Attachment','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Owner','fullname','N.A.','createdAt','toString','closedAt','disposition','filter','map','basename','createReadStream','out','System','Contact','value','renderFile','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','user','show','params','model','keys','WhatsappInteraction','query','filters','attributes','fields','length','includeAll','include','merge','find','catch','create','body','describe','addMessage','WhatsappMessage','ids'];(function(_0x186591,_0x41385c){var _0x54d42d=function(_0x50e4f9){while(--_0x50e4f9){_0x186591['push'](_0x186591['shift']());}};_0x54d42d(++_0x41385c);}(_0x09d1,0xba));var _0x109d=function(_0x152a71,_0x86006c){_0x152a71=_0x152a71-0x0;var _0x38a371=_0x09d1[_0x152a71];return _0x38a371;};'use strict';var rimraf=require(_0x109d('0x0'));var zipdir=require(_0x109d('0x1'));var moment=require('moment');var BPromise=require(_0x109d('0x2'));var util=require(_0x109d('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x109d('0x4'));var Redis=require(_0x109d('0x5'));var interaction=require(_0x109d('0x6'));var qs=require(_0x109d('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x109d('0x8'));var config=require(_0x109d('0x9'));var db=require(_0x109d('0xa'))['db'];config[_0x109d('0xb')]=_[_0x109d('0xc')](config[_0x109d('0xb')],{'host':_0x109d('0xd'),'port':0x18eb});var socket=require(_0x109d('0xe'))(new Redis(config[_0x109d('0xb')]));require(_0x109d('0xf'))['register'](socket);function respondWithStatusCode(_0x1ef07b,_0x3114cb){_0x3114cb=_0x3114cb||0xcc;return function(_0x3b6731){if(_0x3b6731){return _0x1ef07b[_0x109d('0x10')](_0x3114cb);}return _0x1ef07b[_0x109d('0x11')](_0x3114cb)['end']();};}function respondWithResult(_0x587581,_0x104ba0){_0x104ba0=_0x104ba0||0xc8;return function(_0x586dc0){if(_0x586dc0){return _0x587581[_0x109d('0x11')](_0x104ba0)[_0x109d('0x12')](_0x586dc0);}};}function respondWithFilteredResult(_0xbca6a3,_0xff5390){return function(_0x4a6853){if(_0x4a6853){var _0xfe278e=typeof _0xff5390['offset']==='undefined'&&typeof _0xff5390[_0x109d('0x13')]===_0x109d('0x14');var _0x3086d6=_0x4a6853[_0x109d('0x15')];var _0x42dfe4=_0xfe278e?0x0:_0xff5390[_0x109d('0x16')];var _0x55dec5=_0xfe278e?_0x4a6853[_0x109d('0x15')]:_0xff5390['offset']+_0xff5390[_0x109d('0x13')];var _0x472cd2;if(_0x55dec5>=_0x3086d6){_0x55dec5=_0x3086d6;_0x472cd2=0xc8;}else{_0x472cd2=0xce;}_0xbca6a3['status'](_0x472cd2);return _0xbca6a3[_0x109d('0x17')](_0x109d('0x18'),_0x42dfe4+'-'+_0x55dec5+'/'+_0x3086d6)[_0x109d('0x12')](_0x4a6853);}return null;};}function saveUpdates(_0x4b583a){return function(_0x576d9c){if(_0x576d9c){return _0x576d9c[_0x109d('0x19')](_0x4b583a)[_0x109d('0x1a')](function(_0x3c38f7){return _0x3c38f7;});}return null;};}function removeEntity(_0x16286a){return function(_0x512a89){if(_0x512a89){return _0x512a89[_0x109d('0x1b')]()[_0x109d('0x1a')](function(){_0x16286a[_0x109d('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa00cb9){return function(_0x3316fb){if(!_0x3316fb){_0xa00cb9[_0x109d('0x10')](0x194);}return _0x3316fb;};}function handleError(_0x32faa3,_0x3933b8){_0x3933b8=_0x3933b8||0x1f4;return function(_0x4e0017){logger[_0x109d('0x1c')](_0x4e0017[_0x109d('0x1d')]);if(_0x4e0017[_0x109d('0x1e')]){delete _0x4e0017[_0x109d('0x1e')];}_0x32faa3[_0x109d('0x11')](_0x3933b8)[_0x109d('0x1f')](_0x4e0017);};}exports[_0x109d('0x20')]=function(_0x49cca0,_0x46a82a){var _0x20d644={};var _0x1a9d8d=_['map'](db['WhatsappInteraction'][_0x109d('0x21')],function(_0x4b0d5e){return{'name':_0x4b0d5e[_0x109d('0x22')],'type':_0x4b0d5e[_0x109d('0x23')][_0x109d('0x24')]};});_0x20d644=qs[_0x109d('0x25')](_0x1a9d8d,_0x49cca0);return interaction[_0x109d('0x26')](_0x109d('0x27'),_0x49cca0['query'],_0x49cca0[_0x109d('0x28')],_0x20d644,_0x1a9d8d)[_0x109d('0x1a')](respondWithFilteredResult(_0x46a82a,_0x20d644))['catch'](handleError(_0x46a82a,null));};exports[_0x109d('0x29')]=function(_0x378b97,_0xa52fe4){var _0x555e35={'raw':![],'where':{'id':_0x378b97[_0x109d('0x2a')]['id']}},_0x47f0ab={};_0x47f0ab[_0x109d('0x2b')]=_[_0x109d('0x2c')](db[_0x109d('0x2d')][_0x109d('0x21')]);_0x47f0ab[_0x109d('0x2e')]=_[_0x109d('0x2c')](_0x378b97['query']);_0x47f0ab[_0x109d('0x2f')]=_['intersection'](_0x47f0ab['model'],_0x47f0ab[_0x109d('0x2e')]);_0x555e35[_0x109d('0x30')]=_['intersection'](_0x47f0ab[_0x109d('0x2b')],qs['fields'](_0x378b97[_0x109d('0x2e')][_0x109d('0x31')]));_0x555e35[_0x109d('0x30')]=_0x555e35[_0x109d('0x30')][_0x109d('0x32')]?_0x555e35[_0x109d('0x30')]:_0x47f0ab['model'];if(_0x378b97['query'][_0x109d('0x33')]){_0x555e35[_0x109d('0x34')]=[{'all':!![]}];}_0x555e35=_[_0x109d('0x35')]({},_0x555e35,_0x378b97['options']);return db['WhatsappInteraction'][_0x109d('0x36')](_0x555e35)[_0x109d('0x1a')](handleEntityNotFound(_0xa52fe4,null))[_0x109d('0x1a')](respondWithResult(_0xa52fe4,null))[_0x109d('0x37')](handleError(_0xa52fe4,null));};exports[_0x109d('0x38')]=function(_0x41a7f4,_0x21da85){return db[_0x109d('0x2d')][_0x109d('0x38')](_0x41a7f4[_0x109d('0x39')],{})['then'](respondWithResult(_0x21da85,0xc9))[_0x109d('0x37')](handleError(_0x21da85,null));};exports[_0x109d('0x19')]=function(_0xd3e6cc,_0x3ca95b){if(_0xd3e6cc[_0x109d('0x39')]['id']){delete _0xd3e6cc[_0x109d('0x39')]['id'];}return db['WhatsappInteraction'][_0x109d('0x36')]({'where':{'id':_0xd3e6cc['params']['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x3ca95b,null))[_0x109d('0x1a')](saveUpdates(_0xd3e6cc[_0x109d('0x39')],null))[_0x109d('0x1a')](respondWithResult(_0x3ca95b,null))[_0x109d('0x37')](handleError(_0x3ca95b,null));};exports['destroy']=function(_0x28dd44,_0x4af88f){return db[_0x109d('0x2d')][_0x109d('0x36')]({'where':{'id':_0x28dd44['params']['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x4af88f,null))['then'](removeEntity(_0x4af88f,null))[_0x109d('0x37')](handleError(_0x4af88f,null));};exports['describe']=function(_0x4b0021,_0x228ea7){return db[_0x109d('0x2d')][_0x109d('0x3a')]()[_0x109d('0x1a')](respondWithResult(_0x228ea7,null))[_0x109d('0x37')](handleError(_0x228ea7,null));};exports[_0x109d('0x3b')]=function(_0x16d4e7,_0x2e3529){return db[_0x109d('0x3c')][_0x109d('0x36')]({'where':{'id':_0x16d4e7[_0x109d('0x2a')]['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x2e3529,null))[_0x109d('0x1a')](function(_0x1a4833){if(_0x1a4833){return _0x1a4833[_0x109d('0x3b')](_0x16d4e7[_0x109d('0x39')][_0x109d('0x3d')],_[_0x109d('0x3e')](_0x16d4e7['body'],['ids','id'])||{});}})[_0x109d('0x1a')](respondWithResult(_0x2e3529,null))['catch'](handleError(_0x2e3529,null));};exports[_0x109d('0x3f')]=function(_0x104347,_0x3fe28c){var _0x3e253e={'raw':![],'where':{}};var _0x88a0d6={};var _0x36ad9d={'count':0x0,'rows':[]};return db[_0x109d('0x2d')]['findOne']({'where':{'id':_0x104347[_0x109d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3fe28c,null))[_0x109d('0x1a')](function(_0x122f75){if(_0x122f75){_0x88a0d6[_0x109d('0x2b')]=_[_0x109d('0x2c')](db[_0x109d('0x3c')][_0x109d('0x21')]);_0x88a0d6[_0x109d('0x2e')]=_[_0x109d('0x2c')](_0x104347[_0x109d('0x2e')]);_0x88a0d6[_0x109d('0x2f')]=_[_0x109d('0x40')](_0x88a0d6[_0x109d('0x2b')],_0x88a0d6[_0x109d('0x2e')]);_0x3e253e[_0x109d('0x30')]=_[_0x109d('0x40')](_0x88a0d6[_0x109d('0x2b')],qs[_0x109d('0x31')](_0x104347['query'][_0x109d('0x31')]));_0x3e253e[_0x109d('0x30')]=_0x3e253e[_0x109d('0x30')]['length']?_0x3e253e[_0x109d('0x30')]:_0x88a0d6['model'];if(!_0x104347[_0x109d('0x2e')]['hasOwnProperty'](_0x109d('0x41'))){_0x3e253e['limit']=qs[_0x109d('0x13')](_0x104347[_0x109d('0x2e')]['limit']);_0x3e253e['offset']=qs[_0x109d('0x16')](_0x104347['query'][_0x109d('0x16')]);}_0x3e253e['order']=qs['sort'](_0x104347[_0x109d('0x2e')][_0x109d('0x42')]);_0x3e253e[_0x109d('0x43')]=qs[_0x109d('0x2f')](_[_0x109d('0x44')](_0x104347[_0x109d('0x2e')],_0x88a0d6['filters']));_0x3e253e['where']['WhatsappInteractionId']=_0x122f75['id'];if(_0x104347[_0x109d('0x2e')]['filter']){_0x3e253e[_0x109d('0x43')]=_[_0x109d('0x35')](_0x3e253e['where'],{'$or':_['map'](_0x3e253e['attributes'],function(_0x147a6a){var _0x5ddfe7={};_0x5ddfe7[_0x147a6a]={'$like':'%'+_0x104347['query']['filter']+'%'};return _0x5ddfe7;})});}if(_0x104347[_0x109d('0x2e')]['$gte']){var _0x5e2f60=_0x104347[_0x109d('0x2e')][_0x109d('0x45')][_0x109d('0x46')](',');var _0xa2305c={};_0xa2305c[_0x5e2f60[0x0]]={'$gte':moment(_0x5e2f60[0x1])[_0x109d('0x47')](_0x109d('0x48'))};_0x3e253e[_0x109d('0x43')]=_[_0x109d('0x35')](_0x3e253e[_0x109d('0x43')],_0xa2305c);}_0x3e253e=_[_0x109d('0x35')]({},_0x3e253e,_0x104347['options']);return db[_0x109d('0x3c')][_0x109d('0x15')]({'where':_0x3e253e[_0x109d('0x43')]})['then'](function(_0x41e0ee){_0x36ad9d[_0x109d('0x15')]=_0x41e0ee;if(_0x104347[_0x109d('0x2e')][_0x109d('0x33')]){_0x3e253e[_0x109d('0x34')]=[{'all':!![]}];}return db[_0x109d('0x3c')]['findAll'](_0x3e253e);})[_0x109d('0x1a')](function(_0x5a2e16){_0x36ad9d[_0x109d('0x49')]=_0x5a2e16;return _0x36ad9d;});}})['then'](respondWithFilteredResult(_0x3fe28c,_0x3e253e))[_0x109d('0x37')](handleError(_0x3fe28c,null));};exports[_0x109d('0x4a')]=function(_0x216207,_0x40433b){return db['WhatsappInteraction'][_0x109d('0x36')]({'where':{'id':_0x216207[_0x109d('0x2a')]['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x40433b,null))[_0x109d('0x1a')](function(_0x139452){if(_0x139452){return _0x139452[_0x109d('0x4b')](_0x216207[_0x109d('0x39')][_0x109d('0x3d')],_[_0x109d('0x3e')](_0x216207['body'],['ids','id'])||{})['spread'](function(){return db[_0x109d('0x4c')]['findAll']({'attributes':['id',_0x109d('0x1e'),'color'],'where':{'id':_0x216207['body'][_0x109d('0x3d')]}});})[_0x109d('0x1a')](function(_0x16bb56){socket['emit'](_0x109d('0x4d'),{'id':Number(_0x216207[_0x109d('0x2a')]['id']),'tags':_0x16bb56||[]});return{'id':Number(_0x216207[_0x109d('0x2a')]['id']),'tags':_0x16bb56||[]};});}})[_0x109d('0x1a')](respondWithResult(_0x40433b,null))[_0x109d('0x37')](handleError(_0x40433b,null));};exports[_0x109d('0x4e')]=function(_0x338c8e,_0x584846){return db[_0x109d('0x2d')][_0x109d('0x36')]({'where':{'id':_0x338c8e[_0x109d('0x2a')]['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x584846,null))[_0x109d('0x1a')](function(_0x406aa2){if(_0x406aa2){return _0x406aa2['removeTags'](_0x338c8e[_0x109d('0x2e')]['ids']);}})[_0x109d('0x1a')](respondWithStatusCode(_0x584846,null))['catch'](handleError(_0x584846,null));};exports[_0x109d('0x4f')]=function(_0xa36185,_0x4cabc0){var _0x1248e9=moment()[_0x109d('0x50')]()['toString']();var _0x4fccf6=path[_0x109d('0x51')](config[_0x109d('0x52')],_0x109d('0x53'),_0x109d('0x54'),_0x109d('0x55'));var _0x2aa28a=path[_0x109d('0x51')](config[_0x109d('0x52')],'server',_0x109d('0x54'),_0x109d('0x56'));var _0x318c68=path[_0x109d('0x51')](_0x4fccf6,_0x1248e9);var _0x43bcce=util[_0x109d('0x47')](_0x109d('0x57'),_0xa36185[_0x109d('0x2a')]['id'],_0x1248e9);var _0x1b49e6=path[_0x109d('0x51')](_0x4fccf6,_0x43bcce);var _0x2cf430=[];_0x2cf430['push']({'model':db[_0x109d('0x58')],'as':_0x109d('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x2cf430[_0x109d('0x59')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x109d('0x5a'),_0x109d('0x5b')],'raw':!![]});if(_0xa36185[_0x109d('0x2e')][_0x109d('0x56')]){_0x2cf430[_0x109d('0x59')]({'model':db['Attachment'],'as':_0x109d('0x5c'),'raw':!![]});}var _0x79a3e9=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x109d('0x39'),'createdAt',_0x109d('0x5d'),_0x109d('0x5e'),_0x109d('0x5f')],'include':_0x2cf430}];_0x79a3e9['push']({'model':db[_0x109d('0x60')],'as':_0x109d('0x61'),'attributes':['id',_0x109d('0x1e')]});_0x79a3e9[_0x109d('0x59')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x109d('0x2d')][_0x109d('0x36')]({'where':{'id':_0xa36185[_0x109d('0x2a')]['id']},'include':_0x79a3e9})[_0x109d('0x1a')](handleEntityNotFound(_0x4cabc0,null))[_0x109d('0x1a')](function(_0x59bd25){if(_0x59bd25){var _0x22df86=_0x59bd25[_0x109d('0x62')]({'plain':!![]});fs[_0x109d('0x63')](_0x318c68);var _0xbbf41={'channel':'Whatsapp','account':_0x22df86[_0x109d('0x61')][_0x109d('0x1e')],'agent':_0x22df86['Owner']?_0x22df86[_0x109d('0x64')][_0x109d('0x65')]:_0x109d('0x66'),'createdAt':moment(_0x22df86[_0x109d('0x67')])[_0x109d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x109d('0x68')](),'closedAt':_0x22df86['closed']?moment(_0x22df86[_0x109d('0x69')])[_0x109d('0x47')](_0x109d('0x48'))[_0x109d('0x68')]():'','disposition':_0x22df86[_0x109d('0x6a')],'messages':_(_0x22df86['Messages'])[_0x109d('0x6b')]({'secret':![]})[_0x109d('0x6c')](function(_0x458a5a){if(_0x458a5a['Attachment']){var _0x2412fc=path[_0x109d('0x51')](_0x2aa28a,_0x458a5a[_0x109d('0x5c')][_0x109d('0x6d')]);if(fs['existsSync'](_0x2412fc)){fs[_0x109d('0x6e')](_0x2412fc)['pipe'](fs['createWriteStream'](path[_0x109d('0x51')](_0x318c68,_0x458a5a[_0x109d('0x5c')]['basename'])));}}return{'date':moment(_0x458a5a['createdAt'])[_0x109d('0x47')](_0x109d('0x48'))[_0x109d('0x68')](),'sender':_0x458a5a['direction']===_0x109d('0x6f')?_0x458a5a[_0x109d('0x58')]?_0x458a5a[_0x109d('0x58')][_0x109d('0x65')]:_0x109d('0x70'):_0x458a5a[_0x109d('0x71')][_0x109d('0x5a')]+(_0x458a5a[_0x109d('0x71')][_0x109d('0x5b')]?'\x20'+_0x458a5a[_0x109d('0x71')]['lastName']:''),'body':_0x458a5a[_0x109d('0x5c')]?_0x458a5a['Attachment']['basename']:_0x458a5a['body'],'direction':_0x458a5a[_0x109d('0x5d')]===_0x109d('0x6f')?'A':'C','secret':_0x458a5a[_0x109d('0x5e')],'read':_0x458a5a[_0x109d('0x5f')],'attachment':_0x458a5a['Attachment']};})[_0x109d('0x72')]()};return ejs[_0x109d('0x73')](path[_0x109d('0x51')](config['root'],_0x109d('0x53'),_0x109d('0x74'),'downloadInteraction.ejs'),{'interaction':_0xbbf41})[_0x109d('0x1a')](function(_0x596f8e){var _0x555429=path[_0x109d('0x51')](_0x318c68,_0x109d('0x75')+_0x22df86['id']+'-'+_0x1248e9+_0x109d('0x76'));var _0x1f5279={'path':_0x555429,'channel':_0x109d('0x77'),'interactionId':_0x22df86['id']};return pdf[_0x109d('0x78')](_0x596f8e,_0x1f5279);})[_0x109d('0x1a')](function(){return new BPromise(function(_0x15e6ed,_0x165ee0){zipdir(_0x318c68,{'saveTo':_0x1b49e6},function(_0x86e556,_0x33a882){if(_0x86e556)return _0x165ee0(_0x86e556);return _0x15e6ed(_0x33a882);});})[_0x109d('0x1a')](function(){return new BPromise(function(_0x2abb51,_0x43dcd8){rimraf(_0x318c68,function(_0x36c6d1){if(_0x36c6d1)_0x43dcd8(_0x36c6d1);return _0x2abb51();});});})[_0x109d('0x1a')](function(){return _0x4cabc0['download'](_0x1b49e6,_0x43bcce,function(_0x1dfffd){if(_0x1dfffd){console[_0x109d('0x79')](_0x109d('0x7a'),_0x1dfffd);}else{fs[_0x109d('0x7b')](_0x1b49e6);}});});});}else{return _0x4cabc0[_0x109d('0x10')](0xc8);}})[_0x109d('0x37')](handleError(_0x4cabc0,null));}; \ No newline at end of file +var _0x712c=['$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','WhatsappMessage','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','join','server','tmp','root','files','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','out','System','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','model','intersection','attributes','fields','includeAll','merge','options','create','body','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x712c,0x1c9));var _0xc712=function(_0x41920b,_0x2d534f){_0x41920b=_0x41920b-0x0;var _0x4294af=_0x712c[_0x41920b];return _0x4294af;};'use strict';var rimraf=require(_0xc712('0x0'));var zipdir=require(_0xc712('0x1'));var moment=require(_0xc712('0x2'));var BPromise=require(_0xc712('0x3'));var util=require(_0xc712('0x4'));var path=require(_0xc712('0x5'));var ejs=require(_0xc712('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc712('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xc712('0x8'));var logger=require(_0xc712('0x9'))(_0xc712('0xa'));var config=require(_0xc712('0xb'));var db=require(_0xc712('0xc'))['db'];config[_0xc712('0xd')]=_[_0xc712('0xe')](config[_0xc712('0xd')],{'host':_0xc712('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc712('0x10'))[_0xc712('0x11')](socket);function respondWithStatusCode(_0x5182f0,_0x4daf5e){_0x4daf5e=_0x4daf5e||0xcc;return function(_0x4207b5){if(_0x4207b5){return _0x5182f0[_0xc712('0x12')](_0x4daf5e);}return _0x5182f0[_0xc712('0x13')](_0x4daf5e)[_0xc712('0x14')]();};}function respondWithResult(_0x359406,_0x2b80c1){_0x2b80c1=_0x2b80c1||0xc8;return function(_0x5e41a6){if(_0x5e41a6){return _0x359406[_0xc712('0x13')](_0x2b80c1)[_0xc712('0x15')](_0x5e41a6);}};}function respondWithFilteredResult(_0x4ae685,_0x56f5b9){return function(_0x243111){if(_0x243111){var _0x2601cf=typeof _0x56f5b9[_0xc712('0x16')]===_0xc712('0x17')&&typeof _0x56f5b9[_0xc712('0x18')]===_0xc712('0x17');var _0x143c14=_0x243111[_0xc712('0x19')];var _0x37e368=_0x2601cf?0x0:_0x56f5b9['offset'];var _0x32b1d7=_0x2601cf?_0x243111[_0xc712('0x19')]:_0x56f5b9[_0xc712('0x16')]+_0x56f5b9[_0xc712('0x18')];var _0x4a54c1;if(_0x32b1d7>=_0x143c14){_0x32b1d7=_0x143c14;_0x4a54c1=0xc8;}else{_0x4a54c1=0xce;}_0x4ae685[_0xc712('0x13')](_0x4a54c1);return _0x4ae685[_0xc712('0x1a')](_0xc712('0x1b'),_0x37e368+'-'+_0x32b1d7+'/'+_0x143c14)[_0xc712('0x15')](_0x243111);}return null;};}function saveUpdates(_0x50483b){return function(_0x135f4d){if(_0x135f4d){return _0x135f4d[_0xc712('0x1c')](_0x50483b)[_0xc712('0x1d')](function(_0x595521){return _0x595521;});}return null;};}function removeEntity(_0x18e6bf){return function(_0xb0bb6e){if(_0xb0bb6e){return _0xb0bb6e['destroy']()[_0xc712('0x1d')](function(){_0x18e6bf['status'](0xcc)[_0xc712('0x14')]();});}};}function handleEntityNotFound(_0x1c94ca){return function(_0x2406ca){if(!_0x2406ca){_0x1c94ca[_0xc712('0x12')](0x194);}return _0x2406ca;};}function handleError(_0xe80ecb,_0x3ddbdb){_0x3ddbdb=_0x3ddbdb||0x1f4;return function(_0xb65df){logger[_0xc712('0x1e')](_0xb65df[_0xc712('0x1f')]);if(_0xb65df[_0xc712('0x20')]){delete _0xb65df['name'];}_0xe80ecb[_0xc712('0x13')](_0x3ddbdb)[_0xc712('0x21')](_0xb65df);};}exports[_0xc712('0x22')]=function(_0x4d67f7,_0x2522c6){var _0x408b1c={};var _0x28f45b=_[_0xc712('0x23')](db[_0xc712('0x24')][_0xc712('0x25')],function(_0x1119f9){return{'name':_0x1119f9['fieldName'],'type':_0x1119f9[_0xc712('0x26')][_0xc712('0x27')]};});_0x408b1c=qs[_0xc712('0x28')](_0x28f45b,_0x4d67f7);return interaction[_0xc712('0x29')](_0xc712('0x2a'),_0x4d67f7[_0xc712('0x2b')],_0x4d67f7[_0xc712('0x2c')],_0x408b1c,_0x28f45b)['then'](respondWithFilteredResult(_0x2522c6,_0x408b1c))[_0xc712('0x2d')](handleError(_0x2522c6,null));};exports[_0xc712('0x2e')]=function(_0x7b8ff,_0x2224a1){var _0x113db0={'raw':![],'where':{'id':_0x7b8ff[_0xc712('0x2f')]['id']}},_0x2f8834={};_0x2f8834[_0xc712('0x30')]=_['keys'](db[_0xc712('0x24')][_0xc712('0x25')]);_0x2f8834[_0xc712('0x2b')]=_['keys'](_0x7b8ff[_0xc712('0x2b')]);_0x2f8834['filters']=_[_0xc712('0x31')](_0x2f8834['model'],_0x2f8834[_0xc712('0x2b')]);_0x113db0[_0xc712('0x32')]=_['intersection'](_0x2f8834['model'],qs[_0xc712('0x33')](_0x7b8ff[_0xc712('0x2b')]['fields']));_0x113db0[_0xc712('0x32')]=_0x113db0['attributes']['length']?_0x113db0['attributes']:_0x2f8834['model'];if(_0x7b8ff[_0xc712('0x2b')][_0xc712('0x34')]){_0x113db0['include']=[{'all':!![]}];}_0x113db0=_[_0xc712('0x35')]({},_0x113db0,_0x7b8ff[_0xc712('0x36')]);return db[_0xc712('0x24')]['find'](_0x113db0)[_0xc712('0x1d')](handleEntityNotFound(_0x2224a1,null))[_0xc712('0x1d')](respondWithResult(_0x2224a1,null))[_0xc712('0x2d')](handleError(_0x2224a1,null));};exports[_0xc712('0x37')]=function(_0x2d1ab0,_0x5f44da){return db[_0xc712('0x24')][_0xc712('0x37')](_0x2d1ab0[_0xc712('0x38')],{})[_0xc712('0x1d')](respondWithResult(_0x5f44da,0xc9))['catch'](handleError(_0x5f44da,null));};exports[_0xc712('0x1c')]=function(_0x4add40,_0x5b8297){if(_0x4add40['body']['id']){delete _0x4add40['body']['id'];}return db['WhatsappInteraction'][_0xc712('0x39')]({'where':{'id':_0x4add40[_0xc712('0x2f')]['id']}})[_0xc712('0x1d')](handleEntityNotFound(_0x5b8297,null))[_0xc712('0x1d')](saveUpdates(_0x4add40[_0xc712('0x38')],null))[_0xc712('0x1d')](respondWithResult(_0x5b8297,null))['catch'](handleError(_0x5b8297,null));};exports[_0xc712('0x3a')]=function(_0x5b4c27,_0x4dddd5){return db[_0xc712('0x24')][_0xc712('0x39')]({'where':{'id':_0x5b4c27[_0xc712('0x2f')]['id']}})[_0xc712('0x1d')](handleEntityNotFound(_0x4dddd5,null))[_0xc712('0x1d')](removeEntity(_0x4dddd5,null))[_0xc712('0x2d')](handleError(_0x4dddd5,null));};exports[_0xc712('0x3b')]=function(_0x1cbda6,_0x1be5a9){return db[_0xc712('0x24')][_0xc712('0x3b')]()[_0xc712('0x1d')](respondWithResult(_0x1be5a9,null))['catch'](handleError(_0x1be5a9,null));};exports['addMessage']=function(_0x5011fc,_0x260033){return db['WhatsappMessage']['find']({'where':{'id':_0x5011fc[_0xc712('0x2f')]['id']}})[_0xc712('0x1d')](handleEntityNotFound(_0x260033,null))[_0xc712('0x1d')](function(_0x24586d){if(_0x24586d){return _0x24586d[_0xc712('0x3c')](_0x5011fc[_0xc712('0x38')][_0xc712('0x3d')],_[_0xc712('0x3e')](_0x5011fc['body'],[_0xc712('0x3d'),'id'])||{});}})[_0xc712('0x1d')](respondWithResult(_0x260033,null))[_0xc712('0x2d')](handleError(_0x260033,null));};exports[_0xc712('0x3f')]=function(_0x1e01bb,_0x141495){var _0x485b44={'raw':![],'where':{}};var _0x1394b7={};var _0x3352b7={'count':0x0,'rows':[]};return db[_0xc712('0x24')][_0xc712('0x40')]({'where':{'id':_0x1e01bb[_0xc712('0x2f')]['id']}})[_0xc712('0x1d')](handleEntityNotFound(_0x141495,null))['then'](function(_0xb6de9e){if(_0xb6de9e){_0x1394b7['model']=_['keys'](db['WhatsappMessage'][_0xc712('0x25')]);_0x1394b7[_0xc712('0x2b')]=_['keys'](_0x1e01bb[_0xc712('0x2b')]);_0x1394b7[_0xc712('0x41')]=_['intersection'](_0x1394b7[_0xc712('0x30')],_0x1394b7[_0xc712('0x2b')]);_0x485b44[_0xc712('0x32')]=_['intersection'](_0x1394b7[_0xc712('0x30')],qs[_0xc712('0x33')](_0x1e01bb[_0xc712('0x2b')][_0xc712('0x33')]));_0x485b44[_0xc712('0x32')]=_0x485b44[_0xc712('0x32')][_0xc712('0x42')]?_0x485b44['attributes']:_0x1394b7[_0xc712('0x30')];if(!_0x1e01bb[_0xc712('0x2b')][_0xc712('0x43')](_0xc712('0x44'))){_0x485b44[_0xc712('0x18')]=qs[_0xc712('0x18')](_0x1e01bb[_0xc712('0x2b')][_0xc712('0x18')]);_0x485b44['offset']=qs[_0xc712('0x16')](_0x1e01bb[_0xc712('0x2b')]['offset']);}_0x485b44[_0xc712('0x45')]=qs[_0xc712('0x46')](_0x1e01bb['query']['sort']);_0x485b44[_0xc712('0x47')]=qs[_0xc712('0x41')](_[_0xc712('0x48')](_0x1e01bb[_0xc712('0x2b')],_0x1394b7[_0xc712('0x41')]));_0x485b44[_0xc712('0x47')][_0xc712('0x49')]=_0xb6de9e['id'];if(_0x1e01bb[_0xc712('0x2b')][_0xc712('0x4a')]){_0x485b44[_0xc712('0x47')]=_[_0xc712('0x35')](_0x485b44[_0xc712('0x47')],{'$or':_[_0xc712('0x23')](_0x485b44[_0xc712('0x32')],function(_0x293b44){var _0x89d23e={};_0x89d23e[_0x293b44]={'$like':'%'+_0x1e01bb[_0xc712('0x2b')][_0xc712('0x4a')]+'%'};return _0x89d23e;})});}if(_0x1e01bb['query'][_0xc712('0x4b')]){var _0x578bd1=_0x1e01bb[_0xc712('0x2b')][_0xc712('0x4b')]['split'](',');var _0x2d8563={};_0x2d8563[_0x578bd1[0x0]]={'$gte':moment(_0x578bd1[0x1])[_0xc712('0x4c')](_0xc712('0x4d'))};_0x485b44[_0xc712('0x47')]=_[_0xc712('0x35')](_0x485b44[_0xc712('0x47')],_0x2d8563);}_0x485b44=_[_0xc712('0x35')]({},_0x485b44,_0x1e01bb[_0xc712('0x36')]);return db['WhatsappMessage'][_0xc712('0x19')]({'where':_0x485b44[_0xc712('0x47')]})[_0xc712('0x1d')](function(_0x556888){_0x3352b7['count']=_0x556888;if(_0x1e01bb['query']['includeAll']){_0x485b44[_0xc712('0x4e')]=[{'all':!![]}];}return db[_0xc712('0x4f')][_0xc712('0x29')](_0x485b44);})['then'](function(_0x41bd9a){_0x3352b7[_0xc712('0x50')]=_0x41bd9a;return _0x3352b7;});}})[_0xc712('0x1d')](respondWithFilteredResult(_0x141495,_0x485b44))[_0xc712('0x2d')](handleError(_0x141495,null));};exports[_0xc712('0x51')]=function(_0x1f9b92,_0x1259b8){return db[_0xc712('0x24')][_0xc712('0x39')]({'where':{'id':_0x1f9b92[_0xc712('0x2f')]['id']}})[_0xc712('0x1d')](handleEntityNotFound(_0x1259b8,null))[_0xc712('0x1d')](function(_0x2aee51){if(_0x2aee51){return _0x2aee51[_0xc712('0x52')](_0x1f9b92[_0xc712('0x38')][_0xc712('0x3d')],_[_0xc712('0x3e')](_0x1f9b92['body'],['ids','id'])||{})[_0xc712('0x53')](function(){return db[_0xc712('0x54')][_0xc712('0x29')]({'attributes':['id',_0xc712('0x20'),_0xc712('0x55')],'where':{'id':_0x1f9b92[_0xc712('0x38')][_0xc712('0x3d')]}});})[_0xc712('0x1d')](function(_0x309996){socket[_0xc712('0x56')](_0xc712('0x57'),{'id':Number(_0x1f9b92[_0xc712('0x2f')]['id']),'tags':_0x309996||[]});return{'id':Number(_0x1f9b92[_0xc712('0x2f')]['id']),'tags':_0x309996||[]};});}})[_0xc712('0x1d')](respondWithResult(_0x1259b8,null))['catch'](handleError(_0x1259b8,null));};exports[_0xc712('0x58')]=function(_0x141cbe,_0x4a71cc){return db[_0xc712('0x24')][_0xc712('0x39')]({'where':{'id':_0x141cbe[_0xc712('0x2f')]['id']}})['then'](handleEntityNotFound(_0x4a71cc,null))['then'](function(_0x29627d){if(_0x29627d){return _0x29627d[_0xc712('0x58')](_0x141cbe[_0xc712('0x2b')][_0xc712('0x3d')]);}})[_0xc712('0x1d')](respondWithStatusCode(_0x4a71cc,null))[_0xc712('0x2d')](handleError(_0x4a71cc,null));};exports[_0xc712('0x59')]=function(_0x3c3905,_0x321b8f){var _0x3beda2=moment()['unix']()[_0xc712('0x5a')]();var _0x361cdb=path[_0xc712('0x5b')](config['root'],_0xc712('0x5c'),'files',_0xc712('0x5d'));var _0x539f9d=path[_0xc712('0x5b')](config[_0xc712('0x5e')],_0xc712('0x5c'),_0xc712('0x5f'),'attachments');var _0xda04e4=path[_0xc712('0x5b')](_0x361cdb,_0x3beda2);var _0x594458=util[_0xc712('0x4c')](_0xc712('0x60'),_0x3c3905[_0xc712('0x2f')]['id'],_0x3beda2);var _0x5437da=path[_0xc712('0x5b')](_0x361cdb,_0x594458);var _0x12a6ed=[];_0x12a6ed[_0xc712('0x61')]({'model':db[_0xc712('0x62')],'as':_0xc712('0x62'),'attributes':['id',_0xc712('0x63')],'raw':!![]});_0x12a6ed[_0xc712('0x61')]({'model':db['CmContact'],'as':_0xc712('0x64'),'attributes':['id',_0xc712('0x65'),_0xc712('0x66')],'raw':!![]});if(_0x3c3905[_0xc712('0x2b')][_0xc712('0x67')]){_0x12a6ed[_0xc712('0x61')]({'model':db[_0xc712('0x68')],'as':_0xc712('0x68'),'raw':!![]});}var _0x590704=[{'model':db[_0xc712('0x4f')],'as':_0xc712('0x69'),'attributes':['id',_0xc712('0x38'),_0xc712('0x6a'),_0xc712('0x6b'),'secret',_0xc712('0x6c')],'include':_0x12a6ed}];_0x590704[_0xc712('0x61')]({'model':db[_0xc712('0x6d')],'as':_0xc712('0x6e'),'attributes':['id',_0xc712('0x20')]});_0x590704[_0xc712('0x61')]({'model':db['User'],'as':_0xc712('0x6f'),'attributes':['id',_0xc712('0x63')]});return db['WhatsappInteraction'][_0xc712('0x39')]({'where':{'id':_0x3c3905[_0xc712('0x2f')]['id']},'include':_0x590704})[_0xc712('0x1d')](handleEntityNotFound(_0x321b8f,null))[_0xc712('0x1d')](function(_0x2d97d1){if(_0x2d97d1){var _0x59245f=_0x2d97d1[_0xc712('0x70')]({'plain':!![]});fs[_0xc712('0x71')](_0xda04e4);var _0x29a0f8={'channel':_0xc712('0x72'),'account':_0x59245f['Account'][_0xc712('0x20')],'agent':_0x59245f[_0xc712('0x6f')]?_0x59245f[_0xc712('0x6f')][_0xc712('0x63')]:_0xc712('0x73'),'createdAt':moment(_0x59245f[_0xc712('0x6a')])[_0xc712('0x4c')](_0xc712('0x4d'))['toString'](),'closedAt':_0x59245f[_0xc712('0x74')]?moment(_0x59245f[_0xc712('0x75')])['format'](_0xc712('0x4d'))[_0xc712('0x5a')]():'','disposition':_0x59245f[_0xc712('0x76')],'messages':_(_0x59245f[_0xc712('0x69')])[_0xc712('0x4a')]({'secret':![]})['map'](function(_0x201ed3){if(_0x201ed3[_0xc712('0x68')]){var _0x4ccb3f=path[_0xc712('0x5b')](_0x539f9d,_0x201ed3[_0xc712('0x68')][_0xc712('0x77')]);if(fs['existsSync'](_0x4ccb3f)){fs[_0xc712('0x78')](_0x4ccb3f)[_0xc712('0x79')](fs[_0xc712('0x7a')](path['join'](_0xda04e4,_0x201ed3[_0xc712('0x68')]['basename'])));}}return{'date':moment(_0x201ed3[_0xc712('0x6a')])[_0xc712('0x4c')](_0xc712('0x4d'))[_0xc712('0x5a')](),'sender':_0x201ed3[_0xc712('0x6b')]===_0xc712('0x7b')?_0x201ed3[_0xc712('0x62')]?_0x201ed3['User'][_0xc712('0x63')]:_0xc712('0x7c'):_0x201ed3[_0xc712('0x64')]['firstName']+(_0x201ed3[_0xc712('0x64')][_0xc712('0x66')]?'\x20'+_0x201ed3[_0xc712('0x64')][_0xc712('0x66')]:''),'body':_0x201ed3[_0xc712('0x68')]?_0x201ed3[_0xc712('0x68')][_0xc712('0x77')]:_0x201ed3[_0xc712('0x38')],'direction':_0x201ed3[_0xc712('0x6b')]===_0xc712('0x7b')?'A':'C','secret':_0x201ed3[_0xc712('0x7d')],'read':_0x201ed3[_0xc712('0x6c')],'attachment':_0x201ed3[_0xc712('0x68')]};})[_0xc712('0x7e')]()};return ejs[_0xc712('0x7f')](path[_0xc712('0x5b')](config[_0xc712('0x5e')],'server',_0xc712('0x80'),_0xc712('0x81')),{'interaction':_0x29a0f8})['then'](function(_0x1d8ef6){var _0x495343=path[_0xc712('0x5b')](_0xda04e4,_0xc712('0x82')+_0x59245f['id']+'-'+_0x3beda2+_0xc712('0x83'));var _0x34e688={'path':_0x495343,'channel':_0xc712('0x72'),'interactionId':_0x59245f['id']};return pdf['createPdfFromHTML'](_0x1d8ef6,_0x34e688);})['then'](function(){return new BPromise(function(_0x167169,_0x35677b){zipdir(_0xda04e4,{'saveTo':_0x5437da},function(_0x5226c8,_0x2090b2){if(_0x5226c8)return _0x35677b(_0x5226c8);return _0x167169(_0x2090b2);});})[_0xc712('0x1d')](function(){return new BPromise(function(_0x8c2636,_0x3377a0){rimraf(_0xda04e4,function(_0xfa2f0f){if(_0xfa2f0f)_0x3377a0(_0xfa2f0f);return _0x8c2636();});});})[_0xc712('0x1d')](function(){return _0x321b8f[_0xc712('0x59')](_0x5437da,_0x594458,function(_0x532e21){if(_0x532e21){console[_0xc712('0x84')]('err',_0x532e21);}else{fs['unlinkSync'](_0x5437da);}});});});}else{return _0x321b8f[_0xc712('0x12')](0xc8);}})[_0xc712('0x2d')](handleError(_0x321b8f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f04d631..6c1afcf 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 _0xd757=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save','update','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0xd757,0x1e5));var _0x7d75=function(_0x5df274,_0x18eb29){_0x5df274=_0x5df274-0x0;var _0x192e73=_0xd757[_0x5df274];return _0x192e73;};'use strict';var EventEmitter=require(_0x7d75('0x0'));var WhatsappInteraction=require(_0x7d75('0x1'))['db'][_0x7d75('0x2')];var WhatsappMessage=require(_0x7d75('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d75('0x3'),'afterUpdate':_0x7d75('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa7df66){return function(_0x10d11a,_0x42c15a,_0x52bb43){_0x10d11a['getUsers']({'attributes':['id'],'raw':!![]})[_0x7d75('0x5')](function(_0x3fde33){_0x10d11a[_0x7d75('0x6')](_0x7d75('0x7'),_0x3fde33[_0x7d75('0x8')](function(_0x2f0103){return{'id':_0x2f0103['id']};}));return WhatsappMessage[_0x7d75('0x9')]({'where':{'WhatsappInteractionId':_0x10d11a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7d75('0x5')](function(_0x24e1d8){_0x10d11a[_0x7d75('0x6')](_0x7d75('0xa'),_0x24e1d8[_0x7d75('0xb')]);WhatsappInteractionEvents[_0x7d75('0xc')](_0xa7df66+':'+_0x10d11a['id'],_0x10d11a);WhatsappInteractionEvents['emit'](_0xa7df66,_0x10d11a);_0x52bb43(null);})['catch'](_0x52bb43(null));};}for(var e in events){if(events[_0x7d75('0xd')](e)){var event=events[e];WhatsappInteraction[_0x7d75('0xe')](e,emitEvent(event));}}module[_0x7d75('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x7b6b=['setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','save','remove','getUsers','then'];(function(_0x5379a7,_0x4b15e7){var _0xe6ab16=function(_0x16d597){while(--_0x16d597){_0x5379a7['push'](_0x5379a7['shift']());}};_0xe6ab16(++_0x4b15e7);}(_0x7b6b,0xac));var _0xb7b6=function(_0x499531,_0x345a3f){_0x499531=_0x499531-0x0;var _0x2a67c0=_0x7b6b[_0x499531];return _0x2a67c0;};'use strict';var EventEmitter=require(_0xb7b6('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb7b6('0x1')];var WhatsappMessage=require(_0xb7b6('0x2'))['db'][_0xb7b6('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7b6('0x4'),'afterUpdate':'update','afterDestroy':_0xb7b6('0x5')};function emitEvent(_0x7193f5){return function(_0xfd10d6,_0x3fc279,_0xde6ac0){_0xfd10d6[_0xb7b6('0x6')]({'attributes':['id'],'raw':!![]})[_0xb7b6('0x7')](function(_0x318dfb){_0xfd10d6[_0xb7b6('0x8')](_0xb7b6('0x9'),_0x318dfb[_0xb7b6('0xa')](function(_0x4074d1){return{'id':_0x4074d1['id']};}));return WhatsappMessage[_0xb7b6('0xb')]({'where':{'WhatsappInteractionId':_0xfd10d6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb7b6('0x7')](function(_0x22ee5f){_0xfd10d6[_0xb7b6('0x8')](_0xb7b6('0xc'),_0x22ee5f[_0xb7b6('0xd')]);WhatsappInteractionEvents[_0xb7b6('0xe')](_0x7193f5+':'+_0xfd10d6['id'],_0xfd10d6);WhatsappInteractionEvents[_0xb7b6('0xe')](_0x7193f5,_0xfd10d6);_0xde6ac0(null);})['catch'](_0xde6ac0(null));};}for(var e in events){if(events[_0xb7b6('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb7b6('0x10')](e,emitEvent(event));}}module[_0xb7b6('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index a7a32d0..ab14e4a 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 _0xf0f8=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xf0f8,0x1e1));var _0x8f0f=function(_0x5eb0fb,_0x509260){_0x5eb0fb=_0x5eb0fb-0x0;var _0x37524c=_0xf0f8[_0x5eb0fb];return _0x37524c;};'use strict';var _=require(_0x8f0f('0x0'));var util=require(_0x8f0f('0x1'));var logger=require(_0x8f0f('0x2'))('api');var moment=require(_0x8f0f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f0f('0x4'));var rimraf=require(_0x8f0f('0x5'));var config=require(_0x8f0f('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x8f0f('0x7')]=function(_0x374698,_0x354037){return _0x374698[_0x8f0f('0x8')](_0x8f0f('0x9'),attributes,{'tableName':_0x8f0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f958b,_0x2618c8,_0x345c9c){if(_0x4f958b[_0x8f0f('0xb')](_0x8f0f('0xc'))){_0x4f958b['closedAt']=moment()[_0x8f0f('0xd')](_0x8f0f('0xe'));}_0x345c9c(null,_0x4f958b);}}});}; \ No newline at end of file +var _0xd73d=['../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','lodash'];(function(_0x5e5cd9,_0x310d44){var _0x108419=function(_0x536570){while(--_0x536570){_0x5e5cd9['push'](_0x5e5cd9['shift']());}};_0x108419(++_0x310d44);}(_0xd73d,0xb5));var _0xdd73=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xd73d[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xdd73('0x0'));var util=require('util');var logger=require(_0xdd73('0x1'))(_0xdd73('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd73('0x4'));var config=require(_0xdd73('0x5'));var attributes=require(_0xdd73('0x6'));module[_0xdd73('0x7')]=function(_0x52a760,_0x5d41d7){return _0x52a760[_0xdd73('0x8')](_0xdd73('0x9'),attributes,{'tableName':_0xdd73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50a950,_0x106438,_0x50ce94){if(_0x50a950[_0xdd73('0xb')]('closed')){_0x50a950[_0xdd73('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x50ce94(null,_0x50a950);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 78f4d07..ac9d71f 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 _0x7bf3=['update','body','options','raw','where','debug','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappInteraction.socket','register','then','info','request\x20sent','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x586998,_0xc9fd34){var _0x1c882d=function(_0x48b3e8){while(--_0x48b3e8){_0x586998['push'](_0x586998['shift']());}};_0x1c882d(++_0xc9fd34);}(_0x7bf3,0x1e0));var _0x37bf=function(_0x29e119,_0x838181){_0x29e119=_0x29e119-0x0;var _0x2e8584=_0x7bf3[_0x29e119];return _0x2e8584;};'use strict';var _=require(_0x37bf('0x0'));var util=require('util');var moment=require(_0x37bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x37bf('0x2'));var fs=require('fs');var Redis=require(_0x37bf('0x3'));var db=require(_0x37bf('0x4'))['db'];var utils=require(_0x37bf('0x5'));var logger=require('../../config/logger')(_0x37bf('0x6'));var config=require(_0x37bf('0x7'));var jayson=require(_0x37bf('0x8'));var client=jayson['client'][_0x37bf('0x9')]({'port':0x232a});config['redis']=_[_0x37bf('0xa')](config[_0x37bf('0xb')],{'host':_0x37bf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x37bf('0xd'))[_0x37bf('0xe')](socket);function respondWithRpcPromise(_0x2e92f6,_0x71689a,_0x38f33b){return new BPromise(function(_0xeb2038,_0x57d22d){return client['request'](_0x2e92f6,_0x38f33b)[_0x37bf('0xf')](function(_0x1ee904){logger[_0x37bf('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x71689a,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x71689a,_0x37bf('0x11'),JSON[_0x37bf('0x12')](_0x1ee904));if(_0x1ee904[_0x37bf('0x13')]){if(_0x1ee904[_0x37bf('0x13')][_0x37bf('0x14')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x71689a,_0x1ee904[_0x37bf('0x13')]['message']);return _0x57d22d(_0x1ee904[_0x37bf('0x13')][_0x37bf('0x15')]);}logger[_0x37bf('0x13')](_0x37bf('0x16'),_0x71689a,_0x1ee904[_0x37bf('0x13')][_0x37bf('0x15')]);return _0xeb2038(_0x1ee904['error']['message']);}else{logger[_0x37bf('0x10')](_0x37bf('0x16'),_0x71689a,_0x37bf('0x11'));_0xeb2038(_0x1ee904[_0x37bf('0x17')][_0x37bf('0x15')]);}})[_0x37bf('0x18')](function(_0x298d30){logger['error'](_0x37bf('0x16'),_0x71689a,_0x298d30);_0x57d22d(_0x298d30);});});}exports[_0x37bf('0x19')]=function(_0x29569b){var _0x185afa=this;return new Promise(function(_0x4cd1fe,_0x1a1cec){return db[_0x37bf('0x1a')][_0x37bf('0x1b')](_0x29569b[_0x37bf('0x1c')],{'raw':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')][_0x37bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')][_0x37bf('0x1f')]||null:null,'attributes':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')]['attributes']||null:null,'limit':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')]['limit']||null:null})[_0x37bf('0xf')](function(_0x56b206){logger[_0x37bf('0x10')](_0x37bf('0x19'),_0x29569b);logger[_0x37bf('0x20')](_0x37bf('0x19'),_0x29569b,JSON['stringify'](_0x56b206));_0x4cd1fe(_0x56b206);})[_0x37bf('0x18')](function(_0x54d71d){logger['error'](_0x37bf('0x19'),_0x54d71d['message'],_0x29569b);_0x1a1cec(_0x185afa['error'](0x1f4,_0x54d71d[_0x37bf('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x495c8b){return new Promise(function(_0x4a130b,_0x49738f){return db[_0x37bf('0x1a')][_0x37bf('0x21')]({'where':_0x495c8b[_0x37bf('0x1d')]?_0x495c8b[_0x37bf('0x1d')]['where']||null:null})[_0x37bf('0xf')](function(_0x29338f){if(_0x29338f){return _0x29338f[_0x37bf('0x22')](_0x495c8b['body'][_0x37bf('0x23')],_[_0x37bf('0x24')](_0x495c8b[_0x37bf('0x1c')],[_0x37bf('0x23'),'id'])||{});}})[_0x37bf('0x25')](function(_0xf478fa){logger[_0x37bf('0x10')]('AddTags',_0x495c8b);logger[_0x37bf('0x20')](_0x37bf('0x26'),_0x495c8b,JSON[_0x37bf('0x12')](_0xf478fa));_0x4a130b(_0xf478fa);})[_0x37bf('0x18')](function(_0x128971){logger[_0x37bf('0x13')](_0x37bf('0x26'),_0x128971['message'],_0x495c8b);_0x49738f(_this['error'](0x1f4,_0x128971[_0x37bf('0x15')]));});});}; \ No newline at end of file +var _0x94cb=['WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','limit','AddTagsToWhatsappInteraction','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then'];(function(_0x5172a3,_0x5b698c){var _0x33ab1f=function(_0x2598ae){while(--_0x2598ae){_0x5172a3['push'](_0x5172a3['shift']());}};_0x33ab1f(++_0x5b698c);}(_0x94cb,0xda));var _0xb94c=function(_0x3270a8,_0x477762){_0x3270a8=_0x3270a8-0x0;var _0x22c162=_0x94cb[_0x3270a8];return _0x22c162;};'use strict';var _=require('lodash');var util=require(_0xb94c('0x0'));var moment=require(_0xb94c('0x1'));var BPromise=require(_0xb94c('0x2'));var rs=require(_0xb94c('0x3'));var fs=require('fs');var Redis=require(_0xb94c('0x4'));var db=require(_0xb94c('0x5'))['db'];var utils=require(_0xb94c('0x6'));var logger=require(_0xb94c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb94c('0x8')]['http']({'port':0x232a});config[_0xb94c('0x9')]=_[_0xb94c('0xa')](config[_0xb94c('0x9')],{'host':_0xb94c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb94c('0x9')]));require(_0xb94c('0xc'))[_0xb94c('0xd')](socket);function respondWithRpcPromise(_0x12af71,_0x171ffb,_0x48dd3c){return new BPromise(function(_0x58ee48,_0x181690){return client[_0xb94c('0xe')](_0x12af71,_0x48dd3c)[_0xb94c('0xf')](function(_0x46555c){logger['info'](_0xb94c('0x10'),_0x171ffb,'request\x20sent');logger[_0xb94c('0x11')](_0xb94c('0x12'),_0x171ffb,_0xb94c('0x13'),JSON[_0xb94c('0x14')](_0x46555c));if(_0x46555c[_0xb94c('0x15')]){if(_0x46555c[_0xb94c('0x15')][_0xb94c('0x16')]===0x1f4){logger[_0xb94c('0x15')](_0xb94c('0x10'),_0x171ffb,_0x46555c[_0xb94c('0x15')][_0xb94c('0x17')]);return _0x181690(_0x46555c[_0xb94c('0x15')][_0xb94c('0x17')]);}logger[_0xb94c('0x15')](_0xb94c('0x10'),_0x171ffb,_0x46555c[_0xb94c('0x15')][_0xb94c('0x17')]);return _0x58ee48(_0x46555c[_0xb94c('0x15')][_0xb94c('0x17')]);}else{logger[_0xb94c('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x171ffb,'request\x20sent');_0x58ee48(_0x46555c[_0xb94c('0x19')][_0xb94c('0x17')]);}})[_0xb94c('0x1a')](function(_0x534fce){logger[_0xb94c('0x15')](_0xb94c('0x10'),_0x171ffb,_0x534fce);_0x181690(_0x534fce);});});}exports[_0xb94c('0x1b')]=function(_0x4c600f){var _0x124933=this;return new Promise(function(_0x25c10,_0x49f31d){return db[_0xb94c('0x1c')][_0xb94c('0x1d')](_0x4c600f[_0xb94c('0x1e')],{'raw':_0x4c600f['options']?_0x4c600f[_0xb94c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c600f['options']?_0x4c600f['options'][_0xb94c('0x20')]||null:null,'attributes':_0x4c600f[_0xb94c('0x1f')]?_0x4c600f[_0xb94c('0x1f')]['attributes']||null:null,'limit':_0x4c600f['options']?_0x4c600f[_0xb94c('0x1f')][_0xb94c('0x21')]||null:null})[_0xb94c('0xf')](function(_0xdad27d){logger[_0xb94c('0x18')](_0xb94c('0x1b'),_0x4c600f);logger['debug'](_0xb94c('0x1b'),_0x4c600f,JSON['stringify'](_0xdad27d));_0x25c10(_0xdad27d);})[_0xb94c('0x1a')](function(_0x321ef4){logger['error'](_0xb94c('0x1b'),_0x321ef4['message'],_0x4c600f);_0x49f31d(_0x124933['error'](0x1f4,_0x321ef4[_0xb94c('0x17')]));});});};exports[_0xb94c('0x22')]=function(_0xa6c48a){return new Promise(function(_0x47311c,_0x506d29){return db[_0xb94c('0x1c')]['find']({'where':_0xa6c48a['options']?_0xa6c48a[_0xb94c('0x1f')][_0xb94c('0x20')]||null:null})[_0xb94c('0xf')](function(_0x197e95){if(_0x197e95){return _0x197e95[_0xb94c('0x23')](_0xa6c48a['body'][_0xb94c('0x24')],_[_0xb94c('0x25')](_0xa6c48a[_0xb94c('0x1e')],[_0xb94c('0x24'),'id'])||{});}})['spread'](function(_0x29d9cb){logger[_0xb94c('0x18')](_0xb94c('0x26'),_0xa6c48a);logger[_0xb94c('0x11')](_0xb94c('0x26'),_0xa6c48a,JSON['stringify'](_0x29d9cb));_0x47311c(_0x29d9cb);})[_0xb94c('0x1a')](function(_0x5e04e2){logger[_0xb94c('0x15')](_0xb94c('0x26'),_0x5e04e2[_0xb94c('0x17')],_0xa6c48a);_0x506d29(_this['error'](0x1f4,_0x5e04e2[_0xb94c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ab8800e..194dc2c 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 _0x1f05=['save','remove','update','emit','length','whatsappInteraction:'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x1f05,0xe4));var _0x51f0=function(_0x5afa68,_0x3fb091){_0x5afa68=_0x5afa68-0x0;var _0x11dfd6=_0x1f05[_0x5afa68];return _0x11dfd6;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x51f0('0x0'),_0x51f0('0x1'),_0x51f0('0x2')];function createListener(_0x1f4a39,_0x3113ec){return function(_0x1b1572){_0x3113ec[_0x51f0('0x3')](_0x1f4a39,_0x1b1572);};}function removeListener(_0x138595,_0x5edebd){return function(){WhatsappInteractionEvents['removeListener'](_0x138595,_0x5edebd);};}exports['register']=function(_0x453a46){for(var _0x4a4f7d=0x0,_0x18ace5=events[_0x51f0('0x4')];_0x4a4f7d<_0x18ace5;_0x4a4f7d++){var _0x5f17c2=events[_0x4a4f7d];var _0x49ce98=createListener(_0x51f0('0x5')+_0x5f17c2,_0x453a46);WhatsappInteractionEvents['on'](_0x5f17c2,_0x49ce98);}}; \ No newline at end of file +var _0x5d54=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','register','length'];(function(_0x451d6e,_0x45df19){var _0x3c2387=function(_0x2a2971){while(--_0x2a2971){_0x451d6e['push'](_0x451d6e['shift']());}};_0x3c2387(++_0x45df19);}(_0x5d54,0x181));var _0x45d5=function(_0x4e7261,_0x5d624d){_0x4e7261=_0x4e7261-0x0;var _0x37d87b=_0x5d54[_0x4e7261];return _0x37d87b;};'use strict';var WhatsappInteractionEvents=require(_0x45d5('0x0'));var events=[_0x45d5('0x1'),_0x45d5('0x2'),_0x45d5('0x3')];function createListener(_0x2d4e87,_0x5c66c7){return function(_0x6b02c7){_0x5c66c7[_0x45d5('0x4')](_0x2d4e87,_0x6b02c7);};}function removeListener(_0x731b38,_0xdd6f96){return function(){WhatsappInteractionEvents['removeListener'](_0x731b38,_0xdd6f96);};}exports[_0x45d5('0x5')]=function(_0x383932){for(var _0x3b2797=0x0,_0x1aa9b9=events[_0x45d5('0x6')];_0x3b2797<_0x1aa9b9;_0x3b2797++){var _0x599dbe=events[_0x3b2797];var _0x1ad424=createListener(_0x45d5('0x7')+_0x599dbe,_0x383932);WhatsappInteractionEvents['on'](_0x599dbe,_0x1ad424);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8055e30..0ae1e85 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 _0xb4ed=['accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','put','update','/:id/accept'];(function(_0x382e19,_0x2701bd){var _0x22c2f1=function(_0x3cb7a5){while(--_0x3cb7a5){_0x382e19['push'](_0x382e19['shift']());}};_0x22c2f1(++_0x2701bd);}(_0xb4ed,0xef));var _0xdb4e=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0xb4ed[_0x592e40];return _0x5d4288;};'use strict';var multer=require(_0xdb4e('0x0'));var util=require(_0xdb4e('0x1'));var path=require('path');var timeout=require(_0xdb4e('0x2'));var express=require(_0xdb4e('0x3'));var router=express['Router']();var fs_extra=require(_0xdb4e('0x4'));var auth=require(_0xdb4e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb4e('0x6'));router[_0xdb4e('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb4e('0x8')]);router[_0xdb4e('0x7')]('/describe',auth[_0xdb4e('0x9')](),controller[_0xdb4e('0xa')]);router['get'](_0xdb4e('0xb'),auth[_0xdb4e('0x9')](),controller[_0xdb4e('0xc')]);router[_0xdb4e('0xd')]('/',auth['isAuthenticated'](),interaction[_0xdb4e('0xe')](_0xdb4e('0xf'),_0xdb4e('0x10')),controller[_0xdb4e('0x11')]);router[_0xdb4e('0xd')]('/:id/status',controller['status']);router[_0xdb4e('0x12')]('/:id',auth[_0xdb4e('0x9')](),controller[_0xdb4e('0x13')]);router[_0xdb4e('0x12')](_0xdb4e('0x14'),auth['isAuthenticated'](),controller[_0xdb4e('0x15')]);router[_0xdb4e('0x12')](_0xdb4e('0x16'),auth['isAuthenticated'](),controller[_0xdb4e('0x17')]);router[_0xdb4e('0x18')](_0xdb4e('0xb'),auth[_0xdb4e('0x9')](),controller['destroy']);module[_0xdb4e('0x19')]=router; \ No newline at end of file +var _0x9871=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','/:id','isAuthenticated','post','tracked','whatsappmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x44b09b,_0x115c7d){var _0x409f63=function(_0x5dc307){while(--_0x5dc307){_0x44b09b['push'](_0x44b09b['shift']());}};_0x409f63(++_0x115c7d);}(_0x9871,0x1a1));var _0x1987=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x9871[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x1987('0x0'));var util=require(_0x1987('0x1'));var path=require(_0x1987('0x2'));var timeout=require(_0x1987('0x3'));var express=require(_0x1987('0x4'));var router=express[_0x1987('0x5')]();var fs_extra=require(_0x1987('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1987('0x7'));var config=require(_0x1987('0x8'));var controller=require(_0x1987('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1987('0xa')]);router[_0x1987('0xb')](_0x1987('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x1987('0xb')](_0x1987('0xd'),auth[_0x1987('0xe')](),controller['show']);router[_0x1987('0xf')]('/',auth[_0x1987('0xe')](),interaction[_0x1987('0x10')]('whatsapp',_0x1987('0x11')),controller[_0x1987('0x12')]);router['post']('/:id/status',controller['status']);router[_0x1987('0x13')](_0x1987('0xd'),auth['isAuthenticated'](),controller[_0x1987('0x14')]);router[_0x1987('0x13')](_0x1987('0x15'),auth[_0x1987('0xe')](),controller[_0x1987('0x16')]);router[_0x1987('0x13')](_0x1987('0x17'),auth[_0x1987('0xe')](),controller[_0x1987('0x18')]);router[_0x1987('0x19')](_0x1987('0xd'),auth[_0x1987('0xe')](),controller['destroy']);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 1a7e670..1db6686 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 _0x2882=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5ce68d,_0x41dcb3){var _0x17418c=function(_0x30a3d9){while(--_0x30a3d9){_0x5ce68d['push'](_0x5ce68d['shift']());}};_0x17418c(++_0x41dcb3);}(_0x2882,0xb8));var _0x2288=function(_0x2e8a6f,_0x211e88){_0x2e8a6f=_0x2e8a6f-0x0;var _0x42d47e=_0x2882[_0x2e8a6f];return _0x42d47e;};'use strict';var Sequelize=require(_0x2288('0x0'));module[_0x2288('0x1')]={'body':{'type':Sequelize[_0x2288('0x2')](_0x2288('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2288('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2288('0x5')]('in',_0x2288('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2288('0x7')](0xbe)},'phone':{'type':Sequelize[_0x2288('0x7')]},'readAt':{'type':Sequelize[_0x2288('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7408=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','STRING'];(function(_0x41c630,_0x1ed409){var _0x29d4cd=function(_0x197f91){while(--_0x197f91){_0x41c630['push'](_0x41c630['shift']());}};_0x29d4cd(++_0x1ed409);}(_0x7408,0x8d));var _0x8740=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0x7408[_0x319e2e];return _0x302524;};'use strict';var Sequelize=require(_0x8740('0x0'));module[_0x8740('0x1')]={'body':{'type':Sequelize[_0x8740('0x2')](_0x8740('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8740('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x8740('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8740('0x6')]},'secret':{'type':Sequelize[_0x8740('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8740('0x5')]},'providerResponse':{'type':Sequelize[_0x8740('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5062c04..e4bc4be 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 _0xcf82=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','keys','options','create','update','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','WhatsappInteraction','contact','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','then','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length'];(function(_0x5974e5,_0xef90dd){var _0x58540e=function(_0x294354){while(--_0x294354){_0x5974e5['push'](_0x5974e5['shift']());}};_0x58540e(++_0xef90dd);}(_0xcf82,0xc6));var _0x2cf8=function(_0x562721,_0x4b2a11){_0x562721=_0x562721-0x0;var _0x11b1d0=_0xcf82[_0x562721];return _0x11b1d0;};'use strict';var emlformat=require(_0x2cf8('0x0'));var rimraf=require(_0x2cf8('0x1'));var zipdir=require(_0x2cf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cf8('0x3'));var moment=require('moment');var BPromise=require(_0x2cf8('0x4'));var Mustache=require(_0x2cf8('0x5'));var util=require('util');var path=require(_0x2cf8('0x6'));var sox=require(_0x2cf8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2cf8('0x8'));var _=require(_0x2cf8('0x9'));var squel=require(_0x2cf8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2cf8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2cf8('0xc'));var Papa=require('papaparse');var Redis=require(_0x2cf8('0xd'));var authService=require(_0x2cf8('0xe'));var qs=require(_0x2cf8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cf8('0x10'));var logger=require(_0x2cf8('0x11'))(_0x2cf8('0x12'));var utils=require(_0x2cf8('0x13'));var config=require(_0x2cf8('0x14'));var licenseUtil=require(_0x2cf8('0x15'));var db=require(_0x2cf8('0x16'))['db'];config[_0x2cf8('0x17')]=_['defaults'](config[_0x2cf8('0x17')],{'host':_0x2cf8('0x18'),'port':0x18eb});var socket=require(_0x2cf8('0x19'))(new Redis(config[_0x2cf8('0x17')]));require(_0x2cf8('0x1a'))[_0x2cf8('0x1b')](socket);var jayson=require(_0x2cf8('0x1c'));var client=jayson[_0x2cf8('0x1d')][_0x2cf8('0x1e')]({'port':0x232c});var client9002=jayson[_0x2cf8('0x1d')][_0x2cf8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x8b4270,_0x933964,_0x373bfc,_0x53766e){return new BPromise(function(_0x1e4f78,_0x3b5f11){var _0x3b8a5c=_0x53766e||client;return _0x3b8a5c['request'](_0x8b4270,_0x373bfc)['then'](function(_0x2a9f91){logger[_0x2cf8('0x1f')](_0x2cf8('0x20'),_0x933964,_0x2cf8('0x21'));logger[_0x2cf8('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x933964,_0x2cf8('0x21'),JSON['stringify'](_0x2a9f91));if(_0x2a9f91[_0x2cf8('0x23')]){if(_0x2a9f91['error']['code']===0x1f4){logger[_0x2cf8('0x23')](_0x2cf8('0x20'),_0x933964,_0x2a9f91[_0x2cf8('0x23')]['message']);return _0x3b5f11(_0x2a9f91[_0x2cf8('0x23')][_0x2cf8('0x24')]);}logger[_0x2cf8('0x23')](_0x2cf8('0x20'),_0x933964,_0x2a9f91[_0x2cf8('0x23')][_0x2cf8('0x24')]);return _0x1e4f78(_0x2a9f91['error'][_0x2cf8('0x24')]);}else{logger['info'](_0x2cf8('0x20'),_0x933964,_0x2cf8('0x21'));_0x1e4f78(_0x2a9f91[_0x2cf8('0x25')][_0x2cf8('0x24')]);}})[_0x2cf8('0x26')](function(_0x2c4e88){logger['error'](_0x2cf8('0x20'),_0x933964,_0x2c4e88);_0x3b5f11(_0x2c4e88);});});}function respondWithStatusCode(_0x18a495,_0x12e136){_0x12e136=_0x12e136||0xcc;return function(_0x29e781){if(_0x29e781){return _0x18a495[_0x2cf8('0x27')](_0x12e136);}return _0x18a495[_0x2cf8('0x28')](_0x12e136)[_0x2cf8('0x29')]();};}function respondWithResult(_0x154b44,_0x47f04c){_0x47f04c=_0x47f04c||0xc8;return function(_0x28b493){if(_0x28b493){return _0x154b44[_0x2cf8('0x28')](_0x47f04c)[_0x2cf8('0x2a')](_0x28b493);}};}function respondWithFilteredResult(_0x1a6e97,_0x3a89db){return function(_0x107e5e){if(_0x107e5e){var _0x4589c5=typeof _0x3a89db[_0x2cf8('0x2b')]===_0x2cf8('0x2c')&&typeof _0x3a89db['limit']===_0x2cf8('0x2c');var _0x39497e=_0x107e5e[_0x2cf8('0x2d')];var _0x18a719=_0x4589c5?0x0:_0x3a89db[_0x2cf8('0x2b')];var _0x120519=_0x4589c5?_0x107e5e[_0x2cf8('0x2d')]:_0x3a89db[_0x2cf8('0x2b')]+_0x3a89db[_0x2cf8('0x2e')];var _0x3f3b4c;if(_0x120519>=_0x39497e){_0x120519=_0x39497e;_0x3f3b4c=0xc8;}else{_0x3f3b4c=0xce;}_0x1a6e97[_0x2cf8('0x28')](_0x3f3b4c);return _0x1a6e97[_0x2cf8('0x2f')]('Content-Range',_0x18a719+'-'+_0x120519+'/'+_0x39497e)[_0x2cf8('0x2a')](_0x107e5e);}return null;};}function patchUpdates(_0x526cdc){return function(_0x3f2513){try{jsonpatch[_0x2cf8('0x30')](_0x3f2513,_0x526cdc,!![]);}catch(_0x38d24b){return BPromise['reject'](_0x38d24b);}return _0x3f2513['save']();};}function saveUpdates(_0x775557,_0x4a8c9e){return function(_0x5a905c){if(_0x5a905c){return _0x5a905c['update'](_0x775557)[_0x2cf8('0x31')](function(_0x5c7be0){return _0x5c7be0;});}return null;};}function removeEntity(_0x3bf447,_0x25b248){return function(_0x489dd3){if(_0x489dd3){return _0x489dd3[_0x2cf8('0x32')]()[_0x2cf8('0x31')](function(){_0x3bf447[_0x2cf8('0x28')](0xcc)[_0x2cf8('0x29')]();});}};}function handleEntityNotFound(_0x900da3,_0x4c6ba2){return function(_0x12a4f8){if(!_0x12a4f8){_0x900da3[_0x2cf8('0x27')](0x194);}return _0x12a4f8;};}function handleError(_0x2b0314,_0x1f9b3b){_0x1f9b3b=_0x1f9b3b||0x1f4;return function(_0x49e217){logger['error'](_0x49e217[_0x2cf8('0x33')]);if(_0x49e217[_0x2cf8('0x34')]){delete _0x49e217[_0x2cf8('0x34')];}_0x2b0314[_0x2cf8('0x28')](_0x1f9b3b)[_0x2cf8('0x35')](_0x49e217);};}exports[_0x2cf8('0x36')]=function(_0x384bb7,_0xefc0f9){var _0x16b803={},_0x5cb75e={},_0x3d4069={'count':0x0,'rows':[]};var _0x2662bd=_[_0x2cf8('0x37')](db[_0x2cf8('0x38')][_0x2cf8('0x39')],function(_0x57d658){return{'name':_0x57d658[_0x2cf8('0x3a')],'type':_0x57d658[_0x2cf8('0x3b')][_0x2cf8('0x3c')]};});_0x5cb75e['model']=_[_0x2cf8('0x37')](_0x2662bd,_0x2cf8('0x34'));_0x5cb75e[_0x2cf8('0x3d')]=_['keys'](_0x384bb7['query']);_0x5cb75e[_0x2cf8('0x3e')]=_[_0x2cf8('0x3f')](_0x5cb75e['model'],_0x5cb75e[_0x2cf8('0x3d')]);_0x16b803[_0x2cf8('0x40')]=_['intersection'](_0x5cb75e[_0x2cf8('0x41')],qs[_0x2cf8('0x42')](_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x42')]));_0x16b803[_0x2cf8('0x40')]=_0x16b803[_0x2cf8('0x40')][_0x2cf8('0x43')]?_0x16b803[_0x2cf8('0x40')]:_0x5cb75e[_0x2cf8('0x41')];if(!_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x44')]('nolimit')){_0x16b803[_0x2cf8('0x2e')]=qs[_0x2cf8('0x2e')](_0x384bb7['query'][_0x2cf8('0x2e')]);_0x16b803[_0x2cf8('0x2b')]=qs[_0x2cf8('0x2b')](_0x384bb7[_0x2cf8('0x3d')]['offset']);}_0x16b803[_0x2cf8('0x45')]=qs[_0x2cf8('0x46')](_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x46')]);_0x16b803[_0x2cf8('0x47')]=qs[_0x2cf8('0x3e')](_[_0x2cf8('0x48')](_0x384bb7['query'],_0x5cb75e['filters']),_0x2662bd);if(_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x49')]){_0x16b803['where']=_[_0x2cf8('0x4a')](_0x16b803[_0x2cf8('0x47')],{'$or':_['map'](_0x2662bd,function(_0x5e78e0){if(_0x5e78e0[_0x2cf8('0x3b')]!==_0x2cf8('0x4b')){var _0x39427d={};_0x39427d[_0x5e78e0[_0x2cf8('0x34')]]={'$like':'%'+_0x384bb7[_0x2cf8('0x3d')]['filter']+'%'};return _0x39427d;}})});}_0x16b803=_['merge']({},_0x16b803,_0x384bb7['options']);var _0x30729b={'where':_0x16b803[_0x2cf8('0x47')]};return db[_0x2cf8('0x38')][_0x2cf8('0x2d')](_0x30729b)[_0x2cf8('0x31')](function(_0x289f86){_0x3d4069['count']=_0x289f86;if(_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x4c')]){_0x16b803[_0x2cf8('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x16b803);})[_0x2cf8('0x31')](function(_0x4658db){_0x3d4069['rows']=_0x4658db;return _0x3d4069;})[_0x2cf8('0x31')](respondWithFilteredResult(_0xefc0f9,_0x16b803))[_0x2cf8('0x26')](handleError(_0xefc0f9,null));};exports[_0x2cf8('0x4e')]=function(_0x3aa1fe,_0x310bf2){var _0x33b800={'raw':!![],'where':{'id':_0x3aa1fe[_0x2cf8('0x4f')]['id']}},_0x137fdb={};_0x137fdb[_0x2cf8('0x41')]=_[_0x2cf8('0x50')](db[_0x2cf8('0x38')]['rawAttributes']);_0x137fdb[_0x2cf8('0x3d')]=_[_0x2cf8('0x50')](_0x3aa1fe['query']);_0x137fdb['filters']=_[_0x2cf8('0x3f')](_0x137fdb['model'],_0x137fdb[_0x2cf8('0x3d')]);_0x33b800[_0x2cf8('0x40')]=_[_0x2cf8('0x3f')](_0x137fdb[_0x2cf8('0x41')],qs['fields'](_0x3aa1fe[_0x2cf8('0x3d')][_0x2cf8('0x42')]));_0x33b800['attributes']=_0x33b800[_0x2cf8('0x40')]['length']?_0x33b800[_0x2cf8('0x40')]:_0x137fdb[_0x2cf8('0x41')];if(_0x3aa1fe[_0x2cf8('0x3d')][_0x2cf8('0x4c')]){_0x33b800[_0x2cf8('0x4d')]=[{'all':!![]}];}_0x33b800=_['merge']({},_0x33b800,_0x3aa1fe[_0x2cf8('0x51')]);return db[_0x2cf8('0x38')]['find'](_0x33b800)[_0x2cf8('0x31')](handleEntityNotFound(_0x310bf2,null))[_0x2cf8('0x31')](respondWithResult(_0x310bf2,null))[_0x2cf8('0x26')](handleError(_0x310bf2,null));};exports[_0x2cf8('0x52')]=function(_0x53043e,_0x59d1bb){return db['WhatsappMessage'][_0x2cf8('0x52')](_0x53043e['body'],{})['then'](respondWithResult(_0x59d1bb,0xc9))['catch'](handleError(_0x59d1bb,null));};exports[_0x2cf8('0x53')]=function(_0x393245,_0x34465e){if(_0x393245[_0x2cf8('0x54')]['id']){delete _0x393245[_0x2cf8('0x54')]['id'];}return db[_0x2cf8('0x38')]['find']({'where':{'id':_0x393245[_0x2cf8('0x4f')]['id']}})[_0x2cf8('0x31')](handleEntityNotFound(_0x34465e,null))[_0x2cf8('0x31')](saveUpdates(_0x393245['body'],null))[_0x2cf8('0x31')](respondWithResult(_0x34465e,null))[_0x2cf8('0x26')](handleError(_0x34465e,null));};exports[_0x2cf8('0x32')]=function(_0x2ee2dc,_0x1907dd){return db[_0x2cf8('0x38')][_0x2cf8('0x55')]({'where':{'id':_0x2ee2dc[_0x2cf8('0x4f')]['id']}})[_0x2cf8('0x31')](handleEntityNotFound(_0x1907dd,null))[_0x2cf8('0x31')](removeEntity(_0x1907dd,null))[_0x2cf8('0x26')](handleError(_0x1907dd,null));};exports[_0x2cf8('0x56')]=function(_0x20dbed,_0x2a9655){return db['WhatsappMessage']['describe']()[_0x2cf8('0x31')](respondWithResult(_0x2a9655,null))[_0x2cf8('0x26')](handleError(_0x2a9655,null));};var interaction_log=require(_0x2cf8('0x11'))(_0x2cf8('0x57'));exports[_0x2cf8('0x58')]=function(_0x5ae9ce,_0x41bbaa,_0x4b4876){var _0x417b4e={'agent':{},'channel':_0x2cf8('0x59')};if(_0x5ae9ce['body']['id']){delete _0x5ae9ce['body']['id'];}_0x5ae9ce['body'][_0x2cf8('0x5a')]=!![];_0x5ae9ce['body'][_0x2cf8('0x5b')]=moment()[_0x2cf8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ae9ce[_0x2cf8('0x54')]['UserId']=_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x5d')]||_0x5ae9ce[_0x2cf8('0x5e')]['id'];_0x417b4e[_0x2cf8('0x5f')]['id']=_0x5ae9ce[_0x2cf8('0x54')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x5ae9ce[_0x2cf8('0x4f')]['id'],'UserId':null}})[_0x2cf8('0x31')](handleEntityNotFound(_0x41bbaa,null))[_0x2cf8('0x31')](saveUpdates(_0x5ae9ce[_0x2cf8('0x54')],null))[_0x2cf8('0x31')](function(_0x3117c5){if(_0x3117c5){_0x417b4e[_0x2cf8('0x24')]=_0x3117c5[_0x2cf8('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0x2cf8('0x55')]({'where':{'id':_0x3117c5[_0x2cf8('0x61')]}});}return null;})[_0x2cf8('0x31')](handleEntityNotFound(_0x41bbaa,null))[_0x2cf8('0x31')](function(_0x2fae2f){if(_0x2fae2f){return _0x2fae2f['update']({'UserId':_0x5ae9ce['body'][_0x2cf8('0x5d')],'read1stAt':_[_0x2cf8('0x62')](_0x2fae2f[_0x2cf8('0x63')])?moment()[_0x2cf8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2cf8('0x31')](function(_0xdd752b){if(_0xdd752b){_0x417b4e[_0x2cf8('0x64')]=_0xdd752b['get']({'plain':!![]});interaction_log[_0x2cf8('0x1f')](_0x2cf8('0x65'),_0x5ae9ce[_0x2cf8('0x5e')]['id'],_0x5ae9ce[_0x2cf8('0x5e')][_0x2cf8('0x34')],_0x5ae9ce[_0x2cf8('0x5e')][_0x2cf8('0x66')],_0x417b4e['interaction']['id'],_0x5ae9ce[_0x2cf8('0x54')]?JSON[_0x2cf8('0x67')](_0x5ae9ce['body']):_0x2cf8('0x68'));return respondWithRpcPromise('AcceptMessage',_0x2cf8('0x69'),_0x417b4e);}return null;})[_0x2cf8('0x31')](function(_0xc5a380){var _0x33b01b=_0x2cf8('0x6a')+_0xc5a380[_0x2cf8('0x24')][_0x2cf8('0x6b')];return db['sequelize'][_0x2cf8('0x3d')](_0x33b01b,{'type':db[_0x2cf8('0x6c')][_0x2cf8('0x6d')][_0x2cf8('0x6e')],'raw':!![]})[_0x2cf8('0x31')](function(_0x252e1b){return _0x252e1b;});})[_0x2cf8('0x31')](function(_0x3c3f38){if(_0x3c3f38){_0x417b4e[_0x2cf8('0x24')]['contact']=_0x3c3f38[0x0];if(!_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x5d')])return;return db[_0x2cf8('0x6f')][_0x2cf8('0x55')]({'where':{'id':_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x5d')],'role':_0x2cf8('0x5f')},'attributes':['id','name',_0x2cf8('0x70'),_0x2cf8('0x71'),_0x2cf8('0x72')],'raw':!![]});}return null;})['then'](function(_0x51e4e2){if(!_0x51e4e2)return null;_0x417b4e['message'][_0x2cf8('0x5f')]=_0x51e4e2;return _0x417b4e;})['then'](function(_0x4a6f02){if(_0x4a6f02){if(_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x73')]){_0x417b4e[_0x2cf8('0x24')][_0x2cf8('0x74')]=util[_0x2cf8('0x5c')](_0x2cf8('0x75'),_0x5ae9ce[_0x2cf8('0x5e')]['name']);_0x417b4e[_0x2cf8('0x24')][_0x2cf8('0x76')]=_0x417b4e['channel'];_0x417b4e[_0x2cf8('0x24')][_0x2cf8('0x77')]=_0x417b4e['channel'];_0x417b4e['message'][_0x2cf8('0x78')]=_0x2cf8('0x58');return respondWithRpcPromise(_0x2cf8('0x79'),_0x2cf8('0x79'),{'event':_0x2cf8('0x7a'),'message':_0x417b4e[_0x2cf8('0x24')]},client9002)[_0x2cf8('0x31')](function(){return _0x417b4e;});}return _0x417b4e;}return null;})[_0x2cf8('0x31')](respondWithResult(_0x41bbaa,null))[_0x2cf8('0x26')](handleError(_0x41bbaa,null));};var interaction_log=require(_0x2cf8('0x11'))('whatsapp-interactions');exports[_0x2cf8('0x7b')]=function(_0x403cb1,_0x472c31,_0x74f65e){var _0x41d038={'agent':{},'channel':'whatsapp'};if(_0x403cb1[_0x2cf8('0x54')]['id']){delete _0x403cb1['body']['id'];}_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')]=_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')]||_0x403cb1['user']['id'];_0x41d038[_0x2cf8('0x5f')]['id']=_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')];return db[_0x2cf8('0x38')][_0x2cf8('0x55')]({'where':{'id':_0x403cb1[_0x2cf8('0x4f')]['id'],'UserId':null}})[_0x2cf8('0x31')](handleEntityNotFound(_0x472c31,null))[_0x2cf8('0x31')](function(_0x419974){if(_0x419974){_0x41d038[_0x2cf8('0x24')]=_0x419974[_0x2cf8('0x60')]({'plain':!![]});return db[_0x2cf8('0x7c')][_0x2cf8('0x55')]({'where':{'id':_0x419974[_0x2cf8('0x61')]}});}return null;})[_0x2cf8('0x31')](handleEntityNotFound(_0x472c31,null))[_0x2cf8('0x31')](function(_0xe0e80c){if(_0xe0e80c){_0x41d038[_0x2cf8('0x64')]=_0xe0e80c['get']({'plain':!![]});interaction_log[_0x2cf8('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x403cb1[_0x2cf8('0x5e')]['id'],_0x403cb1[_0x2cf8('0x5e')][_0x2cf8('0x34')],_0x403cb1[_0x2cf8('0x5e')]['role'],_0x41d038[_0x2cf8('0x64')]['id'],_0x403cb1[_0x2cf8('0x54')]?JSON[_0x2cf8('0x67')](_0x403cb1[_0x2cf8('0x54')]):_0x2cf8('0x68'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x41d038);}return null;})[_0x2cf8('0x31')](function(_0x3e4665){var _0xb291ec=_0x2cf8('0x6a')+_0x3e4665[_0x2cf8('0x24')][_0x2cf8('0x6b')];return db['sequelize'][_0x2cf8('0x3d')](_0xb291ec,{'type':db[_0x2cf8('0x6c')][_0x2cf8('0x6d')][_0x2cf8('0x6e')],'raw':!![]})[_0x2cf8('0x31')](function(_0x2284c6){return _0x2284c6;});})[_0x2cf8('0x31')](function(_0xec4ca9){if(_0xec4ca9){_0x41d038[_0x2cf8('0x24')][_0x2cf8('0x7d')]=_0xec4ca9[0x0];if(!_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')])return;return db[_0x2cf8('0x6f')]['find']({'where':{'id':_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')],'role':'agent'},'attributes':['id',_0x2cf8('0x34'),_0x2cf8('0x70'),_0x2cf8('0x71'),_0x2cf8('0x72')],'raw':!![]});}return null;})[_0x2cf8('0x31')](function(_0x262306){if(!_0x262306)return null;_0x41d038[_0x2cf8('0x24')][_0x2cf8('0x5f')]=_0x262306;return _0x41d038;})[_0x2cf8('0x31')](function(_0x37cd13){if(_0x37cd13){_0x37cd13[_0x2cf8('0x24')][_0x2cf8('0x74')]=util[_0x2cf8('0x5c')]('SIP/%s',_0x403cb1['user'][_0x2cf8('0x34')]);_0x37cd13[_0x2cf8('0x24')]['channel']=_0x41d038['channel'];_0x37cd13[_0x2cf8('0x24')]['motionChannel']=_0x41d038['channel'];_0x37cd13['message'][_0x2cf8('0x78')]=_0x2cf8('0x7b');respondWithRpcPromise('EventManager',_0x2cf8('0x79'),{'event':_0x2cf8('0x7e'),'message':_0x37cd13[_0x2cf8('0x24')]},client9002);return _0x41d038;}return null;})[_0x2cf8('0x31')](respondWithResult(_0x472c31,null))[_0x2cf8('0x26')](handleError(_0x472c31,null));};exports[_0x2cf8('0x28')]=function(_0x1b756a,_0x441c62,_0x13882a){if(_0x1b756a[_0x2cf8('0x54')]['id']){delete _0x1b756a[_0x2cf8('0x54')]['id'];}var _0x1f1bd8;return db[_0x2cf8('0x38')][_0x2cf8('0x55')]({'where':{'id':_0x1b756a[_0x2cf8('0x4f')]['id']}})[_0x2cf8('0x31')](handleEntityNotFound(_0x441c62,null))[_0x2cf8('0x31')](function(_0x3a2cd5){if(_0x3a2cd5){_0x1f1bd8=_0x3a2cd5;return db['WhatsappAccount'][_0x2cf8('0x55')]({'where':{'id':_0x3a2cd5['WhatsappAccountId']}});}})[_0x2cf8('0x31')](handleEntityNotFound(_0x441c62,null))[_0x2cf8('0x31')](function(_0x1b4822){if(_0x1b4822){logger[_0x2cf8('0x22')](_0x2cf8('0x7f'),_0x2cf8('0x28'),'received\x20delivery\x20report\x20from',_0x1b4822[_0x2cf8('0x3b')],util[_0x2cf8('0x80')](_0x1b756a[_0x2cf8('0x54')],{'showHidden':![],'depth':null}));switch(_0x1b4822[_0x2cf8('0x3b')]){case _0x2cf8('0x81'):if(_0x1b756a[_0x2cf8('0x54')]['MessageSid']&&_0x1b756a[_0x2cf8('0x54')][_0x2cf8('0x82')]===_0x1f1bd8[_0x2cf8('0x83')]&&_0x1b756a[_0x2cf8('0x54')][_0x2cf8('0x84')]&&_0x1b756a[_0x2cf8('0x54')][_0x2cf8('0x84')]===_0x2cf8('0x5a')){return _0x1f1bd8['update']({'read':!![]});}else{logger[_0x2cf8('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x2cf8('0x81'),util[_0x2cf8('0x80')](_0x1b756a[_0x2cf8('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1f1bd8;}})[_0x2cf8('0x31')](respondWithResult(_0x441c62,null))['catch'](handleError(_0x441c62,null));}; \ No newline at end of file +var _0x6b04=['body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','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','Sequelize','QueryTypes','SELECT','fullname','internal','agent','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','User','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','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','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','fields','find','create'];(function(_0xc6d32b,_0x608367){var _0x5d773a=function(_0x2285cc){while(--_0x2285cc){_0xc6d32b['push'](_0xc6d32b['shift']());}};_0x5d773a(++_0x608367);}(_0x6b04,0x1e0));var _0x46b0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6b04[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x46b0('0x0'));var rimraf=require(_0x46b0('0x1'));var zipdir=require(_0x46b0('0x2'));var jsonpatch=require(_0x46b0('0x3'));var rp=require(_0x46b0('0x4'));var moment=require(_0x46b0('0x5'));var BPromise=require(_0x46b0('0x6'));var Mustache=require(_0x46b0('0x7'));var util=require(_0x46b0('0x8'));var path=require(_0x46b0('0x9'));var sox=require(_0x46b0('0xa'));var csv=require(_0x46b0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46b0('0xc'));var _=require(_0x46b0('0xd'));var squel=require(_0x46b0('0xe'));var crypto=require(_0x46b0('0xf'));var jsforce=require(_0x46b0('0x10'));var deskjs=require(_0x46b0('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x46b0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46b0('0x13'));var as=require(_0x46b0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x46b0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x46b0('0x16'))['db'];config[_0x46b0('0x17')]=_[_0x46b0('0x18')](config['redis'],{'host':_0x46b0('0x19'),'port':0x18eb});var socket=require(_0x46b0('0x1a'))(new Redis(config['redis']));require(_0x46b0('0x1b'))[_0x46b0('0x1c')](socket);var jayson=require(_0x46b0('0x1d'));var client=jayson[_0x46b0('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x46b0('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7a37,_0x16e784,_0x470e2c,_0x4b1718){return new BPromise(function(_0x430ddc,_0xe16d50){var _0x19b1e6=_0x4b1718||client;return _0x19b1e6[_0x46b0('0x1f')](_0x1d7a37,_0x470e2c)['then'](function(_0x2f19f4){logger[_0x46b0('0x20')](_0x46b0('0x21'),_0x16e784,_0x46b0('0x22'));logger[_0x46b0('0x23')](_0x46b0('0x24'),_0x16e784,_0x46b0('0x22'),JSON[_0x46b0('0x25')](_0x2f19f4));if(_0x2f19f4[_0x46b0('0x26')]){if(_0x2f19f4[_0x46b0('0x26')][_0x46b0('0x27')]===0x1f4){logger[_0x46b0('0x26')](_0x46b0('0x21'),_0x16e784,_0x2f19f4[_0x46b0('0x26')][_0x46b0('0x28')]);return _0xe16d50(_0x2f19f4[_0x46b0('0x26')][_0x46b0('0x28')]);}logger[_0x46b0('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x16e784,_0x2f19f4['error'][_0x46b0('0x28')]);return _0x430ddc(_0x2f19f4[_0x46b0('0x26')][_0x46b0('0x28')]);}else{logger[_0x46b0('0x20')](_0x46b0('0x21'),_0x16e784,'request\x20sent');_0x430ddc(_0x2f19f4[_0x46b0('0x29')][_0x46b0('0x28')]);}})['catch'](function(_0x5677d2){logger[_0x46b0('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x16e784,_0x5677d2);_0xe16d50(_0x5677d2);});});}function respondWithStatusCode(_0x1cd13d,_0x4c7892){_0x4c7892=_0x4c7892||0xcc;return function(_0x4c3de1){if(_0x4c3de1){return _0x1cd13d[_0x46b0('0x2a')](_0x4c7892);}return _0x1cd13d[_0x46b0('0x2b')](_0x4c7892)[_0x46b0('0x2c')]();};}function respondWithResult(_0x113bd9,_0x5541bd){_0x5541bd=_0x5541bd||0xc8;return function(_0x7f7835){if(_0x7f7835){return _0x113bd9[_0x46b0('0x2b')](_0x5541bd)[_0x46b0('0x2d')](_0x7f7835);}};}function respondWithFilteredResult(_0x1ec8e8,_0x3af02d){return function(_0x2d1c60){if(_0x2d1c60){var _0x1973da=typeof _0x3af02d[_0x46b0('0x2e')]===_0x46b0('0x2f')&&typeof _0x3af02d[_0x46b0('0x30')]===_0x46b0('0x2f');var _0x49dcd0=_0x2d1c60[_0x46b0('0x31')];var _0x3bd74f=_0x1973da?0x0:_0x3af02d[_0x46b0('0x2e')];var _0x242562=_0x1973da?_0x2d1c60[_0x46b0('0x31')]:_0x3af02d[_0x46b0('0x2e')]+_0x3af02d[_0x46b0('0x30')];var _0x204a83;if(_0x242562>=_0x49dcd0){_0x242562=_0x49dcd0;_0x204a83=0xc8;}else{_0x204a83=0xce;}_0x1ec8e8['status'](_0x204a83);return _0x1ec8e8[_0x46b0('0x32')](_0x46b0('0x33'),_0x3bd74f+'-'+_0x242562+'/'+_0x49dcd0)[_0x46b0('0x2d')](_0x2d1c60);}return null;};}function patchUpdates(_0x163fcd){return function(_0x1cd819){try{jsonpatch['apply'](_0x1cd819,_0x163fcd,!![]);}catch(_0x30b585){return BPromise[_0x46b0('0x34')](_0x30b585);}return _0x1cd819[_0x46b0('0x35')]();};}function saveUpdates(_0x2ae9a2,_0x1b0dff){return function(_0x1c65a7){if(_0x1c65a7){return _0x1c65a7[_0x46b0('0x36')](_0x2ae9a2)[_0x46b0('0x37')](function(_0x5d6639){return _0x5d6639;});}return null;};}function removeEntity(_0x54506a,_0x3b8ec6){return function(_0x4322ba){if(_0x4322ba){return _0x4322ba[_0x46b0('0x38')]()['then'](function(){_0x54506a[_0x46b0('0x2b')](0xcc)[_0x46b0('0x2c')]();});}};}function handleEntityNotFound(_0x34248a,_0xd5aa4d){return function(_0x416819){if(!_0x416819){_0x34248a[_0x46b0('0x2a')](0x194);}return _0x416819;};}function handleError(_0x1699c7,_0x1ba99a){_0x1ba99a=_0x1ba99a||0x1f4;return function(_0x2795ef){logger[_0x46b0('0x26')](_0x2795ef[_0x46b0('0x39')]);if(_0x2795ef[_0x46b0('0x3a')]){delete _0x2795ef[_0x46b0('0x3a')];}_0x1699c7[_0x46b0('0x2b')](_0x1ba99a)[_0x46b0('0x3b')](_0x2795ef);};}exports['index']=function(_0x4ce4d3,_0x11cd5a){var _0xb4dae={},_0x4cd13e={},_0x34681b={'count':0x0,'rows':[]};var _0x2e69df=_[_0x46b0('0x3c')](db[_0x46b0('0x3d')][_0x46b0('0x3e')],function(_0x554c7a){return{'name':_0x554c7a[_0x46b0('0x3f')],'type':_0x554c7a[_0x46b0('0x40')][_0x46b0('0x41')]};});_0x4cd13e[_0x46b0('0x42')]=_[_0x46b0('0x3c')](_0x2e69df,_0x46b0('0x3a'));_0x4cd13e[_0x46b0('0x43')]=_[_0x46b0('0x44')](_0x4ce4d3[_0x46b0('0x43')]);_0x4cd13e['filters']=_['intersection'](_0x4cd13e[_0x46b0('0x42')],_0x4cd13e['query']);_0xb4dae['attributes']=_[_0x46b0('0x45')](_0x4cd13e['model'],qs['fields'](_0x4ce4d3[_0x46b0('0x43')]['fields']));_0xb4dae[_0x46b0('0x46')]=_0xb4dae[_0x46b0('0x46')][_0x46b0('0x47')]?_0xb4dae[_0x46b0('0x46')]:_0x4cd13e[_0x46b0('0x42')];if(!_0x4ce4d3[_0x46b0('0x43')][_0x46b0('0x48')]('nolimit')){_0xb4dae[_0x46b0('0x30')]=qs[_0x46b0('0x30')](_0x4ce4d3[_0x46b0('0x43')][_0x46b0('0x30')]);_0xb4dae[_0x46b0('0x2e')]=qs[_0x46b0('0x2e')](_0x4ce4d3[_0x46b0('0x43')]['offset']);}_0xb4dae[_0x46b0('0x49')]=qs[_0x46b0('0x4a')](_0x4ce4d3['query'][_0x46b0('0x4a')]);_0xb4dae[_0x46b0('0x4b')]=qs['filters'](_[_0x46b0('0x4c')](_0x4ce4d3[_0x46b0('0x43')],_0x4cd13e['filters']),_0x2e69df);if(_0x4ce4d3[_0x46b0('0x43')][_0x46b0('0x4d')]){_0xb4dae['where']=_[_0x46b0('0x4e')](_0xb4dae[_0x46b0('0x4b')],{'$or':_['map'](_0x2e69df,function(_0x5e8957){if(_0x5e8957['type']!==_0x46b0('0x4f')){var _0x5c1f66={};_0x5c1f66[_0x5e8957[_0x46b0('0x3a')]]={'$like':'%'+_0x4ce4d3[_0x46b0('0x43')][_0x46b0('0x4d')]+'%'};return _0x5c1f66;}})});}_0xb4dae=_['merge']({},_0xb4dae,_0x4ce4d3[_0x46b0('0x50')]);var _0x1e2a65={'where':_0xb4dae['where']};return db['WhatsappMessage'][_0x46b0('0x31')](_0x1e2a65)[_0x46b0('0x37')](function(_0x2f7389){_0x34681b[_0x46b0('0x31')]=_0x2f7389;if(_0x4ce4d3[_0x46b0('0x43')][_0x46b0('0x51')]){_0xb4dae[_0x46b0('0x52')]=[{'all':!![]}];}return db[_0x46b0('0x3d')][_0x46b0('0x53')](_0xb4dae);})[_0x46b0('0x37')](function(_0x2babe1){_0x34681b[_0x46b0('0x54')]=_0x2babe1;return _0x34681b;})[_0x46b0('0x37')](respondWithFilteredResult(_0x11cd5a,_0xb4dae))[_0x46b0('0x55')](handleError(_0x11cd5a,null));};exports[_0x46b0('0x56')]=function(_0x177018,_0x2dfb8e){var _0x45f55a={'raw':!![],'where':{'id':_0x177018[_0x46b0('0x57')]['id']}},_0x2f9497={};_0x2f9497[_0x46b0('0x42')]=_[_0x46b0('0x44')](db[_0x46b0('0x3d')][_0x46b0('0x3e')]);_0x2f9497[_0x46b0('0x43')]=_['keys'](_0x177018[_0x46b0('0x43')]);_0x2f9497[_0x46b0('0x58')]=_[_0x46b0('0x45')](_0x2f9497['model'],_0x2f9497['query']);_0x45f55a[_0x46b0('0x46')]=_[_0x46b0('0x45')](_0x2f9497[_0x46b0('0x42')],qs['fields'](_0x177018[_0x46b0('0x43')][_0x46b0('0x59')]));_0x45f55a[_0x46b0('0x46')]=_0x45f55a[_0x46b0('0x46')][_0x46b0('0x47')]?_0x45f55a[_0x46b0('0x46')]:_0x2f9497[_0x46b0('0x42')];if(_0x177018[_0x46b0('0x43')][_0x46b0('0x51')]){_0x45f55a['include']=[{'all':!![]}];}_0x45f55a=_[_0x46b0('0x4e')]({},_0x45f55a,_0x177018[_0x46b0('0x50')]);return db['WhatsappMessage'][_0x46b0('0x5a')](_0x45f55a)[_0x46b0('0x37')](handleEntityNotFound(_0x2dfb8e,null))[_0x46b0('0x37')](respondWithResult(_0x2dfb8e,null))['catch'](handleError(_0x2dfb8e,null));};exports['create']=function(_0x369661,_0x334e36){return db[_0x46b0('0x3d')][_0x46b0('0x5b')](_0x369661[_0x46b0('0x5c')],{})['then'](respondWithResult(_0x334e36,0xc9))[_0x46b0('0x55')](handleError(_0x334e36,null));};exports[_0x46b0('0x36')]=function(_0x2a0389,_0x37e095){if(_0x2a0389[_0x46b0('0x5c')]['id']){delete _0x2a0389[_0x46b0('0x5c')]['id'];}return db[_0x46b0('0x3d')]['find']({'where':{'id':_0x2a0389[_0x46b0('0x57')]['id']}})['then'](handleEntityNotFound(_0x37e095,null))[_0x46b0('0x37')](saveUpdates(_0x2a0389[_0x46b0('0x5c')],null))[_0x46b0('0x37')](respondWithResult(_0x37e095,null))[_0x46b0('0x55')](handleError(_0x37e095,null));};exports[_0x46b0('0x38')]=function(_0x333d6c,_0x2eab00){return db[_0x46b0('0x3d')]['find']({'where':{'id':_0x333d6c[_0x46b0('0x57')]['id']}})[_0x46b0('0x37')](handleEntityNotFound(_0x2eab00,null))[_0x46b0('0x37')](removeEntity(_0x2eab00,null))[_0x46b0('0x55')](handleError(_0x2eab00,null));};exports[_0x46b0('0x5d')]=function(_0x3ca214,_0x44d8a8){return db[_0x46b0('0x3d')][_0x46b0('0x5d')]()[_0x46b0('0x37')](respondWithResult(_0x44d8a8,null))['catch'](handleError(_0x44d8a8,null));};var interaction_log=require(_0x46b0('0x5e'))(_0x46b0('0x5f'));exports[_0x46b0('0x60')]=function(_0x34ed24,_0x3ad9f4,_0x240d3c){var _0x2b2fe4={'agent':{},'channel':_0x46b0('0x61')};if(_0x34ed24[_0x46b0('0x5c')]['id']){delete _0x34ed24[_0x46b0('0x5c')]['id'];}_0x34ed24[_0x46b0('0x5c')][_0x46b0('0x62')]=!![];_0x34ed24['body'][_0x46b0('0x63')]=moment()[_0x46b0('0x64')](_0x46b0('0x65'));_0x34ed24['body'][_0x46b0('0x66')]=_0x34ed24['body'][_0x46b0('0x66')]||_0x34ed24[_0x46b0('0x67')]['id'];_0x2b2fe4['agent']['id']=_0x34ed24[_0x46b0('0x5c')][_0x46b0('0x66')];return db[_0x46b0('0x3d')][_0x46b0('0x5a')]({'where':{'id':_0x34ed24[_0x46b0('0x57')]['id'],'UserId':null}})[_0x46b0('0x37')](handleEntityNotFound(_0x3ad9f4,null))[_0x46b0('0x37')](saveUpdates(_0x34ed24[_0x46b0('0x5c')],null))[_0x46b0('0x37')](function(_0x1ff206){if(_0x1ff206){_0x2b2fe4[_0x46b0('0x28')]=_0x1ff206[_0x46b0('0x68')]({'plain':!![]});return db[_0x46b0('0x69')][_0x46b0('0x5a')]({'where':{'id':_0x1ff206[_0x46b0('0x6a')]}});}return null;})[_0x46b0('0x37')](handleEntityNotFound(_0x3ad9f4,null))[_0x46b0('0x37')](function(_0x41e39c){if(_0x41e39c){return _0x41e39c[_0x46b0('0x36')]({'UserId':_0x34ed24[_0x46b0('0x5c')][_0x46b0('0x66')],'read1stAt':_[_0x46b0('0x6b')](_0x41e39c[_0x46b0('0x6c')])?moment()[_0x46b0('0x64')](_0x46b0('0x65')):undefined});}return null;})[_0x46b0('0x37')](function(_0x58fbaa){if(_0x58fbaa){_0x2b2fe4[_0x46b0('0x6d')]=_0x58fbaa['get']({'plain':!![]});interaction_log[_0x46b0('0x20')](_0x46b0('0x6e'),_0x34ed24[_0x46b0('0x67')]['id'],_0x34ed24[_0x46b0('0x67')][_0x46b0('0x3a')],_0x34ed24[_0x46b0('0x67')][_0x46b0('0x6f')],_0x2b2fe4['interaction']['id'],_0x34ed24[_0x46b0('0x5c')]?JSON[_0x46b0('0x25')](_0x34ed24[_0x46b0('0x5c')]):_0x46b0('0x70'));return respondWithRpcPromise(_0x46b0('0x71'),_0x46b0('0x72'),_0x2b2fe4);}return null;})[_0x46b0('0x37')](function(_0x239d96){var _0x50d08b=_0x46b0('0x73')+_0x239d96[_0x46b0('0x28')]['ContactId'];return db['sequelize'][_0x46b0('0x43')](_0x50d08b,{'type':db[_0x46b0('0x74')][_0x46b0('0x75')][_0x46b0('0x76')],'raw':!![]})['then'](function(_0xeca252){return _0xeca252;});})[_0x46b0('0x37')](function(_0x43c4c2){if(_0x43c4c2){_0x2b2fe4[_0x46b0('0x28')]['contact']=_0x43c4c2[0x0];if(!_0x34ed24[_0x46b0('0x5c')][_0x46b0('0x66')])return;return db['User'][_0x46b0('0x5a')]({'where':{'id':_0x34ed24[_0x46b0('0x5c')][_0x46b0('0x66')],'role':'agent'},'attributes':['id',_0x46b0('0x3a'),_0x46b0('0x77'),'email',_0x46b0('0x78')],'raw':!![]});}return null;})[_0x46b0('0x37')](function(_0x4783cc){if(!_0x4783cc)return null;_0x2b2fe4['message'][_0x46b0('0x79')]=_0x4783cc;return _0x2b2fe4;})[_0x46b0('0x37')](function(_0x25dadb){if(_0x25dadb){if(_0x34ed24[_0x46b0('0x5c')][_0x46b0('0x7a')]){_0x2b2fe4[_0x46b0('0x28')]['interface']=util[_0x46b0('0x64')](_0x46b0('0x7b'),_0x34ed24['user'][_0x46b0('0x3a')]);_0x2b2fe4[_0x46b0('0x28')][_0x46b0('0x7c')]=_0x2b2fe4['channel'];_0x2b2fe4[_0x46b0('0x28')][_0x46b0('0x7d')]=_0x2b2fe4[_0x46b0('0x7c')];_0x2b2fe4[_0x46b0('0x28')][_0x46b0('0x7e')]=_0x46b0('0x60');return respondWithRpcPromise(_0x46b0('0x7f'),_0x46b0('0x7f'),{'event':_0x46b0('0x80'),'message':_0x2b2fe4['message']},client9002)[_0x46b0('0x37')](function(){return _0x2b2fe4;});}return _0x2b2fe4;}return null;})['then'](respondWithResult(_0x3ad9f4,null))[_0x46b0('0x55')](handleError(_0x3ad9f4,null));};var interaction_log=require(_0x46b0('0x5e'))(_0x46b0('0x5f'));exports['reject']=function(_0x516bb5,_0x44a32a,_0x4d93f0){var _0x33049c={'agent':{},'channel':_0x46b0('0x61')};if(_0x516bb5['body']['id']){delete _0x516bb5[_0x46b0('0x5c')]['id'];}_0x516bb5[_0x46b0('0x5c')]['UserId']=_0x516bb5['body'][_0x46b0('0x66')]||_0x516bb5[_0x46b0('0x67')]['id'];_0x33049c[_0x46b0('0x79')]['id']=_0x516bb5[_0x46b0('0x5c')][_0x46b0('0x66')];return db['WhatsappMessage'][_0x46b0('0x5a')]({'where':{'id':_0x516bb5[_0x46b0('0x57')]['id'],'UserId':null}})[_0x46b0('0x37')](handleEntityNotFound(_0x44a32a,null))['then'](function(_0x4c9d28){if(_0x4c9d28){_0x33049c['message']=_0x4c9d28['get']({'plain':!![]});return db[_0x46b0('0x69')]['find']({'where':{'id':_0x4c9d28[_0x46b0('0x6a')]}});}return null;})[_0x46b0('0x37')](handleEntityNotFound(_0x44a32a,null))['then'](function(_0x43ef19){if(_0x43ef19){_0x33049c['interaction']=_0x43ef19['get']({'plain':!![]});interaction_log[_0x46b0('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x516bb5[_0x46b0('0x67')]['id'],_0x516bb5[_0x46b0('0x67')][_0x46b0('0x3a')],_0x516bb5['user']['role'],_0x33049c[_0x46b0('0x6d')]['id'],_0x516bb5[_0x46b0('0x5c')]?JSON['stringify'](_0x516bb5[_0x46b0('0x5c')]):_0x46b0('0x70'));return respondWithRpcPromise(_0x46b0('0x81'),_0x46b0('0x82'),_0x33049c);}return null;})['then'](function(_0x34ace2){var _0x275dcb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x34ace2[_0x46b0('0x28')]['ContactId'];return db['sequelize'][_0x46b0('0x43')](_0x275dcb,{'type':db['Sequelize']['QueryTypes'][_0x46b0('0x76')],'raw':!![]})[_0x46b0('0x37')](function(_0x5851bf){return _0x5851bf;});})[_0x46b0('0x37')](function(_0x2bf6d3){if(_0x2bf6d3){_0x33049c[_0x46b0('0x28')]['contact']=_0x2bf6d3[0x0];if(!_0x516bb5['body'][_0x46b0('0x66')])return;return db[_0x46b0('0x83')][_0x46b0('0x5a')]({'where':{'id':_0x516bb5[_0x46b0('0x5c')]['UserId'],'role':_0x46b0('0x79')},'attributes':['id',_0x46b0('0x3a'),_0x46b0('0x77'),'email',_0x46b0('0x78')],'raw':!![]});}return null;})['then'](function(_0xac363e){if(!_0xac363e)return null;_0x33049c[_0x46b0('0x28')]['agent']=_0xac363e;return _0x33049c;})[_0x46b0('0x37')](function(_0x5567b3){if(_0x5567b3){_0x5567b3['message'][_0x46b0('0x84')]=util[_0x46b0('0x64')]('SIP/%s',_0x516bb5['user'][_0x46b0('0x3a')]);_0x5567b3[_0x46b0('0x28')]['channel']=_0x33049c[_0x46b0('0x7c')];_0x5567b3[_0x46b0('0x28')][_0x46b0('0x7d')]=_0x33049c[_0x46b0('0x7c')];_0x5567b3[_0x46b0('0x28')][_0x46b0('0x7e')]=_0x46b0('0x34');respondWithRpcPromise(_0x46b0('0x7f'),_0x46b0('0x7f'),{'event':_0x46b0('0x85'),'message':_0x5567b3[_0x46b0('0x28')]},client9002);return _0x33049c;}return null;})[_0x46b0('0x37')](respondWithResult(_0x44a32a,null))['catch'](handleError(_0x44a32a,null));};exports['status']=function(_0x5b1b8c,_0x178b9c,_0x567541){if(_0x5b1b8c[_0x46b0('0x5c')]['id']){delete _0x5b1b8c[_0x46b0('0x5c')]['id'];}var _0x101dfe;return db[_0x46b0('0x3d')][_0x46b0('0x5a')]({'where':{'id':_0x5b1b8c['params']['id']}})[_0x46b0('0x37')](handleEntityNotFound(_0x178b9c,null))[_0x46b0('0x37')](function(_0x1ae4ce){if(_0x1ae4ce){_0x101dfe=_0x1ae4ce;return db[_0x46b0('0x86')][_0x46b0('0x5a')]({'where':{'id':_0x1ae4ce[_0x46b0('0x87')]}});}})[_0x46b0('0x37')](handleEntityNotFound(_0x178b9c,null))[_0x46b0('0x37')](function(_0x2c2ef8){if(_0x2c2ef8){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x46b0('0x2b'),_0x46b0('0x88'),_0x2c2ef8[_0x46b0('0x40')],util[_0x46b0('0x89')](_0x5b1b8c[_0x46b0('0x5c')],{'showHidden':![],'depth':null}));switch(_0x2c2ef8[_0x46b0('0x40')]){case'twilio':if(_0x5b1b8c[_0x46b0('0x5c')][_0x46b0('0x8a')]&&_0x5b1b8c['body']['MessageSid']===_0x101dfe[_0x46b0('0x8b')]&&_0x5b1b8c[_0x46b0('0x5c')]['MessageStatus']&&_0x5b1b8c[_0x46b0('0x5c')][_0x46b0('0x8c')]===_0x46b0('0x62')){return _0x101dfe[_0x46b0('0x36')]({'read':!![]});}else{logger['error'](_0x46b0('0x8d'),_0x46b0('0x2b'),_0x46b0('0x8e'),util[_0x46b0('0x89')](_0x5b1b8c[_0x46b0('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x101dfe;}})[_0x46b0('0x37')](respondWithResult(_0x178b9c,null))[_0x46b0('0x55')](handleError(_0x178b9c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0a09131..ca197cf 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 _0x705f=['update','remove','emit','hasOwnProperty','hook','WhatsappMessage','save'];(function(_0x450ef7,_0x2f2dda){var _0x2bcd3b=function(_0x4fe820){while(--_0x4fe820){_0x450ef7['push'](_0x450ef7['shift']());}};_0x2bcd3b(++_0x2f2dda);}(_0x705f,0x75));var _0xf705=function(_0x2c25c7,_0x57f2d7){_0x2c25c7=_0x2c25c7-0x0;var _0x1e51bd=_0x705f[_0x2c25c7];return _0x1e51bd;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xf705('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf705('0x1'),'afterUpdate':_0xf705('0x2'),'afterDestroy':_0xf705('0x3')};function emitEvent(_0x35760c){return function(_0x1dd679,_0x47514c,_0x9045cf){WhatsappMessageEvents[_0xf705('0x4')](_0x35760c+':'+_0x1dd679['id'],_0x1dd679);WhatsappMessageEvents[_0xf705('0x4')](_0x35760c,_0x1dd679);_0x9045cf(null);};}for(var e in events){if(events[_0xf705('0x5')](e)){var event=events[e];WhatsappMessage[_0xf705('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x878f=['hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0xe5ac41,_0x4fbc76){var _0xe13003=function(_0x2da101){while(--_0x2da101){_0xe5ac41['push'](_0xe5ac41['shift']());}};_0xe13003(++_0x4fbc76);}(_0x878f,0x173));var _0xf878=function(_0x4494ae,_0x5f08c1){_0x4494ae=_0x4494ae-0x0;var _0x3a0b71=_0x878f[_0x4494ae];return _0x3a0b71;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){WhatsappMessageEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);WhatsappMessageEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 83f833d..56f2113 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 _0xdb73=['../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','find','type','twilio','accountSid','authToken','messages','create','phone','whatsapp:','remote','/status?token=','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdb73,0xe7));var _0x3db7=function(_0x21d387,_0x51c585){_0x21d387=_0x21d387-0x0;var _0x12eacf=_0xdb73[_0x21d387];return _0x12eacf;};'use strict';var _=require(_0x3db7('0x0'));var util=require(_0x3db7('0x1'));var logger=require(_0x3db7('0x2'))(_0x3db7('0x3'));var moment=require(_0x3db7('0x4'));var BPromise=require(_0x3db7('0x5'));var rp=require('request-promise');var fetch=require(_0x3db7('0x6'));var fs=require('fs');var path=require(_0x3db7('0x7'));var rimraf=require(_0x3db7('0x8'));var config=require(_0x3db7('0x9'));var attributes=require(_0x3db7('0xa'));module['exports']=function(_0x11a849,_0x3af7a2){return _0x11a849[_0x3db7('0xb')](_0x3db7('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x3db7('0xd'),'fields':['messageId']},{'name':_0x3db7('0xe'),'fields':[_0x3db7('0xf')],'type':_0x3db7('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a8713,_0x1478be,_0x199759){var _0x53ad28=_0x11a849[_0x3db7('0x11')];var _0xb4f635=_0x2a8713[_0x3db7('0x12')]({'plain':!![]});if(_0xb4f635[_0x3db7('0x13')][_0x3db7('0x14')]()==='in'||_0xb4f635[_0x3db7('0x13')]['toLowerCase']()===_0x3db7('0x15')&&!_0xb4f635[_0x3db7('0x16')]&&!_['isNil'](_0xb4f635[_0x3db7('0x17')])){_0x53ad28[_0x3db7('0x18')][_0x3db7('0x19')]({'where':{'id':_0xb4f635[_0x3db7('0x1a')]}})[_0x3db7('0x1b')](function(_0x172bdf){if(_0x172bdf){_0x172bdf[_0x3db7('0x1c')]({'lastMsgAt':_0xb4f635[_0x3db7('0x1d')],'lastMsgDirection':_0xb4f635['direction'][_0x3db7('0x14')]()});}})['catch'](function(_0x156f56){console['error'](_0x156f56);});}if(_0xb4f635[_0x3db7('0x13')]===_0x3db7('0x15')&&!_0xb4f635[_0x3db7('0x16')]){var _0x198776;_0x53ad28['WhatsappAccount'][_0x3db7('0x1e')]({'where':{'id':_0xb4f635['WhatsappAccountId']},'raw':!![]})[_0x3db7('0x1b')](function(_0x34f49e){_0x198776=_0x34f49e;if(_0x198776&&_0x198776[_0x3db7('0x1f')]){switch(_0x198776[_0x3db7('0x1f')]){case _0x3db7('0x20'):var _0x46b6f2=require('twilio');if(_0x198776['accountSid']&&_0x198776['authToken']&&_0x198776['phone']){var _0x53aa63=new _0x46b6f2(_0x198776[_0x3db7('0x21')],_0x198776[_0x3db7('0x22')]);_0x53aa63[_0x3db7('0x23')][_0x3db7('0x24')]({'body':_0xb4f635[_0x3db7('0xf')],'to':'whatsapp:'+_0xb4f635[_0x3db7('0x25')],'from':_0x3db7('0x26')+_0x198776[_0x3db7('0x25')],'statusCallback':_0x198776[_0x3db7('0x27')]+'/api/whatsapp/messages/'+_0xb4f635['id']+_0x3db7('0x28')+_0x198776[_0x3db7('0x29')]})['then'](function(_0x5f1e8c){if(_0x5f1e8c['sid']){return _0x2a8713[_0x3db7('0x1c')]({'messageId':_0x5f1e8c[_0x3db7('0x2a')]});}})[_0x3db7('0x2b')](function(_0x58d1d7){logger[_0x3db7('0x2c')](_0x3db7('0x2d'),_0x3db7('0x2e'),_0x3db7('0x20'),util[_0x3db7('0x2f')](_0x58d1d7,{'showHidden':![],'depth':null}));});}else{logger[_0x3db7('0x2c')](_0x3db7('0x2d'),'afterCreate',_0x3db7('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3db7('0x30'):var _0x427e51=_0x198776[_0x3db7('0x21')];var _0x4b7b88=_0x198776[_0x3db7('0x22')];var _0x2d2adf=_0x198776[_0x3db7('0x31')]+_0x3db7('0x32')+_0x427e51+_0x3db7('0x33');var _0xfde0da={'to':[_0xb4f635[_0x3db7('0x25')]],'message':{'type':_0x3db7('0x34'),'text':_0xb4f635[_0x3db7('0xf')]}};var _0x562736={'method':_0x3db7('0x35'),'uri':_0x2d2adf,'headers':{'Authorization':_0x3db7('0x36')+_0x4b7b88,'Content-Type':'application/json'},'body':_0xfde0da,'json':!![]};rp(_0x562736)[_0x3db7('0x1b')](function(_0x1f1e83){if(_0x1f1e83[_0x3db7('0x37')][0x0]['message_id']){return _0x2a8713[_0x3db7('0x1c')]({'messageId':_0x1f1e83[_0x3db7('0x37')][0x0]['message_id']});}})[_0x3db7('0x2b')](function(_0x2dd5f4){logger[_0x3db7('0x38')]('WhatsappMessage,\x20%s',_0x2dd5f4);});break;}}})[_0x3db7('0x39')](function(){_0x199759();});}else{_0x199759();}}},'charset':_0x3db7('0x3a'),'collate':_0x3db7('0x3b')});}; \ No newline at end of file +var _0x695b=['/messages/','text','POST','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','node-fetch','path','rimraf','exports','define','messageId','body','FULLTEXT','models','get','toLowerCase','direction','secret','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','type','twilio','phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','accountSid','baseUrl','/whatsapp/v1/'];(function(_0x641ff4,_0x3a43fb){var _0x80c6d5=function(_0x52b5fa){while(--_0x52b5fa){_0x641ff4['push'](_0x641ff4['shift']());}};_0x80c6d5(++_0x3a43fb);}(_0x695b,0x74));var _0xb695=function(_0x462666,_0x4ada17){_0x462666=_0x462666-0x0;var _0x127caa=_0x695b[_0x462666];return _0x127caa;};'use strict';var _=require('lodash');var util=require(_0xb695('0x0'));var logger=require(_0xb695('0x1'))('api');var moment=require(_0xb695('0x2'));var BPromise=require(_0xb695('0x3'));var rp=require('request-promise');var fetch=require(_0xb695('0x4'));var fs=require('fs');var path=require(_0xb695('0x5'));var rimraf=require(_0xb695('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xb695('0x7')]=function(_0x2b3a21,_0x454fd7){return _0x2b3a21[_0xb695('0x8')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xb695('0x9'),'fields':[_0xb695('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0xb695('0xa')],'type':_0xb695('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3233c7,_0xb1633b,_0x1d0705){var _0x2b0592=_0x2b3a21[_0xb695('0xc')];var _0x364525=_0x3233c7[_0xb695('0xd')]({'plain':!![]});if(_0x364525['direction'][_0xb695('0xe')]()==='in'||_0x364525[_0xb695('0xf')][_0xb695('0xe')]()==='out'&&!_0x364525[_0xb695('0x10')]&&!_['isNil'](_0x364525[_0xb695('0x11')])){_0x2b0592['WhatsappInteraction'][_0xb695('0x12')]({'where':{'id':_0x364525[_0xb695('0x13')]}})[_0xb695('0x14')](function(_0x2bcbd0){if(_0x2bcbd0){_0x2bcbd0[_0xb695('0x15')]({'lastMsgAt':_0x364525[_0xb695('0x16')],'lastMsgDirection':_0x364525[_0xb695('0xf')]['toLowerCase']()});}})[_0xb695('0x17')](function(_0x4a4101){console[_0xb695('0x18')](_0x4a4101);});}if(_0x364525[_0xb695('0xf')]===_0xb695('0x19')&&!_0x364525[_0xb695('0x10')]){var _0x3ce455;_0x2b0592[_0xb695('0x1a')][_0xb695('0x1b')]({'where':{'id':_0x364525['WhatsappAccountId']},'raw':!![]})[_0xb695('0x14')](function(_0x34a190){_0x3ce455=_0x34a190;if(_0x3ce455&&_0x3ce455[_0xb695('0x1c')]){switch(_0x3ce455[_0xb695('0x1c')]){case _0xb695('0x1d'):var _0x2a5e0e=require(_0xb695('0x1d'));if(_0x3ce455['accountSid']&&_0x3ce455['authToken']&&_0x3ce455[_0xb695('0x1e')]){var _0x1c76e9=new _0x2a5e0e(_0x3ce455['accountSid'],_0x3ce455[_0xb695('0x1f')]);_0x1c76e9[_0xb695('0x20')][_0xb695('0x21')]({'body':_0x364525['body'],'to':_0xb695('0x22')+_0x364525[_0xb695('0x1e')],'from':_0xb695('0x22')+_0x3ce455[_0xb695('0x1e')],'statusCallback':_0x3ce455['remote']+_0xb695('0x23')+_0x364525['id']+_0xb695('0x24')+_0x3ce455[_0xb695('0x25')]})[_0xb695('0x14')](function(_0x5871b6){if(_0x5871b6[_0xb695('0x26')]){return _0x3233c7[_0xb695('0x15')]({'messageId':_0x5871b6['sid']});}})[_0xb695('0x17')](function(_0x202bc1){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb695('0x27'),_0xb695('0x1d'),util[_0xb695('0x28')](_0x202bc1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb695('0x29'),_0xb695('0x27'),_0xb695('0x1d'),_0xb695('0x2a'));}break;case'sinch':var _0x279025=_0x3ce455[_0xb695('0x2b')];var _0x11337a=_0x3ce455[_0xb695('0x1f')];var _0x2c4217=_0x3ce455[_0xb695('0x2c')]+_0xb695('0x2d')+_0x279025+_0xb695('0x2e');var _0x21aeb9={'to':[_0x364525[_0xb695('0x1e')]],'message':{'type':_0xb695('0x2f'),'text':_0x364525[_0xb695('0xa')]}};var _0x4dd07c={'method':_0xb695('0x30'),'uri':_0x2c4217,'headers':{'Authorization':'Bearer\x20'+_0x11337a,'Content-Type':_0xb695('0x31')},'body':_0x21aeb9,'json':!![]};rp(_0x4dd07c)[_0xb695('0x14')](function(_0x47b719){if(_0x47b719[_0xb695('0x32')][0x0]['message_id']){return _0x3233c7[_0xb695('0x15')]({'messageId':_0x47b719[_0xb695('0x32')][0x0][_0xb695('0x33')]});}})[_0xb695('0x17')](function(_0x1c8a9e){logger['err'](_0xb695('0x34'),_0x1c8a9e);});break;}}})['finally'](function(){_0x1d0705();});}else{_0x1d0705();}}},'charset':'utf8mb4','collate':_0xb695('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e51b267..f862a4b 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 _0x6aa9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','CreateWhatsappMessage','debug','lodash','util'];(function(_0x286d82,_0x1729bf){var _0x203e57=function(_0x3ad4b4){while(--_0x3ad4b4){_0x286d82['push'](_0x286d82['shift']());}};_0x203e57(++_0x1729bf);}(_0x6aa9,0x139));var _0x96aa=function(_0x3ba8f6,_0xc676fe){_0x3ba8f6=_0x3ba8f6-0x0;var _0x5c0dd8=_0x6aa9[_0x3ba8f6];return _0x5c0dd8;};'use strict';var _=require(_0x96aa('0x0'));var util=require(_0x96aa('0x1'));var moment=require(_0x96aa('0x2'));var BPromise=require(_0x96aa('0x3'));var rs=require(_0x96aa('0x4'));var fs=require('fs');var Redis=require(_0x96aa('0x5'));var db=require(_0x96aa('0x6'))['db'];var utils=require(_0x96aa('0x7'));var logger=require(_0x96aa('0x8'))('rpc');var config=require(_0x96aa('0x9'));var jayson=require(_0x96aa('0xa'));var client=jayson[_0x96aa('0xb')][_0x96aa('0xc')]({'port':0x232a});config['redis']=_[_0x96aa('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x96aa('0xe'))(new Redis(config['redis']));require(_0x96aa('0xf'))[_0x96aa('0x10')](socket);function respondWithRpcPromise(_0x4fe278,_0x320447,_0x43297b){return new BPromise(function(_0x1527c8,_0x4736e0){return client[_0x96aa('0x11')](_0x4fe278,_0x43297b)[_0x96aa('0x12')](function(_0x4a88d5){logger[_0x96aa('0x13')](_0x96aa('0x14'),_0x320447,'request\x20sent');logger['debug'](_0x96aa('0x15'),_0x320447,_0x96aa('0x16'),JSON[_0x96aa('0x17')](_0x4a88d5));if(_0x4a88d5[_0x96aa('0x18')]){if(_0x4a88d5[_0x96aa('0x18')][_0x96aa('0x19')]===0x1f4){logger[_0x96aa('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x4a88d5[_0x96aa('0x18')][_0x96aa('0x1a')]);return _0x4736e0(_0x4a88d5['error'][_0x96aa('0x1a')]);}logger[_0x96aa('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x4a88d5['error'][_0x96aa('0x1a')]);return _0x1527c8(_0x4a88d5['error'][_0x96aa('0x1a')]);}else{logger[_0x96aa('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x96aa('0x16'));_0x1527c8(_0x4a88d5[_0x96aa('0x1b')][_0x96aa('0x1a')]);}})[_0x96aa('0x1c')](function(_0x48358e){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x48358e);_0x4736e0(_0x48358e);});});}exports['CreateWhatsappMessage']=function(_0x2637f2){var _0x4445da=this;return new Promise(function(_0x44929a,_0x4b9d97){return db[_0x96aa('0x1d')][_0x96aa('0x1e')](_0x2637f2[_0x96aa('0x1f')],{'raw':_0x2637f2[_0x96aa('0x20')]?_0x2637f2[_0x96aa('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x96aa('0x12')](function(_0x38331c){logger['info'](_0x96aa('0x21'),_0x2637f2);logger[_0x96aa('0x22')]('CreateWhatsappMessage',_0x2637f2,JSON['stringify'](_0x38331c));_0x44929a(_0x38331c);})['catch'](function(_0x337c6d){logger[_0x96aa('0x18')]('CreateWhatsappMessage',_0x337c6d[_0x96aa('0x1a')],_0x2637f2);_0x4b9d97(_0x4445da[_0x96aa('0x18')](0x1f4,_0x337c6d[_0x96aa('0x1a')]));});});}; \ No newline at end of file +var _0x4fcf=['result','catch','CreateWhatsappMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info'];(function(_0x647e61,_0x2d31d6){var _0x1f3147=function(_0x4286cd){while(--_0x4286cd){_0x647e61['push'](_0x647e61['shift']());}};_0x1f3147(++_0x2d31d6);}(_0x4fcf,0xfd));var _0xf4fc=function(_0x4a28fc,_0xe76d76){_0x4a28fc=_0x4a28fc-0x0;var _0x183f8f=_0x4fcf[_0x4a28fc];return _0x183f8f;};'use strict';var _=require(_0xf4fc('0x0'));var util=require(_0xf4fc('0x1'));var moment=require(_0xf4fc('0x2'));var BPromise=require(_0xf4fc('0x3'));var rs=require(_0xf4fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4fc('0x5'))['db'];var utils=require(_0xf4fc('0x6'));var logger=require(_0xf4fc('0x7'))(_0xf4fc('0x8'));var config=require(_0xf4fc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf4fc('0xa')][_0xf4fc('0xb')]({'port':0x232a});config[_0xf4fc('0xc')]=_[_0xf4fc('0xd')](config['redis'],{'host':_0xf4fc('0xe'),'port':0x18eb});var socket=require(_0xf4fc('0xf'))(new Redis(config['redis']));require(_0xf4fc('0x10'))[_0xf4fc('0x11')](socket);function respondWithRpcPromise(_0x50820b,_0x37f4a9,_0x50517f){return new BPromise(function(_0x8ce6f0,_0x141d9e){return client[_0xf4fc('0x12')](_0x50820b,_0x50517f)['then'](function(_0x31ceec){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x37f4a9,_0xf4fc('0x13'));logger[_0xf4fc('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x37f4a9,'request\x20sent',JSON[_0xf4fc('0x15')](_0x31ceec));if(_0x31ceec[_0xf4fc('0x16')]){if(_0x31ceec[_0xf4fc('0x16')][_0xf4fc('0x17')]===0x1f4){logger[_0xf4fc('0x16')](_0xf4fc('0x18'),_0x37f4a9,_0x31ceec[_0xf4fc('0x16')][_0xf4fc('0x19')]);return _0x141d9e(_0x31ceec[_0xf4fc('0x16')]['message']);}logger[_0xf4fc('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x37f4a9,_0x31ceec['error']['message']);return _0x8ce6f0(_0x31ceec[_0xf4fc('0x16')][_0xf4fc('0x19')]);}else{logger[_0xf4fc('0x1a')](_0xf4fc('0x18'),_0x37f4a9,_0xf4fc('0x13'));_0x8ce6f0(_0x31ceec[_0xf4fc('0x1b')][_0xf4fc('0x19')]);}})[_0xf4fc('0x1c')](function(_0x25dcf3){logger[_0xf4fc('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x37f4a9,_0x25dcf3);_0x141d9e(_0x25dcf3);});});}exports[_0xf4fc('0x1d')]=function(_0x5b790e){var _0x369991=this;return new Promise(function(_0x317397,_0x435696){return db['WhatsappMessage'][_0xf4fc('0x1e')](_0x5b790e[_0xf4fc('0x1f')],{'raw':_0x5b790e[_0xf4fc('0x20')]?_0x5b790e[_0xf4fc('0x20')][_0xf4fc('0x21')]===undefined?!![]:![]:!![]})[_0xf4fc('0x22')](function(_0x2da2f6){logger['info']('CreateWhatsappMessage',_0x5b790e);logger[_0xf4fc('0x14')]('CreateWhatsappMessage',_0x5b790e,JSON[_0xf4fc('0x15')](_0x2da2f6));_0x317397(_0x2da2f6);})[_0xf4fc('0x1c')](function(_0x18c94b){logger[_0xf4fc('0x16')]('CreateWhatsappMessage',_0x18c94b[_0xf4fc('0x19')],_0x5b790e);_0x435696(_0x369991[_0xf4fc('0x16')](0x1f4,_0x18c94b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index afe738f..5bc39e4 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 _0xa632=['emit','removeListener','./whatsappMessage.events','remove','update'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xa632,0x6b));var _0x2a63=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa632[_0x4bfac3];return _0x15f0f2;};'use strict';var WhatsappMessageEvents=require(_0x2a63('0x0'));var events=['save',_0x2a63('0x1'),_0x2a63('0x2')];function createListener(_0x56d5e4,_0x5e63c5){return function(_0x2cb332){_0x5e63c5[_0x2a63('0x3')](_0x56d5e4,_0x2cb332);};}function removeListener(_0x3353c8,_0xda9b5a){return function(){WhatsappMessageEvents[_0x2a63('0x4')](_0x3353c8,_0xda9b5a);};}exports['register']=function(_0x3cd537){for(var _0x5e3168=0x0,_0x2b6e74=events['length'];_0x5e3168<_0x2b6e74;_0x5e3168++){var _0x2599be=events[_0x5e3168];var _0x94e1d4=createListener('whatsappMessage:'+_0x2599be,_0x3cd537);WhatsappMessageEvents['on'](_0x2599be,_0x94e1d4);}}; \ No newline at end of file +var _0x7734=['./whatsappMessage.events','save','update','emit','removeListener','register','length','whatsappMessage:'];(function(_0x56a1b5,_0x40b1e4){var _0x461a47=function(_0x47c6d4){while(--_0x47c6d4){_0x56a1b5['push'](_0x56a1b5['shift']());}};_0x461a47(++_0x40b1e4);}(_0x7734,0x188));var _0x4773=function(_0x44fd22,_0x41ba7a){_0x44fd22=_0x44fd22-0x0;var _0x290996=_0x7734[_0x44fd22];return _0x290996;};'use strict';var WhatsappMessageEvents=require(_0x4773('0x0'));var events=[_0x4773('0x1'),'remove',_0x4773('0x2')];function createListener(_0x51f514,_0x763f1f){return function(_0x4e1bba){_0x763f1f[_0x4773('0x3')](_0x51f514,_0x4e1bba);};}function removeListener(_0x4fc85e,_0x121b85){return function(){WhatsappMessageEvents[_0x4773('0x4')](_0x4fc85e,_0x121b85);};}exports[_0x4773('0x5')]=function(_0x11ec26){for(var _0x311808=0x0,_0x3a360d=events[_0x4773('0x6')];_0x311808<_0x3a360d;_0x311808++){var _0x2642da=events[_0x311808];var _0x4b2154=createListener(_0x4773('0x7')+_0x2642da,_0x11ec26);WhatsappMessageEvents['on'](_0x2642da,_0x4b2154);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 08a9690..b605cda 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 _0x5201=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','update','delete','destroy','removeTeams','/:id/users','removeAgents','util','path','Router','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x50748b,_0x599d6d){var _0x5688d7=function(_0xfb5d55){while(--_0xfb5d55){_0x50748b['push'](_0x50748b['shift']());}};_0x5688d7(++_0x599d6d);}(_0x5201,0xc5));var _0x1520=function(_0x5d40b1,_0x230b2a){_0x5d40b1=_0x5d40b1-0x0;var _0x5efe12=_0x5201[_0x5d40b1];return _0x5efe12;};'use strict';var multer=require('multer');var util=require(_0x1520('0x0'));var path=require(_0x1520('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1520('0x2')]();var fs_extra=require(_0x1520('0x3'));var auth=require(_0x1520('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1520('0x5'));router[_0x1520('0x6')]('/',auth['isAuthenticated'](),controller[_0x1520('0x7')]);router[_0x1520('0x6')](_0x1520('0x8'),auth[_0x1520('0x9')](),controller[_0x1520('0xa')]);router[_0x1520('0x6')](_0x1520('0xb'),auth[_0x1520('0x9')](),controller[_0x1520('0xc')]);router[_0x1520('0x6')](_0x1520('0xd'),auth[_0x1520('0x9')](),controller[_0x1520('0xe')]);router['get'](_0x1520('0xf'),auth[_0x1520('0x9')](),controller[_0x1520('0x10')]);router[_0x1520('0x6')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x1520('0x11')]('/',auth['isAuthenticated'](),controller[_0x1520('0x12')]);router[_0x1520('0x11')](_0x1520('0xf'),auth[_0x1520('0x9')](),controller[_0x1520('0x13')]);router['post']('/:id/users',auth[_0x1520('0x9')](),controller['addAgents']);router['put'](_0x1520('0xb'),auth[_0x1520('0x9')](),controller[_0x1520('0x14')]);router[_0x1520('0x15')](_0x1520('0xb'),auth[_0x1520('0x9')](),controller[_0x1520('0x16')]);router[_0x1520('0x15')](_0x1520('0xf'),auth[_0x1520('0x9')](),controller[_0x1520('0x17')]);router[_0x1520('0x15')](_0x1520('0x18'),auth[_0x1520('0x9')](),controller[_0x1520('0x19')]);module['exports']=router; \ No newline at end of file +var _0x054c=['index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','destroy','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2db45e,_0x3c3b37){var _0x200a5=function(_0x2a9fb2){while(--_0x2a9fb2){_0x2db45e['push'](_0x2db45e['shift']());}};_0x200a5(++_0x3c3b37);}(_0x054c,0xb9));var _0xc054=function(_0x5aa1a2,_0x1da92a){_0x5aa1a2=_0x5aa1a2-0x0;var _0x38e38a=_0x054c[_0x5aa1a2];return _0x38e38a;};'use strict';var multer=require('multer');var util=require(_0xc054('0x0'));var path=require(_0xc054('0x1'));var timeout=require(_0xc054('0x2'));var express=require(_0xc054('0x3'));var router=express[_0xc054('0x4')]();var fs_extra=require(_0xc054('0x5'));var auth=require(_0xc054('0x6'));var interaction=require(_0xc054('0x7'));var config=require(_0xc054('0x8'));var controller=require('./whatsappQueue.controller');router[_0xc054('0x9')]('/',auth[_0xc054('0xa')](),controller[_0xc054('0xb')]);router[_0xc054('0x9')](_0xc054('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc054('0xd'),auth[_0xc054('0xa')](),controller[_0xc054('0xe')]);router[_0xc054('0x9')](_0xc054('0xf'),auth[_0xc054('0xa')](),controller[_0xc054('0x10')]);router[_0xc054('0x9')](_0xc054('0x11'),auth[_0xc054('0xa')](),controller[_0xc054('0x12')]);router[_0xc054('0x9')](_0xc054('0x13'),auth[_0xc054('0xa')](),controller[_0xc054('0x14')]);router[_0xc054('0x15')]('/',auth[_0xc054('0xa')](),controller[_0xc054('0x16')]);router[_0xc054('0x15')](_0xc054('0x11'),auth['isAuthenticated'](),controller[_0xc054('0x17')]);router[_0xc054('0x15')](_0xc054('0x13'),auth[_0xc054('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0xc054('0xa')](),controller[_0xc054('0x18')]);router['delete']('/:id',auth[_0xc054('0xa')](),controller[_0xc054('0x19')]);router['delete'](_0xc054('0x11'),auth[_0xc054('0xa')](),controller['removeTeams']);router[_0xc054('0x1a')](_0xc054('0x13'),auth[_0xc054('0xa')](),controller['removeAgents']);module[_0xc054('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a79b703..d44a4b9 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 _0xa4de=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xa4de,0x10d));var _0xea4d=function(_0x3fda62,_0x5d1256){_0x3fda62=_0x3fda62-0x0;var _0x45a3c3=_0xa4de[_0x3fda62];return _0x45a3c3;};'use strict';var Sequelize=require(_0xea4d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xea4d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xea4d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea4d('0x3')](_0xea4d('0x4'),_0xea4d('0x5'),_0xea4d('0x6'))},'description':{'type':Sequelize[_0xea4d('0x7')]}}; \ No newline at end of file +var _0xbec5=['INTEGER','ENUM','rrmemory','beepall','STRING','sequelize','exports','name'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0xbec5,0xe5));var _0x5bec=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0xbec5[_0x1635fe];return _0x3c512a;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5bec('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5bec('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5bec('0x4')](_0x5bec('0x5'),_0x5bec('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x5bec('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index eea971a..2375991 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 _0x1aba=['from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','status','json','limit','undefined','offset','count','set','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','describe','UserWhatsappQueue','length','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','params','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','forEach','userWhatsappQueue:save','removeTeams','field'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x1aba,0x1bc));var _0xa1ab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1aba[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xa1ab('0x0'));var rimraf=require(_0xa1ab('0x1'));var zipdir=require(_0xa1ab('0x2'));var jsonpatch=require(_0xa1ab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1ab('0x4'));var Mustache=require('mustache');var util=require(_0xa1ab('0x5'));var path=require(_0xa1ab('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(_0xa1ab('0x7'));var squel=require(_0xa1ab('0x8'));var crypto=require(_0xa1ab('0x9'));var jsforce=require(_0xa1ab('0xa'));var deskjs=require(_0xa1ab('0xb'));var toCsv=require(_0xa1ab('0xc'));var querystring=require(_0xa1ab('0xd'));var Papa=require(_0xa1ab('0xe'));var Redis=require('ioredis');var authService=require(_0xa1ab('0xf'));var qs=require(_0xa1ab('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1ab('0x11'))(_0xa1ab('0x12'));var utils=require(_0xa1ab('0x13'));var config=require(_0xa1ab('0x14'));var licenseUtil=require(_0xa1ab('0x15'));var db=require(_0xa1ab('0x16'))['db'];config[_0xa1ab('0x17')]=_[_0xa1ab('0x18')](config[_0xa1ab('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1ab('0x19'))(new Redis(config[_0xa1ab('0x17')]));require(_0xa1ab('0x1a'))[_0xa1ab('0x1b')](socket);function respondWithStatusCode(_0x187bf4,_0x5735fd){_0x5735fd=_0x5735fd||0xcc;return function(_0x2fb50c){if(_0x2fb50c){return _0x187bf4['sendStatus'](_0x5735fd);}return _0x187bf4['status'](_0x5735fd)['end']();};}function respondWithResult(_0x8a05c3,_0x487e67){_0x487e67=_0x487e67||0xc8;return function(_0x4c81d7){if(_0x4c81d7){return _0x8a05c3[_0xa1ab('0x1c')](_0x487e67)[_0xa1ab('0x1d')](_0x4c81d7);}};}function respondWithFilteredResult(_0x5b2b60,_0x5f119c){return function(_0x138be1){if(_0x138be1){var _0xed7124=typeof _0x5f119c['offset']==='undefined'&&typeof _0x5f119c[_0xa1ab('0x1e')]===_0xa1ab('0x1f');var _0x3a1534=_0x138be1['count'];var _0x4084af=_0xed7124?0x0:_0x5f119c[_0xa1ab('0x20')];var _0xa4587d=_0xed7124?_0x138be1[_0xa1ab('0x21')]:_0x5f119c[_0xa1ab('0x20')]+_0x5f119c[_0xa1ab('0x1e')];var _0x459970;if(_0xa4587d>=_0x3a1534){_0xa4587d=_0x3a1534;_0x459970=0xc8;}else{_0x459970=0xce;}_0x5b2b60[_0xa1ab('0x1c')](_0x459970);return _0x5b2b60[_0xa1ab('0x22')]('Content-Range',_0x4084af+'-'+_0xa4587d+'/'+_0x3a1534)[_0xa1ab('0x1d')](_0x138be1);}return null;};}function patchUpdates(_0x416cf0){return function(_0x596ecf){try{jsonpatch[_0xa1ab('0x23')](_0x596ecf,_0x416cf0,!![]);}catch(_0x2edbd8){return BPromise[_0xa1ab('0x24')](_0x2edbd8);}return _0x596ecf[_0xa1ab('0x25')]();};}function saveUpdates(_0xffd3f3,_0x40e2a9){return function(_0x4cc6bc){if(_0x4cc6bc){return _0x4cc6bc[_0xa1ab('0x26')](_0xffd3f3)['then'](function(_0x14131e){return _0x14131e;});}return null;};}function removeEntity(_0x10e694,_0xf98cbd){return function(_0x27c8bc){if(_0x27c8bc){return _0x27c8bc[_0xa1ab('0x27')]()[_0xa1ab('0x28')](function(){var _0x23c39e=_0x27c8bc[_0xa1ab('0x29')]({'plain':!![]});var _0x4d6ee4='WhatsappQueues';return db[_0xa1ab('0x2a')][_0xa1ab('0x27')]({'where':{'type':_0x4d6ee4,'resourceId':_0x23c39e['id']}})[_0xa1ab('0x28')](function(){return _0x27c8bc;});})['then'](function(){_0x10e694[_0xa1ab('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x596647,_0x5655d5){return function(_0x18da40){if(!_0x18da40){_0x596647[_0xa1ab('0x2b')](0x194);}return _0x18da40;};}function handleError(_0x633556,_0x135463){_0x135463=_0x135463||0x1f4;return function(_0x34d20d){logger[_0xa1ab('0x2c')](_0x34d20d['stack']);if(_0x34d20d[_0xa1ab('0x2d')]){delete _0x34d20d[_0xa1ab('0x2d')];}_0x633556[_0xa1ab('0x1c')](_0x135463)[_0xa1ab('0x2e')](_0x34d20d);};}exports[_0xa1ab('0x2f')]=function(_0x582c45,_0x10b170){var _0x22085b={},_0x341ac={},_0x5d94d0={'count':0x0,'rows':[]};var _0x4325d9=_['map'](db[_0xa1ab('0x30')][_0xa1ab('0x31')],function(_0x532cb5){return{'name':_0x532cb5[_0xa1ab('0x32')],'type':_0x532cb5['type'][_0xa1ab('0x33')]};});_0x341ac[_0xa1ab('0x34')]=_[_0xa1ab('0x35')](_0x4325d9,_0xa1ab('0x2d'));_0x341ac[_0xa1ab('0x36')]=_[_0xa1ab('0x37')](_0x582c45[_0xa1ab('0x36')]);_0x341ac['filters']=_[_0xa1ab('0x38')](_0x341ac[_0xa1ab('0x34')],_0x341ac['query']);_0x22085b[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x341ac['model'],qs['fields'](_0x582c45[_0xa1ab('0x36')]['fields']));_0x22085b['attributes']=_0x22085b['attributes']['length']?_0x22085b[_0xa1ab('0x39')]:_0x341ac[_0xa1ab('0x34')];if(!_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x3a')](_0xa1ab('0x3b'))){_0x22085b['limit']=qs[_0xa1ab('0x1e')](_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x1e')]);_0x22085b[_0xa1ab('0x20')]=qs['offset'](_0x582c45['query']['offset']);}_0x22085b[_0xa1ab('0x3c')]=qs[_0xa1ab('0x3d')](_0x582c45['query']['sort']);_0x22085b['where']=qs[_0xa1ab('0x3e')](_[_0xa1ab('0x3f')](_0x582c45[_0xa1ab('0x36')],_0x341ac['filters']),_0x4325d9);if(_0x582c45['query'][_0xa1ab('0x40')]){_0x22085b[_0xa1ab('0x41')]=_[_0xa1ab('0x42')](_0x22085b[_0xa1ab('0x41')],{'$or':_[_0xa1ab('0x35')](_0x4325d9,function(_0x4ef988){if(_0x4ef988['type']!==_0xa1ab('0x43')){var _0x196357={};_0x196357[_0x4ef988['name']]={'$like':'%'+_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x40')]+'%'};return _0x196357;}})});}_0x22085b=_[_0xa1ab('0x42')]({},_0x22085b,_0x582c45[_0xa1ab('0x44')]);var _0x11f6dc={'where':_0x22085b[_0xa1ab('0x41')]};return db['WhatsappQueue'][_0xa1ab('0x21')](_0x11f6dc)[_0xa1ab('0x28')](function(_0x2f4289){_0x5d94d0['count']=_0x2f4289;if(_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x45')]){_0x22085b[_0xa1ab('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xa1ab('0x47')](_0x22085b);})[_0xa1ab('0x28')](function(_0x2ba3ad){_0x5d94d0[_0xa1ab('0x48')]=_0x2ba3ad;return _0x5d94d0;})['then'](respondWithFilteredResult(_0x10b170,_0x22085b))[_0xa1ab('0x49')](handleError(_0x10b170,null));};exports[_0xa1ab('0x4a')]=function(_0x5d7858,_0x28cfb7){var _0x32f066={'raw':!![],'where':{'id':_0x5d7858['params']['id']}},_0x1eeeef={};_0x1eeeef[_0xa1ab('0x34')]=_[_0xa1ab('0x37')](db[_0xa1ab('0x30')]['rawAttributes']);_0x1eeeef['query']=_[_0xa1ab('0x37')](_0x5d7858['query']);_0x1eeeef[_0xa1ab('0x3e')]=_['intersection'](_0x1eeeef[_0xa1ab('0x34')],_0x1eeeef[_0xa1ab('0x36')]);_0x32f066[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x1eeeef[_0xa1ab('0x34')],qs[_0xa1ab('0x4b')](_0x5d7858[_0xa1ab('0x36')][_0xa1ab('0x4b')]));_0x32f066[_0xa1ab('0x39')]=_0x32f066[_0xa1ab('0x39')]['length']?_0x32f066[_0xa1ab('0x39')]:_0x1eeeef[_0xa1ab('0x34')];if(_0x5d7858[_0xa1ab('0x36')][_0xa1ab('0x45')]){_0x32f066[_0xa1ab('0x46')]=[{'all':!![]}];}_0x32f066=_['merge']({},_0x32f066,_0x5d7858[_0xa1ab('0x44')]);return db[_0xa1ab('0x30')][_0xa1ab('0x4c')](_0x32f066)[_0xa1ab('0x28')](handleEntityNotFound(_0x28cfb7,null))['then'](respondWithResult(_0x28cfb7,null))['catch'](handleError(_0x28cfb7,null));};exports[_0xa1ab('0x4d')]=function(_0x325dfb,_0x2094c0){return db[_0xa1ab('0x30')][_0xa1ab('0x4d')](_0x325dfb[_0xa1ab('0x4e')],{})[_0xa1ab('0x28')](function(_0x50e8a3){var _0x38c55b=_0x325dfb[_0xa1ab('0x4f')][_0xa1ab('0x29')]({'plain':!![]});if(!_0x38c55b)throw new Error(_0xa1ab('0x50'));if(_0x38c55b[_0xa1ab('0x51')]==='user'){var _0x3a5153=_0x50e8a3[_0xa1ab('0x29')]({'plain':!![]});var _0x2c8dd5=_0xa1ab('0x52');return db[_0xa1ab('0x53')]['find']({'where':{'name':_0x2c8dd5,'userProfileId':_0x38c55b[_0xa1ab('0x54')]},'raw':!![]})['then'](function(_0x4a3e46){if(_0x4a3e46&&_0x4a3e46[_0xa1ab('0x55')]===0x0){return db[_0xa1ab('0x2a')][_0xa1ab('0x4d')]({'name':_0x3a5153['name'],'resourceId':_0x3a5153['id'],'type':_0x4a3e46['name'],'sectionId':_0x4a3e46['id']},{})[_0xa1ab('0x28')](function(){return _0x50e8a3;});}else{return _0x50e8a3;}})[_0xa1ab('0x49')](function(_0x2217f1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2217f1);throw _0x2217f1;});}return _0x50e8a3;})[_0xa1ab('0x28')](respondWithResult(_0x2094c0,0xc9))[_0xa1ab('0x49')](handleError(_0x2094c0,null));};exports[_0xa1ab('0x26')]=function(_0x1bb986,_0x15ac43){if(_0x1bb986[_0xa1ab('0x4e')]['id']){delete _0x1bb986[_0xa1ab('0x4e')]['id'];}return db['WhatsappQueue'][_0xa1ab('0x4c')]({'where':{'id':_0x1bb986['params']['id']}})['then'](handleEntityNotFound(_0x15ac43,null))[_0xa1ab('0x28')](saveUpdates(_0x1bb986[_0xa1ab('0x4e')],null))['then'](respondWithResult(_0x15ac43,null))[_0xa1ab('0x49')](handleError(_0x15ac43,null));};exports[_0xa1ab('0x27')]=function(_0xf428d4,_0x44d30a){return db[_0xa1ab('0x30')][_0xa1ab('0x4c')]({'where':{'id':_0xf428d4['params']['id']}})['then'](handleEntityNotFound(_0x44d30a,null))[_0xa1ab('0x28')](removeEntity(_0x44d30a,null))[_0xa1ab('0x49')](handleError(_0x44d30a,null));};exports[_0xa1ab('0x56')]=function(_0x450dd6,_0x44d6de){return db[_0xa1ab('0x30')][_0xa1ab('0x56')]()[_0xa1ab('0x28')](respondWithResult(_0x44d6de,null))[_0xa1ab('0x49')](handleError(_0x44d6de,null));};exports['getMembers']=function(_0x29299c,_0x24a9b2,_0x2e3ece){var _0x1790c2={'raw':!![],'where':{}},_0x18b191={},_0x5eac0e;return db[_0xa1ab('0x30')]['findOne']({'where':{'id':_0x29299c['params']['id']}})['then'](handleEntityNotFound(_0x24a9b2,null))[_0xa1ab('0x28')](function(_0x5c78b7){if(_0x5c78b7){_0x5eac0e=_0x5c78b7['get']({'plain':!![]});_0x18b191['model']=_['keys'](db[_0xa1ab('0x57')]['rawAttributes']);_0x18b191[_0xa1ab('0x36')]=_['keys'](_0x29299c[_0xa1ab('0x36')]);_0x18b191[_0xa1ab('0x3e')]=_[_0xa1ab('0x38')](_0x18b191['model'],_0x18b191[_0xa1ab('0x36')]);_0x1790c2[_0xa1ab('0x39')]=_['intersection'](_0x18b191[_0xa1ab('0x34')],qs[_0xa1ab('0x4b')](_0x29299c['query'][_0xa1ab('0x4b')]));_0x1790c2[_0xa1ab('0x39')]=_0x1790c2['attributes'][_0xa1ab('0x58')]?_0x1790c2[_0xa1ab('0x39')]:_0x18b191[_0xa1ab('0x34')];if(!_0x29299c[_0xa1ab('0x36')][_0xa1ab('0x3a')](_0xa1ab('0x3b'))){_0x1790c2['limit']=qs[_0xa1ab('0x1e')](_0x29299c[_0xa1ab('0x36')]['limit']);_0x1790c2['offset']=qs[_0xa1ab('0x20')](_0x29299c['query']['offset']);}_0x1790c2[_0xa1ab('0x3c')]=qs[_0xa1ab('0x3d')](_0x29299c[_0xa1ab('0x36')]['sort']);_0x1790c2['where']=qs[_0xa1ab('0x3e')](_[_0xa1ab('0x3f')](_0x29299c[_0xa1ab('0x36')],_0x18b191[_0xa1ab('0x3e')]));_0x1790c2[_0xa1ab('0x41')][_0xa1ab('0x59')]=_0x5c78b7['id'];if(_0x29299c[_0xa1ab('0x36')][_0xa1ab('0x40')]){_0x1790c2[_0xa1ab('0x41')]=_['merge'](_0x1790c2[_0xa1ab('0x41')],{'$or':_[_0xa1ab('0x35')](_0x1790c2[_0xa1ab('0x39')],function(_0x3cde6e){var _0x4afa3c={};_0x4afa3c[_0x3cde6e]={'$like':'%'+_0x29299c[_0xa1ab('0x36')][_0xa1ab('0x40')]+'%'};return _0x4afa3c;})});}_0x1790c2=_[_0xa1ab('0x42')]({},_0x1790c2,_0x29299c[_0xa1ab('0x44')]);return db[_0xa1ab('0x57')]['findAll'](_0x1790c2);}})[_0xa1ab('0x28')](function(_0x1863f5){if(_0x1863f5){return db[_0xa1ab('0x5a')][_0xa1ab('0x5b')]({'where':{'id':_['map'](_0x1863f5,_0xa1ab('0x5c')),'role':_0xa1ab('0x5d')},'attributes':['id',_0xa1ab('0x2d'),_0xa1ab('0x5e'),_0xa1ab('0x5f'),_0xa1ab('0x60')]});}})[_0xa1ab('0x28')](function(_0x1cbd8e){if(_0x1cbd8e){return{'count':_0x1cbd8e[_0xa1ab('0x21')],'rows':_[_0xa1ab('0x35')](_0x1cbd8e[_0xa1ab('0x48')],function(_0xbbf6a4){return{'membername':_0xbbf6a4[_0xa1ab('0x2d')],'UserId':_0xbbf6a4['id'],'queue_name':_0x5eac0e['name'],'WhatsappQueueId':_0x5eac0e['id'],'interface':util[_0xa1ab('0x61')](_0xa1ab('0x62'),_0xa1ab('0x63'),_0xbbf6a4[_0xa1ab('0x2d')]),'penalty':0x0,'paused':_0xbbf6a4['whatsappPause'],'createdAt':_0xbbf6a4[_0xa1ab('0x60')],'updatedAt':_0xbbf6a4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x24a9b2,_0x1790c2))[_0xa1ab('0x49')](handleError(_0x24a9b2,null));};exports[_0xa1ab('0x64')]=function(_0x4cc58b,_0x232616,_0x26d1a3){var _0x2d3008={};var _0x2a5495={};var _0x595a7d;var _0x164529;return db[_0xa1ab('0x30')][_0xa1ab('0x65')]({'where':{'id':_0x4cc58b[_0xa1ab('0x66')]['id']}})[_0xa1ab('0x28')](handleEntityNotFound(_0x232616,null))['then'](function(_0x185e79){if(_0x185e79){_0x595a7d=_0x185e79;_0x2a5495[_0xa1ab('0x34')]=_[_0xa1ab('0x37')](db[_0xa1ab('0x67')][_0xa1ab('0x31')]);_0x2a5495['query']=_[_0xa1ab('0x37')](_0x4cc58b[_0xa1ab('0x36')]);_0x2a5495['filters']=_[_0xa1ab('0x38')](_0x2a5495[_0xa1ab('0x34')],_0x2a5495[_0xa1ab('0x36')]);_0x2d3008[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x2a5495[_0xa1ab('0x34')],qs['fields'](_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x4b')]));_0x2d3008[_0xa1ab('0x39')]=_0x2d3008['attributes'][_0xa1ab('0x58')]?_0x2d3008[_0xa1ab('0x39')]:_0x2a5495[_0xa1ab('0x34')];_0x2d3008['order']=qs['sort'](_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x3d')]);_0x2d3008[_0xa1ab('0x41')]=qs[_0xa1ab('0x3e')](_[_0xa1ab('0x3f')](_0x4cc58b[_0xa1ab('0x36')],_0x2a5495[_0xa1ab('0x3e')]));if(_0x4cc58b['query'][_0xa1ab('0x40')]){_0x2d3008[_0xa1ab('0x41')]=_['merge'](_0x2d3008[_0xa1ab('0x41')],{'$or':_['map'](_0x2d3008[_0xa1ab('0x39')],function(_0x261ae8){var _0xa3469c={};_0xa3469c[_0x261ae8]={'$like':'%'+_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x40')]+'%'};return _0xa3469c;})});}_0x2d3008=_[_0xa1ab('0x42')]({},_0x2d3008,_0x4cc58b['options']);return _0x595a7d[_0xa1ab('0x64')](_0x2d3008);}})[_0xa1ab('0x28')](function(_0x119d71){if(_0x119d71){_0x164529=_0x119d71[_0xa1ab('0x58')];if(!_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x3a')](_0xa1ab('0x3b'))){_0x2d3008[_0xa1ab('0x1e')]=qs['limit'](_0x4cc58b[_0xa1ab('0x36')]['limit']);_0x2d3008['offset']=qs[_0xa1ab('0x20')](_0x4cc58b['query']['offset']);}return _0x595a7d['getTeams'](_0x2d3008);}})[_0xa1ab('0x28')](function(_0x30db55){if(_0x30db55){return _0x30db55?{'count':_0x164529,'rows':_0x30db55}:null;}})[_0xa1ab('0x28')](respondWithResult(_0x232616,null))[_0xa1ab('0x49')](handleError(_0x232616,null));};exports['addTeams']=function(_0x2b071e,_0x570946,_0x57fa0c){var _0x55a333=_0x2b071e[_0xa1ab('0x4e')][_0xa1ab('0x68')];return db[_0xa1ab('0x67')]['findAll']({'where':{'id':_0x55a333},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa1ab('0x69'),'attributes':['id',_0xa1ab('0x2d'),_0xa1ab('0x6a'),'voicePause',_0xa1ab('0x6b')],'raw':!![]}]})[_0xa1ab('0x28')](function(_0x519542){if(_0x519542){var _0x195310=_[_0xa1ab('0x6c')](_0x519542,function(_0x2cb449){var _0x3a5800=_0x2cb449[_0xa1ab('0x29')]({'plain':!![]});return _0x3a5800[_0xa1ab('0x69')];});return db[_0xa1ab('0x30')][_0xa1ab('0x4c')]({'where':{'id':_0x2b071e[_0xa1ab('0x66')]['id']}})['then'](function(_0x339005){return db[_0xa1ab('0x6d')][_0xa1ab('0x6e')](function(_0x2e57f7){return _0x339005[_0xa1ab('0x6f')](_0x55a333,{'transaction':_0x2e57f7})[_0xa1ab('0x28')](function(){return BPromise['each'](_0x195310,function(_0x350bd3){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x350bd3['id'],'WhatsappQueueId':_0x2b071e['params']['id']},'transaction':_0x2e57f7});});})[_0xa1ab('0x28')](function(){_0x195310[_0xa1ab('0x70')](function(_0x204c5e){socket['emit'](_0xa1ab('0x71'),{'UserId':_0x204c5e['id'],'WhatsappQueueId':_0x339005['id']});});});});});}})[_0xa1ab('0x28')](respondWithStatusCode(_0x570946,null))['catch'](handleError(_0x570946,null));};exports[_0xa1ab('0x72')]=function(_0x1c69f8,_0xbf6772,_0x3e2c21){return db['Team'][_0xa1ab('0x47')]({'where':{'id':_0x1c69f8[_0xa1ab('0x36')][_0xa1ab('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa1ab('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa1ab('0x28')](handleEntityNotFound(_0xbf6772,null))[_0xa1ab('0x28')](function(_0x538a7e){var _0x2942ab=_[_0xa1ab('0x35')](_0x538a7e,'id');var _0x3c806e=[];var _0x1769cc=[];var _0x5cd078=squel['select']();_0x5cd078[_0xa1ab('0x73')]('tq.TeamId')[_0xa1ab('0x74')](_0xa1ab('0x75'),'tq')[_0xa1ab('0x76')](_0xa1ab('0x77'),'ut',_0xa1ab('0x78'))[_0xa1ab('0x41')](_0xa1ab('0x79'),_0x1c69f8[_0xa1ab('0x66')]['id']);for(var _0x2615fc=0x0;_0x2615fc<_0x538a7e[_0xa1ab('0x58')];_0x2615fc+=0x1){let _0x10284d=_0x538a7e[_0x2615fc];for(var _0x58166d=0x0;_0x58166d<_0x10284d[_0xa1ab('0x69')][_0xa1ab('0x58')];_0x58166d+=0x1){let _0xaed0e0=_0x10284d[_0xa1ab('0x69')][_0x58166d];var _0x55ac2f=_0x5cd078[_0xa1ab('0x7a')]();_0x55ac2f[_0xa1ab('0x41')](_0xa1ab('0x7b'),_0xaed0e0['id']);_0x1769cc[_0xa1ab('0x7c')](db['sequelize'][_0xa1ab('0x36')](_0x55ac2f['toString'](),{'type':db[_0xa1ab('0x6d')][_0xa1ab('0x7d')][_0xa1ab('0x7e')]})[_0xa1ab('0x28')](function(_0x3e6413){if(_0x3e6413[_0xa1ab('0x58')]===0x1){return _0xaed0e0['id'];}else{var _0x13d3d5=_[_0xa1ab('0x7f')](_[_0xa1ab('0x35')](_0x3e6413,'TeamId'),function(_0x1a1238){return _[_0xa1ab('0x80')](_0x2942ab,_0x1a1238);});if(_0x13d3d5){return _0xaed0e0['id'];}}}));}}return BPromise[_0xa1ab('0x81')](_0x1769cc)[_0xa1ab('0x28')](function(_0x20e2a7){_0x3c806e=_(_0x3c806e)['union'](_0x20e2a7)['compact']()[_0xa1ab('0x82')]();return db['WhatsappQueue'][_0xa1ab('0x4c')]({'where':{'id':_0x1c69f8[_0xa1ab('0x66')]['id']}})[_0xa1ab('0x28')](function(_0x4781a7){return db[_0xa1ab('0x6d')][_0xa1ab('0x6e')](function(_0x11d1eb){return _0x4781a7[_0xa1ab('0x72')](_0x1c69f8[_0xa1ab('0x36')][_0xa1ab('0x68')],{'transaction':_0x11d1eb})['then'](function(){if(!_[_0xa1ab('0x83')](_0x3c806e)){return _0x4781a7['removeAgents'](_0x3c806e,{'transaction':_0x11d1eb});}})[_0xa1ab('0x28')](function(){_0x3c806e[_0xa1ab('0x70')](function(_0x692ea3){socket[_0xa1ab('0x84')](_0xa1ab('0x85'),{'UserId':_0x692ea3,'WhatsappQueueId':_0x4781a7['id']});});});});});});})[_0xa1ab('0x28')](respondWithStatusCode(_0xbf6772,null))['catch'](handleError(_0xbf6772,null));};exports[_0xa1ab('0x86')]=function(_0x329baf,_0x3d14df,_0x3a0082){return db[_0xa1ab('0x30')][_0xa1ab('0x4c')]({'where':{'id':_0x329baf['params']['id']}})[_0xa1ab('0x28')](handleEntityNotFound(_0x3d14df,null))['then'](function(_0x48aea9){if(_0x48aea9){return _0x48aea9[_0xa1ab('0x86')](_0x329baf['body']['ids'],_[_0xa1ab('0x87')](_0x329baf[_0xa1ab('0x4e')],[_0xa1ab('0x68'),'id'])||{})[_0xa1ab('0x88')](function(_0x4b861b){for(var _0x216767=0x0;_0x216767<_0x329baf['body'][_0xa1ab('0x68')][_0xa1ab('0x58')];_0x216767+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x329baf['body'][_0xa1ab('0x68')][_0x216767]),'WhatsappQueueId':Number(_0x329baf[_0xa1ab('0x66')]['id'])});}return _0x4b861b;});}})['then'](respondWithResult(_0x3d14df,null))[_0xa1ab('0x49')](handleError(_0x3d14df,null));};exports['removeAgents']=function(_0x3b270f,_0xb018ad,_0x2bc7c4){return db['WhatsappQueue']['find']({'where':{'id':_0x3b270f[_0xa1ab('0x66')]['id']}})['then'](handleEntityNotFound(_0xb018ad,null))['then'](function(_0xd1632){if(_0xd1632){return _0xd1632[_0xa1ab('0x89')](_0x3b270f['query']['ids'])[_0xa1ab('0x28')](function(){if(_[_0xa1ab('0x8a')](_0x3b270f[_0xa1ab('0x36')][_0xa1ab('0x68')])){for(var _0x50ca7b=0x0;_0x50ca7b<_0x3b270f['query'][_0xa1ab('0x68')][_0xa1ab('0x58')];_0x50ca7b+=0x1){socket[_0xa1ab('0x84')](_0xa1ab('0x85'),{'UserId':Number(_0x3b270f['query'][_0xa1ab('0x68')][_0x50ca7b]),'WhatsappQueueId':Number(_0x3b270f[_0xa1ab('0x66')]['id'])});}}else{socket[_0xa1ab('0x84')](_0xa1ab('0x85'),{'UserId':Number(_0x3b270f[_0xa1ab('0x36')][_0xa1ab('0x68')]),'WhatsappQueueId':Number(_0x3b270f[_0xa1ab('0x66')]['id'])});}});}})[_0xa1ab('0x28')](respondWithStatusCode(_0xb018ad,null))['catch'](handleError(_0xb018ad,null));};exports[_0xa1ab('0x8b')]=function(_0x3e2e5e,_0x33d8ab,_0xc7f89e){var _0x1050a9={};var _0x71ff1b={};var _0x657efc;var _0x10a78e;return db[_0xa1ab('0x30')][_0xa1ab('0x65')]({'where':{'id':_0x3e2e5e[_0xa1ab('0x66')]['id']}})[_0xa1ab('0x28')](handleEntityNotFound(_0x33d8ab,null))['then'](function(_0x38768b){if(_0x38768b){_0x657efc=_0x38768b;_0x71ff1b['model']=_[_0xa1ab('0x37')](db['User'][_0xa1ab('0x31')]);_0x71ff1b[_0xa1ab('0x36')]=_[_0xa1ab('0x37')](_0x3e2e5e[_0xa1ab('0x36')]);_0x71ff1b[_0xa1ab('0x3e')]=_['intersection'](_0x71ff1b[_0xa1ab('0x34')],_0x71ff1b[_0xa1ab('0x36')]);_0x1050a9[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x71ff1b[_0xa1ab('0x34')],qs[_0xa1ab('0x4b')](_0x3e2e5e[_0xa1ab('0x36')][_0xa1ab('0x4b')]));_0x1050a9['attributes']=_0x1050a9[_0xa1ab('0x39')][_0xa1ab('0x58')]?_0x1050a9[_0xa1ab('0x39')]:_0x71ff1b[_0xa1ab('0x34')];_0x1050a9[_0xa1ab('0x3c')]=qs[_0xa1ab('0x3d')](_0x3e2e5e[_0xa1ab('0x36')][_0xa1ab('0x3d')]);_0x1050a9[_0xa1ab('0x41')]=qs['filters'](_['pick'](_0x3e2e5e['query'],_0x71ff1b[_0xa1ab('0x3e')]));if(_0x3e2e5e[_0xa1ab('0x36')][_0xa1ab('0x40')]){_0x1050a9[_0xa1ab('0x41')]=_[_0xa1ab('0x42')](_0x1050a9[_0xa1ab('0x41')],{'$or':_[_0xa1ab('0x35')](_0x1050a9[_0xa1ab('0x39')],function(_0x1ff826){var _0x586e26={};_0x586e26[_0x1ff826]={'$like':'%'+_0x3e2e5e['query'][_0xa1ab('0x40')]+'%'};return _0x586e26;})});}_0x1050a9=_[_0xa1ab('0x42')]({},_0x1050a9,_0x3e2e5e[_0xa1ab('0x44')]);return _0x657efc[_0xa1ab('0x8b')](_0x1050a9);}})['then'](function(_0x572108){if(_0x572108){_0x10a78e=_0x572108[_0xa1ab('0x58')];if(!_0x3e2e5e[_0xa1ab('0x36')]['hasOwnProperty'](_0xa1ab('0x3b'))){_0x1050a9[_0xa1ab('0x1e')]=qs['limit'](_0x3e2e5e['query'][_0xa1ab('0x1e')]);_0x1050a9[_0xa1ab('0x20')]=qs[_0xa1ab('0x20')](_0x3e2e5e[_0xa1ab('0x36')]['offset']);}return _0x657efc['getAgents'](_0x1050a9);}})[_0xa1ab('0x28')](function(_0x197510){if(_0x197510){return _0x197510?{'count':_0x10a78e,'rows':_0x197510}:null;}})['then'](respondWithResult(_0x33d8ab,null))['catch'](handleError(_0x33d8ab,null));}; \ No newline at end of file +var _0xfb0a=['show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','length','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','findAll','User','Agents','online','voicePause','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','name','index','map','rawAttributes','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','WhatsappQueue','include','rows','catch'];(function(_0xbc3047,_0x2bd584){var _0x38d2ea=function(_0x493977){while(--_0x493977){_0xbc3047['push'](_0xbc3047['shift']());}};_0x38d2ea(++_0x2bd584);}(_0xfb0a,0x152));var _0xafb0=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xfb0a[_0x40bffc];return _0x3007e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xafb0('0x0'));var jsonpatch=require(_0xafb0('0x1'));var rp=require(_0xafb0('0x2'));var moment=require(_0xafb0('0x3'));var BPromise=require(_0xafb0('0x4'));var Mustache=require(_0xafb0('0x5'));var util=require(_0xafb0('0x6'));var path=require(_0xafb0('0x7'));var sox=require(_0xafb0('0x8'));var csv=require('to-csv');var ejs=require(_0xafb0('0x9'));var fs=require('fs');var fs_extra=require(_0xafb0('0xa'));var _=require('lodash');var squel=require(_0xafb0('0xb'));var crypto=require(_0xafb0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xafb0('0xd'));var toCsv=require(_0xafb0('0xe'));var querystring=require(_0xafb0('0xf'));var Papa=require(_0xafb0('0x10'));var Redis=require(_0xafb0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xafb0('0x12'));var as=require(_0xafb0('0x13'));var hardwareService=require(_0xafb0('0x14'));var logger=require(_0xafb0('0x15'))(_0xafb0('0x16'));var utils=require(_0xafb0('0x17'));var config=require(_0xafb0('0x18'));var licenseUtil=require(_0xafb0('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xafb0('0x1a')],{'host':_0xafb0('0x1b'),'port':0x18eb});var socket=require(_0xafb0('0x1c'))(new Redis(config[_0xafb0('0x1a')]));require(_0xafb0('0x1d'))[_0xafb0('0x1e')](socket);function respondWithStatusCode(_0x57467b,_0x44afdc){_0x44afdc=_0x44afdc||0xcc;return function(_0x164b40){if(_0x164b40){return _0x57467b[_0xafb0('0x1f')](_0x44afdc);}return _0x57467b[_0xafb0('0x20')](_0x44afdc)[_0xafb0('0x21')]();};}function respondWithResult(_0x3a0815,_0x1ddce1){_0x1ddce1=_0x1ddce1||0xc8;return function(_0x54fc6f){if(_0x54fc6f){return _0x3a0815[_0xafb0('0x20')](_0x1ddce1)[_0xafb0('0x22')](_0x54fc6f);}};}function respondWithFilteredResult(_0x37280e,_0x2f5ae3){return function(_0x48e0df){if(_0x48e0df){var _0x2c9ca3=typeof _0x2f5ae3[_0xafb0('0x23')]===_0xafb0('0x24')&&typeof _0x2f5ae3[_0xafb0('0x25')]===_0xafb0('0x24');var _0x96dce1=_0x48e0df[_0xafb0('0x26')];var _0x460bea=_0x2c9ca3?0x0:_0x2f5ae3['offset'];var _0xd5fad9=_0x2c9ca3?_0x48e0df['count']:_0x2f5ae3['offset']+_0x2f5ae3['limit'];var _0x213858;if(_0xd5fad9>=_0x96dce1){_0xd5fad9=_0x96dce1;_0x213858=0xc8;}else{_0x213858=0xce;}_0x37280e[_0xafb0('0x20')](_0x213858);return _0x37280e[_0xafb0('0x27')](_0xafb0('0x28'),_0x460bea+'-'+_0xd5fad9+'/'+_0x96dce1)[_0xafb0('0x22')](_0x48e0df);}return null;};}function patchUpdates(_0xf8beb){return function(_0xfb0e1c){try{jsonpatch['apply'](_0xfb0e1c,_0xf8beb,!![]);}catch(_0x5239c2){return BPromise['reject'](_0x5239c2);}return _0xfb0e1c[_0xafb0('0x29')]();};}function saveUpdates(_0x4a4028,_0x187f13){return function(_0x3a0e21){if(_0x3a0e21){return _0x3a0e21[_0xafb0('0x2a')](_0x4a4028)['then'](function(_0x29681e){return _0x29681e;});}return null;};}function removeEntity(_0x2c4458,_0x146539){return function(_0x600e7e){if(_0x600e7e){return _0x600e7e[_0xafb0('0x2b')]()[_0xafb0('0x2c')](function(){var _0x1244d3=_0x600e7e[_0xafb0('0x2d')]({'plain':!![]});var _0x169af0=_0xafb0('0x2e');return db[_0xafb0('0x2f')][_0xafb0('0x2b')]({'where':{'type':_0x169af0,'resourceId':_0x1244d3['id']}})['then'](function(){return _0x600e7e;});})['then'](function(){_0x2c4458[_0xafb0('0x20')](0xcc)[_0xafb0('0x21')]();});}};}function handleEntityNotFound(_0x3cc1e2,_0x50028d){return function(_0x18a84f){if(!_0x18a84f){_0x3cc1e2[_0xafb0('0x1f')](0x194);}return _0x18a84f;};}function handleError(_0x281c40,_0x4af06d){_0x4af06d=_0x4af06d||0x1f4;return function(_0x127b17){logger[_0xafb0('0x30')](_0x127b17['stack']);if(_0x127b17[_0xafb0('0x31')]){delete _0x127b17[_0xafb0('0x31')];}_0x281c40[_0xafb0('0x20')](_0x4af06d)['send'](_0x127b17);};}exports[_0xafb0('0x32')]=function(_0x2feac1,_0x416b80){var _0x2ea04f={},_0x56dcf3={},_0x320586={'count':0x0,'rows':[]};var _0x340379=_[_0xafb0('0x33')](db['WhatsappQueue'][_0xafb0('0x34')],function(_0x40bc8f){return{'name':_0x40bc8f['fieldName'],'type':_0x40bc8f['type'][_0xafb0('0x35')]};});_0x56dcf3['model']=_[_0xafb0('0x33')](_0x340379,_0xafb0('0x31'));_0x56dcf3[_0xafb0('0x36')]=_[_0xafb0('0x37')](_0x2feac1[_0xafb0('0x36')]);_0x56dcf3['filters']=_['intersection'](_0x56dcf3[_0xafb0('0x38')],_0x56dcf3[_0xafb0('0x36')]);_0x2ea04f[_0xafb0('0x39')]=_[_0xafb0('0x3a')](_0x56dcf3[_0xafb0('0x38')],qs[_0xafb0('0x3b')](_0x2feac1[_0xafb0('0x36')][_0xafb0('0x3b')]));_0x2ea04f[_0xafb0('0x39')]=_0x2ea04f[_0xafb0('0x39')]['length']?_0x2ea04f['attributes']:_0x56dcf3['model'];if(!_0x2feac1[_0xafb0('0x36')][_0xafb0('0x3c')](_0xafb0('0x3d'))){_0x2ea04f['limit']=qs[_0xafb0('0x25')](_0x2feac1[_0xafb0('0x36')][_0xafb0('0x25')]);_0x2ea04f[_0xafb0('0x23')]=qs['offset'](_0x2feac1[_0xafb0('0x36')]['offset']);}_0x2ea04f[_0xafb0('0x3e')]=qs[_0xafb0('0x3f')](_0x2feac1[_0xafb0('0x36')]['sort']);_0x2ea04f[_0xafb0('0x40')]=qs[_0xafb0('0x41')](_[_0xafb0('0x42')](_0x2feac1[_0xafb0('0x36')],_0x56dcf3[_0xafb0('0x41')]),_0x340379);if(_0x2feac1[_0xafb0('0x36')][_0xafb0('0x43')]){_0x2ea04f[_0xafb0('0x40')]=_[_0xafb0('0x44')](_0x2ea04f[_0xafb0('0x40')],{'$or':_[_0xafb0('0x33')](_0x340379,function(_0x164f91){if(_0x164f91[_0xafb0('0x45')]!==_0xafb0('0x46')){var _0x5e8b3d={};_0x5e8b3d[_0x164f91[_0xafb0('0x31')]]={'$like':'%'+_0x2feac1[_0xafb0('0x36')]['filter']+'%'};return _0x5e8b3d;}})});}_0x2ea04f=_[_0xafb0('0x44')]({},_0x2ea04f,_0x2feac1[_0xafb0('0x47')]);var _0x500ea2={'where':_0x2ea04f[_0xafb0('0x40')]};return db[_0xafb0('0x48')]['count'](_0x500ea2)[_0xafb0('0x2c')](function(_0x5e9915){_0x320586[_0xafb0('0x26')]=_0x5e9915;if(_0x2feac1['query']['includeAll']){_0x2ea04f[_0xafb0('0x49')]=[{'all':!![]}];}return db[_0xafb0('0x48')]['findAll'](_0x2ea04f);})[_0xafb0('0x2c')](function(_0x3c4257){_0x320586[_0xafb0('0x4a')]=_0x3c4257;return _0x320586;})[_0xafb0('0x2c')](respondWithFilteredResult(_0x416b80,_0x2ea04f))[_0xafb0('0x4b')](handleError(_0x416b80,null));};exports[_0xafb0('0x4c')]=function(_0x55773a,_0x370221){var _0x2b96a3={'raw':!![],'where':{'id':_0x55773a[_0xafb0('0x4d')]['id']}},_0x104474={};_0x104474['model']=_['keys'](db[_0xafb0('0x48')][_0xafb0('0x34')]);_0x104474[_0xafb0('0x36')]=_[_0xafb0('0x37')](_0x55773a[_0xafb0('0x36')]);_0x104474[_0xafb0('0x41')]=_[_0xafb0('0x3a')](_0x104474[_0xafb0('0x38')],_0x104474['query']);_0x2b96a3[_0xafb0('0x39')]=_[_0xafb0('0x3a')](_0x104474['model'],qs['fields'](_0x55773a[_0xafb0('0x36')][_0xafb0('0x3b')]));_0x2b96a3[_0xafb0('0x39')]=_0x2b96a3[_0xafb0('0x39')]['length']?_0x2b96a3['attributes']:_0x104474['model'];if(_0x55773a['query'][_0xafb0('0x4e')]){_0x2b96a3['include']=[{'all':!![]}];}_0x2b96a3=_[_0xafb0('0x44')]({},_0x2b96a3,_0x55773a['options']);return db['WhatsappQueue'][_0xafb0('0x4f')](_0x2b96a3)[_0xafb0('0x2c')](handleEntityNotFound(_0x370221,null))['then'](respondWithResult(_0x370221,null))[_0xafb0('0x4b')](handleError(_0x370221,null));};exports[_0xafb0('0x50')]=function(_0x309827,_0x394b4e){return db[_0xafb0('0x48')]['create'](_0x309827[_0xafb0('0x51')],{})[_0xafb0('0x2c')](function(_0x2f51a7){var _0x33938d=_0x309827[_0xafb0('0x52')][_0xafb0('0x2d')]({'plain':!![]});if(!_0x33938d)throw new Error(_0xafb0('0x53'));if(_0x33938d[_0xafb0('0x54')]===_0xafb0('0x52')){var _0x5d26e2=_0x2f51a7[_0xafb0('0x2d')]({'plain':!![]});var _0x31c082=_0xafb0('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x31c082,'userProfileId':_0x33938d[_0xafb0('0x55')]},'raw':!![]})[_0xafb0('0x2c')](function(_0x254620){if(_0x254620&&_0x254620[_0xafb0('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x5d26e2[_0xafb0('0x31')],'resourceId':_0x5d26e2['id'],'type':_0x254620[_0xafb0('0x31')],'sectionId':_0x254620['id']},{})[_0xafb0('0x2c')](function(){return _0x2f51a7;});}else{return _0x2f51a7;}})['catch'](function(_0x58f430){logger[_0xafb0('0x30')](_0xafb0('0x57'),_0x58f430);throw _0x58f430;});}return _0x2f51a7;})['then'](respondWithResult(_0x394b4e,0xc9))[_0xafb0('0x4b')](handleError(_0x394b4e,null));};exports[_0xafb0('0x2a')]=function(_0x48c88f,_0x578915){if(_0x48c88f[_0xafb0('0x51')]['id']){delete _0x48c88f['body']['id'];}return db[_0xafb0('0x48')][_0xafb0('0x4f')]({'where':{'id':_0x48c88f[_0xafb0('0x4d')]['id']}})[_0xafb0('0x2c')](handleEntityNotFound(_0x578915,null))[_0xafb0('0x2c')](saveUpdates(_0x48c88f[_0xafb0('0x51')],null))['then'](respondWithResult(_0x578915,null))[_0xafb0('0x4b')](handleError(_0x578915,null));};exports[_0xafb0('0x2b')]=function(_0x4ebaff,_0x687e0){return db[_0xafb0('0x48')][_0xafb0('0x4f')]({'where':{'id':_0x4ebaff[_0xafb0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x687e0,null))['then'](removeEntity(_0x687e0,null))[_0xafb0('0x4b')](handleError(_0x687e0,null));};exports[_0xafb0('0x58')]=function(_0x492716,_0x2267b7){return db['WhatsappQueue']['describe']()[_0xafb0('0x2c')](respondWithResult(_0x2267b7,null))[_0xafb0('0x4b')](handleError(_0x2267b7,null));};exports['getMembers']=function(_0x1ba6d8,_0x58dc08,_0x26863e){var _0x171be9={'raw':!![],'where':{}},_0x3c958b={},_0x3ac30e;return db[_0xafb0('0x48')][_0xafb0('0x59')]({'where':{'id':_0x1ba6d8['params']['id']}})[_0xafb0('0x2c')](handleEntityNotFound(_0x58dc08,null))[_0xafb0('0x2c')](function(_0x51b514){if(_0x51b514){_0x3ac30e=_0x51b514[_0xafb0('0x2d')]({'plain':!![]});_0x3c958b[_0xafb0('0x38')]=_['keys'](db[_0xafb0('0x5a')][_0xafb0('0x34')]);_0x3c958b[_0xafb0('0x36')]=_['keys'](_0x1ba6d8[_0xafb0('0x36')]);_0x3c958b[_0xafb0('0x41')]=_['intersection'](_0x3c958b[_0xafb0('0x38')],_0x3c958b[_0xafb0('0x36')]);_0x171be9[_0xafb0('0x39')]=_[_0xafb0('0x3a')](_0x3c958b[_0xafb0('0x38')],qs[_0xafb0('0x3b')](_0x1ba6d8[_0xafb0('0x36')][_0xafb0('0x3b')]));_0x171be9['attributes']=_0x171be9['attributes'][_0xafb0('0x5b')]?_0x171be9[_0xafb0('0x39')]:_0x3c958b['model'];if(!_0x1ba6d8['query'][_0xafb0('0x3c')]('nolimit')){_0x171be9[_0xafb0('0x25')]=qs['limit'](_0x1ba6d8['query'][_0xafb0('0x25')]);_0x171be9['offset']=qs[_0xafb0('0x23')](_0x1ba6d8[_0xafb0('0x36')][_0xafb0('0x23')]);}_0x171be9[_0xafb0('0x3e')]=qs[_0xafb0('0x3f')](_0x1ba6d8[_0xafb0('0x36')][_0xafb0('0x3f')]);_0x171be9[_0xafb0('0x40')]=qs[_0xafb0('0x41')](_[_0xafb0('0x42')](_0x1ba6d8['query'],_0x3c958b[_0xafb0('0x41')]));_0x171be9[_0xafb0('0x40')][_0xafb0('0x5c')]=_0x51b514['id'];if(_0x1ba6d8[_0xafb0('0x36')][_0xafb0('0x43')]){_0x171be9[_0xafb0('0x40')]=_[_0xafb0('0x44')](_0x171be9[_0xafb0('0x40')],{'$or':_[_0xafb0('0x33')](_0x171be9[_0xafb0('0x39')],function(_0x11339f){var _0x3bf292={};_0x3bf292[_0x11339f]={'$like':'%'+_0x1ba6d8['query'][_0xafb0('0x43')]+'%'};return _0x3bf292;})});}_0x171be9=_[_0xafb0('0x44')]({},_0x171be9,_0x1ba6d8[_0xafb0('0x47')]);return db[_0xafb0('0x5a')]['findAll'](_0x171be9);}})[_0xafb0('0x2c')](function(_0x4fcd52){if(_0x4fcd52){return db['User'][_0xafb0('0x5d')]({'where':{'id':_[_0xafb0('0x33')](_0x4fcd52,_0xafb0('0x5e')),'role':_0xafb0('0x5f')},'attributes':['id','name',_0xafb0('0x60'),_0xafb0('0x61'),_0xafb0('0x62')]});}})[_0xafb0('0x2c')](function(_0x4dcb8b){if(_0x4dcb8b){return{'count':_0x4dcb8b[_0xafb0('0x26')],'rows':_[_0xafb0('0x33')](_0x4dcb8b[_0xafb0('0x4a')],function(_0x1f876b){return{'membername':_0x1f876b[_0xafb0('0x31')],'UserId':_0x1f876b['id'],'queue_name':_0x3ac30e['name'],'WhatsappQueueId':_0x3ac30e['id'],'interface':util[_0xafb0('0x63')]('%s/%s','SIP',_0x1f876b[_0xafb0('0x31')]),'penalty':0x0,'paused':_0x1f876b[_0xafb0('0x60')],'createdAt':_0x1f876b[_0xafb0('0x62')],'updatedAt':_0x1f876b[_0xafb0('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xafb0('0x2c')](respondWithFilteredResult(_0x58dc08,_0x171be9))[_0xafb0('0x4b')](handleError(_0x58dc08,null));};exports[_0xafb0('0x64')]=function(_0x588c64,_0x416e86,_0x294049){var _0x1e74bf={};var _0x19f850={};var _0x1f7555;var _0x171918;return db['WhatsappQueue']['findOne']({'where':{'id':_0x588c64[_0xafb0('0x4d')]['id']}})[_0xafb0('0x2c')](handleEntityNotFound(_0x416e86,null))['then'](function(_0x58e23c){if(_0x58e23c){_0x1f7555=_0x58e23c;_0x19f850['model']=_[_0xafb0('0x37')](db[_0xafb0('0x65')][_0xafb0('0x34')]);_0x19f850[_0xafb0('0x36')]=_['keys'](_0x588c64['query']);_0x19f850[_0xafb0('0x41')]=_[_0xafb0('0x3a')](_0x19f850['model'],_0x19f850[_0xafb0('0x36')]);_0x1e74bf[_0xafb0('0x39')]=_['intersection'](_0x19f850[_0xafb0('0x38')],qs[_0xafb0('0x3b')](_0x588c64['query'][_0xafb0('0x3b')]));_0x1e74bf[_0xafb0('0x39')]=_0x1e74bf['attributes'][_0xafb0('0x5b')]?_0x1e74bf[_0xafb0('0x39')]:_0x19f850[_0xafb0('0x38')];_0x1e74bf[_0xafb0('0x3e')]=qs[_0xafb0('0x3f')](_0x588c64['query'][_0xafb0('0x3f')]);_0x1e74bf['where']=qs['filters'](_[_0xafb0('0x42')](_0x588c64[_0xafb0('0x36')],_0x19f850['filters']));if(_0x588c64[_0xafb0('0x36')][_0xafb0('0x43')]){_0x1e74bf[_0xafb0('0x40')]=_[_0xafb0('0x44')](_0x1e74bf[_0xafb0('0x40')],{'$or':_[_0xafb0('0x33')](_0x1e74bf[_0xafb0('0x39')],function(_0x3f8e49){var _0x5f2647={};_0x5f2647[_0x3f8e49]={'$like':'%'+_0x588c64[_0xafb0('0x36')]['filter']+'%'};return _0x5f2647;})});}_0x1e74bf=_['merge']({},_0x1e74bf,_0x588c64[_0xafb0('0x47')]);return _0x1f7555[_0xafb0('0x64')](_0x1e74bf);}})[_0xafb0('0x2c')](function(_0x4630ba){if(_0x4630ba){_0x171918=_0x4630ba['length'];if(!_0x588c64[_0xafb0('0x36')]['hasOwnProperty']('nolimit')){_0x1e74bf[_0xafb0('0x25')]=qs[_0xafb0('0x25')](_0x588c64[_0xafb0('0x36')]['limit']);_0x1e74bf[_0xafb0('0x23')]=qs[_0xafb0('0x23')](_0x588c64[_0xafb0('0x36')][_0xafb0('0x23')]);}return _0x1f7555[_0xafb0('0x64')](_0x1e74bf);}})[_0xafb0('0x2c')](function(_0x2e7739){if(_0x2e7739){return _0x2e7739?{'count':_0x171918,'rows':_0x2e7739}:null;}})[_0xafb0('0x2c')](respondWithResult(_0x416e86,null))['catch'](handleError(_0x416e86,null));};exports[_0xafb0('0x66')]=function(_0x3e1155,_0x42ad75,_0x29ecbf){var _0x1434f9=_0x3e1155[_0xafb0('0x51')][_0xafb0('0x67')];return db[_0xafb0('0x65')][_0xafb0('0x68')]({'where':{'id':_0x1434f9},'attributes':['id'],'include':[{'model':db[_0xafb0('0x69')],'as':_0xafb0('0x6a'),'attributes':['id',_0xafb0('0x31'),_0xafb0('0x6b'),_0xafb0('0x6c'),'interface'],'raw':!![]}]})[_0xafb0('0x2c')](function(_0x3898d7){if(_0x3898d7){var _0x1a6372=_['flatMap'](_0x3898d7,function(_0x1d4512){var _0x5d29d8=_0x1d4512[_0xafb0('0x2d')]({'plain':!![]});return _0x5d29d8['Agents'];});return db[_0xafb0('0x48')][_0xafb0('0x4f')]({'where':{'id':_0x3e1155[_0xafb0('0x4d')]['id']}})[_0xafb0('0x2c')](function(_0x2ee033){return db[_0xafb0('0x6d')][_0xafb0('0x6e')](function(_0x23d720){return _0x2ee033[_0xafb0('0x66')](_0x1434f9,{'transaction':_0x23d720})['then'](function(){return BPromise[_0xafb0('0x6f')](_0x1a6372,function(_0x41d2fe){return db[_0xafb0('0x5a')]['findOrCreate']({'where':{'UserId':_0x41d2fe['id'],'WhatsappQueueId':_0x3e1155[_0xafb0('0x4d')]['id']},'transaction':_0x23d720});});})[_0xafb0('0x2c')](function(){_0x1a6372[_0xafb0('0x70')](function(_0x1d1765){socket[_0xafb0('0x71')](_0xafb0('0x72'),{'UserId':_0x1d1765['id'],'WhatsappQueueId':_0x2ee033['id']});});});});});}})[_0xafb0('0x2c')](respondWithStatusCode(_0x42ad75,null))['catch'](handleError(_0x42ad75,null));};exports[_0xafb0('0x73')]=function(_0x3a94b1,_0x1db925,_0x2cf052){return db[_0xafb0('0x65')][_0xafb0('0x68')]({'where':{'id':_0x3a94b1[_0xafb0('0x36')][_0xafb0('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xafb0('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xafb0('0x2c')](handleEntityNotFound(_0x1db925,null))[_0xafb0('0x2c')](function(_0x5f9cc7){var _0x432ccf=_[_0xafb0('0x33')](_0x5f9cc7,'id');var _0x5785f0=[];var _0x5604c2=[];var _0x354709=squel[_0xafb0('0x74')]();_0x354709[_0xafb0('0x75')]('tq.TeamId')[_0xafb0('0x76')](_0xafb0('0x77'),'tq')[_0xafb0('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xafb0('0x40')](_0xafb0('0x79'),_0x3a94b1['params']['id']);for(var _0x3d9863=0x0;_0x3d9863<_0x5f9cc7[_0xafb0('0x5b')];_0x3d9863+=0x1){let _0x5973fa=_0x5f9cc7[_0x3d9863];for(var _0x32dac1=0x0;_0x32dac1<_0x5973fa[_0xafb0('0x6a')][_0xafb0('0x5b')];_0x32dac1+=0x1){let _0x57f432=_0x5973fa[_0xafb0('0x6a')][_0x32dac1];var _0x206b7f=_0x354709['clone']();_0x206b7f[_0xafb0('0x40')](_0xafb0('0x7a'),_0x57f432['id']);_0x5604c2[_0xafb0('0x7b')](db[_0xafb0('0x6d')]['query'](_0x206b7f[_0xafb0('0x7c')](),{'type':db[_0xafb0('0x6d')]['QueryTypes']['SELECT']})[_0xafb0('0x2c')](function(_0x3a56b0){if(_0x3a56b0[_0xafb0('0x5b')]===0x1){return _0x57f432['id'];}else{var _0x5b0fed=_[_0xafb0('0x7d')](_[_0xafb0('0x33')](_0x3a56b0,_0xafb0('0x7e')),function(_0x3654a8){return _[_0xafb0('0x7f')](_0x432ccf,_0x3654a8);});if(_0x5b0fed){return _0x57f432['id'];}}}));}}return BPromise[_0xafb0('0x80')](_0x5604c2)[_0xafb0('0x2c')](function(_0xd8e1fc){_0x5785f0=_(_0x5785f0)[_0xafb0('0x81')](_0xd8e1fc)[_0xafb0('0x82')]()['value']();return db[_0xafb0('0x48')][_0xafb0('0x4f')]({'where':{'id':_0x3a94b1['params']['id']}})[_0xafb0('0x2c')](function(_0x479f08){return db['sequelize'][_0xafb0('0x6e')](function(_0x4e7e9d){return _0x479f08[_0xafb0('0x73')](_0x3a94b1['query'][_0xafb0('0x67')],{'transaction':_0x4e7e9d})['then'](function(){if(!_[_0xafb0('0x83')](_0x5785f0)){return _0x479f08[_0xafb0('0x84')](_0x5785f0,{'transaction':_0x4e7e9d});}})['then'](function(){_0x5785f0['forEach'](function(_0x56e756){socket[_0xafb0('0x71')](_0xafb0('0x85'),{'UserId':_0x56e756,'WhatsappQueueId':_0x479f08['id']});});});});});});})['then'](respondWithStatusCode(_0x1db925,null))[_0xafb0('0x4b')](handleError(_0x1db925,null));};exports[_0xafb0('0x86')]=function(_0x9bd7e9,_0x253bc1,_0x441951){return db['WhatsappQueue'][_0xafb0('0x4f')]({'where':{'id':_0x9bd7e9['params']['id']}})[_0xafb0('0x2c')](handleEntityNotFound(_0x253bc1,null))['then'](function(_0x34ab05){if(_0x34ab05){return _0x34ab05['addAgents'](_0x9bd7e9['body'][_0xafb0('0x67')],_['omit'](_0x9bd7e9[_0xafb0('0x51')],[_0xafb0('0x67'),'id'])||{})[_0xafb0('0x87')](function(_0x107d9d){for(var _0x4bb6ee=0x0;_0x4bb6ee<_0x9bd7e9[_0xafb0('0x51')][_0xafb0('0x67')][_0xafb0('0x5b')];_0x4bb6ee+=0x1){socket[_0xafb0('0x71')]('userWhatsappQueue:save',{'UserId':Number(_0x9bd7e9[_0xafb0('0x51')]['ids'][_0x4bb6ee]),'WhatsappQueueId':Number(_0x9bd7e9['params']['id'])});}return _0x107d9d;});}})['then'](respondWithResult(_0x253bc1,null))['catch'](handleError(_0x253bc1,null));};exports[_0xafb0('0x84')]=function(_0x45d3f9,_0x3cbb2c,_0x505414){return db['WhatsappQueue']['find']({'where':{'id':_0x45d3f9[_0xafb0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3cbb2c,null))[_0xafb0('0x2c')](function(_0x276d4d){if(_0x276d4d){return _0x276d4d[_0xafb0('0x84')](_0x45d3f9[_0xafb0('0x36')][_0xafb0('0x67')])[_0xafb0('0x2c')](function(){if(_[_0xafb0('0x88')](_0x45d3f9[_0xafb0('0x36')][_0xafb0('0x67')])){for(var _0x3b8720=0x0;_0x3b8720<_0x45d3f9[_0xafb0('0x36')]['ids'][_0xafb0('0x5b')];_0x3b8720+=0x1){socket[_0xafb0('0x71')](_0xafb0('0x85'),{'UserId':Number(_0x45d3f9[_0xafb0('0x36')][_0xafb0('0x67')][_0x3b8720]),'WhatsappQueueId':Number(_0x45d3f9[_0xafb0('0x4d')]['id'])});}}else{socket[_0xafb0('0x71')](_0xafb0('0x85'),{'UserId':Number(_0x45d3f9[_0xafb0('0x36')][_0xafb0('0x67')]),'WhatsappQueueId':Number(_0x45d3f9[_0xafb0('0x4d')]['id'])});}});}})[_0xafb0('0x2c')](respondWithStatusCode(_0x3cbb2c,null))[_0xafb0('0x4b')](handleError(_0x3cbb2c,null));};exports['getAgents']=function(_0x174d57,_0x57d14b,_0x3de792){var _0x3bce5c={};var _0xed1cd1={};var _0x46106c;var _0x2aff01;return db[_0xafb0('0x48')][_0xafb0('0x59')]({'where':{'id':_0x174d57['params']['id']}})['then'](handleEntityNotFound(_0x57d14b,null))[_0xafb0('0x2c')](function(_0x1941ab){if(_0x1941ab){_0x46106c=_0x1941ab;_0xed1cd1[_0xafb0('0x38')]=_[_0xafb0('0x37')](db[_0xafb0('0x69')][_0xafb0('0x34')]);_0xed1cd1[_0xafb0('0x36')]=_[_0xafb0('0x37')](_0x174d57[_0xafb0('0x36')]);_0xed1cd1[_0xafb0('0x41')]=_[_0xafb0('0x3a')](_0xed1cd1['model'],_0xed1cd1[_0xafb0('0x36')]);_0x3bce5c[_0xafb0('0x39')]=_[_0xafb0('0x3a')](_0xed1cd1[_0xafb0('0x38')],qs[_0xafb0('0x3b')](_0x174d57[_0xafb0('0x36')]['fields']));_0x3bce5c[_0xafb0('0x39')]=_0x3bce5c['attributes'][_0xafb0('0x5b')]?_0x3bce5c[_0xafb0('0x39')]:_0xed1cd1[_0xafb0('0x38')];_0x3bce5c['order']=qs['sort'](_0x174d57[_0xafb0('0x36')]['sort']);_0x3bce5c[_0xafb0('0x40')]=qs['filters'](_[_0xafb0('0x42')](_0x174d57[_0xafb0('0x36')],_0xed1cd1[_0xafb0('0x41')]));if(_0x174d57[_0xafb0('0x36')][_0xafb0('0x43')]){_0x3bce5c[_0xafb0('0x40')]=_[_0xafb0('0x44')](_0x3bce5c[_0xafb0('0x40')],{'$or':_[_0xafb0('0x33')](_0x3bce5c[_0xafb0('0x39')],function(_0x242579){var _0x5dc760={};_0x5dc760[_0x242579]={'$like':'%'+_0x174d57[_0xafb0('0x36')][_0xafb0('0x43')]+'%'};return _0x5dc760;})});}_0x3bce5c=_[_0xafb0('0x44')]({},_0x3bce5c,_0x174d57[_0xafb0('0x47')]);return _0x46106c['getAgents'](_0x3bce5c);}})['then'](function(_0x3ebbff){if(_0x3ebbff){_0x2aff01=_0x3ebbff[_0xafb0('0x5b')];if(!_0x174d57['query'][_0xafb0('0x3c')](_0xafb0('0x3d'))){_0x3bce5c[_0xafb0('0x25')]=qs[_0xafb0('0x25')](_0x174d57[_0xafb0('0x36')][_0xafb0('0x25')]);_0x3bce5c[_0xafb0('0x23')]=qs[_0xafb0('0x23')](_0x174d57[_0xafb0('0x36')]['offset']);}return _0x46106c[_0xafb0('0x89')](_0x3bce5c);}})[_0xafb0('0x2c')](function(_0x23d632){if(_0x23d632){return _0x23d632?{'count':_0x2aff01,'rows':_0x23d632}:null;}})[_0xafb0('0x2c')](respondWithResult(_0x57d14b,null))[_0xafb0('0x4b')](handleError(_0x57d14b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 18dfd6b..59d3a44 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 _0x7b2b=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners','save'];(function(_0x221f94,_0x5b6586){var _0x5bf802=function(_0x5c1eae){while(--_0x5c1eae){_0x221f94['push'](_0x221f94['shift']());}};_0x5bf802(++_0x5b6586);}(_0x7b2b,0x101));var _0xb7b2=function(_0x39ab2e,_0x3ee6ee){_0x39ab2e=_0x39ab2e-0x0;var _0x53cab0=_0x7b2b[_0x39ab2e];return _0x53cab0;};'use strict';var EventEmitter=require(_0xb7b2('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb7b2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb7b2('0x2')](0x0);var events={'afterCreate':_0xb7b2('0x3'),'afterUpdate':'update','afterDestroy':_0xb7b2('0x4')};function emitEvent(_0x360083){return function(_0x33e57b,_0x563343,_0x2510df){WhatsappQueueEvents[_0xb7b2('0x5')](_0x360083+':'+_0x33e57b['id'],_0x33e57b);WhatsappQueueEvents[_0xb7b2('0x5')](_0x360083,_0x33e57b);_0x2510df(null);};}for(var e in events){if(events[_0xb7b2('0x6')](e)){var event=events[e];WhatsappQueue[_0xb7b2('0x7')](e,emitEvent(event));}}module[_0xb7b2('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x3661=['remove','emit','hook','events','setMaxListeners','save','update'];(function(_0x106c38,_0x1639d1){var _0xff450c=function(_0x563890){while(--_0x563890){_0x106c38['push'](_0x106c38['shift']());}};_0xff450c(++_0x1639d1);}(_0x3661,0x73));var _0x1366=function(_0x55bd04,_0x39e958){_0x55bd04=_0x55bd04-0x0;var _0x16b768=_0x3661[_0x55bd04];return _0x16b768;};'use strict';var EventEmitter=require(_0x1366('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1366('0x1')](0x0);var events={'afterCreate':_0x1366('0x2'),'afterUpdate':_0x1366('0x3'),'afterDestroy':_0x1366('0x4')};function emitEvent(_0x4af0cd){return function(_0x531313,_0x1be7b1,_0x3cb3dd){WhatsappQueueEvents[_0x1366('0x5')](_0x4af0cd+':'+_0x531313['id'],_0x531313);WhatsappQueueEvents[_0x1366('0x5')](_0x4af0cd,_0x531313);_0x3cb3dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x1366('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a6fde99..554ef95 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 _0x8b7b=['../../config/logger','api','moment','request-promise','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x279e9c,_0x45dfe4){var _0x2c6e72=function(_0xe05702){while(--_0xe05702){_0x279e9c['push'](_0x279e9c['shift']());}};_0x2c6e72(++_0x45dfe4);}(_0x8b7b,0x1c1));var _0xb8b7=function(_0x270b91,_0x4400d5){_0x270b91=_0x270b91-0x0;var _0x5a4097=_0x8b7b[_0x270b91];return _0x5a4097;};'use strict';var _=require(_0xb8b7('0x0'));var util=require(_0xb8b7('0x1'));var logger=require(_0xb8b7('0x2'))(_0xb8b7('0x3'));var moment=require(_0xb8b7('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb8b7('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xb8b7('0x7')]=function(_0x4631b4,_0x128e24){return _0x4631b4[_0xb8b7('0x8')](_0xb8b7('0x9'),attributes,{'tableName':_0xb8b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a30=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x54cd98,_0x3029e6){var _0x4abd09=function(_0x10e689){while(--_0x10e689){_0x54cd98['push'](_0x54cd98['shift']());}};_0x4abd09(++_0x3029e6);}(_0x2a30,0x151));var _0x02a3=function(_0x356a34,_0x2dabd1){_0x356a34=_0x356a34-0x0;var _0x370d6f=_0x2a30[_0x356a34];return _0x370d6f;};'use strict';var _=require(_0x02a3('0x0'));var util=require(_0x02a3('0x1'));var logger=require(_0x02a3('0x2'))(_0x02a3('0x3'));var moment=require(_0x02a3('0x4'));var BPromise=require(_0x02a3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02a3('0x6'));var rimraf=require(_0x02a3('0x7'));var config=require(_0x02a3('0x8'));var attributes=require(_0x02a3('0x9'));module[_0x02a3('0xa')]=function(_0x3b1015,_0x4e7100){return _0x3b1015['define'](_0x02a3('0xb'),attributes,{'tableName':_0x02a3('0xc'),'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 96037ca..29f4629 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 _0xa245=['../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','map','model','find','raw','where','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x24e8db,_0x89fc47){var _0x576cc1=function(_0x58f214){while(--_0x58f214){_0x24e8db['push'](_0x24e8db['shift']());}};_0x576cc1(++_0x89fc47);}(_0xa245,0x11e));var _0x5a24=function(_0x383e32,_0x28bfd6){_0x383e32=_0x383e32-0x0;var _0x4c4cbb=_0xa245[_0x383e32];return _0x4c4cbb;};'use strict';var _=require(_0x5a24('0x0'));var util=require(_0x5a24('0x1'));var moment=require(_0x5a24('0x2'));var BPromise=require(_0x5a24('0x3'));var rs=require(_0x5a24('0x4'));var fs=require('fs');var Redis=require(_0x5a24('0x5'));var db=require(_0x5a24('0x6'))['db'];var utils=require(_0x5a24('0x7'));var logger=require(_0x5a24('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5a24('0x9')][_0x5a24('0xa')]({'port':0x232a});config[_0x5a24('0xb')]=_[_0x5a24('0xc')](config[_0x5a24('0xb')],{'host':_0x5a24('0xd'),'port':0x18eb});var socket=require(_0x5a24('0xe'))(new Redis(config[_0x5a24('0xb')]));require(_0x5a24('0xf'))['register'](socket);function respondWithRpcPromise(_0x509028,_0x338778,_0x4cd357){return new BPromise(function(_0x5e0869,_0xec5821){return client[_0x5a24('0x10')](_0x509028,_0x4cd357)[_0x5a24('0x11')](function(_0xee8428){logger[_0x5a24('0x12')](_0x5a24('0x13'),_0x338778,'request\x20sent');logger[_0x5a24('0x14')](_0x5a24('0x15'),_0x338778,_0x5a24('0x16'),JSON[_0x5a24('0x17')](_0xee8428));if(_0xee8428[_0x5a24('0x18')]){if(_0xee8428[_0x5a24('0x18')][_0x5a24('0x19')]===0x1f4){logger[_0x5a24('0x18')](_0x5a24('0x13'),_0x338778,_0xee8428[_0x5a24('0x18')]['message']);return _0xec5821(_0xee8428[_0x5a24('0x18')][_0x5a24('0x1a')]);}logger[_0x5a24('0x18')](_0x5a24('0x13'),_0x338778,_0xee8428[_0x5a24('0x18')][_0x5a24('0x1a')]);return _0x5e0869(_0xee8428[_0x5a24('0x18')]['message']);}else{logger[_0x5a24('0x12')](_0x5a24('0x13'),_0x338778,_0x5a24('0x16'));_0x5e0869(_0xee8428[_0x5a24('0x1b')][_0x5a24('0x1a')]);}})[_0x5a24('0x1c')](function(_0x40cc7c){logger[_0x5a24('0x18')](_0x5a24('0x13'),_0x338778,_0x40cc7c);_0xec5821(_0x40cc7c);});});}exports[_0x5a24('0x1d')]=function(_0x14e4c5){var _0x392049=this;return new Promise(function(_0x324fbc,_0x43bd7c){return db[_0x5a24('0x1e')][_0x5a24('0x1f')]({'raw':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5['options']['raw']===undefined?!![]:![]:!![],'where':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')]['where']||null:null,'attributes':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')][_0x5a24('0x21')]||null:null,'limit':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')][_0x5a24('0x22')]||null:null,'include':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')][_0x5a24('0x23')]?_[_0x5a24('0x24')](_0x14e4c5[_0x5a24('0x20')]['include'],function(_0x20bfbc){return{'model':db[_0x20bfbc[_0x5a24('0x25')]],'as':_0x20bfbc['as'],'attributes':_0x20bfbc[_0x5a24('0x21')],'include':_0x20bfbc['include']?_[_0x5a24('0x24')](_0x20bfbc[_0x5a24('0x23')],function(_0x453036){return{'model':db[_0x453036[_0x5a24('0x25')]],'as':_0x453036['as'],'attributes':_0x453036[_0x5a24('0x21')],'include':_0x453036['include']?_[_0x5a24('0x24')](_0x453036[_0x5a24('0x23')],function(_0x5cca2b){return{'model':db[_0x5cca2b[_0x5a24('0x25')]],'as':_0x5cca2b['as'],'attributes':_0x5cca2b[_0x5a24('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5a24('0x11')](function(_0x5e81b7){logger[_0x5a24('0x12')]('GetWhatsappQueue',_0x14e4c5);logger[_0x5a24('0x14')](_0x5a24('0x1d'),_0x14e4c5,JSON['stringify'](_0x5e81b7));_0x324fbc(_0x5e81b7);})[_0x5a24('0x1c')](function(_0x41a98e){logger['error']('GetWhatsappQueue',_0x41a98e[_0x5a24('0x1a')],_0x14e4c5);_0x43bd7c(_0x392049[_0x5a24('0x18')](0x1f4,_0x41a98e[_0x5a24('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x144b4f){var _0x25bbb2=this;return new Promise(function(_0x3c3e33,_0x475583){return db[_0x5a24('0x1e')][_0x5a24('0x26')]({'raw':_0x144b4f['options']?_0x144b4f[_0x5a24('0x20')][_0x5a24('0x27')]===undefined?!![]:![]:!![],'where':_0x144b4f[_0x5a24('0x20')]?_0x144b4f[_0x5a24('0x20')][_0x5a24('0x28')]||null:null,'attributes':_0x144b4f[_0x5a24('0x20')]?_0x144b4f[_0x5a24('0x20')][_0x5a24('0x21')]||null:null,'include':_0x144b4f[_0x5a24('0x20')]?_0x144b4f['options'][_0x5a24('0x23')]?_[_0x5a24('0x24')](_0x144b4f[_0x5a24('0x20')][_0x5a24('0x23')],function(_0x4d764a){return{'model':db[_0x4d764a[_0x5a24('0x25')]],'as':_0x4d764a['as'],'attributes':_0x4d764a[_0x5a24('0x21')],'include':_0x4d764a[_0x5a24('0x23')]?_[_0x5a24('0x24')](_0x4d764a['include'],function(_0x3949c0){return{'model':db[_0x3949c0[_0x5a24('0x25')]],'as':_0x3949c0['as'],'attributes':_0x3949c0[_0x5a24('0x21')],'include':_0x3949c0['include']?_[_0x5a24('0x24')](_0x3949c0[_0x5a24('0x23')],function(_0x75475c){return{'model':db[_0x75475c[_0x5a24('0x25')]],'as':_0x75475c['as'],'attributes':_0x75475c[_0x5a24('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5a24('0x11')](function(_0x20c2fc){logger['info'](_0x5a24('0x29'),_0x144b4f);logger[_0x5a24('0x14')](_0x5a24('0x29'),_0x144b4f,JSON[_0x5a24('0x17')](_0x20c2fc));_0x3c3e33(_0x20c2fc);})[_0x5a24('0x1c')](function(_0x3cc040){logger['error'](_0x5a24('0x29'),_0x3cc040[_0x5a24('0x1a')],_0x144b4f);_0x475583(_0x25bbb2[_0x5a24('0x18')](0x1f4,_0x3cc040[_0x5a24('0x1a')]));});});}; \ No newline at end of file +var _0xc7ce=['result','catch','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message'];(function(_0x577a0a,_0x13548d){var _0x48ed6e=function(_0x14de2a){while(--_0x14de2a){_0x577a0a['push'](_0x577a0a['shift']());}};_0x48ed6e(++_0x13548d);}(_0xc7ce,0x1b0));var _0xec7c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc7ce[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xec7c('0x0'));var util=require(_0xec7c('0x1'));var moment=require(_0xec7c('0x2'));var BPromise=require(_0xec7c('0x3'));var rs=require(_0xec7c('0x4'));var fs=require('fs');var Redis=require(_0xec7c('0x5'));var db=require(_0xec7c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xec7c('0x7'))(_0xec7c('0x8'));var config=require('../../config/environment');var jayson=require(_0xec7c('0x9'));var client=jayson['client'][_0xec7c('0xa')]({'port':0x232a});config[_0xec7c('0xb')]=_[_0xec7c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec7c('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xec7c('0xe')](socket);function respondWithRpcPromise(_0xe54de2,_0x68264c,_0x56c762){return new BPromise(function(_0xf6fb3f,_0x4eb31b){return client['request'](_0xe54de2,_0x56c762)[_0xec7c('0xf')](function(_0x361429){logger[_0xec7c('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x68264c,'request\x20sent');logger['debug'](_0xec7c('0x11'),_0x68264c,_0xec7c('0x12'),JSON[_0xec7c('0x13')](_0x361429));if(_0x361429[_0xec7c('0x14')]){if(_0x361429[_0xec7c('0x14')][_0xec7c('0x15')]===0x1f4){logger[_0xec7c('0x14')](_0xec7c('0x16'),_0x68264c,_0x361429[_0xec7c('0x14')][_0xec7c('0x17')]);return _0x4eb31b(_0x361429[_0xec7c('0x14')][_0xec7c('0x17')]);}logger[_0xec7c('0x14')](_0xec7c('0x16'),_0x68264c,_0x361429[_0xec7c('0x14')][_0xec7c('0x17')]);return _0xf6fb3f(_0x361429[_0xec7c('0x14')][_0xec7c('0x17')]);}else{logger['info'](_0xec7c('0x16'),_0x68264c,'request\x20sent');_0xf6fb3f(_0x361429[_0xec7c('0x18')][_0xec7c('0x17')]);}})[_0xec7c('0x19')](function(_0x445125){logger[_0xec7c('0x14')](_0xec7c('0x16'),_0x68264c,_0x445125);_0x4eb31b(_0x445125);});});}exports[_0xec7c('0x1a')]=function(_0x5f2534){var _0x295a8a=this;return new Promise(function(_0x4fa114,_0x10a7c9){return db[_0xec7c('0x1b')]['findAll']({'raw':_0x5f2534[_0xec7c('0x1c')]?_0x5f2534[_0xec7c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5f2534['options']?_0x5f2534[_0xec7c('0x1c')][_0xec7c('0x1d')]||null:null,'attributes':_0x5f2534[_0xec7c('0x1c')]?_0x5f2534['options'][_0xec7c('0x1e')]||null:null,'limit':_0x5f2534[_0xec7c('0x1c')]?_0x5f2534[_0xec7c('0x1c')][_0xec7c('0x1f')]||null:null,'include':_0x5f2534[_0xec7c('0x1c')]?_0x5f2534[_0xec7c('0x1c')][_0xec7c('0x20')]?_[_0xec7c('0x21')](_0x5f2534['options']['include'],function(_0x4c8b39){return{'model':db[_0x4c8b39[_0xec7c('0x22')]],'as':_0x4c8b39['as'],'attributes':_0x4c8b39[_0xec7c('0x1e')],'include':_0x4c8b39[_0xec7c('0x20')]?_[_0xec7c('0x21')](_0x4c8b39['include'],function(_0x163669){return{'model':db[_0x163669['model']],'as':_0x163669['as'],'attributes':_0x163669[_0xec7c('0x1e')],'include':_0x163669[_0xec7c('0x20')]?_[_0xec7c('0x21')](_0x163669[_0xec7c('0x20')],function(_0x23507b){return{'model':db[_0x23507b[_0xec7c('0x22')]],'as':_0x23507b['as'],'attributes':_0x23507b['attributes']};}):[]};}):[]};}):[]:[]})[_0xec7c('0xf')](function(_0x5490ee){logger[_0xec7c('0x10')](_0xec7c('0x1a'),_0x5f2534);logger['debug']('GetWhatsappQueue',_0x5f2534,JSON[_0xec7c('0x13')](_0x5490ee));_0x4fa114(_0x5490ee);})['catch'](function(_0x45092c){logger[_0xec7c('0x14')](_0xec7c('0x1a'),_0x45092c[_0xec7c('0x17')],_0x5f2534);_0x10a7c9(_0x295a8a[_0xec7c('0x14')](0x1f4,_0x45092c[_0xec7c('0x17')]));});});};exports[_0xec7c('0x23')]=function(_0x253ce9){var _0x565bf3=this;return new Promise(function(_0x3fd381,_0x63c805){return db[_0xec7c('0x1b')]['find']({'raw':_0x253ce9[_0xec7c('0x1c')]?_0x253ce9['options'][_0xec7c('0x24')]===undefined?!![]:![]:!![],'where':_0x253ce9[_0xec7c('0x1c')]?_0x253ce9[_0xec7c('0x1c')][_0xec7c('0x1d')]||null:null,'attributes':_0x253ce9[_0xec7c('0x1c')]?_0x253ce9[_0xec7c('0x1c')]['attributes']||null:null,'include':_0x253ce9[_0xec7c('0x1c')]?_0x253ce9[_0xec7c('0x1c')][_0xec7c('0x20')]?_['map'](_0x253ce9[_0xec7c('0x1c')]['include'],function(_0x2f9204){return{'model':db[_0x2f9204['model']],'as':_0x2f9204['as'],'attributes':_0x2f9204[_0xec7c('0x1e')],'include':_0x2f9204['include']?_['map'](_0x2f9204[_0xec7c('0x20')],function(_0x52fe5f){return{'model':db[_0x52fe5f[_0xec7c('0x22')]],'as':_0x52fe5f['as'],'attributes':_0x52fe5f[_0xec7c('0x1e')],'include':_0x52fe5f[_0xec7c('0x20')]?_[_0xec7c('0x21')](_0x52fe5f[_0xec7c('0x20')],function(_0x1c738b){return{'model':db[_0x1c738b[_0xec7c('0x22')]],'as':_0x1c738b['as'],'attributes':_0x1c738b[_0xec7c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xec7c('0xf')](function(_0x41ed28){logger[_0xec7c('0x10')](_0xec7c('0x23'),_0x253ce9);logger[_0xec7c('0x25')](_0xec7c('0x23'),_0x253ce9,JSON[_0xec7c('0x13')](_0x41ed28));_0x3fd381(_0x41ed28);})[_0xec7c('0x19')](function(_0x531dac){logger[_0xec7c('0x14')]('ShowWhatsappQueue',_0x531dac[_0xec7c('0x17')],_0x253ce9);_0x63c805(_0x565bf3[_0xec7c('0x14')](0x1f4,_0x531dac[_0xec7c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c89dfdc..97d224a 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 _0x64bb=['removeListener','length','./whatsappQueue.events','save','remove','update','emit'];(function(_0x4c2114,_0x57e809){var _0x1d7c44=function(_0x57cba9){while(--_0x57cba9){_0x4c2114['push'](_0x4c2114['shift']());}};_0x1d7c44(++_0x57e809);}(_0x64bb,0x105));var _0xb64b=function(_0x19c516,_0x211cc3){_0x19c516=_0x19c516-0x0;var _0x1bc9f9=_0x64bb[_0x19c516];return _0x1bc9f9;};'use strict';var WhatsappQueueEvents=require(_0xb64b('0x0'));var events=[_0xb64b('0x1'),_0xb64b('0x2'),_0xb64b('0x3')];function createListener(_0x4df529,_0x47bea2){return function(_0x458c5d){_0x47bea2[_0xb64b('0x4')](_0x4df529,_0x458c5d);};}function removeListener(_0x3d2726,_0x5275e0){return function(){WhatsappQueueEvents[_0xb64b('0x5')](_0x3d2726,_0x5275e0);};}exports['register']=function(_0x10b82e){for(var _0x21ea9f=0x0,_0x20a16a=events[_0xb64b('0x6')];_0x21ea9f<_0x20a16a;_0x21ea9f++){var _0x3563fd=events[_0x21ea9f];var _0x18ee2=createListener('whatsappQueue:'+_0x3563fd,_0x10b82e);WhatsappQueueEvents['on'](_0x3563fd,_0x18ee2);}}; \ No newline at end of file +var _0x9d33=['length','remove','update','removeListener','register'];(function(_0x1b6aab,_0x5683f0){var _0x181f68=function(_0x127b26){while(--_0x127b26){_0x1b6aab['push'](_0x1b6aab['shift']());}};_0x181f68(++_0x5683f0);}(_0x9d33,0xc4));var _0x39d3=function(_0x2998e7,_0x2fb441){_0x2998e7=_0x2998e7-0x0;var _0x30f7e3=_0x9d33[_0x2998e7];return _0x30f7e3;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x39d3('0x0'),_0x39d3('0x1')];function createListener(_0x48cbbd,_0x4e864c){return function(_0x5c211c){_0x4e864c['emit'](_0x48cbbd,_0x5c211c);};}function removeListener(_0x328d8d,_0x467c61){return function(){WhatsappQueueEvents[_0x39d3('0x2')](_0x328d8d,_0x467c61);};}exports[_0x39d3('0x3')]=function(_0x49780b){for(var _0x334770=0x0,_0x58d3fb=events[_0x39d3('0x4')];_0x334770<_0x58d3fb;_0x334770++){var _0x29e64b=events[_0x334770];var _0x275670=createListener('whatsappQueue:'+_0x29e64b,_0x49780b);WhatsappQueueEvents['on'](_0x29e64b,_0x275670);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d1dd587..de0e7dc 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 _0x8c45=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8c45,0x1f3));var _0x58c4=function(_0x3fcd1d,_0x4a1e22){_0x3fcd1d=_0x3fcd1d-0x0;var _0x15ced2=_0x8c45[_0x3fcd1d];return _0x15ced2;};'use strict';var multer=require(_0x58c4('0x0'));var util=require(_0x58c4('0x1'));var path=require('path');var timeout=require(_0x58c4('0x2'));var express=require('express');var router=express[_0x58c4('0x3')]();var fs_extra=require(_0x58c4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x58c4('0x5'));var config=require('../../config/environment');var controller=require(_0x58c4('0x6'));router[_0x58c4('0x7')]('/',auth[_0x58c4('0x8')](),controller[_0x58c4('0x9')]);router['get']('/describe',auth[_0x58c4('0x8')](),controller['describe']);router[_0x58c4('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x58c4('0x8')](),controller[_0x58c4('0xa')]);router[_0x58c4('0xb')](_0x58c4('0xc'),auth[_0x58c4('0x8')](),controller[_0x58c4('0xd')]);router[_0x58c4('0xe')]('/:id',auth[_0x58c4('0x8')](),controller[_0x58c4('0xf')]);module[_0x58c4('0x10')]=router; \ No newline at end of file +var _0x8481=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0x8481,0x6c));var _0x1848=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x8481[_0x351b46];return _0x1515df;};'use strict';var multer=require('multer');var util=require(_0x1848('0x0'));var path=require(_0x1848('0x1'));var timeout=require(_0x1848('0x2'));var express=require(_0x1848('0x3'));var router=express[_0x1848('0x4')]();var fs_extra=require(_0x1848('0x5'));var auth=require(_0x1848('0x6'));var interaction=require(_0x1848('0x7'));var config=require(_0x1848('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x1848('0x9')]('/',auth[_0x1848('0xa')](),controller[_0x1848('0xb')]);router[_0x1848('0x9')]('/describe',auth[_0x1848('0xa')](),controller[_0x1848('0xc')]);router[_0x1848('0x9')](_0x1848('0xd'),auth['isAuthenticated'](),controller[_0x1848('0xe')]);router[_0x1848('0xf')]('/',auth['isAuthenticated'](),controller[_0x1848('0x10')]);router[_0x1848('0x11')](_0x1848('0xd'),auth['isAuthenticated'](),controller[_0x1848('0x12')]);router[_0x1848('0x13')](_0x1848('0xd'),auth['isAuthenticated'](),controller[_0x1848('0x14')]);module[_0x1848('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 4979ae3..031934e 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x142c7a,_0x26e73c){var _0x3a81eb=function(_0x1fccaf){while(--_0x1fccaf){_0x142c7a['push'](_0x142c7a['shift']());}};_0x3a81eb(++_0x26e73c);}(_0x7a54,0x106));var _0x47a5=function(_0x445d62,_0x26d074){_0x445d62=_0x445d62-0x0;var _0x328ddf=_0x7a54[_0x445d62];return _0x328ddf;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2f38d9,_0x2d2461){var _0x1c2541=function(_0x40e2d2){while(--_0x40e2d2){_0x2f38d9['push'](_0x2f38d9['shift']());}};_0x1c2541(++_0x2d2461);}(_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 3e6bd52..828f459 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 _0x1eba=['name','send','WhatsappQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error'];(function(_0x37d239,_0x9890dc){var _0x219891=function(_0xff7ebb){while(--_0xff7ebb){_0x37d239['push'](_0x37d239['shift']());}};_0x219891(++_0x9890dc);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x1eba[_0x220dbb];return _0x2b77de;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=typeof _0x44f37d[_0xa1eb('0x1c')]==='undefined'&&typeof _0x44f37d[_0xa1eb('0x1d')]==='undefined';var _0x1401ef=_0x1c858c[_0xa1eb('0x1e')];var _0x33c4e3=_0x45d6dd?0x0:_0x44f37d[_0xa1eb('0x1c')];var _0x49bfaa=_0x45d6dd?_0x1c858c[_0xa1eb('0x1e')]:_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')];var _0xcf45c1;if(_0x49bfaa>=_0x1401ef){_0x49bfaa=_0x1401ef;_0xcf45c1=0xc8;}else{_0xcf45c1=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xcf45c1);return _0x3cd675[_0xa1eb('0x1f')](_0xa1eb('0x20'),_0x33c4e3+'-'+_0x49bfaa+'/'+_0x1401ef)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x4fc14a){return function(_0x137e2c){try{jsonpatch['apply'](_0x137e2c,_0x4fc14a,!![]);}catch(_0x2258d1){return BPromise[_0xa1eb('0x21')](_0x2258d1);}return _0x137e2c[_0xa1eb('0x22')]();};}function saveUpdates(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x23')](_0x250f99)[_0xa1eb('0x24')](function(_0x5b0903){return _0x5b0903;});}return null;};}function removeEntity(_0x437b2a,_0x250728){return function(_0x258d3a){if(_0x258d3a){return _0x258d3a[_0xa1eb('0x25')]()[_0xa1eb('0x24')](function(){_0x437b2a[_0xa1eb('0x1a')](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x364b1c,_0xd7bb88){return function(_0x352796){if(!_0x352796){_0x364b1c[_0xa1eb('0x26')](0x194);}return _0x352796;};}function handleError(_0x208844,_0x57d089){_0x57d089=_0x57d089||0x1f4;return function(_0x7c617e){logger[_0xa1eb('0x27')](_0x7c617e['stack']);if(_0x7c617e[_0xa1eb('0x28')]){delete _0x7c617e['name'];}_0x208844[_0xa1eb('0x1a')](_0x57d089)[_0xa1eb('0x29')](_0x7c617e);};}exports['index']=function(_0x45ff0d,_0x1581ee){var _0x136835={},_0x4f64bb={},_0x12cf56={'count':0x0,'rows':[]};var _0x41b3ad=_['map'](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')],function(_0x401510){return{'name':_0x401510[_0xa1eb('0x2c')],'type':_0x401510[_0xa1eb('0x2d')]['key']};});_0x4f64bb[_0xa1eb('0x2e')]=_[_0xa1eb('0x2f')](_0x41b3ad,_0xa1eb('0x28'));_0x4f64bb[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x45ff0d[_0xa1eb('0x30')]);_0x4f64bb[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x4f64bb[_0xa1eb('0x2e')],_0x4f64bb[_0xa1eb('0x30')]);_0x136835[_0xa1eb('0x34')]=_['intersection'](_0x4f64bb['model'],qs[_0xa1eb('0x35')](_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x35')]));_0x136835[_0xa1eb('0x34')]=_0x136835[_0xa1eb('0x34')]['length']?_0x136835['attributes']:_0x4f64bb[_0xa1eb('0x2e')];if(!_0x45ff0d[_0xa1eb('0x30')]['hasOwnProperty']('nolimit')){_0x136835[_0xa1eb('0x1d')]=qs['limit'](_0x45ff0d[_0xa1eb('0x30')]['limit']);_0x136835[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x45ff0d[_0xa1eb('0x30')]['offset']);}_0x136835[_0xa1eb('0x36')]=qs[_0xa1eb('0x37')](_0x45ff0d[_0xa1eb('0x30')]['sort']);_0x136835[_0xa1eb('0x38')]=qs[_0xa1eb('0x32')](_[_0xa1eb('0x39')](_0x45ff0d[_0xa1eb('0x30')],_0x4f64bb[_0xa1eb('0x32')]),_0x41b3ad);if(_0x45ff0d['query'][_0xa1eb('0x3a')]){_0x136835[_0xa1eb('0x38')]=_[_0xa1eb('0x3b')](_0x136835[_0xa1eb('0x38')],{'$or':_[_0xa1eb('0x2f')](_0x41b3ad,function(_0x2af1d1){if(_0x2af1d1[_0xa1eb('0x2d')]!==_0xa1eb('0x3c')){var _0x53f251={};_0x53f251[_0x2af1d1[_0xa1eb('0x28')]]={'$like':'%'+_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3a')]+'%'};return _0x53f251;}})});}_0x136835=_[_0xa1eb('0x3b')]({},_0x136835,_0x45ff0d[_0xa1eb('0x3d')]);var _0x5bf994={'where':_0x136835[_0xa1eb('0x38')]};return db[_0xa1eb('0x2a')][_0xa1eb('0x1e')](_0x5bf994)['then'](function(_0x334849){_0x12cf56[_0xa1eb('0x1e')]=_0x334849;if(_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x136835[_0xa1eb('0x3f')]=[{'all':!![]}];}return db[_0xa1eb('0x2a')][_0xa1eb('0x40')](_0x136835);})['then'](function(_0x3c8713){_0x12cf56[_0xa1eb('0x41')]=_0x3c8713;return _0x12cf56;})['then'](respondWithFilteredResult(_0x1581ee,_0x136835))[_0xa1eb('0x42')](handleError(_0x1581ee,null));};exports['show']=function(_0x1744e4,_0x3a6f36){var _0x75f7f6={'raw':!![],'where':{'id':_0x1744e4[_0xa1eb('0x43')]['id']}},_0x361675={};_0x361675[_0xa1eb('0x2e')]=_[_0xa1eb('0x31')](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')]);_0x361675[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x1744e4[_0xa1eb('0x30')]);_0x361675[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x361675[_0xa1eb('0x2e')],_0x361675[_0xa1eb('0x30')]);_0x75f7f6['attributes']=_[_0xa1eb('0x33')](_0x361675['model'],qs[_0xa1eb('0x35')](_0x1744e4[_0xa1eb('0x30')]['fields']));_0x75f7f6['attributes']=_0x75f7f6[_0xa1eb('0x34')][_0xa1eb('0x44')]?_0x75f7f6[_0xa1eb('0x34')]:_0x361675['model'];if(_0x1744e4[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x75f7f6[_0xa1eb('0x3f')]=[{'all':!![]}];}_0x75f7f6=_[_0xa1eb('0x3b')]({},_0x75f7f6,_0x1744e4[_0xa1eb('0x3d')]);return db[_0xa1eb('0x2a')][_0xa1eb('0x45')](_0x75f7f6)[_0xa1eb('0x24')](handleEntityNotFound(_0x3a6f36,null))[_0xa1eb('0x24')](respondWithResult(_0x3a6f36,null))[_0xa1eb('0x42')](handleError(_0x3a6f36,null));};exports[_0xa1eb('0x46')]=function(_0x393f95,_0x39d3c6){return db[_0xa1eb('0x2a')]['create'](_0x393f95[_0xa1eb('0x47')],{})[_0xa1eb('0x24')](respondWithResult(_0x39d3c6,0xc9))[_0xa1eb('0x42')](handleError(_0x39d3c6,null));};exports[_0xa1eb('0x23')]=function(_0x2b0cbf,_0x12dfd4){if(_0x2b0cbf[_0xa1eb('0x47')]['id']){delete _0x2b0cbf['body']['id'];}return db[_0xa1eb('0x2a')][_0xa1eb('0x45')]({'where':{'id':_0x2b0cbf[_0xa1eb('0x43')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x12dfd4,null))[_0xa1eb('0x24')](saveUpdates(_0x2b0cbf[_0xa1eb('0x47')],null))[_0xa1eb('0x24')](respondWithResult(_0x12dfd4,null))[_0xa1eb('0x42')](handleError(_0x12dfd4,null));};exports[_0xa1eb('0x25')]=function(_0x4f7c05,_0x190370){return db['WhatsappQueueReport'][_0xa1eb('0x45')]({'where':{'id':_0x4f7c05['params']['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x190370,null))[_0xa1eb('0x24')](removeEntity(_0x190370,null))[_0xa1eb('0x42')](handleError(_0x190370,null));};exports['describe']=function(_0x3fbd6c,_0xbd9a42){return db['WhatsappQueueReport'][_0xa1eb('0x48')]()[_0xa1eb('0x24')](respondWithResult(_0xbd9a42,null))[_0xa1eb('0x42')](handleError(_0xbd9a42,null));}; \ No newline at end of file +var _0xed3c=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','end','error','stack','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4a84f4,_0x424638){var _0x5ad6aa=function(_0x2ad9f6){while(--_0x2ad9f6){_0x4a84f4['push'](_0x4a84f4['shift']());}};_0x5ad6aa(++_0x424638);}(_0xed3c,0x1a6));var _0xced3=function(_0x48845d,_0x4338c2){_0x48845d=_0x48845d-0x0;var _0x5bad7d=_0xed3c[_0x48845d];return _0x5bad7d;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){_0x559fa2['status'](0xcc)[_0xced3('0x23')]();});}};}function handleEntityNotFound(_0x23f92b,_0x4fc285){return function(_0x3fb4f9){if(!_0x3fb4f9){_0x23f92b['sendStatus'](0x194);}return _0x3fb4f9;};}function handleError(_0x1dcc52,_0x4123ba){_0x4123ba=_0x4123ba||0x1f4;return function(_0x3b728d){logger[_0xced3('0x24')](_0x3b728d[_0xced3('0x25')]);if(_0x3b728d['name']){delete _0x3b728d['name'];}_0x1dcc52[_0xced3('0x17')](_0x4123ba)['send'](_0x3b728d);};}exports[_0xced3('0x26')]=function(_0x1e6923,_0x4a8e85){var _0x3db664={},_0x4024fa={},_0x196956={'count':0x0,'rows':[]};var _0x1032d6=_[_0xced3('0x27')](db[_0xced3('0x28')][_0xced3('0x29')],function(_0x41d003){return{'name':_0x41d003[_0xced3('0x2a')],'type':_0x41d003['type'][_0xced3('0x2b')]};});_0x4024fa[_0xced3('0x2c')]=_[_0xced3('0x27')](_0x1032d6,_0xced3('0x2d'));_0x4024fa[_0xced3('0x2e')]=_[_0xced3('0x2f')](_0x1e6923[_0xced3('0x2e')]);_0x4024fa[_0xced3('0x30')]=_[_0xced3('0x31')](_0x4024fa[_0xced3('0x2c')],_0x4024fa[_0xced3('0x2e')]);_0x3db664[_0xced3('0x32')]=_[_0xced3('0x31')](_0x4024fa[_0xced3('0x2c')],qs[_0xced3('0x33')](_0x1e6923[_0xced3('0x2e')][_0xced3('0x33')]));_0x3db664[_0xced3('0x32')]=_0x3db664[_0xced3('0x32')][_0xced3('0x34')]?_0x3db664[_0xced3('0x32')]:_0x4024fa['model'];if(!_0x1e6923[_0xced3('0x2e')]['hasOwnProperty'](_0xced3('0x35'))){_0x3db664[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0x1e6923[_0xced3('0x2e')][_0xced3('0x1a')]);_0x3db664[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x1e6923[_0xced3('0x2e')][_0xced3('0x1c')]);}_0x3db664[_0xced3('0x36')]=qs['sort'](_0x1e6923[_0xced3('0x2e')][_0xced3('0x37')]);_0x3db664['where']=qs[_0xced3('0x30')](_[_0xced3('0x38')](_0x1e6923[_0xced3('0x2e')],_0x4024fa['filters']),_0x1032d6);if(_0x1e6923['query'][_0xced3('0x39')]){_0x3db664['where']=_[_0xced3('0x3a')](_0x3db664[_0xced3('0x3b')],{'$or':_['map'](_0x1032d6,function(_0x180b65){if(_0x180b65[_0xced3('0x3c')]!==_0xced3('0x3d')){var _0x58b344={};_0x58b344[_0x180b65[_0xced3('0x2d')]]={'$like':'%'+_0x1e6923['query']['filter']+'%'};return _0x58b344;}})});}_0x3db664=_[_0xced3('0x3a')]({},_0x3db664,_0x1e6923[_0xced3('0x3e')]);var _0x217bff={'where':_0x3db664['where']};return db[_0xced3('0x28')][_0xced3('0x1b')](_0x217bff)[_0xced3('0x21')](function(_0x28626b){_0x196956[_0xced3('0x1b')]=_0x28626b;if(_0x1e6923[_0xced3('0x2e')][_0xced3('0x3f')]){_0x3db664[_0xced3('0x40')]=[{'all':!![]}];}return db[_0xced3('0x28')][_0xced3('0x41')](_0x3db664);})[_0xced3('0x21')](function(_0x38855f){_0x196956[_0xced3('0x42')]=_0x38855f;return _0x196956;})[_0xced3('0x21')](respondWithFilteredResult(_0x4a8e85,_0x3db664))[_0xced3('0x43')](handleError(_0x4a8e85,null));};exports['show']=function(_0x4279a3,_0x2ec0ad){var _0x44ff72={'raw':!![],'where':{'id':_0x4279a3[_0xced3('0x44')]['id']}},_0x1a6c1f={};_0x1a6c1f[_0xced3('0x2c')]=_[_0xced3('0x2f')](db[_0xced3('0x28')][_0xced3('0x29')]);_0x1a6c1f['query']=_[_0xced3('0x2f')](_0x4279a3['query']);_0x1a6c1f[_0xced3('0x30')]=_[_0xced3('0x31')](_0x1a6c1f[_0xced3('0x2c')],_0x1a6c1f['query']);_0x44ff72[_0xced3('0x32')]=_[_0xced3('0x31')](_0x1a6c1f[_0xced3('0x2c')],qs[_0xced3('0x33')](_0x4279a3['query'][_0xced3('0x33')]));_0x44ff72[_0xced3('0x32')]=_0x44ff72[_0xced3('0x32')][_0xced3('0x34')]?_0x44ff72[_0xced3('0x32')]:_0x1a6c1f['model'];if(_0x4279a3[_0xced3('0x2e')][_0xced3('0x3f')]){_0x44ff72[_0xced3('0x40')]=[{'all':!![]}];}_0x44ff72=_[_0xced3('0x3a')]({},_0x44ff72,_0x4279a3[_0xced3('0x3e')]);return db[_0xced3('0x28')][_0xced3('0x45')](_0x44ff72)['then'](handleEntityNotFound(_0x2ec0ad,null))[_0xced3('0x21')](respondWithResult(_0x2ec0ad,null))[_0xced3('0x43')](handleError(_0x2ec0ad,null));};exports['create']=function(_0x569c3d,_0x140df2){return db['WhatsappQueueReport'][_0xced3('0x46')](_0x569c3d[_0xced3('0x47')],{})[_0xced3('0x21')](respondWithResult(_0x140df2,0xc9))[_0xced3('0x43')](handleError(_0x140df2,null));};exports[_0xced3('0x20')]=function(_0x1b3396,_0x3700ed){if(_0x1b3396[_0xced3('0x47')]['id']){delete _0x1b3396[_0xced3('0x47')]['id'];}return db['WhatsappQueueReport'][_0xced3('0x45')]({'where':{'id':_0x1b3396[_0xced3('0x44')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3700ed,null))[_0xced3('0x21')](saveUpdates(_0x1b3396[_0xced3('0x47')],null))[_0xced3('0x21')](respondWithResult(_0x3700ed,null))['catch'](handleError(_0x3700ed,null));};exports[_0xced3('0x22')]=function(_0x629ecf,_0x74f70){return db[_0xced3('0x28')][_0xced3('0x45')]({'where':{'id':_0x629ecf[_0xced3('0x44')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x74f70,null))[_0xced3('0x21')](removeEntity(_0x74f70,null))[_0xced3('0x43')](handleError(_0x74f70,null));};exports[_0xced3('0x48')]=function(_0x257ff0,_0x3e2a19){return db['WhatsappQueueReport'][_0xced3('0x48')]()['then'](respondWithResult(_0x3e2a19,null))[_0xced3('0x43')](handleError(_0x3e2a19,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index bb44def..eb93f86 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 _0xef52=['api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x90a171,_0x1b4216){var _0x293595=function(_0x16538b){while(--_0x16538b){_0x90a171['push'](_0x90a171['shift']());}};_0x293595(++_0x1b4216);}(_0xef52,0xe9));var _0x2ef5=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0xef52[_0x512e72];return _0x143086;};'use strict';var _=require(_0x2ef5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ef5('0x1'));var moment=require(_0x2ef5('0x2'));var BPromise=require(_0x2ef5('0x3'));var rp=require(_0x2ef5('0x4'));var fs=require('fs');var path=require(_0x2ef5('0x5'));var rimraf=require('rimraf');var config=require(_0x2ef5('0x6'));var attributes=require(_0x2ef5('0x7'));module[_0x2ef5('0x8')]=function(_0x23e609,_0x1d5fe5){return _0x23e609[_0x2ef5('0x9')](_0x2ef5('0xa'),attributes,{'tableName':_0x2ef5('0xb'),'paranoid':![],'indexes':[{'name':_0x2ef5('0xc'),'fields':[_0x2ef5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xccff=['path','rimraf','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x21e79a,_0x5a7990){var _0x506c02=function(_0x566c95){while(--_0x566c95){_0x21e79a['push'](_0x21e79a['shift']());}};_0x506c02(++_0x5a7990);}(_0xccff,0x102));var _0xfccf=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xccff[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0xfccf('0x0'));var util=require(_0xfccf('0x1'));var logger=require(_0xfccf('0x2'))(_0xfccf('0x3'));var moment=require('moment');var BPromise=require(_0xfccf('0x4'));var rp=require(_0xfccf('0x5'));var fs=require('fs');var path=require(_0xfccf('0x6'));var rimraf=require(_0xfccf('0x7'));var config=require(_0xfccf('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x36ef4f,_0x42e963){return _0x36ef4f[_0xfccf('0x9')](_0xfccf('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xfccf('0xb'),'fields':[_0xfccf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 56ec3cf..68d8809 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 _0x03b5=['info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','debug','UpdateWhatsappQueueReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x57a352,_0xbd7532){var _0x5cd613=function(_0x2e51c4){while(--_0x2e51c4){_0x57a352['push'](_0x57a352['shift']());}};_0x5cd613(++_0xbd7532);}(_0x03b5,0x197));var _0x503b=function(_0x225d0c,_0x171fea){_0x225d0c=_0x225d0c-0x0;var _0x17a85c=_0x03b5[_0x225d0c];return _0x17a85c;};'use strict';var _=require('lodash');var util=require(_0x503b('0x0'));var moment=require(_0x503b('0x1'));var BPromise=require(_0x503b('0x2'));var rs=require(_0x503b('0x3'));var fs=require('fs');var Redis=require(_0x503b('0x4'));var db=require(_0x503b('0x5'))['db'];var utils=require(_0x503b('0x6'));var logger=require(_0x503b('0x7'))(_0x503b('0x8'));var config=require('../../config/environment');var jayson=require(_0x503b('0x9'));var client=jayson[_0x503b('0xa')][_0x503b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0164,_0x448545,_0x175195){return new BPromise(function(_0xf7aa9a,_0x2ebc1a){return client['request'](_0x4b0164,_0x175195)[_0x503b('0xc')](function(_0x5ae805){logger[_0x503b('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x448545,_0x503b('0xe'));logger['debug'](_0x503b('0xf'),_0x448545,_0x503b('0xe'),JSON[_0x503b('0x10')](_0x5ae805));if(_0x5ae805['error']){if(_0x5ae805['error'][_0x503b('0x11')]===0x1f4){logger[_0x503b('0x12')](_0x503b('0x13'),_0x448545,_0x5ae805['error']['message']);return _0x2ebc1a(_0x5ae805['error'][_0x503b('0x14')]);}logger[_0x503b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x448545,_0x5ae805[_0x503b('0x12')][_0x503b('0x14')]);return _0xf7aa9a(_0x5ae805[_0x503b('0x12')][_0x503b('0x14')]);}else{logger[_0x503b('0xd')](_0x503b('0x13'),_0x448545,_0x503b('0xe'));_0xf7aa9a(_0x5ae805[_0x503b('0x15')][_0x503b('0x14')]);}})[_0x503b('0x16')](function(_0x9f2737){logger[_0x503b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x448545,_0x9f2737);_0x2ebc1a(_0x9f2737);});});}exports[_0x503b('0x17')]=function(_0x340c0b){var _0x3c4ff3=this;return new Promise(function(_0x51675a,_0x54088d){return db[_0x503b('0x18')][_0x503b('0x19')](_0x340c0b['body'],{'raw':_0x340c0b[_0x503b('0x1a')]?_0x340c0b[_0x503b('0x1a')][_0x503b('0x1b')]===undefined?!![]:![]:!![]})[_0x503b('0xc')](function(_0x44e4b8){logger[_0x503b('0xd')](_0x503b('0x17'),_0x340c0b);logger[_0x503b('0x1c')](_0x503b('0x17'),_0x340c0b,JSON['stringify'](_0x44e4b8));_0x51675a(_0x44e4b8);})[_0x503b('0x16')](function(_0x373328){logger[_0x503b('0x12')](_0x503b('0x17'),_0x373328[_0x503b('0x14')],_0x340c0b);_0x54088d(_0x3c4ff3[_0x503b('0x12')](0x1f4,_0x373328['message']));});});};exports[_0x503b('0x1d')]=function(_0x3d33c7){var _0x4d9d7a=this;return new Promise(function(_0xf5d57d,_0x25c78e){return db[_0x503b('0x18')][_0x503b('0x1e')](_0x3d33c7[_0x503b('0x1f')],{'raw':_0x3d33c7[_0x503b('0x1a')]?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d33c7['options']?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x20')]||null:null,'attributes':_0x3d33c7[_0x503b('0x1a')]?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x21')]||null:null,'limit':_0x3d33c7[_0x503b('0x1a')]?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x22')]||null:null})[_0x503b('0xc')](function(_0x54e765){logger[_0x503b('0xd')](_0x503b('0x1d'),_0x3d33c7);logger[_0x503b('0x1c')](_0x503b('0x1d'),_0x3d33c7,JSON[_0x503b('0x10')](_0x54e765));_0xf5d57d(_0x54e765);})['catch'](function(_0x37a64a){logger[_0x503b('0x12')]('UpdateWhatsappQueueReport',_0x37a64a['message'],_0x3d33c7);_0x25c78e(_0x4d9d7a[_0x503b('0x12')](0x1f4,_0x37a64a[_0x503b('0x14')]));});});}; \ No newline at end of file +var _0x0666=['../../config/environment','jayson/promise','http','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateWhatsappQueueReport','create','body','options','then','catch','UpdateWhatsappQueueReport','update','raw','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x318bc6,_0xb2ccde){var _0x1c93f4=function(_0x41f672){while(--_0x41f672){_0x318bc6['push'](_0x318bc6['shift']());}};_0x1c93f4(++_0xb2ccde);}(_0x0666,0x178));var _0x6066=function(_0x3806e6,_0x2f55d1){_0x3806e6=_0x3806e6-0x0;var _0x43aea8=_0x0666[_0x3806e6];return _0x43aea8;};'use strict';var _=require(_0x6066('0x0'));var util=require('util');var moment=require(_0x6066('0x1'));var BPromise=require(_0x6066('0x2'));var rs=require(_0x6066('0x3'));var fs=require('fs');var Redis=require(_0x6066('0x4'));var db=require(_0x6066('0x5'))['db'];var utils=require(_0x6066('0x6'));var logger=require('../../config/logger')(_0x6066('0x7'));var config=require(_0x6066('0x8'));var jayson=require(_0x6066('0x9'));var client=jayson['client'][_0x6066('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a2741,_0xa2aabb,_0x886a29){return new BPromise(function(_0x388696,_0x2ac33c){return client['request'](_0x4a2741,_0x886a29)['then'](function(_0x1bea95){logger['info'](_0x6066('0xb'),_0xa2aabb,_0x6066('0xc'));logger[_0x6066('0xd')](_0x6066('0xe'),_0xa2aabb,_0x6066('0xc'),JSON[_0x6066('0xf')](_0x1bea95));if(_0x1bea95['error']){if(_0x1bea95[_0x6066('0x10')][_0x6066('0x11')]===0x1f4){logger[_0x6066('0x10')](_0x6066('0xb'),_0xa2aabb,_0x1bea95['error'][_0x6066('0x12')]);return _0x2ac33c(_0x1bea95[_0x6066('0x10')]['message']);}logger['error'](_0x6066('0xb'),_0xa2aabb,_0x1bea95[_0x6066('0x10')][_0x6066('0x12')]);return _0x388696(_0x1bea95[_0x6066('0x10')][_0x6066('0x12')]);}else{logger[_0x6066('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0xa2aabb,'request\x20sent');_0x388696(_0x1bea95[_0x6066('0x14')][_0x6066('0x12')]);}})['catch'](function(_0x4abbee){logger[_0x6066('0x10')](_0x6066('0xb'),_0xa2aabb,_0x4abbee);_0x2ac33c(_0x4abbee);});});}exports[_0x6066('0x15')]=function(_0x480e81){var _0x50d07a=this;return new Promise(function(_0x375a78,_0x169a3b){return db['WhatsappQueueReport'][_0x6066('0x16')](_0x480e81[_0x6066('0x17')],{'raw':_0x480e81['options']?_0x480e81[_0x6066('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6066('0x19')](function(_0x2c99db){logger[_0x6066('0x13')](_0x6066('0x15'),_0x480e81);logger[_0x6066('0xd')](_0x6066('0x15'),_0x480e81,JSON['stringify'](_0x2c99db));_0x375a78(_0x2c99db);})[_0x6066('0x1a')](function(_0x2db54a){logger[_0x6066('0x10')](_0x6066('0x15'),_0x2db54a['message'],_0x480e81);_0x169a3b(_0x50d07a[_0x6066('0x10')](0x1f4,_0x2db54a['message']));});});};exports[_0x6066('0x1b')]=function(_0x106212){var _0xc16944=this;return new Promise(function(_0x48632a,_0x35a689){return db['WhatsappQueueReport'][_0x6066('0x1c')](_0x106212[_0x6066('0x17')],{'raw':_0x106212[_0x6066('0x18')]?_0x106212['options'][_0x6066('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106212[_0x6066('0x18')]?_0x106212[_0x6066('0x18')]['where']||null:null,'attributes':_0x106212[_0x6066('0x18')]?_0x106212[_0x6066('0x18')][_0x6066('0x1e')]||null:null,'limit':_0x106212['options']?_0x106212[_0x6066('0x18')][_0x6066('0x1f')]||null:null})[_0x6066('0x19')](function(_0x2abe56){logger[_0x6066('0x13')]('UpdateWhatsappQueueReport',_0x106212);logger[_0x6066('0xd')](_0x6066('0x1b'),_0x106212,JSON[_0x6066('0xf')](_0x2abe56));_0x48632a(_0x2abe56);})[_0x6066('0x1a')](function(_0x4a5eb4){logger[_0x6066('0x10')]('UpdateWhatsappQueueReport',_0x4a5eb4[_0x6066('0x12')],_0x106212);_0x35a689(_0xc16944[_0x6066('0x10')](0x1f4,_0x4a5eb4[_0x6066('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index cfe776a..c30a7dc 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 _0xf1a7=['index','/describe','describe','get','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xf1a7,0x1c1));var _0x7f1a=function(_0x440bce,_0x38a205){_0x440bce=_0x440bce-0x0;var _0x465166=_0xf1a7[_0x440bce];return _0x465166;};'use strict';var multer=require('multer');var util=require(_0x7f1a('0x0'));var path=require('path');var timeout=require(_0x7f1a('0x1'));var express=require(_0x7f1a('0x2'));var router=express['Router']();var fs_extra=require(_0x7f1a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7f1a('0x4'));var config=require('../../config/environment');var controller=require(_0x7f1a('0x5'));router['get']('/',auth[_0x7f1a('0x6')](),controller[_0x7f1a('0x7')]);router['get'](_0x7f1a('0x8'),auth['isAuthenticated'](),controller[_0x7f1a('0x9')]);router[_0x7f1a('0xa')](_0x7f1a('0xb'),auth['isAuthenticated'](),controller[_0x7f1a('0xc')]);router[_0x7f1a('0xd')]('/',auth[_0x7f1a('0x6')](),controller['create']);router[_0x7f1a('0xe')](_0x7f1a('0xb'),auth[_0x7f1a('0x6')](),controller[_0x7f1a('0xf')]);router[_0x7f1a('0x10')](_0x7f1a('0xb'),auth['isAuthenticated'](),controller[_0x7f1a('0x11')]);module[_0x7f1a('0x12')]=router; \ No newline at end of file +var _0x61c4=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','exports','util'];(function(_0x2928e4,_0x4e8c34){var _0x2954a0=function(_0x3931cc){while(--_0x3931cc){_0x2928e4['push'](_0x2928e4['shift']());}};_0x2954a0(++_0x4e8c34);}(_0x61c4,0x1cf));var _0x461c=function(_0x4bfb89,_0x3632c4){_0x4bfb89=_0x4bfb89-0x0;var _0x35ac61=_0x61c4[_0x4bfb89];return _0x35ac61;};'use strict';var multer=require('multer');var util=require(_0x461c('0x0'));var path=require('path');var timeout=require(_0x461c('0x1'));var express=require(_0x461c('0x2'));var router=express['Router']();var fs_extra=require(_0x461c('0x3'));var auth=require(_0x461c('0x4'));var interaction=require(_0x461c('0x5'));var config=require('../../config/environment');var controller=require(_0x461c('0x6'));router[_0x461c('0x7')]('/',auth['isAuthenticated'](),controller[_0x461c('0x8')]);router[_0x461c('0x7')]('/describe',auth[_0x461c('0x9')](),controller[_0x461c('0xa')]);router['get'](_0x461c('0xb'),auth['isAuthenticated'](),controller[_0x461c('0xc')]);router[_0x461c('0xd')]('/',auth[_0x461c('0x9')](),controller[_0x461c('0xe')]);router['put'](_0x461c('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x461c('0xb'),auth[_0x461c('0x9')](),controller['destroy']);module[_0x461c('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fcdd79e..cd335f3 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 _0xa664=['queue','exports','STRING','ENUM','account'];(function(_0x2a9687,_0x3ac0e5){var _0xec5f71=function(_0x12301b){while(--_0x12301b){_0x2a9687['push'](_0x2a9687['shift']());}};_0xec5f71(++_0x3ac0e5);}(_0xa664,0x132));var _0x4a66=function(_0x98bc07,_0x310949){_0x98bc07=_0x98bc07-0x0;var _0xa15c02=_0xa664[_0x98bc07];return _0xa15c02;};'use strict';var Sequelize=require('sequelize');module[_0x4a66('0x0')]={'uniqueid':{'type':Sequelize[_0x4a66('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4a66('0x2')](_0x4a66('0x3'),'agent',_0x4a66('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x1eba=['ENUM','account','DATE','sequelize','exports','STRING'];(function(_0x49ce7b,_0xcd96f7){var _0x33ce93=function(_0x53f825){while(--_0x53f825){_0x49ce7b['push'](_0x49ce7b['shift']());}};_0x33ce93(++_0xcd96f7);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x1eba[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'uniqueid':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa1eb('0x3')](_0xa1eb('0x4'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa1eb('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3d782cd..3dc23c7 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 _0x5e11=['json','offset','limit','undefined','count','set','Content-Range','reject','then','error','stack','name','index','WhatsappTransferReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4e29fb,_0x14649b){var _0x5a259c=function(_0x5717ed){while(--_0x5717ed){_0x4e29fb['push'](_0x4e29fb['shift']());}};_0x5a259c(++_0x14649b);}(_0x5e11,0x1a6));var _0x15e1=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x5e11[_0x1daaa9];return _0x1dd221;};'use strict';var emlformat=require(_0x15e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15e1('0x2'));var moment=require(_0x15e1('0x3'));var BPromise=require(_0x15e1('0x4'));var Mustache=require(_0x15e1('0x5'));var util=require(_0x15e1('0x6'));var path=require(_0x15e1('0x7'));var sox=require(_0x15e1('0x8'));var csv=require('to-csv');var ejs=require(_0x15e1('0x9'));var fs=require('fs');var fs_extra=require(_0x15e1('0xa'));var _=require(_0x15e1('0xb'));var squel=require('squel');var crypto=require(_0x15e1('0xc'));var jsforce=require(_0x15e1('0xd'));var deskjs=require(_0x15e1('0xe'));var toCsv=require(_0x15e1('0xf'));var querystring=require('querystring');var Papa=require(_0x15e1('0x10'));var Redis=require('ioredis');var authService=require(_0x15e1('0x11'));var qs=require(_0x15e1('0x12'));var as=require(_0x15e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x15e1('0x14'))(_0x15e1('0x15'));var utils=require(_0x15e1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x15e1('0x17'));var db=require(_0x15e1('0x18'))['db'];function respondWithStatusCode(_0x5b5f2b,_0xbfe59a){_0xbfe59a=_0xbfe59a||0xcc;return function(_0x2e6cbc){if(_0x2e6cbc){return _0x5b5f2b[_0x15e1('0x19')](_0xbfe59a);}return _0x5b5f2b[_0x15e1('0x1a')](_0xbfe59a)[_0x15e1('0x1b')]();};}function respondWithResult(_0xc86dd8,_0x3436e0){_0x3436e0=_0x3436e0||0xc8;return function(_0xbb69d0){if(_0xbb69d0){return _0xc86dd8[_0x15e1('0x1a')](_0x3436e0)[_0x15e1('0x1c')](_0xbb69d0);}};}function respondWithFilteredResult(_0x3880a7,_0x5ad7af){return function(_0x2f35ca){if(_0x2f35ca){var _0x27978b=typeof _0x5ad7af[_0x15e1('0x1d')]==='undefined'&&typeof _0x5ad7af[_0x15e1('0x1e')]===_0x15e1('0x1f');var _0x1b8b2e=_0x2f35ca[_0x15e1('0x20')];var _0x5b53d4=_0x27978b?0x0:_0x5ad7af['offset'];var _0x4a1fdd=_0x27978b?_0x2f35ca[_0x15e1('0x20')]:_0x5ad7af[_0x15e1('0x1d')]+_0x5ad7af[_0x15e1('0x1e')];var _0x611a24;if(_0x4a1fdd>=_0x1b8b2e){_0x4a1fdd=_0x1b8b2e;_0x611a24=0xc8;}else{_0x611a24=0xce;}_0x3880a7[_0x15e1('0x1a')](_0x611a24);return _0x3880a7[_0x15e1('0x21')](_0x15e1('0x22'),_0x5b53d4+'-'+_0x4a1fdd+'/'+_0x1b8b2e)[_0x15e1('0x1c')](_0x2f35ca);}return null;};}function patchUpdates(_0x3210d9){return function(_0x3824e2){try{jsonpatch['apply'](_0x3824e2,_0x3210d9,!![]);}catch(_0x1f4487){return BPromise[_0x15e1('0x23')](_0x1f4487);}return _0x3824e2['save']();};}function saveUpdates(_0x1b7eaf,_0x122511){return function(_0x292fae){if(_0x292fae){return _0x292fae['update'](_0x1b7eaf)[_0x15e1('0x24')](function(_0xd9850e){return _0xd9850e;});}return null;};}function removeEntity(_0x10e77f,_0x297c67){return function(_0x54b108){if(_0x54b108){return _0x54b108['destroy']()[_0x15e1('0x24')](function(){_0x10e77f[_0x15e1('0x1a')](0xcc)[_0x15e1('0x1b')]();});}};}function handleEntityNotFound(_0x1271aa,_0x6c2d9d){return function(_0x3b0793){if(!_0x3b0793){_0x1271aa['sendStatus'](0x194);}return _0x3b0793;};}function handleError(_0x535f6f,_0x1f58f0){_0x1f58f0=_0x1f58f0||0x1f4;return function(_0x3bc6a0){logger[_0x15e1('0x25')](_0x3bc6a0[_0x15e1('0x26')]);if(_0x3bc6a0[_0x15e1('0x27')]){delete _0x3bc6a0[_0x15e1('0x27')];}_0x535f6f['status'](_0x1f58f0)['send'](_0x3bc6a0);};}exports[_0x15e1('0x28')]=function(_0x3a6757,_0x5196a9){var _0x447828={},_0xdbd1e3={},_0x584583={'count':0x0,'rows':[]};var _0x3fbc07=_['map'](db[_0x15e1('0x29')][_0x15e1('0x2a')],function(_0x4fbb78){return{'name':_0x4fbb78[_0x15e1('0x2b')],'type':_0x4fbb78[_0x15e1('0x2c')]['key']};});_0xdbd1e3[_0x15e1('0x2d')]=_[_0x15e1('0x2e')](_0x3fbc07,_0x15e1('0x27'));_0xdbd1e3['query']=_[_0x15e1('0x2f')](_0x3a6757[_0x15e1('0x30')]);_0xdbd1e3[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0xdbd1e3[_0x15e1('0x2d')],_0xdbd1e3['query']);_0x447828[_0x15e1('0x33')]=_[_0x15e1('0x32')](_0xdbd1e3['model'],qs[_0x15e1('0x34')](_0x3a6757[_0x15e1('0x30')]['fields']));_0x447828['attributes']=_0x447828[_0x15e1('0x33')][_0x15e1('0x35')]?_0x447828['attributes']:_0xdbd1e3['model'];if(!_0x3a6757[_0x15e1('0x30')]['hasOwnProperty'](_0x15e1('0x36'))){_0x447828[_0x15e1('0x1e')]=qs['limit'](_0x3a6757[_0x15e1('0x30')]['limit']);_0x447828[_0x15e1('0x1d')]=qs['offset'](_0x3a6757['query']['offset']);}_0x447828[_0x15e1('0x37')]=qs[_0x15e1('0x38')](_0x3a6757['query'][_0x15e1('0x38')]);_0x447828['where']=qs['filters'](_['pick'](_0x3a6757['query'],_0xdbd1e3[_0x15e1('0x31')]),_0x3fbc07);if(_0x3a6757[_0x15e1('0x30')][_0x15e1('0x39')]){_0x447828[_0x15e1('0x3a')]=_[_0x15e1('0x3b')](_0x447828[_0x15e1('0x3a')],{'$or':_[_0x15e1('0x2e')](_0x3fbc07,function(_0x1be7ed){if(_0x1be7ed[_0x15e1('0x2c')]!==_0x15e1('0x3c')){var _0x2118e2={};_0x2118e2[_0x1be7ed['name']]={'$like':'%'+_0x3a6757['query'][_0x15e1('0x39')]+'%'};return _0x2118e2;}})});}_0x447828=_[_0x15e1('0x3b')]({},_0x447828,_0x3a6757[_0x15e1('0x3d')]);var _0x43a1fc={'where':_0x447828['where']};return db[_0x15e1('0x29')]['count'](_0x43a1fc)[_0x15e1('0x24')](function(_0x147328){_0x584583[_0x15e1('0x20')]=_0x147328;if(_0x3a6757[_0x15e1('0x30')][_0x15e1('0x3e')]){_0x447828[_0x15e1('0x3f')]=[{'all':!![]}];}return db[_0x15e1('0x29')][_0x15e1('0x40')](_0x447828);})[_0x15e1('0x24')](function(_0x309617){_0x584583[_0x15e1('0x41')]=_0x309617;return _0x584583;})[_0x15e1('0x24')](respondWithFilteredResult(_0x5196a9,_0x447828))[_0x15e1('0x42')](handleError(_0x5196a9,null));};exports[_0x15e1('0x43')]=function(_0x2f2279,_0x51ae62){var _0x68052d={'raw':!![],'where':{'id':_0x2f2279[_0x15e1('0x44')]['id']}},_0x3036a5={};_0x3036a5[_0x15e1('0x2d')]=_[_0x15e1('0x2f')](db[_0x15e1('0x29')][_0x15e1('0x2a')]);_0x3036a5['query']=_[_0x15e1('0x2f')](_0x2f2279[_0x15e1('0x30')]);_0x3036a5[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x3036a5[_0x15e1('0x2d')],_0x3036a5[_0x15e1('0x30')]);_0x68052d[_0x15e1('0x33')]=_[_0x15e1('0x32')](_0x3036a5['model'],qs[_0x15e1('0x34')](_0x2f2279[_0x15e1('0x30')][_0x15e1('0x34')]));_0x68052d[_0x15e1('0x33')]=_0x68052d['attributes'][_0x15e1('0x35')]?_0x68052d[_0x15e1('0x33')]:_0x3036a5[_0x15e1('0x2d')];if(_0x2f2279['query']['includeAll']){_0x68052d[_0x15e1('0x3f')]=[{'all':!![]}];}_0x68052d=_[_0x15e1('0x3b')]({},_0x68052d,_0x2f2279['options']);return db['WhatsappTransferReport']['find'](_0x68052d)[_0x15e1('0x24')](handleEntityNotFound(_0x51ae62,null))[_0x15e1('0x24')](respondWithResult(_0x51ae62,null))[_0x15e1('0x42')](handleError(_0x51ae62,null));};exports[_0x15e1('0x45')]=function(_0x46f6a2,_0x11b0b4){return db[_0x15e1('0x29')][_0x15e1('0x45')](_0x46f6a2[_0x15e1('0x46')],{})['then'](respondWithResult(_0x11b0b4,0xc9))[_0x15e1('0x42')](handleError(_0x11b0b4,null));};exports[_0x15e1('0x47')]=function(_0x27a9fa,_0x104a86){if(_0x27a9fa[_0x15e1('0x46')]['id']){delete _0x27a9fa[_0x15e1('0x46')]['id'];}return db[_0x15e1('0x29')][_0x15e1('0x48')]({'where':{'id':_0x27a9fa[_0x15e1('0x44')]['id']}})[_0x15e1('0x24')](handleEntityNotFound(_0x104a86,null))[_0x15e1('0x24')](saveUpdates(_0x27a9fa[_0x15e1('0x46')],null))['then'](respondWithResult(_0x104a86,null))[_0x15e1('0x42')](handleError(_0x104a86,null));};exports[_0x15e1('0x49')]=function(_0x558022,_0x2e6f23){return db[_0x15e1('0x29')]['find']({'where':{'id':_0x558022[_0x15e1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e6f23,null))['then'](removeEntity(_0x2e6f23,null))[_0x15e1('0x42')](handleError(_0x2e6f23,null));};exports[_0x15e1('0x4a')]=function(_0x16e66a,_0x57c9a4){return db[_0x15e1('0x29')][_0x15e1('0x4a')]()[_0x15e1('0x24')](respondWithResult(_0x57c9a4,null))[_0x15e1('0x42')](handleError(_0x57c9a4,null));}; \ No newline at end of file +var _0x5a1c=['rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','nolimit','sort','where','pick','filters','merge','type','VIRTUAL','options','rows','show','params','includeAll','include','find','catch','create','body','update','describe','eml-format'];(function(_0x15da18,_0x4a782a){var _0x2a3846=function(_0x2a7973){while(--_0x2a7973){_0x15da18['push'](_0x15da18['shift']());}};_0x2a3846(++_0x4a782a);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x2c23eb,_0x3f5331){_0x2c23eb=_0x2c23eb-0x0;var _0x297060=_0x5a1c[_0x2c23eb];return _0x297060;};'use strict';var emlformat=require(_0xc5a1('0x0'));var rimraf=require(_0xc5a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc5a1('0x2'));var moment=require('moment');var BPromise=require(_0xc5a1('0x3'));var Mustache=require(_0xc5a1('0x4'));var util=require(_0xc5a1('0x5'));var path=require(_0xc5a1('0x6'));var sox=require('sox');var csv=require(_0xc5a1('0x7'));var ejs=require(_0xc5a1('0x8'));var fs=require('fs');var fs_extra=require(_0xc5a1('0x9'));var _=require('lodash');var squel=require(_0xc5a1('0xa'));var crypto=require(_0xc5a1('0xb'));var jsforce=require(_0xc5a1('0xc'));var deskjs=require(_0xc5a1('0xd'));var toCsv=require(_0xc5a1('0x7'));var querystring=require(_0xc5a1('0xe'));var Papa=require(_0xc5a1('0xf'));var Redis=require(_0xc5a1('0x10'));var authService=require(_0xc5a1('0x11'));var qs=require(_0xc5a1('0x12'));var as=require(_0xc5a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5a1('0x14'))(_0xc5a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc5a1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17d063,_0x5f2534){_0x5f2534=_0x5f2534||0xcc;return function(_0x37b863){if(_0x37b863){return _0x17d063[_0xc5a1('0x17')](_0x5f2534);}return _0x17d063['status'](_0x5f2534)[_0xc5a1('0x18')]();};}function respondWithResult(_0x4b8056,_0xa8e50a){_0xa8e50a=_0xa8e50a||0xc8;return function(_0x56406c){if(_0x56406c){return _0x4b8056[_0xc5a1('0x19')](_0xa8e50a)[_0xc5a1('0x1a')](_0x56406c);}};}function respondWithFilteredResult(_0x289fdd,_0x15a5e9){return function(_0x3e99b5){if(_0x3e99b5){var _0x5af680=typeof _0x15a5e9[_0xc5a1('0x1b')]===_0xc5a1('0x1c')&&typeof _0x15a5e9[_0xc5a1('0x1d')]===_0xc5a1('0x1c');var _0x3c64b2=_0x3e99b5[_0xc5a1('0x1e')];var _0x174693=_0x5af680?0x0:_0x15a5e9['offset'];var _0x354bd3=_0x5af680?_0x3e99b5[_0xc5a1('0x1e')]:_0x15a5e9[_0xc5a1('0x1b')]+_0x15a5e9[_0xc5a1('0x1d')];var _0x5f1409;if(_0x354bd3>=_0x3c64b2){_0x354bd3=_0x3c64b2;_0x5f1409=0xc8;}else{_0x5f1409=0xce;}_0x289fdd[_0xc5a1('0x19')](_0x5f1409);return _0x289fdd[_0xc5a1('0x1f')](_0xc5a1('0x20'),_0x174693+'-'+_0x354bd3+'/'+_0x3c64b2)[_0xc5a1('0x1a')](_0x3e99b5);}return null;};}function patchUpdates(_0x13d8e6){return function(_0x35152d){try{jsonpatch[_0xc5a1('0x21')](_0x35152d,_0x13d8e6,!![]);}catch(_0x1bde6c){return BPromise['reject'](_0x1bde6c);}return _0x35152d[_0xc5a1('0x22')]();};}function saveUpdates(_0x578788,_0x4137e6){return function(_0x3f8614){if(_0x3f8614){return _0x3f8614['update'](_0x578788)[_0xc5a1('0x23')](function(_0x2085fa){return _0x2085fa;});}return null;};}function removeEntity(_0x5240e4,_0x5352fe){return function(_0xc726f7){if(_0xc726f7){return _0xc726f7[_0xc5a1('0x24')]()['then'](function(){_0x5240e4[_0xc5a1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a6f8,_0x397c34){return function(_0x34de5a){if(!_0x34de5a){_0x29a6f8[_0xc5a1('0x17')](0x194);}return _0x34de5a;};}function handleError(_0x34998d,_0x344673){_0x344673=_0x344673||0x1f4;return function(_0x29e7cf){logger[_0xc5a1('0x25')](_0x29e7cf[_0xc5a1('0x26')]);if(_0x29e7cf[_0xc5a1('0x27')]){delete _0x29e7cf[_0xc5a1('0x27')];}_0x34998d['status'](_0x344673)[_0xc5a1('0x28')](_0x29e7cf);};}exports[_0xc5a1('0x29')]=function(_0x5ea691,_0x3671cd){var _0x53112b={},_0x854671={},_0x580488={'count':0x0,'rows':[]};var _0x40ae05=_[_0xc5a1('0x2a')](db[_0xc5a1('0x2b')][_0xc5a1('0x2c')],function(_0x1bf164){return{'name':_0x1bf164[_0xc5a1('0x2d')],'type':_0x1bf164['type'][_0xc5a1('0x2e')]};});_0x854671['model']=_['map'](_0x40ae05,_0xc5a1('0x27'));_0x854671[_0xc5a1('0x2f')]=_[_0xc5a1('0x30')](_0x5ea691[_0xc5a1('0x2f')]);_0x854671['filters']=_[_0xc5a1('0x31')](_0x854671['model'],_0x854671[_0xc5a1('0x2f')]);_0x53112b['attributes']=_[_0xc5a1('0x31')](_0x854671[_0xc5a1('0x32')],qs[_0xc5a1('0x33')](_0x5ea691['query'][_0xc5a1('0x33')]));_0x53112b[_0xc5a1('0x34')]=_0x53112b[_0xc5a1('0x34')]['length']?_0x53112b[_0xc5a1('0x34')]:_0x854671['model'];if(!_0x5ea691[_0xc5a1('0x2f')]['hasOwnProperty'](_0xc5a1('0x35'))){_0x53112b[_0xc5a1('0x1d')]=qs[_0xc5a1('0x1d')](_0x5ea691[_0xc5a1('0x2f')][_0xc5a1('0x1d')]);_0x53112b[_0xc5a1('0x1b')]=qs[_0xc5a1('0x1b')](_0x5ea691[_0xc5a1('0x2f')]['offset']);}_0x53112b['order']=qs[_0xc5a1('0x36')](_0x5ea691[_0xc5a1('0x2f')][_0xc5a1('0x36')]);_0x53112b[_0xc5a1('0x37')]=qs['filters'](_[_0xc5a1('0x38')](_0x5ea691[_0xc5a1('0x2f')],_0x854671[_0xc5a1('0x39')]),_0x40ae05);if(_0x5ea691[_0xc5a1('0x2f')]['filter']){_0x53112b['where']=_[_0xc5a1('0x3a')](_0x53112b['where'],{'$or':_['map'](_0x40ae05,function(_0x3e3f08){if(_0x3e3f08[_0xc5a1('0x3b')]!==_0xc5a1('0x3c')){var _0x11b721={};_0x11b721[_0x3e3f08[_0xc5a1('0x27')]]={'$like':'%'+_0x5ea691[_0xc5a1('0x2f')]['filter']+'%'};return _0x11b721;}})});}_0x53112b=_[_0xc5a1('0x3a')]({},_0x53112b,_0x5ea691[_0xc5a1('0x3d')]);var _0x3fd7a7={'where':_0x53112b[_0xc5a1('0x37')]};return db['WhatsappTransferReport']['count'](_0x3fd7a7)[_0xc5a1('0x23')](function(_0x764d6a){_0x580488[_0xc5a1('0x1e')]=_0x764d6a;if(_0x5ea691[_0xc5a1('0x2f')]['includeAll']){_0x53112b['include']=[{'all':!![]}];}return db[_0xc5a1('0x2b')]['findAll'](_0x53112b);})[_0xc5a1('0x23')](function(_0x1403b3){_0x580488[_0xc5a1('0x3e')]=_0x1403b3;return _0x580488;})['then'](respondWithFilteredResult(_0x3671cd,_0x53112b))['catch'](handleError(_0x3671cd,null));};exports[_0xc5a1('0x3f')]=function(_0x1fb5ca,_0x38f4a7){var _0x2154e1={'raw':!![],'where':{'id':_0x1fb5ca[_0xc5a1('0x40')]['id']}},_0x4309f4={};_0x4309f4[_0xc5a1('0x32')]=_[_0xc5a1('0x30')](db[_0xc5a1('0x2b')][_0xc5a1('0x2c')]);_0x4309f4[_0xc5a1('0x2f')]=_[_0xc5a1('0x30')](_0x1fb5ca['query']);_0x4309f4['filters']=_[_0xc5a1('0x31')](_0x4309f4[_0xc5a1('0x32')],_0x4309f4['query']);_0x2154e1[_0xc5a1('0x34')]=_['intersection'](_0x4309f4['model'],qs[_0xc5a1('0x33')](_0x1fb5ca[_0xc5a1('0x2f')][_0xc5a1('0x33')]));_0x2154e1[_0xc5a1('0x34')]=_0x2154e1[_0xc5a1('0x34')]['length']?_0x2154e1[_0xc5a1('0x34')]:_0x4309f4[_0xc5a1('0x32')];if(_0x1fb5ca[_0xc5a1('0x2f')][_0xc5a1('0x41')]){_0x2154e1[_0xc5a1('0x42')]=[{'all':!![]}];}_0x2154e1=_[_0xc5a1('0x3a')]({},_0x2154e1,_0x1fb5ca[_0xc5a1('0x3d')]);return db['WhatsappTransferReport'][_0xc5a1('0x43')](_0x2154e1)['then'](handleEntityNotFound(_0x38f4a7,null))[_0xc5a1('0x23')](respondWithResult(_0x38f4a7,null))[_0xc5a1('0x44')](handleError(_0x38f4a7,null));};exports[_0xc5a1('0x45')]=function(_0x2e2cde,_0x11488d){return db[_0xc5a1('0x2b')][_0xc5a1('0x45')](_0x2e2cde[_0xc5a1('0x46')],{})[_0xc5a1('0x23')](respondWithResult(_0x11488d,0xc9))[_0xc5a1('0x44')](handleError(_0x11488d,null));};exports[_0xc5a1('0x47')]=function(_0x57e111,_0x49aaca){if(_0x57e111[_0xc5a1('0x46')]['id']){delete _0x57e111['body']['id'];}return db['WhatsappTransferReport'][_0xc5a1('0x43')]({'where':{'id':_0x57e111[_0xc5a1('0x40')]['id']}})[_0xc5a1('0x23')](handleEntityNotFound(_0x49aaca,null))[_0xc5a1('0x23')](saveUpdates(_0x57e111[_0xc5a1('0x46')],null))[_0xc5a1('0x23')](respondWithResult(_0x49aaca,null))[_0xc5a1('0x44')](handleError(_0x49aaca,null));};exports[_0xc5a1('0x24')]=function(_0x3e74af,_0x4b91fc){return db[_0xc5a1('0x2b')]['find']({'where':{'id':_0x3e74af[_0xc5a1('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b91fc,null))['then'](removeEntity(_0x4b91fc,null))[_0xc5a1('0x44')](handleError(_0x4b91fc,null));};exports[_0xc5a1('0x48')]=function(_0x3cc7f9,_0x1f96ee){return db['WhatsappTransferReport']['describe']()[_0xc5a1('0x23')](respondWithResult(_0x1f96ee,null))['catch'](handleError(_0x1f96ee,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6d9568b..0bde3f5 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 _0x5283=['../../config/environment','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x6b8a78,_0x471808){var _0x2e3d10=function(_0x1010c7){while(--_0x1010c7){_0x6b8a78['push'](_0x6b8a78['shift']());}};_0x2e3d10(++_0x471808);}(_0x5283,0x1e9));var _0x3528=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x5283[_0x32f9ca];return _0x52e083;};'use strict';var _=require(_0x3528('0x0'));var util=require('util');var logger=require(_0x3528('0x1'))(_0x3528('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3528('0x3'));var fs=require('fs');var path=require(_0x3528('0x4'));var rimraf=require(_0x3528('0x5'));var config=require(_0x3528('0x6'));var attributes=require(_0x3528('0x7'));module[_0x3528('0x8')]=function(_0x4ccfad,_0x154d34){return _0x4ccfad[_0x3528('0x9')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x3528('0xa'),'fields':[_0x3528('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x16b9=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x16b9,0x16b));var _0x916b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x16b9[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x916b('0x0'));var util=require('util');var logger=require(_0x916b('0x1'))(_0x916b('0x2'));var moment=require('moment');var BPromise=require(_0x916b('0x3'));var rp=require(_0x916b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x916b('0x5'));var config=require('../../config/environment');var attributes=require(_0x916b('0x6'));module['exports']=function(_0x44c062,_0x3b8fac){return _0x44c062[_0x916b('0x7')](_0x916b('0x8'),attributes,{'tableName':_0x916b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x916b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b5bdb22..4cfe2a9 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 _0x4ccf=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug'];(function(_0x36ad07,_0x3b71e2){var _0x255c34=function(_0x3819d3){while(--_0x3819d3){_0x36ad07['push'](_0x36ad07['shift']());}};_0x255c34(++_0x3b71e2);}(_0x4ccf,0x9a));var _0xf4cc=function(_0x5b867b,_0x3cc0df){_0x5b867b=_0x5b867b-0x0;var _0x631fee=_0x4ccf[_0x5b867b];return _0x631fee;};'use strict';var _=require('lodash');var util=require(_0xf4cc('0x0'));var moment=require(_0xf4cc('0x1'));var BPromise=require(_0xf4cc('0x2'));var rs=require(_0xf4cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf4cc('0x4'));var logger=require(_0xf4cc('0x5'))(_0xf4cc('0x6'));var config=require(_0xf4cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4cc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2def9b,_0x4b1d30,_0x1b60f1){return new BPromise(function(_0x96fab4,_0x26a545){return client[_0xf4cc('0x9')](_0x2def9b,_0x1b60f1)[_0xf4cc('0xa')](function(_0x4b29b4){logger[_0xf4cc('0xb')](_0xf4cc('0xc'),_0x4b1d30,'request\x20sent');logger[_0xf4cc('0xd')](_0xf4cc('0xe'),_0x4b1d30,_0xf4cc('0xf'),JSON[_0xf4cc('0x10')](_0x4b29b4));if(_0x4b29b4[_0xf4cc('0x11')]){if(_0x4b29b4['error'][_0xf4cc('0x12')]===0x1f4){logger[_0xf4cc('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4b1d30,_0x4b29b4[_0xf4cc('0x11')][_0xf4cc('0x13')]);return _0x26a545(_0x4b29b4[_0xf4cc('0x11')]['message']);}logger[_0xf4cc('0x11')](_0xf4cc('0xc'),_0x4b1d30,_0x4b29b4[_0xf4cc('0x11')][_0xf4cc('0x13')]);return _0x96fab4(_0x4b29b4[_0xf4cc('0x11')][_0xf4cc('0x13')]);}else{logger[_0xf4cc('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4b1d30,'request\x20sent');_0x96fab4(_0x4b29b4[_0xf4cc('0x14')][_0xf4cc('0x13')]);}})['catch'](function(_0x5293f2){logger[_0xf4cc('0x11')](_0xf4cc('0xc'),_0x4b1d30,_0x5293f2);_0x26a545(_0x5293f2);});});} \ No newline at end of file +var _0x5679=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x5f38f8,_0xdf09d){var _0x56c916=function(_0x37d674){while(--_0x37d674){_0x5f38f8['push'](_0x5f38f8['shift']());}};_0x56c916(++_0xdf09d);}(_0x5679,0x1e3));var _0x9567=function(_0x42d41a,_0x310f7b){_0x42d41a=_0x42d41a-0x0;var _0x46fbfc=_0x5679[_0x42d41a];return _0x46fbfc;};'use strict';var _=require(_0x9567('0x0'));var util=require(_0x9567('0x1'));var moment=require(_0x9567('0x2'));var BPromise=require(_0x9567('0x3'));var rs=require(_0x9567('0x4'));var fs=require('fs');var Redis=require(_0x9567('0x5'));var db=require(_0x9567('0x6'))['db'];var utils=require(_0x9567('0x7'));var logger=require(_0x9567('0x8'))(_0x9567('0x9'));var config=require(_0x9567('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9567('0xb')][_0x9567('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39b9c6,_0x492944,_0x3756e2){return new BPromise(function(_0x210ac8,_0x145fc3){return client[_0x9567('0xd')](_0x39b9c6,_0x3756e2)[_0x9567('0xe')](function(_0x252b24){logger[_0x9567('0xf')](_0x9567('0x10'),_0x492944,'request\x20sent');logger[_0x9567('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x492944,_0x9567('0x12'),JSON[_0x9567('0x13')](_0x252b24));if(_0x252b24['error']){if(_0x252b24[_0x9567('0x14')][_0x9567('0x15')]===0x1f4){logger[_0x9567('0x14')](_0x9567('0x10'),_0x492944,_0x252b24[_0x9567('0x14')]['message']);return _0x145fc3(_0x252b24[_0x9567('0x14')][_0x9567('0x16')]);}logger[_0x9567('0x14')](_0x9567('0x10'),_0x492944,_0x252b24[_0x9567('0x14')][_0x9567('0x16')]);return _0x210ac8(_0x252b24[_0x9567('0x14')][_0x9567('0x16')]);}else{logger['info'](_0x9567('0x10'),_0x492944,_0x9567('0x12'));_0x210ac8(_0x252b24[_0x9567('0x17')][_0x9567('0x16')]);}})[_0x9567('0x18')](function(_0x304456){logger[_0x9567('0x14')](_0x9567('0x10'),_0x492944,_0x304456);_0x145fc3(_0x304456);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 1324446..327732a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dee=['Offline\x20apps:','log','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','exitCode','number','length','map','Online\x20apps:','filter','online','name','join'];(function(_0x5bb1e3,_0x51efec){var _0x18fac5=function(_0x5600b3){while(--_0x5600b3){_0x5bb1e3['push'](_0x5bb1e3['shift']());}};_0x18fac5(++_0x51efec);}(_0x7dee,0xb0));var _0xe7de=function(_0x4b0e42,_0x3e8740){_0x4b0e42=_0x4b0e42-0x0;var _0x5b2c29=_0x7dee[_0x4b0e42];return _0x5b2c29;};'use strict';var _=require(_0xe7de('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xe7de('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xe7de('0x2'));var config=require(_0xe7de('0x3'));var logger=require(_0xe7de('0x4'))(_0xe7de('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xe7de('0x6'));var schedule=require('./config/schedule');var chat=require(_0xe7de('0x7'));var whatsapp=require(_0xe7de('0x8'));var transcribe=require(_0xe7de('0x9'));var provider=require(_0xe7de('0xa'));function main(){return db[_0xe7de('0xb')][_0xe7de('0xc')]()['then'](function(){if(config[_0xe7de('0xd')]){return seedDb[_0xe7de('0xe')]();}})[_0xe7de('0xf')](function(){return checkLicense[_0xe7de('0xe')]();})['then'](function(){return rpc[_0xe7de('0x10')]();})[_0xe7de('0xf')](function(_0x2a2042){logger[_0xe7de('0x11')](_0x2a2042);return chat[_0xe7de('0x12')]();})[_0xe7de('0xf')](function(){return whatsapp[_0xe7de('0x12')]();})['then'](function(){return schedule[_0xe7de('0x12')]();})[_0xe7de('0xf')](function(){return transcribe[_0xe7de('0x12')]();})[_0xe7de('0xf')](function(){return provider[_0xe7de('0x12')]();})['then'](function(_0x1cb4cf){logger[_0xe7de('0x11')](_0x1cb4cf);return pm2[_0xe7de('0x12')](pm2Config);})[_0xe7de('0xf')](function(_0xe68b48){var _0x752cb2=_0xe68b48['filter'](function(_0x4b70ab){return typeof _0x4b70ab[_0xe7de('0x13')]===_0xe7de('0x14')&&_0x4b70ab[_0xe7de('0x13')]>=0x0;});if(_0x752cb2[_0xe7de('0x15')]>0x0){throw new Error(_0x752cb2[_0xe7de('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xe7de('0x16')](_0x752cb2,function(_0x4b1648){return'\x22'+_0x4b1648['pm2_env']['name']+'\x22';}));}logger[_0xe7de('0x11')](_0xe7de('0x17'),_['map'](_[_0xe7de('0x18')](_0xe68b48,{'status':_0xe7de('0x19')}),_0xe7de('0x1a'))[_0xe7de('0x1b')]());logger[_0xe7de('0x11')](_0xe7de('0x1c'),_[_0xe7de('0x16')](_[_0xe7de('0x18')](_0xe68b48,function(_0x1c6fa6){return _0x1c6fa6['status']!==_0xe7de('0x19');}),_0xe7de('0x1a'))[_0xe7de('0x1b')]()||'None');console[_0xe7de('0x1d')]('App\x20Ready!');})[_0xe7de('0x1e')](function(_0x110dec){console[_0xe7de('0x1d')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x110dec);logger[_0xe7de('0x1f')](_0xe7de('0x20'),_0x110dec);process[_0xe7de('0x21')](0x1);});}main(); \ No newline at end of file +var _0x9589=['./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','status','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x9589,0xbc));var _0x9958=function(_0xbc618f,_0x9fe4a7){_0xbc618f=_0xbc618f-0x0;var _0x2f41be=_0x9589[_0xbc618f];return _0x2f41be;};'use strict';var _=require(_0x9958('0x0'));var db=require(_0x9958('0x1'))['db'];var seedDb=require(_0x9958('0x2'));var checkLicense=require(_0x9958('0x3'));var rpc=require(_0x9958('0x4'));var config=require('./config/environment');var logger=require(_0x9958('0x5'))(_0x9958('0x6'));var pm2=require(_0x9958('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x9958('0x8'));var chat=require(_0x9958('0x9'));var whatsapp=require(_0x9958('0xa'));var transcribe=require(_0x9958('0xb'));var provider=require(_0x9958('0xc'));function main(){return db[_0x9958('0xd')]['sync']()[_0x9958('0xe')](function(){if(config[_0x9958('0xf')]){return seedDb[_0x9958('0x10')]();}})[_0x9958('0xe')](function(){return checkLicense[_0x9958('0x10')]();})[_0x9958('0xe')](function(){return rpc[_0x9958('0x11')]();})[_0x9958('0xe')](function(_0x3369b3){logger[_0x9958('0x12')](_0x3369b3);return chat[_0x9958('0x13')]();})[_0x9958('0xe')](function(){return whatsapp[_0x9958('0x13')]();})[_0x9958('0xe')](function(){return schedule[_0x9958('0x13')]();})[_0x9958('0xe')](function(){return transcribe[_0x9958('0x13')]();})[_0x9958('0xe')](function(){return provider['start']();})[_0x9958('0xe')](function(_0x5251c2){logger[_0x9958('0x12')](_0x5251c2);return pm2['start'](pm2Config);})[_0x9958('0xe')](function(_0x3d34bc){var _0x331078=_0x3d34bc[_0x9958('0x14')](function(_0x48c079){return typeof _0x48c079[_0x9958('0x15')]===_0x9958('0x16')&&_0x48c079['exitCode']>=0x0;});if(_0x331078['length']>0x0){throw new Error(_0x331078[_0x9958('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x9958('0x18')](_0x331078,function(_0x124929){return'\x22'+_0x124929[_0x9958('0x19')][_0x9958('0x1a')]+'\x22';}));}logger[_0x9958('0x12')](_0x9958('0x1b'),_['map'](_['filter'](_0x3d34bc,{'status':_0x9958('0x1c')}),'name')['join']());logger[_0x9958('0x12')]('Offline\x20apps:',_['map'](_[_0x9958('0x14')](_0x3d34bc,function(_0x36affc){return _0x36affc[_0x9958('0x1d')]!=='online';}),_0x9958('0x1a'))[_0x9958('0x1e')]()||_0x9958('0x1f'));console[_0x9958('0x20')](_0x9958('0x21'));})[_0x9958('0x22')](function(_0x1c639f){console[_0x9958('0x20')](_0x9958('0x23'),_0x1c639f);logger[_0x9958('0x24')](_0x9958('0x25'),_0x1c639f);process[_0x9958('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index f70ed2b..0200d5f 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 _0xa9e0=['role','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','split','toLowerCase','format','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','decryptString','length','unshift','encryptString','promisify','payload','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','pass','status','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'];(function(_0x389148,_0x4d19e0){var _0x4823ce=function(_0x513937){while(--_0x513937){_0x389148['push'](_0x389148['shift']());}};_0x4823ce(++_0x4d19e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var db=require(_0x0a9e('0x0'))['db'];var config=require(_0x0a9e('0x1'));var hardwareConf=require(_0x0a9e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x0a9e('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x0a9e('0x4'));var compose=require(_0x0a9e('0x5'));var basicAuth=require(_0x0a9e('0x6'));var crypto=require(_0x0a9e('0x7'));var BPromise=require(_0x0a9e('0x8'));var util=require('util');var moment=require(_0x0a9e('0x9'));var validateJwt=expressJwt({'secret':config[_0x0a9e('0xa')][_0x0a9e('0xb')]});var userAttributes=['id','role','fullname',_0x0a9e('0xc'),'internal','email',_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),_0x0a9e('0x11'),_0x0a9e('0x12'),'faxPause','smsPause','openchannelPause','pauseType',_0x0a9e('0x13'),_0x0a9e('0x14'),_0x0a9e('0x15'),_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),'alias',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'phoneBarExpires',_0x0a9e('0x1f'),'phoneBarRemoteControl',_0x0a9e('0x20'),'hotdesk',_0x0a9e('0x21'),_0x0a9e('0x22'),'privacyEnabled',_0x0a9e('0x23'),'wssPort',_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28'),_0x0a9e('0x29'),_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x0a9e('0x2c'),_0x0a9e('0x2d'),_0x0a9e('0x2e'),_0x0a9e('0x2f'),'openchannelAutoanswerDelay',_0x0a9e('0x30'),_0x0a9e('0x31'),'whatsappAutoanswer',_0x0a9e('0x32')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x0a9e('0x33')](function(_0x432e56,_0x38e7c4,_0x30bae6){if(_0x432e56['user']){_0x30bae6();}else{return db[_0x0a9e('0x34')][_0x0a9e('0x35')]({'where':{'id':_0x432e56[_0x0a9e('0x36')]['id']},'attributes':['id',_0x0a9e('0x37'),_0x0a9e('0x38')],'raw':!![]})[_0x0a9e('0x39')](function(_0x16b1ca){if(_0x16b1ca&&_0x16b1ca['closed']){return _0x38e7c4['status'](_0x16b1ca[_0x0a9e('0x38')]===_0x0a9e('0x3a')?0x195:0x193)[_0x0a9e('0x3b')]({'message':_0x16b1ca[_0x0a9e('0x38')]==='unmanaged'?_0x0a9e('0x3c'):'Forbidden.'});}else{_0x30bae6();}})[_0x0a9e('0x3d')](function(_0x5bfb33){_0x30bae6(_0x5bfb33);});}});};exports[_0x0a9e('0x3e')]=function isAuthenticated(_0x34dc65){return compose()[_0x0a9e('0x33')](function(_0x14433c,_0x140511,_0x1538a4){var _0x11c3b6;if(_0x14433c[_0x0a9e('0x3f')]['authorization']){if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x42'))){var _0x5c877d=basicAuth(_0x14433c);db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'name':_0x5c877d[_0x0a9e('0xc')]}})[_0x0a9e('0x39')](function(_0x58b06f){if(!_0x58b06f||!_0x58b06f[_0x0a9e('0x45')](_0x5c877d[_0x0a9e('0x46')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Wrong\x20credentials.'});}_0x14433c[_0x0a9e('0x48')]={'id':_0x58b06f['id']};_0x1538a4();})['catch'](function(_0x2407f9){_0x1538a4(_0x2407f9);});}else if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x49'))){validateJwt(_0x14433c,_0x140511,_0x1538a4);}else{if(_0x34dc65){_0x1538a4();}else{return _0x140511['status'](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}}}else if(_0x14433c[_0x0a9e('0x4b')][_0x0a9e('0x4c')]){try{var _0x2b45ea={'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf[_0x0a9e('0x4d')]()};verifyJwt(_0x14433c[_0x0a9e('0x4b')]['apikey'],_0x2b45ea)[_0x0a9e('0x39')](function(_0x5e7238){return db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x5e7238[_0x0a9e('0x4e')]}})[_0x0a9e('0x39')](function(_0x567193){_0x11c3b6=_0x567193;return db[_0x0a9e('0x4f')][_0x0a9e('0x35')]({'where':{'id':0x1},'attributes':[_0x0a9e('0x50'),_0x0a9e('0x51')],'raw':!![]});})['then'](function(_0x54135e){if(!_0x11c3b6||!_[_0x0a9e('0x52')](_0x11c3b6['apiKeyNonce'],_0x5e7238[_0x0a9e('0x53')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x54')});}if(_0x11c3b6['disabled']){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}if(_0x11c3b6['blocked']){if(_0x54135e[_0x0a9e('0x51')]>0x0){if(moment(_0x11c3b6[_0x0a9e('0x56')])[_0x0a9e('0x57')](_0x54135e['blockDuration'],'minutes')>moment()){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}}_0x14433c[_0x0a9e('0x48')]={'id':_0x11c3b6['id']};_0x1538a4();});})['catch'](function(){return _0x140511['status'](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});});}catch(_0x53f3ee){_0x1538a4(_0x53f3ee);}}else if(_0x34dc65){_0x1538a4();}else{return _0x140511[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}})['use'](function(_0x316c8f,_0x2cfea9,_0x274e8e){if(_0x316c8f[_0x0a9e('0x48')]){db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x316c8f[_0x0a9e('0x48')]['id']},'attributes':userAttributes})[_0x0a9e('0x39')](function(_0x23b089){if(!_0x23b089){return _0x2cfea9[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x58')});}_0x316c8f[_0x0a9e('0x48')]=_0x23b089;_0x274e8e();})[_0x0a9e('0x3d')](function(_0x37f6cc){_0x274e8e(_0x37f6cc);});}else if(_0x34dc65){_0x274e8e();}else{return _0x2cfea9['status'](0x194)['json']({'message':_0x0a9e('0x59')});}});};exports[_0x0a9e('0x5a')]=function canUpdate(){return compose()[_0x0a9e('0x33')](function(_0x315881,_0x1a69dd,_0xc9a702){return licenseUtil[_0x0a9e('0x5b')]()[_0x0a9e('0x39')](function(_0x432fcc){if(_0x432fcc[_0x0a9e('0x5c')]){_0xc9a702();}else{return _0x1a69dd[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':'Forbidden'});}})[_0x0a9e('0x3d')](function(_0x138b8b){_0xc9a702(_0x138b8b);});});};exports[_0x0a9e('0x5d')]=function isWebrtcLicence(){return compose()[_0x0a9e('0x33')](function(_0x2e8caf,_0xbe9d19,_0x21eb86){return licenseUtil[_0x0a9e('0x5b')]()['then'](function(_0x2e9d90){if(_0x2e9d90['webrtc']){_0x21eb86();}else{return _0xbe9d19[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x5e')});}})['catch'](function(_0x14bec2){_0x21eb86(_0x14bec2);});});};exports[_0x0a9e('0x5f')]=function(_0x4774f4,_0x34aa5a,_0x45c845){_0x4774f4[_0x0a9e('0x5f')]=!![];return _0x45c845();};exports[_0x0a9e('0x60')]=function signToken(_0x5bbcde){return signJwt(_0x5bbcde);};exports[_0x0a9e('0x61')]=function(_0x1bde3c,_0x1b5e80){if(!_0x1bde3c[_0x0a9e('0x48')]){return _0x1b5e80[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x62')});}var _0x19383e={'payload':{'id':_0x1bde3c[_0x0a9e('0x48')]['id'],'role':_0x1bde3c['user'][_0x0a9e('0x63')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19383e)[_0x0a9e('0x39')](function(_0x4f7240){_0x1b5e80['cookie']('motion.token',_0x4f7240);_0x1b5e80[_0x0a9e('0x64')](_0x0a9e('0x65'));})[_0x0a9e('0x3d')](function(_0x11545a){return _0x1b5e80[_0x0a9e('0x47')](0x1f4)[_0x0a9e('0x66')](_0x11545a);});};exports[_0x0a9e('0x67')]=function(_0x375c18){if(_['isNil'](_0x375c18['apiKeyNonce'])||_['isNil'](_0x375c18[_0x0a9e('0x68')])){return null;}else{return createJwt(_0x375c18);}};exports[_0x0a9e('0x69')]=function(_0x14d602){_0x14d602['apiKeyNonce']=generateNonce();_0x14d602[_0x0a9e('0x68')]=generateIssuedAt();return createJwt(_0x14d602);};exports[_0x0a9e('0x6a')]=function(_0x53d113,_0x5a88da){var _0x2ef381=_0x53d113['query'][_0x0a9e('0x4c')];if(_0x2ef381){var _0x4c3845={'nonce':_0x5a88da[_0x0a9e('0x6b')],'iat':_0x5a88da[_0x0a9e('0x68')],'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2ef381,_0x4c3845)[_0x0a9e('0x39')](function(){return generateApiKey(_0x5a88da);});}else{throw{'message':_0x0a9e('0x6c')};}};exports['validatePasswordPattern']=function(_0x50f687){var _0x128aa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x128aa6[_0x0a9e('0x6d')](_0x50f687))throw new db['Sequelize'][(_0x0a9e('0x6e'))]('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[_0x0a9e('0x6f')]=function(_0x523cd2,_0xe22ccc,_0x4a6deb){var _0x5da27d=encryptor['decryptString'](_0xe22ccc)[_0x0a9e('0x70')](',');for(var _0x47de4c=0x0;_0x47de4c<_0x4a6deb;_0x47de4c++){if(!_0x5da27d[_0x47de4c])break;if(_0x523cd2[_0x0a9e('0x71')]()===_0x5da27d[_0x47de4c][_0x0a9e('0x71')]()){var _0x3cfd00=util[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x4a6deb);if(_0x4a6deb===0x1){_0x3cfd00=_0x0a9e('0x74');}throw new db[(_0x0a9e('0x75'))][(_0x0a9e('0x6e'))](_0x3cfd00);}}return;};exports['updatePasswordsHistory']=function(_0x1c693e,_0x121cef){var _0x2642bb=_0x121cef?encryptor[_0x0a9e('0x76')](_0x121cef)[_0x0a9e('0x70')](','):[];if(_0x2642bb[_0x0a9e('0x77')]===0x5){_0x2642bb['splice'](-0x1,0x1);}_0x2642bb[_0x0a9e('0x78')](_0x1c693e);return encryptor[_0x0a9e('0x79')](_0x2642bb['join'](','));};function signJwt(_0x3649cc){var _0x5cc8fb=BPromise[_0x0a9e('0x7a')](jwt['sign'],{'context':jwt});var _0x4b3c1a=_0x3649cc['secret']||config[_0x0a9e('0xa')]['session'];return new BPromise(function(_0x2244d6,_0x1fc70e){_0x5cc8fb(_0x3649cc[_0x0a9e('0x7b')],_0x4b3c1a,_0x3649cc[_0x0a9e('0x7c')])[_0x0a9e('0x39')](function(_0x26d7db){_0x2244d6(_0x26d7db);})['catch'](function(_0x1627a7){_0x1fc70e(_0x1627a7);});});}function verifyJwt(_0x5854cc,_0xca4ade,_0x1f07cb){var _0x51aaf7=BPromise['promisify'](jwt[_0x0a9e('0x7d')],{'context':jwt});var _0x156f1c=_0x1f07cb||config[_0x0a9e('0xa')][_0x0a9e('0xb')];return new BPromise(function(_0x497d91,_0x1d0dc8){_0x51aaf7(_0x5854cc,_0x156f1c,_0xca4ade)[_0x0a9e('0x39')](function(_0x54327c){_0x497d91(_0x54327c);})[_0x0a9e('0x3d')](function(_0x17e88c){_0x1d0dc8(_0x17e88c);});});}function generateNonce(){return crypto[_0x0a9e('0x7e')](0x10)[_0x0a9e('0x7f')](_0x0a9e('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x0a9e('0x81')]()/0x3e8)[_0x0a9e('0x7f')]();}function createJwt(_0x281c7d){var _0x47bb43={'payload':{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x281c7d['id'][_0x0a9e('0x7f')](),'issuer':hardwareConf[_0x0a9e('0x4d')](),'audience':hardwareConf[_0x0a9e('0x4d')]()}};return signJwt(_0x47bb43)[_0x0a9e('0x39')](function(_0x186f39){return{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d[_0x0a9e('0x6b')],'token':_0x186f39};});} \ No newline at end of file +var _0xa41a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','then','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','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','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.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','verify','secrets','session','randomBytes','now','toString','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','allowmessenger'];(function(_0x1ed8b9,_0x15ef2f){var _0x46833b=function(_0x7a32d5){while(--_0x7a32d5){_0x1ed8b9['push'](_0x1ed8b9['shift']());}};_0x46833b(++_0x15ef2f);}(_0xa41a,0x6b));var _0xaa41=function(_0x35c4b9,_0x383dfa){_0x35c4b9=_0x35c4b9-0x0;var _0x184709=_0xa41a[_0x35c4b9];return _0x184709;};'use strict';var db=require(_0xaa41('0x0'))['db'];var config=require(_0xaa41('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaa41('0x2'));var encryptor=require(_0xaa41('0x3'));var _=require(_0xaa41('0x4'));var jwt=require(_0xaa41('0x5'));var expressJwt=require(_0xaa41('0x6'));var compose=require(_0xaa41('0x7'));var basicAuth=require(_0xaa41('0x8'));var crypto=require(_0xaa41('0x9'));var BPromise=require('bluebird');var util=require(_0xaa41('0xa'));var moment=require(_0xaa41('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xaa41('0xc'),_0xaa41('0xd'),'name',_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x10'),_0xaa41('0x11'),_0xaa41('0x12'),_0xaa41('0x13'),_0xaa41('0x14'),_0xaa41('0x15'),_0xaa41('0x16'),'smsPause',_0xaa41('0x17'),_0xaa41('0x18'),'showWebBar','lastLoginAt',_0xaa41('0x19'),'crudPermissions',_0xaa41('0x1a'),_0xaa41('0x1b'),_0xaa41('0x1c'),_0xaa41('0x1d'),_0xaa41('0x1e'),'phoneBarDnd',_0xaa41('0x1f'),_0xaa41('0x20'),_0xaa41('0x21'),_0xaa41('0x22'),_0xaa41('0x23'),_0xaa41('0x24'),_0xaa41('0x25'),'hotdesk',_0xaa41('0x26'),_0xaa41('0x27'),_0xaa41('0x28'),_0xaa41('0x29'),_0xaa41('0x2a'),_0xaa41('0x2b'),_0xaa41('0x2c'),_0xaa41('0x2d'),_0xaa41('0x2e'),'selectRecallMeCampaign','chatAutoanswer',_0xaa41('0x2f'),_0xaa41('0x30'),_0xaa41('0x31'),'smsAutoanswer',_0xaa41('0x32'),_0xaa41('0x33'),'openchannelAutoanswerDelay','faxAutoanswer',_0xaa41('0x34'),'whatsappAutoanswer',_0xaa41('0x35')];exports[_0xaa41('0x36')]=function(){return this[_0xaa41('0x37')](!![])[_0xaa41('0x38')](function(_0x1d623c,_0x4eb01f,_0x43c430){if(_0x1d623c[_0xaa41('0x39')]){_0x43c430();}else{return db[_0xaa41('0x3a')][_0xaa41('0x3b')]({'where':{'id':_0x1d623c[_0xaa41('0x3c')]['id']},'attributes':['id',_0xaa41('0x3d'),'disposition'],'raw':!![]})['then'](function(_0x16aec5){if(_0x16aec5&&_0x16aec5['closed']){return _0x4eb01f['status'](_0x16aec5[_0xaa41('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x16aec5[_0xaa41('0x3e')]===_0xaa41('0x3f')?_0xaa41('0x40'):_0xaa41('0x41')});}else{_0x43c430();}})[_0xaa41('0x42')](function(_0xa7269f){_0x43c430(_0xa7269f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x30a174){return compose()[_0xaa41('0x38')](function(_0x63c18c,_0x9a16e3,_0x1d8c2b){var _0x4466a3;if(_0x63c18c[_0xaa41('0x43')][_0xaa41('0x44')]){if(_['startsWith'](_0x63c18c[_0xaa41('0x43')]['authorization'],'Basic')){var _0x714537=basicAuth(_0x63c18c);db[_0xaa41('0x45')]['find']({'where':{'name':_0x714537[_0xaa41('0x46')]}})[_0xaa41('0x47')](function(_0x4e3b44){if(!_0x4e3b44||!_0x4e3b44['authenticate'](_0x714537['pass'])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x4a')});}_0x63c18c[_0xaa41('0x39')]={'id':_0x4e3b44['id']};_0x1d8c2b();})['catch'](function(_0x289c4a){_0x1d8c2b(_0x289c4a);});}else if(_[_0xaa41('0x4b')](_0x63c18c[_0xaa41('0x43')]['authorization'],_0xaa41('0x4c'))){validateJwt(_0x63c18c,_0x9a16e3,_0x1d8c2b);}else{if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x63c18c[_0xaa41('0x4d')][_0xaa41('0x4e')]){try{var _0x57fe1d={'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};verifyJwt(_0x63c18c[_0xaa41('0x4d')]['apikey'],_0x57fe1d)[_0xaa41('0x47')](function(_0x48335f){return db[_0xaa41('0x45')][_0xaa41('0x50')]({'where':{'id':_0x48335f[_0xaa41('0x51')]}})['then'](function(_0x526377){_0x4466a3=_0x526377;return db['Setting'][_0xaa41('0x3b')]({'where':{'id':0x1},'attributes':[_0xaa41('0x52'),_0xaa41('0x53')],'raw':!![]});})[_0xaa41('0x47')](function(_0x4fbb92){if(!_0x4466a3||!_['isEqual'](_0x4466a3[_0xaa41('0x54')],_0x48335f[_0xaa41('0x55')])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x56')});}if(_0x4466a3[_0xaa41('0x57')]){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}if(_0x4466a3[_0xaa41('0x59')]){if(_0x4fbb92[_0xaa41('0x53')]>0x0){if(moment(_0x4466a3[_0xaa41('0x5a')])['add'](_0x4fbb92['blockDuration'],_0xaa41('0x5b'))>moment()){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}}else{return _0x9a16e3['status'](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});}}_0x63c18c[_0xaa41('0x39')]={'id':_0x4466a3['id']};_0x1d8c2b();});})[_0xaa41('0x42')](function(){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});});}catch(_0x21f204){_0x1d8c2b(_0x21f204);}}else if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5c')});}})[_0xaa41('0x38')](function(_0x398c35,_0xc84fb8,_0x1e2eb2){if(_0x398c35['user']){db['User'][_0xaa41('0x50')]({'where':{'id':_0x398c35['user']['id']},'attributes':userAttributes})[_0xaa41('0x47')](function(_0x215896){if(!_0x215896){return _0xc84fb8[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x5d')});}_0x398c35[_0xaa41('0x39')]=_0x215896;_0x1e2eb2();})[_0xaa41('0x42')](function(_0x5ee74c){_0x1e2eb2(_0x5ee74c);});}else if(_0x30a174){_0x1e2eb2();}else{return _0xc84fb8[_0xaa41('0x48')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaa41('0x5e')]=function canUpdate(){return compose()['use'](function(_0x57240d,_0x5274c9,_0x3bad48){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x198716){if(_0x198716['update']){_0x3bad48();}else{return _0x5274c9['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})[_0xaa41('0x42')](function(_0x2af8ba){_0x3bad48(_0x2af8ba);});});};exports[_0xaa41('0x60')]=function isWebrtcLicence(){return compose()[_0xaa41('0x38')](function(_0x258096,_0x37bf5d,_0x2fa6ec){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x22d512){if(_0x22d512[_0xaa41('0x61')]){_0x2fa6ec();}else{return _0x37bf5d[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})['catch'](function(_0x406824){_0x2fa6ec(_0x406824);});});};exports[_0xaa41('0x62')]=function(_0x1f50c,_0x2288f8,_0x57d1f6){_0x1f50c[_0xaa41('0x62')]=!![];return _0x57d1f6();};exports['signToken']=function signToken(_0x49fedd){return signJwt(_0x49fedd);};exports[_0xaa41('0x63')]=function(_0xe0eec0,_0x3e16ef){if(!_0xe0eec0['user']){return _0x3e16ef[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x64')});}var _0x48fa37={'payload':{'id':_0xe0eec0[_0xaa41('0x39')]['id'],'role':_0xe0eec0[_0xaa41('0x39')][_0xaa41('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x48fa37)[_0xaa41('0x47')](function(_0x37fbe2){_0x3e16ef[_0xaa41('0x65')](_0xaa41('0x66'),_0x37fbe2);_0x3e16ef[_0xaa41('0x67')]('/dashboards/general');})[_0xaa41('0x42')](function(_0x5bef5f){return _0x3e16ef['status'](0x1f4)[_0xaa41('0x68')](_0x5bef5f);});};exports[_0xaa41('0x69')]=function(_0x3fef3e){if(_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x54')])||_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x6b')])){return null;}else{return createJwt(_0x3fef3e);}};exports[_0xaa41('0x6c')]=function(_0x519e39){_0x519e39[_0xaa41('0x54')]=generateNonce();_0x519e39[_0xaa41('0x6b')]=generateIssuedAt();return createJwt(_0x519e39);};exports[_0xaa41('0x6d')]=function(_0x4f9e92,_0x2e0f53){var _0x35f664=_0x4f9e92['query'][_0xaa41('0x4e')];if(_0x35f664){var _0xd36d1a={'nonce':_0x2e0f53[_0xaa41('0x54')],'iat':_0x2e0f53['apiKeyIat'],'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};return verifyJwt(_0x35f664,_0xd36d1a)['then'](function(){return generateApiKey(_0x2e0f53);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaa41('0x6e')]=function(_0x3cd14f){var _0x3a29d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3a29d2['test'](_0x3cd14f))throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0xaa41('0x71'));return;};exports[_0xaa41('0x72')]=function(_0x2abb78,_0x5ccdc5,_0x2ae70c){var _0x57cb70=encryptor['decryptString'](_0x5ccdc5)[_0xaa41('0x73')](',');for(var _0x52ae7f=0x0;_0x52ae7f<_0x2ae70c;_0x52ae7f++){if(!_0x57cb70[_0x52ae7f])break;if(_0x2abb78[_0xaa41('0x74')]()===_0x57cb70[_0x52ae7f][_0xaa41('0x74')]()){var _0x169ddf=util['format'](_0xaa41('0x75'),_0x2ae70c);if(_0x2ae70c===0x1){_0x169ddf=_0xaa41('0x76');}throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0x169ddf);}}return;};exports[_0xaa41('0x77')]=function(_0x332a3c,_0xc56018){var _0x337059=_0xc56018?encryptor[_0xaa41('0x78')](_0xc56018)['split'](','):[];if(_0x337059[_0xaa41('0x79')]===0x5){_0x337059[_0xaa41('0x7a')](-0x1,0x1);}_0x337059[_0xaa41('0x7b')](_0x332a3c);return encryptor['encryptString'](_0x337059[_0xaa41('0x7c')](','));};function signJwt(_0x2caf5c){var _0x157898=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x7e')],{'context':jwt});var _0xfbe748=_0x2caf5c[_0xaa41('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x5cb34d,_0x540325){_0x157898(_0x2caf5c['payload'],_0xfbe748,_0x2caf5c['options'])[_0xaa41('0x47')](function(_0x50b598){_0x5cb34d(_0x50b598);})['catch'](function(_0x24c6f3){_0x540325(_0x24c6f3);});});}function verifyJwt(_0x40a524,_0x1a877b,_0x312eee){var _0x5cabc4=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x80')],{'context':jwt});var _0x1ddb6c=_0x312eee||config[_0xaa41('0x81')][_0xaa41('0x82')];return new BPromise(function(_0x41ca40,_0x46ebcd){_0x5cabc4(_0x40a524,_0x1ddb6c,_0x1a877b)[_0xaa41('0x47')](function(_0x1795d1){_0x41ca40(_0x1795d1);})['catch'](function(_0x185600){_0x46ebcd(_0x185600);});});}function generateNonce(){return crypto[_0xaa41('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xaa41('0x84')]()/0x3e8)['toString']();}function createJwt(_0x1eac4a){var _0x5c8028={'payload':{'iat':_0x1eac4a[_0xaa41('0x6b')],'nonce':_0x1eac4a[_0xaa41('0x54')]},'options':{'algorithm':'HS512','subject':_0x1eac4a['id'][_0xaa41('0x85')](),'issuer':hardwareConf[_0xaa41('0x4f')](),'audience':hardwareConf[_0xaa41('0x4f')]()}};return signJwt(_0x5c8028)[_0xaa41('0x47')](function(_0x5a2683){return{'iat':_0x1eac4a['apiKeyIat'],'nonce':_0x1eac4a[_0xaa41('0x54')],'token':_0x5a2683};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 9e753ff..38aec1c 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 _0xc793=['search','ids','count','User','getFilteredContacts','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','./sql-utils','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','fields','where','user','clause','tags','skip','checkListsRestrictions'];(function(_0x215456,_0x15aa5c){var _0x8e0e9e=function(_0x3bb623){while(--_0x3bb623){_0x215456['push'](_0x215456['shift']());}};_0x8e0e9e(++_0x15aa5c);}(_0xc793,0x10a));var _0x3c79=function(_0x589f62,_0x5125b7){_0x589f62=_0x589f62-0x0;var _0x4b70cf=_0xc793[_0x589f62];return _0x4b70cf;};'use strict';var _=require(_0x3c79('0x0'));var sqlUtils=require(_0x3c79('0x1'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x3fb699,_0x599d4c,_0x37e2d0,_0x5e7da3){var _0x1728b2={'count':0x0,'rows':[]};var _0x43a7e5=sqlUtils['skipContactsQuery'](_0x599d4c,_0x3fb699);if(_0x43a7e5){return Promise[_0x3c79('0x2')](_0x1728b2);}var _0x87c6b5=sqlUtils[_0x3c79('0x3')]();var _0x4cbfcc={};var _0x16fad4=![];var _0x2950ea=![];return Promise[_0x3c79('0x2')]()[_0x3c79('0x4')](function(){if(_0x3fb699['search']){return sqlUtils[_0x3c79('0x5')](_0x3fb699['search'],_0x5e7da3);}else{return sqlUtils['parseQueryParameters'](_0x3fb699,_0x5e7da3);}})[_0x3c79('0x4')](function(_0x320538){_0x87c6b5['where'](_0x320538['default']);_0x87c6b5['where'](_0x320538[_0x3c79('0x6')]);_0x87c6b5[_0x3c79('0x7')](_0x320538['filter']);_0x87c6b5[_0x3c79('0x7')](_0x320538[_0x3c79('0x8')][_0x3c79('0x9')]);_0x4cbfcc=_0x320538[_0x3c79('0xa')];_0x2950ea=_0x320538[_0x3c79('0x8')][_0x3c79('0xb')];return sqlUtils[_0x3c79('0xc')](_0x599d4c,_0x3fb699,_0x2950ea);})['then'](function(_0x7509f3){_0x87c6b5[_0x3c79('0x7')](_0x7509f3);var _0x1ac8a6=_0x3fb699[_0x3c79('0xd')]?_0x4cbfcc[_0x3c79('0xe')]:_0x3fb699['tag'];_0x16fad4=_0x1ac8a6?!![]:![];return sqlUtils['countFilteredContacts'](_0x87c6b5,_0x1ac8a6);})['then'](function(_0x553368){_0x1728b2[_0x3c79('0xf')]=_0x553368;if(_0x1728b2[_0x3c79('0xf')]===0x0){return;}if(_0x3fb699[_0x3c79('0x10')]){_0x2950ea=!![];}return sqlUtils['buildContactsQuery'](_0x87c6b5,_0x3fb699['fields'],_0x37e2d0,_0x16fad4,_0x4cbfcc['clause'],_0x2950ea);})[_0x3c79('0x4')](function(_0x3dbea0){if(!_0x3dbea0){return[];}return sqlUtils[_0x3c79('0x11')](_0x3dbea0,_0x3fb699,_0x37e2d0);})[_0x3c79('0x4')](function(_0x4e1732){_0x1728b2['rows']=_0x4e1732;return _0x1728b2;})[_0x3c79('0x12')](function(_0x5966a1){throw _0x5966a1;});};exports[_0x3c79('0x13')]=function(){var _0x5de345={};var _0x298265=[];return db[_0x3c79('0x14')][_0x3c79('0x13')]()['then'](function(_0x19ca41){_0x5de345=_0x19ca41;var _0x468a7b=Object[_0x3c79('0x15')](_0x5de345)['filter'](function(_0x52a514){return _[_0x3c79('0x16')](_0x52a514,_0x3c79('0x17'))?_0x52a514:undefined;});var _0x1d8828=_0x468a7b[_0x3c79('0x18')](function(_0x3ba259){return db[_0x3c79('0x19')][_0x3c79('0x1a')]({'where':{'id':_0x3ba259[_0x3c79('0x1b')](0x3)},'raw':!![]});});return Promise[_0x3c79('0x1c')](_0x1d8828);})[_0x3c79('0x4')](function(_0x30f2ba){for(var _0xeaa3af=0x0;_0xeaa3af<_0x30f2ba['length'];_0xeaa3af++){if(_0x30f2ba[_0xeaa3af]){var _0x94e99f=_0x3c79('0x17')+_0x30f2ba[_0xeaa3af]['id'];_0x5de345[_0x94e99f][_0x3c79('0x1d')]=_0x30f2ba[_0xeaa3af][_0x3c79('0x1e')];}}_0x298265=_[_0x3c79('0x18')](Object[_0x3c79('0x15')](_0x5de345),function(_0x1011ec){return{'name':_0x1011ec,'type':_0x5de345[_0x1011ec]['type']};});return _0x298265;})['catch'](function(_0x3b2533){throw _0x3b2533;});}; \ No newline at end of file +var _0x8685=['buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','findOne','all','fieldType','type','map','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','where','default','fields','filter','tags','user','checkListsRestrictions','tag','countFilteredContacts','count','User'];(function(_0xef706f,_0x138d24){var _0x537510=function(_0x30b437){while(--_0x30b437){_0xef706f['push'](_0xef706f['shift']());}};_0x537510(++_0x138d24);}(_0x8685,0x1bf));var _0x5868=function(_0x1d1085,_0x4d80d0){_0x1d1085=_0x1d1085-0x0;var _0x8d6a74=_0x8685[_0x1d1085];return _0x8d6a74;};'use strict';var _=require(_0x5868('0x0'));var sqlUtils=require(_0x5868('0x1'));var db=require(_0x5868('0x2'))['db'];exports[_0x5868('0x3')]=function(_0x1a9501,_0x4092e8,_0x4ee764,_0xd44fdd){var _0x488b36={'count':0x0,'rows':[]};var _0x120f5d=sqlUtils[_0x5868('0x4')](_0x4092e8,_0x1a9501);if(_0x120f5d){return Promise[_0x5868('0x5')](_0x488b36);}var _0x80780f=sqlUtils[_0x5868('0x6')]();var _0x1a5b0c={};var _0x3469c1=![];var _0x46cecf=![];return Promise[_0x5868('0x5')]()[_0x5868('0x7')](function(){if(_0x1a9501[_0x5868('0x8')]){return sqlUtils[_0x5868('0x9')](_0x1a9501[_0x5868('0x8')],_0xd44fdd);}else{return sqlUtils['parseQueryParameters'](_0x1a9501,_0xd44fdd);}})[_0x5868('0x7')](function(_0x586318){_0x80780f[_0x5868('0xa')](_0x586318[_0x5868('0xb')]);_0x80780f[_0x5868('0xa')](_0x586318[_0x5868('0xc')]);_0x80780f['where'](_0x586318[_0x5868('0xd')]);_0x80780f['where'](_0x586318['user']['clause']);_0x1a5b0c=_0x586318[_0x5868('0xe')];_0x46cecf=_0x586318[_0x5868('0xf')]['skip'];return sqlUtils[_0x5868('0x10')](_0x4092e8,_0x1a9501,_0x46cecf);})['then'](function(_0x5cbf1c){_0x80780f[_0x5868('0xa')](_0x5cbf1c);var _0x2289ee=_0x1a9501[_0x5868('0x8')]?_0x1a5b0c['ids']:_0x1a9501[_0x5868('0x11')];_0x3469c1=_0x2289ee?!![]:![];return sqlUtils[_0x5868('0x12')](_0x80780f,_0x2289ee);})['then'](function(_0x16a358){_0x488b36[_0x5868('0x13')]=_0x16a358;if(_0x488b36[_0x5868('0x13')]===0x0){return;}if(_0x1a9501[_0x5868('0x14')]){_0x46cecf=!![];}return sqlUtils[_0x5868('0x15')](_0x80780f,_0x1a9501[_0x5868('0xc')],_0x4ee764,_0x3469c1,_0x1a5b0c[_0x5868('0x16')],_0x46cecf);})[_0x5868('0x7')](function(_0x19ebd5){if(!_0x19ebd5){return[];}return sqlUtils[_0x5868('0x17')](_0x19ebd5,_0x1a9501,_0x4ee764);})[_0x5868('0x7')](function(_0x13f8b1){_0x488b36[_0x5868('0x18')]=_0x13f8b1;return _0x488b36;})[_0x5868('0x19')](function(_0x3d3334){throw _0x3d3334;});};exports[_0x5868('0x1a')]=function(){var _0x45a937={};var _0x4c86b1=[];return db[_0x5868('0x1b')]['describe']()[_0x5868('0x7')](function(_0x758200){_0x45a937=_0x758200;var _0x485647=Object[_0x5868('0x1c')](_0x45a937)[_0x5868('0xd')](function(_0x5f2c4d){return _[_0x5868('0x1d')](_0x5f2c4d,_0x5868('0x1e'))?_0x5f2c4d:undefined;});var _0x13e2fc=_0x485647['map'](function(_0x28a40d){return db['CmCustomField'][_0x5868('0x1f')]({'where':{'id':_0x28a40d['slice'](0x3)},'raw':!![]});});return Promise[_0x5868('0x20')](_0x13e2fc);})[_0x5868('0x7')](function(_0x207777){for(var _0x56ca8e=0x0;_0x56ca8e<_0x207777['length'];_0x56ca8e++){if(_0x207777[_0x56ca8e]){var _0x12f98b=_0x5868('0x1e')+_0x207777[_0x56ca8e]['id'];_0x45a937[_0x12f98b][_0x5868('0x21')]=_0x207777[_0x56ca8e][_0x5868('0x22')];}}_0x4c86b1=_[_0x5868('0x23')](Object[_0x5868('0x1c')](_0x45a937),function(_0x224494){return{'name':_0x224494,'type':_0x45a937[_0x224494][_0x5868('0x22')]};});return _0x4c86b1;})[_0x5868('0x19')](function(_0xfdbe3){throw _0xfdbe3;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index e0f0fe2..2fecb11 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 _0x8c51=['DATE','type','text','start','value','end','tags','clause','ids','User','and','uc.UserId\x20=\x20?','user','skip','map','some','compact','Contact','push','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','subqry.','DESC','findAll','keyBy','QueryTypes','SELECT','CmContact','query','toString','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','search','autocomplete','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','mobile','fax','email','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','forEach','field','expr','getSelectedTags','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)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','datetime','castTo'];(function(_0x9b7e1c,_0x3680d7){var _0xa3b16=function(_0x5278f9){while(--_0x5278f9){_0x9b7e1c['push'](_0x9b7e1c['shift']());}};_0xa3b16(++_0x3680d7);}(_0x8c51,0x1c9));var _0x18c5=function(_0x14213c,_0x21fdb2){_0x14213c=_0x14213c-0x0;var _0x5c5470=_0x8c51[_0x14213c];return _0x5c5470;};'use strict';var _=require(_0x18c5('0x0'));var squel=require(_0x18c5('0x1'));var as=require(_0x18c5('0x2'));var qs=require('../parsers/qs');var utils=require(_0x18c5('0x3'));var db=require(_0x18c5('0x4'))['db'];function skipContactsQuery(_0x168c0a,_0x1c4fba){var _0x5b7c39=![];if(_0x168c0a[_0x18c5('0x5')]==='agent'&&!_0x1c4fba[_0x18c5('0x6')]&&!_0x1c4fba['ListId']&&_0x1c4fba[_0x18c5('0x7')]!=='true'){_0x5b7c39=!![];}return _0x5b7c39;}function getContactsSubquery(){return squel[_0x18c5('0x8')]()[_0x18c5('0x9')](_0x18c5('0xa'),'c')[_0x18c5('0xb')](_0x18c5('0xc'));}function applyJoinClauses(_0x435707,_0x3fd133){var _0x2185e6=_0x3fd133?'c':_0x18c5('0xd');_0x435707[_0x18c5('0xe')](_0x18c5('0xf'),'uc',_0x18c5('0x10')+_0x2185e6+_0x18c5('0x11'))[_0x18c5('0xe')](_0x18c5('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x2185e6+'.id')[_0x18c5('0xe')]('tools_tags','t',_0x18c5('0x13'));return _0x435707;}function addFieldsToQuery(_0x3cc6cc,_0x105f3d,_0x23c52c,_0x2176bc,_0x5bbb2d){var _0x3c9fd1=_0x5bbb2d?'c':'subqry';if(!_0x105f3d){_0x105f3d=['id',_0x18c5('0x14'),'lastName','phone',_0x18c5('0x15'),_0x18c5('0x16'),_0x18c5('0x17'),_0x18c5('0x18'),_0x18c5('0x19'),_0x18c5('0x1a'),'updatedAt',_0x18c5('0x1b'),_0x18c5('0x1c')];}else if(!_0x105f3d[_0x18c5('0x1d')]('id')){_0x105f3d['push']('id');}var _0x4454d1=_0x23c52c&&_0x5bbb2d||!_0x23c52c&&!_0x5bbb2d;if(_0x2176bc){_0x4454d1=_0x2176bc&&_0x5bbb2d||!_0x2176bc&&!_0x5bbb2d;}_0x105f3d[_0x18c5('0x1e')](function(_0x3bc0f8){if(_0x3bc0f8===_0x18c5('0x1c')){if(_0x4454d1){_0x3cc6cc['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3bc0f8);}else if(_0x23c52c||_0x2176bc){_0x3cc6cc[_0x18c5('0x1f')](_0x3c9fd1+'.'+_0x3bc0f8);}}else{_0x3cc6cc[_0x18c5('0x1f')](_0x3c9fd1+'.'+_0x3bc0f8);}});return _0x3cc6cc;}function getSqlClauses(){var _0x15f706={'default':squel['expr'](),'fields':squel[_0x18c5('0x20')](),'filter':squel[_0x18c5('0x20')](),'tags':{'clause':squel[_0x18c5('0x20')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x15f706;}function parseTagParameter(_0x49f413){var _0x1151a8=squel['expr']();if(_0x49f413){var _0x12ebae=utils[_0x18c5('0x21')](_0x49f413);_0x12ebae[_0x18c5('0x1e')](function(_0x224829){_0x1151a8['or'](_0x18c5('0x22'),'%,'+_0x224829+',%');});}return _0x1151a8;}function parseSearchFilter(_0x3dedea){var _0x3baee1=squel[_0x18c5('0x20')]();if(_0x3dedea){var _0x523c65=_0x3dedea[_0x18c5('0x23')]('\x5c','\x5c\x5c')[_0x18c5('0x23')](/'/g,'\x27\x27');if(_0x523c65[_0x18c5('0x24')]('\x20')[_0x18c5('0x25')]>0x1){_0x3baee1['or'](_0x18c5('0x26'),qs[_0x18c5('0x27')](_0x523c65,!![]),null);}else{if(qs[_0x18c5('0x28')](_0x523c65)){_0x3baee1['or'](_0x18c5('0x29'),_0x523c65+'%');_0x3baee1['or']('c.phone\x20LIKE\x20?',_0x523c65+'%');_0x3baee1['or'](_0x18c5('0x2a'),_0x523c65+'%');_0x3baee1['or']('c.fax\x20LIKE\x20?',_0x523c65+'%');}else if(qs[_0x18c5('0x2b')](_0x523c65)){_0x3baee1['or']('c.email\x20LIKE\x20?',_0x523c65+'%');}else{_0x3baee1['or'](_0x18c5('0x2c'),'%'+_0x523c65+'%');_0x3baee1['or']('c.lastName\x20LIKE\x20?','%'+_0x523c65+'%');_0x3baee1['or'](_0x18c5('0x2d'),'%'+_0x523c65+'%');}}}return _0x3baee1;}function parseAdvancedSearchFilter(_0x2cfa80,_0x2b40c0){var _0x5228eb=getSqlClauses();var _0x3657c7=as[_0x18c5('0x2e')](_0x2cfa80);var _0x1ab002=_0x3657c7['sqlOperator'];for(var _0x529b09=0x0;_0x529b09<_0x3657c7[_0x18c5('0x2f')][_0x18c5('0x25')];_0x529b09++){var _0x1b0534=_0x3657c7[_0x18c5('0x2f')][_0x529b09];var _0x5bace5='c';var _0x32084=_[_0x18c5('0x30')](_0x2b40c0,[_0x18c5('0x31'),_0x1b0534[_0x18c5('0x1f')]]);if(_0x32084){if(_0x1b0534[_0x18c5('0x1f')]===_0x18c5('0x32')||_0x32084['fieldType']===_0x18c5('0x33')){_0x1b0534[_0x18c5('0x34')]=_0x18c5('0x35');}var _0x41a68a=as['buildExpression'](_0x5bace5,_0x32084[_0x18c5('0x36')],_0x1b0534);_0x5228eb['default'][_0x1ab002](_0x41a68a[_0x18c5('0x37')],_0x41a68a['value'][_0x18c5('0x38')],_0x41a68a[_0x18c5('0x39')][_0x18c5('0x3a')]);}else{if(_0x1b0534[_0x18c5('0x1f')]==='Tag'){var _0x505b5c=_0x1b0534[_0x18c5('0x39')][_0x18c5('0x24')](',')['map'](function(_0x5c5bb3){return Number(_0x5c5bb3);});var _0x18c1f3=parseTagParameter(_0x505b5c);_0x5228eb[_0x18c5('0x3b')][_0x18c5('0x3c')]['and'](_0x18c1f3);_0x5228eb[_0x18c5('0x3b')][_0x18c5('0x3d')]=_0x505b5c;}else if(_0x1b0534[_0x18c5('0x1f')]===_0x18c5('0x3e')){_0x5228eb['user'][_0x18c5('0x3c')][_0x18c5('0x3f')](_0x18c5('0x40'),_0x1b0534[_0x18c5('0x39')]);_0x5228eb[_0x18c5('0x41')][_0x18c5('0x42')]=!![];}}}return _0x5228eb;}function parseModelFields(_0x580625,_0x5ba7a2){var _0x1c67fc=squel[_0x18c5('0x20')]();var _0x339d8d=_(_0x580625)['keys']()[_0x18c5('0x43')](function(_0x3a3661){return _[_0x18c5('0x44')](_0x5ba7a2,[_0x18c5('0x31'),_0x3a3661])?_0x3a3661:undefined;})[_0x18c5('0x45')]()[_0x18c5('0x39')]();if(_0x580625[_0x18c5('0x46')]){_0x339d8d[_0x18c5('0x47')](_0x18c5('0x46'));}if(_0x580625[_0x18c5('0x3e')]){_0x339d8d[_0x18c5('0x47')](_0x18c5('0x3e'));}if(_0x339d8d[_0x18c5('0x25')]>0x0){_0x339d8d[_0x18c5('0x1e')](function(_0xf4c9f8){if(_0xf4c9f8===_0x18c5('0x18')){_0x1c67fc[_0x18c5('0x3f')](_0x18c5('0x48'),[]['concat'](_0x580625[_0xf4c9f8]));}else if(_0xf4c9f8===_0x18c5('0x46')){var _0x501e2e='%'+_0x580625[_0xf4c9f8]+'%';_0x1c67fc['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x501e2e);}else if(_0xf4c9f8===_0x18c5('0x3e')){_0x1c67fc['and'](_0x18c5('0x40'),_0x580625[_0xf4c9f8]);}else{_0x1c67fc[_0x18c5('0x3f')]('c.'+_0xf4c9f8+_0x18c5('0x49'),_0x580625[_0xf4c9f8]);}});}return _0x1c67fc;}function parseQueryParameters(_0x4da0ff,_0x16c6b0){var _0x52dc8a=getSqlClauses();return Promise[_0x18c5('0x4a')]()[_0x18c5('0x4b')](function(){return parseModelFields(_0x4da0ff,_0x16c6b0);})['then'](function(_0x8e3f5f){_0x52dc8a['fields']['and'](_0x8e3f5f);return parseTagParameter(_0x4da0ff[_0x18c5('0x4c')]);})[_0x18c5('0x4b')](function(_0x46fd8f){_0x52dc8a[_0x18c5('0x3b')][_0x18c5('0x3c')][_0x18c5('0x3f')](_0x46fd8f);return parseSearchFilter(_0x4da0ff[_0x18c5('0x4d')]);})['then'](function(_0x1c3b86){_0x52dc8a[_0x18c5('0x4d')]=_0x1c3b86;return _0x52dc8a;});}function checkListsRestrictions(_0x748d45,_0x57d1a6,_0x2684e8){var _0x3b0d3f=squel[_0x18c5('0x20')]();return Promise[_0x18c5('0x4a')]()[_0x18c5('0x4b')](function(){if(_0x57d1a6[_0x18c5('0x6')]&&_0x748d45[_0x18c5('0x5')]===_0x18c5('0x4e')&&!_0x2684e8){return _0x748d45[_0x18c5('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x92cb4c){if(_0x92cb4c){if(_0x92cb4c[_0x18c5('0x25')]===0x0){_0x3b0d3f[_0x18c5('0x3f')](_0x18c5('0x50'));}else{_0x3b0d3f[_0x18c5('0x3f')](_0x18c5('0x48'),_[_0x18c5('0x43')](_0x92cb4c,'id'));}}})[_0x18c5('0x4b')](function(){return _0x3b0d3f;});}function buildContactsQuery(_0x31e25f,_0x2ef9e5,_0x1e994a,_0x1b2162,_0x44d0f1,_0x5569c4){if(_0x2ef9e5){_0x2ef9e5=_0x1e994a[_0x18c5('0x51')];}_0x31e25f=addFieldsToQuery(_0x31e25f,_0x2ef9e5,_0x1b2162,_0x5569c4,!![]);var _0x260117=squel[_0x18c5('0x8')]();_0x260117=addFieldsToQuery(_0x260117,_0x2ef9e5,_0x1b2162,_0x5569c4,![]);if(_0x1b2162||_0x5569c4){_0x31e25f=applyJoinClauses(_0x31e25f,!![]);_0x31e25f[_0x18c5('0x52')]('c.id');if(_0x1e994a[_0x18c5('0x53')]){_0x260117[_0x18c5('0x53')](_0x1e994a[_0x18c5('0x53')]);}if(_0x1e994a['offset']){_0x260117[_0x18c5('0x54')](_0x1e994a[_0x18c5('0x54')]);}}else{_0x260117=applyJoinClauses(_0x260117,![]);_0x260117['group'](_0x18c5('0x55'));if(_0x1e994a[_0x18c5('0x53')]){_0x31e25f['limit'](_0x1e994a['limit']);}if(_0x1e994a['offset']){_0x31e25f[_0x18c5('0x54')](_0x1e994a['offset']);}}_0x260117[_0x18c5('0x56')](_0x44d0f1);if(_0x1e994a[_0x18c5('0x57')]){_0x1e994a[_0x18c5('0x57')][_0x18c5('0x1e')](function(_0x829635){_0x31e25f['order']('c.'+_0x829635[0x0],_0x829635[0x1]==='DESC'?![]:!![]);_0x260117['order'](_0x18c5('0x58')+_0x829635[0x0],_0x829635[0x1]===_0x18c5('0x59')?![]:!![]);});}_0x260117[_0x18c5('0x9')](_0x31e25f,_0x18c5('0xd'));return _0x260117;}function getFilteredContacts(_0x35d698){var _0x4454e1=[];return db['Tag'][_0x18c5('0x5a')]({'attributes':['id','name','color'],'raw':!![]})[_0x18c5('0x4b')](function(_0x12091b){_0x4454e1=_[_0x18c5('0x5b')](_0x12091b,'id');var _0x3d0f12={'type':db['Sequelize'][_0x18c5('0x5c')][_0x18c5('0x5d')],'model':db[_0x18c5('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x18c5('0x5f')](_0x35d698[_0x18c5('0x60')](),_0x3d0f12);})[_0x18c5('0x4b')](function(_0x19dbb0){_0x19dbb0['forEach'](function(_0x2e9e2a){if(_0x2e9e2a[_0x18c5('0x1c')]){_0x2e9e2a['Tags']=[];_0x2e9e2a[_0x18c5('0x1c')][_0x18c5('0x24')](',')[_0x18c5('0x1e')](function(_0x114299){_0x2e9e2a['Tags'][_0x18c5('0x47')](_0x4454e1[_0x114299]);});}delete _0x2e9e2a[_0x18c5('0x1c')];});return _0x19dbb0;});}function countFilteredContacts(_0x3d4c00,_0x4c29c3){var _0x572dcc=_0x3d4c00['clone']();_0x572dcc['field'](_0x18c5('0x61'));_0x572dcc=applyJoinClauses(_0x572dcc,!![]);_0x3d4c00[_0x18c5('0x52')]('c.id');var _0x5cdb10=utils['getSelectedTags'](_0x4c29c3);if(!_[_0x18c5('0x62')](_0x5cdb10)){_0x572dcc[_0x18c5('0xb')](_0x18c5('0x63'),_0x5cdb10);}var _0x2bbaf5={'type':db['Sequelize'][_0x18c5('0x5c')]['SELECT'],'raw':!![]};return db[_0x18c5('0x64')][_0x18c5('0x5f')](_0x572dcc['toString'](),_0x2bbaf5)[_0x18c5('0x4b')](function(_0x384c46){return _0x384c46[0x0]['COUNT(*)'];});}module[_0x18c5('0x65')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xb214=['email','CompanyId','updatedAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','fieldType','datetime','castTo','DATE','buildExpression','default','text','value','start','end','split','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','keys','some','compact','push','Contact','c.ListId\x20IN\x20?','resolve','then','tag','filter','getLists','attributes','group','c.id','limit','offset','having','order','DESC','subqry.','Tag','color','keyBy','Sequelize','QueryTypes','sequelize','query','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','from','cm_contacts','where','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','mobile','fax'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0xb214,0x1e8));var _0x4b21=function(_0x573746,_0x129598){_0x573746=_0x573746-0x0;var _0x58f4c4=_0xb214[_0x573746];return _0x58f4c4;};'use strict';var _=require(_0x4b21('0x0'));var squel=require(_0x4b21('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x4b21('0x2'));var utils=require(_0x4b21('0x3'));var db=require(_0x4b21('0x4'))['db'];function skipContactsQuery(_0x3d65c7,_0x467f6b){var _0x31f557=![];if(_0x3d65c7[_0x4b21('0x5')]==='agent'&&!_0x467f6b[_0x4b21('0x6')]&&!_0x467f6b[_0x4b21('0x7')]&&_0x467f6b[_0x4b21('0x8')]!==_0x4b21('0x9')){_0x31f557=!![];}return _0x31f557;}function getContactsSubquery(){return squel['select']()[_0x4b21('0xa')](_0x4b21('0xb'),'c')[_0x4b21('0xc')](_0x4b21('0xd'));}function applyJoinClauses(_0x420031,_0x4cb8f1){var _0x5d5d0f=_0x4cb8f1?'c':_0x4b21('0xe');_0x420031[_0x4b21('0xf')](_0x4b21('0x10'),'uc',_0x4b21('0x11')+_0x5d5d0f+_0x4b21('0x12'))['left_join'](_0x4b21('0x13'),'ct',_0x4b21('0x14')+_0x5d5d0f+_0x4b21('0x12'))['left_join'](_0x4b21('0x15'),'t',_0x4b21('0x16'));return _0x420031;}function addFieldsToQuery(_0x2ba5fd,_0x255891,_0x3f3216,_0x2fb288,_0x37b0aa){var _0xb9579e=_0x37b0aa?'c':'subqry';if(!_0x255891){_0x255891=['id',_0x4b21('0x17'),_0x4b21('0x18'),'phone',_0x4b21('0x19'),_0x4b21('0x1a'),_0x4b21('0x1b'),_0x4b21('0x7'),_0x4b21('0x1c'),'createdAt',_0x4b21('0x1d'),_0x4b21('0x1e'),_0x4b21('0x1f')];}else if(!_0x255891[_0x4b21('0x20')]('id')){_0x255891['push']('id');}var _0x3e809f=_0x3f3216&&_0x37b0aa||!_0x3f3216&&!_0x37b0aa;if(_0x2fb288){_0x3e809f=_0x2fb288&&_0x37b0aa||!_0x2fb288&&!_0x37b0aa;}_0x255891[_0x4b21('0x21')](function(_0xa6cb4d){if(_0xa6cb4d===_0x4b21('0x1f')){if(_0x3e809f){_0x2ba5fd[_0x4b21('0x22')](_0x4b21('0x23'),_0xa6cb4d);}else if(_0x3f3216||_0x2fb288){_0x2ba5fd[_0x4b21('0x22')](_0xb9579e+'.'+_0xa6cb4d);}}else{_0x2ba5fd[_0x4b21('0x22')](_0xb9579e+'.'+_0xa6cb4d);}});return _0x2ba5fd;}function getSqlClauses(){var _0x42d5c7={'default':squel['expr'](),'fields':squel[_0x4b21('0x24')](),'filter':squel[_0x4b21('0x24')](),'tags':{'clause':squel[_0x4b21('0x24')](),'ids':null},'user':{'clause':squel[_0x4b21('0x24')](),'skip':![]}};return _0x42d5c7;}function parseTagParameter(_0x5be337){var _0x54c380=squel[_0x4b21('0x24')]();if(_0x5be337){var _0x5baf0e=utils[_0x4b21('0x25')](_0x5be337);_0x5baf0e[_0x4b21('0x21')](function(_0x1c55b3){_0x54c380['or'](_0x4b21('0x26'),'%,'+_0x1c55b3+',%');});}return _0x54c380;}function parseSearchFilter(_0x3ed0da){var _0x32886e=squel['expr']();if(_0x3ed0da){var _0x557934=_0x3ed0da[_0x4b21('0x27')]('\x5c','\x5c\x5c')[_0x4b21('0x27')](/'/g,'\x27\x27');if(_0x557934['split']('\x20')[_0x4b21('0x28')]>0x1){_0x32886e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x557934,!![]),null);}else{if(qs['isNumeric'](_0x557934)){_0x32886e['or'](_0x4b21('0x29'),_0x557934+'%');_0x32886e['or'](_0x4b21('0x2a'),_0x557934+'%');_0x32886e['or'](_0x4b21('0x2b'),_0x557934+'%');_0x32886e['or']('c.fax\x20LIKE\x20?',_0x557934+'%');}else if(qs[_0x4b21('0x2c')](_0x557934)){_0x32886e['or']('c.email\x20LIKE\x20?',_0x557934+'%');}else{_0x32886e['or'](_0x4b21('0x2d'),'%'+_0x557934+'%');_0x32886e['or'](_0x4b21('0x2e'),'%'+_0x557934+'%');_0x32886e['or'](_0x4b21('0x2f'),'%'+_0x557934+'%');}}}return _0x32886e;}function parseAdvancedSearchFilter(_0x4ea3ba,_0x471a56){var _0x1d24a2=getSqlClauses();var _0x44fc91=as[_0x4b21('0x30')](_0x4ea3ba);var _0x312652=_0x44fc91[_0x4b21('0x31')];for(var _0x443211=0x0;_0x443211<_0x44fc91[_0x4b21('0x32')]['length'];_0x443211++){var _0x3d1562=_0x44fc91['conditions'][_0x443211];var _0x110d4b='c';var _0x593350=_['find'](_0x471a56,[_0x4b21('0x33'),_0x3d1562[_0x4b21('0x22')]]);if(_0x593350){if(_0x3d1562[_0x4b21('0x22')]==='dateOfBirth'||_0x593350[_0x4b21('0x34')]===_0x4b21('0x35')){_0x3d1562[_0x4b21('0x36')]=_0x4b21('0x37');}var _0x34d7cb=as[_0x4b21('0x38')](_0x110d4b,_0x593350['type'],_0x3d1562);_0x1d24a2[_0x4b21('0x39')][_0x312652](_0x34d7cb[_0x4b21('0x3a')],_0x34d7cb[_0x4b21('0x3b')][_0x4b21('0x3c')],_0x34d7cb['value'][_0x4b21('0x3d')]);}else{if(_0x3d1562['field']==='Tag'){var _0x3bb776=_0x3d1562[_0x4b21('0x3b')][_0x4b21('0x3e')](',')[_0x4b21('0x3f')](function(_0x10af26){return Number(_0x10af26);});var _0x3f43a6=parseTagParameter(_0x3bb776);_0x1d24a2[_0x4b21('0x40')][_0x4b21('0x41')][_0x4b21('0x42')](_0x3f43a6);_0x1d24a2['tags'][_0x4b21('0x43')]=_0x3bb776;}else if(_0x3d1562['field']===_0x4b21('0x44')){_0x1d24a2['user'][_0x4b21('0x41')][_0x4b21('0x42')](_0x4b21('0x45'),_0x3d1562[_0x4b21('0x3b')]);_0x1d24a2[_0x4b21('0x46')]['skip']=!![];}}}return _0x1d24a2;}function parseModelFields(_0x364836,_0x194fb8){var _0x32d7fe=squel['expr']();var _0x1e1803=_(_0x364836)[_0x4b21('0x47')]()[_0x4b21('0x3f')](function(_0x53f5b7){return _[_0x4b21('0x48')](_0x194fb8,[_0x4b21('0x33'),_0x53f5b7])?_0x53f5b7:undefined;})[_0x4b21('0x49')]()[_0x4b21('0x3b')]();if(_0x364836['Contact']){_0x1e1803[_0x4b21('0x4a')](_0x4b21('0x4b'));}if(_0x364836[_0x4b21('0x44')]){_0x1e1803['push']('User');}if(_0x1e1803[_0x4b21('0x28')]>0x0){_0x1e1803[_0x4b21('0x21')](function(_0x38779b){if(_0x38779b==='ListId'){_0x32d7fe[_0x4b21('0x42')](_0x4b21('0x4c'),[]['concat'](_0x364836[_0x38779b]));}else if(_0x38779b===_0x4b21('0x4b')){var _0x282610='%'+_0x364836[_0x38779b]+'%';_0x32d7fe[_0x4b21('0x42')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x282610);}else if(_0x38779b===_0x4b21('0x44')){_0x32d7fe[_0x4b21('0x42')](_0x4b21('0x45'),_0x364836[_0x38779b]);}else{_0x32d7fe[_0x4b21('0x42')]('c.'+_0x38779b+'\x20=\x20?',_0x364836[_0x38779b]);}});}return _0x32d7fe;}function parseQueryParameters(_0x376288,_0xb8d874){var _0x1f906b=getSqlClauses();return Promise[_0x4b21('0x4d')]()[_0x4b21('0x4e')](function(){return parseModelFields(_0x376288,_0xb8d874);})[_0x4b21('0x4e')](function(_0x473b19){_0x1f906b['fields'][_0x4b21('0x42')](_0x473b19);return parseTagParameter(_0x376288[_0x4b21('0x4f')]);})['then'](function(_0xb69517){_0x1f906b['tags'][_0x4b21('0x41')][_0x4b21('0x42')](_0xb69517);return parseSearchFilter(_0x376288[_0x4b21('0x50')]);})[_0x4b21('0x4e')](function(_0x10a4b5){_0x1f906b[_0x4b21('0x50')]=_0x10a4b5;return _0x1f906b;});}function checkListsRestrictions(_0x22a6c7,_0x461c1f,_0x34e2a2){var _0x55f45c=squel[_0x4b21('0x24')]();return Promise[_0x4b21('0x4d')]()[_0x4b21('0x4e')](function(){if(_0x461c1f[_0x4b21('0x6')]&&_0x22a6c7[_0x4b21('0x5')]==='agent'&&!_0x34e2a2){return _0x22a6c7[_0x4b21('0x51')]({'attributes':['id'],'raw':!![]});}})[_0x4b21('0x4e')](function(_0x427c7f){if(_0x427c7f){if(_0x427c7f[_0x4b21('0x28')]===0x0){_0x55f45c[_0x4b21('0x42')]('c.ListId\x20IS\x20NULL');}else{_0x55f45c[_0x4b21('0x42')]('c.ListId\x20IN\x20?',_[_0x4b21('0x3f')](_0x427c7f,'id'));}}})[_0x4b21('0x4e')](function(){return _0x55f45c;});}function buildContactsQuery(_0x130485,_0x5c2b7d,_0x1e86ab,_0x18632e,_0x4d23bf,_0x5d52e9){if(_0x5c2b7d){_0x5c2b7d=_0x1e86ab[_0x4b21('0x52')];}_0x130485=addFieldsToQuery(_0x130485,_0x5c2b7d,_0x18632e,_0x5d52e9,!![]);var _0x39ff1d=squel['select']();_0x39ff1d=addFieldsToQuery(_0x39ff1d,_0x5c2b7d,_0x18632e,_0x5d52e9,![]);if(_0x18632e||_0x5d52e9){_0x130485=applyJoinClauses(_0x130485,!![]);_0x130485[_0x4b21('0x53')](_0x4b21('0x54'));if(_0x1e86ab['limit']){_0x39ff1d['limit'](_0x1e86ab[_0x4b21('0x55')]);}if(_0x1e86ab['offset']){_0x39ff1d['offset'](_0x1e86ab['offset']);}}else{_0x39ff1d=applyJoinClauses(_0x39ff1d,![]);_0x39ff1d['group']('subqry.id');if(_0x1e86ab['limit']){_0x130485[_0x4b21('0x55')](_0x1e86ab[_0x4b21('0x55')]);}if(_0x1e86ab['offset']){_0x130485[_0x4b21('0x56')](_0x1e86ab[_0x4b21('0x56')]);}}_0x39ff1d[_0x4b21('0x57')](_0x4d23bf);if(_0x1e86ab[_0x4b21('0x58')]){_0x1e86ab[_0x4b21('0x58')][_0x4b21('0x21')](function(_0x29e2c3){_0x130485[_0x4b21('0x58')]('c.'+_0x29e2c3[0x0],_0x29e2c3[0x1]===_0x4b21('0x59')?![]:!![]);_0x39ff1d[_0x4b21('0x58')](_0x4b21('0x5a')+_0x29e2c3[0x0],_0x29e2c3[0x1]==='DESC'?![]:!![]);});}_0x39ff1d[_0x4b21('0xa')](_0x130485,_0x4b21('0xe'));return _0x39ff1d;}function getFilteredContacts(_0x4b6893){var _0x3f140d=[];return db[_0x4b21('0x5b')]['findAll']({'attributes':['id',_0x4b21('0x33'),_0x4b21('0x5c')],'raw':!![]})['then'](function(_0x57ba58){_0x3f140d=_[_0x4b21('0x5d')](_0x57ba58,'id');var _0x14f712={'type':db[_0x4b21('0x5e')][_0x4b21('0x5f')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4b21('0x60')][_0x4b21('0x61')](_0x4b6893['toString'](),_0x14f712);})[_0x4b21('0x4e')](function(_0x4cff4){_0x4cff4['forEach'](function(_0x48a782){if(_0x48a782[_0x4b21('0x1f')]){_0x48a782['Tags']=[];_0x48a782[_0x4b21('0x1f')][_0x4b21('0x3e')](',')[_0x4b21('0x21')](function(_0x2514d5){_0x48a782['Tags'][_0x4b21('0x4a')](_0x3f140d[_0x2514d5]);});}delete _0x48a782['TagIds'];});return _0x4cff4;});}function countFilteredContacts(_0x5328d7,_0x58be42){var _0x2891ab=_0x5328d7['clone']();_0x2891ab[_0x4b21('0x22')](_0x4b21('0x62'));_0x2891ab=applyJoinClauses(_0x2891ab,!![]);_0x5328d7[_0x4b21('0x53')](_0x4b21('0x54'));var _0x2854d2=utils[_0x4b21('0x25')](_0x58be42);if(!_[_0x4b21('0x63')](_0x2854d2)){_0x2891ab[_0x4b21('0xc')](_0x4b21('0x64'),_0x2854d2);}var _0x5341e2={'type':db[_0x4b21('0x5e')]['QueryTypes'][_0x4b21('0x65')],'raw':!![]};return db[_0x4b21('0x60')][_0x4b21('0x61')](_0x2891ab['toString'](),_0x5341e2)[_0x4b21('0x4e')](function(_0x329663){return _0x329663[0x0]['COUNT(*)'];});}module[_0x4b21('0x66')]={'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 4b5cc37..493da11 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 _0x0c52=['secret','createDecipher','crypto','bluebird','lodash','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','binary','write','end','final','close','unlink','createReadStream','createWriteStream','utf8','base64','decryptString'];(function(_0xd3ddd9,_0x58c14f){var _0x541ca7=function(_0x3a6905){while(--_0x3a6905){_0xd3ddd9['push'](_0xd3ddd9['shift']());}};_0x541ca7(++_0x58c14f);}(_0x0c52,0x156));var _0x20c5=function(_0xf13059,_0x124679){_0xf13059=_0xf13059-0x0;var _0xb66aca=_0x0c52[_0xf13059];return _0xb66aca;};'use strict';var crypto=require(_0x20c5('0x0'));var fs=require('fs');var BPromise=require(_0x20c5('0x1'));var _=require(_0x20c5('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x20c5('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x20c5('0x4')][_0x20c5('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x20c5('0x6')};if(config[_0x20c5('0x7')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x20c5('0x7')]['algorithm']);if(isSupported){fileOptions[_0x20c5('0x8')]=config[_0x20c5('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x20c5('0x9')](',\x20');logger[_0x20c5('0xa')](config[_0x20c5('0x7')][_0x20c5('0x8')],_0x20c5('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x34607c){return AES_SUPPORTED_RX[_0x20c5('0xc')](_0x34607c);}function getSupportedCiphers(){return crypto[_0x20c5('0xd')]()[_0x20c5('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x4fe071){return getSupportedCiphers()[_0x20c5('0xf')](_0x4fe071)>-0x1;}function combineOptions(_0xb615b6){var _0x35113f={};for(var _0x1b68d8 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1b68d8)){_0x35113f[_0x1b68d8]=fileOptions[_0x1b68d8];}}if(_0xb615b6){for(var _0x2c864c in _0xb615b6){if(_0xb615b6[_0x20c5('0x10')](_0x2c864c)){_0x35113f[_0x2c864c]=_0xb615b6[_0x2c864c];}}}return _0x35113f;}exports[_0x20c5('0x11')]=function(_0x23186e,_0x3967a3,_0x2e3542,_0x1adeeb){return new BPromise(function(_0x27011b,_0x2a4366){_0x1adeeb=combineOptions(_0x1adeeb);var _0x5659b4=new Buffer(_0x2e3542);var _0x5aa4b7=fs['createReadStream'](_0x23186e);var _0x3ed511=fs['createWriteStream'](_0x3967a3);var _0x4be673=crypto[_0x20c5('0x12')](_0x1adeeb['algorithm'],_0x5659b4);_0x5aa4b7['on'](_0x20c5('0x13'),function(_0x6572bb){var _0x2f0605=new Buffer(_0x4be673[_0x20c5('0x14')](_0x6572bb),_0x20c5('0x15'));_0x3ed511[_0x20c5('0x16')](_0x2f0605);});_0x5aa4b7['on'](_0x20c5('0x17'),function(){try{var _0xb70378=new Buffer(_0x4be673[_0x20c5('0x18')](_0x20c5('0x15')),'binary');_0x3ed511['write'](_0xb70378);_0x3ed511[_0x20c5('0x17')]();_0x3ed511['on'](_0x20c5('0x19'),function(){return _0x27011b(_0x3967a3);});}catch(_0x564d51){fs[_0x20c5('0x1a')](_0x3967a3);return _0x2a4366(_0x564d51);}});});};exports['decryptFile']=function(_0x45599a,_0x15ffb4,_0x55eefa,_0x36a1b2){return new BPromise(function(_0x336c4f,_0x1d02b0){_0x36a1b2=combineOptions(_0x36a1b2);var _0x583df5=new Buffer(_0x55eefa);var _0x136f5=fs[_0x20c5('0x1b')](_0x45599a);var _0x3dc61e=fs[_0x20c5('0x1c')](_0x15ffb4);var _0x194123=crypto['createDecipher'](_0x36a1b2[_0x20c5('0x8')],_0x583df5);_0x136f5['on'](_0x20c5('0x13'),function(_0x17639b){var _0x395b7b=new Buffer(_0x194123[_0x20c5('0x14')](_0x17639b),_0x20c5('0x15'));_0x3dc61e['write'](_0x395b7b);});_0x136f5['on'](_0x20c5('0x17'),function(){try{var _0x1bc66f=new Buffer(_0x194123[_0x20c5('0x18')]('binary'),'binary');_0x3dc61e[_0x20c5('0x16')](_0x1bc66f);_0x3dc61e['end']();_0x3dc61e['on'](_0x20c5('0x19'),function(){return _0x336c4f(_0x15ffb4);});}catch(_0x1fc355){fs['unlink'](_0x15ffb4);return _0x1d02b0(_0x1fc355);}});});};exports['encryptString']=function(_0x2751e3,_0x25e825,_0x45140f){var _0x205ddb=_0x45140f||stringOptions[_0x20c5('0x8')];var _0x4369b3=_0x25e825||stringOptions['secret'];var _0x44f080=crypto[_0x20c5('0x12')](_0x205ddb,_0x4369b3);var _0xd52282=_0x44f080[_0x20c5('0x14')](_0x2751e3,_0x20c5('0x1d'),_0x20c5('0x1e'));_0xd52282+=_0x44f080['final'](_0x20c5('0x1e'));return _0xd52282;};exports[_0x20c5('0x1f')]=function(_0x35ed80,_0x1d8e15,_0x544635){var _0x41d7b2=_0x544635||stringOptions[_0x20c5('0x8')];var _0x5dfa53=_0x1d8e15||stringOptions[_0x20c5('0x20')];var _0x3f7da1=crypto[_0x20c5('0x21')](_0x41d7b2,_0x5dfa53);var _0x3c8b71=_0x3f7da1[_0x20c5('0x14')](_0x35ed80,'base64','utf8');_0x3c8b71+=_0x3f7da1[_0x20c5('0x18')](_0x20c5('0x1d'));return _0x3c8b71;}; \ No newline at end of file +var _0xa69e=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','final','close','createDecipher','unlink','encryptString','secret','base64','decryptString','utf8','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192'];(function(_0x3d542c,_0x2098ae){var _0x4946de=function(_0x51171f){while(--_0x51171f){_0x3d542c['push'](_0x3d542c['shift']());}};_0x4946de(++_0x2098ae);}(_0xa69e,0x178));var _0xea69=function(_0x1f6a2f,_0x8eb8d6){_0x1f6a2f=_0x1f6a2f-0x0;var _0x3b25d1=_0xa69e[_0x1f6a2f];return _0x3b25d1;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xea69('0x0'));var config=require(_0xea69('0x1'));var logger=require(_0xea69('0x2'))(_0xea69('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xea69('0x4')][_0xea69('0x5')],'algorithm':_0xea69('0x6')};const fileOptions={'algorithm':_0xea69('0x7')};if(config[_0xea69('0x8')]&&config['encrypt'][_0xea69('0x9')]){var isSupported=isAlgorithmSupported(config[_0xea69('0x8')]['algorithm']);if(isSupported){fileOptions[_0xea69('0x9')]=config[_0xea69('0x8')][_0xea69('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xea69('0xa')](',\x20');logger[_0xea69('0xb')](config['encrypt'][_0xea69('0x9')],_0xea69('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2ed468){return AES_SUPPORTED_RX['test'](_0x2ed468);}function getSupportedCiphers(){return crypto[_0xea69('0xd')]()[_0xea69('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0xe65a75){return getSupportedCiphers()['indexOf'](_0xe65a75)>-0x1;}function combineOptions(_0x3ff4db){var _0x26a129={};for(var _0xc33615 in fileOptions){if(fileOptions['hasOwnProperty'](_0xc33615)){_0x26a129[_0xc33615]=fileOptions[_0xc33615];}}if(_0x3ff4db){for(var _0x3d5114 in _0x3ff4db){if(_0x3ff4db['hasOwnProperty'](_0x3d5114)){_0x26a129[_0x3d5114]=_0x3ff4db[_0x3d5114];}}}return _0x26a129;}exports[_0xea69('0xf')]=function(_0x3f7b15,_0x35579d,_0x2fb8bd,_0x9615d7){return new BPromise(function(_0x3ef7ae,_0x52a290){_0x9615d7=combineOptions(_0x9615d7);var _0x10eef6=new Buffer(_0x2fb8bd);var _0x3abf73=fs[_0xea69('0x10')](_0x3f7b15);var _0x59388b=fs[_0xea69('0x11')](_0x35579d);var _0x260eaa=crypto['createCipher'](_0x9615d7[_0xea69('0x9')],_0x10eef6);_0x3abf73['on'](_0xea69('0x12'),function(_0x17d727){var _0x498ce7=new Buffer(_0x260eaa[_0xea69('0x13')](_0x17d727),_0xea69('0x14'));_0x59388b[_0xea69('0x15')](_0x498ce7);});_0x3abf73['on'](_0xea69('0x16'),function(){try{var _0x5682fe=new Buffer(_0x260eaa[_0xea69('0x17')](_0xea69('0x14')),_0xea69('0x14'));_0x59388b['write'](_0x5682fe);_0x59388b['end']();_0x59388b['on'](_0xea69('0x18'),function(){return _0x3ef7ae(_0x35579d);});}catch(_0x5eaca3){fs['unlink'](_0x35579d);return _0x52a290(_0x5eaca3);}});});};exports['decryptFile']=function(_0x3af247,_0xc3c92e,_0x21eb10,_0x482f63){return new BPromise(function(_0x4ddb44,_0x41f8e1){_0x482f63=combineOptions(_0x482f63);var _0x9c402d=new Buffer(_0x21eb10);var _0x40a631=fs[_0xea69('0x10')](_0x3af247);var _0x232d44=fs[_0xea69('0x11')](_0xc3c92e);var _0x4c1926=crypto[_0xea69('0x19')](_0x482f63['algorithm'],_0x9c402d);_0x40a631['on'](_0xea69('0x12'),function(_0x26d532){var _0x11da39=new Buffer(_0x4c1926[_0xea69('0x13')](_0x26d532),_0xea69('0x14'));_0x232d44[_0xea69('0x15')](_0x11da39);});_0x40a631['on']('end',function(){try{var _0x39b831=new Buffer(_0x4c1926['final'](_0xea69('0x14')),'binary');_0x232d44['write'](_0x39b831);_0x232d44[_0xea69('0x16')]();_0x232d44['on'](_0xea69('0x18'),function(){return _0x4ddb44(_0xc3c92e);});}catch(_0x2f5aee){fs[_0xea69('0x1a')](_0xc3c92e);return _0x41f8e1(_0x2f5aee);}});});};exports[_0xea69('0x1b')]=function(_0x42477c,_0x382483,_0x21926b){var _0x287b60=_0x21926b||stringOptions['algorithm'];var _0x2a714b=_0x382483||stringOptions[_0xea69('0x1c')];var _0x18af49=crypto['createCipher'](_0x287b60,_0x2a714b);var _0x46d9f4=_0x18af49[_0xea69('0x13')](_0x42477c,'utf8',_0xea69('0x1d'));_0x46d9f4+=_0x18af49[_0xea69('0x17')](_0xea69('0x1d'));return _0x46d9f4;};exports[_0xea69('0x1e')]=function(_0x21417e,_0x130fe8,_0x114d4c){var _0x2a66fc=_0x114d4c||stringOptions[_0xea69('0x9')];var _0x1c115f=_0x130fe8||stringOptions[_0xea69('0x1c')];var _0x31fe59=crypto[_0xea69('0x19')](_0x2a66fc,_0x1c115f);var _0x4d807e=_0x31fe59[_0xea69('0x13')](_0x21417e,_0xea69('0x1d'),'utf8');_0x4d807e+=_0x31fe59[_0xea69('0x17')](_0xea69('0x1f'));return _0x4d807e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index df7955d..a5435eb 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 _0x450a=['util','lodash','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','info','finally','exit'];(function(_0x99ba67,_0x10eae9){var _0x5c4f7d=function(_0x2962f6){while(--_0x2962f6){_0x99ba67['push'](_0x99ba67['shift']());}};_0x5c4f7d(++_0x10eae9);}(_0x450a,0xe1));var _0xa450=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x450a[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xa450('0x0'));var path=require('path');var _=require(_0xa450('0x1'));var csv=require(_0xa450('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xa450('0x3'));var rimraf=require(_0xa450('0x4'));var db=require(_0xa450('0x5'))['db'];var dbH=require(_0xa450('0x5'))['dbH'];var logger=require(_0xa450('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa450('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa450('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xe7318d,_0x1d9797){var _0x3beca1={'status':_0xe7318d};var _0x3da860={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d9797){_0x3beca1[_0xa450('0x8')]=_0x1d9797;}return db[_0xa450('0x9')][_0xa450('0xa')](_0x3beca1,_0x3da860);}function main(){var _0x270509=0x1388;var _0x44c32e;logger['info'](util[_0xa450('0xb')](_0xa450('0xc'),EXTRACTED_REPORT_ID,_0xa450('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa450('0xe'),_0xa450('0xf')]})[_0xa450('0x10')](function(_0x272a94){if(_0x272a94){_0x44c32e=_0x272a94;_0x270509=_0x44c32e[_0xa450('0xf')]||0x1388;}})[_0xa450('0x10')](function(){return dbH[_0xa450('0x11')][_0xa450('0x12')](util[_0xa450('0xb')](_0xa450('0x13'),QUERY),{'type':dbH[_0xa450('0x11')]['QueryTypes'][_0xa450('0x14')]});})[_0xa450('0x10')](function(_0x2c4298){if(!_0x2c4298[0x0][_0xa450('0x15')]){return analyticExtractedReport('Empty');}var _0x47f4ba=[];var _0x496d73=0x0;if(_0x44c32e['split']){if(_0x2c4298&&_0x2c4298[_0xa450('0x16')]){var _0x242835=_['range'](_0x2c4298[0x0]['num']/_0x270509);var _0xdaf577=Number[_0xa450('0x17')](_0x2c4298[0x0][_0xa450('0x15')]/_0x270509)?_0x2c4298[0x0][_0xa450('0x15')]%_0x270509:0x0;_0x242835[_0xa450('0x18')](function(_0x1d6a93){if(_0x1d6a93>0x0){_0x496d73+=_0x270509;}_0x47f4ba['push'](dbH[_0xa450('0x11')]['query'](util['format'](_0xa450('0x19'),QUERY,_0x270509,_0x496d73),{'type':dbH[_0xa450('0x11')][_0xa450('0x1a')]['SELECT']}));});if(_0xdaf577>0x0){_0x496d73+=_0x270509;_0x47f4ba[_0xa450('0x1b')](dbH[_0xa450('0x11')][_0xa450('0x12')](util[_0xa450('0xb')](_0xa450('0x19'),QUERY,_0xdaf577,_0x496d73),{'type':dbH['sequelize'][_0xa450('0x1a')][_0xa450('0x14')]}));}}}else{_0x47f4ba[_0xa450('0x1b')](dbH['sequelize'][_0xa450('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xa450('0x14')]}));}var _0x7f18b0=path[_0xa450('0x1c')](PATH);var _0x44a2f1=path[_0xa450('0x1d')](PATH,_0xa450('0x1e'));var _0x388c5e=_0x44c32e[_0xa450('0xe')]&&_0x47f4ba[_0xa450('0x16')]>0x1;var _0x23cb05=[];if(!fs['existsSync'](path['join'](_0x7f18b0,_0x44a2f1))&&_0x388c5e){fs[_0xa450('0x1f')](path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1));}return BPromise[_0xa450('0x21')](_0x47f4ba,function(_0x5e9244){_0x23cb05[_0xa450('0x1b')](_0x5e9244);})[_0xa450('0x10')](function(){for(var _0x1b0558=0x0;_0x1b0558<_0x23cb05['length'];_0x1b0558+=0x1){var _0x1457da;var _0x58eb8b=_0x23cb05[_0x1b0558];if(_0x388c5e){_0x1457da=path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1,util['format'](_0xa450('0x22'),_0x44a2f1,_0x1b0558,_0xa450('0x23')));}else{_0x1457da=path['join'](_0x7f18b0,util['format'](_0xa450('0x24'),_0x44a2f1,_0xa450('0x23')));}fs[_0xa450('0x25')](_0x1457da,csv(_0x58eb8b));}})[_0xa450('0x10')](function(){if(_0x388c5e){return new Promise(function(_0x38d9c4){zipdir(path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1),{'saveTo':path[_0xa450('0x20')](_0x7f18b0,util[_0xa450('0xb')](_0xa450('0x24'),_0x44a2f1,_0xa450('0x26')))},function(_0x266a2f,_0x19715d){rimraf(path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1),function(){});_0x38d9c4(_0xa450('0x27'));});});}})[_0xa450('0x10')](function(){logger['info'](util[_0xa450('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa450('0xd')));return analyticExtractedReport(_0xa450('0x28'),_0x388c5e?util[_0xa450('0xb')](_0xa450('0x24'),_0x44a2f1,_0x388c5e?_0xa450('0x26'):_0xa450('0x23')):null);});})[_0xa450('0x29')](function(_0x55501a){logger[_0xa450('0x2a')](util[_0xa450('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x55501a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa450('0x2b')](function(){process[_0xa450('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x97dc=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','then','splitSizeCsv','sequelize','query','SELECT','num','Empty','length','isInteger','forEach','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','split','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','inspect','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename'];(function(_0x1e9f1c,_0xdf9aa1){var _0x4f93f7=function(_0x2a9259){while(--_0x2a9259){_0x1e9f1c['push'](_0x1e9f1c['shift']());}};_0x4f93f7(++_0xdf9aa1);}(_0x97dc,0x1d6));var _0xc97d=function(_0x2596fa,_0x189c14){_0x2596fa=_0x2596fa-0x0;var _0x159184=_0x97dc[_0x2596fa];return _0x159184;};'use strict';var util=require('util');var path=require(_0xc97d('0x0'));var _=require(_0xc97d('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xc97d('0x2'));var zipdir=require(_0xc97d('0x3'));var rimraf=require(_0xc97d('0x4'));var db=require(_0xc97d('0x5'))['db'];var dbH=require(_0xc97d('0x5'))[_0xc97d('0x6')];var logger=require(_0xc97d('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc97d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x500264,_0x3f3c29){var _0x4a678a={'status':_0x500264};var _0x5da86a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f3c29){_0x4a678a[_0xc97d('0x9')]=_0x3f3c29;}return db['AnalyticExtractedReport']['update'](_0x4a678a,_0x5da86a);}function main(){var _0x52a42d=0x1388;var _0xb3a3e0;logger['info'](util[_0xc97d('0xa')](_0xc97d('0xb'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xc97d('0xc')][_0xc97d('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0xc97d('0xe')](function(_0x399ebb){if(_0x399ebb){_0xb3a3e0=_0x399ebb;_0x52a42d=_0xb3a3e0[_0xc97d('0xf')]||0x1388;}})['then'](function(){return dbH[_0xc97d('0x10')][_0xc97d('0x11')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc97d('0x10')]['QueryTypes'][_0xc97d('0x12')]});})[_0xc97d('0xe')](function(_0x1c04ea){if(!_0x1c04ea[0x0][_0xc97d('0x13')]){return analyticExtractedReport(_0xc97d('0x14'));}var _0x21af41=[];var _0x2c6b50=0x0;if(_0xb3a3e0['split']){if(_0x1c04ea&&_0x1c04ea[_0xc97d('0x15')]){var _0x158509=_['range'](_0x1c04ea[0x0][_0xc97d('0x13')]/_0x52a42d);var _0x502ec6=Number[_0xc97d('0x16')](_0x1c04ea[0x0][_0xc97d('0x13')]/_0x52a42d)?_0x1c04ea[0x0][_0xc97d('0x13')]%_0x52a42d:0x0;_0x158509[_0xc97d('0x17')](function(_0x1f81eb){if(_0x1f81eb>0x0){_0x2c6b50+=_0x52a42d;}_0x21af41[_0xc97d('0x18')](dbH[_0xc97d('0x10')][_0xc97d('0x11')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x52a42d,_0x2c6b50),{'type':dbH[_0xc97d('0x10')][_0xc97d('0x19')][_0xc97d('0x12')]}));});if(_0x502ec6>0x0){_0x2c6b50+=_0x52a42d;_0x21af41['push'](dbH['sequelize'][_0xc97d('0x11')](util[_0xc97d('0xa')](_0xc97d('0x1a'),QUERY,_0x502ec6,_0x2c6b50),{'type':dbH[_0xc97d('0x10')][_0xc97d('0x19')][_0xc97d('0x12')]}));}}}else{_0x21af41['push'](dbH[_0xc97d('0x10')][_0xc97d('0x11')](QUERY,{'type':dbH['sequelize'][_0xc97d('0x19')][_0xc97d('0x12')]}));}var _0x229c4c=path['dirname'](PATH);var _0x3d3564=path['basename'](PATH,_0xc97d('0x1b'));var _0x339df6=_0xb3a3e0[_0xc97d('0x1c')]&&_0x21af41[_0xc97d('0x15')]>0x1;var _0x146185=[];if(!fs[_0xc97d('0x1d')](path[_0xc97d('0x1e')](_0x229c4c,_0x3d3564))&&_0x339df6){fs[_0xc97d('0x1f')](path['join'](_0x229c4c,_0x3d3564));}return BPromise[_0xc97d('0x20')](_0x21af41,function(_0x5f15d9){_0x146185['push'](_0x5f15d9);})[_0xc97d('0xe')](function(){for(var _0x1baef5=0x0;_0x1baef5<_0x146185[_0xc97d('0x15')];_0x1baef5+=0x1){var _0x1fe40f;var _0x373346=_0x146185[_0x1baef5];if(_0x339df6){_0x1fe40f=path[_0xc97d('0x1e')](_0x229c4c,_0x3d3564,util[_0xc97d('0xa')](_0xc97d('0x21'),_0x3d3564,_0x1baef5,_0xc97d('0x22')));}else{_0x1fe40f=path[_0xc97d('0x1e')](_0x229c4c,util[_0xc97d('0xa')](_0xc97d('0x23'),_0x3d3564,_0xc97d('0x22')));}fs[_0xc97d('0x24')](_0x1fe40f,csv(_0x373346));}})[_0xc97d('0xe')](function(){if(_0x339df6){return new Promise(function(_0x824cdd){zipdir(path[_0xc97d('0x1e')](_0x229c4c,_0x3d3564),{'saveTo':path[_0xc97d('0x1e')](_0x229c4c,util[_0xc97d('0xa')](_0xc97d('0x23'),_0x3d3564,_0xc97d('0x25')))},function(_0x4c1e0c,_0x14d75e){rimraf(path[_0xc97d('0x1e')](_0x229c4c,_0x3d3564),function(){});_0x824cdd(_0xc97d('0x26'));});});}})[_0xc97d('0xe')](function(){logger[_0xc97d('0x27')](util[_0xc97d('0xa')](_0xc97d('0x28'),EXTRACTED_REPORT_ID,_0xc97d('0x29')));return analyticExtractedReport(_0xc97d('0x2a'),_0x339df6?util[_0xc97d('0xa')](_0xc97d('0x23'),_0x3d3564,_0x339df6?_0xc97d('0x25'):_0xc97d('0x22')):null);});})[_0xc97d('0x2b')](function(_0xbba85){logger[_0xc97d('0x27')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc97d('0x29')),util[_0xc97d('0x2c')](_0xbba85,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc97d('0x2d'));})[_0xc97d('0x2e')](function(){process[_0xc97d('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4ff1471..6b9ecfc 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 _0xfdc1=['all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','push','body','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','pageBreak','before','margin','\x20/\x20','footer','black','right','Empty','split','splitSizePdf','then','range','num','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s'];(function(_0x2d4e24,_0x4a324f){var _0x55c5dd=function(_0x39e1d){while(--_0x39e1d){_0x2d4e24['push'](_0x2d4e24['shift']());}};_0x55c5dd(++_0x4a324f);}(_0xfdc1,0x117));var _0x1fdc=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0xfdc1[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x1fdc('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x1fdc('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x1fdc('0x2'));var PdfPrinter=require(_0x1fdc('0x3'));var zipdir=require(_0x1fdc('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x1fdc('0x5'))[_0x1fdc('0x6')];var window=new JSDOM('')[_0x1fdc('0x7')];var BPromise=require(_0x1fdc('0x8'));var db=require(_0x1fdc('0x9'))['db'];var dbH=require(_0x1fdc('0x9'))[_0x1fdc('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1fdc('0xb')][0x2]);var QUERY=process[_0x1fdc('0xb')][0x3];var PATH=process[_0x1fdc('0xb')][0x4];var NAME=process[_0x1fdc('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f9b9b,_0x3e3f03){var _0x156660={'status':_0x4f9b9b};var _0x3b59ac={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e3f03){_0x156660['savename']=_0x3e3f03;}return db[_0x1fdc('0xc')][_0x1fdc('0xd')](_0x156660,_0x3b59ac);}function getHeaders(_0x211c47){return _[_0x1fdc('0xe')](_0x211c47,function(_0x21e60f){return{'text':_0x21e60f,'style':_0x1fdc('0xf')};});}function getRows(_0x4b1fd2,_0x488171){return _[_0x1fdc('0xe')](_0x488171,function(_0x341026){return _(_0x341026)[_0x1fdc('0x10')](_0x4b1fd2)[_0x1fdc('0xe')](function(_0x27b2ce){return _0x27b2ce?_[_0x1fdc('0x11')](_0x27b2ce):'';})[_0x1fdc('0x12')]();});}function createTable(_0x47560d,_0x5289d4){var _0xc598c1={'widths':_['fill'](Array(_0x47560d[_0x1fdc('0x13')]),0x91),'heights':function(_0x3361c0){return _0x3361c0===0x0?_0x1fdc('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1e689b=getHeaders(_0x47560d);_0xc598c1['body'][_0x1fdc('0x15')](_0x1e689b);var _0x586843=getRows(_0x47560d,_0x5289d4);_0xc598c1[_0x1fdc('0x16')]=_0xc598c1[_0x1fdc('0x16')]['concat'](_0x586843);return _0xc598c1;}function createTables(_0x4c6cb3){var _0x49157e=[];var _0x518684=_[_0x1fdc('0x17')](Object[_0x1fdc('0x18')](_0x4c6cb3[0x0]),0x5);_0x518684[_0x1fdc('0x19')](function(_0xf43b8c){_0x49157e['push'](createTable(_0xf43b8c,_0x4c6cb3));});return _0x49157e;}function getPDFDocDefinition(_0x252e60){var _0x10c09c=util['format'](_0x1fdc('0x1a'),NAME,EXTRACTED_REPORT[_0x1fdc('0x1b')],moment(EXTRACTED_REPORT[_0x1fdc('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x1fdc('0x1d')])[_0x1fdc('0x1e')](FORMAT));var _0x2db094=[];for(var _0x25a97a=0x0;_0x25a97a<_0x252e60[_0x1fdc('0x13')];_0x25a97a++){var _0x71555f=[];if(_0x25a97a===0x0){_0x71555f[_0x1fdc('0x15')]({'text':_0x10c09c,'style':'header'});}var _0x9f9b4c={'table':_0x252e60[_0x25a97a]};if(_0x25a97a>0x0){_0x9f9b4c[_0x1fdc('0x1f')]=_0x1fdc('0x20');_0x9f9b4c[_0x1fdc('0x21')]=[0x0,0x46,0x0,0x0];}_0x71555f[_0x1fdc('0x15')](_0x9f9b4c);_0x2db094[_0x1fdc('0x15')](_0x71555f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2db094,'footer':function(_0x39b583,_0xfe1b2e){return{'text':_0x39b583['toString']()+_0x1fdc('0x22')+_0xfe1b2e,'style':_0x1fdc('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1fdc('0x24')},'footer':{'alignment':_0x1fdc('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x227336){var _0x1401f8=0x1388;var _0x6f84ab;if(!_0x227336[0x0]['num']){return analyticExtractedReport(_0x1fdc('0x26'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1fdc('0x27'),_0x1fdc('0x28')]})[_0x1fdc('0x29')](function(_0x14df7b){if(_0x14df7b){_0x6f84ab=_0x14df7b;_0x1401f8=_0x6f84ab[_0x1fdc('0x28')]||0x3e8;}})['then'](function(){var _0x1cd676=[];var _0x1fe9de=0x0;if(_0x6f84ab[_0x1fdc('0x27')]){if(_0x227336&&_0x227336['length']){var _0x355892=_[_0x1fdc('0x2a')](_0x227336[0x0]['num']/_0x1401f8);var _0x3672cb=Number['isInteger'](_0x227336[0x0][_0x1fdc('0x2b')]/_0x1401f8)?_0x227336[0x0][_0x1fdc('0x2b')]%_0x1401f8:0x0;_0x355892[_0x1fdc('0x19')](function(_0x556ad4){if(_0x556ad4>0x0){_0x1fe9de+=_0x1401f8;}_0x1cd676['push'](dbH[_0x1fdc('0x2c')]['query'](util[_0x1fdc('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1401f8,_0x1fe9de),{'type':dbH[_0x1fdc('0x2c')][_0x1fdc('0x2d')][_0x1fdc('0x2e')]}));});if(_0x3672cb>0x0){_0x1fe9de+=_0x1401f8;_0x1cd676[_0x1fdc('0x15')](dbH['sequelize']['query'](util[_0x1fdc('0x1e')](_0x1fdc('0x2f'),QUERY,_0x3672cb,_0x1fe9de),{'type':dbH[_0x1fdc('0x2c')][_0x1fdc('0x2d')]['SELECT']}));}}}else{_0x1cd676['push'](dbH['sequelize'][_0x1fdc('0x30')](QUERY,{'type':dbH['sequelize'][_0x1fdc('0x2d')][_0x1fdc('0x2e')]}));}var _0x4dcdc2=path[_0x1fdc('0x31')](PATH);var _0x980f1c=path[_0x1fdc('0x32')](PATH,_0x1fdc('0x33'));var _0x4bc0bc=_0x6f84ab[_0x1fdc('0x27')]&&_0x1cd676[_0x1fdc('0x13')]>0x1;var _0x24c1df=[];if(!fs[_0x1fdc('0x34')](path['join'](_0x4dcdc2,_0x980f1c))&&_0x4bc0bc){fs[_0x1fdc('0x35')](path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c));}return BPromise[_0x1fdc('0x37')](_0x1cd676,function(_0x1c1921){_0x24c1df[_0x1fdc('0x15')](_0x1c1921);})['then'](function(){var _0x35ad86=[];for(var _0x484f5d=0x0;_0x484f5d<_0x24c1df['length'];_0x484f5d+=0x1){var _0x49da7b=_0x24c1df[_0x484f5d];var _0x33e7b6=createTables(_[_0x1fdc('0x38')](_0x49da7b));var _0x339dec;var _0x5d3e69=getPDFDocDefinition(_0x33e7b6);var _0x545236=getPDFPrinter();var _0x542792=_0x545236[_0x1fdc('0x39')](_0x5d3e69);if(_0x4bc0bc){_0x339dec=path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c,util['format'](_0x1fdc('0x3a'),_0x980f1c,_0x484f5d,_0x1fdc('0x3b')));}else{_0x339dec=path[_0x1fdc('0x36')](_0x4dcdc2,util[_0x1fdc('0x1e')](_0x1fdc('0x3c'),_0x980f1c,_0x1fdc('0x3b')));}_0x35ad86[_0x1fdc('0x15')](writePDFDocument(_0x542792,_0x339dec));}return Promise[_0x1fdc('0x3d')](_0x35ad86);})[_0x1fdc('0x29')](function(){if(_0x4bc0bc){return new Promise(function(_0x2f4750){zipdir(path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c),{'saveTo':path[_0x1fdc('0x36')](_0x4dcdc2,util['format']('%s.%s',_0x980f1c,'zip'))},function(){rimraf(path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c),function(){});_0x2f4750(_0x1fdc('0x3e'));});});}})[_0x1fdc('0x29')](function(){if(!_0x4bc0bc)return;rimraf(path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c),function(){});})[_0x1fdc('0x29')](function(){logger[_0x1fdc('0x3f')](util[_0x1fdc('0x1e')](_0x1fdc('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1fdc('0x41'),_0x4bc0bc?util[_0x1fdc('0x1e')]('%s.%s',_0x980f1c,_0x4bc0bc?_0x1fdc('0x42'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1fdc('0x3f')](util[_0x1fdc('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1fdc('0x43')));return db['AnalyticExtractedReport'][_0x1fdc('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1fdc('0x29')](function(_0xddef51){EXTRACTED_REPORT=_0xddef51;return dbH[_0x1fdc('0x2c')]['query'](util[_0x1fdc('0x1e')](_0x1fdc('0x45'),QUERY),{'type':dbH['sequelize'][_0x1fdc('0x2d')][_0x1fdc('0x2e')]});})[_0x1fdc('0x29')](extractReport)[_0x1fdc('0x46')](function(_0x35e6bb){logger[_0x1fdc('0x3f')](util['format'](_0x1fdc('0x47'),EXTRACTED_REPORT_ID,'PDF'),util[_0x1fdc('0x48')](_0x35e6bb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x1fdc('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb4bc30=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x1fdc('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1fdc('0x4b')}});return _0xb4bc30;}function getPDFDocDefinitionFromHTML(_0x32e7d3,_0x32ebe0){var _0x34d389=util[_0x1fdc('0x1e')]('%s\x20#%d',_0x32ebe0[_0x1fdc('0x4c')],_0x32ebe0['interactionId']);var _0x228256=moment()[_0x1fdc('0x1e')](_0x1fdc('0x4d'))['toString']();var _0x40791e=htmlToPdfmake(_0x32e7d3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x40791e],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1fdc('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1fdc('0x4e')}},'header':function(){return[{'text':_0x1fdc('0x4f'),'style':_0x1fdc('0x50')}];},'footer':function(_0x3ef64f,_0x205706){return[{'text':util[_0x1fdc('0x1e')](_0x1fdc('0x51'),_0x34d389,_0x3ef64f,_0x205706,_0x228256),'style':_0x1fdc('0x23')}];}};}function writePDFDocument(_0x222081,_0xbffb73){return new Promise(function(_0x47abc5,_0x111934){var _0xeb61c3=_0x222081[_0x1fdc('0x52')](fs['createWriteStream'](_0xbffb73));_0xeb61c3['on']('finish',function(){_0x47abc5(_0x1fdc('0x53'));});_0xeb61c3['on'](_0x1fdc('0x54'),function(_0x5a62d0){_0x111934(_0x5a62d0);});_0x222081['end']();});}exports['createPdfFromHTML']=function(_0xaf6caa,_0x1545f8){var _0x90ecc4=getPDFPrinter();var _0x5673fa=getPDFDocDefinitionFromHTML(_0xaf6caa,_0x1545f8);var _0x276f1d=_0x90ecc4['createPdfKitDocument'](_0x5673fa);return writePDFDocument(_0x276f1d,_0x1545f8[_0x1fdc('0x1')])[_0x1fdc('0x46')](function(_0x30227f){throw _0x30227f;});}; \ No newline at end of file +var _0xdeb2=['%s\x20#%d','channel','interactionId','YYYY-MM-DD','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','pdfmake/src/printer','zip-dir','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','keys','push','name','startDate','format','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','splitSizePdf','then','split','isInteger','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf'];(function(_0x2febde,_0x3fbc16){var _0x41cab8=function(_0x152cd7){while(--_0x152cd7){_0x2febde['push'](_0x2febde['shift']());}};_0x41cab8(++_0x3fbc16);}(_0xdeb2,0x68));var _0x2deb=function(_0x307ef5,_0x5dbf62){_0x307ef5=_0x307ef5-0x0;var _0x378b98=_0xdeb2[_0x307ef5];return _0x378b98;};'use strict';var _=require(_0x2deb('0x0'));var fs=require('fs');var util=require(_0x2deb('0x1'));var path=require(_0x2deb('0x2'));var moment=require(_0x2deb('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x2deb('0x4'));var zipdir=require(_0x2deb('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x2deb('0x6'))[_0x2deb('0x7')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x2deb('0x8'))['db'];var dbH=require(_0x2deb('0x8'))[_0x2deb('0x9')];var logger=require(_0x2deb('0xa'))(_0x2deb('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x2deb('0xc')][0x2]);var QUERY=process[_0x2deb('0xc')][0x3];var PATH=process[_0x2deb('0xc')][0x4];var NAME=process[_0x2deb('0xc')][0x5];var FORMAT=_0x2deb('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d338a,_0x3cf98c){var _0x29f78b={'status':_0x2d338a};var _0x5bf962={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cf98c){_0x29f78b[_0x2deb('0xe')]=_0x3cf98c;}return db[_0x2deb('0xf')]['update'](_0x29f78b,_0x5bf962);}function getHeaders(_0x3743e6){return _[_0x2deb('0x10')](_0x3743e6,function(_0x268552){return{'text':_0x268552,'style':_0x2deb('0x11')};});}function getRows(_0x1a97f8,_0x5142f8){return _['map'](_0x5142f8,function(_0x301009){return _(_0x301009)[_0x2deb('0x12')](_0x1a97f8)[_0x2deb('0x10')](function(_0x3b1aff){return _0x3b1aff?_[_0x2deb('0x13')](_0x3b1aff):'';})[_0x2deb('0x14')]();});}function createTable(_0x53a7a6,_0x51daea){var _0x21ab62={'widths':_[_0x2deb('0x15')](Array(_0x53a7a6[_0x2deb('0x16')]),0x91),'heights':function(_0x28b6a9){return _0x28b6a9===0x0?_0x2deb('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x122ffd=getHeaders(_0x53a7a6);_0x21ab62[_0x2deb('0x18')]['push'](_0x122ffd);var _0x49a0b6=getRows(_0x53a7a6,_0x51daea);_0x21ab62[_0x2deb('0x18')]=_0x21ab62[_0x2deb('0x18')][_0x2deb('0x19')](_0x49a0b6);return _0x21ab62;}function createTables(_0x282695){var _0x34453b=[];var _0x233dcf=_[_0x2deb('0x1a')](Object[_0x2deb('0x1b')](_0x282695[0x0]),0x5);_0x233dcf['forEach'](function(_0x306742){_0x34453b[_0x2deb('0x1c')](createTable(_0x306742,_0x282695));});return _0x34453b;}function getPDFDocDefinition(_0x3734bd){var _0x5e40ca=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x2deb('0x1d')],moment(EXTRACTED_REPORT[_0x2deb('0x1e')])[_0x2deb('0x1f')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x2deb('0x1f')](FORMAT));var _0x4df1e0=[];for(var _0x1df655=0x0;_0x1df655<_0x3734bd[_0x2deb('0x16')];_0x1df655++){var _0xfebee6=[];if(_0x1df655===0x0){_0xfebee6[_0x2deb('0x1c')]({'text':_0x5e40ca,'style':_0x2deb('0x20')});}var _0x2e1b49={'table':_0x3734bd[_0x1df655]};if(_0x1df655>0x0){_0x2e1b49[_0x2deb('0x21')]=_0x2deb('0x22');_0x2e1b49[_0x2deb('0x23')]=[0x0,0x46,0x0,0x0];}_0xfebee6[_0x2deb('0x1c')](_0x2e1b49);_0x4df1e0['push'](_0xfebee6);}return{'pageSize':'A4','pageOrientation':_0x2deb('0x24'),'content':_0x4df1e0,'footer':function(_0x5870e4,_0x2030cc){return{'text':_0x5870e4[_0x2deb('0x13')]()+_0x2deb('0x25')+_0x2030cc,'style':_0x2deb('0x26')};},'defaultStyle':{'font':_0x2deb('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x2deb('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x495625){var _0x1db501=0x1388;var _0x2c8858;if(!_0x495625[0x0][_0x2deb('0x29')]){return analyticExtractedReport(_0x2deb('0x2a'));}return db[_0x2deb('0x2b')][_0x2deb('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2deb('0x2d')]})[_0x2deb('0x2e')](function(_0xd48572){if(_0xd48572){_0x2c8858=_0xd48572;_0x1db501=_0x2c8858[_0x2deb('0x2d')]||0x3e8;}})['then'](function(){var _0x61d1b8=[];var _0x1fadef=0x0;if(_0x2c8858[_0x2deb('0x2f')]){if(_0x495625&&_0x495625[_0x2deb('0x16')]){var _0x1a1799=_['range'](_0x495625[0x0][_0x2deb('0x29')]/_0x1db501);var _0x5e8843=Number[_0x2deb('0x30')](_0x495625[0x0][_0x2deb('0x29')]/_0x1db501)?_0x495625[0x0][_0x2deb('0x29')]%_0x1db501:0x0;_0x1a1799[_0x2deb('0x31')](function(_0x467111){if(_0x467111>0x0){_0x1fadef+=_0x1db501;}_0x61d1b8[_0x2deb('0x1c')](dbH[_0x2deb('0x32')]['query'](util[_0x2deb('0x1f')](_0x2deb('0x33'),QUERY,_0x1db501,_0x1fadef),{'type':dbH[_0x2deb('0x32')][_0x2deb('0x34')][_0x2deb('0x35')]}));});if(_0x5e8843>0x0){_0x1fadef+=_0x1db501;_0x61d1b8[_0x2deb('0x1c')](dbH[_0x2deb('0x32')]['query'](util[_0x2deb('0x1f')](_0x2deb('0x33'),QUERY,_0x5e8843,_0x1fadef),{'type':dbH[_0x2deb('0x32')][_0x2deb('0x34')][_0x2deb('0x35')]}));}}}else{_0x61d1b8['push'](dbH[_0x2deb('0x32')]['query'](QUERY,{'type':dbH[_0x2deb('0x32')]['QueryTypes'][_0x2deb('0x35')]}));}var _0x565ff2=path[_0x2deb('0x36')](PATH);var _0x27956a=path[_0x2deb('0x37')](PATH,_0x2deb('0x38'));var _0x1371a6=_0x2c8858[_0x2deb('0x2f')]&&_0x61d1b8['length']>0x1;var _0x5d3014=[];if(!fs[_0x2deb('0x39')](path[_0x2deb('0x3a')](_0x565ff2,_0x27956a))&&_0x1371a6){fs[_0x2deb('0x3b')](path[_0x2deb('0x3a')](_0x565ff2,_0x27956a));}return BPromise[_0x2deb('0x3c')](_0x61d1b8,function(_0x445941){_0x5d3014[_0x2deb('0x1c')](_0x445941);})[_0x2deb('0x2e')](function(){var _0x5efa1d=[];for(var _0x61642e=0x0;_0x61642e<_0x5d3014[_0x2deb('0x16')];_0x61642e+=0x1){var _0x3a777c=_0x5d3014[_0x61642e];var _0x1ab765=createTables(_[_0x2deb('0x3d')](_0x3a777c));var _0x287f12;var _0x28890d=getPDFDocDefinition(_0x1ab765);var _0x23f2aa=getPDFPrinter();var _0x2ae22c=_0x23f2aa['createPdfKitDocument'](_0x28890d);if(_0x1371a6){_0x287f12=path[_0x2deb('0x3a')](_0x565ff2,_0x27956a,util['format'](_0x2deb('0x3e'),_0x27956a,_0x61642e,_0x2deb('0x3f')));}else{_0x287f12=path[_0x2deb('0x3a')](_0x565ff2,util[_0x2deb('0x1f')]('%s.%s',_0x27956a,_0x2deb('0x3f')));}_0x5efa1d['push'](writePDFDocument(_0x2ae22c,_0x287f12));}return Promise[_0x2deb('0x40')](_0x5efa1d);})['then'](function(){if(_0x1371a6){return new Promise(function(_0x11f5e9){zipdir(path[_0x2deb('0x3a')](_0x565ff2,_0x27956a),{'saveTo':path['join'](_0x565ff2,util[_0x2deb('0x1f')](_0x2deb('0x41'),_0x27956a,'zip'))},function(){rimraf(path[_0x2deb('0x3a')](_0x565ff2,_0x27956a),function(){});_0x11f5e9(_0x2deb('0x42'));});});}})[_0x2deb('0x2e')](function(){if(!_0x1371a6)return;rimraf(path[_0x2deb('0x3a')](_0x565ff2,_0x27956a),function(){});})[_0x2deb('0x2e')](function(){logger[_0x2deb('0x43')](util[_0x2deb('0x1f')](_0x2deb('0x44'),EXTRACTED_REPORT_ID,_0x2deb('0x45')));return analyticExtractedReport('Completed',_0x1371a6?util[_0x2deb('0x1f')](_0x2deb('0x41'),_0x27956a,_0x1371a6?_0x2deb('0x46'):_0x2deb('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x2deb('0x1f')](_0x2deb('0x47'),EXTRACTED_REPORT_ID,_0x2deb('0x45')));return db[_0x2deb('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1be68a){EXTRACTED_REPORT=_0x1be68a;return dbH['sequelize'][_0x2deb('0x48')](util[_0x2deb('0x1f')](_0x2deb('0x49'),QUERY),{'type':dbH[_0x2deb('0x32')][_0x2deb('0x34')][_0x2deb('0x35')]});})['then'](extractReport)[_0x2deb('0x4a')](function(_0x2d405f){logger[_0x2deb('0x43')](util[_0x2deb('0x1f')](_0x2deb('0x4b'),EXTRACTED_REPORT_ID,_0x2deb('0x45')),util[_0x2deb('0x4c')](_0x2d405f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2deb('0x4d'));})[_0x2deb('0x4e')](function(){process[_0x2deb('0x4f')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x117524=new PdfPrinter({'Arial':{'normal':__dirname+_0x2deb('0x50'),'bold':__dirname+_0x2deb('0x51'),'italics':__dirname+_0x2deb('0x52'),'bolditalics':__dirname+_0x2deb('0x53')}});return _0x117524;}function getPDFDocDefinitionFromHTML(_0x3325d6,_0x134faa){var _0x54dd48=util[_0x2deb('0x1f')](_0x2deb('0x54'),_0x134faa[_0x2deb('0x55')],_0x134faa[_0x2deb('0x56')]);var _0x285488=moment()['format'](_0x2deb('0x57'))[_0x2deb('0x13')]();var _0x4b7fbd=htmlToPdfmake(_0x3325d6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4b7fbd],'defaultStyle':{'font':_0x2deb('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x310846,_0x5ba306){return[{'text':util['format'](_0x2deb('0x58'),_0x54dd48,_0x310846,_0x5ba306,_0x285488),'style':_0x2deb('0x26')}];}};}function writePDFDocument(_0x3b46c8,_0x2d398d){return new Promise(function(_0x32c06a,_0x227dd1){var _0x3a9895=_0x3b46c8['pipe'](fs[_0x2deb('0x59')](_0x2d398d));_0x3a9895['on'](_0x2deb('0x5a'),function(){_0x32c06a(_0x2deb('0x5a'));});_0x3a9895['on']('error',function(_0x3f2f58){_0x227dd1(_0x3f2f58);});_0x3b46c8[_0x2deb('0x5b')]();});}exports[_0x2deb('0x5c')]=function(_0x4fcb30,_0x4d780b){var _0x162c0e=getPDFPrinter();var _0x5c6c92=getPDFDocDefinitionFromHTML(_0x4fcb30,_0x4d780b);var _0x567c38=_0x162c0e[_0x2deb('0x5d')](_0x5c6c92);return writePDFDocument(_0x567c38,_0x4d780b['path'])[_0x2deb('0x4a')](function(_0x4ec99a){throw _0x4ec99a;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c0de839..4c9cbe2 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 _0xb8c1=['rimraf','../../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','num','Empty','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','%s%d.%s','join','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb8c1,0x91));var _0x1b8c=function(_0x1ef953,_0x5f4de4){_0x1ef953=_0x1ef953-0x0;var _0x246088=_0xb8c1[_0x1ef953];return _0x246088;};'use strict';var util=require('util');var path=require(_0x1b8c('0x0'));var _=require(_0x1b8c('0x1'));var fs=require('fs');var json2xls=require(_0x1b8c('0x2'));var BPromise=require(_0x1b8c('0x3'));var zipdir=require(_0x1b8c('0x4'));var rimraf=require(_0x1b8c('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x1b8c('0x6'))(_0x1b8c('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1b8c('0x8')][0x2]);var QUERY=process[_0x1b8c('0x8')][0x3];var PATH=process[_0x1b8c('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x148847,_0x23191c){var _0xd96ed1={'status':_0x148847};var _0x4e0510={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x23191c){_0xd96ed1[_0x1b8c('0x9')]=_0x23191c;}return db[_0x1b8c('0xa')]['update'](_0xd96ed1,_0x4e0510);}function main(){var _0x32f5cd=0x1388;var _0x311a9a;logger[_0x1b8c('0xb')](util[_0x1b8c('0xc')](_0x1b8c('0xd'),EXTRACTED_REPORT_ID,_0x1b8c('0xe')));return db[_0x1b8c('0xf')][_0x1b8c('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1b8c('0x11')]})['then'](function(_0x29b1a4){if(_0x29b1a4){_0x311a9a=_0x29b1a4;_0x32f5cd=_0x311a9a['splitSizeXlsx']||0x1388;}})[_0x1b8c('0x12')](function(){return dbH[_0x1b8c('0x13')][_0x1b8c('0x14')](util['format'](_0x1b8c('0x15'),QUERY),{'type':dbH[_0x1b8c('0x13')]['QueryTypes']['SELECT']});})[_0x1b8c('0x12')](function(_0x7be88a){if(!_0x7be88a[0x0][_0x1b8c('0x16')]){return analyticExtractedReport(_0x1b8c('0x17'));}var _0x3c1156=[];var _0x35a970=0x0;if(_0x311a9a[_0x1b8c('0x18')]){if(_0x7be88a&&_0x7be88a[_0x1b8c('0x19')]){var _0x14e3c9=_[_0x1b8c('0x1a')](_0x7be88a[0x0][_0x1b8c('0x16')]/_0x32f5cd);var _0x1088db=Number[_0x1b8c('0x1b')](_0x7be88a[0x0]['num']/_0x32f5cd)?_0x7be88a[0x0][_0x1b8c('0x16')]%_0x32f5cd:0x0;_0x14e3c9['forEach'](function(_0x98cc02){if(_0x98cc02>0x0){_0x35a970+=_0x32f5cd;}_0x3c1156[_0x1b8c('0x1c')](dbH[_0x1b8c('0x13')]['query'](util[_0x1b8c('0xc')](_0x1b8c('0x1d'),QUERY,_0x32f5cd,_0x35a970),{'type':dbH[_0x1b8c('0x13')][_0x1b8c('0x1e')][_0x1b8c('0x1f')]}));});if(_0x1088db>0x0){_0x35a970+=_0x32f5cd;_0x3c1156[_0x1b8c('0x1c')](dbH[_0x1b8c('0x13')]['query'](util[_0x1b8c('0xc')](_0x1b8c('0x1d'),QUERY,_0x1088db,_0x35a970),{'type':dbH[_0x1b8c('0x13')][_0x1b8c('0x1e')][_0x1b8c('0x1f')]}));}}}else{_0x3c1156['push'](dbH[_0x1b8c('0x13')][_0x1b8c('0x14')](QUERY,{'type':dbH[_0x1b8c('0x13')][_0x1b8c('0x1e')][_0x1b8c('0x1f')]}));}var _0x5b10fb=path[_0x1b8c('0x20')](PATH);var _0x55bb50=path[_0x1b8c('0x21')](PATH,_0x1b8c('0x22'));var _0x34cf0b=_0x311a9a[_0x1b8c('0x18')]&&_0x3c1156[_0x1b8c('0x19')]>0x1;var _0x460208=[];if(!fs[_0x1b8c('0x23')](path['join'](_0x5b10fb,_0x55bb50))&&_0x34cf0b){fs['mkdirSync'](path['join'](_0x5b10fb,_0x55bb50));}return BPromise['each'](_0x3c1156,function(_0x8c8eb0){_0x460208['push'](_0x8c8eb0);})['then'](function(){for(var _0x63f6f9=0x0;_0x63f6f9<_0x460208[_0x1b8c('0x19')];_0x63f6f9+=0x1){var _0x47bf38;var _0x11a53f=_0x460208[_0x63f6f9];if(_0x34cf0b){_0x47bf38=path['join'](_0x5b10fb,_0x55bb50,util[_0x1b8c('0xc')](_0x1b8c('0x24'),_0x55bb50,_0x63f6f9,'xlsx'));}else{_0x47bf38=path[_0x1b8c('0x25')](_0x5b10fb,util[_0x1b8c('0xc')](_0x1b8c('0x26'),_0x55bb50,_0x1b8c('0x27')));}fs[_0x1b8c('0x28')](_0x47bf38,json2xls(_0x11a53f),_0x1b8c('0x29'));}})[_0x1b8c('0x12')](function(){if(_0x34cf0b){return new Promise(function(_0x1cd705){zipdir(path[_0x1b8c('0x25')](_0x5b10fb,_0x55bb50),{'saveTo':path[_0x1b8c('0x25')](_0x5b10fb,util['format'](_0x1b8c('0x26'),_0x55bb50,_0x1b8c('0x2a')))},function(_0x27561a,_0x5e15f0){rimraf(path[_0x1b8c('0x25')](_0x5b10fb,_0x55bb50),function(){});_0x1cd705(_0x1b8c('0x2b'));});});}})[_0x1b8c('0x12')](function(){logger[_0x1b8c('0xb')](util[_0x1b8c('0xc')](_0x1b8c('0x2c'),EXTRACTED_REPORT_ID,_0x1b8c('0xe')));return analyticExtractedReport(_0x1b8c('0x2d'),_0x34cf0b?util[_0x1b8c('0xc')]('%s.%s',_0x55bb50,_0x34cf0b?_0x1b8c('0x2a'):_0x1b8c('0x27')):null);});})[_0x1b8c('0x2e')](function(_0x113c97){logger['info'](util[_0x1b8c('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1b8c('0xe')),util[_0x1b8c('0x2f')](_0x113c97,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1b8c('0x30'));})['finally'](function(){process[_0x1b8c('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1ae4=['format','XLSX','find','split','then','splitSizeXlsx','sequelize','query','QueryTypes','SELECT','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport'];(function(_0xfab5a0,_0x17ab09){var _0x15b72c=function(_0xbbfa2e){while(--_0xbbfa2e){_0xfab5a0['push'](_0xfab5a0['shift']());}};_0x15b72c(++_0x17ab09);}(_0x1ae4,0x114));var _0x41ae=function(_0xf265cf,_0x599d6c){_0xf265cf=_0xf265cf-0x0;var _0x4747d5=_0x1ae4[_0xf265cf];return _0x4747d5;};'use strict';var util=require(_0x41ae('0x0'));var path=require(_0x41ae('0x1'));var _=require(_0x41ae('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x41ae('0x3'));var zipdir=require(_0x41ae('0x4'));var rimraf=require(_0x41ae('0x5'));var db=require(_0x41ae('0x6'))['db'];var dbH=require(_0x41ae('0x6'))[_0x41ae('0x7')];var logger=require(_0x41ae('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x41ae('0x9')][0x2]);var QUERY=process[_0x41ae('0x9')][0x3];var PATH=process[_0x41ae('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2973bc,_0x533a15){var _0x12a66c={'status':_0x2973bc};var _0x4ff3d6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x533a15){_0x12a66c[_0x41ae('0xa')]=_0x533a15;}return db[_0x41ae('0xb')]['update'](_0x12a66c,_0x4ff3d6);}function main(){var _0x5c5cd8=0x1388;var _0x138347;logger['info'](util[_0x41ae('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x41ae('0xd')));return db['Setting'][_0x41ae('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x41ae('0xf'),'splitSizeXlsx']})[_0x41ae('0x10')](function(_0x5b7b9b){if(_0x5b7b9b){_0x138347=_0x5b7b9b;_0x5c5cd8=_0x138347[_0x41ae('0x11')]||0x1388;}})[_0x41ae('0x10')](function(){return dbH[_0x41ae('0x12')][_0x41ae('0x13')](util[_0x41ae('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x41ae('0x12')][_0x41ae('0x14')][_0x41ae('0x15')]});})['then'](function(_0x5b9a8a){if(!_0x5b9a8a[0x0]['num']){return analyticExtractedReport('Empty');}var _0x5ecf5b=[];var _0x3dadfa=0x0;if(_0x138347[_0x41ae('0xf')]){if(_0x5b9a8a&&_0x5b9a8a[_0x41ae('0x16')]){var _0x3c1c1a=_[_0x41ae('0x17')](_0x5b9a8a[0x0][_0x41ae('0x18')]/_0x5c5cd8);var _0x2b795c=Number[_0x41ae('0x19')](_0x5b9a8a[0x0][_0x41ae('0x18')]/_0x5c5cd8)?_0x5b9a8a[0x0][_0x41ae('0x18')]%_0x5c5cd8:0x0;_0x3c1c1a[_0x41ae('0x1a')](function(_0x19f038){if(_0x19f038>0x0){_0x3dadfa+=_0x5c5cd8;}_0x5ecf5b[_0x41ae('0x1b')](dbH['sequelize'][_0x41ae('0x13')](util['format'](_0x41ae('0x1c'),QUERY,_0x5c5cd8,_0x3dadfa),{'type':dbH[_0x41ae('0x12')]['QueryTypes'][_0x41ae('0x15')]}));});if(_0x2b795c>0x0){_0x3dadfa+=_0x5c5cd8;_0x5ecf5b['push'](dbH[_0x41ae('0x12')]['query'](util[_0x41ae('0xc')](_0x41ae('0x1c'),QUERY,_0x2b795c,_0x3dadfa),{'type':dbH['sequelize'][_0x41ae('0x14')]['SELECT']}));}}}else{_0x5ecf5b[_0x41ae('0x1b')](dbH[_0x41ae('0x12')][_0x41ae('0x13')](QUERY,{'type':dbH[_0x41ae('0x12')][_0x41ae('0x14')][_0x41ae('0x15')]}));}var _0x2e5d12=path[_0x41ae('0x1d')](PATH);var _0xdeec00=path['basename'](PATH,_0x41ae('0x1e'));var _0x2352cf=_0x138347['split']&&_0x5ecf5b[_0x41ae('0x16')]>0x1;var _0x24371d=[];if(!fs[_0x41ae('0x1f')](path[_0x41ae('0x20')](_0x2e5d12,_0xdeec00))&&_0x2352cf){fs['mkdirSync'](path[_0x41ae('0x20')](_0x2e5d12,_0xdeec00));}return BPromise[_0x41ae('0x21')](_0x5ecf5b,function(_0x17344e){_0x24371d[_0x41ae('0x1b')](_0x17344e);})[_0x41ae('0x10')](function(){for(var _0x17f796=0x0;_0x17f796<_0x24371d[_0x41ae('0x16')];_0x17f796+=0x1){var _0x1269c3;var _0x48f878=_0x24371d[_0x17f796];if(_0x2352cf){_0x1269c3=path[_0x41ae('0x20')](_0x2e5d12,_0xdeec00,util[_0x41ae('0xc')](_0x41ae('0x22'),_0xdeec00,_0x17f796,'xlsx'));}else{_0x1269c3=path[_0x41ae('0x20')](_0x2e5d12,util[_0x41ae('0xc')](_0x41ae('0x23'),_0xdeec00,_0x41ae('0x24')));}fs[_0x41ae('0x25')](_0x1269c3,json2xls(_0x48f878),_0x41ae('0x26'));}})[_0x41ae('0x10')](function(){if(_0x2352cf){return new Promise(function(_0x342a88){zipdir(path[_0x41ae('0x20')](_0x2e5d12,_0xdeec00),{'saveTo':path['join'](_0x2e5d12,util[_0x41ae('0xc')]('%s.%s',_0xdeec00,'zip'))},function(_0x7c5f8f,_0x43f2fc){rimraf(path[_0x41ae('0x20')](_0x2e5d12,_0xdeec00),function(){});_0x342a88(_0x41ae('0x27'));});});}})[_0x41ae('0x10')](function(){logger[_0x41ae('0x28')](util[_0x41ae('0xc')](_0x41ae('0x29'),EXTRACTED_REPORT_ID,_0x41ae('0xd')));return analyticExtractedReport('Completed',_0x2352cf?util['format'](_0x41ae('0x23'),_0xdeec00,_0x2352cf?_0x41ae('0x2a'):'xlsx'):null);});})['catch'](function(_0x397ea1){logger[_0x41ae('0x28')](util[_0x41ae('0xc')](_0x41ae('0x2b'),EXTRACTED_REPORT_ID,_0x41ae('0xd')),util[_0x41ae('0x2c')](_0x397ea1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x41ae('0x2d'));})[_0x41ae('0x2e')](function(){process[_0x41ae('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 6e7e6c9..096fab7 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 _0x24f1=['queue','playback','hasOwnProperty','priority','extensions','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','ExecIf','$[${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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x24f1,0xd4));var _0x124f=function(_0x1e41db,_0x38d213){_0x1e41db=_0x1e41db-0x0;var _0x11b1ac=_0x24f1[_0x1e41db];return _0x11b1ac;};'use strict';var _=require(_0x124f('0x0'));var util=require(_0x124f('0x1'));function rewrite(_0x41e960,_0x21a835){var _0x432426=this;return _0x41e960[_0x124f('0x2')][_0x124f('0x3')][_0x124f('0x4')]({'raw':!![]})['then'](function(_0x46058a){_0x432426[_0x124f('0x5')]=_0x46058a;return _0x41e960[_0x124f('0x2')]['VoiceExtension'][_0x124f('0x4')]({'where':{'IntervalId':_0x21a835['IntervalId']},'raw':!![]});})['then'](function(_0x1ff200){return _0x41e960[_0x124f('0x2')][_0x124f('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x124f('0x7')](_['map'](_0x1ff200,_0x124f('0x8')))}},'order':[{'raw':_0x124f('0x9')}],'raw':!![]});})[_0x124f('0xa')](function(_0x573b91){var _0x2ded31=_['filter'](_0x573b91,{'priority':'1'});var _0x271422=_[_0x124f('0xb')](_0x573b91,{'isApp':0x1});var _0x228f10=_[_0x124f('0xc')](_0x271422,_0x124f('0x8'));var _0x4822c4=[_0x124f('0xd'),_0x124f('0xe')];var _0x5520ae=[];var _0x4c6588=[];for(var _0x1c95bc in _0x228f10){if(_0x228f10[_0x124f('0xf')](_0x1c95bc)){_0x432426[_0x124f('0x10')]=0x2;_0x432426[_0x124f('0x11')]=[];_0x432426['extension']=_[_0x124f('0x12')](_0x2ded31,{'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')]});_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':util[_0x124f('0x16')]('CDR(type)=%s',_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')]),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});if(_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')]===_0x124f('0x19')){_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0]['type'],'app':_0x124f('0x15'),'appdata':_0x124f('0x1a')+_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')],'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0]['exten'],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}else if(_0x228f10[_0x1c95bc][0x0]['type']===_0x124f('0x1b')){if(_0x432426['extension']){_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x1c')+(_0x432426[_0x124f('0x1d')][_0x124f('0x1e')]?_0x124f('0x1f')+_0x432426[_0x124f('0x1d')][_0x124f('0x1e')]+'}':_0x124f('0x20')),'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x1a')+_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')],'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});var _0x241ab2=_0x432426['priority']++;_0x432426['extensions'][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':'ExecIf','appdata':_0x124f('0x21')+(_0x241ab2+0x2)+'):Goto('+(_0x241ab2+0x1)+')','context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x241ab2,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});if(_0x432426[_0x124f('0x1d')]){_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x432426[_0x124f('0x1d')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x432426['extension'][_0x124f('0x1e')]+'}':_0x124f('0x22'),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x23')+_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')],'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0]['VoiceExtensionId']});if(_0x432426['extension']&&_0x432426[_0x124f('0x1d')][_0x124f('0xf')](_0x124f('0x24'))&&_0x432426['extension'][_0x124f('0x24')]!==_0x124f('0x25')){_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x26'),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0]['exten'],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x432426['extensions'][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':'Set','appdata':_0x124f('0x27')+_0x432426[_0x124f('0x1d')]['recordingFormat']||_0x124f('0x28'),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x29'),'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426['priority']++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0]['exten'],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0]['VoiceExtensionId']});for(var _0x56faa8=0x0,_0x2e042b=0x0;_0x56faa8<_0x228f10[_0x1c95bc][_0x124f('0x2a')];_0x56faa8+=0x1,_0x2e042b=0x0){var _0x107688=_0x228f10[_0x1c95bc][_0x56faa8];if(_0x107688[_0x124f('0x14')]){_0x107688[_0x124f('0x14')]=_0x107688['type'][_0x124f('0x2b')]();}var _0xce3a59=[];var _0x102f7c=[];delete _0x107688['id'];delete _0x107688[_0x124f('0x2c')];delete _0x107688['updatedAt'];var _0x35dfee=_0x107688[_0x124f('0x2d')]!==_0x124f('0x2e')?[_0x107688[_0x124f('0x2d')]]:_0x107688[_0x124f('0x2f')]?_[_0x124f('0x30')](_[_0x124f('0xb')](_0x432426[_0x124f('0x5')],{'IntervalId':_0x107688[_0x124f('0x2f')]}),_0x124f('0x2d')):[];if(_0x107688[_0x124f('0xf')]('tag')){if(_0x107688['tag']&&_0x107688[_0x124f('0x31')]!=='--'){_0xce3a59[_0x124f('0x13')]({'type':_0x107688[_0x124f('0x14')],'app':'Set','appdata':_0x124f('0x32')+_0x107688[_0x124f('0x31')],'context':_0x107688['context'],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});}}if(_0x107688['type']===_0x124f('0x1b')&&_0x107688[_0x124f('0xf')](_0x124f('0x33'))){if(_0x107688[_0x124f('0x33')]){_0xce3a59[_0x124f('0x13')]({'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x34'),'appdata':_0x124f('0x35')+_0x107688[_0x124f('0x33')]+')','context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee['length']+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});}else{_0xce3a59['push']({'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x34'),'appdata':_0x124f('0x36'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688['VoiceExtensionId']});}}if(_0x107688['hasOwnProperty'](_0x124f('0x37'))){if(_0x4822c4[_0x124f('0x38')](_0x107688['app']['toLowerCase']())>=0x0&&_0x107688[_0x124f('0x39')]!==_0x124f('0x3a')){if(_0x107688[_0x124f('0x37')]){_0xce3a59[_0x124f('0x13')]({'type':_0x107688['type'],'app':_0x124f('0x34'),'appdata':_0x124f('0x3b'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426['priority']+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});_0xce3a59['push']({'type':_0x107688[_0x124f('0x14')],'app':'Set','appdata':_0x124f('0x3c'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688['exten'],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688['VoiceExtensionId']});}else{_0xce3a59[_0x124f('0x13')]({'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x34'),'appdata':_0x124f('0x3d'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});_0xce3a59[_0x124f('0x13')]({'type':_0x107688['type'],'app':'Set','appdata':_0x124f('0x3e'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688['exten'],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688['VoiceExtensionId']});}}}for(var _0x1e9d8a=0x0;_0x1e9d8a<_0x35dfee[_0x124f('0x2a')];_0x1e9d8a+=0x1){var _0x5c9724=_0x432426[_0x124f('0x10')]+_0x35dfee['length'];var _0x52684e=_0x1e9d8a===_0x35dfee[_0x124f('0x2a')]-0x1?_0x432426['priority']+_0xce3a59[_0x124f('0x2a')]+_0x102f7c['length']+0x2:_0x432426['priority']+_0x1e9d8a+0x1;_0xce3a59[_0x124f('0x3f')](_0x1e9d8a,0x0,{'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x40'),'appdata':_0x35dfee[_0x1e9d8a]+'?'+_0x107688['context']+_0x124f('0x41')+_0x5c9724+':'+_0x107688[_0x124f('0x17')]+_0x124f('0x41')+_0x52684e,'exten':_0x107688[_0x124f('0x8')],'context':_0x107688[_0x124f('0x17')],'priority':_0x432426['priority']+_0x1e9d8a,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}_0x107688[_0x124f('0x10')]=_0xce3a59[_0x124f('0x2a')]?_[_0x124f('0x42')](_0xce3a59)['priority']+0x1:_0x432426[_0x124f('0x10')];_0x432426[_0x124f('0x10')]=(_0x102f7c['length']?_[_0x124f('0x42')](_0x102f7c)[_0x124f('0x10')]:_0x107688['priority'])+0x1;_0x432426[_0x124f('0x11')]=_[_0x124f('0x43')](_0x432426[_0x124f('0x11')],_0xce3a59,[_0x107688],_0x102f7c);}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x44'),'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'priority':_0x432426[_0x124f('0x10')],'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x5520ae[_0x124f('0x13')](_0x228f10[_0x1c95bc][0x0]['VoiceExtensionId']);_0x4c6588=_[_0x124f('0x43')](_0x4c6588,_0x432426['extensions']);}}return _0x41e960[_0x124f('0x45')](function(_0x4d7cab){return _0x41e960[_0x124f('0x2')][_0x124f('0x6')][_0x124f('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x5520ae}},'transaction':_0x4d7cab})[_0x124f('0xa')](function(_0x462b2b){return _0x41e960[_0x124f('0x2')][_0x124f('0x6')]['bulkCreate'](_[_0x124f('0x47')](_0x4c6588,'priority'),{'transaction':_0x4d7cab});});});})[_0x124f('0x48')](function(_0x12088c){console[_0x124f('0x49')](_0x12088c);});}exports[_0x124f('0x4a')]=rewrite; \ No newline at end of file +var _0x81a0=['answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','map','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)'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81a0,0x189));var _0x081a=function(_0x1b9172,_0x181f1b){_0x1b9172=_0x1b9172-0x0;var _0x36b703=_0x81a0[_0x1b9172];return _0x36b703;};'use strict';var _=require(_0x081a('0x0'));var util=require(_0x081a('0x1'));function rewrite(_0x50203d,_0x5bc756){var _0x1f177a=this;return _0x50203d[_0x081a('0x2')][_0x081a('0x3')]['findAll']({'raw':!![]})[_0x081a('0x4')](function(_0x27f885){_0x1f177a[_0x081a('0x5')]=_0x27f885;return _0x50203d[_0x081a('0x2')][_0x081a('0x6')][_0x081a('0x7')]({'where':{'IntervalId':_0x5bc756[_0x081a('0x8')]},'raw':!![]});})[_0x081a('0x4')](function(_0xd44d28){return _0x50203d[_0x081a('0x2')][_0x081a('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x081a('0x9')](_['map'](_0xd44d28,_0x081a('0xa')))}},'order':[{'raw':_0x081a('0xb')}],'raw':!![]});})[_0x081a('0x4')](function(_0x43ff76){var _0x440419=_[_0x081a('0xc')](_0x43ff76,{'priority':'1'});var _0x134c28=_[_0x081a('0xc')](_0x43ff76,{'isApp':0x1});var _0x17a2b8=_[_0x081a('0xd')](_0x134c28,_0x081a('0xa'));var _0xa78768=[_0x081a('0xe'),_0x081a('0xf')];var _0x30de26=[];var _0x2463e8=[];for(var _0x12711f in _0x17a2b8){if(_0x17a2b8[_0x081a('0x10')](_0x12711f)){_0x1f177a[_0x081a('0x11')]=0x2;_0x1f177a[_0x081a('0x12')]=[];_0x1f177a[_0x081a('0x13')]=_[_0x081a('0x14')](_0x440419,{'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')]});_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':util[_0x081a('0x18')]('CDR(type)=%s',_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')]),'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0]['exten'],'priority':_0x1f177a[_0x081a('0x11')]++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});if(_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')]===_0x081a('0x1b')){_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x081a('0x1c')+_0x17a2b8[_0x12711f][0x0]['VoiceExtensionId'],'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a[_0x081a('0x11')]++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});}else if(_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')]===_0x081a('0x1d')){if(_0x1f177a[_0x081a('0x13')]){_0x1f177a[_0x081a('0x12')]['push']({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':'CDR(destination)='+(_0x1f177a['extension'][_0x081a('0x1e')]?_0x081a('0x1f')+_0x1f177a[_0x081a('0x13')]['cutdigits']+'}':_0x081a('0x20')),'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a['priority']++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});}_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':'Set','appdata':_0x081a('0x1c')+_0x17a2b8[_0x12711f][0x0]['VoiceExtensionId'],'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a[_0x081a('0x11')]++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});var _0x14f74b=_0x1f177a[_0x081a('0x11')]++;_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0]['type'],'app':_0x081a('0x21'),'appdata':_0x081a('0x22')+(_0x14f74b+0x2)+_0x081a('0x23')+(_0x14f74b+0x1)+')','context':_0x17a2b8[_0x12711f][0x0]['context'],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x14f74b,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});if(_0x1f177a[_0x081a('0x13')]){_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x1f177a[_0x081a('0x13')][_0x081a('0x1e')]?'CDR(prefix)=${EXTEN:0:'+_0x1f177a[_0x081a('0x13')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a['priority']++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});}_0x1f177a['extensions'][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':'Set','appdata':_0x081a('0x24')+_0x17a2b8[_0x12711f][0x0]['VoiceExtensionId'],'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a[_0x081a('0x11')]++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});if(_0x1f177a[_0x081a('0x13')]&&_0x1f177a[_0x081a('0x13')][_0x081a('0x10')](_0x081a('0x25'))&&_0x1f177a['extension'][_0x081a('0x25')]!==_0x081a('0x26')){_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x081a('0x27'),'context':_0x17a2b8[_0x12711f][0x0]['context'],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a[_0x081a('0x11')]++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x081a('0x28')+_0x1f177a[_0x081a('0x13')][_0x081a('0x25')]||_0x081a('0x29'),'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a['priority']++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});}}_0x1f177a['extensions'][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x081a('0x2a'),'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0]['exten'],'priority':_0x1f177a['priority']++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0]['VoiceExtensionId']});_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x081a('0x2b'),'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0]['exten'],'priority':_0x1f177a['priority']++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x081a('0x2c'),'context':_0x17a2b8[_0x12711f][0x0][_0x081a('0x19')],'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'priority':_0x1f177a['priority']++,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});for(var _0x4842d0=0x0,_0x43461e=0x0;_0x4842d0<_0x17a2b8[_0x12711f][_0x081a('0x2d')];_0x4842d0+=0x1,_0x43461e=0x0){var _0x41c96e=_0x17a2b8[_0x12711f][_0x4842d0];if(_0x41c96e['type']){_0x41c96e[_0x081a('0x16')]=_0x41c96e[_0x081a('0x16')][_0x081a('0x2e')]();}var _0x1325de=[];var _0x3b0423=[];delete _0x41c96e['id'];delete _0x41c96e[_0x081a('0x2f')];delete _0x41c96e[_0x081a('0x30')];var _0x2b7ebc=_0x41c96e['interval']!==_0x081a('0x31')?[_0x41c96e[_0x081a('0x32')]]:_0x41c96e[_0x081a('0x8')]?_[_0x081a('0x33')](_[_0x081a('0xc')](_0x1f177a[_0x081a('0x5')],{'IntervalId':_0x41c96e['IntervalId']}),'interval'):[];if(_0x41c96e[_0x081a('0x10')](_0x081a('0x34'))){if(_0x41c96e['tag']&&_0x41c96e['tag']!=='--'){_0x1325de[_0x081a('0x15')]({'type':_0x41c96e[_0x081a('0x16')],'app':_0x081a('0x17'),'appdata':_0x081a('0x35')+_0x41c96e[_0x081a('0x34')],'context':_0x41c96e[_0x081a('0x19')],'exten':_0x41c96e['exten'],'priority':_0x2b7ebc['length']+_0x1f177a[_0x081a('0x11')]+_0x43461e++,'VoiceExtensionId':_0x41c96e[_0x081a('0x1a')]});}}if(_0x41c96e['type']==='outbound'&&_0x41c96e['hasOwnProperty'](_0x081a('0x36'))){if(_0x41c96e['callerID']){_0x1325de[_0x081a('0x15')]({'type':_0x41c96e[_0x081a('0x16')],'app':_0x081a('0x21'),'appdata':_0x081a('0x37')+_0x41c96e[_0x081a('0x36')]+')','context':_0x41c96e['context'],'exten':_0x41c96e[_0x081a('0xa')],'priority':_0x2b7ebc[_0x081a('0x2d')]+_0x1f177a[_0x081a('0x11')]+_0x43461e++,'VoiceExtensionId':_0x41c96e[_0x081a('0x1a')]});}else{_0x1325de[_0x081a('0x15')]({'type':_0x41c96e['type'],'app':'ExecIf','appdata':_0x081a('0x38'),'context':_0x41c96e['context'],'exten':_0x41c96e[_0x081a('0xa')],'priority':_0x2b7ebc[_0x081a('0x2d')]+_0x1f177a[_0x081a('0x11')]+_0x43461e++,'VoiceExtensionId':_0x41c96e['VoiceExtensionId']});}}if(_0x41c96e[_0x081a('0x10')](_0x081a('0x39'))){if(_0xa78768[_0x081a('0x3a')](_0x41c96e[_0x081a('0x3b')][_0x081a('0x2e')]())>=0x0&&_0x41c96e['appType']!==_0x081a('0x3c')){if(_0x41c96e[_0x081a('0x39')]){_0x1325de[_0x081a('0x15')]({'type':_0x41c96e['type'],'app':'ExecIf','appdata':_0x081a('0x3d'),'context':_0x41c96e[_0x081a('0x19')],'exten':_0x41c96e[_0x081a('0xa')],'priority':_0x2b7ebc[_0x081a('0x2d')]+_0x1f177a[_0x081a('0x11')]+_0x43461e++,'VoiceExtensionId':_0x41c96e[_0x081a('0x1a')]});_0x1325de[_0x081a('0x15')]({'type':_0x41c96e['type'],'app':_0x081a('0x17'),'appdata':_0x081a('0x3e'),'context':_0x41c96e['context'],'exten':_0x41c96e['exten'],'priority':_0x2b7ebc[_0x081a('0x2d')]+_0x1f177a[_0x081a('0x11')]+_0x43461e++,'VoiceExtensionId':_0x41c96e[_0x081a('0x1a')]});}else{_0x1325de[_0x081a('0x15')]({'type':_0x41c96e[_0x081a('0x16')],'app':_0x081a('0x21'),'appdata':_0x081a('0x3f'),'context':_0x41c96e['context'],'exten':_0x41c96e['exten'],'priority':_0x2b7ebc[_0x081a('0x2d')]+_0x1f177a['priority']+_0x43461e++,'VoiceExtensionId':_0x41c96e[_0x081a('0x1a')]});_0x1325de[_0x081a('0x15')]({'type':_0x41c96e[_0x081a('0x16')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x41c96e[_0x081a('0x19')],'exten':_0x41c96e[_0x081a('0xa')],'priority':_0x2b7ebc[_0x081a('0x2d')]+_0x1f177a[_0x081a('0x11')]+_0x43461e++,'VoiceExtensionId':_0x41c96e[_0x081a('0x1a')]});}}}for(var _0x2f90c3=0x0;_0x2f90c3<_0x2b7ebc[_0x081a('0x2d')];_0x2f90c3+=0x1){var _0x280041=_0x1f177a[_0x081a('0x11')]+_0x2b7ebc[_0x081a('0x2d')];var _0xd8c0e4=_0x2f90c3===_0x2b7ebc[_0x081a('0x2d')]-0x1?_0x1f177a['priority']+_0x1325de[_0x081a('0x2d')]+_0x3b0423[_0x081a('0x2d')]+0x2:_0x1f177a[_0x081a('0x11')]+_0x2f90c3+0x1;_0x1325de['splice'](_0x2f90c3,0x0,{'type':_0x41c96e['type'],'app':'GotoIfTime','appdata':_0x2b7ebc[_0x2f90c3]+'?'+_0x41c96e['context']+_0x081a('0x40')+_0x280041+':'+_0x41c96e[_0x081a('0x19')]+_0x081a('0x40')+_0xd8c0e4,'exten':_0x41c96e[_0x081a('0xa')],'context':_0x41c96e['context'],'priority':_0x1f177a[_0x081a('0x11')]+_0x2f90c3,'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0]['VoiceExtensionId']});}_0x41c96e[_0x081a('0x11')]=_0x1325de[_0x081a('0x2d')]?_[_0x081a('0x41')](_0x1325de)[_0x081a('0x11')]+0x1:_0x1f177a[_0x081a('0x11')];_0x1f177a[_0x081a('0x11')]=(_0x3b0423[_0x081a('0x2d')]?_[_0x081a('0x41')](_0x3b0423)['priority']:_0x41c96e['priority'])+0x1;_0x1f177a[_0x081a('0x12')]=_[_0x081a('0x42')](_0x1f177a[_0x081a('0x12')],_0x1325de,[_0x41c96e],_0x3b0423);}_0x1f177a[_0x081a('0x12')][_0x081a('0x15')]({'type':_0x17a2b8[_0x12711f][0x0][_0x081a('0x16')],'app':_0x081a('0x43'),'exten':_0x17a2b8[_0x12711f][0x0][_0x081a('0xa')],'context':_0x17a2b8[_0x12711f][0x0]['context'],'priority':_0x1f177a[_0x081a('0x11')],'VoiceExtensionId':_0x17a2b8[_0x12711f][0x0][_0x081a('0x1a')]});_0x30de26[_0x081a('0x15')](_0x17a2b8[_0x12711f][0x0]['VoiceExtensionId']);_0x2463e8=_['concat'](_0x2463e8,_0x1f177a['extensions']);}}return _0x50203d[_0x081a('0x44')](function(_0x35a2bf){return _0x50203d[_0x081a('0x2')]['VoiceExtension'][_0x081a('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x30de26}},'transaction':_0x35a2bf})['then'](function(_0x591970){return _0x50203d[_0x081a('0x2')][_0x081a('0x6')][_0x081a('0x46')](_[_0x081a('0x47')](_0x2463e8,_0x081a('0x11')),{'transaction':_0x35a2bf});});});})[_0x081a('0x48')](function(_0xf44261){console[_0x081a('0x49')](_0xf44261);});}exports[_0x081a('0x4a')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c8bf118..dd7b757 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 _0x1edc=['errors','length','join','hasOwnProperty','data','firstName','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','field','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','updatedAt','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','catch','BlackLists','all','Campaign','get','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','resolve','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','api','redis','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!'];(function(_0x4ffdc0,_0x173126){var _0x2eb36a=function(_0x3e04e4){while(--_0x3e04e4){_0x4ffdc0['push'](_0x4ffdc0['shift']());}};_0x2eb36a(++_0x173126);}(_0x1edc,0xb4));var _0xc1ed=function(_0x301545,_0xd1f3b){_0x301545=_0x301545-0x0;var _0x229495=_0x1edc[_0x301545];return _0x229495;};'use strict';var BPromise=require(_0xc1ed('0x0'));var util=require('util');var _=require(_0xc1ed('0x1'));var fs=require('fs');var squel=require(_0xc1ed('0x2'));var Papa=require(_0xc1ed('0x3'));var Redis=require(_0xc1ed('0x4'));var db=require(_0xc1ed('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc1ed('0x6'));config[_0xc1ed('0x7')]=_['defaults'](config[_0xc1ed('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1ed('0x7')]));require(_0xc1ed('0x8'))[_0xc1ed('0x9')](socket);try{if(!process[_0xc1ed('0xa')][0x2]||process[_0xc1ed('0xa')][0x2]==='undefined'||process[_0xc1ed('0xa')][0x2]===_0xc1ed('0xb')){throw new Error(_0xc1ed('0xc'));}var FILEPATH=process[_0xc1ed('0xa')][0x2];if(!process[_0xc1ed('0xa')][0x3]||process['argv'][0x3]===_0xc1ed('0xd')||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0xc1ed('0xa')][0x4]===_0xc1ed('0xd')||process[_0xc1ed('0xa')][0x4]===_0xc1ed('0xb')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xc1ed('0xa')][0x3][_0xc1ed('0xe')](','),process[_0xc1ed('0xa')][0x4][_0xc1ed('0xe')](','));if(!process[_0xc1ed('0xa')][0x5]||process[_0xc1ed('0xa')][0x5]===_0xc1ed('0xd')||process[_0xc1ed('0xa')][0x5]==='null'){throw new Error(_0xc1ed('0xf'));}var LISTID=process[_0xc1ed('0xa')][0x5];var COMPANYID=process[_0xc1ed('0xa')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!==_0xc1ed('0xb')?process[_0xc1ed('0xa')][0x6]:null;var DUPLICATES=process[_0xc1ed('0xa')][0x7]&&process[_0xc1ed('0xa')][0x7]!==_0xc1ed('0xd')&&process[_0xc1ed('0xa')][0x7]!==_0xc1ed('0xb')?process['argv'][0x7]:null;if(!process[_0xc1ed('0xa')][0x8]||process[_0xc1ed('0xa')][0x8]===_0xc1ed('0xd')||process[_0xc1ed('0xa')][0x8]==='null'){throw new Error(_0xc1ed('0x10'));}var SOCKET_TIMESTAMP=process[_0xc1ed('0xa')][0x8];}catch(_0x21fc0a){logger['error'](_0x21fc0a);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(_0x18ed27,_0x339259,_0x41a87d,_0x50c735){var _0x11eee4={'message':_0x339259};_0x11eee4[_0x18ed27]=!![];if(_0x41a87d){_0x11eee4['contact']=_0x41a87d;}if(_0x50c735){_0x11eee4['index']=_0x50c735;}return _0x11eee4;}function isEmail(_0x5db47b){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))*$/[_0xc1ed('0x11')](_0x5db47b);}function checkRow(_0x8fe284,_0x422516,_0x468ad6){return new BPromise(function(_0x137db5,_0x11a4e0){if(_['isNil'](_0x8fe284)){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),_0xc1ed('0x13'),null,_0x468ad6));}if(_0x8fe284[_0xc1ed('0x14')]&&_0x8fe284[_0xc1ed('0x14')][_0xc1ed('0x15')]){var _0x1fc6dd=_['map'](_0x8fe284['errors'],'message')[_0xc1ed('0x16')](';');return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),_0x1fc6dd,null,_0x468ad6));}var _0x254bed={};for(var _0x4634ad in FIELDS){if(FIELDS[_0xc1ed('0x17')](_0x4634ad)&&FIELDS[_0x4634ad]){_0x254bed[_0x4634ad]=_0x8fe284[_0xc1ed('0x18')][0x0][FIELDS[_0x4634ad]]||_0x8fe284[_0xc1ed('0x18')][0x0]['\ufeff'+FIELDS[_0x4634ad]];}}if(!_0x254bed[_0xc1ed('0x19')]){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'firstName\x20not\x20specified!',null,_0x468ad6));}if(!_0x254bed['phone']){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),_0xc1ed('0x1a'),null,_0x468ad6));}if(_0x254bed['birthDate']){var _0x5b0379=moment(_0x254bed['birthDate'],_0xc1ed('0x1b'));if(!_0x5b0379[_0xc1ed('0x1c')]()){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x468ad6));}}if(_0x254bed['email']){if(!isEmail(_0x254bed[_0xc1ed('0x1d')])){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x468ad6));}}_0x254bed[_0xc1ed('0x1e')]=LISTID;_0x254bed[_0xc1ed('0x1f')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc1ed('0x15')]&&_0x422516){var _0x2b75a1={};for(var _0x244378=0x0,_0x4397ae=DUPLICATES[_0xc1ed('0x15')];_0x244378<_0x4397ae;_0x244378+=0x1){_0x2b75a1[DUPLICATES[_0x244378]]=_0x254bed[DUPLICATES[_0x244378]];}var _0x457c21=_[_0xc1ed('0x20')](_0x422516,_0x2b75a1);if(_0x457c21){return _0x11a4e0(handleCheckRowError('duplicate',_0xc1ed('0x21'),_0x457c21,_0x468ad6));}}return db[_0xc1ed('0x22')][_0xc1ed('0x23')](_0x254bed,{'raw':!![],'hooks':![],'fields':_[_0xc1ed('0x24')](_0x254bed)})[_0xc1ed('0x25')](function(_0x4ea79c){if(DUPLICATES&&DUPLICATES[_0xc1ed('0x15')]&&_0x422516){_0x422516[_0xc1ed('0x26')](_['pick'](_0x254bed,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4ea79c['id'];return _0x137db5();})['catch'](function(_0x550c0d){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x550c0d[_0xc1ed('0x27')]||JSON[_0xc1ed('0x28')](_0x550c0d)),null,_0x468ad6));});});}function checkHopper(){function _0x3bde6f(){return function(_0x51f7e1){logger[_0xc1ed('0x12')](_0xc1ed('0x29'),_0xc1ed('0x2a'),util['inspect'](_0x51f7e1,{'showHidden':![],'depth':null}));};}var _0x30c901=function(_0x127316,_0x1358c0){var _0xef7f64=squel[_0xc1ed('0x2b')]()[_0xc1ed('0x2c')](_0xc1ed('0x2d'))[_0xc1ed('0x2e')]([_0xc1ed('0x2f'),_0xc1ed('0x30'),_0xc1ed('0x31'),_0xc1ed('0x1e'),_0x1358c0,_0xc1ed('0x32'),'updatedAt'],squel['select']()['field']('phone',_0xc1ed('0x2f'))[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x30'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))[_0xc1ed('0x33')](LISTID['toString'](),'ListId')[_0xc1ed('0x33')](_0x127316['id']['toString'](),_0x1358c0)[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x32'))[_0xc1ed('0x33')](_0xc1ed('0x34'),'updatedAt')[_0xc1ed('0x35')](_0xc1ed('0x36'))['where'](_0xc1ed('0x37'))[_0xc1ed('0x38')](_0xc1ed('0x39'),LISTID[_0xc1ed('0x3a')]())[_0xc1ed('0x38')](_0xc1ed('0x3b'))[_0xc1ed('0x38')](_0xc1ed('0x3c'),squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')](_0xc1ed('0x2f'))[_0xc1ed('0x35')](_0xc1ed('0x2d'))['where'](_0x1358c0+_0xc1ed('0x3e'),_0x127316['id'][_0xc1ed('0x3a')]())))[_0xc1ed('0x3a')]();return _0xef7f64;};var _0x3f7ad1=function(_0x1fb2a6,_0x11e335){var _0x32a834=squel[_0xc1ed('0x2b')]()[_0xc1ed('0x2c')](_0xc1ed('0x2d'))['fromQuery']([_0xc1ed('0x2f'),_0xc1ed('0x30'),'ContactId',_0xc1ed('0x1e'),_0x11e335,_0xc1ed('0x32'),'updatedAt'],squel[_0xc1ed('0x3d')]()['field'](_0xc1ed('0x2f'),_0xc1ed('0x2f'))[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x30'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))['field'](LISTID[_0xc1ed('0x3a')](),'ListId')['field'](_0x1fb2a6['id'][_0xc1ed('0x3a')](),_0x11e335)[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x32'))[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x3f'))['from'](_0xc1ed('0x36'))[_0xc1ed('0x38')](_0xc1ed('0x37'))[_0xc1ed('0x38')]('ListId\x20=\x20?',LISTID['toString']())[_0xc1ed('0x38')](_0xc1ed('0x40'),squel[_0xc1ed('0x41')](hopperContacts))[_0xc1ed('0x38')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc1ed('0x3c'),squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')]('calleridnum')[_0xc1ed('0x35')](_0xc1ed('0x42'))[_0xc1ed('0x38')](_0x11e335+_0xc1ed('0x3e'),_0x1fb2a6['id']['toString']()))[_0xc1ed('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')]('phone')[_0xc1ed('0x35')](_0xc1ed('0x2d'))[_0xc1ed('0x38')](_0x11e335+_0xc1ed('0x3e'),_0x1fb2a6['id'][_0xc1ed('0x3a')]())))[_0xc1ed('0x3a')]();return _0x32a834;};function _0x46a3c6(_0x1152f0,_0x1c5ff3){var _0x178566=squel[_0xc1ed('0x2b')]()['into'](_0xc1ed('0x2d'))[_0xc1ed('0x2e')]([_0xc1ed('0x2f'),_0xc1ed('0x30'),'ContactId','ListId',_0x1c5ff3,_0xc1ed('0x32'),_0xc1ed('0x3f')],squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')]('phone',_0xc1ed('0x2f'))['field'](_0xc1ed('0x34'),_0xc1ed('0x30'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))[_0xc1ed('0x33')](LISTID['toString'](),'ListId')[_0xc1ed('0x33')](_0x1152f0['id'][_0xc1ed('0x3a')](),_0x1c5ff3)['field'](_0xc1ed('0x34'),_0xc1ed('0x32'))['field'](_0xc1ed('0x34'),_0xc1ed('0x3f'))['from']('cm_contacts')[_0xc1ed('0x38')](_0xc1ed('0x37'))[_0xc1ed('0x38')](_0xc1ed('0x39'),LISTID['toString']())[_0xc1ed('0x38')](_0xc1ed('0x40'),squel[_0xc1ed('0x41')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc1ed('0x3a')]();return _0x178566;}function _0x10033d(_0xdc9d4c,_0x214f21){var _0x46cdb3=squel[_0xc1ed('0x2b')]()['into'](_0xc1ed('0x43'))[_0xc1ed('0x2e')]([_0xc1ed('0x2f'),'ContactId',_0xc1ed('0x1e'),_0x214f21,_0xc1ed('0x32'),_0xc1ed('0x3f')],squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')](_0xc1ed('0x2f'),_0xc1ed('0x2f'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))[_0xc1ed('0x33')](LISTID[_0xc1ed('0x3a')](),_0xc1ed('0x1e'))[_0xc1ed('0x33')](_0xdc9d4c['id'][_0xc1ed('0x3a')](),_0x214f21)[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x32'))[_0xc1ed('0x33')](_0xc1ed('0x34'),'updatedAt')[_0xc1ed('0x35')]('cm_contacts')[_0xc1ed('0x38')](_0xc1ed('0x37'))[_0xc1ed('0x38')](_0xc1ed('0x39'),LISTID[_0xc1ed('0x3a')]())[_0xc1ed('0x38')](_0xc1ed('0x40'),squel[_0xc1ed('0x41')](hopperContacts))[_0xc1ed('0x38')](_0xc1ed('0x3b')))[_0xc1ed('0x3a')]();return _0x46cdb3;}return db[_0xc1ed('0x44')][_0xc1ed('0x45')]({'where':{'type':_0xc1ed('0x46')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc1ed('0x47')],'as':_0xc1ed('0x48'),'where':{'id':LISTID}}]})[_0xc1ed('0x25')](function(_0x217fa1){var _0x55f5d1=[];if(_0x217fa1){var _0x46c3df;for(var _0x19dedb=0x0,_0x115560;_0x19dedb<_0x217fa1[_0xc1ed('0x15')];_0x19dedb+=0x1){_0x115560=_0x217fa1[_0x19dedb]['get']({'plain':!![]});switch(_0x115560[_0xc1ed('0x49')]){case _0xc1ed('0x4a'):_0x55f5d1[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x3f7ad1(_0x115560,_0xc1ed('0x4d')))[_0xc1ed('0x25')](function(){})['catch'](_0x3bde6f()));break;case'onlyIfOpen':_0x55f5d1[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x30c901(_0x115560,'VoiceQueueId'))['then'](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));break;default:_0x55f5d1[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x46a3c6(_0x115560,_0xc1ed('0x4d')))['then'](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}}return _0x55f5d1;})['all']()[_0xc1ed('0x25')](function(){return db[_0xc1ed('0x44')][_0xc1ed('0x45')]({'where':{'type':_0xc1ed('0x46')},'attributes':['id'],'include':[{'model':db[_0xc1ed('0x47')],'as':_0xc1ed('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x3adecf){var _0x41f78b=[];if(_0x3adecf){var _0x80733c;for(var _0x119052=0x0,_0x474e91;_0x119052<_0x3adecf[_0xc1ed('0x15')];_0x119052+=0x1){_0x474e91=_0x3adecf[_0x119052]['get']({'plain':!![]});_0x41f78b[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x10033d(_0x474e91,'VoiceQueueId'))[_0xc1ed('0x25')](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}return _0x41f78b;})[_0xc1ed('0x50')]();})['then'](function(){return db[_0xc1ed('0x51')][_0xc1ed('0x45')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc1ed('0x47')],'as':_0xc1ed('0x48'),'where':{'id':LISTID}}]})[_0xc1ed('0x25')](function(_0x547f38){var _0x36f48e=[];if(_0x547f38){for(var _0x30087f=0x0,_0x2427bb;_0x30087f<_0x547f38[_0xc1ed('0x15')];_0x30087f+=0x1){_0x2427bb=_0x547f38[_0x30087f][_0xc1ed('0x52')]({'plain':!![]});switch(_0x2427bb[_0xc1ed('0x49')]){case _0xc1ed('0x4a'):_0x36f48e[_0xc1ed('0x26')](db['sequelize'][_0xc1ed('0x4c')](_0x3f7ad1(_0x2427bb,_0xc1ed('0x53')))['then'](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));break;case'onlyIfOpen':_0x36f48e[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x30c901(_0x2427bb,_0xc1ed('0x53')))['then'](function(){})['catch'](_0x3bde6f()));break;default:_0x36f48e[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x46a3c6(_0x2427bb,'CampaignId'))[_0xc1ed('0x25')](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}}return _0x36f48e;})[_0xc1ed('0x50')]();})[_0xc1ed('0x25')](function(){return db['Campaign'][_0xc1ed('0x45')]({'attributes':['id'],'include':[{'model':db[_0xc1ed('0x47')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc1ed('0x25')](function(_0x25e794){var _0x459897=[];if(_0x25e794){for(var _0x294a31=0x0,_0x543961;_0x294a31<_0x25e794[_0xc1ed('0x15')];_0x294a31+=0x1){_0x543961=_0x25e794[_0x294a31][_0xc1ed('0x52')]({'plain':!![]});_0x459897[_0xc1ed('0x26')](db[_0xc1ed('0x4b')]['query'](_0x10033d(_0x543961,_0xc1ed('0x53')))[_0xc1ed('0x25')](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}return _0x459897;})['all']();})[_0xc1ed('0x4e')](function(_0x4b7751){logger[_0xc1ed('0x12')](_0xc1ed('0x54'),'generalCheckHopper',_0x4b7751[_0xc1ed('0x27')]);});}var processPromises=function(_0x2a9c17){return BPromise[_0xc1ed('0x50')](promises)[_0xc1ed('0x25')](function(_0x194cb2){})[_0xc1ed('0x4e')](function(_0x523b0e){logger[_0xc1ed('0x12')](_0xc1ed('0x55'),JSON['stringify'](_0x523b0e));})['finally'](function(){socket[_0xc1ed('0x56')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2a9c17){return _0x2a9c17['resume']();}});};var endCsv=function(){return BPromise[_0xc1ed('0x57')]()[_0xc1ed('0x25')](function(){if(hopperContacts){return checkHopper();}})[_0xc1ed('0x25')](function(){socket[_0xc1ed('0x56')](_0xc1ed('0x58')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x12321e){logger[_0xc1ed('0x12')](_0xc1ed('0x59'),JSON[_0xc1ed('0x28')](_0x12321e));}finally{process[_0xc1ed('0x5a')](0x0);}});};process['on'](_0xc1ed('0x5b'),function(){logger[_0xc1ed('0x5c')](_0xc1ed('0x5d'));endCsv();});function main(){return BPromise[_0xc1ed('0x57')]()[_0xc1ed('0x25')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc1ed('0xe')](',');return db[_0xc1ed('0x22')][_0xc1ed('0x45')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc1ed('0x25')](function(_0x5e8a3c){var _0x10f40e=fs[_0xc1ed('0x5e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x10f40e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x356994,_0x579995){total+=0x1;var _0x482486=total;promises[_0xc1ed('0x26')](checkRow(_0x356994,_0x5e8a3c,_0x482486)[_0xc1ed('0x25')](function(){success+=0x1;})[_0xc1ed('0x4e')](function(_0x106f20){if(_0x106f20[_0xc1ed('0x12')]){errors+=0x1;delete _0x106f20[_0xc1ed('0x12')];}else if(_0x106f20[_0xc1ed('0x5f')]){duplicates+=0x1;delete _0x106f20[_0xc1ed('0x5f')];}rows[_0xc1ed('0x26')](_0x106f20);}));if(total%0xc8===0x0){_0x579995[_0xc1ed('0x60')]();return processPromises(_0x579995);}},'complete':function(){return processPromises()[_0xc1ed('0x25')](function(){logger['info'](_0xc1ed('0x61'));endCsv();});},'error':function(_0x590ee1,_0x339b51){logger[_0xc1ed('0x5c')](_0xc1ed('0x62'),JSON[_0xc1ed('0x28')](_0x590ee1));endCsv();}});})[_0xc1ed('0x4e')](function(_0x39cd03){logger[_0xc1ed('0x12')](_0xc1ed('0x63'),JSON['stringify'](_0x39cd03));});}main(); \ No newline at end of file +var _0x7f0e=['NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','insert','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','id\x20IN\x20?','str','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','query','all','BlackLists','Campaign','CampaignId','onlyIfOpen','generalCheckHopper','finally','emit','contact:csv_','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','stringify','cmContact','checkHopper','inspect','into','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x7f0e,0x167));var _0xe7f0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7f0e[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0xe7f0('0x0'));var util=require(_0xe7f0('0x1'));var _=require(_0xe7f0('0x2'));var fs=require('fs');var squel=require(_0xe7f0('0x3'));var Papa=require(_0xe7f0('0x4'));var Redis=require('ioredis');var db=require(_0xe7f0('0x5'))['db'];var config=require(_0xe7f0('0x6'));var logger=require(_0xe7f0('0x7'))('api');config[_0xe7f0('0x8')]=_[_0xe7f0('0x9')](config[_0xe7f0('0x8')],{'host':_0xe7f0('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe7f0('0x8')]));require(_0xe7f0('0xb'))[_0xe7f0('0xc')](socket);try{if(!process[_0xe7f0('0xd')][0x2]||process[_0xe7f0('0xd')][0x2]==='undefined'||process['argv'][0x2]===_0xe7f0('0xe')){throw new Error(_0xe7f0('0xf'));}var FILEPATH=process[_0xe7f0('0xd')][0x2];if(!process[_0xe7f0('0xd')][0x3]||process[_0xe7f0('0xd')][0x3]===_0xe7f0('0x10')||process['argv'][0x3]===_0xe7f0('0xe')||!process[_0xe7f0('0xd')][0x4]||process[_0xe7f0('0xd')][0x4]==='undefined'||process['argv'][0x4]===_0xe7f0('0xe')){throw new Error(_0xe7f0('0x11'));}var FIELDS=_[_0xe7f0('0x12')](process['argv'][0x3][_0xe7f0('0x13')](','),process[_0xe7f0('0xd')][0x4][_0xe7f0('0x13')](','));if(!process['argv'][0x5]||process[_0xe7f0('0xd')][0x5]===_0xe7f0('0x10')||process[_0xe7f0('0xd')][0x5]===_0xe7f0('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xe7f0('0xd')][0x5];var COMPANYID=process[_0xe7f0('0xd')][0x6]&&process[_0xe7f0('0xd')][0x6]!==_0xe7f0('0x10')&&process[_0xe7f0('0xd')][0x6]!==_0xe7f0('0xe')?process[_0xe7f0('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xe7f0('0xd')][0x7]!==_0xe7f0('0x10')&&process[_0xe7f0('0xd')][0x7]!==_0xe7f0('0xe')?process[_0xe7f0('0xd')][0x7]:null;if(!process[_0xe7f0('0xd')][0x8]||process['argv'][0x8]===_0xe7f0('0x10')||process[_0xe7f0('0xd')][0x8]==='null'){throw new Error(_0xe7f0('0x14'));}var SOCKET_TIMESTAMP=process[_0xe7f0('0xd')][0x8];}catch(_0xa8ee0d){logger['error'](_0xa8ee0d);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(_0x48adf1,_0x105730,_0x2e7b81,_0x3adf21){var _0x371e8d={'message':_0x105730};_0x371e8d[_0x48adf1]=!![];if(_0x2e7b81){_0x371e8d['contact']=_0x2e7b81;}if(_0x3adf21){_0x371e8d[_0xe7f0('0x15')]=_0x3adf21;}return _0x371e8d;}function isEmail(_0x494f37){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))*$/[_0xe7f0('0x16')](_0x494f37);}function checkRow(_0x23a568,_0x3c1b32,_0x4a12fe){return new BPromise(function(_0x43b137,_0x297f6c){if(_[_0xe7f0('0x17')](_0x23a568)){return _0x297f6c(handleCheckRowError(_0xe7f0('0x18'),_0xe7f0('0x19'),null,_0x4a12fe));}if(_0x23a568[_0xe7f0('0x1a')]&&_0x23a568[_0xe7f0('0x1a')][_0xe7f0('0x1b')]){var _0x17a1ca=_[_0xe7f0('0x1c')](_0x23a568['errors'],_0xe7f0('0x1d'))[_0xe7f0('0x1e')](';');return _0x297f6c(handleCheckRowError(_0xe7f0('0x18'),_0x17a1ca,null,_0x4a12fe));}var _0x80d1f2={};for(var _0x4427b3 in FIELDS){if(FIELDS[_0xe7f0('0x1f')](_0x4427b3)&&FIELDS[_0x4427b3]){_0x80d1f2[_0x4427b3]=_0x23a568['data'][0x0][FIELDS[_0x4427b3]]||_0x23a568[_0xe7f0('0x20')][0x0]['\ufeff'+FIELDS[_0x4427b3]];}}if(!_0x80d1f2['firstName']){return _0x297f6c(handleCheckRowError(_0xe7f0('0x18'),'firstName\x20not\x20specified!',null,_0x4a12fe));}if(!_0x80d1f2[_0xe7f0('0x21')]){return _0x297f6c(handleCheckRowError(_0xe7f0('0x18'),_0xe7f0('0x22'),null,_0x4a12fe));}if(_0x80d1f2[_0xe7f0('0x23')]){var _0x1c8a93=moment(_0x80d1f2['birthDate'],'YYYY-MM-DD');if(!_0x1c8a93[_0xe7f0('0x24')]()){return _0x297f6c(handleCheckRowError(_0xe7f0('0x18'),_0xe7f0('0x25'),null,_0x4a12fe));}}if(_0x80d1f2[_0xe7f0('0x26')]){if(!isEmail(_0x80d1f2[_0xe7f0('0x26')])){return _0x297f6c(handleCheckRowError(_0xe7f0('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x4a12fe));}}_0x80d1f2['ListId']=LISTID;_0x80d1f2[_0xe7f0('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe7f0('0x1b')]&&_0x3c1b32){var _0x5ee193={};for(var _0x3e6a9f=0x0,_0x1b5f15=DUPLICATES[_0xe7f0('0x1b')];_0x3e6a9f<_0x1b5f15;_0x3e6a9f+=0x1){_0x5ee193[DUPLICATES[_0x3e6a9f]]=_0x80d1f2[DUPLICATES[_0x3e6a9f]];}var _0x5aa37b=_[_0xe7f0('0x28')](_0x3c1b32,_0x5ee193);if(_0x5aa37b){return _0x297f6c(handleCheckRowError('duplicate',_0xe7f0('0x29'),_0x5aa37b,_0x4a12fe));}}return db[_0xe7f0('0x2a')][_0xe7f0('0x2b')](_0x80d1f2,{'raw':!![],'hooks':![],'fields':_[_0xe7f0('0x2c')](_0x80d1f2)})[_0xe7f0('0x2d')](function(_0x548cc7){if(DUPLICATES&&DUPLICATES['length']&&_0x3c1b32){_0x3c1b32[_0xe7f0('0x2e')](_['pick'](_0x80d1f2,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x548cc7['id'];return _0x43b137();})[_0xe7f0('0x2f')](function(_0x1524ed){return _0x297f6c(handleCheckRowError(_0xe7f0('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1524ed[_0xe7f0('0x1d')]||JSON[_0xe7f0('0x30')](_0x1524ed)),null,_0x4a12fe));});});}function checkHopper(){function _0x5b419c(){return function(_0x33aa79){logger[_0xe7f0('0x18')](_0xe7f0('0x31'),_0xe7f0('0x32'),util[_0xe7f0('0x33')](_0x33aa79,{'showHidden':![],'depth':null}));};}var _0x325d90=function(_0x4c6d98,_0x57e623){var _0xc6f2bf=squel['insert']()[_0xe7f0('0x34')]('cm_hopper')[_0xe7f0('0x35')](['phone',_0xe7f0('0x36'),_0xe7f0('0x37'),_0xe7f0('0x38'),_0x57e623,_0xe7f0('0x39'),_0xe7f0('0x3a')],squel[_0xe7f0('0x3b')]()[_0xe7f0('0x3c')]('phone',_0xe7f0('0x21'))[_0xe7f0('0x3c')](_0xe7f0('0x3d'),'scheduledAt')[_0xe7f0('0x3c')]('id',_0xe7f0('0x37'))['field'](LISTID[_0xe7f0('0x3e')](),_0xe7f0('0x38'))[_0xe7f0('0x3c')](_0x4c6d98['id'][_0xe7f0('0x3e')](),_0x57e623)[_0xe7f0('0x3c')](_0xe7f0('0x3d'),_0xe7f0('0x39'))[_0xe7f0('0x3c')](_0xe7f0('0x3d'),_0xe7f0('0x3a'))[_0xe7f0('0x3f')](_0xe7f0('0x40'))['where'](_0xe7f0('0x41'))[_0xe7f0('0x42')](_0xe7f0('0x43'),LISTID[_0xe7f0('0x3e')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7f0('0x42')](_0xe7f0('0x44'),squel[_0xe7f0('0x3b')]()[_0xe7f0('0x3c')](_0xe7f0('0x21'))[_0xe7f0('0x3f')](_0xe7f0('0x45'))[_0xe7f0('0x42')](_0x57e623+'\x20=\x20?',_0x4c6d98['id'][_0xe7f0('0x3e')]())))[_0xe7f0('0x3e')]();return _0xc6f2bf;};var _0x4d02b8=function(_0x3535f6,_0x18991a){var _0x44ea95=squel[_0xe7f0('0x46')]()[_0xe7f0('0x34')]('cm_hopper')[_0xe7f0('0x35')]([_0xe7f0('0x21'),_0xe7f0('0x36'),'ContactId',_0xe7f0('0x38'),_0x18991a,'createdAt','updatedAt'],squel[_0xe7f0('0x3b')]()[_0xe7f0('0x3c')](_0xe7f0('0x21'),_0xe7f0('0x21'))[_0xe7f0('0x3c')](_0xe7f0('0x3d'),'scheduledAt')[_0xe7f0('0x3c')]('id',_0xe7f0('0x37'))[_0xe7f0('0x3c')](LISTID[_0xe7f0('0x3e')](),_0xe7f0('0x38'))['field'](_0x3535f6['id'][_0xe7f0('0x3e')](),_0x18991a)[_0xe7f0('0x3c')]('NOW()',_0xe7f0('0x39'))[_0xe7f0('0x3c')]('NOW()',_0xe7f0('0x3a'))[_0xe7f0('0x3f')](_0xe7f0('0x40'))[_0xe7f0('0x42')](_0xe7f0('0x41'))[_0xe7f0('0x42')]('ListId\x20=\x20?',LISTID[_0xe7f0('0x3e')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xe7f0('0x42')](_0xe7f0('0x47'))['where'](_0xe7f0('0x44'),squel['select']()[_0xe7f0('0x3c')]('calleridnum')[_0xe7f0('0x3f')]('cm_hopper_final')[_0xe7f0('0x42')](_0x18991a+_0xe7f0('0x48'),_0x3535f6['id'][_0xe7f0('0x3e')]()))['where'](_0xe7f0('0x44'),squel[_0xe7f0('0x3b')]()[_0xe7f0('0x3c')](_0xe7f0('0x21'))['from'](_0xe7f0('0x45'))[_0xe7f0('0x42')](_0x18991a+_0xe7f0('0x48'),_0x3535f6['id']['toString']())))[_0xe7f0('0x3e')]();return _0x44ea95;};function _0x326f70(_0x1ebfa9,_0x55f66a){var _0x411221=squel[_0xe7f0('0x46')]()[_0xe7f0('0x34')](_0xe7f0('0x45'))['fromQuery']([_0xe7f0('0x21'),_0xe7f0('0x36'),'ContactId','ListId',_0x55f66a,_0xe7f0('0x39'),'updatedAt'],squel[_0xe7f0('0x3b')]()[_0xe7f0('0x3c')](_0xe7f0('0x21'),_0xe7f0('0x21'))['field'](_0xe7f0('0x3d'),'scheduledAt')[_0xe7f0('0x3c')]('id',_0xe7f0('0x37'))['field'](LISTID[_0xe7f0('0x3e')](),_0xe7f0('0x38'))[_0xe7f0('0x3c')](_0x1ebfa9['id'][_0xe7f0('0x3e')](),_0x55f66a)[_0xe7f0('0x3c')]('NOW()',_0xe7f0('0x39'))[_0xe7f0('0x3c')](_0xe7f0('0x3d'),_0xe7f0('0x3a'))['from'](_0xe7f0('0x40'))[_0xe7f0('0x42')]('deletedAt\x20IS\x20NULL')[_0xe7f0('0x42')]('ListId\x20=\x20?',LISTID[_0xe7f0('0x3e')]())[_0xe7f0('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0xe7f0('0x47')))[_0xe7f0('0x3e')]();return _0x411221;}function _0x3eca3f(_0x48857c,_0x583b08){var _0x3f29ee=squel[_0xe7f0('0x46')]()[_0xe7f0('0x34')]('cm_hopper_black')[_0xe7f0('0x35')]([_0xe7f0('0x21'),_0xe7f0('0x37'),_0xe7f0('0x38'),_0x583b08,_0xe7f0('0x39'),_0xe7f0('0x3a')],squel['select']()[_0xe7f0('0x3c')]('phone',_0xe7f0('0x21'))['field']('id','ContactId')['field'](LISTID[_0xe7f0('0x3e')](),_0xe7f0('0x38'))[_0xe7f0('0x3c')](_0x48857c['id'][_0xe7f0('0x3e')](),_0x583b08)[_0xe7f0('0x3c')](_0xe7f0('0x3d'),_0xe7f0('0x39'))['field']('NOW()','updatedAt')['from'](_0xe7f0('0x40'))[_0xe7f0('0x42')](_0xe7f0('0x41'))['where']('ListId\x20=\x20?',LISTID[_0xe7f0('0x3e')]())[_0xe7f0('0x42')](_0xe7f0('0x49'),squel[_0xe7f0('0x4a')](hopperContacts))[_0xe7f0('0x42')](_0xe7f0('0x47')))[_0xe7f0('0x3e')]();return _0x3f29ee;}return db[_0xe7f0('0x4b')][_0xe7f0('0x4c')]({'where':{'type':_0xe7f0('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe7f0('0x4e')],'as':_0xe7f0('0x4f'),'where':{'id':LISTID}}]})[_0xe7f0('0x2d')](function(_0x39efe5){var _0x6a7f09=[];if(_0x39efe5){var _0x51d3b5;for(var _0xc4db02=0x0,_0x3a9ee0;_0xc4db02<_0x39efe5[_0xe7f0('0x1b')];_0xc4db02+=0x1){_0x3a9ee0=_0x39efe5[_0xc4db02][_0xe7f0('0x50')]({'plain':!![]});switch(_0x3a9ee0[_0xe7f0('0x51')]){case _0xe7f0('0x52'):_0x6a7f09[_0xe7f0('0x2e')](db['sequelize']['query'](_0x4d02b8(_0x3a9ee0,'VoiceQueueId'))['then'](function(){})[_0xe7f0('0x2f')](_0x5b419c()));break;case'onlyIfOpen':_0x6a7f09[_0xe7f0('0x2e')](db[_0xe7f0('0x53')]['query'](_0x325d90(_0x3a9ee0,_0xe7f0('0x54')))[_0xe7f0('0x2d')](function(){})[_0xe7f0('0x2f')](_0x5b419c()));break;default:_0x6a7f09['push'](db[_0xe7f0('0x53')][_0xe7f0('0x55')](_0x326f70(_0x3a9ee0,_0xe7f0('0x54')))[_0xe7f0('0x2d')](function(){})[_0xe7f0('0x2f')](_0x5b419c()));}}}return _0x6a7f09;})[_0xe7f0('0x56')]()[_0xe7f0('0x2d')](function(){return db[_0xe7f0('0x4b')][_0xe7f0('0x4c')]({'where':{'type':_0xe7f0('0x4d')},'attributes':['id'],'include':[{'model':db[_0xe7f0('0x4e')],'as':_0xe7f0('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x4d7599){var _0x4e3041=[];if(_0x4d7599){var _0x87e3da;for(var _0x479d1d=0x0,_0xf27b43;_0x479d1d<_0x4d7599[_0xe7f0('0x1b')];_0x479d1d+=0x1){_0xf27b43=_0x4d7599[_0x479d1d][_0xe7f0('0x50')]({'plain':!![]});_0x4e3041[_0xe7f0('0x2e')](db['sequelize'][_0xe7f0('0x55')](_0x3eca3f(_0xf27b43,_0xe7f0('0x54')))[_0xe7f0('0x2d')](function(){})[_0xe7f0('0x2f')](_0x5b419c()));}}return _0x4e3041;})[_0xe7f0('0x56')]();})[_0xe7f0('0x2d')](function(){return db[_0xe7f0('0x58')][_0xe7f0('0x4c')]({'attributes':['id',_0xe7f0('0x51')],'include':[{'model':db[_0xe7f0('0x4e')],'as':_0xe7f0('0x4f'),'where':{'id':LISTID}}]})[_0xe7f0('0x2d')](function(_0x1ccb6c){var _0x1bc4d0=[];if(_0x1ccb6c){for(var _0x54f792=0x0,_0x1e6797;_0x54f792<_0x1ccb6c['length'];_0x54f792+=0x1){_0x1e6797=_0x1ccb6c[_0x54f792][_0xe7f0('0x50')]({'plain':!![]});switch(_0x1e6797[_0xe7f0('0x51')]){case'always':_0x1bc4d0[_0xe7f0('0x2e')](db[_0xe7f0('0x53')][_0xe7f0('0x55')](_0x4d02b8(_0x1e6797,_0xe7f0('0x59')))[_0xe7f0('0x2d')](function(){})[_0xe7f0('0x2f')](_0x5b419c()));break;case _0xe7f0('0x5a'):_0x1bc4d0['push'](db[_0xe7f0('0x53')]['query'](_0x325d90(_0x1e6797,_0xe7f0('0x59')))['then'](function(){})[_0xe7f0('0x2f')](_0x5b419c()));break;default:_0x1bc4d0[_0xe7f0('0x2e')](db[_0xe7f0('0x53')]['query'](_0x326f70(_0x1e6797,_0xe7f0('0x59')))[_0xe7f0('0x2d')](function(){})[_0xe7f0('0x2f')](_0x5b419c()));}}}return _0x1bc4d0;})[_0xe7f0('0x56')]();})[_0xe7f0('0x2d')](function(){return db[_0xe7f0('0x58')][_0xe7f0('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe7f0('0x57'),'where':{'id':LISTID}}]})[_0xe7f0('0x2d')](function(_0x2758ca){var _0x137476=[];if(_0x2758ca){for(var _0x67b482=0x0,_0x5f38f9;_0x67b482<_0x2758ca[_0xe7f0('0x1b')];_0x67b482+=0x1){_0x5f38f9=_0x2758ca[_0x67b482][_0xe7f0('0x50')]({'plain':!![]});_0x137476[_0xe7f0('0x2e')](db[_0xe7f0('0x53')][_0xe7f0('0x55')](_0x3eca3f(_0x5f38f9,_0xe7f0('0x59')))[_0xe7f0('0x2d')](function(){})[_0xe7f0('0x2f')](_0x5b419c()));}}return _0x137476;})['all']();})[_0xe7f0('0x2f')](function(_0x55023b){logger[_0xe7f0('0x18')]('cmContact,\x20%s,\x20%s',_0xe7f0('0x5b'),_0x55023b[_0xe7f0('0x1d')]);});}var processPromises=function(_0x52c56a){return BPromise[_0xe7f0('0x56')](promises)[_0xe7f0('0x2d')](function(_0x2df090){})['catch'](function(_0x2d44cb){logger[_0xe7f0('0x18')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x2d44cb));})[_0xe7f0('0x5c')](function(){socket[_0xe7f0('0x5d')](_0xe7f0('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x52c56a){return _0x52c56a['resume']();}});};var endCsv=function(){return BPromise[_0xe7f0('0x5f')]()[_0xe7f0('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xe7f0('0x2d')](function(){socket['emit'](_0xe7f0('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe7f0('0x60')](FILEPATH);}catch(_0x189dfb){logger[_0xe7f0('0x18')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x189dfb));}finally{process[_0xe7f0('0x61')](0x0);}});};process['on'](_0xe7f0('0x62'),function(){logger[_0xe7f0('0x63')](_0xe7f0('0x64'));endCsv();});function main(){return BPromise[_0xe7f0('0x5f')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe7f0('0x13')](',');return db[_0xe7f0('0x2a')][_0xe7f0('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe7f0('0x2d')](function(_0x5b1c25){var _0x85b7a1=fs[_0xe7f0('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe7f0('0x66')](_0x85b7a1,{'header':!![],'skipEmptyLines':!![],'step':function(_0x95f999,_0x49ea31){total+=0x1;var _0x2a7c20=total;promises[_0xe7f0('0x2e')](checkRow(_0x95f999,_0x5b1c25,_0x2a7c20)[_0xe7f0('0x2d')](function(){success+=0x1;})[_0xe7f0('0x2f')](function(_0x3d9f5b){if(_0x3d9f5b['error']){errors+=0x1;delete _0x3d9f5b['error'];}else if(_0x3d9f5b['duplicate']){duplicates+=0x1;delete _0x3d9f5b['duplicate'];}rows[_0xe7f0('0x2e')](_0x3d9f5b);}));if(total%0xc8===0x0){_0x49ea31['pause']();return processPromises(_0x49ea31);}},'complete':function(){return processPromises()['then'](function(){logger[_0xe7f0('0x63')](_0xe7f0('0x67'));endCsv();});},'error':function(_0x47a0dd,_0x50028a){logger['info']('CSV\x20parse\x20error',JSON[_0xe7f0('0x30')](_0x47a0dd));endCsv();}});})['catch'](function(_0x44a57a){logger[_0xe7f0('0x18')](_0xe7f0('0x68'),JSON[_0xe7f0('0x30')](_0x44a57a));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index dfcf6b5..ecb2b54 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 _0x9ba7=['itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CREATE\x20TABLE\x20','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','VoiceQueueId','campaigns_has_cm_lists','CampaignId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','papaparse','util','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','from','join','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','length','split','filter','CmContactHasItem','findOne','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','createdAt','updatedAt','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','field','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','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','isNil','utcOffset','set','offset','stringify','send','start','binding','clone','socket_timestamp','root','.csv','includes','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9ba7,0xdf));var _0x79ba=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9ba7[_0x16b9ed];return _0x66b1f8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x79ba('0x0'));var util=require(_0x79ba('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0x79ba('0x2'))['db'];var config=require(_0x79ba('0x3'));var shared=require(_0x79ba('0x4'));var logger=require(_0x79ba('0x5'))(_0x79ba('0x6'));config[_0x79ba('0x7')]=_[_0x79ba('0x8')](config[_0x79ba('0x7')],{'host':_0x79ba('0x9'),'port':0x18eb});var socket=require(_0x79ba('0xa'))(new Redis(config[_0x79ba('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x79ba('0xb')](_0x79ba('0xc'));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(_0xfb37cb){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'](_0xfb37cb);}function selectNotIn(_0x539901,_0x526976,_0x3f10d7,_0x22ce7a,_0x1bdd66){return squel[_0x79ba('0xd')]()['field']('phone')[_0x79ba('0xe')](_0x22ce7a)[_0x79ba('0xf')](_0x526976,null,_0x526976+'.id\x20=\x20'+_0x22ce7a+'.'+_0x3f10d7)['where'](_0x22ce7a+'.'+_0x3f10d7+'\x20=\x20'+_0x539901+'.'+_0x3f10d7)[_0x79ba('0x10')](_0x526976+_0x79ba('0x11')+_0x1bdd66[_0x79ba('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bf4af,_0x92ff34){promisesAdditionalPhones=[];return db[_0x79ba('0x12')][_0x79ba('0x13')]({'raw':!![],'attributes':['id',_0x79ba('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x79ba('0x15')](function(_0x13b8bf){if(_0x13b8bf!==null){var _0x4f9145=[];for(var _0x5f567e=0x0;_0x5f567e<_0x13b8bf['length'];_0x5f567e++){var _0x2dd69e=_0x13b8bf[_0x5f567e];_0x4f9145[_0x79ba('0x16')](insertAdditionalPhones(_0x2dd69e));}}Promise[_0x79ba('0x17')](_0x4f9145)[_0x79ba('0x15')](function(){_0x5bf4af({'val':0x1});});});});}function insertAdditionalPhones(_0x44f622){return new Promise(function(_0x3d4e10,_0x1bc158){var _0x288c5f=_0x44f622[_0x79ba('0x14')];var _0x589106=_0x288c5f['split'](';');var _0x3275a5=[];orderBy=0x0;for(var _0x870444=0x0;_0x870444<_0x589106[_0x79ba('0x18')];_0x870444++){_0x3275a5[_0x79ba('0x16')](splitAdditionalPhone(_0x44f622['id'],_0x589106[_0x870444]));}Promise[_0x79ba('0x17')](_0x3275a5)[_0x79ba('0x15')](function(){_0x3d4e10({'val':_0x589106[_0x79ba('0x18')]});});});}function splitAdditionalPhone(_0x21c9b4,_0x10cad6){return new Promise(function(_0x4c6e27,_0x9bc179){var _0x558d3e=_0x10cad6[_0x79ba('0x19')](':');var _0x1ae283=_0x558d3e[0x0];var _0x265842=_0x558d3e[0x1];if(!_['isNil'](_0x265842)){var _0x3ab694=_0x265842[_0x79ba('0x19')]('|');var _0x18b560=[];for(var _0x58553d=0x0;_0x58553d<_0x3ab694['length'];_0x58553d++){if(_0x3ab694[_0x58553d]!==''){var _0x376302=_[_0x79ba('0x1a')](promisesAdditionalPhones,{'contactId':_0x21c9b4,'phone':_0x3ab694[_0x58553d]});if(_0x376302[_0x79ba('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x79ba('0x16')]({'contactId':_0x21c9b4,'contactTypeId':_0x1ae283,'phone':_0x3ab694[_0x58553d],'orderBy':orderBy});}}}_0x4c6e27({'ok':0x1});}else _0x4c6e27({'res':0x0});});}function createAdditionalPhone(_0x576c88,_0x5003da,_0x1aa14e,_0x5739df){var _0x4aa183='';var _0x2c0524='';var _0x186445=_0x1aa14e['split']('§');_0x4aa183=_0x186445[0x0];if(_0x186445['length']==0x2)_0x2c0524=_0x186445[0x1];return new Promise(function(_0x4c4e70,_0x2437c4){return db[_0x79ba('0x1b')][_0x79ba('0x1c')]({'where':{'CmContactId':_0x576c88,'item':_0x4aa183}})[_0x79ba('0x15')](function(_0x28ace7){if(_0x28ace7){return db[_0x79ba('0x1b')]['update']({'ItemTypeId':_0x5003da,'description':_0x2c0524,'OrderBy':_0x5739df},{'where':{'CmContactId':_0x576c88,'item':_0x4aa183}})['then'](function(_0x48256b){_0x4c4e70({'res':'updated'});});}else{return db[_0x79ba('0x1b')][_0x79ba('0x1d')]({'CmContactId':_0x576c88,'item':_0x4aa183,'description':_0x2c0524,'ItemTypeId':_0x5003da,'OrderBy':_0x5739df,'ItemClass':_0x79ba('0x1e')})[_0x79ba('0x15')](function(_0x3e2fd3){_0x4c4e70({'res':'inserted'});});}});});}function insertCmHopper(_0x52e146,_0x535a48,_0x43376b,_0xd3565c,_0x1b35eb){var _0x4258ce=[_0x79ba('0x1f'),'cm_contacts.scheduledat',_0x79ba('0x20'),'cm_contacts.ListId',_0x535a48+'.'+_0xd3565c,_0x79ba('0x21'),'cm_contacts.updatedAt',_0x79ba('0x22'),'cm_contacts.UserId','\x22'+_0x1b35eb+'\x22'];return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x25'))[_0x79ba('0x26')]([_0x79ba('0x27'),_0x79ba('0x28'),_0x79ba('0x29'),_0x79ba('0x2a'),_0xd3565c,'createdAt','updatedAt',_0x79ba('0x2b'),_0x79ba('0x2c'),_0x79ba('0x2d')],squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x4258ce)[_0x79ba('0xe')](_0x535a48)[_0x79ba('0xf')](_0x79ba('0x2f'),null,_0x79ba('0x30')+_0x535a48+_0x79ba('0x31'))[_0x79ba('0xf')](_0x43376b,null,_0x43376b+_0x79ba('0x32')+_0x535a48+'.'+_0xd3565c)[_0x79ba('0x10')](_0x535a48+_0x79ba('0x33'),_0x52e146)[_0x79ba('0x10')](_0x79ba('0x34'),NOW)[_0x79ba('0x10')](_0x79ba('0x35'),selectNotIn(_0x535a48,_0x43376b,_0xd3565c,_0x79ba('0x25'),[_0x79ba('0x36'),_0x79ba('0x37')]))[_0x79ba('0x10')](_0x79ba('0x35'),selectNotIn(_0x535a48,_0x43376b,_0xd3565c,_0x79ba('0x25'),[_0x79ba('0x36')])))[_0x79ba('0x38')]();}function insertCmHopperBlack(_0x324249,_0x33273f,_0x20b905,_0x12ac9c){var _0x1b2bbd=[_0x79ba('0x1f'),_0x79ba('0x20'),_0x79ba('0x39'),_0x33273f+'.'+_0x12ac9c,'cm_contacts.createdAt',_0x79ba('0x3a')];return squel[_0x79ba('0x23')]()['into'](_0x79ba('0x3b'))['fromQuery']([_0x79ba('0x27'),'ContactId',_0x79ba('0x2a'),_0x12ac9c,_0x79ba('0x3c'),_0x79ba('0x3d')],squel[_0x79ba('0xd')]()['fields'](_0x1b2bbd)[_0x79ba('0xe')](_0x33273f)[_0x79ba('0xf')]('cm_contacts',null,_0x79ba('0x30')+_0x33273f+'.CmListId')[_0x79ba('0xf')](_0x20b905,null,_0x20b905+'.id\x20=\x20'+_0x33273f+'.'+_0x12ac9c)[_0x79ba('0x10')](_0x33273f+_0x79ba('0x33'),_0x324249)['where'](_0x79ba('0x34'),NOW)['where'](_0x79ba('0x35'),squel[_0x79ba('0xd')]()['field']('phone')['from'](_0x79ba('0x3b'))[_0x79ba('0x10')](_0x79ba('0x3e'),_0x324249)[_0x79ba('0x10')](_0x12ac9c+'\x20=\x20'+_0x33273f+'.'+_0x12ac9c)))[_0x79ba('0x38')]();}function insertTzCmHopper(_0x550c4a,_0x4be79c,_0x1aa03f,_0x4e6949,_0x19a1eb,_0x4c4104){var _0x49bcc3=[_0x79ba('0x1f'),_0x79ba('0x3f')+_0x4c4104+_0x79ba('0x40'),'cm_contacts.id',_0x79ba('0x39'),_0x4be79c+'.'+_0x4e6949,_0x79ba('0x21'),_0x79ba('0x3a'),_0x79ba('0x22'),_0x79ba('0x41'),'\x22'+_0x19a1eb+'\x22'];var _0x6d9a55=squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x25'))[_0x79ba('0x26')]([_0x79ba('0x27'),_0x79ba('0x28'),_0x79ba('0x29'),_0x79ba('0x2a'),_0x4e6949,_0x79ba('0x3c'),_0x79ba('0x3d'),_0x79ba('0x2b'),_0x79ba('0x2c'),_0x79ba('0x2d')],squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x49bcc3)[_0x79ba('0xe')](_0x4be79c)['join'](_0x79ba('0x2f'),null,_0x79ba('0x30')+_0x4be79c+_0x79ba('0x31'))[_0x79ba('0xf')](_0x1aa03f,null,_0x1aa03f+_0x79ba('0x32')+_0x4be79c+'.'+_0x4e6949)['join'](_0x4c4104,null,_0x4c4104+_0x79ba('0x32')+_0x4be79c+'.'+_0x4e6949)[_0x79ba('0x10')](_0x4be79c+_0x79ba('0x33'),_0x550c4a)[_0x79ba('0x10')](_0x79ba('0x34'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4be79c,_0x1aa03f,_0x4e6949,_0x79ba('0x25'),[_0x79ba('0x36'),_0x79ba('0x37')]))['where'](_0x79ba('0x35'),selectNotIn(_0x4be79c,_0x1aa03f,_0x4e6949,_0x79ba('0x25'),[_0x79ba('0x36')])))[_0x79ba('0x38')]();return _0x6d9a55;}function insertTzCmHopperBlack(_0x3f570e,_0x30c25b,_0x1ac678,_0x1312c7){var _0xb74296=[_0x79ba('0x1f'),'cm_contacts.id','cm_contacts.ListId',_0x30c25b+'.'+_0x1312c7,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x3b'))[_0x79ba('0x26')]([_0x79ba('0x27'),_0x79ba('0x29'),_0x79ba('0x2a'),_0x1312c7,'createdAt',_0x79ba('0x3d')],squel['select']()['fields'](_0xb74296)[_0x79ba('0xe')](_0x30c25b)['join'](_0x79ba('0x2f'),null,'cm_contacts.ListId\x20=\x20'+_0x30c25b+_0x79ba('0x31'))[_0x79ba('0xf')](_0x1ac678,null,_0x1ac678+_0x79ba('0x32')+_0x30c25b+'.'+_0x1312c7)[_0x79ba('0x10')](_0x30c25b+_0x79ba('0x33'),_0x3f570e)[_0x79ba('0x10')](_0x79ba('0x34'),NOW)[_0x79ba('0x10')](_0x79ba('0x35'),squel[_0x79ba('0xd')]()[_0x79ba('0x42')](_0x79ba('0x27'))[_0x79ba('0xe')]('cm_hopper_black')[_0x79ba('0x10')]('ListId\x20=\x20?',_0x3f570e)[_0x79ba('0x10')](_0x1312c7+_0x79ba('0x43')+_0x30c25b+'.'+_0x1312c7)))[_0x79ba('0x38')]();}function insertCmHopperAdditionalPhones(_0x4efdeb){var _0x23f226=[_0x79ba('0x44'),_0x79ba('0x45'),_0x79ba('0x46'),'cm_contact_has_items.createdAt',_0x79ba('0x47')];return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x48'))['fromQuery'](['CmHopperId',_0x79ba('0x27'),_0x79ba('0x49'),_0x79ba('0x3c'),_0x79ba('0x3d')],squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x23f226)[_0x79ba('0xe')](_0x79ba('0x25'))[_0x79ba('0xf')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x79ba('0xf')](_0x79ba('0x4a'),null,_0x79ba('0x4b'))[_0x79ba('0x10')](_0x79ba('0x4c'),_0x4efdeb)[_0x79ba('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x79ba('0x38')]();}function insertCmContact(_0x27dd3f,_0x55a613,_0x56ac70,_0x491a8b){var _0x592f94=_['concat'](_[_0x79ba('0x4d')](_0x491a8b),[_0x79ba('0x2a'),_0x79ba('0x4e'),_0x79ba('0x3c'),'updatedAt',_0x79ba('0x4f')]);return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x2f'))[_0x79ba('0x26')](_0x592f94,squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x592f94)[_0x79ba('0xe')](_0x55a613)[_0x79ba('0x10')]('('+_0x56ac70[_0x79ba('0xf')](',')+_0x79ba('0x50'),squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x56ac70)['from'](_0x79ba('0x2f'))[_0x79ba('0x10')](_0x79ba('0x3e'),_0x27dd3f)[_0x79ba('0x10')](_0x79ba('0x51')))[_0x79ba('0x10')]('id\x20IN\x20?',squel[_0x79ba('0xd')]()[_0x79ba('0x42')](_0x79ba('0x52'),_0x79ba('0x53'))[_0x79ba('0xe')](_0x55a613)[_0x79ba('0x54')](_0x56ac70['join'](','))))[_0x79ba('0x38')]();}function handleStop(){logger[_0x79ba('0x55')](_0x79ba('0x56'));stopped=!![];}function handleUncaughtException(_0x12a985){logger[_0x79ba('0x57')](_0x12a985[_0x79ba('0x58')]);process[_0x79ba('0x59')](0x1);}function handleError(_0x2bd52d,_0x36e0db){stats[_0x79ba('0x5a')][_0x79ba('0x16')]({'name':_0x36e0db[_0x79ba('0x5b')],'message':_0x36e0db[_0x79ba('0x58')],'row':_0x2bd52d});}function handleQuery(_0x3bfc24){logger['info'](_0x3bfc24);return db[_0x79ba('0x5c')][_0x79ba('0x5d')](_0x3bfc24)[_0x79ba('0x5e')](function(_0x862ec8){results['push'](_0x862ec8);})[_0x79ba('0x5f')](function(_0x1f5885){logger[_0x79ba('0x57')](_0x1f5885[_0x79ba('0x58')]);});}function updateTzCampaigns(_0x503a0f){return new Promise(function(_0x581032,_0x1be28a){var _0x46a5e4=squel[_0x79ba('0xd')]()[_0x79ba('0x2e')]([_0x79ba('0x60'),_0x79ba('0x61')])['from'](_0x79ba('0x62'))[_0x79ba('0xf')]('campaigns_has_cm_lists',null,_0x79ba('0x63'))['where']('campaigns_has_cm_lists.CmListId='+_0x503a0f);db['sequelize']['query'](_0x46a5e4[_0x79ba('0x38')]())[_0x79ba('0x5e')](function(_0x3ddec8){var _0x2f05b5=[];for(var _0xc0bb61=0x0;_0xc0bb61<_0x3ddec8['length'];_0xc0bb61++){_0x2f05b5[_0x79ba('0x16')](getTimezoneData(_0x3ddec8[_0xc0bb61],tmp_campaigns));}BPromise[_0x79ba('0x17')](_0x2f05b5)[_0x79ba('0x15')](function(){_0x581032({'val':0x1});});})[_0x79ba('0x5f')](function(_0x558c1b){logger['error'](_0x558c1b['message']);_0x581032({'val':0x0});});});}function updateTzVoiceQueues(_0x353d1f){return new Promise(function(_0x3c3340,_0x40e5da){var _0x4c8bcc=squel[_0x79ba('0xd')]()[_0x79ba('0x2e')]([_0x79ba('0x64'),_0x79ba('0x65')])['from'](_0x79ba('0x66'))[_0x79ba('0xf')](_0x79ba('0x67'),null,_0x79ba('0x68'))[_0x79ba('0x10')](_0x79ba('0x69')+_0x353d1f);db['sequelize']['query'](_0x4c8bcc[_0x79ba('0x38')]())['spread'](function(_0xd59b2d){var _0x50ba07=[];for(var _0x4e34ea=0x0;_0x4e34ea<_0xd59b2d[_0x79ba('0x18')];_0x4e34ea++){_0x50ba07[_0x79ba('0x16')](getTimezoneData(_0xd59b2d[_0x4e34ea],tmp_voice_queues));}BPromise[_0x79ba('0x17')](_0x50ba07)['then'](function(){_0x3c3340({'val':0x1});});})[_0x79ba('0x5f')](function(_0x1ba864){logger[_0x79ba('0x57')](_0x1ba864[_0x79ba('0x58')]);_0x3c3340({'val':0x0});});});}function getTimezoneData(_0x4fc856,_0x2fc23b){return new Promise(function(_0x34c73c,_0x31f40c){var _0x58d028=shared[_0x79ba('0x6a')];var _0x450d09=_0x58d028[_0x4fc856[_0x79ba('0x6b')]];if(_[_0x79ba('0x6c')](_0x450d09)){_0x34c73c({'ret':0x1});}else{var _0x305193=_0x450d09[_0x79ba('0x6d')];var _0x489d10=squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x2fc23b)[_0x79ba('0x6e')]('id',_0x4fc856['id'])[_0x79ba('0x6e')](_0x79ba('0x6f'),_0x305193)['set'](_0x79ba('0x6b'),_0x4fc856[_0x79ba('0x6b')])[_0x79ba('0x38')]();return db['sequelize'][_0x79ba('0x5d')](_0x489d10)[_0x79ba('0x5e')](function(_0xee9039){_0x34c73c({'ret':0x1});})[_0x79ba('0x5f')](function(_0x591c5e){logger[_0x79ba('0x57')](_0x591c5e[_0x79ba('0x58')]);_0x31f40c({'ret':0x1});});}});}function handleTZQuery(_0x324105){logger[_0x79ba('0x55')](_0x324105);return db[_0x79ba('0x5c')][_0x79ba('0x5d')](_0x324105)[_0x79ba('0x5e')](function(_0xfe1456){})[_0x79ba('0x5f')](function(_0x2454db){logger[_0x79ba('0x57')](_0x2454db[_0x79ba('0x58')]);});}function main(_0x4619ca,_0x880d0c,_0x5d04de,_0x38252c){logger['info']('main',_0x4619ca,JSON[_0x79ba('0x70')](_0x880d0c));process[_0x79ba('0x71')](_0x79ba('0x72'));var _0x2abdde=_0x880d0c[_0x79ba('0x73')];var _0x5c3825=_[_0x79ba('0x74')](_0x2abdde);var _0x1955bc=_0x880d0c[_0x79ba('0x75')];var _0x36d825=path[_0x79ba('0xf')](config[_0x79ba('0x76')],'server/files/tmp',_0x1955bc+_0x79ba('0x77'));hasTZ=_['keys'](_0x2abdde)[_0x79ba('0x78')]('dialTimezone');var _0x5b613f=_['keys'](_0x2abdde)['join']();logger[_0x79ba('0x55')]('header',_0x5b613f);db[_0x79ba('0x79')]['findAll']({'raw':!![],'attributes':['id',_0x79ba('0x7a')]})[_0x79ba('0x15')](function(_0x28eaf9){for(var _0x42ac5a=0x0;_0x42ac5a<_0x28eaf9['length'];_0x42ac5a++){if(_0x28eaf9[_0x42ac5a][_0x79ba('0x7a')]in _0x2abdde){contactItemTypes[_0x79ba('0x16')](_0x28eaf9[_0x42ac5a]);delete _0x5c3825[_0x28eaf9[_0x42ac5a][_0x79ba('0x7a')]];hasAdditionalPhones=!![];}for(var _0x516f43 in _0x2abdde){if(_0x28eaf9[_0x42ac5a][_0x79ba('0x7a')]+_0x79ba('0x7b')===_0x516f43){phoneDescriptions['push']({'itemTypeId':_0x28eaf9[_0x42ac5a]['id'],'description':_0x516f43});delete _0x5c3825[_0x516f43];}}}if(hasAdditionalPhones)_0x5c3825[_0x79ba('0x14')]='';var _0x3b24b0=_[_0x79ba('0x4d')](_0x5c3825)['join']();logger[_0x79ba('0x55')](_0x79ba('0x7c'),_0x3b24b0);fs[_0x79ba('0x7d')](_0x36d825,_0x3b24b0+'\x0a');Papa[_0x79ba('0x7e')](fs[_0x79ba('0x7f')](_0x4619ca),{'header':!![],'skipEmptyLines':!![],'step':function(_0x8681ca,_0x2fe13b){try{for(var _0x326bdf=0x0,_0x200c13=[];_0x326bdf<_0x8681ca[_0x79ba('0x80')][_0x79ba('0x18')];_0x326bdf++){stats[_0x79ba('0x81')]+=0x1;if(_0x8681ca['errors'][_0x326bdf]){handleError(_0x8681ca[_0x79ba('0x80')][_0x326bdf],_0x8681ca[_0x79ba('0x5a')][_0x326bdf]);}else{var _0x25e4bb=[];var _0x709775=[];var _0x2ebbdc={};for(var _0x59e679 in _0x2abdde){let _0x22ed47=contactItemTypes[_0x79ba('0x82')](_0x3a5948=>_0x3a5948[_0x79ba('0x7a')]===_0x59e679);let _0x545721=contactItemTypes[_0x79ba('0x82')](_0x50cdac=>_0x50cdac[_0x79ba('0x7a')]+'_description'===_0x59e679);if(_[_0x79ba('0x6c')](_0x22ed47)&&_['isNil'](_0x545721)){if(_0x2abdde[_0x79ba('0x83')](_0x59e679)){if(_0x8681ca[_0x79ba('0x80')][_0x326bdf][_0x2abdde[_0x59e679]]){var _0x245bf4=_[_0x79ba('0x84')](_0x8681ca['data'][_0x326bdf][_0x2abdde[_0x59e679]][_0x79ba('0x85')](/"/g,'\x27'));switch(_0x59e679){case _0x79ba('0x28'):var _0x212ac5=moment(_0x245bf4,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x212ac5[_0x79ba('0x86')]()){_0x200c13['push']('\x22'+_0x245bf4+'\x22');}else{_0x25e4bb['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x79ba('0x2b'):var _0x545ebf=parseInt(_0x245bf4);_0x245bf4=_[_0x79ba('0x87')](_0x545ebf)||_0x545ebf<0x0||_0x545ebf>0x4?_0x38252c?0x3:0x2:_0x545ebf;_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');break;case'UserId':var _0xabb1c3=parseInt(_0x245bf4);if(_[_0x79ba('0x88')](_0xabb1c3)&&_['includes'](_0x5d04de,_0xabb1c3)){_0x200c13[_0x79ba('0x16')]('\x22'+_0xabb1c3+'\x22');}else{_0x25e4bb[_0x79ba('0x16')](_0x79ba('0x89'));}break;case'email':if(isEmail(_0x245bf4)){_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');}else{_0x25e4bb[_0x79ba('0x16')]('email\x20wrong\x20format');}break;case _0x79ba('0x8a'):var _0x23afe3=moment(_0x245bf4,_0x79ba('0x8b'),!![]);if(_0x23afe3[_0x79ba('0x86')]()){_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');}else{_0x25e4bb[_0x79ba('0x16')](_0x79ba('0x8c'));}break;case _0x79ba('0x6b'):var _0x20fb6b=shared[_0x79ba('0x6a')];var _0x19fec9=_0x20fb6b[_0x245bf4];if(!_[_0x79ba('0x6c')](_0x19fec9)){var _0x7ec4da=_0x19fec9[_0x79ba('0x6d')];_0x200c13['push']('\x22'+_0x245bf4+'\x22');_0x200c13[_0x79ba('0x16')]('\x22'+_0x7ec4da+'\x22');}break;default:_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');}}else{switch(_0x59e679){case _0x79ba('0x8d'):case'phone':_0x25e4bb[_0x79ba('0x16')](_0x59e679+_0x79ba('0x8e'));break;default:_0x200c13[_0x79ba('0x16')]('\x22\x22');}}}}else{var _0x40811c='';if(!_['isNil'](_0x22ed47)){if(!_0x2ebbdc['hasOwnProperty'](_0x22ed47['id'])){if(!_[_0x79ba('0x6c')](_0x8681ca[_0x79ba('0x80')][_0x326bdf][_0x2abdde[_0x59e679]])){var _0x245bf4=_[_0x79ba('0x84')](_0x8681ca['data'][_0x326bdf][_0x2abdde[_0x59e679]][_0x79ba('0x85')](/"/g,'\x27'));var _0x58ae8f=phoneDescriptions[_0x79ba('0x82')](_0x13f55b=>_0x13f55b[_0x79ba('0x8f')]===_0x22ed47['id']);if(!_['isNil'](_0x58ae8f)){var _0x5ca875=_['trim'](_0x8681ca[_0x79ba('0x80')][_0x326bdf][_0x2abdde[_0x58ae8f[_0x79ba('0x90')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x5ca875))_0x245bf4=_0x245bf4+'§'+_0x5ca875;}if(_0x40811c=='')_0x40811c=_0x245bf4;else _0x40811c+='|'+_0x245bf4;}_0x709775['push'](_0x22ed47['id']+':'+_0x40811c);_0x2ebbdc[_0x22ed47['id']]=0x1;}}}}if(hasAdditionalPhones){_0x200c13['push']('\x22'+_0x709775[_0x79ba('0xf')](';')+'\x22');}if(_0x25e4bb[_0x79ba('0x18')]){handleError(_0x8681ca['data'][_0x326bdf],{'code':_0x79ba('0x91'),'message':_0x25e4bb[_0x79ba('0xf')]()});}else{fs[_0x79ba('0x92')](_0x36d825,_0x200c13[_0x79ba('0xf')]()+'\x0a');}_0x200c13=[];}if(!(stats['rows']%0xc8)){socket[_0x79ba('0x93')]('contact:import:'+_0x1955bc,stats);stats[_0x79ba('0x5a')]=[];}}if(stopped){logger[_0x79ba('0x55')](_0x79ba('0x94'));_0x2fe13b[_0x79ba('0x95')]();}}catch(_0xbc8aba){handleError(_0x8681ca['data'][_0x326bdf],{'code':'SystemError','message':_0xbc8aba[_0x79ba('0x58')]});logger['error'](_0x79ba('0x96'),_0xbc8aba[_0x79ba('0x58')]);}},'complete':function(){try{var _0x12ecf1=[];var _0x1359ae=[];var _0x114bbb=_0x79ba('0x2f');if(_0x880d0c[_0x79ba('0x97')]&&_0x880d0c[_0x79ba('0x97')][_0x79ba('0x18')]){_0x114bbb=_0x79ba('0x98')+_0x1955bc;_0x12ecf1[_0x79ba('0x16')]('CREATE\x20TABLE\x20'+_0x114bbb+_0x79ba('0x99'));}tmp_campaigns=_0x79ba('0x9a')+_0x1955bc;tmp_voice_queues=_0x79ba('0x9b')+_0x1955bc;_0x1359ae[_0x79ba('0x16')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x79ba('0x9c'));_0x1359ae[_0x79ba('0x16')](_0x79ba('0x9d')+tmp_voice_queues+_0x79ba('0x9c'));BPromise[_0x79ba('0x9e')](_0x1359ae,handleTZQuery)[_0x79ba('0x15')](function(_0x4ec198){updateTzCampaigns(_0x880d0c[_0x79ba('0x2a')])['then'](function(_0x2ffebe){updateTzVoiceQueues(_0x880d0c[_0x79ba('0x2a')])[_0x79ba('0x15')](function(_0x3dbecc){if(hasTZ)_0x3b24b0=_0x3b24b0[_0x79ba('0x85')]('dialTimezone','dialTimezone,utcOffset');var _0x4a1c36=util[_0x79ba('0xb')](_0x79ba('0x9f'),_0x36d825,_0x114bbb,_0x3b24b0,_0x880d0c[_0x79ba('0x2a')],_0x880d0c['CompanyId']||null,NOW,NOW);if(_[_0x79ba('0x6c')](_0x2abdde[_0x79ba('0x28')])){_0x4a1c36+=_0x79ba('0xa0');}_0x12ecf1[_0x79ba('0x16')](_0x4a1c36);if(_0x880d0c['duplicates']&&_0x880d0c[_0x79ba('0x97')][_0x79ba('0x18')]){_0x12ecf1[_0x79ba('0x16')](insertCmContact(_0x880d0c[_0x79ba('0x2a')],_0x114bbb,_0x880d0c[_0x79ba('0x97')],_0x2abdde));_0x12ecf1[_0x79ba('0x16')](_0x79ba('0xa1')+_0x114bbb+';');}BPromise['each'](_0x12ecf1,handleQuery)['then'](function(_0x1e00c9){BPromise[_0x79ba('0x17')]([handleAdditionalPhones()])[_0x79ba('0x15')](function(){_0x12ecf1=[];for(var _0x48c55e=0x0;_0x48c55e_0x60179f[_0xe651('0x77')]===_0xbe7f1);let _0x4acc86=contactItemTypes['find'](_0x5791ae=>_0x5791ae[_0xe651('0x77')]+_0xe651('0x78')===_0xbe7f1);if(_[_0xe651('0x7e')](_0x3fd4ec)&&_[_0xe651('0x7e')](_0x4acc86)){if(_0x59e0a7[_0xe651('0x7f')](_0xbe7f1)){if(_0x373527[_0xe651('0x7c')][_0x4cb74c][_0x59e0a7[_0xbe7f1]]){var _0x118d5a=_[_0xe651('0x80')](_0x373527[_0xe651('0x7c')][_0x4cb74c][_0x59e0a7[_0xbe7f1]][_0xe651('0x81')](/"/g,'\x27'));switch(_0xbe7f1){case _0xe651('0x82'):var _0x234915=moment(_0x118d5a,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x234915[_0xe651('0x83')]()){_0x53a574[_0xe651('0x1b')]('\x22'+_0x118d5a+'\x22');}else{_0x1f04fc[_0xe651('0x1b')](_0xe651('0x84'));}break;case _0xe651('0x34'):var _0x5e068c=parseInt(_0x118d5a);_0x118d5a=_[_0xe651('0x85')](_0x5e068c)||_0x5e068c<0x0||_0x5e068c>0x4?_0x16a085?0x3:0x2:_0x5e068c;_0x53a574['push']('\x22'+_0x118d5a+'\x22');break;case _0xe651('0x35'):var _0x15a2a4=parseInt(_0x118d5a);if(_[_0xe651('0x86')](_0x15a2a4)&&_['includes'](_0x316959,_0x15a2a4)){_0x53a574[_0xe651('0x1b')]('\x22'+_0x15a2a4+'\x22');}else{_0x1f04fc['push'](_0xe651('0x87'));}break;case'email':if(isEmail(_0x118d5a)){_0x53a574[_0xe651('0x1b')]('\x22'+_0x118d5a+'\x22');}else{_0x1f04fc[_0xe651('0x1b')](_0xe651('0x88'));}break;case _0xe651('0x89'):var _0x35e8b9=moment(_0x118d5a,_0xe651('0x8a'),!![]);if(_0x35e8b9['isValid']()){_0x53a574[_0xe651('0x1b')]('\x22'+_0x118d5a+'\x22');}else{_0x1f04fc['push'](_0xe651('0x8b'));}break;case _0xe651('0x6a'):var _0x4b287d=shared[_0xe651('0x69')];var _0xd809ea=_0x4b287d[_0x118d5a];if(!_['isNil'](_0xd809ea)){var _0x118a0c=_0xd809ea['utcOffset'];_0x53a574[_0xe651('0x1b')]('\x22'+_0x118d5a+'\x22');_0x53a574[_0xe651('0x1b')]('\x22'+_0x118a0c+'\x22');}break;default:_0x53a574['push']('\x22'+_0x118d5a+'\x22');}}else{switch(_0xbe7f1){case _0xe651('0x8c'):case _0xe651('0x14'):_0x1f04fc[_0xe651('0x1b')](_0xbe7f1+_0xe651('0x8d'));break;default:_0x53a574[_0xe651('0x1b')]('\x22\x22');}}}}else{var _0x3ef1a3='';if(!_[_0xe651('0x7e')](_0x3fd4ec)){if(!_0xa312a5[_0xe651('0x7f')](_0x3fd4ec['id'])){if(!_['isNil'](_0x373527[_0xe651('0x7c')][_0x4cb74c][_0x59e0a7[_0xbe7f1]])){var _0x118d5a=_[_0xe651('0x80')](_0x373527[_0xe651('0x7c')][_0x4cb74c][_0x59e0a7[_0xbe7f1]][_0xe651('0x81')](/"/g,'\x27'));var _0x17dac7=phoneDescriptions[_0xe651('0x8e')](_0x2a2e25=>_0x2a2e25['itemTypeId']===_0x3fd4ec['id']);if(!_[_0xe651('0x7e')](_0x17dac7)){var _0x9cdde=_[_0xe651('0x80')](_0x373527[_0xe651('0x7c')][_0x4cb74c][_0x59e0a7[_0x17dac7['description']]]['replace'](/"/g,'\x27'));if(!_[_0xe651('0x7e')](_0x9cdde))_0x118d5a=_0x118d5a+'§'+_0x9cdde;}if(_0x3ef1a3=='')_0x3ef1a3=_0x118d5a;else _0x3ef1a3+='|'+_0x118d5a;}_0x44425c[_0xe651('0x1b')](_0x3fd4ec['id']+':'+_0x3ef1a3);_0xa312a5[_0x3fd4ec['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53a574[_0xe651('0x1b')]('\x22'+_0x44425c[_0xe651('0x15')](';')+'\x22');}if(_0x1f04fc['length']){handleError(_0x373527[_0xe651('0x7c')][_0x4cb74c],{'code':'SystemRow','message':_0x1f04fc[_0xe651('0x15')]()});}else{fs[_0xe651('0x8f')](_0xfc71c7,_0x53a574[_0xe651('0x15')]()+'\x0a');}_0x53a574=[];}if(!(stats[_0xe651('0x90')]%0xc8)){socket[_0xe651('0x91')](_0xe651('0x92')+_0x58ded6,stats);stats[_0xe651('0x7d')]=[];}}if(stopped){logger[_0xe651('0x59')](_0xe651('0x93'));_0x226919[_0xe651('0x94')]();}}catch(_0x169f20){handleError(_0x373527[_0xe651('0x7c')][_0x4cb74c],{'code':'SystemError','message':_0x169f20[_0xe651('0x5d')]});logger[_0xe651('0x5b')](_0xe651('0x95'),_0x169f20['message']);}},'complete':function(){try{var _0x16f9f5=[];var _0x54e1d7=[];var _0x3b2ac5=_0xe651('0x49');if(_0x3a0d34[_0xe651('0x96')]&&_0x3a0d34[_0xe651('0x96')][_0xe651('0x1a')]){_0x3b2ac5=_0xe651('0x97')+_0x58ded6;_0x16f9f5[_0xe651('0x1b')](_0xe651('0x98')+_0x3b2ac5+_0xe651('0x99'));}tmp_campaigns='campaigns_'+_0x58ded6;tmp_voice_queues='voice_queues_'+_0x58ded6;_0x54e1d7[_0xe651('0x1b')](_0xe651('0x98')+tmp_campaigns+_0xe651('0x9a'));_0x54e1d7[_0xe651('0x1b')](_0xe651('0x98')+tmp_voice_queues+_0xe651('0x9a'));BPromise['each'](_0x54e1d7,handleTZQuery)[_0xe651('0x1d')](function(_0x15f839){updateTzCampaigns(_0x3a0d34[_0xe651('0x32')])[_0xe651('0x1d')](function(_0x1409c6){updateTzVoiceQueues(_0x3a0d34[_0xe651('0x32')])[_0xe651('0x1d')](function(_0x37164c){if(hasTZ)_0x4cdfbb=_0x4cdfbb['replace'](_0xe651('0x6a'),_0xe651('0x9b'));var _0x23221c=util[_0xe651('0xf')]('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',_0xfc71c7,_0x3b2ac5,_0x4cdfbb,_0x3a0d34[_0xe651('0x32')],_0x3a0d34[_0xe651('0x9c')]||null,NOW,NOW);if(_['isNil'](_0x59e0a7[_0xe651('0x82')])){_0x23221c+=_0xe651('0x9d');}_0x16f9f5['push'](_0x23221c);if(_0x3a0d34[_0xe651('0x96')]&&_0x3a0d34[_0xe651('0x96')][_0xe651('0x1a')]){_0x16f9f5['push'](insertCmContact(_0x3a0d34['ListId'],_0x3b2ac5,_0x3a0d34[_0xe651('0x96')],_0x59e0a7));_0x16f9f5[_0xe651('0x1b')](_0xe651('0x9e')+_0x3b2ac5+';');}BPromise[_0xe651('0x9f')](_0x16f9f5,handleQuery)['then'](function(_0x217b37){BPromise[_0xe651('0x1c')]([handleAdditionalPhones()])[_0xe651('0x1d')](function(){_0x16f9f5=[];for(var _0x4cbf7b=0x0;_0x4cbf7b\x20\x20');}var _0x185079=path['join'](config[_0xe651('0xab')],_0xe651('0x73'),process['argv'][0x2]);if(!fs[_0xe651('0xac')](_0x185079)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1fdcc9={};try{_0x1fdcc9=JSON[_0xe651('0x7a')](process[_0xe651('0xaa')][0x3]);if(!_0x1fdcc9[_0xe651('0x70')]){throw new Error(_0xe651('0xad'));}if(!_0x1fdcc9[_0xe651('0x70')]['phone']){throw new Error(_0xe651('0xae'));}if(!_0x1fdcc9['binding'][_0xe651('0x8c')]){throw new Error(_0xe651('0xaf'));}var _0x11f229=0x0;if(_0x1fdcc9[_0xe651('0x70')][_0xe651('0x35')]){_0x11f229=0x1;}if(!_0x1fdcc9['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0xc0d67e){throw new Error(_0xe651('0xb0'));}var _0x74874e=[];try{_0x74874e=_[_0xe651('0xb1')](JSON[_0xe651('0x7a')](process[_0xe651('0xaa')][0x4]),'id');}catch(_0x2f4496){logger[_0xe651('0x59')](_0xe651('0xb2'));}main(_0x185079,_0x1fdcc9,_0x74874e,_0x11f229);}validate();process['on'](_0xe651('0xb3'),handleStop);process['on'](_0xe651('0xb4'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 2f39553..e6e8255 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc493=['PHONE','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_hopper_black','createdAt','select','from','\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','cm_hopper_additional_phones','CmHopperId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','group','info','error','exit','errors','code','catch','main','stringify','send','start','body','ContactItemType','findAll','name','_description','header','createReadStream','data','find','hasOwnProperty','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','dateOfBirth','YYYY-MM-DD','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','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','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','argv','root','existsSync','parse','binding\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','phone','isNil','AdditionalPhones','push','all','then','message','split','filter','CmContactHasItem'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc493,0x76));var _0x3c49=function(_0x3ffceb,_0x419f85){_0x3ffceb=_0x3ffceb-0x0;var _0x2ebaf0=_0xc493[_0x3ffceb];return _0x2ebaf0;};'use strict';var fs=require('fs');var path=require(_0x3c49('0x0'));var _=require(_0x3c49('0x1'));var Papa=require(_0x3c49('0x2'));var util=require(_0x3c49('0x3'));var BPromise=require(_0x3c49('0x4'));var moment=require(_0x3c49('0x5'));var squel=require('squel');var Redis=require(_0x3c49('0x6'));var db=require(_0x3c49('0x7'))['db'];var config=require(_0x3c49('0x8'));var logger=require(_0x3c49('0x9'))(_0x3c49('0xa'));config[_0x3c49('0xb')]=_[_0x3c49('0xc')](config[_0x3c49('0xb')],{'host':_0x3c49('0xd'),'port':0x18eb});var socket=require(_0x3c49('0xe'))(new Redis(config[_0x3c49('0xb')]));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()[_0x3c49('0xf')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x3c49('0x10')+moment()[_0x3c49('0xf')](_0x3c49('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x386eb5){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))*$/[_0x3c49('0x12')](_0x386eb5);}function selectNotIn(_0x3a73b8,_0x1d6440,_0x2a0b44,_0x1c2547,_0x334376){return squel['select']()[_0x3c49('0x13')]('phone')['from'](_0x1c2547)['join'](_0x1d6440,null,_0x1d6440+_0x3c49('0x14')+_0x1c2547+'.'+_0x2a0b44)['where'](_0x1c2547+'.'+_0x2a0b44+_0x3c49('0x15')+_0x3a73b8+'.'+_0x2a0b44)['where'](_0x1d6440+_0x3c49('0x16')+_0x334376['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x525885,_0x26470b){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3c49('0x17')]['query'](_0x3c49('0x18')+tempTableName)[_0x3c49('0x19')](function(_0xf9df55){if(_0xf9df55!==null){var _0x19b8e5=[];for(var _0x128fbc=0x0;_0x128fbc<_0xf9df55[_0x3c49('0x1a')];_0x128fbc++){var _0x45070e=_0xf9df55[_0x128fbc];if(!_['isNil'](_0x45070e[_0x3c49('0x1b')])){if(!_[_0x3c49('0x1c')](_0x45070e[_0x3c49('0x1d')]))_0x19b8e5[_0x3c49('0x1e')](insertAdditionalPhones(_0x45070e));promisesContact[_0x3c49('0x1e')]({'contact':_0x45070e});}}}Promise[_0x3c49('0x1f')](_0x19b8e5)[_0x3c49('0x20')](function(){_0x525885({'val':0x1});});})['catch'](function(_0x2b4e66){logger['error'](_0x2b4e66[_0x3c49('0x21')]);});});}function insertAdditionalPhones(_0x529d72){return new Promise(function(_0x23100b,_0x216d9f){var _0x20cac5=_0x529d72[_0x3c49('0x1d')];if(_[_0x3c49('0x1c')](_0x20cac5))_0x216d9f({'val':0x0});else{var _0x4d4194=_0x20cac5[_0x3c49('0x22')](';');var _0x463597=[];orderBy=0x0;for(var _0x5bb0e1=0x0;_0x5bb0e1<_0x4d4194[_0x3c49('0x1a')];_0x5bb0e1++){_0x463597[_0x3c49('0x1e')](splitAdditionalPhone(_0x529d72['id'],_0x4d4194[_0x5bb0e1]));}Promise['all'](_0x463597)[_0x3c49('0x20')](function(){_0x23100b({'val':_0x4d4194['length']});});}});}function splitAdditionalPhone(_0x50edd2,_0x5762b4){return new Promise(function(_0x44c54d,_0x59aca8){var _0x1f0b13=_0x5762b4[_0x3c49('0x22')](':');var _0x3308ad=_0x1f0b13[0x0];var _0x4d462f=_0x1f0b13[0x1];if(_0x4d462f!==''){var _0x2791f4=_0x4d462f['split']('|');var _0x3f7071=[];for(var _0x2ff431=0x0;_0x2ff431<_0x2791f4['length'];_0x2ff431++){if(_0x2791f4[_0x2ff431]!==''){var _0xd84e75=_[_0x3c49('0x23')](promisesAdditionalPhones,{'contactId':_0x50edd2,'phone':_0x2791f4[_0x2ff431]});if(_0xd84e75['length']==0x0){orderBy++;promisesAdditionalPhones[_0x3c49('0x1e')]({'contactId':_0x50edd2,'contactTypeId':_0x3308ad,'phone':_0x2791f4[_0x2ff431],'orderBy':orderBy});}}}_0x44c54d({'ok':0x1});}else _0x44c54d({'res':0x0});});}function createAdditionalPhone(_0x1ba38b,_0x58c46c,_0x3c1f1f,_0x294376){var _0x8b2ff5='';var _0x2d5c01='';var _0x5231a2=_0x3c1f1f[_0x3c49('0x22')]('§');_0x8b2ff5=_0x5231a2[0x0];if(_0x5231a2[_0x3c49('0x1a')]==0x2)_0x2d5c01=_0x5231a2[0x1];return new Promise(function(_0x294996,_0x404f6f){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1ba38b,'item':_0x8b2ff5}})['then'](function(_0x2b70b9){if(_0x2b70b9){return db[_0x3c49('0x24')]['update']({'ItemTypeId':_0x58c46c,'description':_0x2d5c01,'OrderBy':_0x294376},{'where':{'CmContactId':_0x1ba38b,'item':_0x8b2ff5}})[_0x3c49('0x20')](function(_0x3689a7){_0x294996({'res':'updated'});});}else{return db[_0x3c49('0x24')]['create']({'CmContactId':_0x1ba38b,'item':_0x8b2ff5,'ItemTypeId':_0x58c46c,'description':_0x2d5c01,'OrderBy':_0x294376,'ItemClass':_0x3c49('0x25')})[_0x3c49('0x20')](function(_0x24f94f){_0x294996({'res':_0x3c49('0x26')});});}});});}function updateContact(_0x5d3201){return new Promise(function(_0x1263bd,_0x47e1b0){var _0x5f231e=_0x5d3201['id'];delete _0x5d3201['id'];return db['CmContact'][_0x3c49('0x27')](_0x5d3201,{'where':{'id':_0x5f231e}})['then'](function(_0x4e1933){updatedRows+=0x1;return db[_0x3c49('0x28')][_0x3c49('0x27')]({'phone':_0x5d3201[_0x3c49('0x1b')]},{'where':{'ContactId':_0x5f231e}})['then'](function(_0x1f1647){_0x1263bd({'ret':'OK'});});});});}function insertCmHopper(_0x3d038d,_0x548485,_0x400e7b,_0x35fc,_0x278f68){var _0x1ab585=[_0x3c49('0x29'),_0x3c49('0x2a'),_0x3c49('0x2b'),_0x3c49('0x2c'),_0x548485+'.'+_0x35fc,_0x3c49('0x2d'),_0x3c49('0x2e'),_0x3c49('0x2f'),_0x3c49('0x30'),'\x22'+_0x278f68+'\x22'];return squel[_0x3c49('0x31')]()[_0x3c49('0x32')](_0x3c49('0x33'))[_0x3c49('0x34')]([_0x3c49('0x1b'),'scheduledat',_0x3c49('0x35'),_0x3c49('0x36'),_0x35fc,'createdAt',_0x3c49('0x37'),_0x3c49('0x38'),_0x3c49('0x39'),_0x3c49('0x3a')],squel['select']()[_0x3c49('0x3b')](_0x1ab585)['from'](_0x548485)[_0x3c49('0x3c')](_0x3c49('0x3d'),null,_0x3c49('0x3e')+_0x548485+_0x3c49('0x3f'))[_0x3c49('0x3c')](_0x400e7b,null,_0x400e7b+'.id\x20=\x20'+_0x548485+'.'+_0x35fc)[_0x3c49('0x40')](_0x548485+_0x3c49('0x41'),_0x3d038d)[_0x3c49('0x40')](_0x3c49('0x42'),NOW)[_0x3c49('0x40')](_0x3c49('0x43'),selectNotIn(_0x548485,_0x400e7b,_0x35fc,_0x3c49('0x33'),['\x22always\x22',_0x3c49('0x44')]))[_0x3c49('0x40')](_0x3c49('0x43'),selectNotIn(_0x548485,_0x400e7b,_0x35fc,_0x3c49('0x33'),['\x22always\x22'])))[_0x3c49('0x45')]();}function insertCmHopperBlack(_0x220741,_0xaa2558,_0x326123,_0x48e431){var _0x2556a1=['cm_contacts.phone',_0x3c49('0x2b'),_0x3c49('0x2c'),_0xaa2558+'.'+_0x48e431,_0x3c49('0x2d'),_0x3c49('0x2e')];return squel[_0x3c49('0x31')]()['into'](_0x3c49('0x46'))[_0x3c49('0x34')]([_0x3c49('0x1b'),_0x3c49('0x35'),'ListId',_0x48e431,_0x3c49('0x47'),_0x3c49('0x37')],squel[_0x3c49('0x48')]()[_0x3c49('0x3b')](_0x2556a1)[_0x3c49('0x49')](_0xaa2558)[_0x3c49('0x3c')]('cm_contacts',null,_0x3c49('0x3e')+_0xaa2558+_0x3c49('0x3f'))[_0x3c49('0x3c')](_0x326123,null,_0x326123+_0x3c49('0x14')+_0xaa2558+'.'+_0x48e431)[_0x3c49('0x40')](_0xaa2558+'.CmListId\x20=\x20?',_0x220741)[_0x3c49('0x40')](_0x3c49('0x42'),NOW)[_0x3c49('0x40')](_0x3c49('0x43'),squel[_0x3c49('0x48')]()[_0x3c49('0x13')]('phone')[_0x3c49('0x49')]('cm_hopper_black')[_0x3c49('0x40')]('ListId\x20=\x20?',_0x220741)[_0x3c49('0x40')](_0x48e431+_0x3c49('0x4a'),_0xaa2558+'.'+_0x48e431)))[_0x3c49('0x45')]();}function insertCmHopperAdditionalPhones(_0xa2b7bc){var _0x349573=[_0x3c49('0x4b'),_0x3c49('0x4c'),_0x3c49('0x4d'),_0x3c49('0x4e'),_0x3c49('0x4f')];return squel['insert']()['into'](_0x3c49('0x50'))[_0x3c49('0x34')]([_0x3c49('0x51'),_0x3c49('0x1b'),'OrderBy','createdAt',_0x3c49('0x37')],squel[_0x3c49('0x48')]()[_0x3c49('0x3b')](_0x349573)[_0x3c49('0x49')](_0x3c49('0x33'))[_0x3c49('0x3c')](_0x3c49('0x3d'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x3c49('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x3c49('0x53'),_0xa2b7bc)[_0x3c49('0x40')](_0x3c49('0x42'),NOW))[_0x3c49('0x45')]();}function insertCmContact(_0x500a5f,_0x4097a1,_0x53781a,_0x633d72){var _0x8fabeb=_[_0x3c49('0x54')](_['keys'](_0x633d72),[_0x3c49('0x36'),_0x3c49('0x55'),_0x3c49('0x47'),_0x3c49('0x37')]);return squel[_0x3c49('0x31')]()[_0x3c49('0x32')](_0x3c49('0x3d'))[_0x3c49('0x34')](_0x8fabeb,squel[_0x3c49('0x48')]()[_0x3c49('0x3b')](_0x8fabeb)[_0x3c49('0x49')](_0x4097a1)[_0x3c49('0x40')]('('+_0x53781a['join'](',')+_0x3c49('0x56'),squel[_0x3c49('0x48')]()[_0x3c49('0x3b')](_0x53781a)['from'](_0x3c49('0x3d'))[_0x3c49('0x40')](_0x3c49('0x57'),_0x500a5f))[_0x3c49('0x40')](_0x3c49('0x58'),squel[_0x3c49('0x48')]()[_0x3c49('0x13')](_0x3c49('0x59'),'min_id')['from'](_0x4097a1)[_0x3c49('0x5a')](_0x53781a[_0x3c49('0x3c')](','))))[_0x3c49('0x45')]();}function handleStop(){logger[_0x3c49('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x28aabe){logger[_0x3c49('0x5c')](_0x28aabe[_0x3c49('0x21')]);process[_0x3c49('0x5d')](0x1);}function handleError(_0x31207e,_0x24e7e7){stats[_0x3c49('0x5e')][_0x3c49('0x1e')]({'name':_0x24e7e7[_0x3c49('0x5f')],'message':_0x24e7e7[_0x3c49('0x21')],'row':_0x31207e});}function handleQuery(_0x1b20a7){logger['info'](_0x1b20a7);return db['sequelize']['query'](_0x1b20a7)[_0x3c49('0x19')](function(_0x1faeaa){results[_0x3c49('0x1e')](_0x1faeaa);})[_0x3c49('0x60')](function(_0x272b8b){logger[_0x3c49('0x5c')](_0x272b8b[_0x3c49('0x21')]);});}function main(_0x105c91,_0x281a01,_0x56cafd,_0x50658e){logger[_0x3c49('0x5b')](_0x3c49('0x61'),_0x105c91,JSON[_0x3c49('0x62')](_0x281a01));process[_0x3c49('0x63')](_0x3c49('0x64'));var _0x4864ee=_0x281a01['binding'];var _0x5157ac=_['clone'](_0x4864ee);var _0x2b472b=_0x281a01['socket_timestamp'];var _0x4ce107=path['join'](config['root'],'server/files/tmp',_0x2b472b+'.csv');logger[_0x3c49('0x5b')](_0x3c49('0x65'),_0x281a01);db[_0x3c49('0x66')][_0x3c49('0x67')]({'raw':!![],'attributes':['id',_0x3c49('0x68')]})[_0x3c49('0x20')](function(_0x24df5a){for(var _0x272f52=0x0;_0x272f52<_0x24df5a[_0x3c49('0x1a')];_0x272f52++){if(_0x24df5a[_0x272f52]['name']in _0x4864ee){contactItemTypes[_0x3c49('0x1e')](_0x24df5a[_0x272f52]);delete _0x5157ac[_0x24df5a[_0x272f52][_0x3c49('0x68')]];hasAdditionalPhones=!![];}for(var _0x18b959 in _0x4864ee){if(_0x24df5a[_0x272f52][_0x3c49('0x68')]+_0x3c49('0x69')===_0x18b959){phoneDescriptions['push']({'itemTypeId':_0x24df5a[_0x272f52]['id'],'description':_0x18b959});delete _0x5157ac[_0x18b959];}}}if(hasAdditionalPhones)_0x5157ac[_0x3c49('0x1d')]='';var _0x55e341=_['keys'](_0x5157ac)[_0x3c49('0x3c')]();logger[_0x3c49('0x5b')](_0x3c49('0x6a'),_0x55e341);fs['writeFileSync'](_0x4ce107,_0x55e341+'\x0a');Papa['parse'](fs[_0x3c49('0x6b')](_0x105c91),{'header':!![],'skipEmptyLines':!![],'step':function(_0x53fe71,_0x49e4fa){try{for(var _0x38e9b7=0x0,_0x6d1f29=[];_0x38e9b7<_0x53fe71['data'][_0x3c49('0x1a')];_0x38e9b7++){stats['rows']+=0x1;if(_0x53fe71['errors'][_0x38e9b7]){handleError(_0x53fe71[_0x3c49('0x6c')][_0x38e9b7],_0x53fe71[_0x3c49('0x5e')][_0x38e9b7]);}else{var _0x7dcde6=[];var _0x212c3a=[];var _0x1f5094={};for(var _0x4dceb7 in _0x4864ee){let _0xa2511d=contactItemTypes[_0x3c49('0x6d')](_0x3c2088=>_0x3c2088[_0x3c49('0x68')]===_0x4dceb7);let _0x1ada5c=contactItemTypes['find'](_0x19d5ac=>_0x19d5ac[_0x3c49('0x68')]+_0x3c49('0x69')===_0x4dceb7);if(_['isNil'](_0xa2511d)&&_[_0x3c49('0x1c')](_0x1ada5c)){if(_0x4864ee[_0x3c49('0x6e')](_0x4dceb7)){if(_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0x4dceb7]]){var _0x525f72=_['trim'](_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0x4dceb7]][_0x3c49('0x6f')](/"/g,'\x27'));switch(_0x4dceb7){case _0x3c49('0x70'):var _0x8c2f86=moment(_0x525f72,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x8c2f86[_0x3c49('0x71')]()){_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')](_0x3c49('0x72'));}break;case _0x3c49('0x38'):var _0x7552cc=parseInt(_0x525f72);_0x525f72=_[_0x3c49('0x73')](_0x7552cc)||_0x7552cc<0x0||_0x7552cc>0x4?_0x50658e?0x3:0x2:_0x7552cc;_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');break;case _0x3c49('0x39'):var _0x1f9d8f=parseInt(_0x525f72);if(_[_0x3c49('0x74')](_0x1f9d8f)&&_['includes'](_0x56cafd,_0x1f9d8f)){_0x6d1f29['push']('\x22'+_0x1f9d8f+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')]('agent\x20not\x20exists');}break;case _0x3c49('0x75'):if(isEmail(_0x525f72)){_0x6d1f29['push']('\x22'+_0x525f72+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')]('email\x20wrong\x20format');}break;case _0x3c49('0x76'):var _0x2187f7=moment(_0x525f72,_0x3c49('0x77'),!![]);if(_0x2187f7[_0x3c49('0x71')]()){_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');}}else{switch(_0x4dceb7){case'firstName':case _0x3c49('0x1b'):_0x7dcde6[_0x3c49('0x1e')](_0x4dceb7+_0x3c49('0x78'));break;default:_0x6d1f29[_0x3c49('0x1e')]('\x22\x22');}}}}else{var _0x34a1b7='';if(!_[_0x3c49('0x1c')](_0xa2511d)){if(!_0x1f5094[_0x3c49('0x6e')](_0xa2511d['id'])){for(var _0x43b4f9=0x0;_0x43b4f9<_0x4864ee[_0x4dceb7][_0x3c49('0x1a')];_0x43b4f9++){var _0x525f72=_[_0x3c49('0x79')](_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0x4dceb7][_0x43b4f9]]['replace'](/"/g,'\x27'));var _0xe67823=phoneDescriptions[_0x3c49('0x6d')](_0x3d3460=>_0x3d3460[_0x3c49('0x7a')]===_0xa2511d['id']);if(!_[_0x3c49('0x1c')](_0xe67823)){var _0x4cd842=_['trim'](_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0xe67823[_0x3c49('0x7b')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x3c49('0x1c')](_0x4cd842))_0x525f72=_0x525f72+'§'+_0x4cd842;}if(_0x34a1b7=='')_0x34a1b7=_0x525f72;else _0x34a1b7+='|'+_0x525f72;}_0x212c3a[_0x3c49('0x1e')](_0xa2511d['id']+':'+_0x34a1b7);_0x1f5094[_0xa2511d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x6d1f29['push']('\x22'+_0x212c3a[_0x3c49('0x3c')](';')+'\x22');}if(_0x7dcde6['length']){handleError(_0x53fe71[_0x3c49('0x6c')][_0x38e9b7],{'code':_0x3c49('0x7c'),'message':_0x7dcde6[_0x3c49('0x3c')]()});}else{fs[_0x3c49('0x7d')](_0x4ce107,_0x6d1f29[_0x3c49('0x3c')]()+'\x0a');}_0x6d1f29=[];}if(!(stats[_0x3c49('0x7e')]%0xc8)){socket[_0x3c49('0x7f')](_0x3c49('0x80')+_0x2b472b,stats);stats[_0x3c49('0x5e')]=[];}}if(stopped){logger[_0x3c49('0x5b')](_0x3c49('0x81'));_0x49e4fa[_0x3c49('0x82')]();}}catch(_0x2acff4){handleError(_0x53fe71[_0x3c49('0x6c')][_0x38e9b7],{'code':_0x3c49('0x83'),'message':_0x2acff4[_0x3c49('0x21')]});logger['error'](_0x3c49('0x84'),_0x2acff4[_0x3c49('0x21')]);}},'complete':function(){try{var _0x217afb=[];var _0x2ac535=tempTableName;_0x217afb[_0x3c49('0x1e')](_0x3c49('0x85')+_0x2ac535+_0x3c49('0x86'));logger[_0x3c49('0x5b')](_0x3c49('0x87'),contactItemTypes[_0x3c49('0x1a')]);var _0x5b5803=util[_0x3c49('0xf')](_0x3c49('0x88'),_0x4ce107,_0x2ac535,_0x55e341,_0x281a01['ListId'],_0x281a01['CompanyId']||null,NOW,NOW);if(_[_0x3c49('0x1c')](_0x4864ee[_0x3c49('0x70')])){_0x5b5803+=',\x20scheduledAt\x20=\x20NOW()';}_0x217afb[_0x3c49('0x1e')](_0x5b5803);BPromise[_0x3c49('0x89')](_0x217afb,handleQuery)['then'](function(_0x4c0152){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x217afb=[];for(var _0x4a9837=0x0;_0x4a9837\x20\x20');}var _0x5e69d0=path[_0x3c49('0x3c')](config[_0x3c49('0x92')],'server/files/tmp',process[_0x3c49('0x91')][0x2]);if(!fs[_0x3c49('0x93')](_0x5e69d0)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x214ee7={};try{_0x214ee7=JSON[_0x3c49('0x94')](process[_0x3c49('0x91')][0x3]);if(!_0x214ee7['binding']){throw new Error(_0x3c49('0x95'));}var _0x4a422e=0x0;if(_0x214ee7[_0x3c49('0x96')][_0x3c49('0x39')]){_0x4a422e=0x1;}if(!_0x214ee7[_0x3c49('0x36')]){throw new Error(_0x3c49('0x97'));}}catch(_0x165569){throw new Error(_0x3c49('0x98'));}var _0x4e331d=[];try{_0x4e331d=_[_0x3c49('0x99')](JSON[_0x3c49('0x94')](process['argv'][0x4]),'id');}catch(_0xb4c692){logger['info']('No\x20agent\x20available');}main(_0x5e69d0,_0x214ee7,_0x4e331d,_0x4a422e);}validate();process['on']('SIGINT',handleStop);process['on'](_0x3c49('0x9a'),handleUncaughtException); \ No newline at end of file +var _0x0abf=['cm_hopper.ListId\x20=\x20?','concat','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','code','info','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','keys','header','createReadStream','data','rows','find','_description','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','SystemRow','appendFileSync','emit','SystemError','CREATE\x20TABLE\x20','CIS\x20len','CompanyId','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','papaparse','util','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','CmContactHasItem','findOne','updated','inserted','update','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_hopper_black','fields','ListId\x20=\x20?','\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','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items'];(function(_0x11928e,_0x21e98f){var _0x94cfd8=function(_0x18ba83){while(--_0x18ba83){_0x11928e['push'](_0x11928e['shift']());}};_0x94cfd8(++_0x21e98f);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'use strict';var fs=require('fs');var path=require(_0xf0ab('0x0'));var _=require('lodash');var Papa=require(_0xf0ab('0x1'));var util=require(_0xf0ab('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xf0ab('0x3'));var Redis=require('ioredis');var db=require(_0xf0ab('0x4'))['db'];var config=require(_0xf0ab('0x5'));var logger=require(_0xf0ab('0x6'))(_0xf0ab('0x7'));config[_0xf0ab('0x8')]=_[_0xf0ab('0x9')](config[_0xf0ab('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0ab('0xa'))(new Redis(config[_0xf0ab('0x8')]));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()[_0xf0ab('0xb')](_0xf0ab('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0xf0ab('0xb')](_0xf0ab('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1e7887){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'](_0x1e7887);}function selectNotIn(_0x5d25a0,_0x30042c,_0x53a03f,_0x19e9e7,_0x10a5a2){return squel[_0xf0ab('0xe')]()[_0xf0ab('0xf')](_0xf0ab('0x10'))[_0xf0ab('0x11')](_0x19e9e7)[_0xf0ab('0x12')](_0x30042c,null,_0x30042c+'.id\x20=\x20'+_0x19e9e7+'.'+_0x53a03f)[_0xf0ab('0x13')](_0x19e9e7+'.'+_0x53a03f+_0xf0ab('0x14')+_0x5d25a0+'.'+_0x53a03f)[_0xf0ab('0x13')](_0x30042c+_0xf0ab('0x15')+_0x10a5a2[_0xf0ab('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x36cabe,_0x3d7129){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0xf0ab('0x18')+tempTableName)[_0xf0ab('0x19')](function(_0x221bac){if(_0x221bac!==null){var _0x200cf5=[];for(var _0x2f4618=0x0;_0x2f4618<_0x221bac[_0xf0ab('0x1a')];_0x2f4618++){var _0x54b0ce=_0x221bac[_0x2f4618];if(!_[_0xf0ab('0x1b')](_0x54b0ce[_0xf0ab('0x10')])){if(!_[_0xf0ab('0x1b')](_0x54b0ce[_0xf0ab('0x1c')]))_0x200cf5[_0xf0ab('0x1d')](insertAdditionalPhones(_0x54b0ce));promisesContact[_0xf0ab('0x1d')]({'contact':_0x54b0ce});}}}Promise[_0xf0ab('0x1e')](_0x200cf5)[_0xf0ab('0x1f')](function(){_0x36cabe({'val':0x1});});})[_0xf0ab('0x20')](function(_0x1874a5){logger[_0xf0ab('0x21')](_0x1874a5[_0xf0ab('0x22')]);});});}function insertAdditionalPhones(_0xf43bc4){return new Promise(function(_0x22a205,_0x2cd961){var _0x45c1c9=_0xf43bc4['AdditionalPhones'];if(_[_0xf0ab('0x1b')](_0x45c1c9))_0x2cd961({'val':0x0});else{var _0x6fa888=_0x45c1c9[_0xf0ab('0x23')](';');var _0x11ab3a=[];orderBy=0x0;for(var _0x3bf6a1=0x0;_0x3bf6a1<_0x6fa888[_0xf0ab('0x1a')];_0x3bf6a1++){_0x11ab3a[_0xf0ab('0x1d')](splitAdditionalPhone(_0xf43bc4['id'],_0x6fa888[_0x3bf6a1]));}Promise[_0xf0ab('0x1e')](_0x11ab3a)[_0xf0ab('0x1f')](function(){_0x22a205({'val':_0x6fa888[_0xf0ab('0x1a')]});});}});}function splitAdditionalPhone(_0x43119f,_0x5645b2){return new Promise(function(_0x585841,_0x4eee21){var _0x33aaa0=_0x5645b2['split'](':');var _0x3eca32=_0x33aaa0[0x0];var _0x16b979=_0x33aaa0[0x1];if(_0x16b979!==''){var _0x51ac90=_0x16b979[_0xf0ab('0x23')]('|');var _0x22671e=[];for(var _0x10bf5f=0x0;_0x10bf5f<_0x51ac90[_0xf0ab('0x1a')];_0x10bf5f++){if(_0x51ac90[_0x10bf5f]!==''){var _0x7d4ff9=_['filter'](promisesAdditionalPhones,{'contactId':_0x43119f,'phone':_0x51ac90[_0x10bf5f]});if(_0x7d4ff9[_0xf0ab('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x43119f,'contactTypeId':_0x3eca32,'phone':_0x51ac90[_0x10bf5f],'orderBy':orderBy});}}}_0x585841({'ok':0x1});}else _0x585841({'res':0x0});});}function createAdditionalPhone(_0x55d799,_0x1dcd2e,_0x4306c6,_0x1b223d){var _0x445160='';var _0x43476c='';var _0x174052=_0x4306c6[_0xf0ab('0x23')]('§');_0x445160=_0x174052[0x0];if(_0x174052[_0xf0ab('0x1a')]==0x2)_0x43476c=_0x174052[0x1];return new Promise(function(_0x76a3f3,_0x2f0fcd){return db[_0xf0ab('0x24')][_0xf0ab('0x25')]({'where':{'CmContactId':_0x55d799,'item':_0x445160}})['then'](function(_0x1e1ffb){if(_0x1e1ffb){return db[_0xf0ab('0x24')]['update']({'ItemTypeId':_0x1dcd2e,'description':_0x43476c,'OrderBy':_0x1b223d},{'where':{'CmContactId':_0x55d799,'item':_0x445160}})['then'](function(_0x1eff91){_0x76a3f3({'res':_0xf0ab('0x26')});});}else{return db[_0xf0ab('0x24')]['create']({'CmContactId':_0x55d799,'item':_0x445160,'ItemTypeId':_0x1dcd2e,'description':_0x43476c,'OrderBy':_0x1b223d,'ItemClass':'PHONE'})[_0xf0ab('0x1f')](function(_0x58fa03){_0x76a3f3({'res':_0xf0ab('0x27')});});}});});}function updateContact(_0x51c459){return new Promise(function(_0x3f66fa,_0x9b16fa){var _0x5074c9=_0x51c459['id'];delete _0x51c459['id'];return db['CmContact'][_0xf0ab('0x28')](_0x51c459,{'where':{'id':_0x5074c9}})[_0xf0ab('0x1f')](function(_0x2a3fac){updatedRows+=0x1;return db[_0xf0ab('0x29')][_0xf0ab('0x28')]({'phone':_0x51c459[_0xf0ab('0x10')]},{'where':{'ContactId':_0x5074c9}})[_0xf0ab('0x1f')](function(_0xf8f0f4){_0x3f66fa({'ret':'OK'});});});});}function insertCmHopper(_0x2a2f5d,_0xef5cea,_0x2c88d0,_0x2ad3e2,_0x22dcfe){var _0x437fdb=['cm_contacts.phone',_0xf0ab('0x2a'),_0xf0ab('0x2b'),_0xf0ab('0x2c'),_0xef5cea+'.'+_0x2ad3e2,'cm_contacts.createdAt',_0xf0ab('0x2d'),_0xf0ab('0x2e'),_0xf0ab('0x2f'),'\x22'+_0x22dcfe+'\x22'];return squel['insert']()[_0xf0ab('0x30')]('cm_hopper')[_0xf0ab('0x31')](['phone',_0xf0ab('0x32'),_0xf0ab('0x33'),_0xf0ab('0x34'),_0x2ad3e2,_0xf0ab('0x35'),_0xf0ab('0x36'),_0xf0ab('0x37'),'UserId',_0xf0ab('0x38')],squel[_0xf0ab('0xe')]()['fields'](_0x437fdb)[_0xf0ab('0x11')](_0xef5cea)[_0xf0ab('0x12')](_0xf0ab('0x39'),null,_0xf0ab('0x3a')+_0xef5cea+_0xf0ab('0x3b'))[_0xf0ab('0x12')](_0x2c88d0,null,_0x2c88d0+_0xf0ab('0x3c')+_0xef5cea+'.'+_0x2ad3e2)['where'](_0xef5cea+_0xf0ab('0x3d'),_0x2a2f5d)[_0xf0ab('0x13')](_0xf0ab('0x3e'),NOW)['where'](_0xf0ab('0x3f'),selectNotIn(_0xef5cea,_0x2c88d0,_0x2ad3e2,_0xf0ab('0x40'),[_0xf0ab('0x41'),_0xf0ab('0x42')]))[_0xf0ab('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xef5cea,_0x2c88d0,_0x2ad3e2,_0xf0ab('0x40'),[_0xf0ab('0x41')])))[_0xf0ab('0x43')]();}function insertCmHopperBlack(_0x197955,_0x191caf,_0x17a73,_0x45849c){var _0x413f5c=[_0xf0ab('0x44'),_0xf0ab('0x2b'),_0xf0ab('0x2c'),_0x191caf+'.'+_0x45849c,_0xf0ab('0x45'),_0xf0ab('0x2d')];return squel['insert']()['into'](_0xf0ab('0x46'))['fromQuery']([_0xf0ab('0x10'),_0xf0ab('0x33'),'ListId',_0x45849c,_0xf0ab('0x35'),_0xf0ab('0x36')],squel['select']()[_0xf0ab('0x47')](_0x413f5c)[_0xf0ab('0x11')](_0x191caf)[_0xf0ab('0x12')](_0xf0ab('0x39'),null,_0xf0ab('0x3a')+_0x191caf+_0xf0ab('0x3b'))[_0xf0ab('0x12')](_0x17a73,null,_0x17a73+_0xf0ab('0x3c')+_0x191caf+'.'+_0x45849c)[_0xf0ab('0x13')](_0x191caf+_0xf0ab('0x3d'),_0x197955)[_0xf0ab('0x13')](_0xf0ab('0x3e'),NOW)[_0xf0ab('0x13')](_0xf0ab('0x3f'),squel['select']()['field'](_0xf0ab('0x10'))['from']('cm_hopper_black')['where'](_0xf0ab('0x48'),_0x197955)[_0xf0ab('0x13')](_0x45849c+_0xf0ab('0x49'),_0x191caf+'.'+_0x45849c)))[_0xf0ab('0x43')]();}function insertCmHopperAdditionalPhones(_0x1a2ee9){var _0x132ada=[_0xf0ab('0x4a'),_0xf0ab('0x4b'),_0xf0ab('0x4c'),_0xf0ab('0x4d'),_0xf0ab('0x4e')];return squel[_0xf0ab('0x4f')]()['into'](_0xf0ab('0x50'))[_0xf0ab('0x31')]([_0xf0ab('0x51'),_0xf0ab('0x10'),_0xf0ab('0x52'),_0xf0ab('0x35'),_0xf0ab('0x36')],squel[_0xf0ab('0xe')]()['fields'](_0x132ada)['from']('cm_hopper')[_0xf0ab('0x12')](_0xf0ab('0x39'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xf0ab('0x12')](_0xf0ab('0x53'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf0ab('0x13')](_0xf0ab('0x54'),_0x1a2ee9)[_0xf0ab('0x13')](_0xf0ab('0x3e'),NOW))[_0xf0ab('0x43')]();}function insertCmContact(_0x33112b,_0x26508b,_0x4d1606,_0x3be796){var _0x59e7dd=_[_0xf0ab('0x55')](_['keys'](_0x3be796),[_0xf0ab('0x34'),'CompanyId','createdAt',_0xf0ab('0x36')]);return squel['insert']()[_0xf0ab('0x30')]('cm_contacts')[_0xf0ab('0x31')](_0x59e7dd,squel['select']()[_0xf0ab('0x47')](_0x59e7dd)[_0xf0ab('0x11')](_0x26508b)[_0xf0ab('0x13')]('('+_0x4d1606['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xf0ab('0x47')](_0x4d1606)[_0xf0ab('0x11')]('cm_contacts')['where'](_0xf0ab('0x48'),_0x33112b))[_0xf0ab('0x13')](_0xf0ab('0x56'),squel[_0xf0ab('0xe')]()[_0xf0ab('0xf')](_0xf0ab('0x57'),_0xf0ab('0x58'))[_0xf0ab('0x11')](_0x26508b)[_0xf0ab('0x59')](_0x4d1606[_0xf0ab('0x12')](','))))[_0xf0ab('0x43')]();}function handleStop(){logger['info'](_0xf0ab('0x5a'));stopped=!![];}function handleUncaughtException(_0x5b24e3){logger[_0xf0ab('0x21')](_0x5b24e3[_0xf0ab('0x22')]);process[_0xf0ab('0x5b')](0x1);}function handleError(_0xa946f1,_0x3e1b85){stats[_0xf0ab('0x5c')][_0xf0ab('0x1d')]({'name':_0x3e1b85[_0xf0ab('0x5d')],'message':_0x3e1b85[_0xf0ab('0x22')],'row':_0xa946f1});}function handleQuery(_0x180ee6){logger['info'](_0x180ee6);return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x180ee6)[_0xf0ab('0x19')](function(_0x1d4a72){results[_0xf0ab('0x1d')](_0x1d4a72);})[_0xf0ab('0x20')](function(_0x2a906e){logger[_0xf0ab('0x21')](_0x2a906e[_0xf0ab('0x22')]);});}function main(_0x570379,_0x59455b,_0x7e0318,_0x5c286d){logger[_0xf0ab('0x5e')]('main',_0x570379,JSON[_0xf0ab('0x5f')](_0x59455b));process[_0xf0ab('0x60')](_0xf0ab('0x61'));var _0x5daeda=_0x59455b[_0xf0ab('0x62')];var _0x16522b=_[_0xf0ab('0x63')](_0x5daeda);var _0x3d333f=_0x59455b[_0xf0ab('0x64')];var _0x53ed27=path[_0xf0ab('0x12')](config[_0xf0ab('0x65')],_0xf0ab('0x66'),_0x3d333f+_0xf0ab('0x67'));logger[_0xf0ab('0x5e')](_0xf0ab('0x68'),_0x59455b);db[_0xf0ab('0x69')][_0xf0ab('0x6a')]({'raw':!![],'attributes':['id',_0xf0ab('0x6b')]})[_0xf0ab('0x1f')](function(_0x273136){for(var _0x3bdb3a=0x0;_0x3bdb3a<_0x273136[_0xf0ab('0x1a')];_0x3bdb3a++){if(_0x273136[_0x3bdb3a]['name']in _0x5daeda){contactItemTypes['push'](_0x273136[_0x3bdb3a]);delete _0x16522b[_0x273136[_0x3bdb3a][_0xf0ab('0x6b')]];hasAdditionalPhones=!![];}for(var _0x1490de in _0x5daeda){if(_0x273136[_0x3bdb3a][_0xf0ab('0x6b')]+'_description'===_0x1490de){phoneDescriptions[_0xf0ab('0x1d')]({'itemTypeId':_0x273136[_0x3bdb3a]['id'],'description':_0x1490de});delete _0x16522b[_0x1490de];}}}if(hasAdditionalPhones)_0x16522b['AdditionalPhones']='';var _0x1a32dc=_[_0xf0ab('0x6c')](_0x16522b)[_0xf0ab('0x12')]();logger['info'](_0xf0ab('0x6d'),_0x1a32dc);fs['writeFileSync'](_0x53ed27,_0x1a32dc+'\x0a');Papa['parse'](fs[_0xf0ab('0x6e')](_0x570379),{'header':!![],'skipEmptyLines':!![],'step':function(_0x461c7a,_0x283426){try{for(var _0x549c70=0x0,_0x300424=[];_0x549c70<_0x461c7a[_0xf0ab('0x6f')][_0xf0ab('0x1a')];_0x549c70++){stats[_0xf0ab('0x70')]+=0x1;if(_0x461c7a['errors'][_0x549c70]){handleError(_0x461c7a['data'][_0x549c70],_0x461c7a['errors'][_0x549c70]);}else{var _0x3fddb4=[];var _0xdd4769=[];var _0x2bdb32={};for(var _0x34a245 in _0x5daeda){let _0x2013b6=contactItemTypes[_0xf0ab('0x71')](_0x3a5205=>_0x3a5205[_0xf0ab('0x6b')]===_0x34a245);let _0x3119d1=contactItemTypes[_0xf0ab('0x71')](_0x228334=>_0x228334['name']+_0xf0ab('0x72')===_0x34a245);if(_[_0xf0ab('0x1b')](_0x2013b6)&&_[_0xf0ab('0x1b')](_0x3119d1)){if(_0x5daeda[_0xf0ab('0x73')](_0x34a245)){if(_0x461c7a[_0xf0ab('0x6f')][_0x549c70][_0x5daeda[_0x34a245]]){var _0x3aafc4=_[_0xf0ab('0x74')](_0x461c7a[_0xf0ab('0x6f')][_0x549c70][_0x5daeda[_0x34a245]]['replace'](/"/g,'\x27'));switch(_0x34a245){case _0xf0ab('0x32'):var _0x1276df=moment(_0x3aafc4,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1276df['isValid']()){_0x300424['push']('\x22'+_0x3aafc4+'\x22');}else{_0x3fddb4[_0xf0ab('0x1d')](_0xf0ab('0x75'));}break;case _0xf0ab('0x37'):var _0x14d3e5=parseInt(_0x3aafc4);_0x3aafc4=_[_0xf0ab('0x76')](_0x14d3e5)||_0x14d3e5<0x0||_0x14d3e5>0x4?_0x5c286d?0x3:0x2:_0x14d3e5;_0x300424[_0xf0ab('0x1d')]('\x22'+_0x3aafc4+'\x22');break;case'UserId':var _0x1053c0=parseInt(_0x3aafc4);if(_['isNumber'](_0x1053c0)&&_[_0xf0ab('0x77')](_0x7e0318,_0x1053c0)){_0x300424['push']('\x22'+_0x1053c0+'\x22');}else{_0x3fddb4[_0xf0ab('0x1d')]('agent\x20not\x20exists');}break;case _0xf0ab('0x78'):if(isEmail(_0x3aafc4)){_0x300424['push']('\x22'+_0x3aafc4+'\x22');}else{_0x3fddb4['push'](_0xf0ab('0x79'));}break;case _0xf0ab('0x7a'):var _0x1f37a2=moment(_0x3aafc4,_0xf0ab('0x7b'),!![]);if(_0x1f37a2[_0xf0ab('0x7c')]()){_0x300424[_0xf0ab('0x1d')]('\x22'+_0x3aafc4+'\x22');}else{_0x3fddb4[_0xf0ab('0x1d')](_0xf0ab('0x7d'));}break;default:_0x300424[_0xf0ab('0x1d')]('\x22'+_0x3aafc4+'\x22');}}else{switch(_0x34a245){case _0xf0ab('0x7e'):case _0xf0ab('0x10'):_0x3fddb4[_0xf0ab('0x1d')](_0x34a245+_0xf0ab('0x7f'));break;default:_0x300424['push']('\x22\x22');}}}}else{var _0x1f5e73='';if(!_[_0xf0ab('0x1b')](_0x2013b6)){if(!_0x2bdb32[_0xf0ab('0x73')](_0x2013b6['id'])){for(var _0x12acef=0x0;_0x12acef<_0x5daeda[_0x34a245][_0xf0ab('0x1a')];_0x12acef++){var _0x3aafc4=_[_0xf0ab('0x74')](_0x461c7a[_0xf0ab('0x6f')][_0x549c70][_0x5daeda[_0x34a245][_0x12acef]][_0xf0ab('0x80')](/"/g,'\x27'));var _0x3c184d=phoneDescriptions[_0xf0ab('0x71')](_0x29a89b=>_0x29a89b['itemTypeId']===_0x2013b6['id']);if(!_[_0xf0ab('0x1b')](_0x3c184d)){var _0x1f18cd=_[_0xf0ab('0x74')](_0x461c7a[_0xf0ab('0x6f')][_0x549c70][_0x5daeda[_0x3c184d['description']][0x0]][_0xf0ab('0x80')](/"/g,'\x27'));if(!_[_0xf0ab('0x1b')](_0x1f18cd))_0x3aafc4=_0x3aafc4+'§'+_0x1f18cd;}if(_0x1f5e73=='')_0x1f5e73=_0x3aafc4;else _0x1f5e73+='|'+_0x3aafc4;}_0xdd4769[_0xf0ab('0x1d')](_0x2013b6['id']+':'+_0x1f5e73);_0x2bdb32[_0x2013b6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x300424[_0xf0ab('0x1d')]('\x22'+_0xdd4769[_0xf0ab('0x12')](';')+'\x22');}if(_0x3fddb4['length']){handleError(_0x461c7a[_0xf0ab('0x6f')][_0x549c70],{'code':_0xf0ab('0x81'),'message':_0x3fddb4['join']()});}else{fs[_0xf0ab('0x82')](_0x53ed27,_0x300424['join']()+'\x0a');}_0x300424=[];}if(!(stats[_0xf0ab('0x70')]%0xc8)){socket[_0xf0ab('0x83')]('contact:import:'+_0x3d333f,stats);stats[_0xf0ab('0x5c')]=[];}}if(stopped){logger[_0xf0ab('0x5e')]('Abort\x20parser');_0x283426['abort']();}}catch(_0x2cffac){handleError(_0x461c7a['data'][_0x549c70],{'code':_0xf0ab('0x84'),'message':_0x2cffac[_0xf0ab('0x22')]});logger['error']('step',_0x2cffac['message']);}},'complete':function(){try{var _0xe34b36=[];var _0x7e2b70=tempTableName;_0xe34b36[_0xf0ab('0x1d')](_0xf0ab('0x85')+_0x7e2b70+'\x20LIKE\x20cm_contacts;');logger[_0xf0ab('0x5e')](_0xf0ab('0x86'),contactItemTypes[_0xf0ab('0x1a')]);var _0x1a843c=util[_0xf0ab('0xb')]('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',_0x53ed27,_0x7e2b70,_0x1a32dc,_0x59455b['ListId'],_0x59455b[_0xf0ab('0x87')]||null,NOW,NOW);if(_[_0xf0ab('0x1b')](_0x5daeda['scheduledat'])){_0x1a843c+=',\x20scheduledAt\x20=\x20NOW()';}_0xe34b36[_0xf0ab('0x1d')](_0x1a843c);BPromise[_0xf0ab('0x88')](_0xe34b36,handleQuery)[_0xf0ab('0x1f')](function(_0x42c860){BPromise[_0xf0ab('0x1e')]([handleAdditionalPhones()])[_0xf0ab('0x1f')](function(){_0xe34b36=[];for(var _0x8cc011=0x0;_0x8cc011\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.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','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','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','isEmpty','where','t.id\x20IN\x20?','SELECT','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','getAccountFK','role','agent','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts'];(function(_0x58dc86,_0x4e6b28){var _0x4aae2c=function(_0x214d51){while(--_0x214d51){_0x58dc86['push'](_0x58dc86['shift']());}};_0x4aae2c(++_0x4e6b28);}(_0x3b63,0x87));var _0x33b6=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x3b63[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x33b6('0x0'));var squel=require(_0x33b6('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x33b6('0x2'));var updateInteraction=require(_0x33b6('0x3'))[_0x33b6('0x4')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x49eb5c,_0x1128a4,_0x369fbe){var _0x381b15=![];var _0xd81e61=utils[_0x33b6('0x5')](_0x49eb5c);if(_0x1128a4[_0x33b6('0x6')]===_0x33b6('0x7')&&!_0x369fbe['search']&&!_0x369fbe[_0xd81e61]){_0x381b15=!![];}return _0x381b15;}function getTagsQuery(){return squel[_0x33b6('0x8')]()['field']('id')[_0x33b6('0x9')](_0x33b6('0xa'))['field'](_0x33b6('0xb'))[_0x33b6('0xc')](_0x33b6('0xd'));}function getUsersQuery(_0x5eb4a8,_0x405933){var _0x453faa=utils[_0x33b6('0xe')](_0x5eb4a8);var _0x2d1d3a=_0x33b6('0xf')+_0x5eb4a8+_0x33b6('0x10');var _0x5d6070=squel['select']()[_0x33b6('0x9')]('u.id')[_0x33b6('0x9')]('u.fullname')[_0x33b6('0x9')](_0x33b6('0x11')+_0x453faa)[_0x33b6('0xc')](_0x2d1d3a,'ui')[_0x33b6('0x12')](_0x33b6('0x13'),'u',_0x33b6('0x14'));if(_0x405933[_0x33b6('0x15')]>0x0){_0x5d6070['where']('ui.'+_0x453faa+'\x20IN\x20?',_['map'](_0x405933,'id'));}return _0x5d6070;}function getInteractionsQuery(_0x2c0f48){var _0x2e950b=utils[_0x33b6('0x16')](_0x2c0f48);var _0x1d6633=utils[_0x33b6('0x5')](_0x2c0f48);var _0x3c67bf=utils['getInteractionFK'](_0x2c0f48);return squel[_0x33b6('0x8')]()[_0x33b6('0xc')](_0x2e950b[_0x33b6('0x17')],'i')[_0x33b6('0x12')](_0x33b6('0x18'),'c',_0x33b6('0x19'))[_0x33b6('0x12')](_0x33b6('0x13'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x2e950b[_0x33b6('0x1a')],'a',_0x33b6('0x1b')+_0x1d6633)['left_join'](_0x2e950b[_0x33b6('0x1c')],'me',_0x33b6('0x1d')+_0x3c67bf+'\x20=\x20i.id')['left_join'](_0x2e950b[_0x33b6('0x1e')],'it','it.'+_0x3c67bf+_0x33b6('0x1f'))[_0x33b6('0x12')](_0x33b6('0xd'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3815d4={'body':squel[_0x33b6('0x20')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x33b6('0x20')](),'filter':squel[_0x33b6('0x20')](),'read':squel[_0x33b6('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x33b6('0x20')]()};return _0x3815d4;}function parseTagParameter(_0x15133a){var _0x4aeb33=squel[_0x33b6('0x20')]();if(_0x15133a){var _0x17263f=utils[_0x33b6('0x21')](_0x15133a);_0x17263f[_0x33b6('0x22')](function(_0x155e7a){_0x4aeb33['or'](_0x33b6('0x23'),'%,'+_0x155e7a+',%');});}return _0x4aeb33;}function parseReadParameter(_0x425e7c){var _0x35b9d1='';if(_0x425e7c){_0x35b9d1=_0x33b6('0x24');if(_0x425e7c==='1'){_0x35b9d1=_0x35b9d1['replace']('{OPERATOR}','=');}else{_0x35b9d1=_0x35b9d1['replace']('{OPERATOR}','>');}}return _0x35b9d1;}function parseSearchFilter(_0x4e2317,_0x4d1188){var _0x331658=squel[_0x33b6('0x20')]();if(_0x4d1188){var _0x21299f=_0x4d1188['replace']('\x5c','\x5c\x5c')[_0x33b6('0x25')](/'/g,'\x27\x27');if(qs[_0x33b6('0x26')](_0x21299f)){_0x331658['or'](_0x33b6('0x27'),_0x21299f+'%');if([_0x33b6('0x28'),_0x33b6('0x29')][_0x33b6('0x2a')](_0x4e2317)){_0x331658['or'](_0x33b6('0x2b'),_0x21299f+'%');}else if(_0x4e2317==='fax'){_0x331658['or'](_0x33b6('0x2c'),_0x21299f+'%');}else if(_0x4e2317===_0x33b6('0x2d')){_0x331658['or'](_0x33b6('0x2e'),_0x21299f+'%');}}else if(_0x4e2317===_0x33b6('0x2f')&&qs[_0x33b6('0x30')](_0x21299f)){_0x331658['or']('c.email\x20LIKE\x20?',_0x21299f+'%');}else{if(_0x4e2317===_0x33b6('0x2f')){_0x331658['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x33b6('0x31')](_0x21299f,!![]))['or'](_0x33b6('0x32'),qs['getFullTextValue'](_0x21299f));}else if(_0x4e2317!==_0x33b6('0x33')){_0x331658['or'](_0x33b6('0x34'),qs[_0x33b6('0x31')](_0x21299f));}_0x331658['or'](_0x33b6('0x35'),qs[_0x33b6('0x31')](_0x21299f,!![]),null);}}return _0x331658;}function parseAdvancedSearchFilter(_0x33514e,_0x44a848){var _0x207f6b=getSqlClauses();var _0x4bcf46=as[_0x33b6('0x36')](_0x33514e);var _0x2caa5a=_0x4bcf46['sqlOperator'];for(var _0x195509=0x0;_0x195509<_0x4bcf46[_0x33b6('0x37')][_0x33b6('0x15')];_0x195509++){var _0x127dbf=_0x4bcf46[_0x33b6('0x37')][_0x195509];var _0xac62f1='i';var _0x588f84=_[_0x33b6('0x38')](_0x44a848,[_0x33b6('0xa'),_0x127dbf[_0x33b6('0x9')]]);if(_0x588f84){var _0x51edb2=as[_0x33b6('0x39')](_0xac62f1,_0x588f84[_0x33b6('0x3a')],_0x127dbf);_0x207f6b[_0x33b6('0x3b')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')]['end']);}else{switch(_0x127dbf['field']){case'unreadMessages':var _0x5a8f1d=parseReadParameter(_0x127dbf['value']);_0x207f6b['read'][_0x33b6('0x3f')](_0x5a8f1d);break;case _0x33b6('0x40'):if(_0x127dbf[_0x33b6('0x41')]==='$substring'){if(_0x127dbf[_0x33b6('0x3d')][_0x33b6('0x42')]('\x20')[_0x33b6('0x15')]>0x1){_0x207f6b[_0x33b6('0x43')][_0x2caa5a](_0x33b6('0x35'),qs[_0x33b6('0x31')](_0x127dbf[_0x33b6('0x3d')],!![]),null);}else{var _0x2118a8='%'+_0x127dbf['value']+'%';_0x207f6b[_0x33b6('0x43')][_0x2caa5a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2118a8,_0x2118a8,_0x2118a8);}}else{_0x588f84=_['find'](_0x44a848,['name',_0x33b6('0x44')]);_0x127dbf[_0x33b6('0x9')]=_0x33b6('0x44');_0x51edb2=as[_0x33b6('0x39')](_0xac62f1,_0x588f84[_0x33b6('0x3a')],_0x127dbf);_0x207f6b[_0x33b6('0x43')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2['value'][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x45')]);}break;case'Tag':var _0x2c2054=_0x127dbf[_0x33b6('0x3d')][_0x33b6('0x42')](',')[_0x33b6('0x46')](function(_0x3d91cd){return Number(_0x3d91cd);});var _0x5c1bd2=parseTagParameter(_0x2c2054);_0x207f6b[_0x33b6('0x47')][_0x33b6('0x48')]['and'](_0x5c1bd2);_0x207f6b[_0x33b6('0x47')][_0x33b6('0x49')]=_0x2c2054;break;case _0x33b6('0x4a'):if(_0x127dbf[_0x33b6('0x41')]===_0x33b6('0x4b')){_0x207f6b[_0x33b6('0x4c')][_0x2caa5a](_0x33b6('0x4d'),'%'+_0x127dbf[_0x33b6('0x3d')]+'%',null);}else{_0x588f84=_[_0x33b6('0x38')](_0x44a848,['name',_0x33b6('0x4e')]);_0x127dbf[_0x33b6('0x9')]='UserId';_0x51edb2=as[_0x33b6('0x39')](_0xac62f1,_0x588f84[_0x33b6('0x3a')],_0x127dbf);_0x207f6b[_0x33b6('0x4c')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x45')]);}break;case _0x33b6('0x4f'):case _0x33b6('0x50'):_0x51edb2=as[_0x33b6('0x39')]('me',null,_0x127dbf);_0x207f6b[_0x33b6('0x4f')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x45')]);break;}}}return _0x207f6b;}function parseModelFields(_0x533c34,_0x2fdfac,_0x204cce){var _0xefe302=utils[_0x33b6('0x5')](_0x533c34);var _0xe240c=squel[_0x33b6('0x20')]();var _0x820103=_(_0x2fdfac)[_0x33b6('0x51')]()['map'](function(_0x4965b9){return _[_0x33b6('0x52')](_0x204cce,[_0x33b6('0xa'),_0x4965b9])?_0x4965b9:undefined;})['compact']()[_0x33b6('0x3d')]();if(_0x820103[_0x33b6('0x15')]>0x0){_0x820103[_0x33b6('0x22')](function(_0x3c558){if(_0x3c558===_0xefe302){_0xe240c[_0x33b6('0x3f')]('i.'+_0xefe302+_0x33b6('0x53'),[]['concat'](_0x2fdfac[_0x3c558]));}else if(_0x3c558==='createdAt'){var _0x6f4762=JSON[_0x33b6('0x54')](_0x2fdfac[_0x3c558])[_0x33b6('0x55')];var _0x2b838f=JSON[_0x33b6('0x54')](_0x2fdfac[_0x3c558])[_0x33b6('0x56')];_0xe240c[_0x33b6('0x3f')](_0x33b6('0x57'),_0x6f4762,_0x2b838f);}else{if(_0x2fdfac[_0x3c558]===_0x33b6('0x58')){_0xe240c[_0x33b6('0x3f')]('i.'+_0x3c558+'\x20IS\x20NULL');}else{_0xe240c[_0x33b6('0x3f')]('i.'+_0x3c558+'\x20=\x20?',_0x2fdfac[_0x3c558]);}}});}return _0xe240c;}function parseQueryParameters(_0x542ffa,_0x4abfb5,_0x5cbf78){var _0x4fa079=getSqlClauses();return Promise['resolve']()[_0x33b6('0x59')](function(){return parseModelFields(_0x542ffa,_0x4abfb5,_0x5cbf78);})['then'](function(_0x21ad8f){_0x4fa079[_0x33b6('0x5a')][_0x33b6('0x3f')](_0x21ad8f);return parseReadParameter(_0x4abfb5['read']);})[_0x33b6('0x59')](function(_0x3b2d90){_0x4fa079[_0x33b6('0x5b')][_0x33b6('0x3f')](_0x3b2d90);return parseTagParameter(_0x4abfb5[_0x33b6('0x5c')]);})[_0x33b6('0x59')](function(_0x2b854a){_0x4fa079['tags'][_0x33b6('0x48')][_0x33b6('0x3f')](_0x2b854a);return parseSearchFilter(_0x542ffa,_0x4abfb5['filter']);})[_0x33b6('0x59')](function(_0x14af5e){_0x4fa079['filter']=_0x14af5e;return _0x4fa079;});}function checkAccountsRestrictions(_0x51d94f,_0x7f0b66,_0x2a5cfa){var _0x1b7e86=utils[_0x33b6('0x5')](_0x51d94f);var _0x136683=_0x33b6('0x5d')+_[_0x33b6('0x5e')](_0x51d94f)+(_0x51d94f===_0x33b6('0x5f')?_0x33b6('0x60'):'Accounts');var _0x3d4388=squel[_0x33b6('0x20')]();return Promise[_0x33b6('0x61')]()[_0x33b6('0x59')](function(){if(_0x2a5cfa[_0x33b6('0x62')]&&_0x7f0b66[_0x33b6('0x6')]==='agent'){return _0x7f0b66[_0x136683]({'attributes':['id'],'raw':!![]});}})[_0x33b6('0x59')](function(_0x2da253){if(_0x2da253){if(_0x2da253[_0x33b6('0x15')]===0x0){_0x3d4388['and']('i.'+_0x1b7e86+'\x20IS\x20NULL');}else{_0x3d4388[_0x33b6('0x3f')]('i.'+_0x1b7e86+_0x33b6('0x53'),_[_0x33b6('0x46')](_0x2da253,'id'));}}else if(!_0x2a5cfa[_0x1b7e86]){_0x3d4388['and']('i.'+_0x1b7e86+_0x33b6('0x63'));}})['then'](function(){return _0x3d4388;});}function getClosedOrderClause(_0x2437ba,_0x4b6aae){var _0x7debb3='';var _0xfaecf3=[_0x33b6('0x64'),_0x33b6('0x65'),'i.disposition'];if(_0x2437ba===_0x33b6('0x2f')){_0xfaecf3[_0x33b6('0x66')](_0x33b6('0x67'));}if(_0x4b6aae['closed']==='0'&&_0x2437ba==='mail'){_0x7debb3='i.substatus';}else{if(_0x4b6aae['closed']==='1'){_0xfaecf3['shift']();}_0x7debb3=_0x33b6('0x68')+_0xfaecf3[_0x33b6('0x69')](',\x20')+')';}return _0x7debb3;}function getFilteredInteractions(_0x2024c7,_0x2f7174,_0x114d9a,_0x3a7d24){var _0x18080e=utils['getInteractionFK'](_0x2024c7);var _0x195ad2=_[_0x33b6('0x5e')](_0x2024c7)+_0x33b6('0x6a');var _0xb4fd4e=[];var _0x581b8c=getTagsQuery();var _0x1a9688={'type':db[_0x33b6('0x6b')][_0x33b6('0x6c')]['SELECT'],'raw':!![]};var _0x211074=[];var _0x3dc8e9=[];return db[_0x33b6('0x6d')][_0x33b6('0x6e')](_0x581b8c[_0x33b6('0x6f')](),_0x1a9688)[_0x33b6('0x59')](function(_0x15c3b0){_0xb4fd4e=_[_0x33b6('0x70')](_0x15c3b0,'id');_0x1a9688=_[_0x33b6('0x71')](_0x1a9688,{'model':db[_0x195ad2],'mapToModel':!![],'nest':!![]});if(_0x114d9a[_0x33b6('0x5a')]){_0x3a7d24[_0x33b6('0x72')]['forEach'](function(_0x18ad7b){_0x2f7174['field']('i.'+_0x18ad7b);});}else{_0x2f7174[_0x33b6('0x9')](_0x33b6('0x73'),_0x33b6('0x74'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x75'),'Account.key');_0x2f7174[_0x33b6('0x9')](_0x33b6('0x76'),_0x33b6('0x77'));if(_0x2024c7===_0x33b6('0x2f')){_0x2f7174[_0x33b6('0x9')]('a.email',_0x33b6('0x78'));_0x2f7174['field'](_0x33b6('0x79'),_0x33b6('0x7a'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7b'));_0x2f7174[_0x33b6('0x9')]('i.createdAt');_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7c'));_0x2f7174['field'](_0x33b6('0x7d'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7e'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7f'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x80'));_0x2f7174['field'](_0x33b6('0x81'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x82'));_0x2f7174['field'](_0x33b6('0x83'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x65'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x64'));_0x2f7174[_0x33b6('0x9')]('i.substatus');_0x2f7174['field'](_0x33b6('0x84'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x85'));_0x2f7174[_0x33b6('0x9')]('i.MailAccountId');_0x2f7174[_0x33b6('0x9')]('i.UserId');}else if(_0x2024c7===_0x33b6('0x2d')){_0x2f7174[_0x33b6('0x9')]('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',_0x33b6('0x7a'));}else{_0x2f7174[_0x33b6('0x9')](_0x33b6('0x86'),'contactName');}if(_0x2024c7!==_0x33b6('0x2f')){_0x2f7174['field']('i.*');}_0x2f7174[_0x33b6('0x9')](_0x33b6('0x87'),'Contact.firstName');_0x2f7174[_0x33b6('0x9')](_0x33b6('0x88'),_0x33b6('0x89'));_0x2f7174['field'](_0x33b6('0x8a'),_0x33b6('0x8b'));_0x2f7174['field'](_0x33b6('0x8c'),_0x33b6('0x8d'));_0x2f7174['field'](_0x33b6('0x8e'),_0x33b6('0x8f'));_0x2f7174[_0x33b6('0x9')]('c.fax',_0x33b6('0x90'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x91'),_0x33b6('0x92'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x93'),'Owner.internal');_0x2f7174['field'](_0x33b6('0x94'),_0x33b6('0x95'));}if(_0x3a7d24[_0x33b6('0x96')]){_0x2f7174[_0x33b6('0x96')](_0x3a7d24['limit']);}if(_0x3a7d24[_0x33b6('0x97')]){_0x2f7174['offset'](_0x3a7d24[_0x33b6('0x97')]);}return db['sequelize']['query'](_0x2f7174[_0x33b6('0x6f')](),_0x1a9688);})['then'](function(_0x2a1d4f){_0x211074=_0x2a1d4f;var _0x45a1ab=getUsersQuery(_0x2024c7,_0x211074);return db[_0x33b6('0x6d')][_0x33b6('0x6e')](_0x45a1ab[_0x33b6('0x6f')](),_0x1a9688);})[_0x33b6('0x59')](function(_0x17a3b9){_0x3dc8e9=_[_0x33b6('0x98')](_0x17a3b9,_0x18080e);if(_0x2024c7==='mail'){return db[_0x33b6('0x99')][_0x33b6('0x9a')]({'attributes':[_0x33b6('0x9b')],'raw':!![]});}})['then'](function(_0x784065){var _0x31f0b2=_0x784065?_0x784065[_0x33b6('0x9b')]:undefined;var _0x29901d=_0x211074[_0x33b6('0x46')](function(_0x3d9b91){return updateInteraction(_0x3d9b91,_0xb4fd4e,_0x3dc8e9,_0x31f0b2);});return Promise[_0x33b6('0x9c')](_0x29901d);});}function countFilteredInteractions(_0x391bdf,_0xe43447){var _0x4cd283=_0x391bdf[_0x33b6('0x9d')]();_0x4cd283[_0x33b6('0x9')]('COUNT(*)');_0x4cd283[_0x33b6('0x9')](_0x33b6('0x73'),_0x33b6('0x74'));var _0x16f27b=utils[_0x33b6('0x21')](_0xe43447);if(!_[_0x33b6('0x9e')](_0x16f27b)){_0x4cd283[_0x33b6('0x9f')](_0x33b6('0xa0'),_0x16f27b);}var _0xd8f05e={'type':db[_0x33b6('0x6b')][_0x33b6('0x6c')][_0x33b6('0xa1')],'raw':!![]};return db[_0x33b6('0x6d')][_0x33b6('0x6e')](_0x4cd283[_0x33b6('0x6f')](),_0xd8f05e);}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 _0x5efd=['unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','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.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','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','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','toString','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','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(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','type','default','start','value','end','read','and','Contact','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','Tag','split','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','compact','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','clause','filter','get','capitalize','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','sequelize','keyBy','merge','attributes'];(function(_0x1fe7e4,_0x5d39a4){var _0x4b3e54=function(_0x39fdf1){while(--_0x39fdf1){_0x1fe7e4['push'](_0x1fe7e4['shift']());}};_0x4b3e54(++_0x5d39a4);}(_0x5efd,0xe1));var _0xd5ef=function(_0x19c2d5,_0x212433){_0x19c2d5=_0x19c2d5-0x0;var _0x415124=_0x5efd[_0x19c2d5];return _0x415124;};'use strict';var _=require(_0xd5ef('0x0'));var squel=require(_0xd5ef('0x1'));var as=require(_0xd5ef('0x2'));var qs=require(_0xd5ef('0x3'));var updateInteraction=require(_0xd5ef('0x4'))['updateInteraction'];var utils=require(_0xd5ef('0x5'));var db=require(_0xd5ef('0x6'))['db'];function skipInteractionsQuery(_0x3417cc,_0x2d1a89,_0x304cda){var _0x1f1095=![];var _0x544e96=utils[_0xd5ef('0x7')](_0x3417cc);if(_0x2d1a89[_0xd5ef('0x8')]==='agent'&&!_0x304cda[_0xd5ef('0x9')]&&!_0x304cda[_0x544e96]){_0x1f1095=!![];}return _0x1f1095;}function getTagsQuery(){return squel[_0xd5ef('0xa')]()[_0xd5ef('0xb')]('id')['field'](_0xd5ef('0xc'))[_0xd5ef('0xb')]('color')['from'](_0xd5ef('0xd'));}function getUsersQuery(_0x4b4e2a,_0x58f24e){var _0x1880ea=utils[_0xd5ef('0xe')](_0x4b4e2a);var _0x436797=_0xd5ef('0xf')+_0x4b4e2a+_0xd5ef('0x10');var _0x16b6d7=squel[_0xd5ef('0xa')]()[_0xd5ef('0xb')](_0xd5ef('0x11'))['field'](_0xd5ef('0x12'))[_0xd5ef('0xb')](_0xd5ef('0x13')+_0x1880ea)[_0xd5ef('0x14')](_0x436797,'ui')[_0xd5ef('0x15')](_0xd5ef('0x16'),'u',_0xd5ef('0x17'));if(_0x58f24e[_0xd5ef('0x18')]>0x0){_0x16b6d7[_0xd5ef('0x19')]('ui.'+_0x1880ea+_0xd5ef('0x1a'),_[_0xd5ef('0x1b')](_0x58f24e,'id'));}return _0x16b6d7;}function getInteractionsQuery(_0x2a5e63){var _0x4f08aa=utils[_0xd5ef('0x1c')](_0x2a5e63);var _0x3ff589=utils[_0xd5ef('0x7')](_0x2a5e63);var _0x4ba177=utils[_0xd5ef('0xe')](_0x2a5e63);return squel[_0xd5ef('0xa')]()[_0xd5ef('0x14')](_0x4f08aa[_0xd5ef('0x1d')],'i')[_0xd5ef('0x15')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xd5ef('0x1e'))[_0xd5ef('0x15')](_0x4f08aa[_0xd5ef('0x1f')],'a','a.id\x20=\x20i.'+_0x3ff589)['left_join'](_0x4f08aa['messages'],'me',_0xd5ef('0x20')+_0x4ba177+_0xd5ef('0x21'))['left_join'](_0x4f08aa[_0xd5ef('0x22')],'it',_0xd5ef('0x23')+_0x4ba177+_0xd5ef('0x21'))[_0xd5ef('0x15')]('tools_tags','t',_0xd5ef('0x24'));}function getSqlClauses(){var _0x3a8378={'body':squel['expr'](),'contact':squel[_0xd5ef('0x25')](),'default':squel[_0xd5ef('0x25')](),'fields':squel[_0xd5ef('0x25')](),'filter':squel[_0xd5ef('0x25')](),'read':squel['expr'](),'tags':{'clause':squel[_0xd5ef('0x25')](),'ids':null},'user':squel['expr']()};return _0x3a8378;}function parseTagParameter(_0x1fdd5c){var _0x3d995d=squel[_0xd5ef('0x25')]();if(_0x1fdd5c){var _0x28bff2=utils[_0xd5ef('0x26')](_0x1fdd5c);_0x28bff2[_0xd5ef('0x27')](function(_0x3612bc){_0x3d995d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3612bc+',%');});}return _0x3d995d;}function parseReadParameter(_0x4d5416){var _0x4a759a='';if(_0x4d5416){_0x4a759a=_0xd5ef('0x28');if(_0x4d5416==='1'){_0x4a759a=_0x4a759a[_0xd5ef('0x29')](_0xd5ef('0x2a'),'=');}else{_0x4a759a=_0x4a759a[_0xd5ef('0x29')](_0xd5ef('0x2a'),'>');}}return _0x4a759a;}function parseSearchFilter(_0x4bf07c,_0x4485ea){var _0xc9308d=squel['expr']();if(_0x4485ea){var _0x3d71af=_0x4485ea[_0xd5ef('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3d71af)){_0xc9308d['or'](_0xd5ef('0x2b'),_0x3d71af+'%');if([_0xd5ef('0x2c'),'whatsapp'][_0xd5ef('0x2d')](_0x4bf07c)){_0xc9308d['or'](_0xd5ef('0x2e'),_0x3d71af+'%');}else if(_0x4bf07c===_0xd5ef('0x2f')){_0xc9308d['or'](_0xd5ef('0x30'),_0x3d71af+'%');}else if(_0x4bf07c===_0xd5ef('0x31')){_0xc9308d['or'](_0xd5ef('0x32'),_0x3d71af+'%');}}else if(_0x4bf07c===_0xd5ef('0x33')&&qs[_0xd5ef('0x34')](_0x3d71af)){_0xc9308d['or']('c.email\x20LIKE\x20?',_0x3d71af+'%');}else{if(_0x4bf07c===_0xd5ef('0x33')){_0xc9308d['or'](_0xd5ef('0x35'),qs[_0xd5ef('0x36')](_0x3d71af,!![]))['or'](_0xd5ef('0x37'),qs[_0xd5ef('0x36')](_0x3d71af));}else if(_0x4bf07c!=='fax'){_0xc9308d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd5ef('0x36')](_0x3d71af));}_0xc9308d['or'](_0xd5ef('0x38'),qs[_0xd5ef('0x36')](_0x3d71af,!![]),null);}}return _0xc9308d;}function parseAdvancedSearchFilter(_0x45d8bb,_0x55961a){var _0x216456=getSqlClauses();var _0xf7018f=as[_0xd5ef('0x39')](_0x45d8bb);var _0x4e66fd=_0xf7018f[_0xd5ef('0x3a')];for(var _0x1328cc=0x0;_0x1328cc<_0xf7018f[_0xd5ef('0x3b')][_0xd5ef('0x18')];_0x1328cc++){var _0x23462c=_0xf7018f['conditions'][_0x1328cc];var _0x38dca9='i';var _0x32d7db=_['find'](_0x55961a,[_0xd5ef('0xc'),_0x23462c['field']]);if(_0x32d7db){var _0x10a261=as[_0xd5ef('0x3c')](_0x38dca9,_0x32d7db[_0xd5ef('0x3d')],_0x23462c);_0x216456[_0xd5ef('0x3e')][_0x4e66fd](_0x10a261['text'],_0x10a261['value'][_0xd5ef('0x3f')],_0x10a261[_0xd5ef('0x40')][_0xd5ef('0x41')]);}else{switch(_0x23462c[_0xd5ef('0xb')]){case'unreadMessages':var _0x3f4b31=parseReadParameter(_0x23462c[_0xd5ef('0x40')]);_0x216456[_0xd5ef('0x42')][_0xd5ef('0x43')](_0x3f4b31);break;case _0xd5ef('0x44'):if(_0x23462c['operator']===_0xd5ef('0x45')){if(_0x23462c[_0xd5ef('0x40')]['split']('\x20')['length']>0x1){_0x216456[_0xd5ef('0x46')][_0x4e66fd](_0xd5ef('0x38'),qs[_0xd5ef('0x36')](_0x23462c[_0xd5ef('0x40')],!![]),null);}else{var _0x5a3ec8='%'+_0x23462c['value']+'%';_0x216456[_0xd5ef('0x46')][_0x4e66fd](_0xd5ef('0x47'),_0x5a3ec8,_0x5a3ec8,_0x5a3ec8);}}else{_0x32d7db=_[_0xd5ef('0x48')](_0x55961a,[_0xd5ef('0xc'),_0xd5ef('0x49')]);_0x23462c['field']='ContactId';_0x10a261=as[_0xd5ef('0x3c')](_0x38dca9,_0x32d7db['type'],_0x23462c);_0x216456[_0xd5ef('0x46')][_0x4e66fd](_0x10a261[_0xd5ef('0x4a')],_0x10a261[_0xd5ef('0x40')]['start'],_0x10a261[_0xd5ef('0x40')][_0xd5ef('0x41')]);}break;case _0xd5ef('0x4b'):var _0x56ee45=_0x23462c[_0xd5ef('0x40')][_0xd5ef('0x4c')](',')[_0xd5ef('0x1b')](function(_0x356ec5){return Number(_0x356ec5);});var _0x3fa44b=parseTagParameter(_0x56ee45);_0x216456['tags']['clause'][_0xd5ef('0x43')](_0x3fa44b);_0x216456['tags'][_0xd5ef('0x4d')]=_0x56ee45;break;case'User':if(_0x23462c['operator']===_0xd5ef('0x45')){_0x216456[_0xd5ef('0x4e')][_0x4e66fd](_0xd5ef('0x4f'),'%'+_0x23462c[_0xd5ef('0x40')]+'%',null);}else{_0x32d7db=_[_0xd5ef('0x48')](_0x55961a,['name',_0xd5ef('0x50')]);_0x23462c[_0xd5ef('0xb')]=_0xd5ef('0x50');_0x10a261=as['buildExpression'](_0x38dca9,_0x32d7db['type'],_0x23462c);_0x216456[_0xd5ef('0x4e')][_0x4e66fd](_0x10a261[_0xd5ef('0x4a')],_0x10a261[_0xd5ef('0x40')][_0xd5ef('0x3f')],_0x10a261['value'][_0xd5ef('0x41')]);}break;case _0xd5ef('0x51'):case _0xd5ef('0x52'):_0x10a261=as[_0xd5ef('0x3c')]('me',null,_0x23462c);_0x216456[_0xd5ef('0x51')][_0x4e66fd](_0x10a261['text'],_0x10a261[_0xd5ef('0x40')][_0xd5ef('0x3f')],_0x10a261[_0xd5ef('0x40')][_0xd5ef('0x41')]);break;}}}return _0x216456;}function parseModelFields(_0x22c922,_0x209d75,_0x287668){var _0x9ee424=utils['getAccountFK'](_0x22c922);var _0x557716=squel['expr']();var _0x36f405=_(_0x209d75)[_0xd5ef('0x53')]()['map'](function(_0x32f303){return _['some'](_0x287668,[_0xd5ef('0xc'),_0x32f303])?_0x32f303:undefined;})[_0xd5ef('0x54')]()[_0xd5ef('0x40')]();if(_0x36f405['length']>0x0){_0x36f405[_0xd5ef('0x27')](function(_0x151dc2){if(_0x151dc2===_0x9ee424){_0x557716[_0xd5ef('0x43')]('i.'+_0x9ee424+'\x20IN\x20?',[][_0xd5ef('0x55')](_0x209d75[_0x151dc2]));}else if(_0x151dc2===_0xd5ef('0x56')){var _0xa797dd=JSON[_0xd5ef('0x57')](_0x209d75[_0x151dc2])['$gte'];var _0x5f1161=JSON['parse'](_0x209d75[_0x151dc2])['$lte'];_0x557716[_0xd5ef('0x43')](_0xd5ef('0x58'),_0xa797dd,_0x5f1161);}else{if(_0x209d75[_0x151dc2]===_0xd5ef('0x59')){_0x557716[_0xd5ef('0x43')]('i.'+_0x151dc2+_0xd5ef('0x5a'));}else{_0x557716[_0xd5ef('0x43')]('i.'+_0x151dc2+'\x20=\x20?',_0x209d75[_0x151dc2]);}}});}return _0x557716;}function parseQueryParameters(_0x3077c2,_0x501b4d,_0x83f2e9){var _0x64ff9b=getSqlClauses();return Promise[_0xd5ef('0x5b')]()[_0xd5ef('0x5c')](function(){return parseModelFields(_0x3077c2,_0x501b4d,_0x83f2e9);})[_0xd5ef('0x5c')](function(_0x587083){_0x64ff9b[_0xd5ef('0x5d')][_0xd5ef('0x43')](_0x587083);return parseReadParameter(_0x501b4d[_0xd5ef('0x42')]);})[_0xd5ef('0x5c')](function(_0x8eb767){_0x64ff9b[_0xd5ef('0x42')][_0xd5ef('0x43')](_0x8eb767);return parseTagParameter(_0x501b4d[_0xd5ef('0x5e')]);})['then'](function(_0x4ff964){_0x64ff9b['tags'][_0xd5ef('0x5f')][_0xd5ef('0x43')](_0x4ff964);return parseSearchFilter(_0x3077c2,_0x501b4d[_0xd5ef('0x60')]);})['then'](function(_0xacc967){_0x64ff9b[_0xd5ef('0x60')]=_0xacc967;return _0x64ff9b;});}function checkAccountsRestrictions(_0x10420f,_0x3cfce5,_0x215a19){var _0x3aed1d=utils[_0xd5ef('0x7')](_0x10420f);var _0x3f625a=_0xd5ef('0x61')+_[_0xd5ef('0x62')](_0x10420f)+(_0x10420f===_0xd5ef('0x63')?_0xd5ef('0x64'):_0xd5ef('0x65'));var _0x43be1e=squel[_0xd5ef('0x25')]();return Promise['resolve']()[_0xd5ef('0x5c')](function(){if(_0x215a19[_0xd5ef('0x9')]&&_0x3cfce5[_0xd5ef('0x8')]===_0xd5ef('0x66')){return _0x3cfce5[_0x3f625a]({'attributes':['id'],'raw':!![]});}})[_0xd5ef('0x5c')](function(_0x1928a0){if(_0x1928a0){if(_0x1928a0[_0xd5ef('0x18')]===0x0){_0x43be1e[_0xd5ef('0x43')]('i.'+_0x3aed1d+_0xd5ef('0x5a'));}else{_0x43be1e[_0xd5ef('0x43')]('i.'+_0x3aed1d+_0xd5ef('0x1a'),_[_0xd5ef('0x1b')](_0x1928a0,'id'));}}else if(!_0x215a19[_0x3aed1d]){_0x43be1e[_0xd5ef('0x43')]('i.'+_0x3aed1d+_0xd5ef('0x67'));}})['then'](function(){return _0x43be1e;});}function getClosedOrderClause(_0x2c50a7,_0xb6e5e8){var _0x152581='';var _0x3529f4=[_0xd5ef('0x68'),'i.secondDisposition',_0xd5ef('0x69')];if(_0x2c50a7===_0xd5ef('0x33')){_0x3529f4[_0xd5ef('0x6a')](_0xd5ef('0x6b'));}if(_0xb6e5e8['closed']==='0'&&_0x2c50a7===_0xd5ef('0x33')){_0x152581='i.substatus';}else{if(_0xb6e5e8[_0xd5ef('0x6c')]==='1'){_0x3529f4[_0xd5ef('0x6d')]();}_0x152581=_0xd5ef('0x6e')+_0x3529f4[_0xd5ef('0x6f')](',\x20')+')';}return _0x152581;}function getFilteredInteractions(_0x22dea6,_0x2dbd0e,_0x540050,_0x47c55f){var _0x24d805=utils[_0xd5ef('0xe')](_0x22dea6);var _0x5c71dc=_[_0xd5ef('0x62')](_0x22dea6)+_0xd5ef('0x70');var _0x4cc1f4=[];var _0x311434=getTagsQuery();var _0x3caaff={'type':db[_0xd5ef('0x71')][_0xd5ef('0x72')]['SELECT'],'raw':!![]};var _0x2f8baf=[];var _0x27d93c=[];return db[_0xd5ef('0x73')]['query'](_0x311434['toString'](),_0x3caaff)[_0xd5ef('0x5c')](function(_0x3c425f){_0x4cc1f4=_[_0xd5ef('0x74')](_0x3c425f,'id');_0x3caaff=_[_0xd5ef('0x75')](_0x3caaff,{'model':db[_0x5c71dc],'mapToModel':!![],'nest':!![]});if(_0x540050['fields']){_0x47c55f[_0xd5ef('0x76')]['forEach'](function(_0x3a1841){_0x2dbd0e[_0xd5ef('0xb')]('i.'+_0x3a1841);});}else{_0x2dbd0e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd5ef('0x77'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x78'),_0xd5ef('0x79'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x7a'),_0xd5ef('0x7b'));if(_0x22dea6===_0xd5ef('0x33')){_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x7c'),_0xd5ef('0x7d'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x7e'),_0xd5ef('0x7f'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x80'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x81'));_0x2dbd0e['field'](_0xd5ef('0x82'));_0x2dbd0e['field'](_0xd5ef('0x83'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x84'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x85'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x86'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x87'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x88'));_0x2dbd0e[_0xd5ef('0xb')]('i.disposition');_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x89'));_0x2dbd0e[_0xd5ef('0xb')]('i.thirdDisposition');_0x2dbd0e[_0xd5ef('0xb')]('i.substatus');_0x2dbd0e['field']('i.to');_0x2dbd0e['field'](_0xd5ef('0x8a'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x8b'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x8c'));}else if(_0x22dea6===_0xd5ef('0x31')){_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x8d'),_0xd5ef('0x7f'));}else{_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x8e'),_0xd5ef('0x7f'));}if(_0x22dea6!==_0xd5ef('0x33')){_0x2dbd0e[_0xd5ef('0xb')]('i.*');}_0x2dbd0e['field'](_0xd5ef('0x8f'),_0xd5ef('0x90'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x91'),'Contact.lastName');_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x92'),'Contact.email');_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x93'),_0xd5ef('0x94'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x95'),'Contact.mobile');_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x96'),_0xd5ef('0x97'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x98'),_0xd5ef('0x99'));_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x9a'),'Owner.internal');_0x2dbd0e[_0xd5ef('0xb')](_0xd5ef('0x9b'),_0xd5ef('0x9c'));}if(_0x47c55f['limit']){_0x2dbd0e[_0xd5ef('0x9d')](_0x47c55f[_0xd5ef('0x9d')]);}if(_0x47c55f[_0xd5ef('0x9e')]){_0x2dbd0e['offset'](_0x47c55f['offset']);}return db['sequelize'][_0xd5ef('0x9f')](_0x2dbd0e[_0xd5ef('0xa0')](),_0x3caaff);})['then'](function(_0x4adc1e){_0x2f8baf=_0x4adc1e;var _0x5bc2a5=getUsersQuery(_0x22dea6,_0x2f8baf);return db[_0xd5ef('0x73')]['query'](_0x5bc2a5[_0xd5ef('0xa0')](),_0x3caaff);})['then'](function(_0x35c2a7){_0x27d93c=_[_0xd5ef('0xa1')](_0x35c2a7,_0x24d805);if(_0x22dea6===_0xd5ef('0x33')){return db[_0xd5ef('0xa2')][_0xd5ef('0xa3')]({'attributes':[_0xd5ef('0xa4')],'raw':!![]});}})['then'](function(_0x177ca5){var _0x102072=_0x177ca5?_0x177ca5[_0xd5ef('0xa4')]:undefined;var _0x1ae2dd=_0x2f8baf[_0xd5ef('0x1b')](function(_0x29ffbf){return updateInteraction(_0x29ffbf,_0x4cc1f4,_0x27d93c,_0x102072);});return Promise['all'](_0x1ae2dd);});}function countFilteredInteractions(_0x5f07f6,_0x20f8d4){var _0x3277cf=_0x5f07f6[_0xd5ef('0xa5')]();_0x3277cf[_0xd5ef('0xb')](_0xd5ef('0xa6'));_0x3277cf[_0xd5ef('0xb')](_0xd5ef('0xa7'),_0xd5ef('0x77'));var _0x41867f=utils[_0xd5ef('0x26')](_0x20f8d4);if(!_[_0xd5ef('0xa8')](_0x41867f)){_0x3277cf[_0xd5ef('0x19')](_0xd5ef('0xa9'),_0x41867f);}var _0x151dc1={'type':db['Sequelize'][_0xd5ef('0x72')][_0xd5ef('0xaa')],'raw':!![]};return db['sequelize'][_0xd5ef('0x9f')](_0x3277cf[_0xd5ef('0xa0')](),_0x151dc1);}module[_0xd5ef('0xab')]={'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 9aa8c32..176481b 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 _0x5192=['disposition','unmanaged','UserId','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','lodash','fullname','push','waiting','talking','abandoned','total'];(function(_0x1c60c2,_0x40927f){var _0x419518=function(_0x1df581){while(--_0x1df581){_0x1c60c2['push'](_0x1c60c2['shift']());}};_0x419518(++_0x40927f);}(_0x5192,0x101));var _0x2519=function(_0x213d18,_0x523ee2){_0x213d18=_0x213d18-0x0;var _0x534cdf=_0x5192[_0x213d18];return _0x534cdf;};'use strict';var _=require(_0x2519('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0xca51fc,_0x22f746){return new Promise(function(_0x4d34ee,_0x2748a1){try{var _0x48ee19=[];if(_0x22f746[_0xca51fc]){_0x48ee19=_0x22f746[_0xca51fc]['map'](function(_0x2f1e37){return{'id':_0x2f1e37['id'],'fullname':_0x2f1e37[_0x2519('0x1')]};});}return _0x4d34ee(_0x48ee19);}catch(_0x3282a0){_0x2748a1(_0x3282a0);}});}function getInteractionTags(_0x16763e,_0xbcc886){var _0x2d9349=[];if(_0x16763e){_0x16763e['split'](',')['forEach'](function(_0x2c9fae){_0x2d9349[_0x2519('0x2')](_0xbcc886[_0x2c9fae]);});}return _0x2d9349;}function updateWaitingCounter(_0x121b95){if(_0x121b95[_0x2519('0x3')]){_0x121b95[_0x2519('0x3')]-=0x1;}}function updateInteractionCounters(_0x46d21){_0x46d21[_0x2519('0x3')]=0x0;_0x46d21[_0x2519('0x4')]=0x0;_0x46d21['answered']=0x0;_0x46d21['unmanaged']=0x0;_0x46d21[_0x2519('0x5')]=0x0;_0x46d21[_0x2519('0x6')]=0x0;if(_0x46d21['closed']){if(_0x46d21[_0x2519('0x7')]===_0x2519('0x5')){_0x46d21[_0x2519('0x5')]+=0x1;updateWaitingCounter(_0x46d21);}if(_0x46d21['UserId']){_0x46d21['answered']+=0x1;if(_0x46d21['talking']){_0x46d21[_0x2519('0x4')]-=0x1;}}else{if(_0x46d21[_0x2519('0x7')]){_0x46d21[_0x2519('0x8')]+=0x1;updateWaitingCounter(_0x46d21);}}}else{if(!_0x46d21['UserId']){_0x46d21[_0x2519('0x3')]+=0x1;}if(_0x46d21[_0x2519('0x9')]){_0x46d21[_0x2519('0x4')]+=0x1;updateWaitingCounter(_0x46d21);}}_0x46d21[_0x2519('0x6')]+=0x1;return _0x46d21;}function getLastMessageText(_0x3c9f06){return db['MailMessage'][_0x2519('0xa')]({'where':{'$and':[{'MailInteractionId':_0x3c9f06['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2519('0xb')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2519('0xc')],'order':_0x2519('0xd'),'raw':!![]})['then'](function(_0x151906){if(_0x151906&&_0x151906[_0x2519('0xc')]){_0x3c9f06[_0x2519('0xe')]=_[_0x2519('0xf')](_0x151906[_0x2519('0xc')]);}return _0x3c9f06;})[_0x2519('0x10')](function(_0x179393){throw _0x179393;});}exports[_0x2519('0x11')]=function(_0x5610ac,_0x37fe7f,_0x4a85b3,_0x1ef5c9){return new Promise(function(_0xd57664,_0x1ed296){return getInteractionUsers(_0x5610ac['id'],_0x4a85b3)[_0x2519('0x12')](function(_0xd13c89){_0x5610ac[_0x2519('0x13')]=_0xd13c89;return getInteractionTags(_0x5610ac[_0x2519('0x14')],_0x37fe7f);})[_0x2519('0x12')](function(_0x59fba6){_0x5610ac[_0x2519('0x15')]=_0x59fba6;delete _0x5610ac[_0x2519('0x14')];return updateInteractionCounters(_0x5610ac);})['then'](function(_0x27af37){if(_0x1ef5c9){return getLastMessageText(_0x27af37);}else{return _0x27af37;}})[_0x2519('0x12')](function(_0x3dd9ab){_0xd57664(_0x3dd9ab);})[_0x2519('0x10')](function(_0x1e16d5){_0x1ed296(_0x1e16d5);});});}; \ No newline at end of file +var _0xdc97=['catch','lodash','../../mysqldb','map','split','push','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','findOne','out','-id','plainBody','lastMsgText','trimStart','updateInteraction','then','Users','TagIds','Tags'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0xdc97,0xd1));var _0x7dc9=function(_0x2e92b1,_0x26ff18){_0x2e92b1=_0x2e92b1-0x0;var _0x36453b=_0xdc97[_0x2e92b1];return _0x36453b;};'use strict';var _=require(_0x7dc9('0x0'));var db=require(_0x7dc9('0x1'))['db'];function getInteractionUsers(_0x54c449,_0x5daa14){return new Promise(function(_0xb938a0,_0x5aace1){try{var _0x1ad2a4=[];if(_0x5daa14[_0x54c449]){_0x1ad2a4=_0x5daa14[_0x54c449][_0x7dc9('0x2')](function(_0x5444bb){return{'id':_0x5444bb['id'],'fullname':_0x5444bb['fullname']};});}return _0xb938a0(_0x1ad2a4);}catch(_0x243cbc){_0x5aace1(_0x243cbc);}});}function getInteractionTags(_0x4c98c1,_0x1d5084){var _0x4018ea=[];if(_0x4c98c1){_0x4c98c1[_0x7dc9('0x3')](',')['forEach'](function(_0xaf227){_0x4018ea[_0x7dc9('0x4')](_0x1d5084[_0xaf227]);});}return _0x4018ea;}function updateWaitingCounter(_0x3835bc){if(_0x3835bc[_0x7dc9('0x5')]){_0x3835bc[_0x7dc9('0x5')]-=0x1;}}function updateInteractionCounters(_0x2ae3c1){_0x2ae3c1['waiting']=0x0;_0x2ae3c1[_0x7dc9('0x6')]=0x0;_0x2ae3c1[_0x7dc9('0x7')]=0x0;_0x2ae3c1[_0x7dc9('0x8')]=0x0;_0x2ae3c1[_0x7dc9('0x9')]=0x0;_0x2ae3c1['total']=0x0;if(_0x2ae3c1[_0x7dc9('0xa')]){if(_0x2ae3c1[_0x7dc9('0xb')]==='abandoned'){_0x2ae3c1['abandoned']+=0x1;updateWaitingCounter(_0x2ae3c1);}if(_0x2ae3c1[_0x7dc9('0xc')]){_0x2ae3c1['answered']+=0x1;if(_0x2ae3c1[_0x7dc9('0x6')]){_0x2ae3c1['talking']-=0x1;}}else{if(_0x2ae3c1[_0x7dc9('0xb')]){_0x2ae3c1[_0x7dc9('0x8')]+=0x1;updateWaitingCounter(_0x2ae3c1);}}}else{if(!_0x2ae3c1['UserId']){_0x2ae3c1[_0x7dc9('0x5')]+=0x1;}if(_0x2ae3c1[_0x7dc9('0xc')]){_0x2ae3c1['talking']+=0x1;updateWaitingCounter(_0x2ae3c1);}}_0x2ae3c1[_0x7dc9('0xd')]+=0x1;return _0x2ae3c1;}function getLastMessageText(_0x20f536){return db['MailMessage'][_0x7dc9('0xe')]({'where':{'$and':[{'MailInteractionId':_0x20f536['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7dc9('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x7dc9('0x10'),'raw':!![]})['then'](function(_0x589aa6){if(_0x589aa6&&_0x589aa6[_0x7dc9('0x11')]){_0x20f536[_0x7dc9('0x12')]=_[_0x7dc9('0x13')](_0x589aa6['plainBody']);}return _0x20f536;})['catch'](function(_0x57af0a){throw _0x57af0a;});}exports[_0x7dc9('0x14')]=function(_0x46b1b1,_0x55143c,_0x1447c1,_0x2cd3f5){return new Promise(function(_0xe6fd0b,_0x43bf83){return getInteractionUsers(_0x46b1b1['id'],_0x1447c1)[_0x7dc9('0x15')](function(_0x23ce92){_0x46b1b1[_0x7dc9('0x16')]=_0x23ce92;return getInteractionTags(_0x46b1b1[_0x7dc9('0x17')],_0x55143c);})[_0x7dc9('0x15')](function(_0x3e33ff){_0x46b1b1[_0x7dc9('0x18')]=_0x3e33ff;delete _0x46b1b1[_0x7dc9('0x17')];return updateInteractionCounters(_0x46b1b1);})[_0x7dc9('0x15')](function(_0x365cf7){if(_0x2cd3f5){return getLastMessageText(_0x365cf7);}else{return _0x365cf7;}})[_0x7dc9('0x15')](function(_0x562f69){_0xe6fd0b(_0x562f69);})[_0x7dc9('0x19')](function(_0x52a3cf){_0x43bf83(_0x52a3cf);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c5718bc..bd98dd8 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 _0x4425=['catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_messages','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','Interaction','findOne','then','update','info'];(function(_0x5ceb9e,_0x395877){var _0xb5a999=function(_0x7f938f){while(--_0x7f938f){_0x5ceb9e['push'](_0x5ceb9e['shift']());}};_0xb5a999(++_0x395877);}(_0x4425,0x1e3));var _0x5442=function(_0x297777,_0x8716){_0x297777=_0x297777-0x0;var _0x494a61=_0x4425[_0x297777];return _0x494a61;};'use strict';var _=require(_0x5442('0x0'));var db=require(_0x5442('0x1'))['db'];var loggers={'openchannel':require(_0x5442('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')(_0x5442('0x3')),'fax':require('../../config/logger')(_0x5442('0x4')),'sms':require(_0x5442('0x2'))(_0x5442('0x5')),'chat':require(_0x5442('0x2'))(_0x5442('0x6')),'whatsapp':require(_0x5442('0x2'))(_0x5442('0x7'))};function getAccountFK(_0x3f02cf){return _[_0x5442('0x8')](_0x3f02cf)+(_0x3f02cf===_0x5442('0x9')?_0x5442('0xa'):_0x5442('0xb'))+'Id';}function getInteractionFK(_0x3af103){return _[_0x5442('0x8')](_0x3af103)+_0x5442('0xc');}function getInteractionId(_0x4f47cb,_0x9fe4f3,_0xe80d67){if(_0x4f47cb&&_0x4f47cb[_[_0x5442('0xd')](_0xe80d67)+_0x5442('0xc')]){return _0x4f47cb[_[_0x5442('0xd')](_0xe80d67)+_0x5442('0xc')];}else if(_0x4f47cb&&_0x4f47cb['id']){return _0x4f47cb['id'];}else if(_0x9fe4f3&&_0x9fe4f3['id']){return _0x9fe4f3['id'];}else{return _0x5442('0xe');}}function getInteractionsTables(_0xb54c5a){return{'accounts':_0xb54c5a+'_'+(_0xb54c5a==='chat'?_0x5442('0xf'):_0x5442('0x10')),'interactions':_0xb54c5a+'_interactions','interactionsTags':_0xb54c5a+'_interaction_has_tags','messages':_0xb54c5a+_0x5442('0x11'),'userInteractions':'user_has_'+_0xb54c5a+_0x5442('0x12')};}function getSelectedTags(_0x14309c){var _0x3c2f0f=[];if(_0x14309c){_0x3c2f0f=Array[_0x5442('0x13')](_0x14309c)?_0x14309c:[_0x14309c];}return _0x3c2f0f;}function log(_0x1fadfc,_0x36e562,_0x107090,_0x28c6ec,_0x158542,_0x1ce653){loggers[_0x158542[_0x5442('0x14')]()][_0x1fadfc](_0x5442('0x15'),_0x1ce653[_0x5442('0x16')](),_0x36e562?_0x36e562['id']:null,_0x36e562?_0x36e562['name']:null,_0x36e562?_0x36e562['role']:null,getInteractionId(_0x107090,_0x28c6ec,_0x158542),_0x107090?JSON[_0x5442('0x17')](_0x107090):'null');}function updateUser(_0x20742a,_0x1df857,_0x4bb0ed,_0xed716e,_0x3d3338){db[_['upperFirst'](_0xed716e)+_0x5442('0x18')][_0x5442('0x19')]({'where':{'id':getInteractionId(_0x1df857,_0x4bb0ed,_0xed716e)}})[_0x5442('0x1a')](function(_0x21a3b6){if(_0x21a3b6){return _0x21a3b6[_0x5442('0x1b')]({'UserId':_0x20742a?_0x20742a['id']:null});}})['then'](function(_0x30d597){if(_0x30d597){log(_0x5442('0x1c'),_0x20742a,_0x1df857,_0x4bb0ed,_0xed716e,_0x3d3338);}})[_0x5442('0x1d')](function(){log(_0x5442('0x1e'),_0x20742a,_0x1df857,_0x4bb0ed,_0xed716e,_0x3d3338);});}module[_0x5442('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xff5c=['exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','info','error'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xff5c,0x106));var _0xcff5=function(_0x4284b7,_0x562898){_0x4284b7=_0x4284b7-0x0;var _0x5084c5=_0xff5c[_0x4284b7];return _0x5084c5;};'use strict';var _=require(_0xcff5('0x0'));var db=require(_0xcff5('0x1'))['db'];var loggers={'openchannel':require(_0xcff5('0x2'))(_0xcff5('0x3')),'mail':require(_0xcff5('0x2'))(_0xcff5('0x4')),'fax':require(_0xcff5('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0xcff5('0x5')),'chat':require(_0xcff5('0x2'))('chat-interactions'),'whatsapp':require(_0xcff5('0x2'))(_0xcff5('0x6'))};function getAccountFK(_0x3d5644){return _[_0xcff5('0x7')](_0x3d5644)+(_0x3d5644===_0xcff5('0x8')?_0xcff5('0x9'):_0xcff5('0xa'))+'Id';}function getInteractionFK(_0x118092){return _[_0xcff5('0x7')](_0x118092)+_0xcff5('0xb');}function getInteractionId(_0x17eabf,_0x2aa266,_0x5b0c0a){if(_0x17eabf&&_0x17eabf[_['upperFirst'](_0x5b0c0a)+_0xcff5('0xb')]){return _0x17eabf[_[_0xcff5('0xc')](_0x5b0c0a)+_0xcff5('0xb')];}else if(_0x17eabf&&_0x17eabf['id']){return _0x17eabf['id'];}else if(_0x2aa266&&_0x2aa266['id']){return _0x2aa266['id'];}else{return'unknown';}}function getInteractionsTables(_0x196e33){return{'accounts':_0x196e33+'_'+(_0x196e33===_0xcff5('0x8')?'websites':_0xcff5('0xd')),'interactions':_0x196e33+_0xcff5('0xe'),'interactionsTags':_0x196e33+_0xcff5('0xf'),'messages':_0x196e33+_0xcff5('0x10'),'userInteractions':_0xcff5('0x11')+_0x196e33+_0xcff5('0xe')};}function getSelectedTags(_0xa103eb){var _0x1c3f89=[];if(_0xa103eb){_0x1c3f89=Array['isArray'](_0xa103eb)?_0xa103eb:[_0xa103eb];}return _0x1c3f89;}function log(_0x1833e1,_0x2c2ab6,_0x4b34a2,_0x517989,_0x2242bb,_0x8512bb){loggers[_0x2242bb[_0xcff5('0x12')]()][_0x1833e1](_0xcff5('0x13'),_0x8512bb[_0xcff5('0x14')](),_0x2c2ab6?_0x2c2ab6['id']:null,_0x2c2ab6?_0x2c2ab6[_0xcff5('0x15')]:null,_0x2c2ab6?_0x2c2ab6['role']:null,getInteractionId(_0x4b34a2,_0x517989,_0x2242bb),_0x4b34a2?JSON[_0xcff5('0x16')](_0x4b34a2):_0xcff5('0x17'));}function updateUser(_0x5041c1,_0x5d2798,_0x30c2e8,_0x348a34,_0x1e1954){db[_[_0xcff5('0xc')](_0x348a34)+'Interaction'][_0xcff5('0x18')]({'where':{'id':getInteractionId(_0x5d2798,_0x30c2e8,_0x348a34)}})[_0xcff5('0x19')](function(_0x53365b){if(_0x53365b){return _0x53365b['update']({'UserId':_0x5041c1?_0x5041c1['id']:null});}})[_0xcff5('0x19')](function(_0x52ccd1){if(_0x52ccd1){log(_0xcff5('0x1a'),_0x5041c1,_0x5d2798,_0x30c2e8,_0x348a34,_0x1e1954);}})['catch'](function(){log(_0xcff5('0x1b'),_0x5041c1,_0x5d2798,_0x30c2e8,_0x348a34,_0x1e1954);});}module[_0xcff5('0x1c')]={'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 bdf74ed..48139b2 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 _0x86bc=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','composable-middleware','../../mysqldb','data1','license','split','format','update','base64','utf8','final','parse','use','License','findOne','then','count'];(function(_0x1114e0,_0x237b02){var _0xc5b786=function(_0x1252ba){while(--_0x1252ba){_0x1114e0['push'](_0x1114e0['shift']());}};_0xc5b786(++_0x237b02);}(_0x86bc,0x19f));var _0xc86b=function(_0x42fed7,_0x536879){_0x42fed7=_0x42fed7-0x0;var _0x507960=_0x86bc[_0x42fed7];return _0x507960;};'use strict';var crypto=require(_0xc86b('0x0'));var util=require('util');var compose=require(_0xc86b('0x1'));var db=require(_0xc86b('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xa6ebd0,_0x105ca3){if(_0xa6ebd0&&_0x105ca3){if(_0x105ca3[_0xc86b('0x3')]&&_0x105ca3[_0xc86b('0x4')]){var _0x2ed332=_0x105ca3[_0xc86b('0x3')];var _0x2548cb=_0x105ca3['license'];var _0x4877ca=_0x2ed332[_0xc86b('0x5')]('-')[0x4];var _0x4b3c7a=_0x2ed332[_0xc86b('0x5')]('-')[0x0];var _0x363552=crypto['createDecipher']('aes-256-ctr',util[_0xc86b('0x6')]('%s:%s:%s',_0x4877ca,_0x2ed332,_0x4b3c7a));var _0x18e687=_0x363552[_0xc86b('0x7')](_0x2548cb,_0xc86b('0x8'),_0xc86b('0x9'));_0x18e687+=_0x363552[_0xc86b('0xa')]('utf8');var _0x52dd27=JSON[_0xc86b('0xb')](_0x18e687);return _0x52dd27['hasOwnProperty'](_0xa6ebd0)?_0x52dd27[_0xa6ebd0]:null;}}return null;}function isLimit(_0x546001,_0x1076c9,_0x3ec1fd,_0x17993e){var _0x3988b7=_0x1076c9;return compose()[_0xc86b('0xc')](function(_0x1ebb2a,_0x32e063,_0x42dd28){return db[_0xc86b('0xd')][_0xc86b('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x990557){var _0x535e1f=getValueFromLicense(_0x546001,_0x990557);return _0x535e1f?_0x535e1f:_0x3988b7;})[_0xc86b('0xf')](function(_0x490682){_0x3988b7=_0x490682;return _0x3ec1fd[_0xc86b('0x10')](_0x17993e);})[_0xc86b('0xf')](function(_0x36ba44){if(_0x36ba44>=_0x3988b7){return _0x32e063[_0xc86b('0x11')](0x193)[_0xc86b('0x12')]({'message':util[_0xc86b('0x6')](_0xc86b('0x13'),_0x546001)});}_0x42dd28();})['catch'](function(_0x242859){_0x42dd28(_0x242859);});});}function isUserLimit(){return isLimit(_0xc86b('0x14'),0x1,db[_0xc86b('0x15')],{'where':{'$or':[{'role':_0xc86b('0x16')},{'role':'user'}]}});}exports[_0xc86b('0x17')]=isUserLimit; \ No newline at end of file +var _0x52e1=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64','final','parse','hasOwnProperty','then','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','util'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x52e1,0x107));var _0x152e=function(_0xf44608,_0x4d8e55){_0xf44608=_0xf44608-0x0;var _0x129f91=_0x52e1[_0xf44608];return _0x129f91;};'use strict';var crypto=require('crypto');var util=require(_0x152e('0x0'));var compose=require(_0x152e('0x1'));var db=require(_0x152e('0x2'))['db'];var config=require(_0x152e('0x3'));function getValueFromLicense(_0x2a8648,_0x2ecfc2){if(_0x2a8648&&_0x2ecfc2){if(_0x2ecfc2[_0x152e('0x4')]&&_0x2ecfc2[_0x152e('0x5')]){var _0x1e3297=_0x2ecfc2[_0x152e('0x4')];var _0xef09b0=_0x2ecfc2[_0x152e('0x5')];var _0x27b39b=_0x1e3297[_0x152e('0x6')]('-')[0x4];var _0x33f1d8=_0x1e3297[_0x152e('0x6')]('-')[0x0];var _0x19dc20=crypto[_0x152e('0x7')]('aes-256-ctr',util['format'](_0x152e('0x8'),_0x27b39b,_0x1e3297,_0x33f1d8));var _0x47ab78=_0x19dc20[_0x152e('0x9')](_0xef09b0,_0x152e('0xa'),'utf8');_0x47ab78+=_0x19dc20[_0x152e('0xb')]('utf8');var _0xf0201b=JSON[_0x152e('0xc')](_0x47ab78);return _0xf0201b[_0x152e('0xd')](_0x2a8648)?_0xf0201b[_0x2a8648]:null;}}return null;}function isLimit(_0x302de3,_0x2017dc,_0x35efc1,_0x3b5029){var _0x18e662=_0x2017dc;return compose()['use'](function(_0x872543,_0x17e928,_0x4d8fdc){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x416fe9){var _0x312120=getValueFromLicense(_0x302de3,_0x416fe9);return _0x312120?_0x312120:_0x18e662;})['then'](function(_0x475ef9){_0x18e662=_0x475ef9;return _0x35efc1['count'](_0x3b5029);})[_0x152e('0xe')](function(_0x43eecd){if(_0x43eecd>=_0x18e662){return _0x17e928[_0x152e('0xf')](0x193)['json']({'message':util[_0x152e('0x10')](_0x152e('0x11'),_0x302de3)});}_0x4d8fdc();})['catch'](function(_0x5412cb){_0x4d8fdc(_0x5412cb);});});}function isUserLimit(){return isLimit(_0x152e('0x12'),0x1,db['User'],{'where':{'$or':[{'role':_0x152e('0x13')},{'role':_0x152e('0x14')}]}});}exports[_0x152e('0x15')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 268fafb..942d25b 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 _0x4b88=['field','\x20AS\x20','$ne','$notIn','$in','IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','[$and]','split','length','forEach','shift','map','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST('];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x4b88,0xb6));var _0x84b8=function(_0x5133c6,_0x8f3d2){_0x5133c6=_0x5133c6-0x0;var _0x1e2557=_0x4b88[_0x5133c6];return _0x1e2557;};'use strict';var _=require(_0x84b8('0x0'));var moment=require(_0x84b8('0x1'));exports['parseSearch']=function(_0x290017){var _0x466194={'conditions':[]};_0x466194['sqlOperator']=_[_0x84b8('0x2')](_0x290017,_0x84b8('0x3'))?'or':_0x84b8('0x4');var _0x1ed82d=_0x290017['replace'](_0x84b8('0x5'),'')['replace'](_0x84b8('0x3'),'')[_0x84b8('0x6')]('||');for(var _0x562852=0x0;_0x562852<_0x1ed82d[_0x84b8('0x7')];_0x562852++){var _0x3cbc09=_0x1ed82d[_0x562852][_0x84b8('0x6')](':=');var _0x94593b=_0x3cbc09[0x0];var _0x120e74=_0x3cbc09['slice'](0x1);_0x120e74[_0x84b8('0x8')](function(_0x2296b6){var _0x161ffc=_0x2296b6['split']('[')[_0x84b8('0x9')]();var _0x2c0b08=_0x2296b6['match'](/\[(.*?)\]/g);_0x2c0b08['forEach'](function(_0x170981){var _0x52a65f=_0x170981[_0x84b8('0x6')]('[')['filter'](function(_0x5656e6){return _0x5656e6['indexOf'](']')>-0x1;})[_0x84b8('0xa')](function(_0x240c2b){return _0x240c2b[_0x84b8('0x6')](']')[0x0];})[0x0];_0x466194['conditions'][_0x84b8('0xb')]({'field':_0x94593b,'operator':_0x161ffc,'value':_0x52a65f});});});}return _0x466194;};exports[_0x84b8('0xc')]=function(_0x5db58f,_0x5eac42,_0x548f8b){var _0x11f40a={};if(_0x5eac42===_0x84b8('0xd')){if(_0x548f8b[_0x84b8('0xe')]===_0x84b8('0xf')){_0x548f8b[_0x84b8('0xe')]='$between';_0x548f8b[_0x84b8('0x10')]+=','+_0x548f8b[_0x84b8('0x10')];}else if(_[_0x84b8('0x11')]([_0x84b8('0x12'),_0x84b8('0x13')],_0x548f8b[_0x84b8('0xe')])){_0x548f8b[_0x84b8('0x10')]=moment(_0x548f8b[_0x84b8('0x10')])['add'](0x1,_0x84b8('0x14'))[_0x84b8('0x15')](_0x84b8('0x16'));}}if(_0x548f8b['castTo']){_0x5eac42=_0x548f8b[_0x84b8('0x17')];_0x11f40a[_0x84b8('0x18')]=_0x84b8('0x19')+_0x5db58f+'.'+_0x548f8b[_0x84b8('0x1a')]+_0x84b8('0x1b')+_0x548f8b[_0x84b8('0x17')]+')\x20'+parseOperator(_0x548f8b[_0x84b8('0xe')]);}else{_0x11f40a[_0x84b8('0x18')]=_0x5db58f+'.'+_0x548f8b[_0x84b8('0x1a')]+'\x20'+parseOperator(_0x548f8b[_0x84b8('0xe')]);}if(_['includes']([_0x84b8('0x1c'),_0x84b8('0x1d')],_0x548f8b[_0x84b8('0xe')]))_0x11f40a[_0x84b8('0x18')]='('+_0x11f40a['text']+'\x20OR\x20'+_0x5db58f+'.'+_0x548f8b[_0x84b8('0x1a')]+'\x20IS\x20NULL)';_0x11f40a[_0x84b8('0x10')]=parseValue(_0x5eac42,_0x548f8b['operator'],_0x548f8b['value']);return _0x11f40a;};function parseOperator(_0x5ecc97){var _0x21027a;switch(_0x5ecc97){case _0x84b8('0x1e'):_0x21027a=_0x84b8('0x1f');break;case _0x84b8('0x1d'):_0x21027a='NOT\x20IN\x20?';break;case _0x84b8('0xf'):_0x21027a=_0x84b8('0x20');break;case _0x84b8('0x1c'):_0x21027a=_0x84b8('0x21');break;case'$substring':case _0x84b8('0x22'):case _0x84b8('0x23'):_0x21027a=_0x84b8('0x24');break;case _0x84b8('0x25'):_0x21027a=_0x84b8('0x26');break;case _0x84b8('0x12'):_0x21027a='>\x20?';break;case _0x84b8('0x13'):_0x21027a=_0x84b8('0x27');break;case _0x84b8('0x28'):_0x21027a=_0x84b8('0x29');break;case _0x84b8('0x2a'):_0x21027a=_0x84b8('0x2b');break;}return _0x21027a;}function parseValue(_0x4e3a13,_0x17c894,_0xaea8a2){var _0x209a8d={'start':undefined,'end':undefined};switch(_0x17c894){case _0x84b8('0x1e'):case _0x84b8('0x1d'):_0x209a8d[_0x84b8('0x2c')]=_0xaea8a2[_0x84b8('0x6')](',');break;case _0x84b8('0x2d'):_0x209a8d[_0x84b8('0x2c')]='%'+_0xaea8a2+'%';break;case _0x84b8('0x22'):_0x209a8d[_0x84b8('0x2c')]=_0xaea8a2+'%';break;case _0x84b8('0x23'):_0x209a8d[_0x84b8('0x2c')]='%'+_0xaea8a2;break;case _0x84b8('0x2a'):var _0x3d531f=_0xaea8a2[_0x84b8('0x6')](',');var _0xaea8a2=_0x3d531f['shift']();var _0x537755=_0x3d531f[_0x84b8('0x2e')]();if(_0x4e3a13===_0x84b8('0xd')){_0xaea8a2=moment(_0xaea8a2)[_0x84b8('0x2f')](0x0,!![])[_0x84b8('0x15')]();_0x537755=moment(_0x537755)[_0x84b8('0x2f')](0x0,!![])[_0x84b8('0x30')](0x17,_0x84b8('0x31'))[_0x84b8('0x30')](0x3b,_0x84b8('0x32'))['add'](0x3b,_0x84b8('0x33'))[_0x84b8('0x15')]();}_0x209a8d={'start':_0xaea8a2,'end':_0x537755};break;default:_0x209a8d[_0x84b8('0x2c')]=_0xaea8a2;break;}return _0x209a8d;} \ No newline at end of file +var _0xcecb=['hours','minutes','moment','parseSearch','and','replace','[$and]','split','length','forEach','shift','match','filter','indexOf','map','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','$ne','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$substring','$endsWith','utcOffset'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xcecb,0x1d6));var _0xbcec=function(_0x542c1e,_0x3d45dd){_0x542c1e=_0x542c1e-0x0;var _0x517620=_0xcecb[_0x542c1e];return _0x517620;};'use strict';var _=require('lodash');var moment=require(_0xbcec('0x0'));exports[_0xbcec('0x1')]=function(_0x444813){var _0x300ba2={'conditions':[]};_0x300ba2['sqlOperator']=_['startsWith'](_0x444813,'[$or]')?'or':_0xbcec('0x2');var _0x4008cd=_0x444813[_0xbcec('0x3')](_0xbcec('0x4'),'')[_0xbcec('0x3')]('[$or]','')[_0xbcec('0x5')]('||');for(var _0x1d3a1f=0x0;_0x1d3a1f<_0x4008cd[_0xbcec('0x6')];_0x1d3a1f++){var _0x91dc04=_0x4008cd[_0x1d3a1f][_0xbcec('0x5')](':=');var _0x3966cc=_0x91dc04[0x0];var _0x5bdd20=_0x91dc04['slice'](0x1);_0x5bdd20[_0xbcec('0x7')](function(_0x59eac0){var _0x2ef992=_0x59eac0['split']('[')[_0xbcec('0x8')]();var _0x3c2605=_0x59eac0[_0xbcec('0x9')](/\[(.*?)\]/g);_0x3c2605['forEach'](function(_0x56889e){var _0x126a6a=_0x56889e[_0xbcec('0x5')]('[')[_0xbcec('0xa')](function(_0x296f7d){return _0x296f7d[_0xbcec('0xb')](']')>-0x1;})[_0xbcec('0xc')](function(_0x5a8a6d){return _0x5a8a6d[_0xbcec('0x5')](']')[0x0];})[0x0];_0x300ba2['conditions']['push']({'field':_0x3966cc,'operator':_0x2ef992,'value':_0x126a6a});});});}return _0x300ba2;};exports[_0xbcec('0xd')]=function(_0x59980f,_0x2344f5,_0x5caf32){var _0xdb998={};if(_0x2344f5===_0xbcec('0xe')){if(_0x5caf32[_0xbcec('0xf')]==='$eq'){_0x5caf32[_0xbcec('0xf')]=_0xbcec('0x10');_0x5caf32[_0xbcec('0x11')]+=','+_0x5caf32[_0xbcec('0x11')];}else if(_[_0xbcec('0x12')]([_0xbcec('0x13'),_0xbcec('0x14')],_0x5caf32[_0xbcec('0xf')])){_0x5caf32[_0xbcec('0x11')]=moment(_0x5caf32[_0xbcec('0x11')])[_0xbcec('0x15')](0x1,_0xbcec('0x16'))[_0xbcec('0x17')](_0xbcec('0x18'));}}if(_0x5caf32[_0xbcec('0x19')]){_0x2344f5=_0x5caf32[_0xbcec('0x19')];_0xdb998[_0xbcec('0x1a')]=_0xbcec('0x1b')+_0x59980f+'.'+_0x5caf32[_0xbcec('0x1c')]+_0xbcec('0x1d')+_0x5caf32[_0xbcec('0x19')]+')\x20'+parseOperator(_0x5caf32[_0xbcec('0xf')]);}else{_0xdb998[_0xbcec('0x1a')]=_0x59980f+'.'+_0x5caf32[_0xbcec('0x1c')]+'\x20'+parseOperator(_0x5caf32[_0xbcec('0xf')]);}if(_[_0xbcec('0x12')](['$ne',_0xbcec('0x1e')],_0x5caf32[_0xbcec('0xf')]))_0xdb998[_0xbcec('0x1a')]='('+_0xdb998[_0xbcec('0x1a')]+'\x20OR\x20'+_0x59980f+'.'+_0x5caf32['field']+_0xbcec('0x1f');_0xdb998['value']=parseValue(_0x2344f5,_0x5caf32[_0xbcec('0xf')],_0x5caf32[_0xbcec('0x11')]);return _0xdb998;};function parseOperator(_0x43d57e){var _0x5573c0;switch(_0x43d57e){case _0xbcec('0x20'):_0x5573c0=_0xbcec('0x21');break;case'$notIn':_0x5573c0=_0xbcec('0x22');break;case _0xbcec('0x23'):_0x5573c0='=\x20?';break;case _0xbcec('0x24'):_0x5573c0=_0xbcec('0x25');break;case'$substring':case _0xbcec('0x26'):case'$endsWith':_0x5573c0=_0xbcec('0x27');break;case _0xbcec('0x28'):_0x5573c0=_0xbcec('0x29');break;case'$gt':_0x5573c0=_0xbcec('0x2a');break;case'$lte':_0x5573c0=_0xbcec('0x2b');break;case _0xbcec('0x2c'):_0x5573c0=_0xbcec('0x2d');break;case _0xbcec('0x10'):_0x5573c0='BETWEEN\x20?\x20AND\x20?';break;}return _0x5573c0;}function parseValue(_0x582640,_0xa0d645,_0x563fea){var _0x5c64e9={'start':undefined,'end':undefined};switch(_0xa0d645){case _0xbcec('0x20'):case _0xbcec('0x1e'):_0x5c64e9[_0xbcec('0x2e')]=_0x563fea['split'](',');break;case _0xbcec('0x2f'):_0x5c64e9[_0xbcec('0x2e')]='%'+_0x563fea+'%';break;case _0xbcec('0x26'):_0x5c64e9['start']=_0x563fea+'%';break;case _0xbcec('0x30'):_0x5c64e9[_0xbcec('0x2e')]='%'+_0x563fea;break;case _0xbcec('0x10'):var _0x67eb6f=_0x563fea[_0xbcec('0x5')](',');var _0x563fea=_0x67eb6f[_0xbcec('0x8')]();var _0x4912be=_0x67eb6f['pop']();if(_0x582640===_0xbcec('0xe')){_0x563fea=moment(_0x563fea)[_0xbcec('0x31')](0x0,!![])[_0xbcec('0x17')]();_0x4912be=moment(_0x4912be)[_0xbcec('0x31')](0x0,!![])[_0xbcec('0x15')](0x17,_0xbcec('0x32'))['add'](0x3b,_0xbcec('0x33'))['add'](0x3b,'seconds')['format']();}_0x5c64e9={'start':_0x563fea,'end':_0x4912be};break;default:_0x5c64e9['start']=_0x563fea;break;}return _0x5c64e9;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 12020e2..416441d 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 _0x0ef5=['limit','offset','sort','map','priority','cast','col','DESC','unsigned','ASC','isObject','isString','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','push','replace','join','getOptions','query','$id','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filter','object','value','merge','VIRTUAL','lower','options','lodash','sequelize','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray'];(function(_0x2f7849,_0x24e39a){var _0xcd4066=function(_0x5cd350){while(--_0x5cd350){_0x2f7849['push'](_0x2f7849['shift']());}};_0xcd4066(++_0x24e39a);}(_0x0ef5,0x116));var _0x50ef=function(_0x48271f,_0xc4f6d3){_0x48271f=_0x48271f-0x0;var _0x13eb5c=_0x0ef5[_0x48271f];return _0x13eb5c;};'use strict';var _=require(_0x50ef('0x0'));var sequelize=require(_0x50ef('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x397877){var _0xc0d2c8=['ne'];try{var _0x12a23a=JSON[_0x50ef('0x2')](_0x397877);var _0x358c0d=Object[_0x50ef('0x3')](_0x12a23a)[0x0];return _0xc0d2c8[_0x50ef('0x4')](_0x358c0d);}catch(_0x1be8f){return![];}}function getOperatorValue(_0x4c5656){var _0x1bb87e=JSON[_0x50ef('0x2')](_0x4c5656);var _0x2f3f3e=Object['keys'](_0x1bb87e)[0x0];var _0x2401ba=_0x1bb87e[_0x2f3f3e];return{['$'+_0x2f3f3e]:_0x2401ba};}exports['fields']=function(_0x8580cd){var _0x31f670=null;if(_0x8580cd){_0x31f670=_0x8580cd[_0x50ef('0x5')](',');}return _0x31f670;};exports[_0x50ef('0x6')]=function(_0x3b67dd,_0x3d74fb){var _0x3fd600={};if(!_[_0x50ef('0x7')](_0x3b67dd)){_[_0x50ef('0x8')](_0x3b67dd,function(_0x59c1c0,_0x2166a0){try{if(_0x3d74fb){var _0x56e967=_[_0x50ef('0x9')](_0x3d74fb,{'name':_0x2166a0})||{};if(hasSequelizeOperator(_0x59c1c0)){_0x3fd600[_0x2166a0]=getOperatorValue(_0x59c1c0);}else if(_0x56e967[_0x50ef('0xa')]===_0x50ef('0xb')&&_[_0x50ef('0xc')](_0x59c1c0)){var _0x1df658=JSON['parse'](_0x59c1c0);var _0x4f2ab0={'$gte':moment(moment(_0x1df658[_0x50ef('0xd')])['format'](_0x50ef('0xe')))[_0x50ef('0xf')]()[_0x50ef('0x10')](),'$lte':moment(moment(_0x1df658[_0x50ef('0x11')])[_0x50ef('0x10')](_0x50ef('0xe')))[_0x50ef('0xf')]()[_0x50ef('0x12')](0x1,'s')[_0x50ef('0x10')]()};_0x3fd600[_0x2166a0]=_0x4f2ab0;}else if(_0x56e967[_0x50ef('0x13')]===_0x50ef('0x14')){_0x3fd600[_0x2166a0]=_0x59c1c0;}else{_0x3fd600[_0x2166a0]=_[_0x50ef('0x15')](_0x59c1c0)?_0x59c1c0:JSON['parse'](_0x59c1c0);}}else{_0x3fd600[_0x2166a0]=_['isArray'](_0x59c1c0)?_0x59c1c0:JSON[_0x50ef('0x2')](_0x59c1c0);}}catch(_0x3d1fed){_0x3fd600[_0x2166a0]=_0x59c1c0[_0x50ef('0x5')](',');}});}return _0x3fd600;};exports[_0x50ef('0x16')]=function(_0x56fc52){_0x56fc52=parseInt(_0x56fc52,0xa);if(!_0x56fc52||_0x56fc52<0x0){_0x56fc52=LIMIT_VALUE;}return _0x56fc52;};exports[_0x50ef('0x17')]=function(_0x531664){_0x531664=parseInt(_0x531664,0xa);if(!_0x531664||_0x531664<0x0){_0x531664=0x0;}return _0x531664;};exports[_0x50ef('0x18')]=function(_0x3101f9){var _0x57f92e,_0x162b29=null;if(_0x3101f9){_0x57f92e=_0x3101f9[_0x50ef('0x5')](',');_0x162b29=_[_0x50ef('0x19')](_0x57f92e,function(_0x441c6e){if(_0x441c6e['indexOf']('-')===0x0){return[_0x441c6e===_0x50ef('0x1a')?sequelize[_0x50ef('0x1b')](sequelize[_0x50ef('0x1c')](_0x50ef('0x1a')),'unsigned'):_0x441c6e['substr'](0x1),_0x50ef('0x1d')];}else{return[_0x441c6e==='priority'?sequelize[_0x50ef('0x1b')](sequelize[_0x50ef('0x1c')]('priority'),_0x50ef('0x1e')):_0x441c6e,_0x50ef('0x1f')];}});}return _0x162b29;};exports['omit']=function(_0x1e3a32,_0x2ba515){if(_[_0x50ef('0x7')](_0x1e3a32)){return _0x1e3a32;}if(_[_0x50ef('0x15')](_0x1e3a32)){for(var _0x5e14a9=0x0;_0x5e14a9<_0x1e3a32['length'];_0x5e14a9+=0x1){_0x1e3a32[_0x5e14a9]=this['omit'](_0x1e3a32[_0x5e14a9],_0x2ba515);}return _0x1e3a32;}if(!_[_0x50ef('0x20')](_0x1e3a32)){return _0x1e3a32;}if(_[_0x50ef('0x21')](_0x2ba515)){_0x2ba515=[_0x2ba515];}if(!_['isArray'](_0x2ba515)){return _0x1e3a32;}for(var _0x3dd37a=0x0;_0x3dd37a<_0x2ba515['length'];_0x3dd37a+=0x1){_['unset'](_0x1e3a32,_0x2ba515[_0x3dd37a]);}for(var _0xd113ca in _0x1e3a32){if(_0x1e3a32['hasOwnProperty'](_0xd113ca)){_0x1e3a32[_0xd113ca]=this['omit'](_0x1e3a32[_0xd113ca],_0x2ba515);}}return _0x1e3a32;};exports[_0x50ef('0x22')]=function(_0x29374d){return _0x29374d[_0x50ef('0x23')](RegExp(_0x50ef('0x24')))?!![]:![];};exports['isEmail']=function(_0x58e1ba){return _0x58e1ba['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x15e4f2,_0x20a839){var _0x17e310=[];var _0xf78aee=/[ `!@#$%^&*()_\-?~]/;var _0x1cdc6a=_0x20a839?_0x50ef('0x25'):_0x50ef('0x26');_0x15e4f2[_0x50ef('0x5')](/[ ,]+/)['forEach'](function(_0x24fbdf){_0x24fbdf=_0x24fbdf['replace'](/([^:]")"+/g,'$1');_0x24fbdf='+'+_0x24fbdf+'*';var _0x241742=_0x24fbdf[_0x50ef('0x23')](_0xf78aee);if(_0x241742){_0x24fbdf='\x22'+_0x24fbdf+'\x22';}_0x17e310[_0x50ef('0x27')](_0x24fbdf);});_0x1cdc6a=_0x1cdc6a[_0x50ef('0x28')](_0x50ef('0x26'),_0x17e310[_0x50ef('0x29')]('\x20'));return _0x1cdc6a;};exports[_0x50ef('0x2a')]=function(_0xe33549,_0x1d613c,_0x48a585){var _0x2d956b={},_0x82b0c7={};if(_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x2c')]){_0x1d613c[_0x50ef('0x2b')]['id']=_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x2c')];delete _0x1d613c[_0x50ef('0x2b')]['$id'];}_0x2d956b['model']=_[_0x50ef('0x19')](_0xe33549,_0x50ef('0x13'));_0x2d956b[_0x50ef('0x2b')]=_[_0x50ef('0x3')](_0x1d613c[_0x50ef('0x2b')]);_0x2d956b['filters']=_[_0x50ef('0x2d')](_0x2d956b[_0x50ef('0x2e')],_0x2d956b[_0x50ef('0x2b')]);_0x82b0c7[_0x50ef('0x2f')]=_[_0x50ef('0x2d')](_0x2d956b[_0x50ef('0x2e')],this[_0x50ef('0x30')](_0x1d613c[_0x50ef('0x2b')]['fields']));_0x82b0c7['attributes']=_0x82b0c7[_0x50ef('0x2f')][_0x50ef('0x31')]?_0x82b0c7[_0x50ef('0x2f')]:_0x2d956b['model'];if(!_0x1d613c['query'][_0x50ef('0x32')](_0x50ef('0x33'))){_0x82b0c7['limit']=this[_0x50ef('0x16')](_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x16')]);_0x82b0c7[_0x50ef('0x17')]=this['offset'](_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x17')]);}_0x82b0c7['order']=this[_0x50ef('0x18')](_0x1d613c['query']['sort']);_0x82b0c7[_0x50ef('0x34')]=this[_0x50ef('0x6')](_['pick'](_0x1d613c[_0x50ef('0x2b')],_0x2d956b[_0x50ef('0x6')]),_0xe33549);if(_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')]){var _0x1f251d=_0xe33549;var _0x2e722d=_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')];if(typeof _0x2e722d===_0x50ef('0x36')){_0x1f251d=_[_0x50ef('0x35')](_0xe33549,function(_0x2411cf){return _['includes'](_0x2e722d['columns'],_0x2411cf[_0x50ef('0x13')]);});_0x2e722d=_0x2e722d[_0x50ef('0x37')];}_0x82b0c7[_0x50ef('0x34')]=_[_0x50ef('0x38')](_0x82b0c7[_0x50ef('0x34')],{'$or':_[_0x50ef('0x19')](_0x1f251d,function(_0x391b2e){if(_0x391b2e[_0x50ef('0xa')]!==_0x50ef('0x39')){if(_0x48a585){return sequelize[_0x50ef('0x34')](sequelize['fn']('lower',sequelize['col'](_0x391b2e[_0x50ef('0x13')])),{'$like':sequelize['fn'](_0x50ef('0x3a'),'%'+_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')]+'%')});}else{var _0x42c4ea={};_0x42c4ea[_0x391b2e[_0x50ef('0x13')]]={'$like':'%'+_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')]+'%'};return _0x42c4ea;}}})});}_0x82b0c7=_[_0x50ef('0x38')]({},_0x82b0c7,_0x1d613c[_0x50ef('0x3b')]);return _0x82b0c7;}; \ No newline at end of file +var _0xe87f=['$id','model','intersection','attributes','nolimit','order','filter','object','columns','where','VIRTUAL','lower','merge','options','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','format','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','priority','unsigned','DESC','cast','col','ASC','omit','isObject','isString','length','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','query'];(function(_0x19d751,_0x21938e){var _0x337c88=function(_0x3adff2){while(--_0x3adff2){_0x19d751['push'](_0x19d751['shift']());}};_0x337c88(++_0x21938e);}(_0xe87f,0x1c0));var _0xfe87=function(_0x53e07c,_0x3edd0a){_0x53e07c=_0x53e07c-0x0;var _0x360280=_0xe87f[_0x53e07c];return _0x360280;};'use strict';var _=require('lodash');var sequelize=require(_0xfe87('0x0'));var moment=require(_0xfe87('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x39f3bc){var _0xb83f78=['ne'];try{var _0x3327ed=JSON['parse'](_0x39f3bc);var _0x36d399=Object[_0xfe87('0x2')](_0x3327ed)[0x0];return _0xb83f78[_0xfe87('0x3')](_0x36d399);}catch(_0x57e4f4){return![];}}function getOperatorValue(_0x9b1633){var _0x509b11=JSON[_0xfe87('0x4')](_0x9b1633);var _0x2f04ac=Object[_0xfe87('0x2')](_0x509b11)[0x0];var _0x39db00=_0x509b11[_0x2f04ac];return{['$'+_0x2f04ac]:_0x39db00};}exports[_0xfe87('0x5')]=function(_0xafabec){var _0x1cd59e=null;if(_0xafabec){_0x1cd59e=_0xafabec[_0xfe87('0x6')](',');}return _0x1cd59e;};exports[_0xfe87('0x7')]=function(_0x175800,_0x50cecf){var _0x298795={};if(!_[_0xfe87('0x8')](_0x175800)){_['forOwn'](_0x175800,function(_0x2d1008,_0x2eec00){try{if(_0x50cecf){var _0x21f463=_[_0xfe87('0x9')](_0x50cecf,{'name':_0x2eec00})||{};if(hasSequelizeOperator(_0x2d1008)){_0x298795[_0x2eec00]=getOperatorValue(_0x2d1008);}else if(_0x21f463[_0xfe87('0xa')]===_0xfe87('0xb')&&_[_0xfe87('0xc')](_0x2d1008)){var _0xffd782=JSON['parse'](_0x2d1008);var _0x344b90={'$gte':moment(moment(_0xffd782[_0xfe87('0xd')])['format'](_0xfe87('0xe')))['utc']()[_0xfe87('0xf')](),'$lte':moment(moment(_0xffd782[_0xfe87('0x10')])[_0xfe87('0xf')](_0xfe87('0xe')))['utc']()[_0xfe87('0x11')](0x1,'s')[_0xfe87('0xf')]()};_0x298795[_0x2eec00]=_0x344b90;}else if(_0x21f463[_0xfe87('0x12')]===_0xfe87('0x13')){_0x298795[_0x2eec00]=_0x2d1008;}else{_0x298795[_0x2eec00]=_[_0xfe87('0x14')](_0x2d1008)?_0x2d1008:JSON[_0xfe87('0x4')](_0x2d1008);}}else{_0x298795[_0x2eec00]=_[_0xfe87('0x14')](_0x2d1008)?_0x2d1008:JSON[_0xfe87('0x4')](_0x2d1008);}}catch(_0x460c32){_0x298795[_0x2eec00]=_0x2d1008[_0xfe87('0x6')](',');}});}return _0x298795;};exports[_0xfe87('0x15')]=function(_0x211ebd){_0x211ebd=parseInt(_0x211ebd,0xa);if(!_0x211ebd||_0x211ebd<0x0){_0x211ebd=LIMIT_VALUE;}return _0x211ebd;};exports[_0xfe87('0x16')]=function(_0x531706){_0x531706=parseInt(_0x531706,0xa);if(!_0x531706||_0x531706<0x0){_0x531706=0x0;}return _0x531706;};exports[_0xfe87('0x17')]=function(_0x26f145){var _0x1f12d7,_0x15fb6a=null;if(_0x26f145){_0x1f12d7=_0x26f145['split'](',');_0x15fb6a=_[_0xfe87('0x18')](_0x1f12d7,function(_0x470015){if(_0x470015['indexOf']('-')===0x0){return[_0x470015===_0xfe87('0x19')?sequelize['cast'](sequelize['col'](_0xfe87('0x19')),_0xfe87('0x1a')):_0x470015['substr'](0x1),_0xfe87('0x1b')];}else{return[_0x470015===_0xfe87('0x19')?sequelize[_0xfe87('0x1c')](sequelize[_0xfe87('0x1d')](_0xfe87('0x19')),_0xfe87('0x1a')):_0x470015,_0xfe87('0x1e')];}});}return _0x15fb6a;};exports[_0xfe87('0x1f')]=function(_0x3ad630,_0x25131e){if(_[_0xfe87('0x8')](_0x3ad630)){return _0x3ad630;}if(_[_0xfe87('0x14')](_0x3ad630)){for(var _0x4eef2d=0x0;_0x4eef2d<_0x3ad630['length'];_0x4eef2d+=0x1){_0x3ad630[_0x4eef2d]=this[_0xfe87('0x1f')](_0x3ad630[_0x4eef2d],_0x25131e);}return _0x3ad630;}if(!_[_0xfe87('0x20')](_0x3ad630)){return _0x3ad630;}if(_[_0xfe87('0x21')](_0x25131e)){_0x25131e=[_0x25131e];}if(!_[_0xfe87('0x14')](_0x25131e)){return _0x3ad630;}for(var _0x3477de=0x0;_0x3477de<_0x25131e[_0xfe87('0x22')];_0x3477de+=0x1){_['unset'](_0x3ad630,_0x25131e[_0x3477de]);}for(var _0x4846a0 in _0x3ad630){if(_0x3ad630[_0xfe87('0x23')](_0x4846a0)){_0x3ad630[_0x4846a0]=this[_0xfe87('0x1f')](_0x3ad630[_0x4846a0],_0x25131e);}}return _0x3ad630;};exports[_0xfe87('0x24')]=function(_0x2d1a40){return _0x2d1a40[_0xfe87('0x25')](RegExp(_0xfe87('0x26')))?!![]:![];};exports[_0xfe87('0x27')]=function(_0x5f0c38){return _0x5f0c38[_0xfe87('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xfe87('0x28')]=function(_0x3c3e32,_0x9a5bad){var _0x1adfb1=[];var _0x1f95eb=/[ `!@#$%^&*()_\-?~]/;var _0xb25f4=_0x9a5bad?_0xfe87('0x29'):_0xfe87('0x2a');_0x3c3e32['split'](/[ ,]+/)[_0xfe87('0x2b')](function(_0x150bc3){_0x150bc3=_0x150bc3[_0xfe87('0x2c')](/([^:]")"+/g,'$1');_0x150bc3='+'+_0x150bc3+'*';var _0x189fdf=_0x150bc3[_0xfe87('0x25')](_0x1f95eb);if(_0x189fdf){_0x150bc3='\x22'+_0x150bc3+'\x22';}_0x1adfb1['push'](_0x150bc3);});_0xb25f4=_0xb25f4[_0xfe87('0x2c')]('{EXPR}',_0x1adfb1[_0xfe87('0x2d')]('\x20'));return _0xb25f4;};exports[_0xfe87('0x2e')]=function(_0x2b338f,_0x2ffc05,_0x56564d){var _0x38ea93={},_0x3f3ae8={};if(_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x30')]){_0x2ffc05[_0xfe87('0x2f')]['id']=_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x30')];delete _0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x30')];}_0x38ea93[_0xfe87('0x31')]=_[_0xfe87('0x18')](_0x2b338f,'name');_0x38ea93[_0xfe87('0x2f')]=_[_0xfe87('0x2')](_0x2ffc05[_0xfe87('0x2f')]);_0x38ea93[_0xfe87('0x7')]=_[_0xfe87('0x32')](_0x38ea93[_0xfe87('0x31')],_0x38ea93[_0xfe87('0x2f')]);_0x3f3ae8[_0xfe87('0x33')]=_['intersection'](_0x38ea93[_0xfe87('0x31')],this[_0xfe87('0x5')](_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x5')]));_0x3f3ae8[_0xfe87('0x33')]=_0x3f3ae8['attributes'][_0xfe87('0x22')]?_0x3f3ae8['attributes']:_0x38ea93[_0xfe87('0x31')];if(!_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x23')](_0xfe87('0x34'))){_0x3f3ae8[_0xfe87('0x15')]=this['limit'](_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x15')]);_0x3f3ae8['offset']=this[_0xfe87('0x16')](_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x16')]);}_0x3f3ae8[_0xfe87('0x35')]=this[_0xfe87('0x17')](_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x17')]);_0x3f3ae8['where']=this[_0xfe87('0x7')](_['pick'](_0x2ffc05[_0xfe87('0x2f')],_0x38ea93[_0xfe87('0x7')]),_0x2b338f);if(_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x36')]){var _0x2d521b=_0x2b338f;var _0x152cfd=_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x36')];if(typeof _0x152cfd===_0xfe87('0x37')){_0x2d521b=_[_0xfe87('0x36')](_0x2b338f,function(_0x5c57ce){return _['includes'](_0x152cfd[_0xfe87('0x38')],_0x5c57ce[_0xfe87('0x12')]);});_0x152cfd=_0x152cfd['value'];}_0x3f3ae8[_0xfe87('0x39')]=_['merge'](_0x3f3ae8[_0xfe87('0x39')],{'$or':_[_0xfe87('0x18')](_0x2d521b,function(_0xbd8b56){if(_0xbd8b56[_0xfe87('0xa')]!==_0xfe87('0x3a')){if(_0x56564d){return sequelize[_0xfe87('0x39')](sequelize['fn'](_0xfe87('0x3b'),sequelize['col'](_0xbd8b56[_0xfe87('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x36')]+'%')});}else{var _0x1d185c={};_0x1d185c[_0xbd8b56[_0xfe87('0x12')]]={'$like':'%'+_0x2ffc05[_0xfe87('0x2f')][_0xfe87('0x36')]+'%'};return _0x1d185c;}}})});}_0x3f3ae8=_[_0xfe87('0x3c')]({},_0x3f3ae8,_0x2ffc05[_0xfe87('0x3d')]);return _0x3f3ae8;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 7b99ffa..5d38201 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 _0x21dd=['chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','routealias','omit','value','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','ringing','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','filter','User','name','smsPause','pauseType','split','fields','order','startsWith','DESC','ASC','fullname','substring','indexOf','internal','validateSortParameter','sort','globalStatus','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','mailStatus','faxStatus'];(function(_0x5b57af,_0x1f3989){var _0x4480da=function(_0x370d1d){while(--_0x370d1d){_0x5b57af['push'](_0x5b57af['shift']());}};_0x4480da(++_0x1f3989);}(_0x21dd,0x1dd));var _0xd21d=function(_0x16b47d,_0x51dd58){_0x16b47d=_0x16b47d-0x0;var _0x36a731=_0x21dd[_0x16b47d];return _0x36a731;};'use strict';var _=require(_0xd21d('0x0'));var jayson=require(_0xd21d('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd21d('0x2')][_0xd21d('0x3')]({'port':0x232a});var routingClient=jayson[_0xd21d('0x2')][_0xd21d('0x3')]({'port':0x232c});function isAgentPaused(_0x2a3af5,_0x51a5c6){var _0x2c01c1=[_0x2a3af5[_0xd21d('0x4')],_0x2a3af5[_0xd21d('0x5')],_0x2a3af5[_0xd21d('0x6')],_0x2a3af5[_0xd21d('0x7')],_0x2a3af5['smsPause'],_0x2a3af5[_0xd21d('0x8')],_0x2a3af5[_0xd21d('0x9')]];if(!_0x51a5c6)return _[_0xd21d('0xa')](_0x2c01c1);var _0x25e4d9=_['filter'](_0x2c01c1);return _0x25e4d9[_0xd21d('0xb')]>0x0&&_0x25e4d9[_0xd21d('0xb')]<_0x2c01c1[_0xd21d('0xb')]?!![]:![];}function isIdle(_0x2d40e8){return _0x2d40e8===_0xd21d('0xc')||_0x2d40e8===_0xd21d('0xd')||_0x2d40e8===_0xd21d('0xe')||_0x2d40e8===_0xd21d('0xf')||_['isNil'](_0x2d40e8);}function isAgentIdle(_0x492513){if(_0x492513[_0xd21d('0x10')]!==_0xd21d('0xc')&&_0x492513[_0xd21d('0x8')]){_0x492513[_0xd21d('0x10')]=_0xd21d('0x11');return![];}return _[_0xd21d('0xa')]([_0x492513[_0xd21d('0x12')],_0x492513['faxStatus'],_0x492513['mailStatus'],_0x492513[_0xd21d('0x13')],_0x492513[_0xd21d('0x14')],_0x492513['voiceStatus'],_0x492513[_0xd21d('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd21d('0x16')](_0xd21d('0x17'),{})[_0xd21d('0x18')](function(_0x56d8fc){if(_0x56d8fc[_0xd21d('0x19')]){throw new Error(_0xd21d('0x1a'));}var _0x2f5c8b=_0x56d8fc[_0xd21d('0x1b')];return routingClient[_0xd21d('0x16')](_0xd21d('0x17'),{})[_0xd21d('0x18')](function(_0xf26cbc){if(_0xf26cbc[_0xd21d('0x19')]){throw new Error(_0xd21d('0x1c'));}var _0x2c8088=_0xf26cbc['result'];return _[_0xd21d('0x1d')]({},_0x2f5c8b,_0x2c8088);});})[_0xd21d('0x1e')](function(_0x42e165){throw _0x42e165;});}exports[_0xd21d('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x353f15){var _0xabd3a3=_0xd21d('0xd');if(isAgentPaused(_0x353f15))_0xabd3a3=_0xd21d('0x11');else if(isAgentPaused(_0x353f15,!![]))_0xabd3a3=_0xd21d('0x20');else if(isAgentIdle(_0x353f15))_0xabd3a3=_0xd21d('0xc');else _0xabd3a3=_0xd21d('0x21');return _0xabd3a3;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x3d42e2,_0x15d6d8){var _0x209485=_[_0xd21d('0x22')](_0x3d42e2)?_0x3d42e2:[_0x3d42e2];var _0x504d08=_[_0xd21d('0x23')](_0x15d6d8)+_0xd21d('0x24');var _0x452a2e=_[_0xd21d('0x25')](_0x209485,function(_0x58835a){return db[_0x504d08][_0xd21d('0x26')]({'where':{'id':_0x58835a}})[_0xd21d('0x18')](function(_0x367524){if(!_0x367524)return[];return _0x367524[_0xd21d('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd21d('0x28')](_0x452a2e)[_0xd21d('0x18')](function(_0x30db83){var _0x15cd91=_(_0x30db83)[_0xd21d('0x29')]()[_0xd21d('0x25')]('id')['uniq']()['value']();return _0x15cd91;});}exports[_0xd21d('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1f27d9,_0x5bd6d5,_0x63e7d9){try{if(_0x5bd6d5[_0xd21d('0xb')]>0x0){_0x1f27d9=_0x1f27d9['filter'](function(_0x24c0b2){return _0x5bd6d5[_0xd21d('0x2b')](_0x24c0b2['id']);});}var _0x2a527b=_0x1f27d9['filter'](function(_0x31fbfa){var _0x24672c='busy';if(isAgentIdle(_0x31fbfa)){_0x24672c=_0xd21d('0xc');}return _0x24672c===_0x63e7d9;});return _['map'](_0x2a527b,'id');}catch(_0x3066a4){throw _0x3066a4;}}exports[_0xd21d('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3c1569,_0x104ee9,_0x420a5b){return Promise[_0xd21d('0x2d')]()['then'](function(){if(_0x104ee9[_0xd21d('0xb')]>0x0){_0x3c1569=_0x3c1569[_0xd21d('0x2e')](function(_0xf7a672){return _0x104ee9[_0xd21d('0x2b')](_0xf7a672['id']);});}return _0x3c1569;})['then'](function(){return db[_0xd21d('0x2f')]['findAll']({'attributes':['id',_0xd21d('0x30'),'fullname',_0xd21d('0x4'),'faxPause','mailPause',_0xd21d('0x7'),_0xd21d('0x31'),_0xd21d('0x8'),_0xd21d('0x9'),_0xd21d('0x32')],'where':{'id':{'$in':_['map'](_0x3c1569,'id')}},'raw':!![]});})['then'](function(_0xce99e4){return _0xce99e4[_0xd21d('0x25')](function(_0x108c57){var _0x2ff444=_['find'](_0x3c1569,['id',_0x108c57['id']]);var _0x299aa7=filterAgentAttributes(_0x2ff444);_[_0xd21d('0x1d')](_0x108c57,_0x299aa7);_0x108c57['globalStatus']=getAgentStatus(_0x108c57);return _0x108c57;});})['then'](function(_0x33a675){var _0x174236=sortAgentsByStatus(_0x33a675,_0x420a5b);return _[_0xd21d('0x25')](_0x174236,'id');})[_0xd21d('0x1e')](function(_0x44aefc){throw _0x44aefc;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x12e7ef){var _0x18674b={'fields':[],'order':null};var _0x381af4=_0x12e7ef[_0xd21d('0x33')](',');_0x18674b[_0xd21d('0x34')]=_[_0xd21d('0x2e')](_0x381af4,function(_0x6f4db1){if(!_0x6f4db1[_0xd21d('0x2b')]('globalStatus')){return!![];}_0x18674b[_0xd21d('0x35')]=_[_0xd21d('0x36')](_0x6f4db1,'-')?_0xd21d('0x37'):_0xd21d('0x38');return![];});return _0x18674b;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x53034e){if(_0x53034e[_0xd21d('0x2b')](_0xd21d('0x39'))&&!_0x53034e[_0xd21d('0x2b')]('internal')){var _0x12a10a=_0x53034e[_0xd21d('0x3a')](0x0,_0x53034e[_0xd21d('0x3b')](_0xd21d('0x39')));_0x53034e+=','+_0x12a10a+_0xd21d('0x3c');}return _0x53034e;}exports[_0xd21d('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x44d5f9,_0x4f5645){var _0x873fe7=_0x44d5f9[_0xd21d('0x3e')](function(_0x4796bc,_0x254a4c){if(_0x4796bc[_0xd21d('0x3f')]===_0x254a4c[_0xd21d('0x3f')]){if(_0x4796bc['globalStatus']===_0xd21d('0x11')){if(_0x4f5645===_0xd21d('0x37')){return(_0x4796bc[_0xd21d('0x32')]||'')<(_0x254a4c['pauseType']||'')||_0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()>_0x254a4c[_0xd21d('0x39')][_0xd21d('0x40')]()?0x1:-0x1;}else{return(_0x4796bc[_0xd21d('0x32')]||'')<(_0x254a4c['pauseType']||'')||_0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()>_0x254a4c[_0xd21d('0x39')][_0xd21d('0x40')]()?-0x1:0x1;}}else{if(_0x4f5645===_0xd21d('0x37')){return _0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()<_0x254a4c[_0xd21d('0x39')][_0xd21d('0x40')]()?0x1:-0x1;}else{return _0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()<_0x254a4c['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x4f5645===_0xd21d('0x37')){return _0x4796bc[_0xd21d('0x3f')]<_0x254a4c[_0xd21d('0x3f')]?0x1:-0x1;}else{return _0x4796bc[_0xd21d('0x3f')]<_0x254a4c['globalStatus']?-0x1:0x1;}}});return _0x873fe7;}exports[_0xd21d('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x387001){var _0x254386=[_0xd21d('0x42'),_0xd21d('0x43'),'lastLoginAt',_0xd21d('0x44'),_0xd21d('0x32'),'lastPauseAt',_0xd21d('0x3c'),_0xd21d('0x45'),'chatPause',_0xd21d('0x7'),_0xd21d('0x6'),'smsPause',_0xd21d('0x9'),_0xd21d('0x5'),'voicePause','chatCapacity',_0xd21d('0x46'),_0xd21d('0x47'),_0xd21d('0x48'),_0xd21d('0x49'),_0xd21d('0x4a'),_0xd21d('0x4b'),_0xd21d('0x4c'),_0xd21d('0x4d'),'smsCurrentCapacity','whatsappCurrentCapacity',_0xd21d('0x4e'),_0xd21d('0x12'),_0xd21d('0x13'),_0xd21d('0x4f'),'smsStatus',_0xd21d('0x15'),_0xd21d('0x50'),'voiceStatus',_0xd21d('0x51'),'openchannelStatusTime',_0xd21d('0x52'),'smsStatusTime',_0xd21d('0x53'),_0xd21d('0x54'),_0xd21d('0x55'),_0xd21d('0x56'),_0xd21d('0x57'),_0xd21d('0x58'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xd21d('0x59')];var _0x542968=[_0xd21d('0x4'),_0xd21d('0x7'),_0xd21d('0x6'),'smsPause',_0xd21d('0x9'),_0xd21d('0x5'),_0xd21d('0x8'),_0xd21d('0x43')];var _0x51bc2a=_(_0x387001)[_0xd21d('0x5a')](_0x542968)['pick'](_0x254386)[_0xd21d('0x5b')]();return _0x51bc2a;}exports[_0xd21d('0x5c')]=filterAgentAttributes; \ No newline at end of file +var _0xf175=['indexOf','validateSortParameter','sort','toLowerCase','userpic','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','online','omit','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','filter','length','idle','unknown','voicePause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','whatsappPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','getUpdatedSortOptions','fullname','internal','substring'];(function(_0xf6aa22,_0x46f536){var _0x49c2ea=function(_0x4bcbbb){while(--_0x4bcbbb){_0xf6aa22['push'](_0xf6aa22['shift']());}};_0x49c2ea(++_0x46f536);}(_0xf175,0x1dc));var _0x5f17=function(_0x385b49,_0x326bee){_0x385b49=_0x385b49-0x0;var _0x53c247=_0xf175[_0x385b49];return _0x53c247;};'use strict';var _=require('lodash');var jayson=require(_0x5f17('0x0'));var db=require(_0x5f17('0x1'))['db'];var amiClient=jayson['client'][_0x5f17('0x2')]({'port':0x232a});var routingClient=jayson[_0x5f17('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x3fa9ff,_0x4b8ae6){var _0xb558f4=[_0x3fa9ff[_0x5f17('0x4')],_0x3fa9ff[_0x5f17('0x5')],_0x3fa9ff[_0x5f17('0x6')],_0x3fa9ff[_0x5f17('0x7')],_0x3fa9ff[_0x5f17('0x8')],_0x3fa9ff['voicePause'],_0x3fa9ff['whatsappPause']];if(!_0x4b8ae6)return _[_0x5f17('0x9')](_0xb558f4);var _0x3f394d=_[_0x5f17('0xa')](_0xb558f4);return _0x3f394d[_0x5f17('0xb')]>0x0&&_0x3f394d[_0x5f17('0xb')]<_0xb558f4[_0x5f17('0xb')]?!![]:![];}function isIdle(_0x2d9609){return _0x2d9609===_0x5f17('0xc')||_0x2d9609===_0x5f17('0xd')||_0x2d9609==='unavailable'||_0x2d9609==='ringing'||_['isNil'](_0x2d9609);}function isAgentIdle(_0x243e7a){if(_0x243e7a['voiceStatus']!==_0x5f17('0xc')&&_0x243e7a[_0x5f17('0xe')]){_0x243e7a['voiceStatus']=_0x5f17('0xf');return![];}return _[_0x5f17('0x9')]([_0x243e7a[_0x5f17('0x10')],_0x243e7a[_0x5f17('0x11')],_0x243e7a[_0x5f17('0x12')],_0x243e7a[_0x5f17('0x13')],_0x243e7a[_0x5f17('0x14')],_0x243e7a[_0x5f17('0x15')],_0x243e7a['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x5f17('0x16')](_0x5f17('0x17'),{})[_0x5f17('0x18')](function(_0x2cedec){if(_0x2cedec[_0x5f17('0x19')]){throw new Error(_0x5f17('0x1a'));}var _0xff6f4a=_0x2cedec['result'];return routingClient['request']('Agents',{})[_0x5f17('0x18')](function(_0xcf283e){if(_0xcf283e[_0x5f17('0x19')]){throw new Error(_0x5f17('0x1b'));}var _0x4498a2=_0xcf283e[_0x5f17('0x1c')];return _[_0x5f17('0x1d')]({},_0xff6f4a,_0x4498a2);});})[_0x5f17('0x1e')](function(_0x155159){throw _0x155159;});}exports[_0x5f17('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x3c2a3e){var _0xa5fe35=_0x5f17('0xd');if(isAgentPaused(_0x3c2a3e))_0xa5fe35='pause';else if(isAgentPaused(_0x3c2a3e,!![]))_0xa5fe35=_0x5f17('0x20');else if(isAgentIdle(_0x3c2a3e))_0xa5fe35=_0x5f17('0xc');else _0xa5fe35=_0x5f17('0x21');return _0xa5fe35;}exports[_0x5f17('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x188f49,_0x4cc679){var _0x4a0107=_[_0x5f17('0x23')](_0x188f49)?_0x188f49:[_0x188f49];var _0xca48cb=_[_0x5f17('0x24')](_0x4cc679)+_0x5f17('0x25');var _0x795159=_[_0x5f17('0x26')](_0x4a0107,function(_0x2b1984){return db[_0xca48cb][_0x5f17('0x27')]({'where':{'id':_0x2b1984}})['then'](function(_0x40a11d){if(!_0x40a11d)return[];return _0x40a11d[_0x5f17('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5f17('0x29')](_0x795159)[_0x5f17('0x18')](function(_0x414cd9){var _0xa6c482=_(_0x414cd9)['flatten']()['map']('id')[_0x5f17('0x2a')]()[_0x5f17('0x2b')]();return _0xa6c482;});}exports[_0x5f17('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3edd10,_0x57e313,_0x24fa4f){try{if(_0x57e313[_0x5f17('0xb')]>0x0){_0x3edd10=_0x3edd10[_0x5f17('0xa')](function(_0x12da27){return _0x57e313[_0x5f17('0x2d')](_0x12da27['id']);});}var _0x2e31d0=_0x3edd10['filter'](function(_0x5a10bb){var _0x35a4cd=_0x5f17('0x21');if(isAgentIdle(_0x5a10bb)){_0x35a4cd=_0x5f17('0xc');}return _0x35a4cd===_0x24fa4f;});return _[_0x5f17('0x26')](_0x2e31d0,'id');}catch(_0x5eb795){throw _0x5eb795;}}exports[_0x5f17('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x267fe8,_0x54ec87,_0x37b7f6){return Promise[_0x5f17('0x2f')]()[_0x5f17('0x18')](function(){if(_0x54ec87[_0x5f17('0xb')]>0x0){_0x267fe8=_0x267fe8[_0x5f17('0xa')](function(_0x208fd9){return _0x54ec87['includes'](_0x208fd9['id']);});}return _0x267fe8;})[_0x5f17('0x18')](function(){return db[_0x5f17('0x30')]['findAll']({'attributes':['id',_0x5f17('0x31'),'fullname','chatPause',_0x5f17('0x5'),_0x5f17('0x6'),_0x5f17('0x7'),'smsPause',_0x5f17('0xe'),_0x5f17('0x32'),_0x5f17('0x33')],'where':{'id':{'$in':_[_0x5f17('0x26')](_0x267fe8,'id')}},'raw':!![]});})['then'](function(_0x5a7428){return _0x5a7428['map'](function(_0x8882b3){var _0x434a74=_[_0x5f17('0x34')](_0x267fe8,['id',_0x8882b3['id']]);var _0x2d98a3=filterAgentAttributes(_0x434a74);_[_0x5f17('0x1d')](_0x8882b3,_0x2d98a3);_0x8882b3['globalStatus']=getAgentStatus(_0x8882b3);return _0x8882b3;});})[_0x5f17('0x18')](function(_0xfb1f9a){var _0x1154d3=sortAgentsByStatus(_0xfb1f9a,_0x37b7f6);return _['map'](_0x1154d3,'id');})[_0x5f17('0x1e')](function(_0x4d7d87){throw _0x4d7d87;});}exports[_0x5f17('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4a7f29){var _0x2eb2b7={'fields':[],'order':null};var _0x83f35b=_0x4a7f29[_0x5f17('0x36')](',');_0x2eb2b7[_0x5f17('0x37')]=_[_0x5f17('0xa')](_0x83f35b,function(_0x481d31){if(!_0x481d31['includes'](_0x5f17('0x38'))){return!![];}_0x2eb2b7[_0x5f17('0x39')]=_[_0x5f17('0x3a')](_0x481d31,'-')?_0x5f17('0x3b'):'ASC';return![];});return _0x2eb2b7;}exports[_0x5f17('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x44881a){if(_0x44881a[_0x5f17('0x2d')](_0x5f17('0x3d'))&&!_0x44881a[_0x5f17('0x2d')](_0x5f17('0x3e'))){var _0x30acb3=_0x44881a[_0x5f17('0x3f')](0x0,_0x44881a[_0x5f17('0x40')]('fullname'));_0x44881a+=','+_0x30acb3+_0x5f17('0x3e');}return _0x44881a;}exports[_0x5f17('0x41')]=validateSortParameter;function sortAgentsByStatus(_0xc8167f,_0x490c29){var _0x27e358=_0xc8167f[_0x5f17('0x42')](function(_0x5bdbd5,_0x3603b6){if(_0x5bdbd5[_0x5f17('0x38')]===_0x3603b6['globalStatus']){if(_0x5bdbd5[_0x5f17('0x38')]===_0x5f17('0xf')){if(_0x490c29===_0x5f17('0x3b')){return(_0x5bdbd5[_0x5f17('0x33')]||'')<(_0x3603b6[_0x5f17('0x33')]||'')||_0x5bdbd5[_0x5f17('0x3d')]['toLowerCase']()>_0x3603b6[_0x5f17('0x3d')][_0x5f17('0x43')]()?0x1:-0x1;}else{return(_0x5bdbd5[_0x5f17('0x33')]||'')<(_0x3603b6['pauseType']||'')||_0x5bdbd5['fullname'][_0x5f17('0x43')]()>_0x3603b6['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x490c29===_0x5f17('0x3b')){return _0x5bdbd5[_0x5f17('0x3d')][_0x5f17('0x43')]()<_0x3603b6[_0x5f17('0x3d')][_0x5f17('0x43')]()?0x1:-0x1;}else{return _0x5bdbd5[_0x5f17('0x3d')][_0x5f17('0x43')]()<_0x3603b6['fullname'][_0x5f17('0x43')]()?-0x1:0x1;}}}else{if(_0x490c29===_0x5f17('0x3b')){return _0x5bdbd5[_0x5f17('0x38')]<_0x3603b6['globalStatus']?0x1:-0x1;}else{return _0x5bdbd5[_0x5f17('0x38')]<_0x3603b6[_0x5f17('0x38')]?-0x1:0x1;}}});return _0x27e358;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x477b56){var _0xd50ac1=[_0x5f17('0x44'),'online','lastLoginAt',_0x5f17('0x45'),_0x5f17('0x33'),_0x5f17('0x45'),'internal',_0x5f17('0x46'),'chatPause',_0x5f17('0x7'),_0x5f17('0x6'),_0x5f17('0x8'),'whatsappPause','faxPause',_0x5f17('0xe'),_0x5f17('0x47'),_0x5f17('0x48'),_0x5f17('0x49'),_0x5f17('0x4a'),_0x5f17('0x4b'),_0x5f17('0x4c'),'chatCurrentCapacity',_0x5f17('0x4d'),'mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus',_0x5f17('0x12'),_0x5f17('0x14'),_0x5f17('0x4e'),_0x5f17('0x11'),_0x5f17('0x15'),'chatStatusTime',_0x5f17('0x4f'),_0x5f17('0x50'),_0x5f17('0x51'),_0x5f17('0x52'),'faxStatusTime',_0x5f17('0x53'),_0x5f17('0x54'),_0x5f17('0x55'),_0x5f17('0x56'),_0x5f17('0x57'),'phoneBarEnableAutomaticScreenRecording','routealias'];var _0x5a6b48=[_0x5f17('0x4'),_0x5f17('0x7'),_0x5f17('0x6'),_0x5f17('0x8'),_0x5f17('0x32'),_0x5f17('0x5'),_0x5f17('0xe'),_0x5f17('0x58')];var _0x38f9c3=_(_0x477b56)[_0x5f17('0x59')](_0x5a6b48)['pick'](_0xd50ac1)[_0x5f17('0x2b')]();return _0x38f9c3;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 2fb9787..3036708 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 _0xee78=['dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','inbound','concat','outbound','map','get','loggedInDb','find','merge','initializeQueues','lodash','util','http','client','available','loggedIn','paused','waiting','busy','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xee78,0xb7));var _0x8ee7=function(_0x2b12ac,_0x1ddb41){_0x2b12ac=_0x2b12ac-0x0;var _0x3a9696=_0xee78[_0x2b12ac];return _0x3a9696;};'use strict';var _=require(_0x8ee7('0x0'));var jayson=require('jayson/promise');var util=require(_0x8ee7('0x1'));var amiClient=jayson['client'][_0x8ee7('0x2')]({'port':0x232a});var routingClient=jayson[_0x8ee7('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8ee7('0x4'),_0x8ee7('0x5'),_0x8ee7('0x6'),_0x8ee7('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x8ee7('0x8'),'inUse','invalid','loggedInDb',_0x8ee7('0x9'),_0x8ee7('0xa'),_0x8ee7('0xb'),_0x8ee7('0xc'),_0x8ee7('0xd'),_0x8ee7('0xe'),_0x8ee7('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8ee7('0x10'),_0x8ee7('0x11'),_0x8ee7('0x12'),_0x8ee7('0x13'),_0x8ee7('0x14'),_0x8ee7('0x15'),_0x8ee7('0x16'),'startPredictive',_0x8ee7('0x17'),_0x8ee7('0x18'),_0x8ee7('0x19'),_0x8ee7('0x1a'),_0x8ee7('0x1b'),_0x8ee7('0x1c'),_0x8ee7('0x1d'),_0x8ee7('0x1e'),_0x8ee7('0x1f'),_0x8ee7('0x20'),_0x8ee7('0x21'),'predictiveIntervalDroppedCallsTimeout',_0x8ee7('0x22'),_0x8ee7('0x23'),_0x8ee7('0x24')];function getRealtimeQueues(_0x10ae4b,_0x399caa){var _0x11955e=_0x399caa===_0x8ee7('0x25')?amiClient:routingClient;return _0x11955e[_0x8ee7('0x26')](_['startCase'](_0x399caa)+_0x8ee7('0x27'),_0x10ae4b)[_0x8ee7('0x28')](function(_0x5678c4){if(_0x5678c4[_0x8ee7('0x29')])throw new Error(util['format'](_0x8ee7('0x2a'),_0x399caa));return _0x5678c4['result'];})[_0x8ee7('0x2b')](function(_0x3d0980){throw _0x3d0980;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1d9511,_0x13747b,_0xf0cfdd,_0x185163){var _0x5a2818=DEFAULT_QUEUE_ATTRIBUTES;if(_0xf0cfdd==='voice'){if(_0x185163===_0x8ee7('0x2c')){_0x5a2818=_0x5a2818[_0x8ee7('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x185163===_0x8ee7('0x2e')){_0x5a2818=_0x5a2818[_0x8ee7('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1d9511[_0x8ee7('0x2f')](function(_0x5f2d18){var _0x492c0f=_0x5f2d18[_0x8ee7('0x30')]({'plain':!![]});_0x492c0f[_0x8ee7('0x6')]=0x0;_0x492c0f[_0x8ee7('0x31')]=0x0;_0x492c0f[_0x8ee7('0x5')]=0x0;_0x492c0f[_0x8ee7('0x4')]=0x0;_0x492c0f[_0x8ee7('0x7')]=0x0;if(_0xf0cfdd===_0x8ee7('0x25')){_0x492c0f[_0x8ee7('0xd')]=0x0;_0x492c0f[_0x8ee7('0x8')]=0x0;if(_0x185163===_0x8ee7('0x2e')){_0x492c0f['pTalking']=0x0;_0x492c0f['originated']=0x0;}}var _0x28a55c=_[_0x8ee7('0x32')](_0x13747b,['id',_0x492c0f['id']]);if(_0x28a55c){_[_0x8ee7('0x33')](_0x492c0f,_['pick'](_0x28a55c,_0x5a2818));}return _0x492c0f;});}exports[_0x8ee7('0x34')]=initializeQueues; \ No newline at end of file +var _0x2377=['catch','getRealtimeQueues','inbound','outbound','concat','map','busy','merge','pick','jayson/promise','util','client','http','available','loggedIn','paused','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCallToSecond','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2377,0x141));var _0x7237=function(_0x4bdba0,_0x17f277){_0x4bdba0=_0x4bdba0-0x0;var _0x4b7f8a=_0x2377[_0x4bdba0];return _0x4b7f8a;};'use strict';var _=require('lodash');var jayson=require(_0x7237('0x0'));var util=require(_0x7237('0x1'));var amiClient=jayson[_0x7237('0x2')][_0x7237('0x3')]({'port':0x232a});var routingClient=jayson[_0x7237('0x2')][_0x7237('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7237('0x4'),_0x7237('0x5'),_0x7237('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x7237('0x7'),_0x7237('0x8'),_0x7237('0x9'),_0x7237('0xa'),_0x7237('0xb'),_0x7237('0xc'),_0x7237('0xd'),_0x7237('0xe'),_0x7237('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x7237('0x10'),_0x7237('0x11'),_0x7237('0x12'),_0x7237('0x13'),_0x7237('0x14'),_0x7237('0x15'),_0x7237('0x16'),'startPredictive',_0x7237('0x17'),'erlangCalls',_0x7237('0x18'),'erlangAbandonmentRate','erlangBusyFactor',_0x7237('0x19'),_0x7237('0x1a'),_0x7237('0x1b'),_0x7237('0x1c'),_0x7237('0x1d'),_0x7237('0x1e'),_0x7237('0x1f'),_0x7237('0x20'),_0x7237('0x21'),_0x7237('0x22')];function getRealtimeQueues(_0x26db30,_0x2dd9c5){var _0x268a51=_0x2dd9c5===_0x7237('0x23')?amiClient:routingClient;return _0x268a51[_0x7237('0x24')](_[_0x7237('0x25')](_0x2dd9c5)+_0x7237('0x26'),_0x26db30)['then'](function(_0x214a11){if(_0x214a11[_0x7237('0x27')])throw new Error(util[_0x7237('0x28')](_0x7237('0x29'),_0x2dd9c5));return _0x214a11[_0x7237('0x2a')];})[_0x7237('0x2b')](function(_0x8ba671){throw _0x8ba671;});}exports[_0x7237('0x2c')]=getRealtimeQueues;function initializeQueues(_0x2a1781,_0xd46279,_0x5857c0,_0x134412){var _0x1311b0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5857c0===_0x7237('0x23')){if(_0x134412===_0x7237('0x2d')){_0x1311b0=_0x1311b0['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x134412===_0x7237('0x2e')){_0x1311b0=_0x1311b0[_0x7237('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2a1781[_0x7237('0x30')](function(_0x2d2197){var _0x1f357e=_0x2d2197['get']({'plain':!![]});_0x1f357e[_0x7237('0x6')]=0x0;_0x1f357e[_0x7237('0x9')]=0x0;_0x1f357e[_0x7237('0x5')]=0x0;_0x1f357e[_0x7237('0x4')]=0x0;_0x1f357e['waiting']=0x0;if(_0x5857c0===_0x7237('0x23')){_0x1f357e[_0x7237('0xe')]=0x0;_0x1f357e[_0x7237('0x31')]=0x0;if(_0x134412==='outbound'){_0x1f357e[_0x7237('0x10')]=0x0;_0x1f357e[_0x7237('0x11')]=0x0;}}var _0x3a1eef=_['find'](_0xd46279,['id',_0x1f357e['id']]);if(_0x3a1eef){_[_0x7237('0x32')](_0x1f357e,_[_0x7237('0x33')](_0x3a1eef,_0x1311b0));}return _0x1f357e;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8a5122f..063e1ac 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x16bf05,_0x4f70da){var _0xbcf546=function(_0x70b01d){while(--_0x70b01d){_0x16bf05['push'](_0x16bf05['shift']());}};_0xbcf546(++_0x4f70da);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ 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(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 f0945c8..f447946 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 _0x7c7e=['bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','length','family','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','digest','substring','lodash','crypto'];(function(_0x243f60,_0x2b8786){var _0x36297=function(_0x2cb281){while(--_0x2cb281){_0x243f60['push'](_0x243f60['shift']());}};_0x36297(++_0x2b8786);}(_0x7c7e,0x116));var _0xe7c7=function(_0x3c9fbc,_0x47cae5){_0x3c9fbc=_0x3c9fbc-0x0;var _0x355ce9=_0x7c7e[_0x3c9fbc];return _0x355ce9;};'use strict';var _=require(_0xe7c7('0x0'));var os=require('os');var crypto=require(_0xe7c7('0x1'));var machine=require(_0xe7c7('0x2'));var exec=require(_0xe7c7('0x3'))[_0xe7c7('0x4')];var config=require(_0xe7c7('0x5'));function getInterfaces(){var _0x34504c=[];var _0x59ea42=os['networkInterfaces']();var _0x16b93e=_[_0xe7c7('0x6')](_[_0xe7c7('0x7')](_0x59ea42));for(var _0x1ccee5=0x0;_0x1ccee5<_0x16b93e[_0xe7c7('0x8')];_0x1ccee5++){var _0x7db532=_0x59ea42[_0x16b93e[_0x1ccee5]]['filter'](function(_0xf8ff0d){return _0xf8ff0d[_0xe7c7('0x9')]==='IPv4'&&_0xf8ff0d[_0xe7c7('0xa')]===![];});_0x34504c=_0x34504c[_0xe7c7('0xb')](_0x7db532);}return _0x34504c;}function getFirstInterface(){var _0x40aeba=_[_0xe7c7('0xc')](getInterfaces());return{'macAddress':_0x40aeba&&_0x40aeba[_0xe7c7('0xd')]?_0x40aeba[_0xe7c7('0xd')]:'00:00:00:00:00:00','ipAddress':_0x40aeba&&_0x40aeba['address']?_0x40aeba[_0xe7c7('0xe')]:_0xe7c7('0xf')};}exports[_0xe7c7('0x10')]=getFirstInterface;function getCPUhash(){var _0x5eb3d8=_[_0xe7c7('0x6')](os[_0xe7c7('0x11')]()[_0xe7c7('0x12')](function(_0x464f43){return _0x464f43['model'];}))[_0xe7c7('0x13')](':');return crypto[_0xe7c7('0x14')](_0xe7c7('0x15'))[_0xe7c7('0x16')](_0x5eb3d8)['digest'](_0xe7c7('0x17'));}exports[_0xe7c7('0x18')]=function(){var _0x5bc7f0=os[_0xe7c7('0x19')]();var _0x4b3477=/[0-9a-f-]{36}/;if(config[_0xe7c7('0x1a')]&&_0x4b3477[_0xe7c7('0x1b')](config[_0xe7c7('0x1a')])){return config[_0xe7c7('0x1a')];}else if(_0x5bc7f0===_0xe7c7('0x1c')){return exec(_0xe7c7('0x1d'),{'encoding':_0xe7c7('0x1e')})[_0xe7c7('0x1f')]('\x0d\x0a','');}else{var _0x369f7b=getFirstInterface();var _0x2c9cae=getCPUhash();var _0xa296d6=_0x2c9cae+'|'+os['hostname']()+'|'+_0x369f7b[_0xe7c7('0x20')]+'|'+_0x369f7b['ipAddress'];var _0x50f859=crypto[_0xe7c7('0x14')](_0xe7c7('0x15'))['update'](_0xa296d6)[_0xe7c7('0x21')](_0xe7c7('0x17'));return _0x50f859[_0xe7c7('0x22')](0x0,0x8)+'-'+_0x50f859['substring'](0x8,0xc)+'-'+_0x50f859[_0xe7c7('0x22')](0xc,0x10)+'-'+_0x50f859[_0xe7c7('0x22')](0x10,0x14)+'-'+_0x50f859[_0xe7c7('0x22')](0x14);}}; \ No newline at end of file +var _0x73fe=['update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','filter','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','createHash','md5'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x73fe,0x12d));var _0xe73f=function(_0x22d02c,_0x47d532){_0x22d02c=_0x22d02c-0x0;var _0x443455=_0x73fe[_0x22d02c];return _0x443455;};'use strict';var _=require(_0xe73f('0x0'));var os=require('os');var crypto=require(_0xe73f('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xe73f('0x2'))[_0xe73f('0x3')];var config=require(_0xe73f('0x4'));function getInterfaces(){var _0x4932de=[];var _0x265411=os[_0xe73f('0x5')]();var _0x445285=_[_0xe73f('0x6')](_['keys'](_0x265411));for(var _0x1574fd=0x0;_0x1574fd<_0x445285['length'];_0x1574fd++){var _0x56711e=_0x265411[_0x445285[_0x1574fd]][_0xe73f('0x7')](function(_0x1197d0){return _0x1197d0[_0xe73f('0x8')]===_0xe73f('0x9')&&_0x1197d0['internal']===![];});_0x4932de=_0x4932de['concat'](_0x56711e);}return _0x4932de;}function getFirstInterface(){var _0x2cd8f=_[_0xe73f('0xa')](getInterfaces());return{'macAddress':_0x2cd8f&&_0x2cd8f['mac']?_0x2cd8f[_0xe73f('0xb')]:_0xe73f('0xc'),'ipAddress':_0x2cd8f&&_0x2cd8f['address']?_0x2cd8f[_0xe73f('0xd')]:_0xe73f('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x683db2=_[_0xe73f('0x6')](os[_0xe73f('0xf')]()['map'](function(_0x1e67d6){return _0x1e67d6[_0xe73f('0x10')];}))['join'](':');return crypto[_0xe73f('0x11')](_0xe73f('0x12'))[_0xe73f('0x13')](_0x683db2)[_0xe73f('0x14')](_0xe73f('0x15'));}exports['getUuid']=function(){var _0x3fdec5=os[_0xe73f('0x16')]();var _0x4600c5=/[0-9a-f-]{36}/;if(config[_0xe73f('0x17')]&&_0x4600c5[_0xe73f('0x18')](config[_0xe73f('0x17')])){return config['licenseToken'];}else if(_0x3fdec5===_0xe73f('0x19')){return exec(_0xe73f('0x1a'),{'encoding':'utf8'})[_0xe73f('0x1b')]('\x0d\x0a','');}else{var _0x49946f=getFirstInterface();var _0x471dee=getCPUhash();var _0x4e96cc=_0x471dee+'|'+os[_0xe73f('0x1c')]()+'|'+_0x49946f[_0xe73f('0x1d')]+'|'+_0x49946f[_0xe73f('0x1e')];var _0x56b045=crypto[_0xe73f('0x11')](_0xe73f('0x12'))[_0xe73f('0x13')](_0x4e96cc)[_0xe73f('0x14')](_0xe73f('0x15'));return _0x56b045[_0xe73f('0x1f')](0x0,0x8)+'-'+_0x56b045[_0xe73f('0x1f')](0x8,0xc)+'-'+_0x56b045[_0xe73f('0x1f')](0xc,0x10)+'-'+_0x56b045[_0xe73f('0x1f')](0x10,0x14)+'-'+_0x56b045['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b1d6cd7..c2ab66c 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 _0x401f=['version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','default','util','moment','request-promise','bluebird','pkginfo'];(function(_0x4ae9e2,_0x46a991){var _0x23177e=function(_0x2557a0){while(--_0x2557a0){_0x4ae9e2['push'](_0x4ae9e2['shift']());}};_0x23177e(++_0x46a991);}(_0x401f,0x175));var _0xf401=function(_0xe666d4,_0x239fbc){_0xe666d4=_0xe666d4-0x0;var _0x3b7a94=_0x401f[_0xe666d4];return _0x3b7a94;};'use strict';var util=require(_0xf401('0x0'));var moment=require(_0xf401('0x1'));var rp=require(_0xf401('0x2'));var BPromise=require(_0xf401('0x3'));var pkginfo=require(_0xf401('0x4'))(module,_0xf401('0x5'));var db=require(_0xf401('0x6'))['db'];var encryptor=require(_0xf401('0x7'));var hardware=require('./hardware');var logger=require(_0xf401('0x8'))(_0xf401('0x9'));var HOST=_0xf401('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5d054a){return new BPromise(function(_0x8582ab,_0x10417f){var _0x4df824=util['format'](_0xf401('0xb'),HOST,_0x5d054a,module['exports'][_0xf401('0x5')]);if(oldToken){_0x4df824=util[_0xf401('0xc')](_0xf401('0xd'),HOST,_0x5d054a,module[_0xf401('0xe')]['version'],oldToken);}var _0x29b88b={'uri':_0x4df824,'method':_0xf401('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x29b88b)['then'](function(_0x36ad08){_0x8582ab(_0x36ad08);})['catch'](function(_0x28dbde){_0x10417f(_0x28dbde);});});}function manageLicense(_0x3d6584,_0x199a30){var _0xc9e6fb=_0x199a30[_0xf401('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0xc9e6fb[_0xf401('0x11')]!==_0x3d6584&&!_0xc9e6fb[_0xf401('0x12')]){oldToken=_0xc9e6fb[_0xf401('0x11')];}httpRequest(_0x3d6584)['then'](function(_0x56a46d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x56a46d['active']){isOldTokenSent=![];if(!_0xc9e6fb[_0xf401('0x9')]&&_0xc9e6fb[_0xf401('0x9')]!=_0x56a46d[_0xf401('0x9')]||_0xc9e6fb['license']&&_0xc9e6fb[_0xf401('0x12')]){logger[_0xf401('0x13')](_0xf401('0x14'));}if(_0xc9e6fb[_0xf401('0x9')]&&!_0xc9e6fb[_0xf401('0x12')]&&_0xc9e6fb[_0xf401('0x9')]!=_0x56a46d[_0xf401('0x9')]){logger['info'](_0xf401('0x15'));}if(_0xc9e6fb[_0xf401('0x9')]&&!_0xc9e6fb['data2']&&_0xc9e6fb[_0xf401('0x9')]==_0x56a46d[_0xf401('0x9')]){return _0x199a30;}return _0x199a30[_0xf401('0x16')]({'data1':_0x3d6584,'data2':null,'license':_0x56a46d[_0xf401('0x9')]});}else{if(_0x56a46d[_0xf401('0x9')]||_0xc9e6fb['license']){if(!_0xc9e6fb[_0xf401('0x12')]){if(_0xc9e6fb['data1']==_0x3d6584){GRAY_PERIOD_REASON=_0xf401('0x17');logger[_0xf401('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xf401('0x18');logger[_0xf401('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc9e6fb['data1'],_0x3d6584);}logger[_0xf401('0x13')](_0xf401('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xf401('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x199a30[_0xf401('0x16')]({'data2':encryptor[_0xf401('0x1a')](moment()[_0xf401('0xc')](_0xf401('0x1b')))});}else{if(moment()[_0xf401('0x1c')](encryptor[_0xf401('0x1d')](_0xc9e6fb[_0xf401('0x12')]),_0xf401('0x1e'))>DAYS){logger[_0xf401('0x13')](_0xf401('0x1f'),moment()[_0xf401('0xc')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x199a30[_0xf401('0x16')]({'data1':_0x3d6584,'data2':null,'license':null});}}}else{if(_0xc9e6fb[_0xf401('0x11')]!=_0x3d6584){logger[_0xf401('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc9e6fb[_0xf401('0x11')],_0x3d6584);return _0x199a30[_0xf401('0x16')]({'data1':_0x3d6584,'data2':null,'license':null});}}}return _0x199a30;})['then'](function(_0x372b77){_0x199a30=_0x372b77;})['catch'](function(_0x46e510){logger[_0xf401('0x20')](_0x46e510[_0xf401('0x21')]);})[_0xf401('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xf401('0x23')](),_0x199a30);},TIME);});}function defaultLicense(){var _0x4f56b2=hardware[_0xf401('0x23')]();if(_0x4f56b2){return db[_0xf401('0x24')][_0xf401('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4f56b2}})[_0xf401('0x26')](function(_0x1b7bed,_0x5c18c7){logger['info'](_0xf401('0x27'),_0x4f56b2);manageLicense(_0x4f56b2,_0x1b7bed);})[_0xf401('0x28')](function(_0x29afcc){logger[_0xf401('0x20')](_0x29afcc['message']);});}}exports[_0xf401('0x29')]=defaultLicense; \ No newline at end of file +var _0xb4d3=['update','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','getUuid','License','findOrCreate','spread','message','default','util','pkginfo','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data1','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0xf3bbd7,_0x5eaf2c){var _0x3e5aa0=function(_0x1d7ce3){while(--_0x1d7ce3){_0xf3bbd7['push'](_0xf3bbd7['shift']());}};_0x3e5aa0(++_0x5eaf2c);}(_0xb4d3,0x124));var _0x3b4d=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xb4d3[_0x498334];return _0x13bb70;};'use strict';var util=require(_0x3b4d('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x3b4d('0x1'))(module,_0x3b4d('0x2'));var db=require(_0x3b4d('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x3b4d('0x4'))(_0x3b4d('0x5'));var HOST=_0x3b4d('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4b21a8){return new BPromise(function(_0xf483f8,_0x6ab990){var _0x230a50=util[_0x3b4d('0x7')](_0x3b4d('0x8'),HOST,_0x4b21a8,module[_0x3b4d('0x9')][_0x3b4d('0x2')]);if(oldToken){_0x230a50=util[_0x3b4d('0x7')](_0x3b4d('0xa'),HOST,_0x4b21a8,module[_0x3b4d('0x9')][_0x3b4d('0x2')],oldToken);}var _0x1640c8={'uri':_0x230a50,'method':_0x3b4d('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x1640c8)['then'](function(_0x474359){_0xf483f8(_0x474359);})['catch'](function(_0x29e019){_0x6ab990(_0x29e019);});});}function manageLicense(_0x413db2,_0x59c688){var _0x2d8fef=_0x59c688[_0x3b4d('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x2d8fef['data1']!==_0x413db2&&!_0x2d8fef['data2']){oldToken=_0x2d8fef[_0x3b4d('0xd')];}httpRequest(_0x413db2)[_0x3b4d('0xe')](function(_0x16300e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x16300e[_0x3b4d('0xf')]){isOldTokenSent=![];if(!_0x2d8fef[_0x3b4d('0x5')]&&_0x2d8fef[_0x3b4d('0x5')]!=_0x16300e[_0x3b4d('0x5')]||_0x2d8fef[_0x3b4d('0x5')]&&_0x2d8fef['data2']){logger[_0x3b4d('0x10')](_0x3b4d('0x11'));}if(_0x2d8fef[_0x3b4d('0x5')]&&!_0x2d8fef[_0x3b4d('0x12')]&&_0x2d8fef[_0x3b4d('0x5')]!=_0x16300e[_0x3b4d('0x5')]){logger[_0x3b4d('0x10')](_0x3b4d('0x13'));}if(_0x2d8fef[_0x3b4d('0x5')]&&!_0x2d8fef['data2']&&_0x2d8fef[_0x3b4d('0x5')]==_0x16300e[_0x3b4d('0x5')]){return _0x59c688;}return _0x59c688[_0x3b4d('0x14')]({'data1':_0x413db2,'data2':null,'license':_0x16300e[_0x3b4d('0x5')]});}else{if(_0x16300e[_0x3b4d('0x5')]||_0x2d8fef[_0x3b4d('0x5')]){if(!_0x2d8fef[_0x3b4d('0x12')]){if(_0x2d8fef['data1']==_0x413db2){GRAY_PERIOD_REASON='Disabled';logger[_0x3b4d('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x3b4d('0x15');logger[_0x3b4d('0x10')](_0x3b4d('0x16'),_0x2d8fef[_0x3b4d('0xd')],_0x413db2);}logger['info'](_0x3b4d('0x17'),GRAY_PERIOD_REASON[_0x3b4d('0x18')](),moment()[_0x3b4d('0x7')](_0x3b4d('0x19')));return _0x59c688[_0x3b4d('0x14')]({'data2':encryptor[_0x3b4d('0x1a')](moment()[_0x3b4d('0x7')](_0x3b4d('0x19')))});}else{if(moment()[_0x3b4d('0x1b')](encryptor[_0x3b4d('0x1c')](_0x2d8fef[_0x3b4d('0x12')]),_0x3b4d('0x1d'))>DAYS){logger[_0x3b4d('0x10')](_0x3b4d('0x1e'),moment()[_0x3b4d('0x7')](_0x3b4d('0x19')));isOldTokenSent=![];return _0x59c688[_0x3b4d('0x14')]({'data1':_0x413db2,'data2':null,'license':null});}}}else{if(_0x2d8fef['data1']!=_0x413db2){logger[_0x3b4d('0x10')](_0x3b4d('0x16'),_0x2d8fef[_0x3b4d('0xd')],_0x413db2);return _0x59c688[_0x3b4d('0x14')]({'data1':_0x413db2,'data2':null,'license':null});}}}return _0x59c688;})[_0x3b4d('0xe')](function(_0x1822fa){_0x59c688=_0x1822fa;})[_0x3b4d('0x1f')](function(_0xfed6ed){logger[_0x3b4d('0x20')](_0xfed6ed['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x3b4d('0x21')](),_0x59c688);},TIME);});}function defaultLicense(){var _0x1cbee4=hardware[_0x3b4d('0x21')]();if(_0x1cbee4){return db[_0x3b4d('0x22')][_0x3b4d('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x1cbee4}})[_0x3b4d('0x24')](function(_0xd5401a,_0x1ebc4f){logger[_0x3b4d('0x10')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1cbee4);manageLicense(_0x1cbee4,_0xd5401a);})[_0x3b4d('0x1f')](function(_0x3c163f){logger['error'](_0x3c163f[_0x3b4d('0x25')]);});}}exports[_0x3b4d('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bdd1fb9..acd9770 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 _0x273b=['grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','user','telephone','telephones','forEach','pick','countBy','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','%s:%s:%s','demo','gray','add'];(function(_0x4b1bd4,_0x14e7f5){var _0x21b842=function(_0x3ba203){while(--_0x3ba203){_0x4b1bd4['push'](_0x4b1bd4['shift']());}};_0x21b842(++_0x14e7f5);}(_0x273b,0x6a));var _0xb273=function(_0x514543,_0x2d5ce5){_0x514543=_0x514543-0x0;var _0x3fd3d5=_0x273b[_0x514543];return _0x3fd3d5;};'use strict';var util=require('util');var _=require(_0xb273('0x0'));var moment=require('moment');var BPromise=require(_0xb273('0x1'));var hardware=require(_0xb273('0x2'));var encryptor=require(_0xb273('0x3'));var db=require(_0xb273('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb273('0x6'),'machineUuid':hardware[_0xb273('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb273('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xb24ba6){return new BPromise(function(_0x197e65,_0x582a49){return db[_0xb273('0x9')]['find'](_[_0xb273('0xa')](_0xb24ba6,{'raw':!![],'where':{'id':0x1}}))[_0xb273('0xb')](function(_0x5af8a2){return checkLicense(_0x5af8a2,null);})[_0xb273('0xb')](function(_0x1a296b){_0x197e65(_0x1a296b);return;})[_0xb273('0xc')](function(_0x1207e6){_0x582a49(_0x1207e6);});});}function checkLicense(_0x4d870f,_0x25f594){if(!_0x4d870f){demoLicense[_0xb273('0xd')]=_0x4d870f[_0xb273('0xe')];return demoLicense;}try{var _0x98775c=_0x25f594||_0x4d870f[_0xb273('0xf')];if(_[_0xb273('0x10')](_0x98775c)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xaf5fd5=_0x4d870f['data1'];var _0x5ad3af=_0x4d870f[_0xb273('0x11')];var _0x4b1100=_0xaf5fd5[_0xb273('0x12')]('-')[0x4];var _0x4d8269=_0xaf5fd5['split']('-')[0x0];var _0x527674=encryptor['decryptString'](_0x98775c,util['format'](_0xb273('0x13'),_0x4b1100,_0xaf5fd5,_0x4d8269));var _0x2333d9=JSON['parse'](_0x527674);_0x2333d9[_0xb273('0x14')]=![];_0x2333d9['uuid']=_0xaf5fd5;_0x2333d9['machineUuid']=hardware[_0xb273('0x7')]();if(_0x5ad3af){var _0x50eea8=encryptor['decryptString'](_0x5ad3af);_0x2333d9[_0xb273('0x15')]=_0x50eea8;_0x2333d9['deadline']=moment(_0x50eea8)[_0xb273('0x16')](0x7,'days')['format']();_0x2333d9[_0xb273('0x17')]=_0x2333d9['uuid']!=_0x2333d9['machineUuid']?'changed':_0xb273('0x18');}return _0x2333d9;}catch(_0xc507da){breakingLicense[_0xb273('0xd')]=_0x4d870f[_0xb273('0xe')];breakingLicense[_0xb273('0x19')]=_0xc507da[_0xb273('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5b874e,_0x4565da){getLicense()[_0xb273('0xb')](function(_0x42bfdf){return db[_0xb273('0x1a')][_0xb273('0x1b')]({'attributes':[_0xb273('0x1c'),[db[_0xb273('0x1d')]['fn'](_0xb273('0x1e'),db['sequelize'][_0xb273('0x1f')](_0xb273('0x1c'))),_0xb273('0x20')]],'group':'role','where':{'role':{'$or':['admin',_0xb273('0x21'),_0xb273('0x22')]}},'raw':!![]})[_0xb273('0xb')](function(_0x4dc155){var _0x29da82={'user':_0x42bfdf['users']||0x0,'telephone':_0x42bfdf[_0xb273('0x23')]||0x0};_0x4dc155[_0xb273('0x24')](function(_0x34c96d){var _0x3eb17d=_0x34c96d[_0xb273('0x1c')]==='admin'?_0xb273('0x21'):_0x34c96d[_0xb273('0x1c')];_0x29da82[_0x3eb17d]-=_0x34c96d[_0xb273('0x20')];if(_0x29da82[_0x3eb17d]<0x0)_0x29da82[_0x3eb17d]=0x0;});_0x5b874e(_0x29da82);return;});})[_0xb273('0xc')](function(_0x17e3d3){_0x4565da(_0x17e3d3);});});}function checkUserLimits(_0x36b832){return new BPromise(function(_0x483ff7,_0x42f656){getLimits()[_0xb273('0xb')](function(_0x1a52aa){var _0x2eab62=_[_0xb273('0x25')](_[_0xb273('0x26')](_0x36b832,_0xb273('0x1c')),['admin',_0xb273('0x21'),_0xb273('0x22')]);var _0x18fd38=(_0x2eab62[_0xb273('0x27')]||0x0)+(_0x2eab62['user']||0x0);var _0x44df15=_0x2eab62['telephone']||0x0;if(_0x18fd38>_0x1a52aa[_0xb273('0x21')])return _0x42f656(_0xb273('0x28'));if(_0x44df15>_0x1a52aa[_0xb273('0x22')])return _0x42f656(_0xb273('0x29'));return _0x483ff7();})[_0xb273('0xc')](function(_0x5812ee){_0x42f656(_0x5812ee);});});}module[_0xb273('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x07c2=['sequelize','col','user','users','telephones','forEach','count','pick','countBy','admin','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','uuid','data1','license','isEmpty','split','decryptString','%s:%s:%s','parse','machineUuid','deadline','add','days','format','grayReason','changed','disabled','User','findAll','role','COUNT'];(function(_0x185785,_0xa7a793){var _0x414dba=function(_0x1339e8){while(--_0x1339e8){_0x185785['push'](_0x185785['shift']());}};_0x414dba(++_0xa7a793);}(_0x07c2,0x17e));var _0x207c=function(_0x4dcbe5,_0x3f98d7){_0x4dcbe5=_0x4dcbe5-0x0;var _0x45ac5c=_0x07c2[_0x4dcbe5];return _0x45ac5c;};'use strict';var util=require(_0x207c('0x0'));var _=require(_0x207c('0x1'));var moment=require(_0x207c('0x2'));var BPromise=require(_0x207c('0x3'));var hardware=require('./hardware');var encryptor=require(_0x207c('0x4'));var db=require(_0x207c('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x207c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x207c('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x207c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x207c('0x8'),'machineUuid':hardware[_0x207c('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x28b6b6){return new BPromise(function(_0xf2331f,_0xe4eb4e){return db['License'][_0x207c('0x9')](_['defaults'](_0x28b6b6,{'raw':!![],'where':{'id':0x1}}))[_0x207c('0xa')](function(_0x507d28){return checkLicense(_0x507d28,null);})[_0x207c('0xa')](function(_0x379a49){_0xf2331f(_0x379a49);return;})[_0x207c('0xb')](function(_0x466e32){_0xe4eb4e(_0x466e32);});});}function checkLicense(_0x5a43ea,_0x1ec50f){if(!_0x5a43ea){demoLicense[_0x207c('0xc')]=_0x5a43ea[_0x207c('0xd')];return demoLicense;}try{var _0x8f59a5=_0x1ec50f||_0x5a43ea[_0x207c('0xe')];if(_[_0x207c('0xf')](_0x8f59a5)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4dc756=_0x5a43ea[_0x207c('0xd')];var _0x51c7dd=_0x5a43ea['data2'];var _0x68b4d3=_0x4dc756['split']('-')[0x4];var _0x784923=_0x4dc756[_0x207c('0x10')]('-')[0x0];var _0x256da3=encryptor[_0x207c('0x11')](_0x8f59a5,util['format'](_0x207c('0x12'),_0x68b4d3,_0x4dc756,_0x784923));var _0x5cf0c6=JSON[_0x207c('0x13')](_0x256da3);_0x5cf0c6['demo']=![];_0x5cf0c6[_0x207c('0xc')]=_0x4dc756;_0x5cf0c6[_0x207c('0x14')]=hardware['getUuid']();if(_0x51c7dd){var _0x23bae6=encryptor[_0x207c('0x11')](_0x51c7dd);_0x5cf0c6['gray']=_0x23bae6;_0x5cf0c6[_0x207c('0x15')]=moment(_0x23bae6)[_0x207c('0x16')](0x7,_0x207c('0x17'))[_0x207c('0x18')]();_0x5cf0c6[_0x207c('0x19')]=_0x5cf0c6[_0x207c('0xc')]!=_0x5cf0c6[_0x207c('0x14')]?_0x207c('0x1a'):_0x207c('0x1b');}return _0x5cf0c6;}catch(_0x18269b){breakingLicense[_0x207c('0xc')]=_0x5a43ea[_0x207c('0xd')];breakingLicense['message']=_0x18269b['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2a8942,_0x4246f1){getLicense()[_0x207c('0xa')](function(_0x5f1873){return db[_0x207c('0x1c')][_0x207c('0x1d')]({'attributes':[_0x207c('0x1e'),[db['sequelize']['fn'](_0x207c('0x1f'),db[_0x207c('0x20')][_0x207c('0x21')](_0x207c('0x1e'))),'count']],'group':_0x207c('0x1e'),'where':{'role':{'$or':['admin',_0x207c('0x22'),'telephone']}},'raw':!![]})[_0x207c('0xa')](function(_0x540b29){var _0x13027f={'user':_0x5f1873[_0x207c('0x23')]||0x0,'telephone':_0x5f1873[_0x207c('0x24')]||0x0};_0x540b29[_0x207c('0x25')](function(_0x4b69c8){var _0x414280=_0x4b69c8['role']==='admin'?'user':_0x4b69c8[_0x207c('0x1e')];_0x13027f[_0x414280]-=_0x4b69c8[_0x207c('0x26')];if(_0x13027f[_0x414280]<0x0)_0x13027f[_0x414280]=0x0;});_0x2a8942(_0x13027f);return;});})['catch'](function(_0x4e0241){_0x4246f1(_0x4e0241);});});}function checkUserLimits(_0x3c547e){return new BPromise(function(_0x53b8a4,_0x4e8751){getLimits()[_0x207c('0xa')](function(_0x25db26){var _0x883d84=_[_0x207c('0x27')](_[_0x207c('0x28')](_0x3c547e,_0x207c('0x1e')),[_0x207c('0x29'),_0x207c('0x22'),_0x207c('0x2a')]);var _0x434c54=(_0x883d84[_0x207c('0x29')]||0x0)+(_0x883d84['user']||0x0);var _0x5e7c2c=_0x883d84[_0x207c('0x2a')]||0x0;if(_0x434c54>_0x25db26[_0x207c('0x22')])return _0x4e8751(_0x207c('0x2b'));if(_0x5e7c2c>_0x25db26[_0x207c('0x2a')])return _0x4e8751(_0x207c('0x2c'));return _0x53b8a4();})[_0x207c('0xb')](function(_0x5eb16f){_0x4e8751(_0x5eb16f);});});}module[_0x207c('0x2d')]={'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 273b5a1..9ddeab8 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 _0x2032=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x2a165d,_0x595f5f){var _0x120536=function(_0x43382a){while(--_0x43382a){_0x2a165d['push'](_0x2a165d['shift']());}};_0x120536(++_0x595f5f);}(_0x2032,0xd9));var _0x2203=function(_0x4570a8,_0x4c2a54){_0x4570a8=_0x4570a8-0x0;var _0x2f39a3=_0x2032[_0x4570a8];return _0x2f39a3;};'use strict';module['exports']={'DOMAIN':_0x2203('0x0'),'SESSION_SECRET':_0x2203('0x1'),'GOOGLE_ID':_0x2203('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xdb28=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x2acb9e,_0x315535){var _0x15899d=function(_0x3b0903){while(--_0x3b0903){_0x2acb9e['push'](_0x2acb9e['shift']());}};_0x15899d(++_0x315535);}(_0xdb28,0x106));var _0x8db2=function(_0x5982af,_0x5b42b3){_0x5982af=_0x5982af-0x0;var _0x44f54f=_0xdb28[_0x5982af];return _0x44f54f;};'use strict';module[_0x8db2('0x0')]={'DOMAIN':_0x8db2('0x1'),'SESSION_SECRET':_0x8db2('0x2'),'GOOGLE_ID':_0x8db2('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 260ebbc..7e8881e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ce9=['../utils/loggers','fileLogger','exports'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x5ce9,0x11d));var _0x95ce=function(_0x1d3c84,_0x27447d){_0x1d3c84=_0x1d3c84-0x0;var _0x211702=_0x5ce9[_0x1d3c84];return _0x211702;};'use strict';var fileLogger=require(_0x95ce('0x0'))[_0x95ce('0x1')];module[_0x95ce('0x2')]=fileLogger; \ No newline at end of file +var _0xe396=['exports','../utils/loggers','fileLogger'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xe396,0x115));var _0x6e39=function(_0x3da5de,_0x1a49e9){_0x3da5de=_0x3da5de-0x0;var _0x2fd583=_0xe396[_0x3da5de];return _0x2fd583;};'use strict';var fileLogger=require(_0x6e39('0x0'))[_0x6e39('0x1')];module[_0x6e39('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2175989..f716e81 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 _0x07e3=['resolve','join','root','legacy-libs','express','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js','xdr','path','../../config/environment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x07e3,0x129));var _0x307e=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x07e3[_0x336ca2];return _0xda59a6;};'use strict';var path=require(_0x307e('0x0'));var cfg=require(_0x307e('0x1'));var env={'NODE_PATH':path[_0x307e('0x2')](path[_0x307e('0x3')](cfg[_0x307e('0x4')],_0x307e('0x5')))};var pm2config={'apps':[{'name':_0x307e('0x6'),'script':path[_0x307e('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x307e('0x3')](__dirname,_0x307e('0x7')),'env':env},{'name':_0x307e('0x8'),'script':path[_0x307e('0x3')](__dirname,_0x307e('0x9')),'env':env},{'name':_0x307e('0xa'),'script':path[_0x307e('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x307e('0x3')](__dirname,_0x307e('0xb')),'env':env},{'name':_0x307e('0xc'),'script':path[_0x307e('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xea9e=['xdr','../../services/xdr/index.js','path','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','agi','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x4c287a,_0x14b0aa){var _0x85810b=function(_0x3bc02e){while(--_0x3bc02e){_0x4c287a['push'](_0x4c287a['shift']());}};_0x85810b(++_0x14b0aa);}(_0xea9e,0x1ec));var _0xeea9=function(_0x433b2b,_0x346c64){_0x433b2b=_0x433b2b-0x0;var _0x1430e8=_0xea9e[_0x433b2b];return _0x1430e8;};'use strict';var path=require(_0xeea9('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xeea9('0x1')](path[_0xeea9('0x2')](cfg[_0xeea9('0x3')],_0xeea9('0x4')))};var pm2config={'apps':[{'name':_0xeea9('0x5'),'script':path[_0xeea9('0x2')](__dirname,_0xeea9('0x6')),'env':env},{'name':_0xeea9('0x7'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xeea9('0x8'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0xeea9('0x2')](__dirname,_0xeea9('0x9')),'env':env},{'name':_0xeea9('0xa'),'script':path[_0xeea9('0x2')](__dirname,_0xeea9('0xb')),'env':env},{'name':_0xeea9('0xc'),'script':path[_0xeea9('0x2')](__dirname,_0xeea9('0xd')),'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 19b94bb..7e195e4 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 _0x0fec=['stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','disconnect'];(function(_0x1f38a0,_0x1a5a9d){var _0x3fa815=function(_0x340313){while(--_0x340313){_0x1f38a0['push'](_0x1f38a0['shift']());}};_0x3fa815(++_0x1a5a9d);}(_0x0fec,0x190));var _0xc0fe=function(_0x41d116,_0x36f9f9){_0x41d116=_0x41d116-0x0;var _0x17a999=_0x0fec[_0x41d116];return _0x17a999;};'use strict';var pm2=require(_0xc0fe('0x0'));var BPromise=require(_0xc0fe('0x1'));var config=require(_0xc0fe('0x2'));function connect(){return new BPromise(function(_0x424ddb,_0x18f944){return pm2['connect'](function(_0x2f83df){if(_0x2f83df){return _0x18f944(_0x2f83df);}return _0x424ddb(_0xc0fe('0x3'));});});};exports['start']=function(_0x3f6eb5){return connect()['then'](function(){return new BPromise(function(_0x1f32d1,_0x3459de){return pm2[_0xc0fe('0x4')](_0x3f6eb5,function(_0x5393f4,_0x3146c1){if(_0x5393f4){return _0x3459de(_0x5393f4);}pm2[_0xc0fe('0x5')]();return _0x1f32d1(_0x3146c1);});});});};exports[_0xc0fe('0x6')]=function(_0x23c366){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x2336e2,_0x3812f2){return pm2[_0xc0fe('0x6')](_0x23c366,function(_0x380b7a,_0x2591a2){if(_0x380b7a){return _0x3812f2(_0x380b7a);}pm2[_0xc0fe('0x5')]();return _0x2336e2(_0x2591a2);});});});};exports[_0xc0fe('0x8')]=function(_0x464ec9){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x87c0a6,_0x5dfe1c){return pm2[_0xc0fe('0x8')](_0x464ec9,function(_0x236b4d,_0x4739ff){if(_0x236b4d){return _0x5dfe1c(_0x236b4d);}pm2[_0xc0fe('0x5')]();return _0x87c0a6(_0x4739ff);});});});};exports[_0xc0fe('0x9')]=function(){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x42d16f,_0x3dc819){return pm2[_0xc0fe('0x9')](function(_0x27ef4b,_0x5d903c){if(_0x27ef4b){return _0x3dc819(_0x27ef4b);}pm2['disconnect']();return _0x42d16f(_0x5d903c);});});});};exports[_0xc0fe('0xa')]=function(_0x1c2565){return connect()['then'](function(){return new BPromise(function(_0x59c873,_0x5a5a64){return pm2[_0xc0fe('0xa')](_0x1c2565,function(_0x137b42,_0x436600){if(_0x137b42){return _0x5a5a64(_0x137b42);}pm2[_0xc0fe('0x5')]();return _0x59c873(_0x436600);});});});};exports[_0xc0fe('0xb')]=function(_0x14fa6c){return connect()['then'](function(){return new BPromise(function(_0x5f5c08,_0x4ae1d2){return pm2[_0xc0fe('0xb')](_0x14fa6c,function(_0x4f5e,_0xa9f912){if(_0x4f5e){return _0x4ae1d2(_0x4f5e);}pm2[_0xc0fe('0x5')]();return _0x5f5c08(_0xa9f912);});});});};exports[_0xc0fe('0xc')]=function(){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x1557b5,_0x4d62aa){return pm2[_0xc0fe('0xc')](function(_0x3bbf48){if(_0x3bbf48){return _0x4d62aa(_0x3bbf48);}return _0x1557b5(_0xc0fe('0xd'));});});});}; \ No newline at end of file +var _0x650d=['disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','connect','connected','start','then'];(function(_0x1d0a13,_0x6bd48d){var _0x399b0e=function(_0x1fc13a){while(--_0x1fc13a){_0x1d0a13['push'](_0x1d0a13['shift']());}};_0x399b0e(++_0x6bd48d);}(_0x650d,0x158));var _0xd650=function(_0xe8fa1f,_0x12bba1){_0xe8fa1f=_0xe8fa1f-0x0;var _0x4b3a65=_0x650d[_0xe8fa1f];return _0x4b3a65;};'use strict';var pm2=require(_0xd650('0x0'));var BPromise=require(_0xd650('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x4d14fc,_0x15980b){return pm2[_0xd650('0x2')](function(_0x7e6a01){if(_0x7e6a01){return _0x15980b(_0x7e6a01);}return _0x4d14fc(_0xd650('0x3'));});});};exports[_0xd650('0x4')]=function(_0x34868c){return connect()[_0xd650('0x5')](function(){return new BPromise(function(_0x397716,_0x1852fe){return pm2[_0xd650('0x4')](_0x34868c,function(_0x385c56,_0x11171b){if(_0x385c56){return _0x1852fe(_0x385c56);}pm2[_0xd650('0x6')]();return _0x397716(_0x11171b);});});});};exports[_0xd650('0x7')]=function(_0x464b57){return connect()[_0xd650('0x5')](function(){return new BPromise(function(_0x25d8c8,_0x44abc8){return pm2[_0xd650('0x7')](_0x464b57,function(_0x4434c1,_0x4f8631){if(_0x4434c1){return _0x44abc8(_0x4434c1);}pm2['disconnect']();return _0x25d8c8(_0x4f8631);});});});};exports[_0xd650('0x8')]=function(_0x10098a){return connect()[_0xd650('0x5')](function(){return new BPromise(function(_0x4335e7,_0x4d1f8f){return pm2[_0xd650('0x8')](_0x10098a,function(_0x25bde7,_0x58ae55){if(_0x25bde7){return _0x4d1f8f(_0x25bde7);}pm2[_0xd650('0x6')]();return _0x4335e7(_0x58ae55);});});});};exports[_0xd650('0x9')]=function(){return connect()[_0xd650('0x5')](function(){return new BPromise(function(_0x42b56f,_0x2b9638){return pm2[_0xd650('0x9')](function(_0x2e820c,_0x3f9fe1){if(_0x2e820c){return _0x2b9638(_0x2e820c);}pm2[_0xd650('0x6')]();return _0x42b56f(_0x3f9fe1);});});});};exports[_0xd650('0xa')]=function(_0x2aa43f){return connect()[_0xd650('0x5')](function(){return new BPromise(function(_0x5c993e,_0x1f01d0){return pm2['describe'](_0x2aa43f,function(_0x5a78b4,_0xcb747d){if(_0x5a78b4){return _0x1f01d0(_0x5a78b4);}pm2[_0xd650('0x6')]();return _0x5c993e(_0xcb747d);});});});};exports[_0xd650('0xb')]=function(_0x13e1fd){return connect()[_0xd650('0x5')](function(){return new BPromise(function(_0x18a7aa,_0x39ea42){return pm2['delete'](_0x13e1fd,function(_0x59fcdf,_0x398515){if(_0x59fcdf){return _0x39ea42(_0x59fcdf);}pm2[_0xd650('0x6')]();return _0x18a7aa(_0x398515);});});});};exports[_0xd650('0xc')]=function(){return connect()[_0xd650('0x5')](function(){return new BPromise(function(_0x577cc8,_0x528b97){return pm2[_0xd650('0xc')](function(_0x4cfc10){if(_0x4cfc10){return _0x528b97(_0x4cfc10);}return _0x577cc8(_0xd650('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index dac9246..1d4966a 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 _0x314f=['format','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','info','join','system'];(function(_0x5165f4,_0x26ad84){var _0xbb4b1f=function(_0x3c8a06){while(--_0x3c8a06){_0x5165f4['push'](_0x5165f4['shift']());}};_0xbb4b1f(++_0x26ad84);}(_0x314f,0xf0));var _0xf314=function(_0x4d200e,_0x4295b9){_0x4d200e=_0x4d200e-0x0;var _0x4ef85f=_0x314f[_0x4d200e];return _0x4ef85f;};'use strict';var _=require(_0xf314('0x0'));var moment=require(_0xf314('0x1'));var Redis=require(_0xf314('0x2'));var util=require(_0xf314('0x3'));var config=require('../../config/environment');var db=require(_0xf314('0x4'))['db'];var logger=require(_0xf314('0x5'))(_0xf314('0x6'));config[_0xf314('0x7')]=_[_0xf314('0x8')](config['redis'],{'host':_0xf314('0x9'),'port':0x18eb});var io=require(_0xf314('0xa'))(new Redis(config[_0xf314('0x7')]));function closeInteractions(){var _0x287b0d=0x0;var _0x16665b=[];return db[_0xf314('0xb')][_0xf314('0xc')]({'raw':!![],'attributes':['id',_0xf314('0xd')],'where':{'id':0x1}})['then'](function(_0x42f528){_0x287b0d=_0x42f528[_0xf314('0xd')];if(_0x287b0d){return db[_0xf314('0xe')][_0xf314('0xf')]({'raw':!![],'attributes':['id',_0xf314('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf314('0x11')](_0x42f528['chatTimeout'],_0xf314('0x12'))}}});}else{return[];}})[_0xf314('0x13')](function(_0x1dda44){if(_0x1dda44&&_0x1dda44['length']){_0x16665b=_[_0xf314('0x14')](_0x1dda44||[],'id');logger[_0xf314('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x16665b[_0xf314('0x16')]());return db['ChatInteraction']['update']({'closeReason':_0xf314('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xf314('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x16665b}});}})[_0xf314('0x13')](function(){if(_0x16665b&&_0x16665b[_0xf314('0x19')]){logger[_0xf314('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x16665b[_0xf314('0x16')]());for(var _0x253a50=0x0;_0x253a50<_0x16665b[_0xf314('0x19')];_0x253a50++){io[_0xf314('0x1a')](_0xf314('0x1b'),{'id':_0x16665b[_0x253a50],'closed':!![]});}}})[_0xf314('0x1c')](function(_0x34d968){logger[_0xf314('0x1d')](_0xf314('0x1e'),_0x34d968?util[_0xf314('0x1f')](_0x34d968,{'showHidden':![],'depth':null}):'');});}exports[_0xf314('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2d0d=['minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','then','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x2d0d,0xa7));var _0xd2d0=function(_0xb74b87,_0x5b85cc){_0xb74b87=_0xb74b87-0x0;var _0x18d5de=_0x2d0d[_0xb74b87];return _0x18d5de;};'use strict';var _=require(_0xd2d0('0x0'));var moment=require(_0xd2d0('0x1'));var Redis=require(_0xd2d0('0x2'));var util=require(_0xd2d0('0x3'));var config=require(_0xd2d0('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config['redis']=_['defaults'](config[_0xd2d0('0x5')],{'host':_0xd2d0('0x6'),'port':0x18eb});var io=require(_0xd2d0('0x7'))(new Redis(config[_0xd2d0('0x5')]));function closeInteractions(){var _0x27d67d=0x0;var _0x1bb890=[];return db[_0xd2d0('0x8')][_0xd2d0('0x9')]({'raw':!![],'attributes':['id',_0xd2d0('0xa')],'where':{'id':0x1}})['then'](function(_0x4a5a0e){_0x27d67d=_0x4a5a0e['chatTimeout'];if(_0x27d67d){return db[_0xd2d0('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xd2d0('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4a5a0e[_0xd2d0('0xa')],_0xd2d0('0xd'))}}});}else{return[];}})['then'](function(_0x48d447){if(_0x48d447&&_0x48d447[_0xd2d0('0xe')]){_0x1bb890=_[_0xd2d0('0xf')](_0x48d447||[],'id');logger[_0xd2d0('0x10')](_0xd2d0('0x11'),_0x1bb890[_0xd2d0('0x12')]());return db[_0xd2d0('0xb')][_0xd2d0('0x13')]({'closeReason':_0xd2d0('0x14'),'disposition':_0xd2d0('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1bb890}});}})[_0xd2d0('0x16')](function(){if(_0x1bb890&&_0x1bb890[_0xd2d0('0xe')]){logger[_0xd2d0('0x10')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1bb890[_0xd2d0('0x12')]());for(var _0x3c967e=0x0;_0x3c967e<_0x1bb890['length'];_0x3c967e++){io[_0xd2d0('0x17')](_0xd2d0('0x18'),{'id':_0x1bb890[_0x3c967e],'closed':!![]});}}})[_0xd2d0('0x19')](function(_0x1d3116){logger[_0xd2d0('0x1a')](_0xd2d0('0x1b'),_0x1d3116?util[_0xd2d0('0x1c')](_0x1d3116,{'showHidden':![],'depth':null}):'');});}exports[_0xd2d0('0x1d')]=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 e4eb068..9367a78 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 _0x9bec=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0xbcda4d,_0x3deb9c){var _0x1e5a79=function(_0x393aba){while(--_0x393aba){_0xbcda4d['push'](_0xbcda4d['shift']());}};_0x1e5a79(++_0x3deb9c);}(_0x9bec,0x13d));var _0xc9be=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9bec[_0x7e2eb0];return _0xd92de4;};'use strict';function start(){var _0x13d020=require(_0xc9be('0x0'));return _0x13d020[_0xc9be('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xaec7=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x382020,_0xb16cf7){var _0x3687ee=function(_0x162ef2){while(--_0x162ef2){_0x382020['push'](_0x382020['shift']());}};_0x3687ee(++_0xb16cf7);}(_0xaec7,0x141));var _0x7aec=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xaec7[_0x3ff085];return _0x2b68c3;};'use strict';function start(){var _0x14892b=require(_0x7aec('0x0'));return _0x14892b['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 10d7c70..cd263f6 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 _0x3c2a=['toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop\x20cron','startAt','update','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','bcc','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','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','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3c2a,0x10f));var _0xa3c2=function(_0x4d9e91,_0x3ee4cd){_0x4d9e91=_0x4d9e91-0x0;var _0x4ec62a=_0x3c2a[_0x4d9e91];return _0x4ec62a;};'use strict';var fs=require('fs');var util=require(_0xa3c2('0x0'));var path=require(_0xa3c2('0x1'));var _=require('lodash');var moment=require(_0xa3c2('0x2'));var CronJobManager=require(_0xa3c2('0x3'));var jayson=require(_0xa3c2('0x4'));var BPromise=require('bluebird');var logger=require(_0xa3c2('0x5'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xa3c2('0x6'));var analyticDefaultReportController=require(_0xa3c2('0x7'));var client=jayson[_0xa3c2('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x315985,_0x1cb80b){return function(){logger[_0xa3c2('0x9')](_0xa3c2('0xa'),_0x315985[_0xa3c2('0xb')]);var _0x4a955c=!![];var _0x32c212=_0x315985[_0xa3c2('0xc')]['getSmtpOptions']();var _0x2f40f2={'account':_0x32c212,'message':{'from':util[_0xa3c2('0xd')](_0xa3c2('0xe'),_0x315985[_0xa3c2('0xc')]['name'],_0x315985[_0xa3c2('0xc')][_0xa3c2('0xb')]||_0x315985[_0xa3c2('0xc')][_0xa3c2('0xf')]['user']),'to':_0x315985[_0xa3c2('0xb')],'cc':_0x315985['cc'],'bcc':_0x315985[_0xa3c2('0x10')],'subject':util[_0xa3c2('0xd')]('Report\x20%s\x20last\x20%s\x20%s',_0x1cb80b[_0xa3c2('0x11')],_0x315985[_0xa3c2('0x12')],_0x315985[_0xa3c2('0x13')])}};var _0x6c4933=path['join'](__dirname,_0xa3c2('0x14'));var _0x514337=_0x1cb80b[_0xa3c2('0x15')];var _0x3b7454=util[_0xa3c2('0xd')](_0xa3c2('0x16'),path['basename'](_0x1cb80b[_0xa3c2('0x15')],path[_0xa3c2('0x17')](_0x1cb80b[_0xa3c2('0x15')])),_0xa3c2('0x18'));var _0x258c83=path[_0xa3c2('0x19')](_0x6c4933,_0x514337);var _0x253979=path['join'](_0x6c4933,_0x3b7454);if(fs[_0xa3c2('0x1a')](_0x258c83)){_0x1cb80b['status']=_0xa3c2('0x1b');_0x2f40f2['message']['attachments']=[{'filename':_0x514337,'path':_0x258c83}];_0x2f40f2[_0xa3c2('0x1c')][_0xa3c2('0x1d')]=util[_0xa3c2('0xd')](_0xa3c2('0x1e'),JSON[_0xa3c2('0x1f')](_0x1cb80b,null,0x2));}else if(fs[_0xa3c2('0x1a')](_0x253979)){_0x1cb80b[_0xa3c2('0x20')]='Sent';_0x2f40f2[_0xa3c2('0x1c')]['attachments']=[{'filename':_0x3b7454,'path':_0x253979}];}else{_0x2f40f2[_0xa3c2('0x1c')][_0xa3c2('0x1d')]=_0xa3c2('0x21');if(!_0x315985[_0xa3c2('0x22')]){_0x4a955c=![];logger[_0xa3c2('0x9')](_0xa3c2('0x23'));}}if(_0x4a955c){return client[_0xa3c2('0x24')](_0xa3c2('0x25'),_0x2f40f2)[_0xa3c2('0x26')](function(_0x53a953){if(_0x53a953[_0xa3c2('0x27')]){return logger['error'](_0xa3c2('0x28'),JSON[_0xa3c2('0x1f')](_0x53a953));}return logger[_0xa3c2('0x9')](_0xa3c2('0x29'));})['catch'](function(_0x3ff46e){return logger[_0xa3c2('0x27')](_0xa3c2('0x28'),JSON['stringify'](_0x3ff46e));});}};}function handleError(){return function(_0x4ec8f7){return logger['error'](JSON[_0xa3c2('0x1f')](_0x4ec8f7));};}function handleResult(_0xefb60){return function(_0x149d49){logger[_0xa3c2('0x9')](_0xa3c2('0x2a'),JSON[_0xa3c2('0x1f')](_0x149d49));if(_0xefb60[_0xa3c2('0xc')]&&_0xefb60[_0xa3c2('0xc')][_0xa3c2('0xf')]&&!_[_0xa3c2('0x2b')](_0xefb60[_0xa3c2('0xb')])){setTimeout(handleSendEmail(_0xefb60,_0x149d49),0x3c*0x3e8);}};}function handleJob(_0xfe89f0){return function(){try{if(_['isNil'](_0xfe89f0[_0xa3c2('0x12')])){return logger[_0xa3c2('0x9')](_0xa3c2('0x2c'));}if(_[_0xa3c2('0x2b')](_0xfe89f0[_0xa3c2('0x13')])){return logger[_0xa3c2('0x9')](_0xa3c2('0x2d'));}var _0x3ba163={'startDate':moment()[_0xa3c2('0x2e')](_0xfe89f0[_0xa3c2('0x12')],_0xfe89f0['subtractUnit'])[_0xa3c2('0xd')](_0xa3c2('0x2f')),'endDate':moment()[_0xa3c2('0xd')](_0xa3c2('0x2f')),'type':_0xa3c2('0x30'),'output':_0xfe89f0['output'],'name':_0xfe89f0[_0xa3c2('0x11')]};if(!_[_0xa3c2('0x2b')](_0xfe89f0['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0xfe89f0[_0xa3c2('0x31')]);return analyticDefaultReportController[_0xa3c2('0x32')]({'id':_0xfe89f0[_0xa3c2('0x31')]},_0x3ba163)[_0xa3c2('0x26')](handleResult(_0xfe89f0))[_0xa3c2('0x33')](handleError());}if(!_[_0xa3c2('0x2b')](_0xfe89f0[_0xa3c2('0x34')])){logger[_0xa3c2('0x9')](_0xa3c2('0x35'),_0xfe89f0[_0xa3c2('0x34')]);return analyticCustomReportController[_0xa3c2('0x32')]({'id':_0xfe89f0['CustomReportId']},_0x3ba163)[_0xa3c2('0x26')](handleResult(_0xfe89f0))[_0xa3c2('0x33')](handleError());}}catch(_0x36b450){logger[_0xa3c2('0x27')](JSON[_0xa3c2('0x1f')](_0x36b450));}return logger['info'](_0xa3c2('0x36'));};}function getJobs(_0x3dd76e){var _0x42117d={};if(_0x3dd76e){_0x42117d['id']=_0x3dd76e;}return db[_0xa3c2('0x37')][_0xa3c2('0x38')]({'where':_0x42117d,'include':[{'model':db[_0xa3c2('0xc')],'attributes':['id','name','email'],'include':[{'model':db[_0xa3c2('0x39')],'as':_0xa3c2('0xf'),'include':[{'model':db[_0xa3c2('0x3a')],'as':_0xa3c2('0x3a')}]}]}]})[_0xa3c2('0x26')](function(_0x553ea6){var _0x4ef1e4=_['keys'](manager[_0xa3c2('0x3b')]);var _0x854f28=_['map'](_0x553ea6,function(_0x3b3525){return _0x3b3525['id'][_0xa3c2('0x3c')]();});var _0x101a5b=_[_0xa3c2('0x3d')](_0x553ea6,function(_0x882417){return _0x882417['id']['toString']();});var _0x54ba69=_0x3dd76e?_0x854f28:_['difference'](_0x854f28,_0x4ef1e4);var _0x27f0e6=_[_0xa3c2('0x3e')](_0x854f28,_0x4ef1e4);var _0x56ed3b=_[_0xa3c2('0x3f')](_0x4ef1e4,_0x854f28);var _0x9835cc;var _0x425f81;for(_0x9835cc=0x0;_0x9835cc<_0x56ed3b[_0xa3c2('0x40')]&&!_0x3dd76e;_0x9835cc+=0x1){_0x425f81=_0x56ed3b[_0x9835cc]['toString']();if(manager[_0xa3c2('0x41')](_0x425f81)){manager[_0xa3c2('0x42')](_0x425f81);manager[_0xa3c2('0x43')](_0x425f81);logger[_0xa3c2('0x9')](_0xa3c2('0x44'),_0x425f81);}}logger[_0xa3c2('0x9')](_0xa3c2('0x45'),JSON[_0xa3c2('0x1f')](_0x54ba69));for(_0x9835cc=0x0;_0x9835cc<_0x54ba69[_0xa3c2('0x40')];_0x9835cc+=0x1){_0x425f81=_0x54ba69[_0x9835cc][_0xa3c2('0x3c')]();logger[_0xa3c2('0x9')](_0xa3c2('0x46'),_0x425f81);if(_0x3dd76e){logger[_0xa3c2('0x9')](_0xa3c2('0x47'),_0x3dd76e);logger[_0xa3c2('0x9')](JSON['stringify'](_0x101a5b[_0x425f81]));BPromise[_0xa3c2('0x48')]()[_0xa3c2('0x26')](handleJob(_0x101a5b[_0x425f81]));logger[_0xa3c2('0x9')](_0xa3c2('0x49'),_0x101a5b[_0x425f81][_0xa3c2('0x11')],_0x101a5b[_0x425f81][_0xa3c2('0x4a')]);}else if(_0x101a5b[_0x425f81][_0xa3c2('0x4a')]&&_0x101a5b[_0x425f81][_0xa3c2('0x4b')]&&moment()[_0xa3c2('0x4c')](_0x101a5b[_0x425f81]['startAt'],_0x101a5b[_0x425f81][_0xa3c2('0x4d')])){manager[_0xa3c2('0x4e')](_0x425f81,_0x101a5b[_0x425f81]['cron'],handleJob(_0x101a5b[_0x425f81]));manager[_0xa3c2('0x4f')](_0x425f81);logger[_0xa3c2('0x9')](_0xa3c2('0x50'),_0x101a5b[_0x425f81]['name'],_0x101a5b[_0x425f81]['cron']);}else if(manager[_0xa3c2('0x41')](_0x425f81)){manager[_0xa3c2('0x42')](_0x425f81);manager[_0xa3c2('0x43')](_0x425f81);logger[_0xa3c2('0x9')](_0xa3c2('0x51'),_0x101a5b[_0x425f81][_0xa3c2('0x11')],_0x101a5b[_0x425f81]['cron']);}}for(_0x9835cc=0x0,_0x425f81;_0x9835cc<_0x27f0e6[_0xa3c2('0x40')]&&!_0x3dd76e;_0x9835cc+=0x1){_0x425f81=_0x27f0e6[_0x9835cc][_0xa3c2('0x3c')]();if(manager[_0xa3c2('0x41')](_0x425f81)){if(_0x101a5b[_0x425f81]['cron']&&_0x101a5b[_0x425f81][_0xa3c2('0x4b')]&&moment()[_0xa3c2('0x4c')](_0x101a5b[_0x425f81][_0xa3c2('0x52')],_0x101a5b[_0x425f81]['endAt'])){manager[_0xa3c2('0x53')](_0x425f81,_0x101a5b[_0x425f81][_0xa3c2('0x4a')],handleJob(_0x101a5b[_0x425f81]));logger['info'](_0xa3c2('0x54'),_0x101a5b[_0x425f81]['name'],_0x101a5b[_0x425f81]['cron']);}else{manager[_0xa3c2('0x42')](_0x425f81);manager[_0xa3c2('0x43')](_0x425f81);logger['info'](_0xa3c2('0x51'),_0x101a5b[_0x425f81][_0xa3c2('0x11')],_0x101a5b[_0x425f81]['cron']);}}}})[_0xa3c2('0x33')](function(_0x2035e7){logger[_0xa3c2('0x27')](JSON[_0xa3c2('0x1f')](_0x2035e7));});}exports['run']=function(_0x3ae121){return getJobs(_0x3ae121);};exports[_0xa3c2('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc10b=['info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','format','\x22%s\x22\x20<%s>','name','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','attachments','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','keyBy','toString','difference','intersection','length','exists','delete\x20cron','toRun','index','resolve','run\x20job','cron','endAt','add','start','add\x20cron','stop','deleteJob','active','isBetween','startAt','update\x20cron','stop\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http'];(function(_0x11edc1,_0x16a4bd){var _0x9a4cfd=function(_0x27db80){while(--_0x27db80){_0x11edc1['push'](_0x11edc1['shift']());}};_0x9a4cfd(++_0x16a4bd);}(_0xc10b,0x155));var _0xbc10=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xc10b[_0x39e84d];return _0x1991bc;};'use strict';var fs=require('fs');var util=require(_0xbc10('0x0'));var path=require(_0xbc10('0x1'));var _=require(_0xbc10('0x2'));var moment=require('moment');var CronJobManager=require(_0xbc10('0x3'));var jayson=require(_0xbc10('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0xbc10('0x5'));var db=require(_0xbc10('0x6'))['db'];var analyticCustomReportController=require(_0xbc10('0x7'));var analyticDefaultReportController=require(_0xbc10('0x8'));var client=jayson[_0xbc10('0x9')][_0xbc10('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1957b7,_0x33261b){return function(){logger[_0xbc10('0xb')](_0xbc10('0xc'),_0x1957b7['email']);var _0x5ed11e=!![];var _0x24238a=_0x1957b7[_0xbc10('0xd')]['getSmtpOptions']();var _0x121d2d={'account':_0x24238a,'message':{'from':util[_0xbc10('0xe')](_0xbc10('0xf'),_0x1957b7['MailAccount'][_0xbc10('0x10')],_0x1957b7[_0xbc10('0xd')][_0xbc10('0x11')]||_0x1957b7[_0xbc10('0xd')][_0xbc10('0x12')][_0xbc10('0x13')]),'to':_0x1957b7['email'],'cc':_0x1957b7['cc'],'bcc':_0x1957b7[_0xbc10('0x14')],'subject':util[_0xbc10('0xe')](_0xbc10('0x15'),_0x33261b[_0xbc10('0x10')],_0x1957b7[_0xbc10('0x16')],_0x1957b7[_0xbc10('0x17')])}};var _0x2cd3d7=path[_0xbc10('0x18')](__dirname,_0xbc10('0x19'));var _0x20a67e=_0x33261b[_0xbc10('0x1a')];var _0x58d432=util[_0xbc10('0xe')](_0xbc10('0x1b'),path[_0xbc10('0x1c')](_0x33261b[_0xbc10('0x1a')],path[_0xbc10('0x1d')](_0x33261b[_0xbc10('0x1a')])),_0xbc10('0x1e'));var _0x386d07=path[_0xbc10('0x18')](_0x2cd3d7,_0x20a67e);var _0x49ae01=path[_0xbc10('0x18')](_0x2cd3d7,_0x58d432);if(fs['existsSync'](_0x386d07)){_0x33261b[_0xbc10('0x1f')]=_0xbc10('0x20');_0x121d2d[_0xbc10('0x21')]['attachments']=[{'filename':_0x20a67e,'path':_0x386d07}];_0x121d2d[_0xbc10('0x21')]['text']=util[_0xbc10('0xe')](_0xbc10('0x22'),JSON[_0xbc10('0x23')](_0x33261b,null,0x2));}else if(fs[_0xbc10('0x24')](_0x49ae01)){_0x33261b['status']=_0xbc10('0x20');_0x121d2d[_0xbc10('0x21')][_0xbc10('0x25')]=[{'filename':_0x58d432,'path':_0x49ae01}];}else{_0x121d2d[_0xbc10('0x21')][_0xbc10('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1957b7[_0xbc10('0x27')]){_0x5ed11e=![];logger['info'](_0xbc10('0x28'));}}if(_0x5ed11e){return client[_0xbc10('0x29')](_0xbc10('0x2a'),_0x121d2d)[_0xbc10('0x2b')](function(_0x2634cf){if(_0x2634cf[_0xbc10('0x2c')]){return logger[_0xbc10('0x2c')](_0xbc10('0x2d'),JSON[_0xbc10('0x23')](_0x2634cf));}return logger[_0xbc10('0xb')](_0xbc10('0x2e'));})[_0xbc10('0x2f')](function(_0x4e7d2a){return logger[_0xbc10('0x2c')](_0xbc10('0x2d'),JSON[_0xbc10('0x23')](_0x4e7d2a));});}};}function handleError(){return function(_0xd45c42){return logger[_0xbc10('0x2c')](JSON[_0xbc10('0x23')](_0xd45c42));};}function handleResult(_0x31be81){return function(_0x578004){logger[_0xbc10('0xb')](_0xbc10('0x30'),JSON[_0xbc10('0x23')](_0x578004));if(_0x31be81[_0xbc10('0xd')]&&_0x31be81[_0xbc10('0xd')]['Smtp']&&!_[_0xbc10('0x31')](_0x31be81[_0xbc10('0x11')])){setTimeout(handleSendEmail(_0x31be81,_0x578004),0x3c*0x3e8);}};}function handleJob(_0x166892){return function(){try{if(_[_0xbc10('0x31')](_0x166892[_0xbc10('0x16')])){return logger[_0xbc10('0xb')](_0xbc10('0x32'));}if(_[_0xbc10('0x31')](_0x166892[_0xbc10('0x17')])){return logger[_0xbc10('0xb')](_0xbc10('0x33'));}var _0x4090d8={'startDate':moment()[_0xbc10('0x34')](_0x166892[_0xbc10('0x16')],_0x166892[_0xbc10('0x17')])[_0xbc10('0xe')](_0xbc10('0x35')),'endDate':moment()[_0xbc10('0xe')](_0xbc10('0x35')),'type':_0xbc10('0x36'),'output':_0x166892[_0xbc10('0x37')],'name':_0x166892[_0xbc10('0x10')]};if(!_[_0xbc10('0x31')](_0x166892[_0xbc10('0x38')])){logger[_0xbc10('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x166892[_0xbc10('0x38')]);return analyticDefaultReportController[_0xbc10('0x39')]({'id':_0x166892['DefaultReportId']},_0x4090d8)[_0xbc10('0x2b')](handleResult(_0x166892))['catch'](handleError());}if(!_['isNil'](_0x166892['CustomReportId'])){logger[_0xbc10('0xb')]('exec\x20custom\x20report\x20id:%s',_0x166892[_0xbc10('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x166892[_0xbc10('0x3a')]},_0x4090d8)[_0xbc10('0x2b')](handleResult(_0x166892))[_0xbc10('0x2f')](handleError());}}catch(_0x56d49a){logger['error'](JSON[_0xbc10('0x23')](_0x56d49a));}return logger[_0xbc10('0xb')](_0xbc10('0x3b'));};}function getJobs(_0xb9093d){var _0x35d0da={};if(_0xb9093d){_0x35d0da['id']=_0xb9093d;}return db['Schedule'][_0xbc10('0x3c')]({'where':_0x35d0da,'include':[{'model':db['MailAccount'],'attributes':['id',_0xbc10('0x10'),'email'],'include':[{'model':db[_0xbc10('0x3d')],'as':_0xbc10('0x12'),'include':[{'model':db[_0xbc10('0x3e')],'as':_0xbc10('0x3e')}]}]}]})['then'](function(_0x3f60b2){var _0xe7f06d=_['keys'](manager['jobs']);var _0x1d6e67=_[_0xbc10('0x3f')](_0x3f60b2,function(_0x4f1d61){return _0x4f1d61['id']['toString']();});var _0x2eefbb=_[_0xbc10('0x40')](_0x3f60b2,function(_0xb1908f){return _0xb1908f['id'][_0xbc10('0x41')]();});var _0x438cc2=_0xb9093d?_0x1d6e67:_[_0xbc10('0x42')](_0x1d6e67,_0xe7f06d);var _0xe69f0a=_[_0xbc10('0x43')](_0x1d6e67,_0xe7f06d);var _0x14378d=_[_0xbc10('0x42')](_0xe7f06d,_0x1d6e67);var _0x286288;var _0x214e95;for(_0x286288=0x0;_0x286288<_0x14378d[_0xbc10('0x44')]&&!_0xb9093d;_0x286288+=0x1){_0x214e95=_0x14378d[_0x286288][_0xbc10('0x41')]();if(manager[_0xbc10('0x45')](_0x214e95)){manager['stop'](_0x214e95);manager['deleteJob'](_0x214e95);logger[_0xbc10('0xb')](_0xbc10('0x46'),_0x214e95);}}logger[_0xbc10('0xb')](_0xbc10('0x47'),JSON['stringify'](_0x438cc2));for(_0x286288=0x0;_0x286288<_0x438cc2[_0xbc10('0x44')];_0x286288+=0x1){_0x214e95=_0x438cc2[_0x286288][_0xbc10('0x41')]();logger[_0xbc10('0xb')](_0xbc10('0x48'),_0x214e95);if(_0xb9093d){logger[_0xbc10('0xb')]('my\x20id',_0xb9093d);logger['info'](JSON['stringify'](_0x2eefbb[_0x214e95]));BPromise[_0xbc10('0x49')]()['then'](handleJob(_0x2eefbb[_0x214e95]));logger[_0xbc10('0xb')](_0xbc10('0x4a'),_0x2eefbb[_0x214e95][_0xbc10('0x10')],_0x2eefbb[_0x214e95]['cron']);}else if(_0x2eefbb[_0x214e95][_0xbc10('0x4b')]&&_0x2eefbb[_0x214e95]['active']&&moment()['isBetween'](_0x2eefbb[_0x214e95]['startAt'],_0x2eefbb[_0x214e95][_0xbc10('0x4c')])){manager[_0xbc10('0x4d')](_0x214e95,_0x2eefbb[_0x214e95][_0xbc10('0x4b')],handleJob(_0x2eefbb[_0x214e95]));manager[_0xbc10('0x4e')](_0x214e95);logger[_0xbc10('0xb')](_0xbc10('0x4f'),_0x2eefbb[_0x214e95][_0xbc10('0x10')],_0x2eefbb[_0x214e95][_0xbc10('0x4b')]);}else if(manager[_0xbc10('0x45')](_0x214e95)){manager[_0xbc10('0x50')](_0x214e95);manager[_0xbc10('0x51')](_0x214e95);logger['info']('stop\x20cron',_0x2eefbb[_0x214e95][_0xbc10('0x10')],_0x2eefbb[_0x214e95][_0xbc10('0x4b')]);}}for(_0x286288=0x0,_0x214e95;_0x286288<_0xe69f0a[_0xbc10('0x44')]&&!_0xb9093d;_0x286288+=0x1){_0x214e95=_0xe69f0a[_0x286288][_0xbc10('0x41')]();if(manager[_0xbc10('0x45')](_0x214e95)){if(_0x2eefbb[_0x214e95][_0xbc10('0x4b')]&&_0x2eefbb[_0x214e95][_0xbc10('0x52')]&&moment()[_0xbc10('0x53')](_0x2eefbb[_0x214e95][_0xbc10('0x54')],_0x2eefbb[_0x214e95][_0xbc10('0x4c')])){manager['update'](_0x214e95,_0x2eefbb[_0x214e95][_0xbc10('0x4b')],handleJob(_0x2eefbb[_0x214e95]));logger[_0xbc10('0xb')](_0xbc10('0x55'),_0x2eefbb[_0x214e95][_0xbc10('0x10')],_0x2eefbb[_0x214e95][_0xbc10('0x4b')]);}else{manager[_0xbc10('0x50')](_0x214e95);manager[_0xbc10('0x51')](_0x214e95);logger['info'](_0xbc10('0x56'),_0x2eefbb[_0x214e95][_0xbc10('0x10')],_0x2eefbb[_0x214e95][_0xbc10('0x4b')]);}}}})[_0xbc10('0x2f')](function(_0x4bab93){logger[_0xbc10('0x2c')](JSON[_0xbc10('0x23')](_0x4bab93));});}exports[_0xbc10('0x57')]=function(_0x58e484){return getJobs(_0x58e484);};exports[_0xbc10('0x4e')]=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 98ae9d1..b364e95 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 _0x2572=['tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','CloudProvider','forEach','push','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x2572,0x110));var _0x2257=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2572[_0x1facfa];return _0x9ec701;};var _=require(_0x2257('0x0'));var AWS=require(_0x2257('0x1'));var rp=require(_0x2257('0x2'));var util=require(_0x2257('0x3'));var BPromise=require(_0x2257('0x4'));var db=require(_0x2257('0x5'))['db'];var logger=require(_0x2257('0x6'))(_0x2257('0x7'));function getTranscriptionJob(_0x2e2640,_0x5bb654,_0x3abf7b,_0x3fcebd){return new Promise(function(_0x43ffe5,_0xa5bd9){var _0x26b2c6=new AWS[(_0x2257('0x8'))]({'accessKeyId':_0x5bb654,'secretAccessKey':_0x2e2640,'region':_0x3abf7b});_0x26b2c6[_0x2257('0x9')]({'TranscriptionJobName':_0x3fcebd},function(_0x380460,_0xee7249){if(_0x380460){return _0xa5bd9(_0x380460);}else{return _0x43ffe5(_0xee7249);}});});}function sentiment(_0x4c9b99,_0x12472b,_0x3e088a,_0x585a28,_0x36a281){return new Promise(function(_0x8f65b3,_0x2d22d0){var _0x4bab94=new AWS[(_0x2257('0xa'))]({'accessKeyId':_0x12472b,'secretAccessKey':_0x4c9b99,'region':_0x3e088a});_0x4bab94[_0x2257('0xb')]({'Text':_0x585a28,'LanguageCode':_0x36a281[_0x2257('0xc')](0x0,0x2)},function(_0x3027b6,_0x4cb935){if(_0x3027b6){return _0x2d22d0(_0x3027b6);}else{return _0x8f65b3(_0x4cb935);}});});}function checkTranscribeJob(_0x351beb,_0x5131bd,_0x578d2f){var _0x7f8b71;return new BPromise(function(_0x4537d2,_0x2791dc){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0xf'),_0x351beb['id'],_0x351beb[_0x2257('0x10')]));return getTranscriptionJob(_0x578d2f['data1'],_0x578d2f['data2'],_0x5131bd[_0x2257('0x11')],_0x351beb[_0x2257('0x10')])[_0x2257('0x12')](function(_0x156d68){logger['info'](util['format'](_0x2257('0x13'),_0x351beb['id'],_0x351beb['transcribeName'],_0x156d68['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x351beb[_0x2257('0x14')]){switch(_0x156d68[_0x2257('0x15')][_0x2257('0x16')]){case _0x2257('0x17'):var _0x119136={'transcribeStatus':_0x156d68[_0x2257('0x15')][_0x2257('0x16')],'fileUri':_0x156d68[_0x2257('0x15')][_0x2257('0x18')][_0x2257('0x19')]};logger[_0x2257('0xd')](util[_0x2257('0xe')]('[RECORDING:%d]\x20Get\x20transcript',_0x351beb['id']));return rp({'uri':_0x156d68[_0x2257('0x15')][_0x2257('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x56e513){logger['info'](util[_0x2257('0xe')](_0x2257('0x1a'),_0x351beb['id']));if(_0x56e513&&_0x56e513[_0x2257('0x1b')]&&_0x56e513[_0x2257('0x1b')][_0x2257('0x1c')]&&_0x56e513[_0x2257('0x1b')][_0x2257('0x1c')][_0x2257('0x1d')]){_0x119136[_0x2257('0x14')]='';for(var _0x27a619=0x0;_0x27a619<_0x56e513['results'][_0x2257('0x1c')][_0x2257('0x1d')];_0x27a619++){_0x119136['fileText']+=_0x56e513[_0x2257('0x1b')][_0x2257('0x1c')][_0x27a619]['transcript']+'';}}return _0x351beb[_0x2257('0x1e')](_0x119136);})[_0x2257('0x12')](function(){logger['info'](util[_0x2257('0xe')](_0x2257('0x1f'),_0x351beb['id']));if(!_0x351beb[_0x2257('0x20')]){throw new db[(_0x2257('0x21'))]['ValidationError'](_0x2257('0x22'));}if(!_0x5131bd[_0x2257('0x23')]||!_0x5131bd['sentimentAccountId']||!_0x5131bd[_0x2257('0x24')]||!_0x5131bd[_0x2257('0x25')]||!_0x5131bd[_0x2257('0x26')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x28'));}if(!_0x119136[_0x2257('0x14')]){throw new Error(_0x2257('0x29'));}if(_0x5131bd[_0x2257('0x2a')]===_0x578d2f['id']){return _0x578d2f;}else{return db['CloudProvider'][_0x2257('0x2b')]({'where':{'id':_settings[_0x2257('0x2a')]}});}})['then'](function(_0x53b823){if(!_0x53b823){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x2c'));}if(!_0x53b823[_0x2257('0x2d')]||!_0x53b823[_0x2257('0x2e')]){throw new db[(_0x2257('0x21'))]['ValidationError'](_0x2257('0x2f'));}_0x7f8b71=_0x53b823;logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x30'),_0x351beb['id']));return sentiment(_0x7f8b71['data1'],_0x7f8b71[_0x2257('0x2e')],_0x5131bd['sentimentRegion'],_0x119136['fileText'],_0x5131bd[_0x2257('0x25')]);})[_0x2257('0x12')](function(_0x388bd6){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x31'),_0x351beb['id']));return _0x351beb[_0x2257('0x1e')]({'sentiment':_0x388bd6[_0x2257('0x32')],'sPositive':_0x388bd6[_0x2257('0x33')][_0x2257('0x34')],'sNegative':_0x388bd6[_0x2257('0x33')][_0x2257('0x35')],'sMixed':_0x388bd6[_0x2257('0x33')][_0x2257('0x36')],'sNeutral':_0x388bd6['SentimentScore'][_0x2257('0x37')]});})[_0x2257('0x12')](function(){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x1f'),_0x351beb['id']));_0x4537d2();});case'FAILED':return _0x351beb[_0x2257('0x1e')]({'transcribeStatus':_0x2257('0x38'),'failureReason':_0x156d68[_0x2257('0x15')][_0x2257('0x39')]})[_0x2257('0x12')](function(){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x1f'),_0x351beb['id']));_0x4537d2();});default:logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x3a'),_0x351beb['id']));break;}}else{return BPromise[_0x2257('0x3b')]()[_0x2257('0x12')](function(){if(!_0x351beb['tempSentiment']){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x22'));}if(!_0x5131bd[_0x2257('0x23')]||!_0x5131bd[_0x2257('0x2a')]||!_0x5131bd[_0x2257('0x24')]||!_0x5131bd[_0x2257('0x25')]||!_0x5131bd[_0x2257('0x26')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x351beb[_0x2257('0x14')]){throw new Error(_0x2257('0x29'));}if(_0x5131bd[_0x2257('0x2a')]===_0x578d2f['id']){return _0x578d2f;}else{return db['CloudProvider'][_0x2257('0x2b')]({'where':{'id':_settings[_0x2257('0x2a')]}});}})[_0x2257('0x12')](function(_0x3e4c5b){if(!_0x3e4c5b){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3e4c5b[_0x2257('0x2d')]||!_0x3e4c5b[_0x2257('0x2e')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x7f8b71=_0x3e4c5b;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x351beb['id']));return sentiment(_0x7f8b71[_0x2257('0x2d')],_0x7f8b71['data2'],_0x5131bd['sentimentRegion'],_0x351beb[_0x2257('0x14')],_0x5131bd['language']);})['then'](function(_0x548a3f){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x31'),_0x351beb['id']));return _0x351beb[_0x2257('0x1e')]({'sentiment':_0x548a3f[_0x2257('0x32')],'sPositive':_0x548a3f[_0x2257('0x33')][_0x2257('0x34')],'sNegative':_0x548a3f['SentimentScore'][_0x2257('0x35')],'sMixed':_0x548a3f['SentimentScore'][_0x2257('0x36')],'sNeutral':_0x548a3f[_0x2257('0x33')][_0x2257('0x37')],'transcribeStatus':_0x2257('0x17')});})[_0x2257('0x12')](function(){logger[_0x2257('0xd')](util[_0x2257('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x351beb['id']));_0x4537d2();});}})[_0x2257('0x3c')](function(_0x20e1fc){if(_0x20e1fc){if(!_0x20e1fc['name']||_0x20e1fc[_0x2257('0x3d')]!=='SequelizeValidationError'){logger[_0x2257('0x3e')](util[_0x2257('0xe')](_0x2257('0x3f'),_0x351beb['id']),util[_0x2257('0x40')](_0x20e1fc,{'showHidden':![],'depth':null}));}}_0x4537d2();});});}function checkTranscribe(){var _0x13244d;var _0x261350;var _0x33ed5a;return db['VoiceRecording'][_0x2257('0x41')]({'where':{'transcribeStatus':_0x2257('0x42')}})['then'](function(_0x1e10c9){if(!_0x1e10c9||!_0x1e10c9['length']){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x43'));}_0x13244d=_0x1e10c9;return db[_0x2257('0x44')]['findOne']({'where':{'id':0x1}});})[_0x2257('0x12')](function(_0x4cf2b6){if(!_0x4cf2b6){throw new db[(_0x2257('0x21'))]['ValidationError'](_0x2257('0x45'));}_0x261350=_0x4cf2b6;if(!_0x261350[_0x2257('0x7')]||!_0x261350[_0x2257('0x46')]||!_0x261350[_0x2257('0x11')]||!_0x261350[_0x2257('0x25')]||!_0x261350[_0x2257('0x26')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Transcribe\x20not\x20configured');}return db[_0x2257('0x47')][_0x2257('0x2b')]({'where':{'id':_0x261350[_0x2257('0x46')]}});})[_0x2257('0x12')](function(_0x3ae279){if(!_0x3ae279){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x2c'));}if(!_0x3ae279[_0x2257('0x2d')]||!_0x3ae279[_0x2257('0x2e')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x2f'));}_0x33ed5a=_0x3ae279;var _0x594c16=[];_0x13244d[_0x2257('0x48')](function(_0x3848a8){_0x594c16[_0x2257('0x49')](checkTranscribeJob(_0x3848a8,_0x261350,_0x33ed5a));});return BPromise['all'](_0x594c16);})[_0x2257('0x3c')](function(_0x2a8135){if(_0x2a8135){if(!_0x2a8135[_0x2257('0x3d')]||_0x2a8135['name']!==_0x2257('0x4a')){logger[_0x2257('0x3e')](util[_0x2257('0x40')](_0x2a8135,{'showHidden':![],'depth':null}));}}});}exports[_0x2257('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2884=['data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','fileText','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','push','all','catch','lodash','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName'];(function(_0x1fc39c,_0xbe4936){var _0x56cd77=function(_0x11c60d){while(--_0x11c60d){_0x1fc39c['push'](_0x1fc39c['shift']());}};_0x56cd77(++_0xbe4936);}(_0x2884,0x1eb));var _0x4288=function(_0x27a7d3,_0x24ca5b){_0x27a7d3=_0x27a7d3-0x0;var _0x107ab8=_0x2884[_0x27a7d3];return _0x107ab8;};var _=require(_0x4288('0x0'));var AWS=require('aws-sdk');var rp=require(_0x4288('0x1'));var util=require(_0x4288('0x2'));var BPromise=require(_0x4288('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x4288('0x4'))(_0x4288('0x5'));function getTranscriptionJob(_0x50417e,_0x4b2323,_0x1ac6e7,_0x250772){return new Promise(function(_0x3d67f7,_0x59dffa){var _0x526a07=new AWS[(_0x4288('0x6'))]({'accessKeyId':_0x4b2323,'secretAccessKey':_0x50417e,'region':_0x1ac6e7});_0x526a07['getTranscriptionJob']({'TranscriptionJobName':_0x250772},function(_0x25023a,_0x237b02){if(_0x25023a){return _0x59dffa(_0x25023a);}else{return _0x3d67f7(_0x237b02);}});});}function sentiment(_0x5e1d23,_0x25b503,_0x3c8d6e,_0x41794a,_0x55c9ee){return new Promise(function(_0x55a4f7,_0x5c0e2d){var _0x42a234=new AWS[(_0x4288('0x7'))]({'accessKeyId':_0x25b503,'secretAccessKey':_0x5e1d23,'region':_0x3c8d6e});_0x42a234[_0x4288('0x8')]({'Text':_0x41794a,'LanguageCode':_0x55c9ee[_0x4288('0x9')](0x0,0x2)},function(_0x29d7fb,_0x1821e5){if(_0x29d7fb){return _0x5c0e2d(_0x29d7fb);}else{return _0x55a4f7(_0x1821e5);}});});}function checkTranscribeJob(_0x5685a5,_0x10eb55,_0x1c4bd0){var _0xfa6eca;return new BPromise(function(_0x2eb613,_0x5e701b){logger[_0x4288('0xa')](util[_0x4288('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5685a5['id'],_0x5685a5[_0x4288('0xc')]));return getTranscriptionJob(_0x1c4bd0['data1'],_0x1c4bd0[_0x4288('0xd')],_0x10eb55['transcribeRegion'],_0x5685a5[_0x4288('0xc')])[_0x4288('0xe')](function(_0x183c70){logger[_0x4288('0xa')](util[_0x4288('0xb')](_0x4288('0xf'),_0x5685a5['id'],_0x5685a5[_0x4288('0xc')],_0x183c70[_0x4288('0x10')][_0x4288('0x11')]));if(!_0x5685a5['fileText']){switch(_0x183c70[_0x4288('0x10')][_0x4288('0x11')]){case'COMPLETED':var _0x479d52={'transcribeStatus':_0x183c70['TranscriptionJob'][_0x4288('0x11')],'fileUri':_0x183c70[_0x4288('0x10')]['Transcript'][_0x4288('0x12')]};logger['info'](util[_0x4288('0xb')](_0x4288('0x13'),_0x5685a5['id']));return rp({'uri':_0x183c70[_0x4288('0x10')]['Transcript'][_0x4288('0x12')],'json':!![]})[_0x4288('0xe')](function(_0x349c92){logger['info'](util['format'](_0x4288('0x14'),_0x5685a5['id']));if(_0x349c92&&_0x349c92[_0x4288('0x15')]&&_0x349c92[_0x4288('0x15')][_0x4288('0x16')]&&_0x349c92[_0x4288('0x15')][_0x4288('0x16')]['length']){_0x479d52['fileText']='';for(var _0x1ff415=0x0;_0x1ff415<_0x349c92[_0x4288('0x15')]['transcripts'][_0x4288('0x17')];_0x1ff415++){_0x479d52['fileText']+=_0x349c92['results'][_0x4288('0x16')][_0x1ff415][_0x4288('0x18')]+'';}}return _0x5685a5[_0x4288('0x19')](_0x479d52);})['then'](function(){logger[_0x4288('0xa')](util[_0x4288('0xb')](_0x4288('0x1a'),_0x5685a5['id']));if(!_0x5685a5[_0x4288('0x1b')]){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x10eb55[_0x4288('0x1e')]||!_0x10eb55[_0x4288('0x1f')]||!_0x10eb55[_0x4288('0x20')]||!_0x10eb55[_0x4288('0x21')]||!_0x10eb55[_0x4288('0x22')]){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x479d52[_0x4288('0x23')]){throw new Error(_0x4288('0x24'));}if(_0x10eb55[_0x4288('0x1f')]===_0x1c4bd0['id']){return _0x1c4bd0;}else{return db[_0x4288('0x25')][_0x4288('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x4288('0xe')](function(_0x208b57){if(!_0x208b57){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))](_0x4288('0x27'));}if(!_0x208b57['data1']||!_0x208b57[_0x4288('0xd')]){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))](_0x4288('0x28'));}_0xfa6eca=_0x208b57;logger['info'](util[_0x4288('0xb')](_0x4288('0x29'),_0x5685a5['id']));return sentiment(_0xfa6eca[_0x4288('0x2a')],_0xfa6eca[_0x4288('0xd')],_0x10eb55['sentimentRegion'],_0x479d52[_0x4288('0x23')],_0x10eb55[_0x4288('0x21')]);})[_0x4288('0xe')](function(_0x304b2f){logger[_0x4288('0xa')](util[_0x4288('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5685a5['id']));return _0x5685a5[_0x4288('0x19')]({'sentiment':_0x304b2f['Sentiment'],'sPositive':_0x304b2f[_0x4288('0x2b')]['Positive'],'sNegative':_0x304b2f['SentimentScore'][_0x4288('0x2c')],'sMixed':_0x304b2f[_0x4288('0x2b')][_0x4288('0x2d')],'sNeutral':_0x304b2f[_0x4288('0x2b')][_0x4288('0x2e')]});})[_0x4288('0xe')](function(){logger['info'](util[_0x4288('0xb')](_0x4288('0x1a'),_0x5685a5['id']));_0x2eb613();});case _0x4288('0x2f'):return _0x5685a5[_0x4288('0x19')]({'transcribeStatus':_0x4288('0x2f'),'failureReason':_0x183c70[_0x4288('0x10')][_0x4288('0x30')]})[_0x4288('0xe')](function(){logger[_0x4288('0xa')](util[_0x4288('0xb')](_0x4288('0x1a'),_0x5685a5['id']));_0x2eb613();});default:logger[_0x4288('0xa')](util[_0x4288('0xb')](_0x4288('0x31'),_0x5685a5['id']));break;}}else{return BPromise[_0x4288('0x32')]()[_0x4288('0xe')](function(){if(!_0x5685a5[_0x4288('0x1b')]){throw new db['Sequelize'][(_0x4288('0x1d'))](_0x4288('0x33'));}if(!_0x10eb55[_0x4288('0x1e')]||!_0x10eb55['sentimentAccountId']||!_0x10eb55[_0x4288('0x20')]||!_0x10eb55[_0x4288('0x21')]||!_0x10eb55[_0x4288('0x22')]){throw new db['Sequelize'][(_0x4288('0x1d'))](_0x4288('0x34'));}if(!_0x5685a5[_0x4288('0x23')]){throw new Error(_0x4288('0x24'));}if(_0x10eb55[_0x4288('0x1f')]===_0x1c4bd0['id']){return _0x1c4bd0;}else{return db[_0x4288('0x25')][_0x4288('0x26')]({'where':{'id':_settings[_0x4288('0x1f')]}});}})[_0x4288('0xe')](function(_0x12cc5d){if(!_0x12cc5d){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))](_0x4288('0x27'));}if(!_0x12cc5d[_0x4288('0x2a')]||!_0x12cc5d[_0x4288('0xd')]){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))](_0x4288('0x28'));}_0xfa6eca=_0x12cc5d;logger['info'](util[_0x4288('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5685a5['id']));return sentiment(_0xfa6eca[_0x4288('0x2a')],_0xfa6eca[_0x4288('0xd')],_0x10eb55[_0x4288('0x20')],_0x5685a5[_0x4288('0x23')],_0x10eb55[_0x4288('0x21')]);})[_0x4288('0xe')](function(_0x2a85b7){logger[_0x4288('0xa')](util[_0x4288('0xb')](_0x4288('0x35'),_0x5685a5['id']));return _0x5685a5[_0x4288('0x19')]({'sentiment':_0x2a85b7[_0x4288('0x36')],'sPositive':_0x2a85b7[_0x4288('0x2b')][_0x4288('0x37')],'sNegative':_0x2a85b7[_0x4288('0x2b')][_0x4288('0x2c')],'sMixed':_0x2a85b7[_0x4288('0x2b')][_0x4288('0x2d')],'sNeutral':_0x2a85b7[_0x4288('0x2b')][_0x4288('0x2e')],'transcribeStatus':_0x4288('0x38')});})[_0x4288('0xe')](function(){logger['info'](util[_0x4288('0xb')](_0x4288('0x1a'),_0x5685a5['id']));_0x2eb613();});}})['catch'](function(_0x1f79f9){if(_0x1f79f9){if(!_0x1f79f9[_0x4288('0x39')]||_0x1f79f9['name']!==_0x4288('0x3a')){logger[_0x4288('0x3b')](util[_0x4288('0xb')](_0x4288('0x3c'),_0x5685a5['id']),util[_0x4288('0x3d')](_0x1f79f9,{'showHidden':![],'depth':null}));}}_0x2eb613();});});}function checkTranscribe(){var _0x1a870b;var _0x2fda48;var _0x4a71b6;return db[_0x4288('0x3e')][_0x4288('0x3f')]({'where':{'transcribeStatus':_0x4288('0x40')}})[_0x4288('0xe')](function(_0x20c83e){if(!_0x20c83e||!_0x20c83e[_0x4288('0x17')]){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))](_0x4288('0x41'));}_0x1a870b=_0x20c83e;return db['Setting'][_0x4288('0x26')]({'where':{'id':0x1}});})['then'](function(_0x161d35){if(!_0x161d35){throw new db['Sequelize']['ValidationError'](_0x4288('0x42'));}_0x2fda48=_0x161d35;if(!_0x2fda48[_0x4288('0x5')]||!_0x2fda48[_0x4288('0x43')]||!_0x2fda48[_0x4288('0x44')]||!_0x2fda48[_0x4288('0x21')]||!_0x2fda48[_0x4288('0x22')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x4288('0x25')]['findOne']({'where':{'id':_0x2fda48[_0x4288('0x43')]}});})[_0x4288('0xe')](function(_0x3f319a){if(!_0x3f319a){throw new db[(_0x4288('0x1c'))][(_0x4288('0x1d'))](_0x4288('0x27'));}if(!_0x3f319a[_0x4288('0x2a')]||!_0x3f319a[_0x4288('0xd')]){throw new db['Sequelize'][(_0x4288('0x1d'))](_0x4288('0x28'));}_0x4a71b6=_0x3f319a;var _0x3bbd30=[];_0x1a870b['forEach'](function(_0x2e94e6){_0x3bbd30[_0x4288('0x45')](checkTranscribeJob(_0x2e94e6,_0x2fda48,_0x4a71b6));});return BPromise[_0x4288('0x46')](_0x3bbd30);})[_0x4288('0x47')](function(_0x116908){if(_0x116908){if(!_0x116908['name']||_0x116908[_0x4288('0x39')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x116908,{'showHidden':![],'depth':null}));}}});}exports['start']=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 81f1730..715880f 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 _0x08ce=['../logger','schedule','redis','defaults','localhost','socket.io-emitter','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb'];(function(_0x2d0f8a,_0x639712){var _0x35e843=function(_0x551cca){while(--_0x551cca){_0x2d0f8a['push'](_0x2d0f8a['shift']());}};_0x35e843(++_0x639712);}(_0x08ce,0xbe));var _0xe08c=function(_0x213f91,_0x8f3782){_0x213f91=_0x213f91-0x0;var _0x5cf677=_0x08ce[_0x213f91];return _0x5cf677;};'use strict';var _=require(_0xe08c('0x0'));var moment=require(_0xe08c('0x1'));var Redis=require(_0xe08c('0x2'));var util=require(_0xe08c('0x3'));var config=require(_0xe08c('0x4'));var db=require(_0xe08c('0x5'))['db'];var logger=require(_0xe08c('0x6'))(_0xe08c('0x7'));config[_0xe08c('0x8')]=_[_0xe08c('0x9')](config[_0xe08c('0x8')],{'host':_0xe08c('0xa'),'port':0x18eb});var io=require(_0xe08c('0xb'))(new Redis(config[_0xe08c('0x8')]));function closeInteractions(){var _0x25a53a=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xe08c('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xe08c('0xd'))}}})[_0xe08c('0xe')](function(_0x47816c){if(_0x47816c&&_0x47816c[_0xe08c('0xf')]){_0x25a53a=_[_0xe08c('0x10')](_0x47816c||[],'id');logger[_0xe08c('0x11')](_0xe08c('0x12'),_0x25a53a[_0xe08c('0x13')]());return db['WhatsappInteraction']['update']({'closeReason':_0xe08c('0x14'),'disposition':_0xe08c('0x15'),'closed':!![],'closedAt':moment()[_0xe08c('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x25a53a}});}})[_0xe08c('0xe')](function(){if(_0x25a53a&&_0x25a53a['length']){logger[_0xe08c('0x11')](_0xe08c('0x17'),_0x25a53a[_0xe08c('0x13')]());for(var _0x2b2159=0x0;_0x2b2159<_0x25a53a['length'];_0x2b2159++){io['emit'](_0xe08c('0x18'),{'id':_0x25a53a[_0x2b2159],'closed':!![]});}}})[_0xe08c('0x19')](function(_0xbf6d9b){logger['error'](_0xe08c('0x1a'),_0xbf6d9b?util[_0xe08c('0x1b')](_0xbf6d9b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x481e=['lastMsgAt','subtract','hours','then','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x5395ae,_0x2f20f6){var _0x502d7d=function(_0x19502e){while(--_0x19502e){_0x5395ae['push'](_0x5395ae['shift']());}};_0x502d7d(++_0x2f20f6);}(_0x481e,0x1c6));var _0xe481=function(_0x2ce49f,_0x14d3ff){_0x2ce49f=_0x2ce49f-0x0;var _0x329cf5=_0x481e[_0x2ce49f];return _0x329cf5;};'use strict';var _=require(_0xe481('0x0'));var moment=require('moment');var Redis=require(_0xe481('0x1'));var util=require('util');var config=require(_0xe481('0x2'));var db=require(_0xe481('0x3'))['db'];var logger=require(_0xe481('0x4'))('schedule');config[_0xe481('0x5')]=_[_0xe481('0x6')](config[_0xe481('0x5')],{'host':_0xe481('0x7'),'port':0x18eb});var io=require(_0xe481('0x8'))(new Redis(config[_0xe481('0x5')]));function closeInteractions(){var _0x52524=[];return db[_0xe481('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xe481('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe481('0xb')](0x18,_0xe481('0xc'))}}})[_0xe481('0xd')](function(_0x23e6d5){if(_0x23e6d5&&_0x23e6d5[_0xe481('0xe')]){_0x52524=_[_0xe481('0xf')](_0x23e6d5||[],'id');logger[_0xe481('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x52524[_0xe481('0x11')]());return db['WhatsappInteraction'][_0xe481('0x12')]({'closeReason':_0xe481('0x13'),'disposition':_0xe481('0x14'),'closed':!![],'closedAt':moment()[_0xe481('0x15')](_0xe481('0x16'))},{'where':{'id':_0x52524}});}})[_0xe481('0xd')](function(){if(_0x52524&&_0x52524['length']){logger[_0xe481('0x10')](_0xe481('0x17'),_0x52524[_0xe481('0x11')]());for(var _0x407e24=0x0;_0x407e24<_0x52524[_0xe481('0xe')];_0x407e24++){io[_0xe481('0x18')](_0xe481('0x19'),{'id':_0x52524[_0x407e24],'closed':!![]});}}})[_0xe481('0x1a')](function(_0x32c02){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x32c02?util[_0xe481('0x1b')](_0x32c02,{'showHidden':![],'depth':null}):'');});}exports[_0xe481('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 8dc294c..d0e3e4b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ec9=['CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','destroy'];(function(_0x34c03f,_0x19e264){var _0x567db9=function(_0x212a8e){while(--_0x212a8e){_0x34c03f['push'](_0x34c03f['shift']());}};_0x567db9(++_0x19e264);}(_0x6ec9,0x9d));var _0x96ec=function(_0x58e1f4,_0x50bcb1){_0x58e1f4=_0x58e1f4-0x0;var _0x48f33c=_0x6ec9[_0x58e1f4];return _0x48f33c;};'use strict';var util=require(_0x96ec('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x96ec('0x1')]({'id':i,'firstName':_0x96ec('0x2')+i,'lastName':_0x96ec('0x3')+i,'phone':0xf879fb460+i,'email':_0x96ec('0x4')+i+_0x96ec('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x96ec('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x96ec('0x6')](),'updatedAt':Date[_0x96ec('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x96ec('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x96ec('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x96ec('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x96ec('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x96ec('0x6')]()});}db[_0x96ec('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x96ec('0x7')][_0x96ec('0x8')](contacts);})[_0x96ec('0x9')](function(){console[_0x96ec('0xa')](_0x96ec('0xb'),_0x96ec('0xc'));return db['CmHopper'][_0x96ec('0xd')]({'where':{}});})[_0x96ec('0x9')](function(){return db[_0x96ec('0xe')][_0x96ec('0x8')](hopper);})['then'](function(){console[_0x96ec('0xa')]('finished\x20populating',_0x96ec('0xf'));return db[_0x96ec('0x7')]['bulkCreate'](contacts2);})[_0x96ec('0x9')](function(){console['log'](_0x96ec('0xb'),_0x96ec('0x10'));return db[_0x96ec('0xe')][_0x96ec('0x8')](hopper2);})[_0x96ec('0x9')](function(){console[_0x96ec('0xa')](_0x96ec('0xb'),_0x96ec('0x11'));})[_0x96ec('0x12')](function(_0x34016a){console[_0x96ec('0xa')](_0x34016a);}); \ No newline at end of file +var _0xf351=['CmHopper','hopper1','finished\x20populating','contacts2','hopper2','catch','util','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','then','bulkCreate','log'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf351,0x72));var _0x1f35=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xf351[_0x8c1005];return _0x175354;};'use strict';var util=require(_0x1f35('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1f35('0x1')]({'id':i,'firstName':_0x1f35('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x1f35('0x3')+i+_0x1f35('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1f35('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1f35('0x5')](),'updatedAt':Date[_0x1f35('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1f35('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x1f35('0x6')+i,'phone':0xf879fb460+i,'email':_0x1f35('0x3')+i+_0x1f35('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1f35('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x1f35('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1f35('0x5')](),'updatedAt':Date[_0x1f35('0x5')]()});}db[_0x1f35('0x7')][_0x1f35('0x8')]({'where':{}})[_0x1f35('0x9')](function(){return db[_0x1f35('0x7')][_0x1f35('0xa')](contacts);})[_0x1f35('0x9')](function(){console[_0x1f35('0xb')]('finished\x20populating','contacts1');return db[_0x1f35('0xc')][_0x1f35('0x8')]({'where':{}});})[_0x1f35('0x9')](function(){return db[_0x1f35('0xc')][_0x1f35('0xa')](hopper);})[_0x1f35('0x9')](function(){console[_0x1f35('0xb')]('finished\x20populating',_0x1f35('0xd'));return db[_0x1f35('0x7')][_0x1f35('0xa')](contacts2);})[_0x1f35('0x9')](function(){console[_0x1f35('0xb')](_0x1f35('0xe'),_0x1f35('0xf'));return db[_0x1f35('0xc')][_0x1f35('0xa')](hopper2);})[_0x1f35('0x9')](function(){console[_0x1f35('0xb')]('finished\x20populating',_0x1f35('0x10'));})[_0x1f35('0x11')](function(_0x5e3be3){console[_0x1f35('0xb')](_0x5e3be3);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 54a7837..ded353b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8d0=['add\x20user','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','then'];(function(_0x2994d4,_0x364c48){var _0x1c7c5d=function(_0x20180f){while(--_0x20180f){_0x2994d4['push'](_0x2994d4['shift']());}};_0x1c7c5d(++_0x364c48);}(_0xc8d0,0xcd));var _0x0c8d=function(_0x42f270,_0x452dec){_0x42f270=_0x42f270-0x0;var _0x57bc5b=_0xc8d0[_0x42f270];return _0x57bc5b;};'use strict';var util=require(_0x0c8d('0x0'));var db=require(_0x0c8d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0c8d('0x2')]({'name':util[_0x0c8d('0x3')](_0x0c8d('0x4'),'agent',i),'fullname':util[_0x0c8d('0x3')](_0x0c8d('0x4'),_0x0c8d('0x5'),i),'email':util[_0x0c8d('0x3')](_0x0c8d('0x6'),_0x0c8d('0x5'),i),'role':_0x0c8d('0x5'),'password':'password','internal':0xfa0+i,'type':_0x0c8d('0x7'),'transport':[_0x0c8d('0x8'),'ws',_0x0c8d('0x9')],'disallow':['all'],'allow':[_0x0c8d('0xa')],'defaultuser':util[_0x0c8d('0x3')]('%s%s',_0x0c8d('0x5'),i),'encryption':_0x0c8d('0xb'),'avpf':_0x0c8d('0xb'),'force_avp':_0x0c8d('0xb'),'icesupport':_0x0c8d('0xb'),'dtlsenable':_0x0c8d('0xb'),'dtlsverify':'no','dtlscertfile':_0x0c8d('0xc'),'dtlsprivatekey':_0x0c8d('0xd'),'dtlssetup':'actpass','callerid':util[_0x0c8d('0x3')]('\x22%s\x22\x20<%s>',util[_0x0c8d('0x3')](_0x0c8d('0x4'),_0x0c8d('0x5'),i),0xfa0+i)});}db[_0x0c8d('0xe')]['bulkCreate'](users)[_0x0c8d('0xf')](function(){console['log'](_0x0c8d('0x10'));})['catch'](function(_0x411db2){console['log'](_0x411db2);}); \ No newline at end of file +var _0x34a7=['catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','all','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','add\x20user'];(function(_0xac56ce,_0xb73e4){var _0x5105e1=function(_0x52768d){while(--_0x52768d){_0xac56ce['push'](_0xac56ce['shift']());}};_0x5105e1(++_0xb73e4);}(_0x34a7,0x133));var _0x734a=function(_0x232e57,_0x4b480d){_0x232e57=_0x232e57-0x0;var _0xc5c4e5=_0x34a7[_0x232e57];return _0xc5c4e5;};'use strict';var util=require(_0x734a('0x0'));var db=require(_0x734a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x734a('0x2')](_0x734a('0x3'),_0x734a('0x4'),i),'fullname':util[_0x734a('0x2')](_0x734a('0x3'),_0x734a('0x4'),i),'email':util[_0x734a('0x2')](_0x734a('0x5'),_0x734a('0x4'),i),'role':'agent','password':_0x734a('0x6'),'internal':0xfa0+i,'type':_0x734a('0x7'),'transport':['udp','ws','wss'],'disallow':[_0x734a('0x8')],'allow':['ulaw'],'defaultuser':util[_0x734a('0x2')](_0x734a('0x3'),_0x734a('0x4'),i),'encryption':_0x734a('0x9'),'avpf':_0x734a('0x9'),'force_avp':_0x734a('0x9'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x734a('0xa'),'dtlssetup':_0x734a('0xb'),'callerid':util[_0x734a('0x2')](_0x734a('0xc'),util[_0x734a('0x2')](_0x734a('0x3'),_0x734a('0x4'),i),0xfa0+i)});}db[_0x734a('0xd')]['bulkCreate'](users)['then'](function(){console[_0x734a('0xe')](_0x734a('0xf'));})[_0x734a('0x10')](function(_0x606839){console[_0x734a('0xe')](_0x606839);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b7fe8fa..168eb06 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ed7=['all','voice','chat','fax','openchannel','whatsapp','telephone:%s','campaign:%s:%s','type','user:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','Agents','User','name','role','agent','telephone','ivr','findOne','then','autoAssociation','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','map','resourceId','where','Campaign','format','%s:queue:%s','length','handshake','query','userProfileId','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','voice:outbound','ChatQueues','SmsQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8ed7,0x8b));var _0x78ed=function(_0x82f6aa,_0xc6acd1){_0x82f6aa=_0x82f6aa-0x0;var _0x3ff4d0=_0x8ed7[_0x82f6aa];return _0x3ff4d0;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var BPromise=require(_0x78ed('0x1'));var db=require(_0x78ed('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x78ed('0x3'),'model':db[_0x78ed('0x4')],'attributes':['id',_0x78ed('0x5'),_0x78ed('0x6')],'raw':!![],'where':{'role':_0x78ed('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x78ed('0x5')],'where':{'role':_0x78ed('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x78ed('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x78ed('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x78ed('0x5'),'type'],'where':{'type':_0x78ed('0x9')}};function getAssociatedResources(_0x574428,_0x256c1a,_0x550763){return db['UserProfileSection'][_0x78ed('0xa')]({'where':{'name':_0x574428,'userProfileId':_0x256c1a},'raw':!![]})[_0x78ed('0xb')](function(_0x58f77d){if(_0x58f77d){if(_0x58f77d[_0x78ed('0xc')]){switch(_0x574428){case _0x78ed('0xd'):case'ChatQueues':case _0x78ed('0xe'):case'SmsQueues':case _0x78ed('0xf'):case _0x78ed('0x10'):case _0x78ed('0x11'):return db[_0x550763][_0x78ed('0x12')](queryQueues);case _0x78ed('0x13'):return db[_0x550763][_0x78ed('0x12')](queryTelephones);case'Trunks':return db[_0x550763][_0x78ed('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x550763]['findAll'](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x58f77d['id']},'raw':!![]})[_0x78ed('0xb')](function(_0x272171){if(_0x272171){var _0x2e9007={'where':{'id':_[_0x78ed('0x14')](_0x272171,_0x78ed('0x15'))},'raw':!![]};switch(_0x550763){case _0x78ed('0x4'):_0x2e9007[_0x78ed('0x16')][_0x78ed('0x6')]=_0x78ed('0x8');break;case _0x78ed('0x17'):_0x2e9007[_0x78ed('0x16')]['type']=_0x78ed('0x9');break;}return db[_0x550763][_0x78ed('0x12')](_0x2e9007);}else{return[];}});}}else{return[];}})['then'](function(_0x47eb69){return _0x47eb69;});}function joinOrLeaveQueues(_0x2868d1,_0x2ab0fc,_0x2e9e1d,_0x3bb4a9){_0x2868d1[_0x2ab0fc](util[_0x78ed('0x18')](_0x78ed('0x19'),_0x2e9e1d,_0x3bb4a9[_0x78ed('0x5')]));if(_0x3bb4a9[_0x78ed('0x3')]){for(var _0x376076=0x0;_0x376076<_0x3bb4a9[_0x78ed('0x3')][_0x78ed('0x1a')];_0x376076+=0x1){_0x2868d1[_0x2ab0fc](util['format']('user:%s',_0x3bb4a9[_0x78ed('0x3')][_0x376076]['name']));}}}function joinOrLeave(_0xee570c,_0x55f0e8,_0x4675d3){var _0x590d90;if(_0xee570c[_0x78ed('0x1b')][_0x78ed('0x1c')]['id']){db[_0x78ed('0x4')]['find']({'attributes':['id',_0x78ed('0x5'),'role',_0x78ed('0x1d')],'where':{'id':_0xee570c[_0x78ed('0x1b')][_0x78ed('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x1e')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x1f')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x20')],'as':_0x78ed('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x22')],'as':_0x78ed('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x24')],'as':_0x78ed('0x25'),'attributes':['id'],'raw':!![]}]})[_0x78ed('0xb')](function(_0x312801){if(_0x312801){_0x590d90=_0x312801;_0xee570c[_0x55f0e8](util[_0x78ed('0x18')]('user:%s',_0x312801[_0x78ed('0x5')]));var _0x9b1ba6=[];switch(_0x312801[_0x78ed('0x6')]){case _0x78ed('0x26'):_0xee570c[_0x55f0e8]('voice:inbound');_0xee570c[_0x55f0e8]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x78ed('0x27')];}_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x29')][_0x78ed('0x12')](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2a')][_0x78ed('0x12')](queryQueues));_0x9b1ba6['push'](db[_0x78ed('0x2b')]['findAll'](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2c')]['findAll'](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2d')][_0x78ed('0x12')](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2e')][_0x78ed('0x12')](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2f')]['findAll'](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db['User'][_0x78ed('0x12')](queryTelephones));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x30')][_0x78ed('0x12')](queryTrunks));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x17')][_0x78ed('0x12')](queryCampaigns));_0x9b1ba6['push'](db[_0x78ed('0x4')][_0x78ed('0x12')](queryAgents));break;case _0x78ed('0x31'):_0xee570c[_0x55f0e8](_0x78ed('0x32'));_0xee570c[_0x55f0e8](_0x78ed('0x33'));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0xd'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x29')));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0x34'),_0x312801['userProfileId'],'ChatQueue'));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources('FaxQueues',_0x312801[_0x78ed('0x1d')],_0x78ed('0x2b')));_0x9b1ba6['push'](getAssociatedResources(_0x78ed('0x35'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x2c')));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0xf'),_0x312801[_0x78ed('0x1d')],'MailQueue'));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0x10'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x2e')));_0x9b1ba6['push'](getAssociatedResources('WhatsappQueues',_0x312801[_0x78ed('0x1d')],_0x78ed('0x2f')));_0x9b1ba6['push'](getAssociatedResources(_0x78ed('0x13'),_0x312801[_0x78ed('0x1d')],'User'));_0x9b1ba6['push'](getAssociatedResources(_0x78ed('0x36'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x30')));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources('IvrCampaigns',_0x312801['userProfileId'],_0x78ed('0x17')));_0x9b1ba6[_0x78ed('0x28')](db['User'][_0x78ed('0x12')](queryAgents));break;case'agent':_0xee570c[_0x55f0e8](_0x78ed('0x32'));_0xee570c[_0x55f0e8](_0x78ed('0x33'));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x37')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6['push'](_0x312801[_0x78ed('0x38')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x39')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6['push'](_0x312801['getSmsQueues']({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x3a')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6['push'](_0x312801[_0x78ed('0x3b')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x3c')]({'attributes':['id',_0x78ed('0x5')]}));break;}return BPromise[_0x78ed('0x3d')](_0x9b1ba6);}})['then'](function(_0x1de5a2){if(_0x1de5a2&&_0x1de5a2['length']){for(var _0x20547b=0x0;_0x20547b<_0x1de5a2['length'];_0x20547b+=0x1){for(var _0x120c95=0x0;_0x120c95<_0x1de5a2[_0x20547b][_0x78ed('0x1a')];_0x120c95+=0x1){switch(_0x20547b){case 0x0:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x3e'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x1:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x3f'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x2:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x40'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x3:joinOrLeaveQueues(_0xee570c,_0x55f0e8,'sms',_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x4:joinOrLeaveQueues(_0xee570c,_0x55f0e8,'mail',_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x5:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x41'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x6:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x42'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x7:if(_0x590d90[_0x78ed('0x6')]!=='agent')_0xee570c[_0x55f0e8](util[_0x78ed('0x18')](_0x78ed('0x43'),_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;case 0x8:if(_0x590d90['role']!=='agent')_0xee570c[_0x55f0e8](util[_0x78ed('0x18')]('trunk:%s',_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;case 0x9:if(_0x590d90[_0x78ed('0x6')]!=='agent')_0xee570c[_0x55f0e8](util['format'](_0x78ed('0x44'),_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x45')],_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;case 0xa:_0xee570c[_0x55f0e8](util[_0x78ed('0x18')](_0x78ed('0x46'),_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;}}}}})[_0x78ed('0xb')](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x419d92=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x48')],'id');return _0x590d90[_0x78ed('0x49')](_0x419d92)[_0x78ed('0xb')](function(){for(var _0x167b6b=0x0;_0x167b6b<_0x419d92['length'];_0x167b6b+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x4b'),{'ChatInteractionId':Number(_0x419d92[_0x167b6b]),'UserId':Number(_0x590d90['id'])});}});}})['then'](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x16f5e3=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x4c')],'id');return _0x590d90[_0x78ed('0x4d')](_0x16f5e3)['then'](function(){for(var _0xf0a187=0x0;_0xf0a187<_0x16f5e3['length'];_0xf0a187+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x4e'),{'MailInteractionId':Number(_0x16f5e3[_0xf0a187]),'UserId':Number(_0x590d90['id'])});}});}})[_0x78ed('0xb')](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x3d5862=_[_0x78ed('0x14')](_0x590d90['FaxInteractions'],'id');return _0x590d90['removeFaxInteractions'](_0x3d5862)[_0x78ed('0xb')](function(){for(var _0x5f369d=0x0;_0x5f369d<_0x3d5862[_0x78ed('0x1a')];_0x5f369d+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x4f'),{'FaxInteractionId':Number(_0x3d5862[_0x5f369d]),'UserId':Number(_0x590d90['id'])});}});}})[_0x78ed('0xb')](function(){if(_0x55f0e8==='leave'){var _0x2d8326=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x21')],'id');return _0x590d90[_0x78ed('0x50')](_0x2d8326)[_0x78ed('0xb')](function(){for(var _0x53709d=0x0;_0x53709d<_0x2d8326['length'];_0x53709d+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x51'),{'SmsInteractionId':Number(_0x2d8326[_0x53709d]),'UserId':Number(_0x590d90['id'])});}});}})['then'](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x133309=_[_0x78ed('0x14')](_0x590d90['OpenchannelInteractions'],'id');return _0x590d90[_0x78ed('0x52')](_0x133309)['then'](function(){for(var _0x3d3882=0x0;_0x3d3882<_0x133309['length'];_0x3d3882+=0x1){_0x4675d3['emit'](_0x78ed('0x53'),{'OpenchannelInteractionId':Number(_0x133309[_0x3d3882]),'UserId':Number(_0x590d90['id'])});}});}})[_0x78ed('0xb')](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x32ec7b=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x25')],'id');return _0x590d90[_0x78ed('0x54')](_0x32ec7b)[_0x78ed('0xb')](function(){for(var _0x2d9662=0x0;_0x2d9662<_0x32ec7b[_0x78ed('0x1a')];_0x2d9662+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x55'),{'WhatsappInteractionId':Number(_0x32ec7b[_0x2d9662]),'UserId':Number(_0x590d90['id'])});}});}})['catch'](function(_0x3f62b0){_0xee570c[_0x78ed('0x56')](_0x3f62b0);});}}function onDisconnect(_0x1095c7,_0x531fee){joinOrLeave(_0x1095c7,'leave',_0x531fee);}function onConnect(_0x217fae){joinOrLeave(_0x217fae,_0x78ed('0x57'));}exports[_0x78ed('0x58')]=function(_0x1781af){_0x1781af['on'](_0x78ed('0x59'),function(_0x55897a){_0x55897a[_0x78ed('0x5a')](0x0);_0x55897a[_0x78ed('0x5b')]=_0x55897a[_0x78ed('0x5c')]['connection'][_0x78ed('0x5d')]+':'+_0x55897a[_0x78ed('0x5c')][_0x78ed('0x59')][_0x78ed('0x5e')];_0x55897a[_0x78ed('0x5f')]=new Date();_0x55897a[_0x78ed('0x56')]=function(_0x42b1df){console[_0x78ed('0x56')](_0x78ed('0x60')+_0x55897a['nsp'][_0x78ed('0x5')]+'['+_0x55897a[_0x78ed('0x5b')]+']',_0x42b1df);};_0x55897a['on'](_0x78ed('0x61'),function(){onDisconnect(_0x55897a,_0x1781af);_0x55897a[_0x78ed('0x56')](_0x78ed('0x62'));});onConnect(_0x55897a);_0x55897a[_0x78ed('0x56')](_0x78ed('0x63'));});}; \ No newline at end of file +var _0x94c2=['../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','then','map','resourceId','where','telephone','Campaign','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','SmsQueue','OpenchannelQueue','user','FaxQueue','MailQueue','WhatsappQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util'];(function(_0x4cfc35,_0xb52690){var _0x43a384=function(_0x3d896f){while(--_0x3d896f){_0x4cfc35['push'](_0x4cfc35['shift']());}};_0x43a384(++_0xb52690);}(_0x94c2,0x13d));var _0x294c=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x94c2[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0x294c('0x0'));var BPromise=require('bluebird');var db=require(_0x294c('0x1'))['db'];var config=require(_0x294c('0x2'));var queryQueues={'attributes':['id',_0x294c('0x3')],'include':[{'as':_0x294c('0x4'),'model':db[_0x294c('0x5')],'attributes':['id',_0x294c('0x3'),_0x294c('0x6')],'raw':!![],'where':{'role':_0x294c('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x294c('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x294c('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x294c('0x3'),_0x294c('0x8')],'where':{'type':_0x294c('0x9')}};function getAssociatedResources(_0x308876,_0x5ba1e8,_0x5ddbe8){return db[_0x294c('0xa')][_0x294c('0xb')]({'where':{'name':_0x308876,'userProfileId':_0x5ba1e8},'raw':!![]})['then'](function(_0x5485d0){if(_0x5485d0){if(_0x5485d0[_0x294c('0xc')]){switch(_0x308876){case _0x294c('0xd'):case _0x294c('0xe'):case _0x294c('0xf'):case _0x294c('0x10'):case _0x294c('0x11'):case _0x294c('0x12'):case _0x294c('0x13'):return db[_0x5ddbe8][_0x294c('0x14')](queryQueues);case _0x294c('0x15'):return db[_0x5ddbe8][_0x294c('0x14')](queryTelephones);case _0x294c('0x16'):return db[_0x5ddbe8]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x5ddbe8][_0x294c('0x14')](queryCampaigns);}}else{return db[_0x294c('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x5485d0['id']},'raw':!![]})[_0x294c('0x18')](function(_0x1c3c8a){if(_0x1c3c8a){var _0x32cf32={'where':{'id':_[_0x294c('0x19')](_0x1c3c8a,_0x294c('0x1a'))},'raw':!![]};switch(_0x5ddbe8){case _0x294c('0x5'):_0x32cf32[_0x294c('0x1b')][_0x294c('0x6')]=_0x294c('0x1c');break;case _0x294c('0x1d'):_0x32cf32[_0x294c('0x1b')][_0x294c('0x8')]=_0x294c('0x9');break;}return db[_0x5ddbe8][_0x294c('0x14')](_0x32cf32);}else{return[];}});}}else{return[];}})[_0x294c('0x18')](function(_0x197f22){return _0x197f22;});}function joinOrLeaveQueues(_0x183a9e,_0x220b96,_0x46b92b,_0xe09f15){_0x183a9e[_0x220b96](util[_0x294c('0x1e')](_0x294c('0x1f'),_0x46b92b,_0xe09f15[_0x294c('0x3')]));if(_0xe09f15[_0x294c('0x4')]){for(var _0x4a5750=0x0;_0x4a5750<_0xe09f15[_0x294c('0x4')]['length'];_0x4a5750+=0x1){_0x183a9e[_0x220b96](util[_0x294c('0x1e')](_0x294c('0x20'),_0xe09f15[_0x294c('0x4')][_0x4a5750][_0x294c('0x3')]));}}}function joinOrLeave(_0x10d724,_0x329247,_0x323649){var _0x1d5b2d;if(_0x10d724[_0x294c('0x21')][_0x294c('0x22')]['id']){db[_0x294c('0x5')][_0x294c('0x23')]({'attributes':['id',_0x294c('0x3'),_0x294c('0x6'),_0x294c('0x24')],'where':{'id':_0x10d724[_0x294c('0x21')][_0x294c('0x22')]['id']},'include':[{'model':db[_0x294c('0x25')],'as':_0x294c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x294c('0x27')],'as':_0x294c('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x294c('0x29')],'as':_0x294c('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x294c('0x2b')],'as':_0x294c('0x2c'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x294c('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x294c('0x2e')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x294c('0x18')](function(_0x4de9cc){if(_0x4de9cc){_0x1d5b2d=_0x4de9cc;_0x10d724[_0x329247](util[_0x294c('0x1e')](_0x294c('0x20'),_0x4de9cc[_0x294c('0x3')]));var _0x1b3c9f=[];switch(_0x4de9cc[_0x294c('0x6')]){case'admin':_0x10d724[_0x329247](_0x294c('0x2f'));_0x10d724[_0x329247](_0x294c('0x30'));if(queryQueues['hasOwnProperty'](_0x294c('0x31'))){delete queryQueues['include'];}_0x1b3c9f[_0x294c('0x32')](db[_0x294c('0x33')][_0x294c('0x14')](queryQueues));_0x1b3c9f[_0x294c('0x32')](db[_0x294c('0x34')][_0x294c('0x14')](queryQueues));_0x1b3c9f[_0x294c('0x32')](db['FaxQueue'][_0x294c('0x14')](queryQueues));_0x1b3c9f[_0x294c('0x32')](db[_0x294c('0x35')]['findAll'](queryQueues));_0x1b3c9f[_0x294c('0x32')](db['MailQueue'][_0x294c('0x14')](queryQueues));_0x1b3c9f[_0x294c('0x32')](db[_0x294c('0x36')][_0x294c('0x14')](queryQueues));_0x1b3c9f[_0x294c('0x32')](db['WhatsappQueue'][_0x294c('0x14')](queryQueues));_0x1b3c9f['push'](db[_0x294c('0x5')]['findAll'](queryTelephones));_0x1b3c9f['push'](db['Trunk'][_0x294c('0x14')](queryTrunks));_0x1b3c9f[_0x294c('0x32')](db[_0x294c('0x1d')][_0x294c('0x14')](queryCampaigns));_0x1b3c9f['push'](db[_0x294c('0x5')][_0x294c('0x14')](queryAgents));break;case _0x294c('0x37'):_0x10d724[_0x329247]('voice:inbound');_0x10d724[_0x329247](_0x294c('0x30'));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0xd'),_0x4de9cc[_0x294c('0x24')],'VoiceQueue'));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0xe'),_0x4de9cc[_0x294c('0x24')],_0x294c('0x34')));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources('FaxQueues',_0x4de9cc['userProfileId'],_0x294c('0x38')));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0x10'),_0x4de9cc[_0x294c('0x24')],_0x294c('0x35')));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0x11'),_0x4de9cc[_0x294c('0x24')],_0x294c('0x39')));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0x12'),_0x4de9cc[_0x294c('0x24')],_0x294c('0x36')));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0x13'),_0x4de9cc[_0x294c('0x24')],_0x294c('0x3a')));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0x15'),_0x4de9cc['userProfileId'],'User'));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0x16'),_0x4de9cc[_0x294c('0x24')],'Trunk'));_0x1b3c9f[_0x294c('0x32')](getAssociatedResources(_0x294c('0x3b'),_0x4de9cc['userProfileId'],'Campaign'));_0x1b3c9f[_0x294c('0x32')](db['User']['findAll'](queryAgents));break;case'agent':_0x10d724[_0x329247](_0x294c('0x2f'));_0x10d724[_0x329247]('voice:outbound');_0x1b3c9f[_0x294c('0x32')](_0x4de9cc[_0x294c('0x3c')]({'attributes':['id',_0x294c('0x3')]}));_0x1b3c9f[_0x294c('0x32')](_0x4de9cc[_0x294c('0x3d')]({'attributes':['id','name']}));_0x1b3c9f['push'](_0x4de9cc[_0x294c('0x3e')]({'attributes':['id',_0x294c('0x3')]}));_0x1b3c9f[_0x294c('0x32')](_0x4de9cc[_0x294c('0x3f')]({'attributes':['id',_0x294c('0x3')]}));_0x1b3c9f[_0x294c('0x32')](_0x4de9cc[_0x294c('0x40')]({'attributes':['id',_0x294c('0x3')]}));_0x1b3c9f[_0x294c('0x32')](_0x4de9cc[_0x294c('0x41')]({'attributes':['id','name']}));_0x1b3c9f[_0x294c('0x32')](_0x4de9cc[_0x294c('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x294c('0x43')](_0x1b3c9f);}})[_0x294c('0x18')](function(_0x4c85c6){if(_0x4c85c6&&_0x4c85c6[_0x294c('0x44')]){for(var _0x326837=0x0;_0x326837<_0x4c85c6['length'];_0x326837+=0x1){for(var _0x372108=0x0;_0x372108<_0x4c85c6[_0x326837]['length'];_0x372108+=0x1){switch(_0x326837){case 0x0:joinOrLeaveQueues(_0x10d724,_0x329247,_0x294c('0x45'),_0x4c85c6[_0x326837][_0x372108]);break;case 0x1:joinOrLeaveQueues(_0x10d724,_0x329247,'chat',_0x4c85c6[_0x326837][_0x372108]);break;case 0x2:joinOrLeaveQueues(_0x10d724,_0x329247,_0x294c('0x46'),_0x4c85c6[_0x326837][_0x372108]);break;case 0x3:joinOrLeaveQueues(_0x10d724,_0x329247,_0x294c('0x47'),_0x4c85c6[_0x326837][_0x372108]);break;case 0x4:joinOrLeaveQueues(_0x10d724,_0x329247,_0x294c('0x48'),_0x4c85c6[_0x326837][_0x372108]);break;case 0x5:joinOrLeaveQueues(_0x10d724,_0x329247,_0x294c('0x49'),_0x4c85c6[_0x326837][_0x372108]);break;case 0x6:joinOrLeaveQueues(_0x10d724,_0x329247,_0x294c('0x4a'),_0x4c85c6[_0x326837][_0x372108]);break;case 0x7:if(_0x1d5b2d['role']!==_0x294c('0x7'))_0x10d724[_0x329247](util[_0x294c('0x1e')](_0x294c('0x4b'),_0x4c85c6[_0x326837][_0x372108][_0x294c('0x3')]));break;case 0x8:if(_0x1d5b2d[_0x294c('0x6')]!=='agent')_0x10d724[_0x329247](util['format']('trunk:%s',_0x4c85c6[_0x326837][_0x372108]['name']));break;case 0x9:if(_0x1d5b2d[_0x294c('0x6')]!==_0x294c('0x7'))_0x10d724[_0x329247](util['format'](_0x294c('0x4c'),_0x4c85c6[_0x326837][_0x372108][_0x294c('0x8')],_0x4c85c6[_0x326837][_0x372108][_0x294c('0x3')]));break;case 0xa:_0x10d724[_0x329247](util[_0x294c('0x1e')]('user:%s',_0x4c85c6[_0x326837][_0x372108][_0x294c('0x3')]));break;}}}}})[_0x294c('0x18')](function(){if(_0x329247==='leave'){var _0x58d2fb=_[_0x294c('0x19')](_0x1d5b2d[_0x294c('0x26')],'id');return _0x1d5b2d[_0x294c('0x4d')](_0x58d2fb)[_0x294c('0x18')](function(){for(var _0x41f685=0x0;_0x41f685<_0x58d2fb[_0x294c('0x44')];_0x41f685+=0x1){_0x323649[_0x294c('0x4e')](_0x294c('0x4f'),{'ChatInteractionId':Number(_0x58d2fb[_0x41f685]),'UserId':Number(_0x1d5b2d['id'])});}});}})['then'](function(){if(_0x329247===_0x294c('0x50')){var _0x2265cb=_[_0x294c('0x19')](_0x1d5b2d[_0x294c('0x28')],'id');return _0x1d5b2d[_0x294c('0x51')](_0x2265cb)[_0x294c('0x18')](function(){for(var _0xc086bb=0x0;_0xc086bb<_0x2265cb[_0x294c('0x44')];_0xc086bb+=0x1){_0x323649['emit'](_0x294c('0x52'),{'MailInteractionId':Number(_0x2265cb[_0xc086bb]),'UserId':Number(_0x1d5b2d['id'])});}});}})[_0x294c('0x18')](function(){if(_0x329247===_0x294c('0x50')){var _0x20126a=_[_0x294c('0x19')](_0x1d5b2d[_0x294c('0x2a')],'id');return _0x1d5b2d[_0x294c('0x53')](_0x20126a)[_0x294c('0x18')](function(){for(var _0x514c5f=0x0;_0x514c5f<_0x20126a[_0x294c('0x44')];_0x514c5f+=0x1){_0x323649[_0x294c('0x4e')](_0x294c('0x54'),{'FaxInteractionId':Number(_0x20126a[_0x514c5f]),'UserId':Number(_0x1d5b2d['id'])});}});}})['then'](function(){if(_0x329247===_0x294c('0x50')){var _0xa4780e=_[_0x294c('0x19')](_0x1d5b2d[_0x294c('0x2c')],'id');return _0x1d5b2d[_0x294c('0x55')](_0xa4780e)['then'](function(){for(var _0x236062=0x0;_0x236062<_0xa4780e['length'];_0x236062+=0x1){_0x323649[_0x294c('0x4e')](_0x294c('0x56'),{'SmsInteractionId':Number(_0xa4780e[_0x236062]),'UserId':Number(_0x1d5b2d['id'])});}});}})['then'](function(){if(_0x329247==='leave'){var _0x2ee225=_[_0x294c('0x19')](_0x1d5b2d[_0x294c('0x2d')],'id');return _0x1d5b2d[_0x294c('0x57')](_0x2ee225)['then'](function(){for(var _0x463a42=0x0;_0x463a42<_0x2ee225[_0x294c('0x44')];_0x463a42+=0x1){_0x323649[_0x294c('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2ee225[_0x463a42]),'UserId':Number(_0x1d5b2d['id'])});}});}})['then'](function(){if(_0x329247==='leave'){var _0xd8ebba=_['map'](_0x1d5b2d[_0x294c('0x58')],'id');return _0x1d5b2d[_0x294c('0x59')](_0xd8ebba)[_0x294c('0x18')](function(){for(var _0x17b5fa=0x0;_0x17b5fa<_0xd8ebba['length'];_0x17b5fa+=0x1){_0x323649[_0x294c('0x4e')](_0x294c('0x5a'),{'WhatsappInteractionId':Number(_0xd8ebba[_0x17b5fa]),'UserId':Number(_0x1d5b2d['id'])});}});}})[_0x294c('0x5b')](function(_0x3bd11a){_0x10d724[_0x294c('0x5c')](_0x3bd11a);});}}function onDisconnect(_0x2edd71,_0x27259a){joinOrLeave(_0x2edd71,_0x294c('0x50'),_0x27259a);}function onConnect(_0x3b69c3){joinOrLeave(_0x3b69c3,_0x294c('0x5d'));}exports[_0x294c('0x5e')]=function(_0x1ff9fe){_0x1ff9fe['on'](_0x294c('0x5f'),function(_0x44f6dc){_0x44f6dc[_0x294c('0x60')](0x0);_0x44f6dc['address']=_0x44f6dc['request'][_0x294c('0x5f')][_0x294c('0x61')]+':'+_0x44f6dc[_0x294c('0x62')][_0x294c('0x5f')][_0x294c('0x63')];_0x44f6dc[_0x294c('0x64')]=new Date();_0x44f6dc[_0x294c('0x5c')]=function(_0x4a836f){console[_0x294c('0x5c')](_0x294c('0x65')+_0x44f6dc[_0x294c('0x66')][_0x294c('0x3')]+'['+_0x44f6dc['address']+']',_0x4a836f);};_0x44f6dc['on'](_0x294c('0x67'),function(){onDisconnect(_0x44f6dc,_0x1ff9fe);_0x44f6dc[_0x294c('0x5c')](_0x294c('0x68'));});onConnect(_0x44f6dc);_0x44f6dc[_0x294c('0x5c')](_0x294c('0x69'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 23a6dd9..757ac7c 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 _0xb790=['AfterCreateMessage','event','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','changed','closed','substatus','AfterUpdate','User','find','internal','default','length','model','hook','callback','condition','../../mysqldb','jayson/promise','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','channel','motionChannel','direction','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','undefined','UserId','format','name','agent'];(function(_0x326a44,_0x41c393){var _0x218e10=function(_0x4ef0a6){while(--_0x4ef0a6){_0x326a44['push'](_0x326a44['shift']());}};_0x218e10(++_0x41c393);}(_0xb790,0x9b));var _0x0b79=function(_0x24ca1f,_0x3d2164){_0x24ca1f=_0x24ca1f-0x0;var _0x5f4222=_0xb790[_0x24ca1f];return _0x5f4222;};'use strict';var util=require('util');var db=require(_0x0b79('0x0'))['db'];var jayson=require(_0x0b79('0x1'));var logger=require('../logger')('triggers');var client=jayson[_0x0b79('0x2')][_0x0b79('0x3')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x0b79('0x4'),'event':_0x0b79('0x5'),'condition':_0x0b79('0x6'),'callback':afterCreate},{'channel':_0x0b79('0x7'),'model':_0x0b79('0x4'),'event':_0x0b79('0x8'),'condition':_0x0b79('0x9'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x0b79('0x5'),'condition':_0x0b79('0xa'),'callback':afterCreateMessage},{'channel':_0x0b79('0x7'),'model':_0x0b79('0xb'),'event':_0x0b79('0x5'),'condition':_0x0b79('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x0b79('0xc'),'model':_0x0b79('0xd'),'event':_0x0b79('0x5'),'condition':_0x0b79('0x6'),'callback':afterCreate},{'channel':_0x0b79('0xc'),'model':_0x0b79('0xd'),'event':_0x0b79('0x8'),'condition':_0x0b79('0x9'),'callback':afterUpdate},{'channel':_0x0b79('0xc'),'model':_0x0b79('0xe'),'event':_0x0b79('0x5'),'condition':_0x0b79('0xa'),'callback':afterCreateMessage},{'channel':_0x0b79('0xf'),'model':_0x0b79('0x10'),'event':_0x0b79('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x0b79('0xf'),'model':_0x0b79('0x10'),'event':_0x0b79('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0b79('0xf'),'model':_0x0b79('0x11'),'event':'afterCreate','condition':_0x0b79('0xa'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x0b79('0x12'),'event':'afterCreate','condition':_0x0b79('0x6'),'callback':afterCreate},{'channel':_0x0b79('0x13'),'model':_0x0b79('0x12'),'event':_0x0b79('0x8'),'condition':_0x0b79('0x9'),'callback':afterUpdate},{'channel':_0x0b79('0x13'),'model':_0x0b79('0x14'),'event':_0x0b79('0x5'),'condition':_0x0b79('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x0b79('0x15'),'event':'afterCreate','condition':_0x0b79('0x6'),'callback':afterCreate},{'channel':_0x0b79('0x16'),'model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0b79('0x16'),'model':'MailMessage','event':_0x0b79('0x5'),'condition':_0x0b79('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x0b79('0x17'),'event':_0x0b79('0x5'),'condition':_0x0b79('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':_0x0b79('0x17'),'event':_0x0b79('0x8'),'condition':_0x0b79('0x9'),'callback':afterUpdate},{'channel':_0x0b79('0x18'),'model':_0x0b79('0x19'),'event':_0x0b79('0x5'),'condition':_0x0b79('0xa'),'callback':afterCreateMessage}];function request(_0x1ba363){return client['request'](_0x0b79('0x1a'),_0x1ba363)[_0x0b79('0x1b')](function(_0x5928a3){logger[_0x0b79('0x1c')]('Trigger,\x20%s',_0x0b79('0x1a'),_0x5928a3);if(_0x5928a3[_0x0b79('0x1d')]){if(_0x5928a3[_0x0b79('0x1d')][_0x0b79('0x1e')]===0x1f4){logger[_0x0b79('0x1d')](_0x0b79('0x1f'),_0x0b79('0x1a'),_0x5928a3[_0x0b79('0x1d')]);}}})[_0x0b79('0x20')](function(_0x12bf24){logger[_0x0b79('0x1d')](_0x0b79('0x1f'),_0x0b79('0x1a'),_0x12bf24);});}function afterCreateMessage(_0x574ec4){return function(_0x334075){_0x334075=_0x334075[_0x0b79('0x21')]({'plain':!![]});_0x334075[_0x0b79('0x22')]=_0x574ec4;_0x334075[_0x0b79('0x23')]=_0x574ec4;_0x334075['event']=_0x334075[_0x0b79('0x24')];Promise['resolve']()[_0x0b79('0x1b')](function(){if(typeof _0x334075[_0x0b79('0x25')]==='undefined')return null;var _0x2f3888='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x334075[_0x0b79('0x25')];return db[_0x0b79('0x26')][_0x0b79('0x27')](_0x2f3888,{'type':db[_0x0b79('0x28')][_0x0b79('0x29')][_0x0b79('0x2a')],'raw':!![]});})[_0x0b79('0x1b')](function(_0x4beb9b){if(_0x4beb9b){_0x334075[_0x0b79('0x2b')]=_0x4beb9b[0x0];}if(typeof _0x334075['UserId']===_0x0b79('0x2c'))return;return getAgent(_0x334075[_0x0b79('0x2d')]);})['then'](function(_0x1b085a){if(_0x1b085a){_0x334075['interface']=util[_0x0b79('0x2e')]('SIP/%s',_0x1b085a[_0x0b79('0x2f')]);_0x334075[_0x0b79('0x30')]=_0x1b085a;_0x334075[_0x0b79('0x22')]=_0x574ec4;return request({'event':'incomingmessage','message':_0x334075});}else{return request({'event':'outgoingmessage','message':_0x334075});}})[_0x0b79('0x20')](function(_0x42eb0d){logger[_0x0b79('0x1d')](_0x0b79('0x1f'),_0x0b79('0x31'),_0x42eb0d);});};}function afterCreateOfflineMessage(_0x52631a){return function(_0x2ab4b0){_0x2ab4b0=_0x2ab4b0[_0x0b79('0x21')]({'plain':!![]});_0x2ab4b0[_0x0b79('0x22')]=_0x52631a;_0x2ab4b0[_0x0b79('0x23')]=_0x52631a;_0x2ab4b0[_0x0b79('0x32')]='offlineMessage';return request({'event':_0x2ab4b0[_0x0b79('0x32')],'message':_0x2ab4b0});};}function afterCreate(_0x284fad,_0x428122){return function(_0xbeb89c){_0xbeb89c=_0xbeb89c['get']({'plain':!![]});_0xbeb89c['channel']=_0x284fad;_0xbeb89c[_0x0b79('0x23')]=_0x284fad;_0xbeb89c['event']=_0x0b79('0x33');Promise[_0x0b79('0x34')]()[_0x0b79('0x1b')](function(){var _0x15704a=_0x0b79('0x35')+_0xbeb89c[_0x0b79('0x25')];return db[_0x0b79('0x26')]['query'](_0x15704a,{'type':db['Sequelize'][_0x0b79('0x29')][_0x0b79('0x2a')],'raw':!![]});})[_0x0b79('0x1b')](function(_0x1cc7a5){if(_0x1cc7a5){_0xbeb89c[_0x0b79('0x2b')]=_0x1cc7a5[0x0];}if(typeof _0xbeb89c[_0x0b79('0x2d')]==='undefined')return;return getAgent(_0xbeb89c[_0x0b79('0x2d')]);})[_0x0b79('0x1b')](function(_0x4e0b7b){if(_0x4e0b7b){_0xbeb89c['interface']=util[_0x0b79('0x2e')](_0x0b79('0x36'),_0x4e0b7b['name']);_0xbeb89c[_0x0b79('0x30')]=_0x4e0b7b;}return request({'event':_0x428122,'message':_0xbeb89c});})[_0x0b79('0x20')](function(_0x744ca0){logger['error'](_0x0b79('0x1f'),'AfterCreate',_0x744ca0);});};}function afterUpdate(_0x2a761a){return function(_0x2d423b){var _0x2e977a=_0x2d423b[_0x0b79('0x37')](_0x0b79('0x38'))&&_0x2d423b[_0x0b79('0x38')];var _0x57a9ae=_0x2d423b[_0x0b79('0x37')](_0x0b79('0x39'));if(_0x2e977a||_0x57a9ae){var _0x2f7f2e=_0x2e977a?_0x0b79('0x9'):_0x0b79('0x39');var _0x17c1cd=_0x2d423b[_0x0b79('0x21')]({'plain':!![]});_0x17c1cd[_0x0b79('0x22')]=_0x2a761a;_0x17c1cd[_0x0b79('0x23')]=_0x2a761a;_0x17c1cd['event']=_0x2e977a?_0x0b79('0x38'):_0x0b79('0x39');var _0x2ad178=_0x0b79('0x35')+_0x17c1cd['ContactId'];return db[_0x0b79('0x26')][_0x0b79('0x27')](_0x2ad178,{'type':db[_0x0b79('0x28')][_0x0b79('0x29')]['SELECT'],'raw':!![]})[_0x0b79('0x1b')](function(_0x298c1e){if(_0x298c1e){_0x17c1cd[_0x0b79('0x2b')]=_0x298c1e[0x0];}if(typeof _0x17c1cd['UserId']===_0x0b79('0x2c'))return;return getAgent(_0x17c1cd[_0x0b79('0x2d')]);})['then'](function(_0x1635d7){if(_0x1635d7){_0x17c1cd['interface']=util['format'](_0x0b79('0x36'),_0x1635d7[_0x0b79('0x2f')]);_0x17c1cd[_0x0b79('0x30')]=_0x1635d7;}return request({'event':_0x2f7f2e,'message':_0x17c1cd});})[_0x0b79('0x20')](function(_0x58eb5d){logger[_0x0b79('0x1d')]('Trigger,\x20%s',_0x0b79('0x3a'),_0x58eb5d);});}};}function getAgent(_0x261acc){return db[_0x0b79('0x3b')][_0x0b79('0x3c')]({'where':{'id':_0x261acc},'attributes':['id',_0x0b79('0x2f'),'fullname','email',_0x0b79('0x3d')],'raw':!![]})[_0x0b79('0x1b')](function(_0x4c0a22){return _0x4c0a22;});}exports[_0x0b79('0x3e')]=function(){for(var _0x20ff15=0x0;_0x20ff15=_0xb6dd9c[_0x8013('0x15')]){throw Error(_0x8013('0x16'));}_0x319ba2(_0x9e8684);})[_0x8013('0x17')](function(_0xa335ed){_0x4052f7(_0xa335ed);});});}; \ No newline at end of file +var _0x8fce=['chat','fax','sms','openchannel','getChannels','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','mail'];(function(_0xc62466,_0x10b8b5){var _0x120157=function(_0x1e5602){while(--_0x1e5602){_0xc62466['push'](_0xc62466['shift']());}};_0x120157(++_0x10b8b5);}(_0x8fce,0x138));var _0xe8fc=function(_0x8a7bcb,_0x2cf7d1){_0x8a7bcb=_0x8a7bcb-0x0;var _0x23ccc0=_0x8fce[_0x8a7bcb];return _0x23ccc0;};'use strict';var _=require(_0xe8fc('0x0'));var BPromise=require('bluebird');var db=require(_0xe8fc('0x1'))['db'];var util=require('./license/util');var channels=['voice',_0xe8fc('0x2'),_0xe8fc('0x3'),_0xe8fc('0x4'),_0xe8fc('0x5'),'whatsapp',_0xe8fc('0x6')];exports[_0xe8fc('0x7')]=function(){return channels;};exports['isValidChannel']=function(_0x1f7b30){_0x1f7b30=_0x1f7b30[_0xe8fc('0x8')]();return _['includes'](channels,_0x1f7b30);};exports[_0xe8fc('0x9')]=function(_0x109dd2,_0x2c646f,_0x40f4b9,_0x2a2f5e){var _0x4cde24={'loginAttempts':_0x2c646f,'blocked':_0x40f4b9};if(!_[_0xe8fc('0xa')](_0x2a2f5e)){_0x4cde24[_0xe8fc('0xb')]=_0x2a2f5e;}return _0x109dd2[_0xe8fc('0xc')](_0x4cde24);};exports[_0xe8fc('0xd')]=function(_0x13861a){return new BPromise(function(_0x54103d,_0x29f437){var _0x1fb243=0x0;if(_0x13861a['role']!==_0xe8fc('0xe')){_0x54103d(_0x13861a);}db[_0xe8fc('0xf')][_0xe8fc('0x10')]({'where':{'role':_0xe8fc('0xe'),'online':!![],'id':{'$ne':_0x13861a['id']}}})[_0xe8fc('0x11')](function(_0x126f7b){_0x1fb243=_0x126f7b;return util[_0xe8fc('0xd')]();})[_0xe8fc('0x11')](function(_0x4c2481){if(_0x4c2481&&_0x4c2481[_0xe8fc('0x12')]&&_0x1fb243>=_0x4c2481[_0xe8fc('0x12')]){throw Error(_0xe8fc('0x13'));}_0x54103d(_0x13861a);})[_0xe8fc('0x14')](function(_0x4ddef2){_0x29f437(_0x4ddef2);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 111bc0e..e1571c5 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbec5=['error','stack','status','send','exports','util','../config/logger','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval'];(function(_0xb321b4,_0x5f26b8){var _0xd4f2c3=function(_0x240ae8){while(--_0x240ae8){_0xb321b4['push'](_0xb321b4['shift']());}};_0xd4f2c3(++_0x5f26b8);}(_0xbec5,0xe5));var _0x5bec=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xbec5[_0x3cec8c];return _0x38032e;};'use strict';var util=require(_0x5bec('0x0'));var logger=require(_0x5bec('0x1'))('api');var APIError=function(_0x1d4842,_0x38c81a){this[_0x5bec('0x2')]=_0x1d4842||_0x5bec('0x3');this[_0x5bec('0x4')]=_0x38c81a||'Error';util[_0x5bec('0x5')](APIError,Error);};var APIBadRequestError=function(_0x376cdb){this[_0x5bec('0x2')]=_0x376cdb||'Bad\x20Request';this[_0x5bec('0x4')]=_0x5bec('0x6');util[_0x5bec('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x406e65){this[_0x5bec('0x2')]=_0x406e65||_0x5bec('0x7');this[_0x5bec('0x4')]=_0x5bec('0x8');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x41a827){switch(_0x41a827){case'Bad\x20Request':return 0x190;case _0x5bec('0x9'),_0x5bec('0xa'):return 0x193;case _0x5bec('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a5482){return function(_0x288d1b){logger[_0x5bec('0xb')](_0x288d1b[_0x5bec('0xc')]);var _0x57ffc4=getStatusCode(_0x288d1b[_0x5bec('0x4')]);if(_0x288d1b[_0x5bec('0x4')])delete _0x288d1b['name'];return _0x4a5482[_0x5bec('0xd')](_0x57ffc4)[_0x5bec('0xe')](_0x288d1b);};}module[_0x5bec('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xaa88=['Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Entity\x20not\x20found'];(function(_0x245e34,_0x561e19){var _0x1b25a8=function(_0x4f1a49){while(--_0x4f1a49){_0x245e34['push'](_0x245e34['shift']());}};_0x1b25a8(++_0x561e19);}(_0xaa88,0x137));var _0x8aa8=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0xaa88[_0x575a38];return _0x5a7bdd;};'use strict';var util=require(_0x8aa8('0x0'));var logger=require(_0x8aa8('0x1'))(_0x8aa8('0x2'));var APIError=function(_0x51c79b,_0x4aee38){this[_0x8aa8('0x3')]=_0x51c79b||_0x8aa8('0x4');this[_0x8aa8('0x5')]=_0x4aee38||_0x8aa8('0x6');util[_0x8aa8('0x7')](APIError,Error);};var APIBadRequestError=function(_0x350e8b){this['message']=_0x350e8b||'Bad\x20Request';this[_0x8aa8('0x5')]='Bad\x20Request';util[_0x8aa8('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1ed84d){this[_0x8aa8('0x3')]=_0x1ed84d||_0x8aa8('0x8');this['name']=_0x8aa8('0x9');util[_0x8aa8('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x224f25){switch(_0x224f25){case'Bad\x20Request':return 0x190;case _0x8aa8('0xa'),_0x8aa8('0xb'):return 0x193;case _0x8aa8('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x33cc5c){return function(_0x583688){logger[_0x8aa8('0xc')](_0x583688[_0x8aa8('0xd')]);var _0x50787d=getStatusCode(_0x583688[_0x8aa8('0x5')]);if(_0x583688[_0x8aa8('0x5')])delete _0x583688[_0x8aa8('0x5')];return _0x33cc5c['status'](_0x50787d)[_0x8aa8('0xe')](_0x583688);};}module[_0x8aa8('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 3499cc1..154e21c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd596=['json','send','exports','404','status','render'];(function(_0xcd03f4,_0x40bf27){var _0x122a24=function(_0x1dfb6c){while(--_0x1dfb6c){_0xcd03f4['push'](_0xcd03f4['shift']());}};_0x122a24(++_0x40bf27);}(_0xd596,0x14c));var _0x6d59=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0xd596[_0x17bb31];return _0x505c71;};'use strict';module[_0x6d59('0x0')][0x194]=function pageNotFound(_0x435c17,_0xeab2d3){var _0x3594b8=_0x6d59('0x1');var _0x3b72ba=0x194;var _0x575a41={'status':_0x3b72ba};_0xeab2d3[_0x6d59('0x2')](_0x575a41['status']);_0xeab2d3[_0x6d59('0x3')](_0x3594b8,{},function(_0x3e577a,_0xffd836){if(_0x3e577a){return _0xeab2d3[_0x6d59('0x2')](_0x575a41['status'])[_0x6d59('0x4')](_0x575a41);}_0xeab2d3[_0x6d59('0x5')](_0xffd836);});}; \ No newline at end of file +var _0x8fb9=['json','send','status'];(function(_0x2b5c37,_0xa2cccc){var _0x441c0e=function(_0x5c76a2){while(--_0x5c76a2){_0x2b5c37['push'](_0x2b5c37['shift']());}};_0x441c0e(++_0xa2cccc);}(_0x8fb9,0x155));var _0x98fb=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x8fb9[_0x5416db];return _0x243e35;};'use strict';module['exports'][0x194]=function pageNotFound(_0x24b2d4,_0x1a7410){var _0x393519='404';var _0x1ca20c=0x194;var _0x284ebf={'status':_0x1ca20c};_0x1a7410[_0x98fb('0x0')](_0x284ebf['status']);_0x1a7410['render'](_0x393519,{},function(_0x11cfa9,_0x229f79){if(_0x11cfa9){return _0x1a7410[_0x98fb('0x0')](_0x284ebf[_0x98fb('0x0')])[_0x98fb('0x1')](_0x284ebf);}_0x1a7410[_0x98fb('0x2')](_0x229f79);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ffd2d94..acee72e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','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','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','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','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ef1faea..743fe2e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54e6=['/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/template','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/logs','/apidoc','static','join','root','/www','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/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/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule'];(function(_0x50b20f,_0x5ae4f1){var _0x2d00d3=function(_0x58c50a){while(--_0x58c50a){_0x50b20f['push'](_0x50b20f['shift']());}};_0x2d00d3(++_0x5ae4f1);}(_0x54e6,0x199));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var path=require('path');var express=require(_0x654e('0x0'));var errors=require(_0x654e('0x1'));var config=require(_0x654e('0x2'));var setupLoggers=require(_0x654e('0x3'))[_0x654e('0x4')];var clientSideLogs=require(_0x654e('0x5'));exports[_0x654e('0x6')]=function(_0x1dbaaa){return setupLoggers(_0x1dbaaa)[_0x654e('0x7')](function(){_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9'),require(_0x654e('0xa')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/chanspy',require(_0x654e('0xb')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc'),require(_0x654e('0xd')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe'),require(_0x654e('0xf')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x10'),require(_0x654e('0x11')));_0x1dbaaa['use']('/api/voice/queues',require('./api/voiceQueue'));_0x1dbaaa['use'](_0x654e('0x12'),require('./api/voiceRecording'));_0x1dbaaa['use']('/api/screen/recordings',require(_0x654e('0x13')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/mails',require(_0x654e('0x14')));_0x1dbaaa['use'](_0x654e('0x15'),require('./api/voiceMailMessage'));_0x1dbaaa[_0x654e('0x8')]('/api/voice/calls/reports',require(_0x654e('0x16')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/dials/reports',require(_0x654e('0x17')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x18'),require(_0x654e('0x19')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x1a'),require(_0x654e('0x1b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x1c'),require(_0x654e('0x1d')));_0x1dbaaa['use']('/api/trunks',require(_0x654e('0x1e')));_0x1dbaaa['use'](_0x654e('0x1f'),require('./api/voiceTransferReport'));_0x1dbaaa[_0x654e('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x1dbaaa['use'](_0x654e('0x20'),require(_0x654e('0x21')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x22'),require(_0x654e('0x23')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x24'),require('./api/mailSubstatus'));_0x1dbaaa['use'](_0x654e('0x25'),require(_0x654e('0x26')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x27'),require(_0x654e('0x28')));_0x1dbaaa[_0x654e('0x8')]('/api/mail/applications',require(_0x654e('0x29')));_0x1dbaaa['use'](_0x654e('0x2a'),require(_0x654e('0x2b')));_0x1dbaaa[_0x654e('0x8')]('/api/dashboards',require(_0x654e('0x2c')));_0x1dbaaa['use'](_0x654e('0x2d'),require(_0x654e('0x2e')));_0x1dbaaa['use'](_0x654e('0x2f'),require(_0x654e('0x30')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x31'),require(_0x654e('0x32')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x33'),require(_0x654e('0x34')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x35'),require('./api/faxMessage'));_0x1dbaaa['use']('/api/fax/queues',require('./api/faxQueue'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x36'),require(_0x654e('0x37')));_0x1dbaaa[_0x654e('0x8')]('/api/sms/accounts',require(_0x654e('0x38')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x39'),require('./api/smsApplication'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x3a'),require(_0x654e('0x3b')));_0x1dbaaa[_0x654e('0x8')]('/api/sms/messages',require(_0x654e('0x3c')));_0x1dbaaa['use'](_0x654e('0x3d'),require(_0x654e('0x3e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x3f'),require(_0x654e('0x40')));_0x1dbaaa[_0x654e('0x8')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x1dbaaa['use'](_0x654e('0x41'),require('./api/openchannelInteraction'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x42'),require(_0x654e('0x43')));_0x1dbaaa['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x1dbaaa['use'](_0x654e('0x44'),require('./api/chatWebsite'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x45'),require('./api/openchannelQueueReport'));_0x1dbaaa[_0x654e('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x1dbaaa[_0x654e('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x46'),require(_0x654e('0x47')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x48'),require(_0x654e('0x49')));_0x1dbaaa['use'](_0x654e('0x4a'),require(_0x654e('0x4b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x4c'),require(_0x654e('0x4d')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x4e'),require(_0x654e('0x4f')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x50'),require(_0x654e('0x51')));_0x1dbaaa['use'](_0x654e('0x52'),require('./api/cmContact'));_0x1dbaaa[_0x654e('0x8')]('/api/cm/hopper',require(_0x654e('0x53')));_0x1dbaaa[_0x654e('0x8')]('/api/cm/hopper_black',require(_0x654e('0x54')));_0x1dbaaa['use'](_0x654e('0x55'),require('./api/cmHopperFinal'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x56'),require(_0x654e('0x57')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x58'),require(_0x654e('0x59')));_0x1dbaaa[_0x654e('0x8')]('/api/actions',require(_0x654e('0x5a')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x5b'),require(_0x654e('0x5c')));_0x1dbaaa[_0x654e('0x8')]('/api/canned_answers',require('./api/cannedAnswer'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x5d'),require(_0x654e('0x5e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x5f'),require(_0x654e('0x60')));_0x1dbaaa[_0x654e('0x8')]('/api/intervals',require(_0x654e('0x61')));_0x1dbaaa['use'](_0x654e('0x62'),require('./api/pause'));_0x1dbaaa[_0x654e('0x8')]('/api/cdr',require(_0x654e('0x63')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x64'),require('./api/voiceQueuesLog'));_0x1dbaaa['use'](_0x654e('0x65'),require(_0x654e('0x66')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x67'),require(_0x654e('0x68')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x69'),require('./api/tag'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6a'),require(_0x654e('0x6b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6c'),require('./api/cmContactHasItem'));_0x1dbaaa['use']('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x1dbaaa[_0x654e('0x8')]('/api/templates',require(_0x654e('0x6d')));_0x1dbaaa[_0x654e('0x8')]('/api/triggers',require('./api/trigger'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6e'),require('./api/variable'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6f'),require(_0x654e('0x70')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x71'),require('./api/integrationReport'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x72'),require(_0x654e('0x73')));_0x1dbaaa['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x1dbaaa['use'](_0x654e('0x74'),require(_0x654e('0x75')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x76'),require(_0x654e('0x77')));_0x1dbaaa['use'](_0x654e('0x78'),require(_0x654e('0x79')));_0x1dbaaa['use'](_0x654e('0x7a'),require(_0x654e('0x7b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x7c'),require(_0x654e('0x7d')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/salesforce/configurations',require(_0x654e('0x7e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x7f'),require(_0x654e('0x80')));_0x1dbaaa['use'](_0x654e('0x81'),require('./api/intSugarcrmAccount'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x82'),require(_0x654e('0x83')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x84'),require(_0x654e('0x85')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x86'),require(_0x654e('0x87')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x88'),require('./api/intDeskConfiguration'));_0x1dbaaa['use']('/api/integrations/desk/fields',require(_0x654e('0x89')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x8a'),require(_0x654e('0x8b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x8c'),require(_0x654e('0x8d')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x8e'),require(_0x654e('0x8f')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x90'),require('./api/intZendeskAccount'));_0x1dbaaa['use'](_0x654e('0x91'),require(_0x654e('0x92')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/zendesk/fields',require(_0x654e('0x93')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x94'),require('./api/intFreshdeskAccount'));_0x1dbaaa['use'](_0x654e('0x95'),require(_0x654e('0x96')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x97'),require(_0x654e('0x98')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x1dbaaa['use']('/api/integrations/vtiger/configurations',require(_0x654e('0x99')));_0x1dbaaa['use'](_0x654e('0x9a'),require(_0x654e('0x9b')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9c'),require('./api/intServicenowConfiguration'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9d'),require(_0x654e('0x9e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9f'),require(_0x654e('0xa0')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa1'),require(_0x654e('0xa2')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa3'),require('./api/intDynamics365Field'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa4'),require(_0x654e('0xa5')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa6'),require(_0x654e('0xa7')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa8'),require('./api/intFreshsalesField'));_0x1dbaaa[_0x654e('0x8')]('/api/networks',require('./api/network'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa9'),require('./api/chatQueueReport'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xaa'),require(_0x654e('0xab')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xac'),require(_0x654e('0xad')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xae'),require(_0x654e('0xaf')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb0'),require(_0x654e('0xb1')));_0x1dbaaa['use'](_0x654e('0xb2'),require('./api/smsQueueReport'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb3'),require(_0x654e('0xb4')));_0x1dbaaa[_0x654e('0x8')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x1dbaaa[_0x654e('0x8')]('/api/jscripty/projects',require(_0x654e('0xb5')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb6'),require(_0x654e('0xb7')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb8'),require('./api/squareOdbc'));_0x1dbaaa['use'](_0x654e('0xb9'),require(_0x654e('0xba')));_0x1dbaaa['use']('/api/square/recordings',require('./api/squareRecording'));_0x1dbaaa[_0x654e('0x8')]('/api/square/messages',require(_0x654e('0xbb')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xbc'),require(_0x654e('0xbd')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xbe'),require(_0x654e('0xbf')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc0'),require(_0x654e('0xc1')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc2'),require(_0x654e('0xc3')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc4'),require('./api/attachment'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc5'),require(_0x654e('0xc6')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc7'),require(_0x654e('0xc8')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc9'),require(_0x654e('0xca')));_0x1dbaaa['use'](_0x654e('0xcb'),require('./api/faxTransferReport'));_0x1dbaaa[_0x654e('0x8')]('/api/openchannel/reports/transfer',require(_0x654e('0xcc')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xcd'),require(_0x654e('0xce')));_0x1dbaaa[_0x654e('0x8')]('/api/cm/lists',require(_0x654e('0xcf')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd0'),require(_0x654e('0xd1')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd2'),require('./api/userProfileSection'));_0x1dbaaa[_0x654e('0x8')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x1dbaaa['use'](_0x654e('0xd3'),require('./api/userNotification'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd4'),require(_0x654e('0xd5')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd6'),require(_0x654e('0xd7')));_0x1dbaaa['use'](_0x654e('0xd8'),require(_0x654e('0xd9')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xda'),require(_0x654e('0xdb')));_0x1dbaaa[_0x654e('0x8')]('/api/whatsapp/reports/queue',require(_0x654e('0xdc')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xdd'),require(_0x654e('0xde')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xdf'),require(_0x654e('0xe0')));_0x1dbaaa[_0x654e('0x8')]('/api/cloudProviders',require('./api/cloudProvider'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe1'),require(_0x654e('0xe2')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe3'),require(_0x654e('0xe4')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe5'),require('./api/authLocal'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe6'),require(_0x654e('0xe7')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe8'),require(_0x654e('0xe9')));_0x1dbaaa['use'](_0x654e('0xea'),require(_0x654e('0xeb')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xec'),require(_0x654e('0xed')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xee'),require('./api/version'));_0x1dbaaa['use'](_0x654e('0xef'),require(_0x654e('0xf0')));_0x1dbaaa[_0x654e('0x8')]('/api/pm2',require('./api/pm2'));_0x1dbaaa['use']('/api/webbar',require('./api/webbar'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xf1'),clientSideLogs);_0x1dbaaa[_0x654e('0x8')](_0x654e('0xf2'),express[_0x654e('0xf3')](path[_0x654e('0xf4')](config[_0x654e('0xf5')],_0x654e('0xf2'))));_0x1dbaaa['use'](_0x654e('0xf6'),express[_0x654e('0xf3')](path[_0x654e('0xf4')](config[_0x654e('0xf5')],_0x654e('0xf6'))));_0x1dbaaa[_0x654e('0x8')]('/demo',express[_0x654e('0xf3')](path[_0x654e('0xf4')](config[_0x654e('0xf5')],'/demo')));_0x1dbaaa['use'](_0x654e('0xf7'),express[_0x654e('0xf3')](path['join'](config[_0x654e('0xf5')],_0x654e('0xf8'),_0x654e('0xf9'))));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xfa'),express['static'](path[_0x654e('0xf4')](config[_0x654e('0xf5')],_0x654e('0xfb'))));_0x1dbaaa[_0x654e('0xfc')](_0x654e('0xfd'))[_0x654e('0xfe')](errors[0x194]);_0x1dbaaa[_0x654e('0xfc')]('/*')[_0x654e('0xfe')](function(_0x1a95f7,_0x3748d6){_0x3748d6['sendFile'](path[_0x654e('0xff')](_0x1dbaaa['get']('appPath')+'/index.html'));});return _0x1dbaaa;});}; \ No newline at end of file +var _0xe3ee=['./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/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/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/squareOdbc','/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/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','static','root','/apidoc','/www','join','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/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/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions'];(function(_0x30999c,_0x216a1e){var _0x2b5f42=function(_0x2c967b){while(--_0x2c967b){_0x30999c['push'](_0x30999c['shift']());}};_0x2b5f42(++_0x216a1e);}(_0xe3ee,0x1c1));var _0xee3e=function(_0x1b3264,_0x4e6b43){_0x1b3264=_0x1b3264-0x0;var _0x575eb4=_0xe3ee[_0x1b3264];return _0x575eb4;};'use strict';var path=require(_0xee3e('0x0'));var express=require(_0xee3e('0x1'));var errors=require(_0xee3e('0x2'));var config=require(_0xee3e('0x3'));var setupLoggers=require(_0xee3e('0x4'))[_0xee3e('0x5')];var clientSideLogs=require(_0xee3e('0x6'));exports[_0xee3e('0x7')]=function(_0x51596a){return setupLoggers(_0x51596a)[_0xee3e('0x8')](function(){_0x51596a[_0xee3e('0x9')](_0xee3e('0xa'),require(_0xee3e('0xb')));_0x51596a['use']('/api/voice/chanspy',require(_0xee3e('0xc')));_0x51596a['use'](_0xee3e('0xd'),require(_0xee3e('0xe')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xf'),require(_0xee3e('0x10')));_0x51596a['use']('/api/voice/mohs',require(_0xee3e('0x11')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x12'),require('./api/voiceQueue'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x13'),require(_0xee3e('0x14')));_0x51596a['use'](_0xee3e('0x15'),require(_0xee3e('0x16')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x17'),require('./api/voiceMail'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x18'),require(_0xee3e('0x19')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x1a'),require('./api/voiceCallReport'));_0x51596a[_0xee3e('0x9')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x51596a['use'](_0xee3e('0x1b'),require(_0xee3e('0x1c')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x1d'),require(_0xee3e('0x1e')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x1f'),require(_0xee3e('0x20')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x21'),require(_0xee3e('0x22')));_0x51596a['use'](_0xee3e('0x23'),require('./api/voiceTransferReport'));_0x51596a['use']('/api/mail/out_servers',require(_0xee3e('0x24')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x25'),require(_0xee3e('0x26')));_0x51596a[_0xee3e('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x51596a[_0xee3e('0x9')]('/api/mail/substatuses',require(_0xee3e('0x27')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x28'),require('./api/mailInteraction'));_0x51596a['use'](_0xee3e('0x29'),require('./api/mailMessage'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x2a'),require('./api/mailApplication'));_0x51596a[_0xee3e('0x9')]('/api/mail/reports/queue',require(_0xee3e('0x2b')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x2c'),require('./api/dashboard'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x2d'),require(_0xee3e('0x2e')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x2f'),require(_0xee3e('0x30')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x31'),require('./api/faxApplication'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x32'),require('./api/faxInteraction'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x33'),require('./api/faxMessage'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x34'),require(_0xee3e('0x35')));_0x51596a['use']('/api/fax/reports/queue',require(_0xee3e('0x36')));_0x51596a[_0xee3e('0x9')]('/api/sms/accounts',require('./api/smsAccount'));_0x51596a[_0xee3e('0x9')]('/api/sms/applications',require(_0xee3e('0x37')));_0x51596a['use'](_0xee3e('0x38'),require(_0xee3e('0x39')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x3a'),require(_0xee3e('0x3b')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x3c'),require(_0xee3e('0x3d')));_0x51596a[_0xee3e('0x9')]('/api/openchannel/accounts',require(_0xee3e('0x3e')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x3f'),require('./api/openchannelApplication'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x40'),require(_0xee3e('0x41')));_0x51596a[_0xee3e('0x9')]('/api/openchannel/messages',require(_0xee3e('0x42')));_0x51596a['use'](_0xee3e('0x43'),require('./api/openchannelQueue'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x44'),require(_0xee3e('0x45')));_0x51596a['use'](_0xee3e('0x46'),require(_0xee3e('0x47')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x48'),require('./api/chatApplication'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x49'),require(_0xee3e('0x4a')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x4b'),require('./api/chatMessage'));_0x51596a['use'](_0xee3e('0x4c'),require(_0xee3e('0x4d')));_0x51596a[_0xee3e('0x9')]('/api/chat/queues',require('./api/chatQueue'));_0x51596a['use'](_0xee3e('0x4e'),require(_0xee3e('0x4f')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x50'),require('./api/chatProactiveAction'));_0x51596a['use'](_0xee3e('0x51'),require(_0xee3e('0x52')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x53'),require(_0xee3e('0x54')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x55'),require(_0xee3e('0x56')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x57'),require(_0xee3e('0x58')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x59'),require(_0xee3e('0x5a')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x5b'),require('./api/cmHopperHistory'));_0x51596a[_0xee3e('0x9')]('/api/cm/custom_fields',require(_0xee3e('0x5c')));_0x51596a['use'](_0xee3e('0x5d'),require(_0xee3e('0x5e')));_0x51596a[_0xee3e('0x9')]('/api/automations',require(_0xee3e('0x5f')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x60'),require(_0xee3e('0x61')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x62'),require(_0xee3e('0x63')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x64'),require(_0xee3e('0x65')));_0x51596a[_0xee3e('0x9')]('/api/intervals',require(_0xee3e('0x66')));_0x51596a['use'](_0xee3e('0x67'),require(_0xee3e('0x68')));_0x51596a[_0xee3e('0x9')]('/api/cdr',require(_0xee3e('0x69')));_0x51596a['use'](_0xee3e('0x6a'),require(_0xee3e('0x6b')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x6c'),require(_0xee3e('0x6d')));_0x51596a['use'](_0xee3e('0x6e'),require(_0xee3e('0x6f')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x70'),require(_0xee3e('0x71')));_0x51596a['use'](_0xee3e('0x72'),require('./api/contactItemType'));_0x51596a['use'](_0xee3e('0x73'),require(_0xee3e('0x74')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x75'),require(_0xee3e('0x76')));_0x51596a[_0xee3e('0x9')]('/api/templates',require(_0xee3e('0x77')));_0x51596a[_0xee3e('0x9')]('/api/triggers',require('./api/trigger'));_0x51596a['use'](_0xee3e('0x78'),require(_0xee3e('0x79')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x7a'),require(_0xee3e('0x7b')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x7c'),require(_0xee3e('0x7d')));_0x51596a['use'](_0xee3e('0x7e'),require(_0xee3e('0x7f')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x80'),require(_0xee3e('0x81')));_0x51596a['use'](_0xee3e('0x82'),require(_0xee3e('0x83')));_0x51596a[_0xee3e('0x9')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x51596a['use'](_0xee3e('0x84'),require(_0xee3e('0x85')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x86'),require(_0xee3e('0x87')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x88'),require(_0xee3e('0x89')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x8a'),require(_0xee3e('0x8b')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x8c'),require(_0xee3e('0x8d')));_0x51596a[_0xee3e('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x51596a[_0xee3e('0x9')]('/api/integrations/sugarcrm/configurations',require(_0xee3e('0x8e')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x8f'),require('./api/intSugarcrmField'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x90'),require('./api/intDeskAccount'));_0x51596a[_0xee3e('0x9')]('/api/integrations/desk/configurations',require(_0xee3e('0x91')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x92'),require(_0xee3e('0x93')));_0x51596a['use'](_0xee3e('0x94'),require(_0xee3e('0x95')));_0x51596a['use'](_0xee3e('0x96'),require(_0xee3e('0x97')));_0x51596a[_0xee3e('0x9')]('/api/integrations/zoho/fields',require(_0xee3e('0x98')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x99'),require(_0xee3e('0x9a')));_0x51596a[_0xee3e('0x9')]('/api/integrations/zendesk/configurations',require(_0xee3e('0x9b')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x9c'),require(_0xee3e('0x9d')));_0x51596a[_0xee3e('0x9')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x9e'),require('./api/intFreshdeskConfiguration'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x9f'),require('./api/intFreshdeskField'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xa0'),require('./api/intVtigerAccount'));_0x51596a['use'](_0xee3e('0xa1'),require(_0xee3e('0xa2')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xa3'),require(_0xee3e('0xa4')));_0x51596a[_0xee3e('0x9')]('/api/integrations/servicenow/accounts',require(_0xee3e('0xa5')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xa6'),require(_0xee3e('0xa7')));_0x51596a['use'](_0xee3e('0xa8'),require(_0xee3e('0xa9')));_0x51596a[_0xee3e('0x9')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xaa'),require(_0xee3e('0xab')));_0x51596a['use'](_0xee3e('0xac'),require('./api/intDynamics365Field'));_0x51596a[_0xee3e('0x9')]('/api/integrations/freshsales/accounts',require(_0xee3e('0xad')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xae'),require(_0xee3e('0xaf')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xb0'),require(_0xee3e('0xb1')));_0x51596a['use'](_0xee3e('0xb2'),require(_0xee3e('0xb3')));_0x51596a[_0xee3e('0x9')]('/api/chat/reports/queue',require(_0xee3e('0xb4')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xb5'),require(_0xee3e('0xb6')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xb7'),require(_0xee3e('0xb8')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xb9'),require(_0xee3e('0xba')));_0x51596a['use'](_0xee3e('0xbb'),require(_0xee3e('0xbc')));_0x51596a['use'](_0xee3e('0xbd'),require(_0xee3e('0xbe')));_0x51596a['use'](_0xee3e('0xbf'),require(_0xee3e('0xc0')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xc1'),require(_0xee3e('0xc2')));_0x51596a['use']('/api/jscripty/projects',require(_0xee3e('0xc3')));_0x51596a[_0xee3e('0x9')]('/api/settings',require('./api/setting'));_0x51596a[_0xee3e('0x9')]('/api/square/odbc',require(_0xee3e('0xc4')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xc5'),require(_0xee3e('0xc6')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xc7'),require(_0xee3e('0xc8')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xc9'),require(_0xee3e('0xca')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xcb'),require('./api/team'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xcc'),require('./api/license'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xcd'),require(_0xee3e('0xce')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xcf'),require(_0xee3e('0xd0')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xd1'),require(_0xee3e('0xd2')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xd3'),require(_0xee3e('0xd4')));_0x51596a['use'](_0xee3e('0xd5'),require('./api/mailTransferReport'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xd6'),require(_0xee3e('0xd7')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xd8'),require(_0xee3e('0xd9')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xda'),require('./api/openchannelTransferReport'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xdb'),require(_0xee3e('0xdc')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xdd'),require(_0xee3e('0xde')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xdf'),require('./api/voicePrefix'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xe0'),require('./api/userProfile'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xe1'),require(_0xee3e('0xe2')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xe3'),require(_0xee3e('0xe4')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xe5'),require(_0xee3e('0xe6')));_0x51596a['use'](_0xee3e('0xe7'),require(_0xee3e('0xe8')));_0x51596a['use'](_0xee3e('0xe9'),require(_0xee3e('0xea')));_0x51596a[_0xee3e('0x9')]('/api/whatsapp/interactions',require(_0xee3e('0xeb')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xec'),require(_0xee3e('0xed')));_0x51596a['use'](_0xee3e('0xee'),require(_0xee3e('0xef')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xf0'),require(_0xee3e('0xf1')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xf2'),require('./api/whatsappQueue'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xf3'),require('./api/cloudProvider'));_0x51596a[_0xee3e('0x9')](_0xee3e('0xf4'),require(_0xee3e('0xf5')));_0x51596a[_0xee3e('0x9')]('/api/user-settings',require(_0xee3e('0xf6')));_0x51596a['use'](_0xee3e('0xf7'),require(_0xee3e('0xf8')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xf9'),require(_0xee3e('0xfa')));_0x51596a['use'](_0xee3e('0xfb'),require(_0xee3e('0xfc')));_0x51596a[_0xee3e('0x9')]('/api/jira',require(_0xee3e('0xfd')));_0x51596a[_0xee3e('0x9')](_0xee3e('0xfe'),require(_0xee3e('0xff')));_0x51596a['use'](_0xee3e('0x100'),require('./api/version'));_0x51596a[_0xee3e('0x9')](_0xee3e('0x101'),require('./api/system'));_0x51596a['use'](_0xee3e('0x102'),require(_0xee3e('0x103')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x104'),require('./api/webbar'));_0x51596a[_0xee3e('0x9')]('/api/logs',clientSideLogs);_0x51596a[_0xee3e('0x9')]('/apidoc',express[_0xee3e('0x105')](path['join'](config[_0xee3e('0x106')],_0xee3e('0x107'))));_0x51596a[_0xee3e('0x9')](_0xee3e('0x108'),express[_0xee3e('0x105')](path[_0xee3e('0x109')](config['root'],'/www')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x10a'),express[_0xee3e('0x105')](path[_0xee3e('0x109')](config[_0xee3e('0x106')],_0xee3e('0x10a'))));_0x51596a['use']('/snippet',express[_0xee3e('0x105')](path['join'](config[_0xee3e('0x106')],_0xee3e('0x10b'),'3.1.0')));_0x51596a[_0xee3e('0x9')](_0xee3e('0x10c'),express[_0xee3e('0x105')](path['join'](config[_0xee3e('0x106')],_0xee3e('0x10d'))));_0x51596a[_0xee3e('0x10e')](_0xee3e('0x10f'))[_0xee3e('0x110')](errors[0x194]);_0x51596a[_0xee3e('0x10e')]('/*')[_0xee3e('0x110')](function(_0x4780be,_0x1f1cc8){_0x1f1cc8[_0xee3e('0x111')](path[_0xee3e('0x112')](_0x51596a[_0xee3e('0x110')]('appPath')+'/index.html'));});return _0x51596a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f6b7769..32d9403 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07d7=['../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/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.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/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','listen','log','../config/triggers','default','jayson/promise','../config/environment','merge','../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/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x4596c8,_0x3ae0f3){var _0x37f619=function(_0x218c64){while(--_0x218c64){_0x4596c8['push'](_0x4596c8['shift']());}};_0x37f619(++_0x3ae0f3);}(_0x07d7,0x141));var _0x707d=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x07d7[_0x4bed75];return _0x2dd8e8;};'use strict';var jayson=require(_0x707d('0x0'));var _=require('lodash');var config=require(_0x707d('0x1'));exports['listen']=function(){return new Promise(function(_0xc7732c,_0x34dc7c){var _0x33c8f4={};_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/user/user.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x3')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x4')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x5')));_0x33c8f4=_['merge'](_0x33c8f4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x6')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x7')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x8')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x9')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xa')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xb')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/mailServerIn/mailServerIn.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0xc')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xd')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/mailInteraction/mailInteraction.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xe')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/mailApplication/mailApplication.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xf')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x10')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x11')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x12')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x13')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x14')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x15')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x16')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x17')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x18')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/smsQueue/smsQueue.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x19')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1a')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1b')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x1c')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1d')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1e')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x1f')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x20')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/cmHopper/cmHopper.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x21')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x22')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x23')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x24')));_0x33c8f4=_['merge'](_0x33c8f4,require('../api/sound/sound.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x25')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x26')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x27')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/variable/variable.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x28')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x29')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2a')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2b')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x2c')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2d')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x2e')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2f')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x30')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x31')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x32')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/squareOdbc/squareOdbc.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x33')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x34')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x35')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/campaign/campaign.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x36')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/plugin/plugin.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x37')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x38')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x39')));var _0x4be0c2=jayson[_0x707d('0x3a')](_0x33c8f4)[_0x707d('0x3b')]();var _0x1b7f29=config['rpc'][_0x707d('0x3c')]||config['port']+0x1;var _0x121df7=config[_0x707d('0x3d')]['ip']||_0x707d('0x3e');_0x4be0c2['on'](_0x707d('0x3f'),function(_0x429108){return _0x34dc7c(_0x429108);});_0x4be0c2[_0x707d('0x40')](_0x1b7f29,_0x121df7,function(){console[_0x707d('0x41')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x121df7,_0x1b7f29);require(_0x707d('0x42'))[_0x707d('0x43')]();return _0xc7732c('RPC\x20listening\x20on\x20'+_0x121df7+':'+_0x1b7f29);});});}; \ No newline at end of file +var _0x4745=['../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.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','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.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/smsQueueReport/smsQueueReport.rpc'];(function(_0x11fe8d,_0x19aba4){var _0x356099=function(_0x50c919){while(--_0x50c919){_0x11fe8d['push'](_0x11fe8d['shift']());}};_0x356099(++_0x19aba4);}(_0x4745,0xf3));var _0x5474=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4745[_0x4154a6];return _0x3b2786;};'use strict';var jayson=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));var config=require(_0x5474('0x2'));exports[_0x5474('0x3')]=function(){return new Promise(function(_0x1c18fa,_0x27bc79){var _0x30b98a={};_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x5')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x6')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/voiceQueue/voiceQueue.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x7')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x8')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x9')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0xa')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0xb')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0xc')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0xd')));_0x30b98a=_['merge'](_0x30b98a,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0xe')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0xf')));_0x30b98a=_['merge'](_0x30b98a,require('../api/mailQueue/mailQueue.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/mailInteraction/mailInteraction.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x10')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x11')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x12')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x13')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x14')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x15')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x16')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/smsAccount/smsAccount.rpc'));_0x30b98a=_['merge'](_0x30b98a,require('../api/smsInteraction/smsInteraction.rpc'));_0x30b98a=_['merge'](_0x30b98a,require('../api/smsMessage/smsMessage.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x17')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x18')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x19')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x1a')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x1b')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x1c')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x1d')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x1e')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x1f')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/cmHopper/cmHopper.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x20')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x21')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x22')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x23')));_0x30b98a=_['merge'](_0x30b98a,require('../api/pause/pause.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x24')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x25')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x26')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x27')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x28')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x30b98a=_['merge'](_0x30b98a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x29')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x2a')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x2b')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x2c')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x2d')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x2e')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x2f')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x30')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x31')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x32')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/setting/setting.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x33')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x34')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x35')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x36')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x37')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require('../api/attachment/attachment.rpc'));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x38')));_0x30b98a=_['merge'](_0x30b98a,require(_0x5474('0x39')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x3a')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x3b')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x3c')));_0x30b98a=_[_0x5474('0x4')](_0x30b98a,require(_0x5474('0x3d')));var _0xc76269=jayson[_0x5474('0x3e')](_0x30b98a)[_0x5474('0x3f')]();var _0x23141e=config[_0x5474('0x40')]['port']||config[_0x5474('0x41')]+0x1;var _0x55a32f=config['rpc']['ip']||_0x5474('0x42');_0xc76269['on'](_0x5474('0x43'),function(_0x1c3d61){return _0x27bc79(_0x1c3d61);});_0xc76269[_0x5474('0x3')](_0x23141e,_0x55a32f,function(){console[_0x5474('0x44')](_0x5474('0x45'),_0x55a32f,_0x23141e);require(_0x5474('0x46'))[_0x5474('0x47')]();return _0x1c18fa(_0x5474('0x48')+_0x55a32f+':'+_0x23141e);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4bc5953..29e4c99 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 _0x890b=['util','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','emit','ready','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','indexOf','startsWith','split','length','match','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','close','prototype','sendRequest','sync','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\x20EXTENSION\x20%s','HANGUP','isBoolean','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','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','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','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x33afed,_0x2b3e20){var _0x3c5803=function(_0x1917ed){while(--_0x1917ed){_0x33afed['push'](_0x33afed['shift']());}};_0x3c5803(++_0x2b3e20);}(_0x890b,0x168));var _0xb890=function(_0x3330ab,_0x52aa37){_0x3330ab=_0x3330ab-0x0;var _0x4687ef=_0x890b[_0x3330ab];return _0x4687ef;};'use strict';var util=require(_0xb890('0x0'));var _=require('lodash');var EventEmitter=require(_0xb890('0x1'))[_0xb890('0x2')];var AGIReply=require(_0xb890('0x3'));var AGIError=require(_0xb890('0x4'));function AGIChannel(_0x1246ca){var _0x409b21=this,_0x240155=new AGIReply(),_0x53cfb1=![],_0x523efb={};EventEmitter[_0xb890('0x5')](_0x409b21);_0x1246ca['setEncoding'](_0xb890('0x6'));_0x1246ca[_0xb890('0x7')](0x8*0x3c*0x3c*0x3e8);_0x240155[_0xb890('0x8')]('utf8');_0x240155['on']('headers',function(_0x38175e){for(var _0x23a816 in _0x38175e){_0x409b21[_0x23a816]=_0x38175e[_0x23a816];}_0x409b21[_0xb890('0x9')](_0xb890('0xa'));});_0x240155['on']('line',function(_0x249744){if(_0x249744['toLowerCase']()==_0xb890('0xb')){_0x409b21[_0xb890('0x9')](_0xb890('0xb'));return;}if(_0x249744[_0xb890('0xc')](0x0,0xb)==_0xb890('0xd')){_0x53cfb1=!![];}if(_0x53cfb1){_0x523efb['rx']+=_0x249744+'\x0a';if(_0x249744[_0xb890('0xe')](_0xb890('0xf'))!=-0x1){_0x53cfb1=![];}}else{_0x523efb['rx']=_0x249744;}if(_0x53cfb1){return;}if(typeof _0x523efb['cb']==_0xb890('0x10')){var _0xa89df9=_0x523efb['rx'][_0xb890('0xc')](0x0,0x3),_0x4e2638=null,_0x525fbc=null;_0xa89df9=parseInt(_0xa89df9);if(isNaN(_0xa89df9)){_0x523efb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xa89df9!=0xc8){_0x523efb['cb'](null,{'code':_0xa89df9,'result':-0x1,'extra':'KO'});return;}_0x4e2638=_0x523efb['rx']['substring'](0x4)[_0xb890('0x11')]('result=','');if(_0x4e2638[_0xb890('0x12')]('\x20')!=-0x1){_0x4e2638=_0x4e2638['substr'](0x0,_0x4e2638[_0xb890('0x12')]('\x20'));}if(_[_0xb890('0x13')](_0x4e2638,'-1')){_0x4e2638=parseInt(_0x4e2638);}_0x525fbc=_0x523efb['rx'][_0xb890('0x14')]('\x20');if(_0x525fbc[_0xb890('0x15')]==0x3){_0x525fbc=_0x525fbc[0x2][_0xb890('0xc')](0x1,_0x525fbc[0x2][_0xb890('0x15')]-0x1);}else if(_0x525fbc[_0xb890('0x15')]>0x3){var _0x46075a=/\((.+)\)/;var _0x365f5c=_0x523efb['rx'][_0xb890('0x16')](_0x46075a);if(_0x365f5c){_0x525fbc=_0x365f5c[0x1];}else{_0x525fbc=null;}}else{_0x525fbc=null;}_0x523efb['cb'](null,{'code':_0xa89df9,'result':_0x4e2638,'extra':_0x525fbc});}});_0x1246ca['on']('error',function(_0x1596bd){_0x409b21[_0xb890('0x9')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x1596bd[_0xb890('0x17')]));});_0x1246ca['on']('close',function(){_0x409b21[_0xb890('0x9')]('close',new AGIError(_0xb890('0x18')));});_0x1246ca['on'](_0xb890('0x19'),function(){_0x409b21[_0xb890('0x9')](_0xb890('0x19'),new AGIError(_0xb890('0x1a')));_0x1246ca[_0xb890('0x1b')]();});_0x1246ca['pipe'](_0x240155);this[_0xb890('0x1c')]=function(_0x4de0be,_0x19b521){var _0x4de0be=_0x4de0be||'',_0x19b521=typeof _0x19b521==_0xb890('0x10')?_0x19b521:new Function();_0x523efb={'tx':_0x4de0be,'rx':'','cb':_0x19b521};_0x1246ca[_0xb890('0x1d')](_0x4de0be+'\x0a');},this[_0xb890('0x1e')]=function(){_0x1246ca[_0xb890('0x1b')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xb890('0x1f')][_0xb890('0x20')]=function(_0x10f11f){return this[_0xb890('0x1c')][_0xb890('0x21')](this,_0x10f11f);};AGIChannel['prototype']['answer']=function(){return this[_0xb890('0x20')]('ANSWER');};AGIChannel['prototype'][_0xb890('0x22')]=function(_0x42570c,_0x52a256,_0x2a2413){_0x42570c=_0x42570c===undefined?_0xb890('0x23'):_0x42570c;_0x52a256=_0x52a256===undefined?'5':_0x52a256;_0x2a2413=_0x2a2413===undefined?'1':_0x2a2413;return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x25'),_0x42570c,_0x52a256*0x3e8,_0x2a2413));};AGIChannel['prototype']['noop']=function(_0x4f3e4e){_0x4f3e4e=_0x4f3e4e||_0xb890('0x26');return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x27'),_0x4f3e4e));};AGIChannel[_0xb890('0x1f')][_0xb890('0x28')]=function(_0x1b81f9,_0x2be72a){if(_[_0xb890('0x29')](_0x2be72a)){return this['sendRequest'](util[_0xb890('0x24')](_0xb890('0x2a'),_0x1b81f9,_0x2be72a[_0xb890('0x2b')](',')));}return this[_0xb890('0x20')](util['format'](_0xb890('0x2a'),_0x1b81f9,_0x2be72a));};AGIChannel[_0xb890('0x1f')][_0xb890('0x2c')]=function(_0x5c052e){return this[_0xb890('0x20')](util[_0xb890('0x24')]('SET\x20CONTEXT\x20%s',_0x5c052e));};AGIChannel[_0xb890('0x1f')]['setExtension']=function(_0xa5c678){return this['sendRequest'](util[_0xb890('0x24')](_0xb890('0x2d'),_0xa5c678));};AGIChannel[_0xb890('0x1f')]['setPriority']=function(_0x3a2e31){return this['sendRequest'](util[_0xb890('0x24')]('SET\x20PRIORITY\x20%s',_0x3a2e31));};AGIChannel[_0xb890('0x1f')][_0xb890('0xb')]=function(){return this[_0xb890('0x20')](_0xb890('0x2e'));};AGIChannel[_0xb890('0x1f')]['setVariable']=function(_0x4e2181,_0x1f4eec){var _0x19d689=_[_0xb890('0x2f')](_0x1f4eec)||_['isNumber'](_0x1f4eec)?_0x1f4eec[_0xb890('0x30')]():_0x1f4eec;return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x31'),_0x4e2181,_0x19d689?_0x19d689[_0xb890('0x30')]()[_0xb890('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb890('0x1f')][_0xb890('0x32')]=function(_0x54e410,_0x3fcfdf){return this[_0xb890('0x20')](util['format'](_0xb890('0x33'),_0x54e410,_0x3fcfdf));};AGIChannel['prototype'][_0xb890('0x34')]=function(_0x51c1e1,_0x2882b8){return this[_0xb890('0x20')](util['format'](_0xb890('0x35'),_0x51c1e1,_0x2882b8));};AGIChannel[_0xb890('0x1f')][_0xb890('0x36')]=function(_0x238cef,_0x5673d9){return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x37'),_0x238cef,_0x5673d9));};AGIChannel[_0xb890('0x1f')]['continueAt']=function(_0x1a3406,_0x2e6672,_0x2f5719){_0x2e6672=_0x2e6672||this[_0xb890('0x38')];_0x2f5719=_0x2f5719||0x1;this[_0xb890('0x2c')](_0x1a3406);this[_0xb890('0x39')](_0x2e6672);this[_0xb890('0x3a')](_0x2f5719);return this['noop'](util[_0xb890('0x24')](_0xb890('0x3b'),_0x1a3406,_0x2e6672,_0x2f5719));};AGIChannel[_0xb890('0x1f')]['getVariable']=function(_0x68a621){return this['sendRequest'](util[_0xb890('0x24')]('GET\x20VARIABLE\x20\x22%s\x22',_0x68a621));};AGIChannel['prototype'][_0xb890('0x3c')]=function(_0x481ef3,_0x38111e,_0x1124f7,_0x5c5b4c,_0x19ee93,_0x402ded){_0x38111e=_0x38111e||_0xb890('0x3d');_0x1124f7=_0x1124f7||'';_0x5c5b4c=_0x5c5b4c===undefined?-0x1:_0x5c5b4c==='-1'?-0x1:_0x5c5b4c*0x3e8;_0x19ee93=_0x19ee93===undefined?'':'s='+_0x19ee93;_0x402ded=_0x402ded?_0xb890('0x3e'):'';return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x3f'),_0x481ef3,_0x38111e,_0x1124f7,_0x5c5b4c,_0x402ded,_0x19ee93));};AGIChannel[_0xb890('0x1f')][_0xb890('0x40')]=function(_0x56e260,_0x34bb02){_0x34bb02=_0x34bb02||'';return this[_0xb890('0x20')](util['format'](_0xb890('0x41'),_0x56e260,_0x34bb02));};AGIChannel[_0xb890('0x1f')][_0xb890('0x42')]=function(_0x16d0bb){return this[_0xb890('0x28')](_0xb890('0x43'),_0x16d0bb);};AGIChannel[_0xb890('0x1f')][_0xb890('0x44')]=function(_0xd73568){return this[_0xb890('0x28')](_0xb890('0x45'),_0xd73568);};AGIChannel[_0xb890('0x1f')]['error']=function(_0x43c62c,_0x25a437){this[_0xb890('0x46')](util[_0xb890('0x24')](_0xb890('0x47'),_0x43c62c['id'],_0x43c62c['label'],_0x25a437));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x91c6=['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','setEncoding','utf8','setTimeout','headers','ready','line','hangup','substring','520-Invalid','search','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','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'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0x91c6,0xf9));var _0x691c=function(_0x45a88f,_0x285610){_0x45a88f=_0x45a88f-0x0;var _0x28b2c5=_0x91c6[_0x45a88f];return _0x28b2c5;};'use strict';var util=require(_0x691c('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x691c('0x1')];var AGIReply=require(_0x691c('0x2'));var AGIError=require(_0x691c('0x3'));function AGIChannel(_0xa59a0a){var _0xa7799c=this,_0x4944ce=new AGIReply(),_0xa14528=![],_0x10c5df={};EventEmitter[_0x691c('0x4')](_0xa7799c);_0xa59a0a[_0x691c('0x5')](_0x691c('0x6'));_0xa59a0a[_0x691c('0x7')](0x8*0x3c*0x3c*0x3e8);_0x4944ce['setEncoding'](_0x691c('0x6'));_0x4944ce['on'](_0x691c('0x8'),function(_0xda904f){for(var _0x488086 in _0xda904f){_0xa7799c[_0x488086]=_0xda904f[_0x488086];}_0xa7799c['emit'](_0x691c('0x9'));});_0x4944ce['on'](_0x691c('0xa'),function(_0x3efbfb){if(_0x3efbfb['toLowerCase']()=='hangup'){_0xa7799c['emit'](_0x691c('0xb'));return;}if(_0x3efbfb[_0x691c('0xc')](0x0,0xb)==_0x691c('0xd')){_0xa14528=!![];}if(_0xa14528){_0x10c5df['rx']+=_0x3efbfb+'\x0a';if(_0x3efbfb[_0x691c('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0xa14528=![];}}else{_0x10c5df['rx']=_0x3efbfb;}if(_0xa14528){return;}if(typeof _0x10c5df['cb']=='function'){var _0x2b69f5=_0x10c5df['rx'][_0x691c('0xc')](0x0,0x3),_0x246a67=null,_0x20fd87=null;_0x2b69f5=parseInt(_0x2b69f5);if(isNaN(_0x2b69f5)){_0x10c5df['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x691c('0xf')});return;}if(_0x2b69f5!=0xc8){_0x10c5df['cb'](null,{'code':_0x2b69f5,'result':-0x1,'extra':'KO'});return;}_0x246a67=_0x10c5df['rx'][_0x691c('0xc')](0x4)[_0x691c('0x10')](_0x691c('0x11'),'');if(_0x246a67['indexOf']('\x20')!=-0x1){_0x246a67=_0x246a67[_0x691c('0x12')](0x0,_0x246a67[_0x691c('0x13')]('\x20'));}if(_[_0x691c('0x14')](_0x246a67,'-1')){_0x246a67=parseInt(_0x246a67);}_0x20fd87=_0x10c5df['rx'][_0x691c('0x15')]('\x20');if(_0x20fd87[_0x691c('0x16')]==0x3){_0x20fd87=_0x20fd87[0x2][_0x691c('0xc')](0x1,_0x20fd87[0x2][_0x691c('0x16')]-0x1);}else if(_0x20fd87[_0x691c('0x16')]>0x3){var _0x482351=/\((.+)\)/;var _0x634280=_0x10c5df['rx'][_0x691c('0x17')](_0x482351);if(_0x634280){_0x20fd87=_0x634280[0x1];}else{_0x20fd87=null;}}else{_0x20fd87=null;}_0x10c5df['cb'](null,{'code':_0x2b69f5,'result':_0x246a67,'extra':_0x20fd87});}});_0xa59a0a['on'](_0x691c('0x18'),function(_0x299653){_0xa7799c[_0x691c('0x19')]('error',new AGIError(_0x691c('0x1a'),_0x299653[_0x691c('0x1b')]));});_0xa59a0a['on']('close',function(){_0xa7799c['emit']('close',new AGIError(_0x691c('0x1c')));});_0xa59a0a['on']('timeout',function(){_0xa7799c[_0x691c('0x19')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xa59a0a[_0x691c('0x1d')]();});_0xa59a0a[_0x691c('0x1e')](_0x4944ce);this[_0x691c('0x1f')]=function(_0x1cb6f1,_0xc7de7f){var _0x1cb6f1=_0x1cb6f1||'',_0xc7de7f=typeof _0xc7de7f=='function'?_0xc7de7f:new Function();_0x10c5df={'tx':_0x1cb6f1,'rx':'','cb':_0xc7de7f};_0xa59a0a[_0x691c('0x20')](_0x1cb6f1+'\x0a');},this['close']=function(){_0xa59a0a[_0x691c('0x1d')]();};}util[_0x691c('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x691c('0x22')][_0x691c('0x23')]=function(_0x532a85){return this['command'][_0x691c('0x24')](this,_0x532a85);};AGIChannel['prototype'][_0x691c('0x25')]=function(){return this[_0x691c('0x23')](_0x691c('0x26'));};AGIChannel[_0x691c('0x22')][_0x691c('0x27')]=function(_0x4281ad,_0xbd4585,_0xccf826){_0x4281ad=_0x4281ad===undefined?'beep':_0x4281ad;_0xbd4585=_0xbd4585===undefined?'5':_0xbd4585;_0xccf826=_0xccf826===undefined?'1':_0xccf826;return this[_0x691c('0x23')](util[_0x691c('0x28')](_0x691c('0x29'),_0x4281ad,_0xbd4585*0x3e8,_0xccf826));};AGIChannel[_0x691c('0x22')]['noop']=function(_0x5208b2){_0x5208b2=_0x5208b2||_0x691c('0x2a');return this[_0x691c('0x23')](util['format'](_0x691c('0x2b'),_0x5208b2));};AGIChannel['prototype'][_0x691c('0x2c')]=function(_0x5071f9,_0x416c43){if(_[_0x691c('0x2d')](_0x416c43)){return this[_0x691c('0x23')](util['format']('EXEC\x20%s\x20%s',_0x5071f9,_0x416c43[_0x691c('0x2e')](',')));}return this[_0x691c('0x23')](util[_0x691c('0x28')](_0x691c('0x2f'),_0x5071f9,_0x416c43));};AGIChannel[_0x691c('0x22')][_0x691c('0x30')]=function(_0x3eb8b2){return this['sendRequest'](util[_0x691c('0x28')](_0x691c('0x31'),_0x3eb8b2));};AGIChannel['prototype'][_0x691c('0x32')]=function(_0x2eb0d8){return this[_0x691c('0x23')](util[_0x691c('0x28')]('SET\x20EXTENSION\x20%s',_0x2eb0d8));};AGIChannel[_0x691c('0x22')][_0x691c('0x33')]=function(_0x41974c){return this['sendRequest'](util[_0x691c('0x28')](_0x691c('0x34'),_0x41974c));};AGIChannel[_0x691c('0x22')][_0x691c('0xb')]=function(){return this[_0x691c('0x23')]('HANGUP');};AGIChannel[_0x691c('0x22')][_0x691c('0x35')]=function(_0x385cc7,_0x1c5aa9){var _0x183aad=_[_0x691c('0x36')](_0x1c5aa9)||_['isNumber'](_0x1c5aa9)?_0x1c5aa9[_0x691c('0x37')]():_0x1c5aa9;return this['sendRequest'](util['format'](_0x691c('0x38'),_0x385cc7,_0x183aad?_0x183aad[_0x691c('0x37')]()[_0x691c('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x691c('0x22')]['sayNumber']=function(_0x41dfb5,_0x4dbbbc){return this[_0x691c('0x23')](util[_0x691c('0x28')](_0x691c('0x39'),_0x41dfb5,_0x4dbbbc));};AGIChannel[_0x691c('0x22')][_0x691c('0x3a')]=function(_0x2c2cc4,_0x9ca616){return this[_0x691c('0x23')](util[_0x691c('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x2c2cc4,_0x9ca616));};AGIChannel[_0x691c('0x22')][_0x691c('0x3b')]=function(_0x515aa2,_0x5d1742){return this[_0x691c('0x23')](util[_0x691c('0x28')](_0x691c('0x3c'),_0x515aa2,_0x5d1742));};AGIChannel[_0x691c('0x22')][_0x691c('0x3d')]=function(_0x231174,_0x19fa3f,_0x2bf2b1){_0x19fa3f=_0x19fa3f||this[_0x691c('0x3e')];_0x2bf2b1=_0x2bf2b1||0x1;this[_0x691c('0x30')](_0x231174);this['setExtension'](_0x19fa3f);this[_0x691c('0x33')](_0x2bf2b1);return this[_0x691c('0x3f')](util[_0x691c('0x28')](_0x691c('0x40'),_0x231174,_0x19fa3f,_0x2bf2b1));};AGIChannel[_0x691c('0x22')][_0x691c('0x41')]=function(_0x51d557){return this[_0x691c('0x23')](util[_0x691c('0x28')](_0x691c('0x42'),_0x51d557));};AGIChannel[_0x691c('0x22')][_0x691c('0x43')]=function(_0x2d8afb,_0xdc0573,_0x326537,_0x14cfa2,_0x4aa751,_0x24423e){_0xdc0573=_0xdc0573||_0x691c('0x44');_0x326537=_0x326537||'';_0x14cfa2=_0x14cfa2===undefined?-0x1:_0x14cfa2==='-1'?-0x1:_0x14cfa2*0x3e8;_0x4aa751=_0x4aa751===undefined?'':'s='+_0x4aa751;_0x24423e=_0x24423e?'BEEP':'';return this[_0x691c('0x23')](util[_0x691c('0x28')](_0x691c('0x45'),_0x2d8afb,_0xdc0573,_0x326537,_0x14cfa2,_0x24423e,_0x4aa751));};AGIChannel[_0x691c('0x22')][_0x691c('0x46')]=function(_0x4a2660,_0x37d697){_0x37d697=_0x37d697||'';return this[_0x691c('0x23')](util['format'](_0x691c('0x47'),_0x4a2660,_0x37d697));};AGIChannel[_0x691c('0x22')][_0x691c('0x48')]=function(_0x4c2826){return this[_0x691c('0x2c')](_0x691c('0x49'),_0x4c2826);};AGIChannel[_0x691c('0x22')][_0x691c('0x4a')]=function(_0x32dcf6){return this[_0x691c('0x2c')](_0x691c('0x4b'),_0x32dcf6);};AGIChannel['prototype'][_0x691c('0x18')]=function(_0x137624,_0x79aaec){this[_0x691c('0x3f')](util[_0x691c('0x28')](_0x691c('0x4c'),_0x137624['id'],_0x137624[_0x691c('0x4d')],_0x79aaec));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x691c('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6dd5a04..c5cfa45 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 _0x591a=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','util','Undefined\x20error.'];(function(_0x2cebc5,_0x5642fb){var _0x4c494b=function(_0xeae8ea){while(--_0xeae8ea){_0x2cebc5['push'](_0x2cebc5['shift']());}};_0x4c494b(++_0x5642fb);}(_0x591a,0x19e));var _0xa591=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x591a[_0x588011];return _0x3b3773;};'use strict';var util=require(_0xa591('0x0'));var error={'E_AGI_UNDEFINED':_0xa591('0x1'),'E_AGI_ARGUMENT_PORT':_0xa591('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xa591('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa591('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xa591('0x5'),'E_AGI_SOCKET_ERROR':_0xa591('0x6'),'E_AGI_SOCKET_CLOSE':_0xa591('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xa591('0x8'),'E_AGI_COMMAND_EMPTY':_0xa591('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa591('0xa'),'E_AGI_IVR_ENTRY':_0xa591('0xb')};function AGIError(_0x10ccdb){var _0x10ccdb=_0x10ccdb||null,_0x5113bb=_0x5113bb||[],_0xa42447=0x1,_0x125c02='';if(!error[_0x10ccdb]){_0x10ccdb=_0xa591('0xc');}_0x5113bb[_0xa591('0xd')](error[_0x10ccdb]);while(arguments[_0xa42447]){_0x5113bb['push'](arguments[_0xa42447]);_0xa42447++;}_0x125c02=util['format']['apply'](util,_0x5113bb);this[_0xa591('0xe')]=_0x125c02;this[_0xa591('0xf')]=_0x10ccdb;}module['exports']=AGIError; \ No newline at end of file +var _0x0d2c=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x150143,_0x400370){var _0xfbd91a=function(_0x432e80){while(--_0x432e80){_0x150143['push'](_0x150143['shift']());}};_0xfbd91a(++_0x400370);}(_0x0d2c,0x123));var _0xc0d2=function(_0x130aac,_0x41071b){_0x130aac=_0x130aac-0x0;var _0x1cb8db=_0x0d2c[_0x130aac];return _0x1cb8db;};'use strict';var util=require(_0xc0d2('0x0'));var error={'E_AGI_UNDEFINED':_0xc0d2('0x1'),'E_AGI_ARGUMENT_PORT':_0xc0d2('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xc0d2('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc0d2('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xc0d2('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xc0d2('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc0d2('0x7'),'E_AGI_IVR_ENTRY':_0xc0d2('0x8')};function AGIError(_0x478679){var _0x478679=_0x478679||null,_0x44aa71=_0x44aa71||[],_0x2434b3=0x1,_0x3c3aa1='';if(!error[_0x478679]){_0x478679=_0xc0d2('0x9');}_0x44aa71[_0xc0d2('0xa')](error[_0x478679]);while(arguments[_0x2434b3]){_0x44aa71[_0xc0d2('0xa')](arguments[_0x2434b3]);_0x2434b3++;}_0x3c3aa1=util[_0xc0d2('0xb')]['apply'](util,_0x44aa71);this[_0xc0d2('0xc')]=_0x3c3aa1;this['name']=_0x478679;}module[_0xc0d2('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8b8e9bc..cfe8cbd 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 _0xbcaf=['localhost','subscribe','agi','E_AGI_SERVER_ERROR','message','emit','exports','lodash','events','EventEmitter','redis','defaults'];(function(_0x447582,_0x4f4b8a){var _0x7c0741=function(_0x2ef093){while(--_0x2ef093){_0x447582['push'](_0x447582['shift']());}};_0x7c0741(++_0x4f4b8a);}(_0xbcaf,0xf7));var _0xfbca=function(_0x443ea8,_0x5d4752){_0x443ea8=_0x443ea8-0x0;var _0x56fba9=_0xbcaf[_0x443ea8];return _0x56fba9;};'use strict';var _=require(_0xfbca('0x0'));var EventEmitter=require(_0xfbca('0x1'))[_0xfbca('0x2')];var Redis=require('ioredis');var AGIError=require('./error');var config=require('../../config/environment');config[_0xfbca('0x3')]=_[_0xfbca('0x4')](config[_0xfbca('0x3')],{'host':_0xfbca('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xfbca('0x3')]);sub[_0xfbca('0x6')](_0xfbca('0x7'),function(_0x23bc28){if(_0x23bc28)return eventEmitter['emit']('error',new AGIError(_0xfbca('0x8'),_0x23bc28));});sub['on'](_0xfbca('0x9'),function(_0xa13a65,_0xe24266){if(_0xa13a65!==_0xfbca('0x7'))return;try{var _0x45fa59=JSON['parse'](_0xe24266);eventEmitter[_0xfbca('0xa')]('projectUpdate',_0x45fa59);}catch(_0x1ab775){eventEmitter[_0xfbca('0xa')]('error',new AGIError(_0xfbca('0x8'),_0x1ab775));}});module[_0xfbca('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xef96=['defaults','localhost','agi','emit','E_AGI_SERVER_ERROR','message','projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error','redis'];(function(_0x539a6a,_0x200f85){var _0x3d0dfd=function(_0x3787fa){while(--_0x3787fa){_0x539a6a['push'](_0x539a6a['shift']());}};_0x3d0dfd(++_0x200f85);}(_0xef96,0x180));var _0x6ef9=function(_0x493c12,_0x5e7d14){_0x493c12=_0x493c12-0x0;var _0x442d1a=_0xef96[_0x493c12];return _0x442d1a;};'use strict';var _=require(_0x6ef9('0x0'));var EventEmitter=require(_0x6ef9('0x1'))[_0x6ef9('0x2')];var Redis=require(_0x6ef9('0x3'));var AGIError=require(_0x6ef9('0x4'));var config=require('../../config/environment');config[_0x6ef9('0x5')]=_[_0x6ef9('0x6')](config[_0x6ef9('0x5')],{'host':_0x6ef9('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x6ef9('0x5')]);sub['subscribe'](_0x6ef9('0x8'),function(_0x382bc4){if(_0x382bc4)return eventEmitter[_0x6ef9('0x9')]('error',new AGIError(_0x6ef9('0xa'),_0x382bc4));});sub['on'](_0x6ef9('0xb'),function(_0x1e619c,_0x49fa99){if(_0x1e619c!=='agi')return;try{var _0x31c656=JSON['parse'](_0x49fa99);eventEmitter['emit'](_0x6ef9('0xc'),_0x31c656);}catch(_0x2c0452){eventEmitter[_0x6ef9('0x9')](_0x6ef9('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x2c0452));}});module[_0x6ef9('0xe')]={'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 56c1bcf..be483ae 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 _0x8fbd=['addVertex','edges','prototype','addEdge','push','size','relations','getVertex','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','target','info','default','agicommand','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','getdigits','vertices','numberOfEdges'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fbd,0xbf));var _0xd8fb=function(_0x24bd79,_0x26331c){_0x24bd79=_0x24bd79-0x0;var _0x9d39ba=_0x8fbd[_0x24bd79];return _0x9d39ba;};'use strict';var _=require(_0xd8fb('0x0'));var logger=require(_0xd8fb('0x1'))('agi');var verticesWithRetry=['menu',_0xd8fb('0x2'),'getsecretdigits'];var Graph=function(){this[_0xd8fb('0x3')]={};this['edges']={};this[_0xd8fb('0x4')]=0x0;};Graph['prototype'][_0xd8fb('0x5')]=function(_0x4c1d7a){this[_0xd8fb('0x3')][_0x4c1d7a['id']]=_0x4c1d7a;this[_0xd8fb('0x6')][_0x4c1d7a['id']]=[];};Graph[_0xd8fb('0x7')][_0xd8fb('0x8')]=function(_0x5477c7,_0x530840,_0x4cbffb){this[_0xd8fb('0x6')][_0x5477c7][_0xd8fb('0x9')]({'target':_0x530840,'condition':_0x4cbffb});this[_0xd8fb('0x4')]+=0x1;};Graph[_0xd8fb('0x7')][_0xd8fb('0xa')]=function(){return _[_0xd8fb('0xa')](this[_0xd8fb('0x3')]);};Graph['prototype'][_0xd8fb('0xb')]=function(){return this[_0xd8fb('0x4')];};Graph[_0xd8fb('0x7')][_0xd8fb('0xc')]=function(_0x5a5953){return this['vertices'][_0x5a5953];};Graph['prototype']['traverseBFS']=function(_0x51b487,_0x34723d){if(!this[_0xd8fb('0x3')][_0x51b487]){return logger['info'](_0xd8fb('0xd'));}var _0x9ddb5e=_0x34723d(this[_0xd8fb('0x3')][_0x51b487]);if(!_0x9ddb5e){return logger['info'](_0xd8fb('0xe'));}if(this['edges'][_0x51b487]['length']===0x0){return logger['info'](_0xd8fb('0xf'));}for(var _0x30e616=0x0,_0xfc5f64=[],_0x397726=![];_0x30e616\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','timeout','hangup','find','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server'];(function(_0x560afd,_0x1674d9){var _0x2f8a72=function(_0x376170){while(--_0x376170){_0x560afd['push'](_0x560afd['shift']());}};_0x2f8a72(++_0x1674d9);}(_0x18c9,0x74));var _0x918c=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x18c9[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x918c('0x0'));var syncho=require(_0x918c('0x1'));var util=require(_0x918c('0x2'));var config=require(_0x918c('0x3'));var logger=require(_0x918c('0x4'))(_0x918c('0x5'));var utilLicense=require(_0x918c('0x6'));var rpc=require(_0x918c('0x7'));var Project=require(_0x918c('0x8'));var AGIEmitter=require(_0x918c('0x9'))[_0x918c('0xa')];var projects=[];config['agi']=_[_0x918c('0xb')](config['agi'],{'ip':_0x918c('0xc'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x5b96cd){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5b96cd);agiHandler(_0x5b96cd);}catch(_0x2cf017){logger[_0x918c('0xd')](_0x2cf017[_0x918c('0xe')]);}});});}function projectUpdateHandler(_0x591f25){try{var _0x5baf2e=_[_0x918c('0xf')](projects,['id',_0x591f25['id']]);if(_0x5baf2e>-0x1){if(_0x591f25['deleted']===!![]){projects[_0x918c('0x10')](_0x5baf2e,0x1);}else{projects[_0x5baf2e]=_0x591f25;}}else{projects['push'](_0x591f25);}}catch(_0x224844){logger[_0x918c('0xd')](_0x224844['stack']);}}function listeningHandler(){console[_0x918c('0x11')](_0x918c('0x12'),config['agi'][_0x918c('0x13')]);logger[_0x918c('0x14')](util['format'](_0x918c('0x15'),config[_0x918c('0x5')]['ip'],config['agi'][_0x918c('0x13')]));}function errorHandler(_0x2cbdfc){if(_0x2cbdfc&&_0x2cbdfc[_0x918c('0x16')]&&_0x2cbdfc[_0x918c('0x17')]){logger[_0x918c('0xd')](util['format'](_0x918c('0x18'),_0x2cbdfc[_0x918c('0x16')],_0x2cbdfc[_0x918c('0x17')]));}else{logger['error'](util[_0x918c('0x19')]('[ERROR]\x20%s',_0x2cbdfc[_0x918c('0xe')]));}}function closeHandler(){logger[_0x918c('0x14')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this[_0x918c('0x1c')],this[_0x918c('0x1d')],this[_0x918c('0x1e')]));try{createSquareReport(this);}catch(_0x5c153a){logger[_0x918c('0xd')](_0x5c153a[_0x918c('0xe')]);}}function timeoutHandler(){logger[_0x918c('0x14')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this[_0x918c('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x918c('0x14')](util['format'](_0x918c('0x1f'),this[_0x918c('0x1a')],this[_0x918c('0x1b')],this[_0x918c('0x1c')],this['dnid'],this['uniqueid']));this[_0x918c('0x20')]=!![];}function createSquareReport(_0x1668a3,_0x21659f){rpc[_0x918c('0x21')](_0x1668a3)[_0x918c('0x22')](function(_0x59a78b){if(_0x21659f){_0x21659f(null,_0x59a78b);}})[_0x918c('0x23')](function(_0x3cdb9e){if(_0x21659f){_0x21659f(null,_0x3cdb9e);}});}function setChannelVariables(_0x22525f){for(var _0x4cb8e8 in _0x22525f){if(_0x22525f[_0x918c('0x24')](_0x4cb8e8)){if(_0x4cb8e8['indexOf'](_0x918c('0x25'))===0x0){_0x22525f[_0x4cb8e8[_0x918c('0x26')](0x4)]=_0x22525f[_0x4cb8e8];delete _0x22525f[_0x4cb8e8];}}}}function agiHandler(_0x59f077){logger[_0x918c('0x27')](_0x918c('0x28'),JSON[_0x918c('0x29')](_0x59f077,null,0x2));logger[_0x918c('0x14')](util[_0x918c('0x19')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x59f077[_0x918c('0x1a')],_0x59f077[_0x918c('0x1b')],_0x59f077[_0x918c('0x1c')],_0x59f077[_0x918c('0x1d')],_0x59f077[_0x918c('0x1e')]));_0x59f077['on'](_0x918c('0xd'),errorHandler);_0x59f077['on']('close',closeHandler);_0x59f077['on'](_0x918c('0x2a'),timeoutHandler);_0x59f077[_0x918c('0x20')]=![];_0x59f077['on'](_0x918c('0x2b'),hangupHandler);var _0x2a2735=_[_0x918c('0x2c')](projects,[_0x918c('0x16'),_0x59f077[_0x918c('0x1a')]]);if(!_0x2a2735)return Project['handleNotFound'](_0x59f077);if(!_0x2a2735[_0x918c('0x2d')])return Project[_0x918c('0x2e')](_0x59f077);return Project[_0x918c('0x2f')](_0x2a2735,_0x59f077);}function main(){var _0x5d4542;return utilLicense['getLicense']()[_0x918c('0x22')](function(_0xe9b311){if(!_0xe9b311)return;if(_0xe9b311[_0x918c('0x30')]){if(_0xe9b311[_0x918c('0x31')]&&_0xe9b311[_0x918c('0x31')]>0x0){logger[_0x918c('0x14')](util[_0x918c('0x19')]('[LICENSE]\x20CHANNELS:\x20%s',_0xe9b311[_0x918c('0x31')]));_0x5d4542=_0xe9b311[_0x918c('0x31')];}else{logger[_0x918c('0x14')](_0x918c('0x32'));}}else{logger[_0x918c('0x14')](_0x918c('0x33'));_0x5d4542=-0x1;}})['then'](function(){return Project[_0x918c('0x34')]();})[_0x918c('0x22')](function(_0x3913ea){projects=_0x3913ea;return;})['catch'](function(_0x51fa17){logger[_0x918c('0xd')](_0x918c('0x35'),_0x51fa17['stack']);})['finally'](function(){var _0x59d1d8=require(_0x918c('0x36'))(config[_0x918c('0x5')][_0x918c('0x13')],config[_0x918c('0x5')]['ip'],_0x5d4542);_0x59d1d8['on']('error',errorHandler);_0x59d1d8['on'](_0x918c('0x37'),listeningHandler);_0x59d1d8['on']('connection',connectionHandler);_0x59d1d8['on'](_0x918c('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0x7e63=['../../config/environment','../../config/logger','../../config/license/util','./rpc','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','format','arg_1','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','handleUnpublished','initialize','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','finally','./server','listening','util'];(function(_0x2f6bd2,_0x2de9a7){var _0x2ad912=function(_0x125720){while(--_0x125720){_0x2f6bd2['push'](_0x2f6bd2['shift']());}};_0x2ad912(++_0x2de9a7);}(_0x7e63,0x1ee));var _0x37e6=function(_0x3d3f7a,_0x209a6b){_0x3d3f7a=_0x3d3f7a-0x0;var _0x563c25=_0x7e63[_0x3d3f7a];return _0x563c25;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x37e6('0x0'));var config=require(_0x37e6('0x1'));var logger=require(_0x37e6('0x2'))('agi');var utilLicense=require(_0x37e6('0x3'));var rpc=require(_0x37e6('0x4'));var Project=require(_0x37e6('0x5'));var AGIEmitter=require(_0x37e6('0x6'))[_0x37e6('0x7')];var projects=[];config[_0x37e6('0x8')]=_[_0x37e6('0x9')](config[_0x37e6('0x8')],{'ip':_0x37e6('0xa'),'port':0x11dd});AGIEmitter['on'](_0x37e6('0xb'),projectUpdateHandler);function connectionHandler(_0x2dffae){process[_0x37e6('0xc')](function(){syncho(function(){try{setChannelVariables(_0x2dffae);agiHandler(_0x2dffae);}catch(_0x3cec07){logger[_0x37e6('0xd')](_0x3cec07[_0x37e6('0xe')]);}});});}function projectUpdateHandler(_0x5d4ff0){try{var _0x3f2bbb=_[_0x37e6('0xf')](projects,['id',_0x5d4ff0['id']]);if(_0x3f2bbb>-0x1){if(_0x5d4ff0[_0x37e6('0x10')]===!![]){projects[_0x37e6('0x11')](_0x3f2bbb,0x1);}else{projects[_0x3f2bbb]=_0x5d4ff0;}}else{projects[_0x37e6('0x12')](_0x5d4ff0);}}catch(_0x1f5b02){logger[_0x37e6('0xd')](_0x1f5b02[_0x37e6('0xe')]);}}function listeningHandler(){console['log'](_0x37e6('0x13'),config[_0x37e6('0x8')]['port']);logger['info'](util['format'](_0x37e6('0x14'),config['agi']['ip'],config[_0x37e6('0x8')][_0x37e6('0x15')]));}function errorHandler(_0x2086c2){if(_0x2086c2&&_0x2086c2['name']&&_0x2086c2[_0x37e6('0x16')]){logger['error'](util['format']('[%s]\x20%s',_0x2086c2['name'],_0x2086c2[_0x37e6('0x16')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0x2086c2[_0x37e6('0xe')]));}}function closeHandler(){logger[_0x37e6('0x17')](util['format'](_0x37e6('0x18'),this['arg_1'],this[_0x37e6('0x19')],this['callerid'],this[_0x37e6('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4cb69a){logger['error'](_0x4cb69a[_0x37e6('0xe')]);}}function timeoutHandler(){logger[_0x37e6('0x17')](util[_0x37e6('0x1b')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x37e6('0x1c')],this[_0x37e6('0x19')],this[_0x37e6('0x1d')],this[_0x37e6('0x1a')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x37e6('0x1b')](_0x37e6('0x1e'),this[_0x37e6('0x1c')],this[_0x37e6('0x19')],this[_0x37e6('0x1d')],this[_0x37e6('0x1a')],this[_0x37e6('0x1f')]));this[_0x37e6('0x20')]=!![];}function createSquareReport(_0x479381,_0x2d73e9){rpc[_0x37e6('0x21')](_0x479381)[_0x37e6('0x22')](function(_0x32cb6a){if(_0x2d73e9){_0x2d73e9(null,_0x32cb6a);}})['catch'](function(_0x3cc129){if(_0x2d73e9){_0x2d73e9(null,_0x3cc129);}});}function setChannelVariables(_0x3bf656){for(var _0x74eeba in _0x3bf656){if(_0x3bf656[_0x37e6('0x23')](_0x74eeba)){if(_0x74eeba[_0x37e6('0x24')](_0x37e6('0x25'))===0x0){_0x3bf656[_0x74eeba['substring'](0x4)]=_0x3bf656[_0x74eeba];delete _0x3bf656[_0x74eeba];}}}}function agiHandler(_0x17916f){logger[_0x37e6('0x26')]('variables',JSON['stringify'](_0x17916f,null,0x2));logger[_0x37e6('0x17')](util[_0x37e6('0x1b')](_0x37e6('0x27'),_0x17916f[_0x37e6('0x1c')],_0x17916f[_0x37e6('0x19')],_0x17916f[_0x37e6('0x1d')],_0x17916f[_0x37e6('0x1a')],_0x17916f[_0x37e6('0x1f')]));_0x17916f['on'](_0x37e6('0xd'),errorHandler);_0x17916f['on'](_0x37e6('0x28'),closeHandler);_0x17916f['on'](_0x37e6('0x29'),timeoutHandler);_0x17916f['evtHangup']=![];_0x17916f['on'](_0x37e6('0x2a'),hangupHandler);var _0x10380b=_['find'](projects,['name',_0x17916f[_0x37e6('0x1c')]]);if(!_0x10380b)return Project[_0x37e6('0x2b')](_0x17916f);if(!_0x10380b[_0x37e6('0x2c')])return Project[_0x37e6('0x2d')](_0x17916f);return Project[_0x37e6('0x2e')](_0x10380b,_0x17916f);}function main(){var _0x9298ab;return utilLicense['getLicense']()[_0x37e6('0x22')](function(_0x119c58){if(!_0x119c58)return;if(_0x119c58['voice']){if(_0x119c58[_0x37e6('0x2f')]&&_0x119c58[_0x37e6('0x2f')]>0x0){logger['info'](util[_0x37e6('0x1b')](_0x37e6('0x30'),_0x119c58[_0x37e6('0x2f')]));_0x9298ab=_0x119c58[_0x37e6('0x2f')];}else{logger['info'](_0x37e6('0x31'));}}else{logger[_0x37e6('0x17')](_0x37e6('0x32'));_0x9298ab=-0x1;}})['then'](function(){return Project['getAll']();})[_0x37e6('0x22')](function(_0x193906){projects=_0x193906;return;})[_0x37e6('0x33')](function(_0x445690){logger[_0x37e6('0xd')]('[LICENSE]',_0x445690[_0x37e6('0xe')]);})[_0x37e6('0x34')](function(){var _0x4d3bed=require(_0x37e6('0x35'))(config[_0x37e6('0x8')][_0x37e6('0x15')],config[_0x37e6('0x8')]['ip'],_0x9298ab);_0x4d3bed['on'](_0x37e6('0xd'),errorHandler);_0x4d3bed['on'](_0x37e6('0x36'),listeningHandler);_0x4d3bed['on']('connection',connectionHandler);_0x4d3bed['on']('close',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 f917f58..75add63 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 _0x85ae=['bluebird','jayson/promise','client','then','error','message','result','sendMailMessage','SendMail'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x85ae,0x75));var _0xe85a=function(_0x132613,_0x152bfc){_0x132613=_0x132613-0x0;var _0x5e5119=_0x85ae[_0x132613];return _0x5e5119;};'use strict';var BPromise=require(_0xe85a('0x0'));var jayson=require(_0xe85a('0x1'));var client=jayson[_0xe85a('0x2')]['http']({'port':0x232b});function request(_0x2c1402,_0x5bdd83){return new BPromise(function(_0x86ea95,_0x228577){return client['request'](_0x2c1402,_0x5bdd83)[_0xe85a('0x3')](function(_0xd649bf){if(_0xd649bf[_0xe85a('0x4')]){return _0x228577(_0xd649bf[_0xe85a('0x4')][_0xe85a('0x5')]);}else{return _0x86ea95(_0xd649bf[_0xe85a('0x6')]);}})['catch'](function(_0x1b6a77){return _0x228577(_0x1b6a77);});});}exports[_0xe85a('0x7')]=function(_0x421681,_0x228e80){return request(_0xe85a('0x8'),{'account':_0x421681,'message':_0x228e80});}; \ No newline at end of file +var _0x0d13=['SendMail','client','http','request','error','message','result','catch','sendMailMessage'];(function(_0x172892,_0x2d8b44){var _0x458b5d=function(_0x57d4e8){while(--_0x57d4e8){_0x172892['push'](_0x172892['shift']());}};_0x458b5d(++_0x2d8b44);}(_0x0d13,0x17b));var _0x30d1=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x0d13[_0x5c9307];return _0x373e29;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x30d1('0x0')][_0x30d1('0x1')]({'port':0x232b});function request(_0x6ec9ca,_0x46c8ad){return new BPromise(function(_0x5b6e5b,_0x49ae59){return client[_0x30d1('0x2')](_0x6ec9ca,_0x46c8ad)['then'](function(_0x17a6ad){if(_0x17a6ad[_0x30d1('0x3')]){return _0x49ae59(_0x17a6ad[_0x30d1('0x3')][_0x30d1('0x4')]);}else{return _0x5b6e5b(_0x17a6ad[_0x30d1('0x5')]);}})[_0x30d1('0x6')](function(_0x325551){return _0x49ae59(_0x325551);});});}exports[_0x30d1('0x7')]=function(_0x3fab71,_0x5a5b12){return request(_0x30d1('0x8'),{'account':_0x3fab71,'message':_0x5a5b12});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 93b3e70..9793979 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 _0xfa83=['arg_1','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','evtHangup','response','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','start','debug','stringify','joinAt','format','mxCell','info'];(function(_0x1ece1d,_0x237740){var _0x4fab9a=function(_0x4f7191){while(--_0x4f7191){_0x1ece1d['push'](_0x1ece1d['shift']());}};_0x4fab9a(++_0x237740);}(_0xfa83,0xcf));var _0x3fa8=function(_0x443f17,_0x5b8bb2){_0x443f17=_0x443f17-0x0;var _0x55e267=_0xfa83[_0x443f17];return _0x55e267;};'use strict';var _=require(_0x3fa8('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require('util');var logger=require(_0x3fa8('0x1'))(_0x3fa8('0x2'));var rpc=require(_0x3fa8('0x3'));var mailRpc=require(_0x3fa8('0x4'));var Graph=require(_0x3fa8('0x5'));var Vertices=require(_0x3fa8('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x3fa8('0x7')](function(_0x5dc907){logger[_0x3fa8('0x8')](_0x3fa8('0x9'),_0x5dc907[_0x3fa8('0xa')]);return[];});}function addVertex(_0x32ba39,_0x43af2a,_0x484a2f){_0x43af2a[_0x3fa8('0xb')]=_0x484a2f;if(_0x43af2a[_0x3fa8('0xc')](_0x3fa8('0xd'))){_0x43af2a[_0x3fa8('0xe')]=parseInt(_0x43af2a[_0x3fa8('0xd')],0xa);}_0x32ba39[_0x3fa8('0xf')](_[_0x3fa8('0x10')](_0x43af2a,'mxCell'));}function initGraph(_0x4d2458,_0x44bddf){var _0x6e25d4=new Graph();for(var _0xcc1b2 in _0x4d2458){if(_0x4d2458[_0x3fa8('0xc')](_0xcc1b2)){if(_[_0x3fa8('0x11')](_0x4d2458[_0xcc1b2])){for(var _0x356ead=0x0;_0x356ead<_0x4d2458[_0xcc1b2][_0x3fa8('0x12')];_0x356ead+=0x1){addVertex(_0x6e25d4,_0x4d2458[_0xcc1b2][_0x356ead],_0xcc1b2);}}else{addVertex(_0x6e25d4,_0x4d2458[_0xcc1b2],_0xcc1b2);}}}for(var _0x2c3eb4=0x0;_0x2c3eb4<_0x44bddf[_0x3fa8('0x12')];_0x2c3eb4+=0x1){if(_0x44bddf[_0x2c3eb4][_0x3fa8('0x13')]&&_0x44bddf[_0x2c3eb4][_0x3fa8('0x14')]){_0x6e25d4[_0x3fa8('0x15')](_0x44bddf[_0x2c3eb4][_0x3fa8('0x13')],_0x44bddf[_0x2c3eb4]['target'],_0x44bddf[_0x2c3eb4][_0x3fa8('0x16')]);}}return _0x6e25d4;}function getRoot(_0x3be2a8){return parser[_0x3fa8('0x17')](_0x3be2a8,{'object':!![]})[_0x3fa8('0x18')][_0x3fa8('0x19')];}function inspect(_0xf5ceeb){return util['inspect'](_0xf5ceeb,{'showHidden':![],'depth':null});}function initialize(_0x461288,_0x1b6e96){var _0x1cbc7b=getRoot(_0x461288['production']);if(!_0x1cbc7b||!_0x1cbc7b[_0x3fa8('0x1a')])return;var _0x160e15,_0x431a7a,_0x5f5434;logger[_0x3fa8('0x1b')](_0x3fa8('0x19'),JSON[_0x3fa8('0x1c')](_0x1cbc7b,null,0x2));_0x1b6e96[_0x3fa8('0x1d')]=moment()[_0x3fa8('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x160e15=initGraph(_[_0x3fa8('0x10')](_0x1cbc7b,_0x3fa8('0x1f')),_0x1cbc7b[_0x3fa8('0x1f')]);_0x431a7a=new Vertices(_0x1b6e96,rpc,mailRpc);logger[_0x3fa8('0x20')](util[_0x3fa8('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b6e96[_0x3fa8('0x21')],_0x1b6e96['calleridname'],_0x1b6e96['callerid'],_0x1b6e96[_0x3fa8('0x22')],_0x1b6e96[_0x3fa8('0x23')]));_0x160e15[_0x3fa8('0x24')](_0x1cbc7b['start']['id'],function(_0x50eaea){try{_0x50eaea=_0x431a7a[_0x3fa8('0x25')](_0x50eaea);logger[_0x3fa8('0x1b')](_0x3fa8('0x26'),JSON[_0x3fa8('0x1c')](_0x50eaea,null,0x2));if(_0x50eaea[_0x3fa8('0xb')]===_0x3fa8('0x27')){logger[_0x3fa8('0x20')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1b6e96['context']=_0x50eaea[_0x3fa8('0x28')]||_0x1b6e96[_0x3fa8('0x28')];_0x1b6e96[_0x3fa8('0x29')]=_0x50eaea[_0x3fa8('0x29')];_0x1b6e96[_0x3fa8('0x2a')]=_0x50eaea[_0x3fa8('0x2a')]?_0x50eaea[_0x3fa8('0x2a')]-0x1:0x1;return null;}else if(_0x50eaea&&_0x431a7a[_0x50eaea[_0x3fa8('0xb')]]){_0x5f5434=_0x431a7a[_0x50eaea[_0x3fa8('0xb')]](_0x50eaea);logger[_0x3fa8('0x20')]('response',JSON['stringify'](_0x5f5434,null,0x2));if(_0x5f5434&&_0x5f5434[_0x3fa8('0x2b')]===AGI_CODE_SUCCESS&&_0x5f5434['result']!==AGI_RESULT_ERROR&&!_0x1b6e96[_0x3fa8('0x2c')]){logger['debug'](_0x3fa8('0x2d'),inspect(_0x5f5434));return _[_0x3fa8('0x2e')](_0x5f5434[_0x3fa8('0x2f')])?null:_0x5f5434[_0x3fa8('0x2f')][_0x3fa8('0x30')]();}else{logger['error'](_0x3fa8('0x2d'),inspect(_0x5f5434));return null;}}else{logger[_0x3fa8('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x3c4ba5){logger['error'](_0x3c4ba5['stack']);return null;}});if(_0x1cbc7b[_0x3fa8('0x31')]){logger['info'](util[_0x3fa8('0x1e')](_0x3fa8('0x32'),_0x1b6e96[_0x3fa8('0x21')],_0x1b6e96[_0x3fa8('0x33')],_0x1b6e96[_0x3fa8('0x34')],_0x1b6e96[_0x3fa8('0x22')],_0x1b6e96[_0x3fa8('0x23')]));_0x160e15['traverseBFS'](_0x1cbc7b[_0x3fa8('0x31')]['id'],function(_0x44dd09){try{_0x44dd09=_0x431a7a['clear'](_0x44dd09);logger[_0x3fa8('0x1b')](_0x3fa8('0x26'),JSON[_0x3fa8('0x1c')](_0x44dd09,null,0x2));if(_0x44dd09&&_0x431a7a[_0x44dd09[_0x3fa8('0xb')]]){_0x5f5434=_0x431a7a[_0x44dd09['agicommand']](_0x44dd09);if(_0x5f5434){logger[_0x3fa8('0x1b')](_0x3fa8('0x2d'),inspect(_0x5f5434));return _[_0x3fa8('0x2e')](_0x5f5434[_0x3fa8('0x2f')])?null:_0x5f5434[_0x3fa8('0x2f')][_0x3fa8('0x30')]();}else{logger['error'](_0x3fa8('0x2d'),inspect(_0x5f5434));return null;}}else{logger[_0x3fa8('0x8')](_0x3fa8('0x35'));return null;}}catch(_0x55de78){logger['error'](_0x55de78[_0x3fa8('0xa')]);return null;}});}logger[_0x3fa8('0x20')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b6e96[_0x3fa8('0x21')],_0x1b6e96[_0x3fa8('0x33')],_0x1b6e96['callerid'],_0x1b6e96[_0x3fa8('0x22')],_0x1b6e96['uniqueid']));logger[_0x3fa8('0x20')](util[_0x3fa8('0x1e')](_0x3fa8('0x36'),_0x1b6e96['context'],_0x1b6e96[_0x3fa8('0x29')],parseInt(_0x1b6e96['priority'],0xa)+0x1));_0x1b6e96[_0x3fa8('0x37')](_0x1b6e96['context'],_0x1b6e96[_0x3fa8('0x29')],parseInt(_0x1b6e96[_0x3fa8('0x2a')],0xa)+0x1);_0x1b6e96['close']();}function handleNotFound(_0x1b1ebb){logger[_0x3fa8('0x8')](util[_0x3fa8('0x1e')](_0x3fa8('0x38'),_0x1b1ebb[_0x3fa8('0x21')]));_0x1b1ebb[_0x3fa8('0x37')](_0x1b1ebb[_0x3fa8('0x28')],_0x1b1ebb[_0x3fa8('0x29')],parseInt(_0x1b1ebb['priority'],0xa)+0x1);_0x1b1ebb[_0x3fa8('0x39')]();}function handleUnpublished(_0x47af9c){logger[_0x3fa8('0x8')](util[_0x3fa8('0x1e')](_0x3fa8('0x3a'),_0x47af9c[_0x3fa8('0x21')]));_0x47af9c['continueAt'](_0x47af9c[_0x3fa8('0x28')],_0x47af9c[_0x3fa8('0x29')],parseInt(_0x47af9c[_0x3fa8('0x2a')],0xa)+0x1);_0x47af9c[_0x3fa8('0x39')]();}module[_0x3fa8('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x5deb=['dnid','finally','debug','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','length','source','addEdge','toJson','mxGraphModel','root','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5deb,0x12f));var _0xb5de=function(_0x37f5a1,_0x461925){_0x37f5a1=_0x37f5a1-0x0;var _0x3a97a5=_0x5deb[_0x37f5a1];return _0x3a97a5;};'use strict';var _=require(_0xb5de('0x0'));var moment=require(_0xb5de('0x1'));var parser=require(_0xb5de('0x2'));var util=require(_0xb5de('0x3'));var logger=require(_0xb5de('0x4'))('agi');var rpc=require(_0xb5de('0x5'));var mailRpc=require(_0xb5de('0x6'));var Graph=require(_0xb5de('0x7'));var Vertices=require(_0xb5de('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb5de('0x9')]()[_0xb5de('0xa')](function(_0x4f6be9){logger['error'](_0xb5de('0xb'),_0x4f6be9[_0xb5de('0xc')]);return[];});}function addVertex(_0x1cd073,_0x13ac57,_0x29ac0f){_0x13ac57[_0xb5de('0xd')]=_0x29ac0f;if(_0x13ac57[_0xb5de('0xe')](_0xb5de('0xf'))){_0x13ac57[_0xb5de('0x10')]=parseInt(_0x13ac57['retry'],0xa);}_0x1cd073['addVertex'](_['omit'](_0x13ac57,'mxCell'));}function initGraph(_0x3d1f66,_0x54f4b0){var _0x57803e=new Graph();for(var _0x21cdfd in _0x3d1f66){if(_0x3d1f66[_0xb5de('0xe')](_0x21cdfd)){if(_['isArray'](_0x3d1f66[_0x21cdfd])){for(var _0x1033dd=0x0;_0x1033dd<_0x3d1f66[_0x21cdfd][_0xb5de('0x11')];_0x1033dd+=0x1){addVertex(_0x57803e,_0x3d1f66[_0x21cdfd][_0x1033dd],_0x21cdfd);}}else{addVertex(_0x57803e,_0x3d1f66[_0x21cdfd],_0x21cdfd);}}}for(var _0x5f24ed=0x0;_0x5f24ed<_0x54f4b0[_0xb5de('0x11')];_0x5f24ed+=0x1){if(_0x54f4b0[_0x5f24ed][_0xb5de('0x12')]&&_0x54f4b0[_0x5f24ed]['target']){_0x57803e[_0xb5de('0x13')](_0x54f4b0[_0x5f24ed][_0xb5de('0x12')],_0x54f4b0[_0x5f24ed]['target'],_0x54f4b0[_0x5f24ed]['value']);}}return _0x57803e;}function getRoot(_0x4e1515){return parser[_0xb5de('0x14')](_0x4e1515,{'object':!![]})[_0xb5de('0x15')][_0xb5de('0x16')];}function inspect(_0x234793){return util['inspect'](_0x234793,{'showHidden':![],'depth':null});}function initialize(_0x4a1f37,_0x973f3f){var _0x2e8f71=getRoot(_0x4a1f37['production']);if(!_0x2e8f71||!_0x2e8f71[_0xb5de('0x17')])return;var _0x33071a,_0x46984b,_0x414f06;logger['debug']('root',JSON[_0xb5de('0x18')](_0x2e8f71,null,0x2));_0x973f3f[_0xb5de('0x19')]=moment()[_0xb5de('0x1a')](_0xb5de('0x1b'));_0x33071a=initGraph(_[_0xb5de('0x1c')](_0x2e8f71,'mxCell'),_0x2e8f71[_0xb5de('0x1d')]);_0x46984b=new Vertices(_0x973f3f,rpc,mailRpc);logger['info'](util['format'](_0xb5de('0x1e'),_0x973f3f[_0xb5de('0x1f')],_0x973f3f[_0xb5de('0x20')],_0x973f3f['callerid'],_0x973f3f['dnid'],_0x973f3f[_0xb5de('0x21')]));_0x33071a['traverseBFS'](_0x2e8f71['start']['id'],function(_0x2f7cc3){try{_0x2f7cc3=_0x46984b[_0xb5de('0x22')](_0x2f7cc3);logger['debug'](_0xb5de('0x23'),JSON[_0xb5de('0x18')](_0x2f7cc3,null,0x2));if(_0x2f7cc3[_0xb5de('0xd')]===_0xb5de('0x24')){logger[_0xb5de('0x25')](_0xb5de('0x26'));_0x973f3f['context']=_0x2f7cc3[_0xb5de('0x27')]||_0x973f3f[_0xb5de('0x27')];_0x973f3f[_0xb5de('0x28')]=_0x2f7cc3[_0xb5de('0x28')];_0x973f3f[_0xb5de('0x29')]=_0x2f7cc3[_0xb5de('0x29')]?_0x2f7cc3[_0xb5de('0x29')]-0x1:0x1;return null;}else if(_0x2f7cc3&&_0x46984b[_0x2f7cc3[_0xb5de('0xd')]]){_0x414f06=_0x46984b[_0x2f7cc3[_0xb5de('0xd')]](_0x2f7cc3);logger[_0xb5de('0x25')](_0xb5de('0x2a'),JSON[_0xb5de('0x18')](_0x414f06,null,0x2));if(_0x414f06&&_0x414f06['code']===AGI_CODE_SUCCESS&&_0x414f06[_0xb5de('0x2b')]!==AGI_RESULT_ERROR&&!_0x973f3f[_0xb5de('0x2c')]){logger['debug'](_0xb5de('0x2a'),inspect(_0x414f06));return _[_0xb5de('0x2d')](_0x414f06[_0xb5de('0x2b')])?null:_0x414f06[_0xb5de('0x2b')][_0xb5de('0x2e')]();}else{logger[_0xb5de('0x2f')](_0xb5de('0x2a'),inspect(_0x414f06));return null;}}else{logger['error'](_0xb5de('0x30'));return null;}}catch(_0x5cc757){logger[_0xb5de('0x2f')](_0x5cc757[_0xb5de('0xc')]);return null;}});if(_0x2e8f71['finally']){logger['info'](util[_0xb5de('0x1a')](_0xb5de('0x31'),_0x973f3f['arg_1'],_0x973f3f[_0xb5de('0x20')],_0x973f3f[_0xb5de('0x32')],_0x973f3f[_0xb5de('0x33')],_0x973f3f[_0xb5de('0x21')]));_0x33071a['traverseBFS'](_0x2e8f71[_0xb5de('0x34')]['id'],function(_0x3ed407){try{_0x3ed407=_0x46984b[_0xb5de('0x22')](_0x3ed407);logger[_0xb5de('0x35')]('vertex',JSON[_0xb5de('0x18')](_0x3ed407,null,0x2));if(_0x3ed407&&_0x46984b[_0x3ed407[_0xb5de('0xd')]]){_0x414f06=_0x46984b[_0x3ed407['agicommand']](_0x3ed407);if(_0x414f06){logger[_0xb5de('0x35')]('response',inspect(_0x414f06));return _[_0xb5de('0x2d')](_0x414f06['result'])?null:_0x414f06[_0xb5de('0x2b')][_0xb5de('0x2e')]();}else{logger[_0xb5de('0x2f')]('response',inspect(_0x414f06));return null;}}else{logger[_0xb5de('0x2f')](_0xb5de('0x30'));return null;}}catch(_0x5dcd65){logger[_0xb5de('0x2f')](_0x5dcd65['stack']);return null;}});}logger[_0xb5de('0x25')](util['format'](_0xb5de('0x36'),_0x973f3f['arg_1'],_0x973f3f['calleridname'],_0x973f3f[_0xb5de('0x32')],_0x973f3f['dnid'],_0x973f3f[_0xb5de('0x21')]));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x973f3f[_0xb5de('0x27')],_0x973f3f[_0xb5de('0x28')],parseInt(_0x973f3f['priority'],0xa)+0x1));_0x973f3f['continueAt'](_0x973f3f[_0xb5de('0x27')],_0x973f3f[_0xb5de('0x28')],parseInt(_0x973f3f[_0xb5de('0x29')],0xa)+0x1);_0x973f3f[_0xb5de('0x37')]();}function handleNotFound(_0x5eca7c){logger[_0xb5de('0x2f')](util[_0xb5de('0x1a')](_0xb5de('0x38'),_0x5eca7c[_0xb5de('0x1f')]));_0x5eca7c[_0xb5de('0x39')](_0x5eca7c[_0xb5de('0x27')],_0x5eca7c['extension'],parseInt(_0x5eca7c[_0xb5de('0x29')],0xa)+0x1);_0x5eca7c['close']();}function handleUnpublished(_0x39bce9){logger[_0xb5de('0x2f')](util[_0xb5de('0x1a')](_0xb5de('0x3a'),_0x39bce9[_0xb5de('0x1f')]));_0x39bce9[_0xb5de('0x39')](_0x39bce9[_0xb5de('0x27')],_0x39bce9['extension'],parseInt(_0x39bce9['priority'],0xa)+0x1);_0x39bce9['close']();}module['exports']={'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 3baf320..228ccab 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 _0x54af=['slice','trim','emit','headers','line','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split'];(function(_0x30b8b6,_0x547092){var _0x19fe09=function(_0x176b47){while(--_0x176b47){_0x30b8b6['push'](_0x30b8b6['shift']());}};_0x19fe09(++_0x547092);}(_0x54af,0xb9));var _0xf54a=function(_0x2bfacc,_0xb488d7){_0x2bfacc=_0x2bfacc-0x0;var _0x5acca4=_0x54af[_0x2bfacc];return _0x5acca4;};'use strict';var util=require('util');var Transform=require('stream')[_0xf54a('0x0')];function AGIReply(_0x2c63e4){Transform[_0xf54a('0x1')](this,_0x2c63e4);this[_0xf54a('0x2')]='';this[_0xf54a('0x3')]=![];}util[_0xf54a('0x4')](AGIReply,Transform);AGIReply[_0xf54a('0x5')][_0xf54a('0x6')]=function(_0x50e8ff,_0x4c4de6,_0x16ca4b){var _0x452730='\x0a',_0x1df090=['\x0a\x0a',_0xf54a('0x7')],_0x460868=-0x1,_0x3a1ba2=-0x1,_0x3e6255='',_0x32c78b=0x0,_0x5a1ae2='',_0x23adbf='';this[_0xf54a('0x2')]+=_0x50e8ff[_0xf54a('0x8')]();_0x5a1ae2=this[_0xf54a('0x2')];if(!this[_0xf54a('0x3')]){_0x32c78b=0x0;while(_0x1df090[_0x32c78b]){while((_0x3a1ba2=_0x5a1ae2[_0xf54a('0x9')](_0x1df090[_0x32c78b]))!=-0x1){_0x3e6255=_0x1df090[_0x32c78b];_0x23adbf=_0x5a1ae2[_0xf54a('0xa')](0x0,_0x3a1ba2);_0x5a1ae2=_0x5a1ae2[_0xf54a('0xa')](_0x3a1ba2+_0x3e6255[_0xf54a('0xb')]);var _0x170173=_0x23adbf[_0xf54a('0xc')](_0x452730),_0xcf4e9f=0x0,_0x3cac45={},_0x1378f8='',_0x1d0469='',_0x56bbc9=-0x1;while(_0x170173[_0xcf4e9f]){_0x56bbc9=_0x170173[_0xcf4e9f]['indexOf'](':');if(_0x56bbc9!=-0x1){_0x1378f8=_0x170173[_0xcf4e9f][_0xf54a('0xd')](0x0,_0x56bbc9)[_0xf54a('0xe')]();_0x1d0469=_0x170173[_0xcf4e9f][_0xf54a('0xd')](_0x56bbc9+0x1)[_0xf54a('0xe')]();if(_0x1378f8[_0xf54a('0xb')]>0x0){_0x3cac45[_0x1378f8]=_0x1d0469;}}else{}_0xcf4e9f++;}this[_0xf54a('0xf')](_0xf54a('0x10'),_0x3cac45);this[_0xf54a('0x3')]=!![];}_0x32c78b++;}this[_0xf54a('0x2')]=_0x5a1ae2;}else{while((_0x460868=_0x5a1ae2[_0xf54a('0x9')](_0x452730))!=-0x1){_0x23adbf=_0x5a1ae2[_0xf54a('0xa')](0x0,_0x460868);this['emit'](_0xf54a('0x11'),_0x23adbf);_0x5a1ae2=_0x5a1ae2[_0xf54a('0xa')](_0x460868+_0x452730[_0xf54a('0xb')]);}this['_localBuffer']=_0x5a1ae2;}_0x16ca4b();};module['exports']=AGIReply; \ No newline at end of file +var _0xddb4=['_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','headers','line','util','stream','Transform','call','_localBuffer','_inBody'];(function(_0x4daf54,_0x4f73a6){var _0x2e50c3=function(_0x37ce85){while(--_0x37ce85){_0x4daf54['push'](_0x4daf54['shift']());}};_0x2e50c3(++_0x4f73a6);}(_0xddb4,0x162));var _0x4ddb=function(_0x68c4d9,_0x419b3c){_0x68c4d9=_0x68c4d9-0x0;var _0x62da93=_0xddb4[_0x68c4d9];return _0x62da93;};'use strict';var util=require(_0x4ddb('0x0'));var Transform=require(_0x4ddb('0x1'))[_0x4ddb('0x2')];function AGIReply(_0x3a6aef){Transform[_0x4ddb('0x3')](this,_0x3a6aef);this[_0x4ddb('0x4')]='';this[_0x4ddb('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x4ddb('0x6')]=function(_0x2150e2,_0x4a0113,_0x53a1db){var _0x4b47f1='\x0a',_0x320e9e=['\x0a\x0a',_0x4ddb('0x7')],_0x45c300=-0x1,_0x33ffa5=-0x1,_0x4b756e='',_0xf9537e=0x0,_0x3e2186='',_0x4ac089='';this['_localBuffer']+=_0x2150e2[_0x4ddb('0x8')]();_0x3e2186=this[_0x4ddb('0x4')];if(!this[_0x4ddb('0x5')]){_0xf9537e=0x0;while(_0x320e9e[_0xf9537e]){while((_0x33ffa5=_0x3e2186['indexOf'](_0x320e9e[_0xf9537e]))!=-0x1){_0x4b756e=_0x320e9e[_0xf9537e];_0x4ac089=_0x3e2186[_0x4ddb('0x9')](0x0,_0x33ffa5);_0x3e2186=_0x3e2186[_0x4ddb('0x9')](_0x33ffa5+_0x4b756e[_0x4ddb('0xa')]);var _0x43d042=_0x4ac089[_0x4ddb('0xb')](_0x4b47f1),_0x5d4c94=0x0,_0x361760={},_0x2165d3='',_0x464d18='',_0x26c748=-0x1;while(_0x43d042[_0x5d4c94]){_0x26c748=_0x43d042[_0x5d4c94][_0x4ddb('0xc')](':');if(_0x26c748!=-0x1){_0x2165d3=_0x43d042[_0x5d4c94][_0x4ddb('0xd')](0x0,_0x26c748)[_0x4ddb('0xe')]();_0x464d18=_0x43d042[_0x5d4c94][_0x4ddb('0xd')](_0x26c748+0x1)['trim']();if(_0x2165d3[_0x4ddb('0xa')]>0x0){_0x361760[_0x2165d3]=_0x464d18;}}else{}_0x5d4c94++;}this[_0x4ddb('0xf')](_0x4ddb('0x10'),_0x361760);this[_0x4ddb('0x5')]=!![];}_0xf9537e++;}this['_localBuffer']=_0x3e2186;}else{while((_0x45c300=_0x3e2186[_0x4ddb('0xc')](_0x4b47f1))!=-0x1){_0x4ac089=_0x3e2186[_0x4ddb('0x9')](0x0,_0x45c300);this['emit'](_0x4ddb('0x11'),_0x4ac089);_0x3e2186=_0x3e2186[_0x4ddb('0x9')](_0x45c300+_0x4b47f1['length']);}this[_0x4ddb('0x4')]=_0x3e2186;}_0x53a1db();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6e46bae..61aefd7 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 _0x6737=['LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','then','error','getSquareProjects','name','production','ShowSquareProject','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','agentLogin'];(function(_0x297e02,_0x16e710){var _0x3cf984=function(_0x4de442){while(--_0x4de442){_0x297e02['push'](_0x297e02['shift']());}};_0x3cf984(++_0x16e710);}(_0x6737,0xe2));var _0x7673=function(_0x1a7ce7,_0x3fbeba){_0x1a7ce7=_0x1a7ce7-0x0;var _0x508515=_0x6737[_0x1a7ce7];return _0x508515;};'use strict';var _=require('lodash');var moment=require(_0x7673('0x0'));var jayson=require(_0x7673('0x1'));var client=jayson['client'][_0x7673('0x2')]({'port':0x2329});function request(_0x2a9cd0,_0x43ee27){return new Promise(function(_0x12efff,_0x54002e){return client[_0x7673('0x3')](_0x2a9cd0,_0x43ee27)[_0x7673('0x4')](function(_0x543b61){if(_0x543b61[_0x7673('0x5')]){return _0x54002e(_0x543b61[_0x7673('0x5')]['message']);}else{return _0x12efff(_0x543b61['result']);}})['catch'](function(_0x5292f7){return _0x54002e(_0x5292f7);});});}exports[_0x7673('0x6')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x7673('0x7'),_0x7673('0x8')]}});};exports['getSquareProject']=function(_0x29fdbc){return request(_0x7673('0x9'),{'options':{'raw':![],'where':{'name':_0x29fdbc},'attributes':[_0x7673('0x8')]}});};exports['getMailAccountById']=function(_0x49fcb2){return request(_0x7673('0xa'),{'options':{'raw':![],'where':{'id':_0x49fcb2},'include':[{'model':'MailServerOut','as':_0x7673('0xb'),'include':[{'model':_0x7673('0xc'),'as':_0x7673('0xc')}]}],'attributes':['id',_0x7673('0x7'),_0x7673('0xd')],'smtp':!![]}});};exports[_0x7673('0xe')]=function(_0x1c57a5){return request(_0x7673('0x9'),{'options':{'where':{'id':_0x1c57a5},'attributes':[_0x7673('0x7')]}});};exports[_0x7673('0xf')]=function(_0x5c8626){return request(_0x7673('0x10'),{'options':{'where':{'id':_0x5c8626},'attributes':[_0x7673('0x7')]}});};exports[_0x7673('0x11')]=function(_0x2c83d){return request(_0x7673('0x12'),{'options':{'where':{'id':_0x2c83d},'attributes':[_0x7673('0x7')]}});};exports[_0x7673('0x13')]=function(_0x4a8ea0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4a8ea0},'attributes':[_0x7673('0x14')]}});};exports[_0x7673('0x15')]=function(_0x50f8d9){return request(_0x7673('0x16'),{'options':{'where':{'id':_0x50f8d9},'attributes':[_0x7673('0x7')]}});};exports['getContactByPhone']=function(_0x33ff7d){return request(_0x7673('0x17'),{'options':{'where':{'phone':_0x33ff7d[_0x7673('0x18')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x50f22d){return request(_0x7673('0x19'),{'options':{'where':{'id':_0x50f22d},'attributes':[_0x7673('0x7')]}});};exports['getSoundById']=function(_0x17c564){return request(_0x7673('0x1a'),{'options':{'where':{'id':_0x17c564},'attributes':[_0x7673('0x1b')]}});};exports[_0x7673('0x1c')]=function(_0x4245bf){return request(_0x7673('0x1d'),{'options':{'raw':![],'where':{'id':_0x4245bf},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x7673('0x1e')]=function(_0x21774f){return request(_0x7673('0x1f'),{'options':{'where':{'id':_0x21774f},'attributes':['id',_0x7673('0x7')]}});};exports[_0x7673('0x20')]=function(_0x54f38d){return request(_0x7673('0x21'),{'body':_0x54f38d});};exports[_0x7673('0x22')]=function(_0x714e63){return request(_0x7673('0x23'),{'body':_0x714e63});};exports[_0x7673('0x24')]=function(_0x30c42e){return request('CreateSquareReport',{'body':_[_0x7673('0x25')](_0x30c42e,{'project_name':_0x30c42e[_0x7673('0x26')],'prev_project_name':_0x30c42e[_0x7673('0x27')]||'','is_subproject':_0x30c42e[_0x7673('0x27')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x7673('0x28')]=function(_0x11b42b){return request(_0x7673('0x29'),{'body':_0x11b42b});};exports[_0x7673('0x2a')]=function(_0x119a21){return request(_0x7673('0x2b'),{'body':_0x119a21});};exports[_0x7673('0x2c')]=function(_0x5a59f9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5a59f9[_0x7673('0x18')],'ListId':_0x5a59f9[_0x7673('0x2d')]}}})[_0x7673('0x4')](function(_0x335743){if(_0x335743){return _0x335743;}return request(_0x7673('0x2e'),{'body':_0x5a59f9});});};exports[_0x7673('0x2f')]=function(_0x224122){return request('ShowPause',{'options':{'where':{'id':_0x224122},'attributes':['name']}});};exports[_0x7673('0x30')]=function(_0x36c841,_0x268863){return request(_0x7673('0x31'),{'body':{'interface':_0x268863},'options':{'where':_0x36c841}});};exports['agentPause']=function(_0x3aa249,_0x497760,_0x15f6a7){return request(_0x7673('0x32'),{'body':{'type':_0x497760,'uniqueid':_0x15f6a7},'options':{'where':_0x3aa249}});};exports[_0x7673('0x33')]=function(_0x1b924f){return request(_0x7673('0x34'),{'body':{},'options':{'where':_0x1b924f}});};exports[_0x7673('0x35')]=function(_0x2cb973){return request(_0x7673('0x36'),{'body':{},'options':{'where':_0x2cb973}});}; \ No newline at end of file +var _0x6fb8=['format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2'];(function(_0x48e7e4,_0x5b9d1e){var _0x5a1b77=function(_0x54ff78){while(--_0x54ff78){_0x48e7e4['push'](_0x48e7e4['shift']());}};_0x5a1b77(++_0x5b9d1e);}(_0x6fb8,0x104));var _0x86fb=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0x6fb8[_0x36de10];return _0x58100f;};'use strict';var _=require(_0x86fb('0x0'));var moment=require('moment');var jayson=require(_0x86fb('0x1'));var client=jayson[_0x86fb('0x2')]['http']({'port':0x2329});function request(_0x43e61e,_0x5141d3){return new Promise(function(_0x522fde,_0x23cc99){return client[_0x86fb('0x3')](_0x43e61e,_0x5141d3)[_0x86fb('0x4')](function(_0x17f72e){if(_0x17f72e[_0x86fb('0x5')]){return _0x23cc99(_0x17f72e[_0x86fb('0x5')][_0x86fb('0x6')]);}else{return _0x522fde(_0x17f72e[_0x86fb('0x7')]);}})[_0x86fb('0x8')](function(_0x2d1550){return _0x23cc99(_0x2d1550);});});}exports[_0x86fb('0x9')]=function(){return request(_0x86fb('0xa'),{'options':{'raw':![],'attributes':['id',_0x86fb('0xb'),'production']}});};exports[_0x86fb('0xc')]=function(_0x57a245){return request(_0x86fb('0xd'),{'options':{'raw':![],'where':{'name':_0x57a245},'attributes':[_0x86fb('0xe')]}});};exports[_0x86fb('0xf')]=function(_0x4b7de4){return request(_0x86fb('0x10'),{'options':{'raw':![],'where':{'id':_0x4b7de4},'include':[{'model':'MailServerOut','as':_0x86fb('0x11'),'include':[{'model':_0x86fb('0x12'),'as':_0x86fb('0x12')}]}],'attributes':['id',_0x86fb('0xb'),_0x86fb('0x13')],'smtp':!![]}});};exports[_0x86fb('0x14')]=function(_0x3c8b7d){return request(_0x86fb('0xd'),{'options':{'where':{'id':_0x3c8b7d},'attributes':[_0x86fb('0xb')]}});};exports[_0x86fb('0x15')]=function(_0x580824){return request(_0x86fb('0x16'),{'options':{'where':{'id':_0x580824},'attributes':['name']}});};exports[_0x86fb('0x17')]=function(_0x70ebb7){return request('ShowVariable',{'options':{'where':{'id':_0x70ebb7},'attributes':[_0x86fb('0xb')]}});};exports[_0x86fb('0x18')]=function(_0x1f60ca){return request(_0x86fb('0x19'),{'options':{'where':{'id':_0x1f60ca},'attributes':[_0x86fb('0x1a')]}});};exports['getUserById']=function(_0x4207f5){return request(_0x86fb('0x1b'),{'options':{'where':{'id':_0x4207f5},'attributes':[_0x86fb('0xb')]}});};exports[_0x86fb('0x1c')]=function(_0x28a0f8){return request(_0x86fb('0x1d'),{'options':{'where':{'phone':_0x28a0f8[_0x86fb('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x3ceac1){return request(_0x86fb('0x1f'),{'options':{'where':{'id':_0x3ceac1},'attributes':[_0x86fb('0xb')]}});};exports[_0x86fb('0x20')]=function(_0x3f4229){return request(_0x86fb('0x21'),{'options':{'where':{'id':_0x3f4229},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x295b7d){return request(_0x86fb('0x22'),{'options':{'raw':![],'where':{'id':_0x295b7d},'include':[{'model':_0x86fb('0x23'),'as':_0x86fb('0x24')}]}});};exports[_0x86fb('0x25')]=function(_0x81b923){return request(_0x86fb('0x26'),{'options':{'where':{'id':_0x81b923},'attributes':['id',_0x86fb('0xb')]}});};exports['createSmsMessage']=function(_0x49eedd){return request(_0x86fb('0x27'),{'body':_0x49eedd});};exports[_0x86fb('0x28')]=function(_0xdb1dde){return request(_0x86fb('0x29'),{'body':_0xdb1dde});};exports['createSquareReport']=function(_0x2f94f5){return request('CreateSquareReport',{'body':_[_0x86fb('0x2a')](_0x2f94f5,{'project_name':_0x2f94f5[_0x86fb('0x2b')],'prev_project_name':_0x2f94f5[_0x86fb('0x2c')]||'','is_subproject':_0x2f94f5[_0x86fb('0x2c')]?!![]:![],'leaveAt':moment()[_0x86fb('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x86fb('0x2e')]=function(_0x4a2599){return request(_0x86fb('0x2f'),{'body':_0x4a2599});};exports[_0x86fb('0x30')]=function(_0x239b47){return request(_0x86fb('0x31'),{'body':_0x239b47});};exports[_0x86fb('0x32')]=function(_0x519df5){return request(_0x86fb('0x33'),{'options':{'raw':![],'where':{'phone':_0x519df5[_0x86fb('0x1e')],'ListId':_0x519df5[_0x86fb('0x34')]}}})['then'](function(_0x370000){if(_0x370000){return _0x370000;}return request(_0x86fb('0x35'),{'body':_0x519df5});});};exports[_0x86fb('0x36')]=function(_0x445580){return request('ShowPause',{'options':{'where':{'id':_0x445580},'attributes':[_0x86fb('0xb')]}});};exports[_0x86fb('0x37')]=function(_0x3c7149,_0x4ab79a){return request(_0x86fb('0x38'),{'body':{'interface':_0x4ab79a},'options':{'where':_0x3c7149}});};exports[_0x86fb('0x39')]=function(_0xffe6ec,_0x19c7d0,_0x420226){return request(_0x86fb('0x3a'),{'body':{'type':_0x19c7d0,'uniqueid':_0x420226},'options':{'where':_0xffe6ec}});};exports['agentUnpause']=function(_0x11dd1f){return request('UnpauseUser',{'body':{},'options':{'where':_0x11dd1f}});};exports[_0x86fb('0x3b')]=function(_0x18aa97){return request(_0x86fb('0x3c'),{'body':{},'options':{'where':_0x18aa97}});}; \ 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 9034704..af43a83 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 _0x96f1=['exports','./polly','./lex'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x96f1,0x19c));var _0x196f=function(_0x1d9bf9,_0x453603){_0x1d9bf9=_0x1d9bf9-0x0;var _0x3c3eea=_0x96f1[_0x1d9bf9];return _0x3c3eea;};var polly=require(_0x196f('0x0'));var lex=require(_0x196f('0x1'));module[_0x196f('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x04cc=['./polly','./lex','exports'];(function(_0x267f2c,_0x2f820f){var _0x41ed71=function(_0x1c2fdc){while(--_0x1c2fdc){_0x267f2c['push'](_0x267f2c['shift']());}};_0x41ed71(++_0x2f820f);}(_0x04cc,0x11a));var _0xc04c=function(_0x1b6db3,_0x26930b){_0x1b6db3=_0x1b6db3-0x0;var _0x38a71e=_0x04cc[_0x1b6db3];return _0x38a71e;};var polly=require(_0xc04c('0x0'));var lex=require(_0xc04c('0x1'));module[_0xc04c('0x2')]={'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 1650c46..9b76cd2 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 _0x41bb=['exports','./lib/api'];(function(_0x47c53d,_0x15951f){var _0x1ddaee=function(_0x5765c0){while(--_0x5765c0){_0x47c53d['push'](_0x47c53d['shift']());}};_0x1ddaee(++_0x15951f);}(_0x41bb,0xc5));var _0xb41b=function(_0x14d8e5,_0x125502){_0x14d8e5=_0x14d8e5-0x0;var _0x4f36d8=_0x41bb[_0x14d8e5];return _0x4f36d8;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ No newline at end of file +var _0x5ff3=['exports'];(function(_0x4fe39c,_0x1b7d5a){var _0x2e8e85=function(_0x56fff9){while(--_0x56fff9){_0x4fe39c['push'](_0x4fe39c['shift']());}};_0x2e8e85(++_0x1b7d5a);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3b5c50,_0x5b0e73){_0x3b5c50=_0x3b5c50-0x0;var _0x478b9a=_0x5ff3[_0x3b5c50];return _0x478b9a;};'use strict';var lex=require('./lib/api');module[_0x35ff('0x0')]=function(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a){return lex(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a);}; \ 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 ac39031..e134120 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(_0x282a5b,_0xafe17e){var _0x3b5809=function(_0x4996f9){while(--_0x4996f9){_0x282a5b['push'](_0x282a5b['shift']());}};_0x3b5809(++_0xafe17e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0xd31273,_0x1e0868){var _0x5137d8=function(_0x2af291){while(--_0x2af291){_0xd31273['push'](_0xd31273['shift']());}};_0x5137d8(++_0x1e0868);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 caf6e51..8e3a339 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 _0x9e23=['./lib/api','exports'];(function(_0x5a727b,_0x39ad5a){var _0x876ec2=function(_0x5b09ea){while(--_0x5b09ea){_0x5a727b['push'](_0x5a727b['shift']());}};_0x876ec2(++_0x39ad5a);}(_0x9e23,0x192));var _0x39e2=function(_0x3273b9,_0x51c831){_0x3273b9=_0x3273b9-0x0;var _0x9a80d9=_0x9e23[_0x3273b9];return _0x9a80d9;};'use strict';var polly=require(_0x39e2('0x0'));module[_0x39e2('0x1')]=function(_0x3649c6,_0x162a8b,_0x108732,_0x247b5c,_0x1d524d,_0x46a8ca,_0x3af074){return polly(_0x3649c6,_0x162a8b,_0x108732,_0x247b5c,_0x1d524d,_0x46a8ca,_0x3af074);}; \ No newline at end of file +var _0x237c=['exports','./lib/api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x237c,0x191));var _0xc237=function(_0x3ab8e7,_0x597b74){_0x3ab8e7=_0x3ab8e7-0x0;var _0x1e9e1d=_0x237c[_0x3ab8e7];return _0x1e9e1d;};'use strict';var polly=require(_0xc237('0x0'));module[_0xc237('0x1')]=function(_0x492d0d,_0x58c868,_0x55167f,_0x15dc4b,_0xb75973,_0x9bdac3,_0x10ac9d){return polly(_0x492d0d,_0x58c868,_0x55167f,_0x15dc4b,_0xb75973,_0x9bdac3,_0x10ac9d);}; \ 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 50caaeb..a436402 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 _0xe348=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream','writeFile'];(function(_0x5742c4,_0x5d94fc){var _0x3eecc9=function(_0x1a8a56){while(--_0x1a8a56){_0x5742c4['push'](_0x5742c4['shift']());}};_0x3eecc9(++_0x5d94fc);}(_0xe348,0xc0));var _0x8e34=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xe348[_0xc8a931];return _0x28bd27;};'use strict';var fs=require('fs');var path=require(_0x8e34('0x0'));var BPromise=require(_0x8e34('0x1'));var rs=require(_0x8e34('0x2'));var AWS=require(_0x8e34('0x3'));function pollyResult(_0x1d869e,_0x33ad73,_0xc15650){return new BPromise(function(_0x1df02b,_0x2e3bd9){_0x1d869e['synthesizeSpeech'](_0x33ad73,function(_0x40f6ac,_0x29126d){if(_0x40f6ac){_0x2e3bd9(_0x40f6ac);}else if(_0x29126d){if(_0x29126d[_0x8e34('0x4')]instanceof Buffer){fs[_0x8e34('0x5')](_0xc15650,_0x29126d['AudioStream'],function(_0x5de17e){if(_0x5de17e){_0x2e3bd9(_0x5de17e);}else{_0x1df02b();}});}else{_0x2e3bd9(new Error(_0x8e34('0x6')));}}else{_0x2e3bd9(new Error(_0x8e34('0x7')));}});});}module['exports']=function(_0x585e15,_0x4fbc61,_0x278393,_0x427a39,_0x471ed9,_0x5571be,_0x36782c){var _0x180487=new AWS[(_0x8e34('0x8'))]({'accessKeyId':_0x585e15,'secretAccessKey':_0x4fbc61,'region':_0x278393});var _0x54ac6c={'Text':_0x471ed9,'TextType':_0x5571be||_0x8e34('0x9'),'OutputFormat':_0x8e34('0xa'),'VoiceId':_0x427a39};return pollyResult(_0x180487,_0x54ac6c,_0x36782c);}; \ No newline at end of file +var _0xdee6=['Polly','mp3','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x127393,_0x28bf3a){var _0x1849ef=function(_0x1d5efc){while(--_0x1d5efc){_0x127393['push'](_0x127393['shift']());}};_0x1849ef(++_0x28bf3a);}(_0xdee6,0x19c));var _0x6dee=function(_0x136694,_0x15e429){_0x136694=_0x136694-0x0;var _0x1e96e8=_0xdee6[_0x136694];return _0x1e96e8;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x6dee('0x0'));var rs=require('randomstring');var AWS=require(_0x6dee('0x1'));function pollyResult(_0x10f431,_0x57d94b,_0x22d6c4){return new BPromise(function(_0xfa6c98,_0x5420cf){_0x10f431[_0x6dee('0x2')](_0x57d94b,function(_0x970e6f,_0x2b0b95){if(_0x970e6f){_0x5420cf(_0x970e6f);}else if(_0x2b0b95){if(_0x2b0b95[_0x6dee('0x3')]instanceof Buffer){fs[_0x6dee('0x4')](_0x22d6c4,_0x2b0b95['AudioStream'],function(_0x33e5aa){if(_0x33e5aa){_0x5420cf(_0x33e5aa);}else{_0xfa6c98();}});}else{_0x5420cf(new Error(_0x6dee('0x5')));}}else{_0x5420cf(new Error(_0x6dee('0x6')));}});});}module[_0x6dee('0x7')]=function(_0x2b32e0,_0x3dc362,_0x5d29ea,_0x473e6b,_0x20be0f,_0x49b7bc,_0x31913e){var _0x529864=new AWS[(_0x6dee('0x8'))]({'accessKeyId':_0x2b32e0,'secretAccessKey':_0x3dc362,'region':_0x5d29ea});var _0x33a631={'Text':_0x20be0f,'TextType':_0x49b7bc||'text','OutputFormat':_0x6dee('0x9'),'VoiceId':_0x473e6b};return pollyResult(_0x529864,_0x33a631,_0x31913e);}; \ 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 d6dfc4d..9bdaf13 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 _0x7e80=['./lib/api'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7e80,0xe3));var _0x07e8=function(_0x2b27a0,_0x2ee33){_0x2b27a0=_0x2b27a0-0x0;var _0x44ec6b=_0x7e80[_0x2b27a0];return _0x44ec6b;};'use strict';var asr=require(_0x07e8('0x0'));module['exports']=function(_0x5f569c,_0x67ec4d,_0xc9a23b,_0x4d4e96){return asr(_0x5f569c,_0x67ec4d,_0xc9a23b);}; \ No newline at end of file +var _0x3a59=['exports','./lib/api'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x3a59,0x167));var _0x93a5=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x3a59[_0x2fbcf6];return _0x3e7265;};'use strict';var asr=require(_0x93a5('0x0'));module[_0x93a5('0x1')]=function(_0x1bdf0d,_0x401859,_0x46585f,_0xb4b27d){return asr(_0x1bdf0d,_0x401859,_0x46585f);}; \ 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 0642117..1e7405c 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 _0xffe1=['length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','string','filepath\x20should\x20be\x20a\x20string'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xffe1,0x175));var _0x1ffe=function(_0x5915b1,_0x89d39){_0x5915b1=_0x5915b1-0x0;var _0x46100a=_0xffe1[_0x5915b1];return _0x46100a;};'use strict';var url=require(_0x1ffe('0x0'));var BPromise=require(_0x1ffe('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x37f22a,_0x100207,_0x38121){return new BPromise(function(_0x4d13c2,_0x2be98c){var _0x21ba54;if(typeof _0x37f22a!==_0x1ffe('0x2')||_0x37f22a['length']===0x0){return _0x2be98c(_0x1ffe('0x3'));}if(typeof _0x100207!==_0x1ffe('0x2')||_0x100207[_0x1ffe('0x4')]===0x0){return _0x2be98c(_0x1ffe('0x5'));}if(typeof _0x38121!==_0x1ffe('0x6')&&(typeof _0x38121!==_0x1ffe('0x2')||_0x38121['length']===0x0)){return _0x2be98c('lang\x20should\x20be\x20a\x20string');}try{_0x21ba54=fs[_0x1ffe('0x7')](_0x37f22a)[_0x1ffe('0x8')](_0x1ffe('0x9'));}catch(_0x1cc54d){return _0x2be98c(_0x1cc54d);}return _0x4d13c2({'method':'POST','uri':host+_0x1ffe('0xa')+_0x100207,'body':{'config':{'encoding':_0x1ffe('0xb'),'sampleRateHertz':_0x1ffe('0xc'),'languageCode':_0x38121},'audio':{'content':_0x21ba54}},'json':!![]});});}; \ No newline at end of file +var _0x303a=['url','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','LINEAR16','8000'];(function(_0x590b62,_0x5d7480){var _0x47d844=function(_0x213146){while(--_0x213146){_0x590b62['push'](_0x590b62['shift']());}};_0x47d844(++_0x5d7480);}(_0x303a,0x1a0));var _0xa303=function(_0x23a8ec,_0x3ddb28){_0x23a8ec=_0x23a8ec-0x0;var _0x2b2ce1=_0x303a[_0x23a8ec];return _0x2b2ce1;};'use strict';var url=require(_0xa303('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xa303('0x1');module[_0xa303('0x2')]=function(_0x36e548,_0x19d27a,_0x594b49){return new BPromise(function(_0x46c56b,_0x26b47c){var _0x38a354;if(typeof _0x36e548!==_0xa303('0x3')||_0x36e548[_0xa303('0x4')]===0x0){return _0x26b47c(_0xa303('0x5'));}if(typeof _0x19d27a!==_0xa303('0x3')||_0x19d27a[_0xa303('0x4')]===0x0){return _0x26b47c(_0xa303('0x6'));}if(typeof _0x594b49!=='undefined'&&(typeof _0x594b49!=='string'||_0x594b49['length']===0x0)){return _0x26b47c(_0xa303('0x7'));}try{_0x38a354=fs[_0xa303('0x8')](_0x36e548)['toString'](_0xa303('0x9'));}catch(_0x51acca){return _0x26b47c(_0x51acca);}return _0x46c56b({'method':_0xa303('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x19d27a,'body':{'config':{'encoding':_0xa303('0xb'),'sampleRateHertz':_0xa303('0xc'),'languageCode':_0x594b49},'audio':{'content':_0x38a354}},'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 bc4c459..da87717 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 _0xd4b2=['exports'];(function(_0x1829c2,_0x5dbbeb){var _0x464c40=function(_0x182e04){while(--_0x182e04){_0x1829c2['push'](_0x1829c2['shift']());}};_0x464c40(++_0x5dbbeb);}(_0xd4b2,0x19f));var _0x2d4b=function(_0x470f4b,_0x563ba2){_0x470f4b=_0x470f4b-0x0;var _0x359ae6=_0xd4b2[_0x470f4b];return _0x359ae6;};var asr=require('./asr');module[_0x2d4b('0x0')]={'asr':asr}; \ No newline at end of file +var _0xaee6=['exports'];(function(_0x24de61,_0x2860f6){var _0x5a0b58=function(_0x3d00ae){while(--_0x3d00ae){_0x24de61['push'](_0x24de61['shift']());}};_0x5a0b58(++_0x2860f6);}(_0xaee6,0x166));var _0x6aee=function(_0x159c4e,_0x32db25){_0x159c4e=_0x159c4e-0x0;var _0x489ce9=_0xaee6[_0x159c4e];return _0x489ce9;};var asr=require('./asr');module[_0x6aee('0x0')]={'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 05e200d..ce4726d 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 _0xfd90=['Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','statusCode','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','writeFileSync','base64','then','chmodSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','MP3','text:synthesize','POST','generate','audioContent','writeFile','777','.wav','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','.mp3','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','action','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xfd90,0xac));var _0x0fd9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfd90[_0x122ef9];return _0x42fba0;};'use strict';var apiai=require(_0x0fd9('0x0'));var BPromise=require(_0x0fd9('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x0fd9('0x2'));var https=require(_0x0fd9('0x3'));var md5=require(_0x0fd9('0x4'));var path=require(_0x0fd9('0x5'));var querystring=require(_0x0fd9('0x6'));var rp=require(_0x0fd9('0x7'));var rs=require(_0x0fd9('0x8'));var sox=require(_0x0fd9('0x9'));var tts=require(_0x0fd9('0xa'));var urlParse=require(_0x0fd9('0xb'))['parse'];var util=require(_0x0fd9('0xc'));var aws=require(_0x0fd9('0xd'));var google=require('./google');var sestek=require(_0x0fd9('0xe'));var tilde=require(_0x0fd9('0xf'));var logger=require(_0x0fd9('0x10'))(_0x0fd9('0x11'));var ISPEECH_API=_0x0fd9('0x12');function downloadFile(_0x51f4fb,_0x4a0102){return new BPromise(function(_0x323d8d,_0x182376){var _0x2d4146=urlParse(_0x51f4fb);var _0x4ee4f6=_0x2d4146[_0x0fd9('0x13')]===_0x0fd9('0x14')?https:http;var _0x54d48d={'host':_0x2d4146['host'],'path':_0x2d4146[_0x0fd9('0x5')],'headers':{'user-agent':_0x0fd9('0x15')}};_0x4ee4f6[_0x0fd9('0x16')](_0x54d48d,function(_0xe302e9){if(_0xe302e9['statusCode']!==0xc8){logger[_0x0fd9('0x17')](_0x0fd9('0x18')+_0x51f4fb+_0x0fd9('0x19')+_0xe302e9['statusCode']+'\x20('+_0xe302e9['statusMessage']+')');_0x182376(new Error(_0x0fd9('0x18')+_0x51f4fb+_0x0fd9('0x19')+_0xe302e9['statusCode']+'\x20('+_0xe302e9[_0x0fd9('0x1a')]+')'));return;}var _0xb90f11=fs[_0x0fd9('0x1b')](_0x4a0102);_0xb90f11['on'](_0x0fd9('0x1c'),function(){logger[_0x0fd9('0x1d')](_0x0fd9('0x1e'));_0xb90f11[_0x0fd9('0x1f')](_0x323d8d);});_0xb90f11['on'](_0x0fd9('0x17'),function(_0x6733e){fs[_0x0fd9('0x20')](_0x4a0102);logger[_0x0fd9('0x17')](_0x0fd9('0x21'),_0x6733e);_0x182376(_0x6733e);});_0xe302e9[_0x0fd9('0x22')](_0xb90f11);})['on'](_0x0fd9('0x17'),function(_0xbd0fd1){logger[_0x0fd9('0x17')](_0xbd0fd1);_0x182376(_0xbd0fd1);})[_0x0fd9('0x23')]();});}function uploadFile(_0x5a7f54){return new BPromise(function(_0x2968bd,_0x37ff86){var _0x3b6568=urlParse(_0x5a7f54);var _0x5cfeef=_0x3b6568[_0x0fd9('0x13')]==='https:'?https:http;var _0x20f94f={'host':_0x3b6568[_0x0fd9('0x24')],'path':_0x3b6568[_0x0fd9('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x5cfeef[_0x0fd9('0x16')](_0x20f94f,function(_0x88b2e9){if(_0x88b2e9[_0x0fd9('0x25')]!==0xc8){_0x37ff86(new Error('request\x20to\x20'+_0x5a7f54+'\x20failed,\x20status\x20code\x20=\x20'+_0x88b2e9['statusCode']+'\x20('+_0x88b2e9['statusMessage']+')'));return;}var _0x12de2a='';_0x88b2e9['on'](_0x0fd9('0x26'),function(_0x496b9a){_0x12de2a+=_0x496b9a;});_0x88b2e9['on'](_0x0fd9('0x23'),function(){_0x2968bd(_0x12de2a);});})['on']('error',function(_0x16c8b8){_0x37ff86(_0x16c8b8);})['end']();});}function convertFile(_0x303ad3,_0x5c2352){return new BPromise(function(_0x10609c,_0x706752){var _0x3d4cbc=sox[_0x0fd9('0x27')](_0x303ad3,_0x5c2352,{'sampleRate':0x1f40,'format':_0x0fd9('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d4cbc['on'](_0x0fd9('0x17'),function(_0x3e1598){logger[_0x0fd9('0x17')](_0x0fd9('0x29'),_0x3e1598);_0x706752(_0x3e1598);});_0x3d4cbc['on']('end',function(){logger[_0x0fd9('0x1d')](_0x0fd9('0x2a'));_0x10609c();});_0x3d4cbc[_0x0fd9('0x2b')]();});}function base64Decode(_0x22e3fe,_0x409353){var _0x145568=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+'.wav');fs[_0x0fd9('0x2e')](_0x145568,_0x22e3fe,_0x0fd9('0x2f'));return convertFile(_0x145568,_0x409353)[_0x0fd9('0x30')](function(){try{fs['unlink'](_0x145568);fs[_0x0fd9('0x31')](_0x409353,'777');}catch(_0x4aa799){logger[_0x0fd9('0x17')](_0x4aa799);}return _0x409353['split']('.')[0x0];});}function base64Encode(_0x2c41d5){var _0x3ea2dc=fs['readFileSync'](_0x2c41d5);return new Buffer(_0x3ea2dc)[_0x0fd9('0x32')](_0x0fd9('0x2f'));}exports[_0x0fd9('0x33')]=function(_0x1ed32e,_0x4a1ccf,_0x591189,_0x1e1460,_0x2551ef,_0x1c1a90){var _0x2edf71,_0x50ae5a;var _0x455a1b=_0x0fd9('0x34');var _0x548d95=_0x0fd9('0x35')+_0x1ed32e;var _0x52a6b3={};if(_0x4a1ccf==='ssml'){_0x52a6b3[_0x0fd9('0x36')]={'ssml':_0x591189};}else{_0x52a6b3[_0x0fd9('0x36')]={'text':_0x591189};};_0x52a6b3['voice']={'languageCode':_0x1e1460,'ssmlGender':_0x2551ef};_0x52a6b3['audioConfig']={'audioEncoding':_0x0fd9('0x37'),'sampleRateHertz':0x1f40};var _0x518105={'url':_0x455a1b+_0x0fd9('0x38')+_0x548d95,'method':_0x0fd9('0x39'),'json':!![],'body':_0x52a6b3};return rp(_0x518105)[_0x0fd9('0x30')](function(_0x3d32cf){return new BPromise(function(_0x1c230a,_0x16dfbe){_0x2edf71=path[_0x0fd9('0x2c')](__dirname,'tmp',rs[_0x0fd9('0x3a')](0x4)+'.mp3');var _0x1c2c56=Buffer['from'](_0x3d32cf[_0x0fd9('0x3b')],_0x0fd9('0x2f'));return fs[_0x0fd9('0x3c')](_0x2edf71,_0x1c2c56,function(_0x2a1e31){_0x16dfbe(_0x2a1e31);},function(_0x21c1bd){fs[_0x0fd9('0x31')](_0x2edf71,_0x0fd9('0x3d'));_0x1c230a(_0x21c1bd);});});})[_0x0fd9('0x30')](function(_0x208b7f){_0x50ae5a=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x3e'));return convertFile(_0x2edf71,_0x50ae5a);})[_0x0fd9('0x30')](function(){try{fs[_0x0fd9('0x20')](_0x2edf71);fs[_0x0fd9('0x31')](_0x50ae5a,_0x0fd9('0x3d'));}catch(_0x38f376){logger['error'](_0x38f376);}logger[_0x0fd9('0x1d')]('googleCloudTTS\x20path',_0x50ae5a[_0x0fd9('0x3f')]('.')[0x0]);return _0x50ae5a[_0x0fd9('0x3f')]('.')[0x0];});};exports[_0x0fd9('0x40')]=function(_0x3a3acd,_0x1d49b0){var _0x369270='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xff88f3,_0x359631;var _0x76392;var _0xf7826f={'encoding':_0x0fd9('0x41'),'method':_0x0fd9('0x39'),'timeout':0x2710,'url':_0x369270,'headers':{'Content-Type':_0x0fd9('0x42')},'body':_0x0fd9('0x43')+encodeURIComponent(JSON[_0x0fd9('0x44')]([[['jQ1olc',JSON[_0x0fd9('0x44')]([_0x3a3acd,_0x1d49b0||'en',![],'null']),null,_0x0fd9('0x45')]]]))};return rp(_0xf7826f)[_0x0fd9('0x30')](function(_0x1faccd){try{_0x76392=eval(_0x1faccd[_0x0fd9('0x46')](0x5))[0x0][0x2];}catch(_0x1d2099){throw new Error(_0x0fd9('0x47')+_0x1faccd[_0x0fd9('0x26')]);}if(!_0x76392){if(_0x3a3acd[_0x0fd9('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x1d49b0+'\x22\x20might\x20not\x20exist');}}try{_0x76392=eval(_0x76392)[0x0];}catch(_0x3d58de){throw new Error(_0x0fd9('0x47')+res[_0x0fd9('0x26')]);}const _0x48985f=_0x76392;_0xff88f3=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+_0x0fd9('0x49'));fs[_0x0fd9('0x2e')](_0xff88f3,_0x76392,{'encoding':'base64'});_0x359631=path['resolve'](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x3e'));return convertFile(_0xff88f3,_0x359631);})['then'](function(){try{fs[_0x0fd9('0x20')](_0xff88f3);fs[_0x0fd9('0x31')](_0x359631,_0x0fd9('0x3d'));}catch(_0x520a4b){logger[_0x0fd9('0x17')](_0x520a4b);}logger[_0x0fd9('0x1d')](_0x0fd9('0x4a'),_0x359631[_0x0fd9('0x3f')]('.')[0x0]);return _0x359631[_0x0fd9('0x3f')]('.')[0x0];});};exports['googleASR']=function(_0x514f89,_0x5b5799,_0x40fec3){return google[_0x0fd9('0x4b')](_0x514f89,_0x5b5799,_0x40fec3)[_0x0fd9('0x30')](function(_0x32f485){logger[_0x0fd9('0x1d')](_0x32f485[_0x0fd9('0x4c')]);return rp(_0x32f485);})[_0x0fd9('0x30')](function(_0x3fc3b1){var _0x434b93='';var _0x31b613=0x0;try{fs[_0x0fd9('0x20')](_0x514f89);}catch(_0x171fb2){logger[_0x0fd9('0x17')](_0x171fb2);}if(_0x3fc3b1&&_0x3fc3b1[_0x0fd9('0x4d')]){_0x434b93=_0x3fc3b1[_0x0fd9('0x4d')][_0x0fd9('0x4e')](function(_0x3e67ec){return _0x3e67ec&&_0x3e67ec['alternatives'][0x0]&&_0x3e67ec[_0x0fd9('0x4f')][0x0][_0x0fd9('0x50')]?_0x3e67ec[_0x0fd9('0x4f')][0x0][_0x0fd9('0x50')]:'';})[_0x0fd9('0x51')]('\x0a');_0x31b613=_0x3fc3b1[_0x0fd9('0x4d')][_0x0fd9('0x4e')](function(_0x32e3aa){return _0x32e3aa&&_0x32e3aa[_0x0fd9('0x4f')][0x0]&&_0x32e3aa[_0x0fd9('0x4f')][0x0][_0x0fd9('0x52')]?_0x32e3aa[_0x0fd9('0x4f')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x0fd9('0x1d')](_0x0fd9('0x53'),_0x434b93);logger[_0x0fd9('0x1d')](_0x0fd9('0x54'),_0x31b613);return{'transcript':_0x434b93,'confidence':_0x31b613};})[_0x0fd9('0x55')](function(_0x23cae6){logger[_0x0fd9('0x17')](_0x0fd9('0x56'),_0x23cae6['statusCode'],_0x23cae6[_0x0fd9('0x57')],_0x23cae6[_0x0fd9('0x58')]);});};exports['googleDialogflow']=function(_0x3e83c1,_0x545698,_0x7927f0,_0x5dafea){var _0x137862=apiai(_0x545698,{'language':_0x5dafea||'en'});return _0x137862[_0x0fd9('0x59')](_0x7927f0,{'sessionId':md5(_0x3e83c1)})['then'](function(_0x4e986d){logger['info'](JSON[_0x0fd9('0x44')](_0x4e986d));return{'source':_0x4e986d['result']['source'],'resolvedQuery':_0x4e986d[_0x0fd9('0x5a')]['resolvedQuery'],'action':_0x4e986d[_0x0fd9('0x5a')][_0x0fd9('0x5b')],'actionIncomplete':_0x4e986d[_0x0fd9('0x5a')]['actionIncomplete'],'speech':_0x4e986d[_0x0fd9('0x5a')]['fulfillment'][_0x0fd9('0x5c')],'score':_0x4e986d[_0x0fd9('0x5a')][_0x0fd9('0x5d')],'statusCode':_0x4e986d[_0x0fd9('0x5e')][_0x0fd9('0x5f')],'endConversation':_0x4e986d[_0x0fd9('0x5a')][_0x0fd9('0x60')]['endConversation']||![],'isFallbackIntent':_0x4e986d[_0x0fd9('0x5a')]['metadata'][_0x0fd9('0x61')]};});};exports[_0x0fd9('0x62')]=function(_0x502a7f,_0x32bde8,_0x325670,_0x31008a,_0x392c9e,_0x1a9657){var _0x367016=_0x31008a[_0x0fd9('0x63')](/\\n/g,'\x0a');var _0x41c0b5={'credentials':{'private_key':_0x367016,'client_email':_0x325670}};var _0x23ce29=new dialogflow[(_0x0fd9('0x64'))](_0x41c0b5);var _0x162dc8=_0x23ce29['sessionPath'](_0x32bde8,md5(_0x502a7f));var _0x57314e={'session':_0x162dc8,'queryInput':{'text':{'text':_0x392c9e,'languageCode':_0x1a9657}}};return _0x23ce29[_0x0fd9('0x65')](_0x57314e)[_0x0fd9('0x30')](function(_0x368d3a){if(_0x368d3a&&_0x368d3a[_0x0fd9('0x48')]){logger[_0x0fd9('0x1d')](_0x0fd9('0x66'),JSON[_0x0fd9('0x44')](_0x368d3a));var _0x5219c5=_0x368d3a[0x0];if(_0x5219c5){var _0x55d298={'action':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x5b')],'allRequiredParamsPresent':_0x5219c5['queryResult'][_0x0fd9('0x68')],'endConversation':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x69')]&&_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x69')][_0x0fd9('0x6a')]?_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x69')][_0x0fd9('0x6a')][_0x0fd9('0x6b')][_0x0fd9('0x6c')]:![],'fulfillmentText':_0x5219c5['queryResult']['fulfillmentText'],'intentName':_0x5219c5['queryResult']['intent'][_0x0fd9('0x57')],'intentDisplayName':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x6d')][_0x0fd9('0x6e')],'isFallbackIntent':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x6d')][_0x0fd9('0x6f')],'languageCode':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x70')],'queryText':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x71')],'responseId':_0x5219c5['responseId'],'score':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x72')],'speech':_0x5219c5[_0x0fd9('0x67')]['fulfillmentText'],'providerResponse':JSON[_0x0fd9('0x44')](_0x368d3a)};return _0x55d298;}}});};exports[_0x0fd9('0x73')]=function(_0x14d124,_0x197739,_0x324e58,_0x583bbf){return tilde[_0x0fd9('0x4b')](_0x14d124,_0x197739,_0x324e58,_0x583bbf)[_0x0fd9('0x30')](function(_0x1489d6){try{fs[_0x0fd9('0x20')](_0x14d124);}catch(_0x2e3184){logger[_0x0fd9('0x17')](_0x2e3184);}logger[_0x0fd9('0x1d')]('Tilde\x20ASR\x20transcription',_0x1489d6[_0x0fd9('0x50')]);logger[_0x0fd9('0x1d')](_0x0fd9('0x74'),_0x1489d6[_0x0fd9('0x52')]);return _0x1489d6;});};exports[_0x0fd9('0x75')]=function(_0x45004d,_0x4d6d44,_0x331476,_0x2cde5f,_0x4d5a30,_0x29355c){var _0xafc39f=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x49'));var _0x599b5f;return aws[_0x0fd9('0x76')](_0x45004d,_0x4d6d44,_0x331476,_0x2cde5f,_0x4d5a30,_0x29355c,_0xafc39f)[_0x0fd9('0x30')](function(){_0x599b5f=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+'.wav');return convertFile(_0xafc39f,_0x599b5f);})[_0x0fd9('0x30')](function(){try{fs[_0x0fd9('0x20')](_0xafc39f);fs[_0x0fd9('0x31')](_0x599b5f,_0x0fd9('0x3d'));}catch(_0x279edc){logger[_0x0fd9('0x17')](_0x279edc);}return _0x599b5f[_0x0fd9('0x3f')]('.')[0x0];});};exports[_0x0fd9('0x77')]=function(_0x2e73b3,_0x5d48dd,_0x52e9d0,_0x2efb61,_0x437c35,_0x3fa3f0){return aws['lex'](_0x2e73b3,_0x5d48dd,_0x52e9d0,_0x2efb61,_0x437c35,_0x3fa3f0)['then'](function(_0x7e13ca){logger[_0x0fd9('0x1d')](JSON[_0x0fd9('0x44')](_0x7e13ca));return _0x7e13ca;});};exports[_0x0fd9('0x78')]=function(_0x20b591,_0x3bc71e,_0x2d2d24,_0x461aef){var _0x3b9893=util[_0x0fd9('0x79')](_0x0fd9('0x7a'),ISPEECH_API,_0x20b591,encodeURIComponent(_0x3bc71e),_0x2d2d24,_0x461aef);var _0xdce37b=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x49'));var _0x57fdd9;return downloadFile(_0x3b9893,_0xdce37b)['then'](function(){_0x57fdd9=path[_0x0fd9('0x2c')](__dirname,'tmp',rs[_0x0fd9('0x3a')](0x4)+'.wav');return convertFile(_0xdce37b,_0x57fdd9);})[_0x0fd9('0x30')](function(){try{fs['unlink'](_0xdce37b);fs[_0x0fd9('0x31')](_0x57fdd9,_0x0fd9('0x3d'));}catch(_0x537fd3){logger[_0x0fd9('0x17')](_0x537fd3);}return _0x57fdd9[_0x0fd9('0x3f')]('.')[0x0];});};exports[_0x0fd9('0x7b')]=function(_0x4c4285,_0x7ed458,_0x270ffe,_0x39445a){var _0x26ef84=util['format'](_0x0fd9('0x7c'),ISPEECH_API,_0x7ed458,_0x270ffe,base64Encode(_0x4c4285),_0x39445a?util['format'](_0x0fd9('0x7d'),encodeURIComponent(_0x39445a)):_0x0fd9('0x7e'));return uploadFile(_0x26ef84)[_0x0fd9('0x30')](function(_0x4d421b){return querystring[_0x0fd9('0x7f')](_0x4d421b);});};exports[_0x0fd9('0x80')]=function(_0x517013,_0x5a0ef9){return sestek[_0x0fd9('0x81')](_0x517013,_0x5a0ef9)[_0x0fd9('0x30')](function(_0x412507){logger['info'](JSON[_0x0fd9('0x44')](_0x412507));var _0x3fb361={'speech':_0x412507['text'],'action':_0x412507[_0x0fd9('0x82')]?_0x412507[_0x0fd9('0x82')][_0x0fd9('0x83')]:undefined,'actiondata':_0x412507[_0x0fd9('0x82')]?_0x412507[_0x0fd9('0x82')][_0x0fd9('0x84')]:undefined};if(_0x412507[_0x0fd9('0x82')]&&_0x412507[_0x0fd9('0x82')][_0x0fd9('0x85')]){return base64Decode(_0x412507['channelData'][_0x0fd9('0x85')][_0x0fd9('0x86')],path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+_0x0fd9('0x3e')))[_0x0fd9('0x30')](function(_0x5beffa){_0x3fb361[_0x0fd9('0x87')]=_0x5beffa;return _0x3fb361;});}return _0x3fb361;});};exports[_0x0fd9('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0x81bb=['statusCode','error','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','end','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','text:synthesize','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','util','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER'];(function(_0x23cf72,_0x40fc3e){var _0x157f57=function(_0x54987f){while(--_0x54987f){_0x23cf72['push'](_0x23cf72['shift']());}};_0x157f57(++_0x40fc3e);}(_0x81bb,0x73));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xb81b('0x0'));var dialogflow=require(_0xb81b('0x1'));var fs=require('fs');var http=require(_0xb81b('0x2'));var https=require(_0xb81b('0x3'));var md5=require(_0xb81b('0x4'));var path=require(_0xb81b('0x5'));var querystring=require(_0xb81b('0x6'));var rp=require('request-promise');var rs=require(_0xb81b('0x7'));var sox=require(_0xb81b('0x8'));var tts=require(_0xb81b('0x9'));var urlParse=require(_0xb81b('0xa'))['parse'];var util=require(_0xb81b('0xb'));var aws=require('./aws');var google=require('./google');var sestek=require(_0xb81b('0xc'));var tilde=require('./tilde');var logger=require(_0xb81b('0xd'))(_0xb81b('0xe'));var ISPEECH_API=_0xb81b('0xf');function downloadFile(_0x542e55,_0x32a6f4){return new BPromise(function(_0x43530d,_0x44fdaa){var _0x2bd71f=urlParse(_0x542e55);var _0x49cd00=_0x2bd71f[_0xb81b('0x10')]===_0xb81b('0x11')?https:http;var _0x7483ae={'host':_0x2bd71f[_0xb81b('0x12')],'path':_0x2bd71f['path'],'headers':{'user-agent':_0xb81b('0x13')}};_0x49cd00['get'](_0x7483ae,function(_0x3f9b29){if(_0x3f9b29[_0xb81b('0x14')]!==0xc8){logger[_0xb81b('0x15')]('request\x20to\x20'+_0x542e55+'\x20failed,\x20status\x20code\x20=\x20'+_0x3f9b29[_0xb81b('0x14')]+'\x20('+_0x3f9b29[_0xb81b('0x16')]+')');_0x44fdaa(new Error('request\x20to\x20'+_0x542e55+'\x20failed,\x20status\x20code\x20=\x20'+_0x3f9b29['statusCode']+'\x20('+_0x3f9b29[_0xb81b('0x16')]+')'));return;}var _0x1f8dc0=fs[_0xb81b('0x17')](_0x32a6f4);_0x1f8dc0['on'](_0xb81b('0x18'),function(){logger[_0xb81b('0x19')](_0xb81b('0x1a'));_0x1f8dc0['close'](_0x43530d);});_0x1f8dc0['on'](_0xb81b('0x15'),function(_0x4b4e74){fs[_0xb81b('0x1b')](_0x32a6f4);logger['error'](_0xb81b('0x1c'),_0x4b4e74);_0x44fdaa(_0x4b4e74);});_0x3f9b29['pipe'](_0x1f8dc0);})['on'](_0xb81b('0x15'),function(_0x5ddd83){logger[_0xb81b('0x15')](_0x5ddd83);_0x44fdaa(_0x5ddd83);})[_0xb81b('0x1d')]();});}function uploadFile(_0x2eaa2){return new BPromise(function(_0xe5a39c,_0x224650){var _0x19b9b9=urlParse(_0x2eaa2);var _0xb01a0c=_0x19b9b9[_0xb81b('0x10')]==='https:'?https:http;var _0x53be86={'host':_0x19b9b9[_0xb81b('0x12')],'path':_0x19b9b9[_0xb81b('0x5')],'headers':{'user-agent':_0xb81b('0x13')}};_0xb01a0c[_0xb81b('0x1e')](_0x53be86,function(_0x1475b0){if(_0x1475b0[_0xb81b('0x14')]!==0xc8){_0x224650(new Error(_0xb81b('0x1f')+_0x2eaa2+_0xb81b('0x20')+_0x1475b0[_0xb81b('0x14')]+'\x20('+_0x1475b0[_0xb81b('0x16')]+')'));return;}var _0x46204a='';_0x1475b0['on'](_0xb81b('0x21'),function(_0x427726){_0x46204a+=_0x427726;});_0x1475b0['on'](_0xb81b('0x1d'),function(){_0xe5a39c(_0x46204a);});})['on'](_0xb81b('0x15'),function(_0x1caa39){_0x224650(_0x1caa39);})[_0xb81b('0x1d')]();});}function convertFile(_0x10366d,_0x388f24){return new BPromise(function(_0x2fa3ee,_0x4d84b6){var _0x3eec15=sox[_0xb81b('0x22')](_0x10366d,_0x388f24,{'sampleRate':0x1f40,'format':_0xb81b('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3eec15['on'](_0xb81b('0x15'),function(_0x32d7ff){logger['error'](_0xb81b('0x24'),_0x32d7ff);_0x4d84b6(_0x32d7ff);});_0x3eec15['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x2fa3ee();});_0x3eec15[_0xb81b('0x25')]();});}function base64Decode(_0x338ca4,_0xc4966){var _0x463273=path[_0xb81b('0x26')](__dirname,_0xb81b('0x27'),rs[_0xb81b('0x28')](0x4)+_0xb81b('0x29'));fs[_0xb81b('0x2a')](_0x463273,_0x338ca4,_0xb81b('0x2b'));return convertFile(_0x463273,_0xc4966)[_0xb81b('0x2c')](function(){try{fs['unlink'](_0x463273);fs['chmodSync'](_0xc4966,_0xb81b('0x2d'));}catch(_0x3a0181){logger[_0xb81b('0x15')](_0x3a0181);}return _0xc4966[_0xb81b('0x2e')]('.')[0x0];});}function base64Encode(_0x480c9b){var _0x512634=fs[_0xb81b('0x2f')](_0x480c9b);return new Buffer(_0x512634)[_0xb81b('0x30')](_0xb81b('0x2b'));}exports[_0xb81b('0x31')]=function(_0x46d451,_0x278df4,_0x3cb53,_0x102cc6,_0xa063f5,_0x29177e){var _0x1a2579,_0x2ff440;var _0x30270a=_0xb81b('0x32');var _0x220494=_0xb81b('0x33')+_0x46d451;var _0x41dd2b={};if(_0x278df4==='ssml'){_0x41dd2b[_0xb81b('0x34')]={'ssml':_0x3cb53};}else{_0x41dd2b[_0xb81b('0x34')]={'text':_0x3cb53};};_0x41dd2b[_0xb81b('0x35')]={'languageCode':_0x102cc6,'ssmlGender':_0xa063f5};_0x41dd2b['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1b6797={'url':_0x30270a+_0xb81b('0x36')+_0x220494,'method':'POST','json':!![],'body':_0x41dd2b};return rp(_0x1b6797)[_0xb81b('0x2c')](function(_0x1daf4f){return new BPromise(function(_0x59556e,_0x3c5e41){_0x1a2579=path['resolve'](__dirname,_0xb81b('0x27'),rs[_0xb81b('0x28')](0x4)+_0xb81b('0x37'));var _0x17d7f1=Buffer[_0xb81b('0x38')](_0x1daf4f[_0xb81b('0x39')],_0xb81b('0x2b'));return fs[_0xb81b('0x3a')](_0x1a2579,_0x17d7f1,function(_0x24c097){_0x3c5e41(_0x24c097);},function(_0xa0abc3){fs['chmodSync'](_0x1a2579,_0xb81b('0x2d'));_0x59556e(_0xa0abc3);});});})[_0xb81b('0x2c')](function(_0xf56da9){_0x2ff440=path[_0xb81b('0x26')](__dirname,_0xb81b('0x27'),rs['generate'](0x4)+'.wav');return convertFile(_0x1a2579,_0x2ff440);})['then'](function(){try{fs['unlink'](_0x1a2579);fs[_0xb81b('0x3b')](_0x2ff440,_0xb81b('0x2d'));}catch(_0x4ed016){logger['error'](_0x4ed016);}logger[_0xb81b('0x19')](_0xb81b('0x3c'),_0x2ff440['split']('.')[0x0]);return _0x2ff440[_0xb81b('0x2e')]('.')[0x0];});};exports[_0xb81b('0x3d')]=function(_0x46e2ee,_0x29ca71){var _0x512a00=_0xb81b('0x3e');var _0x3e9893,_0x1d5443;var _0x5ac70c;var _0x38dfc4={'encoding':_0xb81b('0x3f'),'method':_0xb81b('0x40'),'timeout':0x2710,'url':_0x512a00,'headers':{'Content-Type':_0xb81b('0x41')},'body':_0xb81b('0x42')+encodeURIComponent(JSON[_0xb81b('0x43')]([[['jQ1olc',JSON['stringify']([_0x46e2ee,_0x29ca71||'en',![],_0xb81b('0x44')]),null,_0xb81b('0x45')]]]))};return rp(_0x38dfc4)[_0xb81b('0x2c')](function(_0x19ea4e){try{_0x5ac70c=eval(_0x19ea4e['slice'](0x5))[0x0][0x2];}catch(_0x116648){throw new Error(_0xb81b('0x46')+_0x19ea4e['data']);}if(!_0x5ac70c){if(_0x46e2ee[_0xb81b('0x47')]>0xc8){throw new Error(_0xb81b('0x48'));}else{throw new Error(_0xb81b('0x49')+_0x29ca71+_0xb81b('0x4a'));}}try{_0x5ac70c=eval(_0x5ac70c)[0x0];}catch(_0x571929){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xb81b('0x21')]);}const _0x3a68d7=_0x5ac70c;_0x3e9893=path[_0xb81b('0x26')](__dirname,_0xb81b('0x27'),rs[_0xb81b('0x28')](0x4)+_0xb81b('0x37'));fs[_0xb81b('0x2a')](_0x3e9893,_0x5ac70c,{'encoding':_0xb81b('0x2b')});_0x1d5443=path['resolve'](__dirname,_0xb81b('0x27'),rs[_0xb81b('0x28')](0x4)+_0xb81b('0x29'));return convertFile(_0x3e9893,_0x1d5443);})[_0xb81b('0x2c')](function(){try{fs[_0xb81b('0x1b')](_0x3e9893);fs[_0xb81b('0x3b')](_0x1d5443,_0xb81b('0x2d'));}catch(_0x32e04c){logger[_0xb81b('0x15')](_0x32e04c);}logger['info'](_0xb81b('0x4b'),_0x1d5443[_0xb81b('0x2e')]('.')[0x0]);return _0x1d5443[_0xb81b('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x52939e,_0x554e9c,_0x138772){return google[_0xb81b('0x4c')](_0x52939e,_0x554e9c,_0x138772)[_0xb81b('0x2c')](function(_0x3190d8){logger[_0xb81b('0x19')](_0x3190d8[_0xb81b('0x4d')]);return rp(_0x3190d8);})['then'](function(_0x34755d){var _0x394119='';var _0x140a3e=0x0;try{fs['unlink'](_0x52939e);}catch(_0x31f306){logger['error'](_0x31f306);}if(_0x34755d&&_0x34755d[_0xb81b('0x4e')]){_0x394119=_0x34755d['results'][_0xb81b('0x4f')](function(_0x1afd2c){return _0x1afd2c&&_0x1afd2c[_0xb81b('0x50')][0x0]&&_0x1afd2c[_0xb81b('0x50')][0x0][_0xb81b('0x51')]?_0x1afd2c['alternatives'][0x0]['transcript']:'';})[_0xb81b('0x52')]('\x0a');_0x140a3e=_0x34755d[_0xb81b('0x4e')][_0xb81b('0x4f')](function(_0x3976ab){return _0x3976ab&&_0x3976ab[_0xb81b('0x50')][0x0]&&_0x3976ab[_0xb81b('0x50')][0x0][_0xb81b('0x53')]?_0x3976ab[_0xb81b('0x50')][0x0][_0xb81b('0x53')]:0x0;})[_0xb81b('0x52')]('\x0a');}logger[_0xb81b('0x19')](_0xb81b('0x54'),_0x394119);logger[_0xb81b('0x19')]('googleASR\x20confidence',_0x140a3e);return{'transcript':_0x394119,'confidence':_0x140a3e};})[_0xb81b('0x55')](function(_0x2c2b52){logger[_0xb81b('0x15')](_0xb81b('0x56'),_0x2c2b52[_0xb81b('0x14')],_0x2c2b52[_0xb81b('0x57')],_0x2c2b52[_0xb81b('0x58')]);});};exports['googleDialogflow']=function(_0x14c0fd,_0x2a65d8,_0x4c54d7,_0x2b2150){var _0x2bc733=apiai(_0x2a65d8,{'language':_0x2b2150||'en'});return _0x2bc733[_0xb81b('0x59')](_0x4c54d7,{'sessionId':md5(_0x14c0fd)})['then'](function(_0x1e1ae5){logger[_0xb81b('0x19')](JSON[_0xb81b('0x43')](_0x1e1ae5));return{'source':_0x1e1ae5[_0xb81b('0x5a')]['source'],'resolvedQuery':_0x1e1ae5[_0xb81b('0x5a')][_0xb81b('0x5b')],'action':_0x1e1ae5[_0xb81b('0x5a')]['action'],'actionIncomplete':_0x1e1ae5[_0xb81b('0x5a')][_0xb81b('0x5c')],'speech':_0x1e1ae5[_0xb81b('0x5a')][_0xb81b('0x5d')][_0xb81b('0x5e')],'score':_0x1e1ae5['result']['score'],'statusCode':_0x1e1ae5[_0xb81b('0x5f')][_0xb81b('0x60')],'endConversation':_0x1e1ae5['result'][_0xb81b('0x61')][_0xb81b('0x62')]||![],'isFallbackIntent':_0x1e1ae5[_0xb81b('0x5a')][_0xb81b('0x61')][_0xb81b('0x63')]};});};exports[_0xb81b('0x64')]=function(_0x28e4a3,_0xf119c6,_0x390b4d,_0x130b21,_0x15599c,_0x5854ba){var _0x55c57c=_0x130b21[_0xb81b('0x65')](/\\n/g,'\x0a');var _0x11158b={'credentials':{'private_key':_0x55c57c,'client_email':_0x390b4d}};var _0x4dd7bd=new dialogflow[(_0xb81b('0x66'))](_0x11158b);var _0x1ff454=_0x4dd7bd['sessionPath'](_0xf119c6,md5(_0x28e4a3));var _0x41abc8={'session':_0x1ff454,'queryInput':{'text':{'text':_0x15599c,'languageCode':_0x5854ba}}};return _0x4dd7bd['detectIntent'](_0x41abc8)[_0xb81b('0x2c')](function(_0xe2ef6b){if(_0xe2ef6b&&_0xe2ef6b[_0xb81b('0x47')]){logger[_0xb81b('0x19')](_0xb81b('0x67'),JSON[_0xb81b('0x43')](_0xe2ef6b));var _0x190906=_0xe2ef6b[0x0];if(_0x190906){var _0xb50c1a={'action':_0x190906[_0xb81b('0x68')][_0xb81b('0x69')],'allRequiredParamsPresent':_0x190906[_0xb81b('0x68')]['allRequiredParamsPresent'],'endConversation':_0x190906[_0xb81b('0x68')]['diagnosticInfo']&&_0x190906['queryResult'][_0xb81b('0x6a')]['fields']?_0x190906[_0xb81b('0x68')][_0xb81b('0x6a')][_0xb81b('0x6b')]['end_conversation'][_0xb81b('0x6c')]:![],'fulfillmentText':_0x190906[_0xb81b('0x68')][_0xb81b('0x6d')],'intentName':_0x190906[_0xb81b('0x68')][_0xb81b('0x6e')][_0xb81b('0x57')],'intentDisplayName':_0x190906[_0xb81b('0x68')][_0xb81b('0x6e')][_0xb81b('0x6f')],'isFallbackIntent':_0x190906[_0xb81b('0x68')][_0xb81b('0x6e')]['isFallback'],'languageCode':_0x190906['queryResult'][_0xb81b('0x70')],'queryText':_0x190906[_0xb81b('0x68')][_0xb81b('0x71')],'responseId':_0x190906[_0xb81b('0x72')],'score':_0x190906['queryResult'][_0xb81b('0x73')],'speech':_0x190906[_0xb81b('0x68')]['fulfillmentText'],'providerResponse':JSON[_0xb81b('0x43')](_0xe2ef6b)};return _0xb50c1a;}}});};exports['tildeASR']=function(_0x32c1a7,_0x44fb27,_0x2a1234,_0x1a0a10){return tilde[_0xb81b('0x4c')](_0x32c1a7,_0x44fb27,_0x2a1234,_0x1a0a10)[_0xb81b('0x2c')](function(_0x59d99d){try{fs[_0xb81b('0x1b')](_0x32c1a7);}catch(_0x52aafb){logger[_0xb81b('0x15')](_0x52aafb);}logger['info'](_0xb81b('0x74'),_0x59d99d[_0xb81b('0x51')]);logger[_0xb81b('0x19')](_0xb81b('0x75'),_0x59d99d[_0xb81b('0x53')]);return _0x59d99d;});};exports[_0xb81b('0x76')]=function(_0x10a2f1,_0x5cf4da,_0x75af47,_0x6053b,_0x3c0648,_0x3e6a63){var _0x56fff5=path[_0xb81b('0x26')](__dirname,_0xb81b('0x27'),rs[_0xb81b('0x28')](0x4)+_0xb81b('0x37'));var _0x257943;return aws['polly'](_0x10a2f1,_0x5cf4da,_0x75af47,_0x6053b,_0x3c0648,_0x3e6a63,_0x56fff5)[_0xb81b('0x2c')](function(){_0x257943=path[_0xb81b('0x26')](__dirname,_0xb81b('0x27'),rs[_0xb81b('0x28')](0x4)+'.wav');return convertFile(_0x56fff5,_0x257943);})['then'](function(){try{fs['unlink'](_0x56fff5);fs[_0xb81b('0x3b')](_0x257943,_0xb81b('0x2d'));}catch(_0x423c23){logger[_0xb81b('0x15')](_0x423c23);}return _0x257943[_0xb81b('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x34ee35,_0x73cd3f,_0x29a5cf,_0x3e20ed,_0x47c1f8,_0x57d3c5){return aws['lex'](_0x34ee35,_0x73cd3f,_0x29a5cf,_0x3e20ed,_0x47c1f8,_0x57d3c5)[_0xb81b('0x2c')](function(_0x38760b){logger[_0xb81b('0x19')](JSON[_0xb81b('0x43')](_0x38760b));return _0x38760b;});};exports[_0xb81b('0x77')]=function(_0xb12541,_0x1b6626,_0x4d2458,_0x5c2c87){var _0x5ea073=util[_0xb81b('0x78')](_0xb81b('0x79'),ISPEECH_API,_0xb12541,encodeURIComponent(_0x1b6626),_0x4d2458,_0x5c2c87);var _0x44d86c=path[_0xb81b('0x26')](__dirname,_0xb81b('0x27'),rs['generate'](0x4)+_0xb81b('0x37'));var _0xa0e0ad;return downloadFile(_0x5ea073,_0x44d86c)[_0xb81b('0x2c')](function(){_0xa0e0ad=path['resolve'](__dirname,_0xb81b('0x27'),rs['generate'](0x4)+_0xb81b('0x29'));return convertFile(_0x44d86c,_0xa0e0ad);})[_0xb81b('0x2c')](function(){try{fs[_0xb81b('0x1b')](_0x44d86c);fs['chmodSync'](_0xa0e0ad,_0xb81b('0x2d'));}catch(_0x4e0fbf){logger[_0xb81b('0x15')](_0x4e0fbf);}return _0xa0e0ad[_0xb81b('0x2e')]('.')[0x0];});};exports[_0xb81b('0x7a')]=function(_0x2f4c6b,_0x22defe,_0x145d30,_0x21bb5e){var _0x28b530=util[_0xb81b('0x78')](_0xb81b('0x7b'),ISPEECH_API,_0x22defe,_0x145d30,base64Encode(_0x2f4c6b),_0x21bb5e?util['format'](_0xb81b('0x7c'),encodeURIComponent(_0x21bb5e)):_0xb81b('0x7d'));return uploadFile(_0x28b530)[_0xb81b('0x2c')](function(_0x2bb7b1){return querystring['parse'](_0x2bb7b1);});};exports[_0xb81b('0x7e')]=function(_0x4e3048,_0x1ed637){return sestek['nda'](_0x4e3048,_0x1ed637)[_0xb81b('0x2c')](function(_0x5329a9){logger[_0xb81b('0x19')](JSON['stringify'](_0x5329a9));var _0x39a289={'speech':_0x5329a9[_0xb81b('0x7f')],'action':_0x5329a9[_0xb81b('0x80')]?_0x5329a9[_0xb81b('0x80')][_0xb81b('0x81')]:undefined,'actiondata':_0x5329a9['channelData']?_0x5329a9[_0xb81b('0x80')][_0xb81b('0x82')]:undefined};if(_0x5329a9[_0xb81b('0x80')]&&_0x5329a9['channelData'][_0xb81b('0x83')]){return base64Decode(_0x5329a9[_0xb81b('0x80')][_0xb81b('0x83')][_0xb81b('0x84')],path[_0xb81b('0x26')](__dirname,'tmp',rs[_0xb81b('0x28')](0x4)+_0xb81b('0x29')))[_0xb81b('0x2c')](function(_0x1033d4){_0x39a289[_0xb81b('0x85')]=_0x1033d4;return _0x39a289;});}return _0x39a289;});};exports[_0xb81b('0x86')]=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 c1386d0..c669a4a 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 _0xbf0c=['./nda'];(function(_0x4970d6,_0x2e6b07){var _0x2857f3=function(_0x447128){while(--_0x447128){_0x4970d6['push'](_0x4970d6['shift']());}};_0x2857f3(++_0x2e6b07);}(_0xbf0c,0xc8));var _0xcbf0=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0xbf0c[_0x3825a8];return _0xabc9bc;};var nda=require(_0xcbf0('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xe9f2=['exports','./nda'];(function(_0x57ef11,_0x33a373){var _0x263629=function(_0x3a5284){while(--_0x3a5284){_0x57ef11['push'](_0x57ef11['shift']());}};_0x263629(++_0x33a373);}(_0xe9f2,0x14f));var _0x2e9f=function(_0x2593ff,_0x16157b){_0x2593ff=_0x2593ff-0x0;var _0x4c58a2=_0xe9f2[_0x2593ff];return _0x4c58a2;};var nda=require(_0x2e9f('0x0'));module[_0x2e9f('0x1')]={'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 988c660..5bb19a9 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 _0x8164=['CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','exports','resolve','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','text','project','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action'];(function(_0x1a04f4,_0x4c3e77){var _0x47e9bc=function(_0x250b00){while(--_0x250b00){_0x1a04f4['push'](_0x1a04f4['shift']());}};_0x47e9bc(++_0x4c3e77);}(_0x8164,0x170));var _0x4816=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x8164[_0x296897];return _0x2b44ab;};'use strict';var rp=require(_0x4816('0x0'));var url=require(_0x4816('0x1'));var logger=require(_0x4816('0x2'))('agi');module[_0x4816('0x3')]=function(_0x1e9b3f,_0x568058){var _0x109370={'method':'POST','uri':url[_0x4816('0x4')](_0x568058['ndauth_url'],'/token'),'form':{'grant_type':_0x4816('0x5'),'username':_0x568058['username'],'password':_0x568058['password']},'json':!![]};return rp(_0x109370)[_0x4816('0x6')](function(_0x437b8b){var _0x170e7a={'method':_0x4816('0x7'),'uri':url[_0x4816('0x4')](_0x568058[_0x4816('0x8')],_0x4816('0x9')),'body':{'type':_0x568058[_0x4816('0xa')]||_0x4816('0xb'),'channelId':'Nda','conversation':{'id':_0x1e9b3f[_0x4816('0xc')]},'from':{'id':_0x1e9b3f['callerid'],'name':_0x1e9b3f[_0x4816('0xd')]},'recipient':{'id':_0x1e9b3f[_0x4816('0xe')],'name':_0x1e9b3f['extension']},'text':_0x568058[_0x4816('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x437b8b['access_token']},'json':!![]};if(_0x568058[_0x4816('0x10')]){_0x170e7a['body']['channelData'][_0x4816('0x11')]=_0x568058['project'];}if(_0x568058[_0x4816('0x12')]=='1'){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4816('0x16')};}if(_0x568058[_0x4816('0x17')]){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x18')]=_0x568058[_0x4816('0x17')];if(_0x568058[_0x4816('0x19')]){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x1a')]=_0x568058[_0x4816('0x19')];}}logger[_0x4816('0x1b')](JSON['stringify'](_0x170e7a));return rp(_0x170e7a);});}; \ No newline at end of file +var _0xfc1e=['ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','agi','exports','resolve','ndauth_url','username','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData'];(function(_0x276232,_0x20b6b8){var _0x427024=function(_0x2e7ff8){while(--_0x2e7ff8){_0x276232['push'](_0x276232['shift']());}};_0x427024(++_0x20b6b8);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xfc1e[_0x44a64f];return _0x52024b;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0xefc1('0x0'));module[_0xefc1('0x1')]=function(_0x2a6255,_0x913595){var _0xbe8efc={'method':'POST','uri':url[_0xefc1('0x2')](_0x913595[_0xefc1('0x3')],'/token'),'form':{'grant_type':'password','username':_0x913595[_0xefc1('0x4')],'password':_0x913595[_0xefc1('0x5')]},'json':!![]};return rp(_0xbe8efc)[_0xefc1('0x6')](function(_0x3ff4a7){var _0x45bec4={'method':_0xefc1('0x7'),'uri':url[_0xefc1('0x2')](_0x913595[_0xefc1('0x8')],_0xefc1('0x9')),'body':{'type':_0x913595[_0xefc1('0xa')]||_0xefc1('0xb'),'channelId':'Nda','conversation':{'id':_0x2a6255[_0xefc1('0xc')]},'from':{'id':_0x2a6255[_0xefc1('0xd')],'name':_0x2a6255[_0xefc1('0xe')]},'recipient':{'id':_0x2a6255[_0xefc1('0xf')],'name':_0x2a6255[_0xefc1('0x10')]},'text':_0x913595[_0xefc1('0x11')],'channelData':{}},'headers':{'Authorization':_0xefc1('0x12')+_0x3ff4a7[_0xefc1('0x13')]},'json':!![]};if(_0x913595[_0xefc1('0x14')]){_0x45bec4[_0xefc1('0x15')][_0xefc1('0x16')]['ProjectName']=_0x913595[_0xefc1('0x14')];}if(_0x913595[_0xefc1('0x17')]=='1'){_0x45bec4[_0xefc1('0x15')][_0xefc1('0x16')][_0xefc1('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xefc1('0x19')};}if(_0x913595[_0xefc1('0x1a')]){_0x45bec4[_0xefc1('0x15')]['channelData'][_0xefc1('0x1b')]=_0x913595[_0xefc1('0x1a')];if(_0x913595[_0xefc1('0x1c')]){_0x45bec4['body'][_0xefc1('0x16')][_0xefc1('0x1d')]=_0x913595[_0xefc1('0x1c')];}}logger[_0xefc1('0x1e')](JSON[_0xefc1('0x1f')](_0x45bec4));return rp(_0x45bec4);});}; \ 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 c3ba7ff..54dbd24 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 _0x8382=['exports','./lib/api'];(function(_0x577032,_0x23e546){var _0x491213=function(_0x34a2c4){while(--_0x34a2c4){_0x577032['push'](_0x577032['shift']());}};_0x491213(++_0x23e546);}(_0x8382,0x14b));var _0x2838=function(_0x1466cf,_0xe9746){_0x1466cf=_0x1466cf-0x0;var _0x152b24=_0x8382[_0x1466cf];return _0x152b24;};'use strict';var asr=require(_0x2838('0x0'));module[_0x2838('0x1')]=function(_0x462ac1,_0x577fd0,_0x2b899,_0x452300){return asr(_0x462ac1,_0x577fd0,_0x2b899,_0x452300);}; \ No newline at end of file +var _0x5904=['exports','./lib/api'];(function(_0x412686,_0x3fde24){var _0x18619e=function(_0x862bd1){while(--_0x862bd1){_0x412686['push'](_0x412686['shift']());}};_0x18619e(++_0x3fde24);}(_0x5904,0xff));var _0x4590=function(_0x2c60f9,_0x1e47e3){_0x2c60f9=_0x2c60f9-0x0;var _0x17becc=_0x5904[_0x2c60f9];return _0x17becc;};'use strict';var asr=require(_0x4590('0x0'));module[_0x4590('0x1')]=function(_0x33a67e,_0x4b1618,_0x5a4f53,_0x5a99de){return asr(_0x33a67e,_0x4b1618,_0x5a4f53,_0x5a99de);}; \ 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 19b20ed..75e55c3 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 _0x7d88=['Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','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','close','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','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','createHash','sha1','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final'];(function(_0x4a6462,_0x61b1b5){var _0x122407=function(_0x42618b){while(--_0x42618b){_0x4a6462['push'](_0x4a6462['shift']());}};_0x122407(++_0x61b1b5);}(_0x7d88,0x15f));var _0x87d8=function(_0x1855b9,_0x395007){_0x1855b9=_0x1855b9-0x0;var _0x4f742f=_0x7d88[_0x1855b9];return _0x4f742f;};'use strict';var BPromise=require('bluebird');var _=require(_0x87d8('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x87d8('0x1'));var crypto=require(_0x87d8('0x2'));var logger=require(_0x87d8('0x3'))(_0x87d8('0x4'));module[_0x87d8('0x5')]=function(_0x239392,_0x445400,_0x34ca6f,_0x26cc01){return new BPromise(function(_0x2abff7,_0x5e0c27){logger['info'](_0x87d8('0x6'),_0x26cc01||_0x87d8('0x7'));var _0x421581=new WebSocket(_0x26cc01||_0x87d8('0x7'),{'perMessageDeflate':![]});var _0x31a382='';var _0x366d98='0';var _0x7e4dc='1';var _0x3d85c3=_0x87d8('0x8');function _0x3d3b8f(_0x190eef){var _0x227625=crypto[_0x87d8('0x9')](_0x87d8('0xa'));_0x227625['update'](_0x190eef);return _0x227625[_0x87d8('0xb')](_0x87d8('0xc'));}function _0xc36696(){try{logger[_0x87d8('0xd')](_0x87d8('0xe'));var _0xf5617=moment()[_0x87d8('0xf')]();var _0x26a560=_0x3d3b8f(_0xf5617+_0x445400+_0x34ca6f);_0x421581[_0x87d8('0x10')](JSON[_0x87d8('0x11')]({'appID':_0x445400,'timestamp':_0xf5617,'appKey':_0x26a560}));var _0x66af46=fs[_0x87d8('0x12')](_0x239392);_0x66af46['on'](_0x87d8('0x13'),function(_0x5f51d1){_0x421581[_0x87d8('0x10')](_0x5f51d1);});_0x66af46['on']('close',function(){_0x421581[_0x87d8('0x10')](_0x87d8('0x14'));});}catch(_0x498ce7){logger[_0x87d8('0x15')](_0x87d8('0x16'),JSON[_0x87d8('0x11')](_0x498ce7));_0x421581['terminate']();}}function _0x50a5f6(_0x2b791d){try{if(_0x2b791d){var _0x4b0cb8=JSON[_0x87d8('0x17')](_0x2b791d);switch(_0x4b0cb8[_0x87d8('0x18')]){case 0x0:if(_0x4b0cb8[_0x87d8('0x19')]){if(_0x4b0cb8[_0x87d8('0x19')][_0x87d8('0x1a')]){logger['info'](_0x87d8('0x1b'),JSON[_0x87d8('0x11')](_0x4b0cb8[_0x87d8('0x19')][_0x87d8('0x1c')]));_0x31a382=_0x4b0cb8[_0x87d8('0x19')]['hypotheses'][0x0][_0x87d8('0x1d')];_0x366d98=_0x4b0cb8[_0x87d8('0x19')][_0x87d8('0x1c')][0x0]['likelihood'];_0x7e4dc='0';_0x3d85c3=_0x87d8('0x1e');_0x421581[_0x87d8('0x1f')]();}}break;case 0x1:logger['info'](_0x87d8('0x8'));_0x7e4dc='1';_0x3d85c3=_0x87d8('0x8');break;case 0x2:logger['info'](_0x87d8('0x20'));_0x7e4dc='2';_0x3d85c3='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x87d8('0xd')](_0x87d8('0x21'));_0x7e4dc='9';_0x3d85c3=_0x87d8('0x21');break;case 0xa:logger[_0x87d8('0xd')]('Authentication\x20failed.');_0x7e4dc='10';_0x3d85c3='Authentication\x20failed.';break;case 0xb:logger[_0x87d8('0xd')](_0x87d8('0x22'));_0x7e4dc='11';_0x3d85c3='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4a50b0){logger[_0x87d8('0x15')](_0x87d8('0x23'),JSON['stringify'](_0x4a50b0));_0x421581[_0x87d8('0x1f')]();}}function _0x4d1f3e(){logger['info'](_0x87d8('0x24'));_0x2abff7({'transcript':_0x31a382,'confidence':_0x366d98,'status':_0x7e4dc,'status_message':_0x3d85c3});}function _0x341326(_0x43d63f){logger[_0x87d8('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x87d8('0x25')](_0x43d63f)){logger[_0x87d8('0x15')](_[_0x87d8('0x26')](_0x43d63f)?JSON[_0x87d8('0x11')](_0x43d63f):_0x43d63f);}}_0x421581['on'](_0x87d8('0x27'),_0xc36696);_0x421581['on'](_0x87d8('0x28'),_0x50a5f6);_0x421581['on'](_0x87d8('0x29'),_0x4d1f3e);_0x421581['on'](_0x87d8('0x15'),_0x341326);});}; \ No newline at end of file +var _0x608c=['moment','crypto','../../../../../../config/logger','agi','exports','info','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','hypotheses','likelihood','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x608c,0x1a1));var _0xc608=function(_0x26ebfb,_0x302a63){_0x26ebfb=_0x26ebfb-0x0;var _0x3b27e4=_0x608c[_0x26ebfb];return _0x3b27e4;};'use strict';var BPromise=require(_0xc608('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc608('0x1'));var crypto=require(_0xc608('0x2'));var logger=require(_0xc608('0x3'))(_0xc608('0x4'));module[_0xc608('0x5')]=function(_0x2ff32e,_0x124682,_0x3a7fc1,_0xb77bf5){return new BPromise(function(_0x3e04fc,_0x3bba49){logger[_0xc608('0x6')]('Tilde\x20URI',_0xb77bf5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x320ff6=new WebSocket(_0xb77bf5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1f39dc='';var _0x300486='0';var _0x34c41f='1';var _0x10736a=_0xc608('0x7');function _0x347c43(_0x396a1e){var _0x199973=crypto[_0xc608('0x8')](_0xc608('0x9'));_0x199973[_0xc608('0xa')](_0x396a1e);return _0x199973[_0xc608('0xb')](_0xc608('0xc'));}function _0x4c99dc(){try{logger[_0xc608('0x6')](_0xc608('0xd'));var _0xc6d41e=moment()[_0xc608('0xe')]();var _0x46e153=_0x347c43(_0xc6d41e+_0x124682+_0x3a7fc1);_0x320ff6[_0xc608('0xf')](JSON[_0xc608('0x10')]({'appID':_0x124682,'timestamp':_0xc6d41e,'appKey':_0x46e153}));var _0x4c77bf=fs[_0xc608('0x11')](_0x2ff32e);_0x4c77bf['on'](_0xc608('0x12'),function(_0x4a545d){_0x320ff6[_0xc608('0xf')](_0x4a545d);});_0x4c77bf['on']('close',function(){_0x320ff6[_0xc608('0xf')](_0xc608('0x13'));});}catch(_0x2f1a05){logger['error'](_0xc608('0x14'),JSON[_0xc608('0x10')](_0x2f1a05));_0x320ff6[_0xc608('0x15')]();}}function _0x566bd3(_0x349d65){try{if(_0x349d65){var _0x2d4a42=JSON[_0xc608('0x16')](_0x349d65);switch(_0x2d4a42[_0xc608('0x17')]){case 0x0:if(_0x2d4a42[_0xc608('0x18')]){if(_0x2d4a42[_0xc608('0x18')]['final']){logger[_0xc608('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x2d4a42[_0xc608('0x18')][_0xc608('0x19')]));_0x1f39dc=_0x2d4a42['result'][_0xc608('0x19')][0x0]['transcript'];_0x300486=_0x2d4a42['result'][_0xc608('0x19')][0x0][_0xc608('0x1a')];_0x34c41f='0';_0x10736a='Success.';_0x320ff6[_0xc608('0x15')]();}}break;case 0x1:logger[_0xc608('0x6')](_0xc608('0x7'));_0x34c41f='1';_0x10736a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xc608('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x34c41f='2';_0x10736a=_0xc608('0x1b');break;case 0x9:logger[_0xc608('0x6')](_0xc608('0x1c'));_0x34c41f='9';_0x10736a=_0xc608('0x1c');break;case 0xa:logger[_0xc608('0x6')]('Authentication\x20failed.');_0x34c41f='10';_0x10736a=_0xc608('0x1d');break;case 0xb:logger[_0xc608('0x6')](_0xc608('0x1e'));_0x34c41f='11';_0x10736a=_0xc608('0x1e');}}}catch(_0x35b74c){logger[_0xc608('0x1f')](_0xc608('0x20'),JSON[_0xc608('0x10')](_0x35b74c));_0x320ff6['terminate']();}}function _0xfd6ba2(){logger[_0xc608('0x6')](_0xc608('0x21'));_0x3e04fc({'transcript':_0x1f39dc,'confidence':_0x300486,'status':_0x34c41f,'status_message':_0x10736a});}function _0x3993c6(_0x40b900){logger[_0xc608('0x1f')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xc608('0x22')](_0x40b900)){logger[_0xc608('0x1f')](_[_0xc608('0x23')](_0x40b900)?JSON[_0xc608('0x10')](_0x40b900):_0x40b900);}}_0x320ff6['on'](_0xc608('0x24'),_0x4c99dc);_0x320ff6['on']('message',_0x566bd3);_0x320ff6['on'](_0xc608('0x25'),_0xfd6ba2);_0x320ff6['on'](_0xc608('0x1f'),_0x3993c6);});}; \ 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 ad692f8..13a190a 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 _0xf468=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf468,0x1b3));var _0x8f46=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xf468[_0x34bf97];return _0x292719;};var asr=require(_0x8f46('0x0'));module[_0x8f46('0x1')]={'asr':asr}; \ No newline at end of file +var _0xce6c=['exports'];(function(_0x4395ba,_0x26d822){var _0x4515fb=function(_0x3df52b){while(--_0x3df52b){_0x4395ba['push'](_0x4395ba['shift']());}};_0x4515fb(++_0x26d822);}(_0xce6c,0x13e));var _0xcce6=function(_0x24831e,_0x481a96){_0x24831e=_0x24831e-0x0;var _0x4de76d=_0xce6c[_0x24831e];return _0x4de76d;};var asr=require('./asr');module[_0xcce6('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 90c0e76..a0c926f 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(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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 a7c6ce4..64ae2bc 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 _0x3f72=['generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','%s/recordings/%s','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','wav','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','context','extension','priority','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','.wav','login','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','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','join','exports','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','catch','getVoiceQueue','prototype','getSquareProject','getSquareOdbc','getSquareOdbcById','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','body','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','agicommand','clone','isString','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','format','%s.%s','setVariable','replaceObjectAllVariables','split','extra','length','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','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','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','bot','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit'];(function(_0x799107,_0x3ae144){var _0x529fa4=function(_0x2c8784){while(--_0x2c8784){_0x799107['push'](_0x799107['shift']());}};_0x529fa4(++_0x3ae144);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var util=require(_0x23f7('0x0'));var _=require(_0x23f7('0x1'));var sh=require(_0x23f7('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x23f7('0x3'));var Mustache=require(_0x23f7('0x4'));var rp=require(_0x23f7('0x5'));var logger=require(_0x23f7('0x6'))(_0x23f7('0x7'));var config=require('../../config/environment');var shared=require(_0x23f7('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x23f7('0x9');var recursiveMapAttributes=['rawHeaders',_0x23f7('0xa')];var verticesWithRetry=[_0x23f7('0xb'),_0x23f7('0xc'),_0x23f7('0xd')];var AGIVertices=function(_0xccd3c0,_0x1cdd69,_0x3a048c){this[_0x23f7('0xe')]=_0xccd3c0;this[_0x23f7('0xf')]=_0x1cdd69;this[_0x23f7('0x10')]=_0x3a048c;};AGIVertices['prototype'][_0x23f7('0x11')]=function(_0xdaa6e1,_0x4173f1){this['rpc']['getVariableById'](_0xdaa6e1)[_0x23f7('0x12')](function(_0x401ced){_0x4173f1(null,_0x401ced?_0x401ced[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x37510b){_0x4173f1(_0x37510b);});};AGIVertices['prototype'][_0x23f7('0x15')]=function(_0x462af4,_0x2dc34c){this[_0x23f7('0xf')]['getVoiceQueueById'](_0x462af4)[_0x23f7('0x12')](function(_0x434484){_0x2dc34c(null,_0x434484?_0x434484[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x15a35d){_0x2dc34c(_0x15a35d);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x17')]=function(_0x4f7348,_0x2669ab){this[_0x23f7('0xf')]['getSquareProjectById'](_0x4f7348)['then'](function(_0x10d8d2){_0x2669ab(null,_0x10d8d2?_0x10d8d2[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x38bccd){_0x2669ab(_0x38bccd);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x18')]=function(_0x3748bb,_0xaa3b7d){this['rpc'][_0x23f7('0x19')](_0x3748bb)[_0x23f7('0x12')](function(_0x1811bf){_0xaa3b7d(null,_0x1811bf?_0x1811bf['dsn']:![]);})['catch'](function(_0xfc8726){_0xaa3b7d(_0xfc8726);});};AGIVertices['prototype']['getUser']=function(_0x1f82d4,_0x34a5e4){this['rpc'][_0x23f7('0x1a')](_0x1f82d4)[_0x23f7('0x12')](function(_0x59260b){_0x34a5e4(null,_0x59260b?_0x59260b[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x3ebc73){_0x34a5e4(_0x3ebc73);});};AGIVertices['prototype']['getTrunk']=function(_0x2f84c3,_0x12b007){this[_0x23f7('0xf')]['getTrunkById'](_0x2f84c3)[_0x23f7('0x12')](function(_0x52a823){_0x12b007(null,_0x52a823?_0x52a823[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x57d6e6){_0x12b007(_0x57d6e6);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b')]=function(_0x3a4796,_0x3a980e){var _0xf1fa9f=this;this['rpc'][_0x23f7('0x1c')](_0x3a4796)[_0x23f7('0x12')](function(_0x310fa8){_0x3a980e(null,_0x310fa8?_0xf1fa9f[_0x23f7('0x1d')](_0x310fa8[_0x23f7('0x1e')]):![]);})[_0x23f7('0x14')](function(_0x77d50f){_0x3a980e(_0x77d50f);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1f')]=function(_0x3897b3,_0xf0da88){this[_0x23f7('0xf')]['getMailAccountById'](_0x3897b3)[_0x23f7('0x12')](function(_0x1d4754){_0xf0da88(null,_0x1d4754?_0x1d4754:![]);})[_0x23f7('0x14')](function(_0x519705){_0xf0da88(_0x519705);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x20')]=function(_0x2f8a2c,_0xff5c15,_0x301818){this[_0x23f7('0x10')]['sendMailMessage'](_0x2f8a2c,_0xff5c15)[_0x23f7('0x12')](function(){_0x301818(null);})[_0x23f7('0x14')](function(_0xce1783){_0x301818(_0xce1783);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x21')]=function(_0x61d3e5,_0x3bfb07){this[_0x23f7('0xf')]['getIntervalById'](_0x61d3e5)[_0x23f7('0x12')](function(_0x2a702f){if(_0x2a702f){if(_0x2a702f[_0x23f7('0x22')]){_0x3bfb07(null,[_0x2a702f[_0x23f7('0x23')]]);}else{_0x3bfb07(null,_['map'](_0x2a702f['Intervals'],_0x23f7('0x23')));}}else{_0x3bfb07(null,![]);}})['catch'](function(_0x310cb0){_0x3bfb07(_0x310cb0);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1d')]=function(_0xf1b093){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0xf1b093);};AGIVertices[_0x23f7('0x16')]['getQueryOdbc']=function(_0x5f2924,_0x3cc50a,_0x3bb396){odbc[_0x23f7('0x24')](_0x5f2924,function(_0x123c49){if(_0x123c49){logger[_0x23f7('0x25')](_0x23f7('0x26'),_0x123c49);_0x3bb396(_0x123c49);}else{logger[_0x23f7('0x27')](_0x23f7('0x28'));odbc['query'](_0x3cc50a,function(_0x2cbbac,_0x399a04){if(_0x2cbbac){logger[_0x23f7('0x27')](_0x23f7('0x29'),_0x3cc50a);_0x3bb396(_0x2cbbac);}else{logger[_0x23f7('0x27')](_0x23f7('0x2a'),_0x3cc50a);odbc['close'](function(_0x580fc4){if(_0x580fc4){logger[_0x23f7('0x25')](_0x23f7('0x2b'),_0x580fc4);}_0x3bb396(null,_0x399a04);});}});}});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x2c')]=function(_0x1eeedf,_0xfd3c7){this['rpc'][_0x23f7('0x2d')](_0x1eeedf)[_0x23f7('0x12')](function(_0x38e18c){_0xfd3c7(null,_0x38e18c?_0x38e18c:![]);})[_0x23f7('0x14')](function(_0x3f46be){_0xfd3c7(_0x3f46be);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x2e')]=function(_0x3725d2,_0x5d0e99){this['rpc']['createSmsMessage'](_0x3725d2)[_0x23f7('0x12')](function(_0x9c5615){_0x5d0e99(null,_0x9c5615);})[_0x23f7('0x14')](function(_0x36ce93){_0x5d0e99(_0x36ce93);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x2f')]=function(_0x4092b3,_0x5809c2,_0x192cfb){this[_0x23f7('0xf')][_0x23f7('0x2f')]({'uniqueid':this[_0x23f7('0xe')][_0x23f7('0x30')],'node':_0x4092b3[_0x23f7('0x31')],'application':_0x4092b3['agicommand'],'data':_0x5809c2||null,'project_name':this[_0x23f7('0xe')][_0x23f7('0x32')],'callerid':this['channel'][_0x23f7('0x33')]})[_0x23f7('0x12')](function(_0x22bcd7){if(_0x192cfb){_0x192cfb(null,_0x22bcd7);}})[_0x23f7('0x14')](function(_0x5369d1){if(_0x192cfb){_0x192cfb(_0x5369d1);}});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x34')]=function(_0x4243ce,_0x1828a2,_0x36cec6,_0x4efaa2){this[_0x23f7('0xf')][_0x23f7('0x34')]({'uniqueid':this[_0x23f7('0xe')][_0x23f7('0x30')],'callerid':this['channel'][_0x23f7('0x33')],'calleridname':this[_0x23f7('0xe')]['calleridname'],'context':this[_0x23f7('0xe')]['context'],'extension':this[_0x23f7('0xe')]['extension'],'priority':this[_0x23f7('0xe')]['priority'],'accountcode':this[_0x23f7('0xe')][_0x23f7('0x35')],'dnid':this[_0x23f7('0xe')][_0x23f7('0x36')],'projectName':this[_0x23f7('0xe')]['arg_1'],'saveName':_0x1828a2,'filename':_0x4243ce[_0x23f7('0x37')]||_0x1828a2,'savePath':_0x36cec6})[_0x23f7('0x12')](function(_0x3a73a6){_0x4efaa2(null,_0x3a73a6);})['catch'](function(_0x37ae3b){_0x4efaa2(_0x37ae3b);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x38')]=function(_0x20b2d9,_0x334d61,_0xbb6418,_0x29152c,_0x5907e6){this[_0x23f7('0xf')][_0x23f7('0x38')]({'uniqueid':this[_0x23f7('0xe')]['uniqueid'],'body':_0x20b2d9,'direction':_0x334d61,'providerName':_0xbb6418,'providerResponse':_0x29152c})[_0x23f7('0x12')](function(_0x26578f){if(_0x5907e6){_0x5907e6(null,_0x26578f);}})[_0x23f7('0x14')](function(_0x2216e6){if(_0x5907e6){_0x5907e6(_0x2216e6);}});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x39')]=function(_0x1d888,_0x3c3f7e){this[_0x23f7('0xf')][_0x23f7('0x39')]({'firstName':_[_0x23f7('0x3a')](_0x1d888[_0x23f7('0x13')])||_['isNil'](_0x1d888[_0x23f7('0x13')])?'callback_'+Math['random']():_0x1d888[_0x23f7('0x13')],'lastName':_[_0x23f7('0x3a')](_0x1d888[_0x23f7('0x3b')])||_['isNil'](_0x1d888[_0x23f7('0x3b')])?null:_0x1d888[_0x23f7('0x3b')],'phone':_0x1d888[_0x23f7('0x3c')],'ListId':_0x1d888[_0x23f7('0x3d')],'scheduledat':_0x1d888[_0x23f7('0x3e')],'callbackUniqueid':this['channel'][_0x23f7('0x30')],'tags':_0x23f7('0x3f'),'description':_0x23f7('0x40')+_0x1d888[_0x23f7('0x3e')][_0x23f7('0x41')](),'priority':_0x1d888[_0x23f7('0x42')]})[_0x23f7('0x12')](function(_0xcdbf6){_0x3c3f7e(null,_0xcdbf6);})[_0x23f7('0x14')](function(_0x50a3c6){_0x3c3f7e(_0x50a3c6);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x43')]=function(_0x5e2521,_0x182f9b){this[_0x23f7('0xf')][_0x23f7('0x44')](_0x5e2521)[_0x23f7('0x12')](function(_0x4d0e9f){_0x182f9b(null,_0x4d0e9f?_0x4d0e9f[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x11273b){_0x182f9b(_0x11273b);});};AGIVertices['prototype'][_0x23f7('0x45')]=function(_0x24324b,_0x5b4ab3,_0x219d29){var _0x25ad9={'role':_0x23f7('0x46')};_0x25ad9[_0x24324b]=this[_0x23f7('0xe')][_0x23f7('0x33')];this[_0x23f7('0xf')]['agentPause'](_0x25ad9,_0x5b4ab3,this[_0x23f7('0xe')][_0x23f7('0x30')])[_0x23f7('0x12')](function(_0x169b6b){_0x219d29(null,_[_0x23f7('0x47')](_0x169b6b)?![]:!![]);})[_0x23f7('0x14')](function(_0x171f8e){logger[_0x23f7('0x25')](_0x171f8e);_0x219d29(null,![]);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x48')]=function(_0x51730e,_0x423591){var _0x37887d={'role':_0x23f7('0x46')};_0x37887d[_0x51730e]=this[_0x23f7('0xe')][_0x23f7('0x33')];this[_0x23f7('0xf')][_0x23f7('0x48')](_0x37887d)[_0x23f7('0x12')](function(_0x100b42){_0x423591(null,_[_0x23f7('0x47')](_0x100b42)?![]:!![]);})[_0x23f7('0x14')](function(_0x3b4243){logger[_0x23f7('0x25')](_0x3b4243);_0x423591(null,![]);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x49')]=function(_0x2597ed,_0x32f430){var _0x16ae16={'role':_0x23f7('0x46')};_0x16ae16[_0x2597ed]=this[_0x23f7('0xe')][_0x23f7('0x33')];this[_0x23f7('0xf')][_0x23f7('0x49')](_0x16ae16)[_0x23f7('0x12')](function(_0x4e0d4e){_0x32f430(null,_[_0x23f7('0x47')](_0x4e0d4e)?![]:!![]);})[_0x23f7('0x14')](function(_0x2091f9){logger['error'](_0x2091f9);_0x32f430(null,![]);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x4a')]=function(_0x5b5b3b,_0x41b06d){var _0x5e5a84={'role':_0x23f7('0x46')};_0x5e5a84[_0x5b5b3b]=this[_0x23f7('0xe')][_0x23f7('0x33')];var _0x4e32eb=_0x5b5b3b!='internal'?util['format'](_0x23f7('0x4b'),_0x23f7('0x4c'),this[_0x23f7('0xe')][_0x23f7('0x33')]):undefined;this[_0x23f7('0xf')][_0x23f7('0x4a')](_0x5e5a84,_0x4e32eb)[_0x23f7('0x12')](function(_0x4267ed){_0x41b06d(null,_[_0x23f7('0x47')](_0x4267ed)?![]:!![]);})['catch'](function(_0x20387b){logger[_0x23f7('0x25')](_0x20387b);_0x41b06d(null,![]);});};AGIVertices['prototype'][_0x23f7('0x4d')]=function(_0x4f19cd,_0xa92775){sh['exec'](_[_0x23f7('0x4e')](_0x4f19cd),function(_0x3cd86f,_0x518352){var _0x2c9e98=_0x518352[_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'');_0xa92775(null,_0x2c9e98);});};AGIVertices[_0x23f7('0x16')]['googleCloudTTS']=function(_0x211d5e,_0x295104){scripts['googleCloudTTS'](_0x211d5e[_0x23f7('0x50')],_0x211d5e['google_cloud_tts_text_type']||_0x23f7('0x51'),_0x211d5e[_0x23f7('0x51')],_0x211d5e[_0x23f7('0x52')]||_0x23f7('0x53'),_0x211d5e[_0x23f7('0x54')]||_0x23f7('0x55'),_0x211d5e[_0x23f7('0x56')]||_0x23f7('0x57'))[_0x23f7('0x12')](function(_0x64b14e){_0x295104(null,_0x64b14e);})['catch'](function(_0x552018){_0x295104(_0x552018);});};AGIVertices[_0x23f7('0x16')]['googleTTS']=function(_0x3b1a18,_0xcab543){scripts[_0x23f7('0x58')](_0x3b1a18[_0x23f7('0x51')],_0x3b1a18[_0x23f7('0x59')]||'en',0x1)[_0x23f7('0x12')](function(_0xe30b31){_0xcab543(null,_0xe30b31);})[_0x23f7('0x14')](function(_0x5ae763){_0xcab543(_0x5ae763);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x5a')]=function(_0x81626e,_0x4bca58){var _0x31fd8d={'uri':_0x81626e[_0x23f7('0x5b')],'method':_0x81626e[_0x23f7('0x5c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x81626e['timeout'])===_0x23f7('0x5d')&&parseInt(_0x81626e[_0x23f7('0x5e')])>=0x1?parseInt(_0x81626e['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x23f7('0x5f')]([_0x23f7('0x60'),_0x23f7('0x61')],_0x31fd8d['method'][_0x23f7('0x62')]())){try{_0x31fd8d['body']=_0x81626e[_0x23f7('0xa')]?JSON[_0x23f7('0x63')](_0x81626e[_0x23f7('0xa')]):{};}catch(_0x5b2209){logger[_0x23f7('0x25')](_0x23f7('0x64'),_0x5b2209);}}try{_0x31fd8d[_0x23f7('0x65')]=_0x81626e[_0x23f7('0x66')]?JSON[_0x23f7('0x63')](_0x81626e[_0x23f7('0x66')]):{};}catch(_0x1b5d40){logger[_0x23f7('0x25')](_0x23f7('0x67'),_0x1b5d40);}if(_0x81626e[_0x23f7('0x68')]){try{var _0x2535e9=require(_0x81626e[_0x23f7('0x68')])[_0x23f7('0x69')](this,_0x31fd8d);_0x31fd8d['uri']=Mustache['render'](_0x81626e['url'],_0x2535e9,{},['$$','$$']);if(_0x31fd8d[_0x23f7('0x65')]){_0x31fd8d['headers']=JSON[_0x23f7('0x63')](Mustache[_0x23f7('0x6a')](JSON[_0x23f7('0x6b')](_0x31fd8d[_0x23f7('0x65')]),_0x2535e9,{},['$$','$$']));}if(_0x31fd8d[_0x23f7('0x6c')]){_0x31fd8d['body']=JSON[_0x23f7('0x63')](Mustache[_0x23f7('0x6a')](JSON['stringify'](_0x31fd8d[_0x23f7('0x6c')]),_0x2535e9,{},['$$','$$']));}}catch(_0x445a55){logger[_0x23f7('0x25')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x445a55);}}rp(_0x31fd8d)[_0x23f7('0x12')](function(_0xd0fdd1){var _0x52395f={'statusCode':_0xd0fdd1['statusCode']||0xc8,'statusMessage':_0xd0fdd1[_0x23f7('0x6d')]||'OK','headers':_0xd0fdd1[_0x23f7('0x65')]||{},'body':_0xd0fdd1[_0x23f7('0x6c')]||{}};_0x4bca58(null,_0x52395f);})['catch'](function(_0x4eeaf2){var _0x18910d={'statusCode':_0x4eeaf2['statusCode']||0x1f4,'statusMessage':_0x4eeaf2[_0x23f7('0x6e')]||_0x23f7('0x6f'),'headers':_0x4eeaf2[_0x23f7('0x70')][_0x23f7('0x65')]||{},'body':_0x4eeaf2[_0x23f7('0x70')]['body']||{}};_0x4bca58(null,_0x18910d);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x71')]=function(_0x1b4055,_0x6074d9){scripts[_0x23f7('0x71')](this[_0x23f7('0xe')][_0x23f7('0x30')],_0x1b4055[_0x23f7('0x72')],_0x1b4055[_0x23f7('0x51')],_0x1b4055[_0x23f7('0x73')]||'en')[_0x23f7('0x12')](function(_0x55bc4d){_0x6074d9(null,_0x55bc4d);})[_0x23f7('0x14')](function(_0x1f82a0){_0x6074d9(_0x1f82a0);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x74')]=function(_0x321265,_0x504c55){scripts[_0x23f7('0x74')](this['channel'][_0x23f7('0x30')],_0x321265[_0x23f7('0x75')],_0x321265[_0x23f7('0x76')],_0x321265['private_key'],_0x321265[_0x23f7('0x51')],_0x321265[_0x23f7('0x77')]||'en')[_0x23f7('0x12')](function(_0x21a565){_0x504c55(null,_0x21a565);})[_0x23f7('0x14')](function(_0x30625e){_0x504c55(_0x30625e);});};AGIVertices['prototype']['sestekNDA']=function(_0x31eb3e,_0xe5ce11){scripts[_0x23f7('0x78')](this[_0x23f7('0xe')],_0x31eb3e)['then'](function(_0x4bbdc1){_0xe5ce11(null,_0x4bbdc1);})[_0x23f7('0x14')](function(_0x5e3d82){_0xe5ce11(_0x5e3d82);});};AGIVertices['prototype'][_0x23f7('0x79')]=function(_0x4a988b,_0x30c574){scripts[_0x23f7('0x79')](_0x4a988b[_0x23f7('0x72')],_0x4a988b[_0x23f7('0x51')],_0x4a988b[_0x23f7('0x7a')]||_0x23f7('0x53'),_0x4a988b['speed'])[_0x23f7('0x12')](function(_0x36f664){_0x30c574(null,_0x36f664);})[_0x23f7('0x14')](function(_0x4f2d4d){_0x30c574(_0x4f2d4d);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x7b')]=function(_0x29759f,_0x13c224,_0x418c73){scripts[_0x23f7('0x7b')](_0x13c224,_0x29759f['key'],_0x29759f[_0x23f7('0x7c')]||_0x23f7('0x53'),this['isConfigured'](_0x29759f[_0x23f7('0x7d')])?_0x29759f[_0x23f7('0x7d')]:undefined)[_0x23f7('0x12')](function(_0x573a20){_0x418c73(null,_0x573a20);})[_0x23f7('0x14')](function(_0x10ff78){_0x418c73(_0x10ff78);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x7e')]=function(_0x15d8ff,_0x113edf){scripts[_0x23f7('0x7e')](_0x15d8ff[_0x23f7('0x7f')],_0x15d8ff[_0x23f7('0x80')],_0x15d8ff[_0x23f7('0x81')],_0x15d8ff[_0x23f7('0x82')]||_0x23f7('0x83'),_0x15d8ff['text'],_0x15d8ff[_0x23f7('0x84')]||_0x23f7('0x51'))['then'](function(_0x191dbf){_0x113edf(null,_0x191dbf);})['catch'](function(_0x558152){_0x113edf(_0x558152);});};AGIVertices['prototype'][_0x23f7('0x85')]=function(_0xa159da,_0x2eaa0e){scripts[_0x23f7('0x85')](this['channel'][_0x23f7('0x30')],_0xa159da[_0x23f7('0x7f')],_0xa159da['aws_secret_access_key'],_0xa159da[_0x23f7('0x86')],_0xa159da[_0x23f7('0x51')],_0xa159da[_0x23f7('0x87')])[_0x23f7('0x12')](function(_0x3580eb){_0x2eaa0e(null,_0x3580eb);})[_0x23f7('0x14')](function(_0xfc46b5){_0x2eaa0e(_0xfc46b5);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x88')]=function(_0x40daa7,_0x435ffe,_0x3e8519){scripts[_0x23f7('0x88')](_0x435ffe,_0x40daa7[_0x23f7('0x72')],_0x40daa7[_0x23f7('0x89')]||'en-US')[_0x23f7('0x12')](function(_0x3414fe){_0x3e8519(null,_0x3414fe);})[_0x23f7('0x14')](function(_0x41f0f3){_0x3e8519(_0x41f0f3);});};AGIVertices['prototype'][_0x23f7('0x8a')]=function(_0x4f1426,_0x1422fb,_0x4c5293){scripts[_0x23f7('0x8a')](_0x1422fb,_0x4f1426['appid'],_0x4f1426[_0x23f7('0x8b')],_0x4f1426['uri'])[_0x23f7('0x12')](function(_0x50c57e){_0x4c5293(null,_0x50c57e);})[_0x23f7('0x14')](function(_0x2c4dbc){_0x4c5293(_0x2c4dbc);});};AGIVertices[_0x23f7('0x16')]['clear']=function(_0x4fe53a){var _0x17a505=_['includes'](verticesWithRetry,_0x4fe53a[_0x23f7('0x8c')])?_0x4fe53a:_[_0x23f7('0x8d')](_0x4fe53a);for(var _0x57a2f8 in _0x17a505){if(_0x17a505['hasOwnProperty'](_0x57a2f8)){if(_0x17a505[_0x57a2f8]&&_[_0x23f7('0x8e')](_0x17a505[_0x57a2f8])){if(_[_0x23f7('0x5f')](recursiveMapAttributes,_0x57a2f8)){_0x17a505[_0x57a2f8]=this['replaceObjectAllVariables'](_0x17a505[_0x57a2f8]);}else{_0x17a505[_0x57a2f8]=this[_0x23f7('0x8f')](_0x17a505[_0x57a2f8]);}}}}return _0x17a505;};AGIVertices[_0x23f7('0x16')][_0x23f7('0x90')]=function(_0x1c8952){for(var _0x5f340b in _0x1c8952){if(_0x1c8952[_0x23f7('0x91')](_0x5f340b)){if(_[_0x23f7('0x92')](_0x1c8952[_0x5f340b])){this[_0x23f7('0x90')](_0x1c8952[_0x5f340b]);}else if(_[_0x23f7('0x93')](_0x1c8952[_0x5f340b])){for(var _0xcee4c4=0x0;_0xcee4c4<_0x1c8952[_0x5f340b]['length'];_0xcee4c4++){this[_0x23f7('0x90')](_0x1c8952[_0x5f340b][_0xcee4c4]);}}else if(_['isString'](_0x1c8952[_0x5f340b])){_0x1c8952[_0x5f340b]=this['replaceAllVariables'](_0x1c8952[_0x5f340b]);}}}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x94')]=function(_0xee1b20,_0x2feeac){for(var _0xced0c7 in _0xee1b20){if(_0xee1b20[_0x23f7('0x91')](_0xced0c7)){if(_['isPlainObject'](_0xee1b20[_0xced0c7])){if(!_[_0x23f7('0x3a')](_0xee1b20[_0xced0c7])){this[_0x23f7('0x94')](_0xee1b20[_0xced0c7],util[_0x23f7('0x95')](_0x23f7('0x96'),_0x2feeac,_0xced0c7));}}else if(_['isArray'](_0xee1b20[_0xced0c7])){for(var _0x321e8f=0x0;_0x321e8f<_0xee1b20[_0xced0c7]['length'];_0x321e8f++){this[_0x23f7('0x94')](_0xee1b20[_0xced0c7][_0x321e8f],util[_0x23f7('0x95')](_0x23f7('0x96'),_0x2feeac,_0xced0c7+'['+_0x321e8f+']'));}}else{if(!_['isNil'](_0xee1b20[_0xced0c7])){this[_0x23f7('0xe')][_0x23f7('0x97')](util['format'](_0x23f7('0x96'),_0x2feeac,_0xced0c7),_0xee1b20[_0xced0c7]);}}}}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x98')]=function(_0x38e381){try{var _0x3a03a6=JSON[_0x23f7('0x63')](_0x38e381);this[_0x23f7('0x90')](_0x3a03a6);return JSON[_0x23f7('0x6b')](_0x3a03a6);}catch(_0x2aa896){return this[_0x23f7('0x8f')](_0x38e381);}};AGIVertices['prototype'][_0x23f7('0x8f')]=function(_0xbbc385){var _0x5b1423=_0xbbc385[_0x23f7('0x99')]('{');for(var _0x2e9fda=0x1;_0x2e9fda<_0x5b1423['length'];_0x2e9fda+=0x1){var _0x4b9268=_0x5b1423[_0x2e9fda][_0x23f7('0x99')]('}');if(_0x4b9268['length']>0x1){_0xbbc385=_0xbbc385['replaceAll']('{'+_0x4b9268[0x0]+'}',this[_0x23f7('0xe')][_0x23f7('0x11')](_0x4b9268[0x0])[_0x23f7('0x9a')]||_0x4b9268[0x0]);}}if(_0x5b1423[_0x23f7('0x9b')]===0x1){return _0xbbc385['toString']();}return this[_0x23f7('0x8f')](_0xbbc385);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x9c')]=function(_0x318376,_0x9d50e9){var _0x26a9e0=this['channel'][_0x23f7('0x11')](_0x318376);if(_0x26a9e0[_0x23f7('0x9d')]===-0x1){return _0x26a9e0;}logger['info'](util[_0x23f7('0x95')](_0x23f7('0x9e'),_0x9d50e9,_0x26a9e0[_0x23f7('0x9a')]));return this[_0x23f7('0xe')][_0x23f7('0x97')](_0x9d50e9,_0x26a9e0[_0x23f7('0x9a')]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x9f')]=function(_0x2376e7){return _0x2376e7&&_0x2376e7!=='0'&&_0x2376e7!=='-1'&&_0x2376e7!=='';};AGIVertices[_0x23f7('0x16')][_0x23f7('0xa0')]=function(_0x1d1263){this[_0x23f7('0x2f')]['sync'](this,_0x1d1263,'-');_0x1d1263[_0x23f7('0xa1')]=_0x1d1263[_0x23f7('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x23f7('0x16')][_0x23f7('0xa2')]=function(_0x204264){logger['info'](util['format'](_0x23f7('0xa3'),_0x204264['label']));if(!this[_0x23f7('0x9f')](_0x204264[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}var _0x46bad7='\x22'+_0x204264['text']+'\x22';if(this[_0x23f7('0x9f')](_0x204264[_0x23f7('0x70')])){_0x46bad7+=','+_0x204264['options'];}var _0x2229dd=this[_0x23f7('0xe')]['exec'](_0x23f7('0xa6'),_0x46bad7);if(_0x2229dd[_0x23f7('0x9d')]===-0x1){return _0x2229dd;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xa7'),_0x46bad7));};AGIVertices['prototype'][_0x23f7('0xa8')]=function(_0x3cd140){logger['info'](util[_0x23f7('0x95')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x3cd140[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x3cd140[_0x23f7('0xa9')])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0xaa'));}var _0x1cf6eb=_0x3cd140['grammar'];if(this['isConfigured'](_0x3cd140['options'])){_0x1cf6eb+=','+_0x3cd140[_0x23f7('0x70')];}var _0x588bb5=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xac'),_0x1cf6eb);if(_0x588bb5[_0x23f7('0x9d')]===-0x1){return _0x588bb5;}var _0x42f3ad=this[_0x23f7('0x9c')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x42f3ad['result']===-0x1){return _0x42f3ad;}var _0x308fd6=this[_0x23f7('0x9c')](_0x23f7('0xad'),_0x23f7('0xae'));if(_0x308fd6[_0x23f7('0x9d')]===-0x1){return _0x308fd6;}var _0xbe97ff=this['getAndSetVariable']('RECOG_INSTANCE()',_0x23f7('0xaf'));if(_0xbe97ff[_0x23f7('0x9d')]===-0x1){return _0xbe97ff;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1cf6eb));};AGIVertices[_0x23f7('0x16')]['agi']=function(_0x1e8df7){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xb0'),_0x1e8df7[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0x7')]([_0x1e8df7[_0x23f7('0xb1')],_0x1e8df7[_0x23f7('0xb2')]]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0xb3')]=function(_0x1db51e){logger['info'](util[_0x23f7('0x95')](_0x23f7('0xb4'),_0x1db51e['label']));if(this[_0x23f7('0x9f')](_0x1db51e[_0x23f7('0x5e')])){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xb5'),_0x1db51e[_0x23f7('0x5e')]));var _0x2a7125=this[_0x23f7('0xe')][_0x23f7('0xb6')](_0x1db51e['timeout']);if(_0x2a7125[_0x23f7('0x9d')]===-0x1){return _0x2a7125;}}return this[_0x23f7('0xe')]['answer']();};AGIVertices[_0x23f7('0x16')][_0x23f7('0x3f')]=function(_0x31d4e0){logger['info'](util[_0x23f7('0x95')](_0x23f7('0xb7'),_0x31d4e0[_0x23f7('0x31')]));if(!this['isConfigured'](_0x31d4e0[_0x23f7('0x3d')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x31d4e0,'no\x20list\x20selected');}_0x31d4e0[_0x23f7('0x3e')]=moment();if(this[_0x23f7('0x9f')](_0x31d4e0[_0x23f7('0xb8')])){_0x31d4e0[_0x23f7('0x3e')]=moment()[_0x23f7('0xb9')](_0x31d4e0[_0x23f7('0xb8')],_0x23f7('0xba'));}if(!this['isConfigured'](_0x31d4e0['callback_priority'])){_0x31d4e0['callback_priority']=0x2;}this['createCmContact'][_0x23f7('0x69')](this,_0x31d4e0);return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xbb'),_0x31d4e0['phone'],_0x31d4e0['list_id'],_0x31d4e0['scheduledAt']));};AGIVertices[_0x23f7('0x16')]['custom_app']=function(_0x17dfd3){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0xbc'),_0x17dfd3['label']));var _0x4b8d1b=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x17dfd3['application'],_0x17dfd3[_0x23f7('0x70')]);if(_0x4b8d1b[_0x23f7('0x9d')]===-0x1){return _0x4b8d1b;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xbd'),_0x17dfd3[_0x23f7('0xbe')],_0x17dfd3['options']));};AGIVertices[_0x23f7('0x16')]['lumenvoxtts']=function(_0x120503){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0xbf'),_0x120503[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x120503[_0x23f7('0x51')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0xa5'));}var _0x1a1f71='\x22'+_0x120503['text']+'\x22';if(this[_0x23f7('0x9f')](_0x120503[_0x23f7('0x70')])){_0x1a1f71+=','+_0x120503['options'];}var _0x5eaeba=this[_0x23f7('0xe')][_0x23f7('0xab')]('MRCPSynth',_0x1a1f71);if(_0x5eaeba[_0x23f7('0x9d')]===-0x1){return _0x5eaeba;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xa7'),_0x1a1f71));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc0')]=function(_0x171eeb){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xc1'),_0x171eeb[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x171eeb['text'])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20text\x20configured');}var _0x204e86='\x22'+_0x171eeb[_0x23f7('0x51')]+'\x22';if(this['isConfigured'](_0x171eeb[_0x23f7('0x70')])){_0x204e86+=','+_0x171eeb[_0x23f7('0x70')];}var _0x3540fb=this[_0x23f7('0xe')][_0x23f7('0xab')]('MRCPSynth',_0x204e86);if(_0x3540fb[_0x23f7('0x9d')]===-0x1){return _0x3540fb;}return this['channel'][_0x23f7('0xa4')](util['format'](_0x23f7('0xa7'),_0x204e86));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc2')]=function(_0x412db4){logger['info'](util['format'](_0x23f7('0xc3'),_0x412db4[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x412db4['grammar'])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0xaa'));}var _0x4bcbe6=_0x412db4[_0x23f7('0xa9')];if(this[_0x23f7('0x9f')](_0x412db4['options'])){_0x4bcbe6+=','+_0x412db4[_0x23f7('0x70')];}var _0x12ee47=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xac'),_0x4bcbe6);if(_0x12ee47[_0x23f7('0x9d')]===-0x1){return _0x12ee47;}var _0x5ef076=this[_0x23f7('0x9c')]('RECOG_CONFIDENCE()',_0x23f7('0xc4'));if(_0x5ef076[_0x23f7('0x9d')]===-0x1){return _0x5ef076;}var _0x86fff5=this[_0x23f7('0x9c')](_0x23f7('0xad'),_0x23f7('0xc5'));if(_0x86fff5[_0x23f7('0x9d')]===-0x1){return _0x86fff5;}var _0x2e4b4b=this[_0x23f7('0x9c')]('RECOG_INSTANCE()',_0x23f7('0xc6'));if(_0x2e4b4b['result']===-0x1){return _0x2e4b4b;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xc7'),_0x4bcbe6));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc8')]=function(_0x58508a){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x58508a[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x58508a[_0x23f7('0xa9')])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0xaa'));}var _0x384b1c=_0x58508a[_0x23f7('0xa9')];if(this[_0x23f7('0x9f')](_0x58508a[_0x23f7('0x70')])){_0x384b1c+=','+_0x58508a[_0x23f7('0x70')];}var _0x5ef84a=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xac'),_0x384b1c);if(_0x5ef84a['result']===-0x1){return _0x5ef84a;}var _0x38a4bd=this[_0x23f7('0x9c')](_0x23f7('0xc9'),_0x23f7('0xca'));if(_0x38a4bd['result']===-0x1){return _0x38a4bd;}var _0x207c0a=this[_0x23f7('0x9c')]('RECOG_INPUT()',_0x23f7('0xcb'));if(_0x207c0a[_0x23f7('0x9d')]===-0x1){return _0x207c0a;}var _0x555370=this[_0x23f7('0x9c')](_0x23f7('0xcc'),'SESTEK_ASR_INSTANCE');if(_0x555370[_0x23f7('0x9d')]===-0x1){return _0x555370;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xc7'),_0x384b1c));};AGIVertices['prototype'][_0x23f7('0xcd')]=function(_0x528390){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x528390['label']));if(!this[_0x23f7('0x9f')](_0x528390[_0x23f7('0xce')])){return this['channel']['error'](_0x528390,_0x23f7('0xcf'));}var _0x405b4d=this[_0x23f7('0x18')][_0x23f7('0x69')](this,_0x528390[_0x23f7('0xce')]);if(!_0x405b4d){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x528390,_0x23f7('0xd0'));}if(!this[_0x23f7('0x9f')](_0x528390[_0x23f7('0xd1')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x528390,_0x23f7('0xd2'));}var _0x52141e=_0x528390[_0x23f7('0xd1')][_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'\x20');this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xd3'),_0x52141e));var _0x52fd32=this[_0x23f7('0xd4')][_0x23f7('0x69')](this,_0x405b4d,_0x52141e);this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x528390,_0x52141e);if(!this[_0x23f7('0x9f')](_0x528390[_0x23f7('0xd5')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xd6'));}var _0x47d0c7=this[_0x23f7('0x11')]['sync'](this,_0x528390[_0x23f7('0xd5')]);if(!_0x47d0c7){return this[_0x23f7('0xe')]['error'](_0x528390,_0x23f7('0xd7'));}var _0x30445d=this;_0x52fd32[_0x23f7('0xd8')](function(_0xdd1058,_0x590ba3){Object['keys'](_0xdd1058)['forEach'](function(_0x58a15e){_0x30445d[_0x23f7('0xe')][_0x23f7('0x97')](util['format']('%s[%s][%s]',_0x47d0c7,_0x590ba3,_0x58a15e),_0xdd1058[_0x58a15e]);});});this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0xd9'),_0x47d0c7),_0x52fd32[_0x23f7('0x9b')]);return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0xda'),_0x47d0c7));};AGIVertices[_0x23f7('0x16')]['dial']=function(_0x17d77f){logger[_0x23f7('0xdb')](util[_0x23f7('0x95')](_0x23f7('0xdc'),_0x17d77f[_0x23f7('0x31')]));if(!this['isConfigured'](_0x17d77f[_0x23f7('0xdd')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x17d77f,_0x23f7('0xde'));}var _0x5cdcdf=this[_0x23f7('0xdf')][_0x23f7('0x69')](this,_0x17d77f[_0x23f7('0xdd')]);if(!_0x5cdcdf){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x17d77f,_0x23f7('0xe0'));}var _0x4dca18=this['channel'][_0x23f7('0xab')](_0x23f7('0xe1'),[util[_0x23f7('0x95')](_0x23f7('0xe2'),_0x5cdcdf),_0x17d77f[_0x23f7('0x5e')],_0x17d77f[_0x23f7('0xe3')],_0x17d77f['url']]);if(_0x4dca18[_0x23f7('0x9d')]===-0x1){return _0x4dca18;}return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0xe4'),_0x23f7('0xe1')));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xe5')]=function(_0xd5604e){logger['info'](util['format'](_0x23f7('0xe6'),_0xd5604e[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0xd5604e[_0x23f7('0x72')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xe7'));}if(!this['isConfigured'](_0xd5604e[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this[_0x23f7('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0xd5604e);this[_0x23f7('0x38')](_0xd5604e['text'],'in','','');this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0xe8'),_0xd5604e[_0x23f7('0x51')]));var _0x1f55cd=this[_0x23f7('0x71')]['sync'](this,_0xd5604e);if(_0x1f55cd){for(var _0x49793c in _0x1f55cd){if(_0x1f55cd[_0x23f7('0x91')](_0x49793c)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0xe9'),_0x49793c[_0x23f7('0x62')]()),_0x1f55cd[_0x49793c]);}}this[_0x23f7('0x38')](_0x1f55cd['speech'],'out',_0x23f7('0xe5'),'');return this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xea'),_0x1f55cd[_0x23f7('0xeb')]));}return this['channel']['error'](_0xd5604e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x23f7('0x16')][_0x23f7('0xec')]=function(_0x583a86){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xed'),_0x583a86['label']));if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0x75')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xee'));}if(!this['isConfigured'](_0x583a86['client_email'])){return this['channel']['noop'](_0x23f7('0xef'));}if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0xf0')])){return this[_0x23f7('0xe')]['noop']('no\x20private_key\x20configured');}if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0x77')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xf1'));}if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xf2')]=!![];this[_0x23f7('0x2f')](_0x583a86);this['createSquareMessage'](_0x583a86[_0x23f7('0x51')],'in','','');this[_0x23f7('0xe')]['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x583a86[_0x23f7('0x51')]));var _0x20f838=this[_0x23f7('0x74')][_0x23f7('0x69')](this,_0x583a86);if(_0x20f838){for(var _0x351572 in _0x20f838){if(_0x20f838[_0x23f7('0x91')](_0x351572)){if(_0x351572!=='providerResponse'){this[_0x23f7('0xe')]['setVariable'](util[_0x23f7('0x95')](_0x23f7('0xe9'),_0x351572[_0x23f7('0x62')]()),_0x20f838[_0x351572]);}}}this[_0x23f7('0x38')](_0x20f838[_0x23f7('0xeb')],_0x23f7('0xf3'),_0x23f7('0xec'),_0x20f838[_0x23f7('0xf4')]);return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xf5'),_0x20f838[_0x23f7('0xeb')]));}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x583a86,_0x23f7('0xf6'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xf7')]=function(_0x1cd13c){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0xf8'),_0x1cd13c[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xf9')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xfa')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xfb'));}if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xfc')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xfd'));}if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xfe')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xf2')]=!![];this[_0x23f7('0x2f')](_0x1cd13c);this[_0x23f7('0x38')](_0x1cd13c['text'],'in','','');this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xff'),_0x1cd13c[_0x23f7('0x51')]));var _0x21eb1f=this[_0x23f7('0x78')][_0x23f7('0x69')](this,_0x1cd13c);if(_0x21eb1f){for(var _0x4eff58 in _0x21eb1f){if(_0x21eb1f['hasOwnProperty'](_0x4eff58)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x100'),_0x4eff58[_0x23f7('0x62')]()),_0x21eb1f[_0x4eff58]);}}this[_0x23f7('0x38')](_0x21eb1f[_0x23f7('0xeb')],_0x23f7('0xf3'),_0x23f7('0xf7'),'');if(_0x21eb1f[_0x23f7('0x101')]){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x102'),_0x21eb1f[_0x23f7('0x101')]));var _0x4d8a4c=this[_0x23f7('0xe')]['streamFile'](_0x21eb1f[_0x23f7('0x101')]);try{fs[_0x23f7('0x103')](_0x21eb1f['audiofile']+'.wav');}catch(_0x4fd273){logger[_0x23f7('0x25')](_0x4fd273);}return _0x4d8a4c;}else{return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x104'),_0x21eb1f[_0x23f7('0xeb')]));}}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x1cd13c,_0x23f7('0x105'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x106')]=function(_0x3cc58e){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x107'),_0x3cc58e[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x106'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x108')]=function(_0x51caeb){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x109'),_0x51caeb[_0x23f7('0x31')]));var _0x348b97='';if(_0x51caeb['trunk_id']){if(!this[_0x23f7('0x9f')](_0x51caeb[_0x23f7('0x10a')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x51caeb,'no\x20trunk\x20selected');}else{var _0x580c47=parseInt(_0x51caeb['trunk_id'],0xa);if(isNaN(_0x580c47)){_0x348b97=_0x51caeb['trunk_id'];}else{_0x348b97=this[_0x23f7('0x10b')][_0x23f7('0x69')](this,_0x51caeb[_0x23f7('0x10a')]);if(!_0x348b97){return this['channel']['error'](_0x51caeb,_0x23f7('0x10c'));}}}}else if(_0x51caeb[_0x23f7('0x10d')]){_0x348b97=_0x51caeb[_0x23f7('0x10d')];}else{return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x51caeb,'no\x20trunk\x20selected');}var _0xd64e3f=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xe1'),[util[_0x23f7('0x95')](_0x23f7('0x10e'),_0x348b97,_0x51caeb[_0x23f7('0x3c')]),_0x51caeb['timeout'],_0x51caeb[_0x23f7('0xe3')],_0x51caeb[_0x23f7('0x5b')]]);if(_0xd64e3f[_0x23f7('0x9d')]===-0x1){return _0xd64e3f;}return this['channel'][_0x23f7('0xa4')](util['format'](_0x23f7('0xe4'),_0x23f7('0xe1')));};AGIVertices['prototype'][_0x23f7('0x10f')]=function(_0x1c8fc6){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1c8fc6[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x10f'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc')]=function(_0x5f31c6){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5f31c6['label']));if(_0x5f31c6[_0x23f7('0xa1')]===0x0){return this[_0x23f7('0xa0')](_0x5f31c6);}_0x5f31c6[_0x23f7('0xa1')]-=0x1;if(!this[_0x23f7('0x9f')](_0x5f31c6[_0x23f7('0x110')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x5f31c6,_0x23f7('0x111'));}var _0x5afb33=this['getSound'][_0x23f7('0x69')](this,_0x5f31c6[_0x23f7('0x110')]);if(!_0x5afb33){return this[_0x23f7('0xe')]['error'](_0x5f31c6,_0x23f7('0x112'));}if(!this[_0x23f7('0x9f')](_0x5f31c6['variable_id'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x23f7('0xd6'));}var _0x264fd7=this[_0x23f7('0xe')]['getData'](_0x5afb33,_0x5f31c6[_0x23f7('0x113')],_0x5f31c6[_0x23f7('0x114')]);var _0x1f2dd1=_0x264fd7[_0x23f7('0x9d')]?_0x264fd7[_0x23f7('0x9d')][_0x23f7('0x41')]():'';logger[_0x23f7('0x27')](_0x23f7('0x115'),JSON[_0x23f7('0x6b')](_0x264fd7));if(_0x264fd7[_0x23f7('0x9d')]===-0x1){this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,_0x1f2dd1);return _0x264fd7;}else if(_0x264fd7[_0x23f7('0x9a')]===_0x23f7('0x5e')){_0x264fd7[_0x23f7('0x9d')]=_0x1f2dd1[_0x23f7('0x9b')]>=parseInt(_0x5f31c6[_0x23f7('0x116')])?'x':'i';}else{_0x264fd7['result']=_0x1f2dd1[_0x23f7('0x9b')]>=parseInt(_0x5f31c6['mindigit'])&&_0x1f2dd1[_0x23f7('0x9b')]<=parseInt(_0x5f31c6['maxdigit'])?'x':'i';}var _0x3f5160=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x5f31c6[_0x23f7('0xd5')]);if(!_0x3f5160){return this['channel'][_0x23f7('0x25')](_0x5f31c6,_0x23f7('0xd7'));}this[_0x23f7('0xe')]['setVariable'](_0x3f5160,_0x1f2dd1);if(this[_0x23f7('0x9f')](_0x5f31c6['hiddendigitsnum'])){var _0x3e3413=parseInt(_0x5f31c6['hiddendigitsnum'],0xa);var _0x4c00f4=rs[_0x23f7('0x117')]({'charset':'*','length':_0x3e3413});var _0x5c6a32=_0x1f2dd1[_0x23f7('0x9b')];if(_0x5c6a32>0x0){if(_0x5c6a32>_0x3e3413){this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,_0x5f31c6['hiddendigitspos']===_0x23f7('0x118')?_0x4c00f4+_0x1f2dd1['substr'](_0x3e3413):_0x1f2dd1[_0x23f7('0x119')](0x0,_0x5c6a32-_0x3e3413)+_0x4c00f4);}else{this['createSquareDetailsReport']['sync'](this,_0x5f31c6,rs[_0x23f7('0x117')]({'charset':'*','length':_0x5c6a32}));}}else{this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,'');}}else{this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,_0x1f2dd1);}return _0x264fd7;};AGIVertices[_0x23f7('0x16')][_0x23f7('0xd')]=function(_0x2362ac){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x11a'),_0x2362ac[_0x23f7('0x31')]));return this[_0x23f7('0xc')](_0x2362ac);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x11b')]=function(_0x4ea1ef){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x11c'),_0x4ea1ef[_0x23f7('0x31')]));this['createSquareDetailsReport'][_0x23f7('0x69')](this,_0x4ea1ef,_0x4ea1ef[_0x23f7('0x11d')]);return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('GOAL\x20%s',_0x4ea1ef[_0x23f7('0x11d')]));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x11e')]=function(_0x670e69){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x11f'),_0x670e69[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x670e69['aws_access_key_id'])||!this[_0x23f7('0x9f')](_0x670e69[_0x23f7('0x80')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0x120'));}if(!this[_0x23f7('0x9f')](_0x670e69['text'])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0xa5'));}this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x121'),_0x670e69[_0x23f7('0x51')]));var _0x3afdf0=this[_0x23f7('0x7e')][_0x23f7('0x69')](this,_0x670e69);if(_0x3afdf0){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x122'),_0x3afdf0));var _0x2e6507=this['channel'][_0x23f7('0x123')](_0x3afdf0);try{fs[_0x23f7('0x103')](_0x3afdf0+'.wav');}catch(_0x1c0d72){logger[_0x23f7('0x25')](_0x1c0d72);}return _0x2e6507;}return this[_0x23f7('0xe')]['error'](_0x670e69,_0x23f7('0x124'));};AGIVertices['prototype'][_0x23f7('0x125')]=function(_0x5095d5){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5095d5[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x5095d5['aws_access_key_id'])||!this['isConfigured'](_0x5095d5[_0x23f7('0x80')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5095d5[_0x23f7('0x87')])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0x126'));}if(!this[_0x23f7('0x9f')](_0x5095d5[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xf2')]=!![];this[_0x23f7('0x2f')](_0x5095d5);this[_0x23f7('0x38')](_0x5095d5[_0x23f7('0x51')],'in','','');this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x127'),_0x5095d5['text']));var _0x4dd8bd=this['awsLex'][_0x23f7('0x69')](this,_0x5095d5);if(_0x4dd8bd){for(var _0x258a4 in _0x4dd8bd){if(_0x4dd8bd[_0x23f7('0x91')](_0x258a4)&&_[_0x23f7('0x8e')](_0x4dd8bd[_0x258a4])){this[_0x23f7('0xe')]['setVariable'](util[_0x23f7('0x95')](_0x23f7('0x128'),_0x258a4['toUpperCase']()),_0x4dd8bd[_0x258a4]);}}if(_[_0x23f7('0x47')](_0x4dd8bd[_0x23f7('0x6e')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x129'));}else{this[_0x23f7('0x38')](_0x4dd8bd[_0x23f7('0x6e')],_0x23f7('0xf3'),_0x23f7('0x12a'),'');return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x12b'),_0x4dd8bd[_0x23f7('0x6e')]));}}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x5095d5,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x23f7('0x16')][_0x23f7('0x12c')]=function(_0x32d321){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x32d321[_0x23f7('0x31')],_0x32d321[_0x23f7('0x5e')]));if(!this[_0x23f7('0x9f')](_0x32d321[_0x23f7('0x72')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xe7'));}var _0x1de86a='wav';var _0x207601=util['format'](_0x23f7('0x12d'),FILES_PATH,rs[_0x23f7('0x117')](0x4));var _0x25d0af=util[_0x23f7('0x95')](_0x23f7('0x96'),_0x207601,_0x1de86a);var _0x4a6a0e=!![];if(_0x32d321[_0x23f7('0x12e')]===_0x23f7('0x12f')){_0x4a6a0e=![];}var _0x309ed9=this[_0x23f7('0xe')]['recordFile'](_0x207601,_0x1de86a,_0x32d321[_0x23f7('0x130')],_0x32d321[_0x23f7('0x5e')],undefined,_0x4a6a0e);if(_0x309ed9[_0x23f7('0x9d')]!==-0x1){this['channel'][_0x23f7('0xa4')](util['format']('google\x20%s\x20file\x20created',_0x25d0af));var _0x278af0=this[_0x23f7('0x88')][_0x23f7('0x69')](this,_0x32d321,_0x25d0af);if(_0x278af0){for(var _0x38d4dc in _0x278af0){if(_0x278af0['hasOwnProperty'](_0x38d4dc)){this[_0x23f7('0xe')][_0x23f7('0x97')](util['format'](_0x23f7('0x131'),_0x38d4dc['toUpperCase']()),_0x278af0[_0x38d4dc]);}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x132'),JSON[_0x23f7('0x6b')](_0x278af0)));}}return _0x309ed9;};AGIVertices['prototype'][_0x23f7('0x133')]=function(_0x17d80c){logger['info'](util['format'](_0x23f7('0x134'),_0x17d80c[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x17d80c[_0x23f7('0x135')])){return this[_0x23f7('0xe')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x17d80c[_0x23f7('0x8b')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20appsecret\x20configured');}var _0xbd13d0=_0x23f7('0x136');var _0x2379e5=util['format'](_0x23f7('0x12d'),FILES_PATH,rs[_0x23f7('0x117')](0x4));var _0x2dfcd6=util[_0x23f7('0x95')](_0x23f7('0x96'),_0x2379e5,_0xbd13d0);var _0x341e03=!![];if(_0x17d80c[_0x23f7('0x12e')]===_0x23f7('0x12f')){_0x341e03=![];}var _0x5e8d0d=this[_0x23f7('0xe')][_0x23f7('0x137')](_0x2379e5,_0xbd13d0,_0x17d80c[_0x23f7('0x130')],_0x17d80c['timeout'],undefined,_0x341e03);if(_0x5e8d0d['result']!==-0x1){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x138'),_0x2dfcd6));var _0x1d0fdc=this[_0x23f7('0x8a')][_0x23f7('0x69')](this,_0x17d80c,_0x2dfcd6);if(_0x1d0fdc){for(var _0x4dfc10 in _0x1d0fdc){if(_0x1d0fdc[_0x23f7('0x91')](_0x4dfc10)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x139'),_0x4dfc10[_0x23f7('0x62')]()),_0x1d0fdc[_0x4dfc10]);}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x13a'),JSON[_0x23f7('0x6b')](_0x1d0fdc)));}}return _0x5e8d0d;};AGIVertices[_0x23f7('0x16')]['gotoc']=function(_0x2d3d67){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2d3d67[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0x13b')](_0x2d3d67[_0x23f7('0x13c')],_0x2d3d67[_0x23f7('0x13d')],_0x2d3d67[_0x23f7('0x13e')]);};AGIVertices['prototype'][_0x23f7('0x13f')]=function(_0x3a03b6){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3a03b6['label']));if(!this[_0x23f7('0x9f')](_0x3a03b6[_0x23f7('0x140')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3a03b6,_0x23f7('0x141'));}try{var _0x35a3d5=eval(_0x3a03b6[_0x23f7('0x140')])?_0x23f7('0x142'):'false';this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3a03b6['condition'],_0x35a3d5));return{'code':0xc8,'result':_0x35a3d5};}catch(_0x354586){return{'code':0xc8,'result':_0x23f7('0x143')};}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x144')]=function(_0x3c7eca){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x145'),_0x3c7eca[_0x23f7('0x31')]));if(!this['isConfigured'](_0x3c7eca['interval_id'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3c7eca,_0x23f7('0x146'));}var _0x5c9205=this[_0x23f7('0x21')][_0x23f7('0x69')](this,_0x3c7eca[_0x23f7('0x147')]);if(!_0x5c9205){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3c7eca,'no\x20intervals\x20found');}for(var _0x10f913=0x0;_0x10f913<_0x5c9205['length'];_0x10f913+=0x1){var _0x52daf9=this[_0x23f7('0xe')][_0x23f7('0x11')](util[_0x23f7('0x95')](_0x23f7('0x148'),_0x5c9205[_0x10f913]));if(_0x52daf9['result']===-0x1){return _0x52daf9;}logger[_0x23f7('0x27')](util['format'](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x52daf9['extra']));if(_0x52daf9['extra']===_0x23f7('0x142')){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x23f7('0x142')));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x23f7('0x142')));return{'code':0xc8,'result':_0x23f7('0x142')};}else{logger['info'](util[_0x23f7('0x95')]('IFTIME\x20%s\x20%s',_0x5c9205[_0x10f913],'false'));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x23f7('0x143')));}}return{'code':0xc8,'result':_0x23f7('0x143')};};AGIVertices[_0x23f7('0x16')][_0x23f7('0x14a')]=function(_0x444409){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x14b'),_0x444409[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0x14a')]();};AGIVertices[_0x23f7('0x16')][_0x23f7('0x14c')]=function(_0x168af4){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x168af4[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x168af4[_0x23f7('0x72')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xe7'));}var _0x2a77c5=_0x23f7('0x136');var _0x2318bc=util[_0x23f7('0x95')](_0x23f7('0x12d'),FILES_PATH,rs[_0x23f7('0x117')](0x4));var _0x298b58=util['format'](_0x23f7('0x96'),_0x2318bc,_0x2a77c5);var _0x1997ac=!![];if(_0x168af4['beep']==='NOBEEP'){_0x1997ac=![];}var _0x20d558=this[_0x23f7('0xe')]['recordFile'](_0x2318bc,_0x2a77c5,_0x168af4[_0x23f7('0x130')],_0x168af4[_0x23f7('0x5e')],undefined,_0x1997ac);if(_0x20d558['result']!==-0x1){this['channel']['noop'](util[_0x23f7('0x95')](_0x23f7('0x14d'),_0x298b58));var _0x35ec49=this[_0x23f7('0x7b')][_0x23f7('0x69')](this,_0x168af4,_0x298b58);if(_0x35ec49){for(var _0x1e4d24 in _0x35ec49){if(_0x35ec49[_0x23f7('0x91')](_0x1e4d24)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x14e'),_0x1e4d24[_0x23f7('0x62')]()),_0x35ec49[_0x1e4d24]);}}return this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x14f'),JSON[_0x23f7('0x6b')](_0x35ec49)));}}return _0x20d558;};AGIVertices['prototype'][_0x23f7('0x150')]=function(_0xec130d){logger['info'](util[_0x23f7('0x95')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xec130d[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0xec130d['key'])){return this['channel']['noop'](_0x23f7('0xe7'));}if(!this[_0x23f7('0x9f')](_0xec130d[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel']['noop'](util[_0x23f7('0x95')](_0x23f7('0x151'),_0xec130d[_0x23f7('0x51')]));var _0x5407a3=this[_0x23f7('0x79')][_0x23f7('0x69')](this,_0xec130d);if(_0x5407a3){this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x14d'),_0x5407a3));var _0x5ef1ef=this[_0x23f7('0xe')][_0x23f7('0x123')](_0x5407a3,_0xec130d[_0x23f7('0x130')]);try{fs[_0x23f7('0x103')](_0x5407a3+_0x23f7('0x152'));}catch(_0x1abcf8){logger['error'](_0x1abcf8);}return _0x5ef1ef;}return this['channel'][_0x23f7('0x25')](_0xec130d,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x23f7('0x16')][_0x23f7('0x153')]=function(_0x3b5f0a){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x154'),_0x3b5f0a[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x3b5f0a[_0x23f7('0x155')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3b5f0a,_0x23f7('0x156'));}logger['info'](util[_0x23f7('0x95')](_0x23f7('0x157'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));var _0x55f24e=this['agentLogin'][_0x23f7('0x69')](this,_0x3b5f0a[_0x23f7('0x155')]);if(_0x55f24e){logger[_0x23f7('0x27')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger[_0x23f7('0x27')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a['findBy']));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices[_0x23f7('0x16')]['logout']=function(_0x224db9){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x15c'),_0x224db9['label']));if(!this[_0x23f7('0x9f')](_0x224db9[_0x23f7('0x155')])){return this['channel']['error'](_0x224db9,_0x23f7('0x156'));}logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x23f7('0xe')][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));var _0x310675=this[_0x23f7('0x49')]['sync'](this,_0x224db9[_0x23f7('0x155')]);if(_0x310675){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x158'),this['channel'][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices['prototype'][_0x23f7('0x15d')]=function(_0x474b69){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x15e'),_0x474b69[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x474b69['operation'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x474b69,_0x23f7('0x15f'));}this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x160'),_0x474b69['operation']));var _0x473a38=eval(_0x474b69[_0x23f7('0x161')]);if(!this[_0x23f7('0x9f')](_0x474b69[_0x23f7('0xd5')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2b355b=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x474b69['variable_id']);if(!_0x2b355b){return this['channel']['error'](_0x474b69,'no\x20variable\x20found');}if(_[_0x23f7('0x93')](_0x473a38)){var _0x66253=this;_0x473a38[_0x23f7('0xd8')](function(_0x57dc65,_0xda87b3){_0x66253[_0x23f7('0xe')][_0x23f7('0x97')](util['format'](_0x23f7('0x162'),_0x2b355b,_0xda87b3),_0x57dc65);});return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('variable\x20%s[key]\x20set',_0x2b355b));}else{return this['channel'][_0x23f7('0x97')](_0x2b355b,_0x473a38);}};AGIVertices[_0x23f7('0x16')]['menu']=function(_0x30b758){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x30b758[_0x23f7('0x31')]));if(_0x30b758[_0x23f7('0xa1')]===0x0){return this['maxRetry'](_0x30b758);}_0x30b758[_0x23f7('0xa1')]-=0x1;if(!this['isConfigured'](_0x30b758[_0x23f7('0x110')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x30b758,_0x23f7('0x111'));}var _0x1b0423=this['getSound'][_0x23f7('0x69')](this,_0x30b758['file_id']);if(!_0x1b0423){return this[_0x23f7('0xe')]['error'](_0x30b758,_0x23f7('0x112'));}var _0x4eac61=this['channel'][_0x23f7('0x163')](_0x1b0423,_0x30b758[_0x23f7('0x113')],_0x30b758[_0x23f7('0x164')]);var _0x2e5d42=_0x4eac61[_0x23f7('0x9d')];if(_0x4eac61[_0x23f7('0x9d')]===-0x1){this['createSquareDetailsReport'][_0x23f7('0x69')](this,_0x30b758,'-1');return _0x4eac61;}else if(_0x4eac61[_0x23f7('0x9a')]===_0x23f7('0x5e')){_0x4eac61['result']=_0x4eac61[_0x23f7('0x9d')][_0x23f7('0x9b')]>0x0?_0x4eac61[_0x23f7('0x9d')]:'t';}else if(_['isEmpty'](_0x4eac61[_0x23f7('0x9d')])){_0x4eac61[_0x23f7('0x9d')]='#';_0x2e5d42='#';}if(!this['isConfigured'](_0x30b758[_0x23f7('0xd5')])){this[_0x23f7('0xe')]['noop'](_0x23f7('0xd6'));}else{var _0x1f3891=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x30b758[_0x23f7('0xd5')]);if(!_0x1f3891){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x30b758,_0x23f7('0xd7'));}this[_0x23f7('0xe')][_0x23f7('0x97')](_0x1f3891,_0x2e5d42);}this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x30b758,_0x2e5d42);return _0x4eac61;};AGIVertices[_0x23f7('0x16')]['noop']=function(_0x56b2d8){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x165'),_0x56b2d8[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x56b2d8[_0x23f7('0x166')]||_0x56b2d8[_0x23f7('0x31')]);};AGIVertices['prototype']['pause']=function(_0x5296af){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x167'),_0x5296af[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x5296af['findBy'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x5296af,_0x23f7('0x156'));}logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x157'),this['channel']['callerid'],_0x5296af['findBy']));var _0x4eb659=this['getPause'][_0x23f7('0x69')](this,_0x5296af[_0x23f7('0x168')]);var _0x347610=this[_0x23f7('0x45')][_0x23f7('0x69')](this,_0x5296af[_0x23f7('0x155')],_0x4eb659);if(_0x347610){logger[_0x23f7('0x27')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x23f7('0x33')],_0x5296af[_0x23f7('0x155')]));this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x158'),this[_0x23f7('0xe')]['callerid'],_0x5296af[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger['info'](util[_0x23f7('0x95')](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x5296af[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x5296af[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices[_0x23f7('0x16')]['playback']=function(_0x15ec65){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x169'),_0x15ec65[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x15ec65['file_id'])){return this['channel'][_0x23f7('0x25')](_0x15ec65,_0x23f7('0x111'));}var _0x503a59=this[_0x23f7('0x1b')][_0x23f7('0x69')](this,_0x15ec65[_0x23f7('0x110')]);if(!_0x503a59){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x15ec65,'no\x20file\x20audio\x20found');}var _0x102d28=this[_0x23f7('0xe')][_0x23f7('0xab')]('PLAYBACK',[_0x503a59,_0x15ec65[_0x23f7('0xe3')]]);if(_0x102d28[_0x23f7('0x9d')]===-0x1){return _0x102d28;}return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')]('Executed\x20command\x20%s\x20%s',_0x23f7('0x16a'),_0x503a59));};AGIVertices[_0x23f7('0x16')]['queue']=function(_0x183fa5){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x16b'),_0x183fa5[_0x23f7('0x31')]));if(!this['isConfigured'](_0x183fa5[_0x23f7('0x16c')])){return this[_0x23f7('0xe')]['error'](_0x183fa5,_0x23f7('0x16d'));}var _0x15bbf0='';var _0x35c68d=parseInt(_0x183fa5[_0x23f7('0x16c')],0xa);if(isNaN(_0x35c68d)){_0x15bbf0=_0x183fa5[_0x23f7('0x16c')];}else{_0x15bbf0=this['getVoiceQueue'][_0x23f7('0x69')](this,_0x183fa5[_0x23f7('0x16c')]);if(!_0x15bbf0){return this[_0x23f7('0xe')]['error'](_0x183fa5,_0x23f7('0x16e'));}}var _0x4632e7='';if(this[_0x23f7('0x9f')](_0x183fa5[_0x23f7('0x110')])){var _0x449f53=this[_0x23f7('0x1b')][_0x23f7('0x69')](this,_0x183fa5[_0x23f7('0x110')]);if(_0x449f53){_0x4632e7=_0x449f53;}}this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x183fa5,_0x15bbf0);if(_0x183fa5['opts'][_0x23f7('0x16f')]('x')<0x0){_0x183fa5['opts']+='x';}if(_0x183fa5[_0x23f7('0xe3')][_0x23f7('0x16f')]('X')<0x0){_0x183fa5[_0x23f7('0xe3')]+='X';}this[_0x23f7('0xe')][_0x23f7('0x97')](_0x23f7('0x170'),_0x15bbf0?_0x15bbf0[_0x23f7('0x171')]():'');var _0x50d543=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0x172'),[_0x15bbf0,_0x183fa5['opts'],_0x183fa5[_0x23f7('0x5b')],_0x4632e7,_0x183fa5['timeout'],_0x183fa5[_0x23f7('0x7')],_0x183fa5[_0x23f7('0x173')],_0x183fa5[_0x23f7('0x174')],'',_0x183fa5[_0x23f7('0x175')]]);if(_0x50d543['result']===-0x1){return _0x50d543;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xbd'),_0x23f7('0x172'),_0x15bbf0));};AGIVertices['prototype']['record']=function(_0x101c1e){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x101c1e[_0x23f7('0x31')]));var _0x175675=_0x101c1e[_0x23f7('0x176')]||'wav';var _0x2f92a4=util['format']('%s_%s',this[_0x23f7('0xe')][_0x23f7('0x30')],rs[_0x23f7('0x117')](0x5));var _0x4d66e2=util[_0x23f7('0x95')](_0x23f7('0x177'),FILES_PATH,_0x2f92a4,_0x175675);var _0x141502=util['format'](_0x23f7('0x12d'),FILES_PATH,_0x2f92a4);this[_0x23f7('0x34')][_0x23f7('0x69')](this,_0x101c1e,_0x2f92a4,_0x4d66e2);this['channel'][_0x23f7('0x97')](_0x23f7('0x178'),_0x2f92a4);logger[_0x23f7('0x27')](_0x23f7('0x179'),_0x141502,_0x175675,_0x101c1e[_0x23f7('0x17a')],_0x101c1e[_0x23f7('0x5e')]);return this[_0x23f7('0xe')][_0x23f7('0x137')](_0x141502,_0x175675,_0x101c1e['escape_digits'],_0x101c1e[_0x23f7('0x5e')],undefined,!![]);};AGIVertices[_0x23f7('0x16')]['restapi']=function(_0x470678){logger['info'](util[_0x23f7('0x95')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x470678[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x470678[_0x23f7('0x5b')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0x17b'));}var _0x6abc6f=this[_0x23f7('0x5a')][_0x23f7('0x69')](this,_0x470678);logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x17c'),util['inspect'](_0x6abc6f,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x470678[_0x23f7('0xd5')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0x17d'));}var _0x47a568=this[_0x23f7('0x11')]['sync'](this,_0x470678[_0x23f7('0xd5')]);if(!_0x47a568){return this[_0x23f7('0xe')]['error'](_0x470678,_0x23f7('0xd7'));}this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x17e'),_0x47a568),_0x6abc6f[_0x23f7('0x17f')]?_0x6abc6f[_0x23f7('0x17f')]:'200');this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')]('%s_STATUS_MESSAGE',_0x47a568),_0x6abc6f[_0x23f7('0x6d')]?_0x6abc6f[_0x23f7('0x6d')]:'OK');if(_0x6abc6f[_0x23f7('0x6c')]){try{this[_0x23f7('0x94')](_0x6abc6f[_0x23f7('0x6c')],_0x47a568);}catch(_0x4f52ee){logger[_0x23f7('0x25')](util[_0x23f7('0x95')](_0x23f7('0x180'),_0x47a568));}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xda'),_0x47a568));};AGIVertices[_0x23f7('0x16')]['saydigits']=function(_0x23c0c6){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x181'),_0x23c0c6['label']));return this[_0x23f7('0xe')][_0x23f7('0x182')](_0x23c0c6['digits'][_0x23f7('0x4f')](/\s+/g,''),_0x23c0c6['escape_digits']);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x183')]=function(_0x4ec599){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4ec599['label']));return this[_0x23f7('0xe')][_0x23f7('0x184')](_0x4ec599['number'][_0x23f7('0x4f')](/\s+/g,''),_0x4ec599[_0x23f7('0x17a')]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x185')]=function(_0x4675e4){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x186'),_0x4675e4['label']));return this[_0x23f7('0xe')]['sayPhonetic'](_0x4675e4[_0x23f7('0x51')],_0x4675e4['escape_digits']);};AGIVertices['prototype'][_0x23f7('0x187')]=function(_0xf3b0e5){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x188'),_0xf3b0e5['label']));if(!this[_0x23f7('0x9f')](_0xf3b0e5[_0x23f7('0x189')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x18a'));}var _0x13e927=this[_0x23f7('0x1f')][_0x23f7('0x69')](this,_0xf3b0e5[_0x23f7('0x189')]);if(!_0x13e927||!_0x13e927[_0x23f7('0x18b')]){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0xf3b0e5,_0x23f7('0x18c'));}var _0x3a30cb={'from':util[_0x23f7('0x95')](_0x23f7('0x18d'),_0x13e927[_0x23f7('0x13')],_0x13e927[_0x23f7('0x18e')]||_0x13e927['Smtp'][_0x23f7('0x18f')]),'to':_0xf3b0e5['to']||'','cc':_0xf3b0e5['cc']||'','bcc':_0xf3b0e5[_0x23f7('0x190')]||'','subject':_0xf3b0e5['subject'],'html':_0xf3b0e5[_0x23f7('0x51')],'text':_0xf3b0e5[_0x23f7('0x51')]};if(this[_0x23f7('0x9f')](_0xf3b0e5[_0x23f7('0x191')])){}logger[_0x23f7('0xdb')](_0x23f7('0x192'),JSON[_0x23f7('0x6b')](_0x3a30cb));this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0xf3b0e5,_0xf3b0e5['account_id']);this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x193'),_0x13e927['name']));this['sendMailMessage'][_0x23f7('0x69')](this,_0x13e927[_0x23f7('0x194')],_0x3a30cb);return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x195'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x196')]=function(_0x21ed02){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x197'),_0x21ed02[_0x23f7('0x31')]));return this[_0x23f7('0xe')]['noop'](_0x23f7('0x198'));};AGIVertices['prototype'][_0x23f7('0x199')]=function(_0x184c4d){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x19a'),_0x184c4d['label']));if(!this[_0x23f7('0x9f')](_0x184c4d['sms_account_id'])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x19b'));}var _0x23ddff=this[_0x23f7('0x2c')][_0x23f7('0x69')](this,_0x184c4d[_0x23f7('0x19c')]);if(!_0x23ddff){return this['channel']['error'](_0x184c4d,_0x23f7('0x19d'));}var _0x12bad9={'body':_0x184c4d[_0x23f7('0x19e')],'phone':_0x184c4d['to']||'','SmsAccountId':_0x23ddff['id']};logger[_0x23f7('0xdb')](_0x23f7('0x19f'),JSON[_0x23f7('0x6b')](_0x12bad9));this['createSquareDetailsReport'][_0x23f7('0x69')](this,_0x184c4d,_0x184c4d[_0x23f7('0x19c')]);this['channel'][_0x23f7('0xa4')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x23ddff[_0x23f7('0x13')]));this[_0x23f7('0x2e')][_0x23f7('0x69')](this,_0x12bad9);return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x1a0'));};AGIVertices[_0x23f7('0x16')]['set']=function(_0x1a0690){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1a0690[_0x23f7('0x31')]));if(!this['isConfigured'](_0x1a0690[_0x23f7('0xd5')])){return this['channel']['error'](_0x1a0690,_0x23f7('0x1a1'));}var _0x3dffb9=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x1a0690[_0x23f7('0xd5')]);if(!_0x3dffb9){return this[_0x23f7('0xe')]['error'](_0x1a0690,_0x23f7('0xd7'));}return this[_0x23f7('0xe')]['setVariable'](_0x3dffb9,_0x1a0690[_0x23f7('0x1a2')]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1a3')]=function(_0x48e264){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x1a4'),_0x48e264[_0x23f7('0x31')]));this['channel'][_0x23f7('0xa4')](_0x23f7('0x1a5'));if(_0x48e264['answer']===_0x23f7('0x1a6')){this['channel']['noop']('Answer');return this[_0x23f7('0xe')][_0x23f7('0xb3')]();}return this[_0x23f7('0xe')]['noop']('Skipped\x20Answer');};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1a7')]=function(_0x3a30eb){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x1a8'),_0x3a30eb[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x3a30eb[_0x23f7('0x1a9')])){return this['channel'][_0x23f7('0x25')](_0x3a30eb,_0x23f7('0x1aa'));}var _0x160686=this[_0x23f7('0x17')][_0x23f7('0x69')](this,_0x3a30eb[_0x23f7('0x1a9')]);if(!this[_0x23f7('0x9f')](_0x160686)){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3a30eb,util[_0x23f7('0x95')](_0x23f7('0x1ab'),_0x3a30eb[_0x23f7('0x1a9')]));}if(_0x160686===this[_0x23f7('0xe')]['arg_1']){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3a30eb,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x23f7('0x2f')]['sync'](this,_0x3a30eb,_0x160686);var _0x438c30=this['channel']['exec'](_0x23f7('0x1ac'),util[_0x23f7('0x95')](_0x23f7('0x1ad'),config[_0x23f7('0x7')][_0x23f7('0x1ae')]||_0x23f7('0x1af'),_0x160686,this['channel'][_0x23f7('0x32')]));if(_0x438c30['result']===-0x1){return _0x438c30;}return this['channel'][_0x23f7('0xa4')](util['format'](_0x23f7('0xbd'),_0x23f7('0x1ac'),_0x160686));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b0')]=function(_0x270464){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x270464[_0x23f7('0x31')]));var _0x3cf889=this[_0x23f7('0x4d')]['sync'](this,_0x270464[_0x23f7('0xb1')]);this['createSquareDetailsReport']['sync'](this,_0x270464,_0x270464[_0x23f7('0xb1')]);if(this[_0x23f7('0x9f')](_0x270464['variable_id'])){var _0x36383c=this['getVariable']['sync'](this,_0x270464[_0x23f7('0xd5')]);if(_0x36383c){this[_0x23f7('0xe')][_0x23f7('0x97')](_0x36383c,_0x3cf889);return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x1b1'),_0x270464[_0x23f7('0xb1')],_0x36383c));}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x1b2'),_0x270464[_0x23f7('0xb1')]));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b3')]=function(_0x549c19){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x1b4'),_0x549c19[_0x23f7('0x31')]));_0x549c19['text']=_0x549c19[_0x23f7('0x51')][_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x23f7('0x9f')](_0x549c19[_0x23f7('0x50')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0x23f7('0x9f')](_0x549c19[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x1b5'),_0x549c19['text']));var _0x3b05d6=this[_0x23f7('0x1b6')][_0x23f7('0x69')](this,_0x549c19);if(_0x3b05d6){this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x1b7'),_0x3b05d6));var _0x3c80f0=this[_0x23f7('0xe')][_0x23f7('0x123')](_0x3b05d6);try{fs[_0x23f7('0x103')](_0x3b05d6+'.wav');}catch(_0x33f528){logger[_0x23f7('0x25')](_0x33f528);}return _0x3c80f0;}return this[_0x23f7('0xe')]['error'](_0x549c19,_0x23f7('0x1b8'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b9')]=function(_0x30a8e0){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x30a8e0['label']));_0x30a8e0[_0x23f7('0x51')]=_0x30a8e0[_0x23f7('0x51')][_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x30a8e0[_0x23f7('0x51')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0xa5'));}this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x1ba'),_0x30a8e0[_0x23f7('0x51')]));var _0x3e8f52=this['googleTTS'][_0x23f7('0x69')](this,_0x30a8e0);if(_0x3e8f52){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x1bb'),_0x3e8f52));var _0x6a7390=this[_0x23f7('0xe')]['streamFile'](_0x3e8f52);try{fs[_0x23f7('0x103')](_0x3e8f52+'.wav');}catch(_0x186c72){logger[_0x23f7('0x25')](_0x186c72);}return _0x6a7390;}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x30a8e0,_0x23f7('0x1bc'));};AGIVertices[_0x23f7('0x16')]['unpause']=function(_0x1d51ad){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x1bd'),_0x1d51ad[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x1d51ad['findBy'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x1d51ad,_0x23f7('0x156'));}logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x157'),this['channel']['callerid'],_0x1d51ad[_0x23f7('0x155')]));var _0x195178=this[_0x23f7('0x48')][_0x23f7('0x69')](this,_0x1d51ad['findBy']);if(_0x195178){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x1d51ad[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x1d51ad['findBy']));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x15a'),this['channel'][_0x23f7('0x33')],_0x1d51ad['findBy']));this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x1d51ad['findBy']));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1be')]=function(_0x4eef5f){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x1bf'),_0x4eef5f[_0x23f7('0x31')]));var _0x1282c5=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0x1c0'),[_0x4eef5f[_0x23f7('0x1c1')],_0x4eef5f['options']]);if(_0x1282c5[_0x23f7('0x9d')]===-0x1){return _0x1282c5;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xbd'),_0x23f7('0x1c0'),_0x4eef5f['mailbox']));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1c2')]=function(_0x21b3d1){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x21b3d1[_0x23f7('0x31')]));if(!this['isConfigured'](_0x21b3d1[_0x23f7('0xd5')])){return this['channel'][_0x23f7('0x25')](_0x21b3d1,'no\x20variable\x20selected');}var _0x5561fa=this[_0x23f7('0x11')]['sync'](this,_0x21b3d1[_0x23f7('0xd5')]);if(!_0x5561fa){return this['channel'][_0x23f7('0x25')](_0x21b3d1,_0x23f7('0xd7'));}var _0x10e821=this[_0x23f7('0xe')][_0x23f7('0x11')](_0x5561fa);return{'code':0xc8,'result':_0x10e821['extra']?_0x10e821[_0x23f7('0x9a')]:'-'};};String[_0x23f7('0x16')][_0x23f7('0x1c3')]=function(_0x26f544,_0x1050a1){return this['split'](_0x26f544)[_0x23f7('0x1c4')](_0x1050a1);};module[_0x23f7('0x1c5')]=AGIVertices; \ No newline at end of file +var _0xf2fa=['Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','trunk_id','no\x20trunk\x20found','trunk_name','DIAL','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','no\x20file\x20audio\x20found','variable_id','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','agentLogin','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','maxRetry','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','recordingFormat','%s/recordings/%s.%s','%s/recordings/%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','\x22%s\x22\x20<%s>','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','createSquareRecording','calleridname','context','extension','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','toString','getPause','agent','callerid','error','agentUnpause','agentLogout','internal','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda'];(function(_0x506e4e,_0x1e893b){var _0x23719c=function(_0x33e3c0){while(--_0x33e3c0){_0x506e4e['push'](_0x506e4e['shift']());}};_0x23719c(++_0x1e893b);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var util=require(_0xaf2f('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xaf2f('0x1'))();var rs=require(_0xaf2f('0x2'));var moment=require(_0xaf2f('0x3'));var Mustache=require(_0xaf2f('0x4'));var rp=require(_0xaf2f('0x5'));var logger=require(_0xaf2f('0x6'))(_0xaf2f('0x7'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0xaf2f('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xaf2f('0x9'),_0xaf2f('0xa')];var verticesWithRetry=[_0xaf2f('0xb'),_0xaf2f('0xc'),_0xaf2f('0xd')];var AGIVertices=function(_0x5e8ad0,_0x4cfab1,_0x50c838){this[_0xaf2f('0xe')]=_0x5e8ad0;this[_0xaf2f('0xf')]=_0x4cfab1;this[_0xaf2f('0x10')]=_0x50c838;};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x12')]=function(_0x2eaef8,_0x33d60e){this[_0xaf2f('0xf')]['getVariableById'](_0x2eaef8)[_0xaf2f('0x13')](function(_0xd4cf00){_0x33d60e(null,_0xd4cf00?_0xd4cf00[_0xaf2f('0x14')]:![]);})['catch'](function(_0x57cdb0){_0x33d60e(_0x57cdb0);});};AGIVertices['prototype'][_0xaf2f('0x15')]=function(_0x130c3b,_0x580fa6){this[_0xaf2f('0xf')][_0xaf2f('0x16')](_0x130c3b)['then'](function(_0x1bfb43){_0x580fa6(null,_0x1bfb43?_0x1bfb43['name']:![]);})[_0xaf2f('0x17')](function(_0x30905b){_0x580fa6(_0x30905b);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x18')]=function(_0x18b13a,_0x32e829){this[_0xaf2f('0xf')][_0xaf2f('0x19')](_0x18b13a)[_0xaf2f('0x13')](function(_0x244435){_0x32e829(null,_0x244435?_0x244435['name']:![]);})[_0xaf2f('0x17')](function(_0x3376bb){_0x32e829(_0x3376bb);});};AGIVertices['prototype']['getSquareOdbc']=function(_0xb64c0e,_0xee712f){this['rpc'][_0xaf2f('0x1a')](_0xb64c0e)['then'](function(_0x2dbd9b){_0xee712f(null,_0x2dbd9b?_0x2dbd9b['dsn']:![]);})[_0xaf2f('0x17')](function(_0xccf664){_0xee712f(_0xccf664);});};AGIVertices['prototype'][_0xaf2f('0x1b')]=function(_0x42b7ae,_0x359dc2){this[_0xaf2f('0xf')][_0xaf2f('0x1c')](_0x42b7ae)[_0xaf2f('0x13')](function(_0x2fe731){_0x359dc2(null,_0x2fe731?_0x2fe731[_0xaf2f('0x14')]:![]);})['catch'](function(_0x5f199d){_0x359dc2(_0x5f199d);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x1d')]=function(_0x17de64,_0x52a5a1){this[_0xaf2f('0xf')][_0xaf2f('0x1e')](_0x17de64)[_0xaf2f('0x13')](function(_0x153075){_0x52a5a1(null,_0x153075?_0x153075[_0xaf2f('0x14')]:![]);})[_0xaf2f('0x17')](function(_0x593e4d){_0x52a5a1(_0x593e4d);});};AGIVertices['prototype']['getSound']=function(_0x3bbd67,_0x57edba){var _0x580c0e=this;this[_0xaf2f('0xf')][_0xaf2f('0x1f')](_0x3bbd67)[_0xaf2f('0x13')](function(_0x21bf39){_0x57edba(null,_0x21bf39?_0x580c0e[_0xaf2f('0x20')](_0x21bf39['save_name']):![]);})[_0xaf2f('0x17')](function(_0xabe0b){_0x57edba(_0xabe0b);});};AGIVertices['prototype'][_0xaf2f('0x21')]=function(_0x133bdc,_0x49b428){this[_0xaf2f('0xf')][_0xaf2f('0x22')](_0x133bdc)[_0xaf2f('0x13')](function(_0x7a09c6){_0x49b428(null,_0x7a09c6?_0x7a09c6:![]);})['catch'](function(_0x46b672){_0x49b428(_0x46b672);});};AGIVertices[_0xaf2f('0x11')]['sendMailMessage']=function(_0x4e0968,_0xf9c24c,_0x4e2976){this[_0xaf2f('0x10')][_0xaf2f('0x23')](_0x4e0968,_0xf9c24c)[_0xaf2f('0x13')](function(){_0x4e2976(null);})[_0xaf2f('0x17')](function(_0x1b024a){_0x4e2976(_0x1b024a);});};AGIVertices['prototype'][_0xaf2f('0x24')]=function(_0x534b27,_0x4f1ccc){this[_0xaf2f('0xf')][_0xaf2f('0x25')](_0x534b27)['then'](function(_0x54879a){if(_0x54879a){if(_0x54879a[_0xaf2f('0x26')]){_0x4f1ccc(null,[_0x54879a[_0xaf2f('0x27')]]);}else{_0x4f1ccc(null,_[_0xaf2f('0x28')](_0x54879a[_0xaf2f('0x29')],_0xaf2f('0x27')));}}else{_0x4f1ccc(null,![]);}})['catch'](function(_0x1196dd){_0x4f1ccc(_0x1196dd);});};AGIVertices['prototype'][_0xaf2f('0x20')]=function(_0xe6b965){return util[_0xaf2f('0x2a')](_0xaf2f('0x2b'),FILES_PATH,_0xe6b965);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x2c')]=function(_0xfc9e67,_0x41393b,_0x4c66ad){odbc['open'](_0xfc9e67,function(_0x3e3ca6){if(_0x3e3ca6){logger['error'](_0xaf2f('0x2d'),_0x3e3ca6);_0x4c66ad(_0x3e3ca6);}else{logger['info'](_0xaf2f('0x2e'));odbc[_0xaf2f('0x2f')](_0x41393b,function(_0x5e09a7,_0x2c737){if(_0x5e09a7){logger[_0xaf2f('0x30')]('Error\x20executing\x20query\x20%s',_0x41393b);_0x4c66ad(_0x5e09a7);}else{logger[_0xaf2f('0x30')](_0xaf2f('0x31'),_0x41393b);odbc['close'](function(_0x23f46d){if(_0x23f46d){logger['error'](_0xaf2f('0x32'),_0x23f46d);}_0x4c66ad(null,_0x2c737);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x5817dc,_0x3b506e){this[_0xaf2f('0xf')]['getSmsAccountById'](_0x5817dc)[_0xaf2f('0x13')](function(_0x4a33eb){_0x3b506e(null,_0x4a33eb?_0x4a33eb:![]);})['catch'](function(_0x142024){_0x3b506e(_0x142024);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x33')]=function(_0x44471e,_0x97893b){this[_0xaf2f('0xf')][_0xaf2f('0x33')](_0x44471e)[_0xaf2f('0x13')](function(_0x57a493){_0x97893b(null,_0x57a493);})[_0xaf2f('0x17')](function(_0x371551){_0x97893b(_0x371551);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x34')]=function(_0x42811f,_0x5be74c,_0xb718cc){this[_0xaf2f('0xf')][_0xaf2f('0x34')]({'uniqueid':this[_0xaf2f('0xe')][_0xaf2f('0x35')],'node':_0x42811f['label'],'application':_0x42811f[_0xaf2f('0x36')],'data':_0x5be74c||null,'project_name':this[_0xaf2f('0xe')]['arg_1'],'callerid':this[_0xaf2f('0xe')]['callerid']})[_0xaf2f('0x13')](function(_0x3e9660){if(_0xb718cc){_0xb718cc(null,_0x3e9660);}})['catch'](function(_0x29ded1){if(_0xb718cc){_0xb718cc(_0x29ded1);}});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x37')]=function(_0x386a77,_0x530120,_0x5d83aa,_0x2351e1){this[_0xaf2f('0xf')][_0xaf2f('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xaf2f('0xe')]['callerid'],'calleridname':this[_0xaf2f('0xe')][_0xaf2f('0x38')],'context':this['channel'][_0xaf2f('0x39')],'extension':this[_0xaf2f('0xe')][_0xaf2f('0x3a')],'priority':this['channel']['priority'],'accountcode':this[_0xaf2f('0xe')]['accountcode'],'dnid':this[_0xaf2f('0xe')][_0xaf2f('0x3b')],'projectName':this['channel'][_0xaf2f('0x3c')],'saveName':_0x530120,'filename':_0x386a77[_0xaf2f('0x3d')]||_0x530120,'savePath':_0x5d83aa})[_0xaf2f('0x13')](function(_0x92f78c){_0x2351e1(null,_0x92f78c);})[_0xaf2f('0x17')](function(_0x551d53){_0x2351e1(_0x551d53);});};AGIVertices['prototype']['createSquareMessage']=function(_0x21f0fb,_0xd318cb,_0x482604,_0x5d2652,_0xe3518){this[_0xaf2f('0xf')][_0xaf2f('0x3e')]({'uniqueid':this[_0xaf2f('0xe')][_0xaf2f('0x35')],'body':_0x21f0fb,'direction':_0xd318cb,'providerName':_0x482604,'providerResponse':_0x5d2652})[_0xaf2f('0x13')](function(_0x168ec0){if(_0xe3518){_0xe3518(null,_0x168ec0);}})['catch'](function(_0x5dc8f5){if(_0xe3518){_0xe3518(_0x5dc8f5);}});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x3f')]=function(_0x43c0e0,_0x3038d3){this['rpc']['createCmContact']({'firstName':_[_0xaf2f('0x40')](_0x43c0e0[_0xaf2f('0x14')])||_[_0xaf2f('0x41')](_0x43c0e0[_0xaf2f('0x14')])?_0xaf2f('0x42')+Math[_0xaf2f('0x43')]():_0x43c0e0[_0xaf2f('0x14')],'lastName':_[_0xaf2f('0x40')](_0x43c0e0[_0xaf2f('0x44')])||_[_0xaf2f('0x41')](_0x43c0e0[_0xaf2f('0x44')])?null:_0x43c0e0[_0xaf2f('0x44')],'phone':_0x43c0e0[_0xaf2f('0x45')],'ListId':_0x43c0e0['list_id'],'scheduledat':_0x43c0e0[_0xaf2f('0x46')],'callbackUniqueid':this[_0xaf2f('0xe')][_0xaf2f('0x35')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x43c0e0[_0xaf2f('0x46')][_0xaf2f('0x47')](),'priority':_0x43c0e0['callback_priority']})[_0xaf2f('0x13')](function(_0x4e60ee){_0x3038d3(null,_0x4e60ee);})[_0xaf2f('0x17')](function(_0xefdbea){_0x3038d3(_0xefdbea);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x48')]=function(_0x27d176,_0x3095ca){this[_0xaf2f('0xf')]['getPauseById'](_0x27d176)[_0xaf2f('0x13')](function(_0x5c67db){_0x3095ca(null,_0x5c67db?_0x5c67db[_0xaf2f('0x14')]:![]);})['catch'](function(_0x328839){_0x3095ca(_0x328839);});};AGIVertices[_0xaf2f('0x11')]['agentPause']=function(_0x521b84,_0x1beebf,_0x6b27c5){var _0x409eca={'role':_0xaf2f('0x49')};_0x409eca[_0x521b84]=this[_0xaf2f('0xe')][_0xaf2f('0x4a')];this[_0xaf2f('0xf')]['agentPause'](_0x409eca,_0x1beebf,this['channel'][_0xaf2f('0x35')])['then'](function(_0x297f70){_0x6b27c5(null,_[_0xaf2f('0x41')](_0x297f70)?![]:!![]);})[_0xaf2f('0x17')](function(_0xcb0b78){logger[_0xaf2f('0x4b')](_0xcb0b78);_0x6b27c5(null,![]);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x4c')]=function(_0x168bb1,_0x2debde){var _0x346427={'role':_0xaf2f('0x49')};_0x346427[_0x168bb1]=this['channel'][_0xaf2f('0x4a')];this[_0xaf2f('0xf')][_0xaf2f('0x4c')](_0x346427)[_0xaf2f('0x13')](function(_0x9ffc1b){_0x2debde(null,_['isNil'](_0x9ffc1b)?![]:!![]);})[_0xaf2f('0x17')](function(_0x1baa25){logger['error'](_0x1baa25);_0x2debde(null,![]);});};AGIVertices[_0xaf2f('0x11')]['agentLogout']=function(_0x1e2dee,_0x4b86bb){var _0xf751b6={'role':_0xaf2f('0x49')};_0xf751b6[_0x1e2dee]=this[_0xaf2f('0xe')]['callerid'];this['rpc'][_0xaf2f('0x4d')](_0xf751b6)[_0xaf2f('0x13')](function(_0x2d0e14){_0x4b86bb(null,_[_0xaf2f('0x41')](_0x2d0e14)?![]:!![]);})[_0xaf2f('0x17')](function(_0xa4458b){logger[_0xaf2f('0x4b')](_0xa4458b);_0x4b86bb(null,![]);});};AGIVertices[_0xaf2f('0x11')]['agentLogin']=function(_0x7b0b14,_0x120d32){var _0x53becf={'role':_0xaf2f('0x49')};_0x53becf[_0x7b0b14]=this[_0xaf2f('0xe')][_0xaf2f('0x4a')];var _0x3be98e=_0x7b0b14!=_0xaf2f('0x4e')?util[_0xaf2f('0x2a')]('%s/%s@from-sip/n',_0xaf2f('0x4f'),this[_0xaf2f('0xe')][_0xaf2f('0x4a')]):undefined;this[_0xaf2f('0xf')]['agentLogin'](_0x53becf,_0x3be98e)[_0xaf2f('0x13')](function(_0x40d98a){_0x120d32(null,_['isNil'](_0x40d98a)?![]:!![]);})[_0xaf2f('0x17')](function(_0x3820de){logger[_0xaf2f('0x4b')](_0x3820de);_0x120d32(null,![]);});};AGIVertices[_0xaf2f('0x11')]['shellCommand']=function(_0x2f2eeb,_0x342986){sh[_0xaf2f('0x50')](_['trim'](_0x2f2eeb),function(_0x17610c,_0x189e3c){var _0x5edafd=_0x189e3c[_0xaf2f('0x51')](/(\r\n|\n|\r)/gm,'');_0x342986(null,_0x5edafd);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x52')]=function(_0x1ce916,_0x160be1){scripts[_0xaf2f('0x52')](_0x1ce916[_0xaf2f('0x53')],_0x1ce916[_0xaf2f('0x54')]||_0xaf2f('0x55'),_0x1ce916[_0xaf2f('0x55')],_0x1ce916[_0xaf2f('0x56')]||_0xaf2f('0x57'),_0x1ce916['ssmlGender']||_0xaf2f('0x58'),_0x1ce916[_0xaf2f('0x59')]||_0xaf2f('0x5a'))[_0xaf2f('0x13')](function(_0x1ef560){_0x160be1(null,_0x1ef560);})[_0xaf2f('0x17')](function(_0x332431){_0x160be1(_0x332431);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x5b')]=function(_0xc095eb,_0x3a05b0){scripts[_0xaf2f('0x5b')](_0xc095eb[_0xaf2f('0x55')],_0xc095eb[_0xaf2f('0x5c')]||'en',0x1)['then'](function(_0x4c2a77){_0x3a05b0(null,_0x4c2a77);})['catch'](function(_0x3c53d3){_0x3a05b0(_0x3c53d3);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x5d')]=function(_0x41e72,_0x3ad210){var _0x2eb639={'uri':_0x41e72[_0xaf2f('0x5e')],'method':_0x41e72[_0xaf2f('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x41e72[_0xaf2f('0x60')])==='number'&&parseInt(_0x41e72[_0xaf2f('0x60')])>=0x1?parseInt(_0x41e72[_0xaf2f('0x60')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xaf2f('0x61'),_0xaf2f('0x62')],_0x2eb639[_0xaf2f('0x5f')][_0xaf2f('0x63')]())){try{_0x2eb639[_0xaf2f('0x64')]=_0x41e72['rawBody']?JSON[_0xaf2f('0x65')](_0x41e72[_0xaf2f('0xa')]):{};}catch(_0x1023e3){logger['error'](_0xaf2f('0x66'),_0x1023e3);}}try{_0x2eb639['headers']=_0x41e72['rawHeaders']?JSON['parse'](_0x41e72[_0xaf2f('0x9')]):{};}catch(_0x2b97c8){logger[_0xaf2f('0x4b')](_0xaf2f('0x67'),_0x2b97c8);}if(_0x41e72[_0xaf2f('0x68')]){try{var _0x4512f7=require(_0x41e72[_0xaf2f('0x68')])[_0xaf2f('0x69')](this,_0x2eb639);_0x2eb639['uri']=Mustache[_0xaf2f('0x6a')](_0x41e72[_0xaf2f('0x5e')],_0x4512f7,{},['$$','$$']);if(_0x2eb639['headers']){_0x2eb639[_0xaf2f('0x6b')]=JSON[_0xaf2f('0x65')](Mustache[_0xaf2f('0x6a')](JSON[_0xaf2f('0x6c')](_0x2eb639[_0xaf2f('0x6b')]),_0x4512f7,{},['$$','$$']));}if(_0x2eb639[_0xaf2f('0x64')]){_0x2eb639[_0xaf2f('0x64')]=JSON[_0xaf2f('0x65')](Mustache[_0xaf2f('0x6a')](JSON[_0xaf2f('0x6c')](_0x2eb639['body']),_0x4512f7,{},['$$','$$']));}}catch(_0x11c3f9){logger['error'](_0xaf2f('0x6d'),_0x11c3f9);}}rp(_0x2eb639)[_0xaf2f('0x13')](function(_0x4255d1){var _0x47ab7f={'statusCode':_0x4255d1[_0xaf2f('0x6e')]||0xc8,'statusMessage':_0x4255d1[_0xaf2f('0x6f')]||'OK','headers':_0x4255d1[_0xaf2f('0x6b')]||{},'body':_0x4255d1['body']||{}};_0x3ad210(null,_0x47ab7f);})[_0xaf2f('0x17')](function(_0x18cfce){var _0x257809={'statusCode':_0x18cfce[_0xaf2f('0x6e')]||0x1f4,'statusMessage':_0x18cfce['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x18cfce[_0xaf2f('0x70')]['headers']||{},'body':_0x18cfce[_0xaf2f('0x70')][_0xaf2f('0x64')]||{}};_0x3ad210(null,_0x257809);});};AGIVertices['prototype'][_0xaf2f('0x71')]=function(_0x13c4ba,_0x19cc06){scripts[_0xaf2f('0x71')](this[_0xaf2f('0xe')][_0xaf2f('0x35')],_0x13c4ba['key'],_0x13c4ba[_0xaf2f('0x55')],_0x13c4ba['dialogflow_language']||'en')[_0xaf2f('0x13')](function(_0x27989d){_0x19cc06(null,_0x27989d);})['catch'](function(_0x3b9245){_0x19cc06(_0x3b9245);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x72')]=function(_0x25bee0,_0xeb119e){scripts[_0xaf2f('0x72')](this['channel'][_0xaf2f('0x35')],_0x25bee0[_0xaf2f('0x73')],_0x25bee0['client_email'],_0x25bee0[_0xaf2f('0x74')],_0x25bee0[_0xaf2f('0x55')],_0x25bee0[_0xaf2f('0x75')]||'en')[_0xaf2f('0x13')](function(_0x484040){_0xeb119e(null,_0x484040);})[_0xaf2f('0x17')](function(_0x1e55f0){_0xeb119e(_0x1e55f0);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x76')]=function(_0x5cd7d9,_0x4bfdbc){scripts['sestekNDA'](this[_0xaf2f('0xe')],_0x5cd7d9)['then'](function(_0x13bdee){_0x4bfdbc(null,_0x13bdee);})[_0xaf2f('0x17')](function(_0x3a2a97){_0x4bfdbc(_0x3a2a97);});};AGIVertices['prototype']['ispeechTTS']=function(_0x4dcedb,_0x5571b6){scripts[_0xaf2f('0x77')](_0x4dcedb[_0xaf2f('0x78')],_0x4dcedb['text'],_0x4dcedb['ispeech_tts_language']||_0xaf2f('0x57'),_0x4dcedb['speed'])[_0xaf2f('0x13')](function(_0x1a2b7a){_0x5571b6(null,_0x1a2b7a);})[_0xaf2f('0x17')](function(_0x3fe930){_0x5571b6(_0x3fe930);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x79')]=function(_0x343e58,_0x13ed41,_0x45ec80){scripts[_0xaf2f('0x79')](_0x13ed41,_0x343e58[_0xaf2f('0x78')],_0x343e58[_0xaf2f('0x7a')]||_0xaf2f('0x57'),this[_0xaf2f('0x7b')](_0x343e58[_0xaf2f('0x7c')])?_0x343e58[_0xaf2f('0x7c')]:undefined)[_0xaf2f('0x13')](function(_0x32395f){_0x45ec80(null,_0x32395f);})[_0xaf2f('0x17')](function(_0x5eb271){_0x45ec80(_0x5eb271);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x7d')]=function(_0x22146f,_0x2af590){scripts[_0xaf2f('0x7d')](_0x22146f[_0xaf2f('0x7e')],_0x22146f[_0xaf2f('0x7f')],_0x22146f[_0xaf2f('0x80')],_0x22146f[_0xaf2f('0x81')]||'Amy',_0x22146f[_0xaf2f('0x55')],_0x22146f[_0xaf2f('0x82')]||_0xaf2f('0x55'))[_0xaf2f('0x13')](function(_0x5d0fd7){_0x2af590(null,_0x5d0fd7);})[_0xaf2f('0x17')](function(_0x144ad0){_0x2af590(_0x144ad0);});};AGIVertices[_0xaf2f('0x11')]['awsLex']=function(_0x3ded2a,_0x495a93){scripts[_0xaf2f('0x83')](this[_0xaf2f('0xe')]['uniqueid'],_0x3ded2a[_0xaf2f('0x7e')],_0x3ded2a[_0xaf2f('0x7f')],_0x3ded2a[_0xaf2f('0x84')],_0x3ded2a[_0xaf2f('0x55')],_0x3ded2a[_0xaf2f('0x85')])[_0xaf2f('0x13')](function(_0x3c2cec){_0x495a93(null,_0x3c2cec);})['catch'](function(_0x976203){_0x495a93(_0x976203);});};AGIVertices[_0xaf2f('0x11')]['googleASR']=function(_0x37e8bc,_0x5af316,_0x47f13e){scripts[_0xaf2f('0x86')](_0x5af316,_0x37e8bc[_0xaf2f('0x78')],_0x37e8bc[_0xaf2f('0x87')]||'en-US')[_0xaf2f('0x13')](function(_0x153793){_0x47f13e(null,_0x153793);})[_0xaf2f('0x17')](function(_0x13a523){_0x47f13e(_0x13a523);});};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x88')]=function(_0xbc2bee,_0x47413e,_0xb99156){scripts[_0xaf2f('0x88')](_0x47413e,_0xbc2bee['appid'],_0xbc2bee[_0xaf2f('0x89')],_0xbc2bee['uri'])['then'](function(_0x49db6c){_0xb99156(null,_0x49db6c);})[_0xaf2f('0x17')](function(_0x484217){_0xb99156(_0x484217);});};AGIVertices[_0xaf2f('0x11')]['clear']=function(_0x51f6e3){var _0x5ad71b=_[_0xaf2f('0x8a')](verticesWithRetry,_0x51f6e3[_0xaf2f('0x36')])?_0x51f6e3:_[_0xaf2f('0x8b')](_0x51f6e3);for(var _0x4342bf in _0x5ad71b){if(_0x5ad71b[_0xaf2f('0x8c')](_0x4342bf)){if(_0x5ad71b[_0x4342bf]&&_[_0xaf2f('0x8d')](_0x5ad71b[_0x4342bf])){if(_[_0xaf2f('0x8a')](recursiveMapAttributes,_0x4342bf)){_0x5ad71b[_0x4342bf]=this[_0xaf2f('0x8e')](_0x5ad71b[_0x4342bf]);}else{_0x5ad71b[_0x4342bf]=this[_0xaf2f('0x8f')](_0x5ad71b[_0x4342bf]);}}}}return _0x5ad71b;};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x90')]=function(_0x5befae){for(var _0x1b5145 in _0x5befae){if(_0x5befae[_0xaf2f('0x8c')](_0x1b5145)){if(_[_0xaf2f('0x91')](_0x5befae[_0x1b5145])){this['recursiveNodeIndex'](_0x5befae[_0x1b5145]);}else if(_[_0xaf2f('0x92')](_0x5befae[_0x1b5145])){for(var _0x14c36e=0x0;_0x14c36e<_0x5befae[_0x1b5145]['length'];_0x14c36e++){this[_0xaf2f('0x90')](_0x5befae[_0x1b5145][_0x14c36e]);}}else if(_['isString'](_0x5befae[_0x1b5145])){_0x5befae[_0x1b5145]=this[_0xaf2f('0x8f')](_0x5befae[_0x1b5145]);}}}};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x93')]=function(_0x1cb043,_0x15ddba){for(var _0x124fba in _0x1cb043){if(_0x1cb043['hasOwnProperty'](_0x124fba)){if(_[_0xaf2f('0x91')](_0x1cb043[_0x124fba])){if(!_['isEmpty'](_0x1cb043[_0x124fba])){this['saveRestApiResult'](_0x1cb043[_0x124fba],util[_0xaf2f('0x2a')](_0xaf2f('0x94'),_0x15ddba,_0x124fba));}}else if(_[_0xaf2f('0x92')](_0x1cb043[_0x124fba])){for(var _0x2f6533=0x0;_0x2f6533<_0x1cb043[_0x124fba][_0xaf2f('0x95')];_0x2f6533++){this[_0xaf2f('0x93')](_0x1cb043[_0x124fba][_0x2f6533],util['format'](_0xaf2f('0x94'),_0x15ddba,_0x124fba+'['+_0x2f6533+']'));}}else{if(!_['isNil'](_0x1cb043[_0x124fba])){this[_0xaf2f('0xe')][_0xaf2f('0x96')](util[_0xaf2f('0x2a')](_0xaf2f('0x94'),_0x15ddba,_0x124fba),_0x1cb043[_0x124fba]);}}}}};AGIVertices['prototype'][_0xaf2f('0x8e')]=function(_0x592aa4){try{var _0x70b29d=JSON[_0xaf2f('0x65')](_0x592aa4);this[_0xaf2f('0x90')](_0x70b29d);return JSON[_0xaf2f('0x6c')](_0x70b29d);}catch(_0xa9c926){return this[_0xaf2f('0x8f')](_0x592aa4);}};AGIVertices[_0xaf2f('0x11')]['replaceAllVariables']=function(_0x5f3e02){var _0xeb8258=_0x5f3e02['split']('{');for(var _0x59e738=0x1;_0x59e738<_0xeb8258['length'];_0x59e738+=0x1){var _0x1e0da=_0xeb8258[_0x59e738][_0xaf2f('0x97')]('}');if(_0x1e0da[_0xaf2f('0x95')]>0x1){_0x5f3e02=_0x5f3e02[_0xaf2f('0x98')]('{'+_0x1e0da[0x0]+'}',this[_0xaf2f('0xe')][_0xaf2f('0x12')](_0x1e0da[0x0])['extra']||_0x1e0da[0x0]);}}if(_0xeb8258[_0xaf2f('0x95')]===0x1){return _0x5f3e02[_0xaf2f('0x47')]();}return this[_0xaf2f('0x8f')](_0x5f3e02);};AGIVertices['prototype'][_0xaf2f('0x99')]=function(_0x423f01,_0x434847){var _0x554acf=this['channel']['getVariable'](_0x423f01);if(_0x554acf[_0xaf2f('0x9a')]===-0x1){return _0x554acf;}logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x9b'),_0x434847,_0x554acf[_0xaf2f('0x9c')]));return this['channel'][_0xaf2f('0x96')](_0x434847,_0x554acf[_0xaf2f('0x9c')]);};AGIVertices['prototype'][_0xaf2f('0x7b')]=function(_0x316b36){return _0x316b36&&_0x316b36!=='0'&&_0x316b36!=='-1'&&_0x316b36!=='';};AGIVertices[_0xaf2f('0x11')]['maxRetry']=function(_0x25fa5d){this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x25fa5d,'-');_0x25fa5d[_0xaf2f('0x9d')]=_0x25fa5d['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x9e')]=function(_0x4af6c4){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x9f'),_0x4af6c4[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x4af6c4['text'])){return this[_0xaf2f('0xe')]['noop'](_0xaf2f('0xa1'));}var _0x4a7fa8='\x22'+_0x4af6c4[_0xaf2f('0x55')]+'\x22';if(this[_0xaf2f('0x7b')](_0x4af6c4[_0xaf2f('0x70')])){_0x4a7fa8+=','+_0x4af6c4[_0xaf2f('0x70')];}var _0x10ca27=this['channel'][_0xaf2f('0x50')](_0xaf2f('0xa2'),_0x4a7fa8);if(_0x10ca27[_0xaf2f('0x9a')]===-0x1){return _0x10ca27;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xa4'),_0x4a7fa8));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xa5')]=function(_0x5c05ae){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xa6'),_0x5c05ae[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x5c05ae[_0xaf2f('0xa7')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xa8'));}var _0x189a85=_0x5c05ae[_0xaf2f('0xa7')];if(this['isConfigured'](_0x5c05ae[_0xaf2f('0x70')])){_0x189a85+=','+_0x5c05ae['options'];}var _0x237a51=this['channel'][_0xaf2f('0x50')](_0xaf2f('0xa9'),_0x189a85);if(_0x237a51[_0xaf2f('0x9a')]===-0x1){return _0x237a51;}var _0x40a39a=this[_0xaf2f('0x99')](_0xaf2f('0xaa'),_0xaf2f('0xab'));if(_0x40a39a['result']===-0x1){return _0x40a39a;}var _0x3d9ad7=this[_0xaf2f('0x99')](_0xaf2f('0xac'),_0xaf2f('0xad'));if(_0x3d9ad7[_0xaf2f('0x9a')]===-0x1){return _0x3d9ad7;}var _0x25b160=this[_0xaf2f('0x99')]('RECOG_INSTANCE()',_0xaf2f('0xae'));if(_0x25b160[_0xaf2f('0x9a')]===-0x1){return _0x25b160;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xaf'),_0x189a85));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x7')]=function(_0x4731d1){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xb0'),_0x4731d1[_0xaf2f('0xa0')]));return this[_0xaf2f('0xe')]['agi']([_0x4731d1[_0xaf2f('0xb1')],_0x4731d1[_0xaf2f('0xb2')]]);};AGIVertices['prototype'][_0xaf2f('0xb3')]=function(_0x2399bb){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xb4'),_0x2399bb[_0xaf2f('0xa0')]));if(this[_0xaf2f('0x7b')](_0x2399bb[_0xaf2f('0x60')])){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xb5'),_0x2399bb[_0xaf2f('0x60')]));var _0x546f26=this['channel'][_0xaf2f('0xb6')](_0x2399bb[_0xaf2f('0x60')]);if(_0x546f26[_0xaf2f('0x9a')]===-0x1){return _0x546f26;}}return this[_0xaf2f('0xe')][_0xaf2f('0xb3')]();};AGIVertices['prototype'][_0xaf2f('0xb7')]=function(_0x4db3f8){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xb8'),_0x4db3f8['label']));if(!this['isConfigured'](_0x4db3f8[_0xaf2f('0xb9')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x4db3f8,_0xaf2f('0xba'));}_0x4db3f8[_0xaf2f('0x46')]=moment();if(this['isConfigured'](_0x4db3f8[_0xaf2f('0xbb')])){_0x4db3f8['scheduledAt']=moment()[_0xaf2f('0xbc')](_0x4db3f8[_0xaf2f('0xbb')],_0xaf2f('0xbd'));}if(!this[_0xaf2f('0x7b')](_0x4db3f8[_0xaf2f('0xbe')])){_0x4db3f8['callback_priority']=0x2;}this[_0xaf2f('0x3f')]['sync'](this,_0x4db3f8);return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4db3f8[_0xaf2f('0x45')],_0x4db3f8[_0xaf2f('0xb9')],_0x4db3f8[_0xaf2f('0x46')]));};AGIVertices['prototype'][_0xaf2f('0xbf')]=function(_0x51c713){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xc0'),_0x51c713[_0xaf2f('0xa0')]));var _0x1d8104=this[_0xaf2f('0xe')]['exec'](_0x51c713[_0xaf2f('0xc1')],_0x51c713[_0xaf2f('0x70')]);if(_0x1d8104['result']===-0x1){return _0x1d8104;}return this[_0xaf2f('0xe')]['noop'](util[_0xaf2f('0x2a')]('Executed\x20command\x20%s\x20%s',_0x51c713[_0xaf2f('0xc1')],_0x51c713[_0xaf2f('0x70')]));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xc2')]=function(_0x2107fc){logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0xc3'),_0x2107fc[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x2107fc['text'])){return this['channel'][_0xaf2f('0xa3')]('no\x20text\x20configured');}var _0x4f342e='\x22'+_0x2107fc['text']+'\x22';if(this[_0xaf2f('0x7b')](_0x2107fc[_0xaf2f('0x70')])){_0x4f342e+=','+_0x2107fc[_0xaf2f('0x70')];}var _0x8abd0a=this[_0xaf2f('0xe')]['exec']('MRCPSynth',_0x4f342e);if(_0x8abd0a[_0xaf2f('0x9a')]===-0x1){return _0x8abd0a;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xa4'),_0x4f342e));};AGIVertices[_0xaf2f('0x11')]['sestektts']=function(_0x123b4a){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xc4'),_0x123b4a['label']));if(!this[_0xaf2f('0x7b')](_0x123b4a[_0xaf2f('0x55')])){return this['channel'][_0xaf2f('0xa3')]('no\x20text\x20configured');}var _0x46404c='\x22'+_0x123b4a['text']+'\x22';if(this[_0xaf2f('0x7b')](_0x123b4a[_0xaf2f('0x70')])){_0x46404c+=','+_0x123b4a[_0xaf2f('0x70')];}var _0x4e4c51=this[_0xaf2f('0xe')][_0xaf2f('0x50')](_0xaf2f('0xa2'),_0x46404c);if(_0x4e4c51[_0xaf2f('0x9a')]===-0x1){return _0x4e4c51;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xa4'),_0x46404c));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xc5')]=function(_0x2f1d1d){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2f1d1d['label']));if(!this[_0xaf2f('0x7b')](_0x2f1d1d[_0xaf2f('0xa7')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xa8'));}var _0x44210c=_0x2f1d1d[_0xaf2f('0xa7')];if(this[_0xaf2f('0x7b')](_0x2f1d1d[_0xaf2f('0x70')])){_0x44210c+=','+_0x2f1d1d['options'];}var _0x40f2fc=this[_0xaf2f('0xe')][_0xaf2f('0x50')](_0xaf2f('0xa9'),_0x44210c);if(_0x40f2fc[_0xaf2f('0x9a')]===-0x1){return _0x40f2fc;}var _0x2417df=this[_0xaf2f('0x99')](_0xaf2f('0xaa'),_0xaf2f('0xc6'));if(_0x2417df[_0xaf2f('0x9a')]===-0x1){return _0x2417df;}var _0x922f5d=this[_0xaf2f('0x99')](_0xaf2f('0xac'),_0xaf2f('0xc7'));if(_0x922f5d[_0xaf2f('0x9a')]===-0x1){return _0x922f5d;}var _0x110890=this['getAndSetVariable'](_0xaf2f('0xc8'),'LUMENVOX_ASR_INSTANCE');if(_0x110890[_0xaf2f('0x9a')]===-0x1){return _0x110890;}return this['channel'][_0xaf2f('0xa3')](util['format'](_0xaf2f('0xaf'),_0x44210c));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xc9')]=function(_0x24f5aa){logger[_0xaf2f('0x30')](util['format'](_0xaf2f('0xca'),_0x24f5aa[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x24f5aa[_0xaf2f('0xa7')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xa8'));}var _0x165ec0=_0x24f5aa[_0xaf2f('0xa7')];if(this['isConfigured'](_0x24f5aa[_0xaf2f('0x70')])){_0x165ec0+=','+_0x24f5aa[_0xaf2f('0x70')];}var _0x5c9d21=this[_0xaf2f('0xe')][_0xaf2f('0x50')](_0xaf2f('0xa9'),_0x165ec0);if(_0x5c9d21['result']===-0x1){return _0x5c9d21;}var _0x462692=this[_0xaf2f('0x99')](_0xaf2f('0xaa'),_0xaf2f('0xcb'));if(_0x462692[_0xaf2f('0x9a')]===-0x1){return _0x462692;}var _0x5f1cae=this[_0xaf2f('0x99')]('RECOG_INPUT()',_0xaf2f('0xcc'));if(_0x5f1cae[_0xaf2f('0x9a')]===-0x1){return _0x5f1cae;}var _0x4a5398=this[_0xaf2f('0x99')](_0xaf2f('0xc8'),_0xaf2f('0xcd'));if(_0x4a5398[_0xaf2f('0x9a')]===-0x1){return _0x4a5398;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xaf'),_0x165ec0));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xce')]=function(_0x5be507){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5be507[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x5be507[_0xaf2f('0xcf')])){return this['channel'][_0xaf2f('0x4b')](_0x5be507,_0xaf2f('0xd0'));}var _0x1ebee6=this[_0xaf2f('0xd1')][_0xaf2f('0x69')](this,_0x5be507[_0xaf2f('0xcf')]);if(!_0x1ebee6){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5be507,_0xaf2f('0xd2'));}if(!this[_0xaf2f('0x7b')](_0x5be507[_0xaf2f('0x2f')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5be507,_0xaf2f('0xd3'));}var _0x54d84c=_0x5be507[_0xaf2f('0x2f')][_0xaf2f('0x51')](/(\r\n|\n|\r)/gm,'\x20');this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xd4'),_0x54d84c));var _0x580738=this[_0xaf2f('0x2c')]['sync'](this,_0x1ebee6,_0x54d84c);this[_0xaf2f('0x34')]['sync'](this,_0x5be507,_0x54d84c);if(!this[_0xaf2f('0x7b')](_0x5be507['variable_id'])){return this[_0xaf2f('0xe')]['noop'](_0xaf2f('0xd5'));}var _0x129200=this[_0xaf2f('0x12')][_0xaf2f('0x69')](this,_0x5be507['variable_id']);if(!_0x129200){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5be507,_0xaf2f('0xd6'));}var _0x481470=this;_0x580738[_0xaf2f('0xd7')](function(_0x45f44e,_0x3606d0){Object['keys'](_0x45f44e)[_0xaf2f('0xd7')](function(_0x51694f){_0x481470[_0xaf2f('0xe')][_0xaf2f('0x96')](util['format'](_0xaf2f('0xd8'),_0x129200,_0x3606d0,_0x51694f),_0x45f44e[_0x51694f]);});});this['channel'][_0xaf2f('0x96')](util[_0xaf2f('0x2a')]('%s_ROWS_COUNT',_0x129200),_0x580738['length']);return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('variable\x20%s\x20set',_0x129200));};AGIVertices['prototype'][_0xaf2f('0xd9')]=function(_0x51acd9){logger['debug'](util[_0xaf2f('0x2a')](_0xaf2f('0xda'),_0x51acd9[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x51acd9[_0xaf2f('0xdb')])){return this[_0xaf2f('0xe')]['error'](_0x51acd9,'no\x20user\x20selected');}var _0x2b534c=this[_0xaf2f('0x1b')][_0xaf2f('0x69')](this,_0x51acd9[_0xaf2f('0xdb')]);if(!_0x2b534c){return this['channel'][_0xaf2f('0x4b')](_0x51acd9,_0xaf2f('0xdc'));}var _0x35c43f=this[_0xaf2f('0xe')]['exec']('DIAL',[util[_0xaf2f('0x2a')](_0xaf2f('0xdd'),_0x2b534c),_0x51acd9[_0xaf2f('0x60')],_0x51acd9[_0xaf2f('0xde')],_0x51acd9[_0xaf2f('0x5e')]]);if(_0x35c43f[_0xaf2f('0x9a')]===-0x1){return _0x35c43f;}return this[_0xaf2f('0xe')]['noop'](util[_0xaf2f('0x2a')](_0xaf2f('0xdf'),'DIAL'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xe0')]=function(_0x44e7e3){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0xe1'),_0x44e7e3[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x44e7e3[_0xaf2f('0x78')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('no\x20key\x20configured');}if(!this[_0xaf2f('0x7b')](_0x44e7e3[_0xaf2f('0x55')])){return this['channel'][_0xaf2f('0xa3')]('no\x20text\x20configured');}this[_0xaf2f('0xe')][_0xaf2f('0xe2')]=!![];this[_0xaf2f('0x34')](_0x44e7e3);this[_0xaf2f('0x3e')](_0x44e7e3['text'],'in','','');this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xe3'),_0x44e7e3[_0xaf2f('0x55')]));var _0x3e3895=this[_0xaf2f('0x71')]['sync'](this,_0x44e7e3);if(_0x3e3895){for(var _0x522297 in _0x3e3895){if(_0x3e3895[_0xaf2f('0x8c')](_0x522297)){this['channel'][_0xaf2f('0x96')](util[_0xaf2f('0x2a')](_0xaf2f('0xe4'),_0x522297['toUpperCase']()),_0x3e3895[_0x522297]);}}this[_0xaf2f('0x3e')](_0x3e3895[_0xaf2f('0xe5')],_0xaf2f('0xe6'),_0xaf2f('0xe0'),'');return this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('Dialogflow\x20Result\x20%s',_0x3e3895[_0xaf2f('0xe5')]));}return this[_0xaf2f('0xe')]['error'](_0x44e7e3,_0xaf2f('0xe7'));};AGIVertices[_0xaf2f('0x11')]['dialogflowV2']=function(_0x10ac22){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x10ac22[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x10ac22['dialogflowV2_project_id'])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xe8'));}if(!this[_0xaf2f('0x7b')](_0x10ac22[_0xaf2f('0xe9')])){return this['channel'][_0xaf2f('0xa3')](_0xaf2f('0xea'));}if(!this[_0xaf2f('0x7b')](_0x10ac22[_0xaf2f('0x74')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x10ac22[_0xaf2f('0x75')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('no\x20anguage\x20configured');}if(!this[_0xaf2f('0x7b')](_0x10ac22['text'])){return this['channel'][_0xaf2f('0xa3')](_0xaf2f('0xa1'));}this[_0xaf2f('0xe')]['bot']=!![];this[_0xaf2f('0x34')](_0x10ac22);this[_0xaf2f('0x3e')](_0x10ac22[_0xaf2f('0x55')],'in','','');this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0x10ac22[_0xaf2f('0x55')]));var _0x33391=this[_0xaf2f('0x72')][_0xaf2f('0x69')](this,_0x10ac22);if(_0x33391){for(var _0x3870b5 in _0x33391){if(_0x33391['hasOwnProperty'](_0x3870b5)){if(_0x3870b5!=='providerResponse'){this['channel'][_0xaf2f('0x96')](util[_0xaf2f('0x2a')](_0xaf2f('0xe4'),_0x3870b5[_0xaf2f('0x63')]()),_0x33391[_0x3870b5]);}}}this[_0xaf2f('0x3e')](_0x33391['speech'],_0xaf2f('0xe6'),_0xaf2f('0xeb'),_0x33391[_0xaf2f('0xec')]);return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util['format'](_0xaf2f('0xed'),_0x33391[_0xaf2f('0xe5')]));}return this[_0xaf2f('0xe')]['error'](_0x10ac22,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xee')]=function(_0x34600b){logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0xef'),_0x34600b[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x34600b['ndauth_url'])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xf0'));}if(!this['isConfigured'](_0x34600b[_0xaf2f('0xf1')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('no\x20username\x20configured');}if(!this[_0xaf2f('0x7b')](_0x34600b[_0xaf2f('0xf2')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xf3'));}if(!this['isConfigured'](_0x34600b[_0xaf2f('0xf4')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xa1'));}this[_0xaf2f('0xe')][_0xaf2f('0xe2')]=!![];this['createSquareDetailsReport'](_0x34600b);this[_0xaf2f('0x3e')](_0x34600b['text'],'in','','');this[_0xaf2f('0xe')]['noop'](util['format'](_0xaf2f('0xf5'),_0x34600b[_0xaf2f('0x55')]));var _0x288c47=this[_0xaf2f('0x76')]['sync'](this,_0x34600b);if(_0x288c47){for(var _0x1b2f38 in _0x288c47){if(_0x288c47['hasOwnProperty'](_0x1b2f38)){this[_0xaf2f('0xe')]['setVariable'](util[_0xaf2f('0x2a')](_0xaf2f('0xf6'),_0x1b2f38[_0xaf2f('0x63')]()),_0x288c47[_0x1b2f38]);}}this[_0xaf2f('0x3e')](_0x288c47[_0xaf2f('0xe5')],_0xaf2f('0xe6'),_0xaf2f('0xee'),'');if(_0x288c47[_0xaf2f('0xf7')]){this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xf8'),_0x288c47[_0xaf2f('0xf7')]));var _0xafc1c=this[_0xaf2f('0xe')][_0xaf2f('0xf9')](_0x288c47['audiofile']);try{fs[_0xaf2f('0xfa')](_0x288c47['audiofile']+_0xaf2f('0xfb'));}catch(_0x22ff49){logger[_0xaf2f('0x4b')](_0x22ff49);}return _0xafc1c;}else{return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xfc'),_0x288c47[_0xaf2f('0xe5')]));}}return this[_0xaf2f('0xe')]['error'](_0x34600b,_0xaf2f('0xfd'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xfe')]=function(_0x1de665){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1de665['label']));return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xfe'));};AGIVertices[_0xaf2f('0x11')]['ext_dial']=function(_0x5daae8){logger['info'](util[_0xaf2f('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5daae8[_0xaf2f('0xa0')]));var _0x23c96b='';if(_0x5daae8[_0xaf2f('0xff')]){if(!this[_0xaf2f('0x7b')](_0x5daae8[_0xaf2f('0xff')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5daae8,'no\x20trunk\x20selected');}else{var _0x3a51c9=parseInt(_0x5daae8['trunk_id'],0xa);if(isNaN(_0x3a51c9)){_0x23c96b=_0x5daae8[_0xaf2f('0xff')];}else{_0x23c96b=this['getTrunk'][_0xaf2f('0x69')](this,_0x5daae8[_0xaf2f('0xff')]);if(!_0x23c96b){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5daae8,_0xaf2f('0x100'));}}}}else if(_0x5daae8[_0xaf2f('0x101')]){_0x23c96b=_0x5daae8[_0xaf2f('0x101')];}else{return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5daae8,'no\x20trunk\x20selected');}var _0x366bc8=this[_0xaf2f('0xe')][_0xaf2f('0x50')](_0xaf2f('0x102'),[util[_0xaf2f('0x2a')]('SIP/%s/%s',_0x23c96b,_0x5daae8['phone']),_0x5daae8[_0xaf2f('0x60')],_0x5daae8[_0xaf2f('0xde')],_0x5daae8[_0xaf2f('0x5e')]]);if(_0x366bc8[_0xaf2f('0x9a')]===-0x1){return _0x366bc8;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0xdf'),'DIAL'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x103')]=function(_0x9cd651){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x104'),_0x9cd651[_0xaf2f('0xa0')]));return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x103'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xc')]=function(_0x12f321){logger[_0xaf2f('0x30')](util['format'](_0xaf2f('0x105'),_0x12f321[_0xaf2f('0xa0')]));if(_0x12f321[_0xaf2f('0x9d')]===0x0){return this['maxRetry'](_0x12f321);}_0x12f321['retry']-=0x1;if(!this[_0xaf2f('0x7b')](_0x12f321[_0xaf2f('0x106')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x12f321,'no\x20file\x20audio\x20selected');}var _0x21ba35=this[_0xaf2f('0x107')]['sync'](this,_0x12f321[_0xaf2f('0x106')]);if(!_0x21ba35){return this['channel'][_0xaf2f('0x4b')](_0x12f321,_0xaf2f('0x108'));}if(!this[_0xaf2f('0x7b')](_0x12f321[_0xaf2f('0x109')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0xaf2f('0xd5'));}var _0x351b64=this['channel'][_0xaf2f('0x10a')](_0x21ba35,_0x12f321['response'],_0x12f321[_0xaf2f('0x10b')]);var _0x2c987b=_0x351b64[_0xaf2f('0x9a')]?_0x351b64['result'][_0xaf2f('0x47')]():'';logger['info'](_0xaf2f('0x10c'),JSON['stringify'](_0x351b64));if(_0x351b64[_0xaf2f('0x9a')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x12f321,_0x2c987b);return _0x351b64;}else if(_0x351b64[_0xaf2f('0x9c')]==='timeout'){_0x351b64[_0xaf2f('0x9a')]=_0x2c987b[_0xaf2f('0x95')]>=parseInt(_0x12f321[_0xaf2f('0x10d')])?'x':'i';}else{_0x351b64['result']=_0x2c987b[_0xaf2f('0x95')]>=parseInt(_0x12f321[_0xaf2f('0x10d')])&&_0x2c987b[_0xaf2f('0x95')]<=parseInt(_0x12f321['maxdigit'])?'x':'i';}var _0x43262e=this[_0xaf2f('0x12')]['sync'](this,_0x12f321[_0xaf2f('0x109')]);if(!_0x43262e){return this['channel'][_0xaf2f('0x4b')](_0x12f321,_0xaf2f('0xd6'));}this['channel'][_0xaf2f('0x96')](_0x43262e,_0x2c987b);if(this[_0xaf2f('0x7b')](_0x12f321[_0xaf2f('0x10e')])){var _0x3e68ff=parseInt(_0x12f321['hiddendigitsnum'],0xa);var _0x270016=rs[_0xaf2f('0x10f')]({'charset':'*','length':_0x3e68ff});var _0x459f6b=_0x2c987b[_0xaf2f('0x95')];if(_0x459f6b>0x0){if(_0x459f6b>_0x3e68ff){this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x12f321,_0x12f321['hiddendigitspos']===_0xaf2f('0x110')?_0x270016+_0x2c987b['substr'](_0x3e68ff):_0x2c987b[_0xaf2f('0x111')](0x0,_0x459f6b-_0x3e68ff)+_0x270016);}else{this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x12f321,rs[_0xaf2f('0x10f')]({'charset':'*','length':_0x459f6b}));}}else{this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x12f321,'');}}else{this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x12f321,_0x2c987b);}return _0x351b64;};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0xd')]=function(_0x242d72){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x112'),_0x242d72[_0xaf2f('0xa0')]));return this[_0xaf2f('0xc')](_0x242d72);};AGIVertices[_0xaf2f('0x11')]['goal']=function(_0x1c4a43){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1c4a43[_0xaf2f('0xa0')]));this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x1c4a43,_0x1c4a43[_0xaf2f('0x113')]);return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x114'),_0x1c4a43['goalname']));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x115')]=function(_0x52fd13){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x52fd13[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x52fd13[_0xaf2f('0x7e')])||!this[_0xaf2f('0x7b')](_0x52fd13[_0xaf2f('0x7f')])){return this['channel']['noop'](_0xaf2f('0x116'));}if(!this[_0xaf2f('0x7b')](_0x52fd13[_0xaf2f('0x55')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xa1'));}this['channel'][_0xaf2f('0xa3')](util['format'](_0xaf2f('0x117'),_0x52fd13[_0xaf2f('0x55')]));var _0x525bc3=this[_0xaf2f('0x7d')][_0xaf2f('0x69')](this,_0x52fd13);if(_0x525bc3){this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x525bc3));var _0x1fd33d=this[_0xaf2f('0xe')][_0xaf2f('0xf9')](_0x525bc3);try{fs['unlink'](_0x525bc3+_0xaf2f('0xfb'));}catch(_0x542b9c){logger[_0xaf2f('0x4b')](_0x542b9c);}return _0x1fd33d;}return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x52fd13,_0xaf2f('0x118'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x119')]=function(_0x5406b7){logger[_0xaf2f('0x30')](util['format'](_0xaf2f('0x11a'),_0x5406b7[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x5406b7['aws_access_key_id'])||!this[_0xaf2f('0x7b')](_0x5406b7['aws_secret_access_key'])){return this['channel'][_0xaf2f('0xa3')](_0xaf2f('0x116'));}if(!this[_0xaf2f('0x7b')](_0x5406b7['aws_bot_name'])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x11b'));}if(!this['isConfigured'](_0x5406b7[_0xaf2f('0x55')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xa1'));}this[_0xaf2f('0xe')][_0xaf2f('0xe2')]=!![];this[_0xaf2f('0x34')](_0x5406b7);this[_0xaf2f('0x3e')](_0x5406b7[_0xaf2f('0x55')],'in','','');this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x11c'),_0x5406b7[_0xaf2f('0x55')]));var _0x47ae3b=this[_0xaf2f('0x83')][_0xaf2f('0x69')](this,_0x5406b7);if(_0x47ae3b){for(var _0x3a6a27 in _0x47ae3b){if(_0x47ae3b[_0xaf2f('0x8c')](_0x3a6a27)&&_[_0xaf2f('0x8d')](_0x47ae3b[_0x3a6a27])){this['channel'][_0xaf2f('0x96')](util[_0xaf2f('0x2a')]('AWS_LEX_%s',_0x3a6a27[_0xaf2f('0x63')]()),_0x47ae3b[_0x3a6a27]);}}if(_[_0xaf2f('0x41')](_0x47ae3b[_0xaf2f('0x11d')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x11e'));}else{this['createSquareMessage'](_0x47ae3b[_0xaf2f('0x11d')],'out','amazonlex','');return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util['format'](_0xaf2f('0x11f'),_0x47ae3b[_0xaf2f('0x11d')]));}}return this['channel'][_0xaf2f('0x4b')](_0x5406b7,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x120')]=function(_0x40ec12){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x121'),_0x40ec12['label'],_0x40ec12['timeout']));if(!this[_0xaf2f('0x7b')](_0x40ec12[_0xaf2f('0x78')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('no\x20key\x20configured');}var _0x32a806=_0xaf2f('0x122');var _0x46dee7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xaf2f('0x10f')](0x4));var _0x19fbbd=util[_0xaf2f('0x2a')](_0xaf2f('0x94'),_0x46dee7,_0x32a806);var _0x1ea6ee=!![];if(_0x40ec12[_0xaf2f('0x123')]===_0xaf2f('0x124')){_0x1ea6ee=![];}var _0x44aec6=this[_0xaf2f('0xe')][_0xaf2f('0x125')](_0x46dee7,_0x32a806,_0x40ec12[_0xaf2f('0x126')],_0x40ec12['timeout'],undefined,_0x1ea6ee);if(_0x44aec6[_0xaf2f('0x9a')]!==-0x1){this[_0xaf2f('0xe')]['noop'](util['format'](_0xaf2f('0x127'),_0x19fbbd));var _0x4a0874=this[_0xaf2f('0x86')]['sync'](this,_0x40ec12,_0x19fbbd);if(_0x4a0874){for(var _0x868997 in _0x4a0874){if(_0x4a0874[_0xaf2f('0x8c')](_0x868997)){this['channel'][_0xaf2f('0x96')](util[_0xaf2f('0x2a')](_0xaf2f('0x128'),_0x868997[_0xaf2f('0x63')]()),_0x4a0874[_0x868997]);}}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('GoogleASR\x20Result\x20%s',JSON[_0xaf2f('0x6c')](_0x4a0874)));}}return _0x44aec6;};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x129')]=function(_0x5df1d8){logger['info'](util['format'](_0xaf2f('0x12a'),_0x5df1d8[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x5df1d8[_0xaf2f('0x12b')])){return this['channel']['noop'](_0xaf2f('0x12c'));}if(!this[_0xaf2f('0x7b')](_0x5df1d8[_0xaf2f('0x89')])){return this['channel'][_0xaf2f('0xa3')](_0xaf2f('0x12d'));}var _0x5e1174=_0xaf2f('0x122');var _0x43ebf0=util[_0xaf2f('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xaf2f('0x10f')](0x4));var _0x2b628f=util[_0xaf2f('0x2a')](_0xaf2f('0x94'),_0x43ebf0,_0x5e1174);var _0x22077f=!![];if(_0x5df1d8[_0xaf2f('0x123')]===_0xaf2f('0x124')){_0x22077f=![];}var _0x518671=this[_0xaf2f('0xe')]['recordFile'](_0x43ebf0,_0x5e1174,_0x5df1d8[_0xaf2f('0x126')],_0x5df1d8[_0xaf2f('0x60')],undefined,_0x22077f);if(_0x518671[_0xaf2f('0x9a')]!==-0x1){this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x12e'),_0x2b628f));var _0x385dab=this[_0xaf2f('0x88')]['sync'](this,_0x5df1d8,_0x2b628f);if(_0x385dab){for(var _0x2f63ce in _0x385dab){if(_0x385dab['hasOwnProperty'](_0x2f63ce)){this[_0xaf2f('0xe')][_0xaf2f('0x96')](util[_0xaf2f('0x2a')]('TILDE_ASR_%s',_0x2f63ce[_0xaf2f('0x63')]()),_0x385dab[_0x2f63ce]);}}return this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x385dab)));}}return _0x518671;};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x12f')]=function(_0x1d93e6){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x130'),_0x1d93e6[_0xaf2f('0xa0')]));return this['channel'][_0xaf2f('0x131')](_0x1d93e6[_0xaf2f('0x39')],_0x1d93e6['extension'],_0x1d93e6['priority']);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x132')]=function(_0x4b7600){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x133'),_0x4b7600[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x4b7600[_0xaf2f('0x134')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x4b7600,'no\x20condition\x20configured');}try{var _0x42fa38=eval(_0x4b7600[_0xaf2f('0x134')])?_0xaf2f('0x135'):_0xaf2f('0x136');this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4b7600[_0xaf2f('0x134')],_0x42fa38));return{'code':0xc8,'result':_0x42fa38};}catch(_0x5e20b1){return{'code':0xc8,'result':_0xaf2f('0x136')};}};AGIVertices['prototype'][_0xaf2f('0x137')]=function(_0x565e91){logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0x138'),_0x565e91[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x565e91['interval_id'])){return this['channel']['error'](_0x565e91,_0xaf2f('0x139'));}var _0x102e05=this[_0xaf2f('0x24')]['sync'](this,_0x565e91[_0xaf2f('0x13a')]);if(!_0x102e05){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x565e91,_0xaf2f('0x13b'));}for(var _0x590cfa=0x0;_0x590cfa<_0x102e05['length'];_0x590cfa+=0x1){var _0x4f0c30=this[_0xaf2f('0xe')]['getVariable'](util[_0xaf2f('0x2a')](_0xaf2f('0x13c'),_0x102e05[_0x590cfa]));if(_0x4f0c30[_0xaf2f('0x9a')]===-0x1){return _0x4f0c30;}logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x13d'),_0x102e05[_0x590cfa],_0x4f0c30[_0xaf2f('0x9c')]));if(_0x4f0c30[_0xaf2f('0x9c')]==='true'){logger[_0xaf2f('0x30')](util['format'](_0xaf2f('0x13d'),_0x102e05[_0x590cfa],'true'));this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x13d'),_0x102e05[_0x590cfa],_0xaf2f('0x135')));return{'code':0xc8,'result':_0xaf2f('0x135')};}else{logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x13d'),_0x102e05[_0x590cfa],_0xaf2f('0x136')));this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('IFTIME\x20%s\x20%s',_0x102e05[_0x590cfa],_0xaf2f('0x136')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x13e')]=function(_0x4b0aa6){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x4b0aa6['label']));return this['channel'][_0xaf2f('0x13e')]();};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x13f')]=function(_0x47c29d){logger['info'](util[_0xaf2f('0x2a')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x47c29d[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x47c29d[_0xaf2f('0x78')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x140'));}var _0x4da9c8=_0xaf2f('0x122');var _0x5b2982=util[_0xaf2f('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xaf2f('0x10f')](0x4));var _0x20742a=util[_0xaf2f('0x2a')](_0xaf2f('0x94'),_0x5b2982,_0x4da9c8);var _0x1011ab=!![];if(_0x47c29d[_0xaf2f('0x123')]===_0xaf2f('0x124')){_0x1011ab=![];}var _0x570908=this['channel'][_0xaf2f('0x125')](_0x5b2982,_0x4da9c8,_0x47c29d['intKey'],_0x47c29d['timeout'],undefined,_0x1011ab);if(_0x570908['result']!==-0x1){this[_0xaf2f('0xe')]['noop'](util[_0xaf2f('0x2a')](_0xaf2f('0x141'),_0x20742a));var _0xe576fe=this[_0xaf2f('0x79')]['sync'](this,_0x47c29d,_0x20742a);if(_0xe576fe){for(var _0x4e258e in _0xe576fe){if(_0xe576fe[_0xaf2f('0x8c')](_0x4e258e)){this[_0xaf2f('0xe')][_0xaf2f('0x96')](util[_0xaf2f('0x2a')](_0xaf2f('0x142'),_0x4e258e[_0xaf2f('0x63')]()),_0xe576fe[_0x4e258e]);}}return this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x143'),JSON[_0xaf2f('0x6c')](_0xe576fe)));}}return _0x570908;};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x144')]=function(_0x2ec0ce){logger['info'](util[_0xaf2f('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2ec0ce['label']));if(!this['isConfigured'](_0x2ec0ce[_0xaf2f('0x78')])){return this['channel']['noop'](_0xaf2f('0x140'));}if(!this['isConfigured'](_0x2ec0ce['text'])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xa1'));}this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x145'),_0x2ec0ce[_0xaf2f('0x55')]));var _0x2ea491=this[_0xaf2f('0x77')][_0xaf2f('0x69')](this,_0x2ec0ce);if(_0x2ea491){this['channel'][_0xaf2f('0xa3')](util['format'](_0xaf2f('0x141'),_0x2ea491));var _0x168d6c=this[_0xaf2f('0xe')][_0xaf2f('0xf9')](_0x2ea491,_0x2ec0ce[_0xaf2f('0x126')]);try{fs['unlink'](_0x2ea491+_0xaf2f('0xfb'));}catch(_0x53f031){logger[_0xaf2f('0x4b')](_0x53f031);}return _0x168d6c;}return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x2ec0ce,_0xaf2f('0x146'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x147')]=function(_0x2a6fb8){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x148'),_0x2a6fb8[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x2a6fb8['findBy'])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x2a6fb8,'no\x20find\x20by\x20configured');}logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0x149'),this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x2a6fb8[_0xaf2f('0x14a')]));var _0xda0580=this[_0xaf2f('0x14b')][_0xaf2f('0x69')](this,_0x2a6fb8[_0xaf2f('0x14a')]);if(_0xda0580){logger['info'](util[_0xaf2f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xaf2f('0x4a')],_0x2a6fb8[_0xaf2f('0x14a')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xaf2f('0x4a')],_0x2a6fb8[_0xaf2f('0x14a')]));return{'code':0xc8,'result':_0xaf2f('0x14c')};}else{logger[_0xaf2f('0x30')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x2a6fb8['findBy']));this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x14d'),this['channel'][_0xaf2f('0x4a')],_0x2a6fb8[_0xaf2f('0x14a')]));return{'code':0xc8,'result':_0xaf2f('0x14e')};}};AGIVertices['prototype'][_0xaf2f('0x14f')]=function(_0x492a8e){logger[_0xaf2f('0x30')](util['format'](_0xaf2f('0x150'),_0x492a8e[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x492a8e[_0xaf2f('0x14a')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x492a8e,'no\x20find\x20by\x20configured');}logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x149'),this[_0xaf2f('0xe')]['callerid'],_0x492a8e['findBy']));var _0x1f5177=this[_0xaf2f('0x4d')][_0xaf2f('0x69')](this,_0x492a8e[_0xaf2f('0x14a')]);if(_0x1f5177){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x492a8e[_0xaf2f('0x14a')]));this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x151'),this['channel'][_0xaf2f('0x4a')],_0x492a8e['findBy']));return{'code':0xc8,'result':_0xaf2f('0x14c')};}else{logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x14d'),this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x492a8e[_0xaf2f('0x14a')]));this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x492a8e[_0xaf2f('0x14a')]));return{'code':0xc8,'result':_0xaf2f('0x14e')};}};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x152')]=function(_0x3e461e){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x153'),_0x3e461e[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x3e461e[_0xaf2f('0x154')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x3e461e,'no\x20operation\x20configured');}this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x155'),_0x3e461e[_0xaf2f('0x154')]));var _0x4c4182=eval(_0x3e461e['operation']);if(!this[_0xaf2f('0x7b')](_0x3e461e[_0xaf2f('0x109')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0xd5'));}var _0x48c969=this[_0xaf2f('0x12')][_0xaf2f('0x69')](this,_0x3e461e[_0xaf2f('0x109')]);if(!_0x48c969){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x3e461e,_0xaf2f('0xd6'));}if(_[_0xaf2f('0x92')](_0x4c4182)){var _0x27fb2f=this;_0x4c4182['forEach'](function(_0x5ad48a,_0x5d65d4){_0x27fb2f['channel'][_0xaf2f('0x96')](util['format'](_0xaf2f('0x156'),_0x48c969,_0x5d65d4),_0x5ad48a);});return this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x157'),_0x48c969));}else{return this[_0xaf2f('0xe')][_0xaf2f('0x96')](_0x48c969,_0x4c4182);}};AGIVertices[_0xaf2f('0x11')]['menu']=function(_0x4aa4b8){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4aa4b8[_0xaf2f('0xa0')]));if(_0x4aa4b8[_0xaf2f('0x9d')]===0x0){return this[_0xaf2f('0x158')](_0x4aa4b8);}_0x4aa4b8[_0xaf2f('0x9d')]-=0x1;if(!this[_0xaf2f('0x7b')](_0x4aa4b8[_0xaf2f('0x106')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x4aa4b8,_0xaf2f('0x159'));}var _0x2dc975=this[_0xaf2f('0x107')][_0xaf2f('0x69')](this,_0x4aa4b8[_0xaf2f('0x106')]);if(!_0x2dc975){return this[_0xaf2f('0xe')]['error'](_0x4aa4b8,_0xaf2f('0x108'));}var _0x45a16d=this[_0xaf2f('0xe')][_0xaf2f('0x10a')](_0x2dc975,_0x4aa4b8['response'],_0x4aa4b8[_0xaf2f('0x15a')]);var _0x380513=_0x45a16d['result'];if(_0x45a16d[_0xaf2f('0x9a')]===-0x1){this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x4aa4b8,'-1');return _0x45a16d;}else if(_0x45a16d[_0xaf2f('0x9c')]==='timeout'){_0x45a16d[_0xaf2f('0x9a')]=_0x45a16d[_0xaf2f('0x9a')][_0xaf2f('0x95')]>0x0?_0x45a16d['result']:'t';}else if(_[_0xaf2f('0x40')](_0x45a16d['result'])){_0x45a16d['result']='#';_0x380513='#';}if(!this[_0xaf2f('0x7b')](_0x4aa4b8[_0xaf2f('0x109')])){this['channel'][_0xaf2f('0xa3')](_0xaf2f('0xd5'));}else{var _0x5231d7=this[_0xaf2f('0x12')][_0xaf2f('0x69')](this,_0x4aa4b8['variable_id']);if(!_0x5231d7){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x4aa4b8,_0xaf2f('0xd6'));}this[_0xaf2f('0xe')]['setVariable'](_0x5231d7,_0x380513);}this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x4aa4b8,_0x380513);return _0x45a16d;};AGIVertices[_0xaf2f('0x11')]['noop']=function(_0x42c482){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x15b'),_0x42c482[_0xaf2f('0xa0')]));return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0x42c482['output']||_0x42c482['label']);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x15c')]=function(_0x1ad86e){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x15d'),_0x1ad86e['label']));if(!this[_0xaf2f('0x7b')](_0x1ad86e[_0xaf2f('0x14a')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x1ad86e,_0xaf2f('0x15e'));}logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0x149'),this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x1ad86e['findBy']));var _0x97732b=this[_0xaf2f('0x48')][_0xaf2f('0x69')](this,_0x1ad86e[_0xaf2f('0x15f')]);var _0x1bab7d=this['agentPause']['sync'](this,_0x1ad86e[_0xaf2f('0x14a')],_0x97732b);if(_0x1bab7d){logger[_0xaf2f('0x30')](util['format'](_0xaf2f('0x151'),this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x1ad86e[_0xaf2f('0x14a')]));this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util['format'](_0xaf2f('0x151'),this['channel'][_0xaf2f('0x4a')],_0x1ad86e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x1ad86e['findBy']));this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x151'),this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x1ad86e[_0xaf2f('0x14a')]));return{'code':0xc8,'result':_0xaf2f('0x14e')};}};AGIVertices['prototype'][_0xaf2f('0x160')]=function(_0x17b5fb){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x161'),_0x17b5fb[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x17b5fb[_0xaf2f('0x106')])){return this['channel'][_0xaf2f('0x4b')](_0x17b5fb,_0xaf2f('0x159'));}var _0x2b0fa9=this[_0xaf2f('0x107')][_0xaf2f('0x69')](this,_0x17b5fb['file_id']);if(!_0x2b0fa9){return this[_0xaf2f('0xe')]['error'](_0x17b5fb,_0xaf2f('0x108'));}var _0x3c86ce=this[_0xaf2f('0xe')]['exec'](_0xaf2f('0x162'),[_0x2b0fa9,_0x17b5fb[_0xaf2f('0xde')]]);if(_0x3c86ce[_0xaf2f('0x9a')]===-0x1){return _0x3c86ce;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x163'),_0xaf2f('0x162'),_0x2b0fa9));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x164')]=function(_0x9e485e){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x165'),_0x9e485e['label']));if(!this[_0xaf2f('0x7b')](_0x9e485e[_0xaf2f('0x166')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x9e485e,_0xaf2f('0x167'));}var _0xc2ca1a='';var _0x3902db=parseInt(_0x9e485e[_0xaf2f('0x166')],0xa);if(isNaN(_0x3902db)){_0xc2ca1a=_0x9e485e[_0xaf2f('0x166')];}else{_0xc2ca1a=this[_0xaf2f('0x15')]['sync'](this,_0x9e485e[_0xaf2f('0x166')]);if(!_0xc2ca1a){return this[_0xaf2f('0xe')]['error'](_0x9e485e,_0xaf2f('0x168'));}}var _0x5e4fdd='';if(this[_0xaf2f('0x7b')](_0x9e485e[_0xaf2f('0x106')])){var _0x413c59=this[_0xaf2f('0x107')][_0xaf2f('0x69')](this,_0x9e485e['file_id']);if(_0x413c59){_0x5e4fdd=_0x413c59;}}this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x9e485e,_0xc2ca1a);if(_0x9e485e['opts'][_0xaf2f('0x169')]('x')<0x0){_0x9e485e[_0xaf2f('0xde')]+='x';}if(_0x9e485e[_0xaf2f('0xde')][_0xaf2f('0x169')]('X')<0x0){_0x9e485e['opts']+='X';}this[_0xaf2f('0xe')]['setVariable'](_0xaf2f('0x16a'),_0xc2ca1a?_0xc2ca1a[_0xaf2f('0x16b')]():'');var _0x5cae6b=this[_0xaf2f('0xe')]['exec'](_0xaf2f('0x16c'),[_0xc2ca1a,_0x9e485e[_0xaf2f('0xde')],_0x9e485e[_0xaf2f('0x5e')],_0x5e4fdd,_0x9e485e[_0xaf2f('0x60')],_0x9e485e[_0xaf2f('0x7')],_0x9e485e['macro'],_0x9e485e[_0xaf2f('0x16d')],'',_0x9e485e[_0xaf2f('0x16e')]]);if(_0x5cae6b[_0xaf2f('0x9a')]===-0x1){return _0x5cae6b;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('Executed\x20command\x20%s\x20%s',_0xaf2f('0x16c'),_0xc2ca1a));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x16f')]=function(_0x25b536){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x25b536[_0xaf2f('0xa0')]));var _0x102721=_0x25b536[_0xaf2f('0x170')]||_0xaf2f('0x122');var _0x214cc0=util[_0xaf2f('0x2a')]('%s_%s',this[_0xaf2f('0xe')][_0xaf2f('0x35')],rs['generate'](0x5));var _0x22456d=util[_0xaf2f('0x2a')](_0xaf2f('0x171'),FILES_PATH,_0x214cc0,_0x102721);var _0x50a036=util['format'](_0xaf2f('0x172'),FILES_PATH,_0x214cc0);this[_0xaf2f('0x37')][_0xaf2f('0x69')](this,_0x25b536,_0x214cc0,_0x22456d);this[_0xaf2f('0xe')][_0xaf2f('0x96')](_0xaf2f('0x173'),_0x214cc0);logger[_0xaf2f('0x30')](_0xaf2f('0x174'),_0x50a036,_0x102721,_0x25b536[_0xaf2f('0x175')],_0x25b536[_0xaf2f('0x60')]);return this['channel'][_0xaf2f('0x125')](_0x50a036,_0x102721,_0x25b536[_0xaf2f('0x175')],_0x25b536['timeout'],undefined,!![]);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x176')]=function(_0x5e5bdb){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x177'),_0x5e5bdb['label']));if(!this[_0xaf2f('0x7b')](_0x5e5bdb[_0xaf2f('0x5e')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x178'));}var _0x715827=this['restAPI']['sync'](this,_0x5e5bdb);logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Response:',util[_0xaf2f('0x179')](_0x715827,{'showHidden':![],'depth':null})));if(!this[_0xaf2f('0x7b')](_0x5e5bdb[_0xaf2f('0x109')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x17a'));}var _0x353274=this[_0xaf2f('0x12')][_0xaf2f('0x69')](this,_0x5e5bdb['variable_id']);if(!_0x353274){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5e5bdb,_0xaf2f('0xd6'));}this[_0xaf2f('0xe')][_0xaf2f('0x96')](util['format'](_0xaf2f('0x17b'),_0x353274),_0x715827[_0xaf2f('0x6e')]?_0x715827[_0xaf2f('0x6e')]:_0xaf2f('0x17c'));this[_0xaf2f('0xe')][_0xaf2f('0x96')](util['format'](_0xaf2f('0x17d'),_0x353274),_0x715827[_0xaf2f('0x6f')]?_0x715827[_0xaf2f('0x6f')]:'OK');if(_0x715827['body']){try{this[_0xaf2f('0x93')](_0x715827[_0xaf2f('0x64')],_0x353274);}catch(_0x4ed13f){logger[_0xaf2f('0x4b')](util[_0xaf2f('0x2a')](_0xaf2f('0x17e'),_0x353274));}}return this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('variable\x20%s\x20set',_0x353274));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x17f')]=function(_0x5d7fc0){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x180'),_0x5d7fc0[_0xaf2f('0xa0')]));return this[_0xaf2f('0xe')][_0xaf2f('0x181')](_0x5d7fc0[_0xaf2f('0x182')][_0xaf2f('0x51')](/\s+/g,''),_0x5d7fc0[_0xaf2f('0x175')]);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x183')]=function(_0x2e01d5){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2e01d5[_0xaf2f('0xa0')]));return this[_0xaf2f('0xe')]['sayNumber'](_0x2e01d5[_0xaf2f('0x184')][_0xaf2f('0x51')](/\s+/g,''),_0x2e01d5['escape_digits']);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x185')]=function(_0x149288){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x186'),_0x149288[_0xaf2f('0xa0')]));return this['channel'][_0xaf2f('0x187')](_0x149288[_0xaf2f('0x55')],_0x149288[_0xaf2f('0x175')]);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x188')]=function(_0x4079a8){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x189'),_0x4079a8[_0xaf2f('0xa0')]));if(!this[_0xaf2f('0x7b')](_0x4079a8['account_id'])){return this['channel'][_0xaf2f('0xa3')](_0xaf2f('0x18a'));}var _0x530ad2=this[_0xaf2f('0x21')][_0xaf2f('0x69')](this,_0x4079a8[_0xaf2f('0x18b')]);if(!_0x530ad2||!_0x530ad2['Smtp']){return this['channel'][_0xaf2f('0x4b')](_0x4079a8,'no\x20mail\x20account\x20found');}var _0x433a7f={'from':util[_0xaf2f('0x2a')](_0xaf2f('0x18c'),_0x530ad2[_0xaf2f('0x14')],_0x530ad2['email']||_0x530ad2['Smtp']['user']),'to':_0x4079a8['to']||'','cc':_0x4079a8['cc']||'','bcc':_0x4079a8['bcc']||'','subject':_0x4079a8[_0xaf2f('0x18d')],'html':_0x4079a8[_0xaf2f('0x55')],'text':_0x4079a8[_0xaf2f('0x55')]};if(this[_0xaf2f('0x7b')](_0x4079a8[_0xaf2f('0x18e')])){}logger[_0xaf2f('0x18f')](_0xaf2f('0x190'),JSON[_0xaf2f('0x6c')](_0x433a7f));this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x4079a8,_0x4079a8['account_id']);this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x191'),_0x530ad2[_0xaf2f('0x14')]));this['sendMailMessage'][_0xaf2f('0x69')](this,_0x530ad2['smtpOptions'],_0x433a7f);return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaf2f('0x11')]['sendFax']=function(_0x452de6){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x192'),_0x452de6[_0xaf2f('0xa0')]));return this[_0xaf2f('0xe')]['noop'](_0xaf2f('0x193'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x194')]=function(_0x2c12c4){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2c12c4[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x2c12c4[_0xaf2f('0x195')])){return this[_0xaf2f('0xe')]['noop'](_0xaf2f('0x196'));}var _0xca30d3=this['getSmsAccount'][_0xaf2f('0x69')](this,_0x2c12c4[_0xaf2f('0x195')]);if(!_0xca30d3){return this['channel'][_0xaf2f('0x4b')](_0x2c12c4,_0xaf2f('0x197'));}var _0x27ccfe={'body':_0x2c12c4[_0xaf2f('0x198')],'phone':_0x2c12c4['to']||'','SmsAccountId':_0xca30d3['id']};logger[_0xaf2f('0x18f')](_0xaf2f('0x199'),JSON[_0xaf2f('0x6c')](_0x27ccfe));this['createSquareDetailsReport'][_0xaf2f('0x69')](this,_0x2c12c4,_0x2c12c4[_0xaf2f('0x195')]);this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x19a'),_0xca30d3[_0xaf2f('0x14')]));this[_0xaf2f('0x33')][_0xaf2f('0x69')](this,_0x27ccfe);return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x19b')]=function(_0x5e46df){logger['info'](util[_0xaf2f('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x5e46df[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x5e46df['variable_id'])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5e46df,'no\x20variable\x20selected');}var _0x1f3a49=this['getVariable'][_0xaf2f('0x69')](this,_0x5e46df['variable_id']);if(!_0x1f3a49){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x5e46df,_0xaf2f('0xd6'));}return this[_0xaf2f('0xe')]['setVariable'](_0x1f3a49,_0x5e46df['variable_value']);};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x19c')]=function(_0x50e95e){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x19d'),_0x50e95e[_0xaf2f('0xa0')]));this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x19e'));if(_0x50e95e[_0xaf2f('0xb3')]===_0xaf2f('0x19f')){this['channel']['noop'](_0xaf2f('0x1a0'));return this[_0xaf2f('0xe')]['answer']();}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](_0xaf2f('0x1a1'));};AGIVertices[_0xaf2f('0x11')]['subproject']=function(_0x413676){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x413676[_0xaf2f('0xa0')]));if(!this['isConfigured'](_0x413676[_0xaf2f('0x1a2')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x413676,'no\x20subproject\x20selected');}var _0x59bcad=this['getSquareProject'][_0xaf2f('0x69')](this,_0x413676[_0xaf2f('0x1a2')]);if(!this[_0xaf2f('0x7b')](_0x59bcad)){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x413676,util['format'](_0xaf2f('0x1a3'),_0x413676[_0xaf2f('0x1a2')]));}if(_0x59bcad===this[_0xaf2f('0xe')][_0xaf2f('0x3c')]){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x413676,_0xaf2f('0x1a4'));}this[_0xaf2f('0x34')][_0xaf2f('0x69')](this,_0x413676,_0x59bcad);var _0x35d1e8=this[_0xaf2f('0xe')][_0xaf2f('0x50')](_0xaf2f('0x1a5'),util['format'](_0xaf2f('0x1a6'),config[_0xaf2f('0x7')][_0xaf2f('0x1a7')]||_0xaf2f('0x1a8'),_0x59bcad,this[_0xaf2f('0xe')][_0xaf2f('0x3c')]));if(_0x35d1e8[_0xaf2f('0x9a')]===-0x1){return _0x35d1e8;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x163'),_0xaf2f('0x1a5'),_0x59bcad));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x1a9')]=function(_0x2c9ddd){logger[_0xaf2f('0x30')](util['format'](_0xaf2f('0x1aa'),_0x2c9ddd[_0xaf2f('0xa0')]));var _0x492e2d=this[_0xaf2f('0x1ab')][_0xaf2f('0x69')](this,_0x2c9ddd[_0xaf2f('0xb1')]);this[_0xaf2f('0x34')]['sync'](this,_0x2c9ddd,_0x2c9ddd['command']);if(this[_0xaf2f('0x7b')](_0x2c9ddd['variable_id'])){var _0x5e23af=this['getVariable']['sync'](this,_0x2c9ddd[_0xaf2f('0x109')]);if(_0x5e23af){this[_0xaf2f('0xe')][_0xaf2f('0x96')](_0x5e23af,_0x492e2d);return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2c9ddd[_0xaf2f('0xb1')],_0x5e23af));}}return this[_0xaf2f('0xe')]['noop'](util[_0xaf2f('0x2a')](_0xaf2f('0x1ac'),_0x2c9ddd['command']));};AGIVertices[_0xaf2f('0x11')]['google_cloud_tts']=function(_0x51c44d){logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0x1ad'),_0x51c44d[_0xaf2f('0xa0')]));_0x51c44d[_0xaf2f('0x55')]=_0x51c44d[_0xaf2f('0x55')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf2f('0x7b')](_0x51c44d[_0xaf2f('0x53')])){return this[_0xaf2f('0xe')]['noop'](_0xaf2f('0x1ae'));}if(!this[_0xaf2f('0x7b')](_0x51c44d[_0xaf2f('0x55')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('no\x20text\x20configured');}this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util['format'](_0xaf2f('0x1af'),_0x51c44d[_0xaf2f('0x55')]));var _0x151baf=this[_0xaf2f('0x52')][_0xaf2f('0x69')](this,_0x51c44d);if(_0x151baf){this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x1b0'),_0x151baf));var _0x420a7d=this['channel']['streamFile'](_0x151baf);try{fs[_0xaf2f('0xfa')](_0x151baf+_0xaf2f('0xfb'));}catch(_0x525ba2){logger[_0xaf2f('0x4b')](_0x525ba2);}return _0x420a7d;}return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x51c44d,_0xaf2f('0x1b1'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x1b2')]=function(_0x422aca){logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0x1b3'),_0x422aca[_0xaf2f('0xa0')]));_0x422aca[_0xaf2f('0x55')]=_0x422aca[_0xaf2f('0x55')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf2f('0x7b')](_0x422aca[_0xaf2f('0x55')])){return this[_0xaf2f('0xe')][_0xaf2f('0xa3')]('no\x20text\x20configured');}this[_0xaf2f('0xe')]['noop'](util[_0xaf2f('0x2a')](_0xaf2f('0x1b4'),_0x422aca['text']));var _0xf1d7d7=this[_0xaf2f('0x5b')][_0xaf2f('0x69')](this,_0x422aca);if(_0xf1d7d7){this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0xf1d7d7));var _0x21b695=this[_0xaf2f('0xe')]['streamFile'](_0xf1d7d7);try{fs[_0xaf2f('0xfa')](_0xf1d7d7+_0xaf2f('0xfb'));}catch(_0x50b5ec){logger[_0xaf2f('0x4b')](_0x50b5ec);}return _0x21b695;}return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x422aca,_0xaf2f('0x1b5'));};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x1b6')]=function(_0x142dcd){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x142dcd['label']));if(!this[_0xaf2f('0x7b')](_0x142dcd[_0xaf2f('0x14a')])){return this[_0xaf2f('0xe')]['error'](_0x142dcd,_0xaf2f('0x15e'));}logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xaf2f('0xe')]['callerid'],_0x142dcd['findBy']));var _0x5bc3bf=this[_0xaf2f('0x4c')][_0xaf2f('0x69')](this,_0x142dcd['findBy']);if(_0x5bc3bf){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x142dcd[_0xaf2f('0x14a')]));this['channel'][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x142dcd[_0xaf2f('0x14a')]));return{'code':0xc8,'result':'success'};}else{logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x142dcd[_0xaf2f('0x14a')]));this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')](_0xaf2f('0x14d'),this[_0xaf2f('0xe')][_0xaf2f('0x4a')],_0x142dcd['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xaf2f('0x11')][_0xaf2f('0x1b7')]=function(_0xe7c802){logger['info'](util[_0xaf2f('0x2a')](_0xaf2f('0x1b8'),_0xe7c802['label']));var _0x3754fc=this[_0xaf2f('0xe')][_0xaf2f('0x50')](_0xaf2f('0x1b9'),[_0xe7c802[_0xaf2f('0x1ba')],_0xe7c802[_0xaf2f('0x70')]]);if(_0x3754fc[_0xaf2f('0x9a')]===-0x1){return _0x3754fc;}return this[_0xaf2f('0xe')][_0xaf2f('0xa3')](util[_0xaf2f('0x2a')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0xe7c802[_0xaf2f('0x1ba')]));};AGIVertices[_0xaf2f('0x11')]['vswitch']=function(_0x1a1ea9){logger[_0xaf2f('0x30')](util[_0xaf2f('0x2a')](_0xaf2f('0x1bb'),_0x1a1ea9['label']));if(!this['isConfigured'](_0x1a1ea9[_0xaf2f('0x109')])){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x1a1ea9,_0xaf2f('0x1bc'));}var _0x53f7b0=this[_0xaf2f('0x12')][_0xaf2f('0x69')](this,_0x1a1ea9[_0xaf2f('0x109')]);if(!_0x53f7b0){return this[_0xaf2f('0xe')][_0xaf2f('0x4b')](_0x1a1ea9,'no\x20variable\x20found');}var _0x4ea137=this[_0xaf2f('0xe')][_0xaf2f('0x12')](_0x53f7b0);return{'code':0xc8,'result':_0x4ea137['extra']?_0x4ea137[_0xaf2f('0x9c')]:'-'};};String[_0xaf2f('0x11')][_0xaf2f('0x98')]=function(_0x1f8f99,_0x239999){return this[_0xaf2f('0x97')](_0x1f8f99)[_0xaf2f('0x1bd')](_0x239999);};module[_0xaf2f('0x1be')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1c7279f..fc55baa 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 _0xe9a8=['Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause'];(function(_0x5c11cf,_0x1094e9){var _0xd7bc0d=function(_0x5426e2){while(--_0x5426e2){_0x5c11cf['push'](_0x5c11cf['shift']());}};_0xd7bc0d(++_0x1094e9);}(_0xe9a8,0x1b5));var _0x8e9a=function(_0x5d9a79,_0x5e7dbe){_0x5d9a79=_0x5d9a79-0x0;var _0x33b88f=_0xe9a8[_0x5d9a79];return _0x33b88f;};'use strict';var _=require(_0x8e9a('0x0'));var moment=require(_0x8e9a('0x1'));var ami=require(_0x8e9a('0x2'));var logger=require(_0x8e9a('0x3'))('acw');var RpcUser=require(_0x8e9a('0x4'));var RpcVoiceAgentReport=require(_0x8e9a('0x5'));function Acw(_0x54a456){this[_0x8e9a('0x6')]=_0x54a456[_0x8e9a('0x6')];this[_0x8e9a('0x7')]=_0x54a456['agents'];this[_0x8e9a('0x8')]=_0x54a456['timers'];this[_0x8e9a('0x9')]={};ami['on'](_0x8e9a('0xa'),this[_0x8e9a('0xb')]['bind'](this));ami['on'](_0x8e9a('0xc'),this[_0x8e9a('0xd')][_0x8e9a('0xe')](this));ami['on'](_0x8e9a('0xf'),this[_0x8e9a('0x10')]['bind'](this));ami['on']('agentringnoanswer',this[_0x8e9a('0x11')][_0x8e9a('0xe')](this));ami['on']('attendedtransfer',this[_0x8e9a('0x12')][_0x8e9a('0xe')](this));ami['on'](_0x8e9a('0x13'),this[_0x8e9a('0x14')]['bind'](this));ami['on'](_0x8e9a('0x15'),this[_0x8e9a('0x16')]['bind'](this));}function getDiff(_0x5f31b6){var _0x228b32=moment()[_0x8e9a('0x17')](0x0);var _0x3cb8e7=moment(_0x5f31b6)[_0x8e9a('0x17')](0x0);return _0x228b32[_0x8e9a('0x18')](_0x3cb8e7,_0x8e9a('0x19'));}Acw[_0x8e9a('0x1a')][_0x8e9a('0x1b')]=function(_0x508ac6){try{var _0x4392a9=this;var _0x160bd7=this[_0x8e9a('0x9')][_0x508ac6][_0x8e9a('0x1c')];var _0xccc473=this['channels'][_0x508ac6][_0x8e9a('0x1d')];var _0x423ed2=this[_0x8e9a('0x6')][_0xccc473];var _0x165df2=![];var _0x335b3e='ACW';if(_0x423ed2[_0x8e9a('0x1e')]){if(_0x423ed2[_0x8e9a('0x1f')]['name']){_0x165df2=!![];_0x335b3e=_0x423ed2['mandatoryDispositionPause'][_0x8e9a('0x20')];}}return ami[_0x8e9a('0x21')]({'action':_0x8e9a('0x22'),'interface':_0x160bd7,'paused':!![],'reason':_0x335b3e})[_0x8e9a('0x23')](function(){if(_0x4392a9['agents'][_0x160bd7]){return RpcUser[_0x8e9a('0x24')](_0x4392a9[_0x8e9a('0x7')][_0x160bd7]['id'])[_0x8e9a('0x23')](function(_0x39b8e7){if(_0x39b8e7&&!_0x39b8e7['voicePause']){logger[_0x8e9a('0x25')](_0x8e9a('0x26'),_0x508ac6,_0x160bd7,_0xccc473);var _0x2b0b6b=_0x4392a9[_0x8e9a('0x9')][_0x508ac6]['attended']&&_0x4392a9[_0x8e9a('0x9')][_0x508ac6][_0x8e9a('0x27')]?_0x4392a9[_0x8e9a('0x9')][_0x508ac6][_0x8e9a('0x27')]:_0x508ac6;return RpcUser['savePause'](_0x4392a9[_0x8e9a('0x7')][_0x160bd7],_0x335b3e,_0x2b0b6b)[_0x8e9a('0x23')](function(){if(!_0x165df2){_0x4392a9[_0x8e9a('0x8')][_0x160bd7]={};logger[_0x8e9a('0x25')](_0x8e9a('0x28'),_0x508ac6,_0x4392a9['voiceQueues'][_0xccc473][_0x8e9a('0x29')],_0x160bd7,_0xccc473);_0x4392a9['timers'][_0x160bd7]['timer']=setTimeout(_0x4392a9['stopAcw'][_0x8e9a('0xe')](_0x4392a9,_0x160bd7),_0x4392a9[_0x8e9a('0x6')][_0xccc473][_0x8e9a('0x29')]*0x3e8);_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2a')]=moment()[_0x8e9a('0x2b')](_0x8e9a('0x2c'));_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2d')]=_0x508ac6;_0x4392a9['timers'][_0x160bd7]['queue']=_0xccc473;_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2e')]=function(){var _0x2597e0=getDiff(_0x4392a9[_0x8e9a('0x8')][_0x160bd7]['lastPauseAt']);clearTimeout(_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2f')]);_0x4392a9[_0x8e9a('0x8')][_0x160bd7][_0x8e9a('0x2f')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2597e0},_0x4392a9[_0x8e9a('0x8')][_0x160bd7][_0x8e9a('0x2d')],_0x160bd7)['then'](function(_0x516316){logger['info'](_0x8e9a('0x30'),_0x508ac6,_0x2597e0,_0x516316);})[_0x8e9a('0x31')](function(_0x1ff1ff){logger['error'](_0x8e9a('0x32'),_0x508ac6,_0x1ff1ff);});delete _0x4392a9[_0x8e9a('0x8')][_0x160bd7];};}});}else{logger[_0x8e9a('0x25')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x508ac6,_0x160bd7,_0xccc473);}});}})[_0x8e9a('0x31')](function(){logger[_0x8e9a('0x33')](_0x8e9a('0x28'),_0x508ac6,_0x4392a9['voiceQueues'][_0xccc473][_0x8e9a('0x29')],_0x160bd7,_0xccc473);})[_0x8e9a('0x34')](function(){delete _0x4392a9['channels'][_0x508ac6];});}catch(_0x46a65c){logger[_0x8e9a('0x33')](_0x8e9a('0x35'),_0x46a65c[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')]['stopAcw']=function(_0x79bd7e){try{var _0x41958e=this;if(_0x41958e['timers'][_0x79bd7e]){_0x41958e[_0x8e9a('0x8')][_0x79bd7e][_0x8e9a('0x2f')]=![];var _0x20963c=_0x41958e[_0x8e9a('0x8')][_0x79bd7e][_0x8e9a('0x2d')];var _0x36481d=_0x41958e[_0x8e9a('0x8')][_0x79bd7e][_0x8e9a('0x1d')];var _0x28a70b=_0x41958e[_0x8e9a('0x6')][_0x36481d]['acwTimeout'];logger['info'](_0x8e9a('0x37'),_0x20963c,_0x79bd7e);RpcUser[_0x8e9a('0x38')](this[_0x8e9a('0x7')][_0x79bd7e]);RpcVoiceAgentReport[_0x8e9a('0x39')]({'acwtime':_0x28a70b,'agentacw':!![]},_0x20963c,_0x79bd7e)[_0x8e9a('0x23')](function(_0x48d712){logger[_0x8e9a('0x25')](_0x8e9a('0x30'),_0x20963c,_0x28a70b,_0x48d712);})['catch'](function(_0x5208bc){logger[_0x8e9a('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x20963c,_0x5208bc);});}else{logger['error'](_0x8e9a('0x3a'),_0x79bd7e);if(_0x41958e[_0x8e9a('0x8')]){logger[_0x8e9a('0x25')](_0x8e9a('0x3b'),JSON[_0x8e9a('0x3c')](_0x41958e[_0x8e9a('0x8')]));}}}catch(_0x38cb5b){logger['error']('[ACW][STOP]\x20%s',_0x38cb5b['message']);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0xb')]=function(_0x4da14e){try{if(this[_0x8e9a('0x6')][_0x4da14e[_0x8e9a('0x1d')]]&&(this[_0x8e9a('0x6')][_0x4da14e[_0x8e9a('0x1d')]][_0x8e9a('0x3d')]||this[_0x8e9a('0x6')][_0x4da14e[_0x8e9a('0x1d')]]['mandatoryDisposition'])){if(this[_0x8e9a('0x7')][_0x4da14e['interface']]){this['channels'][_0x4da14e['uniqueid']]={'queue':_0x4da14e[_0x8e9a('0x1d')],'interface':_0x4da14e[_0x8e9a('0x1c')],'destlinkedid':_0x4da14e[_0x8e9a('0x27')]};}}}catch(_0x3b505a){logger[_0x8e9a('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x3b505a[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')]['syncAgentConnectPreview']=function(_0x523266){try{if(this['voiceQueues'][_0x523266[_0x8e9a('0x1d')]]&&(this['voiceQueues'][_0x523266['queue']][_0x8e9a('0x3d')]||this['voiceQueues'][_0x523266[_0x8e9a('0x1d')]][_0x8e9a('0x1e')])){if(this['agents'][_0x523266[_0x8e9a('0x1c')]]){this[_0x8e9a('0x9')][_0x523266[_0x8e9a('0x2d')]]={'queue':_0x523266[_0x8e9a('0x1d')],'interface':_0x523266[_0x8e9a('0x1c')]};}}}catch(_0x3af8e4){logger['error'](_0x8e9a('0x3e'),_0x3af8e4['message']);}};Acw[_0x8e9a('0x1a')]['syncHangupRequest']=function(_0x32c072){try{if(this['channels'][_0x32c072[_0x8e9a('0x2d')]]&&_[_0x8e9a('0x3f')](this[_0x8e9a('0x9')][_0x32c072[_0x8e9a('0x2d')]][_0x8e9a('0x40')])){logger['info'](_0x8e9a('0x41'),_0x32c072[_0x8e9a('0x2d')]);this[_0x8e9a('0x1b')](_0x32c072[_0x8e9a('0x2d')]);}else if(this[_0x8e9a('0x9')][_0x32c072[_0x8e9a('0x42')]]&&_[_0x8e9a('0x3f')](this[_0x8e9a('0x9')][_0x32c072[_0x8e9a('0x42')]][_0x8e9a('0x40')])){logger[_0x8e9a('0x25')](_0x8e9a('0x43'),_0x32c072[_0x8e9a('0x42')]);this[_0x8e9a('0x1b')](_0x32c072[_0x8e9a('0x42')]);}}catch(_0x3bdbf1){logger['error'](_0x8e9a('0x44'),_0x3bdbf1['message']);}};Acw['prototype'][_0x8e9a('0x10')]=function(_0x2644a8){try{if(this[_0x8e9a('0x9')][_0x2644a8[_0x8e9a('0x2d')]]&&this['channels'][_0x2644a8[_0x8e9a('0x2d')]][_0x8e9a('0x40')]){logger[_0x8e9a('0x25')](_0x8e9a('0x45'),_0x2644a8[_0x8e9a('0x2d')]);this[_0x8e9a('0x1b')](_0x2644a8[_0x8e9a('0x2d')]);}else if(this[_0x8e9a('0x9')][_0x2644a8['linkedid']]&&this['channels'][_0x2644a8['linkedid']][_0x8e9a('0x40')]){logger[_0x8e9a('0x25')](_0x8e9a('0x46'),_0x2644a8[_0x8e9a('0x42')]);this[_0x8e9a('0x1b')](_0x2644a8['linkedid']);}}catch(_0x273518){logger[_0x8e9a('0x33')](_0x8e9a('0x47'),_0x273518[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0x12')]=function(_0x5c3cee){try{if(!_[_0x8e9a('0x48')](this[_0x8e9a('0x9')][_0x5c3cee['transfereeuniqueid']])){this[_0x8e9a('0x1b')](_0x5c3cee[_0x8e9a('0x49')]);if(this['channels'][_0x5c3cee[_0x8e9a('0x4a')]]){this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4a')]][_0x8e9a('0x40')]=!![];this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4b')]]=this['channels'][_0x5c3cee[_0x8e9a('0x4a')]];delete this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4a')]];}}else if(!_[_0x8e9a('0x48')](this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4b')]])){this[_0x8e9a('0x1b')](_0x5c3cee[_0x8e9a('0x4b')]);if(this['channels'][_0x5c3cee['origtransfereruniqueid']]){this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4c')]]['attended']=!![];this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x49')]]=this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4c')]];delete this['channels'][_0x5c3cee['origtransfereruniqueid']];}}}catch(_0x6bb978){logger[_0x8e9a('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0x6bb978[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0x14')]=function(_0x170859){try{if(this[_0x8e9a('0x9')][_0x170859[_0x8e9a('0x4d')]]){logger['info'](_0x8e9a('0x4e'),JSON['stringify'](_0x170859[_0x8e9a('0x4d')]));this['startAcw'](_0x170859[_0x8e9a('0x4d')]);}else if(this[_0x8e9a('0x9')][_0x170859[_0x8e9a('0x4f')]]){logger[_0x8e9a('0x25')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x8e9a('0x3c')](_0x170859['transfererlinkedid']));this[_0x8e9a('0x1b')](_0x170859[_0x8e9a('0x4f')]);}}catch(_0x2c7b77){logger[_0x8e9a('0x33')](_0x8e9a('0x50'),_0x2c7b77[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0x11')]=function(_0x4da365){try{if(this[_0x8e9a('0x6')][_0x4da365[_0x8e9a('0x1d')]]&&this[_0x8e9a('0x6')][_0x4da365[_0x8e9a('0x1d')]][_0x8e9a('0x51')]===_0x8e9a('0x52')){if(this[_0x8e9a('0x7')][_0x4da365[_0x8e9a('0x1c')]]){logger['info'](_0x8e9a('0x53'),_0x4da365[_0x8e9a('0x2d')],_0x4da365[_0x8e9a('0x1c')],_0x4da365[_0x8e9a('0x1d')]);return RpcUser[_0x8e9a('0x54')](this['agents'][_0x4da365[_0x8e9a('0x1c')]],_0x8e9a('0x55'),_0x4da365[_0x8e9a('0x2d')]);}}}catch(_0x1f2daf){logger[_0x8e9a('0x33')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1f2daf['message']);}};module[_0x8e9a('0x56')]=Acw; \ No newline at end of file +var _0xf9f2=['seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xf9f2,0x193));var _0x2f9f=function(_0x1e8bea,_0x47bde9){_0x1e8bea=_0x1e8bea-0x0;var _0x29f756=_0xf9f2[_0x1e8bea];return _0x29f756;};'use strict';var _=require('lodash');var moment=require(_0x2f9f('0x0'));var ami=require('../ami');var logger=require(_0x2f9f('0x1'))(_0x2f9f('0x2'));var RpcUser=require(_0x2f9f('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0xc03d6){this[_0x2f9f('0x4')]=_0xc03d6['voiceQueues'];this[_0x2f9f('0x5')]=_0xc03d6[_0x2f9f('0x5')];this['timers']=_0xc03d6[_0x2f9f('0x6')];this[_0x2f9f('0x7')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x2f9f('0x8')](this));ami['on'](_0x2f9f('0x9'),this[_0x2f9f('0xa')][_0x2f9f('0x8')](this));ami['on'](_0x2f9f('0xb'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x2f9f('0xc')][_0x2f9f('0x8')](this));ami['on']('attendedtransfer',this[_0x2f9f('0xd')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x2f9f('0x8')](this));ami['on'](_0x2f9f('0xe'),this[_0x2f9f('0xf')][_0x2f9f('0x8')](this));}function getDiff(_0x28e51c){var _0x2784ec=moment()[_0x2f9f('0x10')](0x0);var _0x37e6ce=moment(_0x28e51c)[_0x2f9f('0x10')](0x0);return _0x2784ec['diff'](_0x37e6ce,_0x2f9f('0x11'));}Acw[_0x2f9f('0x12')][_0x2f9f('0x13')]=function(_0x1f3f6f){try{var _0x13015d=this;var _0x57b8b4=this[_0x2f9f('0x7')][_0x1f3f6f][_0x2f9f('0x14')];var _0x524cfb=this['channels'][_0x1f3f6f][_0x2f9f('0x15')];var _0x3732f7=this[_0x2f9f('0x4')][_0x524cfb];var _0x126a50=![];var _0x100cf7=_0x2f9f('0x16');if(_0x3732f7[_0x2f9f('0x17')]){if(_0x3732f7[_0x2f9f('0x18')][_0x2f9f('0x19')]){_0x126a50=!![];_0x100cf7=_0x3732f7[_0x2f9f('0x18')][_0x2f9f('0x19')];}}return ami[_0x2f9f('0x1a')]({'action':'QueuePause','interface':_0x57b8b4,'paused':!![],'reason':_0x100cf7})[_0x2f9f('0x1b')](function(){if(_0x13015d[_0x2f9f('0x5')][_0x57b8b4]){return RpcUser[_0x2f9f('0x1c')](_0x13015d[_0x2f9f('0x5')][_0x57b8b4]['id'])[_0x2f9f('0x1b')](function(_0x55c57b){if(_0x55c57b&&!_0x55c57b[_0x2f9f('0x1d')]){logger[_0x2f9f('0x1e')](_0x2f9f('0x1f'),_0x1f3f6f,_0x57b8b4,_0x524cfb);var _0x2dddf0=_0x13015d['channels'][_0x1f3f6f][_0x2f9f('0x20')]&&_0x13015d[_0x2f9f('0x7')][_0x1f3f6f][_0x2f9f('0x21')]?_0x13015d[_0x2f9f('0x7')][_0x1f3f6f][_0x2f9f('0x21')]:_0x1f3f6f;return RpcUser['savePause'](_0x13015d[_0x2f9f('0x5')][_0x57b8b4],_0x100cf7,_0x2dddf0)[_0x2f9f('0x1b')](function(){if(!_0x126a50){_0x13015d[_0x2f9f('0x6')][_0x57b8b4]={};logger['info'](_0x2f9f('0x22'),_0x1f3f6f,_0x13015d[_0x2f9f('0x4')][_0x524cfb][_0x2f9f('0x23')],_0x57b8b4,_0x524cfb);_0x13015d[_0x2f9f('0x6')][_0x57b8b4][_0x2f9f('0x24')]=setTimeout(_0x13015d[_0x2f9f('0x25')]['bind'](_0x13015d,_0x57b8b4),_0x13015d[_0x2f9f('0x4')][_0x524cfb][_0x2f9f('0x23')]*0x3e8);_0x13015d[_0x2f9f('0x6')][_0x57b8b4]['lastPauseAt']=moment()[_0x2f9f('0x26')](_0x2f9f('0x27'));_0x13015d[_0x2f9f('0x6')][_0x57b8b4][_0x2f9f('0x28')]=_0x1f3f6f;_0x13015d[_0x2f9f('0x6')][_0x57b8b4]['queue']=_0x524cfb;_0x13015d['timers'][_0x57b8b4]['updateAcw']=function(){var _0x334f00=getDiff(_0x13015d[_0x2f9f('0x6')][_0x57b8b4][_0x2f9f('0x29')]);clearTimeout(_0x13015d[_0x2f9f('0x6')][_0x57b8b4][_0x2f9f('0x24')]);_0x13015d[_0x2f9f('0x6')][_0x57b8b4][_0x2f9f('0x24')]=![];RpcVoiceAgentReport[_0x2f9f('0x2a')]({'acwtime':_0x334f00},_0x13015d[_0x2f9f('0x6')][_0x57b8b4][_0x2f9f('0x28')],_0x57b8b4)[_0x2f9f('0x1b')](function(_0x2bbeae){logger[_0x2f9f('0x1e')](_0x2f9f('0x2b'),_0x1f3f6f,_0x334f00,_0x2bbeae);})[_0x2f9f('0x2c')](function(_0x10b08a){logger[_0x2f9f('0x2d')](_0x2f9f('0x2e'),_0x1f3f6f,_0x10b08a);});delete _0x13015d[_0x2f9f('0x6')][_0x57b8b4];};}});}else{logger[_0x2f9f('0x1e')](_0x2f9f('0x2f'),_0x1f3f6f,_0x57b8b4,_0x524cfb);}});}})[_0x2f9f('0x2c')](function(){logger[_0x2f9f('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1f3f6f,_0x13015d[_0x2f9f('0x4')][_0x524cfb][_0x2f9f('0x23')],_0x57b8b4,_0x524cfb);})[_0x2f9f('0x30')](function(){delete _0x13015d[_0x2f9f('0x7')][_0x1f3f6f];});}catch(_0x1d0c9b){logger['error'](_0x2f9f('0x31'),_0x1d0c9b[_0x2f9f('0x32')]);}};Acw[_0x2f9f('0x12')]['stopAcw']=function(_0x5563f1){try{var _0xc7b945=this;if(_0xc7b945['timers'][_0x5563f1]){_0xc7b945[_0x2f9f('0x6')][_0x5563f1]['timer']=![];var _0x1c24cf=_0xc7b945['timers'][_0x5563f1][_0x2f9f('0x28')];var _0x1230d1=_0xc7b945[_0x2f9f('0x6')][_0x5563f1]['queue'];var _0x129d88=_0xc7b945[_0x2f9f('0x4')][_0x1230d1][_0x2f9f('0x23')];logger[_0x2f9f('0x1e')]('[%s][TIMER][STOP][AGENT:%s]',_0x1c24cf,_0x5563f1);RpcUser[_0x2f9f('0x33')](this['agents'][_0x5563f1]);RpcVoiceAgentReport[_0x2f9f('0x2a')]({'acwtime':_0x129d88,'agentacw':!![]},_0x1c24cf,_0x5563f1)[_0x2f9f('0x1b')](function(_0x438ff8){logger[_0x2f9f('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x1c24cf,_0x129d88,_0x438ff8);})[_0x2f9f('0x2c')](function(_0x121dea){logger[_0x2f9f('0x2d')](_0x2f9f('0x2e'),_0x1c24cf,_0x121dea);});}else{logger[_0x2f9f('0x2d')](_0x2f9f('0x34'),_0x5563f1);if(_0xc7b945[_0x2f9f('0x6')]){logger[_0x2f9f('0x1e')](_0x2f9f('0x35'),JSON[_0x2f9f('0x36')](_0xc7b945[_0x2f9f('0x6')]));}}}catch(_0x5c9731){logger[_0x2f9f('0x2d')](_0x2f9f('0x37'),_0x5c9731[_0x2f9f('0x32')]);}};Acw['prototype'][_0x2f9f('0x38')]=function(_0x221a68){try{if(this['voiceQueues'][_0x221a68['queue']]&&(this[_0x2f9f('0x4')][_0x221a68[_0x2f9f('0x15')]][_0x2f9f('0x2')]||this[_0x2f9f('0x4')][_0x221a68[_0x2f9f('0x15')]][_0x2f9f('0x17')])){if(this['agents'][_0x221a68[_0x2f9f('0x14')]]){this[_0x2f9f('0x7')][_0x221a68['uniqueid']]={'queue':_0x221a68[_0x2f9f('0x15')],'interface':_0x221a68[_0x2f9f('0x14')],'destlinkedid':_0x221a68['destlinkedid']};}}}catch(_0x1e5450){logger[_0x2f9f('0x2d')]('[ACW][syncAgentConnect]\x20%s',_0x1e5450[_0x2f9f('0x32')]);}};Acw[_0x2f9f('0x12')][_0x2f9f('0xf')]=function(_0xc7b68e){try{if(this[_0x2f9f('0x4')][_0xc7b68e[_0x2f9f('0x15')]]&&(this[_0x2f9f('0x4')][_0xc7b68e[_0x2f9f('0x15')]][_0x2f9f('0x2')]||this[_0x2f9f('0x4')][_0xc7b68e['queue']]['mandatoryDisposition'])){if(this[_0x2f9f('0x5')][_0xc7b68e[_0x2f9f('0x14')]]){this[_0x2f9f('0x7')][_0xc7b68e[_0x2f9f('0x28')]]={'queue':_0xc7b68e[_0x2f9f('0x15')],'interface':_0xc7b68e[_0x2f9f('0x14')]};}}}catch(_0x5c353f){logger[_0x2f9f('0x2d')](_0x2f9f('0x39'),_0x5c353f[_0x2f9f('0x32')]);}};Acw['prototype'][_0x2f9f('0xa')]=function(_0x35ab39){try{if(this[_0x2f9f('0x7')][_0x35ab39[_0x2f9f('0x28')]]&&_['isUndefined'](this[_0x2f9f('0x7')][_0x35ab39[_0x2f9f('0x28')]][_0x2f9f('0x20')])){logger[_0x2f9f('0x1e')](_0x2f9f('0x3a'),_0x35ab39[_0x2f9f('0x28')]);this[_0x2f9f('0x13')](_0x35ab39[_0x2f9f('0x28')]);}else if(this[_0x2f9f('0x7')][_0x35ab39[_0x2f9f('0x3b')]]&&_[_0x2f9f('0x3c')](this[_0x2f9f('0x7')][_0x35ab39[_0x2f9f('0x3b')]][_0x2f9f('0x20')])){logger[_0x2f9f('0x1e')](_0x2f9f('0x3d'),_0x35ab39['linkedid']);this[_0x2f9f('0x13')](_0x35ab39[_0x2f9f('0x3b')]);}}catch(_0x393f4b){logger[_0x2f9f('0x2d')](_0x2f9f('0x3e'),_0x393f4b[_0x2f9f('0x32')]);}};Acw['prototype']['syncHangup']=function(_0x43f6e5){try{if(this[_0x2f9f('0x7')][_0x43f6e5['uniqueid']]&&this[_0x2f9f('0x7')][_0x43f6e5[_0x2f9f('0x28')]]['attended']){logger[_0x2f9f('0x1e')](_0x2f9f('0x3f'),_0x43f6e5[_0x2f9f('0x28')]);this[_0x2f9f('0x13')](_0x43f6e5['uniqueid']);}else if(this[_0x2f9f('0x7')][_0x43f6e5[_0x2f9f('0x3b')]]&&this[_0x2f9f('0x7')][_0x43f6e5[_0x2f9f('0x3b')]][_0x2f9f('0x20')]){logger[_0x2f9f('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x43f6e5[_0x2f9f('0x3b')]);this[_0x2f9f('0x13')](_0x43f6e5[_0x2f9f('0x3b')]);}}catch(_0x4ad9fe){logger[_0x2f9f('0x2d')](_0x2f9f('0x40'),_0x4ad9fe['message']);}};Acw['prototype'][_0x2f9f('0xd')]=function(_0x1263bb){try{if(!_[_0x2f9f('0x41')](this['channels'][_0x1263bb[_0x2f9f('0x42')]])){this['startAcw'](_0x1263bb[_0x2f9f('0x42')]);if(this[_0x2f9f('0x7')][_0x1263bb['secondtransfereruniqueid']]){this[_0x2f9f('0x7')][_0x1263bb[_0x2f9f('0x43')]]['attended']=!![];this[_0x2f9f('0x7')][_0x1263bb[_0x2f9f('0x44')]]=this[_0x2f9f('0x7')][_0x1263bb['secondtransfereruniqueid']];delete this[_0x2f9f('0x7')][_0x1263bb[_0x2f9f('0x43')]];}}else if(!_['isNil'](this[_0x2f9f('0x7')][_0x1263bb[_0x2f9f('0x44')]])){this['startAcw'](_0x1263bb[_0x2f9f('0x44')]);if(this['channels'][_0x1263bb[_0x2f9f('0x45')]]){this[_0x2f9f('0x7')][_0x1263bb[_0x2f9f('0x45')]][_0x2f9f('0x20')]=!![];this['channels'][_0x1263bb[_0x2f9f('0x42')]]=this[_0x2f9f('0x7')][_0x1263bb[_0x2f9f('0x45')]];delete this[_0x2f9f('0x7')][_0x1263bb['origtransfereruniqueid']];}}}catch(_0x30e57b){logger['error'](_0x2f9f('0x46'),_0x30e57b[_0x2f9f('0x32')]);}};Acw['prototype'][_0x2f9f('0x47')]=function(_0x1a8cd2){try{if(this[_0x2f9f('0x7')][_0x1a8cd2[_0x2f9f('0x48')]]){logger['info'](_0x2f9f('0x49'),JSON['stringify'](_0x1a8cd2['transfereruniqueid']));this[_0x2f9f('0x13')](_0x1a8cd2[_0x2f9f('0x48')]);}else if(this[_0x2f9f('0x7')][_0x1a8cd2[_0x2f9f('0x4a')]]){logger[_0x2f9f('0x1e')](_0x2f9f('0x4b'),JSON[_0x2f9f('0x36')](_0x1a8cd2['transfererlinkedid']));this[_0x2f9f('0x13')](_0x1a8cd2['transfererlinkedid']);}}catch(_0x4e5b1d){logger[_0x2f9f('0x2d')](_0x2f9f('0x4c'),_0x4e5b1d[_0x2f9f('0x32')]);}};Acw[_0x2f9f('0x12')][_0x2f9f('0xc')]=function(_0x13f48e){try{if(this[_0x2f9f('0x4')][_0x13f48e[_0x2f9f('0x15')]]&&this['voiceQueues'][_0x13f48e['queue']][_0x2f9f('0x4d')]===_0x2f9f('0x4e')){if(this[_0x2f9f('0x5')][_0x13f48e[_0x2f9f('0x14')]]){logger[_0x2f9f('0x1e')](_0x2f9f('0x4f'),_0x13f48e['uniqueid'],_0x13f48e[_0x2f9f('0x14')],_0x13f48e[_0x2f9f('0x15')]);return RpcUser[_0x2f9f('0x50')](this['agents'][_0x13f48e[_0x2f9f('0x14')]],_0x2f9f('0x51'),_0x13f48e['uniqueid']);}}}catch(_0xb336f2){logger['error'](_0x2f9f('0x52'),_0xb336f2[_0x2f9f('0x32')]);}};module[_0x2f9f('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 66c0738..be26fd9 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 _0x0e6b=['resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s'];(function(_0x31896b,_0x5ed3b9){var _0x35bd00=function(_0x6aa626){while(--_0x6aa626){_0x31896b['push'](_0x31896b['shift']());}};_0x35bd00(++_0x5ed3b9);}(_0x0e6b,0x9c));var _0xb0e6=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x0e6b[_0x1db481];return _0x3db95b;};'use strict';var Manager=require(_0xb0e6('0x0'));var BPromise=require(_0xb0e6('0x1'));var util=require(_0xb0e6('0x2'));var logger=require(_0xb0e6('0x3'))('ami');var config=require(_0xb0e6('0x4'));var ami=new Manager(config[_0xb0e6('0x5')][_0xb0e6('0x6')],config['asterisk']['ip'],config['asterisk']['username'],config[_0xb0e6('0x5')][_0xb0e6('0x7')],!![]);ami[_0xb0e6('0x8')]();ami[_0xb0e6('0x9')]=BPromise['promisify'](ami[_0xb0e6('0xa')]);function error(_0xfd9b55){logger[_0xb0e6('0xb')](util[_0xb0e6('0xc')](_0xb0e6('0xd'),config[_0xb0e6('0x5')]['username'],config['asterisk']['ip'],config[_0xb0e6('0x5')][_0xb0e6('0x6')],util[_0xb0e6('0xe')](_0xfd9b55,![],null)));}function close(){logger[_0xb0e6('0xb')](util[_0xb0e6('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xb0e6('0x5')][_0xb0e6('0xf')],config[_0xb0e6('0x5')]['ip'],config['asterisk'][_0xb0e6('0x6')]));}ami[_0xb0e6('0x10')]=function(){return function(){return ami['Action']({'action':_0xb0e6('0x11')});};};ami[_0xb0e6('0x12')]=function(){return function(){return ami[_0xb0e6('0x9')]({'action':_0xb0e6('0x13')});};};ami[_0xb0e6('0x14')]=function(){return function(){return ami['Action']({'action':_0xb0e6('0x15')});};};ami[_0xb0e6('0x16')]=function(){return function(){return ami[_0xb0e6('0x9')]({'action':_0xb0e6('0x17')});};};ami[_0xb0e6('0x18')]=function(){return function(){return ami['Action']({'action':_0xb0e6('0x19')});};};function connect(){logger[_0xb0e6('0x1a')](util[_0xb0e6('0xc')](_0xb0e6('0x1b'),config['asterisk']['username'],config[_0xb0e6('0x5')]['ip'],config[_0xb0e6('0x5')][_0xb0e6('0x6')]));ami[_0xb0e6('0x1c')](_0xb0e6('0xb'),error);ami['once'](_0xb0e6('0x1d'),close);}ami['on'](_0xb0e6('0x1e'),connect);ami['on'](_0xb0e6('0x1f'),function(_0x6f242){logger[_0xb0e6('0x1a')](util[_0xb0e6('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xb0e6('0x5')][_0xb0e6('0xf')],config['asterisk']['ip'],config['asterisk'][_0xb0e6('0x6')],util[_0xb0e6('0xe')](_0x6f242,![],null)));});ami['on'](_0xb0e6('0x20'),function(){logger['info'](util[_0xb0e6('0xc')](_0xb0e6('0x21'),config[_0xb0e6('0x5')][_0xb0e6('0xf')],config['asterisk']['ip'],config[_0xb0e6('0x5')][_0xb0e6('0x6')]));return Promise[_0xb0e6('0x22')]()['then'](ami['actionSipShowRegistry']())[_0xb0e6('0x23')](ami[_0xb0e6('0x12')]())[_0xb0e6('0x23')](ami[_0xb0e6('0x14')]())[_0xb0e6('0x23')](ami[_0xb0e6('0x16')]())[_0xb0e6('0x23')](ami[_0xb0e6('0x18')]())['catch'](function(_0x25b248){logger[_0xb0e6('0xb')](_0xb0e6('0x24'),util['inspect'](_0x25b248,{'showHidden':![],'depth':null}));});});ami[_0xb0e6('0x1c')]('error',error);ami[_0xb0e6('0x1c')](_0xb0e6('0x1d'),close);module[_0xb0e6('0x25')]=ami; \ No newline at end of file +var _0x9ca4=['once','exports','bluebird','../../config/logger','ami','asterisk','port','username','password','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','Action','actionQueueSummary','queuesummary','actionCoreShowChannels','info','error','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','catch','[ami.js][fullybooted]'];(function(_0x34b32b,_0x4a0933){var _0x4cbb3d=function(_0x146d8a){while(--_0x146d8a){_0x34b32b['push'](_0x34b32b['shift']());}};_0x4cbb3d(++_0x4a0933);}(_0x9ca4,0x1be));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x49ca('0x0'));var util=require('util');var logger=require(_0x49ca('0x1'))(_0x49ca('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x49ca('0x3')][_0x49ca('0x4')],config[_0x49ca('0x3')]['ip'],config[_0x49ca('0x3')][_0x49ca('0x5')],config[_0x49ca('0x3')][_0x49ca('0x6')],!![]);ami[_0x49ca('0x7')]();ami['Action']=BPromise[_0x49ca('0x8')](ami[_0x49ca('0x9')]);function error(_0xb83c64){logger['error'](util[_0x49ca('0xa')](_0x49ca('0xb'),config[_0x49ca('0x3')][_0x49ca('0x5')],config[_0x49ca('0x3')]['ip'],config[_0x49ca('0x3')]['port'],util[_0x49ca('0xc')](_0xb83c64,![],null)));}function close(){logger['error'](util[_0x49ca('0xa')](_0x49ca('0xd'),config[_0x49ca('0x3')][_0x49ca('0x5')],config[_0x49ca('0x3')]['ip'],config[_0x49ca('0x3')][_0x49ca('0x4')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x49ca('0xe')});};};ami[_0x49ca('0xf')]=function(){return function(){return ami['Action']({'action':_0x49ca('0x10')});};};ami[_0x49ca('0x11')]=function(){return function(){return ami[_0x49ca('0x12')]({'action':'sippeerstatus'});};};ami[_0x49ca('0x13')]=function(){return function(){return ami['Action']({'action':_0x49ca('0x14')});};};ami[_0x49ca('0x15')]=function(){return function(){return ami[_0x49ca('0x12')]({'action':'coreshowchannels'});};};function connect(){logger[_0x49ca('0x16')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x49ca('0x3')][_0x49ca('0x5')],config[_0x49ca('0x3')]['ip'],config['asterisk'][_0x49ca('0x4')]));ami['once'](_0x49ca('0x17'),error);ami['once'](_0x49ca('0x18'),close);}ami['on'](_0x49ca('0x19'),connect);ami['on'](_0x49ca('0x1a'),function(_0x29e676){logger[_0x49ca('0x16')](util[_0x49ca('0xa')](_0x49ca('0x1b'),config[_0x49ca('0x3')][_0x49ca('0x5')],config['asterisk']['ip'],config[_0x49ca('0x3')][_0x49ca('0x4')],util[_0x49ca('0xc')](_0x29e676,![],null)));});ami['on'](_0x49ca('0x1c'),function(){logger[_0x49ca('0x16')](util[_0x49ca('0xa')](_0x49ca('0x1d'),config['asterisk'][_0x49ca('0x5')],config['asterisk']['ip'],config['asterisk'][_0x49ca('0x4')]));return Promise[_0x49ca('0x1e')]()['then'](ami[_0x49ca('0x1f')]())['then'](ami[_0x49ca('0xf')]())[_0x49ca('0x20')](ami['actionSipPeerStatus']())[_0x49ca('0x20')](ami['actionQueueSummary']())[_0x49ca('0x20')](ami[_0x49ca('0x15')]())[_0x49ca('0x21')](function(_0x362d0a){logger[_0x49ca('0x17')](_0x49ca('0x22'),util[_0x49ca('0xc')](_0x362d0a,{'showHidden':![],'depth':null}));});});ami[_0x49ca('0x23')](_0x49ca('0x17'),error);ami[_0x49ca('0x23')](_0x49ca('0x18'),close);module[_0x49ca('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index eff3002..0be45db 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x243b70,_0x2d58d8){var _0x552730=function(_0x4582db){while(--_0x4582db){_0x243b70['push'](_0x243b70['shift']());}};_0x552730(++_0x2d58d8);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4a9433,_0x5337cb){_0x4a9433=_0x4a9433-0x0;var _0x434947=_0xbdb7[_0x4a9433];return _0x434947;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b1d3f71..73cdb00 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 _0x8fc8=['voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countglobal','verifyAdditionalPhones','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','ListId','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','queueBooked','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','VoiceQueueId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countbusyretry','dialGlobalMaxRetry','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','dialPreviewRecallmeReminder','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','Action','[Dialer][checkChannel]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','object','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','XMD-','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','outboundDropCallsDayTimeout','predictiveIntervalMaxThreshold','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','predictiveIntervalHitRate','dialPredictiveOptimizationPercentage','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','loggedIn','busyFactor','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','RUNNING','emptyContact','checkIsBlackList','tryOriginatePredictive','dialOrderByScheduledAt','[countReScheduled]\x20','[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','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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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]','p\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','emit','type','debug','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','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','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','message','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','Error','active','SIP/%s','status','reachable','unmonitored','isTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','push','command','interval','indexOf','true','catch','iftime\x20%s,%s','timezones','then','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','dialTimezone','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin'];(function(_0x1d6721,_0x40406f){var _0x2c7cbd=function(_0x516188){while(--_0x516188){_0x1d6721['push'](_0x1d6721['shift']());}};_0x2c7cbd(++_0x40406f);}(_0x8fc8,0x14b));var _0x88fc=function(_0x1c9231,_0x4aa3fd){_0x1c9231=_0x1c9231-0x0;var _0x488a44=_0x8fc8[_0x1c9231];return _0x488a44;};'use strict';var util=require('util');var _=require(_0x88fc('0x0'));var uuid=require(_0x88fc('0x1'));var moment=require(_0x88fc('0x2'));var rr=require('rr');var Redis=require(_0x88fc('0x3'));var utils=require(_0x88fc('0x4'));var hopperUtils=require(_0x88fc('0x5'));var ut=require(_0x88fc('0x6'));var config=require(_0x88fc('0x7'));var logger=require(_0x88fc('0x8'))(_0x88fc('0x9'));var loggerBooked=require(_0x88fc('0x8'))('booked');var loggerPredictive=require(_0x88fc('0x8'))(_0x88fc('0xa'));var loggerPredictiveCalls=require(_0x88fc('0x8'))(_0x88fc('0xb'));var loggerSyncQueueSummary=require(_0x88fc('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0x88fc('0xc')]=_[_0x88fc('0xd')](config['redis'],{'host':_0x88fc('0xe'),'port':0x18eb});var io=require(_0x88fc('0xf'))(new Redis(config[_0x88fc('0xc')]));var cmHopper=require(_0x88fc('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x88fc('0x11'));var Interval=require(_0x88fc('0x12'));var Action=require(_0x88fc('0x13'));var History=require(_0x88fc('0x14'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x88fc('0x15'));var Hangup=require(_0x88fc('0x16'));var ipAgi=process[_0x88fc('0x17')][_0x88fc('0x18')]||_0x88fc('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x88fc('0x1a')]['enqueue']=function(_0xbccea1){this[_0x88fc('0x1b')]=this[_0x88fc('0x1b')]?this[_0x88fc('0x1b')][_0x88fc('0x1c')](_0xbccea1):_0xbccea1();};function Dialer(_0x1e3e97,_0x5b5736){this[_0x88fc('0x1d')]=new Sequence();this[_0x88fc('0x1e')]=_0x5b5736;this[_0x88fc('0x1f')]=_0x1e3e97[_0x88fc('0x1f')];this[_0x88fc('0x20')]=_0x1e3e97[_0x88fc('0x20')];this['agents']=_0x1e3e97[_0x88fc('0x21')];this[_0x88fc('0x22')]=_0x1e3e97[_0x88fc('0x22')];this[_0x88fc('0x23')]=config[_0x88fc('0x23')]||0x2;this[_0x88fc('0x24')]={};this[_0x88fc('0x25')]={};this[_0x88fc('0x26')]={};this[_0x88fc('0x27')]={};this[_0x88fc('0x28')]={};this[_0x88fc('0x29')]={};this[_0x88fc('0x2a')]={};this[_0x88fc('0x2b')]={};this['queueBooked']={};this[_0x88fc('0x2c')]={};this[_0x88fc('0x2d')]={};ami['on'](_0x88fc('0x2e'),this[_0x88fc('0x2f')][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x31'),this[_0x88fc('0x32')][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x33'),this['syncOriginateResponse'][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x34'),this[_0x88fc('0x35')][_0x88fc('0x30')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x36'),this[_0x88fc('0x37')][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x38'),this['syncHangup']['bind'](this));ami['on'](_0x88fc('0x39'),this[_0x88fc('0x3a')]['bind'](this));ami['on'](_0x88fc('0x3b'),this[_0x88fc('0x3c')][_0x88fc('0x30')](this));ami['on']('queuemember',this[_0x88fc('0x3d')][_0x88fc('0x30')](this));ami['on']('queuestatuscomplete',this[_0x88fc('0x3e')][_0x88fc('0x30')](this));this[_0x88fc('0x3f')]();this[_0x88fc('0x40')]();RpcSetting['getSettings']()['then'](function(_0x1f97fc){previewRecallmeReminderInterval=_0x1f97fc['previewRecallmeReminderInterval'];});}function isNotNull(_0x1075ce){return _0x1075ce!==null&&!_[_0x88fc('0x41')](_0x1075ce);}function msgResponse(_0x3dac06,_0x524553,_0x5c858e){return{'action':_0x3dac06,'response':_0x524553,'message':_0x5c858e,'stack':_0x5c858e};}function emit(_0x578de8,_0x51a26f,_0x1cccd5){io['to'](_0x578de8)[_0x88fc('0x42')](_0x51a26f,_0x1cccd5);}function emitOutboundVoiceQueueSummary(_0x5d1eac){if(_0x5d1eac[_0x88fc('0x43')]==='outbound'){logger[_0x88fc('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x5d1eac,{'showHidden':![],'depth':null}));emit(util[_0x88fc('0x45')](_0x88fc('0x46'),_0x5d1eac[_0x88fc('0x47')]),_0x88fc('0x48'),_0x5d1eac);}}function checkGetDataPredictive(_0x41c576){if(isNotNull(_0x41c576)&&!_['isEmpty'](_0x41c576)){loggerPredictive[_0x88fc('0x49')](_0x88fc('0x4a'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576[_0x88fc('0x4b')]);loggerPredictive[_0x88fc('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576[_0x88fc('0x4c')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x4d'),_0x41c576['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x4e'),_0x41c576[_0x88fc('0x4f')]);loggerPredictive[_0x88fc('0x49')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576[_0x88fc('0x50')]);loggerPredictive[_0x88fc('0x49')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576['predictiveIntervalAvgTalktime']);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x51'));if(_0x41c576['predictiveIntervalTotalCalls']>0x0){if(!_[_0x88fc('0x41')](_0x41c576[_0x88fc('0x52')])&&_0x41c576[_0x88fc('0x52')]>0x0){return!![];}loggerPredictive[_0x88fc('0x49')](_0x88fc('0x53'));if(!_['isUndefined'](_0x41c576[_0x88fc('0x50')])&&_0x41c576[_0x88fc('0x50')]>0x0){return!![];}loggerPredictive[_0x88fc('0x49')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x88fc('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x88fc('0x49')](_0x88fc('0x54'));}return![];}function mergeDataErlangB(_0xec252a){return function(_0x1e115c){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x88fc('0x55'),_0x1e115c[_0x88fc('0x56')]);loggerPredictive['info'](_0x88fc('0x57'),_0x1e115c[_0x88fc('0x58')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x59'),_0x1e115c[_0x88fc('0x5a')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x5b'),_0x1e115c[_0x88fc('0x5c')]);loggerPredictive['info'](_0x88fc('0x59'),_0x1e115c[_0x88fc('0x5a')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x51'));_[_0x88fc('0x5d')](_0xec252a,_0x1e115c);};}function ifInterval(_0x61b57d,_0x7c8241){if(_[_0x88fc('0x41')](_0x7c8241)){return![];}return utils[_0x88fc('0x5e')](undefined,_0x7c8241)<_0x61b57d*0x3c;}function clearPredictiveAttributes(_0x3f798f){if(_0x3f798f[_0x88fc('0x2a')]){_0x3f798f[_0x88fc('0x2a')]=undefined;loggerPredictive[_0x88fc('0x44')](_0x3f798f[_0x88fc('0x47')],_0x88fc('0x5f'));}if(_0x3f798f[_0x88fc('0x29')]){_0x3f798f[_0x88fc('0x29')]=undefined;loggerPredictive['debug'](_0x3f798f[_0x88fc('0x47')],'startPredictive\x20value\x20cleared');}if(_0x3f798f['handlePredictive']){clearInterval(_0x3f798f[_0x88fc('0x60')]);_0x3f798f[_0x88fc('0x60')]=undefined;loggerPredictive[_0x88fc('0x44')](_0x3f798f['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4835a6,_0xab1446){return function(_0x3482c8){loggerPredictive['error'](_0xab1446[_0x88fc('0x47')],_0x4835a6);loggerPredictive[_0x88fc('0x61')](_0x3482c8[_0x88fc('0x62')]);clearPredictiveAttributes(_0xab1446);};}function loggerCatch(_0xfee94a){return function(_0x4a10ad){logger[_0x88fc('0x61')](_0xfee94a,util[_0x88fc('0x63')](_0x4a10ad,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4b9f15,_0x13172c,_0x437531){return function(_0x326ad4){utils[_0x88fc('0x64')](_0x13172c,_0x437531,0x0);logger[_0x88fc('0x61')](_0x4b9f15,util[_0x88fc('0x63')](_0x326ad4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x538d4c){return function(_0x39706b){if(isNotNull(_0x39706b)&&isNotNull(_0x39706b[0x0])){if(_0x39706b[0x0][_0x88fc('0x65')]>0x0){_0x538d4c[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger['info'](_0x88fc('0x67')+_0x538d4c[_0x88fc('0x47')],_0x39706b[0x0][_0x88fc('0x65')],_0x88fc('0x68'));}else{_0x538d4c[_0x88fc('0x66')]=utils[_0x88fc('0x69')]['NO_AVAILABLE_CONTACTS'];logger[_0x88fc('0x49')](_0x88fc('0x6a')+_0x538d4c[_0x88fc('0x47')]);}}};}function createObjHistory(_0x5e929b,_0x24ebe3,_0x3b626e,_0x9baa67,_0x187c3b){_0x5e929b['message']=_0x3b626e;var _0x5905f0=new Action(_0x5e929b,_0x24ebe3);var _0x1059a2=new History(_0x5905f0);_0x1059a2[_0x88fc('0x6b')]=_0x9baa67;_0x1059a2['statedesc']=_0x187c3b;_0x1059a2[_0x88fc('0x6c')]=_0x5905f0[_0x88fc('0x6d')];return _0x1059a2;}function unlockQueueStatus(_0x15cd23,_0x10675e){setTimeout(function(){if(_['isUndefined'](_0x15cd23[_0x88fc('0x6e')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x10675e);}_0x15cd23[_0x88fc('0x6e')]=!![];loggerBooked[_0x88fc('0x49')](_0x88fc('0x6f'),_0x10675e,JSON[_0x88fc('0x70')](_[_0x88fc('0x71')](_0x15cd23,[_0x88fc('0x47'),_0x88fc('0x6e')])));},0x1f3);}function checkInterval(_0x48c579){return function(){if(!isNotNull(_0x48c579[_0x88fc('0x72')])){_0x48c579[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS'][_0x88fc('0x73')];throw _0x48c579['name']+_0x88fc('0x74');}if(!isNotNull(_0x48c579[_0x88fc('0x72')][_0x88fc('0x75')])){_0x48c579[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS'][_0x88fc('0x73')];throw _0x48c579[_0x88fc('0x47')]+_0x88fc('0x74');}if(!isNotNull(_[_0x88fc('0x76')](_0x48c579[_0x88fc('0x72')][_0x88fc('0x75')]))){_0x48c579['message']=utils[_0x88fc('0x69')]['NULL_INTERVAL'];throw _0x48c579['name']+_0x88fc('0x74');}};}function checkIsIVRCampaignActive(_0x15cdd2){return function(){if(!utils[_0x88fc('0x77')](_0x15cdd2)){_0x15cdd2['message']=utils['CAMPAIGN_STATUS'][_0x88fc('0x78')];throw _0x15cdd2[_0x88fc('0x47')]+_0x88fc('0x79');}};}function emitCampaignSummary(_0x38b90a){if(utils[_0x88fc('0x7a')](_0x38b90a)){emit(util['format'](_0x88fc('0x7b'),_0x38b90a[_0x88fc('0x47')]),'campaign:save',_0x38b90a);}}function loggerCatchQueueSummary(_0x27baf7,_0x41fbd3){return function(_0x323342){clearPredictiveAttributes(_0x41fbd3);emitCampaignSummary(_0x41fbd3);loggerSyncQueueSummary[_0x88fc('0x44')](_0x27baf7,util[_0x88fc('0x63')](_0x323342,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5d3520){if(_0x5d3520[_0x88fc('0x7c')]){if(_0x5d3520['originated']===0x0){_0x5d3520[_0x88fc('0x7c')]=![];_0x5d3520[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x78')];loggerSyncQueueSummary[_0x88fc('0x44')](_0x88fc('0x7d'),_0x5d3520['name'],_0x88fc('0x7e'));}else{_0x5d3520[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x7f')];loggerSyncQueueSummary[_0x88fc('0x44')](_0x88fc('0x7d'),_0x5d3520['name'],'is\x20disactive');}emitCampaignSummary(_0x5d3520);}}function myreject(_0x1e9676){return function(_0x5955c9){return _0x1e9676(msgResponse('[ifTime][Action]',_0x88fc('0x80'),JSON['stringify'](_0x5955c9)));};}Dialer[_0x88fc('0x1a')]['isTrunkReachable']=function(_0x1283b3){return!_[_0x88fc('0x41')](_0x1283b3)&&_0x1283b3&&!_[_0x88fc('0x41')](_0x1283b3[_0x88fc('0x47')])&&!_['isUndefined'](_0x1283b3[_0x88fc('0x81')])&&_0x1283b3[_0x88fc('0x81')]&&(this[_0x88fc('0x22')][util[_0x88fc('0x45')](_0x88fc('0x82'),_0x1283b3[_0x88fc('0x47')])][_0x88fc('0x83')]===_0x88fc('0x84')||this['trunks'][util['format'](_0x88fc('0x82'),_0x1283b3[_0x88fc('0x47')])]['status']===_0x88fc('0x85'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x39a430){var _0x1ce4f0=this;return function(){if(!_0x1ce4f0[_0x88fc('0x86')](_0x39a430[_0x88fc('0x87')])){if(!_0x1ce4f0[_0x88fc('0x86')](_0x39a430['TrunkBackup'])){_0x39a430[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS'][_0x88fc('0x88')];throw _0x39a430[_0x88fc('0x47')]+_0x88fc('0x89');}}};};Dialer[_0x88fc('0x1a')][_0x88fc('0x8a')]=function(_0x591d03,_0x2ec63d,_0x2f3ecf,_0x18da18){var _0x4d2d47=this;return function(){var _0x3fb3d0=!![];return _0x4d2d47[_0x88fc('0x8b')](_0x591d03,_0x2ec63d,_0x2f3ecf,_0x18da18,_0x3fb3d0);};};Dialer[_0x88fc('0x1a')][_0x88fc('0x8c')]=function(_0x49a7ef,_0x3720f2,_0x31a1e0,_0xdff940){var _0x10587b=this;return function(){var _0x147cc0=![];return _0x10587b[_0x88fc('0x8b')](_0x49a7ef[_0x88fc('0x75')],_0x3720f2,_0x31a1e0,_0xdff940,_0x147cc0);};};Dialer[_0x88fc('0x1a')][_0x88fc('0x8b')]=function(_0x270db9,_0x4580fc,_0x55ea30,_0x465601,_0x10ec77){var _0x6fd5d7=[];return new Promise(function(_0x3e3a77,_0x2bfdd6){if(!isNotNull(_0x270db9)){_0x465601[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x73')];return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),_0x55ea30+_0x88fc('0x8f')));}if(_[_0x88fc('0x76')](_0x270db9)){_0x465601[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x90')];return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),_0x55ea30+_0x88fc('0x91')));}if(_0x4580fc&&_[_0x88fc('0x41')](config['timezones'][_0x4580fc])){_0x465601[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x92')];return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),_0x55ea30+'\x20Timezone\x20unknow\x20'+_0x4580fc));}if(_['isArray'](_0x270db9)){for(var _0x19d71f=0x0;_0x19d71f<_0x270db9['length'];_0x19d71f+=0x1){_0x6fd5d7[_0x88fc('0x93')](ami['Action']({'action':_0x88fc('0x94'),'command':util[_0x88fc('0x45')]('iftime\x20%s,%s',_0x270db9[_0x19d71f][_0x88fc('0x95')],!_['isUndefined'](config['timezones'][_0x4580fc])?_0x4580fc:'')})['then'](function(_0x1e4b32){return _0x1e4b32['content'][_0x88fc('0x96')](_0x88fc('0x97'))>=0x0;})[_0x88fc('0x98')](myreject(_0x2bfdd6)));}}else{_0x6fd5d7[_0x88fc('0x93')](ami['Action']({'action':_0x88fc('0x94'),'command':util[_0x88fc('0x45')](_0x88fc('0x99'),_0x270db9,!_['isUndefined'](config[_0x88fc('0x9a')][_0x4580fc])?_0x4580fc:'')})[_0x88fc('0x9b')](function(_0x3e1b76){return _0x3e1b76['content'][_0x88fc('0x96')](_0x88fc('0x97'))>=0x0;})[_0x88fc('0x98')](myreject(_0x2bfdd6)));}Promise['all'](_0x6fd5d7)['then'](function(_0x5f2be1){var _0x57abdf=_[_0x88fc('0x9c')](_0x5f2be1);if(_0x57abdf){return _0x3e3a77(_0x57abdf);}else{_0x465601[_0x88fc('0x66')]=_0x10ec77?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x88fc('0x69')][_0x88fc('0x9d')];return _0x2bfdd6(msgResponse(_0x88fc('0x9e'),'Failure',_0x88fc('0x9f')+_0x10ec77+'\x20'+_0x55ea30+'\x20Interval\x20is\x20overtime:\x20'+util[_0x88fc('0x63')](_0x270db9,{'showHidden':![],'depth':null})+_0x88fc('0xa0')+_0x4580fc));}})['catch'](function(_0x28e4b8){return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),JSON[_0x88fc('0x70')](_0x28e4b8)));});});};Dialer[_0x88fc('0x1a')][_0x88fc('0x3f')]=function(){var _0x325666=this;return cmHopper[_0x88fc('0xa1')]({'active':![]},{'where':{'active':!![]}})[_0x88fc('0x9b')](function(){setInterval(function(){_0x325666[_0x88fc('0xa2')]();},0x3e8);});};Dialer[_0x88fc('0x1a')][_0x88fc('0xa2')]=function(){var _0xd75820=this;var _0x3fb34d;for(var _0x20e559 in this[_0x88fc('0x20')]){if(typeof this['campaigns'][_0x20e559]!==_0x88fc('0xa3')){_0x3fb34d=this['campaigns'][_0x20e559];if(utils[_0x88fc('0x7a')](_0x3fb34d)&&utils[_0x88fc('0x77')](_0x3fb34d)){_0x3fb34d[_0x88fc('0x7c')]=!![];Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](checkIsIVRCampaignActive(_0x3fb34d))[_0x88fc('0x9b')](checkInterval(_0x3fb34d))[_0x88fc('0x9b')](_0xd75820[_0x88fc('0xa5')](_0x3fb34d))['then'](_0xd75820[_0x88fc('0x8a')](_0x3fb34d[_0x88fc('0xa6')],_0x3fb34d['dialTimezone'],_0x3fb34d[_0x88fc('0x47')],_0x3fb34d))[_0x88fc('0x9b')](_0xd75820[_0x88fc('0x8c')](_0x3fb34d['Interval'],_0x3fb34d['dialTimezone'],_0x3fb34d['name'],_0x3fb34d))[_0x88fc('0x9b')](_0xd75820[_0x88fc('0xa7')](_0x3fb34d))[_0x88fc('0x98')](loggerCatchQueueSummary(_0x88fc('0xa8'),_0x3fb34d));}else{notSendMessagesCampaign(_0x3fb34d);}}}};Dialer[_0x88fc('0x1a')][_0x88fc('0xa9')]=function(_0x3cf9cc){if(_0x3cf9cc[_0x88fc('0xaa')]!==_0x88fc('0xa')){clearPredictiveAttributes(_0x3cf9cc);}switch(_0x3cf9cc[_0x88fc('0xaa')]){case _0x88fc('0xab'):this[_0x88fc('0xac')](_0x3cf9cc,0x1);break;case _0x88fc('0xad'):this[_0x88fc('0xac')](_0x3cf9cc,_0x3cf9cc[_0x88fc('0xae')]);break;case'predictive':this[_0x88fc('0xa')](_0x3cf9cc);break;case _0x88fc('0xaf'):this[_0x88fc('0xac')](_0x3cf9cc,0x1);break;default:logger['error'](_0x88fc('0xb0'),_0x3cf9cc[_0x88fc('0x47')],_0x88fc('0xb1'));}};Dialer[_0x88fc('0x1a')][_0x88fc('0x8d')]=function(_0x6db131,_0x47b54b){var _0x193375=_0x6db131[_0x88fc('0xb2')];var _0x22bf6c=_0x47b54b?_0x6db131[_0x88fc('0xa6')]:_0x6db131[_0x88fc('0x72')][_0x88fc('0x75')];logger[_0x88fc('0xb3')](_0x88fc('0xb4'),_0x22bf6c,_0x193375,_0x6db131[_0x88fc('0x47')],util['format'](_0x88fc('0xb5'),_0x6db131['name'],_0x6db131['id']));var _0x34908f=null;return Interval[_0x88fc('0xb6')](_0x22bf6c,_0x193375)[_0x88fc('0x9b')](function(_0x113592){if(_0x113592===!![]){return _0x113592;}else{_0x6db131[_0x88fc('0x66')]=_0x47b54b?utils[_0x88fc('0x69')][_0x88fc('0xb7')]:utils[_0x88fc('0x69')][_0x88fc('0x9d')];_0x34908f=msgResponse(_0x88fc('0x9e'),_0x88fc('0x8e'),'Global:\x20'+_0x47b54b+'\x20'+_0x6db131[_0x88fc('0x47')]+_0x88fc('0xb8')+util[_0x88fc('0x63')](_0x22bf6c,{'showHidden':![],'depth':null})+_0x88fc('0xa0')+_0x193375);}if(_0x34908f!==null){logger['silly'](_0x88fc('0xb9'),_0x34908f);_0x34908f['isGlobal']=_0x47b54b;throw _0x34908f;}})[_0x88fc('0x98')](function(_0xe56d6e){logger[_0x88fc('0x61')](_0x88fc('0xba'),_0xe56d6e);throw msgResponse(_0x88fc('0xbb'),_0x88fc('0x80'),util[_0x88fc('0x63')](_0xe56d6e,{'showHidden':![],'depth':null}));});};Dialer[_0x88fc('0x1a')]['syncAgentConnect']=function(_0x50ace7){if(this[_0x88fc('0x1f')][_0x50ace7[_0x88fc('0xbc')]]){if(this[_0x88fc('0x27')][_0x50ace7[_0x88fc('0xbd')]]&&this[_0x88fc('0x27')][_0x50ace7[_0x88fc('0xbd')]][_0x88fc('0x43')]!==_0x88fc('0xbe')){this['updateOriginated'](this[_0x88fc('0x1f')][_0x50ace7[_0x88fc('0xbc')]]);this[_0x88fc('0x27')][_0x50ace7['uniqueid']]['answertime']=moment()['format'](_0x88fc('0xbf'));}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x35')]=function(_0x177e01){var _0x426faf=this['uniqueId'][_0x177e01[_0x88fc('0xbd')]];if(this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]]){if(_0x426faf&&_0x426faf['type']!==_0x88fc('0xbe')){delete this[_0x88fc('0x27')][_0x177e01[_0x88fc('0xbd')]];this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]][_0x88fc('0xc0')]+=0x1;var _0x4166aa=new AgentComplete(_0x426faf,_0x177e01);if(_0x177e01[_0x88fc('0xc1')]===_0x88fc('0xc2')){_0x4166aa[_0x88fc('0xc3')]=this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]][_0x88fc('0xc4')]&&this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]][_0x88fc('0xc5')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x88fc('0xc6')](_0x4166aa)[_0x88fc('0x98')](loggerCatch(_0x88fc('0xc7')));hopperUtils[_0x88fc('0xc8')](_0x4166aa)[_0x88fc('0x98')](loggerCatch(_0x88fc('0xc9')));}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x32')]=function(_0x382d1d){var _0x9bc9a=this[_0x88fc('0x27')][_0x382d1d[_0x88fc('0xbd')]];var _0x536897=this;var _0x600a02=![];var _0x2604ef;var _0x4db8db;if(this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]]){if(_0x9bc9a&&_0x9bc9a['type']!==_0x88fc('0xbe')){delete this[_0x88fc('0x27')][_0x382d1d[_0x88fc('0xbd')]];this['updateOriginated'](this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]]);_0x9bc9a[_0x88fc('0xca')]=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));var _0xc8d85=new QueueCallerAbandon(_0x9bc9a,_0x382d1d);if(utils[_0x88fc('0x5e')](_0x9bc9a['droptime'],_0x9bc9a[_0x88fc('0xcb')])>=_0x9bc9a[_0x88fc('0xcc')]){this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xcd')]+=0x1;this[_0x88fc('0x1f')][_0x382d1d['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x382d1d['queue']][_0x88fc('0xce')]+=0x1;_0xc8d85['state']=0xa;_0xc8d85[_0x88fc('0xcf')]=_0x88fc('0xd0');_0xc8d85[_0x88fc('0xd1')]=_0x88fc('0xd2');_0xc8d85[_0x88fc('0xc3')]=this['voiceQueues'][_0x382d1d['queue']][_0x88fc('0xc4')]?moment()[_0x88fc('0x45')](_0x88fc('0xbf')):undefined;_0xc8d85[_0x88fc('0xd3')]+=0x1;_0xc8d85['countglobal']+=0x1;_0x2604ef=this['voiceQueues'][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd4')];_0x4db8db=this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd5')];hopperUtils['verifyAdditionalPhones'](_0xc8d85,_0xc8d85[_0x88fc('0x6b')],_0x9bc9a[_0x88fc('0xd6')])[_0x88fc('0x9b')](function(_0x5e2ff6){_0x600a02=_0x5e2ff6[_0x88fc('0xd7')]==0x1;if(_0xc8d85['countdropretry']>=_0x536897[_0x88fc('0x1f')][_0x382d1d['queue']]['dialDropMaxRetry']){_0x536897[_0x88fc('0xd8')](_0xc8d85,_0x5e2ff6[_0x88fc('0xd7')]);}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countdropretry':_0xc8d85[_0x88fc('0xd3')],'scheduledat':moment()[_0x88fc('0xda')](_0x536897[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd4')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x9bc9a[_0x88fc('0xdc')],'ListId':_0x9bc9a['ListId'],'VoiceQueueId':_0x9bc9a['VoiceQueueId']||undefined,'CampaignId':_0x9bc9a[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0xde')));var _0x2dd782=new History(_0xc8d85);_0x2dd782[_0x88fc('0x6b')]=0xa;_0x2dd782[_0x88fc('0xcf')]=_0x88fc('0xd0');_0x2dd782['starttime']=moment()[_0x88fc('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dd782['endtime']=_0x2dd782[_0x88fc('0x6d')];_0x2dd782['calleridname']=_0xc8d85[_0x88fc('0xdf')];_0x2dd782[_0x88fc('0xe0')]=_0xc8d85[_0x88fc('0xe0')];hopperUtils[_0x88fc('0xc6')](_0x2dd782)[_0x88fc('0x98')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x88fc('0x9b')](function(){if(_0x600a02)hopperUtils[_0x88fc('0xe1')](_0xc8d85,_0x2604ef,_0x4db8db)['then'](function(){return 0x1;});});}else{this[_0x88fc('0x1f')][_0x382d1d['queue']][_0x88fc('0x4f')]+=0x1;this['voiceQueues'][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xe2')]+=0x1;_0xc8d85[_0x88fc('0x6b')]=0xb;_0xc8d85[_0x88fc('0xcf')]=_0x88fc('0xe3');_0xc8d85[_0x88fc('0xd1')]=_0x88fc('0xe4');_0xc8d85['countabandonedretry']+=0x1;_0xc8d85[_0x88fc('0xe5')]+=0x1;_0x2604ef=this['voiceQueues'][_0x382d1d[_0x88fc('0xbc')]]['dialAbandonedRetryFrequency'];_0x4db8db=this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd5')];hopperUtils[_0x88fc('0xe6')](_0xc8d85,_0xc8d85[_0x88fc('0x6b')],_0x9bc9a[_0x88fc('0xd6')])[_0x88fc('0x9b')](function(_0x5097aa){if(_0xc8d85[_0x88fc('0xe7')]>=_0x536897[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xe8')]){_0x536897[_0x88fc('0xd8')](_0xc8d85,_0x5097aa['additional']);}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countabandonedretry':_0xc8d85['countabandonedretry'],'scheduledat':moment()[_0x88fc('0xda')](_0x536897[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xe9')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x9bc9a[_0x88fc('0xdc')],'ListId':_0x9bc9a[_0x88fc('0xea')],'VoiceQueueId':_0x9bc9a['VoiceQueueId']||undefined,'CampaignId':_0x9bc9a[_0x88fc('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4a9e31=new History(_0xc8d85);_0x4a9e31[_0x88fc('0x6b')]=0xb;_0x4a9e31[_0x88fc('0xcf')]='Abandoned';_0x4a9e31[_0x88fc('0x6d')]=moment()['format'](_0x88fc('0xbf'));_0x4a9e31['endtime']=_0x4a9e31[_0x88fc('0x6d')];_0x4a9e31[_0x88fc('0xdf')]=_0xc8d85[_0x88fc('0xdf')];_0x4a9e31[_0x88fc('0xe0')]=_0xc8d85['calleridnum'];hopperUtils[_0x88fc('0xc6')](_0x4a9e31)[_0x88fc('0x98')](loggerCatch(_0x88fc('0xeb')));}})[_0x88fc('0x9b')](function(){if(_0x600a02)hopperUtils[_0x88fc('0xe1')](_0xc8d85,_0x2604ef,_0x4db8db)[_0x88fc('0x9b')](function(){return 0x1;});});}}}};Dialer[_0x88fc('0x1a')]['syncNewExten']=function(_0x3c653e){if(this[_0x88fc('0x25')][_0x3c653e['uniqueid']]){this[_0x88fc('0x25')][_0x3c653e[_0x88fc('0xbd')]][_0x88fc('0xec')]=_0x3c653e[_0x88fc('0xec')];}if(this[_0x88fc('0x27')][_0x3c653e['uniqueid']]){this['uniqueId'][_0x3c653e[_0x88fc('0xbd')]][_0x88fc('0xec')]=_0x3c653e[_0x88fc('0xec')];}};Dialer[_0x88fc('0x1a')][_0x88fc('0x3d')]=function(_0x369c3a){if(!this[_0x88fc('0x25')][_0x369c3a['actionid']]){return;}var _0x58e100=this['voiceQueues'][this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xbc')]][_0x88fc('0xee')]||_0x88fc('0xef');if(_0x58e100===_0x88fc('0xf0')){if(this[_0x88fc('0x25')][_0x369c3a['actionid']]&&_[_0x88fc('0xf1')](this[_0x88fc('0x25')][_0x369c3a['actionid']]['locked'])&&_0x369c3a[_0x88fc('0x83')]==='1'&&_0x369c3a[_0x88fc('0xf2')]==='0'){if(this[_0x88fc('0x21')][_0x369c3a[_0x88fc('0xf3')]]){if(!this['agents'][_0x369c3a[_0x88fc('0xf3')]]['locked']){this[_0x88fc('0x21')][_0x369c3a[_0x88fc('0xf3')]][_0x88fc('0xf4')]=!![];this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xf4')]=!![];this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xf3')]=_0x369c3a[_0x88fc('0xf3')];}}}}else if(_0x58e100===_0x88fc('0xef')){if(this['actions'][_0x369c3a[_0x88fc('0xed')]]){if(this['agents'][_0x369c3a[_0x88fc('0xf3')]]){this[_0x88fc('0x25')][_0x369c3a['actionid']][_0x88fc('0xf3')]=_0x369c3a['stateinterface'];if(_[_0x88fc('0xf1')](this[_0x88fc('0xf5')][this['actions'][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xbc')]])){this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xbc')]]=[];}this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x369c3a['actionid']][_0x88fc('0xbc')]][_0x88fc('0x93')](_['merge'](_[_0x88fc('0x71')](this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]],[_0x88fc('0xf6'),'stateinterface']),{'status':_0x369c3a[_0x88fc('0x83')],'paused':_0x369c3a[_0x88fc('0xf2')]}));}}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x3e')]=function(_0x2c1f50){if(!this[_0x88fc('0x25')][_0x2c1f50['actionid']]){return;}var _0x3c75c7=this;var _0x333d99=this[_0x88fc('0x1f')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]];var _0x3f60e4=_0x333d99[_0x88fc('0xee')]||_0x88fc('0xef');if(_0x3f60e4===_0x88fc('0xf0')){if(this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]&&this['actions'][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xf3')]){this['preview'][_0x88fc('0xf7')](this[_0x88fc('0x25')][_0x2c1f50['actionid']][_0x88fc('0xf6')],this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xf3')])['catch'](function(_0x14997b){logger[_0x88fc('0x61')](_0x88fc('0xf8'),util['inspect'](_0x14997b,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3c75c7[_0x88fc('0xf9')](_0x3c75c7[_0x88fc('0x1f')][_0x3c75c7['actions'][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]]);_0x3c75c7['agents'][_0x3c75c7[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xf3')]]['locked']=![];delete _0x3c75c7[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]];unlockQueueStatus(_0x333d99);});}else{this['updateOriginated'](this['voiceQueues'][this['actions'][_0x2c1f50[_0x88fc('0xed')]]['queue']]);hopperUtils[_0x88fc('0xd9')]({'active':![],'ContactId':this['actions'][_0x2c1f50['actionid']][_0x88fc('0xdc')],'ListId':this['actions'][_0x2c1f50[_0x88fc('0xed')]]['ListId'],'VoiceQueueId':this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0xfa')));delete this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]];unlockQueueStatus(_0x333d99);}}else if(_0x3f60e4===_0x88fc('0xef')){var _0x22b9d8;if(this['actions'][_0x2c1f50['actionid']]&&!_[_0x88fc('0x76')](this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x2c1f50['actionid']]['queue']])){if(this['queueBookedRR'][_0x3c75c7['actions'][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]]){this[_0x88fc('0x2c')][_0x3c75c7[_0x88fc('0x25')][_0x2c1f50['actionid']][_0x88fc('0xbc')]]=this[_0x88fc('0x2c')][this[_0x88fc('0x25')][_0x2c1f50['actionid']][_0x88fc('0xbc')]]?this[_0x88fc('0x2c')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]]:this['queueBooked'][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]['queue']]?this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]][_0x88fc('0xfb')]||0x0:0x0;}this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]['queue']][_0x88fc('0xfb')]=this[_0x88fc('0x2c')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]];for(var _0x265788=0x0;_0x265788=_0x5e9872['dialGlobalMaxRetry']){_0x313418[_0x88fc('0x11f')](_0x58f67f,_0x2c19b2,_0x34ada3,_0x88fc('0x120'));}else{if(_0x58f67f[_0x88fc('0x119')]>=_0x5e9872[_0x88fc('0x121')]){_0x313418[_0x88fc('0x122')](_0x58f67f,_0x2c19b2,_0x34ada3,_0x88fc('0x123'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x58f67f[_0x88fc('0x119')],'scheduledat':moment()['add'](_0x5e9872[_0x88fc('0x124')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x58f67f[_0x88fc('0xdc')],'ListId':_0x58f67f['ListId'],'VoiceQueueId':_0x58f67f['VoiceQueueId']||undefined,'CampaignId':_0x58f67f[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x125')));_0x2c19b2({'reschedule':0x1});}}});}if(_0x3b64b1[_0x88fc('0x43')]==='ivr'&&this[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]][_0x88fc('0x116')]&&_0x33eb01[_0x88fc('0x10c')]===_0x88fc('0x10d')){delete this[_0x88fc('0x27')][_0x33eb01['uniqueid']];this[_0x88fc('0xf9')](this['campaigns'][_0x3b64b1[_0x88fc('0xbc')]]);_0x2b6587=new Hangup(_0x3b64b1,_0x33eb01);_0x2b6587['state']=0x12;_0x2b6587[_0x88fc('0xcf')]='HangupInAMD';_0x2b6587[_0x88fc('0x118')]=_0x88fc('0x10f');ami[_0x88fc('0x42')](_0x88fc('0x110'),ut[_0x88fc('0x111')](_0x2b6587,'amd'));this[_0x88fc('0x113')](_0x2b6587,_0x88fc('0x126'),'[syncHangupInAMDIvr]');}if(_0x3b64b1[_0x88fc('0x43')]===_0x88fc('0xbe')&&this[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]]['dialAMDActive']&&_0x33eb01[_0x88fc('0x10c')]===_0x88fc('0x127')){return new Promise(function(_0x213a26,_0x4d51c7){delete _0x313418[_0x88fc('0x27')][_0x33eb01[_0x88fc('0xbd')]];_0x313418[_0x88fc('0xf9')](_0x313418[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]]);_0x313418[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]][_0x88fc('0xc0')]+=0x1;_0x313418[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5a29dd=_0x313418['campaigns'][_0x3b64b1[_0x88fc('0xbc')]];var _0xea91a6=new Hangup(_0x3b64b1,_0x33eb01);_0xea91a6[_0x88fc('0x6b')]=0x13;_0xea91a6['statedesc']=_0x88fc('0x117');_0xea91a6[_0x88fc('0x118')]=_0x88fc('0x10f');_0xea91a6[_0x88fc('0x119')]+=0x1;_0xea91a6['countglobal']+=0x1;_0xea91a6[_0x88fc('0x112')]=!![];ami[_0x88fc('0x42')](_0x88fc('0x110'),ut[_0x88fc('0x111')](_0xea91a6,_0x88fc('0x112')));hopperUtils['createHistory'](_0xea91a6)['catch'](loggerCatch(_0x88fc('0x11a')));if(_0xea91a6[_0x88fc('0x128')]+_0xea91a6[_0x88fc('0x11b')]+_0xea91a6['countnoanswerretry']+_0xea91a6['countnosuchnumberretry']+_0xea91a6['countdropretry']+_0xea91a6[_0x88fc('0xe7')]+_0xea91a6[_0x88fc('0x119')]+_0xea91a6['countagentrejectretry']>=_0x5a29dd[_0x88fc('0x129')]){_0x313418[_0x88fc('0x11f')](_0xea91a6,_0x213a26,_0x4d51c7,'reason19\x20machine....');}else{if(_0xea91a6[_0x88fc('0x119')]>=_0x5a29dd['dialMachineMaxRetry']){_0x313418[_0x88fc('0x122')](_0xea91a6,_0x213a26,_0x4d51c7,_0x88fc('0x123'));}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countmachineretry':_0xea91a6['countmachineretry'],'scheduledat':moment()[_0x88fc('0xda')](_0x5a29dd[_0x88fc('0x124')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0xea91a6[_0x88fc('0xdc')],'ListId':_0xea91a6['ListId'],'VoiceQueueId':_0xea91a6['VoiceQueueId']||undefined,'CampaignId':_0xea91a6[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x125')));_0x213a26({'reschedule':0x1});}}});}}};Dialer[_0x88fc('0x1a')]['syncHangup']=function(_0xbc7225){var _0x7d3112=this['uniqueId'][_0xbc7225['uniqueid']];var _0x432c1b;if(_0x7d3112&&_0x7d3112[_0x88fc('0x43')]===_0x88fc('0xbe')){delete this['uniqueId'][_0xbc7225[_0x88fc('0xbd')]];this['updateOriginated'](this['campaigns'][_0x7d3112[_0x88fc('0xbc')]]);this[_0x88fc('0x20')][_0x7d3112[_0x88fc('0xbc')]]['ivrAnswerCallsDay']+=0x1;_0x432c1b=new Hangup(_0x7d3112,_0xbc7225);hopperUtils['createHistory'](_0x432c1b)[_0x88fc('0x98')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x88fc('0xc8')](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12a')));}if(_0x7d3112&&_0x7d3112['type']!=='ivr'&&isNotNull(this[_0x88fc('0x1f')][_0x7d3112['queue']][_0x88fc('0x12b')])){delete this[_0x88fc('0x27')][_0xbc7225['uniqueid']];this['updateOriginated'](this[_0x88fc('0x1f')][_0x7d3112['queue']]);this['voiceQueues'][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0xc0')]+=0x1;this['voiceQueues'][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0x10e')]+=0x1;_0x432c1b=new Hangup(_0x7d3112,_0xbc7225);_0x432c1b[_0x88fc('0x6b')]=0x10;_0x432c1b['statedesc']='AnswerAGI';_0x432c1b[_0x88fc('0x118')]=_0x88fc('0x12c');hopperUtils[_0x88fc('0xc6')](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12d')));hopperUtils[_0x88fc('0xc8')](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12a')));}if(_0x7d3112&&_0x7d3112[_0x88fc('0x43')]!==_0x88fc('0xbe')&&!isNotNull(this[_0x88fc('0x1f')][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0x12b')])){delete this[_0x88fc('0x27')][_0xbc7225[_0x88fc('0xbd')]];this['updateOriginated'](this[_0x88fc('0x1f')][_0x7d3112[_0x88fc('0xbc')]]);this[_0x88fc('0x1f')][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0x12e')]+=0x1;_0x432c1b=new Hangup(_0x7d3112,_0xbc7225);_0x432c1b['state']=0xc;_0x432c1b[_0x88fc('0xcf')]=_0xbc7225[_0x88fc('0x12f')];_0x432c1b[_0x88fc('0x118')]=_0x88fc('0x130');hopperUtils[_0x88fc('0xc6')](_0x432c1b)['catch'](loggerCatch(_0x88fc('0x12d')));hopperUtils['moveContactManagedDialer'](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12a')));}};Dialer[_0x88fc('0x1a')]['syncQueueSummary']=function(_0x449f98){var _0xad0c18=this;if(!_0xad0c18['queuesSummary'][_0x449f98[_0x88fc('0x47')]]){_0xad0c18[_0x88fc('0x2d')][_0x449f98[_0x88fc('0x47')]]={'running':![]};}else if(_0xad0c18['queuesSummary'][_0x449f98[_0x88fc('0x47')]][_0x88fc('0x131')]===!![]){return;}else if(_0xad0c18['queuesSummary'][_0x449f98[_0x88fc('0x47')]][_0x88fc('0x131')]===![]){_0xad0c18[_0x88fc('0x2d')][_0x449f98['name']][_0x88fc('0x131')]=!![];}var _0x4c53c8=_0xad0c18[_0x88fc('0x1f')][_0x449f98[_0x88fc('0x47')]];var _0x4bc594=_0x4c53c8[_0x88fc('0x66')]!==utils[_0x88fc('0x69')][_0x88fc('0x78')];var _0x5373df=utils[_0x88fc('0x132')](_0x4c53c8);_0x4c53c8[_0x88fc('0x133')]=utils[_0x88fc('0x134')](_0x4c53c8,_0xad0c18[_0x88fc('0x22')]);Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](function(){if(_0x4c53c8[_0x88fc('0x133')]===utils[_0x88fc('0x69')][_0x88fc('0x78')]){if(_0x4bc594){clearPredictiveAttributes(_0x4c53c8);_0x449f98[_0x88fc('0x29')]=undefined;_0x449f98[_0x88fc('0x2a')]=undefined;}if(_0x4c53c8[_0x88fc('0x133')]===utils['CAMPAIGN_STATUS'][_0x88fc('0x78')]){_0x449f98['available']=0x0;_0x449f98[_0x88fc('0xf2')]=0x0;_0x449f98['inUse']=0x0;_0x449f98[_0x88fc('0x135')]=0x0;_0x449f98[_0x88fc('0x136')]=0x0;}}else if(_0x4c53c8[_0x88fc('0x133')]===utils[_0x88fc('0x69')]['ACTIVE']&&!_0x5373df){return _0xad0c18[_0x88fc('0x8d')](_0x4c53c8,!![])[_0x88fc('0x9b')](function(){return _0xad0c18[_0x88fc('0x8d')](_0x4c53c8,![]);})[_0x88fc('0x9b')](function(){return _0xad0c18[_0x88fc('0xa9')](_0x4c53c8);})['catch'](function(_0x40afb7){loggerSyncQueueSummary[_0x88fc('0x44')](_0x88fc('0x137'),util['inspect'](_0x40afb7,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4c53c8);});}else{clearPredictiveAttributes(_0x4c53c8);}})[_0x88fc('0x9b')](function(){var _0x37b5c9=_0x449f98[_0x88fc('0x138')](_0x4c53c8);if(_0x37b5c9||_0x4c53c8['queueSummaryCountersUpdated']){_0x4c53c8[_0x88fc('0x139')]=![];_0x449f98[_0x88fc('0x13a')](_0x4c53c8);Object[_0x88fc('0x13b')](_0x4c53c8,_0x449f98);emitOutboundVoiceQueueSummary(_0x449f98);}_0xad0c18['queuesSummary'][_0x4c53c8[_0x88fc('0x47')]][_0x88fc('0x131')]=![];})['catch'](function(_0x423464){logger[_0x88fc('0x61')](_0x88fc('0x137'),util['inspect'](_0x423464,{'showHidden':![],'depth':null}));_0xad0c18[_0x88fc('0x2d')][_0x4c53c8[_0x88fc('0x47')]][_0x88fc('0x131')]=![];});};Dialer['prototype'][_0x88fc('0x37')]=_['throttle'](function(){var _0x2a901c=_['filter'](this[_0x88fc('0x1f')],function(_0xab2637){return _0xab2637[_0x88fc('0x13c')];});var _0x293d1e=_[_0x88fc('0x13d')](this['agents'],function(_0x4929c4){return _0x4929c4[_0x88fc('0x13e')]&&_0x4929c4[_0x88fc('0x83')]===_0x88fc('0x84');});if(_0x2a901c[_0x88fc('0xfc')]>0x0&&_0x293d1e[_0x88fc('0xfc')]>0x0){return Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x2a901c,'id'),previewRecallmeReminderInterval,_[_0x88fc('0x13f')](_0x293d1e,'id')))['then'](function(_0x3e3ffb){for(var _0x38b02c=0x0;_0x38b02c<_0x3e3ffb[_0x88fc('0xfc')];_0x38b02c++){var _0x1b313e=_0x3e3ffb[_0x38b02c][_0x88fc('0x140')][_0x88fc('0x47')];if(_0x1b313e)io['to'](util['format'](_0x88fc('0x141'),_0x1b313e))[_0x88fc('0x42')](_0x88fc('0x142'),{'hopper':_0x3e3ffb[_0x38b02c]});}})[_0x88fc('0x98')](function(_0xed87be){logger[_0x88fc('0x61')](_0x88fc('0x143'),_0xed87be);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x16e955=this;setInterval(function(){_0x16e955[_0x88fc('0x144')](_0x16e955[_0x88fc('0x27')],_0x88fc('0x145'));_0x16e955[_0x88fc('0x144')](_0x16e955['actions'],_0x88fc('0x146'));},0x32c8);};Dialer[_0x88fc('0x1a')]['clearZombieChannels']=function(_0x29df9d,_0x444402){var _0x572fde=this;for(var _0x4789b7 in _0x29df9d){if(typeof _0x29df9d[_0x4789b7]!==_0x88fc('0xa3')){this[_0x88fc('0x1d')][_0x88fc('0x147')](function(){if(!_[_0x88fc('0xf1')](_0x29df9d[_0x4789b7])){return ami[_0x88fc('0x148')]({'action':'status','channel':_0x29df9d[_0x4789b7][_0x88fc('0xec')]})['catch'](function(_0x52423e){if(_0x52423e[_0x88fc('0x66')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x29df9d[_0x4789b7]&&_0x29df9d[_0x4789b7][_0x88fc('0x43')]!==_0x88fc('0xbe')){_0x572fde[_0x88fc('0xf9')](_0x572fde[_0x88fc('0x1f')][_0x29df9d[_0x4789b7][_0x88fc('0xbc')]]);logger[_0x88fc('0x61')](_0x88fc('0x149'),_0x444402,_0x4789b7,_0x29df9d[_0x4789b7][_0x88fc('0xbc')]);delete _0x29df9d[_0x4789b7];}if(_0x29df9d[_0x4789b7]&&_0x29df9d[_0x4789b7]['type']===_0x88fc('0xbe')){_0x572fde[_0x88fc('0xf9')](_0x572fde[_0x88fc('0x20')][_0x29df9d[_0x4789b7]['queue']]);logger[_0x88fc('0x61')]('[Dialer][checkChannel][ivr]',_0x444402,_0x4789b7,_0x29df9d[_0x4789b7]['queue']);delete _0x29df9d[_0x4789b7];}},0x2328);}});}});}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x14a')]=function(_0x73dcf){return Promise[_0x88fc('0xa4')]()['then'](voiceQueueRt[_0x88fc('0x14a')](_0x73dcf))[_0x88fc('0x98')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x88fc('0x1a')][_0x88fc('0xf9')]=function(_0x149509){if(!_[_0x88fc('0x41')](_0x149509)&&_0x149509!==null){if(typeof _0x149509[_0x88fc('0x14b')]!==_0x88fc('0xa3')){if(_0x149509['originated']>0x0){_0x149509['originated']-=0x1;}else{logger['error'](_0x88fc('0x14c'));}}}else{logger[_0x88fc('0x61')](_0x88fc('0x14d'));}};Dialer['prototype'][_0x88fc('0x14e')]=function(_0xe63ca9,_0x24a3d2){var _0x332a9d=this;return function(_0x21c558){_0x332a9d[_0x88fc('0xf9')](_0x24a3d2);logger[_0x88fc('0x61')](_0xe63ca9,util[_0x88fc('0x63')](_0x21c558,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x298241,_0x79a50e,_0x3aeba9){var _0x540cc7={'state':0x19,'statedesc':_0x88fc('0x14f')};this[_0x88fc('0xf9')](_0x79a50e);this[_0x88fc('0x113')](_[_0x88fc('0x5d')](_0x540cc7,_[_0x88fc('0x71')](_0x3aeba9,['ContactId',_0x88fc('0xea'),'UserId',_0x88fc('0x101'),_0x88fc('0xdd')])),_0x88fc('0x150'),_0x88fc('0x151'));logger['error'](_0x298241);};Dialer['prototype'][_0x88fc('0x113')]=function(_0x39ad0d,_0x2f6cc9,_0x59d0f3){hopperUtils[_0x88fc('0xc6')](_0x39ad0d)[_0x88fc('0x98')](loggerCatch(_0x2f6cc9));hopperUtils[_0x88fc('0xc8')](_0x39ad0d)[_0x88fc('0x98')](loggerCatch(_0x59d0f3));};Dialer[_0x88fc('0x1a')]['queueCallerAbandonCreateState']=function(_0x27d54e,_0x3ecb08){hopperUtils[_0x88fc('0xc6')](_0x27d54e)[_0x88fc('0x98')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3ecb08==0x0){hopperUtils[_0x88fc('0xc8')](_0x27d54e)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x152')));}};Dialer[_0x88fc('0x1a')][_0x88fc('0x143')]=function(_0xd6b300){return Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](cmHopper[_0x88fc('0x153')](_0xd6b300['id'],previewRecallmeReminderInterval))[_0x88fc('0x9b')](function(_0x453ea5){for(var _0x21796c=0x0;_0x21796c<_0x453ea5['length'];_0x21796c++){var _0xd87eeb=_0x453ea5[_0x21796c]['Agent'][_0x88fc('0x47')];if(_0xd87eeb)io['to'](util['format'](_0x88fc('0x141'),_0xd87eeb))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x453ea5[_0x21796c]});}})[_0x88fc('0x98')](function(){});};Dialer[_0x88fc('0x1a')][_0x88fc('0xa7')]=function(_0x966865){var _0x12805b=this;return function(){_0x12805b[_0x88fc('0x154')](_0x966865);};};Dialer['prototype']['actionOriginate']=function(_0x7237de,_0x4dad40){var _0x5de31f=this;var _0x517240=uuid['v4']();this[_0x88fc('0x25')][_0x517240]=new Action(_0x7237de,_0x4dad40,_0x517240);return new Promise(function(_0x138038,_0x36dbbe){if(_[_0x88fc('0x41')](_0x7237de)&&typeof _0x7237de!==_0x88fc('0x155')){return _0x36dbbe(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x88fc('0x41')](_0x4dad40[_0x88fc('0x156')])||_0x4dad40[_0x88fc('0x156')]===null){return _0x36dbbe(msgResponse(_0x88fc('0x157'),_0x88fc('0x8e'),'contact\x20is\x20undefine'));}var _0x36273a={'XMD-CALLERID':_0x5de31f[_0x88fc('0x25')][_0x517240][_0x88fc('0x158')](),'XMD-AGI':_0x7237de['dialQueueProject']?util[_0x88fc('0x45')](_0x88fc('0x159'),ipAgi,_0x7237de[_0x88fc('0x12b')]):_0x88fc('0x15a'),'XMD-AGIAFTER':_0x7237de['dialQueueProject2']?util['format'](_0x88fc('0x159'),ipAgi,_0x7237de[_0x88fc('0xc4')]):_0x88fc('0x15a'),'XMD-QUEUE':utils['isOutboundQueue'](_0x7237de)?util[_0x88fc('0x45')]('\x22%s,%s%s,,,%s\x22',_0x7237de[_0x88fc('0x47')],_0x7237de['dialQueueOptions']||'',_0x7237de['dialAgiAfterHangupAgent']?'c':'',_0x7237de['dialQueueTimeout']||0x3):_0x88fc('0x15a'),'XMD-CONTACTID':_0x4dad40[_0x88fc('0xdc')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5de31f[_0x88fc('0x25')][_0x517240]['getCaller'](),'XMD-AMD':_0x7237de[_0x88fc('0x116')]?_0x88fc('0x15b'):_0x88fc('0x15a'),'XMD-DESTINATION':_0x88fc('0x10b')};if(_0x7237de[_0x88fc('0x116')]){_0x36273a[_0x88fc('0x15c')]=_0x7237de[_0x88fc('0x15d')]||0x9c4;_0x36273a[_0x88fc('0x15e')]=_0x7237de[_0x88fc('0x15f')]||0x5dc;_0x36273a[_0x88fc('0x160')]=_0x7237de[_0x88fc('0x161')]||0x320;_0x36273a['XMD-AMDTOTALANALYSISTIME']=_0x7237de['dialAMDTotalAnalysisTime']||0x1388;_0x36273a[_0x88fc('0x162')]=_0x7237de[_0x88fc('0x163')]||0x64;_0x36273a[_0x88fc('0x164')]=_0x7237de['dialAMDBetweenWordsSilence']||0x32;_0x36273a[_0x88fc('0x165')]=_0x7237de[_0x88fc('0x166')]||0x3;_0x36273a[_0x88fc('0x167')]=_0x7237de[_0x88fc('0x168')]||0x100;_0x36273a[_0x88fc('0x169')]=_0x7237de[_0x88fc('0x16a')]||0x1388;}if(utils['isOutboundQueue'](_0x7237de)){_0x36273a[_0x88fc('0x16b')]=_0x4dad40[_0x88fc('0x101')];}else{_0x36273a[_0x88fc('0x16c')]=_0x4dad40[_0x88fc('0xdd')];}for(var _0x587d7d in _0x4dad40['Contact']){if(typeof _0x4dad40[_0x88fc('0x16d')][_0x587d7d]!==_0x88fc('0xa3')){if(isNotNull(_0x4dad40[_0x88fc('0x16d')][_0x587d7d])&&_0x587d7d!=='id'&&_0x587d7d!==_0x88fc('0x16e')&&_0x587d7d!=='createdAt'&&_0x587d7d!==_0x88fc('0x16f')){_0x36273a[util[_0x88fc('0x45')]('%s%s',_0x88fc('0x170'),_['toUpper'](_0x587d7d))]=_0x4dad40[_0x88fc('0x16d')][_0x587d7d];}}}var _0xd7b091=_0x5de31f[_0x88fc('0x86')](_0x7237de[_0x88fc('0x87')])?utils[_0x88fc('0x171')](_0x7237de[_0x88fc('0x87')][_0x88fc('0x172')],_0x7237de[_0x88fc('0x173')],_0x7237de[_0x88fc('0x174')]>0x0?utils[_0x88fc('0x175')](_0x7237de[_0x88fc('0x176')],_0x7237de['dialRandomLastDigitCallerIdNumber']):_0x7237de['dialOriginateCallerIdNumber']):utils['getCallerId'](_[_0x88fc('0xf1')](_0x7237de[_0x88fc('0x177')])?_0x7237de['Trunk'][_0x88fc('0x172')]:_0x7237de[_0x88fc('0x177')][_0x88fc('0x172')],_0x7237de[_0x88fc('0x173')],_0x7237de[_0x88fc('0x174')]>0x0?utils[_0x88fc('0x175')](_0x7237de['dialOriginateCallerIdNumber'],_0x7237de['dialRandomLastDigitCallerIdNumber']):_0x7237de[_0x88fc('0x176')]);if(_0xd7b091){_0x36273a[_0x88fc('0x178')]=_0x5de31f[_0x88fc('0x25')][_0x517240]['originatecalleridname']=utils[_0x88fc('0x179')](_0xd7b091);_0x36273a[_0x88fc('0x17a')]=_0x4dad40[_0x88fc('0x156')];}_0x7237de[_0x88fc('0x17b')]=_0x36273a;return ami[_0x88fc('0x148')]({'actionid':_0x517240,'action':_0x88fc('0x157'),'channel':_0x5de31f['isTrunkReachable'](_0x7237de['Trunk'])?util[_0x88fc('0x45')](_0x88fc('0x17c'),_0x7237de[_0x88fc('0x87')][_0x88fc('0x47')],isNotNull(_0x7237de[_0x88fc('0x17d')])?_0x7237de[_0x88fc('0x17d')][_0x88fc('0x17e')]()||'':'',_0x7237de[_0x88fc('0x17f')]>0x0?_0x4dad40[_0x88fc('0x156')]['substring'](_0x7237de['dialCutDigit']):_0x4dad40[_0x88fc('0x156')]):util[_0x88fc('0x45')](_0x88fc('0x17c'),_[_0x88fc('0xf1')](_0x7237de[_0x88fc('0x177')])?_0x7237de[_0x88fc('0x87')][_0x88fc('0x47')]:_0x7237de[_0x88fc('0x177')][_0x88fc('0x47')],isNotNull(_0x7237de['dialPrefix'])?_0x7237de[_0x88fc('0x17d')][_0x88fc('0x17e')]()||'':'',_0x7237de[_0x88fc('0x17f')]>0x0?_0x4dad40[_0x88fc('0x156')][_0x88fc('0x180')](_0x7237de[_0x88fc('0x17f')]):_0x4dad40['phone']),'callerid':_0xd7b091,'Exten':_0x88fc('0x10b'),'Context':_0x88fc('0x181'),'Priority':'1','variable':_0x36273a,'timeout':(_0x7237de[_0x88fc('0x182')]||0x1e)*0x3e8,'async':!![],'channelid':_0x517240})[_0x88fc('0x9b')](function(_0x4ac65d){return _0x138038(_0x4ac65d);})[_0x88fc('0x98')](function(_0x367866){_0x7237de['outboundOriginateFailureCallsDay']+=0x1;var _0x37237d=new History(_0x5de31f[_0x88fc('0x25')][_0x517240]);logger[_0x88fc('0x61')](util[_0x88fc('0x45')](_0x88fc('0x183'),JSON[_0x88fc('0x70')](_0x367866)));_0x37237d[_0x88fc('0x6b')]=0xe;_0x37237d[_0x88fc('0xcf')]='OriginateError';_0x37237d[_0x88fc('0x6d')]=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));_0x37237d['endtime']=_0x37237d[_0x88fc('0x6d')];hopperUtils[_0x88fc('0xc6')](_0x37237d)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x184')));_0x5de31f[_0x88fc('0xc8')](_0x37237d)[_0x88fc('0x98')](loggerCatch('[originate][error]'))[_0x88fc('0x1c')](function(){delete _0x5de31f[_0x88fc('0x25')][_0x517240];return _0x36dbbe(msgResponse('originate','Error',_0x88fc('0x185')));});});});};Dialer[_0x88fc('0x1a')][_0x88fc('0x186')]=function(_0x3c1cf4,_0x4b7b0e,_0x2efcbf){var _0x43a4e0=new History(_0x4b7b0e);if(_0x43a4e0[_0x88fc('0x128')]+_0x43a4e0[_0x88fc('0x11b')]+_0x43a4e0[_0x88fc('0x11c')]+_0x43a4e0['countnosuchnumberretry']+_0x43a4e0[_0x88fc('0xd3')]+_0x43a4e0[_0x88fc('0xe7')]+_0x43a4e0[_0x88fc('0x119')]+_0x43a4e0[_0x88fc('0x11e')]>=_0x2efcbf[_0x88fc('0x129')]-0x1){return!![];}switch(_0x3c1cf4){case 0x3:if(_0x43a4e0[_0x88fc('0x11c')]>=_0x2efcbf[_0x88fc('0x187')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countnoanswerretry':_0x43a4e0[_0x88fc('0x11c')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x88fc('0xbf')),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x188')));break;case 0x5:if(_0x43a4e0[_0x88fc('0x128')]>=_0x2efcbf['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countbusyretry':_0x43a4e0[_0x88fc('0x128')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0x189')],_0x88fc('0xdb'))['format'](_0x88fc('0xbf')),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0['CampaignId']||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x18a')));break;case 0x8:if(_0x43a4e0[_0x88fc('0x11b')]>=_0x2efcbf[_0x88fc('0x18b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x43a4e0[_0x88fc('0x11b')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0x18c')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x18d')));break;case 0x0:if(_0x43a4e0[_0x88fc('0x11d')]>=_0x2efcbf[_0x88fc('0x18e')]-0x1){return!![];}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countnosuchnumberretry':_0x43a4e0[_0x88fc('0x11d')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf['dialNoSuchNumberRetryFrequency'],'minutes')[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0['VoiceQueueId']||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x18f')));}break;case 0xa:if(_0x43a4e0['countdropretry']>=_0x2efcbf[_0x88fc('0x190')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countdropretry':_0x43a4e0[_0x88fc('0xd3')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0xd4')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0['ListId'],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})['catch'](loggerCatch(_0x88fc('0xde')));break;case 0xb:if(_0x43a4e0[_0x88fc('0xe7')]>=_0x2efcbf[_0x88fc('0xe8')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countabandonedretry':_0x43a4e0[_0x88fc('0xe7')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0xe9')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})['catch'](loggerCatch(_0x88fc('0x191')));break;case 0x13:if(_0x43a4e0['countmachineretry']>=_0x2efcbf[_0x88fc('0x121')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countmachineretry':_0x43a4e0[_0x88fc('0x119')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0x124')],'minutes')[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0['ListId'],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0['CampaignId']||undefined})['catch'](loggerCatch(_0x88fc('0x125')));break;case 0x14:if(_0x43a4e0[_0x88fc('0x11e')]>=_0x2efcbf[_0x88fc('0x192')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countagentrejectretry':_0x43a4e0['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf['dialAgentRejectRetryFrequency'],_0x88fc('0xdb'))[_0x88fc('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0['ListId'],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x193')));break;default:return!![];}};Dialer[_0x88fc('0x1a')][_0x88fc('0x194')]=function(_0x37a3de,_0x7744f7,_0x729d24){var _0x334192=this;var _0x5d6839=new History(_0x37a3de);var _0x492831=![];var _0x49897f;var _0x5a47bb;return new Promise(function(_0x201939,_0xb2dc18){if(_[_0x88fc('0x41')](_0x7744f7)&&typeof _0x7744f7!==_0x88fc('0x155')){return _0xb2dc18(msgResponse(_0x88fc('0x195'),_0x88fc('0x8e'),_0x88fc('0x196')));}if(_[_0x88fc('0x41')](_0x729d24)&&typeof _0x729d24!==_0x88fc('0x155')){return _0xb2dc18(msgResponse('[callProgressDetecting]',_0x88fc('0x8e'),'evt\x20is\x20undefine'));}hopperUtils[_0x88fc('0xe6')](_0x5d6839,_0x729d24[_0x88fc('0xc1')],_0x7744f7)[_0x88fc('0x9b')](function(_0x51a074){if(_0x51a074['additional']==0x1)_0x492831=!![];switch(_0x729d24[_0x88fc('0xc1')]){case'0':_0x7744f7[_0x88fc('0x197')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x0;_0x5d6839[_0x88fc('0xcf')]='NoSuchNumber';_0x5d6839['countnosuchnumberretry']+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;ami['emit'](_0x88fc('0x198'),ut[_0x88fc('0x111')](_0x37a3de,_0x88fc('0x199')));_0x49897f=_0x7744f7['dialNoSuchNumberRetryFrequency'];_0x5a47bb=_0x7744f7[_0x88fc('0xd5')];hopperUtils[_0x88fc('0xc6')](_0x5d6839)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x11a')));if(_0x334192['checkRetriveMax'](0x0,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839['countnosuchnumberretry']>=_0x7744f7[_0x88fc('0x18e')]){_0x334192['createStateFinal'](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x19a'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x19a'));}}break;case'3':_0x7744f7[_0x88fc('0x19b')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x3;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0x19c');_0x5d6839['countnoanswerretry']+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;var _0x3cbc07=ut['buildNoAnswerEventPayload'](_0x37a3de,_0x7744f7);ami[_0x88fc('0x42')](_0x88fc('0x19d'),_0x3cbc07);_0x49897f=_0x7744f7[_0x88fc('0x19e')];_0x5a47bb=_0x7744f7[_0x88fc('0xd5')];hopperUtils['createHistory'](_0x5d6839)['catch'](loggerCatch(_0x88fc('0x19f')));if(_0x334192['checkRetriveMax'](0x3,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x11c')]>=_0x7744f7[_0x88fc('0x187')]){_0x334192['createStateFinal'](_0x5d6839,_0x201939,_0xb2dc18,'reason\x203\x20ringing\x20no\x20answer');}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1a0'));}}break;case'5':_0x7744f7[_0x88fc('0x1a1')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x5;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0x1a2');_0x5d6839[_0x88fc('0x128')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;ami[_0x88fc('0x42')](_0x88fc('0x1a3'),ut['buildObj'](_0x37a3de,_0x88fc('0x1a4')));_0x49897f=_0x7744f7['dialBusyRetryFrequency'];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x5d6839)[_0x88fc('0x98')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x334192[_0x88fc('0x186')](0x5,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x128')]>=_0x7744f7[_0x88fc('0x1a5')]){_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1a6'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1a6'));}}break;case'8':_0x7744f7[_0x88fc('0x1a7')]+=0x1;_0x5d6839['state']=0x8;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0x1a8');_0x5d6839[_0x88fc('0x11b')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;_0x49897f=_0x7744f7[_0x88fc('0x18c')];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];ami[_0x88fc('0x42')](_0x88fc('0x1a9'),ut[_0x88fc('0x111')](_0x37a3de,_0x88fc('0x1aa')));hopperUtils[_0x88fc('0xc6')](_0x5d6839)['catch'](loggerCatch(_0x88fc('0x1ab')));if(_0x334192[_0x88fc('0x186')](0x8,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x11b')]>=_0x7744f7[_0x88fc('0x18b')]){_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,'reason\x208\x20congestion');}else{_0x334192['stateGlobal'](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1ac'));}}break;case'11':_0x7744f7[_0x88fc('0x1ad')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0xb;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0xe3');_0x5d6839[_0x88fc('0xe7')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;_0x49897f=_0x7744f7[_0x88fc('0xe9')];_0x5a47bb=_0x7744f7[_0x88fc('0xd5')];hopperUtils[_0x88fc('0xc6')](_0x5d6839)['catch'](loggerCatch(_0x88fc('0xeb')));if(_0x334192[_0x88fc('0x186')](0xb,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0xe7')]>=_0x7744f7[_0x88fc('0xe8')]){_0x334192['createStateFinal'](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1ae'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1ae'));}}break;case'20':_0x7744f7[_0x88fc('0x1af')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x14;_0x5d6839['statedesc']=_0x88fc('0x1b0');_0x5d6839[_0x88fc('0x11e')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;_0x49897f=_0x7744f7[_0x88fc('0x1b1')];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];ami[_0x88fc('0x42')](_0x88fc('0x1b2'),ut[_0x88fc('0x111')](_0x37a3de,_0x88fc('0x1b3')));hopperUtils['createHistory'](_0x5d6839)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1b4')));if(_0x334192['checkRetriveMax'](0x14,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x11e')]>=_0x7744f7[_0x88fc('0x192')]){_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1b5'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1b5'));}}break;default:_0x7744f7['outboundUnknownCallsDay']+=0x1;_0x5d6839['state']=0xc;_0x5d6839[_0x88fc('0xcf')]=_0x729d24[_0x88fc('0xc1')];_0x49897f=_0x7744f7[_0x88fc('0x1b1')];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];hopperUtils[_0x88fc('0xc6')](_0x5d6839)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1b6')));if(_0x334192[_0x88fc('0x186')](_0x729d24[_0x88fc('0xc1')],_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x128')]+_0x5d6839[_0x88fc('0x11b')]+_0x5d6839[_0x88fc('0x11c')]+_0x5d6839['countnosuchnumberretry']+_0x5d6839[_0x88fc('0xd3')]+_0x5d6839[_0x88fc('0xe7')]+_0x5d6839[_0x88fc('0x119')]+_0x5d6839[_0x88fc('0x11e')]>=_0x7744f7[_0x88fc('0x129')]){_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x729d24[_0x88fc('0xc1')]);}else{_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,_0x729d24[_0x88fc('0xc1')]);}}}})['then'](function(){if(_0x492831){hopperUtils[_0x88fc('0xe1')](_0x5d6839,_0x49897f,_0x5a47bb)['then'](function(){return _0x201939(0x1);});}});});};Dialer[_0x88fc('0x1a')][_0x88fc('0x11f')]=function(_0x23e6e3,_0xbbea6c,_0x44c1af,_0x8bd824){var _0x25f032=new Final(_0x23e6e3);_0x25f032[_0x88fc('0x6b')]=0xf;_0x25f032[_0x88fc('0xcf')]=_0x88fc('0x1b7');this[_0x88fc('0x122')](_0x25f032,_0xbbea6c,_0x44c1af,_0x8bd824);};Dialer['prototype']['createStateFinal']=function(_0x2c36cc,_0x50282c,_0x4d5f88,_0x2340f2){hopperUtils['moveContactManagedDialer'](_0x2c36cc)[_0x88fc('0x9b')](function(){return _0x50282c(msgResponse(_0x88fc('0x195'),_0x88fc('0x106'),_0x2340f2));})[_0x88fc('0x98')](function(){return _0x4d5f88(msgResponse(_0x88fc('0x1b8'),_0x88fc('0x8e'),'contact\x20not\x20moved'));});};Dialer[_0x88fc('0x1a')]['predictive']=function(_0x54d691){var _0x2893f3=_0x54d691['dialPredictiveOptimizationPercentage']/0x64;var _0x510ec1=_0x54d691[_0x88fc('0x1b9')]/(_0x54d691[_0x88fc('0x1b9')]+_0x54d691['outboundAnswerCallsDay']);var _0x301414=Math['round'](_0x54d691['predictiveIntervalAvailable']*(_0x54d691[_0x88fc('0x1ba')]/0x64));var _0x20996f=Math[_0x88fc('0x1bb')](_0x54d691[_0x88fc('0x1bc')]*(_0x54d691[_0x88fc('0x1bd')]/0x64));var _0x3011b3=_0x54d691['available']+_0x54d691[_0x88fc('0x135')];var _0x3d26db=Math['floor'](_0x54d691['erlangCalls']*_0x54d691[_0x88fc('0x5a')]*_0x54d691['predictiveIntervalHitRate']*_0x54d691[_0x88fc('0x1be')]);if(_[_0x88fc('0x41')](_0x54d691['startProgressive'])){if(!_[_0x88fc('0x41')](_0x54d691['startPredictive'])){_0x54d691['startPredictive']=undefined;loggerPredictive[_0x88fc('0x61')](_0x88fc('0x1bf'),_0x88fc('0x1c0'));}if(!_[_0x88fc('0x41')](_0x54d691['handlePredictive'])){loggerPredictive['error'](_0x88fc('0x1bf'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x54d691[_0x88fc('0x60')]);_0x54d691[_0x88fc('0x60')]=undefined;}_0x54d691['startProgressive']=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1c1'),_0x54d691['startProgressive']);this['handlePower'](_0x54d691,0x1);}else if(ifInterval(_0x54d691[_0x88fc('0x1c2')],_0x54d691[_0x88fc('0x2a')])){this[_0x88fc('0xac')](_0x54d691,0x1);loggerPredictiveCalls[_0x88fc('0x49')](_0x88fc('0x1c3'),_0x54d691[_0x88fc('0x2a')],_0x54d691['name']);_0x54d691[_0x88fc('0x56')]=0x0;_0x54d691[_0x88fc('0xce')]=0x0;}else if(_0x2893f3<_0x510ec1&&_0x54d691[_0x88fc('0x1c4')]===_0x88fc('0x1c5')){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x88fc('0x1c6'),_0x510ec1,'startProgressive',_0x54d691[_0x88fc('0x47')]);}else if(_0x3d26db<_0x54d691[_0x88fc('0xce')]&&_0x54d691[_0x88fc('0x1c4')]===_0x88fc('0x1c5')){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x1c7'),_0x88fc('0x1c8'),_0x3d26db,'Drop\x20in\x20this\x20interval',_0x54d691[_0x88fc('0xce')],_0x88fc('0x2a'),_0x54d691[_0x88fc('0x47')]);}else if(!ifInterval(_0x54d691[_0x88fc('0x1c2')],_0x54d691[_0x88fc('0x2a')])&&_['isUndefined'](_0x54d691['startPredictive'])&&!_[_0x88fc('0x41')](_0x54d691[_0x88fc('0x2a')])){_0x54d691[_0x88fc('0x29')]=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1c9'),_0x54d691['startPredictive']);hopperUtils[_0x88fc('0x1ca')](_0x54d691[_0x88fc('0x1c2')])[_0x88fc('0x9b')](this[_0x88fc('0x1cb')](_0x54d691))[_0x88fc('0x9b')](mergeDataErlangB(_0x54d691))['then'](this[_0x88fc('0x1cc')](_0x54d691))[_0x88fc('0x98')](loggerCatchPredictive(_0x88fc('0x1cd'),_0x54d691));}else if(!ifInterval(_0x54d691[_0x88fc('0x1c2')],_0x54d691[_0x88fc('0x29')])){_0x54d691['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x54d691[_0x88fc('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x54d691[_0x88fc('0x47')],'recalculate\x20predictive\x20at',_0x54d691[_0x88fc('0x29')]);clearInterval(_0x54d691['handlePredictive']);_0x54d691[_0x88fc('0x60')]=undefined;hopperUtils[_0x88fc('0x1ca')](_0x54d691[_0x88fc('0x1c2')])[_0x88fc('0x9b')](this[_0x88fc('0x1cb')](_0x54d691))[_0x88fc('0x9b')](mergeDataErlangB(_0x54d691))[_0x88fc('0x9b')](this[_0x88fc('0x1cc')](_0x54d691))[_0x88fc('0x98')](loggerCatchPredictive(_0x88fc('0x1ce'),_0x54d691));}else if(_0x54d691['predictiveIntervalAvailable']&&_0x3011b3<_0x54d691[_0x88fc('0x1bc')]-_0x20996f){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1cf'),_0x3011b3,_0x88fc('0x1d0'),_0x54d691['predictiveIntervalAvailable'],'-',_0x20996f,'=',_0x54d691[_0x88fc('0x1bc')]-_0x20996f,')');}else if(_0x54d691[_0x88fc('0x1bc')]&&_0x3011b3>_0x54d691[_0x88fc('0x1bc')]+_0x301414){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1cf'),_0x3011b3,_0x88fc('0x1d1'),_0x54d691['predictiveIntervalAvailable'],'+',_0x301414,'=',_0x54d691['predictiveIntervalAvailable']+_0x301414,')');}};Dialer[_0x88fc('0x1a')][_0x88fc('0x1cb')]=function(_0x2c772b){var _0x2d25d0=this;return function(_0x33c9ac){return new Promise(function(_0x59c79e,_0x9c05d1){_[_0x88fc('0x5d')](_0x2c772b,_0x33c9ac[0x0]);if(checkGetDataPredictive(_0x33c9ac[0x0])){var _0x2a29be=_0x2c772b[_0x88fc('0x1bc')]=_0x2c772b[_0x88fc('0x135')]+_0x2c772b[_0x88fc('0x1d2')];var _0x58691d=_0x2c772b[_0x88fc('0x1c2')]*0x3c;var _0xe7c2b2=_0x33c9ac[0x0][_0x88fc('0x52')]+_0x33c9ac[0x0][_0x88fc('0x50')];var _0x5aa2cb=(_0x33c9ac[0x0][_0x88fc('0x4c')]+_0x33c9ac[0x0][_0x88fc('0xcd')]+_0x33c9ac[0x0][_0x88fc('0x4f')])/_0x33c9ac[0x0][_0x88fc('0x4b')];_0x2c772b[_0x88fc('0x1d3')]=_0x5aa2cb>0x0?_0x5aa2cb:0x1;switch(_0x2c772b[_0x88fc('0x1c4')]){case _0x88fc('0x1c5'):var _0x2d1dae=_0x2c772b[_0x88fc('0x1d4')]/0x64;return _0x2d25d0['abandonmentRate'](_0x2a29be,_0x58691d,_0xe7c2b2,_0x5aa2cb,_0x2d1dae)[_0x88fc('0x9b')](function(_0x1c1a82){return _0x59c79e(_0x1c1a82);});case _0x88fc('0x1d5'):var _0x57b8c7=_0x2c772b[_0x88fc('0x1d4')]/0x64;return _0x2d25d0['busyFactor'](_0x2a29be,_0x58691d,_0xe7c2b2,_0x5aa2cb,_0x57b8c7)[_0x88fc('0x9b')](function(_0x521c05){return _0x59c79e(_0x521c05);});default:return _0x9c05d1(msgResponse(_0x88fc('0x1d6'),_0x88fc('0x8e'),_0x88fc('0x1d7')));}}else{return _0x9c05d1(msgResponse(_0x88fc('0x1d6'),_0x88fc('0x8e'),_0x88fc('0x1d8')));}});};};Dialer[_0x88fc('0x1a')][_0x88fc('0x1d9')]=function(_0x10d18b){var _0xb910aa=this;return function(_0x3fa538){return new Promise(function(_0x659337,_0x564d92){_[_0x88fc('0x5d')](_0x10d18b,_0x3fa538[0x0]);if(checkGetDataPredictive(_0x3fa538[0x0])){loggerPredictive['info'](JSON[_0x88fc('0x70')](_0x3fa538[0x0]));if(_0x10d18b[_0x88fc('0x1c4')]===_0x88fc('0x1c5')){return _0xb910aa[_0x88fc('0x14a')](_0x10d18b['id'])[_0x88fc('0x9b')](function(_0x4f3936){var _0x14a1fc=_0x10d18b['loggedIn']-_0x4f3936[0x0][_0x88fc('0x1da')];var _0x151dbd=_0x10d18b[_0x88fc('0x1c2')]*0x3c;var _0x58fbc8=_0x3fa538[0x0]['predictiveIntervalAvgTalktime']+_0x3fa538[0x0][_0x88fc('0x50')];var _0x5ff586=(_0x3fa538[0x0][_0x88fc('0x4c')]+_0x3fa538[0x0][_0x88fc('0xcd')]+_0x3fa538[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3fa538[0x0]['predictiveIntervalTotalCalls'];var _0x1737f8=_0x10d18b['dialPredictiveOptimizationPercentage']/0x64;_0x10d18b[_0x88fc('0x1db')]=_0x4f3936[0x0][_0x88fc('0x1da')]||0x0;_0x10d18b[_0x88fc('0x1d3')]=_0x5ff586>0x0?_0x5ff586:0x1;return _0xb910aa[_0x88fc('0x1dc')](_0x14a1fc,_0x151dbd,_0x58fbc8,_0x5ff586,_0x1737f8);})['then'](function(_0xf1da1d){return _0x659337(_0xf1da1d);})[_0x88fc('0x98')](function(_0x23acdd){return _0x564d92(msgResponse('[CatchErlangB]',_0x88fc('0x8e'),JSON[_0x88fc('0x70')](_0x23acdd)));});}if(_0x10d18b['dialPredictiveOptimization']===_0x88fc('0x1d5')){return _0xb910aa[_0x88fc('0x14a')](_0x10d18b['id'])[_0x88fc('0x9b')](function(_0x4d2615){var _0x37c420=_0x10d18b[_0x88fc('0x1dd')]-_0x4d2615[0x0][_0x88fc('0x1da')];var _0x23836e=_0x10d18b[_0x88fc('0x1c2')]*0x3c;var _0x6bff86=_0x3fa538[0x0][_0x88fc('0x52')]+_0x3fa538[0x0][_0x88fc('0x50')];var _0x14b792=(_0x3fa538[0x0]['predictiveIntervalAnsweredCalls']+_0x3fa538[0x0][_0x88fc('0xcd')]+_0x3fa538[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3fa538[0x0]['predictiveIntervalTotalCalls'];var _0x39315b=_0x10d18b['dialPredictiveOptimizationPercentage']/0x64;_0x10d18b[_0x88fc('0x1db')]=_0x4d2615[0x0][_0x88fc('0x1da')]||0x0;_0x10d18b[_0x88fc('0x1d3')]=_0x14b792>0x0?_0x14b792:0x1;return _0xb910aa[_0x88fc('0x1de')](_0x37c420,_0x23836e,_0x6bff86,_0x14b792,_0x39315b);})[_0x88fc('0x9b')](function(_0x3cf8c4){return _0x659337(_0x3cf8c4);})[_0x88fc('0x98')](function(_0x5f54fa){return _0x564d92(msgResponse('[CatchErlangB]',_0x88fc('0x8e'),JSON[_0x88fc('0x70')](_0x5f54fa)));});}}else{return _0x564d92(msgResponse(_0x88fc('0x1d6'),'Failure',_0x88fc('0x1d8')));}});};};Dialer[_0x88fc('0x1a')][_0x88fc('0x1cc')]=function(_0x326da0){var _0x4c1b64=this;return function(){var _0x3951db=0x0;var _0xe4307c=Math[_0x88fc('0x1df')](_0x326da0[_0x88fc('0x58')]*0x3e8);if(_0xe4307c>0x0){_0xe4307c=_0xe4307c<0x64?0x64:_0xe4307c;loggerPredictive[_0x88fc('0x49')](_0x326da0[_0x88fc('0x47')],_0x88fc('0x1e0'),_0xe4307c,_0x88fc('0x1e1'));_0x326da0[_0x88fc('0x60')]=setInterval(function(){_0x4c1b64['handlePredictive'](_0x326da0);loggerPredictiveCalls[_0x88fc('0x49')](_0x88fc('0x1e2'),_0x3951db+=0x1);},_0xe4307c);}else{loggerPredictive[_0x88fc('0x49')](_0x326da0['name'],_0x88fc('0x1e3'));}};};Dialer['prototype'][_0x88fc('0x1e4')]=function(_0x189907,_0x530c90){var _0xae0cde=this;return function(_0x85a01c){if(_[_0x88fc('0x76')](_0x85a01c)){if(_[_0x88fc('0xf1')](_0x530c90['UserId'])||!_0x530c90[_0x88fc('0x1e5')]){if(_0x189907[_0x88fc('0xaa')]===_0x88fc('0xaf')){_0x189907[_0x88fc('0x6e')]=_[_0x88fc('0x41')](_0x189907['queueStatusComplete'])?!![]:_0x189907['queueStatusComplete'];var _0x37109c=uuid['v4']();_0xae0cde[_0x88fc('0x25')][_0x37109c]=new Action(_0x189907,_0x530c90,_0x37109c);loggerBooked[_0x88fc('0x49')](_0x88fc('0x1e6'),_0x37109c,'queueStatusComplete:\x20',JSON['stringify'](_0x189907['queueStatusComplete']),_0x88fc('0x1e7'),_0x189907['name']);if(_0x189907[_0x88fc('0x6e')]){_0x189907[_0x88fc('0x6e')]=![];_0xae0cde[_0x88fc('0xf5')][_0xae0cde['actions'][_0x37109c][_0x88fc('0xbc')]]=[];ami[_0x88fc('0x148')]({'actionid':_0x37109c,'action':_0x88fc('0x1e8'),'queue':_0x189907['name']})['catch'](function(){_0xae0cde[_0x88fc('0xf9')](_0x189907);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xae0cde['actions'][_0x37109c]['ContactId'],'ListId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xea')],'VoiceQueueId':_0xae0cde['actions'][_0x37109c]['VoiceQueueId']||undefined,'CampaignId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xae0cde['actions'][_0x37109c];});}else{loggerBooked[_0x88fc('0x49')]('[booked][checkContactBlack][else]',JSON[_0x88fc('0x70')](_0x189907[_0x88fc('0x6e')]),_0x88fc('0x1e7'),_0x189907['name']);_0xae0cde[_0x88fc('0xf9')](_0x189907);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xdc')],'ListId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xea')],'VoiceQueueId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0x101')]||undefined,'CampaignId':_0xae0cde['actions'][_0x37109c][_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1e9')));delete _0xae0cde[_0x88fc('0x25')][_0x37109c];}}else{return _0xae0cde[_0x88fc('0x1ea')](_0x189907,_0x530c90);}}else{if(utils[_0x88fc('0x5e')](undefined,_0x530c90[_0x88fc('0x1eb')])<_0x189907[_0x88fc('0x1ec')]*0x3c){if(_0x530c90[_0x88fc('0x140')]&&!_0x530c90['Agent']['voicePause']){_0xae0cde[_0x88fc('0x1e')][_0x88fc('0xf7')](_0x530c90['id'])[_0x88fc('0x1c')](function(){_0xae0cde['updateOriginated'](_0x189907);});}else{hopperUtils[_0x88fc('0x1ed')]({'active':![]},_0x530c90['id'],0x1)['finally'](function(){_0xae0cde[_0x88fc('0xf9')](_0x189907);});}}else{_0x189907[_0x88fc('0x1ee')]+=0x1;_0xae0cde['updateOriginated'](_0x189907);if(_0x189907[_0x88fc('0x1ef')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x530c90[_0x88fc('0xdc')],'ListId':_0x530c90['ListId'],'VoiceQueueId':_0x530c90['VoiceQueueId']||undefined,'CampaignId':_0x530c90[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1f0')));hopperUtils[_0x88fc('0xc6')](createObjHistory(_0x189907,_0x530c90,utils[_0x88fc('0x69')][_0x88fc('0x1f1')],0x17,_0x88fc('0x1f2')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xae0cde[_0x88fc('0x113')](createObjHistory(_0x189907,_0x530c90,utils[_0x88fc('0x69')][_0x88fc('0x1f3')],0x16,_0x88fc('0x1f4')),_0x88fc('0x1f5'),_0x88fc('0x1f6'));}}}}else{_0x189907[_0x88fc('0x1f7')]+=0x1;_0xae0cde[_0x88fc('0x113')](createObjHistory(_0x189907,_0x530c90,utils[_0x88fc('0x69')][_0x88fc('0x1f8')],0xd,'Blacklist'),_0x88fc('0x1f9'),'[Originate][MoveBlacklist]');throw _0x88fc('0x1fa');}};};Dialer['prototype'][_0x88fc('0x154')]=function(_0x538add){var _0x128d0f=this;var _0x5dff69=_0x538add[_0x88fc('0x1fb')]-_0x538add[_0x88fc('0x14b')]-_0x538add['temp'];emitCampaignSummary(_0x538add);if(_0x5dff69>0x0){if(_0x5dff69>this[_0x88fc('0x23')]){_0x5dff69=this[_0x88fc('0x23')];}_0x538add[_0x88fc('0x1fc')]+=_0x5dff69;hopperUtils[_0x88fc('0x1fd')](_0x538add,_0x5dff69)[_0x88fc('0x9b')](function(_0x1997d7){_0x538add[_0x88fc('0x1fc')]-=_0x5dff69;_0x538add[_0x88fc('0x1fc')]=_0x538add[_0x88fc('0x1fc')]>0x0?_0x538add[_0x88fc('0x1fc')]:0x0;if(!utils[_0x88fc('0x1fe')](_0x1997d7)){_0x538add[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x1ff')];logger[_0x88fc('0x49')](_0x88fc('0x200')+_0x538add['name']);}else{_0x538add[_0x88fc('0x14b')]+=_0x1997d7[_0x88fc('0xfc')];_0x538add[_0x88fc('0x66')]=utils[_0x88fc('0x69')]['RUNNING'];for(var _0x185bf9=0x0;_0x185bf9<_0x1997d7[_0x88fc('0xfc')];_0x185bf9+=0x1){_0x538add[_0x88fc('0x201')]+=0x1;if(_[_0x88fc('0xf1')](_0x1997d7[_0x185bf9])||_[_0x88fc('0xf1')](_0x1997d7[_0x185bf9][_0x88fc('0x16d')])||_[_0x88fc('0xf1')](_0x1997d7[_0x185bf9]['phone'])){_0x128d0f['emptyContact'](_0x88fc('0x202'),_0x538add,_0x1997d7[_0x185bf9]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x88fc('0x71')](_0x1997d7[_0x185bf9],[_0x88fc('0xdd'),_0x88fc('0x156')]))[_0x88fc('0x9b')](_0x128d0f[_0x88fc('0x1e4')](_0x538add,_0x1997d7[_0x185bf9]))['catch'](_0x128d0f[_0x88fc('0x14e')]('[actionOriginateIvr]\x20',_0x538add));}}}})[_0x88fc('0x98')](loggerGetContactDialer(_0x88fc('0x203'),_0x538add,_0x5dff69));}};Dialer['prototype'][_0x88fc('0xac')]=function(_0x26ac93,_0x378e5f){var _0x185866=this;var _0x1be643=[];if(_0x378e5f<0x1||_0x26ac93['dialMethod']===_0x88fc('0xaf')){_0x378e5f=0x1;}var _0x1bcd71=Math[_0x88fc('0x1df')](_0x26ac93[_0x88fc('0x1d2')]*_0x378e5f)-_0x26ac93[_0x88fc('0x14b')]-_0x26ac93['temp'];if(_0x26ac93['dialLimitQueue']>0x0){var _0x46100a=_0x26ac93[_0x88fc('0x204')]-_0x26ac93[_0x88fc('0x14b')]-_0x26ac93[_0x88fc('0x135')]-_0x26ac93[_0x88fc('0x1fc')]-_0x26ac93['pTalking'];if(_0x1bcd71>_0x46100a){_0x1bcd71=_0x46100a;}}if(_0x1bcd71>0x0){if(_0x26ac93[_0x88fc('0xaa')]===_0x88fc('0xaf')){_0x1bcd71=0x1;}if(_0x1bcd71>this[_0x88fc('0x23')]){_0x1bcd71=this[_0x88fc('0x23')];}_0x26ac93[_0x88fc('0x1fc')]+=_0x1bcd71;for(var _0xcf437e in this[_0x88fc('0x21')]){if(typeof this[_0x88fc('0x21')][_0xcf437e]!==_0x88fc('0xa3')){if(this[_0x88fc('0x21')][_0xcf437e][_0x88fc('0x6b')]===_0x88fc('0x205')&&this['agents'][_0xcf437e][_0x88fc('0x83')]==='reachable'){_0x1be643['push'](this[_0x88fc('0x21')][_0xcf437e]['id']);}}}hopperUtils[_0x88fc('0x206')](_0x26ac93,_0x1be643,_0x1bcd71)[_0x88fc('0x9b')](function(_0x2abc0e){_0x26ac93[_0x88fc('0x1fc')]-=_0x1bcd71;_0x26ac93[_0x88fc('0x1fc')]=_0x26ac93[_0x88fc('0x1fc')]>0x0?_0x26ac93[_0x88fc('0x1fc')]:0x0;if(!utils[_0x88fc('0x1fe')](_0x2abc0e)){hopperUtils[_0x88fc('0x207')](_0x26ac93)[_0x88fc('0x9b')](sendMessageReschedule(_0x26ac93))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x26ac93['originated']+=_0x2abc0e[_0x88fc('0xfc')];_0x26ac93[_0x88fc('0x66')]=_0x26ac93[_0x88fc('0xaa')]==='booked'?utils[_0x88fc('0x69')]['ACTIVE']:utils[_0x88fc('0x69')][_0x88fc('0x208')];for(var _0x33d715=0x0;_0x33d715<_0x2abc0e['length'];_0x33d715+=0x1){if(_[_0x88fc('0xf1')](_0x2abc0e[_0x33d715])||_['isNil'](_0x2abc0e[_0x33d715][_0x88fc('0x16d')])||_[_0x88fc('0xf1')](_0x2abc0e[_0x33d715][_0x88fc('0x156')])){_0x185866[_0x88fc('0x209')](_0x88fc('0x202'),_0x26ac93,_0x2abc0e[_0x33d715]);}else{hopperUtils[_0x88fc('0x20a')](_[_0x88fc('0x71')](_0x2abc0e[_0x33d715],[_0x88fc('0x101'),_0x88fc('0x156')]))[_0x88fc('0x9b')](_0x185866[_0x88fc('0x1e4')](_0x26ac93,_0x2abc0e[_0x33d715]))['catch'](_0x185866[_0x88fc('0x14e')](_0x88fc('0x202'),_0x26ac93));}}}})[_0x88fc('0x98')](loggerGetContactDialer('[getContactDialer2]',_0x26ac93,_0x1bcd71));}};Dialer[_0x88fc('0x1a')][_0x88fc('0x60')]=function(_0x77c128){if(_0x77c128[_0x88fc('0x204')]>0x0){var _0x18be4d=_0x77c128['dialLimitQueue']-_0x77c128[_0x88fc('0x14b')]-_0x77c128[_0x88fc('0x135')];if(_0x18be4d>0x0){this['tryOriginatePredictive'](_0x77c128);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x88fc('0x20b')](_0x77c128);}};Dialer['prototype'][_0x88fc('0x20b')]=function(_0x4a806c){var _0x4fea91=this;var _0x4ff2c6=[];_0x4a806c[_0x88fc('0x14b')]+=0x1;for(var _0x106153 in this[_0x88fc('0x21')]){if(typeof this[_0x88fc('0x21')][_0x106153]!==_0x88fc('0xa3')){if(this[_0x88fc('0x21')][_0x106153][_0x88fc('0x6b')]===_0x88fc('0x205')&&this[_0x88fc('0x21')][_0x106153][_0x88fc('0x83')]===_0x88fc('0x84')){_0x4ff2c6[_0x88fc('0x93')](this['agents'][_0x106153]['id']);}}}return this['getContactDialer'](_0x4a806c['id'],_0x4ff2c6,0x1,_0x4a806c[_0x88fc('0x20c')],_0x4a806c)['then'](function(_0x131101){if(!utils[_0x88fc('0x1fe')](_0x131101)){utils['checkContactLowerLimitOriginate'](_0x4a806c,0x1,0x0);return hopperUtils[_0x88fc('0x207')](_0x4a806c)['then'](sendMessageReschedule(_0x4a806c))['catch'](loggerCatch(_0x88fc('0x20d')));}else{_0x4a806c[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x208')];if(_[_0x88fc('0xf1')](_0x131101[0x0])||_[_0x88fc('0xf1')](_0x131101[0x0][_0x88fc('0x16d')])||_['isNil'](_0x131101[0x0][_0x88fc('0x156')])){_0x4fea91[_0x88fc('0x209')](_0x88fc('0x202'),_0x4a806c,_0x131101[0x0]);}else{return hopperUtils[_0x88fc('0x20a')](_[_0x88fc('0x71')](_0x131101[0x0],[_0x88fc('0x101'),'phone']))[_0x88fc('0x9b')](_0x4fea91[_0x88fc('0x1e4')](_0x4a806c,_0x131101[0x0]))['catch'](_0x4fea91['loggerHandler'](_0x88fc('0x20e'),_0x4a806c));}}})['catch'](loggerGetContactDialer(_0x88fc('0x20f'),_0x4a806c,0x1));};Dialer[_0x88fc('0x1a')][_0x88fc('0x1dc')]=function(_0x5a5b4b,_0x356ef3,_0xd034dc,_0x3dd225,_0x403eee,_0x2364ea){loggerPredictive['info'](_0x88fc('0x210'));loggerPredictive[_0x88fc('0x49')](_0x88fc('0x211'),_0x5a5b4b);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x356ef3);loggerPredictive['info'](_0x88fc('0x212'),_0xd034dc);loggerPredictive['info'](_0x88fc('0x213'),_0x3dd225);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x403eee);loggerPredictive['info'](_0x88fc('0x51'));return new Promise(function(_0x370b0b,_0x138762){if(_0x5a5b4b<=0x0||isNaN(_0x5a5b4b)){return _0x138762(msgResponse('[abandonmentRate]',_0x88fc('0x80'),_0x88fc('0x214')+_0x5a5b4b));}if(_0xd034dc<=0x0||isNaN(_0xd034dc)){return _0x138762(msgResponse(_0x88fc('0x215'),_0x88fc('0x80'),_0x88fc('0x216')+_0xd034dc));}if(_0x3dd225<=0x0||isNaN(_0x3dd225)){return _0x138762(msgResponse(_0x88fc('0x215'),_0x88fc('0x80'),'p\x20=\x20'+_0x3dd225));}if(_0x356ef3<=0x0||isNaN(_0x356ef3)){return _0x138762(msgResponse('[abandonmentRate]','Error',_0x88fc('0x217')+_0x356ef3));}if(_0x403eee<=0x0||isNaN(_0x403eee)){return _0x138762(msgResponse(_0x88fc('0x215'),_0x88fc('0x80'),_0x88fc('0x218')+_0x403eee));}_0x2364ea=_0x2364ea||0x0;var _0x49fdfd=0x1/_0xd034dc;var _0x5a2f9a=0x0;var _0x5ec7f0=0x0;var _0x23cf19=0x0;var _0x3ebea3=0x0;for(var _0x36ac9e=0x0;_0x23cf19<_0x403eee;_0x36ac9e+=0x1){_0x5ec7f0=_0x36ac9e/_0x356ef3;_0x5a2f9a=(_0x3dd225*_0x5ec7f0+_0x2364ea)/_0x49fdfd;_0x23cf19=utils[_0x88fc('0x219')](_0x5a2f9a,_0x5a5b4b);_0x3ebea3=_0x5a2f9a/_0x5a5b4b*(0x1-utils[_0x88fc('0x219')](_0x5a2f9a,_0x5a5b4b));}return _0x370b0b({'erlangCalls':_0x36ac9e,'erlangCallToSecond':_0x356ef3/_0x36ac9e,'erlangAbandonmentRate':_0x23cf19,'erlangBusyFactor':_0x3ebea3});});};Dialer[_0x88fc('0x1a')]['busyFactor']=function(_0x2b3048,_0x2e6738,_0x578179,_0x51314b,_0x4e13f9,_0x471a80){loggerPredictive['info'](_0x88fc('0x21a'));loggerPredictive[_0x88fc('0x49')](_0x88fc('0x211'),_0x2b3048);loggerPredictive['info'](_0x88fc('0x21b'),_0x2e6738);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x212'),_0x578179);loggerPredictive[_0x88fc('0x49')]('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',_0x51314b);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x21c'),_0x4e13f9);loggerPredictive['info'](_0x88fc('0x51'));return new Promise(function(_0x1351a4,_0x3aeda8){if(_0x2b3048<=0x0||isNaN(_0x2b3048)){return _0x3aeda8(msgResponse('[busyFactor]',_0x88fc('0x80'),_0x88fc('0x214')+_0x2b3048));}if(_0x578179<=0x0||isNaN(_0x578179)){return _0x3aeda8(msgResponse(_0x88fc('0x21d'),_0x88fc('0x80'),_0x88fc('0x216')+_0x578179));}if(_0x51314b<=0x0||isNaN(_0x51314b)){return _0x3aeda8(msgResponse(_0x88fc('0x21d'),_0x88fc('0x80'),_0x88fc('0x21e')+_0x51314b));}if(_0x2e6738<=0x0||isNaN(_0x2e6738)){return _0x3aeda8(msgResponse('[busyFactor]','Error','interval\x20=\x20'+_0x2e6738));}if(_0x4e13f9<=0x0||isNaN(_0x4e13f9)){return _0x3aeda8(msgResponse(_0x88fc('0x21d'),'Error',_0x88fc('0x21f')+_0x4e13f9));}_0x471a80=_0x471a80||0x0;var _0x32ca49=0x1/_0x578179;var _0x3b2963=0x0;var _0x2b21ff=0x0;var _0xd07738=0x0;var _0x230ddb=0x0;for(var _0x55f505=0x0;_0x230ddb<_0x4e13f9;_0x55f505+=0x1){_0x2b21ff=_0x55f505/_0x2e6738;_0x3b2963=(_0x51314b*_0x2b21ff+_0x471a80)/_0x32ca49;_0xd07738=utils['erlangb'](_0x3b2963,_0x2b3048);_0x230ddb=_0x3b2963/_0x2b3048*(0x1-utils[_0x88fc('0x219')](_0x3b2963,_0x2b3048));}return _0x1351a4({'erlangCalls':_0x55f505,'erlangCallToSecond':_0x2e6738/_0x55f505,'erlangAbandonmentRate':_0xd07738,'erlangBusyFactor':_0x230ddb});});};module[_0x88fc('0x220')]=Dialer; \ No newline at end of file +var _0x127a=['rrmemory','isNil','stateinterface','locked','queueBooked','pick','syncQueueStatusComplete','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','createHistory','countcongestionretry','stateGlobal','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','moveContactManagedDialer','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','user:dialPreviewRecallReminder','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','getCallerId','dialOriginateCallerIdName','dialOriginateCallerIdNumber','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','[callProgressDetecting]','reason','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','dialPredictiveOptimizationPercentage','abandonmentRate','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','busyFactor','[getDataPredictive]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','voicePause','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','checkContactLowerLimitOriginate','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','m\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','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','name','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','AVG\x20Hold\x20Time:\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','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','originated','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','timezones','indexOf','true','Action','content','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','method\x20not\x20recognized','dialGlobalInterval','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','Drop','dropreason','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','voiceQueue','countabandonedretry','dialAbandonedMaxRetry','additional','ContactId','[rescheduleContact][Abandoned]','swapAdditionalPhones','syncNewExten','channel','syncQueueMember','actionid'];(function(_0x87ac77,_0x44a527){var _0x257ee4=function(_0x3db382){while(--_0x3db382){_0x87ac77['push'](_0x87ac77['shift']());}};_0x257ee4(++_0x44a527);}(_0x127a,0x125));var _0xa127=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x127a[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require(_0xa127('0x0'));var _=require(_0xa127('0x1'));var uuid=require(_0xa127('0x2'));var moment=require(_0xa127('0x3'));var rr=require('rr');var Redis=require(_0xa127('0x4'));var utils=require(_0xa127('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0xa127('0x6'));var config=require('../../../config/environment/');var logger=require(_0xa127('0x7'))(_0xa127('0x8'));var loggerBooked=require('../../../config/logger')(_0xa127('0x9'));var loggerPredictive=require(_0xa127('0x7'))(_0xa127('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xa127('0xb'));var loggerSyncQueueSummary=require(_0xa127('0x7'))(_0xa127('0xc'));var ami=require(_0xa127('0xd'));config['redis']=_[_0xa127('0xe')](config[_0xa127('0xf')],{'host':_0xa127('0x10'),'port':0x18eb});var io=require(_0xa127('0x11'))(new Redis(config[_0xa127('0xf')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xa127('0x12'));var RpcSetting=require(_0xa127('0x13'));var Interval=require(_0xa127('0x14'));var Action=require(_0xa127('0x15'));var History=require(_0xa127('0x16'));var Final=require('./models/final');var AgentComplete=require(_0xa127('0x17'));var QueueCallerAbandon=require(_0xa127('0x18'));var Hangup=require(_0xa127('0x19'));var ipAgi=process[_0xa127('0x1a')][_0xa127('0x1b')]||_0xa127('0x1c');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa127('0x1d')][_0xa127('0x1e')]=function(_0xb7213){this[_0xa127('0x1f')]=this['tail']?this[_0xa127('0x1f')][_0xa127('0x20')](_0xb7213):_0xb7213();};function Dialer(_0x5b212d,_0x4319fc){this[_0xa127('0x21')]=new Sequence();this[_0xa127('0x22')]=_0x4319fc;this['voiceQueues']=_0x5b212d[_0xa127('0x23')];this[_0xa127('0x24')]=_0x5b212d['campaigns'];this['agents']=_0x5b212d[_0xa127('0x25')];this[_0xa127('0x26')]=_0x5b212d[_0xa127('0x26')];this[_0xa127('0x27')]=config['maxNumberOriginate']||0x2;this[_0xa127('0x28')]={};this[_0xa127('0x29')]={};this[_0xa127('0x2a')]={};this[_0xa127('0x2b')]={};this[_0xa127('0x2c')]={};this[_0xa127('0x2d')]={};this['startProgressive']={};this[_0xa127('0x2e')]={};this['queueBooked']={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this[_0xa127('0x2f')]['bind'](this));ami['on'](_0xa127('0x30'),this[_0xa127('0x31')][_0xa127('0x32')](this));ami['on']('originateresponse',this[_0xa127('0x33')][_0xa127('0x32')](this));ami['on'](_0xa127('0x34'),this[_0xa127('0x35')][_0xa127('0x32')](this));ami['on'](_0xa127('0x36'),this[_0xa127('0xc')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0xa127('0x37')][_0xa127('0x32')](this));ami['on']('hangup',this[_0xa127('0x38')][_0xa127('0x32')](this));ami['on'](_0xa127('0x39'),this['syncNewExten'][_0xa127('0x32')](this));ami['on'](_0xa127('0x3a'),this[_0xa127('0x3b')][_0xa127('0x32')](this));ami['on'](_0xa127('0x3c'),this['syncQueueMember'][_0xa127('0x32')](this));ami['on'](_0xa127('0x3d'),this['syncQueueStatusComplete'][_0xa127('0x32')](this));this[_0xa127('0x3e')]();this[_0xa127('0x3f')]();RpcSetting[_0xa127('0x40')]()[_0xa127('0x41')](function(_0x30f1c8){previewRecallmeReminderInterval=_0x30f1c8[_0xa127('0x42')];});}function isNotNull(_0x435785){return _0x435785!==null&&!_[_0xa127('0x43')](_0x435785);}function msgResponse(_0x241e8c,_0x1b6020,_0x46c9ba){return{'action':_0x241e8c,'response':_0x1b6020,'message':_0x46c9ba,'stack':_0x46c9ba};}function emit(_0x54f512,_0x1c34fc,_0x4a08ba){io['to'](_0x54f512)[_0xa127('0x44')](_0x1c34fc,_0x4a08ba);}function emitOutboundVoiceQueueSummary(_0x3ddb91){if(_0x3ddb91[_0xa127('0x45')]===_0xa127('0x46')){logger[_0xa127('0x47')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x3ddb91,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x3ddb91[_0xa127('0x48')]),'voice_queue:save',_0x3ddb91);}}function checkGetDataPredictive(_0x396ecf){if(isNotNull(_0x396ecf)&&!_[_0xa127('0x49')](_0x396ecf)){loggerPredictive[_0xa127('0x4a')](_0xa127('0x4b'));loggerPredictive[_0xa127('0x4a')](_0xa127('0x4c'),_0x396ecf[_0xa127('0x4d')]);loggerPredictive[_0xa127('0x4a')](_0xa127('0x4e'),_0x396ecf[_0xa127('0x4f')]);loggerPredictive[_0xa127('0x4a')](_0xa127('0x50'),_0x396ecf['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xa127('0x4a')](_0xa127('0x51'),_0x396ecf['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xa127('0x4a')](_0xa127('0x52'),_0x396ecf[_0xa127('0x53')]);loggerPredictive[_0xa127('0x4a')](_0xa127('0x54'),_0x396ecf[_0xa127('0x55')]);loggerPredictive['info'](_0xa127('0x56'));if(_0x396ecf[_0xa127('0x4d')]>0x0){if(!_['isUndefined'](_0x396ecf[_0xa127('0x55')])&&_0x396ecf[_0xa127('0x55')]>0x0){return!![];}loggerPredictive[_0xa127('0x4a')](_0xa127('0x57'));if(!_[_0xa127('0x43')](_0x396ecf[_0xa127('0x53')])&&_0x396ecf[_0xa127('0x53')]>0x0){return!![];}loggerPredictive[_0xa127('0x4a')](_0xa127('0x58'));}else{loggerPredictive[_0xa127('0x4a')](_0xa127('0x59'));}}else{loggerPredictive[_0xa127('0x4a')](_0xa127('0x5a'));}return![];}function mergeDataErlangB(_0xea7612){return function(_0x3a7e04){loggerPredictive[_0xa127('0x4a')](_0xa127('0x5b'));loggerPredictive[_0xa127('0x4a')](_0xa127('0x5c'),_0x3a7e04[_0xa127('0x5d')]);loggerPredictive['info'](_0xa127('0x5e'),_0x3a7e04[_0xa127('0x5f')]);loggerPredictive[_0xa127('0x4a')](_0xa127('0x60'),_0x3a7e04[_0xa127('0x61')]);loggerPredictive[_0xa127('0x4a')](_0xa127('0x62'),_0x3a7e04[_0xa127('0x63')]);loggerPredictive[_0xa127('0x4a')](_0xa127('0x60'),_0x3a7e04['erlangAbandonmentRate']);loggerPredictive[_0xa127('0x4a')](_0xa127('0x56'));_[_0xa127('0x64')](_0xea7612,_0x3a7e04);};}function ifInterval(_0x4a12eb,_0x49f332){if(_['isUndefined'](_0x49f332)){return![];}return utils[_0xa127('0x65')](undefined,_0x49f332)<_0x4a12eb*0x3c;}function clearPredictiveAttributes(_0x18d14b){if(_0x18d14b[_0xa127('0x66')]){_0x18d14b['startProgressive']=undefined;loggerPredictive['debug'](_0x18d14b['name'],_0xa127('0x67'));}if(_0x18d14b[_0xa127('0x2d')]){_0x18d14b[_0xa127('0x2d')]=undefined;loggerPredictive[_0xa127('0x47')](_0x18d14b['name'],_0xa127('0x68'));}if(_0x18d14b['handlePredictive']){clearInterval(_0x18d14b[_0xa127('0x69')]);_0x18d14b[_0xa127('0x69')]=undefined;loggerPredictive[_0xa127('0x47')](_0x18d14b['name'],_0xa127('0x6a'));}}function loggerCatchPredictive(_0x5486ad,_0x48cce4){return function(_0x4f5e8c){loggerPredictive['error'](_0x48cce4['name'],_0x5486ad);loggerPredictive['error'](_0x4f5e8c['stack']);clearPredictiveAttributes(_0x48cce4);};}function loggerCatch(_0x46a7d7){return function(_0x4a0af7){logger[_0xa127('0x6b')](_0x46a7d7,util[_0xa127('0x6c')](_0x4a0af7,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3719d2,_0x11fedb,_0x18f24d){return function(_0x2e841b){utils['checkContactLowerLimitOriginate'](_0x11fedb,_0x18f24d,0x0);logger[_0xa127('0x6b')](_0x3719d2,util[_0xa127('0x6c')](_0x2e841b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x355fc9){return function(_0x27d0ba){if(isNotNull(_0x27d0ba)&&isNotNull(_0x27d0ba[0x0])){if(_0x27d0ba[0x0][_0xa127('0x6d')]>0x0){_0x355fc9[_0xa127('0x6e')]=utils[_0xa127('0x6f')][_0xa127('0x70')];logger[_0xa127('0x4a')](_0xa127('0x71')+_0x355fc9['name'],_0x27d0ba[0x0][_0xa127('0x6d')],'contacts');}else{_0x355fc9[_0xa127('0x6e')]=utils[_0xa127('0x6f')][_0xa127('0x72')];logger[_0xa127('0x4a')](_0xa127('0x73')+_0x355fc9[_0xa127('0x48')]);}}};}function createObjHistory(_0x3002f4,_0x4808f4,_0x1d5dd9,_0x48b3d7,_0x2296bc){_0x3002f4[_0xa127('0x6e')]=_0x1d5dd9;var _0x361da8=new Action(_0x3002f4,_0x4808f4);var _0xbe6a61=new History(_0x361da8);_0xbe6a61[_0xa127('0x74')]=_0x48b3d7;_0xbe6a61[_0xa127('0x75')]=_0x2296bc;_0xbe6a61[_0xa127('0x76')]=_0x361da8[_0xa127('0x77')];return _0xbe6a61;}function unlockQueueStatus(_0x1505ad,_0x2a2f3d){setTimeout(function(){if(_['isUndefined'](_0x1505ad[_0xa127('0x78')])){loggerBooked[_0xa127('0x6b')](_0xa127('0x79'),_0x2a2f3d);}_0x1505ad[_0xa127('0x78')]=!![];loggerBooked[_0xa127('0x4a')](_0xa127('0x7a'),_0x2a2f3d,JSON[_0xa127('0x7b')](_['pick'](_0x1505ad,[_0xa127('0x48'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x89ed02){return function(){if(!isNotNull(_0x89ed02[_0xa127('0x7c')])){_0x89ed02['message']=utils[_0xa127('0x6f')]['NULL_INTERVAL'];throw _0x89ed02[_0xa127('0x48')]+_0xa127('0x7d');}if(!isNotNull(_0x89ed02[_0xa127('0x7c')][_0xa127('0x7e')])){_0x89ed02[_0xa127('0x6e')]=utils['CAMPAIGN_STATUS'][_0xa127('0x7f')];throw _0x89ed02[_0xa127('0x48')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xa127('0x49')](_0x89ed02[_0xa127('0x7c')][_0xa127('0x7e')]))){_0x89ed02[_0xa127('0x6e')]=utils[_0xa127('0x6f')]['NULL_INTERVAL'];throw _0x89ed02[_0xa127('0x48')]+_0xa127('0x7d');}};}function checkIsIVRCampaignActive(_0x1e2a53){return function(){if(!utils[_0xa127('0x80')](_0x1e2a53)){_0x1e2a53['message']=utils[_0xa127('0x6f')][_0xa127('0x81')];throw _0x1e2a53[_0xa127('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x454792){if(utils[_0xa127('0x82')](_0x454792)){emit(util[_0xa127('0x83')](_0xa127('0x84'),_0x454792['name']),'campaign:save',_0x454792);}}function loggerCatchQueueSummary(_0x54023c,_0x3f450d){return function(_0x1024b1){clearPredictiveAttributes(_0x3f450d);emitCampaignSummary(_0x3f450d);loggerSyncQueueSummary['debug'](_0x54023c,util['inspect'](_0x1024b1,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2c67d6){if(_0x2c67d6['sendMessageOneNotActive']){if(_0x2c67d6[_0xa127('0x85')]===0x0){_0x2c67d6[_0xa127('0x86')]=![];_0x2c67d6[_0xa127('0x6e')]=utils['CAMPAIGN_STATUS'][_0xa127('0x81')];loggerSyncQueueSummary[_0xa127('0x47')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2c67d6[_0xa127('0x48')],_0xa127('0x87'));}else{_0x2c67d6['message']=utils[_0xa127('0x6f')][_0xa127('0x88')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2c67d6[_0xa127('0x48')],'is\x20disactive');}emitCampaignSummary(_0x2c67d6);}}function myreject(_0x46992f){return function(_0x4e64be){return _0x46992f(msgResponse(_0xa127('0x89'),_0xa127('0x8a'),JSON[_0xa127('0x7b')](_0x4e64be)));};}Dialer[_0xa127('0x1d')][_0xa127('0x8b')]=function(_0x3fbaf5){return!_[_0xa127('0x43')](_0x3fbaf5)&&_0x3fbaf5&&!_[_0xa127('0x43')](_0x3fbaf5[_0xa127('0x48')])&&!_[_0xa127('0x43')](_0x3fbaf5['active'])&&_0x3fbaf5[_0xa127('0x8c')]&&(this['trunks'][util[_0xa127('0x83')](_0xa127('0x8d'),_0x3fbaf5[_0xa127('0x48')])][_0xa127('0x8e')]==='reachable'||this[_0xa127('0x26')][util['format'](_0xa127('0x8d'),_0x3fbaf5[_0xa127('0x48')])]['status']==='unmonitored');};Dialer[_0xa127('0x1d')]['checkIsTrunkReachable']=function(_0x2131d8){var _0x5c5bc1=this;return function(){if(!_0x5c5bc1[_0xa127('0x8b')](_0x2131d8[_0xa127('0x8f')])){if(!_0x5c5bc1['isTrunkReachable'](_0x2131d8[_0xa127('0x90')])){_0x2131d8[_0xa127('0x6e')]=utils[_0xa127('0x6f')][_0xa127('0x91')];throw _0x2131d8['name']+_0xa127('0x92');}}};};Dialer[_0xa127('0x1d')][_0xa127('0x93')]=function(_0x1cd1c1,_0x5b5c08,_0x22e8f9,_0x23733d){var _0x265b94=this;return function(){var _0x50ffd6=!![];return _0x265b94[_0xa127('0x94')](_0x1cd1c1,_0x5b5c08,_0x22e8f9,_0x23733d,_0x50ffd6);};};Dialer[_0xa127('0x1d')][_0xa127('0x95')]=function(_0x4512e0,_0x29708d,_0x34597c,_0x518324){var _0x3b7a0f=this;return function(){var _0x545481=![];return _0x3b7a0f[_0xa127('0x94')](_0x4512e0[_0xa127('0x7e')],_0x29708d,_0x34597c,_0x518324,_0x545481);};};Dialer[_0xa127('0x1d')][_0xa127('0x94')]=function(_0x253e25,_0xc70c6b,_0x49c309,_0x5810d4,_0x1773b1){var _0x56ca71=[];return new Promise(function(_0x226221,_0xf2ad79){if(!isNotNull(_0x253e25)){_0x5810d4[_0xa127('0x6e')]=utils[_0xa127('0x6f')][_0xa127('0x7f')];return _0xf2ad79(msgResponse(_0xa127('0x96'),_0xa127('0x97'),_0x49c309+'\x20Intervals\x20is\x20null\x20'));}if(_[_0xa127('0x49')](_0x253e25)){_0x5810d4['message']=utils[_0xa127('0x6f')][_0xa127('0x98')];return _0xf2ad79(msgResponse('ifTime',_0xa127('0x97'),_0x49c309+_0xa127('0x99')));}if(_0xc70c6b&&_[_0xa127('0x43')](config['timezones'][_0xc70c6b])){_0x5810d4[_0xa127('0x6e')]=utils[_0xa127('0x6f')][_0xa127('0x9a')];return _0xf2ad79(msgResponse(_0xa127('0x96'),_0xa127('0x97'),_0x49c309+_0xa127('0x9b')+_0xc70c6b));}if(_[_0xa127('0x9c')](_0x253e25)){for(var _0x2396f7=0x0;_0x2396f7<_0x253e25[_0xa127('0x9d')];_0x2396f7+=0x1){_0x56ca71[_0xa127('0x9e')](ami['Action']({'action':_0xa127('0x9f'),'command':util[_0xa127('0x83')](_0xa127('0xa0'),_0x253e25[_0x2396f7][_0xa127('0xa1')],!_[_0xa127('0x43')](config[_0xa127('0xa2')][_0xc70c6b])?_0xc70c6b:'')})[_0xa127('0x41')](function(_0x4626d1){return _0x4626d1['content'][_0xa127('0xa3')](_0xa127('0xa4'))>=0x0;})['catch'](myreject(_0xf2ad79)));}}else{_0x56ca71[_0xa127('0x9e')](ami[_0xa127('0xa5')]({'action':'command','command':util[_0xa127('0x83')]('iftime\x20%s,%s',_0x253e25,!_[_0xa127('0x43')](config[_0xa127('0xa2')][_0xc70c6b])?_0xc70c6b:'')})[_0xa127('0x41')](function(_0x3760b0){return _0x3760b0[_0xa127('0xa6')][_0xa127('0xa3')]('true')>=0x0;})[_0xa127('0xa7')](myreject(_0xf2ad79)));}Promise[_0xa127('0xa8')](_0x56ca71)[_0xa127('0x41')](function(_0x454e8e){var _0x48ea9c=_[_0xa127('0xa9')](_0x454e8e);if(_0x48ea9c){return _0x226221(_0x48ea9c);}else{_0x5810d4[_0xa127('0x6e')]=_0x1773b1?utils[_0xa127('0x6f')][_0xa127('0xaa')]:utils['CAMPAIGN_STATUS'][_0xa127('0xab')];return _0xf2ad79(msgResponse(_0xa127('0xac'),'Failure',_0xa127('0xad')+_0x1773b1+'\x20'+_0x49c309+_0xa127('0xae')+util['inspect'](_0x253e25,{'showHidden':![],'depth':null})+_0xa127('0xaf')+_0xc70c6b));}})[_0xa127('0xa7')](function(_0x481c3a){return _0xf2ad79(msgResponse(_0xa127('0x96'),_0xa127('0x97'),JSON[_0xa127('0x7b')](_0x481c3a)));});});};Dialer['prototype'][_0xa127('0x3e')]=function(){var _0x314421=this;return cmHopper[_0xa127('0xb0')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x314421[_0xa127('0xb1')]();},0x3e8);});};Dialer[_0xa127('0x1d')][_0xa127('0xb1')]=function(){var _0x1f626f=this;var _0x574238;for(var _0x2fb4db in this[_0xa127('0x24')]){if(typeof this[_0xa127('0x24')][_0x2fb4db]!==_0xa127('0xb2')){_0x574238=this[_0xa127('0x24')][_0x2fb4db];if(utils[_0xa127('0x82')](_0x574238)&&utils[_0xa127('0x80')](_0x574238)){_0x574238['sendMessageOneNotActive']=!![];Promise[_0xa127('0xb3')]()['then'](checkIsIVRCampaignActive(_0x574238))[_0xa127('0x41')](checkInterval(_0x574238))[_0xa127('0x41')](_0x1f626f[_0xa127('0xb4')](_0x574238))[_0xa127('0x41')](_0x1f626f[_0xa127('0x93')](_0x574238['dialGlobalInterval'],_0x574238[_0xa127('0xb5')],_0x574238['name'],_0x574238))[_0xa127('0x41')](_0x1f626f[_0xa127('0x95')](_0x574238[_0xa127('0x7c')],_0x574238[_0xa127('0xb5')],_0x574238[_0xa127('0x48')],_0x574238))['then'](_0x1f626f[_0xa127('0xb6')](_0x574238))[_0xa127('0xa7')](loggerCatchQueueSummary('[syncCampaigns]',_0x574238));}else{notSendMessagesCampaign(_0x574238);}}}};Dialer[_0xa127('0x1d')][_0xa127('0xb7')]=function(_0x421b32){if(_0x421b32['dialMethod']!==_0xa127('0xa')){clearPredictiveAttributes(_0x421b32);}switch(_0x421b32[_0xa127('0xb8')]){case _0xa127('0xb9'):this['handlePower'](_0x421b32,0x1);break;case'power':this['handlePower'](_0x421b32,_0x421b32['dialPowerLevel']);break;case'predictive':this['predictive'](_0x421b32);break;case _0xa127('0x9'):this[_0xa127('0xba')](_0x421b32,0x1);break;default:logger[_0xa127('0x6b')]('Queue',_0x421b32[_0xa127('0x48')],_0xa127('0xbb'));}};Dialer[_0xa127('0x1d')]['ifTime']=function(_0x4526c9,_0x20f740){var _0x323574=_0x4526c9[_0xa127('0xb5')];var _0x2698db=_0x20f740?_0x4526c9[_0xa127('0xbc')]:_0x4526c9[_0xa127('0x7c')][_0xa127('0x7e')];logger[_0xa127('0xbd')]('Dialer::ifTime()',_0x2698db,_0x323574,_0x4526c9[_0xa127('0x48')],util[_0xa127('0x83')](_0xa127('0xbe'),_0x4526c9[_0xa127('0x48')],_0x4526c9['id']));var _0x5187be=null;return Interval[_0xa127('0xbf')](_0x2698db,_0x323574)[_0xa127('0x41')](function(_0x36582f){if(_0x36582f===!![]){return _0x36582f;}else{_0x4526c9[_0xa127('0x6e')]=_0x20f740?utils[_0xa127('0x6f')][_0xa127('0xaa')]:utils[_0xa127('0x6f')][_0xa127('0xab')];_0x5187be=msgResponse(_0xa127('0xac'),_0xa127('0x97'),_0xa127('0xad')+_0x20f740+'\x20'+_0x4526c9[_0xa127('0x48')]+_0xa127('0xae')+util[_0xa127('0x6c')](_0x2698db,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x323574);}if(_0x5187be!==null){logger[_0xa127('0xbd')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x5187be);_0x5187be['isGlobal']=_0x20f740;throw _0x5187be;}})['catch'](function(_0x159740){logger['error'](_0xa127('0xc0'),_0x159740);throw msgResponse(_0xa127('0x89'),_0xa127('0x8a'),util['inspect'](_0x159740,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xa127('0x2f')]=function(_0x5bedb8){if(this[_0xa127('0x23')][_0x5bedb8[_0xa127('0xc1')]]){if(this['uniqueId'][_0x5bedb8[_0xa127('0xc2')]]&&this['uniqueId'][_0x5bedb8[_0xa127('0xc2')]][_0xa127('0x45')]!==_0xa127('0xc3')){this[_0xa127('0xc4')](this[_0xa127('0x23')][_0x5bedb8['queue']]);this[_0xa127('0x2b')][_0x5bedb8[_0xa127('0xc2')]][_0xa127('0xc5')]=moment()[_0xa127('0x83')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xa127('0x1d')][_0xa127('0x35')]=function(_0x484cbf){var _0x4e16e6=this[_0xa127('0x2b')][_0x484cbf[_0xa127('0xc2')]];if(this[_0xa127('0x23')][_0x484cbf[_0xa127('0xc1')]]){if(_0x4e16e6&&_0x4e16e6[_0xa127('0x45')]!==_0xa127('0xc3')){delete this[_0xa127('0x2b')][_0x484cbf[_0xa127('0xc2')]];this[_0xa127('0x23')][_0x484cbf[_0xa127('0xc1')]][_0xa127('0xc6')]+=0x1;var _0x25acdc=new AgentComplete(_0x4e16e6,_0x484cbf);if(_0x484cbf['reason']===_0xa127('0xc7')){_0x25acdc[_0xa127('0xc8')]=this['voiceQueues'][_0x484cbf[_0xa127('0xc1')]][_0xa127('0xc9')]&&this[_0xa127('0x23')][_0x484cbf[_0xa127('0xc1')]][_0xa127('0xca')]?moment()['format'](_0xa127('0xcb')):undefined;}hopperUtils['createHistory'](_0x25acdc)[_0xa127('0xa7')](loggerCatch(_0xa127('0xcc')));hopperUtils['moveContactManagedDialer'](_0x25acdc)[_0xa127('0xa7')](loggerCatch(_0xa127('0xcd')));}}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x134908){var _0x5e2be6=this[_0xa127('0x2b')][_0x134908[_0xa127('0xc2')]];var _0x5b4bf1=this;var _0x1582dc=![];var _0x1b840e;var _0x167c6f;if(this[_0xa127('0x23')][_0x134908[_0xa127('0xc1')]]){if(_0x5e2be6&&_0x5e2be6['type']!==_0xa127('0xc3')){delete this['uniqueId'][_0x134908[_0xa127('0xc2')]];this[_0xa127('0xc4')](this[_0xa127('0x23')][_0x134908['queue']]);_0x5e2be6[_0xa127('0xce')]=moment()[_0xa127('0x83')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3ed857=new QueueCallerAbandon(_0x5e2be6,_0x134908);if(utils[_0xa127('0x65')](_0x5e2be6[_0xa127('0xce')],_0x5e2be6['responsetime'])>=_0x5e2be6[_0xa127('0xcf')]){this[_0xa127('0x23')][_0x134908['queue']][_0xa127('0xd0')]+=0x1;this[_0xa127('0x23')][_0x134908['queue']][_0xa127('0xd1')]+=0x1;this[_0xa127('0x23')][_0x134908[_0xa127('0xc1')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3ed857[_0xa127('0x74')]=0xa;_0x3ed857[_0xa127('0x75')]=_0xa127('0xd2');_0x3ed857[_0xa127('0xd3')]='TIMEOUT';_0x3ed857['agiafterat']=this[_0xa127('0x23')][_0x134908[_0xa127('0xc1')]][_0xa127('0xc9')]?moment()[_0xa127('0x83')](_0xa127('0xcb')):undefined;_0x3ed857[_0xa127('0xd4')]+=0x1;_0x3ed857[_0xa127('0xd5')]+=0x1;_0x1b840e=this[_0xa127('0x23')][_0x134908['queue']]['dialDropRetryFrequency'];_0x167c6f=this[_0xa127('0x23')][_0x134908['queue']][_0xa127('0xd6')];hopperUtils[_0xa127('0xd7')](_0x3ed857,_0x3ed857[_0xa127('0x74')],_0x5e2be6['voiceQueue'])[_0xa127('0x41')](function(_0x54735a){_0x1582dc=_0x54735a['additional']==0x1;if(_0x3ed857[_0xa127('0xd4')]>=_0x5b4bf1[_0xa127('0x23')][_0x134908[_0xa127('0xc1')]][_0xa127('0xd8')]){_0x5b4bf1[_0xa127('0xd9')](_0x3ed857,_0x54735a['additional']);}else{hopperUtils[_0xa127('0xda')]({'active':![],'countdropretry':_0x3ed857[_0xa127('0xd4')],'scheduledat':moment()[_0xa127('0xdb')](_0x5b4bf1['voiceQueues'][_0x134908[_0xa127('0xc1')]]['dialDropRetryFrequency'],_0xa127('0xdc'))['format'](_0xa127('0xcb')),'ContactId':_0x5e2be6['ContactId'],'ListId':_0x5e2be6[_0xa127('0xdd')],'VoiceQueueId':_0x5e2be6[_0xa127('0xde')]||undefined,'CampaignId':_0x5e2be6[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0xe0')));var _0x864603=new History(_0x3ed857);_0x864603[_0xa127('0x74')]=0xa;_0x864603[_0xa127('0x75')]=_0xa127('0xd2');_0x864603[_0xa127('0x77')]=moment()[_0xa127('0x83')]('YYYY-MM-DD\x20HH:mm:ss');_0x864603[_0xa127('0x76')]=_0x864603[_0xa127('0x77')];_0x864603[_0xa127('0xe1')]=_0x3ed857['calleridname'];_0x864603[_0xa127('0xe2')]=_0x3ed857[_0xa127('0xe2')];hopperUtils['createHistory'](_0x864603)[_0xa127('0xa7')](loggerCatch(_0xa127('0xe3')));}})[_0xa127('0x41')](function(){if(_0x1582dc)hopperUtils['swapAdditionalPhones'](_0x3ed857,_0x1b840e,_0x167c6f)[_0xa127('0x41')](function(){return 0x1;});});}else{this['voiceQueues'][_0x134908[_0xa127('0xc1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xa127('0x23')][_0x134908[_0xa127('0xc1')]][_0xa127('0xe4')]+=0x1;_0x3ed857[_0xa127('0x74')]=0xb;_0x3ed857[_0xa127('0x75')]=_0xa127('0xe5');_0x3ed857[_0xa127('0xd3')]=_0xa127('0xe6');_0x3ed857['countabandonedretry']+=0x1;_0x3ed857['countglobal']+=0x1;_0x1b840e=this['voiceQueues'][_0x134908['queue']][_0xa127('0xe7')];_0x167c6f=this[_0xa127('0x23')][_0x134908[_0xa127('0xc1')]][_0xa127('0xd6')];hopperUtils['verifyAdditionalPhones'](_0x3ed857,_0x3ed857[_0xa127('0x74')],_0x5e2be6[_0xa127('0xe8')])['then'](function(_0x1ceb6e){if(_0x3ed857[_0xa127('0xe9')]>=_0x5b4bf1[_0xa127('0x23')][_0x134908[_0xa127('0xc1')]][_0xa127('0xea')]){_0x5b4bf1[_0xa127('0xd9')](_0x3ed857,_0x1ceb6e[_0xa127('0xeb')]);}else{hopperUtils[_0xa127('0xda')]({'active':![],'countabandonedretry':_0x3ed857['countabandonedretry'],'scheduledat':moment()[_0xa127('0xdb')](_0x5b4bf1['voiceQueues'][_0x134908['queue']][_0xa127('0xe7')],_0xa127('0xdc'))[_0xa127('0x83')](_0xa127('0xcb')),'ContactId':_0x5e2be6[_0xa127('0xec')],'ListId':_0x5e2be6['ListId'],'VoiceQueueId':_0x5e2be6[_0xa127('0xde')]||undefined,'CampaignId':_0x5e2be6[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0xed')));var _0x4e6a8e=new History(_0x3ed857);_0x4e6a8e[_0xa127('0x74')]=0xb;_0x4e6a8e[_0xa127('0x75')]=_0xa127('0xe5');_0x4e6a8e[_0xa127('0x77')]=moment()[_0xa127('0x83')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e6a8e[_0xa127('0x76')]=_0x4e6a8e[_0xa127('0x77')];_0x4e6a8e[_0xa127('0xe1')]=_0x3ed857['calleridname'];_0x4e6a8e['calleridnum']=_0x3ed857[_0xa127('0xe2')];hopperUtils['createHistory'](_0x4e6a8e)[_0xa127('0xa7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xa127('0x41')](function(){if(_0x1582dc)hopperUtils[_0xa127('0xee')](_0x3ed857,_0x1b840e,_0x167c6f)[_0xa127('0x41')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xa127('0xef')]=function(_0x312677){if(this[_0xa127('0x29')][_0x312677[_0xa127('0xc2')]]){this[_0xa127('0x29')][_0x312677['uniqueid']][_0xa127('0xf0')]=_0x312677[_0xa127('0xf0')];}if(this[_0xa127('0x2b')][_0x312677['uniqueid']]){this['uniqueId'][_0x312677[_0xa127('0xc2')]][_0xa127('0xf0')]=_0x312677[_0xa127('0xf0')];}};Dialer['prototype'][_0xa127('0xf1')]=function(_0xc3752c){if(!this[_0xa127('0x29')][_0xc3752c['actionid']]){return;}var _0x41310a=this[_0xa127('0x23')][this[_0xa127('0x29')][_0xc3752c[_0xa127('0xf2')]][_0xa127('0xc1')]]['strategy']||_0xa127('0xf3');if(_0x41310a==='roundrobin'){if(this[_0xa127('0x29')][_0xc3752c[_0xa127('0xf2')]]&&_[_0xa127('0xf4')](this[_0xa127('0x29')][_0xc3752c['actionid']]['locked'])&&_0xc3752c[_0xa127('0x8e')]==='1'&&_0xc3752c['paused']==='0'){if(this[_0xa127('0x25')][_0xc3752c[_0xa127('0xf5')]]){if(!this[_0xa127('0x25')][_0xc3752c[_0xa127('0xf5')]][_0xa127('0xf6')]){this[_0xa127('0x25')][_0xc3752c[_0xa127('0xf5')]]['locked']=!![];this[_0xa127('0x29')][_0xc3752c[_0xa127('0xf2')]][_0xa127('0xf6')]=!![];this[_0xa127('0x29')][_0xc3752c[_0xa127('0xf2')]][_0xa127('0xf5')]=_0xc3752c[_0xa127('0xf5')];}}}}else if(_0x41310a===_0xa127('0xf3')){if(this[_0xa127('0x29')][_0xc3752c['actionid']]){if(this[_0xa127('0x25')][_0xc3752c[_0xa127('0xf5')]]){this[_0xa127('0x29')][_0xc3752c[_0xa127('0xf2')]][_0xa127('0xf5')]=_0xc3752c['stateinterface'];if(_[_0xa127('0xf4')](this['queueBooked'][this[_0xa127('0x29')][_0xc3752c['actionid']][_0xa127('0xc1')]])){this[_0xa127('0xf7')][this[_0xa127('0x29')][_0xc3752c[_0xa127('0xf2')]][_0xa127('0xc1')]]=[];}this[_0xa127('0xf7')][this[_0xa127('0x29')][_0xc3752c[_0xa127('0xf2')]][_0xa127('0xc1')]]['push'](_[_0xa127('0x64')](_[_0xa127('0xf8')](this['actions'][_0xc3752c[_0xa127('0xf2')]],['idHopper','stateinterface']),{'status':_0xc3752c[_0xa127('0x8e')],'paused':_0xc3752c['paused']}));}}}};Dialer['prototype'][_0xa127('0xf9')]=function(_0x270886){if(!this['actions'][_0x270886[_0xa127('0xf2')]]){return;}var _0x4d9a2e=this;var _0x364623=this[_0xa127('0x23')][this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]]['queue']];var _0x384e4e=_0x364623['strategy']||_0xa127('0xf3');if(_0x384e4e===_0xa127('0xfa')){if(this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]]&&this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]][_0xa127('0xf5')]){this[_0xa127('0x22')][_0xa127('0xfb')](this[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xfc')],this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]][_0xa127('0xf5')])[_0xa127('0xa7')](function(_0x25dd65){logger[_0xa127('0x6b')](_0xa127('0xfd'),util[_0xa127('0x6c')](_0x25dd65,{'showHidden':![],'depth':null}));})[_0xa127('0x20')](function(){_0x4d9a2e[_0xa127('0xc4')](_0x4d9a2e['voiceQueues'][_0x4d9a2e[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]][_0xa127('0xc1')]]);_0x4d9a2e['agents'][_0x4d9a2e[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xf5')]]['locked']=![];delete _0x4d9a2e[_0xa127('0x29')][_0x270886['actionid']];unlockQueueStatus(_0x364623);});}else{this[_0xa127('0xc4')](this[_0xa127('0x23')][this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]][_0xa127('0xc1')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x270886[_0xa127('0xf2')]][_0xa127('0xec')],'ListId':this[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xdd')],'VoiceQueueId':this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0xfe')));delete this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]];unlockQueueStatus(_0x364623);}}else if(_0x384e4e===_0xa127('0xf3')){var _0x371086;if(this['actions'][_0x270886[_0xa127('0xf2')]]&&!_[_0xa127('0x49')](this[_0xa127('0xf7')][this['actions'][_0x270886[_0xa127('0xf2')]][_0xa127('0xc1')]])){if(this[_0xa127('0xff')][_0x4d9a2e[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]][_0xa127('0xc1')]]){this[_0xa127('0xff')][_0x4d9a2e['actions'][_0x270886[_0xa127('0xf2')]]['queue']]=this[_0xa127('0xff')][this[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xc1')]]?this['queueBookedRR'][this[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xc1')]]:this[_0xa127('0xf7')][this[_0xa127('0x29')][_0x270886[_0xa127('0xf2')]]['queue']]?this[_0xa127('0xf7')][this[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xc1')]]['_rr']||0x0:0x0;}this[_0xa127('0xf7')][this[_0xa127('0x29')][_0x270886['actionid']][_0xa127('0xc1')]]['_rr']=this[_0xa127('0xff')][this['actions'][_0x270886['actionid']][_0xa127('0xc1')]];for(var _0x39b7d3=0x0;_0x39b7d3=_0x26af58[_0xa127('0x126')]){_0x2db05c['stateGlobal'](_0x289d3e,_0x5990ea,_0x3081da,_0xa127('0x127'));}else{if(_0x289d3e[_0xa127('0x11f')]>=_0x26af58[_0xa127('0x128')]){_0x2db05c[_0xa127('0x129')](_0x289d3e,_0x5990ea,_0x3081da,'reason\x2019\x20machine....');}else{hopperUtils[_0xa127('0xda')]({'active':![],'countmachineretry':_0x289d3e['countmachineretry'],'scheduledat':moment()['add'](_0x26af58[_0xa127('0x12a')],'minutes')[_0xa127('0x83')](_0xa127('0xcb')),'ContactId':_0x289d3e[_0xa127('0xec')],'ListId':_0x289d3e['ListId'],'VoiceQueueId':_0x289d3e[_0xa127('0xde')]||undefined,'CampaignId':_0x289d3e[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0x12b')));_0x5990ea({'reschedule':0x1});}}});}if(_0x1ffe90[_0xa127('0x45')]===_0xa127('0xc3')&&this[_0xa127('0x24')][_0x1ffe90[_0xa127('0xc1')]][_0xa127('0x113')]&&_0x148c18['value']===_0xa127('0x115')){delete this[_0xa127('0x2b')][_0x148c18[_0xa127('0xc2')]];this[_0xa127('0xc4')](this[_0xa127('0x24')][_0x1ffe90['queue']]);_0x2874be=new Hangup(_0x1ffe90,_0x148c18);_0x2874be[_0xa127('0x74')]=0x12;_0x2874be[_0xa127('0x75')]=_0xa127('0x12c');_0x2874be['membername']=_0xa127('0x118');ami[_0xa127('0x44')]('custom:amd',ut[_0xa127('0x119')](_0x2874be,_0xa127('0x11a')));this[_0xa127('0x11b')](_0x2874be,_0xa127('0x12d'),'[syncHangupInAMDIvr]');}if(_0x1ffe90[_0xa127('0x45')]===_0xa127('0xc3')&&this[_0xa127('0x24')][_0x1ffe90[_0xa127('0xc1')]]['dialAMDActive']&&_0x148c18[_0xa127('0x114')]==='MACHINE'){return new Promise(function(_0xc10522,_0x506aab){delete _0x2db05c[_0xa127('0x2b')][_0x148c18[_0xa127('0xc2')]];_0x2db05c['updateOriginated'](_0x2db05c[_0xa127('0x24')][_0x1ffe90[_0xa127('0xc1')]]);_0x2db05c[_0xa127('0x24')][_0x1ffe90[_0xa127('0xc1')]][_0xa127('0xc6')]+=0x1;_0x2db05c[_0xa127('0x24')][_0x1ffe90[_0xa127('0xc1')]][_0xa127('0x116')]+=0x1;var _0x5de7f3=_0x2db05c[_0xa127('0x24')][_0x1ffe90[_0xa127('0xc1')]];var _0x1a3b27=new Hangup(_0x1ffe90,_0x148c18);_0x1a3b27[_0xa127('0x74')]=0x13;_0x1a3b27[_0xa127('0x75')]=_0xa127('0x11e');_0x1a3b27[_0xa127('0x117')]=_0xa127('0x118');_0x1a3b27[_0xa127('0x11f')]+=0x1;_0x1a3b27['countglobal']+=0x1;_0x1a3b27['amd']=!![];ami[_0xa127('0x44')](_0xa127('0x120'),ut['buildObj'](_0x1a3b27,_0xa127('0x11a')));hopperUtils[_0xa127('0x12e')](_0x1a3b27)['catch'](loggerCatch(_0xa127('0x121')));if(_0x1a3b27[_0xa127('0x122')]+_0x1a3b27[_0xa127('0x12f')]+_0x1a3b27[_0xa127('0x123')]+_0x1a3b27[_0xa127('0x124')]+_0x1a3b27[_0xa127('0xd4')]+_0x1a3b27[_0xa127('0xe9')]+_0x1a3b27[_0xa127('0x11f')]+_0x1a3b27[_0xa127('0x125')]>=_0x5de7f3[_0xa127('0x126')]){_0x2db05c[_0xa127('0x130')](_0x1a3b27,_0xc10522,_0x506aab,_0xa127('0x127'));}else{if(_0x1a3b27[_0xa127('0x11f')]>=_0x5de7f3['dialMachineMaxRetry']){_0x2db05c[_0xa127('0x129')](_0x1a3b27,_0xc10522,_0x506aab,_0xa127('0x131'));}else{hopperUtils[_0xa127('0xda')]({'active':![],'countmachineretry':_0x1a3b27['countmachineretry'],'scheduledat':moment()['add'](_0x5de7f3[_0xa127('0x12a')],_0xa127('0xdc'))[_0xa127('0x83')](_0xa127('0xcb')),'ContactId':_0x1a3b27[_0xa127('0xec')],'ListId':_0x1a3b27[_0xa127('0xdd')],'VoiceQueueId':_0x1a3b27[_0xa127('0xde')]||undefined,'CampaignId':_0x1a3b27[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0x12b')));_0xc10522({'reschedule':0x1});}}});}}};Dialer[_0xa127('0x1d')][_0xa127('0x38')]=function(_0x5efd03){var _0x306d7e=this[_0xa127('0x2b')][_0x5efd03[_0xa127('0xc2')]];var _0x2267ae;if(_0x306d7e&&_0x306d7e[_0xa127('0x45')]===_0xa127('0xc3')){delete this['uniqueId'][_0x5efd03[_0xa127('0xc2')]];this['updateOriginated'](this['campaigns'][_0x306d7e[_0xa127('0xc1')]]);this['campaigns'][_0x306d7e[_0xa127('0xc1')]][_0xa127('0x132')]+=0x1;_0x2267ae=new Hangup(_0x306d7e,_0x5efd03);hopperUtils[_0xa127('0x12e')](_0x2267ae)[_0xa127('0xa7')](loggerCatch(_0xa127('0x133')));hopperUtils['moveContactManagedDialer'](_0x2267ae)[_0xa127('0xa7')](loggerCatch(_0xa127('0x134')));}if(_0x306d7e&&_0x306d7e[_0xa127('0x45')]!==_0xa127('0xc3')&&isNotNull(this['voiceQueues'][_0x306d7e['queue']][_0xa127('0x135')])){delete this[_0xa127('0x2b')][_0x5efd03[_0xa127('0xc2')]];this[_0xa127('0xc4')](this[_0xa127('0x23')][_0x306d7e[_0xa127('0xc1')]]);this[_0xa127('0x23')][_0x306d7e['queue']][_0xa127('0xc6')]+=0x1;this[_0xa127('0x23')][_0x306d7e[_0xa127('0xc1')]][_0xa127('0x116')]+=0x1;_0x2267ae=new Hangup(_0x306d7e,_0x5efd03);_0x2267ae['state']=0x10;_0x2267ae[_0xa127('0x75')]='AnswerAGI';_0x2267ae[_0xa127('0x117')]=_0xa127('0x136');hopperUtils[_0xa127('0x12e')](_0x2267ae)[_0xa127('0xa7')](loggerCatch(_0xa127('0x133')));hopperUtils[_0xa127('0x137')](_0x2267ae)[_0xa127('0xa7')](loggerCatch(_0xa127('0x134')));}if(_0x306d7e&&_0x306d7e[_0xa127('0x45')]!==_0xa127('0xc3')&&!isNotNull(this[_0xa127('0x23')][_0x306d7e[_0xa127('0xc1')]][_0xa127('0x135')])){delete this[_0xa127('0x2b')][_0x5efd03['uniqueid']];this['updateOriginated'](this[_0xa127('0x23')][_0x306d7e[_0xa127('0xc1')]]);this[_0xa127('0x23')][_0x306d7e[_0xa127('0xc1')]][_0xa127('0x138')]+=0x1;_0x2267ae=new Hangup(_0x306d7e,_0x5efd03);_0x2267ae['state']=0xc;_0x2267ae[_0xa127('0x75')]=_0x5efd03[_0xa127('0x139')];_0x2267ae[_0xa127('0x117')]=_0xa127('0x13a');hopperUtils[_0xa127('0x12e')](_0x2267ae)[_0xa127('0xa7')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xa127('0x137')](_0x2267ae)[_0xa127('0xa7')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xa127('0x1d')]['syncQueueSummary']=function(_0xaee0d4){var _0x23f043=this;if(!_0x23f043['queuesSummary'][_0xaee0d4[_0xa127('0x48')]]){_0x23f043[_0xa127('0x13b')][_0xaee0d4['name']]={'running':![]};}else if(_0x23f043[_0xa127('0x13b')][_0xaee0d4['name']][_0xa127('0x13c')]===!![]){return;}else if(_0x23f043[_0xa127('0x13b')][_0xaee0d4['name']][_0xa127('0x13c')]===![]){_0x23f043[_0xa127('0x13b')][_0xaee0d4['name']][_0xa127('0x13c')]=!![];}var _0x373128=_0x23f043[_0xa127('0x23')][_0xaee0d4[_0xa127('0x48')]];var _0x5593e2=_0x373128[_0xa127('0x6e')]!==utils[_0xa127('0x6f')]['INACTIVE'];var _0x59407b=utils[_0xa127('0x13d')](_0x373128);_0x373128[_0xa127('0x13e')]=utils['getQueueCampaignStatusMessage'](_0x373128,_0x23f043[_0xa127('0x26')]);Promise[_0xa127('0xb3')]()[_0xa127('0x41')](function(){if(_0x373128[_0xa127('0x13e')]===utils['CAMPAIGN_STATUS'][_0xa127('0x81')]){if(_0x5593e2){clearPredictiveAttributes(_0x373128);_0xaee0d4[_0xa127('0x2d')]=undefined;_0xaee0d4[_0xa127('0x66')]=undefined;}if(_0x373128['statusMessage']===utils['CAMPAIGN_STATUS'][_0xa127('0x81')]){_0xaee0d4[_0xa127('0x13f')]=0x0;_0xaee0d4[_0xa127('0x101')]=0x0;_0xaee0d4[_0xa127('0x140')]=0x0;_0xaee0d4[_0xa127('0x141')]=0x0;_0xaee0d4[_0xa127('0x142')]=0x0;}}else if(_0x373128['statusMessage']===utils[_0xa127('0x6f')][_0xa127('0x143')]&&!_0x59407b){return _0x23f043['ifTime'](_0x373128,!![])[_0xa127('0x41')](function(){return _0x23f043[_0xa127('0x96')](_0x373128,![]);})['then'](function(){return _0x23f043[_0xa127('0xb7')](_0x373128);})[_0xa127('0xa7')](function(_0x3e28b1){loggerSyncQueueSummary[_0xa127('0x47')](_0xa127('0x144'),util[_0xa127('0x6c')](_0x3e28b1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x373128);});}else{clearPredictiveAttributes(_0x373128);}})[_0xa127('0x41')](function(){var _0x4c1916=_0xaee0d4[_0xa127('0x145')](_0x373128);if(_0x4c1916||_0x373128[_0xa127('0x146')]){_0x373128[_0xa127('0x146')]=![];_0xaee0d4[_0xa127('0x147')](_0x373128);Object[_0xa127('0x148')](_0x373128,_0xaee0d4);emitOutboundVoiceQueueSummary(_0xaee0d4);}_0x23f043[_0xa127('0x13b')][_0x373128['name']][_0xa127('0x13c')]=![];})[_0xa127('0xa7')](function(_0x52ea0c){logger[_0xa127('0x6b')](_0xa127('0x144'),util[_0xa127('0x6c')](_0x52ea0c,{'showHidden':![],'depth':null}));_0x23f043[_0xa127('0x13b')][_0x373128[_0xa127('0x48')]][_0xa127('0x13c')]=![];});};Dialer[_0xa127('0x1d')]['syncQueueSummaryComplete']=_[_0xa127('0x149')](function(){var _0x5d8c09=_[_0xa127('0x14a')](this[_0xa127('0x23')],function(_0x2a3eff){return _0x2a3eff[_0xa127('0x14b')];});var _0xe10281=_[_0xa127('0x14a')](this[_0xa127('0x25')],function(_0x2d4e24){return _0x2d4e24[_0xa127('0x14c')]&&_0x2d4e24[_0xa127('0x8e')]===_0xa127('0x14d');});if(_0x5d8c09[_0xa127('0x9d')]>0x0&&_0xe10281[_0xa127('0x9d')]>0x0){return Promise[_0xa127('0xb3')]()[_0xa127('0x41')](cmHopper[_0xa127('0x14e')](_[_0xa127('0x14f')](_0x5d8c09,'id'),previewRecallmeReminderInterval,_[_0xa127('0x14f')](_0xe10281,'id')))[_0xa127('0x41')](function(_0x1fdb25){for(var _0x2a4953=0x0;_0x2a4953<_0x1fdb25[_0xa127('0x9d')];_0x2a4953++){var _0x390302=_0x1fdb25[_0x2a4953][_0xa127('0x150')][_0xa127('0x48')];if(_0x390302)io['to'](util[_0xa127('0x83')](_0xa127('0x151'),_0x390302))[_0xa127('0x44')]('user:dialPreviewRecallReminder',{'hopper':_0x1fdb25[_0x2a4953]});}})[_0xa127('0xa7')](function(_0x16f4de){logger[_0xa127('0x6b')](_0xa127('0x152'),_0x16f4de);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xa127('0x1d')]['loopClearZombieChannels']=function(){var _0x4b3454=this;setInterval(function(){_0x4b3454[_0xa127('0x153')](_0x4b3454['uniqueId'],_0xa127('0x154'));_0x4b3454[_0xa127('0x153')](_0x4b3454[_0xa127('0x29')],_0xa127('0x155'));},0x32c8);};Dialer[_0xa127('0x1d')][_0xa127('0x153')]=function(_0x32d60d,_0x4d9a00){var _0x558be6=this;for(var _0x185a73 in _0x32d60d){if(typeof _0x32d60d[_0x185a73]!==_0xa127('0xb2')){this[_0xa127('0x21')][_0xa127('0x1e')](function(){if(!_[_0xa127('0xf4')](_0x32d60d[_0x185a73])){return ami['Action']({'action':_0xa127('0x8e'),'channel':_0x32d60d[_0x185a73][_0xa127('0xf0')]})[_0xa127('0xa7')](function(_0x312060){if(_0x312060[_0xa127('0x6e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x32d60d[_0x185a73]&&_0x32d60d[_0x185a73]['type']!==_0xa127('0xc3')){_0x558be6[_0xa127('0xc4')](_0x558be6[_0xa127('0x23')][_0x32d60d[_0x185a73][_0xa127('0xc1')]]);logger[_0xa127('0x6b')]('[Dialer][checkChannel]',_0x4d9a00,_0x185a73,_0x32d60d[_0x185a73]['queue']);delete _0x32d60d[_0x185a73];}if(_0x32d60d[_0x185a73]&&_0x32d60d[_0x185a73][_0xa127('0x45')]===_0xa127('0xc3')){_0x558be6[_0xa127('0xc4')](_0x558be6[_0xa127('0x24')][_0x32d60d[_0x185a73]['queue']]);logger[_0xa127('0x6b')](_0xa127('0x156'),_0x4d9a00,_0x185a73,_0x32d60d[_0x185a73][_0xa127('0xc1')]);delete _0x32d60d[_0x185a73];}},0x2328);}});}});}}};Dialer['prototype'][_0xa127('0x157')]=function(_0x384e6f){return Promise[_0xa127('0xb3')]()[_0xa127('0x41')](voiceQueueRt[_0xa127('0x157')](_0x384e6f))[_0xa127('0xa7')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xa127('0xc4')]=function(_0x21f4d8){if(!_['isUndefined'](_0x21f4d8)&&_0x21f4d8!==null){if(typeof _0x21f4d8['originated']!==_0xa127('0xb2')){if(_0x21f4d8[_0xa127('0x85')]>0x0){_0x21f4d8['originated']-=0x1;}else{logger[_0xa127('0x6b')](_0xa127('0x158'));}}}else{logger['error'](_0xa127('0x159'));}};Dialer[_0xa127('0x1d')][_0xa127('0x15a')]=function(_0x257a30,_0x3f94ff){var _0x1f78f6=this;return function(_0xa8fdd){_0x1f78f6['updateOriginated'](_0x3f94ff);logger[_0xa127('0x6b')](_0x257a30,util[_0xa127('0x6c')](_0xa8fdd,{'showHidden':![],'depth':null}));};};Dialer[_0xa127('0x1d')][_0xa127('0x15b')]=function(_0x3c0bb1,_0x5aba87,_0x5abfb2){var _0x54a95b={'state':0x19,'statedesc':'notFound'};this[_0xa127('0xc4')](_0x5aba87);this[_0xa127('0x11b')](_[_0xa127('0x64')](_0x54a95b,_[_0xa127('0xf8')](_0x5abfb2,[_0xa127('0xec'),_0xa127('0xdd'),_0xa127('0x15c'),_0xa127('0xde'),_0xa127('0xdf')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xa127('0x6b')](_0x3c0bb1);};Dialer[_0xa127('0x1d')][_0xa127('0x11b')]=function(_0xc8106b,_0x5084a7,_0x4d417c){hopperUtils['createHistory'](_0xc8106b)['catch'](loggerCatch(_0x5084a7));hopperUtils[_0xa127('0x137')](_0xc8106b)[_0xa127('0xa7')](loggerCatch(_0x4d417c));};Dialer[_0xa127('0x1d')]['queueCallerAbandonCreateState']=function(_0x21bd56,_0x3beac3){hopperUtils['createHistory'](_0x21bd56)[_0xa127('0xa7')](loggerCatch(_0xa127('0xcc')));if(_0x3beac3==0x0){hopperUtils['moveContactManagedDialer'](_0x21bd56)[_0xa127('0xa7')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0xa127('0x152')]=function(_0x5a4b9f){return Promise[_0xa127('0xb3')]()['then'](cmHopper[_0xa127('0x14e')](_0x5a4b9f['id'],previewRecallmeReminderInterval))[_0xa127('0x41')](function(_0x2bb9bf){for(var _0x100667=0x0;_0x100667<_0x2bb9bf['length'];_0x100667++){var _0x3b2f50=_0x2bb9bf[_0x100667][_0xa127('0x150')]['name'];if(_0x3b2f50)io['to'](util[_0xa127('0x83')](_0xa127('0x151'),_0x3b2f50))[_0xa127('0x44')](_0xa127('0x15d'),{'hopper':_0x2bb9bf[_0x100667]});}})[_0xa127('0xa7')](function(){});};Dialer['prototype'][_0xa127('0xb6')]=function(_0x1777f0){var _0x83e1dd=this;return function(){_0x83e1dd['handleIvr'](_0x1777f0);};};Dialer['prototype'][_0xa127('0x15e')]=function(_0x2ba30c,_0x3a0a02){var _0x1fdaa8=this;var _0x4d383a=uuid['v4']();this[_0xa127('0x29')][_0x4d383a]=new Action(_0x2ba30c,_0x3a0a02,_0x4d383a);return new Promise(function(_0x2ac2f9,_0x306aad){if(_[_0xa127('0x43')](_0x2ba30c)&&typeof _0x2ba30c!==_0xa127('0x15f')){return _0x306aad(msgResponse('originate',_0xa127('0x97'),_0xa127('0x160')));}if(_[_0xa127('0x43')](_0x3a0a02[_0xa127('0x161')])||_0x3a0a02['phone']===null){return _0x306aad(msgResponse('originate',_0xa127('0x97'),_0xa127('0x162')));}var _0x467dd7={'XMD-CALLERID':_0x1fdaa8[_0xa127('0x29')][_0x4d383a]['getCaller'](),'XMD-AGI':_0x2ba30c[_0xa127('0x135')]?util[_0xa127('0x83')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2ba30c['dialQueueProject']):_0xa127('0x163'),'XMD-AGIAFTER':_0x2ba30c[_0xa127('0xc9')]?util[_0xa127('0x83')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2ba30c['dialQueueProject2']):_0xa127('0x163'),'XMD-QUEUE':utils[_0xa127('0x164')](_0x2ba30c)?util['format'](_0xa127('0x165'),_0x2ba30c[_0xa127('0x48')],_0x2ba30c['dialQueueOptions']||'',_0x2ba30c[_0xa127('0xca')]?'c':'',_0x2ba30c[_0xa127('0xcf')]||0x3):_0xa127('0x163'),'XMD-CONTACTID':_0x3a0a02[_0xa127('0xec')],'XMD-CDRTYPE':_0xa127('0x8'),'CALLERID(all)':_0x1fdaa8[_0xa127('0x29')][_0x4d383a][_0xa127('0x166')](),'XMD-AMD':_0x2ba30c[_0xa127('0x113')]?_0xa127('0x143'):'NONE','XMD-DESTINATION':_0xa127('0x112')};if(_0x2ba30c[_0xa127('0x113')]){_0x467dd7[_0xa127('0x167')]=_0x2ba30c[_0xa127('0x168')]||0x9c4;_0x467dd7[_0xa127('0x169')]=_0x2ba30c[_0xa127('0x16a')]||0x5dc;_0x467dd7['XMD-AMDAFTERGREETINGSILENCE']=_0x2ba30c['dialAMDAfterGreetingSilence']||0x320;_0x467dd7[_0xa127('0x16b')]=_0x2ba30c['dialAMDTotalAnalysisTime']||0x1388;_0x467dd7['XMD-AMDMINWORDLENGTH']=_0x2ba30c['dialAMDMinWordLength']||0x64;_0x467dd7[_0xa127('0x16c')]=_0x2ba30c[_0xa127('0x16d')]||0x32;_0x467dd7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2ba30c[_0xa127('0x16e')]||0x3;_0x467dd7[_0xa127('0x16f')]=_0x2ba30c['dialAMDSilenceThreshold']||0x100;_0x467dd7[_0xa127('0x170')]=_0x2ba30c[_0xa127('0x171')]||0x1388;}if(utils[_0xa127('0x164')](_0x2ba30c)){_0x467dd7[_0xa127('0x172')]=_0x3a0a02['VoiceQueueId'];}else{_0x467dd7[_0xa127('0x173')]=_0x3a0a02[_0xa127('0xdf')];}var _0x5c4243=utils[_0xa127('0x174')](_0x3a0a02['Contact']);Object['assign'](_0x467dd7,_0x5c4243);var _0x1acc55=_0x1fdaa8[_0xa127('0x8b')](_0x2ba30c[_0xa127('0x8f')])?utils[_0xa127('0x175')](_0x2ba30c[_0xa127('0x8f')]['callerid'],_0x2ba30c[_0xa127('0x176')],_0x2ba30c['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x2ba30c[_0xa127('0x177')],_0x2ba30c['dialRandomLastDigitCallerIdNumber']):_0x2ba30c['dialOriginateCallerIdNumber']):utils[_0xa127('0x175')](_['isNil'](_0x2ba30c[_0xa127('0x90')])?_0x2ba30c[_0xa127('0x8f')][_0xa127('0x178')]:_0x2ba30c[_0xa127('0x90')]['callerid'],_0x2ba30c[_0xa127('0x176')],_0x2ba30c[_0xa127('0x179')]>0x0?utils[_0xa127('0x17a')](_0x2ba30c['dialOriginateCallerIdNumber'],_0x2ba30c[_0xa127('0x179')]):_0x2ba30c['dialOriginateCallerIdNumber']);if(_0x1acc55){_0x467dd7[_0xa127('0x17b')]=_0x1fdaa8[_0xa127('0x29')][_0x4d383a]['originatecalleridname']=utils[_0xa127('0x17c')](_0x1acc55);_0x467dd7[_0xa127('0x17d')]=_0x3a0a02['phone'];}_0x2ba30c['variables']=_0x467dd7;return ami[_0xa127('0xa5')]({'actionid':_0x4d383a,'action':'originate','channel':_0x1fdaa8[_0xa127('0x8b')](_0x2ba30c[_0xa127('0x8f')])?util[_0xa127('0x83')](_0xa127('0x17e'),_0x2ba30c['Trunk']['name'],isNotNull(_0x2ba30c[_0xa127('0x17f')])?_0x2ba30c['dialPrefix'][_0xa127('0x180')]()||'':'',_0x2ba30c[_0xa127('0x181')]>0x0?_0x3a0a02[_0xa127('0x161')][_0xa127('0x182')](_0x2ba30c[_0xa127('0x181')]):_0x3a0a02['phone']):util[_0xa127('0x83')]('SIP/%s/%s%s',_[_0xa127('0xf4')](_0x2ba30c['TrunkBackup'])?_0x2ba30c[_0xa127('0x8f')][_0xa127('0x48')]:_0x2ba30c[_0xa127('0x90')][_0xa127('0x48')],isNotNull(_0x2ba30c[_0xa127('0x17f')])?_0x2ba30c['dialPrefix'][_0xa127('0x180')]()||'':'',_0x2ba30c[_0xa127('0x181')]>0x0?_0x3a0a02[_0xa127('0x161')][_0xa127('0x182')](_0x2ba30c[_0xa127('0x181')]):_0x3a0a02[_0xa127('0x161')]),'callerid':_0x1acc55,'Exten':_0xa127('0x112'),'Context':'from-sip','Priority':'1','variable':_0x467dd7,'timeout':(_0x2ba30c[_0xa127('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4d383a})[_0xa127('0x41')](function(_0x7b7226){return _0x2ac2f9(_0x7b7226);})[_0xa127('0xa7')](function(_0x22ccdd){_0x2ba30c['outboundOriginateFailureCallsDay']+=0x1;var _0x465ddd=new History(_0x1fdaa8[_0xa127('0x29')][_0x4d383a]);logger['error'](util[_0xa127('0x83')](_0xa127('0x184'),JSON['stringify'](_0x22ccdd)));_0x465ddd[_0xa127('0x74')]=0xe;_0x465ddd[_0xa127('0x75')]=_0xa127('0x185');_0x465ddd[_0xa127('0x77')]=moment()['format'](_0xa127('0xcb'));_0x465ddd['endtime']=_0x465ddd[_0xa127('0x77')];hopperUtils[_0xa127('0x12e')](_0x465ddd)[_0xa127('0xa7')](loggerCatch(_0xa127('0x186')));_0x1fdaa8[_0xa127('0x137')](_0x465ddd)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x1fdaa8[_0xa127('0x29')][_0x4d383a];return _0x306aad(msgResponse(_0xa127('0x187'),'Error',_0xa127('0x188')));});});});};Dialer[_0xa127('0x1d')][_0xa127('0x189')]=function(_0x42411,_0x5918c1,_0x533718){var _0x35851f=new History(_0x5918c1);if(_0x35851f[_0xa127('0x122')]+_0x35851f['countcongestionretry']+_0x35851f[_0xa127('0x123')]+_0x35851f[_0xa127('0x124')]+_0x35851f['countdropretry']+_0x35851f['countabandonedretry']+_0x35851f[_0xa127('0x11f')]+_0x35851f[_0xa127('0x125')]>=_0x533718[_0xa127('0x126')]-0x1){return!![];}switch(_0x42411){case 0x3:if(_0x35851f[_0xa127('0x123')]>=_0x533718['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x35851f[_0xa127('0x123')]+=0x1,'scheduledat':moment()[_0xa127('0xdb')](_0x533718[_0xa127('0x18a')],_0xa127('0xdc'))['format'](_0xa127('0xcb')),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f['ListId'],'VoiceQueueId':_0x35851f[_0xa127('0xde')]||undefined,'CampaignId':_0x35851f[_0xa127('0xdf')]||undefined})['catch'](loggerCatch(_0xa127('0x18b')));break;case 0x5:if(_0x35851f[_0xa127('0x122')]>=_0x533718[_0xa127('0x18c')]-0x1){return!![];}hopperUtils[_0xa127('0xda')]({'active':![],'countbusyretry':_0x35851f[_0xa127('0x122')]+=0x1,'scheduledat':moment()['add'](_0x533718['dialBusyRetryFrequency'],_0xa127('0xdc'))[_0xa127('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f['ListId'],'VoiceQueueId':_0x35851f[_0xa127('0xde')]||undefined,'CampaignId':_0x35851f[_0xa127('0xdf')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x35851f[_0xa127('0x12f')]>=_0x533718[_0xa127('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x35851f[_0xa127('0x12f')]+=0x1,'scheduledat':moment()[_0xa127('0xdb')](_0x533718[_0xa127('0x18e')],'minutes')[_0xa127('0x83')](_0xa127('0xcb')),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f[_0xa127('0xdd')],'VoiceQueueId':_0x35851f[_0xa127('0xde')]||undefined,'CampaignId':_0x35851f[_0xa127('0xdf')]||undefined})['catch'](loggerCatch(_0xa127('0x18f')));break;case 0x0:if(_0x35851f[_0xa127('0x124')]>=_0x533718[_0xa127('0x190')]-0x1){return!![];}else{hopperUtils[_0xa127('0xda')]({'active':![],'countnosuchnumberretry':_0x35851f[_0xa127('0x124')]+=0x1,'scheduledat':moment()[_0xa127('0xdb')](_0x533718[_0xa127('0x191')],_0xa127('0xdc'))[_0xa127('0x83')](_0xa127('0xcb')),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f[_0xa127('0xdd')],'VoiceQueueId':_0x35851f[_0xa127('0xde')]||undefined,'CampaignId':_0x35851f[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0x192')));}break;case 0xa:if(_0x35851f[_0xa127('0xd4')]>=_0x533718['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xa127('0xda')]({'active':![],'countdropretry':_0x35851f[_0xa127('0xd4')]+=0x1,'scheduledat':moment()['add'](_0x533718[_0xa127('0x193')],'minutes')[_0xa127('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f['ListId'],'VoiceQueueId':_0x35851f[_0xa127('0xde')]||undefined,'CampaignId':_0x35851f[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0xe0')));break;case 0xb:if(_0x35851f[_0xa127('0xe9')]>=_0x533718['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xa127('0xda')]({'active':![],'countabandonedretry':_0x35851f[_0xa127('0xe9')]+=0x1,'scheduledat':moment()[_0xa127('0xdb')](_0x533718[_0xa127('0xe7')],_0xa127('0xdc'))[_0xa127('0x83')](_0xa127('0xcb')),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f[_0xa127('0xdd')],'VoiceQueueId':_0x35851f[_0xa127('0xde')]||undefined,'CampaignId':_0x35851f['CampaignId']||undefined})[_0xa127('0xa7')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x35851f['countmachineretry']>=_0x533718[_0xa127('0x128')]-0x1){return!![];}hopperUtils[_0xa127('0xda')]({'active':![],'countmachineretry':_0x35851f[_0xa127('0x11f')]+=0x1,'scheduledat':moment()[_0xa127('0xdb')](_0x533718[_0xa127('0x12a')],'minutes')[_0xa127('0x83')](_0xa127('0xcb')),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f[_0xa127('0xdd')],'VoiceQueueId':_0x35851f['VoiceQueueId']||undefined,'CampaignId':_0x35851f['CampaignId']||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0x12b')));break;case 0x14:if(_0x35851f[_0xa127('0x125')]>=_0x533718[_0xa127('0x194')]-0x1){return!![];}hopperUtils[_0xa127('0xda')]({'active':![],'countagentrejectretry':_0x35851f['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xa127('0xdb')](_0x533718['dialAgentRejectRetryFrequency'],'minutes')['format'](_0xa127('0xcb')),'ContactId':_0x35851f[_0xa127('0xec')],'ListId':_0x35851f[_0xa127('0xdd')],'VoiceQueueId':_0x35851f[_0xa127('0xde')]||undefined,'CampaignId':_0x35851f[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0x195')));break;default:return!![];}};Dialer[_0xa127('0x1d')][_0xa127('0x196')]=function(_0x5ce8b1,_0x559950,_0x1084b1){var _0x336e87=this;var _0x277d05=new History(_0x5ce8b1);var _0x519cc4=![];var _0x3158e1;var _0x49383b;return new Promise(function(_0x1eb7be,_0x1013d6){if(_['isUndefined'](_0x559950)&&typeof _0x559950!==_0xa127('0x15f')){return _0x1013d6(msgResponse('[callProgressDetecting]',_0xa127('0x97'),_0xa127('0x197')));}if(_[_0xa127('0x43')](_0x1084b1)&&typeof _0x1084b1!=='object'){return _0x1013d6(msgResponse(_0xa127('0x198'),_0xa127('0x97'),'evt\x20is\x20undefine'));}hopperUtils[_0xa127('0xd7')](_0x277d05,_0x1084b1[_0xa127('0x199')],_0x559950)[_0xa127('0x41')](function(_0x224d92){if(_0x224d92[_0xa127('0xeb')]==0x1)_0x519cc4=!![];switch(_0x1084b1[_0xa127('0x199')]){case'0':_0x559950['outboundNoSuchCallsDay']+=0x1;_0x277d05[_0xa127('0x74')]=0x0;_0x277d05['statedesc']='NoSuchNumber';_0x277d05[_0xa127('0x124')]+=0x1;_0x277d05['countglobal']+=0x1;ami[_0xa127('0x44')]('custom:agentnosuchnumber',ut[_0xa127('0x119')](_0x5ce8b1,_0xa127('0x19a')));_0x3158e1=_0x559950[_0xa127('0x191')];_0x49383b=_0x559950[_0xa127('0xd6')];hopperUtils[_0xa127('0x12e')](_0x277d05)[_0xa127('0xa7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x336e87[_0xa127('0x189')](0x0,_0x5ce8b1,_0x559950)&&!_0x519cc4){if(_0x277d05[_0xa127('0x124')]>=_0x559950['dialNoSuchNumberMaxRetry']){_0x336e87['createStateFinal'](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x19b'));}else{_0x336e87['stateGlobal'](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x19b'));}}break;case'3':_0x559950[_0xa127('0x19c')]+=0x1;_0x277d05['state']=0x3;_0x277d05['statedesc']='NoAnswer';_0x277d05[_0xa127('0x123')]+=0x1;_0x277d05[_0xa127('0xd5')]+=0x1;var _0x4ecdbb=ut[_0xa127('0x19d')](_0x5ce8b1,_0x559950);ami[_0xa127('0x44')]('custom:agentnoanswer',_0x4ecdbb);_0x3158e1=_0x559950[_0xa127('0x18a')];_0x49383b=_0x559950[_0xa127('0xd6')];hopperUtils[_0xa127('0x12e')](_0x277d05)[_0xa127('0xa7')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x336e87[_0xa127('0x189')](0x3,_0x5ce8b1,_0x559950)&&!_0x519cc4){if(_0x277d05[_0xa127('0x123')]>=_0x559950[_0xa127('0x19e')]){_0x336e87[_0xa127('0x129')](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x19f'));}else{_0x336e87['stateGlobal'](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x19f'));}}break;case'5':_0x559950[_0xa127('0x1a0')]+=0x1;_0x277d05[_0xa127('0x74')]=0x5;_0x277d05[_0xa127('0x75')]=_0xa127('0x1a1');_0x277d05[_0xa127('0x122')]+=0x1;_0x277d05[_0xa127('0xd5')]+=0x1;ami[_0xa127('0x44')]('custom:agentbusy',ut[_0xa127('0x119')](_0x5ce8b1,_0xa127('0x1a2')));_0x3158e1=_0x559950[_0xa127('0x1a3')];_0x49383b=_0x559950[_0xa127('0xd6')];hopperUtils[_0xa127('0x12e')](_0x277d05)[_0xa127('0xa7')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x336e87[_0xa127('0x189')](0x5,_0x5ce8b1,_0x559950)&&!_0x519cc4){if(_0x277d05[_0xa127('0x122')]>=_0x559950[_0xa127('0x18c')]){_0x336e87[_0xa127('0x129')](_0x277d05,_0x1eb7be,_0x1013d6,'reason\x205\x20busy');}else{_0x336e87['stateGlobal'](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x1a4'));}}break;case'8':_0x559950[_0xa127('0x1a5')]+=0x1;_0x277d05[_0xa127('0x74')]=0x8;_0x277d05['statedesc']=_0xa127('0x1a6');_0x277d05[_0xa127('0x12f')]+=0x1;_0x277d05[_0xa127('0xd5')]+=0x1;_0x3158e1=_0x559950['dialCongestionRetryFrequency'];_0x49383b=_0x559950[_0xa127('0xd6')];ami['emit'](_0xa127('0x1a7'),ut[_0xa127('0x119')](_0x5ce8b1,_0xa127('0x1a8')));hopperUtils[_0xa127('0x12e')](_0x277d05)[_0xa127('0xa7')](loggerCatch(_0xa127('0x1a9')));if(_0x336e87['checkRetriveMax'](0x8,_0x5ce8b1,_0x559950)&&!_0x519cc4){if(_0x277d05[_0xa127('0x12f')]>=_0x559950[_0xa127('0x18d')]){_0x336e87['createStateFinal'](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x1aa'));}else{_0x336e87[_0xa127('0x130')](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x1aa'));}}break;case'11':_0x559950[_0xa127('0x1ab')]+=0x1;_0x277d05[_0xa127('0x74')]=0xb;_0x277d05[_0xa127('0x75')]=_0xa127('0xe5');_0x277d05['countabandonedretry']+=0x1;_0x277d05[_0xa127('0xd5')]+=0x1;_0x3158e1=_0x559950[_0xa127('0xe7')];_0x49383b=_0x559950[_0xa127('0xd6')];hopperUtils[_0xa127('0x12e')](_0x277d05)['catch'](loggerCatch(_0xa127('0x1ac')));if(_0x336e87[_0xa127('0x189')](0xb,_0x5ce8b1,_0x559950)&&!_0x519cc4){if(_0x277d05[_0xa127('0xe9')]>=_0x559950[_0xa127('0xea')]){_0x336e87[_0xa127('0x129')](_0x277d05,_0x1eb7be,_0x1013d6,'reason\x2011\x20abandoned');}else{_0x336e87[_0xa127('0x130')](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x1ad'));}}break;case'20':_0x559950[_0xa127('0x1ae')]+=0x1;_0x277d05[_0xa127('0x74')]=0x14;_0x277d05[_0xa127('0x75')]=_0xa127('0x1af');_0x277d05[_0xa127('0x125')]+=0x1;_0x277d05['countglobal']+=0x1;_0x3158e1=_0x559950[_0xa127('0x1b0')];_0x49383b=_0x559950[_0xa127('0xd6')];ami[_0xa127('0x44')](_0xa127('0x1b1'),ut[_0xa127('0x119')](_0x5ce8b1,_0xa127('0x1b2')));hopperUtils[_0xa127('0x12e')](_0x277d05)['catch'](loggerCatch(_0xa127('0x1b3')));if(_0x336e87[_0xa127('0x189')](0x14,_0x5ce8b1,_0x559950)&&!_0x519cc4){if(_0x277d05[_0xa127('0x125')]>=_0x559950[_0xa127('0x194')]){_0x336e87[_0xa127('0x129')](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x1b4'));}else{_0x336e87[_0xa127('0x130')](_0x277d05,_0x1eb7be,_0x1013d6,_0xa127('0x1b4'));}}break;default:_0x559950[_0xa127('0x138')]+=0x1;_0x277d05[_0xa127('0x74')]=0xc;_0x277d05[_0xa127('0x75')]=_0x1084b1[_0xa127('0x199')];_0x3158e1=_0x559950[_0xa127('0x1b0')];_0x49383b=_0x559950[_0xa127('0xd6')];hopperUtils[_0xa127('0x12e')](_0x277d05)[_0xa127('0xa7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x336e87['checkRetriveMax'](_0x1084b1[_0xa127('0x199')],_0x5ce8b1,_0x559950)&&!_0x519cc4){if(_0x277d05[_0xa127('0x122')]+_0x277d05[_0xa127('0x12f')]+_0x277d05['countnoanswerretry']+_0x277d05[_0xa127('0x124')]+_0x277d05['countdropretry']+_0x277d05[_0xa127('0xe9')]+_0x277d05[_0xa127('0x11f')]+_0x277d05[_0xa127('0x125')]>=_0x559950[_0xa127('0x126')]){_0x336e87['stateGlobal'](_0x277d05,_0x1eb7be,_0x1013d6,_0x1084b1[_0xa127('0x199')]);}else{_0x336e87[_0xa127('0x129')](_0x277d05,_0x1eb7be,_0x1013d6,_0x1084b1[_0xa127('0x199')]);}}}})['then'](function(){if(_0x519cc4){hopperUtils['swapAdditionalPhones'](_0x277d05,_0x3158e1,_0x49383b)[_0xa127('0x41')](function(){return _0x1eb7be(0x1);});}});});};Dialer[_0xa127('0x1d')]['stateGlobal']=function(_0x4f0af9,_0x362d85,_0x4214b0,_0x430f15){var _0x1b2d19=new Final(_0x4f0af9);_0x1b2d19['state']=0xf;_0x1b2d19['statedesc']=_0xa127('0x1b5');this[_0xa127('0x129')](_0x1b2d19,_0x362d85,_0x4214b0,_0x430f15);};Dialer[_0xa127('0x1d')][_0xa127('0x129')]=function(_0x523860,_0x4b7406,_0x3dce5a,_0x307a58){hopperUtils['moveContactManagedDialer'](_0x523860)[_0xa127('0x41')](function(){return _0x4b7406(msgResponse(_0xa127('0x198'),_0xa127('0x10e'),_0x307a58));})[_0xa127('0xa7')](function(){return _0x3dce5a(msgResponse(_0xa127('0x1b6'),_0xa127('0x97'),_0xa127('0x1b7')));});};Dialer[_0xa127('0x1d')]['predictive']=function(_0x589ef2){var _0x30e76b=_0x589ef2['dialPredictiveOptimizationPercentage']/0x64;var _0x9b9801=_0x589ef2[_0xa127('0xd1')]/(_0x589ef2[_0xa127('0xd1')]+_0x589ef2['outboundAnswerCallsDay']);var _0x149788=Math[_0xa127('0x1b8')](_0x589ef2['predictiveIntervalAvailable']*(_0x589ef2[_0xa127('0x1b9')]/0x64));var _0x17870a=Math[_0xa127('0x1b8')](_0x589ef2[_0xa127('0x1ba')]*(_0x589ef2[_0xa127('0x1bb')]/0x64));var _0x2c8bf8=_0x589ef2[_0xa127('0x13f')]+_0x589ef2[_0xa127('0x141')];var _0x426e3d=Math[_0xa127('0x1bc')](_0x589ef2['erlangCalls']*_0x589ef2[_0xa127('0x61')]*_0x589ef2[_0xa127('0x1bd')]*_0x589ef2[_0xa127('0x1be')]);if(_[_0xa127('0x43')](_0x589ef2[_0xa127('0x66')])){if(!_[_0xa127('0x43')](_0x589ef2['startPredictive'])){_0x589ef2[_0xa127('0x2d')]=undefined;loggerPredictive[_0xa127('0x6b')](_0xa127('0x1bf'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x589ef2[_0xa127('0x69')])){loggerPredictive[_0xa127('0x6b')]('[startMethodPredictive][StartProgressive]',_0xa127('0x1c0'));clearInterval(_0x589ef2[_0xa127('0x69')]);_0x589ef2['handlePredictive']=undefined;}_0x589ef2[_0xa127('0x66')]=moment()['format'](_0xa127('0xcb'));loggerPredictive[_0xa127('0x4a')](_0x589ef2[_0xa127('0x48')],_0xa127('0x1c1'),_0x589ef2[_0xa127('0x66')]);this[_0xa127('0xba')](_0x589ef2,0x1);}else if(ifInterval(_0x589ef2[_0xa127('0x1c2')],_0x589ef2[_0xa127('0x66')])){this['handlePower'](_0x589ef2,0x1);loggerPredictiveCalls[_0xa127('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x589ef2[_0xa127('0x66')],_0x589ef2[_0xa127('0x48')]);_0x589ef2['erlangCalls']=0x0;_0x589ef2['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x30e76b<_0x9b9801&&_0x589ef2[_0xa127('0x1c3')]===_0xa127('0x1c4')){clearPredictiveAttributes(_0x589ef2);loggerPredictive['info'](_0xa127('0x1c5'),_0xa127('0x1c6'),_0x9b9801,'startProgressive',_0x589ef2[_0xa127('0x48')]);}else if(_0x426e3d<_0x589ef2[_0xa127('0x1c7')]&&_0x589ef2[_0xa127('0x1c3')]===_0xa127('0x1c4')){clearPredictiveAttributes(_0x589ef2);loggerPredictive[_0xa127('0x4a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x426e3d,_0xa127('0x1c8'),_0x589ef2['predictiveIntervalErlangCallsDroppedCalls'],_0xa127('0x66'),_0x589ef2[_0xa127('0x48')]);}else if(!ifInterval(_0x589ef2['dialPredictiveInterval'],_0x589ef2[_0xa127('0x66')])&&_['isUndefined'](_0x589ef2['startPredictive'])&&!_['isUndefined'](_0x589ef2[_0xa127('0x66')])){_0x589ef2['startPredictive']=moment()[_0xa127('0x83')](_0xa127('0xcb'));loggerPredictive[_0xa127('0x4a')](_0x589ef2[_0xa127('0x48')],_0xa127('0x1c9'),_0x589ef2[_0xa127('0x2d')]);hopperUtils[_0xa127('0x1ca')](_0x589ef2[_0xa127('0x1c2')])[_0xa127('0x41')](this['getDataPredictive'](_0x589ef2))[_0xa127('0x41')](mergeDataErlangB(_0x589ef2))[_0xa127('0x41')](this[_0xa127('0x1cb')](_0x589ef2))[_0xa127('0xa7')](loggerCatchPredictive(_0xa127('0x1cc'),_0x589ef2));}else if(!ifInterval(_0x589ef2['dialPredictiveInterval'],_0x589ef2[_0xa127('0x2d')])){_0x589ef2[_0xa127('0x1c7')]=0x0;_0x589ef2[_0xa127('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa127('0x4a')](_0x589ef2[_0xa127('0x48')],'recalculate\x20predictive\x20at',_0x589ef2[_0xa127('0x2d')]);clearInterval(_0x589ef2[_0xa127('0x69')]);_0x589ef2[_0xa127('0x69')]=undefined;hopperUtils[_0xa127('0x1ca')](_0x589ef2['dialPredictiveInterval'])[_0xa127('0x41')](this[_0xa127('0x1cd')](_0x589ef2))[_0xa127('0x41')](mergeDataErlangB(_0x589ef2))[_0xa127('0x41')](this['startMethodPredictive'](_0x589ef2))[_0xa127('0xa7')](loggerCatchPredictive(_0xa127('0x1ce'),_0x589ef2));}else if(_0x589ef2[_0xa127('0x1ba')]&&_0x2c8bf8<_0x589ef2[_0xa127('0x1ba')]-_0x17870a){clearPredictiveAttributes(_0x589ef2);loggerPredictive[_0xa127('0x4a')](_0x589ef2[_0xa127('0x48')],_0xa127('0x1cf'),_0x2c8bf8,_0xa127('0x1d0'),_0x589ef2[_0xa127('0x1ba')],'-',_0x17870a,'=',_0x589ef2['predictiveIntervalAvailable']-_0x17870a,')');}else if(_0x589ef2['predictiveIntervalAvailable']&&_0x2c8bf8>_0x589ef2[_0xa127('0x1ba')]+_0x149788){clearPredictiveAttributes(_0x589ef2);loggerPredictive[_0xa127('0x4a')](_0x589ef2[_0xa127('0x48')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2c8bf8,_0xa127('0x1d1'),_0x589ef2[_0xa127('0x1ba')],'+',_0x149788,'=',_0x589ef2[_0xa127('0x1ba')]+_0x149788,')');}};Dialer[_0xa127('0x1d')][_0xa127('0x1cd')]=function(_0x30a118){var _0x12ea75=this;return function(_0x4ffa6f){return new Promise(function(_0x5b0930,_0x11c24c){_['merge'](_0x30a118,_0x4ffa6f[0x0]);if(checkGetDataPredictive(_0x4ffa6f[0x0])){var _0x49262d=_0x30a118[_0xa127('0x1ba')]=_0x30a118[_0xa127('0x141')]+_0x30a118['available'];var _0x2e9f26=_0x30a118[_0xa127('0x1c2')]*0x3c;var _0x4bb8cd=_0x4ffa6f[0x0][_0xa127('0x55')]+_0x4ffa6f[0x0]['predictiveIntervalAvgHoldtime'];var _0x11dd72=(_0x4ffa6f[0x0][_0xa127('0x4f')]+_0x4ffa6f[0x0][_0xa127('0xd0')]+_0x4ffa6f[0x0][_0xa127('0x1d2')])/_0x4ffa6f[0x0][_0xa127('0x4d')];_0x30a118['predictiveIntervalHitRate']=_0x11dd72>0x0?_0x11dd72:0x1;switch(_0x30a118[_0xa127('0x1c3')]){case _0xa127('0x1c4'):var _0x5773c9=_0x30a118[_0xa127('0x1d3')]/0x64;return _0x12ea75[_0xa127('0x1d4')](_0x49262d,_0x2e9f26,_0x4bb8cd,_0x11dd72,_0x5773c9)['then'](function(_0x27e026){return _0x5b0930(_0x27e026);});case'agentBusyFactor':var _0x154ccc=_0x30a118[_0xa127('0x1d3')]/0x64;return _0x12ea75['busyFactor'](_0x49262d,_0x2e9f26,_0x4bb8cd,_0x11dd72,_0x154ccc)['then'](function(_0x36c040){return _0x5b0930(_0x36c040);});default:return _0x11c24c(msgResponse('[getDataPredictive]',_0xa127('0x97'),_0xa127('0x1d5')));}}else{return _0x11c24c(msgResponse('[getDataPredictive]',_0xa127('0x97'),_0xa127('0x1d6')));}});};};Dialer[_0xa127('0x1d')][_0xa127('0x1d7')]=function(_0x45f91c){var _0x95a7a0=this;return function(_0x57f48c){return new Promise(function(_0x7d7e74,_0x41e9a4){_[_0xa127('0x64')](_0x45f91c,_0x57f48c[0x0]);if(checkGetDataPredictive(_0x57f48c[0x0])){loggerPredictive[_0xa127('0x4a')](JSON[_0xa127('0x7b')](_0x57f48c[0x0]));if(_0x45f91c[_0xa127('0x1c3')]===_0xa127('0x1c4')){return _0x95a7a0['getVoiceQueueRtPauses'](_0x45f91c['id'])[_0xa127('0x41')](function(_0x4b60dd){var _0x4d9cf4=_0x45f91c[_0xa127('0x1d8')]-_0x4b60dd[0x0][_0xa127('0x1d9')];var _0x4fa361=_0x45f91c[_0xa127('0x1c2')]*0x3c;var _0x812fca=_0x57f48c[0x0][_0xa127('0x55')]+_0x57f48c[0x0][_0xa127('0x53')];var _0x41feb6=(_0x57f48c[0x0][_0xa127('0x4f')]+_0x57f48c[0x0][_0xa127('0xd0')]+_0x57f48c[0x0][_0xa127('0x1d2')])/_0x57f48c[0x0]['predictiveIntervalTotalCalls'];var _0x59db5a=_0x45f91c[_0xa127('0x1d3')]/0x64;_0x45f91c[_0xa127('0x1da')]=_0x4b60dd[0x0][_0xa127('0x1d9')]||0x0;_0x45f91c['predictiveIntervalHitRate']=_0x41feb6>0x0?_0x41feb6:0x1;return _0x95a7a0[_0xa127('0x1d4')](_0x4d9cf4,_0x4fa361,_0x812fca,_0x41feb6,_0x59db5a);})[_0xa127('0x41')](function(_0x5a04af){return _0x7d7e74(_0x5a04af);})[_0xa127('0xa7')](function(_0x8a004a){return _0x41e9a4(msgResponse(_0xa127('0x1db'),'Failure',JSON[_0xa127('0x7b')](_0x8a004a)));});}if(_0x45f91c['dialPredictiveOptimization']===_0xa127('0x1dc')){return _0x95a7a0[_0xa127('0x157')](_0x45f91c['id'])[_0xa127('0x41')](function(_0x3641ff){var _0x338712=_0x45f91c[_0xa127('0x1d8')]-_0x3641ff[0x0][_0xa127('0x1d9')];var _0x5e3a82=_0x45f91c[_0xa127('0x1c2')]*0x3c;var _0x1e5f35=_0x57f48c[0x0][_0xa127('0x55')]+_0x57f48c[0x0]['predictiveIntervalAvgHoldtime'];var _0x2d820c=(_0x57f48c[0x0][_0xa127('0x4f')]+_0x57f48c[0x0][_0xa127('0xd0')]+_0x57f48c[0x0][_0xa127('0x1d2')])/_0x57f48c[0x0][_0xa127('0x4d')];var _0x28a113=_0x45f91c[_0xa127('0x1d3')]/0x64;_0x45f91c[_0xa127('0x1da')]=_0x3641ff[0x0][_0xa127('0x1d9')]||0x0;_0x45f91c[_0xa127('0x1bd')]=_0x2d820c>0x0?_0x2d820c:0x1;return _0x95a7a0[_0xa127('0x1dd')](_0x338712,_0x5e3a82,_0x1e5f35,_0x2d820c,_0x28a113);})[_0xa127('0x41')](function(_0x4ce030){return _0x7d7e74(_0x4ce030);})[_0xa127('0xa7')](function(_0x112435){return _0x41e9a4(msgResponse('[CatchErlangB]',_0xa127('0x97'),JSON[_0xa127('0x7b')](_0x112435)));});}}else{return _0x41e9a4(msgResponse(_0xa127('0x1de'),'Failure',_0xa127('0x1d6')));}});};};Dialer[_0xa127('0x1d')]['startMethodPredictive']=function(_0x358ef7){var _0x5ccea8=this;return function(){var _0x531175=0x0;var _0x1c3a4e=Math['floor'](_0x358ef7[_0xa127('0x5f')]*0x3e8);if(_0x1c3a4e>0x0){_0x1c3a4e=_0x1c3a4e<0x64?0x64:_0x1c3a4e;loggerPredictive['info'](_0x358ef7[_0xa127('0x48')],_0xa127('0x1df'),_0x1c3a4e,_0xa127('0x1e0'));_0x358ef7[_0xa127('0x69')]=setInterval(function(){_0x5ccea8[_0xa127('0x69')](_0x358ef7);loggerPredictiveCalls[_0xa127('0x4a')](_0xa127('0x1e1'),_0x531175+=0x1);},_0x1c3a4e);}else{loggerPredictive[_0xa127('0x4a')](_0x358ef7[_0xa127('0x48')],_0xa127('0x1e2'));}};};Dialer['prototype'][_0xa127('0x1e3')]=function(_0x147a3e,_0x5b57c0){var _0x4c9ca7=this;return function(_0x3fd933){if(_[_0xa127('0x49')](_0x3fd933)){if(_['isNil'](_0x5b57c0['UserId'])||!_0x5b57c0['recallme']){if(_0x147a3e['dialMethod']===_0xa127('0x9')){_0x147a3e['queueStatusComplete']=_[_0xa127('0x43')](_0x147a3e[_0xa127('0x78')])?!![]:_0x147a3e[_0xa127('0x78')];var _0x27ede5=uuid['v4']();_0x4c9ca7[_0xa127('0x29')][_0x27ede5]=new Action(_0x147a3e,_0x5b57c0,_0x27ede5);loggerBooked[_0xa127('0x4a')](_0xa127('0x1e4'),_0x27ede5,_0xa127('0x1e5'),JSON[_0xa127('0x7b')](_0x147a3e[_0xa127('0x78')]),'Queue:\x20',_0x147a3e[_0xa127('0x48')]);if(_0x147a3e[_0xa127('0x78')]){_0x147a3e[_0xa127('0x78')]=![];_0x4c9ca7['queueBooked'][_0x4c9ca7[_0xa127('0x29')][_0x27ede5][_0xa127('0xc1')]]=[];ami['Action']({'actionid':_0x27ede5,'action':'queuestatus','queue':_0x147a3e[_0xa127('0x48')]})[_0xa127('0xa7')](function(){_0x4c9ca7[_0xa127('0xc4')](_0x147a3e);hopperUtils[_0xa127('0xda')]({'active':![],'ContactId':_0x4c9ca7[_0xa127('0x29')][_0x27ede5][_0xa127('0xec')],'ListId':_0x4c9ca7['actions'][_0x27ede5]['ListId'],'VoiceQueueId':_0x4c9ca7['actions'][_0x27ede5][_0xa127('0xde')]||undefined,'CampaignId':_0x4c9ca7[_0xa127('0x29')][_0x27ede5][_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0x1e6')));delete _0x4c9ca7[_0xa127('0x29')][_0x27ede5];});}else{loggerBooked['info'](_0xa127('0x1e7'),JSON[_0xa127('0x7b')](_0x147a3e[_0xa127('0x78')]),'Queue:\x20',_0x147a3e[_0xa127('0x48')]);_0x4c9ca7[_0xa127('0xc4')](_0x147a3e);hopperUtils[_0xa127('0xda')]({'active':![],'ContactId':_0x4c9ca7['actions'][_0x27ede5][_0xa127('0xec')],'ListId':_0x4c9ca7['actions'][_0x27ede5]['ListId'],'VoiceQueueId':_0x4c9ca7[_0xa127('0x29')][_0x27ede5]['VoiceQueueId']||undefined,'CampaignId':_0x4c9ca7[_0xa127('0x29')][_0x27ede5][_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch(_0xa127('0x1e6')));delete _0x4c9ca7['actions'][_0x27ede5];}}else{return _0x4c9ca7[_0xa127('0x15e')](_0x147a3e,_0x5b57c0);}}else{if(utils[_0xa127('0x65')](undefined,_0x5b57c0['scheduledat'])<_0x147a3e['dialRecallMeTimeout']*0x3c){if(_0x5b57c0[_0xa127('0x150')]&&!_0x5b57c0['Agent'][_0xa127('0x1e8')]){_0x4c9ca7['preview'][_0xa127('0xfb')](_0x5b57c0['id'])[_0xa127('0x20')](function(){_0x4c9ca7[_0xa127('0xc4')](_0x147a3e);});}else{hopperUtils[_0xa127('0x1e9')]({'active':![]},_0x5b57c0['id'],0x1)['finally'](function(){_0x4c9ca7[_0xa127('0xc4')](_0x147a3e);});}}else{_0x147a3e[_0xa127('0x1ea')]+=0x1;_0x4c9ca7[_0xa127('0xc4')](_0x147a3e);if(_0x147a3e['dialRecallInQueue']){hopperUtils[_0xa127('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b57c0[_0xa127('0xec')],'ListId':_0x5b57c0[_0xa127('0xdd')],'VoiceQueueId':_0x5b57c0[_0xa127('0xde')]||undefined,'CampaignId':_0x5b57c0[_0xa127('0xdf')]||undefined})[_0xa127('0xa7')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xa127('0x12e')](createObjHistory(_0x147a3e,_0x5b57c0,utils[_0xa127('0x6f')][_0xa127('0x1eb')],0x17,_0xa127('0x1ec')))[_0xa127('0xa7')](loggerCatch(_0xa127('0x1ed')));}else{_0x4c9ca7[_0xa127('0x11b')](createObjHistory(_0x147a3e,_0x5b57c0,utils[_0xa127('0x6f')][_0xa127('0x1ee')],0x16,_0xa127('0x1ef')),_0xa127('0x1f0'),_0xa127('0x1f1'));}}}}else{_0x147a3e['outboundBlacklistCallsDay']+=0x1;_0x4c9ca7[_0xa127('0x11b')](createObjHistory(_0x147a3e,_0x5b57c0,utils[_0xa127('0x6f')]['BLACKLIST'],0xd,'Blacklist'),_0xa127('0x1f2'),_0xa127('0x1f3'));throw _0xa127('0x1f4');}};};Dialer[_0xa127('0x1d')]['handleIvr']=function(_0x1265d3){var _0x27851e=this;var _0x4eacde=_0x1265d3[_0xa127('0x1f5')]-_0x1265d3[_0xa127('0x85')];emitCampaignSummary(_0x1265d3);if(_0x4eacde>0x0&&_0x1265d3['temp']==0x0){if(_0x4eacde>this[_0xa127('0x27')]){_0x4eacde=this['maxNumberOriginate'];}_0x1265d3[_0xa127('0x1f6')]=0x1;hopperUtils[_0xa127('0x1f7')](_0x1265d3,_0x4eacde)[_0xa127('0x41')](function(_0x46cca9){_0x1265d3['temp']=0x0;if(_0x46cca9){if(!utils[_0xa127('0x1f8')](_0x46cca9)){_0x1265d3['message']=utils[_0xa127('0x6f')][_0xa127('0x72')];logger[_0xa127('0x4a')](_0xa127('0x1f9')+_0x1265d3[_0xa127('0x48')]);}else{_0x1265d3['originated']+=_0x46cca9[_0xa127('0x9d')];_0x1265d3[_0xa127('0x6e')]=utils[_0xa127('0x6f')]['RUNNING'];for(var _0x203c97=0x0;_0x203c97<_0x46cca9[_0xa127('0x9d')];_0x203c97+=0x1){_0x1265d3['ivrTotalCallsDays']+=0x1;if(_[_0xa127('0xf4')](_0x46cca9[_0x203c97])||_['isNil'](_0x46cca9[_0x203c97][_0xa127('0x1fa')])||_[_0xa127('0xf4')](_0x46cca9[_0x203c97][_0xa127('0x161')])){_0x27851e[_0xa127('0x15b')](_0xa127('0x1fb'),_0x1265d3,_0x46cca9[_0x203c97]);}else{hopperUtils[_0xa127('0x1fc')](_[_0xa127('0xf8')](_0x46cca9[_0x203c97],['CampaignId','phone']))['then'](_0x27851e[_0xa127('0x1e3')](_0x1265d3,_0x46cca9[_0x203c97]))[_0xa127('0xa7')](_0x27851e[_0xa127('0x15a')](_0xa127('0x1fd'),_0x1265d3));}}}}})[_0xa127('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0x1265d3,_0x4eacde));}};Dialer[_0xa127('0x1d')][_0xa127('0xba')]=function(_0x3c1868,_0x113e60){var _0x1fccf3=this;var _0x2fa535=[];if(_0x113e60<0x1||_0x3c1868['dialMethod']==='booked'){_0x113e60=0x1;}var _0x51795b=Math['floor'](_0x3c1868[_0xa127('0x13f')]*_0x113e60)-_0x3c1868[_0xa127('0x85')];if(_0x3c1868[_0xa127('0x1fe')]>0x0){var _0x457b4a=_0x3c1868[_0xa127('0x1fe')]-_0x3c1868[_0xa127('0x85')]-_0x3c1868[_0xa127('0x141')]-_0x3c1868[_0xa127('0x142')];if(_0x51795b>_0x457b4a){_0x51795b=_0x457b4a;}}if(_0x51795b>0x0&&_0x3c1868['temp']==0x0){if(_0x3c1868[_0xa127('0xb8')]===_0xa127('0x9')){_0x51795b=0x1;}if(_0x51795b>this[_0xa127('0x27')]){_0x51795b=this[_0xa127('0x27')];}for(var _0x14c76d in this[_0xa127('0x25')]){if(typeof this['agents'][_0x14c76d]!==_0xa127('0xb2')){if(this[_0xa127('0x25')][_0x14c76d][_0xa127('0x74')]==='not_inuse'&&this[_0xa127('0x25')][_0x14c76d][_0xa127('0x8e')]==='reachable'){_0x2fa535[_0xa127('0x9e')](this[_0xa127('0x25')][_0x14c76d]['id']);}}}_0x3c1868['temp']=0x1;hopperUtils[_0xa127('0x1ff')](_0x3c1868,_0x2fa535,_0x51795b)[_0xa127('0x41')](function(_0x3da112){_0x3c1868[_0xa127('0x1f6')]=0x0;if(_0x3da112){if(!utils[_0xa127('0x1f8')](_0x3da112)){hopperUtils[_0xa127('0x200')](_0x3c1868)[_0xa127('0x41')](sendMessageReschedule(_0x3c1868))['catch'](loggerCatch(_0xa127('0x201')));}else{_0x3c1868[_0xa127('0x85')]+=_0x3da112[_0xa127('0x9d')];_0x3c1868[_0xa127('0x6e')]=_0x3c1868[_0xa127('0xb8')]===_0xa127('0x9')?utils[_0xa127('0x6f')][_0xa127('0x143')]:utils[_0xa127('0x6f')][_0xa127('0x202')];for(var _0x11779f=0x0;_0x11779f<_0x3da112[_0xa127('0x9d')];_0x11779f+=0x1){if(_[_0xa127('0xf4')](_0x3da112[_0x11779f])||_[_0xa127('0xf4')](_0x3da112[_0x11779f][_0xa127('0x1fa')])||_[_0xa127('0xf4')](_0x3da112[_0x11779f][_0xa127('0x161')])){_0x1fccf3[_0xa127('0x15b')]('[actionOriginate]\x20',_0x3c1868,_0x3da112[_0x11779f]);}else{hopperUtils[_0xa127('0x203')](_[_0xa127('0xf8')](_0x3da112[_0x11779f],[_0xa127('0xde'),'phone']))[_0xa127('0x41')](_0x1fccf3[_0xa127('0x1e3')](_0x3c1868,_0x3da112[_0x11779f]))['catch'](_0x1fccf3['loggerHandler'](_0xa127('0x1fb'),_0x3c1868));}}}}})['catch'](loggerGetContactDialer(_0xa127('0x204'),_0x3c1868,_0x51795b));}};Dialer[_0xa127('0x1d')][_0xa127('0x69')]=function(_0x485e58){if(_0x485e58['dialLimitQueue']>0x0){var _0x4d43b7=_0x485e58[_0xa127('0x1fe')]-_0x485e58[_0xa127('0x85')]-_0x485e58[_0xa127('0x141')];if(_0x4d43b7>0x0&&_0x485e58[_0xa127('0x1f6')]==0x0){this[_0xa127('0x205')](_0x485e58);}else{loggerPredictiveCalls['info'](_0xa127('0x206'));}}else{this[_0xa127('0x205')](_0x485e58);}};Dialer[_0xa127('0x1d')]['tryOriginatePredictive']=function(_0x3cde0b){var _0x565272=this;var _0x104cba=[];_0x3cde0b[_0xa127('0x85')]+=0x1;for(var _0x37824b in this[_0xa127('0x25')]){if(typeof this[_0xa127('0x25')][_0x37824b]!=='undefined'){if(this[_0xa127('0x25')][_0x37824b][_0xa127('0x74')]===_0xa127('0x207')&&this['agents'][_0x37824b][_0xa127('0x8e')]==='reachable'){_0x104cba[_0xa127('0x9e')](this['agents'][_0x37824b]['id']);}}}_0x3cde0b[_0xa127('0x1f6')]=0x1;return this[_0xa127('0x1ff')](_0x3cde0b['id'],_0x104cba,0x1,_0x3cde0b[_0xa127('0x208')],_0x3cde0b)[_0xa127('0x41')](function(_0xa4a54f){_0x3cde0b['temp']=0x1;if(_0xa4a54f){if(!utils[_0xa127('0x1f8')](_0xa4a54f)){utils[_0xa127('0x209')](_0x3cde0b,0x1,0x0);return hopperUtils['countReScheduled'](_0x3cde0b)[_0xa127('0x41')](sendMessageReschedule(_0x3cde0b))[_0xa127('0xa7')](loggerCatch(_0xa127('0x201')));}else{_0x3cde0b['message']=utils[_0xa127('0x6f')][_0xa127('0x202')];if(_[_0xa127('0xf4')](_0xa4a54f[0x0])||_['isNil'](_0xa4a54f[0x0][_0xa127('0x1fa')])||_['isNil'](_0xa4a54f[0x0][_0xa127('0x161')])){_0x565272[_0xa127('0x15b')]('[actionOriginate]\x20',_0x3cde0b,_0xa4a54f[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xa127('0xf8')](_0xa4a54f[0x0],[_0xa127('0xde'),_0xa127('0x161')]))[_0xa127('0x41')](_0x565272[_0xa127('0x1e3')](_0x3cde0b,_0xa4a54f[0x0]))[_0xa127('0xa7')](_0x565272[_0xa127('0x15a')]('[actionOriginatePredictive]\x20',_0x3cde0b));}}}})[_0xa127('0xa7')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3cde0b,0x1));};Dialer[_0xa127('0x1d')]['abandonmentRate']=function(_0x4f8001,_0x86415e,_0x295f7f,_0x443bc6,_0x173d79,_0xdd0296){loggerPredictive[_0xa127('0x4a')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xa127('0x4a')](_0xa127('0x20a'),_0x4f8001);loggerPredictive[_0xa127('0x4a')](_0xa127('0x20b'),_0x86415e);loggerPredictive[_0xa127('0x4a')](_0xa127('0x20c'),_0x295f7f);loggerPredictive[_0xa127('0x4a')](_0xa127('0x20d'),_0x443bc6);loggerPredictive['info'](_0xa127('0x20e'),_0x173d79);loggerPredictive['info'](_0xa127('0x56'));return new Promise(function(_0x3cb495,_0x8be576){if(_0x4f8001<=0x0||isNaN(_0x4f8001)){return _0x8be576(msgResponse('[abandonmentRate]',_0xa127('0x8a'),_0xa127('0x20f')+_0x4f8001));}if(_0x295f7f<=0x0||isNaN(_0x295f7f)){return _0x8be576(msgResponse(_0xa127('0x210'),_0xa127('0x8a'),_0xa127('0x211')+_0x295f7f));}if(_0x443bc6<=0x0||isNaN(_0x443bc6)){return _0x8be576(msgResponse(_0xa127('0x210'),'Error',_0xa127('0x212')+_0x443bc6));}if(_0x86415e<=0x0||isNaN(_0x86415e)){return _0x8be576(msgResponse('[abandonmentRate]',_0xa127('0x8a'),'interval\x20=\x20'+_0x86415e));}if(_0x173d79<=0x0||isNaN(_0x173d79)){return _0x8be576(msgResponse('[abandonmentRate]',_0xa127('0x8a'),'Amax\x20=\x20'+_0x173d79));}_0xdd0296=_0xdd0296||0x0;var _0x9f794c=0x1/_0x295f7f;var _0x4821dc=0x0;var _0x43dd66=0x0;var _0x417dcf=0x0;var _0x259b9d=0x0;for(var _0x4a11f7=0x0;_0x417dcf<_0x173d79;_0x4a11f7+=0x1){_0x43dd66=_0x4a11f7/_0x86415e;_0x4821dc=(_0x443bc6*_0x43dd66+_0xdd0296)/_0x9f794c;_0x417dcf=utils[_0xa127('0x213')](_0x4821dc,_0x4f8001);_0x259b9d=_0x4821dc/_0x4f8001*(0x1-utils[_0xa127('0x213')](_0x4821dc,_0x4f8001));}return _0x3cb495({'erlangCalls':_0x4a11f7,'erlangCallToSecond':_0x86415e/_0x4a11f7,'erlangAbandonmentRate':_0x417dcf,'erlangBusyFactor':_0x259b9d});});};Dialer['prototype'][_0xa127('0x1dd')]=function(_0x161d3a,_0x196d6c,_0x1493ca,_0x5392f2,_0x411198,_0x378033){loggerPredictive[_0xa127('0x4a')](_0xa127('0x214'));loggerPredictive['info'](_0xa127('0x20a'),_0x161d3a);loggerPredictive['info'](_0xa127('0x20b'),_0x196d6c);loggerPredictive[_0xa127('0x4a')](_0xa127('0x20c'),_0x1493ca);loggerPredictive[_0xa127('0x4a')](_0xa127('0x20d'),_0x5392f2);loggerPredictive[_0xa127('0x4a')](_0xa127('0x215'),_0x411198);loggerPredictive['info'](_0xa127('0x56'));return new Promise(function(_0xc64695,_0x3ccb22){if(_0x161d3a<=0x0||isNaN(_0x161d3a)){return _0x3ccb22(msgResponse('[busyFactor]',_0xa127('0x8a'),_0xa127('0x20f')+_0x161d3a));}if(_0x1493ca<=0x0||isNaN(_0x1493ca)){return _0x3ccb22(msgResponse(_0xa127('0x216'),'Error',_0xa127('0x211')+_0x1493ca));}if(_0x5392f2<=0x0||isNaN(_0x5392f2)){return _0x3ccb22(msgResponse(_0xa127('0x216'),_0xa127('0x8a'),_0xa127('0x212')+_0x5392f2));}if(_0x196d6c<=0x0||isNaN(_0x196d6c)){return _0x3ccb22(msgResponse(_0xa127('0x216'),_0xa127('0x8a'),'interval\x20=\x20'+_0x196d6c));}if(_0x411198<=0x0||isNaN(_0x411198)){return _0x3ccb22(msgResponse('[busyFactor]',_0xa127('0x8a'),_0xa127('0x217')+_0x411198));}_0x378033=_0x378033||0x0;var _0x383e62=0x1/_0x1493ca;var _0x36d91b=0x0;var _0x30ff52=0x0;var _0x1826cb=0x0;var _0x4663f6=0x0;for(var _0x3fdf35=0x0;_0x4663f6<_0x411198;_0x3fdf35+=0x1){_0x30ff52=_0x3fdf35/_0x196d6c;_0x36d91b=(_0x5392f2*_0x30ff52+_0x378033)/_0x383e62;_0x1826cb=utils[_0xa127('0x213')](_0x36d91b,_0x161d3a);_0x4663f6=_0x36d91b/_0x161d3a*(0x1-utils[_0xa127('0x213')](_0x36d91b,_0x161d3a));}return _0xc64695({'erlangCalls':_0x3fdf35,'erlangCallToSecond':_0x196d6c/_0x3fdf35,'erlangAbandonmentRate':_0x1826cb,'erlangBusyFactor':_0x4663f6});});};module['exports']=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 daebd27..6edfc84 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 _0xf020=['util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','exports'];(function(_0x3f6d49,_0x19a4fa){var _0x30263d=function(_0x1b0df9){while(--_0x1b0df9){_0x3f6d49['push'](_0x3f6d49['shift']());}};_0x30263d(++_0x19a4fa);}(_0xf020,0x170));var _0x0f02=function(_0x395ab3,_0x1f969c){_0x395ab3=_0x395ab3-0x0;var _0x7b20cf=_0xf020[_0x395ab3];return _0x7b20cf;};'use strict';var util=require(_0x0f02('0x0'));var _=require(_0x0f02('0x1'));var moment=require(_0x0f02('0x2'));function checkNameSurname(_0x54e78a,_0xef76e0,_0x2c7612){var _0x513836='';if(!_[_0x0f02('0x3')](_0xef76e0)&&_0x0f02('0x4')===typeof _0xef76e0){_0x513836+=_0xef76e0;}if(!_[_0x0f02('0x3')](_0x2c7612)&&'string'===typeof _0x2c7612){_0x513836+='\x20'+_0x2c7612;}if(_0x513836!==''){return _0x513836;}return _0x54e78a;}function Action(_0x434ce2,_0x5891b4,_0x298ff6){this['voiceQueue']=_0x434ce2;this[_0x0f02('0x5')]=_0x298ff6||undefined;this[_0x0f02('0x6')]=checkNameSurname(_0x5891b4[_0x0f02('0x7')][_0x0f02('0x8')],_0x5891b4[_0x0f02('0x7')][_0x0f02('0x9')],_0x5891b4[_0x0f02('0x7')][_0x0f02('0xa')]);this[_0x0f02('0xb')]=_0x5891b4[_0x0f02('0x8')];this[_0x0f02('0xc')]=_0x434ce2[_0x0f02('0x6')];this['active']=_0x5891b4['active']||![];this[_0x0f02('0xd')]=_0x434ce2['type'];this[_0x0f02('0xe')]=_0x434ce2[_0x0f02('0xe')]||0x3;this[_0x0f02('0xf')]=_0x5891b4[_0x0f02('0xf')];this['countbusyretry']=_0x5891b4[_0x0f02('0x10')];this[_0x0f02('0x11')]=_0x5891b4['countcongestionretry'];this[_0x0f02('0x12')]=_0x5891b4[_0x0f02('0x12')];this['countnosuchnumberretry']=_0x5891b4[_0x0f02('0x13')];this['countdropretry']=_0x5891b4[_0x0f02('0x14')];this['countabandonedretry']=_0x5891b4[_0x0f02('0x15')];this[_0x0f02('0x16')]=_0x5891b4[_0x0f02('0x16')];this['countagentrejectretry']=_0x5891b4[_0x0f02('0x17')];this['ContactId']=_0x5891b4[_0x0f02('0x18')];this[_0x0f02('0x19')]=_0x5891b4[_0x0f02('0x19')];this[_0x0f02('0x1a')]=_0x5891b4[_0x0f02('0x1a')];this[_0x0f02('0x1b')]=_0x5891b4[_0x0f02('0x1b')];this[_0x0f02('0x1c')]=_0x5891b4['CampaignId'];this[_0x0f02('0x1d')]=_0x5891b4['id'];this[_0x0f02('0x1e')]=_0x5891b4[_0x0f02('0x7')][_0x0f02('0x9')]||'';this[_0x0f02('0x1f')]=moment()[_0x0f02('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0f02('0x21')]=_0x5891b4[_0x0f02('0x21')];this[_0x0f02('0x22')]=_0x5891b4[_0x0f02('0x22')];this[_0x0f02('0x23')]=_0x5891b4[_0x0f02('0x23')];this[_0x0f02('0x24')]=_0x5891b4['recallme'];this[_0x0f02('0x25')]='';this[_0x0f02('0x26')]='';}Action[_0x0f02('0x27')][_0x0f02('0x28')]=function(){return util[_0x0f02('0x20')]('\x22%s\x22\x20<%s>',this[_0x0f02('0x6')],this[_0x0f02('0x29')][_0x0f02('0x2a')]>0x0?this[_0x0f02('0xb')][_0x0f02('0x2b')](this[_0x0f02('0x29')][_0x0f02('0x2a')]):this[_0x0f02('0xb')]);};Action['prototype'][_0x0f02('0x2c')]=function(){return this[_0x0f02('0xc')];};module[_0x0f02('0x2d')]=Action; \ No newline at end of file +var _0xb67c=['ContactFirstName','format','callback','callbackuniqueid','callbackat','recallme','getCaller','dialCutDigit','number','prototype','getQueue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x342a98,_0x34143f){var _0x456915=function(_0x2f8dad){while(--_0x2f8dad){_0x342a98['push'](_0x342a98['shift']());}};_0x456915(++_0x34143f);}(_0xb67c,0x186));var _0xcb67=function(_0x4f95f8,_0xb73784){_0x4f95f8=_0x4f95f8-0x0;var _0x123b8e=_0xb67c[_0x4f95f8];return _0x123b8e;};'use strict';var util=require(_0xcb67('0x0'));var _=require(_0xcb67('0x1'));var moment=require(_0xcb67('0x2'));function checkNameSurname(_0x4dc424,_0x394bcb,_0x3fb997){var _0x52f5d6='';if(!_['isNil'](_0x394bcb)&&_0xcb67('0x3')===typeof _0x394bcb){_0x52f5d6+=_0x394bcb;}if(!_[_0xcb67('0x4')](_0x3fb997)&&_0xcb67('0x3')===typeof _0x3fb997){_0x52f5d6+='\x20'+_0x3fb997;}if(_0x52f5d6!==''){return _0x52f5d6;}return _0x4dc424;}function Action(_0x447641,_0x1f1203,_0x11255b){this[_0xcb67('0x5')]=_0x447641;this[_0xcb67('0x6')]=_0x11255b||undefined;this[_0xcb67('0x7')]=checkNameSurname(_0x1f1203[_0xcb67('0x8')][_0xcb67('0x9')],_0x1f1203['Contact'][_0xcb67('0xa')],_0x1f1203[_0xcb67('0x8')][_0xcb67('0xb')]);this['number']=_0x1f1203[_0xcb67('0x9')];this[_0xcb67('0xc')]=_0x447641[_0xcb67('0x7')];this[_0xcb67('0xd')]=_0x1f1203[_0xcb67('0xd')]||![];this[_0xcb67('0xe')]=_0x447641['type'];this[_0xcb67('0xf')]=_0x447641[_0xcb67('0xf')]||0x3;this[_0xcb67('0x10')]=_0x1f1203['scheduledat'];this[_0xcb67('0x11')]=_0x1f1203[_0xcb67('0x11')];this[_0xcb67('0x12')]=_0x1f1203[_0xcb67('0x12')];this[_0xcb67('0x13')]=_0x1f1203['countnoanswerretry'];this[_0xcb67('0x14')]=_0x1f1203[_0xcb67('0x14')];this[_0xcb67('0x15')]=_0x1f1203[_0xcb67('0x15')];this[_0xcb67('0x16')]=_0x1f1203[_0xcb67('0x16')];this[_0xcb67('0x17')]=_0x1f1203[_0xcb67('0x17')];this[_0xcb67('0x18')]=_0x1f1203[_0xcb67('0x18')];this[_0xcb67('0x19')]=_0x1f1203[_0xcb67('0x19')];this[_0xcb67('0x1a')]=_0x1f1203[_0xcb67('0x1a')];this[_0xcb67('0x1b')]=_0x1f1203[_0xcb67('0x1b')];this['VoiceQueueId']=_0x1f1203[_0xcb67('0x1c')];this[_0xcb67('0x1d')]=_0x1f1203[_0xcb67('0x1d')];this['idHopper']=_0x1f1203['id'];this[_0xcb67('0x1e')]=_0x1f1203[_0xcb67('0x8')][_0xcb67('0xa')]||'';this['starttime']=moment()[_0xcb67('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb67('0x20')]=_0x1f1203[_0xcb67('0x20')];this[_0xcb67('0x21')]=_0x1f1203[_0xcb67('0x21')];this[_0xcb67('0x22')]=_0x1f1203[_0xcb67('0x22')];this[_0xcb67('0x23')]=_0x1f1203[_0xcb67('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0xcb67('0x24')]=function(){return util[_0xcb67('0x1f')]('\x22%s\x22\x20<%s>',this[_0xcb67('0x7')],this[_0xcb67('0x5')][_0xcb67('0x25')]>0x0?this[_0xcb67('0x26')]['substring'](this[_0xcb67('0x5')]['dialCutDigit']):this[_0xcb67('0x26')]);};Action[_0xcb67('0x27')][_0xcb67('0x28')]=function(){return this[_0xcb67('0xc')];};module[_0xcb67('0x29')]=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 e1113bf..21f0beb 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 _0x47f4=['YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format'];(function(_0x102cff,_0x2b129e){var _0xccbb1e=function(_0x1cfbe7){while(--_0x1cfbe7){_0x102cff['push'](_0x102cff['shift']());}};_0xccbb1e(++_0x2b129e);}(_0x47f4,0x130));var _0x447f=function(_0x1beb39,_0x5bea88){_0x1beb39=_0x1beb39-0x0;var _0x3b7477=_0x47f4[_0x1beb39];return _0x3b7477;};'use strict';var moment=require(_0x447f('0x0'));var utils=require('../utils');function AgentComplete(_0xb7c97b,_0xfaf2e0){this['state']=0x4;this[_0x447f('0x1')]='Answer';this['scheduledat']=_0xb7c97b[_0x447f('0x2')];this[_0x447f('0x3')]=_0xb7c97b[_0x447f('0x3')];this['campaigntype']=_0xb7c97b[_0x447f('0x3')]===_0x447f('0x4')?_0x447f('0x5'):_0xb7c97b[_0x447f('0x3')];this[_0x447f('0x6')]=_0xb7c97b['countbusyretry'];this['countcongestionretry']=_0xb7c97b[_0x447f('0x7')];this[_0x447f('0x8')]=_0xb7c97b[_0x447f('0x8')];this[_0x447f('0x9')]=_0xb7c97b[_0x447f('0x6')]+_0xb7c97b[_0x447f('0x7')]+_0xb7c97b[_0x447f('0x8')]+_0xb7c97b[_0x447f('0xa')]+_0xb7c97b[_0x447f('0xb')]+_0xb7c97b['countabandonedretry']+_0xb7c97b[_0x447f('0xc')]+_0xb7c97b[_0x447f('0xd')];this[_0x447f('0xa')]=_0xb7c97b[_0x447f('0xa')];this['countdropretry']=_0xb7c97b['countdropretry'];this['countabandonedretry']=_0xb7c97b[_0x447f('0xe')];this[_0x447f('0xc')]=_0xb7c97b['countmachineretry'];this[_0x447f('0xd')]=_0xb7c97b[_0x447f('0xd')];this[_0x447f('0xf')]=_0xfaf2e0['uniqueid'];this[_0x447f('0x10')]=_0xb7c97b[_0x447f('0x11')];this['calleridnum']=_0xb7c97b[_0x447f('0x12')];this[_0x447f('0x13')]=_0xb7c97b['starttime'];this['responsetime']=_0xb7c97b[_0x447f('0x14')];this[_0x447f('0x15')]=_0xb7c97b['answertime'];this[_0x447f('0x16')]=moment()[_0x447f('0x17')](_0x447f('0x18'));this['ringtime']=utils[_0x447f('0x19')](_0xb7c97b[_0x447f('0x14')],_0xb7c97b[_0x447f('0x13')]);this['holdtime']=utils[_0x447f('0x19')](_0xb7c97b[_0x447f('0x15')],_0xb7c97b[_0x447f('0x14')]);this[_0x447f('0x1a')]=utils['getSeconds'](this[_0x447f('0x16')],_0xb7c97b[_0x447f('0x15')]);this['queue']=_0xfaf2e0['queue'];this[_0x447f('0x1b')]=_0xfaf2e0['membername'];this[_0x447f('0x1c')]=_0xfaf2e0[_0x447f('0x1c')];this[_0x447f('0x1d')]=_0xb7c97b[_0x447f('0x1d')];this[_0x447f('0x1e')]=_0xb7c97b[_0x447f('0x1e')];this[_0x447f('0x1f')]=_0xb7c97b[_0x447f('0x1f')];this[_0x447f('0x20')]=_0xb7c97b[_0x447f('0x20')];this[_0x447f('0x21')]=_0xb7c97b[_0x447f('0x21')];this[_0x447f('0x22')]=_0xb7c97b[_0x447f('0x22')];this[_0x447f('0x23')]=_0xb7c97b[_0x447f('0x23')];this['VoiceQueueId']=_0xb7c97b[_0x447f('0x24')];this[_0x447f('0x25')]=_0xb7c97b[_0x447f('0x25')];this[_0x447f('0x26')]=_0xb7c97b[_0x447f('0x26')]||'';this[_0x447f('0x27')]=_0xb7c97b[_0x447f('0x27')]||'';this['agiafterat']=_0xb7c97b['agiafterat'];}module[_0x447f('0x28')]=AgentComplete; \ No newline at end of file +var _0x337c=['callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','answertime','ringtime','getSeconds','holdtime','talktime','endtime','queue','membername','reason'];(function(_0x2f19d1,_0x2867df){var _0x9fd241=function(_0x181c13){while(--_0x181c13){_0x2f19d1['push'](_0x2f19d1['shift']());}};_0x9fd241(++_0x2867df);}(_0x337c,0x1b6));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xc337('0x0'));var utils=require(_0xc337('0x1'));function AgentComplete(_0x54d955,_0x435977){this[_0xc337('0x2')]=0x4;this[_0xc337('0x3')]=_0xc337('0x4');this[_0xc337('0x5')]=_0x54d955[_0xc337('0x5')];this[_0xc337('0x6')]=_0x54d955['type'];this['campaigntype']=_0x54d955[_0xc337('0x6')]==='outbound'?'queue':_0x54d955['type'];this[_0xc337('0x7')]=_0x54d955[_0xc337('0x7')];this[_0xc337('0x8')]=_0x54d955[_0xc337('0x8')];this[_0xc337('0x9')]=_0x54d955['countnoanswerretry'];this[_0xc337('0xa')]=_0x54d955[_0xc337('0x7')]+_0x54d955[_0xc337('0x8')]+_0x54d955['countnoanswerretry']+_0x54d955[_0xc337('0xb')]+_0x54d955[_0xc337('0xc')]+_0x54d955[_0xc337('0xd')]+_0x54d955[_0xc337('0xe')]+_0x54d955['countagentrejectretry'];this['countnosuchnumberretry']=_0x54d955[_0xc337('0xb')];this[_0xc337('0xc')]=_0x54d955[_0xc337('0xc')];this[_0xc337('0xd')]=_0x54d955['countabandonedretry'];this['countmachineretry']=_0x54d955[_0xc337('0xe')];this[_0xc337('0xf')]=_0x54d955[_0xc337('0xf')];this[_0xc337('0x10')]=_0x435977[_0xc337('0x10')];this[_0xc337('0x11')]=_0x54d955[_0xc337('0x12')];this['calleridnum']=_0x54d955[_0xc337('0x13')];this['starttime']=_0x54d955['starttime'];this[_0xc337('0x14')]=_0x54d955['responsetime'];this[_0xc337('0x15')]=_0x54d955[_0xc337('0x15')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc337('0x16')]=utils[_0xc337('0x17')](_0x54d955['responsetime'],_0x54d955['starttime']);this[_0xc337('0x18')]=utils['getSeconds'](_0x54d955[_0xc337('0x15')],_0x54d955[_0xc337('0x14')]);this[_0xc337('0x19')]=utils[_0xc337('0x17')](this[_0xc337('0x1a')],_0x54d955['answertime']);this[_0xc337('0x1b')]=_0x435977[_0xc337('0x1b')];this[_0xc337('0x1c')]=_0x435977[_0xc337('0x1c')];this[_0xc337('0x1d')]=_0x435977[_0xc337('0x1d')];this['callback']=_0x54d955['callback'];this[_0xc337('0x1e')]=_0x54d955[_0xc337('0x1e')];this[_0xc337('0x1f')]=_0x54d955[_0xc337('0x1f')];this[_0xc337('0x20')]=_0x54d955[_0xc337('0x20')];this[_0xc337('0x21')]=_0x54d955['ContactId'];this[_0xc337('0x22')]=_0x54d955[_0xc337('0x22')];this['UserId']=_0x54d955['UserId'];this[_0xc337('0x23')]=_0x54d955[_0xc337('0x23')];this[_0xc337('0x24')]=_0x54d955[_0xc337('0x24')];this['originatecalleridnum']=_0x54d955[_0xc337('0x25')]||'';this['originatecalleridname']=_0x54d955['originatecalleridname']||'';this[_0xc337('0x26')]=_0x54d955[_0xc337('0x26')];}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 7831d61..789dcc1 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 _0xa13d=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1a06d4,_0x7dc182){var _0x24ddbb=function(_0x489500){while(--_0x489500){_0x1a06d4['push'](_0x1a06d4['shift']());}};_0x24ddbb(++_0x7dc182);}(_0xa13d,0xb6));var _0xda13=function(_0x3f6a32,_0x3321c3){_0x3f6a32=_0x3f6a32-0x0;var _0x514588=_0xa13d[_0x3f6a32];return _0x514588;};'use strict';function Final(_0x4d2719){this[_0xda13('0x0')]=_0x4d2719[_0xda13('0x0')];this['scheduledat']=_0x4d2719[_0xda13('0x1')];this[_0xda13('0x2')]=_0x4d2719[_0xda13('0x2')];this[_0xda13('0x3')]=_0x4d2719[_0xda13('0x2')]===_0xda13('0x4')?_0xda13('0x5'):_0x4d2719[_0xda13('0x2')];this['countbusyretry']=_0x4d2719[_0xda13('0x6')];this['countcongestionretry']=_0x4d2719[_0xda13('0x7')];this['countnoanswerretry']=_0x4d2719[_0xda13('0x8')];this['countglobal']=_0x4d2719['countbusyretry']+_0x4d2719[_0xda13('0x7')]+_0x4d2719[_0xda13('0x8')]+_0x4d2719[_0xda13('0x9')]+_0x4d2719[_0xda13('0xa')]+_0x4d2719[_0xda13('0xb')]+_0x4d2719[_0xda13('0xc')]+_0x4d2719[_0xda13('0xd')];this[_0xda13('0x9')]=_0x4d2719[_0xda13('0x9')];this[_0xda13('0xa')]=_0x4d2719[_0xda13('0xa')];this[_0xda13('0xb')]=_0x4d2719[_0xda13('0xb')];this[_0xda13('0xc')]=_0x4d2719[_0xda13('0xc')];this['countagentrejectretry']=_0x4d2719[_0xda13('0xd')];this[_0xda13('0x5')]=_0x4d2719['queue'];this[_0xda13('0xe')]=_0x4d2719[_0xda13('0xe')];this[_0xda13('0xf')]=_0x4d2719[_0xda13('0xf')];this[_0xda13('0x10')]=_0x4d2719[_0xda13('0x10')];this[_0xda13('0x11')]=_0x4d2719['responsetime'];this[_0xda13('0x12')]=_0x4d2719['responsetime'];this[_0xda13('0x13')]=_0x4d2719['ringtime']||0x0;this[_0xda13('0x14')]=_0x4d2719[_0xda13('0x14')]||0x0;this[_0xda13('0x15')]=_0x4d2719['talktime']||0x0;this[_0xda13('0x16')]=_0x4d2719[_0xda13('0x16')];this[_0xda13('0x17')]=_0x4d2719[_0xda13('0x17')];this[_0xda13('0x18')]=_0x4d2719[_0xda13('0x18')];this[_0xda13('0x19')]=_0x4d2719[_0xda13('0x19')];this[_0xda13('0x1a')]=_0x4d2719['ContactId'];this[_0xda13('0x1b')]=_0x4d2719[_0xda13('0x1b')];this[_0xda13('0x1c')]=_0x4d2719[_0xda13('0x1c')];this['VoiceQueueId']=_0x4d2719[_0xda13('0x1d')];this['CampaignId']=_0x4d2719[_0xda13('0x1e')];this[_0xda13('0x1f')]=_0x4d2719[_0xda13('0x1f')]||'';this[_0xda13('0x20')]=_0x4d2719[_0xda13('0x20')]||'';this['state']=_0x4d2719[_0xda13('0x21')];this[_0xda13('0x22')]=_0x4d2719[_0xda13('0x22')];}module['exports']=Final; \ No newline at end of file +var _0x23ff=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x38d1cd,_0x20e481){var _0x3ba029=function(_0x1fe528){while(--_0x1fe528){_0x38d1cd['push'](_0x38d1cd['shift']());}};_0x3ba029(++_0x20e481);}(_0x23ff,0x155));var _0xf23f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x23ff[_0x20a584];return _0x4b41a8;};'use strict';function Final(_0x91a2b){this[_0xf23f('0x0')]=_0x91a2b[_0xf23f('0x0')];this[_0xf23f('0x1')]=_0x91a2b[_0xf23f('0x1')];this[_0xf23f('0x2')]=_0x91a2b['type'];this[_0xf23f('0x3')]=_0x91a2b[_0xf23f('0x2')]===_0xf23f('0x4')?_0xf23f('0x5'):_0x91a2b[_0xf23f('0x2')];this[_0xf23f('0x6')]=_0x91a2b[_0xf23f('0x6')];this[_0xf23f('0x7')]=_0x91a2b[_0xf23f('0x7')];this[_0xf23f('0x8')]=_0x91a2b[_0xf23f('0x8')];this[_0xf23f('0x9')]=_0x91a2b[_0xf23f('0x6')]+_0x91a2b[_0xf23f('0x7')]+_0x91a2b[_0xf23f('0x8')]+_0x91a2b['countnosuchnumberretry']+_0x91a2b[_0xf23f('0xa')]+_0x91a2b[_0xf23f('0xb')]+_0x91a2b[_0xf23f('0xc')]+_0x91a2b[_0xf23f('0xd')];this[_0xf23f('0xe')]=_0x91a2b['countnosuchnumberretry'];this[_0xf23f('0xa')]=_0x91a2b[_0xf23f('0xa')];this[_0xf23f('0xb')]=_0x91a2b[_0xf23f('0xb')];this['countmachineretry']=_0x91a2b['countmachineretry'];this['countagentrejectretry']=_0x91a2b[_0xf23f('0xd')];this['queue']=_0x91a2b[_0xf23f('0x5')];this[_0xf23f('0xf')]=_0x91a2b[_0xf23f('0xf')];this['calleridnum']=_0x91a2b[_0xf23f('0x10')];this['starttime']=_0x91a2b[_0xf23f('0x11')];this['responsetime']=_0x91a2b[_0xf23f('0x12')];this[_0xf23f('0x13')]=_0x91a2b[_0xf23f('0x12')];this[_0xf23f('0x14')]=_0x91a2b['ringtime']||0x0;this[_0xf23f('0x15')]=_0x91a2b[_0xf23f('0x15')]||0x0;this[_0xf23f('0x16')]=_0x91a2b[_0xf23f('0x16')]||0x0;this['callback']=_0x91a2b[_0xf23f('0x17')];this[_0xf23f('0x18')]=_0x91a2b[_0xf23f('0x18')];this['callbackat']=_0x91a2b['callbackat'];this[_0xf23f('0x19')]=_0x91a2b[_0xf23f('0x19')];this[_0xf23f('0x1a')]=_0x91a2b[_0xf23f('0x1a')];this[_0xf23f('0x1b')]=_0x91a2b[_0xf23f('0x1b')];this['UserId']=_0x91a2b[_0xf23f('0x1c')];this[_0xf23f('0x1d')]=_0x91a2b[_0xf23f('0x1d')];this[_0xf23f('0x1e')]=_0x91a2b['CampaignId'];this['originatecalleridnum']=_0x91a2b[_0xf23f('0x1f')]||'';this[_0xf23f('0x20')]=_0x91a2b['originatecalleridname']||'';this[_0xf23f('0x21')]=_0x91a2b[_0xf23f('0x21')];this[_0xf23f('0x22')]=_0x91a2b[_0xf23f('0x22')];}module[_0xf23f('0x23')]=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 c170103..350d2bd 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 _0x3d92=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','type','campaigntype','outbound','queue'];(function(_0x476bcd,_0x2f6582){var _0x47b60f=function(_0x406a6e){while(--_0x406a6e){_0x476bcd['push'](_0x476bcd['shift']());}};_0x47b60f(++_0x2f6582);}(_0x3d92,0x117));var _0x23d9=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x3d92[_0x58ae8a];return _0x2f0b6b;};'use strict';var moment=require(_0x23d9('0x0'));var utils=require(_0x23d9('0x1'));function Hangup(_0x33cf25,_0x9b8cba){this[_0x23d9('0x2')]=0x4;this[_0x23d9('0x3')]='Answer';this['scheduledat']=_0x33cf25['scheduledat'];this[_0x23d9('0x4')]=_0x33cf25[_0x23d9('0x4')];this[_0x23d9('0x5')]=_0x33cf25['type']===_0x23d9('0x6')?_0x23d9('0x7'):_0x33cf25[_0x23d9('0x4')];this[_0x23d9('0x8')]=_0x33cf25[_0x23d9('0x8')]||![];this[_0x23d9('0x9')]=_0x33cf25['countbusyretry'];this[_0x23d9('0xa')]=_0x33cf25[_0x23d9('0xa')];this[_0x23d9('0xb')]=_0x33cf25[_0x23d9('0xb')];this[_0x23d9('0xc')]=_0x33cf25['countbusyretry']+_0x33cf25[_0x23d9('0xa')]+_0x33cf25[_0x23d9('0xb')]+_0x33cf25[_0x23d9('0xd')]+_0x33cf25[_0x23d9('0xe')]+_0x33cf25[_0x23d9('0xf')]+_0x33cf25[_0x23d9('0x10')]+_0x33cf25[_0x23d9('0x11')];this[_0x23d9('0xd')]=_0x33cf25[_0x23d9('0xd')];this['countdropretry']=_0x33cf25['countdropretry'];this[_0x23d9('0xf')]=_0x33cf25[_0x23d9('0xf')];this[_0x23d9('0x10')]=_0x33cf25['countmachineretry'];this[_0x23d9('0x11')]=_0x33cf25[_0x23d9('0x11')];this['uniqueid']=_0x9b8cba[_0x23d9('0x12')];this[_0x23d9('0x13')]=_0x33cf25['name'];this[_0x23d9('0x14')]=_0x33cf25[_0x23d9('0x15')];this[_0x23d9('0x16')]=_0x33cf25['starttime'];this[_0x23d9('0x17')]=_0x33cf25['responsetime'];this[_0x23d9('0x18')]=moment()[_0x23d9('0x19')](_0x23d9('0x1a'));this['ringtime']=utils[_0x23d9('0x1b')](_0x33cf25['responsetime'],_0x33cf25['starttime']);this[_0x23d9('0x1c')]=0x0;this[_0x23d9('0x1d')]=utils['getSeconds'](this[_0x23d9('0x18')],_0x33cf25['responsetime']);this[_0x23d9('0x7')]=_0x33cf25[_0x23d9('0x7')];this[_0x23d9('0x1e')]=_0x23d9('0x1f');this['reason']=_0x9b8cba[_0x23d9('0x20')];this['callback']=_0x33cf25[_0x23d9('0x21')];this[_0x23d9('0x22')]=_0x33cf25['callbackuniqueid'];this[_0x23d9('0x23')]=_0x33cf25[_0x23d9('0x23')];this[_0x23d9('0x24')]=_0x33cf25[_0x23d9('0x24')];this['ContactId']=_0x33cf25['ContactId'];this[_0x23d9('0x25')]=_0x33cf25[_0x23d9('0x25')];this['UserId']=_0x33cf25['UserId'];this['VoiceQueueId']=_0x33cf25[_0x23d9('0x26')];this[_0x23d9('0x27')]=_0x33cf25[_0x23d9('0x27')];}module[_0x23d9('0x28')]=Hangup; \ No newline at end of file +var _0x8103=['type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat'];(function(_0x8a94c5,_0x566b28){var _0x13d4c3=function(_0x30ea68){while(--_0x30ea68){_0x8a94c5['push'](_0x8a94c5['shift']());}};_0x13d4c3(++_0x566b28);}(_0x8103,0x120));var _0x3810=function(_0x120dda,_0x3acc8c){_0x120dda=_0x120dda-0x0;var _0x34d2c8=_0x8103[_0x120dda];return _0x34d2c8;};'use strict';var moment=require(_0x3810('0x0'));var utils=require(_0x3810('0x1'));function Hangup(_0xd4cac,_0xbcef87){this[_0x3810('0x2')]=0x4;this[_0x3810('0x3')]=_0x3810('0x4');this[_0x3810('0x5')]=_0xd4cac[_0x3810('0x5')];this[_0x3810('0x6')]=_0xd4cac['type'];this[_0x3810('0x7')]=_0xd4cac[_0x3810('0x6')]===_0x3810('0x8')?_0x3810('0x9'):_0xd4cac[_0x3810('0x6')];this[_0x3810('0xa')]=_0xd4cac[_0x3810('0xa')]||![];this[_0x3810('0xb')]=_0xd4cac['countbusyretry'];this[_0x3810('0xc')]=_0xd4cac[_0x3810('0xc')];this[_0x3810('0xd')]=_0xd4cac[_0x3810('0xd')];this['countglobal']=_0xd4cac[_0x3810('0xb')]+_0xd4cac[_0x3810('0xc')]+_0xd4cac[_0x3810('0xd')]+_0xd4cac[_0x3810('0xe')]+_0xd4cac[_0x3810('0xf')]+_0xd4cac[_0x3810('0x10')]+_0xd4cac[_0x3810('0x11')]+_0xd4cac[_0x3810('0x12')];this['countnosuchnumberretry']=_0xd4cac[_0x3810('0xe')];this['countdropretry']=_0xd4cac[_0x3810('0xf')];this[_0x3810('0x10')]=_0xd4cac[_0x3810('0x10')];this[_0x3810('0x11')]=_0xd4cac['countmachineretry'];this['countagentrejectretry']=_0xd4cac['countagentrejectretry'];this['uniqueid']=_0xbcef87[_0x3810('0x13')];this['calleridname']=_0xd4cac['name'];this[_0x3810('0x14')]=_0xd4cac[_0x3810('0x15')];this[_0x3810('0x16')]=_0xd4cac['starttime'];this[_0x3810('0x17')]=_0xd4cac['responsetime'];this[_0x3810('0x18')]=moment()[_0x3810('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3810('0x1a')]=utils[_0x3810('0x1b')](_0xd4cac['responsetime'],_0xd4cac[_0x3810('0x16')]);this[_0x3810('0x1c')]=0x0;this[_0x3810('0x1d')]=utils[_0x3810('0x1b')](this['endtime'],_0xd4cac[_0x3810('0x17')]);this[_0x3810('0x9')]=_0xd4cac[_0x3810('0x9')];this[_0x3810('0x1e')]='IVR';this[_0x3810('0x1f')]=_0xbcef87['cause-txt'];this['callback']=_0xd4cac[_0x3810('0x20')];this['callbackuniqueid']=_0xd4cac[_0x3810('0x21')];this[_0x3810('0x22')]=_0xd4cac[_0x3810('0x22')];this['recallme']=_0xd4cac[_0x3810('0x23')];this[_0x3810('0x24')]=_0xd4cac[_0x3810('0x24')];this[_0x3810('0x25')]=_0xd4cac[_0x3810('0x25')];this[_0x3810('0x26')]=_0xd4cac[_0x3810('0x26')];this[_0x3810('0x27')]=_0xd4cac['VoiceQueueId'];this[_0x3810('0x28')]=_0xd4cac['CampaignId'];}module[_0x3810('0x29')]=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 557d709..57d9bd8 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 _0x7b98=['scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid'];(function(_0x2919e2,_0x2eeea2){var _0x459272=function(_0x21d78c){while(--_0x21d78c){_0x2919e2['push'](_0x2919e2['shift']());}};_0x459272(++_0x2eeea2);}(_0x7b98,0x154));var _0x87b9=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x7b98[_0x58999b];return _0x5efc3a;};'use strict';var utils=require(_0x87b9('0x0'));function History(_0x35dfcb){this['uniqueid']=_0x35dfcb[_0x87b9('0x1')];this['scheduledat']=_0x35dfcb[_0x87b9('0x2')]||undefined;this['type']=_0x35dfcb[_0x87b9('0x3')];this[_0x87b9('0x4')]=_0x35dfcb[_0x87b9('0x3')]===_0x87b9('0x5')?'queue':_0x35dfcb[_0x87b9('0x3')];this[_0x87b9('0x6')]=_0x35dfcb[_0x87b9('0x6')];this[_0x87b9('0x7')]=_0x35dfcb[_0x87b9('0x7')];this[_0x87b9('0x8')]=_0x35dfcb[_0x87b9('0x8')];this['countglobal']=_0x35dfcb[_0x87b9('0x6')]+_0x35dfcb[_0x87b9('0x7')]+_0x35dfcb[_0x87b9('0x8')]+_0x35dfcb[_0x87b9('0x9')]+_0x35dfcb[_0x87b9('0xa')]+_0x35dfcb[_0x87b9('0xb')]+_0x35dfcb[_0x87b9('0xc')]+_0x35dfcb[_0x87b9('0xd')];this[_0x87b9('0x9')]=_0x35dfcb['countnosuchnumberretry'];this['countdropretry']=_0x35dfcb['countdropretry'];this['countabandonedretry']=_0x35dfcb[_0x87b9('0xb')];this['countmachineretry']=_0x35dfcb['countmachineretry'];this['countagentrejectretry']=_0x35dfcb[_0x87b9('0xd')];this[_0x87b9('0xe')]=_0x35dfcb['queue'];this['calleridname']=_0x35dfcb[_0x87b9('0xf')];this[_0x87b9('0x10')]=_0x35dfcb[_0x87b9('0x11')];this['starttime']=_0x35dfcb[_0x87b9('0x12')];this[_0x87b9('0x13')]=_0x35dfcb[_0x87b9('0x13')];this[_0x87b9('0x14')]=_0x35dfcb[_0x87b9('0x13')];this['ringtime']=utils[_0x87b9('0x15')](_0x35dfcb[_0x87b9('0x13')],_0x35dfcb[_0x87b9('0x12')]);this[_0x87b9('0x16')]=0x0;this[_0x87b9('0x17')]=0x0;this['callback']=_0x35dfcb[_0x87b9('0x18')];this[_0x87b9('0x19')]=_0x35dfcb['callbackuniqueid'];this['callbackat']=_0x35dfcb[_0x87b9('0x1a')];this[_0x87b9('0x1b')]=_0x35dfcb[_0x87b9('0x1b')];this[_0x87b9('0x1c')]=_0x35dfcb[_0x87b9('0x1c')];this[_0x87b9('0x1d')]=_0x35dfcb[_0x87b9('0x1d')];this[_0x87b9('0x1e')]=_0x35dfcb[_0x87b9('0x1e')];this['VoiceQueueId']=_0x35dfcb[_0x87b9('0x1f')];this['CampaignId']=_0x35dfcb[_0x87b9('0x20')];this[_0x87b9('0x21')]=_0x35dfcb[_0x87b9('0x21')]||'';this['originatecalleridname']=_0x35dfcb[_0x87b9('0x22')]||'';this[_0x87b9('0x23')]=_0x35dfcb['state'];this[_0x87b9('0x24')]=_0x35dfcb[_0x87b9('0x24')];}module[_0x87b9('0x25')]=History; \ No newline at end of file +var _0x535f=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1fdd84,_0x3de96a){var _0x3d4d6b=function(_0x406c98){while(--_0x406c98){_0x1fdd84['push'](_0x1fdd84['shift']());}};_0x3d4d6b(++_0x3de96a);}(_0x535f,0xc4));var _0xf535=function(_0x559b54,_0x342f17){_0x559b54=_0x559b54-0x0;var _0x24dbf7=_0x535f[_0x559b54];return _0x24dbf7;};'use strict';var utils=require(_0xf535('0x0'));function History(_0x4a3668){this[_0xf535('0x1')]=_0x4a3668[_0xf535('0x1')];this[_0xf535('0x2')]=_0x4a3668[_0xf535('0x2')]||undefined;this[_0xf535('0x3')]=_0x4a3668[_0xf535('0x3')];this['campaigntype']=_0x4a3668[_0xf535('0x3')]==='outbound'?_0xf535('0x4'):_0x4a3668['type'];this[_0xf535('0x5')]=_0x4a3668[_0xf535('0x5')];this['countcongestionretry']=_0x4a3668['countcongestionretry'];this[_0xf535('0x6')]=_0x4a3668[_0xf535('0x6')];this[_0xf535('0x7')]=_0x4a3668[_0xf535('0x5')]+_0x4a3668[_0xf535('0x8')]+_0x4a3668[_0xf535('0x6')]+_0x4a3668[_0xf535('0x9')]+_0x4a3668['countdropretry']+_0x4a3668[_0xf535('0xa')]+_0x4a3668[_0xf535('0xb')]+_0x4a3668[_0xf535('0xc')];this[_0xf535('0x9')]=_0x4a3668[_0xf535('0x9')];this[_0xf535('0xd')]=_0x4a3668[_0xf535('0xd')];this[_0xf535('0xa')]=_0x4a3668['countabandonedretry'];this[_0xf535('0xb')]=_0x4a3668[_0xf535('0xb')];this['countagentrejectretry']=_0x4a3668[_0xf535('0xc')];this[_0xf535('0x4')]=_0x4a3668[_0xf535('0x4')];this[_0xf535('0xe')]=_0x4a3668[_0xf535('0xf')];this[_0xf535('0x10')]=_0x4a3668[_0xf535('0x11')];this[_0xf535('0x12')]=_0x4a3668['starttime'];this[_0xf535('0x13')]=_0x4a3668[_0xf535('0x13')];this[_0xf535('0x14')]=_0x4a3668['responsetime'];this[_0xf535('0x15')]=utils[_0xf535('0x16')](_0x4a3668[_0xf535('0x13')],_0x4a3668[_0xf535('0x12')]);this[_0xf535('0x17')]=0x0;this['talktime']=0x0;this[_0xf535('0x18')]=_0x4a3668[_0xf535('0x18')];this[_0xf535('0x19')]=_0x4a3668[_0xf535('0x19')];this[_0xf535('0x1a')]=_0x4a3668[_0xf535('0x1a')];this[_0xf535('0x1b')]=_0x4a3668[_0xf535('0x1b')];this[_0xf535('0x1c')]=_0x4a3668[_0xf535('0x1c')];this[_0xf535('0x1d')]=_0x4a3668[_0xf535('0x1d')];this[_0xf535('0x1e')]=_0x4a3668[_0xf535('0x1e')];this[_0xf535('0x1f')]=_0x4a3668[_0xf535('0x1f')];this['CampaignId']=_0x4a3668[_0xf535('0x20')];this[_0xf535('0x21')]=_0x4a3668[_0xf535('0x21')]||'';this[_0xf535('0x22')]=_0x4a3668[_0xf535('0x22')]||'';this[_0xf535('0x23')]=_0x4a3668[_0xf535('0x23')];this['statedesc']=_0x4a3668[_0xf535('0x24')];}module[_0xf535('0x25')]=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 b613837..1698faf 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 _0xf7d2=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','starttime','responsetime','dropreason','droptime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x79e13f,_0x1acca2){var _0x456d26=function(_0xfee51f){while(--_0xfee51f){_0x79e13f['push'](_0x79e13f['shift']());}};_0x456d26(++_0x1acca2);}(_0xf7d2,0x149));var _0x2f7d=function(_0x3439ea,_0x3c68ba){_0x3439ea=_0x3439ea-0x0;var _0x3900a3=_0xf7d2[_0x3439ea];return _0x3900a3;};'use strict';var utils=require(_0x2f7d('0x0'));function QueueCallerAbandon(_0x643d1,_0x2de744){this['scheduledat']=_0x643d1[_0x2f7d('0x1')];this[_0x2f7d('0x2')]=_0x643d1['type'];this['campaigntype']=_0x643d1['type']===_0x2f7d('0x3')?_0x2f7d('0x4'):_0x643d1[_0x2f7d('0x2')];this[_0x2f7d('0x5')]=_0x643d1['countbusyretry'];this[_0x2f7d('0x6')]=_0x643d1[_0x2f7d('0x6')];this[_0x2f7d('0x7')]=_0x643d1[_0x2f7d('0x7')];this[_0x2f7d('0x8')]=_0x643d1['countbusyretry']+_0x643d1['countcongestionretry']+_0x643d1[_0x2f7d('0x7')]+_0x643d1[_0x2f7d('0x9')]+_0x643d1[_0x2f7d('0xa')]+_0x643d1['countabandonedretry']+_0x643d1[_0x2f7d('0xb')]+_0x643d1[_0x2f7d('0xc')];this[_0x2f7d('0x9')]=_0x643d1[_0x2f7d('0x9')];this[_0x2f7d('0xa')]=_0x643d1['countdropretry'];this['countabandonedretry']=_0x643d1[_0x2f7d('0xd')];this[_0x2f7d('0xb')]=_0x643d1[_0x2f7d('0xb')];this['countagentrejectretry']=_0x643d1['countagentrejectretry'];this[_0x2f7d('0xe')]=_0x2de744[_0x2f7d('0xe')];this[_0x2f7d('0xf')]=_0x643d1['name'];this[_0x2f7d('0x10')]=_0x643d1['number'];this[_0x2f7d('0x11')]=_0x643d1[_0x2f7d('0x11')];this[_0x2f7d('0x12')]=_0x643d1[_0x2f7d('0x12')];this['droptime']=_0x643d1['droptime'];this[_0x2f7d('0x13')]=_0x643d1[_0x2f7d('0x13')];this['endtime']=this[_0x2f7d('0x14')];this['ringtime']=utils[_0x2f7d('0x15')](_0x643d1['responsetime'],_0x643d1['starttime']);this['holdtime']=utils[_0x2f7d('0x15')](this[_0x2f7d('0x14')],_0x643d1['responsetime']);this[_0x2f7d('0x16')]=0x0;this[_0x2f7d('0x4')]=_0x2de744[_0x2f7d('0x4')];this[_0x2f7d('0x17')]=_0x2de744[_0x2f7d('0x18')];this[_0x2f7d('0x19')]=_0x2de744[_0x2f7d('0x19')];this[_0x2f7d('0x1a')]=_0x643d1[_0x2f7d('0x1a')];this['callbackuniqueid']=_0x643d1[_0x2f7d('0x1b')];this[_0x2f7d('0x1c')]=_0x643d1[_0x2f7d('0x1c')];this[_0x2f7d('0x1d')]=_0x643d1[_0x2f7d('0x1d')];this['ContactId']=_0x643d1[_0x2f7d('0x1e')];this[_0x2f7d('0x1f')]=_0x643d1[_0x2f7d('0x1f')];this[_0x2f7d('0x20')]=_0x643d1[_0x2f7d('0x20')];this[_0x2f7d('0x21')]=_0x643d1[_0x2f7d('0x21')];this['CampaignId']=_0x643d1[_0x2f7d('0x22')];this[_0x2f7d('0x23')]=_0x643d1[_0x2f7d('0x23')]||'';this[_0x2f7d('0x24')]=_0x643d1['originatecalleridname']||'';this[_0x2f7d('0x25')]=_0x643d1[_0x2f7d('0x25')];this['state']=_0x643d1['state'];this['statedesc']=_0x643d1[_0x2f7d('0x26')];}module[_0x2f7d('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xa825=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','exports','../utils','scheduledat','type','outbound'];(function(_0xee8313,_0xc67ac8){var _0x594fd3=function(_0x5b6c88){while(--_0x5b6c88){_0xee8313['push'](_0xee8313['shift']());}};_0x594fd3(++_0xc67ac8);}(_0xa825,0x196));var _0x5a82=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa825[_0x397e5f];return _0x5302b8;};'use strict';var utils=require(_0x5a82('0x0'));function QueueCallerAbandon(_0x2593a3,_0x2a8c8c){this[_0x5a82('0x1')]=_0x2593a3[_0x5a82('0x1')];this[_0x5a82('0x2')]=_0x2593a3[_0x5a82('0x2')];this['campaigntype']=_0x2593a3[_0x5a82('0x2')]===_0x5a82('0x3')?'queue':_0x2593a3['type'];this[_0x5a82('0x4')]=_0x2593a3[_0x5a82('0x4')];this[_0x5a82('0x5')]=_0x2593a3[_0x5a82('0x5')];this[_0x5a82('0x6')]=_0x2593a3[_0x5a82('0x6')];this[_0x5a82('0x7')]=_0x2593a3[_0x5a82('0x4')]+_0x2593a3['countcongestionretry']+_0x2593a3[_0x5a82('0x6')]+_0x2593a3[_0x5a82('0x8')]+_0x2593a3['countdropretry']+_0x2593a3[_0x5a82('0x9')]+_0x2593a3[_0x5a82('0xa')]+_0x2593a3['countagentrejectretry'];this[_0x5a82('0x8')]=_0x2593a3['countnosuchnumberretry'];this[_0x5a82('0xb')]=_0x2593a3[_0x5a82('0xb')];this['countabandonedretry']=_0x2593a3[_0x5a82('0x9')];this[_0x5a82('0xa')]=_0x2593a3['countmachineretry'];this[_0x5a82('0xc')]=_0x2593a3[_0x5a82('0xc')];this[_0x5a82('0xd')]=_0x2a8c8c[_0x5a82('0xd')];this[_0x5a82('0xe')]=_0x2593a3['name'];this[_0x5a82('0xf')]=_0x2593a3[_0x5a82('0x10')];this['starttime']=_0x2593a3[_0x5a82('0x11')];this['responsetime']=_0x2593a3[_0x5a82('0x12')];this[_0x5a82('0x13')]=_0x2593a3[_0x5a82('0x13')];this[_0x5a82('0x14')]=_0x2593a3[_0x5a82('0x14')];this['endtime']=this[_0x5a82('0x13')];this[_0x5a82('0x15')]=utils[_0x5a82('0x16')](_0x2593a3[_0x5a82('0x12')],_0x2593a3[_0x5a82('0x11')]);this['holdtime']=utils[_0x5a82('0x16')](this['droptime'],_0x2593a3[_0x5a82('0x12')]);this[_0x5a82('0x17')]=0x0;this[_0x5a82('0x18')]=_0x2a8c8c[_0x5a82('0x18')];this['membername']=_0x2a8c8c[_0x5a82('0x19')];this[_0x5a82('0x1a')]=_0x2a8c8c['reason'];this[_0x5a82('0x1b')]=_0x2593a3[_0x5a82('0x1b')];this[_0x5a82('0x1c')]=_0x2593a3[_0x5a82('0x1c')];this['callbackat']=_0x2593a3[_0x5a82('0x1d')];this[_0x5a82('0x1e')]=_0x2593a3['recallme'];this['ContactId']=_0x2593a3[_0x5a82('0x1f')];this[_0x5a82('0x20')]=_0x2593a3[_0x5a82('0x20')];this['UserId']=_0x2593a3[_0x5a82('0x21')];this[_0x5a82('0x22')]=_0x2593a3[_0x5a82('0x22')];this[_0x5a82('0x23')]=_0x2593a3[_0x5a82('0x23')];this[_0x5a82('0x24')]=_0x2593a3['originatecalleridnum']||'';this['originatecalleridname']=_0x2593a3[_0x5a82('0x25')]||'';this[_0x5a82('0x26')]=_0x2593a3[_0x5a82('0x26')];this[_0x5a82('0x27')]=_0x2593a3[_0x5a82('0x27')];this['statedesc']=_0x2593a3['statedesc'];}module[_0x5a82('0x28')]=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 f2a9958..40fe5fc 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 _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x26713c,_0x3e8fd2){var _0x141352=function(_0x4a21ac){while(--_0x4a21ac){_0x26713c['push'](_0x26713c['shift']());}};_0x141352(++_0x3e8fd2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0x0424=['../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialerIvr]','getContactDialerIvr','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone'];(function(_0x83f244,_0x28e10b){var _0x560a39=function(_0x18a3f4){while(--_0x18a3f4){_0x83f244['push'](_0x83f244['shift']());}};_0x560a39(++_0x28e10b);}(_0x0424,0x159));var _0x4042=function(_0x3a66fa,_0x399904){_0x3a66fa=_0x3a66fa-0x0;var _0x388cf9=_0x0424[_0x3a66fa];return _0x388cf9;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x4042('0x0'));var cmHopper=require(_0x4042('0x1'));var cmHopperAdditionalPhone=require(_0x4042('0x2'));var cmHopperBlack=require(_0x4042('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x3cd879){return util['inspect'](_0x3cd879,{'showHidden':![],'depth':null});}function getContactDialer(_0x491eae,_0x20d8df,_0x24fdfd){return cmHopper[_0x4042('0x4')](_0x491eae['id'],_0x20d8df,_0x24fdfd,_0x491eae[_0x4042('0x5')])[_0x4042('0x6')](function(_0xa5310f){_0x491eae[_0x4042('0x7')]=0x0;logger['error']('[getContactDialer]',inspectError(_0xa5310f));});}exports[_0x4042('0x4')]=getContactDialer;function getContactDialerIvr(_0x117143,_0x103e4a){return cmHopper['getContactDialerIvr'](_0x117143['id'],_0x103e4a,_0x117143[_0x4042('0x5')])[_0x4042('0x6')](function(_0x2376a4){_0x117143[_0x4042('0x7')]=0x0;logger[_0x4042('0x8')](_0x4042('0x9'),inspectError(_0x2376a4));});}exports[_0x4042('0xa')]=getContactDialerIvr;function countReScheduled(_0x3b5a73){return cmHopper['countReScheduled'](_0x3b5a73)[_0x4042('0x6')](function(_0x357838){logger['error'](_0x4042('0xb'),inspectError(_0x357838));});}exports[_0x4042('0xc')]=countReScheduled;function rescheduleContact(_0x3e876b){return cmHopper[_0x4042('0xd')](_0x3e876b)[_0x4042('0x6')](function(_0x1ff3ca){logger[_0x4042('0x8')]('[rescheduleContact]',inspectError(_0x1ff3ca));});}exports[_0x4042('0xd')]=rescheduleContact;function unlockContact(_0x291e5c,_0x50206f,_0x28087d){return cmHopper[_0x4042('0xe')](_0x291e5c,_0x50206f,_0x28087d)[_0x4042('0x6')](function(_0x1c3328){logger[_0x4042('0x8')](_0x4042('0xf'),inspectError(_0x1c3328));});}exports[_0x4042('0xe')]=unlockContact;function moveContactManagedDialer(_0x10cb93){return cmHopper[_0x4042('0x10')](_0x10cb93)['catch'](function(_0xe5c1ec){logger['error'](_0x4042('0x11'),inspectError(_0xe5c1ec));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xca9ca6){return cmHopperBlack[_0x4042('0x12')](_0xca9ca6)[_0x4042('0x6')](function(_0x2cd5ca){logger['error'](_0x4042('0x13'),inspectError(_0x2cd5ca));});}exports[_0x4042('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x14d36c){return cmHopperBlack[_0x4042('0x14')](_0x14d36c)['catch'](function(_0x42b518){logger[_0x4042('0x8')](_0x4042('0x15'),inspectError(_0x42b518));});}exports[_0x4042('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x352631,_0x548093,_0x1f9d4a){return cmHopperAdditionalPhone[_0x4042('0x16')](_0x352631,_0x548093,_0x1f9d4a)['catch'](function(_0x1daee8){logger['error'](_0x4042('0x17'),inspectError(_0x1daee8));});}exports[_0x4042('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3f5a64,_0x5d5c6d,_0x461c5e){return cmHopperAdditionalPhone[_0x4042('0x18')](_0x3f5a64,_0x5d5c6d,_0x461c5e)[_0x4042('0x6')](function(_0xbdadc8){logger[_0x4042('0x8')]('[swapAdditionalPhone]',inspectError(_0xbdadc8));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1d8d48){return cmHopperHistory[_0x4042('0x19')](_0x1d8d48)[_0x4042('0x6')](function(_0x3e5c02){logger[_0x4042('0x8')](_0x4042('0x1a'),inspectError(_0x3e5c02));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x33733b){return cmHopperHistory[_0x4042('0x1b')](_0x33733b)['catch'](function(_0xae26c2){logger[_0x4042('0x8')](_0x4042('0x1c'),inspectError(_0xae26c2));});}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 6cd6282..d1072ab 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 _0xefe4=['format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0xefe4,0x199));var _0x4efe=function(_0x228340,_0x1ac61c){_0x228340=_0x228340-0x0;var _0x59ba3e=_0xefe4[_0x228340];return _0x59ba3e;};'use strict';var _=require(_0x4efe('0x0'));var moment=require(_0x4efe('0x1'));var util=require(_0x4efe('0x2'));var logger=require(_0x4efe('0x3'))('dialer');var timezones=require(_0x4efe('0x4'))[_0x4efe('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x4efe('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x4efe('0x7'),'EMPTY_INTERVAL':_0x4efe('0x8'),'INACTIVE':_0x4efe('0x9'),'NO_AGENTS_LOGGED':_0x4efe('0xa'),'NO_AVAILABLE_CONTACTS':_0x4efe('0xb'),'NULL_INTERVAL':_0x4efe('0xc'),'OVERTIME_INTERVAL':_0x4efe('0xd'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x4efe('0xe'),'RECALL_TIMEOUT':_0x4efe('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x4efe('0x10'),'UNREACHABLE_TRUNK':_0x4efe('0x11')};exports[_0x4efe('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2f5949){return _0x2f5949[_0x4efe('0x13')]===_0x4efe('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x110bff){return _0x110bff[_0x4efe('0x15')]===_0x4efe('0x16');}exports[_0x4efe('0x17')]=isIVRCampaign;function isOutboundQueue(_0x5eda79){return _0x5eda79[_0x4efe('0x15')]===_0x4efe('0x18');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x5a08f8){return _0x5a08f8[_0x4efe('0x19')];}exports[_0x4efe('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0xc32623){return _0xc32623[_0x4efe('0x1b')];}exports[_0x4efe('0x1c')]=isIVRCampaignActive;function getSeconds(_0x1dba96,_0x58227d){var _0x5ec1fc=moment(_0x1dba96)[_0x4efe('0x1d')](0x0);var _0x367c8e=moment(_0x58227d)[_0x4efe('0x1d')](0x0);return _0x5ec1fc[_0x4efe('0x1e')](_0x367c8e,_0x4efe('0x1f'));}exports[_0x4efe('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x167a6e,_0x510f3a){var _0x200d65=![];var _0x21cfcb=_0x167a6e['dialMethod']!==_0x510f3a[_0x4efe('0x13')]||_0x167a6e['dialActive']!==_0x510f3a['dialActive']||_0x167a6e[_0x4efe('0x21')]!==_0x510f3a[_0x4efe('0x21')];var _0xfb39e=_0x167a6e['available']!==_0x510f3a['available']||_0x167a6e[_0x4efe('0x22')]!==_0x510f3a[_0x4efe('0x22')]||_0x167a6e['loggedInDb']!==_0x510f3a[_0x4efe('0x23')]||_0x167a6e[_0x4efe('0x24')]!==_0x510f3a[_0x4efe('0x24')]||_0x167a6e[_0x4efe('0x25')]!==_0x510f3a[_0x4efe('0x25')]||_0x167a6e[_0x4efe('0x26')]!==_0x510f3a[_0x4efe('0x26')]||_0x167a6e[_0x4efe('0x27')]!==_0x510f3a[_0x4efe('0x27')]||_0x167a6e[_0x4efe('0x28')]!==_0x510f3a[_0x4efe('0x28')]||_0x167a6e[_0x4efe('0x29')]!==_0x510f3a['originated'];if(_0x167a6e[_0x4efe('0x2a')]&&_0x510f3a[_0x4efe('0x2a')]){_0x200d65=_0x167a6e[_0x4efe('0x2a')][_0x4efe('0x2b')]!==_0x510f3a['Trunk']['name']||_0x167a6e['Trunk'][_0x4efe('0x1b')]!==_0x510f3a['Trunk'][_0x4efe('0x1b')];}return _0x21cfcb||_0xfb39e||_0x200d65;}exports[_0x4efe('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x552bff){var _0x16afc5=null;var _0x327f49=_0x552bff[_0x4efe('0x2d')];if(_['isNil'](_0x552bff[_0x4efe('0x2e')])||_[_0x4efe('0x2f')](_0x552bff[_0x4efe('0x30')])||_[_0x4efe('0x2f')](_0x552bff['Interval'][_0x4efe('0x31')])){_0x16afc5=CAMPAIGN_STATUS[_0x4efe('0x32')];}else if(_[_0x4efe('0x33')](_0x552bff[_0x4efe('0x2e')])||_[_0x4efe('0x33')](_0x552bff['Interval']['Intervals'])){_0x16afc5=CAMPAIGN_STATUS[_0x4efe('0x34')];}else if(_0x327f49&&!timezones[_0x327f49]){_0x16afc5=CAMPAIGN_STATUS[_0x4efe('0x35')];}return _0x16afc5;}function checkAnyValidTrunk(_0xa1898f,_0x839a5a){var _0x2479aa=null;var _0x286a7c=_0x4efe('0x36');var _0x7518a5=['reachable','unmonitored'];var _0x26bb0c=!![];if(_0xa1898f['Trunk']&&_0xa1898f['Trunk'][_0x4efe('0x1b')]){_0x286a7c+=_0xa1898f[_0x4efe('0x2a')][_0x4efe('0x2b')];_0x2479aa=_0x839a5a[_0x286a7c];_0x26bb0c=_0x7518a5[_0x4efe('0x37')](_0x2479aa[_0x4efe('0x38')]);}else if(_0xa1898f[_0x4efe('0x39')]&&_0xa1898f[_0x4efe('0x39')][_0x4efe('0x1b')]){_0x286a7c+=_0xa1898f[_0x4efe('0x39')][_0x4efe('0x2b')];_0x2479aa=_0x839a5a[_0x286a7c];_0x26bb0c=_0x7518a5[_0x4efe('0x37')](_0x2479aa[_0x4efe('0x38')]);}return _0x26bb0c;}function getQueueCampaignStatusMessage(_0x40b63c,_0x1112a9){var _0x51a785=CAMPAIGN_STATUS[_0x4efe('0x6')];var _0x924c1=isPreviewCampaign(_0x40b63c);if(!isQueueCampaignActive(_0x40b63c)){if(_0x924c1){_0x51a785=CAMPAIGN_STATUS[_0x4efe('0x3a')];}else{if(_0x40b63c[_0x4efe('0x29')]===0x0&&_0x40b63c['talking']===0x0&&_0x40b63c['waiting']===0x0&&(_0x40b63c[_0x4efe('0x26')]||0x0)===0x0){_0x51a785=CAMPAIGN_STATUS[_0x4efe('0x3a')];}else{_0x51a785=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x40b63c[_0x4efe('0x22')]===0x0){_0x51a785=CAMPAIGN_STATUS[_0x4efe('0x3b')];}else if(!checkAnyValidTrunk(_0x40b63c,_0x1112a9)){_0x51a785=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x40b63c)){var _0x33f0db=checkAnyValidQueueCampaignInterval(_0x40b63c);if(_0x33f0db){_0x51a785=_0x33f0db;}}return _0x51a785;}exports[_0x4efe('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2eeaf5){var _0x4e8e30=CAMPAIGN_STATUS['DISACTIVED'];if(_0x2eeaf5[_0x4efe('0x29')]===0x0&&_0x2eeaf5[_0x4efe('0x25')]===0x0&&_0x2eeaf5[_0x4efe('0x27')]===0x0&&(_0x2eeaf5[_0x4efe('0x26')]||0x0)===0x0){_0x4e8e30=CAMPAIGN_STATUS[_0x4efe('0x3a')];}return _0x4e8e30;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x579ad5){var _0x1c267b=_0x579ad5[_0x4efe('0x3d')](/"(.*?)"/);return _0x1c267b?_0x1c267b[0x1]:_0x579ad5;}exports[_0x4efe('0x3e')]=extractCalleridName;function getCallerId(_0x4ab29d,_0x559343,_0x20dec7){if(!_['isUndefined'](_0x20dec7)&&typeof _0x20dec7===_0x4efe('0x3f')&&!_[_0x4efe('0x33')](_0x20dec7)){if(!_[_0x4efe('0x40')](_0x559343)&&typeof _0x559343===_0x4efe('0x3f')&&!_[_0x4efe('0x33')](_0x559343)){return util[_0x4efe('0x41')](_0x4efe('0x42'),_0x559343,_0x20dec7);}return util['format'](_0x4efe('0x42'),_0x20dec7,_0x20dec7);}if(!_[_0x4efe('0x40')](_0x4ab29d)&&typeof _0x4ab29d==='string'&&!_[_0x4efe('0x33')](_0x4ab29d)){return _0x4ab29d;}return _0x4efe('0x43');}exports[_0x4efe('0x44')]=getCallerId;function getCallerIdRandom(_0x5d7098,_0x448ca8){var _0x377206;var _0xcae6a4;var _0x552b0a;if(_0x448ca8<=0x0){_0x448ca8=0x1;}_0x377206=new RegExp(_0x4efe('0x45')+_0x448ca8+'}$');_0xcae6a4=Math[_0x4efe('0x46')](0xa,_0x448ca8-0x1);_0x552b0a=Math['pow'](0xa,_0x448ca8)-0x1;return util[_0x4efe('0x41')]('%s',_[_0x4efe('0x47')](_0x5d7098,_0x377206,_[_0x4efe('0x48')](_0xcae6a4,_0x552b0a)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x57dd21){if(_0x57dd21[_0x4efe('0x29')]&&_0x57dd21[_0x4efe('0x29')]>0x0){_0x57dd21['originated']-=0x1;}else{logger[_0x4efe('0x49')](_0x4efe('0x4a'));}}exports[_0x4efe('0x4b')]=decrementOriginate;function checkContactEmpty(_0x30b872){return _0x30b872&&_0x30b872['length']>0x0;}exports[_0x4efe('0x4c')]=checkContactEmpty;function erlangb(_0x1e3e55,_0x11686c){if(_0x11686c===0x0){return 0x0;}var _0xc4fbdb=0x1;for(var _0x3a7c2d=0x1;_0x3a7c2d<=_0x11686c;_0x3a7c2d+=0x1){_0xc4fbdb=0x1+_0xc4fbdb*_0x3a7c2d/_0x1e3e55;}return 0x1/_0xc4fbdb;}exports[_0x4efe('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x4afa7b,_0x504588,_0x4c9147){if(_0x504588>_0x4c9147){for(var _0x463295=0x0;_0x463295<_0x504588-_0x4c9147;_0x463295+=0x1){decrementOriginate(_0x4afa7b);}}}exports[_0x4efe('0x4e')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x1ed9=['RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','name','Trunk','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','active','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME'];(function(_0x39deb2,_0x21d1df){var _0x59a84d=function(_0x1bfedb){while(--_0x1bfedb){_0x39deb2['push'](_0x39deb2['shift']());}};_0x59a84d(++_0x21d1df);}(_0x1ed9,0x1de));var _0x91ed=function(_0x55847d,_0x461e0c){_0x55847d=_0x55847d-0x0;var _0xc9c42a=_0x1ed9[_0x55847d];return _0xc9c42a;};'use strict';var _=require(_0x91ed('0x0'));var moment=require(_0x91ed('0x1'));var util=require(_0x91ed('0x2'));var logger=require(_0x91ed('0x3'))(_0x91ed('0x4'));var timezones=require('../../../../config/environment/shared')[_0x91ed('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x91ed('0x6'),'BLACKLIST':_0x91ed('0x7'),'CONTACTS_RESCHEDULED':_0x91ed('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x91ed('0x9'),'EMPTY_INTERVAL':_0x91ed('0xa'),'INACTIVE':_0x91ed('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x91ed('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x91ed('0xd'),'QUEUE_RECALL':_0x91ed('0xe'),'RECALL_TIMEOUT':_0x91ed('0xf'),'RUNNING':_0x91ed('0x10'),'UNKNOWN_TIMEZONE':_0x91ed('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x91ed('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2f7ef4){return _0x2f7ef4[_0x91ed('0x13')]==='preview';}exports[_0x91ed('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x2533b7){return _0x2533b7[_0x91ed('0x15')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x19c848){return _0x19c848['type']==='outbound';}exports[_0x91ed('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0xdc465c){return _0xdc465c[_0x91ed('0x17')];}exports[_0x91ed('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1e0856){return _0x1e0856['active'];}exports[_0x91ed('0x19')]=isIVRCampaignActive;function getSeconds(_0x1fee46,_0x382505){var _0x3151e9=moment(_0x1fee46)[_0x91ed('0x1a')](0x0);var _0x5a36ed=moment(_0x382505)[_0x91ed('0x1a')](0x0);return _0x3151e9['diff'](_0x5a36ed,_0x91ed('0x1b'));}exports[_0x91ed('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x3222a9,_0x106aa6){var _0xc1f806=![];var _0x236587=_0x3222a9[_0x91ed('0x13')]!==_0x106aa6['dialMethod']||_0x3222a9[_0x91ed('0x17')]!==_0x106aa6[_0x91ed('0x17')]||_0x3222a9[_0x91ed('0x1d')]!==_0x106aa6[_0x91ed('0x1d')];var _0xd267e0=_0x3222a9[_0x91ed('0x1e')]!==_0x106aa6[_0x91ed('0x1e')]||_0x3222a9['loggedIn']!==_0x106aa6[_0x91ed('0x1f')]||_0x3222a9[_0x91ed('0x20')]!==_0x106aa6['loggedInDb']||_0x3222a9[_0x91ed('0x21')]!==_0x106aa6[_0x91ed('0x21')]||_0x3222a9[_0x91ed('0x22')]!==_0x106aa6[_0x91ed('0x22')]||_0x3222a9[_0x91ed('0x23')]!==_0x106aa6[_0x91ed('0x23')]||_0x3222a9[_0x91ed('0x24')]!==_0x106aa6['waiting']||_0x3222a9['inUse']!==_0x106aa6[_0x91ed('0x25')]||_0x3222a9[_0x91ed('0x26')]!==_0x106aa6[_0x91ed('0x26')];if(_0x3222a9['Trunk']&&_0x106aa6['Trunk']){_0xc1f806=_0x3222a9['Trunk'][_0x91ed('0x27')]!==_0x106aa6[_0x91ed('0x28')][_0x91ed('0x27')]||_0x3222a9[_0x91ed('0x28')]['active']!==_0x106aa6['Trunk']['active'];}return _0x236587||_0xd267e0||_0xc1f806;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x19d9e6){var _0x381188=null;var _0x1b6131=_0x19d9e6['dialTimezone'];if(_[_0x91ed('0x29')](_0x19d9e6[_0x91ed('0x2a')])||_[_0x91ed('0x29')](_0x19d9e6['Interval'])||_[_0x91ed('0x29')](_0x19d9e6[_0x91ed('0x2b')][_0x91ed('0x2c')])){_0x381188=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x91ed('0x2d')](_0x19d9e6[_0x91ed('0x2a')])||_['isEmpty'](_0x19d9e6['Interval']['Intervals'])){_0x381188=CAMPAIGN_STATUS[_0x91ed('0x2e')];}else if(_0x1b6131&&!timezones[_0x1b6131]){_0x381188=CAMPAIGN_STATUS[_0x91ed('0x2f')];}return _0x381188;}function checkAnyValidTrunk(_0x1c5f34,_0x54fbdd){var _0x287d8f=null;var _0x25bc12=_0x91ed('0x30');var _0x270749=[_0x91ed('0x31'),'unmonitored'];var _0x59112b=!![];if(_0x1c5f34['Trunk']&&_0x1c5f34[_0x91ed('0x28')][_0x91ed('0x32')]){_0x25bc12+=_0x1c5f34[_0x91ed('0x28')]['name'];_0x287d8f=_0x54fbdd[_0x25bc12];_0x59112b=_0x270749[_0x91ed('0x33')](_0x287d8f[_0x91ed('0x34')]);}else if(_0x1c5f34[_0x91ed('0x35')]&&_0x1c5f34[_0x91ed('0x35')][_0x91ed('0x32')]){_0x25bc12+=_0x1c5f34['TrunkBackup']['name'];_0x287d8f=_0x54fbdd[_0x25bc12];_0x59112b=_0x270749[_0x91ed('0x33')](_0x287d8f['status']);}return _0x59112b;}function getQueueCampaignStatusMessage(_0x1747c3,_0x106af2){var _0x286b90=CAMPAIGN_STATUS['ACTIVE'];var _0x2b7565=isPreviewCampaign(_0x1747c3);if(!isQueueCampaignActive(_0x1747c3)){if(_0x2b7565){_0x286b90=CAMPAIGN_STATUS[_0x91ed('0x36')];}else{if(_0x1747c3[_0x91ed('0x26')]===0x0&&_0x1747c3[_0x91ed('0x22')]===0x0&&_0x1747c3[_0x91ed('0x24')]===0x0&&(_0x1747c3[_0x91ed('0x23')]||0x0)===0x0){_0x286b90=CAMPAIGN_STATUS[_0x91ed('0x36')];}else{_0x286b90=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x1747c3[_0x91ed('0x1f')]===0x0){_0x286b90=CAMPAIGN_STATUS[_0x91ed('0x37')];}else if(!checkAnyValidTrunk(_0x1747c3,_0x106af2)){_0x286b90=CAMPAIGN_STATUS[_0x91ed('0x38')];}else if(!isPreviewCampaign(_0x1747c3)){var _0xa3b627=checkAnyValidQueueCampaignInterval(_0x1747c3);if(_0xa3b627){_0x286b90=_0xa3b627;}}return _0x286b90;}exports[_0x91ed('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x22ea0a){var _0x3225d1=CAMPAIGN_STATUS['DISACTIVED'];if(_0x22ea0a['originated']===0x0&&_0x22ea0a[_0x91ed('0x22')]===0x0&&_0x22ea0a[_0x91ed('0x24')]===0x0&&(_0x22ea0a[_0x91ed('0x23')]||0x0)===0x0){_0x3225d1=CAMPAIGN_STATUS[_0x91ed('0x36')];}return _0x3225d1;}exports[_0x91ed('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x376f08){var _0x1c0bf4=_0x376f08['match'](/"(.*?)"/);return _0x1c0bf4?_0x1c0bf4[0x1]:_0x376f08;}exports[_0x91ed('0x3b')]=extractCalleridName;function getCallerId(_0x4c4d88,_0x101589,_0x49bf91){if(!_[_0x91ed('0x3c')](_0x49bf91)&&typeof _0x49bf91===_0x91ed('0x3d')&&!_['isEmpty'](_0x49bf91)){if(!_[_0x91ed('0x3c')](_0x101589)&&typeof _0x101589===_0x91ed('0x3d')&&!_[_0x91ed('0x2d')](_0x101589)){return util[_0x91ed('0x3e')](_0x91ed('0x3f'),_0x101589,_0x49bf91);}return util[_0x91ed('0x3e')]('\x22%s\x22\x20<%s>',_0x49bf91,_0x49bf91);}if(!_[_0x91ed('0x3c')](_0x4c4d88)&&typeof _0x4c4d88===_0x91ed('0x3d')&&!_['isEmpty'](_0x4c4d88)){return _0x4c4d88;}return'\x22\x22\x20<>';}exports[_0x91ed('0x40')]=getCallerId;function getCallerIdRandom(_0x441b8e,_0x534bdb){var _0x240700;var _0x2c987b;var _0xd56111;if(_0x534bdb<=0x0){_0x534bdb=0x1;}_0x240700=new RegExp('\x5cw{0,'+_0x534bdb+'}$');_0x2c987b=Math['pow'](0xa,_0x534bdb-0x1);_0xd56111=Math[_0x91ed('0x41')](0xa,_0x534bdb)-0x1;return util['format']('%s',_['replace'](_0x441b8e,_0x240700,_[_0x91ed('0x42')](_0x2c987b,_0xd56111)[_0x91ed('0x43')]()));}exports[_0x91ed('0x44')]=getCallerIdRandom;function decrementOriginate(_0x1c82a1){if(_0x1c82a1[_0x91ed('0x26')]&&_0x1c82a1[_0x91ed('0x26')]>0x0){_0x1c82a1[_0x91ed('0x26')]-=0x1;}else{logger[_0x91ed('0x45')](_0x91ed('0x46'));}}exports[_0x91ed('0x47')]=decrementOriginate;function checkContactEmpty(_0xf9a7dc){return _0xf9a7dc&&_0xf9a7dc['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x2224f2,_0xb691ea){if(_0xb691ea===0x0){return 0x0;}var _0x36ea29=0x1;for(var _0x5a54af=0x1;_0x5a54af<=_0xb691ea;_0x5a54af+=0x1){_0x36ea29=0x1+_0x36ea29*_0x5a54af/_0x2224f2;}return 0x1/_0x36ea29;}exports[_0x91ed('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x23d544,_0x123d13,_0x2166ba){if(_0x123d13>_0x2166ba){for(var _0x53afe2=0x0;_0x53afe2<_0x123d13-_0x2166ba;_0x53afe2+=0x1){decrementOriginate(_0x23d544);}}}exports[_0x91ed('0x49')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x225ff4){var _0x278e2c={};var _0x5652de=['id',_0x91ed('0x4a'),_0x91ed('0x4b'),_0x91ed('0x4c'),'updatedAt'];if(_0x225ff4){for(var _0x482b20 in _0x225ff4){if(typeof _0x225ff4[_0x482b20]!==_0x91ed('0x4d')){if(!_[_0x91ed('0x29')](_0x225ff4[_0x482b20])&&!_0x5652de[_0x91ed('0x33')](_0x482b20)){_0x278e2c[util[_0x91ed('0x3e')](_0x91ed('0x4e'),_0x91ed('0x4f'),_0x482b20[_0x91ed('0x50')]())]=_0x225ff4[_0x482b20];}}}}return _0x278e2c;}exports[_0x91ed('0x51')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 20a94e2..e675b25 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(_0x2bfe36,_0x5a2522){var _0x31d3e8=function(_0x3e68a1){while(--_0x3e68a1){_0x2bfe36['push'](_0x2bfe36['shift']());}};_0x31d3e8(++_0x5a2522);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x534455,_0x3b9e7c){var _0x2e1f36=function(_0x493536){while(--_0x493536){_0x534455['push'](_0x534455['shift']());}};_0x2e1f36(++_0x3b9e7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 883d847..8215bb4 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 _0x09ab=['[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','notify','fax','.pdf','\x20notify\x20','stringify','error','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','catch','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','faxpages','faxstatus','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','[Fax][execOriginate][success]'];(function(_0x245208,_0x5ed2c6){var _0x5187dc=function(_0x3aa563){while(--_0x3aa563){_0x245208['push'](_0x245208['shift']());}};_0x5187dc(++_0x5ed2c6);}(_0x09ab,0x182));var _0xb09a=function(_0x5e1ca7,_0xfbbac8){_0x5e1ca7=_0x5e1ca7-0x0;var _0x3a50cb=_0x09ab[_0x5e1ca7];return _0x3a50cb;};'use strict';var util=require(_0xb09a('0x0'));var _=require('lodash');var BPromise=require(_0xb09a('0x1'));var uuid=require(_0xb09a('0x2'));var moment=require(_0xb09a('0x3'));var path=require(_0xb09a('0x4'));var tiff2pdf=require(_0xb09a('0x5'));var gs=require(_0xb09a('0x6'));var logger=require(_0xb09a('0x7'))('fax');var ami=require(_0xb09a('0x8'));var rpcDb=require(_0xb09a('0x9'));var Channel=require(_0xb09a('0xa'));var ut=require(_0xb09a('0xb'));var Action=require(_0xb09a('0xc'));var faxAccount=require(_0xb09a('0xd'));var attachment=require(_0xb09a('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0xd100eb){this[_0xb09a('0xf')]={};this[_0xb09a('0x10')]=_0xd100eb[_0xb09a('0x10')];this[_0xb09a('0x11')]=_0xd100eb[_0xb09a('0x11')];this[_0xb09a('0x12')]={};ami['on'](_0xb09a('0x13'),this[_0xb09a('0x14')][_0xb09a('0x15')](this));ami['on'](_0xb09a('0x16'),this[_0xb09a('0x17')][_0xb09a('0x15')](this));ami['on']('newstate',this['syncNewState'][_0xb09a('0x15')](this));ami['on'](_0xb09a('0x18'),this[_0xb09a('0x19')][_0xb09a('0x15')](this));ami['on']('faxstatus',this[_0xb09a('0x1a')][_0xb09a('0x15')](this));ami['on']('receivefax',this[_0xb09a('0x1b')][_0xb09a('0x15')](this));ami['on'](_0xb09a('0x1c'),this[_0xb09a('0x1d')][_0xb09a('0x15')](this));ami['on']('originateresponse',this[_0xb09a('0x1e')][_0xb09a('0x15')](this));}Fax[_0xb09a('0x1f')][_0xb09a('0x14')]=function(_0x3bbaa4){if(_0x3bbaa4[_0xb09a('0x20')]===_0xb09a('0x21')){for(var _0x441341 in this[_0xb09a('0x10')]){if(this['faxAccounts'][_0xb09a('0x22')](_0x441341)){if(_0x3bbaa4[_0xb09a('0x23')]===this[_0xb09a('0x10')][_0x441341][_0xb09a('0x24')]){this[_0xb09a('0xf')][_0x3bbaa4['uniqueid']]={};this[_0xb09a('0xf')][_0x3bbaa4[_0xb09a('0x25')]][_0xb09a('0x26')]=_0x3bbaa4[_0xb09a('0x26')];this['channels'][_0x3bbaa4[_0xb09a('0x25')]]['id']=this[_0xb09a('0x10')][_0x441341]['id'];this[_0xb09a('0xf')][_0x3bbaa4[_0xb09a('0x25')]][_0xb09a('0x27')]=this[_0xb09a('0x10')][_0x441341]['name'];logger[_0xb09a('0x28')](_0x3bbaa4['uniqueid'],_0xb09a('0x29'));}}}}if(this[_0xb09a('0x12')][_0x3bbaa4[_0xb09a('0x25')]]){this[_0xb09a('0xf')][_0x3bbaa4[_0xb09a('0x25')]]={};this['channels'][_0x3bbaa4['uniqueid']][_0xb09a('0x26')]=_0x3bbaa4[_0xb09a('0x26')];logger[_0xb09a('0x28')](_0x3bbaa4['uniqueid'],_0xb09a('0x29'));}};Fax[_0xb09a('0x1f')]['syncVarSet']=function(_0x5121f4){if(this['channels'][_0x5121f4[_0xb09a('0x25')]]){for(var _0x40cd68 in _0x5121f4[_0xb09a('0x2a')]){if(_0x5121f4[_0xb09a('0x2a')][_0xb09a('0x22')](_0x40cd68)){this['channels'][_0x5121f4['uniqueid']][_0x40cd68]=_0x5121f4[_0xb09a('0x2b')];}}}};Fax['prototype'][_0xb09a('0x2c')]=function(_0xe3aa12){if(this[_0xb09a('0xf')][_0xe3aa12['uniqueid']]){this[_0xb09a('0xf')][_0xe3aa12[_0xb09a('0x25')]][_0xb09a('0x2d')]=_0xe3aa12[_0xb09a('0x2d')];this[_0xb09a('0xf')][_0xe3aa12[_0xb09a('0x25')]]['channelstatedesc']=_0xe3aa12['channelstatedesc'];}};Fax[_0xb09a('0x1f')][_0xb09a('0x19')]=function(_0x32880e){if(this['channels'][_0x32880e[_0xb09a('0x25')]]){for(var _0x531143 in _0x32880e['variable']){if(_0x32880e[_0xb09a('0x2a')][_0xb09a('0x22')](_0x531143)){this[_0xb09a('0xf')][_0x32880e[_0xb09a('0x25')]][_0x531143]=_0x32880e[_0xb09a('0x2b')];}}}};Fax[_0xb09a('0x1f')][_0xb09a('0x1a')]=function(_0x109f0e){if(this['channels'][_0x109f0e[_0xb09a('0x25')]]){this[_0xb09a('0xf')][_0x109f0e[_0xb09a('0x25')]]['operation']=_0x109f0e['operation'];this[_0xb09a('0xf')][_0x109f0e['uniqueid']][_0xb09a('0x2e')]=_0x109f0e[_0xb09a('0x2e')];this[_0xb09a('0xf')][_0x109f0e['uniqueid']][_0xb09a('0x24')]=_0x109f0e['localstationid'];this[_0xb09a('0xf')][_0x109f0e['uniqueid']][_0xb09a('0x2f')]=_0x109f0e[_0xb09a('0x2f')];logger['info'](_0x109f0e['uniqueid'],_0xb09a('0x30'));}};Fax['prototype'][_0xb09a('0x1b')]=function(_0xc8b8f9){var _0x57aaa6=this;if(this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]]){var _0x2ba528=this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]]['id'];this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x31')]=_0xc8b8f9[_0xb09a('0x31')];this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x32')]=_0xc8b8f9[_0xb09a('0x32')];this['channels'][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x24')]=_0xc8b8f9[_0xb09a('0x24')];this[_0xb09a('0xf')][_0xc8b8f9['uniqueid']][_0xb09a('0x33')]=_0xc8b8f9[_0xb09a('0x33')];this[_0xb09a('0xf')][_0xc8b8f9['uniqueid']][_0xb09a('0x34')]=_0xc8b8f9[_0xb09a('0x34')];this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]]['filename']=_0xc8b8f9[_0xb09a('0x2f')];this[_0xb09a('0xf')][_0xc8b8f9['uniqueid']][_0xb09a('0x35')]=_0xc8b8f9['calleridnum'];if(this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x32')]>0x0){tiff2pdf(_0xc8b8f9[_0xb09a('0x2f')],_0xb09a('0x36'),function(_0x4fdb72){logger['info'](_0xc8b8f9['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x4fdb72[_0xb09a('0x37')]);attachment[_0xb09a('0x38')]({'name':path[_0xb09a('0x39')](_0xc8b8f9['filename'])[_0xb09a('0x27')],'basename':path[_0xb09a('0x39')](_0xc8b8f9[_0xb09a('0x2f')])[_0xb09a('0x27')]+'.pdf','type':_0xb09a('0x3a')})[_0xb09a('0x3b')](function(_0x4380b7){faxAccount[_0xb09a('0x3c')](_0x2ba528,{'from':_0xc8b8f9[_0xb09a('0x35')],'mapKey':_0xb09a('0x3d'),'body':path[_0xb09a('0x39')](_0xc8b8f9[_0xb09a('0x2f')])[_0xb09a('0x27')]+_0xb09a('0x3e'),'AttachmentId':_0x4380b7['id']})['catch'](function(_0x1ad826){logger['error'](_0xc8b8f9[_0xb09a('0x25')],_0xb09a('0x3f'),JSON[_0xb09a('0x40')](_0x1ad826));});})['catch'](function(_0x308e37){logger[_0xb09a('0x41')](_0xc8b8f9[_0xb09a('0x25')],'\x20receiveFax\x20',JSON[_0xb09a('0x40')](_0x308e37));});});}logger[_0xb09a('0x28')](_0xc8b8f9[_0xb09a('0x25')],'\x20receiveFax\x20');}};Fax['prototype'][_0xb09a('0x1e')]=function(_0x2c59fa){if(this[_0xb09a('0x12')][_0x2c59fa[_0xb09a('0x25')]]){_[_0xb09a('0x42')](this[_0xb09a('0xf')][_0x2c59fa['uniqueid']],_[_0xb09a('0x43')](_0x2c59fa,[_0xb09a('0x44'),_0xb09a('0x45')]));}};function updateStatus(_0x2c039b){if(_0x2c039b[_0xb09a('0x46')]){faxMessage[_0xb09a('0x47')](_0x2c039b[_0xb09a('0x46')],{'failMessage':_0xb09a('0x48')})[_0xb09a('0x3b')](function(_0x315851){ut[_0xb09a('0x49')](_0xb09a('0x4a'),_0x315851);})['catch'](function(_0x104879){ut[_0xb09a('0x49')](_0xb09a('0x4b'),_0x104879);});}else{ut[_0xb09a('0x49')](_0xb09a('0x4c'));}}Fax[_0xb09a('0x1f')][_0xb09a('0x4d')]=function(_0x540fc3,_0x3f14c0,_0x1b55ea){var _0x2c38fb=this;var _0x1aa88e={};if(_0x3f14c0){_0x1aa88e={'read':_0x3f14c0};}else{_0x1aa88e={'failMessage':_0x1b55ea};}if(this[_0xb09a('0x12')][_0x540fc3][_0xb09a('0x46')]){faxMessage[_0xb09a('0x47')](this[_0xb09a('0x12')][_0x540fc3]['AttachmentId'],_0x1aa88e)['then'](function(_0x59747f){ut[_0xb09a('0x49')](_0xb09a('0x4e'),_0x59747f);})[_0xb09a('0x4f')](function(_0x2b3ebe){ut['logger'](_0xb09a('0x50'),_0x2b3ebe);})[_0xb09a('0x51')](function(){delete _0x2c38fb[_0xb09a('0xf')][_0x540fc3];delete _0x2c38fb[_0xb09a('0x12')][_0x540fc3];});}else{ut[_0xb09a('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0xb09a('0xf')][_0x540fc3];delete this[_0xb09a('0x12')][_0x540fc3];}};Fax['prototype'][_0xb09a('0x1d')]=function(_0x34a8c8){var _0x32a52f=this;if(this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]){if(this['actions'][_0x34a8c8[_0xb09a('0x25')]]){this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]['id']=this['actions'][_0x34a8c8[_0xb09a('0x25')]]['id'];this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]['name']=this[_0xb09a('0x12')][_0x34a8c8[_0xb09a('0x25')]][_0xb09a('0x27')];}logger[_0xb09a('0x28')](_0x34a8c8[_0xb09a('0x25')],this[_0xb09a('0x12')][_0x34a8c8['uniqueid']]?_0xb09a('0x52'):'\x20hangup\x20faxRiceive\x20',JSON[_0xb09a('0x40')](this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]));if(this[_0xb09a('0x12')][_0x34a8c8[_0xb09a('0x25')]]){if(this['channels'][_0x34a8c8['uniqueid']][_0xb09a('0x53')]>0x0&&this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]][_0xb09a('0x54')]==='SUCCESS'){this[_0xb09a('0x4d')](_0x34a8c8[_0xb09a('0x25')],!![]);}else{this['updateStatus'](_0x34a8c8['uniqueid'],![],this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]['faxstatusstring']?_0xb09a('0x55')+this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]][_0xb09a('0x56')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0xb09a('0x57')]=function(_0x3440b1){var _0x9c59e8=this;return new BPromise(function(_0x242d57,_0x23e923){_0x9c59e8[_0xb09a('0x58')](_0x3440b1,_0x9c59e8[_0xb09a('0x10')][_0x3440b1['FaxAccountId']])[_0xb09a('0x3b')](function(_0x5208cc){ut['logger'](_0xb09a('0x59'),_0x5208cc);_0x242d57(ut[_0xb09a('0x37')]('Fax\x20received'));})[_0xb09a('0x4f')](function(_0x1306cc){ut[_0xb09a('0x49')](_0xb09a('0x5a'),_0x1306cc);updateStatus(_0x3440b1);_0x23e923(ut[_0xb09a('0x37')](_0xb09a('0x5b')));});});};Fax[_0xb09a('0x1f')][_0xb09a('0x5c')]=function(_0x19f7e6){var _0xc1be38=this;return new BPromise(function(_0x3f4a37,_0x1a6178){var _0x27b575=_0xc1be38['checkTrunk'](_0xc1be38[_0xb09a('0x10')][_0x19f7e6[_0xb09a('0x5d')]][_0xb09a('0x5e')],_0x19f7e6);if(_0x27b575[_0xb09a('0x5f')]){_0x3f4a37(ut[_0xb09a('0x37')]('Trunk\x20Reachable'));}else{_0x1a6178(ut[_0xb09a('0x37')](_0x27b575['message']));}});};function originate(_0x231fb7,_0x24e03d,_0x3b6881){return new BPromise(function(_0x5d9bbe,_0x5ef564){if(_0x3b6881){var _0x57e156=util[_0xb09a('0x60')](_0xb09a('0x61'),path[_0xb09a('0x39')](_0x231fb7[_0xb09a('0x4')])['name'],_0x231fb7[_0xb09a('0x4')]);gs[_0xb09a('0x62')](_0x57e156)[_0xb09a('0x3b')](function(){_0x231fb7[_0xb09a('0x4')]=util['format'](_0xb09a('0x63'),path[_0xb09a('0x39')](_0x231fb7[_0xb09a('0x4')])[_0xb09a('0x64')],path[_0xb09a('0x39')](_0x231fb7[_0xb09a('0x4')])[_0xb09a('0x27')]);_0x24e03d[_0xb09a('0x65')]=_0x231fb7[_0xb09a('0x4')];ut[_0xb09a('0x49')](_0xb09a('0x66'),'');ami['Action'](ut[_0xb09a('0x67')](_0x231fb7,_0x24e03d))[_0xb09a('0x3b')](function(_0x3c6842){_0x5d9bbe(_0x3c6842);})[_0xb09a('0x4f')](function(_0x54f380){_0x5ef564(_0x54f380);});})[_0xb09a('0x4f')](function(_0x2bc56d){_0x5ef564(_0x2bc56d);});}else{ami[_0xb09a('0x68')](ut[_0xb09a('0x67')](_0x231fb7,_0x24e03d))[_0xb09a('0x3b')](function(_0x301242){_0x5d9bbe(_0x301242);})[_0xb09a('0x4f')](function(_0x1d9590){_0x5ef564(_0x1d9590);});}});}Fax[_0xb09a('0x1f')]['execOriginate']=function(_0x15b0d6,_0x4b1741){var _0x2bae4b=this;return new BPromise(function(_0x45f454,_0xe4b48c){var _0x2cdbea=uuid['v4']();var _0x57e67e=ut['addVariables'](_0x15b0d6,_0x4b1741);_0x2bae4b[_0xb09a('0x12')][_0x2cdbea]=new Action(_0x2cdbea,_0x4b1741,_0x15b0d6);var _0x1b0072=_0x2bae4b[_0xb09a('0x12')][_0x2cdbea];if(path[_0xb09a('0x39')](_0x15b0d6['path'])[_0xb09a('0x69')]===_0xb09a('0x3e')){originate(_0x1b0072,_0x57e67e,!![])[_0xb09a('0x3b')](function(_0x2d9dc6){_0x45f454(_0x2d9dc6);})['catch'](function(_0x52df3e){_0xe4b48c(_0x52df3e);});}else{originate(_0x1b0072,_0x57e67e,![])[_0xb09a('0x3b')](function(_0x9944be){_0x45f454(_0x9944be);})[_0xb09a('0x4f')](function(_0x265970){_0xe4b48c(_0x265970);});}});};Fax[_0xb09a('0x1f')][_0xb09a('0x6a')]=function(_0x5f4ae4){return!_[_0xb09a('0x6b')](_0x5f4ae4)&&!_[_0xb09a('0x6b')](_0x5f4ae4[_0xb09a('0x27')])&&!_[_0xb09a('0x6b')](_0x5f4ae4[_0xb09a('0x6c')])&&_0x5f4ae4[_0xb09a('0x6c')]&&!_[_0xb09a('0x6b')](this[_0xb09a('0x11')][util[_0xb09a('0x60')]('SIP/%s',_0x5f4ae4[_0xb09a('0x27')])])&&!_[_0xb09a('0x6b')](this['trunks'][util[_0xb09a('0x60')]('SIP/%s',_0x5f4ae4['name'])][_0xb09a('0x2e')])&&(this[_0xb09a('0x11')][util[_0xb09a('0x60')](_0xb09a('0x6d'),_0x5f4ae4[_0xb09a('0x27')])]['status']===_0xb09a('0x6e')||this['trunks'][util['format'](_0xb09a('0x6d'),_0x5f4ae4[_0xb09a('0x27')])][_0xb09a('0x2e')]==='unmonitored');};Fax[_0xb09a('0x1f')][_0xb09a('0x6f')]=function(_0x3c6a8a,_0x43635f){if(!this['isTrunkReachable'](_0x3c6a8a)){ut[_0xb09a('0x49')](_0xb09a('0x70'),_[_0xb09a('0x6b')](_0x3c6a8a)?'':_0x3c6a8a[_0xb09a('0x27')]+_0xb09a('0x71'));return{'isValid':![],'message':_0xb09a('0x72')};}if(_[_0xb09a('0x6b')](_0x43635f[_0xb09a('0x3d')])){ut[_0xb09a('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xb09a('0x40')](_0x43635f));return{'isValid':![],'message':_0xb09a('0x73')};}if(_[_0xb09a('0x6b')](_0x43635f[_0xb09a('0x4')])){ut[_0xb09a('0x49')](_0xb09a('0x74'),JSON[_0xb09a('0x40')](_0x43635f));return{'isValid':![],'message':_0xb09a('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xb09a('0x76')]=Fax; \ No newline at end of file +var _0x910d=['SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring'];(function(_0x287d81,_0x344659){var _0x5eda3e=function(_0x33443f){while(--_0x33443f){_0x287d81['push'](_0x287d81['shift']());}};_0x5eda3e(++_0x344659);}(_0x910d,0x179));var _0xd910=function(_0x1f7bc9,_0x29e1b2){_0x1f7bc9=_0x1f7bc9-0x0;var _0x5b28c2=_0x910d[_0x1f7bc9];return _0x5b28c2;};'use strict';var util=require(_0xd910('0x0'));var _=require('lodash');var BPromise=require(_0xd910('0x1'));var uuid=require('uuid');var moment=require(_0xd910('0x2'));var path=require(_0xd910('0x3'));var tiff2pdf=require(_0xd910('0x4'));var gs=require(_0xd910('0x5'));var logger=require(_0xd910('0x6'))(_0xd910('0x7'));var ami=require(_0xd910('0x8'));var rpcDb=require(_0xd910('0x9'));var Channel=require(_0xd910('0xa'));var ut=require(_0xd910('0xb'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xd910('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x19ae7b){this[_0xd910('0xd')]={};this[_0xd910('0xe')]=_0x19ae7b[_0xd910('0xe')];this[_0xd910('0xf')]=_0x19ae7b[_0xd910('0xf')];this[_0xd910('0x10')]={};ami['on']('newchannel',this[_0xd910('0x11')][_0xd910('0x12')](this));ami['on'](_0xd910('0x13'),this[_0xd910('0x14')]['bind'](this));ami['on']('newstate',this[_0xd910('0x15')]['bind'](this));ami['on'](_0xd910('0x16'),this[_0xd910('0x17')][_0xd910('0x12')](this));ami['on'](_0xd910('0x18'),this[_0xd910('0x19')][_0xd910('0x12')](this));ami['on'](_0xd910('0x1a'),this['syncReceiveFax']['bind'](this));ami['on'](_0xd910('0x1b'),this[_0xd910('0x1c')][_0xd910('0x12')](this));ami['on'](_0xd910('0x1d'),this['syncOriginateResponse']['bind'](this));}Fax[_0xd910('0x1e')]['syncNewchannel']=function(_0x16b9c6){if(_0x16b9c6[_0xd910('0x1f')]===_0xd910('0x20')){for(var _0x583562 in this[_0xd910('0xe')]){if(this['faxAccounts'][_0xd910('0x21')](_0x583562)){if(_0x16b9c6['exten']===this[_0xd910('0xe')][_0x583562][_0xd910('0x22')]){this[_0xd910('0xd')][_0x16b9c6[_0xd910('0x23')]]={};this[_0xd910('0xd')][_0x16b9c6[_0xd910('0x23')]]['channel']=_0x16b9c6[_0xd910('0x24')];this[_0xd910('0xd')][_0x16b9c6[_0xd910('0x23')]]['id']=this['faxAccounts'][_0x583562]['id'];this['channels'][_0x16b9c6[_0xd910('0x23')]]['name']=this[_0xd910('0xe')][_0x583562][_0xd910('0x25')];logger[_0xd910('0x26')](_0x16b9c6[_0xd910('0x23')],_0xd910('0x27'));}}}}if(this[_0xd910('0x10')][_0x16b9c6[_0xd910('0x23')]]){this[_0xd910('0xd')][_0x16b9c6['uniqueid']]={};this[_0xd910('0xd')][_0x16b9c6[_0xd910('0x23')]][_0xd910('0x24')]=_0x16b9c6[_0xd910('0x24')];logger[_0xd910('0x26')](_0x16b9c6[_0xd910('0x23')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0xd910('0x14')]=function(_0x538a8b){if(this[_0xd910('0xd')][_0x538a8b[_0xd910('0x23')]]){for(var _0x4be888 in _0x538a8b[_0xd910('0x28')]){if(_0x538a8b[_0xd910('0x28')][_0xd910('0x21')](_0x4be888)){this['channels'][_0x538a8b[_0xd910('0x23')]][_0x4be888]=_0x538a8b[_0xd910('0x29')];}}}};Fax[_0xd910('0x1e')][_0xd910('0x15')]=function(_0x19e2c6){if(this[_0xd910('0xd')][_0x19e2c6[_0xd910('0x23')]]){this['channels'][_0x19e2c6[_0xd910('0x23')]][_0xd910('0x2a')]=_0x19e2c6[_0xd910('0x2a')];this[_0xd910('0xd')][_0x19e2c6['uniqueid']][_0xd910('0x2b')]=_0x19e2c6['channelstatedesc'];}};Fax[_0xd910('0x1e')]['syncNewExten']=function(_0x58f0d9){if(this['channels'][_0x58f0d9[_0xd910('0x23')]]){for(var _0x70b071 in _0x58f0d9[_0xd910('0x28')]){if(_0x58f0d9[_0xd910('0x28')][_0xd910('0x21')](_0x70b071)){this['channels'][_0x58f0d9[_0xd910('0x23')]][_0x70b071]=_0x58f0d9[_0xd910('0x29')];}}}};Fax[_0xd910('0x1e')][_0xd910('0x19')]=function(_0x4f777e){if(this[_0xd910('0xd')][_0x4f777e['uniqueid']]){this[_0xd910('0xd')][_0x4f777e['uniqueid']][_0xd910('0x2c')]=_0x4f777e['operation'];this[_0xd910('0xd')][_0x4f777e[_0xd910('0x23')]][_0xd910('0x2d')]=_0x4f777e['status'];this['channels'][_0x4f777e[_0xd910('0x23')]]['localstationid']=_0x4f777e[_0xd910('0x22')];this[_0xd910('0xd')][_0x4f777e[_0xd910('0x23')]][_0xd910('0x2e')]=_0x4f777e['filename'];logger['info'](_0x4f777e[_0xd910('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0xd910('0x1e')][_0xd910('0x2f')]=function(_0x3bef56){var _0x532af7=this;if(this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]]){var _0x1f45f8=this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]]['id'];this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]][_0xd910('0x30')]=_0x3bef56['remotestationid'];this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]][_0xd910('0x31')]=_0x3bef56[_0xd910('0x31')];this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]][_0xd910('0x22')]=_0x3bef56['localstationid'];this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]][_0xd910('0x32')]=_0x3bef56['resolution'];this['channels'][_0x3bef56[_0xd910('0x23')]]['transferrate']=_0x3bef56[_0xd910('0x33')];this['channels'][_0x3bef56[_0xd910('0x23')]][_0xd910('0x2e')]=_0x3bef56[_0xd910('0x2e')];this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]][_0xd910('0x34')]=_0x3bef56[_0xd910('0x34')];if(this[_0xd910('0xd')][_0x3bef56[_0xd910('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x3bef56[_0xd910('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x2c90f1){logger[_0xd910('0x26')](_0x3bef56[_0xd910('0x23')],_0xd910('0x35'),_0x2c90f1[_0xd910('0x36')]);attachment[_0xd910('0x37')]({'name':path[_0xd910('0x38')](_0x3bef56[_0xd910('0x2e')])[_0xd910('0x25')],'basename':path[_0xd910('0x38')](_0x3bef56[_0xd910('0x2e')])[_0xd910('0x25')]+_0xd910('0x39'),'type':_0xd910('0x3a')})[_0xd910('0x3b')](function(_0x4a37de){faxAccount['notify'](_0x1f45f8,{'from':_0x3bef56['calleridnum'],'mapKey':'fax','body':path[_0xd910('0x38')](_0x3bef56['filename'])[_0xd910('0x25')]+_0xd910('0x39'),'AttachmentId':_0x4a37de['id']})[_0xd910('0x3c')](function(_0x3fb210){logger[_0xd910('0x3d')](_0x3bef56['uniqueid'],_0xd910('0x3e'),JSON[_0xd910('0x3f')](_0x3fb210));});})[_0xd910('0x3c')](function(_0x23ab96){logger[_0xd910('0x3d')](_0x3bef56[_0xd910('0x23')],_0xd910('0x40'),JSON[_0xd910('0x3f')](_0x23ab96));});});}logger[_0xd910('0x26')](_0x3bef56[_0xd910('0x23')],_0xd910('0x40'));}};Fax[_0xd910('0x1e')][_0xd910('0x41')]=function(_0x5bc95b){if(this[_0xd910('0x10')][_0x5bc95b[_0xd910('0x23')]]){_['merge'](this[_0xd910('0xd')][_0x5bc95b[_0xd910('0x23')]],_[_0xd910('0x42')](_0x5bc95b,[_0xd910('0x43'),_0xd910('0x44')]));}};function updateStatus(_0x32b2f8){if(_0x32b2f8[_0xd910('0x45')]){faxMessage[_0xd910('0x46')](_0x32b2f8[_0xd910('0x45')],{'failMessage':_0xd910('0x47')})[_0xd910('0x3b')](function(_0x341575){ut['logger']('[Fax][Message][Error][Updated]',_0x341575);})[_0xd910('0x3c')](function(_0xd1d17a){ut[_0xd910('0x48')]('[Fax][Message][Error][NoUpdate1]',_0xd1d17a);});}else{ut[_0xd910('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0xd910('0x49')]=function(_0x4c5225,_0x119975,_0x2bdfc0){var _0x2a289e=this;var _0x51e32a={};if(_0x119975){_0x51e32a={'read':_0x119975};}else{_0x51e32a={'failMessage':_0x2bdfc0};}if(this[_0xd910('0x10')][_0x4c5225]['AttachmentId']){faxMessage[_0xd910('0x46')](this['actions'][_0x4c5225][_0xd910('0x45')],_0x51e32a)['then'](function(_0x57bdc5){ut['logger'](_0xd910('0x4a'),_0x57bdc5);})['catch'](function(_0x26deff){ut[_0xd910('0x48')](_0xd910('0x4b'),_0x26deff);})[_0xd910('0x4c')](function(){delete _0x2a289e[_0xd910('0xd')][_0x4c5225];delete _0x2a289e[_0xd910('0x10')][_0x4c5225];});}else{ut[_0xd910('0x48')](_0xd910('0x4d'));delete this[_0xd910('0xd')][_0x4c5225];delete this[_0xd910('0x10')][_0x4c5225];}};Fax[_0xd910('0x1e')]['syncHangup']=function(_0x2074ff){var _0x336b4b=this;if(this[_0xd910('0xd')][_0x2074ff['uniqueid']]){if(this[_0xd910('0x10')][_0x2074ff[_0xd910('0x23')]]){this['channels'][_0x2074ff[_0xd910('0x23')]]['id']=this[_0xd910('0x10')][_0x2074ff['uniqueid']]['id'];this['channels'][_0x2074ff['uniqueid']]['name']=this[_0xd910('0x10')][_0x2074ff[_0xd910('0x23')]][_0xd910('0x25')];}logger['info'](_0x2074ff[_0xd910('0x23')],this['actions'][_0x2074ff[_0xd910('0x23')]]?_0xd910('0x4e'):_0xd910('0x4f'),JSON[_0xd910('0x3f')](this[_0xd910('0xd')][_0x2074ff[_0xd910('0x23')]]));if(this[_0xd910('0x10')][_0x2074ff['uniqueid']]){if(this['channels'][_0x2074ff[_0xd910('0x23')]][_0xd910('0x50')]>0x0&&this[_0xd910('0xd')][_0x2074ff[_0xd910('0x23')]][_0xd910('0x18')]===_0xd910('0x51')){this[_0xd910('0x49')](_0x2074ff[_0xd910('0x23')],!![]);}else{this[_0xd910('0x49')](_0x2074ff[_0xd910('0x23')],![],this['channels'][_0x2074ff[_0xd910('0x23')]][_0xd910('0x52')]?_0xd910('0x53')+this[_0xd910('0xd')][_0x2074ff['uniqueid']]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xd910('0x1e')][_0xd910('0x54')]=function(_0x3a4e4a){var _0x2b5084=this;return new BPromise(function(_0x3349ec,_0x46da91){_0x2b5084[_0xd910('0x55')](_0x3a4e4a,_0x2b5084[_0xd910('0xe')][_0x3a4e4a[_0xd910('0x56')]])['then'](function(_0x3e7199){ut[_0xd910('0x48')](_0xd910('0x57'),_0x3e7199);_0x3349ec(ut[_0xd910('0x36')](_0xd910('0x58')));})['catch'](function(_0x379029){ut['logger']('[Fax][execOriginate][failure]',_0x379029);updateStatus(_0x3a4e4a);_0x46da91(ut['message'](_0xd910('0x59')));});});};Fax[_0xd910('0x1e')][_0xd910('0x5a')]=function(_0x1253a4){var _0x1dd40c=this;return new BPromise(function(_0x19cfb7,_0x7239af){var _0x51882c=_0x1dd40c[_0xd910('0x5b')](_0x1dd40c[_0xd910('0xe')][_0x1253a4[_0xd910('0x56')]]['Trunk'],_0x1253a4);if(_0x51882c['isValid']){_0x19cfb7(ut[_0xd910('0x36')](_0xd910('0x5c')));}else{_0x7239af(ut[_0xd910('0x36')](_0x51882c[_0xd910('0x36')]));}});};function originate(_0x3abc71,_0x2d25b3,_0x3d3fb4){return new BPromise(function(_0x3e973f,_0x59eb9e){if(_0x3d3fb4){var _0x22e242=util[_0xd910('0x5d')](_0xd910('0x5e'),path[_0xd910('0x38')](_0x3abc71[_0xd910('0x3')])[_0xd910('0x25')],_0x3abc71[_0xd910('0x3')]);gs[_0xd910('0x5f')](_0x22e242)[_0xd910('0x3b')](function(){_0x3abc71['path']=util['format'](_0xd910('0x60'),path['parse'](_0x3abc71[_0xd910('0x3')])[_0xd910('0x61')],path[_0xd910('0x38')](_0x3abc71[_0xd910('0x3')])['name']);_0x2d25b3[_0xd910('0x62')]=_0x3abc71['path'];ut['logger'](_0xd910('0x63'),'');ami['Action'](ut[_0xd910('0x64')](_0x3abc71,_0x2d25b3))[_0xd910('0x3b')](function(_0x288f6a){_0x3e973f(_0x288f6a);})[_0xd910('0x3c')](function(_0x3b0885){_0x59eb9e(_0x3b0885);});})[_0xd910('0x3c')](function(_0x3012a0){_0x59eb9e(_0x3012a0);});}else{ami[_0xd910('0x65')](ut[_0xd910('0x64')](_0x3abc71,_0x2d25b3))[_0xd910('0x3b')](function(_0x1492d2){_0x3e973f(_0x1492d2);})['catch'](function(_0x457581){_0x59eb9e(_0x457581);});}});}Fax[_0xd910('0x1e')][_0xd910('0x55')]=function(_0x2b4c80,_0x53cb6b){var _0x4f5543=this;return new BPromise(function(_0xf9f7fb,_0x4e029d){var _0x58af35=uuid['v4']();var _0x5caa13=ut['addVariables'](_0x2b4c80,_0x53cb6b);_0x4f5543[_0xd910('0x10')][_0x58af35]=new Action(_0x58af35,_0x53cb6b,_0x2b4c80);var _0x2f0f2c=_0x4f5543[_0xd910('0x10')][_0x58af35];if(path['parse'](_0x2b4c80['path'])['ext']===_0xd910('0x39')){originate(_0x2f0f2c,_0x5caa13,!![])['then'](function(_0x5029fe){_0xf9f7fb(_0x5029fe);})['catch'](function(_0x17af41){_0x4e029d(_0x17af41);});}else{originate(_0x2f0f2c,_0x5caa13,![])[_0xd910('0x3b')](function(_0x10445b){_0xf9f7fb(_0x10445b);})[_0xd910('0x3c')](function(_0x2dd58b){_0x4e029d(_0x2dd58b);});}});};Fax[_0xd910('0x1e')][_0xd910('0x66')]=function(_0x871aa3){return!_[_0xd910('0x67')](_0x871aa3)&&!_[_0xd910('0x67')](_0x871aa3[_0xd910('0x25')])&&!_[_0xd910('0x67')](_0x871aa3[_0xd910('0x68')])&&_0x871aa3[_0xd910('0x68')]&&!_[_0xd910('0x67')](this[_0xd910('0xf')][util[_0xd910('0x5d')](_0xd910('0x69'),_0x871aa3['name'])])&&!_[_0xd910('0x67')](this[_0xd910('0xf')][util[_0xd910('0x5d')]('SIP/%s',_0x871aa3[_0xd910('0x25')])]['status'])&&(this[_0xd910('0xf')][util[_0xd910('0x5d')]('SIP/%s',_0x871aa3['name'])][_0xd910('0x2d')]==='reachable'||this['trunks'][util['format'](_0xd910('0x69'),_0x871aa3[_0xd910('0x25')])][_0xd910('0x2d')]===_0xd910('0x6a'));};Fax[_0xd910('0x1e')][_0xd910('0x5b')]=function(_0x3ca449,_0x2f31fc){if(!this['isTrunkReachable'](_0x3ca449)){ut[_0xd910('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xd910('0x67')](_0x3ca449)?'':_0x3ca449['name']+_0xd910('0x6b'));return{'isValid':![],'message':_0xd910('0x6c')};}if(_['isNil'](_0x2f31fc[_0xd910('0x7')])){ut[_0xd910('0x48')](_0xd910('0x6d'),JSON[_0xd910('0x3f')](_0x2f31fc));return{'isValid':![],'message':_0xd910('0x6e')};}if(_[_0xd910('0x67')](_0x2f31fc[_0xd910('0x3')])){ut[_0xd910('0x48')](_0xd910('0x6f'),JSON[_0xd910('0x3f')](_0x2f31fc));return{'isValid':![],'message':_0xd910('0x70')};}return{'isValid':!![],'message':_0xd910('0x71')};};module[_0xd910('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a3c25e6..88b5e43 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 _0x60a5=['then','[Notify]\x20','bluebird','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x23c43d,_0x448b6e){var _0x597309=function(_0x3b789b){while(--_0x3b789b){_0x23c43d['push'](_0x23c43d['shift']());}};_0x597309(++_0x448b6e);}(_0x60a5,0x142));var _0x560a=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x60a5[_0x56482c];return _0x5aae7a;};'use strict';var util=require('util');var BPromise=require(_0x560a('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x560a('0x1'));var faxAccount=require(_0x560a('0x2'));function loggerCatch(_0x2fd8bb){return function(_0x52be55){logger[_0x560a('0x3')](_0x2fd8bb,util[_0x560a('0x4')](_0x52be55,{'showHidden':![],'depth':null}));};}exports[_0x560a('0x5')]=function(_0x27e463,_0xabb583){return BPromise['resolve']()[_0x560a('0x6')](faxAccount[_0x560a('0x5')](_0x27e463,_0xabb583))['catch'](loggerCatch(_0x560a('0x7')));}; \ No newline at end of file +var _0x37f8=['catch','[Notify]\x20','preview','lodash','notify','then'];(function(_0x1ef612,_0x2ef538){var _0x3d169d=function(_0x5dd4b9){while(--_0x5dd4b9){_0x1ef612['push'](_0x1ef612['shift']());}};_0x3d169d(++_0x2ef538);}(_0x37f8,0x1c4));var _0x837f=function(_0x15112f,_0x53e924){_0x15112f=_0x15112f-0x0;var _0x3ff4ff=_0x37f8[_0x15112f];return _0x3ff4ff;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x837f('0x0'));var _=require(_0x837f('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1c8380){return function(_0x1736ca){logger['error'](_0x1c8380,util['inspect'](_0x1736ca,{'showHidden':![],'depth':null}));};}exports[_0x837f('0x2')]=function(_0x41aa95,_0x2fc4d6){return BPromise['resolve']()[_0x837f('0x3')](faxAccount['notify'](_0x41aa95,_0x2fc4d6))[_0x837f('0x4')](loggerCatch(_0x837f('0x5')));}; \ 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 6d0231b..b6ec8c0 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 _0x4a40=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec','execute','info'];(function(_0x11c69f,_0x116175){var _0xba70ab=function(_0x187fe2){while(--_0x187fe2){_0x11c69f['push'](_0x11c69f['shift']());}};_0xba70ab(++_0x116175);}(_0x4a40,0x161));var _0x04a4=function(_0x345b70,_0x4dc245){_0x345b70=_0x345b70-0x0;var _0x23068c=_0x4a40[_0x345b70];return _0x23068c;};'use strict';var util=require(_0x04a4('0x0'));var logger=require(_0x04a4('0x1'))(_0x04a4('0x2'));var BPromise=require('bluebird');var exec=require(_0x04a4('0x3'))[_0x04a4('0x4')];exports[_0x04a4('0x5')]=function(_0x82afb0){return new BPromise(function(_0xd87529,_0x204f11){exec(_0x82afb0,function(_0x3e360c,_0x4bf2bc,_0x1400a8){logger[_0x04a4('0x6')](_0x04a4('0x7'),_0x4bf2bc);if(_0x3e360c){logger[_0x04a4('0x6')]('Exec\x20gs',_0x04a4('0x8'),util[_0x04a4('0x9')](_0x3e360c,{'showHidden':![],'depth':null}),_0x4bf2bc,_0x1400a8);_0x204f11(_0x3e360c);}_0xd87529(_0x4bf2bc);});});}; \ No newline at end of file +var _0x472b=['\x20Error\x20:','inspect','util','fax','bluebird','child_process','execute','Exec\x20gs','info'];(function(_0x5eb294,_0x5b52ba){var _0xd139fd=function(_0x52e319){while(--_0x52e319){_0x5eb294['push'](_0x5eb294['shift']());}};_0xd139fd(++_0x5b52ba);}(_0x472b,0x18e));var _0xb472=function(_0x303fe6,_0x737e56){_0x303fe6=_0x303fe6-0x0;var _0x404ac9=_0x472b[_0x303fe6];return _0x404ac9;};'use strict';var util=require(_0xb472('0x0'));var logger=require('../../../../config/logger')(_0xb472('0x1'));var BPromise=require(_0xb472('0x2'));var exec=require(_0xb472('0x3'))['exec'];exports[_0xb472('0x4')]=function(_0x5c6d62){return new BPromise(function(_0x501c10,_0x3917bc){exec(_0x5c6d62,function(_0x2b9214,_0x179f98,_0x3994aa){logger['info'](_0xb472('0x5'),_0x179f98);if(_0x2b9214){logger[_0xb472('0x6')](_0xb472('0x5'),_0xb472('0x7'),util[_0xb472('0x8')](_0x2b9214,{'showHidden':![],'depth':null}),_0x179f98,_0x3994aa);_0x3917bc(_0x2b9214);}_0x501c10(_0x179f98);});});}; \ 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 86abc14..9792e5f 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 _0x746b=['../../../../config/logger','fax','message','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment'];(function(_0x56cd6b,_0x5d10ed){var _0x6d92d6=function(_0x5b40d0){while(--_0x5b40d0){_0x56cd6b['push'](_0x56cd6b['shift']());}};_0x6d92d6(++_0x5d10ed);}(_0x746b,0x1bf));var _0xb746=function(_0x471e97,_0x46b959){_0x471e97=_0x471e97-0x0;var _0x40ba92=_0x746b[_0x471e97];return _0x40ba92;};'use strict';var util=require(_0xb746('0x0'));var _=require(_0xb746('0x1'));var moment=require(_0xb746('0x2'));var logger=require(_0xb746('0x3'))(_0xb746('0x4'));exports[_0xb746('0x5')]=function(_0x516fb6){return{'message':_0x516fb6};};exports['logger']=function(_0x1dd3bd,_0x3ee03d){logger['info'](_0x1dd3bd,util['inspect'](_0x3ee03d,{'showHidden':![],'depth':null}));};exports[_0xb746('0x6')]=function(_0x8aa000,_0x4b8b13){var _0x961a5d={'XMF-ECM':_0x4b8b13[_0xb746('0x7')],'XMF-HEADERINFO':_0x4b8b13['headerinfo'],'XMF-MINRATE':_0x4b8b13[_0xb746('0x8')],'XMF-MAXRATE':_0x4b8b13[_0xb746('0x9')],'XMF-MODEM':util[_0xb746('0xa')](_0xb746('0xb'),_0x4b8b13[_0xb746('0xc')]),'XMF-GATEWAY':_0x4b8b13[_0xb746('0xd')],'XMF-FAXDETECT':_0x4b8b13[_0xb746('0xe')],'XMF-T38TIMEOUT':_0x4b8b13[_0xb746('0xf')],'XMF-LOCALSTATIONID':_0x4b8b13['localstationid'],'XMF-PATH':_0x8aa000[_0xb746('0x10')]};return _0x961a5d;};exports[_0xb746('0x11')]=function(_0x25f435,_0x22f374){return{'actionid':_0x25f435[_0xb746('0x12')],'action':_0xb746('0x13'),'channel':_0x25f435[_0xb746('0x14')],'Exten':_0xb746('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0xb746('0xa')](_0xb746('0x16'),_0x25f435[_0xb746('0x17')]?_0x25f435['headerinfo']:'',_0x25f435[_0xb746('0x18')]),'variable':_0x22f374,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x25f435[_0xb746('0x12')]};}; \ No newline at end of file +var _0x92a4=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','../../../../config/logger','message','logger','info','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','uniqueid','channel'];(function(_0x55749a,_0x47b1d7){var _0x5d92df=function(_0x446936){while(--_0x446936){_0x55749a['push'](_0x55749a['shift']());}};_0x5d92df(++_0x47b1d7);}(_0x92a4,0xb4));var _0x492a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x92a4[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0x492a('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x492a('0x1'))('fax');exports[_0x492a('0x2')]=function(_0x349110){return{'message':_0x349110};};exports[_0x492a('0x3')]=function(_0xa8bf2,_0x20cd1f){logger[_0x492a('0x4')](_0xa8bf2,util['inspect'](_0x20cd1f,{'showHidden':![],'depth':null}));};exports[_0x492a('0x5')]=function(_0x3e47a2,_0x5aebca){var _0x56a067={'XMF-ECM':_0x5aebca[_0x492a('0x6')],'XMF-HEADERINFO':_0x5aebca['headerinfo'],'XMF-MINRATE':_0x5aebca[_0x492a('0x7')],'XMF-MAXRATE':_0x5aebca[_0x492a('0x8')],'XMF-MODEM':util[_0x492a('0x9')](_0x492a('0xa'),_0x5aebca[_0x492a('0xb')]),'XMF-GATEWAY':_0x5aebca[_0x492a('0xc')],'XMF-FAXDETECT':_0x5aebca[_0x492a('0xd')],'XMF-T38TIMEOUT':_0x5aebca[_0x492a('0xe')],'XMF-LOCALSTATIONID':_0x5aebca[_0x492a('0xf')],'XMF-PATH':_0x3e47a2['path']};return _0x56a067;};exports['variablesAction']=function(_0x41ebdc,_0x445d48){return{'actionid':_0x41ebdc[_0x492a('0x10')],'action':'originate','channel':_0x41ebdc[_0x492a('0x11')],'Exten':_0x492a('0x12'),'Context':_0x492a('0x13'),'Priority':'1','callerid':util[_0x492a('0x9')](_0x492a('0x14'),_0x41ebdc[_0x492a('0x15')]?_0x41ebdc[_0x492a('0x15')]:'',_0x41ebdc[_0x492a('0xf')]),'variable':_0x445d48,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x41ebdc[_0x492a('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0297aa2..efa656f 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 _0x01b6=['getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./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/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getTelephones','initTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01b6,0x1ee));var _0x601b=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x01b6[_0x19a11f];return _0x51485f;};'use strict';var util=require(_0x601b('0x0'));var moment=require('moment');var server=require(_0x601b('0x1'));var Realtime=require(_0x601b('0x2'));var Report=require(_0x601b('0x3'));var Acw=require(_0x601b('0x4'));var Trigger=require(_0x601b('0x5'));var Dialer=require('./dialer');var Preview=require(_0x601b('0x6'));var Fax=require(_0x601b('0x7'));var user=require(_0x601b('0x8'));var voiceQueue=require(_0x601b('0x9'));var voiceQueueReport=require(_0x601b('0xa'));var voiceCallReport=require(_0x601b('0xb'));var trunk=require(_0x601b('0xc'));var trigger=require(_0x601b('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x601b('0xe'));var campaign=require(_0x601b('0xf'));var voiceExtension=require(_0x601b('0x10'));var faxAccount=require(_0x601b('0x11'));var zendesk=require(_0x601b('0x12'));var salesforce=require(_0x601b('0x13'));var sugarcrm=require(_0x601b('0x14'));var freshdesk=require(_0x601b('0x15'));var desk=require(_0x601b('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x601b('0x17'));var freshsales=require(_0x601b('0x18'));var servicenow=require(_0x601b('0x19'));var dynamics365=require(_0x601b('0x1a'));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(_0x601b('0x1b'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x601b('0x1c')](_0x601b('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x601b('0x1c')](_0x601b('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x601b('0x1e')]()[_0x601b('0x1f')](user['getAgents']())['then'](realtime['initAgents']())[_0x601b('0x1f')](user[_0x601b('0x20')]())['then'](realtime[_0x601b('0x21')]())['then'](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x601b('0x1f')](voiceQueue['getVoiceQueues']())[_0x601b('0x1f')](realtime[_0x601b('0x22')]())['then'](trigger[_0x601b('0x23')]())[_0x601b('0x1f')](realtime[_0x601b('0x24')]())['then'](template[_0x601b('0x25')]())[_0x601b('0x1f')](realtime['initTemplates']())['then'](zendesk[_0x601b('0x26')]())['then'](realtime[_0x601b('0x27')]())[_0x601b('0x1f')](salesforce['getSalesforceAccounts']())[_0x601b('0x1f')](realtime['initSalesforceAccounts']())[_0x601b('0x1f')](sugarcrm[_0x601b('0x28')]())[_0x601b('0x1f')](realtime['initSugarcrmAccounts']())[_0x601b('0x1f')](freshdesk[_0x601b('0x29')]())[_0x601b('0x1f')](realtime['initFreshdeskAccounts']())['then'](desk[_0x601b('0x2a')]())['then'](realtime['initDeskAccounts']())[_0x601b('0x1f')](zoho[_0x601b('0x2b')]())[_0x601b('0x1f')](realtime[_0x601b('0x2c')]())[_0x601b('0x1f')](vtiger[_0x601b('0x2d')]())[_0x601b('0x1f')](realtime[_0x601b('0x2e')]())[_0x601b('0x1f')](freshsales[_0x601b('0x2f')]())[_0x601b('0x1f')](realtime['initFreshsalesAccounts']())[_0x601b('0x1f')](servicenow[_0x601b('0x30')]())[_0x601b('0x1f')](realtime[_0x601b('0x31')]())[_0x601b('0x1f')](dynamics365[_0x601b('0x32')]())[_0x601b('0x1f')](realtime['initDynamics365Accounts']())[_0x601b('0x1f')](campaign[_0x601b('0x33')]())[_0x601b('0x1f')](realtime['initCampaigns']())[_0x601b('0x1f')](voiceExtension[_0x601b('0x34')]())['then'](realtime[_0x601b('0x35')]())[_0x601b('0x1f')](faxAccount[_0x601b('0x36')]())[_0x601b('0x1f')](realtime[_0x601b('0x37')]())[_0x601b('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0x601b('0x1e')]()[_0x601b('0x1f')](voiceQueueReport['getVoiceQueueReports']())[_0x601b('0x1f')](realtime[_0x601b('0x38')]())['then'](cmHopperHistory[_0x601b('0x39')]())[_0x601b('0x1f')](realtime[_0x601b('0x3a')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x601b('0x1f')](realtime[_0x601b('0x3b')]())[_0x601b('0x1f')](voiceCallReport[_0x601b('0x3c')]())['then'](realtime[_0x601b('0x3d')]())[_0x601b('0x3e')](function(_0x393aec){logger[_0x601b('0x3f')]('[index.js][initParams]',util[_0x601b('0x40')](_0x393aec,{'showHidden':![],'depth':null}));});}function main(){return server[_0x601b('0x41')](realtime,preview,fax)[_0x601b('0x1f')](function(){return initRealtime();})[_0x601b('0x1f')](function(){return initParams();})[_0x601b('0x1f')](function(){report[_0x601b('0x42')]();setInterval(initRealtime,0x1388);})[_0x601b('0x3e')](function(_0x35804d){logger['error']('[index.js][main]',util[_0x601b('0x40')](_0x35804d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xdbf7=['./realtime','./report','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./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','ami','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','moment'];(function(_0x1372f9,_0x15cf0b){var _0x2112fa=function(_0x1e1c15){while(--_0x1e1c15){_0x1372f9['push'](_0x1372f9['shift']());}};_0x2112fa(++_0x15cf0b);}(_0xdbf7,0x89));var _0x7dbf=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0xdbf7[_0x5c14f6];return _0x4949b3;};'use strict';var util=require('util');var moment=require(_0x7dbf('0x0'));var server=require('./server');var Realtime=require(_0x7dbf('0x1'));var Report=require(_0x7dbf('0x2'));var Acw=require('./acw');var Trigger=require(_0x7dbf('0x3'));var Dialer=require('./dialer');var Preview=require(_0x7dbf('0x4'));var Fax=require(_0x7dbf('0x5'));var user=require(_0x7dbf('0x6'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x7dbf('0x7'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x7dbf('0x8'));var trigger=require('./rpc/trigger');var template=require(_0x7dbf('0x9'));var cmHopperHistory=require(_0x7dbf('0xa'));var campaign=require(_0x7dbf('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7dbf('0xc'));var zendesk=require(_0x7dbf('0xd'));var salesforce=require(_0x7dbf('0xe'));var sugarcrm=require(_0x7dbf('0xf'));var freshdesk=require(_0x7dbf('0x10'));var desk=require(_0x7dbf('0x11'));var zoho=require(_0x7dbf('0x12'));var vtiger=require(_0x7dbf('0x13'));var freshsales=require(_0x7dbf('0x14'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x7dbf('0x15'));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('../../config/logger')(_0x7dbf('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x7dbf('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x7dbf('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x7dbf('0x18')](user[_0x7dbf('0x19')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x1a')]())[_0x7dbf('0x18')](user[_0x7dbf('0x1b')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x1c')]())[_0x7dbf('0x18')](trunk[_0x7dbf('0x1d')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x1e')]())['then'](voiceQueue[_0x7dbf('0x1f')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x20')]())[_0x7dbf('0x18')](trigger['getTriggers']())[_0x7dbf('0x18')](realtime[_0x7dbf('0x21')]())[_0x7dbf('0x18')](template['getTemplates']())['then'](realtime['initTemplates']())[_0x7dbf('0x18')](zendesk[_0x7dbf('0x22')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x23')]())[_0x7dbf('0x18')](salesforce[_0x7dbf('0x24')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x25')]())[_0x7dbf('0x18')](sugarcrm[_0x7dbf('0x26')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x27')]())['then'](freshdesk[_0x7dbf('0x28')]())[_0x7dbf('0x18')](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())[_0x7dbf('0x18')](realtime[_0x7dbf('0x29')]())[_0x7dbf('0x18')](zoho[_0x7dbf('0x2a')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x2b')]())['then'](vtiger[_0x7dbf('0x2c')]())[_0x7dbf('0x18')](realtime['initVtigerAccounts']())[_0x7dbf('0x18')](freshsales[_0x7dbf('0x2d')]())[_0x7dbf('0x18')](realtime['initFreshsalesAccounts']())[_0x7dbf('0x18')](servicenow['getServicenowAccounts']())[_0x7dbf('0x18')](realtime[_0x7dbf('0x2e')]())[_0x7dbf('0x18')](dynamics365[_0x7dbf('0x2f')]())[_0x7dbf('0x18')](realtime['initDynamics365Accounts']())[_0x7dbf('0x18')](campaign[_0x7dbf('0x30')]())['then'](realtime[_0x7dbf('0x31')]())['then'](voiceExtension[_0x7dbf('0x32')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x33')]())[_0x7dbf('0x18')](faxAccount[_0x7dbf('0x34')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x35')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x7dbf('0x18')](voiceQueueReport[_0x7dbf('0x36')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x37')]())['then'](cmHopperHistory[_0x7dbf('0x38')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x39')]())[_0x7dbf('0x18')](cmHopperHistory[_0x7dbf('0x3a')]())['then'](realtime[_0x7dbf('0x3b')]())[_0x7dbf('0x18')](voiceCallReport[_0x7dbf('0x3c')]())[_0x7dbf('0x18')](realtime[_0x7dbf('0x3d')]())[_0x7dbf('0x3e')](function(_0x4964dc){logger[_0x7dbf('0x3f')](_0x7dbf('0x40'),util[_0x7dbf('0x41')](_0x4964dc,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7dbf('0x42')](realtime,preview,fax)[_0x7dbf('0x18')](function(){return initRealtime();})[_0x7dbf('0x18')](function(){return initParams();})['then'](function(){report[_0x7dbf('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2e1513){logger[_0x7dbf('0x3f')](_0x7dbf('0x44'),util[_0x7dbf('0x41')](_0x2e1513,{'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 a8ffc0e..4484ccc 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 _0x7759=['voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','format','email','address','interface','stringify','user:%s','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','accountcode','fullname','state','unknown','stateTime','status','mobile','online','voiceStatus','voiceStatusTime'];(function(_0x4d089e,_0x33fb0e){var _0x14115d=function(_0x1c7638){while(--_0x1c7638){_0x4d089e['push'](_0x4d089e['shift']());}};_0x14115d(++_0x33fb0e);}(_0x7759,0x143));var _0x9775=function(_0x90bd5d,_0x14551a){_0x90bd5d=_0x90bd5d-0x0;var _0x325766=_0x7759[_0x90bd5d];return _0x325766;};'use strict';var _=require(_0x9775('0x0'));var util=require('util');var moment=require(_0x9775('0x1'));var md5=require(_0x9775('0x2'));var Redis=require(_0x9775('0x3'));var config=require(_0x9775('0x4'));config[_0x9775('0x5')]=_[_0x9775('0x6')](config[_0x9775('0x5')],{'host':_0x9775('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x2543f1){this['id']=_0x2543f1['id']||0x0;this['name']=_0x2543f1[_0x9775('0x8')]||'';this['email']=_0x2543f1['email']||'';this[_0x9775('0x9')]=_0x2543f1[_0x9775('0x9')]||'';this[_0x9775('0xa')]=_0x2543f1['fullname']||'';this[_0x9775('0xb')]=_0x9775('0xc');this[_0x9775('0xd')]=0x0;this[_0x9775('0xe')]=_0x9775('0xc');this['address']='';this['phone']='';this[_0x9775('0xf')]='';this['interface']='';this[_0x9775('0x10')]=_0x2543f1[_0x9775('0x10')]||![];this[_0x9775('0x11')]=_0x9775('0xc');this[_0x9775('0x12')]=0x0;this[_0x9775('0x13')]='';this[_0x9775('0x14')]='';this[_0x9775('0x15')]=![];this[_0x9775('0x16')]=![];this[_0x9775('0x2')]='';}Agent[_0x9775('0x17')][_0x9775('0x18')]=function(_0x116e4f){var _0x443a8d;if(_0x116e4f&&_0x116e4f[_0x9775('0xb')]){_0x443a8d=_0x116e4f[_0x9775('0xb')][_0x9775('0x19')]();switch(_0x443a8d){case _0x9775('0x1a'):_0x443a8d=_0x9775('0x1b');break;case _0x9775('0x1c'):_0x443a8d='talking';break;}}if(_0x443a8d&&this[_0x9775('0x11')]!==_0x443a8d||_0x116e4f[_0x9775('0x1d')]){this[_0x9775('0x12')]=_['toNumber'](moment()[_0x9775('0x1e')]('x'));}if(_0x443a8d){this[_0x9775('0x11')]=_0x443a8d;}var _0xe79ca7={'id':this['id'],'name':this[_0x9775('0x8')],'email':this[_0x9775('0x1f')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x9775('0xd')],'status':this[_0x9775('0xe')],'address':this[_0x9775('0x20')],'online':this[_0x9775('0x10')],'voiceStatus':this[_0x9775('0x11')],'voiceStatusTime':this[_0x9775('0x12')],'voiceStatusCallerIdNumber':this[_0x9775('0x13')],'voiceStatusQueue':this[_0x9775('0x14')],'interface':this[_0x9775('0x21')],'onhold':this[_0x9775('0x15')]};var _0x1f28b4=md5(JSON[_0x9775('0x22')](_0xe79ca7));if(this[_0x9775('0x2')]!==_0x1f28b4){this['md5']=_0x1f28b4;io['to'](util[_0x9775('0x1e')](_0x9775('0x23'),_0xe79ca7['name']))['emit']('user:save',_0xe79ca7);io[_0x9775('0x24')]('user:presence',_0xe79ca7);}};module[_0x9775('0x25')]=Agent; \ No newline at end of file +var _0x96f1=['util','moment','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','status','address','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','stateTime','stringify','emit','user:save','user:presence'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x96f1,0x10a));var _0x196f=function(_0x5b3928,_0x24b38b){_0x5b3928=_0x5b3928-0x0;var _0x33799d=_0x96f1[_0x5b3928];return _0x33799d;};'use strict';var _=require('lodash');var util=require(_0x196f('0x0'));var moment=require(_0x196f('0x1'));var md5=require('md5');var Redis=require(_0x196f('0x2'));var config=require(_0x196f('0x3'));config['redis']=_[_0x196f('0x4')](config['redis'],{'host':_0x196f('0x5'),'port':0x18eb});var io=require(_0x196f('0x6'))(new Redis(config['redis']));function Agent(_0x4d2346){this['id']=_0x4d2346['id']||0x0;this['name']=_0x4d2346[_0x196f('0x7')]||'';this[_0x196f('0x8')]=_0x4d2346[_0x196f('0x8')]||'';this[_0x196f('0x9')]=_0x4d2346[_0x196f('0x9')]||'';this[_0x196f('0xa')]=_0x4d2346[_0x196f('0xa')]||'';this[_0x196f('0xb')]=_0x196f('0xc');this['stateTime']=0x0;this[_0x196f('0xd')]=_0x196f('0xc');this[_0x196f('0xe')]='';this['phone']='';this[_0x196f('0xf')]='';this[_0x196f('0x10')]='';this[_0x196f('0x11')]=_0x4d2346['online']||![];this['voiceStatus']=_0x196f('0xc');this[_0x196f('0x12')]=0x0;this[_0x196f('0x13')]='';this[_0x196f('0x14')]='';this[_0x196f('0x15')]=![];this[_0x196f('0x16')]=![];this[_0x196f('0x17')]='';}Agent[_0x196f('0x18')][_0x196f('0x19')]=function(_0x2ab1e3){var _0x52d141;if(_0x2ab1e3&&_0x2ab1e3[_0x196f('0xb')]){_0x52d141=_0x2ab1e3['state']['toLowerCase']();switch(_0x52d141){case _0x196f('0x1a'):_0x52d141=_0x196f('0x1b');break;case _0x196f('0x1c'):_0x52d141=_0x196f('0x1d');break;}}if(_0x52d141&&this[_0x196f('0x1e')]!==_0x52d141||_0x2ab1e3[_0x196f('0x1f')]){this[_0x196f('0x12')]=_[_0x196f('0x20')](moment()['format']('x'));}if(_0x52d141){this['voiceStatus']=_0x52d141;}var _0x361648={'id':this['id'],'name':this[_0x196f('0x7')],'email':this[_0x196f('0x8')],'accountcode':this[_0x196f('0x9')],'fullname':this[_0x196f('0xa')],'state':this['state'],'stateTime':this[_0x196f('0x21')],'status':this[_0x196f('0xd')],'address':this[_0x196f('0xe')],'online':this[_0x196f('0x11')],'voiceStatus':this[_0x196f('0x1e')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x196f('0x13')],'voiceStatusQueue':this[_0x196f('0x14')],'interface':this[_0x196f('0x10')],'onhold':this[_0x196f('0x15')]};var _0x411dcd=md5(JSON[_0x196f('0x22')](_0x361648));if(this[_0x196f('0x17')]!==_0x411dcd){this[_0x196f('0x17')]=_0x411dcd;io['to'](util['format']('user:%s',_0x361648['name']))[_0x196f('0x23')](_0x196f('0x24'),_0x361648);io[_0x196f('0x23')](_0x196f('0x25'),_0x361648);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a196113..95d7509 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 _0xcef4=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xcef4,0x1b6));var _0x4cef=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0xcef4[_0x1b92a6];return _0x24be5b;};'use strict';function Campaign(_0x31e222){this['id']=_0x31e222['id']||0x0;this[_0x4cef('0x0')]=_0x31e222[_0x4cef('0x0')]||'';this[_0x4cef('0x1')]=_0x31e222[_0x4cef('0x1')]||_0x4cef('0x2');this[_0x4cef('0x3')]=0x0;this[_0x4cef('0x4')]=0x0;this[_0x4cef('0x5')]=0x0;this[_0x4cef('0x6')]=0x0;this[_0x4cef('0x7')]='';this[_0x4cef('0x8')]=!![];this[_0x4cef('0x9')]=_0x31e222['active'];this[_0x4cef('0xa')]=_0x31e222[_0x4cef('0xa')];this[_0x4cef('0xb')]=_0x31e222[_0x4cef('0xb')]||null;this[_0x4cef('0xc')]=_0x31e222[_0x4cef('0xc')]?_0x31e222[_0x4cef('0xc')]:null;this[_0x4cef('0xd')]=_0x31e222[_0x4cef('0xd')];this[_0x4cef('0xe')]=_0x31e222[_0x4cef('0xe')];this['dialOriginateTimeout']=_0x31e222[_0x4cef('0xf')]||0x1e;this[_0x4cef('0x10')]=_0x31e222[_0x4cef('0x10')];this[_0x4cef('0x11')]=_0x31e222[_0x4cef('0x11')];this[_0x4cef('0x12')]=_0x31e222['dialBusyMaxRetry'];this[_0x4cef('0x13')]=_0x31e222[_0x4cef('0x13')];this[_0x4cef('0x14')]=_0x31e222[_0x4cef('0x14')];this[_0x4cef('0x15')]=_0x31e222[_0x4cef('0x15')];this[_0x4cef('0x16')]=_0x31e222[_0x4cef('0x16')];this[_0x4cef('0x17')]=_0x31e222['dialNoSuchNumberMaxRetry']||0x3;this[_0x4cef('0x18')]=_0x31e222[_0x4cef('0x18')]||0x96;this[_0x4cef('0x19')]=_0x31e222[_0x4cef('0x19')]||0x3;this[_0x4cef('0x1a')]=_0x31e222[_0x4cef('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x31e222['dialAbandonedMaxRetry']||0x3;this[_0x4cef('0x1b')]=_0x31e222['dialAbandonedRetryFrequency']||0x96;this[_0x4cef('0x1c')]=_0x31e222[_0x4cef('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x31e222[_0x4cef('0x1d')]||0x96;this[_0x4cef('0x1e')]=_0x31e222[_0x4cef('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x31e222[_0x4cef('0x1f')]||0x96;this[_0x4cef('0x20')]=_0x31e222[_0x4cef('0x20')]||'DESC';this[_0x4cef('0x21')]=_0x31e222[_0x4cef('0x21')]||undefined;this[_0x4cef('0x22')]=_0x31e222[_0x4cef('0x22')]||undefined;this[_0x4cef('0x23')]=_0x31e222[_0x4cef('0x23')]||undefined;this[_0x4cef('0x24')]=_0x31e222['TrunkBackup']?_0x31e222[_0x4cef('0x24')]:undefined;this[_0x4cef('0x25')]=_0x31e222[_0x4cef('0x25')]?_0x31e222['Trunk']:undefined;this[_0x4cef('0x26')]=_0x31e222['Interval']?_0x31e222['Interval']:undefined;this[_0x4cef('0x27')]=_0x31e222[_0x4cef('0x27')]?_0x31e222[_0x4cef('0x27')]:undefined;this[_0x4cef('0x28')]=_0x31e222[_0x4cef('0x27')]?_0x31e222[_0x4cef('0x27')][_0x4cef('0x0')]:undefined;this[_0x4cef('0x29')]=_0x31e222[_0x4cef('0x29')]||![];this['dialAMDInitialSilence']=_0x31e222[_0x4cef('0x2a')];this['dialAMDGreeting']=_0x31e222[_0x4cef('0x2b')];this['dialAMDAfterGreetingSilence']=_0x31e222[_0x4cef('0x2c')];this['dialAMDTotalAnalysisTime']=_0x31e222[_0x4cef('0x2d')];this[_0x4cef('0x2e')]=_0x31e222['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x31e222['dialAMDBetweenWordsSilence'];this[_0x4cef('0x2f')]=_0x31e222[_0x4cef('0x2f')];this[_0x4cef('0x30')]=_0x31e222['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x31e222['dialAMDMaximumWordLength'];}module[_0x4cef('0x31')]=Campaign; \ No newline at end of file +var _0x6f29=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x1fe822,_0x5c3e18){var _0xb31b4=function(_0x172e35){while(--_0x172e35){_0x1fe822['push'](_0x1fe822['shift']());}};_0xb31b4(++_0x5c3e18);}(_0x6f29,0x87));var _0x96f2=function(_0x33c98e,_0x4eb3d0){_0x33c98e=_0x33c98e-0x0;var _0x39a756=_0x6f29[_0x33c98e];return _0x39a756;};'use strict';function Campaign(_0x5262bf){this['id']=_0x5262bf['id']||0x0;this['name']=_0x5262bf['name']||'';this[_0x96f2('0x0')]=_0x5262bf[_0x96f2('0x0')]||'campaign';this[_0x96f2('0x1')]=0x0;this[_0x96f2('0x2')]=0x0;this[_0x96f2('0x3')]=0x0;this[_0x96f2('0x4')]=0x0;this[_0x96f2('0x5')]='';this[_0x96f2('0x6')]=!![];this[_0x96f2('0x7')]=_0x5262bf[_0x96f2('0x7')];this[_0x96f2('0x8')]=_0x5262bf['limitCalls'];this['dialTimezone']=_0x5262bf[_0x96f2('0x9')]||null;this[_0x96f2('0xa')]=_0x5262bf[_0x96f2('0xa')]?_0x5262bf[_0x96f2('0xa')]:null;this[_0x96f2('0xb')]=_0x5262bf[_0x96f2('0xb')];this[_0x96f2('0xc')]=_0x5262bf[_0x96f2('0xc')];this[_0x96f2('0xd')]=_0x5262bf[_0x96f2('0xd')]||0x1e;this[_0x96f2('0xe')]=_0x5262bf[_0x96f2('0xe')];this[_0x96f2('0xf')]=_0x5262bf[_0x96f2('0xf')];this[_0x96f2('0x10')]=_0x5262bf[_0x96f2('0x10')];this['dialBusyRetryFrequency']=_0x5262bf['dialBusyRetryFrequency'];this[_0x96f2('0x11')]=_0x5262bf[_0x96f2('0x11')];this['dialNoAnswerRetryFrequency']=_0x5262bf[_0x96f2('0x12')];this[_0x96f2('0x13')]=_0x5262bf['dialGlobalMaxRetry'];this[_0x96f2('0x14')]=_0x5262bf['dialNoSuchNumberMaxRetry']||0x3;this[_0x96f2('0x15')]=_0x5262bf[_0x96f2('0x15')]||0x96;this[_0x96f2('0x16')]=_0x5262bf[_0x96f2('0x16')]||0x3;this[_0x96f2('0x17')]=_0x5262bf['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x5262bf[_0x96f2('0x18')]||0x3;this[_0x96f2('0x19')]=_0x5262bf[_0x96f2('0x19')]||0x96;this[_0x96f2('0x1a')]=_0x5262bf[_0x96f2('0x1a')]||0x3;this[_0x96f2('0x1b')]=_0x5262bf['dialMachineRetryFrequency']||0x96;this[_0x96f2('0x1c')]=_0x5262bf[_0x96f2('0x1c')]||0x3;this[_0x96f2('0x1d')]=_0x5262bf['dialAgentRejectRetryFrequency']||0x96;this[_0x96f2('0x1e')]=_0x5262bf[_0x96f2('0x1e')]||'DESC';this[_0x96f2('0x1f')]=_0x5262bf[_0x96f2('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5262bf[_0x96f2('0x20')]||undefined;this[_0x96f2('0x21')]=_0x5262bf[_0x96f2('0x21')]||undefined;this['TrunkBackup']=_0x5262bf[_0x96f2('0x22')]?_0x5262bf[_0x96f2('0x22')]:undefined;this[_0x96f2('0x23')]=_0x5262bf[_0x96f2('0x23')]?_0x5262bf['Trunk']:undefined;this[_0x96f2('0x24')]=_0x5262bf[_0x96f2('0x24')]?_0x5262bf[_0x96f2('0x24')]:undefined;this[_0x96f2('0x25')]=_0x5262bf[_0x96f2('0x25')]?_0x5262bf['SquareProject']:undefined;this[_0x96f2('0x26')]=_0x5262bf[_0x96f2('0x25')]?_0x5262bf[_0x96f2('0x25')][_0x96f2('0x27')]:undefined;this[_0x96f2('0x28')]=_0x5262bf[_0x96f2('0x28')]||![];this[_0x96f2('0x29')]=_0x5262bf[_0x96f2('0x29')];this[_0x96f2('0x2a')]=_0x5262bf['dialAMDGreeting'];this[_0x96f2('0x2b')]=_0x5262bf[_0x96f2('0x2b')];this[_0x96f2('0x2c')]=_0x5262bf[_0x96f2('0x2c')];this[_0x96f2('0x2d')]=_0x5262bf['dialAMDMinWordLength'];this[_0x96f2('0x2e')]=_0x5262bf[_0x96f2('0x2e')];this[_0x96f2('0x2f')]=_0x5262bf['dialAMDMaximumNumberOfWords'];this[_0x96f2('0x30')]=_0x5262bf['dialAMDSilenceThreshold'];this[_0x96f2('0x31')]=_0x5262bf[_0x96f2('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 7df9926..1290f43 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 _0xcdd2=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime','unmanaged','abandoned','billableseconds','type','tag','disposition','monitor'];(function(_0x27ba11,_0x55c24f){var _0x2a8afb=function(_0x5d1e58){while(--_0x5d1e58){_0x27ba11['push'](_0x27ba11['shift']());}};_0x2a8afb(++_0x55c24f);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this[_0x2cdd('0x0')]=null;this[_0x2cdd('0x1')]='';this[_0x2cdd('0x2')]='';this[_0x2cdd('0x3')]=0x0;this['calleridname']='';this[_0x2cdd('0x4')]=undefined;this[_0x2cdd('0x5')]=undefined;this[_0x2cdd('0x6')]=0x0;this[_0x2cdd('0x7')]='';this['uniqueid']=0x0;this[_0x2cdd('0x8')]=0x0;this[_0x2cdd('0x9')]=0x0;this['answered']=![];this[_0x2cdd('0xa')]=null;this[_0x2cdd('0xb')]=null;this[_0x2cdd('0xc')]=![];this[_0x2cdd('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0x2cdd('0xe')]=0x0;this['holdtime']=0x0;this[_0x2cdd('0xf')]=null;this[_0x2cdd('0x10')]=null;this[_0x2cdd('0x11')]=null;this[_0x2cdd('0x12')]=![];this[_0x2cdd('0x13')]=null;this[_0x2cdd('0x14')]=null;this[_0x2cdd('0x15')]=[];this[_0x2cdd('0x16')]=undefined;this[_0x2cdd('0x17')]=undefined;this[_0x2cdd('0x18')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x75ff=['context','linkedid','exten','answered','unmanaged','lastapplication','duration','billableseconds','holdtime','type','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x75ff,0x131));var _0xf75f=function(_0xdbce8,_0x550d11){_0xdbce8=_0xdbce8-0x0;var _0x4e8866=_0x75ff[_0xdbce8];return _0x4e8866;};'use strict';function Channel(){this[_0xf75f('0x0')]=null;this[_0xf75f('0x1')]='';this[_0xf75f('0x2')]='';this[_0xf75f('0x3')]=0x0;this[_0xf75f('0x4')]='';this['connectedlinenum']=undefined;this[_0xf75f('0x5')]=undefined;this[_0xf75f('0x6')]=0x0;this[_0xf75f('0x7')]='';this['uniqueid']=0x0;this[_0xf75f('0x8')]=0x0;this[_0xf75f('0x9')]=0x0;this[_0xf75f('0xa')]=![];this['answertime']=null;this['endtime']=null;this[_0xf75f('0xb')]=![];this['abandoned']=![];this[_0xf75f('0xc')]='';this['lastdata']='';this[_0xf75f('0xd')]=0x0;this[_0xf75f('0xe')]=0x0;this[_0xf75f('0xf')]=0x0;this[_0xf75f('0x10')]=null;this['tag']=null;this[_0xf75f('0x11')]=null;this[_0xf75f('0x12')]=![];this['monitorFilename']=null;this['queue']=null;this[_0xf75f('0x13')]=[];this[_0xf75f('0x14')]=undefined;this[_0xf75f('0x15')]=undefined;this['transferType']=undefined;this[_0xf75f('0x16')]=0x0;}module[_0xf75f('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0162947..35366a3 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 _0x3f1b=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x447254,_0x5746e2){var _0xcbd654=function(_0x4d92db){while(--_0x4d92db){_0x447254['push'](_0x447254['shift']());}};_0xcbd654(++_0x5746e2);}(_0x3f1b,0x1f1));var _0xb3f1=function(_0x227118,_0x4be2ed){_0x227118=_0x227118-0x0;var _0x7345fb=_0x3f1b[_0x227118];return _0x7345fb;};'use strict';function DeskAccount(_0x47bc39){this['id']=_0x47bc39['id']||0x0;this[_0xb3f1('0x0')]=_0x47bc39[_0xb3f1('0x0')]||'';this['username']=_0x47bc39[_0xb3f1('0x1')]||'';this[_0xb3f1('0x2')]=_0x47bc39['remoteUri']||'';this[_0xb3f1('0x3')]=_0x47bc39['authType']||'';this[_0xb3f1('0x4')]=_0x47bc39['password']||'';this[_0xb3f1('0x5')]=_0x47bc39['consumerKey']||'';this[_0xb3f1('0x6')]=_0x47bc39[_0xb3f1('0x6')]||'';this[_0xb3f1('0x7')]=_0x47bc39[_0xb3f1('0x7')]||'';this[_0xb3f1('0x8')]=_0x47bc39['tokenSecret']||'';this[_0xb3f1('0x9')]=_0x47bc39[_0xb3f1('0x9')]||'';this[_0xb3f1('0xa')]=_0x47bc39['serverUrl']||'';this[_0xb3f1('0xb')]=_0x47bc39[_0xb3f1('0xb')]||{};}module[_0xb3f1('0xc')]=DeskAccount; \ No newline at end of file +var _0x6ef1=['tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x49ff38,_0x20cb86){var _0x775dea=function(_0x2dd175){while(--_0x2dd175){_0x49ff38['push'](_0x49ff38['shift']());}};_0x775dea(++_0x20cb86);}(_0x6ef1,0x88));var _0x16ef=function(_0x1c3925,_0x41a777){_0x1c3925=_0x1c3925-0x0;var _0x450051=_0x6ef1[_0x1c3925];return _0x450051;};'use strict';function DeskAccount(_0x362630){this['id']=_0x362630['id']||0x0;this[_0x16ef('0x0')]=_0x362630['name']||'';this[_0x16ef('0x1')]=_0x362630[_0x16ef('0x1')]||'';this['remoteUri']=_0x362630[_0x16ef('0x2')]||'';this['authType']=_0x362630[_0x16ef('0x3')]||'';this[_0x16ef('0x4')]=_0x362630[_0x16ef('0x4')]||'';this[_0x16ef('0x5')]=_0x362630['consumerKey']||'';this['consumerSecret']=_0x362630[_0x16ef('0x6')]||'';this['token']=_0x362630[_0x16ef('0x7')]||'';this[_0x16ef('0x8')]=_0x362630['tokenSecret']||'';this[_0x16ef('0x9')]=_0x362630['type']||'';this[_0x16ef('0xa')]=_0x362630['serverUrl']||'';this['Configurations']=_0x362630[_0x16ef('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 7d1f776..c23234a 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 _0x8ee7=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x452a9c,_0x246fa6){var _0x204bf1=function(_0x39750e){while(--_0x39750e){_0x452a9c['push'](_0x452a9c['shift']());}};_0x204bf1(++_0x246fa6);}(_0x8ee7,0x14e));var _0x78ee=function(_0x1407e2,_0x38db9e){_0x1407e2=_0x1407e2-0x0;var _0x1f1a3a=_0x8ee7[_0x1407e2];return _0x1f1a3a;};'use strict';function Dynamics365Account(_0x54826a){this['id']=_0x54826a['id']||0x0;this[_0x78ee('0x0')]=_0x54826a[_0x78ee('0x0')]||'';this['username']=_0x54826a[_0x78ee('0x1')]||'';this['password']=_0x54826a[_0x78ee('0x2')]||'';this[_0x78ee('0x3')]=_0x54826a['remoteUri']||'';this[_0x78ee('0x4')]=_0x54826a[_0x78ee('0x4')]||'';this[_0x78ee('0x5')]=_0x54826a[_0x78ee('0x5')]||'';this[_0x78ee('0x6')]=_0x54826a['clientSecret']||{};this[_0x78ee('0x7')]=_0x54826a[_0x78ee('0x7')]||'';this[_0x78ee('0x8')]=_0x54826a['modernAuthentication']||![];this[_0x78ee('0x9')]=_0x54826a['Configurations']||{};this['CloudProvider']=_0x54826a[_0x78ee('0xa')]||{};}module[_0x78ee('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xfb6b=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x4b10e8,_0x4e54f8){var _0x2b1951=function(_0x3d2e14){while(--_0x3d2e14){_0x4b10e8['push'](_0x4b10e8['shift']());}};_0x2b1951(++_0x4e54f8);}(_0xfb6b,0x19a));var _0xbfb6=function(_0x3ae62a,_0x319705){_0x3ae62a=_0x3ae62a-0x0;var _0xe694a6=_0xfb6b[_0x3ae62a];return _0xe694a6;};'use strict';function Dynamics365Account(_0x12465d){this['id']=_0x12465d['id']||0x0;this['name']=_0x12465d[_0xbfb6('0x0')]||'';this['username']=_0x12465d[_0xbfb6('0x1')]||'';this['password']=_0x12465d[_0xbfb6('0x2')]||'';this[_0xbfb6('0x3')]=_0x12465d['remoteUri']||'';this[_0xbfb6('0x4')]=_0x12465d[_0xbfb6('0x4')]||'';this[_0xbfb6('0x5')]=_0x12465d[_0xbfb6('0x5')]||'';this[_0xbfb6('0x6')]=_0x12465d[_0xbfb6('0x6')]||{};this[_0xbfb6('0x7')]=_0x12465d[_0xbfb6('0x7')]||'';this['modernAuthentication']=_0x12465d[_0xbfb6('0x8')]||![];this['Configurations']=_0x12465d[_0xbfb6('0x9')]||{};this[_0xbfb6('0xa')]=_0x12465d[_0xbfb6('0xa')]||{};}module[_0xbfb6('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 3456db6..0cc409e 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 _0x4394=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','description'];(function(_0x17e7e0,_0x4248ee){var _0x886e37=function(_0x1c53d5){while(--_0x1c53d5){_0x17e7e0['push'](_0x17e7e0['shift']());}};_0x886e37(++_0x4248ee);}(_0x4394,0xdf));var _0x4439=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0x4394[_0x2e2104];return _0x1280c5;};'use strict';function FaxAccount(_0x1e6900){this['id']=_0x1e6900['id']||0x0;this['name']=_0x1e6900['name']||'';this[_0x4439('0x0')]=_0x1e6900[_0x4439('0x0')];this['ecm']=_0x1e6900[_0x4439('0x1')];this['headerinfo']=_0x1e6900[_0x4439('0x2')];this[_0x4439('0x3')]=_0x1e6900['localstationid'];this[_0x4439('0x4')]=_0x1e6900['minrate']||0x960;this['maxrate']=_0x1e6900[_0x4439('0x5')]||0x3840;this[_0x4439('0x6')]=_0x1e6900[_0x4439('0x6')]||_0x4439('0x7');this[_0x4439('0x8')]=_0x1e6900['gateway']||'no';this[_0x4439('0x9')]=_0x1e6900['faxdetect']||'no';this[_0x4439('0xa')]=_0x1e6900[_0x4439('0xa')]||0x1388;this[_0x4439('0xb')]=_0x1e6900['tech']||'SIP';this[_0x4439('0xc')]=_0x1e6900[_0x4439('0xc')]?_0x1e6900[_0x4439('0xc')]:undefined;this[_0x4439('0xd')]=_0x1e6900[_0x4439('0xd')];this[_0x4439('0xe')]=_0x1e6900['key'];}module[_0x4439('0xf')]=FaxAccount; \ No newline at end of file +var _0x5dc2=['t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x5e2fe5,_0x27e3a7){var _0xa30b87=function(_0x288682){while(--_0x288682){_0x5e2fe5['push'](_0x5e2fe5['shift']());}};_0xa30b87(++_0x27e3a7);}(_0x5dc2,0x1d1));var _0x25dc=function(_0x15fdac,_0x5115df){_0x15fdac=_0x15fdac-0x0;var _0x3503e9=_0x5dc2[_0x15fdac];return _0x3503e9;};'use strict';function FaxAccount(_0x4bb093){this['id']=_0x4bb093['id']||0x0;this[_0x25dc('0x0')]=_0x4bb093[_0x25dc('0x0')]||'';this[_0x25dc('0x1')]=_0x4bb093[_0x25dc('0x1')];this['ecm']=_0x4bb093[_0x25dc('0x2')];this[_0x25dc('0x3')]=_0x4bb093[_0x25dc('0x3')];this[_0x25dc('0x4')]=_0x4bb093[_0x25dc('0x4')];this[_0x25dc('0x5')]=_0x4bb093[_0x25dc('0x5')]||0x960;this['maxrate']=_0x4bb093[_0x25dc('0x6')]||0x3840;this[_0x25dc('0x7')]=_0x4bb093['modem']||_0x25dc('0x8');this['gateway']=_0x4bb093[_0x25dc('0x9')]||'no';this[_0x25dc('0xa')]=_0x4bb093[_0x25dc('0xa')]||'no';this[_0x25dc('0xb')]=_0x4bb093[_0x25dc('0xb')]||0x1388;this['tech']=_0x4bb093['tech']||_0x25dc('0xc');this[_0x25dc('0xd')]=_0x4bb093['Trunk']?_0x4bb093['Trunk']:undefined;this['ListId']=_0x4bb093[_0x25dc('0xe')];this[_0x25dc('0xf')]=_0x4bb093[_0x25dc('0xf')];}module[_0x25dc('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index da4ecff..9fb5b01 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 _0x2a4c=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2a4c,0x128));var _0xc2a4=function(_0x1a0475,_0x3e392a){_0x1a0475=_0x1a0475-0x0;var _0x449846=_0x2a4c[_0x1a0475];return _0x449846;};'use strict';function FreshdeskAccount(_0x15beeb){this['id']=_0x15beeb['id']||0x0;this[_0xc2a4('0x0')]=_0x15beeb[_0xc2a4('0x0')]||'';this[_0xc2a4('0x1')]=_0x15beeb[_0xc2a4('0x1')]||'';this['apiKey']=_0x15beeb['token']||'';this['remoteUri']=_0x15beeb[_0xc2a4('0x2')]||'';this[_0xc2a4('0x3')]=_0x15beeb['serverUrl']||'';this['Configurations']=_0x15beeb[_0xc2a4('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xa616=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1e6547,_0x208cf0){var _0x16ca43=function(_0x23cc8b){while(--_0x23cc8b){_0x1e6547['push'](_0x1e6547['shift']());}};_0x16ca43(++_0x208cf0);}(_0xa616,0xbd));var _0x6a61=function(_0x3fcc96,_0x1c65d4){_0x3fcc96=_0x3fcc96-0x0;var _0x5caa7a=_0xa616[_0x3fcc96];return _0x5caa7a;};'use strict';function FreshdeskAccount(_0x3a6402){this['id']=_0x3a6402['id']||0x0;this[_0x6a61('0x0')]=_0x3a6402[_0x6a61('0x0')]||'';this[_0x6a61('0x1')]=_0x3a6402[_0x6a61('0x1')]||'';this[_0x6a61('0x2')]=_0x3a6402[_0x6a61('0x3')]||'';this[_0x6a61('0x4')]=_0x3a6402['remoteUri']||'';this[_0x6a61('0x5')]=_0x3a6402[_0x6a61('0x5')]||'';this[_0x6a61('0x6')]=_0x3a6402['Configurations']||{};}module[_0x6a61('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 820314c..61bb05e 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 _0xd67b=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1ac674,_0x46c8f1){var _0x8d4afb=function(_0xc11334){while(--_0xc11334){_0x1ac674['push'](_0x1ac674['shift']());}};_0x8d4afb(++_0x46c8f1);}(_0xd67b,0x133));var _0xbd67=function(_0x2413ba,_0xc7e7a4){_0x2413ba=_0x2413ba-0x0;var _0x880f47=_0xd67b[_0x2413ba];return _0x880f47;};'use strict';function FreshsalesAccount(_0x1b2dbf){this['id']=_0x1b2dbf['id']||0x0;this[_0xbd67('0x0')]=_0x1b2dbf['name']||'';this[_0xbd67('0x1')]=_0x1b2dbf[_0xbd67('0x1')]||'';this[_0xbd67('0x2')]=_0x1b2dbf['token']||'';this[_0xbd67('0x3')]=_0x1b2dbf['remoteUri']||'';this[_0xbd67('0x4')]=_0x1b2dbf['serverUrl']||'';this[_0xbd67('0x5')]=_0x1b2dbf[_0xbd67('0x5')]||{};}module[_0xbd67('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x9b2a=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x23ca2f,_0x271c2b){var _0x4f4b51=function(_0x1cb6c0){while(--_0x1cb6c0){_0x23ca2f['push'](_0x23ca2f['shift']());}};_0x4f4b51(++_0x271c2b);}(_0x9b2a,0x127));var _0xa9b2=function(_0x413df4,_0x50c89a){_0x413df4=_0x413df4-0x0;var _0x4a5447=_0x9b2a[_0x413df4];return _0x4a5447;};'use strict';function FreshsalesAccount(_0x19fd42){this['id']=_0x19fd42['id']||0x0;this['name']=_0x19fd42[_0xa9b2('0x0')]||'';this[_0xa9b2('0x1')]=_0x19fd42[_0xa9b2('0x1')]||'';this['apiKey']=_0x19fd42[_0xa9b2('0x2')]||'';this[_0xa9b2('0x3')]=_0x19fd42['remoteUri']||'';this['serverUrl']=_0x19fd42[_0xa9b2('0x4')]||'';this[_0xa9b2('0x5')]=_0x19fd42[_0xa9b2('0x5')]||{};}module[_0xa9b2('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ae28ab3..65c757c 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 _0x864d=['originalposition','connectedlinenum','connectedlinename','accountcode','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','exports','type','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt'];(function(_0x3f8776,_0x1e8140){var _0x3abaa4=function(_0x59c15f){while(--_0x59c15f){_0x3f8776['push'](_0x3f8776['shift']());}};_0x3abaa4(++_0x1e8140);}(_0x864d,0x120));var _0xd864=function(_0x362480,_0x73fcd1){_0x362480=_0x362480-0x0;var _0x1dd0ba=_0x864d[_0x362480];return _0x1dd0ba;};'use strict';function QueueReport(){this[_0xd864('0x0')]=_0xd864('0x1');this[_0xd864('0x2')]='';this['calleridnum']='';this[_0xd864('0x3')]='';this['queue']='';this[_0xd864('0x4')]=null;this[_0xd864('0x5')]=null;this[_0xd864('0x6')]=0x1;this[_0xd864('0x7')]=0x1;this[_0xd864('0x8')]=![];this[_0xd864('0x9')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xd864('0xa')]=null;this[_0xd864('0xb')]=0x1;this['channel']='';this[_0xd864('0xc')]='';this[_0xd864('0xd')]='';this[_0xd864('0xe')]='';this['context']='';this[_0xd864('0xf')]='';this['priority']='';this[_0xd864('0x10')]=0x0;this[_0xd864('0x11')]=![];this[_0xd864('0x12')]='';this[_0xd864('0x13')]=_0xd864('0x14');this[_0xd864('0x15')]=null;this['mohtime']=0x0;this['variables']={};}module[_0xd864('0x16')]=QueueReport; \ No newline at end of file +var _0x8d09=['channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','routealias','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x8d09,0x1c6));var _0x98d0=function(_0x5ee0ee,_0x3ce413){_0x5ee0ee=_0x5ee0ee-0x0;var _0x198093=_0x8d09[_0x5ee0ee];return _0x198093;};'use strict';function QueueReport(){this['type']=_0x98d0('0x0');this[_0x98d0('0x1')]='';this[_0x98d0('0x2')]='';this[_0x98d0('0x3')]='';this[_0x98d0('0x4')]='';this[_0x98d0('0x5')]=null;this[_0x98d0('0x6')]=null;this[_0x98d0('0x7')]=0x1;this[_0x98d0('0x8')]=0x1;this[_0x98d0('0x9')]=![];this[_0x98d0('0xa')]=null;this[_0x98d0('0xb')]=![];this['queuecallercompleteAt']=null;this[_0x98d0('0xc')]=![];this['queuecallerexitAt']=null;this[_0x98d0('0xd')]=0x1;this[_0x98d0('0xe')]='';this[_0x98d0('0xf')]='';this[_0x98d0('0x10')]='';this['accountcode']='';this[_0x98d0('0x11')]='';this[_0x98d0('0x12')]='';this[_0x98d0('0x13')]='';this[_0x98d0('0x14')]=0x0;this['assigned']=![];this[_0x98d0('0x15')]='';this[_0x98d0('0x16')]=_0x98d0('0x17');this[_0x98d0('0x18')]=null;this['mohtime']=0x0;this['variables']={};}module[_0x98d0('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index fb8a5ab..86bb8c8 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 _0x72e4=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x3d0184,_0x5d4bab){var _0x530ef0=function(_0x29fed7){while(--_0x29fed7){_0x3d0184['push'](_0x3d0184['shift']());}};_0x530ef0(++_0x5d4bab);}(_0x72e4,0xae));var _0x472e=function(_0x3abe74,_0x57faaa){_0x3abe74=_0x3abe74-0x0;var _0xb0deee=_0x72e4[_0x3abe74];return _0xb0deee;};'use strict';function SalesforceAccount(_0x4991f8){this['id']=_0x4991f8['id']||0x0;this[_0x472e('0x0')]=_0x4991f8[_0x472e('0x0')]||'';this[_0x472e('0x1')]=_0x4991f8['username']||'';this[_0x472e('0x2')]=_0x4991f8['remoteUri']||'';this['password']=_0x4991f8[_0x472e('0x3')]||'';this['clientId']=_0x4991f8[_0x472e('0x4')]||'';this[_0x472e('0x5')]=_0x4991f8[_0x472e('0x5')]||'';this['securityToken']=_0x4991f8[_0x472e('0x6')]||'';this[_0x472e('0x7')]=_0x4991f8['type']||_0x472e('0x8');this[_0x472e('0x9')]=_0x4991f8[_0x472e('0x9')]||'';this['Configurations']=_0x4991f8[_0x472e('0xa')]||{};}module[_0x472e('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xe7d2=['password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0xe7d2,0x13c));var _0x2e7d=function(_0x55f31c,_0x5794b4){_0x55f31c=_0x55f31c-0x0;var _0x4bb516=_0xe7d2[_0x55f31c];return _0x4bb516;};'use strict';function SalesforceAccount(_0x4d26c7){this['id']=_0x4d26c7['id']||0x0;this[_0x2e7d('0x0')]=_0x4d26c7[_0x2e7d('0x0')]||'';this[_0x2e7d('0x1')]=_0x4d26c7[_0x2e7d('0x1')]||'';this[_0x2e7d('0x2')]=_0x4d26c7[_0x2e7d('0x2')]||'';this[_0x2e7d('0x3')]=_0x4d26c7[_0x2e7d('0x3')]||'';this['clientId']=_0x4d26c7[_0x2e7d('0x4')]||'';this[_0x2e7d('0x5')]=_0x4d26c7['clientSecret']||'';this[_0x2e7d('0x6')]=_0x4d26c7[_0x2e7d('0x6')]||'';this['type']=_0x4d26c7[_0x2e7d('0x7')]||'integrationTab';this[_0x2e7d('0x8')]=_0x4d26c7['serverUrl']||'';this[_0x2e7d('0x9')]=_0x4d26c7[_0x2e7d('0x9')]||{};}module[_0x2e7d('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index bc1edc9..41ed816 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 _0xc7bc=['password','remoteUri','serverUrl','name','username'];(function(_0x47666d,_0x2f374a){var _0x584e96=function(_0x535c5e){while(--_0x535c5e){_0x47666d['push'](_0x47666d['shift']());}};_0x584e96(++_0x2f374a);}(_0xc7bc,0x116));var _0xcc7b=function(_0x52b408,_0x22fe7e){_0x52b408=_0x52b408-0x0;var _0x403deb=_0xc7bc[_0x52b408];return _0x403deb;};'use strict';function ServicenowAccount(_0x3603db){this['id']=_0x3603db['id']||0x0;this[_0xcc7b('0x0')]=_0x3603db[_0xcc7b('0x0')]||'';this[_0xcc7b('0x1')]=_0x3603db[_0xcc7b('0x1')]||'';this[_0xcc7b('0x2')]=_0x3603db[_0xcc7b('0x2')]||'';this['remoteUri']=_0x3603db[_0xcc7b('0x3')]||'';this['serverUrl']=_0x3603db[_0xcc7b('0x4')]||'';this['Configurations']=_0x3603db['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xf70d=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x4b7dd5,_0x27195e){var _0x585ff0=function(_0x356164){while(--_0x356164){_0x4b7dd5['push'](_0x4b7dd5['shift']());}};_0x585ff0(++_0x27195e);}(_0xf70d,0xa9));var _0xdf70=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf70d[_0x1035c1];return _0x308d67;};'use strict';function ServicenowAccount(_0x5285cd){this['id']=_0x5285cd['id']||0x0;this[_0xdf70('0x0')]=_0x5285cd[_0xdf70('0x0')]||'';this['username']=_0x5285cd[_0xdf70('0x1')]||'';this[_0xdf70('0x2')]=_0x5285cd['password']||'';this['remoteUri']=_0x5285cd[_0xdf70('0x3')]||'';this[_0xdf70('0x4')]=_0x5285cd[_0xdf70('0x4')]||'';this[_0xdf70('0x5')]=_0x5285cd[_0xdf70('0x5')]||{};}module[_0xdf70('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fcd824a..ec33286 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 _0xf46d=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x386812,_0x27c823){var _0x4704d2=function(_0x513971){while(--_0x513971){_0x386812['push'](_0x386812['shift']());}};_0x4704d2(++_0x27c823);}(_0xf46d,0x1c3));var _0xdf46=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xf46d[_0x3e6d5d];return _0x238923;};'use strict';function SugarcrmAccount(_0x2c93cb){this['id']=_0x2c93cb['id']||0x0;this[_0xdf46('0x0')]=_0x2c93cb['name']||'';this[_0xdf46('0x1')]=_0x2c93cb[_0xdf46('0x1')]||'';this['password']=_0x2c93cb['password']||'';this[_0xdf46('0x2')]=_0x2c93cb[_0xdf46('0x2')]||'';this['serverUrl']=_0x2c93cb[_0xdf46('0x3')]||'';this[_0xdf46('0x4')]=_0x2c93cb[_0xdf46('0x4')]||{};}module[_0xdf46('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x07fb=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3bce26,_0x3aa048){var _0x22aa30=function(_0x5806d7){while(--_0x5806d7){_0x3bce26['push'](_0x3bce26['shift']());}};_0x22aa30(++_0x3aa048);}(_0x07fb,0x1e1));var _0xb07f=function(_0x260584,_0x587d66){_0x260584=_0x260584-0x0;var _0x22a679=_0x07fb[_0x260584];return _0x22a679;};'use strict';function SugarcrmAccount(_0x5a2e9b){this['id']=_0x5a2e9b['id']||0x0;this[_0xb07f('0x0')]=_0x5a2e9b[_0xb07f('0x0')]||'';this[_0xb07f('0x1')]=_0x5a2e9b[_0xb07f('0x1')]||'';this[_0xb07f('0x2')]=_0x5a2e9b['password']||'';this[_0xb07f('0x3')]=_0x5a2e9b[_0xb07f('0x3')]||'';this[_0xb07f('0x4')]=_0x5a2e9b[_0xb07f('0x4')]||'';this['Configurations']=_0x5a2e9b[_0xb07f('0x5')]||{};}module[_0xb07f('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 8364b77..2c43a96 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 _0xf630=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf630,0xf0));var _0x0f63=function(_0x545d44,_0x405d26){_0x545d44=_0x545d44-0x0;var _0x2492d8=_0xf630[_0x545d44];return _0x2492d8;};'use strict';function Telephone(_0xe0b951){this['id']=_0xe0b951['id']||0x0;this[_0x0f63('0x0')]=_0xe0b951[_0x0f63('0x0')]||'';this[_0x0f63('0x1')]=_0xe0b951[_0x0f63('0x1')]||'';this[_0x0f63('0x2')]=_0x0f63('0x3');this[_0x0f63('0x4')]=0x0;this[_0x0f63('0x5')]=_0x0f63('0x3');this[_0x0f63('0x6')]='';}module[_0x0f63('0x7')]=Telephone; \ No newline at end of file +var _0xb9f0=['name','accountcode','stateTime','status','exports'];(function(_0x7b4399,_0x3927df){var _0x4136b6=function(_0x21a50d){while(--_0x21a50d){_0x7b4399['push'](_0x7b4399['shift']());}};_0x4136b6(++_0x3927df);}(_0xb9f0,0xc8));var _0x0b9f=function(_0x3ebbd2,_0x18293c){_0x3ebbd2=_0x3ebbd2-0x0;var _0x5cc1ba=_0xb9f0[_0x3ebbd2];return _0x5cc1ba;};'use strict';function Telephone(_0x565d76){this['id']=_0x565d76['id']||0x0;this['name']=_0x565d76[_0x0b9f('0x0')]||'';this[_0x0b9f('0x1')]=_0x565d76[_0x0b9f('0x1')]||'';this['state']='unknown';this[_0x0b9f('0x2')]=0x0;this[_0x0b9f('0x3')]='unknown';this['address']='';}module[_0x0b9f('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index df5a372..a52a0a2 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 _0xb10b=['name','html'];(function(_0x1b77c0,_0xad4ba){var _0x499179=function(_0x4227f2){while(--_0x4227f2){_0x1b77c0['push'](_0x1b77c0['shift']());}};_0x499179(++_0xad4ba);}(_0xb10b,0x12a));var _0xbb10=function(_0xb4fe2c,_0x3d2be6){_0xb4fe2c=_0xb4fe2c-0x0;var _0x460a1a=_0xb10b[_0xb4fe2c];return _0x460a1a;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x3c30f1,_0x464c46){var _0x3a0e15=function(_0x55c26d){while(--_0x55c26d){_0x3c30f1['push'](_0x3c30f1['shift']());}};_0x3a0e15(++_0x464c46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 e6da2ae..c30fec4 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x588a05,_0x3755ad){var _0x4c126e=function(_0x5cdcd2){while(--_0x5cdcd2){_0x588a05['push'](_0x588a05['shift']());}};_0x4c126e(++_0x3755ad);}(_0xda3f,0xec));var _0xfda3=function(_0x35cd0c,_0x37fc61){_0x35cd0c=_0x35cd0c-0x0;var _0xef69bb=_0xda3f[_0x35cd0c];return _0xef69bb;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5e8fc,_0x1ccc06){_0x5e8fc=_0x5e8fc-0x0;var _0x41c58c=_0x5eb8[_0x5e8fc];return _0x41c58c;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 9aee069..8ebb257 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 _0xffc5=['address','defaultuser','exports','active','name','unknown','stateTime','status','registry','port','domain','stateRegistry','registrationtime'];(function(_0x16e73a,_0x146629){var _0x187aa1=function(_0x26eb2f){while(--_0x26eb2f){_0x16e73a['push'](_0x16e73a['shift']());}};_0x187aa1(++_0x146629);}(_0xffc5,0x196));var _0x5ffc=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xffc5[_0x117f4c];return _0x2b24e9;};'use strict';function Trunk(_0xde4352){this['id']=_0xde4352['id']||0x0;this[_0x5ffc('0x0')]=_0xde4352[_0x5ffc('0x0')]||![];this[_0x5ffc('0x1')]=_0xde4352[_0x5ffc('0x1')]||'';this['state']=_0x5ffc('0x2');this[_0x5ffc('0x3')]=0x0;this[_0x5ffc('0x4')]='unknown';this[_0x5ffc('0x5')]=_0xde4352[_0x5ffc('0x5')]&&_0xde4352[_0x5ffc('0x5')]['indexOf'](':')?_0xde4352[_0x5ffc('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0x5ffc('0x6')]='';this[_0x5ffc('0x7')]='';this['domainport']='';this['refresh']='';this[_0x5ffc('0x8')]=_0x5ffc('0x2');this[_0x5ffc('0x9')]='';this[_0x5ffc('0xa')]='';this[_0x5ffc('0xb')]=_0xde4352[_0x5ffc('0xb')]||'';}module[_0x5ffc('0xc')]=Trunk; \ No newline at end of file +var _0x821d=['registry','split','host','port','domain','domainport','unknown','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x821d,0xeb));var _0xd821=function(_0x38e196,_0x298a4e){_0x38e196=_0x38e196-0x0;var _0x56cdd0=_0x821d[_0x38e196];return _0x56cdd0;};'use strict';function Trunk(_0x37b5af){this['id']=_0x37b5af['id']||0x0;this[_0xd821('0x0')]=_0x37b5af['active']||![];this[_0xd821('0x1')]=_0x37b5af[_0xd821('0x1')]||'';this[_0xd821('0x2')]='unknown';this[_0xd821('0x3')]=0x0;this[_0xd821('0x4')]='unknown';this['registry']=_0x37b5af[_0xd821('0x5')]&&_0x37b5af[_0xd821('0x5')]['indexOf'](':')?_0x37b5af[_0xd821('0x5')][_0xd821('0x6')](':')[0x0]:'';this[_0xd821('0x7')]='';this[_0xd821('0x8')]='';this[_0xd821('0x9')]='';this[_0xd821('0xa')]='';this['refresh']='';this['stateRegistry']=_0xd821('0xb');this[_0xd821('0xc')]='';this[_0xd821('0xd')]='';this[_0xd821('0xe')]=_0x37b5af['defaultuser']||'';}module[_0xd821('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 804eb33..0ca23cf 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 _0x7ff6=['recordingFormat','mandatoryDisposition','exten'];(function(_0x494f4d,_0x2807fa){var _0x3e7dfc=function(_0x14f2d2){while(--_0x14f2d2){_0x494f4d['push'](_0x494f4d['shift']());}};_0x3e7dfc(++_0x2807fa);}(_0x7ff6,0x11f));var _0x67ff=function(_0x3e38d0,_0x5d4616){_0x3e38d0=_0x3e38d0-0x0;var _0x317cd5=_0x7ff6[_0x3e38d0];return _0x317cd5;};'use strict';function voiceExtension(_0x247fdd){this['id']=_0x247fdd['id']||0x0;this['exten']=_0x247fdd[_0x67ff('0x0')]||'';this[_0x67ff('0x1')]=_0x247fdd[_0x67ff('0x1')]||'none';this[_0x67ff('0x2')]=_0x247fdd[_0x67ff('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xa058=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x1eb394,_0x475121){var _0x4165f3=function(_0x5533cb){while(--_0x5533cb){_0x1eb394['push'](_0x1eb394['shift']());}};_0x4165f3(++_0x475121);}(_0xa058,0x1f0));var _0x8a05=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0xa058[_0x2b55b5];return _0x103d28;};'use strict';function voiceExtension(_0x156a08){this['id']=_0x156a08['id']||0x0;this[_0x8a05('0x0')]=_0x156a08['exten']||'';this[_0x8a05('0x1')]=_0x156a08['recordingFormat']||_0x8a05('0x2');this['mandatoryDisposition']=_0x156a08[_0x8a05('0x3')]||![];}module[_0x8a05('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 8a0a28c..0d6df33 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 _0x2bfb=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','wav','gsm','fewestcalls','leastrecent','linear','random','ringall','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','unmanaged','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay'];(function(_0x37ac2d,_0x34bfa8){var _0x2ab66f=function(_0x328327){while(--_0x328327){_0x37ac2d['push'](_0x37ac2d['shift']());}};_0x2ab66f(++_0x34bfa8);}(_0x2bfb,0x109));var _0xb2bf=function(_0x2b29a0,_0x1d2efd){_0x2b29a0=_0x2b29a0-0x0;var _0x79cee4=_0x2bfb[_0x2b29a0];return _0x79cee4;};'use strict';var monitorFormat={'wav':_0xb2bf('0x0'),'wav49':'wav49','gsm':_0xb2bf('0x1')};var strategy={'fewestcalls':_0xb2bf('0x2'),'leastrecent':_0xb2bf('0x3'),'linear':_0xb2bf('0x4'),'random':_0xb2bf('0x5'),'ringall':_0xb2bf('0x6'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0xb2bf('0x7')};function VoiceQueue(_0x3033a8){this['id']=_0x3033a8['id']||0x0;this[_0xb2bf('0x8')]=_0x3033a8[_0xb2bf('0x8')]||'';this[_0xb2bf('0x9')]=_0x3033a8['monitor_format']||'';this[_0xb2bf('0xa')]=_0x3033a8['type']||_0xb2bf('0xb');this[_0xb2bf('0xc')]=0x0;this[_0xb2bf('0xd')]=0x0;this[_0xb2bf('0xe')]=0x0;this[_0xb2bf('0xf')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0xb2bf('0x10')]=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0xb2bf('0x11')]=0x0;this[_0xb2bf('0x12')]=0x0;this[_0xb2bf('0x13')]=0x0;this[_0xb2bf('0x14')]=0x0;this[_0xb2bf('0x15')]=0x0;this[_0xb2bf('0x16')]=0x0;this[_0xb2bf('0x17')]=0x0;this[_0xb2bf('0x18')]=0x0;this[_0xb2bf('0x19')]=0x0;this[_0xb2bf('0x1a')]=0x0;this[_0xb2bf('0x1b')]=0x0;this[_0xb2bf('0x1c')]=0x0;this[_0xb2bf('0x1d')]=_0x3033a8[_0xb2bf('0x1d')]||![];this[_0xb2bf('0x1e')]=_0x3033a8[_0xb2bf('0x1e')]||0xa;this[_0xb2bf('0x1f')]=_0x3033a8[_0xb2bf('0x1f')]||'no';this[_0xb2bf('0x20')]=!![];this[_0xb2bf('0x21')]='';this[_0xb2bf('0x22')]='';this[_0xb2bf('0x23')]=0x0;this[_0xb2bf('0x24')]=0x0;this[_0xb2bf('0x25')]=_0x3033a8[_0xb2bf('0x25')]||null;this[_0xb2bf('0x26')]=_0x3033a8['dialGlobalInterval']?_0x3033a8[_0xb2bf('0x26')]:null;this[_0xb2bf('0x27')]=_0x3033a8[_0xb2bf('0x27')];this[_0xb2bf('0x28')]=_0x3033a8['dialMethod']||_0xb2bf('0x29');this[_0xb2bf('0x2a')]=_0x3033a8[_0xb2bf('0x2a')]||0x0;this['dialLimitQueue']=_0x3033a8[_0xb2bf('0x2b')]||0x0;this[_0xb2bf('0x2c')]=_0x3033a8[_0xb2bf('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x3033a8[_0xb2bf('0x2d')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x3033a8[_0xb2bf('0x2e')]||0.03;this[_0xb2bf('0x2f')]=_0x3033a8[_0xb2bf('0x2f')]||0x258;this[_0xb2bf('0x30')]=_0x3033a8[_0xb2bf('0x30')]||_0xb2bf('0x31');this['dialOriginateCallerIdNumber']=_0x3033a8[_0xb2bf('0x32')]||'anonymous';this['dialOriginateTimeout']=_0x3033a8[_0xb2bf('0x33')]||0x1e;this[_0xb2bf('0x34')]=_0x3033a8['dialQueueOptions']||_0xb2bf('0x35');this[_0xb2bf('0x36')]=_0x3033a8['dialQueueTimeout']||0x3;this[_0xb2bf('0x37')]=_0x3033a8[_0xb2bf('0x37')]||undefined;this['dialCongestionMaxRetry']=_0x3033a8[_0xb2bf('0x38')]||0x3;this[_0xb2bf('0x39')]=_0x3033a8[_0xb2bf('0x39')]||0x96;this[_0xb2bf('0x3a')]=_0x3033a8['dialBusyMaxRetry']||0x3;this[_0xb2bf('0x3b')]=_0x3033a8['dialBusyRetryFrequency']||0x96;this[_0xb2bf('0x3c')]=_0x3033a8['dialNoAnswerMaxRetry']||0x3;this[_0xb2bf('0x3d')]=_0x3033a8[_0xb2bf('0x3d')]||0x96;this[_0xb2bf('0x3e')]=_0x3033a8['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3033a8[_0xb2bf('0x3f')]||0x96;this['dialDropMaxRetry']=_0x3033a8[_0xb2bf('0x40')]||0x3;this[_0xb2bf('0x41')]=_0x3033a8[_0xb2bf('0x41')]||0x96;this[_0xb2bf('0x42')]=_0x3033a8['dialAbandonedMaxRetry']||0x3;this[_0xb2bf('0x43')]=_0x3033a8[_0xb2bf('0x43')]||0x96;this[_0xb2bf('0x44')]=_0x3033a8[_0xb2bf('0x44')]||0x3;this[_0xb2bf('0x45')]=_0x3033a8[_0xb2bf('0x45')]||0x96;this[_0xb2bf('0x46')]=_0x3033a8[_0xb2bf('0x46')]||0x3;this[_0xb2bf('0x47')]=_0x3033a8[_0xb2bf('0x47')]||0x96;this[_0xb2bf('0x48')]=_0x3033a8['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x3033a8[_0xb2bf('0x49')]||0x4;this[_0xb2bf('0x4a')]=_0x3033a8[_0xb2bf('0x4a')]?_0x3033a8['Trunk']:undefined;this[_0xb2bf('0x4b')]=_0x3033a8[_0xb2bf('0x4b')]?_0x3033a8[_0xb2bf('0x4b')]:undefined;this[_0xb2bf('0x4c')]=_0x3033a8[_0xb2bf('0x4c')]||undefined;this[_0xb2bf('0x4d')]=_0x3033a8[_0xb2bf('0x4d')]?_0x3033a8[_0xb2bf('0x4d')]:undefined;this[_0xb2bf('0x4e')]=_0x3033a8[_0xb2bf('0x4e')]||_0xb2bf('0x4f');this[_0xb2bf('0x50')]=_0x3033a8[_0xb2bf('0x50')]||undefined;this['dialCutDigit']=_0x3033a8['dialCutDigit']||undefined;this[_0xb2bf('0x51')]=strategy[_0x3033a8[_0xb2bf('0x51')]];this[_0xb2bf('0x52')]=!![];this['dialAMDActive']=_0x3033a8['dialAMDActive']||![];this[_0xb2bf('0x53')]=_0x3033a8[_0xb2bf('0x53')];this[_0xb2bf('0x54')]=_0x3033a8[_0xb2bf('0x54')];this[_0xb2bf('0x55')]=_0x3033a8[_0xb2bf('0x55')];this[_0xb2bf('0x56')]=_0x3033a8[_0xb2bf('0x56')];this['dialAMDMinWordLength']=_0x3033a8[_0xb2bf('0x57')];this[_0xb2bf('0x58')]=_0x3033a8[_0xb2bf('0x58')];this[_0xb2bf('0x59')]=_0x3033a8[_0xb2bf('0x59')];this[_0xb2bf('0x5a')]=_0x3033a8[_0xb2bf('0x5a')];this[_0xb2bf('0x5b')]=_0x3033a8['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this['timeout']=_0x3033a8[_0xb2bf('0x5c')];this['outboundAnswerCallsDay']=0x0;this[_0xb2bf('0x5d')]=0x0;this[_0xb2bf('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb2bf('0x5f')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xb2bf('0x60')]=0x0;this[_0xb2bf('0x61')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xb2bf('0x62')]=0x0;this[_0xb2bf('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb2bf('0x64')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xb2bf('0x65')]=undefined;this[_0xb2bf('0x66')]=undefined;this[_0xb2bf('0x67')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xb2bf('0x68')]=0x0;this[_0xb2bf('0x69')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xb2bf('0x6a')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xb2bf('0x6b')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xb2bf('0x6c')]=_0x3033a8['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb2bf('0x6d')]=_0x3033a8['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb2bf('0x6e')]=0x0;this[_0xb2bf('0x6f')]=0x0;this[_0xb2bf('0x70')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb2bf('0x71')]=_0x3033a8['dialRecallMeTimeout']||0x1e;this[_0xb2bf('0x72')]=_0x3033a8[_0xb2bf('0x72')]||![];this['dialPreviewAutoRecallMe']=!!_0x3033a8['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x3033a8[_0xb2bf('0x73')]||![];this['dialQueueProject2']=_0x3033a8[_0xb2bf('0x74')]||undefined;this['dialAgiAfterHangupClient']=_0x3033a8[_0xb2bf('0x75')]||![];this[_0xb2bf('0x76')]=_0x3033a8[_0xb2bf('0x76')]||![];this[_0xb2bf('0x9')]=monitorFormat[_0x3033a8['monitor_format']]?monitorFormat[_0x3033a8[_0xb2bf('0x9')]]:undefined;this['mandatoryDisposition']=_0x3033a8[_0xb2bf('0x77')]||![];this['mandatoryDispositionPause']=_0x3033a8[_0xb2bf('0x78')]?_0x3033a8[_0xb2bf('0x78')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0x6be2=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x54dfdd,_0x220ea6){var _0x31e928=function(_0xd9ca97){while(--_0xd9ca97){_0x54dfdd['push'](_0x54dfdd['shift']());}};_0x31e928(++_0x220ea6);}(_0x6be2,0x1cc));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x26be('0x0'),'gsm':_0x26be('0x1')};var strategy={'fewestcalls':_0x26be('0x2'),'leastrecent':'leastrecent','linear':'linear','random':_0x26be('0x3'),'ringall':_0x26be('0x4'),'rr':_0x26be('0x5'),'rrmemory':'rrmemory','rrordered':_0x26be('0x6'),'wrandom':_0x26be('0x7')};function VoiceQueue(_0x6cb6ed){this['id']=_0x6cb6ed['id']||0x0;this['name']=_0x6cb6ed[_0x26be('0x8')]||'';this[_0x26be('0x9')]=_0x6cb6ed['monitor_format']||'';this[_0x26be('0xa')]=_0x6cb6ed['type']||_0x26be('0xb');this['waiting']=0x0;this[_0x26be('0xc')]=0x0;this[_0x26be('0xd')]=0x0;this[_0x26be('0xe')]=0x0;this[_0x26be('0xf')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0x26be('0x10')]=0x0;this['inUse']=0x0;this[_0x26be('0x11')]=0x0;this[_0x26be('0x12')]=0x0;this[_0x26be('0x13')]=0x0;this[_0x26be('0x14')]=0x0;this[_0x26be('0x15')]=0x0;this[_0x26be('0x16')]=0x0;this[_0x26be('0x17')]=0x0;this[_0x26be('0x18')]=0x0;this['unavailable']=0x0;this[_0x26be('0x19')]=0x0;this[_0x26be('0x1a')]=_0x6cb6ed[_0x26be('0x1a')]||![];this[_0x26be('0x1b')]=_0x6cb6ed[_0x26be('0x1b')]||0xa;this[_0x26be('0x1c')]=_0x6cb6ed['autopause']||'no';this[_0x26be('0x1d')]=!![];this[_0x26be('0x1e')]='';this['statusMessage']='';this[_0x26be('0x1f')]=0x0;this[_0x26be('0x20')]=0x0;this[_0x26be('0x21')]=_0x6cb6ed[_0x26be('0x21')]||null;this[_0x26be('0x22')]=_0x6cb6ed['dialGlobalInterval']?_0x6cb6ed[_0x26be('0x22')]:null;this['dialActive']=_0x6cb6ed[_0x26be('0x23')];this[_0x26be('0x24')]=_0x6cb6ed[_0x26be('0x24')]||_0x26be('0x25');this[_0x26be('0x26')]=_0x6cb6ed[_0x26be('0x26')]||0x0;this[_0x26be('0x27')]=_0x6cb6ed['dialLimitQueue']||0x0;this[_0x26be('0x28')]=_0x6cb6ed[_0x26be('0x28')]||0x1;this[_0x26be('0x29')]=_0x6cb6ed[_0x26be('0x29')]||_0x26be('0x2a');this[_0x26be('0x2b')]=_0x6cb6ed['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x6cb6ed[_0x26be('0x2c')]||0x258;this[_0x26be('0x2d')]=_0x6cb6ed[_0x26be('0x2d')]||_0x26be('0x2e');this[_0x26be('0x2f')]=_0x6cb6ed['dialOriginateCallerIdNumber']||_0x26be('0x2e');this[_0x26be('0x30')]=_0x6cb6ed[_0x26be('0x30')]||0x1e;this['dialQueueOptions']=_0x6cb6ed['dialQueueOptions']||_0x26be('0x31');this[_0x26be('0x32')]=_0x6cb6ed[_0x26be('0x32')]||0x3;this[_0x26be('0x33')]=_0x6cb6ed[_0x26be('0x33')]||undefined;this[_0x26be('0x34')]=_0x6cb6ed['dialCongestionMaxRetry']||0x3;this[_0x26be('0x35')]=_0x6cb6ed[_0x26be('0x35')]||0x96;this[_0x26be('0x36')]=_0x6cb6ed[_0x26be('0x36')]||0x3;this[_0x26be('0x37')]=_0x6cb6ed[_0x26be('0x37')]||0x96;this[_0x26be('0x38')]=_0x6cb6ed[_0x26be('0x38')]||0x3;this[_0x26be('0x39')]=_0x6cb6ed[_0x26be('0x39')]||0x96;this[_0x26be('0x3a')]=_0x6cb6ed[_0x26be('0x3a')]||0x3;this[_0x26be('0x3b')]=_0x6cb6ed['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x6cb6ed[_0x26be('0x3c')]||0x3;this[_0x26be('0x3d')]=_0x6cb6ed['dialDropRetryFrequency']||0x96;this[_0x26be('0x3e')]=_0x6cb6ed[_0x26be('0x3e')]||0x3;this[_0x26be('0x3f')]=_0x6cb6ed[_0x26be('0x3f')]||0x96;this[_0x26be('0x40')]=_0x6cb6ed['dialMachineMaxRetry']||0x3;this[_0x26be('0x41')]=_0x6cb6ed[_0x26be('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0x6cb6ed[_0x26be('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x6cb6ed[_0x26be('0x43')]||0x96;this[_0x26be('0x44')]=_0x6cb6ed['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x6cb6ed[_0x26be('0x45')]||0x4;this[_0x26be('0x46')]=_0x6cb6ed[_0x26be('0x46')]?_0x6cb6ed[_0x26be('0x46')]:undefined;this['TrunkBackup']=_0x6cb6ed[_0x26be('0x47')]?_0x6cb6ed[_0x26be('0x47')]:undefined;this[_0x26be('0x48')]=_0x6cb6ed[_0x26be('0x48')]||undefined;this[_0x26be('0x49')]=_0x6cb6ed[_0x26be('0x49')]?_0x6cb6ed['Interval']:undefined;this['dialOrderByScheduledAt']=_0x6cb6ed[_0x26be('0x4a')]||_0x26be('0x4b');this[_0x26be('0x4c')]=_0x6cb6ed['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x6cb6ed[_0x26be('0x4d')]||undefined;this['strategy']=strategy[_0x6cb6ed['strategy']];this[_0x26be('0x4e')]=!![];this[_0x26be('0x4f')]=_0x6cb6ed['dialAMDActive']||![];this[_0x26be('0x50')]=_0x6cb6ed[_0x26be('0x50')];this[_0x26be('0x51')]=_0x6cb6ed['dialAMDGreeting'];this[_0x26be('0x52')]=_0x6cb6ed[_0x26be('0x52')];this[_0x26be('0x53')]=_0x6cb6ed['dialAMDTotalAnalysisTime'];this[_0x26be('0x54')]=_0x6cb6ed['dialAMDMinWordLength'];this[_0x26be('0x55')]=_0x6cb6ed[_0x26be('0x55')];this[_0x26be('0x56')]=_0x6cb6ed[_0x26be('0x56')];this['dialAMDSilenceThreshold']=_0x6cb6ed[_0x26be('0x57')];this[_0x26be('0x58')]=_0x6cb6ed[_0x26be('0x58')];this[_0x26be('0x59')]=0x0;this[_0x26be('0x5a')]=0x0;this[_0x26be('0x5b')]=_0x6cb6ed[_0x26be('0x5b')];this[_0x26be('0x5c')]=0x0;this[_0x26be('0x5d')]=0x0;this[_0x26be('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x26be('0x5f')]=0x0;this[_0x26be('0x60')]=0x0;this[_0x26be('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x26be('0x62')]=0x0;this[_0x26be('0x63')]=0x0;this[_0x26be('0x64')]=0x0;this[_0x26be('0x65')]=0x0;this['outboundReCallsDay']=0x0;this[_0x26be('0x66')]=0x0;this[_0x26be('0x67')]=undefined;this[_0x26be('0x68')]=undefined;this['handlePredictive']=undefined;this[_0x26be('0x69')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x26be('0x6a')]=0x0;this[_0x26be('0x6b')]=0x0;this[_0x26be('0x6c')]=0x0;this[_0x26be('0x6d')]=0x0;this[_0x26be('0x6e')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x26be('0x6f')]=_0x6cb6ed[_0x26be('0x70')]||0x14;this[_0x26be('0x71')]=_0x6cb6ed[_0x26be('0x70')]||0xa;this[_0x26be('0x72')]=0x0;this[_0x26be('0x73')]=0x0;this[_0x26be('0x74')]=0x1;this[_0x26be('0x75')]=0x0;this[_0x26be('0x76')]=0x0;this[_0x26be('0x77')]=0x0;this[_0x26be('0x78')]=0x0;this[_0x26be('0x79')]=_0x6cb6ed['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x6cb6ed['dialRecallInQueue']||![];this[_0x26be('0x7a')]=!!_0x6cb6ed[_0x26be('0x7a')]||![];this[_0x26be('0x7b')]=!!_0x6cb6ed['dialPreviewRecallmeReminder']||![];this[_0x26be('0x7c')]=_0x6cb6ed[_0x26be('0x7c')]||undefined;this[_0x26be('0x7d')]=_0x6cb6ed[_0x26be('0x7d')]||![];this[_0x26be('0x7e')]=_0x6cb6ed['dialAgiAfterHangupAgent']||![];this[_0x26be('0x9')]=monitorFormat[_0x6cb6ed[_0x26be('0x9')]]?monitorFormat[_0x6cb6ed[_0x26be('0x9')]]:undefined;this[_0x26be('0x7f')]=_0x6cb6ed[_0x26be('0x7f')]||![];this[_0x26be('0x80')]=_0x6cb6ed[_0x26be('0x80')]?_0x6cb6ed[_0x26be('0x80')]:undefined;this[_0x26be('0x81')]=![];}module[_0x26be('0x82')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7fc72bb..0a706d2 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 _0x7c1f=['outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','online','incall','includes','status','booked','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','dialActive','some','active','preview','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','unavailable','unknown','unmanaged','type'];(function(_0xd0f17d,_0x4ae565){var _0xd44ca=function(_0x3ce2c7){while(--_0x3ce2c7){_0xd0f17d['push'](_0xd0f17d['shift']());}};_0xd44ca(++_0x4ae565);}(_0x7c1f,0x194));var _0xf7c1=function(_0x59d452,_0x23e51d){_0x59d452=_0x59d452-0x0;var _0x139d2e=_0x7c1f[_0x59d452];return _0x139d2e;};'use strict';var INBOUND_COUNTERS=[_0xf7c1('0x0'),_0xf7c1('0x1'),_0xf7c1('0x2'),_0xf7c1('0x3'),_0xf7c1('0x4'),'talking',_0xf7c1('0x5')];var OUTBOUND_COUNTERS=[_0xf7c1('0x0'),_0xf7c1('0x6'),'inUse',_0xf7c1('0x1'),_0xf7c1('0x2'),_0xf7c1('0x7'),_0xf7c1('0x8'),'outboundAnswerCallsDay',_0xf7c1('0x9'),_0xf7c1('0xa'),_0xf7c1('0xb'),_0xf7c1('0xc'),_0xf7c1('0xd'),_0xf7c1('0xe'),_0xf7c1('0xf'),_0xf7c1('0x10'),_0xf7c1('0x3'),_0xf7c1('0x11'),_0xf7c1('0x12'),_0xf7c1('0x13'),'sumDuration',_0xf7c1('0x14'),_0xf7c1('0x5')];function VoiceQueueSummary(_0x1f2f86){this['id']=_0x1f2f86['id'];this[_0xf7c1('0x15')]=_0x1f2f86[_0xf7c1('0x15')];this[_0xf7c1('0x16')]=_0x1f2f86['strategy'];this['abandoned']=_0x1f2f86[_0xf7c1('0x17')]||0x0;this['answered']=_0x1f2f86[_0xf7c1('0x6')]||0x0;this[_0xf7c1('0x0')]=_0x1f2f86['available']||0x0;this[_0xf7c1('0x18')]=_0x1f2f86['busy']||0x0;this[_0xf7c1('0x19')]=_0x1f2f86[_0xf7c1('0x19')]||0x0;this[_0xf7c1('0x1a')]=_0x1f2f86[_0xf7c1('0x1a')]||0x0;this[_0xf7c1('0x1')]=_0x1f2f86['loggedIn']||0x0;this[_0xf7c1('0x2')]=_0x1f2f86['loggedInDb']||0x0;this[_0xf7c1('0x1b')]=_0x1f2f86['onHold']||0x0;this[_0xf7c1('0x1c')]=_0x1f2f86[_0xf7c1('0x1c')]||0x0;this[_0xf7c1('0x3')]=_0x1f2f86[_0xf7c1('0x3')]||0x0;this[_0xf7c1('0x4')]=_0x1f2f86[_0xf7c1('0x4')]||0x0;this[_0xf7c1('0x1d')]=_0x1f2f86[_0xf7c1('0x1d')];this['sumBillable']=_0x1f2f86['sumBillable'];this[_0xf7c1('0x1e')]=_0x1f2f86[_0xf7c1('0x1e')];this['sumHoldTime']=_0x1f2f86[_0xf7c1('0x1f')]||0x0;this[_0xf7c1('0x12')]=_0x1f2f86['talking']||0x0;this[_0xf7c1('0x14')]=_0x1f2f86['total']||0x0;this['type']=_0x1f2f86['type'];this[_0xf7c1('0x20')]=_0x1f2f86[_0xf7c1('0x20')]||0x0;this['unknown']=_0x1f2f86[_0xf7c1('0x21')]||0x0;this[_0xf7c1('0x22')]=_0x1f2f86[_0xf7c1('0x22')]||0x0;this[_0xf7c1('0x5')]=_0x1f2f86[_0xf7c1('0x5')]||0x0;if(_0x1f2f86[_0xf7c1('0x23')]===_0xf7c1('0x24')){this[_0xf7c1('0x11')]=_0x1f2f86['pTalking']||0x0;this['dialActive']=_0x1f2f86['dialActive'];this[_0xf7c1('0x25')]=_0x1f2f86[_0xf7c1('0x25')];this[_0xf7c1('0x26')]=_0x1f2f86[_0xf7c1('0x26')];this[_0xf7c1('0x27')]=_0x1f2f86[_0xf7c1('0x27')];this[_0xf7c1('0x28')]=_0x1f2f86[_0xf7c1('0x28')];this[_0xf7c1('0x29')]=_0x1f2f86['dialPrefix'];this[_0xf7c1('0x2a')]=_0x1f2f86[_0xf7c1('0x2a')];this['outboundAnswerAgiCallsDay']=_0x1f2f86[_0xf7c1('0x2b')];this[_0xf7c1('0x2c')]=_0x1f2f86[_0xf7c1('0x2c')];this[_0xf7c1('0x9')]=_0x1f2f86[_0xf7c1('0x9')];this['outboundBusyCallsDay']=_0x1f2f86[_0xf7c1('0xa')];this['outboundCongestionCallsDay']=_0x1f2f86[_0xf7c1('0xb')];this[_0xf7c1('0x2d')]=_0x1f2f86[_0xf7c1('0x2d')];this['outboundDropCallsDayCallersExit']=_0x1f2f86[_0xf7c1('0x2e')];this[_0xf7c1('0x2f')]=_0x1f2f86['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x1f2f86[_0xf7c1('0xc')];this[_0xf7c1('0xd')]=_0x1f2f86[_0xf7c1('0xd')];this[_0xf7c1('0x30')]=_0x1f2f86[_0xf7c1('0x30')];this['outboundReCallsDay']=_0x1f2f86[_0xf7c1('0xe')];this[_0xf7c1('0xf')]=_0x1f2f86[_0xf7c1('0xf')];this[_0xf7c1('0x10')]=_0x1f2f86[_0xf7c1('0x10')];this['predictiveIntervalAnsweredCalls']=_0x1f2f86['predictiveIntervalAnsweredCalls'];this[_0xf7c1('0x31')]=_0x1f2f86[_0xf7c1('0x31')];this[_0xf7c1('0x32')]=_0x1f2f86[_0xf7c1('0x32')];this[_0xf7c1('0x33')]=_0x1f2f86['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x1f2f86[_0xf7c1('0x34')];this[_0xf7c1('0x35')]=_0x1f2f86[_0xf7c1('0x35')];this[_0xf7c1('0x36')]=_0x1f2f86['predictiveIntervalErlangCallsDroppedCalls'];this[_0xf7c1('0x37')]=_0x1f2f86['predictiveIntervalHitRate'];this[_0xf7c1('0x38')]=_0x1f2f86[_0xf7c1('0x38')];this[_0xf7c1('0x39')]=_0x1f2f86[_0xf7c1('0x39')];this[_0xf7c1('0x3a')]=_0x1f2f86[_0xf7c1('0x3a')];this[_0xf7c1('0x3b')]=_0x1f2f86['predictiveIntervalTotalCalls'];this['originated']=_0x1f2f86[_0xf7c1('0x7')];this['erlangCalls']=_0x1f2f86[_0xf7c1('0x3c')];this[_0xf7c1('0x3d')]=_0x1f2f86['erlangCallToSecond'];this[_0xf7c1('0x3e')]=_0x1f2f86['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x1f2f86[_0xf7c1('0x3f')];this[_0xf7c1('0x40')]=_0x1f2f86[_0xf7c1('0x40')];this[_0xf7c1('0x41')]=_0x1f2f86['startProgressive'];this['message']=_0x1f2f86[_0xf7c1('0x42')];this[_0xf7c1('0x43')]=_0x1f2f86[_0xf7c1('0x43')];}if(_0x1f2f86[_0xf7c1('0x44')]){this[_0xf7c1('0x44')]={'id':_0x1f2f86[_0xf7c1('0x44')]['id'],'name':_0x1f2f86['Trunk'][_0xf7c1('0x15')],'active':_0x1f2f86[_0xf7c1('0x44')]['active'],'callerid':_0x1f2f86['Trunk'][_0xf7c1('0x45')]};}}VoiceQueueSummary[_0xf7c1('0x46')][_0xf7c1('0x47')]=function(_0x1b7f4e,_0x2ddf10,_0x5f011e,_0x50597a){this['loggedInDb']=0x0;this[_0xf7c1('0x12')]=0x0;this['paused']=0x0;this[_0xf7c1('0x21')]=0x0;this[_0xf7c1('0x1c')]=0x0;this[_0xf7c1('0x19')]=0x0;this[_0xf7c1('0x18')]=0x0;this[_0xf7c1('0x1a')]=0x0;this['unavailable']=0x0;this[_0xf7c1('0x4')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x5f011e){if(_0x5f011e[_0xf7c1('0x0')]){this['available']=Number(_0x5f011e['available']);}if(_0x5f011e[_0xf7c1('0x48')]){this[_0xf7c1('0x1')]=Number(_0x5f011e[_0xf7c1('0x48')]);}if(_0x5f011e[_0xf7c1('0x49')]){this[_0xf7c1('0x5')]=Number(_0x5f011e['callers']);}}for(var _0x2d928d=0x0;_0x2d928d<_0x1b7f4e[_0xf7c1('0x4a')];_0x2d928d++){var _0x2af2d2=_0x2ddf10['SIP/'+_0x1b7f4e[_0x2d928d][_0xf7c1('0x15')]];if(_0x2af2d2&&_0x2af2d2[_0xf7c1('0x4b')]){this[_0xf7c1('0x2')]+=0x1;}if(_0x1b7f4e[_0x2d928d][_0xf7c1('0x4c')]==='1'){this[_0xf7c1('0x12')]+=0x1;}if(_0x1b7f4e[_0x2d928d]['paused']==='1'&&!['2','7','8'][_0xf7c1('0x4d')](_0x1b7f4e[_0x2d928d][_0xf7c1('0x4e')])){this[_0xf7c1('0x3')]+=0x1;}switch(_0x1b7f4e[_0x2d928d][_0xf7c1('0x4e')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xf7c1('0x1c')]+=0x1;break;case'2':this[_0xf7c1('0x19')]+=0x1;break;case'3':this[_0xf7c1('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xf7c1('0x20')]+=0x1;break;case'6':this[_0xf7c1('0x4')]+=0x1;break;case'7':this[_0xf7c1('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xf7c1('0x25')]===_0xf7c1('0x4f')){var _0x3d2ec5=Object['keys'](_0x50597a);for(var _0xd08daa=0x0;_0xd08daa<_0x3d2ec5['length'];_0xd08daa++){var _0x20b58d=_0x3d2ec5[_0xd08daa];var _0x2150f2=_0x50597a[_0x20b58d];if(_0x2150f2['queue']===this['name']&&_0x2150f2[_0xf7c1('0x23')]==='dialer'&&_0x2150f2['exten']===_0xf7c1('0x50')){this['talking']+=0x1;}}if(this[_0xf7c1('0x12')]>this[_0xf7c1('0x19')]){this[_0xf7c1('0x12')]=this[_0xf7c1('0x19')];}this[_0xf7c1('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xf7c1('0x51')]=function(_0x5ed695){var _0x72f433=![];if(_0x5ed695){_0x72f433=INBOUND_COUNTERS['some'](function(_0x1d8e3c){return this[_0x1d8e3c]!==_0x5ed695[_0x1d8e3c];},this);}return _0x72f433;};VoiceQueueSummary[_0xf7c1('0x46')][_0xf7c1('0x52')]=function(_0x1b9b4f){var _0x71b246=![];var _0x4ca2da=![];var _0x489546=![];if(_0x1b9b4f){_0x71b246=this[_0xf7c1('0x25')]!==_0x1b9b4f[_0xf7c1('0x25')]||this[_0xf7c1('0x53')]!==_0x1b9b4f[_0xf7c1('0x53')]||this[_0xf7c1('0x42')]!==_0x1b9b4f[_0xf7c1('0x42')]||this[_0xf7c1('0x43')]!==_0x1b9b4f[_0xf7c1('0x43')];_0x4ca2da=OUTBOUND_COUNTERS[_0xf7c1('0x54')](function(_0x233f32){return this[_0x233f32]!==_0x1b9b4f[_0x233f32];},this);if(this[_0xf7c1('0x44')]&&_0x1b9b4f[_0xf7c1('0x44')]){_0x489546=this[_0xf7c1('0x44')]['name']!==_0x1b9b4f[_0xf7c1('0x44')][_0xf7c1('0x15')]||this[_0xf7c1('0x44')][_0xf7c1('0x55')]!==_0x1b9b4f[_0xf7c1('0x44')]['active'];}}return _0x71b246||_0x4ca2da||_0x489546;};VoiceQueueSummary[_0xf7c1('0x46')]['updateReportFromOutboundQueue']=function(_0x1f0209){this[_0xf7c1('0x6')]=_0x1f0209['answered'];this[_0xf7c1('0x42')]=_0x1f0209[_0xf7c1('0x42')];this[_0xf7c1('0x43')]=_0x1f0209[_0xf7c1('0x43')];this[_0xf7c1('0x7')]=_0x1f0209[_0xf7c1('0x7')];this[_0xf7c1('0x8')]=_0x1f0209[_0xf7c1('0x8')];this[_0xf7c1('0x2c')]=_0x1f0209[_0xf7c1('0x2c')];this[_0xf7c1('0x9')]=_0x1f0209[_0xf7c1('0x9')];this[_0xf7c1('0xa')]=_0x1f0209[_0xf7c1('0xa')];this[_0xf7c1('0xb')]=_0x1f0209[_0xf7c1('0xb')];this[_0xf7c1('0xc')]=_0x1f0209['outboundNoAnswerCallsDay'];this[_0xf7c1('0xd')]=_0x1f0209[_0xf7c1('0xd')];this[_0xf7c1('0xe')]=_0x1f0209[_0xf7c1('0xe')];this[_0xf7c1('0xf')]=_0x1f0209[_0xf7c1('0xf')];this[_0xf7c1('0x10')]=_0x1f0209['outboundUnknownCallsDay'];this[_0xf7c1('0x13')]=_0x1f0209[_0xf7c1('0x13')];this['sumDuration']=_0x1f0209[_0xf7c1('0x1e')];this[_0xf7c1('0x14')]=_0x1f0209[_0xf7c1('0x14')];if(this[_0xf7c1('0x25')]===_0xf7c1('0x56')){this[_0xf7c1('0x11')]=_0x1f0209[_0xf7c1('0x11')];}};module[_0xf7c1('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x9576=['type','unavailable','unknown','unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','statusMessage','Trunk','prototype','createReport','loggedin','callers','length','SIP/','online','includes','status','booked','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','message','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','sumBillable','sumDuration','total','name','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime'];(function(_0x49ebc0,_0x41eec7){var _0x2958a5=function(_0x58ffd7){while(--_0x58ffd7){_0x49ebc0['push'](_0x49ebc0['shift']());}};_0x2958a5(++_0x41eec7);}(_0x9576,0x182));var _0x6957=function(_0x422436,_0x47d23b){_0x422436=_0x422436-0x0;var _0x28238a=_0x9576[_0x422436];return _0x28238a;};'use strict';var INBOUND_COUNTERS=[_0x6957('0x0'),_0x6957('0x1'),_0x6957('0x2'),_0x6957('0x3'),'ringing','talking',_0x6957('0x4')];var OUTBOUND_COUNTERS=[_0x6957('0x0'),_0x6957('0x5'),_0x6957('0x6'),_0x6957('0x1'),_0x6957('0x2'),_0x6957('0x7'),'outboundAbandonedCallsDay',_0x6957('0x8'),_0x6957('0x9'),_0x6957('0xa'),_0x6957('0xb'),_0x6957('0xc'),_0x6957('0xd'),'outboundReCallsDay',_0x6957('0xe'),_0x6957('0xf'),'paused','pTalking',_0x6957('0x10'),_0x6957('0x11'),_0x6957('0x12'),_0x6957('0x13'),_0x6957('0x4')];function VoiceQueueSummary(_0xe5f20b){this['id']=_0xe5f20b['id'];this[_0x6957('0x14')]=_0xe5f20b['name'];this['strategy']=_0xe5f20b['strategy'];this[_0x6957('0x15')]=_0xe5f20b[_0x6957('0x15')]||0x0;this[_0x6957('0x5')]=_0xe5f20b[_0x6957('0x5')]||0x0;this[_0x6957('0x0')]=_0xe5f20b[_0x6957('0x0')]||0x0;this[_0x6957('0x16')]=_0xe5f20b['busy']||0x0;this['inUse']=_0xe5f20b['inUse']||0x0;this[_0x6957('0x17')]=_0xe5f20b[_0x6957('0x17')]||0x0;this[_0x6957('0x1')]=_0xe5f20b[_0x6957('0x1')]||0x0;this['loggedInDb']=_0xe5f20b[_0x6957('0x2')]||0x0;this['onHold']=_0xe5f20b[_0x6957('0x18')]||0x0;this[_0x6957('0x19')]=_0xe5f20b['notInUse']||0x0;this[_0x6957('0x3')]=_0xe5f20b[_0x6957('0x3')]||0x0;this[_0x6957('0x1a')]=_0xe5f20b['ringing']||0x0;this[_0x6957('0x1b')]=_0xe5f20b[_0x6957('0x1b')];this[_0x6957('0x11')]=_0xe5f20b[_0x6957('0x11')];this[_0x6957('0x12')]=_0xe5f20b[_0x6957('0x12')];this[_0x6957('0x1c')]=_0xe5f20b[_0x6957('0x1c')]||0x0;this['talking']=_0xe5f20b['talking']||0x0;this[_0x6957('0x13')]=_0xe5f20b[_0x6957('0x13')]||0x0;this[_0x6957('0x1d')]=_0xe5f20b[_0x6957('0x1d')];this[_0x6957('0x1e')]=_0xe5f20b[_0x6957('0x1e')]||0x0;this[_0x6957('0x1f')]=_0xe5f20b[_0x6957('0x1f')]||0x0;this['unmanaged']=_0xe5f20b[_0x6957('0x20')]||0x0;this[_0x6957('0x4')]=_0xe5f20b[_0x6957('0x4')]||0x0;if(_0xe5f20b[_0x6957('0x1d')]==='outbound'){this['pTalking']=_0xe5f20b[_0x6957('0x21')]||0x0;this[_0x6957('0x22')]=_0xe5f20b['dialActive'];this['dialMethod']=_0xe5f20b[_0x6957('0x23')];this[_0x6957('0x24')]=_0xe5f20b[_0x6957('0x24')];this['dialOriginateCallerIdNumber']=_0xe5f20b[_0x6957('0x25')];this[_0x6957('0x26')]=_0xe5f20b[_0x6957('0x26')];this[_0x6957('0x27')]=_0xe5f20b[_0x6957('0x27')];this[_0x6957('0x28')]=_0xe5f20b[_0x6957('0x28')];this[_0x6957('0x29')]=_0xe5f20b['outboundAnswerAgiCallsDay'];this[_0x6957('0x8')]=_0xe5f20b[_0x6957('0x8')];this[_0x6957('0x9')]=_0xe5f20b[_0x6957('0x9')];this[_0x6957('0xa')]=_0xe5f20b[_0x6957('0xa')];this[_0x6957('0xb')]=_0xe5f20b[_0x6957('0xb')];this[_0x6957('0x2a')]=_0xe5f20b[_0x6957('0x2a')];this[_0x6957('0x2b')]=_0xe5f20b['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0xe5f20b[_0x6957('0x2c')];this[_0x6957('0xc')]=_0xe5f20b[_0x6957('0xc')];this[_0x6957('0xd')]=_0xe5f20b['outboundNoSuchCallsDay'];this[_0x6957('0x2d')]=_0xe5f20b[_0x6957('0x2d')];this[_0x6957('0x2e')]=_0xe5f20b['outboundReCallsDay'];this['outboundRejectCallsDay']=_0xe5f20b[_0x6957('0xe')];this[_0x6957('0xf')]=_0xe5f20b[_0x6957('0xf')];this['predictiveIntervalAnsweredCalls']=_0xe5f20b[_0x6957('0x2f')];this[_0x6957('0x30')]=_0xe5f20b[_0x6957('0x30')];this[_0x6957('0x31')]=_0xe5f20b[_0x6957('0x31')];this[_0x6957('0x32')]=_0xe5f20b[_0x6957('0x32')];this[_0x6957('0x33')]=_0xe5f20b[_0x6957('0x33')];this['predictiveIntervalErlangCalls']=_0xe5f20b[_0x6957('0x34')];this[_0x6957('0x35')]=_0xe5f20b[_0x6957('0x35')];this['predictiveIntervalHitRate']=_0xe5f20b['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0xe5f20b[_0x6957('0x36')];this['predictiveIntervalPauses']=_0xe5f20b['predictiveIntervalPauses'];this[_0x6957('0x37')]=_0xe5f20b[_0x6957('0x37')];this['predictiveIntervalTotalCalls']=_0xe5f20b['predictiveIntervalTotalCalls'];this[_0x6957('0x7')]=_0xe5f20b[_0x6957('0x7')];this[_0x6957('0x38')]=_0xe5f20b[_0x6957('0x38')];this[_0x6957('0x39')]=_0xe5f20b['erlangCallToSecond'];this[_0x6957('0x3a')]=_0xe5f20b['erlangAbandonmentRate'];this['erlangBusyFactor']=_0xe5f20b['erlangBusyFactor'];this['startPredictive']=_0xe5f20b['startPredictive'];this['startProgressive']=_0xe5f20b['startProgressive'];this['message']=_0xe5f20b['message'];this[_0x6957('0x3b')]=_0xe5f20b[_0x6957('0x3b')];}if(_0xe5f20b[_0x6957('0x3c')]){this[_0x6957('0x3c')]={'id':_0xe5f20b[_0x6957('0x3c')]['id'],'name':_0xe5f20b[_0x6957('0x3c')][_0x6957('0x14')],'active':_0xe5f20b[_0x6957('0x3c')]['active'],'callerid':_0xe5f20b[_0x6957('0x3c')]['callerid']};}}VoiceQueueSummary[_0x6957('0x3d')][_0x6957('0x3e')]=function(_0x22ec26,_0x2298e0,_0x41a1ba,_0x2d1d22){this[_0x6957('0x2')]=0x0;this[_0x6957('0x10')]=0x0;this[_0x6957('0x3')]=0x0;this[_0x6957('0x1f')]=0x0;this[_0x6957('0x19')]=0x0;this[_0x6957('0x6')]=0x0;this[_0x6957('0x16')]=0x0;this[_0x6957('0x17')]=0x0;this[_0x6957('0x1e')]=0x0;this[_0x6957('0x1a')]=0x0;this['ringInUse']=0x0;this[_0x6957('0x18')]=0x0;if(_0x41a1ba){if(_0x41a1ba['available']){this['available']=Number(_0x41a1ba[_0x6957('0x0')]);}if(_0x41a1ba['loggedin']){this['loggedIn']=Number(_0x41a1ba[_0x6957('0x3f')]);}if(_0x41a1ba[_0x6957('0x40')]){this[_0x6957('0x4')]=Number(_0x41a1ba[_0x6957('0x40')]);}}for(var _0x31ca13=0x0;_0x31ca13<_0x22ec26[_0x6957('0x41')];_0x31ca13++){var _0x1588d6=_0x2298e0[_0x6957('0x42')+_0x22ec26[_0x31ca13][_0x6957('0x14')]];if(_0x1588d6&&_0x1588d6[_0x6957('0x43')]){this['loggedInDb']+=0x1;}if(_0x22ec26[_0x31ca13]['incall']==='1'){this[_0x6957('0x10')]+=0x1;}if(_0x22ec26[_0x31ca13]['paused']==='1'&&!['2','7','8'][_0x6957('0x44')](_0x22ec26[_0x31ca13][_0x6957('0x45')])){this['paused']+=0x1;}switch(_0x22ec26[_0x31ca13][_0x6957('0x45')]){case'0':this[_0x6957('0x1f')]+=0x1;break;case'1':this[_0x6957('0x19')]+=0x1;break;case'2':this[_0x6957('0x6')]+=0x1;break;case'3':this[_0x6957('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x6957('0x1e')]+=0x1;break;case'6':this[_0x6957('0x1a')]+=0x1;break;case'7':this[_0x6957('0x1b')]+=0x1;break;case'8':this[_0x6957('0x18')]+=0x1;break;}}if(this['dialMethod']===_0x6957('0x46')){var _0x7d8248=Object['keys'](_0x2d1d22);for(var _0x1768ba=0x0;_0x1768ba<_0x7d8248[_0x6957('0x41')];_0x1768ba++){var _0x3b1aac=_0x7d8248[_0x1768ba];var _0x118616=_0x2d1d22[_0x3b1aac];if(_0x118616['queue']===this['name']&&_0x118616[_0x6957('0x1d')]===_0x6957('0x47')&&_0x118616[_0x6957('0x48')]===_0x6957('0x49')){this['talking']+=0x1;}}if(this[_0x6957('0x10')]>this[_0x6957('0x6')]){this[_0x6957('0x10')]=this['inUse'];}this[_0x6957('0x21')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x6957('0x4a')]=function(_0x4858b4){var _0x52128f=![];if(_0x4858b4){_0x52128f=INBOUND_COUNTERS[_0x6957('0x4b')](function(_0x371e29){return this[_0x371e29]!==_0x4858b4[_0x371e29];},this);}return _0x52128f;};VoiceQueueSummary[_0x6957('0x3d')][_0x6957('0x4c')]=function(_0x1d5854){var _0x2d9273=![];var _0x2dba35=![];var _0x1006a5=![];if(_0x1d5854){_0x2d9273=this[_0x6957('0x23')]!==_0x1d5854[_0x6957('0x23')]||this['dialActive']!==_0x1d5854[_0x6957('0x22')]||this[_0x6957('0x4d')]!==_0x1d5854[_0x6957('0x4d')]||this['statusMessage']!==_0x1d5854[_0x6957('0x3b')];_0x2dba35=OUTBOUND_COUNTERS['some'](function(_0xa73e4){return this[_0xa73e4]!==_0x1d5854[_0xa73e4];},this);if(this[_0x6957('0x3c')]&&_0x1d5854['Trunk']){_0x1006a5=this[_0x6957('0x3c')][_0x6957('0x14')]!==_0x1d5854[_0x6957('0x3c')][_0x6957('0x14')]||this[_0x6957('0x3c')][_0x6957('0x4e')]!==_0x1d5854[_0x6957('0x3c')][_0x6957('0x4e')];}}return _0x2d9273||_0x2dba35||_0x1006a5;};VoiceQueueSummary['prototype'][_0x6957('0x4f')]=function(_0x59f156){this[_0x6957('0x5')]=_0x59f156[_0x6957('0x5')];this[_0x6957('0x4d')]=_0x59f156['message'];this[_0x6957('0x3b')]=_0x59f156[_0x6957('0x3b')];this[_0x6957('0x7')]=_0x59f156['originated'];this[_0x6957('0x50')]=_0x59f156[_0x6957('0x50')];this[_0x6957('0x8')]=_0x59f156[_0x6957('0x8')];this['outboundBlacklistCallsDay']=_0x59f156[_0x6957('0x9')];this['outboundBusyCallsDay']=_0x59f156[_0x6957('0xa')];this[_0x6957('0xb')]=_0x59f156[_0x6957('0xb')];this['outboundNoAnswerCallsDay']=_0x59f156[_0x6957('0xc')];this['outboundNoSuchCallsDay']=_0x59f156[_0x6957('0xd')];this[_0x6957('0x2e')]=_0x59f156['outboundReCallsDay'];this[_0x6957('0xe')]=_0x59f156[_0x6957('0xe')];this[_0x6957('0xf')]=_0x59f156[_0x6957('0xf')];this['sumBillable']=_0x59f156[_0x6957('0x11')];this['sumDuration']=_0x59f156['sumDuration'];this[_0x6957('0x13')]=_0x59f156['total'];if(this[_0x6957('0x23')]===_0x6957('0x51')){this[_0x6957('0x21')]=_0x59f156[_0x6957('0x21')];}};module[_0x6957('0x52')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 14b687d..b694603 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 _0xa5d0=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x22685c,_0x478276){var _0x429490=function(_0x553fd2){while(--_0x553fd2){_0x22685c['push'](_0x22685c['shift']());}};_0x429490(++_0x478276);}(_0xa5d0,0x95));var _0x0a5d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa5d0[_0x3ff085];return _0x2b68c3;};'use strict';function VtigerAccount(_0x5a6130){this['id']=_0x5a6130['id']||0x0;this[_0x0a5d('0x0')]=_0x5a6130['name']||'';this[_0x0a5d('0x1')]=_0x5a6130[_0x0a5d('0x1')]||'';this[_0x0a5d('0x2')]=_0x5a6130['accessKey']||'';this[_0x0a5d('0x3')]=_0x5a6130['remoteUri']||'';this[_0x0a5d('0x4')]=_0x5a6130[_0x0a5d('0x4')]||'';this[_0x0a5d('0x5')]=_0x5a6130[_0x0a5d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x6029=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x2598ef,_0x527446){var _0x4b5f0a=function(_0x4641df){while(--_0x4641df){_0x2598ef['push'](_0x2598ef['shift']());}};_0x4b5f0a(++_0x527446);}(_0x6029,0x18f));var _0x9602=function(_0x5e5ce9,_0x1e6447){_0x5e5ce9=_0x5e5ce9-0x0;var _0xab8835=_0x6029[_0x5e5ce9];return _0xab8835;};'use strict';function VtigerAccount(_0x3155dd){this['id']=_0x3155dd['id']||0x0;this[_0x9602('0x0')]=_0x3155dd[_0x9602('0x0')]||'';this[_0x9602('0x1')]=_0x3155dd[_0x9602('0x1')]||'';this['accessKey']=_0x3155dd[_0x9602('0x2')]||'';this['remoteUri']=_0x3155dd[_0x9602('0x3')]||'';this['serverUrl']=_0x3155dd[_0x9602('0x4')]||'';this['Configurations']=_0x3155dd[_0x9602('0x5')]||{};}module[_0x9602('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 6dee958..601fc1a 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 _0x8af3=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x8af3,0x160));var _0x38af=function(_0x38218f,_0x791c41){_0x38218f=_0x38218f-0x0;var _0xb1450=_0x8af3[_0x38218f];return _0xb1450;};'use strict';function ZendeskAccount(_0x3ba8b1){this['id']=_0x3ba8b1['id']||0x0;this['name']=_0x3ba8b1[_0x38af('0x0')]||'';this[_0x38af('0x1')]=_0x3ba8b1[_0x38af('0x1')]||'';this[_0x38af('0x2')]=_0x3ba8b1[_0x38af('0x2')]||'';this[_0x38af('0x3')]=_0x3ba8b1['token']||'';this['remoteUri']=_0x3ba8b1[_0x38af('0x4')]||'';this[_0x38af('0x5')]=_0x3ba8b1[_0x38af('0x5')]||'';this[_0x38af('0x6')]=_0x3ba8b1['type']||_0x38af('0x7');this[_0x38af('0x8')]=_0x3ba8b1[_0x38af('0x8')]||'';this['Configurations']=_0x3ba8b1[_0x38af('0x9')]||{};}module[_0x38af('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x6ef6=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x29c752,_0x2eefba){var _0x40313c=function(_0x517c8d){while(--_0x517c8d){_0x29c752['push'](_0x29c752['shift']());}};_0x40313c(++_0x2eefba);}(_0x6ef6,0x1bd));var _0x66ef=function(_0x5f1d5a,_0x1c85a7){_0x5f1d5a=_0x5f1d5a-0x0;var _0x449071=_0x6ef6[_0x5f1d5a];return _0x449071;};'use strict';function ZendeskAccount(_0x20bc96){this['id']=_0x20bc96['id']||0x0;this['name']=_0x20bc96[_0x66ef('0x0')]||'';this['username']=_0x20bc96[_0x66ef('0x1')]||'';this[_0x66ef('0x2')]=_0x20bc96[_0x66ef('0x2')]||'';this[_0x66ef('0x3')]=_0x20bc96[_0x66ef('0x3')]||'';this[_0x66ef('0x4')]=_0x20bc96[_0x66ef('0x4')]||'';this[_0x66ef('0x5')]=_0x20bc96[_0x66ef('0x5')]||'';this[_0x66ef('0x6')]=_0x20bc96[_0x66ef('0x6')]||_0x66ef('0x7');this['serverUrl']=_0x20bc96[_0x66ef('0x8')]||'';this[_0x66ef('0x9')]=_0x20bc96[_0x66ef('0x9')]||{};}module[_0x66ef('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 9660e67..599c2f3 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 _0xe995=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x3944ac,_0x296dee){var _0x373caf=function(_0x320c39){while(--_0x320c39){_0x3944ac['push'](_0x3944ac['shift']());}};_0x373caf(++_0x296dee);}(_0xe995,0x167));var _0x5e99=function(_0x1d84b1,_0x1d88d0){_0x1d84b1=_0x1d84b1-0x0;var _0x4a9e19=_0xe995[_0x1d84b1];return _0x4a9e19;};'use strict';function ZohoAccount(_0x58e0e0){this['id']=_0x58e0e0['id']||0x0;this[_0x5e99('0x0')]=_0x58e0e0[_0x5e99('0x0')]||'';this[_0x5e99('0x1')]=_0x58e0e0[_0x5e99('0x1')]||'';this[_0x5e99('0x2')]=_0x58e0e0[_0x5e99('0x2')]||'';this[_0x5e99('0x3')]=_0x58e0e0[_0x5e99('0x3')]||'';this['clientId']=_0x58e0e0[_0x5e99('0x4')]||'';this[_0x5e99('0x5')]=_0x58e0e0[_0x5e99('0x5')]||'';this[_0x5e99('0x6')]=_0x58e0e0[_0x5e99('0x6')]||'';this[_0x5e99('0x7')]=_0x58e0e0['code']||'';this[_0x5e99('0x8')]=_0x58e0e0['refreshToken']||'';this[_0x5e99('0x9')]=_0x58e0e0[_0x5e99('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xa824=['clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description','host','zone'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xa824,0x132));var _0x4a82=function(_0x1b065f,_0x1ff000){_0x1b065f=_0x1b065f-0x0;var _0x38a7b8=_0xa824[_0x1b065f];return _0x38a7b8;};'use strict';function ZohoAccount(_0x166543){this['id']=_0x166543['id']||0x0;this[_0x4a82('0x0')]=_0x166543['name']||'';this[_0x4a82('0x1')]=_0x166543['description']||'';this[_0x4a82('0x2')]=_0x166543['host']||'';this['zone']=_0x166543[_0x4a82('0x3')]||'';this[_0x4a82('0x4')]=_0x166543[_0x4a82('0x4')]||'';this['clientSecret']=_0x166543[_0x4a82('0x5')]||'';this['serverUrl']=_0x166543[_0x4a82('0x6')]||'';this[_0x4a82('0x7')]=_0x166543[_0x4a82('0x7')]||'';this[_0x4a82('0x8')]=_0x166543[_0x4a82('0x8')]||'';this['Configurations']=_0x166543['Configurations']||{};}module[_0x4a82('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 731047b..5b3b79e 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 _0xfcbb=['name','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x183b8a,_0x209523){_0x183b8a=_0x183b8a-0x0;var _0x1271c0=_0xfcbb[_0x183b8a];return _0x1271c0;};'use strict';var util=require(_0xbfcb('0x0'));var _=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));function checkNameSurname(_0x5a1002,_0x5747a4,_0x462349){var _0x280329='';if(!_[_0xbfcb('0x3')](_0x5747a4)&&_0xbfcb('0x4')===typeof _0x5747a4){_0x280329+=_0x5747a4;}if(!_[_0xbfcb('0x3')](_0x462349)&&'string'===typeof _0x462349){_0x280329+='\x20'+_0x462349;}if(_0x280329!==''){return _0x280329;}return _0x5a1002;}function Action(_0x5201d3,_0x32c2aa,_0x4990c,_0x8d4e6a,_0x2df839){this[_0xbfcb('0x5')]=_0x4990c||undefined;this[_0xbfcb('0x6')]=_0x5201d3['id'];this[_0xbfcb('0x7')]=_0x32c2aa['name'];this[_0xbfcb('0x8')]=_0x32c2aa[_0xbfcb('0x8')];this[_0xbfcb('0x9')]='queue';this[_0xbfcb('0xa')]=![];this[_0xbfcb('0xb')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?undefined:_0x5201d3[_0xbfcb('0xc')][_0xbfcb('0xd')];this['channelAgent']=this[_0xbfcb('0xb')]?util[_0xbfcb('0xe')](_0xbfcb('0xf'),this[_0xbfcb('0xb')]):_0x8d4e6a||undefined;this['calleridname']=checkNameSurname(_0x5201d3[_0xbfcb('0x10')]['phone'],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x11')],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x12')]);this[_0xbfcb('0x13')]=_0x5201d3[_0xbfcb('0x13')]||![];this[_0xbfcb('0x14')]=_0x5201d3[_0xbfcb('0x15')];this[_0xbfcb('0x16')]=_0x5201d3[_0xbfcb('0x16')];this[_0xbfcb('0x17')]=_0x5201d3[_0xbfcb('0x17')]||0x0;this[_0xbfcb('0x18')]=_0x5201d3[_0xbfcb('0x18')]||0x0;this[_0xbfcb('0x19')]=_0x5201d3[_0xbfcb('0x19')]||0x0;this[_0xbfcb('0x1a')]=(_0x5201d3[_0xbfcb('0x17')]||0x0)+(_0x5201d3[_0xbfcb('0x18')]||0x0)+(_0x5201d3[_0xbfcb('0x19')]||0x0)+(_0x5201d3[_0xbfcb('0x1b')]||0x0)+(_0x5201d3[_0xbfcb('0x1c')]||0x0)+(_0x5201d3['countabandonedretry']||0x0)+(_0x5201d3[_0xbfcb('0x1d')]||0x0)+(_0x5201d3[_0xbfcb('0x1e')]||0x0);this['countnosuchnumberretry']=_0x5201d3[_0xbfcb('0x1b')]||0x0;this[_0xbfcb('0x1c')]=_0x5201d3['countdropretry']||0x0;this['countabandonedretry']=_0x5201d3[_0xbfcb('0x1f')]||0x0;this[_0xbfcb('0x1d')]=_0x5201d3[_0xbfcb('0x1d')]||0x0;this[_0xbfcb('0x1e')]=_0x5201d3[_0xbfcb('0x1e')]||0x0;this['callback']=_0x5201d3[_0xbfcb('0x20')];this[_0xbfcb('0x21')]=_0x5201d3[_0xbfcb('0x21')];this[_0xbfcb('0x22')]=_0x5201d3[_0xbfcb('0x22')];this[_0xbfcb('0x23')]=_0x5201d3[_0xbfcb('0x23')];this[_0xbfcb('0x24')]=_0x5201d3[_0xbfcb('0x24')];this[_0xbfcb('0x25')]=_0x5201d3[_0xbfcb('0x25')];this[_0xbfcb('0x26')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?_0x5201d3[_0xbfcb('0x26')]:_0x5201d3[_0xbfcb('0xc')]['id'];this['VoiceQueueId']=_0x5201d3[_0xbfcb('0x27')];this[_0xbfcb('0x28')]='';this['originatecalleridname']='';}Action[_0xbfcb('0x29')][_0xbfcb('0x2a')]=function(){return util[_0xbfcb('0xe')](_0xbfcb('0x2b'),this[_0xbfcb('0x2c')],this[_0xbfcb('0x2d')]);};module[_0xbfcb('0x2e')]=Action; \ No newline at end of file +var _0xd943=['countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','type','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd943,0x15d));var _0x3d94=function(_0x168eef,_0x387707){_0x168eef=_0x168eef-0x0;var _0x157997=_0xd943[_0x168eef];return _0x157997;};'use strict';var util=require(_0x3d94('0x0'));var _=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));function checkNameSurname(_0x440dd8,_0x5495df,_0x691e28){var _0x3edd1b='';if(!_[_0x3d94('0x3')](_0x5495df)&&_0x3d94('0x4')===typeof _0x5495df){_0x3edd1b+=_0x5495df;}if(!_[_0x3d94('0x3')](_0x691e28)&&'string'===typeof _0x691e28){_0x3edd1b+='\x20'+_0x691e28;}if(_0x3edd1b!==''){return _0x3edd1b;}return _0x440dd8;}function Action(_0x54e692,_0x34c9c3,_0x51cf1f,_0x54e81f,_0x4d29e7){this[_0x3d94('0x5')]=_0x51cf1f||undefined;this[_0x3d94('0x6')]=_0x54e692['id'];this['queue']=_0x34c9c3['name'];this[_0x3d94('0x7')]=_0x34c9c3[_0x3d94('0x7')];this[_0x3d94('0x8')]='queue';this[_0x3d94('0x9')]=![];this['membername']=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?undefined:_0x54e692['Agent'][_0x3d94('0xb')];this[_0x3d94('0xc')]=this[_0x3d94('0xd')]?util[_0x3d94('0xe')](_0x3d94('0xf'),this['membername']):_0x54e81f||undefined;this[_0x3d94('0x10')]=checkNameSurname(_0x54e692[_0x3d94('0x11')][_0x3d94('0x12')],_0x54e692['Contact'][_0x3d94('0x13')],_0x54e692[_0x3d94('0x11')][_0x3d94('0x14')]);this['active']=_0x54e692[_0x3d94('0x15')]||![];this[_0x3d94('0x16')]=_0x54e692[_0x3d94('0x12')];this[_0x3d94('0x17')]=_0x54e692[_0x3d94('0x17')];this[_0x3d94('0x18')]=_0x54e692[_0x3d94('0x18')]||0x0;this[_0x3d94('0x19')]=_0x54e692['countcongestionretry']||0x0;this[_0x3d94('0x1a')]=_0x54e692[_0x3d94('0x1a')]||0x0;this[_0x3d94('0x1b')]=(_0x54e692[_0x3d94('0x18')]||0x0)+(_0x54e692[_0x3d94('0x19')]||0x0)+(_0x54e692[_0x3d94('0x1a')]||0x0)+(_0x54e692[_0x3d94('0x1c')]||0x0)+(_0x54e692['countdropretry']||0x0)+(_0x54e692[_0x3d94('0x1d')]||0x0)+(_0x54e692['countmachineretry']||0x0)+(_0x54e692[_0x3d94('0x1e')]||0x0);this[_0x3d94('0x1c')]=_0x54e692[_0x3d94('0x1c')]||0x0;this[_0x3d94('0x1f')]=_0x54e692[_0x3d94('0x1f')]||0x0;this['countabandonedretry']=_0x54e692['countabandonedretry']||0x0;this[_0x3d94('0x20')]=_0x54e692[_0x3d94('0x20')]||0x0;this[_0x3d94('0x1e')]=_0x54e692['countagentrejectretry']||0x0;this[_0x3d94('0x21')]=_0x54e692[_0x3d94('0x21')];this[_0x3d94('0x22')]=_0x54e692[_0x3d94('0x22')];this[_0x3d94('0x23')]=_0x54e692[_0x3d94('0x23')];this[_0x3d94('0x24')]=_0x54e692[_0x3d94('0x24')];this[_0x3d94('0x25')]=_0x54e692[_0x3d94('0x25')];this[_0x3d94('0x26')]=_0x54e692[_0x3d94('0x26')];this[_0x3d94('0x27')]=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?_0x54e692['UserId']:_0x54e692[_0x3d94('0xa')]['id'];this['VoiceQueueId']=_0x54e692[_0x3d94('0x28')];this[_0x3d94('0x29')]='';this[_0x3d94('0x2a')]='';}Action[_0x3d94('0x2b')][_0x3d94('0x2c')]=function(){return util[_0x3d94('0xe')](_0x3d94('0x2d'),this['calleridname'],this['number']);};module[_0x3d94('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 447ea1a..d929124 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 _0x55ca=['syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','originated','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clockClearZombieChannels','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','pick','UserId','ListId','Action','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Queue','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','status','reachable','unmonitored','run','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','originateresponse','syncOriginateResponse','bind','hangup','syncHangup'];(function(_0xaa6625,_0x5a7df8){var _0x5dd2b4=function(_0x2fbf37){while(--_0x2fbf37){_0xaa6625['push'](_0xaa6625['shift']());}};_0x5dd2b4(++_0x5a7df8);}(_0x55ca,0x126));var _0xa55c=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x55ca[_0x4bc428];return _0x3ca37f;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xa55c('0x2'));var logger=require(_0xa55c('0x3'))('preview');var loggerAction=require(_0xa55c('0x3'))(_0xa55c('0x4'));var ami=require(_0xa55c('0x5'));var rpcDb=require(_0xa55c('0x6'));var cmHopperAdditionalPhone=require(_0xa55c('0x7'));var Action=require(_0xa55c('0x8'));var ut=require(_0xa55c('0x9'));var utils=require('../dialer/utils');config[_0xa55c('0xa')]=_[_0xa55c('0xb')](config['redis'],{'host':_0xa55c('0xc'),'port':0x18eb});var io=require(_0xa55c('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xa55c('0xe')]=function(_0x20c76a){this[_0xa55c('0xf')]=this[_0xa55c('0xf')]?this[_0xa55c('0xf')][_0xa55c('0x10')](_0x20c76a):_0x20c76a();};function Preview(_0x508342){this[_0xa55c('0x11')]=new Sequence();this[_0xa55c('0x12')]=_0x508342[_0xa55c('0x13')];this['trunks']=_0x508342['trunks'];this[_0xa55c('0x14')]={};this['agents']=_0x508342['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xa55c('0x15'),this[_0xa55c('0x16')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x18'),this[_0xa55c('0x19')][_0xa55c('0x17')](this));ami['on']('hanguprequest',this[_0xa55c('0x1a')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1b'),this[_0xa55c('0x1c')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1d'),this[_0xa55c('0x1e')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1f'),this['syncVarSet'][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x20'),this[_0xa55c('0x21')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x22'),this[_0xa55c('0x23')]['bind'](this));this['loopCampaigns'](this[_0xa55c('0x12')]);}function emit(_0x3776ac,_0xade4c4,_0x4cfe10){io['to'](_0x3776ac)[_0xa55c('0x24')](_0xade4c4,_0x4cfe10);}function emitVoiceQueueChannelRemove(_0x2fcb90){logger['info'](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x2fcb90));emit(util[_0xa55c('0x27')](_0xa55c('0x28'),_0x2fcb90[_0xa55c('0x29')]),'voice_queue_channel:remove',_0x2fcb90);io[_0xa55c('0x24')]('voice_queue_presence:remove',_0x2fcb90);}function notSendMessagesQueue(_0x5ba836){if(_0x5ba836['sendMessageOneNotActive']){if(_0x5ba836[_0xa55c('0x2a')]===0x0&&_0x5ba836['pTalking']===0x0){_0x5ba836[_0xa55c('0x2b')]=![];_0x5ba836[_0xa55c('0x2c')]=0x0;_0x5ba836[_0xa55c('0x2d')]=0x0;_0x5ba836[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x30')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+_0xa55c('0x33'));}else{_0x5ba836[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x34')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+'\x20is\x20deactivated');}}}Preview[_0xa55c('0x35')][_0xa55c('0x36')]=function(){var _0x1b8388=this;setInterval(function(){_0x1b8388[_0xa55c('0x37')]();},0x7cf);};Preview[_0xa55c('0x35')][_0xa55c('0x37')]=function(){var _0x52d37f=this[_0xa55c('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x35c9c2 in _0x52d37f){if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&(_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')||_0x52d37f[_0x35c9c2]['dialMethod']===_0xa55c('0x3b'))&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(this[_0xa55c('0x3e')]>0x7){this[_0xa55c('0x3e')]=0x0;this[_0xa55c('0x3f')]();}}if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(_0x52d37f[_0x35c9c2]['dialActive']){this['setMessage'](_0x52d37f[_0x35c9c2]);if(_0x52d37f[_0x35c9c2][_0xa55c('0x40')])this[_0xa55c('0x41')](_0x52d37f[_0x35c9c2]);}else{notSendMessagesQueue(_0x52d37f[_0x35c9c2]);}}}};Preview['prototype'][_0xa55c('0x42')]=function(_0x2f0110){var _0x2e9623=this;this[_0xa55c('0x11')][_0xa55c('0xe')](function(){if(!_[_0xa55c('0x43')](_0x2e9623[_0xa55c('0x14')][_0x2f0110])){loggerAction[_0xa55c('0x44')](_0xa55c('0x45'),_0x2f0110,'Queue',_0x2e9623['actions'][_0x2f0110]['queue'],_0xa55c('0x46'),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x12')][_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]]['originated']),_0xa55c('0x48'),JSON['stringify'](_0x2e9623[_0xa55c('0x12')][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]]['pTalking']),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x14')][_0x2f0110]['dialAnswer']),JSON[_0xa55c('0x26')](_[_0xa55c('0x49')](_0x2e9623['actions'][_0x2f0110],['contactId',_0xa55c('0x4a'),'VoiceQueueId',_0xa55c('0x4b')])));return ami[_0xa55c('0x4c')]({'action':'status','channel':_0x2e9623['actions'][_0x2f0110]['channel']})['catch'](function(_0x3b3308){if(_0x3b3308[_0xa55c('0x2e')]===_0xa55c('0x4d')){setTimeout(function(){if(_0x2e9623[_0xa55c('0x14')][_0x2f0110]){ut[_0xa55c('0x4e')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]],_0xa55c('0x4f'));if(_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x50')]===!![]){ut[_0xa55c('0x51')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110]['queue']],'[clearZombieChannel]');ut[_0xa55c('0x52')](_0xa55c('0x53')+_0x2f0110,_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2f0110,_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]);delete _0x2e9623[_0xa55c('0x14')][_0x2f0110];}},0x2328);}});}});};Preview['prototype'][_0xa55c('0x3f')]=function(){var _0xd5a006=this;loggerAction['info'](_0xa55c('0x54'),_['size'](this[_0xa55c('0x14')]));for(var _0x43a42d in this['actions']){if(_0xd5a006[_0xa55c('0x14')][_0xa55c('0x38')](_0x43a42d)){_0xd5a006['clearZombieChannel'](_0x43a42d);}}};Preview[_0xa55c('0x35')][_0xa55c('0x41')]=function(_0x204767){var _0x59a6c8=this;rpcDb[_0xa55c('0x55')](_0x204767['id'],ut['agentReadyId'](this[_0xa55c('0x56')]))[_0xa55c('0x57')](function(_0x451269){if(!_['isNil'](_0x451269)){for(var _0x41eab1=0x0;_0x41eab1<_0x451269[_0xa55c('0x58')];_0x41eab1+=0x1){if(ut['getDiff'](_0x451269[_0x41eab1][_0xa55c('0x59')])<_0x204767[_0xa55c('0x5a')]*0x3c){if(_0x451269[_0x41eab1]['Agent']&&!_0x451269[_0x41eab1][_0xa55c('0x5b')][_0xa55c('0x5c')]){_0x59a6c8['run'](_0x451269[_0x41eab1]['id'])[_0xa55c('0x57')](ut[_0xa55c('0x5d')](_0xa55c('0x5e')))[_0xa55c('0x5f')](ut['logger2'](_0xa55c('0x5e')));}else{rpcDb['disableContact'](_0x451269[_0x41eab1]['id']);}}else{var _0x2157d6=new Action(_0x451269[_0x41eab1],_0x204767);_0x2157d6[_0xa55c('0x60')]=moment()[_0xa55c('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x204767[_0xa55c('0x61')]+=0x1;ut[_0xa55c('0x62')](_0x2157d6,0x17,'RecallInQueue');if(_0x204767[_0xa55c('0x63')]){rpcDb[_0xa55c('0x64')](ut[_0xa55c('0x65')](_0x451269[_0x41eab1]));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x67'));}else{ut[_0xa55c('0x62')](_0x2157d6,0x16,_0xa55c('0x68'));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x69'));rpcDb[_0xa55c('0x6a')](_0x2157d6,'[HistoryRecallClose]');}}}}})[_0xa55c('0x5f')](ut[_0xa55c('0x5d')](_0xa55c('0x6b')));};Preview['prototype'][_0xa55c('0x6c')]=function(_0x35bf0a){_0x35bf0a['sendMessageOneNotActive']=!![];if(ut[_0xa55c('0x6d')](_0x35bf0a['loggedIn'])){_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x6e')];}else if(!ut[_0xa55c('0x6f')](_0x35bf0a[_0xa55c('0x70')])){_0x35bf0a['message']=utils[_0xa55c('0x2f')][_0xa55c('0x30')];}else if(!this['isTrunkReachable'](_0x35bf0a[_0xa55c('0x71')])){if(!this[_0xa55c('0x72')](_0x35bf0a[_0xa55c('0x73')])){_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x74')];}}else{_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x74')];}};Preview['prototype'][_0xa55c('0x75')]=function(_0x437ced,_0x20593d,_0x2ccfb1){var _0xec640=this;var _0x53b2f7=this[_0xa55c('0x14')][_0x20593d];var _0x54f776=this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]];var _0x2cfe08;var _0x1e1c5b=![];var _0x19aaf5=0x2;var _0x138c9e=0x3;if(_0x54f776){switch(_0x2ccfb1){case'1':_0x54f776[_0xa55c('0x76')]+=0x1;_0x53b2f7['countnosuchnumberretry']+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x0,_0xa55c('0x79'));ami[_0xa55c('0x24')]('custom:agentnosuchnumber',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x7b')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x7c'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'0',_0x54f776)['then'](function(_0xdd92c1){_0x1e1c5b=_0xdd92c1[_0xa55c('0x7e')]==0x1;_0x19aaf5=_0x54f776[_0xa55c('0x7f')];_0x138c9e=_0x54f776[_0xa55c('0x80')];if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x53b2f7[_0xa55c('0x82')]>=_0x54f776['dialNoSuchNumberMaxRetry']){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x83'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0x82'),_0x54f776[_0xa55c('0x7f')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0x53b2f7['countnosuchnumberretry']++;logger[_0xa55c('0x44')](_0xa55c('0x89'),_0x53b2f7['countnosuchnumberretry']);logger[_0xa55c('0x44')]('id',_0x53b2f7[_0xa55c('0x8a')]);_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnosuchnumberretry':_0x53b2f7[_0xa55c('0x82')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'ANSWER':var _0x1dfaf7=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x53b2f7[_0xa55c('0x8e')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x8f')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x50')]=!![];_0x54f776[_0xa55c('0x90')]+=0x1;logger[_0xa55c('0x44')](_0xa55c('0x91'),_0x53b2f7['uniqueid'],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);ami[_0xa55c('0x24')](_0xa55c('0x93'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x94'),this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]]));if(_0x54f776[_0xa55c('0x95')]){ami['emit'](_0xa55c('0x96'),ut['buildAcw'](_0x53b2f7));}break;case'16':ami[_0xa55c('0x24')](_0xa55c('0x97'),ut[_0xa55c('0x7a')](_0x53b2f7,'complete',this['campaignsPreview'][_0x53b2f7[_0xa55c('0x47')]]));emitVoiceQueueChannelRemove(ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x98')));_0x54f776[_0xa55c('0x99')]+=0x1;_0x54f776['total']+=0x1;_0x54f776[_0xa55c('0x9a')]+=0x1;ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0x9b'));_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x4,'Answer');rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x9c'));rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x9d'));rpcDb[_0xa55c('0x9e')](_0x53b2f7);_0x54f776['sumDuration']+=_0x53b2f7[_0xa55c('0x9f')];_0x54f776[_0xa55c('0xa0')]+=_0x53b2f7['talktime'];logger[_0xa55c('0x44')](_0xa55c('0xa1'),_0x53b2f7[_0xa55c('0xa2')],'\x20Queue',_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];break;case'BUSY':_0x54f776[_0xa55c('0xa3')]+=0x1;_0x53b2f7[_0xa55c('0xa4')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x5,'Busy');_0x19aaf5=_0x54f776[_0xa55c('0xa5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xa6'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xa7')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xa8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'5',_0x54f776)['then'](function(_0x463195){_0x1e1c5b=_0x463195[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xab'));}else{if(_0x53b2f7[_0xa55c('0xa4')]>=_0x54f776['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x53b2f7,_0xa55c('0xa8'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xa4'),_0x54f776['dialBusyRetryFrequency']),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xa4')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countbusyretry':_0x53b2f7[_0xa55c('0xa4')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case _0xa55c('0xac'):_0x54f776['outboundNoAnswerCallsDay']+=0x1;_0x53b2f7[_0xa55c('0xad')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x3,_0xa55c('0xae'));_0x19aaf5=_0x54f776[_0xa55c('0xaf')];_0x138c9e=_0x54f776[_0xa55c('0x80')];var _0x402f02=ut[_0xa55c('0xb0')](_0x53b2f7,_0x54f776);ami[_0xa55c('0x24')]('custom:agentnoanswer',_0x402f02);rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xb1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'3',_0x54f776)[_0xa55c('0x57')](function(_0x256db0){_0x1e1c5b=_0x256db0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb2'));}else{if(_0x53b2f7[_0xa55c('0xad')]>=_0x54f776[_0xa55c('0xb3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xad'),_0x54f776[_0xa55c('0xaf')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})['then'](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CONGESTION':_0x54f776['outboundCongestionCallsDay']+=0x1;_0x53b2f7['countcongestionretry']+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x8,_0xa55c('0xb4'));_0x19aaf5=_0x54f776[_0xa55c('0xb5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')]('custom:agentcongestion',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xb6')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xb7'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'8',_0x54f776)[_0xa55c('0x57')](function(_0x25e4e0){_0x1e1c5b=_0x25e4e0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb8'));}else{if(_0x53b2f7[_0xa55c('0xb9')]>=_0x54f776[_0xa55c('0xba')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb7'));}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,'countcongestionretry',_0x54f776[_0xa55c('0xa5')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xb9')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countcongestionretry':_0x53b2f7[_0xa55c('0xb9')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CANCEL':_0x54f776[_0xa55c('0xbb')]+=0x1;_0x53b2f7[_0xa55c('0xbc')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x14,_0xa55c('0xbd'));_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xbf'),ut['buildObj'](_0x53b2f7,_0xa55c('0xc0')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)[_0xa55c('0x57')](function(_0x31287c){_0x1e1c5b=_0x31287c[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x14,_0xa55c('0xbd'));rpcDb['createCustomerFinal'](_0x2cfe08,_0xa55c('0xc2'));}else{if(_0x53b2f7[_0xa55c('0xbc')]>=_0x54f776[_0xa55c('0xc3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,'countagentrejectretry',_0x54f776[_0xa55c('0xbe')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640['incrementPreviewCounters']({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case _0xa55c('0xc4'):_0x54f776[_0xa55c('0xc5')]+=0x1;_0x53b2f7[_0xa55c('0xc6')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0xb,_0xa55c('0xc7'));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'11',_0x54f776)['then'](function(_0x46124b){_0x1e1c5b=_0x46124b['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x53b2f7[_0xa55c('0xc9')]>=_0x54f776[_0xa55c('0xca')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,_0xa55c('0xc6'),_0x54f776[_0xa55c('0xcb')]),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case'18':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0xcd')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x12,_0x437ced['cause-txt']||_0x437ced[_0xa55c('0xce')]);ami[_0xa55c('0x24')](_0xa55c('0xcf'),ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb[_0xa55c('0x66')](_0x53b2f7,'[callProgressDetectingCustomer][hangupInAMD]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'18',_0x54f776)['then'](function(_0x4ab9f1){_0x1e1c5b=_0x4ab9f1['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x12,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd0'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd0'));}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;case'19':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x13,_0x437ced[_0xa55c('0xd1')]||_0x437ced['dialstatus']);ami[_0xa55c('0x24')]('custom:amd',ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xd2'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'18',_0x54f776)['then'](function(_0x2961b6){_0x1e1c5b=_0x2961b6[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd2'));}else{rpcDb['createCustomerFinal'](_0x53b2f7,'[callProgressDetectingCustomer][machine]');}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;default:if(_0x53b2f7[_0xa55c('0x50')]){ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0xd3'));ut[_0xa55c('0x52')](_0xa55c('0xd4')+_0x54f776[_0xa55c('0x29')],_0x437ced);}_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0xc,_0x437ced[_0xa55c('0xd1')]||_0x437ced[_0xa55c('0xce')]);_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x53b2f7,'[callProgressDetectingCustomer][logUnknown]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)['then'](function(_0x1ba04f){_0x1e1c5b=_0x1ba04f[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd5'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd5'));}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});}});}if(!(_0x53b2f7[_0xa55c('0x50')]&&_0x2ccfb1==='16')){ut[_0xa55c('0x4e')](_0x54f776,_0xa55c('0xd6'));logger[_0xa55c('0x44')](_0xa55c('0xd7'),_0x53b2f7[_0xa55c('0xa2')],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x46'),_0x54f776[_0xa55c('0x2a')]);}if(_0x2ccfb1!=='ANSWER'){delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];delete this['actions'][_0x437ced[_0xa55c('0xd8')]];}_0x54f776[_0xa55c('0xd9')]=!![];}};Preview[_0xa55c('0x35')][_0xa55c('0xda')]=function(_0x31767b,_0x4d9b66,_0x456dd4){if(_['isUndefined'](_0x4d9b66)&&'object'!==typeof _0x4d9b66){return;}if(_[_0xa55c('0xdb')](_0x456dd4)&&_0xa55c('0xdc')!==typeof _0x456dd4){return;}switch(_0x456dd4[_0xa55c('0xdd')]){case'0':ut[_0xa55c('0xde')](_0x31767b,0x0,_0xa55c('0x79'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe0'));break;case'3':ut[_0xa55c('0xde')](_0x31767b,0x3,_0xa55c('0xae'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe1'));break;case'5':ut[_0xa55c('0xde')](_0x31767b,0x5,_0xa55c('0xe2'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe3'));break;case'8':ut[_0xa55c('0xde')](_0x31767b,0x8,_0xa55c('0xb4'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe4'));break;case'22':ut['logAgent'](_0x31767b,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x31767b,_0xa55c('0xe5'));break;default:ut[_0xa55c('0xde')](_0x31767b,0xc,_0x456dd4['reason']);rpcDb[_0xa55c('0xdf')](_0x31767b,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa55c('0x4e')](_0x4d9b66,'[callProgressDetectingAgent]');logger[_0xa55c('0x44')](_0xa55c('0xe6'),_0x31767b[_0xa55c('0xa2')],_0xa55c('0x92'),_0x4d9b66[_0xa55c('0x29')],_0xa55c('0x46'),_0x4d9b66[_0xa55c('0x2a')]);delete this[_0xa55c('0x14')][_0x31767b[_0xa55c('0xa2')]];};Preview[_0xa55c('0x35')][_0xa55c('0x7d')]=function(_0x53f209,_0x59f3a4,_0xde7bd){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x53f209,_0x59f3a4,_0xde7bd)[_0xa55c('0x5f')](logger['info'](_0xa55c('0xe7')));};Preview[_0xa55c('0x35')][_0xa55c('0x8c')]=function(_0x5b20c5,_0x3b8f15,_0x18584c){return cmHopperAdditionalPhone[_0xa55c('0x8c')](_0x5b20c5,_0x3b8f15,_0x18584c)['catch'](logger[_0xa55c('0x44')]('[swapAdditionalPhone]\x20'));};Preview[_0xa55c('0x35')]['incrementPreviewCounters']=function(_0x4e8433){return Promise[_0xa55c('0xe8')]()[_0xa55c('0x57')](cmHopperAdditionalPhone[_0xa55c('0x8b')](_0x4e8433))['catch'](logger[_0xa55c('0x44')](_0xa55c('0xe9')));};Preview[_0xa55c('0x35')][_0xa55c('0xea')]=function(_0x4399bd,_0x3e9384,_0x2e76ad,_0x24db74,_0x4b1762){var _0x402298=this;return new Promise(function(_0x1b8b05,_0x80befe){if(_[_0xa55c('0x43')](_0x3e9384)||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xeb')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xec')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xed')])){_0x80befe(ut[_0xa55c('0x2e')]('Contact\x20is\x20undefined',_0x24db74,_0x4b1762));return;}var _0x263d16=uuid['v4']();var _0x48127c=_0x402298['campaignsPreview'][_0x3e9384[_0xa55c('0xee')]['name']];var _0x427e3b=_0x2e76ad?_0x402298['agents'][_0x2e76ad]['id']:undefined;_0x402298[_0xa55c('0x14')][_0x263d16]=new Action(_0x3e9384,_0x48127c,_0x263d16,_0x2e76ad,_0x427e3b);var _0x231499=_0x402298[_0xa55c('0x14')][_0x263d16];_0x231499[_0xa55c('0x86')]=_0x24db74;_0x231499[_0xa55c('0x87')]=_0x4b1762;_0x231499[_0xa55c('0xef')]=_0x2e76ad;if(_[_0xa55c('0xf0')](_0x4399bd)){_0x402298['execCall'](_0x231499,_0x48127c,_0x3e9384,_0x2e76ad)[_0xa55c('0x57')](function(_0x590c0c){logger['info'](_0xa55c('0xf1'),_0xa55c('0xf2')+_0x231499['queue']+_0xa55c('0xf3')+_0x231499[_0xa55c('0x8a')],JSON[_0xa55c('0x26')](_0x590c0c));ami['emit']('custom:agentcalled',ut['buildObj'](_0x231499,'called',_0x402298[_0xa55c('0x12')][_0x231499[_0xa55c('0x47')]]));_0x1b8b05(ut['message'](_0xa55c('0xf4')));})[_0xa55c('0x5f')](function(_0x3b3be0){ut['logger'](_0xa55c('0xf5'),_0x3b3be0);_0x80befe(ut['message']('Call\x20failed',_0x24db74,_0x4b1762));});}else{_0x48127c['outboundBlacklistCallsDay']+=0x1;ut[_0xa55c('0xf6')](_0x231499);rpcDb['createHistory'](_0x231499,_0xa55c('0xf7'));delete _0x402298['actions'][_0x263d16];_0x80befe(ut[_0xa55c('0x2e')](_0xa55c('0xf8'),_0x24db74,_0x4b1762));}});};Preview[_0xa55c('0x35')]['isTrunkReachable']=function(_0x1c016d){return!_[_0xa55c('0x43')](_0x1c016d)&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0x29')])&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0xf9')])&&_0x1c016d[_0xa55c('0xf9')]&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])])&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')])&&(this['trunks'][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')]===_0xa55c('0xfd')||this['trunks'][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])][_0xa55c('0xfc')]===_0xa55c('0xfe'));};Preview[_0xa55c('0x35')][_0xa55c('0xff')]=function(_0x31b866,_0x37ed47){return this['execRun'](_0x31b866,_0x37ed47)[_0xa55c('0x57')](function(_0x331595){return _[_0xa55c('0x49')](_0x331595,[_0xa55c('0x2e')]);})[_0xa55c('0x5f')](function(_0x59a69d){if(_0x59a69d[_0xa55c('0x100')]){rpcDb['unlockContact'](_0x31b866);}if(_0x59a69d['active']){rpcDb[_0xa55c('0x101')](_0x31b866);}throw _[_0xa55c('0x49')](_0x59a69d,[_0xa55c('0x2e')]);});};Preview[_0xa55c('0x35')]['execRun']=function(_0x125812,_0x155c6e){var _0xa22273=this;var _0x1c7506,_0x3b76df;return rpcDb[_0xa55c('0x102')](_0x125812)[_0xa55c('0x57')](function(_0x239b2e){if(!_['isNil'](_0x239b2e[0x0])){_0x3b76df=_0x239b2e[0x0][_0xa55c('0x103')]?![]:!![];_0x1c7506=_0x239b2e[0x0][_0xa55c('0x103')]?!![]:![];_0x1c7506=_0x155c6e?!![]:_0x1c7506;}var _0x2639cc=_0xa22273[_0xa55c('0x104')](_0x239b2e);if(_0x2639cc['isValid']){rpcDb[_0xa55c('0x105')](_[_0xa55c('0x49')](_0x239b2e[0x0],[_0xa55c('0xed'),'phone']))[_0xa55c('0x57')](function(_0x3a67fb){_0xa22273[_0xa55c('0xea')](_0x3a67fb,_0x239b2e[0x0],_0x155c6e,_0x3b76df,_0x1c7506)[_0xa55c('0x57')](function(_0x19e506){return _0x19e506;})[_0xa55c('0x5f')](function(_0x127c2f){throw _0x127c2f;});})['catch'](function(_0xcd4f3a){ut[_0xa55c('0x31')]('[Preview][checkIsBlackList]',_0xcd4f3a);throw ut[_0xa55c('0x2e')](_0xa55c('0x106'),_0x3b76df,_0x1c7506);});}else{throw ut[_0xa55c('0x2e')](_0x2639cc['message'],_0x3b76df,_0x1c7506);}})['catch'](function(_0x4dba17){ut[_0xa55c('0x31')](_0xa55c('0x107'),_0x4dba17);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xa55c('0x35')][_0xa55c('0x104')]=function(_0x591ee3){if(_['isNil'](_0x591ee3)||_[_0xa55c('0xf0')](_0x591ee3)||!_[_0xa55c('0x43')](_0x591ee3[0x0][_0xa55c('0x5b')])&&_['isNil'](_0x591ee3[0x0]['Agent'][_0xa55c('0x29')])){ut['logger'](_0xa55c('0x108'),_0x591ee3);return{'isValid':![],'message':_0xa55c('0x109')};}var _0x5a4e69=this[_0xa55c('0x12')][_0x591ee3[0x0]['Queue']['name']];_0x5a4e69['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xa55c('0x43')](_0x5a4e69)){ut['logger'](_0xa55c('0x10a'),_0x5a4e69);return{'isValid':![],'message':_0xa55c('0x10b')};}if(!this[_0xa55c('0x72')](_0x5a4e69['Trunk'])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x10e'));if(!this[_0xa55c('0x72')](_0x5a4e69[_0xa55c('0x73')])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0x5a4e69[_0xa55c('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa55c('0x10f')};}}if(!ut[_0xa55c('0x6f')](_0x5a4e69['dialActive'])){ut[_0xa55c('0x31')](_0xa55c('0x110'),_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111'));return{'isValid':![],'message':_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111')};}return{'isValid':!![],'message':_0xa55c('0x112')};};Preview[_0xa55c('0x35')][_0xa55c('0x113')]=function(_0x131288,_0x197953,_0x262d72,_0x228d12){var _0x16e229=this;return new Promise(function(_0x5c8713,_0x2d03b2){var _0x4b2e75=_0x131288[_0xa55c('0xa2')];var _0x3d0c6d=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?util['format'](_0xa55c('0x114'),_0x197953[_0xa55c('0x71')][_0xa55c('0x29')],_['isNil'](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')][_0xa55c('0x116')]()||'',_0x197953['dialCutDigit']>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953[_0xa55c('0x118')]):_0x262d72['phone']):util[_0xa55c('0x27')]('SIP/%s/%s%s',_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x29')]:_0x197953[_0xa55c('0x73')]['name'],_[_0xa55c('0x43')](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')]['trim']()||'',_0x197953[_0xa55c('0x118')]>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953['dialCutDigit']):_0x262d72[_0xa55c('0xec')]);var _0x2becbd=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?ut[_0xa55c('0x119')](_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953['dialOriginateCallerIdNumber']):ut[_0xa55c('0x119')](_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')]:_0x197953[_0xa55c('0x73')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953[_0xa55c('0x11d')]);if(_0x2becbd){_0x131288['originatecalleridname']=ut['extractCalleridName'](_0x2becbd);_0x131288['originatecalleridnum']=ut[_0xa55c('0x11e')](_0x2becbd);}var _0x124873=ut[_0xa55c('0x11f')](_0x197953,_0x262d72,_0x3d0c6d,_0x2becbd,_0x4b2e75,_0x131288);_[_0xa55c('0x120')](_0x131288,ut[_0xa55c('0x121')](_0x124873));_0x131288[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x197953['variables']=_0x124873;var _0x35c42c=ut[_0xa55c('0x122')](_0x131288,_0x197953,_0x124873,_0x131288[_0xa55c('0x87')],_0x228d12);return ami[_0xa55c('0x4c')](_0x35c42c)[_0xa55c('0x57')](function(_0xd511c0){_0x197953['originated']+=0x1;logger[_0xa55c('0x44')]('[originated][increment]',_0x4b2e75,'\x20Queue',_0x197953['name'],'originated:\x20',_0x197953[_0xa55c('0x2a')]);_0x5c8713(_0xd511c0);})[_0xa55c('0x5f')](function(_0x4732b4){ut[_0xa55c('0xde')](_0x131288,0xe,_0xa55c('0x123'));rpcDb[_0xa55c('0xdf')](_0x131288,_0xa55c('0x124'));_0x2d03b2(_0x4732b4);});});};Preview[_0xa55c('0x35')][_0xa55c('0x1e')]=function(_0x9c98af){if(this[_0xa55c('0x14')][_0x9c98af['linkedid']]){this['actions'][_0x9c98af[_0xa55c('0x88')]]['channel']=_0x9c98af[_0xa55c('0x125')];}};Preview[_0xa55c('0x35')][_0xa55c('0x16')]=function(_0x340570){var _0x2ef96f=this;var _0x582b22=this[_0xa55c('0x14')][_0x340570[_0xa55c('0x126')]];if(_0x582b22){if(_0x582b22[_0xa55c('0xef')]&&this['agents'][_0x582b22[_0xa55c('0xef')]]){ut[_0xa55c('0x127')](_0x582b22,this['agents'][_0x582b22['lookAgent']][_0xa55c('0x29')],this[_0xa55c('0x56')][_0x582b22[_0xa55c('0xef')]]['id']);}var _0x4f2883=_[_0xa55c('0x128')](_0x582b22);_0x4f2883[_0xa55c('0x8e')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));var _0x5a37d6=_0x2ef96f['campaignsPreview'][_0x582b22[_0xa55c('0x47')]];if(ut['isFailure'](_0x340570['response'])){if(_0x582b22[_0xa55c('0x86')]){rpcDb[_0xa55c('0x129')](_0x582b22[_0xa55c('0x8a')]);}if(_0x582b22[_0xa55c('0x87')]){rpcDb['disableContact'](_0x582b22[_0xa55c('0x8a')]);}ami[_0xa55c('0x24')](_0xa55c('0x12a'),ut[_0xa55c('0x7a')](_0x582b22,_0xa55c('0x12b'),this['campaignsPreview'][_0x582b22[_0xa55c('0x47')]]));this[_0xa55c('0xda')](_0x4f2883,_0x5a37d6,_0x340570);}else{_0x582b22[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));ut[_0xa55c('0xde')](_0x4f2883,0x4,_0xa55c('0x12c'));rpcDb['createAgentHistory'](_0x4f2883,_0xa55c('0x12d'));}}};Preview['prototype'][_0xa55c('0x19')]=function(_0x26946f){var _0x3755a7=this['actions'][_0x26946f['linkedid']];var _0x307b39;if(_0x3755a7){_0x307b39=this[_0xa55c('0x12')][_0x3755a7['queue']];logger['info'](_0xa55c('0x12e'),_0x26946f[_0xa55c('0x88')],'\x20Queue',_0x307b39[_0xa55c('0x29')],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);}if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]&&_0x26946f[_0xa55c('0x88')]!==_0x26946f['uniqueid']){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f['cause']);}else if(this['actions'][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')](_0xa55c('0x130'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39[_0xa55c('0x29')],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}else if(_0x3755a7&&_[_0xa55c('0x43')](_0x3755a7[_0xa55c('0x131')])&&_0x307b39[_0xa55c('0x132')]&&_0x26946f['linkedid']===_0x26946f[_0xa55c('0xa2')]&&_[_0xa55c('0x43')](_0x26946f[_0xa55c('0xdd')])&&_0x26946f[_0xa55c('0x12f')]==='16'&&_0x26946f['channelstate']==='6'&&_[_0xa55c('0xdb')](_0x3755a7['transfer'])){if(_0x3755a7['unlockAgent']){rpcDb['unlockContact'](_0x3755a7['idContact']);}if(_0x3755a7[_0xa55c('0x87')]){rpcDb[_0xa55c('0x101')](_0x3755a7['idContact']);}_0x26946f[_0xa55c('0xdd')]='22';this[_0xa55c('0xda')](_0x3755a7,_0x307b39,_0x26946f);}else if(_0x3755a7&&_0x3755a7[_0xa55c('0x133')]){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){logger[_0xa55c('0x44')](_0xa55c('0x134'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],'\x20Queue',_0x307b39['name'],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);this[_0xa55c('0x75')](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')]);}else if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')]('[syncHangup][talking][cause]',_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39['name'],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x1c')]=function(_0x236015){if(this['actions'][_0x236015['destlinkedid']]&&_0x236015[_0xa55c('0xd8')]!==_0x236015[_0xa55c('0x135')]){this[_0xa55c('0x75')](_0x236015,_0x236015[_0xa55c('0xd8')],_0x236015[_0xa55c('0xce')]);}};Preview[_0xa55c('0x35')][_0xa55c('0x1a')]=function(_0x2511fe){if(this[_0xa55c('0x14')][_0x2511fe[_0xa55c('0x88')]]&&_0x2511fe['linkedid']!==_0x2511fe[_0xa55c('0xa2')]&&!this['actions'][_0x2511fe[_0xa55c('0x88')]][_0xa55c('0x50')]){if(_0x2511fe[_0xa55c('0x12f')]==='1'){this[_0xa55c('0x75')](_0x2511fe,_0x2511fe[_0xa55c('0x88')],_0x2511fe[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x136')]=function(_0x1e8760,_0x329808,_0x35ad66){if(this[_0xa55c('0x14')][_0x1e8760]){if(_[_0xa55c('0x43')](this['actions'][_0x1e8760][_0xa55c('0x137')])){this[_0xa55c('0x14')][_0x1e8760]['variables']={};}this[_0xa55c('0x14')][_0x1e8760][_0xa55c('0x137')][_0x329808]=_0x35ad66;}};Preview[_0xa55c('0x35')]['syncVarSet']=function(_0x238a43){try{if(!_[_0xa55c('0x43')](_0x238a43)){if(ut['filterKey'](_[_0xa55c('0x138')](_0x238a43[_0xa55c('0x139')])[0x0])){this['addVariable'](_0x238a43[_0xa55c('0xa2')],_['keys'](_0x238a43[_0xa55c('0x139')])[0x0],_0x238a43[_0xa55c('0x13a')]);}}}catch(_0x2a6c2d){logger[_0xa55c('0x13b')](_0xa55c('0x13c'),util[_0xa55c('0x13d')](_0x2a6c2d,{'showHidden':![],'depth':null}));}};Preview[_0xa55c('0x35')][_0xa55c('0x21')]=function(_0x9b5e3a){if(_0x9b5e3a){if(this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]]){this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]][_0xa55c('0x133')]=!![];}}};Preview[_0xa55c('0x35')][_0xa55c('0x23')]=function(_0x5ac4fa){if(_0x5ac4fa){if(this[_0xa55c('0x14')][_0x5ac4fa['transfererlinkedid']]){this[_0xa55c('0x14')][_0x5ac4fa[_0xa55c('0x13f')]][_0xa55c('0x133')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x524a=['additional','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','ANSWER','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','pick','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','callerid','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','[originated][increment]','OriginateError','channel','logLookAgent','isFailure','custom:agentringnoanswer','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','filterKey','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','Queue','originated:\x20','queue','dialAnswer','contactId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','catch','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[callProgressDetectingCustomer][logAnswerGlobal]','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','activeContact','countbusyretry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','totalGlobal','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','scheduledAt','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x524a,0x7a));var _0xa524=function(_0x513ee4,_0x58f315){_0x513ee4=_0x513ee4-0x0;var _0x5ec2fc=_0x524a[_0x513ee4];return _0x5ec2fc;};'use strict';var util=require(_0xa524('0x0'));var _=require(_0xa524('0x1'));var uuid=require(_0xa524('0x2'));var moment=require(_0xa524('0x3'));var Redis=require(_0xa524('0x4'));var config=require(_0xa524('0x5'));var logger=require(_0xa524('0x6'))(_0xa524('0x7'));var loggerAction=require('../../../config/logger')(_0xa524('0x8'));var ami=require(_0xa524('0x9'));var rpcDb=require(_0xa524('0xa'));var cmHopperAdditionalPhone=require(_0xa524('0xb'));var Action=require('./action');var ut=require(_0xa524('0xc'));var utils=require(_0xa524('0xd'));config['redis']=_['defaults'](config[_0xa524('0xe')],{'host':_0xa524('0xf'),'port':0x18eb});var io=require(_0xa524('0x10'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa524('0x11')][_0xa524('0x12')]=function(_0x4b1265){this[_0xa524('0x13')]=this[_0xa524('0x13')]?this[_0xa524('0x13')][_0xa524('0x14')](_0x4b1265):_0x4b1265();};function Preview(_0x23d591){this[_0xa524('0x15')]=new Sequence();this[_0xa524('0x16')]=_0x23d591[_0xa524('0x17')];this[_0xa524('0x18')]=_0x23d591[_0xa524('0x18')];this[_0xa524('0x19')]={};this[_0xa524('0x1a')]=_0x23d591[_0xa524('0x1a')];this[_0xa524('0x1b')]=0x0;ami['on'](_0xa524('0x1c'),this[_0xa524('0x1d')]['bind'](this));ami['on']('hangup',this[_0xa524('0x1e')][_0xa524('0x1f')](this));ami['on'](_0xa524('0x20'),this[_0xa524('0x21')][_0xa524('0x1f')](this));ami['on'](_0xa524('0x22'),this[_0xa524('0x23')][_0xa524('0x1f')](this));ami['on'](_0xa524('0x24'),this[_0xa524('0x25')]['bind'](this));ami['on'](_0xa524('0x26'),this[_0xa524('0x27')][_0xa524('0x1f')](this));ami['on']('attendedtransfer',this[_0xa524('0x28')][_0xa524('0x1f')](this));ami['on'](_0xa524('0x29'),this[_0xa524('0x2a')][_0xa524('0x1f')](this));this[_0xa524('0x2b')](this[_0xa524('0x16')]);}function emit(_0x119ebb,_0x2f824f,_0x1db473){io['to'](_0x119ebb)[_0xa524('0x2c')](_0x2f824f,_0x1db473);}function emitVoiceQueueChannelRemove(_0x49e72b){logger[_0xa524('0x2d')](_0xa524('0x2e'),JSON[_0xa524('0x2f')](_0x49e72b));emit(util[_0xa524('0x30')](_0xa524('0x31'),_0x49e72b['name']),_0xa524('0x32'),_0x49e72b);io[_0xa524('0x2c')](_0xa524('0x33'),_0x49e72b);}function notSendMessagesQueue(_0x36c565){if(_0x36c565[_0xa524('0x34')]){if(_0x36c565[_0xa524('0x35')]===0x0&&_0x36c565[_0xa524('0x36')]===0x0){_0x36c565[_0xa524('0x34')]=![];_0x36c565['available']=0x0;_0x36c565[_0xa524('0x37')]=0x0;_0x36c565[_0xa524('0x38')]=utils[_0xa524('0x39')][_0xa524('0x3a')];ut['logger'](_0xa524('0x3b'),_0x36c565[_0xa524('0x3c')]+_0xa524('0x3d'));}else{_0x36c565[_0xa524('0x38')]=utils[_0xa524('0x39')][_0xa524('0x3e')];ut['logger'](_0xa524('0x3b'),_0x36c565[_0xa524('0x3c')]+_0xa524('0x3f'));}}}Preview['prototype'][_0xa524('0x2b')]=function(){var _0x252cbd=this;setInterval(function(){_0x252cbd['syncCampaigns']();},0x7cf);};Preview[_0xa524('0x11')][_0xa524('0x40')]=function(){var _0x56ee7d=this[_0xa524('0x16')];this[_0xa524('0x1b')]+=0x1;for(var _0x445753 in _0x56ee7d){if(_0x56ee7d[_0xa524('0x41')](_0x445753)&&(_0x56ee7d[_0x445753][_0xa524('0x42')]===_0xa524('0x7')||_0x56ee7d[_0x445753][_0xa524('0x42')]===_0xa524('0x43'))&&_0x56ee7d[_0x445753][_0xa524('0x44')]===_0xa524('0x45')){if(this[_0xa524('0x1b')]>0x7){this[_0xa524('0x1b')]=0x0;this[_0xa524('0x46')]();}}if(_0x56ee7d[_0xa524('0x41')](_0x445753)&&_0x56ee7d[_0x445753][_0xa524('0x42')]===_0xa524('0x7')&&_0x56ee7d[_0x445753]['type']===_0xa524('0x45')){if(_0x56ee7d[_0x445753][_0xa524('0x47')]){this[_0xa524('0x48')](_0x56ee7d[_0x445753]);if(_0x56ee7d[_0x445753][_0xa524('0x49')])this['recallMe'](_0x56ee7d[_0x445753]);}else{notSendMessagesQueue(_0x56ee7d[_0x445753]);}}}};Preview[_0xa524('0x11')][_0xa524('0x4a')]=function(_0x21df46){var _0x205d09=this;this[_0xa524('0x15')]['enqueue'](function(){if(!_[_0xa524('0x4b')](_0x205d09[_0xa524('0x19')][_0x21df46])){loggerAction[_0xa524('0x2d')]('[clearZombieChannels][talking]',_0x21df46,_0xa524('0x4c'),_0x205d09['actions'][_0x21df46]['queue'],_0xa524('0x4d'),JSON[_0xa524('0x2f')](_0x205d09[_0xa524('0x16')][_0x205d09['actions'][_0x21df46][_0xa524('0x4e')]][_0xa524('0x35')]),'pTalking:\x20',JSON[_0xa524('0x2f')](_0x205d09['campaignsPreview'][_0x205d09[_0xa524('0x19')][_0x21df46]['queue']]['pTalking']),JSON[_0xa524('0x2f')](_0x205d09[_0xa524('0x19')][_0x21df46][_0xa524('0x4f')]),JSON[_0xa524('0x2f')](_['pick'](_0x205d09['actions'][_0x21df46],[_0xa524('0x50'),'UserId',_0xa524('0x51'),_0xa524('0x52')])));return ami[_0xa524('0x53')]({'action':_0xa524('0x54'),'channel':_0x205d09['actions'][_0x21df46]['channel']})['catch'](function(_0xe9561b){if(_0xe9561b[_0xa524('0x38')]===_0xa524('0x55')){setTimeout(function(){if(_0x205d09['actions'][_0x21df46]){ut[_0xa524('0x56')](_0x205d09[_0xa524('0x16')][_0x205d09[_0xa524('0x19')][_0x21df46]['queue']],_0xa524('0x57'));if(_0x205d09[_0xa524('0x19')][_0x21df46][_0xa524('0x4f')]===!![]){ut[_0xa524('0x58')](_0x205d09[_0xa524('0x16')][_0x205d09['actions'][_0x21df46][_0xa524('0x4e')]],_0xa524('0x57'));ut['loggerError'](_0xa524('0x59')+_0x21df46,_0x205d09[_0xa524('0x19')][_0x21df46][_0xa524('0x4e')]);}ut[_0xa524('0x5a')](_0xa524('0x5b')+_0x21df46,_0x205d09[_0xa524('0x19')][_0x21df46][_0xa524('0x4e')]);delete _0x205d09[_0xa524('0x19')][_0x21df46];}},0x2328);}});}});};Preview[_0xa524('0x11')]['clearZombieChannels']=function(){var _0x495ed3=this;loggerAction[_0xa524('0x2d')](_0xa524('0x5c'),_[_0xa524('0x5d')](this['actions']));for(var _0x5b85a2 in this[_0xa524('0x19')]){if(_0x495ed3[_0xa524('0x19')][_0xa524('0x41')](_0x5b85a2)){_0x495ed3['clearZombieChannel'](_0x5b85a2);}}};Preview['prototype'][_0xa524('0x5e')]=function(_0x4fc3f7){var _0x201251=this;rpcDb['getContactRecallMe'](_0x4fc3f7['id'],ut['agentReadyId'](this[_0xa524('0x1a')]))[_0xa524('0x5f')](function(_0x5b5534){if(!_[_0xa524('0x4b')](_0x5b5534)){for(var _0x2e3911=0x0;_0x2e3911<_0x5b5534[_0xa524('0x60')];_0x2e3911+=0x1){if(ut[_0xa524('0x61')](_0x5b5534[_0x2e3911][_0xa524('0x62')])<_0x4fc3f7['dialRecallMeTimeout']*0x3c){if(_0x5b5534[_0x2e3911][_0xa524('0x63')]&&!_0x5b5534[_0x2e3911]['Agent'][_0xa524('0x64')]){_0x201251[_0xa524('0x65')](_0x5b5534[_0x2e3911]['id'])['then'](ut['logger2'](_0xa524('0x66')))['catch'](ut[_0xa524('0x67')]('[RecallMe]'));}else{rpcDb[_0xa524('0x68')](_0x5b5534[_0x2e3911]['id']);}}else{var _0x2adc6d=new Action(_0x5b5534[_0x2e3911],_0x4fc3f7);_0x2adc6d[_0xa524('0x69')]=moment()['format'](_0xa524('0x6a'));_0x4fc3f7[_0xa524('0x6b')]+=0x1;ut[_0xa524('0x6c')](_0x2adc6d,0x17,_0xa524('0x6d'));if(_0x4fc3f7[_0xa524('0x6e')]){rpcDb[_0xa524('0x6f')](ut['createBody'](_0x5b5534[_0x2e3911]));rpcDb[_0xa524('0x70')](_0x2adc6d,_0xa524('0x71'));}else{ut[_0xa524('0x6c')](_0x2adc6d,0x16,_0xa524('0x72'));rpcDb[_0xa524('0x70')](_0x2adc6d,_0xa524('0x73'));rpcDb[_0xa524('0x74')](_0x2adc6d,_0xa524('0x73'));}}}}})[_0xa524('0x75')](ut[_0xa524('0x67')](_0xa524('0x76')));};Preview[_0xa524('0x11')][_0xa524('0x48')]=function(_0x3eec32){_0x3eec32['sendMessageOneNotActive']=!![];if(ut[_0xa524('0x77')](_0x3eec32[_0xa524('0x78')])){_0x3eec32[_0xa524('0x38')]=utils[_0xa524('0x39')][_0xa524('0x79')];}else if(!ut[_0xa524('0x7a')](_0x3eec32['dialActive'])){_0x3eec32[_0xa524('0x38')]=utils[_0xa524('0x39')][_0xa524('0x3a')];}else if(!this['isTrunkReachable'](_0x3eec32['Trunk'])){if(!this[_0xa524('0x7b')](_0x3eec32[_0xa524('0x7c')])){_0x3eec32[_0xa524('0x38')]=utils['CAMPAIGN_STATUS'][_0xa524('0x7d')];}else{_0x3eec32[_0xa524('0x38')]=utils[_0xa524('0x39')][_0xa524('0x7e')];}}else{_0x3eec32[_0xa524('0x38')]=utils[_0xa524('0x39')][_0xa524('0x7e')];}};Preview[_0xa524('0x11')][_0xa524('0x7f')]=function(_0x1cbc24,_0x561879,_0x146fa5){var _0xe4e383=this;var _0x173328=this[_0xa524('0x19')][_0x561879];var _0x4f2631=this[_0xa524('0x16')][_0x173328[_0xa524('0x4e')]];var _0x47f903;var _0x4110c8=![];var _0x31e759=0x2;var _0x25668a=0x3;if(_0x4f2631){switch(_0x146fa5){case'1':_0x4f2631[_0xa524('0x80')]+=0x1;_0x173328[_0xa524('0x81')]+=0x1;_0x173328[_0xa524('0x82')]=ut['totalGlobal'](_0x173328);ut[_0xa524('0x6c')](_0x173328,0x0,'NoSuchNumber');ami[_0xa524('0x2c')]('custom:agentnosuchnumber',ut[_0xa524('0x83')](_0x173328,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x173328,_0xa524('0x84'));_0xe4e383[_0xa524('0x85')](_0x173328,'0',_0x4f2631)[_0xa524('0x5f')](function(_0x358e4e){_0x4110c8=_0x358e4e['additional']==0x1;_0x31e759=_0x4f2631[_0xa524('0x86')];_0x25668a=_0x4f2631[_0xa524('0x87')];if(!_0x4110c8){if(ut['totalGlobal'](_0x173328)>=_0x4f2631['dialGlobalMaxRetry']){_0x47f903=ut[_0xa524('0x88')](_0x173328,0xf,_0xa524('0x89'));rpcDb['createCustomerFinal'](_0x47f903,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x173328[_0xa524('0x81')]>=_0x4f2631[_0xa524('0x8a')]){rpcDb['createCustomerFinal'](_0x173328,_0xa524('0x8b'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x173328,'countnosuchnumberretry',_0x4f2631['dialNoSuchNumberRetryFrequency']),_0x173328[_0xa524('0x8c')],_0x173328['activeContact']);}}delete this[_0xa524('0x19')][_0x1cbc24[_0xa524('0x8d')]];}else{_0x173328['countnosuchnumberretry']++;logger[_0xa524('0x2d')](_0xa524('0x8e'),_0x173328[_0xa524('0x81')]);logger[_0xa524('0x2d')]('id',_0x173328[_0xa524('0x8f')]);_0xe4e383[_0xa524('0x90')]({'id':_0x173328['idContact'],'field':{'countnosuchnumberretry':_0x173328[_0xa524('0x81')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});break;case'ANSWER':var _0x5df2da=moment()['format'](_0xa524('0x6a'));_0x173328[_0xa524('0x92')]=_0x5df2da;_0x173328[_0xa524('0x93')]=_0x5df2da;_0x173328[_0xa524('0x4f')]=!![];_0x4f2631[_0xa524('0x36')]+=0x1;logger[_0xa524('0x2d')](_0xa524('0x94'),_0x173328[_0xa524('0x95')],_0xa524('0x96'),_0x4f2631[_0xa524('0x3c')],_0xa524('0x97'),_0x4f2631[_0xa524('0x36')]);ami[_0xa524('0x2c')](_0xa524('0x98'),ut[_0xa524('0x83')](_0x173328,_0xa524('0x99'),this[_0xa524('0x16')][_0x173328[_0xa524('0x4e')]]));if(_0x4f2631[_0xa524('0x9a')]){ami[_0xa524('0x2c')](_0xa524('0x9b'),ut[_0xa524('0x9c')](_0x173328));}break;case'16':ami[_0xa524('0x2c')](_0xa524('0x9d'),ut[_0xa524('0x83')](_0x173328,_0xa524('0x9e'),this[_0xa524('0x16')][_0x173328[_0xa524('0x4e')]]));emitVoiceQueueChannelRemove(ut[_0xa524('0x83')](_0x173328,_0xa524('0x9e')));_0x4f2631[_0xa524('0x9f')]+=0x1;_0x4f2631[_0xa524('0xa0')]+=0x1;_0x4f2631['answered']+=0x1;ut[_0xa524('0x58')](_0x4f2631,'[16]');_0x173328[_0xa524('0x82')]=ut['totalGlobal'](_0x173328);ut['logCustomer'](_0x173328,0x4,'Answer');rpcDb[_0xa524('0x70')](_0x173328,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xa524('0x74')](_0x173328,_0xa524('0xa1'));rpcDb['crateCustomerReportQueue'](_0x173328);_0x4f2631['sumDuration']+=_0x173328['talktime'];_0x4f2631[_0xa524('0xa2')]+=_0x173328['talktime'];logger[_0xa524('0x2d')](_0xa524('0xa3'),_0x173328[_0xa524('0x95')],'\x20Queue',_0x4f2631[_0xa524('0x3c')],_0xa524('0x97'),_0x4f2631['pTalking']);delete this[_0xa524('0x19')][_0x1cbc24['linkedid']];break;case _0xa524('0xa4'):_0x4f2631[_0xa524('0xa5')]+=0x1;_0x173328['countbusyretry']+=0x1;_0x173328[_0xa524('0x82')]=ut['totalGlobal'](_0x173328);ut[_0xa524('0x6c')](_0x173328,0x5,_0xa524('0xa6'));_0x31e759=_0x4f2631[_0xa524('0xa7')];_0x25668a=_0x4f2631[_0xa524('0x87')];ami[_0xa524('0x2c')](_0xa524('0xa8'),ut[_0xa524('0x83')](_0x173328,_0xa524('0xa9')));rpcDb[_0xa524('0x70')](_0x173328,'[callProgressDetectingCustomer][logBusy]');_0xe4e383['verifyAdditionalPhones'](_0x173328,'5',_0x4f2631)[_0xa524('0x5f')](function(_0x4ec2da){_0x4110c8=_0x4ec2da['additional']==0x1;if(!_0x4110c8){if(ut['totalGlobal'](_0x173328)>=_0x4f2631[_0xa524('0xaa')]){_0x47f903=ut['cloneAction'](_0x173328,0xf,'Global');rpcDb[_0xa524('0x74')](_0x47f903,_0xa524('0xab'));}else{if(_0x173328['countbusyretry']>=_0x4f2631[_0xa524('0xac')]){rpcDb['createCustomerFinal'](_0x173328,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xa524('0xad')](ut['scheduledAt'](_0x173328,'countbusyretry',_0x4f2631['dialBusyRetryFrequency']),_0x173328[_0xa524('0x8c')],_0x173328[_0xa524('0xae')]);}}}else{_0x173328['countbusyretry']++;_0xe4e383[_0xa524('0x90')]({'id':_0x173328['idContact'],'field':{'countbusyretry':_0x173328[_0xa524('0xaf')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});break;case _0xa524('0xb0'):_0x4f2631[_0xa524('0xb1')]+=0x1;_0x173328[_0xa524('0xb2')]+=0x1;_0x173328[_0xa524('0x82')]=ut[_0xa524('0xb3')](_0x173328);ut[_0xa524('0x6c')](_0x173328,0x3,_0xa524('0xb4'));_0x31e759=_0x4f2631[_0xa524('0xb5')];_0x25668a=_0x4f2631[_0xa524('0x87')];var _0x4a8d6c=ut[_0xa524('0xb6')](_0x173328,_0x4f2631);ami[_0xa524('0x2c')]('custom:agentnoanswer',_0x4a8d6c);rpcDb[_0xa524('0x70')](_0x173328,_0xa524('0xb7'));_0xe4e383[_0xa524('0x85')](_0x173328,'3',_0x4f2631)[_0xa524('0x5f')](function(_0x3e9487){_0x4110c8=_0x3e9487['additional']==0x1;if(!_0x4110c8){if(ut[_0xa524('0xb3')](_0x173328)>=_0x4f2631[_0xa524('0xaa')]){_0x47f903=ut[_0xa524('0x88')](_0x173328,0xf,_0xa524('0x89'));rpcDb['createCustomerFinal'](_0x47f903,_0xa524('0xb8'));}else{if(_0x173328['countnoanswerretry']>=_0x4f2631[_0xa524('0xb9')]){rpcDb[_0xa524('0x74')](_0x173328,_0xa524('0xb7'));}else{rpcDb[_0xa524('0xad')](ut['scheduledAt'](_0x173328,_0xa524('0xb2'),_0x4f2631['dialNoAnswerRetryFrequency']),_0x173328['unlockAgent'],_0x173328[_0xa524('0xae')]);}}}else{_0x173328[_0xa524('0xb2')]++;_0xe4e383[_0xa524('0x90')]({'id':_0x173328['idContact'],'field':{'countnoanswerretry':_0x173328[_0xa524('0xb2')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});break;case _0xa524('0xba'):_0x4f2631[_0xa524('0xbb')]+=0x1;_0x173328[_0xa524('0xbc')]+=0x1;_0x173328['countglobal']=ut[_0xa524('0xb3')](_0x173328);ut[_0xa524('0x6c')](_0x173328,0x8,_0xa524('0xbd'));_0x31e759=_0x4f2631[_0xa524('0xbe')];_0x25668a=_0x4f2631[_0xa524('0x87')];ami[_0xa524('0x2c')](_0xa524('0xbf'),ut[_0xa524('0x83')](_0x173328,'congestion'));rpcDb[_0xa524('0x70')](_0x173328,'[callProgressDetectingCustomer][logCongestion]');_0xe4e383[_0xa524('0x85')](_0x173328,'8',_0x4f2631)[_0xa524('0x5f')](function(_0x446f33){_0x4110c8=_0x446f33['additional']==0x1;if(!_0x4110c8){if(ut[_0xa524('0xb3')](_0x173328)>=_0x4f2631['dialGlobalMaxRetry']){_0x47f903=ut['cloneAction'](_0x173328,0xf,_0xa524('0x89'));rpcDb[_0xa524('0x74')](_0x47f903,_0xa524('0xc0'));}else{if(_0x173328['countcongestionretry']>=_0x4f2631[_0xa524('0xc1')]){rpcDb['createCustomerFinal'](_0x173328,_0xa524('0xc2'));}else{rpcDb[_0xa524('0xad')](ut['scheduledAt'](_0x173328,'countcongestionretry',_0x4f2631[_0xa524('0xa7')]),_0x173328[_0xa524('0x8c')],_0x173328[_0xa524('0xae')]);}}}else{_0x173328[_0xa524('0xbc')]++;_0xe4e383[_0xa524('0x90')]({'id':_0x173328['idContact'],'field':{'countcongestionretry':_0x173328[_0xa524('0xbc')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});break;case _0xa524('0xc3'):_0x4f2631[_0xa524('0xc4')]+=0x1;_0x173328[_0xa524('0xc5')]+=0x1;_0x173328[_0xa524('0x82')]=ut[_0xa524('0xb3')](_0x173328);ut['logCustomer'](_0x173328,0x14,_0xa524('0xc6'));_0x31e759=_0x4f2631[_0xa524('0xc7')];_0x25668a=_0x4f2631[_0xa524('0x87')];ami[_0xa524('0x2c')]('custom:agentreject',ut[_0xa524('0x83')](_0x173328,_0xa524('0xc8')));rpcDb[_0xa524('0x70')](_0x173328,'[syncHangupRequest][logAgentReject]');_0xe4e383['verifyAdditionalPhones'](_0x173328,'20',_0x4f2631)[_0xa524('0x5f')](function(_0x226911){_0x4110c8=_0x226911['additional']==0x1;if(!_0x4110c8){if(ut[_0xa524('0xb3')](_0x173328)>=_0x4f2631[_0xa524('0xaa')]){_0x47f903=ut['cloneAction'](_0x173328,0x14,_0xa524('0xc6'));rpcDb[_0xa524('0x74')](_0x47f903,_0xa524('0xc9'));}else{if(_0x173328[_0xa524('0xc5')]>=_0x4f2631[_0xa524('0xca')]){rpcDb[_0xa524('0x74')](_0x173328,_0xa524('0xc9'));}else{rpcDb[_0xa524('0xad')](ut[_0xa524('0xcb')](_0x173328,_0xa524('0xc5'),_0x4f2631[_0xa524('0xc7')]),_0x173328['unlockAgent'],_0x173328['activeContact']);}}}else{_0x173328['countnoanswerretry']++;_0xe4e383[_0xa524('0x90')]({'id':_0x173328[_0xa524('0x8f')],'field':{'countnoanswerretry':_0x173328[_0xa524('0xb2')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});break;case _0xa524('0xcc'):_0x4f2631[_0xa524('0xcd')]+=0x1;_0x173328[_0xa524('0xce')]+=0x1;_0x173328[_0xa524('0x82')]=ut[_0xa524('0xb3')](_0x173328);ut[_0xa524('0x6c')](_0x173328,0xb,_0xa524('0xcf'));rpcDb['createCustomerHistory'](_0x173328,_0xa524('0xd0'));_0xe4e383[_0xa524('0x85')](_0x173328,'11',_0x4f2631)[_0xa524('0x5f')](function(_0x33d0ec){_0x4110c8=_0x33d0ec[_0xa524('0xd1')]==0x1;if(!_0x4110c8){if(ut[_0xa524('0xb3')](_0x173328)>=_0x4f2631['dialGlobalMaxRetry']){_0x47f903=ut[_0xa524('0x88')](_0x173328,0xf,_0xa524('0x89'));rpcDb[_0xa524('0x74')](_0x47f903,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x173328[_0xa524('0xd2')]>=_0x4f2631['dialAbandonedMaxRety']){rpcDb[_0xa524('0x74')](_0x173328,_0xa524('0xd0'));}else{rpcDb[_0xa524('0xad')](ut[_0xa524('0xcb')](_0x173328,'countabandonedretry',_0x4f2631[_0xa524('0xd3')]),_0x173328[_0xa524('0x8c')],_0x173328['activeContact']);}}}else{_0x173328[_0xa524('0xb2')]++;_0xe4e383[_0xa524('0x90')]({'id':_0x173328[_0xa524('0x8f')],'field':{'countnoanswerretry':_0x173328[_0xa524('0xb2')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});break;case'18':_0x4f2631[_0xa524('0xd4')]+=0x1;_0x173328[_0xa524('0xd5')]+=0x1;_0x173328[_0xa524('0x82')]=ut[_0xa524('0xb3')](_0x173328);ut['logCustomer'](_0x173328,0x12,_0x1cbc24[_0xa524('0xd6')]||_0x1cbc24[_0xa524('0xd7')]);ami[_0xa524('0x2c')](_0xa524('0xd8'),ut[_0xa524('0x83')](_0x173328,'amd'));rpcDb['createCustomerHistory'](_0x173328,_0xa524('0xd9'));_0xe4e383[_0xa524('0x85')](_0x173328,'18',_0x4f2631)[_0xa524('0x5f')](function(_0x4e0587){_0x4110c8=_0x4e0587['additional']==0x1;if(!_0x4110c8){if(ut[_0xa524('0xb3')](_0x173328)>=_0x4f2631[_0xa524('0xaa')]){_0x47f903=ut[_0xa524('0x88')](_0x173328,0x12,'Global');rpcDb['createCustomerFinal'](_0x47f903,_0xa524('0xd9'));}else{rpcDb[_0xa524('0x74')](_0x173328,_0xa524('0xd9'));}}else{_0x173328['countnoanswerretry']++;_0xe4e383[_0xa524('0x90')]({'id':_0x173328['idContact'],'field':{'countnoanswerretry':_0x173328[_0xa524('0xb2')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});delete this['actions'][_0x1cbc24[_0xa524('0x8d')]];break;case'19':_0x4f2631['outboundUnknownCallsDay']+=0x1;_0x173328[_0xa524('0x82')]=ut[_0xa524('0xb3')](_0x173328);ut['logCustomer'](_0x173328,0x13,_0x1cbc24['cause-txt']||_0x1cbc24[_0xa524('0xd7')]);ami[_0xa524('0x2c')](_0xa524('0xd8'),ut['buildObj'](_0x173328,_0xa524('0xda')));rpcDb[_0xa524('0x70')](_0x173328,_0xa524('0xdb'));_0xe4e383[_0xa524('0x85')](_0x173328,'18',_0x4f2631)[_0xa524('0x5f')](function(_0x317fbd){_0x4110c8=_0x317fbd[_0xa524('0xd1')]==0x1;if(!_0x4110c8){if(ut[_0xa524('0xb3')](_0x173328)>=_0x4f2631[_0xa524('0xaa')]){_0x47f903=ut['cloneAction'](_0x173328,0xf,_0xa524('0x89'));rpcDb['createCustomerFinal'](_0x47f903,_0xa524('0xdb'));}else{rpcDb[_0xa524('0x74')](_0x173328,_0xa524('0xdb'));}}else{_0x173328[_0xa524('0xb2')]++;_0xe4e383[_0xa524('0x90')]({'id':_0x173328[_0xa524('0x8f')],'field':{'countnoanswerretry':_0x173328[_0xa524('0xb2')]}})[_0xa524('0x5f')](function(){_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});});}});delete this[_0xa524('0x19')][_0x1cbc24[_0xa524('0x8d')]];break;default:if(_0x173328['dialAnswer']){ut[_0xa524('0x58')](_0x4f2631,_0xa524('0xdc'));ut[_0xa524('0x5a')](_0xa524('0xdd')+_0x4f2631[_0xa524('0x3c')],_0x1cbc24);}_0x4f2631[_0xa524('0xd4')]+=0x1;_0x173328[_0xa524('0x82')]=ut[_0xa524('0xb3')](_0x173328);ut[_0xa524('0x6c')](_0x173328,0xc,_0x1cbc24[_0xa524('0xd6')]||_0x1cbc24[_0xa524('0xd7')]);_0x31e759=_0x4f2631['dialAgentRejectRetryFrequency'];_0x25668a=_0x4f2631[_0xa524('0x87')];rpcDb[_0xa524('0x70')](_0x173328,_0xa524('0xde'));_0xe4e383[_0xa524('0x85')](_0x173328,'20',_0x4f2631)[_0xa524('0x5f')](function(_0x515570){_0x4110c8=_0x515570[_0xa524('0xd1')]==0x1;if(!_0x4110c8){if(ut[_0xa524('0xb3')](_0x173328)>=_0x4f2631[_0xa524('0xaa')]){_0x47f903=ut[_0xa524('0x88')](_0x173328,0xf,_0xa524('0x89'));rpcDb['createCustomerFinal'](_0x47f903,_0xa524('0xdf'));}else{rpcDb[_0xa524('0x74')](_0x173328,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xa524('0x19')][_0x1cbc24[_0xa524('0x8d')]];}else{_0xe4e383[_0xa524('0x91')](_0x173328,_0x31e759,_0x25668a)[_0xa524('0x5f')](function(){});}});}if(!(_0x173328[_0xa524('0x4f')]&&_0x146fa5==='16')){ut[_0xa524('0x56')](_0x4f2631,_0xa524('0xe0'));logger[_0xa524('0x2d')]('[originated][decrement][callProgressDetectingCustomer]',_0x173328[_0xa524('0x95')],_0xa524('0x96'),_0x4f2631[_0xa524('0x3c')],_0xa524('0x4d'),_0x4f2631[_0xa524('0x35')]);}if(_0x146fa5!==_0xa524('0xe1')){delete this[_0xa524('0x19')][_0x1cbc24[_0xa524('0x8d')]];delete this[_0xa524('0x19')][_0x1cbc24['destlinkedid']];}_0x4f2631[_0xa524('0xe2')]=!![];}};Preview['prototype']['callProgressDetectingAgent']=function(_0x1ebab6,_0x41009d,_0x3ed389){if(_[_0xa524('0xe3')](_0x41009d)&&'object'!==typeof _0x41009d){return;}if(_[_0xa524('0xe3')](_0x3ed389)&&_0xa524('0xe4')!==typeof _0x3ed389){return;}switch(_0x3ed389[_0xa524('0xe5')]){case'0':ut[_0xa524('0xe6')](_0x1ebab6,0x0,_0xa524('0xe7'));rpcDb[_0xa524('0xe8')](_0x1ebab6,_0xa524('0xe9'));break;case'3':ut['logAgent'](_0x1ebab6,0x3,_0xa524('0xb4'));rpcDb['createAgentHistory'](_0x1ebab6,_0xa524('0xea'));break;case'5':ut[_0xa524('0xe6')](_0x1ebab6,0x5,_0xa524('0xa6'));rpcDb[_0xa524('0xe8')](_0x1ebab6,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x1ebab6,0x8,'Congestion');rpcDb['createAgentHistory'](_0x1ebab6,_0xa524('0xeb'));break;case'22':ut[_0xa524('0xe6')](_0x1ebab6,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x1ebab6,_0xa524('0xec'));break;default:ut[_0xa524('0xe6')](_0x1ebab6,0xc,_0x3ed389[_0xa524('0xe5')]);rpcDb['createAgentHistory'](_0x1ebab6,_0xa524('0xeb'));}ut[_0xa524('0x56')](_0x41009d,_0xa524('0xed'));logger[_0xa524('0x2d')](_0xa524('0xee'),_0x1ebab6[_0xa524('0x95')],_0xa524('0x96'),_0x41009d[_0xa524('0x3c')],_0xa524('0x4d'),_0x41009d[_0xa524('0x35')]);delete this['actions'][_0x1ebab6[_0xa524('0x95')]];};Preview[_0xa524('0x11')][_0xa524('0x85')]=function(_0x2ab48a,_0x2f4168,_0x2ae0c4){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2ab48a,_0x2f4168,_0x2ae0c4)['catch'](logger[_0xa524('0x2d')](_0xa524('0xef')));};Preview[_0xa524('0x11')][_0xa524('0x91')]=function(_0x54715a,_0x50c483,_0x587fd4){return cmHopperAdditionalPhone[_0xa524('0x91')](_0x54715a,_0x50c483,_0x587fd4)[_0xa524('0x75')](logger[_0xa524('0x2d')](_0xa524('0xf0')));};Preview[_0xa524('0x11')][_0xa524('0x90')]=function(_0x19d82d){return Promise[_0xa524('0xf1')]()[_0xa524('0x5f')](cmHopperAdditionalPhone[_0xa524('0x90')](_0x19d82d))['catch'](logger[_0xa524('0x2d')](_0xa524('0xf2')));};Preview['prototype']['checkInBlack']=function(_0x108802,_0x39b895,_0x42a80d,_0x45cda3,_0x49fec7){var _0x32ce73=this;return new Promise(function(_0x38891b,_0x6ea81b){if(_[_0xa524('0x4b')](_0x39b895)||_['isNil'](_0x39b895[_0xa524('0xf3')])||_[_0xa524('0x4b')](_0x39b895[_0xa524('0xf4')])||_[_0xa524('0x4b')](_0x39b895[_0xa524('0x51')])){_0x6ea81b(ut[_0xa524('0x38')]('Contact\x20is\x20undefined',_0x45cda3,_0x49fec7));return;}var _0x52d8ef=uuid['v4']();var _0x121790=_0x32ce73[_0xa524('0x16')][_0x39b895[_0xa524('0x4c')]['name']];var _0x3ab933=_0x42a80d?_0x32ce73['agents'][_0x42a80d]['id']:undefined;_0x32ce73[_0xa524('0x19')][_0x52d8ef]=new Action(_0x39b895,_0x121790,_0x52d8ef,_0x42a80d,_0x3ab933);var _0x45eae5=_0x32ce73[_0xa524('0x19')][_0x52d8ef];_0x45eae5['unlockAgent']=_0x45cda3;_0x45eae5[_0xa524('0xae')]=_0x49fec7;_0x45eae5[_0xa524('0xf5')]=_0x42a80d;if(_['isEmpty'](_0x108802)){_0x32ce73[_0xa524('0xf6')](_0x45eae5,_0x121790,_0x39b895,_0x42a80d)[_0xa524('0x5f')](function(_0x206df6){logger['info'](_0xa524('0xf7'),_0xa524('0xf8')+_0x45eae5[_0xa524('0x4e')]+'\x20IdHopper:\x20'+_0x45eae5[_0xa524('0x8f')],JSON[_0xa524('0x2f')](_0x206df6));ami[_0xa524('0x2c')](_0xa524('0xf9'),ut[_0xa524('0x83')](_0x45eae5,_0xa524('0xfa'),_0x32ce73[_0xa524('0x16')][_0x45eae5[_0xa524('0x4e')]]));_0x38891b(ut['message']('Calling'));})[_0xa524('0x75')](function(_0x5422e3){ut[_0xa524('0xfb')](_0xa524('0xfc'),_0x5422e3);_0x6ea81b(ut[_0xa524('0x38')](_0xa524('0xfd'),_0x45cda3,_0x49fec7));});}else{_0x121790[_0xa524('0xfe')]+=0x1;ut[_0xa524('0xff')](_0x45eae5);rpcDb[_0xa524('0x100')](_0x45eae5,'[Blacklist][error]');delete _0x32ce73['actions'][_0x52d8ef];_0x6ea81b(ut[_0xa524('0x38')](_0xa524('0x101'),_0x45cda3,_0x49fec7));}});};Preview[_0xa524('0x11')][_0xa524('0x7b')]=function(_0x24a156){return!_[_0xa524('0x4b')](_0x24a156)&&!_[_0xa524('0x4b')](_0x24a156[_0xa524('0x3c')])&&!_[_0xa524('0x4b')](_0x24a156[_0xa524('0x102')])&&_0x24a156['active']&&!_[_0xa524('0x4b')](this[_0xa524('0x18')][util[_0xa524('0x30')]('SIP/%s',_0x24a156[_0xa524('0x3c')])])&&!_[_0xa524('0x4b')](this['trunks'][util[_0xa524('0x30')](_0xa524('0x103'),_0x24a156[_0xa524('0x3c')])]['status'])&&(this[_0xa524('0x18')][util['format'](_0xa524('0x103'),_0x24a156[_0xa524('0x3c')])][_0xa524('0x54')]===_0xa524('0x104')||this[_0xa524('0x18')][util[_0xa524('0x30')](_0xa524('0x103'),_0x24a156[_0xa524('0x3c')])]['status']===_0xa524('0x105'));};Preview[_0xa524('0x11')][_0xa524('0x65')]=function(_0x1abf9b,_0x47612c){return this[_0xa524('0x106')](_0x1abf9b,_0x47612c)[_0xa524('0x5f')](function(_0x275c25){return _['pick'](_0x275c25,[_0xa524('0x38')]);})[_0xa524('0x75')](function(_0x7a3a90){if(_0x7a3a90[_0xa524('0x107')]){rpcDb[_0xa524('0x108')](_0x1abf9b);}if(_0x7a3a90[_0xa524('0x102')]){rpcDb['disableContact'](_0x1abf9b);}throw _['pick'](_0x7a3a90,[_0xa524('0x38')]);});};Preview[_0xa524('0x11')]['execRun']=function(_0x4fae0a,_0x48e391){var _0x560cac=this;var _0x47c6cf,_0xf3fa7e;return rpcDb[_0xa524('0x109')](_0x4fae0a)[_0xa524('0x5f')](function(_0x5a63a7){if(!_[_0xa524('0x4b')](_0x5a63a7[0x0])){_0xf3fa7e=_0x5a63a7[0x0][_0xa524('0x10a')]?![]:!![];_0x47c6cf=_0x5a63a7[0x0]['recallme']?!![]:![];_0x47c6cf=_0x48e391?!![]:_0x47c6cf;}var _0x10db5e=_0x560cac[_0xa524('0x10b')](_0x5a63a7);if(_0x10db5e['isValid']){rpcDb[_0xa524('0x10c')](_[_0xa524('0x10d')](_0x5a63a7[0x0],['VoiceQueueId',_0xa524('0xf4')]))[_0xa524('0x5f')](function(_0x32eeb7){_0x560cac[_0xa524('0x10e')](_0x32eeb7,_0x5a63a7[0x0],_0x48e391,_0xf3fa7e,_0x47c6cf)[_0xa524('0x5f')](function(_0x29dd7f){return _0x29dd7f;})['catch'](function(_0x19ea0f){throw _0x19ea0f;});})['catch'](function(_0x13cda3){ut[_0xa524('0xfb')](_0xa524('0x10f'),_0x13cda3);throw ut[_0xa524('0x38')](_0xa524('0x110'),_0xf3fa7e,_0x47c6cf);});}else{throw ut[_0xa524('0x38')](_0x10db5e[_0xa524('0x38')],_0xf3fa7e,_0x47c6cf);}})[_0xa524('0x75')](function(_0x25d6fc){ut['logger'](_0xa524('0x111'),_0x25d6fc);throw ut[_0xa524('0x38')](_0xa524('0x110'),![],!![]);});};Preview[_0xa524('0x11')][_0xa524('0x10b')]=function(_0x27d9f6){if(_['isNil'](_0x27d9f6)||_[_0xa524('0x112')](_0x27d9f6)||!_[_0xa524('0x4b')](_0x27d9f6[0x0][_0xa524('0x63')])&&_['isNil'](_0x27d9f6[0x0][_0xa524('0x63')][_0xa524('0x3c')])){ut[_0xa524('0xfb')]('[Preview][validateContact][Empty\x20Contact]',_0x27d9f6);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5b579a=this[_0xa524('0x16')][_0x27d9f6[0x0][_0xa524('0x4c')][_0xa524('0x3c')]];_0x5b579a['message']=utils[_0xa524('0x39')][_0xa524('0x7e')];if(_['isNil'](_0x5b579a)){ut[_0xa524('0xfb')](_0xa524('0x113'),_0x5b579a);return{'isValid':![],'message':_0xa524('0x114')};}if(!this['isTrunkReachable'](_0x5b579a[_0xa524('0x115')])){ut[_0xa524('0xfb')](_0xa524('0x116'),_0xa524('0x117')+_0x5b579a[_0xa524('0x3c')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xa524('0x7b')](_0x5b579a[_0xa524('0x7c')])){ut[_0xa524('0xfb')](_0xa524('0x116'),_0x5b579a[_0xa524('0x3c')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa524('0x118')};}}if(!ut[_0xa524('0x7a')](_0x5b579a[_0xa524('0x47')])){ut[_0xa524('0xfb')](_0xa524('0x119'),_0x5b579a[_0xa524('0x3c')]+_0xa524('0x11a'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5b579a[_0xa524('0x3c')]+_0xa524('0x11a')};}return{'isValid':!![],'message':_0xa524('0x11b')};};Preview[_0xa524('0x11')]['execCall']=function(_0x2badd1,_0x2dd889,_0x3faa21,_0x4cff45){var _0x17f111=this;return new Promise(function(_0x28aab3,_0x4a6da7){var _0x447bcb=_0x2badd1[_0xa524('0x95')];var _0x338c50=_0x17f111[_0xa524('0x7b')](_0x2dd889['Trunk'])?util[_0xa524('0x30')](_0xa524('0x11c'),_0x2dd889[_0xa524('0x115')]['name'],_[_0xa524('0x4b')](_0x2dd889[_0xa524('0x11d')])?'':_0x2dd889[_0xa524('0x11d')][_0xa524('0x11e')]()||'',_0x2dd889[_0xa524('0x11f')]>0x0?_0x3faa21['phone'][_0xa524('0x120')](_0x2dd889[_0xa524('0x11f')]):_0x3faa21[_0xa524('0xf4')]):util[_0xa524('0x30')](_0xa524('0x11c'),_['isNil'](_0x2dd889[_0xa524('0x7c')])?_0x2dd889['Trunk'][_0xa524('0x3c')]:_0x2dd889['TrunkBackup'][_0xa524('0x3c')],_['isNil'](_0x2dd889[_0xa524('0x11d')])?'':_0x2dd889[_0xa524('0x11d')][_0xa524('0x11e')]()||'',_0x2dd889[_0xa524('0x11f')]>0x0?_0x3faa21[_0xa524('0xf4')][_0xa524('0x120')](_0x2dd889['dialCutDigit']):_0x3faa21[_0xa524('0xf4')]);var _0x5d8469=_0x17f111[_0xa524('0x7b')](_0x2dd889['Trunk'])?ut[_0xa524('0x121')](_0x2dd889[_0xa524('0x115')]['callerid'],_0x2dd889[_0xa524('0x122')],_0x2dd889['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xa524('0x123')](_0x2dd889[_0xa524('0x124')],_0x2dd889[_0xa524('0x125')]):_0x2dd889[_0xa524('0x124')]):ut['getCallerId'](_[_0xa524('0x4b')](_0x2dd889[_0xa524('0x7c')])?_0x2dd889[_0xa524('0x115')][_0xa524('0x126')]:_0x2dd889[_0xa524('0x7c')][_0xa524('0x126')],_0x2dd889['dialOriginateCallerIdName'],_0x2dd889[_0xa524('0x125')]>0x0?ut['getCallerIdRandom'](_0x2dd889[_0xa524('0x124')],_0x2dd889[_0xa524('0x125')]):_0x2dd889[_0xa524('0x124')]);if(_0x5d8469){_0x2badd1[_0xa524('0x127')]=ut[_0xa524('0x128')](_0x5d8469);_0x2badd1['originatecalleridnum']=ut[_0xa524('0x129')](_0x5d8469);}var _0x5bc7ff=ut[_0xa524('0x12a')](_0x2dd889,_0x3faa21,_0x338c50,_0x5d8469,_0x447bcb,_0x2badd1);var _0x4cc5ea=utils[_0xa524('0x12b')](_0x3faa21[_0xa524('0xf3')]);Object[_0xa524('0x12c')](_0x5bc7ff,_0x4cc5ea);_[_0xa524('0x12d')](_0x2badd1,ut[_0xa524('0x12e')](_0x5bc7ff));_0x2badd1['starttime']=moment()[_0xa524('0x30')](_0xa524('0x6a'));_0x2dd889[_0xa524('0x12f')]=_0x5bc7ff;var _0x23e928=ut['variablesAction'](_0x2badd1,_0x2dd889,_0x5bc7ff,_0x2badd1[_0xa524('0xae')],_0x4cff45);return ami[_0xa524('0x53')](_0x23e928)[_0xa524('0x5f')](function(_0xd0490){_0x2dd889['originated']+=0x1;logger[_0xa524('0x2d')](_0xa524('0x130'),_0x447bcb,_0xa524('0x96'),_0x2dd889[_0xa524('0x3c')],'originated:\x20',_0x2dd889[_0xa524('0x35')]);_0x28aab3(_0xd0490);})['catch'](function(_0xfa0409){ut[_0xa524('0xe6')](_0x2badd1,0xe,_0xa524('0x131'));rpcDb[_0xa524('0xe8')](_0x2badd1,'[originateFailure][logOriginateFailure]');_0x4a6da7(_0xfa0409);});});};Preview[_0xa524('0x11')][_0xa524('0x25')]=function(_0x5295b6){if(this[_0xa524('0x19')][_0x5295b6[_0xa524('0x8d')]]){this['actions'][_0x5295b6['linkedid']]['channel']=_0x5295b6[_0xa524('0x132')];}};Preview[_0xa524('0x11')][_0xa524('0x1d')]=function(_0x2ef207){var _0x25798f=this;var _0x4e6ec3=this[_0xa524('0x19')][_0x2ef207['actionid']];if(_0x4e6ec3){if(_0x4e6ec3['lookAgent']&&this[_0xa524('0x1a')][_0x4e6ec3['lookAgent']]){ut[_0xa524('0x133')](_0x4e6ec3,this[_0xa524('0x1a')][_0x4e6ec3[_0xa524('0xf5')]]['name'],this[_0xa524('0x1a')][_0x4e6ec3['lookAgent']]['id']);}var _0x59dc20=_['clone'](_0x4e6ec3);_0x59dc20[_0xa524('0x92')]=moment()[_0xa524('0x30')]('YYYY-MM-DD\x20HH:mm:ss');var _0x36ac06=_0x25798f['campaignsPreview'][_0x4e6ec3['queue']];if(ut[_0xa524('0x134')](_0x2ef207['response'])){if(_0x4e6ec3[_0xa524('0x8c')]){rpcDb[_0xa524('0x108')](_0x4e6ec3[_0xa524('0x8f')]);}if(_0x4e6ec3['activeContact']){rpcDb[_0xa524('0x68')](_0x4e6ec3['idContact']);}ami[_0xa524('0x2c')](_0xa524('0x135'),ut[_0xa524('0x83')](_0x4e6ec3,'rejected',this[_0xa524('0x16')][_0x4e6ec3[_0xa524('0x4e')]]));this['callProgressDetectingAgent'](_0x59dc20,_0x36ac06,_0x2ef207);}else{_0x4e6ec3[_0xa524('0x69')]=moment()['format'](_0xa524('0x6a'));ut[_0xa524('0xe6')](_0x59dc20,0x4,_0xa524('0x136'));rpcDb[_0xa524('0xe8')](_0x59dc20,_0xa524('0x137'));}}};Preview[_0xa524('0x11')][_0xa524('0x1e')]=function(_0x4552b7){var _0xf3c893=this[_0xa524('0x19')][_0x4552b7['linkedid']];var _0x453e5e;if(_0xf3c893){_0x453e5e=this[_0xa524('0x16')][_0xf3c893[_0xa524('0x4e')]];logger[_0xa524('0x2d')](_0xa524('0x138'),_0x4552b7[_0xa524('0x8d')],_0xa524('0x96'),_0x453e5e['name'],'pTalking:\x20',_0x453e5e[_0xa524('0x36')]);}if(this[_0xa524('0x19')][_0x4552b7[_0xa524('0x8d')]]&&_0x4552b7[_0xa524('0x8d')]!==_0x4552b7[_0xa524('0x95')]){if(_0x4552b7[_0xa524('0x139')]==='16'&&this['actions'][_0x4552b7[_0xa524('0x8d')]]['dialAnswer']){this[_0xa524('0x7f')](_0x4552b7,_0x4552b7['linkedid'],_0x4552b7[_0xa524('0x139')]);}else if(this['actions'][_0x4552b7[_0xa524('0x8d')]][_0xa524('0x4f')]){logger[_0xa524('0x2d')](_0xa524('0x13a'),_0x4552b7['linkedid'],_0x4552b7[_0xa524('0x139')],_0xa524('0x96'),_0x453e5e['name'],_0xa524('0x97'),_0x453e5e['pTalking']);this[_0xa524('0x7f')](_0x4552b7,_0x4552b7[_0xa524('0x8d')],_0x4552b7[_0xa524('0x139')]);}}else if(_0xf3c893&&_[_0xa524('0x4b')](_0xf3c893[_0xa524('0x13b')])&&_0x453e5e['dialQueueProject']&&_0x4552b7['linkedid']===_0x4552b7[_0xa524('0x95')]&&_['isNil'](_0x4552b7[_0xa524('0xe5')])&&_0x4552b7[_0xa524('0x139')]==='16'&&_0x4552b7[_0xa524('0x13c')]==='6'&&_[_0xa524('0xe3')](_0xf3c893[_0xa524('0x13d')])){if(_0xf3c893['unlockAgent']){rpcDb[_0xa524('0x108')](_0xf3c893[_0xa524('0x8f')]);}if(_0xf3c893[_0xa524('0xae')]){rpcDb['disableContact'](_0xf3c893[_0xa524('0x8f')]);}_0x4552b7[_0xa524('0xe5')]='22';this[_0xa524('0x13e')](_0xf3c893,_0x453e5e,_0x4552b7);}else if(_0xf3c893&&_0xf3c893[_0xa524('0x13d')]){if(_0x4552b7['cause']==='16'&&this[_0xa524('0x19')][_0x4552b7[_0xa524('0x8d')]][_0xa524('0x4f')]){logger[_0xa524('0x2d')](_0xa524('0x13f'),_0x4552b7['linkedid'],_0x4552b7[_0xa524('0x139')],'\x20Queue',_0x453e5e[_0xa524('0x3c')],_0xa524('0x97'),_0x453e5e[_0xa524('0x36')]);this[_0xa524('0x7f')](_0x4552b7,_0x4552b7[_0xa524('0x8d')],_0x4552b7['cause']);}else if(this[_0xa524('0x19')][_0x4552b7[_0xa524('0x8d')]][_0xa524('0x4f')]){logger[_0xa524('0x2d')]('[syncHangup][talking][cause]',_0x4552b7[_0xa524('0x8d')],_0x4552b7['cause'],_0xa524('0x96'),_0x453e5e['name'],'pTalking:\x20',_0x453e5e[_0xa524('0x36')]);this[_0xa524('0x7f')](_0x4552b7,_0x4552b7['linkedid'],_0x4552b7['cause']);}}};Preview[_0xa524('0x11')][_0xa524('0x23')]=function(_0x14ea14){if(this[_0xa524('0x19')][_0x14ea14[_0xa524('0x140')]]&&_0x14ea14['destlinkedid']!==_0x14ea14[_0xa524('0x141')]){this[_0xa524('0x7f')](_0x14ea14,_0x14ea14[_0xa524('0x140')],_0x14ea14[_0xa524('0xd7')]);}};Preview[_0xa524('0x11')][_0xa524('0x21')]=function(_0x274c08){if(this[_0xa524('0x19')][_0x274c08[_0xa524('0x8d')]]&&_0x274c08[_0xa524('0x8d')]!==_0x274c08[_0xa524('0x95')]&&!this[_0xa524('0x19')][_0x274c08[_0xa524('0x8d')]][_0xa524('0x4f')]){if(_0x274c08[_0xa524('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x274c08,_0x274c08[_0xa524('0x8d')],_0x274c08[_0xa524('0x139')]);}}};Preview[_0xa524('0x11')][_0xa524('0x142')]=function(_0x17a9a7,_0x2d202d,_0x4e752f){if(this[_0xa524('0x19')][_0x17a9a7]){if(_[_0xa524('0x4b')](this[_0xa524('0x19')][_0x17a9a7][_0xa524('0x12f')])){this[_0xa524('0x19')][_0x17a9a7][_0xa524('0x12f')]={};}this['actions'][_0x17a9a7][_0xa524('0x12f')][_0x2d202d]=_0x4e752f;}};Preview['prototype'][_0xa524('0x27')]=function(_0xf09fad){try{if(!_[_0xa524('0x4b')](_0xf09fad)){if(ut[_0xa524('0x143')](_['keys'](_0xf09fad['variable'])[0x0])){this[_0xa524('0x142')](_0xf09fad[_0xa524('0x95')],_[_0xa524('0x144')](_0xf09fad[_0xa524('0x145')])[0x0],_0xf09fad[_0xa524('0x146')]);}}}catch(_0x2af68b){logger['error'](_0xa524('0x147'),util['inspect'](_0x2af68b,{'showHidden':![],'depth':null}));}};Preview[_0xa524('0x11')][_0xa524('0x28')]=function(_0x492fe4){if(_0x492fe4){if(this[_0xa524('0x19')][_0x492fe4[_0xa524('0x148')]]){this[_0xa524('0x19')][_0x492fe4[_0xa524('0x148')]][_0xa524('0x13d')]=!![];}}};Preview[_0xa524('0x11')][_0xa524('0x2a')]=function(_0x452429){if(_0x452429){if(this[_0xa524('0x19')][_0x452429[_0xa524('0x149')]]){this[_0xa524('0x19')][_0x452429[_0xa524('0x149')]][_0xa524('0x13d')]=!![];}}};module[_0xa524('0x14a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b87c10c..2af212f 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 _0xd5b3=['lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','holdtime','assigned'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd5b3,0x1ca));var _0x3d5b=function(_0x2b64e4,_0x2ffa7f){_0x2b64e4=_0x2b64e4-0x0;var _0x3b9320=_0xd5b3[_0x2b64e4];return _0x3b9320;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x3d5b('0x0'))(_0x3d5b('0x1'));var cmHopper=require(_0x3d5b('0x2'));var cmHopperHistory=require(_0x3d5b('0x3'));var cmHopperBlack=require(_0x3d5b('0x4'));var agentReportPreview=require(_0x3d5b('0x5'));var voiceQueueReport=require(_0x3d5b('0x6'));function loggerCatch(_0x404ce9){return function(_0xc840cc){logger[_0x3d5b('0x7')](_0x404ce9,util[_0x3d5b('0x8')](_0xc840cc,{'showHidden':![],'depth':null}));};}function create(_0x5bca57){return cmHopperHistory[_0x3d5b('0x9')](_0x5bca57)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0xb')));}function createAgent(_0xe08043){return BPromise['resolve']()[_0x3d5b('0xc')](agentReportPreview[_0x3d5b('0x9')](_0xe08043))[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0xb')));}function moveContact(_0x18d5c3){return cmHopper['moveContactManagedDialer'](_0x18d5c3,!![])['catch'](loggerCatch(_0x3d5b('0xd')));}exports[_0x3d5b('0xe')]=function(_0x29e998){return cmHopperBlack[_0x3d5b('0xe')](_0x29e998)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0xf')));};exports[_0x3d5b('0x10')]=function(_0x1c41b7){return BPromise[_0x3d5b('0x11')]()[_0x3d5b('0xc')](cmHopper[_0x3d5b('0x10')](_0x1c41b7))[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x12')));};exports[_0x3d5b('0x9')]=function(_0xbefbb7,_0x37dfa5){create(_0xbefbb7)[_0x3d5b('0xa')](loggerCatch(_0x37dfa5));moveContact(_0xbefbb7)[_0x3d5b('0xa')](loggerCatch(_0x37dfa5));};exports[_0x3d5b('0x13')]=function(_0x465773,_0x4cd561){createAgent(_0x465773)[_0x3d5b('0xa')](loggerCatch(_0x4cd561));};exports[_0x3d5b('0x14')]=function(_0x2fc080,_0x5b0b5d){create(_0x2fc080)[_0x3d5b('0xa')](loggerCatch(_0x5b0b5d));};exports['createCustomerFinal']=function(_0x1eb810,_0x2cbb73){moveContact(_0x1eb810)[_0x3d5b('0xa')](loggerCatch(_0x2cbb73));};exports['rescheduleContact']=function(_0x2d5cab,_0x28cd67,_0x446a94){if(_0x28cd67){_0x2d5cab['UserId']=null;}if(_0x446a94){_0x2d5cab['active']=![];}return cmHopper[_0x3d5b('0x15')](_0x2d5cab)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x16')));};exports[_0x3d5b('0x17')]=function(_0x287cdb){return cmHopper[_0x3d5b('0x17')](_0x287cdb)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x18')));};exports[_0x3d5b('0x19')]=function(_0x4dc618){return cmHopper[_0x3d5b('0x19')]({'UserId':null},_0x4dc618,0x1)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x1a')));};exports[_0x3d5b('0x1b')]=function(_0x851351){return cmHopper[_0x3d5b('0x19')]({'active':![]},_0x851351,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x3d5b('0x1c')]=function(_0x63f984){var _0x2518e9={};_0x2518e9[_0x3d5b('0x1d')]=_0x63f984[_0x3d5b('0x1d')];_0x2518e9[_0x3d5b('0x1e')]=_0x63f984[_0x3d5b('0x1e')];_0x2518e9['calleridnum']=_0x63f984[_0x3d5b('0x1f')];_0x2518e9[_0x3d5b('0x20')]=_0x63f984[_0x3d5b('0x20')];_0x2518e9[_0x3d5b('0x21')]=_0x63f984['queue'];_0x2518e9['queuecallerjoinAt']=_0x63f984[_0x3d5b('0x22')];_0x2518e9['queuecallerleaveAt']=_0x63f984['answertime'];_0x2518e9[_0x3d5b('0x23')]=0x1;_0x2518e9[_0x3d5b('0x24')]=_0x63f984['endtime'];_0x2518e9[_0x3d5b('0x25')]=_0x63f984[_0x3d5b('0x26')];_0x2518e9['context']=_0x3d5b('0x27');_0x2518e9['exten']='xcally-motion-preview';_0x2518e9[_0x3d5b('0x28')]=0x0;_0x2518e9[_0x3d5b('0x29')]=0x1;_0x2518e9[_0x3d5b('0x2a')]=_0x63f984[_0x3d5b('0x26')];_0x2518e9[_0x3d5b('0x2b')]=_0x3d5b('0x2c');return BPromise[_0x3d5b('0x11')]()['then'](voiceQueueReport['create'](_0x2518e9))[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x2d')));};exports[_0x3d5b('0x2e')]=function(_0x2bfe7b,_0x1fbb00){return BPromise[_0x3d5b('0x11')]()[_0x3d5b('0xc')](cmHopper['getContactRecallMe'](_0x2bfe7b,_0x1fbb00))['catch'](loggerCatch(_0x3d5b('0x2f')));};exports[_0x3d5b('0x30')]=function(_0x2b776a){return cmHopper['rescheduleContact'](_0x2b776a,!![],!![])[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x31')));}; \ No newline at end of file +var _0xc722=['util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[activeContact]\x20','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xc722,0xf5));var _0x2c72=function(_0x44fbdf,_0x6115b2){_0x44fbdf=_0x44fbdf-0x0;var _0x28a5c2=_0xc722[_0x44fbdf];return _0x28a5c2;};'use strict';var util=require(_0x2c72('0x0'));var BPromise=require('bluebird');var logger=require(_0x2c72('0x1'))(_0x2c72('0x2'));var cmHopper=require(_0x2c72('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2c72('0x4'));var agentReportPreview=require(_0x2c72('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2dd693){return function(_0x112482){logger['error'](_0x2dd693,util[_0x2c72('0x6')](_0x112482,{'showHidden':![],'depth':null}));};}function create(_0xfd444e){return cmHopperHistory['createHistory'](_0xfd444e)[_0x2c72('0x7')](loggerCatch(_0x2c72('0x8')));}function createAgent(_0x5008e1){return BPromise[_0x2c72('0x9')]()[_0x2c72('0xa')](agentReportPreview[_0x2c72('0xb')](_0x5008e1))[_0x2c72('0x7')](loggerCatch(_0x2c72('0x8')));}function moveContact(_0x23f112){return cmHopper[_0x2c72('0xc')](_0x23f112,!![])['catch'](loggerCatch(_0x2c72('0xd')));}exports[_0x2c72('0xe')]=function(_0x4013b2){return cmHopperBlack['checkIsBlackList'](_0x4013b2)['catch'](loggerCatch(_0x2c72('0xf')));};exports[_0x2c72('0x10')]=function(_0x4fc5b9){return BPromise[_0x2c72('0x9')]()[_0x2c72('0xa')](cmHopper['getContactPreview'](_0x4fc5b9))['catch'](loggerCatch(_0x2c72('0x11')));};exports[_0x2c72('0xb')]=function(_0xc2506f,_0x2934f1){create(_0xc2506f)[_0x2c72('0x7')](loggerCatch(_0x2934f1));moveContact(_0xc2506f)['catch'](loggerCatch(_0x2934f1));};exports[_0x2c72('0x12')]=function(_0x5bd43f,_0x398664){createAgent(_0x5bd43f)[_0x2c72('0x7')](loggerCatch(_0x398664));};exports[_0x2c72('0x13')]=function(_0x205a80,_0x3a54ed){create(_0x205a80)[_0x2c72('0x7')](loggerCatch(_0x3a54ed));};exports[_0x2c72('0x14')]=function(_0x5b16da,_0x24ee01){moveContact(_0x5b16da)[_0x2c72('0x7')](loggerCatch(_0x24ee01));};exports[_0x2c72('0x15')]=function(_0x1b3dad,_0x468eeb,_0x44d96f){if(_0x468eeb){_0x1b3dad[_0x2c72('0x16')]=null;}if(_0x44d96f){_0x1b3dad['active']=![];}return cmHopper[_0x2c72('0x15')](_0x1b3dad)[_0x2c72('0x7')](loggerCatch(_0x2c72('0x17')));};exports[_0x2c72('0x18')]=function(_0x412ddd){return cmHopper[_0x2c72('0x18')](_0x412ddd)[_0x2c72('0x7')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x51b71d){return cmHopper[_0x2c72('0x19')]({'UserId':null},_0x51b71d,0x1)[_0x2c72('0x7')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x419374){return cmHopper[_0x2c72('0x19')]({'active':![]},_0x419374,0x1)[_0x2c72('0x7')](loggerCatch(_0x2c72('0x1a')));};exports['crateCustomerReportQueue']=function(_0x3e244c){var _0x437fa0={};_0x437fa0[_0x2c72('0x1b')]=_0x3e244c[_0x2c72('0x1b')];_0x437fa0[_0x2c72('0x1c')]=_0x3e244c[_0x2c72('0x1c')];_0x437fa0['calleridnum']=_0x3e244c['calleridnum'];_0x437fa0[_0x2c72('0x1d')]=_0x3e244c[_0x2c72('0x1d')];_0x437fa0[_0x2c72('0x1e')]=_0x3e244c[_0x2c72('0x1e')];_0x437fa0[_0x2c72('0x1f')]=_0x3e244c[_0x2c72('0x20')];_0x437fa0['queuecallerleaveAt']=_0x3e244c[_0x2c72('0x20')];_0x437fa0[_0x2c72('0x21')]=0x1;_0x437fa0[_0x2c72('0x22')]=_0x3e244c['endtime'];_0x437fa0[_0x2c72('0x23')]=_0x3e244c[_0x2c72('0x24')];_0x437fa0[_0x2c72('0x25')]=_0x2c72('0x26');_0x437fa0[_0x2c72('0x27')]=_0x2c72('0x28');_0x437fa0[_0x2c72('0x29')]=0x0;_0x437fa0['assigned']=0x1;_0x437fa0['lastAssignedTo']=_0x3e244c[_0x2c72('0x24')];_0x437fa0[_0x2c72('0x2a')]=_0x2c72('0x2b');return BPromise['resolve']()[_0x2c72('0xa')](voiceQueueReport[_0x2c72('0x2c')](_0x437fa0))[_0x2c72('0x7')](loggerCatch(_0x2c72('0x2d')));};exports['getContactRecallMe']=function(_0x2d17d5,_0x536846){return BPromise[_0x2c72('0x9')]()[_0x2c72('0xa')](cmHopper[_0x2c72('0x2e')](_0x2d17d5,_0x536846))[_0x2c72('0x7')](loggerCatch(_0x2c72('0x2f')));};exports['rescheduleContactInQueue']=function(_0x14041c){return cmHopper['rescheduleContact'](_0x14041c,!![],!![])[_0x2c72('0x7')](loggerCatch(_0x2c72('0x30')));}; \ 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 2377c7d..c1e4bbd 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 _0x42c9=['scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','buildAcw','hasOwnProperty','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-agi','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','noanswer','keys','forEach','toLowerCase','variables','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','logAgent','responsetime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global'];(function(_0x49c810,_0x2eed6e){var _0x1e1391=function(_0x596bd2){while(--_0x596bd2){_0x49c810['push'](_0x49c810['shift']());}};_0x1e1391(++_0x2eed6e);}(_0x42c9,0xc8));var _0x942c=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x42c9[_0x4f4c2a];return _0xd15be6;};'use strict';var util=require(_0x942c('0x0'));var _=require(_0x942c('0x1'));var moment=require('moment');var logger=require(_0x942c('0x2'))('preview');var ipAgi=process[_0x942c('0x3')][_0x942c('0x4')]||_0x942c('0x5');var utils=require(_0x942c('0x6'));exports[_0x942c('0x7')]=function(_0x1a4f5d){return function(_0x361179){logger['error'](_0x1a4f5d,util[_0x942c('0x8')](_0x361179,{'showHidden':![],'depth':null}));};};exports[_0x942c('0x9')]=function(_0x1c1513,_0x1a171a){logger[_0x942c('0xa')](_0x1c1513,util[_0x942c('0x8')](_0x1a171a,{'showHidden':![],'depth':null}));};exports[_0x942c('0xb')]=function(_0x2edb60,_0x2c2a65){logger['error'](_0x2edb60,util[_0x942c('0x8')](_0x2c2a65,{'showHidden':![],'depth':null}));};exports[_0x942c('0xc')]=function(_0x4c3574){return function(_0x421fbd){logger[_0x942c('0xa')](_0x4c3574,util[_0x942c('0x8')](_0x421fbd,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x228aa4,_0x464dd8,_0x16015d){return{'message':_0x228aa4,'unlock':_0x464dd8,'active':_0x16015d};};exports['getCallerId']=function(_0x2605a7,_0x38b165,_0x355daf){if(!_[_0x942c('0xd')](_0x355daf)&&_0x942c('0xe')===typeof _0x355daf&&!_[_0x942c('0xf')](_0x355daf)){if(!_[_0x942c('0xd')](_0x38b165)&&_0x942c('0xe')===typeof _0x38b165&&!_[_0x942c('0xf')](_0x38b165)){return util[_0x942c('0x10')](_0x942c('0x11'),_0x38b165,_0x355daf);}return util[_0x942c('0x10')](_0x942c('0x11'),_0x355daf,_0x355daf);}if(!_[_0x942c('0xd')](_0x2605a7)&&_0x942c('0xe')===typeof _0x2605a7&&!_[_0x942c('0xf')](_0x2605a7)){return _0x2605a7;}return _0x942c('0x12');};exports[_0x942c('0x13')]=function(_0x519d91){if(_[_0x942c('0x14')](_0x519d91)){return![];}return _0x519d91;};exports[_0x942c('0x15')]=function(_0x3255dd,_0x1a9e23,_0x32a8c7,_0x42eac0,_0x18e2ac,_0x47ff62){var _0x330fdb={'XMD-QUEUE':_0x1a9e23[_0x942c('0x16')]?_0x1a9e23[_0x942c('0x16')][_0x942c('0x17')]:'','XMD-CALLERID':_0x42eac0,'XMD-CALLERID-PREVIEW':_0x47ff62?util[_0x942c('0x10')](_0x942c('0x11'),_0x47ff62[_0x942c('0x18')],_0x47ff62[_0x942c('0x19')]):_0x42eac0,'XMD-DIALID':_0x18e2ac,'XMD-CONTACTID':_0x1a9e23[_0x942c('0x1a')],'XMD-CDRTYPE':_0x942c('0x1b'),'CALLERID(all)':_0x42eac0,'XMD-VOICEQUEUEID':_0x1a9e23[_0x942c('0x1c')],'XMD-DIALCHANNEL':_0x32a8c7,'XMD-DIALTIMEOUT':_0x3255dd['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x942c('0x10')](_0x942c('0x1d'),_0x3255dd['dialQueueProject2']?'g':'',_[_0x942c('0xf')](_0x3255dd['monitor_format'])?'':_0x942c('0x1e')),'XMD-DIALURL':_0x3255dd['dialPreviewUrl']||'','XMD-AGI':_0x3255dd[_0x942c('0x1f')]?util[_0x942c('0x10')](_0x942c('0x20'),ipAgi,_0x3255dd[_0x942c('0x1f')]):_0x942c('0x21'),'XMD-AGIAFTER':_0x3255dd['dialQueueProject2']?util[_0x942c('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3255dd['dialQueueProject2']):_0x942c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x47ff62?_0x47ff62[_0x942c('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x47ff62?_0x47ff62[_0x942c('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x942c('0x24')};if(!_[_0x942c('0xf')](_0x3255dd[_0x942c('0x25')])){_0x330fdb[util[_0x942c('0x10')]('%s',_0x942c('0x26'))]=_0x3255dd[_0x942c('0x25')];_0x330fdb[util['format']('%s',_0x942c('0x27'))]=_0x18e2ac;}if(_0x1a9e23&&_0x1a9e23[_0x942c('0x28')]){for(var _0xcbe842 in _0x1a9e23['Contact']){if(_0x1a9e23[_0x942c('0x28')]['hasOwnProperty'](_0xcbe842)){if(!_[_0x942c('0x14')](_0x1a9e23[_0x942c('0x28')][_0xcbe842])&&_0xcbe842!=='id'&&_0xcbe842!==_0x942c('0x29')&&_0xcbe842!=='createdAt'&&_0xcbe842!==_0x942c('0x2a')){_0x330fdb[util[_0x942c('0x10')](_0x942c('0x2b'),_0x942c('0x2c'),_['toUpper'](_0xcbe842))]=_0x1a9e23['Contact'][_0xcbe842];}}}}return _0x330fdb;};exports[_0x942c('0x2d')]=function(_0x139cbe){var _0x4f9edb={};for(var _0x76b80d in _0x139cbe){if(_0x139cbe['hasOwnProperty'](_0x76b80d)){_0x4f9edb[util[_0x942c('0x10')]('%s',_[_0x942c('0x2e')](_0x76b80d))]=_0x139cbe[_0x76b80d];}}return{'variables':_0x4f9edb};};exports[_0x942c('0x2f')]=function(_0x5512ac,_0x4528f8){if(!_[_0x942c('0x14')](_0x5512ac)){if(_0x5512ac['hasOwnProperty'](_0x942c('0x30'))){if(_0x5512ac[_0x942c('0x30')]>0x0){_0x5512ac['originated']-=0x1;}else{logger[_0x942c('0x31')](_0x942c('0x32'),_0x4528f8);}}}else{logger['error'](_0x942c('0x33'),_0x4528f8);}};exports['logBlacklist']=function(_0x40135f){var _0xe92ce7=moment()[_0x942c('0x10')](_0x942c('0x34'));_0x40135f[_0x942c('0x35')]=0xd;_0x40135f[_0x942c('0x36')]=_0x942c('0x37');_0x40135f[_0x942c('0x38')]=_0xe92ce7;_0x40135f['responsetime']=_0xe92ce7;_0x40135f['endtime']=_0xe92ce7;};exports[_0x942c('0x39')]=function(_0x592565,_0x29e313,_0x411bc0){var _0x43ab9f=moment()['format'](_0x942c('0x34'));_0x592565[_0x942c('0x35')]=_0x29e313;_0x592565['statedesc']=_0x411bc0;_0x592565[_0x942c('0x3a')]=_0x43ab9f;_0x592565['ringtime']=utils[_0x942c('0x3b')](_0x592565[_0x942c('0x3a')],_0x592565[_0x942c('0x38')]);};exports[_0x942c('0x3c')]=function(_0x185a3b,_0x4fe76a,_0x478de3){_0x185a3b[_0x942c('0x3d')]=_0x4fe76a;_0x185a3b[_0x942c('0x3e')]=_0x478de3;};exports[_0x942c('0x3f')]=function(_0x5abb09,_0x11d085,_0x2e6963){var _0x4badc0=moment()['format'](_0x942c('0x34'));_0x5abb09[_0x942c('0x35')]=_0x11d085;_0x5abb09[_0x942c('0x36')]=_0x2e6963;_0x5abb09[_0x942c('0x3a')]=_0x5abb09[_0x942c('0x3a')]?_0x5abb09[_0x942c('0x3a')]:_0x4badc0;_0x5abb09[_0x942c('0x40')]=_0x5abb09['endtime']?_0x5abb09[_0x942c('0x40')]:_0x4badc0;_0x5abb09[_0x942c('0x41')]=utils['getSeconds'](_0x5abb09[_0x942c('0x3a')]||0x0,_0x5abb09[_0x942c('0x38')]||0x0);_0x5abb09[_0x942c('0x42')]=_0x5abb09[_0x942c('0x43')]?utils[_0x942c('0x3b')](_0x5abb09[_0x942c('0x40')],_0x5abb09[_0x942c('0x43')]):0x0;};exports[_0x942c('0x44')]=function(_0x5a6d4a){return _0x5a6d4a===_0x942c('0x45');};exports[_0x942c('0x46')]=function(_0x1b6f80,_0x473ba7,_0x44eedf,_0x44542c,_0x2dfe90){var _0x5a7030=_0x44542c?_0x942c('0x47'):_0x1b6f80['calleridname'];_0x5a7030=_0x2dfe90?'BOOKED':_0x5a7030;return{'actionid':_0x1b6f80['uniqueid'],'action':_0x942c('0x48'),'channel':_0x1b6f80[_0x942c('0x49')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x5a7030,_0x1b6f80[_0x942c('0x19')]),'Exten':'xcally-motion-preview','Context':_0x942c('0x4a'),'Priority':'1','variable':_0x44eedf,'timeout':(_0x473ba7[_0x942c('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1b6f80[_0x942c('0x4c')]};};exports['totalGlobal']=function(_0x37ca51){return _0x37ca51[_0x942c('0x4d')]+_0x37ca51[_0x942c('0x4e')]+_0x37ca51[_0x942c('0x4f')]+_0x37ca51[_0x942c('0x50')]+_0x37ca51[_0x942c('0x51')];};exports[_0x942c('0x52')]=function(_0x446789){var _0x53b608=_['clone'](_0x446789);_0x53b608[_0x942c('0x35')]=0xf;_0x53b608[_0x942c('0x36')]=_0x942c('0x53');return _0x53b608;};exports[_0x942c('0x54')]=function(_0x39e61f,_0xf18678,_0x1a8740){var _0x2ab101={};_0x2ab101[_0xf18678]=_0x39e61f[_0xf18678];_0x2ab101[_0x942c('0x55')]=![];_0x2ab101[_0x942c('0x56')]=moment()[_0x942c('0x57')](_0x1a8740,_0x942c('0x58'))[_0x942c('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ab101[_0x942c('0x1a')]=_0x39e61f['ContactId'];_0x2ab101['ListId']=_0x39e61f[_0x942c('0x59')];_0x2ab101[_0x942c('0x1c')]=_0x39e61f[_0x942c('0x1c')]||undefined;return _0x2ab101;};exports[_0x942c('0x5a')]=function(_0x1ce9b2,_0x2865e6){if(!_[_0x942c('0x14')](_0x1ce9b2)){if(_0x1ce9b2[_0x942c('0x5b')]>0x0){_0x1ce9b2[_0x942c('0x5b')]-=0x1;}else{logger[_0x942c('0x31')](_0x2865e6,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x942c('0x31')](_0x2865e6,_0x942c('0x5c'));}};exports[_0x942c('0x5d')]=function(_0x43e5d0){if(_0x43e5d0<=0x0){return!![];}return![];};function buildObj(_0x416b51,_0x2fc9e0,_0x3ba34e){_0x416b51[_0x942c('0x5e')]=_0x2fc9e0;_0x416b51['name']=_0x416b51[_0x942c('0x5f')];_0x416b51[_0x942c('0x60')]=_0x416b51[_0x942c('0x49')];_0x416b51['motionChannel']='voice';if(_0x3ba34e){_0x416b51[_0x942c('0x61')]=_0x3ba34e[_0x942c('0x61')];}return _0x416b51;}exports['buildObj']=buildObj;exports[_0x942c('0x62')]=function(_0x1b7928){var _0x132a69={};_0x132a69[_0x942c('0x5f')]=_0x1b7928[_0x942c('0x5f')];_0x132a69[_0x942c('0x60')]=_0x1b7928['channelAgent'];_0x132a69[_0x942c('0x4c')]=_0x1b7928[_0x942c('0x4c')];return _0x132a69;};exports['agentReadyId']=function(_0x59f43a){var _0x393dc8=[];for(var _0x3c6e2e in _0x59f43a){if(_0x59f43a[_0x942c('0x63')](_0x3c6e2e)){if(!_[_0x942c('0x14')](_0x59f43a[_0x3c6e2e])&&_0x59f43a[_0x3c6e2e]['state']===_0x942c('0x64')&&_0x59f43a[_0x3c6e2e][_0x942c('0x65')]===_0x942c('0x66')){_0x393dc8[_0x942c('0x67')](_0x59f43a[_0x3c6e2e]['id']);}}}return _0x393dc8;};exports[_0x942c('0x68')]=function(_0x5aceb7){var _0x4e79f2=moment()[_0x942c('0x69')](0x0);var _0x26b413=moment(_0x5aceb7)['milliseconds'](0x0);return _0x4e79f2[_0x942c('0x6a')](_0x26b413,_0x942c('0x6b'));};exports[_0x942c('0x6c')]=function(_0x3ed48f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ed48f['ContactId'],'ListId':_0x3ed48f[_0x942c('0x59')],'VoiceQueueId':_0x3ed48f[_0x942c('0x1c')]||undefined,'CampaignId':_0x3ed48f[_0x942c('0x6d')]||undefined};};exports[_0x942c('0x6e')]=function(_0x1c0341){if(_0x1c0341==='uniqueid'||_0x1c0341===_0x942c('0x6f')||_0x1c0341==='queue'||_0x1c0341===_0x942c('0x70')||_0x1c0341==='campaigntype'||_0x1c0341===_0x942c('0x71')||_0x1c0341===_0x942c('0x3d')||_0x1c0341==='channelAgent'||_0x1c0341===_0x942c('0x18')||_0x1c0341===_0x942c('0x55')||_0x1c0341==='calleridnum'||_0x1c0341===_0x942c('0x56')||_0x1c0341===_0x942c('0x4d')||_0x1c0341===_0x942c('0x4e')||_0x1c0341===_0x942c('0x4f')||_0x1c0341==='countglobal'||_0x1c0341===_0x942c('0x72')||_0x1c0341===_0x942c('0x73')||_0x1c0341===_0x942c('0x74')||_0x1c0341==='recallme'||_0x1c0341==='ContactId'||_0x1c0341===_0x942c('0x59')||_0x1c0341===_0x942c('0x3e')||_0x1c0341===_0x942c('0x1c')||_0x1c0341===_0x942c('0x75')||_0x1c0341==='xmd-voicequeueid'||_0x1c0341===_0x942c('0x76')||_0x1c0341===_0x942c('0x77')||_0x1c0341==='xmd-listid'||_0x1c0341==='xmd-dialurl'||_0x1c0341===_0x942c('0x78')||_0x1c0341==='xmd-dialoptions'||_0x1c0341==='xmd-dialid'||_0x1c0341===_0x942c('0x79')||_0x1c0341===_0x942c('0x7a')||_0x1c0341==='xmd-cdrtype'||_0x1c0341==='xmd-callerid'||_0x1c0341==='xmd-agiafter'||_0x1c0341===_0x942c('0x7b')||_0x1c0341==='rtpaudioqos'||_0x1c0341==='rtpaudioqosbridged'||_0x1c0341===_0x942c('0x7c')||_0x1c0341==='rtpaudioqosjitterbridged'||_0x1c0341===_0x942c('0x7d')||_0x1c0341===_0x942c('0x7e')||_0x1c0341===_0x942c('0x7f')||_0x1c0341==='rtpaudioqosrttbridged'||_0x1c0341===_0x942c('0x80')||_0x1c0341===_0x942c('0x81')||_0x1c0341===_0x942c('0x7c')||_0x1c0341===_0x942c('0x82')||_0x1c0341==='rtpaudioqosloss'||_0x1c0341===_0x942c('0x7e')||_0x1c0341==='rtpaudioqosrtt'||_0x1c0341==='rtpaudioqosrttbridged'||_0x1c0341===_0x942c('0x83')||_0x1c0341==='bridgepvtcallid'||_0x1c0341===_0x942c('0x35')||_0x1c0341===_0x942c('0x36')){return![];}return!![];};exports[_0x942c('0x84')]=function(_0x2a148b,_0x490ccc){var _0x4a85e6,_0x445e44,_0x27fff2;if(_0x490ccc<=0x0){_0x490ccc=0x1;}_0x4a85e6=new RegExp('\x5cw{0,'+_0x490ccc+'}$');_0x445e44=Math[_0x942c('0x85')](0xa,_0x490ccc-0x1);_0x27fff2=Math[_0x942c('0x85')](0xa,_0x490ccc)-0x1;return util[_0x942c('0x10')]('%s',_[_0x942c('0x86')](_0x2a148b,_0x4a85e6,_[_0x942c('0x87')](_0x445e44,_0x27fff2)));};exports[_0x942c('0x88')]=function(_0xa36a59){var _0x35ad69=_0xa36a59['match'](/"(.*?)"/);return _0x35ad69?_0x35ad69[0x1]:_0xa36a59;};exports['extractCalleridNumber']=function(_0x7f737d){var _0x4ffe05=_0x7f737d['match'](/<(.*?)>/);return _0x4ffe05?_0x4ffe05[0x1]:_0x7f737d;};function buildNoAnswerEventPayload(_0x1bf85f,_0x1134fb){var _0x1db758=buildObj(_0x1bf85f,_0x942c('0x89'));if(!_[_0x942c('0xf')](_0x1134fb['variables'])){Object[_0x942c('0x8a')](_0x1134fb['variables'])[_0x942c('0x8b')](function(_0x14fd59){_0x1db758[_0x14fd59[_0x942c('0x8c')]()]=_0x1134fb[_0x942c('0x8d')][_0x14fd59];});}return _0x1db758;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x3530=['127.0.0.1','../../dialer/utils','loggerCatch','inspect','info','loggerError','error','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','answertime','variablesAction','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','uniqueid','agentReadyId','status','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','idContact','campaigntype','dialAnswer','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment'];(function(_0x1cae7f,_0x419cec){var _0x312391=function(_0x443700){while(--_0x443700){_0x1cae7f['push'](_0x1cae7f['shift']());}};_0x312391(++_0x419cec);}(_0x3530,0x11b));var _0x0353=function(_0x1e6e5d,_0x37baa5){_0x1e6e5d=_0x1e6e5d-0x0;var _0x5b489c=_0x3530[_0x1e6e5d];return _0x5b489c;};'use strict';var util=require(_0x0353('0x0'));var _=require(_0x0353('0x1'));var moment=require(_0x0353('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x0353('0x3');var utils=require(_0x0353('0x4'));exports[_0x0353('0x5')]=function(_0x53c6b4){return function(_0x308d28){logger['error'](_0x53c6b4,util[_0x0353('0x6')](_0x308d28,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x28a514,_0x2f1ec6){logger[_0x0353('0x7')](_0x28a514,util['inspect'](_0x2f1ec6,{'showHidden':![],'depth':null}));};exports[_0x0353('0x8')]=function(_0x2937a3,_0x1bc206){logger[_0x0353('0x9')](_0x2937a3,util[_0x0353('0x6')](_0x1bc206,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x403469){return function(_0x3c0a51){logger[_0x0353('0x7')](_0x403469,util[_0x0353('0x6')](_0x3c0a51,{'showHidden':![],'depth':null}));};};exports[_0x0353('0xa')]=function(_0x1edd9e,_0x299475,_0x14de0f){return{'message':_0x1edd9e,'unlock':_0x299475,'active':_0x14de0f};};exports['getCallerId']=function(_0x341c23,_0x5ab1ca,_0x4289d1){if(!_[_0x0353('0xb')](_0x4289d1)&&_0x0353('0xc')===typeof _0x4289d1&&!_[_0x0353('0xd')](_0x4289d1)){if(!_[_0x0353('0xb')](_0x5ab1ca)&&_0x0353('0xc')===typeof _0x5ab1ca&&!_['isEmpty'](_0x5ab1ca)){return util[_0x0353('0xe')](_0x0353('0xf'),_0x5ab1ca,_0x4289d1);}return util[_0x0353('0xe')](_0x0353('0xf'),_0x4289d1,_0x4289d1);}if(!_[_0x0353('0xb')](_0x341c23)&&_0x0353('0xc')===typeof _0x341c23&&!_['isEmpty'](_0x341c23)){return _0x341c23;}return _0x0353('0x10');};exports[_0x0353('0x11')]=function(_0x264e96){if(_[_0x0353('0x12')](_0x264e96)){return![];}return _0x264e96;};exports[_0x0353('0x13')]=function(_0x49b3e6,_0x3f4615,_0x4543be,_0x52c579,_0x235802,_0x31fa78){var _0x3035c4={'XMD-QUEUE':_0x3f4615[_0x0353('0x14')]?_0x3f4615[_0x0353('0x14')][_0x0353('0x15')]:'','XMD-CALLERID':_0x52c579,'XMD-CALLERID-PREVIEW':_0x31fa78?util[_0x0353('0xe')](_0x0353('0xf'),_0x31fa78[_0x0353('0x16')],_0x31fa78[_0x0353('0x17')]):_0x52c579,'XMD-DIALID':_0x235802,'XMD-CONTACTID':_0x3f4615[_0x0353('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x52c579,'XMD-VOICEQUEUEID':_0x3f4615[_0x0353('0x19')],'XMD-DIALCHANNEL':_0x4543be,'XMD-DIALTIMEOUT':_0x49b3e6[_0x0353('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x0353('0xe')]('\x22rtTxX%s%s\x22',_0x49b3e6[_0x0353('0x1b')]?'g':'',_[_0x0353('0xd')](_0x49b3e6[_0x0353('0x1c')])?'':_0x0353('0x1d')),'XMD-DIALURL':_0x49b3e6[_0x0353('0x1e')]||'','XMD-AGI':_0x49b3e6['dialQueueProject']?util[_0x0353('0xe')](_0x0353('0x1f'),ipAgi,_0x49b3e6[_0x0353('0x20')]):_0x0353('0x21'),'XMD-AGIAFTER':_0x49b3e6[_0x0353('0x1b')]?util['format'](_0x0353('0x1f'),ipAgi,_0x49b3e6['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x31fa78?_0x31fa78['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x31fa78?_0x31fa78[_0x0353('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x0353('0x23')};if(!_[_0x0353('0xd')](_0x49b3e6[_0x0353('0x1c')])){_0x3035c4[util[_0x0353('0xe')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x49b3e6[_0x0353('0x1c')];_0x3035c4[util['format']('%s',_0x0353('0x24'))]=_0x235802;}return _0x3035c4;};exports['toLowerVariables']=function(_0x40e292){var _0x2f8c1a={};for(var _0x44abcb in _0x40e292){if(_0x40e292[_0x0353('0x25')](_0x44abcb)){_0x2f8c1a[util[_0x0353('0xe')]('%s',_[_0x0353('0x26')](_0x44abcb))]=_0x40e292[_0x44abcb];}}return{'variables':_0x2f8c1a};};exports[_0x0353('0x27')]=function(_0x1f692b,_0x4a30b3){if(!_[_0x0353('0x12')](_0x1f692b)){if(_0x1f692b['hasOwnProperty'](_0x0353('0x28'))){if(_0x1f692b[_0x0353('0x28')]>0x0){_0x1f692b[_0x0353('0x28')]-=0x1;}else{logger[_0x0353('0x9')](_0x0353('0x29'),_0x4a30b3);}}}else{logger['error'](_0x0353('0x2a'),_0x4a30b3);}};exports[_0x0353('0x2b')]=function(_0x2d44c9){var _0xdc42a7=moment()[_0x0353('0xe')](_0x0353('0x2c'));_0x2d44c9[_0x0353('0x2d')]=0xd;_0x2d44c9[_0x0353('0x2e')]=_0x0353('0x2f');_0x2d44c9[_0x0353('0x30')]=_0xdc42a7;_0x2d44c9['responsetime']=_0xdc42a7;_0x2d44c9[_0x0353('0x31')]=_0xdc42a7;};exports['logAgent']=function(_0xaeb46c,_0x51bd4f,_0x534efb){var _0x42fc50=moment()[_0x0353('0xe')](_0x0353('0x2c'));_0xaeb46c[_0x0353('0x2d')]=_0x51bd4f;_0xaeb46c[_0x0353('0x2e')]=_0x534efb;_0xaeb46c[_0x0353('0x32')]=_0x42fc50;_0xaeb46c[_0x0353('0x33')]=utils[_0x0353('0x34')](_0xaeb46c['responsetime'],_0xaeb46c[_0x0353('0x30')]);};exports[_0x0353('0x35')]=function(_0x1de259,_0xee11b9,_0x1d59b7){_0x1de259[_0x0353('0x36')]=_0xee11b9;_0x1de259[_0x0353('0x37')]=_0x1d59b7;};exports[_0x0353('0x38')]=function(_0x5b61c5,_0x280903,_0x237538){var _0x1fd108=moment()['format'](_0x0353('0x2c'));_0x5b61c5[_0x0353('0x2d')]=_0x280903;_0x5b61c5[_0x0353('0x2e')]=_0x237538;_0x5b61c5[_0x0353('0x32')]=_0x5b61c5[_0x0353('0x32')]?_0x5b61c5[_0x0353('0x32')]:_0x1fd108;_0x5b61c5['endtime']=_0x5b61c5['endtime']?_0x5b61c5['endtime']:_0x1fd108;_0x5b61c5[_0x0353('0x33')]=utils[_0x0353('0x34')](_0x5b61c5[_0x0353('0x32')]||0x0,_0x5b61c5[_0x0353('0x30')]||0x0);_0x5b61c5['talktime']=_0x5b61c5[_0x0353('0x39')]?utils[_0x0353('0x34')](_0x5b61c5[_0x0353('0x31')],_0x5b61c5[_0x0353('0x39')]):0x0;};exports['isFailure']=function(_0x58b80b){return _0x58b80b==='Failure';};exports[_0x0353('0x3a')]=function(_0xec65a7,_0x2ccb9d,_0x381b35,_0x475fb4,_0x53807a){var _0x5dc722=_0x475fb4?_0x0353('0x3b'):_0xec65a7[_0x0353('0x16')];_0x5dc722=_0x53807a?_0x0353('0x3c'):_0x5dc722;return{'actionid':_0xec65a7['uniqueid'],'action':_0x0353('0x3d'),'channel':_0xec65a7[_0x0353('0x3e')],'callerid':util[_0x0353('0xe')](_0x0353('0xf'),_0x5dc722,_0xec65a7[_0x0353('0x17')]),'Exten':_0x0353('0x3f'),'Context':_0x0353('0x40'),'Priority':'1','variable':_0x381b35,'timeout':(_0x2ccb9d[_0x0353('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0xec65a7['uniqueid']};};exports[_0x0353('0x42')]=function(_0x32d603){return _0x32d603['countbusyretry']+_0x32d603[_0x0353('0x43')]+_0x32d603[_0x0353('0x44')]+_0x32d603[_0x0353('0x45')]+_0x32d603[_0x0353('0x46')];};exports[_0x0353('0x47')]=function(_0x224b73){var _0x38a1a4=_[_0x0353('0x48')](_0x224b73);_0x38a1a4['state']=0xf;_0x38a1a4[_0x0353('0x2e')]=_0x0353('0x49');return _0x38a1a4;};exports[_0x0353('0x4a')]=function(_0x16eb08,_0x2d6bee,_0x4774f6){var _0x260a37={};_0x260a37[_0x2d6bee]=_0x16eb08[_0x2d6bee];_0x260a37[_0x0353('0x4b')]=![];_0x260a37[_0x0353('0x4c')]=moment()[_0x0353('0x4d')](_0x4774f6,_0x0353('0x4e'))[_0x0353('0xe')](_0x0353('0x2c'));_0x260a37[_0x0353('0x18')]=_0x16eb08[_0x0353('0x18')];_0x260a37['ListId']=_0x16eb08[_0x0353('0x4f')];_0x260a37[_0x0353('0x19')]=_0x16eb08['VoiceQueueId']||undefined;return _0x260a37;};exports[_0x0353('0x50')]=function(_0x3366c6,_0x2d79fd){if(!_[_0x0353('0x12')](_0x3366c6)){if(_0x3366c6[_0x0353('0x51')]>0x0){_0x3366c6[_0x0353('0x51')]-=0x1;}else{logger[_0x0353('0x9')](_0x2d79fd,_0x0353('0x52'));}}else{logger[_0x0353('0x9')](_0x2d79fd,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x0353('0x53')]=function(_0x284688){if(_0x284688<=0x0){return!![];}return![];};function buildObj(_0x18283b,_0x35b5aa,_0x33fa12){_0x18283b[_0x0353('0x54')]=_0x35b5aa;_0x18283b[_0x0353('0x15')]=_0x18283b[_0x0353('0x55')];_0x18283b[_0x0353('0x56')]=_0x18283b[_0x0353('0x3e')];_0x18283b[_0x0353('0x57')]=_0x0353('0x58');if(_0x33fa12){_0x18283b[_0x0353('0x59')]=_0x33fa12[_0x0353('0x59')];}return _0x18283b;}exports[_0x0353('0x5a')]=buildObj;exports[_0x0353('0x5b')]=function(_0x3bca05){var _0x1f733b={};_0x1f733b[_0x0353('0x55')]=_0x3bca05['queue'];_0x1f733b[_0x0353('0x56')]=_0x3bca05['channelAgent'];_0x1f733b[_0x0353('0x5c')]=_0x3bca05[_0x0353('0x5c')];return _0x1f733b;};exports[_0x0353('0x5d')]=function(_0x1ac87f){var _0x4fe79c=[];for(var _0x1b9347 in _0x1ac87f){if(_0x1ac87f[_0x0353('0x25')](_0x1b9347)){if(!_[_0x0353('0x12')](_0x1ac87f[_0x1b9347])&&_0x1ac87f[_0x1b9347][_0x0353('0x2d')]==='not_inuse'&&_0x1ac87f[_0x1b9347][_0x0353('0x5e')]==='reachable'){_0x4fe79c[_0x0353('0x5f')](_0x1ac87f[_0x1b9347]['id']);}}}return _0x4fe79c;};exports[_0x0353('0x60')]=function(_0x57a5c2){var _0x4e4974=moment()[_0x0353('0x61')](0x0);var _0x292203=moment(_0x57a5c2)[_0x0353('0x61')](0x0);return _0x4e4974[_0x0353('0x62')](_0x292203,_0x0353('0x63'));};exports[_0x0353('0x64')]=function(_0x378da4){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x378da4[_0x0353('0x18')],'ListId':_0x378da4[_0x0353('0x4f')],'VoiceQueueId':_0x378da4[_0x0353('0x19')]||undefined,'CampaignId':_0x378da4[_0x0353('0x65')]||undefined};};exports['filterKey']=function(_0x68b04e){if(_0x68b04e==='uniqueid'||_0x68b04e===_0x0353('0x66')||_0x68b04e===_0x0353('0x55')||_0x68b04e==='type'||_0x68b04e===_0x0353('0x67')||_0x68b04e===_0x0353('0x68')||_0x68b04e===_0x0353('0x36')||_0x68b04e===_0x0353('0x3e')||_0x68b04e===_0x0353('0x16')||_0x68b04e==='active'||_0x68b04e==='calleridnum'||_0x68b04e==='scheduledat'||_0x68b04e===_0x0353('0x69')||_0x68b04e===_0x0353('0x43')||_0x68b04e===_0x0353('0x44')||_0x68b04e===_0x0353('0x6a')||_0x68b04e===_0x0353('0x6b')||_0x68b04e===_0x0353('0x6c')||_0x68b04e===_0x0353('0x6d')||_0x68b04e==='recallme'||_0x68b04e===_0x0353('0x18')||_0x68b04e==='ListId'||_0x68b04e===_0x0353('0x37')||_0x68b04e==='VoiceQueueId'||_0x68b04e===_0x0353('0x6e')||_0x68b04e===_0x0353('0x6f')||_0x68b04e===_0x0353('0x70')||_0x68b04e===_0x0353('0x71')||_0x68b04e==='xmd-listid'||_0x68b04e===_0x0353('0x72')||_0x68b04e===_0x0353('0x73')||_0x68b04e===_0x0353('0x74')||_0x68b04e===_0x0353('0x75')||_0x68b04e===_0x0353('0x76')||_0x68b04e===_0x0353('0x77')||_0x68b04e===_0x0353('0x78')||_0x68b04e===_0x0353('0x79')||_0x68b04e===_0x0353('0x7a')||_0x68b04e==='xmd-agi'||_0x68b04e===_0x0353('0x7b')||_0x68b04e==='rtpaudioqosbridged'||_0x68b04e==='rtpaudioqosjitter'||_0x68b04e===_0x0353('0x7c')||_0x68b04e===_0x0353('0x7d')||_0x68b04e===_0x0353('0x7e')||_0x68b04e===_0x0353('0x7f')||_0x68b04e===_0x0353('0x80')||_0x68b04e===_0x0353('0x7b')||_0x68b04e==='rtpaudioqosbridged'||_0x68b04e==='rtpaudioqosjitter'||_0x68b04e===_0x0353('0x7c')||_0x68b04e===_0x0353('0x7d')||_0x68b04e===_0x0353('0x7e')||_0x68b04e===_0x0353('0x7f')||_0x68b04e==='rtpaudioqosrttbridged'||_0x68b04e===_0x0353('0x81')||_0x68b04e===_0x0353('0x82')||_0x68b04e===_0x0353('0x2d')||_0x68b04e==='statedesc'){return![];}return!![];};exports[_0x0353('0x83')]=function(_0x47d346,_0x567765){var _0x13d899,_0x12e1d0,_0x55a85d;if(_0x567765<=0x0){_0x567765=0x1;}_0x13d899=new RegExp(_0x0353('0x84')+_0x567765+'}$');_0x12e1d0=Math[_0x0353('0x85')](0xa,_0x567765-0x1);_0x55a85d=Math[_0x0353('0x85')](0xa,_0x567765)-0x1;return util[_0x0353('0xe')]('%s',_[_0x0353('0x86')](_0x47d346,_0x13d899,_[_0x0353('0x87')](_0x12e1d0,_0x55a85d)));};exports[_0x0353('0x88')]=function(_0x4a364f){var _0x2a8447=_0x4a364f['match'](/"(.*?)"/);return _0x2a8447?_0x2a8447[0x1]:_0x4a364f;};exports[_0x0353('0x89')]=function(_0x22083b){var _0x3c1186=_0x22083b[_0x0353('0x8a')](/<(.*?)>/);return _0x3c1186?_0x3c1186[0x1]:_0x22083b;};function buildNoAnswerEventPayload(_0x2f3a5e,_0x2920ab){var _0x280d73=buildObj(_0x2f3a5e,'noanswer');if(!_[_0x0353('0xd')](_0x2920ab[_0x0353('0x8b')])){Object[_0x0353('0x8c')](_0x2920ab['variables'])[_0x0353('0x8d')](function(_0xf92d3c){_0x280d73[_0xf92d3c['toLowerCase']()]=_0x2920ab[_0x0353('0x8b')][_0xf92d3c];});}return _0x280d73;}exports[_0x0353('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 24b2ba0..071601a 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 _0xebe6=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload','voicequeuechannel'];(function(_0x44138f,_0x4c5a10){var _0x1da9fb=function(_0x424306){while(--_0x424306){_0x44138f['push'](_0x44138f['shift']());}};_0x1da9fb(++_0x4c5a10);}(_0xebe6,0x17f));var _0x6ebe=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xebe6[_0x1f1a97];return _0x29fc6a;};'use strict';exports[_0x6ebe('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6ebe('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x6ebe('0x2'),'required':![]},'paused':{'type':_0x6ebe('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x6ebe('0x4')]={'interface':{'type':_0x6ebe('0x1'),'required':!![]},'paused':{'type':_0x6ebe('0x3')},'reason':{'type':'string','required':![]}};exports[_0x6ebe('0x5')]={'module':{'type':_0x6ebe('0x1'),'required':![]}};exports[_0x6ebe('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x6ebe('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x6ebe('0x1')},'format':{'type':_0x6ebe('0x1')},'mixmonitorid':{'type':_0x6ebe('0x1')}};exports[_0x6ebe('0x8')]={'uniqueid':{'type':_0x6ebe('0x1'),'required':!![]}};exports[_0x6ebe('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xfcda=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause','reload'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfcda,0x1c6));var _0xafcd=function(_0x22eee9,_0x4b23cb){_0x22eee9=_0x22eee9-0x0;var _0x5f5787=_0xfcda[_0x22eee9];return _0x5f5787;};'use strict';exports[_0xafcd('0x0')]={'queue':{'type':_0xafcd('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xafcd('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xafcd('0x2'),'required':![]}};exports[_0xafcd('0x3')]={'queue':{'type':_0xafcd('0x1'),'required':!![]},'interface':{'type':_0xafcd('0x1'),'required':!![]}};exports[_0xafcd('0x4')]={'interface':{'type':_0xafcd('0x1'),'required':!![]},'paused':{'type':_0xafcd('0x2')},'reason':{'type':'string','required':![]}};exports[_0xafcd('0x5')]={'module':{'type':_0xafcd('0x1'),'required':![]}};exports[_0xafcd('0x6')]={'uniqueid':{'type':_0xafcd('0x1'),'required':!![]}};exports[_0xafcd('0x7')]={'uniqueid':{'type':_0xafcd('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xafcd('0x1')},'mixmonitorid':{'type':_0xafcd('0x1')}};exports[_0xafcd('0x8')]={'uniqueid':{'type':_0xafcd('0x1'),'required':!![]}};exports[_0xafcd('0x9')]={'uniqueid':{'type':_0xafcd('0x1'),'required':!![]},'exten':{'type':_0xafcd('0x1'),'required':!![]},'context':{'type':_0xafcd('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a0cbb84..d29959e 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x471401,_0x2100c4){var _0x50db1c=function(_0x36eec8){while(--_0x36eec8){_0x471401['push'](_0x471401['shift']());}};_0x50db1c(++_0x2100c4);}(_0xdb28,0x106));var _0x8db2=function(_0x470271,_0x130801){_0x470271=_0x470271-0x0;var _0x25ceab=_0xdb28[_0x470271];return _0x25ceab;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x1b462c,_0x1b329e){var _0x3b6491=function(_0xa21f8e){while(--_0xa21f8e){_0x1b462c['push'](_0x1b462c['shift']());}};_0x3b6491(++_0x1b329e);}(_0xb10b,0x12a));var _0xbb10=function(_0x155af3,_0x4b7f9a){_0x155af3=_0x155af3-0x0;var _0x15a675=_0xb10b[_0x155af3];return _0x15a675;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 2606def..a47fa2f 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 _0x49c0=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x2769e9,_0x1b3f30){var _0x38dc96=function(_0x245354){while(--_0x245354){_0x2769e9['push'](_0x2769e9['shift']());}};_0x38dc96(++_0x1b3f30);}(_0x49c0,0x1ce));var _0x049c=function(_0x481ce9,_0x21d1ec){_0x481ce9=_0x481ce9-0x0;var _0x3c984e=_0x49c0[_0x481ce9];return _0x3c984e;};'use strict';function mergeDBDataToRealtime(_0x30b5df,_0x35692b){var _0x329a39=Object[_0x049c('0x0')]({},_0x30b5df);for(var _0x14f519 in _0x35692b){if(_0x329a39[_0x049c('0x1')](_0x14f519)){_0x329a39[_0x14f519]=_0x35692b[_0x14f519];}}return _0x329a39;}exports[_0x049c('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x6463=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x5047db,_0x3d9dd2){var _0x1d9be6=function(_0x2ebb0a){while(--_0x2ebb0a){_0x5047db['push'](_0x5047db['shift']());}};_0x1d9be6(++_0x3d9dd2);}(_0x6463,0x9b));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';function mergeDBDataToRealtime(_0x5dc7e0,_0x42e968){var _0x1b31d7=Object[_0x3646('0x0')]({},_0x5dc7e0);for(var _0x265833 in _0x42e968){if(_0x1b31d7[_0x3646('0x1')](_0x265833)){_0x1b31d7[_0x265833]=_0x42e968[_0x265833];}}return _0x1b31d7;}exports[_0x3646('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 0d274c4..699b527 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 _0xc3c4=['ANSWERED','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','monitor','monitors','monitorFilename','filename','connectedlinename','membername','originatecalleridnum','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','voiceDialReport','exports','moment','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','length','channel','split','outbound','internal','voiceCallReport','destination','exten','dialer','queue','context','from-voip-provider','callerid','calleridpreview','calleridnum','destinationchannel','disposition'];(function(_0x122afc,_0x2b77e8){var _0x2041d0=function(_0x21563c){while(--_0x21563c){_0x122afc['push'](_0x122afc['shift']());}};_0x2041d0(++_0x2b77e8);}(_0xc3c4,0x127));var _0x4c3c=function(_0x1ade14,_0x1087a3){_0x1ade14=_0x1ade14-0x0;var _0x272ae1=_0xc3c4[_0x1ade14];return _0x272ae1;};'use strict';var _=require('lodash');var moment=require(_0x4c3c('0x0'));var util=require('util');var config=require(_0x4c3c('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x4c3c('0x2'));var RpcVoiceCallReport=require(_0x4c3c('0x3'));var RpcVoiceDialReport=require(_0x4c3c('0x4'));var RpcMemberReport=require(_0x4c3c('0x5'));var RpcVoiceQueueReport=require(_0x4c3c('0x6'));var RpcVoiceRecording=require(_0x4c3c('0x7'));var RpcVoiceTransferReport=require(_0x4c3c('0x8'));var VoiceQueueReport=require(_0x4c3c('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x4c3c('0xa'));var UserReport=require(_0x4c3c('0xb'));function Report(_0x5770ad){this[_0x4c3c('0xc')]=_0x5770ad;this[_0x4c3c('0xd')]=_0x5770ad['agents'];this[_0x4c3c('0xe')]=_0x5770ad[_0x4c3c('0xe')];}Report[_0x4c3c('0xf')]['sync']=function(_0x2adc96){var _0x3f6367=new VoiceQueueReport(this['realtime']);var _0x1e05d1=new VoiceAgentReport(this['realtime']);var _0x3d1958=new VoiceDialReport(this[_0x4c3c('0xc')]);var _0x17626c=new VoiceCallReport(this[_0x4c3c('0xc')]);var _0x132550=new UserReport(this[_0x4c3c('0xc')]);if(config['xdr']&&config[_0x4c3c('0x10')][_0x4c3c('0x11')]){ami['on']('custom:voiceQueueReport',this[_0x4c3c('0x12')][_0x4c3c('0x13')](this));ami['on'](_0x4c3c('0x14'),this['voiceCallReport']['bind'](this));ami['on'](_0x4c3c('0x15'),this[_0x4c3c('0x16')]['bind'](this));ami['on'](_0x4c3c('0x17'),this['voiceDialReport'][_0x4c3c('0x13')](this));ami['on'](_0x4c3c('0x18'),this[_0x4c3c('0x19')][_0x4c3c('0x13')](this));ami['on'](_0x4c3c('0x1a'),this[_0x4c3c('0x1b')][_0x4c3c('0x13')](this));}};Report[_0x4c3c('0xf')][_0x4c3c('0x1c')]=function(_0x276405){var _0x4c6584;_0x4c6584=_[_0x4c3c('0x1d')](this['agents'],function(_0x3d3ffd){return _0x3d3ffd[_0x4c3c('0x1e')]==_0x276405||_0x3d3ffd[_0x4c3c('0x1f')]==_0x276405;});if(_[_0x4c3c('0x20')](_0x4c6584)){var _0x33830f=_[_0x4c3c('0x1d')](this[_0x4c3c('0xe')],function(_0x36f028){return _0x36f028['accountcode']==_0x276405||_0x36f028[_0x4c3c('0x1f')]==_0x276405;});if(_0x33830f){_0x4c6584=_[_0x4c3c('0x1d')](this[_0x4c3c('0xd')],function(_0x4a3736){return _0x4a3736[_0x4c3c('0x21')]==util['format'](_0x4c3c('0x22'),_0x33830f[_0x4c3c('0x1f')]);});}}return _0x4c6584;};Report['prototype'][_0x4c3c('0x12')]=function(_0x1da78b){for(var _0x1e61a6=0x0;_0x1e61a6<_0x1da78b['length'];_0x1e61a6+=0x1){var _0x4fae51=this[_0x4c3c('0x1c')](_0x1da78b[_0x1e61a6][_0x4c3c('0x23')]);if(_0x4fae51){_0x1da78b[_0x1e61a6][_0x4c3c('0x1e')]=_0x4fae51['accountcode'];_0x1da78b[_0x1e61a6][_0x4c3c('0x24')]=!![];_0x1da78b[_0x1e61a6][_0x4c3c('0x25')]=_0x4fae51[_0x4c3c('0x1f')];_0x1da78b[_0x1e61a6][_0x4c3c('0x21')]=_['isNil'](_0x4fae51[_0x4c3c('0x21')])?util[_0x4c3c('0x26')](_0x4c3c('0x22'),_0x4fae51[_0x4c3c('0x1f')]):_0x4fae51[_0x4c3c('0x21')];if(_0x1da78b[_0x1e61a6][_0x4c3c('0x27')]){_0x1da78b[_0x1e61a6][_0x4c3c('0x28')]=moment()[_0x4c3c('0x26')](_0x4c3c('0x29'));}if(_0x1da78b[_0x1e61a6][_0x4c3c('0x2a')]){_0x1da78b[_0x1e61a6][_0x4c3c('0x2b')]=moment()[_0x4c3c('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x4c3c('0x12')](_0x1da78b[_0x1e61a6]);}RpcVoiceQueueReport[_0x4c3c('0x2c')](_0x1da78b[_0x1e61a6]);}};function extractCalleridNumber(_0x4dbf0b){var _0x490de1=_0x4dbf0b[_0x4c3c('0x2d')](/<(.*?)>/);return _0x490de1?_0x490de1[0x1]:_0x4dbf0b;}Report[_0x4c3c('0xf')][_0x4c3c('0x2e')]=function(_0x4554f1){for(var _0x1315b6=0x0;_0x1315b6',_0x43fcad[_0x4c3c('0x42')],_0x43fcad[_0x4c3c('0x3e')]);}if(RpcVoiceTransferReport['transfers'][_0x43fcad[_0x4c3c('0x43')]]){var _0x54e331=RpcVoiceTransferReport[_0x4c3c('0x44')][_0x43fcad[_0x4c3c('0x43')]];_0x54e331[_0x4c3c('0x45')]=_0x43fcad[_0x4c3c('0x46')];RpcVoiceTransferReport[_0x4c3c('0x19')](_0x54e331);delete RpcVoiceTransferReport[_0x4c3c('0x44')][_0x43fcad[_0x4c3c('0x43')]];}if(_[_0x4c3c('0x20')](_0x43fcad[_0x4c3c('0x47')])){_0x43fcad[_0x4c3c('0x47')]=this['getCallType'](_0x43fcad);}if(_[_0x4c3c('0x20')](_0x43fcad[_0x4c3c('0x48')])){var _0x3ba966=_0x43fcad[_0x4c3c('0x31')][_0x4c3c('0x32')]('-')[0x0];var _0x5f3e39=this['agents'][_0x3ba966];if(!_0x5f3e39)_0x5f3e39=this[_0x4c3c('0x2e')](_0x43fcad['accountcode']);if(_0x5f3e39){_0x43fcad[_0x4c3c('0x48')]=_0x5f3e39['id'];_0x43fcad['membername']=_0x5f3e39['name'];}}RpcVoiceCallReport[_0x4c3c('0x2c')](_0x43fcad);if(_0x43fcad[_0x4c3c('0x49')]){for(var _0x45371a=0x0;_0x45371a<_0x43fcad[_0x4c3c('0x4a')][_0x4c3c('0x30')];_0x45371a+=0x1){_0x43fcad[_0x4c3c('0x4b')]=_0x43fcad[_0x4c3c('0x4a')][_0x45371a][_0x4c3c('0x4c')];_0x43fcad['createdAt']=_0x43fcad[_0x4c3c('0x4a')][_0x45371a]['createdAt'];if(_0x43fcad['exten']=='xcally-motion-preview'){_0x43fcad[_0x4c3c('0x3e')]=_0x43fcad[_0x4c3c('0x23')];_0x43fcad['calleridname']=_0x43fcad[_0x4c3c('0x4d')];_0x43fcad[_0x4c3c('0x23')]=_0x43fcad[_0x4c3c('0x1e')];_0x43fcad['connectedlinename']=_0x43fcad[_0x4c3c('0x4e')];_0x43fcad[_0x4c3c('0x37')]=_0x43fcad[_0x4c3c('0x4f')];}else if(_0x43fcad[_0x4c3c('0x37')]=='xcally-motion-dialer'){_0x43fcad[_0x4c3c('0x3e')]=_0x43fcad[_0x4c3c('0x36')];_0x43fcad['exten']=_0x43fcad[_0x4c3c('0x4f')];}RpcVoiceRecording[_0x4c3c('0x2c')](_0x43fcad);}}};Report[_0x4c3c('0xf')][_0x4c3c('0x16')]=function(_0x3ad65d){if(_[_0x4c3c('0x50')](_0x3ad65d)){_0x3ad65d[_0x4c3c('0x51')](function(_0x21a966){RpcVoiceAgentReport[_0x4c3c('0x2c')](_0x21a966);});}else{RpcVoiceAgentReport[_0x4c3c('0x2c')](_0x3ad65d);}};Report[_0x4c3c('0xf')]['voiceDialReport']=function(_0x5316c8){RpcVoiceDialReport[_0x4c3c('0x2c')](_0x5316c8);var _0xb1996b;var _0x31285f;var _0x11df9d=_0x5316c8[_0x4c3c('0x31')];if(_[_0x4c3c('0x52')](_0x11df9d,_0x4c3c('0x53'))){_0x31285f=_0x11df9d[_0x4c3c('0x54')](_0x11df9d['indexOf']('/')+0x1,_0x11df9d[_0x4c3c('0x55')]('@'));_0xb1996b=_[_0x4c3c('0x1d')](this[_0x4c3c('0xd')],function(_0x52eced){return _0x52eced[_0x4c3c('0x56')]==_0x31285f||_0x52eced['phone']==_0x31285f||_0x52eced['accountcode']==_0x31285f;});}else{_0x31285f=_0x11df9d[_0x4c3c('0x54')](_0x11df9d[_0x4c3c('0x55')]('/')+0x1,_0x11df9d[_0x4c3c('0x57')]('-'));_0xb1996b=this['findAgent'](_0x31285f);}if(_0xb1996b){_0x5316c8[_0x4c3c('0x21')]=_[_0x4c3c('0x20')](_0xb1996b[_0x4c3c('0x21')])?util[_0x4c3c('0x26')](_0x4c3c('0x22'),_0xb1996b['name']):_0xb1996b[_0x4c3c('0x21')];_0x5316c8['membername']=_0xb1996b[_0x4c3c('0x1f')];_0x5316c8[_0x4c3c('0x1e')]=_0xb1996b['accountcode'];RpcMemberReport[_0x4c3c('0x58')](_0x5316c8);}};Report['prototype'][_0x4c3c('0x19')]=function(_0x494200){RpcVoiceTransferReport[_0x4c3c('0x44')][_0x494200['transfererlinkedid']]=_0x494200;};Report[_0x4c3c('0xf')][_0x4c3c('0x1b')]=function(_0x47d1c2){RpcVoiceTransferReport[_0x4c3c('0x1b')](_0x47d1c2);};module[_0x4c3c('0x59')]=Report; \ No newline at end of file +var _0xd531=['Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','accountcode','find','telephones','name','format','SIP/%s','voiceQueueReport','length','findAgent','connectedlinenum','assigned','lastAssignedTo','isNil','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','prototype','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','dialer','lastapplication','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','type','UserId','membername','create','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith'];(function(_0x2db67f,_0x4513f2){var _0x582ef4=function(_0x17b5ea){while(--_0x17b5ea){_0x2db67f['push'](_0x2db67f['shift']());}};_0x582ef4(++_0x4513f2);}(_0xd531,0x129));var _0x1d53=function(_0x1c6869,_0x186f3e){_0x1c6869=_0x1c6869-0x0;var _0x5061fc=_0xd531[_0x1c6869];return _0x5061fc;};'use strict';var _=require('lodash');var moment=require(_0x1d53('0x0'));var util=require(_0x1d53('0x1'));var config=require(_0x1d53('0x2'));var ami=require(_0x1d53('0x3'));var RpcVoiceAgentReport=require(_0x1d53('0x4'));var RpcVoiceCallReport=require(_0x1d53('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x1d53('0x6'));var RpcVoiceQueueReport=require(_0x1d53('0x7'));var RpcVoiceRecording=require(_0x1d53('0x8'));var RpcVoiceTransferReport=require(_0x1d53('0x9'));var VoiceQueueReport=require(_0x1d53('0xa'));var VoiceCallReport=require(_0x1d53('0xb'));var VoiceAgentReport=require(_0x1d53('0xc'));var VoiceDialReport=require(_0x1d53('0xd'));var UserReport=require(_0x1d53('0xe'));function Report(_0x4dea56){this[_0x1d53('0xf')]=_0x4dea56;this[_0x1d53('0x10')]=_0x4dea56['agents'];this['telephones']=_0x4dea56['telephones'];}Report['prototype'][_0x1d53('0x11')]=function(_0x54fa94){var _0x412aa3=new VoiceQueueReport(this[_0x1d53('0xf')]);var _0x571e2b=new VoiceAgentReport(this[_0x1d53('0xf')]);var _0x178454=new VoiceDialReport(this['realtime']);var _0x4d8667=new VoiceCallReport(this[_0x1d53('0xf')]);var _0x4adc36=new UserReport(this[_0x1d53('0xf')]);if(config[_0x1d53('0x12')]&&config[_0x1d53('0x12')][_0x1d53('0x13')]){ami['on'](_0x1d53('0x14'),this['voiceQueueReport'][_0x1d53('0x15')](this));ami['on'](_0x1d53('0x16'),this[_0x1d53('0x17')]['bind'](this));ami['on'](_0x1d53('0x18'),this['voiceAgentReport'][_0x1d53('0x15')](this));ami['on'](_0x1d53('0x19'),this['voiceDialReport'][_0x1d53('0x15')](this));ami['on'](_0x1d53('0x1a'),this[_0x1d53('0x1b')][_0x1d53('0x15')](this));ami['on'](_0x1d53('0x1c'),this['attendedTransfer']['bind'](this));}};Report['prototype']['findAgent']=function(_0x2cf740){var _0x222c1d;_0x222c1d=_['find'](this['agents'],function(_0x522f1e){return _0x522f1e[_0x1d53('0x1d')]==_0x2cf740||_0x522f1e['name']==_0x2cf740;});if(_['isNil'](_0x222c1d)){var _0x36f37c=_[_0x1d53('0x1e')](this[_0x1d53('0x1f')],function(_0x2e5521){return _0x2e5521[_0x1d53('0x1d')]==_0x2cf740||_0x2e5521[_0x1d53('0x20')]==_0x2cf740;});if(_0x36f37c){_0x222c1d=_[_0x1d53('0x1e')](this[_0x1d53('0x10')],function(_0x2a42a3){return _0x2a42a3['interface']==util[_0x1d53('0x21')](_0x1d53('0x22'),_0x36f37c[_0x1d53('0x20')]);});}}return _0x222c1d;};Report['prototype'][_0x1d53('0x23')]=function(_0x580f65){for(var _0x280ff8=0x0;_0x280ff8<_0x580f65[_0x1d53('0x24')];_0x280ff8+=0x1){var _0x4ca8ed=this[_0x1d53('0x25')](_0x580f65[_0x280ff8][_0x1d53('0x26')]);if(_0x4ca8ed){_0x580f65[_0x280ff8][_0x1d53('0x1d')]=_0x4ca8ed[_0x1d53('0x1d')];_0x580f65[_0x280ff8][_0x1d53('0x27')]=!![];_0x580f65[_0x280ff8][_0x1d53('0x28')]=_0x4ca8ed[_0x1d53('0x20')];_0x580f65[_0x280ff8]['interface']=_[_0x1d53('0x29')](_0x4ca8ed[_0x1d53('0x2a')])?util[_0x1d53('0x21')](_0x1d53('0x22'),_0x4ca8ed['name']):_0x4ca8ed[_0x1d53('0x2a')];if(_0x580f65[_0x280ff8][_0x1d53('0x2b')]){_0x580f65[_0x280ff8][_0x1d53('0x2c')]=moment()['format'](_0x1d53('0x2d'));}if(_0x580f65[_0x280ff8][_0x1d53('0x2e')]){_0x580f65[_0x280ff8][_0x1d53('0x2f')]=moment()[_0x1d53('0x21')](_0x1d53('0x2d'));}RpcMemberReport[_0x1d53('0x23')](_0x580f65[_0x280ff8]);}RpcVoiceQueueReport['create'](_0x580f65[_0x280ff8]);}};function extractCalleridNumber(_0x7bc346){var _0xbd4a91=_0x7bc346[_0x1d53('0x30')](/<(.*?)>/);return _0xbd4a91?_0xbd4a91[0x1]:_0x7bc346;}Report[_0x1d53('0x31')][_0x1d53('0x32')]=function(_0x551aa2){for(var _0x5ee909=0x0;_0x5ee9090x0?!![]:![];if(!_0x343ccc){return this[_0x84e8('0x1a')](this['summary'][_0x84e8('0x6d')]);}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x1b')]=function(_0x2a90a4){var _0x39d8b3=this['summary']['id'];if(this['summary'][_0x84e8('0x62')][_0x39d8b3]&&this[_0x84e8('0x14')][_0x84e8('0x62')][_0x39d8b3][_0x2a90a4[_0x84e8('0x60')]]){this[_0x84e8('0x14')][_0x84e8('0x62')][_0x39d8b3][_0x2a90a4['actionid']][_0x84e8('0xf')][_0x84e8('0x6e')](_0x2a90a4);}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x17')]=function(_0x5f1f1f){var _0x1d8d77=this;try{if(this[_0x84e8('0x5c')](_0x5f1f1f)&&this[_0x84e8('0x5c')](_0x5f1f1f[_0x84e8('0x51')])){logger[_0x84e8('0x54')](_0x84e8('0x6f'),util[_0x84e8('0x45')](_0x5f1f1f,{'showHidden':![],'depth':null}));var _0x53de5e=this[_0x84e8('0x12')][_0x5f1f1f['queue']];if(_0x53de5e){logger[_0x84e8('0x54')](_0x84e8('0x70'),_0x53de5e['name']);this[_0x84e8('0x14')][_0x84e8('0x5d')][_0x53de5e[_0x84e8('0x5a')]]={'summaryEvent':_0x5f1f1f};this[_0x84e8('0x14')]['statusRequests']+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x53de5e[_0x84e8('0x5a')]})['then'](function(_0x162388){if(!_0x1d8d77[_0x84e8('0x14')][_0x84e8('0x62')][_0x5f1f1f[_0x84e8('0x60')]]){_0x1d8d77[_0x84e8('0x14')][_0x84e8('0x62')][_0x5f1f1f[_0x84e8('0x60')]]={};}_0x1d8d77[_0x84e8('0x14')][_0x84e8('0x62')][_0x5f1f1f[_0x84e8('0x60')]][_0x162388['actionid']]={'queue':_0x53de5e[_0x84e8('0x5a')],'agents':[]};})[_0x84e8('0x40')](function(_0x5ad166){throw _0x5ad166;});}}}catch(_0x57c0df){logger[_0x84e8('0x43')](_0x84e8('0x71'),util[_0x84e8('0x45')](_0x57c0df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x1a')]=function(_0xac430c){if(this[_0x84e8('0x14')][_0x84e8('0x6c')]>0x0){this[_0x84e8('0x14')][_0x84e8('0x6d')]=_0xac430c;return;}logger['debug'](_0x84e8('0x72'),util[_0x84e8('0x45')](_0xac430c,{'showHidden':![],'depth':null}));this[_0x84e8('0x14')]=initializeSummary();ami[_0x84e8('0x4b')](_0x84e8('0x73'),{});};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x1f')]=function(_0x17f488){try{if(this['isNotNull'](_0x17f488)){logger[_0x84e8('0x54')]('[%s][voiceQueueReport][queuecallerjoin]',_0x17f488[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x17f488,{'showHidden':![],'depth':null}));if(_[_0x84e8('0x74')](this[_0x84e8('0x46')][_0x17f488['uniqueid']])){this[_0x84e8('0x46')][_0x17f488[_0x84e8('0x4e')]]=[];}if(_['isUndefined'](this[_0x84e8('0x10')][_0x17f488['uniqueid']])){this['channels'][_0x17f488[_0x84e8('0x4e')]]={};}var _0xd8429c=new QueueReport();_0xd8429c[_0x84e8('0x51')]=_0x17f488[_0x84e8('0x51')];_0xd8429c[_0x84e8('0x6a')]=this['voiceQueues'][_0xd8429c[_0x84e8('0x51')]]&&this[_0x84e8('0x12')][_0xd8429c[_0x84e8('0x51')]]['type']?this[_0x84e8('0x12')][_0xd8429c[_0x84e8('0x51')]]['type']||_0x84e8('0x59'):_0x84e8('0x59');_0xd8429c[_0x84e8('0x75')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));_0xd8429c['position']=_0x17f488[_0x84e8('0x77')];_0xd8429c[_0x84e8('0x78')]=_0x17f488[_0x84e8('0x78')];_0xd8429c[_0x84e8('0x4e')]=_0x17f488[_0x84e8('0x4e')];_0xd8429c[_0x84e8('0x79')]=this[_0x84e8('0x10')][_0x17f488[_0x84e8('0x4e')]][_0x84e8('0x79')];logger[_0x84e8('0x7a')](_0x84e8('0x7b'),_0xd8429c[_0x84e8('0x51')],_0xd8429c[_0x84e8('0x6a')]);Object[_0x84e8('0x69')](_0xd8429c,_[_0x84e8('0x7c')](_0x17f488,_[_0x84e8('0x7d')](_0xd8429c)));this[_0x84e8('0x46')][_0x17f488[_0x84e8('0x4e')]][_0x84e8('0x6e')](_0xd8429c);this[_0x84e8('0x10')][_0x17f488[_0x84e8('0x4e')]]=_0xd8429c;this['emitVoiceQueueChannelSave'](_0xd8429c,_0x84e8('0x1e'));}}catch(_0x1f030f){logger[_0x84e8('0x43')](_0x84e8('0x7e'),_0x17f488[_0x84e8('0x4e')],util['inspect'](_0x1f030f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x21')]=function(_0x2c14be){try{if(this[_0x84e8('0x5c')](_0x2c14be)){logger[_0x84e8('0x54')](_0x84e8('0x7f'),_0x2c14be[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x2c14be,{'showHidden':![],'depth':null}));if(this[_0x84e8('0x46')][_0x2c14be[_0x84e8('0x4e')]]){var _0x568726=_[_0x84e8('0x80')](this['queueReports'][_0x2c14be[_0x84e8('0x4e')]]);_0x568726[_0x84e8('0x39')]=![];_0x568726[_0x84e8('0x81')]=null;_0x568726[_0x84e8('0x82')]=_0x2c14be[_0x84e8('0x82')];_0x568726[_0x84e8('0x83')]=_0x2c14be[_0x84e8('0x83')];_0x568726[_0x84e8('0x20')]=!![];_0x568726[_0x84e8('0x84')]=moment()[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x568726[_0x84e8('0x56')]=_0x84e8('0x85');_0x568726[_0x84e8('0x86')]=null;logger[_0x84e8('0x7a')](_0x84e8('0x87'),_0x568726[_0x84e8('0x51')],_0x568726[_0x84e8('0x6a')]);this[_0x84e8('0x10')][_0x2c14be[_0x84e8('0x4e')]]=_0x568726;this[_0x84e8('0x49')](_0x568726,_0x84e8('0x20'));}}}catch(_0x4cde98){logger['error'](_0x84e8('0x7f'),_0x2c14be['uniqueid'],util['inspect'](_0x4cde98,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x84e8('0x23')]=function(_0x38d5d8){try{if(this[_0x84e8('0x5c')](_0x38d5d8)){logger[_0x84e8('0x54')]('[%s][voiceQueueReport][queuecallerleave]',_0x38d5d8[_0x84e8('0x4e')],util['inspect'](_0x38d5d8,{'showHidden':![],'depth':null}));if(this[_0x84e8('0x46')][_0x38d5d8['uniqueid']]){var _0x1d75c3=_['last'](this[_0x84e8('0x46')][_0x38d5d8[_0x84e8('0x4e')]]);_0x1d75c3[_0x84e8('0x88')]=moment()[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d75c3['connectedlinenum']=_0x38d5d8[_0x84e8('0x89')];_0x1d75c3[_0x84e8('0x8a')]=_0x38d5d8[_0x84e8('0x8a')];logger[_0x84e8('0x7a')](_0x84e8('0x8b'),_0x1d75c3[_0x84e8('0x51')],_0x1d75c3['type'],_0x38d5d8[_0x84e8('0x89')],_0x38d5d8['connectedlinename']);this['channels'][_0x38d5d8['uniqueid']]=_0x1d75c3;this['emitVoiceQueueChannelSave'](_0x1d75c3,_0x84e8('0x22'));}}}catch(_0x384f51){logger[_0x84e8('0x43')](_0x84e8('0x8c'),_0x38d5d8[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x384f51,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x84e8('0x8d')]=function(_0x33dbbb){try{if(this[_0x84e8('0x5c')](_0x33dbbb)){logger[_0x84e8('0x54')]('[%s][voiceQueueReport][agentconnect]',_0x33dbbb['uniqueid'],util[_0x84e8('0x45')](_0x33dbbb,{'showHidden':![],'depth':null}));if(this[_0x84e8('0x46')][_0x33dbbb[_0x84e8('0x4e')]]){var _0x1ac939=_[_0x84e8('0x80')](this[_0x84e8('0x46')][_0x33dbbb[_0x84e8('0x4e')]]);_0x1ac939[_0x84e8('0x39')]=!![];_0x1ac939[_0x84e8('0x56')]=_0x84e8('0x8e');logger[_0x84e8('0x7a')](_0x84e8('0x8f'),_0x1ac939[_0x84e8('0x51')],_0x1ac939[_0x84e8('0x6a')]);}}}catch(_0x227801){logger[_0x84e8('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x33dbbb['uniqueid'],util[_0x84e8('0x45')](_0x227801,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x24')]=function(_0x509442){try{if(this['isNotNull'](_0x509442)){logger['debug'](_0x84e8('0x90'),_0x509442[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x509442,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x509442[_0x84e8('0x4e')]]){var _0x36dddf=_['last'](this[_0x84e8('0x46')][_0x509442[_0x84e8('0x4e')]]);_0x36dddf[_0x84e8('0x20')]=![];_0x36dddf['queuecallerabandonAt']=null;_0x36dddf[_0x84e8('0x91')]=!![];_0x36dddf[_0x84e8('0x86')]=_0x509442['membername'];_0x36dddf[_0x84e8('0x82')]=_0x509442[_0x84e8('0x82')];_0x36dddf[_0x84e8('0x39')]=!![];_0x36dddf['queuecallerexit']=![];_0x36dddf[_0x84e8('0x92')]=null;if(!_0x36dddf[_0x84e8('0x93')]){if(_0x509442[_0x84e8('0x94')]=='transfer'){_0x36dddf[_0x84e8('0x56')]=_0x84e8('0x95');logger[_0x84e8('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x36dddf[_0x84e8('0x51')],_0x36dddf[_0x84e8('0x6a')]);}else{if(_[_0x84e8('0x96')](_0x509442[_0x84e8('0x3f')][_0x84e8('0x97')](),_0x84e8('0x98'))){if(this[_0x84e8('0x46')][_0x509442[_0x84e8('0x99')]]){var _0x362bb8=_['last'](this['queueReports'][_0x509442['linkedid']]);_0x362bb8['queuecallercomplete']=![];_0x362bb8['queuecallerexit']=!![];_0x362bb8[_0x84e8('0x92')]=moment(_0x36dddf[_0x84e8('0x75')])['add'](_0x509442[_0x84e8('0x82')],'seconds')[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x362bb8['queuecallerexitreason']='FORWARDTRANSFER';_0x362bb8['transfer']=!![];_0x362bb8[_0x84e8('0x9a')]=_0x84e8('0x9b');_0x362bb8[_0x84e8('0x9c')]=_0x509442['destexten'];_0x362bb8['transferuniqueid']=_0x509442['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x362bb8[_0x84e8('0x51')],_0x362bb8['type']);var _0x4c9d01=this[_0x84e8('0x46')][_0x509442[_0x84e8('0x99')]];this[_0x84e8('0x46')][_0x509442['linkedid']]=this[_0x84e8('0x46')][_0x509442[_0x84e8('0x4e')]];this['queueReports'][_0x509442[_0x84e8('0x4e')]]=_0x4c9d01;}}else{_0x36dddf['queuecallerexitreason']='COMPLETEDBY'+_0x509442[_0x84e8('0x94')][_0x84e8('0x9d')]();logger['info'](_0x84e8('0x9e'),_0x36dddf[_0x84e8('0x51')],_0x36dddf[_0x84e8('0x6a')],_0x36dddf['queuecallerexitreason']);}}}this[_0x84e8('0x10')][_0x509442[_0x84e8('0x4e')]]=_0x36dddf;}}}catch(_0x207578){logger[_0x84e8('0x43')](_0x84e8('0x90'),_0x509442[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x207578,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x27')]=function(_0x4cf8a2){try{if(this[_0x84e8('0x5c')](_0x4cf8a2)){logger['debug'](_0x84e8('0x9f'),_0x4cf8a2[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x4cf8a2,{'showHidden':![],'depth':null}));this['addVariable'](_0x4cf8a2[_0x84e8('0x4e')],_[_0x84e8('0x7d')](_0x4cf8a2[_0x84e8('0xa0')])[0x0],_0x4cf8a2[_0x84e8('0xa1')]);if(this['queueReports'][_0x4cf8a2[_0x84e8('0x4e')]]){var _0x2dc783=_[_0x84e8('0x80')](this['queueReports'][_0x4cf8a2[_0x84e8('0x4e')]]);if(_0x2dc783){if(this[_0x84e8('0x5c')](_0x4cf8a2[_0x84e8('0xa0')])&&this[_0x84e8('0x5c')](_0x4cf8a2[_0x84e8('0xa0')][_0x84e8('0x62')])){switch(_0x4cf8a2[_0x84e8('0xa1')]){case _0x84e8('0xa2'):_0x2dc783[_0x84e8('0x38')]=![];_0x2dc783['queuecallerexitAt']=null;break;case'TIMEOUT':_0x2dc783['lastevent']=_0x84e8('0xa3');_0x2dc783[_0x84e8('0x38')]=!![];_0x2dc783[_0x84e8('0x92')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));_0x2dc783['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x84e8('0x54')](_0x84e8('0xa4'),_0x4cf8a2[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x2dc783,{'showHidden':![],'depth':null}));ami[_0x84e8('0x4b')](_0x84e8('0xa5'),_0x2dc783);break;default:_0x2dc783[_0x84e8('0x38')]=!![];_0x2dc783[_0x84e8('0x92')]=moment()[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dc783[_0x84e8('0x88')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));}_0x2dc783[_0x84e8('0x20')]=![];_0x2dc783[_0x84e8('0x84')]=null;_0x2dc783['queuecallerexitreason']=_0x4cf8a2[_0x84e8('0xa1')];this['channels'][_0x4cf8a2['uniqueid']]=_0x2dc783;this[_0x84e8('0x49')](_0x2dc783,_0x84e8('0x26'));}else if(this[_0x84e8('0x5c')](_0x4cf8a2['variable'])&&this[_0x84e8('0x5c')](_0x4cf8a2[_0x84e8('0xa0')][_0x84e8('0xa6')])){if(!_0x2dc783['queuecallerabandon']){_0x2dc783[_0x84e8('0x38')]=!![];_0x2dc783[_0x84e8('0x92')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));_0x2dc783[_0x84e8('0x56')]=_0x84e8('0xa7');_0x2dc783[_0x84e8('0x88')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));this[_0x84e8('0x10')][_0x4cf8a2[_0x84e8('0x4e')]]=_0x2dc783;}}logger['info'](_0x84e8('0xa8'),_0x4cf8a2[_0x84e8('0x4e')],_0x2dc783['queue'],_0x2dc783['type'],_[_0x84e8('0x7d')](_0x4cf8a2[_0x84e8('0xa0')])[0x0],_0x4cf8a2['value']);_0x2dc783['variables']=this[_0x84e8('0x15')][_0x4cf8a2['uniqueid']];}}}}catch(_0x1ac699){logger[_0x84e8('0x43')]('[%s][voiceQueueReport][varset]',_0x4cf8a2[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x1ac699,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x84e8('0xa9')]=function(_0x1255ac,_0x44775f,_0x3d690f){var _0x2f2d2a=['rtpaudioqos',_0x84e8('0xaa'),_0x84e8('0xab'),_0x84e8('0xac'),_0x84e8('0xad'),_0x84e8('0xae'),_0x84e8('0xaf'),_0x84e8('0xb0'),'sipcallid','sipuri',_0x84e8('0xb1'),'bridgepvtcallid',_0x84e8('0xb2'),_0x84e8('0xb3'),'memberinterface','memberlastcall',_0x84e8('0xb4'),_0x84e8('0xb5'),'memberrealtime'];if(!_[_0x84e8('0x3c')](_0x44775f)&&!_[_0x84e8('0xb6')](_0x2f2d2a,_0x44775f)){if(_[_0x84e8('0x74')](this[_0x84e8('0x15')][_0x1255ac])){this[_0x84e8('0x15')][_0x1255ac]={};}this[_0x84e8('0x15')][_0x1255ac][_0x44775f]=_0x3d690f;}};VoiceQueueReport[_0x84e8('0xb')]['handleHangup']=function(_0x575d9f,_0x161cd2,_0x214da7){var _0xe37c26={};for(var _0x592a61=0x0;_0x592a610x0?!![]:![];if(!_0x48a582){return this[_0x9c74('0x15')](this[_0x9c74('0x42')][_0x9c74('0x6a')]);}};VoiceQueueReport[_0x9c74('0x6')][_0x9c74('0x6b')]=function(_0x4789a0){var _0x3e63c5=this['summary']['id'];if(this['summary']['queuestatus'][_0x3e63c5]&&this['summary'][_0x9c74('0x5f')][_0x3e63c5][_0x4789a0[_0x9c74('0x5e')]]){this[_0x9c74('0x42')][_0x9c74('0x5f')][_0x3e63c5][_0x4789a0[_0x9c74('0x5e')]]['agents'][_0x9c74('0x6c')](_0x4789a0);}};VoiceQueueReport[_0x9c74('0x6')][_0x9c74('0x12')]=function(_0x512370){var _0x2def60=this;try{if(this[_0x9c74('0x57')](_0x512370)&&this[_0x9c74('0x57')](_0x512370['queue'])){logger[_0x9c74('0x46')](_0x9c74('0x6d'),util[_0x9c74('0x3e')](_0x512370,{'showHidden':![],'depth':null}));var _0x98cd57=this[_0x9c74('0xe')][_0x512370[_0x9c74('0x49')]];if(_0x98cd57){logger[_0x9c74('0x46')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x98cd57[_0x9c74('0x55')]);this[_0x9c74('0x42')][_0x9c74('0x5b')][_0x98cd57[_0x9c74('0x55')]]={'summaryEvent':_0x512370};this[_0x9c74('0x42')][_0x9c74('0x69')]+=0x1;return ami[_0x9c74('0x37')]({'action':_0x9c74('0x5f'),'queue':_0x98cd57[_0x9c74('0x55')]})['then'](function(_0x3264d1){if(!_0x2def60[_0x9c74('0x42')][_0x9c74('0x5f')][_0x512370[_0x9c74('0x5e')]]){_0x2def60[_0x9c74('0x42')][_0x9c74('0x5f')][_0x512370[_0x9c74('0x5e')]]={};}_0x2def60['summary'][_0x9c74('0x5f')][_0x512370[_0x9c74('0x5e')]][_0x3264d1['actionid']]={'queue':_0x98cd57[_0x9c74('0x55')],'agents':[]};})['catch'](function(_0x10de28){throw _0x10de28;});}}}catch(_0x2fb155){logger[_0x9c74('0x3a')](_0x9c74('0x61'),util[_0x9c74('0x3e')](_0x2fb155,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9c74('0x15')]=function(_0x32538c){if(this[_0x9c74('0x42')]['statusRequests']>0x0){this[_0x9c74('0x42')][_0x9c74('0x6a')]=_0x32538c;return;}logger[_0x9c74('0x46')](_0x9c74('0x6e'),util[_0x9c74('0x3e')](_0x32538c,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x9c74('0x6')][_0x9c74('0x6f')]=function(_0x2fa0dd){try{if(this[_0x9c74('0x57')](_0x2fa0dd)){logger[_0x9c74('0x46')](_0x9c74('0x70'),_0x2fa0dd[_0x9c74('0x4e')],util[_0x9c74('0x3e')](_0x2fa0dd,{'showHidden':![],'depth':null}));if(_[_0x9c74('0x58')](this[_0x9c74('0x3c')][_0x2fa0dd['uniqueid']])){this['queueReports'][_0x2fa0dd['uniqueid']]=[];}if(_[_0x9c74('0x58')](this['channels'][_0x2fa0dd['uniqueid']])){this[_0x9c74('0x35')][_0x2fa0dd[_0x9c74('0x4e')]]={};}var _0x30722a=new QueueReport();_0x30722a['queue']=_0x2fa0dd[_0x9c74('0x49')];_0x30722a[_0x9c74('0x66')]=this[_0x9c74('0xe')][_0x30722a[_0x9c74('0x49')]]&&this['voiceQueues'][_0x30722a[_0x9c74('0x49')]]['type']?this[_0x9c74('0xe')][_0x30722a[_0x9c74('0x49')]][_0x9c74('0x66')]||_0x9c74('0x54'):_0x9c74('0x54');_0x30722a[_0x9c74('0x71')]=moment()[_0x9c74('0x47')](_0x9c74('0x72'));_0x30722a[_0x9c74('0x73')]=_0x2fa0dd[_0x9c74('0x73')];_0x30722a[_0x9c74('0x74')]=_0x2fa0dd[_0x9c74('0x74')];_0x30722a['uniqueid']=_0x2fa0dd[_0x9c74('0x4e')];_0x30722a[_0x9c74('0x75')]=this[_0x9c74('0x35')][_0x2fa0dd[_0x9c74('0x4e')]][_0x9c74('0x75')];logger[_0x9c74('0x76')](_0x9c74('0x77'),_0x30722a[_0x9c74('0x49')],_0x30722a[_0x9c74('0x66')]);Object['assign'](_0x30722a,_[_0x9c74('0x78')](_0x2fa0dd,_[_0x9c74('0x79')](_0x30722a)));this['queueReports'][_0x2fa0dd[_0x9c74('0x4e')]][_0x9c74('0x6c')](_0x30722a);this[_0x9c74('0x35')][_0x2fa0dd[_0x9c74('0x4e')]]=_0x30722a;this['emitVoiceQueueChannelSave'](_0x30722a,'queuecallerjoin');}}catch(_0x553f2d){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x2fa0dd[_0x9c74('0x4e')],util[_0x9c74('0x3e')](_0x553f2d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9c74('0x1a')]=function(_0x483aa3){try{if(this[_0x9c74('0x57')](_0x483aa3)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x483aa3[_0x9c74('0x4e')],util[_0x9c74('0x3e')](_0x483aa3,{'showHidden':![],'depth':null}));if(this[_0x9c74('0x3c')][_0x483aa3[_0x9c74('0x4e')]]){var _0xca8af=_['last'](this[_0x9c74('0x3c')][_0x483aa3['uniqueid']]);_0xca8af[_0x9c74('0x34')]=![];_0xca8af['queuecallercompleteAt']=null;_0xca8af[_0x9c74('0x7a')]=_0x483aa3['holdtime'];_0xca8af['originalposition']=_0x483aa3[_0x9c74('0x7b')];_0xca8af[_0x9c74('0x33')]=!![];_0xca8af[_0x9c74('0x7c')]=moment()['format'](_0x9c74('0x72'));_0xca8af['queuecallerexitreason']=_0x9c74('0x7d');_0xca8af[_0x9c74('0x7e')]=null;logger[_0x9c74('0x76')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xca8af[_0x9c74('0x49')],_0xca8af[_0x9c74('0x66')]);this[_0x9c74('0x35')][_0x483aa3[_0x9c74('0x4e')]]=_0xca8af;this[_0x9c74('0x43')](_0xca8af,_0x9c74('0x33'));}}}catch(_0x183421){logger['error'](_0x9c74('0x7f'),_0x483aa3[_0x9c74('0x4e')],util[_0x9c74('0x3e')](_0x183421,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c74('0x6')][_0x9c74('0x1c')]=function(_0x401b17){try{if(this[_0x9c74('0x57')](_0x401b17)){logger['debug'](_0x9c74('0x80'),_0x401b17[_0x9c74('0x4e')],util['inspect'](_0x401b17,{'showHidden':![],'depth':null}));if(this[_0x9c74('0x3c')][_0x401b17[_0x9c74('0x4e')]]){var _0x28beac=_[_0x9c74('0x81')](this[_0x9c74('0x3c')][_0x401b17[_0x9c74('0x4e')]]);_0x28beac['queuecallerleaveAt']=moment()[_0x9c74('0x47')](_0x9c74('0x72'));_0x28beac[_0x9c74('0x82')]=_0x401b17['connectedlinenum'];_0x28beac[_0x9c74('0x83')]=_0x401b17[_0x9c74('0x83')];logger[_0x9c74('0x76')](_0x9c74('0x84'),_0x28beac[_0x9c74('0x49')],_0x28beac[_0x9c74('0x66')],_0x401b17['connectedlinenum'],_0x401b17[_0x9c74('0x83')]);this[_0x9c74('0x35')][_0x401b17[_0x9c74('0x4e')]]=_0x28beac;this[_0x9c74('0x45')](_0x28beac,_0x9c74('0x1b'));}}}catch(_0x38cde6){logger[_0x9c74('0x3a')](_0x9c74('0x80'),_0x401b17[_0x9c74('0x4e')],util['inspect'](_0x38cde6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c74('0x6')][_0x9c74('0x20')]=function(_0x20eb84){try{if(this[_0x9c74('0x57')](_0x20eb84)){logger[_0x9c74('0x46')](_0x9c74('0x85'),_0x20eb84[_0x9c74('0x4e')],util[_0x9c74('0x3e')](_0x20eb84,{'showHidden':![],'depth':null}));if(this[_0x9c74('0x3c')][_0x20eb84[_0x9c74('0x4e')]]){var _0x527b65=_[_0x9c74('0x81')](this[_0x9c74('0x3c')][_0x20eb84['uniqueid']]);_0x527b65[_0x9c74('0x34')]=!![];_0x527b65[_0x9c74('0x4f')]=_0x9c74('0x86');logger[_0x9c74('0x76')](_0x9c74('0x87'),_0x527b65[_0x9c74('0x49')],_0x527b65[_0x9c74('0x66')]);}}}catch(_0x549361){logger[_0x9c74('0x3a')](_0x9c74('0x85'),_0x20eb84[_0x9c74('0x4e')],util[_0x9c74('0x3e')](_0x549361,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9c74('0x1e')]=function(_0x16c8c8){try{if(this[_0x9c74('0x57')](_0x16c8c8)){logger[_0x9c74('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x16c8c8['uniqueid'],util[_0x9c74('0x3e')](_0x16c8c8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x16c8c8[_0x9c74('0x4e')]]){var _0x18c025=_[_0x9c74('0x81')](this[_0x9c74('0x3c')][_0x16c8c8[_0x9c74('0x4e')]]);_0x18c025[_0x9c74('0x33')]=![];_0x18c025[_0x9c74('0x7c')]=null;_0x18c025[_0x9c74('0x88')]=!![];_0x18c025[_0x9c74('0x7e')]=_0x16c8c8[_0x9c74('0x89')];_0x18c025[_0x9c74('0x7a')]=_0x16c8c8[_0x9c74('0x7a')];_0x18c025[_0x9c74('0x34')]=!![];_0x18c025[_0x9c74('0x8a')]=![];_0x18c025[_0x9c74('0x8b')]=null;if(!_0x18c025[_0x9c74('0x8c')]){if(_0x16c8c8['reason']=='transfer'){_0x18c025['queuecallerexitreason']=_0x9c74('0x8d');logger[_0x9c74('0x76')](_0x9c74('0x8e'),_0x18c025[_0x9c74('0x49')],_0x18c025['type']);}else{if(_[_0x9c74('0x8f')](_0x16c8c8[_0x9c74('0x39')][_0x9c74('0x90')](),_0x9c74('0x91'))){if(this[_0x9c74('0x3c')][_0x16c8c8['linkedid']]){var _0x275099=_['last'](this['queueReports'][_0x16c8c8[_0x9c74('0x92')]]);_0x275099[_0x9c74('0x34')]=![];_0x275099[_0x9c74('0x8a')]=!![];_0x275099['queuecallerexitAt']=moment(_0x18c025[_0x9c74('0x71')])[_0x9c74('0x93')](_0x16c8c8[_0x9c74('0x7a')],_0x9c74('0x94'))[_0x9c74('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x275099[_0x9c74('0x4f')]='FORWARDTRANSFER';_0x275099[_0x9c74('0x8c')]=!![];_0x275099['transfertype']=_0x9c74('0x95');_0x275099[_0x9c74('0x96')]=_0x16c8c8[_0x9c74('0x97')];_0x275099[_0x9c74('0x98')]=_0x16c8c8['uniqueid'];logger[_0x9c74('0x76')](_0x9c74('0x99'),_0x275099[_0x9c74('0x49')],_0x275099[_0x9c74('0x66')]);var _0x86f558=this[_0x9c74('0x3c')][_0x16c8c8[_0x9c74('0x92')]];this[_0x9c74('0x3c')][_0x16c8c8[_0x9c74('0x92')]]=this[_0x9c74('0x3c')][_0x16c8c8[_0x9c74('0x4e')]];this[_0x9c74('0x3c')][_0x16c8c8['uniqueid']]=_0x86f558;}}else{_0x18c025[_0x9c74('0x4f')]=_0x9c74('0x9a')+_0x16c8c8[_0x9c74('0x9b')]['toUpperCase']();logger[_0x9c74('0x76')](_0x9c74('0x9c'),_0x18c025[_0x9c74('0x49')],_0x18c025[_0x9c74('0x66')],_0x18c025['queuecallerexitreason']);}}}this[_0x9c74('0x35')][_0x16c8c8[_0x9c74('0x4e')]]=_0x18c025;}}}catch(_0x3f7221){logger[_0x9c74('0x3a')](_0x9c74('0x9d'),_0x16c8c8[_0x9c74('0x4e')],util['inspect'](_0x3f7221,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9c74('0x9e')]=function(_0x3a4a67){try{if(this[_0x9c74('0x57')](_0x3a4a67)){logger[_0x9c74('0x46')](_0x9c74('0x9f'),_0x3a4a67['uniqueid'],util[_0x9c74('0x3e')](_0x3a4a67,{'showHidden':![],'depth':null}));this['addVariable'](_0x3a4a67[_0x9c74('0x4e')],_['keys'](_0x3a4a67[_0x9c74('0xa0')])[0x0],_0x3a4a67['value']);if(this[_0x9c74('0x3c')][_0x3a4a67[_0x9c74('0x4e')]]){var _0x194f4d=_[_0x9c74('0x81')](this[_0x9c74('0x3c')][_0x3a4a67['uniqueid']]);if(_0x194f4d){if(this['isNotNull'](_0x3a4a67['variable'])&&this[_0x9c74('0x57')](_0x3a4a67[_0x9c74('0xa0')]['queuestatus'])){switch(_0x3a4a67[_0x9c74('0xa1')]){case _0x9c74('0xa2'):_0x194f4d[_0x9c74('0x8a')]=![];_0x194f4d[_0x9c74('0x8b')]=null;break;case _0x9c74('0xa3'):_0x194f4d[_0x9c74('0xa4')]='timeout';_0x194f4d[_0x9c74('0x8a')]=!![];_0x194f4d[_0x9c74('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x194f4d[_0x9c74('0xa5')]=moment()[_0x9c74('0x47')](_0x9c74('0x72'));logger[_0x9c74('0x46')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3a4a67[_0x9c74('0x4e')],util[_0x9c74('0x3e')](_0x194f4d,{'showHidden':![],'depth':null}));ami[_0x9c74('0x44')](_0x9c74('0xa6'),_0x194f4d);break;default:_0x194f4d[_0x9c74('0x8a')]=!![];_0x194f4d[_0x9c74('0x8b')]=moment()[_0x9c74('0x47')](_0x9c74('0x72'));_0x194f4d[_0x9c74('0xa5')]=moment()[_0x9c74('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x194f4d[_0x9c74('0x33')]=![];_0x194f4d[_0x9c74('0x7c')]=null;_0x194f4d[_0x9c74('0x4f')]=_0x3a4a67['value'];this[_0x9c74('0x35')][_0x3a4a67[_0x9c74('0x4e')]]=_0x194f4d;this['emitVoiceQueueChannelRemove'](_0x194f4d,'varset');}else if(this[_0x9c74('0x57')](_0x3a4a67['variable'])&&this['isNotNull'](_0x3a4a67[_0x9c74('0xa0')]['queueposition'])){if(!_0x194f4d[_0x9c74('0x33')]){_0x194f4d['queuecallerexit']=!![];_0x194f4d['queuecallerexitAt']=moment()['format'](_0x9c74('0x72'));_0x194f4d[_0x9c74('0x4f')]=_0x9c74('0xa7');_0x194f4d['queuecallerleaveAt']=moment()['format'](_0x9c74('0x72'));this[_0x9c74('0x35')][_0x3a4a67['uniqueid']]=_0x194f4d;}}logger[_0x9c74('0x76')](_0x9c74('0xa8'),_0x3a4a67['uniqueid'],_0x194f4d[_0x9c74('0x49')],_0x194f4d['type'],_['keys'](_0x3a4a67[_0x9c74('0xa0')])[0x0],_0x3a4a67[_0x9c74('0xa1')]);_0x194f4d['variables']=this[_0x9c74('0x10')][_0x3a4a67['uniqueid']];}}}}catch(_0x2dc1a0){logger[_0x9c74('0x3a')]('[%s][voiceQueueReport][varset]',_0x3a4a67[_0x9c74('0x4e')],util['inspect'](_0x2dc1a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c74('0x6')][_0x9c74('0xa9')]=function(_0x340cd1,_0x498883,_0x24f196){var _0x5bbaf2=[_0x9c74('0xaa'),'rtpaudioqosbridged',_0x9c74('0xab'),_0x9c74('0xac'),_0x9c74('0xad'),_0x9c74('0xae'),_0x9c74('0xaf'),_0x9c74('0xb0'),_0x9c74('0xb1'),_0x9c74('0xb2'),_0x9c74('0xb3'),'bridgepvtcallid','membercalls',_0x9c74('0xb4'),_0x9c74('0xb5'),_0x9c74('0xb6'),_0x9c74('0x89'),_0x9c74('0xb7'),_0x9c74('0xb8')];if(!_[_0x9c74('0xb9')](_0x498883)&&!_[_0x9c74('0xba')](_0x5bbaf2,_0x498883)){if(_[_0x9c74('0x58')](this[_0x9c74('0x10')][_0x340cd1])){this[_0x9c74('0x10')][_0x340cd1]={};}this[_0x9c74('0x10')][_0x340cd1][_0x498883]=_0x24f196;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x4736a3,_0xa2c4fa,_0x25bf7d){var _0xd646f1={};for(var _0x12c5d5=0x0;_0x12c5d5=0x0?moment(_0x4de954[_0x57cf('0x14')])[_0x57cf('0xc')](_0x4de954[_0x57cf('0x13')],_0x57cf('0x15')):null,'data1':_0x57cf('0x16'),'data2':_0x4de954['accountcode'],'data3':_0x4de954[_0x57cf('0x17')],'data4':_0x4de954[_0x57cf('0x18')]||null,'role':_0x57cf('0x19'),'internal':_0x4de954['accountcode']?_[_0x57cf('0xf')](_0x4de954[_0x57cf('0xe')]):undefined,'uniqueid':_0x4de954[_0x57cf('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x14a6=['interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','toNumber','accountcode','uniqueid','voiceDialReport','Request','CreateMemberReport','voice','membername','starttime','endtime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','lastAssignedTo','isNil'];(function(_0x237970,_0x3b7e6e){var _0x52d32b=function(_0x5de336){while(--_0x5de336){_0x237970['push'](_0x237970['shift']());}};_0x52d32b(++_0x3b7e6e);}(_0x14a6,0x124));var _0x614a=function(_0x397014,_0x17cc12){_0x397014=_0x397014-0x0;var _0x1163f7=_0x14a6[_0x397014];return _0x1163f7;};'use strict';var moment=require(_0x614a('0x0'));var _=require(_0x614a('0x1'));var util=require(_0x614a('0x2'));var client=require(_0x614a('0x3'));exports[_0x614a('0x4')]=function(_0x1d6d3a){var _0x24a354=_0x1d6d3a['queuecallercompleteAt']||_0x1d6d3a[_0x614a('0x5')];return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x1d6d3a[_0x614a('0x6')],'interface':_[_0x614a('0x7')](_0x1d6d3a[_0x614a('0x8')])?util[_0x614a('0x9')]('SIP/%s',_0x1d6d3a[_0x614a('0x6')]):_0x1d6d3a[_0x614a('0x8')],'type':_0x614a('0xa'),'enterAt':_0x1d6d3a[_0x614a('0xb')],'exitAt':_0x24a354,'duration':moment(_0x24a354)[_0x614a('0xc')](_0x1d6d3a[_0x614a('0xb')],_0x614a('0xd')),'data1':_0x614a('0xe'),'data2':_0x1d6d3a[_0x614a('0xf')],'data3':_0x1d6d3a[_0x614a('0x10')],'data4':null,'data5':_0x1d6d3a[_0x614a('0x11')],'role':'agent','internal':_0x1d6d3a['accountcode']?_[_0x614a('0x12')](_0x1d6d3a[_0x614a('0x13')]):undefined,'uniqueid':_0x1d6d3a[_0x614a('0x14')]},'log':'CreateMemberReport'});};exports[_0x614a('0x15')]=function(_0x15d082){return client[_0x614a('0x16')](_0x614a('0x17'),{'body':{'channel':_0x614a('0x18'),'membername':_0x15d082[_0x614a('0x19')],'interface':_0x15d082[_0x614a('0x8')],'type':_0x614a('0xa'),'enterAt':_0x15d082[_0x614a('0x1a')],'exitAt':_0x15d082[_0x614a('0x1b')],'duration':moment(_0x15d082[_0x614a('0x1b')])[_0x614a('0xc')](_0x15d082[_0x614a('0x1a')],_0x614a('0xd'))>=0x0?moment(_0x15d082[_0x614a('0x1b')])[_0x614a('0xc')](_0x15d082[_0x614a('0x1a')],_0x614a('0xd')):null,'data1':_0x614a('0x1c'),'data2':_0x15d082[_0x614a('0x13')],'data3':_0x15d082[_0x614a('0x10')],'data4':_0x15d082[_0x614a('0x1d')]||null,'role':'agent','internal':_0x15d082['accountcode']?_[_0x614a('0x12')](_0x15d082[_0x614a('0x13')]):undefined,'uniqueid':_0x15d082[_0x614a('0x14')]},'log':_0x614a('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 78178db..10b3114 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 _0x9f95=['GetSettings','../client','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x4d3964,_0x101871){var _0x114207=function(_0x3f7145){while(--_0x3f7145){_0x4d3964['push'](_0x4d3964['shift']());}};_0x114207(++_0x101871);}(_0x9f95,0x97));var _0x59f9=function(_0x1dfb4f,_0x550be0){_0x1dfb4f=_0x1dfb4f-0x0;var _0x547b48=_0x9f95[_0x1dfb4f];return _0x547b48;};'use strict';var client=require(_0x59f9('0x0'));exports['getSettings']=function(){return client[_0x59f9('0x1')](_0x59f9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x59f9('0x3'),_0x59f9('0x4')]},'log':_0x59f9('0x5')});}; \ No newline at end of file +var _0x1053=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x2e1437,_0x2b731e){var _0x2ca1f2=function(_0x2ad6f7){while(--_0x2ad6f7){_0x2e1437['push'](_0x2e1437['shift']());}};_0x2ca1f2(++_0x2b731e);}(_0x1053,0xd5));var _0x3105=function(_0x3bd7c5,_0x272ae9){_0x3bd7c5=_0x3bd7c5-0x0;var _0x423e00=_0x1053[_0x3bd7c5];return _0x423e00;};'use strict';var client=require(_0x3105('0x0'));exports[_0x3105('0x1')]=function(){return client[_0x3105('0x2')](_0x3105('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3105('0x4'),_0x3105('0x5')]},'log':_0x3105('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f859c96..940c21a 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 _0x5867=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x1e8f43,_0x326be9){var _0x267aaa=function(_0x9d95b6){while(--_0x9d95b6){_0x1e8f43['push'](_0x1e8f43['shift']());}};_0x267aaa(++_0x326be9);}(_0x5867,0x1e2));var _0x7586=function(_0x3f116e,_0x1e0387){_0x3f116e=_0x3f116e-0x0;var _0x15c8cb=_0x5867[_0x3f116e];return _0x15c8cb;};'use strict';var client=require(_0x7586('0x0'));exports[_0x7586('0x1')]=function(_0x183971){return function(_0x16e94b){return client[_0x7586('0x2')](_0x7586('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7586('0x4'),_0x7586('0x5')]},'log':_0x7586('0x3')});};}; \ No newline at end of file +var _0x802b=['Request','GetTemplate','name','getTemplates'];(function(_0x5b0f29,_0x3d6f36){var _0x27a26a=function(_0x4d44b3){while(--_0x4d44b3){_0x5b0f29['push'](_0x5b0f29['shift']());}};_0x27a26a(++_0x3d6f36);}(_0x802b,0x103));var _0xb802=function(_0x64b2e1,_0x4b12fe){_0x64b2e1=_0x64b2e1-0x0;var _0x1ca8cd=_0x802b[_0x64b2e1];return _0x1ca8cd;};'use strict';var client=require('../client');exports[_0xb802('0x0')]=function(_0x51d992){return function(_0x9035b5){return client[_0xb802('0x1')](_0xb802('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb802('0x3'),'html']},'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 9175ee5..dca4b41 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 _0x7dfb=['name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data1','data2','data3','data6','../client','Request'];(function(_0x461b1c,_0x36df75){var _0x15bef1=function(_0x2d702d){while(--_0x2d702d){_0x461b1c['push'](_0x461b1c['shift']());}};_0x15bef1(++_0x36df75);}(_0x7dfb,0xce));var _0xb7df=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x7dfb[_0x2b7764];return _0x848dcb;};'use strict';var client=require(_0xb7df('0x0'));exports['getTriggers']=function(_0x55f217){return function(_0x13d910){return client[_0xb7df('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xb7df('0x2'),_0xb7df('0x3'),'status'],'include':[{'model':_0xb7df('0x4'),'as':_0xb7df('0x5'),'attributes':['id',_0xb7df('0x6'),_0xb7df('0x7'),_0xb7df('0x8')]},{'model':'Condition','as':_0xb7df('0x9'),'attributes':['id',_0xb7df('0x6'),_0xb7df('0x7'),_0xb7df('0x8')]},{'model':_0xb7df('0xa'),'as':_0xb7df('0xb'),'attributes':['id','action',_0xb7df('0xc'),_0xb7df('0xd'),_0xb7df('0xe'),'data4','data5',_0xb7df('0xf'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xc63a=['action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','Action','Actions'];(function(_0x2423d7,_0xe6ec57){var _0x151d17=function(_0x559e15){while(--_0x559e15){_0x2423d7['push'](_0x2423d7['shift']());}};_0x151d17(++_0xe6ec57);}(_0xc63a,0xc5));var _0xac63=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc63a[_0x5a776b];return _0xbbef59;};'use strict';var client=require(_0xac63('0x0'));exports[_0xac63('0x1')]=function(_0x2a765d){return function(_0xb84fd9){return client[_0xac63('0x2')](_0xac63('0x3'),{'options':{'raw':![],'attributes':['id',_0xac63('0x4'),_0xac63('0x5'),'status'],'include':[{'model':_0xac63('0x6'),'as':_0xac63('0x7'),'attributes':['id',_0xac63('0x8'),_0xac63('0x9'),_0xac63('0xa')]},{'model':_0xac63('0x6'),'as':'AnyConditions','attributes':['id',_0xac63('0x8'),_0xac63('0x9'),_0xac63('0xa')]},{'model':_0xac63('0xb'),'as':_0xac63('0xc'),'attributes':['id',_0xac63('0xd'),_0xac63('0xe'),_0xac63('0xf'),_0xac63('0x10'),_0xac63('0x11'),_0xac63('0x12'),_0xac63('0x13'),_0xac63('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e6c0c1f..2e19e56 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 _0x23ea=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x41e25d,_0x13330d){var _0x504a53=function(_0x453db3){while(--_0x453db3){_0x41e25d['push'](_0x41e25d['shift']());}};_0x504a53(++_0x13330d);}(_0x23ea,0xc3));var _0xa23e=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0x23ea[_0x230e39];return _0xa804e;};'use strict';var client=require(_0xa23e('0x0'));exports[_0xa23e('0x1')]=function(_0xe039e){return function(_0x5ce01b){return client[_0xa23e('0x2')](_0xa23e('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa23e('0x4'),_0xa23e('0x5'),_0xa23e('0x6')]},'log':_0xa23e('0x3')});};}; \ No newline at end of file +var _0xc96c=['getTrunks','Request','GetTrunk','name','defaultuser'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xc96c,0x14a));var _0xcc96=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xc96c[_0xbbfe59];return _0x28a2a4;};'use strict';var client=require('../client');exports[_0xcc96('0x0')]=function(_0x5346ad){return function(_0x599d20){return client[_0xcc96('0x1')](_0xcc96('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcc96('0x3'),'registry',_0xcc96('0x4')]},'log':_0xcc96('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 0f09002..481b3f6 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x3c350a,_0x248c57){var _0x27b834=function(_0x584de4){while(--_0x584de4){_0x3c350a['push'](_0x3c350a['shift']());}};_0x27b834(++_0x248c57);}(_0xedd9,0xfc));var _0x9edd=function(_0x4fafd8,_0x2b2696){_0x4fafd8=_0x4fafd8-0x0;var _0x57fe38=_0xedd9[_0x4fafd8];return _0x57fe38;};'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 +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(_0x26daa9,_0xae834a){var _0x4b4eb4=function(_0x65887c){while(--_0x65887c){_0x26daa9['push'](_0x26daa9['shift']());}};_0x4b4eb4(++_0xae834a);}(_0xedd9,0xfc));var _0x9edd=function(_0x58b339,_0x6ff331){_0x58b339=_0x58b339-0x0;var _0x4c409a=_0xedd9[_0x58b339];return _0x4c409a;};'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 5c896a4..77a1446 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 _0xdaba=['UpdateVoiceAgentReport','../client','create','Request'];(function(_0x496bf7,_0xf6f25e){var _0x51f31d=function(_0x3ac735){while(--_0x3ac735){_0x496bf7['push'](_0x496bf7['shift']());}};_0x51f31d(++_0xf6f25e);}(_0xdaba,0x19d));var _0xadab=function(_0x49f48f,_0x5a1fcf){_0x49f48f=_0x49f48f-0x0;var _0x2a738f=_0xdaba[_0x49f48f];return _0x2a738f;};'use strict';var client=require(_0xadab('0x0'));exports[_0xadab('0x1')]=function(_0x10cd89){return client[_0xadab('0x2')]('CreateVoiceAgentReport',{'body':_0x10cd89,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x5873b8,_0x306eff,_0x26133a){return client[_0xadab('0x2')]('UpdateVoiceAgentReport',{'body':_0x5873b8,'options':{'where':{'uniqueid':_0x306eff,'interface':_0x26133a,'agentcomplete':!![]}},'log':_0xadab('0x3')});}; \ No newline at end of file +var _0x1af5=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x30b62f,_0x58e182){var _0x598984=function(_0x34dc76){while(--_0x34dc76){_0x30b62f['push'](_0x30b62f['shift']());}};_0x598984(++_0x58e182);}(_0x1af5,0x1dc));var _0x51af=function(_0x469a91,_0x31f432){_0x469a91=_0x469a91-0x0;var _0xa69a0d=_0x1af5[_0x469a91];return _0xa69a0d;};'use strict';var client=require(_0x51af('0x0'));exports[_0x51af('0x1')]=function(_0x5eb4f0){return client[_0x51af('0x2')]('CreateVoiceAgentReport',{'body':_0x5eb4f0,'log':_0x51af('0x3')});};exports[_0x51af('0x4')]=function(_0x59e46a,_0x5e1404,_0x18bb14){return client[_0x51af('0x2')](_0x51af('0x5'),{'body':_0x59e46a,'options':{'where':{'uniqueid':_0x5e1404,'interface':_0x18bb14,'agentcomplete':!![]}},'log':_0x51af('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b9a6818..2739d43 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 _0xf8bb=['CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','startOf','format','day','YYYY-MM-DD\x20HH:mm:ss','disposition','GetVoiceCallReports','moment','util','lodash','../client','create','Request'];(function(_0x394ab3,_0xd303d3){var _0x41ae0c=function(_0x3de1ba){while(--_0x3de1ba){_0x394ab3['push'](_0x394ab3['shift']());}};_0x41ae0c(++_0xd303d3);}(_0xf8bb,0x117));var _0xbf8b=function(_0x178f90,_0x459475){_0x178f90=_0x178f90-0x0;var _0x7c4ed4=_0xf8bb[_0x178f90];return _0x7c4ed4;};'use strict';var moment=require(_0xbf8b('0x0'));var util=require(_0xbf8b('0x1'));var _=require(_0xbf8b('0x2'));var client=require(_0xbf8b('0x3'));exports[_0xbf8b('0x4')]=function(_0xbd7322){return client[_0xbf8b('0x5')](_0xbf8b('0x6'),{'body':_[_0xbf8b('0x7')](_0xbd7322,{'source':_0xbd7322[_0xbf8b('0x8')],'destinationcontext':_0xbd7322[_0xbf8b('0x9')],'callerid':_0xbd7322[_0xbf8b('0xa')],'amaflags':'DOCUMENTATION'}),'log':_0xbf8b('0x6')});};exports[_0xbf8b('0xb')]=function(){return function(){return client[_0xbf8b('0x5')](_0xbf8b('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xbf8b('0xd')]('day')[_0xbf8b('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xbf8b('0xf'))[_0xbf8b('0xe')](_0xbf8b('0x10'))]}},'attributes':['type',_0xbf8b('0x11'),'duration','billableseconds']},'log':_0xbf8b('0x12')});};}; \ No newline at end of file +var _0x4b21=['../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x3ef5be,_0x2f15f1){var _0x239560=function(_0x58b9b2){while(--_0x58b9b2){_0x3ef5be['push'](_0x3ef5be['shift']());}};_0x239560(++_0x2f15f1);}(_0x4b21,0x15e));var _0x14b2=function(_0xffc5da,_0x41391c){_0xffc5da=_0xffc5da-0x0;var _0x527a04=_0x4b21[_0xffc5da];return _0x527a04;};'use strict';var moment=require(_0x14b2('0x0'));var util=require(_0x14b2('0x1'));var _=require('lodash');var client=require(_0x14b2('0x2'));exports[_0x14b2('0x3')]=function(_0xf76c0f){return client[_0x14b2('0x4')](_0x14b2('0x5'),{'body':_[_0x14b2('0x6')](_0xf76c0f,{'source':_0xf76c0f[_0x14b2('0x7')],'destinationcontext':_0xf76c0f[_0x14b2('0x8')],'callerid':_0xf76c0f[_0x14b2('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x14b2('0x5')});};exports[_0x14b2('0xa')]=function(){return function(){return client[_0x14b2('0x4')](_0x14b2('0xb'),{'options':{'where':{'type':[_0x14b2('0xc')],'createdAt':{'$between':[moment()[_0x14b2('0xd')](_0x14b2('0xe'))[_0x14b2('0xf')](_0x14b2('0x10')),moment()['endOf'](_0x14b2('0xe'))[_0x14b2('0xf')](_0x14b2('0x10'))]}},'attributes':[_0x14b2('0x11'),_0x14b2('0x12'),_0x14b2('0x13'),_0x14b2('0x14')]},'log':_0x14b2('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d6b9051..e08e557 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 _0x87c7=['../client','Request','CreateVoiceDialReport'];(function(_0x18d225,_0x57831e){var _0xade03c=function(_0x4b7eae){while(--_0x4b7eae){_0x18d225['push'](_0x18d225['shift']());}};_0xade03c(++_0x57831e);}(_0x87c7,0x162));var _0x787c=function(_0x18dd30,_0x32adf0){_0x18dd30=_0x18dd30-0x0;var _0x978d59=_0x87c7[_0x18dd30];return _0x978d59;};'use strict';var client=require(_0x787c('0x0'));exports['create']=function(_0x3e57ba){return client[_0x787c('0x1')](_0x787c('0x2'),{'body':_0x3e57ba,'log':_0x787c('0x2')});}; \ No newline at end of file +var _0xb695=['CreateVoiceDialReport','create','Request'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xb695,0x8e));var _0x5b69=function(_0x51f954,_0x5499cd){_0x51f954=_0x51f954-0x0;var _0x4cbd64=_0xb695[_0x51f954];return _0x4cbd64;};'use strict';var client=require('../client');exports[_0x5b69('0x0')]=function(_0x3991ca){return client[_0x5b69('0x1')](_0x5b69('0x2'),{'body':_0x3991ca,'log':_0x5b69('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 4f71bfc..03a073f 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 _0x153f=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x50c42c,_0x141ffe){var _0x1608f4=function(_0x4104c7){while(--_0x4104c7){_0x50c42c['push'](_0x50c42c['shift']());}};_0x1608f4(++_0x141ffe);}(_0x153f,0x15b));var _0xf153=function(_0x3466b8,_0x269581){_0x3466b8=_0x3466b8-0x0;var _0x4f80c9=_0x153f[_0x3466b8];return _0x4f80c9;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(){return function(){return client[_0xf153('0x2')](_0xf153('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf153('0x4'),_0xf153('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xf153('0x1')});};}; \ No newline at end of file +var _0xc368=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x5d57f3,_0x1227ba){var _0x2533a5=function(_0x5b84ba){while(--_0x5b84ba){_0x5d57f3['push'](_0x5d57f3['shift']());}};_0x2533a5(++_0x1227ba);}(_0xc368,0x7b));var _0x8c36=function(_0x11766a,_0x27624c){_0x11766a=_0x11766a-0x0;var _0x282a23=_0xc368[_0x11766a];return _0x282a23;};'use strict';var client=require('../client');exports[_0x8c36('0x0')]=function(){return function(){return client['Request'](_0x8c36('0x1'),{'options':{'raw':!![],'attributes':['id',_0x8c36('0x2'),_0x8c36('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x8c36('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d0aa6c3..9d29881 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 _0x91a2=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry'];(function(_0x4fd045,_0x15e4a5){var _0x5f5aa6=function(_0x5ac61b){while(--_0x5ac61b){_0x4fd045['push'](_0x4fd045['shift']());}};_0x5f5aa6(++_0x15e4a5);}(_0x91a2,0x1b4));var _0x291a=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x91a2[_0x10004e];return _0x5af990;};'use strict';var client=require(_0x291a('0x0'));exports[_0x291a('0x1')]=function(){return function(){return client[_0x291a('0x2')](_0x291a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x291a('0x4'),_0x291a('0x5'),_0x291a('0x6'),_0x291a('0x7'),_0x291a('0x8'),'dialActive',_0x291a('0x9'),_0x291a('0xa'),_0x291a('0xb'),_0x291a('0xc'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x291a('0xd'),_0x291a('0xe'),_0x291a('0xf'),_0x291a('0x10'),_0x291a('0x11'),'dialQueueProject',_0x291a('0x12'),'dialCongestionRetryFrequency',_0x291a('0x13'),_0x291a('0x14'),_0x291a('0x15'),_0x291a('0x16'),_0x291a('0x17'),_0x291a('0x18'),_0x291a('0x19'),_0x291a('0x1a'),'dialCheckDuplicateType',_0x291a('0x1b'),_0x291a('0x1c'),_0x291a('0x1d'),_0x291a('0x1e'),_0x291a('0x1f'),_0x291a('0x20'),_0x291a('0x21'),_0x291a('0x22'),_0x291a('0x23'),'dialAMDMaximumWordLength','timeout',_0x291a('0x24'),_0x291a('0x25'),_0x291a('0x26'),_0x291a('0x27'),_0x291a('0x28'),_0x291a('0x29'),_0x291a('0x7'),'strategy',_0x291a('0x2a'),_0x291a('0x2b'),_0x291a('0x2c'),'dialNoSuchNumberRetryFrequency',_0x291a('0x2d'),_0x291a('0x2e'),_0x291a('0x2f'),_0x291a('0x30'),_0x291a('0x31'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x291a('0x32'),_0x291a('0x33'),_0x291a('0x34'),_0x291a('0x35'),_0x291a('0x36')],'include':[{'model':_0x291a('0x37'),'as':'Trunk','attributes':['id',_0x291a('0x38'),_0x291a('0x39'),_0x291a('0x3a')]},{'model':_0x291a('0x3b'),'as':_0x291a('0x3c'),'attributes':['id',_0x291a('0x38')]},{'model':_0x291a('0x37'),'as':_0x291a('0x3d'),'attributes':['id',_0x291a('0x38'),'callerid',_0x291a('0x3a')]},{'model':_0x291a('0x3e'),'as':'Interval','attributes':['id',_0x291a('0x38')],'include':[{'model':_0x291a('0x3e'),'as':_0x291a('0x3f'),'attributes':['id',_0x291a('0x38'),_0x291a('0x40')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x198a=['dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x7f71fe,_0x26b69a){var _0x21b62e=function(_0x5a13bc){while(--_0x5a13bc){_0x7f71fe['push'](_0x7f71fe['shift']());}};_0x21b62e(++_0x26b69a);}(_0x198a,0xf4));var _0xa198=function(_0x511a21,_0x33bbb9){_0x511a21=_0x511a21-0x0;var _0x13bb5a=_0x198a[_0x511a21];return _0x13bb5a;};'use strict';var client=require(_0xa198('0x0'));exports[_0xa198('0x1')]=function(){return function(){return client[_0xa198('0x2')](_0xa198('0x3'),{'options':{'raw':![],'attributes':['id',_0xa198('0x4'),_0xa198('0x5'),'acwTimeout',_0xa198('0x6'),_0xa198('0x7'),'type',_0xa198('0x8'),_0xa198('0x9'),'dialLimitChannel',_0xa198('0xa'),_0xa198('0xb'),_0xa198('0xc'),_0xa198('0xd'),_0xa198('0xe'),'dialOriginateCallerIdName',_0xa198('0xf'),_0xa198('0x10'),'dialQueueOptions',_0xa198('0x11'),'dialQueueProject',_0xa198('0x12'),'dialCongestionRetryFrequency',_0xa198('0x13'),_0xa198('0x14'),'dialNoAnswerMaxRetry',_0xa198('0x15'),'dialGlobalMaxRetry',_0xa198('0x16'),_0xa198('0x17'),_0xa198('0x18'),_0xa198('0x19'),_0xa198('0x1a'),_0xa198('0x1b'),_0xa198('0x1c'),'dialAMDAfterGreetingSilence',_0xa198('0x1d'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xa198('0x1e'),_0xa198('0x1f'),_0xa198('0x20'),'dialRecallMeTimeout',_0xa198('0x21'),'dialOrderByScheduledAt',_0xa198('0x22'),_0xa198('0x23'),_0xa198('0x24'),_0xa198('0x7'),_0xa198('0x25'),_0xa198('0x26'),_0xa198('0x27'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xa198('0x28'),'dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0xa198('0x29'),_0xa198('0x2a'),_0xa198('0x2b'),'dialAgentRejectRetryFrequency',_0xa198('0x2c'),_0xa198('0x2d'),_0xa198('0x2e'),_0xa198('0x2f'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xa198('0x30'),'attributes':['id','name',_0xa198('0x31'),_0xa198('0x32')]},{'model':_0xa198('0x33'),'as':_0xa198('0x34'),'attributes':['id',_0xa198('0x4')]},{'model':_0xa198('0x30'),'as':_0xa198('0x35'),'attributes':['id','name','callerid','active']},{'model':_0xa198('0x36'),'as':'Interval','attributes':['id',_0xa198('0x4')],'include':[{'model':_0xa198('0x36'),'as':'Intervals','attributes':['id',_0xa198('0x4'),_0xa198('0x37')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 898482b..f11043c 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(_0x4177d6,_0x153f3a){var _0x11b9b6=function(_0x31733c){while(--_0x31733c){_0x4177d6['push'](_0x4177d6['shift']());}};_0x11b9b6(++_0x153f3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x53ce90,_0x160161){var _0x2d3947=function(_0x1c8940){while(--_0x1c8940){_0x53ce90['push'](_0x53ce90['shift']());}};_0x2d3947(++_0x160161);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 0a4615c..aafb4b3 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 _0x7289=['GetVoiceQueueRtPauses','Request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7289,0x147));var _0x9728=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7289[_0x1ac595];return _0x455fff;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x8b7d78){return function(){return client[_0x9728('0x0')](_0x9728('0x1'),{'options':{'where':{'VoiceQueueId':_0x8b7d78,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x1e94=['../client','getVoiceQueueRtPauses'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x1e94,0xda));var _0x41e9=function(_0x375120,_0x3562af){_0x375120=_0x375120-0x0;var _0x1c426e=_0x1e94[_0x375120];return _0x1c426e;};'use strict';var client=require(_0x41e9('0x0'));exports[_0x41e9('0x1')]=function(_0x5b2d18){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5b2d18,'paused':!![]},'raw':!![]},'log':_0x41e9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b592ff5..6e0f539 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(_0x5632a7,_0x38cc10){var _0x2e2ff0=function(_0x11ffd5){while(--_0x11ffd5){_0x5632a7['push'](_0x5632a7['shift']());}};_0x2e2ff0(++_0x38cc10);}(_0x7a54,0x106));var _0x47a5=function(_0x21efe0,_0x489823){_0x21efe0=_0x21efe0-0x0;var _0x5db7d8=_0x7a54[_0x21efe0];return _0x5db7d8;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5756a3,_0x2f2a8a){var _0x325ae4=function(_0x51ed4a){while(--_0x51ed4a){_0x5756a3['push'](_0x5756a3['shift']());}};_0x325ae4(++_0x2f2a8a);}(_0x7a54,0x106));var _0x47a5=function(_0x540c32,_0x742b14){_0x540c32=_0x540c32-0x0;var _0x1c5d0b=_0x7a54[_0x540c32];return _0x1c5d0b;};'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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e1a660f..728af70 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 _0x8f70=['transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','blindTransfer','Request','result','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename'];(function(_0x548205,_0x5b811b){var _0x292d1e=function(_0x16c94b){while(--_0x16c94b){_0x548205['push'](_0x548205['shift']());}};_0x292d1e(++_0x5b811b);}(_0x8f70,0xb2));var _0x08f7=function(_0x581227,_0x3a1055){_0x581227=_0x581227-0x0;var _0xd2932d=_0x8f70[_0x581227];return _0xd2932d;};'use strict';var client=require(_0x08f7('0x0'));exports['transfers']={};exports[_0x08f7('0x1')]=function(_0x82b1fe){return client[_0x08f7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x82b1fe[_0x08f7('0x3')],'transfererchannel':_0x82b1fe['transfererchannel'],'transferercalleridnum':_0x82b1fe[_0x08f7('0x4')],'transferercalleridname':_0x82b1fe['transferercalleridname'],'transfererconnectedlinenum':_0x82b1fe[_0x08f7('0x5')],'transfererconnectedlinename':_0x82b1fe[_0x08f7('0x6')],'transfereraccountcode':_0x82b1fe[_0x08f7('0x7')],'transferercontext':_0x82b1fe[_0x08f7('0x8')],'transfererexten':_0x82b1fe[_0x08f7('0x9')],'transfererlinkedid':_0x82b1fe[_0x08f7('0xa')],'transfereechannel':_0x82b1fe[_0x08f7('0xb')],'transfereecalleridnum':_0x82b1fe[_0x08f7('0xc')],'transfereecalleridname':_0x82b1fe[_0x08f7('0xd')],'transfereeconnectedlinenum':_0x82b1fe[_0x08f7('0xe')],'transfereeconnectedlinename':_0x82b1fe[_0x08f7('0xf')],'transfereeaccountcode':_0x82b1fe[_0x08f7('0x10')],'transfereecontext':_0x82b1fe[_0x08f7('0x11')],'transfereeexten':_0x82b1fe['transfereeexten'],'transfereelinkedid':_0x82b1fe['transfereelinkedid'],'isexternal':_0x82b1fe['isexternal'],'context':_0x82b1fe[_0x08f7('0x12')],'extension':_0x82b1fe[_0x08f7('0x13')],'type':_0x08f7('0x14')},'log':_0x08f7('0x15')});};exports[_0x08f7('0x16')]=function(_0x3bf559){return client[_0x08f7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3bf559[_0x08f7('0x3')],'transfererchannel':_0x3bf559[_0x08f7('0x17')],'transferercalleridnum':_0x3bf559[_0x08f7('0x18')],'transferercalleridname':_0x3bf559[_0x08f7('0x19')],'transfererconnectedlinenum':_0x3bf559[_0x08f7('0x1a')],'transfererconnectedlinename':_0x3bf559[_0x08f7('0x1b')],'transfereraccountcode':_0x3bf559[_0x08f7('0x1c')],'transferercontext':_0x3bf559['secondtransferercontext'],'transfererexten':_0x3bf559['secondtransfererexten'],'transfererlinkedid':_0x3bf559[_0x08f7('0x1d')],'transfereechannel':_0x3bf559[_0x08f7('0x1e')],'transfereecalleridnum':_0x3bf559['transfertargetcalleridnum'],'transfereecalleridname':_0x3bf559['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3bf559['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3bf559['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3bf559[_0x08f7('0x1f')],'transfereecontext':_0x3bf559[_0x08f7('0x20')],'transfereeexten':_0x3bf559['transfertargetexten'],'transfereelinkedid':_0x3bf559[_0x08f7('0x21')],'isexternal':_0x3bf559[_0x08f7('0x22')],'context':_0x3bf559[_0x08f7('0x23')],'extension':_0x3bf559['origtransfererexten'],'type':_0x08f7('0x24')},'log':_0x08f7('0x15')});}; \ No newline at end of file +var _0x5e5e=['result','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x1829e5,_0x186272){var _0xff81b9=function(_0x27717c){while(--_0x27717c){_0x1829e5['push'](_0x1829e5['shift']());}};_0xff81b9(++_0x186272);}(_0x5e5e,0x18b));var _0xe5e5=function(_0x474d13,_0x5a4e89){_0x474d13=_0x474d13-0x0;var _0x2353b7=_0x5e5e[_0x474d13];return _0x2353b7;};'use strict';var client=require(_0xe5e5('0x0'));exports[_0xe5e5('0x1')]={};exports[_0xe5e5('0x2')]=function(_0x153bee){return client[_0xe5e5('0x3')](_0xe5e5('0x4'),{'body':{'result':_0x153bee[_0xe5e5('0x5')],'transfererchannel':_0x153bee['transfererchannel'],'transferercalleridnum':_0x153bee[_0xe5e5('0x6')],'transferercalleridname':_0x153bee[_0xe5e5('0x7')],'transfererconnectedlinenum':_0x153bee['transfererconnectedlinenum'],'transfererconnectedlinename':_0x153bee[_0xe5e5('0x8')],'transfereraccountcode':_0x153bee['transfereraccountcode'],'transferercontext':_0x153bee[_0xe5e5('0x9')],'transfererexten':_0x153bee[_0xe5e5('0xa')],'transfererlinkedid':_0x153bee[_0xe5e5('0xb')],'transfereechannel':_0x153bee[_0xe5e5('0xc')],'transfereecalleridnum':_0x153bee[_0xe5e5('0xd')],'transfereecalleridname':_0x153bee[_0xe5e5('0xe')],'transfereeconnectedlinenum':_0x153bee[_0xe5e5('0xf')],'transfereeconnectedlinename':_0x153bee[_0xe5e5('0x10')],'transfereeaccountcode':_0x153bee['transfereeaccountcode'],'transfereecontext':_0x153bee[_0xe5e5('0x11')],'transfereeexten':_0x153bee[_0xe5e5('0x12')],'transfereelinkedid':_0x153bee[_0xe5e5('0x13')],'isexternal':_0x153bee[_0xe5e5('0x14')],'context':_0x153bee['context'],'extension':_0x153bee[_0xe5e5('0x15')],'type':_0xe5e5('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x53c178){return client[_0xe5e5('0x3')](_0xe5e5('0x4'),{'body':{'result':_0x53c178[_0xe5e5('0x5')],'transfererchannel':_0x53c178[_0xe5e5('0x17')],'transferercalleridnum':_0x53c178[_0xe5e5('0x18')],'transferercalleridname':_0x53c178[_0xe5e5('0x19')],'transfererconnectedlinenum':_0x53c178['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x53c178[_0xe5e5('0x1a')],'transfereraccountcode':_0x53c178[_0xe5e5('0x1b')],'transferercontext':_0x53c178[_0xe5e5('0x1c')],'transfererexten':_0x53c178[_0xe5e5('0x1d')],'transfererlinkedid':_0x53c178[_0xe5e5('0x1e')],'transfereechannel':_0x53c178[_0xe5e5('0x1f')],'transfereecalleridnum':_0x53c178['transfertargetcalleridnum'],'transfereecalleridname':_0x53c178[_0xe5e5('0x20')],'transfereeconnectedlinenum':_0x53c178[_0xe5e5('0x21')],'transfereeconnectedlinename':_0x53c178['transfertargetconnectedlinename'],'transfereeaccountcode':_0x53c178[_0xe5e5('0x22')],'transfereecontext':_0x53c178[_0xe5e5('0x23')],'transfereeexten':_0x53c178[_0xe5e5('0x24')],'transfereelinkedid':_0x53c178[_0xe5e5('0x25')],'isexternal':_0x53c178[_0xe5e5('0x14')],'context':_0x53c178['origtransferercontext'],'extension':_0x53c178[_0xe5e5('0x26')],'type':_0xe5e5('0x27')},'log':_0xe5e5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 817a04b..87063ab 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 _0x7217=['channels','uniqueid','channel','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','reload','module','action','Reload','then','message','join','pick','Action','content','catch','voiceQueues','hasOwnProperty','length','find','omit','undefined','voicechannel','map'];(function(_0x5be94d,_0x5ded24){var _0x35fbe2=function(_0x12b9b7){while(--_0x12b9b7){_0x5be94d['push'](_0x5be94d['shift']());}};_0x35fbe2(++_0x5ded24);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var jayson=require(_0x7721('0x1'));var schema=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var config=require(_0x7721('0x4'));var properties=require(_0x7721('0x5'));var ami=require('../ami');var VoiceQueueSummary=require('../model/voiceQueueSummary');exports[_0x7721('0x6')]=function(_0xce17f9,_0x46415c,_0x3fe47c){return new Promise(function(_0xb239e0,_0xf7ff37){var _0x18ab6b={'QueuePause':function(_0x21f680){return new Promise(function(_0x225610){var _0x2f99ed=util[_0x7721('0x7')](_0x7721('0x8'),_0x7721('0x9'),_0x21f680[_0x7721('0xa')]);if(_0xce17f9[_0x7721('0xb')]&&_0xce17f9['timers'][_0x2f99ed]&&_0xce17f9[_0x7721('0xb')][_0x2f99ed][_0x7721('0xc')]){_0xce17f9[_0x7721('0xb')][_0x2f99ed][_0x7721('0xd')]();}if(_0xce17f9[_0x7721('0xe')][_0x2f99ed]){_0xce17f9[_0x7721('0xe')][_0x2f99ed][_0x7721('0xf')]({'statePause':_0x21f680[_0x7721('0x10')]?!![]:![]});}_0x225610({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x2911ec){var _0x199930=this;return new Promise(function(_0x57ff6d,_0x109900){if(ami[_0x7721('0x11')]()==![]){return _0x109900(_0x199930[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config['asterisk'][_0x7721('0x14')],_0x7721('0x15')]['join']('\x20')));}_0x2911ec=_['pick'](_0x2911ec,_['keys'](properties[_0x7721('0x16')][_0x7721('0x17')]));_0x2911ec[_0x7721('0x18')]=_0x7721('0x19');return ami['Action'](_0x2911ec)[_0x7721('0x1a')](function(_0x54a838){_0x57ff6d({'code':0xc8,'message':_0x54a838[_0x7721('0x1b')]});})['catch'](function(_0xfec626){_0x109900(_0x199930[_0x7721('0x12')](0x1f5,_0xfec626[_0x7721('0x1b')]));});});},'Command':function(_0x3e140d){var _0x2286e5=this;return new Promise(function(_0x40af90,_0x402820){if(ami[_0x7721('0x11')]()==![]){return _0x402820(_0x2286e5[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config['asterisk'][_0x7721('0x14')],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}_0x3e140d=_[_0x7721('0x1d')](_0x3e140d,'command');_0x3e140d[_0x7721('0x18')]='Command';return ami[_0x7721('0x1e')](_0x3e140d)[_0x7721('0x1a')](function(_0x3e8a4e){_0x40af90({'code':0xc8,'message':_0x3e8a4e[_0x7721('0x1f')]});})[_0x7721('0x20')](function(_0x395b15){_0x402820(_0x2286e5[_0x7721('0x12')](0x1f5,_0x395b15['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x216f20){var _0x1abedb=[];for(var _0x125564 in _0xce17f9[_0x7721('0x21')]){if(_0xce17f9[_0x7721('0x21')][_0x7721('0x22')](_0x125564)){var _0x424e05=_0xce17f9[_0x7721('0x21')][_0x125564];var _0x40f367=new VoiceQueueSummary(_0x424e05);_0x1abedb['push'](_0x40f367);}}_0x216f20({'count':_0x1abedb[_0x7721('0x23')],'rows':_0x1abedb});});},'UpdateVoiceQueue':function(_0x5b0551){return new Promise(function(_0x499b87,_0x315202){var _0x343c19=_[_0x7721('0x24')](_0xce17f9[_0x7721('0x21')],{'id':parseInt(_0x5b0551['id'])});var _0x1ea4d=_[_0x7721('0x25')](_0x5b0551,['id']);if(_0x343c19){for(var _0xd7d703 in _0x1ea4d){if(typeof _0x1ea4d[_0xd7d703]!==_0x7721('0x26')&&typeof _0x343c19[_0xd7d703]!=='undefined'){_0x343c19[_0xd7d703]=_0x1ea4d[_0xd7d703];}}_0x499b87(_0x343c19);}else{_0x315202();}});},'VoiceChannels':function(){return new Promise(function(_0x471651){var _0x2871c5=_['values'](_0xce17f9['channels']);_0x471651({'count':_0x2871c5[_0x7721('0x23')],'rows':_0x2871c5});});},'VoiceChannelMixMonitor':function(_0x220bbf){var _0x48f329=this;return new Promise(function(_0x46f772,_0x4651b5){if(ami[_0x7721('0x11')]()==![]){return _0x4651b5(_0x48f329['error'](0x1f4,[config[_0x7721('0x13')]['ip'],config[_0x7721('0x13')][_0x7721('0x14')],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}var _0x508202=schema(properties[_0x7721('0x27')])[_0x7721('0x2')](_0x220bbf);if(_0x508202[_0x7721('0x23')]>0x0){return _0x4651b5(_0x48f329['error'](0x1f4,_[_0x7721('0x28')](_0x508202,_0x7721('0x1b'))['join'](',\x20')));}var _0x217592=_['find'](_0xce17f9[_0x7721('0x29')],{'uniqueid':_0x220bbf[_0x7721('0x2a')]});if(_0x217592&&_0x217592[_0x7721('0x2b')]){var _0x1d894b=util[_0x7721('0x7')](_0x7721('0x2c'),_0x220bbf[_0x7721('0x2d')]||_0x220bbf[_0x7721('0x2a')],_0x220bbf[_0x7721('0x7')]||_0x7721('0x2e'));return ami[_0x7721('0x1e')]({'action':'MixMonitor','channel':_0x217592[_0x7721('0x2b')],'file':_0x1d894b,'options':'ai(mixmonitorid)'})[_0x7721('0x1a')](function(_0x35614c){var _0x7942f7=_[_0x7721('0x24')](_0x217592[_0x7721('0x2f')],{'filename':_0x7721('0x30')+_0x1d894b['toLowerCase']()});if(_['isNil'](_0x7942f7)){_0x217592['monitors']['push']({'filename':_0x7721('0x30')+_0x1d894b[_0x7721('0x31')](),'createdAt':moment()[_0x7721('0x7')](_0x7721('0x32')),'mixmonitorid':_0x35614c['mixmonitorid'],'status':_0x7721('0x33')});}else{_0x7942f7['mixmonitorid']=_0x35614c[_0x7721('0x34')];_0x7942f7[_0x7721('0x35')]='rec';}_0x46f772({'code':0xc8,'message':[_0x220bbf[_0x7721('0x2a')],_0x7721('0x36'),_0x35614c['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x35614c[_0x7721('0x34')]});})[_0x7721('0x20')](function(_0xf3b5ca){_0x4651b5(_0x48f329[_0x7721('0x12')](0x1f5,[_0x220bbf['uniqueid'],_0xf3b5ca[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')));});}else{return _0x4651b5(_0x48f329[_0x7721('0x12')](0x1f5,_0x7721('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x52ab67){var _0x490d4=this;return new Promise(function(_0x4a2c28,_0xaa3216){if(ami['isConnected']()==![]){return _0xaa3216(_0x490d4[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config[_0x7721('0x13')]['username'],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}var _0x1ad315=schema(properties['voicechannel'])[_0x7721('0x2')](_0x52ab67);if(_0x1ad315[_0x7721('0x23')]>0x0){return _0xaa3216(_0x490d4[_0x7721('0x12')](0x1f4,_[_0x7721('0x28')](_0x1ad315,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x463ccc=_['find'](_0xce17f9['channels'],{'uniqueid':_0x52ab67[_0x7721('0x2a')]});if(_0x463ccc){return Promise[_0x7721('0x38')]()[_0x7721('0x1a')](function(){if(_0x463ccc[_0x7721('0x2b')]){return ami[_0x7721('0x1e')]({'action':_0x7721('0x39'),'channel':_0x463ccc[_0x7721('0x2b')],'mixmonitorid':_0x52ab67[_0x7721('0x34')]})[_0x7721('0x20')](function(){});}})[_0x7721('0x1a')](function(){if(_0x463ccc['destinationchannel']){return ami['Action']({'action':_0x7721('0x39'),'channel':_0x463ccc[_0x7721('0x3a')],'mixmonitorid':_0x52ab67[_0x7721('0x34')]})[_0x7721('0x20')](function(){});}})['then'](function(){var _0x30107e=_[_0x7721('0x24')](_0x463ccc['monitors'],{'mixmonitorid':_0x52ab67[_0x7721('0x34')]});if(_0x30107e){_0x30107e['status']=_0x7721('0x3b');}})['then'](function(){var _0x334f23=util[_0x7721('0x7')](_0x7721('0x2c'),_0x52ab67['filename']||_0x52ab67[_0x7721('0x2a')],_0x52ab67[_0x7721('0x7')]||'wav');var _0x223d93=_[_0x7721('0x24')](_0x463ccc[_0x7721('0x2f')],{'filename':'/var/spool/asterisk/monitor/'+_0x334f23[_0x7721('0x31')]()});if(_0x223d93){_0x223d93['status']=_0x7721('0x3b');}})[_0x7721('0x1a')](function(){_0x4a2c28({'code':0xc8,'message':[_0x52ab67[_0x7721('0x2a')],_0x7721('0x3c')][_0x7721('0x1c')]('\x20')});})[_0x7721('0x20')](function(_0x163a23){_0xaa3216(_0x490d4[_0x7721('0x12')](0x1f5,[_0x52ab67[_0x7721('0x2a')],_0x163a23[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')));});}else{return _0xaa3216(_0x490d4[_0x7721('0x12')](0x1f5,_0x7721('0x37')));}});},'VoiceQueuesChannels':function(_0x2cd678){var _0x5b741d=this;return new Promise(function(_0x474f32){var _0x2f6f30=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0x3e')]);var _0x1f1ac7={'count':_0x2f6f30[_0x7721('0x23')],'rows':_0x2f6f30};if(_0x2cd678&&_0x2cd678[_0x7721('0x3f')]){if(!['inbound',_0x7721('0x40')][_0x7721('0x41')](_0x2cd678[_0x7721('0x3f')])){return _0xf7ff37(_0x5b741d[_0x7721('0x12')](0x190,_0x7721('0x42')));}var _0x9c0d4=_[_0x7721('0x43')](_0x2f6f30,function(_0x33287d){return _0x33287d[_0x7721('0x3f')]===_0x2cd678[_0x7721('0x3f')];});_0x1f1ac7[_0x7721('0x44')]=_0x9c0d4['length'];_0x1f1ac7[_0x7721('0x45')]=_0x9c0d4;}_0x474f32(_0x1f1ac7);});},'VoiceQueuesChannel':function(_0xadb365){var _0x1234bc=this;return new Promise(function(_0x2ee3c0,_0x15ed3b){var _0x3e7918=schema(properties[_0x7721('0x46')])[_0x7721('0x2')](_0xadb365);if(_0x3e7918[_0x7721('0x23')]>0x0){return _0x15ed3b(_0x1234bc[_0x7721('0x12')](0x1f4,_[_0x7721('0x28')](_0x3e7918,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x18f7f6=_[_0x7721('0x24')](_0xce17f9['queueChannels'],{'uniqueid':_0xadb365['uniqueid']});if(_0x18f7f6){_0x2ee3c0(_0x18f7f6);}else{return _0x15ed3b(_0x1234bc['error'](0x1f5,_0x7721('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x4f2fe6){var _0x4a46db=this;return new Promise(function(_0x57348c,_0x5d7036){if(ami[_0x7721('0x11')]()==![]){return _0x5d7036(_0x4a46db[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config['asterisk'][_0x7721('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x484b8e=schema(properties[_0x7721('0x47')])['validate'](_0x4f2fe6);if(_0x484b8e['length']>0x0){return _0x5d7036(_0x4a46db['error'](0x1f4,_[_0x7721('0x28')](_0x484b8e,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x4a94c8=_[_0x7721('0x24')](_0xce17f9[_0x7721('0x3e')],{'uniqueid':_0x4f2fe6[_0x7721('0x2a')]});if(_0x4a94c8&&_0x4a94c8[_0x7721('0x2b')]){return ami[_0x7721('0x1e')]({'action':_0x7721('0x48'),'channel':_0x4a94c8[_0x7721('0x2b')]})[_0x7721('0x1a')](function(_0x127f46){_0x57348c({'code':0xc8,'message':[_0x4f2fe6[_0x7721('0x2a')],_0x127f46[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')});})[_0x7721('0x20')](function(_0x44de7a){_0x5d7036(_0x4a46db['error'](0x1f5,[_0x4f2fe6[_0x7721('0x2a')],_0x44de7a[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')));});}else{return _0x5d7036(_0x4a46db['error'](0x1f5,_0x7721('0x37')));}});},'VoiceQueuesChannelRedirect':function(_0x104f05){var _0x4c8284=this;return new Promise(function(_0x3e7df3,_0x5d37ad){if(ami[_0x7721('0x11')]()==![]){return _0x5d37ad(_0x4c8284[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config[_0x7721('0x13')][_0x7721('0x14')],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}var _0x167ce7=schema(properties[_0x7721('0x49')])['validate'](_0x104f05);if(_0x167ce7[_0x7721('0x23')]>0x0){return _0x5d37ad(_0x4c8284[_0x7721('0x12')](0x1f4,_[_0x7721('0x28')](_0x167ce7,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x3ed425=_[_0x7721('0x24')](_0xce17f9['queueChannels'],{'uniqueid':_0x104f05[_0x7721('0x2a')]});if(_0x3ed425&&_0x3ed425[_0x7721('0x2b')]){return ami['Action']({'action':_0x7721('0x4a'),'channel':_0x3ed425['channel'],'exten':_0x104f05[_0x7721('0x4b')],'context':_0x104f05[_0x7721('0x4c')]||_0x3ed425[_0x7721('0x4c')],'priority':0x1})[_0x7721('0x1a')](function(_0x1e2436){_0x3e7df3({'code':0xc8,'message':[_0x104f05[_0x7721('0x2a')],_0x1e2436[_0x7721('0x1b')]['toLowerCase']()][_0x7721('0x1c')]('\x20')});})[_0x7721('0x20')](function(_0x280b1d){_0x5d37ad(_0x4c8284['error'](0x1f5,[_0x104f05['uniqueid'],_0x280b1d['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x5d37ad(_0x4c8284[_0x7721('0x12')](0x1f5,_0x7721('0x37')));}});},'Agents':function(_0x580473){return new Promise(function(_0x2d4b3a){var _0x42f6e9=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0xe')]);if(_0x580473&&_0x580473['id']){var _0x53ebb1=_[_0x7721('0x24')](_0x42f6e9,function(_0xfe9fb8){return _0xfe9fb8['id']===_0x580473['id'];});_0x2d4b3a(_0x53ebb1);}else{_0x2d4b3a({'count':_0x42f6e9[_0x7721('0x23')],'rows':_0x42f6e9});}});},'Telephones':function(){return new Promise(function(_0x1bea13){var _0x3cf3fd=_['values'](_0xce17f9[_0x7721('0x4d')]);_0x1bea13({'count':_0x3cf3fd[_0x7721('0x23')],'rows':_0x3cf3fd});});},'Trunks':function(){return new Promise(function(_0x180419){var _0x5f515e=_['values'](_0xce17f9[_0x7721('0x4e')]);_0x180419({'count':_0x5f515e[_0x7721('0x23')],'rows':_0x5f515e});});},'OutboundChannels':function(){return new Promise(function(_0x423040){var _0x42ca24=_[_0x7721('0x3d')](_0xce17f9['outboundChannels']);_0x423040({'count':_0x42ca24['length'],'rows':_0x42ca24});});},'Outbound':function(){return new Promise(function(_0x263070){_0x263070(_0xce17f9[_0x7721('0x40')]);});},'Campaigns':function(){return new Promise(function(_0x68de4){var _0x3c66b3=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0x4f')]);_0x68de4({'count':_0x3c66b3[_0x7721('0x23')],'rows':_0x3c66b3});});},'VoiceQueuesPreview':function(_0x58f944){var _0xdfae41=this;return new Promise(function(_0x413185,_0x27d7f1){_0x46415c['run'](_0x58f944['id'])[_0x7721('0x1a')](function(_0x1a53d6){_0x413185({'code':0xc8,'message':_0x1a53d6[_0x7721('0x1b')]});})[_0x7721('0x20')](function(_0x56af64){_0x27d7f1(_0xdfae41['error'](0x1f4,_0x56af64[_0x7721('0x1b')]));});});},'EventManager':function(_0x2cac50){var _0x177fe3=this;return new Promise(function(_0x42c849,_0x3605cb){if(!_0x2cac50[_0x7721('0x50')]){return _0x3605cb(_0x177fe3['error'](0x1f4,_0x7721('0x51')));}ami[_0x7721('0x52')](_0x7721('0x53')+_0x2cac50['event'],_0x2cac50[_0x7721('0x1b')]);_0x42c849({'code':0xc8,'message':_0x2cac50});});},'FaxAccounts':function(){return new Promise(function(_0x3b16f3){var _0xbad8c4=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0x54')]);_0x3b16f3({'count':_0xbad8c4['length'],'rows':_0xbad8c4});});},'SendFax':function(_0x9c05e4){var _0x59a91d=this;return new Promise(function(_0x12a3f7,_0x47764b){_0x3fe47c[_0x7721('0x55')](_0x9c05e4)[_0x7721('0x1a')](function(_0x963dbe){_0x12a3f7({'code':0xc8,'message':_0x963dbe[_0x7721('0x1b')]});})[_0x7721('0x20')](function(_0x123049){_0x47764b(_0x59a91d[_0x7721('0x12')](0x1f4,_0x123049[_0x7721('0x1b')]));});});},'CheckAfterSend':function(_0x2c74d8){var _0x55d209=this;return new Promise(function(_0x19fad6,_0x19f451){_0x3fe47c[_0x7721('0x56')](_0x2c74d8)['then'](function(_0x94af20){_0x19fad6({'code':0xc8,'message':_0x94af20[_0x7721('0x1b')]});})[_0x7721('0x20')](function(_0xc9761e){_0x19f451(_0x55d209[_0x7721('0x12')](0x1f4,_0xc9761e['message']));});});}};var _0x1276ce=jayson[_0x7721('0x57')](_0x18ab6b)[_0x7721('0x58')]();_0x1276ce['on'](_0x7721('0x12'),function(_0x30326d){return _0xf7ff37(_0x30326d);});_0x1276ce[_0x7721('0x6')](0x232a,'127.0.0.1',function(){console[_0x7721('0x59')](_0x7721('0x5a'),0x232a);return _0xb239e0('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xf072=['outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','send','checkAfterSend','server','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../properties','../ami','../model/voiceQueueSummary','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','catch','isConnected','command','Command','voiceQueues','push','length','find','omit','undefined','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','rec','mixmonitorid','status','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','queueChannels','inbound','outbound','filter','type','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks'];(function(_0x26447e,_0x2e9c94){var _0x38cc1a=function(_0x4f1170){while(--_0x4f1170){_0x26447e['push'](_0x26447e['shift']());}};_0x38cc1a(++_0x2e9c94);}(_0xf072,0x1cf));var _0x2f07=function(_0x31811c,_0x2b2669){_0x31811c=_0x31811c-0x0;var _0x7d13c1=_0xf072[_0x31811c];return _0x7d13c1;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var jayson=require(_0x2f07('0x2'));var schema=require('validate');var moment=require(_0x2f07('0x3'));var config=require('../../../config/environment');var properties=require(_0x2f07('0x4'));var ami=require(_0x2f07('0x5'));var VoiceQueueSummary=require(_0x2f07('0x6'));exports['listen']=function(_0x1d5a33,_0x14d6e6,_0x3643bb){return new Promise(function(_0x2e6422,_0x235418){var _0xf73d1a={'QueuePause':function(_0x33b99c){return new Promise(function(_0x379b2e){var _0x4746c2=util[_0x2f07('0x7')](_0x2f07('0x8'),_0x2f07('0x9'),_0x33b99c[_0x2f07('0xa')]);if(_0x1d5a33[_0x2f07('0xb')]&&_0x1d5a33[_0x2f07('0xb')][_0x4746c2]&&_0x1d5a33['timers'][_0x4746c2][_0x2f07('0xc')]){_0x1d5a33[_0x2f07('0xb')][_0x4746c2][_0x2f07('0xd')]();}if(_0x1d5a33[_0x2f07('0xe')][_0x4746c2]){_0x1d5a33['agents'][_0x4746c2]['updateStatusRealtime']({'statePause':_0x33b99c[_0x2f07('0xf')]?!![]:![]});}_0x379b2e({'code':0xc8,'message':_0x2f07('0x10')});});},'Reload':function(_0x58549c){var _0x6eb88a=this;return new Promise(function(_0x34dbd4,_0x26edfa){if(ami['isConnected']()==![]){return _0x26edfa(_0x6eb88a[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}_0x58549c=_['pick'](_0x58549c,_[_0x2f07('0x16')](properties['reload'][_0x2f07('0x17')]));_0x58549c[_0x2f07('0x18')]=_0x2f07('0x19');return ami[_0x2f07('0x1a')](_0x58549c)[_0x2f07('0x1b')](function(_0x46c9b4){_0x34dbd4({'code':0xc8,'message':_0x46c9b4[_0x2f07('0x1c')]});})[_0x2f07('0x1d')](function(_0x55bd60){_0x26edfa(_0x6eb88a[_0x2f07('0x11')](0x1f5,_0x55bd60['message']));});});},'Command':function(_0x3cd3c0){var _0x2df6ed=this;return new Promise(function(_0x119b68,_0xd944d6){if(ami[_0x2f07('0x1e')]()==![]){return _0xd944d6(_0x2df6ed['error'](0x1f4,[config[_0x2f07('0x12')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x2f07('0x15')]('\x20')));}_0x3cd3c0=_['pick'](_0x3cd3c0,_0x2f07('0x1f'));_0x3cd3c0['action']=_0x2f07('0x20');return ami[_0x2f07('0x1a')](_0x3cd3c0)[_0x2f07('0x1b')](function(_0x307888){_0x119b68({'code':0xc8,'message':_0x307888['content']});})[_0x2f07('0x1d')](function(_0x428d8c){_0xd944d6(_0x2df6ed[_0x2f07('0x11')](0x1f5,_0x428d8c['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x111376){var _0x113916=[];for(var _0x522006 in _0x1d5a33[_0x2f07('0x21')]){if(_0x1d5a33[_0x2f07('0x21')]['hasOwnProperty'](_0x522006)){var _0x427e13=_0x1d5a33['voiceQueues'][_0x522006];var _0x894cd4=new VoiceQueueSummary(_0x427e13);_0x113916[_0x2f07('0x22')](_0x894cd4);}}_0x111376({'count':_0x113916[_0x2f07('0x23')],'rows':_0x113916});});},'UpdateVoiceQueue':function(_0x18f599){return new Promise(function(_0x20e4f8,_0x139ea8){var _0x787aad=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x21')],{'id':parseInt(_0x18f599['id'])});var _0x468cd8=_[_0x2f07('0x25')](_0x18f599,['id']);if(_0x787aad){for(var _0x279eb3 in _0x468cd8){if(typeof _0x468cd8[_0x279eb3]!=='undefined'&&typeof _0x787aad[_0x279eb3]!==_0x2f07('0x26')){_0x787aad[_0x279eb3]=_0x468cd8[_0x279eb3];}}_0x20e4f8(_0x787aad);}else{_0x139ea8();}});},'VoiceChannels':function(){return new Promise(function(_0x2b806a){var _0xada137=_['values'](_0x1d5a33[_0x2f07('0x27')]);_0x2b806a({'count':_0xada137[_0x2f07('0x23')],'rows':_0xada137});});},'VoiceChannelMixMonitor':function(_0x115c97){var _0x5ad0de=this;return new Promise(function(_0xcd91be,_0x368e3d){if(ami[_0x2f07('0x1e')]()==![]){return _0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],'ami\x20disconnected'][_0x2f07('0x15')]('\x20')));}var _0x5b0407=schema(properties[_0x2f07('0x28')])[_0x2f07('0x29')](_0x115c97);if(_0x5b0407[_0x2f07('0x23')]>0x0){return _0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x2a')](_0x5b0407,_0x2f07('0x1c'))[_0x2f07('0x15')](',\x20')));}var _0x3a2bb7=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x27')],{'uniqueid':_0x115c97[_0x2f07('0x2b')]});if(_0x3a2bb7&&_0x3a2bb7[_0x2f07('0x2c')]){var _0xa74d2c=util[_0x2f07('0x7')](_0x2f07('0x2d'),_0x115c97[_0x2f07('0x2e')]||_0x115c97['uniqueid'],_0x115c97['format']||_0x2f07('0x2f'));return ami[_0x2f07('0x1a')]({'action':_0x2f07('0x30'),'channel':_0x3a2bb7['channel'],'file':_0xa74d2c,'options':'ai(mixmonitorid)'})[_0x2f07('0x1b')](function(_0x4acfb6){var _0x35c4e2=_[_0x2f07('0x24')](_0x3a2bb7[_0x2f07('0x31')],{'filename':_0x2f07('0x32')+_0xa74d2c[_0x2f07('0x33')]()});if(_['isNil'](_0x35c4e2)){_0x3a2bb7[_0x2f07('0x31')]['push']({'filename':_0x2f07('0x32')+_0xa74d2c['toLowerCase'](),'createdAt':moment()[_0x2f07('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4acfb6['mixmonitorid'],'status':_0x2f07('0x34')});}else{_0x35c4e2[_0x2f07('0x35')]=_0x4acfb6['mixmonitorid'];_0x35c4e2[_0x2f07('0x36')]=_0x2f07('0x34');}_0xcd91be({'code':0xc8,'message':[_0x115c97[_0x2f07('0x2b')],'MixMonitor\x20Success',_0x4acfb6[_0x2f07('0x35')]][_0x2f07('0x15')]('\x20'),'mixmonitorid':_0x4acfb6[_0x2f07('0x35')]});})[_0x2f07('0x1d')](function(_0x25b1a9){_0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f5,[_0x115c97[_0x2f07('0x2b')],_0x25b1a9[_0x2f07('0x1c')]['toLowerCase']()][_0x2f07('0x15')]('\x20')));});}else{return _0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f5,_0x2f07('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x3f1b6b){var _0x46c665=this;return new Promise(function(_0x2ded2e,_0x5129c){if(ami['isConnected']()==![]){return _0x5129c(_0x46c665[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}var _0x4d5932=schema(properties[_0x2f07('0x28')])[_0x2f07('0x29')](_0x3f1b6b);if(_0x4d5932[_0x2f07('0x23')]>0x0){return _0x5129c(_0x46c665[_0x2f07('0x11')](0x1f4,_['map'](_0x4d5932,'message')[_0x2f07('0x15')](',\x20')));}var _0x437e94=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x27')],{'uniqueid':_0x3f1b6b['uniqueid']});if(_0x437e94){return Promise[_0x2f07('0x38')]()[_0x2f07('0x1b')](function(){if(_0x437e94[_0x2f07('0x2c')]){return ami[_0x2f07('0x1a')]({'action':_0x2f07('0x39'),'channel':_0x437e94[_0x2f07('0x2c')],'mixmonitorid':_0x3f1b6b[_0x2f07('0x35')]})[_0x2f07('0x1d')](function(){});}})[_0x2f07('0x1b')](function(){if(_0x437e94[_0x2f07('0x3a')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x437e94['destinationchannel'],'mixmonitorid':_0x3f1b6b[_0x2f07('0x35')]})[_0x2f07('0x1d')](function(){});}})['then'](function(){var _0x97c166=_['find'](_0x437e94[_0x2f07('0x31')],{'mixmonitorid':_0x3f1b6b[_0x2f07('0x35')]});if(_0x97c166){_0x97c166[_0x2f07('0x36')]='stop';}})[_0x2f07('0x1b')](function(){var _0x350ace=util['format']('%s.%s',_0x3f1b6b[_0x2f07('0x2e')]||_0x3f1b6b[_0x2f07('0x2b')],_0x3f1b6b[_0x2f07('0x7')]||_0x2f07('0x2f'));var _0x1596f8=_[_0x2f07('0x24')](_0x437e94[_0x2f07('0x31')],{'filename':_0x2f07('0x32')+_0x350ace[_0x2f07('0x33')]()});if(_0x1596f8){_0x1596f8[_0x2f07('0x36')]=_0x2f07('0x3b');}})[_0x2f07('0x1b')](function(){_0x2ded2e({'code':0xc8,'message':[_0x3f1b6b[_0x2f07('0x2b')],_0x2f07('0x3c')][_0x2f07('0x15')]('\x20')});})[_0x2f07('0x1d')](function(_0x47ea61){_0x5129c(_0x46c665[_0x2f07('0x11')](0x1f5,[_0x3f1b6b[_0x2f07('0x2b')],_0x47ea61[_0x2f07('0x1c')][_0x2f07('0x33')]()][_0x2f07('0x15')]('\x20')));});}else{return _0x5129c(_0x46c665[_0x2f07('0x11')](0x1f5,_0x2f07('0x37')));}});},'VoiceQueuesChannels':function(_0x23a8ee){var _0x146d70=this;return new Promise(function(_0x5b920b){var _0x3354e0=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x3e')]);var _0x12523d={'count':_0x3354e0['length'],'rows':_0x3354e0};if(_0x23a8ee&&_0x23a8ee['type']){if(![_0x2f07('0x3f'),_0x2f07('0x40')]['includes'](_0x23a8ee['type'])){return _0x235418(_0x146d70[_0x2f07('0x11')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x2bfb93=_[_0x2f07('0x41')](_0x3354e0,function(_0x236e61){return _0x236e61[_0x2f07('0x42')]===_0x23a8ee[_0x2f07('0x42')];});_0x12523d[_0x2f07('0x43')]=_0x2bfb93[_0x2f07('0x23')];_0x12523d[_0x2f07('0x44')]=_0x2bfb93;}_0x5b920b(_0x12523d);});},'VoiceQueuesChannel':function(_0x418be3){var _0x3b381a=this;return new Promise(function(_0x49dfeb,_0x42fa33){var _0x399072=schema(properties[_0x2f07('0x45')])[_0x2f07('0x29')](_0x418be3);if(_0x399072['length']>0x0){return _0x42fa33(_0x3b381a[_0x2f07('0x11')](0x1f4,_['map'](_0x399072,'message')['join'](',\x20')));}var _0x43fa9b=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x3e')],{'uniqueid':_0x418be3[_0x2f07('0x2b')]});if(_0x43fa9b){_0x49dfeb(_0x43fa9b);}else{return _0x42fa33(_0x3b381a[_0x2f07('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x13c1b0){var _0x4084d6=this;return new Promise(function(_0x402da6,_0x56e9be){if(ami[_0x2f07('0x1e')]()==![]){return _0x56e9be(_0x4084d6['error'](0x1f4,[config[_0x2f07('0x12')]['ip'],config['asterisk'][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}var _0xcef3d2=schema(properties[_0x2f07('0x46')])[_0x2f07('0x29')](_0x13c1b0);if(_0xcef3d2[_0x2f07('0x23')]>0x0){return _0x56e9be(_0x4084d6[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x2a')](_0xcef3d2,_0x2f07('0x1c'))['join'](',\x20')));}var _0x5c2dd2=_[_0x2f07('0x24')](_0x1d5a33['queueChannels'],{'uniqueid':_0x13c1b0['uniqueid']});if(_0x5c2dd2&&_0x5c2dd2['channel']){return ami['Action']({'action':_0x2f07('0x47'),'channel':_0x5c2dd2['channel']})[_0x2f07('0x1b')](function(_0x41e88f){_0x402da6({'code':0xc8,'message':[_0x13c1b0[_0x2f07('0x2b')],_0x41e88f[_0x2f07('0x1c')]['toLowerCase']()][_0x2f07('0x15')]('\x20')});})[_0x2f07('0x1d')](function(_0x16fab3){_0x56e9be(_0x4084d6[_0x2f07('0x11')](0x1f5,[_0x13c1b0['uniqueid'],_0x16fab3[_0x2f07('0x1c')][_0x2f07('0x33')]()][_0x2f07('0x15')]('\x20')));});}else{return _0x56e9be(_0x4084d6[_0x2f07('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x7d22f5){var _0x365298=this;return new Promise(function(_0x939049,_0x28b3c3){if(ami['isConnected']()==![]){return _0x28b3c3(_0x365298[_0x2f07('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}var _0x5990d5=schema(properties[_0x2f07('0x48')])[_0x2f07('0x29')](_0x7d22f5);if(_0x5990d5['length']>0x0){return _0x28b3c3(_0x365298[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x2a')](_0x5990d5,'message')[_0x2f07('0x15')](',\x20')));}var _0x71df4d=_[_0x2f07('0x24')](_0x1d5a33['queueChannels'],{'uniqueid':_0x7d22f5['uniqueid']});if(_0x71df4d&&_0x71df4d[_0x2f07('0x2c')]){return ami[_0x2f07('0x1a')]({'action':'Redirect','channel':_0x71df4d[_0x2f07('0x2c')],'exten':_0x7d22f5[_0x2f07('0x49')],'context':_0x7d22f5[_0x2f07('0x4a')]||_0x71df4d[_0x2f07('0x4a')],'priority':0x1})[_0x2f07('0x1b')](function(_0x26f986){_0x939049({'code':0xc8,'message':[_0x7d22f5[_0x2f07('0x2b')],_0x26f986[_0x2f07('0x1c')]['toLowerCase']()]['join']('\x20')});})['catch'](function(_0x58e5ee){_0x28b3c3(_0x365298['error'](0x1f5,[_0x7d22f5['uniqueid'],_0x58e5ee['message'][_0x2f07('0x33')]()][_0x2f07('0x15')]('\x20')));});}else{return _0x28b3c3(_0x365298[_0x2f07('0x11')](0x1f5,_0x2f07('0x37')));}});},'Agents':function(_0x49ae15){return new Promise(function(_0x2fb109){var _0xed7e01=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0xe')]);if(_0x49ae15&&_0x49ae15['id']){var _0x5b68f9=_[_0x2f07('0x24')](_0xed7e01,function(_0x3dc5ee){return _0x3dc5ee['id']===_0x49ae15['id'];});_0x2fb109(_0x5b68f9);}else{_0x2fb109({'count':_0xed7e01['length'],'rows':_0xed7e01});}});},'Telephones':function(){return new Promise(function(_0x5cbc28){var _0x5da460=_['values'](_0x1d5a33[_0x2f07('0x4b')]);_0x5cbc28({'count':_0x5da460[_0x2f07('0x23')],'rows':_0x5da460});});},'Trunks':function(){return new Promise(function(_0x127a39){var _0x5db1db=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x4c')]);_0x127a39({'count':_0x5db1db[_0x2f07('0x23')],'rows':_0x5db1db});});},'OutboundChannels':function(){return new Promise(function(_0x455841){var _0x285df7=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x4d')]);_0x455841({'count':_0x285df7[_0x2f07('0x23')],'rows':_0x285df7});});},'Outbound':function(){return new Promise(function(_0x4d8bf0){_0x4d8bf0(_0x1d5a33['outbound']);});},'Campaigns':function(){return new Promise(function(_0x417618){var _0x1ab958=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x4e')]);_0x417618({'count':_0x1ab958[_0x2f07('0x23')],'rows':_0x1ab958});});},'VoiceQueuesPreview':function(_0x220236){var _0xc4c1c6=this;return new Promise(function(_0x3650d9,_0x1eda37){_0x14d6e6[_0x2f07('0x4f')](_0x220236['id'])[_0x2f07('0x1b')](function(_0x5effb2){_0x3650d9({'code':0xc8,'message':_0x5effb2[_0x2f07('0x1c')]});})[_0x2f07('0x1d')](function(_0x4d738e){_0x1eda37(_0xc4c1c6[_0x2f07('0x11')](0x1f4,_0x4d738e[_0x2f07('0x1c')]));});});},'EventManager':function(_0x5b8f8c){var _0x1cc1f7=this;return new Promise(function(_0x31dd3,_0x212d68){if(!_0x5b8f8c[_0x2f07('0x50')]){return _0x212d68(_0x1cc1f7[_0x2f07('0x11')](0x1f4,_0x2f07('0x51')));}ami['emit'](_0x2f07('0x52')+_0x5b8f8c[_0x2f07('0x50')],_0x5b8f8c['message']);_0x31dd3({'code':0xc8,'message':_0x5b8f8c});});},'FaxAccounts':function(){return new Promise(function(_0xabe7e7){var _0x22c670=_[_0x2f07('0x3d')](_0x1d5a33['faxAccounts']);_0xabe7e7({'count':_0x22c670[_0x2f07('0x23')],'rows':_0x22c670});});},'SendFax':function(_0x4393bd){var _0x4d141f=this;return new Promise(function(_0x31d816,_0x4c182c){_0x3643bb[_0x2f07('0x53')](_0x4393bd)[_0x2f07('0x1b')](function(_0x1a0f5c){_0x31d816({'code':0xc8,'message':_0x1a0f5c[_0x2f07('0x1c')]});})[_0x2f07('0x1d')](function(_0x3a99ce){_0x4c182c(_0x4d141f[_0x2f07('0x11')](0x1f4,_0x3a99ce[_0x2f07('0x1c')]));});});},'CheckAfterSend':function(_0xbdb45c){var _0x4e7f9f=this;return new Promise(function(_0x2443d7,_0x199440){_0x3643bb[_0x2f07('0x54')](_0xbdb45c)[_0x2f07('0x1b')](function(_0x10f5bf){_0x2443d7({'code':0xc8,'message':_0x10f5bf[_0x2f07('0x1c')]});})['catch'](function(_0x52d5c6){_0x199440(_0x4e7f9f[_0x2f07('0x11')](0x1f4,_0x52d5c6[_0x2f07('0x1c')]));});});}};var _0x410a53=jayson[_0x2f07('0x55')](_0xf73d1a)['http']();_0x410a53['on'](_0x2f07('0x11'),function(_0x51db42){return _0x235418(_0x51db42);});_0x410a53[_0x2f07('0x56')](0x232a,'127.0.0.1',function(){console[_0x2f07('0x57')](_0x2f07('0x58'),0x232a);return _0x2e6422(_0x2f07('0x59')+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 f6792d1..88e65c8 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 _0x51e1=['Unknown','createContact','push','format','user:%s','trigger:%s','toLowerCase','merge','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','ListId','data3','phone','$or','routeId','destcalleridnum','calleridnum','firstName','mobile','createdAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x51e1,0x70));var _0x151e=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x51e1[_0x5f25b3];return _0x4ab9bf;};'use strict';var _=require(_0x151e('0x0'));var BPromise=require('bluebird');var Redis=require(_0x151e('0x1'));var util=require(_0x151e('0x2'));var config=require('../../../../config/environment');var logger=require(_0x151e('0x3'))(_0x151e('0x4'));var cmContactRpc=require(_0x151e('0x5'));config[_0x151e('0x6')]=_[_0x151e('0x7')](config[_0x151e('0x6')],{'host':_0x151e('0x8'),'port':0x18eb});var io=require(_0x151e('0x9'))(new Redis(config[_0x151e('0x6')]));function emit(_0x34ccf1,_0x1e29d2,_0x3b2599,_0x3cd66c,_0x202b6d){logger[_0x151e('0xa')](_0x151e('0xb'),_0x34ccf1,_0x1e29d2['id'],_0x3b2599,_0x3cd66c,JSON[_0x151e('0xc')](_0x202b6d));io['to'](_0x3b2599)[_0x151e('0xd')](_0x3cd66c,_0x202b6d);}exports[_0x151e('0xe')]=function(_0x525aa7,_0x182c09,_0x26da98,_0x32a4c1){var _0xf38a9f,_0x205e57;var _0x350c43={};var _0x2994e7;var _0x7d5cc0=Number(_0x26da98[_0x151e('0xf')]);var _0x3b325a=_0x26da98[_0x151e('0x10')]?Boolean(Number(_0x26da98[_0x151e('0x10')])):![];var _0x2029a9;var _0xcd7c51=![];if(!_['isNil'](_0x26da98[_0x151e('0x11')])){if(_0x26da98['data5']=='1')_0xcd7c51=!![];}if(!_0xcd7c51){if(_0x32a4c1['xmd-contactid']){_0x350c43['id']=_0x32a4c1['xmd-contactid'];}}if(!_0x350c43['id']){_0x350c43[_0x151e('0x12')]=_0x7d5cc0;_0x2029a9=_0x26da98[_0x151e('0x13')]&&_0x26da98[_0x151e('0x13')]!=='0'?_0x26da98[_0x151e('0x13')]['split'](','):[_0x151e('0x14')];_0x350c43[_0x151e('0x15')]=_['map'](_0x2029a9,function(_0x1f288d){var _0x24ba11={};_0x24ba11[_0x1f288d]=_0x32a4c1[_0x151e('0x16')]?_0x32a4c1['destcalleridnum']:_0x32a4c1['calleridnum'];return _0x24ba11;});_0x2994e7=_0x32a4c1[_0x151e('0x16')]?_0x32a4c1[_0x151e('0x17')]:_0x32a4c1[_0x151e('0x18')];}var _0x362aee=['id',_0x151e('0x19'),'lastName','phone',_0x151e('0x1a'),'fax','ListId',_0x151e('0x1b'),'scheduledAt','updatedAt'];var _0xc6cd43=_['union'](_0x362aee,_0x2029a9);BPromise[_0x151e('0x1c')]()[_0x151e('0x1d')](cmContactRpc[_0x151e('0x1e')]({'attributes':_0xc6cd43,'where':_0x350c43,'phone':_0x2994e7}))[_0x151e('0x1d')](function(_0x2e4db8){_0x205e57=_0x2e4db8;if(!_[_0x151e('0x1f')](_0x205e57)){if(_0x205e57[_0x151e('0x20')]===0x1){_0xf38a9f=_0x205e57[0x0];logger[_0x151e('0xa')](_0x151e('0x21'),_0x32a4c1[_0x151e('0x22')],_0x182c09['id'],_0xf38a9f['id']);}else{logger[_0x151e('0xa')](_0x151e('0x23'),_0x32a4c1['uniqueid'],_0x182c09['id'],_[_0x151e('0x24')](_0x205e57,'id')[_0x151e('0x25')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x32a4c1['uniqueid'],_0x182c09['id']);var _0xd8928a={'ListId':_0x7d5cc0};var _0x3bae2d=_0x26da98[_0x151e('0x26')]&&_0x26da98['data4']!=='0'?_0x26da98['data4']:_0x151e('0x14');if(_0x3b325a){logger[_0x151e('0xa')](_0x151e('0x27'),_0x32a4c1[_0x151e('0x22')],_0x182c09['id']);_0xd8928a[_0x3bae2d]=_['isNil'](_0x32a4c1[_0x151e('0x16')])?_0x32a4c1['calleridnum']:_0x32a4c1[_0x151e('0x17')];if(_[_0x151e('0x28')](_0x32a4c1[_0x151e('0x16')])){_0xd8928a[_0x151e('0x19')]=_0x32a4c1[_0x151e('0x29')]&&_0x32a4c1[_0x151e('0x29')]!==_0x151e('0x2a')?_0x32a4c1[_0x151e('0x29')]:'Unknown';}else{_0xd8928a[_0x151e('0x19')]=_0x32a4c1['destcalleridname']&&_0x32a4c1[_0x151e('0x2b')]!==''?_0x32a4c1[_0x151e('0x2b')]:_0x151e('0x2c');}return BPromise[_0x151e('0x1c')]()[_0x151e('0x1d')](cmContactRpc[_0x151e('0x2d')](_0xd8928a))[_0x151e('0x1d')](function(_0x54b6c4){_0xf38a9f=_0x54b6c4;_0x205e57[_0x151e('0x2e')](_0x54b6c4);if(_0xf38a9f){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x32a4c1[_0x151e('0x22')],_0x182c09['id'],_0xf38a9f['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x32a4c1[_0x151e('0x22')],_0x182c09['id']);_0xd8928a[_0x3bae2d]=_[_0x151e('0x28')](_0x32a4c1['routeId'])?_0x32a4c1[_0x151e('0x18')]:_0x32a4c1['destcalleridnum'];if(_[_0x151e('0x28')](_0x32a4c1[_0x151e('0x16')])){_0xd8928a[_0x151e('0x19')]=_0x32a4c1[_0x151e('0x29')]&&_0x32a4c1[_0x151e('0x29')]!==_0x151e('0x2a')?_0x32a4c1[_0x151e('0x29')]:_0x151e('0x2c');}else{_0xd8928a[_0x151e('0x19')]=_0x32a4c1[_0x151e('0x2b')]&&_0x32a4c1[_0x151e('0x2b')]!==_0x151e('0x2a')?_0x32a4c1[_0x151e('0x2b')]:_0x151e('0x2c');}_0xf38a9f=_0xd8928a;_0x205e57[_0x151e('0x2e')](_0xd8928a);return;}}})['then'](function(){if(_0x525aa7){emit(_0x32a4c1[_0x151e('0x22')],_0x182c09,util[_0x151e('0x2f')](_0x151e('0x30'),_0x525aa7['name']),util['format'](_0x151e('0x31'),_0x26da98['action'][_0x151e('0x32')]()),{'evt':_[_0x151e('0x33')](_0x32a4c1,{'autoCreate':_0x3b325a}),'contact':_0xf38a9f===undefined?{}:_0xf38a9f,'contacts':_0x205e57[_0x151e('0x20')]===0x0?undefined:_0x205e57});}});}; \ No newline at end of file +var _0x2e26=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','action','merge','length','lodash','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','ListId','createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join'];(function(_0x1c6fb3,_0x573db8){var _0x50e625=function(_0x57a955){while(--_0x57a955){_0x1c6fb3['push'](_0x1c6fb3['shift']());}};_0x50e625(++_0x573db8);}(_0x2e26,0x190));var _0x62e2=function(_0x5795f5,_0xa4aa64){_0x5795f5=_0x5795f5-0x0;var _0x3c6736=_0x2e26[_0x5795f5];return _0x3c6736;};'use strict';var _=require(_0x62e2('0x0'));var BPromise=require(_0x62e2('0x1'));var Redis=require(_0x62e2('0x2'));var util=require('util');var config=require(_0x62e2('0x3'));var logger=require('../../../../config/logger')(_0x62e2('0x4'));var cmContactRpc=require(_0x62e2('0x5'));config[_0x62e2('0x6')]=_[_0x62e2('0x7')](config[_0x62e2('0x6')],{'host':_0x62e2('0x8'),'port':0x18eb});var io=require(_0x62e2('0x9'))(new Redis(config['redis']));function emit(_0x271119,_0x6dd81e,_0x5e5ba8,_0x2f6315,_0x101c2c){logger[_0x62e2('0xa')]('[CM][%s][%s]',_0x271119,_0x6dd81e['id'],_0x5e5ba8,_0x2f6315,JSON[_0x62e2('0xb')](_0x101c2c));io['to'](_0x5e5ba8)['emit'](_0x2f6315,_0x101c2c);}exports[_0x62e2('0xc')]=function(_0xea2a87,_0x47262b,_0x2b5027,_0x96bef5){var _0x123c47,_0x234d1e;var _0x2b68b4={};var _0x5a76e2;var _0x1a03a9=Number(_0x2b5027[_0x62e2('0xd')]);var _0x1a02a5=_0x2b5027[_0x62e2('0xe')]?Boolean(Number(_0x2b5027[_0x62e2('0xe')])):![];var _0x1f641d;var _0x3e6a32=![];if(!_[_0x62e2('0xf')](_0x2b5027[_0x62e2('0x10')])){if(_0x2b5027[_0x62e2('0x10')]=='1')_0x3e6a32=!![];}if(!_0x3e6a32){if(_0x96bef5['xmd-contactid']){_0x2b68b4['id']=_0x96bef5[_0x62e2('0x11')];}}if(!_0x2b68b4['id']){_0x2b68b4['ListId']=_0x1a03a9;_0x1f641d=_0x2b5027['data3']&&_0x2b5027[_0x62e2('0x12')]!=='0'?_0x2b5027[_0x62e2('0x12')][_0x62e2('0x13')](','):[_0x62e2('0x14')];_0x2b68b4[_0x62e2('0x15')]=_[_0x62e2('0x16')](_0x1f641d,function(_0x41175b){var _0x1cb1fb={};_0x1cb1fb[_0x41175b]=_0x96bef5[_0x62e2('0x17')]?_0x96bef5[_0x62e2('0x18')]:_0x96bef5[_0x62e2('0x19')];return _0x1cb1fb;});_0x5a76e2=_0x96bef5[_0x62e2('0x17')]?_0x96bef5[_0x62e2('0x18')]:_0x96bef5[_0x62e2('0x19')];}var _0x55c3e3=['id',_0x62e2('0x1a'),'lastName',_0x62e2('0x14'),_0x62e2('0x1b'),_0x62e2('0x1c'),_0x62e2('0x1d'),_0x62e2('0x1e'),_0x62e2('0x1f'),'updatedAt'];var _0x5b6de=_[_0x62e2('0x20')](_0x55c3e3,_0x1f641d);BPromise[_0x62e2('0x21')]()[_0x62e2('0x22')](cmContactRpc[_0x62e2('0x23')]({'attributes':_0x5b6de,'where':_0x2b68b4,'phone':_0x5a76e2}))[_0x62e2('0x22')](function(_0x188b2a){_0x234d1e=_0x188b2a;if(!_[_0x62e2('0x24')](_0x234d1e)){if(_0x234d1e['length']===0x1){_0x123c47=_0x234d1e[0x0];logger['info'](_0x62e2('0x25'),_0x96bef5[_0x62e2('0x26')],_0x47262b['id'],_0x123c47['id']);}else{logger[_0x62e2('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x96bef5[_0x62e2('0x26')],_0x47262b['id'],_[_0x62e2('0x16')](_0x234d1e,'id')[_0x62e2('0x27')](','));}return;}else{logger[_0x62e2('0xa')](_0x62e2('0x28'),_0x96bef5[_0x62e2('0x26')],_0x47262b['id']);var _0x42287f={'ListId':_0x1a03a9};var _0x57ddd6=_0x2b5027[_0x62e2('0x29')]&&_0x2b5027[_0x62e2('0x29')]!=='0'?_0x2b5027[_0x62e2('0x29')]:_0x62e2('0x14');if(_0x1a02a5){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x96bef5[_0x62e2('0x26')],_0x47262b['id']);_0x42287f[_0x57ddd6]=_['isNil'](_0x96bef5[_0x62e2('0x17')])?_0x96bef5[_0x62e2('0x19')]:_0x96bef5[_0x62e2('0x18')];if(_['isNil'](_0x96bef5['routeId'])){_0x42287f[_0x62e2('0x1a')]=_0x96bef5['calleridname']&&_0x96bef5[_0x62e2('0x2a')]!==_0x62e2('0x2b')?_0x96bef5[_0x62e2('0x2a')]:_0x62e2('0x2c');}else{_0x42287f['firstName']=_0x96bef5[_0x62e2('0x2d')]&&_0x96bef5[_0x62e2('0x2d')]!==_0x62e2('0x2b')?_0x96bef5[_0x62e2('0x2d')]:_0x62e2('0x2c');}return BPromise['resolve']()[_0x62e2('0x22')](cmContactRpc['createContact'](_0x42287f))[_0x62e2('0x22')](function(_0x13d30f){_0x123c47=_0x13d30f;_0x234d1e[_0x62e2('0x2e')](_0x13d30f);if(_0x123c47){logger[_0x62e2('0xa')](_0x62e2('0x2f'),_0x96bef5['uniqueid'],_0x47262b['id'],_0x123c47['id']);}return;});}else{logger['info'](_0x62e2('0x30'),_0x96bef5[_0x62e2('0x26')],_0x47262b['id']);_0x42287f[_0x57ddd6]=_[_0x62e2('0xf')](_0x96bef5[_0x62e2('0x17')])?_0x96bef5['calleridnum']:_0x96bef5[_0x62e2('0x18')];if(_[_0x62e2('0xf')](_0x96bef5[_0x62e2('0x17')])){_0x42287f[_0x62e2('0x1a')]=_0x96bef5[_0x62e2('0x2a')]&&_0x96bef5[_0x62e2('0x2a')]!==_0x62e2('0x2b')?_0x96bef5[_0x62e2('0x2a')]:_0x62e2('0x2c');}else{_0x42287f[_0x62e2('0x1a')]=_0x96bef5[_0x62e2('0x2d')]&&_0x96bef5[_0x62e2('0x2d')]!==_0x62e2('0x2b')?_0x96bef5[_0x62e2('0x2d')]:'Unknown';}_0x123c47=_0x42287f;_0x234d1e[_0x62e2('0x2e')](_0x42287f);return;}}})[_0x62e2('0x22')](function(){if(_0xea2a87){emit(_0x96bef5[_0x62e2('0x26')],_0x47262b,util['format'](_0x62e2('0x31'),_0xea2a87[_0x62e2('0x32')]),util[_0x62e2('0x33')]('trigger:%s',_0x2b5027[_0x62e2('0x34')]['toLowerCase']()),{'evt':_[_0x62e2('0x35')](_0x96bef5,{'autoCreate':_0x1a02a5}),'contact':_0x123c47===undefined?{}:_0x123c47,'contacts':_0x234d1e[_0x62e2('0x36')]===0x0?undefined:_0x234d1e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c96b9cd..f6bfbeb 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 _0xf722=['event','agent','membername','lastevent','mailSubstatus','null','offlineMessage','created','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zendeskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','clone','motionChannel','undefined','voice','inspect','checkTriggers','interface','hasOwnProperty','status','merge','variables','Actions','length','action','toLowerCase','contactmanager','data1','TemplateId','data2','render','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','600','data6','winApplication','format','user:%s','name','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','search','replace','checkTrigger','channel','AllConditions','every','checkConditions','AnyConditions','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf722,0x18f));var _0x2f72=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf722[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x2f72('0x0'));var _=require(_0x2f72('0x1'));var url=require(_0x2f72('0x2'));var Mustache=require(_0x2f72('0x3'));var Redis=require('ioredis');var urlforward=require(_0x2f72('0x4'));var integration=require(_0x2f72('0x5'));var cmContact=require(_0x2f72('0x6'));var script=require(_0x2f72('0x7'));var config=require('../../../config/environment');var logger=require(_0x2f72('0x8'))(_0x2f72('0x9'));var ami=require(_0x2f72('0xa'));config['redis']=_['defaults'](config[_0x2f72('0xb')],{'host':_0x2f72('0xc'),'port':0x18eb});var io=require(_0x2f72('0xd'))(new Redis(config[_0x2f72('0xb')]));var operators={'equals':function(_0x1cb244,_0x871905){return _0x1cb244==_0x871905;},'not_equals':function(_0x72b96f,_0x4305e3){return _0x72b96f!=_0x4305e3;}};var barAndWebActions=[_0x2f72('0xe'),_0x2f72('0x2'),_0x2f72('0xf')];function Trigger(_0x1f4fad){this[_0x2f72('0x10')]=_0x1f4fad[_0x2f72('0x10')];this['agents']=_0x1f4fad[_0x2f72('0x11')];this[_0x2f72('0x12')]=_0x1f4fad[_0x2f72('0x12')];this[_0x2f72('0x13')]=_0x1f4fad[_0x2f72('0x13')];this[_0x2f72('0x14')]=_0x1f4fad[_0x2f72('0x14')];this['zendeskAccounts']=_0x1f4fad['zendeskAccounts'];this[_0x2f72('0x15')]=_0x1f4fad[_0x2f72('0x15')];this['salesforceAccounts']=_0x1f4fad[_0x2f72('0x16')];this[_0x2f72('0x17')]=_0x1f4fad[_0x2f72('0x17')];this['zohoAccounts']=_0x1f4fad[_0x2f72('0x18')];this[_0x2f72('0x19')]=_0x1f4fad[_0x2f72('0x19')];this[_0x2f72('0x1a')]=_0x1f4fad[_0x2f72('0x1a')];this[_0x2f72('0x1b')]=_0x1f4fad[_0x2f72('0x1b')];this[_0x2f72('0x1c')]=_0x1f4fad['dynamics365Accounts'];this['freshsalesAccounts']=_0x1f4fad[_0x2f72('0x1d')];this[_0x2f72('0x1e')]={'zendesk':this[_0x2f72('0x1f')],'salesforce':this[_0x2f72('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x2f72('0x18')],'desk':this[_0x2f72('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x2f72('0x1c')],'freshsales':this[_0x2f72('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0x2f72('0x20'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x23'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x24'),this['syncCustomEvent'][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x25'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x26'),this['syncCustomEvent'][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x27'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on']('custom:agentbusy',this[_0x2f72('0x21')]['bind'](this));ami['on'](_0x2f72('0x28'),this['syncCustomEvent'][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x29'),this['syncCustomEvent'][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x2a'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on']('custom:queuecallerabandon',this[_0x2f72('0x21')]['bind'](this));ami['on'](_0x2f72('0x2b'),this['syncCustomEvent'][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x2c'),this['syncAgentDial'][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x2d'),this[_0x2f72('0x2e')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x2f'),this[_0x2f72('0x2e')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x30'),this['syncCustomEvent'][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x31'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x32'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x33'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x34'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x35'),this[_0x2f72('0x21')][_0x2f72('0x22')](this));ami['on'](_0x2f72('0x36'),this[_0x2f72('0x21')]['bind'](this));ami['on'](_0x2f72('0x37'),this['syncCustomEvent'][_0x2f72('0x22')](this));}Trigger[_0x2f72('0x38')][_0x2f72('0x39')]=function(_0x25167d,_0x310d5d,_0x44706a){logger['info'](_0x25167d,_0x310d5d,JSON[_0x2f72('0x3a')](_0x44706a));io['to'](_0x25167d)[_0x2f72('0x39')](_0x310d5d,_0x44706a);};Trigger[_0x2f72('0x38')]['syncCustomEvent']=function(_0x25e27d){var _0x2c93af=_[_0x2f72('0x3b')](_0x25e27d);if(typeof _0x2c93af[_0x2f72('0x3c')]===_0x2f72('0x3d')){_0x2c93af[_0x2f72('0x3c')]=_0x2f72('0x3e');}logger['debug'](_0x2f72('0x21'),util[_0x2f72('0x3f')](_0x2c93af,{'showHidden':!![],'depth':null}));this[_0x2f72('0x40')](_0x2c93af);};Trigger[_0x2f72('0x38')]['syncAgentDial']=function(_0x5af4e5){if(this['agents'][_0x5af4e5[_0x2f72('0x41')]]){this['syncCustomEvent'](_0x5af4e5);}};Trigger[_0x2f72('0x38')][_0x2f72('0x40')]=function(_0x1b09f9){var _0x195adc;for(var _0x22a90e in this[_0x2f72('0x10')]){if(this['triggers'][_0x2f72('0x42')](_0x22a90e)){if(this['triggers'][_0x22a90e][_0x2f72('0x43')]){_0x195adc=this['checkTrigger'](this[_0x2f72('0x10')][_0x22a90e],_0x1b09f9);if(_0x195adc){_[_0x2f72('0x44')](_0x1b09f9,_0x1b09f9[_0x2f72('0x45')]);for(var _0x38345c=0x0,_0x28aa16,_0x39e831,_0x4dee36;_0x38345c0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x4d6d1d,_0x457a95){var _0x595d1d=function(_0x48804d){while(--_0x48804d){_0x4d6d1d['push'](_0x4d6d1d['shift']());}};_0x595d1d(++_0x457a95);}(_0x3e74,0x175));var _0x43e7=function(_0x4f2ec6,_0x3e0869){_0x4f2ec6=_0x4f2ec6-0x0;var _0x52d32a=_0x3e74[_0x4f2ec6];return _0x52d32a;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 fda198d..3eb6634 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 _0x1941=['odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data5','username','password','clientSecret','then','access_token','catch','error','message','GET','Bearer\x20','4.0','validateEmail','email','length','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','internalemailaddress','outbound','destcalleridnum','POST','contacts','body','headers','substring','lastIndexOf','enduserId','toLowerCase','calleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','indexOf','content','incident','incidents','assign','getString','Descriptions','/systemusers(','Fields','ticketType','phonecall','callDirection','queue','/contacts(','phonecalls','Subjects'];(function(_0x2c4db6,_0x58bad4){var _0xad0dcf=function(_0x3cd52a){while(--_0x3cd52a){_0x2c4db6['push'](_0x2c4db6['shift']());}};_0xad0dcf(++_0x58bad4);}(_0x1941,0x1d3));var _0x1194=function(_0x55f264,_0x3640bf){_0x55f264=_0x55f264-0x0;var _0x3e8be8=_0x1941[_0x55f264];return _0x3e8be8;};'use strict';var _=require(_0x1194('0x0'));var rp=require(_0x1194('0x1'));var util=require(_0x1194('0x2'));var intUtil=require('./util');var md5=require(_0x1194('0x3'));var Redis=require(_0x1194('0x4'));var logger=require(_0x1194('0x5'))(_0x1194('0x6'));var config=require(_0x1194('0x7'));config[_0x1194('0x8')]=_['defaults'](config['redis'],{'host':_0x1194('0x9'),'port':0x18eb});var io=require(_0x1194('0xa'))(new Redis(config[_0x1194('0x8')]));function getAuthToken(_0x4fdfdb,_0x20ad0d,_0x476633){if(_0x4fdfdb[_0x1194('0xb')]){_0x4fdfdb[_0x1194('0xc')]=_0x4fdfdb[_0x1194('0xd')][_0x1194('0xe')];_0x4fdfdb[_0x1194('0xf')]=_0x4fdfdb[_0x1194('0xd')]['data2'];return Promise['resolve'](_0x4fdfdb['CloudProvider'][_0x1194('0x10')]);}var _0x1c7316={'method':'POST','uri':_0x20ad0d,'form':{'client_id':_0x4fdfdb['clientId'],'resource':_0x4fdfdb[_0x1194('0xc')],'username':_0x4fdfdb[_0x1194('0x11')],'password':_0x4fdfdb['password'],'grant_type':_0x1194('0x12'),'client_secret':_0x4fdfdb[_0x1194('0x13')]},'json':!![]};return rp(_0x1c7316)[_0x1194('0x14')](function(_0x582267){return _0x582267[_0x1194('0x15')];})[_0x1194('0x16')](function(_0x1c69f1){logger[_0x1194('0x17')]('['+[_0x476633['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x1c69f1[_0x1194('0x18')];});}function getUser(_0xbb91a8,_0x5b938e,_0x11f576,_0x347598,_0x120a67,_0x25a580){return new Promise(function(_0x2ee5ad,_0x483117){return getAuthToken(_0x5b938e,_0x347598,_0x25a580)['then'](function(_0x45d6ba){var _0x181504={'method':_0x1194('0x19'),'uri':_0x120a67+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x1194('0x1a')+_0x45d6ba,'OData-Version':_0x1194('0x1b')},'json':!![]};return rp(_0x181504);})[_0x1194('0x14')](function(_0x55494e){var _0x21bacd=_0x55494e['value'];var _0x4429f3=![];var _0x895b7d=null;if(!_['isNil'](_0x11f576)){if(intUtil[_0x1194('0x1c')](_0x11f576['email'])){_0xbb91a8['userEmail']=_0x11f576[_0x1194('0x1d')];for(_0x895b7d=0x0;_0x895b7d<_0x21bacd[_0x1194('0x1e')];_0x895b7d++){if(_0x21bacd[_0x895b7d]['internalemailaddress']===_0x11f576[_0x1194('0x1d')]&&!_0x21bacd[_0x895b7d][_0x1194('0x1f')]){_0x4429f3=!![];logger[_0x1194('0x20')]('['+[_0x25a580[_0x1194('0x21')]()]+_0x1194('0x22')+_0x21bacd[_0x895b7d][_0x1194('0x23')]+'!');_0xbb91a8[_0x1194('0x24')]=_0x21bacd[_0x895b7d][_0x1194('0x23')];}}}}if(!_0x4429f3){logger[_0x1194('0x20')]('['+[_0x25a580[_0x1194('0x21')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xbb91a8[_0x1194('0x25')]=_0x5b938e[_0x1194('0x11')];for(_0x895b7d=0x0;_0x895b7d<_0x21bacd['length'];_0x895b7d++){if(_0x21bacd[_0x895b7d][_0x1194('0x26')]===_0x5b938e[_0x1194('0x11')]){_0xbb91a8[_0x1194('0x24')]=_0x21bacd[_0x895b7d]['systemuserid'];}}}_0x2ee5ad(_0xbb91a8);})[_0x1194('0x16')](function(_0x217729){_0x483117(_0x217729[_0x1194('0x18')]);});});}function createEndUser(_0x180cf7,_0x5a131f,_0x2a35ef,_0x290664,_0x59b91f,_0x128ebf,_0x1d8ae3){return new Promise(function(_0xeee708,_0x373720){return getAuthToken(_0x5a131f,_0x2a35ef,_0x128ebf)[_0x1194('0x14')](function(_0x5c1a79){var _0x2f8bd9=_0x128ebf['toLowerCase']()===_0x1194('0x27')?_0x59b91f[_0x1194('0x28')]:_0x59b91f['calleridnum'];var _0x4e3747={'method':_0x1194('0x29'),'uri':_0x290664+_0x1194('0x2a'),'body':{'fullname':_0x2f8bd9,'firstname':_0x2f8bd9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x180cf7['userId']+')'},'headers':{'Authorization':_0x1194('0x1a')+_0x5c1a79,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x4e3747[_0x1194('0x2b')][_0x1d8ae3]=_0x2f8bd9;return rp(_0x4e3747);})['then'](function(_0x29137e){var _0x3847f3=_0x29137e[_0x1194('0x2c')]['odata-entityid'];var _0x17c8a3=_0x3847f3[_0x1194('0x2d')](_0x3847f3[_0x1194('0x2e')]('(')+0x1,_0x3847f3[_0x1194('0x2e')](')'));_0x180cf7[_0x1194('0x2f')]=_0x17c8a3;_0xeee708(_0x180cf7);})[_0x1194('0x16')](function(_0x1b2b85){_0x373720(_0x1b2b85[_0x1194('0x18')]);});});}function getEndUser(_0x2f1a5e,_0x3272b6,_0x1bbe88,_0x20d004,_0xdf4fd3,_0x105582,_0x4f8b17,_0x5c11b4){var _0xa3fa57=_0x105582[_0x1194('0x30')]()===_0x1194('0x27')?_0xdf4fd3[_0x1194('0x28')]:_0xdf4fd3[_0x1194('0x31')];return getAuthToken(_0x3272b6,_0x1bbe88,_0x105582)[_0x1194('0x14')](function(_0x8bd8cb){_0x5c11b4=_0x5c11b4?_0x5c11b4:_0x1194('0x32');var _0x1d5c8f={'method':'GET','uri':_0x20d004+_0x1194('0x33')+_0x5c11b4+_0x1194('0x34')+_0x5c11b4+_0x1194('0x35')+_0xa3fa57[_0x1194('0x36')]('+',_0x1194('0x37'))+'\x27','headers':{'Authorization':_0x1194('0x1a')+_0x8bd8cb,'If-None-Match':null,'OData-Version':_0x1194('0x1b')},'json':!![]};return rp(_0x1d5c8f);})[_0x1194('0x14')](function(_0x50cb7a){var _0x561b5e=![];if(!_0x50cb7a)return _0x561b5e;var _0x24050f=_0x50cb7a[_0x1194('0x38')];for(var _0x9f430b=0x0;_0x9f430b<_0x24050f[_0x1194('0x1e')];_0x9f430b++){if(_0x24050f[_0x9f430b][_0x5c11b4]===_0xa3fa57){_0x561b5e=!![];_0x2f1a5e[_0x1194('0x2f')]=_0x24050f[_0x9f430b][_0x1194('0x39')];}}return _0x561b5e;})[_0x1194('0x14')](function(_0x2f3096){if(_0x2f3096)return _0x2f1a5e;if(_0x4f8b17===_0x1194('0x3a')){logger[_0x1194('0x20')]('['+[_0x105582[_0x1194('0x21')]()]+_0x1194('0x3b'));return _0x2f1a5e;}return createEndUser(_0x2f1a5e,_0x3272b6,_0x1bbe88,_0x20d004,_0xdf4fd3,_0x105582,_0x5c11b4)[_0x1194('0x14')](function(_0x8d14cf){logger[_0x1194('0x20')]('['+[_0x105582[_0x1194('0x21')]()]+_0x1194('0x3c'),_0x8d14cf['enduserId']);return _0x8d14cf;});});}function getCustomFields(_0x245177,_0x521a4e,_0x5958f5){var _0x4483b9={};if(_0x245177[_0x1194('0x1e')]>0x0){_[_0x1194('0x3d')](_0x245177,function(_0x4ab16b){if(_['includes']([_0x1194('0x3e'),_0x1194('0x3f')],_0x4ab16b[_0x1194('0x40')])&&_0x4ab16b[_0x1194('0x41')]&&!_0x4ab16b[_0x1194('0x42')]){var _0x65c1ef=_0x4ab16b['idField'][_0x1194('0x30')]();var _0x3abb28=_0x65c1ef[_0x1194('0x2d')](0x0,_0x65c1ef[_0x1194('0x43')]('_'));var _0x3b476a=_0x65c1ef[_0x1194('0x2d')](_0x65c1ef['indexOf']('_')+0x1);if(_0x3abb28===_0x5958f5){_0x4483b9[_0x3b476a]=_0x4ab16b[_0x1194('0x44')];}}});}return _0x4483b9;}function getTicket(_0x16d96d,_0x153f5d,_0x4ff075,_0x10059f,_0x14dfc7,_0x55cea8,_0x5f558c){return new Promise(function(_0x14eee8,_0x2d1037){var _0x39c951;return getAuthToken(_0x153f5d,_0x4ff075,_0x5f558c)[_0x1194('0x14')](function(_0x19f16e){if(_0x55cea8['ticketType']===_0x1194('0x45')){_0x39c951={'method':'POST','uri':_0x10059f+_0x1194('0x46'),'body':Object[_0x1194('0x47')]({},{'title':intUtil[_0x1194('0x48')](_0x55cea8['Subjects'],_0x14dfc7,'\x20'),'description':intUtil[_0x1194('0x48')](_0x55cea8[_0x1194('0x49')],_0x14dfc7,'\x0a'),'customerid_contact@odata.bind':_0x16d96d[_0x1194('0x2f')]?'/contacts('+_0x16d96d['enduserId']+')':undefined,'ownerid@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x55cea8[_0x1194('0x4b')],_0x14dfc7,_0x55cea8[_0x1194('0x4c')])),'headers':{'Authorization':_0x1194('0x1a')+_0x19f16e,'OData-Version':_0x1194('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x55cea8[_0x1194('0x4c')]===_0x1194('0x4d')){var _0x59fa63=_0x16d96d['enduserId']?[{'partyid_systemuser@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','participationtypemask':_0x16d96d[_0x1194('0x4e')]===_0x1194('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x1194('0x50')+_0x16d96d[_0x1194('0x2f')]+')','participationtypemask':_0x16d96d[_0x1194('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','participationtypemask':_0x16d96d[_0x1194('0x4e')]==='queue'?0x2:0x1}];_0x39c951={'method':'POST','uri':_0x10059f+_0x1194('0x51'),'body':Object[_0x1194('0x47')]({},{'subject':intUtil['getString'](_0x55cea8[_0x1194('0x52')],_0x14dfc7,'\x20'),'phonenumber':String(_0x14dfc7['calleridnum']),'description':intUtil[_0x1194('0x48')](_0x55cea8[_0x1194('0x49')],_0x14dfc7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x16d96d[_0x1194('0x2f')]?_0x1194('0x50')+_0x16d96d['enduserId']+')':undefined,'ownerid@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','directioncode':_0x16d96d[_0x1194('0x4e')]===_0x1194('0x4f')?![]:!![],'phonecall_activity_parties':_0x59fa63},getCustomFields(_0x55cea8[_0x1194('0x4b')],_0x14dfc7,_0x55cea8[_0x1194('0x4c')])),'headers':{'Authorization':_0x1194('0x1a')+_0x19f16e,'OData-Version':_0x1194('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x39c951);})[_0x1194('0x14')](function(_0xc0588e){var _0x4bc681=_0xc0588e['headers'][_0x1194('0x53')];var _0x367d7b=_0x4bc681['substring'](_0x4bc681[_0x1194('0x2e')]('(')+0x1,_0x4bc681[_0x1194('0x2e')](')'));_0x16d96d['ticketId']=_0x367d7b;_0x14eee8(_0x16d96d);})[_0x1194('0x16')](function(_0x16ce18){_0x2d1037(_0x16ce18[_0x1194('0x18')]);});});}function emit(_0x27e01a,_0x24130c,_0xdb366b,_0x2678e1){var _0x97ba17={'uri':util['format'](_0x1194('0x54'),_0x27e01a,_0xdb366b,_0x2678e1)};io['to'](util[_0x1194('0x55')](_0x1194('0x56'),_0x24130c))[_0x1194('0x57')]('trigger:browser:url',_0x97ba17);}exports['cs']=function(_0xd4289,_0x24b3b,_0x5e4321,_0x477631,_0x44fc38,_0x42ffa1,_0xf73d70,_0x515f1e){var _0x473ddc={};_0x42ffa1[_0x1194('0xc')]=_0x42ffa1[_0x1194('0xb')]?intUtil[_0x1194('0x58')](_0x42ffa1[_0x1194('0xd')][_0x1194('0xe')]):intUtil[_0x1194('0x58')](_0x42ffa1['remoteUri']);_0x42ffa1['serverUrl']=intUtil['stripTrailingSlash'](_0x42ffa1['serverUrl']);_0x473ddc[_0x1194('0x4e')]=_0x515f1e===_0x1194('0x4f')||_0x515f1e==='unmanaged'?_0x1194('0x4f'):_0x1194('0x27');var _0x12119=_0x42ffa1[_0x1194('0xb')]?util[_0x1194('0x55')](_0x1194('0x59'),_0x42ffa1[_0x1194('0xd')][_0x1194('0xe')]):util[_0x1194('0x55')](_0x1194('0x59'),_0x42ffa1[_0x1194('0xc')]);var _0x548c74=util[_0x1194('0x55')](_0x1194('0x5a'),_0x42ffa1[_0x1194('0xf')]);var _0x2f81a3=util[_0x1194('0x55')](_0x1194('0x5b'),_0x42ffa1['serverUrl'],_0x24b3b[_0x1194('0x5c')],md5(_0x24b3b[_0x1194('0x5c')]));if(_0x44fc38&&_0x44fc38[_0x1194('0x5d')]){logger['info'](_0x1194('0x5e'),'Recording\x20is\x20enabled!');_0x24b3b['recordingURL']=_0x2f81a3;}else if(_0xf73d70&&_0xf73d70['recordingFormat']&&_0xf73d70[_0x1194('0x5f')]!==_0x1194('0x60')){logger['info'](_0x1194('0x61'),_0x1194('0x62'));_0x24b3b[_0x1194('0x63')]=_0x2f81a3;}else{_0x24b3b[_0x1194('0x63')]='';}return getUser(_0x473ddc,_0x42ffa1,_0x477631,_0x548c74,_0x12119,_0x515f1e)[_0x1194('0x14')](function(_0x21f253){logger['info']('['+_0x515f1e[_0x1194('0x21')]()+']\x20The\x20User\x20ID\x20is:',_0x21f253['userId']);logger[_0x1194('0x20')]('['+_0x515f1e[_0x1194('0x21')]()+_0x1194('0x64'),_0x21f253['userEmail']);return getEndUser(_0x21f253,_0x42ffa1,_0x548c74,_0x12119,_0x24b3b,_0x515f1e,_0x5e4321[_0x1194('0x65')],_0x5e4321['additionalSearchContact']);})['then'](function(_0x3db27f){logger[_0x1194('0x20')]('['+_0x515f1e[_0x1194('0x21')]()+_0x1194('0x66'),_0x3db27f[_0x1194('0x2f')]);logger[_0x1194('0x20')]('['+_0x515f1e['toUpperCase']()+_0x1194('0x67'),_0x24b3b[_0x1194('0x31')]);return getTicket(_0x3db27f,_0x42ffa1,_0x548c74,_0x12119,_0x24b3b,_0x5e4321,_0x515f1e);})[_0x1194('0x14')](function(_0x286288){logger[_0x1194('0x20')](util['format']('['+_0x515f1e[_0x1194('0x21')]()+_0x1194('0x68'),_0x5e4321[_0x1194('0x4c')],_0x286288[_0x1194('0x69')]));logger[_0x1194('0x20')](util[_0x1194('0x55')]('['+_0x515f1e['toUpperCase']()+_0x1194('0x6a'),_0x515f1e));if(_0x515f1e!==_0x1194('0x6b')&&_0x5e4321['openNewTab']){logger['info']('['+_0x515f1e[_0x1194('0x21')]()+']',_0x1194('0x6c'));emit(_0x42ffa1['remoteUri'],_0x477631[_0x1194('0x6d')],_0x5e4321[_0x1194('0x4c')],_0x286288['ticketId']);}})['catch'](function(_0x57d536){logger['error']('['+_0x515f1e['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x57d536[_0x1194('0x18')]);console[_0x1194('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x57d536);});}; \ No newline at end of file +var _0x9e8d=['Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','POST','clientId','username','catch','error','toUpperCase','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','isdisabled','info','systemuserid','userId','userEmail','internalemailaddress','toLowerCase','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','modernAuthentication','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name'];(function(_0x20c4d0,_0x510618){var _0x148f9e=function(_0x3c362f){while(--_0x3c362f){_0x20c4d0['push'](_0x20c4d0['shift']());}};_0x148f9e(++_0x510618);}(_0x9e8d,0x1a5));var _0xd9e8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9e8d[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xd9e8('0x0'));var rp=require(_0xd9e8('0x1'));var util=require('util');var intUtil=require(_0xd9e8('0x2'));var md5=require(_0xd9e8('0x3'));var Redis=require(_0xd9e8('0x4'));var logger=require(_0xd9e8('0x5'))(_0xd9e8('0x6'));var config=require(_0xd9e8('0x7'));config[_0xd9e8('0x8')]=_[_0xd9e8('0x9')](config[_0xd9e8('0x8')],{'host':_0xd9e8('0xa'),'port':0x18eb});var io=require(_0xd9e8('0xb'))(new Redis(config[_0xd9e8('0x8')]));function getAuthToken(_0xbdbdfc,_0xb96e6,_0x5c05ca){if(_0xbdbdfc['modernAuthentication']){_0xbdbdfc[_0xd9e8('0xc')]=_0xbdbdfc[_0xd9e8('0xd')][_0xd9e8('0xe')];_0xbdbdfc[_0xd9e8('0xf')]=_0xbdbdfc[_0xd9e8('0xd')]['data2'];return Promise['resolve'](_0xbdbdfc['CloudProvider']['data5']);}var _0x4dac77={'method':_0xd9e8('0x10'),'uri':_0xb96e6,'form':{'client_id':_0xbdbdfc[_0xd9e8('0x11')],'resource':_0xbdbdfc[_0xd9e8('0xc')],'username':_0xbdbdfc[_0xd9e8('0x12')],'password':_0xbdbdfc['password'],'grant_type':'password','client_secret':_0xbdbdfc['clientSecret']},'json':!![]};return rp(_0x4dac77)['then'](function(_0x4d9fce){return _0x4d9fce['access_token'];})[_0xd9e8('0x13')](function(_0x30fc15){logger[_0xd9e8('0x14')]('['+[_0x5c05ca[_0xd9e8('0x15')]()]+']\x20Wrong\x20credentials!');return _0x30fc15[_0xd9e8('0x16')];});}function getUser(_0x7f2c1d,_0xa8e77f,_0x17b46e,_0x253034,_0x2dabc2,_0x272d82){return new Promise(function(_0x177509,_0x38616a){return getAuthToken(_0xa8e77f,_0x253034,_0x272d82)[_0xd9e8('0x17')](function(_0x2d717e){var _0x23da12={'method':_0xd9e8('0x18'),'uri':_0x2dabc2+_0xd9e8('0x19'),'headers':{'Authorization':_0xd9e8('0x1a')+_0x2d717e,'OData-Version':_0xd9e8('0x1b')},'json':!![]};return rp(_0x23da12);})[_0xd9e8('0x17')](function(_0x3949b4){var _0x1aa6c0=_0x3949b4[_0xd9e8('0x1c')];var _0x1743a4=![];var _0x3fa209=null;if(!_[_0xd9e8('0x1d')](_0x17b46e)){if(intUtil[_0xd9e8('0x1e')](_0x17b46e['email'])){_0x7f2c1d['userEmail']=_0x17b46e[_0xd9e8('0x1f')];for(_0x3fa209=0x0;_0x3fa209<_0x1aa6c0[_0xd9e8('0x20')];_0x3fa209++){if(_0x1aa6c0[_0x3fa209]['internalemailaddress']===_0x17b46e['email']&&!_0x1aa6c0[_0x3fa209][_0xd9e8('0x21')]){_0x1743a4=!![];logger[_0xd9e8('0x22')]('['+[_0x272d82[_0xd9e8('0x15')]()]+']\x20Agent\x20found\x20'+_0x1aa6c0[_0x3fa209][_0xd9e8('0x23')]+'!');_0x7f2c1d[_0xd9e8('0x24')]=_0x1aa6c0[_0x3fa209][_0xd9e8('0x23')];}}}}if(!_0x1743a4){logger[_0xd9e8('0x22')]('['+[_0x272d82[_0xd9e8('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x7f2c1d[_0xd9e8('0x25')]=_0xa8e77f[_0xd9e8('0x12')];for(_0x3fa209=0x0;_0x3fa209<_0x1aa6c0[_0xd9e8('0x20')];_0x3fa209++){if(_0x1aa6c0[_0x3fa209][_0xd9e8('0x26')]===_0xa8e77f[_0xd9e8('0x12')]){_0x7f2c1d[_0xd9e8('0x24')]=_0x1aa6c0[_0x3fa209]['systemuserid'];}}}_0x177509(_0x7f2c1d);})[_0xd9e8('0x13')](function(_0x28b4){_0x38616a(_0x28b4[_0xd9e8('0x16')]);});});}function createEndUser(_0xcf583,_0x31eb53,_0x9c1cad,_0x14aa11,_0x5ef7bf,_0x141c15,_0x448e57){return new Promise(function(_0x92479a,_0x11a0ae){return getAuthToken(_0x31eb53,_0x9c1cad,_0x141c15)['then'](function(_0x4a7ecc){var _0x29fa81=_0x141c15[_0xd9e8('0x27')]()==='outbound'?_0x5ef7bf[_0xd9e8('0x28')]:_0x5ef7bf[_0xd9e8('0x29')];var _0x1ddc59={'method':_0xd9e8('0x10'),'uri':_0x14aa11+'contacts','body':{'fullname':_0x29fa81,'firstname':_0x29fa81,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd9e8('0x2a')+_0xcf583[_0xd9e8('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4a7ecc,'OData-Version':_0xd9e8('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x1ddc59[_0xd9e8('0x2b')][_0x448e57]=_0x29fa81;return rp(_0x1ddc59);})['then'](function(_0x9a0db7){var _0x126a81=_0x9a0db7[_0xd9e8('0x2c')][_0xd9e8('0x2d')];var _0x241389=_0x126a81[_0xd9e8('0x2e')](_0x126a81['lastIndexOf']('(')+0x1,_0x126a81[_0xd9e8('0x2f')](')'));_0xcf583[_0xd9e8('0x30')]=_0x241389;_0x92479a(_0xcf583);})[_0xd9e8('0x13')](function(_0x19bf47){_0x11a0ae(_0x19bf47[_0xd9e8('0x16')]);});});}function getEndUser(_0x4a5189,_0x2b14b9,_0x48e26f,_0x4e201e,_0x2ed56d,_0x28e25c,_0x360fcd,_0x4b00a8){var _0x940e55=_0x28e25c[_0xd9e8('0x27')]()===_0xd9e8('0x31')?_0x2ed56d[_0xd9e8('0x28')]:_0x2ed56d[_0xd9e8('0x29')];return getAuthToken(_0x2b14b9,_0x48e26f,_0x28e25c)[_0xd9e8('0x17')](function(_0x4e8980){_0x4b00a8=_0x4b00a8?_0x4b00a8:'telephone1';var _0x21cb45={'method':_0xd9e8('0x18'),'uri':_0x4e201e+_0xd9e8('0x32')+_0x4b00a8+_0xd9e8('0x33')+_0x4b00a8+_0xd9e8('0x34')+_0x940e55[_0xd9e8('0x35')]('+','%2b')+'\x27','headers':{'Authorization':_0xd9e8('0x1a')+_0x4e8980,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x21cb45);})[_0xd9e8('0x17')](function(_0x2a1f0a){var _0x599d71=![];if(!_0x2a1f0a)return _0x599d71;var _0x32992e=_0x2a1f0a[_0xd9e8('0x1c')];for(var _0x45669e=0x0;_0x45669e<_0x32992e['length'];_0x45669e++){if(_0x32992e[_0x45669e][_0x4b00a8]===_0x940e55){_0x599d71=!![];_0x4a5189[_0xd9e8('0x30')]=_0x32992e[_0x45669e][_0xd9e8('0x36')];}}return _0x599d71;})[_0xd9e8('0x17')](function(_0x41b7c9){if(_0x41b7c9)return _0x4a5189;if(_0x360fcd===_0xd9e8('0x37')){logger[_0xd9e8('0x22')]('['+[_0x28e25c[_0xd9e8('0x15')]()]+_0xd9e8('0x38'));return _0x4a5189;}return createEndUser(_0x4a5189,_0x2b14b9,_0x48e26f,_0x4e201e,_0x2ed56d,_0x28e25c,_0x4b00a8)[_0xd9e8('0x17')](function(_0x4a08ff){logger[_0xd9e8('0x22')]('['+[_0x28e25c[_0xd9e8('0x15')]()]+_0xd9e8('0x39'),_0x4a08ff['enduserId']);return _0x4a08ff;});});}function getCustomFields(_0x1c09c1,_0x3843f4,_0x45ce81){var _0x570a16={};if(_0x1c09c1[_0xd9e8('0x20')]>0x0){_['forEach'](_0x1c09c1,function(_0x247aef){if(_[_0xd9e8('0x3a')]([_0xd9e8('0x3b'),_0xd9e8('0x3c')],_0x247aef['type'])&&_0x247aef['nameField']&&!_0x247aef['customField']){var _0x3acfbb=_0x247aef[_0xd9e8('0x3d')][_0xd9e8('0x27')]();var _0x2b288a=_0x3acfbb[_0xd9e8('0x2e')](0x0,_0x3acfbb[_0xd9e8('0x3e')]('_'));var _0x391802=_0x3acfbb[_0xd9e8('0x2e')](_0x3acfbb['indexOf']('_')+0x1);if(_0x2b288a===_0x45ce81){_0x570a16[_0x391802]=_0x247aef[_0xd9e8('0x3f')];}}});}return _0x570a16;}function getTicket(_0x379cdd,_0x26728d,_0x26526a,_0x15bdb9,_0x12d3b4,_0x16aec3,_0x4a1def){return new Promise(function(_0x221bbb,_0x2e004f){var _0x22d4a7;return getAuthToken(_0x26728d,_0x26526a,_0x4a1def)[_0xd9e8('0x17')](function(_0x5948fa){if(_0x16aec3[_0xd9e8('0x40')]===_0xd9e8('0x41')){_0x22d4a7={'method':_0xd9e8('0x10'),'uri':_0x15bdb9+_0xd9e8('0x42'),'body':Object[_0xd9e8('0x43')]({},{'title':intUtil[_0xd9e8('0x44')](_0x16aec3[_0xd9e8('0x45')],_0x12d3b4,'\x20'),'description':intUtil[_0xd9e8('0x44')](_0x16aec3[_0xd9e8('0x46')],_0x12d3b4,'\x0a'),'customerid_contact@odata.bind':_0x379cdd[_0xd9e8('0x30')]?'/contacts('+_0x379cdd['enduserId']+')':undefined,'ownerid@odata.bind':_0xd9e8('0x2a')+_0x379cdd[_0xd9e8('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x16aec3[_0xd9e8('0x47')],_0x12d3b4,_0x16aec3[_0xd9e8('0x40')])),'headers':{'Authorization':_0xd9e8('0x1a')+_0x5948fa,'OData-Version':_0xd9e8('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x16aec3['ticketType']===_0xd9e8('0x48')){var _0x159503=_0x379cdd[_0xd9e8('0x30')]?[{'partyid_systemuser@odata.bind':_0xd9e8('0x2a')+_0x379cdd[_0xd9e8('0x24')]+')','participationtypemask':_0x379cdd[_0xd9e8('0x49')]===_0xd9e8('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xd9e8('0x4b')+_0x379cdd[_0xd9e8('0x30')]+')','participationtypemask':_0x379cdd[_0xd9e8('0x49')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x379cdd['userId']+')','participationtypemask':_0x379cdd['callDirection']==='queue'?0x2:0x1}];_0x22d4a7={'method':_0xd9e8('0x10'),'uri':_0x15bdb9+_0xd9e8('0x4c'),'body':Object[_0xd9e8('0x43')]({},{'subject':intUtil[_0xd9e8('0x44')](_0x16aec3['Subjects'],_0x12d3b4,'\x20'),'phonenumber':String(_0x12d3b4[_0xd9e8('0x29')]),'description':intUtil['getString'](_0x16aec3['Descriptions'],_0x12d3b4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x379cdd['enduserId']?_0xd9e8('0x4b')+_0x379cdd['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x379cdd[_0xd9e8('0x24')]+')','directioncode':_0x379cdd[_0xd9e8('0x49')]==='queue'?![]:!![],'phonecall_activity_parties':_0x159503},getCustomFields(_0x16aec3[_0xd9e8('0x47')],_0x12d3b4,_0x16aec3[_0xd9e8('0x40')])),'headers':{'Authorization':_0xd9e8('0x1a')+_0x5948fa,'OData-Version':_0xd9e8('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x22d4a7);})[_0xd9e8('0x17')](function(_0x32c9fa){var _0x1f7ae0=_0x32c9fa['headers'][_0xd9e8('0x2d')];var _0x35d6ee=_0x1f7ae0[_0xd9e8('0x2e')](_0x1f7ae0[_0xd9e8('0x2f')]('(')+0x1,_0x1f7ae0[_0xd9e8('0x2f')](')'));_0x379cdd['ticketId']=_0x35d6ee;_0x221bbb(_0x379cdd);})[_0xd9e8('0x13')](function(_0x5525d8){_0x2e004f(_0x5525d8[_0xd9e8('0x16')]);});});}function emit(_0x1f3b6a,_0x7c983e,_0x4d1342,_0x5b243b){var _0x24fcbe={'uri':util['format'](_0xd9e8('0x4d'),_0x1f3b6a,_0x4d1342,_0x5b243b)};io['to'](util[_0xd9e8('0x4e')](_0xd9e8('0x4f'),_0x7c983e))['emit'](_0xd9e8('0x50'),_0x24fcbe);}exports['cs']=function(_0x437fd6,_0x1d40c7,_0x19c0ae,_0x1890a7,_0x4b4663,_0xfc7622,_0x41135d,_0x114f42){var _0x2dc841={};_0xfc7622[_0xd9e8('0xc')]=_0xfc7622[_0xd9e8('0x51')]?intUtil['stripTrailingSlash'](_0xfc7622[_0xd9e8('0xd')][_0xd9e8('0xe')]):intUtil['stripTrailingSlash'](_0xfc7622[_0xd9e8('0xc')]);_0xfc7622[_0xd9e8('0x52')]=intUtil[_0xd9e8('0x53')](_0xfc7622[_0xd9e8('0x52')]);_0x2dc841[_0xd9e8('0x49')]=_0x114f42===_0xd9e8('0x4a')||_0x114f42===_0xd9e8('0x54')?_0xd9e8('0x4a'):'outbound';var _0x477858=_0xfc7622['modernAuthentication']?util[_0xd9e8('0x4e')]('%s/api/data/v9.0/',_0xfc7622[_0xd9e8('0xd')][_0xd9e8('0xe')]):util['format'](_0xd9e8('0x55'),_0xfc7622[_0xd9e8('0xc')]);var _0x384308=util[_0xd9e8('0x4e')](_0xd9e8('0x56'),_0xfc7622[_0xd9e8('0xf')]);var _0x3a95f0=util[_0xd9e8('0x4e')](_0xd9e8('0x57'),_0xfc7622[_0xd9e8('0x52')],_0x1d40c7['uniqueid'],md5(_0x1d40c7[_0xd9e8('0x58')]));if(_0x4b4663&&_0x4b4663['monitor_format']){logger['info'](_0xd9e8('0x59'),_0xd9e8('0x5a'));_0x1d40c7[_0xd9e8('0x5b')]=_0x3a95f0;}else if(_0x41135d&&_0x41135d[_0xd9e8('0x5c')]&&_0x41135d[_0xd9e8('0x5c')]!=='none'){logger[_0xd9e8('0x22')](_0xd9e8('0x5d'),_0xd9e8('0x5a'));_0x1d40c7[_0xd9e8('0x5b')]=_0x3a95f0;}else{_0x1d40c7[_0xd9e8('0x5b')]='';}return getUser(_0x2dc841,_0xfc7622,_0x1890a7,_0x384308,_0x477858,_0x114f42)['then'](function(_0x40213c){logger[_0xd9e8('0x22')]('['+_0x114f42[_0xd9e8('0x15')]()+_0xd9e8('0x5e'),_0x40213c['userId']);logger['info']('['+_0x114f42['toUpperCase']()+_0xd9e8('0x5f'),_0x40213c['userEmail']);return getEndUser(_0x40213c,_0xfc7622,_0x384308,_0x477858,_0x1d40c7,_0x114f42,_0x19c0ae[_0xd9e8('0x60')],_0x19c0ae[_0xd9e8('0x61')]);})[_0xd9e8('0x17')](function(_0x4fa1df){logger[_0xd9e8('0x22')]('['+_0x114f42['toUpperCase']()+_0xd9e8('0x62'),_0x4fa1df[_0xd9e8('0x30')]);logger[_0xd9e8('0x22')]('['+_0x114f42['toUpperCase']()+_0xd9e8('0x63'),_0x1d40c7[_0xd9e8('0x29')]);return getTicket(_0x4fa1df,_0xfc7622,_0x384308,_0x477858,_0x1d40c7,_0x19c0ae,_0x114f42);})[_0xd9e8('0x17')](function(_0x30b4de){logger[_0xd9e8('0x22')](util[_0xd9e8('0x4e')]('['+_0x114f42[_0xd9e8('0x15')]()+_0xd9e8('0x64'),_0x19c0ae[_0xd9e8('0x40')],_0x30b4de['ticketId']));logger[_0xd9e8('0x22')](util[_0xd9e8('0x4e')]('['+_0x114f42[_0xd9e8('0x15')]()+_0xd9e8('0x65'),_0x114f42));if(_0x114f42!==_0xd9e8('0x54')&&_0x19c0ae[_0xd9e8('0x66')]){logger[_0xd9e8('0x22')]('['+_0x114f42[_0xd9e8('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xfc7622[_0xd9e8('0xc')],_0x1890a7[_0xd9e8('0x67')],_0x19c0ae[_0xd9e8('0x40')],_0x30b4de['ticketId']);}})[_0xd9e8('0x13')](function(_0x462bd1){logger[_0xd9e8('0x14')]('['+_0x114f42[_0xd9e8('0x15')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x462bd1[_0xd9e8('0x16')]);console[_0xd9e8('0x14')](_0xd9e8('0x68'),_0x462bd1);});}; \ 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 a3970a4..9ed2a75 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 _0x40c7=['destcalleridname','The\x20Enduser\x20ID\x20is:','trigger:browser:url','catch','error','unmanaged','lastevent','toUpperCase','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','Ticket\x20created!','validateEmail','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','type','idField','content','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x228b33,_0x52a6d6){var _0x258f73=function(_0x539ba2){while(--_0x539ba2){_0x228b33['push'](_0x228b33['shift']());}};_0x258f73(++_0x52a6d6);}(_0x40c7,0x1cf));var _0x740c=function(_0x218479,_0x4fb190){_0x218479=_0x218479-0x0;var _0x3b67a0=_0x40c7[_0x218479];return _0x3b67a0;};'use strict';var _=require('lodash');var rp=require(_0x740c('0x0'));var md5=require('md5');var util=require(_0x740c('0x1'));var Redis=require(_0x740c('0x2'));var intUtil=require('./util');var config=require(_0x740c('0x3'));var logger=require(_0x740c('0x4'))('freshdesk');config[_0x740c('0x5')]=_[_0x740c('0x6')](config[_0x740c('0x5')],{'host':_0x740c('0x7'),'port':0x18eb});var io=require(_0x740c('0x8'))(new Redis(config[_0x740c('0x5')]));var headers={'Content-Type':'application/json','Accept':_0x740c('0x9')};function emit(_0x19e8f8,_0x3b84c3,_0x78e3e0){io['to'](_0x19e8f8)[_0x740c('0xa')](_0x3b84c3,_0x78e3e0);}function getTicket(_0x1d08b3,_0x279712,_0x7561,_0x20c644,_0x63765d){logger[_0x740c('0xb')]('Creating\x20new\x20ticket...');var _0x461535=_[_0x740c('0xc')]({'responder_id':_0x279712['id'],'requester_id':_0x7561['id'],'name':util[_0x740c('0xd')](_0x740c('0xe'),_0x63765d[_0x740c('0xf')]),'phone':_0x63765d[_0x740c('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x740c('0x11')](_0x20c644[_0x740c('0x12')],_0x63765d,'\x20'),'description':intUtil['getString'](_0x20c644['Descriptions'],_0x63765d,'
'),'tags':getTags(_0x20c644['Tags'],'name')},getCustomFields(_0x20c644[_0x740c('0x13')],_0x63765d));_0x461535[_0x740c('0x14')]=_[_0x740c('0x15')](_[_0x740c('0x16')](_0x461535[_0x740c('0x14')],'id'),_0x740c('0x17'));return request({'uri':util[_0x740c('0xd')]('%s/api/v2/tickets',_0x1d08b3[_0x740c('0x18')]),'method':_0x740c('0x19'),'body':_0x461535})['then'](function(_0x578052){logger[_0x740c('0xb')](_0x740c('0x1a'));return _0x578052;});}function getUser(_0x66113e,_0x163619){if(intUtil[_0x740c('0x1b')](_0x163619)){return request({'uri':util['format']('%s/api/v2/agents',_0x66113e[_0x740c('0x18')]),'qs':{'email':_0x163619}})['then'](function(_0xd6997f){if(_0xd6997f[_0x740c('0x1c')]){logger['info'](_0x740c('0x1d'));return _['find'](_0xd6997f,function(_0x1a07c3){return _0x1a07c3[_0x740c('0x1e')][_0x740c('0x1f')]===_0x163619;});}else{logger[_0x740c('0xb')](_0x740c('0x20'));return request({'uri':util[_0x740c('0xd')](_0x740c('0x21'),_0x66113e['remoteUri'])})[_0x740c('0x22')](function(_0x569e89){logger[_0x740c('0xb')]('Admin\x20account\x20selected.');return _0x569e89;});}});}else{logger['info'](_0x740c('0x23'));return request({'uri':util['format'](_0x740c('0x21'),_0x66113e['remoteUri'])})[_0x740c('0x22')](function(_0x486370){logger[_0x740c('0xb')](_0x740c('0x24'));return _0x486370;});}}function getEndUser(_0x12eb41,_0x2cacac,_0x87713c){logger[_0x740c('0xb')]('Searching\x20enduser\x20with\x20phone',_0x87713c);return request({'uri':util[_0x740c('0xd')](_0x740c('0x25'),_0x12eb41['remoteUri']),'qs':{'phone':_0x87713c}})['then'](function(_0x597e34){if(_0x597e34[_0x740c('0x1c')]){logger['info'](_0x740c('0x26'));return _[_0x740c('0x27')](_0x597e34,{'phone':_0x87713c});}else{logger[_0x740c('0xb')](_0x740c('0x28'));return request({'uri':util[_0x740c('0xd')]('%s/api/v2/contacts',_0x12eb41[_0x740c('0x18')]),'method':_0x740c('0x19'),'body':{'name':_0x2cacac,'phone':_0x87713c}})[_0x740c('0x22')](function(_0x483041){logger['info'](_0x740c('0x29'));return _0x483041;});}});}function getAuth(_0x3359ea){return util[_0x740c('0xd')](_0x740c('0x2a'),new Buffer(_0x3359ea['apiKey']+':X')[_0x740c('0x2b')](_0x740c('0x2c')));}function request(_0x4a7678){logger[_0x740c('0x2d')](_0x740c('0x2e'),JSON[_0x740c('0x2f')](_0x4a7678));return rp(_['defaults'](_0x4a7678,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x26fcac,_0x14e8ec){var _0x300eb3=[];if(_0x26fcac&&_0x26fcac[_0x740c('0x1c')]>0x0){_0x300eb3=_[_0x740c('0x30')](_0x26fcac,_0x14e8ec);}return _0x300eb3;}function getCustomFields(_0xbc0393,_0x1c99cc){var _0x4699a6=[];var _0xaeae95={'custom_fields':[]};if(_0xbc0393[_0x740c('0x1c')]>0x0){_[_0x740c('0x31')](_0xbc0393,function(_0x31d34e){if(_[_0x740c('0x32')]([_0x740c('0x33'),_0x740c('0x34')],_0x31d34e['type'])&&_0x31d34e[_0x740c('0x35')]&&!_0x31d34e[_0x740c('0x36')]){_0xaeae95[_0x31d34e[_0x740c('0x35')][_0x740c('0x37')]()]=_0x31d34e['content'][_0x740c('0x2b')]();}else if(_['includes']([_0x740c('0x33'),_0x740c('0x34')],_0x31d34e[_0x740c('0x38')])&&_0x31d34e[_0x740c('0x39')]&&_0x31d34e[_0x740c('0x36')]){_0xaeae95[_0x740c('0x14')]['push']({'id':_0x31d34e[_0x740c('0x39')],'value':_0x31d34e[_0x740c('0x3a')]['toString']()});}else if(_0x31d34e[_0x740c('0x38')]===_0x740c('0x3b')&&_0x31d34e[_0x740c('0x3c')]&&_0x31d34e['idField']&&_0x31d34e['customField']){_0x1c99cc[_0x31d34e[_0x740c('0x3c')]]&&_0xaeae95[_0x740c('0x14')][_0x740c('0x3d')]({'id':_0x31d34e[_0x740c('0x39')],'value':_0x1c99cc[_0x31d34e[_0x740c('0x3c')]][_0x740c('0x2b')]()});}else if(_0x31d34e['type']===_0x740c('0x3e')&&_0x31d34e[_0x740c('0x3f')]&&_0x31d34e[_0x740c('0x3f')][_0x740c('0x40')]&&_0x31d34e[_0x740c('0x39')]&&_0x31d34e[_0x740c('0x36')]){_0x1c99cc[_0x31d34e[_0x740c('0x3f')]['name']['toLowerCase']()]&&_0xaeae95[_0x740c('0x14')][_0x740c('0x3d')]({'id':_0x31d34e[_0x740c('0x39')],'value':_0x1c99cc[_0x31d34e[_0x740c('0x3f')][_0x740c('0x40')][_0x740c('0x37')]()]['toString']()});}});}return _0xaeae95;}exports[_0x740c('0x41')]=function(_0x55e735,_0x543aea,_0x331d15,_0x2c74ea,_0x3ffac4,_0x5636cf){var _0x5799da,_0x2f84e6;_0x5636cf[_0x740c('0x18')]=intUtil[_0x740c('0x42')](_0x5636cf[_0x740c('0x18')]);_0x5636cf[_0x740c('0x43')]=intUtil[_0x740c('0x42')](_0x5636cf[_0x740c('0x43')]);if(_0x3ffac4&&_0x3ffac4[_0x740c('0x44')]){logger[_0x740c('0xb')](_0x740c('0x45'),_0x740c('0x46'));_0x543aea[_0x740c('0x47')]=util[_0x740c('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5636cf['serverUrl'],_0x543aea['uniqueid'],md5(_0x543aea[_0x740c('0x48')]));}else{_0x543aea[_0x740c('0x47')]='';}headers[_0x740c('0x49')]=getAuth(_0x5636cf);return getUser(_0x5636cf,_0x2c74ea[_0x740c('0x1f')])[_0x740c('0x22')](function(_0x21cdbf){_0x5799da=_0x21cdbf;logger[_0x740c('0xb')](_0x740c('0x4a'),_0x5799da['id']);return getEndUser(_0x5636cf,_0x543aea[_0x740c('0xf')],_0x543aea['calleridnum']);})[_0x740c('0x22')](function(_0xe98cbe){_0x2f84e6=_0xe98cbe;logger[_0x740c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2f84e6['id']);return getTicket(_0x5636cf,_0x5799da,_0x2f84e6,_0x331d15,_0x543aea);})[_0x740c('0x22')](function(_0x2991ea){if(_0x2991ea&&_0x2991ea['id']){logger[_0x740c('0xb')](_0x740c('0x1a'));logger[_0x740c('0xb')](_0x740c('0x4b'),_0x2991ea['id']);logger['info'](_0x740c('0x45'),_0x740c('0x4c'));emit(util['format'](_0x740c('0x4d'),_0x2c74ea['name']),'trigger:browser:url',{'uri':util['format'](_0x740c('0x4e'),_0x5636cf['remoteUri'],_0x2991ea['id'])});}})['catch'](function(_0x4e9f50){logger['error'](_0x740c('0x45'),JSON[_0x740c('0x2f')](_0x4e9f50));});};exports['outbound']=function(_0x245235,_0x234957,_0x4be7e3,_0x4507de,_0x39de8d,_0xad0ee0,_0x56d476){var _0x5788aa,_0x1a65bd;_0xad0ee0[_0x740c('0x18')]=intUtil[_0x740c('0x42')](_0xad0ee0[_0x740c('0x18')]);_0xad0ee0[_0x740c('0x43')]=intUtil[_0x740c('0x42')](_0xad0ee0[_0x740c('0x43')]);if(_0x56d476&&_0x56d476[_0x740c('0x4f')]&&_0x56d476[_0x740c('0x4f')]!==_0x740c('0x50')){logger[_0x740c('0xb')](_0x740c('0x51'),_0x740c('0x46'));_0x234957[_0x740c('0x47')]=util[_0x740c('0xd')](_0x740c('0x52'),_0xad0ee0[_0x740c('0x43')],_0x234957['uniqueid'],md5(_0x234957[_0x740c('0x48')]));}headers[_0x740c('0x49')]=getAuth(_0xad0ee0);return getUser(_0xad0ee0,_0x4507de['email'])[_0x740c('0x22')](function(_0x3f5f03){_0x5788aa=_0x3f5f03;logger[_0x740c('0xb')](_0x740c('0x4a'),_0x5788aa['id']);return getEndUser(_0xad0ee0,_0x234957[_0x740c('0x53')],_0x234957['destcalleridnum']);})['then'](function(_0xc925cb){_0x1a65bd=_0xc925cb;logger[_0x740c('0xb')](_0x740c('0x54'),_0x1a65bd['id']);return getTicket(_0xad0ee0,_0x5788aa,_0x1a65bd,_0x4be7e3,_0x234957);})[_0x740c('0x22')](function(_0x5f2700){if(_0x5f2700&&_0x5f2700['id']){logger[_0x740c('0xb')](_0x740c('0x1a'));logger[_0x740c('0xb')](_0x740c('0x4b'),_0x5f2700['id']);logger['info'](_0x740c('0x51'),_0x740c('0x4c'));emit(util[_0x740c('0xd')]('user:%s',_0x4507de[_0x740c('0x40')]),_0x740c('0x55'),{'uri':util[_0x740c('0xd')](_0x740c('0x4e'),_0xad0ee0[_0x740c('0x18')],_0x5f2700['id'])});}})[_0x740c('0x56')](function(_0x48ea46){logger[_0x740c('0x57')](_0x740c('0x51'),JSON[_0x740c('0x2f')](_0x48ea46));});};exports[_0x740c('0x58')]=function(_0x4b9dfa,_0x4656b0,_0x46493f,_0x26c0bf,_0x1c9745,_0x141145){var _0x1f6c40,_0x1fe0ef;_0x141145[_0x740c('0x18')]=intUtil[_0x740c('0x42')](_0x141145[_0x740c('0x18')]);_0x141145[_0x740c('0x43')]=intUtil[_0x740c('0x42')](_0x141145[_0x740c('0x43')]);if(_0x1c9745&&_0x1c9745[_0x740c('0x44')]){logger[_0x740c('0xb')]('['+_0x4656b0[_0x740c('0x59')]['toUpperCase']()+']',_0x740c('0x46'));_0x4656b0[_0x740c('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x141145['serverUrl'],_0x4656b0['uniqueid'],md5(_0x4656b0[_0x740c('0x48')]));}else{_0x4656b0[_0x740c('0x47')]='';}headers[_0x740c('0x49')]=getAuth(_0x141145);return getUser(_0x141145,'')[_0x740c('0x22')](function(_0x1a473b){_0x1f6c40=_0x1a473b;logger[_0x740c('0xb')](_0x740c('0x4a'),_0x1f6c40['id']);return getEndUser(_0x141145,_0x4656b0[_0x740c('0xf')],_0x4656b0[_0x740c('0x10')]);})[_0x740c('0x22')](function(_0x2ae491){_0x1fe0ef=_0x2ae491;logger[_0x740c('0xb')](_0x740c('0x54'),_0x1fe0ef['id']);return getTicket(_0x141145,_0x1f6c40,_0x1fe0ef,_0x46493f,_0x4656b0);})['then'](function(_0x4f62cb){if(_0x4f62cb){logger[_0x740c('0xb')]('Ticket\x20created!');logger[_0x740c('0xb')](_0x740c('0x4b'),_0x4f62cb['id']);}})[_0x740c('0x56')](function(_0x27c6a4){logger[_0x740c('0x57')]('['+_0x4656b0[_0x740c('0x59')][_0x740c('0x5a')]()+']',JSON[_0x740c('0x2f')](_0x27c6a4));});}; \ No newline at end of file +var _0x0522=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','stringify','GET','forEach','picklist','type','nameField','customField','content','includes','string','idField','variable','variableName','push','toString','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','catch','unmanaged','toUpperCase','calleridname','lodash','ioredis','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Descriptions','Tags','name','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','then','Agent\x20found!','find','contact','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','length'];(function(_0x2e2cde,_0xae730){var _0x30ea6c=function(_0x3999ca){while(--_0x3999ca){_0x2e2cde['push'](_0x2e2cde['shift']());}};_0x30ea6c(++_0xae730);}(_0x0522,0x144));var _0x2052=function(_0x53a577,_0x28c984){_0x53a577=_0x53a577-0x0;var _0x476ed0=_0x0522[_0x53a577];return _0x476ed0;};'use strict';var _=require(_0x2052('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x2052('0x1'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x2052('0x2'))(_0x2052('0x3'));config[_0x2052('0x4')]=_[_0x2052('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2052('0x6'))(new Redis(config[_0x2052('0x4')]));var headers={'Content-Type':_0x2052('0x7'),'Accept':_0x2052('0x7')};function emit(_0x3311e1,_0x5d190b,_0x27514d){io['to'](_0x3311e1)[_0x2052('0x8')](_0x5d190b,_0x27514d);}function getTicket(_0x33e2a6,_0x1f2bda,_0x421dd7,_0x2c4f83,_0x363fff){logger[_0x2052('0x9')](_0x2052('0xa'));var _0x319348=_[_0x2052('0xb')]({'responder_id':_0x1f2bda['id'],'requester_id':_0x421dd7['id'],'name':util[_0x2052('0xc')]('Caller\x20-\x20%s',_0x363fff['calleridname']),'phone':_0x363fff[_0x2052('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2052('0xe')](_0x2c4f83['Subjects'],_0x363fff,'\x20'),'description':intUtil[_0x2052('0xe')](_0x2c4f83[_0x2052('0xf')],_0x363fff,'
'),'tags':getTags(_0x2c4f83[_0x2052('0x10')],_0x2052('0x11'))},getCustomFields(_0x2c4f83['Fields'],_0x363fff));_0x319348['custom_fields']=_[_0x2052('0x12')](_[_0x2052('0x13')](_0x319348[_0x2052('0x14')],'id'),_0x2052('0x15'));return request({'uri':util[_0x2052('0xc')](_0x2052('0x16'),_0x33e2a6[_0x2052('0x17')]),'method':'POST','body':_0x319348})['then'](function(_0x42cf0e){logger[_0x2052('0x9')](_0x2052('0x18'));return _0x42cf0e;});}function getUser(_0x9a21f2,_0x31a153){if(intUtil[_0x2052('0x19')](_0x31a153)){return request({'uri':util[_0x2052('0xc')]('%s/api/v2/agents',_0x9a21f2[_0x2052('0x17')]),'qs':{'email':_0x31a153}})[_0x2052('0x1a')](function(_0x29c2dd){if(_0x29c2dd['length']){logger['info'](_0x2052('0x1b'));return _[_0x2052('0x1c')](_0x29c2dd,function(_0x1e529c){return _0x1e529c[_0x2052('0x1d')]['email']===_0x31a153;});}else{logger[_0x2052('0x9')](_0x2052('0x1e'));return request({'uri':util['format'](_0x2052('0x1f'),_0x9a21f2[_0x2052('0x17')])})['then'](function(_0x549a4f){logger[_0x2052('0x9')](_0x2052('0x20'));return _0x549a4f;});}});}else{logger[_0x2052('0x9')](_0x2052('0x21'));return request({'uri':util['format'](_0x2052('0x1f'),_0x9a21f2['remoteUri'])})['then'](function(_0x5c1af8){logger[_0x2052('0x9')](_0x2052('0x20'));return _0x5c1af8;});}}function getEndUser(_0xb6ccaa,_0x2595e2,_0x47447f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x47447f);return request({'uri':util[_0x2052('0xc')](_0x2052('0x22'),_0xb6ccaa[_0x2052('0x17')]),'qs':{'phone':_0x47447f}})[_0x2052('0x1a')](function(_0x2b00c8){if(_0x2b00c8[_0x2052('0x23')]){logger['info'](_0x2052('0x24'));return _[_0x2052('0x1c')](_0x2b00c8,{'phone':_0x47447f});}else{logger[_0x2052('0x9')](_0x2052('0x25'));return request({'uri':util[_0x2052('0xc')](_0x2052('0x22'),_0xb6ccaa[_0x2052('0x17')]),'method':_0x2052('0x26'),'body':{'name':_0x2595e2,'phone':_0x47447f}})[_0x2052('0x1a')](function(_0x393809){logger[_0x2052('0x9')](_0x2052('0x27'));return _0x393809;});}});}function getAuth(_0x2b0421){return util['format'](_0x2052('0x28'),new Buffer(_0x2b0421[_0x2052('0x29')]+':X')['toString'](_0x2052('0x2a')));}function request(_0x4b38db){logger[_0x2052('0x2b')]('[HTTP]',JSON[_0x2052('0x2c')](_0x4b38db));return rp(_[_0x2052('0x5')](_0x4b38db,{'method':_0x2052('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x35ee44,_0x22a847){var _0x385843=[];if(_0x35ee44&&_0x35ee44[_0x2052('0x23')]>0x0){_0x385843=_['map'](_0x35ee44,_0x22a847);}return _0x385843;}function getCustomFields(_0x5092db,_0x506999){var _0x52cc99=[];var _0x280a85={'custom_fields':[]};if(_0x5092db[_0x2052('0x23')]>0x0){_[_0x2052('0x2e')](_0x5092db,function(_0x35af90){if(_['includes'](['string',_0x2052('0x2f')],_0x35af90[_0x2052('0x30')])&&_0x35af90[_0x2052('0x31')]&&!_0x35af90[_0x2052('0x32')]){_0x280a85[_0x35af90[_0x2052('0x31')]['toLowerCase']()]=_0x35af90[_0x2052('0x33')]['toString']();}else if(_[_0x2052('0x34')]([_0x2052('0x35'),'picklist'],_0x35af90[_0x2052('0x30')])&&_0x35af90['idField']&&_0x35af90[_0x2052('0x32')]){_0x280a85[_0x2052('0x14')]['push']({'id':_0x35af90[_0x2052('0x36')],'value':_0x35af90[_0x2052('0x33')]['toString']()});}else if(_0x35af90[_0x2052('0x30')]===_0x2052('0x37')&&_0x35af90['variableName']&&_0x35af90[_0x2052('0x36')]&&_0x35af90['customField']){_0x506999[_0x35af90[_0x2052('0x38')]]&&_0x280a85['custom_fields'][_0x2052('0x39')]({'id':_0x35af90[_0x2052('0x36')],'value':_0x506999[_0x35af90[_0x2052('0x38')]][_0x2052('0x3a')]()});}else if(_0x35af90['type']===_0x2052('0x3b')&&_0x35af90[_0x2052('0x3c')]&&_0x35af90[_0x2052('0x3c')][_0x2052('0x11')]&&_0x35af90[_0x2052('0x36')]&&_0x35af90['customField']){_0x506999[_0x35af90[_0x2052('0x3c')][_0x2052('0x11')][_0x2052('0x3d')]()]&&_0x280a85[_0x2052('0x14')][_0x2052('0x39')]({'id':_0x35af90[_0x2052('0x36')],'value':_0x506999[_0x35af90[_0x2052('0x3c')][_0x2052('0x11')][_0x2052('0x3d')]()][_0x2052('0x3a')]()});}});}return _0x280a85;}exports[_0x2052('0x3e')]=function(_0x4a013d,_0x5c04c3,_0x41fa88,_0x526257,_0x4d254d,_0x2f80cc){var _0x42d2e6,_0x27638a;_0x2f80cc['remoteUri']=intUtil[_0x2052('0x3f')](_0x2f80cc['remoteUri']);_0x2f80cc[_0x2052('0x40')]=intUtil[_0x2052('0x3f')](_0x2f80cc[_0x2052('0x40')]);if(_0x4d254d&&_0x4d254d[_0x2052('0x41')]){logger[_0x2052('0x9')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5c04c3[_0x2052('0x42')]=util[_0x2052('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f80cc[_0x2052('0x40')],_0x5c04c3[_0x2052('0x43')],md5(_0x5c04c3[_0x2052('0x43')]));}else{_0x5c04c3[_0x2052('0x42')]='';}headers[_0x2052('0x44')]=getAuth(_0x2f80cc);return getUser(_0x2f80cc,_0x526257['email'])[_0x2052('0x1a')](function(_0x2e37e1){_0x42d2e6=_0x2e37e1;logger['info'](_0x2052('0x45'),_0x42d2e6['id']);return getEndUser(_0x2f80cc,_0x5c04c3['calleridname'],_0x5c04c3[_0x2052('0xd')]);})[_0x2052('0x1a')](function(_0x1a1e48){_0x27638a=_0x1a1e48;logger[_0x2052('0x9')](_0x2052('0x46'),_0x27638a['id']);return getTicket(_0x2f80cc,_0x42d2e6,_0x27638a,_0x41fa88,_0x5c04c3);})[_0x2052('0x1a')](function(_0xbb1669){if(_0xbb1669&&_0xbb1669['id']){logger[_0x2052('0x9')]('Ticket\x20created!');logger[_0x2052('0x9')](_0x2052('0x47'),_0xbb1669['id']);logger[_0x2052('0x9')]('[QUEUE]',_0x2052('0x48'));emit(util[_0x2052('0xc')](_0x2052('0x49'),_0x526257['name']),'trigger:browser:url',{'uri':util[_0x2052('0xc')](_0x2052('0x4a'),_0x2f80cc[_0x2052('0x17')],_0xbb1669['id'])});}})['catch'](function(_0x17c03d){logger[_0x2052('0x4b')](_0x2052('0x4c'),JSON['stringify'](_0x17c03d));});};exports[_0x2052('0x4d')]=function(_0x4bb7c6,_0x5e4583,_0x59236b,_0x2ecaf6,_0x5710cd,_0x33dbef,_0x974638){var _0x54a13f,_0x521e86;_0x33dbef[_0x2052('0x17')]=intUtil[_0x2052('0x3f')](_0x33dbef['remoteUri']);_0x33dbef[_0x2052('0x40')]=intUtil[_0x2052('0x3f')](_0x33dbef['serverUrl']);if(_0x974638&&_0x974638[_0x2052('0x4e')]&&_0x974638[_0x2052('0x4e')]!==_0x2052('0x4f')){logger['info'](_0x2052('0x50'),_0x2052('0x51'));_0x5e4583[_0x2052('0x42')]=util[_0x2052('0xc')](_0x2052('0x52'),_0x33dbef['serverUrl'],_0x5e4583[_0x2052('0x43')],md5(_0x5e4583[_0x2052('0x43')]));}headers[_0x2052('0x44')]=getAuth(_0x33dbef);return getUser(_0x33dbef,_0x2ecaf6[_0x2052('0x53')])[_0x2052('0x1a')](function(_0x5745f7){_0x54a13f=_0x5745f7;logger['info'](_0x2052('0x45'),_0x54a13f['id']);return getEndUser(_0x33dbef,_0x5e4583[_0x2052('0x54')],_0x5e4583[_0x2052('0x55')]);})['then'](function(_0x1b5cb4){_0x521e86=_0x1b5cb4;logger[_0x2052('0x9')](_0x2052('0x46'),_0x521e86['id']);return getTicket(_0x33dbef,_0x54a13f,_0x521e86,_0x59236b,_0x5e4583);})['then'](function(_0x1f2980){if(_0x1f2980&&_0x1f2980['id']){logger['info'](_0x2052('0x18'));logger['info'](_0x2052('0x47'),_0x1f2980['id']);logger[_0x2052('0x9')](_0x2052('0x50'),_0x2052('0x48'));emit(util[_0x2052('0xc')](_0x2052('0x49'),_0x2ecaf6['name']),'trigger:browser:url',{'uri':util[_0x2052('0xc')](_0x2052('0x4a'),_0x33dbef[_0x2052('0x17')],_0x1f2980['id'])});}})[_0x2052('0x56')](function(_0x1ecd57){logger[_0x2052('0x4b')](_0x2052('0x50'),JSON[_0x2052('0x2c')](_0x1ecd57));});};exports[_0x2052('0x57')]=function(_0x34d329,_0xa3ef3,_0x3d7db0,_0x233e6b,_0x4ce01b,_0xe97c91){var _0x54f577,_0x48839d;_0xe97c91['remoteUri']=intUtil['stripTrailingSlash'](_0xe97c91[_0x2052('0x17')]);_0xe97c91[_0x2052('0x40')]=intUtil[_0x2052('0x3f')](_0xe97c91[_0x2052('0x40')]);if(_0x4ce01b&&_0x4ce01b['monitor_format']){logger[_0x2052('0x9')]('['+_0xa3ef3['lastevent'][_0x2052('0x58')]()+']','Recording\x20is\x20enabled!');_0xa3ef3['recordingURL']=util[_0x2052('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe97c91[_0x2052('0x40')],_0xa3ef3[_0x2052('0x43')],md5(_0xa3ef3[_0x2052('0x43')]));}else{_0xa3ef3['recordingURL']='';}headers[_0x2052('0x44')]=getAuth(_0xe97c91);return getUser(_0xe97c91,'')[_0x2052('0x1a')](function(_0x283a7f){_0x54f577=_0x283a7f;logger['info'](_0x2052('0x45'),_0x54f577['id']);return getEndUser(_0xe97c91,_0xa3ef3[_0x2052('0x59')],_0xa3ef3[_0x2052('0xd')]);})[_0x2052('0x1a')](function(_0x20f64e){_0x48839d=_0x20f64e;logger['info'](_0x2052('0x46'),_0x48839d['id']);return getTicket(_0xe97c91,_0x54f577,_0x48839d,_0x3d7db0,_0xa3ef3);})[_0x2052('0x1a')](function(_0x5327c2){if(_0x5327c2){logger[_0x2052('0x9')]('Ticket\x20created!');logger[_0x2052('0x9')](_0x2052('0x47'),_0x5327c2['id']);}})[_0x2052('0x56')](function(_0x40c041){logger[_0x2052('0x4b')]('['+_0xa3ef3['lastevent'][_0x2052('0x58')]()+']',JSON[_0x2052('0x2c')](_0x40c041));});}; \ 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 745c833..f1f6a29 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 _0x0c89=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Contact','add','ticketId','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x42c9fb,_0x4d7748){var _0x1bac27=function(_0x90c9b8){while(--_0x90c9b8){_0x42c9fb['push'](_0x42c9fb['shift']());}};_0x1bac27(++_0x4d7748);}(_0x0c89,0x15b));var _0x90c8=function(_0x3dc0ed,_0x368f6b){_0x3dc0ed=_0x3dc0ed-0x0;var _0x4b8388=_0x0c89[_0x3dc0ed];return _0x4b8388;};'use strict';var _=require(_0x90c8('0x0'));var rp=require('request-promise');var md5=require(_0x90c8('0x1'));var util=require(_0x90c8('0x2'));var moment=require('moment');var Promise=require(_0x90c8('0x3'));var Redis=require(_0x90c8('0x4'));var intUtil=require('./util');var config=require(_0x90c8('0x5'));var logger=require(_0x90c8('0x6'))(_0x90c8('0x7'));config[_0x90c8('0x8')]=_[_0x90c8('0x9')](config[_0x90c8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x90c8('0xa'))(new Redis(config[_0x90c8('0x8')]));function getAdminId(_0x249391,_0x2e10d7,_0x41bbb8,_0x173950){return new Promise(function(_0x438ca7,_0x4cbc3c){var _0x560146=![];var _0x5b05ba={'method':_0x90c8('0xb'),'uri':_0x173950+_0x90c8('0xc'),'json':!![]};_0x5b05ba[_0x90c8('0xd')]=_0x41bbb8;logger[_0x90c8('0xe')](_0x90c8('0xf'));return rp(_0x5b05ba)[_0x90c8('0x10')](function(_0x2c4390){if(_0x2c4390){var _0x3b0447=_0x2c4390[_0x90c8('0x11')];var _0x45de6c=null;for(_0x45de6c=0x0;_0x45de6c<_0x3b0447[_0x90c8('0x12')];_0x45de6c++){if(_0x3b0447[_0x45de6c][_0x90c8('0x13')]===_0x249391[_0x90c8('0x14')]){_0x249391[_0x90c8('0x15')]=_0x3b0447[_0x45de6c]['id'];_0x560146=!![];}}if(_0x560146){logger['info'](_0x90c8('0x16'),_0x249391[_0x90c8('0x15')]);_0x438ca7(_0x249391);}else{_0x4cbc3c({'statusCode':0x194,'message':_0x90c8('0x17')});}}else{_0x4cbc3c({'statusCode':0x194,'message':_0x90c8('0x17')});}})[_0x90c8('0x18')](function(_0x358618){logger[_0x90c8('0x19')]('['+[_0x2e10d7[_0x90c8('0x1a')]()]+']',_0x358618[_0x90c8('0x1b')]);_0x4cbc3c(_0x358618);});});}function getUser(_0xec22a2,_0x110f69,_0x2726a1){return function(_0x45cd34){return new Promise(function(_0x333bde,_0x128d8c){var _0x43d28e={'method':'GET','uri':_0x2726a1+'/api/selector/owners','json':!![]};_0x43d28e['headers']=_0x110f69;logger[_0x90c8('0xe')](_0x90c8('0x1c'));return rp(_0x43d28e)[_0x90c8('0x10')](function(_0x59dfc1){if(_0x59dfc1){var _0x2963b5=_0x59dfc1[_0x90c8('0x11')];var _0x2c2878=![];var _0x388dbe=null;if(_0x45cd34[_0x90c8('0x1d')]!==null){logger['info'](_0x90c8('0x1e'),_0x45cd34[_0x90c8('0x1d')]);_0x45cd34['userEmail']=_0x45cd34['agentEmail'];for(_0x388dbe=0x0;_0x388dbe<_0x2963b5[_0x90c8('0x12')];_0x388dbe++){if(_0x2963b5[_0x388dbe][_0x90c8('0x13')]===_0x45cd34['agentEmail']){_0x2c2878=!![];_0x45cd34[_0x90c8('0x1f')]=_0x2963b5[_0x388dbe]['id'];logger['info'](_0x90c8('0x20'),_0x45cd34[_0x90c8('0x1f')]);}}}if(!_0x2c2878){logger[_0x90c8('0xe')](_0x90c8('0x21'));_0x45cd34[_0x90c8('0x22')]=_0x45cd34[_0x90c8('0x14')];_0x45cd34[_0x90c8('0x1f')]=_0x45cd34[_0x90c8('0x15')];_0x2c2878=!![];}if(_0x2c2878){_0x333bde(_0x45cd34);}else{_0x128d8c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x128d8c({'statusCode':0x194,'message':_0x90c8('0x17')});}})[_0x90c8('0x18')](function(_0x5c3366){logger[_0x90c8('0x19')]('['+[_0xec22a2[_0x90c8('0x1a')]()]+']',_0x5c3366[_0x90c8('0x1b')]);_0x128d8c(_0x5c3366);});});};}function searchContact(_0x372f13,_0x5d5387,_0x1b106c,_0x382b0b){return new Promise(function(_0x40e6f4,_0x492314){var _0x52556c={'method':_0x90c8('0xb'),'headers':_0x5d5387,'uri':_0x372f13+'/api/lookup?q='+_0x382b0b+_0x90c8('0x23')+_0x1b106c+_0x90c8('0x24'),'json':!![]};rp(_0x52556c)[_0x90c8('0x10')](function(_0x6a299){var _0xbc3055=_[_0x90c8('0x25')](_0x6a299[_0x90c8('0x26')][_0x90c8('0x26')],[_0x1b106c,_0x382b0b]);_0x40e6f4(_0xbc3055);})[_0x90c8('0x18')](function(_0x21cc1b){_0x492314(_0x21cc1b);});});}function getEndUser(_0x13e9f2,_0x4bd606,_0x5aad55){return function(_0x36fdb7){return new Promise(function(_0x3ca245,_0x29d987){logger[_0x90c8('0xe')](util[_0x90c8('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x36fdb7[_0x90c8('0x28')]));searchContact(_0x5aad55,_0x4bd606,_0x90c8('0x29'),_0x36fdb7[_0x90c8('0x28')])[_0x90c8('0x10')](function(_0x3930d4){if(_0x3930d4){_0x36fdb7[_0x90c8('0x2a')]=_0x3930d4['id'];logger[_0x90c8('0xe')](_0x90c8('0x2b'),_0x36fdb7['endUserId']);return _0x3ca245(_0x36fdb7);}searchContact(_0x5aad55,_0x4bd606,_0x90c8('0x2c'),_0x36fdb7[_0x90c8('0x28')])['then'](function(_0x3c695b){if(_0x3c695b){_0x36fdb7['endUserId']=_0x3c695b['id'];logger[_0x90c8('0xe')]('Contact\x20found\x20work_number:',_0x36fdb7[_0x90c8('0x2a')]);return _0x3ca245(_0x36fdb7);}createEndUser(_0x36fdb7,_0x13e9f2,_0x4bd606,_0x5aad55)[_0x90c8('0x10')](function(_0xe600c5){logger['info'](_0x90c8('0x2d'),_0xe600c5[_0x90c8('0x2a')]);return _0x3ca245(_0xe600c5);});});})['catch'](function(_0x557d24){_0x29d987(_0x557d24);});});};}function createEndUser(_0x5f3907,_0x144166,_0x1ff1fa,_0x45a857){return new Promise(function(_0x49b0d7,_0x170782){var _0x122601=moment();var _0x4dcf9f={'method':_0x90c8('0x2e'),'uri':_0x45a857+'/api/contacts','body':{'contact':{'last_name':_0x5f3907[_0x90c8('0x28')],'work_number':_0x5f3907[_0x90c8('0x28')],'mobile_number':_0x5f3907['contactNumber'],'owner_id':_0x5f3907[_0x90c8('0x1f')],'created_at':_0x122601[_0x90c8('0x27')](_0x90c8('0x2f'))}},'json':!![]};_0x4dcf9f['headers']=_0x1ff1fa;logger[_0x90c8('0xe')](_0x90c8('0x30'));return rp(_0x4dcf9f)['then'](function(_0x4013f4){_0x5f3907[_0x90c8('0x2a')]=_0x4013f4[_0x90c8('0x31')]['id'];_0x49b0d7(_0x5f3907);})[_0x90c8('0x18')](function(_0x44f9da){logger['error']('['+[_0x144166[_0x90c8('0x1a')]()]+']',_0x44f9da[_0x90c8('0x1b')]);_0x170782(_0x44f9da['message']);});});}function getTicket(_0x133f59,_0x48ff43,_0x2d2e70,_0x4fdaa9,_0xa41987){return function(_0x56d8d2){logger[_0x90c8('0xe')](_0x90c8('0x32'));return new Promise(function(_0x46dcf0,_0x5ce5a3){var _0x368d62=moment();var _0x3c81e0={'method':'POST','uri':_0x2d2e70+'/api/tasks','body':{'title':intUtil['getString'](_0x4fdaa9[_0x90c8('0x33')],_0xa41987,'\x20'),'description':intUtil[_0x90c8('0x34')](_0x4fdaa9['Descriptions'],_0xa41987,'\x0a'),'owner_id':_0x56d8d2[_0x90c8('0x1f')],'creater_id':_0x56d8d2['adminId'],'targetable_id':_0x56d8d2[_0x90c8('0x2a')],'targetable_type':_0x90c8('0x35'),'created_at':_0x368d62['format'](_0x90c8('0x2f')),'due_date':_0x368d62[_0x90c8('0x36')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3c81e0['headers']=_0x48ff43;return rp(_0x3c81e0)['then'](function(_0x52699a){_0x56d8d2[_0x90c8('0x37')]=_0x52699a['task']['id'];logger[_0x90c8('0xe')](_0x90c8('0x38'),_0x56d8d2[_0x90c8('0x37')]);_0x46dcf0(_0x56d8d2);})[_0x90c8('0x18')](function(_0xe200bc){logger[_0x90c8('0x19')]('['+[_0x133f59[_0x90c8('0x1a')]()]+']',_0xe200bc[_0x90c8('0x1b')]);_0x5ce5a3(_0xe200bc[_0x90c8('0x1b')]);});});};}function emit(_0x2f6666,_0x19a5b5,_0x2abf20){var _0x14925b={'uri':_0x2f6666+'/contacts/'+_0x2abf20};io['to'](util[_0x90c8('0x27')]('user:%s',_0x19a5b5))[_0x90c8('0x39')](_0x90c8('0x3a'),_0x14925b);}exports['cs']=function(_0x834016,_0x51b403,_0xb10d0,_0x52ce79,_0x431e28,_0x433333,_0x2c325b,_0xadd1f){var _0x1652e8={};var _0x1cbc38={'Authorization':_0x90c8('0x3b')+_0x433333[_0x90c8('0x3c')]};_0x433333['remoteUri']=intUtil[_0x90c8('0x3d')](_0x433333['remoteUri']);_0x433333['serverUrl']=intUtil[_0x90c8('0x3d')](_0x433333[_0x90c8('0x3e')]);var _0xc5170f=_0x433333[_0x90c8('0x3f')];_0x1652e8[_0x90c8('0x14')]=_0x433333[_0x90c8('0x40')];_0x1652e8[_0x90c8('0x28')]=_0xadd1f[_0x90c8('0x41')]()===_0x90c8('0x42')?_0x51b403['destcalleridnum']:_0x51b403[_0x90c8('0x43')];_0x1652e8[_0x90c8('0x44')]=_0xadd1f===_0x90c8('0x45')||_0xadd1f===_0x90c8('0x46')?_0x90c8('0x45'):_0x90c8('0x42');if(_0x52ce79){_0x1652e8[_0x90c8('0x1d')]=_0x52ce79[_0x90c8('0x13')];}var _0x13af04=util[_0x90c8('0x27')](_0x90c8('0x47'),_0x433333[_0x90c8('0x3e')],_0x51b403['uniqueid'],md5(_0x51b403[_0x90c8('0x48')]));if(_0x431e28&&_0x431e28[_0x90c8('0x49')]){logger[_0x90c8('0xe')](_0x90c8('0x4a'),_0x90c8('0x4b'));_0x51b403[_0x90c8('0x4c')]=_0x13af04;}else if(_0x2c325b&&_0x2c325b[_0x90c8('0x4d')]&&_0x2c325b[_0x90c8('0x4d')]!==_0x90c8('0x4e')){logger[_0x90c8('0xe')](_0x90c8('0x4f'),_0x90c8('0x4b'));_0x51b403[_0x90c8('0x4c')]=_0x13af04;}else{_0x51b403[_0x90c8('0x4c')]='';}return getAdminId(_0x1652e8,_0xadd1f,_0x1cbc38,_0xc5170f)[_0x90c8('0x10')](getUser(_0xadd1f,_0x1cbc38,_0xc5170f))[_0x90c8('0x10')](getEndUser(_0xadd1f,_0x1cbc38,_0xc5170f))['then'](getTicket(_0xadd1f,_0x1cbc38,_0xc5170f,_0xb10d0,_0x51b403))[_0x90c8('0x10')](function(_0x1f6d1d){logger[_0x90c8('0xe')](util[_0x90c8('0x27')](_0x90c8('0x50'),_0x1f6d1d[_0x90c8('0x37')]));if(_0xadd1f!=='unmanaged'){logger[_0x90c8('0xe')]('['+[_0xadd1f[_0x90c8('0x1a')]()]+']',_0x90c8('0x51'));emit(_0xc5170f,_0x52ce79[_0x90c8('0x52')],_0x1f6d1d[_0x90c8('0x2a')]);}})[_0x90c8('0x18')](function(_0x594ef6){logger[_0x90c8('0x19')]('['+[_0xadd1f['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x90c8('0x53')](_0x594ef6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x835a=['toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name','inspect','lodash','request-promise','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','redis','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','Admin\x20selected','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','POST','/api/tasks','getString','Subjects','Contact','add','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','serverUrl','remoteUri','username'];(function(_0x3139a8,_0x5636c4){var _0x596b69=function(_0x2488d0){while(--_0x2488d0){_0x3139a8['push'](_0x3139a8['shift']());}};_0x596b69(++_0x5636c4);}(_0x835a,0x1b4));var _0xa835=function(_0x2af230,_0x332df5){_0x2af230=_0x2af230-0x0;var _0xec43a1=_0x835a[_0x2af230];return _0xec43a1;};'use strict';var _=require(_0xa835('0x0'));var rp=require(_0xa835('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xa835('0x2'));var Promise=require(_0xa835('0x3'));var Redis=require(_0xa835('0x4'));var intUtil=require('./util');var config=require(_0xa835('0x5'));var logger=require(_0xa835('0x6'))(_0xa835('0x7'));config['redis']=_[_0xa835('0x8')](config['redis'],{'host':_0xa835('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa835('0xa')]));function getAdminId(_0xdb9402,_0x4d1990,_0x1d8c11,_0x47141b){return new Promise(function(_0x3d3107,_0x3e1490){var _0x408aee=![];var _0x4ff889={'method':_0xa835('0xb'),'uri':_0x47141b+_0xa835('0xc'),'json':!![]};_0x4ff889[_0xa835('0xd')]=_0x1d8c11;logger[_0xa835('0xe')](_0xa835('0xf'));return rp(_0x4ff889)[_0xa835('0x10')](function(_0x45d42d){if(_0x45d42d){var _0x2dcc69=_0x45d42d[_0xa835('0x11')];var _0x31fcdd=null;for(_0x31fcdd=0x0;_0x31fcdd<_0x2dcc69[_0xa835('0x12')];_0x31fcdd++){if(_0x2dcc69[_0x31fcdd][_0xa835('0x13')]===_0xdb9402[_0xa835('0x14')]){_0xdb9402[_0xa835('0x15')]=_0x2dcc69[_0x31fcdd]['id'];_0x408aee=!![];}}if(_0x408aee){logger[_0xa835('0xe')](_0xa835('0x16'),_0xdb9402[_0xa835('0x15')]);_0x3d3107(_0xdb9402);}else{_0x3e1490({'statusCode':0x194,'message':_0xa835('0x17')});}}else{_0x3e1490({'statusCode':0x194,'message':_0xa835('0x17')});}})['catch'](function(_0x3941da){logger[_0xa835('0x18')]('['+[_0x4d1990[_0xa835('0x19')]()]+']',_0x3941da[_0xa835('0x1a')]);_0x3e1490(_0x3941da);});});}function getUser(_0x36062b,_0x2e066f,_0x2fd2d8){return function(_0x26af7c){return new Promise(function(_0x5f5b6e,_0x5ca81d){var _0x306f7a={'method':'GET','uri':_0x2fd2d8+'/api/selector/owners','json':!![]};_0x306f7a[_0xa835('0xd')]=_0x2e066f;logger[_0xa835('0xe')](_0xa835('0x1b'));return rp(_0x306f7a)[_0xa835('0x10')](function(_0x5916ef){if(_0x5916ef){var _0x401ecf=_0x5916ef[_0xa835('0x11')];var _0x2efd49=![];var _0x1ea1fe=null;if(_0x26af7c['agentEmail']!==null){logger[_0xa835('0xe')](_0xa835('0x1c'),_0x26af7c['agentEmail']);_0x26af7c[_0xa835('0x1d')]=_0x26af7c[_0xa835('0x1e')];for(_0x1ea1fe=0x0;_0x1ea1fe<_0x401ecf[_0xa835('0x12')];_0x1ea1fe++){if(_0x401ecf[_0x1ea1fe][_0xa835('0x13')]===_0x26af7c['agentEmail']){_0x2efd49=!![];_0x26af7c[_0xa835('0x1f')]=_0x401ecf[_0x1ea1fe]['id'];logger[_0xa835('0xe')]('User\x20found:',_0x26af7c['userId']);}}}if(!_0x2efd49){logger[_0xa835('0xe')](_0xa835('0x20'));_0x26af7c[_0xa835('0x1d')]=_0x26af7c['adminEmail'];_0x26af7c[_0xa835('0x1f')]=_0x26af7c[_0xa835('0x15')];_0x2efd49=!![];}if(_0x2efd49){_0x5f5b6e(_0x26af7c);}else{_0x5ca81d({'statusCode':0x194,'message':_0xa835('0x17')});}}else{_0x5ca81d({'statusCode':0x194,'message':_0xa835('0x17')});}})[_0xa835('0x21')](function(_0x243250){logger[_0xa835('0x18')]('['+[_0x36062b['toUpperCase']()]+']',_0x243250[_0xa835('0x1a')]);_0x5ca81d(_0x243250);});});};}function searchContact(_0x48fb77,_0x2d142a,_0x594c0c,_0x606241){return new Promise(function(_0x1b871a,_0x209d10){var _0x4846e7={'method':_0xa835('0xb'),'headers':_0x2d142a,'uri':_0x48fb77+_0xa835('0x22')+_0x606241+_0xa835('0x23')+_0x594c0c+_0xa835('0x24'),'json':!![]};rp(_0x4846e7)[_0xa835('0x10')](function(_0x4bbd3d){var _0x549f61=_[_0xa835('0x25')](_0x4bbd3d[_0xa835('0x26')][_0xa835('0x26')],[_0x594c0c,_0x606241]);_0x1b871a(_0x549f61);})[_0xa835('0x21')](function(_0x2a7a09){_0x209d10(_0x2a7a09);});});}function getEndUser(_0x17dcd6,_0x3241db,_0x7dbfee){return function(_0x5cc3d6){return new Promise(function(_0x271bef,_0x19aa20){logger[_0xa835('0xe')](util[_0xa835('0x27')](_0xa835('0x28'),_0x5cc3d6['contactNumber']));searchContact(_0x7dbfee,_0x3241db,_0xa835('0x29'),_0x5cc3d6[_0xa835('0x2a')])[_0xa835('0x10')](function(_0x560173){if(_0x560173){_0x5cc3d6[_0xa835('0x2b')]=_0x560173['id'];logger['info'](_0xa835('0x2c'),_0x5cc3d6[_0xa835('0x2b')]);return _0x271bef(_0x5cc3d6);}searchContact(_0x7dbfee,_0x3241db,_0xa835('0x2d'),_0x5cc3d6['contactNumber'])[_0xa835('0x10')](function(_0x1365fa){if(_0x1365fa){_0x5cc3d6[_0xa835('0x2b')]=_0x1365fa['id'];logger['info'](_0xa835('0x2e'),_0x5cc3d6[_0xa835('0x2b')]);return _0x271bef(_0x5cc3d6);}createEndUser(_0x5cc3d6,_0x17dcd6,_0x3241db,_0x7dbfee)[_0xa835('0x10')](function(_0xa9357b){logger['info'](_0xa835('0x2f'),_0xa9357b[_0xa835('0x2b')]);return _0x271bef(_0xa9357b);});});})[_0xa835('0x21')](function(_0x16529d){_0x19aa20(_0x16529d);});});};}function createEndUser(_0x13d855,_0x2c02d6,_0x532a1e,_0x4facdd){return new Promise(function(_0x28f543,_0x4af7c6){var _0x571cc3=moment();var _0x5a78ba={'method':'POST','uri':_0x4facdd+_0xa835('0x30'),'body':{'contact':{'last_name':_0x13d855[_0xa835('0x2a')],'work_number':_0x13d855['contactNumber'],'mobile_number':_0x13d855[_0xa835('0x2a')],'owner_id':_0x13d855[_0xa835('0x1f')],'created_at':_0x571cc3[_0xa835('0x27')](_0xa835('0x31'))}},'json':!![]};_0x5a78ba[_0xa835('0xd')]=_0x532a1e;logger[_0xa835('0xe')](_0xa835('0x32'));return rp(_0x5a78ba)[_0xa835('0x10')](function(_0x3128f2){_0x13d855[_0xa835('0x2b')]=_0x3128f2['contact']['id'];_0x28f543(_0x13d855);})[_0xa835('0x21')](function(_0x577e32){logger['error']('['+[_0x2c02d6[_0xa835('0x19')]()]+']',_0x577e32['message']);_0x4af7c6(_0x577e32[_0xa835('0x1a')]);});});}function getTicket(_0xcd6c0c,_0xc2f65a,_0x4d0f5e,_0x4ff904,_0x1a8dbc){return function(_0xf9ba8d){logger[_0xa835('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x4e6ace,_0x3eec3c){var _0x404eca=moment();var _0x22420f={'method':_0xa835('0x33'),'uri':_0x4d0f5e+_0xa835('0x34'),'body':{'title':intUtil[_0xa835('0x35')](_0x4ff904[_0xa835('0x36')],_0x1a8dbc,'\x20'),'description':intUtil[_0xa835('0x35')](_0x4ff904['Descriptions'],_0x1a8dbc,'\x0a'),'owner_id':_0xf9ba8d[_0xa835('0x1f')],'creater_id':_0xf9ba8d['adminId'],'targetable_id':_0xf9ba8d['endUserId'],'targetable_type':_0xa835('0x37'),'created_at':_0x404eca[_0xa835('0x27')](_0xa835('0x31')),'due_date':_0x404eca[_0xa835('0x38')](0x1e,'m')['format'](_0xa835('0x31'))},'json':!![]};_0x22420f['headers']=_0xc2f65a;return rp(_0x22420f)[_0xa835('0x10')](function(_0x5e0394){_0xf9ba8d['ticketId']=_0x5e0394[_0xa835('0x39')]['id'];logger[_0xa835('0xe')](_0xa835('0x3a'),_0xf9ba8d[_0xa835('0x3b')]);_0x4e6ace(_0xf9ba8d);})[_0xa835('0x21')](function(_0x110937){logger[_0xa835('0x18')]('['+[_0xcd6c0c[_0xa835('0x19')]()]+']',_0x110937[_0xa835('0x1a')]);_0x3eec3c(_0x110937[_0xa835('0x1a')]);});});};}function emit(_0x5875ea,_0x3da993,_0x361d47){var _0x4c6af0={'uri':_0x5875ea+'/contacts/'+_0x361d47};io['to'](util[_0xa835('0x27')](_0xa835('0x3c'),_0x3da993))[_0xa835('0x3d')](_0xa835('0x3e'),_0x4c6af0);}exports['cs']=function(_0x5e1bca,_0x49577a,_0x3f1495,_0x22bfea,_0x20bc4b,_0x2c5aef,_0x591e9b,_0x37620b){var _0x220aee={};var _0x3e44ff={'Authorization':_0xa835('0x3f')+_0x2c5aef[_0xa835('0x40')]};_0x2c5aef['remoteUri']=intUtil['stripTrailingSlash'](_0x2c5aef['remoteUri']);_0x2c5aef[_0xa835('0x41')]=intUtil['stripTrailingSlash'](_0x2c5aef[_0xa835('0x41')]);var _0x544ff1=_0x2c5aef[_0xa835('0x42')];_0x220aee[_0xa835('0x14')]=_0x2c5aef[_0xa835('0x43')];_0x220aee[_0xa835('0x2a')]=_0x37620b[_0xa835('0x44')]()===_0xa835('0x45')?_0x49577a[_0xa835('0x46')]:_0x49577a[_0xa835('0x47')];_0x220aee[_0xa835('0x48')]=_0x37620b===_0xa835('0x49')||_0x37620b===_0xa835('0x4a')?_0xa835('0x49'):'outbound';if(_0x22bfea){_0x220aee[_0xa835('0x1e')]=_0x22bfea[_0xa835('0x13')];}var _0x3b0a68=util[_0xa835('0x27')](_0xa835('0x4b'),_0x2c5aef[_0xa835('0x41')],_0x49577a['uniqueid'],md5(_0x49577a['uniqueid']));if(_0x20bc4b&&_0x20bc4b[_0xa835('0x4c')]){logger['info']('[QUEUE]',_0xa835('0x4d'));_0x49577a[_0xa835('0x4e')]=_0x3b0a68;}else if(_0x591e9b&&_0x591e9b[_0xa835('0x4f')]&&_0x591e9b[_0xa835('0x4f')]!==_0xa835('0x50')){logger[_0xa835('0xe')](_0xa835('0x51'),_0xa835('0x4d'));_0x49577a[_0xa835('0x4e')]=_0x3b0a68;}else{_0x49577a[_0xa835('0x4e')]='';}return getAdminId(_0x220aee,_0x37620b,_0x3e44ff,_0x544ff1)[_0xa835('0x10')](getUser(_0x37620b,_0x3e44ff,_0x544ff1))[_0xa835('0x10')](getEndUser(_0x37620b,_0x3e44ff,_0x544ff1))[_0xa835('0x10')](getTicket(_0x37620b,_0x3e44ff,_0x544ff1,_0x3f1495,_0x49577a))[_0xa835('0x10')](function(_0x95a869){logger[_0xa835('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x95a869[_0xa835('0x3b')]));if(_0x37620b!=='unmanaged'){logger[_0xa835('0xe')]('['+[_0x37620b[_0xa835('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x544ff1,_0x22bfea[_0xa835('0x52')],_0x95a869[_0xa835('0x2b')]);}})[_0xa835('0x21')](function(_0x542bb1){logger[_0xa835('0x18')]('['+[_0x37620b[_0xa835('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xa835('0x53')](_0x542bb1,{'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 d23c52e..d57ad41 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 _0x5170=['zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','unknown\x20integration','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales'];(function(_0x5b8c83,_0x2b4181){var _0x366cb7=function(_0x2320c9){while(--_0x2320c9){_0x5b8c83['push'](_0x5b8c83['shift']());}};_0x366cb7(++_0x2b4181);}(_0x5170,0x82));var _0x0517=function(_0x399029,_0x2c9603){_0x399029=_0x399029-0x0;var _0x29855f=_0x5170[_0x399029];return _0x29855f;};'use strict';var _=require(_0x0517('0x0'));var util=require(_0x0517('0x1'));var zendesk=require(_0x0517('0x2'));var salesforce=require(_0x0517('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0517('0x4'));var zoho=require(_0x0517('0x5'));var desk=require(_0x0517('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x0517('0x7'));var dynamics365=require(_0x0517('0x8'));var freshsales=require(_0x0517('0x9'));var integrations=[_0x0517('0xa'),_0x0517('0xb'),_0x0517('0xc'),_0x0517('0xd'),_0x0517('0xe'),_0x0517('0xf'),_0x0517('0x10'),'dynamics365',_0x0517('0x11'),_0x0517('0x12')];exports['exec']=function(_0x54bada,_0x4b97bd,_0x8f9e38,_0x2cbb74,_0x2822b8,_0x5d324b){if(_0x8f9e38){if(_[_0x0517('0x13')](integrations,_0x54bada[_0x0517('0x14')][_0x0517('0x15')]())){try{var _0x5bf673=null;var _0x5d8b79='';var _0x1cd4e5=_0x8f9e38[_0x54bada[_0x0517('0x14')][_0x0517('0x15')]()];if(_0x1cd4e5){var _0x47afbb=_0x1cd4e5[_0x54bada[_0x0517('0x16')]];if(_0x47afbb){var _0x56457d=_[_0x0517('0x17')](_0x47afbb[_0x0517('0x18')],{'id':parseInt(_0x54bada[_0x0517('0x19')],0xa)});if(_0x56457d){if(_0x2cbb74){if(_0x2822b8&&_0x4b97bd['queue']){_0x5d8b79=_0x0517('0x1a');}else if(_0x4b97bd[_0x0517('0x1b')]){_0x5d8b79=_0x0517('0x1c');}else{console[_0x0517('0x1d')]('EVENT\x20UNKNOWN',_0x4b97bd);}}else{_0x5d8b79=_0x0517('0x1e');}switch(_0x54bada[_0x0517('0x14')][_0x0517('0x15')]()){case _0x0517('0xa'):zendesk[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case'salesforce':salesforce[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0xc'):sugarcrm[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0xd'):freshdesk[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case'zoho':zoho[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0xf'):desk[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0x10'):vtiger[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0x11'):freshsales['cs'](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b,_0x5d8b79);break;case _0x0517('0x12'):servicenow['cs'](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b,_0x5d8b79);break;case'dynamics365':dynamics365['cs'](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b,_0x5d8b79);break;default:console['log'](_0x0517('0x1f'));}}else{_0x5bf673=require('../../../../config/logger')(_0x54bada[_0x0517('0x14')][_0x0517('0x15')]());_0x5bf673[_0x0517('0x20')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x54bada[_0x0517('0x14')][_0x0517('0x15')](),_0x54bada[_0x0517('0x19')]));}}else{_0x5bf673=require('../../../../config/logger')(_0x54bada[_0x0517('0x14')][_0x0517('0x15')]());_0x5bf673[_0x0517('0x20')](_0x0517('0x21'),util['format'](_0x0517('0x22'),_0x54bada['data1'][_0x0517('0x15')](),_0x54bada[_0x0517('0x16')]));}}else{}}catch(_0x57ba82){console[_0x0517('0x20')](_0x57ba82);}}}}; \ No newline at end of file +var _0x320f=['data2','find','Configurations','data3','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','sugarcrm','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase'];(function(_0x208b66,_0x34b3ef){var _0x328f23=function(_0x2893ff){while(--_0x2893ff){_0x208b66['push'](_0x208b66['shift']());}};_0x328f23(++_0x34b3ef);}(_0x320f,0x13a));var _0xf320=function(_0x300b8a,_0x44b9eb){_0x300b8a=_0x300b8a-0x0;var _0x3d9cc0=_0x320f[_0x300b8a];return _0x3d9cc0;};'use strict';var _=require(_0xf320('0x0'));var util=require(_0xf320('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xf320('0x2'));var sugarcrm=require(_0xf320('0x3'));var freshdesk=require(_0xf320('0x4'));var zoho=require(_0xf320('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xf320('0x6'));var freshsales=require(_0xf320('0x7'));var integrations=['zendesk',_0xf320('0x8'),'sugarcrm',_0xf320('0x9'),_0xf320('0xa'),_0xf320('0xb'),_0xf320('0xc'),_0xf320('0xd'),_0xf320('0xe'),_0xf320('0xf')];exports['exec']=function(_0x49ce70,_0x3ee7da,_0x16ea1e,_0x340ff7,_0x38427e,_0x2f7821){if(_0x16ea1e){if(_[_0xf320('0x10')](integrations,_0x49ce70[_0xf320('0x11')][_0xf320('0x12')]())){try{var _0x43b28e=null;var _0x3357e8='';var _0x51afc0=_0x16ea1e[_0x49ce70['data1'][_0xf320('0x12')]()];if(_0x51afc0){var _0x59567b=_0x51afc0[_0x49ce70[_0xf320('0x13')]];if(_0x59567b){var _0x2ae202=_[_0xf320('0x14')](_0x59567b[_0xf320('0x15')],{'id':parseInt(_0x49ce70[_0xf320('0x16')],0xa)});if(_0x2ae202){if(_0x340ff7){if(_0x38427e&&_0x3ee7da['queue']){_0x3357e8='queue';}else if(_0x3ee7da[_0xf320('0x17')]){_0x3357e8=_0xf320('0x18');}else{console[_0xf320('0x19')](_0xf320('0x1a'),_0x3ee7da);}}else{_0x3357e8=_0xf320('0x1b');}switch(_0x49ce70[_0xf320('0x11')][_0xf320('0x12')]()){case _0xf320('0x1c'):zendesk[_0x3357e8](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821);break;case _0xf320('0x8'):salesforce[_0x3357e8](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821);break;case _0xf320('0x1d'):sugarcrm[_0x3357e8](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821);break;case _0xf320('0x9'):freshdesk[_0x3357e8](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821);break;case _0xf320('0xa'):zoho[_0x3357e8](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821);break;case _0xf320('0xb'):desk[_0x3357e8](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821);break;case _0xf320('0xc'):vtiger[_0x3357e8](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821);break;case'freshsales':freshsales['cs'](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821,_0x3357e8);break;case _0xf320('0xf'):servicenow['cs'](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821,_0x3357e8);break;case _0xf320('0xd'):dynamics365['cs'](_0x49ce70,_0x3ee7da,_0x2ae202,_0x340ff7,_0x38427e,_0x59567b,_0x2f7821,_0x3357e8);break;default:console['log'](_0xf320('0x1e'));}}else{_0x43b28e=require(_0xf320('0x1f'))(_0x49ce70[_0xf320('0x11')]['toLowerCase']());_0x43b28e['error'](_0xf320('0x20'),util[_0xf320('0x21')](_0xf320('0x22'),_0x49ce70[_0xf320('0x11')]['toLowerCase'](),_0x49ce70[_0xf320('0x16')]));}}else{_0x43b28e=require(_0xf320('0x1f'))(_0x49ce70[_0xf320('0x11')][_0xf320('0x12')]());_0x43b28e[_0xf320('0x23')](_0xf320('0x20'),util['format'](_0xf320('0x24'),_0x49ce70[_0xf320('0x11')]['toLowerCase'](),_0x49ce70[_0xf320('0x13')]));}}else{}}catch(_0x24c4f7){console[_0xf320('0x23')](_0x24c4f7);}}}}; \ 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 dd1bbae..55572f4 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 _0x10d5=['recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','find','execute','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','then','resolve','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','additionalSearchAccount','Lead','first','Phone','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','create','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound'];(function(_0x1cdabe,_0x286194){var _0x3dcc9c=function(_0x5aa9c7){while(--_0x5aa9c7){_0x1cdabe['push'](_0x1cdabe['shift']());}};_0x3dcc9c(++_0x286194);}(_0x10d5,0xfe));var _0x510d=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x10d5[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0x510d('0x0'));var rp=require(_0x510d('0x1'));var moment=require(_0x510d('0x2'));var BPromise=require('bluebird');var md5=require(_0x510d('0x3'));var jsforce=require(_0x510d('0x4'));var util=require(_0x510d('0x5'));var Redis=require(_0x510d('0x6'));var intUtil=require('./util');var config=require(_0x510d('0x7'));var logger=require('../../../../config/logger')(_0x510d('0x8'));config[_0x510d('0x9')]=_[_0x510d('0xa')](config[_0x510d('0x9')],{'host':_0x510d('0xb'),'port':0x18eb});var io=require(_0x510d('0xc'))(new Redis(config['redis']));function emit(_0x2bbb1b,_0x2a6b43,_0x4592f2){io['to'](_0x2bbb1b)[_0x510d('0xd')](_0x2a6b43,_0x4592f2);}function getTicket(_0x4f00c3,_0x5a6b62,_0x2ca24e,_0x2a019e,_0x367742,_0x68c183,_0x3277f7,_0x5322f8){var _0x20326=Object[_0x510d('0xe')]({},{'OwnerId':_0x5a6b62['id'],'Subject':intUtil[_0x510d('0xf')](_0x2a019e[_0x510d('0x10')],_0x367742,'\x20'),'Description':intUtil[_0x510d('0xf')](_0x2a019e[_0x510d('0x11')],_0x367742,'\x0a')},getCustomFields(_0x68c183,_0x367742));if(_0x2ca24e){if(_0x2a019e[_0x510d('0x12')]===_0x510d('0x13')){_0x20326[_0x510d('0x14')]=moment[_0x510d('0x15')]();_0x20326['IsReminderSet']=![];_0x20326[_0x510d('0x16')]=![];if(_0x2ca24e[_0x510d('0x17')]===_0x510d('0x18')||_0x2ca24e['endUserType']===_0x510d('0x19')){_0x20326[_0x510d('0x1a')]=_0x2ca24e['id'];}else if(_0x2ca24e[_0x510d('0x17')]===_0x510d('0x1b')){_0x20326[_0x510d('0x1c')]=_0x2ca24e['id'];}}else if(_0x2a019e[_0x510d('0x12')]==='Case'){if(_0x2ca24e[_0x510d('0x17')]===_0x510d('0x18')){_0x20326[_0x510d('0x1d')]=_0x2ca24e['id'];}else if(_0x2ca24e[_0x510d('0x17')]==='account'){_0x20326[_0x510d('0x1e')]=_0x2ca24e['id'];}else if(_0x2ca24e['endUserType']===_0x510d('0x19')&&_0x2a019e[_0x510d('0x1f')]){_0x20326[_0x2a019e[_0x510d('0x1f')]]=_0x2ca24e['id'];}else{logger['info'](_0x510d('0x20'));}}}return _0x3277f7[_0x510d('0x21')](_0x2a019e[_0x510d('0x12')])['create'](_0x20326);}function getUser(_0x724668,_0x22c12e,_0x29a8ac){if(!_[_0x510d('0x22')](_0x22c12e)&&intUtil['validateEmail'](_0x22c12e)){var _0x45314f={'Email':_0x22c12e};var _0x37cbc2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x29a8ac['sobject']('User')[_0x510d('0x23')](_0x45314f,_0x37cbc2)[_0x510d('0x24')]()['then'](function(_0x8bc2d7){if(_0x8bc2d7[_0x510d('0x25')]){var _0x48611a=_['find'](_0x8bc2d7,function(_0x5699ed){return _0x5699ed[_0x510d('0x26')]===_0x22c12e;});if(_0x48611a){logger[_0x510d('0x27')](_0x510d('0x28'),_0x22c12e);return BPromise['resolve']({'id':_0x48611a['Id'],'name':_0x48611a[_0x510d('0x29')]});}}else{logger[_0x510d('0x27')](_0x510d('0x2a'),_0x22c12e);return _0x29a8ac['identity']()['then'](function(_0x2f89a8){return BPromise['resolve']({'id':_0x2f89a8[_0x510d('0x2b')],'name':_0x2f89a8[_0x510d('0x2c')]});});}});}else{logger['info'](_0x510d('0x2a'),_0x22c12e);return _0x29a8ac[_0x510d('0x2d')]()[_0x510d('0x2e')](function(_0x48d905){return BPromise[_0x510d('0x2f')]({'id':_0x48d905['user_id'],'name':_0x48d905[_0x510d('0x2c')]});});}}function getEndUser(_0x137738,_0x4b363c,_0x15d39f,_0x168834,_0x40329c){var _0x35ea8d={'$or':{'Phone':_0x168834}};var _0x321807={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x510d('0x2f')]()[_0x510d('0x2e')](function(){logger[_0x510d('0x27')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x168834,_0x4b363c[_0x510d('0x30')]);switch(_0x4b363c['moduleSearch']){case _0x510d('0x31'):var _0x203b67=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c[_0x510d('0x33')]){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x33')]]=_0x168834;_[_0x510d('0x34')](_0x203b67[_0x510d('0x35')],_0x4c8053);}return _0x40329c[_0x510d('0x21')](_0x510d('0x36'))['find'](_0x203b67,_0x321807)[_0x510d('0x24')]()[_0x510d('0x2e')](function(_0x76791a){if(_0x76791a&&_0x76791a[_0x510d('0x25')]){return _0x76791a;}else{var _0x3ec2b7=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c[_0x510d('0x37')]){var _0xfc3c4b={};_0xfc3c4b[_0x4b363c[_0x510d('0x37')]]=_0x168834;_[_0x510d('0x34')](_0x3ec2b7['$or'],_0xfc3c4b);}return _0x40329c[_0x510d('0x21')]('Lead')[_0x510d('0x23')](_0x3ec2b7,_0x321807);}});case'account_contact_lead':var _0x4fde9b=_['cloneDeep'](_0x35ea8d);if(_0x4b363c[_0x510d('0x38')]){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x38')]]=_0x168834;_['merge'](_0x4fde9b['$or'],_0x4c8053);}return _0x40329c['sobject']('Account')[_0x510d('0x23')](_0x4fde9b,_0x321807)[_0x510d('0x24')]()[_0x510d('0x2e')](function(_0xec9e60){if(_0xec9e60&&_0xec9e60['length']){return _0xec9e60;}else{var _0x55c74f=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c['additionalSearchContact']){var _0x4de575={};_0x4de575[_0x4b363c['additionalSearchContact']]=_0x168834;_[_0x510d('0x34')](_0x55c74f[_0x510d('0x35')],_0x4de575);}return _0x40329c[_0x510d('0x21')](_0x510d('0x36'))[_0x510d('0x23')](_0x55c74f,_0x321807)[_0x510d('0x2e')](function(_0x4e4566){if(_0x4e4566&&_0x4e4566[_0x510d('0x25')]){return _0x4e4566;}else{var _0x3ba8c7=_['cloneDeep'](_0x35ea8d);if(_0x4b363c['additionalSearchLead']){var _0x20697b={};_0x20697b[_0x4b363c[_0x510d('0x37')]]=_0x168834;_[_0x510d('0x34')](_0x3ba8c7[_0x510d('0x35')],_0x20697b);}return _0x40329c['sobject'](_0x510d('0x39'))['find'](_0x3ba8c7,_0x321807);}});}});case _0x510d('0x18'):var _0x203b67=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c['additionalSearchContact']){var _0x4c8053={};_0x4c8053[_0x4b363c['additionalSearchContact']]=_0x168834;_[_0x510d('0x34')](_0x203b67['$or'],_0x4c8053);}return _0x40329c[_0x510d('0x21')](_0x510d('0x36'))[_0x510d('0x23')](_0x203b67,_0x321807)[_0x510d('0x24')]();case _0x510d('0x19'):var _0xf5b64c=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c['additionalSearchLead']){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x37')]]=_0x168834;_[_0x510d('0x34')](_0xf5b64c[_0x510d('0x35')],_0x4c8053);}return _0x40329c[_0x510d('0x21')](_0x510d('0x39'))['find'](_0xf5b64c,_0x321807);case _0x510d('0x1b'):var _0x4fde9b=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c[_0x510d('0x38')]){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x38')]]=_0x168834;_[_0x510d('0x34')](_0x4fde9b[_0x510d('0x35')],_0x4c8053);}return _0x40329c[_0x510d('0x21')]('Account')[_0x510d('0x23')](_0x4fde9b,_0x321807);default:return null;}})['then'](function(_0x535deb){if(_0x535deb&&_0x535deb[_0x510d('0x25')]){var _0x30956e=_[_0x510d('0x3a')](_0x535deb);if(_0x30956e){return BPromise[_0x510d('0x2f')]({'id':_0x30956e['Id'],'name':_0x30956e[_0x510d('0x29')],'phone':_0x30956e[_0x510d('0x3b')],'endUserType':_0x30956e['attributes'][_0x510d('0x3c')][_0x510d('0x3d')]()});}}})['then'](function(_0x29e45d){if(_0x29e45d){logger[_0x510d('0x27')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x29e45d[_0x510d('0x17')],_0x168834);return BPromise['resolve'](_0x29e45d);}else{logger[_0x510d('0x27')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x168834);var _0xaac4a3={'Phone':_0x168834};if(_0x4b363c['moduleCreate']){if(_0x4b363c[_0x510d('0x3e')]==='contact'){logger[_0x510d('0x27')](_0x510d('0x3f'),_0x168834,_0x4b363c[_0x510d('0x3e')]);_0xaac4a3[_0x510d('0x40')]=_0x15d39f!==_0x510d('0x41')?_0x15d39f:util[_0x510d('0x42')](_0x510d('0x43'),_0x168834);}else if(_0x4b363c[_0x510d('0x3e')]==='lead'){logger[_0x510d('0x27')](_0x510d('0x3f'),_0x168834,_0x4b363c['moduleCreate']);_0xaac4a3[_0x510d('0x40')]=_0x15d39f!==''?_0x15d39f:util[_0x510d('0x42')](_0x510d('0x43'),_0x168834);_0xaac4a3['Company']=_0x510d('0x44');}else if(_0x4b363c['moduleCreate']===_0x510d('0x1b')){logger[_0x510d('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x168834,_0x4b363c['moduleCreate']);_0xaac4a3[_0x510d('0x29')]=_0x15d39f!==''?_0x15d39f:util[_0x510d('0x42')](_0x510d('0x43'),_0x168834);}else{return null;}}return _0x40329c['sobject'](_['upperFirst'](_0x4b363c['moduleCreate']))[_0x510d('0x45')](_0xaac4a3)[_0x510d('0x2e')](function(_0x5d675e){return BPromise['resolve']({'id':_0x5d675e['id'],'endUserType':_0x4b363c[_0x510d('0x3e')]});});}});}function getCustomFields(_0x41b1f1,_0x19b746){var _0x3bbaa1={};if(_0x41b1f1[_0x510d('0x25')]>0x0){_['forEach'](_0x41b1f1,function(_0x2bc2eb){if(_[_0x510d('0x46')]([_0x510d('0x47'),'picklist'],_0x2bc2eb[_0x510d('0x3c')])&&_0x2bc2eb['idField']){_0x3bbaa1[_0x2bc2eb[_0x510d('0x48')]]=_0x2bc2eb[_0x510d('0x49')][_0x510d('0x4a')]();}else if(_0x2bc2eb['type']===_0x510d('0x4b')&&_0x2bc2eb[_0x510d('0x4c')]&&_0x2bc2eb[_0x510d('0x48')]){_0x19b746[_0x2bc2eb[_0x510d('0x4c')]]&&(_0x3bbaa1[_0x2bc2eb[_0x510d('0x48')]]=_0x19b746[_0x2bc2eb[_0x510d('0x4c')]][_0x510d('0x4a')]());}else if(_0x2bc2eb[_0x510d('0x3c')]===_0x510d('0x4d')&&_0x2bc2eb[_0x510d('0x4e')]&&_0x2bc2eb[_0x510d('0x4e')]['name']&&_0x2bc2eb[_0x510d('0x48')]){_0x19b746[_0x2bc2eb['Variable'][_0x510d('0x4f')][_0x510d('0x3d')]()]&&(_0x3bbaa1[_0x2bc2eb[_0x510d('0x48')]]=_0x19b746[_0x2bc2eb[_0x510d('0x4e')][_0x510d('0x4f')][_0x510d('0x3d')]()]['toString']());}});}return _0x3bbaa1;}function getConnection(_0x25aa55){var _0x58b9e4=_0x25aa55['password'][_0x510d('0x50')](_0x25aa55[_0x510d('0x51')]);var _0x19d537=new jsforce[(_0x510d('0x52'))]({'oauth2':{'loginUrl':_0x25aa55['remoteUri']||_0x510d('0x53'),'clientId':_0x25aa55[_0x510d('0x54')],'clientSecret':_0x25aa55[_0x510d('0x55')]}});return _0x19d537[_0x510d('0x56')](_0x25aa55['username'],_0x58b9e4)['then'](function(){logger[_0x510d('0x27')]('Connection\x20established.');return _0x19d537;});}exports[_0x510d('0x57')]=function(_0x559b15,_0x4f6a52,_0x1a5136,_0x4680ff,_0x3db154,_0x2f8897){var _0x80cd61,_0x43c89e,_0x231125,_0x974b14;_0x2f8897[_0x510d('0x58')]=intUtil[_0x510d('0x59')](_0x2f8897[_0x510d('0x58')]);_0x2f8897[_0x510d('0x5a')]=intUtil[_0x510d('0x59')](_0x2f8897['remoteUri']);if(_0x3db154&&_0x3db154['monitor_format']){logger[_0x510d('0x27')](_0x510d('0x5b'),_0x510d('0x5c'));_0x4f6a52['recordingURL']=util[_0x510d('0x42')](_0x510d('0x5d'),_0x2f8897[_0x510d('0x58')],_0x4f6a52['uniqueid'],md5(_0x4f6a52[_0x510d('0x5e')]));}else{_0x4f6a52[_0x510d('0x5f')]='';}return getConnection(_0x2f8897)[_0x510d('0x2e')](function(_0x1d6869){_0x974b14=_0x1d6869;return getUser(_0x2f8897,_0x4680ff[_0x510d('0x60')],_0x974b14);})[_0x510d('0x2e')](function(_0x5451c0){_0x80cd61=_0x5451c0;return getEndUser(_0x2f8897,_0x1a5136,_0x4f6a52[_0x510d('0x61')],_0x4f6a52[_0x510d('0x62')],_0x974b14);})[_0x510d('0x2e')](function(_0x2a8247){_0x43c89e=_0x2a8247;return getTicket(_0x2f8897,_0x80cd61,_0x43c89e,_0x1a5136,_0x4f6a52,_0x1a5136['Fields'],_0x974b14,_0x510d('0x57'));})['then'](function(_0x3e18d6){_0x231125=_0x3e18d6;logger[_0x510d('0x27')](_0x510d('0x63'),_0x231125['id']);logger[_0x510d('0x27')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x231125['id'],_0x4680ff[_0x510d('0x4f')],_0x2f8897[_0x510d('0x3c')]);switch(_0x2f8897['type']){case _0x510d('0x64'):emit(util[_0x510d('0x42')](_0x510d('0x65'),_0x4680ff[_0x510d('0x4f')]),_0x510d('0x66'),{'recordId':_0x231125['id']});break;case'newTab':emit(util[_0x510d('0x42')](_0x510d('0x65'),_0x4680ff[_0x510d('0x4f')]),_0x510d('0x67'),{'uri':util[_0x510d('0x42')](_0x510d('0x68'),_0x974b14[_0x510d('0x69')],_0x231125['id'])});break;default:logger[_0x510d('0x6a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x510d('0x6b')](function(_0x395679){logger[_0x510d('0x6a')](_0x510d('0x5b'),_0x395679);});};exports[_0x510d('0x6c')]=function(_0x39e5da,_0x1ae994,_0x115804,_0x289eb0,_0x43cd6d,_0x4b9321,_0x405b23){var _0x113b2d,_0x4f83cc,_0x3c3ac6,_0xb1af00;_0x4b9321[_0x510d('0x58')]=intUtil[_0x510d('0x59')](_0x4b9321[_0x510d('0x58')]);_0x4b9321['remoteUri']=intUtil[_0x510d('0x59')](_0x4b9321[_0x510d('0x5a')]);if(_0x405b23&&_0x405b23[_0x510d('0x6d')]&&_0x405b23[_0x510d('0x6d')]!==_0x510d('0x6e')){logger[_0x510d('0x27')](_0x510d('0x6f'),_0x510d('0x5c'));_0x1ae994['recordingURL']=util[_0x510d('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b9321[_0x510d('0x58')],_0x1ae994[_0x510d('0x5e')],md5(_0x1ae994['uniqueid']));}return getConnection(_0x4b9321)[_0x510d('0x2e')](function(_0x4a2860){_0xb1af00=_0x4a2860;return getUser(_0x4b9321,_0x289eb0[_0x510d('0x60')],_0xb1af00);})['then'](function(_0x3b44ec){_0x113b2d=_0x3b44ec;return getEndUser(_0x4b9321,_0x115804,_0x1ae994[_0x510d('0x70')],_0x1ae994[_0x510d('0x71')],_0xb1af00);})['then'](function(_0x265019){_0x4f83cc=_0x265019;return getTicket(_0x4b9321,_0x113b2d,_0x4f83cc,_0x115804,_0x1ae994,_0x115804[_0x510d('0x72')],_0xb1af00,_0x510d('0x6c'));})[_0x510d('0x2e')](function(_0x350e3c){_0x3c3ac6=_0x350e3c;logger[_0x510d('0x27')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3c3ac6['id']);logger['info'](_0x510d('0x73'),_0x3c3ac6['id'],_0x289eb0[_0x510d('0x4f')],_0x4b9321[_0x510d('0x3c')]);switch(_0x4b9321['type']){case _0x510d('0x64'):emit(util[_0x510d('0x42')](_0x510d('0x65'),_0x289eb0['name']),_0x510d('0x66'),{'recordId':_0x3c3ac6['id']});break;case _0x510d('0x74'):emit(util['format'](_0x510d('0x65'),_0x289eb0['name']),'trigger:browser:url',{'uri':util[_0x510d('0x42')](_0x510d('0x68'),_0xb1af00[_0x510d('0x69')],_0x3c3ac6['id'])});break;default:logger['error'](_0x510d('0x6f'),_0x510d('0x75'));}})[_0x510d('0x6b')](function(_0x2eeea4){logger[_0x510d('0x6a')](_0x510d('0x6f'),_0x2eeea4);});};exports['unmanaged']=function(_0x3913d2,_0x3e7ff6,_0x2ac17e,_0x41c05a,_0x5ec4fb,_0x5732b9){var _0x611d2f,_0x43e823,_0x336f65,_0x14b54a;_0x5732b9[_0x510d('0x58')]=intUtil[_0x510d('0x59')](_0x5732b9[_0x510d('0x58')]);_0x5732b9[_0x510d('0x5a')]=intUtil[_0x510d('0x59')](_0x5732b9['remoteUri']);if(_0x5ec4fb&&_0x5ec4fb['monitor_format']){logger[_0x510d('0x27')]('['+_0x3e7ff6[_0x510d('0x76')][_0x510d('0x77')]()+']','Recording\x20is\x20enabled!');_0x3e7ff6[_0x510d('0x5f')]=util[_0x510d('0x42')](_0x510d('0x5d'),_0x5732b9[_0x510d('0x58')],_0x3e7ff6[_0x510d('0x5e')],md5(_0x3e7ff6[_0x510d('0x5e')]));}else{_0x3e7ff6['recordingURL']='';}return getConnection(_0x5732b9)[_0x510d('0x2e')](function(_0x32c6b3){_0x14b54a=_0x32c6b3;if(!_[_0x510d('0x22')](_0x41c05a)){return getUser(_0x5732b9,_0x41c05a[_0x510d('0x4f')],_0x14b54a);}else{return getUser(_0x5732b9,null,_0x14b54a);}})[_0x510d('0x2e')](function(_0x4cf24d){_0x611d2f=_0x4cf24d;return getEndUser(_0x5732b9,_0x2ac17e,_0x3e7ff6[_0x510d('0x61')],_0x3e7ff6[_0x510d('0x62')],_0x14b54a);})[_0x510d('0x2e')](function(_0x184dd3){_0x43e823=_0x184dd3;return getTicket(_0x5732b9,_0x611d2f,_0x43e823,_0x2ac17e,_0x3e7ff6,_0x2ac17e['Fields'],_0x14b54a);})[_0x510d('0x2e')](function(_0x16a844){_0x336f65=_0x16a844;logger[_0x510d('0x27')]('['+_0x3e7ff6[_0x510d('0x76')][_0x510d('0x77')]()+']\x20Ticket\x20%s\x20created.',_0x336f65['id']);logger[_0x510d('0x27')]('['+_0x3e7ff6[_0x510d('0x76')]['toUpperCase']()+_0x510d('0x78'),_0x5732b9[_0x510d('0x3c')]);})[_0x510d('0x6b')](function(_0x2b0471){logger[_0x510d('0x6a')]('['+_0x3e7ff6['lastevent'][_0x510d('0x77')]()+']',_0x2b0471);});}; \ No newline at end of file +var _0xa181=['then','Email','info','Agent\x20%s\x20found.','resolve','Name','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','cloneDeep','additionalSearchContact','Contact','execute','length','additionalSearchLead','merge','$or','account_contact_lead','additionalSearchAccount','Account','Lead','lead','first','type','toLowerCase','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','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.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','account','Case','contact','ContactId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find'];(function(_0x468393,_0xe8209a){var _0x24d01e=function(_0x18cf47){while(--_0x18cf47){_0x468393['push'](_0x468393['shift']());}};_0x24d01e(++_0xe8209a);}(_0xa181,0x1e6));var _0x1a18=function(_0x1cc6ed,_0x1ce9ca){_0x1cc6ed=_0x1cc6ed-0x0;var _0x24e40d=_0xa181[_0x1cc6ed];return _0x24e40d;};'use strict';var _=require('lodash');var rp=require(_0x1a18('0x0'));var moment=require('moment');var BPromise=require(_0x1a18('0x1'));var md5=require(_0x1a18('0x2'));var jsforce=require(_0x1a18('0x3'));var util=require(_0x1a18('0x4'));var Redis=require(_0x1a18('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x1a18('0x6'))(_0x1a18('0x7'));config[_0x1a18('0x8')]=_['defaults'](config['redis'],{'host':_0x1a18('0x9'),'port':0x18eb});var io=require(_0x1a18('0xa'))(new Redis(config['redis']));function emit(_0x1a1b9c,_0x3aa9c1,_0x1946a8){io['to'](_0x1a1b9c)[_0x1a18('0xb')](_0x3aa9c1,_0x1946a8);}function getTicket(_0x2f4728,_0x371e22,_0x56a058,_0x51beb6,_0x4aa52c,_0x35eba9,_0xde5489,_0xd499b6){var _0x27a005=Object[_0x1a18('0xc')]({},{'OwnerId':_0x371e22['id'],'Subject':intUtil[_0x1a18('0xd')](_0x51beb6[_0x1a18('0xe')],_0x4aa52c,'\x20'),'Description':intUtil[_0x1a18('0xd')](_0x51beb6[_0x1a18('0xf')],_0x4aa52c,'\x0a')},getCustomFields(_0x35eba9,_0x4aa52c));if(_0x56a058){if(_0x51beb6[_0x1a18('0x10')]==='Task'){_0x27a005[_0x1a18('0x11')]=moment[_0x1a18('0x12')]();_0x27a005[_0x1a18('0x13')]=![];_0x27a005[_0x1a18('0x14')]=![];if(_0x56a058[_0x1a18('0x15')]==='contact'||_0x56a058[_0x1a18('0x15')]==='lead'){_0x27a005['WhoId']=_0x56a058['id'];}else if(_0x56a058[_0x1a18('0x15')]===_0x1a18('0x16')){_0x27a005['WhatId']=_0x56a058['id'];}}else if(_0x51beb6['ticketType']===_0x1a18('0x17')){if(_0x56a058[_0x1a18('0x15')]===_0x1a18('0x18')){_0x27a005[_0x1a18('0x19')]=_0x56a058['id'];}else if(_0x56a058['endUserType']===_0x1a18('0x16')){_0x27a005['AccountId']=_0x56a058['id'];}else if(_0x56a058[_0x1a18('0x15')]==='lead'&&_0x51beb6[_0x1a18('0x1a')]){_0x27a005[_0x51beb6['leadId']]=_0x56a058['id'];}else{logger['info'](_0x1a18('0x1b'));}}}return _0xde5489[_0x1a18('0x1c')](_0x51beb6['ticketType'])[_0x1a18('0x1d')](_0x27a005);}function getUser(_0x56a7fc,_0x15ddf5,_0x4c386d){if(!_[_0x1a18('0x1e')](_0x15ddf5)&&intUtil[_0x1a18('0x1f')](_0x15ddf5)){var _0x742dec={'Email':_0x15ddf5};var _0x1a3a86={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4c386d[_0x1a18('0x1c')](_0x1a18('0x20'))[_0x1a18('0x21')](_0x742dec,_0x1a3a86)['execute']()[_0x1a18('0x22')](function(_0x1b79f4){if(_0x1b79f4['length']){var _0x58e72b=_[_0x1a18('0x21')](_0x1b79f4,function(_0x590786){return _0x590786[_0x1a18('0x23')]===_0x15ddf5;});if(_0x58e72b){logger[_0x1a18('0x24')](_0x1a18('0x25'),_0x15ddf5);return BPromise[_0x1a18('0x26')]({'id':_0x58e72b['Id'],'name':_0x58e72b[_0x1a18('0x27')]});}}else{logger['info'](_0x1a18('0x28'),_0x15ddf5);return _0x4c386d[_0x1a18('0x29')]()[_0x1a18('0x22')](function(_0x5d96b2){return BPromise[_0x1a18('0x26')]({'id':_0x5d96b2[_0x1a18('0x2a')],'name':_0x5d96b2[_0x1a18('0x2b')]});});}});}else{logger[_0x1a18('0x24')](_0x1a18('0x28'),_0x15ddf5);return _0x4c386d[_0x1a18('0x29')]()['then'](function(_0x46da65){return BPromise[_0x1a18('0x26')]({'id':_0x46da65[_0x1a18('0x2a')],'name':_0x46da65[_0x1a18('0x2b')]});});}}function getEndUser(_0x10472b,_0x89a05d,_0x5dd9b1,_0x5ec301,_0xa3ae48){var _0x57b20a={'$or':{'Phone':_0x5ec301}};var _0x5216a3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1a18('0x26')]()[_0x1a18('0x22')](function(){logger[_0x1a18('0x24')](_0x1a18('0x2c'),_0x5ec301,_0x89a05d[_0x1a18('0x2d')]);switch(_0x89a05d[_0x1a18('0x2d')]){case'contact_lead':var _0x4dac68=_[_0x1a18('0x2e')](_0x57b20a);if(_0x89a05d[_0x1a18('0x2f')]){var _0x3bc5bb={};_0x3bc5bb[_0x89a05d[_0x1a18('0x2f')]]=_0x5ec301;_['merge'](_0x4dac68['$or'],_0x3bc5bb);}return _0xa3ae48[_0x1a18('0x1c')](_0x1a18('0x30'))['find'](_0x4dac68,_0x5216a3)[_0x1a18('0x31')]()[_0x1a18('0x22')](function(_0x54fbe3){if(_0x54fbe3&&_0x54fbe3[_0x1a18('0x32')]){return _0x54fbe3;}else{var _0x8777c2=_[_0x1a18('0x2e')](_0x57b20a);if(_0x89a05d[_0x1a18('0x33')]){var _0x5b05b3={};_0x5b05b3[_0x89a05d[_0x1a18('0x33')]]=_0x5ec301;_[_0x1a18('0x34')](_0x8777c2[_0x1a18('0x35')],_0x5b05b3);}return _0xa3ae48[_0x1a18('0x1c')]('Lead')[_0x1a18('0x21')](_0x8777c2,_0x5216a3);}});case _0x1a18('0x36'):var _0x19913d=_['cloneDeep'](_0x57b20a);if(_0x89a05d[_0x1a18('0x37')]){var _0x3bc5bb={};_0x3bc5bb[_0x89a05d[_0x1a18('0x37')]]=_0x5ec301;_[_0x1a18('0x34')](_0x19913d['$or'],_0x3bc5bb);}return _0xa3ae48[_0x1a18('0x1c')](_0x1a18('0x38'))[_0x1a18('0x21')](_0x19913d,_0x5216a3)['execute']()[_0x1a18('0x22')](function(_0x2c871e){if(_0x2c871e&&_0x2c871e['length']){return _0x2c871e;}else{var _0x977505=_[_0x1a18('0x2e')](_0x57b20a);if(_0x89a05d[_0x1a18('0x2f')]){var _0x5ddaea={};_0x5ddaea[_0x89a05d[_0x1a18('0x2f')]]=_0x5ec301;_[_0x1a18('0x34')](_0x977505[_0x1a18('0x35')],_0x5ddaea);}return _0xa3ae48[_0x1a18('0x1c')](_0x1a18('0x30'))[_0x1a18('0x21')](_0x977505,_0x5216a3)[_0x1a18('0x22')](function(_0x17390e){if(_0x17390e&&_0x17390e[_0x1a18('0x32')]){return _0x17390e;}else{var _0x38cba8=_[_0x1a18('0x2e')](_0x57b20a);if(_0x89a05d[_0x1a18('0x33')]){var _0x3c83c3={};_0x3c83c3[_0x89a05d[_0x1a18('0x33')]]=_0x5ec301;_[_0x1a18('0x34')](_0x38cba8[_0x1a18('0x35')],_0x3c83c3);}return _0xa3ae48[_0x1a18('0x1c')](_0x1a18('0x39'))[_0x1a18('0x21')](_0x38cba8,_0x5216a3);}});}});case _0x1a18('0x18'):var _0x4dac68=_[_0x1a18('0x2e')](_0x57b20a);if(_0x89a05d['additionalSearchContact']){var _0x3bc5bb={};_0x3bc5bb[_0x89a05d['additionalSearchContact']]=_0x5ec301;_['merge'](_0x4dac68[_0x1a18('0x35')],_0x3bc5bb);}return _0xa3ae48[_0x1a18('0x1c')](_0x1a18('0x30'))[_0x1a18('0x21')](_0x4dac68,_0x5216a3)[_0x1a18('0x31')]();case _0x1a18('0x3a'):var _0x1d4252=_[_0x1a18('0x2e')](_0x57b20a);if(_0x89a05d[_0x1a18('0x33')]){var _0x3bc5bb={};_0x3bc5bb[_0x89a05d[_0x1a18('0x33')]]=_0x5ec301;_['merge'](_0x1d4252[_0x1a18('0x35')],_0x3bc5bb);}return _0xa3ae48[_0x1a18('0x1c')](_0x1a18('0x39'))['find'](_0x1d4252,_0x5216a3);case'account':var _0x19913d=_[_0x1a18('0x2e')](_0x57b20a);if(_0x89a05d[_0x1a18('0x37')]){var _0x3bc5bb={};_0x3bc5bb[_0x89a05d[_0x1a18('0x37')]]=_0x5ec301;_['merge'](_0x19913d[_0x1a18('0x35')],_0x3bc5bb);}return _0xa3ae48[_0x1a18('0x1c')](_0x1a18('0x38'))[_0x1a18('0x21')](_0x19913d,_0x5216a3);default:return null;}})[_0x1a18('0x22')](function(_0x66f6d8){if(_0x66f6d8&&_0x66f6d8[_0x1a18('0x32')]){var _0x305c85=_[_0x1a18('0x3b')](_0x66f6d8);if(_0x305c85){return BPromise[_0x1a18('0x26')]({'id':_0x305c85['Id'],'name':_0x305c85[_0x1a18('0x27')],'phone':_0x305c85['Phone'],'endUserType':_0x305c85['attributes'][_0x1a18('0x3c')][_0x1a18('0x3d')]()});}}})['then'](function(_0x192d2d){if(_0x192d2d){logger[_0x1a18('0x24')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x192d2d[_0x1a18('0x15')],_0x5ec301);return BPromise[_0x1a18('0x26')](_0x192d2d);}else{logger[_0x1a18('0x24')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5ec301);var _0x3ecd18={'Phone':_0x5ec301};if(_0x89a05d['moduleCreate']){if(_0x89a05d['moduleCreate']===_0x1a18('0x18')){logger[_0x1a18('0x24')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5ec301,_0x89a05d['moduleCreate']);_0x3ecd18['LastName']=_0x5dd9b1!==_0x1a18('0x3e')?_0x5dd9b1:util['format'](_0x1a18('0x3f'),_0x5ec301);}else if(_0x89a05d[_0x1a18('0x40')]===_0x1a18('0x3a')){logger[_0x1a18('0x24')](_0x1a18('0x41'),_0x5ec301,_0x89a05d[_0x1a18('0x40')]);_0x3ecd18[_0x1a18('0x42')]=_0x5dd9b1!==_0x1a18('0x3e')?_0x5dd9b1:util[_0x1a18('0x43')](_0x1a18('0x3f'),_0x5ec301);_0x3ecd18['Company']=_0x1a18('0x44');}else if(_0x89a05d['moduleCreate']===_0x1a18('0x16')){logger[_0x1a18('0x24')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5ec301,_0x89a05d[_0x1a18('0x40')]);_0x3ecd18['Name']=_0x5dd9b1!==''?_0x5dd9b1:util['format']('Caller\x20-\x20%s',_0x5ec301);}else{return null;}}return _0xa3ae48[_0x1a18('0x1c')](_[_0x1a18('0x45')](_0x89a05d[_0x1a18('0x40')]))[_0x1a18('0x1d')](_0x3ecd18)[_0x1a18('0x22')](function(_0x249b9f){return BPromise[_0x1a18('0x26')]({'id':_0x249b9f['id'],'endUserType':_0x89a05d['moduleCreate']});});}});}function getCustomFields(_0x484ee0,_0x54a98c){var _0x4d246a={};if(_0x484ee0['length']>0x0){_[_0x1a18('0x46')](_0x484ee0,function(_0x5c26d6){if(_[_0x1a18('0x47')]([_0x1a18('0x48'),_0x1a18('0x49')],_0x5c26d6[_0x1a18('0x3c')])&&_0x5c26d6[_0x1a18('0x4a')]){_0x4d246a[_0x5c26d6[_0x1a18('0x4a')]]=_0x5c26d6[_0x1a18('0x4b')][_0x1a18('0x4c')]();}else if(_0x5c26d6[_0x1a18('0x3c')]==='variable'&&_0x5c26d6[_0x1a18('0x4d')]&&_0x5c26d6[_0x1a18('0x4a')]){_0x54a98c[_0x5c26d6['variableName']]&&(_0x4d246a[_0x5c26d6['idField']]=_0x54a98c[_0x5c26d6[_0x1a18('0x4d')]][_0x1a18('0x4c')]());}else if(_0x5c26d6[_0x1a18('0x3c')]===_0x1a18('0x4e')&&_0x5c26d6[_0x1a18('0x4f')]&&_0x5c26d6['Variable'][_0x1a18('0x50')]&&_0x5c26d6[_0x1a18('0x4a')]){_0x54a98c[_0x5c26d6[_0x1a18('0x4f')][_0x1a18('0x50')][_0x1a18('0x3d')]()]&&(_0x4d246a[_0x5c26d6[_0x1a18('0x4a')]]=_0x54a98c[_0x5c26d6[_0x1a18('0x4f')][_0x1a18('0x50')]['toLowerCase']()]['toString']());}});}return _0x4d246a;}function getConnection(_0x54d6ef){var _0x561a3f=_0x54d6ef[_0x1a18('0x51')][_0x1a18('0x52')](_0x54d6ef[_0x1a18('0x53')]);var _0x49ef4f=new jsforce[(_0x1a18('0x54'))]({'oauth2':{'loginUrl':_0x54d6ef[_0x1a18('0x55')]||_0x1a18('0x56'),'clientId':_0x54d6ef[_0x1a18('0x57')],'clientSecret':_0x54d6ef[_0x1a18('0x58')]}});return _0x49ef4f[_0x1a18('0x59')](_0x54d6ef[_0x1a18('0x5a')],_0x561a3f)[_0x1a18('0x22')](function(){logger['info']('Connection\x20established.');return _0x49ef4f;});}exports[_0x1a18('0x5b')]=function(_0x55207f,_0x481a2d,_0x16df49,_0x3e800a,_0xcfb4f,_0x2b8447){var _0x58cf0b,_0x2cdff3,_0x39284c,_0x59d3e0;_0x2b8447[_0x1a18('0x5c')]=intUtil[_0x1a18('0x5d')](_0x2b8447[_0x1a18('0x5c')]);_0x2b8447[_0x1a18('0x55')]=intUtil[_0x1a18('0x5d')](_0x2b8447[_0x1a18('0x55')]);if(_0xcfb4f&&_0xcfb4f[_0x1a18('0x5e')]){logger[_0x1a18('0x24')]('[QUEUE]',_0x1a18('0x5f'));_0x481a2d[_0x1a18('0x60')]=util[_0x1a18('0x43')](_0x1a18('0x61'),_0x2b8447[_0x1a18('0x5c')],_0x481a2d[_0x1a18('0x62')],md5(_0x481a2d[_0x1a18('0x62')]));}else{_0x481a2d[_0x1a18('0x60')]='';}return getConnection(_0x2b8447)[_0x1a18('0x22')](function(_0x396278){_0x59d3e0=_0x396278;return getUser(_0x2b8447,_0x3e800a[_0x1a18('0x63')],_0x59d3e0);})[_0x1a18('0x22')](function(_0x26f759){_0x58cf0b=_0x26f759;return getEndUser(_0x2b8447,_0x16df49,_0x481a2d[_0x1a18('0x64')],_0x481a2d[_0x1a18('0x65')],_0x59d3e0);})['then'](function(_0x2ded18){_0x2cdff3=_0x2ded18;return getTicket(_0x2b8447,_0x58cf0b,_0x2cdff3,_0x16df49,_0x481a2d,_0x16df49[_0x1a18('0x66')],_0x59d3e0,_0x1a18('0x5b'));})[_0x1a18('0x22')](function(_0x32c0be){_0x39284c=_0x32c0be;logger[_0x1a18('0x24')](_0x1a18('0x67'),_0x39284c['id']);logger[_0x1a18('0x24')](_0x1a18('0x68'),_0x39284c['id'],_0x3e800a[_0x1a18('0x50')],_0x2b8447['type']);switch(_0x2b8447[_0x1a18('0x3c')]){case _0x1a18('0x69'):emit(util[_0x1a18('0x43')](_0x1a18('0x6a'),_0x3e800a['name']),_0x1a18('0x6b'),{'recordId':_0x39284c['id']});break;case _0x1a18('0x6c'):emit(util['format'](_0x1a18('0x6a'),_0x3e800a['name']),_0x1a18('0x6d'),{'uri':util[_0x1a18('0x43')](_0x1a18('0x6e'),_0x59d3e0[_0x1a18('0x6f')],_0x39284c['id'])});break;default:logger[_0x1a18('0x70')](_0x1a18('0x71'));}})[_0x1a18('0x72')](function(_0x557a09){logger[_0x1a18('0x70')](_0x1a18('0x73'),_0x557a09);});};exports[_0x1a18('0x74')]=function(_0x491e4d,_0xa97125,_0x51dcdb,_0x29b825,_0x4948cd,_0x317110,_0x63a6c8){var _0x3d0e89,_0xa3fc8b,_0x36e60a,_0x15d88c;_0x317110[_0x1a18('0x5c')]=intUtil['stripTrailingSlash'](_0x317110[_0x1a18('0x5c')]);_0x317110[_0x1a18('0x55')]=intUtil[_0x1a18('0x5d')](_0x317110[_0x1a18('0x55')]);if(_0x63a6c8&&_0x63a6c8[_0x1a18('0x75')]&&_0x63a6c8[_0x1a18('0x75')]!==_0x1a18('0x76')){logger[_0x1a18('0x24')](_0x1a18('0x77'),_0x1a18('0x5f'));_0xa97125[_0x1a18('0x60')]=util[_0x1a18('0x43')](_0x1a18('0x61'),_0x317110[_0x1a18('0x5c')],_0xa97125[_0x1a18('0x62')],md5(_0xa97125['uniqueid']));}return getConnection(_0x317110)[_0x1a18('0x22')](function(_0xd1b010){_0x15d88c=_0xd1b010;return getUser(_0x317110,_0x29b825[_0x1a18('0x63')],_0x15d88c);})[_0x1a18('0x22')](function(_0x2e043d){_0x3d0e89=_0x2e043d;return getEndUser(_0x317110,_0x51dcdb,_0xa97125[_0x1a18('0x78')],_0xa97125[_0x1a18('0x79')],_0x15d88c);})[_0x1a18('0x22')](function(_0x469c78){_0xa3fc8b=_0x469c78;return getTicket(_0x317110,_0x3d0e89,_0xa3fc8b,_0x51dcdb,_0xa97125,_0x51dcdb[_0x1a18('0x66')],_0x15d88c,_0x1a18('0x74'));})[_0x1a18('0x22')](function(_0x3f53d2){_0x36e60a=_0x3f53d2;logger[_0x1a18('0x24')](_0x1a18('0x7a'),_0x36e60a['id']);logger[_0x1a18('0x24')](_0x1a18('0x7b'),_0x36e60a['id'],_0x29b825[_0x1a18('0x50')],_0x317110[_0x1a18('0x3c')]);switch(_0x317110['type']){case _0x1a18('0x69'):emit(util['format'](_0x1a18('0x6a'),_0x29b825[_0x1a18('0x50')]),'trigger:salesforce:display',{'recordId':_0x36e60a['id']});break;case'newTab':emit(util['format'](_0x1a18('0x6a'),_0x29b825[_0x1a18('0x50')]),_0x1a18('0x6d'),{'uri':util[_0x1a18('0x43')](_0x1a18('0x6e'),_0x15d88c[_0x1a18('0x6f')],_0x36e60a['id'])});break;default:logger[_0x1a18('0x70')](_0x1a18('0x77'),_0x1a18('0x7c'));}})[_0x1a18('0x72')](function(_0x25c1fd){logger[_0x1a18('0x70')](_0x1a18('0x77'),_0x25c1fd);});};exports[_0x1a18('0x7d')]=function(_0x405899,_0x2bfaf9,_0x1c01b4,_0x5f182d,_0x422298,_0x4c0218){var _0x26eea7,_0x51685e,_0x1bcd19,_0x38f68f;_0x4c0218[_0x1a18('0x5c')]=intUtil[_0x1a18('0x5d')](_0x4c0218[_0x1a18('0x5c')]);_0x4c0218['remoteUri']=intUtil[_0x1a18('0x5d')](_0x4c0218[_0x1a18('0x55')]);if(_0x422298&&_0x422298[_0x1a18('0x5e')]){logger['info']('['+_0x2bfaf9['lastevent'][_0x1a18('0x7e')]()+']',_0x1a18('0x5f'));_0x2bfaf9[_0x1a18('0x60')]=util[_0x1a18('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c0218[_0x1a18('0x5c')],_0x2bfaf9[_0x1a18('0x62')],md5(_0x2bfaf9[_0x1a18('0x62')]));}else{_0x2bfaf9[_0x1a18('0x60')]='';}return getConnection(_0x4c0218)[_0x1a18('0x22')](function(_0x3d0d34){_0x38f68f=_0x3d0d34;if(!_[_0x1a18('0x1e')](_0x5f182d)){return getUser(_0x4c0218,_0x5f182d[_0x1a18('0x50')],_0x38f68f);}else{return getUser(_0x4c0218,null,_0x38f68f);}})['then'](function(_0x2beba0){_0x26eea7=_0x2beba0;return getEndUser(_0x4c0218,_0x1c01b4,_0x2bfaf9[_0x1a18('0x64')],_0x2bfaf9[_0x1a18('0x65')],_0x38f68f);})[_0x1a18('0x22')](function(_0x254e98){_0x51685e=_0x254e98;return getTicket(_0x4c0218,_0x26eea7,_0x51685e,_0x1c01b4,_0x2bfaf9,_0x1c01b4[_0x1a18('0x66')],_0x38f68f);})[_0x1a18('0x22')](function(_0x38d4e6){_0x1bcd19=_0x38d4e6;logger[_0x1a18('0x24')]('['+_0x2bfaf9[_0x1a18('0x7f')][_0x1a18('0x7e')]()+_0x1a18('0x80'),_0x1bcd19['id']);logger[_0x1a18('0x24')]('['+_0x2bfaf9[_0x1a18('0x7f')]['toUpperCase']()+_0x1a18('0x81'),_0x4c0218[_0x1a18('0x3c')]);})[_0x1a18('0x72')](function(_0x3267bf){logger[_0x1a18('0x70')]('['+_0x2bfaf9[_0x1a18('0x7f')][_0x1a18('0x7e')]()+']',_0x3267bf);});}; \ 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 737fde0..8b11bd3 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 _0xf62c=['endUserNumber','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','content','toString','idField','variable','variableName','Variable','name','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminId','adminEmail','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST'];(function(_0x52631f,_0x319db8){var _0x5accd2=function(_0x5ec169){while(--_0x5ec169){_0x52631f['push'](_0x52631f['shift']());}};_0x5accd2(++_0x319db8);}(_0xf62c,0xb3));var _0xcf62=function(_0x2f4de8,_0x313395){_0x2f4de8=_0x2f4de8-0x0;var _0x4569cb=_0xf62c[_0x2f4de8];return _0x4569cb;};'use strict';var _=require(_0xcf62('0x0'));var Promise=require(_0xcf62('0x1'));var rp=require(_0xcf62('0x2'));var util=require(_0xcf62('0x3'));var md5=require(_0xcf62('0x4'));var Redis=require(_0xcf62('0x5'));var intUtil=require(_0xcf62('0x6'));var config=require(_0xcf62('0x7'));var logger=require(_0xcf62('0x8'))(_0xcf62('0x9'));config[_0xcf62('0xa')]=_[_0xcf62('0xb')](config[_0xcf62('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x1239ec,_0x18e32b,_0x1d4c17,_0x4a1a7d,_0x23657a,_0x427775){return new Promise(function(_0x3c9f67,_0x488f0f){var _0x564ade={'method':_0xcf62('0xc'),'uri':_0x4a1a7d+_0xcf62('0xd')+'&'+_0x23657a+'&'+_0x427775,'auth':_0x18e32b,'json':!![]};return rp(_0x564ade)[_0xcf62('0xe')](function(_0x3e0d9c){if(_0x3e0d9c['result'][_0xcf62('0xf')]>0x0){_0x1d4c17['adminId']=_0x3e0d9c[_0xcf62('0x10')][0x0][_0xcf62('0x11')];}logger[_0xcf62('0x12')]('['+[_0x1239ec[_0xcf62('0x13')]()]+_0xcf62('0x14'),_0x1d4c17);_0x3c9f67(_0x1d4c17);})['catch'](function(_0x5048e4){logger[_0xcf62('0x15')]('['+[_0x1239ec[_0xcf62('0x13')]()]+']',_0x5048e4[_0xcf62('0x16')]);_0x488f0f(_0x5048e4['message']);});});}function getUser(_0x2b499e,_0x1971a0,_0x59bf2b,_0x5a001d,_0x539643){return function(_0x23f619){logger[_0xcf62('0x12')]('['+[_0x2b499e[_0xcf62('0x13')]()]+_0xcf62('0x17'),_0x23f619);return new Promise(function(_0x23858a,_0x5db4f4){if(intUtil[_0xcf62('0x18')](_0x23f619[_0xcf62('0x19')])){var _0x2843ea={'method':_0xcf62('0xc'),'uri':_0x59bf2b+_0xcf62('0x1a')+_0x23f619[_0xcf62('0x19')]+'&'+_0x5a001d+'&'+_0x539643,'auth':_0x1971a0,'json':!![]};logger[_0xcf62('0x12')]('['+[_0x2b499e['toUpperCase']()]+_0xcf62('0x1b'),_0x2843ea);return rp(_0x2843ea)['then'](function(_0x2367f3){logger['info']('['+[_0x2b499e[_0xcf62('0x13')]()]+_0xcf62('0x1c'),_0x2367f3);if(_0x2367f3[_0xcf62('0x10')][_0xcf62('0xf')]>0x0&&String(_0x2367f3[_0xcf62('0x10')][0x0]['active'])===_0xcf62('0x1d')){_0x23f619[_0xcf62('0x1e')]=_0x2367f3[_0xcf62('0x10')][0x0][_0xcf62('0x11')];}else{_0x23f619['userId']=_0x23f619[_0xcf62('0x1f')];_0x23f619[_0xcf62('0x19')]=_0x23f619[_0xcf62('0x20')];}logger[_0xcf62('0x12')]('['+[_0x2b499e[_0xcf62('0x13')]()]+'],\x20getUser\x20crm',_0x23f619);_0x23858a(_0x23f619);})[_0xcf62('0x21')](function(_0x45d7c4){logger[_0xcf62('0x15')]('['+[_0x2b499e[_0xcf62('0x13')]()]+']',_0x45d7c4['message']);_0x5db4f4(_0x45d7c4[_0xcf62('0x16')]);});}else{logger['info']('['+[_0x2b499e['toUpperCase']()]+_0xcf62('0x22'));_0x23f619[_0xcf62('0x1e')]=_0x23f619[_0xcf62('0x1f')];_0x23f619[_0xcf62('0x19')]=_0x23f619['adminEmail'];_0x23858a(_0x23f619);}});};}function createEndUser(_0x53f0a6,_0x49ba0a,_0x2ff906,_0x2fe3ec,_0x44565b){logger[_0xcf62('0x12')]('['+[_0x53f0a6[_0xcf62('0x13')]()]+_0xcf62('0x23'),_0x2ff906);return new Promise(function(_0x250ba9,_0x203c11){var _0x309f60={'method':_0xcf62('0x24'),'uri':_0x2fe3ec+'sys_user?'+_0x44565b,'body':{'user_name':_0x2ff906[_0xcf62('0x25')],'roles':'user','first_name':_0x2ff906[_0xcf62('0x25')],'active':_0xcf62('0x1d'),'date_format':_0xcf62('0x26'),'phone':_0x2ff906[_0xcf62('0x25')]},'auth':_0x49ba0a,'json':!![]};return rp(_0x309f60)['then'](function(_0x4d9eb7){logger[_0xcf62('0x12')]('['+[_0x53f0a6[_0xcf62('0x13')]()]+'],\x20EndUser\x20schema',_0x4d9eb7[_0xcf62('0x10')]);_0x2ff906[_0xcf62('0x27')]=_0x4d9eb7[_0xcf62('0x10')][_0xcf62('0x11')];_0x250ba9(_0x2ff906);})[_0xcf62('0x21')](function(_0x402113){logger[_0xcf62('0x15')]('['+[_0x53f0a6['toUpperCase']()]+']',_0x402113['message']);_0x203c11(_0x402113[_0xcf62('0x16')]);});});}function getEndUser(_0x326f4d,_0x3fcef4,_0x21c551,_0x1c8acb,_0x490d0c){return function(_0x260e72){logger[_0xcf62('0x12')]('['+[_0x326f4d[_0xcf62('0x13')]()]+_0xcf62('0x28'),_0x260e72);return new Promise(function(_0x159099,_0x34a478){var _0x497538={'method':_0xcf62('0xc'),'uri':_0x21c551+'sys_user?sysparm_query=phone%3D'+_0x260e72[_0xcf62('0x25')]+'&'+_0x1c8acb+'&'+_0x490d0c,'auth':_0x3fcef4,'json':!![]};return rp(_0x497538)[_0xcf62('0xe')](function(_0x5c4a2c){if(_0x5c4a2c['result']['length']>0x0){_0x260e72[_0xcf62('0x27')]=_0x5c4a2c[_0xcf62('0x10')][0x0]['sys_id'];logger[_0xcf62('0x12')]('['+[_0x326f4d[_0xcf62('0x13')]()]+_0xcf62('0x29'),_0x260e72);_0x159099(_0x260e72);}else{return createEndUser(_0x326f4d,_0x3fcef4,_0x260e72,_0x21c551,_0x1c8acb)[_0xcf62('0xe')](function(_0x15a623){logger['info']('['+[_0x326f4d['toUpperCase']()]+_0xcf62('0x2a'),_0x15a623);_0x159099(_0x15a623);});}})[_0xcf62('0x21')](function(_0x3738ad){logger[_0xcf62('0x15')]('['+[_0x326f4d[_0xcf62('0x13')]()]+']',_0x3738ad[_0xcf62('0x16')]);_0x34a478(_0x3738ad['message']);});});};}function getCustomFields(_0x26b297,_0x42db51){var _0x493c9d={};if(_0x26b297['length']>0x0){_[_0xcf62('0x2b')](_0x26b297,function(_0x2b29a4){if(_[_0xcf62('0x2c')]([_0xcf62('0x2d'),_0xcf62('0x2e')],_0x2b29a4[_0xcf62('0x2f')])&&_0x2b29a4['nameField']&&!_0x2b29a4[_0xcf62('0x30')]){_0x493c9d[_0x2b29a4['nameField'][_0xcf62('0x31')]()]=_0x2b29a4[_0xcf62('0x32')][_0xcf62('0x33')]();}else if(_[_0xcf62('0x2c')]([_0xcf62('0x2d'),_0xcf62('0x2e')],_0x2b29a4[_0xcf62('0x2f')])&&_0x2b29a4['idField']&&_0x2b29a4['customField']){_0x493c9d[_0x2b29a4[_0xcf62('0x34')][_0xcf62('0x31')]()]=_0x2b29a4[_0xcf62('0x32')][_0xcf62('0x33')]();}else if(_0x2b29a4['type']===_0xcf62('0x35')&&_0x2b29a4[_0xcf62('0x36')]&&_0x2b29a4[_0xcf62('0x34')]&&_0x2b29a4[_0xcf62('0x30')]){_0x493c9d[_0x2b29a4['idField'][_0xcf62('0x31')]()]=_0x42db51[_0x2b29a4['variableName']]['toString']();}else if(_0x2b29a4['type']==='customVariable'&&_0x2b29a4[_0xcf62('0x37')]&&_0x2b29a4['Variable'][_0xcf62('0x38')]&&_0x2b29a4[_0xcf62('0x34')]&&_0x2b29a4[_0xcf62('0x30')]){_0x493c9d[_0x2b29a4[_0xcf62('0x34')][_0xcf62('0x31')]()]=_0x42db51[_0x2b29a4[_0xcf62('0x37')][_0xcf62('0x38')]['toLowerCase']()]['toString']();}});}return _0x493c9d;}function getTicket(_0x194b54,_0x53fcd1,_0x3bc2c0,_0x161d4,_0x3da37d,_0x17c99a){return function(_0x214181){logger[_0xcf62('0x12')]('['+[_0x194b54[_0xcf62('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x214181);return new Promise(function(_0x10b700,_0x33fca7){var _0x59c153=_0x194b54[_0xcf62('0x31')]()===_0xcf62('0x39')?_0x214181['userId']:_0x214181[_0xcf62('0x27')];var _0x3c3b20={'method':_0xcf62('0x24'),'uri':_0x3bc2c0+_0xcf62('0x3a')+'?'+_0x17c99a,'body':Object[_0xcf62('0x3b')]({},{'active':_0xcf62('0x1d'),'caller_id':_0x59c153,'assigned_to':_0x214181[_0xcf62('0x1e')],'short_description':intUtil[_0xcf62('0x3c')](_0x161d4['Subjects'],_0x3da37d,'\x20'),'description':intUtil[_0xcf62('0x3c')](_0x161d4[_0xcf62('0x3d')],_0x3da37d,'\x0a')},getCustomFields(_0x161d4[_0xcf62('0x3e')],_0x3da37d)),'auth':_0x53fcd1,'json':!![]};return rp(_0x3c3b20)[_0xcf62('0xe')](function(_0xabd3e3){logger['info']('['+[_0x194b54['toUpperCase']()]+_0xcf62('0x3f'),_0xabd3e3[_0xcf62('0x10')]);_0x214181['ticketId']=_0xabd3e3[_0xcf62('0x10')]['sys_id'];_0x214181[_0xcf62('0x40')]=_0xabd3e3[_0xcf62('0x10')][_0xcf62('0x41')];logger[_0xcf62('0x12')]('['+[_0x194b54[_0xcf62('0x13')]()]+_0xcf62('0x42'),_0x214181);_0x10b700(_0x214181);})[_0xcf62('0x21')](function(_0x4cfb77){logger[_0xcf62('0x15')]('['+[_0x194b54['toUpperCase']()]+']',_0x4cfb77[_0xcf62('0x16')]);_0x33fca7(_0x4cfb77[_0xcf62('0x16')]);});});};}function createRemoteTag(_0x6020e4,_0x1f399a,_0x38238b,_0x395e60){return new Promise(function(_0x53ae70,_0x541d3c){var _0x10f19d={'method':'POST','uri':_0x38238b+_0xcf62('0x43')+'?'+_0x395e60,'body':{'short_description':_0x6020e4,'global':!![],'active':!![],'name':_0x6020e4},'auth':_0x1f399a,'json':!![]};return rp(_0x10f19d)[_0xcf62('0xe')](function(_0x256e9a){var _0x158101=_0x256e9a[_0xcf62('0x10')][_0xcf62('0x11')];_0x53ae70(_0x158101);});});}function getRemoteTag(_0x529ba3,_0x111feb,_0x23c3f5,_0x2e2fd4,_0x5c3e4e){return new Promise(function(_0x55ba12,_0x1ff1e3){var _0x12409e={'method':_0xcf62('0xc'),'uri':_0x23c3f5+_0xcf62('0x43')+_0xcf62('0x44')+_0x529ba3+'&'+_0x2e2fd4,'auth':_0x111feb,'json':!![]};return rp(_0x12409e)['then'](function(_0x8b8816){if(_0x8b8816[_0xcf62('0x10')][_0xcf62('0xf')]>0x0){var _0x169b5c=_0x8b8816[_0xcf62('0x10')][0x0]['sys_id'];_0x55ba12(_0x169b5c);}else{return createRemoteTag(_0x529ba3,_0x111feb,_0x23c3f5,_0x2e2fd4)['then'](function(_0x536ede){_0x55ba12(_0x536ede);});}});});}function assignTagToIncident(_0x3737a5,_0x4af025,_0x403f93,_0x2b4c91,_0x22ede7){return new Promise(function(_0x348878,_0x1d6f7e){var _0x1c65b2={'method':_0xcf62('0x24'),'uri':_0x403f93+_0xcf62('0x45')+'?'+_0x22ede7,'body':{'label':_0x3737a5,'table':_0xcf62('0x3a'),'id_type':'Incident','table_key':_0x2b4c91['ticketId'],'title':'Incident\x20-\x20'+_0x2b4c91[_0xcf62('0x40')],'id_display':_0x2b4c91['ticketNumber']},'auth':_0x4af025,'json':!![]};return rp(_0x1c65b2)[_0xcf62('0xe')](function(_0x397087){_0x348878();})['catch'](function(){_0x348878();});});}function manageTags(_0x2e787a,_0x1da7cc,_0x101134,_0x46c491,_0xa77add,_0x188085,_0x5b1b94){return new Promise(function(_0x48c38b,_0x1aa469){var _0x1b4c8f=[];_0x1da7cc['forEach'](function(_0x55f93e){_0x1b4c8f[_0xcf62('0x46')](getRemoteTag(_0x55f93e,_0x101134,_0x46c491,_0x188085,_0x5b1b94));});return Promise[_0xcf62('0x47')](_0x1b4c8f)[_0xcf62('0xe')](function(_0x510869){if(_0x510869[_0xcf62('0xf')]){logger[_0xcf62('0x12')]('['+[_0x2e787a[_0xcf62('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x510869);var _0x5756c6=[];_0x510869[_0xcf62('0x2b')](function(_0x202307){_0x5756c6[_0xcf62('0x46')](assignTagToIncident(_0x202307,_0x101134,_0x46c491,_0xa77add,_0x188085));});return Promise[_0xcf62('0x47')](_0x5756c6)[_0xcf62('0xe')](function(){_0x48c38b();})[_0xcf62('0x21')](function(){_0x48c38b();});}else{_0x48c38b();}});});}function getTags(_0x2323d9,_0xa59678,_0x4b26dd,_0x4cfbc4,_0x4a9101,_0x50205d){return function(_0x3bd541){return new Promise(function(_0x5d6321,_0x3da7e2){var _0x55e5ac=[];var _0x513755=_0x4cfbc4[_0xcf62('0x48')];if(_0x513755&&_0x513755['length']>0x0){_0x55e5ac=_[_0xcf62('0x49')](_0x513755,_0xcf62('0x38'));}if(_0x55e5ac['length']>0x0){return manageTags(_0x2323d9,_0x55e5ac,_0xa59678,_0x4b26dd,_0x3bd541,_0x4a9101,_0x50205d)[_0xcf62('0xe')](function(){_0x5d6321(_0x3bd541);});}else{_0x5d6321(_0x3bd541);}});};}function emit(_0x15e2eb,_0x57d8a2,_0x56ab92){var _0x2004dd=_0xcf62('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xcf62('0x4b')+_0xcf62('0x4c');var _0x56b45b={'uri':_0x15e2eb+_0xcf62('0x4d')+_0x56ab92+_0x2004dd};io['to'](util[_0xcf62('0x4e')](_0xcf62('0x4f'),_0x57d8a2))[_0xcf62('0x50')](_0xcf62('0x51'),_0x56b45b);}exports['cs']=function(_0x4f91cb,_0x54a061,_0x3c9ad9,_0x125126,_0x56a1fb,_0x2bccaf,_0x284ab6,_0x3fcf42){var _0x5b533a={};var _0x56268c={'user':_0x2bccaf[_0xcf62('0x52')],'pass':_0x2bccaf['password']};var _0x4c923a=_0xcf62('0x53');var _0x58f997='sysparm_display_value=true';_0x2bccaf[_0xcf62('0x54')]=intUtil[_0xcf62('0x55')](_0x2bccaf['remoteUri']);_0x2bccaf[_0xcf62('0x56')]=intUtil[_0xcf62('0x55')](_0x2bccaf[_0xcf62('0x56')]);var _0x3ef765=util[_0xcf62('0x4e')](_0xcf62('0x57'),_0x2bccaf[_0xcf62('0x54')]);_0x5b533a[_0xcf62('0x19')]=!_[_0xcf62('0x58')](_0x125126)?_0x125126[_0xcf62('0x59')]:null;_0x5b533a['adminEmail']=_0x2bccaf['email'];_0x5b533a[_0xcf62('0x25')]=_0x3fcf42[_0xcf62('0x31')]()==='outbound'?_0x54a061[_0xcf62('0x5a')]:_0x54a061['calleridnum'];_0x5b533a[_0xcf62('0x5b')]=_0x3fcf42===_0xcf62('0x5c')||_0x3fcf42===_0xcf62('0x5d')?'queue':_0xcf62('0x39');var _0x17ef15=util[_0xcf62('0x4e')](_0xcf62('0x5e'),_0x2bccaf[_0xcf62('0x56')],_0x54a061[_0xcf62('0x5f')],md5(_0x54a061[_0xcf62('0x5f')]));if(_0x56a1fb&&_0x56a1fb[_0xcf62('0x60')]){logger['info'](_0xcf62('0x61'),_0xcf62('0x62'));_0x54a061[_0xcf62('0x63')]=_0x17ef15;}else if(_0x284ab6&&_0x284ab6[_0xcf62('0x64')]&&_0x284ab6[_0xcf62('0x64')]!==_0xcf62('0x65')){logger[_0xcf62('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x54a061[_0xcf62('0x63')]=_0x17ef15;}else{_0x54a061[_0xcf62('0x63')]='';}return getAdminUser(_0x3fcf42,_0x56268c,_0x5b533a,_0x3ef765,_0x58f997,_0x4c923a)[_0xcf62('0xe')](getUser(_0x3fcf42,_0x56268c,_0x3ef765,_0x58f997,_0x4c923a))[_0xcf62('0xe')](getEndUser(_0x3fcf42,_0x56268c,_0x3ef765,_0x58f997,_0x4c923a))['then'](getTicket(_0x3fcf42,_0x56268c,_0x3ef765,_0x3c9ad9,_0x54a061,_0x58f997))['then'](function(_0x57ac3f){logger[_0xcf62('0x12')](util['format'](_0xcf62('0x66'),_0x57ac3f[_0xcf62('0x67')]));logger['info'](util[_0xcf62('0x4e')](_0xcf62('0x68'),_0x3fcf42));if(_0x3fcf42!==_0xcf62('0x5d')){logger['info']('['+[_0x3fcf42['toUpperCase']()]+']',_0xcf62('0x69'));emit(_0x2bccaf[_0xcf62('0x54')],_0x125126[_0xcf62('0x38')],_0x57ac3f[_0xcf62('0x67')]);}})['catch'](function(_0x5031c0){logger['error']('['+[_0x3fcf42['toUpperCase']()]+_0xcf62('0x6a'),util[_0xcf62('0x6b')](_0x5031c0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0542=['remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','servicenow','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','sys_id','catch','error','toUpperCase','message','validateEmail','userEmail','GET','info','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','true','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1'];(function(_0x16e705,_0x3d4b58){var _0x197878=function(_0x4091b5){while(--_0x4091b5){_0x16e705['push'](_0x16e705['shift']());}};_0x197878(++_0x3d4b58);}(_0x0542,0x155));var _0x2054=function(_0x3ec0ef,_0x524a76){_0x3ec0ef=_0x3ec0ef-0x0;var _0x313833=_0x0542[_0x3ec0ef];return _0x313833;};'use strict';var _=require(_0x2054('0x0'));var Promise=require(_0x2054('0x1'));var rp=require(_0x2054('0x2'));var util=require(_0x2054('0x3'));var md5=require(_0x2054('0x4'));var Redis=require(_0x2054('0x5'));var intUtil=require('./util');var config=require(_0x2054('0x6'));var logger=require('../../../../config/logger')(_0x2054('0x7'));config[_0x2054('0x8')]=_['defaults'](config[_0x2054('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2054('0x9'))(new Redis(config[_0x2054('0x8')]));function getAdminUser(_0x454c81,_0x4558f3,_0x2ebba7,_0x314045,_0x30d799,_0x50f93){return new Promise(function(_0x2973e2,_0x45eae6){var _0x271690={'method':'GET','uri':_0x314045+_0x2054('0xa')+'&'+_0x30d799+'&'+_0x50f93,'auth':_0x4558f3,'json':!![]};return rp(_0x271690)[_0x2054('0xb')](function(_0xd75f2e){if(_0xd75f2e['result'][_0x2054('0xc')]>0x0){_0x2ebba7[_0x2054('0xd')]=_0xd75f2e['result'][0x0][_0x2054('0xe')];}logger['info']('['+[_0x454c81['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x2ebba7);_0x2973e2(_0x2ebba7);})[_0x2054('0xf')](function(_0x40b985){logger[_0x2054('0x10')]('['+[_0x454c81[_0x2054('0x11')]()]+']',_0x40b985['message']);_0x45eae6(_0x40b985[_0x2054('0x12')]);});});}function getUser(_0x14989a,_0x407dee,_0x24c35d,_0x143f04,_0x5e0220){return function(_0x4b5879){logger['info']('['+[_0x14989a[_0x2054('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x4b5879);return new Promise(function(_0x19e6d4,_0x27fe2a){if(intUtil[_0x2054('0x13')](_0x4b5879[_0x2054('0x14')])){var _0x6ec4aa={'method':_0x2054('0x15'),'uri':_0x24c35d+'sys_user?sysparm_query=email%3D'+_0x4b5879['userEmail']+'&'+_0x143f04+'&'+_0x5e0220,'auth':_0x407dee,'json':!![]};logger[_0x2054('0x16')]('['+[_0x14989a[_0x2054('0x11')]()]+_0x2054('0x17'),_0x6ec4aa);return rp(_0x6ec4aa)['then'](function(_0x5a19d6){logger[_0x2054('0x16')]('['+[_0x14989a[_0x2054('0x11')]()]+_0x2054('0x18'),_0x5a19d6);if(_0x5a19d6['result'][_0x2054('0xc')]>0x0&&String(_0x5a19d6[_0x2054('0x19')][0x0][_0x2054('0x1a')])==='true'){_0x4b5879[_0x2054('0x1b')]=_0x5a19d6[_0x2054('0x19')][0x0]['sys_id'];}else{_0x4b5879[_0x2054('0x1b')]=_0x4b5879[_0x2054('0xd')];_0x4b5879['userEmail']=_0x4b5879[_0x2054('0x1c')];}logger['info']('['+[_0x14989a[_0x2054('0x11')]()]+'],\x20getUser\x20crm',_0x4b5879);_0x19e6d4(_0x4b5879);})[_0x2054('0xf')](function(_0x1f5692){logger[_0x2054('0x10')]('['+[_0x14989a[_0x2054('0x11')]()]+']',_0x1f5692[_0x2054('0x12')]);_0x27fe2a(_0x1f5692['message']);});}else{logger[_0x2054('0x16')]('['+[_0x14989a[_0x2054('0x11')]()]+_0x2054('0x1d'));_0x4b5879['userId']=_0x4b5879['adminId'];_0x4b5879[_0x2054('0x14')]=_0x4b5879[_0x2054('0x1c')];_0x19e6d4(_0x4b5879);}});};}function createEndUser(_0x421d20,_0x4ee23e,_0x38a332,_0x50d26f,_0x4f5609){logger[_0x2054('0x16')]('['+[_0x421d20[_0x2054('0x11')]()]+_0x2054('0x1e'),_0x38a332);return new Promise(function(_0x4805ac,_0x126db9){var _0x1f0be4={'method':_0x2054('0x1f'),'uri':_0x50d26f+_0x2054('0x20')+_0x4f5609,'body':{'user_name':_0x38a332['endUserNumber'],'roles':_0x2054('0x21'),'first_name':_0x38a332['endUserNumber'],'active':_0x2054('0x22'),'date_format':'System','phone':_0x38a332[_0x2054('0x23')]},'auth':_0x4ee23e,'json':!![]};return rp(_0x1f0be4)[_0x2054('0xb')](function(_0x243f17){logger[_0x2054('0x16')]('['+[_0x421d20[_0x2054('0x11')]()]+_0x2054('0x24'),_0x243f17[_0x2054('0x19')]);_0x38a332[_0x2054('0x25')]=_0x243f17[_0x2054('0x19')][_0x2054('0xe')];_0x4805ac(_0x38a332);})[_0x2054('0xf')](function(_0x1d53e0){logger[_0x2054('0x10')]('['+[_0x421d20[_0x2054('0x11')]()]+']',_0x1d53e0[_0x2054('0x12')]);_0x126db9(_0x1d53e0['message']);});});}function getEndUser(_0x169400,_0x59319f,_0x208c75,_0x46e6e4,_0x7fa4c6){return function(_0x54834f){logger[_0x2054('0x16')]('['+[_0x169400[_0x2054('0x11')]()]+_0x2054('0x26'),_0x54834f);return new Promise(function(_0x5ae349,_0x5e21f5){var _0x385944={'method':_0x2054('0x15'),'uri':_0x208c75+'sys_user?sysparm_query=phone%3D'+_0x54834f['endUserNumber']+'&'+_0x46e6e4+'&'+_0x7fa4c6,'auth':_0x59319f,'json':!![]};return rp(_0x385944)[_0x2054('0xb')](function(_0xe4ad1a){if(_0xe4ad1a[_0x2054('0x19')][_0x2054('0xc')]>0x0){_0x54834f[_0x2054('0x25')]=_0xe4ad1a[_0x2054('0x19')][0x0]['sys_id'];logger[_0x2054('0x16')]('['+[_0x169400[_0x2054('0x11')]()]+_0x2054('0x27'),_0x54834f);_0x5ae349(_0x54834f);}else{return createEndUser(_0x169400,_0x59319f,_0x54834f,_0x208c75,_0x46e6e4)['then'](function(_0x37b45f){logger['info']('['+[_0x169400['toUpperCase']()]+_0x2054('0x28'),_0x37b45f);_0x5ae349(_0x37b45f);});}})[_0x2054('0xf')](function(_0x4fc2ca){logger[_0x2054('0x10')]('['+[_0x169400[_0x2054('0x11')]()]+']',_0x4fc2ca[_0x2054('0x12')]);_0x5e21f5(_0x4fc2ca[_0x2054('0x12')]);});});};}function getCustomFields(_0x3c6808,_0x307c01){var _0x52a714={};if(_0x3c6808[_0x2054('0xc')]>0x0){_[_0x2054('0x29')](_0x3c6808,function(_0x5d63dc){if(_[_0x2054('0x2a')]([_0x2054('0x2b'),_0x2054('0x2c')],_0x5d63dc[_0x2054('0x2d')])&&_0x5d63dc[_0x2054('0x2e')]&&!_0x5d63dc[_0x2054('0x2f')]){_0x52a714[_0x5d63dc[_0x2054('0x2e')][_0x2054('0x30')]()]=_0x5d63dc[_0x2054('0x31')][_0x2054('0x32')]();}else if(_[_0x2054('0x2a')](['string',_0x2054('0x2c')],_0x5d63dc[_0x2054('0x2d')])&&_0x5d63dc['idField']&&_0x5d63dc[_0x2054('0x2f')]){_0x52a714[_0x5d63dc[_0x2054('0x33')]['toLowerCase']()]=_0x5d63dc['content'][_0x2054('0x32')]();}else if(_0x5d63dc[_0x2054('0x2d')]===_0x2054('0x34')&&_0x5d63dc[_0x2054('0x35')]&&_0x5d63dc['idField']&&_0x5d63dc[_0x2054('0x2f')]){_0x52a714[_0x5d63dc[_0x2054('0x33')]['toLowerCase']()]=_0x307c01[_0x5d63dc[_0x2054('0x35')]][_0x2054('0x32')]();}else if(_0x5d63dc[_0x2054('0x2d')]===_0x2054('0x36')&&_0x5d63dc['Variable']&&_0x5d63dc[_0x2054('0x37')][_0x2054('0x38')]&&_0x5d63dc[_0x2054('0x33')]&&_0x5d63dc['customField']){_0x52a714[_0x5d63dc[_0x2054('0x33')][_0x2054('0x30')]()]=_0x307c01[_0x5d63dc[_0x2054('0x37')][_0x2054('0x38')][_0x2054('0x30')]()][_0x2054('0x32')]();}});}return _0x52a714;}function getTicket(_0x22b245,_0x321c8a,_0x2bf431,_0x9550b2,_0x11d3bd,_0x10ed9e){return function(_0x4a1889){logger['info']('['+[_0x22b245[_0x2054('0x11')]()]+_0x2054('0x39'),_0x4a1889);return new Promise(function(_0x39682f,_0x157578){var _0x2498d1=_0x22b245[_0x2054('0x30')]()===_0x2054('0x3a')?_0x4a1889[_0x2054('0x1b')]:_0x4a1889[_0x2054('0x25')];var _0x2e56f1={'method':_0x2054('0x1f'),'uri':_0x2bf431+_0x2054('0x3b')+'?'+_0x10ed9e,'body':Object[_0x2054('0x3c')]({},{'active':_0x2054('0x22'),'caller_id':_0x2498d1,'assigned_to':_0x4a1889[_0x2054('0x1b')],'short_description':intUtil[_0x2054('0x3d')](_0x9550b2['Subjects'],_0x11d3bd,'\x20'),'description':intUtil['getString'](_0x9550b2[_0x2054('0x3e')],_0x11d3bd,'\x0a')},getCustomFields(_0x9550b2[_0x2054('0x3f')],_0x11d3bd)),'auth':_0x321c8a,'json':!![]};return rp(_0x2e56f1)[_0x2054('0xb')](function(_0x11d440){logger[_0x2054('0x16')]('['+[_0x22b245[_0x2054('0x11')]()]+_0x2054('0x40'),_0x11d440[_0x2054('0x19')]);_0x4a1889[_0x2054('0x41')]=_0x11d440['result'][_0x2054('0xe')];_0x4a1889[_0x2054('0x42')]=_0x11d440[_0x2054('0x19')]['number'];logger[_0x2054('0x16')]('['+[_0x22b245[_0x2054('0x11')]()]+_0x2054('0x43'),_0x4a1889);_0x39682f(_0x4a1889);})[_0x2054('0xf')](function(_0xe276cf){logger[_0x2054('0x10')]('['+[_0x22b245['toUpperCase']()]+']',_0xe276cf['message']);_0x157578(_0xe276cf[_0x2054('0x12')]);});});};}function createRemoteTag(_0x44ac91,_0x4ea41d,_0x7a7bde,_0x363733){return new Promise(function(_0x3e2d30,_0x3a49a7){var _0x1dcce1={'method':_0x2054('0x1f'),'uri':_0x7a7bde+_0x2054('0x44')+'?'+_0x363733,'body':{'short_description':_0x44ac91,'global':!![],'active':!![],'name':_0x44ac91},'auth':_0x4ea41d,'json':!![]};return rp(_0x1dcce1)[_0x2054('0xb')](function(_0x154bf4){var _0x10bbe8=_0x154bf4['result']['sys_id'];_0x3e2d30(_0x10bbe8);});});}function getRemoteTag(_0x1bab3a,_0x3529fd,_0x29ae0b,_0x505146,_0x1a594a){return new Promise(function(_0x44f00c,_0x5c9f80){var _0xa895a7={'method':'GET','uri':_0x29ae0b+_0x2054('0x44')+'?sysparm_query=name%3D'+_0x1bab3a+'&'+_0x505146,'auth':_0x3529fd,'json':!![]};return rp(_0xa895a7)[_0x2054('0xb')](function(_0x25bb6e){if(_0x25bb6e[_0x2054('0x19')][_0x2054('0xc')]>0x0){var _0x4905fb=_0x25bb6e[_0x2054('0x19')][0x0][_0x2054('0xe')];_0x44f00c(_0x4905fb);}else{return createRemoteTag(_0x1bab3a,_0x3529fd,_0x29ae0b,_0x505146)[_0x2054('0xb')](function(_0x478a91){_0x44f00c(_0x478a91);});}});});}function assignTagToIncident(_0x3d8f39,_0x81a9eb,_0x13c718,_0x22206c,_0x3655b4){return new Promise(function(_0x505086,_0x5a9819){var _0x5618e4={'method':_0x2054('0x1f'),'uri':_0x13c718+_0x2054('0x45')+'?'+_0x3655b4,'body':{'label':_0x3d8f39,'table':_0x2054('0x3b'),'id_type':_0x2054('0x46'),'table_key':_0x22206c[_0x2054('0x41')],'title':_0x2054('0x47')+_0x22206c[_0x2054('0x42')],'id_display':_0x22206c[_0x2054('0x42')]},'auth':_0x81a9eb,'json':!![]};return rp(_0x5618e4)[_0x2054('0xb')](function(_0x58b982){_0x505086();})[_0x2054('0xf')](function(){_0x505086();});});}function manageTags(_0x23e551,_0x5701f3,_0x1b07cc,_0x46ef7f,_0x5ddfd1,_0x38058d,_0x5cf730){return new Promise(function(_0x362531,_0x1bd382){var _0x3ebb2b=[];_0x5701f3['forEach'](function(_0x12d17a){_0x3ebb2b[_0x2054('0x48')](getRemoteTag(_0x12d17a,_0x1b07cc,_0x46ef7f,_0x38058d,_0x5cf730));});return Promise[_0x2054('0x49')](_0x3ebb2b)[_0x2054('0xb')](function(_0x2baa93){if(_0x2baa93[_0x2054('0xc')]){logger['info']('['+[_0x23e551[_0x2054('0x11')]()]+_0x2054('0x4a'),_0x2baa93);var _0x18b82b=[];_0x2baa93[_0x2054('0x29')](function(_0x4678b8){_0x18b82b[_0x2054('0x48')](assignTagToIncident(_0x4678b8,_0x1b07cc,_0x46ef7f,_0x5ddfd1,_0x38058d));});return Promise[_0x2054('0x49')](_0x18b82b)['then'](function(){_0x362531();})['catch'](function(){_0x362531();});}else{_0x362531();}});});}function getTags(_0x37308f,_0xaf1143,_0x41c41b,_0x321501,_0x6271fc,_0x34138b){return function(_0x3ca181){return new Promise(function(_0x460108,_0x4288a1){var _0x3b5434=[];var _0x174208=_0x321501[_0x2054('0x4b')];if(_0x174208&&_0x174208[_0x2054('0xc')]>0x0){_0x3b5434=_['map'](_0x174208,'name');}if(_0x3b5434[_0x2054('0xc')]>0x0){return manageTags(_0x37308f,_0x3b5434,_0xaf1143,_0x41c41b,_0x3ca181,_0x6271fc,_0x34138b)[_0x2054('0xb')](function(){_0x460108(_0x3ca181);});}else{_0x460108(_0x3ca181);}});};}function emit(_0x433777,_0x1ae948,_0xa3a787){var _0x12bee7=_0x2054('0x4c')+_0x2054('0x4d')+_0x2054('0x4e')+_0x2054('0x4f');var _0x1d4f97={'uri':_0x433777+_0x2054('0x50')+_0xa3a787+_0x12bee7};io['to'](util[_0x2054('0x51')]('user:%s',_0x1ae948))[_0x2054('0x52')](_0x2054('0x53'),_0x1d4f97);}exports['cs']=function(_0x41989e,_0x363012,_0x510bef,_0x41b466,_0x2eecf5,_0x81fcd0,_0x409786,_0x3e6ac7){var _0x42b881={};var _0x2a6156={'user':_0x81fcd0[_0x2054('0x54')],'pass':_0x81fcd0[_0x2054('0x55')]};var _0x2ff20e=_0x2054('0x56');var _0x5c3872='sysparm_display_value=true';_0x81fcd0[_0x2054('0x57')]=intUtil[_0x2054('0x58')](_0x81fcd0[_0x2054('0x57')]);_0x81fcd0[_0x2054('0x59')]=intUtil[_0x2054('0x58')](_0x81fcd0['serverUrl']);var _0xda6c11=util[_0x2054('0x51')]('%s/api/now/table/',_0x81fcd0[_0x2054('0x57')]);_0x42b881[_0x2054('0x14')]=!_[_0x2054('0x5a')](_0x41b466)?_0x41b466[_0x2054('0x5b')]:null;_0x42b881['adminEmail']=_0x81fcd0['email'];_0x42b881[_0x2054('0x23')]=_0x3e6ac7[_0x2054('0x30')]()===_0x2054('0x3a')?_0x363012[_0x2054('0x5c')]:_0x363012['calleridnum'];_0x42b881[_0x2054('0x5d')]=_0x3e6ac7==='queue'||_0x3e6ac7===_0x2054('0x5e')?_0x2054('0x5f'):_0x2054('0x3a');var _0x372090=util['format'](_0x2054('0x60'),_0x81fcd0[_0x2054('0x59')],_0x363012[_0x2054('0x61')],md5(_0x363012[_0x2054('0x61')]));if(_0x2eecf5&&_0x2eecf5[_0x2054('0x62')]){logger[_0x2054('0x16')]('[QUEUE]',_0x2054('0x63'));_0x363012[_0x2054('0x64')]=_0x372090;}else if(_0x409786&&_0x409786[_0x2054('0x65')]&&_0x409786['recordingFormat']!==_0x2054('0x66')){logger['info']('[OUTBOUND]',_0x2054('0x63'));_0x363012[_0x2054('0x64')]=_0x372090;}else{_0x363012['recordingURL']='';}return getAdminUser(_0x3e6ac7,_0x2a6156,_0x42b881,_0xda6c11,_0x5c3872,_0x2ff20e)[_0x2054('0xb')](getUser(_0x3e6ac7,_0x2a6156,_0xda6c11,_0x5c3872,_0x2ff20e))['then'](getEndUser(_0x3e6ac7,_0x2a6156,_0xda6c11,_0x5c3872,_0x2ff20e))[_0x2054('0xb')](getTicket(_0x3e6ac7,_0x2a6156,_0xda6c11,_0x510bef,_0x363012,_0x5c3872))[_0x2054('0xb')](function(_0x53295e){logger[_0x2054('0x16')](util[_0x2054('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x53295e['ticketId']));logger[_0x2054('0x16')](util[_0x2054('0x51')](_0x2054('0x67'),_0x3e6ac7));if(_0x3e6ac7!==_0x2054('0x5e')){logger[_0x2054('0x16')]('['+[_0x3e6ac7[_0x2054('0x11')]()]+']',_0x2054('0x68'));emit(_0x81fcd0[_0x2054('0x57')],_0x41b466[_0x2054('0x38')],_0x53295e[_0x2054('0x41')]);}})['catch'](function(_0xc5c6e9){logger[_0x2054('0x10')]('['+[_0x3e6ac7['toUpperCase']()]+_0x2054('0x69'),util[_0x2054('0x6a')](_0xc5c6e9,{'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 eff508e..02f7d0e 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 _0x6a7f=['contacts','version','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','unmanaged','toUpperCase','isNil','users','error','lastevent','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','format','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','merge','length','type','string','nameField','toLowerCase','content','customField','custom_fields','Variable','login','username','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!'];(function(_0x1c7338,_0x4459fb){var _0xccfb39=function(_0x1017ca){while(--_0x1017ca){_0x1c7338['push'](_0x1c7338['shift']());}};_0xccfb39(++_0x4459fb);}(_0x6a7f,0x1ec));var _0xf6a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xf6a7('0x0'));var BPromise=require(_0xf6a7('0x1'));var md5=require(_0xf6a7('0x2'));var util=require(_0xf6a7('0x3'));var Redis=require('ioredis');var intUtil=require(_0xf6a7('0x4'));var config=require(_0xf6a7('0x5'));var logger=require(_0xf6a7('0x6'))('sugarcrm');config[_0xf6a7('0x7')]=_[_0xf6a7('0x8')](config[_0xf6a7('0x7')],{'host':_0xf6a7('0x9'),'port':0x18eb});var io=require(_0xf6a7('0xa'))(new Redis(config['redis']));var def={'method':_0xf6a7('0xb'),'json':!![]};function emit(_0x34ccb2,_0x1694a8,_0xdef8bd){io['to'](_0x34ccb2)[_0xf6a7('0xc')](_0x1694a8,_0xdef8bd);}function getTicket(_0xe2b998,_0x3ae799,_0x197d7b,_0x2e1025,_0x1f3abe,_0x53860f,_0x175032,_0x4c722e){logger[_0xf6a7('0xd')]('Creating\x20new\x20ticket...');var _0x3e09f0=new Date();var _0x58e286=[{'name':_0xf6a7('0xe'),'value':intUtil[_0xf6a7('0xf')](_0x2e1025['Subjects'],_0x1f3abe,'\x20')},{'name':_0xf6a7('0x10'),'value':_0x3ae799['id']},{'name':_0xf6a7('0x11'),'value':_0x3ae799['id']},{'name':_0xf6a7('0x12'),'value':intUtil['getString'](_0x2e1025[_0xf6a7('0x13')],_0x1f3abe,'\x0a')},{'name':_0xf6a7('0x14'),'value':_0x3e09f0['toISOString']()[_0xf6a7('0x15')](0x0,0x13)[_0xf6a7('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xf6a7('0x17'),'value':'15'},{'name':_0xf6a7('0x18'),'value':_0x197d7b['id']},{'name':_0xf6a7('0x19'),'value':'Contacts'},{'name':_0xf6a7('0x1a'),'value':_0x197d7b[_0xf6a7('0xe')]},{'name':_0xf6a7('0x1b'),'value':_0x4c722e}];if(_0x53860f['length']){_[_0xf6a7('0x1c')](_0x53860f,function(_0x2b9564){if(_0x1f3abe[_0x2b9564[_0xf6a7('0x1d')]]){_0x58e286[_0xf6a7('0x1e')]({'name':_0x2b9564[_0xf6a7('0x1f')],'value':_0x1f3abe[_0x2b9564[_0xf6a7('0x1d')]]});}});}return request({'form':{'method':_0xf6a7('0x20'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x175032['id'],'module_name':'Calls','name_value_list':_0x58e286})}});}function getAuth(_0x9f0e92){return util[_0xf6a7('0x23')]('Basic\x20%s',new Buffer(_0x9f0e92['apiKey']+':X')[_0xf6a7('0x24')](_0xf6a7('0x25')));}function getServerInfo(_0x17c43c){return request({'form':{'method':_0xf6a7('0x26'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON['stringify']({'session':_0x17c43c['id']})}});}function getUser(_0x313d7c,_0x36fe44,_0x4dd770){if(!_['isNil'](_0x36fe44)){logger[_0xf6a7('0xd')](_0xf6a7('0x27'),_0x36fe44);return request({'form':{'method':_0xf6a7('0x28'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x4dd770['id'],'module_name':_0xf6a7('0x29'),'query':util[_0xf6a7('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x36fe44),'order_by':'','offset':'0','select_fields':['id',_0xf6a7('0xe'),_0xf6a7('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6a7('0x2b')](function(_0x55821d){if(_0x55821d[_0xf6a7('0x2c')]['length']){var _0x25e5da=_[_0xf6a7('0x2d')](_0x55821d[_0xf6a7('0x2c')],function(_0x23fe52){return _0x23fe52['name_value_list'][_0xf6a7('0x2a')][_0xf6a7('0x2e')]===_0x36fe44;});if(_0x25e5da){logger[_0xf6a7('0xd')](_0xf6a7('0x2f'));return BPromise[_0xf6a7('0x30')]({'id':_0x25e5da[_0xf6a7('0x31')]['id'][_0xf6a7('0x2e')],'name':_0x25e5da[_0xf6a7('0x31')]['name'][_0xf6a7('0x2e')]});}}logger[_0xf6a7('0xd')](_0xf6a7('0x32'));return BPromise[_0xf6a7('0x30')]({'id':_0x4dd770[_0xf6a7('0x31')][_0xf6a7('0x33')][_0xf6a7('0x2e')],'name':_0x4dd770['name_value_list'][_0xf6a7('0x2a')][_0xf6a7('0x2e')]});});}else{logger[_0xf6a7('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4dd770[_0xf6a7('0x31')][_0xf6a7('0x33')][_0xf6a7('0x2e')],'name':_0x4dd770[_0xf6a7('0x31')][_0xf6a7('0x2a')][_0xf6a7('0x2e')]});}}function getEndUser(_0x6d581f,_0x411c3a,_0x519b81,_0x3403a4){logger['info'](_0xf6a7('0x34'),_0x519b81);return request({'form':{'method':_0xf6a7('0x28'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x3403a4['id'],'module_name':_0xf6a7('0x35'),'query':util[_0xf6a7('0x23')](_0xf6a7('0x36'),_0x519b81),'order_by':'','offset':'0','select_fields':['id',_0xf6a7('0xe'),_0xf6a7('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1f8d50){if(_0x1f8d50[_0xf6a7('0x2c')]['length']){var _0x5969ce=_[_0xf6a7('0x2d')](_0x1f8d50[_0xf6a7('0x2c')],function(_0x5b30bd){return _0x5b30bd[_0xf6a7('0x31')]['phone_home']['value']===_0x519b81;});if(_0x5969ce){logger[_0xf6a7('0xd')](_0xf6a7('0x38'));return BPromise['resolve']({'id':_0x5969ce['name_value_list']['id'][_0xf6a7('0x2e')],'name':_0x5969ce[_0xf6a7('0x31')][_0xf6a7('0xe')]['value'],'phone':_0x5969ce[_0xf6a7('0x31')][_0xf6a7('0x37')][_0xf6a7('0x2e')]});}}else{logger['info'](_0xf6a7('0x39'));return request({'form':{'method':_0xf6a7('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf6a7('0x22')]({'session':_0x3403a4['id'],'module_name':_0xf6a7('0x35'),'name_value_list':[{'name':_0xf6a7('0x3a'),'value':_0x411c3a!==_0xf6a7('0x3b')?_0x411c3a:util[_0xf6a7('0x23')](_0xf6a7('0x3c'),_0x519b81)},{'name':_0xf6a7('0x37'),'value':_0x519b81}]})}})[_0xf6a7('0x2b')](function(_0x28fe41){logger[_0xf6a7('0xd')]('Enduser\x20created.');return BPromise[_0xf6a7('0x30')]({'id':_0x28fe41['id'],'name':_0x28fe41['entry_list'][_0xf6a7('0x3a')][_0xf6a7('0x2e')],'phone':_0x28fe41['entry_list']['phone_home'][_0xf6a7('0x2e')]});});}});}function request(_0x163707){logger['debug']('[HTTP]',JSON[_0xf6a7('0x22')](_0x163707));return rp(_[_0xf6a7('0x3d')](def,_0x163707));}function getTags(_0x460797,_0x2c2e87){var _0x2844c3=[];if(_0x460797&&_0x460797[_0xf6a7('0x3e')]>0x0){_0x2844c3=_['map'](_0x460797,_0x2c2e87);}return _0x2844c3;}function getCustomFields(_0x4e5907,_0x2590c9){var _0x130777=[];var _0x2f6dae={'custom_fields':[]};if(_0x4e5907[_0xf6a7('0x3e')]>0x0){_[_0xf6a7('0x1c')](_0x4e5907,function(_0x7302c3){if(_0x7302c3[_0xf6a7('0x3f')]===_0xf6a7('0x40')&&_0x7302c3[_0xf6a7('0x41')]&&!_0x7302c3['customField']){_0x2f6dae[_0x7302c3['nameField'][_0xf6a7('0x42')]()]=_0x7302c3[_0xf6a7('0x43')][_0xf6a7('0x24')]();}else if(_0x7302c3[_0xf6a7('0x3f')]===_0xf6a7('0x40')&&_0x7302c3['idField']&&_0x7302c3[_0xf6a7('0x44')]){_0x2f6dae[_0xf6a7('0x45')][_0xf6a7('0x1e')]({'id':_0x7302c3[_0xf6a7('0x1f')],'value':_0x7302c3['content'][_0xf6a7('0x24')]()});}else if(_0x7302c3[_0xf6a7('0x3f')]==='variable'&&_0x7302c3[_0xf6a7('0x1d')]&&_0x7302c3[_0xf6a7('0x1f')]&&_0x7302c3['customField']){_0x2590c9[_0x7302c3['variableName']]&&_0x2f6dae[_0xf6a7('0x45')][_0xf6a7('0x1e')]({'id':_0x7302c3[_0xf6a7('0x1f')],'value':_0x2590c9[_0x7302c3[_0xf6a7('0x1d')]][_0xf6a7('0x24')]()});}else if(_0x7302c3[_0xf6a7('0x3f')]==='customVariable'&&_0x7302c3[_0xf6a7('0x46')]&&_0x7302c3['Variable'][_0xf6a7('0xe')]&&_0x7302c3[_0xf6a7('0x1f')]&&_0x7302c3[_0xf6a7('0x44')]){_0x2590c9[_0x7302c3[_0xf6a7('0x46')]['name'][_0xf6a7('0x42')]()]&&_0x2f6dae[_0xf6a7('0x45')][_0xf6a7('0x1e')]({'id':_0x7302c3[_0xf6a7('0x1f')],'value':_0x2590c9[_0x7302c3['Variable']['name'][_0xf6a7('0x42')]()][_0xf6a7('0x24')]()});}});}return _0x2f6dae;}function getConnection(_0x612b3a){return request({'method':_0xf6a7('0xb'),'form':{'method':_0xf6a7('0x47'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'user_auth':{'user_name':_0x612b3a[_0xf6a7('0x48')],'password':_0x612b3a['password'],'encryption':_0xf6a7('0x49')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x279449){var _0x455886=_0x279449;if(_0x455886['id']){def['sessionID']=_0x455886['id'];return BPromise[_0xf6a7('0x30')](_0x455886);}else{throw new Error(util[_0xf6a7('0x23')](_0xf6a7('0x4a'),_0x612b3a['id']));}});}function setRelationship(_0x524401,_0x345ab2,_0x5a5a6d,_0x1efb4b){return request({'form':{'method':_0xf6a7('0x4b'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x524401['id'],'module_name':_0xf6a7('0x4c'),'module_id':_0x5a5a6d['id'],'link_field_name':_0x1efb4b,'related_ids':[_0x345ab2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf6a7('0x4d')]=function(_0x3ad477,_0x4de817,_0x256b88,_0x4630ef,_0x3d1209,_0x29d9e5){var _0x5cd6de,_0x1f39b6,_0x12350b,_0x390c3b;_0x29d9e5[_0xf6a7('0x4e')]=intUtil[_0xf6a7('0x4f')](_0x29d9e5[_0xf6a7('0x4e')]);_0x29d9e5[_0xf6a7('0x50')]=intUtil[_0xf6a7('0x4f')](_0x29d9e5[_0xf6a7('0x50')]);def[_0xf6a7('0x51')]=util[_0xf6a7('0x23')](_0xf6a7('0x52'),_0x29d9e5['remoteUri']);if(_0x3d1209&&_0x3d1209[_0xf6a7('0x53')]){logger[_0xf6a7('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4de817[_0xf6a7('0x54')]=util[_0xf6a7('0x23')](_0xf6a7('0x55'),_0x29d9e5[_0xf6a7('0x50')],_0x4de817[_0xf6a7('0x56')],md5(_0x4de817['uniqueid']));}else{_0x4de817['recordingURL']='';}return getConnection(_0x29d9e5)[_0xf6a7('0x2b')](function(_0x20fd8a){_0x390c3b=_0x20fd8a;return getUser(_0x29d9e5,_0x4630ef[_0xf6a7('0xe')],_0x390c3b);})['then'](function(_0x567685){_0x5cd6de=_0x567685;logger[_0xf6a7('0xd')]('The\x20User\x20ID\x20is:',_0x5cd6de['id']);return getEndUser(_0x29d9e5,_0x4de817[_0xf6a7('0x57')],_0x4de817[_0xf6a7('0x58')],_0x390c3b);})[_0xf6a7('0x2b')](function(_0x2371e1){_0x1f39b6=_0x2371e1;logger[_0xf6a7('0xd')](_0xf6a7('0x59'),_0x1f39b6['id']);return getTicket(_0x29d9e5,_0x5cd6de,_0x1f39b6,_0x256b88,_0x4de817,_0x256b88[_0xf6a7('0x5a')],_0x390c3b,_0xf6a7('0x5b'));})[_0xf6a7('0x2b')](function(_0x21c1a2){_0x12350b=_0x21c1a2;logger[_0xf6a7('0xd')](_0xf6a7('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x12350b['id']);return setRelationship(_0x390c3b,_0x5cd6de,_0x12350b,'users');})[_0xf6a7('0x2b')](function(){return setRelationship(_0x390c3b,_0x1f39b6,_0x12350b,_0xf6a7('0x5d'));})[_0xf6a7('0x2b')](function(){return getServerInfo(_0x390c3b);})[_0xf6a7('0x2b')](function(_0x5d6cc9){var _0x19e6a4=parseInt(_0x5d6cc9[_0xf6a7('0x5e')][_0xf6a7('0x5f')](0x0));var _0x5e0710=util[_0xf6a7('0x23')](_0xf6a7('0x60'),_0x29d9e5['remoteUri'],_0x12350b['id']);if(_0x19e6a4>0x6){_0x5e0710=util[_0xf6a7('0x23')](_0xf6a7('0x61'),_0x29d9e5[_0xf6a7('0x4e')],_0x12350b['id']);}logger[_0xf6a7('0xd')](_0xf6a7('0x62'),_0xf6a7('0x63'));emit(util[_0xf6a7('0x23')](_0xf6a7('0x64'),_0x4630ef['name']),'trigger:browser:url',{'uri':_0x5e0710});})[_0xf6a7('0x65')](function(_0x4b196d){logger['error'](_0xf6a7('0x62'),JSON['stringify'](_0x4b196d));});};exports[_0xf6a7('0x66')]=function(_0x1c2f1b,_0x13ab09,_0x45c12c,_0x143d1e,_0x14d224,_0x39d0a,_0x5483e0){var _0x495c0e,_0x10896f,_0x1db411,_0x1cc290;_0x39d0a['remoteUri']=intUtil[_0xf6a7('0x4f')](_0x39d0a[_0xf6a7('0x4e')]);_0x39d0a['serverUrl']=intUtil[_0xf6a7('0x4f')](_0x39d0a[_0xf6a7('0x50')]);def[_0xf6a7('0x51')]=util[_0xf6a7('0x23')](_0xf6a7('0x52'),_0x39d0a['remoteUri']);if(_0x5483e0&&_0x5483e0[_0xf6a7('0x67')]&&_0x5483e0['recordingFormat']!==_0xf6a7('0x68')){logger[_0xf6a7('0xd')](_0xf6a7('0x69'),_0xf6a7('0x6a'));_0x13ab09[_0xf6a7('0x54')]=util[_0xf6a7('0x23')](_0xf6a7('0x55'),_0x39d0a[_0xf6a7('0x50')],_0x13ab09[_0xf6a7('0x56')],md5(_0x13ab09[_0xf6a7('0x56')]));}return getConnection(_0x39d0a)[_0xf6a7('0x2b')](function(_0x15cede){_0x1cc290=_0x15cede;return getUser(_0x39d0a,_0x143d1e[_0xf6a7('0xe')],_0x1cc290);})[_0xf6a7('0x2b')](function(_0x835517){_0x495c0e=_0x835517;logger[_0xf6a7('0xd')](_0xf6a7('0x6b'),_0x495c0e['id']);return getEndUser(_0x39d0a,_0x13ab09[_0xf6a7('0x6c')],_0x13ab09['destcalleridnum'],_0x1cc290);})[_0xf6a7('0x2b')](function(_0x372095){_0x10896f=_0x372095;logger[_0xf6a7('0xd')](_0xf6a7('0x59'),_0x10896f['id']);return getTicket(_0x39d0a,_0x495c0e,_0x10896f,_0x45c12c,_0x13ab09,_0x45c12c['Fields'],_0x1cc290,'Outbound');})[_0xf6a7('0x2b')](function(_0x5a943b){_0x1db411=_0x5a943b;logger[_0xf6a7('0xd')](_0xf6a7('0x5c'));logger['info'](_0xf6a7('0x6d'),_0x1db411['id']);return setRelationship(_0x1cc290,_0x495c0e,_0x1db411,'users');})[_0xf6a7('0x2b')](function(){return setRelationship(_0x1cc290,_0x10896f,_0x1db411,_0xf6a7('0x5d'));})[_0xf6a7('0x2b')](function(){return getServerInfo(_0x1cc290);})[_0xf6a7('0x2b')](function(_0x1c97c4){var _0x3e5b6a=parseInt(_0x1c97c4[_0xf6a7('0x5e')]['charAt'](0x0));var _0x595973=util['format'](_0xf6a7('0x60'),_0x39d0a[_0xf6a7('0x4e')],_0x1db411['id']);if(_0x3e5b6a>0x6){_0x595973=util[_0xf6a7('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39d0a[_0xf6a7('0x4e')],_0x1db411['id']);}logger['info'](_0xf6a7('0x69'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6a7('0x23')]('user:%s',_0x143d1e[_0xf6a7('0xe')]),_0xf6a7('0x6e'),{'uri':_0x595973});})['catch'](function(_0x168bc5){logger['error'](_0xf6a7('0x69'),JSON[_0xf6a7('0x22')](_0x168bc5));});};exports[_0xf6a7('0x6f')]=function(_0x50c9f1,_0x4e4e8d,_0x5ad9c3,_0x47648d,_0x139b3d,_0x346a07){var _0x467d68,_0x39a917,_0x11b68d,_0x5457b6;_0x346a07[_0xf6a7('0x4e')]=intUtil[_0xf6a7('0x4f')](_0x346a07[_0xf6a7('0x4e')]);_0x346a07[_0xf6a7('0x50')]=intUtil[_0xf6a7('0x4f')](_0x346a07[_0xf6a7('0x50')]);def[_0xf6a7('0x51')]=util[_0xf6a7('0x23')](_0xf6a7('0x52'),_0x346a07[_0xf6a7('0x4e')]);if(_0x139b3d&&_0x139b3d[_0xf6a7('0x53')]){logger[_0xf6a7('0xd')]('['+_0x4e4e8d['lastevent'][_0xf6a7('0x70')]()+']',_0xf6a7('0x6a'));_0x4e4e8d[_0xf6a7('0x54')]=util[_0xf6a7('0x23')](_0xf6a7('0x55'),_0x346a07[_0xf6a7('0x50')],_0x4e4e8d[_0xf6a7('0x56')],md5(_0x4e4e8d['uniqueid']));}else{_0x4e4e8d[_0xf6a7('0x54')]='';}return getConnection(_0x346a07)['then'](function(_0x290554){_0x5457b6=_0x290554;if(!_[_0xf6a7('0x71')](_0x47648d)){return getUser(_0x346a07,_0x47648d[_0xf6a7('0xe')],_0x5457b6);}else{return getUser(_0x346a07,null,_0x5457b6);}})['then'](function(_0x3be386){_0x467d68=_0x3be386;logger['info'](_0xf6a7('0x6b'),_0x467d68['id']);return getEndUser(_0x346a07,_0x4e4e8d['calleridname'],_0x4e4e8d[_0xf6a7('0x58')],_0x5457b6);})[_0xf6a7('0x2b')](function(_0x58ad48){_0x39a917=_0x58ad48;logger[_0xf6a7('0xd')]('The\x20Enduser\x20ID\x20is:',_0x39a917['id']);return getTicket(_0x346a07,_0x467d68,_0x39a917,_0x5ad9c3,_0x4e4e8d,_0x5ad9c3[_0xf6a7('0x5a')],_0x5457b6,_0xf6a7('0x5b'));})[_0xf6a7('0x2b')](function(_0x171023){_0x11b68d=_0x171023;logger[_0xf6a7('0xd')](_0xf6a7('0x5c'));logger[_0xf6a7('0xd')](_0xf6a7('0x6d'),_0x11b68d['id']);return setRelationship(_0x5457b6,_0x467d68,_0x11b68d,_0xf6a7('0x72'));})[_0xf6a7('0x2b')](function(){return setRelationship(_0x5457b6,_0x39a917,_0x11b68d,_0xf6a7('0x5d'));})[_0xf6a7('0x2b')](function(){return getServerInfo(_0x5457b6);})[_0xf6a7('0x65')](function(_0xfdb9d4){logger[_0xf6a7('0x73')]('['+_0x4e4e8d[_0xf6a7('0x74')][_0xf6a7('0x70')]()+']',JSON[_0xf6a7('0x22')](_0xfdb9d4));});}; \ No newline at end of file +var _0xb4e3=['monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','version','[OUTBOUND]','trigger:browser:url','catch','toUpperCase','calleridname','lodash','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','duration_hours','duration_minutes','parent_id','parent_name','forEach','variableName','idField','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','customField','nameField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php'];(function(_0x26c848,_0x2e36ba){var _0x599488=function(_0x2e886a){while(--_0x2e886a){_0x26c848['push'](_0x26c848['shift']());}};_0x599488(++_0x2e36ba);}(_0xb4e3,0x18a));var _0x3b4e=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0xb4e3[_0x5471ec];return _0x121d4c;};'use strict';var _=require(_0x3b4e('0x0'));var rp=require('request-promise');var BPromise=require(_0x3b4e('0x1'));var md5=require(_0x3b4e('0x2'));var util=require(_0x3b4e('0x3'));var Redis=require('ioredis');var intUtil=require(_0x3b4e('0x4'));var config=require(_0x3b4e('0x5'));var logger=require(_0x3b4e('0x6'))(_0x3b4e('0x7'));config['redis']=_[_0x3b4e('0x8')](config[_0x3b4e('0x9')],{'host':_0x3b4e('0xa'),'port':0x18eb});var io=require(_0x3b4e('0xb'))(new Redis(config[_0x3b4e('0x9')]));var def={'method':_0x3b4e('0xc'),'json':!![]};function emit(_0x35c665,_0x2fa21f,_0x250a19){io['to'](_0x35c665)[_0x3b4e('0xd')](_0x2fa21f,_0x250a19);}function getTicket(_0x3e568c,_0x3ff3a8,_0x55f94b,_0x17c6ea,_0x4dd0ab,_0x3e5359,_0x592bbc,_0x180839){logger[_0x3b4e('0xe')]('Creating\x20new\x20ticket...');var _0x2e4dc6=new Date();var _0x36d9b8=[{'name':_0x3b4e('0xf'),'value':intUtil[_0x3b4e('0x10')](_0x17c6ea[_0x3b4e('0x11')],_0x4dd0ab,'\x20')},{'name':_0x3b4e('0x12'),'value':_0x3ff3a8['id']},{'name':'created_by','value':_0x3ff3a8['id']},{'name':_0x3b4e('0x13'),'value':intUtil['getString'](_0x17c6ea[_0x3b4e('0x14')],_0x4dd0ab,'\x0a')},{'name':'date_start','value':_0x2e4dc6[_0x3b4e('0x15')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x3b4e('0x16'),'value':'0'},{'name':_0x3b4e('0x17'),'value':'15'},{'name':_0x3b4e('0x18'),'value':_0x55f94b['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x3b4e('0x19'),'value':_0x55f94b[_0x3b4e('0xf')]},{'name':'direction','value':_0x180839}];if(_0x3e5359['length']){_[_0x3b4e('0x1a')](_0x3e5359,function(_0x2dd7b8){if(_0x4dd0ab[_0x2dd7b8[_0x3b4e('0x1b')]]){_0x36d9b8['push']({'name':_0x2dd7b8[_0x3b4e('0x1c')],'value':_0x4dd0ab[_0x2dd7b8[_0x3b4e('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x3b4e('0x1d'),'response_type':_0x3b4e('0x1d'),'rest_data':JSON[_0x3b4e('0x1e')]({'session':_0x592bbc['id'],'module_name':'Calls','name_value_list':_0x36d9b8})}});}function getAuth(_0x1c41ae){return util[_0x3b4e('0x1f')](_0x3b4e('0x20'),new Buffer(_0x1c41ae[_0x3b4e('0x21')]+':X')[_0x3b4e('0x22')](_0x3b4e('0x23')));}function getServerInfo(_0x2a3e42){return request({'form':{'method':_0x3b4e('0x24'),'input_type':_0x3b4e('0x1d'),'response_type':_0x3b4e('0x1d'),'rest_data':JSON[_0x3b4e('0x1e')]({'session':_0x2a3e42['id']})}});}function getUser(_0x5bcf5e,_0x3bf8d1,_0x20bd79){if(!_[_0x3b4e('0x25')](_0x3bf8d1)){logger[_0x3b4e('0xe')](_0x3b4e('0x26'),_0x3bf8d1);return request({'form':{'method':_0x3b4e('0x27'),'input_type':_0x3b4e('0x1d'),'response_type':'JSON','rest_data':JSON[_0x3b4e('0x1e')]({'session':_0x20bd79['id'],'module_name':_0x3b4e('0x28'),'query':util[_0x3b4e('0x1f')](_0x3b4e('0x29'),_0x3bf8d1),'order_by':'','offset':'0','select_fields':['id','name',_0x3b4e('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3b4e('0x2b')](function(_0x3ccc9a){if(_0x3ccc9a[_0x3b4e('0x2c')][_0x3b4e('0x2d')]){var _0x243bcd=_[_0x3b4e('0x2e')](_0x3ccc9a['entry_list'],function(_0x4bd35d){return _0x4bd35d[_0x3b4e('0x2f')][_0x3b4e('0x2a')][_0x3b4e('0x30')]===_0x3bf8d1;});if(_0x243bcd){logger[_0x3b4e('0xe')]('Agent\x20found!');return BPromise[_0x3b4e('0x31')]({'id':_0x243bcd[_0x3b4e('0x2f')]['id'][_0x3b4e('0x30')],'name':_0x243bcd[_0x3b4e('0x2f')][_0x3b4e('0xf')][_0x3b4e('0x30')]});}}logger[_0x3b4e('0xe')](_0x3b4e('0x32'));return BPromise['resolve']({'id':_0x20bd79['name_value_list']['user_id']['value'],'name':_0x20bd79[_0x3b4e('0x2f')][_0x3b4e('0x2a')][_0x3b4e('0x30')]});});}else{logger['info'](_0x3b4e('0x33'));return BPromise[_0x3b4e('0x31')]({'id':_0x20bd79[_0x3b4e('0x2f')]['user_id'][_0x3b4e('0x30')],'name':_0x20bd79[_0x3b4e('0x2f')]['user_name'][_0x3b4e('0x30')]});}}function getEndUser(_0x52ada7,_0x10b7a3,_0x377055,_0x130e78){logger[_0x3b4e('0xe')](_0x3b4e('0x34'),_0x377055);return request({'form':{'method':_0x3b4e('0x27'),'input_type':_0x3b4e('0x1d'),'response_type':_0x3b4e('0x1d'),'rest_data':JSON['stringify']({'session':_0x130e78['id'],'module_name':_0x3b4e('0x35'),'query':util['format'](_0x3b4e('0x36'),_0x377055),'order_by':'','offset':'0','select_fields':['id',_0x3b4e('0xf'),_0x3b4e('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3b4e('0x2b')](function(_0x323a67){if(_0x323a67[_0x3b4e('0x2c')][_0x3b4e('0x2d')]){var _0x5bc516=_[_0x3b4e('0x2e')](_0x323a67['entry_list'],function(_0x5c5e52){return _0x5c5e52[_0x3b4e('0x2f')][_0x3b4e('0x37')]['value']===_0x377055;});if(_0x5bc516){logger[_0x3b4e('0xe')]('Enduser\x20found!');return BPromise[_0x3b4e('0x31')]({'id':_0x5bc516[_0x3b4e('0x2f')]['id']['value'],'name':_0x5bc516[_0x3b4e('0x2f')][_0x3b4e('0xf')][_0x3b4e('0x30')],'phone':_0x5bc516[_0x3b4e('0x2f')]['phone_home'][_0x3b4e('0x30')]});}}else{logger[_0x3b4e('0xe')](_0x3b4e('0x38'));return request({'form':{'method':_0x3b4e('0x39'),'input_type':_0x3b4e('0x1d'),'response_type':_0x3b4e('0x1d'),'rest_data':JSON[_0x3b4e('0x1e')]({'session':_0x130e78['id'],'module_name':_0x3b4e('0x35'),'name_value_list':[{'name':_0x3b4e('0x3a'),'value':_0x10b7a3!==_0x3b4e('0x3b')?_0x10b7a3:util[_0x3b4e('0x1f')](_0x3b4e('0x3c'),_0x377055)},{'name':_0x3b4e('0x37'),'value':_0x377055}]})}})['then'](function(_0x31f82d){logger[_0x3b4e('0xe')](_0x3b4e('0x3d'));return BPromise[_0x3b4e('0x31')]({'id':_0x31f82d['id'],'name':_0x31f82d['entry_list'][_0x3b4e('0x3a')][_0x3b4e('0x30')],'phone':_0x31f82d[_0x3b4e('0x2c')]['phone_home'][_0x3b4e('0x30')]});});}});}function request(_0x797d5b){logger[_0x3b4e('0x3e')](_0x3b4e('0x3f'),JSON[_0x3b4e('0x1e')](_0x797d5b));return rp(_['merge'](def,_0x797d5b));}function getTags(_0x5aebac,_0x32ea39){var _0x440789=[];if(_0x5aebac&&_0x5aebac[_0x3b4e('0x2d')]>0x0){_0x440789=_[_0x3b4e('0x40')](_0x5aebac,_0x32ea39);}return _0x440789;}function getCustomFields(_0x14e06b,_0x50b188){var _0x3f8843=[];var _0x9f6bf9={'custom_fields':[]};if(_0x14e06b[_0x3b4e('0x2d')]>0x0){_[_0x3b4e('0x1a')](_0x14e06b,function(_0x586701){if(_0x586701[_0x3b4e('0x41')]===_0x3b4e('0x42')&&_0x586701['nameField']&&!_0x586701[_0x3b4e('0x43')]){_0x9f6bf9[_0x586701[_0x3b4e('0x44')][_0x3b4e('0x45')]()]=_0x586701[_0x3b4e('0x46')][_0x3b4e('0x22')]();}else if(_0x586701[_0x3b4e('0x41')]===_0x3b4e('0x42')&&_0x586701[_0x3b4e('0x1c')]&&_0x586701[_0x3b4e('0x43')]){_0x9f6bf9[_0x3b4e('0x47')][_0x3b4e('0x48')]({'id':_0x586701[_0x3b4e('0x1c')],'value':_0x586701[_0x3b4e('0x46')][_0x3b4e('0x22')]()});}else if(_0x586701[_0x3b4e('0x41')]===_0x3b4e('0x49')&&_0x586701['variableName']&&_0x586701[_0x3b4e('0x1c')]&&_0x586701['customField']){_0x50b188[_0x586701['variableName']]&&_0x9f6bf9[_0x3b4e('0x47')][_0x3b4e('0x48')]({'id':_0x586701[_0x3b4e('0x1c')],'value':_0x50b188[_0x586701[_0x3b4e('0x1b')]][_0x3b4e('0x22')]()});}else if(_0x586701[_0x3b4e('0x41')]===_0x3b4e('0x4a')&&_0x586701[_0x3b4e('0x4b')]&&_0x586701['Variable'][_0x3b4e('0xf')]&&_0x586701['idField']&&_0x586701[_0x3b4e('0x43')]){_0x50b188[_0x586701[_0x3b4e('0x4b')][_0x3b4e('0xf')][_0x3b4e('0x45')]()]&&_0x9f6bf9[_0x3b4e('0x47')][_0x3b4e('0x48')]({'id':_0x586701[_0x3b4e('0x1c')],'value':_0x50b188[_0x586701[_0x3b4e('0x4b')][_0x3b4e('0xf')][_0x3b4e('0x45')]()]['toString']()});}});}return _0x9f6bf9;}function getConnection(_0x21a058){return request({'method':_0x3b4e('0xc'),'form':{'method':_0x3b4e('0x4c'),'input_type':'JSON','response_type':_0x3b4e('0x1d'),'rest_data':JSON[_0x3b4e('0x1e')]({'user_auth':{'user_name':_0x21a058[_0x3b4e('0x4d')],'password':_0x21a058[_0x3b4e('0x4e')],'encryption':_0x3b4e('0x4f')},'application':_0x3b4e('0x50')})}})[_0x3b4e('0x2b')](function(_0x2cb504){var _0x4ccbf7=_0x2cb504;if(_0x4ccbf7['id']){def[_0x3b4e('0x51')]=_0x4ccbf7['id'];return BPromise[_0x3b4e('0x31')](_0x4ccbf7);}else{throw new Error(util[_0x3b4e('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x21a058['id']));}});}function setRelationship(_0x2b4a17,_0x365183,_0x2d0e13,_0xb0c010){return request({'form':{'method':_0x3b4e('0x52'),'input_type':_0x3b4e('0x1d'),'response_type':'JSON','rest_data':JSON[_0x3b4e('0x1e')]({'session':_0x2b4a17['id'],'module_name':_0x3b4e('0x53'),'module_id':_0x2d0e13['id'],'link_field_name':_0xb0c010,'related_ids':[_0x365183['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3b4e('0x54')]=function(_0x32db4e,_0x292297,_0x5a6d70,_0x6d1760,_0x1b3715,_0x5775b5){var _0xdd90c1,_0x2b81c5,_0x47ac02,_0x184e5b;_0x5775b5['remoteUri']=intUtil['stripTrailingSlash'](_0x5775b5[_0x3b4e('0x55')]);_0x5775b5[_0x3b4e('0x56')]=intUtil[_0x3b4e('0x57')](_0x5775b5[_0x3b4e('0x56')]);def[_0x3b4e('0x58')]=util[_0x3b4e('0x1f')](_0x3b4e('0x59'),_0x5775b5[_0x3b4e('0x55')]);if(_0x1b3715&&_0x1b3715[_0x3b4e('0x5a')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x292297[_0x3b4e('0x5b')]=util[_0x3b4e('0x1f')](_0x3b4e('0x5c'),_0x5775b5[_0x3b4e('0x56')],_0x292297['uniqueid'],md5(_0x292297[_0x3b4e('0x5d')]));}else{_0x292297[_0x3b4e('0x5b')]='';}return getConnection(_0x5775b5)[_0x3b4e('0x2b')](function(_0x3fe1d9){_0x184e5b=_0x3fe1d9;return getUser(_0x5775b5,_0x6d1760[_0x3b4e('0xf')],_0x184e5b);})['then'](function(_0x45d325){_0xdd90c1=_0x45d325;logger[_0x3b4e('0xe')](_0x3b4e('0x5e'),_0xdd90c1['id']);return getEndUser(_0x5775b5,_0x292297['calleridname'],_0x292297[_0x3b4e('0x5f')],_0x184e5b);})[_0x3b4e('0x2b')](function(_0x49bc9b){_0x2b81c5=_0x49bc9b;logger[_0x3b4e('0xe')](_0x3b4e('0x60'),_0x2b81c5['id']);return getTicket(_0x5775b5,_0xdd90c1,_0x2b81c5,_0x5a6d70,_0x292297,_0x5a6d70[_0x3b4e('0x61')],_0x184e5b,_0x3b4e('0x62'));})[_0x3b4e('0x2b')](function(_0x2d3f11){_0x47ac02=_0x2d3f11;logger[_0x3b4e('0xe')](_0x3b4e('0x63'));logger[_0x3b4e('0xe')]('The\x20Ticket\x20ID\x20is:',_0x47ac02['id']);return setRelationship(_0x184e5b,_0xdd90c1,_0x47ac02,_0x3b4e('0x64'));})[_0x3b4e('0x2b')](function(){return setRelationship(_0x184e5b,_0x2b81c5,_0x47ac02,_0x3b4e('0x65'));})[_0x3b4e('0x2b')](function(){return getServerInfo(_0x184e5b);})[_0x3b4e('0x2b')](function(_0x18fddf){var _0x39a837=parseInt(_0x18fddf['version'][_0x3b4e('0x66')](0x0));var _0x539618=util[_0x3b4e('0x1f')](_0x3b4e('0x67'),_0x5775b5[_0x3b4e('0x55')],_0x47ac02['id']);if(_0x39a837>0x6){_0x539618=util[_0x3b4e('0x1f')](_0x3b4e('0x68'),_0x5775b5[_0x3b4e('0x55')],_0x47ac02['id']);}logger[_0x3b4e('0xe')](_0x3b4e('0x69'),_0x3b4e('0x6a'));emit(util['format']('user:%s',_0x6d1760[_0x3b4e('0xf')]),'trigger:browser:url',{'uri':_0x539618});})['catch'](function(_0x156d36){logger[_0x3b4e('0x6b')](_0x3b4e('0x69'),JSON['stringify'](_0x156d36));});};exports[_0x3b4e('0x6c')]=function(_0x4e3776,_0x444d25,_0x147f48,_0x172d71,_0x245db2,_0x3b67a3,_0x52e829){var _0x29f040,_0x3b146f,_0x3c03a1,_0x160dcb;_0x3b67a3[_0x3b4e('0x55')]=intUtil[_0x3b4e('0x57')](_0x3b67a3[_0x3b4e('0x55')]);_0x3b67a3[_0x3b4e('0x56')]=intUtil[_0x3b4e('0x57')](_0x3b67a3['serverUrl']);def[_0x3b4e('0x58')]=util['format'](_0x3b4e('0x59'),_0x3b67a3['remoteUri']);if(_0x52e829&&_0x52e829[_0x3b4e('0x6d')]&&_0x52e829[_0x3b4e('0x6d')]!==_0x3b4e('0x6e')){logger['info']('[OUTBOUND]',_0x3b4e('0x6f'));_0x444d25[_0x3b4e('0x5b')]=util[_0x3b4e('0x1f')](_0x3b4e('0x5c'),_0x3b67a3[_0x3b4e('0x56')],_0x444d25[_0x3b4e('0x5d')],md5(_0x444d25[_0x3b4e('0x5d')]));}return getConnection(_0x3b67a3)['then'](function(_0x589ea9){_0x160dcb=_0x589ea9;return getUser(_0x3b67a3,_0x172d71[_0x3b4e('0xf')],_0x160dcb);})[_0x3b4e('0x2b')](function(_0xcb676b){_0x29f040=_0xcb676b;logger[_0x3b4e('0xe')]('The\x20User\x20ID\x20is:',_0x29f040['id']);return getEndUser(_0x3b67a3,_0x444d25[_0x3b4e('0x70')],_0x444d25[_0x3b4e('0x71')],_0x160dcb);})[_0x3b4e('0x2b')](function(_0x4f1af2){_0x3b146f=_0x4f1af2;logger[_0x3b4e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b146f['id']);return getTicket(_0x3b67a3,_0x29f040,_0x3b146f,_0x147f48,_0x444d25,_0x147f48[_0x3b4e('0x61')],_0x160dcb,'Outbound');})[_0x3b4e('0x2b')](function(_0x4c0052){_0x3c03a1=_0x4c0052;logger[_0x3b4e('0xe')](_0x3b4e('0x63'));logger[_0x3b4e('0xe')](_0x3b4e('0x72'),_0x3c03a1['id']);return setRelationship(_0x160dcb,_0x29f040,_0x3c03a1,'users');})[_0x3b4e('0x2b')](function(){return setRelationship(_0x160dcb,_0x3b146f,_0x3c03a1,'contacts');})['then'](function(){return getServerInfo(_0x160dcb);})[_0x3b4e('0x2b')](function(_0x429d17){var _0x501a22=parseInt(_0x429d17[_0x3b4e('0x73')][_0x3b4e('0x66')](0x0));var _0x406863=util[_0x3b4e('0x1f')](_0x3b4e('0x67'),_0x3b67a3[_0x3b4e('0x55')],_0x3c03a1['id']);if(_0x501a22>0x6){_0x406863=util[_0x3b4e('0x1f')](_0x3b4e('0x68'),_0x3b67a3[_0x3b4e('0x55')],_0x3c03a1['id']);}logger[_0x3b4e('0xe')](_0x3b4e('0x74'),_0x3b4e('0x6a'));emit(util[_0x3b4e('0x1f')]('user:%s',_0x172d71[_0x3b4e('0xf')]),_0x3b4e('0x75'),{'uri':_0x406863});})[_0x3b4e('0x76')](function(_0x26ba18){logger[_0x3b4e('0x6b')](_0x3b4e('0x74'),JSON[_0x3b4e('0x1e')](_0x26ba18));});};exports['unmanaged']=function(_0x519d06,_0x5d48fe,_0x331ca7,_0x2c0355,_0x5730c5,_0x49b8a2){var _0x2052bc,_0xe395b5,_0x436da1,_0x3c77b7;_0x49b8a2[_0x3b4e('0x55')]=intUtil[_0x3b4e('0x57')](_0x49b8a2[_0x3b4e('0x55')]);_0x49b8a2[_0x3b4e('0x56')]=intUtil[_0x3b4e('0x57')](_0x49b8a2[_0x3b4e('0x56')]);def[_0x3b4e('0x58')]=util[_0x3b4e('0x1f')](_0x3b4e('0x59'),_0x49b8a2['remoteUri']);if(_0x5730c5&&_0x5730c5[_0x3b4e('0x5a')]){logger[_0x3b4e('0xe')]('['+_0x5d48fe['lastevent'][_0x3b4e('0x77')]()+']',_0x3b4e('0x6f'));_0x5d48fe[_0x3b4e('0x5b')]=util[_0x3b4e('0x1f')](_0x3b4e('0x5c'),_0x49b8a2[_0x3b4e('0x56')],_0x5d48fe[_0x3b4e('0x5d')],md5(_0x5d48fe[_0x3b4e('0x5d')]));}else{_0x5d48fe[_0x3b4e('0x5b')]='';}return getConnection(_0x49b8a2)[_0x3b4e('0x2b')](function(_0x2ab74c){_0x3c77b7=_0x2ab74c;if(!_[_0x3b4e('0x25')](_0x2c0355)){return getUser(_0x49b8a2,_0x2c0355['name'],_0x3c77b7);}else{return getUser(_0x49b8a2,null,_0x3c77b7);}})[_0x3b4e('0x2b')](function(_0x32c548){_0x2052bc=_0x32c548;logger['info'](_0x3b4e('0x5e'),_0x2052bc['id']);return getEndUser(_0x49b8a2,_0x5d48fe[_0x3b4e('0x78')],_0x5d48fe[_0x3b4e('0x5f')],_0x3c77b7);})[_0x3b4e('0x2b')](function(_0x59439a){_0xe395b5=_0x59439a;logger['info']('The\x20Enduser\x20ID\x20is:',_0xe395b5['id']);return getTicket(_0x49b8a2,_0x2052bc,_0xe395b5,_0x331ca7,_0x5d48fe,_0x331ca7[_0x3b4e('0x61')],_0x3c77b7,_0x3b4e('0x62'));})[_0x3b4e('0x2b')](function(_0x1626fd){_0x436da1=_0x1626fd;logger[_0x3b4e('0xe')](_0x3b4e('0x63'));logger[_0x3b4e('0xe')]('The\x20Ticket\x20ID\x20is:',_0x436da1['id']);return setRelationship(_0x3c77b7,_0x2052bc,_0x436da1,'users');})[_0x3b4e('0x2b')](function(){return setRelationship(_0x3c77b7,_0xe395b5,_0x436da1,_0x3b4e('0x65'));})[_0x3b4e('0x2b')](function(){return getServerInfo(_0x3c77b7);})[_0x3b4e('0x76')](function(_0x2f21a9){logger[_0x3b4e('0x6b')]('['+_0x5d48fe['lastevent'][_0x3b4e('0x77')]()+']',JSON[_0x3b4e('0x1e')](_0x2f21a9));});}; \ 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 60733da..c1c37bb 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 _0xea1c=['string','push','variable','variableName','toString','customVariable','Variable','toLowerCase','name','keyValue','keyType','%s:\x20%s','keyContent','key','format','stripTrailingSlash','slice','lastIndexOf','isNil','test','lodash','util','length','type'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xea1c,0x194));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcea1('0x0'));var util=require(_0xcea1('0x1'));exports['getString']=function(_0x53bc37,_0x539549,_0x3fea35){var _0x7a96dc=[];if(_0x53bc37[_0xcea1('0x2')]>0x0){var _0x232026=_['sortBy'](_0x53bc37,['id']);for(var _0x2c2898=0x0;_0x2c2898<_0x232026['length'];_0x2c2898++){var _0x3292d6=_0x232026[_0x2c2898];if(_0x3292d6[_0xcea1('0x3')]===_0xcea1('0x4')){_0x7a96dc[_0xcea1('0x5')](_0x3292d6['content']);}else if(_0x3292d6[_0xcea1('0x3')]===_0xcea1('0x6')&&_0x3292d6[_0xcea1('0x7')]){_0x539549[_0x3292d6[_0xcea1('0x7')]]&&_0x7a96dc[_0xcea1('0x5')](_0x539549[_0x3292d6[_0xcea1('0x7')]][_0xcea1('0x8')]());}else if(_0x3292d6[_0xcea1('0x3')]===_0xcea1('0x9')&&_0x3292d6['Variable']&&_0x3292d6[_0xcea1('0xa')]['name']){_0x539549[_0x3292d6[_0xcea1('0xa')]['name'][_0xcea1('0xb')]()]&&_0x7a96dc[_0xcea1('0x5')](_0x539549[_0x3292d6[_0xcea1('0xa')][_0xcea1('0xc')][_0xcea1('0xb')]()][_0xcea1('0x8')]());}else if(_0x3292d6['type']===_0xcea1('0xd')){if(_0x3292d6[_0xcea1('0xe')]===_0xcea1('0x4')&&_0x3292d6['key']){_0x7a96dc[_0xcea1('0x5')](util['format'](_0xcea1('0xf'),_0x3292d6['key'],_0x3292d6[_0xcea1('0x10')]));}else if(_0x3292d6[_0xcea1('0xe')]==='variable'&&_0x3292d6['variableName']&&_0x3292d6[_0xcea1('0x11')]){_0x539549[_0x3292d6['variableName']]&&_0x7a96dc['push'](util[_0xcea1('0x12')](_0xcea1('0xf'),_0x3292d6['key'],_0x539549[_0x3292d6[_0xcea1('0x7')]]));}else if(_0x3292d6[_0xcea1('0xe')]===_0xcea1('0x9')&&_0x3292d6[_0xcea1('0xa')]&&_0x3292d6[_0xcea1('0xa')]['name']&&_0x3292d6[_0xcea1('0x11')]){_0x539549[_0x3292d6['Variable'][_0xcea1('0xc')]['toLowerCase']()]&&_0x7a96dc[_0xcea1('0x5')](util[_0xcea1('0x12')](_0xcea1('0xf'),_0x3292d6[_0xcea1('0x11')],_0x539549[_0x3292d6[_0xcea1('0xa')]['name'][_0xcea1('0xb')]()]));}}}}return _0x7a96dc['join'](_0x3fea35);};exports[_0xcea1('0x13')]=function(_0x503fbd){var _0x2db1e9=_0x503fbd[_0xcea1('0x14')](-0x1);if(_0x2db1e9==='/'){_0x503fbd=_0x503fbd['substring'](0x0,_0x503fbd[_0xcea1('0x15')](_0x2db1e9));}return _0x503fbd;};exports['validateEmail']=function(_0x59d644){if(!_[_0xcea1('0x16')](_0x59d644)&&_0x59d644!==''){var _0x433116=/^(([^<>()\[\]\\.,;:\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 _0x433116[_0xcea1('0x17')](String(_0x59d644)[_0xcea1('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xa4c9=['key','keyContent','keyType','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','string','push','content','variable','variableName','toString','type','customVariable','Variable','name','toLowerCase','keyValue','format','%s:\x20%s'];(function(_0x50259c,_0x2eaa8c){var _0x5d73ec=function(_0x275904){while(--_0x275904){_0x50259c['push'](_0x50259c['shift']());}};_0x5d73ec(++_0x2eaa8c);}(_0xa4c9,0x19e));var _0x9a4c=function(_0x241fc2,_0xe233db){_0x241fc2=_0x241fc2-0x0;var _0x3b15d9=_0xa4c9[_0x241fc2];return _0x3b15d9;};'use strict';var _=require('lodash');var util=require(_0x9a4c('0x0'));exports[_0x9a4c('0x1')]=function(_0x3f61bf,_0x2f8c86,_0x3c7b9a){var _0x1eeded=[];if(_0x3f61bf[_0x9a4c('0x2')]>0x0){var _0x3615ff=_[_0x9a4c('0x3')](_0x3f61bf,['id']);for(var _0x36ef05=0x0;_0x36ef05<_0x3615ff[_0x9a4c('0x2')];_0x36ef05++){var _0x96ff9d=_0x3615ff[_0x36ef05];if(_0x96ff9d['type']===_0x9a4c('0x4')){_0x1eeded[_0x9a4c('0x5')](_0x96ff9d[_0x9a4c('0x6')]);}else if(_0x96ff9d['type']===_0x9a4c('0x7')&&_0x96ff9d[_0x9a4c('0x8')]){_0x2f8c86[_0x96ff9d[_0x9a4c('0x8')]]&&_0x1eeded[_0x9a4c('0x5')](_0x2f8c86[_0x96ff9d['variableName']][_0x9a4c('0x9')]());}else if(_0x96ff9d[_0x9a4c('0xa')]===_0x9a4c('0xb')&&_0x96ff9d[_0x9a4c('0xc')]&&_0x96ff9d[_0x9a4c('0xc')][_0x9a4c('0xd')]){_0x2f8c86[_0x96ff9d[_0x9a4c('0xc')]['name']['toLowerCase']()]&&_0x1eeded['push'](_0x2f8c86[_0x96ff9d['Variable'][_0x9a4c('0xd')][_0x9a4c('0xe')]()][_0x9a4c('0x9')]());}else if(_0x96ff9d[_0x9a4c('0xa')]===_0x9a4c('0xf')){if(_0x96ff9d['keyType']==='string'&&_0x96ff9d['key']){_0x1eeded[_0x9a4c('0x5')](util[_0x9a4c('0x10')](_0x9a4c('0x11'),_0x96ff9d[_0x9a4c('0x12')],_0x96ff9d[_0x9a4c('0x13')]));}else if(_0x96ff9d[_0x9a4c('0x14')]===_0x9a4c('0x7')&&_0x96ff9d['variableName']&&_0x96ff9d[_0x9a4c('0x12')]){_0x2f8c86[_0x96ff9d['variableName']]&&_0x1eeded[_0x9a4c('0x5')](util[_0x9a4c('0x10')](_0x9a4c('0x11'),_0x96ff9d[_0x9a4c('0x12')],_0x2f8c86[_0x96ff9d[_0x9a4c('0x8')]]));}else if(_0x96ff9d['keyType']===_0x9a4c('0xb')&&_0x96ff9d[_0x9a4c('0xc')]&&_0x96ff9d[_0x9a4c('0xc')]['name']&&_0x96ff9d[_0x9a4c('0x12')]){_0x2f8c86[_0x96ff9d[_0x9a4c('0xc')]['name'][_0x9a4c('0xe')]()]&&_0x1eeded['push'](util[_0x9a4c('0x10')](_0x9a4c('0x11'),_0x96ff9d[_0x9a4c('0x12')],_0x2f8c86[_0x96ff9d[_0x9a4c('0xc')][_0x9a4c('0xd')][_0x9a4c('0xe')]()]));}}}}return _0x1eeded['join'](_0x3c7b9a);};exports[_0x9a4c('0x15')]=function(_0x3a0475){var _0x1d8cf1=_0x3a0475['slice'](-0x1);if(_0x1d8cf1==='/'){_0x3a0475=_0x3a0475[_0x9a4c('0x16')](0x0,_0x3a0475[_0x9a4c('0x17')](_0x1d8cf1));}return _0x3a0475;};exports[_0x9a4c('0x18')]=function(_0x5c5f9d){if(!_[_0x9a4c('0x19')](_0x5c5f9d)&&_0x5c5f9d!==''){var _0x29c120=/^(([^<>()\[\]\\.,;:\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 _0x29c120[_0x9a4c('0x1a')](String(_0x5c5f9d)[_0x9a4c('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 048691f..1844317 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','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','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +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(_0x17fea8,_0x523bde){var _0x385a83=function(_0x3a1101){while(--_0x3a1101){_0x17fea8['push'](_0x17fea8['shift']());}};_0x385a83(++_0x523bde);}(_0x34e8,0x12c));var _0x834e=function(_0x3a519a,_0x1a5968){_0x3a519a=_0x3a519a-0x0;var _0x9994bd=_0x34e8[_0x3a519a];return _0x9994bd;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 0946f36..d56214b 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 _0xc522=['filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','debug','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','variable','idField','variableName','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:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','unmanaged','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','format','type:user\x20role:end-user\x20phone:%s','length'];(function(_0x3b9909,_0x39cbd5){var _0x4419cd=function(_0x4458bf){while(--_0x4458bf){_0x3b9909['push'](_0x3b9909['shift']());}};_0x4419cd(++_0x39cbd5);}(_0xc522,0x12a));var _0x2c52=function(_0x3b7a85,_0x3d87ca){_0x3b7a85=_0x3b7a85-0x0;var _0xaf8140=_0xc522[_0x3b7a85];return _0xaf8140;};'use strict';var _=require(_0x2c52('0x0'));var rp=require(_0x2c52('0x1'));var md5=require(_0x2c52('0x2'));var util=require(_0x2c52('0x3'));var Redis=require('ioredis');var intUtil=require(_0x2c52('0x4'));var config=require(_0x2c52('0x5'));var logger=require(_0x2c52('0x6'))('zendesk');config[_0x2c52('0x7')]=_[_0x2c52('0x8')](config['redis'],{'host':_0x2c52('0x9'),'port':0x18eb});var io=require(_0x2c52('0xa'))(new Redis(config['redis']));function emit(_0x3a4d7e,_0x4e675e,_0x27f484){io['to'](_0x3a4d7e)['emit'](_0x4e675e,_0x27f484);}var headers={'Content-Type':_0x2c52('0xb'),'Accept':_0x2c52('0xb')};function getTicket(_0x5e8404,_0xff4af9,_0x325c7e,_0x2c0fcd,_0x13411d){logger[_0x2c52('0xc')](_0x2c52('0xd'));return request({'uri':util['format'](_0x2c52('0xe'),_0x5e8404[_0x2c52('0xf')]),'method':_0x2c52('0x10'),'body':{'ticket':_[_0x2c52('0x11')]({'requester_id':_0x325c7e['id'],'submitter_id':_0xff4af9?_0xff4af9['id']:undefined,'assignee_id':_0xff4af9?_0xff4af9['id']:undefined,'tags':getTags(_0x2c0fcd[_0x2c52('0x12')],_0x2c52('0x13')),'subject':intUtil[_0x2c52('0x14')](_0x2c0fcd['Subjects'],_0x13411d,'\x20'),'description':intUtil['getString'](_0x2c0fcd[_0x2c52('0x15')],_0x13411d,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2c52('0x14')](_0x2c0fcd[_0x2c52('0x15')],_0x13411d,'\x0a')}},getCustomFields(_0x2c0fcd['Fields'],_0x13411d))}})[_0x2c52('0x16')](function(_0x1b75dd){logger[_0x2c52('0xc')](_0x2c52('0x17'));return _0x1b75dd[_0x2c52('0x18')];});}function getUser(_0x498e4e,_0x3c4379){if(intUtil[_0x2c52('0x19')](_0x3c4379)){logger[_0x2c52('0xc')](_0x2c52('0x1a'),_0x3c4379);return request({'uri':util['format'](_0x2c52('0x1b'),_0x498e4e['remoteUri']),'qs':{'query':util['format'](_0x2c52('0x1c'),_0x3c4379)}})[_0x2c52('0x16')](function(_0x5f3db9){if(_0x5f3db9[_0x2c52('0x1d')]){logger[_0x2c52('0xc')](_0x2c52('0x1e'));return _[_0x2c52('0x1f')](_0x5f3db9[_0x2c52('0x20')],{'email':_0x3c4379,'role':_0x2c52('0x21')});}else{logger[_0x2c52('0xc')](_0x2c52('0x22'));return request({'uri':util['format'](_0x2c52('0x23'),_0x498e4e[_0x2c52('0xf')])})['then'](function(_0x2a353f){logger['info'](_0x2c52('0x24'));return _0x2a353f[_0x2c52('0x25')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x498e4e[_0x2c52('0xf')])})[_0x2c52('0x16')](function(_0x5c44e9){logger['info'](_0x2c52('0x24'));return _0x5c44e9[_0x2c52('0x25')];});}}function getEndUser(_0x586471,_0x39c312,_0x577630){logger[_0x2c52('0xc')]('Searching\x20enduser\x20with\x20phone',_0x577630);return request({'uri':util[_0x2c52('0x26')](_0x2c52('0x1b'),_0x586471[_0x2c52('0xf')]),'qs':{'query':util[_0x2c52('0x26')](_0x2c52('0x27'),_0x577630)}})[_0x2c52('0x16')](function(_0x500f08){var _0x235977;if(_0x500f08['results'][_0x2c52('0x28')]){_0x500f08[_0x2c52('0x20')]=_[_0x2c52('0x29')](_0x500f08['results'],{'suspended':![],'role':_0x2c52('0x2a')});if(_0x500f08[_0x2c52('0x20')][_0x2c52('0x28')]){_0x235977=_[_0x2c52('0x2b')](_0x500f08['results']);}}if(_0x235977){logger['info']('Enduser\x20found!');return _0x235977;}else{logger['info'](_0x2c52('0x2c'));return request({'uri':util['format'](_0x2c52('0x2d'),_0x586471[_0x2c52('0xf')]),'method':_0x2c52('0x10'),'body':{'user':{'role':_0x2c52('0x2a'),'name':util['format'](_0x2c52('0x2e'),_0x39c312||_0x577630),'phone':_0x577630}}})[_0x2c52('0x16')](function(_0x379c3d){logger[_0x2c52('0xc')](_0x2c52('0x2f'));return _0x379c3d[_0x2c52('0x25')];});}});}function getAuth(_0x173246){var _0x208e1d;if(_0x173246[_0x2c52('0x30')]===_0x2c52('0x31')){_0x208e1d=util[_0x2c52('0x26')](_0x2c52('0x32'),_0x173246['username'],_0x173246[_0x2c52('0x31')]);}else if(_0x173246[_0x2c52('0x30')]===_0x2c52('0x33')){_0x208e1d=util[_0x2c52('0x26')](_0x2c52('0x34'),_0x173246[_0x2c52('0x35')],_0x173246[_0x2c52('0x33')]);}return util[_0x2c52('0x26')](_0x2c52('0x36'),new Buffer(_0x208e1d)[_0x2c52('0x37')]('base64'));}function request(_0x5d4c6d){logger[_0x2c52('0x38')]('[HTTP]',JSON['stringify'](_0x5d4c6d));return rp(_['defaults'](_0x5d4c6d,{'method':_0x2c52('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x2c2aa5,_0x340e98){var _0x42b6e7=[];if(_0x2c2aa5&&_0x2c2aa5[_0x2c52('0x28')]>0x0){_0x42b6e7=_[_0x2c52('0x3a')](_0x2c2aa5,_0x340e98);}return _0x42b6e7;}function getCustomFields(_0x5825eb,_0x22cd9f){var _0xdda480=[];var _0x820ab5={'custom_fields':[]};if(_0x5825eb[_0x2c52('0x28')]>0x0){_['forEach'](_0x5825eb,function(_0x3377c2){if(_[_0x2c52('0x3b')]([_0x2c52('0x3c'),_0x2c52('0x3d')],_0x3377c2[_0x2c52('0x3e')])&&_0x3377c2[_0x2c52('0x3f')]&&!_0x3377c2[_0x2c52('0x40')]){_0x820ab5[_0x3377c2[_0x2c52('0x3f')][_0x2c52('0x41')]()]=_0x3377c2[_0x2c52('0x42')][_0x2c52('0x37')]();}else if(_['includes'](['string','picklist'],_0x3377c2[_0x2c52('0x3e')])&&_0x3377c2['idField']&&_0x3377c2[_0x2c52('0x40')]){_0x820ab5[_0x2c52('0x43')][_0x2c52('0x44')]({'id':_0x3377c2['idField'],'value':_0x3377c2[_0x2c52('0x42')][_0x2c52('0x37')]()});}else if(_0x3377c2[_0x2c52('0x3e')]===_0x2c52('0x45')&&_0x3377c2['variableName']&&_0x3377c2[_0x2c52('0x46')]&&_0x3377c2[_0x2c52('0x40')]){_0x22cd9f[_0x3377c2[_0x2c52('0x47')]]&&_0x820ab5[_0x2c52('0x43')][_0x2c52('0x44')]({'id':_0x3377c2[_0x2c52('0x46')],'value':_0x22cd9f[_0x3377c2[_0x2c52('0x47')]][_0x2c52('0x37')]()});}else if(_0x3377c2[_0x2c52('0x3e')]==='customVariable'&&_0x3377c2['Variable']&&_0x3377c2[_0x2c52('0x48')][_0x2c52('0x13')]&&_0x3377c2[_0x2c52('0x46')]&&_0x3377c2[_0x2c52('0x40')]){_0x22cd9f[_0x3377c2[_0x2c52('0x48')]['name'][_0x2c52('0x41')]()]&&_0x820ab5['custom_fields'][_0x2c52('0x44')]({'id':_0x3377c2[_0x2c52('0x46')],'value':_0x22cd9f[_0x3377c2[_0x2c52('0x48')][_0x2c52('0x13')][_0x2c52('0x41')]()][_0x2c52('0x37')]()});}});}return _0x820ab5;}exports[_0x2c52('0x49')]=function(_0x1d40cc,_0x1b6599,_0x5ea1e6,_0x1e8008,_0x3aa8f4,_0x1dca65){var _0x1c590c,_0xc0b3d6;_0x1dca65[_0x2c52('0xf')]=intUtil[_0x2c52('0x4a')](_0x1dca65[_0x2c52('0xf')]);_0x1dca65[_0x2c52('0x4b')]=intUtil['stripTrailingSlash'](_0x1dca65['serverUrl']);if(_0x3aa8f4&&_0x3aa8f4[_0x2c52('0x4c')]){logger[_0x2c52('0xc')](_0x2c52('0x4d'),_0x2c52('0x4e'));_0x1b6599[_0x2c52('0x4f')]=util['format'](_0x2c52('0x50'),_0x1dca65[_0x2c52('0x4b')],_0x1b6599[_0x2c52('0x51')],md5(_0x1b6599[_0x2c52('0x51')]));}else{_0x1b6599[_0x2c52('0x4f')]='';}headers[_0x2c52('0x52')]=getAuth(_0x1dca65);return getUser(_0x1dca65,_0x1e8008[_0x2c52('0x53')])[_0x2c52('0x16')](function(_0x4ca0c7){_0x1c590c=_0x4ca0c7;logger['info'](_0x2c52('0x54'),_0x1c590c['id']);return getEndUser(_0x1dca65,_0x1b6599[_0x2c52('0x55')],_0x1b6599[_0x2c52('0x56')]);})[_0x2c52('0x16')](function(_0x43a82d){_0xc0b3d6=_0x43a82d;logger['info'](_0x2c52('0x57'),_0xc0b3d6['id']);return getTicket(_0x1dca65,_0x1c590c,_0xc0b3d6,_0x5ea1e6,_0x1b6599);})[_0x2c52('0x16')](function(_0x30d377){if(_0x30d377){logger[_0x2c52('0xc')]('The\x20Ticket\x20ID\x20is:',_0x30d377['id']);switch(_0x1dca65[_0x2c52('0x3e')]){case _0x2c52('0x58'):logger['info']('[QUEUE]',_0x2c52('0x59'));return request({'uri':util[_0x2c52('0x26')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1dca65[_0x2c52('0xf')],_0x1c590c['id'],_0x30d377['id']),'method':_0x2c52('0x10')});case _0x2c52('0x5a'):logger[_0x2c52('0xc')](_0x2c52('0x4d'),_0x2c52('0x5b'));emit(util[_0x2c52('0x26')]('user:%s',_0x1e8008[_0x2c52('0x13')]),'trigger:browser:url',{'uri':util[_0x2c52('0x26')](_0x2c52('0x5c'),_0x1dca65['remoteUri'][_0x2c52('0x5d')](_0x2c52('0x5e'),''),_0x30d377['id'])});break;default:logger[_0x2c52('0x5f')](_0x2c52('0x4d'),_0x2c52('0x60'));}}})['catch'](function(_0x376c05){logger[_0x2c52('0x5f')](_0x2c52('0x61'),util[_0x2c52('0x62')](_0x376c05,{'showHidden':!![],'depth':null}));});};exports[_0x2c52('0x63')]=function(_0x3bb64f,_0x4f5add,_0x3b8710,_0x665a4c,_0x5d9500,_0x3fc001,_0x5c2b1d){var _0x19b221,_0x15d9e5;_0x3fc001['remoteUri']=intUtil[_0x2c52('0x4a')](_0x3fc001['remoteUri']);_0x3fc001[_0x2c52('0x4b')]=intUtil['stripTrailingSlash'](_0x3fc001['serverUrl']);if(_0x5c2b1d&&_0x5c2b1d[_0x2c52('0x64')]&&_0x5c2b1d[_0x2c52('0x64')]!==_0x2c52('0x65')){logger['info'](_0x2c52('0x66'),_0x2c52('0x4e'));_0x4f5add['recordingURL']=util[_0x2c52('0x26')](_0x2c52('0x50'),_0x3fc001[_0x2c52('0x4b')],_0x4f5add[_0x2c52('0x51')],md5(_0x4f5add[_0x2c52('0x51')]));}headers['Authorization']=getAuth(_0x3fc001);return getUser(_0x3fc001,_0x665a4c[_0x2c52('0x53')])[_0x2c52('0x16')](function(_0x57de88){_0x19b221=_0x57de88;logger[_0x2c52('0xc')](_0x2c52('0x54'),_0x19b221['id']);return getEndUser(_0x3fc001,_0x4f5add[_0x2c52('0x67')],_0x4f5add[_0x2c52('0x68')]);})['then'](function(_0x3e3ed6){_0x15d9e5=_0x3e3ed6;logger[_0x2c52('0xc')]('The\x20Enduser\x20ID\x20is:',_0x15d9e5['id']);return getTicket(_0x3fc001,_0x19b221,_0x15d9e5,_0x3b8710,_0x4f5add);})[_0x2c52('0x16')](function(_0x1aa62f){if(_0x1aa62f){logger[_0x2c52('0xc')](_0x2c52('0x69'),_0x1aa62f['id']);switch(_0x3fc001[_0x2c52('0x3e')]){case _0x2c52('0x58'):logger[_0x2c52('0xc')](_0x2c52('0x66'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2c52('0x26')](_0x2c52('0x6a'),_0x3fc001['remoteUri'],_0x19b221['id'],_0x1aa62f['id']),'method':_0x2c52('0x10')});case _0x2c52('0x5a'):logger[_0x2c52('0xc')](_0x2c52('0x66'),_0x2c52('0x5b'));emit(util[_0x2c52('0x26')](_0x2c52('0x6b'),_0x665a4c['name']),'trigger:browser:url',{'uri':util[_0x2c52('0x26')](_0x2c52('0x5c'),_0x3fc001[_0x2c52('0xf')][_0x2c52('0x5d')](_0x2c52('0x5e'),''),_0x1aa62f['id'])});break;default:logger[_0x2c52('0x5f')]('[OUTBOUND]',_0x2c52('0x60'));}}})['catch'](function(_0x4852d9){logger[_0x2c52('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2c52('0x62')](_0x4852d9,{'showHidden':!![],'depth':null}));});};exports[_0x2c52('0x6c')]=function(_0x219a25,_0x1eb9dd,_0x6b653d,_0x56b010,_0xafbacd,_0x453677){var _0x34a869,_0xe109b1;_0x453677[_0x2c52('0xf')]=intUtil[_0x2c52('0x4a')](_0x453677[_0x2c52('0xf')]);_0x453677[_0x2c52('0x4b')]=intUtil[_0x2c52('0x4a')](_0x453677[_0x2c52('0x4b')]);if(_0xafbacd&&_0xafbacd[_0x2c52('0x4c')]){logger[_0x2c52('0xc')]('['+_0x1eb9dd[_0x2c52('0x6d')][_0x2c52('0x6e')]()+']',_0x2c52('0x4e'));_0x1eb9dd['recordingURL']=util[_0x2c52('0x26')](_0x2c52('0x50'),_0x453677[_0x2c52('0x4b')],_0x1eb9dd[_0x2c52('0x51')],md5(_0x1eb9dd['uniqueid']));}else{_0x1eb9dd[_0x2c52('0x4f')]='';}headers[_0x2c52('0x52')]=getAuth(_0x453677);return getUser(_0x453677)[_0x2c52('0x16')](function(_0x1438af){_0x34a869=_0x1438af;logger[_0x2c52('0xc')](_0x2c52('0x54'),_0x34a869['id']);return getEndUser(_0x453677,_0x1eb9dd[_0x2c52('0x55')],_0x1eb9dd[_0x2c52('0x56')]);})[_0x2c52('0x16')](function(_0x41a1ab){_0xe109b1=_0x41a1ab;logger['info'](_0x2c52('0x57'),_0xe109b1['id']);return getTicket(_0x453677,_0x34a869,_0xe109b1,_0x6b653d,_0x1eb9dd);})[_0x2c52('0x16')](function(_0x2b0e9d){if(_0x2b0e9d){logger[_0x2c52('0xc')](_0x2c52('0x69'),_0x2b0e9d['id']);}})[_0x2c52('0x6f')](function(_0x3a154c){logger['error']('['+_0x1eb9dd['lastevent'][_0x2c52('0x6e')]()+']'+_0x2c52('0x70'),util[_0x2c52('0x62')](_0x3a154c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb5e4=['string','picklist','type','nameField','toLowerCase','content','toString','includes','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','POST','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','replace','unmanaged','toUpperCase','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','Tags','getString','Descriptions','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','format','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','end-user','first','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','stringify','GET','length','forEach'];(function(_0xb72424,_0x15da3){var _0x330950=function(_0x795dd9){while(--_0x795dd9){_0xb72424['push'](_0xb72424['shift']());}};_0x330950(++_0x15da3);}(_0xb5e4,0x10e));var _0x4b5e=function(_0x1e7872,_0x38559f){_0x1e7872=_0x1e7872-0x0;var _0x368ca9=_0xb5e4[_0x1e7872];return _0x368ca9;};'use strict';var _=require(_0x4b5e('0x0'));var rp=require(_0x4b5e('0x1'));var md5=require(_0x4b5e('0x2'));var util=require(_0x4b5e('0x3'));var Redis=require(_0x4b5e('0x4'));var intUtil=require(_0x4b5e('0x5'));var config=require(_0x4b5e('0x6'));var logger=require(_0x4b5e('0x7'))(_0x4b5e('0x8'));config[_0x4b5e('0x9')]=_[_0x4b5e('0xa')](config[_0x4b5e('0x9')],{'host':_0x4b5e('0xb'),'port':0x18eb});var io=require(_0x4b5e('0xc'))(new Redis(config[_0x4b5e('0x9')]));function emit(_0x58ba6e,_0x5b67d1,_0x2ed7d6){io['to'](_0x58ba6e)[_0x4b5e('0xd')](_0x5b67d1,_0x2ed7d6);}var headers={'Content-Type':'application/json','Accept':_0x4b5e('0xe')};function getTicket(_0x37cfab,_0x23b45d,_0x557aec,_0x180705,_0x21d866){logger[_0x4b5e('0xf')](_0x4b5e('0x10'));return request({'uri':util['format']('%s/tickets.json',_0x37cfab['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x557aec['id'],'submitter_id':_0x23b45d?_0x23b45d['id']:undefined,'assignee_id':_0x23b45d?_0x23b45d['id']:undefined,'tags':getTags(_0x180705[_0x4b5e('0x11')],'name'),'subject':intUtil['getString'](_0x180705['Subjects'],_0x21d866,'\x20'),'description':intUtil[_0x4b5e('0x12')](_0x180705[_0x4b5e('0x13')],_0x21d866,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x180705['Descriptions'],_0x21d866,'\x0a')}},getCustomFields(_0x180705['Fields'],_0x21d866))}})[_0x4b5e('0x14')](function(_0x3b3b42){logger[_0x4b5e('0xf')](_0x4b5e('0x15'));return _0x3b3b42['ticket'];});}function getUser(_0x576142,_0x2d3266){if(intUtil['validateEmail'](_0x2d3266)){logger[_0x4b5e('0xf')](_0x4b5e('0x16'),_0x2d3266);return request({'uri':util[_0x4b5e('0x17')]('%s/search.json',_0x576142[_0x4b5e('0x18')]),'qs':{'query':util[_0x4b5e('0x17')](_0x4b5e('0x19'),_0x2d3266)}})[_0x4b5e('0x14')](function(_0x2500fc){if(_0x2500fc[_0x4b5e('0x1a')]){logger[_0x4b5e('0xf')](_0x4b5e('0x1b'));return _[_0x4b5e('0x1c')](_0x2500fc[_0x4b5e('0x1d')],{'email':_0x2d3266,'role':_0x4b5e('0x1e')});}else{logger[_0x4b5e('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x576142[_0x4b5e('0x18')])})[_0x4b5e('0x14')](function(_0x176623){logger[_0x4b5e('0xf')](_0x4b5e('0x1f'));return _0x176623[_0x4b5e('0x20')];});}});}else{logger[_0x4b5e('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4b5e('0x17')]('%s/users/me.json',_0x576142[_0x4b5e('0x18')])})['then'](function(_0x1bec29){logger[_0x4b5e('0xf')]('Admin\x20account\x20selected.');return _0x1bec29[_0x4b5e('0x20')];});}}function getEndUser(_0x4c6584,_0x552be0,_0x5a3dca){logger[_0x4b5e('0xf')](_0x4b5e('0x21'),_0x5a3dca);return request({'uri':util[_0x4b5e('0x17')]('%s/search.json',_0x4c6584[_0x4b5e('0x18')]),'qs':{'query':util[_0x4b5e('0x17')](_0x4b5e('0x22'),_0x5a3dca)}})[_0x4b5e('0x14')](function(_0x37af4f){var _0x35bb95;if(_0x37af4f['results']['length']){_0x37af4f[_0x4b5e('0x1d')]=_['filter'](_0x37af4f[_0x4b5e('0x1d')],{'suspended':![],'role':_0x4b5e('0x23')});if(_0x37af4f['results']['length']){_0x35bb95=_[_0x4b5e('0x24')](_0x37af4f['results']);}}if(_0x35bb95){logger[_0x4b5e('0xf')]('Enduser\x20found!');return _0x35bb95;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x4b5e('0x17')]('%s/users.json',_0x4c6584[_0x4b5e('0x18')]),'method':'POST','body':{'user':{'role':_0x4b5e('0x23'),'name':util[_0x4b5e('0x17')](_0x4b5e('0x25'),_0x552be0||_0x5a3dca),'phone':_0x5a3dca}}})['then'](function(_0x2cba81){logger[_0x4b5e('0xf')](_0x4b5e('0x26'));return _0x2cba81[_0x4b5e('0x20')];});}});}function getAuth(_0x309921){var _0x3eaffd;if(_0x309921[_0x4b5e('0x27')]===_0x4b5e('0x28')){_0x3eaffd=util[_0x4b5e('0x17')](_0x4b5e('0x29'),_0x309921[_0x4b5e('0x2a')],_0x309921[_0x4b5e('0x28')]);}else if(_0x309921[_0x4b5e('0x27')]===_0x4b5e('0x2b')){_0x3eaffd=util[_0x4b5e('0x17')](_0x4b5e('0x2c'),_0x309921[_0x4b5e('0x2a')],_0x309921[_0x4b5e('0x2b')]);}return util[_0x4b5e('0x17')](_0x4b5e('0x2d'),new Buffer(_0x3eaffd)['toString'](_0x4b5e('0x2e')));}function request(_0x217689){logger['debug']('[HTTP]',JSON[_0x4b5e('0x2f')](_0x217689));return rp(_[_0x4b5e('0xa')](_0x217689,{'method':_0x4b5e('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x1570c0,_0x2595f4){var _0x5b8700=[];if(_0x1570c0&&_0x1570c0[_0x4b5e('0x31')]>0x0){_0x5b8700=_['map'](_0x1570c0,_0x2595f4);}return _0x5b8700;}function getCustomFields(_0x1e677a,_0x1ac7d3){var _0x4134c4=[];var _0x52c1de={'custom_fields':[]};if(_0x1e677a[_0x4b5e('0x31')]>0x0){_[_0x4b5e('0x32')](_0x1e677a,function(_0x1c2aca){if(_['includes']([_0x4b5e('0x33'),_0x4b5e('0x34')],_0x1c2aca[_0x4b5e('0x35')])&&_0x1c2aca[_0x4b5e('0x36')]&&!_0x1c2aca['customField']){_0x52c1de[_0x1c2aca[_0x4b5e('0x36')][_0x4b5e('0x37')]()]=_0x1c2aca[_0x4b5e('0x38')][_0x4b5e('0x39')]();}else if(_[_0x4b5e('0x3a')]([_0x4b5e('0x33'),_0x4b5e('0x34')],_0x1c2aca[_0x4b5e('0x35')])&&_0x1c2aca['idField']&&_0x1c2aca[_0x4b5e('0x3b')]){_0x52c1de[_0x4b5e('0x3c')][_0x4b5e('0x3d')]({'id':_0x1c2aca[_0x4b5e('0x3e')],'value':_0x1c2aca[_0x4b5e('0x38')][_0x4b5e('0x39')]()});}else if(_0x1c2aca[_0x4b5e('0x35')]===_0x4b5e('0x3f')&&_0x1c2aca['variableName']&&_0x1c2aca[_0x4b5e('0x3e')]&&_0x1c2aca[_0x4b5e('0x3b')]){_0x1ac7d3[_0x1c2aca[_0x4b5e('0x40')]]&&_0x52c1de[_0x4b5e('0x3c')]['push']({'id':_0x1c2aca[_0x4b5e('0x3e')],'value':_0x1ac7d3[_0x1c2aca['variableName']][_0x4b5e('0x39')]()});}else if(_0x1c2aca[_0x4b5e('0x35')]===_0x4b5e('0x41')&&_0x1c2aca[_0x4b5e('0x42')]&&_0x1c2aca[_0x4b5e('0x42')][_0x4b5e('0x43')]&&_0x1c2aca['idField']&&_0x1c2aca[_0x4b5e('0x3b')]){_0x1ac7d3[_0x1c2aca[_0x4b5e('0x42')]['name'][_0x4b5e('0x37')]()]&&_0x52c1de[_0x4b5e('0x3c')][_0x4b5e('0x3d')]({'id':_0x1c2aca[_0x4b5e('0x3e')],'value':_0x1ac7d3[_0x1c2aca['Variable'][_0x4b5e('0x43')][_0x4b5e('0x37')]()]['toString']()});}});}return _0x52c1de;}exports[_0x4b5e('0x44')]=function(_0x445520,_0x3e12e6,_0x55810a,_0x389a9a,_0x389d48,_0x2ac40a){var _0x1306be,_0x146983;_0x2ac40a[_0x4b5e('0x18')]=intUtil[_0x4b5e('0x45')](_0x2ac40a['remoteUri']);_0x2ac40a[_0x4b5e('0x46')]=intUtil['stripTrailingSlash'](_0x2ac40a[_0x4b5e('0x46')]);if(_0x389d48&&_0x389d48[_0x4b5e('0x47')]){logger[_0x4b5e('0xf')](_0x4b5e('0x48'),_0x4b5e('0x49'));_0x3e12e6[_0x4b5e('0x4a')]=util['format'](_0x4b5e('0x4b'),_0x2ac40a[_0x4b5e('0x46')],_0x3e12e6['uniqueid'],md5(_0x3e12e6[_0x4b5e('0x4c')]));}else{_0x3e12e6[_0x4b5e('0x4a')]='';}headers['Authorization']=getAuth(_0x2ac40a);return getUser(_0x2ac40a,_0x389a9a[_0x4b5e('0x4d')])[_0x4b5e('0x14')](function(_0x3af1fd){_0x1306be=_0x3af1fd;logger[_0x4b5e('0xf')](_0x4b5e('0x4e'),_0x1306be['id']);return getEndUser(_0x2ac40a,_0x3e12e6['calleridname'],_0x3e12e6[_0x4b5e('0x4f')]);})[_0x4b5e('0x14')](function(_0x256d59){_0x146983=_0x256d59;logger[_0x4b5e('0xf')](_0x4b5e('0x50'),_0x146983['id']);return getTicket(_0x2ac40a,_0x1306be,_0x146983,_0x55810a,_0x3e12e6);})[_0x4b5e('0x14')](function(_0x4b8789){if(_0x4b8789){logger[_0x4b5e('0xf')](_0x4b5e('0x51'),_0x4b8789['id']);switch(_0x2ac40a[_0x4b5e('0x35')]){case _0x4b5e('0x52'):logger[_0x4b5e('0xf')]('[QUEUE]',_0x4b5e('0x53'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ac40a[_0x4b5e('0x18')],_0x1306be['id'],_0x4b8789['id']),'method':_0x4b5e('0x54')});case'newTab':logger[_0x4b5e('0xf')](_0x4b5e('0x48'),_0x4b5e('0x55'));emit(util['format']('user:%s',_0x389a9a[_0x4b5e('0x43')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x2ac40a['remoteUri']['replace'](_0x4b5e('0x56'),''),_0x4b8789['id'])});break;default:logger[_0x4b5e('0x57')](_0x4b5e('0x48'),_0x4b5e('0x58'));}}})[_0x4b5e('0x59')](function(_0x431cea){logger[_0x4b5e('0x57')](_0x4b5e('0x5a'),util[_0x4b5e('0x5b')](_0x431cea,{'showHidden':!![],'depth':null}));});};exports[_0x4b5e('0x5c')]=function(_0x36b96c,_0x56a58d,_0x53ac54,_0x75e6f2,_0x50cacf,_0x6efd6b,_0x2d08c0){var _0x33f3e3,_0x3b81b1;_0x6efd6b[_0x4b5e('0x18')]=intUtil[_0x4b5e('0x45')](_0x6efd6b[_0x4b5e('0x18')]);_0x6efd6b['serverUrl']=intUtil['stripTrailingSlash'](_0x6efd6b[_0x4b5e('0x46')]);if(_0x2d08c0&&_0x2d08c0[_0x4b5e('0x5d')]&&_0x2d08c0[_0x4b5e('0x5d')]!==_0x4b5e('0x5e')){logger[_0x4b5e('0xf')](_0x4b5e('0x5f'),'Recording\x20is\x20enabled!');_0x56a58d[_0x4b5e('0x4a')]=util[_0x4b5e('0x17')](_0x4b5e('0x4b'),_0x6efd6b[_0x4b5e('0x46')],_0x56a58d[_0x4b5e('0x4c')],md5(_0x56a58d['uniqueid']));}headers[_0x4b5e('0x60')]=getAuth(_0x6efd6b);return getUser(_0x6efd6b,_0x75e6f2['email'])[_0x4b5e('0x14')](function(_0x596c6e){_0x33f3e3=_0x596c6e;logger[_0x4b5e('0xf')](_0x4b5e('0x4e'),_0x33f3e3['id']);return getEndUser(_0x6efd6b,_0x56a58d[_0x4b5e('0x61')],_0x56a58d[_0x4b5e('0x62')]);})[_0x4b5e('0x14')](function(_0x1bdda6){_0x3b81b1=_0x1bdda6;logger[_0x4b5e('0xf')](_0x4b5e('0x50'),_0x3b81b1['id']);return getTicket(_0x6efd6b,_0x33f3e3,_0x3b81b1,_0x53ac54,_0x56a58d);})[_0x4b5e('0x14')](function(_0x115a69){if(_0x115a69){logger['info'](_0x4b5e('0x51'),_0x115a69['id']);switch(_0x6efd6b[_0x4b5e('0x35')]){case _0x4b5e('0x52'):logger[_0x4b5e('0xf')](_0x4b5e('0x5f'),_0x4b5e('0x53'));return request({'uri':util[_0x4b5e('0x17')](_0x4b5e('0x63'),_0x6efd6b[_0x4b5e('0x18')],_0x33f3e3['id'],_0x115a69['id']),'method':_0x4b5e('0x54')});case'newTab':logger[_0x4b5e('0xf')](_0x4b5e('0x5f'),_0x4b5e('0x55'));emit(util[_0x4b5e('0x17')](_0x4b5e('0x64'),_0x75e6f2['name']),'trigger:browser:url',{'uri':util[_0x4b5e('0x17')]('%s/agent/tickets/%s',_0x6efd6b[_0x4b5e('0x18')][_0x4b5e('0x65')](_0x4b5e('0x56'),''),_0x115a69['id'])});break;default:logger[_0x4b5e('0x57')](_0x4b5e('0x5f'),_0x4b5e('0x58'));}}})[_0x4b5e('0x59')](function(_0x551631){logger[_0x4b5e('0x57')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4b5e('0x5b')](_0x551631,{'showHidden':!![],'depth':null}));});};exports[_0x4b5e('0x66')]=function(_0x5d76d7,_0x483766,_0x137dc0,_0x4c8c23,_0x17fafc,_0x319f77){var _0x5caf51,_0x80d1e;_0x319f77[_0x4b5e('0x18')]=intUtil[_0x4b5e('0x45')](_0x319f77[_0x4b5e('0x18')]);_0x319f77['serverUrl']=intUtil['stripTrailingSlash'](_0x319f77['serverUrl']);if(_0x17fafc&&_0x17fafc['monitor_format']){logger[_0x4b5e('0xf')]('['+_0x483766['lastevent'][_0x4b5e('0x67')]()+']',_0x4b5e('0x49'));_0x483766['recordingURL']=util['format'](_0x4b5e('0x4b'),_0x319f77['serverUrl'],_0x483766['uniqueid'],md5(_0x483766[_0x4b5e('0x4c')]));}else{_0x483766['recordingURL']='';}headers[_0x4b5e('0x60')]=getAuth(_0x319f77);return getUser(_0x319f77)['then'](function(_0x2d2927){_0x5caf51=_0x2d2927;logger[_0x4b5e('0xf')](_0x4b5e('0x4e'),_0x5caf51['id']);return getEndUser(_0x319f77,_0x483766[_0x4b5e('0x68')],_0x483766[_0x4b5e('0x4f')]);})['then'](function(_0x4da17d){_0x80d1e=_0x4da17d;logger['info'](_0x4b5e('0x50'),_0x80d1e['id']);return getTicket(_0x319f77,_0x5caf51,_0x80d1e,_0x137dc0,_0x483766);})[_0x4b5e('0x14')](function(_0x16e3af){if(_0x16e3af){logger[_0x4b5e('0xf')](_0x4b5e('0x51'),_0x16e3af['id']);}})[_0x4b5e('0x59')](function(_0x5325ba){logger['error']('['+_0x483766[_0x4b5e('0x69')][_0x4b5e('0x67')]()+']'+_0x4b5e('0x6a'),util[_0x4b5e('0x5b')](_0x5325ba,{'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 d7a255d..b1b2d60 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 _0x5aba=['add','seconds','catch','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','connect','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','outbound','recordingFormat','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','util','moment','bluebird','../../../../config/environment','../../../../config/logger','localhost','redis','stringify','length','forEach','includes','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then'];(function(_0x500743,_0x132d06){var _0x4d2fd8=function(_0x1805c1){while(--_0x1805c1){_0x500743['push'](_0x500743['shift']());}};_0x4d2fd8(++_0x132d06);}(_0x5aba,0x69));var _0xa5ab=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x5aba[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0xa5ab('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xa5ab('0x1'));var intUtil=require('./util');var moment=require(_0xa5ab('0x2'));var Redis=require('ioredis');var BPromise=require(_0xa5ab('0x3'));var config=require(_0xa5ab('0x4'));var logger=require(_0xa5ab('0x5'))('zoho');config['redis']=_['defaults'](config['redis'],{'host':_0xa5ab('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa5ab('0x7')]));function emit(_0x38f46e,_0xa6631c,_0x5c7f87){io['to'](_0x38f46e)['emit'](_0xa6631c,_0x5c7f87);}function request(_0x5658fb){logger['debug']('[HTTP]',JSON[_0xa5ab('0x8')](_0x5658fb));return rp(_0x5658fb);}function getCustomFields(_0x5b6e86,_0x305a11){var _0x57b58c={};if(_0x5b6e86[_0xa5ab('0x9')]>0x0){_[_0xa5ab('0xa')](_0x5b6e86,function(_0x393756){if(_[_0xa5ab('0xb')](['string',_0xa5ab('0xc')],_0x393756[_0xa5ab('0xd')])&&_0x393756[_0xa5ab('0xe')]){_0x57b58c[_0x393756[_0xa5ab('0xe')]]=_0x393756[_0xa5ab('0xf')][_0xa5ab('0x10')]();}else if(_0x393756[_0xa5ab('0xd')]==='variable'&&_0x393756['variableName']&&_0x393756[_0xa5ab('0xe')]&&_0x305a11[_0x393756[_0xa5ab('0x11')]]){_0x57b58c[_0x393756['idField']]=_0x305a11[_0x393756[_0xa5ab('0x11')]][_0xa5ab('0x10')]();}else if(_0x393756['type']==='customVariable'&&_0x393756[_0xa5ab('0x12')]&&_0x393756['Variable'][_0xa5ab('0x13')]&&_0x393756[_0xa5ab('0xe')]&&_0x305a11[_0x393756[_0xa5ab('0x12')][_0xa5ab('0x13')]['toLowerCase']()]){_0x57b58c[_0x393756[_0xa5ab('0xe')]]=_0x305a11[_0x393756['Variable'][_0xa5ab('0x13')][_0xa5ab('0x14')]()][_0xa5ab('0x10')]();}});}return _0x57b58c;}function getName(_0x3363e6){if(_0x3363e6[_0xa5ab('0x15')]('\x20')>0x0){var _0x540c15=_0x3363e6[_0xa5ab('0x16')](/ (.+)/);if(_0x540c15[0x1]){return _0x540c15;}}return[_0x3363e6,_0x3363e6];}var accountsTokens={};function getAccessToken(_0x1cf54e){return new Promise(function(_0x504475,_0x2b8604){if(!_[_0xa5ab('0x17')](accountsTokens[_0x1cf54e['id']])&&!_['isNil'](accountsTokens[_0x1cf54e['id']][_0xa5ab('0x18')])){if(moment()[_0xa5ab('0x19')](accountsTokens[_0x1cf54e['id']][_0xa5ab('0x1a')])){_0x504475(accountsTokens[_0x1cf54e['id']][_0xa5ab('0x18')]);}}var _0x5bbad2;switch(_0x1cf54e['zone']){case'US':_0x5bbad2=_0xa5ab('0x1b');break;case'AU':_0x5bbad2=_0xa5ab('0x1c');break;case'EU':_0x5bbad2='https://accounts.zoho.eu';break;case'IN':_0x5bbad2=_0xa5ab('0x1d');break;case'CN':_0x5bbad2=_0xa5ab('0x1e');break;default:_0x5bbad2='https://accounts.zoho.eu';break;}var _0x5a9e05={'method':_0xa5ab('0x1f'),'uri':_0x5bbad2+_0xa5ab('0x20'),'qs':{'refresh_token':_0x1cf54e[_0xa5ab('0x21')],'client_id':_0x1cf54e[_0xa5ab('0x22')],'client_secret':_0x1cf54e['clientSecret'],'grant_type':_0xa5ab('0x23')},'json':!![]};return rp(_0x5a9e05)[_0xa5ab('0x24')](function(_0x41e334){accountsTokens[_0x1cf54e['id']]={'access_token':_0x41e334[_0xa5ab('0x18')],'expires_in':moment()[_0xa5ab('0x25')](_0x41e334[_0xa5ab('0x1a')],_0xa5ab('0x26'))};_0x504475(_0x41e334[_0xa5ab('0x18')]);})[_0xa5ab('0x27')](function(_0x50f43b){logger['error']('Failing\x20creating\x20the\x20access_token',_0x50f43b['stack']);_0x2b8604(_0x50f43b);});});}function getUser(_0xe65097,_0x2a979d,_0x6096d1,_0x7a7496){logger[_0xa5ab('0x28')](_0xa5ab('0x29'));return request({'method':_0xa5ab('0x2a'),'uri':util[_0xa5ab('0x2b')](_0xa5ab('0x2c'),_0x2a979d),'qs':{'type':_0xa5ab('0x2d')},'headers':{'Authorization':_0xa5ab('0x2e')+_0xe65097},'json':!![]})[_0xa5ab('0x24')](function(_0x373fa0){if(_0x373fa0['users']){var _0x4b8250=-0x1;if(_['isArrayLikeObject'](_0x373fa0[_0xa5ab('0x2f')])){if(!_[_0xa5ab('0x17')](_0x7a7496)){_0x4b8250=_[_0xa5ab('0x30')](_0x373fa0[_0xa5ab('0x2f')],function(_0x45ab8f){return _0x45ab8f[_0xa5ab('0x31')]===_0x7a7496;});}if(_0x4b8250>=0x0){logger[_0xa5ab('0x28')]('Agent\x20found!');}else{logger[_0xa5ab('0x28')](_0xa5ab('0x32'));_0x4b8250=_[_0xa5ab('0x30')](_0x373fa0[_0xa5ab('0x2f')],function(_0x492d48){return _0x492d48[_0xa5ab('0x33')][_0xa5ab('0x13')]===_0xa5ab('0x34');});}return _0x373fa0[_0xa5ab('0x2f')][_0x4b8250];}else{if(_0x373fa0[_0xa5ab('0x35')][_0xa5ab('0x33')][_0xa5ab('0x13')]==='Administrator'){logger[_0xa5ab('0x28')](_0xa5ab('0x32'));user=_0x373fa0['user'];return user;}else{logger['error'](_0xa5ab('0x36'),JSON[_0xa5ab('0x8')](_0x373fa0));throw new Error(_0xa5ab('0x37')+JSON[_0xa5ab('0x8')](_0x373fa0));}}}else{logger[_0xa5ab('0x38')](_0xa5ab('0x36'),JSON[_0xa5ab('0x8')](_0x373fa0));throw new Error(_0xa5ab('0x37')+JSON['stringify'](_0x373fa0));}})[_0xa5ab('0x27')](function(_0x443a44){console[_0xa5ab('0x38')](_0x443a44);});}function getZohoUser(_0x4d4d60,_0x23bef1){return new BPromise(function(_0x430cdd,_0x43126b){request(_0x4d4d60)['then'](function(_0x3cc747){var _0x5ee32e=null;if(_0x3cc747){_0x5ee32e=_0x3cc747[_0xa5ab('0x39')][0x0];_0x5ee32e[_0xa5ab('0x3a')]=_0x23bef1;}_0x430cdd(_0x5ee32e);})[_0xa5ab('0x27')](function(_0x551727){_0x43126b(_0x551727);});});}function createEndUser(_0x5ae461,_0x1f9ad0,_0x5a1143,_0x4781e7,_0x4b925c,_0x1e6765){var _0x5a1143=getName(_0x5a1143);return request({'method':_0xa5ab('0x1f'),'uri':_0xa5ab('0x3b')+_0x1f9ad0+_0xa5ab('0x3c')+_[_0xa5ab('0x3d')](_0x1e6765[_0xa5ab('0x3e')])+'s','body':{'data':[{'Last_Name':_0x5a1143[0x1],'First_Name':_0x5a1143[0x0],'Phone':_0x4781e7,'Owner':{'name':!_[_0xa5ab('0x17')](_0x4b925c['role'][_0xa5ab('0x13')])?_0x4b925c[_0xa5ab('0x3f')][_0xa5ab('0x13')]:!_[_0xa5ab('0x17')](_0x4b925c[_0xa5ab('0x40')])?_0x4b925c[_0xa5ab('0x40')]+'\x20'+_0x4b925c['last_name']:_0x4b925c[_0xa5ab('0x41')],'id':_0x4b925c['id']}}]},'headers':{'Authorization':_0xa5ab('0x2e')+_0x5ae461},'json':!![]})[_0xa5ab('0x24')](function(_0x3b68cd){if(_0x3b68cd&&_0x3b68cd['data'][0x0][_0xa5ab('0x42')]==='SUCCESS'){var _0x463cc8=_0x3b68cd[_0xa5ab('0x39')][0x0]['details'];_0x463cc8['enduserType']=_[_0xa5ab('0x3d')](_0x1e6765[_0xa5ab('0x3e')])+'s';return _0x463cc8;}logger[_0xa5ab('0x38')](_0xa5ab('0x36'),JSON['stringify'](data));throw new Error(_0xa5ab('0x43')+JSON[_0xa5ab('0x8')](data));})['catch'](function(_0xa4a21){console[_0xa5ab('0x44')]('CREATE\x20ERROR',_0xa4a21);});}function getEndUser(_0x5994e1,_0xedb01,_0x274e28,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1){var _0x4a3221={'method':_0xa5ab('0x2a'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5994e1},'json':!![]};switch(_0x36a4a1[_0xa5ab('0x45')]){case _0xa5ab('0x46'):_0x4a3221[_0xa5ab('0x47')]=_0xa5ab('0x3b')+_0xedb01+_0xa5ab('0x48')+_0x57fdb8+'))';return getZohoUser(_0x4a3221,_0xa5ab('0x49'))[_0xa5ab('0x24')](function(_0x37061f){if(_0x37061f)return _0x37061f;_0x4a3221['uri']=_0xa5ab('0x3b')+_0xedb01+_0xa5ab('0x4a')+_0x57fdb8+'))';return getZohoUser(_0x4a3221,'Leads')['then'](function(_0x1ca497){if(_0x1ca497)return _0x1ca497;if(_0x36a4a1[_0xa5ab('0x3e')]!=_0xa5ab('0x4b')){return createEndUser(_0x5994e1,_0xedb01,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1);}else{return{};}});});break;case'contact':_0x4a3221[_0xa5ab('0x47')]='https://www.zohoapis.'+_0xedb01+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x57fdb8+'))';return getZohoUser(_0x4a3221,_0xa5ab('0x49'))[_0xa5ab('0x24')](function(_0x1e4b24){if(_0x1e4b24)return _0x1e4b24;if(_0x36a4a1[_0xa5ab('0x3e')]!='nothing'){return createEndUser(_0x5994e1,_0xedb01,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1);}else{return{};}});break;case'lead':_0x4a3221[_0xa5ab('0x47')]=_0xa5ab('0x3b')+_0xedb01+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x57fdb8+'))';return getZohoUser(_0x4a3221,'Leads')[_0xa5ab('0x24')](function(_0x3d62d8){if(_0x3d62d8)return _0x3d62d8;if(_0x36a4a1[_0xa5ab('0x3e')]!=_0xa5ab('0x4b')){return createEndUser(_0x5994e1,_0xedb01,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1);}else{return{};}});break;}}function getCall(_0x211a0f,_0x31b366,_0x1ce5a9,_0x281a91,_0x3d0e91,_0x247480,_0x325806,_0x391b56){logger[_0xa5ab('0x28')](_0xa5ab('0x4c'));var _0x4db439={};_0x4db439[_0xa5ab('0x4d')]={'name':!_['isNil'](_0x281a91['role'][_0xa5ab('0x13')])&&!_[_0xa5ab('0x17')](_0x281a91[_0xa5ab('0x33')][_0xa5ab('0x13')])&&_0x281a91['profile'][_0xa5ab('0x13')]===_0xa5ab('0x4e')?_0x281a91[_0xa5ab('0x3f')]['name']:!_[_0xa5ab('0x17')](_0x281a91[_0xa5ab('0x40')])?_0x281a91['first_name']+'\x20'+_0x281a91[_0xa5ab('0x41')]:_0x281a91[_0xa5ab('0x41')],'id':_0x281a91['id']};_0x4db439[_0xa5ab('0x4f')]=intUtil['getString'](_0x247480['Subjects'],_0x325806,'\x20');_0x4db439[_0xa5ab('0x50')]=intUtil['getString'](_0x247480[_0xa5ab('0x51')],_0x325806,'\x0a');if(_0x3d0e91[_0xa5ab('0x3a')]===_0xa5ab('0x49')){_0x4db439[_0xa5ab('0x52')]={'name':!_[_0xa5ab('0x17')](_0x3d0e91['Full_Name'])?_0x3d0e91[_0xa5ab('0x53')]:!_['isNil'](_0x3d0e91[_0xa5ab('0x54')])?_0x3d0e91[_0xa5ab('0x54')]+'\x20'+_0x3d0e91[_0xa5ab('0x55')]:_0x3d0e91['Last_Name'],'id':_0x3d0e91['id']};}if(_0x3d0e91[_0xa5ab('0x3a')]===_0xa5ab('0x56')){_0x4db439[_0xa5ab('0x57')]={'name':!_[_0xa5ab('0x17')](_0x3d0e91[_0xa5ab('0x53')])?_0x3d0e91[_0xa5ab('0x53')]:!_[_0xa5ab('0x17')](_0x3d0e91[_0xa5ab('0x54')])?_0x3d0e91[_0xa5ab('0x54')]+'\x20'+_0x3d0e91[_0xa5ab('0x55')]:_0x3d0e91[_0xa5ab('0x55')],'id':_0x3d0e91['id']};_0x4db439[_0xa5ab('0x58')]=_['startCase'](_0x3d0e91[_0xa5ab('0x3a')]);}if(_0x325806[_0xa5ab('0x59')]){_0x4db439[_0xa5ab('0x5a')]=moment[_0xa5ab('0x5b')](parseInt(_0x325806[_0xa5ab('0x59')])*0x3e8)[_0xa5ab('0x2b')]('mm:ss');}else if(_0x325806[_0xa5ab('0x5c')]&&_0x325806['endtime']){_0x4db439[_0xa5ab('0x5a')]=moment['utc'](moment(_0x325806[_0xa5ab('0x5d')],_0xa5ab('0x5e'))[_0xa5ab('0x5f')](moment(_0x325806[_0xa5ab('0x60')],_0xa5ab('0x5e'))))[_0xa5ab('0x2b')](_0xa5ab('0x61'));}switch(_0x325806[_0xa5ab('0x62')]){case _0xa5ab('0x63'):_0x4db439[_0xa5ab('0x64')]='Called';break;case'complete':case _0xa5ab('0x65'):_0x4db439['Call_Result']=_0xa5ab('0x66');break;case _0xa5ab('0x67'):_0x4db439[_0xa5ab('0x64')]='Rejected';break;case _0xa5ab('0x68'):_0x4db439[_0xa5ab('0x64')]=_0xa5ab('0x69');break;case'timeout':_0x4db439[_0xa5ab('0x64')]=_0xa5ab('0x6a');default:}_0x4db439[_0xa5ab('0x6b')]=(_0x391b56==='outbound'?moment(_0x325806[_0xa5ab('0x60')])['format'](_0xa5ab('0x5e')):moment(_0x325806[_0xa5ab('0x6c')])['format'](_0xa5ab('0x5e')))||moment()[_0xa5ab('0x2b')](_0xa5ab('0x5e'));_0x4db439['Call_Type']=_0x391b56||'Inbound';_0x4db439=_['merge'](_0x4db439,getCustomFields(_0x247480['Fields'],_0x325806));return request({'method':_0xa5ab('0x1f'),'uri':_0xa5ab('0x3b')+_0x31b366+_0xa5ab('0x6d'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x211a0f},'body':{'data':[_0x4db439]},'json':!![]})[_0xa5ab('0x24')](function(_0x531090){if(_0x531090&&_0x531090[_0xa5ab('0x39')][0x0]['code']===_0xa5ab('0x6e')){logger[_0xa5ab('0x28')](_0xa5ab('0x6f'));return{'id':_0x531090['data'][0x0][_0xa5ab('0x70')]['id']};}})[_0xa5ab('0x27')](function(_0x49fcbb){logger['info'](_0xa5ab('0x71'),_0x49fcbb['stack']);console[_0xa5ab('0x44')](_0xa5ab('0x71'),_0x49fcbb);});}exports['queue']=function(_0x4e0d02,_0x132ba5,_0x34d34c,_0x321882,_0x21a73b,_0xfa1fea){var _0x2326e1,_0x4ff731,_0x1b76c1;_0xfa1fea[_0xa5ab('0x72')]=intUtil[_0xa5ab('0x73')](_0xfa1fea[_0xa5ab('0x72')]);_0xfa1fea[_0xa5ab('0x74')]=intUtil[_0xa5ab('0x73')](_0xfa1fea['serverUrl']);if(_0x21a73b&&_0x21a73b[_0xa5ab('0x75')]){logger[_0xa5ab('0x28')](_0xa5ab('0x76'),_0xa5ab('0x77'));_0x132ba5[_0xa5ab('0x78')]=_0xfa1fea[_0xa5ab('0x74')]+'/api/voice/recordings/'+_0x132ba5[_0xa5ab('0x79')]+_0xa5ab('0x7a')+md5(_0x132ba5['uniqueid']);}else{_0x132ba5[_0xa5ab('0x78')]='';}var _0x2b5ec1=_0xfa1fea[_0xa5ab('0x72')]===_0xa5ab('0x7b')?'eu':_0xa5ab('0x7c');return getAccessToken(_0xfa1fea)[_0xa5ab('0x24')](function(_0x4b896c){_0x1b76c1=_0x4b896c;return getUser(_0x1b76c1,_0x2b5ec1,_0xfa1fea,_0x321882[_0xa5ab('0x31')]);})['then'](function(_0xbfc1e2){_0x2326e1=_0xbfc1e2;logger[_0xa5ab('0x28')](_0xa5ab('0x7d'),_0x2326e1['id']);return getEndUser(_0x1b76c1,_0x2b5ec1,_0xfa1fea,_0x132ba5[_0xa5ab('0x7e')],_0x132ba5[_0xa5ab('0x7f')],_0x2326e1,_0x34d34c);})['then'](function(_0x125d20){_0x4ff731=_0x125d20;return getCall(_0x1b76c1,_0x2b5ec1,_0xfa1fea,_0x2326e1,_0x4ff731,_0x34d34c,_0x132ba5,_0xa5ab('0x80'));})[_0xa5ab('0x24')](function(_0x16c819){if(_0x16c819){logger['info'](_0xa5ab('0x81'),_0x16c819['id']);logger[_0xa5ab('0x28')](_0xa5ab('0x76'),_0xa5ab('0x82'));emit(util['format']('user:%s',_0x321882[_0xa5ab('0x13')]),_0xa5ab('0x83'),{'uri':_0xa5ab('0x84')+_0xfa1fea[_0xa5ab('0x72')]+'/crm/EntityInfo.do?module=Calls&id='+_0x16c819['id']});}})[_0xa5ab('0x27')](function(_0x259c74){logger['error'](_0xa5ab('0x76'),JSON[_0xa5ab('0x8')](_0x259c74));});};exports[_0xa5ab('0x85')]=function(_0xa529a8,_0x1249f8,_0x455a3f,_0x314f40,_0x34e73f,_0x3d5a77,_0x486a7a){var _0x4f86e9,_0x432628,_0x2ab7c5;_0x3d5a77[_0xa5ab('0x72')]=intUtil[_0xa5ab('0x73')](_0x3d5a77['host']);_0x3d5a77[_0xa5ab('0x74')]=intUtil[_0xa5ab('0x73')](_0x3d5a77[_0xa5ab('0x74')]);if(_0x486a7a&&_0x486a7a[_0xa5ab('0x86')]&&_0x486a7a['recordingFormat']!=='none'){logger[_0xa5ab('0x28')](_0xa5ab('0x87'),'Recording\x20is\x20enabled!');_0x1249f8['recordingURL']=_0x3d5a77[_0xa5ab('0x74')]+_0xa5ab('0x88')+_0x1249f8['uniqueid']+_0xa5ab('0x7a')+md5(_0x1249f8[_0xa5ab('0x79')]);}var _0x1ec018=_0x3d5a77[_0xa5ab('0x72')]===_0xa5ab('0x7b')?'eu':_0xa5ab('0x7c');return getAccessToken(_0x3d5a77)[_0xa5ab('0x24')](function(_0x194f1c){_0x2ab7c5=_0x194f1c;return getUser(_0x2ab7c5,_0x1ec018,_0x3d5a77,_0x314f40[_0xa5ab('0x31')]);})[_0xa5ab('0x24')](function(_0x59f2f5){_0x4f86e9=_0x59f2f5;logger[_0xa5ab('0x28')]('The\x20User\x20ID\x20is:',_0x4f86e9['id']);return getEndUser(_0x2ab7c5,_0x1ec018,_0x3d5a77,_0x1249f8[_0xa5ab('0x89')],_0x1249f8[_0xa5ab('0x8a')],_0x4f86e9,_0x455a3f);})[_0xa5ab('0x24')](function(_0x48ece5){_0x432628=_0x48ece5;return getCall(_0x2ab7c5,_0x1ec018,_0x3d5a77,_0x4f86e9,_0x432628,_0x455a3f,_0x1249f8,_0xa5ab('0x8b'));})[_0xa5ab('0x24')](function(_0x5d8a80){if(_0x5d8a80){logger[_0xa5ab('0x28')](_0xa5ab('0x81'),_0x5d8a80['id']);logger['info']('[OUTBOUND]',_0xa5ab('0x82'));emit(util[_0xa5ab('0x2b')]('user:%s',_0x314f40[_0xa5ab('0x13')]),_0xa5ab('0x83'),{'uri':_0xa5ab('0x84')+_0x3d5a77[_0xa5ab('0x72')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5d8a80['id']});}})[_0xa5ab('0x27')](function(_0x374321){logger[_0xa5ab('0x38')](_0xa5ab('0x87'),JSON[_0xa5ab('0x8')](_0x374321));});};exports[_0xa5ab('0x8c')]=function(_0x3c4e10,_0x35d74f,_0x97176a,_0x5b19f8,_0x564931,_0x4b126d){var _0x3c94c9,_0x31ede7,_0x120c8d;_0x4b126d[_0xa5ab('0x72')]=intUtil[_0xa5ab('0x73')](_0x4b126d[_0xa5ab('0x72')]);_0x4b126d[_0xa5ab('0x74')]=intUtil[_0xa5ab('0x73')](_0x4b126d['serverUrl']);if(_0x564931&&_0x564931[_0xa5ab('0x75')]){logger[_0xa5ab('0x28')]('['+_0x35d74f[_0xa5ab('0x62')]['toUpperCase']()+']',_0xa5ab('0x77'));_0x35d74f['recordingURL']=_0x4b126d['serverUrl']+_0xa5ab('0x88')+_0x35d74f['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x35d74f['uniqueid']);}else{_0x35d74f[_0xa5ab('0x78')]='';}var _0x8c1086=_0x4b126d[_0xa5ab('0x72')]===_0xa5ab('0x7b')?'eu':_0xa5ab('0x7c');return getAccessToken(_0x4b126d)['then'](function(_0x41fa41){_0x120c8d=_0x41fa41;return getUser(_0x120c8d,_0x8c1086,_0x4b126d);})['then'](function(_0x1b67e3){_0x3c94c9=_0x1b67e3;logger[_0xa5ab('0x28')](_0xa5ab('0x7d'),_0x3c94c9['id']);return getEndUser(_0x120c8d,_0x8c1086,_0x4b126d,_0x35d74f[_0xa5ab('0x7e')],_0x35d74f['calleridnum'],_0x3c94c9,_0x97176a);})[_0xa5ab('0x24')](function(_0x15d408){_0x31ede7=_0x15d408;return getCall(_0x120c8d,_0x8c1086,_0x4b126d,_0x3c94c9,_0x31ede7,_0x97176a,_0x35d74f,_0xa5ab('0x80'));})[_0xa5ab('0x24')](function(_0x324678){if(_0x324678){logger[_0xa5ab('0x28')](_0xa5ab('0x81'),_0x324678['id']);}})[_0xa5ab('0x27')](function(_0x567920){logger[_0xa5ab('0x38')]('['+_0x35d74f[_0xa5ab('0x62')][_0xa5ab('0x8d')]()+']',JSON[_0xa5ab('0x8')](_0x567920));});}; \ No newline at end of file +var _0x7d5a=['Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','utc','talktime','mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','stringify','length','forEach','string','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','getString','Subjects','Description','Descriptions'];(function(_0x23ce3d,_0x126b26){var _0x115c50=function(_0x43173e){while(--_0x43173e){_0x23ce3d['push'](_0x23ce3d['shift']());}};_0x115c50(++_0x126b26);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x4160a4,_0x4d3b43){_0x4160a4=_0x4160a4-0x0;var _0x4f439f=_0x7d5a[_0x4160a4];return _0x4f439f;};'use strict';var _=require(_0xa7d5('0x0'));var rp=require(_0xa7d5('0x1'));var md5=require(_0xa7d5('0x2'));var util=require(_0xa7d5('0x3'));var intUtil=require(_0xa7d5('0x4'));var moment=require(_0xa7d5('0x5'));var Redis=require(_0xa7d5('0x6'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xa7d5('0x7'))(_0xa7d5('0x8'));config[_0xa7d5('0x9')]=_[_0xa7d5('0xa')](config[_0xa7d5('0x9')],{'host':_0xa7d5('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa7d5('0x9')]));function emit(_0xb5bcd2,_0x2c2c25,_0x16004f){io['to'](_0xb5bcd2)[_0xa7d5('0xc')](_0x2c2c25,_0x16004f);}function request(_0xf40c67){logger[_0xa7d5('0xd')]('[HTTP]',JSON[_0xa7d5('0xe')](_0xf40c67));return rp(_0xf40c67);}function getCustomFields(_0x1a153c,_0x298577){var _0x55a249={};if(_0x1a153c[_0xa7d5('0xf')]>0x0){_[_0xa7d5('0x10')](_0x1a153c,function(_0x96f93b){if(_['includes']([_0xa7d5('0x11'),_0xa7d5('0x12')],_0x96f93b[_0xa7d5('0x13')])&&_0x96f93b[_0xa7d5('0x14')]){_0x55a249[_0x96f93b[_0xa7d5('0x14')]]=_0x96f93b['content'][_0xa7d5('0x15')]();}else if(_0x96f93b[_0xa7d5('0x13')]===_0xa7d5('0x16')&&_0x96f93b[_0xa7d5('0x17')]&&_0x96f93b[_0xa7d5('0x14')]&&_0x298577[_0x96f93b['variableName']]){_0x55a249[_0x96f93b[_0xa7d5('0x14')]]=_0x298577[_0x96f93b[_0xa7d5('0x17')]][_0xa7d5('0x15')]();}else if(_0x96f93b['type']==='customVariable'&&_0x96f93b[_0xa7d5('0x18')]&&_0x96f93b['Variable'][_0xa7d5('0x19')]&&_0x96f93b[_0xa7d5('0x14')]&&_0x298577[_0x96f93b['Variable'][_0xa7d5('0x19')][_0xa7d5('0x1a')]()]){_0x55a249[_0x96f93b[_0xa7d5('0x14')]]=_0x298577[_0x96f93b['Variable']['name'][_0xa7d5('0x1a')]()]['toString']();}});}return _0x55a249;}function getName(_0x3f10a9){if(_0x3f10a9['indexOf']('\x20')>0x0){var _0x4dfff9=_0x3f10a9[_0xa7d5('0x1b')](/ (.+)/);if(_0x4dfff9[0x1]){return _0x4dfff9;}}return[_0x3f10a9,_0x3f10a9];}var accountsTokens={};function getAccessToken(_0x123241){return new Promise(function(_0x106a72,_0x2a2879){if(!_[_0xa7d5('0x1c')](accountsTokens[_0x123241['id']])&&!_[_0xa7d5('0x1c')](accountsTokens[_0x123241['id']]['access_token'])){if(moment()[_0xa7d5('0x1d')](accountsTokens[_0x123241['id']][_0xa7d5('0x1e')])){_0x106a72(accountsTokens[_0x123241['id']][_0xa7d5('0x1f')]);}}var _0x43b3e2;switch(_0x123241[_0xa7d5('0x20')]){case'US':_0x43b3e2='https://accounts.zoho.com';break;case'AU':_0x43b3e2=_0xa7d5('0x21');break;case'EU':_0x43b3e2=_0xa7d5('0x22');break;case'IN':_0x43b3e2=_0xa7d5('0x23');break;case'CN':_0x43b3e2=_0xa7d5('0x24');break;default:_0x43b3e2=_0xa7d5('0x22');break;}var _0x1dba7e={'method':'POST','uri':_0x43b3e2+_0xa7d5('0x25'),'qs':{'refresh_token':_0x123241[_0xa7d5('0x26')],'client_id':_0x123241[_0xa7d5('0x27')],'client_secret':_0x123241[_0xa7d5('0x28')],'grant_type':_0xa7d5('0x29')},'json':!![]};return rp(_0x1dba7e)[_0xa7d5('0x2a')](function(_0x5bb0f3){accountsTokens[_0x123241['id']]={'access_token':_0x5bb0f3[_0xa7d5('0x1f')],'expires_in':moment()[_0xa7d5('0x2b')](_0x5bb0f3[_0xa7d5('0x1e')],_0xa7d5('0x2c'))};_0x106a72(_0x5bb0f3[_0xa7d5('0x1f')]);})[_0xa7d5('0x2d')](function(_0x3e2f44){logger[_0xa7d5('0x2e')](_0xa7d5('0x2f'),_0x3e2f44[_0xa7d5('0x30')]);_0x2a2879(_0x3e2f44);});});}function getUser(_0x10e1d7,_0x405272,_0x3f0fab,_0x4ed5a4){logger['info'](_0xa7d5('0x31'));return request({'method':_0xa7d5('0x32'),'uri':util[_0xa7d5('0x33')](_0xa7d5('0x34'),_0x405272),'qs':{'type':_0xa7d5('0x35')},'headers':{'Authorization':_0xa7d5('0x36')+_0x10e1d7},'json':!![]})[_0xa7d5('0x2a')](function(_0x59ad60){if(_0x59ad60[_0xa7d5('0x37')]){var _0x1991c3=-0x1;if(_['isArrayLikeObject'](_0x59ad60['users'])){if(!_[_0xa7d5('0x1c')](_0x4ed5a4)){_0x1991c3=_[_0xa7d5('0x38')](_0x59ad60['users'],function(_0x524343){return _0x524343[_0xa7d5('0x39')]===_0x4ed5a4;});}if(_0x1991c3>=0x0){logger['info'](_0xa7d5('0x3a'));}else{logger[_0xa7d5('0x3b')](_0xa7d5('0x3c'));_0x1991c3=_[_0xa7d5('0x38')](_0x59ad60[_0xa7d5('0x37')],function(_0xae4fa1){return _0xae4fa1[_0xa7d5('0x3d')]['name']==='Administrator';});}return _0x59ad60['users'][_0x1991c3];}else{if(_0x59ad60[_0xa7d5('0x3e')][_0xa7d5('0x3d')]['name']===_0xa7d5('0x3f')){logger[_0xa7d5('0x3b')]('Using\x20the\x20admin\x20account!');user=_0x59ad60['user'];return user;}else{logger[_0xa7d5('0x2e')](_0xa7d5('0x40'),JSON['stringify'](_0x59ad60));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x59ad60));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xa7d5('0xe')](_0x59ad60));throw new Error(_0xa7d5('0x41')+JSON[_0xa7d5('0xe')](_0x59ad60));}})[_0xa7d5('0x2d')](function(_0x4457fa){console[_0xa7d5('0x2e')](_0x4457fa);});}function getZohoUser(_0x58c994,_0x48752d){return new BPromise(function(_0x4940fd,_0x524600){request(_0x58c994)[_0xa7d5('0x2a')](function(_0x1093f4){var _0x527efb=null;if(_0x1093f4){_0x527efb=_0x1093f4[_0xa7d5('0x42')][0x0];_0x527efb[_0xa7d5('0x43')]=_0x48752d;}_0x4940fd(_0x527efb);})[_0xa7d5('0x2d')](function(_0x4ac5d1){_0x524600(_0x4ac5d1);});});}function createEndUser(_0x362845,_0x4547b5,_0x4b36cc,_0xaa56b5,_0x16b785,_0x587b6d){var _0x4b36cc=getName(_0x4b36cc);return request({'method':_0xa7d5('0x44'),'uri':_0xa7d5('0x45')+_0x4547b5+_0xa7d5('0x46')+_['startCase'](_0x587b6d[_0xa7d5('0x47')])+'s','body':{'data':[{'Last_Name':_0x4b36cc[0x1],'First_Name':_0x4b36cc[0x0],'Phone':_0xaa56b5,'Owner':{'name':!_[_0xa7d5('0x1c')](_0x16b785['role']['name'])?_0x16b785[_0xa7d5('0x48')][_0xa7d5('0x19')]:!_['isNil'](_0x16b785[_0xa7d5('0x49')])?_0x16b785[_0xa7d5('0x49')]+'\x20'+_0x16b785[_0xa7d5('0x4a')]:_0x16b785[_0xa7d5('0x4a')],'id':_0x16b785['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x362845},'json':!![]})[_0xa7d5('0x2a')](function(_0x5344c8){if(_0x5344c8&&_0x5344c8[_0xa7d5('0x42')][0x0][_0xa7d5('0x4b')]==='SUCCESS'){var _0x2ef6f6=_0x5344c8[_0xa7d5('0x42')][0x0]['details'];_0x2ef6f6['enduserType']=_[_0xa7d5('0x4c')](_0x587b6d[_0xa7d5('0x47')])+'s';return _0x2ef6f6;}logger['error'](_0xa7d5('0x40'),JSON[_0xa7d5('0xe')](data));throw new Error(_0xa7d5('0x4d')+JSON[_0xa7d5('0xe')](data));})[_0xa7d5('0x2d')](function(_0x55e414){console[_0xa7d5('0x4e')](_0xa7d5('0x4f'),_0x55e414);});}function getEndUser(_0x4dc812,_0x15f2b4,_0x24004b,_0x4450e9,_0x2377df,_0xc028ac,_0x19497f){var _0x1cac48={'method':_0xa7d5('0x32'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4dc812},'json':!![]};switch(_0x19497f[_0xa7d5('0x50')]){case _0xa7d5('0x51'):_0x1cac48[_0xa7d5('0x52')]='https://www.zohoapis.'+_0x15f2b4+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2377df+'))';return getZohoUser(_0x1cac48,_0xa7d5('0x53'))[_0xa7d5('0x2a')](function(_0xd90be4){if(_0xd90be4)return _0xd90be4;_0x1cac48[_0xa7d5('0x52')]='https://www.zohoapis.'+_0x15f2b4+_0xa7d5('0x54')+_0x2377df+'))';return getZohoUser(_0x1cac48,_0xa7d5('0x55'))[_0xa7d5('0x2a')](function(_0x3bef8f){if(_0x3bef8f)return _0x3bef8f;if(_0x19497f[_0xa7d5('0x47')]!=_0xa7d5('0x56')){return createEndUser(_0x4dc812,_0x15f2b4,_0x4450e9,_0x2377df,_0xc028ac,_0x19497f);}else{return{};}});});break;case _0xa7d5('0x57'):_0x1cac48['uri']=_0xa7d5('0x45')+_0x15f2b4+_0xa7d5('0x58')+_0x2377df+'))';return getZohoUser(_0x1cac48,_0xa7d5('0x53'))['then'](function(_0x34ed0b){if(_0x34ed0b)return _0x34ed0b;if(_0x19497f[_0xa7d5('0x47')]!=_0xa7d5('0x56')){return createEndUser(_0x4dc812,_0x15f2b4,_0x4450e9,_0x2377df,_0xc028ac,_0x19497f);}else{return{};}});break;case'lead':_0x1cac48['uri']=_0xa7d5('0x45')+_0x15f2b4+_0xa7d5('0x54')+_0x2377df+'))';return getZohoUser(_0x1cac48,'Leads')['then'](function(_0x276b95){if(_0x276b95)return _0x276b95;if(_0x19497f['moduleCreate']!=_0xa7d5('0x56')){return createEndUser(_0x4dc812,_0x15f2b4,_0x4450e9,_0x2377df,_0xc028ac,_0x19497f);}else{return{};}});break;}}function getCall(_0x4752b0,_0x264d19,_0x8c644e,_0x452991,_0x3e41e7,_0x2b318a,_0x20947e,_0x1c524c){logger[_0xa7d5('0x3b')](_0xa7d5('0x59'));var _0x1f91e7={};_0x1f91e7['Owner']={'name':!_[_0xa7d5('0x1c')](_0x452991[_0xa7d5('0x48')][_0xa7d5('0x19')])&&!_[_0xa7d5('0x1c')](_0x452991[_0xa7d5('0x3d')][_0xa7d5('0x19')])&&_0x452991[_0xa7d5('0x3d')][_0xa7d5('0x19')]===_0xa7d5('0x5a')?_0x452991['role'][_0xa7d5('0x19')]:!_[_0xa7d5('0x1c')](_0x452991['first_name'])?_0x452991[_0xa7d5('0x49')]+'\x20'+_0x452991[_0xa7d5('0x4a')]:_0x452991[_0xa7d5('0x4a')],'id':_0x452991['id']};_0x1f91e7['Subject']=intUtil[_0xa7d5('0x5b')](_0x2b318a[_0xa7d5('0x5c')],_0x20947e,'\x20');_0x1f91e7[_0xa7d5('0x5d')]=intUtil['getString'](_0x2b318a[_0xa7d5('0x5e')],_0x20947e,'\x0a');if(_0x3e41e7[_0xa7d5('0x43')]===_0xa7d5('0x53')){_0x1f91e7[_0xa7d5('0x5f')]={'name':!_[_0xa7d5('0x1c')](_0x3e41e7['Full_Name'])?_0x3e41e7['Full_Name']:!_[_0xa7d5('0x1c')](_0x3e41e7[_0xa7d5('0x60')])?_0x3e41e7[_0xa7d5('0x60')]+'\x20'+_0x3e41e7[_0xa7d5('0x61')]:_0x3e41e7[_0xa7d5('0x61')],'id':_0x3e41e7['id']};}if(_0x3e41e7[_0xa7d5('0x43')]===_0xa7d5('0x55')){_0x1f91e7[_0xa7d5('0x62')]={'name':!_['isNil'](_0x3e41e7[_0xa7d5('0x63')])?_0x3e41e7[_0xa7d5('0x63')]:!_['isNil'](_0x3e41e7[_0xa7d5('0x60')])?_0x3e41e7[_0xa7d5('0x60')]+'\x20'+_0x3e41e7[_0xa7d5('0x61')]:_0x3e41e7['Last_Name'],'id':_0x3e41e7['id']};_0x1f91e7[_0xa7d5('0x64')]=_['startCase'](_0x3e41e7[_0xa7d5('0x43')]);}if(_0x20947e['talktime']){_0x1f91e7['Call_Duration']=moment[_0xa7d5('0x65')](parseInt(_0x20947e[_0xa7d5('0x66')])*0x3e8)[_0xa7d5('0x33')](_0xa7d5('0x67'));}else if(_0x20947e['answertime']&&_0x20947e[_0xa7d5('0x68')]){_0x1f91e7[_0xa7d5('0x69')]=moment[_0xa7d5('0x65')](moment(_0x20947e[_0xa7d5('0x68')],_0xa7d5('0x6a'))[_0xa7d5('0x6b')](moment(_0x20947e[_0xa7d5('0x6c')],_0xa7d5('0x6a'))))['format'](_0xa7d5('0x67'));}switch(_0x20947e[_0xa7d5('0x6d')]){case _0xa7d5('0x6e'):_0x1f91e7[_0xa7d5('0x6f')]=_0xa7d5('0x70');break;case'complete':case _0xa7d5('0x71'):_0x1f91e7['Call_Result']=_0xa7d5('0x72');break;case _0xa7d5('0x73'):_0x1f91e7[_0xa7d5('0x6f')]='Rejected';break;case _0xa7d5('0x74'):_0x1f91e7['Call_Result']=_0xa7d5('0x75');break;case'timeout':_0x1f91e7[_0xa7d5('0x6f')]=_0xa7d5('0x76');default:}_0x1f91e7[_0xa7d5('0x77')]=(_0x1c524c===_0xa7d5('0x78')?moment(_0x20947e[_0xa7d5('0x6c')])[_0xa7d5('0x33')](_0xa7d5('0x6a')):moment(_0x20947e[_0xa7d5('0x79')])[_0xa7d5('0x33')](_0xa7d5('0x6a')))||moment()[_0xa7d5('0x33')](_0xa7d5('0x6a'));_0x1f91e7[_0xa7d5('0x7a')]=_0x1c524c||'Inbound';_0x1f91e7=_['merge'](_0x1f91e7,getCustomFields(_0x2b318a[_0xa7d5('0x7b')],_0x20947e));return request({'method':_0xa7d5('0x44'),'uri':_0xa7d5('0x45')+_0x264d19+_0xa7d5('0x7c'),'headers':{'Authorization':_0xa7d5('0x36')+_0x4752b0},'body':{'data':[_0x1f91e7]},'json':!![]})['then'](function(_0x5b5f11){if(_0x5b5f11&&_0x5b5f11[_0xa7d5('0x42')][0x0][_0xa7d5('0x4b')]===_0xa7d5('0x7d')){logger['info'](_0xa7d5('0x7e'));return{'id':_0x5b5f11[_0xa7d5('0x42')][0x0][_0xa7d5('0x7f')]['id']};}})[_0xa7d5('0x2d')](function(_0x5d5e0b){logger[_0xa7d5('0x3b')](_0xa7d5('0x80'),_0x5d5e0b[_0xa7d5('0x30')]);console[_0xa7d5('0x4e')](_0xa7d5('0x80'),_0x5d5e0b);});}exports[_0xa7d5('0x81')]=function(_0x2a7d34,_0x12712b,_0x59adb9,_0x2062dc,_0x200136,_0x7b93bf){var _0x478946,_0x1fbdc2,_0x417c76;_0x7b93bf[_0xa7d5('0x82')]=intUtil[_0xa7d5('0x83')](_0x7b93bf[_0xa7d5('0x82')]);_0x7b93bf[_0xa7d5('0x84')]=intUtil[_0xa7d5('0x83')](_0x7b93bf[_0xa7d5('0x84')]);if(_0x200136&&_0x200136['monitor_format']){logger['info'](_0xa7d5('0x85'),_0xa7d5('0x86'));_0x12712b['recordingURL']=_0x7b93bf['serverUrl']+_0xa7d5('0x87')+_0x12712b['uniqueid']+_0xa7d5('0x88')+md5(_0x12712b['uniqueid']);}else{_0x12712b[_0xa7d5('0x89')]='';}var _0x38eed2=_0x7b93bf[_0xa7d5('0x82')]===_0xa7d5('0x8a')?'eu':_0xa7d5('0x8b');return getAccessToken(_0x7b93bf)[_0xa7d5('0x2a')](function(_0x4976be){_0x417c76=_0x4976be;return getUser(_0x417c76,_0x38eed2,_0x7b93bf,_0x2062dc[_0xa7d5('0x39')]);})[_0xa7d5('0x2a')](function(_0x449916){_0x478946=_0x449916;logger[_0xa7d5('0x3b')](_0xa7d5('0x8c'),_0x478946['id']);return getEndUser(_0x417c76,_0x38eed2,_0x7b93bf,_0x12712b[_0xa7d5('0x8d')],_0x12712b[_0xa7d5('0x8e')],_0x478946,_0x59adb9);})[_0xa7d5('0x2a')](function(_0x2c9bb0){_0x1fbdc2=_0x2c9bb0;return getCall(_0x417c76,_0x38eed2,_0x7b93bf,_0x478946,_0x1fbdc2,_0x59adb9,_0x12712b,_0xa7d5('0x8f'));})[_0xa7d5('0x2a')](function(_0x2e20a6){if(_0x2e20a6){logger[_0xa7d5('0x3b')](_0xa7d5('0x90'),_0x2e20a6['id']);logger[_0xa7d5('0x3b')]('[QUEUE]',_0xa7d5('0x91'));emit(util['format']('user:%s',_0x2062dc[_0xa7d5('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x7b93bf[_0xa7d5('0x82')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2e20a6['id']});}})[_0xa7d5('0x2d')](function(_0x2eeff9){logger[_0xa7d5('0x2e')](_0xa7d5('0x85'),JSON['stringify'](_0x2eeff9));});};exports['outbound']=function(_0xc48bf6,_0x10b1d7,_0x4c9f2d,_0x59aadf,_0x4acd24,_0x4c2153,_0x3b3a95){var _0x8432ae,_0x51d32c,_0x2f0a04;_0x4c2153[_0xa7d5('0x82')]=intUtil[_0xa7d5('0x83')](_0x4c2153['host']);_0x4c2153[_0xa7d5('0x84')]=intUtil[_0xa7d5('0x83')](_0x4c2153['serverUrl']);if(_0x3b3a95&&_0x3b3a95[_0xa7d5('0x92')]&&_0x3b3a95['recordingFormat']!==_0xa7d5('0x93')){logger[_0xa7d5('0x3b')](_0xa7d5('0x94'),_0xa7d5('0x86'));_0x10b1d7['recordingURL']=_0x4c2153[_0xa7d5('0x84')]+_0xa7d5('0x87')+_0x10b1d7[_0xa7d5('0x95')]+_0xa7d5('0x88')+md5(_0x10b1d7[_0xa7d5('0x95')]);}var _0x2af095=_0x4c2153[_0xa7d5('0x82')]===_0xa7d5('0x8a')?'eu':'com';return getAccessToken(_0x4c2153)[_0xa7d5('0x2a')](function(_0x575241){_0x2f0a04=_0x575241;return getUser(_0x2f0a04,_0x2af095,_0x4c2153,_0x59aadf[_0xa7d5('0x39')]);})['then'](function(_0x2a099c){_0x8432ae=_0x2a099c;logger[_0xa7d5('0x3b')](_0xa7d5('0x8c'),_0x8432ae['id']);return getEndUser(_0x2f0a04,_0x2af095,_0x4c2153,_0x10b1d7['destcalleridname'],_0x10b1d7[_0xa7d5('0x96')],_0x8432ae,_0x4c9f2d);})[_0xa7d5('0x2a')](function(_0x4c6af5){_0x51d32c=_0x4c6af5;return getCall(_0x2f0a04,_0x2af095,_0x4c2153,_0x8432ae,_0x51d32c,_0x4c9f2d,_0x10b1d7,'Outbound');})[_0xa7d5('0x2a')](function(_0x530f8a){if(_0x530f8a){logger['info'](_0xa7d5('0x90'),_0x530f8a['id']);logger['info'](_0xa7d5('0x94'),_0xa7d5('0x91'));emit(util[_0xa7d5('0x33')](_0xa7d5('0x97'),_0x59aadf['name']),_0xa7d5('0x98'),{'uri':_0xa7d5('0x99')+_0x4c2153[_0xa7d5('0x82')]+_0xa7d5('0x9a')+_0x530f8a['id']});}})[_0xa7d5('0x2d')](function(_0xeb5e64){logger[_0xa7d5('0x2e')](_0xa7d5('0x94'),JSON[_0xa7d5('0xe')](_0xeb5e64));});};exports[_0xa7d5('0x9b')]=function(_0xd60091,_0x2b4668,_0x30a9cd,_0x34e0f7,_0x482227,_0x2a129a){var _0x16889b,_0x48e3db,_0x2c8bb5;_0x2a129a[_0xa7d5('0x82')]=intUtil[_0xa7d5('0x83')](_0x2a129a['host']);_0x2a129a[_0xa7d5('0x84')]=intUtil['stripTrailingSlash'](_0x2a129a['serverUrl']);if(_0x482227&&_0x482227[_0xa7d5('0x9c')]){logger[_0xa7d5('0x3b')]('['+_0x2b4668[_0xa7d5('0x6d')][_0xa7d5('0x9d')]()+']','Recording\x20is\x20enabled!');_0x2b4668[_0xa7d5('0x89')]=_0x2a129a['serverUrl']+_0xa7d5('0x87')+_0x2b4668[_0xa7d5('0x95')]+_0xa7d5('0x88')+md5(_0x2b4668[_0xa7d5('0x95')]);}else{_0x2b4668[_0xa7d5('0x89')]='';}var _0x2550ce=_0x2a129a[_0xa7d5('0x82')]==='zoho.eu'?'eu':_0xa7d5('0x8b');return getAccessToken(_0x2a129a)[_0xa7d5('0x2a')](function(_0xb94e76){_0x2c8bb5=_0xb94e76;return getUser(_0x2c8bb5,_0x2550ce,_0x2a129a);})[_0xa7d5('0x2a')](function(_0x4e08cc){_0x16889b=_0x4e08cc;logger['info'](_0xa7d5('0x8c'),_0x16889b['id']);return getEndUser(_0x2c8bb5,_0x2550ce,_0x2a129a,_0x2b4668['calleridname'],_0x2b4668[_0xa7d5('0x8e')],_0x16889b,_0x30a9cd);})['then'](function(_0x54d78f){_0x48e3db=_0x54d78f;return getCall(_0x2c8bb5,_0x2550ce,_0x2a129a,_0x16889b,_0x48e3db,_0x30a9cd,_0x2b4668,_0xa7d5('0x8f'));})['then'](function(_0x1b1ba9){if(_0x1b1ba9){logger[_0xa7d5('0x3b')](_0xa7d5('0x90'),_0x1b1ba9['id']);}})[_0xa7d5('0x2d')](function(_0x354be6){logger['error']('['+_0x2b4668['lastevent'][_0xa7d5('0x9d')]()+']',JSON[_0xa7d5('0xe')](_0x354be6));});}; \ 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 0a1711a..dc45742 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 _0x4181=['error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x4181,0x16b));var _0x1418=function(_0x5d7d56,_0xe36793){_0x5d7d56=_0x5d7d56-0x0;var _0x1c3e39=_0x4181[_0x5d7d56];return _0x1c3e39;};'use strict';var util=require(_0x1418('0x0'));var sh=require('shelljs');var Mustache=require(_0x1418('0x1'));var logger=require(_0x1418('0x2'))(_0x1418('0x3'));exports[_0x1418('0x4')]=function(_0x3e0b2f,_0x3fb8e9){var _0x3bfa0b=_0x3e0b2f[_0x1418('0x5')]?_0x3e0b2f[_0x1418('0x5')]:_0x1418('0x6');var _0x5b3dae=_0x3e0b2f[_0x1418('0x7')]?Mustache[_0x1418('0x8')](_0x3e0b2f[_0x1418('0x7')],_0x3fb8e9):_0x3fb8e9;sh['exec'](_0x5b3dae,function(_0x478aad,_0x2db78c,_0x3f37be){if(_0x478aad!==0x0){logger[_0x1418('0x9')](util['format'](_0x1418('0xa'),_0x3bfa0b,_0x5b3dae,_0x478aad,_0x3f37be));}else{logger[_0x1418('0xb')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x3bfa0b,_0x5b3dae,_0x2db78c));}});}; \ No newline at end of file +var _0x2df9=['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','mustache','../../../../config/logger','trigger','data2','Script','data3','exec','error'];(function(_0x16a011,_0x4aa8f7){var _0x1a9df1=function(_0x11cd80){while(--_0x11cd80){_0x16a011['push'](_0x16a011['shift']());}};_0x1a9df1(++_0x4aa8f7);}(_0x2df9,0x79));var _0x92df=function(_0xc58097,_0x2b92bb){_0xc58097=_0xc58097-0x0;var _0x51b38d=_0x2df9[_0xc58097];return _0x51b38d;};'use strict';var util=require(_0x92df('0x0'));var sh=require('shelljs');var Mustache=require(_0x92df('0x1'));var logger=require(_0x92df('0x2'))(_0x92df('0x3'));exports['exec']=function(_0x389ec5,_0x1c1a66){var _0x40b143=_0x389ec5[_0x92df('0x4')]?_0x389ec5[_0x92df('0x4')]:_0x92df('0x5');var _0x47a01d=_0x389ec5[_0x92df('0x6')]?Mustache['render'](_0x389ec5[_0x92df('0x6')],_0x1c1a66):_0x1c1a66;sh[_0x92df('0x7')](_0x47a01d,function(_0x24546f,_0x1921a9,_0x934805){if(_0x24546f!==0x0){logger[_0x92df('0x8')](util[_0x92df('0x9')](_0x92df('0xa'),_0x40b143,_0x47a01d,_0x24546f,_0x934805));}else{logger[_0x92df('0xb')](util['format'](_0x92df('0xc'),_0x40b143,_0x47a01d,_0x1921a9));}});}; \ 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 d63cd7b..3abed64 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 _0x1618=['trigger','exec','data1','toUpperCase','render','data2','data5','headers','data6','parse','GET','DELETE','data7','stack','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','object','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x1618,0x171));var _0x8161=function(_0x4789d9,_0x3ed897){_0x4789d9=_0x4789d9-0x0;var _0x12162d=_0x1618[_0x4789d9];return _0x12162d;};'use strict';var rp=require(_0x8161('0x0'));var util=require(_0x8161('0x1'));var _=require(_0x8161('0x2'));var Mustache=require(_0x8161('0x3'));var logger=require(_0x8161('0x4'))(_0x8161('0x5'));exports[_0x8161('0x6')]=function(_0x2c5d4b,_0xb3a0cd){var _0x1dd4b0,_0x214d17;var _0x5b5678={'method':_0x2c5d4b[_0x8161('0x7')][_0x8161('0x8')](),'uri':Mustache[_0x8161('0x9')](_0x2c5d4b[_0x8161('0xa')],_0xb3a0cd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2c5d4b[_0x8161('0xb')])==='number'&&parseInt(_0x2c5d4b[_0x8161('0xb')])>=0x1&&parseInt(_0x2c5d4b[_0x8161('0xb')])<=0xa?parseInt(_0x2c5d4b['data5'])*0x3e8:0x5*0x3e8};try{_0x5b5678[_0x8161('0xc')]=_0x2c5d4b[_0x8161('0xd')]?JSON[_0x8161('0xe')](Mustache[_0x8161('0x9')](_0x2c5d4b[_0x8161('0xd')],_0xb3a0cd)):{};}catch(_0x2874ed){logger['error'](_0x2874ed['stack']);}switch(_0x2c5d4b[_0x8161('0x7')][_0x8161('0x8')]()){case _0x8161('0xf'):case _0x8161('0x10'):_0x1dd4b0=null;_0x5b5678['qs']=_0xb3a0cd;break;case'POST':case'PUT':if(_0x2c5d4b[_0x8161('0x11')]){try{_0x1dd4b0=JSON[_0x8161('0xe')](Mustache[_0x8161('0x9')](_0x2c5d4b[_0x8161('0x11')],_0xb3a0cd));_0x5b5678['body']=_0x1dd4b0;}catch(_0x3b70d4){logger['error'](_0x3b70d4[_0x8161('0x12')]);logger[_0x8161('0x13')](_0x8161('0x14'));}}else{_0x1dd4b0=_0xb3a0cd;_0x5b5678[_0x8161('0x15')]=_0x1dd4b0;}break;}logger['info'](util['format'](_0x8161('0x16'),_0x2c5d4b[_0x8161('0x7')],_0x2c5d4b[_0x8161('0xa')],JSON[_0x8161('0x17')](_0x5b5678)));rp(_0x5b5678)[_0x8161('0x18')](function(_0x3f3aa0){_0x1dd4b0=!_['isNil'](_0x1dd4b0)?',\x20request\x20body:\x20'+_0x1dd4b0:'';_0x214d17=typeof _0x3f3aa0[_0x8161('0x15')]===_0x8161('0x19')?JSON[_0x8161('0x17')](_0x3f3aa0[_0x8161('0x15')]):_0x3f3aa0[_0x8161('0x15')];logger[_0x8161('0x1a')](util[_0x8161('0x1b')](_0x8161('0x1c'),_0x2c5d4b[_0x8161('0x7')],_0x2c5d4b[_0x8161('0xa')],_0x3f3aa0[_0x8161('0x1d')],_0x214d17));})[_0x8161('0x1e')](function(_0x8bf7af){logger[_0x8161('0x13')](util[_0x8161('0x1b')](_0x8161('0x1f'),_0x2c5d4b[_0x8161('0x7')],_0x2c5d4b['data2'],_0x8bf7af[_0x8161('0x1d')],_0x8bf7af[_0x8161('0x20')],_0x8bf7af[_0x8161('0x21')]));});}; \ No newline at end of file +var _0x3bd7=['exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','stack','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x3bd7,0xc7));var _0x73bd=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x3bd7[_0x285800];return _0x4b809e;};'use strict';var rp=require(_0x73bd('0x0'));var util=require(_0x73bd('0x1'));var _=require('lodash');var Mustache=require(_0x73bd('0x2'));var logger=require(_0x73bd('0x3'))(_0x73bd('0x4'));exports[_0x73bd('0x5')]=function(_0x5bf870,_0x589584){var _0x3b3bfa,_0x3b1b87;var _0x269599={'method':_0x5bf870[_0x73bd('0x6')][_0x73bd('0x7')](),'uri':Mustache[_0x73bd('0x8')](_0x5bf870[_0x73bd('0x9')],_0x589584),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5bf870[_0x73bd('0xa')])===_0x73bd('0xb')&&parseInt(_0x5bf870[_0x73bd('0xa')])>=0x1&&parseInt(_0x5bf870[_0x73bd('0xa')])<=0xa?parseInt(_0x5bf870[_0x73bd('0xa')])*0x3e8:0x5*0x3e8};try{_0x269599[_0x73bd('0xc')]=_0x5bf870[_0x73bd('0xd')]?JSON[_0x73bd('0xe')](Mustache[_0x73bd('0x8')](_0x5bf870[_0x73bd('0xd')],_0x589584)):{};}catch(_0x3a5c35){logger['error'](_0x3a5c35[_0x73bd('0xf')]);}switch(_0x5bf870[_0x73bd('0x6')][_0x73bd('0x7')]()){case'GET':case'DELETE':_0x3b3bfa=null;_0x269599['qs']=_0x589584;break;case'POST':case'PUT':if(_0x5bf870[_0x73bd('0x10')]){try{_0x3b3bfa=JSON[_0x73bd('0xe')](Mustache[_0x73bd('0x8')](_0x5bf870[_0x73bd('0x10')],_0x589584));_0x269599[_0x73bd('0x11')]=_0x3b3bfa;}catch(_0x3ec4ac){logger[_0x73bd('0x12')](_0x3ec4ac['stack']);logger[_0x73bd('0x12')](_0x73bd('0x13'));}}else{_0x3b3bfa=_0x589584;_0x269599[_0x73bd('0x11')]=_0x3b3bfa;}break;}logger['info'](util[_0x73bd('0x14')](_0x73bd('0x15'),_0x5bf870[_0x73bd('0x6')],_0x5bf870['data2'],JSON['stringify'](_0x269599)));rp(_0x269599)[_0x73bd('0x16')](function(_0x595b6a){_0x3b3bfa=!_[_0x73bd('0x17')](_0x3b3bfa)?_0x73bd('0x18')+_0x3b3bfa:'';_0x3b1b87=typeof _0x595b6a[_0x73bd('0x11')]===_0x73bd('0x19')?JSON[_0x73bd('0x1a')](_0x595b6a[_0x73bd('0x11')]):_0x595b6a['body'];logger[_0x73bd('0x1b')](util[_0x73bd('0x14')](_0x73bd('0x1c'),_0x5bf870[_0x73bd('0x6')],_0x5bf870[_0x73bd('0x9')],_0x595b6a[_0x73bd('0x1d')],_0x3b1b87));})[_0x73bd('0x1e')](function(_0x5ca7a1){logger[_0x73bd('0x12')](util[_0x73bd('0x14')](_0x73bd('0x1f'),_0x5bf870[_0x73bd('0x6')],_0x5bf870[_0x73bd('0x9')],_0x5ca7a1[_0x73bd('0x1d')],_0x5ca7a1[_0x73bd('0x20')],_0x5ca7a1[_0x73bd('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 6052460..8e1e039 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 _0x618e=['catch','jayson/promise','../../config/logger','routing','http','Request','request','debug','rpc','error','message','result'];(function(_0x40aea6,_0x3f5c1a){var _0x1aed83=function(_0x363547){while(--_0x363547){_0x40aea6['push'](_0x40aea6['shift']());}};_0x1aed83(++_0x3f5c1a);}(_0x618e,0xfd));var _0xe618=function(_0x834637,_0x1b0ce9){_0x834637=_0x834637-0x0;var _0x44d3a0=_0x618e[_0x834637];return _0x44d3a0;};'use strict';var jayson=require(_0xe618('0x0'));var BPromise=require('bluebird');var logger=require(_0xe618('0x1'))(_0xe618('0x2'));var client=jayson['client'][_0xe618('0x3')]({'port':0x2329});client[_0xe618('0x4')]=function(_0x48b695,_0x37f73e){return new BPromise(function(_0x945935,_0x4f2241){return client[_0xe618('0x5')](_0x48b695,_0x37f73e)['then'](function(_0x26dfd5){logger[_0xe618('0x6')](_0xe618('0x7'),_0xe618('0x2'),_0x48b695,_0x37f73e,_0x26dfd5);if(_0x26dfd5['error']){logger[_0xe618('0x8')](_0xe618('0x7'),'routing',_0x48b695,_0x26dfd5[_0xe618('0x8')][_0xe618('0x9')],_0x37f73e);return _0x4f2241(_0x26dfd5[_0xe618('0x8')][_0xe618('0x9')]);}else{return _0x945935(_0x26dfd5[_0xe618('0xa')]);}})[_0xe618('0xb')](function(_0x3f6d43){logger[_0xe618('0x8')]('rpc',_0xe618('0x2'),_0x48b695,_0x3f6d43,_0x37f73e);return _0x4f2241(_0x3f6d43);});});};module['exports']=client; \ No newline at end of file +var _0xc8a4=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error','message','result','catch'];(function(_0x5a508c,_0x58e1be){var _0x2440e8=function(_0x4ded32){while(--_0x4ded32){_0x5a508c['push'](_0x5a508c['shift']());}};_0x2440e8(++_0x58e1be);}(_0xc8a4,0x1b2));var _0x4c8a=function(_0xfd8fb8,_0x2c0591){_0xfd8fb8=_0xfd8fb8-0x0;var _0x49dd95=_0xc8a4[_0xfd8fb8];return _0x49dd95;};'use strict';var jayson=require(_0x4c8a('0x0'));var BPromise=require(_0x4c8a('0x1'));var logger=require(_0x4c8a('0x2'))(_0x4c8a('0x3'));var client=jayson[_0x4c8a('0x4')][_0x4c8a('0x5')]({'port':0x2329});client[_0x4c8a('0x6')]=function(_0x2dd192,_0x1c71bb){return new BPromise(function(_0x3dd654,_0x5521d9){return client[_0x4c8a('0x7')](_0x2dd192,_0x1c71bb)[_0x4c8a('0x8')](function(_0x54052f){logger['debug'](_0x4c8a('0x9'),_0x4c8a('0x3'),_0x2dd192,_0x1c71bb,_0x54052f);if(_0x54052f[_0x4c8a('0xa')]){logger['error'](_0x4c8a('0x9'),_0x4c8a('0x3'),_0x2dd192,_0x54052f[_0x4c8a('0xa')][_0x4c8a('0xb')],_0x1c71bb);return _0x5521d9(_0x54052f[_0x4c8a('0xa')][_0x4c8a('0xb')]);}else{return _0x3dd654(_0x54052f[_0x4c8a('0xc')]);}})[_0x4c8a('0xd')](function(_0x11da54){logger[_0x4c8a('0xa')]('rpc',_0x4c8a('0x3'),_0x2dd192,_0x11da54,_0x1c71bb);return _0x5521d9(_0x11da54);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ec7cfb4..7a11cdc 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 _0x45b9=['getMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then'];(function(_0x57236f,_0x10d604){var _0x2397b5=function(_0x1784ed){while(--_0x1784ed){_0x57236f['push'](_0x57236f['shift']());}};_0x2397b5(++_0x10d604);}(_0x45b9,0x78));var _0x945b=function(_0x925812,_0x2ee730){_0x925812=_0x925812-0x0;var _0x375ae9=_0x45b9[_0x925812];return _0x375ae9;};'use strict';var server=require(_0x945b('0x0'));var Realtime=require(_0x945b('0x1'));var EmailChannel=require(_0x945b('0x2'));var mailAccount=require(_0x945b('0x3'));var setting=require(_0x945b('0x4'));var logger=require('../../config/logger')(_0x945b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x945b('0x6')]()[_0x945b('0x7')](mailAccount[_0x945b('0x8')]())['then'](realtime['initMailAccounts']())[_0x945b('0x7')](function(){email[_0x945b('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x945b('0xa')](realtime,email)[_0x945b('0x7')](function(){return initRealtime();})[_0x945b('0x7')](function(){return setting[_0x945b('0xb')]();})[_0x945b('0x7')](function(_0x2ef3a4){return setInterval(initRealtime,_0x2ef3a4[_0x945b('0xc')]*0x3e8);})[_0x945b('0xd')](function(_0xd3fdb1){logger[_0x945b('0xe')](_0x945b('0xf'),_0xd3fdb1);});}main(); \ No newline at end of file +var _0x9f6a=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','Email\x20service\x20initialization','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x2cd0f0,_0x33b799){var _0x181e45=function(_0x3575a7){while(--_0x3575a7){_0x2cd0f0['push'](_0x2cd0f0['shift']());}};_0x181e45(++_0x33b799);}(_0x9f6a,0x1d0));var _0xa9f6=function(_0x2ec5b9,_0x56e0a3){_0x2ec5b9=_0x2ec5b9-0x0;var _0x10dcea=_0x9f6a[_0x2ec5b9];return _0x10dcea;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xa9f6('0x0'));var setting=require(_0xa9f6('0x1'));var logger=require(_0xa9f6('0x2'))(_0xa9f6('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xa9f6('0x4')](mailAccount[_0xa9f6('0x5')]())[_0xa9f6('0x4')](realtime[_0xa9f6('0x6')]())['then'](function(){email[_0xa9f6('0x7')](realtime[_0xa9f6('0x8')]);return realtime;});}function main(){return server[_0xa9f6('0x9')](realtime,email)[_0xa9f6('0x4')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x7f371f){return setInterval(initRealtime,_0x7f371f[_0xa9f6('0xa')]*0x3e8);})[_0xa9f6('0xb')](function(_0xe9070d){logger['error'](_0xa9f6('0xc'),_0xe9070d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 86b3a73..27f8048 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 _0x6b62=['./imap','../rpc/mailAccount','start\x20email\x20channel','smtp','prototype','emit','mailAccounts','name','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','provider','custom','service','hasOwnProperty','imapAccounts','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','info','lastName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter'];(function(_0x4effce,_0x3c20f1){var _0x5d97aa=function(_0x24921a){while(--_0x24921a){_0x4effce['push'](_0x4effce['shift']());}};_0x5d97aa(++_0x3c20f1);}(_0x6b62,0x171));var _0x26b6=function(_0x9f7328,_0x166793){_0x9f7328=_0x9f7328-0x0;var _0x54d2cb=_0x6b62[_0x9f7328];return _0x54d2cb;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x26b6('0x0'));var Redis=require(_0x26b6('0x1'));var config=require(_0x26b6('0x2'));var logger=require(_0x26b6('0x3'))(_0x26b6('0x4'));config[_0x26b6('0x5')]=_[_0x26b6('0x6')](config[_0x26b6('0x5')],{'host':_0x26b6('0x7'),'port':0x18eb});var io=require(_0x26b6('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x26b6('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x26b6('0xa'));var md5Accounts={};function EmailChannel(_0x173255){logger['info'](_0x26b6('0xb'));this['mailAccounts']=_0x173255['mailAccounts'];this['imapAccounts']={};this[_0x26b6('0xc')]=new EmailSmtp();}EmailChannel[_0x26b6('0xd')][_0x26b6('0xe')]=function(_0x33ef74){var _0x41d343=this[_0x26b6('0xf')][_0x33ef74];var _0x5d1ef3={'id':_0x41d343['id'],'name':_0x41d343[_0x26b6('0x10')],'key':_0x41d343['key'],'active':_0x41d343[_0x26b6('0x11')],'Imap':{'status':_0x41d343['Imap'][_0x26b6('0x12')],'messageStatus':_0x41d343[_0x26b6('0x13')][_0x26b6('0x14')],'total':_0x41d343[_0x26b6('0x13')][_0x26b6('0x15')]}};if(_[_0x26b6('0x16')](md5Accounts[_0x33ef74])){md5Accounts[_0x33ef74]={};}var _0x1e8f05=md5(JSON[_0x26b6('0x17')](_0x5d1ef3));if(md5Accounts[_0x33ef74]['md5']!==_0x1e8f05){md5Accounts[_0x33ef74]['md5']=_0x1e8f05;io[_0x26b6('0xe')](_0x26b6('0x18'),_0x5d1ef3);}};EmailChannel['prototype'][_0x26b6('0x19')]=function(_0x3a694d){for(var _0x3825ab in _0x3a694d){if(_0x3a694d['hasOwnProperty'](_0x3825ab)){if(_0x3a694d[_0x3825ab][_0x26b6('0x13')]&&_0x3a694d[_0x3825ab]['active']){var _0x3ddd5d=_0x3a694d[_0x3825ab][_0x26b6('0x13')];if(!_0x3ddd5d['service']&&_0x3a694d[_0x3825ab][_0x26b6('0x1a')]!==_0x26b6('0x1b'))_0x3ddd5d[_0x26b6('0x1c')]=_0x3a694d[_0x3825ab][_0x26b6('0x1a')];if(!this['imapAccounts'][_0x26b6('0x1d')](_0x3ddd5d['id'])){this[_0x26b6('0x1e')][_0x3ddd5d['id']]=new EmailImap(_0x3ddd5d,_0x3a694d[_0x3825ab][_0x26b6('0x4')]);this[_0x26b6('0x1e')][_0x3ddd5d['id']]['on']('box',this[_0x26b6('0x1f')][_0x26b6('0x20')](this,_0x3825ab));this[_0x26b6('0x1e')][_0x3ddd5d['id']]['on'](_0x26b6('0x4'),this[_0x26b6('0x21')][_0x26b6('0x20')](this,_0x3825ab));this[_0x26b6('0x1e')][_0x3ddd5d['id']]['on'](_0x26b6('0x22'),this[_0x26b6('0x23')]['bind'](this,_0x3825ab));this['imapAccounts'][_0x3ddd5d['id']]['on'](_0x26b6('0x24'),this[_0x26b6('0x25')][_0x26b6('0x20')](this,_0x3825ab));}}else{if(_[_0x26b6('0x16')](this[_0x26b6('0xf')][_0x3825ab][_0x26b6('0x13')])){this[_0x26b6('0xf')][_0x3825ab][_0x26b6('0x13')]={};}this[_0x26b6('0xf')][_0x3825ab]['Imap'][_0x26b6('0x12')]=_0x26b6('0x26');this[_0x26b6('0xf')][_0x3825ab][_0x26b6('0x13')][_0x26b6('0x14')]='';this['emit'](_0x3825ab);}}}};EmailChannel[_0x26b6('0xd')][_0x26b6('0x1f')]=function(_0x1992c4,_0xe53f){if(this[_0x26b6('0xf')][_0x1992c4]){this[_0x26b6('0xf')][_0x1992c4][_0x26b6('0x13')][_0x26b6('0x12')]=_0x26b6('0x27');this[_0x26b6('0xf')][_0x1992c4]['Imap'][_0x26b6('0x14')]=_0xe53f[_0x26b6('0x10')];if(_0xe53f[_0x26b6('0x28')]){this[_0x26b6('0xf')][_0x1992c4][_0x26b6('0x13')][_0x26b6('0x15')]=_0xe53f[_0x26b6('0x28')][_0x26b6('0x15')];}return this[_0x26b6('0xe')](_0x1992c4);}};EmailChannel[_0x26b6('0xd')]['handleImapEmail']=function(_0x57f56b,_0x160ef3){logger[_0x26b6('0x29')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x160ef3['firstName'],_0x160ef3[_0x26b6('0x2a')],_0x160ef3['from'],_0x57f56b);if(this[_0x26b6('0xf')][_0x57f56b]){return mailAccount[_0x26b6('0x2b')](_0x57f56b,_0x160ef3)[_0x26b6('0x2c')](function(_0x535d2f){if(_0x535d2f){logger[_0x26b6('0x29')]('Mail\x20accepted\x20from\x20routing');}})[_0x26b6('0x2d')](function(_0x1998c6){logger[_0x26b6('0x24')](_0x26b6('0x2e'),JSON[_0x26b6('0x17')](_0x1998c6));});}};EmailChannel['prototype'][_0x26b6('0x23')]=function(_0x2393ed){if(this[_0x26b6('0xf')][_0x2393ed]&&this[_0x26b6('0xf')][_0x2393ed][_0x26b6('0x13')]){if(this[_0x26b6('0x1e')][this['mailAccounts'][_0x2393ed][_0x26b6('0x13')]['id']]){delete this['imapAccounts'][this[_0x26b6('0xf')][_0x2393ed]['Imap']['id']];}this[_0x26b6('0xf')][_0x2393ed][_0x26b6('0x13')][_0x26b6('0x2f')]=moment();this['emit'](_0x2393ed);}};EmailChannel[_0x26b6('0xd')][_0x26b6('0x25')]=function(_0x548daa,_0x129dae){if(this['mailAccounts'][_0x548daa]){this[_0x26b6('0xf')][_0x548daa]['Imap']['status']=_0x26b6('0x24');this[_0x26b6('0xf')][_0x548daa][_0x26b6('0x13')][_0x26b6('0x14')]=_0x129dae;return this[_0x26b6('0xe')](_0x548daa);}};EmailChannel['prototype'][_0x26b6('0x30')]=function(_0x328f5f,_0x40dd05){return this['smtp'][_0x26b6('0x31')](_0x328f5f,_0x40dd05);};EmailChannel['prototype'][_0x26b6('0x32')]=function(_0x44de45){var _0x37b33c=this;if(this[_0x26b6('0xf')][_0x44de45['id']]){if(_[_0x26b6('0x16')](this['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')])){this['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')]={};}this['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')]['lastSync']=moment();return new BPromise(function(_0x387680,_0x4cbc8c){return _0x37b33c[_0x26b6('0xc')][_0x26b6('0x34')](_0x44de45)[_0x26b6('0x2c')](function(_0x270ddf){_0x37b33c[_0x26b6('0xf')][_0x44de45['id']][_0x26b6('0x33')][_0x26b6('0x12')]=_0x26b6('0x35');_0x37b33c[_0x26b6('0xf')][_0x44de45['id']]['Smtp'][_0x26b6('0x14')]='';_0x37b33c['emit'](_0x44de45['id']);_0x387680(_0x270ddf);})[_0x26b6('0x2d')](function(_0x1cf6bf){_0x37b33c[_0x26b6('0xf')][_0x44de45['id']][_0x26b6('0x33')][_0x26b6('0x12')]='error';_0x37b33c['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')][_0x26b6('0x14')]=_0x1cf6bf;_0x37b33c[_0x26b6('0xe')](_0x44de45['id']);_0x4cbc8c(_0x1cf6bf);});});}return this['smtp']['verify'](_0x44de45);};module['exports']=EmailChannel; \ No newline at end of file +var _0x0fee=['exports','moment','bluebird','md5','ioredis','../../../config/logger','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','email','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','lastSync','smtp','send','verifySmtp','Smtp','verify','then','verified'];(function(_0x1a794f,_0x41af7b){var _0x2105be=function(_0x406dcd){while(--_0x406dcd){_0x1a794f['push'](_0x1a794f['shift']());}};_0x2105be(++_0x41af7b);}(_0x0fee,0x71));var _0xe0fe=function(_0x333624,_0x3a2756){_0x333624=_0x333624-0x0;var _0x7cd99b=_0x0fee[_0x333624];return _0x7cd99b;};'use strict';var _=require('lodash');var moment=require(_0xe0fe('0x0'));var BPromise=require(_0xe0fe('0x1'));var md5=require(_0xe0fe('0x2'));var Redis=require(_0xe0fe('0x3'));var config=require('../../../config/environment');var logger=require(_0xe0fe('0x4'))('email');config[_0xe0fe('0x5')]=_[_0xe0fe('0x6')](config[_0xe0fe('0x5')],{'host':_0xe0fe('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xe0fe('0x8'));var EmailSmtp=require(_0xe0fe('0x9'));var mailAccount=require(_0xe0fe('0xa'));var md5Accounts={};function EmailChannel(_0x22db84){logger[_0xe0fe('0xb')](_0xe0fe('0xc'));this[_0xe0fe('0xd')]=_0x22db84[_0xe0fe('0xd')];this[_0xe0fe('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xe0fe('0xf')]=function(_0x4518cc){var _0x208458=this[_0xe0fe('0xd')][_0x4518cc];var _0x17f08f={'id':_0x208458['id'],'name':_0x208458['name'],'key':_0x208458['key'],'active':_0x208458[_0xe0fe('0x10')],'Imap':{'status':_0x208458[_0xe0fe('0x11')][_0xe0fe('0x12')],'messageStatus':_0x208458[_0xe0fe('0x11')][_0xe0fe('0x13')],'total':_0x208458[_0xe0fe('0x11')][_0xe0fe('0x14')]}};if(_[_0xe0fe('0x15')](md5Accounts[_0x4518cc])){md5Accounts[_0x4518cc]={};}var _0x55ad34=md5(JSON[_0xe0fe('0x16')](_0x17f08f));if(md5Accounts[_0x4518cc][_0xe0fe('0x2')]!==_0x55ad34){md5Accounts[_0x4518cc][_0xe0fe('0x2')]=_0x55ad34;io[_0xe0fe('0xf')](_0xe0fe('0x17'),_0x17f08f);}};EmailChannel[_0xe0fe('0x18')][_0xe0fe('0x19')]=function(_0x2b9942){for(var _0x17e02b in _0x2b9942){if(_0x2b9942[_0xe0fe('0x1a')](_0x17e02b)){if(_0x2b9942[_0x17e02b][_0xe0fe('0x11')]&&_0x2b9942[_0x17e02b][_0xe0fe('0x10')]){var _0x16d902=_0x2b9942[_0x17e02b]['Imap'];if(!_0x16d902[_0xe0fe('0x1b')]&&_0x2b9942[_0x17e02b][_0xe0fe('0x1c')]!==_0xe0fe('0x1d'))_0x16d902[_0xe0fe('0x1b')]=_0x2b9942[_0x17e02b][_0xe0fe('0x1c')];if(!this[_0xe0fe('0xe')][_0xe0fe('0x1a')](_0x16d902['id'])){this[_0xe0fe('0xe')][_0x16d902['id']]=new EmailImap(_0x16d902,_0x2b9942[_0x17e02b][_0xe0fe('0x1e')]);this[_0xe0fe('0xe')][_0x16d902['id']]['on'](_0xe0fe('0x1f'),this[_0xe0fe('0x20')][_0xe0fe('0x21')](this,_0x17e02b));this[_0xe0fe('0xe')][_0x16d902['id']]['on'](_0xe0fe('0x1e'),this['handleImapEmail'][_0xe0fe('0x21')](this,_0x17e02b));this[_0xe0fe('0xe')][_0x16d902['id']]['on'](_0xe0fe('0x22'),this[_0xe0fe('0x23')][_0xe0fe('0x21')](this,_0x17e02b));this['imapAccounts'][_0x16d902['id']]['on'](_0xe0fe('0x24'),this[_0xe0fe('0x25')][_0xe0fe('0x21')](this,_0x17e02b));}}else{if(_[_0xe0fe('0x15')](this['mailAccounts'][_0x17e02b][_0xe0fe('0x11')])){this['mailAccounts'][_0x17e02b][_0xe0fe('0x11')]={};}this['mailAccounts'][_0x17e02b][_0xe0fe('0x11')][_0xe0fe('0x12')]=_0xe0fe('0x26');this[_0xe0fe('0xd')][_0x17e02b][_0xe0fe('0x11')][_0xe0fe('0x13')]='';this['emit'](_0x17e02b);}}}};EmailChannel[_0xe0fe('0x18')]['handleImapBox']=function(_0x51169a,_0x2c383e){if(this[_0xe0fe('0xd')][_0x51169a]){this[_0xe0fe('0xd')][_0x51169a][_0xe0fe('0x11')]['status']='connected';this['mailAccounts'][_0x51169a][_0xe0fe('0x11')][_0xe0fe('0x13')]=_0x2c383e[_0xe0fe('0x27')];if(_0x2c383e[_0xe0fe('0x28')]){this[_0xe0fe('0xd')][_0x51169a][_0xe0fe('0x11')][_0xe0fe('0x14')]=_0x2c383e[_0xe0fe('0x28')][_0xe0fe('0x14')];}return this[_0xe0fe('0xf')](_0x51169a);}};EmailChannel[_0xe0fe('0x18')]['handleImapEmail']=function(_0x1d57a1,_0x83aee5){logger[_0xe0fe('0xb')](_0xe0fe('0x29'),_0x83aee5[_0xe0fe('0x2a')],_0x83aee5[_0xe0fe('0x2b')],_0x83aee5['from'],_0x1d57a1);if(this[_0xe0fe('0xd')][_0x1d57a1]){return mailAccount[_0xe0fe('0x2c')](_0x1d57a1,_0x83aee5)['then'](function(_0x1e49b4){if(_0x1e49b4){logger['info'](_0xe0fe('0x2d'));}})[_0xe0fe('0x2e')](function(_0xe19317){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xe0fe('0x16')](_0xe19317));});}};EmailChannel[_0xe0fe('0x18')][_0xe0fe('0x23')]=function(_0x1a8d75){if(this['mailAccounts'][_0x1a8d75]&&this[_0xe0fe('0xd')][_0x1a8d75][_0xe0fe('0x11')]){if(this[_0xe0fe('0xe')][this['mailAccounts'][_0x1a8d75][_0xe0fe('0x11')]['id']]){delete this['imapAccounts'][this[_0xe0fe('0xd')][_0x1a8d75][_0xe0fe('0x11')]['id']];}this['mailAccounts'][_0x1a8d75][_0xe0fe('0x11')][_0xe0fe('0x2f')]=moment();this[_0xe0fe('0xf')](_0x1a8d75);}};EmailChannel[_0xe0fe('0x18')][_0xe0fe('0x25')]=function(_0x19ee66,_0x31aaaa){if(this[_0xe0fe('0xd')][_0x19ee66]){this['mailAccounts'][_0x19ee66][_0xe0fe('0x11')][_0xe0fe('0x12')]=_0xe0fe('0x24');this['mailAccounts'][_0x19ee66][_0xe0fe('0x11')][_0xe0fe('0x13')]=_0x31aaaa;return this[_0xe0fe('0xf')](_0x19ee66);}};EmailChannel[_0xe0fe('0x18')]['sendMail']=function(_0x5002e2,_0x2bbae9){return this[_0xe0fe('0x30')][_0xe0fe('0x31')](_0x5002e2,_0x2bbae9);};EmailChannel[_0xe0fe('0x18')][_0xe0fe('0x32')]=function(_0x2b869a){var _0x1174bb=this;if(this['mailAccounts'][_0x2b869a['id']]){if(_['isNil'](this[_0xe0fe('0xd')][_0x2b869a['id']][_0xe0fe('0x33')])){this['mailAccounts'][_0x2b869a['id']]['Smtp']={};}this[_0xe0fe('0xd')][_0x2b869a['id']][_0xe0fe('0x33')][_0xe0fe('0x2f')]=moment();return new BPromise(function(_0x24fb49,_0xc62eb8){return _0x1174bb['smtp'][_0xe0fe('0x34')](_0x2b869a)[_0xe0fe('0x35')](function(_0x384d09){_0x1174bb[_0xe0fe('0xd')][_0x2b869a['id']][_0xe0fe('0x33')][_0xe0fe('0x12')]=_0xe0fe('0x36');_0x1174bb[_0xe0fe('0xd')][_0x2b869a['id']][_0xe0fe('0x33')][_0xe0fe('0x13')]='';_0x1174bb[_0xe0fe('0xf')](_0x2b869a['id']);_0x24fb49(_0x384d09);})[_0xe0fe('0x2e')](function(_0x5b7d5a){_0x1174bb[_0xe0fe('0xd')][_0x2b869a['id']][_0xe0fe('0x33')][_0xe0fe('0x12')]=_0xe0fe('0x24');_0x1174bb[_0xe0fe('0xd')][_0x2b869a['id']][_0xe0fe('0x33')][_0xe0fe('0x13')]=_0x5b7d5a;_0x1174bb[_0xe0fe('0xf')](_0x2b869a['id']);_0xc62eb8(_0x5b7d5a);});});}return this[_0xe0fe('0x30')]['verify'](_0x2b869a);};module[_0xe0fe('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 0abd55b..1a3559a 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 _0x7693=['mailparser','simpleParser','../../../config/logger','email','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','prototype','openBox','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','hasOwnProperty','upperFirst','exports','lodash','util','imap'];(function(_0x36bf4a,_0x13cf2f){var _0x3588c6=function(_0x459d5c){while(--_0x459d5c){_0x36bf4a['push'](_0x36bf4a['shift']());}};_0x3588c6(++_0x13cf2f);}(_0x7693,0xe1));var _0x3769=function(_0x198543,_0x365209){_0x198543=_0x198543-0x0;var _0x369029=_0x7693[_0x198543];return _0x369029;};'use strict';var _=require(_0x3769('0x0'));var util=require(_0x3769('0x1'));var Imap=require(_0x3769('0x2'));var simpleParser=require(_0x3769('0x3'))[_0x3769('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require(_0x3769('0x5'))(_0x3769('0x6'));function EmailImap(_0x9b07fe,_0x393be2){this['mailbox']=_0x9b07fe[_0x3769('0x7')];this[_0x3769('0x8')]=this[_0x3769('0x9')](_0x9b07fe,_0x393be2);this[_0x3769('0x2')]=new Imap(this['account']);this[_0x3769('0x2')][_0x3769('0xa')](_0x3769('0xb'),this['handleReady'][_0x3769('0xc')](this));this['imap']['once'](_0x3769('0xd'),this[_0x3769('0xe')][_0x3769('0xc')](this));this[_0x3769('0x2')]['on'](_0x3769('0xf'),this[_0x3769('0x10')][_0x3769('0xc')](this));this[_0x3769('0x2')][_0x3769('0x11')]();}util[_0x3769('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0x3769('0x9')]=function(_0x16de34,_0x403b5c){var _0x49a891={'connTimeout':_0x16de34[_0x3769('0x13')]?_0x16de34['connTimeout']*0x3e8:0x2710,'authTimeout':_0x16de34['authTimeout']?_0x16de34[_0x3769('0x14')]*0x3e8:0x1388};if(_0x16de34[_0x3769('0x15')]){_0x49a891[_0x3769('0x16')]=_0x16de34['user'];if(_0x16de34[_0x3769('0x17')]){_0x49a891['xoauth2']=utils[_0x3769('0x18')](_0x16de34['CloudProvider'][_0x3769('0x19')],_0x16de34[_0x3769('0x16')]);}else{_0x49a891[_0x3769('0x1a')]=_0x16de34[_0x3769('0x1a')];}}else{if(_0x16de34[_0x3769('0x1b')]){_0x49a891['user']=_0x16de34['user'];_0x49a891['password']=_0x16de34[_0x3769('0x1a')];}}_0x49a891[_0x3769('0x6')]=_0x403b5c||_0x16de34[_0x3769('0x16')]||_0x3769('0x1c');_0x49a891[_0x3769('0x1d')]=_0x16de34[_0x3769('0x1d')];_0x49a891[_0x3769('0x1e')]=_0x16de34[_0x3769('0x1e')]||0x3e1;if(_0x16de34[_0x3769('0x1f')]){_0x49a891[_0x3769('0x1f')]=!![];}else{_0x49a891[_0x3769('0x1f')]=![];_0x49a891[_0x3769('0x20')]='required';}return _0x49a891;};EmailImap[_0x3769('0x21')]['handleReady']=function(){this[_0x3769('0x2')][_0x3769('0x22')](this[_0x3769('0x7')],![],this['handleOpenBox'][_0x3769('0xc')](this));};EmailImap['prototype'][_0x3769('0x23')]=function(_0x30d80b,_0x8722de){if(_0x30d80b){this[_0x3769('0x10')](_0x30d80b,!![]);}else{this[_0x3769('0x24')]('box',_0x8722de);this['readUnseen']();}};EmailImap[_0x3769('0x21')]['handleCloseBox']=function(_0x20abc8){if(_0x20abc8){this['handleError'](_0x20abc8,!![]);}else{this['imap'][_0x3769('0xd')]();}};EmailImap[_0x3769('0x21')][_0x3769('0x25')]=function(){this['imap'][_0x3769('0x26')]([_0x3769('0x27')],this[_0x3769('0x28')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')][_0x3769('0x28')]=function(_0x612c15,_0x423dbe){if(_0x612c15){this[_0x3769('0x10')](_0x612c15,!![]);}else{if(_0x423dbe[_0x3769('0x29')]){try{var _0x1e8c41=this[_0x3769('0x2')]['fetch'](_0x423dbe,{'bodies':'','markSeen':!![]});_0x1e8c41['on']('message',this[_0x3769('0x2a')][_0x3769('0xc')](this));_0x1e8c41[_0x3769('0xa')]('error',this[_0x3769('0x2b')][_0x3769('0xc')](this));_0x1e8c41['once'](_0x3769('0xd'),this[_0x3769('0x2c')]['bind'](this));}catch(_0x1e0bb5){logger[_0x3769('0xf')](_0x1e0bb5);}}else{this[_0x3769('0x2')][_0x3769('0x2d')](!![],this[_0x3769('0x2e')][_0x3769('0xc')](this));}}};EmailImap[_0x3769('0x21')][_0x3769('0x2a')]=function(_0x36e7d6){_0x36e7d6['on'](_0x3769('0x2f'),this[_0x3769('0x30')]['bind'](this));_0x36e7d6[_0x3769('0xa')](_0x3769('0x31'),this[_0x3769('0x32')][_0x3769('0xc')](this));_0x36e7d6[_0x3769('0xa')](_0x3769('0xd'),this[_0x3769('0x33')]['bind'](this));};EmailImap[_0x3769('0x21')]['handleMessageBody']=function(_0x1ecb89){simpleParser(_0x1ecb89,{'Iconv':Iconv},this[_0x3769('0x34')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')][_0x3769('0x32')]=function(){};EmailImap[_0x3769('0x21')][_0x3769('0x33')]=function(){};EmailImap[_0x3769('0x21')][_0x3769('0x34')]=function(_0x4d95ab,_0x2e5a76){if(_0x4d95ab){logger[_0x3769('0xf')](_0x4d95ab);}else{var _0x5c9902=this;utils['parser'](this['account'],_0x2e5a76,function(_0x42b0b8){_0x5c9902[_0x3769('0x24')](_0x3769('0x6'),_0x42b0b8);});}};EmailImap[_0x3769('0x21')][_0x3769('0x2c')]=function(){this[_0x3769('0x2')][_0x3769('0x2d')](!![],this[_0x3769('0x2e')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')]['handleFetchError']=function(_0x21e29b){this[_0x3769('0x10')](_0x21e29b);this[_0x3769('0x2')][_0x3769('0x2d')](!![],this[_0x3769('0x2e')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')][_0x3769('0xe')]=function(){this['emit']('end');};EmailImap['prototype'][_0x3769('0x10')]=function(_0x28d467,_0xd50dfb){logger['error'](_0x3769('0x10'),this[_0x3769('0x8')][_0x3769('0x6')],JSON[_0x3769('0x35')](_0x28d467));var _0x15387d='';if(_0x28d467){if(_0x28d467['textCode']){_0x15387d=_0x28d467['textCode'];}else{for(var _0x1f4a9c in _0x28d467){if(_0x28d467[_0x3769('0x36')](_0x1f4a9c)){_0x15387d+=_[_0x3769('0x37')](_0x1f4a9c)+':\x20'+_0x28d467[_0x1f4a9c]+'\x0a';}}}}if(_0xd50dfb){this[_0x3769('0x2')]['end']();}else{this[_0x3769('0x24')](_0x3769('0xf'),_0x15387d);this[_0x3769('0x24')]('end');}};module[_0x3769('0x38')]=EmailImap; \ No newline at end of file +var _0x4b7e=['handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','port','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','lodash','imap','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','bind','end'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x4b7e,0x1e9));var _0xe4b7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4b7e[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xe4b7('0x0'));var util=require('util');var Imap=require(_0xe4b7('0x1'));var simpleParser=require(_0xe4b7('0x2'))[_0xe4b7('0x3')];var Iconv=require('iconv')[_0xe4b7('0x4')];var EventEmitter=require(_0xe4b7('0x5'))[_0xe4b7('0x6')];var utils=require('./utils');var logger=require(_0xe4b7('0x7'))(_0xe4b7('0x8'));function EmailImap(_0x5cfec6,_0xccaf26){this[_0xe4b7('0x9')]=_0x5cfec6[_0xe4b7('0x9')];this[_0xe4b7('0xa')]=this[_0xe4b7('0xb')](_0x5cfec6,_0xccaf26);this['imap']=new Imap(this[_0xe4b7('0xa')]);this['imap'][_0xe4b7('0xc')]('ready',this['handleReady'][_0xe4b7('0xd')](this));this[_0xe4b7('0x1')][_0xe4b7('0xc')](_0xe4b7('0xe'),this[_0xe4b7('0xf')][_0xe4b7('0xd')](this));this['imap']['on'](_0xe4b7('0x10'),this[_0xe4b7('0x11')][_0xe4b7('0xd')](this));this[_0xe4b7('0x1')][_0xe4b7('0x12')]();}util[_0xe4b7('0x13')](EmailImap,EventEmitter);EmailImap[_0xe4b7('0x14')]['getAccount']=function(_0x2d4a08,_0x24163f){var _0x345825={'connTimeout':_0x2d4a08[_0xe4b7('0x15')]?_0x2d4a08[_0xe4b7('0x15')]*0x3e8:0x2710,'authTimeout':_0x2d4a08['authTimeout']?_0x2d4a08[_0xe4b7('0x16')]*0x3e8:0x1388};if(_0x2d4a08[_0xe4b7('0x17')]){_0x345825['user']=_0x2d4a08[_0xe4b7('0x18')];if(_0x2d4a08[_0xe4b7('0x19')]){_0x345825['xoauth2']=utils[_0xe4b7('0x1a')](_0x2d4a08[_0xe4b7('0x1b')][_0xe4b7('0x1c')],_0x2d4a08[_0xe4b7('0x18')]);}else{_0x345825[_0xe4b7('0x1d')]=_0x2d4a08[_0xe4b7('0x1d')];}}else{if(_0x2d4a08[_0xe4b7('0x1e')]){_0x345825[_0xe4b7('0x18')]=_0x2d4a08[_0xe4b7('0x18')];_0x345825[_0xe4b7('0x1d')]=_0x2d4a08[_0xe4b7('0x1d')];}}_0x345825[_0xe4b7('0x8')]=_0x24163f||_0x2d4a08['user']||_0xe4b7('0x1f');_0x345825['host']=_0x2d4a08['host'];_0x345825[_0xe4b7('0x20')]=_0x2d4a08[_0xe4b7('0x20')]||0x3e1;if(_0x2d4a08[_0xe4b7('0x21')]){_0x345825['tls']=!![];}else{_0x345825[_0xe4b7('0x21')]=![];_0x345825[_0xe4b7('0x22')]=_0xe4b7('0x23');}return _0x345825;};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x24')]=function(){this[_0xe4b7('0x1')][_0xe4b7('0x25')](this[_0xe4b7('0x9')],![],this[_0xe4b7('0x26')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x56698b,_0x3546b7){if(_0x56698b){this['handleError'](_0x56698b,!![]);}else{this[_0xe4b7('0x27')](_0xe4b7('0x28'),_0x3546b7);this[_0xe4b7('0x29')]();}};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x2a')]=function(_0x266467){if(_0x266467){this[_0xe4b7('0x11')](_0x266467,!![]);}else{this[_0xe4b7('0x1')][_0xe4b7('0xe')]();}};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x29')]=function(){this[_0xe4b7('0x1')][_0xe4b7('0x2b')]([_0xe4b7('0x2c')],this[_0xe4b7('0x2d')][_0xe4b7('0xd')](this));};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x2d')]=function(_0x11191c,_0x20de39){if(_0x11191c){this[_0xe4b7('0x11')](_0x11191c,!![]);}else{if(_0x20de39[_0xe4b7('0x2e')]){try{var _0x282cf7=this[_0xe4b7('0x1')][_0xe4b7('0x2f')](_0x20de39,{'bodies':'','markSeen':!![]});_0x282cf7['on'](_0xe4b7('0x30'),this[_0xe4b7('0x31')][_0xe4b7('0xd')](this));_0x282cf7[_0xe4b7('0xc')](_0xe4b7('0x10'),this[_0xe4b7('0x32')][_0xe4b7('0xd')](this));_0x282cf7['once'](_0xe4b7('0xe'),this[_0xe4b7('0x33')][_0xe4b7('0xd')](this));}catch(_0x1cab05){logger['error'](_0x1cab05);}}else{this['imap'][_0xe4b7('0x34')](!![],this['handleCloseBox'][_0xe4b7('0xd')](this));}}};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x31')]=function(_0x21ba63){_0x21ba63['on'](_0xe4b7('0x35'),this[_0xe4b7('0x36')][_0xe4b7('0xd')](this));_0x21ba63[_0xe4b7('0xc')](_0xe4b7('0x37'),this[_0xe4b7('0x38')]['bind'](this));_0x21ba63[_0xe4b7('0xc')](_0xe4b7('0xe'),this[_0xe4b7('0x39')][_0xe4b7('0xd')](this));};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x36')]=function(_0xad326b){simpleParser(_0xad326b,{'Iconv':Iconv},this['handleSimpleParser'][_0xe4b7('0xd')](this));};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x38')]=function(){};EmailImap['prototype'][_0xe4b7('0x39')]=function(){};EmailImap[_0xe4b7('0x14')]['handleSimpleParser']=function(_0x5d6b18,_0x467353){if(_0x5d6b18){logger['error'](_0x5d6b18);}else{var _0x37ad9c=this;utils[_0xe4b7('0x3a')](this[_0xe4b7('0xa')],_0x467353,function(_0x50f016){_0x37ad9c[_0xe4b7('0x27')](_0xe4b7('0x8'),_0x50f016);});}};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x33')]=function(){this['imap'][_0xe4b7('0x34')](!![],this['handleCloseBox'][_0xe4b7('0xd')](this));};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x32')]=function(_0x45bd36){this[_0xe4b7('0x11')](_0x45bd36);this[_0xe4b7('0x1')]['closeBox'](!![],this[_0xe4b7('0x2a')][_0xe4b7('0xd')](this));};EmailImap['prototype'][_0xe4b7('0xf')]=function(){this[_0xe4b7('0x27')](_0xe4b7('0xe'));};EmailImap[_0xe4b7('0x14')][_0xe4b7('0x11')]=function(_0x362ba2,_0x43cb71){logger[_0xe4b7('0x10')]('handleError',this[_0xe4b7('0xa')]['email'],JSON[_0xe4b7('0x3b')](_0x362ba2));var _0x52127b='';if(_0x362ba2){if(_0x362ba2[_0xe4b7('0x3c')]){_0x52127b=_0x362ba2[_0xe4b7('0x3c')];}else{for(var _0x5ba12b in _0x362ba2){if(_0x362ba2[_0xe4b7('0x3d')](_0x5ba12b)){_0x52127b+=_[_0xe4b7('0x3e')](_0x5ba12b)+':\x20'+_0x362ba2[_0x5ba12b]+'\x0a';}}}}if(_0x43cb71){this[_0xe4b7('0x1')]['end']();}else{this[_0xe4b7('0x27')](_0xe4b7('0x10'),_0x52127b);this[_0xe4b7('0x27')](_0xe4b7('0xe'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index dce58b9..1345ad3 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 _0x3089=['exports','nodemailer','nodemailer-plugin-inline-base64','send','use','compile','sendMail','toString','prototype','createTransport','verify','Not\x20verifired'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x3089,0x1c9));var _0x9308=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x3089[_0x43d11d];return _0x38cd08;};'use strict';var nodemailer=require(_0x9308('0x0'));var inlineBase64=require(_0x9308('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x9308('0x2')]=function(_0x40c5b0,_0x33ec60){return new Promise(function(_0x143f74,_0x5d561f){var _0xc424bc=nodemailer['createTransport'](_0x40c5b0);_0xc424bc[_0x9308('0x3')](_0x9308('0x4'),inlineBase64());_0xc424bc[_0x9308('0x5')](_0x33ec60,function(_0x2a6dc1,_0x2cc7c0){if(_0x2a6dc1){_0x5d561f(_0x2a6dc1[_0x9308('0x6')]());}else{_0x143f74(_0x2cc7c0);}});});};EmailSmtp[_0x9308('0x7')]['verify']=function(_0x469766){return new Promise(function(_0x50c985,_0x251def){var _0x1fcb74=nodemailer[_0x9308('0x8')](_0x469766);_0x1fcb74[_0x9308('0x9')](function(_0x287dd3,_0x548e52){if(_0x287dd3){_0x251def(_0x287dd3[_0x9308('0x6')]());}else{if(_0x548e52){_0x50c985(_0x548e52);}else{_0x251def(_0x9308('0xa'));}}});});};module[_0x9308('0xb')]=EmailSmtp; \ No newline at end of file +var _0x64fe=['verify','Not\x20verifired','prototype','send','createTransport','use','sendMail','toString'];(function(_0x4d80ab,_0x43cf4a){var _0x2c3fc1=function(_0x3b824c){while(--_0x3b824c){_0x4d80ab['push'](_0x4d80ab['shift']());}};_0x2c3fc1(++_0x43cf4a);}(_0x64fe,0x14a));var _0xe64f=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x64fe[_0x25bea7];return _0x175952;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xe64f('0x0')][_0xe64f('0x1')]=function(_0x5e30b2,_0x3d0d2c){return new Promise(function(_0x5ac7b0,_0x381922){var _0x34032c=nodemailer[_0xe64f('0x2')](_0x5e30b2);_0x34032c[_0xe64f('0x3')]('compile',inlineBase64());_0x34032c[_0xe64f('0x4')](_0x3d0d2c,function(_0x5994fc,_0x3766df){if(_0x5994fc){_0x381922(_0x5994fc[_0xe64f('0x5')]());}else{_0x5ac7b0(_0x3766df);}});});};EmailSmtp[_0xe64f('0x0')]['verify']=function(_0x1ce007){return new Promise(function(_0x14d9a7,_0x29e0b0){var _0x1022c8=nodemailer['createTransport'](_0x1ce007);_0x1022c8[_0xe64f('0x6')](function(_0x4ccc11,_0x56d53f){if(_0x4ccc11){_0x29e0b0(_0x4ccc11[_0xe64f('0x5')]());}else{if(_0x56d53f){_0x14d9a7(_0x56d53f);}else{_0x29e0b0(_0xe64f('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index bb42e3a..1f1a476 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 _0x38f6=['format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','parseBuffer','first','

Empty\x20message

','Attachments','Title','Data','user=','base64','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','name','substring','length','slice','join','Anonymous','split','pop','isEmpty','@xcally.com','test','replace','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x1d3d53[_0x638f('0xf')](0x0,-0x1)[_0x638f('0x10')]('\x20'):_0x194761[_0x638f('0xc')];}return _0x638f('0x11');}function getLastName(_0x1a44f){var _0x1801ad=_[_0x638f('0x7')](_0x1a44f[_0x638f('0x8')]);if(_0x1801ad&&_0x1801ad['name']){var _0x23d52b=_0x1801ad[_0x638f('0xc')][_0x638f('0x12')](/\s+/);return _0x23d52b[_0x638f('0xe')]>0x1?_0x23d52b[_0x638f('0x13')]():'';}return'';}function getMails(_0x2c1658,_0x53b320){var _0x1985f0='';for(var _0x3331ea=0x0;_0x3331ea<_0x53b320[_0x638f('0x8')][_0x638f('0xe')];_0x3331ea+=0x1){if(_0x53b320[_0x638f('0x8')][_0x3331ea]['address']!==_0x2c1658){if(!_[_0x638f('0x14')](_0x1985f0)){_0x1985f0+=',';}_0x1985f0+=_0x53b320['value'][_0x3331ea][_0x638f('0xc')]||_0x53b320['value'][_0x3331ea][_0x638f('0x9')]||'';_0x1985f0+='\x20<';_0x1985f0+=_0x53b320[_0x638f('0x8')][_0x3331ea][_0x638f('0x9')]?_0x53b320[_0x638f('0x8')][_0x3331ea]['address']:_0x638f('0xa')+random['generate'](0x6)+_0x638f('0x15');_0x1985f0+='>';}}return _0x1985f0;}function parseEmail(_0x56c5b9,_0x43d85d,_0x2b3b28){if(_0x43d85d['html']){var _0x5a29dc=/)<[^<]*)*<\/script>/gi;while(_0x5a29dc[_0x638f('0x16')](_0x43d85d['html'])){_0x43d85d['html']=_0x43d85d['html'][_0x638f('0x17')](_0x5a29dc,'');}if(_0x43d85d[_0x638f('0x18')][_0x638f('0x19')](_0x638f('0x1a'))){var _0x182581=[];_0x43d85d[_0x638f('0x1b')][_0x638f('0x1c')](_0x34aaab=>{_0x182581['push'](_0x34aaab[_0x638f('0x1d')]);});var _0x3fde53=/]+>/g;var _0x395116=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1653b4=_0x43d85d[_0x638f('0x18')][_0x638f('0x17')](_0x395116,_0x638f('0x1e'));var _0x32ad23=_0x1653b4[_0x638f('0x17')](_0x3fde53,_0x638f('0x1f'));for(let _0x3d0bad=0x0;_0x3d0bad<_0x182581[_0x638f('0xe')];_0x3d0bad++){var _0x9656d9=_0x32ad23[_0x638f('0x17')](_0x638f('0x1f'),_0x638f('0x20')+_0x182581[_0x3d0bad]+_0x638f('0x21'));_0x32ad23=_0x9656d9;}_0x43d85d['html']=_0x32ad23;}_0x2b3b28['body']=_0x43d85d[_0x638f('0x18')];}else{_0x2b3b28[_0x638f('0x22')]=_0x43d85d[_0x638f('0x23')];}if(_0x2b3b28[_0x638f('0x22')]){_0x2b3b28[_0x638f('0x22')]=_0x2b3b28[_0x638f('0x22')][_0x638f('0x17')](/0x0){var _0x21bc4a=[_0x638f('0x34'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0xff9c9b=0x0;_0xff9c9b<_0x43d85d[_0x638f('0x33')]['length'];_0xff9c9b++){var _0x29058d=_[_0x638f('0x35')](_0x21bc4a,_0x43d85d[_0x638f('0x33')][_0xff9c9b]['line']);if(_0x29058d>=0x0){_0x2b3b28[_0x638f('0x36')]=!![];}}}return _0x2b3b28;}exports[_0x638f('0x37')]=function(_0x1ef059,_0x3a49ee,_0x3ffde5){var _0x43c3df={'from':getAddress(_0x3a49ee[_0x638f('0x38')]),'firstName':getFirstName(_0x3a49ee['from']),'lastName':getLastName(_0x3a49ee[_0x638f('0x38')]),'mapKey':'email','message':{'from':getMails(_0x1ef059[_0x638f('0x6')],_0x3a49ee[_0x638f('0x38')]),'to':_0x1ef059['email'],'cc':'','subject':_0x3a49ee[_0x638f('0x39')]||'','messageId':_0x3a49ee[_0x638f('0x3a')],'inReplyTo':_0x3a49ee[_0x638f('0x3b')],'sentAt':moment(_0x3a49ee[_0x638f('0x3c')])[_0x638f('0x3d')](_0x638f('0x3e')),'attach':![],'attachments':[]}};if(!_0x3a49ee[_0x638f('0x18')]&&!_0x3a49ee[_0x638f('0x23')]){var _0x18087e=_[_0x638f('0x3f')](_0x3a49ee[_0x638f('0x1b')],{'contentType':_0x638f('0x40')});if(_0x18087e[_0x638f('0xe')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3a49ee[_0x638f('0x3a')]));tnef[_0x638f('0x41')](_[_0x638f('0x42')](_0x18087e)['content'],function(_0x2c3085,_0x5425af){if(_0x5425af){_0x3a49ee['html']=_0x5425af['BodyHTML']||_0x638f('0x43');if(_0x5425af[_0x638f('0x44')]){for(var _0x13a653=0x0;_0x13a653<_0x5425af['Attachments']['length'];_0x13a653++){var _0x27e520=_0x5425af[_0x638f('0x44')][_0x13a653];_0x43c3df[_0x638f('0x26')]['attachments'][_0x638f('0x31')]({'filename':_0x27e520[_0x638f('0x45')],'content':Buffer[_0x638f('0x38')](_0x27e520[_0x638f('0x46')])});}}}_0x3ffde5(parseEmail(_0x1ef059,_0x3a49ee,_0x43c3df));});}else{_0x3a49ee['html']=_0x638f('0x43');_0x3ffde5(parseEmail(_0x1ef059,_0x3a49ee,_0x43c3df));}}else{_0x3ffde5(parseEmail(_0x1ef059,_0x3a49ee,_0x43c3df));}};exports['generateXOAuth2Token']=function(_0x9b2e43,_0x42b2f3){var _0x24fca6=[_0x638f('0x47')+(_0x42b2f3||''),'auth=Bearer\x20'+_0x9b2e43,'',''];return Buffer[_0x638f('0x38')](_0x24fca6[_0x638f('0x10')](''),'utf-8')['toString'](_0x638f('0x48'));}; \ No newline at end of file +var _0x3a30=['filename','replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','length','slice','test','html','push'];(function(_0xd67085,_0x3fbe40){var _0x4e2775=function(_0x345ba6){while(--_0x345ba6){_0xd67085['push'](_0xd67085['shift']());}};_0x4e2775(++_0x3fbe40);}(_0x3a30,0x1ce));var _0x03a3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3a30[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x03a3('0x0'));var moment=require(_0x03a3('0x1'));var random=require(_0x03a3('0x2'));var fs=require('fs');var path=require(_0x03a3('0x3'));var util=require(_0x03a3('0x4'));var tnef=require('node-tnef');var logger=require(_0x03a3('0x5'))(_0x03a3('0x6'));var config=require(_0x03a3('0x7'));function getAddress(_0x145585){var _0x42dd38=_[_0x03a3('0x8')](_0x145585[_0x03a3('0x9')]);return _0x42dd38&&_0x42dd38[_0x03a3('0xa')]?_0x42dd38[_0x03a3('0xa')]:_0x03a3('0xb')+random[_0x03a3('0xc')](0x6)+_0x03a3('0xd');}function getFirstName(_0x15c663){var _0x1d22da=_[_0x03a3('0x8')](_0x15c663[_0x03a3('0x9')]);if(_0x1d22da&&_0x1d22da[_0x03a3('0xe')]){if(_0x1d22da['name']==_0x1d22da[_0x03a3('0xa')]){return _0x1d22da['name'][_0x03a3('0xf')](0x0,_0x1d22da[_0x03a3('0xe')]['indexOf']('@'));}var _0x52f3ee=_0x1d22da[_0x03a3('0xe')]['split'](/\s+/);return _0x52f3ee[_0x03a3('0x10')]>0x1?_0x52f3ee[_0x03a3('0x11')](0x0,-0x1)['join']('\x20'):_0x1d22da[_0x03a3('0xe')];}return'Anonymous';}function getLastName(_0x199f95){var _0x567823=_[_0x03a3('0x8')](_0x199f95['value']);if(_0x567823&&_0x567823[_0x03a3('0xe')]){var _0x9e7374=_0x567823[_0x03a3('0xe')]['split'](/\s+/);return _0x9e7374[_0x03a3('0x10')]>0x1?_0x9e7374['pop']():'';}return'';}function getMails(_0x3de9dd,_0x3c6ecd){var _0x232068='';for(var _0x1712a4=0x0;_0x1712a4<_0x3c6ecd[_0x03a3('0x9')][_0x03a3('0x10')];_0x1712a4+=0x1){if(_0x3c6ecd['value'][_0x1712a4][_0x03a3('0xa')]!==_0x3de9dd){if(!_['isEmpty'](_0x232068)){_0x232068+=',';}_0x232068+=_0x3c6ecd[_0x03a3('0x9')][_0x1712a4][_0x03a3('0xe')]||_0x3c6ecd[_0x03a3('0x9')][_0x1712a4][_0x03a3('0xa')]||'';_0x232068+='\x20<';_0x232068+=_0x3c6ecd['value'][_0x1712a4][_0x03a3('0xa')]?_0x3c6ecd[_0x03a3('0x9')][_0x1712a4][_0x03a3('0xa')]:_0x03a3('0xb')+random[_0x03a3('0xc')](0x6)+_0x03a3('0xd');_0x232068+='>';}}return _0x232068;}function parseEmail(_0x42f7af,_0xf8456,_0x491932){if(_0xf8456['html']){var _0x3ff690=/)<[^<]*)*<\/script>/gi;while(_0x3ff690[_0x03a3('0x12')](_0xf8456['html'])){_0xf8456[_0x03a3('0x13')]=_0xf8456[_0x03a3('0x13')]['replace'](_0x3ff690,'');}if(_0xf8456[_0x03a3('0x13')]['includes']('{_0x747f7b[_0x03a3('0x14')](_0x2ac9d9[_0x03a3('0x15')]);});var _0x1bfa60=/]+>/g;var _0x580798=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x466725=_0xf8456[_0x03a3('0x13')][_0x03a3('0x16')](_0x580798,_0x03a3('0x17'));var _0x14c153=_0x466725[_0x03a3('0x16')](_0x1bfa60,_0x03a3('0x18'));for(let _0x5c6e61=0x0;_0x5c6e61<_0x747f7b[_0x03a3('0x10')];_0x5c6e61++){var _0x2690bb=_0x14c153[_0x03a3('0x16')]('_IMG',_0x03a3('0x19')+_0x747f7b[_0x5c6e61]+_0x03a3('0x1a'));_0x14c153=_0x2690bb;}_0xf8456[_0x03a3('0x13')]=_0x14c153;}_0x491932[_0x03a3('0x1b')]=_0xf8456['html'];}else{_0x491932['body']=_0xf8456[_0x03a3('0x1c')];}if(_0x491932[_0x03a3('0x1b')]){_0x491932[_0x03a3('0x1b')]=_0x491932[_0x03a3('0x1b')][_0x03a3('0x16')](/0x0){var _0x557782=['Auto-Submitted:\x20auto-replied',_0x03a3('0x2f'),_0x03a3('0x30')];for(var _0xab140f=0x0;_0xab140f<_0xf8456[_0x03a3('0x2e')][_0x03a3('0x10')];_0xab140f++){var _0x25a7c7=_['indexOf'](_0x557782,_0xf8456[_0x03a3('0x2e')][_0xab140f]['line']);if(_0x25a7c7>=0x0){_0x491932[_0x03a3('0x31')]=!![];}}}return _0x491932;}exports[_0x03a3('0x32')]=function(_0x53ce43,_0x28d520,_0x2d5dfb){var _0x4eb251={'from':getAddress(_0x28d520[_0x03a3('0x33')]),'firstName':getFirstName(_0x28d520[_0x03a3('0x33')]),'lastName':getLastName(_0x28d520[_0x03a3('0x33')]),'mapKey':'email','message':{'from':getMails(_0x53ce43[_0x03a3('0x6')],_0x28d520[_0x03a3('0x33')]),'to':_0x53ce43[_0x03a3('0x6')],'cc':'','subject':_0x28d520[_0x03a3('0x34')]||'','messageId':_0x28d520['messageId'],'inReplyTo':_0x28d520[_0x03a3('0x35')],'sentAt':moment(_0x28d520[_0x03a3('0x36')])[_0x03a3('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x28d520[_0x03a3('0x13')]&&!_0x28d520[_0x03a3('0x1c')]){var _0xcffd30=_[_0x03a3('0x37')](_0x28d520[_0x03a3('0x25')],{'contentType':'application/ms-tnef'});if(_0xcffd30[_0x03a3('0x10')]){logger['info'](util[_0x03a3('0x28')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x28d520[_0x03a3('0x38')]));tnef['parseBuffer'](_[_0x03a3('0x39')](_0xcffd30)[_0x03a3('0x2d')],function(_0x42df65,_0x1e0bd8){if(_0x1e0bd8){_0x28d520[_0x03a3('0x13')]=_0x1e0bd8[_0x03a3('0x3a')]||_0x03a3('0x3b');if(_0x1e0bd8[_0x03a3('0x3c')]){for(var _0x197d03=0x0;_0x197d03<_0x1e0bd8['Attachments'][_0x03a3('0x10')];_0x197d03++){var _0x8243a3=_0x1e0bd8[_0x03a3('0x3c')][_0x197d03];_0x4eb251[_0x03a3('0x1e')][_0x03a3('0x25')][_0x03a3('0x14')]({'filename':_0x8243a3[_0x03a3('0x3d')],'content':Buffer[_0x03a3('0x33')](_0x8243a3[_0x03a3('0x3e')])});}}}_0x2d5dfb(parseEmail(_0x53ce43,_0x28d520,_0x4eb251));});}else{_0x28d520[_0x03a3('0x13')]='

Empty\x20message

';_0x2d5dfb(parseEmail(_0x53ce43,_0x28d520,_0x4eb251));}}else{_0x2d5dfb(parseEmail(_0x53ce43,_0x28d520,_0x4eb251));}};exports[_0x03a3('0x3f')]=function(_0x59507a,_0x5e1a63){var _0xea2c24=[_0x03a3('0x40')+(_0x5e1a63||''),_0x03a3('0x41')+_0x59507a,'',''];return Buffer['from'](_0xea2c24[_0x03a3('0x2b')](''),_0x03a3('0x42'))[_0x03a3('0x43')](_0x03a3('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index daebb0c..b830176 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 _0x8edb=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x8edb,0x10d));var _0xb8ed=function(_0x38a241,_0x43d9e0){_0x38a241=_0x38a241-0x0;var _0x46bf97=_0x8edb[_0x38a241];return _0x46bf97;};'use strict';var _=require(_0xb8ed('0x0'));function MailAccount(_0x45b696){this['id']=_0x45b696['id']||0x0;this[_0xb8ed('0x1')]=_0x45b696['name']||_0xb8ed('0x2');this[_0xb8ed('0x3')]=_0x45b696[_0xb8ed('0x3')]||_0xb8ed('0x4');this[_0xb8ed('0x5')]=_0x45b696['active']||![];this[_0xb8ed('0x6')]=_0x45b696['Imap']||[];this[_0xb8ed('0x7')]=_0x45b696['Smtp']||[];}module[_0xb8ed('0x8')]=MailAccount; \ No newline at end of file +var _0xb4f5=['key','SERV','active','Imap','exports','lodash','name','Service'];(function(_0x40bcba,_0x3c136a){var _0xeb7699=function(_0x56559d){while(--_0x56559d){_0x40bcba['push'](_0x40bcba['shift']());}};_0xeb7699(++_0x3c136a);}(_0xb4f5,0x18d));var _0x5b4f=function(_0x103ff9,_0x576a4d){_0x103ff9=_0x103ff9-0x0;var _0x40693e=_0xb4f5[_0x103ff9];return _0x40693e;};'use strict';var _=require(_0x5b4f('0x0'));function MailAccount(_0x50cbb8){this['id']=_0x50cbb8['id']||0x0;this['name']=_0x50cbb8[_0x5b4f('0x1')]||_0x5b4f('0x2');this[_0x5b4f('0x3')]=_0x50cbb8[_0x5b4f('0x3')]||_0x5b4f('0x4');this[_0x5b4f('0x5')]=_0x50cbb8[_0x5b4f('0x5')]||![];this[_0x5b4f('0x6')]=_0x50cbb8[_0x5b4f('0x6')]||[];this['Smtp']=_0x50cbb8['Smtp']||[];}module[_0x5b4f('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 92e40fe..b394bd5 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 _0x4e53=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x3f889a,_0x4f6dbb){var _0x5593db=function(_0x4ee959){while(--_0x4ee959){_0x3f889a['push'](_0x3f889a['shift']());}};_0x5593db(++_0x4f6dbb);}(_0x4e53,0x1aa));var _0x34e5=function(_0x16afae,_0x56e1eb){_0x16afae=_0x16afae-0x0;var _0x231601=_0x4e53[_0x16afae];return _0x231601;};'use strict';var _=require(_0x34e5('0x0'));var MailAccount=require(_0x34e5('0x1'));var Realtime=function(){this[_0x34e5('0x2')]={};};function freeIsNotKey(_0x3c3b68,_0x2daa78,_0x4b3fe1){var _0x2482df=_[_0x34e5('0x3')](_0x3c3b68,function(_0x544dcb,_0x501c07){return _0x544dcb[_0x4b3fe1];});for(var _0x48156a in _0x2daa78){if(_0x2daa78[_0x34e5('0x4')](_0x48156a)){if(!_0x2482df[_0x48156a]){delete _0x2daa78[_0x48156a];}}}}Realtime[_0x34e5('0x5')][_0x34e5('0x6')]=function(_0x142cd9,_0x4f99e7){for(var _0x90026d in _0x4f99e7){if(_0x142cd9[_0x34e5('0x4')](_0x90026d)){_0x142cd9[_0x90026d]=_0x4f99e7[_0x90026d];}}};Realtime[_0x34e5('0x5')][_0x34e5('0x7')]=function(){var _0x51e3ca=this;return function(_0x25a149){if(_0x25a149){freeIsNotKey(_0x25a149,_0x51e3ca[_0x34e5('0x2')],'id');for(var _0x5e2672=0x0,_0x325add={},_0x1979c8={};_0x5e2672<_0x25a149['length'];_0x5e2672+=0x1){_0x325add=_0x25a149[_0x5e2672];if(_[_0x34e5('0x8')](_0x51e3ca[_0x34e5('0x2')][_0x325add['id']])){_0x51e3ca[_0x34e5('0x2')][_0x325add['id']]=new MailAccount(_0x325add);}else{_[_0x34e5('0x9')](_0x51e3ca[_0x34e5('0x2')][_0x325add['id']],_0x325add);}}}return _0x51e3ca['mailAccounts'];};};module[_0x34e5('0xa')]=Realtime; \ No newline at end of file +var _0x975c=['isUndefined','merge','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x1513fa,_0x177504){var _0x35e47f=function(_0x329791){while(--_0x329791){_0x1513fa['push'](_0x1513fa['shift']());}};_0x35e47f(++_0x177504);}(_0x975c,0xfc));var _0xc975=function(_0xed8833,_0x2a801e){_0xed8833=_0xed8833-0x0;var _0x42a79d=_0x975c[_0xed8833];return _0x42a79d;};'use strict';var _=require(_0xc975('0x0'));var MailAccount=require(_0xc975('0x1'));var Realtime=function(){this[_0xc975('0x2')]={};};function freeIsNotKey(_0xa1bd2f,_0x58efff,_0x50f7de){var _0x29b664=_['mapKeys'](_0xa1bd2f,function(_0xdba0d4,_0x34b8d0){return _0xdba0d4[_0x50f7de];});for(var _0x4c75de in _0x58efff){if(_0x58efff[_0xc975('0x3')](_0x4c75de)){if(!_0x29b664[_0x4c75de]){delete _0x58efff[_0x4c75de];}}}}Realtime[_0xc975('0x4')][_0xc975('0x5')]=function(_0x5dea75,_0x403bdf){for(var _0x27e4b8 in _0x403bdf){if(_0x5dea75[_0xc975('0x3')](_0x27e4b8)){_0x5dea75[_0x27e4b8]=_0x403bdf[_0x27e4b8];}}};Realtime[_0xc975('0x4')][_0xc975('0x6')]=function(){var _0x3607ce=this;return function(_0x457caf){if(_0x457caf){freeIsNotKey(_0x457caf,_0x3607ce[_0xc975('0x2')],'id');for(var _0x3a2a6a=0x0,_0x3d6245={},_0x55a86e={};_0x3a2a6a<_0x457caf[_0xc975('0x7')];_0x3a2a6a+=0x1){_0x3d6245=_0x457caf[_0x3a2a6a];if(_[_0xc975('0x8')](_0x3607ce['mailAccounts'][_0x3d6245['id']])){_0x3607ce[_0xc975('0x2')][_0x3d6245['id']]=new MailAccount(_0x3d6245);}else{_[_0xc975('0x9')](_0x3607ce[_0xc975('0x2')][_0x3d6245['id']],_0x3d6245);}}}return _0x3607ce[_0xc975('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 41183d3..c2b322c 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 _0x53fa=['Imap','CloudProvider','service','type','data5','MailServerOut','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','key','ListId'];(function(_0x5eca45,_0x321d2a){var _0x3ba8b5=function(_0x35e9f1){while(--_0x35e9f1){_0x5eca45['push'](_0x5eca45['shift']());}};_0x3ba8b5(++_0x321d2a);}(_0x53fa,0x1ac));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa53f('0x0'));exports[_0xa53f('0x1')]=function(){return function(){return client['Request'](_0xa53f('0x2'),{'options':{'attributes':['id',_0xa53f('0x3'),'provider','service','email','active',_0xa53f('0x4'),_0xa53f('0x5'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xa53f('0x6'),'include':[{'model':_0xa53f('0x7'),'attributes':['id','name',_0xa53f('0x8'),_0xa53f('0x9'),_0xa53f('0xa')],'as':_0xa53f('0x7')}]},{'model':_0xa53f('0xb'),'as':'Smtp','include':[{'model':_0xa53f('0x7'),'attributes':['id',_0xa53f('0x3'),'service',_0xa53f('0x9'),'data5'],'as':_0xa53f('0x7')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x5526c5,_0x4860ed){return client[_0xa53f('0xc')](_0xa53f('0xd'),{'account':{'id':_0x5526c5},'body':_0x4860ed,'log':_0xa53f('0xd')});}; \ No newline at end of file +var _0x39d2=['active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email'];(function(_0x2a2884,_0x278f10){var _0xcfeced=function(_0x34b5ad){while(--_0x34b5ad){_0x2a2884['push'](_0x2a2884['shift']());}};_0xcfeced(++_0x278f10);}(_0x39d2,0xf5));var _0x239d=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x39d2[_0x68ee8b];return _0x5148f7;};'use strict';var client=require(_0x239d('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x239d('0x1')](_0x239d('0x2'),{'options':{'attributes':['id',_0x239d('0x3'),_0x239d('0x4'),_0x239d('0x5'),_0x239d('0x6'),_0x239d('0x7'),_0x239d('0x8'),_0x239d('0x9'),_0x239d('0xa')],'raw':![],'include':[{'model':_0x239d('0xb'),'as':_0x239d('0xc'),'include':[{'model':_0x239d('0xd'),'attributes':['id','name',_0x239d('0x5'),_0x239d('0xe'),_0x239d('0xf')],'as':_0x239d('0xd')}]},{'model':_0x239d('0x10'),'as':_0x239d('0x11'),'include':[{'model':_0x239d('0xd'),'attributes':['id',_0x239d('0x3'),_0x239d('0x5'),_0x239d('0xe'),_0x239d('0xf')],'as':_0x239d('0xd')}]}]},'log':_0x239d('0x12')});};};exports[_0x239d('0x13')]=function(_0x1387c8,_0x4bc66a){return client['Request'](_0x239d('0x14'),{'account':{'id':_0x1387c8},'body':_0x4bc66a,'log':_0x239d('0x14')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 95feee4..62aa083 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 _0x2a6e=['../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x5a0714,_0x69fab5){var _0x1a16e2=function(_0x6ee137){while(--_0x6ee137){_0x5a0714['push'](_0x5a0714['shift']());}};_0x1a16e2(++_0x69fab5);}(_0x2a6e,0xcd));var _0xe2a6=function(_0x3bfd04,_0x4872bc){_0x3bfd04=_0x3bfd04-0x0;var _0x2d4a74=_0x2a6e[_0x3bfd04];return _0x2d4a74;};'use strict';var client=require(_0xe2a6('0x0'));exports[_0xe2a6('0x1')]=function(){return client[_0xe2a6('0x2')](_0xe2a6('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe2a6('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x91ae=['Request','ShowSetting','loginMailFrequency','../client','getSettings'];(function(_0x14a19e,_0x739b59){var _0x519d6a=function(_0x5f8800){while(--_0x5f8800){_0x14a19e['push'](_0x14a19e['shift']());}};_0x519d6a(++_0x739b59);}(_0x91ae,0x1ed));var _0xe91a=function(_0x5a3060,_0x452e4f){_0x5a3060=_0x5a3060-0x0;var _0x103481=_0x91ae[_0x5a3060];return _0x103481;};'use strict';var client=require(_0xe91a('0x0'));exports[_0xe91a('0x1')]=function(){return client[_0xe91a('0x2')](_0xe91a('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe91a('0x4')]},'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 9b8f77a..d5c5b36 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 c93a56b..91f1ff1 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 _0xd6f8=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','sticky-session','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','defaults','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes'];(function(_0x1a9ba5,_0x3cf983){var _0x116696=function(_0x51f895){while(--_0x51f895){_0x1a9ba5['push'](_0x1a9ba5['shift']());}};_0x116696(++_0x3cf983);}(_0xd6f8,0x139));var _0x8d6f=function(_0x163807,_0x558cfa){_0x163807=_0x163807-0x0;var _0x535b97=_0xd6f8[_0x163807];return _0x535b97;};'use strict';var _=require(_0x8d6f('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x8d6f('0x1'));var Redis=require('ioredis');var config=require(_0x8d6f('0x2'));var app=express();var server=http[_0x8d6f('0x3')](app);server[_0x8d6f('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0x8d6f('0x5')])){var socketio=require(_0x8d6f('0x6'))(server,{'transports':[_0x8d6f('0x7'),_0x8d6f('0x8')]});config['redis']=_[_0x8d6f('0x9')](config[_0x8d6f('0xa')],{'host':_0x8d6f('0xb'),'port':0x18eb});socketio['adapter'](require(_0x8d6f('0xc'))({'pubClient':new Redis(config[_0x8d6f('0xa')]),'subClient':new Redis(config[_0x8d6f('0xa')])}));require(_0x8d6f('0xd'))[_0x8d6f('0xe')]();require(_0x8d6f('0xf'))[_0x8d6f('0xe')](socketio);require('../../config/express')['default'](app);require(_0x8d6f('0x10'))[_0x8d6f('0xe')](app);}else{server[_0x8d6f('0x11')](_0x8d6f('0x12'),function(){console[_0x8d6f('0x13')](_0x8d6f('0x14'),config['port']);});}exports=module[_0x8d6f('0x15')]=app; \ No newline at end of file +var _0x19f0=['lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports'];(function(_0x1be7fd,_0x51ff5a){var _0x2f7949=function(_0x1eb3ed){while(--_0x1eb3ed){_0x1be7fd['push'](_0x1be7fd['shift']());}};_0x2f7949(++_0x51ff5a);}(_0x19f0,0x1f4));var _0x019f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x019f('0x0'));var http=require(_0x019f('0x1'));var express=require('express');var sticky=require(_0x019f('0x2'));var Redis=require(_0x019f('0x3'));var config=require(_0x019f('0x4'));var app=express();var server=http[_0x019f('0x5')](app);server[_0x019f('0x6')]=0xdbba0;if(sticky[_0x019f('0x7')](server,config['port'])){var socketio=require(_0x019f('0x8'))(server,{'transports':[_0x019f('0x9'),_0x019f('0xa')]});config[_0x019f('0xb')]=_[_0x019f('0xc')](config['redis'],{'host':_0x019f('0xd'),'port':0x18eb});socketio[_0x019f('0xe')](require(_0x019f('0xf'))({'pubClient':new Redis(config[_0x019f('0xb')]),'subClient':new Redis(config[_0x019f('0xb')])}));require(_0x019f('0x10'))[_0x019f('0x11')]();require(_0x019f('0x12'))[_0x019f('0x11')](socketio);require(_0x019f('0x13'))[_0x019f('0x11')](app);require(_0x019f('0x14'))[_0x019f('0x11')](app);}else{server['once']('listening',function(){console[_0x019f('0x15')](_0x019f('0x16'),config[_0x019f('0x17')]);});}exports=module[_0x019f('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 4c04951..7567c65 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 _0xb260=['jayson/promise','../../config/logger','routing','client','Request','request','debug','error','result','rpc','exports'];(function(_0x14f458,_0x5dd219){var _0x4ff2da=function(_0x473b86){while(--_0x473b86){_0x14f458['push'](_0x14f458['shift']());}};_0x4ff2da(++_0x5dd219);}(_0xb260,0x1ef));var _0x0b26=function(_0xf342c1,_0x527191){_0xf342c1=_0xf342c1-0x0;var _0x1ea8d8=_0xb260[_0xf342c1];return _0x1ea8d8;};'use strict';var jayson=require(_0x0b26('0x0'));var BPromise=require('bluebird');var logger=require(_0x0b26('0x1'))(_0x0b26('0x2'));var client=jayson[_0x0b26('0x3')]['http']({'port':0x2329});client[_0x0b26('0x4')]=function(_0x29f45c,_0x5243cc){return new BPromise(function(_0xa97581,_0x533b34){return client[_0x0b26('0x5')](_0x29f45c,_0x5243cc)['then'](function(_0x35d7b3){logger[_0x0b26('0x6')]('rpc',_0x0b26('0x2'),_0x29f45c,_0x5243cc,_0x35d7b3);if(_0x35d7b3[_0x0b26('0x7')]){logger[_0x0b26('0x7')]('rpc',_0x0b26('0x2'),_0x29f45c,_0x35d7b3[_0x0b26('0x7')]['message'],_0x5243cc);return _0x533b34(_0x35d7b3[_0x0b26('0x7')]['message']);}else{return _0xa97581(_0x35d7b3[_0x0b26('0x8')]);}})['catch'](function(_0x3e8817){logger[_0x0b26('0x7')](_0x0b26('0x9'),_0x0b26('0x2'),_0x29f45c,_0x3e8817,_0x5243cc);return _0x533b34(_0x3e8817);});});};module[_0x0b26('0xa')]=client; \ No newline at end of file +var _0xab58=['client','Request','request','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0xc9e89,_0x9eb884){var _0x121116=function(_0x5e6d06){while(--_0x5e6d06){_0xc9e89['push'](_0xc9e89['shift']());}};_0x121116(++_0x9eb884);}(_0xab58,0x98));var _0x8ab5=function(_0x5b88cc,_0xe6c74a){_0x5b88cc=_0x5b88cc-0x0;var _0x5f2b7b=_0xab58[_0x5b88cc];return _0x5f2b7b;};'use strict';var jayson=require(_0x8ab5('0x0'));var BPromise=require(_0x8ab5('0x1'));var logger=require(_0x8ab5('0x2'))(_0x8ab5('0x3'));var client=jayson[_0x8ab5('0x4')]['http']({'port':0x2329});client[_0x8ab5('0x5')]=function(_0x516134,_0x5c2432){return new BPromise(function(_0x272095,_0x4b166b){return client[_0x8ab5('0x6')](_0x516134,_0x5c2432)['then'](function(_0x5bcae4){logger['debug'](_0x8ab5('0x7'),_0x8ab5('0x3'),_0x516134,_0x5c2432,_0x5bcae4);if(_0x5bcae4[_0x8ab5('0x8')]){logger[_0x8ab5('0x8')](_0x8ab5('0x7'),_0x8ab5('0x3'),_0x516134,_0x5bcae4[_0x8ab5('0x8')][_0x8ab5('0x9')],_0x5c2432);return _0x4b166b(_0x5bcae4[_0x8ab5('0x8')][_0x8ab5('0x9')]);}else{return _0x272095(_0x5bcae4[_0x8ab5('0xa')]);}})[_0x8ab5('0xb')](function(_0x5f87b7){logger[_0x8ab5('0x8')]('rpc',_0x8ab5('0x3'),_0x516134,_0x5f87b7,_0x5c2432);return _0x4b166b(_0x5f87b7);});});};module[_0x8ab5('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c8dd432..50dc1e5 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 _0xd4ef=['initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues'];(function(_0x43fcb1,_0x57c618){var _0x3ac394=function(_0x33789e){while(--_0x33789e){_0x43fcb1['push'](_0x43fcb1['shift']());}};_0x3ac394(++_0x57c618);}(_0xd4ef,0x14c));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var server=require(_0xfd4e('0x0'));var Realtime=require(_0xfd4e('0x1'));var user=require(_0xfd4e('0x2'));var interval=require(_0xfd4e('0x3'));var openchannelQueue=require(_0xfd4e('0x4'));var chatQueue=require(_0xfd4e('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xfd4e('0x6'));var faxQueue=require(_0xfd4e('0x7'));var whatsappQueue=require(_0xfd4e('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xfd4e('0x9')]()[_0xfd4e('0xa')](user[_0xfd4e('0xb')]())[_0xfd4e('0xa')](realtime[_0xfd4e('0xc')]())[_0xfd4e('0xa')](interval[_0xfd4e('0xd')]())[_0xfd4e('0xa')](realtime[_0xfd4e('0xe')]())[_0xfd4e('0xa')](openchannelQueue['getOpenchannelQueues']())[_0xfd4e('0xa')](realtime[_0xfd4e('0xf')]())[_0xfd4e('0xa')](chatQueue[_0xfd4e('0x10')]())[_0xfd4e('0xa')](realtime[_0xfd4e('0x11')]())[_0xfd4e('0xa')](smsQueue[_0xfd4e('0x12')]())['then'](realtime[_0xfd4e('0x13')]())[_0xfd4e('0xa')](mailQueue[_0xfd4e('0x14')]())[_0xfd4e('0xa')](realtime['initMailQueues']())[_0xfd4e('0xa')](faxQueue[_0xfd4e('0x15')]())['then'](realtime[_0xfd4e('0x16')]())[_0xfd4e('0xa')](whatsappQueue[_0xfd4e('0x17')]())['then'](realtime[_0xfd4e('0x18')]())[_0xfd4e('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xfd4e('0xa')](function(_0x4ca467){return initRealtime();})[_0xfd4e('0xa')](function(_0x16fd74){return setInterval(initRealtime,0x1388);})[_0xfd4e('0x19')](function(_0x2013c3){console[_0xfd4e('0x1a')](_0x2013c3);});}main(); \ No newline at end of file +var _0x7061=['then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x7061,0x66));var _0x1706=function(_0x3bfd0a,_0x23ebf7){_0x3bfd0a=_0x3bfd0a-0x0;var _0x27ffe4=_0x7061[_0x3bfd0a];return _0x27ffe4;};'use strict';var BPromise=require(_0x1706('0x0'));var server=require(_0x1706('0x1'));var Realtime=require(_0x1706('0x2'));var user=require(_0x1706('0x3'));var interval=require(_0x1706('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x1706('0x5'));var smsQueue=require(_0x1706('0x6'));var mailQueue=require(_0x1706('0x7'));var faxQueue=require(_0x1706('0x8'));var whatsappQueue=require(_0x1706('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x1706('0xa')](user[_0x1706('0xb')]())[_0x1706('0xa')](realtime['initAgents']())[_0x1706('0xa')](interval[_0x1706('0xc')]())[_0x1706('0xa')](realtime[_0x1706('0xd')]())[_0x1706('0xa')](openchannelQueue[_0x1706('0xe')]())['then'](realtime['initOpenchannelQueues']())[_0x1706('0xa')](chatQueue[_0x1706('0xf')]())[_0x1706('0xa')](realtime[_0x1706('0x10')]())[_0x1706('0xa')](smsQueue[_0x1706('0x11')]())[_0x1706('0xa')](realtime[_0x1706('0x12')]())[_0x1706('0xa')](mailQueue[_0x1706('0x13')]())[_0x1706('0xa')](realtime[_0x1706('0x14')]())[_0x1706('0xa')](faxQueue[_0x1706('0x15')]())[_0x1706('0xa')](realtime[_0x1706('0x16')]())['then'](whatsappQueue[_0x1706('0x17')]())[_0x1706('0xa')](realtime[_0x1706('0x18')]())['then'](function(){return realtime;});}function main(){return server[_0x1706('0x19')](realtime)[_0x1706('0xa')](function(_0x35e2da){return initRealtime();})[_0x1706('0xa')](function(_0x16cfa1){return setInterval(initRealtime,0x1388);})[_0x1706('0x1a')](function(_0x524a6e){console[_0x1706('0x1b')](_0x524a6e);});}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 766a917..f293c60 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(_0x3a9349,_0xdb8806){var _0x2c924b=function(_0x2cbfd8){while(--_0x2cbfd8){_0x3a9349['push'](_0x3a9349['shift']());}};_0x2c924b(++_0xdb8806);}(_0x814b,0x1a2));var _0xb814=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0x814b[_0x2d2e85];return _0x3e9f5e;};'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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x94c30,_0x3416c8){var _0x159bb3=function(_0x546e3e){while(--_0x546e3e){_0x94c30['push'](_0x94c30['shift']());}};_0x159bb3(++_0x3416c8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x5fc3[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 388c857..436c8df 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 _0xf696=['SendMail','bluebird','jayson/promise','client','request','error','catch','sendMailMessage'];(function(_0x10f705,_0x41770d){var _0x2dcf50=function(_0x5b219e){while(--_0x5b219e){_0x10f705['push'](_0x10f705['shift']());}};_0x2dcf50(++_0x41770d);}(_0xf696,0x1d1));var _0x6f69=function(_0x3d4c7f,_0x225345){_0x3d4c7f=_0x3d4c7f-0x0;var _0x3bfa82=_0xf696[_0x3d4c7f];return _0x3bfa82;};'use strict';var BPromise=require(_0x6f69('0x0'));var jayson=require(_0x6f69('0x1'));var client=jayson[_0x6f69('0x2')]['http']({'port':0x232b});function request(_0x5c0958,_0x18e472){return new BPromise(function(_0x1490fb,_0x25ebdb){return client[_0x6f69('0x3')](_0x5c0958,_0x18e472)['then'](function(_0x2fae35){if(_0x2fae35[_0x6f69('0x4')]){return _0x25ebdb(_0x2fae35[_0x6f69('0x4')]['message']);}else{return _0x1490fb(_0x2fae35['result']);}})[_0x6f69('0x5')](function(_0x1df490){return _0x25ebdb(_0x1df490);});});}exports[_0x6f69('0x6')]=function(_0x2b9f63,_0x252e35){return request(_0x6f69('0x7'),{'account':_0x2b9f63,'message':_0x252e35});}; \ No newline at end of file +var _0x27cb=['http','then','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0xc8a956,_0x5c8321){var _0x1e31f0=function(_0x1736e5){while(--_0x1736e5){_0xc8a956['push'](_0xc8a956['shift']());}};_0x1e31f0(++_0x5c8321);}(_0x27cb,0x6a));var _0xb27c=function(_0x2106f8,_0x52b88b){_0x2106f8=_0x2106f8-0x0;var _0x18c0ae=_0x27cb[_0x2106f8];return _0x18c0ae;};'use strict';var BPromise=require(_0xb27c('0x0'));var jayson=require(_0xb27c('0x1'));var client=jayson['client'][_0xb27c('0x2')]({'port':0x232b});function request(_0x12add2,_0xd4da71){return new BPromise(function(_0x557bf2,_0x52c02d){return client['request'](_0x12add2,_0xd4da71)[_0xb27c('0x3')](function(_0x6474c0){if(_0x6474c0[_0xb27c('0x4')]){return _0x52c02d(_0x6474c0[_0xb27c('0x4')][_0xb27c('0x5')]);}else{return _0x557bf2(_0x6474c0[_0xb27c('0x6')]);}})['catch'](function(_0x5701be){return _0x52c02d(_0x5701be);});});}exports[_0xb27c('0x7')]=function(_0x507a8d,_0x331d99){return request(_0xb27c('0x8'),{'account':_0x507a8d,'message':_0x331d99});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 929259e..700b717 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 _0x6ce8=['StatusTime','toNumber','format','mailStatusTime','faxStatus','whatsappStatusTime','busyQueue','emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','Capacity','maxcapacity','updateRealtime','mail','chat','openchannel','whatsapp','Status'];(function(_0x2c7762,_0x1245d0){var _0x468e75=function(_0xfaff5){while(--_0xfaff5){_0x2c7762['push'](_0x2c7762['shift']());}};_0x468e75(++_0x1245d0);}(_0x6ce8,0x1b4));var _0x86ce=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x6ce8[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x86ce('0x0'));var moment=require(_0x86ce('0x1'));var md5=require(_0x86ce('0x2'));var Redis=require(_0x86ce('0x3'));var config=require(_0x86ce('0x4'));config[_0x86ce('0x5')]=_[_0x86ce('0x6')](config[_0x86ce('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x86ce('0x7'))(new Redis(config[_0x86ce('0x5')]));function Agent(_0xd147d0){this['id']=_0xd147d0['id']||0x0;this[_0x86ce('0x8')]=_0xd147d0[_0x86ce('0x8')]||'';this[_0x86ce('0x9')]=_0xd147d0[_0x86ce('0x9')]||!![];this[_0x86ce('0xa')]=_0xd147d0['voicePause']||![];this['chatPause']=_0xd147d0[_0x86ce('0xb')]||![];this[_0x86ce('0xc')]=_0xd147d0[_0x86ce('0xc')]||![];this[_0x86ce('0xd')]=_0xd147d0['faxPause']||![];this[_0x86ce('0xe')]=_0xd147d0['smsPause']||![];this[_0x86ce('0xf')]=_0xd147d0[_0x86ce('0xf')]||![];this[_0x86ce('0x10')]=_0x86ce('0x11');this[_0x86ce('0x12')]=0x0;this[_0x86ce('0x13')]=_0xd147d0['chatCapacity']||0x0;this[_0x86ce('0x14')]=0x0;this[_0x86ce('0x15')]=_0x86ce('0x11');this['mailStatusTime']=0x0;this[_0x86ce('0x16')]=_0xd147d0['mailCapacity']||0x0;this[_0x86ce('0x17')]=0x0;this['faxStatus']=_0x86ce('0x11');this[_0x86ce('0x18')]=0x0;this[_0x86ce('0x19')]=_0xd147d0[_0x86ce('0x19')]||0x0;this[_0x86ce('0x1a')]=0x0;this[_0x86ce('0x1b')]=_0x86ce('0x11');this[_0x86ce('0x1c')]=0x0;this[_0x86ce('0x1d')]=_0xd147d0['smsCapacity']||0x0;this[_0x86ce('0x1e')]=0x0;this['whatsappStatus']=_0x86ce('0x11');this['whatsappStatusTime']=0x0;this[_0x86ce('0x1f')]=_0xd147d0['whatsappCapacity']||0x0;this[_0x86ce('0x20')]=0x0;this[_0x86ce('0x21')]=_0x86ce('0x11');this[_0x86ce('0x22')]=0x0;this['openchannelCapacity']=_0xd147d0[_0x86ce('0x23')]||0x0;this[_0x86ce('0x24')]=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this[_0x86ce('0x25')]={};this[_0x86ce('0x26')]={};this[_0x86ce('0x27')]={};this[_0x86ce('0x28')]={};this[_0x86ce('0x29')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x86ce('0x2a')][_0x86ce('0x2b')]=function(_0x5d3fa7){if(this[_0x5d3fa7+'CurrentCapacity']>0x0){if(this[_0x5d3fa7+_0x86ce('0x2c')]>0x0&&this[_0x5d3fa7+'CurrentCapacity']>=this[_0x5d3fa7+_0x86ce('0x2c')]){return _0x86ce('0x2d');}else{return'working';}}else{return'idle';}};Agent[_0x86ce('0x2a')][_0x86ce('0x2e')]=function(){var _0x22d1bb=[_0x86ce('0x2f'),_0x86ce('0x30'),_0x86ce('0x31'),'fax','sms',_0x86ce('0x32')];for(var _0x41f799=0x0;_0x41f799<_0x22d1bb['length'];_0x41f799+=0x1){var _0x517eb2=this[_0x86ce('0x2b')](_0x22d1bb[_0x41f799]);if(this[_0x22d1bb[_0x41f799]+_0x86ce('0x33')]!==_0x517eb2){this[_0x22d1bb[_0x41f799]+_0x86ce('0x34')]=_[_0x86ce('0x35')](moment()[_0x86ce('0x36')]('x'));}this[_0x22d1bb[_0x41f799]+_0x86ce('0x33')]=_0x517eb2;}var _0x200175={'id':this['id'],'name':this[_0x86ce('0x8')],'online':this[_0x86ce('0x9')],'voicePause':this[_0x86ce('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x86ce('0xc')],'smsPause':this[_0x86ce('0xe')],'faxPause':this[_0x86ce('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x86ce('0x12')],'chatCapacity':this[_0x86ce('0x13')],'chatCurrentCapacity':this[_0x86ce('0x14')],'mailStatus':this[_0x86ce('0x15')],'mailStatusTime':this[_0x86ce('0x37')],'mailCapacity':this[_0x86ce('0x16')],'mailCurrentCapacity':this[_0x86ce('0x17')],'faxStatus':this[_0x86ce('0x38')],'faxStatusTime':this[_0x86ce('0x18')],'faxCapacity':this[_0x86ce('0x19')],'faxCurrentCapacity':this[_0x86ce('0x1a')],'smsStatus':this[_0x86ce('0x1b')],'smsStatusTime':this[_0x86ce('0x1c')],'smsCapacity':this[_0x86ce('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x86ce('0x39')],'whatsappCapacity':this[_0x86ce('0x1f')],'whatsappCurrentCapacity':this[_0x86ce('0x20')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x86ce('0x22')],'openchannelCapacity':this[_0x86ce('0x23')],'openchannelCurrentCapacity':this[_0x86ce('0x24')],'busy':this['busy'],'busyQueue':this[_0x86ce('0x3a')],'chatWaitingInteractions':this[_0x86ce('0x25')],'faxWaitingInteractions':this[_0x86ce('0x26')],'mailWaitingInteractions':this[_0x86ce('0x27')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x86ce('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x162837=md5(JSON['stringify'](_0x200175));if(this[_0x86ce('0x2')]!==_0x162837){this[_0x86ce('0x2')]=_0x162837;io[_0x86ce('0x3b')](_0x86ce('0x3c'),_0x200175);}};module['exports']=Agent; \ No newline at end of file +var _0x610e=['chatStatus','mailStatusTime','faxStatus','faxCapacity','openchannelStatus','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','stringify','emit','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','sms','length','getChannelStatus','StatusTime'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x610e,0x10b));var _0xe610=function(_0xfdb93b,_0x323a6a){_0xfdb93b=_0xfdb93b-0x0;var _0x4b4c4=_0x610e[_0xfdb93b];return _0x4b4c4;};'use strict';var _=require(_0xe610('0x0'));var moment=require(_0xe610('0x1'));var md5=require(_0xe610('0x2'));var Redis=require(_0xe610('0x3'));var config=require('../../../config/environment');config[_0xe610('0x4')]=_[_0xe610('0x5')](config[_0xe610('0x4')],{'host':_0xe610('0x6'),'port':0x18eb});var io=require(_0xe610('0x7'))(new Redis(config[_0xe610('0x4')]));function Agent(_0x3573d7){this['id']=_0x3573d7['id']||0x0;this[_0xe610('0x8')]=_0x3573d7[_0xe610('0x8')]||'';this[_0xe610('0x9')]=_0x3573d7['online']||!![];this[_0xe610('0xa')]=_0x3573d7[_0xe610('0xa')]||![];this[_0xe610('0xb')]=_0x3573d7['chatPause']||![];this[_0xe610('0xc')]=_0x3573d7['mailPause']||![];this[_0xe610('0xd')]=_0x3573d7[_0xe610('0xd')]||![];this[_0xe610('0xe')]=_0x3573d7['smsPause']||![];this['openchannelPause']=_0x3573d7[_0xe610('0xf')]||![];this['chatStatus']='unknown';this[_0xe610('0x10')]=0x0;this[_0xe610('0x11')]=_0x3573d7['chatCapacity']||0x0;this[_0xe610('0x12')]=0x0;this[_0xe610('0x13')]=_0xe610('0x14');this['mailStatusTime']=0x0;this[_0xe610('0x15')]=_0x3573d7[_0xe610('0x15')]||0x0;this[_0xe610('0x16')]=0x0;this['faxStatus']=_0xe610('0x14');this[_0xe610('0x17')]=0x0;this['faxCapacity']=_0x3573d7['faxCapacity']||0x0;this[_0xe610('0x18')]=0x0;this[_0xe610('0x19')]='unknown';this[_0xe610('0x1a')]=0x0;this['smsCapacity']=_0x3573d7[_0xe610('0x1b')]||0x0;this[_0xe610('0x1c')]=0x0;this[_0xe610('0x1d')]=_0xe610('0x14');this[_0xe610('0x1e')]=0x0;this[_0xe610('0x1f')]=_0x3573d7[_0xe610('0x1f')]||0x0;this[_0xe610('0x20')]=0x0;this['openchannelStatus']=_0xe610('0x14');this[_0xe610('0x21')]=0x0;this[_0xe610('0x22')]=_0x3573d7[_0xe610('0x22')]||0x0;this[_0xe610('0x23')]=0x0;this[_0xe610('0x24')]=![];this[_0xe610('0x25')]=undefined;this[_0xe610('0x2')]='';this[_0xe610('0x26')]={};this[_0xe610('0x27')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0xe610('0x28')]();}Agent[_0xe610('0x29')]['getChannelStatus']=function(_0xa0e10){if(this[_0xa0e10+_0xe610('0x2a')]>0x0){if(this[_0xa0e10+_0xe610('0x2b')]>0x0&&this[_0xa0e10+_0xe610('0x2a')]>=this[_0xa0e10+_0xe610('0x2b')]){return _0xe610('0x2c');}else{return _0xe610('0x2d');}}else{return _0xe610('0x2e');}};Agent['prototype']['updateRealtime']=function(){var _0x4fb42c=['mail',_0xe610('0x2f'),_0xe610('0x30'),'fax',_0xe610('0x31'),'whatsapp'];for(var _0x36dc68=0x0;_0x36dc68<_0x4fb42c[_0xe610('0x32')];_0x36dc68+=0x1){var _0x1b1287=this[_0xe610('0x33')](_0x4fb42c[_0x36dc68]);if(this[_0x4fb42c[_0x36dc68]+'Status']!==_0x1b1287){this[_0x4fb42c[_0x36dc68]+_0xe610('0x34')]=_['toNumber'](moment()['format']('x'));}this[_0x4fb42c[_0x36dc68]+'Status']=_0x1b1287;}var _0x14cec6={'id':this['id'],'name':this[_0xe610('0x8')],'online':this[_0xe610('0x9')],'voicePause':this[_0xe610('0xa')],'chatPause':this[_0xe610('0xb')],'mailPause':this[_0xe610('0xc')],'smsPause':this[_0xe610('0xe')],'faxPause':this[_0xe610('0xd')],'openchannelPause':this[_0xe610('0xf')],'chatStatus':this[_0xe610('0x35')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xe610('0x13')],'mailStatusTime':this[_0xe610('0x36')],'mailCapacity':this[_0xe610('0x15')],'mailCurrentCapacity':this[_0xe610('0x16')],'faxStatus':this[_0xe610('0x37')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xe610('0x38')],'faxCurrentCapacity':this[_0xe610('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xe610('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xe610('0x1c')],'whatsappStatus':this[_0xe610('0x1d')],'whatsappStatusTime':this[_0xe610('0x1e')],'whatsappCapacity':this[_0xe610('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xe610('0x39')],'openchannelStatusTime':this[_0xe610('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xe610('0x24')],'busyQueue':this[_0xe610('0x25')],'chatWaitingInteractions':this[_0xe610('0x26')],'faxWaitingInteractions':this[_0xe610('0x27')],'mailWaitingInteractions':this[_0xe610('0x3a')],'openchannelWaitingInteractions':this[_0xe610('0x3b')],'smsWaitingInteractions':this[_0xe610('0x3c')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x5e8089=md5(JSON[_0xe610('0x3d')](_0x14cec6));if(this[_0xe610('0x2')]!==_0x5e8089){this[_0xe610('0x2')]=_0x5e8089;io[_0xe610('0x3e')]('user:save',_0x14cec6);}};module[_0xe610('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 1c726b1..26c0e84 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 _0x8404=['available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','prototype','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8404,0x93));var _0x4840=function(_0x3eefcf,_0x4766c2){_0x3eefcf=_0x3eefcf-0x0;var _0x394552=_0x8404[_0x3eefcf];return _0x394552;};'use strict';var _=require(_0x4840('0x0'));var md5=require('md5');var util=require(_0x4840('0x1'));var Redis=require(_0x4840('0x2'));var config=require('../../../config/environment');config[_0x4840('0x3')]=_[_0x4840('0x4')](config[_0x4840('0x3')],{'host':_0x4840('0x5'),'port':0x18eb});var io=require(_0x4840('0x6'))(new Redis(config[_0x4840('0x3')]));function ChatQueue(_0xa931be){this['id']=_0xa931be['id']||0x0;this[_0x4840('0x7')]=_0xa931be['name']||'';this[_0x4840('0x8')]=_0xa931be['timeout']||0xa;this[_0x4840('0x9')]=_0xa931be[_0x4840('0x9')]||'beepall';this[_0x4840('0xa')]=_0xa931be[_0x4840('0xa')];this[_0x4840('0xb')]={};this[_0x4840('0xc')]=0x0;this[_0x4840('0xd')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x4840('0xe')]['updateRouting']=function(){var _0x901c9d=this[_0x4840('0xb')][_0x4840('0xf')];this[_0x4840('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x4840('0xf')]=_0x901c9d;};ChatQueue[_0x4840('0xe')][_0x4840('0x10')]=function(){this[_0x4840('0x11')]=0x0;this[_0x4840('0x12')]=0x0;for(var _0x1645b0=0x0;_0x1645b0=0x0?this[_0x4840('0x15')]:0x0;var _0x29f014={'id':this['id'],'available':this[_0x4840('0x15')],'loggedIn':this[_0x4840('0x11')],'name':this[_0x4840('0x7')],'paused':this[_0x4840('0x12')],'waiting':this['waiting']};var _0x34e810=md5(JSON[_0x4840('0x16')](_0x29f014));if(this[_0x4840('0xd')]!==_0x34e810){this[_0x4840('0xd')]=_0x34e810;io['to'](util[_0x4840('0x17')](_0x4840('0x18'),_0x29f014[_0x4840('0x7')]))[_0x4840('0x19')](_0x4840('0x1a'),_0x29f014);}};module[_0x4840('0x1b')]=ChatQueue; \ No newline at end of file +var _0xb540=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis'];(function(_0x142433,_0x43e3e4){var _0x2535c0=function(_0x2c8918){while(--_0x2c8918){_0x142433['push'](_0x142433['shift']());}};_0x2535c0(++_0x43e3e4);}(_0xb540,0x175));var _0x0b54=function(_0x1c593d,_0x27f22c){_0x1c593d=_0x1c593d-0x0;var _0x136f76=_0xb540[_0x1c593d];return _0x136f76;};'use strict';var _=require(_0x0b54('0x0'));var md5=require(_0x0b54('0x1'));var util=require(_0x0b54('0x2'));var Redis=require(_0x0b54('0x3'));var config=require(_0x0b54('0x4'));config[_0x0b54('0x5')]=_['defaults'](config[_0x0b54('0x5')],{'host':_0x0b54('0x6'),'port':0x18eb});var io=require(_0x0b54('0x7'))(new Redis(config[_0x0b54('0x5')]));function ChatQueue(_0x230d82){this['id']=_0x230d82['id']||0x0;this[_0x0b54('0x8')]=_0x230d82[_0x0b54('0x8')]||'';this[_0x0b54('0x9')]=_0x230d82[_0x0b54('0x9')]||0xa;this['strategy']=_0x230d82[_0x0b54('0xa')]||_0x0b54('0xb');this[_0x0b54('0xc')]=_0x230d82['Agents'];this['mapAgentsId']={};this[_0x0b54('0xd')]=0x0;this[_0x0b54('0x1')]='';this[_0x0b54('0xe')]();this['updateRealtime']();}ChatQueue[_0x0b54('0xf')][_0x0b54('0xe')]=function(){var _0xfb17d4=this[_0x0b54('0x10')][_0x0b54('0x11')];this[_0x0b54('0x10')]=_[_0x0b54('0x12')](this['Agents'],'id');this[_0x0b54('0x10')][_0x0b54('0x11')]=_0xfb17d4;};ChatQueue[_0x0b54('0xf')]['updateRealtime']=function(){this[_0x0b54('0x13')]=0x0;this[_0x0b54('0x14')]=0x0;for(var _0x2ecc47=0x0;_0x2ecc47=0x0?this[_0x0b54('0x18')]:0x0;var _0x39b9a0={'id':this['id'],'available':this[_0x0b54('0x18')],'loggedIn':this[_0x0b54('0x13')],'name':this[_0x0b54('0x8')],'paused':this[_0x0b54('0x14')],'waiting':this[_0x0b54('0xd')]};var _0x2f6c11=md5(JSON['stringify'](_0x39b9a0));if(this[_0x0b54('0x1')]!==_0x2f6c11){this[_0x0b54('0x1')]=_0x2f6c11;io['to'](util[_0x0b54('0x19')](_0x0b54('0x1a'),_0x39b9a0[_0x0b54('0x8')]))[_0x0b54('0x1b')](_0x0b54('0x1c'),_0x39b9a0);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 013d6e1..2033e58 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 _0x4133=['Agents','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','available','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4133,0x1ca));var _0x3413=function(_0x3009b1,_0x1ed650){_0x3009b1=_0x3009b1-0x0;var _0x433c7e=_0x4133[_0x3009b1];return _0x433c7e;};'use strict';var _=require(_0x3413('0x0'));var md5=require(_0x3413('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3413('0x2'));config[_0x3413('0x3')]=_[_0x3413('0x4')](config[_0x3413('0x3')],{'host':_0x3413('0x5'),'port':0x18eb});var io=require(_0x3413('0x6'))(new Redis(config['redis']));function FaxQueue(_0x85ead){this['id']=_0x85ead['id']||0x0;this[_0x3413('0x7')]=_0x85ead['name']||'';this[_0x3413('0x8')]=_0x85ead[_0x3413('0x8')]||0xa;this[_0x3413('0x9')]=_0x85ead[_0x3413('0x9')]||'beepall';this[_0x3413('0xa')]=_0x85ead[_0x3413('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3413('0x1')]='';this[_0x3413('0xb')]();this['updateRealtime']();}FaxQueue[_0x3413('0xc')][_0x3413('0xb')]=function(){var _0x2a6954=this[_0x3413('0xd')][_0x3413('0xe')];this[_0x3413('0xd')]=_[_0x3413('0xf')](this[_0x3413('0xa')],'id');this['mapAgentsId'][_0x3413('0xe')]=_0x2a6954;};FaxQueue[_0x3413('0xc')][_0x3413('0x10')]=function(){this[_0x3413('0x11')]=0x0;this[_0x3413('0x12')]=0x0;for(var _0x1f0b50=0x0;_0x1f0b50=0x0?this[_0x3413('0x13')]:0x0;var _0x5e9e05={'id':this['id'],'available':this[_0x3413('0x13')],'loggedIn':this[_0x3413('0x11')],'name':this[_0x3413('0x7')],'paused':this['paused'],'waiting':this[_0x3413('0x14')]};var _0x202418=md5(JSON['stringify'](_0x5e9e05));if(this[_0x3413('0x1')]!==_0x202418){this[_0x3413('0x1')]=_0x202418;io['to'](util[_0x3413('0x15')](_0x3413('0x16'),_0x5e9e05['name']))[_0x3413('0x17')](_0x3413('0x18'),_0x5e9e05);}};module[_0x3413('0x19')]=FaxQueue; \ No newline at end of file +var _0xc3aa=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0x38c863,_0x417f08){var _0x49a451=function(_0x12bfcc){while(--_0x12bfcc){_0x38c863['push'](_0x38c863['shift']());}};_0x49a451(++_0x417f08);}(_0xc3aa,0x104));var _0xac3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc3aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xac3a('0x0'));var md5=require(_0xac3a('0x1'));var util=require(_0xac3a('0x2'));var Redis=require(_0xac3a('0x3'));var config=require(_0xac3a('0x4'));config[_0xac3a('0x5')]=_['defaults'](config[_0xac3a('0x5')],{'host':_0xac3a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xac3a('0x5')]));function FaxQueue(_0x5dbc45){this['id']=_0x5dbc45['id']||0x0;this[_0xac3a('0x7')]=_0x5dbc45['name']||'';this[_0xac3a('0x8')]=_0x5dbc45[_0xac3a('0x8')]||0xa;this[_0xac3a('0x9')]=_0x5dbc45[_0xac3a('0x9')]||_0xac3a('0xa');this[_0xac3a('0xb')]=_0x5dbc45[_0xac3a('0xb')];this[_0xac3a('0xc')]={};this[_0xac3a('0xd')]=0x0;this[_0xac3a('0x1')]='';this[_0xac3a('0xe')]();this[_0xac3a('0xf')]();}FaxQueue[_0xac3a('0x10')]['updateRouting']=function(){var _0x17f10d=this[_0xac3a('0xc')]['_rr'];this[_0xac3a('0xc')]=_[_0xac3a('0x11')](this['Agents'],'id');this[_0xac3a('0xc')][_0xac3a('0x12')]=_0x17f10d;};FaxQueue[_0xac3a('0x10')][_0xac3a('0xf')]=function(){this[_0xac3a('0x13')]=0x0;this['paused']=0x0;for(var _0x4e5da6=0x0;_0x4e5da6=0x0?this['available']:0x0;var _0x2e1890={'id':this['id'],'available':this[_0xac3a('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xac3a('0x16')],'waiting':this[_0xac3a('0xd')]};var _0x3b7807=md5(JSON[_0xac3a('0x18')](_0x2e1890));if(this[_0xac3a('0x1')]!==_0x3b7807){this[_0xac3a('0x1')]=_0x3b7807;io['to'](util[_0xac3a('0x19')](_0xac3a('0x1a'),_0x2e1890[_0xac3a('0x7')]))[_0xac3a('0x1b')](_0xac3a('0x1c'),_0x2e1890);}};module[_0xac3a('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 39e5c61..da97e9a 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 _0xbad0=['exports','name','Intervals'];(function(_0xe26a5d,_0x256095){var _0x2976a3=function(_0x41c347){while(--_0x41c347){_0xe26a5d['push'](_0xe26a5d['shift']());}};_0x2976a3(++_0x256095);}(_0xbad0,0x1b7));var _0x0bad=function(_0x134dec,_0x40677b){_0x134dec=_0x134dec-0x0;var _0x2ff36a=_0xbad0[_0x134dec];return _0x2ff36a;};'use strict';function Interval(_0x1cccae){this['id']=_0x1cccae['id']||0x0;this[_0x0bad('0x0')]=_0x1cccae[_0x0bad('0x0')]||'';this[_0x0bad('0x1')]=_0x1cccae[_0x0bad('0x1')]||{};}module[_0x0bad('0x2')]=Interval; \ No newline at end of file +var _0xece6=['exports','name','Intervals'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xece6,0x82));var _0x6ece=function(_0x186591,_0x41385c){_0x186591=_0x186591-0x0;var _0x54d42d=_0xece6[_0x186591];return _0x54d42d;};'use strict';function Interval(_0x136b6e){this['id']=_0x136b6e['id']||0x0;this[_0x6ece('0x0')]=_0x136b6e[_0x6ece('0x0')]||'';this[_0x6ece('0x1')]=_0x136b6e['Intervals']||{};}module[_0x6ece('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 a76c2bf..8efc622 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 _0x6caf=['mail:queue:%s','mail_queue:save','util','ioredis','../../../config/environment','redis','defaults','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','map','_rr','prototype','length','online','mailPause','paused','available','loggedIn','name','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6caf,0x154));var _0xf6ca=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x6caf[_0x1fc122];return _0xa2cb13;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xf6ca('0x0'));var Redis=require(_0xf6ca('0x1'));var config=require(_0xf6ca('0x2'));config[_0xf6ca('0x3')]=_[_0xf6ca('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf6ca('0x3')]));function MailQueue(_0x173711){this['id']=_0x173711['id']||0x0;this['name']=_0x173711['name']||'';this[_0xf6ca('0x5')]=_0x173711['timeout']||0xa;this['strategy']=_0x173711[_0xf6ca('0x6')]||_0xf6ca('0x7');this[_0xf6ca('0x8')]=_0x173711['Agents'];this[_0xf6ca('0x9')]={};this[_0xf6ca('0xa')]=0x0;this[_0xf6ca('0xb')]='';this['updateRouting']();this[_0xf6ca('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x437070=this['mapAgentsId']['_rr'];this[_0xf6ca('0x9')]=_[_0xf6ca('0xd')](this[_0xf6ca('0x8')],'id');this[_0xf6ca('0x9')][_0xf6ca('0xe')]=_0x437070;};MailQueue[_0xf6ca('0xf')][_0xf6ca('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x243ad8=0x0;_0x243ad8=0x0?this[_0xf6ca('0x14')]:0x0;var _0x1f7606={'id':this['id'],'available':this[_0xf6ca('0x14')],'loggedIn':this[_0xf6ca('0x15')],'name':this[_0xf6ca('0x16')],'paused':this[_0xf6ca('0x13')],'waiting':this[_0xf6ca('0xa')]};var _0x19092a=md5(JSON['stringify'](_0x1f7606));if(this[_0xf6ca('0xb')]!==_0x19092a){this[_0xf6ca('0xb')]=_0x19092a;io['to'](util[_0xf6ca('0x17')](_0xf6ca('0x18'),_0x1f7606['name']))['emit'](_0xf6ca('0x19'),_0x1f7606);}};module['exports']=MailQueue; \ No newline at end of file +var _0x0229=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','stringify','md5','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x4d95a7,_0x39419c){var _0x2f65af=function(_0x5c9ea7){while(--_0x5c9ea7){_0x4d95a7['push'](_0x4d95a7['shift']());}};_0x2f65af(++_0x39419c);}(_0x0229,0x68));var _0x9022=function(_0x4d75d3,_0x20139e){_0x4d75d3=_0x4d75d3-0x0;var _0x87f7a7=_0x0229[_0x4d75d3];return _0x87f7a7;};'use strict';var _=require(_0x9022('0x0'));var md5=require('md5');var util=require(_0x9022('0x1'));var Redis=require(_0x9022('0x2'));var config=require(_0x9022('0x3'));config[_0x9022('0x4')]=_['defaults'](config[_0x9022('0x4')],{'host':_0x9022('0x5'),'port':0x18eb});var io=require(_0x9022('0x6'))(new Redis(config[_0x9022('0x4')]));function MailQueue(_0x4588a1){this['id']=_0x4588a1['id']||0x0;this[_0x9022('0x7')]=_0x4588a1[_0x9022('0x7')]||'';this[_0x9022('0x8')]=_0x4588a1[_0x9022('0x8')]||0xa;this[_0x9022('0x9')]=_0x4588a1[_0x9022('0x9')]||_0x9022('0xa');this[_0x9022('0xb')]=_0x4588a1['Agents'];this[_0x9022('0xc')]={};this[_0x9022('0xd')]=0x0;this['md5']='';this[_0x9022('0xe')]();this[_0x9022('0xf')]();}MailQueue[_0x9022('0x10')][_0x9022('0xe')]=function(){var _0x117ea3=this[_0x9022('0xc')][_0x9022('0x11')];this[_0x9022('0xc')]=_['map'](this[_0x9022('0xb')],'id');this[_0x9022('0xc')][_0x9022('0x11')]=_0x117ea3;};MailQueue['prototype'][_0x9022('0xf')]=function(){this[_0x9022('0x12')]=0x0;this[_0x9022('0x13')]=0x0;for(var _0x42d48f=0x0;_0x42d48f=0x0?this[_0x9022('0x16')]:0x0;var _0x41a283={'id':this['id'],'available':this[_0x9022('0x16')],'loggedIn':this[_0x9022('0x12')],'name':this[_0x9022('0x7')],'paused':this[_0x9022('0x13')],'waiting':this[_0x9022('0xd')]};var _0x86e990=md5(JSON[_0x9022('0x17')](_0x41a283));if(this[_0x9022('0x18')]!==_0x86e990){this['md5']=_0x86e990;io['to'](util['format'](_0x9022('0x19'),_0x41a283[_0x9022('0x7')]))[_0x9022('0x1a')](_0x9022('0x1b'),_0x41a283);}};module[_0x9022('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9c02840..8096525 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x276953,_0x59a3ea){var _0x6ecce5=function(_0x38eecf){while(--_0x38eecf){_0x276953['push'](_0x276953['shift']());}};_0x6ecce5(++_0x59a3ea);}(_0x814b,0x1a2));var _0xb814=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x814b[_0x5ca644];return _0x5c87a2;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x26e001,_0x3e0825){_0x26e001=_0x26e001-0x0;var _0x20b654=_0x7a54[_0x26e001];return _0x20b654;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 012494d..c65faf8 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 _0x702d=['name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','smsPause','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x702d,0x147));var _0xd702=function(_0x3c3beb,_0x239cf9){_0x3c3beb=_0x3c3beb-0x0;var _0x3c2b50=_0x702d[_0x3c3beb];return _0x3c2b50;};'use strict';var _=require(_0xd702('0x0'));var md5=require(_0xd702('0x1'));var util=require(_0xd702('0x2'));var Redis=require(_0xd702('0x3'));var config=require(_0xd702('0x4'));config['redis']=_[_0xd702('0x5')](config[_0xd702('0x6')],{'host':_0xd702('0x7'),'port':0x18eb});var io=require(_0xd702('0x8'))(new Redis(config['redis']));function SmsQueue(_0x432e01){this['id']=_0x432e01['id']||0x0;this['name']=_0x432e01[_0xd702('0x9')]||'';this[_0xd702('0xa')]=_0x432e01[_0xd702('0xa')]||0xa;this['strategy']=_0x432e01[_0xd702('0xb')]||'beepall';this[_0xd702('0xc')]=_0x432e01[_0xd702('0xc')];this[_0xd702('0xd')]={};this[_0xd702('0xe')]=0x0;this[_0xd702('0x1')]='';this[_0xd702('0xf')]();this[_0xd702('0x10')]();}SmsQueue[_0xd702('0x11')][_0xd702('0xf')]=function(){var _0x15a632=this['mapAgentsId']['_rr'];this[_0xd702('0xd')]=_[_0xd702('0x12')](this[_0xd702('0xc')],'id');this['mapAgentsId'][_0xd702('0x13')]=_0x15a632;};SmsQueue[_0xd702('0x11')][_0xd702('0x10')]=function(){this[_0xd702('0x14')]=0x0;this[_0xd702('0x15')]=0x0;for(var _0x181ff2=0x0;_0x181ff2=0x0?this['available']:0x0;var _0x2205de={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd702('0x14')],'name':this[_0xd702('0x9')],'paused':this[_0xd702('0x15')],'waiting':this[_0xd702('0xe')]};var _0x4cf326=md5(JSON[_0xd702('0x19')](_0x2205de));if(this[_0xd702('0x1')]!==_0x4cf326){this['md5']=_0x4cf326;io['to'](util['format']('sms:queue:%s',_0x2205de[_0xd702('0x9')]))[_0xd702('0x1a')]('sms_queue:save',_0x2205de);}};module[_0xd702('0x1b')]=SmsQueue; \ No newline at end of file +var _0xc36d=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0xc36d,0x7d));var _0xdc36=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0xc36d[_0x37ded3];return _0x51e49e;};'use strict';var _=require(_0xdc36('0x0'));var md5=require(_0xdc36('0x1'));var util=require(_0xdc36('0x2'));var Redis=require(_0xdc36('0x3'));var config=require(_0xdc36('0x4'));config[_0xdc36('0x5')]=_['defaults'](config[_0xdc36('0x5')],{'host':_0xdc36('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdc36('0x5')]));function SmsQueue(_0xbc5223){this['id']=_0xbc5223['id']||0x0;this[_0xdc36('0x7')]=_0xbc5223[_0xdc36('0x7')]||'';this[_0xdc36('0x8')]=_0xbc5223['timeout']||0xa;this[_0xdc36('0x9')]=_0xbc5223[_0xdc36('0x9')]||_0xdc36('0xa');this[_0xdc36('0xb')]=_0xbc5223['Agents'];this[_0xdc36('0xc')]={};this[_0xdc36('0xd')]=0x0;this['md5']='';this[_0xdc36('0xe')]();this[_0xdc36('0xf')]();}SmsQueue[_0xdc36('0x10')]['updateRouting']=function(){var _0x251189=this[_0xdc36('0xc')]['_rr'];this['mapAgentsId']=_[_0xdc36('0x11')](this[_0xdc36('0xb')],'id');this[_0xdc36('0xc')][_0xdc36('0x12')]=_0x251189;};SmsQueue['prototype'][_0xdc36('0xf')]=function(){this[_0xdc36('0x13')]=0x0;this[_0xdc36('0x14')]=0x0;for(var _0xae6ad3=0x0;_0xae6ad3=0x0?this[_0xdc36('0x17')]:0x0;var _0x160d70={'id':this['id'],'available':this[_0xdc36('0x17')],'loggedIn':this[_0xdc36('0x13')],'name':this[_0xdc36('0x7')],'paused':this['paused'],'waiting':this[_0xdc36('0xd')]};var _0x12d4bf=md5(JSON['stringify'](_0x160d70));if(this[_0xdc36('0x1')]!==_0x12d4bf){this[_0xdc36('0x1')]=_0x12d4bf;io['to'](util[_0xdc36('0x18')]('sms:queue:%s',_0x160d70[_0xdc36('0x7')]))[_0xdc36('0x19')]('sms_queue:save',_0x160d70);}};module[_0xdc36('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4b555c4..249d9ab 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 _0xcc38=['emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','updateRouting','mapAgentsId','_rr','map','paused','length','online','available','loggedIn','waiting','stringify','format','whatsapp:queue:%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcc38,0xeb));var _0x8cc3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcc38[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x8cc3('0x0'));var md5=require(_0x8cc3('0x1'));var util=require(_0x8cc3('0x2'));var Redis=require(_0x8cc3('0x3'));var config=require('../../../config/environment');config[_0x8cc3('0x4')]=_[_0x8cc3('0x5')](config[_0x8cc3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8cc3('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x1fb533){this['id']=_0x1fb533['id']||0x0;this[_0x8cc3('0x7')]=_0x1fb533[_0x8cc3('0x7')]||'';this[_0x8cc3('0x8')]=_0x1fb533[_0x8cc3('0x8')]||0xa;this['strategy']=_0x1fb533[_0x8cc3('0x9')]||_0x8cc3('0xa');this[_0x8cc3('0xb')]=_0x1fb533[_0x8cc3('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8cc3('0x1')]='';this['updateRouting']();this[_0x8cc3('0xc')]();}WhatsappQueue['prototype'][_0x8cc3('0xd')]=function(){var _0xd9713a=this[_0x8cc3('0xe')][_0x8cc3('0xf')];this[_0x8cc3('0xe')]=_[_0x8cc3('0x10')](this[_0x8cc3('0xb')],'id');this[_0x8cc3('0xe')]['_rr']=_0xd9713a;};WhatsappQueue['prototype'][_0x8cc3('0xc')]=function(){this['loggedIn']=0x0;this[_0x8cc3('0x11')]=0x0;for(var _0x2e8ba1=0x0;_0x2e8ba1=0x0?this[_0x8cc3('0x14')]:0x0;var _0x2108d7={'id':this['id'],'available':this[_0x8cc3('0x14')],'loggedIn':this[_0x8cc3('0x15')],'name':this[_0x8cc3('0x7')],'paused':this['paused'],'waiting':this[_0x8cc3('0x16')]};var _0x27502e=md5(JSON[_0x8cc3('0x17')](_0x2108d7));if(this[_0x8cc3('0x1')]!==_0x27502e){this[_0x8cc3('0x1')]=_0x27502e;io['to'](util[_0x8cc3('0x18')](_0x8cc3('0x19'),_0x2108d7['name']))[_0x8cc3('0x1a')](_0x8cc3('0x1b'),_0x2108d7);}};module[_0x8cc3('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xf78c=['Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf78c,0x196));var _0xcf78=function(_0x58eaec,_0x5f3f13){_0x58eaec=_0x58eaec-0x0;var _0x48910d=_0xf78c[_0x58eaec];return _0x48910d;};'use strict';var _=require(_0xcf78('0x0'));var md5=require(_0xcf78('0x1'));var util=require(_0xcf78('0x2'));var Redis=require('ioredis');var config=require(_0xcf78('0x3'));config[_0xcf78('0x4')]=_[_0xcf78('0x5')](config[_0xcf78('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xcf78('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x1e5ebc){this['id']=_0x1e5ebc['id']||0x0;this[_0xcf78('0x7')]=_0x1e5ebc[_0xcf78('0x7')]||'';this[_0xcf78('0x8')]=_0x1e5ebc[_0xcf78('0x8')]||0xa;this[_0xcf78('0x9')]=_0x1e5ebc[_0xcf78('0x9')]||'beepall';this[_0xcf78('0xa')]=_0x1e5ebc[_0xcf78('0xa')];this[_0xcf78('0xb')]={};this[_0xcf78('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xcf78('0xd')]();}WhatsappQueue[_0xcf78('0xe')]['updateRouting']=function(){var _0x4fc2f3=this[_0xcf78('0xb')][_0xcf78('0xf')];this[_0xcf78('0xb')]=_['map'](this[_0xcf78('0xa')],'id');this['mapAgentsId'][_0xcf78('0xf')]=_0x4fc2f3;};WhatsappQueue[_0xcf78('0xe')][_0xcf78('0xd')]=function(){this[_0xcf78('0x10')]=0x0;this[_0xcf78('0x11')]=0x0;for(var _0x4f5819=0x0;_0x4f5819=0x0?this[_0xcf78('0x14')]:0x0;var _0x4e0279={'id':this['id'],'available':this['available'],'loggedIn':this[_0xcf78('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xcf78('0xc')]};var _0x4d348a=md5(JSON[_0xcf78('0x15')](_0x4e0279));if(this['md5']!==_0x4d348a){this[_0xcf78('0x1')]=_0x4d348a;io['to'](util[_0xcf78('0x16')](_0xcf78('0x17'),_0x4e0279[_0xcf78('0x7')]))[_0xcf78('0x18')]('whatsapp_queue:save',_0x4e0279);}};module[_0xcf78('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b5c47be..c9802f4 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 _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(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 +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(_0x5cf05a,_0x5299d5){var _0x8fb04c=function(_0x44bdab){while(--_0x44bdab){_0x5cf05a['push'](_0x5cf05a['shift']());}};_0x8fb04c(++_0x5299d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x43f5c7,_0x118763){_0x43f5c7=_0x43f5c7-0x0;var _0x46be5f=_0xb10b[_0x43f5c7];return _0x46be5f;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7a08fe5..6620e7e 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 _0x9b38=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0xa63da5,_0x548bb5){var _0x5e5034=function(_0x1c71fa){while(--_0x1c71fa){_0xa63da5['push'](_0xa63da5['shift']());}};_0x5e5034(++_0x548bb5);}(_0x9b38,0x7f));var _0x89b3=function(_0x280707,_0x301938){_0x280707=_0x280707-0x0;var _0x2b88b7=_0x9b38[_0x280707];return _0x2b88b7;};'use strict';var client=require(_0x89b3('0x0'));exports[_0x89b3('0x1')]=function(_0x4e2392,_0x3220fe){return client['Request'](_0x89b3('0x2'),{'body':_0x3220fe,'options':{'where':{'id':_0x4e2392}},'log':'updateChatInteraction'});};exports[_0x89b3('0x3')]=function(_0x4b5c60,_0x31fd73){return client[_0x89b3('0x4')](_0x89b3('0x5'),{'body':_0x31fd73,'options':{'where':{'id':_0x4b5c60}},'log':_0x89b3('0x6')});}; \ No newline at end of file +var _0xaa89=['addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x3fbbf0,_0x27ac0b){var _0x42b947=function(_0x45fcc9){while(--_0x45fcc9){_0x3fbbf0['push'](_0x3fbbf0['shift']());}};_0x42b947(++_0x27ac0b);}(_0xaa89,0xbf));var _0x9aa8=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0xaa89[_0x26e727];return _0x563800;};'use strict';var client=require('../client');exports[_0x9aa8('0x0')]=function(_0x145f09,_0x1c1014){return client[_0x9aa8('0x1')](_0x9aa8('0x2'),{'body':_0x1c1014,'options':{'where':{'id':_0x145f09}},'log':_0x9aa8('0x3')});};exports['addTags']=function(_0x16e139,_0x1bff25){return client['Request']('AddTagsToChatInteraction',{'body':_0x1bff25,'options':{'where':{'id':_0x16e139}},'log':_0x9aa8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 20d70d0..92ac8e0 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 _0x154b=['Request','CreateChatMessage','../client','create'];(function(_0x399a25,_0x33b1fa){var _0x3f4dca=function(_0x3be0e8){while(--_0x3be0e8){_0x399a25['push'](_0x399a25['shift']());}};_0x3f4dca(++_0x33b1fa);}(_0x154b,0xc2));var _0xb154=function(_0x86972e,_0xb0955b){_0x86972e=_0x86972e-0x0;var _0x1aa424=_0x154b[_0x86972e];return _0x1aa424;};'use strict';var client=require(_0xb154('0x0'));exports[_0xb154('0x1')]=function(_0x4feb57){return client[_0xb154('0x2')](_0xb154('0x3'),{'body':_0x4feb57,'log':'createChatMessage'});}; \ No newline at end of file +var _0x2673=['CreateChatMessage','createChatMessage'];(function(_0x203265,_0x2c8156){var _0x7d13ac=function(_0x4e43cf){while(--_0x4e43cf){_0x203265['push'](_0x203265['shift']());}};_0x7d13ac(++_0x2c8156);}(_0x2673,0x94));var _0x3267=function(_0x2880d8,_0x284ded){_0x2880d8=_0x2880d8-0x0;var _0x51f5a9=_0x2673[_0x2880d8];return _0x51f5a9;};'use strict';var client=require('../client');exports['create']=function(_0xa96882){return client['Request'](_0x3267('0x0'),{'body':_0xa96882,'log':_0x3267('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 62ce410..52fb7b8 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 _0x8403=['Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8403,0x1a5));var _0x3840=function(_0x43acf9,_0xdab1a5){_0x43acf9=_0x43acf9-0x0;var _0x1534df=_0x8403[_0x43acf9];return _0x1534df;};'use strict';var client=require(_0x3840('0x0'));exports[_0x3840('0x1')]=function(){return function(){return client[_0x3840('0x2')](_0x3840('0x3'),{'options':{'raw':![],'attributes':['id',_0x3840('0x4'),_0x3840('0x5'),_0x3840('0x6')],'include':[{'model':_0x3840('0x7'),'as':_0x3840('0x8'),'attributes':['id','name',_0x3840('0x9'),_0x3840('0xa')]}]},'log':_0x3840('0x1')});};}; \ No newline at end of file +var _0x5334=['getChatQueues','Request','GetChatQueue','name','strategy','Agents','../client'];(function(_0x557493,_0xe70531){var _0x56f613=function(_0x263c0d){while(--_0x263c0d){_0x557493['push'](_0x557493['shift']());}};_0x56f613(++_0xe70531);}(_0x5334,0x84));var _0x4533=function(_0x23b746,_0x26147b){_0x23b746=_0x23b746-0x0;var _0x20e630=_0x5334[_0x23b746];return _0x20e630;};'use strict';var client=require(_0x4533('0x0'));exports[_0x4533('0x1')]=function(){return function(){return client[_0x4533('0x2')](_0x4533('0x3'),{'options':{'raw':![],'attributes':['id',_0x4533('0x4'),'timeout',_0x4533('0x5')],'include':[{'model':'User','as':_0x4533('0x6'),'attributes':['id',_0x4533('0x4'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d1d8861..956f016 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 _0xaf80=['../client','create','Request','UpdateChatQueueReport','DESC'];(function(_0x46640c,_0x4d27c5){var _0x32fb77=function(_0x2384b6){while(--_0x2384b6){_0x46640c['push'](_0x46640c['shift']());}};_0x32fb77(++_0x4d27c5);}(_0xaf80,0x1ef));var _0x0af8=function(_0x198e0d,_0x52797e){_0x198e0d=_0x198e0d-0x0;var _0x132b6b=_0xaf80[_0x198e0d];return _0x132b6b;};'use strict';var client=require(_0x0af8('0x0'));exports[_0x0af8('0x1')]=function(_0x440a0e){return client[_0x0af8('0x2')]('CreateChatQueueReport',{'body':_0x440a0e,'log':'CreateChatQueueReport'});};exports['update']=function(_0x431bc8,_0x3fba3b){return client[_0x0af8('0x2')](_0x0af8('0x3'),{'body':_0x3fba3b,'options':{'where':{'uniqueid':_0x431bc8},'order':[['id',_0x0af8('0x4')]],'limit':0x1},'log':_0x0af8('0x3')});}; \ No newline at end of file +var _0x33a1=['create','update','UpdateChatQueueReport','DESC','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33a1,0x7c));var _0x133a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33a1[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x133a('0x0'));exports[_0x133a('0x1')]=function(_0x5f43e5){return client['Request']('CreateChatQueueReport',{'body':_0x5f43e5,'log':'CreateChatQueueReport'});};exports[_0x133a('0x2')]=function(_0x212a37,_0x35db62){return client['Request'](_0x133a('0x3'),{'body':_0x35db62,'options':{'where':{'uniqueid':_0x212a37},'order':[['id',_0x133a('0x4')]],'limit':0x1},'log':_0x133a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c41e5d0..5b7f894 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(_0xe27948,_0x5bfa16){var _0x44e57b=function(_0x34654a){while(--_0x34654a){_0xe27948['push'](_0xe27948['shift']());}};_0x44e57b(++_0x5bfa16);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7a54,0x106));var _0x47a5=function(_0x1b06fe,_0x1daced){_0x1b06fe=_0x1b06fe-0x0;var _0x3f97f8=_0x7a54[_0x1b06fe];return _0x3f97f8;};'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 36bc4eb..5d1e514 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 _0x4fea=['createFaxMessage','../client','create','Request'];(function(_0x4db42e,_0x1bef76){var _0x12ae06=function(_0x3e1617){while(--_0x3e1617){_0x4db42e['push'](_0x4db42e['shift']());}};_0x12ae06(++_0x1bef76);}(_0x4fea,0x91));var _0xa4fe=function(_0x4f9483,_0x13b7b6){_0x4f9483=_0x4f9483-0x0;var _0x49de02=_0x4fea[_0x4f9483];return _0x49de02;};'use strict';var client=require(_0xa4fe('0x0'));exports[_0xa4fe('0x1')]=function(_0x55eedd){return client[_0xa4fe('0x2')]('CreateFaxMessage',{'body':_0x55eedd,'log':_0xa4fe('0x3')});}; \ No newline at end of file +var _0x9ea6=['Request','createFaxMessage','../client','create'];(function(_0xa84dee,_0x5e6c46){var _0x2864db=function(_0x3688df){while(--_0x3688df){_0xa84dee['push'](_0xa84dee['shift']());}};_0x2864db(++_0x5e6c46);}(_0x9ea6,0x1e2));var _0x69ea=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9ea6[_0x199572];return _0x13cfa3;};'use strict';var client=require(_0x69ea('0x0'));exports[_0x69ea('0x1')]=function(_0x38b320){return client[_0x69ea('0x2')]('CreateFaxMessage',{'body':_0x38b320,'log':_0x69ea('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8240e00..1e1a0a0 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 _0x95f1=['Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x57cdc2,_0x82646a){var _0x55f940=function(_0x20c3f6){while(--_0x20c3f6){_0x57cdc2['push'](_0x57cdc2['shift']());}};_0x55f940(++_0x82646a);}(_0x95f1,0x1bb));var _0x195f=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x95f1[_0x710815];return _0x5b3b89;};'use strict';var client=require('../client');exports[_0x195f('0x0')]=function(){return function(){return client[_0x195f('0x1')](_0x195f('0x2'),{'options':{'raw':![],'attributes':['id',_0x195f('0x3'),_0x195f('0x4'),_0x195f('0x5')],'include':[{'model':_0x195f('0x6'),'as':_0x195f('0x7'),'attributes':['id',_0x195f('0x3'),_0x195f('0x8'),_0x195f('0x9')]}]},'log':_0x195f('0x0')});};}; \ No newline at end of file +var _0xa24c=['GetFaxQueue','name','timeout','online','faxPause','../client','getFaxQueues'];(function(_0x1a5741,_0x5466b5){var _0x78dde1=function(_0x4a8d87){while(--_0x4a8d87){_0x1a5741['push'](_0x1a5741['shift']());}};_0x78dde1(++_0x5466b5);}(_0xa24c,0x67));var _0xca24=function(_0xfc2c79,_0x395c2d){_0xfc2c79=_0xfc2c79-0x0;var _0x246a09=_0xa24c[_0xfc2c79];return _0x246a09;};'use strict';var client=require(_0xca24('0x0'));exports[_0xca24('0x1')]=function(){return function(){return client['Request'](_0xca24('0x2'),{'options':{'raw':![],'attributes':['id',_0xca24('0x3'),_0xca24('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xca24('0x3'),_0xca24('0x5'),_0xca24('0x6')]}]},'log':_0xca24('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index dc2b271..7380f14 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 _0x5256=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x2d03e2,_0x1f9224){var _0x9af5b1=function(_0x39e8e5){while(--_0x39e8e5){_0x2d03e2['push'](_0x2d03e2['shift']());}};_0x9af5b1(++_0x1f9224);}(_0x5256,0x13d));var _0x6525=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x5256[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0x6525('0x0'));exports[_0x6525('0x1')]=function(_0x5b6f76){return client[_0x6525('0x2')](_0x6525('0x3'),{'body':_0x5b6f76,'log':'CreateFaxQueueReport'});};exports[_0x6525('0x4')]=function(_0x27a83e,_0x618f58){return client['Request'](_0x6525('0x5'),{'body':_0x618f58,'options':{'where':{'uniqueid':_0x27a83e},'order':[['id',_0x6525('0x6')]],'limit':0x1},'log':_0x6525('0x5')});}; \ No newline at end of file +var _0x3daf=['DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x57279e,_0x1d1b9a){var _0x240a2e=function(_0x249aa6){while(--_0x249aa6){_0x57279e['push'](_0x57279e['shift']());}};_0x240a2e(++_0x1d1b9a);}(_0x3daf,0x95));var _0xf3da=function(_0x20337d,_0x56fc43){_0x20337d=_0x20337d-0x0;var _0x72c9af=_0x3daf[_0x20337d];return _0x72c9af;};'use strict';var client=require(_0xf3da('0x0'));exports[_0xf3da('0x1')]=function(_0x4a58bf){return client[_0xf3da('0x2')](_0xf3da('0x3'),{'body':_0x4a58bf,'log':_0xf3da('0x3')});};exports[_0xf3da('0x4')]=function(_0x5bea95,_0x575da6){return client[_0xf3da('0x2')]('UpdateFaxQueueReport',{'body':_0x575da6,'options':{'where':{'uniqueid':_0x5bea95},'order':[['id',_0xf3da('0x5')]],'limit':0x1},'log':_0xf3da('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5431406..0e6122e 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 _0x98d1=['interval','../client','getIntervals','name','Intervals'];(function(_0x2c961d,_0x106e3a){var _0xb29a42=function(_0xc899d8){while(--_0xc899d8){_0x2c961d['push'](_0x2c961d['shift']());}};_0xb29a42(++_0x106e3a);}(_0x98d1,0x88));var _0x198d=function(_0x341a83,_0x10f65c){_0x341a83=_0x341a83-0x0;var _0x3c41e3=_0x98d1[_0x341a83];return _0x3c41e3;};'use strict';var client=require(_0x198d('0x0'));exports[_0x198d('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x198d('0x2')],'include':[{'model':'Interval','as':_0x198d('0x3'),'attributes':['id','name',_0x198d('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x634d=['getIntervals','GetInterval','name','Intervals','interval','../client'];(function(_0x185063,_0x3f0bb7){var _0x16d9d3=function(_0x1b3fe3){while(--_0x1b3fe3){_0x185063['push'](_0x185063['shift']());}};_0x16d9d3(++_0x3f0bb7);}(_0x634d,0x101));var _0xd634=function(_0xea8624,_0x3c91b5){_0xea8624=_0xea8624-0x0;var _0x4fa412=_0x634d[_0xea8624];return _0x4fa412;};'use strict';var client=require(_0xd634('0x0'));exports[_0xd634('0x1')]=function(){return function(){return client['Request'](_0xd634('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd634('0x3')],'include':[{'model':'Interval','as':_0xd634('0x4'),'attributes':['id',_0xd634('0x3'),_0xd634('0x5')]}]},'log':_0xd634('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 717794f..19fb4d2 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 _0x5c3c=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0xe47cf,_0x2683e2){var _0x5714c4=function(_0xdd0ef2){while(--_0xdd0ef2){_0xe47cf['push'](_0xe47cf['shift']());}};_0x5714c4(++_0x2683e2);}(_0x5c3c,0x132));var _0xc5c3=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x5c3c[_0x42f009];return _0x22a1e0;};'use strict';var client=require(_0xc5c3('0x0'));exports[_0xc5c3('0x1')]=function(_0x11705d,_0x32103c){return client['Request'](_0xc5c3('0x2'),{'body':_0x32103c,'options':{'where':{'id':_0x11705d}},'log':_0xc5c3('0x3')});};exports[_0xc5c3('0x4')]=function(_0x2a3649,_0x2535e0){return client[_0xc5c3('0x5')](_0xc5c3('0x6'),{'body':_0x2535e0,'options':{'where':{'id':_0x2a3649}},'log':_0xc5c3('0x7')});}; \ No newline at end of file +var _0x955f=['update','Request','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x412b2a,_0x11fb8a){var _0x5872e3=function(_0x202191){while(--_0x202191){_0x412b2a['push'](_0x412b2a['shift']());}};_0x5872e3(++_0x11fb8a);}(_0x955f,0x1eb));var _0xf955=function(_0x195c17,_0x343d5a){_0x195c17=_0x195c17-0x0;var _0x3d9a94=_0x955f[_0x195c17];return _0x3d9a94;};'use strict';var client=require(_0xf955('0x0'));exports[_0xf955('0x1')]=function(_0x438668,_0x382225){return client[_0xf955('0x2')]('UpdateMailInteraction',{'body':_0x382225,'options':{'where':{'id':_0x438668}},'log':_0xf955('0x3')});};exports['addTags']=function(_0x5d0c95,_0x1db0dd){return client['Request'](_0xf955('0x4'),{'body':_0x1db0dd,'options':{'where':{'id':_0x5d0c95}},'log':_0xf955('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 18e4fae..98e9a04 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 _0x44ca=['createMailMessage','../client','Request'];(function(_0xc1ca45,_0xdd1ce2){var _0x4e7a23=function(_0x3cb1f2){while(--_0x3cb1f2){_0xc1ca45['push'](_0xc1ca45['shift']());}};_0x4e7a23(++_0xdd1ce2);}(_0x44ca,0x1ba));var _0xa44c=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x44ca[_0x4f4c2a];return _0xd15be6;};'use strict';var client=require(_0xa44c('0x0'));exports['create']=function(_0x2e6d74){return client[_0xa44c('0x1')]('CreateMailMessage',{'body':_0x2e6d74,'log':_0xa44c('0x2')});}; \ No newline at end of file +var _0x6a41=['Request','createMailMessage','create'];(function(_0x4ac1b4,_0x2c9141){var _0x5803bc=function(_0x4bcaff){while(--_0x4bcaff){_0x4ac1b4['push'](_0x4ac1b4['shift']());}};_0x5803bc(++_0x2c9141);}(_0x6a41,0x1eb));var _0x16a4=function(_0x4d218e,_0x570ea9){_0x4d218e=_0x4d218e-0x0;var _0x5e6af5=_0x6a41[_0x4d218e];return _0x5e6af5;};'use strict';var client=require('../client');exports[_0x16a4('0x0')]=function(_0x3adb82){return client[_0x16a4('0x1')]('CreateMailMessage',{'body':_0x3adb82,'log':_0x16a4('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3edafdc..1a34e82 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 _0x340e=['mailPause','getMailQueues','GetMailQueue','name','User','online'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x340e,0x1c3));var _0xe340=function(_0x2b95ed,_0x2bb471){_0x2b95ed=_0x2b95ed-0x0;var _0x232b9b=_0x340e[_0x2b95ed];return _0x232b9b;};'use strict';var client=require('../client');exports[_0xe340('0x0')]=function(){return function(){return client['Request'](_0xe340('0x1'),{'options':{'raw':![],'attributes':['id',_0xe340('0x2'),'timeout','strategy'],'include':[{'model':_0xe340('0x3'),'as':'Agents','attributes':['id',_0xe340('0x2'),_0xe340('0x4'),_0xe340('0x5')]}]},'log':_0xe340('0x0')});};}; \ No newline at end of file +var _0x7181=['User','online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout','strategy'];(function(_0x148b43,_0xb42a00){var _0x4953cc=function(_0x7a038a){while(--_0x7a038a){_0x148b43['push'](_0x148b43['shift']());}};_0x4953cc(++_0xb42a00);}(_0x7181,0x11c));var _0x1718=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x7181[_0x58965a];return _0x254efc;};'use strict';var client=require(_0x1718('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x1718('0x1')](_0x1718('0x2'),{'options':{'raw':![],'attributes':['id',_0x1718('0x3'),_0x1718('0x4'),_0x1718('0x5')],'include':[{'model':_0x1718('0x6'),'as':'Agents','attributes':['id',_0x1718('0x3'),_0x1718('0x7'),_0x1718('0x8')]}]},'log':_0x1718('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b8c4c1b..1f03d52 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 _0x666d=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC'];(function(_0x543628,_0x17a06){var _0x1475f9=function(_0x4c399b){while(--_0x4c399b){_0x543628['push'](_0x543628['shift']());}};_0x1475f9(++_0x17a06);}(_0x666d,0x134));var _0xd666=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x666d[_0x5f0089];return _0x193892;};'use strict';var client=require('../client');exports['create']=function(_0x189992){return client[_0xd666('0x0')](_0xd666('0x1'),{'body':_0x189992,'log':_0xd666('0x1')});};exports['update']=function(_0x4fb105,_0xb78191){return client['Request'](_0xd666('0x2'),{'body':_0xb78191,'options':{'where':{'uniqueid':_0x4fb105},'order':[['id',_0xd666('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x960d=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','update'];(function(_0x583c99,_0x786325){var _0x58a1ce=function(_0x2b9374){while(--_0x2b9374){_0x583c99['push'](_0x583c99['shift']());}};_0x58a1ce(++_0x786325);}(_0x960d,0x1e7));var _0xd960=function(_0x5b7818,_0x40bd96){_0x5b7818=_0x5b7818-0x0;var _0x55fc58=_0x960d[_0x5b7818];return _0x55fc58;};'use strict';var client=require(_0xd960('0x0'));exports[_0xd960('0x1')]=function(_0x4e43de){return client[_0xd960('0x2')](_0xd960('0x3'),{'body':_0x4e43de,'log':_0xd960('0x3')});};exports[_0xd960('0x4')]=function(_0x223600,_0x19e020){return client[_0xd960('0x2')](_0xd960('0x5'),{'body':_0x19e020,'options':{'where':{'uniqueid':_0x223600},'order':[['id','DESC']],'limit':0x1},'log':_0xd960('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 594145a..ab33ec8 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 _0x7efa=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x138468,_0x57141a){var _0x255801=function(_0x48922a){while(--_0x48922a){_0x138468['push'](_0x138468['shift']());}};_0x255801(++_0x57141a);}(_0x7efa,0x160));var _0xa7ef=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x7efa[_0x4f2c3a];return _0x17d91c;};'use strict';var client=require(_0xa7ef('0x0'));exports[_0xa7ef('0x1')]=function(_0x235e1e,_0x7acec0){return client[_0xa7ef('0x2')](_0xa7ef('0x3'),{'body':_0x7acec0,'options':{'where':{'id':_0x235e1e}},'log':_0xa7ef('0x4')});};exports['addTags']=function(_0x2b1611,_0x34a7ed){return client[_0xa7ef('0x2')](_0xa7ef('0x5'),{'body':_0x34a7ed,'options':{'where':{'id':_0x2b1611}},'log':_0xa7ef('0x6')});}; \ No newline at end of file +var _0x5cb0=['addTags','AddTagsToOpenchannelInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x1460a7,_0x5d8b59){var _0x31b200=function(_0x4de7cc){while(--_0x4de7cc){_0x1460a7['push'](_0x1460a7['shift']());}};_0x31b200(++_0x5d8b59);}(_0x5cb0,0x1e8));var _0x05cb=function(_0x3bebcc,_0x49473c){_0x3bebcc=_0x3bebcc-0x0;var _0x5daebb=_0x5cb0[_0x3bebcc];return _0x5daebb;};'use strict';var client=require(_0x05cb('0x0'));exports['update']=function(_0x3f47f3,_0xd5980f){return client[_0x05cb('0x1')](_0x05cb('0x2'),{'body':_0xd5980f,'options':{'where':{'id':_0x3f47f3}},'log':_0x05cb('0x3')});};exports[_0x05cb('0x4')]=function(_0x2e94a6,_0x36b3d8){return client[_0x05cb('0x1')](_0x05cb('0x5'),{'body':_0x36b3d8,'options':{'where':{'id':_0x2e94a6}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0ebc7b1..9586831 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 _0xbdfe=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbdfe,0x175));var _0xebdf=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xbdfe[_0x42bc91];return _0x3f5507;};'use strict';var client=require(_0xebdf('0x0'));exports['create']=function(_0x13c98d){return client[_0xebdf('0x1')](_0xebdf('0x2'),{'body':_0x13c98d,'log':_0xebdf('0x3')});}; \ No newline at end of file +var _0x99c2=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x20606d,_0x5c6fd1){var _0x1eb50a=function(_0x2c6684){while(--_0x2c6684){_0x20606d['push'](_0x20606d['shift']());}};_0x1eb50a(++_0x5c6fd1);}(_0x99c2,0xa1));var _0x299c=function(_0x2a9094,_0x1e3dfc){_0x2a9094=_0x2a9094-0x0;var _0x58cebd=_0x99c2[_0x2a9094];return _0x58cebd;};'use strict';var client=require('../client');exports[_0x299c('0x0')]=function(_0x1284ff){return client[_0x299c('0x1')](_0x299c('0x2'),{'body':_0x1284ff,'log':_0x299c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 03aecc8..539dbf4 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 _0x65b1=['../client','getOpenchannelQueues','name','timeout','strategy','User','online','openchannelPause'];(function(_0x5a7ca8,_0xd70f1c){var _0x2cd56b=function(_0xce8dbe){while(--_0xce8dbe){_0x5a7ca8['push'](_0x5a7ca8['shift']());}};_0x2cd56b(++_0xd70f1c);}(_0x65b1,0xf0));var _0x165b=function(_0x30b44a,_0x57bca9){_0x30b44a=_0x30b44a-0x0;var _0x268f85=_0x65b1[_0x30b44a];return _0x268f85;};'use strict';var client=require(_0x165b('0x0'));exports[_0x165b('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x165b('0x2'),_0x165b('0x3'),_0x165b('0x4')],'include':[{'model':_0x165b('0x5'),'as':'Agents','attributes':['id',_0x165b('0x2'),_0x165b('0x6'),_0x165b('0x7')]}]},'log':_0x165b('0x1')});};}; \ No newline at end of file +var _0x8973=['Agents','name','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8973,0xeb));var _0x3897=function(_0x4c60c4,_0x84d1b2){_0x4c60c4=_0x4c60c4-0x0;var _0x3e65ff=_0x8973[_0x4c60c4];return _0x3e65ff;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x3897('0x0')](_0x3897('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x3897('0x2'),_0x3897('0x3')],'include':[{'model':_0x3897('0x4'),'as':_0x3897('0x5'),'attributes':['id',_0x3897('0x6'),_0x3897('0x7'),_0x3897('0x8')]}]},'log':_0x3897('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 58e65ab..9541511 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 _0x2cc9=['CreateOpenchannelQueueReport','DESC','create','Request'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x2cc9,0x1f2));var _0x92cc=function(_0x4605a4,_0x5a1a06){_0x4605a4=_0x4605a4-0x0;var _0xd0b9f6=_0x2cc9[_0x4605a4];return _0xd0b9f6;};'use strict';var client=require('../client');exports[_0x92cc('0x0')]=function(_0x35ebd9){return client[_0x92cc('0x1')](_0x92cc('0x2'),{'body':_0x35ebd9,'log':_0x92cc('0x2')});};exports['update']=function(_0x433557,_0x4770c0){return client[_0x92cc('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x4770c0,'options':{'where':{'uniqueid':_0x433557},'order':[['id',_0x92cc('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xd9b9=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','create','Request'];(function(_0x3577f8,_0x52f707){var _0x582b2c=function(_0x14bbf4){while(--_0x14bbf4){_0x3577f8['push'](_0x3577f8['shift']());}};_0x582b2c(++_0x52f707);}(_0xd9b9,0x111));var _0x9d9b=function(_0x3ab20b,_0x194b2e){_0x3ab20b=_0x3ab20b-0x0;var _0x430470=_0xd9b9[_0x3ab20b];return _0x430470;};'use strict';var client=require('../client');exports[_0x9d9b('0x0')]=function(_0xc457ba){return client[_0x9d9b('0x1')]('CreateOpenchannelQueueReport',{'body':_0xc457ba,'log':_0x9d9b('0x2')});};exports['update']=function(_0x5c6d5b,_0x36b467){return client[_0x9d9b('0x1')](_0x9d9b('0x3'),{'body':_0x36b467,'options':{'where':{'uniqueid':_0x5c6d5b},'order':[['id',_0x9d9b('0x4')]],'limit':0x1},'log':_0x9d9b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a17a049..54718c9 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 _0x5ad3=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x5ad3[_0x21f931];return _0x3f083c;};'use strict';var client=require(_0x35ad('0x0'));exports[_0x35ad('0x1')]=function(_0x15b630,_0x2a45b7){return client['Request'](_0x35ad('0x2'),{'body':_0x2a45b7,'options':{'where':{'id':_0x15b630}},'log':_0x35ad('0x3')});};exports[_0x35ad('0x4')]=function(_0x69a0b3,_0x450f55){return client[_0x35ad('0x5')](_0x35ad('0x6'),{'body':_0x450f55,'options':{'where':{'id':_0x69a0b3}},'log':_0x35ad('0x7')});}; \ No newline at end of file +var _0xa73a=['update','Request','UpdateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x56eefb,_0x1a1c6d){var _0x13ed78=function(_0x18f89a){while(--_0x18f89a){_0x56eefb['push'](_0x56eefb['shift']());}};_0x13ed78(++_0x1a1c6d);}(_0xa73a,0x82));var _0xaa73=function(_0x5b3e28,_0x2ad693){_0x5b3e28=_0x5b3e28-0x0;var _0x21a6f4=_0xa73a[_0x5b3e28];return _0x21a6f4;};'use strict';var client=require('../client');exports[_0xaa73('0x0')]=function(_0x3d8fed,_0x230542){return client[_0xaa73('0x1')](_0xaa73('0x2'),{'body':_0x230542,'options':{'where':{'id':_0x3d8fed}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x512616,_0x35025d){return client[_0xaa73('0x1')](_0xaa73('0x3'),{'body':_0x35025d,'options':{'where':{'id':_0x512616}},'log':_0xaa73('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index b455389..c02c8ed 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 _0xc347=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x3b7afc,_0x591c4b){var _0x4c7bb2=function(_0xe73053){while(--_0xe73053){_0x3b7afc['push'](_0x3b7afc['shift']());}};_0x4c7bb2(++_0x591c4b);}(_0xc347,0x101));var _0x7c34=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc347[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7c34('0x0'));exports[_0x7c34('0x1')]=function(_0x6ae516){return client[_0x7c34('0x2')](_0x7c34('0x3'),{'body':_0x6ae516,'log':_0x7c34('0x4')});}; \ No newline at end of file +var _0x0dfb=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x3b8cec,_0x525da7){var _0x2f49f2=function(_0x2aac99){while(--_0x2aac99){_0x3b8cec['push'](_0x3b8cec['shift']());}};_0x2f49f2(++_0x525da7);}(_0x0dfb,0x15b));var _0xb0df=function(_0x24f364,_0x2ba7a9){_0x24f364=_0x24f364-0x0;var _0xecb2c5=_0x0dfb[_0x24f364];return _0xecb2c5;};'use strict';var client=require(_0xb0df('0x0'));exports[_0xb0df('0x1')]=function(_0x468641){return client[_0xb0df('0x2')](_0xb0df('0x3'),{'body':_0x468641,'log':_0xb0df('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a684cfe..b6642b6 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x46828f,_0x181b24){var _0x381d27=function(_0x24236d){while(--_0x24236d){_0x46828f['push'](_0x46828f['shift']());}};_0x381d27(++_0x181b24);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb7e7[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x250f6c,_0x3297c8){var _0xab0ed0=function(_0x128b08){while(--_0x128b08){_0x250f6c['push'](_0x250f6c['shift']());}};_0xab0ed0(++_0x3297c8);}(_0xe706,0xa3));var _0x6e70=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0xe706[_0x1f6f84];return _0x177f40;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 971154a..704fd4e 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x008c,0x188));var _0xc008=function(_0x190417,_0x54dc0d){_0x190417=_0x190417-0x0;var _0x110e9c=_0x008c[_0x190417];return _0x110e9c;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x26ccc0,_0xe46bde){var _0x222470=function(_0x3ea814){while(--_0x3ea814){_0x26ccc0['push'](_0x26ccc0['shift']());}};_0x222470(++_0xe46bde);}(_0x3e74,0x175));var _0x43e7=function(_0x46a672,_0x5d4487){_0x46a672=_0x46a672-0x0;var _0xd812cb=_0x3e74[_0x46a672];return _0xd812cb;};'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 a3dcef1..352c4af 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(_0x42da23,_0x27dba6){var _0x2c023c=function(_0x39b743){while(--_0x39b743){_0x42da23['push'](_0x42da23['shift']());}};_0x2c023c(++_0x27dba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x17856b,_0x5b1e80){var _0x246625=function(_0x1bed77){while(--_0x1bed77){_0x17856b['push'](_0x17856b['shift']());}};_0x246625(++_0x5b1e80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 99f9c3b..28432f1 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 _0xb145=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5c407a,_0x4474c8){var _0x29c26b=function(_0x35aa6a){while(--_0x35aa6a){_0x5c407a['push'](_0x5c407a['shift']());}};_0x29c26b(++_0x4474c8);}(_0xb145,0xa3));var _0x5b14=function(_0x4e3ba2,_0x11b4ab){_0x4e3ba2=_0x4e3ba2-0x0;var _0x3b019e=_0xb145[_0x4e3ba2];return _0x3b019e;};'use strict';var client=require('../client');exports[_0x5b14('0x0')]=function(_0xc54593,_0x935de1){return client[_0x5b14('0x1')](_0x5b14('0x2'),{'body':_0x935de1,'options':{'where':{'id':_0xc54593}},'log':_0x5b14('0x3')});};exports[_0x5b14('0x4')]=function(_0x34b4cd,_0x5111cd){return client[_0x5b14('0x1')](_0x5b14('0x5'),{'body':_0x5111cd,'options':{'where':{'id':_0x34b4cd}},'log':_0x5b14('0x6')});}; \ No newline at end of file +var _0xed5c=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x4d7af7,_0x3c6d93){var _0x226a9d=function(_0x4a2aa1){while(--_0x4a2aa1){_0x4d7af7['push'](_0x4d7af7['shift']());}};_0x226a9d(++_0x3c6d93);}(_0xed5c,0x81));var _0xced5=function(_0x5cc622,_0x4a2f74){_0x5cc622=_0x5cc622-0x0;var _0x4fff15=_0xed5c[_0x5cc622];return _0x4fff15;};'use strict';var client=require(_0xced5('0x0'));exports[_0xced5('0x1')]=function(_0x2c59c3,_0x21fae7){return client[_0xced5('0x2')](_0xced5('0x3'),{'body':_0x21fae7,'options':{'where':{'id':_0x2c59c3}},'log':_0xced5('0x4')});};exports[_0xced5('0x5')]=function(_0x2b8184,_0x2ec4f9){return client['Request'](_0xced5('0x6'),{'body':_0x2ec4f9,'options':{'where':{'id':_0x2b8184}},'log':_0xced5('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 57ceae4..0097286 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 _0x5d00=['Request','CreateWhatsappMessage'];(function(_0x4c7dce,_0x2ba397){var _0x42245b=function(_0x249213){while(--_0x249213){_0x4c7dce['push'](_0x4c7dce['shift']());}};_0x42245b(++_0x2ba397);}(_0x5d00,0x10c));var _0x05d0=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x5d00[_0x46efd7];return _0x5637e4;};'use strict';var client=require('../client');exports['create']=function(_0x811990){return client[_0x05d0('0x0')](_0x05d0('0x1'),{'body':_0x811990,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xd1a5=['Request','../client'];(function(_0x309df4,_0x3391db){var _0x4be8fc=function(_0x2261e4){while(--_0x2261e4){_0x309df4['push'](_0x309df4['shift']());}};_0x4be8fc(++_0x3391db);}(_0xd1a5,0x93));var _0x5d1a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xd1a5[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0x5d1a('0x0'));exports['create']=function(_0x5d4e33){return client[_0x5d1a('0x1')]('CreateWhatsappMessage',{'body':_0x5d4e33,'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 6dfba66..c30cb10 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 _0xf871=['Request','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues'];(function(_0x3484c3,_0x14e9e8){var _0x524f80=function(_0x5d10bf){while(--_0x5d10bf){_0x3484c3['push'](_0x3484c3['shift']());}};_0x524f80(++_0x14e9e8);}(_0xf871,0xef));var _0x1f87=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xf871[_0x277fa3];return _0x2e4520;};'use strict';var client=require('../client');exports[_0x1f87('0x0')]=function(){return function(){return client[_0x1f87('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x1f87('0x2'),_0x1f87('0x3'),_0x1f87('0x4')],'include':[{'model':_0x1f87('0x5'),'as':'Agents','attributes':['id',_0x1f87('0x2'),_0x1f87('0x6'),_0x1f87('0x7')]}]},'log':_0x1f87('0x0')});};}; \ No newline at end of file +var _0x17c6=['../client','getWhatsappQueues','Request','name','timeout','strategy','User','Agents','online'];(function(_0x4c81ab,_0x15d31a){var _0x42cdeb=function(_0x312ec6){while(--_0x312ec6){_0x4c81ab['push'](_0x4c81ab['shift']());}};_0x42cdeb(++_0x15d31a);}(_0x17c6,0x7e));var _0x617c=function(_0x196e92,_0x5d145e){_0x196e92=_0x196e92-0x0;var _0x41c8b1=_0x17c6[_0x196e92];return _0x41c8b1;};'use strict';var client=require(_0x617c('0x0'));exports[_0x617c('0x1')]=function(){return function(){return client[_0x617c('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x617c('0x3'),_0x617c('0x4'),_0x617c('0x5')],'include':[{'model':_0x617c('0x6'),'as':_0x617c('0x7'),'attributes':['id',_0x617c('0x3'),_0x617c('0x8'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 568195c..4c2d87a 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 _0xef84=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xef84,0xf1));var _0x4ef8=function(_0x21faef,_0x291124){_0x21faef=_0x21faef-0x0;var _0x4c4ae4=_0xef84[_0x21faef];return _0x4c4ae4;};'use strict';var client=require(_0x4ef8('0x0'));exports[_0x4ef8('0x1')]=function(_0x431296){return client[_0x4ef8('0x2')](_0x4ef8('0x3'),{'body':_0x431296,'log':_0x4ef8('0x3')});};exports[_0x4ef8('0x4')]=function(_0x1269c9,_0x451426){return client[_0x4ef8('0x2')](_0x4ef8('0x5'),{'body':_0x451426,'options':{'where':{'uniqueid':_0x1269c9},'order':[['id',_0x4ef8('0x6')]],'limit':0x1},'log':_0x4ef8('0x5')});}; \ No newline at end of file +var _0x1095=['update','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x5e766e,_0x401bcd){var _0x21ac06=function(_0x1dd94d){while(--_0x1dd94d){_0x5e766e['push'](_0x5e766e['shift']());}};_0x21ac06(++_0x401bcd);}(_0x1095,0x1b5));var _0x5109=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x1095[_0x40ac5e];return _0x2839d6;};'use strict';var client=require(_0x5109('0x0'));exports['create']=function(_0x10612e){return client[_0x5109('0x1')](_0x5109('0x2'),{'body':_0x10612e,'log':'CreateWhatsappQueueReport'});};exports[_0x5109('0x3')]=function(_0x412eb3,_0x506737){return client[_0x5109('0x1')]('UpdateWhatsappQueueReport',{'body':_0x506737,'options':{'where':{'uniqueid':_0x412eb3},'order':[['id',_0x5109('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 110ed58..a48ea51 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 _0x274b=['message','join','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','[%s][QUEUE]\x20%s','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x274b,0x72));var _0xb274=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x274b[_0x618414];return _0x21c19a;};'use strict';var schema=require('validate');var _=require(_0xb274('0x0'));var util=require('util');var seqqueue=require(_0xb274('0x1'));var logger=require(_0xb274('0x2'))(_0xb274('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xb274('0x4')},'timeout':{'type':_0xb274('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4eb2c0,_0x591c50,_0x24c47d){return logger['info'](util[_0xb274('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4eb2c0,_0x591c50['name'],_0x24c47d));}function handleFindAgent(_0x434c6b){return function(_0x2752ab){return _0x2752ab[_0xb274('0x7')][_0xb274('0x8')]()===_0x434c6b['toLowerCase']();};}exports[_0xb274('0x9')]=function(_0x17070e,_0x1b2033,_0x599a66,_0x5963b5){return function(_0x47c7cb){try{var _0x4e0460={'name':_0x1b2033[0x0],'timeout':_0x1b2033[0x1]};var _0x13b02c=queue['validate'](_0x4e0460,{'typecast':!![]});if(_0x13b02c[_0xb274('0xa')]){logger[_0xb274('0xb')](_0xb274('0xc'),_0x17070e,_[_0xb274('0xd')](_0x13b02c,_0xb274('0xe'))[_0xb274('0xf')](',\x20'));_0x47c7cb['stop']();}else{var _0x563b3f=_[_0xb274('0x10')](_0x599a66[_0xb274('0x11')],handleFindAgent(_0x4e0460['name']));if(_0x563b3f){var _0x27b985=(_0x4e0460[_0xb274('0x12')]||0xa)*0x3e8;var _0x333a5f,_0x4ebf8;var _0x5ca487=seqqueue[_0xb274('0x13')](_0x27b985);_0x5ca487['id']=_0x17070e;_0x5ca487[_0xb274('0x14')]=_0x27b985;_0x5ca487[_0xb274('0x15')]=_0x5963b5[_0xb274('0x15')];writeLog(_0x17070e,_0x563b3f,util['format'](_0xb274('0x16'),_0x27b985));_0x599a66[_0xb274('0x17')][_0x17070e]['on']('end',function(){logger[_0xb274('0x18')](_0xb274('0x19'),_0x17070e);clearTimeout(_0x4ebf8);_0x4ebf8=undefined;_0x5ca487[_0xb274('0x1a')]();if(_0x599a66[_0xb274('0x17')][_0x17070e]){delete _0x599a66[_0xb274('0x17')][_0x17070e];}_0x47c7cb['stop']();});_0x599a66[_0xb274('0x17')][_0x17070e]['on']('complete',function(){if(_0x599a66[_0xb274('0x17')][_0x17070e]){delete _0x599a66[_0xb274('0x17')][_0x17070e];}});_0x4ebf8=setTimeout(function(){logger['info'](_0xb274('0x1b'),_0x17070e);clearTimeout(_0x4ebf8);_0x5ca487[_0xb274('0x1a')]();_0x47c7cb['next']();},_0x27b985);strategy[_0xb274('0x1c')](_0x5ca487,_0x563b3f,_0x599a66,_0x5963b5);}else{logger[_0xb274('0xb')](_0xb274('0x1d'),_0x17070e,_0x4e0460[_0xb274('0x7')]);_0x47c7cb[_0xb274('0x1e')]();}}}catch(_0x40c23a){console['log'](_0x40c23a);logger[_0xb274('0xb')](_0xb274('0x1f'),_0x17070e,_0x40c23a['stack']);_0x47c7cb[_0xb274('0x1e')]();}};}; \ No newline at end of file +var _0x65c4=['agents','timeout','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','seq-queue','../../../../config/logger','routing','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x65c4,0x19f));var _0x465c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x65c4[_0x6131cd];return _0x47e916;};'use strict';var schema=require(_0x465c('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x465c('0x1'));var logger=require(_0x465c('0x2'))(_0x465c('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x465c('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x465c('0x5')}});function writeLog(_0x4fd5fe,_0xc15725,_0x2b8d7b){return logger[_0x465c('0x6')](util[_0x465c('0x7')](_0x465c('0x8'),_0x4fd5fe,_0xc15725['name'],_0x2b8d7b));}function handleFindAgent(_0x479089){return function(_0x2550e1){return _0x2550e1[_0x465c('0x9')][_0x465c('0xa')]()===_0x479089[_0x465c('0xa')]();};}exports[_0x465c('0xb')]=function(_0x1cf87f,_0xa9d078,_0x551174,_0x29e8c5){return function(_0x156555){try{var _0x3e5502={'name':_0xa9d078[0x0],'timeout':_0xa9d078[0x1]};var _0x253640=queue[_0x465c('0x0')](_0x3e5502,{'typecast':!![]});if(_0x253640[_0x465c('0xc')]){logger['error'](_0x465c('0xd'),_0x1cf87f,_[_0x465c('0xe')](_0x253640,_0x465c('0xf'))[_0x465c('0x10')](',\x20'));_0x156555['stop']();}else{var _0x3122ce=_['find'](_0x551174[_0x465c('0x11')],handleFindAgent(_0x3e5502[_0x465c('0x9')]));if(_0x3122ce){var _0x43b6b4=(_0x3e5502[_0x465c('0x12')]||0xa)*0x3e8;var _0x21fc10,_0x4ae9e8;var _0x3f5230=seqqueue[_0x465c('0x13')](_0x43b6b4);_0x3f5230['id']=_0x1cf87f;_0x3f5230[_0x465c('0x14')]=_0x43b6b4;_0x3f5230['channel']=_0x29e8c5[_0x465c('0x15')];writeLog(_0x1cf87f,_0x3122ce,util[_0x465c('0x7')](_0x465c('0x16'),_0x43b6b4));_0x551174['rules'][_0x1cf87f]['on'](_0x465c('0x17'),function(){logger['info'](_0x465c('0x18'),_0x1cf87f);clearTimeout(_0x4ae9e8);_0x4ae9e8=undefined;_0x3f5230['close']();if(_0x551174[_0x465c('0x19')][_0x1cf87f]){delete _0x551174[_0x465c('0x19')][_0x1cf87f];}_0x156555[_0x465c('0x1a')]();});_0x551174[_0x465c('0x19')][_0x1cf87f]['on'](_0x465c('0x1b'),function(){if(_0x551174[_0x465c('0x19')][_0x1cf87f]){delete _0x551174[_0x465c('0x19')][_0x1cf87f];}});_0x4ae9e8=setTimeout(function(){logger['info'](_0x465c('0x1c'),_0x1cf87f);clearTimeout(_0x4ae9e8);_0x3f5230[_0x465c('0x1d')]();_0x156555[_0x465c('0x1e')]();},_0x43b6b4);strategy[_0x465c('0x1f')](_0x3f5230,_0x3122ce,_0x551174,_0x29e8c5);}else{logger[_0x465c('0x20')](_0x465c('0x21'),_0x1cf87f,_0x3e5502[_0x465c('0x9')]);_0x156555[_0x465c('0x1a')]();}}}catch(_0xffff2a){console[_0x465c('0x22')](_0xffff2a);logger[_0x465c('0x20')]('[%s][QUEUE]\x20%s',_0x1cf87f,_0xffff2a[_0x465c('0x23')]);_0x156555['stop']();}};}; \ 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 b48d758..62a8c21 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 _0xb0c7=['providerResponse','create','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','error','stringify','finally','[%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','postText','amazonlex','providerName'];(function(_0x2432ad,_0x59883b){var _0x2e35c4=function(_0x1f81ac){while(--_0x1f81ac){_0x2432ad['push'](_0x2432ad['shift']());}};_0x2e35c4(++_0x59883b);}(_0xb0c7,0x153));var _0x7b0c=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xb0c7[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x7b0c('0x0'));var moment=require(_0x7b0c('0x1'));var AWS=require(_0x7b0c('0x2'));var utils=require(_0x7b0c('0x3'));var logger=require(_0x7b0c('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7b0c('0x5')),'mailMessage':require(_0x7b0c('0x6')),'smsMessage':require(_0x7b0c('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7b0c('0x8'))};exports[_0x7b0c('0x9')]=function(_0x5d2fa3,_0x409bd1){return function(_0x1526d3){try{if(!_[_0x7b0c('0xa')](this[_0x7b0c('0xb')]['UserId'])){logger[_0x7b0c('0xc')](_0x7b0c('0xd'),_0x5d2fa3,_0x7b0c('0xe'));return _0x1526d3[_0x7b0c('0xf')]();}var _0x55608e={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7b0c('0x10')](_0x7b0c('0x11')),'direction':_0x7b0c('0x12')};if(this[_0x7b0c('0x13')]==='sms'||this[_0x7b0c('0x13')]===_0x7b0c('0x14')){_0x55608e[_0x7b0c('0x15')]=this['interaction'][_0x7b0c('0x15')];}var _0xafed86=this[_0x7b0c('0x13')];if(_0xafed86===_0x7b0c('0x16')){_0x55608e['ChatWebsiteId']=this[_0x7b0c('0x17')]['id'];}else{_0x55608e[_[_0x7b0c('0x18')](_0xafed86)+_0x7b0c('0x19')]=this['account']['id'];}_0x55608e[_[_0x7b0c('0x18')](_0xafed86)+_0x7b0c('0x1a')]=this['interaction']['id'];if(this[_0x7b0c('0xb')][_0x7b0c('0x1b')]){var _0x55546e=_0x409bd1[0x4];if(!_[_0x7b0c('0x1c')](_0x55546e)){_0x55608e[_0x7b0c('0x1d')]=utils[_0x7b0c('0x1e')](_0x55546e,this);return rpc[_0xafed86+_0x7b0c('0x1f')]['create'](_0x55608e)[_0x7b0c('0x20')](function(_0x51cfff){logger[_0x7b0c('0xc')](_0x7b0c('0xd'),_0x5d2fa3,_0x55608e[_0x7b0c('0x1d')]);})['catch'](function(_0x50990b){logger[_0x7b0c('0x21')](_0x7b0c('0xd'),_0x5d2fa3,JSON[_0x7b0c('0x22')](_0x50990b));})[_0x7b0c('0x23')](function(){logger[_0x7b0c('0xc')](_0x7b0c('0x24'),_0x5d2fa3);_0x1526d3[_0x7b0c('0x25')]();});}else{logger[_0x7b0c('0xc')](_0x7b0c('0x26'),_0x5d2fa3);_0x1526d3[_0x7b0c('0x25')]();}}else{var _0x41010e=this;var _0xd556d3=new AWS[(_0x7b0c('0x27'))]({'accessKeyId':_0x409bd1[0x0],'secretAccessKey':_0x409bd1[0x1],'region':_0x409bd1[0x2]});var _0x2949ca={'botAlias':_0x7b0c('0x28'),'botName':_0x409bd1[0x3],'inputText':this[_0x7b0c('0x29')][_0x7b0c('0x1d')],'userId':this[_0x7b0c('0x13')]+':'+this['interaction']['id']['toString']()};_0xd556d3[_0x7b0c('0x2a')](_0x2949ca,function(_0x3c7eea,_0x4c4837){if(_0x3c7eea){logger[_0x7b0c('0x21')](_0x7b0c('0xd'),_0x5d2fa3,_0x3c7eea[_0x7b0c('0x29')]);_0x1526d3['next']();}else if(_0x4c4837&&_0x4c4837['message']){_0x41010e[_0x7b0c('0x1d')][_0x7b0c('0x2b')]=_0x4c4837;_0x55608e['body']=_0x4c4837[_0x7b0c('0x29')];_0x55608e[_0x7b0c('0x2c')]=_0x7b0c('0x2b');_0x55608e[_0x7b0c('0x2d')]=JSON[_0x7b0c('0x22')](_0x4c4837);return rpc[_0xafed86+_0x7b0c('0x1f')][_0x7b0c('0x2e')](_0x55608e)[_0x7b0c('0x20')](function(_0x1c5d76){logger[_0x7b0c('0xc')](_0x7b0c('0xd'),_0x5d2fa3,_0x55608e['body']);if(_0x4c4837['dialogState']=='Failed'){_0x1526d3[_0x7b0c('0xf')]();}else{_0x1526d3[_0x7b0c('0x25')]();}})[_0x7b0c('0x2f')](function(_0x38d967){logger[_0x7b0c('0x21')](_0x7b0c('0xd'),_0x5d2fa3,JSON['stringify'](_0x38d967));_0x1526d3[_0x7b0c('0xf')]();});}else{_0x1526d3[_0x7b0c('0xf')]();}});}}catch(_0x47bfed){logger['error'](_0x7b0c('0xd'),_0x5d2fa3,JSON[_0x7b0c('0x22')](_0x47bfed));_0x1526d3[_0x7b0c('0x25')]();}};}; \ No newline at end of file +var _0x90b9=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','created','isEmpty','getMustacheRender','Message','create','body','catch','error','[%s][AMAZONLEX]\x20%s','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','providerName','amazonlex','then','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x90b9,0x148));var _0x990b=function(_0x526ca6,_0x1ade2f){_0x526ca6=_0x526ca6-0x0;var _0x5a4591=_0x90b9[_0x526ca6];return _0x5a4591;};'use strict';var _=require(_0x990b('0x0'));var moment=require(_0x990b('0x1'));var AWS=require(_0x990b('0x2'));var utils=require(_0x990b('0x3'));var logger=require(_0x990b('0x4'))(_0x990b('0x5'));var rpc={'chatMessage':require(_0x990b('0x6')),'openchannelMessage':require(_0x990b('0x7')),'mailMessage':require(_0x990b('0x8')),'smsMessage':require(_0x990b('0x9')),'faxMessage':require(_0x990b('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1abfd7,_0x5d1878){return function(_0x2e8835){try{if(!_['isNil'](this['interaction'][_0x990b('0xb')])){logger[_0x990b('0xc')]('[%s][AMAZONLEX]\x20%s',_0x1abfd7,_0x990b('0xd'));return _0x2e8835[_0x990b('0xe')]();}var _0x592fb3={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x990b('0xf')};if(this['channel']===_0x990b('0x10')||this[_0x990b('0x11')]===_0x990b('0x12')){_0x592fb3[_0x990b('0x13')]=this['interaction'][_0x990b('0x13')];}var _0x2b2f83=this[_0x990b('0x11')];if(_0x2b2f83===_0x990b('0x14')){_0x592fb3[_0x990b('0x15')]=this['account']['id'];}else{_0x592fb3[_[_0x990b('0x16')](_0x2b2f83)+_0x990b('0x17')]=this[_0x990b('0x18')]['id'];}_0x592fb3[_[_0x990b('0x16')](_0x2b2f83)+_0x990b('0x19')]=this['interaction']['id'];if(this[_0x990b('0x1a')][_0x990b('0x1b')]){var _0x92511f=_0x5d1878[0x4];if(!_[_0x990b('0x1c')](_0x92511f)){_0x592fb3['body']=utils[_0x990b('0x1d')](_0x92511f,this);return rpc[_0x2b2f83+_0x990b('0x1e')][_0x990b('0x1f')](_0x592fb3)['then'](function(_0x17b99e){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1abfd7,_0x592fb3[_0x990b('0x20')]);})[_0x990b('0x21')](function(_0x3e3d34){logger[_0x990b('0x22')](_0x990b('0x23'),_0x1abfd7,JSON[_0x990b('0x24')](_0x3e3d34));})['finally'](function(){logger[_0x990b('0xc')](_0x990b('0x25'),_0x1abfd7);_0x2e8835[_0x990b('0x26')]();});}else{logger[_0x990b('0xc')](_0x990b('0x27'),_0x1abfd7);_0x2e8835[_0x990b('0x26')]();}}else{var _0x29fdbd=this;var _0x2606ce=new AWS[(_0x990b('0x28'))]({'accessKeyId':_0x5d1878[0x0],'secretAccessKey':_0x5d1878[0x1],'region':_0x5d1878[0x2]});var _0x148bae={'botAlias':'$LATEST','botName':_0x5d1878[0x3],'inputText':this[_0x990b('0x29')][_0x990b('0x20')],'userId':this[_0x990b('0x11')]+':'+this['interaction']['id'][_0x990b('0x2a')]()};_0x2606ce[_0x990b('0x2b')](_0x148bae,function(_0x243380,_0x1381d4){if(_0x243380){logger[_0x990b('0x22')](_0x990b('0x23'),_0x1abfd7,_0x243380[_0x990b('0x29')]);_0x2e8835[_0x990b('0xe')]();}else if(_0x1381d4&&_0x1381d4[_0x990b('0x29')]){_0x29fdbd[_0x990b('0x20')]['amazonlex']=_0x1381d4;_0x592fb3[_0x990b('0x20')]=_0x1381d4['message'];_0x592fb3[_0x990b('0x2c')]=_0x990b('0x2d');_0x592fb3['providerResponse']=JSON[_0x990b('0x24')](_0x1381d4);return rpc[_0x2b2f83+_0x990b('0x1e')]['create'](_0x592fb3)[_0x990b('0x2e')](function(_0x330418){logger[_0x990b('0xc')](_0x990b('0x23'),_0x1abfd7,_0x592fb3[_0x990b('0x20')]);if(_0x1381d4['dialogState']==_0x990b('0x2f')){_0x2e8835[_0x990b('0xe')]();}else{_0x2e8835[_0x990b('0x26')]();}})['catch'](function(_0x14f622){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1abfd7,JSON['stringify'](_0x14f622));_0x2e8835[_0x990b('0xe')]();});}else{_0x2e8835[_0x990b('0xe')]();}});}}catch(_0x3f6325){logger[_0x990b('0x22')](_0x990b('0x23'),_0x1abfd7,JSON[_0x990b('0x24')](_0x3f6325));_0x2e8835[_0x990b('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 41c9937..2cb7c1b 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 _0x8107=['created','Autoreply\x20already\x20sent','next','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','channel','mail','phone','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','','headers','auto-replied','All','sendMailMessage','smtpOptions','messageId','create','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil'];(function(_0x57e51,_0x27de3a){var _0x17c798=function(_0xf60782){while(--_0xf60782){_0x57e51['push'](_0x57e51['shift']());}};_0x17c798(++_0x27de3a);}(_0x8107,0xb2));var _0x7810=function(_0x1c67a2,_0x599648){_0x1c67a2=_0x1c67a2-0x0;var _0x4fbd8e=_0x8107[_0x1c67a2];return _0x4fbd8e;};'use strict';var _=require(_0x7810('0x0'));var moment=require(_0x7810('0x1'));var utils=require(_0x7810('0x2'));var logger=require(_0x7810('0x3'))(_0x7810('0x4'));var rpc={'chatMessage':require(_0x7810('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7810('0x6')),'faxMessage':require(_0x7810('0x7')),'whatsappMessage':require(_0x7810('0x8')),'chatInteraction':require(_0x7810('0x9')),'openchannelInteraction':require(_0x7810('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x7810('0xb')),'faxInteraction':require(_0x7810('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x7810('0xd'));exports[_0x7810('0xe')]=function(_0x32c0ec,_0x46d74b,_0x48c628,_0x584c87){return function(_0x4c05ad){try{var _0x7df63f=this['channel'];if(_0x7df63f==='mail'&&_0x584c87[_0x7810('0xf')]['isAutoreply']){logger[_0x7810('0x10')](_0x7810('0x11'),_0x32c0ec,_0x7810('0x12'));return _0x4c05ad['next']();}if(_0x46d74b[0x0]==='1'&&(_[_0x7810('0x13')](this['interaction'][_0x7810('0x14')])||!this['interaction'][_0x7810('0x14')])){logger['info'](_0x7810('0x11'),_0x32c0ec,_0x7810('0x15'));return _0x4c05ad[_0x7810('0x16')]();}if(_0x46d74b[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x7810('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x32c0ec,_0x7810('0x17'));return _0x4c05ad['next']();}var _0x48b8e6={'ContactId':this[_0x7810('0x18')]['id'],'sentAt':moment()['format'](_0x7810('0x19')),'direction':_0x7810('0x1a')};if(this['channel']==='mail'){_0x48b8e6[_0x7810('0xf')]=utils[_0x7810('0x1b')](_0x46d74b[0x2],this);}else{_0x48b8e6[_0x7810('0xf')]=utils[_0x7810('0x1b')](_0x46d74b[0x1],this);}if(this[_0x7810('0x1c')]){_0x48b8e6['to']=this[_0x7810('0x1c')][_0x7810('0x1d')]||'';if(this[_0x7810('0x1e')]===_0x7810('0x1f')&&_0x46d74b[0x1]==='1'){_0x48b8e6['cc']=this[_0x7810('0x1c')]['cc']||'';}_0x48b8e6[_0x7810('0x1d')]=this[_0x7810('0x1c')]['to']||'';_0x48b8e6[_0x7810('0x20')]=this[_0x7810('0x1c')][_0x7810('0x20')]||'';_0x48b8e6['read']=!![];if(this[_0x7810('0x1c')][_0x7810('0x21')]){_0x48b8e6['subject']='';_0x48b8e6[_0x7810('0x21')]+=_[_0x7810('0x22')](this[_0x7810('0x1c')]['subject'],_0x7810('0x23'))?'':_0x7810('0x24');_0x48b8e6[_0x7810('0x21')]+=this[_0x7810('0x1c')][_0x7810('0x21')];}}if(this[_0x7810('0x1e')]===_0x7810('0x25')){_0x48b8e6['ChatWebsiteId']=this[_0x7810('0x26')]['id'];}else{_0x48b8e6[_[_0x7810('0x27')](this[_0x7810('0x1e')])+_0x7810('0x28')]=this['account']['id'];}_0x48b8e6[_['upperFirst'](this[_0x7810('0x1e')])+_0x7810('0x29')]=this[_0x7810('0x2a')]['id'];var _0x203e70=this[_0x7810('0x2a')];if(rpc[this[_0x7810('0x1e')]+_0x7810('0x2b')]){if(this[_0x7810('0x1e')]==='mail'){_0x48b8e6['inReplyTo']=this[_0x7810('0x1c')]['messageId'];_0x48b8e6['html']=''+_['replace'](_0x48b8e6['body'],_0x7810('0x2c'),_0x7810('0x2d'))+_0x7810('0x2e');_0x48b8e6[_0x7810('0x2f')]={'Auto-Submitted':_0x7810('0x30'),'X-Auto-Response-Suppress':_0x7810('0x31'),'Precedence':'auto_reply'};return mailRpc[_0x7810('0x32')](this[_0x7810('0x26')][_0x7810('0x33')],_0x48b8e6)['then'](function(_0x51c675){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x32c0ec);_0x48b8e6['messageId']=_0x51c675['message'][_0x7810('0x34')];return rpc[_0x7df63f+_0x7810('0x2b')][_0x7810('0x35')](_0x48b8e6);})[_0x7810('0x36')](function(_0x29873d){logger['info'](_0x7810('0x11'),_0x32c0ec,JSON[_0x7810('0x37')](_0x29873d));})['catch'](function(_0x56d420){logger[_0x7810('0x38')](_0x7810('0x39'),_0x32c0ec,JSON['stringify'](_0x56d420));})[_0x7810('0x3a')](function(){Promise[_0x7810('0x3b')]()['then'](function(){if(_0x46d74b[0x0]!=='2'||_0x203e70[_0x7810('0x3c')])return;return rpc[_0x7df63f+_0x7810('0x3d')][_0x7810('0x3e')](_0x203e70['id'],{'autoreplyExecuted':!![]})[_0x7810('0x36')](function(_0x127f58){logger[_0x7810('0x10')](_0x7810('0x3f'),_0x32c0ec,JSON[_0x7810('0x37')](_0x127f58));})[_0x7810('0x40')](function(_0x101197){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x32c0ec,JSON['stringify'](_0x101197));});})['then'](function(){_0x4c05ad[_0x7810('0x16')]();});});}else{return rpc[this[_0x7810('0x1e')]+_0x7810('0x2b')][_0x7810('0x35')](_0x48b8e6)[_0x7810('0x36')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x32c0ec,_0x48b8e6[_0x7810('0xf')]);})['catch'](function(_0x10dfed){logger[_0x7810('0x38')](_0x7810('0x11'),_0x32c0ec,JSON[_0x7810('0x37')](_0x10dfed));})[_0x7810('0x3a')](function(){Promise[_0x7810('0x3b')]()[_0x7810('0x36')](function(){if(_0x46d74b[0x0]!=='2'||_0x203e70[_0x7810('0x3c')])return;return rpc[_0x7df63f+_0x7810('0x3d')][_0x7810('0x3e')](_0x203e70['id'],{'autoreplyExecuted':!![]})[_0x7810('0x36')](function(_0x56441b){logger[_0x7810('0x10')](_0x7810('0x3f'),_0x32c0ec,JSON[_0x7810('0x37')](_0x56441b));})[_0x7810('0x40')](function(_0xb5dab7){logger[_0x7810('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x32c0ec,JSON['stringify'](_0xb5dab7));});})['then'](function(){_0x4c05ad['next']();});});}}}catch(_0x26cc6e){logger[_0x7810('0x38')](_0x7810('0x11'),_0x32c0ec,JSON['stringify'](_0x26cc6e));_0x4c05ad[_0x7810('0x41')]();}};}; \ No newline at end of file +var _0xbbf4=['getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','messageId','html','replace','','auto-replied','All','auto_reply','sendMailMessage','create','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','then','autoreplyExecuted','Interaction','update','stringify','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','error','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0xbbf4,0xf8));var _0x4bbf=function(_0x5b022b,_0x37cc86){_0x5b022b=_0x5b022b-0x0;var _0x9d2f68=_0xbbf4[_0x5b022b];return _0x9d2f68;};'use strict';var _=require(_0x4bbf('0x0'));var moment=require('moment');var utils=require(_0x4bbf('0x1'));var logger=require(_0x4bbf('0x2'))('routing');var rpc={'chatMessage':require(_0x4bbf('0x3')),'openchannelMessage':require(_0x4bbf('0x4')),'mailMessage':require(_0x4bbf('0x5')),'smsMessage':require(_0x4bbf('0x6')),'faxMessage':require(_0x4bbf('0x7')),'whatsappMessage':require(_0x4bbf('0x8')),'chatInteraction':require(_0x4bbf('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x4bbf('0xa')),'smsInteraction':require(_0x4bbf('0xb')),'faxInteraction':require(_0x4bbf('0xc')),'whatsappInteraction':require(_0x4bbf('0xd'))};var mailRpc=require(_0x4bbf('0xe'));exports[_0x4bbf('0xf')]=function(_0x633367,_0x2d7c0c,_0x42086e,_0x4762f9){return function(_0x13a456){try{var _0x406910=this['channel'];if(_0x406910===_0x4bbf('0x10')&&_0x4762f9[_0x4bbf('0x11')][_0x4bbf('0x12')]){logger['info'](_0x4bbf('0x13'),_0x633367,_0x4bbf('0x14'));return _0x13a456[_0x4bbf('0x15')]();}if(_0x2d7c0c[0x0]==='1'&&(_[_0x4bbf('0x16')](this[_0x4bbf('0x17')][_0x4bbf('0x18')])||!this['interaction']['created'])){logger[_0x4bbf('0x19')]('[%s][AUTOREPLY]\x20%s',_0x633367,_0x4bbf('0x1a'));return _0x13a456['next']();}if(_0x2d7c0c[0x0]==='2'&&this[_0x4bbf('0x17')]['autoreplyExecuted']){logger[_0x4bbf('0x19')](_0x4bbf('0x1b'),_0x633367,_0x4bbf('0x1c'));return _0x13a456[_0x4bbf('0x15')]();}var _0x13f5a7={'ContactId':this[_0x4bbf('0x1d')]['id'],'sentAt':moment()['format'](_0x4bbf('0x1e')),'direction':'out'};if(this[_0x4bbf('0x1f')]===_0x4bbf('0x10')){_0x13f5a7[_0x4bbf('0x11')]=utils['getMustacheRender'](_0x2d7c0c[0x2],this);}else{_0x13f5a7[_0x4bbf('0x11')]=utils[_0x4bbf('0x20')](_0x2d7c0c[0x1],this);}if(this[_0x4bbf('0x21')]){_0x13f5a7['to']=this['message'][_0x4bbf('0x22')]||'';if(this[_0x4bbf('0x1f')]===_0x4bbf('0x10')&&_0x2d7c0c[0x1]==='1'){_0x13f5a7['cc']=this['message']['cc']||'';}_0x13f5a7[_0x4bbf('0x22')]=this[_0x4bbf('0x21')]['to']||'';_0x13f5a7[_0x4bbf('0x23')]=this['message']['phone']||'';_0x13f5a7[_0x4bbf('0x24')]=!![];if(this[_0x4bbf('0x21')][_0x4bbf('0x25')]){_0x13f5a7[_0x4bbf('0x25')]='';_0x13f5a7[_0x4bbf('0x25')]+=_[_0x4bbf('0x26')](this[_0x4bbf('0x21')][_0x4bbf('0x25')],_0x4bbf('0x27'))?'':'Re:\x20';_0x13f5a7[_0x4bbf('0x25')]+=this['message'][_0x4bbf('0x25')];}}if(this[_0x4bbf('0x1f')]===_0x4bbf('0x28')){_0x13f5a7[_0x4bbf('0x29')]=this[_0x4bbf('0x2a')]['id'];}else{_0x13f5a7[_['upperFirst'](this[_0x4bbf('0x1f')])+_0x4bbf('0x2b')]=this['account']['id'];}_0x13f5a7[_[_0x4bbf('0x2c')](this[_0x4bbf('0x1f')])+_0x4bbf('0x2d')]=this[_0x4bbf('0x17')]['id'];var _0x6bd873=this['interaction'];if(rpc[this[_0x4bbf('0x1f')]+'Message']){if(this['channel']==='mail'){_0x13f5a7['inReplyTo']=this[_0x4bbf('0x21')][_0x4bbf('0x2e')];_0x13f5a7[_0x4bbf('0x2f')]=''+_[_0x4bbf('0x30')](_0x13f5a7[_0x4bbf('0x11')],_0x4bbf('0x31'),_0x4bbf('0x32'))+_0x4bbf('0x33');_0x13f5a7['headers']={'Auto-Submitted':_0x4bbf('0x34'),'X-Auto-Response-Suppress':_0x4bbf('0x35'),'Precedence':_0x4bbf('0x36')};return mailRpc[_0x4bbf('0x37')](this[_0x4bbf('0x2a')]['smtpOptions'],_0x13f5a7)['then'](function(_0x5d18c3){logger[_0x4bbf('0x19')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x633367);_0x13f5a7[_0x4bbf('0x2e')]=_0x5d18c3['message'][_0x4bbf('0x2e')];return rpc[_0x406910+'Message'][_0x4bbf('0x38')](_0x13f5a7);})['then'](function(_0x1cee13){logger['info']('[%s][AUTOREPLY]\x20%s',_0x633367,JSON['stringify'](_0x1cee13));})[_0x4bbf('0x39')](function(_0x378d40){logger['error'](_0x4bbf('0x3a'),_0x633367,JSON['stringify'](_0x378d40));})[_0x4bbf('0x3b')](function(){Promise[_0x4bbf('0x3c')]()[_0x4bbf('0x3d')](function(){if(_0x2d7c0c[0x0]!=='2'||_0x6bd873[_0x4bbf('0x3e')])return;return rpc[_0x406910+_0x4bbf('0x3f')][_0x4bbf('0x40')](_0x6bd873['id'],{'autoreplyExecuted':!![]})[_0x4bbf('0x3d')](function(_0x6f3b32){logger['info'](_0x4bbf('0x1b'),_0x633367,JSON[_0x4bbf('0x41')](_0x6f3b32));})[_0x4bbf('0x39')](function(_0x1b8968){logger['error'](_0x4bbf('0x42'),_0x633367,JSON['stringify'](_0x1b8968));});})[_0x4bbf('0x3d')](function(){_0x13a456[_0x4bbf('0x15')]();});});}else{return rpc[this['channel']+_0x4bbf('0x43')]['create'](_0x13f5a7)[_0x4bbf('0x3d')](function(){logger[_0x4bbf('0x19')]('[%s][AUTOREPLY]\x20%s',_0x633367,_0x13f5a7['body']);})[_0x4bbf('0x39')](function(_0x3b171c){logger['error'](_0x4bbf('0x13'),_0x633367,JSON[_0x4bbf('0x41')](_0x3b171c));})[_0x4bbf('0x3b')](function(){Promise['resolve']()['then'](function(){if(_0x2d7c0c[0x0]!=='2'||_0x6bd873[_0x4bbf('0x3e')])return;return rpc[_0x406910+_0x4bbf('0x3f')][_0x4bbf('0x40')](_0x6bd873['id'],{'autoreplyExecuted':!![]})[_0x4bbf('0x3d')](function(_0x1f23eb){logger[_0x4bbf('0x19')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x633367,JSON[_0x4bbf('0x41')](_0x1f23eb));})['catch'](function(_0x11200a){logger['error'](_0x4bbf('0x42'),_0x633367,JSON['stringify'](_0x11200a));});})[_0x4bbf('0x3d')](function(){_0x13a456[_0x4bbf('0x15')]();});});}}}catch(_0xa4e22){logger[_0x4bbf('0x44')](_0x4bbf('0x13'),_0x633367,JSON[_0x4bbf('0x41')](_0xa4e22));_0x13a456[_0x4bbf('0x45')]();}};}; \ 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 f3fac28..0b36f72 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 _0xd818=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','[%s][CLOSE]\x20%s','stringify','finally','error','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x1a25a7,_0x4c2252){var _0x382c41=function(_0x47d7a8){while(--_0x47d7a8){_0x1a25a7['push'](_0x1a25a7['shift']());}};_0x382c41(++_0x4c2252);}(_0xd818,0x179));var _0x8d81=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xd818[_0x1a0daa];return _0x1dbe15;};'use strict';var moment=require('moment');var logger=require(_0x8d81('0x0'))(_0x8d81('0x1'));var rpc={'chatInteraction':require(_0x8d81('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x8d81('0x3')),'mailInteraction':require(_0x8d81('0x4')),'faxInteraction':require(_0x8d81('0x5')),'whatsappInteraction':require(_0x8d81('0x6'))};exports[_0x8d81('0x7')]=function(_0xb85fdc,_0x2ae265,_0x519ba9,_0x4bbd8a){return function(_0x24dd74){try{logger['info'](_0x8d81('0x8'),_0xb85fdc,_0x2ae265[0x0]);var _0x2f4846={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x8d81('0x9'),'disposition':_0x2ae265[0x0]};if(rpc[_0x4bbd8a[_0x8d81('0xa')]+'Interaction']){rpc[_0x4bbd8a[_0x8d81('0xa')]+_0x8d81('0xb')][_0x8d81('0xc')](_0x4bbd8a['interaction']['id'],_0x2f4846)['then'](function(_0x389aa1){logger['info'](_0x8d81('0xd'),_0xb85fdc,_0x4bbd8a[_0x8d81('0xe')]['id']);})['catch'](function(_0x4115af){logger['error'](_0x8d81('0xf'),_0xb85fdc,JSON[_0x8d81('0x10')](_0x4115af));})[_0x8d81('0x11')](function(){_0x24dd74['stop']();});}}catch(_0x1f3ded){logger[_0x8d81('0x12')](_0x8d81('0xf'),_0xb85fdc,JSON['stringify'](_0x1f3ded));_0x24dd74['stop']();}};}; \ No newline at end of file +var _0x7851=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7851,0x13e));var _0x1785=function(_0x2290d4,_0x15fe39){_0x2290d4=_0x2290d4-0x0;var _0x2212c9=_0x7851[_0x2290d4];return _0x2212c9;};'use strict';var moment=require(_0x1785('0x0'));var logger=require(_0x1785('0x1'))('routing');var rpc={'chatInteraction':require(_0x1785('0x2')),'openchannelInteraction':require(_0x1785('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1785('0x4')),'whatsappInteraction':require(_0x1785('0x5'))};exports[_0x1785('0x6')]=function(_0x45583e,_0x2cfd76,_0x470a42,_0xa67cd){return function(_0x4fc575){try{logger['info'](_0x1785('0x7'),_0x45583e,_0x2cfd76[0x0]);var _0x38435a={'closed':0x1,'closedAt':moment()[_0x1785('0x8')](_0x1785('0x9')),'closeReason':_0x1785('0xa'),'disposition':_0x2cfd76[0x0]};if(rpc[_0xa67cd['channel']+_0x1785('0xb')]){rpc[_0xa67cd[_0x1785('0xc')]+_0x1785('0xb')][_0x1785('0xd')](_0xa67cd[_0x1785('0xe')]['id'],_0x38435a)[_0x1785('0xf')](function(_0x5529a1){logger['info'](_0x1785('0x10'),_0x45583e,_0xa67cd[_0x1785('0xe')]['id']);})[_0x1785('0x11')](function(_0x1449f8){logger[_0x1785('0x12')](_0x1785('0x13'),_0x45583e,JSON[_0x1785('0x14')](_0x1449f8));})[_0x1785('0x15')](function(){_0x4fc575[_0x1785('0x16')]();});}}catch(_0x4f1869){logger[_0x1785('0x12')]('[%s][CLOSE]\x20%s',_0x45583e,JSON[_0x1785('0x14')](_0x4f1869));_0x4fc575[_0x1785('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 78cbd39..5605d2d 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 _0xc1dc=['[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','result','fulfillment','speech','providerName','providerResponse','metadata','lodash','moment','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info'];(function(_0x188e18,_0x573161){var _0x220701=function(_0xf2ef49){while(--_0xf2ef49){_0x188e18['push'](_0x188e18['shift']());}};_0x220701(++_0x573161);}(_0xc1dc,0x84));var _0xcc1d=function(_0x5f71a9,_0x30d620){_0x5f71a9=_0x5f71a9-0x0;var _0x5b5b4e=_0xc1dc[_0x5f71a9];return _0x5b5b4e;};'use strict';var _=require(_0xcc1d('0x0'));var moment=require(_0xcc1d('0x1'));var apiai=require(_0xcc1d('0x2'));var md5=require('md5');var utils=require(_0xcc1d('0x3'));var logger=require('../../../../config/logger')(_0xcc1d('0x4'));var rpc={'chatMessage':require(_0xcc1d('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcc1d('0x6')),'smsMessage':require(_0xcc1d('0x7')),'faxMessage':require(_0xcc1d('0x8')),'whatsappMessage':require(_0xcc1d('0x9'))};exports[_0xcc1d('0xa')]=function(_0x597eb8,_0x4dc8ee){return function(_0x23e085){try{if(!_[_0xcc1d('0xb')](this[_0xcc1d('0xc')][_0xcc1d('0xd')])){logger[_0xcc1d('0xe')](_0xcc1d('0xf'),_0x597eb8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x23e085[_0xcc1d('0x10')]();}var _0x27e81c={'ContactId':this[_0xcc1d('0x11')]['id'],'sentAt':moment()[_0xcc1d('0x12')](_0xcc1d('0x13')),'direction':_0xcc1d('0x14')};if(this['channel']===_0xcc1d('0x15')||this[_0xcc1d('0x16')]==='whatsapp'){_0x27e81c[_0xcc1d('0x17')]=this[_0xcc1d('0xc')][_0xcc1d('0x17')];}var _0x45b520=this[_0xcc1d('0x16')];if(_0x45b520===_0xcc1d('0x18')){_0x27e81c[_0xcc1d('0x19')]=this['account']['id'];}else{_0x27e81c[_['upperFirst'](_0x45b520)+_0xcc1d('0x1a')]=this['account']['id'];}_0x27e81c[_[_0xcc1d('0x1b')](_0x45b520)+_0xcc1d('0x1c')]=this[_0xcc1d('0xc')]['id'];if(this[_0xcc1d('0xc')][_0xcc1d('0x1d')]){var _0x2bf07a=_0x4dc8ee[0x2];if(!_[_0xcc1d('0x1e')](_0x2bf07a)){_0x27e81c[_0xcc1d('0x1f')]=utils[_0xcc1d('0x20')](_0x2bf07a,this);return rpc[_0x45b520+_0xcc1d('0x21')]['create'](_0x27e81c)['then'](function(_0x2ee388){logger['info'](_0xcc1d('0xf'),_0x597eb8,_0x27e81c[_0xcc1d('0x1f')]);})[_0xcc1d('0x22')](function(_0x104c54){logger[_0xcc1d('0x23')](_0xcc1d('0xf'),_0x597eb8,JSON[_0xcc1d('0x24')](_0x104c54));})[_0xcc1d('0x25')](function(){logger[_0xcc1d('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x597eb8);_0x23e085[_0xcc1d('0x26')]();});}else{logger['info'](_0xcc1d('0x27'),_0x597eb8);_0x23e085[_0xcc1d('0x26')]();}}else{var _0x167b9f=this;var _0x5a2df6=apiai(_0x4dc8ee[0x0],{'language':_0x4dc8ee[0x1]||'en'});return _0x5a2df6[_0xcc1d('0x28')](this[_0xcc1d('0x29')][_0xcc1d('0x1f')],{'sessionId':md5(this[_0xcc1d('0xc')]['id'])})[_0xcc1d('0x2a')](function(_0x5e2f74){_0x167b9f[_0xcc1d('0x1f')]['dialogflow']=_0x5e2f74;_0x27e81c[_0xcc1d('0x1f')]=_0x5e2f74[_0xcc1d('0x2b')][_0xcc1d('0x2c')][_0xcc1d('0x2d')];_0x27e81c[_0xcc1d('0x2e')]='dialogflow';_0x27e81c[_0xcc1d('0x2f')]=JSON[_0xcc1d('0x24')](_0x5e2f74);return rpc[_0x45b520+_0xcc1d('0x21')]['create'](_0x27e81c)[_0xcc1d('0x2a')](function(_0x491edb){logger[_0xcc1d('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,_0x27e81c[_0xcc1d('0x1f')]);if(_0x5e2f74[_0xcc1d('0x2b')][_0xcc1d('0x30')]['endConversation']){_0x23e085[_0xcc1d('0x10')]();}else{_0x23e085[_0xcc1d('0x26')]();}})[_0xcc1d('0x22')](function(_0x4a406f){logger[_0xcc1d('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,JSON[_0xcc1d('0x24')](_0x4a406f));_0x23e085[_0xcc1d('0x10')]();});})[_0xcc1d('0x22')](function(_0x380bd2){logger[_0xcc1d('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,_0x380bd2[_0xcc1d('0x29')]);_0x23e085[_0xcc1d('0x10')]();});}}catch(_0x4cbe87){logger[_0xcc1d('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,JSON[_0xcc1d('0x24')](_0x4cbe87));_0x23e085['stop']();}};}; \ No newline at end of file +var _0x9219=['consequence','isNil','interaction','UserId','next','contact','out','channel','sms','phone','ChatWebsiteId','account','AccountId','upperFirst','created','isEmpty','body','getMustacheRender','Message','then','info','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','result','fulfillment','dialogflow','providerResponse','metadata','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x9219,0x19e));var _0x9921=function(_0x2a9c59,_0x515695){_0x2a9c59=_0x2a9c59-0x0;var _0x9a7fb1=_0x9219[_0x2a9c59];return _0x9a7fb1;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x9921('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x9921('0x1')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9921('0x2')),'faxMessage':require(_0x9921('0x3')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9921('0x4')]=function(_0x26d1db,_0x16edb8){return function(_0x2fd860){try{if(!_[_0x9921('0x5')](this[_0x9921('0x6')][_0x9921('0x7')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x26d1db,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2fd860[_0x9921('0x8')]();}var _0x4b975c={'ContactId':this[_0x9921('0x9')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9921('0xa')};if(this[_0x9921('0xb')]===_0x9921('0xc')||this[_0x9921('0xb')]==='whatsapp'){_0x4b975c[_0x9921('0xd')]=this['interaction']['phone'];}var _0x411bfd=this[_0x9921('0xb')];if(_0x411bfd==='chat'){_0x4b975c[_0x9921('0xe')]=this[_0x9921('0xf')]['id'];}else{_0x4b975c[_['upperFirst'](_0x411bfd)+_0x9921('0x10')]=this[_0x9921('0xf')]['id'];}_0x4b975c[_[_0x9921('0x11')](_0x411bfd)+'InteractionId']=this[_0x9921('0x6')]['id'];if(this[_0x9921('0x6')][_0x9921('0x12')]){var _0x4ad6e1=_0x16edb8[0x2];if(!_[_0x9921('0x13')](_0x4ad6e1)){_0x4b975c[_0x9921('0x14')]=utils[_0x9921('0x15')](_0x4ad6e1,this);return rpc[_0x411bfd+_0x9921('0x16')]['create'](_0x4b975c)[_0x9921('0x17')](function(_0x291874){logger[_0x9921('0x18')]('[%s][DIALOGFLOW]\x20%s',_0x26d1db,_0x4b975c[_0x9921('0x14')]);})[_0x9921('0x19')](function(_0x25b02a){logger[_0x9921('0x1a')](_0x9921('0x1b'),_0x26d1db,JSON[_0x9921('0x1c')](_0x25b02a));})['finally'](function(){logger[_0x9921('0x18')](_0x9921('0x1d'),_0x26d1db);_0x2fd860[_0x9921('0x1e')]();});}else{logger[_0x9921('0x18')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x26d1db);_0x2fd860[_0x9921('0x1e')]();}}else{var _0x3d1f40=this;var _0x24023b=apiai(_0x16edb8[0x0],{'language':_0x16edb8[0x1]||'en'});return _0x24023b[_0x9921('0x1f')](this[_0x9921('0x20')][_0x9921('0x14')],{'sessionId':md5(this[_0x9921('0x6')]['id'])})[_0x9921('0x17')](function(_0x2bc3f7){_0x3d1f40[_0x9921('0x14')]['dialogflow']=_0x2bc3f7;_0x4b975c['body']=_0x2bc3f7[_0x9921('0x21')][_0x9921('0x22')]['speech'];_0x4b975c['providerName']=_0x9921('0x23');_0x4b975c[_0x9921('0x24')]=JSON[_0x9921('0x1c')](_0x2bc3f7);return rpc[_0x411bfd+_0x9921('0x16')]['create'](_0x4b975c)[_0x9921('0x17')](function(_0x491300){logger[_0x9921('0x18')](_0x9921('0x1b'),_0x26d1db,_0x4b975c[_0x9921('0x14')]);if(_0x2bc3f7['result'][_0x9921('0x25')]['endConversation']){_0x2fd860[_0x9921('0x8')]();}else{_0x2fd860[_0x9921('0x1e')]();}})[_0x9921('0x19')](function(_0x486446){logger[_0x9921('0x1a')](_0x9921('0x1b'),_0x26d1db,JSON['stringify'](_0x486446));_0x2fd860[_0x9921('0x8')]();});})[_0x9921('0x19')](function(_0x1d0874){logger[_0x9921('0x1a')](_0x9921('0x1b'),_0x26d1db,_0x1d0874[_0x9921('0x20')]);_0x2fd860[_0x9921('0x8')]();});}}catch(_0x4629e3){logger['error'](_0x9921('0x1b'),_0x26d1db,JSON[_0x9921('0x1c')](_0x4629e3));_0x2fd860['stop']();}};}; \ 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 9185d00..c943e1a 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 _0xd765=['finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','replace','SessionsClient','message','detectIntent','length','dialogflowV2','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','queryResult','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','stop','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','then'];(function(_0x1afc70,_0x3c3620){var _0x313b62=function(_0x5a1c79){while(--_0x5a1c79){_0x1afc70['push'](_0x1afc70['shift']());}};_0x313b62(++_0x3c3620);}(_0xd765,0xb5));var _0x5d76=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd765[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x5d76('0x0'));var dialogflow=require(_0x5d76('0x1'));var md5=require(_0x5d76('0x2'));var moment=require('moment');var Promise=require(_0x5d76('0x3'));var logger=require(_0x5d76('0x4'))(_0x5d76('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0x5d76('0x6')),'openchannelMessage':require(_0x5d76('0x7')),'mailMessage':require(_0x5d76('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5d76('0x9')),'whatsappMessage':require(_0x5d76('0xa'))};function createMessage(_0x576a1b,_0x49aaf5,_0x1e6065,_0x4ed531){return new Promise(function(_0x3c4f63,_0x1b472f){var _0x4f6668=_['clone'](_0x1e6065);_0x4f6668[_0x5d76('0xb')]=_0x4ed531;return rpc[_0x49aaf5+_0x5d76('0xc')][_0x5d76('0xd')](_0x4f6668)['then'](function(){logger[_0x5d76('0xe')](_0x5d76('0xf'),_0x576a1b,_0x4f6668['body']);_0x3c4f63();})[_0x5d76('0x10')](function(_0x50e31f){logger[_0x5d76('0x11')](_0x5d76('0xf'),_0x576a1b,JSON[_0x5d76('0x12')](_0x50e31f));_0x1b472f(_0x50e31f);});});}exports[_0x5d76('0x13')]=function(_0x15f76c,_0x573503){return function(_0x165d51){try{if(!_[_0x5d76('0x14')](this[_0x5d76('0x15')][_0x5d76('0x16')])){logger[_0x5d76('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x15f76c,_0x5d76('0x17'));return _0x165d51[_0x5d76('0x18')]();}var _0x34e729={'ContactId':this[_0x5d76('0x19')]['id'],'sentAt':moment()[_0x5d76('0x1a')](_0x5d76('0x1b')),'direction':_0x5d76('0x1c')};if(this[_0x5d76('0x1d')]===_0x5d76('0x1e')||this[_0x5d76('0x1d')]===_0x5d76('0x1f')){_0x34e729['phone']=this[_0x5d76('0x15')]['phone'];}var _0x31c6d2=this['channel'];if(_0x31c6d2==='chat'){_0x34e729[_0x5d76('0x20')]=this[_0x5d76('0x21')]['id'];}else{_0x34e729[_[_0x5d76('0x22')](_0x31c6d2)+_0x5d76('0x23')]=this[_0x5d76('0x21')]['id'];}_0x34e729[_['upperFirst'](_0x31c6d2)+_0x5d76('0x24')]=this[_0x5d76('0x15')]['id'];if(this[_0x5d76('0x15')][_0x5d76('0x25')]){var _0x2149d8=_0x573503[0x4];if(!_[_0x5d76('0x26')](_0x2149d8)){_0x34e729[_0x5d76('0xb')]=utils[_0x5d76('0x27')](_0x2149d8,this);return rpc[_0x31c6d2+_0x5d76('0xc')][_0x5d76('0xd')](_0x34e729)[_0x5d76('0x28')](function(_0xf278b0){logger['info'](_0x5d76('0xf'),_0x15f76c,_0x34e729[_0x5d76('0xb')]);})['catch'](function(_0x2c02a0){logger[_0x5d76('0x11')](_0x5d76('0xf'),_0x15f76c,JSON[_0x5d76('0x12')](_0x2c02a0));})[_0x5d76('0x29')](function(){logger[_0x5d76('0xe')](_0x5d76('0x2a'),_0x15f76c);_0x165d51['stop']();});}else{logger[_0x5d76('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x15f76c);_0x165d51['stop']();}}else{var _0x5d3a87=this;var _0x2af44c=_0x573503[0x2][_0x5d76('0x2b')](/\\n/g,'\x0a');var _0x43b5a2={'credentials':{'private_key':_0x2af44c,'client_email':_0x573503[0x1]}};var _0x2ac469=new dialogflow[(_0x5d76('0x2c'))](_0x43b5a2);var _0x35662d=_0x2ac469['sessionPath'](_0x573503[0x0],md5(_0x5d3a87[_0x5d76('0x15')]['id']));var _0x13ce69={'session':_0x35662d,'queryInput':{'text':{'text':_0x5d3a87[_0x5d76('0x2d')][_0x5d76('0xb')],'languageCode':_0x573503[0x3]||'en'}}};return _0x2ac469[_0x5d76('0x2e')](_0x13ce69)[_0x5d76('0x28')](function(_0x1cf38c){if(_0x1cf38c&&_0x1cf38c[_0x5d76('0x2f')]){_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x30')]=_0x1cf38c;var _0x558aa0=_0x1cf38c[0x0];var _0x43648c=_0x558aa0['queryResult'][_0x5d76('0x31')]&&_0x558aa0['queryResult'][_0x5d76('0x31')][_0x5d76('0x32')]?_0x558aa0['queryResult'][_0x5d76('0x31')][_0x5d76('0x32')][_0x5d76('0x33')][_0x5d76('0x34')]:![];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x35')]=_0x558aa0['queryResult'][_0x5d76('0x36')];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x37')]=_0x558aa0[_0x5d76('0x38')][_0x5d76('0x39')];_0x5d3a87[_0x5d76('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x558aa0['queryResult'][_0x5d76('0x31')]&&_0x558aa0[_0x5d76('0x38')]['diagnosticInfo'][_0x5d76('0x32')]?_0x558aa0[_0x5d76('0x38')][_0x5d76('0x31')][_0x5d76('0x32')]['end_conversation'][_0x5d76('0x34')]:![];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x3a')]=_0x558aa0['queryResult']['intent']['name'];_0x5d3a87['body'][_0x5d76('0x3b')]=_0x558aa0[_0x5d76('0x38')][_0x5d76('0x3c')][_0x5d76('0x3d')];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x3e')]=_0x558aa0[_0x5d76('0x38')]['intent'][_0x5d76('0x3f')];_0x5d3a87['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x558aa0['queryResult'][_0x5d76('0x40')];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x41')]=_0x558aa0[_0x5d76('0x38')][_0x5d76('0x42')];_0x5d3a87[_0x5d76('0xb')]['DIALOGFLOWV2_SCORE']=_0x558aa0['queryResult'][_0x5d76('0x43')];_0x34e729[_0x5d76('0x44')]=_0x5d76('0x30');_0x34e729[_0x5d76('0x45')]=JSON[_0x5d76('0x12')](_0x1cf38c);var _0x3d245=[];for(var _0x56b1c0=0x0;_0x56b1c0<_0x1cf38c[_0x5d76('0x2f')];_0x56b1c0++){var _0x5e6d94=_0x1cf38c[_0x56b1c0];if(_0x5e6d94&&_0x5e6d94[_0x5d76('0x38')]&&_0x5e6d94['queryResult']['fulfillmentText']){_0x3d245[_0x5d76('0x46')](createMessage(_0x15f76c,_0x31c6d2,_0x34e729,_0x5e6d94[_0x5d76('0x38')][_0x5d76('0x47')]));}}return Promise[_0x5d76('0x48')](_0x3d245)[_0x5d76('0x28')](function(){if(_0x43648c){_0x165d51[_0x5d76('0x18')]();}else{_0x165d51[_0x5d76('0x49')]();}})[_0x5d76('0x10')](function(_0x481526){logger[_0x5d76('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x15f76c,JSON[_0x5d76('0x12')](_0x481526));_0x165d51[_0x5d76('0x18')]();});}})[_0x5d76('0x10')](function(_0x8a8223){logger['error'](_0x5d76('0xf'),_0x15f76c,_0x8a8223[_0x5d76('0x2d')],_0x8a8223['stack']);_0x165d51[_0x5d76('0x18')]();});}}catch(_0x96cdba){logger[_0x5d76('0x11')](_0x5d76('0xf'),_0x15f76c,JSON[_0x5d76('0x12')](_0x96cdba));_0x165d51[_0x5d76('0x49')]();}};}; \ No newline at end of file +var _0xb9de=['whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','fields','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','stringify','length','fulfillmentText','push','message','stack','lodash','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','consequence','isNil','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms'];(function(_0x249b9f,_0x2e6e3f){var _0x413e5c=function(_0x2e97b5){while(--_0x2e97b5){_0x249b9f['push'](_0x249b9f['shift']());}};_0x413e5c(++_0x2e6e3f);}(_0xb9de,0x1d9));var _0xeb9d=function(_0x523460,_0x4b14f6){_0x523460=_0x523460-0x0;var _0x254954=_0xb9de[_0x523460];return _0x254954;};'use strict';var _=require(_0xeb9d('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xeb9d('0x1'))('routing');var utils=require(_0xeb9d('0x2'));var rpc={'chatMessage':require(_0xeb9d('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xeb9d('0x4')),'smsMessage':require(_0xeb9d('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x42c39a,_0x14ee6d,_0x1efd95,_0x534c78){return new Promise(function(_0x3891da,_0x373bc2){var _0x4ec2b0=_[_0xeb9d('0x6')](_0x1efd95);_0x4ec2b0['body']=_0x534c78;return rpc[_0x14ee6d+_0xeb9d('0x7')][_0xeb9d('0x8')](_0x4ec2b0)[_0xeb9d('0x9')](function(){logger[_0xeb9d('0xa')](_0xeb9d('0xb'),_0x42c39a,_0x4ec2b0[_0xeb9d('0xc')]);_0x3891da();})[_0xeb9d('0xd')](function(_0x504158){logger[_0xeb9d('0xe')](_0xeb9d('0xb'),_0x42c39a,JSON['stringify'](_0x504158));_0x373bc2(_0x504158);});});}exports[_0xeb9d('0xf')]=function(_0x37e67f,_0x31d631){return function(_0x54d1df){try{if(!_[_0xeb9d('0x10')](this['interaction'][_0xeb9d('0x11')])){logger[_0xeb9d('0xa')](_0xeb9d('0xb'),_0x37e67f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x54d1df[_0xeb9d('0x12')]();}var _0x25dfdd={'ContactId':this[_0xeb9d('0x13')]['id'],'sentAt':moment()['format'](_0xeb9d('0x14')),'direction':_0xeb9d('0x15')};if(this[_0xeb9d('0x16')]===_0xeb9d('0x17')||this[_0xeb9d('0x16')]===_0xeb9d('0x18')){_0x25dfdd[_0xeb9d('0x19')]=this[_0xeb9d('0x1a')][_0xeb9d('0x19')];}var _0x5d0b32=this[_0xeb9d('0x16')];if(_0x5d0b32===_0xeb9d('0x1b')){_0x25dfdd[_0xeb9d('0x1c')]=this[_0xeb9d('0x1d')]['id'];}else{_0x25dfdd[_[_0xeb9d('0x1e')](_0x5d0b32)+_0xeb9d('0x1f')]=this[_0xeb9d('0x1d')]['id'];}_0x25dfdd[_[_0xeb9d('0x1e')](_0x5d0b32)+_0xeb9d('0x20')]=this[_0xeb9d('0x1a')]['id'];if(this[_0xeb9d('0x1a')][_0xeb9d('0x21')]){var _0x69e55e=_0x31d631[0x4];if(!_[_0xeb9d('0x22')](_0x69e55e)){_0x25dfdd[_0xeb9d('0xc')]=utils[_0xeb9d('0x23')](_0x69e55e,this);return rpc[_0x5d0b32+'Message'][_0xeb9d('0x8')](_0x25dfdd)[_0xeb9d('0x9')](function(_0x5da244){logger[_0xeb9d('0xa')](_0xeb9d('0xb'),_0x37e67f,_0x25dfdd[_0xeb9d('0xc')]);})['catch'](function(_0x5557c5){logger[_0xeb9d('0xe')](_0xeb9d('0xb'),_0x37e67f,JSON['stringify'](_0x5557c5));})[_0xeb9d('0x24')](function(){logger['info'](_0xeb9d('0x25'),_0x37e67f);_0x54d1df[_0xeb9d('0x26')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x37e67f);_0x54d1df['stop']();}}else{var _0x3c0193=this;var _0x130ac0=_0x31d631[0x2][_0xeb9d('0x27')](/\\n/g,'\x0a');var _0x4c5f5b={'credentials':{'private_key':_0x130ac0,'client_email':_0x31d631[0x1]}};var _0x548c0f=new dialogflow[(_0xeb9d('0x28'))](_0x4c5f5b);var _0x3d40c5=_0x548c0f[_0xeb9d('0x29')](_0x31d631[0x0],md5(_0x3c0193[_0xeb9d('0x1a')]['id']));var _0x172060={'session':_0x3d40c5,'queryInput':{'text':{'text':_0x3c0193['message'][_0xeb9d('0xc')],'languageCode':_0x31d631[0x3]||'en'}}};return _0x548c0f[_0xeb9d('0x2a')](_0x172060)[_0xeb9d('0x9')](function(_0x374122){if(_0x374122&&_0x374122['length']){_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x2b')]=_0x374122;var _0x3a7415=_0x374122[0x0];var _0x23c10d=_0x3a7415[_0xeb9d('0x2c')]['diagnosticInfo']&&_0x3a7415[_0xeb9d('0x2c')][_0xeb9d('0x2d')]['fields']?_0x3a7415[_0xeb9d('0x2c')][_0xeb9d('0x2d')]['fields'][_0xeb9d('0x2e')][_0xeb9d('0x2f')]:![];_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x30')]=_0x3a7415['queryResult'][_0xeb9d('0x31')];_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x32')]=_0x3a7415[_0xeb9d('0x2c')]['allRequiredParamsPresent'];_0x3c0193['body'][_0xeb9d('0x33')]=_0x3a7415['queryResult'][_0xeb9d('0x2d')]&&_0x3a7415['queryResult'][_0xeb9d('0x2d')][_0xeb9d('0x34')]?_0x3a7415[_0xeb9d('0x2c')][_0xeb9d('0x2d')][_0xeb9d('0x34')][_0xeb9d('0x2e')]['boolValue']:![];_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x35')]=_0x3a7415['queryResult']['intent']['name'];_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x36')]=_0x3a7415['queryResult'][_0xeb9d('0x37')][_0xeb9d('0x38')];_0x3c0193['body'][_0xeb9d('0x39')]=_0x3a7415[_0xeb9d('0x2c')]['intent'][_0xeb9d('0x3a')];_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x3b')]=_0x3a7415[_0xeb9d('0x2c')][_0xeb9d('0x3c')];_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x3d')]=_0x3a7415[_0xeb9d('0x2c')][_0xeb9d('0x3e')];_0x3c0193[_0xeb9d('0xc')][_0xeb9d('0x3f')]=_0x3a7415[_0xeb9d('0x2c')]['intentDetectionConfidence'];_0x25dfdd[_0xeb9d('0x40')]=_0xeb9d('0x2b');_0x25dfdd['providerResponse']=JSON[_0xeb9d('0x41')](_0x374122);var _0x4e3842=[];for(var _0x5196ca=0x0;_0x5196ca<_0x374122[_0xeb9d('0x42')];_0x5196ca++){var _0x60167f=_0x374122[_0x5196ca];if(_0x60167f&&_0x60167f['queryResult']&&_0x60167f[_0xeb9d('0x2c')][_0xeb9d('0x43')]){_0x4e3842[_0xeb9d('0x44')](createMessage(_0x37e67f,_0x5d0b32,_0x25dfdd,_0x60167f['queryResult']['fulfillmentText']));}}return Promise['all'](_0x4e3842)[_0xeb9d('0x9')](function(){if(_0x23c10d){_0x54d1df[_0xeb9d('0x12')]();}else{_0x54d1df[_0xeb9d('0x26')]();}})['catch'](function(_0x2a1ab5){logger[_0xeb9d('0xe')](_0xeb9d('0xb'),_0x37e67f,JSON[_0xeb9d('0x41')](_0x2a1ab5));_0x54d1df[_0xeb9d('0x12')]();});}})[_0xeb9d('0xd')](function(_0x39a47c){logger[_0xeb9d('0xe')](_0xeb9d('0xb'),_0x37e67f,_0x39a47c[_0xeb9d('0x45')],_0x39a47c[_0xeb9d('0x46')]);_0x54d1df[_0xeb9d('0x12')]();});}}catch(_0x55009f){logger['error'](_0xeb9d('0xb'),_0x37e67f,JSON[_0xeb9d('0x41')](_0x55009f));_0x54d1df[_0xeb9d('0x26')]();}};}; \ 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 aaa2d7a..56526bb 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 _0x9e54=['routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','stringify','validate','lodash','./utils'];(function(_0x1758c6,_0x126d79){var _0x5da38e=function(_0xb2b125){while(--_0xb2b125){_0x1758c6['push'](_0x1758c6['shift']());}};_0x5da38e(++_0x126d79);}(_0x9e54,0x165));var _0x49e5=function(_0xb1a4df,_0xad7f78){_0xb1a4df=_0xb1a4df-0x0;var _0x4fbd06=_0x9e54[_0xb1a4df];return _0x4fbd06;};'use strict';var schema=require(_0x49e5('0x0'));var _=require(_0x49e5('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x49e5('0x2'));var logger=require('../../../../config/logger')(_0x49e5('0x3'));var gotoif=schema({'condition':{'type':_0x49e5('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x49e5('0x5'),'message':_0x49e5('0x6')},'priorityFalse':{'type':_0x49e5('0x5'),'message':_0x49e5('0x7')}});exports[_0x49e5('0x8')]=function(_0x12e180,_0x1a7df6){return function(_0x43eb49){try{var _0x1240e2={'condition':htmlToText[_0x49e5('0x9')](utils[_0x49e5('0xa')](_0x1a7df6[0x0],this),{'wordwrap':![]})[_0x49e5('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1a7df6[0x1],'priorityFalse':_0x1a7df6[0x2]};var _0x10c497=gotoif['validate'](_0x1240e2,{'typecast':!![]});if(_0x10c497[_0x49e5('0xc')]){logger['error'](_0x49e5('0xd'),_0x12e180,_[_0x49e5('0xe')](_0x10c497,_0x49e5('0xf'))[_0x49e5('0x10')](',\x20'));_0x43eb49[_0x49e5('0x11')]();}else{try{var _0x25d56a=eval('('+_0x1240e2[_0x49e5('0x12')]+')');var _0x3f3c95=_0x25d56a?_0x1240e2[_0x49e5('0x13')]:_0x1240e2['priorityFalse'];logger[_0x49e5('0x14')](_0x49e5('0x15'),_0x12e180,_0x1240e2['condition'],_0x25d56a,_0x3f3c95||'next');if(_0x3f3c95){var _0x45a108=_[_0x49e5('0x16')](_0x43eb49[_0x49e5('0x17')](),{'p':_0x3f3c95});if(_0x45a108>=0x0){logger[_0x49e5('0x14')](_0x49e5('0x18'),_0x12e180,_0x3f3c95||_0x49e5('0x19'),_0x45a108);_0x43eb49[_0x49e5('0x19')](_0x45a108);}else{logger[_0x49e5('0x14')](_0x49e5('0x1a'),_0x12e180,_0x3f3c95||_0x49e5('0x19'));_0x43eb49[_0x49e5('0x11')]();}}else{_0x43eb49[_0x49e5('0x19')]();}}catch(_0x4c53cd){logger['error'](_0x49e5('0x1b'),_0x12e180,_0x4c53cd[_0x49e5('0xf')]);_0x43eb49['stop']();}}}catch(_0x414bcf){logger[_0x49e5('0x1c')](_0x49e5('0xd'),_0x12e180,JSON[_0x49e5('0x1d')](_0x414bcf));_0x43eb49[_0x49e5('0x11')]();}};}; \ No newline at end of file +var _0x4857=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x2d5aea,_0x1fac98){var _0x1b266e=function(_0x394079){while(--_0x394079){_0x2d5aea['push'](_0x2d5aea['shift']());}};_0x1b266e(++_0x1fac98);}(_0x4857,0x111));var _0x7485=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x4857[_0x32b542];return _0x554d54;};'use strict';var schema=require('validate');var _=require(_0x7485('0x0'));var htmlToText=require(_0x7485('0x1'));var utils=require(_0x7485('0x2'));var logger=require(_0x7485('0x3'))(_0x7485('0x4'));var gotoif=schema({'condition':{'type':_0x7485('0x5'),'required':!![],'message':_0x7485('0x6')},'priorityTrue':{'type':_0x7485('0x7'),'message':_0x7485('0x8')},'priorityFalse':{'type':_0x7485('0x7'),'message':_0x7485('0x9')}});exports[_0x7485('0xa')]=function(_0x47f0c1,_0x20d17f){return function(_0x11638c){try{var _0x7041c1={'condition':htmlToText[_0x7485('0xb')](utils[_0x7485('0xc')](_0x20d17f[0x0],this),{'wordwrap':![]})[_0x7485('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x20d17f[0x1],'priorityFalse':_0x20d17f[0x2]};var _0x5dfb93=gotoif['validate'](_0x7041c1,{'typecast':!![]});if(_0x5dfb93[_0x7485('0xe')]){logger[_0x7485('0xf')](_0x7485('0x10'),_0x47f0c1,_[_0x7485('0x11')](_0x5dfb93,_0x7485('0x12'))[_0x7485('0x13')](',\x20'));_0x11638c[_0x7485('0x14')]();}else{try{var _0x42d4b7=eval('('+_0x7041c1['condition']+')');var _0x49aca6=_0x42d4b7?_0x7041c1[_0x7485('0x15')]:_0x7041c1['priorityFalse'];logger['info'](_0x7485('0x16'),_0x47f0c1,_0x7041c1[_0x7485('0x17')],_0x42d4b7,_0x49aca6||_0x7485('0x18'));if(_0x49aca6){var _0x4aaa93=_['findIndex'](_0x11638c['rules'](),{'p':_0x49aca6});if(_0x4aaa93>=0x0){logger['info'](_0x7485('0x19'),_0x47f0c1,_0x49aca6||_0x7485('0x18'),_0x4aaa93);_0x11638c[_0x7485('0x18')](_0x4aaa93);}else{logger[_0x7485('0x1a')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x47f0c1,_0x49aca6||_0x7485('0x18'));_0x11638c[_0x7485('0x14')]();}}else{_0x11638c[_0x7485('0x18')]();}}catch(_0x26cb3d){logger[_0x7485('0xf')](_0x7485('0x1b'),_0x47f0c1,_0x26cb3d[_0x7485('0x12')]);_0x11638c[_0x7485('0x14')]();}}}catch(_0x2c1c7d){logger['error'](_0x7485('0x10'),_0x47f0c1,JSON['stringify'](_0x2c1c7d));_0x11638c[_0x7485('0x14')]();}};}; \ 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 905f38c..022f971 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 _0x9bc7=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','map','message'];(function(_0x57c16e,_0x38659b){var _0x196819=function(_0x1f005a){while(--_0x1f005a){_0x57c16e['push'](_0x57c16e['shift']());}};_0x196819(++_0x38659b);}(_0x9bc7,0xa1));var _0x79bc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9bc7[_0x4b369d];return _0x571a98;};'use strict';var schema=require('validate');var _=require(_0x79bc('0x0'));var logger=require('../../../../config/logger')(_0x79bc('0x1'));var gotop=schema({'priority':{'type':_0x79bc('0x2'),'required':!![],'message':_0x79bc('0x3')}});exports[_0x79bc('0x4')]=function(_0x3b4e90,_0x5d23e3){return function(_0x5c8917){try{var _0x3fb4ad={'priority':_0x5d23e3[0x0]};var _0x209e0b=gotop[_0x79bc('0x5')](_0x3fb4ad,{'typecast':!![]});if(_0x209e0b[_0x79bc('0x6')]){logger['error'](_0x79bc('0x7'),_0x3b4e90,_[_0x79bc('0x8')](_0x209e0b,_0x79bc('0x9'))['join'](',\x20'));_0x5c8917[_0x79bc('0xa')]();}else{logger[_0x79bc('0xb')](_0x79bc('0xc'),_0x3b4e90,_0x3fb4ad[_0x79bc('0xd')]);if(_0x3fb4ad[_0x79bc('0xd')]){var _0x4d6028=_[_0x79bc('0xe')](_0x5c8917['rules'](),{'p':_0x3fb4ad[_0x79bc('0xd')]});if(_0x4d6028>=0x0){logger[_0x79bc('0xb')](_0x79bc('0xf'),_0x3b4e90,_0x3fb4ad[_0x79bc('0xd')]||_0x79bc('0x10'),_0x4d6028);_0x5c8917[_0x79bc('0x10')](_0x4d6028);}else{logger[_0x79bc('0xb')](_0x79bc('0x11'),_0x3b4e90,_0x3fb4ad[_0x79bc('0xd')]||_0x79bc('0x10'));_0x5c8917[_0x79bc('0xa')]();}}else{_0x5c8917['next']();}}}catch(_0x4cb76f){logger[_0x79bc('0x12')](_0x79bc('0x7'),_0x3b4e90,JSON['stringify'](_0x4cb76f));_0x5c8917[_0x79bc('0xa')]();}};}; \ No newline at end of file +var _0xa8aa=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','join'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa8aa,0xf9));var _0xaa8a=function(_0x52a93e,_0x1a8144){_0x52a93e=_0x52a93e-0x0;var _0x31948a=_0xa8aa[_0x52a93e];return _0x31948a;};'use strict';var schema=require(_0xaa8a('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xaa8a('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xaa8a('0x2')}});exports['consequence']=function(_0x1b19cb,_0x4c59bc){return function(_0x33b5c9){try{var _0x45e129={'priority':_0x4c59bc[0x0]};var _0x3b26b1=gotop[_0xaa8a('0x0')](_0x45e129,{'typecast':!![]});if(_0x3b26b1[_0xaa8a('0x3')]){logger['error'](_0xaa8a('0x4'),_0x1b19cb,_[_0xaa8a('0x5')](_0x3b26b1,'message')[_0xaa8a('0x6')](',\x20'));_0x33b5c9[_0xaa8a('0x7')]();}else{logger[_0xaa8a('0x8')](_0xaa8a('0x9'),_0x1b19cb,_0x45e129['priority']);if(_0x45e129[_0xaa8a('0xa')]){var _0x250b3d=_['findIndex'](_0x33b5c9['rules'](),{'p':_0x45e129['priority']});if(_0x250b3d>=0x0){logger[_0xaa8a('0x8')](_0xaa8a('0xb'),_0x1b19cb,_0x45e129['priority']||_0xaa8a('0xc'),_0x250b3d);_0x33b5c9['next'](_0x250b3d);}else{logger['info'](_0xaa8a('0xd'),_0x1b19cb,_0x45e129[_0xaa8a('0xa')]||_0xaa8a('0xc'));_0x33b5c9[_0xaa8a('0x7')]();}}else{_0x33b5c9[_0xaa8a('0xc')]();}}}catch(_0x255896){logger[_0xaa8a('0xe')]('[%s][GOTOP]\x20%s',_0x1b19cb,JSON[_0xaa8a('0xf')](_0x255896));_0x33b5c9[_0xaa8a('0x7')]();}};}; \ 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 22a7ae4..3b80a17 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 _0x2697=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','account','interaction','Message','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop'];(function(_0x3f766c,_0x1fef7c){var _0x36a7db=function(_0x3d221d){while(--_0x3d221d){_0x3f766c['push'](_0x3f766c['shift']());}};_0x36a7db(++_0x1fef7c);}(_0x2697,0x120));var _0x7269=function(_0x15bbf1,_0x40ef96){_0x15bbf1=_0x15bbf1-0x0;var _0x5c4b47=_0x2697[_0x15bbf1];return _0x5c4b47;};'use strict';var _=require('lodash');var utils=require(_0x7269('0x0'));var logger=require(_0x7269('0x1'))(_0x7269('0x2'));var rpc={'chatMessage':require(_0x7269('0x3')),'openchannelMessage':require(_0x7269('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7269('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7269('0x6'))};exports[_0x7269('0x7')]=function(_0x350aeb,_0x320ed5){return function(_0x438f7c){try{var _0x1e47e3={'body':utils[_0x7269('0x8')](_0x320ed5[0x0],this),'ContactId':this[_0x7269('0x9')]['id']};if(this[_0x7269('0xa')]===_0x7269('0xb')){_0x1e47e3[_0x7269('0xc')]=this['account']['id'];}else{_0x1e47e3[_[_0x7269('0xd')](this[_0x7269('0xa')])+'AccountId']=this[_0x7269('0xe')]['id'];}_0x1e47e3[_['upperFirst'](this[_0x7269('0xa')])+'InteractionId']=this[_0x7269('0xf')]['id'];if(rpc[this['channel']+_0x7269('0x10')]){return rpc[this[_0x7269('0xa')]+_0x7269('0x10')]['create'](_0x1e47e3)[_0x7269('0x11')](function(_0x2c5957){logger['info'](_0x7269('0x12'),_0x350aeb,_0x1e47e3[_0x7269('0x13')]);_0x438f7c[_0x7269('0x14')]();})['catch'](function(_0x2ba8ec){logger[_0x7269('0x15')](_0x7269('0x12'),_0x350aeb,JSON[_0x7269('0x16')](_0x2ba8ec));_0x438f7c[_0x7269('0x17')]();});}}catch(_0x44e266){logger[_0x7269('0x15')](_0x7269('0x12'),_0x350aeb,JSON['stringify'](_0x44e266));_0x438f7c[_0x7269('0x17')]();}};}; \ No newline at end of file +var _0x2d28=['next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','account','upperFirst','AccountId','interaction','Message','create','info'];(function(_0xa86e3c,_0x542998){var _0x1dd1ca=function(_0x55c73a){while(--_0x55c73a){_0xa86e3c['push'](_0xa86e3c['shift']());}};_0x1dd1ca(++_0x542998);}(_0x2d28,0x1be));var _0x82d2=function(_0x43f552,_0x42808c){_0x43f552=_0x43f552-0x0;var _0x17911b=_0x2d28[_0x43f552];return _0x17911b;};'use strict';var _=require(_0x82d2('0x0'));var utils=require(_0x82d2('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x82d2('0x2')),'smsMessage':require(_0x82d2('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x82d2('0x4'))};exports[_0x82d2('0x5')]=function(_0x5a19a7,_0x463ecf){return function(_0x4b55d2){try{var _0x4dab01={'body':utils[_0x82d2('0x6')](_0x463ecf[0x0],this),'ContactId':this[_0x82d2('0x7')]['id']};if(this[_0x82d2('0x8')]==='chat'){_0x4dab01['ChatWebsiteId']=this[_0x82d2('0x9')]['id'];}else{_0x4dab01[_[_0x82d2('0xa')](this[_0x82d2('0x8')])+_0x82d2('0xb')]=this[_0x82d2('0x9')]['id'];}_0x4dab01[_[_0x82d2('0xa')](this['channel'])+'InteractionId']=this[_0x82d2('0xc')]['id'];if(rpc[this['channel']+_0x82d2('0xd')]){return rpc[this[_0x82d2('0x8')]+_0x82d2('0xd')][_0x82d2('0xe')](_0x4dab01)['then'](function(_0x16d32a){logger[_0x82d2('0xf')]('[%s][MESSAGE]\x20%s',_0x5a19a7,_0x4dab01['body']);_0x4b55d2[_0x82d2('0x10')]();})[_0x82d2('0x11')](function(_0x2bf42c){logger[_0x82d2('0x12')](_0x82d2('0x13'),_0x5a19a7,JSON[_0x82d2('0x14')](_0x2bf42c));_0x4b55d2[_0x82d2('0x15')]();});}}catch(_0x2d5b2a){logger[_0x82d2('0x12')](_0x82d2('0x13'),_0x5a19a7,JSON[_0x82d2('0x14')](_0x2d5b2a));_0x4b55d2[_0x82d2('0x15')]();}};}; \ 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 265571e..7d40749 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 _0xd3d5=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xd3d5,0xdf));var _0x5d3d=function(_0x175c6e,_0x6385e8){_0x175c6e=_0x175c6e-0x0;var _0x423b4f=_0xd3d5[_0x175c6e];return _0x423b4f;};'use strict';var utils=require(_0x5d3d('0x0'));var logger=require(_0x5d3d('0x1'))(_0x5d3d('0x2'));exports[_0x5d3d('0x3')]=function(_0x4cebf5,_0x3cf64f){return function(_0x22a0bf){try{logger[_0x5d3d('0x4')](_0x5d3d('0x5'),_0x4cebf5,utils[_0x5d3d('0x6')](_0x3cf64f[0x0],this));_0x22a0bf['next']();}catch(_0x122194){logger[_0x5d3d('0x7')]('[%s][NOOP]\x20%s',_0x4cebf5,JSON[_0x5d3d('0x8')](_0x122194));_0x22a0bf[_0x5d3d('0x9')]();}};}; \ No newline at end of file +var _0x1f4c=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop'];(function(_0x4a0b9f,_0x117097){var _0x2cc7c7=function(_0x5e736c){while(--_0x5e736c){_0x4a0b9f['push'](_0x4a0b9f['shift']());}};_0x2cc7c7(++_0x117097);}(_0x1f4c,0x168));var _0xc1f4=function(_0x5dfdaa,_0x5586a8){_0x5dfdaa=_0x5dfdaa-0x0;var _0x485b05=_0x1f4c[_0x5dfdaa];return _0x485b05;};'use strict';var utils=require(_0xc1f4('0x0'));var logger=require(_0xc1f4('0x1'))(_0xc1f4('0x2'));exports[_0xc1f4('0x3')]=function(_0x3f719a,_0x49107b){return function(_0x334049){try{logger[_0xc1f4('0x4')](_0xc1f4('0x5'),_0x3f719a,utils[_0xc1f4('0x6')](_0x49107b[0x0],this));_0x334049[_0xc1f4('0x7')]();}catch(_0x50bc28){logger[_0xc1f4('0x8')](_0xc1f4('0x5'),_0x3f719a,JSON['stringify'](_0x50bc28));_0x334049[_0xc1f4('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 1def4cc..6bf644f 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 _0xe566=['redis','defaults','localhost','socket.io-emitter','account','queue','from','joinAt','emit','clone','queue_id','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','error','toLowerCase','consequence','length','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy'];(function(_0x306462,_0x87e538){var _0x25c09a=function(_0x51e7c3){while(--_0x51e7c3){_0x306462['push'](_0x306462['shift']());}};_0x25c09a(++_0x87e538);}(_0xe566,0xa0));var _0x6e56=function(_0x1bee00,_0x5b22ec){_0x1bee00=_0x1bee00-0x0;var _0x95f29e=_0xe566[_0x1bee00];return _0x95f29e;};'use strict';var schema=require(_0x6e56('0x0'));var _=require(_0x6e56('0x1'));var util=require(_0x6e56('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x6e56('0x3'))(_0x6e56('0x4'));var strategy=require(_0x6e56('0x5'));config[_0x6e56('0x6')]=_[_0x6e56('0x7')](config[_0x6e56('0x6')],{'host':_0x6e56('0x8'),'port':0x18eb});var io=require(_0x6e56('0x9'))(new Redis(config[_0x6e56('0x6')]));var attributes=['id','queue_id',_0x6e56('0xa'),_0x6e56('0xb'),_0x6e56('0xc'),_0x6e56('0xd')];function emit(_0x1d833d,_0x101f4c,_0x5b62df){io['to'](_0x1d833d)[_0x6e56('0xe')](_0x101f4c,_0x5b62df);}function emitChannelQueueInteraction(_0x4c97a6,_0x3ac42b,_0x4cc083,_0x2982fc,_0x1eba8b,_0x3e3406,_0x17fc90,_0x26dfc7){var _0x789a48=_[_0x6e56('0xf')](_0x4cc083);_0x789a48[_0x6e56('0x10')]=_0x26dfc7;_0x789a48['queue']=_0x3ac42b;_0x789a48[_0x6e56('0xa')]=_0x2982fc;_0x789a48['id']=_0x1eba8b;if(_0x3e3406){attributes[_0x6e56('0x11')](_[_0x6e56('0x12')](_0x4c97a6)+_0x6e56('0x13'));_0x17fc90[util[_0x6e56('0x14')]('%sQueuesWaitingInteractions',_0x4c97a6)][_0x1eba8b]=_[_0x6e56('0x15')](_0x789a48,attributes);}else{delete _0x17fc90[util[_0x6e56('0x14')](_0x6e56('0x16'),_0x4c97a6)][_0x1eba8b];}emit(util[_0x6e56('0x14')](_0x6e56('0x17'),_0x4c97a6,_0x3ac42b),util[_0x6e56('0x14')]('%s_queue_waiting_interaction:%s',_0x4c97a6,_0x3e3406?_0x6e56('0x18'):_0x6e56('0x19')),_[_0x6e56('0x15')](_0x789a48,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6e56('0x1a')),'chatQueueReport':require(_0x6e56('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x6e56('0x1c')),'whatsappQueueReport':require(_0x6e56('0x1d'))};var queue=schema({'name':{'type':_0x6e56('0x1e'),'required':!![],'message':_0x6e56('0x1f')},'timeout':{'type':_0x6e56('0x20'),'message':_0x6e56('0x21')}});function startRouting(_0x4a1ec7,_0x3fe598,_0x2d9fd7,_0x398fc8){if(_0x4a1ec7&&_0x3fe598&&_0x2d9fd7){_0x3fe598[_0x6e56('0x22')]+=0x1;var _0x49eb24={'uniqueid':_0x4a1ec7,'from':_0x2d9fd7['body']?_0x2d9fd7[_0x6e56('0x23')][_0x6e56('0xc')]:'','joinAt':moment()[_0x6e56('0x14')](_0x6e56('0x24')),'ContactId':_0x2d9fd7[_0x6e56('0x25')]?_0x2d9fd7[_0x6e56('0x25')]['id']:null,'ListId':_0x2d9fd7['list']?_0x2d9fd7[_0x6e56('0x26')]['id']:null};_0x49eb24[_[_0x6e56('0x27')](_0x2d9fd7[_0x6e56('0x28')])+_0x6e56('0x29')]=_0x3fe598['id']||null;_0x49eb24[_[_0x6e56('0x27')](_0x2d9fd7['channel'])+_0x6e56('0x13')]=_0x2d9fd7[_0x6e56('0x2a')]?_0x2d9fd7[_0x6e56('0x2a')]['id']:null;_0x49eb24[_['upperFirst'](_0x2d9fd7[_0x6e56('0x28')])+_0x6e56('0x2b')]=_0x2d9fd7[_0x6e56('0x2c')]?_0x2d9fd7[_0x6e56('0x2c')]['id']:null;_0x49eb24[_['upperFirst'](_0x2d9fd7[_0x6e56('0x28')])+(_0x2d9fd7[_0x6e56('0x28')]!==_0x6e56('0x2d')?_0x6e56('0x2e'):_0x6e56('0x2f'))]=_0x2d9fd7['account']?_0x2d9fd7[_0x6e56('0xa')]['id']:null;logger['info'](util[_0x6e56('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4a1ec7,_0x3fe598[_0x6e56('0x30')]));emitChannelQueueInteraction(_0x2d9fd7['channel'],_0x3fe598['name'],_0x49eb24,_0x2d9fd7[_0x6e56('0xa')][_0x6e56('0x30')],_0x2d9fd7[_0x6e56('0x2c')]['id'],!![],_0x398fc8,_0x3fe598['id']);if(rpc[_0x2d9fd7[_0x6e56('0x28')]+_0x6e56('0x31')]){return rpc[_0x2d9fd7['channel']+'QueueReport'][_0x6e56('0x32')](_0x49eb24)[_0x6e56('0x33')](function(_0x334ed4){logger['error'](_0x6e56('0x34'));});}}}function stopRouting(_0xde0d07,_0x340b9c,_0x47b596,_0x170dff){if(_0xde0d07&&_0x340b9c){_0x340b9c[_0x6e56('0x22')]-=0x1;var _0x41683b={'leaveAt':moment()[_0x6e56('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x6e56('0x14')](_0x6e56('0x24')),'reason':_0x6e56('0x35')};logger[_0x6e56('0x36')](util['format'](_0x6e56('0x37'),_0xde0d07,_0x340b9c['name']));emitChannelQueueInteraction(_0x47b596[_0x6e56('0x28')],_0x340b9c[_0x6e56('0x30')],_0x47b596[_0x6e56('0x23')],_0x47b596[_0x6e56('0xa')]['name'],_0x47b596['message']['id'],![],_0x170dff,_0x340b9c['id']);if(rpc[_0x47b596[_0x6e56('0x28')]+_0x6e56('0x31')]){return rpc[_0x47b596[_0x6e56('0x28')]+_0x6e56('0x31')][_0x6e56('0x38')](_0xde0d07,_0x41683b)[_0x6e56('0x33')](function(_0x9107f2){logger['error'](_0x6e56('0x39'));});}}}function endRouting(_0x2181b0,_0x4d0f94,_0x6b7fc,_0x1432c7){if(_0x2181b0&&_0x4d0f94){_0x4d0f94[_0x6e56('0x22')]-=0x1;var _0x3e24c8={'leaveAt':moment()[_0x6e56('0x14')](_0x6e56('0x24')),'exitAt':moment()[_0x6e56('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6e56('0x3a')};logger[_0x6e56('0x36')](util[_0x6e56('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x2181b0,_0x4d0f94[_0x6e56('0x30')]));emitChannelQueueInteraction(_0x6b7fc[_0x6e56('0x28')],_0x4d0f94[_0x6e56('0x30')],_0x6b7fc['body'],_0x6b7fc[_0x6e56('0xa')][_0x6e56('0x30')],_0x6b7fc['message']['id'],![],_0x1432c7);if(rpc[_0x6b7fc[_0x6e56('0x28')]+_0x6e56('0x31')]){return rpc[_0x6b7fc['channel']+_0x6e56('0x31')]['update'](_0x2181b0,_0x3e24c8)[_0x6e56('0x33')](function(_0x1ff679){logger[_0x6e56('0x3b')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x58a7d3){return function(_0x327c78){return _0x327c78[_0x6e56('0x30')][_0x6e56('0x3c')]()===_0x58a7d3['toLowerCase']();};}exports[_0x6e56('0x3d')]=function(_0x12962d,_0x17a965,_0x459ae7,_0x26aff0){return function(_0x458e19){try{var _0x349210={'name':_0x17a965[0x0],'timeout':_0x17a965[0x1]};var _0x16ed69=queue[_0x6e56('0x0')](_0x349210,{'typecast':!![]});if(_0x16ed69[_0x6e56('0x3e')]){logger[_0x6e56('0x3b')]('[%s][QUEUE]\x20%s',_0x12962d,_[_0x6e56('0x3f')](_0x16ed69,_0x6e56('0x2c'))['join'](',\x20'));_0x458e19[_0x6e56('0x40')]();}else{var _0x24c368=_[_0x6e56('0x41')](_0x459ae7[_0x26aff0[_0x6e56('0x28')]+_0x6e56('0x42')],handleFindQueue(_0x349210['name']));if(_0x24c368){startRouting(_0x12962d,_0x24c368,_0x26aff0,_0x459ae7);var _0x5790c0=(_0x24c368[_0x6e56('0x3a')]||0xa)*0x3e8;var _0x819ecb=(_0x349210[_0x6e56('0x3a')]||0x14)*0x3e8;var _0x3216a1;if(_0x5790c0>_0x819ecb){_0x819ecb=_0x5790c0;}var _0x1e9f28=seqqueue[_0x6e56('0x43')](_0x5790c0);_0x1e9f28['id']=_0x12962d;_0x1e9f28[_0x6e56('0x44')]=_0x5790c0;_0x1e9f28[_0x6e56('0x45')]=_0x819ecb;_0x1e9f28[_0x6e56('0x28')]=_0x26aff0['channel'];_0x459ae7[_0x6e56('0x46')][_0x12962d]['on'](_0x6e56('0x47'),function(){logger[_0x6e56('0x36')](_0x6e56('0x48'),_0x12962d);stopRouting(_0x12962d,_0x24c368,_0x26aff0,_0x459ae7);clearTimeout(_0x3216a1);_0x3216a1=undefined;_0x1e9f28[_0x6e56('0x49')](!![]);if(_0x459ae7['rules'][_0x12962d]){delete _0x459ae7[_0x6e56('0x46')][_0x12962d];}_0x458e19['stop']();});_0x459ae7[_0x6e56('0x46')][_0x12962d]['on']('complete',function(){if(_0x459ae7[_0x6e56('0x46')][_0x12962d]){delete _0x459ae7[_0x6e56('0x46')][_0x12962d];}});_0x3216a1=setTimeout(function(){logger[_0x6e56('0x36')](_0x6e56('0x4a'),_0x12962d);endRouting(_0x12962d,_0x24c368,_0x26aff0,_0x459ae7);clearTimeout(_0x3216a1);_0x1e9f28[_0x6e56('0x49')](!![]);_0x458e19[_0x6e56('0x4b')]();},_0x819ecb);switch(_0x24c368[_0x6e56('0x4c')]){case'rrmemory':strategy[_0x6e56('0x4d')](_0x1e9f28,_0x24c368,_0x459ae7,_0x26aff0);break;default:strategy[_0x6e56('0x4e')](_0x1e9f28,_0x24c368,_0x459ae7,_0x26aff0);}}else{logger['error'](_0x6e56('0x4f'),_0x12962d,_0x349210['name']);_0x458e19['stop']();}}}catch(_0xcf243b){console[_0x6e56('0x50')](_0xcf243b);logger['error'](_0x6e56('0x51'),_0x12962d,_0xcf243b[_0x6e56('0x52')]);_0x458e19['stop']();}};}; \ No newline at end of file +var _0x768c=['[%s][START:QUEUE][NAME:%s]','name','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','rules','close','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','push','capitalize','format','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info'];(function(_0x488fb9,_0x417ab6){var _0x4cd53a=function(_0x988bf6){while(--_0x988bf6){_0x488fb9['push'](_0x488fb9['shift']());}};_0x4cd53a(++_0x417ab6);}(_0x768c,0x1ed));var _0xc768=function(_0x154c90,_0x326987){_0x154c90=_0x154c90-0x0;var _0x5976d7=_0x768c[_0x154c90];return _0x5976d7;};'use strict';var schema=require(_0xc768('0x0'));var _=require(_0xc768('0x1'));var util=require(_0xc768('0x2'));var seqqueue=require(_0xc768('0x3'));var moment=require(_0xc768('0x4'));var Redis=require(_0xc768('0x5'));var config=require(_0xc768('0x6'));var logger=require(_0xc768('0x7'))(_0xc768('0x8'));var strategy=require(_0xc768('0x9'));config[_0xc768('0xa')]=_[_0xc768('0xb')](config[_0xc768('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc768('0xc'))(new Redis(config[_0xc768('0xa')]));var attributes=['id',_0xc768('0xd'),_0xc768('0xe'),_0xc768('0xf'),_0xc768('0x10'),_0xc768('0x11')];function emit(_0x4b9c4a,_0x1cc91e,_0x52ac4e){io['to'](_0x4b9c4a)['emit'](_0x1cc91e,_0x52ac4e);}function emitChannelQueueInteraction(_0x30d7c2,_0x5bffca,_0x15d624,_0x1a5b7b,_0x2d35ef,_0x4e3269,_0x196d01,_0x1102a8){var _0x57195e=_['clone'](_0x15d624);_0x57195e[_0xc768('0xd')]=_0x1102a8;_0x57195e['queue']=_0x5bffca;_0x57195e['account']=_0x1a5b7b;_0x57195e['id']=_0x2d35ef;if(_0x4e3269){attributes[_0xc768('0x12')](_[_0xc768('0x13')](_0x30d7c2)+'InteractionId');_0x196d01[util[_0xc768('0x14')]('%sQueuesWaitingInteractions',_0x30d7c2)][_0x2d35ef]=_['pick'](_0x57195e,attributes);}else{delete _0x196d01[util[_0xc768('0x14')]('%sQueuesWaitingInteractions',_0x30d7c2)][_0x2d35ef];}emit(util[_0xc768('0x14')]('%s:queue:%s',_0x30d7c2,_0x5bffca),util[_0xc768('0x14')](_0xc768('0x15'),_0x30d7c2,_0x4e3269?'save':_0xc768('0x16')),_[_0xc768('0x17')](_0x57195e,attributes));}var rpc={'openchannelQueueReport':require(_0xc768('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xc768('0x19')),'smsQueueReport':require(_0xc768('0x1a')),'faxQueueReport':require(_0xc768('0x1b')),'whatsappQueueReport':require(_0xc768('0x1c'))};var queue=schema({'name':{'type':_0xc768('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xc768('0x1e'),'message':_0xc768('0x1f')}});function startRouting(_0x3c8e9b,_0x325005,_0x311769,_0x403396){if(_0x3c8e9b&&_0x325005&&_0x311769){_0x325005[_0xc768('0x20')]+=0x1;var _0x58902f={'uniqueid':_0x3c8e9b,'from':_0x311769['body']?_0x311769[_0xc768('0x21')][_0xc768('0x10')]:'','joinAt':moment()['format'](_0xc768('0x22')),'ContactId':_0x311769['contact']?_0x311769['contact']['id']:null,'ListId':_0x311769[_0xc768('0x23')]?_0x311769[_0xc768('0x23')]['id']:null};_0x58902f[_[_0xc768('0x24')](_0x311769[_0xc768('0x25')])+_0xc768('0x26')]=_0x325005['id']||null;_0x58902f[_[_0xc768('0x24')](_0x311769[_0xc768('0x25')])+_0xc768('0x27')]=_0x311769[_0xc768('0x28')]?_0x311769[_0xc768('0x28')]['id']:null;_0x58902f[_[_0xc768('0x24')](_0x311769[_0xc768('0x25')])+'MessageId']=_0x311769['message']?_0x311769[_0xc768('0x29')]['id']:null;_0x58902f[_[_0xc768('0x24')](_0x311769[_0xc768('0x25')])+(_0x311769[_0xc768('0x25')]!==_0xc768('0x2a')?_0xc768('0x2b'):_0xc768('0x2c'))]=_0x311769[_0xc768('0xe')]?_0x311769['account']['id']:null;logger[_0xc768('0x2d')](util[_0xc768('0x14')](_0xc768('0x2e'),_0x3c8e9b,_0x325005[_0xc768('0x2f')]));emitChannelQueueInteraction(_0x311769[_0xc768('0x25')],_0x325005[_0xc768('0x2f')],_0x58902f,_0x311769[_0xc768('0xe')][_0xc768('0x2f')],_0x311769[_0xc768('0x29')]['id'],!![],_0x403396,_0x325005['id']);if(rpc[_0x311769[_0xc768('0x25')]+'QueueReport']){return rpc[_0x311769[_0xc768('0x25')]+'QueueReport'][_0xc768('0x30')](_0x58902f)[_0xc768('0x31')](function(_0x2bfd05){logger[_0xc768('0x32')](_0xc768('0x33'));});}}}function stopRouting(_0x1b6eb4,_0x520634,_0x19a12d,_0x1b5389){if(_0x1b6eb4&&_0x520634){_0x520634[_0xc768('0x20')]-=0x1;var _0x38e3dd={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xc768('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format'](_0xc768('0x34'),_0x1b6eb4,_0x520634['name']));emitChannelQueueInteraction(_0x19a12d[_0xc768('0x25')],_0x520634[_0xc768('0x2f')],_0x19a12d[_0xc768('0x21')],_0x19a12d[_0xc768('0xe')][_0xc768('0x2f')],_0x19a12d[_0xc768('0x29')]['id'],![],_0x1b5389,_0x520634['id']);if(rpc[_0x19a12d[_0xc768('0x25')]+_0xc768('0x35')]){return rpc[_0x19a12d[_0xc768('0x25')]+_0xc768('0x35')][_0xc768('0x36')](_0x1b6eb4,_0x38e3dd)[_0xc768('0x31')](function(_0x2c2015){logger[_0xc768('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x543ab0,_0x1f64d7,_0x1e2204,_0x2abd09){if(_0x543ab0&&_0x1f64d7){_0x1f64d7[_0xc768('0x20')]-=0x1;var _0x3e15dc={'leaveAt':moment()[_0xc768('0x14')](_0xc768('0x22')),'exitAt':moment()[_0xc768('0x14')](_0xc768('0x22')),'reason':_0xc768('0x37')};logger[_0xc768('0x2d')](util[_0xc768('0x14')](_0xc768('0x38'),_0x543ab0,_0x1f64d7['name']));emitChannelQueueInteraction(_0x1e2204[_0xc768('0x25')],_0x1f64d7['name'],_0x1e2204[_0xc768('0x21')],_0x1e2204[_0xc768('0xe')][_0xc768('0x2f')],_0x1e2204[_0xc768('0x29')]['id'],![],_0x2abd09);if(rpc[_0x1e2204[_0xc768('0x25')]+'QueueReport']){return rpc[_0x1e2204[_0xc768('0x25')]+_0xc768('0x35')][_0xc768('0x36')](_0x543ab0,_0x3e15dc)[_0xc768('0x31')](function(_0x29cdd7){logger['error'](_0xc768('0x39'));});}}}function handleFindQueue(_0x4afec6){return function(_0x2815e9){return _0x2815e9[_0xc768('0x2f')][_0xc768('0x3a')]()===_0x4afec6[_0xc768('0x3a')]();};}exports[_0xc768('0x3b')]=function(_0x3aa105,_0x17fd3f,_0x48957f,_0x42703f){return function(_0x3fc900){try{var _0x401738={'name':_0x17fd3f[0x0],'timeout':_0x17fd3f[0x1]};var _0x49ce44=queue[_0xc768('0x0')](_0x401738,{'typecast':!![]});if(_0x49ce44[_0xc768('0x3c')]){logger[_0xc768('0x32')](_0xc768('0x3d'),_0x3aa105,_[_0xc768('0x3e')](_0x49ce44,_0xc768('0x29'))[_0xc768('0x3f')](',\x20'));_0x3fc900[_0xc768('0x40')]();}else{var _0x578310=_[_0xc768('0x41')](_0x48957f[_0x42703f[_0xc768('0x25')]+'Queues'],handleFindQueue(_0x401738[_0xc768('0x2f')]));if(_0x578310){startRouting(_0x3aa105,_0x578310,_0x42703f,_0x48957f);var _0x2b21d0=(_0x578310[_0xc768('0x37')]||0xa)*0x3e8;var _0x5eed2c=(_0x401738[_0xc768('0x37')]||0x14)*0x3e8;var _0x4db337;if(_0x2b21d0>_0x5eed2c){_0x5eed2c=_0x2b21d0;}var _0x591cc4=seqqueue[_0xc768('0x42')](_0x2b21d0);_0x591cc4['id']=_0x3aa105;_0x591cc4[_0xc768('0x43')]=_0x2b21d0;_0x591cc4[_0xc768('0x44')]=_0x5eed2c;_0x591cc4[_0xc768('0x25')]=_0x42703f[_0xc768('0x25')];_0x48957f[_0xc768('0x45')][_0x3aa105]['on']('end',function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3aa105);stopRouting(_0x3aa105,_0x578310,_0x42703f,_0x48957f);clearTimeout(_0x4db337);_0x4db337=undefined;_0x591cc4[_0xc768('0x46')](!![]);if(_0x48957f[_0xc768('0x45')][_0x3aa105]){delete _0x48957f[_0xc768('0x45')][_0x3aa105];}_0x3fc900['stop']();});_0x48957f[_0xc768('0x45')][_0x3aa105]['on']('complete',function(){if(_0x48957f[_0xc768('0x45')][_0x3aa105]){delete _0x48957f[_0xc768('0x45')][_0x3aa105];}});_0x4db337=setTimeout(function(){logger[_0xc768('0x2d')](_0xc768('0x47'),_0x3aa105);endRouting(_0x3aa105,_0x578310,_0x42703f,_0x48957f);clearTimeout(_0x4db337);_0x591cc4[_0xc768('0x46')](!![]);_0x3fc900[_0xc768('0x48')]();},_0x5eed2c);switch(_0x578310['strategy']){case'rrmemory':strategy[_0xc768('0x49')](_0x591cc4,_0x578310,_0x48957f,_0x42703f);break;default:strategy[_0xc768('0x4a')](_0x591cc4,_0x578310,_0x48957f,_0x42703f);}}else{logger['error'](_0xc768('0x4b'),_0x3aa105,_0x401738[_0xc768('0x2f')]);_0x3fc900['stop']();}}}catch(_0x414114){console[_0xc768('0x4c')](_0x414114);logger[_0xc768('0x32')](_0xc768('0x3d'),_0x3aa105,_0x414114['stack']);_0x3fc900['stop']();}};}; \ 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 8ad23dd..7f05bd5 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 _0x9b67=['drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','channel','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout'];(function(_0x3b8774,_0x301a46){var _0x5bcfcc=function(_0x5d9d2f){while(--_0x5d9d2f){_0x3b8774['push'](_0x3b8774['shift']());}};_0x5bcfcc(++_0x301a46);}(_0x9b67,0xf6));var _0x79b6=function(_0x400577,_0x2141ed){_0x400577=_0x400577-0x0;var _0x5395bd=_0x9b67[_0x400577];return _0x5395bd;};'use strict';var _=require(_0x79b6('0x0'));var uuid=require(_0x79b6('0x1'));var util=require(_0x79b6('0x2'));var logger=require(_0x79b6('0x3'))(_0x79b6('0x4'));var Agent=function(_0x5523a1,_0x3ba25a,_0x1aeb24,_0x5297d0){this['notificationId']=uuid['v4']();this[_0x79b6('0x5')]=_0x5523a1;this[_0x79b6('0x6')]=_0x3ba25a;this[_0x79b6('0x7')]=_0x1aeb24;this[_0x79b6('0x4')]=_0x5297d0;this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xc'),this[_0x79b6('0xa')]['bind'](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xd'),this[_0x79b6('0xe')][_0x79b6('0xb')](this));};Agent['prototype']['push']=function(){this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));};Agent[_0x79b6('0xf')][_0x79b6('0xe')]=function(){this[_0x79b6('0xa')](!![]);};Agent[_0x79b6('0xf')][_0x79b6('0x9')]=function(){logger[_0x79b6('0x10')](_0x79b6('0x11'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);if(_[_0x79b6('0x12')](this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']])){logger[_0x79b6('0x10')](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}else{if(this[_0x79b6('0x4')][_0x79b6('0x14')]||util[_0x79b6('0x15')](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this['agent']['id']],this[_0x79b6('0x5')]['channel'],![])){this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=!![];this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x18')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this[_0x79b6('0x5')][_0x79b6('0x19')]);util[_0x79b6('0x1a')](this['notificationId'],this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],null,this['routing']);util['writeLog'](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],'RINGING'+(this[_0x79b6('0x4')]['forcedOwnership']?_0x79b6('0x1b'):''));}else{logger[_0x79b6('0x10')](_0x79b6('0x1c'),this[_0x79b6('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}}};Agent['prototype'][_0x79b6('0xa')]=function(_0x2d219c){if(_[_0x79b6('0x12')](this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']])){return logger['debug'](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);}else{logger[_0x79b6('0x10')](_0x79b6('0x1d'),this[_0x79b6('0x5')]['id'],this['agent']['id']);util[_0x79b6('0x1e')](this[_0x79b6('0x1f')],this[_0x79b6('0x5')]['id'],this['realtime']['agents'][this[_0x79b6('0x6')]['id']],null,this[_0x79b6('0x4')]);this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=![];this['realtime']['agents'][this[_0x79b6('0x6')]['id']]['busyQueue']=undefined;util[_0x79b6('0x20')](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this['squeue'][_0x79b6('0x19')]);util[_0x79b6('0x21')](this['squeue']['id'],this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']],_0x2d219c?_0x79b6('0x22'):_0x79b6('0x23'));}if(!_0x2d219c){setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}};function agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c){return new Agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c);}module[_0x79b6('0x24')]=agent; \ No newline at end of file +var _0x56a4=['saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','removeWaitingNotification','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue'];(function(_0x405fe8,_0xa55e2f){var _0x50e490=function(_0x566869){while(--_0x566869){_0x405fe8['push'](_0x405fe8['shift']());}};_0x50e490(++_0xa55e2f);}(_0x56a4,0x11b));var _0x456a=function(_0x41f55e,_0x264009){_0x41f55e=_0x41f55e-0x0;var _0x922b33=_0x56a4[_0x41f55e];return _0x922b33;};'use strict';var _=require(_0x456a('0x0'));var uuid=require(_0x456a('0x1'));var util=require('./util');var logger=require(_0x456a('0x2'))(_0x456a('0x3'));var Agent=function(_0x5f3fe1,_0x478cac,_0x26a7c6,_0x3a11ee){this[_0x456a('0x4')]=uuid['v4']();this[_0x456a('0x5')]=_0x5f3fe1;this[_0x456a('0x6')]=_0x478cac;this['realtime']=_0x26a7c6;this[_0x456a('0x3')]=_0x3a11ee;this['squeue']['push'](this[_0x456a('0x7')][_0x456a('0x8')](this),this[_0x456a('0x9')]['bind'](this));this[_0x456a('0x5')]['on']('timeout',this[_0x456a('0x9')][_0x456a('0x8')](this));this[_0x456a('0x5')]['on'](_0x456a('0xa'),this[_0x456a('0xb')][_0x456a('0x8')](this));};Agent[_0x456a('0xc')][_0x456a('0xd')]=function(){this[_0x456a('0x5')][_0x456a('0xd')](this[_0x456a('0x7')]['bind'](this),this[_0x456a('0x9')]['bind'](this));};Agent['prototype'][_0x456a('0xb')]=function(){this[_0x456a('0x9')](!![]);};Agent[_0x456a('0xc')][_0x456a('0x7')]=function(){logger['debug'](_0x456a('0xe'),this[_0x456a('0x5')]['id'],this[_0x456a('0x6')]['id']);if(_[_0x456a('0xf')](this[_0x456a('0x10')][_0x456a('0x11')][this['agent']['id']])){logger[_0x456a('0x12')](_0x456a('0x13'),this[_0x456a('0x5')]['id'],this[_0x456a('0x6')]['id']);setTimeout(this['push'][_0x456a('0x8')](this),0x3e8);}else{if(this[_0x456a('0x3')][_0x456a('0x14')]||util['isAgentAvailable'](this[_0x456a('0x5')]['id'],this['realtime']['agents'][this[_0x456a('0x6')]['id']],this['squeue'][_0x456a('0x15')],![])){this['realtime'][_0x456a('0x11')][this[_0x456a('0x6')]['id']]['busy']=!![];this['realtime']['agents'][this[_0x456a('0x6')]['id']][_0x456a('0x16')]=undefined;util[_0x456a('0x17')](this['realtime'],this[_0x456a('0x3')],this['agent'],this['squeue']['channel']);util[_0x456a('0x18')](this[_0x456a('0x4')],this[_0x456a('0x5')]['id'],this['realtime'][_0x456a('0x11')][this[_0x456a('0x6')]['id']],null,this['routing']);util[_0x456a('0x19')](this['squeue']['id'],this['realtime'][_0x456a('0x11')][this['agent']['id']],_0x456a('0x1a')+(this['routing'][_0x456a('0x14')]?_0x456a('0x1b'):''));}else{logger[_0x456a('0x12')](_0x456a('0x1c'),this[_0x456a('0x5')]['id'],this[_0x456a('0x6')]['id']);setTimeout(this[_0x456a('0xd')][_0x456a('0x8')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x48205d){if(_[_0x456a('0xf')](this[_0x456a('0x10')]['agents'][this[_0x456a('0x6')]['id']])){return logger[_0x456a('0x12')](_0x456a('0x13'),this[_0x456a('0x5')]['id'],this[_0x456a('0x6')]['id']);}else{logger['debug'](_0x456a('0x1d'),this[_0x456a('0x5')]['id'],this[_0x456a('0x6')]['id']);util['hideNotification'](this[_0x456a('0x4')],this[_0x456a('0x5')]['id'],this['realtime'][_0x456a('0x11')][this[_0x456a('0x6')]['id']],null,this[_0x456a('0x3')]);this[_0x456a('0x10')][_0x456a('0x11')][this['agent']['id']][_0x456a('0x1e')]=![];this[_0x456a('0x10')][_0x456a('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0x456a('0x1f')](this['realtime'],this['routing'],this['agent'],this[_0x456a('0x5')][_0x456a('0x15')]);util[_0x456a('0x19')](this[_0x456a('0x5')]['id'],this['realtime'][_0x456a('0x11')][this[_0x456a('0x6')]['id']],_0x48205d?'STOP':_0x456a('0x20'));}if(!_0x48205d){setTimeout(this[_0x456a('0xd')][_0x456a('0x8')](this),0x3e8);}};function agent(_0x289c99,_0x97fda1,_0x5113da,_0x41d36d){return new Agent(_0x289c99,_0x97fda1,_0x5113da,_0x41d36d);}module[_0x456a('0x21')]=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 1e156ff..c568df2 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 _0xe587=['TIMEOUT','busy','busyQueue','removeWaitingNotification','exports','uuid','./util','routing','notificationId','queue','realtime','handleTimeout','bind','squeue','timeout','drained','handleDrained','push','handleRun','prototype','isNil','Agents','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20EMPTY'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xe587,0x1b2));var _0x7e58=function(_0xea41d7,_0x34948){_0xea41d7=_0xea41d7-0x0;var _0x44716e=_0xe587[_0xea41d7];return _0x44716e;};'use strict';var _=require('lodash');var uuid=require(_0x7e58('0x0'));var util=require(_0x7e58('0x1'));var logger=require('../../../../../config/logger')(_0x7e58('0x2'));var Beepall=function(_0xf3b3ed,_0x233997,_0x1ef19f,_0x408843){this[_0x7e58('0x3')]=uuid['v4']();this['squeue']=_0xf3b3ed;this[_0x7e58('0x4')]=_0x233997;this[_0x7e58('0x5')]=_0x1ef19f;this['routing']=_0x408843;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x7e58('0x6')][_0x7e58('0x7')](this));this[_0x7e58('0x8')]['on'](_0x7e58('0x9'),this[_0x7e58('0x6')]['bind'](this));this[_0x7e58('0x8')]['on'](_0x7e58('0xa'),this[_0x7e58('0xb')][_0x7e58('0x7')](this));};Beepall['prototype'][_0x7e58('0xc')]=function(){this['squeue'][_0x7e58('0xc')](this[_0x7e58('0xd')]['bind'](this),this[_0x7e58('0x6')][_0x7e58('0x7')](this));};Beepall[_0x7e58('0xe')]['handleDrained']=function(){this[_0x7e58('0x6')](!![]);};Beepall['prototype'][_0x7e58('0xd')]=function(){var _0x141333=!![];if(!_[_0x7e58('0xf')](this[_0x7e58('0x4')])&&!_['isNil'](this[_0x7e58('0x4')][_0x7e58('0x10')])&&this['queue'][_0x7e58('0x10')]['length']>0x0){for(var _0x4d53db=0x0,_0x5ca5fd;_0x4d53db0x0){for(var _0x11a2e0=0x0,_0x5e07f5;_0x11a2e00x0&&_0x6cbb1d[_0x26169f+'CurrentCapacity']>=_0x6cbb1d[_0x26169f+_0x597d('0x20')]){writeLog(_0x15c1e6,_0x6cbb1d,_0x26169f['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x597d('0x21')]=function(_0x5332b6,_0x35877c,_0x2cee5d,_0x54f7a8,_0x6373c){return sendNotification(!![],_0x5332b6,_0x35877c,_0x2cee5d,_0x54f7a8,_0x6373c);};exports[_0x597d('0x22')]=function(_0x3d940e,_0xd527b6,_0x2266c9,_0x1718e8,_0xef023f){return sendNotification(![],_0x3d940e,_0xd527b6,_0x2266c9,_0x1718e8,_0xef023f);};exports[_0x597d('0x23')]=function(_0x5783a3,_0x5c09ed,_0x5eb2fd){var _0xeb9c92=_0x5c09ed[_0x597d('0x24')][_0x597d('0x25')];if(!_0xeb9c92&&_0x5eb2fd){_0xeb9c92=_0x5eb2fd['id'];}var _0x37238d=_['some'](_0x5783a3[_0x5c09ed['channel']+_0x597d('0x26')],function(_0x5468be){var _0x3420d8=_[_0x597d('0x27')](_0x5c09ed[_0x597d('0x28')])+_0x597d('0x29');return _0x5468be[_0x3420d8]===_0x5c09ed['interaction']['id'];});if(!_0x37238d&&_0xeb9c92){_0x37238d=_[_0x597d('0x2a')](_0x5783a3['agents'][_0xeb9c92][_0x5c09ed[_0x597d('0x28')]+'WaitingInteractions'],function(_0x563a82){return _0x563a82['id']===_0x5c09ed['interaction']['id'];});}return _0x37238d;};exports[_0x597d('0x2b')]=function(_0x54dccb,_0x438aec,_0x4779d6,_0x503bd4){_0x54dccb[_0x597d('0x2c')][_0x4779d6['id']][_0x503bd4+'WaitingInteractions'][_0x438aec['message']['id']]={'id':_0x438aec[_0x597d('0x24')]['id']};};exports[_0x597d('0x2d')]=function(_0x523e65,_0x4375a8,_0x7290d6,_0x261e4b){delete _0x523e65[_0x597d('0x2c')][_0x7290d6['id']][_0x261e4b+'WaitingInteractions'][_0x4375a8['message']['id']];};exports[_0x597d('0x2e')]=writeLog; \ No newline at end of file +var _0xa47d=['removeWaitingNotification','writeLog','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction','channel','QueuesWaitingInteractions','capitalize','InteractionId','some','agents','WaitingInteractions','saveWaitingNotification'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa47d,0x1e8));var _0xda47=function(_0x2dd107,_0x1ba68d){_0x2dd107=_0x2dd107-0x0;var _0x50bacb=_0xa47d[_0x2dd107];return _0x50bacb;};'use strict';var _=require('lodash');var util=require(_0xda47('0x0'));var utils=require(_0xda47('0x1'));var Redis=require('ioredis');var config=require(_0xda47('0x2'));var logger=require(_0xda47('0x3'))(_0xda47('0x4'));config[_0xda47('0x5')]=_['defaults'](config['redis'],{'host':_0xda47('0x6'),'port':0x18eb});var io=require(_0xda47('0x7'))(new Redis(config[_0xda47('0x5')]));function sendNotification(_0x3a8b7,_0x3fcde8,_0x41d0c3,_0x3ffab3,_0x520e02,_0x1857eb){io['to'](util[_0xda47('0x8')](_0xda47('0x9'),_0x3ffab3[_0xda47('0xa')]))['emit'](_0xda47('0xb'),_0x3ffab3);var _0x156916=_0x1857eb||{};var _0x2c25ce=_0x41d0c3[_0xda47('0xc')]('.');var _0x103939={'uniqueid':_0x3fcde8,'channel':_0x2c25ce[0x0],'id':_0x2c25ce[0x1],'title':_0x2c25ce[0x0]+_0xda47('0xd'),'interactionId':_0x2c25ce[0x2],'queue':_0x520e02?_0x520e02[_0xda47('0xa')]:null,'sound':_0x156916[_0xda47('0xe')][_0xda47('0xf')],'shake':_0x156916[_0xda47('0xe')][_0xda47('0x10')]};try{if(!_0x156916['body']){_0x156916[_0xda47('0x11')]={};}if(_0x520e02){_0x156916[_0xda47('0x11')][_0xda47('0x12')]=_0x520e02;}else if(_0x156916[_0xda47('0x11')]['queue']){delete _0x156916[_0xda47('0x11')][_0xda47('0x12')];}_0x103939[_0xda47('0x13')]=utils['getMustacheRender'](_0x156916[_0xda47('0xe')]['notificationTemplate'],_0x156916);}catch(_0xb5a376){_0x103939[_0xda47('0x13')]=_0xda47('0x14');logger[_0xda47('0x15')](util[_0xda47('0x8')](_0xda47('0x16'),_0x3fcde8,_0xb5a376[_0xda47('0x17')]));}io['to'](util[_0xda47('0x8')](_0xda47('0x9'),_0x3ffab3[_0xda47('0xa')]))[_0xda47('0x18')](util['format'](_0xda47('0x19'),_0x3a8b7?_0xda47('0x1a'):_0xda47('0x1b')),_0x103939);}function writeLog(_0x10e1b9,_0x26b1b0,_0x38b0d3){return logger[_0xda47('0x1c')](util[_0xda47('0x8')](_0xda47('0x1d'),_0x10e1b9,_0x26b1b0[_0xda47('0xa')],_0x38b0d3));}exports[_0xda47('0x1e')]=function(_0x9a2eb2,_0x573899,_0x58d794,_0x573237){if(_0x573899[_0xda47('0x1f')]){writeLog(_0x9a2eb2,_0x573899,_0xda47('0x20'));return![];}if(!_0x573899[_0xda47('0x21')]){writeLog(_0x9a2eb2,_0x573899,_0xda47('0x22'));return![];}if(_0x573899[_0x58d794+_0xda47('0x23')]){writeLog(_0x9a2eb2,_0x573899,_0xda47('0x24'));return![];}if(_0x573237&&_0x573899[_0xda47('0x25')](_0x58d794+_0xda47('0x26'))&&_0x573899[_0xda47('0x25')](_0x58d794+_0xda47('0x27'))){if(_0x573899[_0x58d794+'Capacity']>0x0&&_0x573899[_0x58d794+_0xda47('0x27')]>=_0x573899[_0x58d794+_0xda47('0x26')]){writeLog(_0x9a2eb2,_0x573899,_0x58d794['toUpperCase']()+_0xda47('0x28'));return![];}}return!![];};exports[_0xda47('0x29')]=function(_0x588e5f,_0xd39abe,_0x119cd3,_0x10b8d9,_0x28fa02){return sendNotification(!![],_0x588e5f,_0xd39abe,_0x119cd3,_0x10b8d9,_0x28fa02);};exports['hideNotification']=function(_0x5805a9,_0x5d1547,_0xcb95c8,_0x230ee8,_0x3a588c){return sendNotification(![],_0x5805a9,_0x5d1547,_0xcb95c8,_0x230ee8,_0x3a588c);};exports[_0xda47('0x2a')]=function(_0x4cc8e4,_0x39e409,_0x1753c2){var _0x2abb28=_0x39e409[_0xda47('0x2b')]['UserId'];if(!_0x2abb28&&_0x1753c2){_0x2abb28=_0x1753c2['id'];}var _0x43a7cc=_['some'](_0x4cc8e4[_0x39e409[_0xda47('0x2c')]+_0xda47('0x2d')],function(_0x4dc3f6){var _0x420b14=_[_0xda47('0x2e')](_0x39e409[_0xda47('0x2c')])+_0xda47('0x2f');return _0x4dc3f6[_0x420b14]===_0x39e409[_0xda47('0x2b')]['id'];});if(!_0x43a7cc&&_0x2abb28){_0x43a7cc=_[_0xda47('0x30')](_0x4cc8e4[_0xda47('0x31')][_0x2abb28][_0x39e409[_0xda47('0x2c')]+_0xda47('0x32')],function(_0x520e43){return _0x520e43['id']===_0x39e409[_0xda47('0x2b')]['id'];});}return _0x43a7cc;};exports[_0xda47('0x33')]=function(_0x179d8e,_0x4ada7e,_0x322dac,_0x15a6a5){_0x179d8e[_0xda47('0x31')][_0x322dac['id']][_0x15a6a5+_0xda47('0x32')][_0x4ada7e[_0xda47('0x17')]['id']]={'id':_0x4ada7e[_0xda47('0x2b')]['id']};};exports[_0xda47('0x34')]=function(_0x3f2b88,_0x33d70a,_0x1dcba3,_0x3a4a63){delete _0x3f2b88[_0xda47('0x31')][_0x1dcba3['id']][_0x3a4a63+_0xda47('0x32')][_0x33d70a[_0xda47('0x17')]['id']];};exports[_0xda47('0x35')]=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 8f9676a..38ecc87 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 _0xa631=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','shelljs','lodash','./utils','routing','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x4eb5a3,_0x4c8543){var _0x20434c=function(_0x32a57c){while(--_0x32a57c){_0x4eb5a3['push'](_0x4eb5a3['shift']());}};_0x20434c(++_0x4c8543);}(_0xa631,0xe4));var _0x1a63=function(_0x5cd771,_0xeaab3f){_0x5cd771=_0x5cd771-0x0;var _0x5a3463=_0xa631[_0x5cd771];return _0x5a3463;};'use strict';var schema=require('validate');var sh=require(_0x1a63('0x0'));var _=require(_0x1a63('0x1'));var utils=require(_0x1a63('0x2'));var logger=require('../../../../config/logger')(_0x1a63('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1a63('0x4')]=function(_0x1def2e,_0x24bd2a){return function(_0x4eed61){try{var _0x51ff47={'command':_0x24bd2a[0x0]};var _0x5a2067=system['validate'](_0x51ff47,{'typecast':!![]});if(_0x5a2067[_0x1a63('0x5')]){logger[_0x1a63('0x6')](_0x1a63('0x7'),_0x1def2e,_['map'](_0x5a2067,'message')[_0x1a63('0x8')](',\x20'));logger[_0x1a63('0x9')](_0x1a63('0xa'),_0x1def2e);_0x4eed61[_0x1a63('0xb')]();}else{var _0x38b2be=this;var _0x58dd88=utils[_0x1a63('0xc')](_0x24bd2a[0x0],this);logger[_0x1a63('0x9')](_0x1a63('0xd'),_0x1def2e,_0x58dd88);sh[_0x1a63('0xe')](_['trim'](_0x58dd88),function(_0x1c7e4f,_0x199c92){logger[_0x1a63('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1def2e,_0x1c7e4f);if(_0x1c7e4f==0x0){var _0xd7e70c=_0x199c92['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x1a63('0xf')](_0x24bd2a[0x1])||_[_0x1a63('0x10')](_0x24bd2a[0x1])){logger[_0x1a63('0x9')]('[%s][SYSTEM]\x20no\x20variable',_0x1def2e);_0x38b2be['body'][_0x24bd2a[0x1]]=_0xd7e70c;}else{logger[_0x1a63('0x9')](_0x1a63('0x11'),_0x1def2e,_0x24bd2a[0x1],_0xd7e70c);_0x38b2be[_0x1a63('0x12')][_0x24bd2a[0x1]]=_0xd7e70c;}}_0x4eed61[_0x1a63('0xb')]();});}}catch(_0x1c1e8c){logger['error'](_0x1a63('0x7'),_0x1def2e,_['isObject'](_0x1c1e8c)?JSON[_0x1a63('0x13')](_0x1c1e8c):_0x1c1e8c);logger[_0x1a63('0x9')](_0x1a63('0xa'),_0x1def2e);_0x4eed61[_0x1a63('0xb')]();}};}; \ No newline at end of file +var _0xd9ea=['[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','./utils','../../../../config/logger','routing','string','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x4ed9eb,_0x3bf8a4){var _0x128030=function(_0x23a564){while(--_0x23a564){_0x4ed9eb['push'](_0x4ed9eb['shift']());}};_0x128030(++_0x3bf8a4);}(_0xd9ea,0x1c6));var _0xad9e=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0xd9ea[_0x2e913b];return _0x173899;};'use strict';var schema=require(_0xad9e('0x0'));var sh=require(_0xad9e('0x1'));var _=require('lodash');var utils=require(_0xad9e('0x2'));var logger=require(_0xad9e('0x3'))(_0xad9e('0x4'));var system=schema({'command':{'type':_0xad9e('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x406f74,_0x17aa85){return function(_0x3ba09f){try{var _0x4f80f8={'command':_0x17aa85[0x0]};var _0x1fff5c=system[_0xad9e('0x0')](_0x4f80f8,{'typecast':!![]});if(_0x1fff5c[_0xad9e('0x6')]){logger[_0xad9e('0x7')](_0xad9e('0x8'),_0x406f74,_[_0xad9e('0x9')](_0x1fff5c,_0xad9e('0xa'))[_0xad9e('0xb')](',\x20'));logger[_0xad9e('0xc')](_0xad9e('0xd'),_0x406f74);_0x3ba09f[_0xad9e('0xe')]();}else{var _0x11be79=this;var _0x37a27c=utils[_0xad9e('0xf')](_0x17aa85[0x0],this);logger[_0xad9e('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x406f74,_0x37a27c);sh['exec'](_[_0xad9e('0x10')](_0x37a27c),function(_0x2a6444,_0x384840){logger['info'](_0xad9e('0x11'),_0x406f74,_0x2a6444);if(_0x2a6444==0x0){var _0x3ac487=_0x384840[_0xad9e('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xad9e('0x13')](_0x17aa85[0x1])||_[_0xad9e('0x14')](_0x17aa85[0x1])){logger[_0xad9e('0xc')](_0xad9e('0x15'),_0x406f74);_0x11be79['body'][_0x17aa85[0x1]]=_0x3ac487;}else{logger[_0xad9e('0xc')](_0xad9e('0x16'),_0x406f74,_0x17aa85[0x1],_0x3ac487);_0x11be79['body'][_0x17aa85[0x1]]=_0x3ac487;}}_0x3ba09f['next']();});}}catch(_0x25759b){logger[_0xad9e('0x7')](_0xad9e('0x8'),_0x406f74,_[_0xad9e('0x17')](_0x25759b)?JSON[_0xad9e('0x18')](_0x25759b):_0x25759b);logger[_0xad9e('0xc')](_0xad9e('0xd'),_0x406f74);_0x3ba09f['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 319c086..9beded2 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 _0x129f=['lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','consequence','validate','length','error','map','join','next','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally'];(function(_0x91d1e3,_0x299619){var _0x13d9c9=function(_0xac6f58){while(--_0xac6f58){_0x91d1e3['push'](_0x91d1e3['shift']());}};_0x13d9c9(++_0x299619);}(_0x129f,0xe1));var _0xf129=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x129f[_0x5f1391];return _0x50ebe3;};'use strict';var schema=require('validate');var _=require(_0xf129('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf129('0x1')),'smsInteraction':require(_0xf129('0x2')),'mailInteraction':require(_0xf129('0x3')),'faxInteraction':require(_0xf129('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xf129('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf129('0x6')]=function(_0x468c31,_0x143874,_0xa094ea,_0x21edcb){return function(_0x492119){try{var _0x1e023c={'tag':_0x143874[0x0]};var _0x497e03=tag[_0xf129('0x7')](_0x1e023c,{'typecast':!![]});if(_0x497e03[_0xf129('0x8')]){logger[_0xf129('0x9')]('[%s][TAG]\x20%s',_0x468c31,_[_0xf129('0xa')](_0x497e03,'message')[_0xf129('0xb')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x468c31);_0x492119[_0xf129('0xc')]();}else{var _0x21cb67={'ids':[_0x143874[0x0]]};if(rpc[_0x21edcb['channel']+_0xf129('0xd')]){rpc[_0x21edcb['channel']+_0xf129('0xd')][_0xf129('0xe')](_0x21edcb[_0xf129('0xf')]['id'],_0x21cb67)[_0xf129('0x10')](function(_0x271c5a){logger[_0xf129('0x11')](_0xf129('0x12'),_0x468c31,_0x143874[0x1],_0x21edcb[_0xf129('0x13')],_0x21edcb[_0xf129('0xf')]['id']);})[_0xf129('0x14')](function(_0x421511){logger[_0xf129('0x9')](_0xf129('0x15'),_0x468c31,JSON[_0xf129('0x16')](_0x421511));logger['info'](_0xf129('0x17'),_0x468c31);})[_0xf129('0x18')](function(){_0x492119[_0xf129('0xc')]();});}}}catch(_0x4f78a2){logger[_0xf129('0x9')](_0xf129('0x15'),_0x468c31,_['isObject'](_0x4f78a2)?JSON[_0xf129('0x16')](_0x4f78a2):_0x4f78a2);logger[_0xf129('0x11')](_0xf129('0x17'),_0x468c31);_0x492119[_0xf129('0xc')]();}};}; \ No newline at end of file +var _0x3315=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','[%s][TAG]\x20%s','isObject','info','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x3315,0x98));var _0x5331=function(_0x13ccb5,_0x33bc2e){_0x13ccb5=_0x13ccb5-0x0;var _0x20d2c7=_0x3315[_0x13ccb5];return _0x20d2c7;};'use strict';var schema=require(_0x5331('0x0'));var _=require(_0x5331('0x1'));var rpc={'chatInteraction':require(_0x5331('0x2')),'openchannelInteraction':require(_0x5331('0x3')),'smsInteraction':require(_0x5331('0x4')),'mailInteraction':require(_0x5331('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5331('0x6'))};var logger=require('../../../../config/logger')(_0x5331('0x7'));var tag=schema({'tag':{'type':_0x5331('0x8'),'required':!![],'message':_0x5331('0x9')}});exports[_0x5331('0xa')]=function(_0x5206e9,_0x56b872,_0x1fd09d,_0x915590){return function(_0x5de4e1){try{var _0x27edc2={'tag':_0x56b872[0x0]};var _0x5ec1f3=tag[_0x5331('0x0')](_0x27edc2,{'typecast':!![]});if(_0x5ec1f3['length']){logger[_0x5331('0xb')]('[%s][TAG]\x20%s',_0x5206e9,_['map'](_0x5ec1f3,_0x5331('0xc'))[_0x5331('0xd')](',\x20'));logger['info'](_0x5331('0xe'),_0x5206e9);_0x5de4e1[_0x5331('0xf')]();}else{var _0x333a4a={'ids':[_0x56b872[0x0]]};if(rpc[_0x915590[_0x5331('0x10')]+_0x5331('0x11')]){rpc[_0x915590[_0x5331('0x10')]+_0x5331('0x11')]['addTags'](_0x915590['interaction']['id'],_0x333a4a)[_0x5331('0x12')](function(_0xbf5470){logger['info'](_0x5331('0x13'),_0x5206e9,_0x56b872[0x1],_0x915590[_0x5331('0x10')],_0x915590['interaction']['id']);})[_0x5331('0x14')](function(_0x2b4e2b){logger[_0x5331('0xb')]('[%s][TAG]\x20%s',_0x5206e9,JSON[_0x5331('0x15')](_0x2b4e2b));logger['info'](_0x5331('0xe'),_0x5206e9);})[_0x5331('0x16')](function(){_0x5de4e1[_0x5331('0xf')]();});}}}catch(_0x3b6524){logger['error'](_0x5331('0x17'),_0x5206e9,_[_0x5331('0x18')](_0x3b6524)?JSON[_0x5331('0x15')](_0x3b6524):_0x3b6524);logger[_0x5331('0x19')](_0x5331('0xe'),_0x5206e9);_0x5de4e1[_0x5331('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 bc92883..3e7f90b 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 _0x91e9=['?params=','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','then','info','stop','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing'];(function(_0x1f6feb,_0x49d07f){var _0x5c2053=function(_0x99e452){while(--_0x99e452){_0x1f6feb['push'](_0x1f6feb['shift']());}};_0x5c2053(++_0x49d07f);}(_0x91e9,0x81));var _0x991e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x91e9[_0x59ee6f];return _0x4c0979;};'use strict';var rp=require(_0x991e('0x0'));var logger=require(_0x991e('0x1'))(_0x991e('0x2'));var _=require(_0x991e('0x3'));var arr=[];exports[_0x991e('0x4')]=function(_0x24bfe8,_0x5ea954){return function(_0x4edfa4){var _0x1a48e2=_0x5ea954[0xa];var _0x28b422=_0x5ea954[0xb];var _0x48980c=_0x5ea954[0xc];var _0x833f66=_0x5ea954[0xd];var _0x5eb2e9=_0x5ea954[0xe];var _0xdf0eb1=_0x5ea954[0xf][_0x991e('0x5')](/\n/g,_0x991e('0x6'));var _0x208aa8=_0x5ea954[0x10][_0x991e('0x5')](/\n/g,'\x20');if(!arr[_0x991e('0x7')](_0x28b422)){arr[_0x991e('0x8')](_0x28b422);var _0x38e829=_0x5ea954[0x3];var _0x806073=_0x5ea954[0x4];var _0x4aa57c=_0x5ea954[0x1];var _0x32658a=_0x5ea954[0x0];var _0xe2679b={};_0xe2679b[_0x991e('0x9')]=_0x5ea954[0x8]+'?params='+_0x48980c+'|'+_0x1a48e2+'|'+_0x833f66+'|'+_0x28b422+'|'+_0x5eb2e9;_0xe2679b[_0x991e('0xa')]=_0x5ea954[0x7]+_0x991e('0xb')+_0x48980c+'|'+_0x1a48e2+'|'+_0x833f66+'|'+_0x28b422+'|'+_0x5eb2e9+'|'+_0xdf0eb1+'|'+_0x208aa8;_0xe2679b['title']=_0x5ea954[0x9];var _0x2d688f={};_0x2d688f[_0x991e('0xc')]=_0x991e('0xd');_0x2d688f[_0x991e('0xe')]=_0x991e('0xf');var _0x54b6f6=[];_0x54b6f6['push'](_0x5ea954[0x2]);_0x54b6f6[_0x991e('0x8')](_0x5ea954[0x5]);_0x54b6f6[_0x991e('0x8')](_0x5ea954[0x6]);_0x2d688f[_0x991e('0x10')]=_0x54b6f6;_0x2d688f['id']=0x1;var _0x452ec8=JSON[_0x991e('0x11')](_0x2d688f);var _0x5c2bb5={'encoding':_0x991e('0x12'),'method':_0x991e('0x13'),'timeout':0x2710,'url':_0x38e829,'headers':{'Content-Type':_0x991e('0x14')},'body':_0x452ec8};return rp(_0x5c2bb5)['then'](function(_0xe78794){const _0x665ba0=JSON[_0x991e('0x15')](_0xe78794);if(!_0x665ba0[_0x991e('0x16')][_0x991e('0x17')]){throw new Error(_0x991e('0x18'));}var _0x343521=_0x28b422;var _0x46e69c=_0x991e('0x19')+_0x4aa57c+'&serviceId='+_0x32658a+_0x991e('0x1a')+_0x343521+_0x991e('0x1b')+JSON[_0x991e('0x11')](_0xe2679b);var _0x3c71f8=_0x806073+'?'+_0x46e69c;return rp(_0x3c71f8);})[_0x991e('0x1c')](function(_0x15b6eb){logger[_0x991e('0x1d')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x24bfe8,_0x15b6eb);_0x4edfa4[_0x991e('0x1e')]();})['catch'](function(_0x46a911){logger[_0x991e('0x1f')]('[%s][TVOX]\x20%s',_0x24bfe8,_[_0x991e('0x20')](_0x46a911)?JSON['stringify'](_0x46a911):_0x46a911);_0x4edfa4[_0x991e('0x1e')]();});}else{logger[_0x991e('0x1d')](_0x991e('0x21'),_0x24bfe8);_0x4edfa4[_0x991e('0x22')]();}};}; \ No newline at end of file +var _0xba73=['[%s][TVOX]\x20%s','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnRing','?params=','title','jsonrpc','method','params','stringify','utf8','POST','application/json-rpc','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','stop','catch','error'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xba73,0x162));var _0x3ba7=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xba73[_0x42bdad];return _0x122626;};'use strict';var rp=require(_0x3ba7('0x0'));var logger=require(_0x3ba7('0x1'))(_0x3ba7('0x2'));var _=require(_0x3ba7('0x3'));var arr=[];exports['consequence']=function(_0x6be58b,_0x151b9a){return function(_0x587eb6){var _0x223673=_0x151b9a[0xa];var _0x5ea71a=_0x151b9a[0xb];var _0xfd4066=_0x151b9a[0xc];var _0x1d6e31=_0x151b9a[0xd];var _0x3d836b=_0x151b9a[0xe];var _0x3380e9=_0x151b9a[0xf][_0x3ba7('0x4')](/\n/g,_0x3ba7('0x5'));var _0xa29574=_0x151b9a[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x3ba7('0x6')](_0x5ea71a)){arr[_0x3ba7('0x7')](_0x5ea71a);var _0x39fc64=_0x151b9a[0x3];var _0x38e9b5=_0x151b9a[0x4];var _0x56d762=_0x151b9a[0x1];var _0xb289e8=_0x151b9a[0x0];var _0x2f90a5={};_0x2f90a5['urlOnAnswer']=_0x151b9a[0x8]+'?params='+_0xfd4066+'|'+_0x223673+'|'+_0x1d6e31+'|'+_0x5ea71a+'|'+_0x3d836b;_0x2f90a5[_0x3ba7('0x8')]=_0x151b9a[0x7]+_0x3ba7('0x9')+_0xfd4066+'|'+_0x223673+'|'+_0x1d6e31+'|'+_0x5ea71a+'|'+_0x3d836b+'|'+_0x3380e9+'|'+_0xa29574;_0x2f90a5[_0x3ba7('0xa')]=_0x151b9a[0x9];var _0x47a106={};_0x47a106[_0x3ba7('0xb')]='2.0';_0x47a106[_0x3ba7('0xc')]='login';var _0x1efd7e=[];_0x1efd7e[_0x3ba7('0x7')](_0x151b9a[0x2]);_0x1efd7e[_0x3ba7('0x7')](_0x151b9a[0x5]);_0x1efd7e[_0x3ba7('0x7')](_0x151b9a[0x6]);_0x47a106[_0x3ba7('0xd')]=_0x1efd7e;_0x47a106['id']=0x1;var _0x4e73aa=JSON[_0x3ba7('0xe')](_0x47a106);var _0x413a32={'encoding':_0x3ba7('0xf'),'method':_0x3ba7('0x10'),'timeout':0x2710,'url':_0x39fc64,'headers':{'Content-Type':_0x3ba7('0x11')},'body':_0x4e73aa};return rp(_0x413a32)['then'](function(_0x2d4a12){const _0x4e1558=JSON['parse'](_0x2d4a12);if(!_0x4e1558[_0x3ba7('0x12')][_0x3ba7('0x13')]){throw new Error(_0x3ba7('0x14'));}var _0x51fd52=_0x5ea71a;var _0x5ca626=_0x3ba7('0x15')+_0x56d762+_0x3ba7('0x16')+_0xb289e8+_0x3ba7('0x17')+_0x51fd52+_0x3ba7('0x18')+JSON['stringify'](_0x2f90a5);var _0x3d5710=_0x38e9b5+'?'+_0x5ca626;return rp(_0x3d5710);})[_0x3ba7('0x19')](function(_0x341795){logger[_0x3ba7('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x6be58b,_0x341795);_0x587eb6[_0x3ba7('0x1b')]();})[_0x3ba7('0x1c')](function(_0x33778f){logger[_0x3ba7('0x1d')](_0x3ba7('0x1e'),_0x6be58b,_['isObject'](_0x33778f)?JSON[_0x3ba7('0xe')](_0x33778f):_0x33778f);_0x587eb6[_0x3ba7('0x1b')]();});}else{logger[_0x3ba7('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x6be58b);_0x587eb6[_0x3ba7('0x1f')]();}};}; \ 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 90353e8..8a862b9 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x423ca4,_0x43f09e){var _0x2a5ae1=function(_0x3d83d4){while(--_0x3d83d4){_0x423ca4['push'](_0x423ca4['shift']());}};_0x2a5ae1(++_0x43f09e);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x16530d,_0x431565){var _0x477c57=function(_0x1a0040){while(--_0x1a0040){_0x16530d['push'](_0x16530d['shift']());}};_0x477c57(++_0x431565);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index a8c175b..2aee9e8 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 _0x7ba8=['matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','.js','autoreply','split','mail','push','slice','join','dialogflow','appdata','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0x7ba8,0x9b));var _0x87ba=function(_0x15daa6,_0x598792){_0x15daa6=_0x15daa6-0x0;var _0x5d86c0=_0x7ba8[_0x15daa6];return _0x5d86c0;};'use strict';var _=require(_0x87ba('0x0'));var util=require(_0x87ba('0x1'));var path=require(_0x87ba('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x87ba('0x3'));var sUtils=require(_0x87ba('0x4'));var logger=require(_0x87ba('0x5'))(_0x87ba('0x6'));var rpc={'openchannelQueueReport':require(_0x87ba('0x7')),'mailQueueReport':require(_0x87ba('0x8')),'chatQueueReport':require(_0x87ba('0x9')),'smsQueueReport':require(_0x87ba('0xa')),'faxQueueReport':require(_0x87ba('0xb')),'whatsappQueueReport':require(_0x87ba('0xc'))};var RuleEngine=require(_0x87ba('0xd'));function getId(_0x26adbd,_0x3f90e5,_0x1239ab){return util[_0x87ba('0xe')]('%s.%s.%s',_0x26adbd,_0x3f90e5||0x0,_0x1239ab||0x0);}function getIntervals(_0x4a5ab3,_0x9d7d7c){var _0x25bc5b=[];if(!_[_0x87ba('0xf')](_0x9d7d7c[_0x87ba('0x10')])&&!_['isNil'](_0x4a5ab3[_0x9d7d7c['IntervalId']])&&!_[_0x87ba('0xf')](_0x4a5ab3[_0x9d7d7c[_0x87ba('0x10')]][_0x87ba('0x11')])){_0x25bc5b=_[_0x87ba('0x12')](_0x4a5ab3[_0x9d7d7c[_0x87ba('0x10')]]['Intervals'],_0x87ba('0x13'));}else if(!_['isNil'](_0x9d7d7c['interval'])){_0x25bc5b=[_0x9d7d7c['interval']];}return _0x25bc5b;}exports[_0x87ba('0x14')]=function(_0x570501){_0x570501[_0x87ba('0x15')]={};return new BPromise(function(_0x1d93cf,_0x44f3a1){var _0x4c9e79={'Start':function(_0xf23a2e){var _0x3f5352=this;return new Promise(function(_0xec3a15,_0x308ce2){if(_0xf23a2e){try{var _0x55eba3=[];var _0x34defb=getId(_0xf23a2e[_0x87ba('0x16')],_0xf23a2e['message']?_0xf23a2e[_0x87ba('0x17')]['id']:0x0,_0xf23a2e[_0x87ba('0x18')]?_0xf23a2e[_0x87ba('0x18')]['id']:0x0);var _0x47b8ad=sUtils[_0x87ba('0x19')](_0x570501,_0xf23a2e);if(!_0x47b8ad&&_0xf23a2e[_0x87ba('0x1a')]&&_[_0x87ba('0x1b')](_0xf23a2e[_0x87ba('0x1a')])&&_0xf23a2e[_0x87ba('0x1a')][_0x87ba('0x1c')]){for(var _0x38c74d=0x0;_0x38c74d<_0xf23a2e[_0x87ba('0x1a')][_0x87ba('0x1c')];_0x38c74d+=0x1){var _0x59eea3=_0xf23a2e[_0x87ba('0x1a')][_0x38c74d];if(fs[_0x87ba('0x1d')](path['join'](__dirname,'applications',_0x59eea3[_0x87ba('0x1e')]+_0x87ba('0x1f')))){var _0x1f2175=[];switch(_0x59eea3[_0x87ba('0x1e')]['toLowerCase']()){case _0x87ba('0x20'):var _0x32b6c6=_0x59eea3['appdata'][_0x87ba('0x21')](',');if(_0xf23a2e[_0x87ba('0x16')]===_0x87ba('0x22')){_0x1f2175[_0x87ba('0x23')](_0x32b6c6[0x0]);_0x1f2175[_0x87ba('0x23')](_0x32b6c6[0x1]);_0x1f2175['push'](_0x32b6c6[_0x87ba('0x24')](0x2,_0x32b6c6[_0x87ba('0x1c')])[_0x87ba('0x25')](','));}else{_0x1f2175['push'](_0x32b6c6[0x0]);_0x1f2175[_0x87ba('0x23')](_0x32b6c6['slice'](0x1,_0x32b6c6[_0x87ba('0x1c')])[_0x87ba('0x25')](','));}break;case _0x87ba('0x26'):var _0x7ac5c6=_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');_0x1f2175[_0x87ba('0x23')](_0x7ac5c6[0x0]);_0x1f2175['push'](_0x7ac5c6[0x1]);_0x1f2175[_0x87ba('0x23')](_0x7ac5c6[_0x87ba('0x24')](0x2,_0x7ac5c6[_0x87ba('0x1c')])[_0x87ba('0x25')](','));break;case'dialogflowv2':var _0x2a01b1=_0x59eea3[_0x87ba('0x27')]['split'](',');_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x0]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x1]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x2]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x3]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[_0x87ba('0x24')](0x4,_0x2a01b1['length'])[_0x87ba('0x25')](','));break;case _0x87ba('0x28'):var _0x527442=_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');_0x1f2175['push'](_0x527442[0x0]);_0x1f2175[_0x87ba('0x23')](_0x527442[0x1]);_0x1f2175[_0x87ba('0x23')](_0x527442[0x2]);_0x1f2175['push'](_0x527442[0x3]);_0x1f2175[_0x87ba('0x23')](_0x527442[_0x87ba('0x24')](0x4,_0x527442[_0x87ba('0x1c')])[_0x87ba('0x25')](','));break;case _0x87ba('0x17'):_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x27')]);break;case'tag':_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x29')]);_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x27')]);break;case _0x87ba('0x2a'):var _0x43abcd=utils[_0x87ba('0x2b')](_0xf23a2e[_0x87ba('0x2c')][_0x87ba('0x2d')],_0xf23a2e);var _0x2138b2=_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x0]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x1]);_0x1f2175['push'](_0x2138b2[0x2]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x3]);_0x1f2175['push'](_0x2138b2[0x4]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x5]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x6]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x7]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x8]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x9]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0xa]);_0x1f2175[_0x87ba('0x23')](_0xf23a2e[_0x87ba('0x18')]['id']);_0x1f2175[_0x87ba('0x23')](_0xf23a2e[_0x87ba('0x17')]['id']);_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x2e')]);_0x1f2175[_0x87ba('0x23')](_0xf23a2e['interaction'][_0x87ba('0x2f')]);_0x1f2175[_0x87ba('0x23')](_0xf23a2e[_0x87ba('0x30')][_0x87ba('0x30')]);_0x1f2175[_0x87ba('0x23')](_0x43abcd);break;default:_0x1f2175=_[_0x87ba('0xf')](_0x59eea3['appdata'])?[]:_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');}var _0x5c6c5b={'id':util[_0x87ba('0xe')](_0x87ba('0x31'),_0x34defb,_0x59eea3['id'],_0x59eea3[_0x87ba('0x1e')]),'condition':require(_0x87ba('0x32'))[_0x87ba('0x33')](_0x34defb,getIntervals(_0x570501[_0x87ba('0x34')],_0x59eea3),_0x570501),'consequence':require(_0x87ba('0x35')+_0x59eea3['app'])[_0x87ba('0x36')](_0x34defb,_0x1f2175,_0x570501,_0xf23a2e),'p':_0x59eea3[_0x87ba('0x37')]||0x0};logger[_0x87ba('0x38')](_0x87ba('0x39'),_0x5c6c5b['id'],_0x87ba('0x3a'),getIntervals(_0x570501[_0x87ba('0x34')],_0x59eea3)['join'](_0x87ba('0x3b')));_0x55eba3[_0x87ba('0x23')](_0x5c6c5b);}else{logger[_0x87ba('0x3c')](_0x87ba('0x3d'),path[_0x87ba('0x25')](__dirname,_0x87ba('0x1a'),_0x59eea3['app']+_0x87ba('0x1f')));}}_0x570501[_0x87ba('0x15')][_0x34defb]=new RuleEngine(_0x55eba3);_0x570501[_0x87ba('0x15')][_0x34defb][_0x87ba('0x3e')](_0xf23a2e,function(_0xf03810){logger[_0x87ba('0x38')](_0x87ba('0x3f'),JSON[_0x87ba('0x40')](_0xf03810[_0x87ba('0x41')]));if(_0x570501[_0x87ba('0x15')][_0x34defb]){_0x570501[_0x87ba('0x15')][_0x34defb][_0x87ba('0x42')](_0x87ba('0x43'));}});return _0xec3a15({'code':0xc8,'message':_0xf23a2e});}else{if(_0x47b8ad){logger[_0x87ba('0x38')](util['format'](_0x87ba('0x44'),_0x34defb));}else{logger[_0x87ba('0x38')](_0x87ba('0x45'));}return _0xec3a15({'code':0xc8,'message':_0xf23a2e});}}catch(_0x4bc252){logger['error'](_0x4bc252[_0x87ba('0x46')]);return _0x308ce2(_0x3f5352[_0x87ba('0x3c')](0x1f4,_0x4bc252));}}return _0x308ce2(_0x87ba('0x47'));});},'AcceptMessage':function(_0x1fce05){var _0x4a13aa=this;return new Promise(function(_0x21cf54,_0x465895){if(_0x1fce05[_0x87ba('0x48')]&&_0x1fce05['agent']['id']){if(_0x570501[_0x87ba('0x49')][_0x1fce05['agent']['id']]){_0x570501[_0x87ba('0x49')][_0x1fce05[_0x87ba('0x48')]['id']][_0x87ba('0x4a')]=![];_0x570501[_0x87ba('0x49')][_0x1fce05[_0x87ba('0x48')]['id']][_0x87ba('0x4b')]=undefined;}}if(_0x1fce05[_0x87ba('0x17')]&&_0x1fce05[_0x87ba('0x17')]['id']){try{var _0xa8ed6e=getId(_0x1fce05[_0x87ba('0x16')],_0x1fce05[_0x87ba('0x17')]?_0x1fce05[_0x87ba('0x17')]['id']:0x0,_0x1fce05['interaction']?_0x1fce05[_0x87ba('0x18')]['id']:0x0);if(_0x570501[_0x87ba('0x15')][_0xa8ed6e]){_0x570501[_0x87ba('0x15')][_0xa8ed6e][_0x87ba('0x42')]('end');if(rpc[_0x1fce05[_0x87ba('0x16')]+_0x87ba('0x4c')]){rpc[_0x1fce05[_0x87ba('0x16')]+_0x87ba('0x4c')][_0x87ba('0x4d')](_0xa8ed6e,{'UserId':_0x1fce05[_0x87ba('0x17')][_0x87ba('0x4e')]})[_0x87ba('0x4f')](function(){logger[_0x87ba('0x3c')](_0x87ba('0x50'));});}}return _0x21cf54({'code':0xc8,'message':_0x1fce05});}catch(_0x554b2e){logger['error'](_0x554b2e['stack']);return _0x465895(_0x4a13aa['error'](0x1f4,_0x554b2e));}}logger[_0x87ba('0x3c')](_0x87ba('0x51'));return _0x465895(_0x4a13aa[_0x87ba('0x3c')](0x1f4,_0x87ba('0x51')));});},'RejectMessage':function(_0x41c934){var _0x1666d4=this;return new Promise(function(_0x2ff719,_0x315bc0){if(_0x41c934[_0x87ba('0x48')]&&_0x41c934['agent']['id']){try{if(_0x570501[_0x87ba('0x49')][_0x41c934[_0x87ba('0x48')]['id']]){_0x570501[_0x87ba('0x49')][_0x41c934[_0x87ba('0x48')]['id']][_0x87ba('0x4a')]=![];_0x570501[_0x87ba('0x49')][_0x41c934[_0x87ba('0x48')]['id']][_0x87ba('0x4b')]=undefined;}return _0x2ff719({'code':0xc8,'message':_0x41c934});}catch(_0x206a66){logger[_0x87ba('0x3c')](_0x206a66[_0x87ba('0x46')]);return _0x315bc0(_0x1666d4[_0x87ba('0x3c')](0x1f4,_0x206a66));}}logger[_0x87ba('0x3c')](_0x87ba('0x51'));return _0x315bc0(_0x1666d4[_0x87ba('0x3c')](0x1f4,_0x87ba('0x51')));});},'AbandonInteraction':function(_0x24bc6f){var _0x7c516e=this;return new Promise(function(_0x273bcd,_0x3f638f){if(_0x24bc6f[_0x87ba('0x16')]&&_0x24bc6f[_0x87ba('0x18')]&&_0x24bc6f[_0x87ba('0x18')]['id']){try{var _0x14205b=getId(_0x24bc6f[_0x87ba('0x16')],_0x24bc6f[_0x87ba('0x17')]?_0x24bc6f[_0x87ba('0x17')]['id']:0x0,_0x24bc6f['interaction']?_0x24bc6f[_0x87ba('0x18')]['id']:0x0);if(_0x570501[_0x87ba('0x15')][_0x14205b]){_0x570501[_0x87ba('0x15')][_0x14205b][_0x87ba('0x42')](_0x87ba('0x52'));}return _0x273bcd({'code':0xc8,'message':_0x24bc6f});}catch(_0x3c90db){logger['error'](_0x3c90db['stack']);return _0x3f638f(_0x7c516e[_0x87ba('0x3c')](0x1f4,_0x3c90db));}}logger['error'](_0x87ba('0x51'));return _0x3f638f(_0x7c516e[_0x87ba('0x3c')](0x1f4,_0x87ba('0x51')));});},'AgentCapacity':function(_0x3fe2d7){var _0x1f64b5=this;return new Promise(function(_0x4dbf55,_0x4689f0){if(_0x570501['agents'][_0x87ba('0x53')](_0x3fe2d7['id'])){for(var _0x2ffb94 in _0x3fe2d7[_0x87ba('0x54')]){if(_0x3fe2d7[_0x87ba('0x54')][_0x87ba('0x53')](_0x2ffb94)){if(_0x570501['agents'][_0x3fe2d7['id']][_0x87ba('0x53')](_0x2ffb94+_0x87ba('0x55'))){_0x570501[_0x87ba('0x49')][_0x3fe2d7['id']][_0x2ffb94+_0x87ba('0x55')]=parseInt(_0x3fe2d7[_0x87ba('0x54')][_0x2ffb94],0xa);}}}_0x570501['agents'][_0x3fe2d7['id']][_0x87ba('0x56')]();return _0x4dbf55({'code':0xc8,'message':_0x570501['agents'][_0x3fe2d7['id']]});}else{return _0x4689f0(_0x1f64b5['error'](0x1f4,_0x87ba('0x57')));}});},'Agents':function(_0x255fd7){return new Promise(function(_0xc8035e){var _0x12f847=_[_0x87ba('0x58')](_0x570501['agents']);if(_0x255fd7&&_0x255fd7['id']){var _0x39e040=_[_0x87ba('0x59')](_0x12f847,function(_0x4a4d6f){return _0x4a4d6f['id']===_0x255fd7['id'];});_0xc8035e(_0x39e040);}else{_0xc8035e({'count':_0x12f847[_0x87ba('0x1c')],'rows':_0x12f847});}});},'ChatQueues':function(){return new Promise(function(_0x5badc1){var _0x2f8310=[];for(var _0x34d78c in _0x570501[_0x87ba('0x5a')]){if(_0x570501[_0x87ba('0x5a')][_0x87ba('0x53')](_0x34d78c)){var _0x3cb048=_0x570501[_0x87ba('0x5a')][_0x34d78c];var _0x184aee={'id':_0x3cb048['id'],'available':_0x3cb048['available'],'loggedIn':_0x3cb048[_0x87ba('0x5b')],'name':_0x3cb048[_0x87ba('0x5c')],'paused':_0x3cb048[_0x87ba('0x5d')],'waiting':_0x3cb048[_0x87ba('0x5e')]};_0x2f8310['push'](_0x184aee);}}_0x5badc1({'count':_0x2f8310[_0x87ba('0x1c')],'rows':_0x2f8310});});},'MailQueues':function(){return new Promise(function(_0x184b16){var _0x5262cf=[];for(var _0x4fe45a in _0x570501[_0x87ba('0x5f')]){if(_0x570501['mailQueues'][_0x87ba('0x53')](_0x4fe45a)){var _0x354ad3=_0x570501[_0x87ba('0x5f')][_0x4fe45a];var _0x155aa6={'id':_0x354ad3['id'],'available':_0x354ad3[_0x87ba('0x60')],'loggedIn':_0x354ad3[_0x87ba('0x5b')],'name':_0x354ad3['name'],'paused':_0x354ad3[_0x87ba('0x5d')],'waiting':_0x354ad3[_0x87ba('0x5e')]};_0x5262cf[_0x87ba('0x23')](_0x155aa6);}}_0x184b16({'count':_0x5262cf[_0x87ba('0x1c')],'rows':_0x5262cf});});},'OpenchannelQueues':function(){return new Promise(function(_0x555b44){var _0x2a3f43=[];for(var _0x28f325 in _0x570501[_0x87ba('0x61')]){if(_0x570501[_0x87ba('0x61')][_0x87ba('0x53')](_0x28f325)){var _0x9837ca=_0x570501[_0x87ba('0x61')][_0x28f325];var _0x432f69={'id':_0x9837ca['id'],'available':_0x9837ca[_0x87ba('0x60')],'loggedIn':_0x9837ca['loggedIn'],'name':_0x9837ca[_0x87ba('0x5c')],'paused':_0x9837ca['paused'],'waiting':_0x9837ca[_0x87ba('0x5e')]};_0x2a3f43[_0x87ba('0x23')](_0x432f69);}}_0x555b44({'count':_0x2a3f43['length'],'rows':_0x2a3f43});});},'SmsQueues':function(){return new Promise(function(_0x417dd6){var _0x2eee9d=[];for(var _0x591490 in _0x570501[_0x87ba('0x62')]){if(_0x570501[_0x87ba('0x62')][_0x87ba('0x53')](_0x591490)){var _0x2e36bb=_0x570501['smsQueues'][_0x591490];var _0x6b967d={'id':_0x2e36bb['id'],'available':_0x2e36bb[_0x87ba('0x60')],'loggedIn':_0x2e36bb[_0x87ba('0x5b')],'name':_0x2e36bb[_0x87ba('0x5c')],'paused':_0x2e36bb[_0x87ba('0x5d')],'waiting':_0x2e36bb[_0x87ba('0x5e')]};_0x2eee9d['push'](_0x6b967d);}}_0x417dd6({'count':_0x2eee9d[_0x87ba('0x1c')],'rows':_0x2eee9d});});},'FaxQueues':function(){return new Promise(function(_0x3c4165){var _0x442372=[];for(var _0x4ff2ed in _0x570501['faxQueues']){if(_0x570501['faxQueues']['hasOwnProperty'](_0x4ff2ed)){var _0x5c3ac8=_0x570501[_0x87ba('0x63')][_0x4ff2ed];var _0x566d0a={'id':_0x5c3ac8['id'],'available':_0x5c3ac8['available'],'loggedIn':_0x5c3ac8[_0x87ba('0x5b')],'name':_0x5c3ac8[_0x87ba('0x5c')],'paused':_0x5c3ac8[_0x87ba('0x5d')],'waiting':_0x5c3ac8['waiting']};_0x442372[_0x87ba('0x23')](_0x566d0a);}}_0x3c4165({'count':_0x442372['length'],'rows':_0x442372});});},'WhatsappQueues':function(){return new Promise(function(_0x4ab200){var _0x542309=[];for(var _0x430537 in _0x570501[_0x87ba('0x64')]){if(_0x570501[_0x87ba('0x64')][_0x87ba('0x53')](_0x430537)){var _0x275cb2=_0x570501[_0x87ba('0x64')][_0x430537];var _0x4e450d={'id':_0x275cb2['id'],'available':_0x275cb2['available'],'loggedIn':_0x275cb2['loggedIn'],'name':_0x275cb2[_0x87ba('0x5c')],'paused':_0x275cb2[_0x87ba('0x5d')],'waiting':_0x275cb2[_0x87ba('0x5e')]};_0x542309[_0x87ba('0x23')](_0x4e450d);}}_0x4ab200({'count':_0x542309['length'],'rows':_0x542309});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1fcf68){var _0x14c822=_[_0x87ba('0x58')](_0x570501['chatQueuesWaitingInteractions']);_0x1fcf68({'count':_0x14c822[_0x87ba('0x1c')],'rows':_0x14c822});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3d0a3d){var _0x1c961e=_[_0x87ba('0x58')](_0x570501['mailQueuesWaitingInteractions']);_0x3d0a3d({'count':_0x1c961e['length'],'rows':_0x1c961e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1f2702){var _0x321c64=_[_0x87ba('0x58')](_0x570501['openchannelQueuesWaitingInteractions']);_0x1f2702({'count':_0x321c64[_0x87ba('0x1c')],'rows':_0x321c64});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2e64a5){var _0x29185e=_[_0x87ba('0x58')](_0x570501[_0x87ba('0x65')]);_0x2e64a5({'count':_0x29185e[_0x87ba('0x1c')],'rows':_0x29185e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4c4c8c){var _0xe2dfc5=_['values'](_0x570501[_0x87ba('0x66')]);_0x4c4c8c({'count':_0xe2dfc5['length'],'rows':_0xe2dfc5});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4f754b){var _0x1fc4e0=_[_0x87ba('0x58')](_0x570501[_0x87ba('0x67')]);_0x4f754b({'count':_0x1fc4e0['length'],'rows':_0x1fc4e0});});}};var _0x2909e5=jayson[_0x87ba('0x68')](_0x4c9e79)[_0x87ba('0x69')]();_0x2909e5['on'](_0x87ba('0x3c'),function(_0x3d0a24){logger[_0x87ba('0x3c')](JSON['stringify'](_0x3d0a24));return _0x44f3a1(_0x3d0a24);});_0x2909e5[_0x87ba('0x14')](0x232c,_0x87ba('0x6a'),function(){console[_0x87ba('0x6b')](_0x87ba('0x6c'),0x232c);return _0x1d93cf(_0x87ba('0x6d')+0x232c);});});}; \ No newline at end of file +var _0xfd33=['catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','info','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','UserId'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfd33,0xdd));var _0x3fd3=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xfd33[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x3fd3('0x0'));var util=require('util');var path=require(_0x3fd3('0x1'));var fs=require('fs');var jayson=require(_0x3fd3('0x2'));var BPromise=require(_0x3fd3('0x3'));var utils=require(_0x3fd3('0x4'));var sUtils=require(_0x3fd3('0x5'));var logger=require('../../../config/logger')(_0x3fd3('0x6'));var rpc={'openchannelQueueReport':require(_0x3fd3('0x7')),'mailQueueReport':require(_0x3fd3('0x8')),'chatQueueReport':require(_0x3fd3('0x9')),'smsQueueReport':require(_0x3fd3('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3fd3('0xb'))};var RuleEngine=require(_0x3fd3('0xc'));function getId(_0x2c8784,_0x66acea,_0x16dc25){return util[_0x3fd3('0xd')](_0x3fd3('0xe'),_0x2c8784,_0x66acea||0x0,_0x16dc25||0x0);}function getIntervals(_0x27b661,_0x461f29){var _0x485af8=[];if(!_[_0x3fd3('0xf')](_0x461f29['IntervalId'])&&!_[_0x3fd3('0xf')](_0x27b661[_0x461f29[_0x3fd3('0x10')]])&&!_['isNil'](_0x27b661[_0x461f29['IntervalId']]['Intervals'])){_0x485af8=_[_0x3fd3('0x11')](_0x27b661[_0x461f29['IntervalId']]['Intervals'],'interval');}else if(!_[_0x3fd3('0xf')](_0x461f29['interval'])){_0x485af8=[_0x461f29[_0x3fd3('0x12')]];}return _0x485af8;}exports['listen']=function(_0x3a7264){_0x3a7264[_0x3fd3('0x13')]={};return new BPromise(function(_0x1dc6c2,_0x3e0cdc){var _0x3dd830={'Start':function(_0x163e86){var _0xcaef8=this;return new Promise(function(_0x1bf9bb,_0x509d61){if(_0x163e86){try{var _0x2d6a3f=[];var _0x146e92=getId(_0x163e86[_0x3fd3('0x14')],_0x163e86[_0x3fd3('0x15')]?_0x163e86['message']['id']:0x0,_0x163e86[_0x3fd3('0x16')]?_0x163e86['interaction']['id']:0x0);var _0x297d29=sUtils['checkWaitingNotifications'](_0x3a7264,_0x163e86);if(!_0x297d29&&_0x163e86['applications']&&_[_0x3fd3('0x17')](_0x163e86['applications'])&&_0x163e86[_0x3fd3('0x18')]['length']){for(var _0x3b62b0=0x0;_0x3b62b0<_0x163e86[_0x3fd3('0x18')][_0x3fd3('0x19')];_0x3b62b0+=0x1){var _0x4ae6e1=_0x163e86[_0x3fd3('0x18')][_0x3b62b0];if(fs[_0x3fd3('0x1a')](path[_0x3fd3('0x1b')](__dirname,_0x3fd3('0x18'),_0x4ae6e1[_0x3fd3('0x1c')]+_0x3fd3('0x1d')))){var _0x3303ef=[];switch(_0x4ae6e1['app']['toLowerCase']()){case _0x3fd3('0x1e'):var _0x5cf4f1=_0x4ae6e1[_0x3fd3('0x1f')][_0x3fd3('0x20')](',');if(_0x163e86[_0x3fd3('0x14')]==='mail'){_0x3303ef[_0x3fd3('0x21')](_0x5cf4f1[0x0]);_0x3303ef[_0x3fd3('0x21')](_0x5cf4f1[0x1]);_0x3303ef['push'](_0x5cf4f1[_0x3fd3('0x22')](0x2,_0x5cf4f1[_0x3fd3('0x19')])[_0x3fd3('0x1b')](','));}else{_0x3303ef['push'](_0x5cf4f1[0x0]);_0x3303ef[_0x3fd3('0x21')](_0x5cf4f1[_0x3fd3('0x22')](0x1,_0x5cf4f1['length'])[_0x3fd3('0x1b')](','));}break;case _0x3fd3('0x23'):var _0x1f7a49=_0x4ae6e1['appdata'][_0x3fd3('0x20')](',');_0x3303ef[_0x3fd3('0x21')](_0x1f7a49[0x0]);_0x3303ef['push'](_0x1f7a49[0x1]);_0x3303ef[_0x3fd3('0x21')](_0x1f7a49[_0x3fd3('0x22')](0x2,_0x1f7a49[_0x3fd3('0x19')])[_0x3fd3('0x1b')](','));break;case _0x3fd3('0x24'):var _0x23090d=_0x4ae6e1[_0x3fd3('0x1f')][_0x3fd3('0x20')](',');_0x3303ef['push'](_0x23090d[0x0]);_0x3303ef[_0x3fd3('0x21')](_0x23090d[0x1]);_0x3303ef[_0x3fd3('0x21')](_0x23090d[0x2]);_0x3303ef[_0x3fd3('0x21')](_0x23090d[0x3]);_0x3303ef['push'](_0x23090d[_0x3fd3('0x22')](0x4,_0x23090d[_0x3fd3('0x19')])[_0x3fd3('0x1b')](','));break;case _0x3fd3('0x25'):var _0x53c2e4=_0x4ae6e1[_0x3fd3('0x1f')][_0x3fd3('0x20')](',');_0x3303ef[_0x3fd3('0x21')](_0x53c2e4[0x0]);_0x3303ef[_0x3fd3('0x21')](_0x53c2e4[0x1]);_0x3303ef[_0x3fd3('0x21')](_0x53c2e4[0x2]);_0x3303ef[_0x3fd3('0x21')](_0x53c2e4[0x3]);_0x3303ef[_0x3fd3('0x21')](_0x53c2e4[_0x3fd3('0x22')](0x4,_0x53c2e4[_0x3fd3('0x19')])[_0x3fd3('0x1b')](','));break;case _0x3fd3('0x15'):_0x3303ef['push'](_0x4ae6e1['appdata']);break;case _0x3fd3('0x26'):_0x3303ef[_0x3fd3('0x21')](_0x4ae6e1[_0x3fd3('0x27')]);_0x3303ef[_0x3fd3('0x21')](_0x4ae6e1['appdata']);break;case _0x3fd3('0x28'):var _0x57454b=utils['getMustacheRender'](_0x163e86['account'][_0x3fd3('0x29')],_0x163e86);var _0x18c027=_0x4ae6e1[_0x3fd3('0x1f')][_0x3fd3('0x20')](',');_0x3303ef[_0x3fd3('0x21')](_0x18c027[0x0]);_0x3303ef[_0x3fd3('0x21')](_0x18c027[0x1]);_0x3303ef['push'](_0x18c027[0x2]);_0x3303ef[_0x3fd3('0x21')](_0x18c027[0x3]);_0x3303ef['push'](_0x18c027[0x4]);_0x3303ef[_0x3fd3('0x21')](_0x18c027[0x5]);_0x3303ef[_0x3fd3('0x21')](_0x18c027[0x6]);_0x3303ef[_0x3fd3('0x21')](_0x18c027[0x7]);_0x3303ef['push'](_0x18c027[0x8]);_0x3303ef[_0x3fd3('0x21')](_0x18c027[0x9]);_0x3303ef[_0x3fd3('0x21')](_0x18c027[0xa]);_0x3303ef[_0x3fd3('0x21')](_0x163e86['interaction']['id']);_0x3303ef[_0x3fd3('0x21')](_0x163e86[_0x3fd3('0x15')]['id']);_0x3303ef[_0x3fd3('0x21')](_0x4ae6e1['ChatWebsiteId']);_0x3303ef['push'](_0x163e86['interaction'][_0x3fd3('0x2a')]);_0x3303ef[_0x3fd3('0x21')](_0x163e86['body'][_0x3fd3('0x2b')]);_0x3303ef['push'](_0x57454b);break;default:_0x3303ef=_[_0x3fd3('0xf')](_0x4ae6e1['appdata'])?[]:_0x4ae6e1[_0x3fd3('0x1f')][_0x3fd3('0x20')](',');}var _0x1ae718={'id':util[_0x3fd3('0xd')](_0x3fd3('0x2c'),_0x146e92,_0x4ae6e1['id'],_0x4ae6e1[_0x3fd3('0x1c')]),'condition':require(_0x3fd3('0x2d'))[_0x3fd3('0x2e')](_0x146e92,getIntervals(_0x3a7264['intervals'],_0x4ae6e1),_0x3a7264),'consequence':require('./applications/'+_0x4ae6e1[_0x3fd3('0x1c')])[_0x3fd3('0x2f')](_0x146e92,_0x3303ef,_0x3a7264,_0x163e86),'p':_0x4ae6e1[_0x3fd3('0x30')]||0x0};logger['info'](_0x3fd3('0x31'),_0x1ae718['id'],_0x3fd3('0x32'),getIntervals(_0x3a7264['intervals'],_0x4ae6e1)[_0x3fd3('0x1b')](_0x3fd3('0x33')));_0x2d6a3f['push'](_0x1ae718);}else{logger[_0x3fd3('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x3fd3('0x1b')](__dirname,_0x3fd3('0x18'),_0x4ae6e1[_0x3fd3('0x1c')]+_0x3fd3('0x1d')));}}_0x3a7264[_0x3fd3('0x13')][_0x146e92]=new RuleEngine(_0x2d6a3f);_0x3a7264[_0x3fd3('0x13')][_0x146e92]['execute'](_0x163e86,function(_0x42d1a1){logger[_0x3fd3('0x35')]('Applications\x20executed',JSON['stringify'](_0x42d1a1[_0x3fd3('0x36')]));if(_0x3a7264[_0x3fd3('0x13')][_0x146e92]){_0x3a7264[_0x3fd3('0x13')][_0x146e92][_0x3fd3('0x37')](_0x3fd3('0x38'));}});return _0x1bf9bb({'code':0xc8,'message':_0x163e86});}else{if(_0x297d29){logger[_0x3fd3('0x35')](util[_0x3fd3('0xd')](_0x3fd3('0x39'),_0x146e92));}else{logger[_0x3fd3('0x35')](_0x3fd3('0x3a'));}return _0x1bf9bb({'code':0xc8,'message':_0x163e86});}}catch(_0x33c698){logger['error'](_0x33c698[_0x3fd3('0x3b')]);return _0x509d61(_0xcaef8[_0x3fd3('0x34')](0x1f4,_0x33c698));}}return _0x509d61(_0x3fd3('0x3c'));});},'AcceptMessage':function(_0x22be18){var _0x3a276c=this;return new Promise(function(_0xac3565,_0x12380a){if(_0x22be18[_0x3fd3('0x3d')]&&_0x22be18['agent']['id']){if(_0x3a7264[_0x3fd3('0x3e')][_0x22be18['agent']['id']]){_0x3a7264['agents'][_0x22be18['agent']['id']]['busy']=![];_0x3a7264[_0x3fd3('0x3e')][_0x22be18[_0x3fd3('0x3d')]['id']][_0x3fd3('0x3f')]=undefined;}}if(_0x22be18['message']&&_0x22be18[_0x3fd3('0x15')]['id']){try{var _0x1d1e72=getId(_0x22be18[_0x3fd3('0x14')],_0x22be18['message']?_0x22be18['message']['id']:0x0,_0x22be18['interaction']?_0x22be18[_0x3fd3('0x16')]['id']:0x0);if(_0x3a7264['rules'][_0x1d1e72]){_0x3a7264[_0x3fd3('0x13')][_0x1d1e72]['emit'](_0x3fd3('0x40'));if(rpc[_0x22be18['channel']+_0x3fd3('0x41')]){rpc[_0x22be18[_0x3fd3('0x14')]+'QueueReport']['update'](_0x1d1e72,{'UserId':_0x22be18['message'][_0x3fd3('0x42')]})[_0x3fd3('0x43')](function(){logger[_0x3fd3('0x34')](_0x3fd3('0x44'));});}}return _0xac3565({'code':0xc8,'message':_0x22be18});}catch(_0x2ec208){logger[_0x3fd3('0x34')](_0x2ec208[_0x3fd3('0x3b')]);return _0x12380a(_0x3a276c['error'](0x1f4,_0x2ec208));}}logger['error'](_0x3fd3('0x45'));return _0x12380a(_0x3a276c[_0x3fd3('0x34')](0x1f4,_0x3fd3('0x45')));});},'RejectMessage':function(_0x33b671){var _0x2b5195=this;return new Promise(function(_0x3875f7,_0x5996fd){if(_0x33b671[_0x3fd3('0x3d')]&&_0x33b671[_0x3fd3('0x3d')]['id']){try{if(_0x3a7264['agents'][_0x33b671['agent']['id']]){_0x3a7264[_0x3fd3('0x3e')][_0x33b671[_0x3fd3('0x3d')]['id']]['busy']=![];_0x3a7264['agents'][_0x33b671[_0x3fd3('0x3d')]['id']][_0x3fd3('0x3f')]=undefined;}return _0x3875f7({'code':0xc8,'message':_0x33b671});}catch(_0xc3e5a6){logger[_0x3fd3('0x34')](_0xc3e5a6[_0x3fd3('0x3b')]);return _0x5996fd(_0x2b5195[_0x3fd3('0x34')](0x1f4,_0xc3e5a6));}}logger['error']('message\x20is\x20empty');return _0x5996fd(_0x2b5195[_0x3fd3('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x233bfb){var _0xda5ebd=this;return new Promise(function(_0x561fc4,_0x4b9094){if(_0x233bfb[_0x3fd3('0x14')]&&_0x233bfb[_0x3fd3('0x16')]&&_0x233bfb[_0x3fd3('0x16')]['id']){try{var _0x290fc0=getId(_0x233bfb[_0x3fd3('0x14')],_0x233bfb[_0x3fd3('0x15')]?_0x233bfb['message']['id']:0x0,_0x233bfb['interaction']?_0x233bfb[_0x3fd3('0x16')]['id']:0x0);if(_0x3a7264[_0x3fd3('0x13')][_0x290fc0]){_0x3a7264[_0x3fd3('0x13')][_0x290fc0]['emit']('end');}return _0x561fc4({'code':0xc8,'message':_0x233bfb});}catch(_0xae0bc4){logger[_0x3fd3('0x34')](_0xae0bc4['stack']);return _0x4b9094(_0xda5ebd[_0x3fd3('0x34')](0x1f4,_0xae0bc4));}}logger[_0x3fd3('0x34')](_0x3fd3('0x45'));return _0x4b9094(_0xda5ebd[_0x3fd3('0x34')](0x1f4,_0x3fd3('0x45')));});},'AgentCapacity':function(_0x267d83){var _0x176976=this;return new Promise(function(_0x290159,_0x447c92){if(_0x3a7264[_0x3fd3('0x3e')][_0x3fd3('0x46')](_0x267d83['id'])){for(var _0x36d078 in _0x267d83['capacity']){if(_0x267d83['capacity'][_0x3fd3('0x46')](_0x36d078)){if(_0x3a7264[_0x3fd3('0x3e')][_0x267d83['id']][_0x3fd3('0x46')](_0x36d078+_0x3fd3('0x47'))){_0x3a7264[_0x3fd3('0x3e')][_0x267d83['id']][_0x36d078+_0x3fd3('0x47')]=parseInt(_0x267d83[_0x3fd3('0x48')][_0x36d078],0xa);}}}_0x3a7264[_0x3fd3('0x3e')][_0x267d83['id']]['updateRealtime']();return _0x290159({'code':0xc8,'message':_0x3a7264[_0x3fd3('0x3e')][_0x267d83['id']]});}else{return _0x447c92(_0x176976[_0x3fd3('0x34')](0x1f4,_0x3fd3('0x49')));}});},'Agents':function(_0x96a846){return new Promise(function(_0x3b6135){var _0x38f894=_['values'](_0x3a7264[_0x3fd3('0x3e')]);if(_0x96a846&&_0x96a846['id']){var _0x43165f=_['find'](_0x38f894,function(_0x124f03){return _0x124f03['id']===_0x96a846['id'];});_0x3b6135(_0x43165f);}else{_0x3b6135({'count':_0x38f894['length'],'rows':_0x38f894});}});},'ChatQueues':function(){return new Promise(function(_0x1a9b6c){var _0xe10d2c=[];for(var _0x1ebbc6 in _0x3a7264[_0x3fd3('0x4a')]){if(_0x3a7264[_0x3fd3('0x4a')][_0x3fd3('0x46')](_0x1ebbc6)){var _0x5518f1=_0x3a7264['chatQueues'][_0x1ebbc6];var _0x370db8={'id':_0x5518f1['id'],'available':_0x5518f1[_0x3fd3('0x4b')],'loggedIn':_0x5518f1[_0x3fd3('0x4c')],'name':_0x5518f1[_0x3fd3('0x4d')],'paused':_0x5518f1[_0x3fd3('0x4e')],'waiting':_0x5518f1[_0x3fd3('0x4f')]};_0xe10d2c[_0x3fd3('0x21')](_0x370db8);}}_0x1a9b6c({'count':_0xe10d2c[_0x3fd3('0x19')],'rows':_0xe10d2c});});},'MailQueues':function(){return new Promise(function(_0x179806){var _0x33af2e=[];for(var _0x4c523a in _0x3a7264[_0x3fd3('0x50')]){if(_0x3a7264[_0x3fd3('0x50')][_0x3fd3('0x46')](_0x4c523a)){var _0x29c370=_0x3a7264[_0x3fd3('0x50')][_0x4c523a];var _0x1daa79={'id':_0x29c370['id'],'available':_0x29c370[_0x3fd3('0x4b')],'loggedIn':_0x29c370['loggedIn'],'name':_0x29c370['name'],'paused':_0x29c370[_0x3fd3('0x4e')],'waiting':_0x29c370[_0x3fd3('0x4f')]};_0x33af2e['push'](_0x1daa79);}}_0x179806({'count':_0x33af2e[_0x3fd3('0x19')],'rows':_0x33af2e});});},'OpenchannelQueues':function(){return new Promise(function(_0x17931f){var _0x107875=[];for(var _0x3ff8f0 in _0x3a7264['openchannelQueues']){if(_0x3a7264['openchannelQueues']['hasOwnProperty'](_0x3ff8f0)){var _0x440ba5=_0x3a7264['openchannelQueues'][_0x3ff8f0];var _0x1c0676={'id':_0x440ba5['id'],'available':_0x440ba5[_0x3fd3('0x4b')],'loggedIn':_0x440ba5[_0x3fd3('0x4c')],'name':_0x440ba5[_0x3fd3('0x4d')],'paused':_0x440ba5[_0x3fd3('0x4e')],'waiting':_0x440ba5[_0x3fd3('0x4f')]};_0x107875[_0x3fd3('0x21')](_0x1c0676);}}_0x17931f({'count':_0x107875[_0x3fd3('0x19')],'rows':_0x107875});});},'SmsQueues':function(){return new Promise(function(_0x2d29f7){var _0x38ec3c=[];for(var _0x5c2fe2 in _0x3a7264[_0x3fd3('0x51')]){if(_0x3a7264[_0x3fd3('0x51')]['hasOwnProperty'](_0x5c2fe2)){var _0x4012de=_0x3a7264[_0x3fd3('0x51')][_0x5c2fe2];var _0x3e95e8={'id':_0x4012de['id'],'available':_0x4012de[_0x3fd3('0x4b')],'loggedIn':_0x4012de[_0x3fd3('0x4c')],'name':_0x4012de[_0x3fd3('0x4d')],'paused':_0x4012de['paused'],'waiting':_0x4012de[_0x3fd3('0x4f')]};_0x38ec3c[_0x3fd3('0x21')](_0x3e95e8);}}_0x2d29f7({'count':_0x38ec3c[_0x3fd3('0x19')],'rows':_0x38ec3c});});},'FaxQueues':function(){return new Promise(function(_0x2d98be){var _0x13b2ef=[];for(var _0x387fdc in _0x3a7264[_0x3fd3('0x52')]){if(_0x3a7264[_0x3fd3('0x52')]['hasOwnProperty'](_0x387fdc)){var _0x40480c=_0x3a7264[_0x3fd3('0x52')][_0x387fdc];var _0x59b3b8={'id':_0x40480c['id'],'available':_0x40480c[_0x3fd3('0x4b')],'loggedIn':_0x40480c[_0x3fd3('0x4c')],'name':_0x40480c['name'],'paused':_0x40480c[_0x3fd3('0x4e')],'waiting':_0x40480c[_0x3fd3('0x4f')]};_0x13b2ef['push'](_0x59b3b8);}}_0x2d98be({'count':_0x13b2ef[_0x3fd3('0x19')],'rows':_0x13b2ef});});},'WhatsappQueues':function(){return new Promise(function(_0x370ffb){var _0x5e776b=[];for(var _0x3eab1a in _0x3a7264['whatsappQueues']){if(_0x3a7264[_0x3fd3('0x53')][_0x3fd3('0x46')](_0x3eab1a)){var _0xc255fb=_0x3a7264[_0x3fd3('0x53')][_0x3eab1a];var _0x394700={'id':_0xc255fb['id'],'available':_0xc255fb['available'],'loggedIn':_0xc255fb[_0x3fd3('0x4c')],'name':_0xc255fb[_0x3fd3('0x4d')],'paused':_0xc255fb['paused'],'waiting':_0xc255fb['waiting']};_0x5e776b['push'](_0x394700);}}_0x370ffb({'count':_0x5e776b[_0x3fd3('0x19')],'rows':_0x5e776b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x45170b){var _0x6478fe=_['values'](_0x3a7264['chatQueuesWaitingInteractions']);_0x45170b({'count':_0x6478fe[_0x3fd3('0x19')],'rows':_0x6478fe});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x517697){var _0x10c887=_[_0x3fd3('0x54')](_0x3a7264[_0x3fd3('0x55')]);_0x517697({'count':_0x10c887['length'],'rows':_0x10c887});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2ed94d){var _0x39b30c=_[_0x3fd3('0x54')](_0x3a7264[_0x3fd3('0x56')]);_0x2ed94d({'count':_0x39b30c[_0x3fd3('0x19')],'rows':_0x39b30c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x40ec83){var _0x65e123=_[_0x3fd3('0x54')](_0x3a7264[_0x3fd3('0x57')]);_0x40ec83({'count':_0x65e123[_0x3fd3('0x19')],'rows':_0x65e123});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4cfae8){var _0x41ff65=_[_0x3fd3('0x54')](_0x3a7264[_0x3fd3('0x58')]);_0x4cfae8({'count':_0x41ff65[_0x3fd3('0x19')],'rows':_0x41ff65});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1a75ec){var _0x297cf6=_[_0x3fd3('0x54')](_0x3a7264[_0x3fd3('0x59')]);_0x1a75ec({'count':_0x297cf6[_0x3fd3('0x19')],'rows':_0x297cf6});});}};var _0xcf6a5b=jayson[_0x3fd3('0x5a')](_0x3dd830)[_0x3fd3('0x5b')]();_0xcf6a5b['on']('error',function(_0x2dc3c5){logger[_0x3fd3('0x34')](JSON['stringify'](_0x2dc3c5));return _0x3e0cdc(_0x2dc3c5);});_0xcf6a5b[_0x3fd3('0x5c')](0x232c,_0x3fd3('0x5d'),function(){console[_0x3fd3('0x5e')](_0x3fd3('0x5f'),0x232c);return _0x1dc6c2('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 adac215..de63abf 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 _0x451b=['result','catch','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','jayson/promise','lodash','routing','client','http','then','error','message'];(function(_0x59dd21,_0x3a9799){var _0xa03031=function(_0xdb9a34){while(--_0xdb9a34){_0x59dd21['push'](_0x59dd21['shift']());}};_0xa03031(++_0x3a9799);}(_0x451b,0x17c));var _0xb451=function(_0x32735f,_0x1d7924){_0x32735f=_0x32735f-0x0;var _0x23b083=_0x451b[_0x32735f];return _0x23b083;};'use strict';var util=require(_0xb451('0x0'));var BPromise=require(_0xb451('0x1'));var jayson=require(_0xb451('0x2'));var _=require(_0xb451('0x3'));var logger=require('../../../config/logger')(_0xb451('0x4'));var client=jayson[_0xb451('0x5')][_0xb451('0x6')]({'port':0x232a});function request(_0x7cfbd7,_0x3d4b19){return new BPromise(function(_0x6d67c2,_0x1ff7ac){return client['request'](_0x7cfbd7,_0x3d4b19)[_0xb451('0x7')](function(_0xc7cae5){if(_0xc7cae5[_0xb451('0x8')]){return _0x1ff7ac(_0xc7cae5[_0xb451('0x8')][_0xb451('0x9')]);}else{return _0x6d67c2(_0xc7cae5[_0xb451('0xa')]);}})[_0xb451('0xb')](function(_0x9d053a){return _0x1ff7ac(_0x9d053a);});});}exports['condition']=function(_0x105d95,_0x22162e,_0x2a21ef){return function(_0x18b41f){if(_0x2a21ef['rules']&&!_0x2a21ef[_0xb451('0xc')][_0x105d95]){logger['info'](_0xb451('0xd'),_0x105d95);return _0x18b41f[_0xb451('0xe')]();}var _0x2235af=[];for(var _0x17d923=0x0;_0x17d923<_0x22162e['length'];_0x17d923+=0x1){_0x2235af[_0xb451('0xf')](request(_0xb451('0x10'),{'command':util[_0xb451('0x11')](_0xb451('0x12'),_0x22162e[_0x17d923])})[_0xb451('0x7')](function(_0x473ca8){return _0x473ca8&&_0x473ca8[_0xb451('0x9')]&&_0x473ca8[_0xb451('0x9')][_0xb451('0x13')](_0xb451('0x14'))>=0x0?!![]:![];})[_0xb451('0xb')](function(_0x210617){logger[_0xb451('0x8')](_0xb451('0x15'),_0x105d95,_0x22162e[_0x17d923]);}));}BPromise[_0xb451('0x16')](_0x2235af)[_0xb451('0x7')](function(_0x5d0d1f){var _0x31c2b5=_[_0xb451('0x17')](_0x5d0d1f);logger[_0xb451('0x18')](_0xb451('0x19'),_0x105d95,_0x22162e[_0xb451('0x1a')](_0xb451('0x1b')),_0x31c2b5);_0x18b41f['when'](_0x31c2b5);})[_0xb451('0xb')](function(_0x4d6990){console[_0xb451('0x1c')](_0x4d6990);logger[_0xb451('0x8')](_0xb451('0x19'),_0x105d95,_0x22162e[_0xb451('0x1a')](_0xb451('0x1b')),_0x4d6990[_0xb451('0x1d')]);_0x18b41f['stop']();});};}; \ No newline at end of file +var _0x0757=['http','request','then','error','message','catch','condition','rules','stop','length','push','Command','format','true','[%s][INTERVAL]\x20%s','all','some','\x20|\x20','[%s][INTERVAL]\x20%s\x20%s','util','jayson/promise','lodash','../../../config/logger'];(function(_0x27d073,_0x207ff5){var _0x194ac1=function(_0x8b1ba1){while(--_0x8b1ba1){_0x27d073['push'](_0x27d073['shift']());}};_0x194ac1(++_0x207ff5);}(_0x0757,0x6f));var _0x7075=function(_0x3a331e,_0x7db48b){_0x3a331e=_0x3a331e-0x0;var _0x2684a6=_0x0757[_0x3a331e];return _0x2684a6;};'use strict';var util=require(_0x7075('0x0'));var BPromise=require('bluebird');var jayson=require(_0x7075('0x1'));var _=require(_0x7075('0x2'));var logger=require(_0x7075('0x3'))('routing');var client=jayson['client'][_0x7075('0x4')]({'port':0x232a});function request(_0x26a51a,_0x5df0c3){return new BPromise(function(_0x1fe5f2,_0x41ce5a){return client[_0x7075('0x5')](_0x26a51a,_0x5df0c3)[_0x7075('0x6')](function(_0x45453d){if(_0x45453d[_0x7075('0x7')]){return _0x41ce5a(_0x45453d['error'][_0x7075('0x8')]);}else{return _0x1fe5f2(_0x45453d['result']);}})[_0x7075('0x9')](function(_0x2cd912){return _0x41ce5a(_0x2cd912);});});}exports[_0x7075('0xa')]=function(_0x4e164d,_0x4ced3b,_0x1e78e1){return function(_0x4c3503){if(_0x1e78e1[_0x7075('0xb')]&&!_0x1e78e1['rules'][_0x4e164d]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4e164d);return _0x4c3503[_0x7075('0xc')]();}var _0x4b98b9=[];for(var _0x2324be=0x0;_0x2324be<_0x4ced3b[_0x7075('0xd')];_0x2324be+=0x1){_0x4b98b9[_0x7075('0xe')](request(_0x7075('0xf'),{'command':util[_0x7075('0x10')]('iftime\x20%s',_0x4ced3b[_0x2324be])})[_0x7075('0x6')](function(_0x1b4260){return _0x1b4260&&_0x1b4260['message']&&_0x1b4260[_0x7075('0x8')]['indexOf'](_0x7075('0x11'))>=0x0?!![]:![];})[_0x7075('0x9')](function(_0x39081d){logger['error'](_0x7075('0x12'),_0x4e164d,_0x4ced3b[_0x2324be]);}));}BPromise[_0x7075('0x13')](_0x4b98b9)[_0x7075('0x6')](function(_0x5aa4e8){var _0x32405b=_[_0x7075('0x14')](_0x5aa4e8);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x4e164d,_0x4ced3b['join'](_0x7075('0x15')),_0x32405b);_0x4c3503['when'](_0x32405b);})['catch'](function(_0x5279c3){console['log'](_0x5279c3);logger[_0x7075('0x7')](_0x7075('0x16'),_0x4e164d,_0x4ced3b['join'](_0x7075('0x15')),_0x5279c3['stack']);_0x4c3503[_0x7075('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 3f90a4e..a214ae1 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 _0x04b8=['ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','agentcalled','debug','destuniqueid','agentcalledAt','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x04b8,0x159));var _0x804b=function(_0x153eb6,_0x5a291f){_0x153eb6=_0x153eb6-0x0;var _0x3855a7=_0x04b8[_0x153eb6];return _0x3855a7;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x241a4f,_0xa6a605){utils['info'](util[_0x804b('0x1')](_0x804b('0x2'),_0x241a4f['uniqueid'],_0x241a4f[_0x804b('0x3')],_0x241a4f[_0x804b('0x4')],_0x241a4f[_0x804b('0x5')],_0x241a4f['interface'],_0x241a4f[_0x804b('0x6')],_0x241a4f[_0x804b('0x7')],_0x241a4f[_0x804b('0x8')]));if(_0x241a4f['queue']){utils[_0x804b('0x9')](_0x241a4f[_0x804b('0x4')])['then'](function(_0x2a5a68){if(_0x2a5a68){_0x241a4f[_0x804b('0xa')]=_0x2a5a68[_0x804b('0xa')];_0x241a4f[_0x804b('0xb')]=_0x241a4f[_0x804b('0xc')]?_0x2a5a68['acw']:![];_0x241a4f[_0x804b('0xd')]=_0x241a4f[_0x804b('0xb')]?_0x2a5a68[_0x804b('0xe')]:0x0;}utils[_0x804b('0xf')](_0x804b('0x10'),_0x241a4f);});}else{utils[_0x804b('0xf')]('CreateVoiceAgentReport',_0x241a4f);}if(_0xa6a605){delete transfers[_0x241a4f[_0x804b('0x11')]];}else{delete agents[_0x241a4f['destuniqueid']];}}exports[_0x804b('0x12')]=function(_0x3a2702){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x3a2702);agents[_0x3a2702[_0x804b('0x14')]]=_0x3a2702;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x15')]=utils['now']();agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x8')]='called';agents[_0x3a2702[_0x804b('0x14')]]['connectedlinenum']=null;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x16')]=null;utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x18'),_0x3a2702['uniqueid'],agents[_0x3a2702[_0x804b('0x14')]]['membername'],_0x3a2702[_0x804b('0x14')]));}catch(_0x95e719){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x95e719);}};exports[_0x804b('0x1a')]=function(_0x427166){try{if(!_[_0x804b('0x1b')](agents[_0x427166[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166[_0x804b('0x11')]),_0x427166);utils[_0x804b('0x17')](util[_0x804b('0x1')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x427166[_0x804b('0x11')],agents[_0x427166[_0x804b('0x14')]]['membername'],_0x427166[_0x804b('0x14')]));agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1a')]=!![];agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1d')]=utils['now']();agents[_0x427166[_0x804b('0x14')]][_0x804b('0x8')]='timeout';agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1e')]=_0x804b('0x1f');agents[_0x427166[_0x804b('0x14')]][_0x804b('0x20')]=_0x427166['ringtime']?parseInt(_0x427166[_0x804b('0x21')])/0x3e8:0x0;agents[_0x427166[_0x804b('0x14')]][_0x804b('0x22')]=0x0;unanswered[_0x804b('0x23')](_0x427166[_0x804b('0x14')]);}}catch(_0x4a6079){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166['uniqueid']),_0x4a6079);}};exports[_0x804b('0x24')]=function(_0x407357){try{_[_0x804b('0x25')](agents,function(_0x57b8da,_0x408857){if(_0x57b8da[_0x804b('0x11')]==_0x407357['uniqueid']&&!_[_0x804b('0x26')](unanswered,_0x57b8da[_0x804b('0x14')])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x407357);utils['info'](util[_0x804b('0x1')](_0x804b('0x28'),_0x407357[_0x804b('0x11')],_0x57b8da[_0x804b('0x5')],_0x57b8da[_0x804b('0x14')]));_0x57b8da[_0x804b('0x1a')]=!![];_0x57b8da[_0x804b('0x1d')]=utils[_0x804b('0x29')]();_0x57b8da[_0x804b('0x8')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x1e')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x20')]=_0x407357[_0x804b('0x20')];_0x57b8da[_0x804b('0x22')]=0x0;writeDB(_0x57b8da);}});}catch(_0x384c44){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x384c44);}};exports[_0x804b('0x2b')]=function(_0x350387){try{if(agents[_0x350387[_0x804b('0x14')]]){utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387['uniqueid']),_0x350387);utils['info'](util[_0x804b('0x1')](_0x804b('0x2c'),_0x350387[_0x804b('0x11')],agents[_0x350387['destuniqueid']]['membername'],_0x350387['destuniqueid']));agents[_0x350387[_0x804b('0x14')]][_0x804b('0x2d')]=utils[_0x804b('0x29')]();agents[_0x350387[_0x804b('0x14')]][_0x804b('0x7')]=_0x350387[_0x804b('0x7')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x16')]=_0x350387[_0x804b('0x16')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x20')]=_0x350387[_0x804b('0x21')];agents[_0x350387[_0x804b('0x14')]]['lastevent']=_0x804b('0x2e');_[_0x804b('0x25')](agents,function(_0xb877d6,_0x3d6d8a){if(_0xb877d6[_0x804b('0x14')]!=_0x350387['destuniqueid']&&_0xb877d6['uniqueid']==_0x350387[_0x804b('0x11')]){_0xb877d6[_0x804b('0x22')]=0x0;_0xb877d6[_0x804b('0x20')]=_0x350387['ringtime'];_0xb877d6[_0x804b('0x1a')]=!![];_0xb877d6['agentringnoanswerAt']=utils[_0x804b('0x29')]();_0xb877d6[_0x804b('0x8')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x1e')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x30')]=_0x350387[_0x804b('0x14')];_0xb877d6['answeredelsewheremembername']=_0x350387[_0x804b('0x5')];writeDB(_0xb877d6);}});}}catch(_0x1c0363){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387[_0x804b('0x11')]),_0x1c0363);}};exports[_0x804b('0xc')]=function(_0x1df519){try{if(!_[_0x804b('0x1b')](agents[_0x1df519[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519['uniqueid']),_0x1df519);utils[_0x804b('0x17')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1df519['uniqueid'],agents[_0x1df519[_0x804b('0x14')]]['membername'],_0x1df519[_0x804b('0x14')]));agents[_0x1df519[_0x804b('0x14')]][_0x804b('0xc')]=!![];agents[_0x1df519[_0x804b('0x14')]]['agentcompleteAt']=utils[_0x804b('0x29')]();agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x22')]=utils['diffTime'](agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x32')],agents[_0x1df519[_0x804b('0x14')]]['agentconnectAt']);agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x1e')]=_0x1df519[_0x804b('0x1e')];agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x8')]=_0x804b('0x33');writeDB(agents[_0x1df519[_0x804b('0x14')]]);}}catch(_0x2a2a08){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519[_0x804b('0x11')]),_0x2a2a08);}};exports[_0x804b('0x34')]=function(_0x2c1796){try{if(!_['isNil'](agents[_0x2c1796['transfereruniqueid']])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x35'),_0x2c1796[_0x804b('0x11')]),_0x2c1796);utils[_0x804b('0x17')](util['format'](_0x804b('0x36'),_0x2c1796[_0x804b('0x11')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x5')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')]));agents[_0x2c1796['transfereruniqueid']]['transfer']=!![];agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x38')]='blind';agents[_0x2c1796['transfereruniqueid']][_0x804b('0x39')]=_0x2c1796[_0x804b('0x3a')];agents[_0x2c1796[_0x804b('0x37')]]['transferuniqueid']=agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')];}}catch(_0x54cc99){utils[_0x804b('0x19')](util['format'](_0x804b('0x35'),_0x2c1796['uniqueid']),_0x54cc99);}};exports[_0x804b('0x3b')]=function(_0x183e72){try{utils['debug'](util[_0x804b('0x1')]('[%s][agents][attendedtransfer]',_0x183e72[_0x804b('0x3c')]),_0x183e72);if(_0x183e72[_0x804b('0x3c')]==_0x183e72[_0x804b('0x3d')]){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3e')]])){utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3e')]]['membername']));agents[_0x183e72['secondtransfereruniqueid']][_0x804b('0x40')]=!![];agents[_0x183e72['secondtransfereruniqueid']]['transfertype']=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x39')]=_0x183e72[_0x804b('0x42')];agents[_0x183e72['secondtransfereruniqueid']]['transferuniqueid']=_0x183e72[_0x804b('0x3c')];}if(_0x183e72[_0x804b('0x43')]&&agents[_0x183e72[_0x804b('0x43')]]){agents[_0x183e72[_0x804b('0x43')]][_0x804b('0x44')]=0x1;transfers[_0x183e72[_0x804b('0x43')]]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x43')]]);transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x6')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x6')];transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x46')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x46')];transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x15')]=utils[_0x804b('0x29')]();transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x2d')]=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x20')]=0x0;transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x44')]=0x2;}}else if(_0x183e72[_0x804b('0x3e')]==_0x183e72['secondtransfererlinkedid']){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3c')]])){utils[_0x804b('0x17')](util['format'](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x5')]));agents[_0x183e72[_0x804b('0x3c')]]['transfer']=!![];agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x38')]=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3c')]]['transferexten']=_0x183e72['secondtransfererexten'];agents[_0x183e72[_0x804b('0x3c')]]['transferuniqueid']=_0x183e72[_0x804b('0x3e')];}if(_0x183e72[_0x804b('0x47')]&&agents[_0x183e72[_0x804b('0x47')]]){agents[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x1;transfers[_0x183e72['transfertargetuniqueid']]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x47')]]);transfers[_0x183e72[_0x804b('0x47')]]['calleridnum']=agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x6')];transfers[_0x183e72['transfertargetuniqueid']][_0x804b('0x46')]=agents[_0x183e72['origtransfereruniqueid']][_0x804b('0x46')];transfers[_0x183e72[_0x804b('0x47')]]['agentcalledAt']=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x2d')]=utils['now']();transfers[_0x183e72[_0x804b('0x47')]]['holdtime']=0x0;transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x2;}}}catch(_0x43f3ec){utils[_0x804b('0x19')](util['format'](_0x804b('0x48'),_0x183e72[_0x804b('0x3c')]),_0x43f3ec);}};exports[_0x804b('0x49')]=function(_0xa1da42){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][hangup]',_0xa1da42[_0x804b('0x11')]),_0xa1da42);if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x1e')]===_0x804b('0x1f')){if(_0xa1da42[_0x804b('0x4a')]==='21'){agents[_0xa1da42[_0x804b('0x11')]]['reason']=_0x804b('0x4b');agents[_0xa1da42[_0x804b('0x11')]]['lastevent']=_0x804b('0x4b');}utils[_0x804b('0x17')](util['format'](_0x804b('0x4c'),_0xa1da42['uniqueid'],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);var _0x5efc95=unanswered[_0x804b('0x4d')](_0xa1da42['uniqueid']);if(_0x5efc95>-0x1){unanswered[_0x804b('0x4e')](_0x5efc95,0x1);}}if(transfers[_0xa1da42[_0x804b('0x11')]]){transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0xc')]=!![];transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x32')]=utils[_0x804b('0x29')]();transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils[_0x804b('0x4f')](transfers[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt'],transfers[_0xa1da42['uniqueid']][_0x804b('0x2d')]);transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')]=_0x804b('0x50');transfers[_0xa1da42['uniqueid']][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],transfers[_0xa1da42['uniqueid']]['lastevent']));writeDB(transfers[_0xa1da42[_0x804b('0x11')]],!![]);}if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x2d')]){agents[_0xa1da42[_0x804b('0x11')]]['agentcomplete']=!![];agents[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt']=utils['now']();agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils['diffTime'](agents[_0xa1da42['uniqueid']][_0x804b('0x32')],agents[_0xa1da42[_0x804b('0x11')]]['agentconnectAt']);agents[_0xa1da42[_0x804b('0x11')]]['reason']=agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x40')]?_0x804b('0x40'):'agent';agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]]['reason'],agents[_0xa1da42['uniqueid']][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);}}catch(_0x3dd61f){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x51'),_0xa1da42[_0x804b('0x11')]),_0x3dd61f);}}; \ No newline at end of file +var _0xbfcc=['now','lastevent','called','connectedlinename','agentringnoanswer','isNil','debug','timeout','reason','holdtime','ringtime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','talktime','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','info','format','membername','interface','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','uniqueid'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xbfcc[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1a2fe0,_0x2d1386){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1a2fe0['uniqueid'],_0x1a2fe0['channel'],_0x1a2fe0['queue'],_0x1a2fe0[_0xcbfc('0x3')],_0x1a2fe0[_0xcbfc('0x4')],_0x1a2fe0['calleridnum'],_0x1a2fe0[_0xcbfc('0x5')],_0x1a2fe0['lastevent']));if(_0x1a2fe0[_0xcbfc('0x6')]){utils[_0xcbfc('0x7')](_0x1a2fe0[_0xcbfc('0x6')])[_0xcbfc('0x8')](function(_0x4eff22){if(_0x4eff22){_0x1a2fe0[_0xcbfc('0x9')]=_0x4eff22[_0xcbfc('0x9')];_0x1a2fe0[_0xcbfc('0xa')]=_0x1a2fe0[_0xcbfc('0xb')]?_0x4eff22[_0xcbfc('0xc')]:![];_0x1a2fe0[_0xcbfc('0xd')]=_0x1a2fe0['agentacw']?_0x4eff22[_0xcbfc('0xe')]:0x0;}utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);});}else{utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);}if(_0x2d1386){delete transfers[_0x1a2fe0['uniqueid']];}else{delete agents[_0x1a2fe0[_0xcbfc('0x11')]];}}exports[_0xcbfc('0x12')]=function(_0x80d08d){try{utils['debug'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x80d08d);agents[_0x80d08d[_0xcbfc('0x11')]]=_0x80d08d;agents[_0x80d08d[_0xcbfc('0x11')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x16')]=_0xcbfc('0x17');agents[_0x80d08d['destuniqueid']]['connectedlinenum']=null;agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x18')]=null;utils[_0xcbfc('0x1')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x80d08d[_0xcbfc('0x14')],agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x80d08d['destuniqueid']));}catch(_0x3825d5){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x3825d5);}};exports[_0xcbfc('0x19')]=function(_0x25c167){try{if(!_[_0xcbfc('0x1a')](agents[_0x25c167['destuniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')]('[%s][agents][agentringnoanswer]',_0x25c167[_0xcbfc('0x14')]),_0x25c167);utils['info'](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x25c167[_0xcbfc('0x14')],agents[_0x25c167['destuniqueid']]['membername'],_0x25c167[_0xcbfc('0x11')]));agents[_0x25c167[_0xcbfc('0x11')]][_0xcbfc('0x19')]=!![];agents[_0x25c167[_0xcbfc('0x11')]]['agentringnoanswerAt']=utils[_0xcbfc('0x15')]();agents[_0x25c167['destuniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1d')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1e')]=_0x25c167[_0xcbfc('0x1f')]?parseInt(_0x25c167[_0xcbfc('0x1f')])/0x3e8:0x0;agents[_0x25c167[_0xcbfc('0x11')]]['talktime']=0x0;unanswered[_0xcbfc('0x20')](_0x25c167[_0xcbfc('0x11')]);}}catch(_0x4f632a){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x22'),_0x25c167[_0xcbfc('0x14')]),_0x4f632a);}};exports[_0xcbfc('0x23')]=function(_0x19d2e){try{_[_0xcbfc('0x24')](agents,function(_0x5366cf,_0x41b68b){if(_0x5366cf[_0xcbfc('0x14')]==_0x19d2e[_0xcbfc('0x14')]&&!_[_0xcbfc('0x25')](unanswered,_0x5366cf['destuniqueid'])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x19d2e);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x27'),_0x19d2e['uniqueid'],_0x5366cf[_0xcbfc('0x3')],_0x5366cf[_0xcbfc('0x11')]));_0x5366cf['agentringnoanswer']=!![];_0x5366cf[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x5366cf[_0xcbfc('0x16')]='abandoned';_0x5366cf['reason']='abandoned';_0x5366cf[_0xcbfc('0x1e')]=_0x19d2e[_0xcbfc('0x1e')];_0x5366cf[_0xcbfc('0x29')]=0x0;writeDB(_0x5366cf);}});}catch(_0x9c1ff3){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x9c1ff3);}};exports['agentconnect']=function(_0x2f14ff){try{if(agents[_0x2f14ff[_0xcbfc('0x11')]]){utils['debug'](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]',_0x2f14ff[_0xcbfc('0x14')]),_0x2f14ff);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f14ff[_0xcbfc('0x14')],agents[_0x2f14ff['destuniqueid']]['membername'],_0x2f14ff[_0xcbfc('0x11')]));agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x5')]=_0x2f14ff[_0xcbfc('0x5')];agents[_0x2f14ff[_0xcbfc('0x11')]]['connectedlinename']=_0x2f14ff[_0xcbfc('0x18')];agents[_0x2f14ff['destuniqueid']][_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x16')]='connect';_['forIn'](agents,function(_0x236b66,_0x1c678b){if(_0x236b66[_0xcbfc('0x11')]!=_0x2f14ff[_0xcbfc('0x11')]&&_0x236b66[_0xcbfc('0x14')]==_0x2f14ff['uniqueid']){_0x236b66[_0xcbfc('0x29')]=0x0;_0x236b66[_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];_0x236b66['agentringnoanswer']=!![];_0x236b66[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x236b66[_0xcbfc('0x16')]='answered_elsewhere';_0x236b66[_0xcbfc('0x1d')]=_0xcbfc('0x2b');_0x236b66[_0xcbfc('0x2c')]=_0x2f14ff[_0xcbfc('0x11')];_0x236b66[_0xcbfc('0x2d')]=_0x2f14ff[_0xcbfc('0x3')];writeDB(_0x236b66);}});}}catch(_0x1e14bb){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x2e'),_0x2f14ff['uniqueid']),_0x1e14bb);}};exports[_0xcbfc('0xb')]=function(_0x50a01c){try{if(!_[_0xcbfc('0x1a')](agents[_0x50a01c[_0xcbfc('0x11')]])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x2f'),_0x50a01c[_0xcbfc('0x14')]),_0x50a01c);utils['info'](util[_0xcbfc('0x2')](_0xcbfc('0x30'),_0x50a01c[_0xcbfc('0x14')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x50a01c[_0xcbfc('0x11')]));agents[_0x50a01c[_0xcbfc('0x11')]]['agentcomplete']=!![];agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x31')]=utils['now']();agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x50a01c['destuniqueid']][_0xcbfc('0x31')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x2a')]);agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x1d')]=_0x50a01c[_0xcbfc('0x1d')];agents[_0x50a01c[_0xcbfc('0x11')]]['lastevent']='complete';writeDB(agents[_0x50a01c[_0xcbfc('0x11')]]);}}catch(_0x94398c){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')]('[%s][agents][agentcomplete]',_0x50a01c['uniqueid']),_0x94398c);}};exports[_0xcbfc('0x33')]=function(_0xe5c5ef){try{if(!_[_0xcbfc('0x1a')](agents[_0xe5c5ef['transfereruniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x34'),_0xe5c5ef['uniqueid']),_0xe5c5ef);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x35'),_0xe5c5ef[_0xcbfc('0x14')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x3')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')]));agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x37')]=!![];agents[_0xe5c5ef['transfereruniqueid']][_0xcbfc('0x38')]=_0xcbfc('0x39');agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferexten']=_0xe5c5ef[_0xcbfc('0x3a')];agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferuniqueid']=agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')];}}catch(_0x38db76){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x34'),_0xe5c5ef[_0xcbfc('0x14')]),_0x38db76);}};exports['attendedtransfer']=function(_0x2fe240){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x3b'),_0x2fe240[_0xcbfc('0x3c')]),_0x2fe240);if(_0x2fe240[_0xcbfc('0x3c')]==_0x2fe240[_0xcbfc('0x3d')]){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3e')]])){utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x3f'),_0x2fe240['origtransfereruniqueid'],agents[_0x2fe240['secondtransfereruniqueid']]['membername']));agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x42')];agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3c')];}if(_0x2fe240[_0xcbfc('0x44')]&&agents[_0x2fe240['transfereeuniqueid']]){agents[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x45')]=0x1;transfers[_0x2fe240[_0xcbfc('0x44')]]=_[_0xcbfc('0x46')](agents[_0x2fe240[_0xcbfc('0x44')]]);transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x47')]=agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x47')];transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x48')]=agents[_0x2fe240[_0xcbfc('0x3e')]]['calleridname'];transfers[_0x2fe240[_0xcbfc('0x44')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x45')]=0x2;}}else if(_0x2fe240[_0xcbfc('0x3e')]==_0x2fe240['secondtransfererlinkedid']){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3c')]])){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x3f'),_0x2fe240[_0xcbfc('0x3c')],agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x3')]));agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x49')];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3e')];}if(_0x2fe240['transfertargetuniqueid']&&agents[_0x2fe240[_0xcbfc('0x4a')]]){agents[_0x2fe240[_0xcbfc('0x4a')]]['agententerreason']=0x1;transfers[_0x2fe240[_0xcbfc('0x4a')]]=_['clone'](agents[_0x2fe240['transfertargetuniqueid']]);transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x47')]=agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x47')];transfers[_0x2fe240[_0xcbfc('0x4a')]]['calleridname']=agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x48')];transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x4b')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]]['agentconnectAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4c3d4d){utils[_0xcbfc('0x21')](util['format']('[%s][agents][attendedtransfer]',_0x2fe240[_0xcbfc('0x3c')]),_0x4c3d4d);}};exports['hangup']=function(_0x99068f){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x99068f);if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]===_0xcbfc('0x1c')){if(_0x99068f['cause']==='21'){agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x4d');agents[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x4d');}utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x4e'),_0x99068f[_0xcbfc('0x14')],agents[_0x99068f[_0xcbfc('0x14')]]['membername'],agents[_0x99068f[_0xcbfc('0x14')]]['reason'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);var _0x51019a=unanswered[_0xcbfc('0x4f')](_0x99068f['uniqueid']);if(_0x51019a>-0x1){unanswered[_0xcbfc('0x50')](_0x51019a,0x1);}}if(transfers[_0x99068f[_0xcbfc('0x14')]]){transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0xb')]=!![];transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();transfers[_0x99068f['uniqueid']][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](transfers[_0x99068f[_0xcbfc('0x14')]]['agentcompleteAt'],transfers[_0x99068f[_0xcbfc('0x14')]]['agentconnectAt']);transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x51');transfers[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x52');utils['info'](util[_0xcbfc('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x99068f[_0xcbfc('0x14')],transfers[_0x99068f['uniqueid']][_0xcbfc('0x3')],transfers[_0x99068f[_0xcbfc('0x14')]]['reason'],transfers[_0x99068f[_0xcbfc('0x14')]]['lastevent']));writeDB(transfers[_0x99068f[_0xcbfc('0x14')]],!![]);}if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]){agents[_0x99068f['uniqueid']][_0xcbfc('0xb')]=!![];agents[_0x99068f['uniqueid']][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]);agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x37')]?_0xcbfc('0x37'):_0xcbfc('0x51');agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]='complete';utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x4e'),_0x99068f['uniqueid'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x3')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);}}catch(_0x4f38cb){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x4f38cb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 16da950..8d0404b 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 _0x553f=['appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','info','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','error','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x34950f,_0x345c88){var _0xaab5f7=function(_0x44b324){while(--_0x44b324){_0x34950f['push'](_0x34950f['shift']());}};_0xaab5f7(++_0x345c88);}(_0x553f,0x1c0));var _0xf553=function(_0x503877,_0x36edd4){_0x503877=_0x503877-0x0;var _0x561fc5=_0x553f[_0x503877];return _0x561fc5;};'use strict';var _=require(_0xf553('0x0'));var util=require(_0xf553('0x1'));var utils=require(_0xf553('0x2'));var transfers=require(_0xf553('0x3'));var dispositions=[_0xf553('0x4'),'FAILED','FAILED',_0xf553('0x4'),'NO\x20ANSWER',_0xf553('0x4'),_0xf553('0x5'),_0xf553('0x6'),'FAILED',_0xf553('0x7'),_0xf553('0x7')];var channels={};function writeDB(_0x38573a){var _0x54a907;if(transfers[_0xf553('0x8')][_0x38573a[_0xf553('0x9')]]){_0x54a907=_0x38573a['uniqueid'];_0x38573a['uniqueid']=transfers['blinds'][_0x38573a[_0xf553('0x9')]][_0xf553('0xa')];}utils['info'](util[_0xf553('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x38573a[_0xf553('0x9')],_0x38573a[_0xf553('0xc')],_0x38573a['queue'],_0x38573a[_0xf553('0xd')],_0x38573a[_0xf553('0xe')],_0x38573a[_0xf553('0xf')],_0x38573a[_0xf553('0x10')],_0x38573a[_0xf553('0x11')]));if(_0x38573a[_0xf553('0x12')]){utils[_0xf553('0x13')](_0x38573a[_0xf553('0x12')])[_0xf553('0x14')](function(_0x154752){if(_0x154752){_0x38573a['UserId']=_0x154752['id'];}utils[_0xf553('0x15')](_0xf553('0x16'),_0x38573a);});}else{utils['request'](_0xf553('0x16'),_0x38573a);}if(channels[_0x38573a[_0xf553('0x9')]]){delete channels[_0x38573a[_0xf553('0x9')]];}else if(_0x54a907&&channels[_0x54a907]){if(!transfers[_0xf553('0x8')][_0x54a907][_0xf553('0x17')])delete transfers[_0xf553('0x8')][_0x54a907];delete channels[_0x54a907];}}exports['newchannel']=function(_0x450bb3){try{utils[_0xf553('0x18')](util[_0xf553('0xb')](_0xf553('0x19'),_0x450bb3[_0xf553('0x9')]),_0x450bb3);if(_0x450bb3['uniqueid']==_0x450bb3[_0xf553('0x1a')]&&_0x450bb3[_0xf553('0xc')]!='OutgoingSpoolFailed'){utils['info'](util[_0xf553('0xb')](_0xf553('0x1b'),_0x450bb3['uniqueid'],_0x450bb3['context'],_0x450bb3[_0xf553('0x1c')]));channels[_0x450bb3['uniqueid']]={'uniqueid':_0x450bb3[_0xf553('0x9')],'accountcode':_0x450bb3[_0xf553('0x12')],'source':_0x450bb3[_0xf553('0xf')],'destination':_0x450bb3[_0xf553('0x1c')],'destinationcontext':_0x450bb3[_0xf553('0x1d')],'channel':_0x450bb3[_0xf553('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xf553('0x1e')};}}catch(_0x12e0d1){utils['error'](util[_0xf553('0xb')]('[%s][calls][newchannel]',_0x450bb3[_0xf553('0x9')]),_0x12e0d1);}};exports[_0xf553('0x1f')]=function(_0x3a0aa7){try{utils['debug'](util[_0xf553('0xb')]('[%s][calls][newstate]',_0x3a0aa7[_0xf553('0x9')]),_0x3a0aa7);if(!_[_0xf553('0x20')](channels[_0x3a0aa7['uniqueid']])&&_0x3a0aa7[_0xf553('0x21')]==0x6){utils['info'](util[_0xf553('0xb')](_0xf553('0x22'),_0x3a0aa7['uniqueid'],_0x3a0aa7[_0xf553('0x1d')],_0x3a0aa7[_0xf553('0xc')]));if(_[_0xf553('0x20')](channels[_0x3a0aa7['uniqueid']][_0xf553('0x23')])){channels[_0x3a0aa7[_0xf553('0x9')]][_0xf553('0x23')]=utils[_0xf553('0x24')]();}}else if(!_['isNil'](channels[_0x3a0aa7[_0xf553('0x1a')]])&&_0x3a0aa7[_0xf553('0x21')]==0x6&&_0x3a0aa7[_0xf553('0x1d')]!=_0xf553('0x25')){utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x27'),_0x3a0aa7[_0xf553('0x9')],_0x3a0aa7['linkedid'],_0x3a0aa7[_0xf553('0x1d')],_0x3a0aa7[_0xf553('0xc')]));channels[_0x3a0aa7['linkedid']][_0xf553('0x12')]=_0x3a0aa7[_0xf553('0x12')];channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x28')]=_0x3a0aa7[_0xf553('0xc')];if(_['isNil'](channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x29')])){channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x29')]=utils[_0xf553('0x24')]();}channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x2a')]=dispositions[_[_0xf553('0x2b')](_0x3a0aa7[_0xf553('0x21')])]||_0xf553('0x5');}}catch(_0x2808cc){utils['error'](util[_0xf553('0xb')](_0xf553('0x2c'),_0x3a0aa7[_0xf553('0x9')]),_0x2808cc);}};exports[_0xf553('0x2d')]=function(_0x21125b){try{if(!_[_0xf553('0x20')](channels[_0x21125b[_0xf553('0x9')]])){utils[_0xf553('0x18')](util[_0xf553('0xb')]('[%s][calls][hangup]',_0x21125b[_0xf553('0x9')]),_0x21125b);if(_[_0xf553('0x20')](channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x2e')])){channels[_0x21125b['uniqueid']][_0xf553('0x2e')]=_0x21125b[_0xf553('0x2f')]+'\x20<'+_0x21125b[_0xf553('0xf')]+'>';}utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x30'),_0x21125b[_0xf553('0x9')],channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x2e')],_0x21125b[_0xf553('0x31')]));channels[_0x21125b['uniqueid']][_0xf553('0x32')]=utils[_0xf553('0x24')]();channels[_0x21125b[_0xf553('0x9')]]['duration']=utils[_0xf553('0x33')](channels[_0x21125b['uniqueid']][_0xf553('0x32')],channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x34')]);channels[_0x21125b[_0xf553('0x9')]]['billableseconds']=channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x29')]?utils[_0xf553('0x33')](channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x32')],channels[_0x21125b[_0xf553('0x9')]]['answertime']):0x0;writeDB(channels[_0x21125b[_0xf553('0x9')]]);}}catch(_0x1e2f30){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x36'),_0x21125b[_0xf553('0x9')]),_0x1e2f30);}};exports[_0xf553('0x37')]=function(_0x18540f){try{if(!_['isNil'](channels[_0x18540f[_0xf553('0x38')]])){utils[_0xf553('0x18')](util[_0xf553('0xb')](_0xf553('0x39'),_0x18540f[_0xf553('0x3a')]),_0x18540f);if(channels[_0x18540f[_0xf553('0x38')]][_0xf553('0xc')]==_0x18540f['transfereechannel']){utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x18540f[_0xf553('0x3a')],_0x18540f['localtwolinkedid'],_0x18540f[_0xf553('0x3b')]));channels[_0x18540f[_0xf553('0x38')]][_0xf553('0x28')]=_0x18540f[_0xf553('0x3b')];channels[_0x18540f[_0xf553('0x38')]][_0xf553('0x3c')]=_0xf553('0x3d');}else if(channels[_0x18540f[_0xf553('0x38')]][_0xf553('0xc')]=_0x18540f[_0xf553('0x3e')]){utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x18540f[_0xf553('0x3a')],_0x18540f[_0xf553('0x38')],_0x18540f[_0xf553('0x3f')]));channels[_0x18540f[_0xf553('0x38')]]['destinationchannel']=_0x18540f[_0xf553('0x3f')];channels[_0x18540f['localtwolinkedid']][_0xf553('0x3c')]=_0xf553('0x3d');}}}catch(_0x4fb22e){utils[_0xf553('0x35')](util['format']('[%s][calls][attendedtransfer]',_0x18540f[_0xf553('0x3a')]),_0x4fb22e);}};exports[_0xf553('0x40')]=function(_0x473c38){try{if(!_[_0xf553('0x20')](channels[_0x473c38['uniqueid']])){utils[_0xf553('0x18')](util[_0xf553('0xb')](_0xf553('0x41'),_0x473c38[_0xf553('0x9')]),_0x473c38);channels[_0x473c38['uniqueid']][_0xf553('0x42')]=utils['now']();utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x473c38['uniqueid'],channels[_0x473c38['uniqueid']][_0xf553('0x42')]));}}catch(_0x35e9c8){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x41'),_0x473c38[_0xf553('0x9')]),_0x35e9c8);}};exports['musiconholdstop']=function(_0x4bef32){try{if(!_[_0xf553('0x20')](channels[_0x4bef32['uniqueid']])){utils[_0xf553('0x18')](util['format'](_0xf553('0x43'),_0x4bef32[_0xf553('0x9')]),_0x4bef32);if(!_[_0xf553('0x20')](channels[_0x4bef32[_0xf553('0x9')]]['musiconholdstartAt'])){channels[_0x4bef32[_0xf553('0x9')]][_0xf553('0x44')]+=utils['diffTime'](utils[_0xf553('0x24')](),channels[_0x4bef32['uniqueid']][_0xf553('0x42')]);utils[_0xf553('0x26')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4bef32[_0xf553('0x9')],channels[_0x4bef32[_0xf553('0x9')]][_0xf553('0x44')]));delete channels[_0x4bef32[_0xf553('0x9')]][_0xf553('0x42')];}}}catch(_0x37ef35){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x43'),_0x4bef32[_0xf553('0x9')]),_0x37ef35);}};exports[_0xf553('0x45')]=function(_0x349edc){try{if(!_['isNil'](channels[_0x349edc[_0xf553('0x9')]])){utils[_0xf553('0x18')](util['format'](_0xf553('0x46'),_0x349edc[_0xf553('0x9')]),_0x349edc);if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-originatecalleridnum'])){utils['info'](util[_0xf553('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x349edc[_0xf553('0x9')],_0x349edc['value']));channels[_0x349edc['uniqueid']][_0xf553('0x48')]=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')][_0xf553('0x4a')])){utils['info'](util[_0xf553('0xb')](_0xf553('0x4b'),_0x349edc[_0xf553('0x9')],_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]]['destination']=_0x349edc[_0xf553('0x49')];channels[_0x349edc['uniqueid']][_0xf553('0x2e')]='\x22'+_0x349edc[_0xf553('0x49')]+'\x22\x20<'+_0x349edc[_0xf553('0x49')]+'>';}if(!_['isNil'](_0x349edc[_0xf553('0x47')]['xmd-callerid-preview'])||!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-callerid'])){utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x349edc[_0xf553('0x9')],!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-callerid-preview'])?_0xf553('0x4c'):_0xf553('0x4d'),_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x2e')]=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-queue'])||!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmcs-queue'])){utils['info'](util[_0xf553('0xb')](_0xf553('0x4e'),_0x349edc[_0xf553('0x9')],!_[_0xf553('0x20')](_0x349edc['variable'][_0xf553('0x4f')])?'xmd-queue':_0xf553('0x50'),_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x51')]=_0xf553('0x52');channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x53')]=_0x349edc['value'];channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x54')]=!![];}if(!_[_0xf553('0x20')](_0x349edc['variable'][_0xf553('0x55')])){utils[_0xf553('0x26')](util['format'](_0xf553('0x56'),_0x349edc[_0xf553('0x9')],_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x57')]=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')][_0xf553('0x58')])){utils[_0xf553('0x26')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x349edc[_0xf553('0x9')],_0x349edc['value']));channels[_0x349edc['uniqueid']]['type']=_0x349edc[_0xf553('0x49')];}if(!_['isNil'](_0x349edc[_0xf553('0x47')][_0xf553('0x59')])){utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x5a'),_0x349edc[_0xf553('0x9')],_0x349edc['value']));channels[_0x349edc[_0xf553('0x9')]]['routeid']=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')][_0xf553('0x5b')])){utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x5c'),_0x349edc[_0xf553('0x9')],_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x5b')]=_0x349edc['value'];}}}catch(_0xab8b84){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x46'),_0x349edc[_0xf553('0x9')]),_0xab8b84);}};exports[_0xf553('0x5d')]=function(_0x4c6dda){try{if(!_[_0xf553('0x20')](channels[_0x4c6dda[_0xf553('0x9')]])){utils['debug'](util[_0xf553('0xb')](_0xf553('0x5e'),_0x4c6dda[_0xf553('0x9')]),_0x4c6dda);utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x5f'),_0x4c6dda['uniqueid'],_0x4c6dda[_0xf553('0x60')],_0x4c6dda[_0xf553('0x61')]));if(_0x4c6dda[_0xf553('0x60')][_0xf553('0x62')]()==_0xf553('0x63')&&_[_0xf553('0x64')](_0x4c6dda[_0xf553('0x61')][_0xf553('0x62')](),_0xf553('0x65'))){var _0x424607=_0x4c6dda[_0xf553('0x61')][_0xf553('0x66')]('=');var _0x274d1f=_0x424607[0x0][_0xf553('0x67')](_0x424607[0x0][_0xf553('0x68')]('(')+0x1,_0x424607[0x0][_0xf553('0x68')](')'));var _0x2cb39d=_0x424607[0x1];channels[_0x4c6dda[_0xf553('0x9')]][_0x274d1f]=_0x2cb39d;}if(!_[_0xf553('0x69')]([_0xf553('0x2d'),_0xf553('0x6a'),_0xf553('0x6b'),_0xf553('0x63'),_0xf553('0x6c')],_0x4c6dda[_0xf553('0x60')][_0xf553('0x62')]())){channels[_0x4c6dda[_0xf553('0x9')]][_0xf553('0x51')]=_0x4c6dda[_0xf553('0x60')];channels[_0x4c6dda['uniqueid']]['lastdata']=_0x4c6dda[_0xf553('0x61')];}}}catch(_0x358c8c){utils[_0xf553('0x35')](util[_0xf553('0xb')]('[%s][calls][newexten]',_0x4c6dda[_0xf553('0x9')]),_0x358c8c);}}; \ No newline at end of file +var _0xa49e=['varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','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','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','recording','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','callerid','calleridname','info','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','secondtransfererchannel','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','origtransfererchannel','userfield','_attended','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s'];(function(_0x17ae8c,_0x5d723b){var _0x4ee6cc=function(_0x4a1d6c){while(--_0x4a1d6c){_0x17ae8c['push'](_0x17ae8c['shift']());}};_0x4ee6cc(++_0x5d723b);}(_0xa49e,0x1de));var _0xea49=function(_0x40162a,_0x265b0c){_0x40162a=_0x40162a-0x0;var _0x488161=_0xa49e[_0x40162a];return _0x488161;};'use strict';var _=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var utils=require(_0xea49('0x2'));var transfers=require(_0xea49('0x3'));var dispositions=[_0xea49('0x4'),_0xea49('0x5'),_0xea49('0x5'),_0xea49('0x4'),'NO\x20ANSWER',_0xea49('0x4'),_0xea49('0x6'),_0xea49('0x7'),'FAILED',_0xea49('0x5'),_0xea49('0x5')];var channels={};function writeDB(_0xc682a){var _0x35c89e;if(transfers[_0xea49('0x8')][_0xc682a['uniqueid']]){_0x35c89e=_0xc682a[_0xea49('0x9')];_0xc682a['uniqueid']=transfers[_0xea49('0x8')][_0xc682a['uniqueid']]['transfereeuniqueid'];}utils['info'](util[_0xea49('0xa')](_0xea49('0xb'),_0xc682a[_0xea49('0x9')],_0xc682a[_0xea49('0xc')],_0xc682a[_0xea49('0xd')],_0xc682a[_0xea49('0xe')],_0xc682a[_0xea49('0xf')],_0xc682a[_0xea49('0x10')],_0xc682a[_0xea49('0x11')],_0xc682a[_0xea49('0x12')]));if(_0xc682a[_0xea49('0x13')]){utils['getUserByInternal'](_0xc682a[_0xea49('0x13')])[_0xea49('0x14')](function(_0x31d210){if(_0x31d210){_0xc682a[_0xea49('0x15')]=_0x31d210['id'];}utils['request'](_0xea49('0x16'),_0xc682a);});}else{utils[_0xea49('0x17')]('CreateVoiceCallReport',_0xc682a);}if(channels[_0xc682a[_0xea49('0x9')]]){delete channels[_0xc682a[_0xea49('0x9')]];}else if(_0x35c89e&&channels[_0x35c89e]){if(!transfers[_0xea49('0x8')][_0x35c89e][_0xea49('0x18')])delete transfers['blinds'][_0x35c89e];delete channels[_0x35c89e];}}exports['newchannel']=function(_0x427386){try{utils['debug'](util[_0xea49('0xa')](_0xea49('0x19'),_0x427386[_0xea49('0x9')]),_0x427386);if(_0x427386['uniqueid']==_0x427386[_0xea49('0x1a')]&&_0x427386[_0xea49('0xc')]!=_0xea49('0x1b')){utils['info'](util[_0xea49('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x427386[_0xea49('0x9')],_0x427386[_0xea49('0x1c')],_0x427386[_0xea49('0x1d')]));channels[_0x427386[_0xea49('0x9')]]={'uniqueid':_0x427386[_0xea49('0x9')],'accountcode':_0x427386[_0xea49('0x13')],'source':_0x427386[_0xea49('0x10')],'destination':_0x427386[_0xea49('0x1d')],'destinationcontext':_0x427386['context'],'channel':_0x427386[_0xea49('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xea49('0x4'),'amaflags':_0xea49('0x1e')};}}catch(_0x352438){utils[_0xea49('0x1f')](util[_0xea49('0xa')]('[%s][calls][newchannel]',_0x427386[_0xea49('0x9')]),_0x352438);}};exports[_0xea49('0x20')]=function(_0x2c4751){try{utils[_0xea49('0x21')](util[_0xea49('0xa')]('[%s][calls][newstate]',_0x2c4751[_0xea49('0x9')]),_0x2c4751);if(!_[_0xea49('0x22')](channels[_0x2c4751[_0xea49('0x9')]])&&_0x2c4751[_0xea49('0x23')]==0x6){utils['info'](util[_0xea49('0xa')](_0xea49('0x24'),_0x2c4751[_0xea49('0x9')],_0x2c4751[_0xea49('0x1c')],_0x2c4751[_0xea49('0xc')]));if(_['isNil'](channels[_0x2c4751[_0xea49('0x9')]][_0xea49('0x25')])){channels[_0x2c4751[_0xea49('0x9')]][_0xea49('0x25')]=utils[_0xea49('0x26')]();}}else if(!_[_0xea49('0x22')](channels[_0x2c4751[_0xea49('0x1a')]])&&_0x2c4751[_0xea49('0x23')]==0x6&&_0x2c4751[_0xea49('0x1c')]!='transfer'){utils['info'](util[_0xea49('0xa')](_0xea49('0x27'),_0x2c4751[_0xea49('0x9')],_0x2c4751['linkedid'],_0x2c4751[_0xea49('0x1c')],_0x2c4751['channel']));channels[_0x2c4751['linkedid']][_0xea49('0x13')]=_0x2c4751[_0xea49('0x13')];channels[_0x2c4751['linkedid']][_0xea49('0x28')]=_0x2c4751['channel'];if(_[_0xea49('0x22')](channels[_0x2c4751[_0xea49('0x1a')]][_0xea49('0x29')])){channels[_0x2c4751['linkedid']][_0xea49('0x29')]=utils[_0xea49('0x26')]();}channels[_0x2c4751[_0xea49('0x1a')]][_0xea49('0x2a')]=dispositions[_[_0xea49('0x2b')](_0x2c4751[_0xea49('0x23')])]||_0xea49('0x6');}}catch(_0x22bdb9){utils[_0xea49('0x1f')](util['format'](_0xea49('0x2c'),_0x2c4751[_0xea49('0x9')]),_0x22bdb9);}};exports[_0xea49('0x2d')]=function(_0x489677){try{if(!_[_0xea49('0x22')](channels[_0x489677[_0xea49('0x9')]])){utils[_0xea49('0x21')](util[_0xea49('0xa')]('[%s][calls][hangup]',_0x489677[_0xea49('0x9')]),_0x489677);if(_[_0xea49('0x22')](channels[_0x489677[_0xea49('0x9')]][_0xea49('0x2e')])){channels[_0x489677[_0xea49('0x9')]][_0xea49('0x2e')]=_0x489677[_0xea49('0x2f')]+'\x20<'+_0x489677[_0xea49('0x10')]+'>';}utils[_0xea49('0x30')](util[_0xea49('0xa')](_0xea49('0x31'),_0x489677[_0xea49('0x9')],channels[_0x489677[_0xea49('0x9')]]['callerid'],_0x489677['cause-txt']));channels[_0x489677[_0xea49('0x9')]][_0xea49('0x32')]=utils['now']();channels[_0x489677[_0xea49('0x9')]][_0xea49('0x33')]=utils['diffTime'](channels[_0x489677['uniqueid']]['endtime'],channels[_0x489677[_0xea49('0x9')]][_0xea49('0x34')]);channels[_0x489677[_0xea49('0x9')]]['billableseconds']=channels[_0x489677[_0xea49('0x9')]][_0xea49('0x29')]?utils['diffTime'](channels[_0x489677[_0xea49('0x9')]][_0xea49('0x32')],channels[_0x489677[_0xea49('0x9')]]['answertime']):0x0;writeDB(channels[_0x489677[_0xea49('0x9')]]);}}catch(_0x1afb05){utils[_0xea49('0x1f')](util[_0xea49('0xa')]('[%s][calls][hangup]',_0x489677[_0xea49('0x9')]),_0x1afb05);}};exports[_0xea49('0x35')]=function(_0x2098e0){try{if(!_[_0xea49('0x22')](channels[_0x2098e0[_0xea49('0x36')]])){utils['debug'](util[_0xea49('0xa')](_0xea49('0x37'),_0x2098e0['origtransfereruniqueid']),_0x2098e0);if(channels[_0x2098e0[_0xea49('0x36')]]['channel']==_0x2098e0[_0xea49('0x38')]){utils['info'](util[_0xea49('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2098e0['origtransfereruniqueid'],_0x2098e0[_0xea49('0x36')],_0x2098e0['secondtransfererchannel']));channels[_0x2098e0[_0xea49('0x36')]][_0xea49('0x28')]=_0x2098e0[_0xea49('0x39')];channels[_0x2098e0[_0xea49('0x36')]]['userfield']='_attended';}else if(channels[_0x2098e0['localtwolinkedid']]['channel']=_0x2098e0[_0xea49('0x3a')]){utils[_0xea49('0x30')](util[_0xea49('0xa')](_0xea49('0x3b'),_0x2098e0[_0xea49('0x3c')],_0x2098e0[_0xea49('0x36')],_0x2098e0[_0xea49('0x3d')]));channels[_0x2098e0[_0xea49('0x36')]][_0xea49('0x28')]=_0x2098e0[_0xea49('0x3d')];channels[_0x2098e0[_0xea49('0x36')]][_0xea49('0x3e')]=_0xea49('0x3f');}}}catch(_0x127d06){utils[_0xea49('0x1f')](util[_0xea49('0xa')]('[%s][calls][attendedtransfer]',_0x2098e0[_0xea49('0x3c')]),_0x127d06);}};exports[_0xea49('0x40')]=function(_0x142c1c){try{if(!_['isNil'](channels[_0x142c1c[_0xea49('0x9')]])){utils['debug'](util['format']('[%s][calls][musiconholdstart]',_0x142c1c[_0xea49('0x9')]),_0x142c1c);channels[_0x142c1c[_0xea49('0x9')]][_0xea49('0x41')]=utils['now']();utils[_0xea49('0x30')](util['format'](_0xea49('0x42'),_0x142c1c['uniqueid'],channels[_0x142c1c[_0xea49('0x9')]][_0xea49('0x41')]));}}catch(_0x19629a){utils[_0xea49('0x1f')](util[_0xea49('0xa')](_0xea49('0x43'),_0x142c1c[_0xea49('0x9')]),_0x19629a);}};exports['musiconholdstop']=function(_0x9e289f){try{if(!_[_0xea49('0x22')](channels[_0x9e289f[_0xea49('0x9')]])){utils[_0xea49('0x21')](util[_0xea49('0xa')](_0xea49('0x44'),_0x9e289f['uniqueid']),_0x9e289f);if(!_['isNil'](channels[_0x9e289f[_0xea49('0x9')]][_0xea49('0x41')])){channels[_0x9e289f[_0xea49('0x9')]][_0xea49('0x45')]+=utils[_0xea49('0x46')](utils['now'](),channels[_0x9e289f[_0xea49('0x9')]][_0xea49('0x41')]);utils[_0xea49('0x30')](util[_0xea49('0xa')](_0xea49('0x47'),_0x9e289f[_0xea49('0x9')],channels[_0x9e289f[_0xea49('0x9')]]['mohtime']));delete channels[_0x9e289f['uniqueid']]['musiconholdstartAt'];}}}catch(_0x59e1a4){utils[_0xea49('0x1f')](util[_0xea49('0xa')]('[%s][calls][musiconholdstop]',_0x9e289f[_0xea49('0x9')]),_0x59e1a4);}};exports[_0xea49('0x48')]=function(_0x54fdee){try{if(!_['isNil'](channels[_0x54fdee[_0xea49('0x9')]])){utils[_0xea49('0x21')](util[_0xea49('0xa')](_0xea49('0x49'),_0x54fdee[_0xea49('0x9')]),_0x54fdee);if(!_['isNil'](_0x54fdee[_0xea49('0x4a')][_0xea49('0x4b')])){utils[_0xea49('0x30')](util[_0xea49('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x54fdee[_0xea49('0x9')],_0x54fdee[_0xea49('0x4c')]));channels[_0x54fdee[_0xea49('0x9')]]['source']=_0x54fdee[_0xea49('0x4c')];}if(!_[_0xea49('0x22')](_0x54fdee[_0xea49('0x4a')][_0xea49('0x4d')])){utils[_0xea49('0x30')](util[_0xea49('0xa')](_0xea49('0x4e'),_0x54fdee[_0xea49('0x9')],_0x54fdee['value']));channels[_0x54fdee[_0xea49('0x9')]][_0xea49('0x4f')]=_0x54fdee[_0xea49('0x4c')];channels[_0x54fdee[_0xea49('0x9')]][_0xea49('0x2e')]='\x22'+_0x54fdee['value']+_0xea49('0x50')+_0x54fdee['value']+'>';}if(!_[_0xea49('0x22')](_0x54fdee['variable']['xmd-callerid-preview'])||!_[_0xea49('0x22')](_0x54fdee[_0xea49('0x4a')][_0xea49('0x51')])){utils['info'](util[_0xea49('0xa')](_0xea49('0x52'),_0x54fdee[_0xea49('0x9')],!_[_0xea49('0x22')](_0x54fdee[_0xea49('0x4a')][_0xea49('0x53')])?_0xea49('0x53'):_0xea49('0x51'),_0x54fdee['value']));channels[_0x54fdee['uniqueid']][_0xea49('0x2e')]=_0x54fdee[_0xea49('0x4c')];}if(!_[_0xea49('0x22')](_0x54fdee[_0xea49('0x4a')]['xmd-queue'])||!_[_0xea49('0x22')](_0x54fdee[_0xea49('0x4a')][_0xea49('0x54')])){utils[_0xea49('0x30')](util[_0xea49('0xa')](_0xea49('0x52'),_0x54fdee['uniqueid'],!_[_0xea49('0x22')](_0x54fdee['variable'][_0xea49('0x55')])?_0xea49('0x55'):_0xea49('0x54'),_0x54fdee[_0xea49('0x4c')]));channels[_0x54fdee[_0xea49('0x9')]][_0xea49('0x56')]=_0xea49('0x57');channels[_0x54fdee[_0xea49('0x9')]][_0xea49('0x58')]=_0x54fdee[_0xea49('0x4c')];channels[_0x54fdee['uniqueid']][_0xea49('0xd')]=!![];}if(!_['isNil'](_0x54fdee[_0xea49('0x4a')]['xmd-contactid'])){utils[_0xea49('0x30')](util[_0xea49('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x54fdee[_0xea49('0x9')],_0x54fdee[_0xea49('0x4c')]));channels[_0x54fdee[_0xea49('0x9')]][_0xea49('0x59')]=_0x54fdee['value'];}if(!_[_0xea49('0x22')](_0x54fdee['variable'][_0xea49('0x5a')])){utils[_0xea49('0x30')](util[_0xea49('0xa')](_0xea49('0x5b'),_0x54fdee[_0xea49('0x9')],_0x54fdee[_0xea49('0x4c')]));channels[_0x54fdee[_0xea49('0x9')]][_0xea49('0x5c')]=_0x54fdee[_0xea49('0x4c')];}if(!_[_0xea49('0x22')](_0x54fdee['variable'][_0xea49('0x5d')])){utils[_0xea49('0x30')](util['format'](_0xea49('0x5e'),_0x54fdee[_0xea49('0x9')],_0x54fdee[_0xea49('0x4c')]));channels[_0x54fdee['uniqueid']]['routeid']=_0x54fdee['value'];}if(!_['isNil'](_0x54fdee[_0xea49('0x4a')][_0xea49('0x5f')])){utils[_0xea49('0x30')](util[_0xea49('0xa')](_0xea49('0x60'),_0x54fdee[_0xea49('0x9')],_0x54fdee[_0xea49('0x4c')]));channels[_0x54fdee['uniqueid']][_0xea49('0x5f')]=_0x54fdee[_0xea49('0x4c')];}}}catch(_0x156a1d){utils[_0xea49('0x1f')](util[_0xea49('0xa')](_0xea49('0x49'),_0x54fdee[_0xea49('0x9')]),_0x156a1d);}};exports[_0xea49('0x61')]=function(_0x57a08e){try{if(!_[_0xea49('0x22')](channels[_0x57a08e[_0xea49('0x9')]])){utils['debug'](util[_0xea49('0xa')]('[%s][calls][newexten]',_0x57a08e['uniqueid']),_0x57a08e);utils['info'](util[_0xea49('0xa')](_0xea49('0x62'),_0x57a08e['uniqueid'],_0x57a08e['application'],_0x57a08e[_0xea49('0x63')]));if(_0x57a08e[_0xea49('0x64')][_0xea49('0x65')]()=='set'&&_[_0xea49('0x66')](_0x57a08e['appdata'][_0xea49('0x65')](),_0xea49('0x67'))){var _0x3bab12=_0x57a08e[_0xea49('0x63')][_0xea49('0x68')]('=');var _0x40d06c=_0x3bab12[0x0][_0xea49('0x69')](_0x3bab12[0x0]['lastIndexOf']('(')+0x1,_0x3bab12[0x0][_0xea49('0x6a')](')'));var _0x127fc8=_0x3bab12[0x1];channels[_0x57a08e[_0xea49('0x9')]][_0x40d06c]=_0x127fc8;}if(!_['includes']([_0xea49('0x2d'),_0xea49('0x6b'),_0xea49('0x6c'),'set',_0xea49('0x6d')],_0x57a08e[_0xea49('0x64')][_0xea49('0x65')]())){channels[_0x57a08e['uniqueid']]['lastapplication']=_0x57a08e[_0xea49('0x64')];channels[_0x57a08e['uniqueid']][_0xea49('0x58')]=_0x57a08e[_0xea49('0x63')];}}}catch(_0x56f14b){utils[_0xea49('0x1f')](util['format']('[%s][calls][newexten]',_0x57a08e[_0xea49('0x9')]),_0x56f14b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b15106d..b0fbd53 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 _0x0dd9=['./utils','connect','shutdown','info','[core]\x20shutdown','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x441933,_0x1bf8e2){var _0xb7e63=function(_0x1b0ae2){while(--_0x1b0ae2){_0x441933['push'](_0x441933['shift']());}};_0xb7e63(++_0x1bf8e2);}(_0x0dd9,0x78));var _0x90dd=function(_0x1eedee,_0x415620){_0x1eedee=_0x1eedee-0x0;var _0x7c8be0=_0x0dd9[_0x1eedee];return _0x7c8be0;};'use strict';var utils=require(_0x90dd('0x0'));exports[_0x90dd('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x90dd('0x2')]=function(){utils[_0x90dd('0x3')](_0x90dd('0x4'));};exports['fullybooted']=function(){utils[_0x90dd('0x3')]('[core]\x20fullybooted');};exports[_0x90dd('0x5')]=function(_0x452506){utils[_0x90dd('0x5')](_0x90dd('0x6'),_0x452506);};exports[_0x90dd('0x7')]=function(){utils['info'](_0x90dd('0x8'));};exports[_0x90dd('0x9')]=function(_0x423bc9){}; \ No newline at end of file +var _0xb85f=['error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xb85f,0x10d));var _0xfb85=function(_0x50dd61,_0x5149cb){_0x50dd61=_0x50dd61-0x0;var _0x5217b2=_0xb85f[_0x50dd61];return _0x5217b2;};'use strict';var utils=require(_0xfb85('0x0'));exports[_0xfb85('0x1')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils[_0xfb85('0x2')](_0xfb85('0x3'));};exports[_0xfb85('0x4')]=function(){utils[_0xfb85('0x2')](_0xfb85('0x5'));};exports['error']=function(_0x4863dc){utils[_0xfb85('0x6')](_0xfb85('0x7'),_0x4863dc);};exports[_0xfb85('0x8')]=function(){utils[_0xfb85('0x2')](_0xfb85('0x9'));};exports[_0xfb85('0xa')]=function(_0x4c07a4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2fd3614..b67f964 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 _0x55fc=['calleridname','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x5bbb86,_0x31386a){var _0x41f61d=function(_0x4a29d4){while(--_0x4a29d4){_0x5bbb86['push'](_0x5bbb86['shift']());}};_0x41f61d(++_0x31386a);}(_0x55fc,0x1c8));var _0xc55f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x55fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc55f('0x0'));var util=require(_0xc55f('0x1'));var utils=require(_0xc55f('0x2'));var dials={};function writeDB(_0x3698de){utils[_0xc55f('0x3')](util['format'](_0xc55f('0x4'),_0x3698de[_0xc55f('0x5')],_0x3698de[_0xc55f('0x6')],_0x3698de['dialstring'],_0x3698de[_0xc55f('0x7')],_0x3698de['connectedlinenum'],_0x3698de[_0xc55f('0x8')]));utils[_0xc55f('0x9')](_0xc55f('0xa'),_0x3698de);delete dials[_0x3698de[_0xc55f('0x5')]];}exports['newexten']=function(_0x44d2d3){try{utils[_0xc55f('0xb')](util['format'](_0xc55f('0xc'),_0x44d2d3['uniqueid']),_0x44d2d3);utils['info'](util[_0xc55f('0xd')](_0xc55f('0xe'),_0x44d2d3[_0xc55f('0x5')],_0x44d2d3[_0xc55f('0xf')],_0x44d2d3[_0xc55f('0x10')]));if(_0x44d2d3['application'][_0xc55f('0x11')]()==_0xc55f('0x12')&&_[_0xc55f('0x13')](_0x44d2d3[_0xc55f('0x10')]['toLowerCase'](),'cdr(routeid)')){var _0x5052fe=_0x44d2d3[_0xc55f('0x10')][_0xc55f('0x14')]('=');dials[_0x44d2d3[_0xc55f('0x5')]]={'routeId':_0x5052fe[0x1]};}}catch(_0x1bc810){utils[_0xc55f('0x15')](util[_0xc55f('0xd')](_0xc55f('0xc'),_0x44d2d3['uniqueid']),_0x1bc810);}};exports[_0xc55f('0x16')]=function(_0x39a414){try{utils[_0xc55f('0xb')](util[_0xc55f('0xd')](_0xc55f('0x17'),_0x39a414[_0xc55f('0x5')]),_0x39a414);if(!_[_0xc55f('0x18')](_0x39a414[_0xc55f('0x19')][_0xc55f('0x1a')])){utils[_0xc55f('0x3')](util[_0xc55f('0xd')](_0xc55f('0x1b'),_0x39a414[_0xc55f('0x5')],_0x39a414[_0xc55f('0x1c')]));dials[_0x39a414[_0xc55f('0x5')]]={'routeId':_0x39a414[_0xc55f('0x1c')]};}}catch(_0x32af79){utils[_0xc55f('0x15')](util[_0xc55f('0xd')](_0xc55f('0x17'),_0x39a414['uniqueid']),_0x32af79);}};exports[_0xc55f('0x1d')]=function(_0x14de25){try{if(!_[_0xc55f('0x18')](dials[_0x14de25[_0xc55f('0x5')]])){utils['debug'](util[_0xc55f('0xd')]('[%s][dials][dialbegin]',_0x14de25[_0xc55f('0x5')]),_0x14de25);dials[_0x14de25[_0xc55f('0x5')]]=_[_0xc55f('0x1e')](dials[_0x14de25[_0xc55f('0x5')]],_0x14de25);dials[_0x14de25[_0xc55f('0x5')]][_0xc55f('0x1f')]=utils[_0xc55f('0x20')]();dials[_0x14de25[_0xc55f('0x5')]][_0xc55f('0x21')]=_0xc55f('0x22');utils['info'](util['format'](_0xc55f('0x23'),_0x14de25['uniqueid'],dials[_0x14de25[_0xc55f('0x5')]][_0xc55f('0x1f')]));}}catch(_0x420afa){utils[_0xc55f('0x15')](util['format']('[%s][dials][dialbegin]',_0x14de25[_0xc55f('0x5')]),_0x420afa);}};exports[_0xc55f('0x24')]=function(_0x39089a){try{if(!_[_0xc55f('0x18')](dials[_0x39089a[_0xc55f('0x5')]])){utils['debug'](util[_0xc55f('0xd')](_0xc55f('0x25'),_0x39089a[_0xc55f('0x5')]),_0x39089a);dials[_0x39089a[_0xc55f('0x5')]][_0xc55f('0x8')]=_0x39089a['dialstatus'];if(_0x39089a[_0xc55f('0x8')]=='ANSWER'){dials[_0x39089a[_0xc55f('0x5')]]=_[_0xc55f('0x1e')](dials[_0x39089a['uniqueid']],_0x39089a);dials[_0x39089a['uniqueid']][_0xc55f('0x26')]=utils[_0xc55f('0x20')]();dials[_0x39089a[_0xc55f('0x5')]][_0xc55f('0x21')]=_0xc55f('0x27');utils['info'](util[_0xc55f('0xd')](_0xc55f('0x28'),_0x39089a[_0xc55f('0x5')],_0x39089a['dialstatus'],dials[_0x39089a[_0xc55f('0x5')]]['answertime']));}else{utils['info'](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x39089a['uniqueid'],_0x39089a[_0xc55f('0x8')]));}}}catch(_0x1227c6){utils['error'](util[_0xc55f('0xd')](_0xc55f('0x25'),_0x39089a[_0xc55f('0x5')]),_0x1227c6);}};exports[_0xc55f('0x29')]=function(_0x3d55e4){try{if(!_[_0xc55f('0x18')](dials[_0x3d55e4[_0xc55f('0x5')]])){utils[_0xc55f('0xb')](util[_0xc55f('0xd')](_0xc55f('0x2a'),_0x3d55e4[_0xc55f('0x5')]),_0x3d55e4);utils[_0xc55f('0x3')](util[_0xc55f('0xd')](_0xc55f('0x2b'),_0x3d55e4['uniqueid'],_0x3d55e4['calleridnum'],_0x3d55e4[_0xc55f('0x2c')],_0x3d55e4['cause-txt']));dials[_0x3d55e4[_0xc55f('0x5')]]=_[_0xc55f('0x1e')](dials[_0x3d55e4[_0xc55f('0x5')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x2d')]=utils[_0xc55f('0x2e')](dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x2f')],dials[_0x3d55e4['uniqueid']]['starttime']);dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x30')]=utils[_0xc55f('0x2e')](dials[_0x3d55e4[_0xc55f('0x5')]]['answertime']||dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x2f')],dials[_0x3d55e4['uniqueid']][_0xc55f('0x1f')]);dials[_0x3d55e4['uniqueid']][_0xc55f('0x31')]=dials[_0x3d55e4['uniqueid']][_0xc55f('0x26')]?utils[_0xc55f('0x2e')](dials[_0x3d55e4[_0xc55f('0x5')]]['endtime'],dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x26')]):0x0;writeDB(dials[_0x3d55e4[_0xc55f('0x5')]]);}}catch(_0x27e9da){utils[_0xc55f('0x15')](util['format'](_0xc55f('0x2a'),_0x3d55e4[_0xc55f('0x5')]),_0x27e9da);}}; \ No newline at end of file +var _0x8841=['holdtime','diffTime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x8841,0xcf));var _0x1884=function(_0xcfe36,_0x3f2c9a){_0xcfe36=_0xcfe36-0x0;var _0x44dba8=_0x8841[_0xcfe36];return _0x44dba8;};'use strict';var _=require(_0x1884('0x0'));var util=require(_0x1884('0x1'));var utils=require(_0x1884('0x2'));var dials={};function writeDB(_0xfb7a7d){utils[_0x1884('0x3')](util[_0x1884('0x4')](_0x1884('0x5'),_0xfb7a7d[_0x1884('0x6')],_0xfb7a7d[_0x1884('0x7')],_0xfb7a7d['dialstring'],_0xfb7a7d[_0x1884('0x8')],_0xfb7a7d[_0x1884('0x9')],_0xfb7a7d[_0x1884('0xa')]));utils['request'](_0x1884('0xb'),_0xfb7a7d);delete dials[_0xfb7a7d[_0x1884('0x6')]];}exports[_0x1884('0xc')]=function(_0x5e2398){try{utils[_0x1884('0xd')](util[_0x1884('0x4')]('[%s][dials][newexten]',_0x5e2398[_0x1884('0x6')]),_0x5e2398);utils[_0x1884('0x3')](util['format'](_0x1884('0xe'),_0x5e2398[_0x1884('0x6')],_0x5e2398[_0x1884('0xf')],_0x5e2398[_0x1884('0x10')]));if(_0x5e2398[_0x1884('0xf')]['toLowerCase']()==_0x1884('0x11')&&_['startsWith'](_0x5e2398['appdata']['toLowerCase'](),'cdr(routeid)')){var _0x5d426c=_0x5e2398[_0x1884('0x10')][_0x1884('0x12')]('=');dials[_0x5e2398[_0x1884('0x6')]]={'routeId':_0x5d426c[0x1]};}}catch(_0x1e46af){utils[_0x1884('0x13')](util[_0x1884('0x4')](_0x1884('0x14'),_0x5e2398[_0x1884('0x6')]),_0x1e46af);}};exports[_0x1884('0x15')]=function(_0x513975){try{utils[_0x1884('0xd')](util[_0x1884('0x4')](_0x1884('0x16'),_0x513975[_0x1884('0x6')]),_0x513975);if(!_['isNil'](_0x513975[_0x1884('0x17')][_0x1884('0x18')])){utils[_0x1884('0x3')](util[_0x1884('0x4')](_0x1884('0x19'),_0x513975[_0x1884('0x6')],_0x513975[_0x1884('0x1a')]));dials[_0x513975[_0x1884('0x6')]]={'routeId':_0x513975[_0x1884('0x1a')]};}}catch(_0x1371e1){utils['error'](util[_0x1884('0x4')](_0x1884('0x16'),_0x513975['uniqueid']),_0x1371e1);}};exports[_0x1884('0x1b')]=function(_0x441dbb){try{if(!_[_0x1884('0x1c')](dials[_0x441dbb['uniqueid']])){utils[_0x1884('0xd')](util[_0x1884('0x4')](_0x1884('0x1d'),_0x441dbb[_0x1884('0x6')]),_0x441dbb);dials[_0x441dbb[_0x1884('0x6')]]=_[_0x1884('0x1e')](dials[_0x441dbb[_0x1884('0x6')]],_0x441dbb);dials[_0x441dbb[_0x1884('0x6')]]['starttime']=utils[_0x1884('0x1f')]();dials[_0x441dbb[_0x1884('0x6')]][_0x1884('0x20')]=_0x1884('0x21');utils[_0x1884('0x3')](util['format'](_0x1884('0x22'),_0x441dbb[_0x1884('0x6')],dials[_0x441dbb[_0x1884('0x6')]][_0x1884('0x23')]));}}catch(_0x269597){utils[_0x1884('0x13')](util['format'](_0x1884('0x1d'),_0x441dbb[_0x1884('0x6')]),_0x269597);}};exports[_0x1884('0x24')]=function(_0x2ba826){try{if(!_[_0x1884('0x1c')](dials[_0x2ba826['uniqueid']])){utils[_0x1884('0xd')](util['format'](_0x1884('0x25'),_0x2ba826[_0x1884('0x6')]),_0x2ba826);dials[_0x2ba826['uniqueid']][_0x1884('0xa')]=_0x2ba826['dialstatus'];if(_0x2ba826[_0x1884('0xa')]==_0x1884('0x26')){dials[_0x2ba826['uniqueid']]=_[_0x1884('0x1e')](dials[_0x2ba826[_0x1884('0x6')]],_0x2ba826);dials[_0x2ba826[_0x1884('0x6')]][_0x1884('0x27')]=utils[_0x1884('0x1f')]();dials[_0x2ba826[_0x1884('0x6')]][_0x1884('0x20')]=_0x1884('0x28');utils[_0x1884('0x3')](util[_0x1884('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2ba826[_0x1884('0x6')],_0x2ba826[_0x1884('0xa')],dials[_0x2ba826[_0x1884('0x6')]][_0x1884('0x27')]));}else{utils[_0x1884('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x2ba826[_0x1884('0x6')],_0x2ba826[_0x1884('0xa')]));}}}catch(_0xd4851f){utils['error'](util[_0x1884('0x4')](_0x1884('0x25'),_0x2ba826['uniqueid']),_0xd4851f);}};exports['hangup']=function(_0x450629){try{if(!_[_0x1884('0x1c')](dials[_0x450629[_0x1884('0x6')]])){utils['debug'](util[_0x1884('0x4')](_0x1884('0x29'),_0x450629['uniqueid']),_0x450629);utils[_0x1884('0x3')](util[_0x1884('0x4')](_0x1884('0x2a'),_0x450629[_0x1884('0x6')],_0x450629['calleridnum'],_0x450629[_0x1884('0x2b')],_0x450629[_0x1884('0x2c')]));dials[_0x450629[_0x1884('0x6')]]=_[_0x1884('0x1e')](dials[_0x450629['uniqueid']],{'endtime':utils[_0x1884('0x1f')](),'lastevent':_0x1884('0x2d')});dials[_0x450629[_0x1884('0x6')]][_0x1884('0x2e')]=utils['diffTime'](dials[_0x450629[_0x1884('0x6')]][_0x1884('0x2f')],dials[_0x450629['uniqueid']][_0x1884('0x23')]);dials[_0x450629[_0x1884('0x6')]][_0x1884('0x30')]=utils[_0x1884('0x31')](dials[_0x450629[_0x1884('0x6')]][_0x1884('0x27')]||dials[_0x450629[_0x1884('0x6')]][_0x1884('0x2f')],dials[_0x450629['uniqueid']][_0x1884('0x23')]);dials[_0x450629[_0x1884('0x6')]][_0x1884('0x32')]=dials[_0x450629[_0x1884('0x6')]][_0x1884('0x27')]?utils[_0x1884('0x31')](dials[_0x450629[_0x1884('0x6')]]['endtime'],dials[_0x450629['uniqueid']]['answertime']):0x0;writeDB(dials[_0x450629[_0x1884('0x6')]]);}}catch(_0x38502c){utils['error'](util[_0x1884('0x4')](_0x1884('0x29'),_0x450629[_0x1884('0x6')]),_0x38502c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 7894e73..5895e79 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 _0x75e8=['[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','port','asterisk','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','format','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin'];(function(_0x5999ba,_0x97b26a){var _0x2140b5=function(_0x23b3fb){while(--_0x23b3fb){_0x5999ba['push'](_0x5999ba['shift']());}};_0x2140b5(++_0x97b26a);}(_0x75e8,0x114));var _0x875e=function(_0x1459fe,_0x1a65eb){_0x1459fe=_0x1459fe-0x0;var _0x4aa93a=_0x75e8[_0x1459fe];return _0x4aa93a;};var AsteriskManager=require(_0x875e('0x0'));var config=require(_0x875e('0x1'));var utils=require('./utils');var util=require(_0x875e('0x2'));var isXDREnabled=config['xdr']&&config[_0x875e('0x3')][_0x875e('0x4')]?!config[_0x875e('0x3')][_0x875e('0x4')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x875e('0x3')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x875e('0x5')],config[_0x875e('0x6')]['ip'],config[_0x875e('0x6')][_0x875e('0x7')],config['asterisk']['password'],!![]);ami[_0x875e('0x8')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x875e('0x9')](_0x875e('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x875e('0xb'));var queues=require(_0x875e('0xc'));var recordings=require(_0x875e('0xd'));var members=require(_0x875e('0xe'));var dials=require(_0x875e('0xf'));var transfers=require(_0x875e('0x10'));var core=require('./core.controller');ami['on'](_0x875e('0x11'),core[_0x875e('0x11')]);ami['on'](_0x875e('0x12'),core[_0x875e('0x12')]);ami['on'](_0x875e('0x13'),core[_0x875e('0x13')]);ami['on'](_0x875e('0x14'),core[_0x875e('0x14')]);ami['on'](_0x875e('0x15'),core[_0x875e('0x15')]);ami['on'](_0x875e('0x16'),core[_0x875e('0x16')]);ami['on']('devicestatechange',function(_0x57d6d3){try{utils['debug'](util[_0x875e('0x17')]('[%s][index][devicestatechange]',_0x57d6d3['device']),_0x57d6d3);members[_0x875e('0x18')](_0x57d6d3);}catch(_0x4a17eb){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x19'),_0x57d6d3[_0x875e('0x1a')]),_0x4a17eb);}});ami['on'](_0x875e('0x1b'),function(_0x1c5f26){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x1d'),_0x1c5f26[_0x875e('0x1e')]),_0x1c5f26);agents[_0x875e('0x1b')](_0x1c5f26);}catch(_0x5fee88){utils['error'](util['format'](_0x875e('0x1d'),_0x1c5f26['uniqueid']),_0x5fee88);}});ami['on']('agentringnoanswer',function(_0xc087ac){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x1f'),_0xc087ac[_0x875e('0x1e')]),_0xc087ac);agents['agentringnoanswer'](_0xc087ac);}catch(_0x17a8c0){utils['error'](util[_0x875e('0x17')](_0x875e('0x1f'),_0xc087ac[_0x875e('0x1e')]),_0x17a8c0);}});ami['on']('agentconnect',function(_0x403509){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x20'),_0x403509['uniqueid']),_0x403509);agents[_0x875e('0x21')](_0x403509);queues[_0x875e('0x21')](_0x403509);}catch(_0x19b385){utils[_0x875e('0x14')](util[_0x875e('0x17')]('[%s][index][agentconnect]',_0x403509['uniqueid']),_0x19b385);}});ami['on'](_0x875e('0x22'),function(_0x543580){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x23'),_0x543580['uniqueid']),_0x543580);agents[_0x875e('0x22')](_0x543580);queues[_0x875e('0x22')](_0x543580);members[_0x875e('0x22')](_0x543580);}catch(_0x2e4884){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x23'),_0x543580[_0x875e('0x1e')]),_0x2e4884);}});ami['on'](_0x875e('0x24'),function(_0x19dab8){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')]('[%s][index][queuecallerabandon]',_0x19dab8[_0x875e('0x1e')]),_0x19dab8);agents[_0x875e('0x24')](_0x19dab8);queues[_0x875e('0x24')](_0x19dab8);}catch(_0x3dd844){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x25'),_0x19dab8[_0x875e('0x1e')]),_0x3dd844);}});ami['on'](_0x875e('0x26'),function(_0x19a92c){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x27'),_0x19a92c['uniqueid']),_0x19a92c);queues[_0x875e('0x26')](_0x19a92c);recordings[_0x875e('0x26')](_0x19a92c);}catch(_0x318aac){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x27'),_0x19a92c[_0x875e('0x1e')]),_0x318aac);}});ami['on']('queuecallerleave',function(_0x2cd844){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x28'),_0x2cd844[_0x875e('0x1e')]),_0x2cd844);queues[_0x875e('0x29')](_0x2cd844);}catch(_0x35863e){utils['error'](util[_0x875e('0x17')]('[%s][index][queuecallerleave]',_0x2cd844['uniqueid']),_0x35863e);}});ami['on'](_0x875e('0x2a'),function(_0x29e2f9){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x2b'),_0x29e2f9[_0x875e('0x1e')]),_0x29e2f9);queues[_0x875e('0x2a')](_0x29e2f9);calls['musiconholdstart'](_0x29e2f9);}catch(_0x1ba063){utils[_0x875e('0x14')](util['format'](_0x875e('0x2b'),_0x29e2f9[_0x875e('0x1e')]),_0x1ba063);}});ami['on'](_0x875e('0x2c'),function(_0x281aeb){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x2d'),_0x281aeb[_0x875e('0x1e')]),_0x281aeb);queues[_0x875e('0x2c')](_0x281aeb);calls['musiconholdstop'](_0x281aeb);}catch(_0x4b513b){utils[_0x875e('0x14')](util['format'](_0x875e('0x2d'),_0x281aeb[_0x875e('0x1e')]),_0x4b513b);}});ami['on'](_0x875e('0x2e'),function(_0x220f8f){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x2f'),_0x220f8f[_0x875e('0x1e')]),_0x220f8f);calls[_0x875e('0x2e')](_0x220f8f);recordings[_0x875e('0x2e')](_0x220f8f);}catch(_0x287acc){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x2f'),_0x220f8f[_0x875e('0x1e')]),_0x287acc);}});ami['on'](_0x875e('0x30'),function(_0x2c96f9){try{utils['debug'](util['format'](_0x875e('0x31'),_0x2c96f9[_0x875e('0x1e')]),_0x2c96f9);calls[_0x875e('0x30')](_0x2c96f9);recordings[_0x875e('0x30')](_0x2c96f9);dials['hangup'](_0x2c96f9);agents[_0x875e('0x30')](_0x2c96f9);queues['hangup'](_0x2c96f9);}catch(_0x16a112){utils[_0x875e('0x14')](util['format']('[%s][index][hangup]',_0x2c96f9[_0x875e('0x1e')]),_0x16a112);}});ami['on'](_0x875e('0x32'),function(_0x28b36d){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x33'),_0x28b36d['uniqueid']),_0x28b36d);members[_0x875e('0x32')](_0x28b36d);}catch(_0x2a27d5){utils['error'](util[_0x875e('0x17')](_0x875e('0x33'),_0x28b36d[_0x875e('0x1e')]),_0x2a27d5);}});ami['on'](_0x875e('0x34'),function(_0x3ad47d){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x35'),_0x3ad47d['uniqueid']),_0x3ad47d);queues[_0x875e('0x34')](_0x3ad47d);agents['blindtransfer'](_0x3ad47d);transfers['blindtransfer'](_0x3ad47d);recordings[_0x875e('0x34')](_0x3ad47d);}catch(_0x23fecc){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x35'),_0x3ad47d['uniqueid']),_0x23fecc);}});ami['on'](_0x875e('0x36'),function(_0x521fbe){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x37'),_0x521fbe[_0x875e('0x38')]),_0x521fbe);queues['attendedtransfer'](_0x521fbe);transfers['attendedtransfer'](_0x521fbe);agents[_0x875e('0x36')](_0x521fbe);calls[_0x875e('0x36')](_0x521fbe);}catch(_0x26bd3a){utils[_0x875e('0x14')](util[_0x875e('0x17')]('[%s][index][attendedtransfer]',_0x521fbe[_0x875e('0x38')]),_0x26bd3a);}});ami['on']('varset',function(_0x5082c4){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x39'),_0x5082c4['uniqueid']),_0x5082c4);queues[_0x875e('0x3a')](_0x5082c4);recordings[_0x875e('0x3a')](_0x5082c4);calls['varset'](_0x5082c4);dials[_0x875e('0x3a')](_0x5082c4);}catch(_0x358acf){utils['error'](util[_0x875e('0x17')](_0x875e('0x39'),_0x5082c4[_0x875e('0x1e')]),_0x358acf);}});ami['on'](_0x875e('0x3b'),function(_0x85a307){try{utils['debug'](util['format'](_0x875e('0x3c'),_0x85a307[_0x875e('0x1e')]),_0x85a307);calls[_0x875e('0x3b')](_0x85a307);recordings[_0x875e('0x3b')](_0x85a307);dials['newexten'](_0x85a307);}catch(_0x4eefe1){utils[_0x875e('0x14')](util[_0x875e('0x17')]('[%s][index][newexten]',_0x85a307['uniqueid']),_0x4eefe1);}});ami['on'](_0x875e('0x3d'),function(_0x2a41f4){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x3e'),_0x2a41f4[_0x875e('0x1e')]),_0x2a41f4);calls[_0x875e('0x3d')](_0x2a41f4);recordings[_0x875e('0x3d')](_0x2a41f4);}catch(_0x142b6d){utils['error'](util['format']('[%s][index][newchannel]',_0x2a41f4[_0x875e('0x1e')]),_0x142b6d);}});ami['on'](_0x875e('0x3f'),function(_0x1b248a){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x40'),_0x1b248a[_0x875e('0x1e')]),_0x1b248a);dials['dialbegin'](_0x1b248a);}catch(_0x35534e){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x41'),_0x1b248a[_0x875e('0x1e')]),_0x35534e);}});ami['on'](_0x875e('0x42'),function(_0x1af449){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x43'),_0x1af449[_0x875e('0x1e')]),_0x1af449);dials['dialend'](_0x1af449);}catch(_0x34b71a){utils[_0x875e('0x14')](util['format'](_0x875e('0x43'),_0x1af449['uniqueid']),_0x34b71a);}});} \ No newline at end of file +var _0x3a6c=['newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','local','port','asterisk','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop'];(function(_0x21e711,_0x2137f2){var _0x1be525=function(_0x22a6c8){while(--_0x22a6c8){_0x21e711['push'](_0x21e711['shift']());}};_0x1be525(++_0x2137f2);}(_0x3a6c,0x1e9));var _0xc3a6=function(_0x593b6d,_0x2b76fc){_0x593b6d=_0x593b6d-0x0;var _0x37b1ea=_0x3a6c[_0x593b6d];return _0x37b1ea;};var AsteriskManager=require('asterisk-manager');var config=require(_0xc3a6('0x0'));var utils=require(_0xc3a6('0x1'));var util=require(_0xc3a6('0x2'));var isXDREnabled=config[_0xc3a6('0x3')]&&config[_0xc3a6('0x3')][_0xc3a6('0x4')]?!config[_0xc3a6('0x3')]['disabled']:!![];var isProduction=config[_0xc3a6('0x5')]==='production'||![];var isLocalAsterisk=config[_0xc3a6('0x3')]&&config[_0xc3a6('0x3')][_0xc3a6('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xc3a6('0x7')],config[_0xc3a6('0x8')]['ip'],config[_0xc3a6('0x8')]['username'],config['asterisk']['password'],!![]);ami[_0xc3a6('0x9')]();if(!isXDREnabled){utils[_0xc3a6('0xa')](_0xc3a6('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xc3a6('0xa')](_0xc3a6('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0xc3a6('0xd'));var queues=require(_0xc3a6('0xe'));var recordings=require(_0xc3a6('0xf'));var members=require(_0xc3a6('0x10'));var dials=require(_0xc3a6('0x11'));var transfers=require('./transfers.controller');var core=require(_0xc3a6('0x12'));ami['on'](_0xc3a6('0x13'),core[_0xc3a6('0x13')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xc3a6('0x14'),core[_0xc3a6('0x14')]);ami['on'](_0xc3a6('0x15'),core[_0xc3a6('0x15')]);ami['on'](_0xc3a6('0x16'),core[_0xc3a6('0x16')]);ami['on'](_0xc3a6('0x17'),core[_0xc3a6('0x17')]);ami['on'](_0xc3a6('0x18'),function(_0x13f811){try{utils['debug'](util[_0xc3a6('0x19')]('[%s][index][devicestatechange]',_0x13f811[_0xc3a6('0x1a')]),_0x13f811);members[_0xc3a6('0x18')](_0x13f811);}catch(_0x2d8f93){utils['error'](util[_0xc3a6('0x19')](_0xc3a6('0x1b'),_0x13f811['device']),_0x2d8f93);}});ami['on'](_0xc3a6('0x1c'),function(_0x3749c3){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x1e'),_0x3749c3['uniqueid']),_0x3749c3);agents[_0xc3a6('0x1c')](_0x3749c3);}catch(_0x12c6b7){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x1e'),_0x3749c3[_0xc3a6('0x1f')]),_0x12c6b7);}});ami['on'](_0xc3a6('0x20'),function(_0x306c45){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')]('[%s][index][agentringnoanswer]',_0x306c45[_0xc3a6('0x1f')]),_0x306c45);agents['agentringnoanswer'](_0x306c45);}catch(_0x1ac8a1){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x21'),_0x306c45[_0xc3a6('0x1f')]),_0x1ac8a1);}});ami['on']('agentconnect',function(_0x504dd8){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x22'),_0x504dd8[_0xc3a6('0x1f')]),_0x504dd8);agents[_0xc3a6('0x23')](_0x504dd8);queues[_0xc3a6('0x23')](_0x504dd8);}catch(_0x17de51){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x22'),_0x504dd8['uniqueid']),_0x17de51);}});ami['on'](_0xc3a6('0x24'),function(_0x3dd200){try{utils['debug'](util[_0xc3a6('0x19')](_0xc3a6('0x25'),_0x3dd200[_0xc3a6('0x1f')]),_0x3dd200);agents['agentcomplete'](_0x3dd200);queues[_0xc3a6('0x24')](_0x3dd200);members[_0xc3a6('0x24')](_0x3dd200);}catch(_0x58acde){utils['error'](util[_0xc3a6('0x19')](_0xc3a6('0x25'),_0x3dd200['uniqueid']),_0x58acde);}});ami['on'](_0xc3a6('0x26'),function(_0x1bee00){try{utils['debug'](util[_0xc3a6('0x19')](_0xc3a6('0x27'),_0x1bee00['uniqueid']),_0x1bee00);agents[_0xc3a6('0x26')](_0x1bee00);queues[_0xc3a6('0x26')](_0x1bee00);}catch(_0x562047){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x27'),_0x1bee00[_0xc3a6('0x1f')]),_0x562047);}});ami['on'](_0xc3a6('0x28'),function(_0x2c9779){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')]('[%s][index][queuecallerjoin]',_0x2c9779[_0xc3a6('0x1f')]),_0x2c9779);queues[_0xc3a6('0x28')](_0x2c9779);recordings[_0xc3a6('0x28')](_0x2c9779);}catch(_0x58d1ca){utils[_0xc3a6('0x15')](util['format'](_0xc3a6('0x29'),_0x2c9779[_0xc3a6('0x1f')]),_0x58d1ca);}});ami['on'](_0xc3a6('0x2a'),function(_0x3ee9cf){try{utils[_0xc3a6('0x1d')](util['format']('[%s][index][queuecallerleave]',_0x3ee9cf['uniqueid']),_0x3ee9cf);queues[_0xc3a6('0x2a')](_0x3ee9cf);}catch(_0x303141){utils['error'](util[_0xc3a6('0x19')](_0xc3a6('0x2b'),_0x3ee9cf[_0xc3a6('0x1f')]),_0x303141);}});ami['on']('musiconholdstart',function(_0x3ef4b4){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x2c'),_0x3ef4b4[_0xc3a6('0x1f')]),_0x3ef4b4);queues[_0xc3a6('0x2d')](_0x3ef4b4);calls[_0xc3a6('0x2d')](_0x3ef4b4);}catch(_0x5469b9){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x2c'),_0x3ef4b4[_0xc3a6('0x1f')]),_0x5469b9);}});ami['on'](_0xc3a6('0x2e'),function(_0x31b96d){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')]('[%s][index][musiconholdstop]',_0x31b96d['uniqueid']),_0x31b96d);queues[_0xc3a6('0x2e')](_0x31b96d);calls[_0xc3a6('0x2e')](_0x31b96d);}catch(_0x2f0462){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')]('[%s][index][musiconholdstop]',_0x31b96d[_0xc3a6('0x1f')]),_0x2f0462);}});ami['on'](_0xc3a6('0x2f'),function(_0x1b5e1e){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x30'),_0x1b5e1e['uniqueid']),_0x1b5e1e);calls['newstate'](_0x1b5e1e);recordings[_0xc3a6('0x2f')](_0x1b5e1e);}catch(_0x1b8697){utils['error'](util[_0xc3a6('0x19')](_0xc3a6('0x30'),_0x1b5e1e[_0xc3a6('0x1f')]),_0x1b8697);}});ami['on'](_0xc3a6('0x31'),function(_0x3afdf5){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x32'),_0x3afdf5[_0xc3a6('0x1f')]),_0x3afdf5);calls[_0xc3a6('0x31')](_0x3afdf5);recordings[_0xc3a6('0x31')](_0x3afdf5);dials[_0xc3a6('0x31')](_0x3afdf5);agents[_0xc3a6('0x31')](_0x3afdf5);queues[_0xc3a6('0x31')](_0x3afdf5);}catch(_0x408c7){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x32'),_0x3afdf5['uniqueid']),_0x408c7);}});ami['on']('cdr',function(_0x4a6560){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x33'),_0x4a6560[_0xc3a6('0x1f')]),_0x4a6560);members[_0xc3a6('0x34')](_0x4a6560);}catch(_0x30027a){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x33'),_0x4a6560[_0xc3a6('0x1f')]),_0x30027a);}});ami['on'](_0xc3a6('0x35'),function(_0x588a38){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x36'),_0x588a38['uniqueid']),_0x588a38);queues['blindtransfer'](_0x588a38);agents['blindtransfer'](_0x588a38);transfers[_0xc3a6('0x35')](_0x588a38);recordings[_0xc3a6('0x35')](_0x588a38);}catch(_0x23ff35){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x36'),_0x588a38[_0xc3a6('0x1f')]),_0x23ff35);}});ami['on'](_0xc3a6('0x37'),function(_0x1bbe9a){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x38'),_0x1bbe9a[_0xc3a6('0x39')]),_0x1bbe9a);queues[_0xc3a6('0x37')](_0x1bbe9a);transfers[_0xc3a6('0x37')](_0x1bbe9a);agents['attendedtransfer'](_0x1bbe9a);calls[_0xc3a6('0x37')](_0x1bbe9a);}catch(_0x20b894){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x38'),_0x1bbe9a[_0xc3a6('0x39')]),_0x20b894);}});ami['on'](_0xc3a6('0x3a'),function(_0x5563f){try{utils['debug'](util[_0xc3a6('0x19')]('[%s][index][varset]',_0x5563f[_0xc3a6('0x1f')]),_0x5563f);queues[_0xc3a6('0x3a')](_0x5563f);recordings[_0xc3a6('0x3a')](_0x5563f);calls[_0xc3a6('0x3a')](_0x5563f);dials[_0xc3a6('0x3a')](_0x5563f);}catch(_0x625999){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x3b'),_0x5563f[_0xc3a6('0x1f')]),_0x625999);}});ami['on']('newexten',function(_0x8d1928){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x3c'),_0x8d1928[_0xc3a6('0x1f')]),_0x8d1928);calls[_0xc3a6('0x3d')](_0x8d1928);recordings[_0xc3a6('0x3d')](_0x8d1928);dials[_0xc3a6('0x3d')](_0x8d1928);}catch(_0x1db2a9){utils['error'](util[_0xc3a6('0x19')]('[%s][index][newexten]',_0x8d1928[_0xc3a6('0x1f')]),_0x1db2a9);}});ami['on'](_0xc3a6('0x3e'),function(_0x1806a7){try{utils[_0xc3a6('0x1d')](util[_0xc3a6('0x19')](_0xc3a6('0x3f'),_0x1806a7['uniqueid']),_0x1806a7);calls[_0xc3a6('0x3e')](_0x1806a7);recordings[_0xc3a6('0x3e')](_0x1806a7);}catch(_0x1e3e84){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x3f'),_0x1806a7[_0xc3a6('0x1f')]),_0x1e3e84);}});ami['on']('dialbegin',function(_0x99f859){try{utils[_0xc3a6('0x1d')](util['format']('[%s][index][dialbegin]',_0x99f859[_0xc3a6('0x1f')]),_0x99f859);dials[_0xc3a6('0x40')](_0x99f859);}catch(_0x2908fd){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x41'),_0x99f859[_0xc3a6('0x1f')]),_0x2908fd);}});ami['on']('dialend',function(_0x54484a){try{utils[_0xc3a6('0x1d')](util['format'](_0xc3a6('0x42'),_0x54484a['uniqueid']),_0x54484a);dials['dialend'](_0x54484a);}catch(_0x32cad2){utils[_0xc3a6('0x15')](util[_0xc3a6('0x19')](_0xc3a6('0x42'),_0x54484a['uniqueid']),_0x32cad2);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 27fb2fd..7cdde63 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 _0x5c54=['enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','channel','data1','source','destination','data3','assign','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','util','./utils','info','format','uniqueid','interface','data2','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x5c54,0x71));var _0x45c5=function(_0x2c660e,_0x25702c){_0x2c660e=_0x2c660e-0x0;var _0x5eeb77=_0x5c54[_0x2c660e];return _0x5eeb77;};'use strict';var _=require(_0x45c5('0x0'));var util=require(_0x45c5('0x1'));var utils=require(_0x45c5('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x404886){utils[_0x45c5('0x3')](util[_0x45c5('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x404886[_0x45c5('0x5')],_0x404886[_0x45c5('0x6')],_0x404886['channel'],_0x404886[_0x45c5('0x7')],_0x404886[_0x45c5('0x8')],_0x404886[_0x45c5('0x9')]));if(_0x404886['interface']){utils['getUserByInterface'](_0x404886[_0x45c5('0x6')])[_0x45c5('0xa')](function(_0x41b3a4){if(_0x41b3a4){_0x404886[_0x45c5('0x8')]=_0x41b3a4[_0x45c5('0xb')];_0x404886[_0x45c5('0xc')]=_0x41b3a4[_0x45c5('0xc')];utils[_0x45c5('0xd')](_0x45c5('0xe'),_0x404886);}else{utils[_0x45c5('0xf')](_0x404886[_0x45c5('0x6')][_0x45c5('0x10')]('/')[0x1])[_0x45c5('0xa')](function(_0x329044){if(_0x329044){_0x404886[_0x45c5('0x8')]=_0x329044['name'];_0x404886[_0x45c5('0xc')]=_0x329044[_0x45c5('0xc')];utils[_0x45c5('0xd')](_0x45c5('0xe'),_0x404886);}});}})[_0x45c5('0x11')](function(_0x2854a8){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x13'),_0x404886[_0x45c5('0x5')]),_0x2854a8);});}delete members[_0x404886[_0x45c5('0x6')]];}function startsWith(_0x1945de,_0x1e09ff){return _[_0x45c5('0x14')](_0x1945de,function(_0x4605fb){return _['startsWith'](_0x1e09ff,_0x4605fb);});}exports['devicestatechange']=function(_0x4b7b1a){try{utils[_0x45c5('0x15')](util['format'](_0x45c5('0x16'),members[_0x4b7b1a[_0x45c5('0x17')]]?members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x5')]:_0x4b7b1a[_0x45c5('0x17')]),_0x4b7b1a);utils[_0x45c5('0x3')](util[_0x45c5('0x4')](_0x45c5('0x18'),members[_0x4b7b1a[_0x45c5('0x17')]]?members[_0x4b7b1a['device']][_0x45c5('0x5')]:_0x4b7b1a['device'],_0x4b7b1a[_0x45c5('0x19')],_0x4b7b1a[_0x45c5('0x17')]));switch(_0x4b7b1a[_0x45c5('0x19')]){case _0x45c5('0x1a'):case _0x45c5('0x1b'):if(!startsWith(exclude,_0x4b7b1a['device'])){members[_0x4b7b1a[_0x45c5('0x17')]]={'channel':_0x45c5('0x1c'),'interface':_0x4b7b1a['device'],'type':_0x45c5('0x1d'),'enterAt':utils[_0x45c5('0x1e')](),'role':_0x45c5('0x1f')};}break;case _0x45c5('0x20'):if(!_[_0x45c5('0x21')](members[_0x4b7b1a[_0x45c5('0x17')]])){members[_0x4b7b1a['device']][_0x45c5('0x22')]=utils[_0x45c5('0x1e')]();members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x23')]=utils[_0x45c5('0x24')](members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x22')],members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x25')]);if(members[_0x4b7b1a[_0x45c5('0x17')]]['uniqueid']){writeDB(members[_0x4b7b1a['device']]);}}break;default:break;}}catch(_0x249478){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x16'),members[_0x4b7b1a[_0x45c5('0x17')]]?members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x5')]:_0x4b7b1a[_0x45c5('0x17')]),_0x249478);}};exports[_0x45c5('0x26')]=function(_0x175917){try{if(!_[_0x45c5('0x21')](members[_0x175917[_0x45c5('0x6')]])){utils[_0x45c5('0x15')](util[_0x45c5('0x4')]('[%s][members][agentcomplete]',_0x175917['uniqueid']),_0x175917);utils[_0x45c5('0x3')](util[_0x45c5('0x4')](_0x45c5('0x27'),_0x175917[_0x45c5('0x5')],_0x175917[_0x45c5('0x6')],_0x175917['queue']));members[_0x175917['interface']]=_['assign'](members[_0x175917['interface']],{'data4':_0x175917[_0x45c5('0x28')],'uniqueid':_0x175917['uniqueid']});}}catch(_0x5b8b55){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x29'),_0x175917[_0x45c5('0x5')]),_0x5b8b55);}};exports['cdr']=function(_0x531260){try{utils[_0x45c5('0x15')](util[_0x45c5('0x4')]('[%s][members][cdr]',_0x531260[_0x45c5('0x5')]),_0x531260);if(_0x531260[_0x45c5('0x2a')]){var _0x24a684=_0x531260[_0x45c5('0x2a')][_0x45c5('0x10')]('-')[0x0];if(!_['isNil'](members[_0x24a684])){members[_0x24a684]=_['assign'](members[_0x24a684],{'data1':members[_0x24a684][_0x45c5('0x2b')]||_0x531260[_0x45c5('0x9')],'data2':members[_0x24a684][_0x45c5('0x7')]||_0x531260[_0x45c5('0x2c')],'data3':members[_0x24a684]['data3']||_0x531260[_0x45c5('0x2d')],'uniqueid':members[_0x24a684][_0x45c5('0x5')]||_0x531260[_0x45c5('0x5')]});utils[_0x45c5('0x3')](util[_0x45c5('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x531260['uniqueid'],members[_0x24a684][_0x45c5('0x2b')],members[_0x24a684][_0x45c5('0x7')],members[_0x24a684][_0x45c5('0x2e')]));if(members[_0x24a684][_0x45c5('0x22')]){writeDB(members[_0x24a684]);}}}if(_0x531260['destinationchannel']){var _0x5f0688=_0x531260['destinationchannel'][_0x45c5('0x10')]('-')[0x0];if(!_['isNil'](members[_0x5f0688])){members[_0x5f0688]=_[_0x45c5('0x2f')](members[_0x5f0688],{'data1':members[_0x5f0688][_0x45c5('0x2b')]||_0x531260[_0x45c5('0x9')],'data2':members[_0x5f0688][_0x45c5('0x7')]||_0x531260['source'],'data3':members[_0x5f0688][_0x45c5('0x2e')]||_0x531260[_0x45c5('0x2d')],'uniqueid':members[_0x5f0688][_0x45c5('0x5')]||_0x531260['uniqueid']});utils['info'](util[_0x45c5('0x4')](_0x45c5('0x30'),_0x531260[_0x45c5('0x5')],members[_0x5f0688][_0x45c5('0x2b')],members[_0x5f0688]['data2'],members[_0x5f0688][_0x45c5('0x2e')]));if(members[_0x5f0688]['exitAt']){writeDB(members[_0x5f0688]);}}}}catch(_0x2d2172){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x31'),_0x531260[_0x45c5('0x5')]),_0x2d2172);}}; \ No newline at end of file +var _0xc2cc=['state','BUSY','voice','now','NOT_INUSE','exitAt','duration','diffTime','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','[%s][members][cdr]','data1','data2','destination','data3','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','format','uniqueid','channel','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','interface','split','error','some','startsWith','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0x2af7e9,_0x4aca13){var _0x378ead=function(_0x449f29){while(--_0x449f29){_0x2af7e9['push'](_0x2af7e9['shift']());}};_0x378ead(++_0x4aca13);}(_0xc2cc,0x70));var _0xcc2c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc2cc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xcc2c('0x0'));var utils=require(_0xcc2c('0x1'));var members={};var exclude=[_0xcc2c('0x2'),'Queue:'];function writeDB(_0x2a1a4a){utils['info'](util[_0xcc2c('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2a1a4a[_0xcc2c('0x4')],_0x2a1a4a['interface'],_0x2a1a4a[_0xcc2c('0x5')],_0x2a1a4a['data2'],_0x2a1a4a['membername'],_0x2a1a4a[_0xcc2c('0x6')]));if(_0x2a1a4a['interface']){utils[_0xcc2c('0x7')](_0x2a1a4a['interface'])[_0xcc2c('0x8')](function(_0x58c80c){if(_0x58c80c){_0x2a1a4a['membername']=_0x58c80c[_0xcc2c('0x9')];_0x2a1a4a[_0xcc2c('0xa')]=_0x58c80c[_0xcc2c('0xa')];utils[_0xcc2c('0xb')](_0xcc2c('0xc'),_0x2a1a4a);}else{utils[_0xcc2c('0xd')](_0x2a1a4a[_0xcc2c('0xe')][_0xcc2c('0xf')]('/')[0x1])['then'](function(_0x358306){if(_0x358306){_0x2a1a4a['membername']=_0x358306[_0xcc2c('0x9')];_0x2a1a4a[_0xcc2c('0xa')]=_0x358306[_0xcc2c('0xa')];utils[_0xcc2c('0xb')]('CreateMemberReport',_0x2a1a4a);}});}})['catch'](function(_0x4d52fe){utils[_0xcc2c('0x10')](util[_0xcc2c('0x3')]('[%s][members][writeDB]',_0x2a1a4a['uniqueid']),_0x4d52fe);});}delete members[_0x2a1a4a[_0xcc2c('0xe')]];}function startsWith(_0x494f3d,_0x18a774){return _[_0xcc2c('0x11')](_0x494f3d,function(_0x10a651){return _[_0xcc2c('0x12')](_0x18a774,_0x10a651);});}exports['devicestatechange']=function(_0x5d6189){try{utils[_0xcc2c('0x13')](util[_0xcc2c('0x3')]('[%s][members][devicestatechange]',members[_0x5d6189[_0xcc2c('0x14')]]?members[_0x5d6189[_0xcc2c('0x14')]][_0xcc2c('0x4')]:_0x5d6189[_0xcc2c('0x14')]),_0x5d6189);utils[_0xcc2c('0x15')](util[_0xcc2c('0x3')](_0xcc2c('0x16'),members[_0x5d6189['device']]?members[_0x5d6189[_0xcc2c('0x14')]][_0xcc2c('0x4')]:_0x5d6189['device'],_0x5d6189['state'],_0x5d6189['device']));switch(_0x5d6189[_0xcc2c('0x17')]){case'INUSE':case _0xcc2c('0x18'):if(!startsWith(exclude,_0x5d6189[_0xcc2c('0x14')])){members[_0x5d6189['device']]={'channel':_0xcc2c('0x19'),'interface':_0x5d6189[_0xcc2c('0x14')],'type':'TALKING','enterAt':utils[_0xcc2c('0x1a')](),'role':'agent'};}break;case _0xcc2c('0x1b'):if(!_['isNil'](members[_0x5d6189['device']])){members[_0x5d6189[_0xcc2c('0x14')]][_0xcc2c('0x1c')]=utils['now']();members[_0x5d6189[_0xcc2c('0x14')]][_0xcc2c('0x1d')]=utils[_0xcc2c('0x1e')](members[_0x5d6189[_0xcc2c('0x14')]][_0xcc2c('0x1c')],members[_0x5d6189[_0xcc2c('0x14')]]['enterAt']);if(members[_0x5d6189[_0xcc2c('0x14')]][_0xcc2c('0x4')]){writeDB(members[_0x5d6189[_0xcc2c('0x14')]]);}}break;default:break;}}catch(_0xfd6b4b){utils[_0xcc2c('0x10')](util['format']('[%s][members][devicestatechange]',members[_0x5d6189['device']]?members[_0x5d6189['device']][_0xcc2c('0x4')]:_0x5d6189[_0xcc2c('0x14')]),_0xfd6b4b);}};exports[_0xcc2c('0x1f')]=function(_0x2c4ce9){try{if(!_[_0xcc2c('0x20')](members[_0x2c4ce9[_0xcc2c('0xe')]])){utils[_0xcc2c('0x13')](util[_0xcc2c('0x3')](_0xcc2c('0x21'),_0x2c4ce9[_0xcc2c('0x4')]),_0x2c4ce9);utils[_0xcc2c('0x15')](util['format'](_0xcc2c('0x22'),_0x2c4ce9['uniqueid'],_0x2c4ce9['interface'],_0x2c4ce9['queue']));members[_0x2c4ce9[_0xcc2c('0xe')]]=_[_0xcc2c('0x23')](members[_0x2c4ce9['interface']],{'data4':_0x2c4ce9['queue'],'uniqueid':_0x2c4ce9[_0xcc2c('0x4')]});}}catch(_0x4e4265){utils[_0xcc2c('0x10')](util[_0xcc2c('0x3')](_0xcc2c('0x21'),_0x2c4ce9[_0xcc2c('0x4')]),_0x4e4265);}};exports[_0xcc2c('0x24')]=function(_0x565b97){try{utils['debug'](util[_0xcc2c('0x3')](_0xcc2c('0x25'),_0x565b97[_0xcc2c('0x4')]),_0x565b97);if(_0x565b97[_0xcc2c('0x5')]){var _0x23da34=_0x565b97['channel'][_0xcc2c('0xf')]('-')[0x0];if(!_['isNil'](members[_0x23da34])){members[_0x23da34]=_[_0xcc2c('0x23')](members[_0x23da34],{'data1':members[_0x23da34][_0xcc2c('0x26')]||_0x565b97['type'],'data2':members[_0x23da34][_0xcc2c('0x27')]||_0x565b97['source'],'data3':members[_0x23da34]['data3']||_0x565b97[_0xcc2c('0x28')],'uniqueid':members[_0x23da34]['uniqueid']||_0x565b97[_0xcc2c('0x4')]});utils[_0xcc2c('0x15')](util[_0xcc2c('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x565b97[_0xcc2c('0x4')],members[_0x23da34][_0xcc2c('0x26')],members[_0x23da34]['data2'],members[_0x23da34][_0xcc2c('0x29')]));if(members[_0x23da34]['exitAt']){writeDB(members[_0x23da34]);}}}if(_0x565b97[_0xcc2c('0x2a')]){var _0x4cb5de=_0x565b97[_0xcc2c('0x2a')][_0xcc2c('0xf')]('-')[0x0];if(!_[_0xcc2c('0x20')](members[_0x4cb5de])){members[_0x4cb5de]=_['assign'](members[_0x4cb5de],{'data1':members[_0x4cb5de][_0xcc2c('0x26')]||_0x565b97[_0xcc2c('0x6')],'data2':members[_0x4cb5de][_0xcc2c('0x27')]||_0x565b97[_0xcc2c('0x2b')],'data3':members[_0x4cb5de][_0xcc2c('0x29')]||_0x565b97[_0xcc2c('0x28')],'uniqueid':members[_0x4cb5de]['uniqueid']||_0x565b97[_0xcc2c('0x4')]});utils[_0xcc2c('0x15')](util[_0xcc2c('0x3')](_0xcc2c('0x2c'),_0x565b97['uniqueid'],members[_0x4cb5de][_0xcc2c('0x26')],members[_0x4cb5de][_0xcc2c('0x27')],members[_0x4cb5de][_0xcc2c('0x29')]));if(members[_0x4cb5de][_0xcc2c('0x1c')]){writeDB(members[_0x4cb5de]);}}}}catch(_0x21834b){utils[_0xcc2c('0x10')](util[_0xcc2c('0x3')](_0xcc2c('0x25'),_0x565b97[_0xcc2c('0x4')]),_0x21834b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ff04a88..0db71c7 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 _0xf540=['[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','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]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format'];(function(_0x431f11,_0x2e0001){var _0x51391f=function(_0x11d3b5){while(--_0x11d3b5){_0x431f11['push'](_0x431f11['shift']());}};_0x51391f(++_0x2e0001);}(_0xf540,0x1f1));var _0x0f54=function(_0x481c8b,_0x41e7be){_0x481c8b=_0x481c8b-0x0;var _0x4790ab=_0xf540[_0x481c8b];return _0x4790ab;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0f54('0x0'));var queues={};function writeDB(_0x4d77da){utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x3'),_0x4d77da[_0x0f54('0x4')],_0x4d77da[_0x0f54('0x5')],_0x4d77da[_0x0f54('0x6')],_0x4d77da[_0x0f54('0x7')],_0x4d77da[_0x0f54('0x8')],_0x4d77da[_0x0f54('0x9')],_0x4d77da[_0x0f54('0xa')]));if(_0x4d77da[_0x0f54('0x6')]){utils[_0x0f54('0xb')](_0x4d77da[_0x0f54('0x6')])[_0x0f54('0xc')](function(_0x5119df){if(_0x5119df){_0x4d77da[_0x0f54('0xd')]=_0x5119df[_0x0f54('0xd')];}utils[_0x0f54('0xe')]('CreateVoiceQueueReport',_0x4d77da);});}else{utils[_0x0f54('0xe')](_0x0f54('0xf'),_0x4d77da);}if(_0x4d77da[_0x0f54('0x10')]){delete queues[_0x4d77da[_0x0f54('0x10')]];}else{delete queues[_0x4d77da[_0x0f54('0x4')]];}}exports[_0x0f54('0x11')]=function(_0x18495b){try{utils[_0x0f54('0x12')](util[_0x0f54('0x2')](_0x0f54('0x13'),_0x18495b[_0x0f54('0x4')]),_0x18495b);utils[_0x0f54('0x1')](util['format'](_0x0f54('0x14'),_0x18495b[_0x0f54('0x4')],_0x18495b[_0x0f54('0x6')],_0x18495b[_0x0f54('0x15')]));queues[_0x18495b['uniqueid']]=_[_0x0f54('0x16')](_0x18495b,{'originalposition':_0x18495b[_0x0f54('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3204a5){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x13'),_0x18495b[_0x0f54('0x4')]),_0x3204a5);}};exports[_0x0f54('0x18')]=function(_0x249eab){try{if(!_['isNil'](queues[_0x249eab[_0x0f54('0x4')]])){utils[_0x0f54('0x12')](util['format'](_0x0f54('0x19'),_0x249eab[_0x0f54('0x4')]),_0x249eab);if(queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x1a')]){if(!queues[_0x249eab['uniqueid']][_0x0f54('0x1b')]&&!queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x1c')]){queues[_0x249eab['uniqueid']][_0x0f54('0x1d')]=!![];queues[_0x249eab['uniqueid']]['queuecallercompleteAt']=utils[_0x0f54('0x1e')]();queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x1f');}utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x249eab[_0x0f54('0x4')],queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x20')],queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0xa')]));writeDB(queues[_0x249eab[_0x0f54('0x4')]]);}else if(queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x10')]){utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x21'),_0x249eab[_0x0f54('0x4')],queues[_0x249eab[_0x0f54('0x4')]]['name'],queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x10')]));queues[queues[_0x249eab['uniqueid']]['transfereduniqueid']]=queues[_0x249eab[_0x0f54('0x4')]];queues[queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x249eab['uniqueid']];}}}catch(_0x1e775a){utils['error'](util[_0x0f54('0x2')](_0x0f54('0x19'),_0x249eab[_0x0f54('0x4')]),_0x1e775a);}};exports[_0x0f54('0x22')]=function(_0xb0c491){try{utils[_0x0f54('0x12')](util[_0x0f54('0x2')](_0x0f54('0x23'),_0xb0c491[_0x0f54('0x4')]),_0xb0c491);if(!_[_0x0f54('0x24')](_0xb0c491[_0x0f54('0x25')]['queuestatus'])&&_0xb0c491[_0x0f54('0x26')][_0x0f54('0x27')]()!=='CONTINUE'){if(!_[_0x0f54('0x24')](queues[_0xb0c491[_0x0f54('0x4')]])){queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x1b')]=![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x28')]=null;queues[_0xb0c491['uniqueid']][_0x0f54('0x1c')]=!![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x29')]=utils[_0x0f54('0x1e')]();queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0xa')]=_0xb0c491[_0x0f54('0x26')][_0x0f54('0x27')]();utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x2a'),_0xb0c491['uniqueid'],queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x20')],_0xb0c491[_0x0f54('0x26')],queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0xa')]));writeDB(queues[_0xb0c491[_0x0f54('0x4')]]);}}else if(!_[_0x0f54('0x24')](_0xb0c491[_0x0f54('0x25')][_0x0f54('0x2b')])){if(!_['isNil'](queues[_0xb0c491[_0x0f54('0x4')]])&&!queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x1b')]){queues[_0xb0c491[_0x0f54('0x4')]]['queuecallerabandon']=![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x28')]=null;queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x1c')]=!![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x29')]=utils[_0x0f54('0x1e')]();queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x2c');utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xb0c491[_0x0f54('0x4')],queues[_0xb0c491['uniqueid']][_0x0f54('0x20')],_0xb0c491[_0x0f54('0x26')],queues[_0xb0c491[_0x0f54('0x4')]]['queuecallerexitreason']));}}}catch(_0xdbe74c){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x23'),_0xb0c491['uniqueid']),_0xdbe74c);}};exports[_0x0f54('0x1b')]=function(_0x3f3c29){try{if(!_[_0x0f54('0x24')](queues[_0x3f3c29[_0x0f54('0x4')]])){utils['debug'](util[_0x0f54('0x2')]('[%s][queues][queuecallerabandon]',_0x3f3c29[_0x0f54('0x4')]),_0x3f3c29);queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0x1c')]=![];queues[_0x3f3c29[_0x0f54('0x4')]]['queuecallerexitAt']=null;queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0x1b')]=!![];queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0x28')]=utils['now']();queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0xa')]='ABANDONED';utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x2d'),_0x3f3c29['uniqueid'],queues[_0x3f3c29['uniqueid']][_0x0f54('0x20')],queues[_0x3f3c29['uniqueid']][_0x0f54('0xa')]));}}catch(_0xbebccc){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x2e'),_0x3f3c29['uniqueid']),_0xbebccc);}};exports[_0x0f54('0x2f')]=function(_0x451465){try{if(!_[_0x0f54('0x24')](queues[_0x451465['uniqueid']])){utils[_0x0f54('0x12')](util['format'](_0x0f54('0x30'),_0x451465[_0x0f54('0x4')]),_0x451465);utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x451465['uniqueid'],queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x20')],_0x451465[_0x0f54('0x31')],_0x451465['connectedlinename']));queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x2f')]=!![];queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x1a')]=utils['now']();queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x32')]=utils['diffTime'](queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x1a')],queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x33')]);queues[_0x451465['uniqueid']][_0x0f54('0x15')]=_0x451465[_0x0f54('0x15')];queues[_0x451465['uniqueid']][_0x0f54('0x34')]=_0x451465[_0x0f54('0x34')];queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x31')]=_0x451465[_0x0f54('0x31')];queues[_0x451465['uniqueid']][_0x0f54('0x35')]=_0x451465[_0x0f54('0x35')];}}catch(_0x13cb85){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x30'),_0x451465[_0x0f54('0x4')]),_0x13cb85);}};exports[_0x0f54('0x36')]=function(_0x1e9952){try{if(!_[_0x0f54('0x24')](queues[_0x1e9952[_0x0f54('0x4')]])){utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][agentconnect]',_0x1e9952[_0x0f54('0x4')]),_0x1e9952);utils['info'](util[_0x0f54('0x2')](_0x0f54('0x37'),_0x1e9952[_0x0f54('0x4')],queues[_0x1e9952[_0x0f54('0x4')]]['name'],_0x1e9952[_0x0f54('0x38')],_0x1e9952['destaccountcode']));queues[_0x1e9952['uniqueid']][_0x0f54('0x1b')]=![];queues[_0x1e9952[_0x0f54('0x4')]]['queuecallerabandon']=![];queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x28')]=null;queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x1c')]=![];queues[_0x1e9952[_0x0f54('0x4')]]['queuecallerexitreason']=null;queues[_0x1e9952['uniqueid']][_0x0f54('0x29')]=null;queues[_0x1e9952[_0x0f54('0x4')]]['assigned']=!![];queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x9')]=_0x1e9952[_0x0f54('0x39')];queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x7')]=_0x1e9952[_0x0f54('0x38')];}}catch(_0xcc2161){utils[_0x0f54('0x17')](util['format'](_0x0f54('0x3a'),_0x1e9952[_0x0f54('0x4')]),_0xcc2161);}};exports[_0x0f54('0x3b')]=function(_0x40b172){try{if(!_[_0x0f54('0x24')](queues[_0x40b172[_0x0f54('0x4')]])){if(queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1a')]){utils[_0x0f54('0x12')](util[_0x0f54('0x2')](_0x0f54('0x3c'),_0x40b172[_0x0f54('0x4')]),_0x40b172);queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1b')]=![];queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1b')]=![];queues[_0x40b172['uniqueid']][_0x0f54('0x28')]=null;queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1c')]=![];queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x29')]=null;queues[_0x40b172[_0x0f54('0x4')]]['assigned']=!![];queues[_0x40b172[_0x0f54('0x4')]]['lastAssignedTo']=_0x40b172['membername'];queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1d')]=!![];queues[_0x40b172[_0x0f54('0x4')]]['queuecallercompleteAt']=utils[_0x0f54('0x1e')]();if(_0x40b172[_0x0f54('0x3d')]==_0x0f54('0x3e')){if(!queues[_0x40b172['uniqueid']][_0x0f54('0x3e')]){queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x3f');}}else{queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x40')+_0x40b172[_0x0f54('0x3d')][_0x0f54('0x27')]();}utils[_0x0f54('0x1')](util['format'](_0x0f54('0x41'),_0x40b172[_0x0f54('0x4')],queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x20')],_0x40b172['membername'],queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0xa')]));writeDB(queues[_0x40b172[_0x0f54('0x4')]]);}}}catch(_0x3709c4){utils['error'](util[_0x0f54('0x2')](_0x0f54('0x3c'),_0x40b172[_0x0f54('0x4')]),_0x3709c4);}};exports[_0x0f54('0x42')]=function(_0x304a6d){try{if(!_[_0x0f54('0x24')](queues[_0x304a6d[_0x0f54('0x43')]])){utils[_0x0f54('0x12')](util['format'](_0x0f54('0x44'),_0x304a6d['uniqueid']),_0x304a6d);queues[_0x304a6d['transfereeuniqueid']][_0x0f54('0x3e')]=!![];queues[_0x304a6d[_0x0f54('0x43')]][_0x0f54('0x45')]=_0x0f54('0x46');queues[_0x304a6d['transfereeuniqueid']][_0x0f54('0x47')]=_0x304a6d[_0x0f54('0x48')];queues[_0x304a6d['transfereeuniqueid']][_0x0f54('0x49')]=_0x304a6d[_0x0f54('0x43')];queues[_0x304a6d[_0x0f54('0x43')]][_0x0f54('0xa')]='BLINDTRANSFER';utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x4a'),_0x304a6d[_0x0f54('0x4')],queues[_0x304a6d[_0x0f54('0x43')]][_0x0f54('0x20')],_0x304a6d[_0x0f54('0x43')],_0x304a6d['extension']));}}catch(_0x54d789){utils[_0x0f54('0x17')](util[_0x0f54('0x2')]('[%s][queues][blindtransfer]',_0x304a6d[_0x0f54('0x4')]),_0x54d789);}};exports[_0x0f54('0x4b')]=function(_0x1b4a0e){try{utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][attendedtransfer]',_0x1b4a0e[_0x0f54('0x4c')]),_0x1b4a0e);if(_0x1b4a0e[_0x0f54('0x4c')]==_0x1b4a0e[_0x0f54('0x4d')]){if(!_[_0x0f54('0x24')](queues[_0x1b4a0e[_0x0f54('0x4e')]])){utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x4f')]));queues[_0x1b4a0e[_0x0f54('0x4e')]]['transfer']=!![];queues[_0x1b4a0e[_0x0f54('0x4e')]]['transfertype']=_0x0f54('0x50');queues[_0x1b4a0e['secondtransfererlinkedid']][_0x0f54('0x47')]=_0x1b4a0e[_0x0f54('0x4f')];queues[_0x1b4a0e['secondtransfererlinkedid']]['transferuniqueid']=_0x1b4a0e[_0x0f54('0x4c')];queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0xa')]=_0x0f54('0x51');}if(!_[_0x0f54('0x24')](queues[_0x1b4a0e[_0x0f54('0x4d')]])){if(_0x1b4a0e[_0x0f54('0x52')]&&queues[_0x1b4a0e[_0x0f54('0x52')]]){queues[_0x1b4a0e[_0x0f54('0x52')]][_0x0f54('0x53')]=0x1;queues[_0x1b4a0e['transfereeuniqueid']]=_[_0x0f54('0x54')](queues[_0x1b4a0e['transfereelinkedid']]);queues[_0x1b4a0e[_0x0f54('0x43')]]['transfereduniqueid']=_0x1b4a0e['transfertargetuniqueid'];queues[_0x1b4a0e[_0x0f54('0x43')]]['queuecallerenterreason']=0x2;queues[_0x1b4a0e[_0x0f54('0x43')]]['calleridnum']=queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x8')];queues[_0x1b4a0e['transfereeuniqueid']][_0x0f54('0x55')]=queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x55')];queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x33')]=utils[_0x0f54('0x1e')]();queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x1a')]=utils['now']();queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x32')]=0x0;queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x56')]=0x0;utils['info'](util[_0x0f54('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x20')],queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x8')],queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x55')]));}else{utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x57'),_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e['origtransfererlinkedid']][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x4e')]));queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x10')]=_0x1b4a0e[_0x0f54('0x4e')];}}}else if(_0x1b4a0e[_0x0f54('0x58')]==_0x1b4a0e[_0x0f54('0x4e')]){if(!_['isNil'](queues[_0x1b4a0e[_0x0f54('0x4d')]])){utils[_0x0f54('0x1')](util['format'](_0x0f54('0x59'),_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x58')],_0x1b4a0e['secondtransfererexten']));queues[_0x1b4a0e['origtransfererlinkedid']][_0x0f54('0x3e')]=!![];queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x45')]=_0x0f54('0x50');queues[_0x1b4a0e[_0x0f54('0x4d')]]['transferexten']=_0x1b4a0e[_0x0f54('0x5a')];queues[_0x1b4a0e['origtransfererlinkedid']][_0x0f54('0x49')]=_0x1b4a0e[_0x0f54('0x58')];queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0xa')]=_0x0f54('0x51');}if(!_[_0x0f54('0x24')](queues[_0x1b4a0e[_0x0f54('0x4e')]])){if(_0x1b4a0e[_0x0f54('0x5b')]&&queues[_0x1b4a0e[_0x0f54('0x5b')]]){queues[_0x1b4a0e[_0x0f54('0x5b')]][_0x0f54('0x53')]=0x1;queues[_0x1b4a0e[_0x0f54('0x5c')]]=_['clone'](queues[_0x1b4a0e[_0x0f54('0x5b')]]);queues[_0x1b4a0e[_0x0f54('0x5c')]][_0x0f54('0x10')]=_0x1b4a0e[_0x0f54('0x5c')];queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x53')]=0x2;queues[_0x1b4a0e[_0x0f54('0x5c')]]['calleridnum']=queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x8')];queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x55')]=queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x55')];queues[_0x1b4a0e['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x0f54('0x1e')]();queues[_0x1b4a0e[_0x0f54('0x5c')]][_0x0f54('0x1a')]=utils[_0x0f54('0x1e')]();queues[_0x1b4a0e[_0x0f54('0x5c')]]['holdtime']=0x0;queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x56')]=0x0;utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x5d'),_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x5c')]][_0x0f54('0x20')],queues[_0x1b4a0e['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x1b4a0e[_0x0f54('0x5c')]]['calleridnum'],queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x55')]));}else{utils[_0x0f54('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x4d')]));queues[_0x1b4a0e['secondtransfererlinkedid']][_0x0f54('0x10')]=_0x1b4a0e[_0x0f54('0x4d')];}}}}catch(_0x1d211b){utils[_0x0f54('0x17')](util['format'](_0x0f54('0x5e'),_0x1b4a0e[_0x0f54('0x4c')]),_0x1d211b);}};exports[_0x0f54('0x5f')]=function(_0x27e4c1){try{if(!_[_0x0f54('0x24')](queues[_0x27e4c1[_0x0f54('0x4')]])){utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][musiconholdstart]',_0x27e4c1[_0x0f54('0x4')]),_0x27e4c1);queues[_0x27e4c1[_0x0f54('0x4')]]['musiconholdstartAt']=utils[_0x0f54('0x1e')]();utils[_0x0f54('0x1')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x27e4c1['uniqueid'],queues[_0x27e4c1[_0x0f54('0x4')]][_0x0f54('0x20')],queues[_0x27e4c1[_0x0f54('0x4')]][_0x0f54('0x60')]));}}catch(_0x30428e){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x61'),_0x27e4c1['uniqueid']),_0x30428e);}};exports[_0x0f54('0x62')]=function(_0x2217c4){try{if(!_[_0x0f54('0x24')](queues[_0x2217c4[_0x0f54('0x4')]])){if(!_['isNil'](queues[_0x2217c4[_0x0f54('0x4')]][_0x0f54('0x60')])){utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][musiconholdstop]',_0x2217c4[_0x0f54('0x4')]),_0x2217c4);queues[_0x2217c4[_0x0f54('0x4')]][_0x0f54('0x56')]+=utils['diffTime'](utils['now'](),queues[_0x2217c4['uniqueid']]['musiconholdstartAt']);utils[_0x0f54('0x1')](util['format'](_0x0f54('0x63'),_0x2217c4[_0x0f54('0x4')],queues[_0x2217c4['uniqueid']][_0x0f54('0x20')],queues[_0x2217c4[_0x0f54('0x4')]]['mohtime']));delete queues[_0x2217c4[_0x0f54('0x4')]][_0x0f54('0x60')];}}}catch(_0x25b1b8){utils[_0x0f54('0x17')](util['format']('[%s][queues][musiconholdstop]',_0x2217c4[_0x0f54('0x4')]),_0x25b1b8);}}; \ No newline at end of file +var _0xb8d0=['ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','isNil','debug','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfer','transfertype','BLIND','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferexten','transferuniqueid'];(function(_0x3aaecb,_0x59be14){var _0x42ca0b=function(_0x233f3d){while(--_0x233f3d){_0x3aaecb['push'](_0x3aaecb['shift']());}};_0x42ca0b(++_0x59be14);}(_0xb8d0,0x7d));var _0x0b8d=function(_0x737849,_0x7e4729){_0x737849=_0x737849-0x0;var _0x17897f=_0xb8d0[_0x737849];return _0x17897f;};'use strict';var _=require(_0x0b8d('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x6416a){utils[_0x0b8d('0x1')](util['format'](_0x0b8d('0x2'),_0x6416a[_0x0b8d('0x3')],_0x6416a[_0x0b8d('0x4')],_0x6416a['queue'],_0x6416a[_0x0b8d('0x5')],_0x6416a[_0x0b8d('0x6')],_0x6416a[_0x0b8d('0x7')],_0x6416a['queuecallerexitreason']));if(_0x6416a[_0x0b8d('0x8')]){utils[_0x0b8d('0x9')](_0x6416a['queue'])[_0x0b8d('0xa')](function(_0x28fdbb){if(_0x28fdbb){_0x6416a[_0x0b8d('0xb')]=_0x28fdbb[_0x0b8d('0xb')];}utils[_0x0b8d('0xc')](_0x0b8d('0xd'),_0x6416a);});}else{utils[_0x0b8d('0xc')](_0x0b8d('0xd'),_0x6416a);}if(_0x6416a[_0x0b8d('0xe')]){delete queues[_0x6416a[_0x0b8d('0xe')]];}else{delete queues[_0x6416a['uniqueid']];}}exports['queuecallerjoin']=function(_0x1e5d4e){try{utils['debug'](util[_0x0b8d('0xf')](_0x0b8d('0x10'),_0x1e5d4e[_0x0b8d('0x3')]),_0x1e5d4e);utils['info'](util[_0x0b8d('0xf')](_0x0b8d('0x11'),_0x1e5d4e[_0x0b8d('0x3')],_0x1e5d4e[_0x0b8d('0x8')],_0x1e5d4e[_0x0b8d('0x12')]));queues[_0x1e5d4e[_0x0b8d('0x3')]]=_['assign'](_0x1e5d4e,{'originalposition':_0x1e5d4e[_0x0b8d('0x12')],'queuecallerjoinAt':utils[_0x0b8d('0x13')](),'mohtime':0x0});}catch(_0x30678b){utils[_0x0b8d('0x14')](util[_0x0b8d('0xf')](_0x0b8d('0x10'),_0x1e5d4e['uniqueid']),_0x30678b);}};exports[_0x0b8d('0x15')]=function(_0x5c66f5){try{if(!_[_0x0b8d('0x16')](queues[_0x5c66f5[_0x0b8d('0x3')]])){utils[_0x0b8d('0x17')](util[_0x0b8d('0xf')]('[%s][queues][hangup]',_0x5c66f5[_0x0b8d('0x3')]),_0x5c66f5);if(queues[_0x5c66f5['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x5c66f5['uniqueid']][_0x0b8d('0x18')]&&!queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0x19')]){queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0x1a')]=!![];queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0x1b')]=utils[_0x0b8d('0x13')]();queues[_0x5c66f5['uniqueid']][_0x0b8d('0x1c')]=_0x0b8d('0x1d');}utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5c66f5[_0x0b8d('0x3')],queues[_0x5c66f5['uniqueid']]['name'],queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0x1c')]));writeDB(queues[_0x5c66f5[_0x0b8d('0x3')]]);}else if(queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0xe')]){utils['info'](util[_0x0b8d('0xf')](_0x0b8d('0x1e'),_0x5c66f5[_0x0b8d('0x3')],queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0x1f')],queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0xe')]));queues[queues[_0x5c66f5['uniqueid']]['transfereduniqueid']]=queues[_0x5c66f5[_0x0b8d('0x3')]];queues[queues[_0x5c66f5[_0x0b8d('0x3')]][_0x0b8d('0xe')]][_0x0b8d('0x20')]=0x2;delete queues[_0x5c66f5[_0x0b8d('0x3')]];}}}catch(_0x200718){utils[_0x0b8d('0x14')](util[_0x0b8d('0xf')]('[%s][queues][hangup]',_0x5c66f5[_0x0b8d('0x3')]),_0x200718);}};exports[_0x0b8d('0x21')]=function(_0x51f9fe){try{utils['debug'](util[_0x0b8d('0xf')]('[%s][queues][varset]',_0x51f9fe[_0x0b8d('0x3')]),_0x51f9fe);if(!_[_0x0b8d('0x16')](_0x51f9fe[_0x0b8d('0x22')][_0x0b8d('0x23')])&&_0x51f9fe['value'][_0x0b8d('0x24')]()!==_0x0b8d('0x25')){if(!_[_0x0b8d('0x16')](queues[_0x51f9fe[_0x0b8d('0x3')]])){queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x18')]=![];queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x26')]=null;queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x19')]=!![];queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x27')]=utils[_0x0b8d('0x13')]();queues[_0x51f9fe['uniqueid']][_0x0b8d('0x1c')]=_0x51f9fe[_0x0b8d('0x28')][_0x0b8d('0x24')]();utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x29'),_0x51f9fe[_0x0b8d('0x3')],queues[_0x51f9fe[_0x0b8d('0x3')]]['name'],_0x51f9fe['value'],queues[_0x51f9fe['uniqueid']][_0x0b8d('0x1c')]));writeDB(queues[_0x51f9fe[_0x0b8d('0x3')]]);}}else if(!_[_0x0b8d('0x16')](_0x51f9fe[_0x0b8d('0x22')][_0x0b8d('0x2a')])){if(!_[_0x0b8d('0x16')](queues[_0x51f9fe['uniqueid']])&&!queues[_0x51f9fe[_0x0b8d('0x3')]]['queuecallerabandon']){queues[_0x51f9fe['uniqueid']][_0x0b8d('0x18')]=![];queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x26')]=null;queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x19')]=!![];queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x27')]=utils[_0x0b8d('0x13')]();queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x1c')]='EXITWITHKEY';utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x2b'),_0x51f9fe[_0x0b8d('0x3')],queues[_0x51f9fe[_0x0b8d('0x3')]][_0x0b8d('0x1f')],_0x51f9fe['value'],queues[_0x51f9fe['uniqueid']][_0x0b8d('0x1c')]));}}}catch(_0x2e653f){utils[_0x0b8d('0x14')](util[_0x0b8d('0xf')](_0x0b8d('0x2c'),_0x51f9fe[_0x0b8d('0x3')]),_0x2e653f);}};exports[_0x0b8d('0x18')]=function(_0x5a26d7){try{if(!_[_0x0b8d('0x16')](queues[_0x5a26d7[_0x0b8d('0x3')]])){utils[_0x0b8d('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x5a26d7['uniqueid']),_0x5a26d7);queues[_0x5a26d7[_0x0b8d('0x3')]][_0x0b8d('0x19')]=![];queues[_0x5a26d7['uniqueid']][_0x0b8d('0x27')]=null;queues[_0x5a26d7[_0x0b8d('0x3')]][_0x0b8d('0x18')]=!![];queues[_0x5a26d7[_0x0b8d('0x3')]][_0x0b8d('0x26')]=utils[_0x0b8d('0x13')]();queues[_0x5a26d7[_0x0b8d('0x3')]][_0x0b8d('0x1c')]=_0x0b8d('0x2d');utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x2e'),_0x5a26d7[_0x0b8d('0x3')],queues[_0x5a26d7[_0x0b8d('0x3')]]['name'],queues[_0x5a26d7[_0x0b8d('0x3')]][_0x0b8d('0x1c')]));}}catch(_0x47edd7){utils['error'](util['format'](_0x0b8d('0x2f'),_0x5a26d7[_0x0b8d('0x3')]),_0x47edd7);}};exports['queuecallerleave']=function(_0x49f7d4){try{if(!_[_0x0b8d('0x16')](queues[_0x49f7d4['uniqueid']])){utils[_0x0b8d('0x17')](util[_0x0b8d('0xf')](_0x0b8d('0x30'),_0x49f7d4[_0x0b8d('0x3')]),_0x49f7d4);utils[_0x0b8d('0x1')](util['format'](_0x0b8d('0x31'),_0x49f7d4[_0x0b8d('0x3')],queues[_0x49f7d4[_0x0b8d('0x3')]][_0x0b8d('0x1f')],_0x49f7d4[_0x0b8d('0x32')],_0x49f7d4[_0x0b8d('0x33')]));queues[_0x49f7d4[_0x0b8d('0x3')]][_0x0b8d('0x34')]=!![];queues[_0x49f7d4['uniqueid']][_0x0b8d('0x35')]=utils[_0x0b8d('0x13')]();queues[_0x49f7d4[_0x0b8d('0x3')]][_0x0b8d('0x36')]=utils['diffTime'](queues[_0x49f7d4[_0x0b8d('0x3')]]['queuecallerleaveAt'],queues[_0x49f7d4['uniqueid']][_0x0b8d('0x37')]);queues[_0x49f7d4[_0x0b8d('0x3')]][_0x0b8d('0x12')]=_0x49f7d4[_0x0b8d('0x12')];queues[_0x49f7d4[_0x0b8d('0x3')]][_0x0b8d('0x38')]=_0x49f7d4[_0x0b8d('0x38')];queues[_0x49f7d4[_0x0b8d('0x3')]]['connectedlinenum']=_0x49f7d4[_0x0b8d('0x32')];queues[_0x49f7d4['uniqueid']][_0x0b8d('0x33')]=_0x49f7d4['connectedlinename'];}}catch(_0x179574){utils[_0x0b8d('0x14')](util['format']('[%s][queues][queuecallerleave]',_0x49f7d4[_0x0b8d('0x3')]),_0x179574);}};exports[_0x0b8d('0x39')]=function(_0x13bbc9){try{if(!_[_0x0b8d('0x16')](queues[_0x13bbc9['uniqueid']])){utils[_0x0b8d('0x17')](util['format'](_0x0b8d('0x3a'),_0x13bbc9[_0x0b8d('0x3')]),_0x13bbc9);utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x13bbc9[_0x0b8d('0x3')],queues[_0x13bbc9[_0x0b8d('0x3')]][_0x0b8d('0x1f')],_0x13bbc9[_0x0b8d('0x3b')],_0x13bbc9[_0x0b8d('0x3c')]));queues[_0x13bbc9['uniqueid']]['queuecallerabandon']=![];queues[_0x13bbc9[_0x0b8d('0x3')]][_0x0b8d('0x18')]=![];queues[_0x13bbc9[_0x0b8d('0x3')]][_0x0b8d('0x26')]=null;queues[_0x13bbc9['uniqueid']][_0x0b8d('0x19')]=![];queues[_0x13bbc9[_0x0b8d('0x3')]]['queuecallerexitreason']=null;queues[_0x13bbc9[_0x0b8d('0x3')]][_0x0b8d('0x27')]=null;queues[_0x13bbc9[_0x0b8d('0x3')]][_0x0b8d('0x3d')]=!![];queues[_0x13bbc9['uniqueid']]['accountcode']=_0x13bbc9['destaccountcode'];queues[_0x13bbc9[_0x0b8d('0x3')]]['lastAssignedTo']=_0x13bbc9[_0x0b8d('0x3b')];}}catch(_0x44e786){utils['error'](util[_0x0b8d('0xf')]('[%s][queues][agentconnect]',_0x13bbc9[_0x0b8d('0x3')]),_0x44e786);}};exports[_0x0b8d('0x3e')]=function(_0x436c95){try{if(!_['isNil'](queues[_0x436c95[_0x0b8d('0x3')]])){if(queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x35')]){utils[_0x0b8d('0x17')](util[_0x0b8d('0xf')](_0x0b8d('0x3f'),_0x436c95[_0x0b8d('0x3')]),_0x436c95);queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x18')]=![];queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x18')]=![];queues[_0x436c95['uniqueid']][_0x0b8d('0x26')]=null;queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x19')]=![];queues[_0x436c95[_0x0b8d('0x3')]]['queuecallerexitAt']=null;queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x3d')]=!![];queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x5')]=_0x436c95[_0x0b8d('0x3b')];queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x1a')]=!![];queues[_0x436c95['uniqueid']][_0x0b8d('0x1b')]=utils[_0x0b8d('0x13')]();if(_0x436c95[_0x0b8d('0x40')]=='transfer'){if(!queues[_0x436c95[_0x0b8d('0x3')]]['transfer']){queues[_0x436c95['uniqueid']][_0x0b8d('0x1c')]='TRANSFER';}}else{queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x1c')]=_0x0b8d('0x41')+_0x436c95[_0x0b8d('0x40')]['toUpperCase']();}utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x42'),_0x436c95[_0x0b8d('0x3')],queues[_0x436c95[_0x0b8d('0x3')]][_0x0b8d('0x1f')],_0x436c95[_0x0b8d('0x3b')],queues[_0x436c95[_0x0b8d('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x436c95[_0x0b8d('0x3')]]);}}}catch(_0x31fc0){utils['error'](util[_0x0b8d('0xf')](_0x0b8d('0x3f'),_0x436c95[_0x0b8d('0x3')]),_0x31fc0);}};exports[_0x0b8d('0x43')]=function(_0x1b0646){try{if(!_['isNil'](queues[_0x1b0646[_0x0b8d('0x44')]])){utils[_0x0b8d('0x17')](util[_0x0b8d('0xf')](_0x0b8d('0x45'),_0x1b0646[_0x0b8d('0x3')]),_0x1b0646);queues[_0x1b0646['transfereeuniqueid']][_0x0b8d('0x46')]=!![];queues[_0x1b0646['transfereeuniqueid']][_0x0b8d('0x47')]=_0x0b8d('0x48');queues[_0x1b0646[_0x0b8d('0x44')]]['transferexten']=_0x1b0646['extension'];queues[_0x1b0646[_0x0b8d('0x44')]]['transferuniqueid']=_0x1b0646[_0x0b8d('0x44')];queues[_0x1b0646[_0x0b8d('0x44')]][_0x0b8d('0x1c')]=_0x0b8d('0x49');utils['info'](util['format'](_0x0b8d('0x4a'),_0x1b0646[_0x0b8d('0x3')],queues[_0x1b0646[_0x0b8d('0x44')]][_0x0b8d('0x1f')],_0x1b0646[_0x0b8d('0x44')],_0x1b0646['extension']));}}catch(_0x28043d){utils[_0x0b8d('0x14')](util[_0x0b8d('0xf')](_0x0b8d('0x45'),_0x1b0646[_0x0b8d('0x3')]),_0x28043d);}};exports['attendedtransfer']=function(_0x4051c9){try{utils[_0x0b8d('0x17')](util[_0x0b8d('0xf')](_0x0b8d('0x4b'),_0x4051c9[_0x0b8d('0x4c')]),_0x4051c9);if(_0x4051c9[_0x0b8d('0x4c')]==_0x4051c9[_0x0b8d('0x4d')]){if(!_[_0x0b8d('0x16')](queues[_0x4051c9[_0x0b8d('0x4e')]])){utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x4f'),_0x4051c9[_0x0b8d('0x4c')],queues[_0x4051c9['secondtransfererlinkedid']][_0x0b8d('0x1f')],_0x4051c9[_0x0b8d('0x50')]));queues[_0x4051c9[_0x0b8d('0x4e')]][_0x0b8d('0x46')]=!![];queues[_0x4051c9['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x4051c9['secondtransfererlinkedid']][_0x0b8d('0x51')]=_0x4051c9[_0x0b8d('0x50')];queues[_0x4051c9['secondtransfererlinkedid']][_0x0b8d('0x52')]=_0x4051c9[_0x0b8d('0x4c')];queues[_0x4051c9[_0x0b8d('0x4e')]]['queuecallerexitreason']=_0x0b8d('0x53');}if(!_['isNil'](queues[_0x4051c9[_0x0b8d('0x4d')]])){if(_0x4051c9['transfereelinkedid']&&queues[_0x4051c9[_0x0b8d('0x54')]]){queues[_0x4051c9['transfereelinkedid']][_0x0b8d('0x20')]=0x1;queues[_0x4051c9[_0x0b8d('0x44')]]=_[_0x0b8d('0x55')](queues[_0x4051c9[_0x0b8d('0x54')]]);queues[_0x4051c9['transfereeuniqueid']][_0x0b8d('0xe')]=_0x4051c9['transfertargetuniqueid'];queues[_0x4051c9[_0x0b8d('0x44')]][_0x0b8d('0x20')]=0x2;queues[_0x4051c9[_0x0b8d('0x44')]]['calleridnum']=queues[_0x4051c9[_0x0b8d('0x4e')]]['calleridnum'];queues[_0x4051c9['transfereeuniqueid']]['calleridname']=queues[_0x4051c9[_0x0b8d('0x4e')]][_0x0b8d('0x56')];queues[_0x4051c9[_0x0b8d('0x44')]][_0x0b8d('0x37')]=utils[_0x0b8d('0x13')]();queues[_0x4051c9[_0x0b8d('0x44')]][_0x0b8d('0x35')]=utils[_0x0b8d('0x13')]();queues[_0x4051c9[_0x0b8d('0x44')]][_0x0b8d('0x36')]=0x0;queues[_0x4051c9[_0x0b8d('0x44')]][_0x0b8d('0x57')]=0x0;utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x58'),_0x4051c9[_0x0b8d('0x4c')],queues[_0x4051c9[_0x0b8d('0x44')]][_0x0b8d('0x1f')],queues[_0x4051c9[_0x0b8d('0x44')]][_0x0b8d('0x6')],queues[_0x4051c9[_0x0b8d('0x44')]]['calleridname']));}else{utils['info'](util[_0x0b8d('0xf')](_0x0b8d('0x59'),_0x4051c9[_0x0b8d('0x4c')],queues[_0x4051c9['origtransfererlinkedid']][_0x0b8d('0x1f')],_0x4051c9['secondtransfererlinkedid']));queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0xe')]=_0x4051c9[_0x0b8d('0x4e')];}}}else if(_0x4051c9[_0x0b8d('0x5a')]==_0x4051c9[_0x0b8d('0x4e')]){if(!_[_0x0b8d('0x16')](queues[_0x4051c9[_0x0b8d('0x4d')]])){utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x5b'),_0x4051c9[_0x0b8d('0x4c')],queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0x1f')],_0x4051c9['secondtransfereruniqueid'],_0x4051c9[_0x0b8d('0x5c')]));queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0x46')]=!![];queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0x47')]=_0x0b8d('0x5d');queues[_0x4051c9[_0x0b8d('0x4d')]]['transferexten']=_0x4051c9[_0x0b8d('0x5c')];queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0x52')]=_0x4051c9[_0x0b8d('0x5a')];queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0x1c')]=_0x0b8d('0x53');}if(!_[_0x0b8d('0x16')](queues[_0x4051c9[_0x0b8d('0x4e')]])){if(_0x4051c9['transfertargetlinkedid']&&queues[_0x4051c9[_0x0b8d('0x5e')]]){queues[_0x4051c9['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x4051c9['transfertargetuniqueid']]=_[_0x0b8d('0x55')](queues[_0x4051c9[_0x0b8d('0x5e')]]);queues[_0x4051c9[_0x0b8d('0x5f')]][_0x0b8d('0xe')]=_0x4051c9[_0x0b8d('0x5f')];queues[_0x4051c9[_0x0b8d('0x5f')]][_0x0b8d('0x20')]=0x2;queues[_0x4051c9['transfertargetuniqueid']][_0x0b8d('0x6')]=queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0x6')];queues[_0x4051c9[_0x0b8d('0x5f')]][_0x0b8d('0x56')]=queues[_0x4051c9[_0x0b8d('0x4d')]][_0x0b8d('0x56')];queues[_0x4051c9[_0x0b8d('0x5f')]][_0x0b8d('0x37')]=utils['now']();queues[_0x4051c9['transfertargetuniqueid']][_0x0b8d('0x35')]=utils['now']();queues[_0x4051c9['transfertargetuniqueid']][_0x0b8d('0x36')]=0x0;queues[_0x4051c9[_0x0b8d('0x5f')]]['mohtime']=0x0;utils[_0x0b8d('0x1')](util[_0x0b8d('0xf')](_0x0b8d('0x60'),_0x4051c9[_0x0b8d('0x4c')],queues[_0x4051c9[_0x0b8d('0x5f')]][_0x0b8d('0x1f')],queues[_0x4051c9['transfertargetuniqueid']][_0x0b8d('0xe')],queues[_0x4051c9[_0x0b8d('0x5f')]]['calleridnum'],queues[_0x4051c9[_0x0b8d('0x5f')]][_0x0b8d('0x56')]));}else{utils['info'](util[_0x0b8d('0xf')](_0x0b8d('0x59'),_0x4051c9['origtransfereruniqueid'],queues[_0x4051c9[_0x0b8d('0x4e')]]['name'],_0x4051c9['origtransfererlinkedid']));queues[_0x4051c9[_0x0b8d('0x4e')]][_0x0b8d('0xe')]=_0x4051c9['origtransfererlinkedid'];}}}}catch(_0x3bd86b){utils[_0x0b8d('0x14')](util[_0x0b8d('0xf')](_0x0b8d('0x4b'),_0x4051c9[_0x0b8d('0x4c')]),_0x3bd86b);}};exports[_0x0b8d('0x61')]=function(_0x183cf8){try{if(!_[_0x0b8d('0x16')](queues[_0x183cf8[_0x0b8d('0x3')]])){utils[_0x0b8d('0x17')](util['format']('[%s][queues][musiconholdstart]',_0x183cf8[_0x0b8d('0x3')]),_0x183cf8);queues[_0x183cf8['uniqueid']][_0x0b8d('0x62')]=utils[_0x0b8d('0x13')]();utils[_0x0b8d('0x1')](util['format'](_0x0b8d('0x63'),_0x183cf8[_0x0b8d('0x3')],queues[_0x183cf8[_0x0b8d('0x3')]][_0x0b8d('0x1f')],queues[_0x183cf8[_0x0b8d('0x3')]][_0x0b8d('0x62')]));}}catch(_0xd5d8a6){utils[_0x0b8d('0x14')](util['format'](_0x0b8d('0x64'),_0x183cf8[_0x0b8d('0x3')]),_0xd5d8a6);}};exports['musiconholdstop']=function(_0x29e704){try{if(!_[_0x0b8d('0x16')](queues[_0x29e704[_0x0b8d('0x3')]])){if(!_[_0x0b8d('0x16')](queues[_0x29e704[_0x0b8d('0x3')]][_0x0b8d('0x62')])){utils['debug'](util[_0x0b8d('0xf')](_0x0b8d('0x65'),_0x29e704[_0x0b8d('0x3')]),_0x29e704);queues[_0x29e704['uniqueid']][_0x0b8d('0x57')]+=utils[_0x0b8d('0x66')](utils[_0x0b8d('0x13')](),queues[_0x29e704[_0x0b8d('0x3')]][_0x0b8d('0x62')]);utils['info'](util[_0x0b8d('0xf')](_0x0b8d('0x67'),_0x29e704[_0x0b8d('0x3')],queues[_0x29e704[_0x0b8d('0x3')]][_0x0b8d('0x1f')],queues[_0x29e704[_0x0b8d('0x3')]][_0x0b8d('0x57')]));delete queues[_0x29e704[_0x0b8d('0x3')]][_0x0b8d('0x62')];}}}catch(_0x34a132){utils[_0x0b8d('0x14')](util[_0x0b8d('0xf')](_0x0b8d('0x65'),_0x29e704['uniqueid']),_0x34a132);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 03705f2..f2d6811 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 _0x803d=['varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','request','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error'];(function(_0x562dcd,_0x34a73c){var _0x110dab=function(_0x14dbde){while(--_0x14dbde){_0x562dcd['push'](_0x562dcd['shift']());}};_0x110dab(++_0x34a73c);}(_0x803d,0x10e));var _0xd803=function(_0x53e323,_0x3a9748){_0x53e323=_0x53e323-0x0;var _0x48b657=_0x803d[_0x53e323];return _0x48b657;};'use strict';var _=require(_0xd803('0x0'));var util=require(_0xd803('0x1'));var utils=require(_0xd803('0x2'));var transfers=require(_0xd803('0x3'));var recordings={};function writeDB(_0x5495c9){var _0x4d7171;utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x6'),_0x5495c9[_0xd803('0x7')]));if(transfers[_0xd803('0x8')][_0x5495c9[_0xd803('0x7')]]){_0x4d7171=_0x5495c9[_0xd803('0x7')];_0x5495c9[_0xd803('0x7')]=transfers[_0xd803('0x8')][_0x5495c9['uniqueid']][_0xd803('0x9')];}if(_0x5495c9[_0xd803('0xa')]){utils[_0xd803('0xb')](_0x5495c9[_0xd803('0xa')])[_0xd803('0xc')](function(_0x1ef1c7){if(_0x1ef1c7){_0x5495c9['membername']=_0x1ef1c7[_0xd803('0xd')];_0x5495c9[_0xd803('0xe')]=_0x1ef1c7['id'];}utils[_0xd803('0xf')]('CreateVoiceRecording',_0x5495c9);});}else{utils['request']('CreateVoiceRecording',_0x5495c9);}if(_0x4d7171)delete transfers[_0xd803('0x8')][_0x4d7171];}exports['newchannel']=function(_0x1afec9){try{utils['debug'](util[_0xd803('0x5')](_0xd803('0x10'),_0x1afec9[_0xd803('0x7')]),_0x1afec9);if(_0x1afec9[_0xd803('0x7')]==_0x1afec9[_0xd803('0x11')]){utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x12'),_0x1afec9[_0xd803('0x7')],_0x1afec9[_0xd803('0x13')],_0x1afec9[_0xd803('0x14')]));recordings[_0x1afec9['uniqueid']]={'uniqueid':_0x1afec9[_0xd803('0x7')],'accountcode':_0x1afec9[_0xd803('0xa')],'exten':_0x1afec9[_0xd803('0x14')],'context':_0x1afec9[_0xd803('0x13')],'channel':_0x1afec9[_0xd803('0x15')],'monitors':[]};}}catch(_0x2eeafb){utils['error'](util[_0xd803('0x5')](_0xd803('0x10'),_0x1afec9[_0xd803('0x7')]),_0x2eeafb);}};exports['newstate']=function(_0x48d063){try{utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x17'),_0x48d063[_0xd803('0x7')]),_0x48d063);if(!_[_0xd803('0x18')](recordings[_0x48d063[_0xd803('0x7')]])&&_0x48d063[_0xd803('0x19')]==0x6){utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x1a'),_0x48d063[_0xd803('0x7')],_0x48d063[_0xd803('0x13')],_0x48d063[_0xd803('0x15')]));}else if(!_[_0xd803('0x18')](recordings[_0x48d063[_0xd803('0x11')]])&&_0x48d063[_0xd803('0x19')]==0x6&&_0x48d063['context']!=_0xd803('0x1b')){utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x1c'),_0x48d063[_0xd803('0x7')],_0x48d063[_0xd803('0x11')],_0x48d063[_0xd803('0x13')],_0x48d063[_0xd803('0x15')]));recordings[_0x48d063[_0xd803('0x11')]][_0xd803('0xa')]=_0x48d063[_0xd803('0xa')];}}catch(_0x1109be){utils[_0xd803('0x1d')](util[_0xd803('0x5')]('[%s][recordings][newstate]',_0x48d063[_0xd803('0x7')]),_0x1109be);}};exports[_0xd803('0x1e')]=function(_0x584f82){try{if(!_[_0xd803('0x18')](_0x584f82[_0xd803('0x1f')])&&!_[_0xd803('0x18')](_0x584f82[_0xd803('0x1f')][_0xd803('0x20')])){utils['debug'](util[_0xd803('0x5')]('[%s][recordings][varset]',_0x584f82[_0xd803('0x7')]),_0x584f82);utils['info'](util[_0xd803('0x5')](_0xd803('0x21'),_0x584f82[_0xd803('0x7')],_0x584f82[_0xd803('0x1f')],_0x584f82[_0xd803('0x22')]));if(_[_0xd803('0x23')](_0x584f82[_0xd803('0x22')],_0xd803('0x24'))){_0x584f82['value']=_0x584f82[_0xd803('0x22')][_0xd803('0x25')]('.wav49','.WAV');}if(recordings[_0x584f82[_0xd803('0x11')]]){var _0x11f424=_[_0xd803('0x26')](recordings[_0x584f82[_0xd803('0x11')]][_0xd803('0x27')],{'value':_0x584f82[_0xd803('0x22')]});if(_[_0xd803('0x18')](_0x11f424)){recordings[_0x584f82['linkedid']][_0xd803('0x27')][_0xd803('0x28')]({'value':_0x584f82[_0xd803('0x22')]});}}}}catch(_0x4d2ef0){utils['error'](util['format'](_0xd803('0x29'),_0x584f82[_0xd803('0x7')]),_0x4d2ef0);}};exports[_0xd803('0x2a')]=function(_0x4363d2){try{if(!_['isNil'](recordings[_0x4363d2[_0xd803('0x7')]])){utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x2b'),_0x4363d2[_0xd803('0x7')]),_0x4363d2);utils['info'](util['format'](_0xd803('0x2c'),_0x4363d2[_0xd803('0x7')],_0x4363d2[_0xd803('0x2d')],_0x4363d2[_0xd803('0x2e')],_0x4363d2[_0xd803('0x2f')]));recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x2d')]=_0x4363d2[_0xd803('0x2d')];recordings[_0x4363d2['uniqueid']][_0xd803('0x2e')]=_0x4363d2[_0xd803('0x2e')];recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x30')]=_0x4363d2[_0xd803('0x30')];recordings[_0x4363d2['uniqueid']][_0xd803('0x31')]=_0x4363d2[_0xd803('0x31')];if(recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x32')]==_0xd803('0x33')&&recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0xa')]){recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x30')]=recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0xa')];recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x31')]='';}recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x27')]['forEach'](function(_0x38a576){var _0x2692be=_[_0xd803('0x34')](recordings[_0x4363d2[_0xd803('0x7')]]);_0x2692be[_0xd803('0x22')]=_0x38a576[_0xd803('0x22')];writeDB(_0x2692be);});delete recordings[_0x4363d2[_0xd803('0x7')]];}}catch(_0x1f962c){utils[_0xd803('0x1d')](util[_0xd803('0x5')]('[%s][recordings][hangup]',_0x4363d2[_0xd803('0x7')]),_0x1f962c);}};exports[_0xd803('0x35')]=function(_0x3603ca){try{if(!_['isNil'](recordings[_0x3603ca['uniqueid']])){utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x36'),_0x3603ca['uniqueid']),_0x3603ca);utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x37'),_0x3603ca[_0xd803('0x7')],_0x3603ca[_0xd803('0x38')],_0x3603ca['appdata']));if(_0x3603ca[_0xd803('0x38')][_0xd803('0x39')]()==_0xd803('0x3a')&&_[_0xd803('0x3b')](_0x3603ca[_0xd803('0x3c')][_0xd803('0x39')](),_0xd803('0x3d'))){var _0x567571=_0x3603ca[_0xd803('0x3c')][_0xd803('0x3e')]('=');var _0x2ba8b9=_0x567571[0x0][_0xd803('0x3f')](_0x567571[0x0]['lastIndexOf']('(')+0x1,_0x567571[0x0][_0xd803('0x40')](')'));var _0x5353b6=_0x567571[0x1];recordings[_0x3603ca[_0xd803('0x7')]][_0x2ba8b9]=_0x5353b6;}}}catch(_0x2ecf98){utils[_0xd803('0x1d')](util[_0xd803('0x5')](_0xd803('0x36'),_0x3603ca[_0xd803('0x7')]),_0x2ecf98);}};exports[_0xd803('0x41')]=function(_0x44f37d){try{if(!_[_0xd803('0x18')](recordings[_0x44f37d[_0xd803('0x7')]])){utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x42'),_0x44f37d[_0xd803('0x7')]),_0x44f37d);utils[_0xd803('0x4')](util[_0xd803('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x44f37d[_0xd803('0x7')],_0x44f37d[_0xd803('0x43')]));recordings[_0x44f37d[_0xd803('0x7')]][_0xd803('0x43')]=_0x44f37d[_0xd803('0x43')];}}catch(_0x119679){utils[_0xd803('0x1d')](util['format'](_0xd803('0x42'),_0x44f37d[_0xd803('0x7')]),_0x119679);}};exports[_0xd803('0x44')]=function(_0x51546e){try{utils['debug'](util[_0xd803('0x5')](_0xd803('0x45'),_0x51546e[_0xd803('0x7')]),_0x51546e);utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x46'),_0x51546e[_0xd803('0x7')],_0x51546e[_0xd803('0x47')],_0x51546e['transferercalleridname'],_0x51546e[_0xd803('0x48')],_0x51546e[_0xd803('0x49')]));if(recordings[_0x51546e[_0xd803('0x4a')]]&&transfers[_0xd803('0x8')][_0x51546e['transfereruniqueid']]){transfers['blinds'][_0x51546e[_0xd803('0x4a')]]['recording']=!![];}}catch(_0x1fc51b){utils[_0xd803('0x1d')](util[_0xd803('0x5')](_0xd803('0x45'),_0x51546e[_0xd803('0x7')]),_0x1fc51b);}}; \ No newline at end of file +var _0x1cac=['clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','find','monitors','push','hangup','debug','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach'];(function(_0xcfd8e0,_0x379ff5){var _0x3aaab2=function(_0x1ac367){while(--_0x1ac367){_0xcfd8e0['push'](_0xcfd8e0['shift']());}};_0x3aaab2(++_0x379ff5);}(_0x1cac,0x13f));var _0xc1ca=function(_0x1eb6b0,_0x42f6a4){_0x1eb6b0=_0x1eb6b0-0x0;var _0x4c58ef=_0x1cac[_0x1eb6b0];return _0x4c58ef;};'use strict';var _=require(_0xc1ca('0x0'));var util=require('util');var utils=require(_0xc1ca('0x1'));var transfers=require(_0xc1ca('0x2'));var recordings={};function writeDB(_0x321977){var _0x4f1e32;utils[_0xc1ca('0x3')](util[_0xc1ca('0x4')](_0xc1ca('0x5'),_0x321977['uniqueid']));if(transfers[_0xc1ca('0x6')][_0x321977[_0xc1ca('0x7')]]){_0x4f1e32=_0x321977[_0xc1ca('0x7')];_0x321977[_0xc1ca('0x7')]=transfers['blinds'][_0x321977['uniqueid']][_0xc1ca('0x8')];}if(_0x321977[_0xc1ca('0x9')]){utils[_0xc1ca('0xa')](_0x321977[_0xc1ca('0x9')])['then'](function(_0x2f87a5){if(_0x2f87a5){_0x321977['membername']=_0x2f87a5[_0xc1ca('0xb')];_0x321977[_0xc1ca('0xc')]=_0x2f87a5['id'];}utils[_0xc1ca('0xd')](_0xc1ca('0xe'),_0x321977);});}else{utils[_0xc1ca('0xd')](_0xc1ca('0xe'),_0x321977);}if(_0x4f1e32)delete transfers[_0xc1ca('0x6')][_0x4f1e32];}exports[_0xc1ca('0xf')]=function(_0x145c85){try{utils['debug'](util[_0xc1ca('0x4')](_0xc1ca('0x10'),_0x145c85[_0xc1ca('0x7')]),_0x145c85);if(_0x145c85[_0xc1ca('0x7')]==_0x145c85['linkedid']){utils[_0xc1ca('0x3')](util[_0xc1ca('0x4')](_0xc1ca('0x11'),_0x145c85[_0xc1ca('0x7')],_0x145c85[_0xc1ca('0x12')],_0x145c85[_0xc1ca('0x13')]));recordings[_0x145c85[_0xc1ca('0x7')]]={'uniqueid':_0x145c85['uniqueid'],'accountcode':_0x145c85[_0xc1ca('0x9')],'exten':_0x145c85[_0xc1ca('0x13')],'context':_0x145c85[_0xc1ca('0x12')],'channel':_0x145c85[_0xc1ca('0x14')],'monitors':[]};}}catch(_0x1705bb){utils[_0xc1ca('0x15')](util[_0xc1ca('0x4')]('[%s][recordings][newchannel]',_0x145c85[_0xc1ca('0x7')]),_0x1705bb);}};exports['newstate']=function(_0xea02df){try{utils['debug'](util[_0xc1ca('0x4')](_0xc1ca('0x16'),_0xea02df[_0xc1ca('0x7')]),_0xea02df);if(!_[_0xc1ca('0x17')](recordings[_0xea02df[_0xc1ca('0x7')]])&&_0xea02df[_0xc1ca('0x18')]==0x6){utils['info'](util[_0xc1ca('0x4')](_0xc1ca('0x19'),_0xea02df[_0xc1ca('0x7')],_0xea02df['context'],_0xea02df[_0xc1ca('0x14')]));}else if(!_[_0xc1ca('0x17')](recordings[_0xea02df[_0xc1ca('0x1a')]])&&_0xea02df[_0xc1ca('0x18')]==0x6&&_0xea02df['context']!=_0xc1ca('0x1b')){utils[_0xc1ca('0x3')](util[_0xc1ca('0x4')](_0xc1ca('0x1c'),_0xea02df['uniqueid'],_0xea02df[_0xc1ca('0x1a')],_0xea02df[_0xc1ca('0x12')],_0xea02df['channel']));recordings[_0xea02df[_0xc1ca('0x1a')]]['accountcode']=_0xea02df[_0xc1ca('0x9')];}}catch(_0x912860){utils['error'](util['format'](_0xc1ca('0x16'),_0xea02df[_0xc1ca('0x7')]),_0x912860);}};exports[_0xc1ca('0x1d')]=function(_0x229e58){try{if(!_[_0xc1ca('0x17')](_0x229e58[_0xc1ca('0x1e')])&&!_[_0xc1ca('0x17')](_0x229e58['variable'][_0xc1ca('0x1f')])){utils['debug'](util[_0xc1ca('0x4')](_0xc1ca('0x20'),_0x229e58[_0xc1ca('0x7')]),_0x229e58);utils['info'](util[_0xc1ca('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x229e58['uniqueid'],_0x229e58[_0xc1ca('0x1e')],_0x229e58[_0xc1ca('0x21')]));if(_[_0xc1ca('0x22')](_0x229e58['value'],_0xc1ca('0x23'))){_0x229e58[_0xc1ca('0x21')]=_0x229e58[_0xc1ca('0x21')][_0xc1ca('0x24')](_0xc1ca('0x23'),'.WAV');}if(recordings[_0x229e58[_0xc1ca('0x1a')]]){var _0x1e5e5c=_[_0xc1ca('0x25')](recordings[_0x229e58['linkedid']][_0xc1ca('0x26')],{'value':_0x229e58[_0xc1ca('0x21')]});if(_[_0xc1ca('0x17')](_0x1e5e5c)){recordings[_0x229e58[_0xc1ca('0x1a')]][_0xc1ca('0x26')][_0xc1ca('0x27')]({'value':_0x229e58[_0xc1ca('0x21')]});}}}}catch(_0x369d65){utils['error'](util[_0xc1ca('0x4')](_0xc1ca('0x20'),_0x229e58['uniqueid']),_0x369d65);}};exports[_0xc1ca('0x28')]=function(_0x378611){try{if(!_[_0xc1ca('0x17')](recordings[_0x378611[_0xc1ca('0x7')]])){utils[_0xc1ca('0x29')](util[_0xc1ca('0x4')]('[%s][recordings][hangup]',_0x378611[_0xc1ca('0x7')]),_0x378611);utils[_0xc1ca('0x3')](util[_0xc1ca('0x4')](_0xc1ca('0x2a'),_0x378611[_0xc1ca('0x7')],_0x378611[_0xc1ca('0x2b')],_0x378611[_0xc1ca('0x2c')],_0x378611[_0xc1ca('0x2d')]));recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x2b')]=_0x378611[_0xc1ca('0x2b')];recordings[_0x378611['uniqueid']][_0xc1ca('0x2c')]=_0x378611['calleridname'];recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x2e')]=_0x378611[_0xc1ca('0x2e')];recordings[_0x378611['uniqueid']][_0xc1ca('0x2f')]=_0x378611[_0xc1ca('0x2f')];if(recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x30')]==_0xc1ca('0x31')&&recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x9')]){recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x2e')]=recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x9')];recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x2f')]='';}recordings[_0x378611[_0xc1ca('0x7')]][_0xc1ca('0x26')][_0xc1ca('0x32')](function(_0x496573){var _0x10dea1=_[_0xc1ca('0x33')](recordings[_0x378611[_0xc1ca('0x7')]]);_0x10dea1[_0xc1ca('0x21')]=_0x496573[_0xc1ca('0x21')];writeDB(_0x10dea1);});delete recordings[_0x378611[_0xc1ca('0x7')]];}}catch(_0x174245){utils[_0xc1ca('0x15')](util[_0xc1ca('0x4')]('[%s][recordings][hangup]',_0x378611['uniqueid']),_0x174245);}};exports['newexten']=function(_0x644c2b){try{if(!_[_0xc1ca('0x17')](recordings[_0x644c2b[_0xc1ca('0x7')]])){utils[_0xc1ca('0x29')](util[_0xc1ca('0x4')](_0xc1ca('0x34'),_0x644c2b['uniqueid']),_0x644c2b);utils[_0xc1ca('0x3')](util[_0xc1ca('0x4')](_0xc1ca('0x35'),_0x644c2b[_0xc1ca('0x7')],_0x644c2b[_0xc1ca('0x36')],_0x644c2b['appdata']));if(_0x644c2b['application'][_0xc1ca('0x37')]()==_0xc1ca('0x38')&&_[_0xc1ca('0x39')](_0x644c2b['appdata']['toLowerCase'](),_0xc1ca('0x3a'))){var _0x2fee33=_0x644c2b[_0xc1ca('0x3b')]['split']('=');var _0x48f940=_0x2fee33[0x0][_0xc1ca('0x3c')](_0x2fee33[0x0][_0xc1ca('0x3d')]('(')+0x1,_0x2fee33[0x0][_0xc1ca('0x3d')](')'));var _0x5541da=_0x2fee33[0x1];recordings[_0x644c2b[_0xc1ca('0x7')]][_0x48f940]=_0x5541da;}}}catch(_0x4d3622){utils[_0xc1ca('0x15')](util[_0xc1ca('0x4')](_0xc1ca('0x34'),_0x644c2b[_0xc1ca('0x7')]),_0x4d3622);}};exports[_0xc1ca('0x3e')]=function(_0x420380){try{if(!_['isNil'](recordings[_0x420380[_0xc1ca('0x7')]])){utils[_0xc1ca('0x29')](util[_0xc1ca('0x4')](_0xc1ca('0x3f'),_0x420380[_0xc1ca('0x7')]),_0x420380);utils['info'](util['format'](_0xc1ca('0x40'),_0x420380['uniqueid'],_0x420380[_0xc1ca('0x41')]));recordings[_0x420380[_0xc1ca('0x7')]][_0xc1ca('0x41')]=_0x420380[_0xc1ca('0x41')];}}catch(_0x362c9c){utils[_0xc1ca('0x15')](util[_0xc1ca('0x4')](_0xc1ca('0x3f'),_0x420380[_0xc1ca('0x7')]),_0x362c9c);}};exports[_0xc1ca('0x42')]=function(_0x5c1b11){try{utils[_0xc1ca('0x29')](util['format'](_0xc1ca('0x43'),_0x5c1b11[_0xc1ca('0x7')]),_0x5c1b11);utils[_0xc1ca('0x3')](util[_0xc1ca('0x4')](_0xc1ca('0x44'),_0x5c1b11[_0xc1ca('0x7')],_0x5c1b11[_0xc1ca('0x45')],_0x5c1b11['transferercalleridname'],_0x5c1b11[_0xc1ca('0x46')],_0x5c1b11[_0xc1ca('0x47')]));if(recordings[_0x5c1b11['transfereruniqueid']]&&transfers[_0xc1ca('0x6')][_0x5c1b11[_0xc1ca('0x48')]]){transfers[_0xc1ca('0x6')][_0x5c1b11['transfereruniqueid']][_0xc1ca('0x49')]=!![];}}catch(_0x1d22f6){utils[_0xc1ca('0x15')](util[_0xc1ca('0x4')]('[%s][recordings][blindtransfer]',_0x5c1b11[_0xc1ca('0x7')]),_0x1d22f6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a039cc2..152bb21 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 _0x1924=['debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blinds','error','attendedtransfer','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','[%s][transfers][attendedtransfer]','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer'];(function(_0x476e65,_0x46d610){var _0x412269=function(_0x13ac56){while(--_0x13ac56){_0x476e65['push'](_0x476e65['shift']());}};_0x412269(++_0x46d610);}(_0x1924,0x17b));var _0x4192=function(_0x48304d,_0x27d4a8){_0x48304d=_0x48304d-0x0;var _0x48660f=_0x1924[_0x48304d];return _0x48660f;};'use strict';var _=require(_0x4192('0x0'));var util=require(_0x4192('0x1'));var utils=require(_0x4192('0x2'));function writeDB(_0x3a4e67){utils['info'](util[_0x4192('0x3')](_0x4192('0x4'),_0x3a4e67[_0x4192('0x5')]==='attended'?_0x3a4e67[_0x4192('0x6')]:_0x3a4e67[_0x4192('0x7')],_0x3a4e67[_0x4192('0x5')]));utils[_0x4192('0x8')](_0x4192('0x9'),_0x3a4e67);}exports['blinds']={};exports[_0x4192('0xa')]=function(_0x5f3431){try{utils[_0x4192('0xb')](util[_0x4192('0x3')](_0x4192('0xc'),_0x5f3431[_0x4192('0x7')]),_0x5f3431);utils['info'](util['format'](_0x4192('0xd'),_0x5f3431['uniqueid'],_0x5f3431[_0x4192('0xe')],_0x5f3431[_0x4192('0xf')],_0x5f3431[_0x4192('0x10')],_0x5f3431['transfereecalleridname']));_0x5f3431[_0x4192('0x5')]='blind';exports[_0x4192('0x11')][_0x5f3431['transfereruniqueid']]=_0x5f3431;writeDB(_0x5f3431);}catch(_0x2c0f8a){utils[_0x4192('0x12')](util[_0x4192('0x3')]('[%s][transfers][blindtransfer]',_0x5f3431[_0x4192('0x7')]),_0x2c0f8a);}};exports[_0x4192('0x13')]=function(_0x39ab28){try{utils[_0x4192('0xb')](util['format']('[%s][transfers][attendedtransfer]',_0x39ab28[_0x4192('0x6')]),_0x39ab28);utils[_0x4192('0x14')](util['format'](_0x4192('0x15'),_0x39ab28[_0x4192('0x6')],_0x39ab28['origtransferercalleridnum'],_0x39ab28[_0x4192('0x16')],_0x39ab28[_0x4192('0x17')],_0x39ab28[_0x4192('0x18')]));_0x39ab28=_['assign'](_0x39ab28,{'transfererchannel':_0x39ab28['origtransfererchannel'],'transferercalleridnum':_0x39ab28[_0x4192('0x19')],'transferercalleridname':_0x39ab28[_0x4192('0x16')],'transfererconnectedlinenum':_0x39ab28[_0x4192('0x1a')],'transfererconnectedlinename':_0x39ab28['secondtransfererconnectedlinename'],'transfereraccountcode':_0x39ab28[_0x4192('0x1b')],'transferercontext':_0x39ab28['secondtransferercontext'],'transfererexten':_0x39ab28[_0x4192('0x1c')],'transfererlinkedid':_0x39ab28[_0x4192('0x1d')],'context':_0x39ab28[_0x4192('0x1e')],'extension':_0x39ab28[_0x4192('0x1f')],'type':_0x4192('0x20')});if(_[_0x4192('0x21')](_0x39ab28['transfereechannel'])){_0x39ab28=_['assign'](_0x39ab28,{'transfereechannel':_0x39ab28[_0x4192('0x22')],'transfereecalleridnum':_0x39ab28[_0x4192('0x17')],'transfereecalleridname':_0x39ab28['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x39ab28[_0x4192('0x23')],'transfereeconnectedlinename':_0x39ab28['transfertargetconnectedlinename'],'transfereeaccountcode':_0x39ab28[_0x4192('0x24')],'transfereecontext':_0x39ab28['transfertargetcontext'],'transfereeexten':_0x39ab28[_0x4192('0x25')],'transfereelinkedid':_0x39ab28['transfertargetlinkedid']});}writeDB(_0x39ab28);}catch(_0xc5e7a5){utils[_0x4192('0x12')](util[_0x4192('0x3')](_0x4192('0x26'),_0x39ab28[_0x4192('0x6')]),_0xc5e7a5);}}; \ No newline at end of file +var _0x0d71=['error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid'];(function(_0x12e658,_0x168c2b){var _0x29cd00=function(_0x1ba304){while(--_0x1ba304){_0x12e658['push'](_0x12e658['shift']());}};_0x29cd00(++_0x168c2b);}(_0x0d71,0xce));var _0x10d7=function(_0x170c01,_0x34fbe8){_0x170c01=_0x170c01-0x0;var _0xfe8db3=_0x0d71[_0x170c01];return _0xfe8db3;};'use strict';var _=require('lodash');var util=require(_0x10d7('0x0'));var utils=require(_0x10d7('0x1'));function writeDB(_0x1feaef){utils[_0x10d7('0x2')](util[_0x10d7('0x3')](_0x10d7('0x4'),_0x1feaef[_0x10d7('0x5')]==='attended'?_0x1feaef[_0x10d7('0x6')]:_0x1feaef[_0x10d7('0x7')],_0x1feaef[_0x10d7('0x5')]));utils[_0x10d7('0x8')](_0x10d7('0x9'),_0x1feaef);}exports[_0x10d7('0xa')]={};exports[_0x10d7('0xb')]=function(_0x6c7f7){try{utils[_0x10d7('0xc')](util[_0x10d7('0x3')]('[%s][transfers][blindtransfer]',_0x6c7f7['uniqueid']),_0x6c7f7);utils[_0x10d7('0x2')](util[_0x10d7('0x3')](_0x10d7('0xd'),_0x6c7f7['uniqueid'],_0x6c7f7[_0x10d7('0xe')],_0x6c7f7['transferercalleridname'],_0x6c7f7[_0x10d7('0xf')],_0x6c7f7[_0x10d7('0x10')]));_0x6c7f7['type']=_0x10d7('0x11');exports[_0x10d7('0xa')][_0x6c7f7[_0x10d7('0x12')]]=_0x6c7f7;writeDB(_0x6c7f7);}catch(_0x35f759){utils[_0x10d7('0x13')](util[_0x10d7('0x3')]('[%s][transfers][blindtransfer]',_0x6c7f7['uniqueid']),_0x35f759);}};exports[_0x10d7('0x14')]=function(_0x49d37d){try{utils[_0x10d7('0xc')](util[_0x10d7('0x3')](_0x10d7('0x15'),_0x49d37d[_0x10d7('0x6')]),_0x49d37d);utils[_0x10d7('0x2')](util[_0x10d7('0x3')](_0x10d7('0x16'),_0x49d37d[_0x10d7('0x6')],_0x49d37d[_0x10d7('0x17')],_0x49d37d[_0x10d7('0x18')],_0x49d37d['transfertargetcalleridnum'],_0x49d37d[_0x10d7('0x19')]));_0x49d37d=_[_0x10d7('0x1a')](_0x49d37d,{'transfererchannel':_0x49d37d[_0x10d7('0x1b')],'transferercalleridnum':_0x49d37d[_0x10d7('0x17')],'transferercalleridname':_0x49d37d[_0x10d7('0x18')],'transfererconnectedlinenum':_0x49d37d[_0x10d7('0x1c')],'transfererconnectedlinename':_0x49d37d[_0x10d7('0x1d')],'transfereraccountcode':_0x49d37d[_0x10d7('0x1e')],'transferercontext':_0x49d37d[_0x10d7('0x1f')],'transfererexten':_0x49d37d[_0x10d7('0x20')],'transfererlinkedid':_0x49d37d[_0x10d7('0x21')],'context':_0x49d37d[_0x10d7('0x22')],'extension':_0x49d37d[_0x10d7('0x23')],'type':_0x10d7('0x24')});if(_[_0x10d7('0x25')](_0x49d37d[_0x10d7('0x26')])){_0x49d37d=_[_0x10d7('0x1a')](_0x49d37d,{'transfereechannel':_0x49d37d[_0x10d7('0x27')],'transfereecalleridnum':_0x49d37d[_0x10d7('0x28')],'transfereecalleridname':_0x49d37d[_0x10d7('0x19')],'transfereeconnectedlinenum':_0x49d37d[_0x10d7('0x29')],'transfereeconnectedlinename':_0x49d37d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x49d37d[_0x10d7('0x2a')],'transfereecontext':_0x49d37d['transfertargetcontext'],'transfereeexten':_0x49d37d[_0x10d7('0x2b')],'transfereelinkedid':_0x49d37d[_0x10d7('0x2c')]});}writeDB(_0x49d37d);}catch(_0x1bd35f){utils[_0x10d7('0x13')](util[_0x10d7('0x3')](_0x10d7('0x15'),_0x49d37d[_0x10d7('0x6')]),_0x1bd35f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a0bd330..e051ffc 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 _0x8e34=['acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','now','isAfter','isBefore','bluebird','moment','client','http','../../config/logger','info','inspect','debug','error','request','then','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw'];(function(_0x3187ec,_0x3abc3b){var _0x44ccb5=function(_0x425b60){while(--_0x425b60){_0x3187ec['push'](_0x3187ec['shift']());}};_0x44ccb5(++_0x3abc3b);}(_0x8e34,0x1bf));var _0x48e3=function(_0x3110f6,_0x30de52){_0x3110f6=_0x3110f6-0x0;var _0x5ecdb0=_0x8e34[_0x3110f6];return _0x5ecdb0;};'use strict';var BPromise=require(_0x48e3('0x0'));var jayson=require('jayson/promise');var moment=require(_0x48e3('0x1'));var util=require('util');var client=jayson[_0x48e3('0x2')][_0x48e3('0x3')]({'port':0x2329});var logger=require(_0x48e3('0x4'))('xdr');exports[_0x48e3('0x5')]=function(_0x55fdc9,_0x4c7548){logger[_0x48e3('0x5')](_0x55fdc9,_0x4c7548?util[_0x48e3('0x6')](_0x4c7548,{'showHidden':![],'depth':null}):'');};exports[_0x48e3('0x7')]=function(_0x2e57b8,_0x30d3bd){logger['debug'](_0x2e57b8,_0x30d3bd?util[_0x48e3('0x6')](_0x30d3bd,{'showHidden':![],'depth':null}):'');};exports[_0x48e3('0x8')]=function(_0x5078fb,_0x243b19){logger['error'](_0x5078fb,_0x243b19?util['inspect'](_0x243b19,{'showHidden':![],'depth':null}):'');};exports[_0x48e3('0x9')]=function(_0x36a5fd,_0x17b2b0){return client[_0x48e3('0x9')](_0x36a5fd,{'body':_0x17b2b0})[_0x48e3('0xa')](function(_0x2d0717){logger[_0x48e3('0x7')]('[utils][request]\x20name:%s',_0x36a5fd,_0x2d0717?util[_0x48e3('0x6')](_0x2d0717,{'showHidden':![],'depth':null}):'');})[_0x48e3('0xb')](function(_0x5c899c){logger[_0x48e3('0x8')]('[utils][request]\x20name:%s',_0x36a5fd,_0x5c899c?util[_0x48e3('0x6')](_0x5c899c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2e9cac){return client[_0x48e3('0x9')](_0x48e3('0xc'),{'options':{'raw':!![],'attributes':['id',_0x48e3('0xd'),_0x48e3('0xe'),'interface'],'where':_0x2e9cac,'limit':0x1}})[_0x48e3('0xa')](function(_0x4214c9){logger[_0x48e3('0x7')](_0x48e3('0xf'),JSON[_0x48e3('0x10')](_0x2e9cac),_0x4214c9?util[_0x48e3('0x6')](_0x4214c9,{'showHidden':![],'depth':null}):'');return _0x4214c9[_0x48e3('0x11')][_0x48e3('0x12')]?_0x4214c9['result'][0x0]:null;});}exports[_0x48e3('0x13')]=function(_0x245238){return new BPromise(function(_0x592cb4,_0x366426){if(_0x245238){return getUser({'internal':_0x245238})[_0x48e3('0xa')](function(_0x201d8c){logger[_0x48e3('0x5')](_0x48e3('0x14'),_0x245238,_0x201d8c?_0x48e3('0x15'):_0x48e3('0x16'));return _0x592cb4(_0x201d8c);})[_0x48e3('0xb')](function(_0x368efd){logger[_0x48e3('0x8')](_0x48e3('0x17'),_0x368efd?util[_0x48e3('0x6')](_0x368efd,{'showHidden':![],'depth':null}):'');return _0x592cb4(null);});}return _0x592cb4(null);});};exports[_0x48e3('0x18')]=function(_0x158d32){return new BPromise(function(_0x18caa3,_0x28b583){if(_0x158d32){return getUser({'interface':_0x158d32})['then'](function(_0x894072){logger[_0x48e3('0x5')](_0x48e3('0x19'),_0x158d32,_0x894072?_0x48e3('0x15'):'notfound');return _0x18caa3(_0x894072);})['catch'](function(_0x366dcb){logger[_0x48e3('0x8')](_0x48e3('0x1a'),_0x366dcb?util[_0x48e3('0x6')](_0x366dcb,{'showHidden':![],'depth':null}):'');return _0x18caa3(null);});}return _0x18caa3(null);});};exports[_0x48e3('0x1b')]=function(_0x47595e){return new BPromise(function(_0x3a341f,_0x4001c3){if(_0x47595e){return getUser({'name':_0x47595e})[_0x48e3('0xa')](function(_0x4167b7){logger[_0x48e3('0x5')](_0x48e3('0x1c'),_0x47595e,_0x4167b7?_0x48e3('0x15'):_0x48e3('0x16'));return _0x3a341f(_0x4167b7);})['catch'](function(_0x43fae8){logger[_0x48e3('0x8')]('[utils][getUserByName]',_0x43fae8?util[_0x48e3('0x6')](_0x43fae8,{'showHidden':![],'depth':null}):'');return _0x3a341f(null);});}return _0x3a341f(null);});};exports[_0x48e3('0x1d')]=function(_0x3fa2c9){return new BPromise(function(_0xffdf2c,_0x1aac2c){if(_0x3fa2c9){return client[_0x48e3('0x9')](_0x48e3('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x48e3('0xe'),_0x48e3('0x1f'),_0x48e3('0x20'),_0x48e3('0x21')],'where':{'name':_0x3fa2c9},'limit':0x1}})[_0x48e3('0xa')](function(_0x306338){logger[_0x48e3('0x7')](_0x48e3('0x22'),_0x3fa2c9,_0x306338?util[_0x48e3('0x6')](_0x306338,{'showHidden':![],'depth':null}):'');logger[_0x48e3('0x5')](_0x48e3('0x23'),_0x3fa2c9,_0x306338?'found':_0x48e3('0x16'));return _0xffdf2c(_0x306338[_0x48e3('0x11')][_0x48e3('0x12')]?_0x306338[_0x48e3('0x11')][0x0]:null);})[_0x48e3('0xb')](function(_0x3697ca){logger[_0x48e3('0x8')](_0x48e3('0x24'),_0x3697ca?util[_0x48e3('0x6')](_0x3697ca,{'showHidden':![],'depth':null}):'');return _0xffdf2c(null);});}return _0xffdf2c(null);});};exports[_0x48e3('0x25')]=function(_0x3281c6,_0x42301a){return moment(_0x3281c6)[_0x48e3('0x26')](_0x42301a,_0x48e3('0x27'))[_0x48e3('0x28')](_0x48e3('0x29'));};exports[_0x48e3('0x2a')]=function(_0x321b48,_0x14a838){return moment(_0x321b48)[_0x48e3('0x2b')](_0x14a838,_0x48e3('0x27'))[_0x48e3('0x28')](_0x48e3('0x29'));};exports['diffTime']=function(_0x54c836,_0x40d7b5){return moment(_0x54c836)[_0x48e3('0x2c')](moment(_0x40d7b5),_0x48e3('0x27'));};exports['sumTime']=function(_0x23c8e7,_0x437497){return parseInt(_0x23c8e7,0xa)+parseInt(_0x437497,0xa);};exports[_0x48e3('0x2d')]=function(){return moment()[_0x48e3('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x48e3('0x2e')]=function(_0x5d05e9,_0x1f3e73){if(_0x1f3e73){return moment(_0x5d05e9)[_0x48e3('0x2e')](_0x1f3e73);}return!![];};exports[_0x48e3('0x2f')]=function(_0x1b3494,_0x2c955b){if(_0x2c955b){return moment(_0x1b3494)[_0x48e3('0x2f')](_0x2c955b);}else if(_0x1b3494){return!![];}return![];}; \ No newline at end of file +var _0xeb0f=['GetUser','internal','name','interface','[utils][getUser]\x20where:%s','length','result','getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','info','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','sumTime','now','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','inspect','debug','error','request','[utils][request]\x20name:%s','catch'];(function(_0x294a77,_0x8a359d){var _0x17db6d=function(_0x4e121d){while(--_0x4e121d){_0x294a77['push'](_0x294a77['shift']());}};_0x17db6d(++_0x8a359d);}(_0xeb0f,0x176));var _0xfeb0=function(_0x1663f4,_0x4e0ae3){_0x1663f4=_0x1663f4-0x0;var _0x31ce27=_0xeb0f[_0x1663f4];return _0x31ce27;};'use strict';var BPromise=require(_0xfeb0('0x0'));var jayson=require('jayson/promise');var moment=require(_0xfeb0('0x1'));var util=require(_0xfeb0('0x2'));var client=jayson[_0xfeb0('0x3')][_0xfeb0('0x4')]({'port':0x2329});var logger=require(_0xfeb0('0x5'))(_0xfeb0('0x6'));exports['info']=function(_0x666a5e,_0x558b57){logger['info'](_0x666a5e,_0x558b57?util[_0xfeb0('0x7')](_0x558b57,{'showHidden':![],'depth':null}):'');};exports[_0xfeb0('0x8')]=function(_0x3ec46d,_0x3ec5f2){logger[_0xfeb0('0x8')](_0x3ec46d,_0x3ec5f2?util[_0xfeb0('0x7')](_0x3ec5f2,{'showHidden':![],'depth':null}):'');};exports[_0xfeb0('0x9')]=function(_0x603187,_0x24109b){logger[_0xfeb0('0x9')](_0x603187,_0x24109b?util[_0xfeb0('0x7')](_0x24109b,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5b6cdd,_0x38b16b){return client[_0xfeb0('0xa')](_0x5b6cdd,{'body':_0x38b16b})['then'](function(_0x5e2404){logger[_0xfeb0('0x8')](_0xfeb0('0xb'),_0x5b6cdd,_0x5e2404?util[_0xfeb0('0x7')](_0x5e2404,{'showHidden':![],'depth':null}):'');})[_0xfeb0('0xc')](function(_0x1230e3){logger['error'](_0xfeb0('0xb'),_0x5b6cdd,_0x1230e3?util[_0xfeb0('0x7')](_0x1230e3,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2af8b6){return client[_0xfeb0('0xa')](_0xfeb0('0xd'),{'options':{'raw':!![],'attributes':['id',_0xfeb0('0xe'),_0xfeb0('0xf'),_0xfeb0('0x10')],'where':_0x2af8b6,'limit':0x1}})['then'](function(_0x1c8374){logger[_0xfeb0('0x8')](_0xfeb0('0x11'),JSON['stringify'](_0x2af8b6),_0x1c8374?util['inspect'](_0x1c8374,{'showHidden':![],'depth':null}):'');return _0x1c8374['result'][_0xfeb0('0x12')]?_0x1c8374[_0xfeb0('0x13')][0x0]:null;});}exports[_0xfeb0('0x14')]=function(_0xf8f560){return new BPromise(function(_0x3332ea,_0x82a86e){if(_0xf8f560){return getUser({'internal':_0xf8f560})[_0xfeb0('0x15')](function(_0x2695ab){logger['info'](_0xfeb0('0x16'),_0xf8f560,_0x2695ab?_0xfeb0('0x17'):'notfound');return _0x3332ea(_0x2695ab);})[_0xfeb0('0xc')](function(_0x1d22bb){logger[_0xfeb0('0x9')]('[utils][getUserByInternal]',_0x1d22bb?util[_0xfeb0('0x7')](_0x1d22bb,{'showHidden':![],'depth':null}):'');return _0x3332ea(null);});}return _0x3332ea(null);});};exports['getUserByInterface']=function(_0x141cc0){return new BPromise(function(_0x43f155,_0x82252d){if(_0x141cc0){return getUser({'interface':_0x141cc0})[_0xfeb0('0x15')](function(_0x5aa08f){logger['info'](_0xfeb0('0x18'),_0x141cc0,_0x5aa08f?'found':_0xfeb0('0x19'));return _0x43f155(_0x5aa08f);})[_0xfeb0('0xc')](function(_0x3d05a2){logger[_0xfeb0('0x9')]('[utils][getUserByInterface]',_0x3d05a2?util[_0xfeb0('0x7')](_0x3d05a2,{'showHidden':![],'depth':null}):'');return _0x43f155(null);});}return _0x43f155(null);});};exports[_0xfeb0('0x1a')]=function(_0x4f2cb0){return new BPromise(function(_0x73119e,_0x2a7521){if(_0x4f2cb0){return getUser({'name':_0x4f2cb0})[_0xfeb0('0x15')](function(_0x388c62){logger[_0xfeb0('0x1b')](_0xfeb0('0x1c'),_0x4f2cb0,_0x388c62?_0xfeb0('0x17'):_0xfeb0('0x19'));return _0x73119e(_0x388c62);})[_0xfeb0('0xc')](function(_0x547d4c){logger[_0xfeb0('0x9')](_0xfeb0('0x1d'),_0x547d4c?util['inspect'](_0x547d4c,{'showHidden':![],'depth':null}):'');return _0x73119e(null);});}return _0x73119e(null);});};exports[_0xfeb0('0x1e')]=function(_0x2f875c){return new BPromise(function(_0x2a2b52,_0x14eed2){if(_0x2f875c){return client[_0xfeb0('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xfeb0('0xf'),'type','acw','acwTimeout'],'where':{'name':_0x2f875c},'limit':0x1}})[_0xfeb0('0x15')](function(_0x40cd34){logger[_0xfeb0('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x2f875c,_0x40cd34?util[_0xfeb0('0x7')](_0x40cd34,{'showHidden':![],'depth':null}):'');logger[_0xfeb0('0x1b')](_0xfeb0('0x1f'),_0x2f875c,_0x40cd34?_0xfeb0('0x17'):_0xfeb0('0x19'));return _0x2a2b52(_0x40cd34[_0xfeb0('0x13')]['length']?_0x40cd34['result'][0x0]:null);})[_0xfeb0('0xc')](function(_0x5d188e){logger[_0xfeb0('0x9')](_0xfeb0('0x20'),_0x5d188e?util[_0xfeb0('0x7')](_0x5d188e,{'showHidden':![],'depth':null}):'');return _0x2a2b52(null);});}return _0x2a2b52(null);});};exports[_0xfeb0('0x21')]=function(_0x45d664,_0x45ba50){return moment(_0x45d664)[_0xfeb0('0x22')](_0x45ba50,_0xfeb0('0x23'))[_0xfeb0('0x24')](_0xfeb0('0x25'));};exports[_0xfeb0('0x26')]=function(_0x2cb4fb,_0x28d4a6){return moment(_0x2cb4fb)[_0xfeb0('0x27')](_0x28d4a6,_0xfeb0('0x23'))[_0xfeb0('0x24')](_0xfeb0('0x25'));};exports['diffTime']=function(_0x20b206,_0x33fe82){return moment(_0x20b206)['diff'](moment(_0x33fe82),_0xfeb0('0x23'));};exports[_0xfeb0('0x28')]=function(_0x369a15,_0x2f7922){return parseInt(_0x369a15,0xa)+parseInt(_0x2f7922,0xa);};exports[_0xfeb0('0x29')]=function(){return moment()['format'](_0xfeb0('0x25'));};exports['isAfter']=function(_0x52c48d,_0x348c2c){if(_0x348c2c){return moment(_0x52c48d)['isAfter'](_0x348c2c);}return!![];};exports[_0xfeb0('0x2a')]=function(_0x58a729,_0x2888f2){if(_0x2888f2){return moment(_0x58a729)[_0xfeb0('0x2a')](_0x2888f2);}else if(_0x58a729){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 4c315c6..bcf1aac 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 _0xe3ea=['join','/var','log','xcally','client','role','name','ensureDir','catch','user','then','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','x-forwarded-for','headers','connection','remoteAddress','url','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','statusCode','device','other','agent_id','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData'];(function(_0x4a6102,_0xedf422){var _0x416650=function(_0x4be9ec){while(--_0x4be9ec){_0x4a6102['push'](_0x4a6102['shift']());}};_0x416650(++_0xedf422);}(_0xe3ea,0x1cd));var _0xae3e=function(_0x556cc0,_0x286631){_0x556cc0=_0x556cc0-0x0;var _0x465ff5=_0xe3ea[_0x556cc0];return _0x465ff5;};var fs=require(_0xae3e('0x0'));var _=require(_0xae3e('0x1'));var ewinston=require(_0xae3e('0x2'));var path=require(_0xae3e('0x3'));var util=require('util');var fileLogger=require(_0xae3e('0x4'))[_0xae3e('0x5')];var safeTemplate=require(_0xae3e('0x6'))[_0xae3e('0x7')];var maskSensitiveData=require('./mask-sensitive-data')[_0xae3e('0x8')];function ClientSideLogger(){function _0xa6e659(_0x27dca6){var _0x41aecd=path[_0xae3e('0x9')](_0xae3e('0xa'),_0xae3e('0xb'),_0xae3e('0xc'));var _0xf2e452=path['join'](_0xae3e('0xd'),_0x27dca6[_0xae3e('0xe')]+'-'+_0x27dca6[_0xae3e('0xf')]);return fs[_0xae3e('0x10')](path[_0xae3e('0x9')](_0x41aecd,_0xf2e452))['then'](function(){var _0x524aa7=fileLogger(_0xae3e('0xd'),path['join'](_0x41aecd,_0xf2e452));return _0x524aa7;})[_0xae3e('0x11')](function(_0x544762){throw _0x544762;});}this[_0xae3e('0xb')]=function(_0x147aa7,_0x5103f8,_0x1bb097,_0x22162e){return _0xa6e659(_0x147aa7[_0xae3e('0x12')])[_0xae3e('0x13')](function(_0x53a010){var _0x30e5e9=_0x53a010[_0x5103f8];return _0x30e5e9;})[_0xae3e('0x13')](function(_0x30ffa2){var _0x5af6b8=_0x147aa7[_0xae3e('0x12')]?_0x147aa7[_0xae3e('0x12')]['id']:'no-user';var _0x1d1c57=_0x22162e[_0xae3e('0x14')];var _0x39cfc7=_0x22162e[_0xae3e('0x15')];var _0x4275e5=new Date(Number(_0x39cfc7));return _0x30ffa2(_0x5af6b8,_0x4275e5,_0x1bb097,_0x1d1c57);})[_0xae3e('0x11')](function(_0x49f8ae){fileLogger(_0xae3e('0xd'))[_0xae3e('0x16')](_0x49f8ae);});};}function setupLoggers(_0x3b6ad5){return new Promise(function(_0x28c980){var _0x5cd708=new ClientSideLogger();var _0x27935d=fileLogger(_0xae3e('0x17'));var _0x181fa6=fileLogger(_0xae3e('0x18'));_0x3b6ad5[_0xae3e('0x19')](_0xae3e('0x1a'),_0x5cd708);_0x3b6ad5[_0xae3e('0x1b')](ewinston['logger']({'winstonInstance':_0x27935d,'meta':![],'statusLevels':!![],'msg':function(_0x266ebf,_0x1f1cca){var _0x63d8ed=_0xae3e('0x1c');if(!_[_0xae3e('0x1d')](_0x266ebf[_0xae3e('0x1e')])){_0x63d8ed+='\x20body=%s';var _0x4c1103=_0x266ebf[_0xae3e('0x1e')];maskSensitiveData(_0x4c1103);}return safeTemplate(util[_0xae3e('0x1f')](_0x63d8ed,_0x266ebf['method'],_0x266ebf['headers'][_0xae3e('0x20')]?_0x266ebf[_0xae3e('0x21')][_0xae3e('0x20')]:_0x266ebf[_0xae3e('0x22')][_0xae3e('0x23')]||_0x266ebf['ip'],_0x266ebf[_0xae3e('0x24')],_0x1f1cca['statusCode'],_0x1f1cca['responseTime'],_0x266ebf[_0xae3e('0x12')]?_0x266ebf[_0xae3e('0x12')]['id']:null,_0x266ebf[_0xae3e('0x12')]?_0x266ebf[_0xae3e('0x12')][_0xae3e('0xf')]:null,_0x266ebf[_0xae3e('0x12')]?_0x266ebf['user']['role']:null,_0x4c1103?util[_0xae3e('0x25')](_0x4c1103,![],null):''));}}));_0x3b6ad5['use'](ewinston[_0xae3e('0x26')]({'winstonInstance':_0x181fa6,'meta':![],'statusLevels':!![],'msg':function(_0x433112,_0x10a7f0){var _0x1aad26='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')]['device']&&_0x433112[_0xae3e('0x1e')]['agent_id']){_0x1aad26=_0xae3e('0x27');}return util[_0xae3e('0x1f')](_0x1aad26,_0x433112[_0xae3e('0x28')],_0x433112[_0xae3e('0x21')][_0xae3e('0x20')]?_0x433112['headers'][_0xae3e('0x20')]:_0x433112[_0xae3e('0x22')][_0xae3e('0x23')]||_0x433112['ip'],_0x433112['url'],_0x10a7f0[_0xae3e('0x29')],_0x10a7f0['responseTime'],_0x433112[_0xae3e('0x12')]?_0x433112[_0xae3e('0x12')]['id']:null,_0x433112[_0xae3e('0x12')]?_0x433112['user'][_0xae3e('0xf')]:null,_0x433112[_0xae3e('0x12')]?_0x433112[_0xae3e('0x12')][_0xae3e('0xe')]:null,_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')][_0xae3e('0x2a')]?_0x433112[_0xae3e('0x1e')][_0xae3e('0x2a')]:_0xae3e('0x2b'),_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')][_0xae3e('0x2c')]?_0x433112[_0xae3e('0x1e')][_0xae3e('0x2c')]:'',_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')]['agent_name']?_0x433112[_0xae3e('0x1e')][_0xae3e('0x2d')]:'');},'ignoreRoute':function(_0x43b048){var _0x3896a1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3896a1['test'](_0x43b048['url']);}}));return _0x28c980();});}exports[_0xae3e('0x2e')]=setupLoggers; \ No newline at end of file +var _0x7e49=['role','ensureDir','catch','user','then','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','name','device','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','path','fileLogger','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client'];(function(_0x41c255,_0x186b1d){var _0xa03c4b=function(_0x59c2f5){while(--_0x59c2f5){_0x41c255['push'](_0x41c255['shift']());}};_0xa03c4b(++_0x186b1d);}(_0x7e49,0x137));var _0x97e4=function(_0x27b859,_0x540b7f){_0x27b859=_0x27b859-0x0;var _0x309e69=_0x7e49[_0x27b859];return _0x309e69;};var fs=require(_0x97e4('0x0'));var _=require(_0x97e4('0x1'));var ewinston=require('express-winston');var path=require(_0x97e4('0x2'));var util=require('util');var fileLogger=require('./loggers')[_0x97e4('0x3')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x97e4('0x4'))[_0x97e4('0x5')];function ClientSideLogger(){function _0x2c33b9(_0x1c88b2){var _0x2911d8=path['join'](_0x97e4('0x6'),_0x97e4('0x7'),_0x97e4('0x8'));var _0x11d0e4=path[_0x97e4('0x9')](_0x97e4('0xa'),_0x1c88b2[_0x97e4('0xb')]+'-'+_0x1c88b2['name']);return fs[_0x97e4('0xc')](path[_0x97e4('0x9')](_0x2911d8,_0x11d0e4))['then'](function(){var _0x4852df=fileLogger(_0x97e4('0xa'),path[_0x97e4('0x9')](_0x2911d8,_0x11d0e4));return _0x4852df;})[_0x97e4('0xd')](function(_0x3ab4a5){throw _0x3ab4a5;});}this[_0x97e4('0x7')]=function(_0xba813c,_0x47f7af,_0x394a00,_0x5efc4c){return _0x2c33b9(_0xba813c[_0x97e4('0xe')])[_0x97e4('0xf')](function(_0x35515e){var _0x22c338=_0x35515e[_0x47f7af];return _0x22c338;})[_0x97e4('0xf')](function(_0x460989){var _0x40d61b=_0xba813c[_0x97e4('0xe')]?_0xba813c[_0x97e4('0xe')]['id']:_0x97e4('0x10');var _0x43c8ed=_0x5efc4c[_0x97e4('0x11')];var _0x569c60=_0x5efc4c[_0x97e4('0x12')];var _0x24081e=new Date(Number(_0x569c60));return _0x460989(_0x40d61b,_0x24081e,_0x394a00,_0x43c8ed);})[_0x97e4('0xd')](function(_0x50040e){fileLogger(_0x97e4('0xa'))[_0x97e4('0x13')](_0x50040e);});};}function setupLoggers(_0x22e7a0){return new Promise(function(_0x3a1789){var _0x49218d=new ClientSideLogger();var _0xba8fcd=fileLogger(_0x97e4('0x14'));var _0x5057ca=fileLogger(_0x97e4('0x15'));_0x22e7a0[_0x97e4('0x16')](_0x97e4('0x17'),_0x49218d);_0x22e7a0[_0x97e4('0x18')](ewinston[_0x97e4('0x19')]({'winstonInstance':_0xba8fcd,'meta':![],'statusLevels':!![],'msg':function(_0x2b3939,_0x4a3c75){var _0x4899e3=_0x97e4('0x1a');if(!_['isEmpty'](_0x2b3939[_0x97e4('0x1b')])){_0x4899e3+=_0x97e4('0x1c');var _0x39bc6a=_0x2b3939[_0x97e4('0x1b')];maskSensitiveData(_0x39bc6a);}return safeTemplate(util[_0x97e4('0x1d')](_0x4899e3,_0x2b3939[_0x97e4('0x1e')],_0x2b3939[_0x97e4('0x1f')][_0x97e4('0x20')]?_0x2b3939[_0x97e4('0x1f')][_0x97e4('0x20')]:_0x2b3939[_0x97e4('0x21')][_0x97e4('0x22')]||_0x2b3939['ip'],_0x2b3939[_0x97e4('0x23')],_0x4a3c75['statusCode'],_0x4a3c75['responseTime'],_0x2b3939[_0x97e4('0xe')]?_0x2b3939[_0x97e4('0xe')]['id']:null,_0x2b3939[_0x97e4('0xe')]?_0x2b3939[_0x97e4('0xe')]['name']:null,_0x2b3939[_0x97e4('0xe')]?_0x2b3939['user'][_0x97e4('0xb')]:null,_0x39bc6a?util['inspect'](_0x39bc6a,![],null):''));}}));_0x22e7a0[_0x97e4('0x18')](ewinston[_0x97e4('0x19')]({'winstonInstance':_0x5057ca,'meta':![],'statusLevels':!![],'msg':function(_0x14fc3d,_0x52ece0){var _0x5f11f0=_0x97e4('0x24');if(_0x14fc3d[_0x97e4('0x1b')]&&_0x14fc3d[_0x97e4('0x1b')]['device']&&_0x14fc3d[_0x97e4('0x1b')]['agent_id']){_0x5f11f0=_0x97e4('0x25');}return util['format'](_0x5f11f0,_0x14fc3d['method'],_0x14fc3d[_0x97e4('0x1f')][_0x97e4('0x20')]?_0x14fc3d['headers'][_0x97e4('0x20')]:_0x14fc3d[_0x97e4('0x21')]['remoteAddress']||_0x14fc3d['ip'],_0x14fc3d['url'],_0x52ece0[_0x97e4('0x26')],_0x52ece0['responseTime'],_0x14fc3d[_0x97e4('0xe')]?_0x14fc3d['user']['id']:null,_0x14fc3d[_0x97e4('0xe')]?_0x14fc3d[_0x97e4('0xe')][_0x97e4('0x27')]:null,_0x14fc3d['user']?_0x14fc3d[_0x97e4('0xe')][_0x97e4('0xb')]:null,_0x14fc3d[_0x97e4('0x1b')]&&_0x14fc3d[_0x97e4('0x1b')][_0x97e4('0x28')]?_0x14fc3d[_0x97e4('0x1b')][_0x97e4('0x28')]:_0x97e4('0x29'),_0x14fc3d[_0x97e4('0x1b')]&&_0x14fc3d[_0x97e4('0x1b')]['agent_id']?_0x14fc3d[_0x97e4('0x1b')][_0x97e4('0x2a')]:'',_0x14fc3d[_0x97e4('0x1b')]&&_0x14fc3d[_0x97e4('0x1b')][_0x97e4('0x2b')]?_0x14fc3d['body'][_0x97e4('0x2b')]:'');},'ignoreRoute':function(_0x11e721){var _0x32e0b9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x32e0b9[_0x97e4('0x2c')](_0x11e721[_0x97e4('0x23')]);}}));return _0x3a1789();});}exports[_0x97e4('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 15169f7..7e076a4 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ad5=['lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','exports','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','test','isMoment','padStart','length','iftime'];(function(_0x356102,_0xdb5cc8){var _0x4faa04=function(_0x36113d){while(--_0x36113d){_0x356102['push'](_0x356102['shift']());}};_0x4faa04(++_0xdb5cc8);}(_0x8ad5,0xde));var _0x58ad=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8ad5[_0x134c2e];return _0x2825db;};var _=require(_0x58ad('0x0'));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][_0x58ad('0x1')](function(_0x2bd0a6){return _0x2bd0a6[_0x58ad('0x2')];})[_0x58ad('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x58ad('0x4');var EINVALID_DATE=_0x58ad('0x5');function throwIfDateNotValid(_0x2b60aa){if(!_0x2b60aa['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x45057e){var _0x41b84b=_0x45057e[_0x58ad('0x6')](':')[_0x58ad('0x1')](function(_0x37317a){return parseInt(_0x37317a,0xa);});var _0x4ea062=_0x41b84b[0x0];var _0x4856bb=_0x41b84b[0x1];if(_0x4ea062<0x0||_0x4ea062>0x17||_0x4856bb<0x0||_0x4856bb>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ea062,_0x4856bb];}function circularDoWInterval(_0x278ba8,_0x55a39e){if(_0x278ba8===_0x55a39e){return[_0x278ba8];}else{var _0x250bf2=moment[_0x58ad('0x7')]();moment[_0x58ad('0x7')]('en');var _0xc4edab=moment[_0x58ad('0x8')]()[_0x58ad('0x1')](function(_0x4e2349){return _0x4e2349['toLowerCase']();});moment[_0x58ad('0x7')](_0x250bf2);var _0x2d13ec=_0xc4edab[_0x58ad('0x9')](_0x278ba8);var _0x1ab8d4=_0xc4edab[_0x58ad('0x9')](_0x55a39e);if(_0x1ab8d4>_0x2d13ec){return _0xc4edab[_0x58ad('0xa')](_0x2d13ec,_0x1ab8d4+0x1);}else{var _0x3eaeff=_0xc4edab[_0x58ad('0xa')](0x0,_0x1ab8d4+0x1);var _0x1afc05=_0xc4edab[_0x58ad('0xa')](_0x2d13ec);return _0x1afc05[_0x58ad('0xb')](_0x3eaeff);}}}module[_0x58ad('0xc')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x5e87e7,_0x43d0bd){if(_0x5e87e7===_0x43d0bd){return[_0x5e87e7];}else{var _0x4cc636=moment[_0x58ad('0x7')]();moment[_0x58ad('0x7')]('en');var _0x3cee92=moment[_0x58ad('0xd')]()['map'](function(_0x8941ed){return _0x8941ed[_0x58ad('0xe')]();});moment[_0x58ad('0x7')](_0x4cc636);var _0x1bea05=_0x3cee92[_0x58ad('0x9')](_0x5e87e7);var _0x26cef4=_0x3cee92[_0x58ad('0x9')](_0x43d0bd);if(_0x26cef4>_0x1bea05){return _0x3cee92['slice'](_0x1bea05,_0x26cef4+0x1);}else{var _0x445920=_0x3cee92[_0x58ad('0xa')](0x0,_0x26cef4+0x1);var _0x8ebc2=_0x3cee92['slice'](_0x1bea05);return _0x8ebc2[_0x58ad('0xb')](_0x445920);}}}module['exports'][_0x58ad('0xf')]=circularMonthInterval;function parseDom(_0x4cf275){var _0x17a3c8=parseInt(_0x4cf275,0xa);if(_0x17a3c8<0x1||_0x17a3c8>0x1f){throw new Error(EINVALID_DATE);}return _0x17a3c8;}function timeCompare(_0x120da1,_0x25aa21,_0x18432d){var _0x318824=_0x120da1[_0x58ad('0x10')]();var _0x4e597e=extractTime(_0x25aa21);var _0x17bb00=_0x4e597e[0x0];var _0x24a820=_0x4e597e[0x1];var _0x500a1b=_0x120da1[_0x58ad('0x10')]()[_0x58ad('0x11')](_0x17bb00)[_0x58ad('0x12')](_0x24a820);throwIfDateNotValid(_0x500a1b);var _0x10cc76=extractTime(_0x18432d);var _0x1723c7=_0x10cc76[0x0];var _0xecbf80=_0x10cc76[0x1];var _0x5911c0=_0x120da1[_0x58ad('0x10')]()[_0x58ad('0x11')](_0x1723c7)[_0x58ad('0x12')](_0xecbf80);throwIfDateNotValid(_0x5911c0);if(_0x5911c0['isBefore'](_0x500a1b)){var _0x5aa6bf=_0x318824['clone']()['startOf'](_0x58ad('0x13'));var _0x30d6c4=_0x318824[_0x58ad('0x10')]()[_0x58ad('0x14')]('day');return _0x318824[_0x58ad('0x15')](_0x500a1b,_0x30d6c4,undefined,'[]')||_0x318824['isBetween'](_0x5aa6bf,_0x5911c0,undefined,'[]');}else{return _0x318824[_0x58ad('0x15')](_0x500a1b,_0x5911c0,undefined,'[]');}}module['exports'][_0x58ad('0x16')]=timeCompare;function dowCompare(_0x8f431f,_0x192f8a,_0x42eb88){var _0x4199e0=_0x8f431f[_0x58ad('0x7')]('en')[_0x58ad('0x17')](_0x58ad('0x18'))[_0x58ad('0xe')]();return circularDoWInterval(_0x192f8a,_0x42eb88)['includes'](_0x4199e0);}module[_0x58ad('0xc')][_0x58ad('0x19')]=dowCompare;function domCompare(_0x37c985,_0x1bd972,_0x34b345){var _0x5a289e=_0x37c985['date']();if(_0x1bd972===_0x34b345){return _0x5a289e===_0x1bd972;}else{var _0x3a4f84=_0x37c985[_0x58ad('0x1a')]();var _0x13b9d9=_0x1bd972<_0x34b345;let _0x2f14e6=![];var _0x1014ee=0x0;var _0x305174=0x0;if(_0x13b9d9){_0x1014ee=Math[_0x58ad('0x1b')](0x1,_0x1bd972);_0x305174=Math[_0x58ad('0x1c')](_0x34b345,_0x3a4f84);_0x2f14e6=_0x5a289e>=_0x1014ee&&_0x5a289e<=_0x305174;}else{_0x1014ee=Math[_0x58ad('0x1c')](_0x1bd972,_0x3a4f84);_0x305174=Math['max'](0x1,_0x34b345);_0x2f14e6=_0x5a289e>=_0x1014ee||_0x5a289e<=_0x305174;}return _0x2f14e6;}}module[_0x58ad('0xc')][_0x58ad('0x1d')]=domCompare;function monthCompare(_0xaea2f4,_0x3963b2,_0x126622){var _0x656f74=_0xaea2f4[_0x58ad('0x7')]('en')[_0x58ad('0x17')](_0x58ad('0x1e'))[_0x58ad('0xe')]();return circularMonthInterval(_0x3963b2,_0x126622)['includes'](_0x656f74);}module['exports'][_0x58ad('0x1f')]=monthCompare;function iftime(_0x240c4c,_0x15e4b7=moment['tz']['guess'](),_0x3e852b=moment()){if(!validateRx[_0x58ad('0x20')](_0x240c4c)){throw new Error(EINVALID_STRING);}else{var _0x64f8ac=(moment[_0x58ad('0x21')](_0x3e852b)?_0x3e852b['clone']():moment(_0x3e852b))['tz'](_0x15e4b7)[_0x58ad('0x7')]('en');throwIfDateNotValid(_0x64f8ac);var _0xc8bb89=_0x240c4c['split'](',');var _0x36a272=_0xc8bb89[0x0];var _0x52d4c1=_0xc8bb89[0x1];var _0x1689cb=_0xc8bb89[0x2];var _0x2645ff=_0xc8bb89[0x3];let _0x2e77ee=!![];if(_0x36a272!=='*'){var _0x54bf55=_0x36a272[_0x58ad('0x6')]('-');var _0x314922=_[_0x58ad('0x22')](_0x54bf55[0x0],0x5,'0');var _0x549fd0=_0x54bf55[_0x58ad('0x23')]===0x2?_[_0x58ad('0x22')](_0x54bf55[0x1],0x5,'0'):_0x314922;_0x2e77ee=timeCompare(_0x64f8ac,_0x314922,_0x549fd0);}let _0x3ad788=!![];if(_0x52d4c1!=='*'){var _0x2c79b7=_0x52d4c1[_0x58ad('0x6')]('-');var _0x1ee220=_0x2c79b7[0x0];var _0x5df2f5=_0x2c79b7[_0x58ad('0x23')]===0x2?_0x2c79b7[0x1]:_0x1ee220;_0x3ad788=dowCompare(_0x64f8ac,_0x1ee220,_0x5df2f5);}let _0x9c7bfc=!![];if(_0x1689cb!=='*'){var _0x358d77=_0x1689cb[_0x58ad('0x6')]('-');var _0x5717c5=parseDom(_0x358d77[0x0]);var _0x19c57e=_0x358d77[_0x58ad('0x23')]===0x2?parseDom(_0x358d77[0x1]):_0x5717c5;_0x9c7bfc=domCompare(_0x64f8ac,_0x5717c5,_0x19c57e);}let _0xdf4612=!![];if(_0x2645ff!=='*'){var _0x33dfe6=_0x2645ff[_0x58ad('0x6')]('-');var _0x24f6d8=_0x33dfe6[0x0];var _0x173dd1=_0x33dfe6[_0x58ad('0x23')]===0x2?_0x33dfe6[0x1]:_0x33dfe6[0x0];_0xdf4612=monthCompare(_0x64f8ac,_0x24f6d8,_0x173dd1);}return _0x2e77ee&&_0x3ad788&&_0x9c7bfc&&_0xdf4612;}}module['exports'][_0x58ad('0x24')]=iftime; \ No newline at end of file +var _0x347f=['dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes'];(function(_0x41f0d4,_0x3568c0){var _0x2a5250=function(_0x31ec86){while(--_0x31ec86){_0x41f0d4['push'](_0x41f0d4['shift']());}};_0x2a5250(++_0x3568c0);}(_0x347f,0x64));var _0xf347=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x347f[_0xa464c9];return _0x3d73c4;};var _=require(_0xf347('0x0'));var moment=require(_0xf347('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][_0xf347('0x2')](function(_0x2ea165){return _0x2ea165[_0xf347('0x3')];})[_0xf347('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf347('0x5');var EINVALID_DATE=_0xf347('0x6');function throwIfDateNotValid(_0x2b35d8){if(!_0x2b35d8[_0xf347('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1e15fd){var _0x287acb=_0x1e15fd[_0xf347('0x8')](':')[_0xf347('0x2')](function(_0x4e06f1){return parseInt(_0x4e06f1,0xa);});var _0x5effb8=_0x287acb[0x0];var _0x3cd2bb=_0x287acb[0x1];if(_0x5effb8<0x0||_0x5effb8>0x17||_0x3cd2bb<0x0||_0x3cd2bb>0x3b){throw new Error(EINVALID_DATE);}return[_0x5effb8,_0x3cd2bb];}function circularDoWInterval(_0x1e373d,_0x439f21){if(_0x1e373d===_0x439f21){return[_0x1e373d];}else{var _0x3b2d96=moment[_0xf347('0x9')]();moment[_0xf347('0x9')]('en');var _0x4815bc=moment[_0xf347('0xa')]()[_0xf347('0x2')](function(_0x5b34d3){return _0x5b34d3[_0xf347('0xb')]();});moment['locale'](_0x3b2d96);var _0x2eac49=_0x4815bc[_0xf347('0xc')](_0x1e373d);var _0x2a24d6=_0x4815bc[_0xf347('0xc')](_0x439f21);if(_0x2a24d6>_0x2eac49){return _0x4815bc[_0xf347('0xd')](_0x2eac49,_0x2a24d6+0x1);}else{var _0x7cc22f=_0x4815bc[_0xf347('0xd')](0x0,_0x2a24d6+0x1);var _0x2faa81=_0x4815bc[_0xf347('0xd')](_0x2eac49);return _0x2faa81['concat'](_0x7cc22f);}}}module[_0xf347('0xe')][_0xf347('0xf')]=circularDoWInterval;function circularMonthInterval(_0x23d9dc,_0x1caabd){if(_0x23d9dc===_0x1caabd){return[_0x23d9dc];}else{var _0x25de20=moment[_0xf347('0x9')]();moment[_0xf347('0x9')]('en');var _0x3c8521=moment['monthsShort']()[_0xf347('0x2')](function(_0x313c13){return _0x313c13[_0xf347('0xb')]();});moment['locale'](_0x25de20);var _0x34d0c3=_0x3c8521[_0xf347('0xc')](_0x23d9dc);var _0x3dcd0e=_0x3c8521[_0xf347('0xc')](_0x1caabd);if(_0x3dcd0e>_0x34d0c3){return _0x3c8521[_0xf347('0xd')](_0x34d0c3,_0x3dcd0e+0x1);}else{var _0xb8af1a=_0x3c8521[_0xf347('0xd')](0x0,_0x3dcd0e+0x1);var _0x14bb13=_0x3c8521['slice'](_0x34d0c3);return _0x14bb13['concat'](_0xb8af1a);}}}module[_0xf347('0xe')][_0xf347('0x10')]=circularMonthInterval;function parseDom(_0x1c3f66){var _0x20fd5a=parseInt(_0x1c3f66,0xa);if(_0x20fd5a<0x1||_0x20fd5a>0x1f){throw new Error(EINVALID_DATE);}return _0x20fd5a;}function timeCompare(_0x132b90,_0x5c144c,_0x5d2c63){var _0x3d85f9=_0x132b90[_0xf347('0x11')]();var _0x5f5364=extractTime(_0x5c144c);var _0x1d93f0=_0x5f5364[0x0];var _0x17402a=_0x5f5364[0x1];var _0x2b1510=_0x132b90[_0xf347('0x11')]()[_0xf347('0x12')](_0x1d93f0)[_0xf347('0x13')](_0x17402a);throwIfDateNotValid(_0x2b1510);var _0x3a0614=extractTime(_0x5d2c63);var _0x544929=_0x3a0614[0x0];var _0x5b64e1=_0x3a0614[0x1];var _0x24fc18=_0x132b90[_0xf347('0x11')]()['hours'](_0x544929)[_0xf347('0x13')](_0x5b64e1);throwIfDateNotValid(_0x24fc18);if(_0x24fc18[_0xf347('0x14')](_0x2b1510)){var _0x42cfa2=_0x3d85f9[_0xf347('0x11')]()[_0xf347('0x15')](_0xf347('0x16'));var _0x5ea61d=_0x3d85f9[_0xf347('0x11')]()[_0xf347('0x17')](_0xf347('0x16'));return _0x3d85f9[_0xf347('0x18')](_0x2b1510,_0x5ea61d,undefined,'[]')||_0x3d85f9[_0xf347('0x18')](_0x42cfa2,_0x24fc18,undefined,'[]');}else{return _0x3d85f9['isBetween'](_0x2b1510,_0x24fc18,undefined,'[]');}}module[_0xf347('0xe')][_0xf347('0x19')]=timeCompare;function dowCompare(_0x1f5171,_0x47c6bd,_0x288109){var _0x27a54b=_0x1f5171[_0xf347('0x9')]('en')[_0xf347('0x1a')](_0xf347('0x1b'))['toLowerCase']();return circularDoWInterval(_0x47c6bd,_0x288109)[_0xf347('0x1c')](_0x27a54b);}module[_0xf347('0xe')][_0xf347('0x1d')]=dowCompare;function domCompare(_0x36be90,_0x2688b4,_0x3f998e){var _0x314fda=_0x36be90[_0xf347('0x1e')]();if(_0x2688b4===_0x3f998e){return _0x314fda===_0x2688b4;}else{var _0x1800ad=_0x36be90[_0xf347('0x1f')]();var _0x4c4677=_0x2688b4<_0x3f998e;let _0x3fd395=![];var _0x2a89cb=0x0;var _0xb37b2a=0x0;if(_0x4c4677){_0x2a89cb=Math[_0xf347('0x20')](0x1,_0x2688b4);_0xb37b2a=Math[_0xf347('0x21')](_0x3f998e,_0x1800ad);_0x3fd395=_0x314fda>=_0x2a89cb&&_0x314fda<=_0xb37b2a;}else{_0x2a89cb=Math[_0xf347('0x21')](_0x2688b4,_0x1800ad);_0xb37b2a=Math[_0xf347('0x20')](0x1,_0x3f998e);_0x3fd395=_0x314fda>=_0x2a89cb||_0x314fda<=_0xb37b2a;}return _0x3fd395;}}module[_0xf347('0xe')][_0xf347('0x22')]=domCompare;function monthCompare(_0x760b07,_0x3ba444,_0x2fd630){var _0x4abf12=_0x760b07[_0xf347('0x9')]('en')['format'](_0xf347('0x23'))[_0xf347('0xb')]();return circularMonthInterval(_0x3ba444,_0x2fd630)[_0xf347('0x1c')](_0x4abf12);}module[_0xf347('0xe')][_0xf347('0x24')]=monthCompare;function iftime(_0x32c76b,_0x4f7fee=moment['tz'][_0xf347('0x25')](),_0x228a24=moment()){if(!validateRx[_0xf347('0x26')](_0x32c76b)){throw new Error(EINVALID_STRING);}else{var _0x5aea71=(moment[_0xf347('0x27')](_0x228a24)?_0x228a24['clone']():moment(_0x228a24))['tz'](_0x4f7fee)[_0xf347('0x9')]('en');throwIfDateNotValid(_0x5aea71);var _0x291bf1=_0x32c76b['split'](',');var _0x273290=_0x291bf1[0x0];var _0x58596a=_0x291bf1[0x1];var _0x39753b=_0x291bf1[0x2];var _0x49625c=_0x291bf1[0x3];let _0x4caddb=!![];if(_0x273290!=='*'){var _0xf8fae5=_0x273290[_0xf347('0x8')]('-');var _0x282e4c=_[_0xf347('0x28')](_0xf8fae5[0x0],0x5,'0');var _0x24b4c8=_0xf8fae5[_0xf347('0x29')]===0x2?_[_0xf347('0x28')](_0xf8fae5[0x1],0x5,'0'):_0x282e4c;_0x4caddb=timeCompare(_0x5aea71,_0x282e4c,_0x24b4c8);}let _0x5c3bef=!![];if(_0x58596a!=='*'){var _0x5af196=_0x58596a[_0xf347('0x8')]('-');var _0x60c810=_0x5af196[0x0];var _0x67da94=_0x5af196[_0xf347('0x29')]===0x2?_0x5af196[0x1]:_0x60c810;_0x5c3bef=dowCompare(_0x5aea71,_0x60c810,_0x67da94);}let _0x429473=!![];if(_0x39753b!=='*'){var _0x54a05b=_0x39753b[_0xf347('0x8')]('-');var _0xf5efef=parseDom(_0x54a05b[0x0]);var _0x5e2137=_0x54a05b[_0xf347('0x29')]===0x2?parseDom(_0x54a05b[0x1]):_0xf5efef;_0x429473=domCompare(_0x5aea71,_0xf5efef,_0x5e2137);}let _0x154c70=!![];if(_0x49625c!=='*'){var _0x2713d9=_0x49625c['split']('-');var _0x2cc9ec=_0x2713d9[0x0];var _0x4819a4=_0x2713d9[_0xf347('0x29')]===0x2?_0x2713d9[0x1]:_0x2713d9[0x0];_0x154c70=monthCompare(_0x5aea71,_0x2cc9ec,_0x4819a4);}return _0x4caddb&&_0x5c3bef&&_0x429473&&_0x154c70;}}module['exports'][_0xf347('0x2a')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 147dfe2..c0eebfd 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8313=['meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','Console','warn','transports','File','%s-%s','error','fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','addColors','join','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','{{{'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8313,0x1bb));var _0x3831=function(_0x3d0630,_0x476fe6){_0x3d0630=_0x3d0630-0x0;var _0x382f56=_0x8313[_0x3d0630];return _0x382f56;};'use strict';var path=require('path');var util=require(_0x3831('0x0'));var moment=require(_0x3831('0x1'));var winston=require(_0x3831('0x2'));var config=require(_0x3831('0x3'));var debugLevel=config[_0x3831('0x4')]?config[_0x3831('0x4')][_0x3831('0x5')]():_0x3831('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':_0x3831('0x7'),'error':_0x3831('0x8'),'warn':_0x3831('0x9'),'info':_0x3831('0xa'),'print':_0x3831('0xb'),'success':_0x3831('0xc'),'http':'gray','verbose':_0x3831('0xd'),'debug':_0x3831('0xe'),'silly':'bold\x20cyan'};winston[_0x3831('0xf')](XC_LOG_COLORS);function getLogFileName(_0x19a6ac,_0xde28ea,_0x3b5ecc){var _0x416b03=_0x19a6ac||'/var/log/xcally';return path[_0x3831('0x10')](_0x416b03,util['format'](_0x3831('0x11'),_0xde28ea,_0x3b5ecc));}function formatter(_0x387f6c,_0x5d6e45){_0x5d6e45['message']=_0x5d6e45[_0x3831('0x12')][_0x3831('0x13')](/@@{/g,'{{{')[_0x3831('0x13')](/}@@/g,_0x3831('0x14'))[_0x3831('0x13')](/@{/g,'{{')[_0x3831('0x13')](/}@/g,'}}');return util[_0x3831('0x15')](_0x3831('0x16'),moment()[_0x3831('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),_0x5d6e45['level'][_0x3831('0x17')](),_0x387f6c,_0x5d6e45['message']);}function fileFormat(_0x11596c,_0x38f035){_0x38f035[_0x3831('0x12')]=_0x38f035[_0x3831('0x12')]['replace'](/@@{/g,_0x3831('0x18'))[_0x3831('0x13')](/}@@/g,'}}}')[_0x3831('0x13')](/@{/g,'{{')[_0x3831('0x13')](/}@/g,'}}');var _0x1499b2=_0x38f035[_0x3831('0x19')]&&Object[_0x3831('0x1a')](_0x38f035[_0x3831('0x19')])[_0x3831('0x1b')]?'\x0a\x09'+JSON[_0x3831('0x1c')](_0x38f035['meta']):'';return util[_0x3831('0x15')](_0x3831('0x1d'),moment()[_0x3831('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),_0x38f035[_0x3831('0x1e')][_0x3831('0x17')](),_0x11596c,_0x38f035['message'],_0x1499b2);}function consoleLogger(){var _0x1d02c8=new winston[(_0x3831('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x3831('0x20'))]({'level':_0x3831('0x21'),'json':![],'formatter':function(_0x2cf003){return formatter('',_0x2cf003);}})]});return _0x1d02c8;}function fileLogger(_0x3083fe,_0x31e7d2){var _0xe053f2=new winston[(_0x3831('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3831('0x22'))][(_0x3831('0x23'))]({'name':util[_0x3831('0x15')](_0x3831('0x24'),_0x3083fe,_0x3831('0x25')),'filename':getLogFileName(_0x31e7d2,_0x3083fe,_0x3831('0x25')),'level':_0x3831('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c87d1){return fileFormat(_0x3083fe,_0x1c87d1);}}),new winston[(_0x3831('0x22'))][(_0x3831('0x23'))]({'name':util[_0x3831('0x15')](_0x3831('0x24'),_0x3083fe,debugLevel),'filename':getLogFileName(_0x31e7d2,_0x3083fe,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa3da38){return fileFormat(_0x3083fe,_0xa3da38);}}),new winston['transports']['Console']({'level':_0x3831('0x21'),'json':![],'formatter':function(_0x4c6e40){return fileFormat(_0x3083fe,_0x4c6e40);}})]});return _0xe053f2;}exports['consoleLogger']=consoleLogger;exports[_0x3831('0x26')]=fileLogger; \ No newline at end of file +var _0xff88=['length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','debugLevel','toLowerCase','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys'];(function(_0x263f54,_0x19f6ee){var _0x53f1af=function(_0x1147b6){while(--_0x1147b6){_0x263f54['push'](_0x263f54['shift']());}};_0x53f1af(++_0x19f6ee);}(_0xff88,0x10f));var _0x8ff8=function(_0x387ede,_0x20dbcc){_0x387ede=_0x387ede-0x0;var _0x41ff0d=_0xff88[_0x387ede];return _0x41ff0d;};'use strict';var path=require(_0x8ff8('0x0'));var util=require('util');var moment=require('moment');var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x8ff8('0x1')]?config['debugLevel'][_0x8ff8('0x2')]():'info';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':_0x8ff8('0x3'),'error':'red','warn':_0x8ff8('0x4'),'info':_0x8ff8('0x5'),'print':_0x8ff8('0x6'),'success':_0x8ff8('0x7'),'http':_0x8ff8('0x8'),'verbose':_0x8ff8('0x9'),'debug':_0x8ff8('0xa'),'silly':_0x8ff8('0xb')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x315c8f,_0xb29f3,_0x228b5d){var _0x5ba5f4=_0x315c8f||'/var/log/xcally';return path[_0x8ff8('0xc')](_0x5ba5f4,util[_0x8ff8('0xd')](_0x8ff8('0xe'),_0xb29f3,_0x228b5d));}function formatter(_0x423d53,_0x22d808){_0x22d808['message']=_0x22d808[_0x8ff8('0xf')][_0x8ff8('0x10')](/@@{/g,_0x8ff8('0x11'))['replace'](/}@@/g,_0x8ff8('0x12'))[_0x8ff8('0x10')](/@{/g,'{{')[_0x8ff8('0x10')](/}@/g,'}}');return util[_0x8ff8('0xd')](_0x8ff8('0x13'),moment()[_0x8ff8('0xd')](_0x8ff8('0x14')),_0x22d808[_0x8ff8('0x15')][_0x8ff8('0x16')](),_0x423d53,_0x22d808['message']);}function fileFormat(_0x56e37a,_0x2a355d){_0x2a355d[_0x8ff8('0xf')]=_0x2a355d[_0x8ff8('0xf')][_0x8ff8('0x10')](/@@{/g,_0x8ff8('0x11'))[_0x8ff8('0x10')](/}@@/g,_0x8ff8('0x12'))[_0x8ff8('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1b5d43=_0x2a355d[_0x8ff8('0x17')]&&Object[_0x8ff8('0x18')](_0x2a355d['meta'])[_0x8ff8('0x19')]?'\x0a\x09'+JSON[_0x8ff8('0x1a')](_0x2a355d[_0x8ff8('0x17')]):'';return util[_0x8ff8('0xd')](_0x8ff8('0x1b'),moment()[_0x8ff8('0xd')](_0x8ff8('0x14')),_0x2a355d[_0x8ff8('0x15')]['toUpperCase'](),_0x56e37a,_0x2a355d[_0x8ff8('0xf')],_0x1b5d43);}function consoleLogger(){var _0x2a18bc=new winston[(_0x8ff8('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8ff8('0x1d'))][(_0x8ff8('0x1e'))]({'level':_0x8ff8('0x1f'),'json':![],'formatter':function(_0x4ef68e){return formatter('',_0x4ef68e);}})]});return _0x2a18bc;}function fileLogger(_0x3855b9,_0x1fdcff){var _0x2ec022=new winston[(_0x8ff8('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8ff8('0x1d'))][(_0x8ff8('0x20'))]({'name':util[_0x8ff8('0xd')](_0x8ff8('0x21'),_0x3855b9,'error'),'filename':getLogFileName(_0x1fdcff,_0x3855b9,_0x8ff8('0x22')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x207f25){return fileFormat(_0x3855b9,_0x207f25);}}),new winston[(_0x8ff8('0x1d'))]['File']({'name':util[_0x8ff8('0xd')](_0x8ff8('0x21'),_0x3855b9,debugLevel),'filename':getLogFileName(_0x1fdcff,_0x3855b9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf51357){return fileFormat(_0x3855b9,_0xf51357);}}),new winston[(_0x8ff8('0x1d'))][(_0x8ff8('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x2126c3){return fileFormat(_0x3855b9,_0x2126c3);}})]});return _0x2ec022;}exports[_0x8ff8('0x23')]=consoleLogger;exports[_0x8ff8('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index d6f721b..6dd5879 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x1acfa5,_0x56ebd9){var _0x9c20c8=function(_0x5394da){while(--_0x5394da){_0x1acfa5['push'](_0x1acfa5['shift']());}};_0x9c20c8(++_0x56ebd9);}(_0xadb5,0xad));var _0x5adb=function(_0x487a20,_0x607d52){_0x487a20=_0x487a20-0x0;var _0x3fd40c=_0xadb5[_0x487a20];return _0x3fd40c;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x1fbd72,_0x5b353f){var _0x47e61a=function(_0x24581a){while(--_0x24581a){_0x1fbd72['push'](_0x1fbd72['shift']());}};_0x47e61a(++_0x5b353f);}(_0x2ef3,0xba));var _0x32ef=function(_0x543c30,_0x4a012c){_0x543c30=_0x543c30-0x0;var _0x37b89c=_0x2ef3[_0x543c30];return _0x37b89c;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index f7f1d73..f78d80d 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 _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x280a18,_0x269e99){var _0x21f648=function(_0x5699fb){while(--_0x5699fb){_0x280a18['push'](_0x280a18['shift']());}};_0x21f648(++_0x269e99);}(_0x4024,0x89));var _0x4402=function(_0x3513ed,_0x1a671e){_0x3513ed=_0x3513ed-0x0;var _0x4a70aa=_0x4024[_0x3513ed];return _0x4a70aa;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x8f4c=['map','isPlainObject','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','replace','isArray'];(function(_0xd0a8f2,_0x3de485){var _0x212cd1=function(_0x211c5d){while(--_0x211c5d){_0xd0a8f2['push'](_0xd0a8f2['shift']());}};_0x212cd1(++_0x3de485);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3394b4,_0x4d8898){_0x3394b4=_0x3394b4-0x0;var _0x2acad2=_0x8f4c[_0x3394b4];return _0x2acad2;};var _=require(_0xc8f4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x292fb6){return _0x292fb6==='{{'?_0xc8f4('0x1'):_0xc8f4('0x2');}function safeTemplate(_0x19893b){var _0x134d73=_0x19893b;if(typeof _0x19893b==='string'){_0x134d73=_0x19893b[_0xc8f4('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc8f4('0x4')](_0x19893b)){_0x134d73=_0x19893b[_0xc8f4('0x5')](function(_0x56c9b1){return safeTemplate(_0x56c9b1);});}else if(_[_0xc8f4('0x6')](_0x19893b)){_0x134d73=Object['keys'](_0x19893b)['reduce'](function(_0x520063,_0x373506){_0x520063[_0x373506]=safeTemplate(_0x19893b[_0x373506]);return _0x520063;},{});}return _0x134d73;}module['exports'][_0xc8f4('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 588977f..00c2dcb 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 _0x1f16=['resolve','legacy-libs','isArray','apps','findIndex','motion2','env','NODE_PATH','string','pathExists','readJSON','then','writeJSON','exports','fs-extra','path','../config/environment','root'];(function(_0x15732b,_0x191cac){var _0x251f3e=function(_0x47cae6){while(--_0x47cae6){_0x15732b['push'](_0x15732b['shift']());}};_0x251f3e(++_0x191cac);}(_0x1f16,0x1f4));var _0x61f1=function(_0x1f6154,_0x91c64e){_0x1f6154=_0x1f6154-0x0;var _0x8326c6=_0x1f16[_0x1f6154];return _0x8326c6;};var fs=require(_0x61f1('0x0'));var path=require(_0x61f1('0x1'));var config=require(_0x61f1('0x2'));var root=config[_0x61f1('0x3')];var APP_JSON_PATH=path[_0x61f1('0x4')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x61f1('0x5'));function setLegacyLibsNodeEnvPath(_0x312cd3){let _0x4b550a=![];if(Array[_0x61f1('0x6')](_0x312cd3[_0x61f1('0x7')])){var _0x4de99b=_0x312cd3[_0x61f1('0x7')][_0x61f1('0x8')](function(_0x55032c){return _0x55032c['name']===_0x61f1('0x9');});if(_0x4de99b>-0x1){var _0x1a5f63=_0x312cd3[_0x61f1('0x7')][_0x4de99b];if(typeof _0x1a5f63[_0x61f1('0xa')][_0x61f1('0xb')]!==_0x61f1('0xc')){_0x1a5f63[_0x61f1('0xa')][_0x61f1('0xb')]=NODEPATH;_0x4b550a=!![];}}return{'appConfig':_0x312cd3,'updated':_0x4b550a};}}function updateAppConfig(_0x2979fa){return fs[_0x61f1('0xd')](APP_JSON_PATH)['then'](function(_0x3e1e24){if(_0x3e1e24){return fs[_0x61f1('0xe')](APP_JSON_PATH)[_0x61f1('0xf')](function(_0x206bce){var _0x6baee8=setLegacyLibsNodeEnvPath(_0x206bce);if(_0x6baee8['updated']){_0x2979fa['info']('Updating\x20app.json');return fs[_0x61f1('0x10')](APP_JSON_PATH,_0x206bce,{'spaces':0x2});}else{return Promise[_0x61f1('0x4')]();}});}else{return Promise[_0x61f1('0x4')]();}});}module[_0x61f1('0x11')]=updateAppConfig; \ No newline at end of file +var _0x9dda=['pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','isArray','apps','findIndex','name','motion2','NODE_PATH','env'];(function(_0x301da6,_0x171999){var _0x4752b1=function(_0x4c4e8d){while(--_0x4c4e8d){_0x301da6['push'](_0x301da6['shift']());}};_0x4752b1(++_0x171999);}(_0x9dda,0x16d));var _0xa9dd=function(_0x4fbcdc,_0x556f6a){_0x4fbcdc=_0x4fbcdc-0x0;var _0xf5a902=_0x9dda[_0x4fbcdc];return _0xf5a902;};var fs=require(_0xa9dd('0x0'));var path=require(_0xa9dd('0x1'));var config=require(_0xa9dd('0x2'));var root=config[_0xa9dd('0x3')];var APP_JSON_PATH=path[_0xa9dd('0x4')](root,_0xa9dd('0x5'));var NODEPATH=path[_0xa9dd('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x24b408){let _0x169ee8=![];if(Array[_0xa9dd('0x6')](_0x24b408[_0xa9dd('0x7')])){var _0x365922=_0x24b408[_0xa9dd('0x7')][_0xa9dd('0x8')](function(_0xf635ce){return _0xf635ce[_0xa9dd('0x9')]===_0xa9dd('0xa');});if(_0x365922>-0x1){var _0x44077a=_0x24b408[_0xa9dd('0x7')][_0x365922];if(typeof _0x44077a['env'][_0xa9dd('0xb')]!=='string'){_0x44077a[_0xa9dd('0xc')][_0xa9dd('0xb')]=NODEPATH;_0x169ee8=!![];}}return{'appConfig':_0x24b408,'updated':_0x169ee8};}}function updateAppConfig(_0x36e192){return fs[_0xa9dd('0xd')](APP_JSON_PATH)[_0xa9dd('0xe')](function(_0x23f821){if(_0x23f821){return fs[_0xa9dd('0xf')](APP_JSON_PATH)[_0xa9dd('0xe')](function(_0x511ec0){var _0x1c6124=setLegacyLibsNodeEnvPath(_0x511ec0);if(_0x1c6124[_0xa9dd('0x10')]){_0x36e192[_0xa9dd('0x11')](_0xa9dd('0x12'));return fs[_0xa9dd('0x13')](APP_JSON_PATH,_0x511ec0,{'spaces':0x2});}else{return Promise[_0xa9dd('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xa9dd('0x14')]=updateAppConfig; \ No newline at end of file